diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright 2024 Biglup Labs
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/NATIVE_REVISION b/NATIVE_REVISION
new file mode 100644
--- /dev/null
+++ b/NATIVE_REVISION
@@ -0,0 +1,1 @@
+a6f659d780f17b60ebafa170af919cca8173df09
diff --git a/NOTICE b/NOTICE
new file mode 100644
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,37 @@
+Bundled cardano-c source package
+===============================
+
+cardano-c: Copyright Biglup Labs and contributors, Apache-2.0 (LICENSE).
+The source revision is recorded in NATIVE_REVISION. Original source notices
+are preserved. The Cabal description and config.h are generated by Cometa;
+no upstream C implementation is modified by packaging.
+
+This distribution contains multiple licenses. Its package license expression
+lists the requirements of the combined source payload; it does not relicense
+individual files. In particular, mini-gmp is not Apache-2.0 licensed.
+
+vendor/external/libsodium: ISC (libsodium/LICENSE), with original public-domain
+notices in individual files; SHA-256/SHA-512 by Colin Percival are BSD-2-Clause
+(the full notice is reproduced in licenses/libsodium-sha-BSD-2-Clause.txt).
+BLAKE2 reference files carry CC0 public-domain notices; CC0 is the selected
+license where alternatives are offered (licenses/CC0-1.0.txt).
+
+vendor/external/gmp: mini-gmp and mini-mpq by the Free Software Foundation and
+contributors, LGPL-3.0-or-later OR GPL-2.0-or-later. See gmp/README and the source
+headers, licenses/LGPL-3.0.txt, licenses/GPL-3.0.txt (incorporated by LGPL v3)
+and licenses/GPL-2.0.txt. Consumers distributing linked applications must satisfy
+the terms of their selected license, including its relinking/source provisions.
+
+vendor/external/sha3: MIT (sha3/LICENSE).
+vendor/external/secp256k1: MIT (secp256k1/COPYING).
+vendor/external/blst: Apache-2.0 (blst/LICENSE).
+
+vendor/external/ripemd160: public-domain dedication and fallback unrestricted
+license with warranty disclaimer (ripemd160/LICENSE). This component imposes no
+additional license conditions, so it adds no term to the package's SPDX license
+expression. Hackage rejects custom LicenseRef identifiers. The original
+dedication, fallback grant and disclaimer remain in the bundled LICENSE and
+source headers; this metadata representation does not change those notices.
+
+All paths above are relative to vendor/external unless given in full. Full
+upstream provenance is retained in vendor/external/README and VERSION files.
diff --git a/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,25 @@
+# cardano-c-clib
+
+Unpublished native source companion to the Cometa Haskell binding. Package
+version 0.1.1.0 bundles cardano-c 2.0.0-rc.7, revision `a6f659d780f17b60ebafa170af919cca8173df09`.
+
+This is a generated Cabal `build-type: Simple` package. Cabal compiles bundled
+C sources using its selected C toolchain and optimization settings. Consumers
+need no separately installed cardano-c library, CMake, Git or network download
+for the native build. Six private libraries isolate bundled dependencies;
+public cardano-c headers are installed by the main library for downstream FFI.
+
+The configuration uses upstream defaults (collection growth 1.5, JSON depth
+256), portable C blst, and upstream secp256k1 verification defines. Unix builds
+link math and pthread and enable libsodium's initialization mutex. Compiler and
+architecture selection remain the consumer toolchain's responsibility.
+
+Sources and original notices are in `vendor/`; the payload excludes native test
+suites, development scripts and build outputs. `NOTICE` and `licenses/` describe
+the mixed licensing, including mini-gmp's LGPL/GPL alternatives. The complete
+source is provided for consumers to rebuild and satisfy applicable license terms.
+
+Regenerate from the Cometa repository with
+`python3 tools/package-native.py /path/to/pinned/cardano-c`.
+The generator verifies the committed native pin and a clean tracked checkout;
+`--check` compares the generated package byte for byte without modifying it.
diff --git a/VERSION b/VERSION
new file mode 100644
--- /dev/null
+++ b/VERSION
@@ -0,0 +1,4 @@
+VERSION_MAJOR=2
+VERSION_MINOR=0
+VERSION_PATCH=0
+VERSION_PRERELEASE=rc.7
diff --git a/cardano-c-clib.cabal b/cardano-c-clib.cabal
new file mode 100644
--- /dev/null
+++ b/cardano-c-clib.cabal
@@ -0,0 +1,1714 @@
+cabal-version: 3.0
+name: cardano-c-clib
+version: 0.1.1.0
+synopsis: Bundled cardano-c native sources for Cometa
+description:
+  Compiles pinned cardano-c and its six bundled C dependencies with Cabal.
+  Installs the public native headers for Haskell FFI consumers. No CMake,
+  Git checkout or installed cardano-c is required when building this package.
+license: Apache-2.0 AND ISC AND BSD-2-Clause AND CC0-1.0 AND MIT AND (LGPL-3.0-or-later OR GPL-2.0-or-later)
+author: Biglup Labs and bundled dependency authors
+maintainer: angel.castillob@protonmail.com
+category: Blockchain
+homepage: https://github.com/Biglup/cometa.hs
+bug-reports: https://github.com/Biglup/cometa.hs/issues
+build-type: Simple
+license-files:
+  LICENSE
+  NOTICE
+  licenses/CC0-1.0.txt
+  licenses/GPL-2.0.txt
+  licenses/GPL-3.0.txt
+  licenses/LGPL-3.0.txt
+  licenses/libsodium-sha-BSD-2-Clause.txt
+  vendor/external/blst/LICENSE
+  vendor/external/libsodium/LICENSE
+  vendor/external/ripemd160/LICENSE
+  vendor/external/secp256k1/COPYING
+  vendor/external/sha3/LICENSE
+extra-source-files:
+  LICENSE
+  NATIVE_REVISION
+  NOTICE
+  README.md
+  VERSION
+  licenses/CC0-1.0.txt
+  licenses/GPL-2.0.txt
+  licenses/GPL-3.0.txt
+  licenses/LGPL-3.0.txt
+  licenses/libsodium-sha-BSD-2-Clause.txt
+  vendor/external/README
+  vendor/external/blst/LICENSE
+  vendor/external/blst/VERSION.txt
+  vendor/external/blst/bindings/blst.h
+  vendor/external/blst/bindings/blst_aux.h
+  vendor/external/blst/src/aggregate.c
+  vendor/external/blst/src/bulk_addition.c
+  vendor/external/blst/src/bytes.h
+  vendor/external/blst/src/consts.c
+  vendor/external/blst/src/consts.h
+  vendor/external/blst/src/cpuid.c
+  vendor/external/blst/src/e1.c
+  vendor/external/blst/src/e2.c
+  vendor/external/blst/src/ec_mult.h
+  vendor/external/blst/src/ec_ops.h
+  vendor/external/blst/src/errors.h
+  vendor/external/blst/src/exp.c
+  vendor/external/blst/src/exports.c
+  vendor/external/blst/src/fields.h
+  vendor/external/blst/src/fp12_tower.c
+  vendor/external/blst/src/hash_to_field.c
+  vendor/external/blst/src/keygen.c
+  vendor/external/blst/src/map_to_g1.c
+  vendor/external/blst/src/map_to_g2.c
+  vendor/external/blst/src/multi_scalar.c
+  vendor/external/blst/src/no_asm.h
+  vendor/external/blst/src/pairing.c
+  vendor/external/blst/src/pentaroot-addchain.h
+  vendor/external/blst/src/pentaroot.c
+  vendor/external/blst/src/point.h
+  vendor/external/blst/src/rb_tree.c
+  vendor/external/blst/src/recip-addchain.h
+  vendor/external/blst/src/recip.c
+  vendor/external/blst/src/server.c
+  vendor/external/blst/src/sha256.h
+  vendor/external/blst/src/sqrt-addchain.h
+  vendor/external/blst/src/sqrt.c
+  vendor/external/blst/src/vect.c
+  vendor/external/blst/src/vect.h
+  vendor/external/gmp/README
+  vendor/external/gmp/mini-gmp.c
+  vendor/external/gmp/mini-gmp.h
+  vendor/external/libsodium/LICENSE
+  vendor/external/libsodium/README.markdown
+  vendor/external/libsodium/crypto_aead/chacha20poly1305/aead_chacha20poly1305.c
+  vendor/external/libsodium/crypto_auth/crypto_auth.c
+  vendor/external/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c
+  vendor/external/libsodium/crypto_auth/hmacsha512/auth_hmacsha512.c
+  vendor/external/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c
+  vendor/external/libsodium/crypto_core/ed25519/core_ed25519.c
+  vendor/external/libsodium/crypto_core/ed25519/core_ristretto255.c
+  vendor/external/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c
+  vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/base.h
+  vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/base2.h
+  vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h
+  vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/fe.h
+  vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/base.h
+  vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/base2.h
+  vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h
+  vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/fe.h
+  vendor/external/libsodium/crypto_core/hchacha20/core_hchacha20.c
+  vendor/external/libsodium/crypto_core/hsalsa20/core_hsalsa20.c
+  vendor/external/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c
+  vendor/external/libsodium/crypto_core/salsa/ref/core_salsa_ref.c
+  vendor/external/libsodium/crypto_generichash/blake2b/generichash_blake2.c
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2.h
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.c
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.h
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.h
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-avx2.h
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse2.h
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse41.h
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c
+  vendor/external/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c
+  vendor/external/libsodium/crypto_generichash/crypto_generichash.c
+  vendor/external/libsodium/crypto_hash/crypto_hash.c
+  vendor/external/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c
+  vendor/external/libsodium/crypto_hash/sha256/hash_sha256.c
+  vendor/external/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c
+  vendor/external/libsodium/crypto_hash/sha512/hash_sha512.c
+  vendor/external/libsodium/crypto_onetimeauth/crypto_onetimeauth.c
+  vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.c
+  vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h
+  vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h
+  vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h
+  vendor/external/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c
+  vendor/external/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.h
+  vendor/external/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c
+  vendor/external/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.h
+  vendor/external/libsodium/crypto_scalarmult/crypto_scalarmult.c
+  vendor/external/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c
+  vendor/external/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.h
+  vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h
+  vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c
+  vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.h
+  vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h
+  vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h
+  vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c
+  vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_namespace.h
+  vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c
+  vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.h
+  vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h
+  vendor/external/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c
+  vendor/external/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.h
+  vendor/external/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c
+  vendor/external/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c
+  vendor/external/libsodium/crypto_sign/crypto_sign.c
+  vendor/external/libsodium/crypto_sign/ed25519/ref10/keypair.c
+  vendor/external/libsodium/crypto_sign/ed25519/ref10/obsolete.c
+  vendor/external/libsodium/crypto_sign/ed25519/ref10/open.c
+  vendor/external/libsodium/crypto_sign/ed25519/ref10/sign.c
+  vendor/external/libsodium/crypto_sign/ed25519/ref10/sign_ed25519_ref10.h
+  vendor/external/libsodium/crypto_sign/ed25519/sign_ed25519.c
+  vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c
+  vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.h
+  vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c
+  vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.h
+  vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u0.h
+  vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u1.h
+  vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u4.h
+  vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u8.h
+  vendor/external/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c
+  vendor/external/libsodium/crypto_stream/chacha20/ref/chacha20_ref.h
+  vendor/external/libsodium/crypto_stream/chacha20/stream_chacha20.c
+  vendor/external/libsodium/crypto_stream/chacha20/stream_chacha20.h
+  vendor/external/libsodium/crypto_stream/crypto_stream.c
+  vendor/external/libsodium/crypto_stream/salsa20/ref/salsa20_ref.c
+  vendor/external/libsodium/crypto_stream/salsa20/ref/salsa20_ref.h
+  vendor/external/libsodium/crypto_stream/salsa20/stream_salsa20.c
+  vendor/external/libsodium/crypto_stream/salsa20/stream_salsa20.h
+  vendor/external/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.c
+  vendor/external/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.h
+  vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.c
+  vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.h
+  vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c
+  vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.h
+  vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u0.h
+  vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u1.h
+  vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u4.h
+  vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u8.h
+  vendor/external/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012_ref.c
+  vendor/external/libsodium/crypto_stream/salsa2012/stream_salsa2012.c
+  vendor/external/libsodium/crypto_stream/salsa208/ref/stream_salsa208_ref.c
+  vendor/external/libsodium/crypto_stream/salsa208/stream_salsa208.c
+  vendor/external/libsodium/crypto_stream/xchacha20/stream_xchacha20.c
+  vendor/external/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c
+  vendor/external/libsodium/crypto_verify/verify.c
+  vendor/external/libsodium/include/sodium.h
+  vendor/external/libsodium/include/sodium/core.h
+  vendor/external/libsodium/include/sodium/crypto_aead_aegis128l.h
+  vendor/external/libsodium/include/sodium/crypto_aead_aegis256.h
+  vendor/external/libsodium/include/sodium/crypto_aead_aes256gcm.h
+  vendor/external/libsodium/include/sodium/crypto_aead_chacha20poly1305.h
+  vendor/external/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h
+  vendor/external/libsodium/include/sodium/crypto_auth.h
+  vendor/external/libsodium/include/sodium/crypto_auth_hmacsha256.h
+  vendor/external/libsodium/include/sodium/crypto_auth_hmacsha512.h
+  vendor/external/libsodium/include/sodium/crypto_auth_hmacsha512256.h
+  vendor/external/libsodium/include/sodium/crypto_box.h
+  vendor/external/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h
+  vendor/external/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h
+  vendor/external/libsodium/include/sodium/crypto_core_ed25519.h
+  vendor/external/libsodium/include/sodium/crypto_core_hchacha20.h
+  vendor/external/libsodium/include/sodium/crypto_core_hsalsa20.h
+  vendor/external/libsodium/include/sodium/crypto_core_ristretto255.h
+  vendor/external/libsodium/include/sodium/crypto_core_salsa20.h
+  vendor/external/libsodium/include/sodium/crypto_core_salsa2012.h
+  vendor/external/libsodium/include/sodium/crypto_core_salsa208.h
+  vendor/external/libsodium/include/sodium/crypto_generichash.h
+  vendor/external/libsodium/include/sodium/crypto_generichash_blake2b.h
+  vendor/external/libsodium/include/sodium/crypto_hash.h
+  vendor/external/libsodium/include/sodium/crypto_hash_sha256.h
+  vendor/external/libsodium/include/sodium/crypto_hash_sha512.h
+  vendor/external/libsodium/include/sodium/crypto_kdf.h
+  vendor/external/libsodium/include/sodium/crypto_kdf_blake2b.h
+  vendor/external/libsodium/include/sodium/crypto_kdf_hkdf_sha256.h
+  vendor/external/libsodium/include/sodium/crypto_kdf_hkdf_sha512.h
+  vendor/external/libsodium/include/sodium/crypto_kx.h
+  vendor/external/libsodium/include/sodium/crypto_onetimeauth.h
+  vendor/external/libsodium/include/sodium/crypto_onetimeauth_poly1305.h
+  vendor/external/libsodium/include/sodium/crypto_pwhash.h
+  vendor/external/libsodium/include/sodium/crypto_pwhash_argon2i.h
+  vendor/external/libsodium/include/sodium/crypto_pwhash_argon2id.h
+  vendor/external/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h
+  vendor/external/libsodium/include/sodium/crypto_scalarmult.h
+  vendor/external/libsodium/include/sodium/crypto_scalarmult_curve25519.h
+  vendor/external/libsodium/include/sodium/crypto_scalarmult_ed25519.h
+  vendor/external/libsodium/include/sodium/crypto_scalarmult_ristretto255.h
+  vendor/external/libsodium/include/sodium/crypto_secretbox.h
+  vendor/external/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h
+  vendor/external/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h
+  vendor/external/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h
+  vendor/external/libsodium/include/sodium/crypto_shorthash.h
+  vendor/external/libsodium/include/sodium/crypto_shorthash_siphash24.h
+  vendor/external/libsodium/include/sodium/crypto_sign.h
+  vendor/external/libsodium/include/sodium/crypto_sign_ed25519.h
+  vendor/external/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h
+  vendor/external/libsodium/include/sodium/crypto_stream.h
+  vendor/external/libsodium/include/sodium/crypto_stream_chacha20.h
+  vendor/external/libsodium/include/sodium/crypto_stream_salsa20.h
+  vendor/external/libsodium/include/sodium/crypto_stream_salsa2012.h
+  vendor/external/libsodium/include/sodium/crypto_stream_salsa208.h
+  vendor/external/libsodium/include/sodium/crypto_stream_xchacha20.h
+  vendor/external/libsodium/include/sodium/crypto_stream_xsalsa20.h
+  vendor/external/libsodium/include/sodium/crypto_verify_16.h
+  vendor/external/libsodium/include/sodium/crypto_verify_32.h
+  vendor/external/libsodium/include/sodium/crypto_verify_64.h
+  vendor/external/libsodium/include/sodium/export.h
+  vendor/external/libsodium/include/sodium/private/asm_cet.h
+  vendor/external/libsodium/include/sodium/private/chacha20_ietf_ext.h
+  vendor/external/libsodium/include/sodium/private/common.h
+  vendor/external/libsodium/include/sodium/private/ed25519_ref10.h
+  vendor/external/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h
+  vendor/external/libsodium/include/sodium/private/ed25519_ref10_fe_51.h
+  vendor/external/libsodium/include/sodium/private/implementations.h
+  vendor/external/libsodium/include/sodium/private/mutex.h
+  vendor/external/libsodium/include/sodium/private/softaes.h
+  vendor/external/libsodium/include/sodium/private/sse2_64_32.h
+  vendor/external/libsodium/include/sodium/randombytes.h
+  vendor/external/libsodium/include/sodium/randombytes_internal_random.h
+  vendor/external/libsodium/include/sodium/randombytes_sysrandom.h
+  vendor/external/libsodium/include/sodium/runtime.h
+  vendor/external/libsodium/include/sodium/utils.h
+  vendor/external/libsodium/include/sodium/version.h
+  vendor/external/libsodium/randombytes/internal/randombytes_internal_random.c
+  vendor/external/libsodium/randombytes/randombytes.c
+  vendor/external/libsodium/randombytes/sysrandom/randombytes_sysrandom.c
+  vendor/external/libsodium/sodium/codecs.c
+  vendor/external/libsodium/sodium/core.c
+  vendor/external/libsodium/sodium/runtime.c
+  vendor/external/libsodium/sodium/utils.c
+  vendor/external/libsodium/sodium/version.c
+  vendor/external/ripemd160/LICENSE
+  vendor/external/ripemd160/VERSION.txt
+  vendor/external/ripemd160/ripemd160.c
+  vendor/external/ripemd160/ripemd160.h
+  vendor/external/secp256k1/COPYING
+  vendor/external/secp256k1/VERSION.txt
+  vendor/external/secp256k1/include/secp256k1.h
+  vendor/external/secp256k1/include/secp256k1_extrakeys.h
+  vendor/external/secp256k1/include/secp256k1_preallocated.h
+  vendor/external/secp256k1/include/secp256k1_schnorrsig.h
+  vendor/external/secp256k1/src/assumptions.h
+  vendor/external/secp256k1/src/checkmem.h
+  vendor/external/secp256k1/src/ecdsa.h
+  vendor/external/secp256k1/src/ecdsa_impl.h
+  vendor/external/secp256k1/src/eckey.h
+  vendor/external/secp256k1/src/eckey_impl.h
+  vendor/external/secp256k1/src/ecmult.h
+  vendor/external/secp256k1/src/ecmult_compute_table.h
+  vendor/external/secp256k1/src/ecmult_compute_table_impl.h
+  vendor/external/secp256k1/src/ecmult_const.h
+  vendor/external/secp256k1/src/ecmult_const_impl.h
+  vendor/external/secp256k1/src/ecmult_gen.h
+  vendor/external/secp256k1/src/ecmult_gen_compute_table.h
+  vendor/external/secp256k1/src/ecmult_gen_compute_table_impl.h
+  vendor/external/secp256k1/src/ecmult_gen_impl.h
+  vendor/external/secp256k1/src/ecmult_impl.h
+  vendor/external/secp256k1/src/field.h
+  vendor/external/secp256k1/src/field_10x26.h
+  vendor/external/secp256k1/src/field_10x26_impl.h
+  vendor/external/secp256k1/src/field_5x52.h
+  vendor/external/secp256k1/src/field_5x52_impl.h
+  vendor/external/secp256k1/src/field_5x52_int128_impl.h
+  vendor/external/secp256k1/src/field_impl.h
+  vendor/external/secp256k1/src/group.h
+  vendor/external/secp256k1/src/group_impl.h
+  vendor/external/secp256k1/src/hash.h
+  vendor/external/secp256k1/src/hash_impl.h
+  vendor/external/secp256k1/src/hsort.h
+  vendor/external/secp256k1/src/hsort_impl.h
+  vendor/external/secp256k1/src/int128.h
+  vendor/external/secp256k1/src/int128_impl.h
+  vendor/external/secp256k1/src/int128_native.h
+  vendor/external/secp256k1/src/int128_native_impl.h
+  vendor/external/secp256k1/src/int128_struct.h
+  vendor/external/secp256k1/src/int128_struct_impl.h
+  vendor/external/secp256k1/src/modinv32.h
+  vendor/external/secp256k1/src/modinv32_impl.h
+  vendor/external/secp256k1/src/modinv64.h
+  vendor/external/secp256k1/src/modinv64_impl.h
+  vendor/external/secp256k1/src/modules/extrakeys/main_impl.h
+  vendor/external/secp256k1/src/modules/schnorrsig/main_impl.h
+  vendor/external/secp256k1/src/precomputed_ecmult.c
+  vendor/external/secp256k1/src/precomputed_ecmult.h
+  vendor/external/secp256k1/src/precomputed_ecmult_gen.c
+  vendor/external/secp256k1/src/precomputed_ecmult_gen.h
+  vendor/external/secp256k1/src/scalar.h
+  vendor/external/secp256k1/src/scalar_4x64.h
+  vendor/external/secp256k1/src/scalar_4x64_impl.h
+  vendor/external/secp256k1/src/scalar_8x32.h
+  vendor/external/secp256k1/src/scalar_8x32_impl.h
+  vendor/external/secp256k1/src/scalar_impl.h
+  vendor/external/secp256k1/src/scratch.h
+  vendor/external/secp256k1/src/scratch_impl.h
+  vendor/external/secp256k1/src/secp256k1.c
+  vendor/external/secp256k1/src/selftest.h
+  vendor/external/secp256k1/src/util.h
+  vendor/external/sha3/LICENSE
+  vendor/external/sha3/VERSION.txt
+  vendor/external/sha3/sha3.c
+  vendor/external/sha3/sha3.h
+  vendor/include/cardano/address/address.h
+  vendor/include/cardano/address/address_type.h
+  vendor/include/cardano/address/base_address.h
+  vendor/include/cardano/address/byron_address.h
+  vendor/include/cardano/address/byron_address_attributes.h
+  vendor/include/cardano/address/byron_address_type.h
+  vendor/include/cardano/address/enterprise_address.h
+  vendor/include/cardano/address/pointer_address.h
+  vendor/include/cardano/address/reward_address.h
+  vendor/include/cardano/address/stake_pointer.h
+  vendor/include/cardano/assets/asset_id.h
+  vendor/include/cardano/assets/asset_id_list.h
+  vendor/include/cardano/assets/asset_id_map.h
+  vendor/include/cardano/assets/asset_name.h
+  vendor/include/cardano/assets/asset_name_list.h
+  vendor/include/cardano/assets/asset_name_map.h
+  vendor/include/cardano/assets/multi_asset.h
+  vendor/include/cardano/assets/policy_id_list.h
+  vendor/include/cardano/auxiliary_data/auxiliary_data.h
+  vendor/include/cardano/auxiliary_data/metadatum.h
+  vendor/include/cardano/auxiliary_data/metadatum_kind.h
+  vendor/include/cardano/auxiliary_data/metadatum_label_list.h
+  vendor/include/cardano/auxiliary_data/metadatum_list.h
+  vendor/include/cardano/auxiliary_data/metadatum_map.h
+  vendor/include/cardano/auxiliary_data/plutus_v1_script_list.h
+  vendor/include/cardano/auxiliary_data/plutus_v2_script_list.h
+  vendor/include/cardano/auxiliary_data/plutus_v3_script_list.h
+  vendor/include/cardano/auxiliary_data/plutus_v4_script_list.h
+  vendor/include/cardano/auxiliary_data/transaction_metadata.h
+  vendor/include/cardano/bip39.h
+  vendor/include/cardano/buffer.h
+  vendor/include/cardano/cardano.h
+  vendor/include/cardano/cbor/cbor_major_type.h
+  vendor/include/cardano/cbor/cbor_reader.h
+  vendor/include/cardano/cbor/cbor_reader_state.h
+  vendor/include/cardano/cbor/cbor_simple_value.h
+  vendor/include/cardano/cbor/cbor_tag.h
+  vendor/include/cardano/cbor/cbor_writer.h
+  vendor/include/cardano/certs/auth_committee_hot_cert.h
+  vendor/include/cardano/certs/cert_type.h
+  vendor/include/cardano/certs/certificate.h
+  vendor/include/cardano/certs/certificate_set.h
+  vendor/include/cardano/certs/genesis_key_delegation_cert.h
+  vendor/include/cardano/certs/mir_cert.h
+  vendor/include/cardano/certs/mir_cert_pot_type.h
+  vendor/include/cardano/certs/mir_cert_type.h
+  vendor/include/cardano/certs/mir_to_pot_cert.h
+  vendor/include/cardano/certs/mir_to_stake_creds_cert.h
+  vendor/include/cardano/certs/pool_registration_cert.h
+  vendor/include/cardano/certs/pool_retirement_cert.h
+  vendor/include/cardano/certs/register_drep_cert.h
+  vendor/include/cardano/certs/registration_cert.h
+  vendor/include/cardano/certs/resign_committee_cold_cert.h
+  vendor/include/cardano/certs/stake_delegation_cert.h
+  vendor/include/cardano/certs/stake_deregistration_cert.h
+  vendor/include/cardano/certs/stake_registration_cert.h
+  vendor/include/cardano/certs/stake_registration_delegation_cert.h
+  vendor/include/cardano/certs/stake_vote_delegation_cert.h
+  vendor/include/cardano/certs/stake_vote_registration_delegation_cert.h
+  vendor/include/cardano/certs/unregister_drep_cert.h
+  vendor/include/cardano/certs/unregistration_cert.h
+  vendor/include/cardano/certs/update_drep_cert.h
+  vendor/include/cardano/certs/vote_delegation_cert.h
+  vendor/include/cardano/certs/vote_registration_delegation_cert.h
+  vendor/include/cardano/common/anchor.h
+  vendor/include/cardano/common/bigint.h
+  vendor/include/cardano/common/byte_order.h
+  vendor/include/cardano/common/credential.h
+  vendor/include/cardano/common/credential_type.h
+  vendor/include/cardano/common/datum.h
+  vendor/include/cardano/common/datum_type.h
+  vendor/include/cardano/common/drep.h
+  vendor/include/cardano/common/drep_type.h
+  vendor/include/cardano/common/ex_units.h
+  vendor/include/cardano/common/governance_action_id.h
+  vendor/include/cardano/common/governance_key_type.h
+  vendor/include/cardano/common/guard_set.h
+  vendor/include/cardano/common/network_id.h
+  vendor/include/cardano/common/network_magic.h
+  vendor/include/cardano/common/protocol_version.h
+  vendor/include/cardano/common/reward_address_list.h
+  vendor/include/cardano/common/unit_interval.h
+  vendor/include/cardano/common/utxo.h
+  vendor/include/cardano/common/utxo_list.h
+  vendor/include/cardano/common/withdrawal_map.h
+  vendor/include/cardano/crypto/bip32_private_key.h
+  vendor/include/cardano/crypto/bip32_public_key.h
+  vendor/include/cardano/crypto/blake2b_hash.h
+  vendor/include/cardano/crypto/blake2b_hash_set.h
+  vendor/include/cardano/crypto/blake2b_hash_size.h
+  vendor/include/cardano/crypto/crc32.h
+  vendor/include/cardano/crypto/ed25519_private_key.h
+  vendor/include/cardano/crypto/ed25519_public_key.h
+  vendor/include/cardano/crypto/ed25519_signature.h
+  vendor/include/cardano/crypto/emip3.h
+  vendor/include/cardano/crypto/pbkdf2.h
+  vendor/include/cardano/encoding/base58.h
+  vendor/include/cardano/encoding/bech32.h
+  vendor/include/cardano/error.h
+  vendor/include/cardano/export.h
+  vendor/include/cardano/json/json_context.h
+  vendor/include/cardano/json/json_format.h
+  vendor/include/cardano/json/json_object.h
+  vendor/include/cardano/json/json_object_type.h
+  vendor/include/cardano/json/json_writer.h
+  vendor/include/cardano/key_handlers/account_derivation_path.h
+  vendor/include/cardano/key_handlers/cip_1852_constants.h
+  vendor/include/cardano/key_handlers/derivation_path.h
+  vendor/include/cardano/key_handlers/secure_key_handler.h
+  vendor/include/cardano/key_handlers/secure_key_handler_impl.h
+  vendor/include/cardano/key_handlers/secure_key_handler_type.h
+  vendor/include/cardano/key_handlers/software_secure_key_handler.h
+  vendor/include/cardano/message_signing/cip8.h
+  vendor/include/cardano/object.h
+  vendor/include/cardano/plutus_data/constr_plutus_data.h
+  vendor/include/cardano/plutus_data/plutus_data.h
+  vendor/include/cardano/plutus_data/plutus_data_kind.h
+  vendor/include/cardano/plutus_data/plutus_list.h
+  vendor/include/cardano/plutus_data/plutus_map.h
+  vendor/include/cardano/pool_params/bls_key.h
+  vendor/include/cardano/pool_params/ipv4.h
+  vendor/include/cardano/pool_params/ipv6.h
+  vendor/include/cardano/pool_params/multi_host_name_relay.h
+  vendor/include/cardano/pool_params/pool_metadata.h
+  vendor/include/cardano/pool_params/pool_owners.h
+  vendor/include/cardano/pool_params/pool_params.h
+  vendor/include/cardano/pool_params/relay.h
+  vendor/include/cardano/pool_params/relay_type.h
+  vendor/include/cardano/pool_params/relays.h
+  vendor/include/cardano/pool_params/single_host_addr_relay.h
+  vendor/include/cardano/pool_params/single_host_name_relay.h
+  vendor/include/cardano/proposal_procedures/committee.h
+  vendor/include/cardano/proposal_procedures/committee_members_map.h
+  vendor/include/cardano/proposal_procedures/constitution.h
+  vendor/include/cardano/proposal_procedures/credential_set.h
+  vendor/include/cardano/proposal_procedures/governance_action_type.h
+  vendor/include/cardano/proposal_procedures/hard_fork_initiation_action.h
+  vendor/include/cardano/proposal_procedures/info_action.h
+  vendor/include/cardano/proposal_procedures/new_constitution_action.h
+  vendor/include/cardano/proposal_procedures/no_confidence_action.h
+  vendor/include/cardano/proposal_procedures/parameter_change_action.h
+  vendor/include/cardano/proposal_procedures/proposal_procedure.h
+  vendor/include/cardano/proposal_procedures/proposal_procedure_set.h
+  vendor/include/cardano/proposal_procedures/treasury_withdrawals_action.h
+  vendor/include/cardano/proposal_procedures/update_committee_action.h
+  vendor/include/cardano/protocol_params/cost_model.h
+  vendor/include/cardano/protocol_params/costmdls.h
+  vendor/include/cardano/protocol_params/drep_voting_thresholds.h
+  vendor/include/cardano/protocol_params/ex_unit_prices.h
+  vendor/include/cardano/protocol_params/pool_voting_thresholds.h
+  vendor/include/cardano/protocol_params/proposed_param_updates.h
+  vendor/include/cardano/protocol_params/protocol_param_update.h
+  vendor/include/cardano/protocol_params/protocol_parameters.h
+  vendor/include/cardano/protocol_params/update.h
+  vendor/include/cardano/providers/provider.h
+  vendor/include/cardano/providers/provider_impl.h
+  vendor/include/cardano/scripts/native_scripts/native_script.h
+  vendor/include/cardano/scripts/native_scripts/native_script_list.h
+  vendor/include/cardano/scripts/native_scripts/native_script_type.h
+  vendor/include/cardano/scripts/native_scripts/script_all.h
+  vendor/include/cardano/scripts/native_scripts/script_any.h
+  vendor/include/cardano/scripts/native_scripts/script_invalid_after.h
+  vendor/include/cardano/scripts/native_scripts/script_invalid_before.h
+  vendor/include/cardano/scripts/native_scripts/script_n_of_k.h
+  vendor/include/cardano/scripts/native_scripts/script_pubkey.h
+  vendor/include/cardano/scripts/native_scripts/script_require_guard.h
+  vendor/include/cardano/scripts/plutus_scripts/plutus_language_version.h
+  vendor/include/cardano/scripts/plutus_scripts/plutus_v1_script.h
+  vendor/include/cardano/scripts/plutus_scripts/plutus_v2_script.h
+  vendor/include/cardano/scripts/plutus_scripts/plutus_v3_script.h
+  vendor/include/cardano/scripts/plutus_scripts/plutus_v4_script.h
+  vendor/include/cardano/scripts/script.h
+  vendor/include/cardano/scripts/script_language.h
+  vendor/include/cardano/slot_config.h
+  vendor/include/cardano/time.h
+  vendor/include/cardano/transaction/sub_transaction.h
+  vendor/include/cardano/transaction/transaction.h
+  vendor/include/cardano/transaction_body/account_balance_interval.h
+  vendor/include/cardano/transaction_body/account_balance_intervals_map.h
+  vendor/include/cardano/transaction_body/direct_deposit_map.h
+  vendor/include/cardano/transaction_body/required_guards_map.h
+  vendor/include/cardano/transaction_body/sub_transaction_body.h
+  vendor/include/cardano/transaction_body/sub_transaction_set.h
+  vendor/include/cardano/transaction_body/transaction_body.h
+  vendor/include/cardano/transaction_body/transaction_input.h
+  vendor/include/cardano/transaction_body/transaction_input_set.h
+  vendor/include/cardano/transaction_body/transaction_output.h
+  vendor/include/cardano/transaction_body/transaction_output_list.h
+  vendor/include/cardano/transaction_body/value.h
+  vendor/include/cardano/transaction_builder/balancing/deferred_redeemer_list.h
+  vendor/include/cardano/transaction_builder/balancing/implicit_coin.h
+  vendor/include/cardano/transaction_builder/balancing/input_to_redeemer_map.h
+  vendor/include/cardano/transaction_builder/balancing/transaction_balancing.h
+  vendor/include/cardano/transaction_builder/coin_selection/coin_selection_request.h
+  vendor/include/cardano/transaction_builder/coin_selection/coin_selection_strategy.h
+  vendor/include/cardano/transaction_builder/coin_selection/coin_selector.h
+  vendor/include/cardano/transaction_builder/coin_selection/coin_selector_impl.h
+  vendor/include/cardano/transaction_builder/coin_selection/large_first_coin_selector.h
+  vendor/include/cardano/transaction_builder/coin_selection/random_improve_coin_selector.h
+  vendor/include/cardano/transaction_builder/evaluation/native_tx_evaluator.h
+  vendor/include/cardano/transaction_builder/evaluation/provider_tx_evaluator.h
+  vendor/include/cardano/transaction_builder/evaluation/tx_evaluator.h
+  vendor/include/cardano/transaction_builder/evaluation/tx_evaluator_impl.h
+  vendor/include/cardano/transaction_builder/fee.h
+  vendor/include/cardano/transaction_builder/script_data_hash.h
+  vendor/include/cardano/transaction_builder/sub_transaction_builder.h
+  vendor/include/cardano/transaction_builder/transaction_builder.h
+  vendor/include/cardano/typedefs.h
+  vendor/include/cardano/uplc/uplc_apply_params.h
+  vendor/include/cardano/voting_procedures/governance_action_id_list.h
+  vendor/include/cardano/voting_procedures/vote.h
+  vendor/include/cardano/voting_procedures/voter.h
+  vendor/include/cardano/voting_procedures/voter_list.h
+  vendor/include/cardano/voting_procedures/voter_type.h
+  vendor/include/cardano/voting_procedures/voting_procedure.h
+  vendor/include/cardano/voting_procedures/voting_procedure_list.h
+  vendor/include/cardano/voting_procedures/voting_procedures.h
+  vendor/include/cardano/witness_set/bootstrap_witness.h
+  vendor/include/cardano/witness_set/bootstrap_witness_set.h
+  vendor/include/cardano/witness_set/native_script_set.h
+  vendor/include/cardano/witness_set/plutus_data_set.h
+  vendor/include/cardano/witness_set/plutus_v1_script_set.h
+  vendor/include/cardano/witness_set/plutus_v2_script_set.h
+  vendor/include/cardano/witness_set/plutus_v3_script_set.h
+  vendor/include/cardano/witness_set/plutus_v4_script_set.h
+  vendor/include/cardano/witness_set/redeemer.h
+  vendor/include/cardano/witness_set/redeemer_list.h
+  vendor/include/cardano/witness_set/redeemer_tag.h
+  vendor/include/cardano/witness_set/vkey_witness.h
+  vendor/include/cardano/witness_set/vkey_witness_set.h
+  vendor/include/cardano/witness_set/witness_set.h
+  vendor/src/address/address.c
+  vendor/src/address/base_address.c
+  vendor/src/address/byron_address.c
+  vendor/src/address/enterprise_address.c
+  vendor/src/address/internals/addr_common.c
+  vendor/src/address/internals/addr_common.h
+  vendor/src/address/internals/base_addr_pack.c
+  vendor/src/address/internals/base_addr_pack.h
+  vendor/src/address/internals/byron_addr_pack.c
+  vendor/src/address/internals/byron_addr_pack.h
+  vendor/src/address/internals/byron_address_content.h
+  vendor/src/address/internals/enterprise_addr_pack.c
+  vendor/src/address/internals/enterprise_addr_pack.h
+  vendor/src/address/internals/pointer_addr_pack.c
+  vendor/src/address/internals/pointer_addr_pack.h
+  vendor/src/address/internals/reward_addr_pack.c
+  vendor/src/address/internals/reward_addr_pack.h
+  vendor/src/address/pointer_address.c
+  vendor/src/address/reward_address.c
+  vendor/src/allocators.c
+  vendor/src/allocators.h
+  vendor/src/assets/asset_id.c
+  vendor/src/assets/asset_id_list.c
+  vendor/src/assets/asset_id_map.c
+  vendor/src/assets/asset_name.c
+  vendor/src/assets/asset_name_list.c
+  vendor/src/assets/asset_name_map.c
+  vendor/src/assets/multi_asset.c
+  vendor/src/assets/policy_id_list.c
+  vendor/src/auxiliary_data/auxiliary_data.c
+  vendor/src/auxiliary_data/metadatum.c
+  vendor/src/auxiliary_data/metadatum_label_list.c
+  vendor/src/auxiliary_data/metadatum_list.c
+  vendor/src/auxiliary_data/metadatum_map.c
+  vendor/src/auxiliary_data/plutus_v1_script_list.c
+  vendor/src/auxiliary_data/plutus_v2_script_list.c
+  vendor/src/auxiliary_data/plutus_v3_script_list.c
+  vendor/src/auxiliary_data/plutus_v4_script_list.c
+  vendor/src/auxiliary_data/transaction_metadata.c
+  vendor/src/bip39/bip39.c
+  vendor/src/bip39/bip39_wordlist_en.h
+  vendor/src/buffer/buffer.c
+  vendor/src/cardano.c
+  vendor/src/cbor/cbor_additional_info.h
+  vendor/src/cbor/cbor_initial_byte.c
+  vendor/src/cbor/cbor_initial_byte.h
+  vendor/src/cbor/cbor_major_type.c
+  vendor/src/cbor/cbor_reader/cbor_reader.c
+  vendor/src/cbor/cbor_reader/cbor_reader_collections.c
+  vendor/src/cbor/cbor_reader/cbor_reader_collections.h
+  vendor/src/cbor/cbor_reader/cbor_reader_core.c
+  vendor/src/cbor/cbor_reader/cbor_reader_core.h
+  vendor/src/cbor/cbor_reader/cbor_reader_numeric.c
+  vendor/src/cbor/cbor_reader/cbor_reader_numeric.h
+  vendor/src/cbor/cbor_reader/cbor_reader_simple_values.c
+  vendor/src/cbor/cbor_reader/cbor_reader_simple_values.h
+  vendor/src/cbor/cbor_reader/cbor_reader_tags.c
+  vendor/src/cbor/cbor_reader/cbor_reader_tags.h
+  vendor/src/cbor/cbor_reader_state.c
+  vendor/src/cbor/cbor_simple_value.c
+  vendor/src/cbor/cbor_tag.c
+  vendor/src/cbor/cbor_validation.c
+  vendor/src/cbor/cbor_validation.h
+  vendor/src/cbor/cbor_writer.c
+  vendor/src/certs/auth_committee_hot_cert.c
+  vendor/src/certs/cert_type.c
+  vendor/src/certs/certificate.c
+  vendor/src/certs/certificate_set.c
+  vendor/src/certs/genesis_key_delegation_cert.c
+  vendor/src/certs/mir_cert.c
+  vendor/src/certs/mir_to_pot_cert.c
+  vendor/src/certs/mir_to_stake_creds_cert.c
+  vendor/src/certs/pool_registration_cert.c
+  vendor/src/certs/pool_retirement_cert.c
+  vendor/src/certs/register_drep_cert.c
+  vendor/src/certs/registration_cert.c
+  vendor/src/certs/resign_committee_cold_cert.c
+  vendor/src/certs/stake_delegation_cert.c
+  vendor/src/certs/stake_deregistration_cert.c
+  vendor/src/certs/stake_registration_cert.c
+  vendor/src/certs/stake_registration_delegation_cert.c
+  vendor/src/certs/stake_vote_delegation_cert.c
+  vendor/src/certs/stake_vote_registration_delegation_cert.c
+  vendor/src/certs/unregister_drep_cert.c
+  vendor/src/certs/unregistration_cert.c
+  vendor/src/certs/update_drep_cert.c
+  vendor/src/certs/vote_delegation_cert.c
+  vendor/src/certs/vote_registration_delegation_cert.c
+  vendor/src/collections/array.c
+  vendor/src/collections/array.h
+  vendor/src/collections/set.c
+  vendor/src/collections/set.h
+  vendor/src/common/anchor.c
+  vendor/src/common/bigint.c
+  vendor/src/common/credential.c
+  vendor/src/common/datum.c
+  vendor/src/common/drep.c
+  vendor/src/common/ex_units.c
+  vendor/src/common/governance_action_id.c
+  vendor/src/common/guard_set.c
+  vendor/src/common/ledger_order.c
+  vendor/src/common/ledger_order.h
+  vendor/src/common/network_magic.c
+  vendor/src/common/protocol_version.c
+  vendor/src/common/reward_address_list.c
+  vendor/src/common/unit_interval.c
+  vendor/src/common/utxo.c
+  vendor/src/common/utxo_list.c
+  vendor/src/common/withdrawal_map.c
+  vendor/src/config.h
+  vendor/src/crypto/arithmetic.c
+  vendor/src/crypto/arithmetic.h
+  vendor/src/crypto/bip32_key_derivation.c
+  vendor/src/crypto/bip32_key_derivation.h
+  vendor/src/crypto/bip32_private_key.c
+  vendor/src/crypto/bip32_public_key.c
+  vendor/src/crypto/blake2b_hash.c
+  vendor/src/crypto/blake2b_hash_internal.h
+  vendor/src/crypto/blake2b_hash_set.c
+  vendor/src/crypto/crc32.c
+  vendor/src/crypto/ed25519_private_key.c
+  vendor/src/crypto/ed25519_public_key.c
+  vendor/src/crypto/ed25519_signature.c
+  vendor/src/crypto/emip3.c
+  vendor/src/crypto/pbkdf2.c
+  vendor/src/encoding/base58.c
+  vendor/src/encoding/bech32.c
+  vendor/src/endian.c
+  vendor/src/endian.h
+  vendor/src/error.c
+  vendor/src/json/internals/json_object_common.c
+  vendor/src/json/internals/json_object_common.h
+  vendor/src/json/internals/json_object_serialization.c
+  vendor/src/json/internals/json_object_serialization.h
+  vendor/src/json/internals/json_parser.c
+  vendor/src/json/internals/json_parser.h
+  vendor/src/json/internals/json_writer_common.c
+  vendor/src/json/internals/json_writer_common.h
+  vendor/src/json/internals/utf8.c
+  vendor/src/json/internals/utf8.h
+  vendor/src/json/json_object.c
+  vendor/src/json/json_writer.c
+  vendor/src/key_handlers/secure_key_handler.c
+  vendor/src/key_handlers/software_secure_key_handler.c
+  vendor/src/message_signing/cip8.c
+  vendor/src/object.c
+  vendor/src/plutus_data/constr_plutus_data.c
+  vendor/src/plutus_data/plutus_data.c
+  vendor/src/plutus_data/plutus_list.c
+  vendor/src/plutus_data/plutus_map.c
+  vendor/src/pool_params/bls_key.c
+  vendor/src/pool_params/ipv4.c
+  vendor/src/pool_params/ipv6.c
+  vendor/src/pool_params/multi_host_name_relay.c
+  vendor/src/pool_params/pool_metadata.c
+  vendor/src/pool_params/pool_owners.c
+  vendor/src/pool_params/pool_params.c
+  vendor/src/pool_params/relay.c
+  vendor/src/pool_params/relay_type.c
+  vendor/src/pool_params/relays.c
+  vendor/src/pool_params/single_host_addr_relay.c
+  vendor/src/pool_params/single_host_name_relay.c
+  vendor/src/proposal_procedures/committee.c
+  vendor/src/proposal_procedures/committee_members_map.c
+  vendor/src/proposal_procedures/constitution.c
+  vendor/src/proposal_procedures/credential_set.c
+  vendor/src/proposal_procedures/governance_action_type.c
+  vendor/src/proposal_procedures/hard_fork_initiation_action.c
+  vendor/src/proposal_procedures/info_action.c
+  vendor/src/proposal_procedures/new_constitution_action.c
+  vendor/src/proposal_procedures/no_confidence_action.c
+  vendor/src/proposal_procedures/parameter_change_action.c
+  vendor/src/proposal_procedures/proposal_procedure.c
+  vendor/src/proposal_procedures/proposal_procedure_set.c
+  vendor/src/proposal_procedures/treasury_withdrawals_action.c
+  vendor/src/proposal_procedures/update_committee_action.c
+  vendor/src/protocol_params/cost_model.c
+  vendor/src/protocol_params/costmdls.c
+  vendor/src/protocol_params/drep_voting_thresholds.c
+  vendor/src/protocol_params/ex_unit_prices.c
+  vendor/src/protocol_params/pool_voting_thresholds.c
+  vendor/src/protocol_params/proposed_param_updates.c
+  vendor/src/protocol_params/protocol_param_update.c
+  vendor/src/protocol_params/protocol_parameters.c
+  vendor/src/protocol_params/update.c
+  vendor/src/providers/emscripten/emscripten_provider.c
+  vendor/src/providers/provider.c
+  vendor/src/scripts/native_scripts/native_script.c
+  vendor/src/scripts/native_scripts/native_script_list.c
+  vendor/src/scripts/native_scripts/native_script_type.c
+  vendor/src/scripts/native_scripts/script_all.c
+  vendor/src/scripts/native_scripts/script_any.c
+  vendor/src/scripts/native_scripts/script_invalid_after.c
+  vendor/src/scripts/native_scripts/script_invalid_before.c
+  vendor/src/scripts/native_scripts/script_n_of_k.c
+  vendor/src/scripts/native_scripts/script_pubkey.c
+  vendor/src/scripts/native_scripts/script_require_guard.c
+  vendor/src/scripts/plutus_scripts/plutus_v1_script.c
+  vendor/src/scripts/plutus_scripts/plutus_v2_script.c
+  vendor/src/scripts/plutus_scripts/plutus_v3_script.c
+  vendor/src/scripts/plutus_scripts/plutus_v4_script.c
+  vendor/src/scripts/script.c
+  vendor/src/string_safe.c
+  vendor/src/string_safe.h
+  vendor/src/time.c
+  vendor/src/transaction/sub_transaction.c
+  vendor/src/transaction/transaction.c
+  vendor/src/transaction_body/account_balance_interval.c
+  vendor/src/transaction_body/account_balance_intervals_map.c
+  vendor/src/transaction_body/direct_deposit_map.c
+  vendor/src/transaction_body/internals/body_fields.c
+  vendor/src/transaction_body/internals/body_fields.h
+  vendor/src/transaction_body/required_guards_map.c
+  vendor/src/transaction_body/sub_transaction_body.c
+  vendor/src/transaction_body/sub_transaction_set.c
+  vendor/src/transaction_body/transaction_body.c
+  vendor/src/transaction_body/transaction_input.c
+  vendor/src/transaction_body/transaction_input_set.c
+  vendor/src/transaction_body/transaction_output.c
+  vendor/src/transaction_body/transaction_output_list.c
+  vendor/src/transaction_body/value.c
+  vendor/src/transaction_builder/balancing/deferred_redeemer_list.c
+  vendor/src/transaction_builder/balancing/implicit_coin.c
+  vendor/src/transaction_builder/balancing/input_to_redeemer_map.c
+  vendor/src/transaction_builder/balancing/internals/collateral.c
+  vendor/src/transaction_builder/balancing/internals/collateral.h
+  vendor/src/transaction_builder/balancing/internals/pool_deposits.c
+  vendor/src/transaction_builder/balancing/internals/pool_deposits.h
+  vendor/src/transaction_builder/balancing/internals/scripts_needed.c
+  vendor/src/transaction_builder/balancing/internals/scripts_needed.h
+  vendor/src/transaction_builder/balancing/internals/unique_signers.c
+  vendor/src/transaction_builder/balancing/internals/unique_signers.h
+  vendor/src/transaction_builder/balancing/transaction_balancing.c
+  vendor/src/transaction_builder/coin_selection/coin_selector.c
+  vendor/src/transaction_builder/coin_selection/internals/change_builder.c
+  vendor/src/transaction_builder/coin_selection/internals/change_builder.h
+  vendor/src/transaction_builder/coin_selection/internals/emscripten_coin_selector.c
+  vendor/src/transaction_builder/coin_selection/internals/large_first_coin_selector.c
+  vendor/src/transaction_builder/coin_selection/internals/large_first_helpers.c
+  vendor/src/transaction_builder/coin_selection/internals/large_first_helpers.h
+  vendor/src/transaction_builder/coin_selection/internals/random_improve_change_state.c
+  vendor/src/transaction_builder/coin_selection/internals/random_improve_change_state.h
+  vendor/src/transaction_builder/coin_selection/internals/random_improve_coin_selector.c
+  vendor/src/transaction_builder/coin_selection/internals/random_improve_helpers.c
+  vendor/src/transaction_builder/coin_selection/internals/random_improve_helpers.h
+  vendor/src/transaction_builder/coin_selection/internals/random_improve_selection_index.c
+  vendor/src/transaction_builder/coin_selection/internals/random_improve_selection_index.h
+  vendor/src/transaction_builder/coin_selection/internals/random_improve_utxo_utils.c
+  vendor/src/transaction_builder/coin_selection/internals/random_improve_utxo_utils.h
+  vendor/src/transaction_builder/coin_selection/internals/value_splitting.c
+  vendor/src/transaction_builder/coin_selection/internals/value_splitting.h
+  vendor/src/transaction_builder/evaluation/emscripten_tx_evaluator.c
+  vendor/src/transaction_builder/evaluation/native_tx_evaluator.c
+  vendor/src/transaction_builder/evaluation/provider_tx_evaluator.c
+  vendor/src/transaction_builder/evaluation/tx_evaluator.c
+  vendor/src/transaction_builder/fee.c
+  vendor/src/transaction_builder/internals/blake2b_hash_to_redeemer_map.c
+  vendor/src/transaction_builder/internals/blake2b_hash_to_redeemer_map.h
+  vendor/src/transaction_builder/internals/builder_build.c
+  vendor/src/transaction_builder/internals/builder_build.h
+  vendor/src/transaction_builder/internals/builder_certs.c
+  vendor/src/transaction_builder/internals/builder_certs.h
+  vendor/src/transaction_builder/internals/builder_config.c
+  vendor/src/transaction_builder/internals/builder_config.h
+  vendor/src/transaction_builder/internals/builder_entities.c
+  vendor/src/transaction_builder/internals/builder_entities.h
+  vendor/src/transaction_builder/internals/builder_inputs.c
+  vendor/src/transaction_builder/internals/builder_inputs.h
+  vendor/src/transaction_builder/internals/builder_mint.c
+  vendor/src/transaction_builder/internals/builder_mint.h
+  vendor/src/transaction_builder/internals/builder_outputs.c
+  vendor/src/transaction_builder/internals/builder_outputs.h
+  vendor/src/transaction_builder/internals/builder_proposals.c
+  vendor/src/transaction_builder/internals/builder_proposals.h
+  vendor/src/transaction_builder/internals/builder_redeemers.c
+  vendor/src/transaction_builder/internals/builder_redeemers.h
+  vendor/src/transaction_builder/internals/builder_state.c
+  vendor/src/transaction_builder/internals/builder_state.h
+  vendor/src/transaction_builder/internals/builder_sub_build.c
+  vendor/src/transaction_builder/internals/builder_sub_build.h
+  vendor/src/transaction_builder/internals/builder_sub_transactions.c
+  vendor/src/transaction_builder/internals/builder_sub_transactions.h
+  vendor/src/transaction_builder/internals/builder_votes.c
+  vendor/src/transaction_builder/internals/builder_votes.h
+  vendor/src/transaction_builder/internals/builder_withdrawals.c
+  vendor/src/transaction_builder/internals/builder_withdrawals.h
+  vendor/src/transaction_builder/internals/builder_witnesses.c
+  vendor/src/transaction_builder/internals/builder_witnesses.h
+  vendor/src/transaction_builder/internals/created_output_scripts.c
+  vendor/src/transaction_builder/internals/created_output_scripts.h
+  vendor/src/transaction_builder/script_data_hash.c
+  vendor/src/transaction_builder/sub_transaction_builder.c
+  vendor/src/transaction_builder/transaction_builder.c
+  vendor/src/uplc/arena/uplc_arena.c
+  vendor/src/uplc/arena/uplc_arena.h
+  vendor/src/uplc/ast/uplc_constant.c
+  vendor/src/uplc/ast/uplc_constant.h
+  vendor/src/uplc/ast/uplc_int.c
+  vendor/src/uplc/ast/uplc_int.h
+  vendor/src/uplc/ast/uplc_int_math.c
+  vendor/src/uplc/ast/uplc_int_math.h
+  vendor/src/uplc/ast/uplc_lang_version.c
+  vendor/src/uplc/ast/uplc_lang_version.h
+  vendor/src/uplc/ast/uplc_program.c
+  vendor/src/uplc/ast/uplc_program.h
+  vendor/src/uplc/ast/uplc_scope_check_mode.h
+  vendor/src/uplc/ast/uplc_term.c
+  vendor/src/uplc/ast/uplc_term.h
+  vendor/src/uplc/ast/uplc_term_kind.h
+  vendor/src/uplc/ast/uplc_type.c
+  vendor/src/uplc/ast/uplc_type.h
+  vendor/src/uplc/ast/uplc_type_kind.h
+  vendor/src/uplc/builtins/bls.c
+  vendor/src/uplc/builtins/bls.h
+  vendor/src/uplc/builtins/builtins.c
+  vendor/src/uplc/builtins/builtins.h
+  vendor/src/uplc/builtins/uplc_builtin.c
+  vendor/src/uplc/builtins/uplc_builtin.h
+  vendor/src/uplc/builtins/uplc_builtin_outcome.h
+  vendor/src/uplc/builtins/uplc_builtin_semantics.c
+  vendor/src/uplc/builtins/uplc_builtin_semantics.h
+  vendor/src/uplc/builtins/uplc_byte_view.h
+  vendor/src/uplc/cost/uplc_builtin_cost.h
+  vendor/src/uplc/cost/uplc_builtin_cost_arity.h
+  vendor/src/uplc/cost/uplc_builtin_costs.c
+  vendor/src/uplc/cost/uplc_builtin_costs.h
+  vendor/src/uplc/cost/uplc_const_or_linear_cost.h
+  vendor/src/uplc/cost/uplc_const_or_two_arg_cost.h
+  vendor/src/uplc/cost/uplc_cost_model.c
+  vendor/src/uplc/cost/uplc_cost_model.h
+  vendor/src/uplc/cost/uplc_cost_model_version.h
+  vendor/src/uplc/cost/uplc_cost_sat.c
+  vendor/src/uplc/cost/uplc_cost_sat.h
+  vendor/src/uplc/cost/uplc_diag_model_kind.h
+  vendor/src/uplc/cost/uplc_ex_mem.c
+  vendor/src/uplc/cost/uplc_ex_mem.h
+  vendor/src/uplc/cost/uplc_exp_mod_cost.h
+  vendor/src/uplc/cost/uplc_four_arg_cost.c
+  vendor/src/uplc/cost/uplc_four_arg_cost.h
+  vendor/src/uplc/cost/uplc_four_arg_kind.h
+  vendor/src/uplc/cost/uplc_linear_cost.h
+  vendor/src/uplc/cost/uplc_machine_costs.c
+  vendor/src/uplc/cost/uplc_machine_costs.h
+  vendor/src/uplc/cost/uplc_one_arg_cost.c
+  vendor/src/uplc/cost/uplc_one_arg_cost.h
+  vendor/src/uplc/cost/uplc_one_arg_kind.h
+  vendor/src/uplc/cost/uplc_quadratic_cost.h
+  vendor/src/uplc/cost/uplc_selected_cost_model.c
+  vendor/src/uplc/cost/uplc_selected_cost_model.h
+  vendor/src/uplc/cost/uplc_six_arg_cost.c
+  vendor/src/uplc/cost/uplc_six_arg_cost.h
+  vendor/src/uplc/cost/uplc_six_arg_kind.h
+  vendor/src/uplc/cost/uplc_step_accumulator.c
+  vendor/src/uplc/cost/uplc_step_accumulator.h
+  vendor/src/uplc/cost/uplc_step_kind.h
+  vendor/src/uplc/cost/uplc_subtracted_sizes_cost.h
+  vendor/src/uplc/cost/uplc_three_arg_cost.c
+  vendor/src/uplc/cost/uplc_three_arg_cost.h
+  vendor/src/uplc/cost/uplc_three_arg_kind.h
+  vendor/src/uplc/cost/uplc_two_arg_cost.c
+  vendor/src/uplc/cost/uplc_two_arg_cost.h
+  vendor/src/uplc/cost/uplc_two_arg_kind.h
+  vendor/src/uplc/cost/uplc_two_var_linear_cost.h
+  vendor/src/uplc/cost/uplc_two_var_quadratic_cost.h
+  vendor/src/uplc/cost/uplc_with_interaction_cost.h
+  vendor/src/uplc/data/uplc_data.c
+  vendor/src/uplc/data/uplc_data.h
+  vendor/src/uplc/data/uplc_data_kind.h
+  vendor/src/uplc/data/uplc_data_pair.h
+  vendor/src/uplc/flat/flat_decode.c
+  vendor/src/uplc/flat/flat_decode.h
+  vendor/src/uplc/flat/flat_encode.c
+  vendor/src/uplc/flat/flat_encode.h
+  vendor/src/uplc/flat/flat_reader.c
+  vendor/src/uplc/flat/flat_reader.h
+  vendor/src/uplc/flat/flat_writer.c
+  vendor/src/uplc/flat/flat_writer.h
+  vendor/src/uplc/machine/uplc_budget.h
+  vendor/src/uplc/machine/uplc_env.c
+  vendor/src/uplc/machine/uplc_env.h
+  vendor/src/uplc/machine/uplc_eval_result.h
+  vendor/src/uplc/machine/uplc_eval_status.h
+  vendor/src/uplc/machine/uplc_frame.c
+  vendor/src/uplc/machine/uplc_frame.h
+  vendor/src/uplc/machine/uplc_frame_kind.h
+  vendor/src/uplc/machine/uplc_machine.c
+  vendor/src/uplc/machine/uplc_machine.h
+  vendor/src/uplc/machine/uplc_machine_version.h
+  vendor/src/uplc/machine/uplc_state_kind.h
+  vendor/src/uplc/machine/uplc_value.c
+  vendor/src/uplc/machine/uplc_value.h
+  vendor/src/uplc/machine/uplc_value_kind.h
+  vendor/src/uplc/syntax/pretty.c
+  vendor/src/uplc/syntax/pretty.h
+  vendor/src/uplc/syntax/text_parser.c
+  vendor/src/uplc/syntax/text_parser.h
+  vendor/src/uplc/tx/script_context.c
+  vendor/src/uplc/tx/script_context.h
+  vendor/src/uplc/tx/uplc_apply_params.c
+  vendor/src/voting_procedures/governance_action_id_list.c
+  vendor/src/voting_procedures/vote.c
+  vendor/src/voting_procedures/voter.c
+  vendor/src/voting_procedures/voter_list.c
+  vendor/src/voting_procedures/voter_type.c
+  vendor/src/voting_procedures/voting_procedure.c
+  vendor/src/voting_procedures/voting_procedure_list.c
+  vendor/src/voting_procedures/voting_procedure_map.c
+  vendor/src/voting_procedures/voting_procedure_map.h
+  vendor/src/voting_procedures/voting_procedures.c
+  vendor/src/witness_set/bootstrap_witness.c
+  vendor/src/witness_set/bootstrap_witness_set.c
+  vendor/src/witness_set/native_script_set.c
+  vendor/src/witness_set/plutus_data_set.c
+  vendor/src/witness_set/plutus_v1_script_set.c
+  vendor/src/witness_set/plutus_v2_script_set.c
+  vendor/src/witness_set/plutus_v3_script_set.c
+  vendor/src/witness_set/plutus_v4_script_set.c
+  vendor/src/witness_set/redeemer.c
+  vendor/src/witness_set/redeemer_list.c
+  vendor/src/witness_set/vkey_witness.c
+  vendor/src/witness_set/vkey_witness_set.c
+  vendor/src/witness_set/witness_set.c
+
+library sodium
+  visibility: private
+  default-language: Haskell2010
+  c-sources:
+    vendor/external/libsodium/crypto_aead/chacha20poly1305/aead_chacha20poly1305.c
+    vendor/external/libsodium/crypto_auth/crypto_auth.c
+    vendor/external/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c
+    vendor/external/libsodium/crypto_auth/hmacsha512/auth_hmacsha512.c
+    vendor/external/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c
+    vendor/external/libsodium/crypto_core/ed25519/core_ed25519.c
+    vendor/external/libsodium/crypto_core/ed25519/core_ristretto255.c
+    vendor/external/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c
+    vendor/external/libsodium/crypto_core/hchacha20/core_hchacha20.c
+    vendor/external/libsodium/crypto_core/hsalsa20/core_hsalsa20.c
+    vendor/external/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c
+    vendor/external/libsodium/crypto_core/salsa/ref/core_salsa_ref.c
+    vendor/external/libsodium/crypto_generichash/blake2b/generichash_blake2.c
+    vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c
+    vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c
+    vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.c
+    vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c
+    vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c
+    vendor/external/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c
+    vendor/external/libsodium/crypto_generichash/crypto_generichash.c
+    vendor/external/libsodium/crypto_hash/crypto_hash.c
+    vendor/external/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c
+    vendor/external/libsodium/crypto_hash/sha256/hash_sha256.c
+    vendor/external/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c
+    vendor/external/libsodium/crypto_hash/sha512/hash_sha512.c
+    vendor/external/libsodium/crypto_onetimeauth/crypto_onetimeauth.c
+    vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.c
+    vendor/external/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c
+    vendor/external/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c
+    vendor/external/libsodium/crypto_scalarmult/crypto_scalarmult.c
+    vendor/external/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c
+    vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c
+    vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c
+    vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c
+    vendor/external/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c
+    vendor/external/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c
+    vendor/external/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c
+    vendor/external/libsodium/crypto_sign/crypto_sign.c
+    vendor/external/libsodium/crypto_sign/ed25519/ref10/keypair.c
+    vendor/external/libsodium/crypto_sign/ed25519/ref10/obsolete.c
+    vendor/external/libsodium/crypto_sign/ed25519/ref10/open.c
+    vendor/external/libsodium/crypto_sign/ed25519/ref10/sign.c
+    vendor/external/libsodium/crypto_sign/ed25519/sign_ed25519.c
+    vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c
+    vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c
+    vendor/external/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c
+    vendor/external/libsodium/crypto_stream/chacha20/stream_chacha20.c
+    vendor/external/libsodium/crypto_stream/crypto_stream.c
+    vendor/external/libsodium/crypto_stream/salsa20/ref/salsa20_ref.c
+    vendor/external/libsodium/crypto_stream/salsa20/stream_salsa20.c
+    vendor/external/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.c
+    vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.c
+    vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c
+    vendor/external/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012_ref.c
+    vendor/external/libsodium/crypto_stream/salsa2012/stream_salsa2012.c
+    vendor/external/libsodium/crypto_stream/salsa208/ref/stream_salsa208_ref.c
+    vendor/external/libsodium/crypto_stream/salsa208/stream_salsa208.c
+    vendor/external/libsodium/crypto_stream/xchacha20/stream_xchacha20.c
+    vendor/external/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c
+    vendor/external/libsodium/crypto_verify/verify.c
+    vendor/external/libsodium/randombytes/internal/randombytes_internal_random.c
+    vendor/external/libsodium/randombytes/randombytes.c
+    vendor/external/libsodium/randombytes/sysrandom/randombytes_sysrandom.c
+    vendor/external/libsodium/sodium/codecs.c
+    vendor/external/libsodium/sodium/core.c
+    vendor/external/libsodium/sodium/runtime.c
+    vendor/external/libsodium/sodium/utils.c
+    vendor/external/libsodium/sodium/version.c
+  include-dirs:
+    vendor
+    vendor/include
+    vendor/external/libsodium/include
+    vendor/external/libsodium/include/sodium
+    vendor/external/gmp
+    vendor/external/sha3
+    vendor/external/ripemd160
+    vendor/external/secp256k1/include
+    vendor/external/blst/bindings
+  cc-options: -std=c99 -DSODIUM_STATIC -DJSONC_STATIC -w
+  if !os(windows)
+    cc-options: -DHAVE_PTHREAD=1
+    extra-libraries: pthread
+
+library gmp
+  visibility: private
+  default-language: Haskell2010
+  c-sources:
+    vendor/external/gmp/mini-gmp.c
+  include-dirs:
+    vendor
+    vendor/include
+    vendor/external/libsodium/include
+    vendor/external/libsodium/include/sodium
+    vendor/external/gmp
+    vendor/external/sha3
+    vendor/external/ripemd160
+    vendor/external/secp256k1/include
+    vendor/external/blst/bindings
+  cc-options: -std=c99 -DSODIUM_STATIC -DJSONC_STATIC -w
+
+library sha3
+  visibility: private
+  default-language: Haskell2010
+  c-sources:
+    vendor/external/sha3/sha3.c
+  include-dirs:
+    vendor
+    vendor/include
+    vendor/external/libsodium/include
+    vendor/external/libsodium/include/sodium
+    vendor/external/gmp
+    vendor/external/sha3
+    vendor/external/ripemd160
+    vendor/external/secp256k1/include
+    vendor/external/blst/bindings
+  cc-options: -std=c99 -DSODIUM_STATIC -DJSONC_STATIC -w
+
+library ripemd160
+  visibility: private
+  default-language: Haskell2010
+  c-sources:
+    vendor/external/ripemd160/ripemd160.c
+  include-dirs:
+    vendor
+    vendor/include
+    vendor/external/libsodium/include
+    vendor/external/libsodium/include/sodium
+    vendor/external/gmp
+    vendor/external/sha3
+    vendor/external/ripemd160
+    vendor/external/secp256k1/include
+    vendor/external/blst/bindings
+  cc-options: -std=c99 -DSODIUM_STATIC -DJSONC_STATIC -w
+
+library secp256k1
+  visibility: private
+  default-language: Haskell2010
+  c-sources:
+    vendor/external/secp256k1/src/precomputed_ecmult.c
+    vendor/external/secp256k1/src/precomputed_ecmult_gen.c
+    vendor/external/secp256k1/src/secp256k1.c
+  include-dirs:
+    vendor
+    vendor/include
+    vendor/external/libsodium/include
+    vendor/external/libsodium/include/sodium
+    vendor/external/gmp
+    vendor/external/sha3
+    vendor/external/ripemd160
+    vendor/external/secp256k1/include
+    vendor/external/blst/bindings
+  cc-options: -std=c99 -DSODIUM_STATIC -DJSONC_STATIC -w -DENABLE_MODULE_EXTRAKEYS=1 -DENABLE_MODULE_SCHNORRSIG=1 -DECMULT_WINDOW_SIZE=8 -DSECP256K1_STATIC
+
+library blst
+  visibility: private
+  default-language: Haskell2010
+  c-sources:
+    vendor/external/blst/src/server.c
+  include-dirs:
+    vendor
+    vendor/include
+    vendor/external/libsodium/include
+    vendor/external/libsodium/include/sodium
+    vendor/external/gmp
+    vendor/external/sha3
+    vendor/external/ripemd160
+    vendor/external/secp256k1/include
+    vendor/external/blst/bindings
+  cc-options: -std=c99 -DSODIUM_STATIC -DJSONC_STATIC -w -D__BLST_NO_ASM__ -D__BLST_PORTABLE__
+
+library
+  default-language: Haskell2010
+  build-depends: sodium, gmp, sha3, ripemd160, secp256k1, blst
+  c-sources:
+    vendor/src/address/address.c
+    vendor/src/address/base_address.c
+    vendor/src/address/byron_address.c
+    vendor/src/address/enterprise_address.c
+    vendor/src/address/internals/addr_common.c
+    vendor/src/address/internals/base_addr_pack.c
+    vendor/src/address/internals/byron_addr_pack.c
+    vendor/src/address/internals/enterprise_addr_pack.c
+    vendor/src/address/internals/pointer_addr_pack.c
+    vendor/src/address/internals/reward_addr_pack.c
+    vendor/src/address/pointer_address.c
+    vendor/src/address/reward_address.c
+    vendor/src/allocators.c
+    vendor/src/assets/asset_id.c
+    vendor/src/assets/asset_id_list.c
+    vendor/src/assets/asset_id_map.c
+    vendor/src/assets/asset_name.c
+    vendor/src/assets/asset_name_list.c
+    vendor/src/assets/asset_name_map.c
+    vendor/src/assets/multi_asset.c
+    vendor/src/assets/policy_id_list.c
+    vendor/src/auxiliary_data/auxiliary_data.c
+    vendor/src/auxiliary_data/metadatum.c
+    vendor/src/auxiliary_data/metadatum_label_list.c
+    vendor/src/auxiliary_data/metadatum_list.c
+    vendor/src/auxiliary_data/metadatum_map.c
+    vendor/src/auxiliary_data/plutus_v1_script_list.c
+    vendor/src/auxiliary_data/plutus_v2_script_list.c
+    vendor/src/auxiliary_data/plutus_v3_script_list.c
+    vendor/src/auxiliary_data/plutus_v4_script_list.c
+    vendor/src/auxiliary_data/transaction_metadata.c
+    vendor/src/bip39/bip39.c
+    vendor/src/buffer/buffer.c
+    vendor/src/cardano.c
+    vendor/src/cbor/cbor_initial_byte.c
+    vendor/src/cbor/cbor_major_type.c
+    vendor/src/cbor/cbor_reader/cbor_reader.c
+    vendor/src/cbor/cbor_reader/cbor_reader_collections.c
+    vendor/src/cbor/cbor_reader/cbor_reader_core.c
+    vendor/src/cbor/cbor_reader/cbor_reader_numeric.c
+    vendor/src/cbor/cbor_reader/cbor_reader_simple_values.c
+    vendor/src/cbor/cbor_reader/cbor_reader_tags.c
+    vendor/src/cbor/cbor_reader_state.c
+    vendor/src/cbor/cbor_simple_value.c
+    vendor/src/cbor/cbor_tag.c
+    vendor/src/cbor/cbor_validation.c
+    vendor/src/cbor/cbor_writer.c
+    vendor/src/certs/auth_committee_hot_cert.c
+    vendor/src/certs/cert_type.c
+    vendor/src/certs/certificate.c
+    vendor/src/certs/certificate_set.c
+    vendor/src/certs/genesis_key_delegation_cert.c
+    vendor/src/certs/mir_cert.c
+    vendor/src/certs/mir_to_pot_cert.c
+    vendor/src/certs/mir_to_stake_creds_cert.c
+    vendor/src/certs/pool_registration_cert.c
+    vendor/src/certs/pool_retirement_cert.c
+    vendor/src/certs/register_drep_cert.c
+    vendor/src/certs/registration_cert.c
+    vendor/src/certs/resign_committee_cold_cert.c
+    vendor/src/certs/stake_delegation_cert.c
+    vendor/src/certs/stake_deregistration_cert.c
+    vendor/src/certs/stake_registration_cert.c
+    vendor/src/certs/stake_registration_delegation_cert.c
+    vendor/src/certs/stake_vote_delegation_cert.c
+    vendor/src/certs/stake_vote_registration_delegation_cert.c
+    vendor/src/certs/unregister_drep_cert.c
+    vendor/src/certs/unregistration_cert.c
+    vendor/src/certs/update_drep_cert.c
+    vendor/src/certs/vote_delegation_cert.c
+    vendor/src/certs/vote_registration_delegation_cert.c
+    vendor/src/collections/array.c
+    vendor/src/collections/set.c
+    vendor/src/common/anchor.c
+    vendor/src/common/bigint.c
+    vendor/src/common/credential.c
+    vendor/src/common/datum.c
+    vendor/src/common/drep.c
+    vendor/src/common/ex_units.c
+    vendor/src/common/governance_action_id.c
+    vendor/src/common/guard_set.c
+    vendor/src/common/ledger_order.c
+    vendor/src/common/network_magic.c
+    vendor/src/common/protocol_version.c
+    vendor/src/common/reward_address_list.c
+    vendor/src/common/unit_interval.c
+    vendor/src/common/utxo.c
+    vendor/src/common/utxo_list.c
+    vendor/src/common/withdrawal_map.c
+    vendor/src/crypto/arithmetic.c
+    vendor/src/crypto/bip32_key_derivation.c
+    vendor/src/crypto/bip32_private_key.c
+    vendor/src/crypto/bip32_public_key.c
+    vendor/src/crypto/blake2b_hash.c
+    vendor/src/crypto/blake2b_hash_set.c
+    vendor/src/crypto/crc32.c
+    vendor/src/crypto/ed25519_private_key.c
+    vendor/src/crypto/ed25519_public_key.c
+    vendor/src/crypto/ed25519_signature.c
+    vendor/src/crypto/emip3.c
+    vendor/src/crypto/pbkdf2.c
+    vendor/src/encoding/base58.c
+    vendor/src/encoding/bech32.c
+    vendor/src/endian.c
+    vendor/src/error.c
+    vendor/src/json/internals/json_object_common.c
+    vendor/src/json/internals/json_object_serialization.c
+    vendor/src/json/internals/json_parser.c
+    vendor/src/json/internals/json_writer_common.c
+    vendor/src/json/internals/utf8.c
+    vendor/src/json/json_object.c
+    vendor/src/json/json_writer.c
+    vendor/src/key_handlers/secure_key_handler.c
+    vendor/src/key_handlers/software_secure_key_handler.c
+    vendor/src/message_signing/cip8.c
+    vendor/src/object.c
+    vendor/src/plutus_data/constr_plutus_data.c
+    vendor/src/plutus_data/plutus_data.c
+    vendor/src/plutus_data/plutus_list.c
+    vendor/src/plutus_data/plutus_map.c
+    vendor/src/pool_params/bls_key.c
+    vendor/src/pool_params/ipv4.c
+    vendor/src/pool_params/ipv6.c
+    vendor/src/pool_params/multi_host_name_relay.c
+    vendor/src/pool_params/pool_metadata.c
+    vendor/src/pool_params/pool_owners.c
+    vendor/src/pool_params/pool_params.c
+    vendor/src/pool_params/relay.c
+    vendor/src/pool_params/relay_type.c
+    vendor/src/pool_params/relays.c
+    vendor/src/pool_params/single_host_addr_relay.c
+    vendor/src/pool_params/single_host_name_relay.c
+    vendor/src/proposal_procedures/committee.c
+    vendor/src/proposal_procedures/committee_members_map.c
+    vendor/src/proposal_procedures/constitution.c
+    vendor/src/proposal_procedures/credential_set.c
+    vendor/src/proposal_procedures/governance_action_type.c
+    vendor/src/proposal_procedures/hard_fork_initiation_action.c
+    vendor/src/proposal_procedures/info_action.c
+    vendor/src/proposal_procedures/new_constitution_action.c
+    vendor/src/proposal_procedures/no_confidence_action.c
+    vendor/src/proposal_procedures/parameter_change_action.c
+    vendor/src/proposal_procedures/proposal_procedure.c
+    vendor/src/proposal_procedures/proposal_procedure_set.c
+    vendor/src/proposal_procedures/treasury_withdrawals_action.c
+    vendor/src/proposal_procedures/update_committee_action.c
+    vendor/src/protocol_params/cost_model.c
+    vendor/src/protocol_params/costmdls.c
+    vendor/src/protocol_params/drep_voting_thresholds.c
+    vendor/src/protocol_params/ex_unit_prices.c
+    vendor/src/protocol_params/pool_voting_thresholds.c
+    vendor/src/protocol_params/proposed_param_updates.c
+    vendor/src/protocol_params/protocol_param_update.c
+    vendor/src/protocol_params/protocol_parameters.c
+    vendor/src/protocol_params/update.c
+    vendor/src/providers/emscripten/emscripten_provider.c
+    vendor/src/providers/provider.c
+    vendor/src/scripts/native_scripts/native_script.c
+    vendor/src/scripts/native_scripts/native_script_list.c
+    vendor/src/scripts/native_scripts/native_script_type.c
+    vendor/src/scripts/native_scripts/script_all.c
+    vendor/src/scripts/native_scripts/script_any.c
+    vendor/src/scripts/native_scripts/script_invalid_after.c
+    vendor/src/scripts/native_scripts/script_invalid_before.c
+    vendor/src/scripts/native_scripts/script_n_of_k.c
+    vendor/src/scripts/native_scripts/script_pubkey.c
+    vendor/src/scripts/native_scripts/script_require_guard.c
+    vendor/src/scripts/plutus_scripts/plutus_v1_script.c
+    vendor/src/scripts/plutus_scripts/plutus_v2_script.c
+    vendor/src/scripts/plutus_scripts/plutus_v3_script.c
+    vendor/src/scripts/plutus_scripts/plutus_v4_script.c
+    vendor/src/scripts/script.c
+    vendor/src/string_safe.c
+    vendor/src/time.c
+    vendor/src/transaction/sub_transaction.c
+    vendor/src/transaction/transaction.c
+    vendor/src/transaction_body/account_balance_interval.c
+    vendor/src/transaction_body/account_balance_intervals_map.c
+    vendor/src/transaction_body/direct_deposit_map.c
+    vendor/src/transaction_body/internals/body_fields.c
+    vendor/src/transaction_body/required_guards_map.c
+    vendor/src/transaction_body/sub_transaction_body.c
+    vendor/src/transaction_body/sub_transaction_set.c
+    vendor/src/transaction_body/transaction_body.c
+    vendor/src/transaction_body/transaction_input.c
+    vendor/src/transaction_body/transaction_input_set.c
+    vendor/src/transaction_body/transaction_output.c
+    vendor/src/transaction_body/transaction_output_list.c
+    vendor/src/transaction_body/value.c
+    vendor/src/transaction_builder/balancing/deferred_redeemer_list.c
+    vendor/src/transaction_builder/balancing/implicit_coin.c
+    vendor/src/transaction_builder/balancing/input_to_redeemer_map.c
+    vendor/src/transaction_builder/balancing/internals/collateral.c
+    vendor/src/transaction_builder/balancing/internals/pool_deposits.c
+    vendor/src/transaction_builder/balancing/internals/scripts_needed.c
+    vendor/src/transaction_builder/balancing/internals/unique_signers.c
+    vendor/src/transaction_builder/balancing/transaction_balancing.c
+    vendor/src/transaction_builder/coin_selection/coin_selector.c
+    vendor/src/transaction_builder/coin_selection/internals/change_builder.c
+    vendor/src/transaction_builder/coin_selection/internals/emscripten_coin_selector.c
+    vendor/src/transaction_builder/coin_selection/internals/large_first_coin_selector.c
+    vendor/src/transaction_builder/coin_selection/internals/large_first_helpers.c
+    vendor/src/transaction_builder/coin_selection/internals/random_improve_change_state.c
+    vendor/src/transaction_builder/coin_selection/internals/random_improve_coin_selector.c
+    vendor/src/transaction_builder/coin_selection/internals/random_improve_helpers.c
+    vendor/src/transaction_builder/coin_selection/internals/random_improve_selection_index.c
+    vendor/src/transaction_builder/coin_selection/internals/random_improve_utxo_utils.c
+    vendor/src/transaction_builder/coin_selection/internals/value_splitting.c
+    vendor/src/transaction_builder/evaluation/emscripten_tx_evaluator.c
+    vendor/src/transaction_builder/evaluation/native_tx_evaluator.c
+    vendor/src/transaction_builder/evaluation/provider_tx_evaluator.c
+    vendor/src/transaction_builder/evaluation/tx_evaluator.c
+    vendor/src/transaction_builder/fee.c
+    vendor/src/transaction_builder/internals/blake2b_hash_to_redeemer_map.c
+    vendor/src/transaction_builder/internals/builder_build.c
+    vendor/src/transaction_builder/internals/builder_certs.c
+    vendor/src/transaction_builder/internals/builder_config.c
+    vendor/src/transaction_builder/internals/builder_entities.c
+    vendor/src/transaction_builder/internals/builder_inputs.c
+    vendor/src/transaction_builder/internals/builder_mint.c
+    vendor/src/transaction_builder/internals/builder_outputs.c
+    vendor/src/transaction_builder/internals/builder_proposals.c
+    vendor/src/transaction_builder/internals/builder_redeemers.c
+    vendor/src/transaction_builder/internals/builder_state.c
+    vendor/src/transaction_builder/internals/builder_sub_build.c
+    vendor/src/transaction_builder/internals/builder_sub_transactions.c
+    vendor/src/transaction_builder/internals/builder_votes.c
+    vendor/src/transaction_builder/internals/builder_withdrawals.c
+    vendor/src/transaction_builder/internals/builder_witnesses.c
+    vendor/src/transaction_builder/internals/created_output_scripts.c
+    vendor/src/transaction_builder/script_data_hash.c
+    vendor/src/transaction_builder/sub_transaction_builder.c
+    vendor/src/transaction_builder/transaction_builder.c
+    vendor/src/uplc/arena/uplc_arena.c
+    vendor/src/uplc/ast/uplc_constant.c
+    vendor/src/uplc/ast/uplc_int.c
+    vendor/src/uplc/ast/uplc_int_math.c
+    vendor/src/uplc/ast/uplc_lang_version.c
+    vendor/src/uplc/ast/uplc_program.c
+    vendor/src/uplc/ast/uplc_term.c
+    vendor/src/uplc/ast/uplc_type.c
+    vendor/src/uplc/builtins/bls.c
+    vendor/src/uplc/builtins/builtins.c
+    vendor/src/uplc/builtins/uplc_builtin.c
+    vendor/src/uplc/builtins/uplc_builtin_semantics.c
+    vendor/src/uplc/cost/uplc_builtin_costs.c
+    vendor/src/uplc/cost/uplc_cost_model.c
+    vendor/src/uplc/cost/uplc_cost_sat.c
+    vendor/src/uplc/cost/uplc_ex_mem.c
+    vendor/src/uplc/cost/uplc_four_arg_cost.c
+    vendor/src/uplc/cost/uplc_machine_costs.c
+    vendor/src/uplc/cost/uplc_one_arg_cost.c
+    vendor/src/uplc/cost/uplc_selected_cost_model.c
+    vendor/src/uplc/cost/uplc_six_arg_cost.c
+    vendor/src/uplc/cost/uplc_step_accumulator.c
+    vendor/src/uplc/cost/uplc_three_arg_cost.c
+    vendor/src/uplc/cost/uplc_two_arg_cost.c
+    vendor/src/uplc/data/uplc_data.c
+    vendor/src/uplc/flat/flat_decode.c
+    vendor/src/uplc/flat/flat_encode.c
+    vendor/src/uplc/flat/flat_reader.c
+    vendor/src/uplc/flat/flat_writer.c
+    vendor/src/uplc/machine/uplc_env.c
+    vendor/src/uplc/machine/uplc_frame.c
+    vendor/src/uplc/machine/uplc_machine.c
+    vendor/src/uplc/machine/uplc_value.c
+    vendor/src/uplc/syntax/pretty.c
+    vendor/src/uplc/syntax/text_parser.c
+    vendor/src/uplc/tx/script_context.c
+    vendor/src/uplc/tx/uplc_apply_params.c
+    vendor/src/voting_procedures/governance_action_id_list.c
+    vendor/src/voting_procedures/vote.c
+    vendor/src/voting_procedures/voter.c
+    vendor/src/voting_procedures/voter_list.c
+    vendor/src/voting_procedures/voter_type.c
+    vendor/src/voting_procedures/voting_procedure.c
+    vendor/src/voting_procedures/voting_procedure_list.c
+    vendor/src/voting_procedures/voting_procedure_map.c
+    vendor/src/voting_procedures/voting_procedures.c
+    vendor/src/witness_set/bootstrap_witness.c
+    vendor/src/witness_set/bootstrap_witness_set.c
+    vendor/src/witness_set/native_script_set.c
+    vendor/src/witness_set/plutus_data_set.c
+    vendor/src/witness_set/plutus_v1_script_set.c
+    vendor/src/witness_set/plutus_v2_script_set.c
+    vendor/src/witness_set/plutus_v3_script_set.c
+    vendor/src/witness_set/plutus_v4_script_set.c
+    vendor/src/witness_set/redeemer.c
+    vendor/src/witness_set/redeemer_list.c
+    vendor/src/witness_set/vkey_witness.c
+    vendor/src/witness_set/vkey_witness_set.c
+    vendor/src/witness_set/witness_set.c
+  include-dirs:
+    vendor
+    vendor/include
+    vendor/external/libsodium/include
+    vendor/external/libsodium/include/sodium
+    vendor/external/gmp
+    vendor/external/sha3
+    vendor/external/ripemd160
+    vendor/external/secp256k1/include
+    vendor/external/blst/bindings
+  install-includes:
+    cardano/address/address.h
+    cardano/address/address_type.h
+    cardano/address/base_address.h
+    cardano/address/byron_address.h
+    cardano/address/byron_address_attributes.h
+    cardano/address/byron_address_type.h
+    cardano/address/enterprise_address.h
+    cardano/address/pointer_address.h
+    cardano/address/reward_address.h
+    cardano/address/stake_pointer.h
+    cardano/assets/asset_id.h
+    cardano/assets/asset_id_list.h
+    cardano/assets/asset_id_map.h
+    cardano/assets/asset_name.h
+    cardano/assets/asset_name_list.h
+    cardano/assets/asset_name_map.h
+    cardano/assets/multi_asset.h
+    cardano/assets/policy_id_list.h
+    cardano/auxiliary_data/auxiliary_data.h
+    cardano/auxiliary_data/metadatum.h
+    cardano/auxiliary_data/metadatum_kind.h
+    cardano/auxiliary_data/metadatum_label_list.h
+    cardano/auxiliary_data/metadatum_list.h
+    cardano/auxiliary_data/metadatum_map.h
+    cardano/auxiliary_data/plutus_v1_script_list.h
+    cardano/auxiliary_data/plutus_v2_script_list.h
+    cardano/auxiliary_data/plutus_v3_script_list.h
+    cardano/auxiliary_data/plutus_v4_script_list.h
+    cardano/auxiliary_data/transaction_metadata.h
+    cardano/bip39.h
+    cardano/buffer.h
+    cardano/cardano.h
+    cardano/cbor/cbor_major_type.h
+    cardano/cbor/cbor_reader.h
+    cardano/cbor/cbor_reader_state.h
+    cardano/cbor/cbor_simple_value.h
+    cardano/cbor/cbor_tag.h
+    cardano/cbor/cbor_writer.h
+    cardano/certs/auth_committee_hot_cert.h
+    cardano/certs/cert_type.h
+    cardano/certs/certificate.h
+    cardano/certs/certificate_set.h
+    cardano/certs/genesis_key_delegation_cert.h
+    cardano/certs/mir_cert.h
+    cardano/certs/mir_cert_pot_type.h
+    cardano/certs/mir_cert_type.h
+    cardano/certs/mir_to_pot_cert.h
+    cardano/certs/mir_to_stake_creds_cert.h
+    cardano/certs/pool_registration_cert.h
+    cardano/certs/pool_retirement_cert.h
+    cardano/certs/register_drep_cert.h
+    cardano/certs/registration_cert.h
+    cardano/certs/resign_committee_cold_cert.h
+    cardano/certs/stake_delegation_cert.h
+    cardano/certs/stake_deregistration_cert.h
+    cardano/certs/stake_registration_cert.h
+    cardano/certs/stake_registration_delegation_cert.h
+    cardano/certs/stake_vote_delegation_cert.h
+    cardano/certs/stake_vote_registration_delegation_cert.h
+    cardano/certs/unregister_drep_cert.h
+    cardano/certs/unregistration_cert.h
+    cardano/certs/update_drep_cert.h
+    cardano/certs/vote_delegation_cert.h
+    cardano/certs/vote_registration_delegation_cert.h
+    cardano/common/anchor.h
+    cardano/common/bigint.h
+    cardano/common/byte_order.h
+    cardano/common/credential.h
+    cardano/common/credential_type.h
+    cardano/common/datum.h
+    cardano/common/datum_type.h
+    cardano/common/drep.h
+    cardano/common/drep_type.h
+    cardano/common/ex_units.h
+    cardano/common/governance_action_id.h
+    cardano/common/governance_key_type.h
+    cardano/common/guard_set.h
+    cardano/common/network_id.h
+    cardano/common/network_magic.h
+    cardano/common/protocol_version.h
+    cardano/common/reward_address_list.h
+    cardano/common/unit_interval.h
+    cardano/common/utxo.h
+    cardano/common/utxo_list.h
+    cardano/common/withdrawal_map.h
+    cardano/crypto/bip32_private_key.h
+    cardano/crypto/bip32_public_key.h
+    cardano/crypto/blake2b_hash.h
+    cardano/crypto/blake2b_hash_set.h
+    cardano/crypto/blake2b_hash_size.h
+    cardano/crypto/crc32.h
+    cardano/crypto/ed25519_private_key.h
+    cardano/crypto/ed25519_public_key.h
+    cardano/crypto/ed25519_signature.h
+    cardano/crypto/emip3.h
+    cardano/crypto/pbkdf2.h
+    cardano/encoding/base58.h
+    cardano/encoding/bech32.h
+    cardano/error.h
+    cardano/export.h
+    cardano/json/json_context.h
+    cardano/json/json_format.h
+    cardano/json/json_object.h
+    cardano/json/json_object_type.h
+    cardano/json/json_writer.h
+    cardano/key_handlers/account_derivation_path.h
+    cardano/key_handlers/cip_1852_constants.h
+    cardano/key_handlers/derivation_path.h
+    cardano/key_handlers/secure_key_handler.h
+    cardano/key_handlers/secure_key_handler_impl.h
+    cardano/key_handlers/secure_key_handler_type.h
+    cardano/key_handlers/software_secure_key_handler.h
+    cardano/message_signing/cip8.h
+    cardano/object.h
+    cardano/plutus_data/constr_plutus_data.h
+    cardano/plutus_data/plutus_data.h
+    cardano/plutus_data/plutus_data_kind.h
+    cardano/plutus_data/plutus_list.h
+    cardano/plutus_data/plutus_map.h
+    cardano/pool_params/bls_key.h
+    cardano/pool_params/ipv4.h
+    cardano/pool_params/ipv6.h
+    cardano/pool_params/multi_host_name_relay.h
+    cardano/pool_params/pool_metadata.h
+    cardano/pool_params/pool_owners.h
+    cardano/pool_params/pool_params.h
+    cardano/pool_params/relay.h
+    cardano/pool_params/relay_type.h
+    cardano/pool_params/relays.h
+    cardano/pool_params/single_host_addr_relay.h
+    cardano/pool_params/single_host_name_relay.h
+    cardano/proposal_procedures/committee.h
+    cardano/proposal_procedures/committee_members_map.h
+    cardano/proposal_procedures/constitution.h
+    cardano/proposal_procedures/credential_set.h
+    cardano/proposal_procedures/governance_action_type.h
+    cardano/proposal_procedures/hard_fork_initiation_action.h
+    cardano/proposal_procedures/info_action.h
+    cardano/proposal_procedures/new_constitution_action.h
+    cardano/proposal_procedures/no_confidence_action.h
+    cardano/proposal_procedures/parameter_change_action.h
+    cardano/proposal_procedures/proposal_procedure.h
+    cardano/proposal_procedures/proposal_procedure_set.h
+    cardano/proposal_procedures/treasury_withdrawals_action.h
+    cardano/proposal_procedures/update_committee_action.h
+    cardano/protocol_params/cost_model.h
+    cardano/protocol_params/costmdls.h
+    cardano/protocol_params/drep_voting_thresholds.h
+    cardano/protocol_params/ex_unit_prices.h
+    cardano/protocol_params/pool_voting_thresholds.h
+    cardano/protocol_params/proposed_param_updates.h
+    cardano/protocol_params/protocol_param_update.h
+    cardano/protocol_params/protocol_parameters.h
+    cardano/protocol_params/update.h
+    cardano/providers/provider.h
+    cardano/providers/provider_impl.h
+    cardano/scripts/native_scripts/native_script.h
+    cardano/scripts/native_scripts/native_script_list.h
+    cardano/scripts/native_scripts/native_script_type.h
+    cardano/scripts/native_scripts/script_all.h
+    cardano/scripts/native_scripts/script_any.h
+    cardano/scripts/native_scripts/script_invalid_after.h
+    cardano/scripts/native_scripts/script_invalid_before.h
+    cardano/scripts/native_scripts/script_n_of_k.h
+    cardano/scripts/native_scripts/script_pubkey.h
+    cardano/scripts/native_scripts/script_require_guard.h
+    cardano/scripts/plutus_scripts/plutus_language_version.h
+    cardano/scripts/plutus_scripts/plutus_v1_script.h
+    cardano/scripts/plutus_scripts/plutus_v2_script.h
+    cardano/scripts/plutus_scripts/plutus_v3_script.h
+    cardano/scripts/plutus_scripts/plutus_v4_script.h
+    cardano/scripts/script.h
+    cardano/scripts/script_language.h
+    cardano/slot_config.h
+    cardano/time.h
+    cardano/transaction/sub_transaction.h
+    cardano/transaction/transaction.h
+    cardano/transaction_body/account_balance_interval.h
+    cardano/transaction_body/account_balance_intervals_map.h
+    cardano/transaction_body/direct_deposit_map.h
+    cardano/transaction_body/required_guards_map.h
+    cardano/transaction_body/sub_transaction_body.h
+    cardano/transaction_body/sub_transaction_set.h
+    cardano/transaction_body/transaction_body.h
+    cardano/transaction_body/transaction_input.h
+    cardano/transaction_body/transaction_input_set.h
+    cardano/transaction_body/transaction_output.h
+    cardano/transaction_body/transaction_output_list.h
+    cardano/transaction_body/value.h
+    cardano/transaction_builder/balancing/deferred_redeemer_list.h
+    cardano/transaction_builder/balancing/implicit_coin.h
+    cardano/transaction_builder/balancing/input_to_redeemer_map.h
+    cardano/transaction_builder/balancing/transaction_balancing.h
+    cardano/transaction_builder/coin_selection/coin_selection_request.h
+    cardano/transaction_builder/coin_selection/coin_selection_strategy.h
+    cardano/transaction_builder/coin_selection/coin_selector.h
+    cardano/transaction_builder/coin_selection/coin_selector_impl.h
+    cardano/transaction_builder/coin_selection/large_first_coin_selector.h
+    cardano/transaction_builder/coin_selection/random_improve_coin_selector.h
+    cardano/transaction_builder/evaluation/native_tx_evaluator.h
+    cardano/transaction_builder/evaluation/provider_tx_evaluator.h
+    cardano/transaction_builder/evaluation/tx_evaluator.h
+    cardano/transaction_builder/evaluation/tx_evaluator_impl.h
+    cardano/transaction_builder/fee.h
+    cardano/transaction_builder/script_data_hash.h
+    cardano/transaction_builder/sub_transaction_builder.h
+    cardano/transaction_builder/transaction_builder.h
+    cardano/typedefs.h
+    cardano/uplc/uplc_apply_params.h
+    cardano/voting_procedures/governance_action_id_list.h
+    cardano/voting_procedures/vote.h
+    cardano/voting_procedures/voter.h
+    cardano/voting_procedures/voter_list.h
+    cardano/voting_procedures/voter_type.h
+    cardano/voting_procedures/voting_procedure.h
+    cardano/voting_procedures/voting_procedure_list.h
+    cardano/voting_procedures/voting_procedures.h
+    cardano/witness_set/bootstrap_witness.h
+    cardano/witness_set/bootstrap_witness_set.h
+    cardano/witness_set/native_script_set.h
+    cardano/witness_set/plutus_data_set.h
+    cardano/witness_set/plutus_v1_script_set.h
+    cardano/witness_set/plutus_v2_script_set.h
+    cardano/witness_set/plutus_v3_script_set.h
+    cardano/witness_set/plutus_v4_script_set.h
+    cardano/witness_set/redeemer.h
+    cardano/witness_set/redeemer_list.h
+    cardano/witness_set/redeemer_tag.h
+    cardano/witness_set/vkey_witness.h
+    cardano/witness_set/vkey_witness_set.h
+    cardano/witness_set/witness_set.h
+  cc-options: -std=c99 -DSODIUM_STATIC -DJSONC_STATIC
+  if !os(windows)
+    extra-libraries: m, pthread
diff --git a/licenses/CC0-1.0.txt b/licenses/CC0-1.0.txt
new file mode 100644
--- /dev/null
+++ b/licenses/CC0-1.0.txt
@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+    LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+    ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+    INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+    REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+    PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+    THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+    HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+  i. the right to reproduce, adapt, distribute, perform, display,
+     communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+     likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+     subject to the limitations in paragraph 4(a), below;
+  v. rights protecting the extraction, dissemination, use and reuse of data
+     in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+     European Parliament and of the Council of 11 March 1996 on the legal
+     protection of databases, and under any national implementation
+     thereof, including any amended or successor version of such
+     directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+     world based on applicable law or treaty, and any national
+     implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+    surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+    warranties of any kind concerning the Work, express, implied,
+    statutory or otherwise, including without limitation warranties of
+    title, merchantability, fitness for a particular purpose, non
+    infringement, or the absence of latent or other defects, accuracy, or
+    the present or absence of errors, whether or not discoverable, all to
+    the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+    that may apply to the Work or any use thereof, including without
+    limitation any person's Copyright and Related Rights in the Work.
+    Further, Affirmer disclaims responsibility for obtaining any necessary
+    consents, permissions or other rights required for any use of the
+    Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+    party to this document and has no duty or obligation with respect to
+    this CC0 or use of the Work.
diff --git a/licenses/GPL-2.0.txt b/licenses/GPL-2.0.txt
new file mode 100644
--- /dev/null
+++ b/licenses/GPL-2.0.txt
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/licenses/GPL-3.0.txt b/licenses/GPL-3.0.txt
new file mode 100644
--- /dev/null
+++ b/licenses/GPL-3.0.txt
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/licenses/LGPL-3.0.txt b/licenses/LGPL-3.0.txt
new file mode 100644
--- /dev/null
+++ b/licenses/LGPL-3.0.txt
@@ -0,0 +1,165 @@
+                   GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions.
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version.
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/licenses/libsodium-sha-BSD-2-Clause.txt b/licenses/libsodium-sha-BSD-2-Clause.txt
new file mode 100644
--- /dev/null
+++ b/licenses/libsodium-sha-BSD-2-Clause.txt
@@ -0,0 +1,27 @@
+/*-
+ * Copyright 2005,2007,2009 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
diff --git a/vendor/external/README b/vendor/external/README
new file mode 100644
--- /dev/null
+++ b/vendor/external/README
@@ -0,0 +1,71 @@
+Third-party libraries vendored into cardano-c
+=============================================
+
+Each dependency below is vendored under lib/external/<name>/, compiled as an
+isolated CMake OBJECT library with warnings and clang-tidy disabled for that
+target only, and folded into libcardano-c. The upstream license text is kept
+verbatim in each directory; copyright notices are never altered. All listed
+licenses are compatible with the project's Apache-2.0 license.
+
+libsodium
+  Use:      SHA-256, SHA-512, Blake2b, Ed25519, HMAC, constant-time compare.
+  License:  ISC (see libsodium/LICENSE).
+  Origin:   https://github.com/jedisct1/libsodium
+
+gmp (mini-gmp)
+  Use:      arbitrary-precision integers backing cardano_bigint_t.
+  License:  LGPL/GPL dual (see gmp/README and the headers).
+  Origin:   https://gmplib.org (mini-gmp subset)
+
+sha3
+  Use:      SHA3-256 and Keccak-256 (shared Keccak-f permutation, differing
+            domain pad byte).
+  Version:  tiny_sha3 @ dcbb3192047c2a721f5f851db591871d428036a9
+  License:  MIT (see sha3/LICENSE).
+  Origin:   https://github.com/mjosaarinen/tiny_sha3
+  Details:  sha3/VERSION.txt
+
+ripemd160
+  Use:      RIPEMD-160 (20-byte digest).
+  Version:  trezor-firmware crypto/ripemd160.c @
+            fb471a96f226737ec1c22bbf88078f5b36a572bc
+            (Litzenberger 2008, public-domain changes by Wuille 2012)
+  License:  Public domain (see ripemd160/LICENSE).
+  Origin:   https://github.com/trezor/trezor-firmware
+  Details:  ripemd160/VERSION.txt
+
+secp256k1
+  Use:      secp256k1 ECDSA-verify and Schnorr (BIP340) verify backing the
+            verifyEcdsaSecp256k1Signature and verifySchnorrSecp256k1Signature
+            builtins. Only the verify path plus the extrakeys and schnorrsig
+            modules are compiled; recovery, ECDH, ellswift and musig are
+            dropped.
+  Version:  bitcoin-core/secp256k1 v0.6.0 @
+            0cdc758a56360bf58a851fe91085a327ec97685a
+  License:  MIT (see secp256k1/COPYING).
+  Origin:   https://github.com/bitcoin-core/secp256k1
+  Details:  secp256k1/VERSION.txt
+  Build:    No autotools and no codegen. Configured by compile defines on the
+            OBJECT target (ENABLE_MODULE_EXTRAKEYS, ENABLE_MODULE_SCHNORRSIG,
+            ECMULT_WINDOW_SIZE=8, SECP256K1_STATIC); the checked-in precomputed
+            tables are compiled as-is. The small window keeps the verify table
+            at 8 KiB instead of 1 MiB, since secp verify is a cold path.
+
+blst
+  Use:      BLS12-381 G1/G2 arithmetic, pairings, hash-to-curve and
+            serialization backing the bls12_381_* Plutus builtins.
+  Version:  supranational/blst v0.3.14 @
+            8c7db7fe8d2ce6e76dc398ebd4d475c0ec564355
+  License:  Apache-2.0 (see blst/LICENSE).
+  Origin:   https://github.com/supranational/blst
+  Details:  blst/VERSION.txt
+  Build:    Portable no-assembly build. Only src/server.c is a compilation
+            unit; it includes the implementation .c files it needs. The
+            OBJECT target sets __BLST_NO_ASM__ (reference C field arithmetic
+            in no_asm.h) and __BLST_PORTABLE__ (pure-C SHA-256, no runtime
+            asm dispatch), so there is no assembly and the target builds on
+            WASM and the armv6/armv7 cross builds. src/vect.h was reordered so
+            the no-asm 32-bit-limb path is also taken on x86_64/aarch64; no
+            copyright text was altered. The asm/ and build/ trees, the C++ and
+            language bindings, and the alternative client_min_* amalgamation
+            units are dropped.
diff --git a/vendor/external/blst/LICENSE b/vendor/external/blst/LICENSE
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/vendor/external/blst/VERSION.txt b/vendor/external/blst/VERSION.txt
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/VERSION.txt
@@ -0,0 +1,72 @@
+Upstream:  supranational/blst
+Origin:    https://github.com/supranational/blst
+Tag:       v0.3.14
+Commit:    8c7db7fe8d2ce6e76dc398ebd4d475c0ec564355
+License:   Apache-2.0 (see LICENSE in this directory)
+
+Provides BLS12-381 G1/G2 group arithmetic, pairings, hash-to-curve and
+serialization for the Plutus bls12_381_* builtins (added in a later task).
+This task only vendors and wires the library plus a smoke test; the builtin
+bodies are implemented separately.
+
+Build configuration: portable, no-assembly build
+  The library is compiled as a single translation unit, src/server.c, which
+  #includes the implementation .c files it needs:
+    keygen.c hash_to_field.c e1.c map_to_g1.c e2.c map_to_g2.c fp12_tower.c
+    pairing.c aggregate.c exp.c sqrt.c recip.c bulk_addition.c multi_scalar.c
+    consts.c vect.c exports.c rb_tree.c cpuid.c
+  (pentaroot.c is included only under BLST_FR_PENTAROOT, which is never
+  defined here.)
+
+  Two compile defines are set on the isolated CMake OBJECT target
+  (see lib/CMakeLists.txt):
+    __BLST_NO_ASM__   - select the portable reference C field arithmetic in
+                        src/no_asm.h instead of any assembly. With this define
+                        there is no assembly anywhere, so the library builds on
+                        WASM/Emscripten and the armv6/armv7 cross builds.
+    __BLST_PORTABLE__ - also disable the runtime-dispatched SHA-256 assembly
+                        kernels (blst_sha256_block_data_order_shaext /
+                        blst_sha256_block_armv8 in src/sha256.h), falling back
+                        to the pure-C blst_sha256_block_data_order. Without this
+                        define, on an x86_64 host built with -msha or on Apple
+                        Silicon (which defines __ARM_FEATURE_CRYPTO) the header
+                        would reference an assembly SHA-256 symbol that the
+                        no-asm build does not provide, and the link would fail.
+
+Local changes to the vendored source (recorded per the vendoring rules):
+  src/no_asm.h - replace variable-length scratch arrays with fixed capacity
+    for the largest supported field (384 bits), plus a carry limb or doubled
+    capacity where required. smul_2n receives up to 768 bits. The public
+    wrappers fix n to the field width; loop bounds and copy/zero lengths
+    remain based on n. Remove the VLA compiler restriction so MSVC can use
+    the same portable C implementation. No arithmetic operations changed.
+  src/vect.h - the limb-size selection block is reordered so that the
+    __BLST_NO_ASM__/__wasm64__ branch (32-bit limbs, the path no_asm.h is
+    written for) is tested before the __x86_64__/__aarch64__ branch (64-bit
+    limbs). Upstream only ships the no-assembly path for architectures other
+    than x86_64/aarch64, so on those two it would otherwise pick 64-bit limbs
+    and fail to compile no_asm.h (which defines its 64-bit double-limb llimb_t
+    only for the 32-bit-limb case). Reordering lets the portable build compile
+    on x86_64 and aarch64 too. No copyright or license text was altered.
+
+Removed from the upstream tree to keep this lean (no copyright text altered):
+  - src/asm/        - all .pl assembly generators (not used in the no-asm build).
+  - build/          - assembly.S and per-platform assembly tooling (unused).
+  - bindings/blst_t.hpp, bindings/blst.hpp, bindings/blst.swg - C++/SWIG glue.
+  - All language bindings: bindings/{go,rust,python,node.js,java,c#,emscripten}
+    and bindings/vectors.
+  - src/client_min_pk.c, src/client_min_sig.c - alternative amalgamation units
+    (server.c is the unit we compile; these are not #included by it).
+  - build.sh, build.bat, go.mod, README.md, SECURITY.md, the logo image.
+
+Vendored files:
+  LICENSE                 - upstream Apache-2.0 license, copied verbatim.
+  bindings/blst.h         - public C API.
+  bindings/blst_aux.h     - auxiliary public C API.
+  src/server.c            - the single translation unit compiled; it #includes
+                            the implementation .c files listed above.
+  src/*.c                 - the implementation units server.c #includes.
+  src/*.h                 - the internal headers they need (vect.h, no_asm.h,
+                            consts.h, point.h, fields.h, ec_ops.h, ec_mult.h,
+                            errors.h, bytes.h, sha256.h and the *-addchain.h
+                            tables).
diff --git a/vendor/external/blst/bindings/blst.h b/vendor/external/blst/bindings/blst.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/bindings/blst.h
@@ -0,0 +1,490 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __BLST_H__
+#define __BLST_H__
+
+#ifdef __SIZE_TYPE__
+typedef __SIZE_TYPE__ size_t;
+#else
+#include <stddef.h>
+#endif
+
+#if defined(__UINT8_TYPE__) && defined(__UINT32_TYPE__) \
+                            && defined(__UINT64_TYPE__)
+typedef __UINT8_TYPE__  uint8_t;
+typedef __UINT32_TYPE__ uint32_t;
+typedef __UINT64_TYPE__ uint64_t;
+#else
+#include <stdint.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#elif !defined(__STDC_VERSION__) || __STDC_VERSION__<202311
+# if defined(__BLST_CGO__)
+typedef _Bool bool; /* it's assumed that cgo calls modern enough compiler */
+# elif !defined(bool)
+#  if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901
+#   define bool _Bool
+#  else
+#   define bool int
+#  endif
+#  define __blst_h_bool__
+# endif
+#endif
+
+#ifdef SWIG
+# define DEFNULL =NULL
+#elif defined __cplusplus
+# define DEFNULL =0
+#else
+# define DEFNULL
+#endif
+
+typedef enum {
+    BLST_SUCCESS = 0,
+    BLST_BAD_ENCODING,
+    BLST_POINT_NOT_ON_CURVE,
+    BLST_POINT_NOT_IN_GROUP,
+    BLST_AGGR_TYPE_MISMATCH,
+    BLST_VERIFY_FAIL,
+    BLST_PK_IS_INFINITY,
+    BLST_BAD_SCALAR,
+} BLST_ERROR;
+
+typedef uint8_t byte;
+typedef uint64_t limb_t;
+
+typedef struct { byte b[256/8]; } blst_scalar;
+typedef struct { limb_t l[256/8/sizeof(limb_t)]; } blst_fr;
+typedef struct { limb_t l[384/8/sizeof(limb_t)]; } blst_fp;
+/* 0 is "real" part, 1 is "imaginary" */
+typedef struct { blst_fp fp[2]; } blst_fp2;
+typedef struct { blst_fp2 fp2[3]; } blst_fp6;
+typedef struct { blst_fp6 fp6[2]; } blst_fp12;
+
+void blst_scalar_from_uint32(blst_scalar *out, const uint32_t a[8]);
+void blst_uint32_from_scalar(uint32_t out[8], const blst_scalar *a);
+void blst_scalar_from_uint64(blst_scalar *out, const uint64_t a[4]);
+void blst_uint64_from_scalar(uint64_t out[4], const blst_scalar *a);
+void blst_scalar_from_bendian(blst_scalar *out, const byte a[32]);
+void blst_bendian_from_scalar(byte out[32], const blst_scalar *a);
+void blst_scalar_from_lendian(blst_scalar *out, const byte a[32]);
+void blst_lendian_from_scalar(byte out[32], const blst_scalar *a);
+bool blst_scalar_fr_check(const blst_scalar *a);
+bool blst_sk_check(const blst_scalar *a);
+bool blst_sk_add_n_check(blst_scalar *out, const blst_scalar *a,
+                                           const blst_scalar *b);
+bool blst_sk_sub_n_check(blst_scalar *out, const blst_scalar *a,
+                                           const blst_scalar *b);
+bool blst_sk_mul_n_check(blst_scalar *out, const blst_scalar *a,
+                                           const blst_scalar *b);
+void blst_sk_inverse(blst_scalar *out, const blst_scalar *a);
+bool blst_scalar_from_le_bytes(blst_scalar *out, const byte *in, size_t len);
+bool blst_scalar_from_be_bytes(blst_scalar *out, const byte *in, size_t len);
+
+#ifndef SWIG
+/*
+ * BLS12-381-specific Fr operations.
+ */
+void blst_fr_add(blst_fr *ret, const blst_fr *a, const blst_fr *b);
+void blst_fr_sub(blst_fr *ret, const blst_fr *a, const blst_fr *b);
+void blst_fr_mul_by_3(blst_fr *ret, const blst_fr *a);
+void blst_fr_lshift(blst_fr *ret, const blst_fr *a, size_t count);
+void blst_fr_rshift(blst_fr *ret, const blst_fr *a, size_t count);
+void blst_fr_mul(blst_fr *ret, const blst_fr *a, const blst_fr *b);
+void blst_fr_sqr(blst_fr *ret, const blst_fr *a);
+void blst_fr_cneg(blst_fr *ret, const blst_fr *a, bool flag);
+void blst_fr_eucl_inverse(blst_fr *ret, const blst_fr *a);
+void blst_fr_inverse(blst_fr *ret, const blst_fr *a);
+
+void blst_fr_from_uint64(blst_fr *ret, const uint64_t a[4]);
+void blst_uint64_from_fr(uint64_t ret[4], const blst_fr *a);
+void blst_fr_from_scalar(blst_fr *ret, const blst_scalar *a);
+void blst_scalar_from_fr(blst_scalar *ret, const blst_fr *a);
+
+/*
+ * BLS12-381-specific Fp operations.
+ */
+void blst_fp_add(blst_fp *ret, const blst_fp *a, const blst_fp *b);
+void blst_fp_sub(blst_fp *ret, const blst_fp *a, const blst_fp *b);
+void blst_fp_mul_by_3(blst_fp *ret, const blst_fp *a);
+void blst_fp_mul_by_8(blst_fp *ret, const blst_fp *a);
+void blst_fp_lshift(blst_fp *ret, const blst_fp *a, size_t count);
+void blst_fp_mul(blst_fp *ret, const blst_fp *a, const blst_fp *b);
+void blst_fp_sqr(blst_fp *ret, const blst_fp *a);
+void blst_fp_cneg(blst_fp *ret, const blst_fp *a, bool flag);
+void blst_fp_eucl_inverse(blst_fp *ret, const blst_fp *a);
+void blst_fp_inverse(blst_fp *ret, const blst_fp *a);
+bool blst_fp_sqrt(blst_fp *ret, const blst_fp *a);
+
+void blst_fp_from_uint32(blst_fp *ret, const uint32_t a[12]);
+void blst_uint32_from_fp(uint32_t ret[12], const blst_fp *a);
+void blst_fp_from_uint64(blst_fp *ret, const uint64_t a[6]);
+void blst_uint64_from_fp(uint64_t ret[6], const blst_fp *a);
+void blst_fp_from_bendian(blst_fp *ret, const byte a[48]);
+void blst_bendian_from_fp(byte ret[48], const blst_fp *a);
+void blst_fp_from_lendian(blst_fp *ret, const byte a[48]);
+void blst_lendian_from_fp(byte ret[48], const blst_fp *a);
+
+/*
+ * BLS12-381-specific Fp2 operations.
+ */
+void blst_fp2_add(blst_fp2 *ret, const blst_fp2 *a, const blst_fp2 *b);
+void blst_fp2_sub(blst_fp2 *ret, const blst_fp2 *a, const blst_fp2 *b);
+void blst_fp2_mul_by_3(blst_fp2 *ret, const blst_fp2 *a);
+void blst_fp2_mul_by_8(blst_fp2 *ret, const blst_fp2 *a);
+void blst_fp2_lshift(blst_fp2 *ret, const blst_fp2 *a, size_t count);
+void blst_fp2_mul(blst_fp2 *ret, const blst_fp2 *a, const blst_fp2 *b);
+void blst_fp2_sqr(blst_fp2 *ret, const blst_fp2 *a);
+void blst_fp2_cneg(blst_fp2 *ret, const blst_fp2 *a, bool flag);
+void blst_fp2_eucl_inverse(blst_fp2 *ret, const blst_fp2 *a);
+void blst_fp2_inverse(blst_fp2 *ret, const blst_fp2 *a);
+bool blst_fp2_sqrt(blst_fp2 *ret, const blst_fp2 *a);
+
+/*
+ * BLS12-381-specific Fp12 operations.
+ */
+void blst_fp12_sqr(blst_fp12 *ret, const blst_fp12 *a);
+void blst_fp12_cyclotomic_sqr(blst_fp12 *ret, const blst_fp12 *a);
+void blst_fp12_mul(blst_fp12 *ret, const blst_fp12 *a, const blst_fp12 *b);
+void blst_fp12_mul_by_xy00z0(blst_fp12 *ret, const blst_fp12 *a,
+                                             const blst_fp6 *xy00z0);
+void blst_fp12_conjugate(blst_fp12 *a);
+void blst_fp12_inverse(blst_fp12 *ret, const blst_fp12 *a);
+/* caveat lector! |n| has to be non-zero and not more than 3! */
+void blst_fp12_frobenius_map(blst_fp12 *ret, const blst_fp12 *a, size_t n);
+bool blst_fp12_is_equal(const blst_fp12 *a, const blst_fp12 *b);
+bool blst_fp12_is_one(const blst_fp12 *a);
+bool blst_fp12_in_group(const blst_fp12 *a);
+const blst_fp12 *blst_fp12_one(void);
+#endif  // SWIG
+
+/*
+ * BLS12-381-specific point operations.
+ */
+typedef struct { blst_fp x, y, z; } blst_p1;
+typedef struct { blst_fp x, y; } blst_p1_affine;
+
+void blst_p1_add(blst_p1 *out, const blst_p1 *a, const blst_p1 *b);
+void blst_p1_add_or_double(blst_p1 *out, const blst_p1 *a, const blst_p1 *b);
+void blst_p1_add_affine(blst_p1 *out, const blst_p1 *a,
+                                      const blst_p1_affine *b);
+void blst_p1_add_or_double_affine(blst_p1 *out, const blst_p1 *a,
+                                                const blst_p1_affine *b);
+void blst_p1_double(blst_p1 *out, const blst_p1 *a);
+void blst_p1_mult(blst_p1 *out, const blst_p1 *p, const byte *scalar,
+                                                  size_t nbits);
+void blst_p1_cneg(blst_p1 *p, bool cbit);
+void blst_p1_to_affine(blst_p1_affine *out, const blst_p1 *in);
+void blst_p1_from_affine(blst_p1 *out, const blst_p1_affine *in);
+bool blst_p1_on_curve(const blst_p1 *p);
+bool blst_p1_in_g1(const blst_p1 *p);
+bool blst_p1_is_equal(const blst_p1 *a, const blst_p1 *b);
+bool blst_p1_is_inf(const blst_p1 *a);
+const blst_p1 *blst_p1_generator(void);
+
+bool blst_p1_affine_on_curve(const blst_p1_affine *p);
+bool blst_p1_affine_in_g1(const blst_p1_affine *p);
+bool blst_p1_affine_is_equal(const blst_p1_affine *a, const blst_p1_affine *b);
+bool blst_p1_affine_is_inf(const blst_p1_affine *a);
+const blst_p1_affine *blst_p1_affine_generator(void);
+
+typedef struct { blst_fp2 x, y, z; } blst_p2;
+typedef struct { blst_fp2 x, y; } blst_p2_affine;
+
+void blst_p2_add(blst_p2 *out, const blst_p2 *a, const blst_p2 *b);
+void blst_p2_add_or_double(blst_p2 *out, const blst_p2 *a, const blst_p2 *b);
+void blst_p2_add_affine(blst_p2 *out, const blst_p2 *a,
+                                      const blst_p2_affine *b);
+void blst_p2_add_or_double_affine(blst_p2 *out, const blst_p2 *a,
+                                                const blst_p2_affine *b);
+void blst_p2_double(blst_p2 *out, const blst_p2 *a);
+void blst_p2_mult(blst_p2 *out, const blst_p2 *p, const byte *scalar,
+                                                  size_t nbits);
+void blst_p2_cneg(blst_p2 *p, bool cbit);
+void blst_p2_to_affine(blst_p2_affine *out, const blst_p2 *in);
+void blst_p2_from_affine(blst_p2 *out, const blst_p2_affine *in);
+bool blst_p2_on_curve(const blst_p2 *p);
+bool blst_p2_in_g2(const blst_p2 *p);
+bool blst_p2_is_equal(const blst_p2 *a, const blst_p2 *b);
+bool blst_p2_is_inf(const blst_p2 *a);
+const blst_p2 *blst_p2_generator(void);
+
+bool blst_p2_affine_on_curve(const blst_p2_affine *p);
+bool blst_p2_affine_in_g2(const blst_p2_affine *p);
+bool blst_p2_affine_is_equal(const blst_p2_affine *a, const blst_p2_affine *b);
+bool blst_p2_affine_is_inf(const blst_p2_affine *a);
+const blst_p2_affine *blst_p2_affine_generator(void);
+
+/*
+ * Multi-scalar multiplications and other multi-point operations.
+ */
+
+void blst_p1s_to_affine(blst_p1_affine dst[], const blst_p1 *const points[],
+                        size_t npoints);
+void blst_p1s_add(blst_p1 *ret, const blst_p1_affine *const points[],
+                                size_t npoints);
+
+size_t blst_p1s_mult_wbits_precompute_sizeof(size_t wbits, size_t npoints);
+void blst_p1s_mult_wbits_precompute(blst_p1_affine table[], size_t wbits,
+                                    const blst_p1_affine *const points[],
+                                    size_t npoints);
+size_t blst_p1s_mult_wbits_scratch_sizeof(size_t npoints);
+void blst_p1s_mult_wbits(blst_p1 *ret, const blst_p1_affine table[],
+                         size_t wbits, size_t npoints,
+                         const byte *const scalars[], size_t nbits,
+                         limb_t *scratch);
+
+size_t blst_p1s_mult_pippenger_scratch_sizeof(size_t npoints);
+void blst_p1s_mult_pippenger(blst_p1 *ret, const blst_p1_affine *const points[],
+                             size_t npoints, const byte *const scalars[],
+                             size_t nbits, limb_t *scratch);
+void blst_p1s_tile_pippenger(blst_p1 *ret, const blst_p1_affine *const points[],
+                             size_t npoints, const byte *const scalars[],
+                             size_t nbits, limb_t *scratch,
+                             size_t bit0, size_t window);
+
+void blst_p2s_to_affine(blst_p2_affine dst[], const blst_p2 *const points[],
+                        size_t npoints);
+void blst_p2s_add(blst_p2 *ret, const blst_p2_affine *const points[],
+                                size_t npoints);
+
+size_t blst_p2s_mult_wbits_precompute_sizeof(size_t wbits, size_t npoints);
+void blst_p2s_mult_wbits_precompute(blst_p2_affine table[], size_t wbits,
+                                    const blst_p2_affine *const points[],
+                                    size_t npoints);
+size_t blst_p2s_mult_wbits_scratch_sizeof(size_t npoints);
+void blst_p2s_mult_wbits(blst_p2 *ret, const blst_p2_affine table[],
+                         size_t wbits, size_t npoints,
+                         const byte *const scalars[], size_t nbits,
+                         limb_t *scratch);
+
+size_t blst_p2s_mult_pippenger_scratch_sizeof(size_t npoints);
+void blst_p2s_mult_pippenger(blst_p2 *ret, const blst_p2_affine *const points[],
+                             size_t npoints, const byte *const scalars[],
+                             size_t nbits, limb_t *scratch);
+void blst_p2s_tile_pippenger(blst_p2 *ret, const blst_p2_affine *const points[],
+                             size_t npoints, const byte *const scalars[],
+                             size_t nbits, limb_t *scratch,
+                             size_t bit0, size_t window);
+
+/*
+ * Hash-to-curve operations.
+ */
+#ifndef SWIG
+void blst_map_to_g1(blst_p1 *out, const blst_fp *u, const blst_fp *v DEFNULL);
+void blst_map_to_g2(blst_p2 *out, const blst_fp2 *u, const blst_fp2 *v DEFNULL);
+#endif
+
+void blst_encode_to_g1(blst_p1 *out,
+                       const byte *msg, size_t msg_len,
+                       const byte *DST DEFNULL, size_t DST_len DEFNULL,
+                       const byte *aug DEFNULL, size_t aug_len DEFNULL);
+void blst_hash_to_g1(blst_p1 *out,
+                     const byte *msg, size_t msg_len,
+                     const byte *DST DEFNULL, size_t DST_len DEFNULL,
+                     const byte *aug DEFNULL, size_t aug_len DEFNULL);
+
+void blst_encode_to_g2(blst_p2 *out,
+                       const byte *msg, size_t msg_len,
+                       const byte *DST DEFNULL, size_t DST_len DEFNULL,
+                       const byte *aug DEFNULL, size_t aug_len DEFNULL);
+void blst_hash_to_g2(blst_p2 *out,
+                     const byte *msg, size_t msg_len,
+                     const byte *DST DEFNULL, size_t DST_len DEFNULL,
+                     const byte *aug DEFNULL, size_t aug_len DEFNULL);
+
+/*
+ * Zcash-compatible serialization/deserialization.
+ */
+void blst_p1_serialize(byte out[96], const blst_p1 *in);
+void blst_p1_compress(byte out[48], const blst_p1 *in);
+void blst_p1_affine_serialize(byte out[96], const blst_p1_affine *in);
+void blst_p1_affine_compress(byte out[48], const blst_p1_affine *in);
+BLST_ERROR blst_p1_uncompress(blst_p1_affine *out, const byte in[48]);
+BLST_ERROR blst_p1_deserialize(blst_p1_affine *out, const byte in[96]);
+
+void blst_p2_serialize(byte out[192], const blst_p2 *in);
+void blst_p2_compress(byte out[96], const blst_p2 *in);
+void blst_p2_affine_serialize(byte out[192], const blst_p2_affine *in);
+void blst_p2_affine_compress(byte out[96], const blst_p2_affine *in);
+BLST_ERROR blst_p2_uncompress(blst_p2_affine *out, const byte in[96]);
+BLST_ERROR blst_p2_deserialize(blst_p2_affine *out, const byte in[192]);
+
+/*
+ * Specification defines two variants, 'minimal-signature-size' and
+ * 'minimal-pubkey-size'. To unify appearance we choose to distinguish
+ * them by suffix referring to the public key type, more specifically
+ * _pk_in_g1 corresponds to 'minimal-pubkey-size' and _pk_in_g2 - to
+ * 'minimal-signature-size'. It might appear a bit counterintuitive
+ * in sign call, but no matter how you twist it, something is bound to
+ * turn a little odd.
+ */
+/*
+ * Secret-key operations.
+ */
+void blst_keygen(blst_scalar *out_SK, const byte *IKM, size_t IKM_len,
+                 const byte *info DEFNULL, size_t info_len DEFNULL);
+void blst_sk_to_pk_in_g1(blst_p1 *out_pk, const blst_scalar *SK);
+void blst_sign_pk_in_g1(blst_p2 *out_sig, const blst_p2 *hash,
+                                          const blst_scalar *SK);
+void blst_sk_to_pk_in_g2(blst_p2 *out_pk, const blst_scalar *SK);
+void blst_sign_pk_in_g2(blst_p1 *out_sig, const blst_p1 *hash,
+                                          const blst_scalar *SK);
+
+/*
+ * Pairing interface.
+ */
+#ifndef SWIG
+void blst_miller_loop(blst_fp12 *ret, const blst_p2_affine *Q,
+                                      const blst_p1_affine *P);
+void blst_miller_loop_n(blst_fp12 *ret, const blst_p2_affine *const Qs[],
+                                        const blst_p1_affine *const Ps[],
+                                        size_t n);
+void blst_final_exp(blst_fp12 *ret, const blst_fp12 *f);
+void blst_precompute_lines(blst_fp6 Qlines[68], const blst_p2_affine *Q);
+void blst_miller_loop_lines(blst_fp12 *ret, const blst_fp6 Qlines[68],
+                                            const blst_p1_affine *P);
+bool blst_fp12_finalverify(const blst_fp12 *gt1, const blst_fp12 *gt2);
+#endif
+
+#ifdef __BLST_CGO__
+typedef limb_t blst_pairing;
+#elif defined(__BLST_RUST_BINDGEN__)
+typedef struct {} blst_pairing;
+#else
+typedef struct blst_opaque blst_pairing;
+#endif
+
+size_t blst_pairing_sizeof(void);
+void blst_pairing_init(blst_pairing *new_ctx, bool hash_or_encode,
+                       const byte *DST DEFNULL, size_t DST_len DEFNULL);
+const byte *blst_pairing_get_dst(const blst_pairing *ctx);
+void blst_pairing_commit(blst_pairing *ctx);
+BLST_ERROR blst_pairing_aggregate_pk_in_g2(blst_pairing *ctx,
+                                           const blst_p2_affine *PK,
+                                           const blst_p1_affine *signature,
+                                           const byte *msg, size_t msg_len,
+                                           const byte *aug DEFNULL,
+                                           size_t aug_len DEFNULL);
+BLST_ERROR blst_pairing_chk_n_aggr_pk_in_g2(blst_pairing *ctx,
+                                            const blst_p2_affine *PK,
+                                            bool pk_grpchk,
+                                            const blst_p1_affine *signature,
+                                            bool sig_grpchk,
+                                            const byte *msg, size_t msg_len,
+                                            const byte *aug DEFNULL,
+                                            size_t aug_len DEFNULL);
+BLST_ERROR blst_pairing_mul_n_aggregate_pk_in_g2(blst_pairing *ctx,
+                                                 const blst_p2_affine *PK,
+                                                 const blst_p1_affine *sig,
+                                                 const byte *scalar,
+                                                 size_t nbits,
+                                                 const byte *msg,
+                                                 size_t msg_len,
+                                                 const byte *aug DEFNULL,
+                                                 size_t aug_len DEFNULL);
+BLST_ERROR blst_pairing_chk_n_mul_n_aggr_pk_in_g2(blst_pairing *ctx,
+                                                  const blst_p2_affine *PK,
+                                                  bool pk_grpchk,
+                                                  const blst_p1_affine *sig,
+                                                  bool sig_grpchk,
+                                                  const byte *scalar,
+                                                  size_t nbits,
+                                                  const byte *msg,
+                                                  size_t msg_len,
+                                                  const byte *aug DEFNULL,
+                                                  size_t aug_len DEFNULL);
+BLST_ERROR blst_pairing_aggregate_pk_in_g1(blst_pairing *ctx,
+                                           const blst_p1_affine *PK,
+                                           const blst_p2_affine *signature,
+                                           const byte *msg, size_t msg_len,
+                                           const byte *aug DEFNULL,
+                                           size_t aug_len DEFNULL);
+BLST_ERROR blst_pairing_chk_n_aggr_pk_in_g1(blst_pairing *ctx,
+                                            const blst_p1_affine *PK,
+                                            bool pk_grpchk,
+                                            const blst_p2_affine *signature,
+                                            bool sig_grpchk,
+                                            const byte *msg, size_t msg_len,
+                                            const byte *aug DEFNULL,
+                                            size_t aug_len DEFNULL);
+BLST_ERROR blst_pairing_mul_n_aggregate_pk_in_g1(blst_pairing *ctx,
+                                                 const blst_p1_affine *PK,
+                                                 const blst_p2_affine *sig,
+                                                 const byte *scalar,
+                                                 size_t nbits,
+                                                 const byte *msg,
+                                                 size_t msg_len,
+                                                 const byte *aug DEFNULL,
+                                                 size_t aug_len DEFNULL);
+BLST_ERROR blst_pairing_chk_n_mul_n_aggr_pk_in_g1(blst_pairing *ctx,
+                                                  const blst_p1_affine *PK,
+                                                  bool pk_grpchk,
+                                                  const blst_p2_affine *sig,
+                                                  bool sig_grpchk,
+                                                  const byte *scalar,
+                                                  size_t nbits,
+                                                  const byte *msg,
+                                                  size_t msg_len,
+                                                  const byte *aug DEFNULL,
+                                                  size_t aug_len DEFNULL);
+BLST_ERROR blst_pairing_merge(blst_pairing *ctx, const blst_pairing *ctx1);
+bool blst_pairing_finalverify(const blst_pairing *ctx,
+                              const blst_fp12 *gtsig DEFNULL);
+
+
+/*
+ * Customarily applications aggregate signatures separately.
+ * In which case application would have to pass NULLs for |signature|
+ * to blst_pairing_aggregate calls and pass aggregated signature
+ * collected with these calls to blst_pairing_finalverify. Inputs are
+ * Zcash-compatible "straight-from-wire" byte vectors, compressed or
+ * not.
+ */
+BLST_ERROR blst_aggregate_in_g1(blst_p1 *out, const blst_p1 *in,
+                                              const byte *zwire);
+BLST_ERROR blst_aggregate_in_g2(blst_p2 *out, const blst_p2 *in,
+                                              const byte *zwire);
+
+void blst_aggregated_in_g1(blst_fp12 *out, const blst_p1_affine *signature);
+void blst_aggregated_in_g2(blst_fp12 *out, const blst_p2_affine *signature);
+
+/*
+ * "One-shot" CoreVerify entry points.
+ */
+BLST_ERROR blst_core_verify_pk_in_g1(const blst_p1_affine *pk,
+                                     const blst_p2_affine *signature,
+                                     bool hash_or_encode,
+                                     const byte *msg, size_t msg_len,
+                                     const byte *DST DEFNULL,
+                                     size_t DST_len DEFNULL,
+                                     const byte *aug DEFNULL,
+                                     size_t aug_len DEFNULL);
+BLST_ERROR blst_core_verify_pk_in_g2(const blst_p2_affine *pk,
+                                     const blst_p1_affine *signature,
+                                     bool hash_or_encode,
+                                     const byte *msg, size_t msg_len,
+                                     const byte *DST DEFNULL,
+                                     size_t DST_len DEFNULL,
+                                     const byte *aug DEFNULL,
+                                     size_t aug_len DEFNULL);
+
+extern const blst_p1_affine BLS12_381_G1;
+extern const blst_p1_affine BLS12_381_NEG_G1;
+extern const blst_p2_affine BLS12_381_G2;
+extern const blst_p2_affine BLS12_381_NEG_G2;
+
+#include "blst_aux.h"
+
+#ifdef __cplusplus
+}
+#elif defined(__blst_h_bool__)
+# undef __blst_h_bool__
+# undef bool
+#endif
+#endif
diff --git a/vendor/external/blst/bindings/blst_aux.h b/vendor/external/blst/bindings/blst_aux.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/bindings/blst_aux.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __BLST_AUX_H__
+#define __BLST_AUX_H__
+/*
+ * This file lists interfaces that might be promoted to blst.h or removed,
+ * depending on their proven/unproven worthiness.
+ */
+
+void blst_fr_ct_bfly(blst_fr *x0, blst_fr *x1, const blst_fr *twiddle);
+void blst_fr_gs_bfly(blst_fr *x0, blst_fr *x1, const blst_fr *twiddle);
+void blst_fr_to(blst_fr *ret, const blst_fr *a);
+void blst_fr_from(blst_fr *ret, const blst_fr *a);
+#ifdef BLST_FR_PENTAROOT
+void blst_fr_pentaroot(blst_fr *ret, const blst_fr *a);
+void blst_fr_pentapow(blst_fr *ret, const blst_fr *a);
+#endif
+
+void blst_fp_to(blst_fp *ret, const blst_fp *a);
+void blst_fp_from(blst_fp *ret, const blst_fp *a);
+
+bool blst_fp_is_square(const blst_fp *a);
+bool blst_fp2_is_square(const blst_fp2 *a);
+
+void blst_p1_from_jacobian(blst_p1 *out, const blst_p1 *in);
+void blst_p2_from_jacobian(blst_p2 *out, const blst_p2 *in);
+
+/*
+ * Below functions produce both point and deserialized outcome of
+ * SkToPk and Sign. However, deserialized outputs are pre-decorated
+ * with sign and infinity bits. This means that you have to bring the
+ * output into compliance prior returning to application. If you want
+ * compressed point value, then do [equivalent of]
+ *
+ *  byte temp[96];
+ *  blst_sk_to_pk2_in_g1(temp, out_pk, SK);
+ *  temp[0] |= 0x80;
+ *  memcpy(out, temp, 48);
+ *
+ * Otherwise do
+ *
+ *  blst_sk_to_pk2_in_g1(out, out_pk, SK);
+ *  out[0] &= ~0x20;
+ *
+ * Either |out| or |out_<point>| can be NULL.
+ */
+void blst_sk_to_pk2_in_g1(byte out[96], blst_p1_affine *out_pk,
+                          const blst_scalar *SK);
+void blst_sign_pk2_in_g1(byte out[192], blst_p2_affine *out_sig,
+                         const blst_p2 *hash, const blst_scalar *SK);
+void blst_sk_to_pk2_in_g2(byte out[192], blst_p2_affine *out_pk,
+                          const blst_scalar *SK);
+void blst_sign_pk2_in_g2(byte out[96], blst_p1_affine *out_sig,
+                         const blst_p1 *hash, const blst_scalar *SK);
+
+#ifdef __BLST_RUST_BINDGEN__
+typedef struct {} blst_uniq;
+#else
+typedef struct blst_opaque blst_uniq;
+#endif
+
+size_t blst_uniq_sizeof(size_t n_nodes);
+void blst_uniq_init(blst_uniq *tree);
+bool blst_uniq_test(blst_uniq *tree, const byte *msg, size_t len);
+
+#ifdef expand_message_xmd
+void expand_message_xmd(unsigned char *bytes, size_t len_in_bytes,
+                        const unsigned char *aug, size_t aug_len,
+                        const unsigned char *msg, size_t msg_len,
+                        const unsigned char *DST, size_t DST_len);
+#else
+void blst_expand_message_xmd(byte *out, size_t out_len,
+                             const byte *msg, size_t msg_len,
+                             const byte *DST, size_t DST_len);
+#endif
+
+void blst_p1_unchecked_mult(blst_p1 *out, const blst_p1 *p, const byte *scalar,
+                                                            size_t nbits);
+void blst_p2_unchecked_mult(blst_p2 *out, const blst_p2 *p, const byte *scalar,
+                                                            size_t nbits);
+
+void blst_pairing_raw_aggregate(blst_pairing *ctx, const blst_p2_affine *q,
+                                                   const blst_p1_affine *p);
+blst_fp12 *blst_pairing_as_fp12(blst_pairing *ctx);
+void blst_bendian_from_fp12(byte out[48*12], const blst_fp12 *a);
+
+void blst_keygen_v3(blst_scalar *out_SK, const byte *IKM, size_t IKM_len,
+                    const byte *info DEFNULL, size_t info_len DEFNULL);
+void blst_keygen_v4_5(blst_scalar *out_SK, const byte *IKM, size_t IKM_len,
+                      const byte *salt, size_t salt_len,
+                      const byte *info DEFNULL, size_t info_len DEFNULL);
+void blst_keygen_v5(blst_scalar *out_SK, const byte *IKM, size_t IKM_len,
+                    const byte *salt, size_t salt_len,
+                    const byte *info DEFNULL, size_t info_len DEFNULL);
+void blst_derive_master_eip2333(blst_scalar *out_SK,
+                                const byte *IKM, size_t IKM_len);
+void blst_derive_child_eip2333(blst_scalar *out_SK, const blst_scalar *SK,
+                               uint32_t child_index);
+
+void blst_scalar_from_hexascii(blst_scalar *out, const byte *hex);
+void blst_fr_from_hexascii(blst_fr *ret, const byte *hex);
+void blst_fp_from_hexascii(blst_fp *ret, const byte *hex);
+
+size_t blst_p1_sizeof(void);
+size_t blst_p1_affine_sizeof(void);
+size_t blst_p2_sizeof(void);
+size_t blst_p2_affine_sizeof(void);
+size_t blst_fp12_sizeof(void);
+
+/*
+ * Single-shot SHA-256 hash function.
+ */
+void blst_sha256(byte out[32], const byte *msg, size_t msg_len);
+#endif
diff --git a/vendor/external/blst/src/aggregate.c b/vendor/external/blst/src/aggregate.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/aggregate.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/*
+ * Usage pattern on single-processor system is
+ *
+ * blst_pairing_init(ctx, hash_or_encode, DST);
+ * blst_pairing_aggregate_pk_in_g1(ctx, PK[0], aggregated_signature, msg[0]);
+ * blst_pairing_aggregate_pk_in_g1(ctx, PK[1], NULL, msg[1]);
+ * ...
+ * blst_pairing_commit(ctx);
+ * blst_pairing_finalverify(ctx, NULL);
+ *
+ ***********************************************************************
+ * Usage pattern on multi-processor system is
+ *
+ *   blst_pairing_init(pk[0], hash_or_encode, DST);
+ *   blst_pairing_init(pk[1], hash_or_encode, DST);
+ *   ...
+ * start threads each processing an N/nthreads slice of PKs and messages:
+ *     blst_pairing_aggregate_pk_in_g1(pk[i], PK[i*n+0], NULL, msg[i*n+0]);
+ *     blst_pairing_aggregate_pk_in_g1(pk[i], PK[i*n+1], NULL, msg[i*n+1]);
+ *     ...
+ *     blst_pairing_commit(pkx);
+ *   ...
+ * meanwhile in main thread
+ *   blst_fp12 gtsig;
+ *   blst_aggregated_in_g2(&gtsig, aggregated_signature);
+ * join threads and merge their contexts:
+ *   blst_pairing_merge(pk[0], pk[1]);
+ *   blst_pairing_merge(pk[0], pk[2]);
+ *   ...
+ *   blst_pairing_finalverify(pk[0], gtsig);
+ */
+
+#ifndef N_MAX
+# define N_MAX 8
+#endif
+
+typedef union { POINTonE1 e1; POINTonE2 e2; } AggregatedSignature;
+typedef struct {
+    unsigned int ctrl;
+    unsigned int nelems;
+    const void *DST;
+    size_t DST_len;
+    vec384fp12 GT;
+    AggregatedSignature AggrSign;
+    POINTonE2_affine Q[N_MAX];
+    POINTonE1_affine P[N_MAX];
+} PAIRING;
+
+enum { AGGR_UNDEFINED      = 0,
+       AGGR_MIN_SIG        = 1,
+       AGGR_MIN_PK         = 2,
+       AGGR_SIGN_SET       = 0x10,
+       AGGR_GT_SET         = 0x20,
+       AGGR_HASH_OR_ENCODE = 0x40 };
+#define MIN_SIG_OR_PK (AGGR_MIN_SIG | AGGR_MIN_PK)
+
+static const size_t sizeof_pairing = (sizeof(PAIRING) + 7) & ~(size_t)7;
+
+size_t blst_pairing_sizeof(void)
+{   return sizeof_pairing;   }
+
+void blst_pairing_init(PAIRING *ctx, int hash_or_encode,
+                       const void *DST, size_t DST_len)
+{
+    ctx->ctrl = AGGR_UNDEFINED | (hash_or_encode ? AGGR_HASH_OR_ENCODE : 0);
+    ctx->nelems = 0;
+    ctx->DST = (uptr_t)DST==(uptr_t)((byte *)ctx+sizeof_pairing) ? (void *)42
+                                                                 : DST;
+    ctx->DST_len = DST_len;
+}
+
+static const void *pairing_get_dst(const PAIRING *ctx)
+{   return (uptr_t)ctx->DST==(uptr_t)42 ? (const byte *)ctx+sizeof_pairing
+                                        : ctx->DST;
+}
+
+const void *blst_pairing_get_dst(const PAIRING *ctx)
+{   return pairing_get_dst(ctx);   }
+
+#define FROM_AFFINE(out,in) do { \
+    vec_copy((out)->X, in->X, 2*sizeof(in->X)), \
+    vec_select((out)->Z, in->X, BLS12_381_Rx.p, sizeof(in->X), \
+                         vec_is_zero(in->X, 2*sizeof(in->X))); } while(0)
+
+/*
+ * Optional |nbits|-wide |scalar| is used to facilitate multiple aggregated
+ * signature verification as discussed at
+ * https://ethresear.ch/t/fast-verification-of-multiple-bls-signatures/5407.
+ * Usage pattern is not finalized yet, because (sig != NULL) is better and
+ * will be handled separately...
+ */
+static BLST_ERROR PAIRING_Aggregate_PK_in_G2(PAIRING *ctx,
+                                             const POINTonE2_affine *PK,
+                                             size_t pk_groupcheck,
+                                             const POINTonE1_affine *sig,
+                                             size_t sig_groupcheck,
+                                             const byte *scalar, size_t nbits,
+                                             const void *msg, size_t msg_len,
+                                             const void *aug, size_t aug_len)
+{
+    if (ctx->ctrl & AGGR_MIN_PK)
+        return BLST_AGGR_TYPE_MISMATCH;
+
+    ctx->ctrl |= AGGR_MIN_SIG;
+
+    /*
+     * Since we don't know if the signature is individual or aggregated,
+     * the only sensible thing to do is to skip over infinite one and
+     * count on the corresponding infinite public key to be rejected,
+     * in case the signature is non-aggregated that is.
+     */
+    if (sig != NULL && !vec_is_zero(sig, sizeof(*sig))) {
+        POINTonE1 *S = &ctx->AggrSign.e1;
+        POINTonE1 P[1];
+
+        FROM_AFFINE(P, sig);
+
+        if (sig_groupcheck && !POINTonE1_in_G1(P))
+            return BLST_POINT_NOT_IN_GROUP;
+
+        if (ctx->ctrl & AGGR_SIGN_SET) {
+            if (nbits != 0 && scalar != NULL) {
+                POINTonE1_mult_w5(P, P, scalar, nbits);
+                POINTonE1_dadd(S, S, P, NULL);
+            } else {
+                POINTonE1_dadd_affine(S, S, sig);
+            }
+        } else {
+            ctx->ctrl |= AGGR_SIGN_SET;
+            if (nbits != 0 && scalar != NULL)
+                POINTonE1_mult_w5(S, P, scalar, nbits);
+            else
+                vec_copy(S, P, sizeof(P));
+        }
+    }
+
+    if (PK != NULL) {
+        unsigned int n;
+        POINTonE1 H[1];
+        const void *DST = pairing_get_dst(ctx);
+
+        /*
+         * Reject infinite public keys.
+         */
+        if (vec_is_zero(PK, sizeof(*PK)))
+            return BLST_PK_IS_INFINITY;
+
+        if (pk_groupcheck) {
+            POINTonE2 P[1];
+
+            FROM_AFFINE(P, PK);
+            if (!POINTonE2_in_G2(P))
+                return BLST_POINT_NOT_IN_GROUP;
+        }
+
+        if (ctx->ctrl & AGGR_HASH_OR_ENCODE)
+            Hash_to_G1(H, msg, msg_len, DST, ctx->DST_len, aug, aug_len);
+        else
+            Encode_to_G1(H, msg, msg_len, DST, ctx->DST_len, aug, aug_len);
+
+        if (nbits != 0 && scalar != NULL)
+            POINTonE1_mult_w5(H, H, scalar, nbits);
+
+        POINTonE1_from_Jacobian(H, H);
+
+        n = ctx->nelems;
+        vec_copy(ctx->Q + n, PK, sizeof(POINTonE2_affine));
+        vec_copy(ctx->P + n, H, sizeof(POINTonE1_affine));
+        if (++n == N_MAX) {
+            if (ctx->ctrl & AGGR_GT_SET) {
+                vec384fp12 GT;
+                miller_loop_n(GT, ctx->Q, ctx->P, n);
+                mul_fp12(ctx->GT, ctx->GT, GT);
+            } else {
+                miller_loop_n(ctx->GT, ctx->Q, ctx->P, n);
+                ctx->ctrl |= AGGR_GT_SET;
+            }
+            n = 0;
+        }
+        ctx->nelems = n;
+    }
+
+    return BLST_SUCCESS;
+}
+
+BLST_ERROR blst_pairing_aggregate_pk_in_g2(PAIRING *ctx,
+                                           const POINTonE2_affine *PK,
+                                           const POINTonE1_affine *signature,
+                                           const void *msg, size_t msg_len,
+                                           const void *aug, size_t aug_len)
+{   return PAIRING_Aggregate_PK_in_G2(ctx, PK, 0, signature, 1, NULL, 0,
+                                      msg, msg_len, aug, aug_len);
+}
+
+BLST_ERROR blst_pairing_mul_n_aggregate_pk_in_g2(PAIRING *ctx,
+                                                 const POINTonE2_affine *PK,
+                                                 const POINTonE1_affine *sig,
+                                                 const byte *scalar,
+                                                 size_t nbits,
+                                                 const void *msg,
+                                                 size_t msg_len,
+                                                 const void *aug,
+                                                 size_t aug_len)
+{   return PAIRING_Aggregate_PK_in_G2(ctx, PK, 0, sig, 1, scalar, nbits,
+                                      msg, msg_len, aug, aug_len);
+}
+
+BLST_ERROR blst_pairing_chk_n_aggr_pk_in_g2(PAIRING *ctx,
+                                            const POINTonE2_affine *PK,
+                                            size_t pk_grpchk,
+                                            const POINTonE1_affine *signature,
+                                            size_t sig_grpchk,
+                                            const void *msg, size_t msg_len,
+                                            const void *aug, size_t aug_len)
+{   return PAIRING_Aggregate_PK_in_G2(ctx, PK, pk_grpchk, signature, sig_grpchk,
+                                      NULL, 0, msg, msg_len, aug, aug_len);
+}
+
+BLST_ERROR blst_pairing_chk_n_mul_n_aggr_pk_in_g2(PAIRING *ctx,
+                                                  const POINTonE2_affine *PK,
+                                                  size_t pk_grpchk,
+                                                  const POINTonE1_affine *sig,
+                                                  size_t sig_grpchk,
+                                                  const byte *scalar,
+                                                  size_t nbits,
+                                                  const void *msg,
+                                                  size_t msg_len,
+                                                  const void *aug,
+                                                  size_t aug_len)
+{   return PAIRING_Aggregate_PK_in_G2(ctx, PK, pk_grpchk, sig, sig_grpchk,
+                                      scalar, nbits,
+                                      msg, msg_len, aug, aug_len);
+}
+
+static BLST_ERROR PAIRING_Aggregate_PK_in_G1(PAIRING *ctx,
+                                             const POINTonE1_affine *PK,
+                                             size_t pk_groupcheck,
+                                             const POINTonE2_affine *sig,
+                                             size_t sig_groupcheck,
+                                             const byte *scalar, size_t nbits,
+                                             const void *msg, size_t msg_len,
+                                             const void *aug, size_t aug_len)
+{
+    if (ctx->ctrl & AGGR_MIN_SIG)
+        return BLST_AGGR_TYPE_MISMATCH;
+
+    ctx->ctrl |= AGGR_MIN_PK;
+
+    /*
+     * Since we don't know if the signature is individual or aggregated,
+     * the only sensible thing to do is to skip over infinite one and
+     * count on the corresponding infinite public key to be rejected,
+     * in case the signature is non-aggregated that is.
+     */
+    if (sig != NULL && !vec_is_zero(sig, sizeof(*sig))) {
+        POINTonE2 *S = &ctx->AggrSign.e2;
+        POINTonE2 P[1];
+
+        FROM_AFFINE(P, sig);
+
+        if (sig_groupcheck && !POINTonE2_in_G2(P))
+            return BLST_POINT_NOT_IN_GROUP;
+
+        if (ctx->ctrl & AGGR_SIGN_SET) {
+            if (nbits != 0 && scalar != NULL) {
+
+                POINTonE2_mult_w5(P, P, scalar, nbits);
+                POINTonE2_dadd(S, S, P, NULL);
+            } else {
+                POINTonE2_dadd_affine(S, S, sig);
+            }
+        } else {
+            ctx->ctrl |= AGGR_SIGN_SET;
+            if (nbits != 0 && scalar != NULL)
+                POINTonE2_mult_w5(S, P, scalar, nbits);
+            else
+                vec_copy(S, P, sizeof(P));
+        }
+    }
+
+    if (PK != NULL) {
+        unsigned int n;
+        POINTonE2 H[1];
+        POINTonE1 pk[1];
+        const void *DST = pairing_get_dst(ctx);
+
+        /*
+         * Reject infinite public keys.
+         */
+        if (vec_is_zero(PK, sizeof(*PK)))
+            return BLST_PK_IS_INFINITY;
+
+        if (pk_groupcheck) {
+            POINTonE1 P[1];
+
+            FROM_AFFINE(P, PK);
+            if (!POINTonE1_in_G1(P))
+                return BLST_POINT_NOT_IN_GROUP;
+        }
+
+        if (ctx->ctrl & AGGR_HASH_OR_ENCODE)
+            Hash_to_G2(H, msg, msg_len, DST, ctx->DST_len, aug, aug_len);
+        else
+            Encode_to_G2(H, msg, msg_len, DST, ctx->DST_len, aug, aug_len);
+
+        POINTonE2_from_Jacobian(H, H);
+
+        if (nbits != 0 && scalar != NULL) {
+            FROM_AFFINE(pk, PK);
+            POINTonE1_mult_w5(pk, pk, scalar, nbits);
+            POINTonE1_from_Jacobian(pk, pk);
+            PK = (const POINTonE1_affine *)pk;
+        }
+
+        n = ctx->nelems;
+        vec_copy(ctx->Q + n, H, sizeof(POINTonE2_affine));
+        vec_copy(ctx->P + n, PK, sizeof(POINTonE1_affine));
+        if (++n == N_MAX) {
+            if (ctx->ctrl & AGGR_GT_SET) {
+                vec384fp12 GT;
+                miller_loop_n(GT, ctx->Q, ctx->P, n);
+                mul_fp12(ctx->GT, ctx->GT, GT);
+            } else {
+                miller_loop_n(ctx->GT, ctx->Q, ctx->P, n);
+                ctx->ctrl |= AGGR_GT_SET;
+            }
+            n = 0;
+        }
+        ctx->nelems = n;
+    }
+
+    return BLST_SUCCESS;
+}
+
+BLST_ERROR blst_pairing_aggregate_pk_in_g1(PAIRING *ctx,
+                                           const POINTonE1_affine *PK,
+                                           const POINTonE2_affine *signature,
+                                           const void *msg, size_t msg_len,
+                                           const void *aug, size_t aug_len)
+{   return PAIRING_Aggregate_PK_in_G1(ctx, PK, 0, signature, 1, NULL, 0,
+                                      msg, msg_len, aug, aug_len);
+}
+
+BLST_ERROR blst_pairing_mul_n_aggregate_pk_in_g1(PAIRING *ctx,
+                                                 const POINTonE1_affine *PK,
+                                                 const POINTonE2_affine *sig,
+                                                 const byte *scalar,
+                                                 size_t nbits,
+                                                 const void *msg,
+                                                 size_t msg_len,
+                                                 const void *aug,
+                                                 size_t aug_len)
+{   return PAIRING_Aggregate_PK_in_G1(ctx, PK, 0, sig, 1, scalar, nbits,
+                                      msg, msg_len, aug, aug_len);
+}
+
+BLST_ERROR blst_pairing_chk_n_aggr_pk_in_g1(PAIRING *ctx,
+                                            const POINTonE1_affine *PK,
+                                            size_t pk_grpchk,
+                                            const POINTonE2_affine *signature,
+                                            size_t sig_grpchk,
+                                            const void *msg, size_t msg_len,
+                                            const void *aug, size_t aug_len)
+{   return PAIRING_Aggregate_PK_in_G1(ctx, PK, pk_grpchk, signature, sig_grpchk,
+                                      NULL, 0, msg, msg_len, aug, aug_len);
+}
+
+BLST_ERROR blst_pairing_chk_n_mul_n_aggr_pk_in_g1(PAIRING *ctx,
+                                                  const POINTonE1_affine *PK,
+                                                  size_t pk_grpchk,
+                                                  const POINTonE2_affine *sig,
+                                                  size_t sig_grpchk,
+                                                  const byte *scalar,
+                                                  size_t nbits,
+                                                  const void *msg,
+                                                  size_t msg_len,
+                                                  const void *aug,
+                                                  size_t aug_len)
+{   return PAIRING_Aggregate_PK_in_G1(ctx, PK, pk_grpchk, sig, sig_grpchk,
+                                      scalar, nbits,
+                                      msg, msg_len, aug, aug_len);
+}
+
+static void PAIRING_Commit(PAIRING *ctx)
+{
+    unsigned int n;
+
+    if ((n = ctx->nelems) != 0) {
+        if (ctx->ctrl & AGGR_GT_SET) {
+            vec384fp12 GT;
+            miller_loop_n(GT, ctx->Q, ctx->P, n);
+            mul_fp12(ctx->GT, ctx->GT, GT);
+        } else {
+            miller_loop_n(ctx->GT, ctx->Q, ctx->P, n);
+            ctx->ctrl |= AGGR_GT_SET;
+        }
+        ctx->nelems = 0;
+    }
+}
+
+void blst_pairing_commit(PAIRING *ctx)
+{   PAIRING_Commit(ctx);   }
+
+BLST_ERROR blst_pairing_merge(PAIRING *ctx, const PAIRING *ctx1)
+{
+    if ((ctx->ctrl & MIN_SIG_OR_PK) != AGGR_UNDEFINED
+        && (ctx1->ctrl & MIN_SIG_OR_PK) != AGGR_UNDEFINED
+        && (ctx->ctrl & ctx1->ctrl & MIN_SIG_OR_PK) == 0)
+        return BLST_AGGR_TYPE_MISMATCH;
+
+    /* context producers are expected to have called blst_pairing_commit */
+    if (ctx->nelems || ctx1->nelems)
+        return BLST_AGGR_TYPE_MISMATCH;
+
+    ctx->ctrl |= ctx1->ctrl & MIN_SIG_OR_PK;
+
+    switch (ctx->ctrl & MIN_SIG_OR_PK) {
+        case AGGR_MIN_SIG:
+            if (ctx->ctrl & ctx1->ctrl & AGGR_SIGN_SET) {
+                POINTonE1_dadd(&ctx->AggrSign.e1, &ctx->AggrSign.e1,
+                                                  &ctx1->AggrSign.e1, NULL);
+            } else if (ctx1->ctrl & AGGR_SIGN_SET) {
+                ctx->ctrl |= AGGR_SIGN_SET;
+                vec_copy(&ctx->AggrSign.e1, &ctx1->AggrSign.e1,
+                         sizeof(ctx->AggrSign.e1));
+            }
+            break;
+        case AGGR_MIN_PK:
+            if (ctx->ctrl & ctx1->ctrl & AGGR_SIGN_SET) {
+                POINTonE2_dadd(&ctx->AggrSign.e2, &ctx->AggrSign.e2,
+                                                  &ctx1->AggrSign.e2, NULL);
+            } else if (ctx1->ctrl & AGGR_SIGN_SET) {
+                ctx->ctrl |= AGGR_SIGN_SET;
+                vec_copy(&ctx->AggrSign.e2, &ctx1->AggrSign.e2,
+                         sizeof(ctx->AggrSign.e2));
+            }
+            break;
+        case AGGR_UNDEFINED:
+            break;
+        default:
+            return BLST_AGGR_TYPE_MISMATCH;
+    }
+
+    if (ctx->ctrl & ctx1->ctrl & AGGR_GT_SET) {
+        mul_fp12(ctx->GT, ctx->GT, ctx1->GT);
+    } else if (ctx1->ctrl & AGGR_GT_SET) {
+        ctx->ctrl |= AGGR_GT_SET;
+        vec_copy(ctx->GT, ctx1->GT, sizeof(ctx->GT));
+    }
+
+    return BLST_SUCCESS;
+}
+
+static bool_t PAIRING_FinalVerify(const PAIRING *ctx, const vec384fp12 GTsig)
+{
+    vec384fp12 GT;
+
+    if (!(ctx->ctrl & AGGR_GT_SET))
+        return 0;
+
+    if (GTsig != NULL) {
+        vec_copy(GT, GTsig, sizeof(GT));
+    } else if (ctx->ctrl & AGGR_SIGN_SET) {
+        AggregatedSignature AggrSign;
+
+        switch (ctx->ctrl & MIN_SIG_OR_PK) {
+            case AGGR_MIN_SIG:
+                POINTonE1_from_Jacobian(&AggrSign.e1, &ctx->AggrSign.e1);
+                miller_loop_n(GT, (const POINTonE2_affine *)&BLS12_381_G2,
+                                  (const POINTonE1_affine *)&AggrSign.e1, 1);
+                break;
+            case AGGR_MIN_PK:
+                POINTonE2_from_Jacobian(&AggrSign.e2, &ctx->AggrSign.e2);
+                miller_loop_n(GT, (const POINTonE2_affine *)&AggrSign.e2,
+                                  (const POINTonE1_affine *)&BLS12_381_G1, 1);
+                break;
+            default:
+                return 0;
+        }
+    } else {
+        /*
+         * The aggregated signature was infinite, relation between the
+         * hashes and the public keys has to be VERY special...
+         */
+        vec_copy(GT, BLS12_381_Rx.p12, sizeof(GT));
+    }
+
+    conjugate_fp12(GT);
+    mul_fp12(GT, GT, ctx->GT);
+    final_exp(GT, GT);
+
+    /* return GT==1 */
+    return vec_is_equal(GT[0][0], BLS12_381_Rx.p2, sizeof(GT[0][0])) &
+           vec_is_zero(GT[0][1], sizeof(GT) - sizeof(GT[0][0]));
+}
+
+int blst_pairing_finalverify(const PAIRING *ctx, const vec384fp12 GTsig)
+{   return (int)PAIRING_FinalVerify(ctx, GTsig);   }
+
+int blst_fp12_finalverify(const vec384fp12 GT1, const vec384fp12 GT2)
+{
+    vec384fp12 GT;
+
+    vec_copy(GT, GT1, sizeof(GT));
+    conjugate_fp12(GT);
+    mul_fp12(GT, GT, GT2);
+    final_exp(GT, GT);
+
+    /* return GT==1 */
+    return (int)(vec_is_equal(GT[0][0], BLS12_381_Rx.p2, sizeof(GT[0][0])) &
+                 vec_is_zero(GT[0][1], sizeof(GT) - sizeof(GT[0][0])));
+}
+
+void blst_pairing_raw_aggregate(PAIRING *ctx, const POINTonE2_affine *q,
+                                              const POINTonE1_affine *p)
+{
+    unsigned int n;
+
+    if (vec_is_zero(q, sizeof(*q)) & vec_is_zero(p, sizeof(*p)))
+        return;
+
+    n = ctx->nelems;
+    vec_copy(ctx->Q + n, q, sizeof(*q));
+    vec_copy(ctx->P + n, p, sizeof(*p));
+    if (++n == N_MAX) {
+        if (ctx->ctrl & AGGR_GT_SET) {
+            vec384fp12 GT;
+            miller_loop_n(GT, ctx->Q, ctx->P, n);
+            mul_fp12(ctx->GT, ctx->GT, GT);
+        } else {
+            miller_loop_n(ctx->GT, ctx->Q, ctx->P, n);
+            ctx->ctrl |= AGGR_GT_SET;
+        }
+        n = 0;
+    }
+    ctx->nelems = n;
+}
+
+vec384fp12 *blst_pairing_as_fp12(PAIRING *ctx)
+{
+    PAIRING_Commit(ctx);
+    return (vec384fp12 *)ctx->GT;
+}
+
+/*
+ * PAIRING context-free entry points.
+ *
+ * To perform FastAggregateVerify, aggregate all public keys and
+ * signatures with corresponding blst_aggregate_in_g{12}, convert
+ * result to affine and call suitable blst_core_verify_pk_in_g{12}
+ * or blst_aggregated_in_g{12}...
+ */
+BLST_ERROR blst_aggregate_in_g1(POINTonE1 *out, const POINTonE1 *in,
+                                                const unsigned char *zwire)
+{
+    POINTonE1 P[1];
+    BLST_ERROR ret;
+
+    ret = POINTonE1_Deserialize_Z((POINTonE1_affine *)P, zwire);
+
+    if (ret != BLST_SUCCESS)
+        return ret;
+
+    if (vec_is_zero(P, sizeof(POINTonE1_affine))) {
+        if (in == NULL)
+            vec_zero(out, sizeof(*out));
+        return BLST_SUCCESS;
+    }
+
+    vec_copy(P->Z, BLS12_381_Rx.p, sizeof(P->Z));
+
+    if (!POINTonE1_in_G1(P))
+        return BLST_POINT_NOT_IN_GROUP;
+
+    if (in == NULL)
+        vec_copy(out, P, sizeof(P));
+    else
+        POINTonE1_dadd_affine(out, in, (POINTonE1_affine *)P);
+
+    return BLST_SUCCESS;
+}
+
+BLST_ERROR blst_aggregate_in_g2(POINTonE2 *out, const POINTonE2 *in,
+                                                const unsigned char *zwire)
+{
+    POINTonE2 P[1];
+    BLST_ERROR ret;
+
+    ret = POINTonE2_Deserialize_Z((POINTonE2_affine *)P, zwire);
+
+    if (ret != BLST_SUCCESS)
+        return ret;
+
+    if (vec_is_zero(P, sizeof(POINTonE2_affine))) {
+        if (in == NULL)
+            vec_zero(out, sizeof(*out));
+        return BLST_SUCCESS;
+    }
+
+    vec_copy(P->Z, BLS12_381_Rx.p, sizeof(P->Z));
+
+    if (!POINTonE2_in_G2(P))
+        return BLST_POINT_NOT_IN_GROUP;
+
+    if (in == NULL) {
+        vec_copy(out, P, sizeof(P));
+    } else {
+        POINTonE2_dadd_affine(out, in, (POINTonE2_affine *)P);
+    }
+    return BLST_SUCCESS;
+}
+
+void blst_aggregated_in_g1(vec384fp12 ret, const POINTonE1_affine *sig)
+{   miller_loop_n(ret, (const POINTonE2_affine *)&BLS12_381_G2, sig, 1);   }
+
+void blst_aggregated_in_g2(vec384fp12 ret, const POINTonE2_affine *sig)
+{   miller_loop_n(ret, sig, (const POINTonE1_affine *)&BLS12_381_G1, 1);   }
+
+BLST_ERROR blst_core_verify_pk_in_g1(const POINTonE1_affine *pk,
+                                     const POINTonE2_affine *signature,
+                                     int hash_or_encode,
+                                     const void *msg, size_t msg_len,
+                                     const void *DST, size_t DST_len,
+                                     const void *aug, size_t aug_len)
+{
+    PAIRING ctx;
+    BLST_ERROR ret;
+
+    ctx.ctrl = AGGR_UNDEFINED | (hash_or_encode ? AGGR_HASH_OR_ENCODE : 0);
+    ctx.nelems = 0;
+    ctx.DST = DST;
+    ctx.DST_len = DST_len;
+
+    ret = PAIRING_Aggregate_PK_in_G1(&ctx, pk, 1, signature, 1, NULL, 0,
+                                     msg, msg_len, aug, aug_len);
+    if (ret != BLST_SUCCESS)
+        return ret;
+
+    PAIRING_Commit(&ctx);
+
+    return PAIRING_FinalVerify(&ctx, NULL) ? BLST_SUCCESS : BLST_VERIFY_FAIL;
+}
+
+BLST_ERROR blst_core_verify_pk_in_g2(const POINTonE2_affine *pk,
+                                     const POINTonE1_affine *signature,
+                                     int hash_or_encode,
+                                     const void *msg, size_t msg_len,
+                                     const void *DST, size_t DST_len,
+                                     const void *aug, size_t aug_len)
+{
+    PAIRING ctx;
+    BLST_ERROR ret;
+
+    ctx.ctrl = AGGR_UNDEFINED | (hash_or_encode ? AGGR_HASH_OR_ENCODE : 0);
+    ctx.nelems = 0;
+    ctx.DST = DST;
+    ctx.DST_len = DST_len;
+
+    ret = PAIRING_Aggregate_PK_in_G2(&ctx, pk, 1, signature, 1, NULL, 0,
+                                     msg, msg_len, aug, aug_len);
+    if (ret != BLST_SUCCESS)
+        return ret;
+
+    PAIRING_Commit(&ctx);
+
+    return PAIRING_FinalVerify(&ctx, NULL) ? BLST_SUCCESS : BLST_VERIFY_FAIL;
+}
diff --git a/vendor/external/blst/src/bulk_addition.c b/vendor/external/blst/src/bulk_addition.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/bulk_addition.c
@@ -0,0 +1,176 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "fields.h"
+#include "point.h"
+
+/*
+ * This implementation uses explicit addition formula:
+ *
+ * λ = (Y₂-Y₁)/(X₂-X₁)
+ * X₃ = λ²-(X₁+X₂)
+ * Y₃ = λ⋅(X₁-X₃)-Y₁
+ *
+ * But since we don't know if we'll have to add point to itself, we need
+ * to eventually resort to corresponding doubling formula:
+ *
+ * λ = 3X₁²/2Y₁
+ * X₃ = λ²-2X₁
+ * Y₃ = λ⋅(X₁-X₃)-Y₁
+ *
+ * The formulae use prohibitively expensive inversion, but whenever we
+ * have a lot of affine points to accumulate, we can amortize the cost
+ * by applying Montgomery's batch inversion approach. As a result,
+ * asymptotic[!] per-point cost for addition is as small as 5M+1S. For
+ * comparison, ptype##_dadd_affine takes 8M+5S. In practice, all things
+ * considered, the improvement coefficient varies from 60% to 85%
+ * depending on platform and curve.
+ *
+ * THIS IMPLEMENTATION IS *NOT* CONSTANT-TIME. [But if there is an
+ * application that requires constant time-ness, speak up!]
+ */
+
+/*
+ * Calculate λ's numerator and denominator.
+ *
+ * input:	A	x1	y1	-
+ *		B	x2	y2	-
+ * output:
+ * if A!=B:	A	x1	y1	(x2-x1)*mul_acc
+ *		B	x2+x1	y2-y1	(x2-x1)
+ *
+ * if A==B:	A	x	y	2y*mul_acc
+ *		B	2x	3*x^2	2y
+ *
+ * if A==-B:	A	0	0	1*mul_acc
+ *		B	0	3*x^2	0
+ */
+#define HEAD(ptype, bits, field, one) \
+static void ptype##_head(ptype AB[2], const vec##bits mul_acc) \
+{ \
+    ptype *A = AB, *B = AB+1; \
+    limb_t inf = vec_is_zero(A, sizeof(ptype##_affine)) | \
+                 vec_is_zero(B, sizeof(ptype##_affine));  \
+    static const vec##bits zero = { 0 }; \
+\
+    sub_##field(B->Z, B->X, A->X);		/* X2-X1  */ \
+    add_##field(B->X, B->X, A->X);		/* X2+X1  */ \
+    add_##field(A->Z, B->Y, A->Y);		/* Y2+Y1  */ \
+    sub_##field(B->Y, B->Y, A->Y);		/* Y2-Y1  */ \
+    if (vec_is_zero(B->Z, sizeof(B->Z))) {	/* X2==X1 */ \
+        inf = vec_is_zero(A->Z, sizeof(A->Z));	\
+        vec_select(B->X, A->Z, B->X, sizeof(B->X), inf); \
+        sqr_##field(B->Y, A->X);		\
+        mul_by_3_##field(B->Y, B->Y);		/* 3*X1^2 */ \
+        vec_copy(B->Z, A->Z, sizeof(B->Z));	/* 2*Y1   */ \
+    }						/* B->Y is numenator    */ \
+						/* B->Z is denominator  */ \
+    vec_select(A->X, B->X, A->X, sizeof(A->X), inf); \
+    vec_select(A->Y, A->Z, A->Y, sizeof(A->Y), inf); \
+    vec_select(A->Z, one,  B->Z, sizeof(A->Z), inf); \
+    vec_select(B->Z, zero, B->Z, sizeof(B->Z), inf); \
+    if (mul_acc != NULL) \
+        mul_##field(A->Z, A->Z, mul_acc);	/* chain multiplication */\
+}
+
+/*
+ * Calculate λ and resulting coordinates.
+ *
+ * input:	A		x1			y1		-
+ *		B		x2+x1			nominator	-
+ * 		lambda		1/denominator
+ * output:	D		x3=(nom/den)^2-(x2+x1)	y3=(nom/den)(x1-x3)-y1
+ */
+#define TAIL(ptype, bits, field, one) \
+static void ptype##_tail(ptype *D, ptype AB[2], vec##bits lambda) \
+{ \
+    ptype *A = AB, *B = AB+1; \
+    vec##bits llambda; \
+    limb_t inf = vec_is_zero(B->Z, sizeof(B->Z)); \
+\
+    mul_##field(lambda, lambda, B->Y);		/* λ = (Y2-Y1)/(X2-X1)  */ \
+						/* alt. 3*X1^2/2*Y1     */ \
+    sqr_##field(llambda, lambda); \
+    sub_##field(D->X, llambda, B->X);		/* X3 = λ^2-X1-X2       */ \
+\
+    sub_##field(D->Y, A->X, D->X);   \
+    mul_##field(D->Y, D->Y, lambda); \
+    sub_##field(D->Y, D->Y, A->Y);		/* Y3 = λ*(X1-X3)-Y1    */ \
+\
+    vec_select(D->X, A->X, D->X, 2*sizeof(D->X), inf); \
+    vec_select(B->Z, one, B->Z, sizeof(B->Z), inf); \
+}
+
+/*
+ * |points[]| is volatile buffer with |X|s and |Y|s initially holding
+ * input affine coordinates, and with |Z|s being used as additional
+ * temporary storage [unrelated to Jacobian coordinates]. |sum| is
+ * in-/output, initialize to infinity accordingly.
+ */
+#define ADDITION_BTREE(prefix, ptype, bits, field, one) \
+HEAD(ptype, bits, field, one) \
+TAIL(ptype, bits, field, one) \
+static void ptype##s_accumulate(ptype *sum, ptype points[], size_t n) \
+{ \
+    ptype *dst; \
+    void *mul_acc; \
+    size_t i; \
+\
+    while (n >= 16) { \
+        if (n & 1) \
+            ptype##_dadd_affine(sum, sum, (const ptype##_affine *)points++); \
+        n /= 2; \
+        for (mul_acc = NULL, i = n; i--; mul_acc = points->Z, points += 2) \
+            ptype##_head(points, mul_acc); \
+\
+        reciprocal_##field(points[-2].Z, points[-2].Z); /* 1/∏ Zi */ \
+\
+        for (dst = points, i = n; --i;) { \
+            dst--; points -= 2; \
+            mul_##field(points[-2].Z, points[0].Z, points[-2].Z); \
+            ptype##_tail(dst, points, points[-2].Z); \
+            mul_##field(points[-2].Z, points[0].Z, points[1].Z); \
+        } \
+        dst--; points -= 2; \
+        ptype##_tail(dst, points, points[0].Z); \
+        points = dst; \
+    } \
+    while (n--) \
+        ptype##_dadd_affine(sum, sum, (const ptype##_affine *)points++); \
+} \
+\
+void prefix##s_add(ptype *sum, const ptype##_affine *const points[], \
+                               size_t npoints) \
+{ \
+    const size_t stride = SCRATCH_LIMIT / sizeof(ptype); \
+    ptype *scratch = alloca((npoints > stride ? stride : npoints) * \
+                            sizeof(ptype)); \
+    const ptype##_affine *point = NULL; \
+\
+    vec_zero(sum, sizeof(*sum)); \
+    while (npoints) { \
+        size_t i, j = npoints > stride ? stride : npoints; \
+        for (i=0; i<j; i++) { \
+            point = *points ? *points++ : point+1; \
+            vec_copy(&scratch[i], point, sizeof(*point)); \
+        } \
+        ptype##s_accumulate(sum, scratch, j); \
+        npoints -= j; \
+    } \
+}
+
+#ifndef SCRATCH_LIMIT
+# ifdef __wasm__
+#  define SCRATCH_LIMIT (45 * 1024)
+# else
+   /* Performance with 144K scratch is within 1-2-3% from optimal */
+#  define SCRATCH_LIMIT (144 * 1024)
+# endif
+#endif
+
+ADDITION_BTREE(blst_p1, POINTonE1, 384, fp, BLS12_381_Rx.p2)
+
+ADDITION_BTREE(blst_p2, POINTonE2, 384x, fp2, BLS12_381_Rx.p2)
diff --git a/vendor/external/blst/src/bytes.h b/vendor/external/blst/src/bytes.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/bytes.h
@@ -0,0 +1,152 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __BLS12_381_ASM_BYTES_H__
+#define __BLS12_381_ASM_BYTES_H__
+
+static inline void bytes_zero(unsigned char *a, size_t num)
+{
+    size_t i;
+
+    for (i = 0; i < num; i++)
+        a[i] = 0;
+}
+
+static inline void limbs_from_be_bytes(limb_t *restrict ret,
+                                       const unsigned char *in, size_t n)
+{
+    limb_t limb = 0;
+
+    while(n--) {
+        limb <<= 8;
+        limb |= *in++;
+        /*
+         * 'if (n % sizeof(limb_t) == 0)' is omitted because it's cheaper
+         * to perform redundant stores than to pay penalty for
+         * mispredicted branch. Besides, some compilers unroll the
+         * loop and remove redundant stores to 'restrict'-ed storage...
+         */
+        ret[n / sizeof(limb_t)] = limb;
+    }
+}
+
+static inline void be_bytes_from_limbs(unsigned char *out, const limb_t *in,
+                                       size_t n)
+{
+    limb_t limb;
+
+    while(n--) {
+        limb = in[n / sizeof(limb_t)];
+        *out++ = (unsigned char)(limb >> (8 * (n % sizeof(limb_t))));
+    }
+}
+
+static inline void limbs_from_le_bytes(limb_t *restrict ret,
+                                       const unsigned char *in, size_t n)
+{
+    limb_t limb = 0;
+
+    while(n--) {
+        limb <<= 8;
+        limb |= in[n];
+        /*
+         * 'if (n % sizeof(limb_t) == 0)' is omitted because it's cheaper
+         * to perform redundant stores than to pay penalty for
+         * mispredicted branch. Besides, some compilers unroll the
+         * loop and remove redundant stores to 'restrict'-ed storage...
+         */
+        ret[n / sizeof(limb_t)] = limb;
+    }
+}
+
+static inline void le_bytes_from_limbs(unsigned char *out, const limb_t *in,
+                                       size_t n)
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+    limb_t limb;
+    size_t i, j, r;
+
+    if ((uptr_t)out == (uptr_t)in && is_endian.little)
+        return;
+
+    r = n % sizeof(limb_t);
+    n /= sizeof(limb_t);
+
+    for(i = 0; i < n; i++) {
+        for (limb = in[i], j = 0; j < sizeof(limb_t); j++, limb >>= 8)
+            *out++ = (unsigned char)limb;
+    }
+    if (r) {
+        for (limb = in[i], j = 0; j < r; j++, limb >>= 8)
+            *out++ = (unsigned char)limb;
+    }
+}
+
+static inline char hex_from_nibble(unsigned char nibble)
+{
+    int mask = (9 - (nibble &= 0xf)) >> 31;
+    return (char)(nibble + ((('a'-10) & mask) | ('0' & ~mask)));
+}
+
+static unsigned char nibble_from_hex(char c)
+{
+    int mask, ret;
+
+    mask = (('a'-c-1) & (c-1-'f')) >> 31;
+    ret  = (10 + c - 'a') & mask;
+    mask = (('A'-c-1) & (c-1-'F')) >> 31;
+    ret |= (10 + c - 'A') & mask;
+    mask = (('0'-c-1) & (c-1-'9')) >> 31;
+    ret |= (c - '0') & mask;
+    mask = ((ret-1) & ~mask) >> 31;
+    ret |= 16 & mask;
+
+    return (unsigned char)ret;
+}
+
+static void bytes_from_hexascii(unsigned char *ret, size_t sz, const char *hex)
+{
+    size_t len;
+    unsigned char b = 0;
+
+    if (hex[0]=='0' && (hex[1]=='x' || hex[1]=='X'))
+        hex += 2;
+
+    for (len = 0; len<2*sz && nibble_from_hex(hex[len])<16; len++) ;
+
+    bytes_zero(ret, sz);
+
+    while(len--) {
+        b <<= 4;
+        b |= nibble_from_hex(*hex++);
+        if (len % 2 == 0)
+            ret[len / 2] = b;
+    }
+}
+
+static void limbs_from_hexascii(limb_t *ret, size_t sz, const char *hex)
+{
+    size_t len;
+    limb_t limb = 0;
+
+    if (hex[0]=='0' && (hex[1]=='x' || hex[1]=='X'))
+        hex += 2;
+
+    for (len = 0; len<2*sz && nibble_from_hex(hex[len])<16; len++) ;
+
+    vec_zero(ret, sz);
+
+    while(len--) {
+        limb <<= 4;
+        limb |= nibble_from_hex(*hex++);
+        if (len % (2*sizeof(limb_t)) == 0)
+            ret[len / (2*sizeof(limb_t))] = limb;
+    }
+}
+
+#endif
diff --git a/vendor/external/blst/src/consts.c b/vendor/external/blst/src/consts.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/consts.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "consts.h"
+
+/* z = -0xd201000000010000 */
+const vec384 BLS12_381_P = {    /* (z-1)^2 * (z^4 - z^2 + 1)/3 + z */
+    TO_LIMB_T(0xb9feffffffffaaab), TO_LIMB_T(0x1eabfffeb153ffff),
+    TO_LIMB_T(0x6730d2a0f6b0f624), TO_LIMB_T(0x64774b84f38512bf),
+    TO_LIMB_T(0x4b1ba7b6434bacd7), TO_LIMB_T(0x1a0111ea397fe69a)
+};
+const limb_t BLS12_381_p0 = (limb_t)0x89f3fffcfffcfffd;  /* -1/P */
+
+const radix384 BLS12_381_Rx = { /* (1<<384)%P, "radix", one-in-Montgomery */
+  { { ONE_MONT_P },
+    { 0 } }
+};
+
+const vec384 BLS12_381_RR = {   /* (1<<768)%P, "radix"^2, to-Montgomery */
+    TO_LIMB_T(0xf4df1f341c341746), TO_LIMB_T(0x0a76e6a609d104f1),
+    TO_LIMB_T(0x8de5476c4c95b6d5), TO_LIMB_T(0x67eb88a9939d83c0),
+    TO_LIMB_T(0x9a793e85b519952d), TO_LIMB_T(0x11988fe592cae3aa)
+};
+
+const vec256 BLS12_381_r = {    /* z^4 - z^2 + 1, group order */
+    TO_LIMB_T(0xffffffff00000001), TO_LIMB_T(0x53bda402fffe5bfe),
+    TO_LIMB_T(0x3339d80809a1d805), TO_LIMB_T(0x73eda753299d7d48)
+};
+
+const vec256 BLS12_381_rRR = {  /* (1<<512)%r, "radix"^2, to-Montgomery */
+    TO_LIMB_T(0xc999e990f3f29c6d), TO_LIMB_T(0x2b6cedcb87925c23),
+    TO_LIMB_T(0x05d314967254398f), TO_LIMB_T(0x0748d9d99f59ff11)
+};
diff --git a/vendor/external/blst/src/consts.h b/vendor/external/blst/src/consts.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/consts.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __BLS12_381_ASM_CONST_H__
+#define __BLS12_381_ASM_CONST_H__
+#include "vect.h"
+
+extern const vec384 BLS12_381_P;
+extern const limb_t BLS12_381_p0;
+static const limb_t p0 = (limb_t)0x89f3fffcfffcfffd;  /* -1/P */
+typedef union { vec384 p12[12]; vec384x p2; vec384 p; } radix384;
+extern const radix384 BLS12_381_Rx; /* (1<<384)%P, "radix", one-in-Montgomery */
+extern const vec384 BLS12_381_RR;   /* (1<<768)%P, "radix"^2, to-Montgomery   */
+
+#define ONE_MONT_P TO_LIMB_T(0x760900000002fffd), \
+                   TO_LIMB_T(0xebf4000bc40c0002), \
+                   TO_LIMB_T(0x5f48985753c758ba), \
+                   TO_LIMB_T(0x77ce585370525745), \
+                   TO_LIMB_T(0x5c071a97a256ec6d), \
+                   TO_LIMB_T(0x15f65ec3fa80e493)
+
+#define ZERO_384 (BLS12_381_Rx.p2[1])
+
+extern const vec256 BLS12_381_r;    /* order */
+static const limb_t r0 = (limb_t)0xfffffffeffffffff;  /* -1/r */
+extern const vec256 BLS12_381_rRR;  /* (1<<512)%r, "radix"^2, to-Montgomery   */
+
+#endif
diff --git a/vendor/external/blst/src/cpuid.c b/vendor/external/blst/src/cpuid.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/cpuid.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#if (defined(__GNUC__) || defined(__clang__) || defined(__SUNPRO_C)) && !defined(_WIN32)
+__attribute__((visibility("hidden")))
+#endif
+int __blst_platform_cap = 0;
+
+#if defined(__x86_64__) || defined(__x86_64) || (defined(_M_X64) && !defined(_M_ARM64EC))
+
+# if defined(__GNUC__) || defined(__clang__) || defined(__SUNPRO_C)
+static void __cpuidex(int info[4], int func, int sub)
+{
+    int eax, ebx, ecx, edx;
+
+    __asm__("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
+                    : "a"(func), "c"(sub));
+
+    info[0] = eax;
+    info[1] = ebx;
+    info[2] = ecx;
+    info[3] = edx;
+}
+# else
+#  include <intrin.h>
+# endif
+
+# if defined(__GNUC__) || defined(__clang__)
+__attribute__((constructor))
+# endif
+static int __blst_cpuid(void)
+{
+    int info[4], cap = 0;
+
+    __cpuidex(info, 0, 0);
+    if (info[0] > 6) {
+        __cpuidex(info, 7, 0);
+        cap |= (info[1]>>19) & 1; /* ADX */
+        cap |= (info[1]>>28) & 2; /* SHA */
+    }
+
+    __blst_platform_cap = cap;
+
+    return 0;
+}
+
+# if defined(_MSC_VER) && !defined(__clang__)
+#  pragma section(".CRT$XCU",read)
+__declspec(allocate(".CRT$XCU")) static int (*p)(void) = __blst_cpuid;
+# elif defined(__SUNPRO_C)
+#  pragma init(__blst_cpuid)
+# endif
+
+#elif defined(__aarch64__) || defined(__aarch64) || defined(_M_ARM64)
+
+# if defined(__linux__) && (defined(__GNUC__) || defined(__clang__))
+extern unsigned long getauxval(unsigned long type) __attribute__ ((weak));
+
+__attribute__((constructor))
+static int __blst_cpuid(void)
+{
+    int cap = 0;
+
+    if (getauxval) {
+        unsigned long hwcap_ce = getauxval(16);
+        cap = (hwcap_ce>>6) & 1; /* SHA256 */
+    }
+
+    __blst_platform_cap = cap;
+
+    return 0;
+}
+# elif defined(__APPLE__) && (defined(__GNUC__) || defined(__clang__))
+__attribute__((constructor))
+static int __blst_cpuid()
+{
+    __blst_platform_cap = 1; /* SHA256 */
+    return 0;
+}
+# elif defined(__FreeBSD__) && __FreeBSD__ >= 12
+#  include <sys/auxv.h>
+__attribute__((constructor))
+static int __blst_cpuid()
+{
+    unsigned long cap;
+
+    if (elf_aux_info(AT_HWCAP, &cap, sizeof(cap)) == 0)
+        __blst_platform_cap = (cap & HWCAP_SHA2) != 0;
+
+    return 0;
+}
+# elif defined(_WIN64)
+int IsProcessorFeaturePresent(int);
+
+#  if defined(__GNUC__) || defined(__clang__)
+__attribute__((constructor))
+#  endif
+static int __blst_cpuid(void)
+{
+    __blst_platform_cap = IsProcessorFeaturePresent(30); /* AES, SHA1, SHA2 */
+
+    return 0;
+}
+
+#  if defined(_MSC_VER) && !defined(__clang__)
+#   pragma section(".CRT$XCU",read)
+__declspec(allocate(".CRT$XCU")) static int (*p)(void) = __blst_cpuid;
+#  endif
+# endif
+
+#endif
diff --git a/vendor/external/blst/src/e1.c b/vendor/external/blst/src/e1.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/e1.c
@@ -0,0 +1,564 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "point.h"
+#include "fields.h"
+#include "errors.h"
+
+/*
+ * y^2 = x^3 + B
+ */
+static const vec384 B_E1 = {        /* (4 << 384) % P */
+    TO_LIMB_T(0xaa270000000cfff3), TO_LIMB_T(0x53cc0032fc34000a),
+    TO_LIMB_T(0x478fe97a6b0a807f), TO_LIMB_T(0xb1d37ebee6ba24d7),
+    TO_LIMB_T(0x8ec9733bbf78ab2f), TO_LIMB_T(0x09d645513d83de7e)
+};
+
+const POINTonE1 BLS12_381_G1 = {    /* generator point [in Montgomery] */
+  /* (0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905
+   *    a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb << 384) % P */
+  { TO_LIMB_T(0x5cb38790fd530c16), TO_LIMB_T(0x7817fc679976fff5),
+    TO_LIMB_T(0x154f95c7143ba1c1), TO_LIMB_T(0xf0ae6acdf3d0e747),
+    TO_LIMB_T(0xedce6ecc21dbf440), TO_LIMB_T(0x120177419e0bfb75) },
+  /* (0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af6
+   *    00db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1 << 384) % P */
+  { TO_LIMB_T(0xbaac93d50ce72271), TO_LIMB_T(0x8c22631a7918fd8e),
+    TO_LIMB_T(0xdd595f13570725ce), TO_LIMB_T(0x51ac582950405194),
+    TO_LIMB_T(0x0e1c8c3fad0059c0), TO_LIMB_T(0x0bbc3efc5008a26a) },
+  { ONE_MONT_P }
+};
+
+const POINTonE1 BLS12_381_NEG_G1 = { /* negative generator [in Montgomery] */
+  /* (0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905
+   *    a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb << 384) % P */
+  { TO_LIMB_T(0x5cb38790fd530c16), TO_LIMB_T(0x7817fc679976fff5),
+    TO_LIMB_T(0x154f95c7143ba1c1), TO_LIMB_T(0xf0ae6acdf3d0e747),
+    TO_LIMB_T(0xedce6ecc21dbf440), TO_LIMB_T(0x120177419e0bfb75) },
+  /* (0x114d1d6855d545a8aa7d76c8cf2e21f267816aef1db507c9
+   *    6655b9d5caac42364e6f38ba0ecb751bad54dcd6b939c2ca << 384) % P */
+  { TO_LIMB_T(0xff526c2af318883a), TO_LIMB_T(0x92899ce4383b0270),
+    TO_LIMB_T(0x89d7738d9fa9d055), TO_LIMB_T(0x12caf35ba344c12a),
+    TO_LIMB_T(0x3cff1b76964b5317), TO_LIMB_T(0x0e44d2ede9774430) },
+  { ONE_MONT_P }
+};
+
+static inline void mul_by_b_onE1(vec384 out, const vec384 in)
+{   lshift_fp(out, in, 2);   }
+
+static inline void mul_by_4b_onE1(vec384 out, const vec384 in)
+{   lshift_fp(out, in, 4);   }
+
+static void POINTonE1_cneg(POINTonE1 *p, bool_t cbit)
+{   cneg_fp(p->Y, p->Y, cbit);   }
+
+void blst_p1_cneg(POINTonE1 *a, int cbit)
+{   POINTonE1_cneg(a, is_zero(cbit) ^ 1);   }
+
+static void POINTonE1_from_Jacobian(POINTonE1 *out, const POINTonE1 *in)
+{
+    vec384 Z, ZZ;
+    limb_t inf = vec_is_zero(in->Z, sizeof(in->Z));
+
+    reciprocal_fp(Z, in->Z);                            /* 1/Z   */
+
+    sqr_fp(ZZ, Z);
+    mul_fp(out->X, in->X, ZZ);                          /* X = X/Z^2 */
+
+    mul_fp(ZZ, ZZ, Z);
+    mul_fp(out->Y, in->Y, ZZ);                          /* Y = Y/Z^3 */
+
+    vec_select(out->Z, in->Z, BLS12_381_G1.Z,
+                       sizeof(BLS12_381_G1.Z), inf);    /* Z = inf ? 0 : 1 */
+}
+
+void blst_p1_from_jacobian(POINTonE1 *out, const POINTonE1 *a)
+{   POINTonE1_from_Jacobian(out, a);   }
+
+static void POINTonE1_to_affine(POINTonE1_affine *out, const POINTonE1 *in)
+{
+    POINTonE1 p;
+
+    if (!vec_is_equal(in->Z, BLS12_381_Rx.p, sizeof(in->Z))) {
+        POINTonE1_from_Jacobian(&p, in);
+        in = &p;
+    }
+    vec_copy(out, in, sizeof(*out));
+}
+
+void blst_p1_to_affine(POINTonE1_affine *out, const POINTonE1 *a)
+{   POINTonE1_to_affine(out, a);   }
+
+void blst_p1_from_affine(POINTonE1 *out, const POINTonE1_affine *a)
+{
+    vec_copy(out, a, sizeof(*a));
+    vec_select(out->Z, a->X, BLS12_381_Rx.p, sizeof(out->Z),
+                       vec_is_zero(a, sizeof(*a)));
+}
+
+static bool_t POINTonE1_affine_on_curve(const POINTonE1_affine *p)
+{
+    vec384 XXX, YY;
+
+    sqr_fp(XXX, p->X);
+    mul_fp(XXX, XXX, p->X);                             /* X^3 */
+    add_fp(XXX, XXX, B_E1);                             /* X^3 + B */
+
+    sqr_fp(YY, p->Y);                                   /* Y^2 */
+
+    return vec_is_equal(XXX, YY, sizeof(XXX));
+}
+
+int blst_p1_affine_on_curve(const POINTonE1_affine *p)
+{   return (int)(POINTonE1_affine_on_curve(p) | vec_is_zero(p, sizeof(*p)));   }
+
+static bool_t POINTonE1_on_curve(const POINTonE1 *p)
+{
+    vec384 XXX, YY, BZ6;
+    limb_t inf = vec_is_zero(p->Z, sizeof(p->Z));
+
+    sqr_fp(BZ6, p->Z);
+    mul_fp(BZ6, BZ6, p->Z);
+    sqr_fp(BZ6, BZ6);                                   /* Z^6 */
+    mul_by_b_onE1(BZ6, BZ6);                            /* B*Z^6 */
+
+    sqr_fp(XXX, p->X);
+    mul_fp(XXX, XXX, p->X);                             /* X^3 */
+    add_fp(XXX, XXX, BZ6);                              /* X^3 + B*Z^6 */
+
+    sqr_fp(YY, p->Y);                                   /* Y^2 */
+
+    return vec_is_equal(XXX, YY, sizeof(XXX)) | inf;
+}
+
+int blst_p1_on_curve(const POINTonE1 *p)
+{   return (int)POINTonE1_on_curve(p);   }
+
+static limb_t POINTonE1_affine_Serialize_BE(unsigned char out[96],
+                                            const POINTonE1_affine *in)
+{
+    vec384 temp;
+
+    from_fp(temp, in->X);
+    be_bytes_from_limbs(out, temp, sizeof(temp));
+
+    from_fp(temp, in->Y);
+    be_bytes_from_limbs(out + 48, temp, sizeof(temp));
+
+    return sgn0_pty_mod_384(temp, BLS12_381_P);
+}
+
+void blst_p1_affine_serialize(unsigned char out[96],
+                              const POINTonE1_affine *in)
+{
+    if (vec_is_zero(in->X, 2*sizeof(in->X))) {
+        bytes_zero(out, 96);
+        out[0] = 0x40;    /* infinity bit */
+    } else {
+        (void)POINTonE1_affine_Serialize_BE(out, in);
+    }
+}
+
+static limb_t POINTonE1_Serialize_BE(unsigned char out[96],
+                                     const POINTonE1 *in)
+{
+    POINTonE1 p;
+
+    if (!vec_is_equal(in->Z, BLS12_381_Rx.p, sizeof(in->Z))) {
+        POINTonE1_from_Jacobian(&p, in);
+        in = &p;
+    }
+
+    return POINTonE1_affine_Serialize_BE(out, (const POINTonE1_affine *)in);
+}
+
+static void POINTonE1_Serialize(unsigned char out[96], const POINTonE1 *in)
+{
+    if (vec_is_zero(in->Z, sizeof(in->Z))) {
+        bytes_zero(out, 96);
+        out[0] = 0x40;    /* infinity bit */
+    } else {
+        (void)POINTonE1_Serialize_BE(out, in);
+    }
+}
+
+void blst_p1_serialize(unsigned char out[96], const POINTonE1 *in)
+{   POINTonE1_Serialize(out, in);   }
+
+static limb_t POINTonE1_affine_Compress_BE(unsigned char out[48],
+                                           const POINTonE1_affine *in)
+{
+    vec384 temp;
+
+    from_fp(temp, in->X);
+    be_bytes_from_limbs(out, temp, sizeof(temp));
+
+    return sgn0_pty_mont_384(in->Y, BLS12_381_P, p0);
+}
+
+void blst_p1_affine_compress(unsigned char out[48], const POINTonE1_affine *in)
+{
+    if (vec_is_zero(in->X, 2*sizeof(in->X))) {
+        bytes_zero(out, 48);
+        out[0] = 0xc0;    /* compressed and infinity bits */
+    } else {
+        limb_t sign = POINTonE1_affine_Compress_BE(out, in);
+        out[0] |= (unsigned char)(0x80 | ((sign & 2) << 4));
+    }
+}
+
+static limb_t POINTonE1_Compress_BE(unsigned char out[48],
+                                    const POINTonE1 *in)
+{
+    POINTonE1 p;
+
+    if (!vec_is_equal(in->Z, BLS12_381_Rx.p, sizeof(in->Z))) {
+        POINTonE1_from_Jacobian(&p, in);
+        in = &p;
+    }
+
+    return POINTonE1_affine_Compress_BE(out, (const POINTonE1_affine *)in);
+}
+
+void blst_p1_compress(unsigned char out[48], const POINTonE1 *in)
+{
+    if (vec_is_zero(in->Z, sizeof(in->Z))) {
+        bytes_zero(out, 48);
+        out[0] = 0xc0;    /* compressed and infinity bits */
+    } else {
+        limb_t sign = POINTonE1_Compress_BE(out, in);
+        out[0] |= (unsigned char)(0x80 | ((sign & 2) << 4));
+    }
+}
+
+static limb_t POINTonE1_Uncompress_BE(POINTonE1_affine *out,
+                                      const unsigned char in[48])
+{
+    POINTonE1_affine ret;
+    vec384 temp;
+
+    limbs_from_be_bytes(ret.X, in, sizeof(ret.X));
+    /* clear top 3 bits in case caller was conveying some information there */
+    ret.X[sizeof(ret.X)/sizeof(limb_t)-1] &= ((limb_t)0-1) >> 3;
+    add_fp(temp, ret.X, ZERO_384);  /* less than modulus? */
+    if (!vec_is_equal(temp, ret.X, sizeof(temp)))
+        return (limb_t)0 - BLST_BAD_ENCODING;
+    mul_fp(ret.X, ret.X, BLS12_381_RR);
+
+    sqr_fp(ret.Y, ret.X);
+    mul_fp(ret.Y, ret.Y, ret.X);
+    add_fp(ret.Y, ret.Y, B_E1);                         /* X^3 + B */
+    if (!sqrt_fp(ret.Y, ret.Y))
+        return (limb_t)0 - BLST_POINT_NOT_ON_CURVE;
+
+    vec_copy(out, &ret, sizeof(ret));
+
+    return sgn0_pty_mont_384(out->Y, BLS12_381_P, p0);
+}
+
+static BLST_ERROR POINTonE1_Uncompress_Z(POINTonE1_affine *out,
+                                         const unsigned char in[48])
+{
+    unsigned char in0 = in[0];
+    limb_t sgn0_pty;
+
+    if ((in0 & 0x80) == 0)      /* compressed bit */
+        return BLST_BAD_ENCODING;
+
+    if (in0 & 0x40) {           /* infinity bit */
+        if (byte_is_zero(in0 & 0x3f) & bytes_are_zero(in+1, 47)) {
+            vec_zero(out, sizeof(*out));
+            return BLST_SUCCESS;
+        } else {
+            return BLST_BAD_ENCODING;
+        }
+    }
+
+    sgn0_pty = POINTonE1_Uncompress_BE(out, in);
+
+    if (sgn0_pty > 3)
+        return (BLST_ERROR)(0 - sgn0_pty); /* POINT_NOT_ON_CURVE */
+
+    sgn0_pty >>= 1; /* skip over parity bit */
+    sgn0_pty ^= (in0 & 0x20) >> 5;
+    cneg_fp(out->Y, out->Y, sgn0_pty);
+
+    /* (0,±2) is not in group, but application might want to ignore? */
+    return vec_is_zero(out->X, sizeof(out->X)) ? BLST_POINT_NOT_IN_GROUP
+                                               : BLST_SUCCESS;
+}
+
+BLST_ERROR blst_p1_uncompress(POINTonE1_affine *out, const unsigned char in[48])
+{   return POINTonE1_Uncompress_Z(out, in);   }
+
+static BLST_ERROR POINTonE1_Deserialize_BE(POINTonE1_affine *out,
+                                           const unsigned char in[96])
+{
+    POINTonE1_affine ret;
+    vec384 temp;
+
+    limbs_from_be_bytes(ret.X, in, sizeof(ret.X));
+    limbs_from_be_bytes(ret.Y, in + 48, sizeof(ret.Y));
+
+    /* clear top 3 bits in case caller was conveying some information there */
+    ret.X[sizeof(ret.X)/sizeof(limb_t)-1] &= ((limb_t)0-1) >> 3;
+    add_fp(temp, ret.X, ZERO_384);  /* less than modulus? */
+    if (!vec_is_equal(temp, ret.X, sizeof(temp)))
+        return BLST_BAD_ENCODING;
+
+    add_fp(temp, ret.Y, ZERO_384);  /* less than modulus? */
+    if (!vec_is_equal(temp, ret.Y, sizeof(temp)))
+        return BLST_BAD_ENCODING;
+
+    mul_fp(ret.X, ret.X, BLS12_381_RR);
+    mul_fp(ret.Y, ret.Y, BLS12_381_RR);
+
+    if (!POINTonE1_affine_on_curve(&ret))
+        return BLST_POINT_NOT_ON_CURVE;
+
+    vec_copy(out, &ret, sizeof(ret));
+
+    /* (0,±2) is not in group, but application might want to ignore? */
+    return vec_is_zero(out->X, sizeof(out->X)) ? BLST_POINT_NOT_IN_GROUP
+                                               : BLST_SUCCESS;
+}
+
+static BLST_ERROR POINTonE1_Deserialize_Z(POINTonE1_affine *out,
+                                          const unsigned char in[96])
+{
+    unsigned char in0 = in[0];
+
+    if ((in0 & 0xe0) == 0)
+        return POINTonE1_Deserialize_BE(out, in);
+
+    if (in0 & 0x80)             /* compressed bit */
+        return POINTonE1_Uncompress_Z(out, in);
+
+    if (in0 & 0x40) {           /* infinity bit */
+        if (byte_is_zero(in0 & 0x3f) & bytes_are_zero(in+1, 95)) {
+            vec_zero(out, sizeof(*out));
+            return BLST_SUCCESS;
+        }
+    }
+
+    return BLST_BAD_ENCODING;
+}
+
+BLST_ERROR blst_p1_deserialize(POINTonE1_affine *out,
+                               const unsigned char in[96])
+{   return POINTonE1_Deserialize_Z(out, in);   }
+
+#include "ec_ops.h"
+POINT_DADD_IMPL(POINTonE1, 384, fp)
+POINT_DADD_AFFINE_IMPL_A0(POINTonE1, 384, fp, BLS12_381_Rx.p)
+POINT_ADD_IMPL(POINTonE1, 384, fp)
+POINT_ADD_AFFINE_IMPL(POINTonE1, 384, fp, BLS12_381_Rx.p)
+POINT_DOUBLE_IMPL_A0(POINTonE1, 384, fp)
+POINT_IS_EQUAL_IMPL(POINTonE1, 384, fp)
+
+void blst_p1_add(POINTonE1 *out, const POINTonE1 *a, const POINTonE1 *b)
+{   POINTonE1_add(out, a, b);   }
+
+void blst_p1_add_or_double(POINTonE1 *out, const POINTonE1 *a,
+                                           const POINTonE1 *b)
+{   POINTonE1_dadd(out, a, b, NULL);   }
+
+void blst_p1_add_affine(POINTonE1 *out, const POINTonE1 *a,
+                                        const POINTonE1_affine *b)
+{   POINTonE1_add_affine(out, a, b);   }
+
+void blst_p1_add_or_double_affine(POINTonE1 *out, const POINTonE1 *a,
+                                                  const POINTonE1_affine *b)
+{   POINTonE1_dadd_affine(out, a, b);   }
+
+void blst_p1_double(POINTonE1 *out, const POINTonE1 *a)
+{   POINTonE1_double(out, a);   }
+
+int blst_p1_is_equal(const POINTonE1 *a, const POINTonE1 *b)
+{   return (int)POINTonE1_is_equal(a, b);   }
+
+#include "ec_mult.h"
+POINT_MULT_SCALAR_WX_IMPL(POINTonE1, 4)
+POINT_MULT_SCALAR_WX_IMPL(POINTonE1, 5)
+
+#ifdef __BLST_PRIVATE_TESTMODE__
+POINT_AFFINE_MULT_SCALAR_IMPL(POINTonE1)
+
+DECLARE_PRIVATE_POINTXZ(POINTonE1, 384)
+POINT_LADDER_PRE_IMPL(POINTonE1, 384, fp)
+POINT_LADDER_STEP_IMPL_A0(POINTonE1, 384, fp, onE1)
+POINT_LADDER_POST_IMPL_A0(POINTonE1, 384, fp, onE1)
+POINT_MULT_SCALAR_LADDER_IMPL(POINTonE1)
+#endif
+
+static const vec384 beta = {            /* such that beta^3 - 1 = 0  */
+    /* -1/2 * (1 + sqrt(-3)) = ((P-2)^(P-2)) * (1 + (P-3)^((P+1)/4)) */
+    /* (0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4
+          897d29650fb85f9b409427eb4f49fffd8bfd00000000aaac << 384) % P */
+    TO_LIMB_T(0xcd03c9e48671f071), TO_LIMB_T(0x5dab22461fcda5d2),
+    TO_LIMB_T(0x587042afd3851b95), TO_LIMB_T(0x8eb60ebe01bacb9e),
+    TO_LIMB_T(0x03f97d6e83d050d2), TO_LIMB_T(0x18f0206554638741)
+};
+
+static void sigma(POINTonE1 *out, const POINTonE1 *in)
+{
+    vec_copy(out->X, in->X, 2*sizeof(out->X));
+    mul_fp(out->Z, in->Z, beta);
+}
+
+/* Gallant-Lambert-Vanstone, ~45% faster than POINTonE1_mult_w5 */
+static void POINTonE1_mult_glv(POINTonE1 *out, const POINTonE1 *in,
+                               const pow256 SK)
+{
+    union { vec256 l; pow256 s; } val;
+
+    /* SK/z^2 [in constant time] */
+
+    limbs_from_le_bytes(val.l, SK, 32);
+    div_by_zz(val.l);
+    le_bytes_from_limbs(val.s, val.l, 32);
+
+    {
+        const byte *scalars[2] = { val.s+16, val.s };
+        POINTonE1 table[2][1<<(5-1)];   /* 4.5KB */
+        size_t i;
+
+        POINTonE1_precompute_w5(table[0], in);
+        for (i = 0; i < 1<<(5-1); i++) {
+            mul_fp(table[1][i].X, table[0][i].X, beta);
+            cneg_fp(table[1][i].Y, table[0][i].Y, 1);
+            vec_copy(table[1][i].Z, table[0][i].Z, sizeof(table[1][i].Z));
+        }
+
+        POINTonE1s_mult_w5(out, NULL, 2, scalars, 128, table);
+        POINTonE1_cneg(out, 1);
+        mul_fp(out->Z, out->Z, beta);
+        mul_fp(out->Z, out->Z, beta);
+    }
+
+    vec_zero(val.l, sizeof(val));   /* scrub the copy of SK */
+}
+
+static void POINTonE1_sign(POINTonE1 *out, const POINTonE1 *in, const pow256 SK)
+{
+    vec384 Z, ZZ;
+    limb_t inf;
+
+    POINTonE1_mult_glv(out, in, SK);
+
+    /* convert to affine to remove possible bias in out->Z */
+    inf = vec_is_zero(out->Z, sizeof(out->Z));
+#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+    flt_reciprocal_fp(Z, out->Z);                       /* 1/Z   */
+#else
+    reciprocal_fp(Z, out->Z);                           /* 1/Z   */
+#endif
+
+    sqr_fp(ZZ, Z);
+    mul_fp(out->X, out->X, ZZ);                         /* X = X/Z^2 */
+
+    mul_fp(ZZ, ZZ, Z);
+    mul_fp(out->Y, out->Y, ZZ);                         /* Y = Y/Z^3 */
+
+    vec_select(out->Z, out->Z, BLS12_381_G1.Z, sizeof(BLS12_381_G1.Z),
+                       inf);                            /* Z = inf ? 0 : 1 */
+}
+
+void blst_sk_to_pk_in_g1(POINTonE1 *out, const pow256 SK)
+{   POINTonE1_sign(out, &BLS12_381_G1, SK);   }
+
+void blst_sign_pk_in_g2(POINTonE1 *out, const POINTonE1 *msg, const pow256 SK)
+{   POINTonE1_sign(out, msg, SK);   }
+
+void blst_sk_to_pk2_in_g1(unsigned char out[96], POINTonE1_affine *PK,
+                          const pow256 SK)
+{
+    POINTonE1 P[1];
+
+    POINTonE1_sign(P, &BLS12_381_G1, SK);
+    if (PK != NULL)
+        vec_copy(PK, P, sizeof(*PK));
+    if (out != NULL) {
+        limb_t sgn0_pty = POINTonE1_Serialize_BE(out, P);
+        out[0] |= (sgn0_pty & 2) << 4;      /* pre-decorate */
+        out[0] |= vec_is_zero(P->Z, sizeof(P->Z)) << 6;
+    }
+}
+
+void blst_sign_pk2_in_g2(unsigned char out[96], POINTonE1_affine *sig,
+                         const POINTonE1 *hash, const pow256 SK)
+{
+    POINTonE1 P[1];
+
+    POINTonE1_sign(P, hash, SK);
+    if (sig != NULL)
+        vec_copy(sig, P, sizeof(*sig));
+    if (out != NULL) {
+        limb_t sgn0_pty = POINTonE1_Serialize_BE(out, P);
+        out[0] |= (sgn0_pty & 2) << 4;      /* pre-decorate */
+        out[0] |= vec_is_zero(P->Z, sizeof(P->Z)) << 6;
+    }
+}
+
+void blst_p1_mult(POINTonE1 *out, const POINTonE1 *a,
+                                  const byte *scalar, size_t nbits)
+{
+    if (nbits < 176) {
+        if (nbits)
+            POINTonE1_mult_w4(out, a, scalar, nbits);
+        else
+            vec_zero(out, sizeof(*out));
+    } else if (nbits <= 256) {
+        union { vec256 l; pow256 s; } val;
+        size_t i, j, top, mask = (size_t)0 - 1;
+
+        /* this is not about constant-time-ness, but branch optimization */
+        for (top = (nbits + 7)/8, i=0, j=0; i<sizeof(val.s);) {
+            val.s[i++] = scalar[j] & mask;
+            mask = 0 - ((i - top) >> (8*sizeof(top)-1));
+            j += 1 & mask;
+        }
+
+        if (check_mod_256(val.s, BLS12_381_r))  /* z^4 is the formal limit */
+            POINTonE1_mult_glv(out, a, val.s);
+        else    /* should never be the case, added for formal completeness */
+            POINTonE1_mult_w5(out, a, scalar, nbits);
+
+        vec_zero(val.l, sizeof(val));
+    } else {    /* should never be the case, added for formal completeness */
+        POINTonE1_mult_w5(out, a, scalar, nbits);
+    }
+}
+
+void blst_p1_unchecked_mult(POINTonE1 *out, const POINTonE1 *a,
+                                            const byte *scalar, size_t nbits)
+{
+    if (nbits)
+        POINTonE1_mult_w4(out, a, scalar, nbits);
+    else
+        vec_zero(out, sizeof(*out));
+}
+
+int blst_p1_affine_is_equal(const POINTonE1_affine *a,
+                            const POINTonE1_affine *b)
+{   return (int)vec_is_equal(a, b, sizeof(*a));   }
+
+int blst_p1_is_inf(const POINTonE1 *p)
+{   return (int)vec_is_zero(p->Z, sizeof(p->Z));   }
+
+const POINTonE1 *blst_p1_generator(void)
+{   return &BLS12_381_G1;   }
+
+int blst_p1_affine_is_inf(const POINTonE1_affine *p)
+{   return (int)vec_is_zero(p, sizeof(*p));   }
+
+const POINTonE1_affine *blst_p1_affine_generator(void)
+{   return (const POINTonE1_affine *)&BLS12_381_G1;   }
+
+size_t blst_p1_sizeof(void)
+{   return sizeof(POINTonE1);   }
+
+size_t blst_p1_affine_sizeof(void)
+{   return sizeof(POINTonE1_affine);   }
diff --git a/vendor/external/blst/src/e2.c b/vendor/external/blst/src/e2.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/e2.c
@@ -0,0 +1,638 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "point.h"
+#include "fields.h"
+#include "errors.h"
+
+/*
+ * y^2 = x^3 + B
+ */
+static const vec384x B_E2 = {       /* 4 + 4*i */
+  { TO_LIMB_T(0xaa270000000cfff3), TO_LIMB_T(0x53cc0032fc34000a),
+    TO_LIMB_T(0x478fe97a6b0a807f), TO_LIMB_T(0xb1d37ebee6ba24d7),
+    TO_LIMB_T(0x8ec9733bbf78ab2f), TO_LIMB_T(0x09d645513d83de7e) },
+  { TO_LIMB_T(0xaa270000000cfff3), TO_LIMB_T(0x53cc0032fc34000a),
+    TO_LIMB_T(0x478fe97a6b0a807f), TO_LIMB_T(0xb1d37ebee6ba24d7),
+    TO_LIMB_T(0x8ec9733bbf78ab2f), TO_LIMB_T(0x09d645513d83de7e) }
+};
+
+const POINTonE2 BLS12_381_G2 = {    /* generator point [in Montgomery] */
+{ /* (0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02
+        b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8 << 384) % P */
+  { TO_LIMB_T(0xf5f28fa202940a10), TO_LIMB_T(0xb3f5fb2687b4961a),
+    TO_LIMB_T(0xa1a893b53e2ae580), TO_LIMB_T(0x9894999d1a3caee9),
+    TO_LIMB_T(0x6f67b7631863366b), TO_LIMB_T(0x058191924350bcd7) },
+  /* (0x13e02b6052719f607dacd3a088274f65596bd0d09920b61a
+        b5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e << 384) % P */
+  { TO_LIMB_T(0xa5a9c0759e23f606), TO_LIMB_T(0xaaa0c59dbccd60c3),
+    TO_LIMB_T(0x3bb17e18e2867806), TO_LIMB_T(0x1b1ab6cc8541b367),
+    TO_LIMB_T(0xc2b6ed0ef2158547), TO_LIMB_T(0x11922a097360edf3) }
+},
+{ /* (0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a7
+        6d429a695160d12c923ac9cc3baca289e193548608b82801 << 384) % P */
+  { TO_LIMB_T(0x4c730af860494c4a), TO_LIMB_T(0x597cfa1f5e369c5a),
+    TO_LIMB_T(0xe7e6856caa0a635a), TO_LIMB_T(0xbbefb5e96e0d495f),
+    TO_LIMB_T(0x07d3a975f0ef25a2), TO_LIMB_T(0x0083fd8e7e80dae5) },
+  /* (0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af
+        267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be << 384) % P */
+  { TO_LIMB_T(0xadc0fc92df64b05d), TO_LIMB_T(0x18aa270a2b1461dc),
+    TO_LIMB_T(0x86adac6a3be4eba0), TO_LIMB_T(0x79495c4ec93da33a),
+    TO_LIMB_T(0xe7175850a43ccaed), TO_LIMB_T(0x0b2bc2a163de1bf2) },
+},
+{ { ONE_MONT_P }, { 0 } }
+};
+
+const POINTonE2 BLS12_381_NEG_G2 = { /* negative generator [in Montgomery] */
+{ /* (0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02
+        b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8 << 384) % P */
+  { TO_LIMB_T(0xf5f28fa202940a10), TO_LIMB_T(0xb3f5fb2687b4961a),
+    TO_LIMB_T(0xa1a893b53e2ae580), TO_LIMB_T(0x9894999d1a3caee9),
+    TO_LIMB_T(0x6f67b7631863366b), TO_LIMB_T(0x058191924350bcd7) },
+  /* (0x13e02b6052719f607dacd3a088274f65596bd0d09920b61a
+        b5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e << 384) % P */
+  { TO_LIMB_T(0xa5a9c0759e23f606), TO_LIMB_T(0xaaa0c59dbccd60c3),
+    TO_LIMB_T(0x3bb17e18e2867806), TO_LIMB_T(0x1b1ab6cc8541b367),
+    TO_LIMB_T(0xc2b6ed0ef2158547), TO_LIMB_T(0x11922a097360edf3) }
+},
+{ /* (0x0d1b3cc2c7027888be51d9ef691d77bcb679afda66c73f17
+        f9ee3837a55024f78c71363275a75d75d86bab79f74782aa << 384) % P */
+  { TO_LIMB_T(0x6d8bf5079fb65e61), TO_LIMB_T(0xc52f05df531d63a5),
+    TO_LIMB_T(0x7f4a4d344ca692c9), TO_LIMB_T(0xa887959b8577c95f),
+    TO_LIMB_T(0x4347fe40525c8734), TO_LIMB_T(0x197d145bbaff0bb5) },
+  /* (0x13fa4d4a0ad8b1ce186ed5061789213d993923066dddaf10
+        40bc3ff59f825c78df74f2d75467e25e0f55f8a00fa030ed << 384) % P */
+  { TO_LIMB_T(0x0c3e036d209afa4e), TO_LIMB_T(0x0601d8f4863f9e23),
+    TO_LIMB_T(0xe0832636bacc0a84), TO_LIMB_T(0xeb2def362a476f84),
+    TO_LIMB_T(0x64044f659f0ee1e9), TO_LIMB_T(0x0ed54f48d5a1caa7) }
+},
+{ { ONE_MONT_P }, { 0 } }
+};
+
+static void mul_by_b_onE2(vec384x out, const vec384x in)
+{
+    sub_fp(out[0], in[0], in[1]);
+    add_fp(out[1], in[0], in[1]);
+    lshift_fp(out[0], out[0], 2);
+    lshift_fp(out[1], out[1], 2);
+}
+
+static void mul_by_4b_onE2(vec384x out, const vec384x in)
+{
+    sub_fp(out[0], in[0], in[1]);
+    add_fp(out[1], in[0], in[1]);
+    lshift_fp(out[0], out[0], 4);
+    lshift_fp(out[1], out[1], 4);
+}
+
+static void POINTonE2_cneg(POINTonE2 *p, bool_t cbit)
+{   cneg_fp2(p->Y, p->Y, cbit);   }
+
+void blst_p2_cneg(POINTonE2 *a, int cbit)
+{   POINTonE2_cneg(a, is_zero(cbit) ^ 1);   }
+
+static void POINTonE2_from_Jacobian(POINTonE2 *out, const POINTonE2 *in)
+{
+    vec384x Z, ZZ;
+    limb_t inf = vec_is_zero(in->Z, sizeof(in->Z));
+
+    reciprocal_fp2(Z, in->Z);                           /* 1/Z */
+
+    sqr_fp2(ZZ, Z);
+    mul_fp2(out->X, in->X, ZZ);                         /* X = X/Z^2 */
+
+    mul_fp2(ZZ, ZZ, Z);
+    mul_fp2(out->Y, in->Y, ZZ);                         /* Y = Y/Z^3 */
+
+    vec_select(out->Z, in->Z, BLS12_381_G2.Z,
+                       sizeof(BLS12_381_G2.Z), inf);    /* Z = inf ? 0 : 1 */
+}
+
+void blst_p2_from_jacobian(POINTonE2 *out, const POINTonE2 *a)
+{   POINTonE2_from_Jacobian(out, a);   }
+
+static void POINTonE2_to_affine(POINTonE2_affine *out, const POINTonE2 *in)
+{
+    POINTonE2 p;
+
+    if (!vec_is_equal(in->Z, BLS12_381_Rx.p2, sizeof(in->Z))) {
+        POINTonE2_from_Jacobian(&p, in);
+        in = &p;
+    }
+    vec_copy(out, in, sizeof(*out));
+}
+
+void blst_p2_to_affine(POINTonE2_affine *out, const POINTonE2 *a)
+{   POINTonE2_to_affine(out, a);   }
+
+void blst_p2_from_affine(POINTonE2 *out, const POINTonE2_affine *a)
+{
+    vec_copy(out, a, sizeof(*a));
+    vec_select(out->Z, a->X, BLS12_381_Rx.p2, sizeof(out->Z),
+                       vec_is_zero(a, sizeof(*a)));
+}
+
+static bool_t POINTonE2_affine_on_curve(const POINTonE2_affine *p)
+{
+    vec384x XXX, YY;
+
+    sqr_fp2(XXX, p->X);
+    mul_fp2(XXX, XXX, p->X);                            /* X^3 */
+    add_fp2(XXX, XXX, B_E2);                            /* X^3 + B */
+
+    sqr_fp2(YY, p->Y);                                  /* Y^2 */
+
+    return vec_is_equal(XXX, YY, sizeof(XXX));
+}
+
+int blst_p2_affine_on_curve(const POINTonE2_affine *p)
+{   return (int)(POINTonE2_affine_on_curve(p) | vec_is_zero(p, sizeof(*p)));   }
+
+static bool_t POINTonE2_on_curve(const POINTonE2 *p)
+{
+    vec384x XXX, YY, BZ6;
+    limb_t inf = vec_is_zero(p->Z, sizeof(p->Z));
+
+    sqr_fp2(BZ6, p->Z);
+    mul_fp2(BZ6, BZ6, p->Z);
+    sqr_fp2(XXX, BZ6);                                  /* Z^6 */
+    mul_by_b_onE2(BZ6, XXX);                            /* B*Z^6 */
+
+    sqr_fp2(XXX, p->X);
+    mul_fp2(XXX, XXX, p->X);                            /* X^3 */
+    add_fp2(XXX, XXX, BZ6);                             /* X^3 + B*Z^6 */
+
+    sqr_fp2(YY, p->Y);                                  /* Y^2 */
+
+    return vec_is_equal(XXX, YY, sizeof(XXX)) | inf;
+}
+
+int blst_p2_on_curve(const POINTonE2 *p)
+{   return (int)POINTonE2_on_curve(p);   }
+
+static limb_t POINTonE2_affine_Serialize_BE(unsigned char out[192],
+                                            const POINTonE2_affine *in)
+{
+    vec384x temp;
+
+    from_fp(temp[1], in->X[1]);
+    be_bytes_from_limbs(out, temp[1], sizeof(temp[1]));
+    from_fp(temp[0], in->X[0]);
+    be_bytes_from_limbs(out + 48, temp[0], sizeof(temp[0]));
+
+    from_fp(temp[1], in->Y[1]);
+    be_bytes_from_limbs(out + 96, temp[1], sizeof(temp[1]));
+    from_fp(temp[0], in->Y[0]);
+    be_bytes_from_limbs(out + 144, temp[0], sizeof(temp[0]));
+
+    return sgn0_pty_mod_384x(temp, BLS12_381_P);
+}
+
+void blst_p2_affine_serialize(unsigned char out[192],
+                              const POINTonE2_affine *in)
+{
+    if (vec_is_zero(in->X, 2*sizeof(in->X))) {
+        bytes_zero(out, 192);
+        out[0] = 0x40;    /* infinity bit */
+    } else {
+        (void)POINTonE2_affine_Serialize_BE(out, in);
+    }
+}
+
+static limb_t POINTonE2_Serialize_BE(unsigned char out[192],
+                                     const POINTonE2 *in)
+{
+    POINTonE2 p;
+
+    if (!vec_is_equal(in->Z, BLS12_381_Rx.p2, sizeof(in->Z))) {
+        POINTonE2_from_Jacobian(&p, in);
+        in = &p;
+    }
+
+    return POINTonE2_affine_Serialize_BE(out, (const POINTonE2_affine *)in);
+}
+
+static void POINTonE2_Serialize(unsigned char out[192], const POINTonE2 *in)
+{
+    if (vec_is_zero(in->Z, sizeof(in->Z))) {
+        bytes_zero(out, 192);
+        out[0] = 0x40;    /* infinity bit */
+    } else {
+        (void)POINTonE2_Serialize_BE(out, in);
+    }
+}
+
+void blst_p2_serialize(unsigned char out[192], const POINTonE2 *in)
+{   POINTonE2_Serialize(out, in);   }
+
+static limb_t POINTonE2_affine_Compress_BE(unsigned char out[96],
+                                           const POINTonE2_affine *in)
+{
+    vec384 temp;
+
+    from_fp(temp, in->X[1]);
+    be_bytes_from_limbs(out, temp, sizeof(temp));
+    from_fp(temp, in->X[0]);
+    be_bytes_from_limbs(out + 48, temp, sizeof(temp));
+
+    return sgn0_pty_mont_384x(in->Y, BLS12_381_P, p0);
+}
+
+void blst_p2_affine_compress(unsigned char out[96], const POINTonE2_affine *in)
+{
+    if (vec_is_zero(in->X, 2*sizeof(in->X))) {
+        bytes_zero(out, 96);
+        out[0] = 0xc0;    /* compressed and infinity bits */
+    } else {
+        limb_t sign = POINTonE2_affine_Compress_BE(out, in);
+        out[0] |= (unsigned char)(0x80 | ((sign & 2) << 4));
+    }
+}
+
+static limb_t POINTonE2_Compress_BE(unsigned char out[96],
+                                    const POINTonE2 *in)
+{
+    POINTonE2 p;
+
+    if (!vec_is_equal(in->Z, BLS12_381_Rx.p, sizeof(in->Z))) {
+        POINTonE2_from_Jacobian(&p, in);
+        in = &p;
+    }
+
+    return POINTonE2_affine_Compress_BE(out, (const POINTonE2_affine *)in);
+}
+
+void blst_p2_compress(unsigned char out[96], const POINTonE2 *in)
+{
+    if (vec_is_zero(in->Z, sizeof(in->Z))) {
+        bytes_zero(out, 96);
+        out[0] = 0xc0;    /* compressed and infinity bits */
+    } else {
+        limb_t sign = POINTonE2_Compress_BE(out, in);
+        out[0] |= (unsigned char)(0x80 | ((sign & 2) << 4));
+    }
+}
+
+static limb_t POINTonE2_Uncompress_BE(POINTonE2_affine *out,
+                                      const unsigned char in[96])
+{
+    POINTonE2_affine ret;
+    vec384 temp;
+
+    limbs_from_be_bytes(ret.X[1], in, sizeof(ret.X[1]));
+    limbs_from_be_bytes(ret.X[0], in + 48, sizeof(ret.X[0]));
+
+    /* clear top 3 bits in case caller was conveying some information there */
+    ret.X[1][sizeof(ret.X[1])/sizeof(limb_t)-1] &= ((limb_t)0-1) >> 3;
+    add_fp(temp, ret.X[1], ZERO_384);  /* less than modulus? */
+    if (!vec_is_equal(temp, ret.X[1], sizeof(temp)))
+        return (limb_t)0 - BLST_BAD_ENCODING;
+
+    add_fp(temp, ret.X[0], ZERO_384);  /* less than modulus? */
+    if (!vec_is_equal(temp, ret.X[0], sizeof(temp)))
+        return (limb_t)0 - BLST_BAD_ENCODING;
+
+    mul_fp(ret.X[0], ret.X[0], BLS12_381_RR);
+    mul_fp(ret.X[1], ret.X[1], BLS12_381_RR);
+
+    sqr_fp2(ret.Y, ret.X);
+    mul_fp2(ret.Y, ret.Y, ret.X);
+    add_fp2(ret.Y, ret.Y, B_E2);                        /* X^3 + B */
+    if (!sqrt_fp2(ret.Y, ret.Y))
+        return (limb_t)0 - BLST_POINT_NOT_ON_CURVE;
+
+    vec_copy(out, &ret, sizeof(ret));
+
+    return sgn0_pty_mont_384x(out->Y, BLS12_381_P, p0);
+}
+
+static BLST_ERROR POINTonE2_Uncompress_Z(POINTonE2_affine *out,
+                                         const unsigned char in[96])
+{
+    unsigned char in0 = in[0];
+    limb_t sgn0_pty;
+
+    if ((in0 & 0x80) == 0)      /* compressed bit */
+        return BLST_BAD_ENCODING;
+
+    if (in0 & 0x40) {           /* infinity bit */
+        if (byte_is_zero(in0 & 0x3f) & bytes_are_zero(in+1, 95)) {
+            vec_zero(out, sizeof(*out));
+            return BLST_SUCCESS;
+        } else {
+            return BLST_BAD_ENCODING;
+        }
+    }
+
+    sgn0_pty = POINTonE2_Uncompress_BE(out, in);
+
+    if (sgn0_pty > 3)
+        return (BLST_ERROR)(0 - sgn0_pty); /* POINT_NOT_ON_CURVE */
+
+    sgn0_pty >>= 1; /* skip over parity bit */
+    sgn0_pty ^= (in0 & 0x20) >> 5;
+    cneg_fp2(out->Y, out->Y, sgn0_pty);
+
+    return BLST_SUCCESS;
+}
+
+BLST_ERROR blst_p2_uncompress(POINTonE2_affine *out, const unsigned char in[96])
+{   return POINTonE2_Uncompress_Z(out, in);   }
+
+static BLST_ERROR POINTonE2_Deserialize_BE(POINTonE2_affine *out,
+                                           const unsigned char in[192])
+{
+    POINTonE2_affine ret;
+    vec384 temp;
+
+    limbs_from_be_bytes(ret.X[1], in, sizeof(ret.X[1]));
+    limbs_from_be_bytes(ret.X[0], in + 48, sizeof(ret.X[0]));
+    limbs_from_be_bytes(ret.Y[1], in + 96, sizeof(ret.Y[1]));
+    limbs_from_be_bytes(ret.Y[0], in + 144, sizeof(ret.Y[0]));
+
+    /* clear top 3 bits in case caller was conveying some information there */
+    ret.X[1][sizeof(ret.X[1])/sizeof(limb_t)-1] &= ((limb_t)0-1) >> 3;
+    add_fp(temp, ret.X[1], ZERO_384);  /* less than modulus? */
+    if (!vec_is_equal(temp, ret.X[1], sizeof(temp)))
+        return BLST_BAD_ENCODING;
+
+    add_fp(temp, ret.X[0], ZERO_384);  /* less than modulus? */
+    if (!vec_is_equal(temp, ret.X[0], sizeof(temp)))
+        return BLST_BAD_ENCODING;
+
+    add_fp(temp, ret.Y[1], ZERO_384);  /* less than modulus? */
+    if (!vec_is_equal(temp, ret.Y[1], sizeof(temp)))
+        return BLST_BAD_ENCODING;
+
+    add_fp(temp, ret.Y[0], ZERO_384);  /* less than modulus? */
+    if (!vec_is_equal(temp, ret.Y[0], sizeof(temp)))
+        return BLST_BAD_ENCODING;
+
+    mul_fp(ret.X[0], ret.X[0], BLS12_381_RR);
+    mul_fp(ret.X[1], ret.X[1], BLS12_381_RR);
+    mul_fp(ret.Y[0], ret.Y[0], BLS12_381_RR);
+    mul_fp(ret.Y[1], ret.Y[1], BLS12_381_RR);
+
+    if (!POINTonE2_affine_on_curve(&ret))
+        return BLST_POINT_NOT_ON_CURVE;
+
+    vec_copy(out, &ret, sizeof(ret));
+
+    return BLST_SUCCESS;
+}
+
+static BLST_ERROR POINTonE2_Deserialize_Z(POINTonE2_affine *out,
+                                          const unsigned char in[192])
+{
+    unsigned char in0 = in[0];
+
+    if ((in0 & 0xe0) == 0)
+        return POINTonE2_Deserialize_BE(out, in);
+
+    if (in0 & 0x80)             /* compressed bit */
+        return POINTonE2_Uncompress_Z(out, in);
+
+    if (in0 & 0x40) {           /* infinity bit */
+        if (byte_is_zero(in0 & 0x3f) & bytes_are_zero(in+1, 191)) {
+            vec_zero(out, sizeof(*out));
+            return BLST_SUCCESS;
+        }
+    }
+
+    return BLST_BAD_ENCODING;
+}
+
+BLST_ERROR blst_p2_deserialize(POINTonE2_affine *out,
+                               const unsigned char in[192])
+{   return POINTonE2_Deserialize_Z(out, in);   }
+
+#include "ec_ops.h"
+POINT_DADD_IMPL(POINTonE2, 384x, fp2)
+POINT_DADD_AFFINE_IMPL_A0(POINTonE2, 384x, fp2, BLS12_381_Rx.p2)
+POINT_ADD_IMPL(POINTonE2, 384x, fp2)
+POINT_ADD_AFFINE_IMPL(POINTonE2, 384x, fp2, BLS12_381_Rx.p2)
+POINT_DOUBLE_IMPL_A0(POINTonE2, 384x, fp2)
+POINT_IS_EQUAL_IMPL(POINTonE2, 384x, fp2)
+
+void blst_p2_add(POINTonE2 *out, const POINTonE2 *a, const POINTonE2 *b)
+{   POINTonE2_add(out, a, b);   }
+
+void blst_p2_add_or_double(POINTonE2 *out, const POINTonE2 *a,
+                                           const POINTonE2 *b)
+{   POINTonE2_dadd(out, a, b, NULL);   }
+
+void blst_p2_add_affine(POINTonE2 *out, const POINTonE2 *a,
+                                        const POINTonE2_affine *b)
+{   POINTonE2_add_affine(out, a, b);   }
+
+void blst_p2_add_or_double_affine(POINTonE2 *out, const POINTonE2 *a,
+                                                  const POINTonE2_affine *b)
+{   POINTonE2_dadd_affine(out, a, b);   }
+
+void blst_p2_double(POINTonE2 *out, const POINTonE2 *a)
+{   POINTonE2_double(out, a);   }
+
+int blst_p2_is_equal(const POINTonE2 *a, const POINTonE2 *b)
+{   return (int)POINTonE2_is_equal(a, b);   }
+
+#include "ec_mult.h"
+POINT_MULT_SCALAR_WX_IMPL(POINTonE2, 4)
+POINT_MULT_SCALAR_WX_IMPL(POINTonE2, 5)
+
+#ifdef __BLST_PRIVATE_TESTMODE__
+POINT_AFFINE_MULT_SCALAR_IMPL(POINTonE2)
+
+DECLARE_PRIVATE_POINTXZ(POINTonE2, 384x)
+POINT_LADDER_PRE_IMPL(POINTonE2, 384x, fp2)
+POINT_LADDER_STEP_IMPL_A0(POINTonE2, 384x, fp2, onE2)
+POINT_LADDER_POST_IMPL_A0(POINTonE2, 384x, fp2, onE2)
+POINT_MULT_SCALAR_LADDER_IMPL(POINTonE2)
+#endif
+
+static void psi(POINTonE2 *out, const POINTonE2 *in)
+{
+    static const vec384x frobenius_x = { /* 1/(1 + i)^((P-1)/3) */
+      { 0 },
+      { /* (0x1a0111ea397fe699ec02408663d4de85aa0d857d89759ad4
+              897d29650fb85f9b409427eb4f49fffd8bfd00000000aaad << 384) % P */
+        TO_LIMB_T(0x890dc9e4867545c3), TO_LIMB_T(0x2af322533285a5d5),
+        TO_LIMB_T(0x50880866309b7e2c), TO_LIMB_T(0xa20d1b8c7e881024),
+        TO_LIMB_T(0x14e4f04fe2db9068), TO_LIMB_T(0x14e56d3f1564853a) }
+    };
+    static const vec384x frobenius_y = { /* 1/(1 + i)^((P-1)/2) */
+      { /* (0x135203e60180a68ee2e9c448d77a2cd91c3dedd930b1cf60
+              ef396489f61eb45e304466cf3e67fa0af1ee7b04121bdea2 << 384) % P */
+        TO_LIMB_T(0x3e2f585da55c9ad1), TO_LIMB_T(0x4294213d86c18183),
+        TO_LIMB_T(0x382844c88b623732), TO_LIMB_T(0x92ad2afd19103e18),
+        TO_LIMB_T(0x1d794e4fac7cf0b9), TO_LIMB_T(0x0bd592fc7d825ec8) },
+      { /* (0x06af0e0437ff400b6831e36d6bd17ffe48395dabc2d3435e
+              77f76e17009241c5ee67992f72ec05f4c81084fbede3cc09 << 384) % P */
+        TO_LIMB_T(0x7bcfa7a25aa30fda), TO_LIMB_T(0xdc17dec12a927e7c),
+        TO_LIMB_T(0x2f088dd86b4ebef1), TO_LIMB_T(0xd1ca2087da74d4a7),
+        TO_LIMB_T(0x2da2596696cebc1d), TO_LIMB_T(0x0e2b7eedbbfd87d2) },
+    };
+
+    vec_copy(out, in, sizeof(*out));
+    cneg_fp(out->X[1], out->X[1], 1);   mul_fp2(out->X, out->X, frobenius_x);
+    cneg_fp(out->Y[1], out->Y[1], 1);   mul_fp2(out->Y, out->Y, frobenius_y);
+    cneg_fp(out->Z[1], out->Z[1], 1);
+}
+
+/* Galbraith-Lin-Scott, ~67% faster than POINTonE2_mul_w5 */
+static void POINTonE2_mult_gls(POINTonE2 *out, const POINTonE2 *in,
+                               const pow256 SK)
+{
+    union { vec256 l; pow256 s; } val;
+
+    /* break down SK to "digits" with |z| as radix [in constant time] */
+
+    limbs_from_le_bytes(val.l, SK, 32);
+    div_by_zz(val.l);
+    div_by_z(val.l);
+    div_by_z(val.l + NLIMBS(256)/2);
+    le_bytes_from_limbs(val.s, val.l, 32);
+
+    {
+        const byte *scalars[2] = { val.s, NULL };
+        POINTonE2 table[4][1<<(5-1)];   /* 18KB */
+        size_t i;
+
+        POINTonE2_precompute_w5(table[0], in);
+        for (i = 0; i < 1<<(5-1); i++) {
+            psi(&table[1][i], &table[0][i]);
+            psi(&table[2][i], &table[1][i]);
+            psi(&table[3][i], &table[2][i]);
+            POINTonE2_cneg(&table[1][i], 1); /* account for z being negative */
+            POINTonE2_cneg(&table[3][i], 1);
+        }
+
+        POINTonE2s_mult_w5(out, NULL, 4, scalars, 64, table);
+    }
+
+    vec_zero(val.l, sizeof(val));   /* scrub the copy of SK */
+}
+
+static void POINTonE2_sign(POINTonE2 *out, const POINTonE2 *in, const pow256 SK)
+{
+    vec384x Z, ZZ;
+    limb_t inf;
+
+    POINTonE2_mult_gls(out, in, SK);
+
+    /* convert to affine to remove possible bias in out->Z */
+    inf = vec_is_zero(out->Z, sizeof(out->Z));
+#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+    flt_reciprocal_fp2(Z, out->Z);                      /* 1/Z   */
+#else
+    reciprocal_fp2(Z, out->Z);                          /* 1/Z   */
+#endif
+
+    sqr_fp2(ZZ, Z);
+    mul_fp2(out->X, out->X, ZZ);                        /* X = X/Z^2 */
+
+    mul_fp2(ZZ, ZZ, Z);
+    mul_fp2(out->Y, out->Y, ZZ);                        /* Y = Y/Z^3 */
+
+    vec_select(out->Z, out->Z, BLS12_381_G2.Z, sizeof(BLS12_381_G2.Z),
+                       inf);                            /* Z = inf ? 0 : 1 */
+}
+
+void blst_sk_to_pk_in_g2(POINTonE2 *out, const pow256 SK)
+{   POINTonE2_sign(out, &BLS12_381_G2, SK);   }
+
+void blst_sign_pk_in_g1(POINTonE2 *out, const POINTonE2 *msg, const pow256 SK)
+{   POINTonE2_sign(out, msg, SK);   }
+
+void blst_sk_to_pk2_in_g2(unsigned char out[192], POINTonE2_affine *PK,
+                          const pow256 SK)
+{
+    POINTonE2 P[1];
+
+    POINTonE2_sign(P, &BLS12_381_G2, SK);
+    if (PK != NULL)
+        vec_copy(PK, P, sizeof(*PK));
+    if (out != NULL) {
+        limb_t sgn0_pty = POINTonE2_Serialize_BE(out, P);
+        out[0] |= (sgn0_pty & 2) << 4;      /* pre-decorate */
+        out[0] |= vec_is_zero(P->Z, sizeof(P->Z)) << 6;
+    }
+}
+
+void blst_sign_pk2_in_g1(unsigned char out[192], POINTonE2_affine *sig,
+                         const POINTonE2 *hash, const pow256 SK)
+{
+    POINTonE2 P[1];
+
+    POINTonE2_sign(P, hash, SK);
+    if (sig != NULL)
+        vec_copy(sig, P, sizeof(*sig));
+    if (out != NULL) {
+        limb_t sgn0_pty = POINTonE2_Serialize_BE(out, P);
+        out[0] |= (sgn0_pty & 2) << 4;      /* pre-decorate */
+        out[0] |= vec_is_zero(P->Z, sizeof(P->Z)) << 6;
+    }
+}
+
+void blst_p2_mult(POINTonE2 *out, const POINTonE2 *a,
+                                  const byte *scalar, size_t nbits)
+{
+    if (nbits < 144) {
+        if (nbits)
+            POINTonE2_mult_w4(out, a, scalar, nbits);
+        else
+            vec_zero(out, sizeof(*out));
+    } else if (nbits <= 256) {
+        union { vec256 l; pow256 s; } val;
+        size_t i, j, top, mask = (size_t)0 - 1;
+
+        /* this is not about constant-time-ness, but branch optimization */
+        for (top = (nbits + 7)/8, i=0, j=0; i<sizeof(val.s);) {
+            val.s[i++] = scalar[j] & mask;
+            mask = 0 - ((i - top) >> (8*sizeof(top)-1));
+            j += 1 & mask;
+        }
+
+        if (check_mod_256(val.s, BLS12_381_r))  /* z^4 is the formal limit */
+            POINTonE2_mult_gls(out, a, val.s);
+        else    /* should never be the case, added for formal completeness */
+            POINTonE2_mult_w5(out, a, scalar, nbits);
+
+        vec_zero(val.l, sizeof(val));
+    } else {    /* should never be the case, added for formal completeness */
+        POINTonE2_mult_w5(out, a, scalar, nbits);
+    }
+}
+
+void blst_p2_unchecked_mult(POINTonE2 *out, const POINTonE2 *a,
+                                            const byte *scalar, size_t nbits)
+{
+    if (nbits)
+        POINTonE2_mult_w4(out, a, scalar, nbits);
+    else
+        vec_zero(out, sizeof(*out));
+}
+
+int blst_p2_affine_is_equal(const POINTonE2_affine *a,
+                            const POINTonE2_affine *b)
+{   return (int)vec_is_equal(a, b, sizeof(*a));   }
+
+int blst_p2_is_inf(const POINTonE2 *p)
+{   return (int)vec_is_zero(p->Z, sizeof(p->Z));   }
+
+const POINTonE2 *blst_p2_generator(void)
+{   return &BLS12_381_G2;   }
+
+int blst_p2_affine_is_inf(const POINTonE2_affine *p)
+{   return (int)vec_is_zero(p, sizeof(*p));   }
+
+const POINTonE2_affine *blst_p2_affine_generator(void)
+{   return (const POINTonE2_affine *)&BLS12_381_G2;   }
+
+size_t blst_p2_sizeof(void)
+{   return sizeof(POINTonE2);   }
+
+size_t blst_p2_affine_sizeof(void)
+{   return sizeof(POINTonE2_affine);   }
diff --git a/vendor/external/blst/src/ec_mult.h b/vendor/external/blst/src/ec_mult.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/ec_mult.h
@@ -0,0 +1,316 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __BLS12_381_ASM_EC_MULT_H__
+#define __BLS12_381_ASM_EC_MULT_H__
+
+#include "point.h"
+
+/* Works up to 9 bits */
+static limb_t get_wval(const byte *d, size_t off, size_t bits)
+{
+    size_t top = off + bits - 1;
+    limb_t ret;
+
+    ret = ((limb_t)d[top / 8] << 8) | d[off / 8];
+
+    return ret >> (off%8);
+}
+
+/* Works up to 25 bits. */
+static limb_t get_wval_limb(const byte *d, size_t off, size_t bits)
+{
+    size_t i, top = (off + bits - 1)/8;
+    limb_t ret, mask = (limb_t)0 - 1;
+
+    d   += off/8;
+    top -= off/8-1;
+
+    /* this is not about constant-time-ness, but branch optimization */
+    for (ret=0, i=0; i<4;) {
+        ret |= (*d & mask) << (8*i);
+        mask = (limb_t)0 - ((++i - top) >> (8*sizeof(top)-1));
+        d += 1 & mask;
+    }
+
+    return ret >> (off%8);
+}
+
+/*
+ * Window value encoding that utilizes the fact that -P is trivially
+ * calculated, which allows to halve the size of pre-computed table,
+ * is attributed to A. D. Booth, hence the name of the subroutines...
+ */
+static limb_t booth_encode(limb_t wval, size_t sz)
+{
+    limb_t mask = 0 - (wval >> sz);     /* "sign" bit -> mask */
+    launder(mask);
+
+    wval = (wval + 1) >> 1;
+    wval = (wval ^ mask) - mask;
+
+    /* &0x1f, but <=0x10, is index in table, rest is extended "sign" bit */
+    return wval;
+}
+
+/*
+ * Key feature of these constant-time subroutines is that they tolerate
+ * zeros in most significant bit positions of the scalar[s], or in other
+ * words, zero-padded scalar values. This means that one can and should
+ * pass order's bit-length, which is customarily publicly known, instead
+ * of the factual scalars' bit-lengths. This is facilitated by point
+ * addition subroutines implemented to handle points at infinity, which
+ * are encoded as Z==0. [Doubling algorithms handle such points at
+ * infinity "naturally," since resulting Z is product of original Z.]
+ */
+#define POINT_MULT_SCALAR_WX_IMPL(ptype, SZ) \
+static bool_t ptype##_gather_booth_w##SZ(ptype *restrict p, \
+                                         const ptype table[1<<(SZ-1)], \
+                                         limb_t booth_idx) \
+{ \
+    size_t i; \
+    bool_t booth_sign = (booth_idx >> SZ) & 1; \
+\
+    booth_idx &= (1<<SZ) - 1; \
+    vec_copy(p, table, sizeof(ptype)); \
+    /* ~6% with -Os, ~2% with -O3 ... */\
+    for (i = 2; i <= 1<<(SZ-1); i++) \
+        ptype##_ccopy(p, table + i - 1, byte_is_zero((byte)(i ^ booth_idx))); \
+\
+    ptype##_cneg(p, booth_sign); \
+\
+    return byte_is_zero((byte)booth_idx); \
+} \
+\
+static void ptype##_precompute_w##SZ(ptype row[], const ptype *point) \
+{ \
+    size_t i, j; \
+                                      /* row[-1] is implicit infinity */\
+    vec_copy(&row[0], point, sizeof(ptype));        /* row[0]=p*1     */\
+    ptype##_double(&row[1],  point);                /* row[1]=p*(1+1) */\
+    for (i = 2, j = 1; i < 1<<(SZ-1); i += 2, j++) \
+        ptype##_add(&row[i], &row[j], &row[j-1]),   /* row[2]=p*(2+1) */\
+        ptype##_double(&row[i+1], &row[j]);         /* row[3]=p*(2+2) */\
+}                                                   /* row[4] ...     */\
+\
+static void ptype##s_mult_w##SZ(ptype *ret, \
+                                const ptype *points[], size_t npoints, \
+                                const byte *scalars[], size_t bits, \
+                                ptype table[][1<<(SZ-1)]) \
+{ \
+    limb_t wmask, wval; \
+    size_t i, j, window, nbytes; \
+    const byte *scalar, **scalar_s = scalars; \
+    ptype sum[1], row[1]; \
+    bool_t sum_is_inf, row_is_inf, ret_is_inf; \
+\
+    if (table == NULL) \
+        table = (ptype (*)[1<<(SZ-1)])alloca((1<<(SZ-1)) * sizeof(ptype) * \
+                                             npoints); \
+\
+    if (points != NULL) { \
+        const ptype *point = NULL; \
+        for (i = 0; i < npoints; i++) \
+            point = *points ? *points++ : point+1, \
+            ptype##_precompute_w##SZ(table[i], point); \
+    } \
+\
+    nbytes = (bits + 7)/8; /* convert |bits| to bytes */ \
+    scalar = *scalar_s++; \
+\
+    /* top excess bits modulo target window size */ \
+    window = bits % SZ; /* yes, it may be zero */ \
+    wmask = ((limb_t)1 << (window + 1)) - 1; \
+\
+    bits -= window; \
+    if (bits > 0) \
+        wval = get_wval(scalar, bits - 1, window + 1) & wmask; \
+    else \
+        wval = (scalar[0] << 1) & wmask; \
+\
+    wval = booth_encode(wval, SZ); \
+    ret_is_inf = ptype##_gather_booth_w##SZ(ret, table[0], wval); \
+\
+    i = 1; \
+    while (bits > 0) { \
+        for (; i < npoints; i++) { \
+            scalar = *scalar_s ? *scalar_s++ : scalar+nbytes; \
+            wval = get_wval(scalar, bits - 1, window + 1) & wmask; \
+            wval = booth_encode(wval, SZ); \
+            row_is_inf = ptype##_gather_booth_w##SZ(row, table[i], wval); \
+            ptype##_dadd(sum, ret, row, NULL); \
+            ptype##_ccopy(ret, sum, (ret_is_inf | row_is_inf) ^ 1); \
+            sum_is_inf = vec_is_zero(ret->Z, sizeof(ret->Z)); \
+            ret_is_inf |= sum_is_inf; \
+            row_is_inf |= sum_is_inf; \
+            ptype##_ccopy(ret, row, ret_is_inf); \
+            ret_is_inf &= row_is_inf; \
+        } \
+\
+        for (j = 0; j < SZ; j++) \
+            ptype##_double(ret, ret); \
+\
+        window = SZ; \
+        wmask = ((limb_t)1 << (window + 1)) - 1; \
+        bits -= window; \
+        i = 0; scalar_s = scalars; \
+    } \
+\
+    for (; i < npoints; i++) { \
+        scalar = *scalar_s ? *scalar_s++ : scalar+nbytes; \
+        wval = (scalar[0] << 1) & wmask; \
+        wval = booth_encode(wval, SZ); \
+        row_is_inf = ptype##_gather_booth_w##SZ(row, table[i], wval); \
+        ptype##_dadd(sum, ret, row, NULL); \
+        ptype##_ccopy(ret, sum, (ret_is_inf | row_is_inf) ^ 1); \
+        sum_is_inf = vec_is_zero(ret->Z, sizeof(ret->Z)); \
+        ret_is_inf |= sum_is_inf; \
+        row_is_inf |= sum_is_inf; \
+        ptype##_ccopy(ret, row, ret_is_inf); \
+        ret_is_inf &= row_is_inf; \
+    } \
+\
+    vec_czero(ret->Z, sizeof(ret->Z), ret_is_inf); \
+} \
+\
+static void ptype##_mult_w##SZ(ptype *ret, const ptype *point, \
+                               const byte *scalar, size_t bits) \
+{ \
+    limb_t wmask, wval; \
+    size_t j, window; \
+    ptype sum[1], row[1]; \
+    bool_t sum_is_inf, row_is_inf, ret_is_inf; \
+    ptype table[1<<(SZ-1)]; \
+\
+    ptype##_precompute_w##SZ(table, point); \
+\
+    /* top excess bits modulo target window size */ \
+    window = bits % SZ;  /* yes, it may be zero */ \
+    wmask = ((limb_t)1 << (window + 1)) - 1; \
+\
+    bits -= window; \
+    wval = bits ? get_wval(scalar, bits - 1, window + 1) \
+                : (limb_t)scalar[0] << 1; \
+    wval &= wmask; \
+    wval = booth_encode(wval, SZ); \
+    ret_is_inf = ptype##_gather_booth_w##SZ(ret, table, wval); \
+\
+    while (bits > 0) { \
+        for (j = 0; j < SZ; j++) \
+            ptype##_double(ret, ret); \
+\
+        window = SZ; \
+        wmask = ((limb_t)1 << (window + 1)) - 1; \
+        bits -= window; \
+\
+        wval = bits ? get_wval(scalar, bits - 1, window + 1) \
+                    : (limb_t)scalar[0] << 1; \
+        wval &= wmask; \
+        wval = booth_encode(wval, SZ); \
+        row_is_inf = ptype##_gather_booth_w##SZ(row, table, wval); \
+        if (bits > 0) ptype##_add(sum, ret, row); \
+        else          ptype##_dadd(sum, ret, row, NULL); \
+        ptype##_ccopy(ret, sum, (ret_is_inf | row_is_inf) ^ 1); \
+        sum_is_inf = vec_is_zero(ret->Z, sizeof(ret->Z)); \
+        ret_is_inf |= sum_is_inf; \
+        row_is_inf |= sum_is_inf; \
+        ptype##_ccopy(ret, row, ret_is_inf); \
+        ret_is_inf &= row_is_inf; \
+    } \
+\
+    vec_czero(ret->Z, sizeof(ret->Z), ret_is_inf); \
+}
+
+#if 0
+/* ~50%, or ~2x[!] slower than w5... */
+#define POINT_MULT_SCALAR_LADDER_IMPL(ptype) \
+static void ptype##_mult_ladder(ptype *ret, const ptype *p, \
+                                const byte *scalar, size_t bits) \
+{ \
+    ptype sum[1]; \
+    bool_t bit, pbit = 0; \
+\
+    vec_copy(sum, p, sizeof(ptype)); \
+    vec_zero(ret, sizeof(ptype));   /* infinity */ \
+\
+    while (bits--) { \
+        bit = is_bit_set(scalar, bits); \
+        bit ^= pbit; \
+        ptype##_cswap(ret, sum, bit); \
+        ptype##_add(sum, sum, ret); \
+        ptype##_double(ret, ret); \
+        pbit ^= bit; \
+    } \
+    ptype##_cswap(ret, sum, pbit); \
+}
+#else
+/* >40% better performance than above, [and ~30% slower than w5]... */
+#define POINT_MULT_SCALAR_LADDER_IMPL(ptype) \
+static void ptype##_mult_ladder(ptype *out, const ptype *p, \
+                                const byte *scalar, size_t bits) \
+{ \
+    ptype##xz sum[1]; \
+    ptype##xz pxz[1]; \
+    ptype##xz ret[1]; \
+    bool_t bit, pbit = 0; \
+\
+    ptype##xz_ladder_pre(pxz, p); \
+    vec_copy(sum, pxz, sizeof(ptype##xz)); \
+    vec_zero(ret, sizeof(ptype##xz));   /* infinity */ \
+\
+    while (bits--) { \
+        bit = is_bit_set(scalar, bits); \
+        bit ^= pbit; \
+        ptype##xz_cswap(ret, sum, bit); \
+        ptype##xz_ladder_step(ret, sum, pxz); \
+        pbit ^= bit; \
+    } \
+    ptype##xz_cswap(ret, sum, pbit); \
+    ptype##xz_ladder_post(out, ret, sum, pxz, p->Y); \
+}
+#endif
+
+/*
+ * Sole reason for existence of this implementation is that addition
+ * with affine point renders a share of multiplications redundant by
+ * virtue of Z==1. And since pre-defined generator point can be and
+ * customarily is instantiated affine, it would be hardly appropriate
+ * to pass on this opportunity. Though while it's faster than the
+ * generic ladder implementation, by ~25%, it's not faster than XZ one
+ * above, <15% slower. Just in case, it's faster than generic ladder
+ * even if one accounts for prior conversion to affine coordinates,
+ * so that choice [for resource-constrained case] is actually between
+ * this plus said conversion and XZ ladder...
+ *
+ * To summarize, if ptype##_mult_w5 executed in one unit of time, then
+ * - naive ptype##_mult_ladder would execute in ~2;
+ * - XZ version above - in ~1.4;
+ * - ptype##_affine_mult_ladder below - in ~1.65;
+ * - [small-footprint ptype##_to_affine would run in ~0.18].
+ *
+ * Caveat lector, |p_affine|*(order+2) produces wrong result, because
+ * addition doesn't handle doubling. Indeed, P*(order+1) is P and it
+ * fails to add with itself producing infinity in last addition. But
+ * as long as |scalar| is reduced modulo order, as it should be, it's
+ * not a problem...
+ */
+#define POINT_AFFINE_MULT_SCALAR_IMPL(ptype) \
+static void ptype##_affine_mult_ladder(ptype *ret, \
+                                       const ptype##_affine *p_affine, \
+                                       const byte *scalar, size_t bits) \
+{ \
+    ptype sum[1]; \
+    bool_t bit; \
+\
+    vec_zero(ret, sizeof(ptype));   /* infinity */ \
+\
+    while (bits--) { \
+        ptype##_double(ret, ret); \
+        ptype##_add_affine(sum, ret, p_affine); \
+        bit = (scalar[bits / LIMB_T_BITS] >> (bits % LIMB_T_BITS)) & 1; \
+        ptype##_ccopy(ret, sum, bit); \
+    } \
+}
+#endif
diff --git a/vendor/external/blst/src/ec_ops.h b/vendor/external/blst/src/ec_ops.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/ec_ops.h
@@ -0,0 +1,787 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __BLS12_384_ASM_EC_OPS_H__
+#define __BLS12_384_ASM_EC_OPS_H__
+/*
+ * Addition that can handle doubling [as well as points at infinity,
+ * which are encoded as Z==0] in constant time. It naturally comes at
+ * cost, but this subroutine should be called only when independent
+ * points are processed, which is considered reasonable compromise.
+ * For example, ptype##s_mult_w5 calls it, but since *major* gain is
+ * result of pure doublings being effectively divided by amount of
+ * points, slightly slower addition can be tolerated. But what is the
+ * additional cost more specifically? Best addition result is 11M+5S,
+ * while this routine takes 13M+5S (+1M+1S if a4!=0), as per
+ *
+ * -------------+-------------
+ * addition     | doubling
+ * -------------+-------------
+ * U1 = X1*Z2^2 | U1 = X1
+ * U2 = X2*Z1^2 |
+ * S1 = Y1*Z2^3 | S1 = Y1
+ * S2 = Y2*Z1^3 |
+ * zz = Z1*Z2   | zz = Z1
+ * H = U2-U1    | H' = 2*Y1
+ * R = S2-S1    | R' = 3*X1^2[+a*Z1^4]
+ * sx = U1+U2   | sx = X1+X1
+ * -------------+-------------
+ * H!=0 || R!=0 | H==0 && R==0
+ *
+ *      X3 = R^2-H^2*sx
+ *      Y3 = R*(H^2*U1-X3)-H^3*S1
+ *      Z3 = H*zz
+ *
+ * As for R!=0 condition in context of H==0, a.k.a. P-P. The result is
+ * infinity by virtue of Z3 = (U2-U1)*zz = H*zz = 0*zz == 0.
+ */
+#define POINT_DADD_IMPL(ptype, bits, field) \
+static void ptype##_dadd(ptype *out, const ptype *p1, const ptype *p2, \
+                         const vec##bits a4) \
+{ \
+    ptype p3; /* starts as (U1, S1, zz) from addition side */\
+    struct { vec##bits H, R, sx; } add, dbl; \
+    bool_t p1inf, p2inf, is_dbl; \
+\
+    add_##field(dbl.sx, p1->X, p1->X);  /* sx = X1+X1 */\
+    sqr_##field(dbl.R, p1->X);          /* X1^2 */\
+    mul_by_3_##field(dbl.R, dbl.R);     /* R = 3*X1^2 */\
+    add_##field(dbl.H, p1->Y, p1->Y);   /* H = 2*Y1 */\
+\
+    p2inf = vec_is_zero(p2->Z, sizeof(p2->Z)); \
+    sqr_##field(p3.X, p2->Z);           /* Z2^2 */\
+    mul_##field(p3.Z, p1->Z, p2->Z);    /* Z1*Z2 */\
+    p1inf = vec_is_zero(p1->Z, sizeof(p1->Z)); \
+    sqr_##field(add.H, p1->Z);          /* Z1^2 */\
+\
+    if (a4 != NULL) { \
+        sqr_##field(p3.Y, add.H);       /* Z1^4, [borrow p3.Y] */\
+        mul_##field(p3.Y, p3.Y, a4);    \
+        add_##field(dbl.R, dbl.R, p3.Y);/* R = 3*X1^2+a*Z1^4 */\
+    } \
+\
+    mul_##field(p3.Y, p1->Y, p2->Z);    \
+    mul_##field(p3.Y, p3.Y, p3.X);      /* S1 = Y1*Z2^3 */\
+    mul_##field(add.R, p2->Y, p1->Z);   \
+    mul_##field(add.R, add.R, add.H);   /* S2 = Y2*Z1^3 */\
+    sub_##field(add.R, add.R, p3.Y);    /* R = S2-S1 */\
+\
+    mul_##field(p3.X, p3.X, p1->X);     /* U1 = X1*Z2^2 */\
+    mul_##field(add.H, add.H, p2->X);   /* U2 = X2*Z1^2 */\
+\
+    add_##field(add.sx, add.H, p3.X);   /* sx = U1+U2 */\
+    sub_##field(add.H, add.H, p3.X);    /* H = U2-U1 */\
+\
+    /* make the choice between addition and doubling */\
+    is_dbl = vec_is_zero(add.H, 2*sizeof(add.H));      \
+    vec_select(&p3, p1, &p3, sizeof(p3), is_dbl);      \
+    vec_select(&add, &dbl, &add, sizeof(add), is_dbl); \
+    /* |p3| and |add| hold all inputs now, |p3| will hold output */\
+\
+    mul_##field(p3.Z, p3.Z, add.H);     /* Z3 = H*Z1*Z2 */\
+\
+    sqr_##field(dbl.H, add.H);          /* H^2 */\
+    mul_##field(dbl.R, dbl.H, add.H);   /* H^3 */\
+    mul_##field(dbl.R, dbl.R, p3.Y);    /* H^3*S1 */\
+    mul_##field(p3.Y, dbl.H, p3.X);     /* H^2*U1 */\
+\
+    mul_##field(dbl.H, dbl.H, add.sx);  /* H^2*sx */\
+    sqr_##field(p3.X, add.R);           /* R^2 */\
+    sub_##field(p3.X, p3.X, dbl.H);     /* X3 = R^2-H^2*sx */\
+\
+    sub_##field(p3.Y, p3.Y, p3.X);      /* H^2*U1-X3 */\
+    mul_##field(p3.Y, p3.Y, add.R);     /* R*(H^2*U1-X3) */\
+    sub_##field(p3.Y, p3.Y, dbl.R);     /* Y3 = R*(H^2*U1-X3)-H^3*S1 */\
+\
+    vec_select(&p3, p1, &p3, sizeof(ptype), p2inf); \
+    vec_select(out, p2, &p3, sizeof(ptype), p1inf); \
+}
+
+/*
+ * Addition with affine point that can handle doubling [as well as
+ * points at infinity, with |p1| being encoded as Z==0 and |p2| as
+ * X,Y==0] in constant time. But at what additional cost? Best
+ * addition result is 7M+4S, while this routine takes 8M+5S, as per
+ *
+ * -------------+-------------
+ * addition     | doubling
+ * -------------+-------------
+ * U1 = X1      | U1 = X2
+ * U2 = X2*Z1^2 |
+ * S1 = Y1      | S1 = Y2
+ * S2 = Y2*Z1^3 |
+ * H = U2-X1    | H' = 2*Y2
+ * R = S2-Y1    | R' = 3*X2^2[+a]
+ * sx = X1+U2   | sx = X2+X2
+ * zz = H*Z1    | zz = H'
+ * -------------+-------------
+ * H!=0 || R!=0 | H==0 && R==0
+ *
+ *      X3 = R^2-H^2*sx
+ *      Y3 = R*(H^2*U1-X3)-H^3*S1
+ *      Z3 = zz
+ *
+ * As for R!=0 condition in context of H==0, a.k.a. P-P. The result is
+ * infinity by virtue of Z3 = (U2-U1)*zz = H*zz = 0*zz == 0.
+ */
+#define POINT_DADD_AFFINE_IMPL_A0(ptype, bits, field, one) \
+static void ptype##_dadd_affine(ptype *out, const ptype *p1, \
+                                            const ptype##_affine *p2) \
+{ \
+    ptype p3; /* starts as (,, H*Z1) from addition side */\
+    struct { vec##bits H, R, sx; } add, dbl; \
+    bool_t p1inf, p2inf, is_dbl; \
+\
+    p2inf = vec_is_zero(p2->X, 2*sizeof(p2->X)); \
+    add_##field(dbl.sx, p2->X, p2->X);  /* sx = X2+X2 */\
+    sqr_##field(dbl.R, p2->X);          /* X2^2 */\
+    mul_by_3_##field(dbl.R, dbl.R);     /* R = 3*X2^2 */\
+    add_##field(dbl.H, p2->Y, p2->Y);   /* H = 2*Y2 */\
+\
+    p1inf = vec_is_zero(p1->Z, sizeof(p1->Z)); \
+    sqr_##field(add.H, p1->Z);          /* Z1^2 */\
+    mul_##field(add.R, add.H, p1->Z);   /* Z1^3 */\
+    mul_##field(add.R, add.R, p2->Y);   /* S2 = Y2*Z1^3 */\
+    sub_##field(add.R, add.R, p1->Y);   /* R = S2-Y1 */\
+\
+    mul_##field(add.H, add.H, p2->X);   /* U2 = X2*Z1^2 */\
+\
+    add_##field(add.sx, add.H, p1->X);  /* sx = X1+U2 */\
+    sub_##field(add.H, add.H, p1->X);   /* H = U2-X1 */\
+\
+    mul_##field(p3.Z, add.H, p1->Z);    /* Z3 = H*Z1 */\
+\
+    /* make the choice between addition and doubling */ \
+    is_dbl = vec_is_zero(add.H, 2*sizeof(add.H));       \
+    vec_select(p3.X, p2, p1, 2*sizeof(p3.X), is_dbl);   \
+    vec_select(p3.Z, dbl.H, p3.Z, sizeof(p3.Z), is_dbl);\
+    vec_select(&add, &dbl, &add, sizeof(add), is_dbl);  \
+    /* |p3| and |add| hold all inputs now, |p3| will hold output */\
+\
+    sqr_##field(dbl.H, add.H);          /* H^2 */\
+    mul_##field(dbl.R, dbl.H, add.H);   /* H^3 */\
+    mul_##field(dbl.R, dbl.R, p3.Y);    /* H^3*S1 */\
+    mul_##field(p3.Y, dbl.H, p3.X);     /* H^2*U1 */\
+\
+    mul_##field(dbl.H, dbl.H, add.sx);  /* H^2*sx */\
+    sqr_##field(p3.X, add.R);           /* R^2 */\
+    sub_##field(p3.X, p3.X, dbl.H);     /* X3 = R^2-H^2*sx */\
+\
+    sub_##field(p3.Y, p3.Y, p3.X);      /* H^2*U1-X3 */\
+    mul_##field(p3.Y, p3.Y, add.R);     /* R*(H^2*U1-X3) */\
+    sub_##field(p3.Y, p3.Y, dbl.R);     /* Y3 = R*(H^2*U1-X3)-H^3*S1 */\
+\
+    vec_select(p3.X, p2,  p3.X, 2*sizeof(p3.X), p1inf); \
+    vec_select(p3.Z, one, p3.Z, sizeof(p3.Z), p1inf); \
+    vec_select(out, p1, &p3, sizeof(ptype), p2inf); \
+}
+
+/*
+ * https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl
+ * with twist to handle either input at infinity, which are encoded as Z==0.
+ */
+#define POINT_ADD_IMPL(ptype, bits, field) \
+static void ptype##_add(ptype *out, const ptype *p1, const ptype *p2) \
+{ \
+    ptype p3; \
+    vec##bits Z1Z1, Z2Z2, U1, S1, H, I, J; \
+    bool_t p1inf, p2inf; \
+\
+    p1inf = vec_is_zero(p1->Z, sizeof(p1->Z)); \
+    sqr_##field(Z1Z1, p1->Z);           /* Z1Z1 = Z1^2 */\
+\
+    mul_##field(p3.Z, Z1Z1, p1->Z);     /* Z1*Z1Z1 */\
+    mul_##field(p3.Z, p3.Z, p2->Y);     /* S2 = Y2*Z1*Z1Z1 */\
+\
+    p2inf = vec_is_zero(p2->Z, sizeof(p2->Z)); \
+    sqr_##field(Z2Z2, p2->Z);           /* Z2Z2 = Z2^2 */\
+\
+    mul_##field(S1, Z2Z2, p2->Z);       /* Z2*Z2Z2 */\
+    mul_##field(S1, S1, p1->Y);         /* S1 = Y1*Z2*Z2Z2 */\
+\
+    sub_##field(p3.Z, p3.Z, S1);        /* S2-S1 */\
+    add_##field(p3.Z, p3.Z, p3.Z);      /* r = 2*(S2-S1) */\
+\
+    mul_##field(U1, p1->X, Z2Z2);       /* U1 = X1*Z2Z2 */\
+    mul_##field(H,  p2->X, Z1Z1);       /* U2 = X2*Z1Z1 */\
+\
+    sub_##field(H, H, U1);              /* H = U2-U1 */\
+\
+    add_##field(I, H, H);               /* 2*H */\
+    sqr_##field(I, I);                  /* I = (2*H)^2 */\
+\
+    mul_##field(J, H, I);               /* J = H*I */\
+    mul_##field(S1, S1, J);             /* S1*J */\
+\
+    mul_##field(p3.Y, U1, I);           /* V = U1*I */\
+\
+    sqr_##field(p3.X, p3.Z);            /* r^2 */\
+    sub_##field(p3.X, p3.X, J);         /* r^2-J */\
+    sub_##field(p3.X, p3.X, p3.Y);      \
+    sub_##field(p3.X, p3.X, p3.Y);      /* X3 = r^2-J-2*V */\
+\
+    sub_##field(p3.Y, p3.Y, p3.X);      /* V-X3 */\
+    mul_##field(p3.Y, p3.Y, p3.Z);      /* r*(V-X3) */\
+    sub_##field(p3.Y, p3.Y, S1);        \
+    sub_##field(p3.Y, p3.Y, S1);        /* Y3 = r*(V-X3)-2*S1*J */\
+\
+    add_##field(p3.Z, p1->Z, p2->Z);    /* Z1+Z2 */\
+    sqr_##field(p3.Z, p3.Z);            /* (Z1+Z2)^2 */\
+    sub_##field(p3.Z, p3.Z, Z1Z1);      /* (Z1+Z2)^2-Z1Z1 */\
+    sub_##field(p3.Z, p3.Z, Z2Z2);      /* (Z1+Z2)^2-Z1Z1-Z2Z2 */\
+    mul_##field(p3.Z, p3.Z, H);         /* Z3 = ((Z1+Z2)^2-Z1Z1-Z2Z2)*H */\
+\
+    vec_select(&p3, p1, &p3, sizeof(ptype), p2inf); \
+    vec_select(out, p2, &p3, sizeof(ptype), p1inf); \
+}
+
+/*
+ * https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-madd-2007-bl
+ * with twist to handle either input at infinity, with |p1| encoded as Z==0,
+ * and |p2| as X==Y==0.
+ */
+#define POINT_ADD_AFFINE_IMPL(ptype, bits, field, one) \
+static void ptype##_add_affine(ptype *out, const ptype *p1, \
+                                           const ptype##_affine *p2) \
+{ \
+    ptype p3; \
+    vec##bits Z1Z1, H, HH, I, J; \
+    bool_t p1inf, p2inf; \
+\
+    p1inf = vec_is_zero(p1->Z, sizeof(p1->Z)); \
+\
+    sqr_##field(Z1Z1, p1->Z);           /* Z1Z1 = Z1^2 */\
+\
+    mul_##field(p3.Z, Z1Z1, p1->Z);     /* Z1*Z1Z1 */\
+    mul_##field(p3.Z, p3.Z, p2->Y);     /* S2 = Y2*Z1*Z1Z1 */\
+\
+    p2inf = vec_is_zero(p2->X, 2*sizeof(p2->X)); \
+\
+    mul_##field(H, p2->X, Z1Z1);        /* U2 = X2*Z1Z1 */\
+    sub_##field(H, H, p1->X);           /* H = U2-X1 */\
+\
+    sqr_##field(HH, H);                 /* HH = H^2 */\
+    add_##field(I, HH, HH);             \
+    add_##field(I, I, I);               /* I = 4*HH */\
+\
+    mul_##field(p3.Y, p1->X, I);        /* V = X1*I */\
+    mul_##field(J, H, I);               /* J = H*I */\
+    mul_##field(I, J, p1->Y);           /* Y1*J */\
+\
+    sub_##field(p3.Z, p3.Z, p1->Y);     /* S2-Y1 */\
+    add_##field(p3.Z, p3.Z, p3.Z);      /* r = 2*(S2-Y1) */\
+\
+    sqr_##field(p3.X, p3.Z);            /* r^2 */\
+    sub_##field(p3.X, p3.X, J);         /* r^2-J */\
+    sub_##field(p3.X, p3.X, p3.Y);      \
+    sub_##field(p3.X, p3.X, p3.Y);      /* X3 = r^2-J-2*V */\
+\
+    sub_##field(p3.Y, p3.Y, p3.X);      /* V-X3 */\
+    mul_##field(p3.Y, p3.Y, p3.Z);      /* r*(V-X3) */\
+    sub_##field(p3.Y, p3.Y, I);         \
+    sub_##field(p3.Y, p3.Y, I);         /* Y3 = r*(V-X3)-2*Y1*J */\
+\
+    add_##field(p3.Z, p1->Z, H);        /* Z1+H */\
+    sqr_##field(p3.Z, p3.Z);            /* (Z1+H)^2 */\
+    sub_##field(p3.Z, p3.Z, Z1Z1);      /* (Z1+H)^2-Z1Z1 */\
+    sub_##field(p3.Z, p3.Z, HH);        /* Z3 = (Z1+H)^2-Z1Z1-HH */\
+\
+    vec_select(p3.Z, one, p3.Z, sizeof(p3.Z), p1inf); \
+    vec_select(p3.X, p2,  p3.X, 2*sizeof(p3.X), p1inf); \
+    vec_select(out, p1, &p3, sizeof(ptype), p2inf); \
+}
+
+/*
+ * https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l
+ */
+#define POINT_DOUBLE_IMPL_A0(ptype, bits, field) \
+static void ptype##_double(ptype *p3, const ptype *p1) \
+{ \
+    vec##bits A, B, C; \
+\
+    sqr_##field(A, p1->X);              /* A = X1^2 */\
+    sqr_##field(B, p1->Y);              /* B = Y1^2 */\
+    sqr_##field(C, B);                  /* C = B^2 */\
+\
+    add_##field(B, B, p1->X);           /* X1+B */\
+    sqr_##field(B, B);                  /* (X1+B)^2 */\
+    sub_##field(B, B, A);               /* (X1+B)^2-A */\
+    sub_##field(B, B, C);               /* (X1+B)^2-A-C */\
+    add_##field(B, B, B);               /* D = 2*((X1+B)^2-A-C) */\
+\
+    mul_by_3_##field(A, A);             /* E = 3*A */\
+\
+    sqr_##field(p3->X, A);              /* F = E^2 */\
+    sub_##field(p3->X, p3->X, B);       \
+    sub_##field(p3->X, p3->X, B);       /* X3 = F-2*D */\
+\
+    add_##field(p3->Z, p1->Z, p1->Z);   /* 2*Z1 */\
+    mul_##field(p3->Z, p3->Z, p1->Y);   /* Z3 = 2*Z1*Y1 */\
+\
+    mul_by_8_##field(C, C);             /* 8*C */\
+    sub_##field(p3->Y, B, p3->X);       /* D-X3 */\
+    mul_##field(p3->Y, p3->Y, A);       /* E*(D-X3) */\
+    sub_##field(p3->Y, p3->Y, C);       /* Y3 = E*(D-X3)-8*C */\
+}
+
+#define POINT_LADDER_PRE_IMPL(ptype, bits, field) \
+static void ptype##xz_ladder_pre(ptype##xz *pxz, const ptype *p) \
+{ \
+    mul_##field(pxz->X, p->X, p->Z);    /* X2 = X1*Z1 */\
+    sqr_##field(pxz->Z, p->Z);          \
+    mul_##field(pxz->Z, pxz->Z, p->Z);  /* Z2 = Z1^3 */\
+}
+
+/*
+ * https://hyperelliptic.org/EFD/g1p/auto-shortw-xz.html#ladder-ladd-2002-it-3
+ * with twist to handle either input at infinity, which are encoded as Z==0.
+ * Just in case, order of doubling and addition is reverse in comparison to
+ * hyperelliptic.org entry. This was done to minimize temporary storage.
+ *
+ * XZ1 is |p|, XZ2&XZ4 are in&out |r|, XZ3&XZ5 are in&out |s|.
+ */
+#define POINT_LADDER_STEP_IMPL_A0(ptype, bits, field, suffix4b) \
+static void ptype##xz_ladder_step(ptype##xz *r, ptype##xz *s, \
+                                  const ptype##xz *p) \
+{ \
+    ptype##xz p5; \
+    vec##bits A, B, C, D, XX, ZZ; \
+    bool_t r_inf, s_inf; \
+                                        /* s += r */\
+    mul_##field(A, r->X, s->X);         /* A = X2*X3 */\
+    mul_##field(B, r->Z, s->Z);         /* B = Z2*Z3 */\
+    mul_##field(C, r->X, s->Z);         /* C = X2*Z3 */\
+    mul_##field(D, r->Z, s->X);         /* D = X3*Z2 */\
+\
+    sqr_##field(A, A);                  /* (A[-a*B])^2 */\
+    add_##field(p5.X, C, D);            /* C+D */\
+    mul_##field(p5.X, p5.X, B);         /* B*(C+D) */\
+    mul_by_4b_##suffix4b(B, p5.X);      /* b4*B*(C+D) */\
+    sub_##field(p5.X, A, B);            /* (A[-a*B])^2-b4*B*(C+D) */\
+    mul_##field(p5.X, p5.X, p->Z);      /* X5 = Z1*((A[-a*B])^2-b4*B*(C+D)) */\
+\
+    sub_##field(p5.Z, C, D);            /* C-D */\
+    sqr_##field(p5.Z, p5.Z);            /* (C-D)^2 */\
+    mul_##field(p5.Z, p5.Z, p->X);      /* Z5 = X1*(C-D)^2 */\
+\
+    r_inf = vec_is_zero(r->Z, sizeof(r->Z)); \
+    s_inf = vec_is_zero(s->Z, sizeof(s->Z)); \
+\
+    vec_select(&p5, r, &p5, sizeof(ptype##xz), s_inf); \
+    vec_select(s,   s, &p5, sizeof(ptype##xz), r_inf); \
+                                        /* r *= 2 */\
+    sqr_##field(XX, r->X);              /* XX = X2^2 */\
+    sqr_##field(ZZ, r->Z);              /* ZZ = Z2^2 */\
+\
+    add_##field(r->Z, r->X, r->Z);      /* X2+Z2 */\
+    sqr_##field(r->Z, r->Z);            /* (X2+Z2)^2 */\
+    sub_##field(r->Z, r->Z, XX);        /* (X2+Z2)^2-XX */\
+    sub_##field(r->Z, r->Z, ZZ);        /* E = (X2+Z2)^2-XX-ZZ */\
+\
+    sqr_##field(A, XX);                 /* (XX[-a*ZZ])^2 */\
+    mul_##field(B, r->Z, ZZ);           /* E*ZZ */\
+    mul_by_4b_##suffix4b(C, B);         /* b4*E*ZZ */\
+    sub_##field(r->X, A, C);            /* X4 = (XX[-a*ZZ])^2-b4*E*ZZ */\
+\
+    sqr_##field(ZZ, ZZ);                /* ZZ^2 */\
+    mul_by_4b_##suffix4b(B, ZZ);        /* b4*ZZ^2 */\
+    mul_##field(r->Z, r->Z, XX);        /* E*(XX[+a*ZZ]) */\
+    add_##field(r->Z, r->Z, r->Z);      /* 2*E*(XX[+a*ZZ]) */\
+    add_##field(r->Z, r->Z, B);         /* Z4 = 2*E*(XX[+a*ZZ])+b4*ZZ^2 */\
+}
+
+/*
+ * Recover the |r|'s y-coordinate using Eq. (8) from Brier-Joye,
+ * "Weierstraß Elliptic Curves and Side-Channel Attacks", with XZ twist
+ * and conversion to Jacobian coordinates from <openssl>/.../ecp_smpl.c,
+ * and with twist to recover from |s| at infinity [which occurs when
+ * multiplying by (order-1)].
+ *
+ * X4 = 2*Y1*X2*Z3*Z1*Z2
+ * Y4 = 2*b*Z3*(Z1*Z2)^2 + Z3*(a*Z1*Z2+X1*X2)*(X1*Z2+X2*Z1) - X3*(X1*Z2-X2*Z1)^2
+ * Z4 = 2*Y1*Z3*Z2^2*Z1
+ *
+ * Z3x2 = 2*Z3
+ * Y1Z3x2 = Y1*Z3x2
+ * Z1Z2 = Z1*Z2
+ * X1Z2 = X1*Z2
+ * X2Z1 = X2*Z1
+ * X4 = Y1Z3x2*X2*Z1Z2
+ * A = b*Z3x2*(Z1Z2)^2
+ * B = Z3*(a*Z1Z2+X1*X2)*(X1Z2+X2Z1)
+ * C = X3*(X1Z2-X2Z1)^2
+ * Y4 = A+B-C
+ * Z4 = Y1Z3x2*Z1Z2*Z2
+ *
+ * XZ1 is |p|, XZ2 is |r|, XZ3 is |s|, 'a' is 0.
+ */
+#define POINT_LADDER_POST_IMPL_A0(ptype, bits, field, suffixb) \
+static void ptype##xz_ladder_post(ptype *p4, \
+                                  const ptype##xz *r, const ptype##xz *s, \
+                                  const ptype##xz *p, const vec##bits Y1) \
+{ \
+    vec##bits Z3x2, Y1Z3x2, Z1Z2, X1Z2, X2Z1, A, B, C; \
+    bool_t s_inf; \
+\
+    add_##field(Z3x2, s->Z, s->Z);      /* Z3x2 = 2*Z3 */\
+    mul_##field(Y1Z3x2, Y1, Z3x2);      /* Y1Z3x2 = Y1*Z3x2 */\
+    mul_##field(Z1Z2, p->Z, r->Z);      /* Z1Z2 = Z1*Z2 */\
+    mul_##field(X1Z2, p->X, r->Z);      /* X1Z2 = X1*Z2 */\
+    mul_##field(X2Z1, r->X, p->Z);      /* X2Z1 = X2*Z1 */\
+\
+    mul_##field(p4->X, Y1Z3x2, r->X);   /* Y1Z3x2*X2 */\
+    mul_##field(p4->X, p4->X, Z1Z2);    /* X4 = Y1Z3x2*X2*Z1Z2 */\
+\
+    sqr_##field(A, Z1Z2);               /* (Z1Z2)^2 */\
+    mul_##field(B, A, Z3x2);            /* Z3x2*(Z1Z2)^2 */\
+    mul_by_b_##suffixb(A, B);           /* A = b*Z3x2*(Z1Z2)^2 */\
+\
+    mul_##field(B, p->X, r->X);         /* [a*Z1Z2+]X1*X2 */\
+    mul_##field(B, B, s->Z);            /* Z3*([a*Z1Z2+]X1*X2) */\
+    add_##field(C, X1Z2, X2Z1);         /* X1Z2+X2Z1 */\
+    mul_##field(B, B, C);               /* B = Z3*([a*Z2Z1+]X1*X2)*(X1Z2+X2Z1) */\
+\
+    sub_##field(C, X1Z2, X2Z1);         /* X1Z2-X2Z1 */\
+    sqr_##field(C, C);                  /* (X1Z2-X2Z1)^2 */\
+    mul_##field(C, C, s->X);            /* C = X3*(X1Z2-X2Z1)^2 */\
+\
+    add_##field(A, A, B);               /* A+B */\
+    sub_##field(A, A, C);               /* Y4 = A+B-C */\
+\
+    mul_##field(p4->Z, Z1Z2, r->Z);     /* Z1Z2*Z2 */\
+    mul_##field(p4->Z, p4->Z, Y1Z3x2);  /* Y1Z3x2*Z1Z2*Z2 */\
+\
+    s_inf = vec_is_zero(s->Z, sizeof(s->Z)); \
+    vec_select(p4->X, p->X, p4->X, sizeof(p4->X), s_inf); \
+    vec_select(p4->Y, Y1,   A,     sizeof(p4->Y), s_inf); \
+    vec_select(p4->Z, p->Z, p4->Z, sizeof(p4->Z), s_inf); \
+    ptype##_cneg(p4, s_inf); \
+                                        /* to Jacobian */\
+    mul_##field(p4->X, p4->X, p4->Z);   /* X4 = X4*Z4 */\
+    sqr_##field(B, p4->Z);              \
+    mul_##field(p4->Y, p4->Y, B);       /* Y4 = Y4*Z4^2 */\
+}
+
+#define POINT_IS_EQUAL_IMPL(ptype, bits, field) \
+static limb_t ptype##_is_equal(const ptype *p1, const ptype *p2) \
+{ \
+    vec##bits Z1Z1, Z2Z2; \
+    ptype##_affine a1, a2; \
+    bool_t is_inf1 = vec_is_zero(p1->Z, sizeof(p1->Z)); \
+    bool_t is_inf2 = vec_is_zero(p2->Z, sizeof(p2->Z)); \
+\
+    sqr_##field(Z1Z1, p1->Z);           /* Z1Z1 = Z1^2 */\
+    sqr_##field(Z2Z2, p2->Z);           /* Z2Z2 = Z2^2 */\
+\
+    mul_##field(a1.X, p1->X, Z2Z2);     /* U1 = X1*Z2Z2 */\
+    mul_##field(a2.X, p2->X, Z1Z1);     /* U2 = X2*Z1Z1 */\
+\
+    mul_##field(a1.Y, p1->Y, p2->Z);    /* Y1*Z2 */\
+    mul_##field(a2.Y, p2->Y, p1->Z);    /* Y2*Z1 */\
+\
+    mul_##field(a1.Y, a1.Y, Z2Z2);      /* S1 = Y1*Z2*Z2Z2 */\
+    mul_##field(a2.Y, a2.Y, Z1Z1);      /* S2 = Y2*Z1*Z1Z1 */\
+\
+    return vec_is_equal(&a1, &a2, sizeof(a1)) & (is_inf1 ^ is_inf2 ^ 1); \
+}
+
+/*
+ * https://eprint.iacr.org/2015/1060, algorithm 7 with a twist to handle
+ * |p3| pointing at either |p1| or |p2|. This is resolved by adding |t5|
+ * and replacing few first references to |X3| in the formula, up to step
+ * 21, with it. 12M[+27A], doubling and infinity are handled by the
+ * formula itself. Infinity is to be encoded as [0, !0, 0].
+ */
+#define POINT_PROJ_DADD_IMPL_A0(ptype, bits, field, suffixb) \
+static void ptype##proj_dadd(ptype##proj *p3, const ptype##proj *p1, \
+                                              const ptype##proj *p2) \
+{ \
+    vec##bits t0, t1, t2, t3, t4, t5; \
+\
+    mul_##field(t0, p1->X, p2->X);      /* 1.     t0 = X1*X2 */\
+    mul_##field(t1, p1->Y, p2->Y);      /* 2.     t1 = Y1*Y2 */\
+    mul_##field(t2, p1->Z, p2->Z);      /* 3.     t2 = Z1*Z2 */\
+    add_##field(t3, p1->X, p1->Y);      /* 4.     t3 = X1+Y1 */\
+    add_##field(t4, p2->X, p2->Y);      /* 5.     t4 = X2+Y2 */\
+    mul_##field(t3, t3, t4);            /* 6.     t3 = t3*t4 */\
+    add_##field(t4, t0, t1);            /* 7.     t4 = t0+t1 */\
+    sub_##field(t3, t3, t4);            /* 8.     t3 = t3-t4 */\
+    add_##field(t4, p1->Y, p1->Z);      /* 9.     t4 = Y1+Z1 */\
+    add_##field(t5, p2->Y, p2->Z);      /* 10.    t5 = Y2+Z2 */\
+    mul_##field(t4, t4, t5);            /* 11.    t4 = t4*t5 */\
+    add_##field(t5, t1, t2);            /* 12.    t5 = t1+t2 */\
+    sub_##field(t4, t4, t5);            /* 13.    t4 = t4-t5 */\
+    add_##field(t5, p1->X, p1->Z);      /* 14.    t5 = X1+Z1 */\
+    add_##field(p3->Y, p2->X, p2->Z);   /* 15.    Y3 = X2+Z2 */\
+    mul_##field(t5, t5, p3->Y);         /* 16.    t5 = t5*Y3 */\
+    add_##field(p3->Y, t0, t2);         /* 17.    Y3 = t0+t2 */\
+    sub_##field(p3->Y, t5, p3->Y);      /* 18.    Y3 = t5-Y3 */\
+    mul_by_3_##field(t0, t0);           /* 19-20. t0 = 3*t0  */\
+    mul_by_3_##field(t5, t2);           /* 21.    t5 = 3*t2  */\
+    mul_by_b_##suffixb(t2, t5);         /* 21.    t2 = b*t5  */\
+    add_##field(p3->Z, t1, t2);         /* 22.    Z3 = t1+t2 */\
+    sub_##field(t1, t1, t2);            /* 23.    t1 = t1-t2 */\
+    mul_by_3_##field(t5, p3->Y);        /* 24.    t5 = 3*Y3  */\
+    mul_by_b_##suffixb(p3->Y, t5);      /* 24.    Y3 = b*t5  */\
+    mul_##field(p3->X, t4, p3->Y);      /* 25.    X3 = t4*Y3 */\
+    mul_##field(t2, t3, t1);            /* 26.    t2 = t3*t1 */\
+    sub_##field(p3->X, t2, p3->X);      /* 27.    X3 = t2-X3 */\
+    mul_##field(p3->Y, p3->Y, t0);      /* 28.    Y3 = Y3*t0 */\
+    mul_##field(t1, t1, p3->Z);         /* 29.    t1 = t1*Z3 */\
+    add_##field(p3->Y, t1, p3->Y);      /* 30.    Y3 = t1+Y3 */\
+    mul_##field(t0, t0, t3);            /* 31.    t0 = t0*t3 */\
+    mul_##field(p3->Z, p3->Z, t4);      /* 32.    Z3 = Z3*t4 */\
+    add_##field(p3->Z, p3->Z, t0);      /* 33.    Z3 = Z3+t0 */\
+}
+
+/*
+ * https://eprint.iacr.org/2015/1060, algorithm 8 with a twist to handle
+ * |p2| being infinity encoded as [0, 0]. 11M[+21A].
+ */
+#define POINT_PROJ_DADD_AFFINE_IMPL_A0(ptype, bits, field, suffixb) \
+static void ptype##proj_dadd_affine(ptype##proj *out, const ptype##proj *p1, \
+                                                      const ptype##_affine *p2) \
+{ \
+    ptype##proj p3[1]; \
+    vec##bits t0, t1, t2, t3, t4; \
+    limb_t p2inf = vec_is_zero(p2, sizeof(*p2)); \
+\
+    mul_##field(t0, p1->X, p2->X);      /* 1.     t0 = X1*X2 */\
+    mul_##field(t1, p1->Y, p2->Y);      /* 2.     t1 = Y1*Y2 */\
+    add_##field(t3, p1->X, p1->Y);      /* 3.     t3 = X1+Y1 */\
+    add_##field(t4, p2->X, p2->Y);      /* 4.     t4 = X2+Y2 */\
+    mul_##field(t3, t3, t4);            /* 5.     t3 = t3*t4 */\
+    add_##field(t4, t0, t1);            /* 6.     t4 = t0+t1 */\
+    sub_##field(t3, t3, t4);            /* 7.     t3 = t3-t4 */\
+    mul_##field(t4, p2->Y, p1->Z);      /* 8.     t4 = Y2*Z1 */\
+    add_##field(t4, t4, p1->Y);         /* 9.     t4 = t4+Y1 */\
+    mul_##field(p3->Y, p2->X, p1->Z);   /* 10.    Y3 = X2*Z1 */\
+    add_##field(p3->Y, p3->Y, p1->X);   /* 11.    Y3 = Y3+X1 */\
+    mul_by_3_##field(t0, t0);           /* 12-13. t0 = 3*t0  */\
+    mul_by_b_##suffixb(t2, p1->Z);      /* 14.    t2 = b*Z1  */\
+    mul_by_3_##field(t2, t2);           /* 14.    t2 = 3*t2  */\
+    add_##field(p3->Z, t1, t2);         /* 15.    Z3 = t1+t2 */\
+    sub_##field(t1, t1, t2);            /* 16.    t1 = t1-t2 */\
+    mul_by_b_##suffixb(t2, p3->Y);      /* 17.    t2 = b*Y3  */\
+    mul_by_3_##field(p3->Y, t2);        /* 17.    Y3 = 3*t2  */\
+    mul_##field(p3->X, t4, p3->Y);      /* 18.    X3 = t4*Y3 */\
+    mul_##field(t2, t3, t1);            /* 19.    t2 = t3*t1 */\
+    sub_##field(p3->X, t2, p3->X);      /* 20.    X3 = t2-X3 */\
+    mul_##field(p3->Y, p3->Y, t0);      /* 21.    Y3 = Y3*t0 */\
+    mul_##field(t1, t1, p3->Z);         /* 22.    t1 = t1*Z3 */\
+    add_##field(p3->Y, t1, p3->Y);      /* 23.    Y3 = t1+Y3 */\
+    mul_##field(t0, t0, t3);            /* 24.    t0 = t0*t3 */\
+    mul_##field(p3->Z, p3->Z, t4);      /* 25.    Z3 = Z3*t4 */\
+    add_##field(p3->Z, p3->Z, t0);      /* 26.    Z3 = Z3+t0 */\
+\
+    vec_select(out, p1, p3, sizeof(*out), p2inf); \
+}
+
+/*
+ * https://eprint.iacr.org/2015/1060, algorithm 9 with a twist to handle
+ * |p3| pointing at |p1|. This is resolved by adding |t3| to hold X*Y
+ * and reordering operations to bring references to |p1| forward.
+ * 6M+2S[+13A].
+ */
+#define POINT_PROJ_DOUBLE_IMPL_A0(ptype, bits, field, suffixb) \
+static void ptype##proj_double(ptype##proj *p3, const ptype##proj *p1) \
+{ \
+    vec##bits t0, t1, t2, t3; \
+\
+    sqr_##field(t0, p1->Y);             /* 1.     t0 = Y*Y   */\
+    mul_##field(t1, p1->Y, p1->Z);      /* 5.     t1 = Y*Z   */\
+    sqr_##field(t2, p1->Z);             /* 6.     t2 = Z*Z   */\
+    mul_##field(t3, p1->X, p1->Y);      /* 16.    t3 = X*Y   */\
+    lshift_##field(p3->Z, t0, 3);       /* 2-4.   Z3 = 8*t0  */\
+    mul_by_b_##suffixb(p3->X, t2);      /* 7.     t2 = b*t2  */\
+    mul_by_3_##field(t2, p3->X);        /* 7.     t2 = 3*t2  */\
+    mul_##field(p3->X, t2, p3->Z);      /* 8.     X3 = t2*Z3 */\
+    add_##field(p3->Y, t0, t2);         /* 9.     Y3 = t0+t2 */\
+    mul_##field(p3->Z, t1, p3->Z);      /* 10.    Z3 = t1*Z3 */\
+    mul_by_3_##field(t2, t2);           /* 11-12. t2 = 3*t2  */\
+    sub_##field(t0, t0, t2);            /* 13.    t0 = t0-t2 */\
+    mul_##field(p3->Y, t0, p3->Y);      /* 14.    Y3 = t0*Y3 */\
+    add_##field(p3->Y, p3->X, p3->Y);   /* 15.    Y3 = X3+Y3 */\
+    mul_##field(p3->X, t0, t3);         /* 17.    X3 = t0*t3 */\
+    add_##field(p3->X, p3->X, p3->X);   /* 18.    X3 = X3+X3 */\
+}
+
+#define POINT_PROJ_TO_JACOBIAN_IMPL(ptype, bits, field) \
+static void ptype##proj_to_Jacobian(ptype *out, const ptype##proj *in) \
+{ \
+    vec##bits ZZ; \
+\
+    sqr_##field(ZZ, in->Z); \
+    mul_##field(out->X, in->X, in->Z); \
+    mul_##field(out->Y, in->Y, ZZ); \
+    vec_copy(out->Z, in->Z, sizeof(out->Z)); \
+}
+
+#define POINT_TO_PROJECTIVE_IMPL(ptype, bits, field, one) \
+static void ptype##_to_projective(ptype##proj *out, const ptype *in) \
+{ \
+    vec##bits ZZ; \
+    limb_t is_inf = vec_is_zero(in->Z, sizeof(in->Z)); \
+\
+    sqr_##field(ZZ, in->Z); \
+    mul_##field(out->X, in->X, in->Z); \
+    vec_select(out->Y, one, in->Y, sizeof(out->Y), is_inf); \
+    mul_##field(out->Z, ZZ, in->Z); \
+}
+
+/******************* !!!!! NOT CONSTANT TIME !!!!! *******************/
+
+/*
+ * http://hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-add-2008-s
+ * http://hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-dbl-2008-s-1
+ * with twist to handle either input at infinity. Addition costs 12M+2S,
+ * while conditional doubling - 4M+6M+3S.
+ */
+#define POINTXYZZ_DADD_IMPL(ptype, bits, field) \
+static void ptype##xyzz_dadd(ptype##xyzz *p3, const ptype##xyzz *p1, \
+                                              const ptype##xyzz *p2) \
+{ \
+    vec##bits U, S, P, R; \
+\
+    if (vec_is_zero(p2->ZZZ, 2*sizeof(p2->ZZZ))) { \
+        vec_copy(p3, p1, sizeof(*p3));  \
+        return; \
+    } else if (vec_is_zero(p1->ZZZ, 2*sizeof(p1->ZZZ))) { \
+        vec_copy(p3, p2, sizeof(*p3));  \
+        return; \
+    } \
+\
+    mul_##field(U, p1->X, p2->ZZ);              /* U1 = X1*ZZ2 */\
+    mul_##field(S, p1->Y, p2->ZZZ);             /* S1 = Y1*ZZZ2 */\
+    mul_##field(P, p2->X, p1->ZZ);              /* U2 = X2*ZZ1 */\
+    mul_##field(R, p2->Y, p1->ZZZ);             /* S2 = Y2*ZZZ1 */\
+    sub_##field(P, P, U);                       /* P = U2-U1 */\
+    sub_##field(R, R, S);                       /* R = S2-S1 */\
+\
+    if (!vec_is_zero(P, sizeof(P))) {           /* X1!=X2 */\
+        vec##bits PP, PPP, Q;                   /* add |p1| and |p2| */\
+\
+        sqr_##field(PP, P);                     /* PP = P^2 */\
+        mul_##field(PPP, PP, P);                /* PPP = P*PP */\
+        mul_##field(Q, U, PP);                  /* Q = U1*PP */\
+        sqr_##field(p3->X, R);                  /* R^2 */\
+        add_##field(P, Q, Q); \
+        sub_##field(p3->X, p3->X, PPP);         /* R^2-PPP */\
+        sub_##field(p3->X, p3->X, P);           /* X3 = R^2-PPP-2*Q */\
+        sub_##field(Q, Q, p3->X); \
+        mul_##field(Q, Q, R);                   /* R*(Q-X3) */\
+        mul_##field(p3->Y, S, PPP);             /* S1*PPP */\
+        sub_##field(p3->Y, Q, p3->Y);           /* Y3 = R*(Q-X3)-S1*PPP */\
+        mul_##field(p3->ZZ, p1->ZZ, p2->ZZ);    /* ZZ1*ZZ2 */\
+        mul_##field(p3->ZZZ, p1->ZZZ, p2->ZZZ); /* ZZZ1*ZZZ2 */\
+        mul_##field(p3->ZZ, p3->ZZ, PP);        /* ZZ3 = ZZ1*ZZ2*PP */\
+        mul_##field(p3->ZZZ, p3->ZZZ, PPP);     /* ZZZ3 = ZZZ1*ZZZ2*PPP */\
+    } else if (vec_is_zero(R, sizeof(R))) {     /* X1==X2 && Y1==Y2 */\
+        vec##bits V, W, M;                      /* double |p1| */\
+\
+        add_##field(U, p1->Y, p1->Y);           /* U = 2*Y1 */\
+        sqr_##field(V, U);                      /* V = U^2 */\
+        mul_##field(W, V, U);                   /* W = U*V */\
+        mul_##field(S, p1->X, V);               /* S = X1*V */\
+        sqr_##field(M, p1->X); \
+        mul_by_3_##field(M, M);                 /* M = 3*X1^2[+a*ZZ1^2] */\
+        sqr_##field(p3->X, M); \
+        add_##field(U, S, S);                   /* 2*S */\
+        sub_##field(p3->X, p3->X, U);           /* X3 = M^2-2*S */\
+        mul_##field(p3->Y, W, p1->Y);           /* W*Y1 */\
+        sub_##field(S, S, p3->X); \
+        mul_##field(S, S, M);                   /* M*(S-X3) */\
+        sub_##field(p3->Y, S, p3->Y);           /* Y3 = M*(S-X3)-W*Y1 */\
+        mul_##field(p3->ZZ, p1->ZZ, V);         /* ZZ3 = V*ZZ1 */\
+        mul_##field(p3->ZZZ, p1->ZZZ, W);       /* ZZ3 = W*ZZZ1 */\
+    } else {                                    /* X1==X2 && Y1==-Y2 */\
+        vec_zero(p3->ZZZ, 2*sizeof(p3->ZZZ));   /* set |p3| to infinity */\
+    } \
+}
+
+/*
+ * http://hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#addition-madd-2008-s
+ * http://hyperelliptic.org/EFD/g1p/auto-shortw-xyzz.html#doubling-mdbl-2008-s-1
+ * with twists to handle even subtractions and either input at infinity.
+ * Addition costs 8M+2S, while conditional doubling - 2M+4M+3S.
+ */
+#define POINTXYZZ_DADD_AFFINE_IMPL(ptype, bits, field, one) \
+static void ptype##xyzz_dadd_affine(ptype##xyzz *p3, const ptype##xyzz *p1, \
+                                                     const ptype##_affine *p2, \
+                                                     bool_t subtract) \
+{ \
+    vec##bits P, R; \
+\
+    if (vec_is_zero(p2, sizeof(*p2))) { \
+        vec_copy(p3, p1, sizeof(*p3));  \
+        return; \
+    } else if (vec_is_zero(p1->ZZZ, 2*sizeof(p1->ZZZ))) { \
+        vec_copy(p3->X, p2->X, 2*sizeof(p3->X));\
+        cneg_##field(p3->ZZZ, one, subtract);   \
+        vec_copy(p3->ZZ, one, sizeof(p3->ZZ));  \
+        return; \
+    } \
+\
+    mul_##field(P, p2->X, p1->ZZ);              /* U2 = X2*ZZ1 */\
+    mul_##field(R, p2->Y, p1->ZZZ);             /* S2 = Y2*ZZZ1 */\
+    cneg_##field(R, R, subtract); \
+    sub_##field(P, P, p1->X);                   /* P = U2-X1 */\
+    sub_##field(R, R, p1->Y);                   /* R = S2-Y1 */\
+\
+    if (!vec_is_zero(P, sizeof(P))) {           /* X1!=X2 */\
+        vec##bits PP, PPP, Q;                   /* add |p2| to |p1| */\
+\
+        sqr_##field(PP, P);                     /* PP = P^2 */\
+        mul_##field(PPP, PP, P);                /* PPP = P*PP */\
+        mul_##field(Q, p1->X, PP);              /* Q = X1*PP */\
+        sqr_##field(p3->X, R);                  /* R^2 */\
+        add_##field(P, Q, Q); \
+        sub_##field(p3->X, p3->X, PPP);         /* R^2-PPP */\
+        sub_##field(p3->X, p3->X, P);           /* X3 = R^2-PPP-2*Q */\
+        sub_##field(Q, Q, p3->X); \
+        mul_##field(Q, Q, R);                   /* R*(Q-X3) */\
+        mul_##field(p3->Y, p1->Y, PPP);         /* Y1*PPP */\
+        sub_##field(p3->Y, Q, p3->Y);           /* Y3 = R*(Q-X3)-Y1*PPP */\
+        mul_##field(p3->ZZ, p1->ZZ, PP);        /* ZZ3 = ZZ1*PP */\
+        mul_##field(p3->ZZZ, p1->ZZZ, PPP);     /* ZZZ3 = ZZZ1*PPP */\
+    } else if (vec_is_zero(R, sizeof(R))) {     /* X1==X2 && Y1==Y2 */\
+        vec##bits U, S, M;                      /* double |p2| */\
+\
+        add_##field(U, p2->Y, p2->Y);           /* U = 2*Y1 */\
+        sqr_##field(p3->ZZ, U);                 /* [ZZ3 =] V = U^2 */\
+        mul_##field(p3->ZZZ, p3->ZZ, U);        /* [ZZZ3 =] W = U*V */\
+        mul_##field(S, p2->X, p3->ZZ);          /* S = X1*V */\
+        sqr_##field(M, p2->X); \
+        mul_by_3_##field(M, M);                 /* M = 3*X1^2[+a] */\
+        sqr_##field(p3->X, M); \
+        add_##field(U, S, S);                   /* 2*S */\
+        sub_##field(p3->X, p3->X, U);           /* X3 = M^2-2*S */\
+        mul_##field(p3->Y, p3->ZZZ, p2->Y);     /* W*Y1 */\
+        sub_##field(S, S, p3->X); \
+        mul_##field(S, S, M);                   /* M*(S-X3) */\
+        sub_##field(p3->Y, S, p3->Y);           /* Y3 = M*(S-X3)-W*Y1 */\
+        cneg_##field(p3->ZZZ, p3->ZZZ, subtract); \
+    } else {                                    /* X1==X2 && Y1==-Y2 */\
+        vec_zero(p3->ZZZ, 2*sizeof(p3->ZZZ));   /* set |p3| to infinity */\
+    } \
+}
+
+#define POINTXYZZ_TO_JACOBIAN_IMPL(ptype, bits, field) \
+static void ptype##xyzz_to_Jacobian(ptype *out, const ptype##xyzz *in) \
+{ \
+    mul_##field(out->X, in->X, in->ZZ); \
+    mul_##field(out->Y, in->Y, in->ZZZ); \
+    vec_copy(out->Z, in->ZZ, sizeof(out->Z)); \
+}
+
+#define POINT_TO_XYZZ_IMPL(ptype, bits, field) \
+static void ptype##_to_xyzz(ptype##xyzz *out, const ptype *in) \
+{ \
+    vec_copy(out->X, in->X, 2*sizeof(out->X)); \
+    sqr_##field(out->ZZ, in->Z); \
+    mul_##field(out->ZZZ, out->ZZ, in->Z); \
+}
+
+#endif
diff --git a/vendor/external/blst/src/errors.h b/vendor/external/blst/src/errors.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/errors.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __BLS12_381_ASM_ERRORS_H__
+#define __BLS12_381_ASM_ERRORS_H__
+
+typedef enum {
+    BLST_SUCCESS = 0,
+    BLST_BAD_ENCODING,
+    BLST_POINT_NOT_ON_CURVE,
+    BLST_POINT_NOT_IN_GROUP,
+    BLST_AGGR_TYPE_MISMATCH,
+    BLST_VERIFY_FAIL,
+    BLST_PK_IS_INFINITY,
+} BLST_ERROR;
+
+#endif
diff --git a/vendor/external/blst/src/exp.c b/vendor/external/blst/src/exp.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/exp.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "vect.h"
+
+/*
+ * |out| = |inp|^|pow|, small footprint, public exponent
+ */
+static void exp_mont_384(vec384 out, const vec384 inp, const byte *pow,
+                         size_t pow_bits, const vec384 p, limb_t n0)
+{
+#if 1
+    vec384 ret;
+
+    vec_copy(ret, inp, sizeof(ret));  /* ret = inp^1 */
+    --pow_bits; /* most significant bit is set, skip over */
+    while (pow_bits--) {
+        sqr_mont_384(ret, ret, p, n0);
+        if (is_bit_set(pow, pow_bits))
+            mul_mont_384(ret, ret, inp, p, n0);
+    }
+    vec_copy(out, ret, sizeof(ret));  /* out = ret */
+#else
+    unsigned int i;
+    vec384 sqr;
+
+    vec_copy(sqr, inp, sizeof(sqr));
+    for (i = 0; !is_bit_set(pow, i++);)
+        sqr_mont_384(sqr, sqr, sqr, p, n0);
+    vec_copy(out, sqr, sizeof(sqr));
+    for (; i < pow_bits; i++) {
+        sqr_mont_384(sqr, sqr, sqr, p, n0);
+        if (is_bit_set(pow, i))
+            mul_mont_384(out, out, sqr, p, n0);
+    }
+#endif
+}
+
+static void exp_mont_384x(vec384x out, const vec384x inp, const byte *pow,
+                          size_t pow_bits, const vec384 p, limb_t n0)
+{
+    vec384x ret;
+
+    vec_copy(ret, inp, sizeof(ret));  /* |ret| = |inp|^1 */
+    --pow_bits; /* most significant bit is accounted for, skip over */
+    while (pow_bits--) {
+        sqr_mont_384x(ret, ret, p, n0);
+        if (is_bit_set(pow, pow_bits))
+            mul_mont_384x(ret, ret, inp, p, n0);
+    }
+    vec_copy(out, ret, sizeof(ret));  /* |out| = |ret| */
+}
diff --git a/vendor/external/blst/src/exports.c b/vendor/external/blst/src/exports.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/exports.c
@@ -0,0 +1,583 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+/*
+ * Why this file? Overall goal is to ensure that all internal calls
+ * remain internal after linking application. This is to both
+ *
+ * a) minimize possibility of external name conflicts (since all
+ *    non-blst-prefixed and [assembly subroutines] remain static);
+ * b) preclude possibility of unintentional internal reference
+ *    overload in shared library context (one can achieve same
+ *    effect with -Bsymbolic, but we don't want to rely on end-user
+ *    to remember to use it);
+ */
+
+#include "fields.h"
+#include "bytes.h"
+
+/*
+ * BLS12-381-specific Fr shortcuts to assembly.
+ */
+void blst_fr_add(vec256 ret, const vec256 a, const vec256 b)
+{   add_mod_256(ret, a, b, BLS12_381_r);   }
+
+void blst_fr_sub(vec256 ret, const vec256 a, const vec256 b)
+{   sub_mod_256(ret, a, b, BLS12_381_r);   }
+
+void blst_fr_mul_by_3(vec256 ret, const vec256 a)
+{   mul_by_3_mod_256(ret, a, BLS12_381_r);   }
+
+void blst_fr_lshift(vec256 ret, const vec256 a, size_t count)
+{   lshift_mod_256(ret, a, count, BLS12_381_r);   }
+
+void blst_fr_rshift(vec256 ret, const vec256 a, size_t count)
+{   rshift_mod_256(ret, a, count, BLS12_381_r);   }
+
+void blst_fr_mul(vec256 ret, const vec256 a, const vec256 b)
+{   mul_mont_sparse_256(ret, a, b, BLS12_381_r, r0);   }
+
+void blst_fr_ct_bfly(vec256 x0, vec256 x1, const vec256 twiddle)
+{
+    vec256 x2;
+
+    mul_mont_sparse_256(x2, x1, twiddle, BLS12_381_r, r0);
+    sub_mod_256(x1, x0, x2, BLS12_381_r);
+    add_mod_256(x0, x0, x2, BLS12_381_r);
+}
+
+void blst_fr_gs_bfly(vec256 x0, vec256 x1, const vec256 twiddle)
+{
+    vec256 x2;
+
+    sub_mod_256(x2, x0, x1, BLS12_381_r);
+    add_mod_256(x0, x0, x1, BLS12_381_r);
+    mul_mont_sparse_256(x1, x2, twiddle, BLS12_381_r, r0);
+}
+
+void blst_fr_sqr(vec256 ret, const vec256 a)
+{   sqr_mont_sparse_256(ret, a, BLS12_381_r, r0);   }
+
+void blst_fr_cneg(vec256 ret, const vec256 a, int flag)
+{   cneg_mod_256(ret, a, is_zero(flag) ^ 1, BLS12_381_r);   }
+
+void blst_fr_to(vec256 ret, const vec256 a)
+{   mul_mont_sparse_256(ret, a, BLS12_381_rRR, BLS12_381_r, r0);   }
+
+void blst_fr_from(vec256 ret, const vec256 a)
+{   from_mont_256(ret, a, BLS12_381_r, r0);   }
+
+void blst_fr_from_scalar(vec256 ret, const pow256 a)
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+
+    if ((uptr_t)ret == (uptr_t)a && is_endian.little) {
+        mul_mont_sparse_256(ret, (const limb_t *)a, BLS12_381_rRR,
+                                                    BLS12_381_r, r0);
+    } else {
+        vec256 out;
+        limbs_from_le_bytes(out, a, 32);
+        mul_mont_sparse_256(ret, out, BLS12_381_rRR, BLS12_381_r, r0);
+        vec_zero(out, sizeof(out));
+    }
+}
+
+void blst_scalar_from_fr(pow256 ret, const vec256 a)
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+
+    if ((uptr_t)ret == (uptr_t)a && is_endian.little) {
+        from_mont_256((limb_t *)ret, a, BLS12_381_r, r0);
+    } else {
+        vec256 out;
+        from_mont_256(out, a, BLS12_381_r, r0);
+        le_bytes_from_limbs(ret, out, 32);
+        vec_zero(out, sizeof(out));
+    }
+}
+
+int blst_scalar_fr_check(const pow256 a)
+{   return (int)(check_mod_256(a, BLS12_381_r) |
+                 bytes_are_zero(a, sizeof(pow256)));
+}
+
+int blst_sk_check(const pow256 a)
+{   return (int)check_mod_256(a, BLS12_381_r);   }
+
+int blst_sk_add_n_check(pow256 ret, const pow256 a, const pow256 b)
+{   return (int)add_n_check_mod_256(ret, a, b, BLS12_381_r);   }
+
+int blst_sk_sub_n_check(pow256 ret, const pow256 a, const pow256 b)
+{   return (int)sub_n_check_mod_256(ret, a, b, BLS12_381_r);   }
+
+int blst_sk_mul_n_check(pow256 ret, const pow256 a, const pow256 b)
+{
+    vec256 t[2];
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+    bool_t is_zero;
+
+    if (((size_t)a|(size_t)b)%sizeof(limb_t) != 0 || !is_endian.little) {
+        limbs_from_le_bytes(t[0], a, sizeof(pow256));
+        limbs_from_le_bytes(t[1], b, sizeof(pow256));
+        a = (const byte *)t[0];
+        b = (const byte *)t[1];
+    }
+    mul_mont_sparse_256(t[0], BLS12_381_rRR, (const limb_t *)a, BLS12_381_r, r0);
+    mul_mont_sparse_256(t[0], t[0], (const limb_t *)b, BLS12_381_r, r0);
+    le_bytes_from_limbs(ret, t[0], sizeof(pow256));
+    is_zero = vec_is_zero(t[0], sizeof(vec256));
+    vec_zero(t, sizeof(t));
+
+    return (int)(is_zero^1);
+}
+
+void blst_sk_inverse(pow256 ret, const pow256 a)
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+
+    if (((size_t)a|(size_t)ret)%sizeof(limb_t) == 0 && is_endian.little) {
+        limb_t *out = (limb_t *)ret;
+        mul_mont_sparse_256(out, (const limb_t *)a, BLS12_381_rRR,
+                                                    BLS12_381_r, r0);
+        reciprocal_fr(out, out);
+        from_mont_256(out, out, BLS12_381_r, r0);
+    } else {
+        vec256 out;
+        limbs_from_le_bytes(out, a, 32);
+        mul_mont_sparse_256(out, out, BLS12_381_rRR, BLS12_381_r, r0);
+        reciprocal_fr(out, out);
+        from_mont_256(out, out, BLS12_381_r, r0);
+        le_bytes_from_limbs(ret, out, 32);
+        vec_zero(out, sizeof(out));
+    }
+}
+
+/*
+ * BLS12-381-specific Fp shortcuts to assembly.
+ */
+void blst_fp_add(vec384 ret, const vec384 a, const vec384 b)
+{   add_fp(ret, a, b);   }
+
+void blst_fp_sub(vec384 ret, const vec384 a, const vec384 b)
+{   sub_fp(ret, a, b);   }
+
+void blst_fp_mul_by_3(vec384 ret, const vec384 a)
+{   mul_by_3_fp(ret, a);   }
+
+void blst_fp_mul_by_8(vec384 ret, const vec384 a)
+{   mul_by_8_fp(ret, a);   }
+
+void blst_fp_lshift(vec384 ret, const vec384 a, size_t count)
+{   lshift_fp(ret, a, count);   }
+
+void blst_fp_mul(vec384 ret, const vec384 a, const vec384 b)
+{   mul_fp(ret, a, b);   }
+
+void blst_fp_sqr(vec384 ret, const vec384 a)
+{   sqr_fp(ret, a);   }
+
+void blst_fp_cneg(vec384 ret, const vec384 a, int flag)
+{   cneg_fp(ret, a, is_zero(flag) ^ 1);   }
+
+void blst_fp_to(vec384 ret, const vec384 a)
+{   mul_fp(ret, a, BLS12_381_RR);   }
+
+void blst_fp_from(vec384 ret, const vec384 a)
+{   from_fp(ret, a);   }
+
+/*
+ * Fp serialization/deserialization.
+ */
+void blst_fp_from_uint32(vec384 ret, const unsigned int a[12])
+{
+    if (sizeof(limb_t) == 8) {
+        int i;
+        for (i = 0; i < 6; i++)
+            ret[i] = a[2*i] | ((limb_t)a[2*i+1] << (32 & (8*sizeof(limb_t)-1)));
+        a = (const unsigned int *)ret;
+    }
+    mul_fp(ret, (const limb_t *)a, BLS12_381_RR);
+}
+
+void blst_uint32_from_fp(unsigned int ret[12], const vec384 a)
+{
+    if (sizeof(limb_t) == 4) {
+        from_fp((limb_t *)ret, a);
+    } else {
+        vec384 out;
+        int i;
+
+        from_fp(out, a);
+        for (i = 0; i < 6; i++) {
+            limb_t limb = out[i];
+            ret[2*i]   = (unsigned int)limb;
+            ret[2*i+1] = (unsigned int)(limb >> (32 & (8*sizeof(limb_t)-1)));
+        }
+    }
+}
+
+void blst_fp_from_uint64(vec384 ret, const unsigned long long a[6])
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+
+    if (sizeof(limb_t) == 4 && !is_endian.little) {
+        int i;
+        for (i = 0; i < 6; i++) {
+            unsigned long long limb = a[i];
+            ret[2*i]   = (limb_t)limb;
+            ret[2*i+1] = (limb_t)(limb >> 32);
+        }
+        a = (const unsigned long long *)ret;
+    }
+    mul_fp(ret, (const limb_t *)a, BLS12_381_RR);
+}
+
+void blst_uint64_from_fp(unsigned long long ret[6], const vec384 a)
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+
+    if (sizeof(limb_t) == 8 || is_endian.little) {
+        from_fp((limb_t *)ret, a);
+    } else {
+        vec384 out;
+        int i;
+
+        from_fp(out, a);
+        for (i = 0; i < 6; i++)
+            ret[i] = out[2*i] | ((unsigned long long)out[2*i+1] << 32);
+    }
+}
+
+void blst_fp_from_bendian(vec384 ret, const unsigned char a[48])
+{
+    vec384 out;
+
+    limbs_from_be_bytes(out, a, sizeof(vec384));
+    mul_fp(ret, out, BLS12_381_RR);
+}
+
+void blst_bendian_from_fp(unsigned char ret[48], const vec384 a)
+{
+    vec384 out;
+
+    from_fp(out, a);
+    be_bytes_from_limbs(ret, out, sizeof(vec384));
+}
+
+void blst_fp_from_lendian(vec384 ret, const unsigned char a[48])
+{
+    vec384 out;
+
+    limbs_from_le_bytes(out, a, sizeof(vec384));
+    mul_fp(ret, out, BLS12_381_RR);
+}
+
+void blst_lendian_from_fp(unsigned char ret[48], const vec384 a)
+{
+    vec384 out;
+
+    from_fp(out, a);
+    le_bytes_from_limbs(ret, out, sizeof(vec384));
+}
+
+/*
+ * BLS12-381-specific Fp2 shortcuts to assembly.
+ */
+void blst_fp2_add(vec384x ret, const vec384x a, const vec384x b)
+{   add_fp2(ret, a, b);   }
+
+void blst_fp2_sub(vec384x ret, const vec384x a, const vec384x b)
+{   sub_fp2(ret, a, b);   }
+
+void blst_fp2_mul_by_3(vec384x ret, const vec384x a)
+{   mul_by_3_fp2(ret, a);   }
+
+void blst_fp2_mul_by_8(vec384x ret, const vec384x a)
+{   mul_by_8_fp2(ret, a);   }
+
+void blst_fp2_lshift(vec384x ret, const vec384x a, size_t count)
+{   lshift_fp2(ret, a, count);    }
+
+void blst_fp2_mul(vec384x ret, const vec384x a, const vec384x b)
+{   mul_fp2(ret, a, b);   }
+
+void blst_fp2_sqr(vec384x ret, const vec384x a)
+{   sqr_fp2(ret, a);   }
+
+void blst_fp2_cneg(vec384x ret, const vec384x a, int flag)
+{   cneg_fp2(ret, a, is_zero(flag) ^ 1);   }
+
+/*
+ * Scalar serialization/deserialization.
+ */
+void blst_scalar_from_uint32(pow256 ret, const unsigned int a[8])
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+    size_t i;
+
+    if ((uptr_t)ret==(uptr_t)a && is_endian.little)
+        return;
+
+    for(i = 0; i < 8; i++) {
+        unsigned int w = a[i];
+        *ret++ = (byte)w;
+        *ret++ = (byte)(w >> 8);
+        *ret++ = (byte)(w >> 16);
+        *ret++ = (byte)(w >> 24);
+    }
+}
+
+void blst_uint32_from_scalar(unsigned int ret[8], const pow256 a)
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+    size_t i;
+
+    if ((uptr_t)ret==(uptr_t)a && is_endian.little)
+        return;
+
+    for(i = 0; i < 8; i++) {
+        unsigned int w = (unsigned int)(*a++);
+        w |= (unsigned int)(*a++) << 8;
+        w |= (unsigned int)(*a++) << 16;
+        w |= (unsigned int)(*a++) << 24;
+        ret[i] = w;
+    }
+}
+
+void blst_scalar_from_uint64(pow256 ret, const unsigned long long a[4])
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+    size_t i;
+
+    if ((uptr_t)ret==(uptr_t)a && is_endian.little)
+        return;
+
+    for(i = 0; i < 4; i++) {
+        unsigned long long w = a[i];
+        *ret++ = (byte)w;
+        *ret++ = (byte)(w >> 8);
+        *ret++ = (byte)(w >> 16);
+        *ret++ = (byte)(w >> 24);
+        *ret++ = (byte)(w >> 32);
+        *ret++ = (byte)(w >> 40);
+        *ret++ = (byte)(w >> 48);
+        *ret++ = (byte)(w >> 56);
+    }
+}
+
+void blst_uint64_from_scalar(unsigned long long ret[4], const pow256 a)
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+    size_t i;
+
+    if ((uptr_t)ret==(uptr_t)a && is_endian.little)
+        return;
+
+    for(i = 0; i < 4; i++) {
+        unsigned long long w = (unsigned long long)(*a++);
+        w |= (unsigned long long)(*a++) << 8;
+        w |= (unsigned long long)(*a++) << 16;
+        w |= (unsigned long long)(*a++) << 24;
+        w |= (unsigned long long)(*a++) << 32;
+        w |= (unsigned long long)(*a++) << 40;
+        w |= (unsigned long long)(*a++) << 48;
+        w |= (unsigned long long)(*a++) << 56;
+        ret[i] = w;
+    }
+}
+
+void blst_scalar_from_bendian(pow256 ret, const unsigned char a[32])
+{
+    vec256 out;
+    limbs_from_be_bytes(out, a, sizeof(out));
+    le_bytes_from_limbs(ret, out, sizeof(out));
+    vec_zero(out, sizeof(out));
+}
+
+void blst_bendian_from_scalar(unsigned char ret[32], const pow256 a)
+{
+    vec256 out;
+    limbs_from_le_bytes(out, a, sizeof(out));
+    be_bytes_from_limbs(ret, out, sizeof(out));
+    vec_zero(out, sizeof(out));
+}
+
+void blst_scalar_from_lendian(pow256 ret, const unsigned char a[32])
+{
+    size_t i;
+
+    if ((uptr_t)ret==(uptr_t)a)
+        return;
+
+    for (i = 0; i < 32; i++)
+        ret[i] = a[i];
+}
+
+void blst_lendian_from_scalar(unsigned char ret[32], const pow256 a)
+{
+    size_t i;
+
+    if ((uptr_t)ret==(uptr_t)a)
+        return;
+
+    for (i = 0; i < 32; i++)
+        ret[i] = a[i];
+}
+
+void blst_fr_from_uint64(vec256 ret, const unsigned long long a[4])
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+
+    if (sizeof(limb_t) == 4 && !is_endian.little) {
+        int i;
+        for (i = 0; i < 4; i++) {
+            unsigned long long limb = a[i];
+            ret[2*i]   = (limb_t)limb;
+            ret[2*i+1] = (limb_t)(limb >> 32);
+        }
+        a = (const unsigned long long *)ret;
+    }
+    mul_mont_sparse_256(ret, (const limb_t *)a, BLS12_381_rRR, BLS12_381_r, r0);
+}
+
+void blst_uint64_from_fr(unsigned long long ret[4], const vec256 a)
+{
+    const union {
+        long one;
+        char little;
+    } is_endian = { 1 };
+
+    if (sizeof(limb_t) == 8 || is_endian.little) {
+        from_mont_256((limb_t *)ret, a, BLS12_381_r, r0);
+    } else {
+        vec256 out;
+        int i;
+
+        from_mont_256(out, a, BLS12_381_r, r0);
+        for (i = 0; i < 4; i++)
+            ret[i] = out[2*i] | ((unsigned long long)out[2*i+1] << 32);
+        vec_zero(out, sizeof(out));
+    }
+}
+
+int blst_scalar_from_le_bytes(pow256 out, const unsigned char *bytes, size_t n)
+{
+    size_t rem = (n - 1) % 32 + 1;
+    struct { vec256 out, digit; } t;
+    limb_t ret;
+
+    vec_zero(t.out, sizeof(t.out));
+
+    n -= rem;
+    limbs_from_le_bytes(t.out, bytes += n, rem);
+    mul_mont_sparse_256(t.out, BLS12_381_rRR, t.out, BLS12_381_r, r0);
+
+    while (n) {
+        limbs_from_le_bytes(t.digit, bytes -= 32, 32);
+        add_mod_256(t.out, t.out, t.digit, BLS12_381_r);
+        mul_mont_sparse_256(t.out, BLS12_381_rRR, t.out, BLS12_381_r, r0);
+        n -= 32;
+    }
+
+    from_mont_256(t.out, t.out, BLS12_381_r, r0);
+
+    ret = vec_is_zero(t.out, sizeof(t.out));
+    le_bytes_from_limbs(out, t.out, 32);
+    vec_zero(&t, sizeof(t));
+
+    return (int)(ret^1);
+}
+
+int blst_scalar_from_be_bytes(pow256 out, const unsigned char *bytes, size_t n)
+{
+    size_t rem = (n - 1) % 32 + 1;
+    struct { vec256 out, digit; } t;
+    limb_t ret;
+
+    vec_zero(t.out, sizeof(t.out));
+
+    limbs_from_be_bytes(t.out, bytes, rem);
+    mul_mont_sparse_256(t.out, BLS12_381_rRR, t.out, BLS12_381_r, r0);
+
+    while (n -= rem) {
+        limbs_from_be_bytes(t.digit, bytes += rem, 32);
+        add_mod_256(t.out, t.out, t.digit, BLS12_381_r);
+        mul_mont_sparse_256(t.out, BLS12_381_rRR, t.out, BLS12_381_r, r0);
+        rem = 32;
+    }
+
+    from_mont_256(t.out, t.out, BLS12_381_r, r0);
+
+    ret = vec_is_zero(t.out, sizeof(t.out));
+    le_bytes_from_limbs(out, t.out, 32);
+    vec_zero(&t, sizeof(t));
+
+    return (int)(ret^1);
+}
+
+/*
+ * Single-short SHA-256 hash function.
+ */
+#include "sha256.h"
+
+void blst_sha256(unsigned char md[32], const void *msg, size_t len)
+{
+    SHA256_CTX ctx;
+
+    sha256_init(&ctx);
+    sha256_update(&ctx, msg, len);
+    sha256_final(md, &ctx);
+}
+
+/*
+ * Test facilitator.
+ */
+void blst_scalar_from_hexascii(pow256 ret, const char *hex)
+{   bytes_from_hexascii(ret, sizeof(pow256), hex);   }
+
+void blst_fr_from_hexascii(vec256 ret, const char *hex)
+{
+    limbs_from_hexascii(ret, sizeof(vec256), hex);
+    mul_mont_sparse_256(ret, ret, BLS12_381_rRR, BLS12_381_r, r0);
+}
+
+void blst_fp_from_hexascii(vec384 ret, const char *hex)
+{
+    limbs_from_hexascii(ret, sizeof(vec384), hex);
+    mul_fp(ret, ret, BLS12_381_RR);
+}
diff --git a/vendor/external/blst/src/fields.h b/vendor/external/blst/src/fields.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/fields.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __BLS12_381_ASM_FIELDS_H__
+#define __BLS12_381_ASM_FIELDS_H__
+
+#include "vect.h"
+#include "consts.h"
+
+/*
+ * BLS12-381-specific Fp shortcuts to assembly.
+ */
+static inline void add_fp(vec384 ret, const vec384 a, const vec384 b)
+{   add_mod_384(ret, a, b, BLS12_381_P);   }
+
+static inline void sub_fp(vec384 ret, const vec384 a, const vec384 b)
+{   sub_mod_384(ret, a, b, BLS12_381_P);   }
+
+static inline void mul_by_3_fp(vec384 ret, const vec384 a)
+{   mul_by_3_mod_384(ret, a, BLS12_381_P);   }
+
+static inline void mul_by_8_fp(vec384 ret, const vec384 a)
+{   mul_by_8_mod_384(ret, a, BLS12_381_P);   }
+
+static inline void lshift_fp(vec384 ret, const vec384 a, size_t count)
+{   lshift_mod_384(ret, a, count, BLS12_381_P);   }
+
+static inline void rshift_fp(vec384 ret, const vec384 a, size_t count)
+{   rshift_mod_384(ret, a, count, BLS12_381_P);   }
+
+static inline void div_by_2_fp(vec384 ret, const vec384 a)
+{   div_by_2_mod_384(ret, a, BLS12_381_P);   }
+
+static inline void mul_fp(vec384 ret, const vec384 a, const vec384 b)
+{   mul_mont_384(ret, a, b, BLS12_381_P, p0);   }
+
+static inline void sqr_fp(vec384 ret, const vec384 a)
+{   sqr_mont_384(ret, a, BLS12_381_P, p0);   }
+
+static inline void cneg_fp(vec384 ret, const vec384 a, bool_t flag)
+{   cneg_mod_384(ret, a, flag, BLS12_381_P);   }
+
+static inline void from_fp(vec384 ret, const vec384 a)
+{   from_mont_384(ret, a, BLS12_381_P, p0);   }
+
+static inline void redc_fp(vec384 ret, const vec768 a)
+{   redc_mont_384(ret, a, BLS12_381_P, p0);   }
+
+/*
+ * BLS12-381-specific Fp2 shortcuts to assembly.
+ */
+static inline void add_fp2(vec384x ret, const vec384x a, const vec384x b)
+{   add_mod_384x(ret, a, b, BLS12_381_P);   }
+
+static inline void sub_fp2(vec384x ret, const vec384x a, const vec384x b)
+{   sub_mod_384x(ret, a, b, BLS12_381_P);   }
+
+static inline void mul_by_3_fp2(vec384x ret, const vec384x a)
+{   mul_by_3_mod_384x(ret, a, BLS12_381_P);   }
+
+static inline void mul_by_8_fp2(vec384x ret, const vec384x a)
+{   mul_by_8_mod_384x(ret, a, BLS12_381_P);   }
+
+static inline void lshift_fp2(vec384x ret, const vec384x a, size_t count)
+{
+    lshift_mod_384(ret[0], a[0], count, BLS12_381_P);
+    lshift_mod_384(ret[1], a[1], count, BLS12_381_P);
+}
+
+static inline void mul_fp2(vec384x ret, const vec384x a, const vec384x b)
+{   mul_mont_384x(ret, a, b, BLS12_381_P, p0);   }
+
+static inline void sqr_fp2(vec384x ret, const vec384x a)
+{   sqr_mont_384x(ret, a, BLS12_381_P, p0);   }
+
+static inline void cneg_fp2(vec384x ret, const vec384x a, bool_t flag)
+{
+    cneg_mod_384(ret[0], a[0], flag, BLS12_381_P);
+    cneg_mod_384(ret[1], a[1], flag, BLS12_381_P);
+}
+
+#define vec_load_global vec_copy
+
+static void reciprocal_fp(vec384 out, const vec384 inp);
+static void flt_reciprocal_fp(vec384 out, const vec384 inp);
+static bool_t recip_sqrt_fp(vec384 out, const vec384 inp);
+static bool_t sqrt_fp(vec384 out, const vec384 inp);
+
+static void reciprocal_fp2(vec384x out, const vec384x inp);
+static void flt_reciprocal_fp2(vec384x out, const vec384x inp);
+static bool_t recip_sqrt_fp2(vec384x out, const vec384x inp,
+                             const vec384x recip_ZZZ, const vec384x magic_ZZZ);
+static bool_t sqrt_fp2(vec384x out, const vec384x inp);
+static bool_t sqrt_align_fp2(vec384x out, const vec384x ret,
+                             const vec384x sqrt, const vec384x inp);
+
+typedef vec384x   vec384fp2;
+typedef vec384fp2 vec384fp6[3];
+typedef vec384fp6 vec384fp12[2];
+
+static void sqr_fp12(vec384fp12 ret, const vec384fp12 a);
+static void cyclotomic_sqr_fp12(vec384fp12 ret, const vec384fp12 a);
+static void mul_fp12(vec384fp12 ret, const vec384fp12 a, const vec384fp12 b);
+static void mul_by_xy00z0_fp12(vec384fp12 ret, const vec384fp12 a,
+                                               const vec384fp6 xy00z0);
+static void conjugate_fp12(vec384fp12 a);
+static void inverse_fp12(vec384fp12 ret, const vec384fp12 a);
+/* caveat lector! |n| has to be non-zero and not more than 3! */
+static void frobenius_map_fp12(vec384fp12 ret, const vec384fp12 a, size_t n);
+
+#define neg_fp(r,a) cneg_fp((r),(a),1)
+#define neg_fp2(r,a) cneg_fp2((r),(a),1)
+
+#endif /* __BLS12_381_ASM_FIELDS_H__ */
diff --git a/vendor/external/blst/src/fp12_tower.c b/vendor/external/blst/src/fp12_tower.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/fp12_tower.c
@@ -0,0 +1,789 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "fields.h"
+
+/*
+ * Fp2  = Fp[u]  / (u^2 + 1)
+ * Fp6  = Fp2[v] / (v^3 - u - 1)
+ * Fp12 = Fp6[w] / (w^2 - v)
+ */
+
+static inline void mul_by_u_plus_1_fp2(vec384x ret, const vec384x a)
+{   mul_by_1_plus_i_mod_384x(ret, a, BLS12_381_P);   }
+
+#if 1 && !defined(__BLST_NO_ASM__)
+#define __FP2x2__
+/*
+ * Fp2x2 is a "widened" version of Fp2, which allows to consolidate
+ * reductions from several multiplications. In other words instead of
+ * "mul_redc-mul_redc-add" we get "mul-mul-add-redc," where latter
+ * addition is double-width... To be more specific this gives ~7-10%
+ * faster pairing depending on platform...
+ */
+typedef vec768 vec768x[2];
+
+static inline void add_fp2x2(vec768x ret, const vec768x a, const vec768x b)
+{
+    add_mod_384x384(ret[0], a[0], b[0], BLS12_381_P);
+    add_mod_384x384(ret[1], a[1], b[1], BLS12_381_P);
+}
+
+static inline void sub_fp2x2(vec768x ret, const vec768x a, const vec768x b)
+{
+    sub_mod_384x384(ret[0], a[0], b[0], BLS12_381_P);
+    sub_mod_384x384(ret[1], a[1], b[1], BLS12_381_P);
+}
+
+static inline void mul_by_u_plus_1_fp2x2(vec768x ret, const vec768x a)
+{
+    /* caveat lector! |ret| may not be same as |a| */
+    sub_mod_384x384(ret[0], a[0], a[1], BLS12_381_P);
+    add_mod_384x384(ret[1], a[0], a[1], BLS12_381_P);
+}
+
+static inline void redc_fp2x2(vec384x ret, const vec768x a)
+{
+    redc_mont_384(ret[0], a[0], BLS12_381_P, p0);
+    redc_mont_384(ret[1], a[1], BLS12_381_P, p0);
+}
+
+static void mul_fp2x2(vec768x ret, const vec384x a, const vec384x b)
+{
+#if 1
+    mul_382x(ret, a, b, BLS12_381_P);   /* +~6% in Miller loop */
+#else
+    union { vec384 x[2]; vec768 x2; } t;
+
+    add_mod_384(t.x[0], a[0], a[1], BLS12_381_P);
+    add_mod_384(t.x[1], b[0], b[1], BLS12_381_P);
+    mul_384(ret[1], t.x[0], t.x[1]);
+
+    mul_384(ret[0], a[0], b[0]);
+    mul_384(t.x2,   a[1], b[1]);
+
+    sub_mod_384x384(ret[1], ret[1], ret[0], BLS12_381_P);
+    sub_mod_384x384(ret[1], ret[1], t.x2, BLS12_381_P);
+
+    sub_mod_384x384(ret[0], ret[0], t.x2, BLS12_381_P);
+#endif
+}
+
+static void sqr_fp2x2(vec768x ret, const vec384x a)
+{
+#if 1
+    sqr_382x(ret, a, BLS12_381_P);      /* +~5% in final exponentiation */
+#else
+    vec384 t0, t1;
+
+    add_mod_384(t0, a[0], a[1], BLS12_381_P);
+    sub_mod_384(t1, a[0], a[1], BLS12_381_P);
+
+    mul_384(ret[1], a[0], a[1]);
+    add_mod_384x384(ret[1], ret[1], ret[1], BLS12_381_P);
+
+    mul_384(ret[0], t0, t1);
+#endif
+}
+#endif  /* __FP2x2__ */
+
+/*
+ * Fp6 extension
+ */
+#if defined(__FP2x2__)  /* ~10-13% improvement for mul_fp12 and sqr_fp12 */
+typedef vec768x vec768fp6[3];
+
+static inline void sub_fp6x2(vec768fp6 ret, const vec768fp6 a,
+                                            const vec768fp6 b)
+{
+    sub_fp2x2(ret[0], a[0], b[0]);
+    sub_fp2x2(ret[1], a[1], b[1]);
+    sub_fp2x2(ret[2], a[2], b[2]);
+}
+
+static void mul_fp6x2(vec768fp6 ret, const vec384fp6 a, const vec384fp6 b)
+{
+    vec768x t0, t1, t2;
+    vec384x aa, bb;
+
+    mul_fp2x2(t0, a[0], b[0]);
+    mul_fp2x2(t1, a[1], b[1]);
+    mul_fp2x2(t2, a[2], b[2]);
+
+    /* ret[0] = ((a1 + a2)*(b1 + b2) - a1*b1 - a2*b2)*(u+1) + a0*b0
+              = (a1*b2 + a2*b1)*(u+1) + a0*b0 */
+    add_fp2(aa, a[1], a[2]);
+    add_fp2(bb, b[1], b[2]);
+    mul_fp2x2(ret[0], aa, bb);
+    sub_fp2x2(ret[0], ret[0], t1);
+    sub_fp2x2(ret[0], ret[0], t2);
+    mul_by_u_plus_1_fp2x2(ret[1], ret[0]);  /* borrow ret[1] for a moment */
+    add_fp2x2(ret[0], ret[1], t0);
+
+    /* ret[1] = (a0 + a1)*(b0 + b1) - a0*b0 - a1*b1 + a2*b2*(u+1)
+              = a0*b1 + a1*b0 + a2*b2*(u+1) */
+    add_fp2(aa, a[0], a[1]);
+    add_fp2(bb, b[0], b[1]);
+    mul_fp2x2(ret[1], aa, bb);
+    sub_fp2x2(ret[1], ret[1], t0);
+    sub_fp2x2(ret[1], ret[1], t1);
+    mul_by_u_plus_1_fp2x2(ret[2], t2);      /* borrow ret[2] for a moment */
+    add_fp2x2(ret[1], ret[1], ret[2]);
+
+    /* ret[2] = (a0 + a2)*(b0 + b2) - a0*b0 - a2*b2 + a1*b1
+              = a0*b2 + a2*b0 + a1*b1 */
+    add_fp2(aa, a[0], a[2]);
+    add_fp2(bb, b[0], b[2]);
+    mul_fp2x2(ret[2], aa, bb);
+    sub_fp2x2(ret[2], ret[2], t0);
+    sub_fp2x2(ret[2], ret[2], t2);
+    add_fp2x2(ret[2], ret[2], t1);
+}
+
+static inline void redc_fp6x2(vec384fp6 ret, const vec768fp6 a)
+{
+    redc_fp2x2(ret[0], a[0]);
+    redc_fp2x2(ret[1], a[1]);
+    redc_fp2x2(ret[2], a[2]);
+}
+
+static void mul_fp6(vec384fp6 ret, const vec384fp6 a, const vec384fp6 b)
+{
+    vec768fp6 r;
+
+    mul_fp6x2(r, a, b);
+    redc_fp6x2(ret, r); /* narrow to normal width */
+}
+
+static void sqr_fp6(vec384fp6 ret, const vec384fp6 a)
+{
+    vec768x s0, m01, m12, s2, rx;
+
+    sqr_fp2x2(s0, a[0]);
+
+    mul_fp2x2(m01, a[0], a[1]);
+    add_fp2x2(m01, m01, m01);
+
+    mul_fp2x2(m12, a[1], a[2]);
+    add_fp2x2(m12, m12, m12);
+
+    sqr_fp2x2(s2, a[2]);
+
+    /* ret[2] = (a0 + a1 + a2)^2 - a0^2 - a2^2 - 2*(a0*a1) - 2*(a1*a2)
+              = a1^2 + 2*(a0*a2) */
+    add_fp2(ret[2], a[2], a[1]);
+    add_fp2(ret[2], ret[2], a[0]);
+    sqr_fp2x2(rx, ret[2]);
+    sub_fp2x2(rx, rx, s0);
+    sub_fp2x2(rx, rx, s2);
+    sub_fp2x2(rx, rx, m01);
+    sub_fp2x2(rx, rx, m12);
+    redc_fp2x2(ret[2], rx);
+
+    /* ret[0] = a0^2 + 2*(a1*a2)*(u+1) */
+    mul_by_u_plus_1_fp2x2(rx, m12);
+    add_fp2x2(rx, rx, s0);
+    redc_fp2x2(ret[0], rx);
+
+    /* ret[1] = a2^2*(u+1) + 2*(a0*a1) */
+    mul_by_u_plus_1_fp2x2(rx, s2);
+    add_fp2x2(rx, rx, m01);
+    redc_fp2x2(ret[1], rx);
+}
+#else
+static void mul_fp6(vec384fp6 ret, const vec384fp6 a, const vec384fp6 b)
+{
+    vec384x t0, t1, t2, t3, t4, t5;
+
+    mul_fp2(t0, a[0], b[0]);
+    mul_fp2(t1, a[1], b[1]);
+    mul_fp2(t2, a[2], b[2]);
+
+    /* ret[0] = ((a1 + a2)*(b1 + b2) - a1*b1 - a2*b2)*(u+1) + a0*b0
+              = (a1*b2 + a2*b1)*(u+1) + a0*b0 */
+    add_fp2(t4, a[1], a[2]);
+    add_fp2(t5, b[1], b[2]);
+    mul_fp2(t3, t4, t5);
+    sub_fp2(t3, t3, t1);
+    sub_fp2(t3, t3, t2);
+    mul_by_u_plus_1_fp2(t3, t3);
+    /* add_fp2(ret[0], t3, t0); considering possible aliasing... */
+
+    /* ret[1] = (a0 + a1)*(b0 + b1) - a0*b0 - a1*b1 + a2*b2*(u+1)
+              = a0*b1 + a1*b0 + a2*b2*(u+1) */
+    add_fp2(t4, a[0], a[1]);
+    add_fp2(t5, b[0], b[1]);
+    mul_fp2(ret[1], t4, t5);
+    sub_fp2(ret[1], ret[1], t0);
+    sub_fp2(ret[1], ret[1], t1);
+    mul_by_u_plus_1_fp2(t4, t2);
+    add_fp2(ret[1], ret[1], t4);
+
+    /* ret[2] = (a0 + a2)*(b0 + b2) - a0*b0 - a2*b2 + a1*b1
+              = a0*b2 + a2*b0 + a1*b1 */
+    add_fp2(t4, a[0], a[2]);
+    add_fp2(t5, b[0], b[2]);
+    mul_fp2(ret[2], t4, t5);
+    sub_fp2(ret[2], ret[2], t0);
+    sub_fp2(ret[2], ret[2], t2);
+    add_fp2(ret[2], ret[2], t1);
+
+    add_fp2(ret[0], t3, t0);    /* ... moved from above */
+}
+
+static void sqr_fp6(vec384fp6 ret, const vec384fp6 a)
+{
+    vec384x s0, m01, m12, s2;
+
+    sqr_fp2(s0, a[0]);
+
+    mul_fp2(m01, a[0], a[1]);
+    add_fp2(m01, m01, m01);
+
+    mul_fp2(m12, a[1], a[2]);
+    add_fp2(m12, m12, m12);
+
+    sqr_fp2(s2, a[2]);
+
+    /* ret[2] = (a0 + a1 + a2)^2 - a0^2 - a2^2 - 2*(a0*a1) - 2*(a1*a2)
+              = a1^2 + 2*(a0*a2) */
+    add_fp2(ret[2], a[2], a[1]);
+    add_fp2(ret[2], ret[2], a[0]);
+    sqr_fp2(ret[2], ret[2]);
+    sub_fp2(ret[2], ret[2], s0);
+    sub_fp2(ret[2], ret[2], s2);
+    sub_fp2(ret[2], ret[2], m01);
+    sub_fp2(ret[2], ret[2], m12);
+
+    /* ret[0] = a0^2 + 2*(a1*a2)*(u+1) */
+    mul_by_u_plus_1_fp2(ret[0], m12);
+    add_fp2(ret[0], ret[0], s0);
+
+    /* ret[1] = a2^2*(u+1) + 2*(a0*a1) */
+    mul_by_u_plus_1_fp2(ret[1], s2);
+    add_fp2(ret[1], ret[1], m01);
+}
+#endif
+
+static void add_fp6(vec384fp6 ret, const vec384fp6 a, const vec384fp6 b)
+{
+    add_fp2(ret[0], a[0], b[0]);
+    add_fp2(ret[1], a[1], b[1]);
+    add_fp2(ret[2], a[2], b[2]);
+}
+
+static void sub_fp6(vec384fp6 ret, const vec384fp6 a, const vec384fp6 b)
+{
+    sub_fp2(ret[0], a[0], b[0]);
+    sub_fp2(ret[1], a[1], b[1]);
+    sub_fp2(ret[2], a[2], b[2]);
+}
+
+static void neg_fp6(vec384fp6 ret, const vec384fp6 a)
+{
+    neg_fp2(ret[0], a[0]);
+    neg_fp2(ret[1], a[1]);
+    neg_fp2(ret[2], a[2]);
+}
+
+#if 0
+#define mul_by_v_fp6 mul_by_v_fp6
+static void mul_by_v_fp6(vec384fp6 ret, const vec384fp6 a)
+{
+    vec384x t;
+
+    mul_by_u_plus_1_fp2(t, a[2]);
+    vec_copy(ret[2], a[1], sizeof(a[1]));
+    vec_copy(ret[1], a[0], sizeof(a[0]));
+    vec_copy(ret[0], t, sizeof(t));
+}
+#endif
+
+/*
+ * Fp12 extension
+ */
+#if defined(__FP2x2__)
+static void mul_fp12(vec384fp12 ret, const vec384fp12 a, const vec384fp12 b)
+{
+    vec768fp6 t0, t1, rx;
+    vec384fp6 t2;
+
+    mul_fp6x2(t0, a[0], b[0]);
+    mul_fp6x2(t1, a[1], b[1]);
+
+    /* ret[1] = (a0 + a1)*(b0 + b1) - a0*b0 - a1*b1
+              = a0*b1 + a1*b0 */
+    add_fp6(t2, a[0], a[1]);
+    add_fp6(ret[1], b[0], b[1]);
+    mul_fp6x2(rx, ret[1], t2);
+    sub_fp6x2(rx, rx, t0);
+    sub_fp6x2(rx, rx, t1);
+    redc_fp6x2(ret[1], rx);
+
+    /* ret[0] = a0*b0 + a1*b1*v */
+    mul_by_u_plus_1_fp2x2(rx[0], t1[2]);
+    add_fp2x2(rx[0], t0[0], rx[0]);
+    add_fp2x2(rx[1], t0[1], t1[0]);
+    add_fp2x2(rx[2], t0[2], t1[1]);
+    redc_fp6x2(ret[0], rx);
+}
+
+static inline void mul_by_0y0_fp6x2(vec768fp6 ret, const vec384fp6 a,
+                                                   const vec384fp2 b)
+{
+    mul_fp2x2(ret[1], a[2], b);     /* borrow ret[1] for a moment */
+    mul_by_u_plus_1_fp2x2(ret[0], ret[1]);
+    mul_fp2x2(ret[1], a[0], b);
+    mul_fp2x2(ret[2], a[1], b);
+}
+
+static void mul_by_xy0_fp6x2(vec768fp6 ret, const vec384fp6 a,
+                                            const vec384fp6 b)
+{
+    vec768x t0, t1;
+    vec384x aa, bb;
+
+    mul_fp2x2(t0, a[0], b[0]);
+    mul_fp2x2(t1, a[1], b[1]);
+
+    /* ret[0] = ((a1 + a2)*(b1 + 0) - a1*b1 - a2*0)*(u+1) + a0*b0
+              = (a1*0 + a2*b1)*(u+1) + a0*b0 */
+    mul_fp2x2(ret[1], a[2], b[1]);  /* borrow ret[1] for a moment */
+    mul_by_u_plus_1_fp2x2(ret[0], ret[1]);
+    add_fp2x2(ret[0], ret[0], t0);
+
+    /* ret[1] = (a0 + a1)*(b0 + b1) - a0*b0 - a1*b1 + a2*0*(u+1)
+              = a0*b1 + a1*b0 + a2*0*(u+1) */
+    add_fp2(aa, a[0], a[1]);
+    add_fp2(bb, b[0], b[1]);
+    mul_fp2x2(ret[1], aa, bb);
+    sub_fp2x2(ret[1], ret[1], t0);
+    sub_fp2x2(ret[1], ret[1], t1);
+
+    /* ret[2] = (a0 + a2)*(b0 + 0) - a0*b0 - a2*0 + a1*b1
+              = a0*0 + a2*b0 + a1*b1 */
+    mul_fp2x2(ret[2], a[2], b[0]);
+    add_fp2x2(ret[2], ret[2], t1);
+}
+
+static void mul_by_xy00z0_fp12(vec384fp12 ret, const vec384fp12 a,
+                                               const vec384fp6 xy00z0)
+{
+    vec768fp6 t0, t1, rr;
+    vec384fp6 t2;
+
+    mul_by_xy0_fp6x2(t0, a[0], xy00z0);
+    mul_by_0y0_fp6x2(t1, a[1], xy00z0[2]);
+
+    /* ret[1] = (a0 + a1)*(b0 + b1) - a0*b0 - a1*b1
+              = a0*b1 + a1*b0 */
+    vec_copy(t2[0], xy00z0[0], sizeof(t2[0]));
+    add_fp2(t2[1], xy00z0[1], xy00z0[2]);
+    add_fp6(ret[1], a[0], a[1]);
+    mul_by_xy0_fp6x2(rr, ret[1], t2);
+    sub_fp6x2(rr, rr, t0);
+    sub_fp6x2(rr, rr, t1);
+    redc_fp6x2(ret[1], rr);
+
+    /* ret[0] = a0*b0 + a1*b1*v */
+    mul_by_u_plus_1_fp2x2(rr[0], t1[2]);
+    add_fp2x2(rr[0], t0[0], rr[0]);
+    add_fp2x2(rr[1], t0[1], t1[0]);
+    add_fp2x2(rr[2], t0[2], t1[1]);
+    redc_fp6x2(ret[0], rr);
+}
+#else
+static void mul_fp12(vec384fp12 ret, const vec384fp12 a, const vec384fp12 b)
+{
+    vec384fp6 t0, t1, t2;
+
+    mul_fp6(t0, a[0], b[0]);
+    mul_fp6(t1, a[1], b[1]);
+
+    /* ret[1] = (a0 + a1)*(b0 + b1) - a0*b0 - a1*b1
+              = a0*b1 + a1*b0 */
+    add_fp6(t2, a[0], a[1]);
+    add_fp6(ret[1], b[0], b[1]);
+    mul_fp6(ret[1], ret[1], t2);
+    sub_fp6(ret[1], ret[1], t0);
+    sub_fp6(ret[1], ret[1], t1);
+
+    /* ret[0] = a0*b0 + a1*b1*v */
+#ifdef mul_by_v_fp6
+    mul_by_v_fp6(t1, t1);
+    add_fp6(ret[0], t0, t1);
+#else
+    mul_by_u_plus_1_fp2(t1[2], t1[2]);
+    add_fp2(ret[0][0], t0[0], t1[2]);
+    add_fp2(ret[0][1], t0[1], t1[0]);
+    add_fp2(ret[0][2], t0[2], t1[1]);
+#endif
+}
+
+static inline void mul_by_0y0_fp6(vec384fp6 ret, const vec384fp6 a,
+                                                 const vec384fp2 b)
+{
+    vec384x t;
+
+    mul_fp2(t,      a[2], b);
+    mul_fp2(ret[2], a[1], b);
+    mul_fp2(ret[1], a[0], b);
+    mul_by_u_plus_1_fp2(ret[0], t);
+}
+
+static void mul_by_xy0_fp6(vec384fp6 ret, const vec384fp6 a, const vec384fp6 b)
+{
+    vec384x t0, t1, /*t2,*/ t3, t4, t5;
+
+    mul_fp2(t0, a[0], b[0]);
+    mul_fp2(t1, a[1], b[1]);
+
+    /* ret[0] = ((a1 + a2)*(b1 + 0) - a1*b1 - a2*0)*(u+1) + a0*b0
+              = (a1*0 + a2*b1)*(u+1) + a0*b0 */
+    mul_fp2(t3, a[2], b[1]);
+    mul_by_u_plus_1_fp2(t3, t3);
+    /* add_fp2(ret[0], t3, t0); considering possible aliasing... */
+
+    /* ret[1] = (a0 + a1)*(b0 + b1) - a0*b0 - a1*b1 + a2*0*(u+1)
+              = a0*b1 + a1*b0 + a2*0*(u+1) */
+    add_fp2(t4, a[0], a[1]);
+    add_fp2(t5, b[0], b[1]);
+    mul_fp2(ret[1], t4, t5);
+    sub_fp2(ret[1], ret[1], t0);
+    sub_fp2(ret[1], ret[1], t1);
+
+    /* ret[2] = (a0 + a2)*(b0 + 0) - a0*b0 - a2*0 + a1*b1
+              = a0*0 + a2*b0 + a1*b1 */
+    mul_fp2(ret[2], a[2], b[0]);
+    add_fp2(ret[2], ret[2], t1);
+
+    add_fp2(ret[0], t3, t0);    /* ... moved from above */
+}
+
+static void mul_by_xy00z0_fp12(vec384fp12 ret, const vec384fp12 a,
+                                               const vec384fp6 xy00z0)
+{
+    vec384fp6 t0, t1, t2;
+
+    mul_by_xy0_fp6(t0, a[0], xy00z0);
+    mul_by_0y0_fp6(t1, a[1], xy00z0[2]);
+
+    /* ret[1] = (a0 + a1)*(b0 + b1) - a0*b0 - a1*b1
+              = a0*b1 + a1*b0 */
+    vec_copy(t2[0], xy00z0[0], sizeof(t2[0]));
+    add_fp2(t2[1], xy00z0[1], xy00z0[2]);
+    add_fp6(ret[1], a[0], a[1]);
+    mul_by_xy0_fp6(ret[1], ret[1], t2);
+    sub_fp6(ret[1], ret[1], t0);
+    sub_fp6(ret[1], ret[1], t1);
+
+    /* ret[0] = a0*b0 + a1*b1*v */
+#ifdef mul_by_v_fp6
+    mul_by_v_fp6(t1, t1);
+    add_fp6(ret[0], t0, t1);
+#else
+    mul_by_u_plus_1_fp2(t1[2], t1[2]);
+    add_fp2(ret[0][0], t0[0], t1[2]);
+    add_fp2(ret[0][1], t0[1], t1[0]);
+    add_fp2(ret[0][2], t0[2], t1[1]);
+#endif
+}
+#endif
+
+static void sqr_fp12(vec384fp12 ret, const vec384fp12 a)
+{
+    vec384fp6 t0, t1;
+
+    add_fp6(t0, a[0], a[1]);
+#ifdef mul_by_v_fp6
+    mul_by_v_fp6(t1, a[1]);
+    add_fp6(t1, a[0], t1);
+#else
+    mul_by_u_plus_1_fp2(t1[2], a[1][2]);
+    add_fp2(t1[0], a[0][0], t1[2]);
+    add_fp2(t1[1], a[0][1], a[1][0]);
+    add_fp2(t1[2], a[0][2], a[1][1]);
+#endif
+    mul_fp6(t0, t0, t1);
+    mul_fp6(t1, a[0], a[1]);
+
+    /* ret[1] = 2*(a0*a1) */
+    add_fp6(ret[1], t1, t1);
+
+    /* ret[0] = (a0 + a1)*(a0 + a1*v) - a0*a1 - a0*a1*v
+              = a0^2 + a1^2*v */
+    sub_fp6(ret[0], t0, t1);
+#ifdef mul_by_v_fp6
+    mul_by_v_fp6(t1, t1);
+    sub_fp6(ret[0], ret[0], t1);
+#else
+    mul_by_u_plus_1_fp2(t1[2], t1[2]);
+    sub_fp2(ret[0][0], ret[0][0], t1[2]);
+    sub_fp2(ret[0][1], ret[0][1], t1[0]);
+    sub_fp2(ret[0][2], ret[0][2], t1[1]);
+#endif
+}
+
+static void conjugate_fp12(vec384fp12 a)
+{   neg_fp6(a[1], a[1]);   }
+
+static void inverse_fp6(vec384fp6 ret, const vec384fp6 a)
+{
+    vec384x c0, c1, c2, t0, t1;
+
+    /* c0 = a0^2 - (a1*a2)*(u+1) */
+    sqr_fp2(c0, a[0]);
+    mul_fp2(t0, a[1], a[2]);
+    mul_by_u_plus_1_fp2(t0, t0);
+    sub_fp2(c0, c0, t0);
+
+    /* c1 = a2^2*(u+1) - (a0*a1) */
+    sqr_fp2(c1, a[2]);
+    mul_by_u_plus_1_fp2(c1, c1);
+    mul_fp2(t0, a[0], a[1]);
+    sub_fp2(c1, c1, t0);
+
+    /* c2 = a1^2 - a0*a2 */
+    sqr_fp2(c2, a[1]);
+    mul_fp2(t0, a[0], a[2]);
+    sub_fp2(c2, c2, t0);
+
+    /* (a2*c1 + a1*c2)*(u+1) + a0*c0 */
+    mul_fp2(t0, c1, a[2]);
+    mul_fp2(t1, c2, a[1]);
+    add_fp2(t0, t0, t1);
+    mul_by_u_plus_1_fp2(t0, t0);
+    mul_fp2(t1, c0, a[0]);
+    add_fp2(t0, t0, t1);
+
+    reciprocal_fp2(t1, t0);
+
+    mul_fp2(ret[0], c0, t1);
+    mul_fp2(ret[1], c1, t1);
+    mul_fp2(ret[2], c2, t1);
+}
+
+static void inverse_fp12(vec384fp12 ret, const vec384fp12 a)
+{
+    vec384fp6 t0, t1;
+
+    sqr_fp6(t0, a[0]);
+    sqr_fp6(t1, a[1]);
+#ifdef mul_by_v_fp6
+    mul_by_v_fp6(t1, t1);
+    sub_fp6(t0, t0, t1);
+#else
+    mul_by_u_plus_1_fp2(t1[2], t1[2]);
+    sub_fp2(t0[0], t0[0], t1[2]);
+    sub_fp2(t0[1], t0[1], t1[0]);
+    sub_fp2(t0[2], t0[2], t1[1]);
+#endif
+
+    inverse_fp6(t1, t0);
+
+    mul_fp6(ret[0], a[0], t1);
+    mul_fp6(ret[1], a[1], t1);
+    neg_fp6(ret[1], ret[1]);
+}
+
+typedef vec384x vec384fp4[2];
+
+#if defined(__FP2x2__)
+static void sqr_fp4(vec384fp4 ret, const vec384x a0, const vec384x a1)
+{
+    vec768x t0, t1, t2;
+
+    sqr_fp2x2(t0, a0);
+    sqr_fp2x2(t1, a1);
+    add_fp2(ret[1], a0, a1);
+
+    mul_by_u_plus_1_fp2x2(t2, t1);
+    add_fp2x2(t2, t2, t0);
+    redc_fp2x2(ret[0], t2);
+
+    sqr_fp2x2(t2, ret[1]);
+    sub_fp2x2(t2, t2, t0);
+    sub_fp2x2(t2, t2, t1);
+    redc_fp2x2(ret[1], t2);
+}
+#else
+static void sqr_fp4(vec384fp4 ret, const vec384x a0, const vec384x a1)
+{
+    vec384x t0, t1;
+
+    sqr_fp2(t0, a0);
+    sqr_fp2(t1, a1);
+    add_fp2(ret[1], a0, a1);
+
+    mul_by_u_plus_1_fp2(ret[0], t1);
+    add_fp2(ret[0], ret[0], t0);
+
+    sqr_fp2(ret[1], ret[1]);
+    sub_fp2(ret[1], ret[1], t0);
+    sub_fp2(ret[1], ret[1], t1);
+}
+#endif
+
+static void cyclotomic_sqr_fp12(vec384fp12 ret, const vec384fp12 a)
+{
+    vec384fp4 t0, t1, t2;
+
+    sqr_fp4(t0, a[0][0], a[1][1]);
+    sqr_fp4(t1, a[1][0], a[0][2]);
+    sqr_fp4(t2, a[0][1], a[1][2]);
+
+    sub_fp2(ret[0][0], t0[0],     a[0][0]);
+    add_fp2(ret[0][0], ret[0][0], ret[0][0]);
+    add_fp2(ret[0][0], ret[0][0], t0[0]);
+
+    sub_fp2(ret[0][1], t1[0],     a[0][1]);
+    add_fp2(ret[0][1], ret[0][1], ret[0][1]);
+    add_fp2(ret[0][1], ret[0][1], t1[0]);
+
+    sub_fp2(ret[0][2], t2[0],     a[0][2]);
+    add_fp2(ret[0][2], ret[0][2], ret[0][2]);
+    add_fp2(ret[0][2], ret[0][2], t2[0]);
+
+    mul_by_u_plus_1_fp2(t2[1], t2[1]);
+    add_fp2(ret[1][0], t2[1],     a[1][0]);
+    add_fp2(ret[1][0], ret[1][0], ret[1][0]);
+    add_fp2(ret[1][0], ret[1][0], t2[1]);
+
+    add_fp2(ret[1][1], t0[1],     a[1][1]);
+    add_fp2(ret[1][1], ret[1][1], ret[1][1]);
+    add_fp2(ret[1][1], ret[1][1], t0[1]);
+
+    add_fp2(ret[1][2], t1[1],     a[1][2]);
+    add_fp2(ret[1][2], ret[1][2], ret[1][2]);
+    add_fp2(ret[1][2], ret[1][2], t1[1]);
+}
+
+/*
+ * caveat lector! |n| has to be non-zero and not more than 3!
+ */
+static inline void frobenius_map_fp2(vec384x ret, const vec384x a, size_t n)
+{
+    vec_copy(ret[0], a[0], sizeof(ret[0]));
+    cneg_fp(ret[1], a[1], n & 1);
+}
+
+static void frobenius_map_fp6(vec384fp6 ret, const vec384fp6 a, size_t n)
+{
+    static const vec384x coeffs1[] = {  /* (u + 1)^((P^n - 1) / 3) */
+      { { 0 },
+        { TO_LIMB_T(0xcd03c9e48671f071), TO_LIMB_T(0x5dab22461fcda5d2),
+          TO_LIMB_T(0x587042afd3851b95), TO_LIMB_T(0x8eb60ebe01bacb9e),
+          TO_LIMB_T(0x03f97d6e83d050d2), TO_LIMB_T(0x18f0206554638741) } },
+      { { TO_LIMB_T(0x30f1361b798a64e8), TO_LIMB_T(0xf3b8ddab7ece5a2a),
+          TO_LIMB_T(0x16a8ca3ac61577f7), TO_LIMB_T(0xc26a2ff874fd029b),
+          TO_LIMB_T(0x3636b76660701c6e), TO_LIMB_T(0x051ba4ab241b6160) } },
+      { { 0 }, { ONE_MONT_P } }
+    };
+    static const vec384 coeffs2[] = {  /* (u + 1)^((2P^n - 2) / 3) */
+      {   TO_LIMB_T(0x890dc9e4867545c3), TO_LIMB_T(0x2af322533285a5d5),
+          TO_LIMB_T(0x50880866309b7e2c), TO_LIMB_T(0xa20d1b8c7e881024),
+          TO_LIMB_T(0x14e4f04fe2db9068), TO_LIMB_T(0x14e56d3f1564853a)   },
+      {   TO_LIMB_T(0xcd03c9e48671f071), TO_LIMB_T(0x5dab22461fcda5d2),
+          TO_LIMB_T(0x587042afd3851b95), TO_LIMB_T(0x8eb60ebe01bacb9e),
+          TO_LIMB_T(0x03f97d6e83d050d2), TO_LIMB_T(0x18f0206554638741)   },
+      {   TO_LIMB_T(0x43f5fffffffcaaae), TO_LIMB_T(0x32b7fff2ed47fffd),
+          TO_LIMB_T(0x07e83a49a2e99d69), TO_LIMB_T(0xeca8f3318332bb7a),
+          TO_LIMB_T(0xef148d1ea0f4c069), TO_LIMB_T(0x040ab3263eff0206)   }
+    };
+
+    frobenius_map_fp2(ret[0], a[0], n);
+    frobenius_map_fp2(ret[1], a[1], n);
+    frobenius_map_fp2(ret[2], a[2], n);
+    --n;    /* implied ONE_MONT_P at index 0 */
+    mul_fp2(ret[1], ret[1], coeffs1[n]);
+    mul_fp(ret[2][0], ret[2][0], coeffs2[n]);
+    mul_fp(ret[2][1], ret[2][1], coeffs2[n]);
+}
+
+static void frobenius_map_fp12(vec384fp12 ret, const vec384fp12 a, size_t n)
+{
+    static const vec384x coeffs[] = {  /* (u + 1)^((P^n - 1) / 6) */
+      { { TO_LIMB_T(0x07089552b319d465), TO_LIMB_T(0xc6695f92b50a8313),
+          TO_LIMB_T(0x97e83cccd117228f), TO_LIMB_T(0xa35baecab2dc29ee),
+          TO_LIMB_T(0x1ce393ea5daace4d), TO_LIMB_T(0x08f2220fb0fb66eb) },
+	{ TO_LIMB_T(0xb2f66aad4ce5d646), TO_LIMB_T(0x5842a06bfc497cec),
+          TO_LIMB_T(0xcf4895d42599d394), TO_LIMB_T(0xc11b9cba40a8e8d0),
+          TO_LIMB_T(0x2e3813cbe5a0de89), TO_LIMB_T(0x110eefda88847faf) } },
+      { { TO_LIMB_T(0xecfb361b798dba3a), TO_LIMB_T(0xc100ddb891865a2c),
+          TO_LIMB_T(0x0ec08ff1232bda8e), TO_LIMB_T(0xd5c13cc6f1ca4721),
+          TO_LIMB_T(0x47222a47bf7b5c04), TO_LIMB_T(0x0110f184e51c5f59) } },
+      { { TO_LIMB_T(0x3e2f585da55c9ad1), TO_LIMB_T(0x4294213d86c18183),
+          TO_LIMB_T(0x382844c88b623732), TO_LIMB_T(0x92ad2afd19103e18),
+          TO_LIMB_T(0x1d794e4fac7cf0b9), TO_LIMB_T(0x0bd592fc7d825ec8) },
+	{ TO_LIMB_T(0x7bcfa7a25aa30fda), TO_LIMB_T(0xdc17dec12a927e7c),
+          TO_LIMB_T(0x2f088dd86b4ebef1), TO_LIMB_T(0xd1ca2087da74d4a7),
+          TO_LIMB_T(0x2da2596696cebc1d), TO_LIMB_T(0x0e2b7eedbbfd87d2) } },
+    };
+
+    frobenius_map_fp6(ret[0], a[0], n);
+    frobenius_map_fp6(ret[1], a[1], n);
+    --n;    /* implied ONE_MONT_P at index 0 */
+    mul_fp2(ret[1][0], ret[1][0], coeffs[n]);
+    mul_fp2(ret[1][1], ret[1][1], coeffs[n]);
+    mul_fp2(ret[1][2], ret[1][2], coeffs[n]);
+}
+
+
+/*
+ * BLS12-381-specific Fp12 shortcuts.
+ */
+void blst_fp12_sqr(vec384fp12 ret, const vec384fp12 a)
+{   sqr_fp12(ret, a);   }
+
+void blst_fp12_cyclotomic_sqr(vec384fp12 ret, const vec384fp12 a)
+{   cyclotomic_sqr_fp12(ret, a);   }
+
+void blst_fp12_mul(vec384fp12 ret, const vec384fp12 a, const vec384fp12 b)
+{   mul_fp12(ret, a, b);   }
+
+void blst_fp12_mul_by_xy00z0(vec384fp12 ret, const vec384fp12 a,
+                                             const vec384fp6 xy00z0)
+{   mul_by_xy00z0_fp12(ret, a, xy00z0);   }
+
+void blst_fp12_conjugate(vec384fp12 a)
+{   conjugate_fp12(a);   }
+
+void blst_fp12_inverse(vec384fp12 ret, const vec384fp12 a)
+{   inverse_fp12(ret, a);   }
+
+/* caveat lector! |n| has to be non-zero and not more than 3! */
+void blst_fp12_frobenius_map(vec384fp12 ret, const vec384fp12 a, size_t n)
+{   frobenius_map_fp12(ret, a, n);   }
+
+int blst_fp12_is_equal(const vec384fp12 a, const vec384fp12 b)
+{   return (int)vec_is_equal(a, b, sizeof(vec384fp12));   }
+
+int blst_fp12_is_one(const vec384fp12 a)
+{
+    return (int)(vec_is_equal(a[0][0], BLS12_381_Rx.p2, sizeof(a[0][0])) &
+                 vec_is_zero(a[0][1], sizeof(vec384fp12) - sizeof(a[0][0])));
+}
+
+const vec384fp12 *blst_fp12_one(void)
+{   return (const vec384fp12 *)BLS12_381_Rx.p12;   }
+
+void blst_bendian_from_fp12(unsigned char ret[48*12], const vec384fp12 a)
+{
+    size_t i, j;
+    vec384 out;
+
+    for (i = 0; i < 3; i++) {
+        for (j = 0; j < 2; j++) {
+            from_fp(out, a[j][i][0]);
+            be_bytes_from_limbs(ret, out, sizeof(vec384));  ret += 48;
+            from_fp(out, a[j][i][1]);
+            be_bytes_from_limbs(ret, out, sizeof(vec384));  ret += 48;
+        }
+    }
+}
+
+size_t blst_fp12_sizeof(void)
+{   return sizeof(vec384fp12);   }
diff --git a/vendor/external/blst/src/hash_to_field.c b/vendor/external/blst/src/hash_to_field.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/hash_to_field.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "consts.h"
+#include "sha256.h"
+
+static const vec384 BLS12_381_RRRR = {  /* RR^2 */
+    TO_LIMB_T(0xed48ac6bd94ca1e0), TO_LIMB_T(0x315f831e03a7adf8),
+    TO_LIMB_T(0x9a53352a615e29dd), TO_LIMB_T(0x34c04e5e921e1761),
+    TO_LIMB_T(0x2512d43565724728), TO_LIMB_T(0x0aa6346091755d4d)
+};
+
+#ifdef expand_message_xmd
+void expand_message_xmd(unsigned char *bytes, size_t len_in_bytes,
+                        const unsigned char *aug, size_t aug_len,
+                        const unsigned char *msg, size_t msg_len,
+                        const unsigned char *DST, size_t DST_len);
+#else
+static void sha256_init_Zpad(SHA256_CTX *ctx)
+{
+    ctx->h[0] = 0xda5698beU;
+    ctx->h[1] = 0x17b9b469U;
+    ctx->h[2] = 0x62335799U;
+    ctx->h[3] = 0x779fbecaU;
+    ctx->h[4] = 0x8ce5d491U;
+    ctx->h[5] = 0xc0d26243U;
+    ctx->h[6] = 0xbafef9eaU;
+    ctx->h[7] = 0x1837a9d8U;
+    ctx->N = 64;
+    vec_zero(ctx->buf, sizeof(ctx->buf));
+    ctx->off = 0;
+}
+
+static void vec_xor(void *restrict ret, const void *restrict a,
+                                        const void *restrict b, size_t num)
+{
+    limb_t *rp = (limb_t *)ret;
+    const limb_t *ap = (const limb_t *)a;
+    const limb_t *bp = (const limb_t *)b;
+    size_t i;
+
+    num /= sizeof(limb_t);
+
+    for (i = 0; i < num; i++)
+        rp[i] = ap[i] ^ bp[i];
+}
+
+static void expand_message_xmd(unsigned char *bytes, size_t len_in_bytes,
+                               const unsigned char *aug, size_t aug_len,
+                               const unsigned char *msg, size_t msg_len,
+                               const unsigned char *DST, size_t DST_len)
+{
+    union { limb_t align; unsigned char c[32]; } b_0;
+    union { limb_t align; unsigned char c[33+256+31]; } b_i;
+    unsigned char *p;
+    size_t i, b_i_bits, b_i_blocks;
+    SHA256_CTX ctx;
+
+    /*
+     * compose template for 'strxor(b_0, b_(i-1)) || I2OSP(i, 1) || DST_prime'
+     */
+    if (DST_len > 255) {
+        sha256_init(&ctx);
+        sha256_update(&ctx, "H2C-OVERSIZE-DST-", 17);
+        sha256_update(&ctx, DST, DST_len);
+        sha256_final(b_0.c, &ctx);
+        DST = b_0.c, DST_len = 32;
+    }
+    b_i_blocks = ((33 + DST_len + 1 + 9) + 63) & -64;
+    vec_zero(b_i.c + b_i_blocks - 64, 64);
+
+    p = b_i.c + 33;
+    for (i = 0; i < DST_len; i++)
+        p[i] = DST[i];
+    p[i++] = (unsigned char)DST_len;
+    p[i++] = 0x80;
+    p[i+6] = p[i+5] = p[i+4] = p[i+3] = p[i+2] = p[i+1] = p[i+0] = 0;
+    b_i_bits = (33 + DST_len + 1) * 8;
+    p = b_i.c + b_i_blocks;
+    p[-2] = (unsigned char)(b_i_bits >> 8);
+    p[-1] = (unsigned char)(b_i_bits);
+
+    sha256_init_Zpad(&ctx);                         /* Z_pad | */
+    sha256_update(&ctx, aug, aug_len);              /* | aug | */
+    sha256_update(&ctx, msg, msg_len);              /* | msg | */
+    /* | I2OSP(len_in_bytes, 2) || I2OSP(0, 1) || DST_prime    */
+    b_i.c[30] = (unsigned char)(len_in_bytes >> 8);
+    b_i.c[31] = (unsigned char)(len_in_bytes);
+    b_i.c[32] = 0;
+    sha256_update(&ctx, b_i.c + 30, 3 + DST_len + 1);
+    sha256_final(b_0.c, &ctx);
+
+    sha256_init_h(ctx.h);
+    vec_copy(b_i.c, b_0.c, 32);
+    ++b_i.c[32];
+    sha256_block_data_order(ctx.h, b_i.c, b_i_blocks / 64);
+    sha256_emit(bytes, ctx.h);
+
+    len_in_bytes += 31; /* ell = ceil(len_in_bytes / b_in_bytes), with */
+    len_in_bytes /= 32; /* caller being responsible for accordingly large
+                         * buffer. hash_to_field passes one with length
+                         * divisible by 64, remember? which works... */
+    while (--len_in_bytes) {
+        sha256_init_h(ctx.h);
+        vec_xor(b_i.c, b_0.c, bytes, 32);
+        bytes += 32;
+        ++b_i.c[32];
+        sha256_block_data_order(ctx.h, b_i.c, b_i_blocks / 64);
+        sha256_emit(bytes, ctx.h);
+    }
+}
+#endif
+
+/*
+ * |nelems| is 'count * m' from spec
+ */
+static void hash_to_field(vec384 elems[], size_t nelems,
+                          const unsigned char *aug, size_t aug_len,
+                          const unsigned char *msg, size_t msg_len,
+                          const unsigned char *DST, size_t DST_len)
+{
+    size_t L = sizeof(vec384) + 128/8;  /* ceil((ceil(log2(p)) + k) / 8) */
+    size_t len_in_bytes = L * nelems;   /* divisible by 64, hurray!      */
+#if !defined(__STDC_VERSION__) || __STDC_VERSION__<199901 \
+                               || defined(__STDC_NO_VLA__)
+    limb_t *pseudo_random = alloca(len_in_bytes);
+#else
+    limb_t pseudo_random[len_in_bytes/sizeof(limb_t)];
+#endif
+    unsigned char *bytes;
+    vec768 elem;
+
+    aug_len = aug!=NULL ? aug_len : 0;
+    DST_len = DST!=NULL ? DST_len : 0;
+
+    expand_message_xmd((unsigned char *)pseudo_random, len_in_bytes,
+                       aug, aug_len, msg, msg_len, DST, DST_len);
+
+    vec_zero(elem, sizeof(elem));
+    bytes = (unsigned char *)pseudo_random;
+    while (nelems--) {
+        limbs_from_be_bytes(elem, bytes, L);
+        bytes += L;
+        /*
+         * L-bytes block % P, output is in Montgomery domain...
+         */
+        redc_mont_384(elems[0], elem, BLS12_381_P, p0);
+        mul_mont_384(elems[0], elems[0], BLS12_381_RRRR, BLS12_381_P, p0);
+        elems++;
+    }
+}
+
+void blst_expand_message_xmd(unsigned char *bytes, size_t len_in_bytes,
+                             const unsigned char *msg, size_t msg_len,
+                             const unsigned char *DST, size_t DST_len)
+{
+    size_t buf_len = (len_in_bytes+31) & ((size_t)0-32);
+    unsigned char *buf_ptr = bytes;
+
+    if (buf_len > 255*32)
+        return;
+
+    if (buf_len != len_in_bytes)
+        buf_ptr = alloca(buf_len);
+
+    expand_message_xmd(buf_ptr, len_in_bytes, NULL, 0, msg, msg_len,
+                                              DST, DST_len);
+    if (buf_ptr != bytes) {
+        unsigned char *ptr = buf_ptr;
+        while (len_in_bytes--)
+            *bytes++ = *ptr++;
+        vec_zero(buf_ptr, buf_len);
+    }
+}
diff --git a/vendor/external/blst/src/keygen.c b/vendor/external/blst/src/keygen.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/keygen.c
@@ -0,0 +1,319 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "consts.h"
+#include "bytes.h"
+#include "sha256.h"
+
+typedef struct {
+    SHA256_CTX ctx;
+    unsigned int h_ipad[8];
+    unsigned int h_opad[8];
+    union { limb_t l[64/sizeof(limb_t)]; unsigned char c[64]; } tail;
+} HMAC_SHA256_CTX;
+
+static void HMAC_init(HMAC_SHA256_CTX *ctx, const void *K, size_t K_len)
+{
+    size_t i;
+
+    if (K == NULL) {            /* reuse h_ipad and h_opad */
+        sha256_hcopy(ctx->ctx.h, ctx->h_ipad);
+        ctx->ctx.N = 64;
+        vec_zero(ctx->ctx.buf, sizeof(ctx->ctx.buf));
+        ctx->ctx.off = 0;
+
+        return;
+    }
+
+    vec_zero(ctx->tail.c, sizeof(ctx->tail));
+    if (K_len > 64) {
+        sha256_init(&ctx->ctx);
+        sha256_update(&ctx->ctx, K, K_len);
+        sha256_final(ctx->tail.c, &ctx->ctx);
+    } else {
+        sha256_bcopy(ctx->tail.c, K, K_len);
+    }
+
+    for (i = 0; i < 64/sizeof(limb_t); i++)
+        ctx->tail.l[i] ^= (limb_t)0x3636363636363636;
+
+    sha256_init(&ctx->ctx);
+    sha256_update(&ctx->ctx, ctx->tail.c, 64);
+    sha256_hcopy(ctx->h_ipad, ctx->ctx.h);
+
+    for (i = 0; i < 64/sizeof(limb_t); i++)
+        ctx->tail.l[i] ^= (limb_t)(0x3636363636363636 ^ 0x5c5c5c5c5c5c5c5c);
+
+    sha256_init_h(ctx->h_opad);
+    sha256_block_data_order(ctx->h_opad, ctx->tail.c, 1);
+
+    vec_zero(ctx->tail.c, sizeof(ctx->tail));
+    ctx->tail.c[32] = 0x80;
+    ctx->tail.c[62] = 3;        /* (64+32)*8 in big endian */
+    ctx->tail.c[63] = 0;
+}
+
+static void HMAC_update(HMAC_SHA256_CTX *ctx, const unsigned char *inp,
+                                              size_t len)
+{   sha256_update(&ctx->ctx, inp, len);   }
+
+static void HMAC_final(unsigned char md[32], HMAC_SHA256_CTX *ctx)
+{
+    sha256_final(ctx->tail.c, &ctx->ctx);
+    sha256_hcopy(ctx->ctx.h, ctx->h_opad);
+    sha256_block_data_order(ctx->ctx.h, ctx->tail.c, 1);
+    sha256_emit(md, ctx->ctx.h);
+}
+
+static void HKDF_Extract(unsigned char PRK[32],
+                         const void *salt, size_t salt_len,
+                         const void *IKM,  size_t IKM_len,
+#ifndef __BLST_HKDF_TESTMODE__
+                         int IKM_fixup,
+#endif
+                         HMAC_SHA256_CTX *ctx)
+{
+    unsigned char zero[1] = { 0 };
+
+    HMAC_init(ctx, salt != NULL ? salt : zero, salt_len);
+    HMAC_update(ctx, IKM, IKM_len);
+#ifndef __BLST_HKDF_TESTMODE__
+    if (IKM_fixup) {
+        /* Section 2.3 KeyGen in BLS-signature draft */
+        HMAC_update(ctx, zero, 1);
+    }
+#endif
+    HMAC_final(PRK, ctx);
+}
+
+static void HKDF_Expand(unsigned char *OKM, size_t L,
+                        const unsigned char PRK[32],
+                        const void *info, size_t info_len,
+#ifndef __BLST_HKDF_TESTMODE__
+                        int info_fixup,
+#endif
+                        HMAC_SHA256_CTX *ctx)
+{
+#if !defined(__STDC_VERSION__) || __STDC_VERSION__<199901 \
+                               || defined(__STDC_NO_VLA__)
+    unsigned char *info_prime = alloca(info_len + 2 + 1);
+#else
+    unsigned char info_prime[info_len + 2 + 1];
+#endif
+
+    HMAC_init(ctx, PRK, 32);
+
+    if (info_len != 0)
+        sha256_bcopy(info_prime, info, info_len);
+#ifndef __BLST_HKDF_TESTMODE__
+    if (info_fixup) {
+        /* Section 2.3 KeyGen in BLS-signature draft */
+        info_prime[info_len + 0] = (unsigned char)(L >> 8);
+        info_prime[info_len + 1] = (unsigned char)(L);
+        info_len += 2;
+    }
+#endif
+    info_prime[info_len] = 1;   /* counter */
+    HMAC_update(ctx, info_prime, info_len + 1);
+    HMAC_final(ctx->tail.c, ctx);
+    while (L > 32) {
+        sha256_hcopy((unsigned int *)OKM, (const unsigned int *)ctx->tail.c);
+        OKM += 32; L -= 32;
+        ++info_prime[info_len]; /* counter */
+        HMAC_init(ctx, NULL, 0);
+        HMAC_update(ctx, ctx->tail.c, 32);
+        HMAC_update(ctx, info_prime, info_len + 1);
+        HMAC_final(ctx->tail.c, ctx);
+    }
+    sha256_bcopy(OKM, ctx->tail.c, L);
+}
+
+#ifndef __BLST_HKDF_TESTMODE__
+static void keygen(pow256 SK, const void *IKM, size_t IKM_len,
+                              const void *salt, size_t salt_len,
+                              const void *info, size_t info_len,
+                              int version)
+{
+    struct {
+        HMAC_SHA256_CTX ctx;
+        unsigned char PRK[32], OKM[48];
+        vec512 key;
+    } scratch;
+    unsigned char salt_prime[32] = "BLS-SIG-KEYGEN-SALT-";
+
+    if (IKM_len < 32 || (version > 4 && salt == NULL)) {
+        vec_zero(SK, sizeof(pow256));
+        return;
+    }
+
+    /*
+     * Vet |info| since some callers were caught to be sloppy, e.g.
+     * SWIG-4.0-generated Python wrapper...
+     */
+    info_len = info==NULL ? 0 : info_len;
+
+    if (salt == NULL) {
+        salt = salt_prime;
+        salt_len = 20;
+    }
+
+    if (version == 4) {
+        /* salt = H(salt) */
+        sha256_init(&scratch.ctx.ctx);
+        sha256_update(&scratch.ctx.ctx, salt, salt_len);
+        sha256_final(salt_prime, &scratch.ctx.ctx);
+        salt = salt_prime;
+        salt_len = sizeof(salt_prime);
+    }
+
+    while (1) {
+        /* PRK = HKDF-Extract(salt, IKM || I2OSP(0, 1)) */
+        HKDF_Extract(scratch.PRK, salt, salt_len,
+                                  IKM, IKM_len, 1, &scratch.ctx);
+
+        /* OKM = HKDF-Expand(PRK, key_info || I2OSP(L, 2), L) */
+        HKDF_Expand(scratch.OKM, sizeof(scratch.OKM), scratch.PRK,
+                    info, info_len, 1, &scratch.ctx);
+
+        /* SK = OS2IP(OKM) mod r */
+        vec_zero(scratch.key, sizeof(scratch.key));
+        limbs_from_be_bytes(scratch.key, scratch.OKM, sizeof(scratch.OKM));
+        redc_mont_256(scratch.key, scratch.key, BLS12_381_r, r0);
+        /*
+         * Given that mul_mont_sparse_256 has special boundary conditions
+         * it's appropriate to mention that redc_mont_256 output is fully
+         * reduced at this point. Because we started with 384-bit input,
+         * one with most significant half smaller than the modulus.
+         */
+        mul_mont_sparse_256(scratch.key, scratch.key, BLS12_381_rRR,
+                            BLS12_381_r, r0);
+
+        if (version < 4 || !vec_is_zero(scratch.key, sizeof(vec256)))
+            break;
+
+        /* salt = H(salt) */
+        sha256_init(&scratch.ctx.ctx);
+        sha256_update(&scratch.ctx.ctx, salt, salt_len);
+        sha256_final(salt_prime, &scratch.ctx.ctx);
+        salt = salt_prime;
+        salt_len = sizeof(salt_prime);
+    }
+
+    le_bytes_from_limbs(SK, scratch.key, sizeof(pow256));
+
+    /*
+     * scrub the stack just in case next callee inadvertently flashes
+     * a fragment across application boundary...
+     */
+    vec_zero(&scratch, sizeof(scratch));
+}
+
+void blst_keygen(pow256 SK, const void *IKM, size_t IKM_len,
+                            const void *info, size_t info_len)
+{   keygen(SK, IKM, IKM_len, NULL, 0, info, info_len, 4);   }
+
+void blst_keygen_v3(pow256 SK, const void *IKM, size_t IKM_len,
+                               const void *info, size_t info_len)
+{   keygen(SK, IKM, IKM_len, NULL, 0, info, info_len, 3);   }
+
+void blst_keygen_v4_5(pow256 SK, const void *IKM, size_t IKM_len,
+                                 const void *salt, size_t salt_len,
+                                 const void *info, size_t info_len)
+{   keygen(SK, IKM, IKM_len, salt, salt_len, info, info_len, 4);   }
+
+void blst_keygen_v5(pow256 SK, const void *IKM, size_t IKM_len,
+                               const void *salt, size_t salt_len,
+                               const void *info, size_t info_len)
+{   keygen(SK, IKM, IKM_len, salt, salt_len, info, info_len, 5);   }
+
+/*
+ * https://eips.ethereum.org/EIPS/eip-2333
+ */
+void blst_derive_master_eip2333(pow256 SK, const void *seed, size_t seed_len)
+{   keygen(SK, seed, seed_len, NULL, 0, NULL, 0, 4);   }
+
+static void parent_SK_to_lamport_PK(pow256 PK, const pow256 parent_SK,
+                                    unsigned int index)
+{
+    size_t i;
+    struct {
+        HMAC_SHA256_CTX ctx;
+        SHA256_CTX ret;
+        unsigned char PRK[32], IKM[32];
+        unsigned char lamport[255][32];
+    } scratch;
+
+    /* salt = I2OSP(index, 4) */
+    unsigned char salt[4] = { (unsigned char)(index>>24),
+                              (unsigned char)(index>>16),
+                              (unsigned char)(index>>8),
+                              (unsigned char)(index) };
+
+    /* IKM = I2OSP(parent_SK, 32) */
+    for (i = 0; i < 32; i++)
+        scratch.IKM[i] = parent_SK[31-i];
+
+    /* lamport_0 = IKM_to_lamport_SK(IKM, salt) */
+    HKDF_Extract(scratch.PRK, salt, sizeof(salt), scratch.IKM, 32, 0,
+                 &scratch.ctx);
+    HKDF_Expand(scratch.lamport[0], sizeof(scratch.lamport),
+                scratch.PRK, NULL, 0, 0, &scratch.ctx);
+
+    vec_zero(scratch.ctx.ctx.buf, sizeof(scratch.ctx.ctx.buf));
+    scratch.ctx.ctx.buf[32] = 0x80;
+    scratch.ctx.ctx.buf[62] = 1;    /* 32*8 in big endian */
+    scratch.ctx.ctx.buf[63] = 0;
+    for (i = 0; i < 255; i++) {
+        /* lamport_PK = lamport_PK | SHA256(lamport_0[i]) */
+        sha256_init_h(scratch.ctx.ctx.h);
+        sha256_bcopy(scratch.ctx.ctx.buf, scratch.lamport[i], 32);
+        sha256_block_data_order(scratch.ctx.ctx.h, scratch.ctx.ctx.buf, 1);
+        sha256_emit(scratch.lamport[i], scratch.ctx.ctx.h);
+    }
+
+    /* compressed_lamport_PK = SHA256(lamport_PK) */
+    sha256_init(&scratch.ret);
+    sha256_update(&scratch.ret, scratch.lamport, sizeof(scratch.lamport));
+
+    /* not_IKM = flip_bits(IKM) */
+    for (i = 0; i< 32; i++)
+        scratch.IKM[i] = ~scratch.IKM[i];
+
+    /* lamport_1 = IKM_to_lamport_SK(not_IKM, salt) */
+    HKDF_Extract(scratch.PRK, salt, sizeof(salt), scratch.IKM, 32, 0,
+                 &scratch.ctx);
+    HKDF_Expand(scratch.lamport[0], sizeof(scratch.lamport),
+                scratch.PRK, NULL, 0, 0, &scratch.ctx);
+
+    vec_zero(scratch.ctx.ctx.buf, sizeof(scratch.ctx.ctx.buf));
+    scratch.ctx.ctx.buf[32] = 0x80;
+    scratch.ctx.ctx.buf[62] = 1;
+    for (i = 0; i < 255; i++) {
+        /* lamport_PK = lamport_PK | SHA256(lamport_1[i]) */
+        sha256_init_h(scratch.ctx.ctx.h);
+        sha256_bcopy(scratch.ctx.ctx.buf, scratch.lamport[i], 32);
+        sha256_block_data_order(scratch.ctx.ctx.h, scratch.ctx.ctx.buf, 1);
+        sha256_emit(scratch.lamport[i], scratch.ctx.ctx.h);
+    }
+
+    /* compressed_lamport_PK = SHA256(lamport_PK) */
+    sha256_update(&scratch.ret, scratch.lamport, sizeof(scratch.lamport));
+    sha256_final(PK, &scratch.ret);
+
+    /*
+     * scrub the stack just in case next callee inadvertently flashes
+     * a fragment across application boundary...
+     */
+    vec_zero(&scratch, sizeof(scratch));
+}
+
+void blst_derive_child_eip2333(pow256 SK, const pow256 parent_SK,
+                               unsigned int child_index)
+{
+    parent_SK_to_lamport_PK(SK, parent_SK, child_index);
+    keygen(SK, SK, sizeof(pow256), NULL, 0, NULL, 0, 4);
+}
+#endif
diff --git a/vendor/external/blst/src/map_to_g1.c b/vendor/external/blst/src/map_to_g1.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/map_to_g1.c
@@ -0,0 +1,559 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "point.h"
+#include "fields.h"
+
+/*
+ * y^2 = x^3 + A'*x + B', isogenous one
+ */
+static const vec384 Aprime_E1 = {
+    /* (0x00144698a3b8e9433d693a02c96d4982b0ea985383ee66a8
+          d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d << 384) % P */
+    TO_LIMB_T(0x2f65aa0e9af5aa51), TO_LIMB_T(0x86464c2d1e8416c3),
+    TO_LIMB_T(0xb85ce591b7bd31e2), TO_LIMB_T(0x27e11c91b5f24e7c),
+    TO_LIMB_T(0x28376eda6bfc1835), TO_LIMB_T(0x155455c3e5071d85)
+};
+static const vec384 Bprime_E1 = {
+    /* (0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070
+          a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0 << 384) % P */
+    TO_LIMB_T(0xfb996971fe22a1e0), TO_LIMB_T(0x9aa93eb35b742d6f),
+    TO_LIMB_T(0x8c476013de99c5c4), TO_LIMB_T(0x873e27c3a221e571),
+    TO_LIMB_T(0xca72b5e45a52d888), TO_LIMB_T(0x06824061418a386b)
+};
+
+static void map_fp_times_Zz(vec384 map[], const vec384 isogeny_map[],
+                            const vec384 Zz_powers[], size_t n)
+{
+    while (n--)
+        mul_fp(map[n], isogeny_map[n], Zz_powers[n]);
+}
+
+static void map_fp(vec384 acc, const vec384 x, const vec384 map[], size_t n)
+{
+    while (n--) {
+        mul_fp(acc, acc, x);
+        add_fp(acc, acc, map[n]);
+    }
+}
+
+static void isogeny_map_to_E1(POINTonE1 *out, const POINTonE1 *p)
+{
+    /*
+     * x = x_num / x_den, where
+     * x_num = k_(1,11) * x'^11 + k_(1,10) * x'^10 + k_(1,9) * x'^9 +
+     *         ... + k_(1,0)
+     * ...
+     */
+    static const vec384 isogeny_map_x_num[] = { /*  (k_(1,*)<<384) % P  */
+      { TO_LIMB_T(0x4d18b6f3af00131c), TO_LIMB_T(0x19fa219793fee28c),
+        TO_LIMB_T(0x3f2885f1467f19ae), TO_LIMB_T(0x23dcea34f2ffb304),
+        TO_LIMB_T(0xd15b58d2ffc00054), TO_LIMB_T(0x0913be200a20bef4)  },
+      { TO_LIMB_T(0x898985385cdbbd8b), TO_LIMB_T(0x3c79e43cc7d966aa),
+        TO_LIMB_T(0x1597e193f4cd233a), TO_LIMB_T(0x8637ef1e4d6623ad),
+        TO_LIMB_T(0x11b22deed20d827b), TO_LIMB_T(0x07097bc5998784ad)  },
+      { TO_LIMB_T(0xa542583a480b664b), TO_LIMB_T(0xfc7169c026e568c6),
+        TO_LIMB_T(0x5ba2ef314ed8b5a6), TO_LIMB_T(0x5b5491c05102f0e7),
+        TO_LIMB_T(0xdf6e99707d2a0079), TO_LIMB_T(0x0784151ed7605524)  },
+      { TO_LIMB_T(0x494e212870f72741), TO_LIMB_T(0xab9be52fbda43021),
+        TO_LIMB_T(0x26f5577994e34c3d), TO_LIMB_T(0x049dfee82aefbd60),
+        TO_LIMB_T(0x65dadd7828505289), TO_LIMB_T(0x0e93d431ea011aeb)  },
+      { TO_LIMB_T(0x90ee774bd6a74d45), TO_LIMB_T(0x7ada1c8a41bfb185),
+        TO_LIMB_T(0x0f1a8953b325f464), TO_LIMB_T(0x104c24211be4805c),
+        TO_LIMB_T(0x169139d319ea7a8f), TO_LIMB_T(0x09f20ead8e532bf6)  },
+      { TO_LIMB_T(0x6ddd93e2f43626b7), TO_LIMB_T(0xa5482c9aa1ccd7bd),
+        TO_LIMB_T(0x143245631883f4bd), TO_LIMB_T(0x2e0a94ccf77ec0db),
+        TO_LIMB_T(0xb0282d480e56489f), TO_LIMB_T(0x18f4bfcbb4368929)  },
+      { TO_LIMB_T(0x23c5f0c953402dfd), TO_LIMB_T(0x7a43ff6958ce4fe9),
+        TO_LIMB_T(0x2c390d3d2da5df63), TO_LIMB_T(0xd0df5c98e1f9d70f),
+        TO_LIMB_T(0xffd89869a572b297), TO_LIMB_T(0x1277ffc72f25e8fe)  },
+      { TO_LIMB_T(0x79f4f0490f06a8a6), TO_LIMB_T(0x85f894a88030fd81),
+        TO_LIMB_T(0x12da3054b18b6410), TO_LIMB_T(0xe2a57f6505880d65),
+        TO_LIMB_T(0xbba074f260e400f1), TO_LIMB_T(0x08b76279f621d028)  },
+      { TO_LIMB_T(0xe67245ba78d5b00b), TO_LIMB_T(0x8456ba9a1f186475),
+        TO_LIMB_T(0x7888bff6e6b33bb4), TO_LIMB_T(0xe21585b9a30f86cb),
+        TO_LIMB_T(0x05a69cdcef55feee), TO_LIMB_T(0x09e699dd9adfa5ac)  },
+      { TO_LIMB_T(0x0de5c357bff57107), TO_LIMB_T(0x0a0db4ae6b1a10b2),
+        TO_LIMB_T(0xe256bb67b3b3cd8d), TO_LIMB_T(0x8ad456574e9db24f),
+        TO_LIMB_T(0x0443915f50fd4179), TO_LIMB_T(0x098c4bf7de8b6375)  },
+      { TO_LIMB_T(0xe6b0617e7dd929c7), TO_LIMB_T(0xfe6e37d442537375),
+        TO_LIMB_T(0x1dafdeda137a489e), TO_LIMB_T(0xe4efd1ad3f767ceb),
+        TO_LIMB_T(0x4a51d8667f0fe1cf), TO_LIMB_T(0x054fdf4bbf1d821c)  },
+      { TO_LIMB_T(0x72db2a50658d767b), TO_LIMB_T(0x8abf91faa257b3d5),
+        TO_LIMB_T(0xe969d6833764ab47), TO_LIMB_T(0x464170142a1009eb),
+        TO_LIMB_T(0xb14f01aadb30be2f), TO_LIMB_T(0x18ae6a856f40715d)  }
+    };
+    /* ...
+     * x_den = x'^10 + k_(2,9) * x'^9 + k_(2,8) * x'^8 + ... + k_(2,0)
+     */
+    static const vec384 isogeny_map_x_den[] = { /*  (k_(2,*)<<384) % P  */
+      { TO_LIMB_T(0xb962a077fdb0f945), TO_LIMB_T(0xa6a9740fefda13a0),
+        TO_LIMB_T(0xc14d568c3ed6c544), TO_LIMB_T(0xb43fc37b908b133e),
+        TO_LIMB_T(0x9c0b3ac929599016), TO_LIMB_T(0x0165aa6c93ad115f)  },
+      { TO_LIMB_T(0x23279a3ba506c1d9), TO_LIMB_T(0x92cfca0a9465176a),
+        TO_LIMB_T(0x3b294ab13755f0ff), TO_LIMB_T(0x116dda1c5070ae93),
+        TO_LIMB_T(0xed4530924cec2045), TO_LIMB_T(0x083383d6ed81f1ce)  },
+      { TO_LIMB_T(0x9885c2a6449fecfc), TO_LIMB_T(0x4a2b54ccd37733f0),
+        TO_LIMB_T(0x17da9ffd8738c142), TO_LIMB_T(0xa0fba72732b3fafd),
+        TO_LIMB_T(0xff364f36e54b6812), TO_LIMB_T(0x0f29c13c660523e2)  },
+      { TO_LIMB_T(0xe349cc118278f041), TO_LIMB_T(0xd487228f2f3204fb),
+        TO_LIMB_T(0xc9d325849ade5150), TO_LIMB_T(0x43a92bd69c15c2df),
+        TO_LIMB_T(0x1c2c7844bc417be4), TO_LIMB_T(0x12025184f407440c)  },
+      { TO_LIMB_T(0x587f65ae6acb057b), TO_LIMB_T(0x1444ef325140201f),
+        TO_LIMB_T(0xfbf995e71270da49), TO_LIMB_T(0xccda066072436a42),
+        TO_LIMB_T(0x7408904f0f186bb2), TO_LIMB_T(0x13b93c63edf6c015)  },
+      { TO_LIMB_T(0xfb918622cd141920), TO_LIMB_T(0x4a4c64423ecaddb4),
+        TO_LIMB_T(0x0beb232927f7fb26), TO_LIMB_T(0x30f94df6f83a3dc2),
+        TO_LIMB_T(0xaeedd424d780f388), TO_LIMB_T(0x06cc402dd594bbeb)  },
+      { TO_LIMB_T(0xd41f761151b23f8f), TO_LIMB_T(0x32a92465435719b3),
+        TO_LIMB_T(0x64f436e888c62cb9), TO_LIMB_T(0xdf70a9a1f757c6e4),
+        TO_LIMB_T(0x6933a38d5b594c81), TO_LIMB_T(0x0c6f7f7237b46606)  },
+      { TO_LIMB_T(0x693c08747876c8f7), TO_LIMB_T(0x22c9850bf9cf80f0),
+        TO_LIMB_T(0x8e9071dab950c124), TO_LIMB_T(0x89bc62d61c7baf23),
+        TO_LIMB_T(0xbc6be2d8dad57c23), TO_LIMB_T(0x17916987aa14a122)  },
+      { TO_LIMB_T(0x1be3ff439c1316fd), TO_LIMB_T(0x9965243a7571dfa7),
+        TO_LIMB_T(0xc7f7f62962f5cd81), TO_LIMB_T(0x32c6aa9af394361c),
+        TO_LIMB_T(0xbbc2ee18e1c227f4), TO_LIMB_T(0x0c102cbac531bb34)  },
+      { TO_LIMB_T(0x997614c97bacbf07), TO_LIMB_T(0x61f86372b99192c0),
+        TO_LIMB_T(0x5b8c95fc14353fc3), TO_LIMB_T(0xca2b066c2a87492f),
+        TO_LIMB_T(0x16178f5bbf698711), TO_LIMB_T(0x12a6dcd7f0f4e0e8)  }
+    };
+    /*
+     * y = y' * y_num / y_den, where
+     * y_num = k_(3,15) * x'^15 + k_(3,14) * x'^14 + k_(3,13) * x'^13 +
+     *         ... + k_(3,0)
+     * ...
+     */
+    static const vec384 isogeny_map_y_num[] = { /*  (k_(3,*)<<384) % P  */
+      { TO_LIMB_T(0x2b567ff3e2837267), TO_LIMB_T(0x1d4d9e57b958a767),
+        TO_LIMB_T(0xce028fea04bd7373), TO_LIMB_T(0xcc31a30a0b6cd3df),
+        TO_LIMB_T(0x7d7b18a682692693), TO_LIMB_T(0x0d300744d42a0310)  },
+      { TO_LIMB_T(0x99c2555fa542493f), TO_LIMB_T(0xfe7f53cc4874f878),
+        TO_LIMB_T(0x5df0608b8f97608a), TO_LIMB_T(0x14e03832052b49c8),
+        TO_LIMB_T(0x706326a6957dd5a4), TO_LIMB_T(0x0a8dadd9c2414555)  },
+      { TO_LIMB_T(0x13d942922a5cf63a), TO_LIMB_T(0x357e33e36e261e7d),
+        TO_LIMB_T(0xcf05a27c8456088d), TO_LIMB_T(0x0000bd1de7ba50f0),
+        TO_LIMB_T(0x83d0c7532f8c1fde), TO_LIMB_T(0x13f70bf38bbf2905)  },
+      { TO_LIMB_T(0x5c57fd95bfafbdbb), TO_LIMB_T(0x28a359a65e541707),
+        TO_LIMB_T(0x3983ceb4f6360b6d), TO_LIMB_T(0xafe19ff6f97e6d53),
+        TO_LIMB_T(0xb3468f4550192bf7), TO_LIMB_T(0x0bb6cde49d8ba257)  },
+      { TO_LIMB_T(0x590b62c7ff8a513f), TO_LIMB_T(0x314b4ce372cacefd),
+        TO_LIMB_T(0x6bef32ce94b8a800), TO_LIMB_T(0x6ddf84a095713d5f),
+        TO_LIMB_T(0x64eace4cb0982191), TO_LIMB_T(0x0386213c651b888d)  },
+      { TO_LIMB_T(0xa5310a31111bbcdd), TO_LIMB_T(0xa14ac0f5da148982),
+        TO_LIMB_T(0xf9ad9cc95423d2e9), TO_LIMB_T(0xaa6ec095283ee4a7),
+        TO_LIMB_T(0xcf5b1f022e1c9107), TO_LIMB_T(0x01fddf5aed881793)  },
+      { TO_LIMB_T(0x65a572b0d7a7d950), TO_LIMB_T(0xe25c2d8183473a19),
+        TO_LIMB_T(0xc2fcebe7cb877dbd), TO_LIMB_T(0x05b2d36c769a89b0),
+        TO_LIMB_T(0xba12961be86e9efb), TO_LIMB_T(0x07eb1b29c1dfde1f)  },
+      { TO_LIMB_T(0x93e09572f7c4cd24), TO_LIMB_T(0x364e929076795091),
+        TO_LIMB_T(0x8569467e68af51b5), TO_LIMB_T(0xa47da89439f5340f),
+        TO_LIMB_T(0xf4fa918082e44d64), TO_LIMB_T(0x0ad52ba3e6695a79)  },
+      { TO_LIMB_T(0x911429844e0d5f54), TO_LIMB_T(0xd03f51a3516bb233),
+        TO_LIMB_T(0x3d587e5640536e66), TO_LIMB_T(0xfa86d2a3a9a73482),
+        TO_LIMB_T(0xa90ed5adf1ed5537), TO_LIMB_T(0x149c9c326a5e7393)  },
+      { TO_LIMB_T(0x462bbeb03c12921a), TO_LIMB_T(0xdc9af5fa0a274a17),
+        TO_LIMB_T(0x9a558ebde836ebed), TO_LIMB_T(0x649ef8f11a4fae46),
+        TO_LIMB_T(0x8100e1652b3cdc62), TO_LIMB_T(0x1862bd62c291dacb)  },
+      { TO_LIMB_T(0x05c9b8ca89f12c26), TO_LIMB_T(0x0194160fa9b9ac4f),
+        TO_LIMB_T(0x6a643d5a6879fa2c), TO_LIMB_T(0x14665bdd8846e19d),
+        TO_LIMB_T(0xbb1d0d53af3ff6bf), TO_LIMB_T(0x12c7e1c3b28962e5)  },
+      { TO_LIMB_T(0xb55ebf900b8a3e17), TO_LIMB_T(0xfedc77ec1a9201c4),
+        TO_LIMB_T(0x1f07db10ea1a4df4), TO_LIMB_T(0x0dfbd15dc41a594d),
+        TO_LIMB_T(0x389547f2334a5391), TO_LIMB_T(0x02419f98165871a4)  },
+      { TO_LIMB_T(0xb416af000745fc20), TO_LIMB_T(0x8e563e9d1ea6d0f5),
+        TO_LIMB_T(0x7c763e17763a0652), TO_LIMB_T(0x01458ef0159ebbef),
+        TO_LIMB_T(0x8346fe421f96bb13), TO_LIMB_T(0x0d2d7b829ce324d2)  },
+      { TO_LIMB_T(0x93096bb538d64615), TO_LIMB_T(0x6f2a2619951d823a),
+        TO_LIMB_T(0x8f66b3ea59514fa4), TO_LIMB_T(0xf563e63704f7092f),
+        TO_LIMB_T(0x724b136c4cf2d9fa), TO_LIMB_T(0x046959cfcfd0bf49)  },
+      { TO_LIMB_T(0xea748d4b6e405346), TO_LIMB_T(0x91e9079c2c02d58f),
+        TO_LIMB_T(0x41064965946d9b59), TO_LIMB_T(0xa06731f1d2bbe1ee),
+        TO_LIMB_T(0x07f897e267a33f1b), TO_LIMB_T(0x1017290919210e5f)  },
+      { TO_LIMB_T(0x872aa6c17d985097), TO_LIMB_T(0xeecc53161264562a),
+        TO_LIMB_T(0x07afe37afff55002), TO_LIMB_T(0x54759078e5be6838),
+        TO_LIMB_T(0xc4b92d15db8acca8), TO_LIMB_T(0x106d87d1b51d13b9)  }
+    };
+    /* ...
+     * y_den = x'^15 + k_(4,14) * x'^14 + k_(4,13) * x'^13 + ... + k_(4,0)
+     */
+    static const vec384 isogeny_map_y_den[] = { /*  (k_(4,*)<<384) % P  */
+      { TO_LIMB_T(0xeb6c359d47e52b1c), TO_LIMB_T(0x18ef5f8a10634d60),
+        TO_LIMB_T(0xddfa71a0889d5b7e), TO_LIMB_T(0x723e71dcc5fc1323),
+        TO_LIMB_T(0x52f45700b70d5c69), TO_LIMB_T(0x0a8b981ee47691f1)  },
+      { TO_LIMB_T(0x616a3c4f5535b9fb), TO_LIMB_T(0x6f5f037395dbd911),
+        TO_LIMB_T(0xf25f4cc5e35c65da), TO_LIMB_T(0x3e50dffea3c62658),
+        TO_LIMB_T(0x6a33dca523560776), TO_LIMB_T(0x0fadeff77b6bfe3e)  },
+      { TO_LIMB_T(0x2be9b66df470059c), TO_LIMB_T(0x24a2c159a3d36742),
+        TO_LIMB_T(0x115dbe7ad10c2a37), TO_LIMB_T(0xb6634a652ee5884d),
+        TO_LIMB_T(0x04fe8bb2b8d81af4), TO_LIMB_T(0x01c2a7a256fe9c41)  },
+      { TO_LIMB_T(0xf27bf8ef3b75a386), TO_LIMB_T(0x898b367476c9073f),
+        TO_LIMB_T(0x24482e6b8c2f4e5f), TO_LIMB_T(0xc8e0bbd6fe110806),
+        TO_LIMB_T(0x59b0c17f7631448a), TO_LIMB_T(0x11037cd58b3dbfbd)  },
+      { TO_LIMB_T(0x31c7912ea267eec6), TO_LIMB_T(0x1dbf6f1c5fcdb700),
+        TO_LIMB_T(0xd30d4fe3ba86fdb1), TO_LIMB_T(0x3cae528fbee9a2a4),
+        TO_LIMB_T(0xb1cce69b6aa9ad9a), TO_LIMB_T(0x044393bb632d94fb)  },
+      { TO_LIMB_T(0xc66ef6efeeb5c7e8), TO_LIMB_T(0x9824c289dd72bb55),
+        TO_LIMB_T(0x71b1a4d2f119981d), TO_LIMB_T(0x104fc1aafb0919cc),
+        TO_LIMB_T(0x0e49df01d942a628), TO_LIMB_T(0x096c3a09773272d4)  },
+      { TO_LIMB_T(0x9abc11eb5fadeff4), TO_LIMB_T(0x32dca50a885728f0),
+        TO_LIMB_T(0xfb1fa3721569734c), TO_LIMB_T(0xc4b76271ea6506b3),
+        TO_LIMB_T(0xd466a75599ce728e), TO_LIMB_T(0x0c81d4645f4cb6ed)  },
+      { TO_LIMB_T(0x4199f10e5b8be45b), TO_LIMB_T(0xda64e495b1e87930),
+        TO_LIMB_T(0xcb353efe9b33e4ff), TO_LIMB_T(0x9e9efb24aa6424c6),
+        TO_LIMB_T(0xf08d33680a237465), TO_LIMB_T(0x0d3378023e4c7406)  },
+      { TO_LIMB_T(0x7eb4ae92ec74d3a5), TO_LIMB_T(0xc341b4aa9fac3497),
+        TO_LIMB_T(0x5be603899e907687), TO_LIMB_T(0x03bfd9cca75cbdeb),
+        TO_LIMB_T(0x564c2935a96bfa93), TO_LIMB_T(0x0ef3c33371e2fdb5)  },
+      { TO_LIMB_T(0x7ee91fd449f6ac2e), TO_LIMB_T(0xe5d5bd5cb9357a30),
+        TO_LIMB_T(0x773a8ca5196b1380), TO_LIMB_T(0xd0fda172174ed023),
+        TO_LIMB_T(0x6cb95e0fa776aead), TO_LIMB_T(0x0d22d5a40cec7cff)  },
+      { TO_LIMB_T(0xf727e09285fd8519), TO_LIMB_T(0xdc9d55a83017897b),
+        TO_LIMB_T(0x7549d8bd057894ae), TO_LIMB_T(0x178419613d90d8f8),
+        TO_LIMB_T(0xfce95ebdeb5b490a), TO_LIMB_T(0x0467ffaef23fc49e)  },
+      { TO_LIMB_T(0xc1769e6a7c385f1b), TO_LIMB_T(0x79bc930deac01c03),
+        TO_LIMB_T(0x5461c75a23ede3b5), TO_LIMB_T(0x6e20829e5c230c45),
+        TO_LIMB_T(0x828e0f1e772a53cd), TO_LIMB_T(0x116aefa749127bff)  },
+      { TO_LIMB_T(0x101c10bf2744c10a), TO_LIMB_T(0xbbf18d053a6a3154),
+        TO_LIMB_T(0xa0ecf39ef026f602), TO_LIMB_T(0xfc009d4996dc5153),
+        TO_LIMB_T(0xb9000209d5bd08d3), TO_LIMB_T(0x189e5fe4470cd73c)  },
+      { TO_LIMB_T(0x7ebd546ca1575ed2), TO_LIMB_T(0xe47d5a981d081b55),
+        TO_LIMB_T(0x57b2b625b6d4ca21), TO_LIMB_T(0xb0a1ba04228520cc),
+        TO_LIMB_T(0x98738983c2107ff3), TO_LIMB_T(0x13dddbc4799d81d6)  },
+      { TO_LIMB_T(0x09319f2e39834935), TO_LIMB_T(0x039e952cbdb05c21),
+        TO_LIMB_T(0x55ba77a9a2f76493), TO_LIMB_T(0xfd04e3dfc6086467),
+        TO_LIMB_T(0xfb95832e7d78742e), TO_LIMB_T(0x0ef9c24eccaf5e0e)  }
+    };
+    vec384 Zz_powers[15], map[15], xn, xd, yn, yd;
+
+    /* lay down Z^2 powers in descending order                          */
+    sqr_fp(Zz_powers[14], p->Z);                        /* ZZ^1         */
+#ifdef __OPTIMIZE_SIZE__
+    for (size_t i = 14; i > 0; i--)
+        mul_fp(Zz_powers[i-1], Zz_powers[i], Zz_powers[14]);
+#else
+    sqr_fp(Zz_powers[13], Zz_powers[14]);               /* ZZ^2  1+1    */
+    mul_fp(Zz_powers[12], Zz_powers[14], Zz_powers[13]);/* ZZ^3  2+1    */
+    sqr_fp(Zz_powers[11], Zz_powers[13]);               /* ZZ^4  2+2    */
+    mul_fp(Zz_powers[10], Zz_powers[13], Zz_powers[12]);/* ZZ^5  2+3    */
+    sqr_fp(Zz_powers[9],  Zz_powers[12]);               /* ZZ^6  3+3    */
+    mul_fp(Zz_powers[8],  Zz_powers[12], Zz_powers[11]);/* ZZ^7  3+4    */
+    sqr_fp(Zz_powers[7],  Zz_powers[11]);               /* ZZ^8  4+4    */
+    mul_fp(Zz_powers[6],  Zz_powers[11], Zz_powers[10]);/* ZZ^9  4+5    */
+    sqr_fp(Zz_powers[5],  Zz_powers[10]);               /* ZZ^10 5+5    */
+    mul_fp(Zz_powers[4],  Zz_powers[10], Zz_powers[9]); /* ZZ^11 5+6    */
+    sqr_fp(Zz_powers[3],  Zz_powers[9]);                /* ZZ^12 6+6    */
+    mul_fp(Zz_powers[2],  Zz_powers[9],  Zz_powers[8]); /* ZZ^13 6+7    */
+    sqr_fp(Zz_powers[1],  Zz_powers[8]);                /* ZZ^14 7+7    */
+    mul_fp(Zz_powers[0],  Zz_powers[8],  Zz_powers[7]); /* ZZ^15 7+8    */
+#endif
+
+    map_fp_times_Zz(map, isogeny_map_x_num, Zz_powers + 4, 11);
+    mul_fp(xn, p->X, isogeny_map_x_num[11]);
+    add_fp(xn, xn, map[10]);
+    map_fp(xn, p->X, map, 10);
+
+    map_fp_times_Zz(map, isogeny_map_x_den, Zz_powers + 5, 10);
+    add_fp(xd, p->X, map[9]);
+    map_fp(xd, p->X, map, 9);
+    mul_fp(xd, xd, Zz_powers[14]);      /* xd *= Z^2                    */
+
+    map_fp_times_Zz(map, isogeny_map_y_num, Zz_powers, 15);
+    mul_fp(yn, p->X, isogeny_map_y_num[15]);
+    add_fp(yn, yn, map[14]);
+    map_fp(yn, p->X, map, 14);
+    mul_fp(yn, yn, p->Y);               /* yn *= Y                      */
+
+    map_fp_times_Zz(map, isogeny_map_y_den, Zz_powers, 15);
+    add_fp(yd, p->X, map[14]);
+    map_fp(yd, p->X, map, 14);
+    mul_fp(Zz_powers[14], Zz_powers[14], p->Z);
+    mul_fp(yd, yd, Zz_powers[14]);      /* yd *= Z^3                    */
+
+    /* convert (xn, xd, yn, yd) to Jacobian coordinates                 */
+    mul_fp(out->Z, xd, yd);             /* Z = xd * yd                  */
+    mul_fp(out->X, xn, yd);
+    mul_fp(out->X, out->X, out->Z);     /* X = xn * xd * yd^2           */
+    sqr_fp(out->Y, out->Z);
+    mul_fp(out->Y, out->Y, xd);
+    mul_fp(out->Y, out->Y, yn);         /* Y = yn * xd^3 * yd^2         */
+}
+
+static void map_to_isogenous_E1(POINTonE1 *p, const vec384 u)
+{
+    static const vec384 minus_A = { /* P - A */
+        TO_LIMB_T(0x8a9955f1650a005a), TO_LIMB_T(0x9865b3d192cfe93c),
+        TO_LIMB_T(0xaed3ed0f3ef3c441), TO_LIMB_T(0x3c962ef33d92c442),
+        TO_LIMB_T(0x22e438dbd74f94a2), TO_LIMB_T(0x04acbc265478c915)
+    };
+    static const vec384 Z = {       /* (11<<384) % P */
+        TO_LIMB_T(0x886c00000023ffdc), TO_LIMB_T(0x0f70008d3090001d),
+        TO_LIMB_T(0x77672417ed5828c3), TO_LIMB_T(0x9dac23e943dc1740),
+        TO_LIMB_T(0x50553f1b9c131521), TO_LIMB_T(0x078c712fbe0ab6e8)
+    };
+    static const vec384 sqrt_minus_ZZZ = {
+        TO_LIMB_T(0x43b571cad3215f1f), TO_LIMB_T(0xccb460ef1c702dc2),
+        TO_LIMB_T(0x742d884f4f97100b), TO_LIMB_T(0xdb2c3e3238a3382b),
+        TO_LIMB_T(0xe40f3fa13fce8f88), TO_LIMB_T(0x0073a2af9892a2ff)
+    };
+    static const vec384 ZxA = {
+        TO_LIMB_T(0x7f674ea0a8915178), TO_LIMB_T(0xb0f945fc13b8fa65),
+        TO_LIMB_T(0x4b46759a38e87d76), TO_LIMB_T(0x2e7a929641bbb6a1),
+        TO_LIMB_T(0x1668ddfa462bf6b6), TO_LIMB_T(0x00960e2ed1cf294c)
+    };
+    vec384 uu, tv2, x2n, gx1, gxd, y2;
+#if 0
+    vec384 xn, x1n, xd, y, y1, Zuu, tv4;
+#else
+# define xn     p->X
+# define y      p->Y
+# define xd     p->Z
+# define x1n    xn
+# define y1     y
+# define Zuu    x2n
+# define tv4    y1
+#endif
+#define sgn0_fp(a) (sgn0_pty_mont_384((a), BLS12_381_P, p0) & 1)
+    bool_t e1, e2;
+
+    /*
+     * as per map_to_curve() from poc/sswu_opt.sage at
+     * https://github.com/cfrg/draft-irtf-cfrg-hash-to-curve
+     */
+    /* x numerator variants                                             */
+    sqr_fp(uu, u);                      /* uu = u^2                     */
+    mul_fp(Zuu, Z, uu);                 /* Zuu = Z * uu                 */
+    sqr_fp(tv2, Zuu);                   /* tv2 = Zuu^2                  */
+    add_fp(tv2, tv2, Zuu);              /* tv2 = tv2 + Zuu              */
+    add_fp(x1n, tv2, BLS12_381_Rx.p);   /* x1n = tv2 + 1                */
+    mul_fp(x1n, x1n, Bprime_E1);        /* x1n = x1n * B                */
+    mul_fp(x2n, Zuu, x1n);              /* x2n = Zuu * x1n              */
+
+    /* x denumenator                                                    */
+    mul_fp(xd, minus_A, tv2);           /* xd = -A * tv2                */
+    e1 = vec_is_zero(xd, sizeof(xd));   /* e1 = xd == 0                 */
+    vec_select(xd, ZxA, xd, sizeof(xd), e1);    /*              # If xd == 0, set xd = Z*A */
+
+    /* y numerators variants                                            */
+    sqr_fp(tv2, xd);                    /* tv2 = xd^2                   */
+    mul_fp(gxd, xd, tv2);               /* gxd = xd^3                   */
+    mul_fp(tv2, Aprime_E1, tv2);        /* tv2 = A * tv2                */
+    sqr_fp(gx1, x1n);                   /* gx1 = x1n^2                  */
+    add_fp(gx1, gx1, tv2);              /* gx1 = gx1 + tv2      # x1n^2 + A*xd^2 */
+    mul_fp(gx1, gx1, x1n);              /* gx1 = gx1 * x1n      # x1n^3 + A*x1n*xd^2 */
+    mul_fp(tv2, Bprime_E1, gxd);        /* tv2 = B * gxd                */
+    add_fp(gx1, gx1, tv2);              /* gx1 = gx1 + tv2      # x1^3 + A*x1*xd^2 + B*xd^3 */
+    sqr_fp(tv4, gxd);                   /* tv4 = gxd^2                  */
+    mul_fp(tv2, gx1, gxd);              /* tv2 = gx1 * gxd              */
+    mul_fp(tv4, tv4, tv2);              /* tv4 = tv4 * tv2      # gx1*gxd^3 */
+    e2 = recip_sqrt_fp(y1, tv4);        /* y1 = tv4^c1          # (gx1*gxd^3)^((p-3)/4) */
+    mul_fp(y1, y1, tv2);                /* y1 = y1 * tv2        # gx1*gxd*y1 */
+    mul_fp(y2, y1, sqrt_minus_ZZZ);     /* y2 = y1 * c2         # y2 = y1*sqrt(-Z^3) */
+    mul_fp(y2, y2, uu);                 /* y2 = y2 * uu                 */
+    mul_fp(y2, y2, u);                  /* y2 = y2 * u                  */
+
+    /* choose numerators                                                */
+    vec_select(xn, x1n, x2n, sizeof(xn), e2);   /* xn = e2 ? x1n : x2n  */
+    vec_select(y, y1, y2, sizeof(y), e2);       /* y  = e2 ? y1 : y2    */
+
+    e1 = sgn0_fp(u);
+    e2 = sgn0_fp(y);
+    cneg_fp(y, y, e1^e2);               /* fix sign of y                */
+                                        /* return (xn, xd, y, 1)        */
+
+    /* convert (xn, xd, y, 1) to Jacobian projective coordinates        */
+    mul_fp(p->X, xn, xd);               /* X = xn * xd                  */
+    mul_fp(p->Y, y, gxd);               /* Y = y * xd^3                 */
+#ifndef xd
+    vec_copy(p->Z, xd, sizeof(xd));     /* Z = xd                       */
+#else
+# undef xn
+# undef y
+# undef xd
+# undef x1n
+# undef y1
+# undef Zuu
+# undef tv4
+#endif
+#undef sgn0_fp
+}
+
+static void POINTonE1_add_n_dbl(POINTonE1 *out, const POINTonE1 *p, size_t n)
+{
+    POINTonE1_dadd(out, out, p, NULL);
+    while(n--)
+        POINTonE1_double(out, out);
+}
+
+static void POINTonE1_times_minus_z(POINTonE1 *out, const POINTonE1 *in)
+{
+    POINTonE1_double(out, in);          /*      1: 0x2                  */
+    POINTonE1_add_n_dbl(out, in, 2);    /*   2..4: 0x3..0xc             */
+    POINTonE1_add_n_dbl(out, in, 3);    /*   5..8: 0xd..0x68            */
+    POINTonE1_add_n_dbl(out, in, 9);    /*  9..18: 0x69..0xd200         */
+    POINTonE1_add_n_dbl(out, in, 32);   /* 19..51: ..0xd20100000000     */
+    POINTonE1_add_n_dbl(out, in, 16);   /* 52..68: ..0xd201000000010000 */
+}
+
+/*
+ * |u|, |v| are expected to be in Montgomery representation
+ */
+static void map_to_g1(POINTonE1 *out, const vec384 u, const vec384 v)
+{
+    POINTonE1 p;
+
+    map_to_isogenous_E1(&p, u);
+
+    if (v != NULL) {
+        map_to_isogenous_E1(out, v);    /* borrow |out|                 */
+        POINTonE1_dadd(&p, &p, out, Aprime_E1);
+    }
+
+    isogeny_map_to_E1(&p, &p);          /* sprinkle isogenous powder    */
+
+    /* clear the cofactor by multiplying |p| by 1-z, 0xd201000000010001 */
+    POINTonE1_times_minus_z(out, &p);
+    POINTonE1_dadd(out, out, &p, NULL);
+}
+
+void blst_map_to_g1(POINTonE1 *out, const vec384 u, const vec384 v)
+{   map_to_g1(out, u, v);   }
+
+static void Encode_to_G1(POINTonE1 *p, const unsigned char *msg, size_t msg_len,
+                                       const unsigned char *DST, size_t DST_len,
+                                       const unsigned char *aug, size_t aug_len)
+{
+    vec384 u[1];
+
+    hash_to_field(u, 1, aug, aug_len, msg, msg_len, DST, DST_len);
+    map_to_g1(p, u[0], NULL);
+}
+
+void blst_encode_to_g1(POINTonE1 *p, const unsigned char *msg, size_t msg_len,
+                                     const unsigned char *DST, size_t DST_len,
+                                     const unsigned char *aug, size_t aug_len)
+{   Encode_to_G1(p, msg, msg_len, DST, DST_len, aug, aug_len);   }
+
+static void Hash_to_G1(POINTonE1 *p, const unsigned char *msg, size_t msg_len,
+                                     const unsigned char *DST, size_t DST_len,
+                                     const unsigned char *aug, size_t aug_len)
+{
+    vec384 u[2];
+
+    hash_to_field(u, 2, aug, aug_len, msg, msg_len, DST, DST_len);
+    map_to_g1(p, u[0], u[1]);
+}
+
+void blst_hash_to_g1(POINTonE1 *p, const unsigned char *msg, size_t msg_len,
+                                   const unsigned char *DST, size_t DST_len,
+                                   const unsigned char *aug, size_t aug_len)
+{   Hash_to_G1(p, msg, msg_len, DST, DST_len, aug, aug_len);   }
+
+static void sigma(POINTonE1 *out, const POINTonE1 *in);
+
+#if 0
+#ifdef __OPTIMIZE_SIZE__
+static void POINTonE1_times_zz_minus_1_div_by_3(POINTonE1 *out,
+                                                const POINTonE1 *in)
+{
+    static const byte zz_minus_1_div_by_3[] = {
+        TO_BYTES(0x0000000055555555ULL), TO_BYTES(0x396c8c005555e156)
+    };
+    size_t n = 126-1;
+    const POINTonE1 *dblin = in;
+
+    while(n--) {
+        POINTonE1_double(out, dblin);   dblin = out;
+        if (is_bit_set(zz_minus_1_div_by_3, n))
+            POINTonE1_dadd(out, out, in, NULL);
+    }
+}
+#else
+static void POINTonE1_dbl_n_add(POINTonE1 *out, size_t n, const POINTonE1 *p)
+{
+    while(n--)
+        POINTonE1_double(out, out);
+    POINTonE1_dadd(out, out, p, NULL);
+}
+
+static void POINTonE1_times_zz_minus_1_div_by_3(POINTonE1 *out,
+                                                const POINTonE1 *in)
+{
+    POINTonE1 t3, t5, t7, t11, t85;
+
+    POINTonE1_double(&t7, in);              /* 2P */
+    POINTonE1_dadd(&t3, &t7, in, NULL);     /* 3P */
+    POINTonE1_dadd(&t5, &t3, &t7, NULL);    /* 5P */
+    POINTonE1_dadd(&t7, &t5, &t7, NULL);    /* 7P */
+    POINTonE1_double(&t85, &t5);            /* 10P */
+    POINTonE1_dadd(&t11, &t85, in, NULL);   /* 11P */
+    POINTonE1_dbl_n_add(&t85, 3, &t5);      /* 0x55P */
+                                            /* (-0xd201000000010000^2 - 1) / 3 */
+    POINTonE1_double(out, &t7);             /* 0xe */
+    POINTonE1_dbl_n_add(out, 5,  &t11);     /* 0x1cb */
+    POINTonE1_dbl_n_add(out, 3,  &t3);      /* 0xe5b */
+    POINTonE1_dbl_n_add(out, 3,  in);       /* 0x72d9 */
+    POINTonE1_dbl_n_add(out, 5,  &t3);      /* 0xe5b23 */
+    POINTonE1_dbl_n_add(out, 18, &t85);     /* 0x396c8c0055 */
+    POINTonE1_dbl_n_add(out, 8,  &t85);     /* 0x396c8c005555 */
+    POINTonE1_dbl_n_add(out, 3,  &t7);      /* 0x1cb646002aaaf */
+    POINTonE1_dbl_n_add(out, 7,  &t5);      /* 0xe5b23001555785 */
+    POINTonE1_dbl_n_add(out, 5,  &t11);     /* 0x1cb646002aaaf0ab */
+    POINTonE1_dbl_n_add(out, 41, &t85);     /* 0x396c8c005555e1560000000055 */
+    POINTonE1_dbl_n_add(out, 8,  &t85);     /* 0x396c8c005555e156000000005555 */
+    POINTonE1_dbl_n_add(out, 8,  &t85);     /* 0x396c8c005555e15600000000555555 */
+    POINTonE1_dbl_n_add(out, 8,  &t85);     /* 0x396c8c005555e1560000000055555555 */
+}
+#endif
+
+static bool_t POINTonE1_in_G1(const POINTonE1 *P)
+{
+    POINTonE1 t0, t1, t2;
+
+    /* Bowe, S., "Faster subgroup checks for BLS12-381"                   */
+    sigma(&t0, P);                        /* σ(P)                         */
+    sigma(&t1, &t0);                      /* σ²(P)                        */
+
+    POINTonE1_double(&t0, &t0);           /* 2σ(P)                        */
+    POINTonE1_dadd(&t2, &t1, P, NULL);    /* P +  σ²(P)                   */
+    POINTonE1_cneg(&t2, 1);               /* - P - σ²(P)                  */
+    POINTonE1_dadd(&t2, &t2, &t0, NULL);  /* 2σ(P) - P - σ²(P)            */
+    POINTonE1_times_zz_minus_1_div_by_3(  &t0, &t2);
+    POINTonE1_cneg(&t1, 1);
+    POINTonE1_dadd(&t0, &t0, &t1, NULL);  /* [(z²-1)/3](2σ(P) - P - σ²(P)) */
+                                          /* - σ²(P) */
+    return vec_is_zero(t0.Z, sizeof(t0.Z));
+}
+#else
+static bool_t POINTonE1_in_G1(const POINTonE1 *P)
+{
+    POINTonE1 t0, t1;
+
+    /* Scott, M., https://eprint.iacr.org/2021/1130 */
+    POINTonE1_times_minus_z(&t0, P);
+    POINTonE1_times_minus_z(&t1, &t0);
+    POINTonE1_cneg(&t1, 1);             /* [-z²]P   */
+
+    sigma(&t0, P);                      /* σ(P)     */
+    sigma(&t0, &t0);                    /* σ²(P)    */
+
+    return POINTonE1_is_equal(&t0, &t1);
+}
+#endif
+
+int blst_p1_in_g1(const POINTonE1 *p)
+{   return (int)POINTonE1_in_G1(p);   }
+
+int blst_p1_affine_in_g1(const POINTonE1_affine *p)
+{
+    POINTonE1 P;
+
+    vec_copy(P.X, p->X, 2*sizeof(P.X));
+    vec_select(P.Z, p->X, BLS12_381_Rx.p, sizeof(P.Z),
+                     vec_is_zero(p, sizeof(*p)));
+
+    return (int)POINTonE1_in_G1(&P);
+}
diff --git a/vendor/external/blst/src/map_to_g2.c b/vendor/external/blst/src/map_to_g2.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/map_to_g2.c
@@ -0,0 +1,444 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "point.h"
+#include "fields.h"
+
+/*
+ * y^2 = x^3 + A'*x + B', isogenous one
+ */
+static const vec384x Aprime_E2 = {      /* 240*i */
+  { 0 },
+  { TO_LIMB_T(0xe53a000003135242), TO_LIMB_T(0x01080c0fdef80285),
+    TO_LIMB_T(0xe7889edbe340f6bd), TO_LIMB_T(0x0b51375126310601),
+    TO_LIMB_T(0x02d6985717c744ab), TO_LIMB_T(0x1220b4e979ea5467) }
+};
+static const vec384x Bprime_E2 = {      /* 1012 + 1012*i */
+  { TO_LIMB_T(0x22ea00000cf89db2), TO_LIMB_T(0x6ec832df71380aa4),
+    TO_LIMB_T(0x6e1b94403db5a66e), TO_LIMB_T(0x75bf3c53a79473ba),
+    TO_LIMB_T(0x3dd3a569412c0a34), TO_LIMB_T(0x125cdb5e74dc4fd1) },
+  { TO_LIMB_T(0x22ea00000cf89db2), TO_LIMB_T(0x6ec832df71380aa4),
+    TO_LIMB_T(0x6e1b94403db5a66e), TO_LIMB_T(0x75bf3c53a79473ba),
+    TO_LIMB_T(0x3dd3a569412c0a34), TO_LIMB_T(0x125cdb5e74dc4fd1) }
+};
+
+static void map_fp2_times_Zz(vec384x map[], const vec384x isogeny_map[],
+                             const vec384x Zz_powers[], size_t n)
+{
+    while (n--)
+        mul_fp2(map[n], isogeny_map[n], Zz_powers[n]);
+}
+
+static void map_fp2(vec384x acc, const vec384x x, const vec384x map[], size_t n)
+{
+    while (n--) {
+        mul_fp2(acc, acc, x);
+        add_fp2(acc, acc, map[n]);
+    }
+}
+
+static void isogeny_map_to_E2(POINTonE2 *out, const POINTonE2 *p)
+{
+    /*
+     * x = x_num / x_den, where
+     * x_num = k_(1,3) * x'^3 + k_(1,2) * x'^2 + k_(1,1) * x' + k_(1,0)
+     * ...
+     */
+    static const vec384x isogeny_map_x_num[] = {    /* (k_(1,*)<<384) % P   */
+     {{ TO_LIMB_T(0x47f671c71ce05e62), TO_LIMB_T(0x06dd57071206393e),
+        TO_LIMB_T(0x7c80cd2af3fd71a2), TO_LIMB_T(0x048103ea9e6cd062),
+        TO_LIMB_T(0xc54516acc8d037f6), TO_LIMB_T(0x13808f550920ea41) },
+      { TO_LIMB_T(0x47f671c71ce05e62), TO_LIMB_T(0x06dd57071206393e),
+        TO_LIMB_T(0x7c80cd2af3fd71a2), TO_LIMB_T(0x048103ea9e6cd062),
+        TO_LIMB_T(0xc54516acc8d037f6), TO_LIMB_T(0x13808f550920ea41) }},
+     {{ 0 },
+      { TO_LIMB_T(0x5fe55555554c71d0), TO_LIMB_T(0x873fffdd236aaaa3),
+        TO_LIMB_T(0x6a6b4619b26ef918), TO_LIMB_T(0x21c2888408874945),
+        TO_LIMB_T(0x2836cda7028cabc5), TO_LIMB_T(0x0ac73310a7fd5abd) }},
+     {{ TO_LIMB_T(0x0a0c5555555971c3), TO_LIMB_T(0xdb0c00101f9eaaae),
+        TO_LIMB_T(0xb1fb2f941d797997), TO_LIMB_T(0xd3960742ef416e1c),
+        TO_LIMB_T(0xb70040e2c20556f4), TO_LIMB_T(0x149d7861e581393b) },
+      { TO_LIMB_T(0xaff2aaaaaaa638e8), TO_LIMB_T(0x439fffee91b55551),
+        TO_LIMB_T(0xb535a30cd9377c8c), TO_LIMB_T(0x90e144420443a4a2),
+        TO_LIMB_T(0x941b66d3814655e2), TO_LIMB_T(0x0563998853fead5e) }},
+     {{ TO_LIMB_T(0x40aac71c71c725ed), TO_LIMB_T(0x190955557a84e38e),
+        TO_LIMB_T(0xd817050a8f41abc3), TO_LIMB_T(0xd86485d4c87f6fb1),
+        TO_LIMB_T(0x696eb479f885d059), TO_LIMB_T(0x198e1a74328002d2) },
+      { 0 }}
+    };
+    /* ...
+     * x_den = x'^2 + k_(2,1) * x' + k_(2,0)
+     */
+    static const vec384x isogeny_map_x_den[] = {    /* (k_(2,*)<<384) % P   */
+     {{ 0 },
+      { TO_LIMB_T(0x1f3affffff13ab97), TO_LIMB_T(0xf25bfc611da3ff3e),
+        TO_LIMB_T(0xca3757cb3819b208), TO_LIMB_T(0x3e6427366f8cec18),
+        TO_LIMB_T(0x03977bc86095b089), TO_LIMB_T(0x04f69db13f39a952) }},
+     {{ TO_LIMB_T(0x447600000027552e), TO_LIMB_T(0xdcb8009a43480020),
+        TO_LIMB_T(0x6f7ee9ce4a6e8b59), TO_LIMB_T(0xb10330b7c0a95bc6),
+        TO_LIMB_T(0x6140b1fcfb1e54b7), TO_LIMB_T(0x0381be097f0bb4e1) },
+      { TO_LIMB_T(0x7588ffffffd8557d), TO_LIMB_T(0x41f3ff646e0bffdf),
+        TO_LIMB_T(0xf7b1e8d2ac426aca), TO_LIMB_T(0xb3741acd32dbb6f8),
+        TO_LIMB_T(0xe9daf5b9482d581f), TO_LIMB_T(0x167f53e0ba7431b8) }}
+    };
+    /*
+     * y = y' * y_num / y_den, where
+     * y_num = k_(3,3) * x'^3 + k_(3,2) * x'^2 + k_(3,1) * x' + k_(3,0)
+     * ...
+     */
+    static const vec384x isogeny_map_y_num[] = {    /* (k_(3,*)<<384) % P   */
+     {{ TO_LIMB_T(0x96d8f684bdfc77be), TO_LIMB_T(0xb530e4f43b66d0e2),
+        TO_LIMB_T(0x184a88ff379652fd), TO_LIMB_T(0x57cb23ecfae804e1),
+        TO_LIMB_T(0x0fd2e39eada3eba9), TO_LIMB_T(0x08c8055e31c5d5c3) },
+      { TO_LIMB_T(0x96d8f684bdfc77be), TO_LIMB_T(0xb530e4f43b66d0e2),
+        TO_LIMB_T(0x184a88ff379652fd), TO_LIMB_T(0x57cb23ecfae804e1),
+        TO_LIMB_T(0x0fd2e39eada3eba9), TO_LIMB_T(0x08c8055e31c5d5c3) }},
+     {{ 0 },
+      { TO_LIMB_T(0xbf0a71c71c91b406), TO_LIMB_T(0x4d6d55d28b7638fd),
+        TO_LIMB_T(0x9d82f98e5f205aee), TO_LIMB_T(0xa27aa27b1d1a18d5),
+        TO_LIMB_T(0x02c3b2b2d2938e86), TO_LIMB_T(0x0c7d13420b09807f) }},
+     {{ TO_LIMB_T(0xd7f9555555531c74), TO_LIMB_T(0x21cffff748daaaa8),
+        TO_LIMB_T(0x5a9ad1866c9bbe46), TO_LIMB_T(0x4870a2210221d251),
+        TO_LIMB_T(0x4a0db369c0a32af1), TO_LIMB_T(0x02b1ccc429ff56af) },
+      { TO_LIMB_T(0xe205aaaaaaac8e37), TO_LIMB_T(0xfcdc000768795556),
+        TO_LIMB_T(0x0c96011a8a1537dd), TO_LIMB_T(0x1c06a963f163406e),
+        TO_LIMB_T(0x010df44c82a881e6), TO_LIMB_T(0x174f45260f808feb) }},
+     {{ TO_LIMB_T(0xa470bda12f67f35c), TO_LIMB_T(0xc0fe38e23327b425),
+        TO_LIMB_T(0xc9d3d0f2c6f0678d), TO_LIMB_T(0x1c55c9935b5a982e),
+        TO_LIMB_T(0x27f6c0e2f0746764), TO_LIMB_T(0x117c5e6e28aa9054) },
+      { 0 }}
+    };
+    /* ...
+     * y_den = x'^3 + k_(4,2) * x'^2 + k_(4,1) * x' + k_(4,0)
+     */
+    static const vec384x isogeny_map_y_den[] = {    /* (k_(4,*)<<384) % P   */
+     {{ TO_LIMB_T(0x0162fffffa765adf), TO_LIMB_T(0x8f7bea480083fb75),
+        TO_LIMB_T(0x561b3c2259e93611), TO_LIMB_T(0x11e19fc1a9c875d5),
+        TO_LIMB_T(0xca713efc00367660), TO_LIMB_T(0x03c6a03d41da1151) },
+      { TO_LIMB_T(0x0162fffffa765adf), TO_LIMB_T(0x8f7bea480083fb75),
+        TO_LIMB_T(0x561b3c2259e93611), TO_LIMB_T(0x11e19fc1a9c875d5),
+        TO_LIMB_T(0xca713efc00367660), TO_LIMB_T(0x03c6a03d41da1151) }},
+     {{ 0 },
+      { TO_LIMB_T(0x5db0fffffd3b02c5), TO_LIMB_T(0xd713f52358ebfdba),
+        TO_LIMB_T(0x5ea60761a84d161a), TO_LIMB_T(0xbb2c75a34ea6c44a),
+        TO_LIMB_T(0x0ac6735921c1119b), TO_LIMB_T(0x0ee3d913bdacfbf6) }},
+     {{ TO_LIMB_T(0x66b10000003affc5), TO_LIMB_T(0xcb1400e764ec0030),
+        TO_LIMB_T(0xa73e5eb56fa5d106), TO_LIMB_T(0x8984c913a0fe09a9),
+        TO_LIMB_T(0x11e10afb78ad7f13), TO_LIMB_T(0x05429d0e3e918f52) },
+      { TO_LIMB_T(0x534dffffffc4aae6), TO_LIMB_T(0x5397ff174c67ffcf),
+        TO_LIMB_T(0xbff273eb870b251d), TO_LIMB_T(0xdaf2827152870915),
+        TO_LIMB_T(0x393a9cbaca9e2dc3), TO_LIMB_T(0x14be74dbfaee5748) }}
+    };
+    vec384x Zz_powers[3], map[3], xn, xd, yn, yd;
+
+    /* lay down Z^2 powers in descending order                          */
+    sqr_fp2(Zz_powers[2], p->Z);                       /* ZZ^1          */
+    sqr_fp2(Zz_powers[1], Zz_powers[2]);               /* ZZ^2  1+1     */
+    mul_fp2(Zz_powers[0], Zz_powers[2], Zz_powers[1]); /* ZZ^3  2+1     */
+
+    map_fp2_times_Zz(map, isogeny_map_x_num, Zz_powers, 3);
+    mul_fp2(xn, p->X, isogeny_map_x_num[3]);
+    add_fp2(xn, xn, map[2]);
+    map_fp2(xn, p->X, map, 2);
+
+    map_fp2_times_Zz(map, isogeny_map_x_den, Zz_powers + 1, 2);
+    add_fp2(xd, p->X, map[1]);
+    map_fp2(xd, p->X, map, 1);
+    mul_fp2(xd, xd, Zz_powers[2]);      /* xd *= Z^2                    */
+
+    map_fp2_times_Zz(map, isogeny_map_y_num, Zz_powers, 3);
+    mul_fp2(yn, p->X, isogeny_map_y_num[3]);
+    add_fp2(yn, yn, map[2]);
+    map_fp2(yn, p->X, map, 2);
+    mul_fp2(yn, yn, p->Y);              /* yn *= Y                      */
+
+    map_fp2_times_Zz(map, isogeny_map_y_den, Zz_powers, 3);
+    add_fp2(yd, p->X, map[2]);
+    map_fp2(yd, p->X, map, 2);
+    mul_fp2(Zz_powers[2], Zz_powers[2], p->Z);
+    mul_fp2(yd, yd, Zz_powers[2]);      /* yd *= Z^3                    */
+
+    /* convert (xn, xd, yn, yd) to Jacobian coordinates                 */
+    mul_fp2(out->Z, xd, yd);            /* Z = xd * yd                  */
+    mul_fp2(out->X, xn, yd);
+    mul_fp2(out->X, out->X, out->Z);    /* X = xn * xd * yd^2           */
+    sqr_fp2(out->Y, out->Z);
+    mul_fp2(out->Y, out->Y, xd);
+    mul_fp2(out->Y, out->Y, yn);        /* Y = yn * xd^3 * yd^2         */
+}
+
+static void map_to_isogenous_E2(POINTonE2 *p, const vec384x u)
+{
+    static const vec384x minus_A = {
+      { 0 },
+      { TO_LIMB_T(0xd4c4fffffcec5869), TO_LIMB_T(0x1da3f3eed25bfd79),
+        TO_LIMB_T(0x7fa833c5136fff67), TO_LIMB_T(0x59261433cd540cbd),
+        TO_LIMB_T(0x48450f5f2b84682c), TO_LIMB_T(0x07e05d00bf959233) }
+    };
+    static const vec384x Z = {              /* -2 - i */
+      { TO_LIMB_T(0x87ebfffffff9555c), TO_LIMB_T(0x656fffe5da8ffffa),
+        TO_LIMB_T(0x0fd0749345d33ad2), TO_LIMB_T(0xd951e663066576f4),
+        TO_LIMB_T(0xde291a3d41e980d3), TO_LIMB_T(0x0815664c7dfe040d) },
+      { TO_LIMB_T(0x43f5fffffffcaaae), TO_LIMB_T(0x32b7fff2ed47fffd),
+        TO_LIMB_T(0x07e83a49a2e99d69), TO_LIMB_T(0xeca8f3318332bb7a),
+        TO_LIMB_T(0xef148d1ea0f4c069), TO_LIMB_T(0x040ab3263eff0206) }
+    };
+    static const vec384x recip_ZZZ = {      /* 1/(Z^3) */
+      { TO_LIMB_T(0x65018f5c28f598eb), TO_LIMB_T(0xe6020417f022d916),
+        TO_LIMB_T(0xd6327313288369c7), TO_LIMB_T(0x622ded8eb447156f),
+        TO_LIMB_T(0xe52a2aee72c2a01f), TO_LIMB_T(0x089812fb8481ffe4) },
+      { TO_LIMB_T(0x2574eb851eb8619f), TO_LIMB_T(0xdba2e97912925604),
+        TO_LIMB_T(0x67e495a909e7a18e), TO_LIMB_T(0xdf2da23b8145b8f7),
+        TO_LIMB_T(0xcf5d3728310ebf6d), TO_LIMB_T(0x11be446236f4c116) }
+    };
+    static const vec384x magic_ZZZ = {      /* 1/Z^3 = a + b*i */
+                                            /* a^2 + b^2 */
+      { TO_LIMB_T(0xaa7eb851eb8508e0), TO_LIMB_T(0x1c54fdf360989374),
+        TO_LIMB_T(0xc87f2fc6e716c62e), TO_LIMB_T(0x0124aefb1f9efea7),
+        TO_LIMB_T(0xb2f8be63e844865c), TO_LIMB_T(0x08b47f775a7ef35a) },
+                                            /* (a^2 + b^2)^((P-3)/4) */
+      { TO_LIMB_T(0xe4132bbd838cf70a), TO_LIMB_T(0x01d769ac83772c19),
+        TO_LIMB_T(0xa83dd6e974c22e45), TO_LIMB_T(0xbc8ec3e777b08dff),
+        TO_LIMB_T(0xc035c2042ecf5da3), TO_LIMB_T(0x073929e97f0850bf) }
+    };
+    static const vec384x ZxA = {            /* 240 - 480*i */
+      { TO_LIMB_T(0xe53a000003135242), TO_LIMB_T(0x01080c0fdef80285),
+        TO_LIMB_T(0xe7889edbe340f6bd), TO_LIMB_T(0x0b51375126310601),
+        TO_LIMB_T(0x02d6985717c744ab), TO_LIMB_T(0x1220b4e979ea5467) },
+      { TO_LIMB_T(0xa989fffff9d8b0d2), TO_LIMB_T(0x3b47e7dda4b7faf3),
+        TO_LIMB_T(0xff50678a26dffece), TO_LIMB_T(0xb24c28679aa8197a),
+        TO_LIMB_T(0x908a1ebe5708d058), TO_LIMB_T(0x0fc0ba017f2b2466) }
+    };
+    vec384x uu, tv2, tv4, x2n, gx1, gxd, y2;
+#if 0
+    vec384x xn, x1n, xd, y, y1, Zuu;
+#else
+# define xn     p->X
+# define y      p->Y
+# define xd     p->Z
+# define x1n    xn
+# define y1     y
+# define Zuu    x2n
+#endif
+#define sgn0_fp2(a) (sgn0_pty_mont_384x((a), BLS12_381_P, p0) & 1)
+    bool_t e1, e2;
+
+    /*
+     * as per map_to_curve() from poc/sswu_opt.sage at
+     * https://github.com/cfrg/draft-irtf-cfrg-hash-to-curve
+     * with 9mod16 twists...
+     */
+    /* x numerator variants                                             */
+    sqr_fp2(uu, u);                     /* uu = u^2                     */
+    mul_fp2(Zuu, Z, uu);                /* Zuu = Z * uu                 */
+    sqr_fp2(tv2, Zuu);                  /* tv2 = Zuu^2                  */
+    add_fp2(tv2, tv2, Zuu);             /* tv2 = tv2 + Zuu              */
+    add_fp2(x1n, tv2, BLS12_381_Rx.p2); /* x1n = tv2 + 1                */
+    mul_fp2(x1n, x1n, Bprime_E2);       /* x1n = x1n * B                */
+    mul_fp2(x2n, Zuu, x1n);             /* x2n = Zuu * x1n              */
+
+    /* x denumenator                                                    */
+    mul_fp2(xd, minus_A, tv2);          /* xd = -A * tv2                */
+    e1 = vec_is_zero(xd, sizeof(xd));   /* e1 = xd == 0                 */
+    vec_select(xd, ZxA, xd, sizeof(xd), e1);    /*              # If xd == 0, set xd = Z*A */
+
+    /* y numerators variants                                            */
+    sqr_fp2(tv2, xd);                   /* tv2 = xd^2                   */
+    mul_fp2(gxd, xd, tv2);              /* gxd = xd^3                   */
+    mul_fp2(tv2, Aprime_E2, tv2);       /* tv2 = A * tv2                */
+    sqr_fp2(gx1, x1n);                  /* gx1 = x1n^2                  */
+    add_fp2(gx1, gx1, tv2);             /* gx1 = gx1 + tv2      # x1n^2 + A*xd^2 */
+    mul_fp2(gx1, gx1, x1n);             /* gx1 = gx1 * x1n      # x1n^3 + A*x1n*xd^2 */
+    mul_fp2(tv2, Bprime_E2, gxd);       /* tv2 = B * gxd                */
+    add_fp2(gx1, gx1, tv2);             /* gx1 = gx1 + tv2      # x1^3 + A*x1*xd^2 + B*xd^3 */
+    sqr_fp2(tv4, gxd);                  /* tv4 = gxd^2                  */
+    mul_fp2(tv2, gx1, gxd);             /* tv2 = gx1 * gxd              */
+    mul_fp2(tv4, tv4, tv2);             /* tv4 = tv4 * tv2      # gx1*gxd^3 */
+    e2 = recip_sqrt_fp2(y1, tv4,        /* y1 = tv4^c1          # (gx1*gxd^3)^((p^2-9)/16) */
+                        recip_ZZZ, magic_ZZZ);
+    mul_fp2(y1, y1, tv2);               /* y1 = y1 * tv2        # gx1*gxd*y1 */
+    mul_fp2(y2, y1, uu);                /* y2 = y1 * uu                 */
+    mul_fp2(y2, y2, u);                 /* y2 = y2 * u                  */
+
+    /* choose numerators                                                */
+    vec_select(xn, x1n, x2n, sizeof(xn), e2);   /* xn = e2 ? x1n : x2n  */
+    vec_select(y, y1, y2, sizeof(y), e2);       /* y  = e2 ? y1 : y2    */
+
+    e1 = sgn0_fp2(u);
+    e2 = sgn0_fp2(y);
+    cneg_fp2(y, y, e1^e2);              /* fix sign of y                */
+                                        /* return (xn, xd, y, 1)        */
+
+    /* convert (xn, xd, y, 1) to Jacobian projective coordinates        */
+    mul_fp2(p->X, xn, xd);              /* X = xn * xd                  */
+    mul_fp2(p->Y, y, gxd);              /* Y = y * xd^3                 */
+#ifndef xd
+    vec_copy(p->Z, xd, sizeof(xd));     /* Z = xd                       */
+#else
+# undef xn
+# undef y
+# undef xd
+# undef x1n
+# undef y1
+# undef Zuu
+# undef tv4
+#endif
+#undef sgn0_fp2
+}
+
+#if 0
+static const byte h_eff[] = {
+    TO_BYTES(0xe8020005aaa95551), TO_BYTES(0x59894c0adebbf6b4),
+    TO_BYTES(0xe954cbc06689f6a3), TO_BYTES(0x2ec0ec69d7477c1a),
+    TO_BYTES(0x6d82bf015d1212b0), TO_BYTES(0x329c2f178731db95),
+    TO_BYTES(0x9986ff031508ffe1), TO_BYTES(0x88e2a8e9145ad768),
+    TO_BYTES(0x584c6a0ea91b3528), TO_BYTES(0x0bc69f08f2ee75b3)
+};
+
+static void clear_cofactor(POINTonE2 *out, const POINTonE2 *p)
+{    POINTonE2_mult_w5(out, p, h_eff, 636);   }
+#else
+/*
+ * As per suggestions in "7. Clearing the cofactor" at
+ * https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06
+ */
+static void POINTonE2_add_n_dbl(POINTonE2 *out, const POINTonE2 *p, size_t n)
+{
+    POINTonE2_dadd(out, out, p, NULL);
+    while(n--)
+        POINTonE2_double(out, out);
+}
+
+static void POINTonE2_times_minus_z(POINTonE2 *out, const POINTonE2 *in)
+{
+    POINTonE2_double(out, in);          /*      1: 0x2                  */
+    POINTonE2_add_n_dbl(out, in, 2);    /*   2..4: 0x3..0xc             */
+    POINTonE2_add_n_dbl(out, in, 3);    /*   5..8: 0xd..0x68            */
+    POINTonE2_add_n_dbl(out, in, 9);    /*  9..18: 0x69..0xd200         */
+    POINTonE2_add_n_dbl(out, in, 32);   /* 19..51: ..0xd20100000000     */
+    POINTonE2_add_n_dbl(out, in, 16);   /* 52..68: ..0xd201000000010000 */
+}
+
+static void psi(POINTonE2 *out, const POINTonE2 *in);
+
+static void clear_cofactor(POINTonE2 *out, const POINTonE2 *p)
+{
+    POINTonE2 t0, t1;
+
+    /* A.Budroni, F.Pintore, "Efficient hash maps to G2 on BLS curves"  */
+    POINTonE2_double(out, p);           /* out = 2P                     */
+    psi(out, out);                      /* out = Ψ(2P)                  */
+    psi(out, out);                      /* out = Ψ²(2P)                 */
+
+    vec_copy(&t0, p, sizeof(t0));
+    POINTonE2_cneg(&t0, 1);             /* t0 = -P                      */
+    psi(&t1, &t0);                      /* t1 = -Ψ(P)                   */
+    POINTonE2_dadd(out, out, &t0, NULL);/* out = Ψ²(2P) - P             */
+    POINTonE2_dadd(out, out, &t1, NULL);/* out = Ψ²(2P) - P - Ψ(P)      */
+
+    POINTonE2_times_minus_z(&t0, p);    /* t0 = [-z]P                   */
+    POINTonE2_dadd(&t0, &t0, p, NULL);  /* t0 = [-z + 1]P               */
+    POINTonE2_dadd(&t0, &t0, &t1, NULL);/* t0 = [-z + 1]P - Ψ(P)        */
+    POINTonE2_times_minus_z(&t1, &t0);  /* t1 = [z² - z]P + [z]Ψ(P)     */
+    POINTonE2_dadd(out, out, &t1, NULL);/* out = [z² - z - 1]P          */
+                                        /*     + [z - 1]Ψ(P)            */
+                                        /*     + Ψ²(2P)                 */
+}
+#endif
+
+/*
+ * |u|, |v| are expected to be in Montgomery representation
+ */
+static void map_to_g2(POINTonE2 *out, const vec384x u, const vec384x v)
+{
+    POINTonE2 p;
+
+    map_to_isogenous_E2(&p, u);
+
+    if (v != NULL) {
+        map_to_isogenous_E2(out, v);    /* borrow |out|                 */
+        POINTonE2_dadd(&p, &p, out, Aprime_E2);
+    }
+
+    isogeny_map_to_E2(&p, &p);          /* sprinkle isogenous powder    */
+    clear_cofactor(out, &p);
+}
+
+void blst_map_to_g2(POINTonE2 *out, const vec384x u, const vec384x v)
+{   map_to_g2(out, u, v);   }
+
+static void Encode_to_G2(POINTonE2 *p, const unsigned char *msg, size_t msg_len,
+                                       const unsigned char *DST, size_t DST_len,
+                                       const unsigned char *aug, size_t aug_len)
+{
+    vec384x u[1];
+
+    hash_to_field(u[0], 2, aug, aug_len, msg, msg_len, DST, DST_len);
+    map_to_g2(p, u[0], NULL);
+}
+
+void blst_encode_to_g2(POINTonE2 *p, const unsigned char *msg, size_t msg_len,
+                                     const unsigned char *DST, size_t DST_len,
+                                     const unsigned char *aug, size_t aug_len)
+{   Encode_to_G2(p, msg, msg_len, DST, DST_len, aug, aug_len);   }
+
+static void Hash_to_G2(POINTonE2 *p, const unsigned char *msg, size_t msg_len,
+                                     const unsigned char *DST, size_t DST_len,
+                                     const unsigned char *aug, size_t aug_len)
+{
+    vec384x u[2];
+
+    hash_to_field(u[0], 4, aug, aug_len, msg, msg_len, DST, DST_len);
+    map_to_g2(p, u[0], u[1]);
+}
+
+void blst_hash_to_g2(POINTonE2 *p, const unsigned char *msg, size_t msg_len,
+                                   const unsigned char *DST, size_t DST_len,
+                                   const unsigned char *aug, size_t aug_len)
+{   Hash_to_G2(p, msg, msg_len, DST, DST_len, aug, aug_len);   }
+
+static bool_t POINTonE2_in_G2(const POINTonE2 *P)
+{
+#if 0
+    POINTonE2 t0, t1, t2;
+
+    /* Bowe, S., "Faster subgroup checks for BLS12-381"                 */
+    psi(&t0, P);                        /* Ψ(P)                         */
+    psi(&t0, &t0);                      /* Ψ²(P)                        */
+    psi(&t1, &t0);                      /* Ψ³(P)                        */
+
+    POINTonE2_times_minus_z(&t2, &t1);
+    POINTonE2_dadd(&t0, &t0, &t2, NULL);
+    POINTonE2_cneg(&t0, 1);
+    POINTonE2_dadd(&t0, &t0, P, NULL);  /* [z]Ψ³(P) - Ψ²(P) + P         */
+
+    return vec_is_zero(t0.Z, sizeof(t0.Z));
+#else
+    POINTonE2 t0, t1;
+
+    /* Scott, M., https://eprint.iacr.org/2021/1130 */
+    psi(&t0, P);                            /* Ψ(P) */
+
+    POINTonE2_times_minus_z(&t1, P);
+    POINTonE2_cneg(&t1, 1);                 /* [z]P */
+
+    return POINTonE2_is_equal(&t0, &t1);
+#endif
+}
+
+int blst_p2_in_g2(const POINTonE2 *p)
+{   return (int)POINTonE2_in_G2(p);   }
+
+int blst_p2_affine_in_g2(const POINTonE2_affine *p)
+{
+    POINTonE2 P;
+
+    vec_copy(P.X, p->X, 2*sizeof(P.X));
+    vec_select(P.Z, p->X, BLS12_381_Rx.p, sizeof(P.Z),
+                     vec_is_zero(p, sizeof(*p)));
+
+    return (int)POINTonE2_in_G2(&P);
+}
diff --git a/vendor/external/blst/src/multi_scalar.c b/vendor/external/blst/src/multi_scalar.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/multi_scalar.c
@@ -0,0 +1,427 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "fields.h"
+#include "point.h"
+
+/*
+ * Infinite point among inputs would be devastating. Shall we change it?
+ */
+#define POINTS_TO_AFFINE_IMPL(prefix, ptype, bits, field) \
+static void ptype##s_to_affine(ptype##_affine dst[], \
+                               const ptype *const points[], size_t npoints) \
+{ \
+    size_t i; \
+    vec##bits *acc, ZZ, ZZZ; \
+    const ptype *point = NULL; \
+    const size_t stride = sizeof(ptype)==sizeof(POINTonE1) ? 1536 : 768; \
+\
+    while (npoints) { \
+        const ptype *p, *const *walkback; \
+        size_t delta = stride<npoints ? stride : npoints; \
+\
+        point = *points ? *points++ : point+1; \
+        acc = (vec##bits *)dst; \
+        vec_copy(acc++, point->Z, sizeof(vec##bits)); \
+        for (i = 1; i < delta; i++, acc++) \
+            point = *points ? *points++ : point+1, \
+            mul_##field(acc[0], acc[-1], point->Z); \
+\
+        --acc; reciprocal_##field(acc[0], acc[0]); \
+\
+        walkback = points-1, p = point, --delta, dst += delta; \
+        for (i = 0; i < delta; i++, acc--, dst--) { \
+            mul_##field(acc[-1], acc[-1], acc[0]);  /* 1/Z        */\
+            sqr_##field(ZZ, acc[-1]);               /* 1/Z^2      */\
+            mul_##field(ZZZ, ZZ, acc[-1]);          /* 1/Z^3      */\
+            mul_##field(acc[-1], p->Z, acc[0]);     \
+            mul_##field(dst->X,  p->X, ZZ);         /* X = X'/Z^2 */\
+            mul_##field(dst->Y,  p->Y, ZZZ);        /* Y = Y'/Z^3 */\
+            p = (p == *walkback) ? *--walkback : p-1; \
+        } \
+        sqr_##field(ZZ, acc[0]);                    /* 1/Z^2      */\
+        mul_##field(ZZZ, ZZ, acc[0]);               /* 1/Z^3      */\
+        mul_##field(dst->X, p->X, ZZ);              /* X = X'/Z^2 */\
+        mul_##field(dst->Y, p->Y, ZZZ);             /* Y = Y'/Z^3 */\
+        ++delta, dst += delta, npoints -= delta; \
+    } \
+} \
+\
+void prefix##s_to_affine(ptype##_affine dst[], const ptype *const points[], \
+                         size_t npoints) \
+{   ptype##s_to_affine(dst, points, npoints);   }
+
+POINTS_TO_AFFINE_IMPL(blst_p1, POINTonE1, 384, fp)
+POINTS_TO_AFFINE_IMPL(blst_p2, POINTonE2, 384x, fp2)
+
+/*
+ * This is two-step multi-scalar multiplication procedure. First, given
+ * a set of points you pre-compute a table for chosen windowing factor
+ * [expressed in bits with value between 2 and 14], and then you pass
+ * this table to the actual multiplication procedure along with scalars.
+ * Idea is that the pre-computed table will be reused multiple times. In
+ * which case multiplication runs faster than below Pippenger algorithm
+ * implementation for up to ~16K points for wbits=8, naturally at the
+ * expense of multi-megabyte table. One can trade even more memory for
+ * performance, but each wbits increment doubles the memory requirement,
+ * so at some point it gets prohibively large... For reference, without
+ * reusing the table it's faster than Pippenger algorithm for up ~32
+ * points [with wbits=5]...
+ */
+
+#define SCRATCH_SZ(ptype) (sizeof(ptype)==sizeof(POINTonE1) ? 8192 : 4096)
+
+#define PRECOMPUTE_WBITS_IMPL(prefix, ptype, bits, field, one) \
+static void ptype##_precompute_row_wbits(ptype row[], size_t wbits, \
+                                         const ptype##_affine *point) \
+{ \
+    size_t i, j, n = (size_t)1 << (wbits-1); \
+                                          /* row[-1] is implicit infinity */\
+    vec_copy(&row[0], point, sizeof(*point));           /* row[0]=p*1     */\
+    vec_copy(&row[0].Z, one, sizeof(row[0].Z));                             \
+    ptype##_double(&row[1],  &row[0]);                  /* row[1]=p*(1+1) */\
+    for (i = 2, j = 1; i < n; i += 2, j++) \
+        ptype##_add_affine(&row[i], &row[i-1], point),  /* row[2]=p*(2+1) */\
+        ptype##_double(&row[i+1], &row[j]);             /* row[3]=p*(2+2) */\
+}                                                       /* row[4] ...     */\
+\
+static void ptype##s_to_affine_row_wbits(ptype##_affine dst[], ptype src[], \
+                                         size_t wbits, size_t npoints) \
+{ \
+    size_t total = npoints << (wbits-1); \
+    size_t nwin = (size_t)1 << (wbits-1); \
+    size_t i, j; \
+    vec##bits *acc, ZZ, ZZZ; \
+\
+    src += total; \
+    acc = (vec##bits *)src; \
+    vec_copy(acc++, one, sizeof(vec##bits)); \
+    for (i = 0; i < npoints; i++) \
+        for (j = nwin; --src, --j; acc++)    \
+            mul_##field(acc[0], acc[-1], src->Z); \
+\
+    --acc; reciprocal_##field(acc[0], acc[0]); \
+\
+    for (i = 0; i < npoints; i++) { \
+        vec_copy(dst++, src++, sizeof(ptype##_affine)); \
+        for (j = 1; j < nwin; j++, acc--, src++, dst++) { \
+            mul_##field(acc[-1], acc[-1], acc[0]);  /* 1/Z        */\
+            sqr_##field(ZZ, acc[-1]);               /* 1/Z^2      */\
+            mul_##field(ZZZ, ZZ, acc[-1]);          /* 1/Z^3      */\
+            mul_##field(acc[-1], src->Z, acc[0]);                   \
+            mul_##field(dst->X, src->X, ZZ);        /* X = X'/Z^2 */\
+            mul_##field(dst->Y, src->Y, ZZZ);       /* Y = Y'/Z^3 */\
+        } \
+    } \
+} \
+\
+/* flat |points[n]| can be placed at the end of |table[n<<(wbits-1)]| */\
+static void ptype##s_precompute_wbits(ptype##_affine table[], size_t wbits, \
+                                      const ptype##_affine *const points[], \
+                                      size_t npoints) \
+{ \
+    size_t total = npoints << (wbits-1); \
+    size_t nwin = (size_t)1 << (wbits-1); \
+    size_t nmin = wbits>9 ? (size_t)1: (size_t)1 << (9-wbits); \
+    size_t i, top = 0; \
+    ptype *rows, *row; \
+    const ptype##_affine *point = NULL; \
+    size_t stride = ((512*1024)/sizeof(ptype##_affine)) >> wbits; \
+    if (stride == 0) stride = 1; \
+\
+    while (npoints >= nmin) { \
+        size_t limit = total - npoints; \
+\
+        if (top + (stride << wbits) > limit) { \
+            stride = (limit - top) >> wbits;   \
+            if (stride == 0) break;            \
+        } \
+        rows = row = (ptype *)(&table[top]); \
+        for (i = 0; i < stride; i++, row += nwin) \
+            point = *points ? *points++ : point+1, \
+            ptype##_precompute_row_wbits(row, wbits, point); \
+        ptype##s_to_affine_row_wbits(&table[top], rows, wbits, stride); \
+        top += stride << (wbits-1); \
+        npoints -= stride; \
+    } \
+    rows = row = alloca(2*sizeof(ptype##_affine) * npoints * nwin); \
+    for (i = 0; i < npoints; i++, row += nwin) \
+        point = *points ? *points++ : point+1, \
+        ptype##_precompute_row_wbits(row, wbits, point); \
+    ptype##s_to_affine_row_wbits(&table[top], rows, wbits, npoints); \
+} \
+\
+size_t prefix##s_mult_wbits_precompute_sizeof(size_t wbits, size_t npoints) \
+{ return (sizeof(ptype##_affine)*npoints) << (wbits-1); } \
+void prefix##s_mult_wbits_precompute(ptype##_affine table[], size_t wbits, \
+                                     const ptype##_affine *const points[], \
+                                     size_t npoints) \
+{ ptype##s_precompute_wbits(table, wbits, points, npoints); }
+
+#define POINTS_MULT_WBITS_IMPL(prefix, ptype, bits, field, one) \
+static void ptype##_gather_booth_wbits(ptype *p, const ptype##_affine row[], \
+                                       size_t wbits, limb_t booth_idx) \
+{ \
+    bool_t booth_sign = (booth_idx >> wbits) & 1; \
+    bool_t idx_is_zero; \
+    static const ptype##_affine infinity = { 0 }; \
+\
+    booth_idx &= ((limb_t)1 << wbits) - 1; \
+    idx_is_zero = is_zero(booth_idx); \
+    booth_idx -= 1 ^ idx_is_zero; \
+    vec_select(p, &infinity, &row[booth_idx], sizeof(row[0]), idx_is_zero); \
+    ptype##_cneg(p, booth_sign); \
+} \
+\
+static void ptype##s_mult_wbits(ptype *ret, const ptype##_affine table[], \
+                                size_t wbits, size_t npoints, \
+                                const byte *const scalars[], size_t nbits, \
+                                ptype scratch[]) \
+{ \
+    limb_t wmask, wval; \
+    size_t i, j, z, nbytes, window, nwin = (size_t)1 << (wbits-1); \
+    const byte *scalar, *const *scalar_s = scalars; \
+    const ptype##_affine *row = table; \
+\
+    size_t scratch_sz = SCRATCH_SZ(ptype); \
+    if (scratch == NULL) { \
+        scratch_sz /= 4; /* limit to 288K */ \
+        scratch_sz = scratch_sz < npoints ? scratch_sz : npoints; \
+        scratch = alloca(sizeof(ptype) * scratch_sz); \
+    } \
+\
+    nbytes = (nbits + 7)/8; /* convert |nbits| to bytes */ \
+    scalar = *scalar_s++; \
+\
+    /* top excess bits modulo target window size */ \
+    window = nbits % wbits; /* yes, it may be zero */ \
+    wmask = ((limb_t)1 << (window + 1)) - 1; \
+\
+    nbits -= window; \
+    z = is_zero(nbits); \
+    wval = (get_wval_limb(scalar, nbits - (z^1), wbits + (z^1)) << z) & wmask; \
+    wval = booth_encode(wval, wbits); \
+    ptype##_gather_booth_wbits(&scratch[0], row, wbits, wval); \
+    row += nwin; \
+\
+    i = 1; vec_zero(ret, sizeof(*ret)); \
+    while (nbits > 0) { \
+        for (j = i; i < npoints; i++, j++, row += nwin) { \
+            if (j == scratch_sz) \
+                ptype##s_accumulate(ret, scratch, j), j = 0; \
+            scalar = *scalar_s ? *scalar_s++ : scalar+nbytes; \
+            wval = get_wval_limb(scalar, nbits - 1, window + 1) & wmask; \
+            wval = booth_encode(wval, wbits); \
+            ptype##_gather_booth_wbits(&scratch[j], row, wbits, wval); \
+        } \
+        ptype##s_accumulate(ret, scratch, j); \
+\
+        for (j = 0; j < wbits; j++) \
+            ptype##_double(ret, ret); \
+\
+        window = wbits; \
+        wmask = ((limb_t)1 << (window + 1)) - 1; \
+        nbits -= window; \
+        i = 0; row = table; scalar_s = scalars; \
+    } \
+\
+    for (j = i; i < npoints; i++, j++, row += nwin) { \
+        if (j == scratch_sz) \
+            ptype##s_accumulate(ret, scratch, j), j = 0; \
+        scalar = *scalar_s ? *scalar_s++ : scalar+nbytes; \
+        wval = (get_wval_limb(scalar, 0, wbits) << 1) & wmask; \
+        wval = booth_encode(wval, wbits); \
+        ptype##_gather_booth_wbits(&scratch[j], row, wbits, wval); \
+    } \
+    ptype##s_accumulate(ret, scratch, j); \
+} \
+\
+size_t prefix##s_mult_wbits_scratch_sizeof(size_t npoints) \
+{ \
+    const size_t scratch_sz = SCRATCH_SZ(ptype); \
+    return sizeof(ptype) * (npoints < scratch_sz ? npoints : scratch_sz); \
+} \
+void prefix##s_mult_wbits(ptype *ret, const ptype##_affine table[], \
+                          size_t wbits, size_t npoints, \
+                          const byte *const scalars[], size_t nbits, \
+                          ptype scratch[]) \
+{ ptype##s_mult_wbits(ret, table, wbits, npoints, scalars, nbits, scratch); }
+
+PRECOMPUTE_WBITS_IMPL(blst_p1, POINTonE1, 384, fp, BLS12_381_Rx.p)
+POINTS_MULT_WBITS_IMPL(blst_p1, POINTonE1, 384, fp, BLS12_381_Rx.p)
+
+PRECOMPUTE_WBITS_IMPL(blst_p2, POINTonE2, 384x, fp2, BLS12_381_Rx.p2)
+POINTS_MULT_WBITS_IMPL(blst_p2, POINTonE2, 384x, fp2, BLS12_381_Rx.p2)
+
+/*
+ * Pippenger algorithm implementation, fastest option for larger amount
+ * of points...
+ */
+
+static size_t pippenger_window_size(size_t npoints)
+{
+    size_t wbits;
+
+    for (wbits=0; npoints>>=1; wbits++) ;
+
+    return wbits>12 ? wbits-3 : (wbits>4 ? wbits-2 : (wbits ? 2 : 1));
+}
+
+#define DECLARE_PRIVATE_POINTXYZZ(ptype, bits) \
+typedef struct { vec##bits X,Y,ZZZ,ZZ; } ptype##xyzz;
+
+#define POINTS_MULT_PIPPENGER_IMPL(prefix, ptype) \
+static void ptype##_integrate_buckets(ptype *out, ptype##xyzz buckets[], \
+                                                  size_t wbits) \
+{ \
+    ptype##xyzz ret[1], acc[1]; \
+    size_t n = (size_t)1 << wbits; \
+\
+    /* Calculate sum of x[i-1]*i for i=1 through 1<<|wbits|. */\
+    vec_copy(acc, &buckets[--n], sizeof(acc)); \
+    vec_copy(ret, &buckets[n], sizeof(ret)); \
+    vec_zero(&buckets[n], sizeof(buckets[n])); \
+    while (n--) { \
+        ptype##xyzz_dadd(acc, acc, &buckets[n]); \
+        ptype##xyzz_dadd(ret, ret, acc); \
+        vec_zero(&buckets[n], sizeof(buckets[n])); \
+    } \
+    ptype##xyzz_to_Jacobian(out, ret); \
+} \
+\
+static void ptype##_bucket(ptype##xyzz buckets[], limb_t booth_idx, \
+                           size_t wbits, const ptype##_affine *p) \
+{ \
+    bool_t booth_sign = (booth_idx >> wbits) & 1; \
+\
+    booth_idx &= (1<<wbits) - 1; \
+    if (booth_idx--) \
+        ptype##xyzz_dadd_affine(&buckets[booth_idx], &buckets[booth_idx], \
+                                                     p, booth_sign); \
+} \
+\
+static void ptype##_prefetch(const ptype##xyzz buckets[], limb_t booth_idx, \
+                             size_t wbits) \
+{ \
+    booth_idx &= (1<<wbits) - 1; \
+    if (booth_idx--) \
+        vec_prefetch(&buckets[booth_idx], sizeof(buckets[booth_idx])); \
+} \
+\
+static void ptype##s_tile_pippenger(ptype *ret, \
+                                    const ptype##_affine *const points[], \
+                                    size_t npoints, \
+                                    const byte *const scalars[], size_t nbits, \
+                                    ptype##xyzz buckets[], \
+                                    size_t bit0, size_t wbits, size_t cbits) \
+{ \
+    limb_t wmask, wval, wnxt; \
+    size_t i, z, nbytes; \
+    const byte *scalar = *scalars++; \
+    const ptype##_affine *point = *points++; \
+\
+    nbytes = (nbits + 7)/8; /* convert |nbits| to bytes */ \
+    wmask = ((limb_t)1 << (wbits+1)) - 1; \
+    z = is_zero(bit0); \
+    bit0 -= z^1; wbits += z^1; \
+    wval = (get_wval_limb(scalar, bit0, wbits) << z) & wmask; \
+    wval = booth_encode(wval, cbits); \
+    scalar = *scalars ? *scalars++ : scalar+nbytes; \
+    wnxt = (get_wval_limb(scalar, bit0, wbits) << z) & wmask; \
+    wnxt = booth_encode(wnxt, cbits); \
+    npoints--;  /* account for prefetch */ \
+\
+    ptype##_bucket(buckets, wval, cbits, point); \
+    for (i = 1; i < npoints; i++) { \
+        wval = wnxt; \
+        scalar = *scalars ? *scalars++ : scalar+nbytes; \
+        wnxt = (get_wval_limb(scalar, bit0, wbits) << z) & wmask; \
+        wnxt = booth_encode(wnxt, cbits); \
+        ptype##_prefetch(buckets, wnxt, cbits); \
+        point = *points ? *points++ : point+1; \
+        ptype##_bucket(buckets, wval, cbits, point); \
+    } \
+    point = *points ? *points++ : point+1; \
+    ptype##_bucket(buckets, wnxt, cbits, point); \
+    ptype##_integrate_buckets(ret, buckets, cbits - 1); \
+} \
+\
+static void ptype##s_mult_pippenger(ptype *ret, \
+                                    const ptype##_affine *const points[], \
+                                    size_t npoints, \
+                                    const byte *const scalars[], size_t nbits, \
+                                    ptype##xyzz buckets[], size_t window) \
+{ \
+    size_t i, wbits, cbits, bit0 = nbits; \
+    ptype tile[1]; \
+\
+    window = window ? window : pippenger_window_size(npoints); \
+    vec_zero(buckets, sizeof(buckets[0]) << (window-1)); \
+    vec_zero(ret, sizeof(*ret)); \
+\
+    /* top excess bits modulo target window size */ \
+    wbits = nbits % window; /* yes, it may be zero */ \
+    cbits = wbits + 1; \
+    while (bit0 -= wbits) { \
+        ptype##s_tile_pippenger(tile, points, npoints, scalars, nbits, \
+                                      buckets, bit0, wbits, cbits); \
+        ptype##_dadd(ret, ret, tile, NULL); \
+        for (i = 0; i < window; i++) \
+            ptype##_double(ret, ret); \
+        cbits = wbits = window; \
+    } \
+    ptype##s_tile_pippenger(tile, points, npoints, scalars, nbits, \
+                                  buckets, 0, wbits, cbits); \
+    ptype##_dadd(ret, ret, tile, NULL); \
+} \
+\
+size_t prefix##s_mult_pippenger_scratch_sizeof(size_t npoints) \
+{   return sizeof(ptype##xyzz) << (pippenger_window_size(npoints)-1);   } \
+void prefix##s_tile_pippenger(ptype *ret, \
+                              const ptype##_affine *const points[], \
+                              size_t npoints, \
+                              const byte *const scalars[], size_t nbits, \
+                              ptype##xyzz scratch[], \
+                              size_t bit0, size_t window) \
+{ \
+    size_t wbits, cbits; \
+\
+    if (bit0 + window > nbits)  wbits = nbits - bit0, cbits = wbits + 1; \
+    else                        wbits = cbits = window; \
+    ptype##s_tile_pippenger(ret, points, npoints, scalars, nbits, scratch, \
+                                 bit0, wbits, cbits); \
+} \
+void prefix##s_mult_pippenger(ptype *ret, \
+                              const ptype##_affine *const points[], \
+                              size_t npoints, \
+                              const byte *const scalars[], size_t nbits, \
+                              ptype##xyzz scratch[]) \
+{ \
+    if (npoints == 1) { \
+        prefix##_from_affine(ret, points[0]); \
+        prefix##_mult(ret, ret, scalars[0], nbits); \
+        return; \
+    } \
+    if ((npoints * sizeof(ptype##_affine) * 8 * 3) <= SCRATCH_LIMIT) { \
+        ptype##_affine *table = alloca(npoints * sizeof(ptype##_affine) * 8); \
+        ptype##s_precompute_wbits(table, 4, points, npoints); \
+        ptype##s_mult_wbits(ret, table, 4, npoints, scalars, nbits, NULL); \
+        return; \
+    } \
+    ptype##s_mult_pippenger(ret, points, npoints, scalars, nbits, scratch, 0); \
+}
+
+DECLARE_PRIVATE_POINTXYZZ(POINTonE1, 384)
+POINTXYZZ_TO_JACOBIAN_IMPL(POINTonE1, 384, fp)
+POINTXYZZ_DADD_IMPL(POINTonE1, 384, fp)
+POINTXYZZ_DADD_AFFINE_IMPL(POINTonE1, 384, fp, BLS12_381_Rx.p)
+POINTS_MULT_PIPPENGER_IMPL(blst_p1, POINTonE1)
+
+DECLARE_PRIVATE_POINTXYZZ(POINTonE2, 384x)
+POINTXYZZ_TO_JACOBIAN_IMPL(POINTonE2, 384x, fp2)
+POINTXYZZ_DADD_IMPL(POINTonE2, 384x, fp2)
+POINTXYZZ_DADD_AFFINE_IMPL(POINTonE2, 384x, fp2, BLS12_381_Rx.p2)
+POINTS_MULT_PIPPENGER_IMPL(blst_p2, POINTonE2)
diff --git a/vendor/external/blst/src/no_asm.h b/vendor/external/blst/src/no_asm.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/no_asm.h
@@ -0,0 +1,1347 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#if LIMB_T_BITS==32
+typedef unsigned long long llimb_t;
+#endif
+
+/* cardano-c: all callers use at most 384-bit fields. Fixed-capacity
+ * scratch buffers keep this C implementation usable with MSVC, which does
+ * not support VLAs. smul_2n uses double-width (768-bit) scratch space.
+ * Copy lengths below remain based on n, not on the buffer capacity. */
+#define BLST_MAX_LIMBS NLIMBS(384)
+
+#if defined(__clang__)
+# pragma GCC diagnostic ignored "-Wstatic-in-inline"
+#endif
+
+#if !defined(__clang__) && !defined(__builtin_assume)
+# if defined(__GNUC__) && __GNUC__>=5
+#  define __builtin_assume(condition) if (!(condition)) __builtin_unreachable()
+# elif defined(_MSC_VER)
+#  define __builtin_assume(condition) __assume(condition)
+# else
+#  define __builtin_assume(condition) (void)(condition)
+# endif
+#endif
+
+static void mul_mont_n(limb_t ret[], const limb_t a[], const limb_t b[],
+                       const limb_t p[], limb_t n0, size_t n)
+{
+    __builtin_assume(n != 0 && n%2 == 0);
+    llimb_t limbx;
+    limb_t mask, borrow, mx, hi, tmp[BLST_MAX_LIMBS+1], carry;
+    size_t i, j;
+
+    for (mx=b[0], hi=0, i=0; i<n; i++) {
+        limbx = (mx * (llimb_t)a[i]) + hi;
+        tmp[i] = (limb_t)limbx;
+        hi = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+    mx = n0*tmp[0];
+    tmp[i] = hi;
+
+    for (carry=0, j=0; ; ) {
+        limbx = (mx * (llimb_t)p[0]) + tmp[0];
+        hi = (limb_t)(limbx >> LIMB_T_BITS);
+        for (i=1; i<n; i++) {
+            limbx = (mx * (llimb_t)p[i] + hi) + tmp[i];
+            tmp[i-1] = (limb_t)limbx;
+            hi = (limb_t)(limbx >> LIMB_T_BITS);
+        }
+        limbx = tmp[i] + (hi + (llimb_t)carry);
+        tmp[i-1] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+
+        if (++j==n)
+            break;
+
+        for (mx=b[j], hi=0, i=0; i<n; i++) {
+            limbx = (mx * (llimb_t)a[i] + hi) + tmp[i];
+            tmp[i] = (limb_t)limbx;
+            hi = (limb_t)(limbx >> LIMB_T_BITS);
+        }
+        mx = n0*tmp[0];
+        limbx = hi + (llimb_t)carry;
+        tmp[i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+
+    for (borrow=0, i=0; i<n; i++) {
+        limbx = tmp[i] - (p[i] + (llimb_t)borrow);
+        ret[i] = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    mask = carry - borrow;
+    launder(mask);
+
+    for(i=0; i<n; i++)
+        ret[i] = (ret[i] & ~mask) | (tmp[i] & mask);
+}
+
+#define MUL_MONT_IMPL(bits) \
+inline void mul_mont_##bits(vec##bits ret, const vec##bits a, \
+                            const vec##bits b, const vec##bits p, limb_t n0) \
+{   mul_mont_n(ret, a, b, p, n0, NLIMBS(bits));   } \
+\
+inline void sqr_mont_##bits(vec##bits ret, const vec##bits a, \
+                            const vec##bits p, limb_t n0) \
+{   mul_mont_n(ret, a, a, p, n0, NLIMBS(bits));   }
+
+/*
+ * 256-bit subroutines can handle arbitrary modulus, even non-"sparse",
+ * but we have to harmonize the naming with assembly.
+ */
+#define mul_mont_256 mul_mont_sparse_256
+#define sqr_mont_256 sqr_mont_sparse_256
+MUL_MONT_IMPL(256)
+#undef mul_mont_256
+#undef sqr_mont_256
+MUL_MONT_IMPL(384)
+
+static void add_mod_n(limb_t ret[], const limb_t a[], const limb_t b[],
+                      const limb_t p[], size_t n)
+{
+    __builtin_assume(n != 0);
+    llimb_t limbx;
+    limb_t mask, carry, borrow, tmp[BLST_MAX_LIMBS];
+    size_t i;
+
+    for (carry=0, i=0; i<n; i++) {
+        limbx = a[i] + (b[i] + (llimb_t)carry);
+        tmp[i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+
+    for (borrow=0, i=0; i<n; i++) {
+        limbx = tmp[i] - (p[i] + (llimb_t)borrow);
+        ret[i] = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    mask = carry - borrow;
+    launder(mask);
+
+    for(i=0; i<n; i++)
+        ret[i] = (ret[i] & ~mask) | (tmp[i] & mask);
+}
+
+#define ADD_MOD_IMPL(bits) \
+inline void add_mod_##bits(vec##bits ret, const vec##bits a, \
+                           const vec##bits b, const vec##bits p) \
+{   add_mod_n(ret, a, b, p, NLIMBS(bits));   }
+
+ADD_MOD_IMPL(256)
+ADD_MOD_IMPL(384)
+
+static void sub_mod_n(limb_t ret[], const limb_t a[], const limb_t b[],
+                      const limb_t p[], size_t n)
+{
+    __builtin_assume(n != 0);
+    llimb_t limbx;
+    limb_t mask, carry, borrow;
+    size_t i;
+
+    for (borrow=0, i=0; i<n; i++) {
+        limbx = a[i] - (b[i] + (llimb_t)borrow);
+        ret[i] = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    mask = 0 - borrow;
+    launder(mask);
+
+    for (carry=0, i=0; i<n; i++) {
+        limbx = ret[i] + ((p[i] & mask) + (llimb_t)carry);
+        ret[i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+}
+
+#define SUB_MOD_IMPL(bits) \
+inline void sub_mod_##bits(vec##bits ret, const vec##bits a, \
+                           const vec##bits b, const vec##bits p) \
+{   sub_mod_n(ret, a, b, p, NLIMBS(bits));   }
+
+SUB_MOD_IMPL(256)
+SUB_MOD_IMPL(384)
+
+static void mul_by_3_mod_n(limb_t ret[], const limb_t a[], const limb_t p[],
+                           size_t n)
+{
+    __builtin_assume(n != 0);
+    llimb_t limbx;
+    limb_t mask, carry, borrow, tmp[BLST_MAX_LIMBS], two_a[BLST_MAX_LIMBS];
+    size_t i;
+
+    for (carry=0, i=0; i<n; i++) {
+        limb_t a_i = a[i];
+        tmp[i] = a_i<<1 | carry;
+        carry = a_i>>(LIMB_T_BITS-1);
+    }
+
+    for (borrow=0, i=0; i<n; i++) {
+        limbx = tmp[i] - (p[i] + (llimb_t)borrow);
+        two_a[i] = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    mask = carry - borrow;
+    launder(mask);
+
+    for(i=0; i<n; i++)
+        two_a[i] = (two_a[i] & ~mask) | (tmp[i] & mask);
+
+    for (carry=0, i=0; i<n; i++) {
+        limbx = a[i] + (two_a[i] + (llimb_t)carry);
+        tmp[i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+
+    for (borrow=0, i=0; i<n; i++) {
+        limbx = tmp[i] - (p[i] + (llimb_t)borrow);
+        ret[i] = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    mask = carry - borrow;
+    launder(mask);
+
+    for(i=0; i<n; i++)
+        ret[i] = (ret[i] & ~mask) | (tmp[i] & mask);
+}
+
+#define MUL_BY_3_MOD_IMPL(bits) \
+inline void mul_by_3_mod_##bits(vec##bits ret, const vec##bits a, \
+                                const vec##bits p) \
+{   mul_by_3_mod_n(ret, a, p, NLIMBS(bits));   }
+
+MUL_BY_3_MOD_IMPL(256)
+MUL_BY_3_MOD_IMPL(384)
+
+static void lshift_mod_n(limb_t ret[], const limb_t a[], size_t count,
+                         const limb_t p[], size_t n)
+{
+    __builtin_assume(count != 0);
+    __builtin_assume(n != 0);
+    llimb_t limbx;
+    limb_t mask, carry, borrow, tmp[BLST_MAX_LIMBS];
+    size_t i;
+
+    while (count--) {
+        for (carry=0, i=0; i<n; i++) {
+            limb_t a_i = a[i];
+            tmp[i] = a_i<<1 | carry;
+            carry = a_i>>(LIMB_T_BITS-1);
+        }
+
+        for (borrow=0, i=0; i<n; i++) {
+            limbx = tmp[i] - (p[i] + (llimb_t)borrow);
+            ret[i] = (limb_t)limbx;
+            borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+        }
+
+        mask = carry - borrow;
+        launder(mask);
+
+        for(i=0; i<n; i++)
+            ret[i] = (ret[i] & ~mask) | (tmp[i] & mask);
+
+        a = ret;
+    }
+}
+
+#define LSHIFT_MOD_IMPL(bits) \
+inline void lshift_mod_##bits(vec##bits ret, const vec##bits a, size_t count, \
+                              const vec##bits p) \
+{   lshift_mod_n(ret, a, count, p, NLIMBS(bits));   }
+
+LSHIFT_MOD_IMPL(256)
+LSHIFT_MOD_IMPL(384)
+
+static void cneg_mod_n(limb_t ret[], const limb_t a[], bool_t flag,
+                       const limb_t p[], size_t n)
+{
+    __builtin_assume(n != 0);
+    llimb_t limbx;
+    limb_t borrow, mask, tmp[BLST_MAX_LIMBS];
+    size_t i;
+
+    for (borrow=0, i=0; i<n; i++) {
+        limbx = p[i] - (a[i] + (llimb_t)borrow);
+        tmp[i] = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    flag &= vec_is_zero(a, n*sizeof(limb_t)) ^ 1;
+    mask = (limb_t)0 - flag;
+
+    for(i=0; i<n; i++)
+        ret[i] = (a[i] & ~mask) | (tmp[i] & mask);
+}
+
+#define CNEG_MOD_IMPL(bits) \
+inline void cneg_mod_##bits(vec##bits ret, const vec##bits a, bool_t flag, \
+                            const vec##bits p) \
+{   cneg_mod_n(ret, a, flag, p, NLIMBS(bits));   }
+
+CNEG_MOD_IMPL(256)
+CNEG_MOD_IMPL(384)
+
+static limb_t check_mod_n(const byte a[], const limb_t p[], size_t n)
+{
+    __builtin_assume(n != 0);
+    llimb_t limbx;
+    limb_t borrow, ai, acc;
+    size_t i, j;
+
+    for (acc=borrow=0, i=0; i<n; i++) {
+        for (ai=0, j=0; j<8*sizeof(limb_t); j+=8)
+            ai |= (limb_t)(*a++) << j;
+        acc |= ai;
+        limbx = ai - (p[i] + (llimb_t)borrow);
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    return borrow & (is_zero(acc) ^ 1);
+}
+
+#define CHECK_MOD_IMPL(bits) \
+inline limb_t check_mod_##bits(const pow##bits a, const vec##bits p) \
+{   return check_mod_n(a, p, NLIMBS(bits));   }
+
+CHECK_MOD_IMPL(256)
+
+static limb_t add_n_check_mod_n(byte ret[], const byte a[], const byte b[],
+                                            const limb_t p[], size_t n)
+{
+    __builtin_assume(n != 0);
+    limb_t ret_[BLST_MAX_LIMBS], a_[BLST_MAX_LIMBS], b_[BLST_MAX_LIMBS], zero;
+
+    limbs_from_le_bytes(a_, a, n*sizeof(limb_t));
+    limbs_from_le_bytes(b_, b, n*sizeof(limb_t));
+
+    add_mod_n(ret_, a_, b_, p, n);
+    zero = vec_is_zero(ret_, n*sizeof(limb_t));
+
+    le_bytes_from_limbs(ret, ret_, n*sizeof(limb_t));
+
+    return zero^1;
+}
+
+#define ADD_N_CHECK_MOD_IMPL(bits) \
+inline limb_t add_n_check_mod_##bits(pow##bits ret, const pow##bits a, \
+                                     const pow##bits b, const vec##bits p) \
+{   return add_n_check_mod_n(ret, a, b, p, NLIMBS(bits));   }
+
+ADD_N_CHECK_MOD_IMPL(256)
+
+static limb_t sub_n_check_mod_n(byte ret[], const byte a[], const byte b[],
+                                            const limb_t p[], size_t n)
+{
+    __builtin_assume(n != 0);
+    limb_t ret_[BLST_MAX_LIMBS], a_[BLST_MAX_LIMBS], b_[BLST_MAX_LIMBS], zero;
+
+    limbs_from_le_bytes(a_, a, n*sizeof(limb_t));
+    limbs_from_le_bytes(b_, b, n*sizeof(limb_t));
+
+    sub_mod_n(ret_, a_, b_, p, n);
+    zero = vec_is_zero(ret_, n*sizeof(limb_t));
+
+    le_bytes_from_limbs(ret, ret_, n*sizeof(limb_t));
+
+    return zero^1;
+}
+
+#define SUB_N_CHECK_MOD_IMPL(bits) \
+inline limb_t sub_n_check_mod_##bits(pow##bits ret, const pow##bits a, \
+                                     const pow##bits b, const vec##bits p) \
+{   return sub_n_check_mod_n(ret, a, b, p, NLIMBS(bits));   }
+
+SUB_N_CHECK_MOD_IMPL(256)
+
+static void from_mont_n(limb_t ret[], const limb_t a[],
+                        const limb_t p[], limb_t n0, size_t n)
+{
+    __builtin_assume(n != 0 && n%2 == 0);
+    llimb_t limbx;
+    limb_t mask, borrow, mx, hi, tmp[BLST_MAX_LIMBS];
+    size_t i, j;
+
+    for (j=0; j<n; j++) {
+        mx = n0*a[0];
+        limbx = (mx * (llimb_t)p[0]) + a[0];
+        hi = (limb_t)(limbx >> LIMB_T_BITS);
+        for (i=1; i<n; i++) {
+            limbx = (mx * (llimb_t)p[i] + hi) + a[i];
+            tmp[i-1] = (limb_t)limbx;
+            hi = (limb_t)(limbx >> LIMB_T_BITS);
+        }
+        tmp[i-1] = hi;
+        a = tmp;
+    }
+
+    /* this is needed only if input can be non-fully-reduced */
+    for (borrow=0, i=0; i<n; i++) {
+        limbx = tmp[i] - (p[i] + (llimb_t)borrow);
+        ret[i] = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    mask = 0 - borrow;
+    launder(mask);
+
+    for(i=0; i<n; i++)
+        ret[i] = (ret[i] & ~mask) | (tmp[i] & mask);
+}
+
+#define FROM_MONT_IMPL(bits) \
+inline void from_mont_##bits(vec##bits ret, const vec##bits a, \
+                             const vec##bits p, limb_t n0) \
+{   from_mont_n(ret, a, p, n0, NLIMBS(bits));   }
+
+FROM_MONT_IMPL(256)
+FROM_MONT_IMPL(384)
+
+static void redc_mont_n(limb_t ret[], const limb_t a[],
+                        const limb_t p[], limb_t n0, size_t n)
+{
+    __builtin_assume(n != 0 && n%2 == 0);
+    llimb_t limbx;
+    limb_t mask, carry, borrow, mx, hi, tmp[BLST_MAX_LIMBS];
+    const limb_t *b = a;
+    size_t i, j;
+
+    for (j=0; j<n; j++) {
+        mx = n0*b[0];
+        limbx = (mx * (llimb_t)p[0]) + b[0];
+        hi = (limb_t)(limbx >> LIMB_T_BITS);
+        for (i=1; i<n; i++) {
+            limbx = (mx * (llimb_t)p[i] + hi) + b[i];
+            tmp[i-1] = (limb_t)limbx;
+            hi = (limb_t)(limbx >> LIMB_T_BITS);
+        }
+        tmp[i-1] = hi;
+        b = tmp;
+    }
+
+    for (carry=0, i=0; i<n; i++) {
+        limbx = a[n+i] + (tmp[i] + (llimb_t)carry);
+        tmp[i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+
+    for (borrow=0, i=0; i<n; i++) {
+        limbx = tmp[i] - (p[i] + (llimb_t)borrow);
+        ret[i] = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    mask = carry - borrow;
+    launder(mask);
+
+    for(i=0; i<n; i++)
+        ret[i] = (ret[i] & ~mask) | (tmp[i] & mask);
+}
+
+#define REDC_MONT_IMPL(bits, bits2) \
+inline void redc_mont_##bits(vec##bits ret, const vec##bits2 a, \
+                             const vec##bits p, limb_t n0) \
+{   redc_mont_n(ret, a, p, n0, NLIMBS(bits));   }
+
+REDC_MONT_IMPL(256, 512)
+REDC_MONT_IMPL(384, 768)
+
+static void rshift_mod_n(limb_t ret[], const limb_t a[], size_t count,
+                         const limb_t p[], size_t n)
+{
+    __builtin_assume(count != 0);
+    __builtin_assume(n != 0 && n%2 == 0);
+    llimb_t limbx;
+    limb_t mask, carry, limb, next;
+    size_t i;
+
+    while (count--) {
+        mask = 0 - (a[0] & 1);
+        launder(mask);
+        for (carry=0, i=0; i<n; i++) {
+            limbx = a[i] + ((p[i]&mask) + (llimb_t)carry);
+            ret[i] = (limb_t)limbx;
+            carry = (limb_t)(limbx >> LIMB_T_BITS);
+        }
+
+        for (next=ret[0], i=0; i<n-1; i++) {
+            limb = next >> 1;
+            next = ret[i+1];
+            ret[i] = limb | next << (LIMB_T_BITS-1);
+        }
+        ret[i] = next >> 1 | carry << (LIMB_T_BITS-1);
+
+        a = ret;
+    }
+}
+
+#define RSHIFT_MOD_IMPL(bits) \
+inline void rshift_mod_##bits(vec##bits ret, const vec##bits a, size_t count, \
+                              const vec##bits p) \
+{   rshift_mod_n(ret, a, count, p, NLIMBS(bits));   }
+
+RSHIFT_MOD_IMPL(256)
+RSHIFT_MOD_IMPL(384)
+
+#define DIV_BY_2_MOD_IMPL(bits) \
+inline void div_by_2_mod_##bits(vec##bits ret, const vec##bits a, \
+                                const vec##bits p) \
+{   rshift_mod_n(ret, a, 1, p, NLIMBS(bits));   }
+
+DIV_BY_2_MOD_IMPL(384)
+
+static limb_t sgn0_pty_mod_n(const limb_t a[], const limb_t p[], size_t n)
+{
+    __builtin_assume(n != 0);
+    llimb_t limbx;
+    limb_t carry, borrow, ret, tmp[BLST_MAX_LIMBS];
+    size_t i;
+
+    ret = a[0] & 1; /* parity */
+
+    for (carry=0, i=0; i<n; i++) {
+        limb_t a_i = a[i];
+        tmp[i] = a_i<<1 | carry;
+        carry = a_i>>(LIMB_T_BITS-1);
+    }
+
+    for (borrow=0, i=0; i<n; i++) {
+        limbx = tmp[i] - (p[i] + (llimb_t)borrow);
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    ret |= ((carry - borrow) & 2) ^ 2;
+
+    return ret;
+}
+
+inline limb_t sgn0_pty_mod_384(const vec384 a, const vec384 p)
+{   return sgn0_pty_mod_n(a, p, NLIMBS(384));   }
+
+inline limb_t sgn0_pty_mont_384(const vec384 a, const vec384 p, limb_t n0)
+{
+    vec384 tmp;
+
+    from_mont_n(tmp, a, p, n0, NLIMBS(384));
+
+    return sgn0_pty_mod_n(tmp, p, NLIMBS(384));
+}
+
+inline limb_t sgn0_pty_mod_384x(const vec384x a, const vec384 p)
+{
+    limb_t re, im, sign, prty;
+
+    re = sgn0_pty_mod_n(a[0], p, NLIMBS(384));
+    im = sgn0_pty_mod_n(a[1], p, NLIMBS(384));
+
+    /* a->im!=0 ? sgn0(a->im) : sgn0(a->re) */
+    sign = (limb_t)0 - vec_is_zero(a[1], sizeof(vec384));
+    sign = (re & sign) | (im & ~sign);
+
+    /* a->re==0 ? prty(a->im) : prty(a->re) */
+    prty = (limb_t)0 - vec_is_zero(a[0], sizeof(vec384));
+    prty = (im & prty) | (re & ~prty);
+
+    return (sign & 2) | (prty & 1);
+}
+
+inline limb_t sgn0_pty_mont_384x(const vec384x a, const vec384 p, limb_t n0)
+{
+    vec384x tmp;
+
+    from_mont_n(tmp[0], a[0], p, n0, NLIMBS(384));
+    from_mont_n(tmp[1], a[1], p, n0, NLIMBS(384));
+
+    return sgn0_pty_mod_384x(tmp, p);
+}
+
+void mul_mont_384x(vec384x ret, const vec384x a, const vec384x b,
+                          const vec384 p, limb_t n0)
+{
+    vec384 aa, bb, cc;
+
+    add_mod_n(aa, a[0], a[1], p, NLIMBS(384));
+    add_mod_n(bb, b[0], b[1], p, NLIMBS(384));
+    mul_mont_n(bb, bb, aa, p, n0, NLIMBS(384));
+    mul_mont_n(aa, a[0], b[0], p, n0, NLIMBS(384));
+    mul_mont_n(cc, a[1], b[1], p, n0, NLIMBS(384));
+    sub_mod_n(ret[0], aa, cc, p, NLIMBS(384));
+    sub_mod_n(ret[1], bb, aa, p, NLIMBS(384));
+    sub_mod_n(ret[1], ret[1], cc, p, NLIMBS(384));
+}
+
+/*
+ * mul_mont_n without final conditional subtraction, which implies
+ * that modulus is one bit short, which in turn means that there are
+ * no carries to handle between iterations...
+ */
+static void mul_mont_nonred_n(limb_t ret[], const limb_t a[], const limb_t b[],
+                              const limb_t p[], limb_t n0, size_t n)
+{
+    __builtin_assume(n != 0 && n%2 == 0);
+    llimb_t limbx;
+    limb_t mx, hi, tmp[BLST_MAX_LIMBS+1];
+    size_t i, j;
+
+    for (mx=b[0], hi=0, i=0; i<n; i++) {
+        limbx = (mx * (llimb_t)a[i]) + hi;
+        tmp[i] = (limb_t)limbx;
+        hi = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+    mx = n0*tmp[0];
+    tmp[i] = hi;
+
+    for (j=0; ; ) {
+        limbx = (mx * (llimb_t)p[0]) + tmp[0];
+        hi = (limb_t)(limbx >> LIMB_T_BITS);
+        for (i=1; i<n; i++) {
+            limbx = (mx * (llimb_t)p[i] + hi) + tmp[i];
+            tmp[i-1] = (limb_t)limbx;
+            hi = (limb_t)(limbx >> LIMB_T_BITS);
+        }
+        tmp[i-1] = tmp[i] + hi;
+
+        if (++j==n)
+            break;
+
+        for (mx=b[j], hi=0, i=0; i<n; i++) {
+            limbx = (mx * (llimb_t)a[i] + hi) + tmp[i];
+            tmp[i] = (limb_t)limbx;
+            hi = (limb_t)(limbx >> LIMB_T_BITS);
+        }
+        mx = n0*tmp[0];
+        tmp[i] = hi;
+    }
+
+    vec_copy(ret, tmp, n*sizeof(limb_t));
+}
+
+void sqr_n_mul_mont_383(vec384 ret, const vec384 a, size_t count,
+                        const vec384 p, limb_t n0, const vec384 b)
+{
+    __builtin_assume(count != 0);
+    while(count--) {
+        mul_mont_nonred_n(ret, a, a, p, n0, NLIMBS(384));
+        a = ret;
+    }
+    mul_mont_n(ret, ret, b, p, n0, NLIMBS(384));
+}
+
+void sqr_mont_382x(vec384x ret, const vec384x a,
+                          const vec384 p, limb_t n0)
+{
+    llimb_t limbx;
+    limb_t mask, carry, borrow;
+    size_t i;
+    vec384 t0, t1;
+
+    /* "add_mod_n(t0, a[0], a[1], p, NLIMBS(384));" */
+    for (carry=0, i=0; i<NLIMBS(384); i++) {
+        limbx = a[0][i] + (a[1][i] + (llimb_t)carry);
+        t0[i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+
+    /* "sub_mod_n(t1, a[0], a[1], p, NLIMBS(384));" */
+    for (borrow=0, i=0; i<NLIMBS(384); i++) {
+        limbx = a[0][i] - (a[1][i] + (llimb_t)borrow);
+        t1[i] = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+    mask = 0 - borrow;
+    launder(mask);
+
+    /* "mul_mont_n(ret[1], a[0], a[1], p, n0, NLIMBS(384));" */
+    mul_mont_nonred_n(ret[1], a[0], a[1], p, n0, NLIMBS(384));
+
+    /* "add_mod_n(ret[1], ret[1], ret[1], p, NLIMBS(384));" */
+    for (carry=0, i=0; i<NLIMBS(384); i++) {
+        limb_t a_i = ret[1][i];
+        ret[1][i] = a_i<<1 | carry;
+        carry = a_i>>(LIMB_T_BITS-1);
+    }
+
+    /* "mul_mont_n(ret[0], t0, t1, p, n0, NLIMBS(384));" */
+    mul_mont_nonred_n(ret[0], t0, t1, p, n0, NLIMBS(384));
+
+    /* account for t1's sign... */
+    for (borrow=0, i=0; i<NLIMBS(384); i++) {
+        limbx = ret[0][i] - ((t0[i] & mask) + (llimb_t)borrow);
+        ret[0][i] = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+    mask = 0 - borrow;
+    launder(mask);
+    for (carry=0, i=0; i<NLIMBS(384); i++) {
+        limbx = ret[0][i] + ((p[i] & mask) + (llimb_t)carry);
+        ret[0][i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+}
+
+#if defined(__GNUC__) || defined(__clang__)
+# define MSB(x) ({ limb_t ret = (x) >> (LIMB_T_BITS-1); launder(ret); ret; })
+#else
+# define MSB(x) ((x) >> (LIMB_T_BITS-1))
+#endif
+
+static size_t num_bits(limb_t l)
+{
+    limb_t x, mask;
+    size_t bits = is_zero(l) ^ 1;
+
+    if (sizeof(limb_t) == 8) {
+        x = l >> (32 & (8*sizeof(limb_t)-1));
+        mask = 0 - MSB(0 - x);
+        bits += 32 & mask;
+        l ^= (x ^ l) & mask;
+    }
+
+    x = l >> 16;
+    mask = 0 - MSB(0 - x);
+    bits += 16 & mask;
+    l ^= (x ^ l) & mask;
+
+    x = l >> 8;
+    mask = 0 - MSB(0 - x);
+    bits += 8 & mask;
+    l ^= (x ^ l) & mask;
+
+    x = l >> 4;
+    mask = 0 - MSB(0 - x);
+    bits += 4 & mask;
+    l ^= (x ^ l) & mask;
+
+    x = l >> 2;
+    mask = 0 - MSB(0 - x);
+    bits += 2 & mask;
+    l ^= (x ^ l) & mask;
+
+    bits += l >> 1;
+
+    return bits;
+}
+
+#if defined(__clang_major__) && __clang_major__>7
+__attribute__((optnone))
+#endif
+static limb_t lshift_2(limb_t hi, limb_t lo, size_t l)
+{
+    size_t r = LIMB_T_BITS - l;
+    limb_t mask = 0 - (is_zero(l)^1);
+    return (hi << (l&(LIMB_T_BITS-1))) | ((lo & mask) >> (r&(LIMB_T_BITS-1)));
+}
+
+/*
+ * https://eprint.iacr.org/2020/972 with 'k' being LIMB_T_BITS-1.
+ */
+static void ab_approximation_n(limb_t a_[2], const limb_t a[],
+                               limb_t b_[2], const limb_t b[], size_t n)
+{
+    __builtin_assume(n != 0 && n%2 == 0);
+    limb_t a_hi, a_lo, b_hi, b_lo, mask;
+    size_t i;
+
+    i = n-1;
+    a_hi = a[i],    a_lo = a[i-1];
+    b_hi = b[i],    b_lo = b[i-1];
+    for (i--; --i;) {
+        mask = 0 - is_zero(a_hi | b_hi);
+        a_hi = ((a_lo ^ a_hi) & mask) ^ a_hi;
+        b_hi = ((b_lo ^ b_hi) & mask) ^ b_hi;
+        a_lo = ((a[i] ^ a_lo) & mask) ^ a_lo;
+        b_lo = ((b[i] ^ b_lo) & mask) ^ b_lo;
+    }
+    i = LIMB_T_BITS - num_bits(a_hi | b_hi);
+    /* |i| can be LIMB_T_BITS if all a[2..]|b[2..] were zeros */
+
+    a_[0] = a[0], a_[1] = lshift_2(a_hi, a_lo, i);
+    b_[0] = b[0], b_[1] = lshift_2(b_hi, b_lo, i);
+}
+
+typedef struct { limb_t f0, g0, f1, g1; } factors;
+
+static void inner_loop_n(factors *fg, const limb_t a_[2], const limb_t b_[2],
+                         size_t n)
+{
+    __builtin_assume(n != 0);
+    llimb_t limbx;
+    limb_t f0 = 1, g0 = 0, f1 = 0, g1 = 1;
+    limb_t a_lo, a_hi, b_lo, b_hi, t_lo, t_hi, odd, borrow, xorm;
+
+    a_lo = a_[0], a_hi = a_[1];
+    b_lo = b_[0], b_hi = b_[1];
+
+    while(n--) {
+        odd = 0 - (a_lo&1);
+
+        /* a_ -= b_ if a_ is odd */
+        t_lo = a_lo, t_hi = a_hi;
+        limbx = a_lo - (llimb_t)(b_lo & odd);
+        a_lo = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+        limbx = a_hi - ((llimb_t)(b_hi & odd) + borrow);
+        a_hi = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS);
+
+        /* negate a_-b_ if it borrowed */
+        a_lo ^= borrow;
+        a_hi ^= borrow;
+        limbx = a_lo + (llimb_t)(borrow & 1);
+        a_lo = (limb_t)limbx;
+        a_hi += (limb_t)(limbx >> LIMB_T_BITS) & 1;
+
+        /* b_=a_ if a_-b_ borrowed */
+        b_lo = ((t_lo ^ b_lo) & borrow) ^ b_lo;
+        b_hi = ((t_hi ^ b_hi) & borrow) ^ b_hi;
+
+        /* exchange f0 and f1 if a_-b_ borrowed */
+        xorm = (f0 ^ f1) & borrow;
+        f0 ^= xorm;
+        f1 ^= xorm;
+
+        /* exchange g0 and g1 if a_-b_ borrowed */
+        xorm = (g0 ^ g1) & borrow;
+        g0 ^= xorm;
+        g1 ^= xorm;
+
+        /* subtract if a_ was odd */
+        f0 -= f1 & odd;
+        g0 -= g1 & odd;
+
+        f1 <<= 1;
+        g1 <<= 1;
+        a_lo >>= 1; a_lo |= a_hi << (LIMB_T_BITS-1);
+        a_hi >>= 1;
+    }
+
+    fg->f0 = f0, fg->g0 = g0, fg->f1 = f1, fg->g1= g1;
+}
+
+static limb_t cneg_n(limb_t ret[], const limb_t a[], limb_t neg, size_t n)
+{
+    __builtin_assume(n != 0);
+    llimb_t limbx = 0;
+    limb_t carry;
+    size_t i;
+
+    for (carry=neg&1, i=0; i<n; i++) {
+        limbx = (llimb_t)(a[i] ^ neg) + carry;
+        ret[i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+
+    return 0 - MSB((limb_t)limbx);
+}
+
+static limb_t add_n(limb_t ret[], const limb_t a[], limb_t b[], size_t n)
+{
+    __builtin_assume(n != 0);
+    llimb_t limbx;
+    limb_t carry;
+    size_t i;
+
+    for (carry=0, i=0; i<n; i++) {
+        limbx = a[i] + (b[i] + (llimb_t)carry);
+        ret[i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+
+    return carry;
+}
+
+static limb_t umul_n(limb_t ret[], const limb_t a[], limb_t b, size_t n)
+{
+    __builtin_assume(n != 0);
+    llimb_t limbx;
+    limb_t hi;
+    size_t i;
+
+    for (hi=0, i=0; i<n; i++) {
+        limbx = (b * (llimb_t)a[i]) + hi;
+        ret[i] = (limb_t)limbx;
+        hi = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+
+    return hi;
+}
+
+static limb_t smul_n_shift_n(limb_t ret[], const limb_t a[], limb_t *f_,
+                                           const limb_t b[], limb_t *g_,
+                                           size_t n)
+{
+    __builtin_assume(n != 0);
+    limb_t a_[BLST_MAX_LIMBS+1], b_[BLST_MAX_LIMBS+1], f, g, neg, carry, hi;
+    size_t i;
+
+    /* |a|*|f_| */
+    f = *f_;
+    neg = 0 - MSB(f);
+    f = (f ^ neg) - neg;            /* ensure |f| is positive */
+    (void)cneg_n(a_, a, neg, n);
+    hi = umul_n(a_, a_, f, n);
+    a_[n] = hi - (f & neg);
+
+    /* |b|*|g_| */
+    g = *g_;
+    neg = 0 - MSB(g);
+    g = (g ^ neg) - neg;            /* ensure |g| is positive */
+    (void)cneg_n(b_, b, neg, n);
+    hi = umul_n(b_, b_, g, n);
+    b_[n] = hi - (g & neg);
+
+    /* |a|*|f_| + |b|*|g_| */
+    (void)add_n(a_, a_, b_, n+1);
+
+    /* (|a|*|f_| + |b|*|g_|) >> k */
+    for (carry=a_[0], i=0; i<n; i++) {
+        hi = carry >> (LIMB_T_BITS-2);
+        carry = a_[i+1];
+        ret[i] = hi | (carry << 2);
+    }
+
+    /* ensure result is non-negative, fix up |f_| and |g_| accordingly */
+    neg = 0 - MSB(carry);
+    *f_ = (*f_ ^ neg) - neg;
+    *g_ = (*g_ ^ neg) - neg;
+    (void)cneg_n(ret, ret, neg, n);
+
+    return neg;
+}
+
+static limb_t smul_2n(limb_t ret[], const limb_t u[], limb_t f,
+                                    const limb_t v[], limb_t g, size_t n)
+{
+    __builtin_assume(n != 0);
+    limb_t u_[2*BLST_MAX_LIMBS], v_[2*BLST_MAX_LIMBS], neg, hi;
+
+    /* |u|*|f_| */
+    neg = 0 - MSB(f);
+    f = (f ^ neg) - neg;            /* ensure |f| is positive */
+    neg = cneg_n(u_, u, neg, n);
+    hi = umul_n(u_, u_, f, n) - (f&neg);
+
+    /* |v|*|g_| */
+    neg = 0 - MSB(g);
+    g = (g ^ neg) - neg;            /* ensure |g| is positive */
+    neg = cneg_n(v_, v, neg, n);
+    hi += umul_n(v_, v_, g, n) - (g&neg);
+
+    /* |u|*|f_| + |v|*|g_| */
+    hi += add_n(ret, u_, v_, n);
+
+    return hi;
+}
+
+static void ct_inverse_mod_n(limb_t ret[], const limb_t inp[],
+                             const limb_t mod[], const limb_t modx[], size_t n)
+{
+    __builtin_assume(n != 0 && n%2 == 0);
+    llimb_t limbx;
+    limb_t a[BLST_MAX_LIMBS], b[BLST_MAX_LIMBS], u[2*BLST_MAX_LIMBS], v[2*BLST_MAX_LIMBS], t[2*BLST_MAX_LIMBS];
+    limb_t a_[2], b_[2], sign, carry, top;
+    factors fg;
+    size_t i;
+
+    vec_copy(a, inp, n*sizeof(limb_t));
+    vec_copy(b, mod, n*sizeof(limb_t));
+    vec_zero(u, 2*n*sizeof(limb_t)); u[0] = 1;
+    vec_zero(v, 2*n*sizeof(limb_t));
+
+    for (i=0; i<(2*n*LIMB_T_BITS)/(LIMB_T_BITS-2); i++) {
+        ab_approximation_n(a_, a, b_, b, n);
+        inner_loop_n(&fg, a_, b_, LIMB_T_BITS-2);
+        (void)smul_n_shift_n(t, a, &fg.f0, b, &fg.g0, n);
+        (void)smul_n_shift_n(b, a, &fg.f1, b, &fg.g1, n);
+        vec_copy(a, t, n*sizeof(limb_t));
+        smul_2n(t, u, fg.f0, v, fg.g0, 2*n);
+        smul_2n(v, u, fg.f1, v, fg.g1, 2*n);
+        vec_copy(u, t, 2*n*sizeof(limb_t));
+    }
+
+    inner_loop_n(&fg, a, b, (2*n*LIMB_T_BITS)%(LIMB_T_BITS-2));
+    top = smul_2n(ret, u, fg.f1, v, fg.g1, 2*n);
+
+    sign = 0 - MSB(top);    /* top is 1, 0 or -1 */
+    for (carry=0, i=0; i<n; i++) {
+        limbx = ret[n+i] + ((modx[i] & sign) + (llimb_t)carry);
+        ret[n+i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+    top += carry;
+    sign = 0 - top;         /* top is 1, 0 or -1 */
+    top |= sign;
+    for (i=0; i<n; i++)
+        a[i] = modx[i] & top;
+    (void)cneg_n(a, a, 0 - MSB(sign), n);
+    add_n(ret+n, ret+n, a, n);
+}
+
+#define CT_INVERSE_MOD_IMPL(bits, bits2) \
+inline void ct_inverse_mod_##bits(vec##bits2 ret, const vec##bits inp, \
+                                  const vec##bits mod, const vec##bits modx) \
+{   ct_inverse_mod_n(ret, inp, mod, modx, NLIMBS(bits));   }
+
+CT_INVERSE_MOD_IMPL(256, 512)
+CT_INVERSE_MOD_IMPL(384, 768)
+
+/*
+ * Copy of inner_loop_n above, but with |L| updates.
+ */
+static limb_t legendre_loop_n(limb_t L, factors *fg, const limb_t a_[2],
+                              const limb_t b_[2], size_t n)
+{
+    __builtin_assume(n != 0);
+    llimb_t limbx;
+    limb_t f0 = 1, g0 = 0, f1 = 0, g1 = 1;
+    limb_t a_lo, a_hi, b_lo, b_hi, t_lo, t_hi, odd, borrow, xorm;
+
+    a_lo = a_[0], a_hi = a_[1];
+    b_lo = b_[0], b_hi = b_[1];
+
+    while(n--) {
+        odd = 0 - (a_lo&1);
+
+        /* a_ -= b_ if a_ is odd */
+        t_lo = a_lo, t_hi = a_hi;
+        limbx = a_lo - (llimb_t)(b_lo & odd);
+        a_lo = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+        limbx = a_hi - ((llimb_t)(b_hi & odd) + borrow);
+        a_hi = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS);
+
+        L += ((t_lo & b_lo) >> 1) & borrow;
+
+        /* negate a_-b_ if it borrowed */
+        a_lo ^= borrow;
+        a_hi ^= borrow;
+        limbx = a_lo + (llimb_t)(borrow & 1);
+        a_lo = (limb_t)limbx;
+        a_hi += (limb_t)(limbx >> LIMB_T_BITS) & 1;
+
+        /* b_=a_ if a_-b_ borrowed */
+        b_lo = ((t_lo ^ b_lo) & borrow) ^ b_lo;
+        b_hi = ((t_hi ^ b_hi) & borrow) ^ b_hi;
+
+        /* exchange f0 and f1 if a_-b_ borrowed */
+        xorm = (f0 ^ f1) & borrow;
+        f0 ^= xorm;
+        f1 ^= xorm;
+
+        /* exchange g0 and g1 if a_-b_ borrowed */
+        xorm = (g0 ^ g1) & borrow;
+        g0 ^= xorm;
+        g1 ^= xorm;
+
+        /* subtract if a_ was odd */
+        f0 -= f1 & odd;
+        g0 -= g1 & odd;
+
+        f1 <<= 1;
+        g1 <<= 1;
+        a_lo >>= 1; a_lo |= a_hi << (LIMB_T_BITS-1);
+        a_hi >>= 1;
+
+        L += (b_lo + 2) >> 2;
+    }
+
+    fg->f0 = f0, fg->g0 = g0, fg->f1 = f1, fg->g1 = g1;
+
+    return L;
+}
+
+static bool_t ct_is_sqr_mod_n(const limb_t inp[], const limb_t mod[], size_t n)
+{
+    __builtin_assume(n != 0 && n%2 == 0);
+    limb_t a[BLST_MAX_LIMBS], b[BLST_MAX_LIMBS], t[BLST_MAX_LIMBS];
+    limb_t a_[2], b_[2], neg, L = 0;
+    factors fg;
+    size_t i;
+
+    vec_copy(a, inp, n*sizeof(limb_t));
+    vec_copy(b, mod, n*sizeof(limb_t));
+
+    for (i=0; i<(2*n*LIMB_T_BITS)/(LIMB_T_BITS-2); i++) {
+        ab_approximation_n(a_, a, b_, b, n);
+        L = legendre_loop_n(L, &fg, a_, b_, LIMB_T_BITS-2);
+        neg = smul_n_shift_n(t, a, &fg.f0, b, &fg.g0, n);
+        (void)smul_n_shift_n(b, a, &fg.f1, b, &fg.g1, n);
+        vec_copy(a, t, n*sizeof(limb_t));
+        L += (b[0] >> 1) & neg;
+    }
+
+    L = legendre_loop_n(L, &fg, a, b, (2*n*LIMB_T_BITS)%(LIMB_T_BITS-2));
+
+    return (L & 1) ^ 1;
+}
+
+#define CT_IS_SQR_MOD_IMPL(bits) \
+inline bool_t ct_is_square_mod_##bits(const vec##bits inp, \
+                                      const vec##bits mod) \
+{   return ct_is_sqr_mod_n(inp, mod, NLIMBS(bits));   }
+
+CT_IS_SQR_MOD_IMPL(384)
+
+/*
+ * |div_top| points at two most significant limbs of the dividend, |d_hi|
+ * and |d_lo| are two most significant limbs of the divisor. If divisor
+ * is only one limb, it is to be passed in |d_hi| with zero in |d_lo|.
+ * The divisor is required to be "bitwise left-aligned," and dividend's
+ * top limbs to be not larger than the divisor's. The latter limitation
+ * can be problematic in the first iteration of multi-precision division,
+ * where in most general case the condition would have to be "smaller."
+ * The subroutine considers four limbs, two of which are "overlapping,"
+ * hence the name... Another way to look at it is to think of the pair
+ * of the dividend's limbs being suffixed with a zero:
+ *   +-------+-------+-------+
+ * R |       |       |   0   |
+ *   +-------+-------+-------+
+ *           +-------+-------+
+ * D         |       |       |
+ *           +-------+-------+
+ */
+limb_t div_3_limbs(const limb_t div_top[2], limb_t d_lo, limb_t d_hi)
+{
+    llimb_t Rx;
+    limb_t r_lo = div_top[0], r_hi = div_top[1];
+    limb_t Q = 0, mask, borrow, rx;
+    size_t i;
+
+    for (i = 0; i < LIMB_T_BITS; i++) {
+        /* "borrow, Rx = R - D" */
+        Rx = (llimb_t)r_lo - d_lo;
+        rx = (limb_t)Rx;
+        borrow = (limb_t)(Rx >> LIMB_T_BITS) & 1;
+        Rx = r_hi - (d_hi + (llimb_t)borrow);
+        borrow = (limb_t)(Rx >> LIMB_T_BITS);
+
+        /* "if (R >= D) R -= D" */
+        r_lo = ((r_lo ^ rx) & borrow) ^ rx;
+        rx = (limb_t)Rx;
+        r_hi = ((r_hi ^ rx) & borrow) ^ rx;
+
+        Q <<= 1;
+        Q |= ~borrow & 1;
+
+        /* "D >>= 1" */
+        d_lo >>= 1; d_lo |= d_hi << (LIMB_T_BITS - 1);
+        d_hi >>= 1;
+    }
+
+    mask = 0 - MSB(Q);  /* does it overflow? */
+
+    /* "borrow, Rx = R - D" */
+    Rx = (llimb_t)r_lo - d_lo;
+    rx = (limb_t)Rx;
+    borrow = (limb_t)(Rx >> LIMB_T_BITS) & 1;
+    Rx = r_hi - (d_hi + (llimb_t)borrow);
+    borrow = (limb_t)(Rx >> LIMB_T_BITS) & 1;
+
+    Q <<= 1;
+    Q |= borrow ^ 1;
+
+    return (Q | mask);
+}
+
+static limb_t quot_rem_n(limb_t *div_rem, const limb_t *divisor,
+                                          limb_t quotient, size_t n)
+{
+    __builtin_assume(n != 0 && n%2 == 0);
+    llimb_t limbx;
+    limb_t tmp[BLST_MAX_LIMBS+1], carry, mask, borrow;
+    size_t i;
+
+    /* divisor*quotient */
+    for (carry=0, i=0; i<n; i++) {
+        limbx = (quotient * (llimb_t)divisor[i]) + carry;
+        tmp[i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS);
+    }
+    tmp[i] = carry;
+
+    /* remainder = dividend - divisor*quotient */
+    for (borrow=0, i=0; i<=n; i++) {
+        limbx = div_rem[i] - (tmp[i] + (llimb_t)borrow);
+        tmp[i] = (limb_t)limbx;
+        borrow = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    mask = 0 - borrow;
+    launder(mask);
+
+    /* if quotient was off by one, add divisor to the remainder */
+    for (carry=0, i=0; i<n; i++) {
+        limbx = tmp[i] + ((divisor[i] & mask) + (llimb_t)carry);
+        div_rem[i] = (limb_t)limbx;
+        carry = (limb_t)(limbx >> LIMB_T_BITS) & 1;
+    }
+
+    return (div_rem[i] = quotient + mask);
+}
+
+inline limb_t quot_rem_128(limb_t *div_rem, const limb_t *divisor,
+                                            limb_t quotient)
+{   return quot_rem_n(div_rem, divisor, quotient, NLIMBS(128));   }
+
+inline limb_t quot_rem_64(limb_t *div_rem, const limb_t *divisor,
+                                           limb_t quotient)
+{   return quot_rem_n(div_rem, divisor, quotient, NLIMBS(64));   }
+
+/*
+ * Unlock reference implementations in vect.c
+ */
+#define mul_by_8_mod_384 mul_by_8_mod_384
+#define mul_by_8_mod_384x mul_by_8_mod_384x
+#define mul_by_3_mod_384x mul_by_3_mod_384x
+#define mul_by_1_plus_i_mod_384x mul_by_1_plus_i_mod_384x
+#define add_mod_384x add_mod_384x
+#define sub_mod_384x sub_mod_384x
+#define lshift_mod_384x lshift_mod_384x
+#define sqr_mont_384x sqr_mont_384x
+
+inline void vec_prefetch(const void *ptr, size_t len)
+{   (void)ptr; (void)len;   }
+
+/*
+ * SHA-256
+ */
+#define ROTR(x,n)	((x)>>n | (x)<<(32-n))
+#define Sigma0(x)	(ROTR((x),2) ^ ROTR((x),13) ^ ROTR((x),22))
+#define Sigma1(x)	(ROTR((x),6) ^ ROTR((x),11) ^ ROTR((x),25))
+#define sigma0(x)	(ROTR((x),7) ^ ROTR((x),18) ^ ((x)>>3))
+#define sigma1(x)	(ROTR((x),17) ^ ROTR((x),19) ^ ((x)>>10))
+#define Ch(x,y,z)	(((x) & (y)) ^ ((~(x)) & (z)))
+#define Maj(x,y,z)	(((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
+
+void blst_sha256_block_data_order(unsigned int *v, const void *inp,
+                                                   size_t blocks)
+{
+    static const unsigned int K256[64] = {
+        0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+        0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+        0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+        0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+        0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+        0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+        0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
+        0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+        0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
+        0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+        0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
+        0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+        0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
+        0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+        0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+        0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+    };
+    unsigned int X[16], l, a, b, c, d, e, f, g, h, s0, s1, T1, T2;
+    const unsigned char *data = inp;
+    size_t round;
+
+    a = v[0];
+    b = v[1];
+    c = v[2];
+    d = v[3];
+    e = v[4];
+    f = v[5];
+    g = v[6];
+    h = v[7];
+
+    while (blocks--) {
+        for (round = 0; round < 16; round++) {
+            l  = (unsigned int)data[0] << 24;
+            l |= (unsigned int)data[1] << 16;
+            l |= (unsigned int)data[2] << 8;
+            l |= (unsigned int)data[3];
+            data += 4;
+            T1 = X[round] = l;
+            T1 += h + Sigma1(e) + Ch(e, f, g) + K256[round];
+            T2 = Sigma0(a) + Maj(a, b, c);
+            h = g;
+            g = f;
+            f = e;
+            e = d + T1;
+            d = c;
+            c = b;
+            b = a;
+            a = T1 + T2;
+        }
+
+        for (; round < 64; round++) {
+            s0 = X[(round + 1) & 0x0f];
+            s0 = sigma0(s0);
+            s1 = X[(round + 14) & 0x0f];
+            s1 = sigma1(s1);
+
+            T1 = X[round & 0xf] += s0 + s1 + X[(round + 9) & 0xf];
+            T1 += h + Sigma1(e) + Ch(e, f, g) + K256[round];
+            T2 = Sigma0(a) + Maj(a, b, c);
+            h = g;
+            g = f;
+            f = e;
+            e = d + T1;
+            d = c;
+            c = b;
+            b = a;
+            a = T1 + T2;
+        }
+
+        a += v[0]; v[0] = a;
+        b += v[1]; v[1] = b;
+        c += v[2]; v[2] = c;
+        d += v[3]; v[3] = d;
+        e += v[4]; v[4] = e;
+        f += v[5]; v[5] = f;
+        g += v[6]; v[6] = g;
+        h += v[7]; v[7] = h;
+    }
+}
+#undef ROTR
+#undef Sigma0
+#undef Sigma1
+#undef sigma0
+#undef sigma1
+#undef Ch
+#undef Maj
+
+void blst_sha256_hcopy(unsigned int dst[8], const unsigned int src[8])
+{
+    size_t i;
+
+    for (i=0; i<8; i++)
+        dst[i] = src[i];
+}
+
+void blst_sha256_emit(unsigned char md[32], const unsigned int h[8])
+{
+    size_t i;
+
+    for (i=0; i<8; i++, md+=4) {
+        unsigned int h_i = h[i];
+        md[0] = (unsigned char)(h_i >> 24);
+        md[1] = (unsigned char)(h_i >> 16);
+        md[2] = (unsigned char)(h_i >> 8);
+        md[3] = (unsigned char)h_i;
+    }
+}
+
+void blst_sha256_bcopy(void *dst_, const void *src_, size_t len)
+{
+    unsigned char *dst = dst_;
+    const unsigned char *src = src_;
+    size_t i;
+
+    for (i=0; i<len; i++)
+        dst[i] = src[i];
+}
diff --git a/vendor/external/blst/src/pairing.c b/vendor/external/blst/src/pairing.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/pairing.c
@@ -0,0 +1,493 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "point.h"
+#include "fields.h"
+
+/*
+ * Line evaluations from  https://eprint.iacr.org/2010/354.pdf
+ * with a twist moving common expression to line_by_Px2.
+ */
+static void line_add(vec384fp6 line, POINTonE2 *T, const POINTonE2 *R,
+                                                   const POINTonE2_affine *Q)
+{
+    vec384x Z1Z1, U2, S2, H, HH, I, J, V;
+#if 1
+# define r line[1]
+#else
+    vec384x r;
+#endif
+
+    /*
+     * https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-madd-2007-bl
+     * with XYZ3 being |T|, XYZ1 - |R|, XY2 - |Q|, i.e. Q is affine
+     */
+    sqr_fp2(Z1Z1, R->Z);                /* Z1Z1 = Z1^2 */
+    mul_fp2(U2, Q->X, Z1Z1);            /* U2 = X2*Z1Z1 */
+
+    mul_fp2(S2, Q->Y, R->Z);
+    mul_fp2(S2, S2, Z1Z1);              /* S2 = Y2*Z1*Z1Z1 */
+
+    sub_fp2(H, U2, R->X);               /* H = U2-X1 */
+
+    sqr_fp2(HH, H);                     /* HH = H^2 */
+    add_fp2(I, HH, HH);
+    add_fp2(I, I, I);                   /* I = 4*HH */
+
+    mul_fp2(J, H, I);                   /* J = H*I */
+
+    sub_fp2(r, S2, R->Y);
+    add_fp2(r, r, r);                   /* r = 2*(S2-Y1) */
+
+    mul_fp2(V, R->X, I);                /* V = X1*I */
+
+    sqr_fp2(T->X, r);
+    sub_fp2(T->X, T->X, J);
+    sub_fp2(T->X, T->X, V);
+    sub_fp2(T->X, T->X, V);             /* X3 = r^2-J-2*V */
+
+    mul_fp2(J, J, R->Y);
+    sub_fp2(T->Y, V, T->X);
+    mul_fp2(T->Y, T->Y, r);
+    sub_fp2(T->Y, T->Y, J);
+    sub_fp2(T->Y, T->Y, J);             /* Y3 = r*(V-X3)-2*Y1*J */
+
+    add_fp2(T->Z, R->Z, H);
+    sqr_fp2(T->Z, T->Z);
+    sub_fp2(T->Z, T->Z, Z1Z1);
+    sub_fp2(T->Z, T->Z, HH);            /* Z3 = (Z1+H)^2-Z1Z1-HH */
+
+    /*
+     * line evaluation
+     */
+    mul_fp2(I, r, Q->X);
+    mul_fp2(J, Q->Y, T->Z);
+    sub_fp2(I, I, J);
+    add_fp2(line[0], I, I);          /* 2*(r*X2 - Y2*Z3) */
+#ifdef r
+# undef r
+#else
+    vec_copy(line[1], r, sizeof(r));
+#endif
+    vec_copy(line[2], T->Z, sizeof(T->Z));
+}
+
+static void line_dbl(vec384fp6 line, POINTonE2 *T, const POINTonE2 *Q)
+{
+    vec384x ZZ, A, B, C, D, E, F;
+
+    /*
+     * https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-alnr
+     */
+    sqr_fp2(A, Q->X);                   /* A = X1^2 */
+    sqr_fp2(B, Q->Y);                   /* B = Y1^2 */
+    sqr_fp2(ZZ, Q->Z);                  /* ZZ = Z1^2 */
+    sqr_fp2(C, B);                      /* C = B^2 */
+
+    add_fp2(D, Q->X, B);                /* X1+B */
+    sqr_fp2(D, D);                      /* (X1+B)^2 */
+    sub_fp2(D, D, A);                   /* (X1+B)^2-A */
+    sub_fp2(D, D, C);                   /* (X1+B)^2-A-C */
+    add_fp2(D, D, D);                   /* D = 2*((X1+B)^2-A-C) */
+
+    mul_by_3_fp2(E, A);                 /* E = 3*A */
+    sqr_fp2(F, E);                      /* F = E^2 */
+
+    add_fp2(line[0], E, Q->X);          /* 3*A+X1 for line evaluation */
+
+    sub_fp2(T->X, F, D);
+    sub_fp2(T->X, T->X, D);             /* X3 = F-2*D */
+
+    add_fp2(T->Z, Q->Y, Q->Z);
+    sqr_fp2(T->Z, T->Z);
+    sub_fp2(T->Z, T->Z, B);
+    sub_fp2(T->Z, T->Z, ZZ);            /* Z3 = (Y1+Z1)^2-B-ZZ */
+
+    mul_by_8_fp2(C, C);                 /* 8*C */
+    sub_fp2(T->Y, D, T->X);             /* D-X3 */
+    mul_fp2(T->Y, T->Y, E);             /* E*(D-X3) */
+    sub_fp2(T->Y, T->Y, C);             /* Y3 = E*(D-X3)-8*C */
+
+    /*
+     * line evaluation
+     */
+    sqr_fp2(line[0], line[0]);
+    sub_fp2(line[0], line[0], A);
+    sub_fp2(line[0], line[0], F);       /* (3*A+X1)^2 - X1^2 - 9*A^2 */
+    lshift_fp2(B, B, 2);
+    sub_fp2(line[0], line[0], B);       /* 6*X1^3 - 4*Y1^2 */
+
+    mul_fp2(line[1], E, ZZ);            /* 3*X1^2 * Z1^2 */
+
+    mul_fp2(line[2], T->Z, ZZ);         /* Z3 * Z1^2 */
+}
+
+static void line_by_Px2(vec384fp6 line, const POINTonE1_affine *Px2)
+{
+    mul_fp(line[1][0], line[1][0], Px2->X);   /* "b01" *= -2*P->X */
+    mul_fp(line[1][1], line[1][1], Px2->X);
+
+    mul_fp(line[2][0], line[2][0], Px2->Y);   /* "b11" *= 2*P->Y */
+    mul_fp(line[2][1], line[2][1], Px2->Y);
+}
+
+#if 0
+static void add_n_dbl(vec384fp12 ret, POINTonE2 *T, const POINTonE2_affine *Q,
+                      const POINTonE1_affine *Px2, vec384fp6 line, size_t n)
+{
+    line_add(line, T, T, Q);    line_by_Px2(line, Px2);
+    mul_by_xy00z0_fp12(ret, ret, line);
+    while (n--) {
+        sqr_fp12(ret, ret);
+        line_dbl(line, T, T);   line_by_Px2(line, Px2);
+        mul_by_xy00z0_fp12(ret, ret, line);
+    }
+}
+
+static void miller_loop(vec384fp12 ret, const POINTonE2 *Q, const POINTonE1 *P)
+{
+#define Q ((const POINTonE2_affine *)Q)
+    POINTonE2 T[1];
+    POINTonE1_affine Px2[1];
+    vec384fp6 line; /* it's not actual fp6, but 3 packed fp2, "xy00z0"  */
+
+    /* Move common expression from line evaluation to line_by_Px2. */
+    add_fp(Px2->X, P->X, P->X);
+    neg_fp(Px2->X, Px2->X);
+    add_fp(Px2->Y, P->Y, P->Y);
+
+    vec_copy(T->X, Q->X, 2*sizeof(T->X));
+    vec_copy(T->Z, BLS12_381_Rx.p2, sizeof(T->Z));
+
+    /* first step is ret = 1^2*line, which is replaced with ret = line  */
+    line_dbl(line, T, T);                       /* 0x2                  */
+    line_by_Px2(line, Px2);
+    vec_zero(ret, sizeof(vec384fp12));
+    vec_copy(ret[0][0], line[0], 2*sizeof(vec384fp2));
+    vec_copy(ret[1][1], line[2], sizeof(vec384fp2));
+    add_n_dbl(ret, T, Q, Px2, line, 2);         /* ..0xc                */
+    add_n_dbl(ret, T, Q, Px2, line, 3);         /* ..0x68               */
+    add_n_dbl(ret, T, Q, Px2, line, 9);         /* ..0xd200             */
+    add_n_dbl(ret, T, Q, Px2, line, 32);        /* ..0xd20100000000     */
+    add_n_dbl(ret, T, Q, Px2, line, 16);        /* ..0xd201000000010000 */
+    conjugate_fp12(ret);                /* account for z being negative */
+#undef Q
+}
+#endif
+
+static void start_dbl_n(vec384fp12 ret, POINTonE2 T[],
+                                        const POINTonE1_affine Px2[], size_t n)
+{
+    size_t i;
+    vec384fp6 line; /* it's not actual fp6, but 3 packed fp2, "xy00z0"  */
+
+    /* first step is ret = 1^2*line, which is replaced with ret = line  */
+    line_dbl(line, T+0, T+0);           line_by_Px2(line, Px2+0);
+    vec_zero(ret, sizeof(vec384fp12));
+    vec_copy(ret[0][0], line[0], 2*sizeof(vec384fp2));
+    vec_copy(ret[1][1], line[2], sizeof(vec384fp2));
+
+    for (i = 1; i < n; i++) {
+        line_dbl(line, T+i, T+i);       line_by_Px2(line, Px2+i);
+        mul_by_xy00z0_fp12(ret, ret, line);
+    }
+}
+
+static void add_n_dbl_n(vec384fp12 ret, POINTonE2 T[],
+                                        const POINTonE2_affine Q[],
+                                        const POINTonE1_affine Px2[],
+                                        size_t n, size_t k)
+{
+    size_t i;
+    vec384fp6 line; /* it's not actual fp6, but 3 packed fp2, "xy00z0"  */
+
+    for (i = 0; i < n; i++) {
+        line_add(line, T+i, T+i, Q+i);  line_by_Px2(line, Px2+i);
+        mul_by_xy00z0_fp12(ret, ret, line);
+    }
+    while (k--) {
+        sqr_fp12(ret, ret);
+        for (i = 0; i < n; i++) {
+            line_dbl(line, T+i, T+i);   line_by_Px2(line, Px2+i);
+            mul_by_xy00z0_fp12(ret, ret, line);
+        }
+    }
+}
+
+static void miller_loop_n(vec384fp12 ret, const POINTonE2_affine Q[],
+                                          const POINTonE1_affine P[], size_t n)
+{
+#if !defined(__STDC_VERSION__) || __STDC_VERSION__<199901 \
+                               || defined(__STDC_NO_VLA__)
+    POINTonE2 *T = alloca(n*sizeof(POINTonE2));
+    POINTonE1_affine *Px2 = alloca(n*sizeof(POINTonE1_affine));
+#else
+    POINTonE2 T[n];
+    POINTonE1_affine Px2[n];
+#endif
+    size_t i;
+
+    if ((n == 1) && (vec_is_zero(&Q[0], sizeof(Q[0])) |
+                     vec_is_zero(&P[0], sizeof(P[0]))) ) {
+        /*
+         * Special case of infinite aggregated signature, pair the additive
+         * group's identity with the multiplicative group's identity.
+         */
+        vec_copy(ret, BLS12_381_Rx.p12, sizeof(vec384fp12));
+        return;
+    }
+
+    for (i = 0; i < n; i++) {
+        /* Move common expression from line evaluation to line_by_Px2.  */
+        add_fp(Px2[i].X, P[i].X, P[i].X);
+        neg_fp(Px2[i].X, Px2[i].X);
+        add_fp(Px2[i].Y, P[i].Y, P[i].Y);
+
+        vec_copy(T[i].X, Q[i].X, 2*sizeof(T[i].X));
+        vec_copy(T[i].Z, BLS12_381_Rx.p2, sizeof(T[i].Z));
+    }
+
+    /* first step is ret = 1^2*line, which is replaced with ret = line  */
+    start_dbl_n(ret, T, Px2, n);                /* 0x2                  */
+    add_n_dbl_n(ret, T, Q, Px2, n, 2);          /* ..0xc                */
+    add_n_dbl_n(ret, T, Q, Px2, n, 3);          /* ..0x68               */
+    add_n_dbl_n(ret, T, Q, Px2, n, 9);          /* ..0xd200             */
+    add_n_dbl_n(ret, T, Q, Px2, n, 32);         /* ..0xd20100000000     */
+    add_n_dbl_n(ret, T, Q, Px2, n, 16);         /* ..0xd201000000010000 */
+    conjugate_fp12(ret);                /* account for z being negative */
+}
+
+static void pre_add_n_dbl(vec384fp6 lines[], POINTonE2 *T,
+                                             const POINTonE2_affine *Q,
+                                             size_t n)
+{
+    line_add(lines++[0], T, T, Q);
+    while (n--)
+        line_dbl(lines++[0], T, T);
+}
+
+static void precompute_lines(vec384fp6 Qlines[68], const POINTonE2_affine *Q)
+{
+    POINTonE2 T[1];
+
+    vec_copy(T->X, Q->X, 2*sizeof(T->X));
+    vec_copy(T->Z, BLS12_381_Rx.p2, sizeof(T->Z));
+
+    line_dbl(Qlines[0], T, T);                  /* 0x2                  */
+    pre_add_n_dbl(&Qlines[1],  T, Q, 2);        /* ..0xc                */
+    pre_add_n_dbl(&Qlines[4],  T, Q, 3);        /* ..0x68               */
+    pre_add_n_dbl(&Qlines[8],  T, Q, 9);        /* ..0xd200             */
+    pre_add_n_dbl(&Qlines[18], T, Q, 32);       /* ..0xd20100000000     */
+    pre_add_n_dbl(&Qlines[51], T, Q, 16);       /* ..0xd201000000010000 */
+}
+
+static void post_line_by_Px2(vec384fp6 out, const vec384fp6 in,
+                                            const POINTonE1_affine *Px2)
+{
+    vec_copy(out[0], in[0], sizeof(out[0]));
+
+    mul_fp(out[1][0], in[1][0], Px2->X);        /* "b01" *= -2*P->X */
+    mul_fp(out[1][1], in[1][1], Px2->X);
+
+    mul_fp(out[2][0], in[2][0], Px2->Y);        /* "b11" *= 2*P->Y */
+    mul_fp(out[2][1], in[2][1], Px2->Y);
+}
+
+static void post_add_n_dbl(vec384fp12 ret, const vec384fp6 lines[],
+                           const POINTonE1_affine *Px2, size_t n)
+{
+    vec384fp6 line;
+
+    post_line_by_Px2(line, lines++[0], Px2);
+    mul_by_xy00z0_fp12(ret, ret, line);
+    while (n--) {
+        sqr_fp12(ret, ret);
+        post_line_by_Px2(line, lines++[0], Px2);
+        mul_by_xy00z0_fp12(ret, ret, line);
+    }
+}
+
+static void miller_loop_lines(vec384fp12 ret, const vec384fp6 Qlines[68],
+                                              const POINTonE1_affine *P)
+{
+    POINTonE1_affine Px2[1];
+    vec384fp6 line; /* it's not actual fp6, but 3 packed fp2, "xy00z0"  */
+
+    /* Move common expression from line evaluation to line_by_Px2. */
+    add_fp(Px2->X, P->X, P->X);
+    neg_fp(Px2->X, Px2->X);
+    add_fp(Px2->Y, P->Y, P->Y);
+
+    /* first step is ret = 1^2*line, which is replaced with ret = line  */
+    post_line_by_Px2(line, Qlines[0], Px2);     /* 0x2                  */
+    vec_zero(ret, sizeof(vec384fp12));
+    vec_copy(ret[0][0], line[0], 2*sizeof(vec384fp2));
+    vec_copy(ret[1][1], line[2], sizeof(vec384fp2));
+    post_add_n_dbl(ret, &Qlines[1],  Px2, 2);   /* ..0xc                */
+    post_add_n_dbl(ret, &Qlines[4],  Px2, 3);   /* ..0x68               */
+    post_add_n_dbl(ret, &Qlines[8],  Px2, 9);   /* ..0xd200             */
+    post_add_n_dbl(ret, &Qlines[18], Px2, 32);  /* ..0xd20100000000     */
+    post_add_n_dbl(ret, &Qlines[51], Px2, 16);  /* ..0xd201000000010000 */
+    conjugate_fp12(ret);                /* account for z being negative */
+}
+
+#ifdef INTERNAL_TESTMODE
+static void miller_loop_alt(vec384fp12 ret, const POINTonE2_affine *Q,
+                                            const POINTonE1_affine *P)
+{
+    vec384fp6 lines[68];
+
+    precompute_lines(lines, Q);
+    miller_loop_lines(ret, lines, P);
+}
+#endif
+
+static void mul_n_sqr(vec384fp12 ret, const vec384fp12 a, size_t n)
+{
+    mul_fp12(ret, ret, a);
+    while (n--)
+        cyclotomic_sqr_fp12(ret, ret);
+}
+
+static void raise_to_z_div_by_2(vec384fp12 ret, const vec384fp12 a)
+{
+    cyclotomic_sqr_fp12(ret, a);                /* 0x2                  */
+    mul_n_sqr(ret, a, 2);                       /* ..0xc                */
+    mul_n_sqr(ret, a, 3);                       /* ..0x68               */
+    mul_n_sqr(ret, a, 9);                       /* ..0xd200             */
+    mul_n_sqr(ret, a, 32);                      /* ..0xd20100000000     */
+    mul_n_sqr(ret, a, 16-1);                    /* ..0x6900800000008000 */
+    conjugate_fp12(ret);                /* account for z being negative */
+}
+
+#define raise_to_z(a, b) (raise_to_z_div_by_2(a, b), cyclotomic_sqr_fp12(a, a))
+
+/*
+ * Adaptation from <zkcrypto>/pairing/src/bls12_381/mod.rs
+ */
+static void final_exp(vec384fp12 ret, const vec384fp12 f)
+{
+    vec384fp12 y0, y1, y2, y3;
+
+    vec_copy(y1, f, sizeof(y1));
+    conjugate_fp12(y1);
+    inverse_fp12(y2, f);
+    mul_fp12(ret, y1, y2);
+    frobenius_map_fp12(y2, ret, 2);
+    mul_fp12(ret, ret, y2);
+
+    cyclotomic_sqr_fp12(y0, ret);
+    raise_to_z(y1, y0);
+    raise_to_z_div_by_2(y2, y1);
+    vec_copy(y3, ret, sizeof(y3));
+    conjugate_fp12(y3);
+    mul_fp12(y1, y1, y3);
+    conjugate_fp12(y1);
+    mul_fp12(y1, y1, y2);
+    raise_to_z(y2, y1);
+    raise_to_z(y3, y2);
+    conjugate_fp12(y1);
+    mul_fp12(y3, y3, y1);
+    conjugate_fp12(y1);
+    frobenius_map_fp12(y1, y1, 3);
+    frobenius_map_fp12(y2, y2, 2);
+    mul_fp12(y1, y1, y2);
+    raise_to_z(y2, y3);
+    mul_fp12(y2, y2, y0);
+    mul_fp12(y2, y2, ret);
+    mul_fp12(y1, y1, y2);
+    frobenius_map_fp12(y2, y3, 1);
+    mul_fp12(ret, y1, y2);
+}
+
+void blst_miller_loop(vec384fp12 ret, const POINTonE2_affine *Q,
+                                      const POINTonE1_affine *P)
+{   miller_loop_n(ret, Q ? Q : (const POINTonE2_affine *)&BLS12_381_G2,
+                       P ? P : (const POINTonE1_affine *)&BLS12_381_G1, 1);
+}
+
+#ifndef MILLER_LOOP_N_MAX
+# define MILLER_LOOP_N_MAX 16
+#endif
+
+void blst_miller_loop_n(vec384fp12 out, const POINTonE2_affine *const Qs[],
+                                        const POINTonE1_affine *const Ps[],
+                                        size_t n)
+{   /* ~10KB of stack storage */
+    POINTonE2 T[MILLER_LOOP_N_MAX];
+    POINTonE2_affine Q[MILLER_LOOP_N_MAX];
+    POINTonE1_affine Px2[MILLER_LOOP_N_MAX];
+    const POINTonE2_affine *Qptr = NULL;
+    const POINTonE1_affine *Pptr = NULL;
+    size_t i, j;
+
+    for (i = 0, j = 0; j < n; j++) {
+        Qptr = *Qs ? *Qs++ : Qptr+1;
+        Pptr = *Ps ? *Ps++ : Pptr+1;
+
+        /* Move common expression from line evaluation to line_by_Px2.  */
+        add_fp(Px2[i].X, Pptr->X, Pptr->X);
+        neg_fp(Px2[i].X, Px2[i].X);
+        add_fp(Px2[i].Y, Pptr->Y, Pptr->Y);
+
+        vec_copy(Q[i].X, Qptr->X, 2*sizeof(Q[i].X));
+        vec_copy(T[i].X, Qptr->X, 2*sizeof(T[i].X));
+        vec_copy(T[i].Z, BLS12_381_Rx.p2, sizeof(T[i].Z));
+
+        if (++i == MILLER_LOOP_N_MAX || j == n-1) {
+            vec384fp12 tmp;
+            vec384fp6 *ret = j < MILLER_LOOP_N_MAX ? out : tmp;
+
+            /* first step is ret = 1^2*line, which is just ret = line       */
+            start_dbl_n(ret, T, Px2, i);            /* 0x2                  */
+            add_n_dbl_n(ret, T, Q, Px2, i, 2);      /* ..0xc                */
+            add_n_dbl_n(ret, T, Q, Px2, i, 3);      /* ..0x68               */
+            add_n_dbl_n(ret, T, Q, Px2, i, 9);      /* ..0xd200             */
+            add_n_dbl_n(ret, T, Q, Px2, i, 32);     /* ..0xd20100000000     */
+            add_n_dbl_n(ret, T, Q, Px2, i, 16);     /* ..0xd201000000010000 */
+            conjugate_fp12(ret);            /* account for z being negative */
+
+            if (j >= MILLER_LOOP_N_MAX)
+                mul_fp12(out, out, ret);
+
+            i = 0;
+        }
+    }
+}
+
+void blst_final_exp(vec384fp12 ret, const vec384fp12 f)
+{   final_exp(ret, f);   }
+
+void blst_precompute_lines(vec384fp6 Qlines[68], const POINTonE2_affine *Q)
+{   precompute_lines(Qlines, Q);   }
+
+void blst_miller_loop_lines(vec384fp12 ret, const vec384fp6 Qlines[68],
+                                            const POINTonE1_affine *P)
+{   miller_loop_lines(ret, Qlines, P);   }
+
+static bool_t is_cyclotomic(const vec384fp12 f)
+{
+    vec384fp12 a, b;
+
+    frobenius_map_fp12(a, f, 2);
+    frobenius_map_fp12(b, a, 2);
+    mul_fp12(b, b, f);
+
+    return vec_is_equal(a, b, sizeof(a));
+}
+
+int blst_fp12_in_group(const vec384fp12 f)
+{
+    vec384fp12 a, b;
+
+    if (vec_is_zero(f, sizeof(vec384fp12)) || !is_cyclotomic(f))
+        return 0;
+
+    frobenius_map_fp12(a, f, 1);
+    raise_to_z(b, f);
+
+    return (int)vec_is_equal(a, b, sizeof(a));
+}
diff --git a/vendor/external/blst/src/pentaroot-addchain.h b/vendor/external/blst/src/pentaroot-addchain.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/pentaroot-addchain.h
@@ -0,0 +1,333 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+/*
+ * The "magic" number is 1/5 modulo BLS12_381_r-1. Exponentiation to which
+ * yields 5th root of the base.
+ *
+ * Generated with 'addchain 20974350070050476191779096203274386335076221000211055129041463479975432473805'
+ * https://github.com/kwantam/addchain
+ * # Bos-Coster (win=4)           :  307 (15)
+ * # Bos-Coster (win=10)          :  307 (18)
+ * # Yacobi                       :  319 (16)
+ * # Bos-Coster (win=2)           :  319 ( 5)
+ * # Bos-Coster (win=5)           :  306 (19) <<<
+ * # Bos-Coster (win=7)           :  311 (22)
+ * # Bos-Coster (win=9)           :  313 (20)
+ * # Bos-Coster (win=3)           :  314 ( 9)
+ * # Bos-Coster (win=6)           :  309 (21)
+ * # Bos-Coster (win=8)           :  309 (23)
+ * # Bergeron-Berstel-Brlek-Duboc :  334 ( 5)
+ */
+
+#define PENTAROOT_MOD_BLS12_381_r(out, inp, ptype) do { \
+ptype t[19]; \
+vec_copy(t[1], inp, sizeof(ptype)); /*    0: 1 */\
+sqr(t[7], t[1]);                    /*    1: 2 */\
+sqr(t[0], t[7]);                    /*    2: 4 */\
+sqr(t[2], t[0]);                    /*    3: 8 */\
+mul(t[10], t[2], t[1]);             /*    4: 9 */\
+mul(t[3], t[10], t[7]);             /*    5: b */\
+mul(t[1], t[10], t[0]);             /*    6: d */\
+mul(t[5], t[3], t[0]);              /*    7: f */\
+mul(t[9], t[10], t[2]);             /*    8: 11 */\
+mul(t[4], t[3], t[2]);              /*    9: 13 */\
+mul(t[15], t[5], t[2]);             /*   10: 17 */\
+mul(t[8], t[15], t[2]);             /*   11: 1f */\
+mul(t[13], t[8], t[7]);             /*   12: 21 */\
+mul(t[14], t[8], t[0]);             /*   13: 23 */\
+mul(t[12], t[13], t[0]);            /*   14: 25 */\
+mul(t[6], t[8], t[2]);              /*   15: 27 */\
+mul(t[11], t[14], t[2]);            /*   16: 2b */\
+sqr(t[0], t[15]);                   /*   17: 2e */\
+mul(t[18], t[6], t[2]);             /*   18: 2f */\
+mul(t[2], t[11], t[2]);             /*   19: 33 */\
+mul(t[16], t[2], t[7]);             /*   20: 35 */\
+mul(t[7], t[0], t[3]);              /*   21: 39 */\
+mul(t[17], t[0], t[5]);             /*   22: 3d */\
+/* sqr(t[0], t[0]); */              /*   23: 5c */\
+/* sqr(t[0], t[0]); */              /*   24: b8 */\
+/* sqr(t[0], t[0]); */              /*   25: 170 */\
+/* sqr(t[0], t[0]); */              /*   26: 2e0 */\
+/* sqr(t[0], t[0]); */              /*   27: 5c0 */\
+/* sqr(t[0], t[0]); */              /*   28: b80 */\
+/* sqr(t[0], t[0]); */              /*   29: 1700 */\
+sqr_n_mul(t[0], t[0], 7, t[18]);    /*   30: 172f */\
+/* sqr(t[0], t[0]); */              /*   31: 2e5e */\
+/* sqr(t[0], t[0]); */              /*   32: 5cbc */\
+/* sqr(t[0], t[0]); */              /*   33: b978 */\
+/* sqr(t[0], t[0]); */              /*   34: 172f0 */\
+/* sqr(t[0], t[0]); */              /*   35: 2e5e0 */\
+/* sqr(t[0], t[0]); */              /*   36: 5cbc0 */\
+sqr_n_mul(t[0], t[0], 6, t[13]);    /*   37: 5cbe1 */\
+/* sqr(t[0], t[0]); */              /*   38: b97c2 */\
+/* sqr(t[0], t[0]); */              /*   39: 172f84 */\
+/* sqr(t[0], t[0]); */              /*   40: 2e5f08 */\
+/* sqr(t[0], t[0]); */              /*   41: 5cbe10 */\
+/* sqr(t[0], t[0]); */              /*   42: b97c20 */\
+/* sqr(t[0], t[0]); */              /*   43: 172f840 */\
+sqr_n_mul(t[0], t[0], 6, t[17]);    /*   44: 172f87d */\
+/* sqr(t[0], t[0]); */              /*   45: 2e5f0fa */\
+/* sqr(t[0], t[0]); */              /*   46: 5cbe1f4 */\
+/* sqr(t[0], t[0]); */              /*   47: b97c3e8 */\
+/* sqr(t[0], t[0]); */              /*   48: 172f87d0 */\
+/* sqr(t[0], t[0]); */              /*   49: 2e5f0fa0 */\
+/* sqr(t[0], t[0]); */              /*   50: 5cbe1f40 */\
+sqr_n_mul(t[0], t[0], 6, t[16]);    /*   51: 5cbe1f75 */\
+/* sqr(t[0], t[0]); */              /*   52: b97c3eea */\
+/* sqr(t[0], t[0]); */              /*   53: 172f87dd4 */\
+/* sqr(t[0], t[0]); */              /*   54: 2e5f0fba8 */\
+/* sqr(t[0], t[0]); */              /*   55: 5cbe1f750 */\
+/* sqr(t[0], t[0]); */              /*   56: b97c3eea0 */\
+sqr_n_mul(t[0], t[0], 5, t[15]);    /*   57: b97c3eeb7 */\
+/* sqr(t[0], t[0]); */              /*   58: 172f87dd6e */\
+/* sqr(t[0], t[0]); */              /*   59: 2e5f0fbadc */\
+/* sqr(t[0], t[0]); */              /*   60: 5cbe1f75b8 */\
+/* sqr(t[0], t[0]); */              /*   61: b97c3eeb70 */\
+/* sqr(t[0], t[0]); */              /*   62: 172f87dd6e0 */\
+/* sqr(t[0], t[0]); */              /*   63: 2e5f0fbadc0 */\
+sqr_n_mul(t[0], t[0], 6, t[15]);    /*   64: 2e5f0fbadd7 */\
+/* sqr(t[0], t[0]); */              /*   65: 5cbe1f75bae */\
+/* sqr(t[0], t[0]); */              /*   66: b97c3eeb75c */\
+/* sqr(t[0], t[0]); */              /*   67: 172f87dd6eb8 */\
+/* sqr(t[0], t[0]); */              /*   68: 2e5f0fbadd70 */\
+/* sqr(t[0], t[0]); */              /*   69: 5cbe1f75bae0 */\
+/* sqr(t[0], t[0]); */              /*   70: b97c3eeb75c0 */\
+/* sqr(t[0], t[0]); */              /*   71: 172f87dd6eb80 */\
+/* sqr(t[0], t[0]); */              /*   72: 2e5f0fbadd700 */\
+sqr_n_mul(t[0], t[0], 8, t[14]);    /*   73: 2e5f0fbadd723 */\
+/* sqr(t[0], t[0]); */              /*   74: 5cbe1f75bae46 */\
+/* sqr(t[0], t[0]); */              /*   75: b97c3eeb75c8c */\
+/* sqr(t[0], t[0]); */              /*   76: 172f87dd6eb918 */\
+/* sqr(t[0], t[0]); */              /*   77: 2e5f0fbadd7230 */\
+/* sqr(t[0], t[0]); */              /*   78: 5cbe1f75bae460 */\
+/* sqr(t[0], t[0]); */              /*   79: b97c3eeb75c8c0 */\
+/* sqr(t[0], t[0]); */              /*   80: 172f87dd6eb9180 */\
+/* sqr(t[0], t[0]); */              /*   81: 2e5f0fbadd72300 */\
+sqr_n_mul(t[0], t[0], 8, t[13]);    /*   82: 2e5f0fbadd72321 */\
+/* sqr(t[0], t[0]); */              /*   83: 5cbe1f75bae4642 */\
+/* sqr(t[0], t[0]); */              /*   84: b97c3eeb75c8c84 */\
+/* sqr(t[0], t[0]); */              /*   85: 172f87dd6eb91908 */\
+/* sqr(t[0], t[0]); */              /*   86: 2e5f0fbadd723210 */\
+/* sqr(t[0], t[0]); */              /*   87: 5cbe1f75bae46420 */\
+/* sqr(t[0], t[0]); */              /*   88: b97c3eeb75c8c840 */\
+sqr_n_mul(t[0], t[0], 6, t[2]);     /*   89: b97c3eeb75c8c873 */\
+/* sqr(t[0], t[0]); */              /*   90: 172f87dd6eb9190e6 */\
+/* sqr(t[0], t[0]); */              /*   91: 2e5f0fbadd72321cc */\
+/* sqr(t[0], t[0]); */              /*   92: 5cbe1f75bae464398 */\
+/* sqr(t[0], t[0]); */              /*   93: b97c3eeb75c8c8730 */\
+/* sqr(t[0], t[0]); */              /*   94: 172f87dd6eb9190e60 */\
+/* sqr(t[0], t[0]); */              /*   95: 2e5f0fbadd72321cc0 */\
+sqr_n_mul(t[0], t[0], 6, t[13]);    /*   96: 2e5f0fbadd72321ce1 */\
+/* sqr(t[0], t[0]); */              /*   97: 5cbe1f75bae46439c2 */\
+/* sqr(t[0], t[0]); */              /*   98: b97c3eeb75c8c87384 */\
+/* sqr(t[0], t[0]); */              /*   99: 172f87dd6eb9190e708 */\
+/* sqr(t[0], t[0]); */              /*  100: 2e5f0fbadd72321ce10 */\
+/* sqr(t[0], t[0]); */              /*  101: 5cbe1f75bae46439c20 */\
+/* sqr(t[0], t[0]); */              /*  102: b97c3eeb75c8c873840 */\
+/* sqr(t[0], t[0]); */              /*  103: 172f87dd6eb9190e7080 */\
+sqr_n_mul(t[0], t[0], 7, t[12]);    /*  104: 172f87dd6eb9190e70a5 */\
+/* sqr(t[0], t[0]); */              /*  105: 2e5f0fbadd72321ce14a */\
+/* sqr(t[0], t[0]); */              /*  106: 5cbe1f75bae46439c294 */\
+/* sqr(t[0], t[0]); */              /*  107: b97c3eeb75c8c8738528 */\
+/* sqr(t[0], t[0]); */              /*  108: 172f87dd6eb9190e70a50 */\
+/* sqr(t[0], t[0]); */              /*  109: 2e5f0fbadd72321ce14a0 */\
+/* sqr(t[0], t[0]); */              /*  110: 5cbe1f75bae46439c2940 */\
+/* sqr(t[0], t[0]); */              /*  111: b97c3eeb75c8c87385280 */\
+/* sqr(t[0], t[0]); */              /*  112: 172f87dd6eb9190e70a500 */\
+sqr_n_mul(t[0], t[0], 8, t[11]);    /*  113: 172f87dd6eb9190e70a52b */\
+/* sqr(t[0], t[0]); */              /*  114: 2e5f0fbadd72321ce14a56 */\
+/* sqr(t[0], t[0]); */              /*  115: 5cbe1f75bae46439c294ac */\
+/* sqr(t[0], t[0]); */              /*  116: b97c3eeb75c8c873852958 */\
+/* sqr(t[0], t[0]); */              /*  117: 172f87dd6eb9190e70a52b0 */\
+/* sqr(t[0], t[0]); */              /*  118: 2e5f0fbadd72321ce14a560 */\
+/* sqr(t[0], t[0]); */              /*  119: 5cbe1f75bae46439c294ac0 */\
+sqr_n_mul(t[0], t[0], 6, t[1]);     /*  120: 5cbe1f75bae46439c294acd */\
+/* sqr(t[0], t[0]); */              /*  121: b97c3eeb75c8c873852959a */\
+/* sqr(t[0], t[0]); */              /*  122: 172f87dd6eb9190e70a52b34 */\
+/* sqr(t[0], t[0]); */              /*  123: 2e5f0fbadd72321ce14a5668 */\
+/* sqr(t[0], t[0]); */              /*  124: 5cbe1f75bae46439c294acd0 */\
+/* sqr(t[0], t[0]); */              /*  125: b97c3eeb75c8c873852959a0 */\
+/* sqr(t[0], t[0]); */              /*  126: 172f87dd6eb9190e70a52b340 */\
+/* sqr(t[0], t[0]); */              /*  127: 2e5f0fbadd72321ce14a56680 */\
+/* sqr(t[0], t[0]); */              /*  128: 5cbe1f75bae46439c294acd00 */\
+sqr_n_mul(t[0], t[0], 8, t[2]);     /*  129: 5cbe1f75bae46439c294acd33 */\
+/* sqr(t[0], t[0]); */              /*  130: b97c3eeb75c8c873852959a66 */\
+/* sqr(t[0], t[0]); */              /*  131: 172f87dd6eb9190e70a52b34cc */\
+/* sqr(t[0], t[0]); */              /*  132: 2e5f0fbadd72321ce14a566998 */\
+/* sqr(t[0], t[0]); */              /*  133: 5cbe1f75bae46439c294acd330 */\
+/* sqr(t[0], t[0]); */              /*  134: b97c3eeb75c8c873852959a660 */\
+/* sqr(t[0], t[0]); */              /*  135: 172f87dd6eb9190e70a52b34cc0 */\
+sqr_n_mul(t[0], t[0], 6, t[11]);    /*  136: 172f87dd6eb9190e70a52b34ceb */\
+/* sqr(t[0], t[0]); */              /*  137: 2e5f0fbadd72321ce14a56699d6 */\
+/* sqr(t[0], t[0]); */              /*  138: 5cbe1f75bae46439c294acd33ac */\
+/* sqr(t[0], t[0]); */              /*  139: b97c3eeb75c8c873852959a6758 */\
+/* sqr(t[0], t[0]); */              /*  140: 172f87dd6eb9190e70a52b34ceb0 */\
+sqr_n_mul(t[0], t[0], 4, t[10]);    /*  141: 172f87dd6eb9190e70a52b34ceb9 */\
+/* sqr(t[0], t[0]); */              /*  142: 2e5f0fbadd72321ce14a56699d72 */\
+/* sqr(t[0], t[0]); */              /*  143: 5cbe1f75bae46439c294acd33ae4 */\
+/* sqr(t[0], t[0]); */              /*  144: b97c3eeb75c8c873852959a675c8 */\
+/* sqr(t[0], t[0]); */              /*  145: 172f87dd6eb9190e70a52b34ceb90 */\
+/* sqr(t[0], t[0]); */              /*  146: 2e5f0fbadd72321ce14a56699d720 */\
+sqr_n_mul(t[0], t[0], 5, t[8]);     /*  147: 2e5f0fbadd72321ce14a56699d73f */\
+/* sqr(t[0], t[0]); */              /*  148: 5cbe1f75bae46439c294acd33ae7e */\
+/* sqr(t[0], t[0]); */              /*  149: b97c3eeb75c8c873852959a675cfc */\
+/* sqr(t[0], t[0]); */              /*  150: 172f87dd6eb9190e70a52b34ceb9f8 */\
+/* sqr(t[0], t[0]); */              /*  151: 2e5f0fbadd72321ce14a56699d73f0 */\
+/* sqr(t[0], t[0]); */              /*  152: 5cbe1f75bae46439c294acd33ae7e0 */\
+/* sqr(t[0], t[0]); */              /*  153: b97c3eeb75c8c873852959a675cfc0 */\
+/* sqr(t[0], t[0]); */              /*  154: 172f87dd6eb9190e70a52b34ceb9f80 */\
+/* sqr(t[0], t[0]); */              /*  155: 2e5f0fbadd72321ce14a56699d73f00 */\
+/* sqr(t[0], t[0]); */              /*  156: 5cbe1f75bae46439c294acd33ae7e00 */\
+/* sqr(t[0], t[0]); */              /*  157: b97c3eeb75c8c873852959a675cfc00 */\
+/* sqr(t[0], t[0]); */              /*  158: 172f87dd6eb9190e70a52b34ceb9f800 */\
+/* sqr(t[0], t[0]); */              /*  159: 2e5f0fbadd72321ce14a56699d73f000 */\
+/* sqr(t[0], t[0]); */              /*  160: 5cbe1f75bae46439c294acd33ae7e000 */\
+/* sqr(t[0], t[0]); */              /*  161: b97c3eeb75c8c873852959a675cfc000 */\
+/* sqr(t[0], t[0]); */              /*  162: 172f87dd6eb9190e70a52b34ceb9f8000 */\
+sqr_n_mul(t[0], t[0], 15, t[9]);    /*  163: 172f87dd6eb9190e70a52b34ceb9f8011 */\
+/* sqr(t[0], t[0]); */              /*  164: 2e5f0fbadd72321ce14a56699d73f0022 */\
+/* sqr(t[0], t[0]); */              /*  165: 5cbe1f75bae46439c294acd33ae7e0044 */\
+/* sqr(t[0], t[0]); */              /*  166: b97c3eeb75c8c873852959a675cfc0088 */\
+/* sqr(t[0], t[0]); */              /*  167: 172f87dd6eb9190e70a52b34ceb9f80110 */\
+/* sqr(t[0], t[0]); */              /*  168: 2e5f0fbadd72321ce14a56699d73f00220 */\
+/* sqr(t[0], t[0]); */              /*  169: 5cbe1f75bae46439c294acd33ae7e00440 */\
+/* sqr(t[0], t[0]); */              /*  170: b97c3eeb75c8c873852959a675cfc00880 */\
+/* sqr(t[0], t[0]); */              /*  171: 172f87dd6eb9190e70a52b34ceb9f801100 */\
+sqr_n_mul(t[0], t[0], 8, t[3]);     /*  172: 172f87dd6eb9190e70a52b34ceb9f80110b */\
+/* sqr(t[0], t[0]); */              /*  173: 2e5f0fbadd72321ce14a56699d73f002216 */\
+/* sqr(t[0], t[0]); */              /*  174: 5cbe1f75bae46439c294acd33ae7e00442c */\
+/* sqr(t[0], t[0]); */              /*  175: b97c3eeb75c8c873852959a675cfc008858 */\
+/* sqr(t[0], t[0]); */              /*  176: 172f87dd6eb9190e70a52b34ceb9f80110b0 */\
+/* sqr(t[0], t[0]); */              /*  177: 2e5f0fbadd72321ce14a56699d73f0022160 */\
+sqr_n_mul(t[0], t[0], 5, t[8]);     /*  178: 2e5f0fbadd72321ce14a56699d73f002217f */\
+/* sqr(t[0], t[0]); */              /*  179: 5cbe1f75bae46439c294acd33ae7e00442fe */\
+/* sqr(t[0], t[0]); */              /*  180: b97c3eeb75c8c873852959a675cfc00885fc */\
+/* sqr(t[0], t[0]); */              /*  181: 172f87dd6eb9190e70a52b34ceb9f80110bf8 */\
+/* sqr(t[0], t[0]); */              /*  182: 2e5f0fbadd72321ce14a56699d73f002217f0 */\
+/* sqr(t[0], t[0]); */              /*  183: 5cbe1f75bae46439c294acd33ae7e00442fe0 */\
+/* sqr(t[0], t[0]); */              /*  184: b97c3eeb75c8c873852959a675cfc00885fc0 */\
+/* sqr(t[0], t[0]); */              /*  185: 172f87dd6eb9190e70a52b34ceb9f80110bf80 */\
+/* sqr(t[0], t[0]); */              /*  186: 2e5f0fbadd72321ce14a56699d73f002217f00 */\
+/* sqr(t[0], t[0]); */              /*  187: 5cbe1f75bae46439c294acd33ae7e00442fe00 */\
+/* sqr(t[0], t[0]); */              /*  188: b97c3eeb75c8c873852959a675cfc00885fc00 */\
+sqr_n_mul(t[0], t[0], 10, t[7]);    /*  189: b97c3eeb75c8c873852959a675cfc00885fc39 */\
+/* sqr(t[0], t[0]); */              /*  190: 172f87dd6eb9190e70a52b34ceb9f80110bf872 */\
+/* sqr(t[0], t[0]); */              /*  191: 2e5f0fbadd72321ce14a56699d73f002217f0e4 */\
+/* sqr(t[0], t[0]); */              /*  192: 5cbe1f75bae46439c294acd33ae7e00442fe1c8 */\
+/* sqr(t[0], t[0]); */              /*  193: b97c3eeb75c8c873852959a675cfc00885fc390 */\
+/* sqr(t[0], t[0]); */              /*  194: 172f87dd6eb9190e70a52b34ceb9f80110bf8720 */\
+/* sqr(t[0], t[0]); */              /*  195: 2e5f0fbadd72321ce14a56699d73f002217f0e40 */\
+sqr_n_mul(t[0], t[0], 6, t[6]);     /*  196: 2e5f0fbadd72321ce14a56699d73f002217f0e67 */\
+/* sqr(t[0], t[0]); */              /*  197: 5cbe1f75bae46439c294acd33ae7e00442fe1cce */\
+/* sqr(t[0], t[0]); */              /*  198: b97c3eeb75c8c873852959a675cfc00885fc399c */\
+/* sqr(t[0], t[0]); */              /*  199: 172f87dd6eb9190e70a52b34ceb9f80110bf87338 */\
+/* sqr(t[0], t[0]); */              /*  200: 2e5f0fbadd72321ce14a56699d73f002217f0e670 */\
+/* sqr(t[0], t[0]); */              /*  201: 5cbe1f75bae46439c294acd33ae7e00442fe1cce0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  202: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3 */\
+/* sqr(t[0], t[0]); */              /*  203: b97c3eeb75c8c873852959a675cfc00885fc399e6 */\
+/* sqr(t[0], t[0]); */              /*  204: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cc */\
+/* sqr(t[0], t[0]); */              /*  205: 2e5f0fbadd72321ce14a56699d73f002217f0e6798 */\
+/* sqr(t[0], t[0]); */              /*  206: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf30 */\
+/* sqr(t[0], t[0]); */              /*  207: b97c3eeb75c8c873852959a675cfc00885fc399e60 */\
+/* sqr(t[0], t[0]); */              /*  208: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cc0 */\
+/* sqr(t[0], t[0]); */              /*  209: 2e5f0fbadd72321ce14a56699d73f002217f0e67980 */\
+/* sqr(t[0], t[0]); */              /*  210: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf300 */\
+sqr_n_mul(t[0], t[0], 8, t[2]);     /*  211: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf333 */\
+/* sqr(t[0], t[0]); */              /*  212: b97c3eeb75c8c873852959a675cfc00885fc399e666 */\
+/* sqr(t[0], t[0]); */              /*  213: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc */\
+/* sqr(t[0], t[0]); */              /*  214: 2e5f0fbadd72321ce14a56699d73f002217f0e679998 */\
+/* sqr(t[0], t[0]); */              /*  215: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3330 */\
+/* sqr(t[0], t[0]); */              /*  216: b97c3eeb75c8c873852959a675cfc00885fc399e6660 */\
+/* sqr(t[0], t[0]); */              /*  217: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc0 */\
+/* sqr(t[0], t[0]); */              /*  218: 2e5f0fbadd72321ce14a56699d73f002217f0e6799980 */\
+sqr_n_mul(t[0], t[0], 7, t[5]);     /*  219: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f */\
+/* sqr(t[0], t[0]); */              /*  220: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e */\
+/* sqr(t[0], t[0]); */              /*  221: b97c3eeb75c8c873852959a675cfc00885fc399e6663c */\
+/* sqr(t[0], t[0]); */              /*  222: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78 */\
+/* sqr(t[0], t[0]); */              /*  223: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f0 */\
+/* sqr(t[0], t[0]); */              /*  224: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e0 */\
+/* sqr(t[0], t[0]); */              /*  225: b97c3eeb75c8c873852959a675cfc00885fc399e6663c0 */\
+/* sqr(t[0], t[0]); */              /*  226: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc780 */\
+/* sqr(t[0], t[0]); */              /*  227: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f00 */\
+/* sqr(t[0], t[0]); */              /*  228: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e00 */\
+sqr_n_mul(t[0], t[0], 9, t[2]);     /*  229: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e33 */\
+/* sqr(t[0], t[0]); */              /*  230: b97c3eeb75c8c873852959a675cfc00885fc399e6663c66 */\
+/* sqr(t[0], t[0]); */              /*  231: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc */\
+/* sqr(t[0], t[0]); */              /*  232: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f198 */\
+/* sqr(t[0], t[0]); */              /*  233: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e330 */\
+/* sqr(t[0], t[0]); */              /*  234: b97c3eeb75c8c873852959a675cfc00885fc399e6663c660 */\
+/* sqr(t[0], t[0]); */              /*  235: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc0 */\
+/* sqr(t[0], t[0]); */              /*  236: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f1980 */\
+sqr_n_mul(t[0], t[0], 7, t[4]);     /*  237: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f1993 */\
+/* sqr(t[0], t[0]); */              /*  238: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e3326 */\
+/* sqr(t[0], t[0]); */              /*  239: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664c */\
+/* sqr(t[0], t[0]); */              /*  240: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc98 */\
+/* sqr(t[0], t[0]); */              /*  241: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19930 */\
+/* sqr(t[0], t[0]); */              /*  242: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e33260 */\
+/* sqr(t[0], t[0]); */              /*  243: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664c0 */\
+/* sqr(t[0], t[0]); */              /*  244: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc980 */\
+/* sqr(t[0], t[0]); */              /*  245: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f199300 */\
+sqr_n_mul(t[0], t[0], 8, t[2]);     /*  246: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f199333 */\
+/* sqr(t[0], t[0]); */              /*  247: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e332666 */\
+/* sqr(t[0], t[0]); */              /*  248: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664ccc */\
+/* sqr(t[0], t[0]); */              /*  249: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc9998 */\
+/* sqr(t[0], t[0]); */              /*  250: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f1993330 */\
+/* sqr(t[0], t[0]); */              /*  251: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e3326660 */\
+/* sqr(t[0], t[0]); */              /*  252: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664ccc0 */\
+/* sqr(t[0], t[0]); */              /*  253: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc99980 */\
+/* sqr(t[0], t[0]); */              /*  254: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933300 */\
+sqr_n_mul(t[0], t[0], 8, t[2]);     /*  255: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933333 */\
+/* sqr(t[0], t[0]); */              /*  256: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e33266666 */\
+/* sqr(t[0], t[0]); */              /*  257: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664ccccc */\
+/* sqr(t[0], t[0]); */              /*  258: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc999998 */\
+/* sqr(t[0], t[0]); */              /*  259: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f199333330 */\
+/* sqr(t[0], t[0]); */              /*  260: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e332666660 */\
+/* sqr(t[0], t[0]); */              /*  261: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664ccccc0 */\
+/* sqr(t[0], t[0]); */              /*  262: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc9999980 */\
+/* sqr(t[0], t[0]); */              /*  263: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f1993333300 */\
+sqr_n_mul(t[0], t[0], 8, t[2]);     /*  264: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f1993333333 */\
+/* sqr(t[0], t[0]); */              /*  265: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e3326666666 */\
+/* sqr(t[0], t[0]); */              /*  266: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664ccccccc */\
+/* sqr(t[0], t[0]); */              /*  267: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc99999998 */\
+/* sqr(t[0], t[0]); */              /*  268: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933333330 */\
+/* sqr(t[0], t[0]); */              /*  269: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e33266666660 */\
+/* sqr(t[0], t[0]); */              /*  270: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664ccccccc0 */\
+sqr_n_mul(t[0], t[0], 6, t[3]);     /*  271: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664cccccccb */\
+/* sqr(t[0], t[0]); */              /*  272: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc999999996 */\
+/* sqr(t[0], t[0]); */              /*  273: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933333332c */\
+/* sqr(t[0], t[0]); */              /*  274: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e332666666658 */\
+/* sqr(t[0], t[0]); */              /*  275: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664cccccccb0 */\
+/* sqr(t[0], t[0]); */              /*  276: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc9999999960 */\
+/* sqr(t[0], t[0]); */              /*  277: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933333332c0 */\
+/* sqr(t[0], t[0]); */              /*  278: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e3326666666580 */\
+/* sqr(t[0], t[0]); */              /*  279: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664cccccccb00 */\
+sqr_n_mul(t[0], t[0], 8, t[2]);     /*  280: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664cccccccb33 */\
+/* sqr(t[0], t[0]); */              /*  281: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc99999999666 */\
+/* sqr(t[0], t[0]); */              /*  282: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933333332ccc */\
+/* sqr(t[0], t[0]); */              /*  283: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e33266666665998 */\
+/* sqr(t[0], t[0]); */              /*  284: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664cccccccb330 */\
+/* sqr(t[0], t[0]); */              /*  285: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc999999996660 */\
+/* sqr(t[0], t[0]); */              /*  286: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933333332ccc0 */\
+/* sqr(t[0], t[0]); */              /*  287: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e332666666659980 */\
+/* sqr(t[0], t[0]); */              /*  288: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664cccccccb3300 */\
+sqr_n_mul(t[0], t[0], 8, t[2]);     /*  289: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664cccccccb3333 */\
+/* sqr(t[0], t[0]); */              /*  290: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc9999999966666 */\
+/* sqr(t[0], t[0]); */              /*  291: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933333332ccccc */\
+/* sqr(t[0], t[0]); */              /*  292: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e3326666666599998 */\
+/* sqr(t[0], t[0]); */              /*  293: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664cccccccb33330 */\
+/* sqr(t[0], t[0]); */              /*  294: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc99999999666660 */\
+/* sqr(t[0], t[0]); */              /*  295: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933333332ccccc0 */\
+/* sqr(t[0], t[0]); */              /*  296: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e33266666665999980 */\
+/* sqr(t[0], t[0]); */              /*  297: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664cccccccb333300 */\
+sqr_n_mul(t[0], t[0], 8, t[2]);     /*  298: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664cccccccb333333 */\
+/* sqr(t[0], t[0]); */              /*  299: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc999999996666666 */\
+/* sqr(t[0], t[0]); */              /*  300: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933333332ccccccc */\
+/* sqr(t[0], t[0]); */              /*  301: 5cbe1f75bae46439c294acd33ae7e00442fe1ccf3331e332666666659999998 */\
+/* sqr(t[0], t[0]); */              /*  302: b97c3eeb75c8c873852959a675cfc00885fc399e6663c664cccccccb3333330 */\
+/* sqr(t[0], t[0]); */              /*  303: 172f87dd6eb9190e70a52b34ceb9f80110bf8733cccc78cc9999999966666660 */\
+/* sqr(t[0], t[0]); */              /*  304: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933333332ccccccc0 */\
+sqr_n_mul(out, t[0], 6, t[1]);      /*  305: 2e5f0fbadd72321ce14a56699d73f002217f0e679998f19933333332cccccccd */\
+} while(0)
diff --git a/vendor/external/blst/src/pentaroot.c b/vendor/external/blst/src/pentaroot.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/pentaroot.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "fields.h"
+
+static inline void mul_fr(vec256 ret, const vec256 a, const vec256 b)
+{   mul_mont_sparse_256(ret, a, b, BLS12_381_r, r0);   }
+
+static inline void sqr_fr(vec256 ret, const vec256 a)
+{   sqr_mont_sparse_256(ret, a, BLS12_381_r, r0);   }
+
+#ifdef __OPTIMIZE_SIZE__
+void blst_fr_pentaroot(vec256 out, const vec256 inp)
+{
+    static const byte pow[] = {
+        TO_BYTES(0x33333332cccccccd), TO_BYTES(0x217f0e679998f199),
+        TO_BYTES(0xe14a56699d73f002), TO_BYTES(0x2e5f0fbadd72321c)
+    };
+    size_t pow_bits = 254;
+    vec256 ret;
+
+    vec_copy(ret, inp, sizeof(ret));  /* ret = inp^1 */
+    --pow_bits; /* most significant bit is set, skip over */
+    while (pow_bits--) {
+        sqr_fr(ret, ret);
+        if (is_bit_set(pow, pow_bits))
+            mul_fr(ret, ret, inp);
+    }
+    vec_copy(out, ret, sizeof(ret));  /* out = ret */
+}
+#else
+# if 0
+/*
+ * "255"-bit variant omits full reductions at the ends of squarings,
+ * not implemented yet[?].
+ */
+static inline void sqr_n_mul_fr(vec256 out, const vec256 a, size_t count,
+                                const vec256 b)
+{   sqr_n_mul_mont_255(out, a, count, BLS12_381_r, r0, b);   }
+# else
+static void sqr_n_mul_fr(vec256 out, const vec256 a, size_t count,
+                         const vec256 b)
+{
+    do {
+        sqr_fr(out, a);
+        a = out;
+    } while (--count);
+    mul_fr(out, out, b);
+}
+# endif
+
+# define sqr(ret,a)		sqr_fr(ret,a)
+# define mul(ret,a,b)		mul_fr(ret,a,b)
+# define sqr_n_mul(ret,a,n,b)	sqr_n_mul_fr(ret,a,n,b)
+
+# include "pentaroot-addchain.h"
+void blst_fr_pentaroot(vec256 out, const vec256 inp)
+{   PENTAROOT_MOD_BLS12_381_r(out, inp, vec256);   }
+# undef PENTAROOT_MOD_BLS12_381_r
+
+# undef sqr_n_mul
+# undef sqr
+# undef mul
+#endif
+
+void blst_fr_pentapow(vec256 out, const vec256 inp)
+{
+    vec256 tmp;
+
+    sqr_fr(tmp, inp);
+    sqr_fr(tmp, tmp);
+    mul_fr(out, tmp, inp);
+}
diff --git a/vendor/external/blst/src/point.h b/vendor/external/blst/src/point.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/point.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __BLS12_381_ASM_POINT_H__
+#define __BLS12_381_ASM_POINT_H__
+
+#include "vect.h"
+#include "bytes.h"
+
+#define DECLARE_POINT(ptype, bits) \
+typedef struct { vec##bits X,Y,Z; } ptype; \
+typedef struct { vec##bits X,Y; } ptype##_affine; \
+\
+static void ptype##_dadd(ptype *out, const ptype *p1, const ptype *p2,	\
+                         const vec##bits a4);				\
+static void ptype##_dadd_affine(ptype *out, const ptype *p1,		\
+                                            const ptype##_affine *p2);	\
+static void ptype##_add(ptype *out, const ptype *p1, const ptype *p2);	\
+static void ptype##_add_affine(ptype *out, const ptype *p1,		\
+                                           const ptype##_affine *p2);	\
+static void ptype##_double(ptype *out, const ptype *p1);		\
+static void ptype##_mult_w5(ptype *out, const ptype *point,		\
+                            const byte *scalar, size_t nbits);		\
+static void ptype##_cneg(ptype *p, limb_t cbit);			\
+static void ptype##_to_affine(ptype##_affine *out, const ptype *in);	\
+static void ptype##_from_Jacobian(ptype *out, const ptype *in);		\
+\
+static inline void ptype##_cswap(ptype *restrict a,			\
+                                 ptype *restrict b, bool_t cbit) {	\
+    vec_cswap(a, b, sizeof(ptype), cbit);				\
+} \
+static inline void ptype##_ccopy(ptype *restrict a,			\
+                                 const ptype *restrict b, bool_t cbit) {\
+    vec_select(a, b, a, sizeof(ptype), cbit);				\
+}
+
+#define DECLARE_PRIVATE_POINTXZ(ptype, bits) \
+typedef struct { vec##bits X,Z; } ptype##xz; \
+\
+static void ptype##xz_ladder_pre(ptype##xz *out, const ptype *in);	\
+static void ptype##xz_ladder_step(ptype##xz *r, ptype##xz *s,		\
+                                  const ptype##xz *p);			\
+static void ptype##xz_ladder_post(ptype *ret,				\
+                                  const ptype##xz *r, const ptype##xz *s, \
+                                  const ptype##xz *p, const vec##bits Y1);\
+\
+static inline void ptype##xz_cswap(ptype##xz *restrict a,		\
+                                   ptype##xz *restrict b, bool_t cbit) {\
+    vec_cswap(a, b, sizeof(ptype##xz), cbit);				\
+}
+
+DECLARE_POINT(POINTonE1, 384)
+
+DECLARE_POINT(POINTonE2, 384x)
+
+#ifdef __GNUC__
+# pragma GCC diagnostic ignored "-Wunused-function"
+#endif
+
+#endif
diff --git a/vendor/external/blst/src/rb_tree.c b/vendor/external/blst/src/rb_tree.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/rb_tree.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stddef.h>
+
+/*
+ * Red-black tree tailored for uniqueness test. Amount of messages to be
+ * checked is known prior context initialization, implementation is
+ * insert-only, failure is returned if message is already in the tree.
+ */
+
+struct node {
+    struct node *leafs[2];
+    const void *data;
+    size_t len_n_colour;    /* len<<1 | colour */
+};
+
+struct rb_tree {
+    struct node *root;
+    size_t n_nodes;
+    struct node nodes[1];
+};
+
+static long bytes_compare(const unsigned char *ptr0, size_t len0,
+                          const unsigned char *ptr1, size_t len1)
+{
+    size_t i, len = len0<len1 ? len0 : len1;
+    long a, b;
+
+    for (i=0; i<len; i++) {
+        if ((a = ptr0[i]) != (b = ptr1[i]))
+            return a - b;
+    }
+
+    return (long)len0 - (long)len1;
+}
+
+#define PAINT_BLACK(p)  ((p)->len_n_colour &= ~(size_t)1)
+#define PAINT_RED(p)    ((p)->len_n_colour |= 1)
+#define IS_RED(p)       ((p)->len_n_colour & 1)
+
+static int rb_tree_insert(struct rb_tree *tree, const void *data, size_t len)
+{
+    struct node *nodes[8*sizeof(void *)];   /* visited nodes    */
+    unsigned char dirs[8*sizeof(void *)];   /* taken directions */
+    size_t k = 0;                           /* walked distance  */
+    struct node *p, *y, *z;
+
+    for (p = tree->root; p != NULL; k++) {
+        long cmp = bytes_compare(data, len, p->data, p->len_n_colour>>1);
+
+        if (cmp == 0)
+            return 0;   /* already in tree, no insertion */
+
+        /* record the step */
+        nodes[k] = p;
+        p = p->leafs[(dirs[k] = cmp>0)];
+    }
+
+    /* allocate new node */
+    z = &tree->nodes[tree->n_nodes++];
+    z->leafs[0] = z->leafs[1] = NULL;
+    z->data = data;
+    z->len_n_colour = len<<1;
+    PAINT_RED(z);
+
+    /* graft |z| */
+    if (k > 0)
+        nodes[k-1]->leafs[dirs[k-1]] = z;
+    else
+        tree->root = z;
+
+    /* re-balance |tree| */
+    while (k >= 2 && IS_RED(y = nodes[k-1])) {
+        size_t ydir = dirs[k-2];
+        struct node *x = nodes[k-2],        /* |z|'s grandparent    */
+                    *s = x->leafs[ydir^1];  /* |z|'s uncle          */
+
+        if (s != NULL && IS_RED(s)) {
+            PAINT_RED(x);
+            PAINT_BLACK(y);
+            PAINT_BLACK(s);
+            k -= 2;
+        } else {
+            if (dirs[k-1] != ydir) {
+                /*    |        |
+                 *    x        x
+                 *   / \        \
+                 *  y   s -> z   s
+                 *   \      /
+                 *    z    y
+                 *   /      \
+                 *  ?        ?
+                 */
+                struct node *t = y;
+                y = y->leafs[ydir^1];
+                t->leafs[ydir^1] = y->leafs[ydir];
+                y->leafs[ydir] = t;
+            }
+
+            /*      |        |
+             *      x        y
+             *       \      / \
+             *    y   s -> z   x
+             *   / \          / \
+             *  z   ?        ?   s
+             */
+            x->leafs[ydir] = y->leafs[ydir^1];
+            y->leafs[ydir^1] = x;
+
+            PAINT_RED(x);
+            PAINT_BLACK(y);
+
+            if (k > 2)
+                nodes[k-3]->leafs[dirs[k-3]] = y;
+            else
+                tree->root = y;
+
+            break;
+        }
+    }
+
+    PAINT_BLACK(tree->root);
+
+    return 1;
+}
+
+#undef IS_RED
+#undef PAINT_RED
+#undef PAINT_BLACK
+
+size_t blst_uniq_sizeof(size_t n_nodes)
+{   return sizeof(struct rb_tree) + sizeof(struct node)*(n_nodes-1);   }
+
+void blst_uniq_init(struct rb_tree *tree)
+{
+    tree->root = NULL;
+    tree->n_nodes = 0;
+}
+
+int blst_uniq_test(struct rb_tree *tree, const void *data, size_t len)
+{   return (int)rb_tree_insert(tree, data, len);   }
diff --git a/vendor/external/blst/src/recip-addchain.h b/vendor/external/blst/src/recip-addchain.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/recip-addchain.h
@@ -0,0 +1,489 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+/*
+ * The "magic" number is BLS12_381_P-2. Exponentiation to which yields
+ * reciprocal to input base.
+ *
+ * Generated with 'addchain 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559785'
+ * https://github.com/kwantam/addchain
+ *
+ * # Bos-Coster (win=4)           :  461 (16) <<<
+ * # Bos-Coster (win=3)           :  464 ( 9)
+ * # Bos-Coster (win=8)           :  469 (35)
+ * # Bos-Coster (win=5)           :  463 (28)
+ * # Bos-Coster (win=9)           :  467 (32)
+ * # Bos-Coster (win=7)           :  462 (27)
+ * # Yacobi                       :  481 (31)
+ * # Bos-Coster (win=10)          :  475 (30)
+ * # Bos-Coster (win=6)           :  463 (32)
+ * # Bos-Coster (win=2)           :  489 ( 5)
+ * # Bergeron-Berstel-Brlek-Duboc :  498 ( 5)
+ */
+
+#define RECIPROCAL_MOD_BLS12_381_P(out, inp, ptype) do { \
+ptype t[16]; \
+vec_copy(t[1], inp, sizeof(ptype)); /*    0: 1 */\
+sqr(t[0], t[1]);                    /*    1: 2 */\
+mul(t[9], t[0], t[1]);              /*    2: 3 */\
+sqr(t[5], t[0]);                    /*    3: 4 */\
+mul(t[2], t[9], t[0]);              /*    4: 5 */\
+mul(t[7], t[5], t[9]);              /*    5: 7 */\
+mul(t[10], t[2], t[5]);             /*    6: 9 */\
+mul(t[13], t[7], t[5]);             /*    7: b */\
+mul(t[4], t[10], t[5]);             /*    8: d */\
+mul(t[8], t[13], t[5]);             /*    9: f */\
+mul(t[15], t[4], t[5]);             /*   10: 11 */\
+mul(t[11], t[8], t[5]);             /*   11: 13 */\
+mul(t[3], t[15], t[5]);             /*   12: 15 */\
+mul(t[12], t[11], t[5]);            /*   13: 17 */\
+sqr(t[0], t[4]);                    /*   14: 1a */\
+mul(t[14], t[12], t[5]);            /*   15: 1b */\
+mul(t[6], t[0], t[9]);              /*   16: 1d */\
+mul(t[5], t[0], t[2]);              /*   17: 1f */\
+/* sqr(t[0], t[0]); */              /*   18: 34 */\
+/* sqr(t[0], t[0]); */              /*   19: 68 */\
+/* sqr(t[0], t[0]); */              /*   20: d0 */\
+/* sqr(t[0], t[0]); */              /*   21: 1a0 */\
+/* sqr(t[0], t[0]); */              /*   22: 340 */\
+/* sqr(t[0], t[0]); */              /*   23: 680 */\
+/* sqr(t[0], t[0]); */              /*   24: d00 */\
+/* sqr(t[0], t[0]); */              /*   25: 1a00 */\
+/* sqr(t[0], t[0]); */              /*   26: 3400 */\
+/* sqr(t[0], t[0]); */              /*   27: 6800 */\
+/* sqr(t[0], t[0]); */              /*   28: d000 */\
+/* sqr(t[0], t[0]); */              /*   29: 1a000 */\
+sqr_n_mul(t[0], t[0], 12, t[15]);   /*   30: 1a011 */\
+/* sqr(t[0], t[0]); */              /*   31: 34022 */\
+/* sqr(t[0], t[0]); */              /*   32: 68044 */\
+/* sqr(t[0], t[0]); */              /*   33: d0088 */\
+/* sqr(t[0], t[0]); */              /*   34: 1a0110 */\
+/* sqr(t[0], t[0]); */              /*   35: 340220 */\
+/* sqr(t[0], t[0]); */              /*   36: 680440 */\
+/* sqr(t[0], t[0]); */              /*   37: d00880 */\
+sqr_n_mul(t[0], t[0], 7, t[8]);     /*   38: d0088f */\
+/* sqr(t[0], t[0]); */              /*   39: 1a0111e */\
+/* sqr(t[0], t[0]); */              /*   40: 340223c */\
+/* sqr(t[0], t[0]); */              /*   41: 6804478 */\
+/* sqr(t[0], t[0]); */              /*   42: d0088f0 */\
+sqr_n_mul(t[0], t[0], 4, t[2]);     /*   43: d0088f5 */\
+/* sqr(t[0], t[0]); */              /*   44: 1a0111ea */\
+/* sqr(t[0], t[0]); */              /*   45: 340223d4 */\
+/* sqr(t[0], t[0]); */              /*   46: 680447a8 */\
+/* sqr(t[0], t[0]); */              /*   47: d0088f50 */\
+/* sqr(t[0], t[0]); */              /*   48: 1a0111ea0 */\
+/* sqr(t[0], t[0]); */              /*   49: 340223d40 */\
+sqr_n_mul(t[0], t[0], 6, t[7]);     /*   50: 340223d47 */\
+/* sqr(t[0], t[0]); */              /*   51: 680447a8e */\
+/* sqr(t[0], t[0]); */              /*   52: d0088f51c */\
+/* sqr(t[0], t[0]); */              /*   53: 1a0111ea38 */\
+/* sqr(t[0], t[0]); */              /*   54: 340223d470 */\
+/* sqr(t[0], t[0]); */              /*   55: 680447a8e0 */\
+/* sqr(t[0], t[0]); */              /*   56: d0088f51c0 */\
+/* sqr(t[0], t[0]); */              /*   57: 1a0111ea380 */\
+sqr_n_mul(t[0], t[0], 7, t[12]);    /*   58: 1a0111ea397 */\
+/* sqr(t[0], t[0]); */              /*   59: 340223d472e */\
+/* sqr(t[0], t[0]); */              /*   60: 680447a8e5c */\
+/* sqr(t[0], t[0]); */              /*   61: d0088f51cb8 */\
+/* sqr(t[0], t[0]); */              /*   62: 1a0111ea3970 */\
+/* sqr(t[0], t[0]); */              /*   63: 340223d472e0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*   64: 340223d472ff */\
+/* sqr(t[0], t[0]); */              /*   65: 680447a8e5fe */\
+/* sqr(t[0], t[0]); */              /*   66: d0088f51cbfc */\
+sqr_n_mul(t[0], t[0], 2, t[9]);     /*   67: d0088f51cbff */\
+/* sqr(t[0], t[0]); */              /*   68: 1a0111ea397fe */\
+/* sqr(t[0], t[0]); */              /*   69: 340223d472ffc */\
+/* sqr(t[0], t[0]); */              /*   70: 680447a8e5ff8 */\
+/* sqr(t[0], t[0]); */              /*   71: d0088f51cbff0 */\
+/* sqr(t[0], t[0]); */              /*   72: 1a0111ea397fe0 */\
+/* sqr(t[0], t[0]); */              /*   73: 340223d472ffc0 */\
+sqr_n_mul(t[0], t[0], 6, t[4]);     /*   74: 340223d472ffcd */\
+/* sqr(t[0], t[0]); */              /*   75: 680447a8e5ff9a */\
+/* sqr(t[0], t[0]); */              /*   76: d0088f51cbff34 */\
+/* sqr(t[0], t[0]); */              /*   77: 1a0111ea397fe68 */\
+/* sqr(t[0], t[0]); */              /*   78: 340223d472ffcd0 */\
+/* sqr(t[0], t[0]); */              /*   79: 680447a8e5ff9a0 */\
+/* sqr(t[0], t[0]); */              /*   80: d0088f51cbff340 */\
+sqr_n_mul(t[0], t[0], 6, t[4]);     /*   81: d0088f51cbff34d */\
+/* sqr(t[0], t[0]); */              /*   82: 1a0111ea397fe69a */\
+/* sqr(t[0], t[0]); */              /*   83: 340223d472ffcd34 */\
+/* sqr(t[0], t[0]); */              /*   84: 680447a8e5ff9a68 */\
+/* sqr(t[0], t[0]); */              /*   85: d0088f51cbff34d0 */\
+/* sqr(t[0], t[0]); */              /*   86: 1a0111ea397fe69a0 */\
+/* sqr(t[0], t[0]); */              /*   87: 340223d472ffcd340 */\
+sqr_n_mul(t[0], t[0], 6, t[10]);    /*   88: 340223d472ffcd349 */\
+/* sqr(t[0], t[0]); */              /*   89: 680447a8e5ff9a692 */\
+/* sqr(t[0], t[0]); */              /*   90: d0088f51cbff34d24 */\
+/* sqr(t[0], t[0]); */              /*   91: 1a0111ea397fe69a48 */\
+sqr_n_mul(t[0], t[0], 3, t[9]);     /*   92: 1a0111ea397fe69a4b */\
+/* sqr(t[0], t[0]); */              /*   93: 340223d472ffcd3496 */\
+/* sqr(t[0], t[0]); */              /*   94: 680447a8e5ff9a692c */\
+/* sqr(t[0], t[0]); */              /*   95: d0088f51cbff34d258 */\
+/* sqr(t[0], t[0]); */              /*   96: 1a0111ea397fe69a4b0 */\
+/* sqr(t[0], t[0]); */              /*   97: 340223d472ffcd34960 */\
+/* sqr(t[0], t[0]); */              /*   98: 680447a8e5ff9a692c0 */\
+/* sqr(t[0], t[0]); */              /*   99: d0088f51cbff34d2580 */\
+sqr_n_mul(t[0], t[0], 7, t[4]);     /*  100: d0088f51cbff34d258d */\
+/* sqr(t[0], t[0]); */              /*  101: 1a0111ea397fe69a4b1a */\
+/* sqr(t[0], t[0]); */              /*  102: 340223d472ffcd349634 */\
+/* sqr(t[0], t[0]); */              /*  103: 680447a8e5ff9a692c68 */\
+/* sqr(t[0], t[0]); */              /*  104: d0088f51cbff34d258d0 */\
+sqr_n_mul(t[0], t[0], 4, t[4]);     /*  105: d0088f51cbff34d258dd */\
+/* sqr(t[0], t[0]); */              /*  106: 1a0111ea397fe69a4b1ba */\
+/* sqr(t[0], t[0]); */              /*  107: 340223d472ffcd3496374 */\
+/* sqr(t[0], t[0]); */              /*  108: 680447a8e5ff9a692c6e8 */\
+/* sqr(t[0], t[0]); */              /*  109: d0088f51cbff34d258dd0 */\
+/* sqr(t[0], t[0]); */              /*  110: 1a0111ea397fe69a4b1ba0 */\
+/* sqr(t[0], t[0]); */              /*  111: 340223d472ffcd34963740 */\
+sqr_n_mul(t[0], t[0], 6, t[8]);     /*  112: 340223d472ffcd3496374f */\
+/* sqr(t[0], t[0]); */              /*  113: 680447a8e5ff9a692c6e9e */\
+/* sqr(t[0], t[0]); */              /*  114: d0088f51cbff34d258dd3c */\
+/* sqr(t[0], t[0]); */              /*  115: 1a0111ea397fe69a4b1ba78 */\
+/* sqr(t[0], t[0]); */              /*  116: 340223d472ffcd3496374f0 */\
+/* sqr(t[0], t[0]); */              /*  117: 680447a8e5ff9a692c6e9e0 */\
+/* sqr(t[0], t[0]); */              /*  118: d0088f51cbff34d258dd3c0 */\
+sqr_n_mul(t[0], t[0], 6, t[14]);    /*  119: d0088f51cbff34d258dd3db */\
+/* sqr(t[0], t[0]); */              /*  120: 1a0111ea397fe69a4b1ba7b6 */\
+/* sqr(t[0], t[0]); */              /*  121: 340223d472ffcd3496374f6c */\
+/* sqr(t[0], t[0]); */              /*  122: 680447a8e5ff9a692c6e9ed8 */\
+sqr_n_mul(t[0], t[0], 3, t[1]);     /*  123: 680447a8e5ff9a692c6e9ed9 */\
+/* sqr(t[0], t[0]); */              /*  124: d0088f51cbff34d258dd3db2 */\
+/* sqr(t[0], t[0]); */              /*  125: 1a0111ea397fe69a4b1ba7b64 */\
+/* sqr(t[0], t[0]); */              /*  126: 340223d472ffcd3496374f6c8 */\
+/* sqr(t[0], t[0]); */              /*  127: 680447a8e5ff9a692c6e9ed90 */\
+/* sqr(t[0], t[0]); */              /*  128: d0088f51cbff34d258dd3db20 */\
+/* sqr(t[0], t[0]); */              /*  129: 1a0111ea397fe69a4b1ba7b640 */\
+/* sqr(t[0], t[0]); */              /*  130: 340223d472ffcd3496374f6c80 */\
+/* sqr(t[0], t[0]); */              /*  131: 680447a8e5ff9a692c6e9ed900 */\
+sqr_n_mul(t[0], t[0], 8, t[4]);     /*  132: 680447a8e5ff9a692c6e9ed90d */\
+/* sqr(t[0], t[0]); */              /*  133: d0088f51cbff34d258dd3db21a */\
+/* sqr(t[0], t[0]); */              /*  134: 1a0111ea397fe69a4b1ba7b6434 */\
+/* sqr(t[0], t[0]); */              /*  135: 340223d472ffcd3496374f6c868 */\
+/* sqr(t[0], t[0]); */              /*  136: 680447a8e5ff9a692c6e9ed90d0 */\
+/* sqr(t[0], t[0]); */              /*  137: d0088f51cbff34d258dd3db21a0 */\
+/* sqr(t[0], t[0]); */              /*  138: 1a0111ea397fe69a4b1ba7b64340 */\
+/* sqr(t[0], t[0]); */              /*  139: 340223d472ffcd3496374f6c8680 */\
+sqr_n_mul(t[0], t[0], 7, t[12]);    /*  140: 340223d472ffcd3496374f6c8697 */\
+/* sqr(t[0], t[0]); */              /*  141: 680447a8e5ff9a692c6e9ed90d2e */\
+/* sqr(t[0], t[0]); */              /*  142: d0088f51cbff34d258dd3db21a5c */\
+/* sqr(t[0], t[0]); */              /*  143: 1a0111ea397fe69a4b1ba7b6434b8 */\
+/* sqr(t[0], t[0]); */              /*  144: 340223d472ffcd3496374f6c86970 */\
+/* sqr(t[0], t[0]); */              /*  145: 680447a8e5ff9a692c6e9ed90d2e0 */\
+sqr_n_mul(t[0], t[0], 5, t[13]);    /*  146: 680447a8e5ff9a692c6e9ed90d2eb */\
+/* sqr(t[0], t[0]); */              /*  147: d0088f51cbff34d258dd3db21a5d6 */\
+/* sqr(t[0], t[0]); */              /*  148: 1a0111ea397fe69a4b1ba7b6434bac */\
+/* sqr(t[0], t[0]); */              /*  149: 340223d472ffcd3496374f6c869758 */\
+/* sqr(t[0], t[0]); */              /*  150: 680447a8e5ff9a692c6e9ed90d2eb0 */\
+/* sqr(t[0], t[0]); */              /*  151: d0088f51cbff34d258dd3db21a5d60 */\
+/* sqr(t[0], t[0]); */              /*  152: 1a0111ea397fe69a4b1ba7b6434bac0 */\
+sqr_n_mul(t[0], t[0], 6, t[4]);     /*  153: 1a0111ea397fe69a4b1ba7b6434bacd */\
+/* sqr(t[0], t[0]); */              /*  154: 340223d472ffcd3496374f6c869759a */\
+/* sqr(t[0], t[0]); */              /*  155: 680447a8e5ff9a692c6e9ed90d2eb34 */\
+/* sqr(t[0], t[0]); */              /*  156: d0088f51cbff34d258dd3db21a5d668 */\
+/* sqr(t[0], t[0]); */              /*  157: 1a0111ea397fe69a4b1ba7b6434bacd0 */\
+/* sqr(t[0], t[0]); */              /*  158: 340223d472ffcd3496374f6c869759a0 */\
+/* sqr(t[0], t[0]); */              /*  159: 680447a8e5ff9a692c6e9ed90d2eb340 */\
+sqr_n_mul(t[0], t[0], 6, t[6]);     /*  160: 680447a8e5ff9a692c6e9ed90d2eb35d */\
+/* sqr(t[0], t[0]); */              /*  161: d0088f51cbff34d258dd3db21a5d66ba */\
+/* sqr(t[0], t[0]); */              /*  162: 1a0111ea397fe69a4b1ba7b6434bacd74 */\
+/* sqr(t[0], t[0]); */              /*  163: 340223d472ffcd3496374f6c869759ae8 */\
+/* sqr(t[0], t[0]); */              /*  164: 680447a8e5ff9a692c6e9ed90d2eb35d0 */\
+sqr_n_mul(t[0], t[0], 4, t[10]);    /*  165: 680447a8e5ff9a692c6e9ed90d2eb35d9 */\
+/* sqr(t[0], t[0]); */              /*  166: d0088f51cbff34d258dd3db21a5d66bb2 */\
+/* sqr(t[0], t[0]); */              /*  167: 1a0111ea397fe69a4b1ba7b6434bacd764 */\
+/* sqr(t[0], t[0]); */              /*  168: 340223d472ffcd3496374f6c869759aec8 */\
+/* sqr(t[0], t[0]); */              /*  169: 680447a8e5ff9a692c6e9ed90d2eb35d90 */\
+/* sqr(t[0], t[0]); */              /*  170: d0088f51cbff34d258dd3db21a5d66bb20 */\
+/* sqr(t[0], t[0]); */              /*  171: 1a0111ea397fe69a4b1ba7b6434bacd7640 */\
+/* sqr(t[0], t[0]); */              /*  172: 340223d472ffcd3496374f6c869759aec80 */\
+/* sqr(t[0], t[0]); */              /*  173: 680447a8e5ff9a692c6e9ed90d2eb35d900 */\
+sqr_n_mul(t[0], t[0], 8, t[6]);     /*  174: 680447a8e5ff9a692c6e9ed90d2eb35d91d */\
+/* sqr(t[0], t[0]); */              /*  175: d0088f51cbff34d258dd3db21a5d66bb23a */\
+/* sqr(t[0], t[0]); */              /*  176: 1a0111ea397fe69a4b1ba7b6434bacd76474 */\
+/* sqr(t[0], t[0]); */              /*  177: 340223d472ffcd3496374f6c869759aec8e8 */\
+/* sqr(t[0], t[0]); */              /*  178: 680447a8e5ff9a692c6e9ed90d2eb35d91d0 */\
+sqr_n_mul(t[0], t[0], 4, t[4]);     /*  179: 680447a8e5ff9a692c6e9ed90d2eb35d91dd */\
+/* sqr(t[0], t[0]); */              /*  180: d0088f51cbff34d258dd3db21a5d66bb23ba */\
+/* sqr(t[0], t[0]); */              /*  181: 1a0111ea397fe69a4b1ba7b6434bacd764774 */\
+/* sqr(t[0], t[0]); */              /*  182: 340223d472ffcd3496374f6c869759aec8ee8 */\
+/* sqr(t[0], t[0]); */              /*  183: 680447a8e5ff9a692c6e9ed90d2eb35d91dd0 */\
+/* sqr(t[0], t[0]); */              /*  184: d0088f51cbff34d258dd3db21a5d66bb23ba0 */\
+/* sqr(t[0], t[0]); */              /*  185: 1a0111ea397fe69a4b1ba7b6434bacd7647740 */\
+/* sqr(t[0], t[0]); */              /*  186: 340223d472ffcd3496374f6c869759aec8ee80 */\
+sqr_n_mul(t[0], t[0], 7, t[12]);    /*  187: 340223d472ffcd3496374f6c869759aec8ee97 */\
+/* sqr(t[0], t[0]); */              /*  188: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e */\
+/* sqr(t[0], t[0]); */              /*  189: d0088f51cbff34d258dd3db21a5d66bb23ba5c */\
+/* sqr(t[0], t[0]); */              /*  190: 1a0111ea397fe69a4b1ba7b6434bacd764774b8 */\
+/* sqr(t[0], t[0]); */              /*  191: 340223d472ffcd3496374f6c869759aec8ee970 */\
+/* sqr(t[0], t[0]); */              /*  192: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e0 */\
+/* sqr(t[0], t[0]); */              /*  193: d0088f51cbff34d258dd3db21a5d66bb23ba5c0 */\
+/* sqr(t[0], t[0]); */              /*  194: 1a0111ea397fe69a4b1ba7b6434bacd764774b80 */\
+/* sqr(t[0], t[0]); */              /*  195: 340223d472ffcd3496374f6c869759aec8ee9700 */\
+/* sqr(t[0], t[0]); */              /*  196: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e00 */\
+sqr_n_mul(t[0], t[0], 9, t[11]);    /*  197: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13 */\
+/* sqr(t[0], t[0]); */              /*  198: d0088f51cbff34d258dd3db21a5d66bb23ba5c26 */\
+/* sqr(t[0], t[0]); */              /*  199: 1a0111ea397fe69a4b1ba7b6434bacd764774b84c */\
+sqr_n_mul(t[0], t[0], 2, t[9]);     /*  200: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f */\
+/* sqr(t[0], t[0]); */              /*  201: 340223d472ffcd3496374f6c869759aec8ee9709e */\
+/* sqr(t[0], t[0]); */              /*  202: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13c */\
+/* sqr(t[0], t[0]); */              /*  203: d0088f51cbff34d258dd3db21a5d66bb23ba5c278 */\
+/* sqr(t[0], t[0]); */              /*  204: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f0 */\
+/* sqr(t[0], t[0]); */              /*  205: 340223d472ffcd3496374f6c869759aec8ee9709e0 */\
+sqr_n_mul(t[0], t[0], 5, t[7]);     /*  206: 340223d472ffcd3496374f6c869759aec8ee9709e7 */\
+/* sqr(t[0], t[0]); */              /*  207: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce */\
+/* sqr(t[0], t[0]); */              /*  208: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c */\
+/* sqr(t[0], t[0]); */              /*  209: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38 */\
+/* sqr(t[0], t[0]); */              /*  210: 340223d472ffcd3496374f6c869759aec8ee9709e70 */\
+/* sqr(t[0], t[0]); */              /*  211: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce0 */\
+/* sqr(t[0], t[0]); */              /*  212: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c0 */\
+/* sqr(t[0], t[0]); */              /*  213: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f380 */\
+sqr_n_mul(t[0], t[0], 7, t[2]);     /*  214: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f385 */\
+/* sqr(t[0], t[0]); */              /*  215: 340223d472ffcd3496374f6c869759aec8ee9709e70a */\
+/* sqr(t[0], t[0]); */              /*  216: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce14 */\
+/* sqr(t[0], t[0]); */              /*  217: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c28 */\
+/* sqr(t[0], t[0]); */              /*  218: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f3850 */\
+/* sqr(t[0], t[0]); */              /*  219: 340223d472ffcd3496374f6c869759aec8ee9709e70a0 */\
+/* sqr(t[0], t[0]); */              /*  220: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce140 */\
+/* sqr(t[0], t[0]); */              /*  221: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c280 */\
+sqr_n_mul(t[0], t[0], 7, t[10]);    /*  222: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c289 */\
+/* sqr(t[0], t[0]); */              /*  223: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512 */\
+/* sqr(t[0], t[0]); */              /*  224: 340223d472ffcd3496374f6c869759aec8ee9709e70a24 */\
+/* sqr(t[0], t[0]); */              /*  225: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce1448 */\
+/* sqr(t[0], t[0]); */              /*  226: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2890 */\
+/* sqr(t[0], t[0]); */              /*  227: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f385120 */\
+/* sqr(t[0], t[0]); */              /*  228: 340223d472ffcd3496374f6c869759aec8ee9709e70a240 */\
+sqr_n_mul(t[0], t[0], 6, t[12]);    /*  229: 340223d472ffcd3496374f6c869759aec8ee9709e70a257 */\
+/* sqr(t[0], t[0]); */              /*  230: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144ae */\
+/* sqr(t[0], t[0]); */              /*  231: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895c */\
+/* sqr(t[0], t[0]); */              /*  232: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512b8 */\
+/* sqr(t[0], t[0]); */              /*  233: 340223d472ffcd3496374f6c869759aec8ee9709e70a2570 */\
+/* sqr(t[0], t[0]); */              /*  234: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144ae0 */\
+sqr_n_mul(t[0], t[0], 5, t[6]);     /*  235: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd */\
+/* sqr(t[0], t[0]); */              /*  236: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fa */\
+/* sqr(t[0], t[0]); */              /*  237: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf4 */\
+/* sqr(t[0], t[0]); */              /*  238: 340223d472ffcd3496374f6c869759aec8ee9709e70a257e8 */\
+/* sqr(t[0], t[0]); */              /*  239: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd0 */\
+/* sqr(t[0], t[0]); */              /*  240: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fa0 */\
+sqr_n_mul(t[0], t[0], 5, t[11]);    /*  241: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb3 */\
+/* sqr(t[0], t[0]); */              /*  242: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf66 */\
+/* sqr(t[0], t[0]); */              /*  243: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ecc */\
+/* sqr(t[0], t[0]); */              /*  244: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd98 */\
+/* sqr(t[0], t[0]); */              /*  245: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb30 */\
+/* sqr(t[0], t[0]); */              /*  246: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf660 */\
+sqr_n_mul(t[0], t[0], 5, t[11]);    /*  247: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf673 */\
+/* sqr(t[0], t[0]); */              /*  248: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece6 */\
+/* sqr(t[0], t[0]); */              /*  249: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc */\
+/* sqr(t[0], t[0]); */              /*  250: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb398 */\
+/* sqr(t[0], t[0]); */              /*  251: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730 */\
+/* sqr(t[0], t[0]); */              /*  252: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece60 */\
+/* sqr(t[0], t[0]); */              /*  253: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc0 */\
+/* sqr(t[0], t[0]); */              /*  254: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb3980 */\
+/* sqr(t[0], t[0]); */              /*  255: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf67300 */\
+sqr_n_mul(t[0], t[0], 8, t[4]);     /*  256: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d */\
+/* sqr(t[0], t[0]); */              /*  257: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a */\
+/* sqr(t[0], t[0]); */              /*  258: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34 */\
+/* sqr(t[0], t[0]); */              /*  259: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39868 */\
+/* sqr(t[0], t[0]); */              /*  260: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d0 */\
+/* sqr(t[0], t[0]); */              /*  261: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a0 */\
+/* sqr(t[0], t[0]); */              /*  262: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc340 */\
+/* sqr(t[0], t[0]); */              /*  263: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb398680 */\
+sqr_n_mul(t[0], t[0], 7, t[3]);     /*  264: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb398695 */\
+/* sqr(t[0], t[0]); */              /*  265: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a */\
+/* sqr(t[0], t[0]); */              /*  266: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a54 */\
+/* sqr(t[0], t[0]); */              /*  267: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a8 */\
+/* sqr(t[0], t[0]); */              /*  268: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb3986950 */\
+/* sqr(t[0], t[0]); */              /*  269: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0 */\
+/* sqr(t[0], t[0]); */              /*  270: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a540 */\
+/* sqr(t[0], t[0]); */              /*  271: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a80 */\
+/* sqr(t[0], t[0]); */              /*  272: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869500 */\
+/* sqr(t[0], t[0]); */              /*  273: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a00 */\
+sqr_n_mul(t[0], t[0], 9, t[8]);     /*  274: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f */\
+/* sqr(t[0], t[0]); */              /*  275: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541e */\
+/* sqr(t[0], t[0]); */              /*  276: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83c */\
+/* sqr(t[0], t[0]); */              /*  277: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb398695078 */\
+/* sqr(t[0], t[0]); */              /*  278: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f0 */\
+/* sqr(t[0], t[0]); */              /*  279: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541e0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  280: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed */\
+/* sqr(t[0], t[0]); */              /*  281: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83da */\
+/* sqr(t[0], t[0]); */              /*  282: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b4 */\
+/* sqr(t[0], t[0]); */              /*  283: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f68 */\
+sqr_n_mul(t[0], t[0], 3, t[9]);     /*  284: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b */\
+/* sqr(t[0], t[0]); */              /*  285: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed6 */\
+/* sqr(t[0], t[0]); */              /*  286: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac */\
+/* sqr(t[0], t[0]); */              /*  287: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b58 */\
+/* sqr(t[0], t[0]); */              /*  288: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0 */\
+/* sqr(t[0], t[0]); */              /*  289: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed60 */\
+/* sqr(t[0], t[0]); */              /*  290: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac0 */\
+/* sqr(t[0], t[0]); */              /*  291: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b580 */\
+/* sqr(t[0], t[0]); */              /*  292: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b00 */\
+sqr_n_mul(t[0], t[0], 8, t[8]);     /*  293: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f */\
+/* sqr(t[0], t[0]); */              /*  294: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61e */\
+/* sqr(t[0], t[0]); */              /*  295: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3c */\
+/* sqr(t[0], t[0]); */              /*  296: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b5878 */\
+sqr_n_mul(t[0], t[0], 3, t[9]);     /*  297: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b */\
+/* sqr(t[0], t[0]); */              /*  298: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6 */\
+/* sqr(t[0], t[0]); */              /*  299: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec */\
+/* sqr(t[0], t[0]); */              /*  300: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8 */\
+/* sqr(t[0], t[0]); */              /*  301: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b0 */\
+/* sqr(t[0], t[0]); */              /*  302: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f60 */\
+/* sqr(t[0], t[0]); */              /*  303: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec0 */\
+/* sqr(t[0], t[0]); */              /*  304: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d80 */\
+sqr_n_mul(t[0], t[0], 7, t[10]);    /*  305: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d89 */\
+/* sqr(t[0], t[0]); */              /*  306: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b12 */\
+/* sqr(t[0], t[0]); */              /*  307: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f624 */\
+/* sqr(t[0], t[0]); */              /*  308: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec48 */\
+/* sqr(t[0], t[0]); */              /*  309: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d890 */\
+/* sqr(t[0], t[0]); */              /*  310: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120 */\
+/* sqr(t[0], t[0]); */              /*  311: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6240 */\
+/* sqr(t[0], t[0]); */              /*  312: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec480 */\
+/* sqr(t[0], t[0]); */              /*  313: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8900 */\
+/* sqr(t[0], t[0]); */              /*  314: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b1200 */\
+sqr_n_mul(t[0], t[0], 9, t[8]);     /*  315: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f */\
+/* sqr(t[0], t[0]); */              /*  316: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241e */\
+/* sqr(t[0], t[0]); */              /*  317: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483c */\
+/* sqr(t[0], t[0]); */              /*  318: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d89078 */\
+/* sqr(t[0], t[0]); */              /*  319: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f0 */\
+/* sqr(t[0], t[0]); */              /*  320: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241e0 */\
+/* sqr(t[0], t[0]); */              /*  321: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483c0 */\
+sqr_n_mul(t[0], t[0], 6, t[3]);     /*  322: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d5 */\
+/* sqr(t[0], t[0]); */              /*  323: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aa */\
+/* sqr(t[0], t[0]); */              /*  324: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f54 */\
+/* sqr(t[0], t[0]); */              /*  325: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241ea8 */\
+/* sqr(t[0], t[0]); */              /*  326: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d50 */\
+/* sqr(t[0], t[0]); */              /*  327: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aa0 */\
+/* sqr(t[0], t[0]); */              /*  328: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f540 */\
+sqr_n_mul(t[0], t[0], 6, t[5]);     /*  329: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55f */\
+/* sqr(t[0], t[0]); */              /*  330: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabe */\
+/* sqr(t[0], t[0]); */              /*  331: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57c */\
+/* sqr(t[0], t[0]); */              /*  332: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaf8 */\
+/* sqr(t[0], t[0]); */              /*  333: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55f0 */\
+/* sqr(t[0], t[0]); */              /*  334: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabe0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  335: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabff */\
+/* sqr(t[0], t[0]); */              /*  336: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fe */\
+/* sqr(t[0], t[0]); */              /*  337: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffc */\
+/* sqr(t[0], t[0]); */              /*  338: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ff8 */\
+/* sqr(t[0], t[0]); */              /*  339: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabff0 */\
+/* sqr(t[0], t[0]); */              /*  340: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fe0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  341: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fff */\
+/* sqr(t[0], t[0]); */              /*  342: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aafffe */\
+/* sqr(t[0], t[0]); */              /*  343: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55fffc */\
+/* sqr(t[0], t[0]); */              /*  344: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfff8 */\
+/* sqr(t[0], t[0]); */              /*  345: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fff0 */\
+sqr_n_mul(t[0], t[0], 4, t[4]);     /*  346: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd */\
+/* sqr(t[0], t[0]); */              /*  347: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffa */\
+/* sqr(t[0], t[0]); */              /*  348: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff4 */\
+/* sqr(t[0], t[0]); */              /*  349: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffe8 */\
+sqr_n_mul(t[0], t[0], 3, t[9]);     /*  350: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb */\
+/* sqr(t[0], t[0]); */              /*  351: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd6 */\
+/* sqr(t[0], t[0]); */              /*  352: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac */\
+/* sqr(t[0], t[0]); */              /*  353: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58 */\
+/* sqr(t[0], t[0]); */              /*  354: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb0 */\
+/* sqr(t[0], t[0]); */              /*  355: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd60 */\
+/* sqr(t[0], t[0]); */              /*  356: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac0 */\
+/* sqr(t[0], t[0]); */              /*  357: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff580 */\
+/* sqr(t[0], t[0]); */              /*  358: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb00 */\
+sqr_n_mul(t[0], t[0], 8, t[3]);     /*  359: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb15 */\
+/* sqr(t[0], t[0]); */              /*  360: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a */\
+/* sqr(t[0], t[0]); */              /*  361: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54 */\
+/* sqr(t[0], t[0]); */              /*  362: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a8 */\
+/* sqr(t[0], t[0]); */              /*  363: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb150 */\
+/* sqr(t[0], t[0]); */              /*  364: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a0 */\
+/* sqr(t[0], t[0]); */              /*  365: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac540 */\
+/* sqr(t[0], t[0]); */              /*  366: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a80 */\
+sqr_n_mul(t[0], t[0], 7, t[5]);     /*  367: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9f */\
+/* sqr(t[0], t[0]); */              /*  368: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153e */\
+/* sqr(t[0], t[0]); */              /*  369: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7c */\
+/* sqr(t[0], t[0]); */              /*  370: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54f8 */\
+/* sqr(t[0], t[0]); */              /*  371: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9f0 */\
+/* sqr(t[0], t[0]); */              /*  372: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153e0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  373: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ff */\
+/* sqr(t[0], t[0]); */              /*  374: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7fe */\
+/* sqr(t[0], t[0]); */              /*  375: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffc */\
+/* sqr(t[0], t[0]); */              /*  376: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ff8 */\
+/* sqr(t[0], t[0]); */              /*  377: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ff0 */\
+/* sqr(t[0], t[0]); */              /*  378: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7fe0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  379: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7fff */\
+/* sqr(t[0], t[0]); */              /*  380: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54fffe */\
+/* sqr(t[0], t[0]); */              /*  381: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9fffc */\
+/* sqr(t[0], t[0]); */              /*  382: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153fff8 */\
+/* sqr(t[0], t[0]); */              /*  383: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7fff0 */\
+sqr_n_mul(t[0], t[0], 4, t[8]);     /*  384: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff */\
+/* sqr(t[0], t[0]); */              /*  385: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffe */\
+/* sqr(t[0], t[0]); */              /*  386: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffc */\
+/* sqr(t[0], t[0]); */              /*  387: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffff8 */\
+/* sqr(t[0], t[0]); */              /*  388: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff0 */\
+sqr_n_mul(t[0], t[0], 4, t[7]);     /*  389: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff7 */\
+/* sqr(t[0], t[0]); */              /*  390: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee */\
+/* sqr(t[0], t[0]); */              /*  391: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdc */\
+/* sqr(t[0], t[0]); */              /*  392: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb8 */\
+/* sqr(t[0], t[0]); */              /*  393: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff70 */\
+/* sqr(t[0], t[0]); */              /*  394: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee0 */\
+/* sqr(t[0], t[0]); */              /*  395: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdc0 */\
+/* sqr(t[0], t[0]); */              /*  396: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb80 */\
+sqr_n_mul(t[0], t[0], 7, t[5]);     /*  397: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9f */\
+/* sqr(t[0], t[0]); */              /*  398: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73e */\
+/* sqr(t[0], t[0]); */              /*  399: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7c */\
+/* sqr(t[0], t[0]); */              /*  400: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcf8 */\
+/* sqr(t[0], t[0]); */              /*  401: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9f0 */\
+/* sqr(t[0], t[0]); */              /*  402: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73e0 */\
+sqr_n_mul(t[0], t[0], 5, t[6]);     /*  403: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fd */\
+/* sqr(t[0], t[0]); */              /*  404: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fa */\
+/* sqr(t[0], t[0]); */              /*  405: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff4 */\
+/* sqr(t[0], t[0]); */              /*  406: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9fe8 */\
+/* sqr(t[0], t[0]); */              /*  407: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fd0 */\
+/* sqr(t[0], t[0]); */              /*  408: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fa0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  409: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbf */\
+/* sqr(t[0], t[0]); */              /*  410: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7e */\
+/* sqr(t[0], t[0]); */              /*  411: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9fefc */\
+/* sqr(t[0], t[0]); */              /*  412: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdf8 */\
+/* sqr(t[0], t[0]); */              /*  413: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbf0 */\
+/* sqr(t[0], t[0]); */              /*  414: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7e0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  415: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7ff */\
+/* sqr(t[0], t[0]); */              /*  416: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffe */\
+/* sqr(t[0], t[0]); */              /*  417: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffc */\
+/* sqr(t[0], t[0]); */              /*  418: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbff8 */\
+/* sqr(t[0], t[0]); */              /*  419: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7ff0 */\
+/* sqr(t[0], t[0]); */              /*  420: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffe0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  421: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffff */\
+/* sqr(t[0], t[0]); */              /*  422: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdfffe */\
+/* sqr(t[0], t[0]); */              /*  423: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbfffc */\
+/* sqr(t[0], t[0]); */              /*  424: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fff8 */\
+/* sqr(t[0], t[0]); */              /*  425: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffff0 */\
+/* sqr(t[0], t[0]); */              /*  426: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdfffe0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  427: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdfffff */\
+/* sqr(t[0], t[0]); */              /*  428: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbffffe */\
+/* sqr(t[0], t[0]); */              /*  429: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7ffffc */\
+/* sqr(t[0], t[0]); */              /*  430: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9fefffff8 */\
+/* sqr(t[0], t[0]); */              /*  431: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdfffff0 */\
+/* sqr(t[0], t[0]); */              /*  432: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbffffe0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  433: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbffffff */\
+/* sqr(t[0], t[0]); */              /*  434: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffe */\
+/* sqr(t[0], t[0]); */              /*  435: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffc */\
+/* sqr(t[0], t[0]); */              /*  436: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffff8 */\
+/* sqr(t[0], t[0]); */              /*  437: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbffffff0 */\
+/* sqr(t[0], t[0]); */              /*  438: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffe0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  439: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffff */\
+/* sqr(t[0], t[0]); */              /*  440: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9fefffffffe */\
+/* sqr(t[0], t[0]); */              /*  441: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdfffffffc */\
+/* sqr(t[0], t[0]); */              /*  442: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbfffffff8 */\
+/* sqr(t[0], t[0]); */              /*  443: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffff0 */\
+sqr_n_mul(t[0], t[0], 4, t[4]);     /*  444: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd */\
+/* sqr(t[0], t[0]); */              /*  445: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa */\
+/* sqr(t[0], t[0]); */              /*  446: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffffff4 */\
+/* sqr(t[0], t[0]); */              /*  447: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbfffffffe8 */\
+/* sqr(t[0], t[0]); */              /*  448: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd0 */\
+/* sqr(t[0], t[0]); */              /*  449: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa0 */\
+/* sqr(t[0], t[0]); */              /*  450: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffffff40 */\
+sqr_n_mul(t[0], t[0], 6, t[3]);     /*  451: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffffff55 */\
+/* sqr(t[0], t[0]); */              /*  452: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbfffffffeaa */\
+/* sqr(t[0], t[0]); */              /*  453: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd54 */\
+/* sqr(t[0], t[0]); */              /*  454: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa8 */\
+/* sqr(t[0], t[0]); */              /*  455: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffffff550 */\
+sqr_n_mul(t[0], t[0], 4, t[2]);     /*  456: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffffff555 */\
+/* sqr(t[0], t[0]); */              /*  457: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbfffffffeaaa */\
+/* sqr(t[0], t[0]); */              /*  458: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd554 */\
+/* sqr(t[0], t[0]); */              /*  459: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaa8 */\
+sqr_n_mul(out, t[0], 3, t[1]);      /*  460: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaa9 */\
+} while(0)
diff --git a/vendor/external/blst/src/recip.c b/vendor/external/blst/src/recip.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/recip.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "fields.h"
+
+#ifdef __OPTIMIZE_SIZE__
+/*
+ * 608 multiplications for scalar inversion modulo BLS12-381 prime, 32%
+ * more than corresponding optimal addition-chain, plus mispredicted
+ * branch penalties on top of that... The addition chain below was
+ * measured to be >50% faster.
+ */
+static void flt_reciprocal_fp(vec384 out, const vec384 inp)
+{
+    static const byte BLS12_381_P_minus_2[] = {
+        TO_BYTES(0xb9feffffffffaaa9), TO_BYTES(0x1eabfffeb153ffff),
+        TO_BYTES(0x6730d2a0f6b0f624), TO_BYTES(0x64774b84f38512bf),
+        TO_BYTES(0x4b1ba7b6434bacd7), TO_BYTES(0x1a0111ea397fe69a)
+    };
+
+    exp_mont_384(out, inp, BLS12_381_P_minus_2, 381, BLS12_381_P, p0);
+}
+#else
+# define sqr(ret,a)		sqr_fp(ret,a)
+# define mul(ret,a,b)		mul_fp(ret,a,b)
+# define sqr_n_mul(ret,a,n,b)	sqr_n_mul_fp(ret,a,n,b)
+
+# include "recip-addchain.h"
+static void flt_reciprocal_fp(vec384 out, const vec384 inp)
+{
+    RECIPROCAL_MOD_BLS12_381_P(out, inp, vec384);
+}
+# undef RECIPROCAL_MOD_BLS12_381_P
+# undef sqr_n_mul
+# undef mul
+# undef sqr
+#endif
+
+static void flt_reciprocal_fp2(vec384x out, const vec384x inp)
+{
+    vec384 t0, t1;
+
+    /*
+     * |out| = 1/(a + b*i) = a/(a^2+b^2) - b/(a^2+b^2)*i
+     */
+    sqr_fp(t0, inp[0]);
+    sqr_fp(t1, inp[1]);
+    add_fp(t0, t0, t1);
+    flt_reciprocal_fp(t1, t0);
+    mul_fp(out[0], inp[0], t1);
+    mul_fp(out[1], inp[1], t1);
+    neg_fp(out[1], out[1]);
+}
+
+static void reciprocal_fp(vec384 out, const vec384 inp)
+{
+    static const vec384 Px8 = {    /* left-aligned value of the modulus */
+        TO_LIMB_T(0xcff7fffffffd5558), TO_LIMB_T(0xf55ffff58a9ffffd),
+        TO_LIMB_T(0x39869507b587b120), TO_LIMB_T(0x23ba5c279c2895fb),
+        TO_LIMB_T(0x58dd3db21a5d66bb), TO_LIMB_T(0xd0088f51cbff34d2)
+    };
+#ifdef __BLST_NO_ASM__
+# define RRx4 BLS12_381_RR
+#else
+    static const vec384 RRx4 = {   /* (4<<768)%P */
+        TO_LIMB_T(0x5f7e7cd070d107c2), TO_LIMB_T(0xec839a9ac49c13c8),
+        TO_LIMB_T(0x6933786f44f4ef0b), TO_LIMB_T(0xd6bf8b9c676be983),
+        TO_LIMB_T(0xd3adaaaa4dcefb06), TO_LIMB_T(0x12601bc1d82bc175)
+    };
+#endif
+    union { vec768 x; vec384 r[2]; } temp;
+
+    ct_inverse_mod_383(temp.x, inp, BLS12_381_P, Px8);
+    redc_mont_384(temp.r[0], temp.x, BLS12_381_P, p0);
+    mul_mont_384(temp.r[0], temp.r[0], RRx4, BLS12_381_P, p0);
+
+#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+    /* sign goes straight to flt_reciprocal */
+    mul_mont_384(temp.r[1], temp.r[0], inp, BLS12_381_P, p0);
+    if (vec_is_equal(temp.r[1],  BLS12_381_Rx.p, sizeof(vec384)) |
+        vec_is_zero(temp.r[1], sizeof(vec384)))
+        vec_copy(out, temp.r[0], sizeof(vec384));
+    else
+        flt_reciprocal_fp(out, inp);
+#else
+    vec_copy(out, temp.r[0], sizeof(vec384));
+#endif
+#undef RRx4
+}
+
+void blst_fp_inverse(vec384 out, const vec384 inp)
+{   reciprocal_fp(out, inp);   }
+
+void blst_fp_eucl_inverse(vec384 ret, const vec384 a)
+{   reciprocal_fp(ret, a);   }
+
+static void reciprocal_fp2(vec384x out, const vec384x inp)
+{
+    vec384 t0, t1;
+
+    /*
+     * |out| = 1/(a + b*i) = a/(a^2+b^2) - b/(a^2+b^2)*i
+     */
+    sqr_fp(t0, inp[0]);
+    sqr_fp(t1, inp[1]);
+    add_fp(t0, t0, t1);
+    reciprocal_fp(t1, t0);
+    mul_fp(out[0], inp[0], t1);
+    mul_fp(out[1], inp[1], t1);
+    neg_fp(out[1], out[1]);
+}
+
+void blst_fp2_inverse(vec384x out, const vec384x inp)
+{   reciprocal_fp2(out, inp);   }
+
+void blst_fp2_eucl_inverse(vec384x out, const vec384x inp)
+{   reciprocal_fp2(out, inp);   }
+
+static void reciprocal_fr(vec256 out, const vec256 inp)
+{
+    static const vec256 rx2 = { /* left-aligned value of the modulus */
+        TO_LIMB_T(0xfffffffe00000002), TO_LIMB_T(0xa77b4805fffcb7fd),
+        TO_LIMB_T(0x6673b0101343b00a), TO_LIMB_T(0xe7db4ea6533afa90),
+    };
+    vec512 temp;
+
+    ct_inverse_mod_256(temp, inp, BLS12_381_r, rx2);
+    redc_mont_256(out, temp, BLS12_381_r, r0);
+    mul_mont_sparse_256(out, out, BLS12_381_rRR, BLS12_381_r, r0);
+}
+
+void blst_fr_inverse(vec256 out, const vec256 inp)
+{   reciprocal_fr(out, inp);   }
+
+void blst_fr_eucl_inverse(vec256 out, const vec256 inp)
+{   reciprocal_fr(out, inp);   }
diff --git a/vendor/external/blst/src/server.c b/vendor/external/blst/src/server.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/server.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "keygen.c"
+#include "hash_to_field.c"
+#include "e1.c"
+#include "map_to_g1.c"
+#include "e2.c"
+#include "map_to_g2.c"
+#include "fp12_tower.c"
+#include "pairing.c"
+#include "aggregate.c"
+#include "exp.c"
+#include "sqrt.c"
+#include "recip.c"
+#include "bulk_addition.c"
+#include "multi_scalar.c"
+#include "consts.c"
+#include "vect.c"
+#include "exports.c"
+#ifndef __BLST_CGO__
+# include "rb_tree.c"
+#endif
+#ifdef BLST_FR_PENTAROOT
+# include "pentaroot.c"
+#endif
+#ifndef __BLST_NO_CPUID__
+# include "cpuid.c"
+#endif
diff --git a/vendor/external/blst/src/sha256.h b/vendor/external/blst/src/sha256.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/sha256.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __BLS12_381_ASM_SHA256_H__
+#define __BLS12_381_ASM_SHA256_H__
+
+#include "vect.h"
+
+#if (defined(__x86_64__) || defined(__x86_64) || defined(_M_X64)) && \
+     defined(__SHA__) /* -msha */ && !defined(__BLST_PORTABLE__)
+# define sha256_block_data_order blst_sha256_block_data_order_shaext
+#elif defined(__aarch64__) && \
+      defined(__ARM_FEATURE_CRYPTO) && !defined(__BLST_PORTABLE__)
+# define sha256_block_data_order blst_sha256_block_armv8
+#else
+# define sha256_block_data_order blst_sha256_block_data_order
+#endif
+#define sha256_hcopy blst_sha256_hcopy
+#define sha256_bcopy blst_sha256_bcopy
+#define sha256_emit  blst_sha256_emit
+
+void sha256_block_data_order(unsigned int *h, const void *inp, size_t blocks);
+void sha256_hcopy(unsigned int dst[8], const unsigned int src[8]);
+void sha256_bcopy(void *dst, const void *src, size_t len);
+
+/*
+ * If SHA256_CTX conflicts with something, just redefine it to alternative
+ * custom name prior including this header.
+ */
+typedef struct {
+    unsigned int h[8];
+    unsigned long long N;
+    unsigned char buf[64];
+    size_t off;
+} SHA256_CTX;
+
+
+static void sha256_init_h(unsigned int h[8])
+{
+    h[0] = 0x6a09e667U;
+    h[1] = 0xbb67ae85U;
+    h[2] = 0x3c6ef372U;
+    h[3] = 0xa54ff53aU;
+    h[4] = 0x510e527fU;
+    h[5] = 0x9b05688cU;
+    h[6] = 0x1f83d9abU;
+    h[7] = 0x5be0cd19U;
+}
+
+static void sha256_init(SHA256_CTX *ctx)
+{
+    sha256_init_h(ctx->h);
+    ctx->N = 0;
+    vec_zero(ctx->buf, sizeof(ctx->buf));
+    ctx->off = 0;
+}
+
+static void sha256_update(SHA256_CTX *ctx, const void *_inp, size_t len)
+{
+    size_t n;
+    const unsigned char *inp = _inp;
+
+    ctx->N += len;
+
+    if ((len != 0) & ((n = ctx->off) != 0)) {
+        size_t rem = sizeof(ctx->buf) - n;
+
+        if (rem > len) {
+            sha256_bcopy(ctx->buf + n, inp, len);
+            ctx->off += len;
+            return;
+        } else {
+            sha256_bcopy(ctx->buf + n, inp, rem);
+            inp += rem;
+            len -= rem;
+            sha256_block_data_order(ctx->h, ctx->buf, 1);
+            vec_zero(ctx->buf, sizeof(ctx->buf));
+            ctx->off = 0;
+        }
+    }
+
+    n = len / sizeof(ctx->buf);
+    if (n > 0) {
+        sha256_block_data_order(ctx->h, inp, n);
+        n *= sizeof(ctx->buf);
+        inp += n;
+        len -= n;
+    }
+
+    if (len)
+        sha256_bcopy(ctx->buf, inp, ctx->off = len);
+}
+
+#define __TOBE32(ptr, val) ((ptr)[0] = (unsigned char)((val)>>24), \
+                            (ptr)[1] = (unsigned char)((val)>>16), \
+                            (ptr)[2] = (unsigned char)((val)>>8),  \
+                            (ptr)[3] = (unsigned char)(val))
+
+#if 1
+void sha256_emit(unsigned char md[32], const unsigned int h[8]);
+#else
+static void sha256_emit(unsigned char md[32], const unsigned int h[8])
+{
+    unsigned int h_i;
+
+    h_i = h[0]; __TOBE32(md + 0, h_i);
+    h_i = h[1]; __TOBE32(md + 4, h_i);
+    h_i = h[2]; __TOBE32(md + 8, h_i);
+    h_i = h[3]; __TOBE32(md + 12, h_i);
+    h_i = h[4]; __TOBE32(md + 16, h_i);
+    h_i = h[5]; __TOBE32(md + 20, h_i);
+    h_i = h[6]; __TOBE32(md + 24, h_i);
+    h_i = h[7]; __TOBE32(md + 28, h_i);
+}
+#endif
+
+static void sha256_final(unsigned char md[32], SHA256_CTX *ctx)
+{
+    unsigned long long bits = ctx->N * 8;
+    size_t n = ctx->off;
+    unsigned char *tail;
+
+    ctx->buf[n++] = 0x80;
+
+    if (n > (sizeof(ctx->buf) - 8)) {
+        sha256_block_data_order(ctx->h, ctx->buf, 1);
+        vec_zero(ctx->buf, sizeof(ctx->buf));
+    }
+
+    tail = ctx->buf + sizeof(ctx->buf) - 8;
+    __TOBE32(tail, (unsigned int)(bits >> 32));
+    __TOBE32(tail + 4, (unsigned int)bits);
+    sha256_block_data_order(ctx->h, ctx->buf, 1);
+    sha256_emit(md, ctx->h);
+}
+
+#undef __TOBE32
+#endif
diff --git a/vendor/external/blst/src/sqrt-addchain.h b/vendor/external/blst/src/sqrt-addchain.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/sqrt-addchain.h
@@ -0,0 +1,489 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+/*
+ * The "magic" number is (BLS12_381_P-3)/4. Exponentiation to which
+ * yields reciprocal of sqrt(x), which is used in simplified Shallue-
+ * van de Woestijne-Ulas map-to-curve method, but it's trivial to adapt
+ * it for more "traditional" sqrt(x) as 'x*ret' (or for is_square(x)
+ * as 'x*ret^2==1').
+ *
+ * Generated with 'addchain 1000602388805416848354447456433976039139220704984751971333014534031007912622709466110671907282253916009473568139946'
+ * https://github.com/kwantam/addchain
+ *
+ * # Bos-Coster (win=4)           :  458 (16) <<<
+ * # Bos-Coster (win=5)           :  460 (28)
+ * # Bos-Coster (win=6)           :  461 (33)
+ * # Bos-Coster (win=7)           :  460 (28)
+ * # Bos-Coster (win=3)           :  462 ( 9)
+ * # Bos-Coster (win=8)           :  466 (34)
+ * # Bos-Coster (win=9)           :  464 (31)
+ * # Yacobi                       :  478 (31)
+ * # Bos-Coster (win=10)          :  473 (30)
+ * # Bos-Coster (win=2)           :  486 ( 5)
+ * # Bergeron-Berstel-Brlek-Duboc :  489 ( 5)
+ */
+
+#define RECIP_SQRT_MOD_BLS12_381_P(out, inp, ptype) do { \
+ptype t[16]; \
+vec_copy(t[13], inp, sizeof(ptype));/*    0: 1 */\
+sqr(t[0], t[13]);                   /*    1: 2 */\
+mul(t[8], t[0], t[13]);             /*    2: 3 */\
+sqr(t[4], t[0]);                    /*    3: 4 */\
+mul(t[1], t[8], t[0]);              /*    4: 5 */\
+mul(t[6], t[4], t[8]);              /*    5: 7 */\
+mul(t[9], t[1], t[4]);              /*    6: 9 */\
+mul(t[12], t[6], t[4]);             /*    7: b */\
+mul(t[3], t[9], t[4]);              /*    8: d */\
+mul(t[7], t[12], t[4]);             /*    9: f */\
+mul(t[15], t[3], t[4]);             /*   10: 11 */\
+mul(t[10], t[7], t[4]);             /*   11: 13 */\
+mul(t[2], t[15], t[4]);             /*   12: 15 */\
+mul(t[11], t[10], t[4]);            /*   13: 17 */\
+sqr(t[0], t[3]);                    /*   14: 1a */\
+mul(t[14], t[11], t[4]);            /*   15: 1b */\
+mul(t[5], t[0], t[8]);              /*   16: 1d */\
+mul(t[4], t[0], t[1]);              /*   17: 1f */\
+/* sqr(t[0], t[0]); */              /*   18: 34 */\
+/* sqr(t[0], t[0]); */              /*   19: 68 */\
+/* sqr(t[0], t[0]); */              /*   20: d0 */\
+/* sqr(t[0], t[0]); */              /*   21: 1a0 */\
+/* sqr(t[0], t[0]); */              /*   22: 340 */\
+/* sqr(t[0], t[0]); */              /*   23: 680 */\
+/* sqr(t[0], t[0]); */              /*   24: d00 */\
+/* sqr(t[0], t[0]); */              /*   25: 1a00 */\
+/* sqr(t[0], t[0]); */              /*   26: 3400 */\
+/* sqr(t[0], t[0]); */              /*   27: 6800 */\
+/* sqr(t[0], t[0]); */              /*   28: d000 */\
+/* sqr(t[0], t[0]); */              /*   29: 1a000 */\
+sqr_n_mul(t[0], t[0], 12, t[15]);   /*   30: 1a011 */\
+/* sqr(t[0], t[0]); */              /*   31: 34022 */\
+/* sqr(t[0], t[0]); */              /*   32: 68044 */\
+/* sqr(t[0], t[0]); */              /*   33: d0088 */\
+/* sqr(t[0], t[0]); */              /*   34: 1a0110 */\
+/* sqr(t[0], t[0]); */              /*   35: 340220 */\
+/* sqr(t[0], t[0]); */              /*   36: 680440 */\
+/* sqr(t[0], t[0]); */              /*   37: d00880 */\
+sqr_n_mul(t[0], t[0], 7, t[7]);     /*   38: d0088f */\
+/* sqr(t[0], t[0]); */              /*   39: 1a0111e */\
+/* sqr(t[0], t[0]); */              /*   40: 340223c */\
+/* sqr(t[0], t[0]); */              /*   41: 6804478 */\
+/* sqr(t[0], t[0]); */              /*   42: d0088f0 */\
+sqr_n_mul(t[0], t[0], 4, t[1]);     /*   43: d0088f5 */\
+/* sqr(t[0], t[0]); */              /*   44: 1a0111ea */\
+/* sqr(t[0], t[0]); */              /*   45: 340223d4 */\
+/* sqr(t[0], t[0]); */              /*   46: 680447a8 */\
+/* sqr(t[0], t[0]); */              /*   47: d0088f50 */\
+/* sqr(t[0], t[0]); */              /*   48: 1a0111ea0 */\
+/* sqr(t[0], t[0]); */              /*   49: 340223d40 */\
+sqr_n_mul(t[0], t[0], 6, t[6]);     /*   50: 340223d47 */\
+/* sqr(t[0], t[0]); */              /*   51: 680447a8e */\
+/* sqr(t[0], t[0]); */              /*   52: d0088f51c */\
+/* sqr(t[0], t[0]); */              /*   53: 1a0111ea38 */\
+/* sqr(t[0], t[0]); */              /*   54: 340223d470 */\
+/* sqr(t[0], t[0]); */              /*   55: 680447a8e0 */\
+/* sqr(t[0], t[0]); */              /*   56: d0088f51c0 */\
+/* sqr(t[0], t[0]); */              /*   57: 1a0111ea380 */\
+sqr_n_mul(t[0], t[0], 7, t[11]);    /*   58: 1a0111ea397 */\
+/* sqr(t[0], t[0]); */              /*   59: 340223d472e */\
+/* sqr(t[0], t[0]); */              /*   60: 680447a8e5c */\
+/* sqr(t[0], t[0]); */              /*   61: d0088f51cb8 */\
+/* sqr(t[0], t[0]); */              /*   62: 1a0111ea3970 */\
+/* sqr(t[0], t[0]); */              /*   63: 340223d472e0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*   64: 340223d472ff */\
+/* sqr(t[0], t[0]); */              /*   65: 680447a8e5fe */\
+/* sqr(t[0], t[0]); */              /*   66: d0088f51cbfc */\
+sqr_n_mul(t[0], t[0], 2, t[8]);     /*   67: d0088f51cbff */\
+/* sqr(t[0], t[0]); */              /*   68: 1a0111ea397fe */\
+/* sqr(t[0], t[0]); */              /*   69: 340223d472ffc */\
+/* sqr(t[0], t[0]); */              /*   70: 680447a8e5ff8 */\
+/* sqr(t[0], t[0]); */              /*   71: d0088f51cbff0 */\
+/* sqr(t[0], t[0]); */              /*   72: 1a0111ea397fe0 */\
+/* sqr(t[0], t[0]); */              /*   73: 340223d472ffc0 */\
+sqr_n_mul(t[0], t[0], 6, t[3]);     /*   74: 340223d472ffcd */\
+/* sqr(t[0], t[0]); */              /*   75: 680447a8e5ff9a */\
+/* sqr(t[0], t[0]); */              /*   76: d0088f51cbff34 */\
+/* sqr(t[0], t[0]); */              /*   77: 1a0111ea397fe68 */\
+/* sqr(t[0], t[0]); */              /*   78: 340223d472ffcd0 */\
+/* sqr(t[0], t[0]); */              /*   79: 680447a8e5ff9a0 */\
+/* sqr(t[0], t[0]); */              /*   80: d0088f51cbff340 */\
+sqr_n_mul(t[0], t[0], 6, t[3]);     /*   81: d0088f51cbff34d */\
+/* sqr(t[0], t[0]); */              /*   82: 1a0111ea397fe69a */\
+/* sqr(t[0], t[0]); */              /*   83: 340223d472ffcd34 */\
+/* sqr(t[0], t[0]); */              /*   84: 680447a8e5ff9a68 */\
+/* sqr(t[0], t[0]); */              /*   85: d0088f51cbff34d0 */\
+/* sqr(t[0], t[0]); */              /*   86: 1a0111ea397fe69a0 */\
+/* sqr(t[0], t[0]); */              /*   87: 340223d472ffcd340 */\
+sqr_n_mul(t[0], t[0], 6, t[9]);     /*   88: 340223d472ffcd349 */\
+/* sqr(t[0], t[0]); */              /*   89: 680447a8e5ff9a692 */\
+/* sqr(t[0], t[0]); */              /*   90: d0088f51cbff34d24 */\
+/* sqr(t[0], t[0]); */              /*   91: 1a0111ea397fe69a48 */\
+sqr_n_mul(t[0], t[0], 3, t[8]);     /*   92: 1a0111ea397fe69a4b */\
+/* sqr(t[0], t[0]); */              /*   93: 340223d472ffcd3496 */\
+/* sqr(t[0], t[0]); */              /*   94: 680447a8e5ff9a692c */\
+/* sqr(t[0], t[0]); */              /*   95: d0088f51cbff34d258 */\
+/* sqr(t[0], t[0]); */              /*   96: 1a0111ea397fe69a4b0 */\
+/* sqr(t[0], t[0]); */              /*   97: 340223d472ffcd34960 */\
+/* sqr(t[0], t[0]); */              /*   98: 680447a8e5ff9a692c0 */\
+/* sqr(t[0], t[0]); */              /*   99: d0088f51cbff34d2580 */\
+sqr_n_mul(t[0], t[0], 7, t[3]);     /*  100: d0088f51cbff34d258d */\
+/* sqr(t[0], t[0]); */              /*  101: 1a0111ea397fe69a4b1a */\
+/* sqr(t[0], t[0]); */              /*  102: 340223d472ffcd349634 */\
+/* sqr(t[0], t[0]); */              /*  103: 680447a8e5ff9a692c68 */\
+/* sqr(t[0], t[0]); */              /*  104: d0088f51cbff34d258d0 */\
+sqr_n_mul(t[0], t[0], 4, t[3]);     /*  105: d0088f51cbff34d258dd */\
+/* sqr(t[0], t[0]); */              /*  106: 1a0111ea397fe69a4b1ba */\
+/* sqr(t[0], t[0]); */              /*  107: 340223d472ffcd3496374 */\
+/* sqr(t[0], t[0]); */              /*  108: 680447a8e5ff9a692c6e8 */\
+/* sqr(t[0], t[0]); */              /*  109: d0088f51cbff34d258dd0 */\
+/* sqr(t[0], t[0]); */              /*  110: 1a0111ea397fe69a4b1ba0 */\
+/* sqr(t[0], t[0]); */              /*  111: 340223d472ffcd34963740 */\
+sqr_n_mul(t[0], t[0], 6, t[7]);     /*  112: 340223d472ffcd3496374f */\
+/* sqr(t[0], t[0]); */              /*  113: 680447a8e5ff9a692c6e9e */\
+/* sqr(t[0], t[0]); */              /*  114: d0088f51cbff34d258dd3c */\
+/* sqr(t[0], t[0]); */              /*  115: 1a0111ea397fe69a4b1ba78 */\
+/* sqr(t[0], t[0]); */              /*  116: 340223d472ffcd3496374f0 */\
+/* sqr(t[0], t[0]); */              /*  117: 680447a8e5ff9a692c6e9e0 */\
+/* sqr(t[0], t[0]); */              /*  118: d0088f51cbff34d258dd3c0 */\
+sqr_n_mul(t[0], t[0], 6, t[14]);    /*  119: d0088f51cbff34d258dd3db */\
+/* sqr(t[0], t[0]); */              /*  120: 1a0111ea397fe69a4b1ba7b6 */\
+/* sqr(t[0], t[0]); */              /*  121: 340223d472ffcd3496374f6c */\
+/* sqr(t[0], t[0]); */              /*  122: 680447a8e5ff9a692c6e9ed8 */\
+sqr_n_mul(t[0], t[0], 3, t[13]);    /*  123: 680447a8e5ff9a692c6e9ed9 */\
+/* sqr(t[0], t[0]); */              /*  124: d0088f51cbff34d258dd3db2 */\
+/* sqr(t[0], t[0]); */              /*  125: 1a0111ea397fe69a4b1ba7b64 */\
+/* sqr(t[0], t[0]); */              /*  126: 340223d472ffcd3496374f6c8 */\
+/* sqr(t[0], t[0]); */              /*  127: 680447a8e5ff9a692c6e9ed90 */\
+/* sqr(t[0], t[0]); */              /*  128: d0088f51cbff34d258dd3db20 */\
+/* sqr(t[0], t[0]); */              /*  129: 1a0111ea397fe69a4b1ba7b640 */\
+/* sqr(t[0], t[0]); */              /*  130: 340223d472ffcd3496374f6c80 */\
+/* sqr(t[0], t[0]); */              /*  131: 680447a8e5ff9a692c6e9ed900 */\
+sqr_n_mul(t[0], t[0], 8, t[3]);     /*  132: 680447a8e5ff9a692c6e9ed90d */\
+/* sqr(t[0], t[0]); */              /*  133: d0088f51cbff34d258dd3db21a */\
+/* sqr(t[0], t[0]); */              /*  134: 1a0111ea397fe69a4b1ba7b6434 */\
+/* sqr(t[0], t[0]); */              /*  135: 340223d472ffcd3496374f6c868 */\
+/* sqr(t[0], t[0]); */              /*  136: 680447a8e5ff9a692c6e9ed90d0 */\
+/* sqr(t[0], t[0]); */              /*  137: d0088f51cbff34d258dd3db21a0 */\
+/* sqr(t[0], t[0]); */              /*  138: 1a0111ea397fe69a4b1ba7b64340 */\
+/* sqr(t[0], t[0]); */              /*  139: 340223d472ffcd3496374f6c8680 */\
+sqr_n_mul(t[0], t[0], 7, t[11]);    /*  140: 340223d472ffcd3496374f6c8697 */\
+/* sqr(t[0], t[0]); */              /*  141: 680447a8e5ff9a692c6e9ed90d2e */\
+/* sqr(t[0], t[0]); */              /*  142: d0088f51cbff34d258dd3db21a5c */\
+/* sqr(t[0], t[0]); */              /*  143: 1a0111ea397fe69a4b1ba7b6434b8 */\
+/* sqr(t[0], t[0]); */              /*  144: 340223d472ffcd3496374f6c86970 */\
+/* sqr(t[0], t[0]); */              /*  145: 680447a8e5ff9a692c6e9ed90d2e0 */\
+sqr_n_mul(t[0], t[0], 5, t[12]);    /*  146: 680447a8e5ff9a692c6e9ed90d2eb */\
+/* sqr(t[0], t[0]); */              /*  147: d0088f51cbff34d258dd3db21a5d6 */\
+/* sqr(t[0], t[0]); */              /*  148: 1a0111ea397fe69a4b1ba7b6434bac */\
+/* sqr(t[0], t[0]); */              /*  149: 340223d472ffcd3496374f6c869758 */\
+/* sqr(t[0], t[0]); */              /*  150: 680447a8e5ff9a692c6e9ed90d2eb0 */\
+/* sqr(t[0], t[0]); */              /*  151: d0088f51cbff34d258dd3db21a5d60 */\
+/* sqr(t[0], t[0]); */              /*  152: 1a0111ea397fe69a4b1ba7b6434bac0 */\
+sqr_n_mul(t[0], t[0], 6, t[3]);     /*  153: 1a0111ea397fe69a4b1ba7b6434bacd */\
+/* sqr(t[0], t[0]); */              /*  154: 340223d472ffcd3496374f6c869759a */\
+/* sqr(t[0], t[0]); */              /*  155: 680447a8e5ff9a692c6e9ed90d2eb34 */\
+/* sqr(t[0], t[0]); */              /*  156: d0088f51cbff34d258dd3db21a5d668 */\
+/* sqr(t[0], t[0]); */              /*  157: 1a0111ea397fe69a4b1ba7b6434bacd0 */\
+/* sqr(t[0], t[0]); */              /*  158: 340223d472ffcd3496374f6c869759a0 */\
+/* sqr(t[0], t[0]); */              /*  159: 680447a8e5ff9a692c6e9ed90d2eb340 */\
+sqr_n_mul(t[0], t[0], 6, t[5]);     /*  160: 680447a8e5ff9a692c6e9ed90d2eb35d */\
+/* sqr(t[0], t[0]); */              /*  161: d0088f51cbff34d258dd3db21a5d66ba */\
+/* sqr(t[0], t[0]); */              /*  162: 1a0111ea397fe69a4b1ba7b6434bacd74 */\
+/* sqr(t[0], t[0]); */              /*  163: 340223d472ffcd3496374f6c869759ae8 */\
+/* sqr(t[0], t[0]); */              /*  164: 680447a8e5ff9a692c6e9ed90d2eb35d0 */\
+sqr_n_mul(t[0], t[0], 4, t[9]);     /*  165: 680447a8e5ff9a692c6e9ed90d2eb35d9 */\
+/* sqr(t[0], t[0]); */              /*  166: d0088f51cbff34d258dd3db21a5d66bb2 */\
+/* sqr(t[0], t[0]); */              /*  167: 1a0111ea397fe69a4b1ba7b6434bacd764 */\
+/* sqr(t[0], t[0]); */              /*  168: 340223d472ffcd3496374f6c869759aec8 */\
+/* sqr(t[0], t[0]); */              /*  169: 680447a8e5ff9a692c6e9ed90d2eb35d90 */\
+/* sqr(t[0], t[0]); */              /*  170: d0088f51cbff34d258dd3db21a5d66bb20 */\
+/* sqr(t[0], t[0]); */              /*  171: 1a0111ea397fe69a4b1ba7b6434bacd7640 */\
+/* sqr(t[0], t[0]); */              /*  172: 340223d472ffcd3496374f6c869759aec80 */\
+/* sqr(t[0], t[0]); */              /*  173: 680447a8e5ff9a692c6e9ed90d2eb35d900 */\
+sqr_n_mul(t[0], t[0], 8, t[5]);     /*  174: 680447a8e5ff9a692c6e9ed90d2eb35d91d */\
+/* sqr(t[0], t[0]); */              /*  175: d0088f51cbff34d258dd3db21a5d66bb23a */\
+/* sqr(t[0], t[0]); */              /*  176: 1a0111ea397fe69a4b1ba7b6434bacd76474 */\
+/* sqr(t[0], t[0]); */              /*  177: 340223d472ffcd3496374f6c869759aec8e8 */\
+/* sqr(t[0], t[0]); */              /*  178: 680447a8e5ff9a692c6e9ed90d2eb35d91d0 */\
+sqr_n_mul(t[0], t[0], 4, t[3]);     /*  179: 680447a8e5ff9a692c6e9ed90d2eb35d91dd */\
+/* sqr(t[0], t[0]); */              /*  180: d0088f51cbff34d258dd3db21a5d66bb23ba */\
+/* sqr(t[0], t[0]); */              /*  181: 1a0111ea397fe69a4b1ba7b6434bacd764774 */\
+/* sqr(t[0], t[0]); */              /*  182: 340223d472ffcd3496374f6c869759aec8ee8 */\
+/* sqr(t[0], t[0]); */              /*  183: 680447a8e5ff9a692c6e9ed90d2eb35d91dd0 */\
+/* sqr(t[0], t[0]); */              /*  184: d0088f51cbff34d258dd3db21a5d66bb23ba0 */\
+/* sqr(t[0], t[0]); */              /*  185: 1a0111ea397fe69a4b1ba7b6434bacd7647740 */\
+/* sqr(t[0], t[0]); */              /*  186: 340223d472ffcd3496374f6c869759aec8ee80 */\
+sqr_n_mul(t[0], t[0], 7, t[11]);    /*  187: 340223d472ffcd3496374f6c869759aec8ee97 */\
+/* sqr(t[0], t[0]); */              /*  188: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e */\
+/* sqr(t[0], t[0]); */              /*  189: d0088f51cbff34d258dd3db21a5d66bb23ba5c */\
+/* sqr(t[0], t[0]); */              /*  190: 1a0111ea397fe69a4b1ba7b6434bacd764774b8 */\
+/* sqr(t[0], t[0]); */              /*  191: 340223d472ffcd3496374f6c869759aec8ee970 */\
+/* sqr(t[0], t[0]); */              /*  192: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e0 */\
+/* sqr(t[0], t[0]); */              /*  193: d0088f51cbff34d258dd3db21a5d66bb23ba5c0 */\
+/* sqr(t[0], t[0]); */              /*  194: 1a0111ea397fe69a4b1ba7b6434bacd764774b80 */\
+/* sqr(t[0], t[0]); */              /*  195: 340223d472ffcd3496374f6c869759aec8ee9700 */\
+/* sqr(t[0], t[0]); */              /*  196: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e00 */\
+sqr_n_mul(t[0], t[0], 9, t[10]);    /*  197: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13 */\
+/* sqr(t[0], t[0]); */              /*  198: d0088f51cbff34d258dd3db21a5d66bb23ba5c26 */\
+/* sqr(t[0], t[0]); */              /*  199: 1a0111ea397fe69a4b1ba7b6434bacd764774b84c */\
+sqr_n_mul(t[0], t[0], 2, t[8]);     /*  200: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f */\
+/* sqr(t[0], t[0]); */              /*  201: 340223d472ffcd3496374f6c869759aec8ee9709e */\
+/* sqr(t[0], t[0]); */              /*  202: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13c */\
+/* sqr(t[0], t[0]); */              /*  203: d0088f51cbff34d258dd3db21a5d66bb23ba5c278 */\
+/* sqr(t[0], t[0]); */              /*  204: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f0 */\
+/* sqr(t[0], t[0]); */              /*  205: 340223d472ffcd3496374f6c869759aec8ee9709e0 */\
+sqr_n_mul(t[0], t[0], 5, t[6]);     /*  206: 340223d472ffcd3496374f6c869759aec8ee9709e7 */\
+/* sqr(t[0], t[0]); */              /*  207: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce */\
+/* sqr(t[0], t[0]); */              /*  208: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c */\
+/* sqr(t[0], t[0]); */              /*  209: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38 */\
+/* sqr(t[0], t[0]); */              /*  210: 340223d472ffcd3496374f6c869759aec8ee9709e70 */\
+/* sqr(t[0], t[0]); */              /*  211: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce0 */\
+/* sqr(t[0], t[0]); */              /*  212: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c0 */\
+/* sqr(t[0], t[0]); */              /*  213: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f380 */\
+sqr_n_mul(t[0], t[0], 7, t[1]);     /*  214: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f385 */\
+/* sqr(t[0], t[0]); */              /*  215: 340223d472ffcd3496374f6c869759aec8ee9709e70a */\
+/* sqr(t[0], t[0]); */              /*  216: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce14 */\
+/* sqr(t[0], t[0]); */              /*  217: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c28 */\
+/* sqr(t[0], t[0]); */              /*  218: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f3850 */\
+/* sqr(t[0], t[0]); */              /*  219: 340223d472ffcd3496374f6c869759aec8ee9709e70a0 */\
+/* sqr(t[0], t[0]); */              /*  220: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce140 */\
+/* sqr(t[0], t[0]); */              /*  221: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c280 */\
+sqr_n_mul(t[0], t[0], 7, t[9]);     /*  222: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c289 */\
+/* sqr(t[0], t[0]); */              /*  223: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512 */\
+/* sqr(t[0], t[0]); */              /*  224: 340223d472ffcd3496374f6c869759aec8ee9709e70a24 */\
+/* sqr(t[0], t[0]); */              /*  225: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce1448 */\
+/* sqr(t[0], t[0]); */              /*  226: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2890 */\
+/* sqr(t[0], t[0]); */              /*  227: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f385120 */\
+/* sqr(t[0], t[0]); */              /*  228: 340223d472ffcd3496374f6c869759aec8ee9709e70a240 */\
+sqr_n_mul(t[0], t[0], 6, t[11]);    /*  229: 340223d472ffcd3496374f6c869759aec8ee9709e70a257 */\
+/* sqr(t[0], t[0]); */              /*  230: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144ae */\
+/* sqr(t[0], t[0]); */              /*  231: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895c */\
+/* sqr(t[0], t[0]); */              /*  232: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512b8 */\
+/* sqr(t[0], t[0]); */              /*  233: 340223d472ffcd3496374f6c869759aec8ee9709e70a2570 */\
+/* sqr(t[0], t[0]); */              /*  234: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144ae0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  235: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd */\
+/* sqr(t[0], t[0]); */              /*  236: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fa */\
+/* sqr(t[0], t[0]); */              /*  237: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf4 */\
+/* sqr(t[0], t[0]); */              /*  238: 340223d472ffcd3496374f6c869759aec8ee9709e70a257e8 */\
+/* sqr(t[0], t[0]); */              /*  239: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd0 */\
+/* sqr(t[0], t[0]); */              /*  240: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fa0 */\
+sqr_n_mul(t[0], t[0], 5, t[10]);    /*  241: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb3 */\
+/* sqr(t[0], t[0]); */              /*  242: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf66 */\
+/* sqr(t[0], t[0]); */              /*  243: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ecc */\
+/* sqr(t[0], t[0]); */              /*  244: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd98 */\
+/* sqr(t[0], t[0]); */              /*  245: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb30 */\
+/* sqr(t[0], t[0]); */              /*  246: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf660 */\
+sqr_n_mul(t[0], t[0], 5, t[10]);    /*  247: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf673 */\
+/* sqr(t[0], t[0]); */              /*  248: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece6 */\
+/* sqr(t[0], t[0]); */              /*  249: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc */\
+/* sqr(t[0], t[0]); */              /*  250: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb398 */\
+/* sqr(t[0], t[0]); */              /*  251: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730 */\
+/* sqr(t[0], t[0]); */              /*  252: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece60 */\
+/* sqr(t[0], t[0]); */              /*  253: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc0 */\
+/* sqr(t[0], t[0]); */              /*  254: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb3980 */\
+/* sqr(t[0], t[0]); */              /*  255: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf67300 */\
+sqr_n_mul(t[0], t[0], 8, t[3]);     /*  256: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d */\
+/* sqr(t[0], t[0]); */              /*  257: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a */\
+/* sqr(t[0], t[0]); */              /*  258: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34 */\
+/* sqr(t[0], t[0]); */              /*  259: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39868 */\
+/* sqr(t[0], t[0]); */              /*  260: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d0 */\
+/* sqr(t[0], t[0]); */              /*  261: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a0 */\
+/* sqr(t[0], t[0]); */              /*  262: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc340 */\
+/* sqr(t[0], t[0]); */              /*  263: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb398680 */\
+sqr_n_mul(t[0], t[0], 7, t[2]);     /*  264: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb398695 */\
+/* sqr(t[0], t[0]); */              /*  265: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a */\
+/* sqr(t[0], t[0]); */              /*  266: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a54 */\
+/* sqr(t[0], t[0]); */              /*  267: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a8 */\
+/* sqr(t[0], t[0]); */              /*  268: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb3986950 */\
+/* sqr(t[0], t[0]); */              /*  269: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0 */\
+/* sqr(t[0], t[0]); */              /*  270: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a540 */\
+/* sqr(t[0], t[0]); */              /*  271: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a80 */\
+/* sqr(t[0], t[0]); */              /*  272: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869500 */\
+/* sqr(t[0], t[0]); */              /*  273: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a00 */\
+sqr_n_mul(t[0], t[0], 9, t[7]);     /*  274: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f */\
+/* sqr(t[0], t[0]); */              /*  275: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541e */\
+/* sqr(t[0], t[0]); */              /*  276: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83c */\
+/* sqr(t[0], t[0]); */              /*  277: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb398695078 */\
+/* sqr(t[0], t[0]); */              /*  278: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f0 */\
+/* sqr(t[0], t[0]); */              /*  279: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541e0 */\
+sqr_n_mul(t[0], t[0], 5, t[3]);     /*  280: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed */\
+/* sqr(t[0], t[0]); */              /*  281: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83da */\
+/* sqr(t[0], t[0]); */              /*  282: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b4 */\
+/* sqr(t[0], t[0]); */              /*  283: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f68 */\
+sqr_n_mul(t[0], t[0], 3, t[8]);     /*  284: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b */\
+/* sqr(t[0], t[0]); */              /*  285: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed6 */\
+/* sqr(t[0], t[0]); */              /*  286: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac */\
+/* sqr(t[0], t[0]); */              /*  287: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b58 */\
+/* sqr(t[0], t[0]); */              /*  288: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0 */\
+/* sqr(t[0], t[0]); */              /*  289: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed60 */\
+/* sqr(t[0], t[0]); */              /*  290: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac0 */\
+/* sqr(t[0], t[0]); */              /*  291: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b580 */\
+/* sqr(t[0], t[0]); */              /*  292: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b00 */\
+sqr_n_mul(t[0], t[0], 8, t[7]);     /*  293: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f */\
+/* sqr(t[0], t[0]); */              /*  294: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61e */\
+/* sqr(t[0], t[0]); */              /*  295: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3c */\
+/* sqr(t[0], t[0]); */              /*  296: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b5878 */\
+sqr_n_mul(t[0], t[0], 3, t[8]);     /*  297: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b */\
+/* sqr(t[0], t[0]); */              /*  298: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6 */\
+/* sqr(t[0], t[0]); */              /*  299: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec */\
+/* sqr(t[0], t[0]); */              /*  300: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8 */\
+/* sqr(t[0], t[0]); */              /*  301: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b0 */\
+/* sqr(t[0], t[0]); */              /*  302: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f60 */\
+/* sqr(t[0], t[0]); */              /*  303: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec0 */\
+/* sqr(t[0], t[0]); */              /*  304: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d80 */\
+sqr_n_mul(t[0], t[0], 7, t[9]);     /*  305: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d89 */\
+/* sqr(t[0], t[0]); */              /*  306: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b12 */\
+/* sqr(t[0], t[0]); */              /*  307: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f624 */\
+/* sqr(t[0], t[0]); */              /*  308: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec48 */\
+/* sqr(t[0], t[0]); */              /*  309: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d890 */\
+/* sqr(t[0], t[0]); */              /*  310: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120 */\
+/* sqr(t[0], t[0]); */              /*  311: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6240 */\
+/* sqr(t[0], t[0]); */              /*  312: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec480 */\
+/* sqr(t[0], t[0]); */              /*  313: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8900 */\
+/* sqr(t[0], t[0]); */              /*  314: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b1200 */\
+sqr_n_mul(t[0], t[0], 9, t[7]);     /*  315: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f */\
+/* sqr(t[0], t[0]); */              /*  316: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241e */\
+/* sqr(t[0], t[0]); */              /*  317: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483c */\
+/* sqr(t[0], t[0]); */              /*  318: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d89078 */\
+/* sqr(t[0], t[0]); */              /*  319: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f0 */\
+/* sqr(t[0], t[0]); */              /*  320: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241e0 */\
+/* sqr(t[0], t[0]); */              /*  321: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483c0 */\
+sqr_n_mul(t[0], t[0], 6, t[2]);     /*  322: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d5 */\
+/* sqr(t[0], t[0]); */              /*  323: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aa */\
+/* sqr(t[0], t[0]); */              /*  324: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f54 */\
+/* sqr(t[0], t[0]); */              /*  325: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241ea8 */\
+/* sqr(t[0], t[0]); */              /*  326: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d50 */\
+/* sqr(t[0], t[0]); */              /*  327: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aa0 */\
+/* sqr(t[0], t[0]); */              /*  328: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f540 */\
+sqr_n_mul(t[0], t[0], 6, t[4]);     /*  329: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55f */\
+/* sqr(t[0], t[0]); */              /*  330: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabe */\
+/* sqr(t[0], t[0]); */              /*  331: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57c */\
+/* sqr(t[0], t[0]); */              /*  332: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaf8 */\
+/* sqr(t[0], t[0]); */              /*  333: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55f0 */\
+/* sqr(t[0], t[0]); */              /*  334: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabe0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  335: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabff */\
+/* sqr(t[0], t[0]); */              /*  336: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fe */\
+/* sqr(t[0], t[0]); */              /*  337: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffc */\
+/* sqr(t[0], t[0]); */              /*  338: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ff8 */\
+/* sqr(t[0], t[0]); */              /*  339: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabff0 */\
+/* sqr(t[0], t[0]); */              /*  340: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fe0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  341: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fff */\
+/* sqr(t[0], t[0]); */              /*  342: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aafffe */\
+/* sqr(t[0], t[0]); */              /*  343: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55fffc */\
+/* sqr(t[0], t[0]); */              /*  344: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfff8 */\
+/* sqr(t[0], t[0]); */              /*  345: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fff0 */\
+sqr_n_mul(t[0], t[0], 4, t[3]);     /*  346: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd */\
+/* sqr(t[0], t[0]); */              /*  347: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffa */\
+/* sqr(t[0], t[0]); */              /*  348: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff4 */\
+/* sqr(t[0], t[0]); */              /*  349: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffe8 */\
+sqr_n_mul(t[0], t[0], 3, t[8]);     /*  350: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb */\
+/* sqr(t[0], t[0]); */              /*  351: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd6 */\
+/* sqr(t[0], t[0]); */              /*  352: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac */\
+/* sqr(t[0], t[0]); */              /*  353: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58 */\
+/* sqr(t[0], t[0]); */              /*  354: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb0 */\
+/* sqr(t[0], t[0]); */              /*  355: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd60 */\
+/* sqr(t[0], t[0]); */              /*  356: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac0 */\
+/* sqr(t[0], t[0]); */              /*  357: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff580 */\
+/* sqr(t[0], t[0]); */              /*  358: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb00 */\
+sqr_n_mul(t[0], t[0], 8, t[2]);     /*  359: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb15 */\
+/* sqr(t[0], t[0]); */              /*  360: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a */\
+/* sqr(t[0], t[0]); */              /*  361: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54 */\
+/* sqr(t[0], t[0]); */              /*  362: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a8 */\
+/* sqr(t[0], t[0]); */              /*  363: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb150 */\
+/* sqr(t[0], t[0]); */              /*  364: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a0 */\
+/* sqr(t[0], t[0]); */              /*  365: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac540 */\
+/* sqr(t[0], t[0]); */              /*  366: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a80 */\
+sqr_n_mul(t[0], t[0], 7, t[4]);     /*  367: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9f */\
+/* sqr(t[0], t[0]); */              /*  368: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153e */\
+/* sqr(t[0], t[0]); */              /*  369: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7c */\
+/* sqr(t[0], t[0]); */              /*  370: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54f8 */\
+/* sqr(t[0], t[0]); */              /*  371: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9f0 */\
+/* sqr(t[0], t[0]); */              /*  372: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153e0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  373: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ff */\
+/* sqr(t[0], t[0]); */              /*  374: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7fe */\
+/* sqr(t[0], t[0]); */              /*  375: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffc */\
+/* sqr(t[0], t[0]); */              /*  376: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ff8 */\
+/* sqr(t[0], t[0]); */              /*  377: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ff0 */\
+/* sqr(t[0], t[0]); */              /*  378: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7fe0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  379: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7fff */\
+/* sqr(t[0], t[0]); */              /*  380: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54fffe */\
+/* sqr(t[0], t[0]); */              /*  381: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9fffc */\
+/* sqr(t[0], t[0]); */              /*  382: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153fff8 */\
+/* sqr(t[0], t[0]); */              /*  383: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7fff0 */\
+sqr_n_mul(t[0], t[0], 4, t[7]);     /*  384: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff */\
+/* sqr(t[0], t[0]); */              /*  385: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffe */\
+/* sqr(t[0], t[0]); */              /*  386: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffc */\
+/* sqr(t[0], t[0]); */              /*  387: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffff8 */\
+/* sqr(t[0], t[0]); */              /*  388: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff0 */\
+sqr_n_mul(t[0], t[0], 4, t[6]);     /*  389: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff7 */\
+/* sqr(t[0], t[0]); */              /*  390: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee */\
+/* sqr(t[0], t[0]); */              /*  391: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdc */\
+/* sqr(t[0], t[0]); */              /*  392: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb8 */\
+/* sqr(t[0], t[0]); */              /*  393: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff70 */\
+/* sqr(t[0], t[0]); */              /*  394: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee0 */\
+/* sqr(t[0], t[0]); */              /*  395: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdc0 */\
+/* sqr(t[0], t[0]); */              /*  396: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb80 */\
+sqr_n_mul(t[0], t[0], 7, t[4]);     /*  397: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9f */\
+/* sqr(t[0], t[0]); */              /*  398: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73e */\
+/* sqr(t[0], t[0]); */              /*  399: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7c */\
+/* sqr(t[0], t[0]); */              /*  400: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcf8 */\
+/* sqr(t[0], t[0]); */              /*  401: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9f0 */\
+/* sqr(t[0], t[0]); */              /*  402: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73e0 */\
+sqr_n_mul(t[0], t[0], 5, t[5]);     /*  403: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fd */\
+/* sqr(t[0], t[0]); */              /*  404: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fa */\
+/* sqr(t[0], t[0]); */              /*  405: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff4 */\
+/* sqr(t[0], t[0]); */              /*  406: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9fe8 */\
+/* sqr(t[0], t[0]); */              /*  407: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fd0 */\
+/* sqr(t[0], t[0]); */              /*  408: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fa0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  409: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbf */\
+/* sqr(t[0], t[0]); */              /*  410: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7e */\
+/* sqr(t[0], t[0]); */              /*  411: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9fefc */\
+/* sqr(t[0], t[0]); */              /*  412: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdf8 */\
+/* sqr(t[0], t[0]); */              /*  413: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbf0 */\
+/* sqr(t[0], t[0]); */              /*  414: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7e0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  415: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7ff */\
+/* sqr(t[0], t[0]); */              /*  416: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffe */\
+/* sqr(t[0], t[0]); */              /*  417: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffc */\
+/* sqr(t[0], t[0]); */              /*  418: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbff8 */\
+/* sqr(t[0], t[0]); */              /*  419: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7ff0 */\
+/* sqr(t[0], t[0]); */              /*  420: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffe0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  421: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffff */\
+/* sqr(t[0], t[0]); */              /*  422: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdfffe */\
+/* sqr(t[0], t[0]); */              /*  423: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbfffc */\
+/* sqr(t[0], t[0]); */              /*  424: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fff8 */\
+/* sqr(t[0], t[0]); */              /*  425: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffff0 */\
+/* sqr(t[0], t[0]); */              /*  426: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdfffe0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  427: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdfffff */\
+/* sqr(t[0], t[0]); */              /*  428: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbffffe */\
+/* sqr(t[0], t[0]); */              /*  429: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7ffffc */\
+/* sqr(t[0], t[0]); */              /*  430: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9fefffff8 */\
+/* sqr(t[0], t[0]); */              /*  431: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdfffff0 */\
+/* sqr(t[0], t[0]); */              /*  432: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbffffe0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  433: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbffffff */\
+/* sqr(t[0], t[0]); */              /*  434: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffe */\
+/* sqr(t[0], t[0]); */              /*  435: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffc */\
+/* sqr(t[0], t[0]); */              /*  436: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffff8 */\
+/* sqr(t[0], t[0]); */              /*  437: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbffffff0 */\
+/* sqr(t[0], t[0]); */              /*  438: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffe0 */\
+sqr_n_mul(t[0], t[0], 5, t[4]);     /*  439: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffff */\
+/* sqr(t[0], t[0]); */              /*  440: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9fefffffffe */\
+/* sqr(t[0], t[0]); */              /*  441: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdfffffffc */\
+/* sqr(t[0], t[0]); */              /*  442: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbfffffff8 */\
+/* sqr(t[0], t[0]); */              /*  443: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffff0 */\
+sqr_n_mul(t[0], t[0], 4, t[3]);     /*  444: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd */\
+/* sqr(t[0], t[0]); */              /*  445: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa */\
+/* sqr(t[0], t[0]); */              /*  446: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffffff4 */\
+/* sqr(t[0], t[0]); */              /*  447: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbfffffffe8 */\
+/* sqr(t[0], t[0]); */              /*  448: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd0 */\
+/* sqr(t[0], t[0]); */              /*  449: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa0 */\
+/* sqr(t[0], t[0]); */              /*  450: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffffff40 */\
+sqr_n_mul(t[0], t[0], 6, t[2]);     /*  451: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffffff55 */\
+/* sqr(t[0], t[0]); */              /*  452: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbfffffffeaa */\
+/* sqr(t[0], t[0]); */              /*  453: d0088f51cbff34d258dd3db21a5d66bb23ba5c279c2895fb39869507b587b120f55ffff58a9ffffdcff7fffffffd54 */\
+/* sqr(t[0], t[0]); */              /*  454: 1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa8 */\
+/* sqr(t[0], t[0]); */              /*  455: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffffff550 */\
+sqr_n_mul(t[0], t[0], 4, t[1]);     /*  456: 340223d472ffcd3496374f6c869759aec8ee9709e70a257ece61a541ed61ec483d57fffd62a7ffff73fdffffffff555 */\
+sqr(out, t[0]);                     /*  457: 680447a8e5ff9a692c6e9ed90d2eb35d91dd2e13ce144afd9cc34a83dac3d8907aaffffac54ffffee7fbfffffffeaaa */\
+} while(0)
diff --git a/vendor/external/blst/src/sqrt.c b/vendor/external/blst/src/sqrt.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/sqrt.c
@@ -0,0 +1,261 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "fields.h"
+
+#ifdef __OPTIMIZE_SIZE__
+static void recip_sqrt_fp_3mod4(vec384 out, const vec384 inp)
+{
+    static const byte BLS_12_381_P_minus_3_div_4[] = {
+        TO_BYTES(0xee7fbfffffffeaaa), TO_BYTES(0x07aaffffac54ffff),
+        TO_BYTES(0xd9cc34a83dac3d89), TO_BYTES(0xd91dd2e13ce144af),
+        TO_BYTES(0x92c6e9ed90d2eb35), TO_BYTES(0x0680447a8e5ff9a6)
+    };
+
+    exp_mont_384(out, inp, BLS_12_381_P_minus_3_div_4, 379, BLS12_381_P, p0);
+}
+#else
+# if 1
+/*
+ * "383"-bit variant omits full reductions at the ends of squarings,
+ * which results in up to ~15% improvement. [One can improve further
+ * by omitting full reductions even after multiplications and
+ * performing final reduction at the very end of the chain.]
+ */
+static inline void sqr_n_mul_fp(vec384 out, const vec384 a, size_t count,
+                                const vec384 b)
+{   sqr_n_mul_mont_383(out, a, count, BLS12_381_P, p0, b);   }
+# else
+static void sqr_n_mul_fp(vec384 out, const vec384 a, size_t count,
+                         const vec384 b)
+{
+    while(count--) {
+        sqr_fp(out, a);
+        a = out;
+    }
+    mul_fp(out, out, b);
+}
+# endif
+
+# define sqr(ret,a)		sqr_fp(ret,a)
+# define mul(ret,a,b)		mul_fp(ret,a,b)
+# define sqr_n_mul(ret,a,n,b)	sqr_n_mul_fp(ret,a,n,b)
+
+# include "sqrt-addchain.h"
+static void recip_sqrt_fp_3mod4(vec384 out, const vec384 inp)
+{
+    RECIP_SQRT_MOD_BLS12_381_P(out, inp, vec384);
+}
+# undef RECIP_SQRT_MOD_BLS12_381_P
+
+# undef sqr_n_mul
+# undef sqr
+# undef mul
+#endif
+
+static bool_t recip_sqrt_fp(vec384 out, const vec384 inp)
+{
+    vec384 t0, t1;
+    bool_t ret;
+
+    recip_sqrt_fp_3mod4(t0, inp);
+
+    mul_fp(t1, t0, inp);
+    sqr_fp(t1, t1);
+    ret = vec_is_equal(t1, inp, sizeof(t1));
+    vec_copy(out, t0, sizeof(t0));
+
+    return ret;
+}
+
+static bool_t sqrt_fp(vec384 out, const vec384 inp)
+{
+    vec384 t0, t1;
+    bool_t ret;
+
+    recip_sqrt_fp_3mod4(t0, inp);
+
+    mul_fp(t0, t0, inp);
+    sqr_fp(t1, t0);
+    ret = vec_is_equal(t1, inp, sizeof(t1));
+    vec_copy(out, t0, sizeof(t0));
+
+    return ret;
+}
+
+int blst_fp_sqrt(vec384 out, const vec384 inp)
+{   return (int)sqrt_fp(out, inp);   }
+
+int blst_fp_is_square(const vec384 inp)
+{
+    return (int)ct_is_square_mod_384(inp, BLS12_381_P);
+}
+
+static bool_t sqrt_align_fp2(vec384x out, const vec384x ret,
+                             const vec384x sqrt, const vec384x inp)
+{
+    static const vec384x sqrt_minus_1 = { { 0 }, { ONE_MONT_P } };
+    static const vec384x sqrt_sqrt_minus_1 = {
+      /*
+       * "magic" number is ±2^((p-3)/4)%p, which is "1/sqrt(2)",
+       * in quotes because 2*"1/sqrt(2)"^2 == -1 mod p, not 1,
+       * but it pivots into "complex" plane nevertheless...
+       */
+      { TO_LIMB_T(0x3e2f585da55c9ad1), TO_LIMB_T(0x4294213d86c18183),
+        TO_LIMB_T(0x382844c88b623732), TO_LIMB_T(0x92ad2afd19103e18),
+        TO_LIMB_T(0x1d794e4fac7cf0b9), TO_LIMB_T(0x0bd592fc7d825ec8) },
+      { TO_LIMB_T(0x7bcfa7a25aa30fda), TO_LIMB_T(0xdc17dec12a927e7c),
+        TO_LIMB_T(0x2f088dd86b4ebef1), TO_LIMB_T(0xd1ca2087da74d4a7),
+        TO_LIMB_T(0x2da2596696cebc1d), TO_LIMB_T(0x0e2b7eedbbfd87d2) }
+    };
+    static const vec384x sqrt_minus_sqrt_minus_1 = {
+      { TO_LIMB_T(0x7bcfa7a25aa30fda), TO_LIMB_T(0xdc17dec12a927e7c),
+        TO_LIMB_T(0x2f088dd86b4ebef1), TO_LIMB_T(0xd1ca2087da74d4a7),
+        TO_LIMB_T(0x2da2596696cebc1d), TO_LIMB_T(0x0e2b7eedbbfd87d2) },
+      { TO_LIMB_T(0x7bcfa7a25aa30fda), TO_LIMB_T(0xdc17dec12a927e7c),
+        TO_LIMB_T(0x2f088dd86b4ebef1), TO_LIMB_T(0xd1ca2087da74d4a7),
+        TO_LIMB_T(0x2da2596696cebc1d), TO_LIMB_T(0x0e2b7eedbbfd87d2) }
+    };
+    vec384x coeff, t0, t1;
+    bool_t is_sqrt, flag;
+
+    /*
+     * Instead of multiple trial squarings we can perform just one
+     * and see if the result is "rotated by multiple of 90°" in
+     * relation to |inp|, and "rotate" |ret| accordingly.
+     */
+    sqr_fp2(t0, sqrt);
+    /* "sqrt(|inp|)"^2 = (a + b*i)^2 = (a^2-b^2) + 2ab*i */
+
+    /* (a^2-b^2) + 2ab*i == |inp| ? |ret| is spot on */
+    sub_fp2(t1, t0, inp);
+    is_sqrt = vec_is_zero(t1, sizeof(t1));
+    vec_copy(coeff, BLS12_381_Rx.p2, sizeof(coeff));
+
+    /* -(a^2-b^2) - 2ab*i == |inp| ? "rotate |ret| by 90°" */
+    add_fp2(t1, t0, inp);
+    vec_select(coeff, sqrt_minus_1, coeff, sizeof(coeff),
+               flag = vec_is_zero(t1, sizeof(t1)));
+    is_sqrt |= flag;
+
+    /* 2ab - (a^2-b^2)*i == |inp| ? "rotate |ret| by 135°" */
+    sub_fp(t1[0], t0[0], inp[1]);
+    add_fp(t1[1], t0[1], inp[0]);
+    vec_select(coeff, sqrt_sqrt_minus_1, coeff, sizeof(coeff),
+               flag = vec_is_zero(t1, sizeof(t1)));
+    is_sqrt |= flag;
+
+    /* -2ab + (a^2-b^2)*i == |inp| ? "rotate |ret| by 45°" */
+    add_fp(t1[0], t0[0], inp[1]);
+    sub_fp(t1[1], t0[1], inp[0]);
+    vec_select(coeff, sqrt_minus_sqrt_minus_1, coeff, sizeof(coeff),
+               flag = vec_is_zero(t1, sizeof(t1)));
+    is_sqrt |= flag;
+
+    /* actual "rotation" */
+    mul_fp2(out, ret, coeff);
+
+    return is_sqrt;
+}
+
+/*
+ * |inp| = a + b*i
+ */
+static bool_t recip_sqrt_fp2(vec384x out, const vec384x inp,
+                                          const vec384x recip_ZZZ,
+                                          const vec384x magic_ZZZ)
+{
+    vec384 aa, bb, cc;
+    vec384x inp_;
+    bool_t is_sqrt;
+
+    sqr_fp(aa, inp[0]);
+    sqr_fp(bb, inp[1]);
+    add_fp(aa, aa, bb);
+
+    is_sqrt = recip_sqrt_fp(cc, aa);  /* 1/sqrt(a²+b²)                    */
+
+    /* if |inp| doesn't have quadratic residue, multiply by "1/Z³" ...    */
+    mul_fp2(inp_, inp, recip_ZZZ);
+    /* ... and adjust |aa| and |cc| accordingly                           */
+    {
+        vec384 za, zc;
+
+        mul_fp(za, aa, magic_ZZZ[0]); /* aa*(za² + zb²)                   */
+        mul_fp(zc, cc, magic_ZZZ[1]); /* cc*(za² + zb²)^((p-3)/4)         */
+        vec_select(aa, aa, za, sizeof(aa), is_sqrt);
+        vec_select(cc, cc, zc, sizeof(cc), is_sqrt);
+    }
+    vec_select(inp_, inp, inp_, sizeof(inp_), is_sqrt);
+
+    mul_fp(aa, aa, cc);               /* sqrt(a²+b²)                      */
+
+    sub_fp(bb, inp_[0], aa);
+    add_fp(aa, inp_[0], aa);
+    vec_select(aa, bb, aa, sizeof(aa), vec_is_zero(aa, sizeof(aa)));
+    div_by_2_fp(aa, aa);              /* (a ± sqrt(a²+b²))/2              */
+
+    /* if it says "no sqrt," final "align" will find right one...         */
+    (void)recip_sqrt_fp(out[0], aa);  /* 1/sqrt((a ± sqrt(a²+b²))/2)      */
+
+    div_by_2_fp(out[1], inp_[1]);
+    mul_fp(out[1], out[1], out[0]);   /* b/(2*sqrt((a ± sqrt(a²+b²))/2))  */
+    mul_fp(out[0], out[0], aa);       /* sqrt((a ± sqrt(a²+b²))/2)        */
+
+    /* bound to succeed                                                   */
+    (void)sqrt_align_fp2(out, out, out, inp_);
+
+    mul_fp(out[0], out[0], cc);       /* inverse the result               */
+    mul_fp(out[1], out[1], cc);
+    neg_fp(out[1], out[1]);
+
+    return is_sqrt;
+}
+
+static bool_t sqrt_fp2(vec384x out, const vec384x inp)
+{
+    vec384x ret;
+    vec384 aa, bb;
+
+    sqr_fp(aa, inp[0]);
+    sqr_fp(bb, inp[1]);
+    add_fp(aa, aa, bb);
+
+    /* don't pay attention to return value, final "align" will tell...    */
+    (void)sqrt_fp(aa, aa);            /* sqrt(a²+b²)                      */
+
+    sub_fp(bb, inp[0], aa);
+    add_fp(aa, inp[0], aa);
+    vec_select(aa, bb, aa, sizeof(aa), vec_is_zero(aa, sizeof(aa)));
+    div_by_2_fp(aa, aa);              /* (a ± sqrt(a²+b²))/2              */
+
+    /* if it says "no sqrt," final "align" will find right one...         */
+    (void)recip_sqrt_fp(ret[0], aa);  /* 1/sqrt((a ± sqrt(a²+b²))/2)      */
+
+    div_by_2_fp(ret[1], inp[1]);
+    mul_fp(ret[1], ret[1], ret[0]);   /* b/(2*sqrt((a ± sqrt(a²+b²))/2))  */
+    mul_fp(ret[0], ret[0], aa);       /* sqrt((a ± sqrt(a²+b²))/2)        */
+
+    /*
+     * Now see if |ret| is or can be made sqrt(|inp|)...
+     */
+
+    return sqrt_align_fp2(out, ret, ret, inp);
+}
+
+int blst_fp2_sqrt(vec384x out, const vec384x inp)
+{   return (int)sqrt_fp2(out, inp);   }
+
+int blst_fp2_is_square(const vec384x inp)
+{
+    vec384 aa, bb;
+
+    sqr_fp(aa, inp[0]);
+    sqr_fp(bb, inp[1]);
+    add_fp(aa, aa, bb);
+
+    return (int)ct_is_square_mod_384(aa, BLS12_381_P);
+}
diff --git a/vendor/external/blst/src/vect.c b/vendor/external/blst/src/vect.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/vect.c
@@ -0,0 +1,176 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "vect.h"
+
+#ifdef __BLST_NO_ASM__
+# include "no_asm.h"
+#endif
+
+/*
+ * Following are some reference C implementations to assist new
+ * assembly modules development, as starting-point stand-ins and for
+ * cross-checking. In order to "polyfil" specific subroutine redefine
+ * it on compiler command line, e.g. -Dmul_mont_384x=_mul_mont_384x.
+ */
+
+#ifdef lshift_mod_384
+inline void lshift_mod_384(vec384 ret, const vec384 a, size_t n,
+                           const vec384 mod)
+{
+    while(n--)
+        add_mod_384(ret, a, a, mod), a = ret;
+}
+#endif
+
+#ifdef mul_by_8_mod_384
+inline void mul_by_8_mod_384(vec384 ret, const vec384 a, const vec384 mod)
+{   lshift_mod_384(ret, a, 3, mod);   }
+#endif
+
+#ifdef mul_by_3_mod_384
+inline void mul_by_3_mod_384(vec384 ret, const vec384 a, const vec384 mod)
+{
+    vec384 t;
+
+    add_mod_384(t, a, a, mod);
+    add_mod_384(ret, t, a, mod);
+}
+#endif
+
+#ifdef mul_by_3_mod_384x
+inline void mul_by_3_mod_384x(vec384x ret, const vec384x a, const vec384 mod)
+{
+    mul_by_3_mod_384(ret[0], a[0], mod);
+    mul_by_3_mod_384(ret[1], a[1], mod);
+}
+#endif
+
+#ifdef mul_by_8_mod_384x
+inline void mul_by_8_mod_384x(vec384x ret, const vec384x a, const vec384 mod)
+{
+    mul_by_8_mod_384(ret[0], a[0], mod);
+    mul_by_8_mod_384(ret[1], a[1], mod);
+}
+#endif
+
+#ifdef mul_by_1_plus_i_mod_384x
+inline void mul_by_1_plus_i_mod_384x(vec384x ret, const vec384x a,
+                                     const vec384 mod)
+{
+    vec384 t;
+
+    add_mod_384(t, a[0], a[1], mod);
+    sub_mod_384(ret[0], a[0], a[1], mod);
+    vec_copy(ret[1], t, sizeof(t));
+}
+#endif
+
+#ifdef add_mod_384x
+inline void add_mod_384x(vec384x ret, const vec384x a, const vec384x b,
+                         const vec384 mod)
+{
+    add_mod_384(ret[0], a[0], b[0], mod);
+    add_mod_384(ret[1], a[1], b[1], mod);
+}
+#endif
+
+#ifdef sub_mod_384x
+inline void sub_mod_384x(vec384x ret, const vec384x a, const vec384x b,
+                         const vec384 mod)
+{
+    sub_mod_384(ret[0], a[0], b[0], mod);
+    sub_mod_384(ret[1], a[1], b[1], mod);
+}
+#endif
+
+#ifdef lshift_mod_384x
+inline void lshift_mod_384x(vec384x ret, const vec384x a, size_t n,
+                            const vec384 mod)
+{
+    lshift_mod_384(ret[0], a[0], n, mod);
+    lshift_mod_384(ret[1], a[1], n, mod);
+}
+#endif
+
+#if defined(mul_mont_384x) && !(defined(__ADX__) && !defined(__BLST_PORTABLE__))
+void mul_mont_384x(vec384x ret, const vec384x a, const vec384x b,
+                   const vec384 mod, limb_t n0)
+{
+    vec768 t0, t1, t2;
+    vec384 aa, bb;
+
+    mul_384(t0, a[0], b[0]);
+    mul_384(t1, a[1], b[1]);
+
+    add_mod_384(aa, a[0], a[1], mod);
+    add_mod_384(bb, b[0], b[1], mod);
+    mul_384(t2, aa, bb);
+    sub_mod_384x384(t2, t2, t0, mod);
+    sub_mod_384x384(t2, t2, t1, mod);
+
+    sub_mod_384x384(t0, t0, t1, mod);
+
+    redc_mont_384(ret[0], t0, mod, n0);
+    redc_mont_384(ret[1], t2, mod, n0);
+}
+#endif
+
+#if defined(sqr_mont_384x) && !(defined(__ADX__) && !defined(__BLST_PORTABLE__))
+void sqr_mont_384x(vec384x ret, const vec384x a, const vec384 mod, limb_t n0)
+{
+    vec384 t0, t1;
+
+    add_mod_384(t0, a[0], a[1], mod);
+    sub_mod_384(t1, a[0], a[1], mod);
+
+    mul_mont_384(ret[1], a[0], a[1], mod, n0);
+    add_mod_384(ret[1], ret[1], ret[1], mod);
+
+    mul_mont_384(ret[0], t0, t1, mod, n0);
+}
+#endif
+
+limb_t div_3_limbs(const limb_t dividend_top[2], limb_t d_lo, limb_t d_hi);
+limb_t quot_rem_128(limb_t *quot_rem, const limb_t *divisor, limb_t quotient);
+limb_t quot_rem_64(limb_t *quot_rem, const limb_t *divisor, limb_t quotient);
+
+/*
+ * Divide 255-bit |val| by z^2 yielding 128-bit quotient and remainder in place.
+ */
+static void div_by_zz(limb_t val[])
+{
+    static const limb_t zz[] = { TO_LIMB_T(0x0000000100000000),
+                                 TO_LIMB_T(0xac45a4010001a402) };
+    size_t loop, zz_len = sizeof(zz)/sizeof(zz[0]);
+    limb_t d_lo, d_hi;
+
+    d_lo = zz[zz_len - 2];
+    d_hi = zz[zz_len - 1];
+    for (loop = zz_len, zz_len--; loop--;) {
+        limb_t q = div_3_limbs(val + loop + zz_len, d_lo, d_hi);
+        (void)quot_rem_128(val + loop, zz, q);
+    }
+    /* remainder is in low half of val[], quotient is in high */
+}
+
+/*
+ * Divide 128-bit |val| by z yielding 64-bit quotient and remainder in place.
+ */
+static void div_by_z(limb_t val[])
+{
+    static const limb_t z[] = { TO_LIMB_T(0xd201000000010000) };
+    size_t loop, z_len = sizeof(z)/sizeof(z[0]);
+    limb_t d_lo, d_hi;
+
+    d_lo = (sizeof(z) == sizeof(limb_t)) ? 0 : z[z_len - 2];
+    d_hi = z[z_len - 1];
+    for (loop = z_len, z_len--; loop--;) {
+        limb_t q = div_3_limbs(val + loop + z_len, d_lo, d_hi);
+        (void)quot_rem_64(val + loop, z, q);
+    }
+    /* remainder is in low half of val[], quotient is in high */
+}
diff --git a/vendor/external/blst/src/vect.h b/vendor/external/blst/src/vect.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/blst/src/vect.h
@@ -0,0 +1,438 @@
+/*
+ * Copyright Supranational LLC
+ * Licensed under the Apache License, Version 2.0, see LICENSE for details.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __BLS12_381_ASM_VECT_H__
+#define __BLS12_381_ASM_VECT_H__
+
+#include <stddef.h>
+
+#if defined(__BLST_NO_ASM__) || defined(__wasm64__)
+/* cardano-c: portable no-assembly build. Use 32-bit limbs with a 64-bit
+ * double-limb (the reference C path in no_asm.h), which compiles on every
+ * target including WASM and the armv6/armv7 cross builds. This branch is
+ * tested first so that forcing __BLST_NO_ASM__ on x86_64/aarch64 selects the
+ * portable C path instead of the (intentionally absent) assembly modules. */
+typedef unsigned int limb_t;
+# define LIMB_T_BITS    32
+# ifndef __BLST_NO_ASM__
+#  define __BLST_NO_ASM__
+# endif
+
+#elif defined(__x86_64__) || defined(__aarch64__)
+/* These are available even in ILP32 flavours, but even then they are
+ * capable of performing 64-bit operations as efficiently as in *P64. */
+typedef unsigned long long limb_t;
+# define LIMB_T_BITS    64
+
+#elif defined(_WIN64)   /* Win64 is P64 */
+typedef unsigned __int64 limb_t;
+# define LIMB_T_BITS    64
+
+#else                   /* 32 bits on 32-bit platforms, 64 - on 64-bit */
+typedef unsigned long limb_t;
+#  ifdef _LP64
+#   define LIMB_T_BITS   64
+#  else
+#   define LIMB_T_BITS   32
+#   define __BLST_NO_ASM__
+#  endif
+#endif
+
+/*
+ * Why isn't LIMB_T_BITS defined as 8*sizeof(limb_t)? Because pre-processor
+ * knows nothing about sizeof(anything)...
+ */
+#if LIMB_T_BITS == 64
+# define TO_LIMB_T(limb64)     limb64
+#else
+# define TO_LIMB_T(limb64)     (limb_t)limb64,(limb_t)(limb64>>32)
+#endif
+
+#define NLIMBS(bits)   (bits/LIMB_T_BITS)
+
+typedef limb_t vec256[NLIMBS(256)];
+typedef limb_t vec512[NLIMBS(512)];
+typedef limb_t vec384[NLIMBS(384)];
+typedef limb_t vec768[NLIMBS(768)];
+typedef vec384 vec384x[2];      /* 0 is "real" part, 1 is "imaginary" */
+
+typedef unsigned char byte;
+#define TO_BYTES(limb64)    (byte)limb64,(byte)(limb64>>8),\
+                            (byte)(limb64>>16),(byte)(limb64>>24),\
+                            (byte)(limb64>>32),(byte)(limb64>>40),\
+                            (byte)(limb64>>48),(byte)(limb64>>56)
+typedef byte pow256[256/8];
+
+/*
+ * Internal Boolean type, Boolean by value, hence safe to cast to or
+ * reinterpret as 'bool'.
+ */
+typedef limb_t bool_t;
+
+/*
+ * Assembly subroutines...
+ */
+#if defined(__ADX__) /* e.g. -march=broadwell */ && !defined(__BLST_PORTABLE__)\
+                                                 && !defined(__BLST_NO_ASM__)
+# define mul_mont_sparse_256 mulx_mont_sparse_256
+# define sqr_mont_sparse_256 sqrx_mont_sparse_256
+# define from_mont_256 fromx_mont_256
+# define redc_mont_256 redcx_mont_256
+# define mul_mont_384 mulx_mont_384
+# define sqr_mont_384 sqrx_mont_384
+# define sqr_n_mul_mont_384 sqrx_n_mul_mont_384
+# define sqr_n_mul_mont_383 sqrx_n_mul_mont_383
+# define mul_384 mulx_384
+# define sqr_384 sqrx_384
+# define redc_mont_384 redcx_mont_384
+# define from_mont_384 fromx_mont_384
+# define sgn0_pty_mont_384 sgn0x_pty_mont_384
+# define sgn0_pty_mont_384x sgn0x_pty_mont_384x
+# define ct_inverse_mod_383 ctx_inverse_mod_383
+#elif defined(__BLST_NO_ASM__)
+# define ct_inverse_mod_383 ct_inverse_mod_384
+#endif
+
+void mul_mont_sparse_256(vec256 ret, const vec256 a, const vec256 b,
+                         const vec256 p, limb_t n0);
+void sqr_mont_sparse_256(vec256 ret, const vec256 a, const vec256 p, limb_t n0);
+void redc_mont_256(vec256 ret, const vec512 a, const vec256 p, limb_t n0);
+void from_mont_256(vec256 ret, const vec256 a, const vec256 p, limb_t n0);
+
+void add_mod_256(vec256 ret, const vec256 a, const vec256 b, const vec256 p);
+void sub_mod_256(vec256 ret, const vec256 a, const vec256 b, const vec256 p);
+void mul_by_3_mod_256(vec256 ret, const vec256 a, const vec256 p);
+void cneg_mod_256(vec256 ret, const vec256 a, bool_t flag, const vec256 p);
+void lshift_mod_256(vec256 ret, const vec256 a, size_t count, const vec256 p);
+void rshift_mod_256(vec256 ret, const vec256 a, size_t count, const vec256 p);
+bool_t eucl_inverse_mod_256(vec256 ret, const vec256 a, const vec256 p,
+                            const vec256 one);
+limb_t check_mod_256(const pow256 a, const vec256 p);
+limb_t add_n_check_mod_256(pow256 ret, const pow256 a, const pow256 b,
+                                       const vec256 p);
+limb_t sub_n_check_mod_256(pow256 ret, const pow256 a, const pow256 b,
+                                       const vec256 p);
+
+void vec_prefetch(const void *ptr, size_t len);
+
+void mul_mont_384(vec384 ret, const vec384 a, const vec384 b,
+                  const vec384 p, limb_t n0);
+void sqr_mont_384(vec384 ret, const vec384 a, const vec384 p, limb_t n0);
+void sqr_n_mul_mont_384(vec384 ret, const vec384 a, size_t count,
+                        const vec384 p, limb_t n0, const vec384 b);
+void sqr_n_mul_mont_383(vec384 ret, const vec384 a, size_t count,
+                        const vec384 p, limb_t n0, const vec384 b);
+
+void mul_384(vec768 ret, const vec384 a, const vec384 b);
+void sqr_384(vec768 ret, const vec384 a);
+void redc_mont_384(vec384 ret, const vec768 a, const vec384 p, limb_t n0);
+void from_mont_384(vec384 ret, const vec384 a, const vec384 p, limb_t n0);
+limb_t sgn0_pty_mont_384(const vec384 a, const vec384 p, limb_t n0);
+limb_t sgn0_pty_mont_384x(const vec384x a, const vec384 p, limb_t n0);
+limb_t sgn0_pty_mod_384(const vec384 a, const vec384 p);
+limb_t sgn0_pty_mod_384x(const vec384x a, const vec384 p);
+
+void add_mod_384(vec384 ret, const vec384 a, const vec384 b, const vec384 p);
+void sub_mod_384(vec384 ret, const vec384 a, const vec384 b, const vec384 p);
+void mul_by_8_mod_384(vec384 ret, const vec384 a, const vec384 p);
+void mul_by_3_mod_384(vec384 ret, const vec384 a, const vec384 p);
+void cneg_mod_384(vec384 ret, const vec384 a, bool_t flag, const vec384 p);
+void lshift_mod_384(vec384 ret, const vec384 a, size_t count, const vec384 p);
+void rshift_mod_384(vec384 ret, const vec384 a, size_t count, const vec384 p);
+void div_by_2_mod_384(vec384 ret, const vec384 a, const vec384 p);
+void ct_inverse_mod_383(vec768 ret, const vec384 inp, const vec384 mod,
+                                                      const vec384 modx);
+void ct_inverse_mod_256(vec512 ret, const vec256 inp, const vec256 mod,
+                                                      const vec256 modx);
+bool_t ct_is_square_mod_384(const vec384 inp, const vec384 mod);
+
+#if defined(__ADX__) /* e.g. -march=broadwell */ && !defined(__BLST_PORTABLE__)
+# define mul_mont_384x mulx_mont_384x
+# define sqr_mont_384x sqrx_mont_384x
+# define sqr_mont_382x sqrx_mont_382x
+# define mul_382x mulx_382x
+# define sqr_382x sqrx_382x
+#endif
+
+void mul_mont_384x(vec384x ret, const vec384x a, const vec384x b,
+                   const vec384 p, limb_t n0);
+void sqr_mont_384x(vec384x ret, const vec384x a, const vec384 p, limb_t n0);
+void sqr_mont_382x(vec384x ret, const vec384x a, const vec384 p, limb_t n0);
+void mul_382x(vec768 ret[2], const vec384x a, const vec384x b, const vec384 p);
+void sqr_382x(vec768 ret[2], const vec384x a, const vec384 p);
+
+void add_mod_384x(vec384x ret, const vec384x a, const vec384x b,
+                  const vec384 p);
+void sub_mod_384x(vec384x ret, const vec384x a, const vec384x b,
+                  const vec384 p);
+void mul_by_8_mod_384x(vec384x ret, const vec384x a, const vec384 p);
+void mul_by_3_mod_384x(vec384x ret, const vec384x a, const vec384 p);
+void mul_by_1_plus_i_mod_384x(vec384x ret, const vec384x a, const vec384 p);
+void add_mod_384x384(vec768 ret, const vec768 a, const vec768 b,
+                     const vec384 p);
+void sub_mod_384x384(vec768 ret, const vec768 a, const vec768 b,
+                     const vec384 p);
+
+/*
+ * C subroutines
+ */
+static void exp_mont_384(vec384 out, const vec384 inp, const byte *pow,
+                         size_t pow_bits, const vec384 p, limb_t n0);
+static void exp_mont_384x(vec384x out, const vec384x inp, const byte *pow,
+                          size_t pow_bits, const vec384 p, limb_t n0);
+static void div_by_zz(limb_t val[]);
+static void div_by_z(limb_t val[]);
+
+#ifdef __UINTPTR_TYPE__
+typedef __UINTPTR_TYPE__ uptr_t;
+#else
+typedef const void *uptr_t;
+#endif
+
+#if !defined(restrict)
+# if !defined(__STDC_VERSION__) || __STDC_VERSION__<199901
+#  if defined(__GNUC__) && __GNUC__>=2
+#   define restrict __restrict__
+#  elif defined(_MSC_VER)
+#   define restrict __restrict
+#  else
+#   define restrict
+#  endif
+# endif
+#endif
+
+#if !defined(inline) && !defined(__cplusplus)
+# if !defined(__STDC_VERSION__) || __STDC_VERSION__<199901
+#  if defined(__GNUC__) && __GNUC__>=2
+#   define inline __inline__
+#  elif defined(_MSC_VER)
+#   define inline __inline
+#  else
+#   define inline
+#  endif
+# endif
+#endif
+
+#if defined(__GNUC__) || defined(__clang__)
+# define launder(var) __asm__ __volatile__("" : "+r"(var))
+#else
+# define launder(var)
+#endif
+
+static inline bool_t is_bit_set(const byte *v, size_t i)
+{
+    bool_t ret = (v[i/8] >> (i%8)) & 1;
+    launder(ret);
+    return ret;
+}
+
+static inline bool_t byte_is_zero(unsigned char c)
+{
+    limb_t ret = ((limb_t)(c) - 1) >> (LIMB_T_BITS - 1);
+    launder(ret);
+    return ret;
+}
+
+static inline bool_t bytes_are_zero(const unsigned char *a, size_t num)
+{
+    unsigned char acc;
+    size_t i;
+
+    for (acc = 0, i = 0; i < num; i++)
+        acc |= a[i];
+
+    return byte_is_zero(acc);
+}
+
+static inline void vec_cswap(void *restrict a, void *restrict b, size_t num,
+                             bool_t cbit)
+{
+    limb_t ai, *ap = (limb_t *)a;
+    limb_t bi, *bp = (limb_t *)b;
+    limb_t xorm, mask;
+    size_t i;
+
+    launder(cbit);
+    mask = (limb_t)0 - cbit;
+
+    num /= sizeof(limb_t);
+
+    for (i = 0; i < num; i++) {
+        xorm = ((ai = ap[i]) ^ (bi = bp[i])) & mask;
+        ap[i] = ai ^ xorm;
+        bp[i] = bi ^ xorm;
+    }
+}
+
+/* ret = bit ? a : b */
+void vec_select_32(void *ret, const void *a, const void *b, bool_t sel_a);
+void vec_select_48(void *ret, const void *a, const void *b, bool_t sel_a);
+void vec_select_96(void *ret, const void *a, const void *b, bool_t sel_a);
+void vec_select_144(void *ret, const void *a, const void *b, bool_t sel_a);
+void vec_select_192(void *ret, const void *a, const void *b, bool_t sel_a);
+void vec_select_288(void *ret, const void *a, const void *b, bool_t sel_a);
+static inline void vec_select(void *ret, const void *a, const void *b,
+                              size_t num, bool_t sel_a)
+{
+    launder(sel_a);
+#ifndef __BLST_NO_ASM__
+    if (num == 32)          vec_select_32(ret, a, b, sel_a);
+    else if (num == 48)     vec_select_48(ret, a, b, sel_a);
+    else if (num == 96)     vec_select_96(ret, a, b, sel_a);
+    else if (num == 144)    vec_select_144(ret, a, b, sel_a);
+    else if (num == 192)    vec_select_192(ret, a, b, sel_a);
+    else if (num == 288)    vec_select_288(ret, a, b, sel_a);
+#else
+    if (0) ;
+#endif
+    else {
+        limb_t bi;
+        volatile limb_t *rp = (limb_t *)ret;
+        const limb_t *ap = (const limb_t *)a;
+        const limb_t *bp = (const limb_t *)b;
+        limb_t xorm, mask = (limb_t)0 - sel_a;
+        size_t i;
+
+        num /= sizeof(limb_t);
+
+        for (i = 0; i < num; i++) {
+            xorm = (ap[i] ^ (bi = bp[i])) & mask;
+            rp[i] = bi ^ xorm;
+        }
+    }
+}
+
+static inline bool_t is_zero(limb_t l)
+{
+    limb_t ret = (~l & (l - 1)) >> (LIMB_T_BITS - 1);
+    launder(ret);
+    return ret;
+}
+
+static inline bool_t vec_is_zero(const void *a, size_t num)
+{
+    const limb_t *ap = (const limb_t *)a;
+    limb_t acc;
+    size_t i;
+
+#ifndef __BLST_NO_ASM__
+    bool_t vec_is_zero_16x(const void *a, size_t num);
+    if ((num & 15) == 0)
+        return vec_is_zero_16x(a, num);
+#endif
+
+    num /= sizeof(limb_t);
+
+    for (acc = 0, i = 0; i < num; i++)
+        acc |= ap[i];
+
+    return is_zero(acc);
+}
+
+static inline bool_t vec_is_equal(const void *a, const void *b, size_t num)
+{
+    const limb_t *ap = (const limb_t *)a;
+    const limb_t *bp = (const limb_t *)b;
+    limb_t acc;
+    size_t i;
+
+#ifndef __BLST_NO_ASM__
+    bool_t vec_is_equal_16x(const void *a, const void *b, size_t num);
+    if ((num & 15) == 0)
+        return vec_is_equal_16x(a, b, num);
+#endif
+
+    num /= sizeof(limb_t);
+
+    for (acc = 0, i = 0; i < num; i++)
+        acc |= ap[i] ^ bp[i];
+
+    return is_zero(acc);
+}
+
+static inline void cneg_mod_384x(vec384x ret, const vec384x a, bool_t flag,
+                                 const vec384 p)
+{
+    cneg_mod_384(ret[0], a[0], flag, p);
+    cneg_mod_384(ret[1], a[1], flag, p);
+}
+
+static inline void vec_copy(void *restrict ret, const void *a, size_t num)
+{
+    limb_t *rp = (limb_t *)ret;
+    const limb_t *ap = (const limb_t *)a;
+    size_t i;
+
+    num /= sizeof(limb_t);
+
+    for (i = 0; i < num; i++)
+        rp[i] = ap[i];
+}
+
+static inline void vec_zero(void *ret, size_t num)
+{
+    volatile limb_t *rp = (volatile limb_t *)ret;
+    size_t i;
+
+    num /= sizeof(limb_t);
+
+    for (i = 0; i < num; i++)
+        rp[i] = 0;
+
+#if defined(__GNUC__) || defined(__clang__)
+    __asm__ __volatile__("" : : "r"(ret) : "memory");
+#endif
+}
+
+static inline void vec_czero(void *ret, size_t num, bool_t cbit)
+{
+    limb_t *rp = (limb_t *)ret;
+    size_t i;
+    limb_t mask;
+
+    launder(cbit);
+    mask = (limb_t)0 - (cbit^1);
+
+    num /= sizeof(limb_t);
+
+    for (i = 0; i < num; i++)
+        rp[i] &= mask;
+}
+
+/*
+ * Some compilers get arguably overzealous(*) when passing pointer to
+ * multi-dimensional array [such as vec384x] as 'const' argument.
+ * General direction seems to be to legitimize such constification,
+ * so it's argued that suppressing the warning is appropriate.
+ *
+ * (*)  http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1923.htm
+ */
+#if defined(__INTEL_COMPILER)
+# pragma warning(disable:167)
+# pragma warning(disable:556)
+#elif defined(__GNUC__) && !defined(__clang__)
+# pragma GCC diagnostic ignored "-Wpedantic"
+#elif defined(_MSC_VER)
+# pragma warning(disable: 4127 4189)
+#endif
+
+#if !defined(__wasm__) && __STDC_HOSTED__-0 != 0
+# include <stdlib.h>
+#endif
+
+#if defined(__GNUC__)
+# ifndef alloca
+#  define alloca(s) __builtin_alloca(s)
+# endif
+#elif defined(__sun)
+# include <alloca.h>
+#elif defined(_WIN32)
+# include <malloc.h>
+# ifndef alloca
+#  define alloca(s) _alloca(s)
+# endif
+#endif
+
+#endif /* __BLS12_381_ASM_VECT_H__ */
diff --git a/vendor/external/gmp/README b/vendor/external/gmp/README
new file mode 100644
--- /dev/null
+++ b/vendor/external/gmp/README
@@ -0,0 +1,79 @@
+Copyright 2011-2013, 2018 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+  * the GNU Lesser General Public License as published by the Free
+    Software Foundation; either version 3 of the License, or (at your
+    option) any later version.
+
+or
+
+  * the GNU General Public License as published by the Free Software
+    Foundation; either version 2 of the License, or (at your option) any
+    later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.
+
+
+This is "mini-gmp", a small implementation of a subset of GMP's mpn,
+mpz and mpq interfaces.
+
+It is intended for applications which need arithmetic on numbers
+larger than a machine word, but which don't need to handle very large
+numbers very efficiently. Those applications can include a copy of
+mini-gmp to get a GMP-compatible interface with small footprint. One
+can also arrange for optional linking with the real GMP library, using
+mini-gmp as a fallback when for some reason GMP is not available, or
+not desired as a dependency.
+
+The supported GMP subset of the mpn and mpz interfaces is declared in
+mini-gmp.h, and implemented in mini-gmp.c. The implemented
+functions are fully compatible with the corresponding GMP functions,
+as specified in the GMP manual, with a few exceptions:
+
+  mpz_export and mpz_import support only NAILS = 0.
+
+  The REALLOC_FUNC and FREE_FUNC registered with
+  mp_set_memory_functions does not get the correct size of the
+  allocated block in the corresponding argument. mini-gmp always
+  passes zero for these rarely used arguments.
+
+  When mpz_get_str allocates the block, it can be longer than needed.
+
+The performance target for mini-gmp is to be at most 10 times slower
+than the real GMP library, for numbers of size up to a few hundred
+bits. No asymptotically fast algorithms are included in mini-gmp, so
+it will be many orders of magnitude slower than GMP for very large
+numbers.
+
+The supported GMP subset of the mpq layer is declared in mini-mpq.h,
+and implemented in mini-mpq.c.
+
+You should never "install" mini-gmp. Applications can either just
+#include mini-gmp.c (but then, beware that it defines several macros
+and functions outside of the advertised interface), and if needed
+#include mini-mpq.c in a later line (order is important). Or compile
+mini-gmp.c and mini-mpq.c as separate compilation units, and use the
+declarations in mini-gmp.h and mini-mpq.h.
+
+The tests subdirectory contains a testsuite. To use it, you need GMP
+and GNU make. Just run make check in the tests directory. If the
+hard-coded compiler settings are not right, you have to either edit the
+Makefile or pass overriding values on the make command line (e.g.,
+make CC=cc check).
+
+The initial version of mini-gmp was put together by Niels Möller
+<nisse@lysator.liu.se>, with a fair amount of copy-and-paste from the
+GMP sources.
diff --git a/vendor/external/gmp/mini-gmp.c b/vendor/external/gmp/mini-gmp.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/gmp/mini-gmp.c
@@ -0,0 +1,4572 @@
+/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
+
+   Contributed to the GNU project by Niels Möller
+
+Copyright 1991-1997, 1999-2019 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+  * the GNU Lesser General Public License as published by the Free
+    Software Foundation; either version 3 of the License, or (at your
+    option) any later version.
+
+or
+
+  * the GNU General Public License as published by the Free Software
+    Foundation; either version 2 of the License, or (at your option) any
+    later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
+
+/* NOTE: All functions in this file which are not declared in
+   mini-gmp.h are internal, and are not intended to be compatible
+   with GMP or with future versions of mini-gmp. */
+
+/* Much of the material copied from GMP files, including: gmp-impl.h,
+   longlong.h, mpn/generic/add_n.c, mpn/generic/addmul_1.c,
+   mpn/generic/lshift.c, mpn/generic/mul_1.c,
+   mpn/generic/mul_basecase.c, mpn/generic/rshift.c,
+   mpn/generic/sbpi1_div_qr.c, mpn/generic/sub_n.c,
+   mpn/generic/submul_1.c. */
+
+#include <assert.h>
+#include <ctype.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mini-gmp.h"
+
+#if !defined(MINI_GMP_DONT_USE_FLOAT_H)
+#include <float.h>
+#endif
+
+
+/* Macros */
+#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
+
+#define GMP_LIMB_MAX ((mp_limb_t) ~ (mp_limb_t) 0)
+#define GMP_LIMB_HIGHBIT ((mp_limb_t) 1 << (GMP_LIMB_BITS - 1))
+
+#define GMP_HLIMB_BIT ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2))
+#define GMP_LLIMB_MASK (GMP_HLIMB_BIT - 1)
+
+#define GMP_ULONG_BITS (sizeof(unsigned long) * CHAR_BIT)
+#define GMP_ULONG_HIGHBIT ((unsigned long) 1 << (GMP_ULONG_BITS - 1))
+
+#define GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
+#define GMP_NEG_CAST(T,x) (-((T)((x) + 1) - 1))
+
+#define GMP_MIN(a, b) ((a) < (b) ? (a) : (b))
+#define GMP_MAX(a, b) ((a) > (b) ? (a) : (b))
+
+#define GMP_CMP(a,b) (((a) > (b)) - ((a) < (b)))
+
+#if defined(DBL_MANT_DIG) && FLT_RADIX == 2
+#define GMP_DBL_MANT_BITS DBL_MANT_DIG
+#else
+#define GMP_DBL_MANT_BITS (53)
+#endif
+
+/* Return non-zero if xp,xsize and yp,ysize overlap.
+   If xp+xsize<=yp there's no overlap, or if yp+ysize<=xp there's no
+   overlap.  If both these are false, there's an overlap. */
+#define GMP_MPN_OVERLAP_P(xp, xsize, yp, ysize)				\
+  ((xp) + (xsize) > (yp) && (yp) + (ysize) > (xp))
+
+#define gmp_assert_nocarry(x) do { \
+    mp_limb_t __cy = (x);	   \
+    assert (__cy == 0);		   \
+  } while (0)
+
+#define gmp_clz(count, x) do {						\
+    mp_limb_t __clz_x = (x);						\
+    unsigned __clz_c = 0;						\
+    int LOCAL_SHIFT_BITS = 8;						\
+    if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)				\
+      for (;								\
+	   (__clz_x & ((mp_limb_t) 0xff << (GMP_LIMB_BITS - 8))) == 0;	\
+	   __clz_c += 8)						\
+	{ __clz_x <<= LOCAL_SHIFT_BITS;	}				\
+    for (; (__clz_x & GMP_LIMB_HIGHBIT) == 0; __clz_c++)		\
+      __clz_x <<= 1;							\
+    (count) = __clz_c;							\
+  } while (0)
+
+#define gmp_ctz(count, x) do {						\
+    mp_limb_t __ctz_x = (x);						\
+    unsigned __ctz_c = 0;						\
+    gmp_clz (__ctz_c, __ctz_x & - __ctz_x);				\
+    (count) = GMP_LIMB_BITS - 1 - __ctz_c;				\
+  } while (0)
+
+#define gmp_add_ssaaaa(sh, sl, ah, al, bh, bl) \
+  do {									\
+    mp_limb_t __x;							\
+    __x = (al) + (bl);							\
+    (sh) = (ah) + (bh) + (__x < (al));					\
+    (sl) = __x;								\
+  } while (0)
+
+#define gmp_sub_ddmmss(sh, sl, ah, al, bh, bl) \
+  do {									\
+    mp_limb_t __x;							\
+    __x = (al) - (bl);							\
+    (sh) = (ah) - (bh) - ((al) < (bl));					\
+    (sl) = __x;								\
+  } while (0)
+
+#define gmp_umul_ppmm(w1, w0, u, v)					\
+  do {									\
+    int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;				\
+    if (sizeof(unsigned int) * CHAR_BIT >= 2 * GMP_LIMB_BITS)		\
+      {									\
+	unsigned int __ww = (unsigned int) (u) * (v);			\
+	w0 = (mp_limb_t) __ww;						\
+	w1 = (mp_limb_t) (__ww >> LOCAL_GMP_LIMB_BITS);			\
+      }									\
+    else if (GMP_ULONG_BITS >= 2 * GMP_LIMB_BITS)			\
+      {									\
+	unsigned long int __ww = (unsigned long int) (u) * (v);		\
+	w0 = (mp_limb_t) __ww;						\
+	w1 = (mp_limb_t) (__ww >> LOCAL_GMP_LIMB_BITS);			\
+      }									\
+    else {								\
+      mp_limb_t __x0, __x1, __x2, __x3;					\
+      unsigned __ul, __vl, __uh, __vh;					\
+      mp_limb_t __u = (u), __v = (v);					\
+									\
+      __ul = __u & GMP_LLIMB_MASK;					\
+      __uh = __u >> (GMP_LIMB_BITS / 2);				\
+      __vl = __v & GMP_LLIMB_MASK;					\
+      __vh = __v >> (GMP_LIMB_BITS / 2);				\
+									\
+      __x0 = (mp_limb_t) __ul * __vl;					\
+      __x1 = (mp_limb_t) __ul * __vh;					\
+      __x2 = (mp_limb_t) __uh * __vl;					\
+      __x3 = (mp_limb_t) __uh * __vh;					\
+									\
+      __x1 += __x0 >> (GMP_LIMB_BITS / 2);/* this can't give carry */	\
+      __x1 += __x2;		/* but this indeed can */		\
+      if (__x1 < __x2)		/* did we get it? */			\
+	__x3 += GMP_HLIMB_BIT;	/* yes, add it in the proper pos. */	\
+									\
+      (w1) = __x3 + (__x1 >> (GMP_LIMB_BITS / 2));			\
+      (w0) = (__x1 << (GMP_LIMB_BITS / 2)) + (__x0 & GMP_LLIMB_MASK);	\
+    }									\
+  } while (0)
+
+#define gmp_udiv_qrnnd_preinv(q, r, nh, nl, d, di)			\
+  do {									\
+    mp_limb_t _qh, _ql, _r, _mask;					\
+    gmp_umul_ppmm (_qh, _ql, (nh), (di));				\
+    gmp_add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl));		\
+    _r = (nl) - _qh * (d);						\
+    _mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */		\
+    _qh += _mask;							\
+    _r += _mask & (d);							\
+    if (_r >= (d))							\
+      {									\
+	_r -= (d);							\
+	_qh++;								\
+      }									\
+									\
+    (r) = _r;								\
+    (q) = _qh;								\
+  } while (0)
+
+#define gmp_udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv)		\
+  do {									\
+    mp_limb_t _q0, _t1, _t0, _mask;					\
+    gmp_umul_ppmm ((q), _q0, (n2), (dinv));				\
+    gmp_add_ssaaaa ((q), _q0, (q), _q0, (n2), (n1));			\
+									\
+    /* Compute the two most significant limbs of n - q'd */		\
+    (r1) = (n1) - (d1) * (q);						\
+    gmp_sub_ddmmss ((r1), (r0), (r1), (n0), (d1), (d0));		\
+    gmp_umul_ppmm (_t1, _t0, (d0), (q));				\
+    gmp_sub_ddmmss ((r1), (r0), (r1), (r0), _t1, _t0);			\
+    (q)++;								\
+									\
+    /* Conditionally adjust q and the remainders */			\
+    _mask = - (mp_limb_t) ((r1) >= _q0);				\
+    (q) += _mask;							\
+    gmp_add_ssaaaa ((r1), (r0), (r1), (r0), _mask & (d1), _mask & (d0)); \
+    if ((r1) >= (d1))							\
+      {									\
+	if ((r1) > (d1) || (r0) >= (d0))				\
+	  {								\
+	    (q)++;							\
+	    gmp_sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0));	\
+	  }								\
+      }									\
+  } while (0)
+
+/* Swap macros. */
+#define MP_LIMB_T_SWAP(x, y)						\
+  do {									\
+    mp_limb_t __mp_limb_t_swap__tmp = (x);				\
+    (x) = (y);								\
+    (y) = __mp_limb_t_swap__tmp;					\
+  } while (0)
+#define MP_SIZE_T_SWAP(x, y)						\
+  do {									\
+    mp_size_t __mp_size_t_swap__tmp = (x);				\
+    (x) = (y);								\
+    (y) = __mp_size_t_swap__tmp;					\
+  } while (0)
+#define MP_BITCNT_T_SWAP(x,y)			\
+  do {						\
+    mp_bitcnt_t __mp_bitcnt_t_swap__tmp = (x);	\
+    (x) = (y);					\
+    (y) = __mp_bitcnt_t_swap__tmp;		\
+  } while (0)
+#define MP_PTR_SWAP(x, y)						\
+  do {									\
+    mp_ptr __mp_ptr_swap__tmp = (x);					\
+    (x) = (y);								\
+    (y) = __mp_ptr_swap__tmp;						\
+  } while (0)
+#define MP_SRCPTR_SWAP(x, y)						\
+  do {									\
+    mp_srcptr __mp_srcptr_swap__tmp = (x);				\
+    (x) = (y);								\
+    (y) = __mp_srcptr_swap__tmp;					\
+  } while (0)
+
+#define MPN_PTR_SWAP(xp,xs, yp,ys)					\
+  do {									\
+    MP_PTR_SWAP (xp, yp);						\
+    MP_SIZE_T_SWAP (xs, ys);						\
+  } while(0)
+#define MPN_SRCPTR_SWAP(xp,xs, yp,ys)					\
+  do {									\
+    MP_SRCPTR_SWAP (xp, yp);						\
+    MP_SIZE_T_SWAP (xs, ys);						\
+  } while(0)
+
+#define MPZ_PTR_SWAP(x, y)						\
+  do {									\
+    mpz_ptr __mpz_ptr_swap__tmp = (x);					\
+    (x) = (y);								\
+    (y) = __mpz_ptr_swap__tmp;						\
+  } while (0)
+#define MPZ_SRCPTR_SWAP(x, y)						\
+  do {									\
+    mpz_srcptr __mpz_srcptr_swap__tmp = (x);				\
+    (x) = (y);								\
+    (y) = __mpz_srcptr_swap__tmp;					\
+  } while (0)
+
+const int mp_bits_per_limb = GMP_LIMB_BITS;
+
+/* Memory allocation and other helper functions. */
+static void
+gmp_die (const char *msg)
+{
+  fprintf (stderr, "%s\n", msg);
+  abort();
+}
+
+static void *
+gmp_default_alloc (size_t size)
+{
+  void *p;
+
+  assert (size > 0);
+
+  p = malloc (size);
+  if (!p)
+    gmp_die("gmp_default_alloc: Virtual memory exhausted.");
+
+  return p;
+}
+
+static void *
+gmp_default_realloc (void *old, size_t unused_old_size, size_t new_size)
+{
+  void * p;
+
+  p = realloc (old, new_size);
+
+  if (!p)
+    gmp_die("gmp_default_realloc: Virtual memory exhausted.");
+
+  return p;
+}
+
+static void
+gmp_default_free (void *p, size_t unused_size)
+{
+  free (p);
+}
+
+static void * (*gmp_allocate_func) (size_t) = gmp_default_alloc;
+static void * (*gmp_reallocate_func) (void *, size_t, size_t) = gmp_default_realloc;
+static void (*gmp_free_func) (void *, size_t) = gmp_default_free;
+
+void
+mp_get_memory_functions (void *(**alloc_func) (size_t),
+			 void *(**realloc_func) (void *, size_t, size_t),
+			 void (**free_func) (void *, size_t))
+{
+  if (alloc_func)
+    *alloc_func = gmp_allocate_func;
+
+  if (realloc_func)
+    *realloc_func = gmp_reallocate_func;
+
+  if (free_func)
+    *free_func = gmp_free_func;
+}
+
+void
+mp_set_memory_functions (void *(*alloc_func) (size_t),
+			 void *(*realloc_func) (void *, size_t, size_t),
+			 void (*free_func) (void *, size_t))
+{
+  if (!alloc_func)
+    alloc_func = gmp_default_alloc;
+  if (!realloc_func)
+    realloc_func = gmp_default_realloc;
+  if (!free_func)
+    free_func = gmp_default_free;
+
+  gmp_allocate_func = alloc_func;
+  gmp_reallocate_func = realloc_func;
+  gmp_free_func = free_func;
+}
+
+#define gmp_xalloc(size) ((*gmp_allocate_func)((size)))
+#define gmp_free(p) ((*gmp_free_func) ((p), 0))
+
+static mp_ptr
+gmp_xalloc_limbs (mp_size_t size)
+{
+  return (mp_ptr) gmp_xalloc (size * sizeof (mp_limb_t));
+}
+
+static mp_ptr
+gmp_xrealloc_limbs (mp_ptr old, mp_size_t size)
+{
+  assert (size > 0);
+  return (mp_ptr) (*gmp_reallocate_func) (old, 0, size * sizeof (mp_limb_t));
+}
+
+
+/* MPN interface */
+
+void
+mpn_copyi (mp_ptr d, mp_srcptr s, mp_size_t n)
+{
+  mp_size_t i;
+  for (i = 0; i < n; i++)
+    d[i] = s[i];
+}
+
+void
+mpn_copyd (mp_ptr d, mp_srcptr s, mp_size_t n)
+{
+  while (--n >= 0)
+    d[n] = s[n];
+}
+
+int
+mpn_cmp (mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  while (--n >= 0)
+    {
+      if (ap[n] != bp[n])
+	return ap[n] > bp[n] ? 1 : -1;
+    }
+  return 0;
+}
+
+static int
+mpn_cmp4 (mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
+{
+  if (an != bn)
+    return an < bn ? -1 : 1;
+  else
+    return mpn_cmp (ap, bp, an);
+}
+
+static mp_size_t
+mpn_normalized_size (mp_srcptr xp, mp_size_t n)
+{
+  while (n > 0 && xp[n-1] == 0)
+    --n;
+  return n;
+}
+
+int
+mpn_zero_p(mp_srcptr rp, mp_size_t n)
+{
+  return mpn_normalized_size (rp, n) == 0;
+}
+
+void
+mpn_zero (mp_ptr rp, mp_size_t n)
+{
+  while (--n >= 0)
+    rp[n] = 0;
+}
+
+mp_limb_t
+mpn_add_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
+{
+  mp_size_t i;
+
+  assert (n > 0);
+  i = 0;
+  do
+    {
+      mp_limb_t r = ap[i] + b;
+      /* Carry out */
+      b = (r < b);
+      rp[i] = r;
+    }
+  while (++i < n);
+
+  return b;
+}
+
+mp_limb_t
+mpn_add_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  mp_size_t i;
+  mp_limb_t cy;
+
+  for (i = 0, cy = 0; i < n; i++)
+    {
+      mp_limb_t a, b, r;
+      a = ap[i]; b = bp[i];
+      r = a + cy;
+      cy = (r < cy);
+      r += b;
+      cy += (r < b);
+      rp[i] = r;
+    }
+  return cy;
+}
+
+mp_limb_t
+mpn_add (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
+{
+  mp_limb_t cy;
+
+  assert (an >= bn);
+
+  cy = mpn_add_n (rp, ap, bp, bn);
+  if (an > bn)
+    cy = mpn_add_1 (rp + bn, ap + bn, an - bn, cy);
+  return cy;
+}
+
+mp_limb_t
+mpn_sub_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
+{
+  mp_size_t i;
+
+  assert (n > 0);
+
+  i = 0;
+  do
+    {
+      mp_limb_t a = ap[i];
+      /* Carry out */
+      mp_limb_t cy = a < b;
+      rp[i] = a - b;
+      b = cy;
+    }
+  while (++i < n);
+
+  return b;
+}
+
+mp_limb_t
+mpn_sub_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  mp_size_t i;
+  mp_limb_t cy;
+
+  for (i = 0, cy = 0; i < n; i++)
+    {
+      mp_limb_t a, b;
+      a = ap[i]; b = bp[i];
+      b += cy;
+      cy = (b < cy);
+      cy += (a < b);
+      rp[i] = a - b;
+    }
+  return cy;
+}
+
+mp_limb_t
+mpn_sub (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
+{
+  mp_limb_t cy;
+
+  assert (an >= bn);
+
+  cy = mpn_sub_n (rp, ap, bp, bn);
+  if (an > bn)
+    cy = mpn_sub_1 (rp + bn, ap + bn, an - bn, cy);
+  return cy;
+}
+
+mp_limb_t
+mpn_mul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+{
+  mp_limb_t ul, cl, hpl, lpl;
+
+  assert (n >= 1);
+
+  cl = 0;
+  do
+    {
+      ul = *up++;
+      gmp_umul_ppmm (hpl, lpl, ul, vl);
+
+      lpl += cl;
+      cl = (lpl < cl) + hpl;
+
+      *rp++ = lpl;
+    }
+  while (--n != 0);
+
+  return cl;
+}
+
+mp_limb_t
+mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+{
+  mp_limb_t ul, cl, hpl, lpl, rl;
+
+  assert (n >= 1);
+
+  cl = 0;
+  do
+    {
+      ul = *up++;
+      gmp_umul_ppmm (hpl, lpl, ul, vl);
+
+      lpl += cl;
+      cl = (lpl < cl) + hpl;
+
+      rl = *rp;
+      lpl = rl + lpl;
+      cl += lpl < rl;
+      *rp++ = lpl;
+    }
+  while (--n != 0);
+
+  return cl;
+}
+
+mp_limb_t
+mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
+{
+  mp_limb_t ul, cl, hpl, lpl, rl;
+
+  assert (n >= 1);
+
+  cl = 0;
+  do
+    {
+      ul = *up++;
+      gmp_umul_ppmm (hpl, lpl, ul, vl);
+
+      lpl += cl;
+      cl = (lpl < cl) + hpl;
+
+      rl = *rp;
+      lpl = rl - lpl;
+      cl += lpl > rl;
+      *rp++ = lpl;
+    }
+  while (--n != 0);
+
+  return cl;
+}
+
+mp_limb_t
+mpn_mul (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn)
+{
+  assert (un >= vn);
+  assert (vn >= 1);
+  assert (!GMP_MPN_OVERLAP_P(rp, un + vn, up, un));
+  assert (!GMP_MPN_OVERLAP_P(rp, un + vn, vp, vn));
+
+  /* We first multiply by the low order limb. This result can be
+     stored, not added, to rp. We also avoid a loop for zeroing this
+     way. */
+
+  rp[un] = mpn_mul_1 (rp, up, un, vp[0]);
+
+  /* Now accumulate the product of up[] and the next higher limb from
+     vp[]. */
+
+  while (--vn >= 1)
+    {
+      rp += 1, vp += 1;
+      rp[un] = mpn_addmul_1 (rp, up, un, vp[0]);
+    }
+  return rp[un];
+}
+
+void
+mpn_mul_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
+{
+  mpn_mul (rp, ap, n, bp, n);
+}
+
+void
+mpn_sqr (mp_ptr rp, mp_srcptr ap, mp_size_t n)
+{
+  mpn_mul (rp, ap, n, ap, n);
+}
+
+mp_limb_t
+mpn_lshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
+{
+  mp_limb_t high_limb, low_limb;
+  unsigned int tnc;
+  mp_limb_t retval;
+
+  assert (n >= 1);
+  assert (cnt >= 1);
+  assert (cnt < GMP_LIMB_BITS);
+
+  up += n;
+  rp += n;
+
+  tnc = GMP_LIMB_BITS - cnt;
+  low_limb = *--up;
+  retval = low_limb >> tnc;
+  high_limb = (low_limb << cnt);
+
+  while (--n != 0)
+    {
+      low_limb = *--up;
+      *--rp = high_limb | (low_limb >> tnc);
+      high_limb = (low_limb << cnt);
+    }
+  *--rp = high_limb;
+
+  return retval;
+}
+
+mp_limb_t
+mpn_rshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
+{
+  mp_limb_t high_limb, low_limb;
+  unsigned int tnc;
+  mp_limb_t retval;
+
+  assert (n >= 1);
+  assert (cnt >= 1);
+  assert (cnt < GMP_LIMB_BITS);
+
+  tnc = GMP_LIMB_BITS - cnt;
+  high_limb = *up++;
+  retval = (high_limb << tnc);
+  low_limb = high_limb >> cnt;
+
+  while (--n != 0)
+    {
+      high_limb = *up++;
+      *rp++ = low_limb | (high_limb << tnc);
+      low_limb = high_limb >> cnt;
+    }
+  *rp = low_limb;
+
+  return retval;
+}
+
+static mp_bitcnt_t
+mpn_common_scan (mp_limb_t limb, mp_size_t i, mp_srcptr up, mp_size_t un,
+		 mp_limb_t ux)
+{
+  unsigned cnt;
+
+  assert (ux == 0 || ux == GMP_LIMB_MAX);
+  assert (0 <= i && i <= un );
+
+  while (limb == 0)
+    {
+      i++;
+      if (i == un)
+	return (ux == 0 ? ~(mp_bitcnt_t) 0 : un * GMP_LIMB_BITS);
+      limb = ux ^ up[i];
+    }
+  gmp_ctz (cnt, limb);
+  return (mp_bitcnt_t) i * GMP_LIMB_BITS + cnt;
+}
+
+mp_bitcnt_t
+mpn_scan1 (mp_srcptr ptr, mp_bitcnt_t bit)
+{
+  mp_size_t i;
+  i = bit / GMP_LIMB_BITS;
+
+  return mpn_common_scan ( ptr[i] & (GMP_LIMB_MAX << (bit % GMP_LIMB_BITS)),
+			  i, ptr, i, 0);
+}
+
+mp_bitcnt_t
+mpn_scan0 (mp_srcptr ptr, mp_bitcnt_t bit)
+{
+  mp_size_t i;
+  i = bit / GMP_LIMB_BITS;
+
+  return mpn_common_scan (~ptr[i] & (GMP_LIMB_MAX << (bit % GMP_LIMB_BITS)),
+			  i, ptr, i, GMP_LIMB_MAX);
+}
+
+void
+mpn_com (mp_ptr rp, mp_srcptr up, mp_size_t n)
+{
+  while (--n >= 0)
+    *rp++ = ~ *up++;
+}
+
+mp_limb_t
+mpn_neg (mp_ptr rp, mp_srcptr up, mp_size_t n)
+{
+  while (*up == 0)
+    {
+      *rp = 0;
+      if (!--n)
+	return 0;
+      ++up; ++rp;
+    }
+  *rp = - *up;
+  mpn_com (++rp, ++up, --n);
+  return 1;
+}
+
+
+/* MPN division interface. */
+
+/* The 3/2 inverse is defined as
+
+     m = floor( (B^3-1) / (B u1 + u0)) - B
+*/
+mp_limb_t
+mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
+{
+  mp_limb_t r, m;
+
+  {
+    mp_limb_t p, ql;
+    unsigned ul, uh, qh;
+
+    /* For notation, let b denote the half-limb base, so that B = b^2.
+       Split u1 = b uh + ul. */
+    ul = u1 & GMP_LLIMB_MASK;
+    uh = u1 >> (GMP_LIMB_BITS / 2);
+
+    /* Approximation of the high half of quotient. Differs from the 2/1
+       inverse of the half limb uh, since we have already subtracted
+       u0. */
+    qh = (u1 ^ GMP_LIMB_MAX) / uh;
+
+    /* Adjust to get a half-limb 3/2 inverse, i.e., we want
+
+       qh' = floor( (b^3 - 1) / u) - b = floor ((b^3 - b u - 1) / u
+	   = floor( (b (~u) + b-1) / u),
+
+       and the remainder
+
+       r = b (~u) + b-1 - qh (b uh + ul)
+       = b (~u - qh uh) + b-1 - qh ul
+
+       Subtraction of qh ul may underflow, which implies adjustments.
+       But by normalization, 2 u >= B > qh ul, so we need to adjust by
+       at most 2.
+    */
+
+    r = ((~u1 - (mp_limb_t) qh * uh) << (GMP_LIMB_BITS / 2)) | GMP_LLIMB_MASK;
+
+    p = (mp_limb_t) qh * ul;
+    /* Adjustment steps taken from udiv_qrnnd_c */
+    if (r < p)
+      {
+	qh--;
+	r += u1;
+	if (r >= u1) /* i.e. we didn't get carry when adding to r */
+	  if (r < p)
+	    {
+	      qh--;
+	      r += u1;
+	    }
+      }
+    r -= p;
+
+    /* Low half of the quotient is
+
+       ql = floor ( (b r + b-1) / u1).
+
+       This is a 3/2 division (on half-limbs), for which qh is a
+       suitable inverse. */
+
+    p = (r >> (GMP_LIMB_BITS / 2)) * qh + r;
+    /* Unlike full-limb 3/2, we can add 1 without overflow. For this to
+       work, it is essential that ql is a full mp_limb_t. */
+    ql = (p >> (GMP_LIMB_BITS / 2)) + 1;
+
+    /* By the 3/2 trick, we don't need the high half limb. */
+    r = (r << (GMP_LIMB_BITS / 2)) + GMP_LLIMB_MASK - ql * u1;
+
+    if (r >= (GMP_LIMB_MAX & (p << (GMP_LIMB_BITS / 2))))
+      {
+	ql--;
+	r += u1;
+      }
+    m = ((mp_limb_t) qh << (GMP_LIMB_BITS / 2)) + ql;
+    if (r >= u1)
+      {
+	m++;
+	r -= u1;
+      }
+  }
+
+  /* Now m is the 2/1 inverse of u1. If u0 > 0, adjust it to become a
+     3/2 inverse. */
+  if (u0 > 0)
+    {
+      mp_limb_t th, tl;
+      r = ~r;
+      r += u0;
+      if (r < u0)
+	{
+	  m--;
+	  if (r >= u1)
+	    {
+	      m--;
+	      r -= u1;
+	    }
+	  r -= u1;
+	}
+      gmp_umul_ppmm (th, tl, u0, m);
+      r += th;
+      if (r < th)
+	{
+	  m--;
+	  m -= ((r > u1) | ((r == u1) & (tl > u0)));
+	}
+    }
+
+  return m;
+}
+
+struct gmp_div_inverse
+{
+  /* Normalization shift count. */
+  unsigned shift;
+  /* Normalized divisor (d0 unused for mpn_div_qr_1) */
+  mp_limb_t d1, d0;
+  /* Inverse, for 2/1 or 3/2. */
+  mp_limb_t di;
+};
+
+static void
+mpn_div_qr_1_invert (struct gmp_div_inverse *inv, mp_limb_t d)
+{
+  unsigned shift;
+
+  assert (d > 0);
+  gmp_clz (shift, d);
+  inv->shift = shift;
+  inv->d1 = d << shift;
+  inv->di = mpn_invert_limb (inv->d1);
+}
+
+static void
+mpn_div_qr_2_invert (struct gmp_div_inverse *inv,
+		     mp_limb_t d1, mp_limb_t d0)
+{
+  unsigned shift;
+
+  assert (d1 > 0);
+  gmp_clz (shift, d1);
+  inv->shift = shift;
+  if (shift > 0)
+    {
+      d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift));
+      d0 <<= shift;
+    }
+  inv->d1 = d1;
+  inv->d0 = d0;
+  inv->di = mpn_invert_3by2 (d1, d0);
+}
+
+static void
+mpn_div_qr_invert (struct gmp_div_inverse *inv,
+		   mp_srcptr dp, mp_size_t dn)
+{
+  assert (dn > 0);
+
+  if (dn == 1)
+    mpn_div_qr_1_invert (inv, dp[0]);
+  else if (dn == 2)
+    mpn_div_qr_2_invert (inv, dp[1], dp[0]);
+  else
+    {
+      unsigned shift;
+      mp_limb_t d1, d0;
+
+      d1 = dp[dn-1];
+      d0 = dp[dn-2];
+      assert (d1 > 0);
+      gmp_clz (shift, d1);
+      inv->shift = shift;
+      if (shift > 0)
+	{
+	  d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift));
+	  d0 = (d0 << shift) | (dp[dn-3] >> (GMP_LIMB_BITS - shift));
+	}
+      inv->d1 = d1;
+      inv->d0 = d0;
+      inv->di = mpn_invert_3by2 (d1, d0);
+    }
+}
+
+/* Not matching current public gmp interface, rather corresponding to
+   the sbpi1_div_* functions. */
+static mp_limb_t
+mpn_div_qr_1_preinv (mp_ptr qp, mp_srcptr np, mp_size_t nn,
+		     const struct gmp_div_inverse *inv)
+{
+  mp_limb_t d, di;
+  mp_limb_t r;
+  mp_ptr tp = NULL;
+
+  if (inv->shift > 0)
+    {
+      /* Shift, reusing qp area if possible. In-place shift if qp == np. */
+      tp = qp ? qp : gmp_xalloc_limbs (nn);
+      r = mpn_lshift (tp, np, nn, inv->shift);
+      np = tp;
+    }
+  else
+    r = 0;
+
+  d = inv->d1;
+  di = inv->di;
+  while (--nn >= 0)
+    {
+      mp_limb_t q;
+
+      gmp_udiv_qrnnd_preinv (q, r, r, np[nn], d, di);
+      if (qp)
+	qp[nn] = q;
+    }
+  if ((inv->shift > 0) && (tp != qp))
+    gmp_free (tp);
+
+  return r >> inv->shift;
+}
+
+static void
+mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn,
+		     const struct gmp_div_inverse *inv)
+{
+  unsigned shift;
+  mp_size_t i;
+  mp_limb_t d1, d0, di, r1, r0;
+
+  assert (nn >= 2);
+  shift = inv->shift;
+  d1 = inv->d1;
+  d0 = inv->d0;
+  di = inv->di;
+
+  if (shift > 0)
+    r1 = mpn_lshift (np, np, nn, shift);
+  else
+    r1 = 0;
+
+  r0 = np[nn - 1];
+
+  i = nn - 2;
+  do
+    {
+      mp_limb_t n0, q;
+      n0 = np[i];
+      gmp_udiv_qr_3by2 (q, r1, r0, r1, r0, n0, d1, d0, di);
+
+      if (qp)
+	qp[i] = q;
+    }
+  while (--i >= 0);
+
+  if (shift > 0)
+    {
+      assert ((r0 & (GMP_LIMB_MAX >> (GMP_LIMB_BITS - shift))) == 0);
+      r0 = (r0 >> shift) | (r1 << (GMP_LIMB_BITS - shift));
+      r1 >>= shift;
+    }
+
+  np[1] = r1;
+  np[0] = r0;
+}
+
+static void
+mpn_div_qr_pi1 (mp_ptr qp,
+		mp_ptr np, mp_size_t nn, mp_limb_t n1,
+		mp_srcptr dp, mp_size_t dn,
+		mp_limb_t dinv)
+{
+  mp_size_t i;
+
+  mp_limb_t d1, d0;
+  mp_limb_t cy, cy1;
+  mp_limb_t q;
+
+  assert (dn > 2);
+  assert (nn >= dn);
+
+  d1 = dp[dn - 1];
+  d0 = dp[dn - 2];
+
+  assert ((d1 & GMP_LIMB_HIGHBIT) != 0);
+  /* Iteration variable is the index of the q limb.
+   *
+   * We divide <n1, np[dn-1+i], np[dn-2+i], np[dn-3+i],..., np[i]>
+   * by            <d1,          d0,        dp[dn-3],  ..., dp[0] >
+   */
+
+  i = nn - dn;
+  do
+    {
+      mp_limb_t n0 = np[dn-1+i];
+
+      if (n1 == d1 && n0 == d0)
+	{
+	  q = GMP_LIMB_MAX;
+	  mpn_submul_1 (np+i, dp, dn, q);
+	  n1 = np[dn-1+i];	/* update n1, last loop's value will now be invalid */
+	}
+      else
+	{
+	  gmp_udiv_qr_3by2 (q, n1, n0, n1, n0, np[dn-2+i], d1, d0, dinv);
+
+	  cy = mpn_submul_1 (np + i, dp, dn-2, q);
+
+	  cy1 = n0 < cy;
+	  n0 = n0 - cy;
+	  cy = n1 < cy1;
+	  n1 = n1 - cy1;
+	  np[dn-2+i] = n0;
+
+	  if (cy != 0)
+	    {
+	      n1 += d1 + mpn_add_n (np + i, np + i, dp, dn - 1);
+	      q--;
+	    }
+	}
+
+      if (qp)
+	qp[i] = q;
+    }
+  while (--i >= 0);
+
+  np[dn - 1] = n1;
+}
+
+static void
+mpn_div_qr_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn,
+		   mp_srcptr dp, mp_size_t dn,
+		   const struct gmp_div_inverse *inv)
+{
+  assert (dn > 0);
+  assert (nn >= dn);
+
+  if (dn == 1)
+    np[0] = mpn_div_qr_1_preinv (qp, np, nn, inv);
+  else if (dn == 2)
+    mpn_div_qr_2_preinv (qp, np, nn, inv);
+  else
+    {
+      mp_limb_t nh;
+      unsigned shift;
+
+      assert (inv->d1 == dp[dn-1]);
+      assert (inv->d0 == dp[dn-2]);
+      assert ((inv->d1 & GMP_LIMB_HIGHBIT) != 0);
+
+      shift = inv->shift;
+      if (shift > 0)
+	nh = mpn_lshift (np, np, nn, shift);
+      else
+	nh = 0;
+
+      mpn_div_qr_pi1 (qp, np, nn, nh, dp, dn, inv->di);
+
+      if (shift > 0)
+	gmp_assert_nocarry (mpn_rshift (np, np, dn, shift));
+    }
+}
+
+static void
+mpn_div_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn)
+{
+  struct gmp_div_inverse inv;
+  mp_ptr tp = NULL;
+
+  assert (dn > 0);
+  assert (nn >= dn);
+
+  mpn_div_qr_invert (&inv, dp, dn);
+  if (dn > 2 && inv.shift > 0)
+    {
+      tp = gmp_xalloc_limbs (dn);
+      gmp_assert_nocarry (mpn_lshift (tp, dp, dn, inv.shift));
+      dp = tp;
+    }
+  mpn_div_qr_preinv (qp, np, nn, dp, dn, &inv);
+  if (tp)
+    gmp_free (tp);
+}
+
+
+/* MPN base conversion. */
+static unsigned
+mpn_base_power_of_two_p (unsigned b)
+{
+  switch (b)
+    {
+    case 2: return 1;
+    case 4: return 2;
+    case 8: return 3;
+    case 16: return 4;
+    case 32: return 5;
+    case 64: return 6;
+    case 128: return 7;
+    case 256: return 8;
+    default: return 0;
+    }
+}
+
+struct mpn_base_info
+{
+  /* bb is the largest power of the base which fits in one limb, and
+     exp is the corresponding exponent. */
+  unsigned exp;
+  mp_limb_t bb;
+};
+
+static void
+mpn_get_base_info (struct mpn_base_info *info, mp_limb_t b)
+{
+  mp_limb_t m;
+  mp_limb_t p;
+  unsigned exp;
+
+  m = GMP_LIMB_MAX / b;
+  for (exp = 1, p = b; p <= m; exp++)
+    p *= b;
+
+  info->exp = exp;
+  info->bb = p;
+}
+
+static mp_bitcnt_t
+mpn_limb_size_in_base_2 (mp_limb_t u)
+{
+  unsigned shift;
+
+  assert (u > 0);
+  gmp_clz (shift, u);
+  return GMP_LIMB_BITS - shift;
+}
+
+static size_t
+mpn_get_str_bits (unsigned char *sp, unsigned bits, mp_srcptr up, mp_size_t un)
+{
+  unsigned char mask;
+  size_t sn, j;
+  mp_size_t i;
+  unsigned shift;
+
+  sn = ((un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1])
+	+ bits - 1) / bits;
+
+  mask = (1U << bits) - 1;
+
+  for (i = 0, j = sn, shift = 0; j-- > 0;)
+    {
+      unsigned char digit = up[i] >> shift;
+
+      shift += bits;
+
+      if (shift >= GMP_LIMB_BITS && ++i < un)
+	{
+	  shift -= GMP_LIMB_BITS;
+	  digit |= up[i] << (bits - shift);
+	}
+      sp[j] = digit & mask;
+    }
+  return sn;
+}
+
+/* We generate digits from the least significant end, and reverse at
+   the end. */
+static size_t
+mpn_limb_get_str (unsigned char *sp, mp_limb_t w,
+		  const struct gmp_div_inverse *binv)
+{
+  mp_size_t i;
+  for (i = 0; w > 0; i++)
+    {
+      mp_limb_t h, l, r;
+
+      h = w >> (GMP_LIMB_BITS - binv->shift);
+      l = w << binv->shift;
+
+      gmp_udiv_qrnnd_preinv (w, r, h, l, binv->d1, binv->di);
+      assert ((r & (GMP_LIMB_MAX >> (GMP_LIMB_BITS - binv->shift))) == 0);
+      r >>= binv->shift;
+
+      sp[i] = r;
+    }
+  return i;
+}
+
+static size_t
+mpn_get_str_other (unsigned char *sp,
+		   int base, const struct mpn_base_info *info,
+		   mp_ptr up, mp_size_t un)
+{
+  struct gmp_div_inverse binv;
+  size_t sn;
+  size_t i;
+
+  mpn_div_qr_1_invert (&binv, base);
+
+  sn = 0;
+
+  if (un > 1)
+    {
+      struct gmp_div_inverse bbinv;
+      mpn_div_qr_1_invert (&bbinv, info->bb);
+
+      do
+	{
+	  mp_limb_t w;
+	  size_t done;
+	  w = mpn_div_qr_1_preinv (up, up, un, &bbinv);
+	  un -= (up[un-1] == 0);
+	  done = mpn_limb_get_str (sp + sn, w, &binv);
+
+	  for (sn += done; done < info->exp; done++)
+	    sp[sn++] = 0;
+	}
+      while (un > 1);
+    }
+  sn += mpn_limb_get_str (sp + sn, up[0], &binv);
+
+  /* Reverse order */
+  for (i = 0; 2*i + 1 < sn; i++)
+    {
+      unsigned char t = sp[i];
+      sp[i] = sp[sn - i - 1];
+      sp[sn - i - 1] = t;
+    }
+
+  return sn;
+}
+
+size_t
+mpn_get_str (unsigned char *sp, int base, mp_ptr up, mp_size_t un)
+{
+  unsigned bits;
+
+  assert (un > 0);
+  assert (up[un-1] > 0);
+
+  bits = mpn_base_power_of_two_p (base);
+  if (bits)
+    return mpn_get_str_bits (sp, bits, up, un);
+  else
+    {
+      struct mpn_base_info info;
+
+      mpn_get_base_info (&info, base);
+      return mpn_get_str_other (sp, base, &info, up, un);
+    }
+}
+
+static mp_size_t
+mpn_set_str_bits (mp_ptr rp, const unsigned char *sp, size_t sn,
+		  unsigned bits)
+{
+  mp_size_t rn;
+  size_t j;
+  unsigned shift;
+
+  for (j = sn, rn = 0, shift = 0; j-- > 0; )
+    {
+      if (shift == 0)
+	{
+	  rp[rn++] = sp[j];
+	  shift += bits;
+	}
+      else
+	{
+	  rp[rn-1] |= (mp_limb_t) sp[j] << shift;
+	  shift += bits;
+	  if (shift >= GMP_LIMB_BITS)
+	    {
+	      shift -= GMP_LIMB_BITS;
+	      if (shift > 0)
+		rp[rn++] = (mp_limb_t) sp[j] >> (bits - shift);
+	    }
+	}
+    }
+  rn = mpn_normalized_size (rp, rn);
+  return rn;
+}
+
+/* Result is usually normalized, except for all-zero input, in which
+   case a single zero limb is written at *RP, and 1 is returned. */
+static mp_size_t
+mpn_set_str_other (mp_ptr rp, const unsigned char *sp, size_t sn,
+		   mp_limb_t b, const struct mpn_base_info *info)
+{
+  mp_size_t rn;
+  mp_limb_t w;
+  unsigned k;
+  size_t j;
+
+  assert (sn > 0);
+
+  k = 1 + (sn - 1) % info->exp;
+
+  j = 0;
+  w = sp[j++];
+  while (--k != 0)
+    w = w * b + sp[j++];
+
+  rp[0] = w;
+
+  for (rn = 1; j < sn;)
+    {
+      mp_limb_t cy;
+
+      w = sp[j++];
+      for (k = 1; k < info->exp; k++)
+	w = w * b + sp[j++];
+
+      cy = mpn_mul_1 (rp, rp, rn, info->bb);
+      cy += mpn_add_1 (rp, rp, rn, w);
+      if (cy > 0)
+	rp[rn++] = cy;
+    }
+  assert (j == sn);
+
+  return rn;
+}
+
+mp_size_t
+mpn_set_str (mp_ptr rp, const unsigned char *sp, size_t sn, int base)
+{
+  unsigned bits;
+
+  if (sn == 0)
+    return 0;
+
+  bits = mpn_base_power_of_two_p (base);
+  if (bits)
+    return mpn_set_str_bits (rp, sp, sn, bits);
+  else
+    {
+      struct mpn_base_info info;
+
+      mpn_get_base_info (&info, base);
+      return mpn_set_str_other (rp, sp, sn, base, &info);
+    }
+}
+
+
+/* MPZ interface */
+void
+mpz_init (mpz_t r)
+{
+  static const mp_limb_t dummy_limb = GMP_LIMB_MAX & 0xc1a0;
+
+  r->_mp_alloc = 0;
+  r->_mp_size = 0;
+  r->_mp_d = (mp_ptr) &dummy_limb;
+}
+
+/* The utility of this function is a bit limited, since many functions
+   assigns the result variable using mpz_swap. */
+void
+mpz_init2 (mpz_t r, mp_bitcnt_t bits)
+{
+  mp_size_t rn;
+
+  bits -= (bits != 0);		/* Round down, except if 0 */
+  rn = 1 + bits / GMP_LIMB_BITS;
+
+  r->_mp_alloc = rn;
+  r->_mp_size = 0;
+  r->_mp_d = gmp_xalloc_limbs (rn);
+}
+
+void
+mpz_clear (mpz_t r)
+{
+  if (r->_mp_alloc)
+    gmp_free (r->_mp_d);
+}
+
+static mp_ptr
+mpz_realloc (mpz_t r, mp_size_t size)
+{
+  size = GMP_MAX (size, 1);
+
+  if (r->_mp_alloc)
+    r->_mp_d = gmp_xrealloc_limbs (r->_mp_d, size);
+  else
+    r->_mp_d = gmp_xalloc_limbs (size);
+  r->_mp_alloc = size;
+
+  if (GMP_ABS (r->_mp_size) > size)
+    r->_mp_size = 0;
+
+  return r->_mp_d;
+}
+
+/* Realloc for an mpz_t WHAT if it has less than NEEDED limbs.  */
+#define MPZ_REALLOC(z,n) ((n) > (z)->_mp_alloc			\
+			  ? mpz_realloc(z,n)			\
+			  : (z)->_mp_d)
+
+/* MPZ assignment and basic conversions. */
+void
+mpz_set_si (mpz_t r, signed long int x)
+{
+  if (x >= 0)
+    mpz_set_ui (r, x);
+  else /* (x < 0) */
+    if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+      {
+	mpz_set_ui (r, GMP_NEG_CAST (unsigned long int, x));
+	mpz_neg (r, r);
+      }
+  else
+    {
+      r->_mp_size = -1;
+      MPZ_REALLOC (r, 1)[0] = GMP_NEG_CAST (unsigned long int, x);
+    }
+}
+
+void
+mpz_set_ui (mpz_t r, unsigned long int x)
+{
+  if (x > 0)
+    {
+      r->_mp_size = 1;
+      MPZ_REALLOC (r, 1)[0] = x;
+      if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+	{
+	  int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;
+	  while (x >>= LOCAL_GMP_LIMB_BITS)
+	    {
+	      ++ r->_mp_size;
+	      MPZ_REALLOC (r, r->_mp_size)[r->_mp_size - 1] = x;
+	    }
+	}
+    }
+  else
+    r->_mp_size = 0;
+}
+
+void
+mpz_set (mpz_t r, const mpz_t x)
+{
+  /* Allow the NOP r == x */
+  if (r != x)
+    {
+      mp_size_t n;
+      mp_ptr rp;
+
+      n = GMP_ABS (x->_mp_size);
+      rp = MPZ_REALLOC (r, n);
+
+      mpn_copyi (rp, x->_mp_d, n);
+      r->_mp_size = x->_mp_size;
+    }
+}
+
+void
+mpz_init_set_si (mpz_t r, signed long int x)
+{
+  mpz_init (r);
+  mpz_set_si (r, x);
+}
+
+void
+mpz_init_set_ui (mpz_t r, unsigned long int x)
+{
+  mpz_init (r);
+  mpz_set_ui (r, x);
+}
+
+void
+mpz_init_set (mpz_t r, const mpz_t x)
+{
+  mpz_init (r);
+  mpz_set (r, x);
+}
+
+int
+mpz_fits_slong_p (const mpz_t u)
+{
+  return (LONG_MAX + LONG_MIN == 0 || mpz_cmp_ui (u, LONG_MAX) <= 0) &&
+    mpz_cmpabs_ui (u, GMP_NEG_CAST (unsigned long int, LONG_MIN)) <= 0;
+}
+
+static int
+mpn_absfits_ulong_p (mp_srcptr up, mp_size_t un)
+{
+  int ulongsize = GMP_ULONG_BITS / GMP_LIMB_BITS;
+  mp_limb_t ulongrem = 0;
+
+  if (GMP_ULONG_BITS % GMP_LIMB_BITS != 0)
+    ulongrem = (mp_limb_t) (ULONG_MAX >> GMP_LIMB_BITS * ulongsize) + 1;
+
+  return un <= ulongsize || (up[ulongsize] < ulongrem && un == ulongsize + 1);
+}
+
+int
+mpz_fits_ulong_p (const mpz_t u)
+{
+  mp_size_t us = u->_mp_size;
+
+  return us >= 0 && mpn_absfits_ulong_p (u->_mp_d, us);
+}
+
+long int
+mpz_get_si (const mpz_t u)
+{
+  unsigned long r = mpz_get_ui (u);
+  unsigned long c = -LONG_MAX - LONG_MIN;
+
+  if (u->_mp_size < 0)
+    /* This expression is necessary to properly handle -LONG_MIN */
+    return -(long) c - (long) ((r - c) & LONG_MAX);
+  else
+    return (long) (r & LONG_MAX);
+}
+
+unsigned long int
+mpz_get_ui (const mpz_t u)
+{
+  if (GMP_LIMB_BITS < GMP_ULONG_BITS)
+    {
+      int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;
+      unsigned long r = 0;
+      mp_size_t n = GMP_ABS (u->_mp_size);
+      n = GMP_MIN (n, 1 + (mp_size_t) (GMP_ULONG_BITS - 1) / GMP_LIMB_BITS);
+      while (--n >= 0)
+	r = (r << LOCAL_GMP_LIMB_BITS) + u->_mp_d[n];
+      return r;
+    }
+
+  return u->_mp_size == 0 ? 0 : u->_mp_d[0];
+}
+
+size_t
+mpz_size (const mpz_t u)
+{
+  return GMP_ABS (u->_mp_size);
+}
+
+mp_limb_t
+mpz_getlimbn (const mpz_t u, mp_size_t n)
+{
+  if (n >= 0 && n < GMP_ABS (u->_mp_size))
+    return u->_mp_d[n];
+  else
+    return 0;
+}
+
+void
+mpz_realloc2 (mpz_t x, mp_bitcnt_t n)
+{
+  mpz_realloc (x, 1 + (n - (n != 0)) / GMP_LIMB_BITS);
+}
+
+mp_srcptr
+mpz_limbs_read (mpz_srcptr x)
+{
+  return x->_mp_d;
+}
+
+mp_ptr
+mpz_limbs_modify (mpz_t x, mp_size_t n)
+{
+  assert (n > 0);
+  return MPZ_REALLOC (x, n);
+}
+
+mp_ptr
+mpz_limbs_write (mpz_t x, mp_size_t n)
+{
+  return mpz_limbs_modify (x, n);
+}
+
+void
+mpz_limbs_finish (mpz_t x, mp_size_t xs)
+{
+  mp_size_t xn;
+  xn = mpn_normalized_size (x->_mp_d, GMP_ABS (xs));
+  x->_mp_size = xs < 0 ? -xn : xn;
+}
+
+static mpz_srcptr
+mpz_roinit_normal_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
+{
+  x->_mp_alloc = 0;
+  x->_mp_d = (mp_ptr) xp;
+  x->_mp_size = xs;
+  return x;
+}
+
+mpz_srcptr
+mpz_roinit_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
+{
+  mpz_roinit_normal_n (x, xp, xs);
+  mpz_limbs_finish (x, xs);
+  return x;
+}
+
+
+/* Conversions and comparison to double. */
+void
+mpz_set_d (mpz_t r, double x)
+{
+  int sign;
+  mp_ptr rp;
+  mp_size_t rn, i;
+  double B;
+  double Bi;
+  mp_limb_t f;
+
+  /* x != x is true when x is a NaN, and x == x * 0.5 is true when x is
+     zero or infinity. */
+  if (x != x || x == x * 0.5)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  sign = x < 0.0 ;
+  if (sign)
+    x = - x;
+
+  if (x < 1.0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+  B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
+  Bi = 1.0 / B;
+  for (rn = 1; x >= B; rn++)
+    x *= Bi;
+
+  rp = MPZ_REALLOC (r, rn);
+
+  f = (mp_limb_t) x;
+  x -= f;
+  assert (x < 1.0);
+  i = rn-1;
+  rp[i] = f;
+  while (--i >= 0)
+    {
+      x = B * x;
+      f = (mp_limb_t) x;
+      x -= f;
+      assert (x < 1.0);
+      rp[i] = f;
+    }
+
+  r->_mp_size = sign ? - rn : rn;
+}
+
+void
+mpz_init_set_d (mpz_t r, double x)
+{
+  mpz_init (r);
+  mpz_set_d (r, x);
+}
+
+double
+mpz_get_d (const mpz_t u)
+{
+  int m;
+  mp_limb_t l;
+  mp_size_t un;
+  double x;
+  double B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
+
+  un = GMP_ABS (u->_mp_size);
+
+  if (un == 0)
+    return 0.0;
+
+  l = u->_mp_d[--un];
+  gmp_clz (m, l);
+  m = m + GMP_DBL_MANT_BITS - GMP_LIMB_BITS;
+  if (m < 0)
+    l &= GMP_LIMB_MAX << -m;
+
+  for (x = l; --un >= 0;)
+    {
+      x = B*x;
+      if (m > 0) {
+	l = u->_mp_d[un];
+	m -= GMP_LIMB_BITS;
+	if (m < 0)
+	  l &= GMP_LIMB_MAX << -m;
+	x += l;
+      }
+    }
+
+  if (u->_mp_size < 0)
+    x = -x;
+
+  return x;
+}
+
+int
+mpz_cmpabs_d (const mpz_t x, double d)
+{
+  mp_size_t xn;
+  double B, Bi;
+  mp_size_t i;
+
+  xn = x->_mp_size;
+  d = GMP_ABS (d);
+
+  if (xn != 0)
+    {
+      xn = GMP_ABS (xn);
+
+      B = 4.0 * (double) (GMP_LIMB_HIGHBIT >> 1);
+      Bi = 1.0 / B;
+
+      /* Scale d so it can be compared with the top limb. */
+      for (i = 1; i < xn; i++)
+	d *= Bi;
+
+      if (d >= B)
+	return -1;
+
+      /* Compare floor(d) to top limb, subtract and cancel when equal. */
+      for (i = xn; i-- > 0;)
+	{
+	  mp_limb_t f, xl;
+
+	  f = (mp_limb_t) d;
+	  xl = x->_mp_d[i];
+	  if (xl > f)
+	    return 1;
+	  else if (xl < f)
+	    return -1;
+	  d = B * (d - f);
+	}
+    }
+  return - (d > 0.0);
+}
+
+int
+mpz_cmp_d (const mpz_t x, double d)
+{
+  if (x->_mp_size < 0)
+    {
+      if (d >= 0.0)
+	return -1;
+      else
+	return -mpz_cmpabs_d (x, d);
+    }
+  else
+    {
+      if (d < 0.0)
+	return 1;
+      else
+	return mpz_cmpabs_d (x, d);
+    }
+}
+
+
+/* MPZ comparisons and the like. */
+int
+mpz_sgn (const mpz_t u)
+{
+  return GMP_CMP (u->_mp_size, 0);
+}
+
+int
+mpz_cmp_si (const mpz_t u, long v)
+{
+  mp_size_t usize = u->_mp_size;
+
+  if (v >= 0)
+    return mpz_cmp_ui (u, v);
+  else if (usize >= 0)
+    return 1;
+  else
+    return - mpz_cmpabs_ui (u, GMP_NEG_CAST (unsigned long int, v));
+}
+
+int
+mpz_cmp_ui (const mpz_t u, unsigned long v)
+{
+  mp_size_t usize = u->_mp_size;
+
+  if (usize < 0)
+    return -1;
+  else
+    return mpz_cmpabs_ui (u, v);
+}
+
+int
+mpz_cmp (const mpz_t a, const mpz_t b)
+{
+  mp_size_t asize = a->_mp_size;
+  mp_size_t bsize = b->_mp_size;
+
+  if (asize != bsize)
+    return (asize < bsize) ? -1 : 1;
+  else if (asize >= 0)
+    return mpn_cmp (a->_mp_d, b->_mp_d, asize);
+  else
+    return mpn_cmp (b->_mp_d, a->_mp_d, -asize);
+}
+
+int
+mpz_cmpabs_ui (const mpz_t u, unsigned long v)
+{
+  mp_size_t un = GMP_ABS (u->_mp_size);
+
+  if (! mpn_absfits_ulong_p (u->_mp_d, un))
+    return 1;
+  else
+    {
+      unsigned long uu = mpz_get_ui (u);
+      return GMP_CMP(uu, v);
+    }
+}
+
+int
+mpz_cmpabs (const mpz_t u, const mpz_t v)
+{
+  return mpn_cmp4 (u->_mp_d, GMP_ABS (u->_mp_size),
+		   v->_mp_d, GMP_ABS (v->_mp_size));
+}
+
+void
+mpz_abs (mpz_t r, const mpz_t u)
+{
+  mpz_set (r, u);
+  r->_mp_size = GMP_ABS (r->_mp_size);
+}
+
+void
+mpz_neg (mpz_t r, const mpz_t u)
+{
+  mpz_set (r, u);
+  r->_mp_size = -r->_mp_size;
+}
+
+void
+mpz_swap (mpz_t u, mpz_t v)
+{
+  MP_SIZE_T_SWAP (u->_mp_size, v->_mp_size);
+  MP_SIZE_T_SWAP (u->_mp_alloc, v->_mp_alloc);
+  MP_PTR_SWAP (u->_mp_d, v->_mp_d);
+}
+
+
+/* MPZ addition and subtraction */
+
+
+void
+mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b)
+{
+  mpz_t bb;
+  mpz_init_set_ui (bb, b);
+  mpz_add (r, a, bb);
+  mpz_clear (bb);
+}
+
+void
+mpz_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
+{
+  mpz_ui_sub (r, b, a);
+  mpz_neg (r, r);
+}
+
+void
+mpz_ui_sub (mpz_t r, unsigned long a, const mpz_t b)
+{
+  mpz_neg (r, b);
+  mpz_add_ui (r, r, a);
+}
+
+static mp_size_t
+mpz_abs_add (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t an = GMP_ABS (a->_mp_size);
+  mp_size_t bn = GMP_ABS (b->_mp_size);
+  mp_ptr rp;
+  mp_limb_t cy;
+
+  if (an < bn)
+    {
+      MPZ_SRCPTR_SWAP (a, b);
+      MP_SIZE_T_SWAP (an, bn);
+    }
+
+  rp = MPZ_REALLOC (r, an + 1);
+  cy = mpn_add (rp, a->_mp_d, an, b->_mp_d, bn);
+
+  rp[an] = cy;
+
+  return an + cy;
+}
+
+static mp_size_t
+mpz_abs_sub (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t an = GMP_ABS (a->_mp_size);
+  mp_size_t bn = GMP_ABS (b->_mp_size);
+  int cmp;
+  mp_ptr rp;
+
+  cmp = mpn_cmp4 (a->_mp_d, an, b->_mp_d, bn);
+  if (cmp > 0)
+    {
+      rp = MPZ_REALLOC (r, an);
+      gmp_assert_nocarry (mpn_sub (rp, a->_mp_d, an, b->_mp_d, bn));
+      return mpn_normalized_size (rp, an);
+    }
+  else if (cmp < 0)
+    {
+      rp = MPZ_REALLOC (r, bn);
+      gmp_assert_nocarry (mpn_sub (rp, b->_mp_d, bn, a->_mp_d, an));
+      return -mpn_normalized_size (rp, bn);
+    }
+  else
+    return 0;
+}
+
+void
+mpz_add (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t rn;
+
+  if ( (a->_mp_size ^ b->_mp_size) >= 0)
+    rn = mpz_abs_add (r, a, b);
+  else
+    rn = mpz_abs_sub (r, a, b);
+
+  r->_mp_size = a->_mp_size >= 0 ? rn : - rn;
+}
+
+void
+mpz_sub (mpz_t r, const mpz_t a, const mpz_t b)
+{
+  mp_size_t rn;
+
+  if ( (a->_mp_size ^ b->_mp_size) >= 0)
+    rn = mpz_abs_sub (r, a, b);
+  else
+    rn = mpz_abs_add (r, a, b);
+
+  r->_mp_size = a->_mp_size >= 0 ? rn : - rn;
+}
+
+
+/* MPZ multiplication */
+void
+mpz_mul_si (mpz_t r, const mpz_t u, long int v)
+{
+  if (v < 0)
+    {
+      mpz_mul_ui (r, u, GMP_NEG_CAST (unsigned long int, v));
+      mpz_neg (r, r);
+    }
+  else
+    mpz_mul_ui (r, u, v);
+}
+
+void
+mpz_mul_ui (mpz_t r, const mpz_t u, unsigned long int v)
+{
+  mpz_t vv;
+  mpz_init_set_ui (vv, v);
+  mpz_mul (r, u, vv);
+  mpz_clear (vv);
+  return;
+}
+
+void
+mpz_mul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  int sign;
+  mp_size_t un, vn, rn;
+  mpz_t t;
+  mp_ptr tp;
+
+  un = u->_mp_size;
+  vn = v->_mp_size;
+
+  if (un == 0 || vn == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  sign = (un ^ vn) < 0;
+
+  un = GMP_ABS (un);
+  vn = GMP_ABS (vn);
+
+  mpz_init2 (t, (un + vn) * GMP_LIMB_BITS);
+
+  tp = t->_mp_d;
+  if (un >= vn)
+    mpn_mul (tp, u->_mp_d, un, v->_mp_d, vn);
+  else
+    mpn_mul (tp, v->_mp_d, vn, u->_mp_d, un);
+
+  rn = un + vn;
+  rn -= tp[rn-1] == 0;
+
+  t->_mp_size = sign ? - rn : rn;
+  mpz_swap (r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_mul_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bits)
+{
+  mp_size_t un, rn;
+  mp_size_t limbs;
+  unsigned shift;
+  mp_ptr rp;
+
+  un = GMP_ABS (u->_mp_size);
+  if (un == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  limbs = bits / GMP_LIMB_BITS;
+  shift = bits % GMP_LIMB_BITS;
+
+  rn = un + limbs + (shift > 0);
+  rp = MPZ_REALLOC (r, rn);
+  if (shift > 0)
+    {
+      mp_limb_t cy = mpn_lshift (rp + limbs, u->_mp_d, un, shift);
+      rp[rn-1] = cy;
+      rn -= (cy == 0);
+    }
+  else
+    mpn_copyd (rp + limbs, u->_mp_d, un);
+
+  mpn_zero (rp, limbs);
+
+  r->_mp_size = (u->_mp_size < 0) ? - rn : rn;
+}
+
+void
+mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v)
+{
+  mpz_t t;
+  mpz_init_set_ui (t, v);
+  mpz_mul (t, u, t);
+  mpz_add (r, r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_submul_ui (mpz_t r, const mpz_t u, unsigned long int v)
+{
+  mpz_t t;
+  mpz_init_set_ui (t, v);
+  mpz_mul (t, u, t);
+  mpz_sub (r, r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_addmul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mpz_t t;
+  mpz_init (t);
+  mpz_mul (t, u, v);
+  mpz_add (r, r, t);
+  mpz_clear (t);
+}
+
+void
+mpz_submul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mpz_t t;
+  mpz_init (t);
+  mpz_mul (t, u, v);
+  mpz_sub (r, r, t);
+  mpz_clear (t);
+}
+
+
+/* MPZ division */
+enum mpz_div_round_mode { GMP_DIV_FLOOR, GMP_DIV_CEIL, GMP_DIV_TRUNC };
+
+/* Allows q or r to be zero. Returns 1 iff remainder is non-zero. */
+static int
+mpz_div_qr (mpz_t q, mpz_t r,
+	    const mpz_t n, const mpz_t d, enum mpz_div_round_mode mode)
+{
+  mp_size_t ns, ds, nn, dn, qs;
+  ns = n->_mp_size;
+  ds = d->_mp_size;
+
+  if (ds == 0)
+    gmp_die("mpz_div_qr: Divide by zero.");
+
+  if (ns == 0)
+    {
+      if (q)
+	q->_mp_size = 0;
+      if (r)
+	r->_mp_size = 0;
+      return 0;
+    }
+
+  nn = GMP_ABS (ns);
+  dn = GMP_ABS (ds);
+
+  qs = ds ^ ns;
+
+  if (nn < dn)
+    {
+      if (mode == GMP_DIV_CEIL && qs >= 0)
+	{
+	  /* q = 1, r = n - d */
+	  if (r)
+	    mpz_sub (r, n, d);
+	  if (q)
+	    mpz_set_ui (q, 1);
+	}
+      else if (mode == GMP_DIV_FLOOR && qs < 0)
+	{
+	  /* q = -1, r = n + d */
+	  if (r)
+	    mpz_add (r, n, d);
+	  if (q)
+	    mpz_set_si (q, -1);
+	}
+      else
+	{
+	  /* q = 0, r = d */
+	  if (r)
+	    mpz_set (r, n);
+	  if (q)
+	    q->_mp_size = 0;
+	}
+      return 1;
+    }
+  else
+    {
+      mp_ptr np, qp;
+      mp_size_t qn, rn;
+      mpz_t tq, tr;
+
+      mpz_init_set (tr, n);
+      np = tr->_mp_d;
+
+      qn = nn - dn + 1;
+
+      if (q)
+	{
+	  mpz_init2 (tq, qn * GMP_LIMB_BITS);
+	  qp = tq->_mp_d;
+	}
+      else
+	qp = NULL;
+
+      mpn_div_qr (qp, np, nn, d->_mp_d, dn);
+
+      if (qp)
+	{
+	  qn -= (qp[qn-1] == 0);
+
+	  tq->_mp_size = qs < 0 ? -qn : qn;
+	}
+      rn = mpn_normalized_size (np, dn);
+      tr->_mp_size = ns < 0 ? - rn : rn;
+
+      if (mode == GMP_DIV_FLOOR && qs < 0 && rn != 0)
+	{
+	  if (q)
+	    mpz_sub_ui (tq, tq, 1);
+	  if (r)
+	    mpz_add (tr, tr, d);
+	}
+      else if (mode == GMP_DIV_CEIL && qs >= 0 && rn != 0)
+	{
+	  if (q)
+	    mpz_add_ui (tq, tq, 1);
+	  if (r)
+	    mpz_sub (tr, tr, d);
+	}
+
+      if (q)
+	{
+	  mpz_swap (tq, q);
+	  mpz_clear (tq);
+	}
+      if (r)
+	mpz_swap (tr, r);
+
+      mpz_clear (tr);
+
+      return rn != 0;
+    }
+}
+
+void
+mpz_cdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, r, n, d, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, r, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, r, n, d, GMP_DIV_TRUNC);
+}
+
+void
+mpz_cdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, NULL, n, d, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, NULL, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (q, NULL, n, d, GMP_DIV_TRUNC);
+}
+
+void
+mpz_cdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, GMP_DIV_TRUNC);
+}
+
+void
+mpz_mod (mpz_t r, const mpz_t n, const mpz_t d)
+{
+  mpz_div_qr (NULL, r, n, d, d->_mp_size >= 0 ? GMP_DIV_FLOOR : GMP_DIV_CEIL);
+}
+
+static void
+mpz_div_q_2exp (mpz_t q, const mpz_t u, mp_bitcnt_t bit_index,
+		enum mpz_div_round_mode mode)
+{
+  mp_size_t un, qn;
+  mp_size_t limb_cnt;
+  mp_ptr qp;
+  int adjust;
+
+  un = u->_mp_size;
+  if (un == 0)
+    {
+      q->_mp_size = 0;
+      return;
+    }
+  limb_cnt = bit_index / GMP_LIMB_BITS;
+  qn = GMP_ABS (un) - limb_cnt;
+  bit_index %= GMP_LIMB_BITS;
+
+  if (mode == ((un > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* un != 0 here. */
+    /* Note: Below, the final indexing at limb_cnt is valid because at
+       that point we have qn > 0. */
+    adjust = (qn <= 0
+	      || !mpn_zero_p (u->_mp_d, limb_cnt)
+	      || (u->_mp_d[limb_cnt]
+		  & (((mp_limb_t) 1 << bit_index) - 1)));
+  else
+    adjust = 0;
+
+  if (qn <= 0)
+    qn = 0;
+  else
+    {
+      qp = MPZ_REALLOC (q, qn);
+
+      if (bit_index != 0)
+	{
+	  mpn_rshift (qp, u->_mp_d + limb_cnt, qn, bit_index);
+	  qn -= qp[qn - 1] == 0;
+	}
+      else
+	{
+	  mpn_copyi (qp, u->_mp_d + limb_cnt, qn);
+	}
+    }
+
+  q->_mp_size = qn;
+
+  if (adjust)
+    mpz_add_ui (q, q, 1);
+  if (un < 0)
+    mpz_neg (q, q);
+}
+
+static void
+mpz_div_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bit_index,
+		enum mpz_div_round_mode mode)
+{
+  mp_size_t us, un, rn;
+  mp_ptr rp;
+  mp_limb_t mask;
+
+  us = u->_mp_size;
+  if (us == 0 || bit_index == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+  rn = (bit_index + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
+  assert (rn > 0);
+
+  rp = MPZ_REALLOC (r, rn);
+  un = GMP_ABS (us);
+
+  mask = GMP_LIMB_MAX >> (rn * GMP_LIMB_BITS - bit_index);
+
+  if (rn > un)
+    {
+      /* Quotient (with truncation) is zero, and remainder is
+	 non-zero */
+      if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. */
+	{
+	  /* Have to negate and sign extend. */
+	  mp_size_t i;
+
+	  gmp_assert_nocarry (! mpn_neg (rp, u->_mp_d, un));
+	  for (i = un; i < rn - 1; i++)
+	    rp[i] = GMP_LIMB_MAX;
+
+	  rp[rn-1] = mask;
+	  us = -us;
+	}
+      else
+	{
+	  /* Just copy */
+	  if (r != u)
+	    mpn_copyi (rp, u->_mp_d, un);
+
+	  rn = un;
+	}
+    }
+  else
+    {
+      if (r != u)
+	mpn_copyi (rp, u->_mp_d, rn - 1);
+
+      rp[rn-1] = u->_mp_d[rn-1] & mask;
+
+      if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. */
+	{
+	  /* If r != 0, compute 2^{bit_count} - r. */
+	  mpn_neg (rp, rp, rn);
+
+	  rp[rn-1] &= mask;
+
+	  /* us is not used for anything else, so we can modify it
+	     here to indicate flipped sign. */
+	  us = -us;
+	}
+    }
+  rn = mpn_normalized_size (rp, rn);
+  r->_mp_size = us < 0 ? -rn : rn;
+}
+
+void
+mpz_cdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_q_2exp (r, u, cnt, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_q_2exp (r, u, cnt, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_q_2exp (r, u, cnt, GMP_DIV_TRUNC);
+}
+
+void
+mpz_cdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_r_2exp (r, u, cnt, GMP_DIV_CEIL);
+}
+
+void
+mpz_fdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_r_2exp (r, u, cnt, GMP_DIV_FLOOR);
+}
+
+void
+mpz_tdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
+{
+  mpz_div_r_2exp (r, u, cnt, GMP_DIV_TRUNC);
+}
+
+void
+mpz_divexact (mpz_t q, const mpz_t n, const mpz_t d)
+{
+  gmp_assert_nocarry (mpz_div_qr (q, NULL, n, d, GMP_DIV_TRUNC));
+}
+
+int
+mpz_divisible_p (const mpz_t n, const mpz_t d)
+{
+  return mpz_div_qr (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0;
+}
+
+int
+mpz_congruent_p (const mpz_t a, const mpz_t b, const mpz_t m)
+{
+  mpz_t t;
+  int res;
+
+  /* a == b (mod 0) iff a == b */
+  if (mpz_sgn (m) == 0)
+    return (mpz_cmp (a, b) == 0);
+
+  mpz_init (t);
+  mpz_sub (t, a, b);
+  res = mpz_divisible_p (t, m);
+  mpz_clear (t);
+
+  return res;
+}
+
+static unsigned long
+mpz_div_qr_ui (mpz_t q, mpz_t r,
+	       const mpz_t n, unsigned long d, enum mpz_div_round_mode mode)
+{
+  unsigned long ret;
+  mpz_t rr, dd;
+
+  mpz_init (rr);
+  mpz_init_set_ui (dd, d);
+  mpz_div_qr (q, rr, n, dd, mode);
+  mpz_clear (dd);
+  ret = mpz_get_ui (rr);
+
+  if (r)
+    mpz_swap (r, rr);
+  mpz_clear (rr);
+
+  return ret;
+}
+
+unsigned long
+mpz_cdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, r, n, d, GMP_DIV_CEIL);
+}
+
+unsigned long
+mpz_fdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, r, n, d, GMP_DIV_FLOOR);
+}
+
+unsigned long
+mpz_tdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, r, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_cdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_CEIL);
+}
+
+unsigned long
+mpz_fdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_FLOOR);
+}
+
+unsigned long
+mpz_tdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_cdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_CEIL);
+}
+unsigned long
+mpz_fdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR);
+}
+unsigned long
+mpz_tdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_cdiv_ui (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_CEIL);
+}
+
+unsigned long
+mpz_fdiv_ui (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_FLOOR);
+}
+
+unsigned long
+mpz_tdiv_ui (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC);
+}
+
+unsigned long
+mpz_mod_ui (mpz_t r, const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR);
+}
+
+void
+mpz_divexact_ui (mpz_t q, const mpz_t n, unsigned long d)
+{
+  gmp_assert_nocarry (mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC));
+}
+
+int
+mpz_divisible_ui_p (const mpz_t n, unsigned long d)
+{
+  return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0;
+}
+
+
+/* GCD */
+static mp_limb_t
+mpn_gcd_11 (mp_limb_t u, mp_limb_t v)
+{
+  unsigned shift;
+
+  assert ( (u | v) > 0);
+
+  if (u == 0)
+    return v;
+  else if (v == 0)
+    return u;
+
+  gmp_ctz (shift, u | v);
+
+  u >>= shift;
+  v >>= shift;
+
+  if ( (u & 1) == 0)
+    MP_LIMB_T_SWAP (u, v);
+
+  while ( (v & 1) == 0)
+    v >>= 1;
+
+  while (u != v)
+    {
+      if (u > v)
+	{
+	  u -= v;
+	  do
+	    u >>= 1;
+	  while ( (u & 1) == 0);
+	}
+      else
+	{
+	  v -= u;
+	  do
+	    v >>= 1;
+	  while ( (v & 1) == 0);
+	}
+    }
+  return u << shift;
+}
+
+unsigned long
+mpz_gcd_ui (mpz_t g, const mpz_t u, unsigned long v)
+{
+  mpz_t t;
+  mpz_init_set_ui(t, v);
+  mpz_gcd (t, u, t);
+  if (v > 0)
+    v = mpz_get_ui (t);
+
+  if (g)
+    mpz_swap (t, g);
+
+  mpz_clear (t);
+
+  return v;
+}
+
+static mp_bitcnt_t
+mpz_make_odd (mpz_t r)
+{
+  mp_bitcnt_t shift;
+
+  assert (r->_mp_size > 0);
+  /* Count trailing zeros, equivalent to mpn_scan1, because we know that there is a 1 */
+  shift = mpn_common_scan (r->_mp_d[0], 0, r->_mp_d, 0, 0);
+  mpz_tdiv_q_2exp (r, r, shift);
+
+  return shift;
+}
+
+void
+mpz_gcd (mpz_t g, const mpz_t u, const mpz_t v)
+{
+  mpz_t tu, tv;
+  mp_bitcnt_t uz, vz, gz;
+
+  if (u->_mp_size == 0)
+    {
+      mpz_abs (g, v);
+      return;
+    }
+  if (v->_mp_size == 0)
+    {
+      mpz_abs (g, u);
+      return;
+    }
+
+  mpz_init (tu);
+  mpz_init (tv);
+
+  mpz_abs (tu, u);
+  uz = mpz_make_odd (tu);
+  mpz_abs (tv, v);
+  vz = mpz_make_odd (tv);
+  gz = GMP_MIN (uz, vz);
+
+  if (tu->_mp_size < tv->_mp_size)
+    mpz_swap (tu, tv);
+
+  mpz_tdiv_r (tu, tu, tv);
+  if (tu->_mp_size == 0)
+    {
+      mpz_swap (g, tv);
+    }
+  else
+    for (;;)
+      {
+	int c;
+
+	mpz_make_odd (tu);
+	c = mpz_cmp (tu, tv);
+	if (c == 0)
+	  {
+	    mpz_swap (g, tu);
+	    break;
+	  }
+	if (c < 0)
+	  mpz_swap (tu, tv);
+
+	if (tv->_mp_size == 1)
+	  {
+	    mp_limb_t vl = tv->_mp_d[0];
+	    mp_limb_t ul = mpz_tdiv_ui (tu, vl);
+	    mpz_set_ui (g, mpn_gcd_11 (ul, vl));
+	    break;
+	  }
+	mpz_sub (tu, tu, tv);
+      }
+  mpz_clear (tu);
+  mpz_clear (tv);
+  mpz_mul_2exp (g, g, gz);
+}
+
+void
+mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
+{
+  mpz_t tu, tv, s0, s1, t0, t1;
+  mp_bitcnt_t uz, vz, gz;
+  mp_bitcnt_t power;
+
+  if (u->_mp_size == 0)
+    {
+      /* g = 0 u + sgn(v) v */
+      signed long sign = mpz_sgn (v);
+      mpz_abs (g, v);
+      if (s)
+	s->_mp_size = 0;
+      if (t)
+	mpz_set_si (t, sign);
+      return;
+    }
+
+  if (v->_mp_size == 0)
+    {
+      /* g = sgn(u) u + 0 v */
+      signed long sign = mpz_sgn (u);
+      mpz_abs (g, u);
+      if (s)
+	mpz_set_si (s, sign);
+      if (t)
+	t->_mp_size = 0;
+      return;
+    }
+
+  mpz_init (tu);
+  mpz_init (tv);
+  mpz_init (s0);
+  mpz_init (s1);
+  mpz_init (t0);
+  mpz_init (t1);
+
+  mpz_abs (tu, u);
+  uz = mpz_make_odd (tu);
+  mpz_abs (tv, v);
+  vz = mpz_make_odd (tv);
+  gz = GMP_MIN (uz, vz);
+
+  uz -= gz;
+  vz -= gz;
+
+  /* Cofactors corresponding to odd gcd. gz handled later. */
+  if (tu->_mp_size < tv->_mp_size)
+    {
+      mpz_swap (tu, tv);
+      MPZ_SRCPTR_SWAP (u, v);
+      MPZ_PTR_SWAP (s, t);
+      MP_BITCNT_T_SWAP (uz, vz);
+    }
+
+  /* Maintain
+   *
+   * u = t0 tu + t1 tv
+   * v = s0 tu + s1 tv
+   *
+   * where u and v denote the inputs with common factors of two
+   * eliminated, and det (s0, t0; s1, t1) = 2^p. Then
+   *
+   * 2^p tu =  s1 u - t1 v
+   * 2^p tv = -s0 u + t0 v
+   */
+
+  /* After initial division, tu = q tv + tu', we have
+   *
+   * u = 2^uz (tu' + q tv)
+   * v = 2^vz tv
+   *
+   * or
+   *
+   * t0 = 2^uz, t1 = 2^uz q
+   * s0 = 0,    s1 = 2^vz
+   */
+
+  mpz_setbit (t0, uz);
+  mpz_tdiv_qr (t1, tu, tu, tv);
+  mpz_mul_2exp (t1, t1, uz);
+
+  mpz_setbit (s1, vz);
+  power = uz + vz;
+
+  if (tu->_mp_size > 0)
+    {
+      mp_bitcnt_t shift;
+      shift = mpz_make_odd (tu);
+      mpz_mul_2exp (t0, t0, shift);
+      mpz_mul_2exp (s0, s0, shift);
+      power += shift;
+
+      for (;;)
+	{
+	  int c;
+	  c = mpz_cmp (tu, tv);
+	  if (c == 0)
+	    break;
+
+	  if (c < 0)
+	    {
+	      /* tv = tv' + tu
+	       *
+	       * u = t0 tu + t1 (tv' + tu) = (t0 + t1) tu + t1 tv'
+	       * v = s0 tu + s1 (tv' + tu) = (s0 + s1) tu + s1 tv' */
+
+	      mpz_sub (tv, tv, tu);
+	      mpz_add (t0, t0, t1);
+	      mpz_add (s0, s0, s1);
+
+	      shift = mpz_make_odd (tv);
+	      mpz_mul_2exp (t1, t1, shift);
+	      mpz_mul_2exp (s1, s1, shift);
+	    }
+	  else
+	    {
+	      mpz_sub (tu, tu, tv);
+	      mpz_add (t1, t0, t1);
+	      mpz_add (s1, s0, s1);
+
+	      shift = mpz_make_odd (tu);
+	      mpz_mul_2exp (t0, t0, shift);
+	      mpz_mul_2exp (s0, s0, shift);
+	    }
+	  power += shift;
+	}
+    }
+
+  /* Now tv = odd part of gcd, and -s0 and t0 are corresponding
+     cofactors. */
+
+  mpz_mul_2exp (tv, tv, gz);
+  mpz_neg (s0, s0);
+
+  /* 2^p g = s0 u + t0 v. Eliminate one factor of two at a time. To
+     adjust cofactors, we need u / g and v / g */
+
+  mpz_divexact (s1, v, tv);
+  mpz_abs (s1, s1);
+  mpz_divexact (t1, u, tv);
+  mpz_abs (t1, t1);
+
+  while (power-- > 0)
+    {
+      /* s0 u + t0 v = (s0 - v/g) u - (t0 + u/g) v */
+      if (mpz_odd_p (s0) || mpz_odd_p (t0))
+	{
+	  mpz_sub (s0, s0, s1);
+	  mpz_add (t0, t0, t1);
+	}
+      assert (mpz_even_p (t0) && mpz_even_p (s0));
+      mpz_tdiv_q_2exp (s0, s0, 1);
+      mpz_tdiv_q_2exp (t0, t0, 1);
+    }
+
+  /* Arrange so that |s| < |u| / 2g */
+  mpz_add (s1, s0, s1);
+  if (mpz_cmpabs (s0, s1) > 0)
+    {
+      mpz_swap (s0, s1);
+      mpz_sub (t0, t0, t1);
+    }
+  if (u->_mp_size < 0)
+    mpz_neg (s0, s0);
+  if (v->_mp_size < 0)
+    mpz_neg (t0, t0);
+
+  mpz_swap (g, tv);
+  if (s)
+    mpz_swap (s, s0);
+  if (t)
+    mpz_swap (t, t0);
+
+  mpz_clear (tu);
+  mpz_clear (tv);
+  mpz_clear (s0);
+  mpz_clear (s1);
+  mpz_clear (t0);
+  mpz_clear (t1);
+}
+
+void
+mpz_lcm (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mpz_t g;
+
+  if (u->_mp_size == 0 || v->_mp_size == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  mpz_init (g);
+
+  mpz_gcd (g, u, v);
+  mpz_divexact (g, u, g);
+  mpz_mul (r, g, v);
+
+  mpz_clear (g);
+  mpz_abs (r, r);
+}
+
+void
+mpz_lcm_ui (mpz_t r, const mpz_t u, unsigned long v)
+{
+  if (v == 0 || u->_mp_size == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  v /= mpz_gcd_ui (NULL, u, v);
+  mpz_mul_ui (r, u, v);
+
+  mpz_abs (r, r);
+}
+
+int
+mpz_invert (mpz_t r, const mpz_t u, const mpz_t m)
+{
+  mpz_t g, tr;
+  int invertible;
+
+  if (u->_mp_size == 0 || mpz_cmpabs_ui (m, 1) <= 0)
+    return 0;
+
+  mpz_init (g);
+  mpz_init (tr);
+
+  mpz_gcdext (g, tr, NULL, u, m);
+  invertible = (mpz_cmp_ui (g, 1) == 0);
+
+  if (invertible)
+    {
+      if (tr->_mp_size < 0)
+	{
+	  if (m->_mp_size >= 0)
+	    mpz_add (tr, tr, m);
+	  else
+	    mpz_sub (tr, tr, m);
+	}
+      mpz_swap (r, tr);
+    }
+
+  mpz_clear (g);
+  mpz_clear (tr);
+  return invertible;
+}
+
+
+/* Higher level operations (sqrt, pow and root) */
+
+void
+mpz_pow_ui (mpz_t r, const mpz_t b, unsigned long e)
+{
+  unsigned long bit;
+  mpz_t tr;
+  mpz_init_set_ui (tr, 1);
+
+  bit = GMP_ULONG_HIGHBIT;
+  do
+    {
+      mpz_mul (tr, tr, tr);
+      if (e & bit)
+	mpz_mul (tr, tr, b);
+      bit >>= 1;
+    }
+  while (bit > 0);
+
+  mpz_swap (r, tr);
+  mpz_clear (tr);
+}
+
+void
+mpz_ui_pow_ui (mpz_t r, unsigned long blimb, unsigned long e)
+{
+  mpz_t b;
+
+  mpz_init_set_ui (b, blimb);
+  mpz_pow_ui (r, b, e);
+  mpz_clear (b);
+}
+
+void
+mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m)
+{
+  mpz_t tr;
+  mpz_t base;
+  mp_size_t en, mn;
+  mp_srcptr mp;
+  struct gmp_div_inverse minv;
+  unsigned shift;
+  mp_ptr tp = NULL;
+
+  en = GMP_ABS (e->_mp_size);
+  mn = GMP_ABS (m->_mp_size);
+  if (mn == 0)
+    gmp_die ("mpz_powm: Zero modulo.");
+
+  if (en == 0)
+    {
+      mpz_set_ui (r, 1);
+      return;
+    }
+
+  mp = m->_mp_d;
+  mpn_div_qr_invert (&minv, mp, mn);
+  shift = minv.shift;
+
+  if (shift > 0)
+    {
+      /* To avoid shifts, we do all our reductions, except the final
+	 one, using a *normalized* m. */
+      minv.shift = 0;
+
+      tp = gmp_xalloc_limbs (mn);
+      gmp_assert_nocarry (mpn_lshift (tp, mp, mn, shift));
+      mp = tp;
+    }
+
+  mpz_init (base);
+
+  if (e->_mp_size < 0)
+    {
+      if (!mpz_invert (base, b, m))
+	gmp_die ("mpz_powm: Negative exponent and non-invertible base.");
+    }
+  else
+    {
+      mp_size_t bn;
+      mpz_abs (base, b);
+
+      bn = base->_mp_size;
+      if (bn >= mn)
+	{
+	  mpn_div_qr_preinv (NULL, base->_mp_d, base->_mp_size, mp, mn, &minv);
+	  bn = mn;
+	}
+
+      /* We have reduced the absolute value. Now take care of the
+	 sign. Note that we get zero represented non-canonically as
+	 m. */
+      if (b->_mp_size < 0)
+	{
+	  mp_ptr bp = MPZ_REALLOC (base, mn);
+	  gmp_assert_nocarry (mpn_sub (bp, mp, mn, bp, bn));
+	  bn = mn;
+	}
+      base->_mp_size = mpn_normalized_size (base->_mp_d, bn);
+    }
+  mpz_init_set_ui (tr, 1);
+
+  while (--en >= 0)
+    {
+      mp_limb_t w = e->_mp_d[en];
+      mp_limb_t bit;
+
+      bit = GMP_LIMB_HIGHBIT;
+      do
+	{
+	  mpz_mul (tr, tr, tr);
+	  if (w & bit)
+	    mpz_mul (tr, tr, base);
+	  if (tr->_mp_size > mn)
+	    {
+	      mpn_div_qr_preinv (NULL, tr->_mp_d, tr->_mp_size, mp, mn, &minv);
+	      tr->_mp_size = mpn_normalized_size (tr->_mp_d, mn);
+	    }
+	  bit >>= 1;
+	}
+      while (bit > 0);
+    }
+
+  /* Final reduction */
+  if (tr->_mp_size >= mn)
+    {
+      minv.shift = shift;
+      mpn_div_qr_preinv (NULL, tr->_mp_d, tr->_mp_size, mp, mn, &minv);
+      tr->_mp_size = mpn_normalized_size (tr->_mp_d, mn);
+    }
+  if (tp)
+    gmp_free (tp);
+
+  mpz_swap (r, tr);
+  mpz_clear (tr);
+  mpz_clear (base);
+}
+
+void
+mpz_powm_ui (mpz_t r, const mpz_t b, unsigned long elimb, const mpz_t m)
+{
+  mpz_t e;
+
+  mpz_init_set_ui (e, elimb);
+  mpz_powm (r, b, e, m);
+  mpz_clear (e);
+}
+
+/* x=trunc(y^(1/z)), r=y-x^z */
+void
+mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z)
+{
+  int sgn;
+  mpz_t t, u;
+
+  sgn = y->_mp_size < 0;
+  if ((~z & sgn) != 0)
+    gmp_die ("mpz_rootrem: Negative argument, with even root.");
+  if (z == 0)
+    gmp_die ("mpz_rootrem: Zeroth root.");
+
+  if (mpz_cmpabs_ui (y, 1) <= 0) {
+    if (x)
+      mpz_set (x, y);
+    if (r)
+      r->_mp_size = 0;
+    return;
+  }
+
+  mpz_init (u);
+  mpz_init (t);
+  mpz_setbit (t, mpz_sizeinbase (y, 2) / z + 1);
+
+  if (z == 2) /* simplify sqrt loop: z-1 == 1 */
+    do {
+      mpz_swap (u, t);			/* u = x */
+      mpz_tdiv_q (t, y, u);		/* t = y/x */
+      mpz_add (t, t, u);		/* t = y/x + x */
+      mpz_tdiv_q_2exp (t, t, 1);	/* x'= (y/x + x)/2 */
+    } while (mpz_cmpabs (t, u) < 0);	/* |x'| < |x| */
+  else /* z != 2 */ {
+    mpz_t v;
+
+    mpz_init (v);
+    if (sgn)
+      mpz_neg (t, t);
+
+    do {
+      mpz_swap (u, t);			/* u = x */
+      mpz_pow_ui (t, u, z - 1);		/* t = x^(z-1) */
+      mpz_tdiv_q (t, y, t);		/* t = y/x^(z-1) */
+      mpz_mul_ui (v, u, z - 1);		/* v = x*(z-1) */
+      mpz_add (t, t, v);		/* t = y/x^(z-1) + x*(z-1) */
+      mpz_tdiv_q_ui (t, t, z);		/* x'=(y/x^(z-1) + x*(z-1))/z */
+    } while (mpz_cmpabs (t, u) < 0);	/* |x'| < |x| */
+
+    mpz_clear (v);
+  }
+
+  if (r) {
+    mpz_pow_ui (t, u, z);
+    mpz_sub (r, y, t);
+  }
+  if (x)
+    mpz_swap (x, u);
+  mpz_clear (u);
+  mpz_clear (t);
+}
+
+int
+mpz_root (mpz_t x, const mpz_t y, unsigned long z)
+{
+  int res;
+  mpz_t r;
+
+  mpz_init (r);
+  mpz_rootrem (x, r, y, z);
+  res = r->_mp_size == 0;
+  mpz_clear (r);
+
+  return res;
+}
+
+/* Compute s = floor(sqrt(u)) and r = u - s^2. Allows r == NULL */
+void
+mpz_sqrtrem (mpz_t s, mpz_t r, const mpz_t u)
+{
+  mpz_rootrem (s, r, u, 2);
+}
+
+void
+mpz_sqrt (mpz_t s, const mpz_t u)
+{
+  mpz_rootrem (s, NULL, u, 2);
+}
+
+int
+mpz_perfect_square_p (const mpz_t u)
+{
+  if (u->_mp_size <= 0)
+    return (u->_mp_size == 0);
+  else
+    return mpz_root (NULL, u, 2);
+}
+
+int
+mpn_perfect_square_p (mp_srcptr p, mp_size_t n)
+{
+  mpz_t t;
+
+  assert (n > 0);
+  assert (p [n-1] != 0);
+  return mpz_root (NULL, mpz_roinit_normal_n (t, p, n), 2);
+}
+
+mp_size_t
+mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr p, mp_size_t n)
+{
+  mpz_t s, r, u;
+  mp_size_t res;
+
+  assert (n > 0);
+  assert (p [n-1] != 0);
+
+  mpz_init (r);
+  mpz_init (s);
+  mpz_rootrem (s, r, mpz_roinit_normal_n (u, p, n), 2);
+
+  assert (s->_mp_size == (n+1)/2);
+  mpn_copyd (sp, s->_mp_d, s->_mp_size);
+  mpz_clear (s);
+  res = r->_mp_size;
+  if (rp)
+    mpn_copyd (rp, r->_mp_d, res);
+  mpz_clear (r);
+  return res;
+}
+
+/* Combinatorics */
+
+void
+mpz_mfac_uiui (mpz_t x, unsigned long n, unsigned long m)
+{
+  mpz_set_ui (x, n + (n == 0));
+  if (m + 1 < 2) return;
+  while (n > m + 1)
+    mpz_mul_ui (x, x, n -= m);
+}
+
+void
+mpz_2fac_ui (mpz_t x, unsigned long n)
+{
+  mpz_mfac_uiui (x, n, 2);
+}
+
+void
+mpz_fac_ui (mpz_t x, unsigned long n)
+{
+  mpz_mfac_uiui (x, n, 1);
+}
+
+void
+mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k)
+{
+  mpz_t t;
+
+  mpz_set_ui (r, k <= n);
+
+  if (k > (n >> 1))
+    k = (k <= n) ? n - k : 0;
+
+  mpz_init (t);
+  mpz_fac_ui (t, k);
+
+  for (; k > 0; --k)
+    mpz_mul_ui (r, r, n--);
+
+  mpz_divexact (r, r, t);
+  mpz_clear (t);
+}
+
+
+/* Primality testing */
+
+/* Computes Kronecker (a/b) with odd b, a!=0 and GCD(a,b) = 1 */
+/* Adapted from JACOBI_BASE_METHOD==4 in mpn/generic/jacbase.c */
+static int
+gmp_jacobi_coprime (mp_limb_t a, mp_limb_t b)
+{
+  int c, bit = 0;
+
+  assert (b & 1);
+  assert (a != 0);
+  /* assert (mpn_gcd_11 (a, b) == 1); */
+
+  /* Below, we represent a and b shifted right so that the least
+     significant one bit is implicit. */
+  b >>= 1;
+
+  gmp_ctz(c, a);
+  a >>= 1;
+
+  do
+    {
+      a >>= c;
+      /* (2/b) = -1 if b = 3 or 5 mod 8 */
+      bit ^= c & (b ^ (b >> 1));
+      if (a < b)
+	{
+	  bit ^= a & b;
+	  a = b - a;
+	  b -= a;
+	}
+      else
+	{
+	  a -= b;
+	  assert (a != 0);
+	}
+
+      gmp_ctz(c, a);
+      ++c;
+    }
+  while (b > 0);
+
+  return bit & 1 ? -1 : 1;
+}
+
+static void
+gmp_lucas_step_k_2k (mpz_t V, mpz_t Qk, const mpz_t n)
+{
+  mpz_mod (Qk, Qk, n);
+  /* V_{2k} <- V_k ^ 2 - 2Q^k */
+  mpz_mul (V, V, V);
+  mpz_submul_ui (V, Qk, 2);
+  mpz_tdiv_r (V, V, n);
+  /* Q^{2k} = (Q^k)^2 */
+  mpz_mul (Qk, Qk, Qk);
+}
+
+/* Computes V_k, Q^k (mod n) for the Lucas' sequence */
+/* with P=1, Q=Q; k = (n>>b0)|1. */
+/* Requires an odd n > 4; b0 > 0; -2*Q must not overflow a long */
+/* Returns (U_k == 0) and sets V=V_k and Qk=Q^k. */
+static int
+gmp_lucas_mod (mpz_t V, mpz_t Qk, long Q,
+	       mp_bitcnt_t b0, const mpz_t n)
+{
+  mp_bitcnt_t bs;
+  mpz_t U;
+  int res;
+
+  assert (b0 > 0);
+  assert (Q <= - (LONG_MIN / 2));
+  assert (Q >= - (LONG_MAX / 2));
+  assert (mpz_cmp_ui (n, 4) > 0);
+  assert (mpz_odd_p (n));
+
+  mpz_init_set_ui (U, 1); /* U1 = 1 */
+  mpz_set_ui (V, 1); /* V1 = 1 */
+  mpz_set_si (Qk, Q);
+
+  for (bs = mpz_sizeinbase (n, 2) - 1; --bs >= b0;)
+    {
+      /* U_{2k} <- U_k * V_k */
+      mpz_mul (U, U, V);
+      /* V_{2k} <- V_k ^ 2 - 2Q^k */
+      /* Q^{2k} = (Q^k)^2 */
+      gmp_lucas_step_k_2k (V, Qk, n);
+
+      /* A step k->k+1 is performed if the bit in $n$ is 1	*/
+      /* mpz_tstbit(n,bs) or the bit is 0 in $n$ but	*/
+      /* should be 1 in $n+1$ (bs == b0)			*/
+      if (b0 == bs || mpz_tstbit (n, bs))
+	{
+	  /* Q^{k+1} <- Q^k * Q */
+	  mpz_mul_si (Qk, Qk, Q);
+	  /* U_{k+1} <- (U_k + V_k) / 2 */
+	  mpz_swap (U, V); /* Keep in V the old value of U_k */
+	  mpz_add (U, U, V);
+	  /* We have to compute U/2, so we need an even value, */
+	  /* equivalent (mod n) */
+	  if (mpz_odd_p (U))
+	    mpz_add (U, U, n);
+	  mpz_tdiv_q_2exp (U, U, 1);
+	  /* V_{k+1} <-(D*U_k + V_k) / 2 =
+			U_{k+1} + (D-1)/2*U_k = U_{k+1} - 2Q*U_k */
+	  mpz_mul_si (V, V, -2*Q);
+	  mpz_add (V, U, V);
+	  mpz_tdiv_r (V, V, n);
+	}
+      mpz_tdiv_r (U, U, n);
+    }
+
+  res = U->_mp_size == 0;
+  mpz_clear (U);
+  return res;
+}
+
+/* Performs strong Lucas' test on x, with parameters suggested */
+/* for the BPSW test. Qk is only passed to recycle a variable. */
+/* Requires GCD (x,6) = 1.*/
+static int
+gmp_stronglucas (const mpz_t x, mpz_t Qk)
+{
+  mp_bitcnt_t b0;
+  mpz_t V, n;
+  mp_limb_t maxD, D; /* The absolute value is stored. */
+  long Q;
+  mp_limb_t tl;
+
+  /* Test on the absolute value. */
+  mpz_roinit_normal_n (n, x->_mp_d, GMP_ABS (x->_mp_size));
+
+  assert (mpz_odd_p (n));
+  /* assert (mpz_gcd_ui (NULL, n, 6) == 1); */
+  if (mpz_root (Qk, n, 2))
+    return 0; /* A square is composite. */
+
+  /* Check Ds up to square root (in case, n is prime)
+     or avoid overflows */
+  maxD = (Qk->_mp_size == 1) ? Qk->_mp_d [0] - 1 : GMP_LIMB_MAX;
+
+  D = 3;
+  /* Search a D such that (D/n) = -1 in the sequence 5,-7,9,-11,.. */
+  /* For those Ds we have (D/n) = (n/|D|) */
+  do
+    {
+      if (D >= maxD)
+	return 1 + (D != GMP_LIMB_MAX); /* (1 + ! ~ D) */
+      D += 2;
+      tl = mpz_tdiv_ui (n, D);
+      if (tl == 0)
+	return 0;
+    }
+  while (gmp_jacobi_coprime (tl, D) == 1);
+
+  mpz_init (V);
+
+  /* n-(D/n) = n+1 = d*2^{b0}, with d = (n>>b0) | 1 */
+  b0 = mpz_scan0 (n, 0);
+
+  /* D= P^2 - 4Q; P = 1; Q = (1-D)/4 */
+  Q = (D & 2) ? (long) (D >> 2) + 1 : -(long) (D >> 2);
+
+  if (! gmp_lucas_mod (V, Qk, Q, b0, n))	/* If Ud != 0 */
+    while (V->_mp_size != 0 && --b0 != 0)	/* while Vk != 0 */
+      /* V <- V ^ 2 - 2Q^k */
+      /* Q^{2k} = (Q^k)^2 */
+      gmp_lucas_step_k_2k (V, Qk, n);
+
+  mpz_clear (V);
+  return (b0 != 0);
+}
+
+static int
+gmp_millerrabin (const mpz_t n, const mpz_t nm1, mpz_t y,
+		 const mpz_t q, mp_bitcnt_t k)
+{
+  assert (k > 0);
+
+  /* Caller must initialize y to the base. */
+  mpz_powm (y, y, q, n);
+
+  if (mpz_cmp_ui (y, 1) == 0 || mpz_cmp (y, nm1) == 0)
+    return 1;
+
+  while (--k > 0)
+    {
+      mpz_powm_ui (y, y, 2, n);
+      if (mpz_cmp (y, nm1) == 0)
+	return 1;
+      /* y == 1 means that the previous y was a non-trivial square root
+	 of 1 (mod n). y == 0 means that n is a power of the base.
+	 In either case, n is not prime. */
+      if (mpz_cmp_ui (y, 1) <= 0)
+	return 0;
+    }
+  return 0;
+}
+
+/* This product is 0xc0cfd797, and fits in 32 bits. */
+#define GMP_PRIME_PRODUCT \
+  (3UL*5UL*7UL*11UL*13UL*17UL*19UL*23UL*29UL)
+
+/* Bit (p+1)/2 is set, for each odd prime <= 61 */
+#define GMP_PRIME_MASK 0xc96996dcUL
+
+int
+mpz_probab_prime_p (const mpz_t n, int reps)
+{
+  mpz_t nm1;
+  mpz_t q;
+  mpz_t y;
+  mp_bitcnt_t k;
+  int is_prime;
+  int j;
+
+  /* Note that we use the absolute value of n only, for compatibility
+     with the real GMP. */
+  if (mpz_even_p (n))
+    return (mpz_cmpabs_ui (n, 2) == 0) ? 2 : 0;
+
+  /* Above test excludes n == 0 */
+  assert (n->_mp_size != 0);
+
+  if (mpz_cmpabs_ui (n, 64) < 0)
+    return (GMP_PRIME_MASK >> (n->_mp_d[0] >> 1)) & 2;
+
+  if (mpz_gcd_ui (NULL, n, GMP_PRIME_PRODUCT) != 1)
+    return 0;
+
+  /* All prime factors are >= 31. */
+  if (mpz_cmpabs_ui (n, 31*31) < 0)
+    return 2;
+
+  mpz_init (nm1);
+  mpz_init (q);
+
+  /* Find q and k, where q is odd and n = 1 + 2**k * q.  */
+  mpz_abs (nm1, n);
+  nm1->_mp_d[0] -= 1;
+  k = mpz_scan1 (nm1, 0);
+  mpz_tdiv_q_2exp (q, nm1, k);
+
+  /* BPSW test */
+  mpz_init_set_ui (y, 2);
+  is_prime = gmp_millerrabin (n, nm1, y, q, k) && gmp_stronglucas (n, y);
+  reps -= 24; /* skip the first 24 repetitions */
+
+  /* Use Miller-Rabin, with a deterministic sequence of bases, a[j] =
+     j^2 + j + 41 using Euler's polynomial. We potentially stop early,
+     if a[j] >= n - 1. Since n >= 31*31, this can happen only if reps >
+     30 (a[30] == 971 > 31*31 == 961). */
+
+  for (j = 0; is_prime & (j < reps); j++)
+    {
+      mpz_set_ui (y, (unsigned long) j*j+j+41);
+      if (mpz_cmp (y, nm1) >= 0)
+	{
+	  /* Don't try any further bases. This "early" break does not affect
+	     the result for any reasonable reps value (<=5000 was tested) */
+	  assert (j >= 30);
+	  break;
+	}
+      is_prime = gmp_millerrabin (n, nm1, y, q, k);
+    }
+  mpz_clear (nm1);
+  mpz_clear (q);
+  mpz_clear (y);
+
+  return is_prime;
+}
+
+
+/* Logical operations and bit manipulation. */
+
+/* Numbers are treated as if represented in two's complement (and
+   infinitely sign extended). For a negative values we get the two's
+   complement from -x = ~x + 1, where ~ is bitwise complement.
+   Negation transforms
+
+     xxxx10...0
+
+   into
+
+     yyyy10...0
+
+   where yyyy is the bitwise complement of xxxx. So least significant
+   bits, up to and including the first one bit, are unchanged, and
+   the more significant bits are all complemented.
+
+   To change a bit from zero to one in a negative number, subtract the
+   corresponding power of two from the absolute value. This can never
+   underflow. To change a bit from one to zero, add the corresponding
+   power of two, and this might overflow. E.g., if x = -001111, the
+   two's complement is 110001. Clearing the least significant bit, we
+   get two's complement 110000, and -010000. */
+
+int
+mpz_tstbit (const mpz_t d, mp_bitcnt_t bit_index)
+{
+  mp_size_t limb_index;
+  unsigned shift;
+  mp_size_t ds;
+  mp_size_t dn;
+  mp_limb_t w;
+  int bit;
+
+  ds = d->_mp_size;
+  dn = GMP_ABS (ds);
+  limb_index = bit_index / GMP_LIMB_BITS;
+  if (limb_index >= dn)
+    return ds < 0;
+
+  shift = bit_index % GMP_LIMB_BITS;
+  w = d->_mp_d[limb_index];
+  bit = (w >> shift) & 1;
+
+  if (ds < 0)
+    {
+      /* d < 0. Check if any of the bits below is set: If so, our bit
+	 must be complemented. */
+      if (shift > 0 && (mp_limb_t) (w << (GMP_LIMB_BITS - shift)) > 0)
+	return bit ^ 1;
+      while (--limb_index >= 0)
+	if (d->_mp_d[limb_index] > 0)
+	  return bit ^ 1;
+    }
+  return bit;
+}
+
+static void
+mpz_abs_add_bit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  mp_size_t dn, limb_index;
+  mp_limb_t bit;
+  mp_ptr dp;
+
+  dn = GMP_ABS (d->_mp_size);
+
+  limb_index = bit_index / GMP_LIMB_BITS;
+  bit = (mp_limb_t) 1 << (bit_index % GMP_LIMB_BITS);
+
+  if (limb_index >= dn)
+    {
+      mp_size_t i;
+      /* The bit should be set outside of the end of the number.
+	 We have to increase the size of the number. */
+      dp = MPZ_REALLOC (d, limb_index + 1);
+
+      dp[limb_index] = bit;
+      for (i = dn; i < limb_index; i++)
+	dp[i] = 0;
+      dn = limb_index + 1;
+    }
+  else
+    {
+      mp_limb_t cy;
+
+      dp = d->_mp_d;
+
+      cy = mpn_add_1 (dp + limb_index, dp + limb_index, dn - limb_index, bit);
+      if (cy > 0)
+	{
+	  dp = MPZ_REALLOC (d, dn + 1);
+	  dp[dn++] = cy;
+	}
+    }
+
+  d->_mp_size = (d->_mp_size < 0) ? - dn : dn;
+}
+
+static void
+mpz_abs_sub_bit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  mp_size_t dn, limb_index;
+  mp_ptr dp;
+  mp_limb_t bit;
+
+  dn = GMP_ABS (d->_mp_size);
+  dp = d->_mp_d;
+
+  limb_index = bit_index / GMP_LIMB_BITS;
+  bit = (mp_limb_t) 1 << (bit_index % GMP_LIMB_BITS);
+
+  assert (limb_index < dn);
+
+  gmp_assert_nocarry (mpn_sub_1 (dp + limb_index, dp + limb_index,
+				 dn - limb_index, bit));
+  dn = mpn_normalized_size (dp, dn);
+  d->_mp_size = (d->_mp_size < 0) ? - dn : dn;
+}
+
+void
+mpz_setbit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  if (!mpz_tstbit (d, bit_index))
+    {
+      if (d->_mp_size >= 0)
+	mpz_abs_add_bit (d, bit_index);
+      else
+	mpz_abs_sub_bit (d, bit_index);
+    }
+}
+
+void
+mpz_clrbit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  if (mpz_tstbit (d, bit_index))
+    {
+      if (d->_mp_size >= 0)
+	mpz_abs_sub_bit (d, bit_index);
+      else
+	mpz_abs_add_bit (d, bit_index);
+    }
+}
+
+void
+mpz_combit (mpz_t d, mp_bitcnt_t bit_index)
+{
+  if (mpz_tstbit (d, bit_index) ^ (d->_mp_size < 0))
+    mpz_abs_sub_bit (d, bit_index);
+  else
+    mpz_abs_add_bit (d, bit_index);
+}
+
+void
+mpz_com (mpz_t r, const mpz_t u)
+{
+  mpz_add_ui (r, u, 1);
+  mpz_neg (r, r);
+}
+
+void
+mpz_and (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, rn, i;
+  mp_ptr up, vp, rp;
+
+  mp_limb_t ux, vx, rx;
+  mp_limb_t uc, vc, rc;
+  mp_limb_t ul, vl, rl;
+
+  un = GMP_ABS (u->_mp_size);
+  vn = GMP_ABS (v->_mp_size);
+  if (un < vn)
+    {
+      MPZ_SRCPTR_SWAP (u, v);
+      MP_SIZE_T_SWAP (un, vn);
+    }
+  if (vn == 0)
+    {
+      r->_mp_size = 0;
+      return;
+    }
+
+  uc = u->_mp_size < 0;
+  vc = v->_mp_size < 0;
+  rc = uc & vc;
+
+  ux = -uc;
+  vx = -vc;
+  rx = -rc;
+
+  /* If the smaller input is positive, higher limbs don't matter. */
+  rn = vx ? un : vn;
+
+  rp = MPZ_REALLOC (r, rn + (mp_size_t) rc);
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  i = 0;
+  do
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ vx) + vc;
+      vc = vl < vc;
+
+      rl = ( (ul & vl) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  while (++i < vn);
+  assert (vc == 0);
+
+  for (; i < rn; i++)
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      rl = ( (ul & vx) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  if (rc)
+    rp[rn++] = rc;
+  else
+    rn = mpn_normalized_size (rp, rn);
+
+  r->_mp_size = rx ? -rn : rn;
+}
+
+void
+mpz_ior (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, rn, i;
+  mp_ptr up, vp, rp;
+
+  mp_limb_t ux, vx, rx;
+  mp_limb_t uc, vc, rc;
+  mp_limb_t ul, vl, rl;
+
+  un = GMP_ABS (u->_mp_size);
+  vn = GMP_ABS (v->_mp_size);
+  if (un < vn)
+    {
+      MPZ_SRCPTR_SWAP (u, v);
+      MP_SIZE_T_SWAP (un, vn);
+    }
+  if (vn == 0)
+    {
+      mpz_set (r, u);
+      return;
+    }
+
+  uc = u->_mp_size < 0;
+  vc = v->_mp_size < 0;
+  rc = uc | vc;
+
+  ux = -uc;
+  vx = -vc;
+  rx = -rc;
+
+  /* If the smaller input is negative, by sign extension higher limbs
+     don't matter. */
+  rn = vx ? vn : un;
+
+  rp = MPZ_REALLOC (r, rn + (mp_size_t) rc);
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  i = 0;
+  do
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ vx) + vc;
+      vc = vl < vc;
+
+      rl = ( (ul | vl) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  while (++i < vn);
+  assert (vc == 0);
+
+  for (; i < rn; i++)
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      rl = ( (ul | vx) ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  if (rc)
+    rp[rn++] = rc;
+  else
+    rn = mpn_normalized_size (rp, rn);
+
+  r->_mp_size = rx ? -rn : rn;
+}
+
+void
+mpz_xor (mpz_t r, const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, i;
+  mp_ptr up, vp, rp;
+
+  mp_limb_t ux, vx, rx;
+  mp_limb_t uc, vc, rc;
+  mp_limb_t ul, vl, rl;
+
+  un = GMP_ABS (u->_mp_size);
+  vn = GMP_ABS (v->_mp_size);
+  if (un < vn)
+    {
+      MPZ_SRCPTR_SWAP (u, v);
+      MP_SIZE_T_SWAP (un, vn);
+    }
+  if (vn == 0)
+    {
+      mpz_set (r, u);
+      return;
+    }
+
+  uc = u->_mp_size < 0;
+  vc = v->_mp_size < 0;
+  rc = uc ^ vc;
+
+  ux = -uc;
+  vx = -vc;
+  rx = -rc;
+
+  rp = MPZ_REALLOC (r, un + (mp_size_t) rc);
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  i = 0;
+  do
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ vx) + vc;
+      vc = vl < vc;
+
+      rl = (ul ^ vl ^ rx) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  while (++i < vn);
+  assert (vc == 0);
+
+  for (; i < un; i++)
+    {
+      ul = (up[i] ^ ux) + uc;
+      uc = ul < uc;
+
+      rl = (ul ^ ux) + rc;
+      rc = rl < rc;
+      rp[i] = rl;
+    }
+  if (rc)
+    rp[un++] = rc;
+  else
+    un = mpn_normalized_size (rp, un);
+
+  r->_mp_size = rx ? -un : un;
+}
+
+static unsigned
+gmp_popcount_limb (mp_limb_t x)
+{
+  unsigned c;
+
+  /* Do 16 bits at a time, to avoid limb-sized constants. */
+  int LOCAL_SHIFT_BITS = 16;
+  for (c = 0; x > 0;)
+    {
+      unsigned w = x - ((x >> 1) & 0x5555);
+      w = ((w >> 2) & 0x3333) + (w & 0x3333);
+      w =  (w >> 4) + w;
+      w = ((w >> 8) & 0x000f) + (w & 0x000f);
+      c += w;
+      if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
+	x >>= LOCAL_SHIFT_BITS;
+      else
+	x = 0;
+    }
+  return c;
+}
+
+mp_bitcnt_t
+mpn_popcount (mp_srcptr p, mp_size_t n)
+{
+  mp_size_t i;
+  mp_bitcnt_t c;
+
+  for (c = 0, i = 0; i < n; i++)
+    c += gmp_popcount_limb (p[i]);
+
+  return c;
+}
+
+mp_bitcnt_t
+mpz_popcount (const mpz_t u)
+{
+  mp_size_t un;
+
+  un = u->_mp_size;
+
+  if (un < 0)
+    return ~(mp_bitcnt_t) 0;
+
+  return mpn_popcount (u->_mp_d, un);
+}
+
+mp_bitcnt_t
+mpz_hamdist (const mpz_t u, const mpz_t v)
+{
+  mp_size_t un, vn, i;
+  mp_limb_t uc, vc, ul, vl, comp;
+  mp_srcptr up, vp;
+  mp_bitcnt_t c;
+
+  un = u->_mp_size;
+  vn = v->_mp_size;
+
+  if ( (un ^ vn) < 0)
+    return ~(mp_bitcnt_t) 0;
+
+  comp = - (uc = vc = (un < 0));
+  if (uc)
+    {
+      assert (vn < 0);
+      un = -un;
+      vn = -vn;
+    }
+
+  up = u->_mp_d;
+  vp = v->_mp_d;
+
+  if (un < vn)
+    MPN_SRCPTR_SWAP (up, un, vp, vn);
+
+  for (i = 0, c = 0; i < vn; i++)
+    {
+      ul = (up[i] ^ comp) + uc;
+      uc = ul < uc;
+
+      vl = (vp[i] ^ comp) + vc;
+      vc = vl < vc;
+
+      c += gmp_popcount_limb (ul ^ vl);
+    }
+  assert (vc == 0);
+
+  for (; i < un; i++)
+    {
+      ul = (up[i] ^ comp) + uc;
+      uc = ul < uc;
+
+      c += gmp_popcount_limb (ul ^ comp);
+    }
+
+  return c;
+}
+
+mp_bitcnt_t
+mpz_scan1 (const mpz_t u, mp_bitcnt_t starting_bit)
+{
+  mp_ptr up;
+  mp_size_t us, un, i;
+  mp_limb_t limb, ux;
+
+  us = u->_mp_size;
+  un = GMP_ABS (us);
+  i = starting_bit / GMP_LIMB_BITS;
+
+  /* Past the end there's no 1 bits for u>=0, or an immediate 1 bit
+     for u<0. Notice this test picks up any u==0 too. */
+  if (i >= un)
+    return (us >= 0 ? ~(mp_bitcnt_t) 0 : starting_bit);
+
+  up = u->_mp_d;
+  ux = 0;
+  limb = up[i];
+
+  if (starting_bit != 0)
+    {
+      if (us < 0)
+	{
+	  ux = mpn_zero_p (up, i);
+	  limb = ~ limb + ux;
+	  ux = - (mp_limb_t) (limb >= ux);
+	}
+
+      /* Mask to 0 all bits before starting_bit, thus ignoring them. */
+      limb &= GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS);
+    }
+
+  return mpn_common_scan (limb, i, up, un, ux);
+}
+
+mp_bitcnt_t
+mpz_scan0 (const mpz_t u, mp_bitcnt_t starting_bit)
+{
+  mp_ptr up;
+  mp_size_t us, un, i;
+  mp_limb_t limb, ux;
+
+  us = u->_mp_size;
+  ux = - (mp_limb_t) (us >= 0);
+  un = GMP_ABS (us);
+  i = starting_bit / GMP_LIMB_BITS;
+
+  /* When past end, there's an immediate 0 bit for u>=0, or no 0 bits for
+     u<0.  Notice this test picks up all cases of u==0 too. */
+  if (i >= un)
+    return (ux ? starting_bit : ~(mp_bitcnt_t) 0);
+
+  up = u->_mp_d;
+  limb = up[i] ^ ux;
+
+  if (ux == 0)
+    limb -= mpn_zero_p (up, i); /* limb = ~(~limb + zero_p) */
+
+  /* Mask all bits before starting_bit, thus ignoring them. */
+  limb &= GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS);
+
+  return mpn_common_scan (limb, i, up, un, ux);
+}
+
+
+/* MPZ base conversion. */
+
+size_t
+mpz_sizeinbase (const mpz_t u, int base)
+{
+  mp_size_t un;
+  mp_srcptr up;
+  mp_ptr tp;
+  mp_bitcnt_t bits;
+  struct gmp_div_inverse bi;
+  size_t ndigits;
+
+  assert (base >= 2);
+  assert (base <= 62);
+
+  un = GMP_ABS (u->_mp_size);
+  if (un == 0)
+    return 1;
+
+  up = u->_mp_d;
+
+  bits = (un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1]);
+  switch (base)
+    {
+    case 2:
+      return bits;
+    case 4:
+      return (bits + 1) / 2;
+    case 8:
+      return (bits + 2) / 3;
+    case 16:
+      return (bits + 3) / 4;
+    case 32:
+      return (bits + 4) / 5;
+      /* FIXME: Do something more clever for the common case of base
+	 10. */
+    }
+
+  tp = gmp_xalloc_limbs (un);
+  mpn_copyi (tp, up, un);
+  mpn_div_qr_1_invert (&bi, base);
+
+  ndigits = 0;
+  do
+    {
+      ndigits++;
+      mpn_div_qr_1_preinv (tp, tp, un, &bi);
+      un -= (tp[un-1] == 0);
+    }
+  while (un > 0);
+
+  gmp_free (tp);
+  return ndigits;
+}
+
+char *
+mpz_get_str (char *sp, int base, const mpz_t u)
+{
+  unsigned bits;
+  const char *digits;
+  mp_size_t un;
+  size_t i, sn;
+
+  digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+  if (base > 1)
+    {
+      if (base <= 36)
+	digits = "0123456789abcdefghijklmnopqrstuvwxyz";
+      else if (base > 62)
+	return NULL;
+    }
+  else if (base >= -1)
+    base = 10;
+  else
+    {
+      base = -base;
+      if (base > 36)
+	return NULL;
+    }
+
+  sn = 1 + mpz_sizeinbase (u, base);
+  if (!sp)
+    sp = (char *) gmp_xalloc (1 + sn);
+
+  un = GMP_ABS (u->_mp_size);
+
+  if (un == 0)
+    {
+      sp[0] = '0';
+      sp[1] = '\0';
+      return sp;
+    }
+
+  i = 0;
+
+  if (u->_mp_size < 0)
+    sp[i++] = '-';
+
+  bits = mpn_base_power_of_two_p (base);
+
+  if (bits)
+    /* Not modified in this case. */
+    sn = i + mpn_get_str_bits ((unsigned char *) sp + i, bits, u->_mp_d, un);
+  else
+    {
+      struct mpn_base_info info;
+      mp_ptr tp;
+
+      mpn_get_base_info (&info, base);
+      tp = gmp_xalloc_limbs (un);
+      mpn_copyi (tp, u->_mp_d, un);
+
+      sn = i + mpn_get_str_other ((unsigned char *) sp + i, base, &info, tp, un);
+      gmp_free (tp);
+    }
+
+  for (; i < sn; i++)
+    sp[i] = digits[(unsigned char) sp[i]];
+
+  sp[sn] = '\0';
+  return sp;
+}
+
+int
+mpz_set_str (mpz_t r, const char *sp, int base)
+{
+  unsigned bits, value_of_a;
+  mp_size_t rn, alloc;
+  mp_ptr rp;
+  size_t dn;
+  int sign;
+  unsigned char *dp;
+
+  assert (base == 0 || (base >= 2 && base <= 62));
+
+  while (isspace( (unsigned char) *sp))
+    sp++;
+
+  sign = (*sp == '-');
+  sp += sign;
+
+  if (base == 0)
+    {
+      if (sp[0] == '0')
+	{
+	  if (sp[1] == 'x' || sp[1] == 'X')
+	    {
+	      base = 16;
+	      sp += 2;
+	    }
+	  else if (sp[1] == 'b' || sp[1] == 'B')
+	    {
+	      base = 2;
+	      sp += 2;
+	    }
+	  else
+	    base = 8;
+	}
+      else
+	base = 10;
+    }
+
+  if (!*sp)
+    {
+      r->_mp_size = 0;
+      return -1;
+    }
+  dp = (unsigned char *) gmp_xalloc (strlen (sp));
+
+  value_of_a = (base > 36) ? 36 : 10;
+  for (dn = 0; *sp; sp++)
+    {
+      unsigned digit;
+
+      if (isspace ((unsigned char) *sp))
+	continue;
+      else if (*sp >= '0' && *sp <= '9')
+	digit = *sp - '0';
+      else if (*sp >= 'a' && *sp <= 'z')
+	digit = *sp - 'a' + value_of_a;
+      else if (*sp >= 'A' && *sp <= 'Z')
+	digit = *sp - 'A' + 10;
+      else
+	digit = base; /* fail */
+
+      if (digit >= (unsigned) base)
+	{
+	  gmp_free (dp);
+	  r->_mp_size = 0;
+	  return -1;
+	}
+
+      dp[dn++] = digit;
+    }
+
+  if (!dn)
+    {
+      gmp_free (dp);
+      r->_mp_size = 0;
+      return -1;
+    }
+  bits = mpn_base_power_of_two_p (base);
+
+  if (bits > 0)
+    {
+      alloc = (dn * bits + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
+      rp = MPZ_REALLOC (r, alloc);
+      rn = mpn_set_str_bits (rp, dp, dn, bits);
+    }
+  else
+    {
+      struct mpn_base_info info;
+      mpn_get_base_info (&info, base);
+      alloc = (dn + info.exp - 1) / info.exp;
+      rp = MPZ_REALLOC (r, alloc);
+      rn = mpn_set_str_other (rp, dp, dn, base, &info);
+      /* Normalization, needed for all-zero input. */
+      assert (rn > 0);
+      rn -= rp[rn-1] == 0;
+    }
+  assert (rn <= alloc);
+  gmp_free (dp);
+
+  r->_mp_size = sign ? - rn : rn;
+
+  return 0;
+}
+
+int
+mpz_init_set_str (mpz_t r, const char *sp, int base)
+{
+  mpz_init (r);
+  return mpz_set_str (r, sp, base);
+}
+
+size_t
+mpz_out_str (FILE *stream, int base, const mpz_t x)
+{
+  char *str;
+  size_t len;
+
+  str = mpz_get_str (NULL, base, x);
+  if (!str)
+    return 0;
+  len = strlen (str);
+  len = fwrite (str, 1, len, stream);
+  gmp_free (str);
+  return len;
+}
+
+
+static int
+gmp_detect_endian (void)
+{
+  static const int i = 2;
+  const unsigned char *p = (const unsigned char *) &i;
+  return 1 - *p;
+}
+
+/* Import and export. Does not support nails. */
+void
+mpz_import (mpz_t r, size_t count, int order, size_t size, int endian,
+	    size_t nails, const void *src)
+{
+  const unsigned char *p;
+  ptrdiff_t word_step;
+  mp_ptr rp;
+  mp_size_t rn;
+
+  /* The current (partial) limb. */
+  mp_limb_t limb;
+  /* The number of bytes already copied to this limb (starting from
+     the low end). */
+  size_t bytes;
+  /* The index where the limb should be stored, when completed. */
+  mp_size_t i;
+
+  if (nails != 0)
+    gmp_die ("mpz_import: Nails not supported.");
+
+  assert (order == 1 || order == -1);
+  assert (endian >= -1 && endian <= 1);
+
+  if (endian == 0)
+    endian = gmp_detect_endian ();
+
+  p = (unsigned char *) src;
+
+  word_step = (order != endian) ? 2 * size : 0;
+
+  /* Process bytes from the least significant end, so point p at the
+     least significant word. */
+  if (order == 1)
+    {
+      p += size * (count - 1);
+      word_step = - word_step;
+    }
+
+  /* And at least significant byte of that word. */
+  if (endian == 1)
+    p += (size - 1);
+
+  rn = (size * count + sizeof(mp_limb_t) - 1) / sizeof(mp_limb_t);
+  rp = MPZ_REALLOC (r, rn);
+
+  for (limb = 0, bytes = 0, i = 0; count > 0; count--, p += word_step)
+    {
+      size_t j;
+      for (j = 0; j < size; j++, p -= (ptrdiff_t) endian)
+	{
+	  limb |= (mp_limb_t) *p << (bytes++ * CHAR_BIT);
+	  if (bytes == sizeof(mp_limb_t))
+	    {
+	      rp[i++] = limb;
+	      bytes = 0;
+	      limb = 0;
+	    }
+	}
+    }
+  assert (i + (bytes > 0) == rn);
+  if (limb != 0)
+    rp[i++] = limb;
+  else
+    i = mpn_normalized_size (rp, i);
+
+  r->_mp_size = i;
+}
+
+void *
+mpz_export (void *r, size_t *countp, int order, size_t size, int endian,
+	    size_t nails, const mpz_t u)
+{
+  size_t count;
+  mp_size_t un;
+
+  if (nails != 0)
+    gmp_die ("mpz_import: Nails not supported.");
+
+  assert (order == 1 || order == -1);
+  assert (endian >= -1 && endian <= 1);
+  assert (size > 0 || u->_mp_size == 0);
+
+  un = u->_mp_size;
+  count = 0;
+  if (un != 0)
+    {
+      size_t k;
+      unsigned char *p;
+      ptrdiff_t word_step;
+      /* The current (partial) limb. */
+      mp_limb_t limb;
+      /* The number of bytes left to do in this limb. */
+      size_t bytes;
+      /* The index where the limb was read. */
+      mp_size_t i;
+
+      un = GMP_ABS (un);
+
+      /* Count bytes in top limb. */
+      limb = u->_mp_d[un-1];
+      assert (limb != 0);
+
+      k = (GMP_LIMB_BITS <= CHAR_BIT);
+      if (!k)
+	{
+	  do {
+	    int LOCAL_CHAR_BIT = CHAR_BIT;
+	    k++; limb >>= LOCAL_CHAR_BIT;
+	  } while (limb != 0);
+	}
+      /* else limb = 0; */
+
+      count = (k + (un-1) * sizeof (mp_limb_t) + size - 1) / size;
+
+      if (!r)
+	r = gmp_xalloc (count * size);
+
+      if (endian == 0)
+	endian = gmp_detect_endian ();
+
+      p = (unsigned char *) r;
+
+      word_step = (order != endian) ? 2 * size : 0;
+
+      /* Process bytes from the least significant end, so point p at the
+	 least significant word. */
+      if (order == 1)
+	{
+	  p += size * (count - 1);
+	  word_step = - word_step;
+	}
+
+      /* And at least significant byte of that word. */
+      if (endian == 1)
+	p += (size - 1);
+
+      for (bytes = 0, i = 0, k = 0; k < count; k++, p += word_step)
+	{
+	  size_t j;
+	  for (j = 0; j < size; ++j, p -= (ptrdiff_t) endian)
+	    {
+	      if (sizeof (mp_limb_t) == 1)
+		{
+		  if (i < un)
+		    *p = u->_mp_d[i++];
+		  else
+		    *p = 0;
+		}
+	      else
+		{
+		  int LOCAL_CHAR_BIT = CHAR_BIT;
+		  if (bytes == 0)
+		    {
+		      if (i < un)
+			limb = u->_mp_d[i++];
+		      bytes = sizeof (mp_limb_t);
+		    }
+		  *p = limb;
+		  limb >>= LOCAL_CHAR_BIT;
+		  bytes--;
+		}
+	    }
+	}
+      assert (i == un);
+      assert (k == count);
+    }
+
+  if (countp)
+    *countp = count;
+
+  return r;
+}
diff --git a/vendor/external/gmp/mini-gmp.h b/vendor/external/gmp/mini-gmp.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/gmp/mini-gmp.h
@@ -0,0 +1,309 @@
+/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
+
+Copyright 2011-2015, 2017, 2019-2020 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+  * the GNU Lesser General Public License as published by the Free
+    Software Foundation; either version 3 of the License, or (at your
+    option) any later version.
+
+or
+
+  * the GNU General Public License as published by the Free Software
+    Foundation; either version 2 of the License, or (at your option) any
+    later version.
+
+or both in parallel, as here.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received copies of the GNU General Public License and the
+GNU Lesser General Public License along with the GNU MP Library.  If not,
+see https://www.gnu.org/licenses/.  */
+
+/* About mini-gmp: This is a minimal implementation of a subset of the
+   GMP interface. It is intended for inclusion into applications which
+   have modest bignums needs, as a fallback when the real GMP library
+   is not installed.
+
+   This file defines the public interface. */
+
+#ifndef __MINI_GMP_H__
+#define __MINI_GMP_H__
+
+/* For size_t */
+#include <stddef.h>
+
+#if defined(__EMSCRIPTEN__)
+#include <emscripten.h>
+#endif
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+void mp_set_memory_functions (void *(*) (size_t),
+			      void *(*) (void *, size_t, size_t),
+			      void (*) (void *, size_t));
+
+void mp_get_memory_functions (void *(**) (size_t),
+			      void *(**) (void *, size_t, size_t),
+			      void (**) (void *, size_t));
+
+#ifndef MINI_GMP_LIMB_TYPE
+#define MINI_GMP_LIMB_TYPE long
+#endif
+
+typedef unsigned MINI_GMP_LIMB_TYPE mp_limb_t;
+typedef long mp_size_t;
+typedef unsigned long mp_bitcnt_t;
+
+typedef mp_limb_t *mp_ptr;
+typedef const mp_limb_t *mp_srcptr;
+
+typedef struct
+{
+  int _mp_alloc;		/* Number of *limbs* allocated and pointed
+				   to by the _mp_d field.  */
+  int _mp_size;			/* abs(_mp_size) is the number of limbs the
+				   last field points to.  If _mp_size is
+				   negative this is a negative number.  */
+  mp_limb_t *_mp_d;		/* Pointer to the limbs.  */
+} __mpz_struct;
+
+typedef __mpz_struct mpz_t[1];
+
+typedef __mpz_struct *mpz_ptr;
+typedef const __mpz_struct *mpz_srcptr;
+
+extern const int mp_bits_per_limb;
+
+void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
+void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
+void mpn_zero (mp_ptr, mp_size_t);
+
+int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t);
+int mpn_zero_p (mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+
+mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
+int mpn_perfect_square_p (mp_srcptr, mp_size_t);
+mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+
+mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t);
+mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t);
+
+void mpn_com (mp_ptr, mp_srcptr, mp_size_t);
+mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t);
+
+mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t);
+
+mp_limb_t mpn_invert_3by2 (mp_limb_t, mp_limb_t);
+#define mpn_invert_limb(x) mpn_invert_3by2 ((x), 0)
+
+size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
+mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
+
+void mpz_init (mpz_t);
+void mpz_init2 (mpz_t, mp_bitcnt_t);
+void mpz_clear (mpz_t);
+
+#define mpz_odd_p(z)   (((z)->_mp_size != 0) & (int) (z)->_mp_d[0])
+#define mpz_even_p(z)  (! mpz_odd_p (z))
+
+int mpz_sgn (const mpz_t);
+int mpz_cmp_si (const mpz_t, long);
+int mpz_cmp_ui (const mpz_t, unsigned long);
+int mpz_cmp (const mpz_t, const mpz_t);
+int mpz_cmpabs_ui (const mpz_t, unsigned long);
+int mpz_cmpabs (const mpz_t, const mpz_t);
+int mpz_cmp_d (const mpz_t, double);
+int mpz_cmpabs_d (const mpz_t, double);
+
+void mpz_abs (mpz_t, const mpz_t);
+void mpz_neg (mpz_t, const mpz_t);
+void mpz_swap (mpz_t, mpz_t);
+
+void mpz_add_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_add (mpz_t, const mpz_t, const mpz_t);
+void mpz_sub_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_ui_sub (mpz_t, unsigned long, const mpz_t);
+void mpz_sub (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_mul_si (mpz_t, const mpz_t, long int);
+void mpz_mul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_mul (mpz_t, const mpz_t, const mpz_t);
+void mpz_mul_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_addmul (mpz_t, const mpz_t, const mpz_t);
+void mpz_submul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_submul (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_cdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_fdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_tdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_cdiv_q (mpz_t, const mpz_t, const mpz_t);
+void mpz_fdiv_q (mpz_t, const mpz_t, const mpz_t);
+void mpz_tdiv_q (mpz_t, const mpz_t, const mpz_t);
+void mpz_cdiv_r (mpz_t, const mpz_t, const mpz_t);
+void mpz_fdiv_r (mpz_t, const mpz_t, const mpz_t);
+void mpz_tdiv_r (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_cdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_fdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_tdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_cdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_fdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_tdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+
+void mpz_mod (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_divexact (mpz_t, const mpz_t, const mpz_t);
+
+int mpz_divisible_p (const mpz_t, const mpz_t);
+int mpz_congruent_p (const mpz_t, const mpz_t, const mpz_t);
+
+unsigned long mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_cdiv_q_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_fdiv_q_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_tdiv_q_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_cdiv_r_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_fdiv_r_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_tdiv_r_ui (mpz_t, const mpz_t, unsigned long);
+unsigned long mpz_cdiv_ui (const mpz_t, unsigned long);
+unsigned long mpz_fdiv_ui (const mpz_t, unsigned long);
+unsigned long mpz_tdiv_ui (const mpz_t, unsigned long);
+
+unsigned long mpz_mod_ui (mpz_t, const mpz_t, unsigned long);
+
+void mpz_divexact_ui (mpz_t, const mpz_t, unsigned long);
+
+int mpz_divisible_ui_p (const mpz_t, unsigned long);
+
+unsigned long mpz_gcd_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_gcd (mpz_t, const mpz_t, const mpz_t);
+void mpz_gcdext (mpz_t, mpz_t, mpz_t, const mpz_t, const mpz_t);
+void mpz_lcm_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_lcm (mpz_t, const mpz_t, const mpz_t);
+int mpz_invert (mpz_t, const mpz_t, const mpz_t);
+
+void mpz_sqrtrem (mpz_t, mpz_t, const mpz_t);
+void mpz_sqrt (mpz_t, const mpz_t);
+int mpz_perfect_square_p (const mpz_t);
+
+void mpz_pow_ui (mpz_t, const mpz_t, unsigned long);
+void mpz_ui_pow_ui (mpz_t, unsigned long, unsigned long);
+void mpz_powm (mpz_t, const mpz_t, const mpz_t, const mpz_t);
+void mpz_powm_ui (mpz_t, const mpz_t, unsigned long, const mpz_t);
+
+void mpz_rootrem (mpz_t, mpz_t, const mpz_t, unsigned long);
+int mpz_root (mpz_t, const mpz_t, unsigned long);
+
+void mpz_fac_ui (mpz_t, unsigned long);
+void mpz_2fac_ui (mpz_t, unsigned long);
+void mpz_mfac_uiui (mpz_t, unsigned long, unsigned long);
+void mpz_bin_uiui (mpz_t, unsigned long, unsigned long);
+
+int mpz_probab_prime_p (const mpz_t, int);
+
+int mpz_tstbit (const mpz_t, mp_bitcnt_t);
+void mpz_setbit (mpz_t, mp_bitcnt_t);
+void mpz_clrbit (mpz_t, mp_bitcnt_t);
+void mpz_combit (mpz_t, mp_bitcnt_t);
+
+void mpz_com (mpz_t, const mpz_t);
+void mpz_and (mpz_t, const mpz_t, const mpz_t);
+void mpz_ior (mpz_t, const mpz_t, const mpz_t);
+void mpz_xor (mpz_t, const mpz_t, const mpz_t);
+
+mp_bitcnt_t mpz_popcount (const mpz_t);
+mp_bitcnt_t mpz_hamdist (const mpz_t, const mpz_t);
+mp_bitcnt_t mpz_scan0 (const mpz_t, mp_bitcnt_t);
+mp_bitcnt_t mpz_scan1 (const mpz_t, mp_bitcnt_t);
+
+int mpz_fits_slong_p (const mpz_t);
+int mpz_fits_ulong_p (const mpz_t);
+long int mpz_get_si (const mpz_t);
+unsigned long int mpz_get_ui (const mpz_t);
+double mpz_get_d (const mpz_t);
+size_t mpz_size (const mpz_t);
+mp_limb_t mpz_getlimbn (const mpz_t, mp_size_t);
+
+void mpz_realloc2 (mpz_t, mp_bitcnt_t);
+mp_srcptr mpz_limbs_read (mpz_srcptr);
+mp_ptr mpz_limbs_modify (mpz_t, mp_size_t);
+mp_ptr mpz_limbs_write (mpz_t, mp_size_t);
+void mpz_limbs_finish (mpz_t, mp_size_t);
+mpz_srcptr mpz_roinit_n (mpz_t, mp_srcptr, mp_size_t);
+
+#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
+
+void mpz_set_si (mpz_t, signed long int);
+void mpz_set_ui (mpz_t, unsigned long int);
+void mpz_set (mpz_t, const mpz_t);
+void mpz_set_d (mpz_t, double);
+
+void mpz_init_set_si (mpz_t, signed long int);
+void mpz_init_set_ui (mpz_t, unsigned long int);
+void mpz_init_set (mpz_t, const mpz_t);
+void mpz_init_set_d (mpz_t, double);
+
+size_t mpz_sizeinbase (const mpz_t, int);
+char *mpz_get_str (char *, int, const mpz_t);
+int mpz_set_str (mpz_t, const char *, int);
+int mpz_init_set_str (mpz_t, const char *, int);
+
+/* This long list taken from gmp.h. */
+/* For reference, "defined(EOF)" cannot be used here.  In g++ 2.95.4,
+   <iostream> defines EOF but not FILE.  */
+#if defined (FILE)                                              \
+  || defined (H_STDIO)                                          \
+  || defined (_H_STDIO)               /* AIX */                 \
+  || defined (_STDIO_H)               /* glibc, Sun, SCO */     \
+  || defined (_STDIO_H_)              /* BSD, OSF */            \
+  || defined (__STDIO_H)              /* Borland */             \
+  || defined (__STDIO_H__)            /* IRIX */                \
+  || defined (_STDIO_INCLUDED)        /* HPUX */                \
+  || defined (__dj_include_stdio_h_)  /* DJGPP */               \
+  || defined (_FILE_DEFINED)          /* Microsoft */           \
+  || defined (__STDIO__)              /* Apple MPW MrC */       \
+  || defined (_MSL_STDIO_H)           /* Metrowerks */          \
+  || defined (_STDIO_H_INCLUDED)      /* QNX4 */		\
+  || defined (_ISO_STDIO_ISO_H)       /* Sun C++ */		\
+  || defined (__STDIO_LOADED)         /* VMS */			\
+  || defined (__DEFINED_FILE)         /* musl */
+size_t mpz_out_str (FILE *, int, const mpz_t);
+#endif
+
+void mpz_import (mpz_t, size_t, int, size_t, int, size_t, const void *);
+void *mpz_export (void *, size_t *, int, size_t, int, size_t, const mpz_t);
+
+#if defined (__cplusplus)
+}
+#endif
+#endif /* __MINI_GMP_H__ */
diff --git a/vendor/external/libsodium/LICENSE b/vendor/external/libsodium/LICENSE
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/LICENSE
@@ -0,0 +1,18 @@
+/*
+ * ISC License
+ *
+ * Copyright (c) 2013-2023
+ * Frank Denis <j at pureftpd dot org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
diff --git a/vendor/external/libsodium/README.markdown b/vendor/external/libsodium/README.markdown
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/README.markdown
@@ -0,0 +1,46 @@
+[![GitHub CI](https://github.com/jedisct1/libsodium/workflows/CI/badge.svg)](https://github.com/jedisct1/libsodium/actions)
+[![Windows build status](https://ci.appveyor.com/api/projects/status/fu8s2elx25il98hj?svg=true)](https://ci.appveyor.com/project/jedisct1/libsodium)
+[![Coverity Scan Build Status](https://scan.coverity.com/projects/2397/badge.svg)](https://scan.coverity.com/projects/2397)
+[![Azure build status](https://jedisct1.visualstudio.com/Libsodium/_apis/build/status/jedisct1.libsodium?branchName=stable)](https://jedisct1.visualstudio.com/Libsodium/_build/latest?definitionId=3&branchName=stable)
+[![CodeQL scan](https://github.com/jedisct1/libsodium/workflows/CodeQL%20scan/badge.svg)](https://github.com/jedisct1/libsodium/actions)
+
+![libsodium](https://raw.github.com/jedisct1/libsodium/master/logo.png)
+============
+
+Sodium is a new, easy-to-use software library for encryption,
+decryption, signatures, password hashing and more.
+
+It is a portable, cross-compilable, installable, packageable
+fork of [NaCl](http://nacl.cr.yp.to/), with a compatible API, and an
+extended API to improve usability even further.
+
+Its goal is to provide all of the core operations needed to build
+higher-level cryptographic tools.
+
+Sodium supports a variety of compilers and operating systems,
+including Windows (with MingW or Visual Studio, x86 and x64), iOS, Android,
+as well as Javascript and Webassembly.
+
+## Documentation
+
+The documentation is available on Gitbook and built from the
+[libsodium-doc](https://github.com/jedisct1/libsodium-doc) repository:
+
+* [libsodium documentation](https://doc.libsodium.org) - online, requires Javascript.
+
+## Integrity Checking
+
+The integrity checking instructions (including the signing key for libsodium)
+are available in the [installation](https://download.libsodium.org/doc/installation#integrity-checking)
+section of the documentation.
+
+## Community
+
+A mailing-list is available to discuss libsodium.
+
+In order to join, just send a random mail to `sodium-subscribe` {at}
+`pureftpd` {dot} `org`.
+
+## License
+
+[ISC license](https://en.wikipedia.org/wiki/ISC_license).
diff --git a/vendor/external/libsodium/crypto_aead/chacha20poly1305/aead_chacha20poly1305.c b/vendor/external/libsodium/crypto_aead/chacha20poly1305/aead_chacha20poly1305.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_aead/chacha20poly1305/aead_chacha20poly1305.c
@@ -0,0 +1,400 @@
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+
+#include "core.h"
+#include "crypto_aead_chacha20poly1305.h"
+#include "crypto_onetimeauth_poly1305.h"
+#include "crypto_stream_chacha20.h"
+#include "crypto_verify_16.h"
+#include "randombytes.h"
+#include "utils.h"
+
+#include "private/chacha20_ietf_ext.h"
+#include "private/common.h"
+
+static const unsigned char _pad0[16] = { 0 };
+
+int
+crypto_aead_chacha20poly1305_encrypt_detached(unsigned char *c,
+                                              unsigned char *mac,
+                                              unsigned long long *maclen_p,
+                                              const unsigned char *m,
+                                              unsigned long long mlen,
+                                              const unsigned char *ad,
+                                              unsigned long long adlen,
+                                              const unsigned char *nsec,
+                                              const unsigned char *npub,
+                                              const unsigned char *k)
+{
+    crypto_onetimeauth_poly1305_state state;
+    unsigned char                     block0[64U];
+    unsigned char                     slen[8U];
+
+    (void) nsec;
+    crypto_stream_chacha20(block0, sizeof block0, npub, k);
+    crypto_onetimeauth_poly1305_init(&state, block0);
+    sodium_memzero(block0, sizeof block0);
+
+    crypto_onetimeauth_poly1305_update(&state, ad, adlen);
+    STORE64_LE(slen, (uint64_t) adlen);
+    crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+    crypto_stream_chacha20_xor_ic(c, m, mlen, npub, 1U, k);
+
+    crypto_onetimeauth_poly1305_update(&state, c, mlen);
+    STORE64_LE(slen, (uint64_t) mlen);
+    crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+    crypto_onetimeauth_poly1305_final(&state, mac);
+    sodium_memzero(&state, sizeof state);
+
+    if (maclen_p != NULL) {
+        *maclen_p = crypto_aead_chacha20poly1305_ABYTES;
+    }
+    return 0;
+}
+
+int
+crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
+                                     unsigned long long *clen_p,
+                                     const unsigned char *m,
+                                     unsigned long long mlen,
+                                     const unsigned char *ad,
+                                     unsigned long long adlen,
+                                     const unsigned char *nsec,
+                                     const unsigned char *npub,
+                                     const unsigned char *k)
+{
+    unsigned long long clen = 0ULL;
+    int                ret;
+
+    if (mlen > crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    ret = crypto_aead_chacha20poly1305_encrypt_detached(c,
+                                                        c + mlen, NULL,
+                                                        m, mlen,
+                                                        ad, adlen,
+                                                        nsec, npub, k);
+    if (clen_p != NULL) {
+        if (ret == 0) {
+            clen = mlen + crypto_aead_chacha20poly1305_ABYTES;
+        }
+        *clen_p = clen;
+    }
+    return ret;
+}
+
+int
+crypto_aead_chacha20poly1305_ietf_encrypt_detached(unsigned char *c,
+                                                   unsigned char *mac,
+                                                   unsigned long long *maclen_p,
+                                                   const unsigned char *m,
+                                                   unsigned long long mlen,
+                                                   const unsigned char *ad,
+                                                   unsigned long long adlen,
+                                                   const unsigned char *nsec,
+                                                   const unsigned char *npub,
+                                                   const unsigned char *k)
+{
+    crypto_onetimeauth_poly1305_state state;
+    unsigned char                     block0[64U];
+    unsigned char                     slen[8U];
+
+    (void) nsec;
+    crypto_stream_chacha20_ietf(block0, sizeof block0, npub, k);
+    crypto_onetimeauth_poly1305_init(&state, block0);
+    sodium_memzero(block0, sizeof block0);
+
+    crypto_onetimeauth_poly1305_update(&state, ad, adlen);
+    crypto_onetimeauth_poly1305_update(&state, _pad0, (0x10 - adlen) & 0xf);
+
+    crypto_stream_chacha20_ietf_xor_ic(c, m, mlen, npub, 1U, k);
+
+    crypto_onetimeauth_poly1305_update(&state, c, mlen);
+    crypto_onetimeauth_poly1305_update(&state, _pad0, (0x10 - mlen) & 0xf);
+
+    STORE64_LE(slen, (uint64_t) adlen);
+    crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+    STORE64_LE(slen, (uint64_t) mlen);
+    crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+    crypto_onetimeauth_poly1305_final(&state, mac);
+    sodium_memzero(&state, sizeof state);
+
+    if (maclen_p != NULL) {
+        *maclen_p = crypto_aead_chacha20poly1305_ietf_ABYTES;
+    }
+    return 0;
+}
+
+int
+crypto_aead_chacha20poly1305_ietf_encrypt(unsigned char *c,
+                                          unsigned long long *clen_p,
+                                          const unsigned char *m,
+                                          unsigned long long mlen,
+                                          const unsigned char *ad,
+                                          unsigned long long adlen,
+                                          const unsigned char *nsec,
+                                          const unsigned char *npub,
+                                          const unsigned char *k)
+{
+    unsigned long long clen = 0ULL;
+    int                ret;
+
+    if (mlen > crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    ret = crypto_aead_chacha20poly1305_ietf_encrypt_detached(c,
+                                                             c + mlen, NULL,
+                                                             m, mlen,
+                                                             ad, adlen,
+                                                             nsec, npub, k);
+    if (clen_p != NULL) {
+        if (ret == 0) {
+            clen = mlen + crypto_aead_chacha20poly1305_ietf_ABYTES;
+        }
+        *clen_p = clen;
+    }
+    return ret;
+}
+
+int
+crypto_aead_chacha20poly1305_decrypt_detached(unsigned char *m,
+                                              unsigned char *nsec,
+                                              const unsigned char *c,
+                                              unsigned long long clen,
+                                              const unsigned char *mac,
+                                              const unsigned char *ad,
+                                              unsigned long long adlen,
+                                              const unsigned char *npub,
+                                              const unsigned char *k)
+{
+    crypto_onetimeauth_poly1305_state state;
+    unsigned char                     block0[64U];
+    unsigned char                     slen[8U];
+    unsigned char                     computed_mac[crypto_aead_chacha20poly1305_ABYTES];
+    unsigned long long                mlen;
+    int                               ret;
+
+    (void) nsec;
+    crypto_stream_chacha20(block0, sizeof block0, npub, k);
+    crypto_onetimeauth_poly1305_init(&state, block0);
+    sodium_memzero(block0, sizeof block0);
+
+    crypto_onetimeauth_poly1305_update(&state, ad, adlen);
+    STORE64_LE(slen, (uint64_t) adlen);
+    crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+    mlen = clen;
+    crypto_onetimeauth_poly1305_update(&state, c, mlen);
+    STORE64_LE(slen, (uint64_t) mlen);
+    crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+    crypto_onetimeauth_poly1305_final(&state, computed_mac);
+    sodium_memzero(&state, sizeof state);
+
+    COMPILER_ASSERT(sizeof computed_mac == 16U);
+    ret = crypto_verify_16(computed_mac, mac);
+    sodium_memzero(computed_mac, sizeof computed_mac);
+    if (m == NULL) {
+        return ret;
+    }
+    if (ret != 0) {
+        memset(m, 0, mlen);
+        return -1;
+    }
+    crypto_stream_chacha20_xor_ic(m, c, mlen, npub, 1U, k);
+
+    return 0;
+}
+
+int
+crypto_aead_chacha20poly1305_decrypt(unsigned char *m,
+                                     unsigned long long *mlen_p,
+                                     unsigned char *nsec,
+                                     const unsigned char *c,
+                                     unsigned long long clen,
+                                     const unsigned char *ad,
+                                     unsigned long long adlen,
+                                     const unsigned char *npub,
+                                     const unsigned char *k)
+{
+    unsigned long long mlen = 0ULL;
+    int                ret = -1;
+
+    if (clen >= crypto_aead_chacha20poly1305_ABYTES) {
+        ret = crypto_aead_chacha20poly1305_decrypt_detached
+            (m, nsec,
+             c, clen - crypto_aead_chacha20poly1305_ABYTES,
+             c + clen - crypto_aead_chacha20poly1305_ABYTES,
+             ad, adlen, npub, k);
+    }
+    if (mlen_p != NULL) {
+        if (ret == 0) {
+            mlen = clen - crypto_aead_chacha20poly1305_ABYTES;
+        }
+        *mlen_p = mlen;
+    }
+    return ret;
+}
+
+int
+crypto_aead_chacha20poly1305_ietf_decrypt_detached(unsigned char *m,
+                                                   unsigned char *nsec,
+                                                   const unsigned char *c,
+                                                   unsigned long long clen,
+                                                   const unsigned char *mac,
+                                                   const unsigned char *ad,
+                                                   unsigned long long adlen,
+                                                   const unsigned char *npub,
+                                                   const unsigned char *k)
+{
+    crypto_onetimeauth_poly1305_state state;
+    unsigned char                     block0[64U];
+    unsigned char                     slen[8U];
+    unsigned char                     computed_mac[crypto_aead_chacha20poly1305_ietf_ABYTES];
+    unsigned long long                mlen;
+    int                               ret;
+
+    (void) nsec;
+    crypto_stream_chacha20_ietf(block0, sizeof block0, npub, k);
+    crypto_onetimeauth_poly1305_init(&state, block0);
+    sodium_memzero(block0, sizeof block0);
+
+    crypto_onetimeauth_poly1305_update(&state, ad, adlen);
+    crypto_onetimeauth_poly1305_update(&state, _pad0, (0x10 - adlen) & 0xf);
+
+    mlen = clen;
+    crypto_onetimeauth_poly1305_update(&state, c, mlen);
+    crypto_onetimeauth_poly1305_update(&state, _pad0, (0x10 - mlen) & 0xf);
+
+    STORE64_LE(slen, (uint64_t) adlen);
+    crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+    STORE64_LE(slen, (uint64_t) mlen);
+    crypto_onetimeauth_poly1305_update(&state, slen, sizeof slen);
+
+    crypto_onetimeauth_poly1305_final(&state, computed_mac);
+    sodium_memzero(&state, sizeof state);
+
+    COMPILER_ASSERT(sizeof computed_mac == 16U);
+    ret = crypto_verify_16(computed_mac, mac);
+    sodium_memzero(computed_mac, sizeof computed_mac);
+    if (m == NULL) {
+        return ret;
+    }
+    if (ret != 0) {
+        memset(m, 0, mlen);
+        return -1;
+    }
+    crypto_stream_chacha20_ietf_xor_ic(m, c, mlen, npub, 1U, k);
+
+    return 0;
+}
+
+int
+crypto_aead_chacha20poly1305_ietf_decrypt(unsigned char *m,
+                                          unsigned long long *mlen_p,
+                                          unsigned char *nsec,
+                                          const unsigned char *c,
+                                          unsigned long long clen,
+                                          const unsigned char *ad,
+                                          unsigned long long adlen,
+                                          const unsigned char *npub,
+                                          const unsigned char *k)
+{
+    unsigned long long mlen = 0ULL;
+    int                ret = -1;
+
+    if (clen >= crypto_aead_chacha20poly1305_ietf_ABYTES) {
+        ret = crypto_aead_chacha20poly1305_ietf_decrypt_detached
+            (m, nsec,
+             c, clen - crypto_aead_chacha20poly1305_ietf_ABYTES,
+             c + clen - crypto_aead_chacha20poly1305_ietf_ABYTES,
+             ad, adlen, npub, k);
+    }
+    if (mlen_p != NULL) {
+        if (ret == 0) {
+            mlen = clen - crypto_aead_chacha20poly1305_ietf_ABYTES;
+        }
+        *mlen_p = mlen;
+    }
+    return ret;
+}
+
+size_t
+crypto_aead_chacha20poly1305_ietf_keybytes(void)
+{
+    return crypto_aead_chacha20poly1305_ietf_KEYBYTES;
+}
+
+size_t
+crypto_aead_chacha20poly1305_ietf_npubbytes(void)
+{
+    return crypto_aead_chacha20poly1305_ietf_NPUBBYTES;
+}
+
+size_t
+crypto_aead_chacha20poly1305_ietf_nsecbytes(void)
+{
+    return crypto_aead_chacha20poly1305_ietf_NSECBYTES;
+}
+
+size_t
+crypto_aead_chacha20poly1305_ietf_abytes(void)
+{
+    return crypto_aead_chacha20poly1305_ietf_ABYTES;
+}
+
+size_t
+crypto_aead_chacha20poly1305_ietf_messagebytes_max(void)
+{
+    return crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX;
+}
+
+void
+crypto_aead_chacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_chacha20poly1305_ietf_KEYBYTES])
+{
+    randombytes_buf(k, crypto_aead_chacha20poly1305_ietf_KEYBYTES);
+}
+
+size_t
+crypto_aead_chacha20poly1305_keybytes(void)
+{
+    return crypto_aead_chacha20poly1305_KEYBYTES;
+}
+
+size_t
+crypto_aead_chacha20poly1305_npubbytes(void)
+{
+    return crypto_aead_chacha20poly1305_NPUBBYTES;
+}
+
+size_t
+crypto_aead_chacha20poly1305_nsecbytes(void)
+{
+    return crypto_aead_chacha20poly1305_NSECBYTES;
+}
+
+size_t
+crypto_aead_chacha20poly1305_abytes(void)
+{
+    return crypto_aead_chacha20poly1305_ABYTES;
+}
+
+size_t
+crypto_aead_chacha20poly1305_messagebytes_max(void)
+{
+    return crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX;
+}
+
+void
+crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_chacha20poly1305_KEYBYTES])
+{
+    randombytes_buf(k, crypto_aead_chacha20poly1305_KEYBYTES);
+}
diff --git a/vendor/external/libsodium/crypto_auth/crypto_auth.c b/vendor/external/libsodium/crypto_auth/crypto_auth.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_auth/crypto_auth.c
@@ -0,0 +1,41 @@
+
+#include "crypto_auth.h"
+#include "randombytes.h"
+
+size_t
+crypto_auth_bytes(void)
+{
+    return crypto_auth_BYTES;
+}
+
+size_t
+crypto_auth_keybytes(void)
+{
+    return crypto_auth_KEYBYTES;
+}
+
+const char *
+crypto_auth_primitive(void)
+{
+    return crypto_auth_PRIMITIVE;
+}
+
+int
+crypto_auth(unsigned char *out, const unsigned char *in,
+            unsigned long long inlen, const unsigned char *k)
+{
+    return crypto_auth_hmacsha512256(out, in, inlen, k);
+}
+
+int
+crypto_auth_verify(const unsigned char *h, const unsigned char *in,
+                   unsigned long long inlen,const unsigned char *k)
+{
+    return crypto_auth_hmacsha512256_verify(h, in, inlen, k);
+}
+
+void
+crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES])
+{
+    randombytes_buf(k, crypto_auth_KEYBYTES);
+}
diff --git a/vendor/external/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c b/vendor/external/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c
@@ -0,0 +1,118 @@
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "crypto_auth_hmacsha256.h"
+#include "crypto_hash_sha256.h"
+#include "crypto_verify_32.h"
+#include "randombytes.h"
+#include "utils.h"
+
+size_t
+crypto_auth_hmacsha256_bytes(void)
+{
+    return crypto_auth_hmacsha256_BYTES;
+}
+
+size_t
+crypto_auth_hmacsha256_keybytes(void)
+{
+    return crypto_auth_hmacsha256_KEYBYTES;
+}
+
+size_t
+crypto_auth_hmacsha256_statebytes(void)
+{
+    return sizeof(crypto_auth_hmacsha256_state);
+}
+
+void
+crypto_auth_hmacsha256_keygen(unsigned char k[crypto_auth_hmacsha256_KEYBYTES])
+{
+    randombytes_buf(k, crypto_auth_hmacsha256_KEYBYTES);
+}
+
+int
+crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state,
+                            const unsigned char *key, size_t keylen)
+{
+    unsigned char pad[64];
+    unsigned char khash[32];
+    size_t        i;
+
+    if (keylen > 64) {
+        crypto_hash_sha256_init(&state->ictx);
+        crypto_hash_sha256_update(&state->ictx, key, keylen);
+        crypto_hash_sha256_final(&state->ictx, khash);
+        key    = khash;
+        keylen = 32;
+    }
+    crypto_hash_sha256_init(&state->ictx);
+    memset(pad, 0x36, 64);
+    for (i = 0; i < keylen; i++) {
+        pad[i] ^= key[i];
+    }
+    crypto_hash_sha256_update(&state->ictx, pad, 64);
+
+    crypto_hash_sha256_init(&state->octx);
+    memset(pad, 0x5c, 64);
+    for (i = 0; i < keylen; i++) {
+        pad[i] ^= key[i];
+    }
+    crypto_hash_sha256_update(&state->octx, pad, 64);
+
+    sodium_memzero((void *) pad, sizeof pad);
+    sodium_memzero((void *) khash, sizeof khash);
+
+    return 0;
+}
+
+int
+crypto_auth_hmacsha256_update(crypto_auth_hmacsha256_state *state,
+                              const unsigned char *in, unsigned long long inlen)
+{
+    crypto_hash_sha256_update(&state->ictx, in, inlen);
+
+    return 0;
+}
+
+int
+crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state *state,
+                             unsigned char                *out)
+{
+    unsigned char ihash[32];
+
+    crypto_hash_sha256_final(&state->ictx, ihash);
+    crypto_hash_sha256_update(&state->octx, ihash, 32);
+    crypto_hash_sha256_final(&state->octx, out);
+
+    sodium_memzero((void *) ihash, sizeof ihash);
+
+    return 0;
+}
+
+int
+crypto_auth_hmacsha256(unsigned char *out, const unsigned char *in,
+                       unsigned long long inlen, const unsigned char *k)
+{
+    crypto_auth_hmacsha256_state state;
+
+    crypto_auth_hmacsha256_init(&state, k, crypto_auth_hmacsha256_KEYBYTES);
+    crypto_auth_hmacsha256_update(&state, in, inlen);
+    crypto_auth_hmacsha256_final(&state, out);
+
+    return 0;
+}
+
+int
+crypto_auth_hmacsha256_verify(const unsigned char *h, const unsigned char *in,
+                              unsigned long long inlen, const unsigned char *k)
+{
+    unsigned char correct[32];
+
+    crypto_auth_hmacsha256(correct, in, inlen, k);
+
+    return crypto_verify_32(h, correct) | (-(h == correct)) |
+           sodium_memcmp(correct, h, 32);
+}
diff --git a/vendor/external/libsodium/crypto_auth/hmacsha512/auth_hmacsha512.c b/vendor/external/libsodium/crypto_auth/hmacsha512/auth_hmacsha512.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_auth/hmacsha512/auth_hmacsha512.c
@@ -0,0 +1,118 @@
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "crypto_auth_hmacsha512.h"
+#include "crypto_hash_sha512.h"
+#include "crypto_verify_64.h"
+#include "randombytes.h"
+#include "utils.h"
+
+size_t
+crypto_auth_hmacsha512_bytes(void)
+{
+    return crypto_auth_hmacsha512_BYTES;
+}
+
+size_t
+crypto_auth_hmacsha512_keybytes(void)
+{
+    return crypto_auth_hmacsha512_KEYBYTES;
+}
+
+size_t
+crypto_auth_hmacsha512_statebytes(void)
+{
+    return sizeof(crypto_auth_hmacsha512_state);
+}
+
+void
+crypto_auth_hmacsha512_keygen(unsigned char k[crypto_auth_hmacsha512_KEYBYTES])
+{
+    randombytes_buf(k, crypto_auth_hmacsha512_KEYBYTES);
+}
+
+int
+crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state,
+                            const unsigned char *key, size_t keylen)
+{
+    unsigned char pad[128];
+    unsigned char khash[64];
+    size_t        i;
+
+    if (keylen > 128) {
+        crypto_hash_sha512_init(&state->ictx);
+        crypto_hash_sha512_update(&state->ictx, key, keylen);
+        crypto_hash_sha512_final(&state->ictx, khash);
+        key    = khash;
+        keylen = 64;
+    }
+    crypto_hash_sha512_init(&state->ictx);
+    memset(pad, 0x36, 128);
+    for (i = 0; i < keylen; i++) {
+        pad[i] ^= key[i];
+    }
+    crypto_hash_sha512_update(&state->ictx, pad, 128);
+
+    crypto_hash_sha512_init(&state->octx);
+    memset(pad, 0x5c, 128);
+    for (i = 0; i < keylen; i++) {
+        pad[i] ^= key[i];
+    }
+    crypto_hash_sha512_update(&state->octx, pad, 128);
+
+    sodium_memzero((void *) pad, sizeof pad);
+    sodium_memzero((void *) khash, sizeof khash);
+
+    return 0;
+}
+
+int
+crypto_auth_hmacsha512_update(crypto_auth_hmacsha512_state *state,
+                              const unsigned char *in, unsigned long long inlen)
+{
+    crypto_hash_sha512_update(&state->ictx, in, inlen);
+
+    return 0;
+}
+
+int
+crypto_auth_hmacsha512_final(crypto_auth_hmacsha512_state *state,
+                             unsigned char                *out)
+{
+    unsigned char ihash[64];
+
+    crypto_hash_sha512_final(&state->ictx, ihash);
+    crypto_hash_sha512_update(&state->octx, ihash, 64);
+    crypto_hash_sha512_final(&state->octx, out);
+
+    sodium_memzero((void *) ihash, sizeof ihash);
+
+    return 0;
+}
+
+int
+crypto_auth_hmacsha512(unsigned char *out, const unsigned char *in,
+                       unsigned long long inlen, const unsigned char *k)
+{
+    crypto_auth_hmacsha512_state state;
+
+    crypto_auth_hmacsha512_init(&state, k, crypto_auth_hmacsha512_KEYBYTES);
+    crypto_auth_hmacsha512_update(&state, in, inlen);
+    crypto_auth_hmacsha512_final(&state, out);
+
+    return 0;
+}
+
+int
+crypto_auth_hmacsha512_verify(const unsigned char *h, const unsigned char *in,
+                              unsigned long long inlen, const unsigned char *k)
+{
+    unsigned char correct[64];
+
+    crypto_auth_hmacsha512(correct, in, inlen, k);
+
+    return crypto_verify_64(h, correct) | (-(h == correct)) |
+           sodium_memcmp(correct, h, 64);
+}
diff --git a/vendor/external/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c b/vendor/external/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c
@@ -0,0 +1,93 @@
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "crypto_auth_hmacsha512.h"
+#include "crypto_auth_hmacsha512256.h"
+#include "crypto_hash_sha512.h"
+#include "crypto_verify_32.h"
+#include "randombytes.h"
+#include "utils.h"
+
+size_t
+crypto_auth_hmacsha512256_bytes(void)
+{
+    return crypto_auth_hmacsha512256_BYTES;
+}
+
+size_t
+crypto_auth_hmacsha512256_keybytes(void)
+{
+    return crypto_auth_hmacsha512256_KEYBYTES;
+}
+
+size_t
+crypto_auth_hmacsha512256_statebytes(void)
+{
+    return sizeof(crypto_auth_hmacsha512256_state);
+}
+
+void
+crypto_auth_hmacsha512256_keygen(
+    unsigned char k[crypto_auth_hmacsha512256_KEYBYTES])
+{
+    randombytes_buf(k, crypto_auth_hmacsha512256_KEYBYTES);
+}
+
+int
+crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state,
+                               const unsigned char *key, size_t keylen)
+{
+    return crypto_auth_hmacsha512_init((crypto_auth_hmacsha512_state *) state,
+                                       key, keylen);
+}
+
+int
+crypto_auth_hmacsha512256_update(crypto_auth_hmacsha512256_state *state,
+                                 const unsigned char             *in,
+                                 unsigned long long               inlen)
+{
+    return crypto_auth_hmacsha512_update((crypto_auth_hmacsha512_state *) state,
+                                         in, inlen);
+}
+
+int
+crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state *state,
+                                unsigned char                   *out)
+{
+    unsigned char out0[64];
+
+    crypto_auth_hmacsha512_final((crypto_auth_hmacsha512_state *) state, out0);
+    memcpy(out, out0, 32);
+
+    return 0;
+}
+
+int
+crypto_auth_hmacsha512256(unsigned char *out, const unsigned char *in,
+                          unsigned long long inlen, const unsigned char *k)
+{
+    crypto_auth_hmacsha512256_state state;
+
+    crypto_auth_hmacsha512256_init(&state, k,
+                                   crypto_auth_hmacsha512256_KEYBYTES);
+    crypto_auth_hmacsha512256_update(&state, in, inlen);
+    crypto_auth_hmacsha512256_final(&state, out);
+
+    return 0;
+}
+
+int
+crypto_auth_hmacsha512256_verify(const unsigned char *h,
+                                 const unsigned char *in,
+                                 unsigned long long   inlen,
+                                 const unsigned char *k)
+{
+    unsigned char correct[32];
+
+    crypto_auth_hmacsha512256(correct, in, inlen, k);
+
+    return crypto_verify_32(h, correct) | (-(h == correct)) |
+           sodium_memcmp(correct, h, 32);
+}
diff --git a/vendor/external/libsodium/crypto_core/ed25519/core_ed25519.c b/vendor/external/libsodium/crypto_core/ed25519/core_ed25519.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/ed25519/core_ed25519.c
@@ -0,0 +1,225 @@
+
+#include <stdint.h>
+
+#include "crypto_core_ed25519.h"
+#include "private/common.h"
+#include "private/ed25519_ref10.h"
+#include "randombytes.h"
+#include "utils.h"
+
+int
+crypto_core_ed25519_is_valid_point(const unsigned char *p)
+{
+    ge25519_p3 p_p3;
+
+    if (ge25519_is_canonical(p) == 0 ||
+        ge25519_has_small_order(p) != 0 ||
+        ge25519_frombytes(&p_p3, p) != 0 ||
+        ge25519_is_on_curve(&p_p3) == 0 ||
+        ge25519_is_on_main_subgroup(&p_p3) == 0) {
+        return 0;
+    }
+    return 1;
+}
+
+int
+crypto_core_ed25519_add(unsigned char *r,
+                        const unsigned char *p, const unsigned char *q)
+{
+    ge25519_p3     p_p3, q_p3, r_p3;
+    ge25519_p1p1   r_p1p1;
+    ge25519_cached q_cached;
+
+    if (ge25519_frombytes(&p_p3, p) != 0 || ge25519_is_on_curve(&p_p3) == 0 ||
+        ge25519_frombytes(&q_p3, q) != 0 || ge25519_is_on_curve(&q_p3) == 0) {
+        return -1;
+    }
+    ge25519_p3_to_cached(&q_cached, &q_p3);
+    ge25519_add(&r_p1p1, &p_p3, &q_cached);
+    ge25519_p1p1_to_p3(&r_p3, &r_p1p1);
+    ge25519_p3_tobytes(r, &r_p3);
+
+    return 0;
+}
+
+int
+crypto_core_ed25519_sub(unsigned char *r,
+                        const unsigned char *p, const unsigned char *q)
+{
+    ge25519_p3     p_p3, q_p3, r_p3;
+    ge25519_p1p1   r_p1p1;
+    ge25519_cached q_cached;
+
+    if (ge25519_frombytes(&p_p3, p) != 0 || ge25519_is_on_curve(&p_p3) == 0 ||
+        ge25519_frombytes(&q_p3, q) != 0 || ge25519_is_on_curve(&q_p3) == 0) {
+        return -1;
+    }
+    ge25519_p3_to_cached(&q_cached, &q_p3);
+    ge25519_sub(&r_p1p1, &p_p3, &q_cached);
+    ge25519_p1p1_to_p3(&r_p3, &r_p1p1);
+    ge25519_p3_tobytes(r, &r_p3);
+
+    return 0;
+}
+
+int
+crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r)
+{
+    ge25519_from_uniform(p, r);
+
+    return 0;
+}
+
+int
+crypto_core_ed25519_from_hash(unsigned char *p, const unsigned char *h)
+{
+    ge25519_from_hash(p, h);
+
+    return 0;
+}
+
+void
+crypto_core_ed25519_random(unsigned char *p)
+{
+    unsigned char h[crypto_core_ed25519_UNIFORMBYTES];
+
+    randombytes_buf(h, sizeof h);
+    (void) crypto_core_ed25519_from_uniform(p, h);
+}
+
+void
+crypto_core_ed25519_scalar_random(unsigned char *r)
+{
+    do {
+        randombytes_buf(r, crypto_core_ed25519_SCALARBYTES);
+        r[crypto_core_ed25519_SCALARBYTES - 1] &= 0x1f;
+    } while (sc25519_is_canonical(r) == 0 ||
+             sodium_is_zero(r, crypto_core_ed25519_SCALARBYTES));
+}
+
+int
+crypto_core_ed25519_scalar_invert(unsigned char *recip, const unsigned char *s)
+{
+    sc25519_invert(recip, s);
+
+    return - sodium_is_zero(s, crypto_core_ed25519_SCALARBYTES);
+}
+
+/* 2^252+27742317777372353535851937790883648493 */
+static const unsigned char L[] = {
+    0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7,
+    0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10
+};
+
+void
+crypto_core_ed25519_scalar_negate(unsigned char *neg, const unsigned char *s)
+{
+    unsigned char t_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+    unsigned char s_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+
+    COMPILER_ASSERT(crypto_core_ed25519_NONREDUCEDSCALARBYTES >=
+                    2 * crypto_core_ed25519_SCALARBYTES);
+    memset(t_, 0, sizeof t_);
+    memset(s_, 0, sizeof s_);
+    memcpy(t_ + crypto_core_ed25519_SCALARBYTES, L,
+           crypto_core_ed25519_SCALARBYTES);
+    memcpy(s_, s, crypto_core_ed25519_SCALARBYTES);
+    sodium_sub(t_, s_, sizeof t_);
+    sc25519_reduce(t_);
+    memcpy(neg, t_, crypto_core_ed25519_SCALARBYTES);
+}
+
+void
+crypto_core_ed25519_scalar_complement(unsigned char *comp,
+                                      const unsigned char *s)
+{
+    unsigned char t_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+    unsigned char s_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+
+    COMPILER_ASSERT(crypto_core_ed25519_NONREDUCEDSCALARBYTES >=
+                    2 * crypto_core_ed25519_SCALARBYTES);
+    memset(t_, 0, sizeof t_);
+    memset(s_, 0, sizeof s_);
+    t_[0]++;
+    memcpy(t_ + crypto_core_ed25519_SCALARBYTES, L,
+           crypto_core_ed25519_SCALARBYTES);
+    memcpy(s_, s, crypto_core_ed25519_SCALARBYTES);
+    sodium_sub(t_, s_, sizeof t_);
+    sc25519_reduce(t_);
+    memcpy(comp, t_, crypto_core_ed25519_SCALARBYTES);
+}
+
+void
+crypto_core_ed25519_scalar_add(unsigned char *z, const unsigned char *x,
+                               const unsigned char *y)
+{
+    unsigned char x_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+    unsigned char y_[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+
+    memset(x_, 0, sizeof x_);
+    memset(y_, 0, sizeof y_);
+    memcpy(x_, x, crypto_core_ed25519_SCALARBYTES);
+    memcpy(y_, y, crypto_core_ed25519_SCALARBYTES);
+    sodium_add(x_, y_, crypto_core_ed25519_SCALARBYTES);
+    crypto_core_ed25519_scalar_reduce(z, x_);
+}
+
+void
+crypto_core_ed25519_scalar_sub(unsigned char *z, const unsigned char *x,
+                               const unsigned char *y)
+{
+    unsigned char yn[crypto_core_ed25519_SCALARBYTES];
+
+    crypto_core_ed25519_scalar_negate(yn, y);
+    crypto_core_ed25519_scalar_add(z, x, yn);
+}
+
+void
+crypto_core_ed25519_scalar_mul(unsigned char *z, const unsigned char *x,
+                               const unsigned char *y)
+{
+    sc25519_mul(z, x, y);
+}
+
+void
+crypto_core_ed25519_scalar_reduce(unsigned char *r,
+                                  const unsigned char *s)
+{
+    unsigned char t[crypto_core_ed25519_NONREDUCEDSCALARBYTES];
+
+    memcpy(t, s, sizeof t);
+    sc25519_reduce(t);
+    memcpy(r, t, crypto_core_ed25519_SCALARBYTES);
+    sodium_memzero(t, sizeof t);
+}
+
+size_t
+crypto_core_ed25519_bytes(void)
+{
+    return crypto_core_ed25519_BYTES;
+}
+
+size_t
+crypto_core_ed25519_nonreducedscalarbytes(void)
+{
+    return crypto_core_ed25519_NONREDUCEDSCALARBYTES;
+}
+
+size_t
+crypto_core_ed25519_uniformbytes(void)
+{
+    return crypto_core_ed25519_UNIFORMBYTES;
+}
+
+size_t
+crypto_core_ed25519_hashbytes(void)
+{
+    return crypto_core_ed25519_HASHBYTES;
+}
+
+size_t
+crypto_core_ed25519_scalarbytes(void)
+{
+    return crypto_core_ed25519_SCALARBYTES;
+}
diff --git a/vendor/external/libsodium/crypto_core/ed25519/core_ristretto255.c b/vendor/external/libsodium/crypto_core/ed25519/core_ristretto255.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/ed25519/core_ristretto255.c
@@ -0,0 +1,156 @@
+
+#include <stdint.h>
+
+#include "crypto_core_ed25519.h"
+#include "crypto_core_ristretto255.h"
+#include "private/common.h"
+#include "private/ed25519_ref10.h"
+#include "randombytes.h"
+#include "utils.h"
+
+int
+crypto_core_ristretto255_is_valid_point(const unsigned char *p)
+{
+    ge25519_p3 p_p3;
+
+    if (ristretto255_frombytes(&p_p3, p) != 0) {
+        return 0;
+    }
+    return 1;
+}
+
+int
+crypto_core_ristretto255_add(unsigned char *r,
+                             const unsigned char *p, const unsigned char *q)
+{
+    ge25519_p3     p_p3, q_p3, r_p3;
+    ge25519_p1p1   r_p1p1;
+    ge25519_cached q_cached;
+
+    if (ristretto255_frombytes(&p_p3, p) != 0 ||
+        ristretto255_frombytes(&q_p3, q) != 0) {
+        return -1;
+    }
+    ge25519_p3_to_cached(&q_cached, &q_p3);
+    ge25519_add(&r_p1p1, &p_p3, &q_cached);
+    ge25519_p1p1_to_p3(&r_p3, &r_p1p1);
+    ristretto255_p3_tobytes(r, &r_p3);
+
+    return 0;
+}
+
+int
+crypto_core_ristretto255_sub(unsigned char *r,
+                             const unsigned char *p, const unsigned char *q)
+{
+    ge25519_p3     p_p3, q_p3, r_p3;
+    ge25519_p1p1   r_p1p1;
+    ge25519_cached q_cached;
+
+    if (ristretto255_frombytes(&p_p3, p) != 0 ||
+        ristretto255_frombytes(&q_p3, q) != 0) {
+        return -1;
+    }
+    ge25519_p3_to_cached(&q_cached, &q_p3);
+    ge25519_sub(&r_p1p1, &p_p3, &q_cached);
+    ge25519_p1p1_to_p3(&r_p3, &r_p1p1);
+    ristretto255_p3_tobytes(r, &r_p3);
+
+    return 0;
+}
+
+int
+crypto_core_ristretto255_from_hash(unsigned char *p, const unsigned char *r)
+{
+    ristretto255_from_hash(p, r);
+
+    return 0;
+}
+
+void
+crypto_core_ristretto255_random(unsigned char *p)
+{
+    unsigned char h[crypto_core_ristretto255_HASHBYTES];
+
+    randombytes_buf(h, sizeof h);
+    (void) crypto_core_ristretto255_from_hash(p, h);
+}
+
+void
+crypto_core_ristretto255_scalar_random(unsigned char *r)
+{
+    crypto_core_ed25519_scalar_random(r);
+}
+
+int
+crypto_core_ristretto255_scalar_invert(unsigned char *recip,
+                                       const unsigned char *s)
+{
+    return crypto_core_ed25519_scalar_invert(recip, s);
+}
+
+void
+crypto_core_ristretto255_scalar_negate(unsigned char *neg,
+                                       const unsigned char *s)
+{
+    crypto_core_ed25519_scalar_negate(neg, s);
+}
+
+void
+crypto_core_ristretto255_scalar_complement(unsigned char *comp,
+                                           const unsigned char *s)
+{
+    crypto_core_ed25519_scalar_complement(comp, s);
+}
+
+void
+crypto_core_ristretto255_scalar_add(unsigned char *z, const unsigned char *x,
+                                    const unsigned char *y)
+{
+    crypto_core_ed25519_scalar_add(z, x, y);
+}
+
+void
+crypto_core_ristretto255_scalar_sub(unsigned char *z, const unsigned char *x,
+                                    const unsigned char *y)
+{
+    crypto_core_ed25519_scalar_sub(z, x, y);
+}
+
+void
+crypto_core_ristretto255_scalar_mul(unsigned char *z, const unsigned char *x,
+                                    const unsigned char *y)
+{
+    sc25519_mul(z, x, y);
+}
+
+void
+crypto_core_ristretto255_scalar_reduce(unsigned char *r,
+                                       const unsigned char *s)
+{
+    crypto_core_ed25519_scalar_reduce(r, s);
+}
+
+size_t
+crypto_core_ristretto255_bytes(void)
+{
+    return crypto_core_ristretto255_BYTES;
+}
+
+size_t
+crypto_core_ristretto255_nonreducedscalarbytes(void)
+{
+    return crypto_core_ristretto255_NONREDUCEDSCALARBYTES;
+}
+
+size_t
+crypto_core_ristretto255_hashbytes(void)
+{
+    return crypto_core_ristretto255_HASHBYTES;
+}
+
+size_t
+crypto_core_ristretto255_scalarbytes(void)
+{
+    return crypto_core_ristretto255_SCALARBYTES;
+}
diff --git a/vendor/external/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c b/vendor/external/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c
@@ -0,0 +1,2858 @@
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "crypto_verify_32.h"
+#include "private/common.h"
+#include "private/ed25519_ref10.h"
+#include "utils.h"
+
+static inline uint64_t
+load_3(const unsigned char *in)
+{
+    uint64_t result;
+
+    result = (uint64_t) in[0];
+    result |= ((uint64_t) in[1]) << 8;
+    result |= ((uint64_t) in[2]) << 16;
+
+    return result;
+}
+
+static inline uint64_t
+load_4(const unsigned char *in)
+{
+    uint64_t result;
+
+    result = (uint64_t) in[0];
+    result |= ((uint64_t) in[1]) << 8;
+    result |= ((uint64_t) in[2]) << 16;
+    result |= ((uint64_t) in[3]) << 24;
+
+    return result;
+}
+
+/*
+ * Field arithmetic:
+ * Use 5*51 bit limbs on 64-bit systems with support for 128 bit arithmetic,
+ * and 10*25.5 bit limbs elsewhere.
+ *
+ * Functions used elsewhere that are candidates for inlining are defined
+ * via "private/curve25519_ref10.h".
+ */
+
+#ifdef HAVE_TI_MODE
+# include "fe_51/constants.h"
+# include "fe_51/fe.h"
+#else
+# include "fe_25_5/constants.h"
+# include "fe_25_5/fe.h"
+#endif
+
+void
+fe25519_invert(fe25519 out, const fe25519 z)
+{
+    fe25519 t0;
+    fe25519 t1;
+    fe25519 t2;
+    fe25519 t3;
+    int     i;
+
+    fe25519_sq(t0, z);
+    fe25519_sq(t1, t0);
+    fe25519_sq(t1, t1);
+    fe25519_mul(t1, z, t1);
+    fe25519_mul(t0, t0, t1);
+    fe25519_sq(t2, t0);
+    fe25519_mul(t1, t1, t2);
+    fe25519_sq(t2, t1);
+    for (i = 1; i < 5; ++i) {
+        fe25519_sq(t2, t2);
+    }
+    fe25519_mul(t1, t2, t1);
+    fe25519_sq(t2, t1);
+    for (i = 1; i < 10; ++i) {
+        fe25519_sq(t2, t2);
+    }
+    fe25519_mul(t2, t2, t1);
+    fe25519_sq(t3, t2);
+    for (i = 1; i < 20; ++i) {
+        fe25519_sq(t3, t3);
+    }
+    fe25519_mul(t2, t3, t2);
+    for (i = 1; i < 11; ++i) {
+        fe25519_sq(t2, t2);
+    }
+    fe25519_mul(t1, t2, t1);
+    fe25519_sq(t2, t1);
+    for (i = 1; i < 50; ++i) {
+        fe25519_sq(t2, t2);
+    }
+    fe25519_mul(t2, t2, t1);
+    fe25519_sq(t3, t2);
+    for (i = 1; i < 100; ++i) {
+        fe25519_sq(t3, t3);
+    }
+    fe25519_mul(t2, t3, t2);
+    for (i = 1; i < 51; ++i) {
+        fe25519_sq(t2, t2);
+    }
+    fe25519_mul(t1, t2, t1);
+    for (i = 1; i < 6; ++i) {
+        fe25519_sq(t1, t1);
+    }
+    fe25519_mul(out, t1, t0);
+}
+
+static void
+fe25519_pow22523(fe25519 out, const fe25519 z)
+{
+    fe25519 t0;
+    fe25519 t1;
+    fe25519 t2;
+    int     i;
+
+    fe25519_sq(t0, z);
+    fe25519_sq(t1, t0);
+    fe25519_sq(t1, t1);
+    fe25519_mul(t1, z, t1);
+    fe25519_mul(t0, t0, t1);
+    fe25519_sq(t0, t0);
+    fe25519_mul(t0, t1, t0);
+    fe25519_sq(t1, t0);
+    for (i = 1; i < 5; ++i) {
+        fe25519_sq(t1, t1);
+    }
+    fe25519_mul(t0, t1, t0);
+    fe25519_sq(t1, t0);
+    for (i = 1; i < 10; ++i) {
+        fe25519_sq(t1, t1);
+    }
+    fe25519_mul(t1, t1, t0);
+    fe25519_sq(t2, t1);
+    for (i = 1; i < 20; ++i) {
+        fe25519_sq(t2, t2);
+    }
+    fe25519_mul(t1, t2, t1);
+    for (i = 1; i < 11; ++i) {
+        fe25519_sq(t1, t1);
+    }
+    fe25519_mul(t0, t1, t0);
+    fe25519_sq(t1, t0);
+    for (i = 1; i < 50; ++i) {
+        fe25519_sq(t1, t1);
+    }
+    fe25519_mul(t1, t1, t0);
+    fe25519_sq(t2, t1);
+    for (i = 1; i < 100; ++i) {
+        fe25519_sq(t2, t2);
+    }
+    fe25519_mul(t1, t2, t1);
+    for (i = 1; i < 51; ++i) {
+        fe25519_sq(t1, t1);
+    }
+    fe25519_mul(t0, t1, t0);
+    fe25519_sq(t0, t0);
+    fe25519_sq(t0, t0);
+    fe25519_mul(out, t0, z);
+}
+
+static inline void
+fe25519_cneg(fe25519 h, const fe25519 f, unsigned int b)
+{
+    fe25519 negf;
+
+    fe25519_neg(negf, f);
+    fe25519_copy(h, f);
+    fe25519_cmov(h, negf, b);
+}
+
+static inline void
+fe25519_abs(fe25519 h, const fe25519 f)
+{
+    fe25519_cneg(h, f, fe25519_isnegative(f));
+}
+
+static inline void
+fe25519_sqmul(fe25519 s, const int n, const fe25519 a)
+{
+    int i;
+
+    for (i = 0; i < n; i++) {
+        fe25519_sq(s, s);
+    }
+    fe25519_mul(s, s, a);
+}
+
+static unsigned int
+fe25519_notsquare(const fe25519 x)
+{
+    fe25519       _10, _11, _1100, _1111, _11110000, _11111111;
+    fe25519       t, u, v;
+    unsigned char s[32];
+
+    /* Jacobi symbol - x^((p-1)/2) */
+    fe25519_mul(_10, x, x);
+    fe25519_mul(_11, x, _10);
+    fe25519_sq(_1100, _11);
+    fe25519_sq(_1100, _1100);
+    fe25519_mul(_1111, _11, _1100);
+    fe25519_sq(_11110000, _1111);
+    fe25519_sq(_11110000, _11110000);
+    fe25519_sq(_11110000, _11110000);
+    fe25519_sq(_11110000, _11110000);
+    fe25519_mul(_11111111, _1111, _11110000);
+    fe25519_copy(t, _11111111);
+    fe25519_sqmul(t, 2, _11);
+    fe25519_copy(u, t);
+    fe25519_sqmul(t, 10, u);
+    fe25519_sqmul(t, 10, u);
+    fe25519_copy(v, t);
+    fe25519_sqmul(t, 30, v);
+    fe25519_copy(v, t);
+    fe25519_sqmul(t, 60, v);
+    fe25519_copy(v, t);
+    fe25519_sqmul(t, 120, v);
+    fe25519_sqmul(t, 10, u);
+    fe25519_sqmul(t, 3, _11);
+    fe25519_sq(t, t);
+
+    fe25519_tobytes(s, t);
+
+    return s[1] & 1;
+}
+
+/*
+ r = p + q
+ */
+
+void
+ge25519_add(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q)
+{
+    fe25519 t0;
+
+    fe25519_add(r->X, p->Y, p->X);
+    fe25519_sub(r->Y, p->Y, p->X);
+    fe25519_mul(r->Z, r->X, q->YplusX);
+    fe25519_mul(r->Y, r->Y, q->YminusX);
+    fe25519_mul(r->T, q->T2d, p->T);
+    fe25519_mul(r->X, p->Z, q->Z);
+    fe25519_add(t0, r->X, r->X);
+    fe25519_sub(r->X, r->Z, r->Y);
+    fe25519_add(r->Y, r->Z, r->Y);
+    fe25519_add(r->Z, t0, r->T);
+    fe25519_sub(r->T, t0, r->T);
+}
+
+static void
+slide_vartime(signed char *r, const unsigned char *a)
+{
+    int i;
+    int b;
+    int k;
+    int ribs;
+    int cmp;
+
+    for (i = 0; i < 256; ++i) {
+        r[i] = 1 & (a[i >> 3] >> (i & 7));
+    }
+    for (i = 0; i < 256; ++i) {
+        if (! r[i]) {
+            continue;
+        }
+        for (b = 1; b <= 6 && i + b < 256; ++b) {
+            if (! r[i + b]) {
+                continue;
+            }
+            ribs = r[i + b] << b;
+            cmp = r[i] + ribs;
+            if (cmp <= 15) {
+                r[i] = cmp;
+                r[i + b] = 0;
+            } else {
+                cmp = r[i] - ribs;
+                if (cmp < -15) {
+                    break;
+                }
+                r[i] = cmp;
+                for (k = i + b; k < 256; ++k) {
+                    if (! r[k]) {
+                        r[k] = 1;
+                        break;
+                    }
+                    r[k] = 0;
+                }
+            }
+        }
+    }
+}
+
+int
+ge25519_frombytes(ge25519_p3 *h, const unsigned char *s)
+{
+    fe25519 u;
+    fe25519 v;
+    fe25519 vxx;
+    fe25519 m_root_check, p_root_check;
+    fe25519 negx;
+    fe25519 x_sqrtm1;
+    int     has_m_root, has_p_root;
+
+    fe25519_frombytes(h->Y, s);
+    fe25519_1(h->Z);
+    fe25519_sq(u, h->Y);
+    fe25519_mul(v, u, d);
+    fe25519_sub(u, u, h->Z); /* u = y^2-1 */
+    fe25519_add(v, v, h->Z); /* v = dy^2+1 */
+
+    fe25519_mul(h->X, u, v);
+    fe25519_pow22523(h->X, h->X);
+    fe25519_mul(h->X, u, h->X); /* u((uv)^((q-5)/8)) */
+
+    fe25519_sq(vxx, h->X);
+    fe25519_mul(vxx, vxx, v);
+    fe25519_sub(m_root_check, vxx, u); /* vx^2-u */
+    fe25519_add(p_root_check, vxx, u); /* vx^2+u */
+    has_m_root = fe25519_iszero(m_root_check);
+    has_p_root = fe25519_iszero(p_root_check);
+    fe25519_mul(x_sqrtm1, h->X, sqrtm1); /* x*sqrt(-1) */
+    fe25519_cmov(h->X, x_sqrtm1, 1 - has_m_root);
+
+    fe25519_neg(negx, h->X);
+    fe25519_cmov(h->X, negx, fe25519_isnegative(h->X) ^ (s[31] >> 7));
+    fe25519_mul(h->T, h->X, h->Y);
+
+    return (has_m_root | has_p_root) - 1;
+}
+
+int
+ge25519_frombytes_negate_vartime(ge25519_p3 *h, const unsigned char *s)
+{
+    fe25519 u;
+    fe25519 v;
+    fe25519 v3;
+    fe25519 vxx;
+    fe25519 m_root_check, p_root_check;
+
+    fe25519_frombytes(h->Y, s);
+    fe25519_1(h->Z);
+    fe25519_sq(u, h->Y);
+    fe25519_mul(v, u, d);
+    fe25519_sub(u, u, h->Z); /* u = y^2-1 */
+    fe25519_add(v, v, h->Z); /* v = dy^2+1 */
+
+    fe25519_sq(v3, v);
+    fe25519_mul(v3, v3, v); /* v3 = v^3 */
+    fe25519_sq(h->X, v3);
+    fe25519_mul(h->X, h->X, v);
+    fe25519_mul(h->X, h->X, u); /* x = uv^7 */
+
+    fe25519_pow22523(h->X, h->X); /* x = (uv^7)^((q-5)/8) */
+    fe25519_mul(h->X, h->X, v3);
+    fe25519_mul(h->X, h->X, u); /* x = uv^3(uv^7)^((q-5)/8) */
+
+    fe25519_sq(vxx, h->X);
+    fe25519_mul(vxx, vxx, v);
+    fe25519_sub(m_root_check, vxx, u); /* vx^2-u */
+    if (fe25519_iszero(m_root_check) == 0) {
+        fe25519_add(p_root_check, vxx, u); /* vx^2+u */
+        if (fe25519_iszero(p_root_check) == 0) {
+            return -1;
+        }
+        fe25519_mul(h->X, h->X, sqrtm1);
+    }
+
+    if (fe25519_isnegative(h->X) == (s[31] >> 7)) {
+        fe25519_neg(h->X, h->X);
+    }
+    fe25519_mul(h->T, h->X, h->Y);
+
+    return 0;
+}
+
+/*
+ r = p + q
+ */
+
+static void
+ge25519_madd(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_precomp *q)
+{
+    fe25519 t0;
+
+    fe25519_add(r->X, p->Y, p->X);
+    fe25519_sub(r->Y, p->Y, p->X);
+    fe25519_mul(r->Z, r->X, q->yplusx);
+    fe25519_mul(r->Y, r->Y, q->yminusx);
+    fe25519_mul(r->T, q->xy2d, p->T);
+    fe25519_add(t0, p->Z, p->Z);
+    fe25519_sub(r->X, r->Z, r->Y);
+    fe25519_add(r->Y, r->Z, r->Y);
+    fe25519_add(r->Z, t0, r->T);
+    fe25519_sub(r->T, t0, r->T);
+}
+
+/*
+ r = p - q
+ */
+
+static void
+ge25519_msub(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_precomp *q)
+{
+    fe25519 t0;
+
+    fe25519_add(r->X, p->Y, p->X);
+    fe25519_sub(r->Y, p->Y, p->X);
+    fe25519_mul(r->Z, r->X, q->yminusx);
+    fe25519_mul(r->Y, r->Y, q->yplusx);
+    fe25519_mul(r->T, q->xy2d, p->T);
+    fe25519_add(t0, p->Z, p->Z);
+    fe25519_sub(r->X, r->Z, r->Y);
+    fe25519_add(r->Y, r->Z, r->Y);
+    fe25519_sub(r->Z, t0, r->T);
+    fe25519_add(r->T, t0, r->T);
+}
+
+/*
+ r = p
+ */
+
+void
+ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p)
+{
+    fe25519_mul(r->X, p->X, p->T);
+    fe25519_mul(r->Y, p->Y, p->Z);
+    fe25519_mul(r->Z, p->Z, p->T);
+}
+
+/*
+ r = p
+ */
+
+void
+ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p)
+{
+    fe25519_mul(r->X, p->X, p->T);
+    fe25519_mul(r->Y, p->Y, p->Z);
+    fe25519_mul(r->Z, p->Z, p->T);
+    fe25519_mul(r->T, p->X, p->Y);
+}
+
+static void
+ge25519_p2_0(ge25519_p2 *h)
+{
+    fe25519_0(h->X);
+    fe25519_1(h->Y);
+    fe25519_1(h->Z);
+}
+
+/*
+ r = 2 * p
+ */
+
+static void
+ge25519_p2_dbl(ge25519_p1p1 *r, const ge25519_p2 *p)
+{
+    fe25519 t0;
+
+    fe25519_sq(r->X, p->X);
+    fe25519_sq(r->Z, p->Y);
+    fe25519_sq2(r->T, p->Z);
+    fe25519_add(r->Y, p->X, p->Y);
+    fe25519_sq(t0, r->Y);
+    fe25519_add(r->Y, r->Z, r->X);
+    fe25519_sub(r->Z, r->Z, r->X);
+    fe25519_sub(r->X, t0, r->Y);
+    fe25519_sub(r->T, r->T, r->Z);
+}
+
+static void
+ge25519_p3_0(ge25519_p3 *h)
+{
+    fe25519_0(h->X);
+    fe25519_1(h->Y);
+    fe25519_1(h->Z);
+    fe25519_0(h->T);
+}
+
+static void
+ge25519_cached_0(ge25519_cached *h)
+{
+    fe25519_1(h->YplusX);
+    fe25519_1(h->YminusX);
+    fe25519_1(h->Z);
+    fe25519_0(h->T2d);
+}
+
+/*
+ r = p
+ */
+
+void
+ge25519_p3_to_cached(ge25519_cached *r, const ge25519_p3 *p)
+{
+    fe25519_add(r->YplusX, p->Y, p->X);
+    fe25519_sub(r->YminusX, p->Y, p->X);
+    fe25519_copy(r->Z, p->Z);
+    fe25519_mul(r->T2d, p->T, d2);
+}
+
+static void
+ge25519_p3_to_precomp(ge25519_precomp *pi, const ge25519_p3 *p)
+{
+    fe25519 recip;
+    fe25519 x;
+    fe25519 y;
+    fe25519 xy;
+
+    fe25519_invert(recip, p->Z);
+    fe25519_mul(x, p->X, recip);
+    fe25519_mul(y, p->Y, recip);
+    fe25519_add(pi->yplusx, y, x);
+    fe25519_sub(pi->yminusx, y, x);
+    fe25519_mul(xy, x, y);
+    fe25519_mul(pi->xy2d, xy, d2);
+}
+
+/*
+ r = p
+ */
+
+static void
+ge25519_p3_to_p2(ge25519_p2 *r, const ge25519_p3 *p)
+{
+    fe25519_copy(r->X, p->X);
+    fe25519_copy(r->Y, p->Y);
+    fe25519_copy(r->Z, p->Z);
+}
+
+void
+ge25519_p3_tobytes(unsigned char *s, const ge25519_p3 *h)
+{
+    fe25519 recip;
+    fe25519 x;
+    fe25519 y;
+
+    fe25519_invert(recip, h->Z);
+    fe25519_mul(x, h->X, recip);
+    fe25519_mul(y, h->Y, recip);
+    fe25519_tobytes(s, y);
+    s[31] ^= fe25519_isnegative(x) << 7;
+}
+
+/*
+ r = 2 * p
+ */
+
+static void
+ge25519_p3_dbl(ge25519_p1p1 *r, const ge25519_p3 *p)
+{
+    ge25519_p2 q;
+    ge25519_p3_to_p2(&q, p);
+    ge25519_p2_dbl(r, &q);
+}
+
+static void
+ge25519_precomp_0(ge25519_precomp *h)
+{
+    fe25519_1(h->yplusx);
+    fe25519_1(h->yminusx);
+    fe25519_0(h->xy2d);
+}
+
+static unsigned char
+equal(signed char b, signed char c)
+{
+    unsigned char ub = b;
+    unsigned char uc = c;
+    unsigned char x  = ub ^ uc; /* 0: yes; 1..255: no */
+    uint32_t      y  = (uint32_t) x; /* 0: yes; 1..255: no */
+
+    y -= 1;   /* 4294967295: yes; 0..254: no */
+    y >>= 31; /* 1: yes; 0: no */
+
+    return y;
+}
+
+static unsigned char
+negative(signed char b)
+{
+    /* 18446744073709551361..18446744073709551615: yes; 0..255: no */
+    uint64_t x = b;
+
+    x >>= 63; /* 1: yes; 0: no */
+
+    return x;
+}
+
+static void
+ge25519_cmov(ge25519_precomp *t, const ge25519_precomp *u, unsigned char b)
+{
+    fe25519_cmov(t->yplusx, u->yplusx, b);
+    fe25519_cmov(t->yminusx, u->yminusx, b);
+    fe25519_cmov(t->xy2d, u->xy2d, b);
+}
+
+static void
+ge25519_cmov_cached(ge25519_cached *t, const ge25519_cached *u, unsigned char b)
+{
+    fe25519_cmov(t->YplusX, u->YplusX, b);
+    fe25519_cmov(t->YminusX, u->YminusX, b);
+    fe25519_cmov(t->Z, u->Z, b);
+    fe25519_cmov(t->T2d, u->T2d, b);
+}
+
+static void
+ge25519_cmov8(ge25519_precomp *t, const ge25519_precomp precomp[8], const signed char b)
+{
+    ge25519_precomp     minust;
+    const unsigned char bnegative = negative(b);
+    const unsigned char babs      = b - (((-bnegative) & b) * ((signed char) 1 << 1));
+
+    ge25519_precomp_0(t);
+    ge25519_cmov(t, &precomp[0], equal(babs, 1));
+    ge25519_cmov(t, &precomp[1], equal(babs, 2));
+    ge25519_cmov(t, &precomp[2], equal(babs, 3));
+    ge25519_cmov(t, &precomp[3], equal(babs, 4));
+    ge25519_cmov(t, &precomp[4], equal(babs, 5));
+    ge25519_cmov(t, &precomp[5], equal(babs, 6));
+    ge25519_cmov(t, &precomp[6], equal(babs, 7));
+    ge25519_cmov(t, &precomp[7], equal(babs, 8));
+    fe25519_copy(minust.yplusx, t->yminusx);
+    fe25519_copy(minust.yminusx, t->yplusx);
+    fe25519_neg(minust.xy2d, t->xy2d);
+    ge25519_cmov(t, &minust, bnegative);
+}
+
+static void
+ge25519_cmov8_base(ge25519_precomp *t, const int pos, const signed char b)
+{
+    static const ge25519_precomp base[32][8] = { /* base[i][j] = (j+1)*256^i*B */
+#ifdef HAVE_TI_MODE
+# include "fe_51/base.h"
+#else
+# include "fe_25_5/base.h"
+#endif
+    };
+    ge25519_cmov8(t, base[pos], b);
+}
+
+static void
+ge25519_cmov8_cached(ge25519_cached *t, const ge25519_cached cached[8], const signed char b)
+{
+    ge25519_cached      minust;
+    const unsigned char bnegative = negative(b);
+    const unsigned char babs      = b - (((-bnegative) & b) * ((signed char) 1 << 1));
+
+    ge25519_cached_0(t);
+    ge25519_cmov_cached(t, &cached[0], equal(babs, 1));
+    ge25519_cmov_cached(t, &cached[1], equal(babs, 2));
+    ge25519_cmov_cached(t, &cached[2], equal(babs, 3));
+    ge25519_cmov_cached(t, &cached[3], equal(babs, 4));
+    ge25519_cmov_cached(t, &cached[4], equal(babs, 5));
+    ge25519_cmov_cached(t, &cached[5], equal(babs, 6));
+    ge25519_cmov_cached(t, &cached[6], equal(babs, 7));
+    ge25519_cmov_cached(t, &cached[7], equal(babs, 8));
+    fe25519_copy(minust.YplusX, t->YminusX);
+    fe25519_copy(minust.YminusX, t->YplusX);
+    fe25519_copy(minust.Z, t->Z);
+    fe25519_neg(minust.T2d, t->T2d);
+    ge25519_cmov_cached(t, &minust, bnegative);
+}
+
+/*
+ r = p - q
+ */
+
+void
+ge25519_sub(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q)
+{
+    fe25519 t0;
+
+    fe25519_add(r->X, p->Y, p->X);
+    fe25519_sub(r->Y, p->Y, p->X);
+    fe25519_mul(r->Z, r->X, q->YminusX);
+    fe25519_mul(r->Y, r->Y, q->YplusX);
+    fe25519_mul(r->T, q->T2d, p->T);
+    fe25519_mul(r->X, p->Z, q->Z);
+    fe25519_add(t0, r->X, r->X);
+    fe25519_sub(r->X, r->Z, r->Y);
+    fe25519_add(r->Y, r->Z, r->Y);
+    fe25519_sub(r->Z, t0, r->T);
+    fe25519_add(r->T, t0, r->T);
+}
+
+void
+ge25519_tobytes(unsigned char *s, const ge25519_p2 *h)
+{
+    fe25519 recip;
+    fe25519 x;
+    fe25519 y;
+
+    fe25519_invert(recip, h->Z);
+    fe25519_mul(x, h->X, recip);
+    fe25519_mul(y, h->Y, recip);
+    fe25519_tobytes(s, y);
+    s[31] ^= fe25519_isnegative(x) << 7;
+}
+
+/*
+ r = a * A + b * B
+ where a = a[0]+256*a[1]+...+256^31 a[31].
+ and b = b[0]+256*b[1]+...+256^31 b[31].
+ B is the Ed25519 base point (x,4/5) with x positive.
+
+ Only used for signatures verification.
+ */
+
+void
+ge25519_double_scalarmult_vartime(ge25519_p2 *r, const unsigned char *a,
+                                  const ge25519_p3 *A, const unsigned char *b)
+{
+    static const ge25519_precomp Bi[8] = {
+#ifdef HAVE_TI_MODE
+# include "fe_51/base2.h"
+#else
+# include "fe_25_5/base2.h"
+#endif
+    };
+    signed char    aslide[256];
+    signed char    bslide[256];
+    ge25519_cached Ai[8]; /* A,3A,5A,7A,9A,11A,13A,15A */
+    ge25519_p1p1   t;
+    ge25519_p3     u;
+    ge25519_p3     A2;
+    int            i;
+
+    slide_vartime(aslide, a);
+    slide_vartime(bslide, b);
+
+    ge25519_p3_to_cached(&Ai[0], A);
+
+    ge25519_p3_dbl(&t, A);
+    ge25519_p1p1_to_p3(&A2, &t);
+
+    ge25519_add(&t, &A2, &Ai[0]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[1], &u);
+
+    ge25519_add(&t, &A2, &Ai[1]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[2], &u);
+
+    ge25519_add(&t, &A2, &Ai[2]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[3], &u);
+
+    ge25519_add(&t, &A2, &Ai[3]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[4], &u);
+
+    ge25519_add(&t, &A2, &Ai[4]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[5], &u);
+
+    ge25519_add(&t, &A2, &Ai[5]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[6], &u);
+
+    ge25519_add(&t, &A2, &Ai[6]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[7], &u);
+
+    ge25519_p2_0(r);
+
+    for (i = 255; i >= 0; --i) {
+        if (aslide[i] || bslide[i]) {
+            break;
+        }
+    }
+
+    for (; i >= 0; --i) {
+        ge25519_p2_dbl(&t, r);
+
+        if (aslide[i] > 0) {
+            ge25519_p1p1_to_p3(&u, &t);
+            ge25519_add(&t, &u, &Ai[aslide[i] / 2]);
+        } else if (aslide[i] < 0) {
+            ge25519_p1p1_to_p3(&u, &t);
+            ge25519_sub(&t, &u, &Ai[(-aslide[i]) / 2]);
+        }
+
+        if (bslide[i] > 0) {
+            ge25519_p1p1_to_p3(&u, &t);
+            ge25519_madd(&t, &u, &Bi[bslide[i] / 2]);
+        } else if (bslide[i] < 0) {
+            ge25519_p1p1_to_p3(&u, &t);
+            ge25519_msub(&t, &u, &Bi[(-bslide[i]) / 2]);
+        }
+
+        ge25519_p1p1_to_p2(r, &t);
+    }
+}
+
+/*
+ h = a * p
+ where a = a[0]+256*a[1]+...+256^31 a[31]
+
+ Preconditions:
+ a[31] <= 127
+
+ p is public
+ */
+
+void
+ge25519_scalarmult(ge25519_p3 *h, const unsigned char *a, const ge25519_p3 *p)
+{
+    signed char     e[64];
+    signed char     carry;
+    ge25519_p1p1    r;
+    ge25519_p2      s;
+    ge25519_p1p1    t2, t3, t4, t5, t6, t7, t8;
+    ge25519_p3      p2, p3, p4, p5, p6, p7, p8;
+    ge25519_cached  pi[8];
+    ge25519_cached  t;
+    int             i;
+
+    ge25519_p3_to_cached(&pi[1 - 1], p);   /* p */
+
+    ge25519_p3_dbl(&t2, p);
+    ge25519_p1p1_to_p3(&p2, &t2);
+    ge25519_p3_to_cached(&pi[2 - 1], &p2); /* 2p = 2*p */
+
+    ge25519_add(&t3, p, &pi[2 - 1]);
+    ge25519_p1p1_to_p3(&p3, &t3);
+    ge25519_p3_to_cached(&pi[3 - 1], &p3); /* 3p = 2p+p */
+
+    ge25519_p3_dbl(&t4, &p2);
+    ge25519_p1p1_to_p3(&p4, &t4);
+    ge25519_p3_to_cached(&pi[4 - 1], &p4); /* 4p = 2*2p */
+
+    ge25519_add(&t5, p, &pi[4 - 1]);
+    ge25519_p1p1_to_p3(&p5, &t5);
+    ge25519_p3_to_cached(&pi[5 - 1], &p5); /* 5p = 4p+p */
+
+    ge25519_p3_dbl(&t6, &p3);
+    ge25519_p1p1_to_p3(&p6, &t6);
+    ge25519_p3_to_cached(&pi[6 - 1], &p6); /* 6p = 2*3p */
+
+    ge25519_add(&t7, p, &pi[6 - 1]);
+    ge25519_p1p1_to_p3(&p7, &t7);
+    ge25519_p3_to_cached(&pi[7 - 1], &p7); /* 7p = 6p+p */
+
+    ge25519_p3_dbl(&t8, &p4);
+    ge25519_p1p1_to_p3(&p8, &t8);
+    ge25519_p3_to_cached(&pi[8 - 1], &p8); /* 8p = 2*4p */
+
+    for (i = 0; i < 32; ++i) {
+        e[2 * i + 0] = (a[i] >> 0) & 15;
+        e[2 * i + 1] = (a[i] >> 4) & 15;
+    }
+    /* each e[i] is between 0 and 15 */
+    /* e[63] is between 0 and 7 */
+
+    carry = 0;
+    for (i = 0; i < 63; ++i) {
+        e[i] += carry;
+        carry = e[i] + 8;
+        carry >>= 4;
+        e[i] -= carry * ((signed char) 1 << 4);
+    }
+    e[63] += carry;
+    /* each e[i] is between -8 and 8 */
+
+    ge25519_p3_0(h);
+
+    for (i = 63; i != 0; i--) {
+        ge25519_cmov8_cached(&t, pi, e[i]);
+        ge25519_add(&r, h, &t);
+
+        ge25519_p1p1_to_p2(&s, &r);
+        ge25519_p2_dbl(&r, &s);
+        ge25519_p1p1_to_p2(&s, &r);
+        ge25519_p2_dbl(&r, &s);
+        ge25519_p1p1_to_p2(&s, &r);
+        ge25519_p2_dbl(&r, &s);
+        ge25519_p1p1_to_p2(&s, &r);
+        ge25519_p2_dbl(&r, &s);
+
+        ge25519_p1p1_to_p3(h, &r);  /* *16 */
+    }
+    ge25519_cmov8_cached(&t, pi, e[i]);
+    ge25519_add(&r, h, &t);
+
+    ge25519_p1p1_to_p3(h, &r);
+}
+
+/*
+ h = a * B (with precomputation)
+ where a = a[0]+256*a[1]+...+256^31 a[31]
+ B is the Ed25519 base point (x,4/5) with x positive
+ (as bytes: 0x5866666666666666666666666666666666666666666666666666666666666666)
+
+ Preconditions:
+ a[31] <= 127
+ */
+
+void
+ge25519_scalarmult_base(ge25519_p3 *h, const unsigned char *a)
+{
+    signed char     e[64];
+    signed char     carry;
+    ge25519_p1p1    r;
+    ge25519_p2      s;
+    ge25519_precomp t;
+    int             i;
+
+    for (i = 0; i < 32; ++i) {
+        e[2 * i + 0] = (a[i] >> 0) & 15;
+        e[2 * i + 1] = (a[i] >> 4) & 15;
+    }
+    /* each e[i] is between 0 and 15 */
+    /* e[63] is between 0 and 7 */
+
+    carry = 0;
+    for (i = 0; i < 63; ++i) {
+        e[i] += carry;
+        carry = e[i] + 8;
+        carry >>= 4;
+        e[i] -= carry * ((signed char) 1 << 4);
+    }
+    e[63] += carry;
+    /* each e[i] is between -8 and 8 */
+
+    ge25519_p3_0(h);
+
+    for (i = 1; i < 64; i += 2) {
+        ge25519_cmov8_base(&t, i / 2, e[i]);
+        ge25519_madd(&r, h, &t);
+        ge25519_p1p1_to_p3(h, &r);
+    }
+
+    ge25519_p3_dbl(&r, h);
+    ge25519_p1p1_to_p2(&s, &r);
+    ge25519_p2_dbl(&r, &s);
+    ge25519_p1p1_to_p2(&s, &r);
+    ge25519_p2_dbl(&r, &s);
+    ge25519_p1p1_to_p2(&s, &r);
+    ge25519_p2_dbl(&r, &s);
+    ge25519_p1p1_to_p3(h, &r);
+
+    for (i = 0; i < 64; i += 2) {
+        ge25519_cmov8_base(&t, i / 2, e[i]);
+        ge25519_madd(&r, h, &t);
+        ge25519_p1p1_to_p3(h, &r);
+    }
+}
+
+/* multiply by the order of the main subgroup l = 2^252+27742317777372353535851937790883648493 */
+static void
+ge25519_mul_l(ge25519_p3 *r, const ge25519_p3 *A)
+{
+    static const signed char aslide[253] = {
+        13, 0, 0, 0, 0, -1, 0, 0, 0, 0, -11, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0, 0, 0, 0, -3, 0, 0, 0, 0, -13, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, -13, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, -13, 0, 0, 0, 0, 0, 0, -3, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 3, 0, 0, 0, 0, -11, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 7, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
+    };
+    ge25519_cached Ai[8];
+    ge25519_p1p1   t;
+    ge25519_p3     u;
+    ge25519_p3     A2;
+    int            i;
+
+    ge25519_p3_to_cached(&Ai[0], A);
+    ge25519_p3_dbl(&t, A);
+    ge25519_p1p1_to_p3(&A2, &t);
+    ge25519_add(&t, &A2, &Ai[0]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[1], &u);
+    ge25519_add(&t, &A2, &Ai[1]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[2], &u);
+    ge25519_add(&t, &A2, &Ai[2]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[3], &u);
+    ge25519_add(&t, &A2, &Ai[3]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[4], &u);
+    ge25519_add(&t, &A2, &Ai[4]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[5], &u);
+    ge25519_add(&t, &A2, &Ai[5]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[6], &u);
+    ge25519_add(&t, &A2, &Ai[6]);
+    ge25519_p1p1_to_p3(&u, &t);
+    ge25519_p3_to_cached(&Ai[7], &u);
+
+    ge25519_p3_0(r);
+
+    for (i = 252; i >= 0; --i) {
+        ge25519_p3_dbl(&t, r);
+
+        if (aslide[i] > 0) {
+            ge25519_p1p1_to_p3(&u, &t);
+            ge25519_add(&t, &u, &Ai[aslide[i] / 2]);
+        } else if (aslide[i] < 0) {
+            ge25519_p1p1_to_p3(&u, &t);
+            ge25519_sub(&t, &u, &Ai[(-aslide[i]) / 2]);
+        }
+
+        ge25519_p1p1_to_p3(r, &t);
+    }
+}
+
+int
+ge25519_is_on_curve(const ge25519_p3 *p)
+{
+    fe25519 x2;
+    fe25519 y2;
+    fe25519 z2;
+    fe25519 z4;
+    fe25519 t0;
+    fe25519 t1;
+
+    fe25519_sq(x2, p->X);
+    fe25519_sq(y2, p->Y);
+    fe25519_sq(z2, p->Z);
+    fe25519_sub(t0, y2, x2);
+    fe25519_mul(t0, t0, z2);
+
+    fe25519_mul(t1, x2, y2);
+    fe25519_mul(t1, t1, d);
+    fe25519_sq(z4, z2);
+    fe25519_add(t1, t1, z4);
+    fe25519_sub(t0, t0, t1);
+
+    return fe25519_iszero(t0);
+}
+
+int
+ge25519_is_on_main_subgroup(const ge25519_p3 *p)
+{
+    ge25519_p3 pl;
+
+    ge25519_mul_l(&pl, p);
+
+    return fe25519_iszero(pl.X);
+}
+
+int
+ge25519_is_canonical(const unsigned char *s)
+{
+    unsigned char c;
+    unsigned char d;
+    unsigned int  i;
+
+    c = (s[31] & 0x7f) ^ 0x7f;
+    for (i = 30; i > 0; i--) {
+        c |= s[i] ^ 0xff;
+    }
+    c = (((unsigned int) c) - 1U) >> 8;
+    d = (0xed - 1U - (unsigned int) s[0]) >> 8;
+
+    return 1 - (c & d & 1);
+}
+
+int
+ge25519_has_small_order(const unsigned char s[32])
+{
+    CRYPTO_ALIGN(16)
+    static const unsigned char blacklist[][32] = {
+        /* 0 (order 4) */
+        { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+        /* 1 (order 1) */
+        { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+        /* 2707385501144840649318225287225658788936804267575313519463743609750303402022
+           (order 8) */
+        { 0x26, 0xe8, 0x95, 0x8f, 0xc2, 0xb2, 0x27, 0xb0, 0x45, 0xc3, 0xf4,
+          0x89, 0xf2, 0xef, 0x98, 0xf0, 0xd5, 0xdf, 0xac, 0x05, 0xd3, 0xc6,
+          0x33, 0x39, 0xb1, 0x38, 0x02, 0x88, 0x6d, 0x53, 0xfc, 0x05 },
+        /* 55188659117513257062467267217118295137698188065244968500265048394206261417927
+           (order 8) */
+        { 0xc7, 0x17, 0x6a, 0x70, 0x3d, 0x4d, 0xd8, 0x4f, 0xba, 0x3c, 0x0b,
+          0x76, 0x0d, 0x10, 0x67, 0x0f, 0x2a, 0x20, 0x53, 0xfa, 0x2c, 0x39,
+          0xcc, 0xc6, 0x4e, 0xc7, 0xfd, 0x77, 0x92, 0xac, 0x03, 0x7a },
+        /* p-1 (order 2) */
+        { 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f },
+        /* p (=0, order 4) */
+        { 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f },
+        /* p+1 (=1, order 1) */
+        { 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }
+    };
+    unsigned char c[7] = { 0 };
+    unsigned int  k;
+    size_t        i, j;
+
+    COMPILER_ASSERT(7 == sizeof blacklist / sizeof blacklist[0]);
+    for (j = 0; j < 31; j++) {
+        for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
+            c[i] |= s[j] ^ blacklist[i][j];
+        }
+    }
+    for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
+        c[i] |= (s[j] & 0x7f) ^ blacklist[i][j];
+    }
+    k = 0;
+    for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
+        k |= (c[i] - 1);
+    }
+    return (int) ((k >> 8) & 1);
+}
+
+/*
+ Input:
+ a[0]+256*a[1]+...+256^31*a[31] = a
+ b[0]+256*b[1]+...+256^31*b[31] = b
+ *
+ Output:
+ s[0]+256*s[1]+...+256^31*s[31] = (ab) mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+ */
+
+void
+sc25519_mul(unsigned char s[32], const unsigned char a[32], const unsigned char b[32])
+{
+    int64_t a0  = 2097151 & load_3(a);
+    int64_t a1  = 2097151 & (load_4(a + 2) >> 5);
+    int64_t a2  = 2097151 & (load_3(a + 5) >> 2);
+    int64_t a3  = 2097151 & (load_4(a + 7) >> 7);
+    int64_t a4  = 2097151 & (load_4(a + 10) >> 4);
+    int64_t a5  = 2097151 & (load_3(a + 13) >> 1);
+    int64_t a6  = 2097151 & (load_4(a + 15) >> 6);
+    int64_t a7  = 2097151 & (load_3(a + 18) >> 3);
+    int64_t a8  = 2097151 & load_3(a + 21);
+    int64_t a9  = 2097151 & (load_4(a + 23) >> 5);
+    int64_t a10 = 2097151 & (load_3(a + 26) >> 2);
+    int64_t a11 = (load_4(a + 28) >> 7);
+
+    int64_t b0  = 2097151 & load_3(b);
+    int64_t b1  = 2097151 & (load_4(b + 2) >> 5);
+    int64_t b2  = 2097151 & (load_3(b + 5) >> 2);
+    int64_t b3  = 2097151 & (load_4(b + 7) >> 7);
+    int64_t b4  = 2097151 & (load_4(b + 10) >> 4);
+    int64_t b5  = 2097151 & (load_3(b + 13) >> 1);
+    int64_t b6  = 2097151 & (load_4(b + 15) >> 6);
+    int64_t b7  = 2097151 & (load_3(b + 18) >> 3);
+    int64_t b8  = 2097151 & load_3(b + 21);
+    int64_t b9  = 2097151 & (load_4(b + 23) >> 5);
+    int64_t b10 = 2097151 & (load_3(b + 26) >> 2);
+    int64_t b11 = (load_4(b + 28) >> 7);
+
+    int64_t s0;
+    int64_t s1;
+    int64_t s2;
+    int64_t s3;
+    int64_t s4;
+    int64_t s5;
+    int64_t s6;
+    int64_t s7;
+    int64_t s8;
+    int64_t s9;
+    int64_t s10;
+    int64_t s11;
+    int64_t s12;
+    int64_t s13;
+    int64_t s14;
+    int64_t s15;
+    int64_t s16;
+    int64_t s17;
+    int64_t s18;
+    int64_t s19;
+    int64_t s20;
+    int64_t s21;
+    int64_t s22;
+    int64_t s23;
+
+    int64_t carry0;
+    int64_t carry1;
+    int64_t carry2;
+    int64_t carry3;
+    int64_t carry4;
+    int64_t carry5;
+    int64_t carry6;
+    int64_t carry7;
+    int64_t carry8;
+    int64_t carry9;
+    int64_t carry10;
+    int64_t carry11;
+    int64_t carry12;
+    int64_t carry13;
+    int64_t carry14;
+    int64_t carry15;
+    int64_t carry16;
+    int64_t carry17;
+    int64_t carry18;
+    int64_t carry19;
+    int64_t carry20;
+    int64_t carry21;
+    int64_t carry22;
+
+    s0 = a0 * b0;
+    s1 = a0 * b1 + a1 * b0;
+    s2 = a0 * b2 + a1 * b1 + a2 * b0;
+    s3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0;
+    s4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0;
+    s5 = a0 * b5 + a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 + a5 * b0;
+    s6 = a0 * b6 + a1 * b5 + a2 * b4 + a3 * b3 + a4 * b2 + a5 * b1 + a6 * b0;
+    s7 = a0 * b7 + a1 * b6 + a2 * b5 + a3 * b4 + a4 * b3 + a5 * b2 +
+         a6 * b1 + a7 * b0;
+    s8 = a0 * b8 + a1 * b7 + a2 * b6 + a3 * b5 + a4 * b4 + a5 * b3 +
+         a6 * b2 + a7 * b1 + a8 * b0;
+    s9 = a0 * b9 + a1 * b8 + a2 * b7 + a3 * b6 + a4 * b5 + a5 * b4 +
+         a6 * b3 + a7 * b2 + a8 * b1 + a9 * b0;
+    s10 = a0 * b10 + a1 * b9 + a2 * b8 + a3 * b7 + a4 * b6 + a5 * b5 +
+          a6 * b4 + a7 * b3 + a8 * b2 + a9 * b1 + a10 * b0;
+    s11 = a0 * b11 + a1 * b10 + a2 * b9 + a3 * b8 + a4 * b7 + a5 * b6 +
+          a6 * b5 + a7 * b4 + a8 * b3 + a9 * b2 + a10 * b1 + a11 * b0;
+    s12 = a1 * b11 + a2 * b10 + a3 * b9 + a4 * b8 + a5 * b7 + a6 * b6 +
+          a7 * b5 + a8 * b4 + a9 * b3 + a10 * b2 + a11 * b1;
+    s13 = a2 * b11 + a3 * b10 + a4 * b9 + a5 * b8 + a6 * b7 + a7 * b6 +
+          a8 * b5 + a9 * b4 + a10 * b3 + a11 * b2;
+    s14 = a3 * b11 + a4 * b10 + a5 * b9 + a6 * b8 + a7 * b7 + a8 * b6 +
+          a9 * b5 + a10 * b4 + a11 * b3;
+    s15 = a4 * b11 + a5 * b10 + a6 * b9 + a7 * b8 + a8 * b7 + a9 * b6 +
+          a10 * b5 + a11 * b4;
+    s16 =
+        a5 * b11 + a6 * b10 + a7 * b9 + a8 * b8 + a9 * b7 + a10 * b6 + a11 * b5;
+    s17 = a6 * b11 + a7 * b10 + a8 * b9 + a9 * b8 + a10 * b7 + a11 * b6;
+    s18 = a7 * b11 + a8 * b10 + a9 * b9 + a10 * b8 + a11 * b7;
+    s19 = a8 * b11 + a9 * b10 + a10 * b9 + a11 * b8;
+    s20 = a9 * b11 + a10 * b10 + a11 * b9;
+    s21 = a10 * b11 + a11 * b10;
+    s22 = a11 * b11;
+    s23 = 0;
+
+    carry0 = (s0 + (int64_t) (1L << 20)) >> 21;
+    s1 += carry0;
+    s0 -= carry0 * ((uint64_t) 1L << 21);
+    carry2 = (s2 + (int64_t) (1L << 20)) >> 21;
+    s3 += carry2;
+    s2 -= carry2 * ((uint64_t) 1L << 21);
+    carry4 = (s4 + (int64_t) (1L << 20)) >> 21;
+    s5 += carry4;
+    s4 -= carry4 * ((uint64_t) 1L << 21);
+    carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+    carry12 = (s12 + (int64_t) (1L << 20)) >> 21;
+    s13 += carry12;
+    s12 -= carry12 * ((uint64_t) 1L << 21);
+    carry14 = (s14 + (int64_t) (1L << 20)) >> 21;
+    s15 += carry14;
+    s14 -= carry14 * ((uint64_t) 1L << 21);
+    carry16 = (s16 + (int64_t) (1L << 20)) >> 21;
+    s17 += carry16;
+    s16 -= carry16 * ((uint64_t) 1L << 21);
+    carry18 = (s18 + (int64_t) (1L << 20)) >> 21;
+    s19 += carry18;
+    s18 -= carry18 * ((uint64_t) 1L << 21);
+    carry20 = (s20 + (int64_t) (1L << 20)) >> 21;
+    s21 += carry20;
+    s20 -= carry20 * ((uint64_t) 1L << 21);
+    carry22 = (s22 + (int64_t) (1L << 20)) >> 21;
+    s23 += carry22;
+    s22 -= carry22 * ((uint64_t) 1L << 21);
+
+    carry1 = (s1 + (int64_t) (1L << 20)) >> 21;
+    s2 += carry1;
+    s1 -= carry1 * ((uint64_t) 1L << 21);
+    carry3 = (s3 + (int64_t) (1L << 20)) >> 21;
+    s4 += carry3;
+    s3 -= carry3 * ((uint64_t) 1L << 21);
+    carry5 = (s5 + (int64_t) (1L << 20)) >> 21;
+    s6 += carry5;
+    s5 -= carry5 * ((uint64_t) 1L << 21);
+    carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
+    s12 += carry11;
+    s11 -= carry11 * ((uint64_t) 1L << 21);
+    carry13 = (s13 + (int64_t) (1L << 20)) >> 21;
+    s14 += carry13;
+    s13 -= carry13 * ((uint64_t) 1L << 21);
+    carry15 = (s15 + (int64_t) (1L << 20)) >> 21;
+    s16 += carry15;
+    s15 -= carry15 * ((uint64_t) 1L << 21);
+    carry17 = (s17 + (int64_t) (1L << 20)) >> 21;
+    s18 += carry17;
+    s17 -= carry17 * ((uint64_t) 1L << 21);
+    carry19 = (s19 + (int64_t) (1L << 20)) >> 21;
+    s20 += carry19;
+    s19 -= carry19 * ((uint64_t) 1L << 21);
+    carry21 = (s21 + (int64_t) (1L << 20)) >> 21;
+    s22 += carry21;
+    s21 -= carry21 * ((uint64_t) 1L << 21);
+
+    s11 += s23 * 666643;
+    s12 += s23 * 470296;
+    s13 += s23 * 654183;
+    s14 -= s23 * 997805;
+    s15 += s23 * 136657;
+    s16 -= s23 * 683901;
+
+    s10 += s22 * 666643;
+    s11 += s22 * 470296;
+    s12 += s22 * 654183;
+    s13 -= s22 * 997805;
+    s14 += s22 * 136657;
+    s15 -= s22 * 683901;
+
+    s9 += s21 * 666643;
+    s10 += s21 * 470296;
+    s11 += s21 * 654183;
+    s12 -= s21 * 997805;
+    s13 += s21 * 136657;
+    s14 -= s21 * 683901;
+
+    s8 += s20 * 666643;
+    s9 += s20 * 470296;
+    s10 += s20 * 654183;
+    s11 -= s20 * 997805;
+    s12 += s20 * 136657;
+    s13 -= s20 * 683901;
+
+    s7 += s19 * 666643;
+    s8 += s19 * 470296;
+    s9 += s19 * 654183;
+    s10 -= s19 * 997805;
+    s11 += s19 * 136657;
+    s12 -= s19 * 683901;
+
+    s6 += s18 * 666643;
+    s7 += s18 * 470296;
+    s8 += s18 * 654183;
+    s9 -= s18 * 997805;
+    s10 += s18 * 136657;
+    s11 -= s18 * 683901;
+
+    carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+    carry12 = (s12 + (int64_t) (1L << 20)) >> 21;
+    s13 += carry12;
+    s12 -= carry12 * ((uint64_t) 1L << 21);
+    carry14 = (s14 + (int64_t) (1L << 20)) >> 21;
+    s15 += carry14;
+    s14 -= carry14 * ((uint64_t) 1L << 21);
+    carry16 = (s16 + (int64_t) (1L << 20)) >> 21;
+    s17 += carry16;
+    s16 -= carry16 * ((uint64_t) 1L << 21);
+
+    carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
+    s12 += carry11;
+    s11 -= carry11 * ((uint64_t) 1L << 21);
+    carry13 = (s13 + (int64_t) (1L << 20)) >> 21;
+    s14 += carry13;
+    s13 -= carry13 * ((uint64_t) 1L << 21);
+    carry15 = (s15 + (int64_t) (1L << 20)) >> 21;
+    s16 += carry15;
+    s15 -= carry15 * ((uint64_t) 1L << 21);
+
+    s5 += s17 * 666643;
+    s6 += s17 * 470296;
+    s7 += s17 * 654183;
+    s8 -= s17 * 997805;
+    s9 += s17 * 136657;
+    s10 -= s17 * 683901;
+
+    s4 += s16 * 666643;
+    s5 += s16 * 470296;
+    s6 += s16 * 654183;
+    s7 -= s16 * 997805;
+    s8 += s16 * 136657;
+    s9 -= s16 * 683901;
+
+    s3 += s15 * 666643;
+    s4 += s15 * 470296;
+    s5 += s15 * 654183;
+    s6 -= s15 * 997805;
+    s7 += s15 * 136657;
+    s8 -= s15 * 683901;
+
+    s2 += s14 * 666643;
+    s3 += s14 * 470296;
+    s4 += s14 * 654183;
+    s5 -= s14 * 997805;
+    s6 += s14 * 136657;
+    s7 -= s14 * 683901;
+
+    s1 += s13 * 666643;
+    s2 += s13 * 470296;
+    s3 += s13 * 654183;
+    s4 -= s13 * 997805;
+    s5 += s13 * 136657;
+    s6 -= s13 * 683901;
+
+    s0 += s12 * 666643;
+    s1 += s12 * 470296;
+    s2 += s12 * 654183;
+    s3 -= s12 * 997805;
+    s4 += s12 * 136657;
+    s5 -= s12 * 683901;
+    s12 = 0;
+
+    carry0 = (s0 + (int64_t) (1L << 20)) >> 21;
+    s1 += carry0;
+    s0 -= carry0 * ((uint64_t) 1L << 21);
+    carry2 = (s2 + (int64_t) (1L << 20)) >> 21;
+    s3 += carry2;
+    s2 -= carry2 * ((uint64_t) 1L << 21);
+    carry4 = (s4 + (int64_t) (1L << 20)) >> 21;
+    s5 += carry4;
+    s4 -= carry4 * ((uint64_t) 1L << 21);
+    carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+
+    carry1 = (s1 + (int64_t) (1L << 20)) >> 21;
+    s2 += carry1;
+    s1 -= carry1 * ((uint64_t) 1L << 21);
+    carry3 = (s3 + (int64_t) (1L << 20)) >> 21;
+    s4 += carry3;
+    s3 -= carry3 * ((uint64_t) 1L << 21);
+    carry5 = (s5 + (int64_t) (1L << 20)) >> 21;
+    s6 += carry5;
+    s5 -= carry5 * ((uint64_t) 1L << 21);
+    carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
+    s12 += carry11;
+    s11 -= carry11 * ((uint64_t) 1L << 21);
+
+    s0 += s12 * 666643;
+    s1 += s12 * 470296;
+    s2 += s12 * 654183;
+    s3 -= s12 * 997805;
+    s4 += s12 * 136657;
+    s5 -= s12 * 683901;
+    s12 = 0;
+
+    carry0 = s0 >> 21;
+    s1 += carry0;
+    s0 -= carry0 * ((uint64_t) 1L << 21);
+    carry1 = s1 >> 21;
+    s2 += carry1;
+    s1 -= carry1 * ((uint64_t) 1L << 21);
+    carry2 = s2 >> 21;
+    s3 += carry2;
+    s2 -= carry2 * ((uint64_t) 1L << 21);
+    carry3 = s3 >> 21;
+    s4 += carry3;
+    s3 -= carry3 * ((uint64_t) 1L << 21);
+    carry4 = s4 >> 21;
+    s5 += carry4;
+    s4 -= carry4 * ((uint64_t) 1L << 21);
+    carry5 = s5 >> 21;
+    s6 += carry5;
+    s5 -= carry5 * ((uint64_t) 1L << 21);
+    carry6 = s6 >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry7 = s7 >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry8 = s8 >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry9 = s9 >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry10 = s10 >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+    carry11 = s11 >> 21;
+    s12 += carry11;
+    s11 -= carry11 * ((uint64_t) 1L << 21);
+
+    s0 += s12 * 666643;
+    s1 += s12 * 470296;
+    s2 += s12 * 654183;
+    s3 -= s12 * 997805;
+    s4 += s12 * 136657;
+    s5 -= s12 * 683901;
+
+    carry0 = s0 >> 21;
+    s1 += carry0;
+    s0 -= carry0 * ((uint64_t) 1L << 21);
+    carry1 = s1 >> 21;
+    s2 += carry1;
+    s1 -= carry1 * ((uint64_t) 1L << 21);
+    carry2 = s2 >> 21;
+    s3 += carry2;
+    s2 -= carry2 * ((uint64_t) 1L << 21);
+    carry3 = s3 >> 21;
+    s4 += carry3;
+    s3 -= carry3 * ((uint64_t) 1L << 21);
+    carry4 = s4 >> 21;
+    s5 += carry4;
+    s4 -= carry4 * ((uint64_t) 1L << 21);
+    carry5 = s5 >> 21;
+    s6 += carry5;
+    s5 -= carry5 * ((uint64_t) 1L << 21);
+    carry6 = s6 >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry7 = s7 >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry8 = s8 >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry9 = s9 >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry10 = s10 >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+
+    s[0]  = s0 >> 0;
+    s[1]  = s0 >> 8;
+    s[2]  = (s0 >> 16) | (s1 * ((uint64_t) 1 << 5));
+    s[3]  = s1 >> 3;
+    s[4]  = s1 >> 11;
+    s[5]  = (s1 >> 19) | (s2 * ((uint64_t) 1 << 2));
+    s[6]  = s2 >> 6;
+    s[7]  = (s2 >> 14) | (s3 * ((uint64_t) 1 << 7));
+    s[8]  = s3 >> 1;
+    s[9]  = s3 >> 9;
+    s[10] = (s3 >> 17) | (s4 * ((uint64_t) 1 << 4));
+    s[11] = s4 >> 4;
+    s[12] = s4 >> 12;
+    s[13] = (s4 >> 20) | (s5 * ((uint64_t) 1 << 1));
+    s[14] = s5 >> 7;
+    s[15] = (s5 >> 15) | (s6 * ((uint64_t) 1 << 6));
+    s[16] = s6 >> 2;
+    s[17] = s6 >> 10;
+    s[18] = (s6 >> 18) | (s7 * ((uint64_t) 1 << 3));
+    s[19] = s7 >> 5;
+    s[20] = s7 >> 13;
+    s[21] = s8 >> 0;
+    s[22] = s8 >> 8;
+    s[23] = (s8 >> 16) | (s9 * ((uint64_t) 1 << 5));
+    s[24] = s9 >> 3;
+    s[25] = s9 >> 11;
+    s[26] = (s9 >> 19) | (s10 * ((uint64_t) 1 << 2));
+    s[27] = s10 >> 6;
+    s[28] = (s10 >> 14) | (s11 * ((uint64_t) 1 << 7));
+    s[29] = s11 >> 1;
+    s[30] = s11 >> 9;
+    s[31] = s11 >> 17;
+}
+
+/*
+ Input:
+ a[0]+256*a[1]+...+256^31*a[31] = a
+ b[0]+256*b[1]+...+256^31*b[31] = b
+ c[0]+256*c[1]+...+256^31*c[31] = c
+ *
+ Output:
+ s[0]+256*s[1]+...+256^31*s[31] = (ab+c) mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+ */
+
+void
+sc25519_muladd(unsigned char s[32], const unsigned char a[32],
+               const unsigned char b[32], const unsigned char c[32])
+{
+    int64_t a0  = 2097151 & load_3(a);
+    int64_t a1  = 2097151 & (load_4(a + 2) >> 5);
+    int64_t a2  = 2097151 & (load_3(a + 5) >> 2);
+    int64_t a3  = 2097151 & (load_4(a + 7) >> 7);
+    int64_t a4  = 2097151 & (load_4(a + 10) >> 4);
+    int64_t a5  = 2097151 & (load_3(a + 13) >> 1);
+    int64_t a6  = 2097151 & (load_4(a + 15) >> 6);
+    int64_t a7  = 2097151 & (load_3(a + 18) >> 3);
+    int64_t a8  = 2097151 & load_3(a + 21);
+    int64_t a9  = 2097151 & (load_4(a + 23) >> 5);
+    int64_t a10 = 2097151 & (load_3(a + 26) >> 2);
+    int64_t a11 = (load_4(a + 28) >> 7);
+
+    int64_t b0  = 2097151 & load_3(b);
+    int64_t b1  = 2097151 & (load_4(b + 2) >> 5);
+    int64_t b2  = 2097151 & (load_3(b + 5) >> 2);
+    int64_t b3  = 2097151 & (load_4(b + 7) >> 7);
+    int64_t b4  = 2097151 & (load_4(b + 10) >> 4);
+    int64_t b5  = 2097151 & (load_3(b + 13) >> 1);
+    int64_t b6  = 2097151 & (load_4(b + 15) >> 6);
+    int64_t b7  = 2097151 & (load_3(b + 18) >> 3);
+    int64_t b8  = 2097151 & load_3(b + 21);
+    int64_t b9  = 2097151 & (load_4(b + 23) >> 5);
+    int64_t b10 = 2097151 & (load_3(b + 26) >> 2);
+    int64_t b11 = (load_4(b + 28) >> 7);
+
+    int64_t c0  = 2097151 & load_3(c);
+    int64_t c1  = 2097151 & (load_4(c + 2) >> 5);
+    int64_t c2  = 2097151 & (load_3(c + 5) >> 2);
+    int64_t c3  = 2097151 & (load_4(c + 7) >> 7);
+    int64_t c4  = 2097151 & (load_4(c + 10) >> 4);
+    int64_t c5  = 2097151 & (load_3(c + 13) >> 1);
+    int64_t c6  = 2097151 & (load_4(c + 15) >> 6);
+    int64_t c7  = 2097151 & (load_3(c + 18) >> 3);
+    int64_t c8  = 2097151 & load_3(c + 21);
+    int64_t c9  = 2097151 & (load_4(c + 23) >> 5);
+    int64_t c10 = 2097151 & (load_3(c + 26) >> 2);
+    int64_t c11 = (load_4(c + 28) >> 7);
+
+    int64_t s0;
+    int64_t s1;
+    int64_t s2;
+    int64_t s3;
+    int64_t s4;
+    int64_t s5;
+    int64_t s6;
+    int64_t s7;
+    int64_t s8;
+    int64_t s9;
+    int64_t s10;
+    int64_t s11;
+    int64_t s12;
+    int64_t s13;
+    int64_t s14;
+    int64_t s15;
+    int64_t s16;
+    int64_t s17;
+    int64_t s18;
+    int64_t s19;
+    int64_t s20;
+    int64_t s21;
+    int64_t s22;
+    int64_t s23;
+
+    int64_t carry0;
+    int64_t carry1;
+    int64_t carry2;
+    int64_t carry3;
+    int64_t carry4;
+    int64_t carry5;
+    int64_t carry6;
+    int64_t carry7;
+    int64_t carry8;
+    int64_t carry9;
+    int64_t carry10;
+    int64_t carry11;
+    int64_t carry12;
+    int64_t carry13;
+    int64_t carry14;
+    int64_t carry15;
+    int64_t carry16;
+    int64_t carry17;
+    int64_t carry18;
+    int64_t carry19;
+    int64_t carry20;
+    int64_t carry21;
+    int64_t carry22;
+
+    s0 = c0 + a0 * b0;
+    s1 = c1 + a0 * b1 + a1 * b0;
+    s2 = c2 + a0 * b2 + a1 * b1 + a2 * b0;
+    s3 = c3 + a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0;
+    s4 = c4 + a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0;
+    s5 = c5 + a0 * b5 + a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 + a5 * b0;
+    s6 = c6 + a0 * b6 + a1 * b5 + a2 * b4 + a3 * b3 + a4 * b2 + a5 * b1 +
+         a6 * b0;
+    s7 = c7 + a0 * b7 + a1 * b6 + a2 * b5 + a3 * b4 + a4 * b3 + a5 * b2 +
+         a6 * b1 + a7 * b0;
+    s8 = c8 + a0 * b8 + a1 * b7 + a2 * b6 + a3 * b5 + a4 * b4 + a5 * b3 +
+         a6 * b2 + a7 * b1 + a8 * b0;
+    s9 = c9 + a0 * b9 + a1 * b8 + a2 * b7 + a3 * b6 + a4 * b5 + a5 * b4 +
+         a6 * b3 + a7 * b2 + a8 * b1 + a9 * b0;
+    s10 = c10 + a0 * b10 + a1 * b9 + a2 * b8 + a3 * b7 + a4 * b6 + a5 * b5 +
+          a6 * b4 + a7 * b3 + a8 * b2 + a9 * b1 + a10 * b0;
+    s11 = c11 + a0 * b11 + a1 * b10 + a2 * b9 + a3 * b8 + a4 * b7 + a5 * b6 +
+          a6 * b5 + a7 * b4 + a8 * b3 + a9 * b2 + a10 * b1 + a11 * b0;
+    s12 = a1 * b11 + a2 * b10 + a3 * b9 + a4 * b8 + a5 * b7 + a6 * b6 +
+          a7 * b5 + a8 * b4 + a9 * b3 + a10 * b2 + a11 * b1;
+    s13 = a2 * b11 + a3 * b10 + a4 * b9 + a5 * b8 + a6 * b7 + a7 * b6 +
+          a8 * b5 + a9 * b4 + a10 * b3 + a11 * b2;
+    s14 = a3 * b11 + a4 * b10 + a5 * b9 + a6 * b8 + a7 * b7 + a8 * b6 +
+          a9 * b5 + a10 * b4 + a11 * b3;
+    s15 = a4 * b11 + a5 * b10 + a6 * b9 + a7 * b8 + a8 * b7 + a9 * b6 +
+          a10 * b5 + a11 * b4;
+    s16 =
+        a5 * b11 + a6 * b10 + a7 * b9 + a8 * b8 + a9 * b7 + a10 * b6 + a11 * b5;
+    s17 = a6 * b11 + a7 * b10 + a8 * b9 + a9 * b8 + a10 * b7 + a11 * b6;
+    s18 = a7 * b11 + a8 * b10 + a9 * b9 + a10 * b8 + a11 * b7;
+    s19 = a8 * b11 + a9 * b10 + a10 * b9 + a11 * b8;
+    s20 = a9 * b11 + a10 * b10 + a11 * b9;
+    s21 = a10 * b11 + a11 * b10;
+    s22 = a11 * b11;
+    s23 = 0;
+
+    carry0 = (s0 + (int64_t) (1L << 20)) >> 21;
+    s1 += carry0;
+    s0 -= carry0 * ((uint64_t) 1L << 21);
+    carry2 = (s2 + (int64_t) (1L << 20)) >> 21;
+    s3 += carry2;
+    s2 -= carry2 * ((uint64_t) 1L << 21);
+    carry4 = (s4 + (int64_t) (1L << 20)) >> 21;
+    s5 += carry4;
+    s4 -= carry4 * ((uint64_t) 1L << 21);
+    carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+    carry12 = (s12 + (int64_t) (1L << 20)) >> 21;
+    s13 += carry12;
+    s12 -= carry12 * ((uint64_t) 1L << 21);
+    carry14 = (s14 + (int64_t) (1L << 20)) >> 21;
+    s15 += carry14;
+    s14 -= carry14 * ((uint64_t) 1L << 21);
+    carry16 = (s16 + (int64_t) (1L << 20)) >> 21;
+    s17 += carry16;
+    s16 -= carry16 * ((uint64_t) 1L << 21);
+    carry18 = (s18 + (int64_t) (1L << 20)) >> 21;
+    s19 += carry18;
+    s18 -= carry18 * ((uint64_t) 1L << 21);
+    carry20 = (s20 + (int64_t) (1L << 20)) >> 21;
+    s21 += carry20;
+    s20 -= carry20 * ((uint64_t) 1L << 21);
+    carry22 = (s22 + (int64_t) (1L << 20)) >> 21;
+    s23 += carry22;
+    s22 -= carry22 * ((uint64_t) 1L << 21);
+
+    carry1 = (s1 + (int64_t) (1L << 20)) >> 21;
+    s2 += carry1;
+    s1 -= carry1 * ((uint64_t) 1L << 21);
+    carry3 = (s3 + (int64_t) (1L << 20)) >> 21;
+    s4 += carry3;
+    s3 -= carry3 * ((uint64_t) 1L << 21);
+    carry5 = (s5 + (int64_t) (1L << 20)) >> 21;
+    s6 += carry5;
+    s5 -= carry5 * ((uint64_t) 1L << 21);
+    carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
+    s12 += carry11;
+    s11 -= carry11 * ((uint64_t) 1L << 21);
+    carry13 = (s13 + (int64_t) (1L << 20)) >> 21;
+    s14 += carry13;
+    s13 -= carry13 * ((uint64_t) 1L << 21);
+    carry15 = (s15 + (int64_t) (1L << 20)) >> 21;
+    s16 += carry15;
+    s15 -= carry15 * ((uint64_t) 1L << 21);
+    carry17 = (s17 + (int64_t) (1L << 20)) >> 21;
+    s18 += carry17;
+    s17 -= carry17 * ((uint64_t) 1L << 21);
+    carry19 = (s19 + (int64_t) (1L << 20)) >> 21;
+    s20 += carry19;
+    s19 -= carry19 * ((uint64_t) 1L << 21);
+    carry21 = (s21 + (int64_t) (1L << 20)) >> 21;
+    s22 += carry21;
+    s21 -= carry21 * ((uint64_t) 1L << 21);
+
+    s11 += s23 * 666643;
+    s12 += s23 * 470296;
+    s13 += s23 * 654183;
+    s14 -= s23 * 997805;
+    s15 += s23 * 136657;
+    s16 -= s23 * 683901;
+
+    s10 += s22 * 666643;
+    s11 += s22 * 470296;
+    s12 += s22 * 654183;
+    s13 -= s22 * 997805;
+    s14 += s22 * 136657;
+    s15 -= s22 * 683901;
+
+    s9 += s21 * 666643;
+    s10 += s21 * 470296;
+    s11 += s21 * 654183;
+    s12 -= s21 * 997805;
+    s13 += s21 * 136657;
+    s14 -= s21 * 683901;
+
+    s8 += s20 * 666643;
+    s9 += s20 * 470296;
+    s10 += s20 * 654183;
+    s11 -= s20 * 997805;
+    s12 += s20 * 136657;
+    s13 -= s20 * 683901;
+
+    s7 += s19 * 666643;
+    s8 += s19 * 470296;
+    s9 += s19 * 654183;
+    s10 -= s19 * 997805;
+    s11 += s19 * 136657;
+    s12 -= s19 * 683901;
+
+    s6 += s18 * 666643;
+    s7 += s18 * 470296;
+    s8 += s18 * 654183;
+    s9 -= s18 * 997805;
+    s10 += s18 * 136657;
+    s11 -= s18 * 683901;
+
+    carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+    carry12 = (s12 + (int64_t) (1L << 20)) >> 21;
+    s13 += carry12;
+    s12 -= carry12 * ((uint64_t) 1L << 21);
+    carry14 = (s14 + (int64_t) (1L << 20)) >> 21;
+    s15 += carry14;
+    s14 -= carry14 * ((uint64_t) 1L << 21);
+    carry16 = (s16 + (int64_t) (1L << 20)) >> 21;
+    s17 += carry16;
+    s16 -= carry16 * ((uint64_t) 1L << 21);
+
+    carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
+    s12 += carry11;
+    s11 -= carry11 * ((uint64_t) 1L << 21);
+    carry13 = (s13 + (int64_t) (1L << 20)) >> 21;
+    s14 += carry13;
+    s13 -= carry13 * ((uint64_t) 1L << 21);
+    carry15 = (s15 + (int64_t) (1L << 20)) >> 21;
+    s16 += carry15;
+    s15 -= carry15 * ((uint64_t) 1L << 21);
+
+    s5 += s17 * 666643;
+    s6 += s17 * 470296;
+    s7 += s17 * 654183;
+    s8 -= s17 * 997805;
+    s9 += s17 * 136657;
+    s10 -= s17 * 683901;
+
+    s4 += s16 * 666643;
+    s5 += s16 * 470296;
+    s6 += s16 * 654183;
+    s7 -= s16 * 997805;
+    s8 += s16 * 136657;
+    s9 -= s16 * 683901;
+
+    s3 += s15 * 666643;
+    s4 += s15 * 470296;
+    s5 += s15 * 654183;
+    s6 -= s15 * 997805;
+    s7 += s15 * 136657;
+    s8 -= s15 * 683901;
+
+    s2 += s14 * 666643;
+    s3 += s14 * 470296;
+    s4 += s14 * 654183;
+    s5 -= s14 * 997805;
+    s6 += s14 * 136657;
+    s7 -= s14 * 683901;
+
+    s1 += s13 * 666643;
+    s2 += s13 * 470296;
+    s3 += s13 * 654183;
+    s4 -= s13 * 997805;
+    s5 += s13 * 136657;
+    s6 -= s13 * 683901;
+
+    s0 += s12 * 666643;
+    s1 += s12 * 470296;
+    s2 += s12 * 654183;
+    s3 -= s12 * 997805;
+    s4 += s12 * 136657;
+    s5 -= s12 * 683901;
+    s12 = 0;
+
+    carry0 = (s0 + (int64_t) (1L << 20)) >> 21;
+    s1 += carry0;
+    s0 -= carry0 * ((uint64_t) 1L << 21);
+    carry2 = (s2 + (int64_t) (1L << 20)) >> 21;
+    s3 += carry2;
+    s2 -= carry2 * ((uint64_t) 1L << 21);
+    carry4 = (s4 + (int64_t) (1L << 20)) >> 21;
+    s5 += carry4;
+    s4 -= carry4 * ((uint64_t) 1L << 21);
+    carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+
+    carry1 = (s1 + (int64_t) (1L << 20)) >> 21;
+    s2 += carry1;
+    s1 -= carry1 * ((uint64_t) 1L << 21);
+    carry3 = (s3 + (int64_t) (1L << 20)) >> 21;
+    s4 += carry3;
+    s3 -= carry3 * ((uint64_t) 1L << 21);
+    carry5 = (s5 + (int64_t) (1L << 20)) >> 21;
+    s6 += carry5;
+    s5 -= carry5 * ((uint64_t) 1L << 21);
+    carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
+    s12 += carry11;
+    s11 -= carry11 * ((uint64_t) 1L << 21);
+
+    s0 += s12 * 666643;
+    s1 += s12 * 470296;
+    s2 += s12 * 654183;
+    s3 -= s12 * 997805;
+    s4 += s12 * 136657;
+    s5 -= s12 * 683901;
+    s12 = 0;
+
+    carry0 = s0 >> 21;
+    s1 += carry0;
+    s0 -= carry0 * ((uint64_t) 1L << 21);
+    carry1 = s1 >> 21;
+    s2 += carry1;
+    s1 -= carry1 * ((uint64_t) 1L << 21);
+    carry2 = s2 >> 21;
+    s3 += carry2;
+    s2 -= carry2 * ((uint64_t) 1L << 21);
+    carry3 = s3 >> 21;
+    s4 += carry3;
+    s3 -= carry3 * ((uint64_t) 1L << 21);
+    carry4 = s4 >> 21;
+    s5 += carry4;
+    s4 -= carry4 * ((uint64_t) 1L << 21);
+    carry5 = s5 >> 21;
+    s6 += carry5;
+    s5 -= carry5 * ((uint64_t) 1L << 21);
+    carry6 = s6 >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry7 = s7 >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry8 = s8 >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry9 = s9 >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry10 = s10 >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+    carry11 = s11 >> 21;
+    s12 += carry11;
+    s11 -= carry11 * ((uint64_t) 1L << 21);
+
+    s0 += s12 * 666643;
+    s1 += s12 * 470296;
+    s2 += s12 * 654183;
+    s3 -= s12 * 997805;
+    s4 += s12 * 136657;
+    s5 -= s12 * 683901;
+
+    carry0 = s0 >> 21;
+    s1 += carry0;
+    s0 -= carry0 * ((uint64_t) 1L << 21);
+    carry1 = s1 >> 21;
+    s2 += carry1;
+    s1 -= carry1 * ((uint64_t) 1L << 21);
+    carry2 = s2 >> 21;
+    s3 += carry2;
+    s2 -= carry2 * ((uint64_t) 1L << 21);
+    carry3 = s3 >> 21;
+    s4 += carry3;
+    s3 -= carry3 * ((uint64_t) 1L << 21);
+    carry4 = s4 >> 21;
+    s5 += carry4;
+    s4 -= carry4 * ((uint64_t) 1L << 21);
+    carry5 = s5 >> 21;
+    s6 += carry5;
+    s5 -= carry5 * ((uint64_t) 1L << 21);
+    carry6 = s6 >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry7 = s7 >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry8 = s8 >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry9 = s9 >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry10 = s10 >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+
+    s[0]  = s0 >> 0;
+    s[1]  = s0 >> 8;
+    s[2]  = (s0 >> 16) | (s1 * ((uint64_t) 1 << 5));
+    s[3]  = s1 >> 3;
+    s[4]  = s1 >> 11;
+    s[5]  = (s1 >> 19) | (s2 * ((uint64_t) 1 << 2));
+    s[6]  = s2 >> 6;
+    s[7]  = (s2 >> 14) | (s3 * ((uint64_t) 1 << 7));
+    s[8]  = s3 >> 1;
+    s[9]  = s3 >> 9;
+    s[10] = (s3 >> 17) | (s4 * ((uint64_t) 1 << 4));
+    s[11] = s4 >> 4;
+    s[12] = s4 >> 12;
+    s[13] = (s4 >> 20) | (s5 * ((uint64_t) 1 << 1));
+    s[14] = s5 >> 7;
+    s[15] = (s5 >> 15) | (s6 * ((uint64_t) 1 << 6));
+    s[16] = s6 >> 2;
+    s[17] = s6 >> 10;
+    s[18] = (s6 >> 18) | (s7 * ((uint64_t) 1 << 3));
+    s[19] = s7 >> 5;
+    s[20] = s7 >> 13;
+    s[21] = s8 >> 0;
+    s[22] = s8 >> 8;
+    s[23] = (s8 >> 16) | (s9 * ((uint64_t) 1 << 5));
+    s[24] = s9 >> 3;
+    s[25] = s9 >> 11;
+    s[26] = (s9 >> 19) | (s10 * ((uint64_t) 1 << 2));
+    s[27] = s10 >> 6;
+    s[28] = (s10 >> 14) | (s11 * ((uint64_t) 1 << 7));
+    s[29] = s11 >> 1;
+    s[30] = s11 >> 9;
+    s[31] = s11 >> 17;
+}
+
+/*
+ Input:
+ a[0]+256*a[1]+...+256^31*a[31] = a
+ *
+ Output:
+ s[0]+256*s[1]+...+256^31*s[31] = a^2 mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+ */
+
+static inline void
+sc25519_sq(unsigned char *s, const unsigned char *a)
+{
+    sc25519_mul(s, a, a);
+}
+
+/*
+ Input:
+ s[0]+256*a[1]+...+256^31*a[31] = a
+ n
+ *
+ Output:
+ s[0]+256*s[1]+...+256^31*s[31] = x * s^(s^n) mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+ Overwrites s in place.
+ */
+
+static inline void
+sc25519_sqmul(unsigned char s[32], const int n, const unsigned char a[32])
+{
+    int i;
+
+    for (i = 0; i < n; i++) {
+        sc25519_sq(s, s);
+    }
+    sc25519_mul(s, s, a);
+}
+
+void
+sc25519_invert(unsigned char recip[32], const unsigned char s[32])
+{
+    unsigned char _10[32], _100[32], _1000[32], _10000[32], _100000[32],
+        _1000000[32], _10010011[32], _10010111[32], _100110[32], _1010[32],
+        _1010000[32], _1010011[32], _1011[32], _10110[32], _10111101[32],
+        _11[32], _1100011[32], _1100111[32], _11010011[32], _1101011[32],
+        _11100111[32], _11101011[32], _11110101[32];
+
+    sc25519_sq(_10, s);
+    sc25519_mul(_11, s, _10);
+    sc25519_mul(_100, s, _11);
+    sc25519_sq(_1000, _100);
+    sc25519_mul(_1010, _10, _1000);
+    sc25519_mul(_1011, s, _1010);
+    sc25519_sq(_10000, _1000);
+    sc25519_sq(_10110, _1011);
+    sc25519_mul(_100000, _1010, _10110);
+    sc25519_mul(_100110, _10000, _10110);
+    sc25519_sq(_1000000, _100000);
+    sc25519_mul(_1010000, _10000, _1000000);
+    sc25519_mul(_1010011, _11, _1010000);
+    sc25519_mul(_1100011, _10000, _1010011);
+    sc25519_mul(_1100111, _100, _1100011);
+    sc25519_mul(_1101011, _100, _1100111);
+    sc25519_mul(_10010011, _1000000, _1010011);
+    sc25519_mul(_10010111, _100, _10010011);
+    sc25519_mul(_10111101, _100110, _10010111);
+    sc25519_mul(_11010011, _10110, _10111101);
+    sc25519_mul(_11100111, _1010000, _10010111);
+    sc25519_mul(_11101011, _100, _11100111);
+    sc25519_mul(_11110101, _1010, _11101011);
+
+    sc25519_mul(recip, _1011, _11110101);
+    sc25519_sqmul(recip, 126, _1010011);
+    sc25519_sqmul(recip, 9, _10);
+    sc25519_mul(recip, recip, _11110101);
+    sc25519_sqmul(recip, 7, _1100111);
+    sc25519_sqmul(recip, 9, _11110101);
+    sc25519_sqmul(recip, 11, _10111101);
+    sc25519_sqmul(recip, 8, _11100111);
+    sc25519_sqmul(recip, 9, _1101011);
+    sc25519_sqmul(recip, 6, _1011);
+    sc25519_sqmul(recip, 14, _10010011);
+    sc25519_sqmul(recip, 10, _1100011);
+    sc25519_sqmul(recip, 9, _10010111);
+    sc25519_sqmul(recip, 10, _11110101);
+    sc25519_sqmul(recip, 8, _11010011);
+    sc25519_sqmul(recip, 8, _11101011);
+}
+
+/*
+ Input:
+ s[0]+256*s[1]+...+256^63*s[63] = s
+ *
+ Output:
+ s[0]+256*s[1]+...+256^31*s[31] = s mod l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+ Overwrites s in place.
+ */
+
+void
+sc25519_reduce(unsigned char s[64])
+{
+    int64_t s0  = 2097151 & load_3(s);
+    int64_t s1  = 2097151 & (load_4(s + 2) >> 5);
+    int64_t s2  = 2097151 & (load_3(s + 5) >> 2);
+    int64_t s3  = 2097151 & (load_4(s + 7) >> 7);
+    int64_t s4  = 2097151 & (load_4(s + 10) >> 4);
+    int64_t s5  = 2097151 & (load_3(s + 13) >> 1);
+    int64_t s6  = 2097151 & (load_4(s + 15) >> 6);
+    int64_t s7  = 2097151 & (load_3(s + 18) >> 3);
+    int64_t s8  = 2097151 & load_3(s + 21);
+    int64_t s9  = 2097151 & (load_4(s + 23) >> 5);
+    int64_t s10 = 2097151 & (load_3(s + 26) >> 2);
+    int64_t s11 = 2097151 & (load_4(s + 28) >> 7);
+    int64_t s12 = 2097151 & (load_4(s + 31) >> 4);
+    int64_t s13 = 2097151 & (load_3(s + 34) >> 1);
+    int64_t s14 = 2097151 & (load_4(s + 36) >> 6);
+    int64_t s15 = 2097151 & (load_3(s + 39) >> 3);
+    int64_t s16 = 2097151 & load_3(s + 42);
+    int64_t s17 = 2097151 & (load_4(s + 44) >> 5);
+    int64_t s18 = 2097151 & (load_3(s + 47) >> 2);
+    int64_t s19 = 2097151 & (load_4(s + 49) >> 7);
+    int64_t s20 = 2097151 & (load_4(s + 52) >> 4);
+    int64_t s21 = 2097151 & (load_3(s + 55) >> 1);
+    int64_t s22 = 2097151 & (load_4(s + 57) >> 6);
+    int64_t s23 = (load_4(s + 60) >> 3);
+
+    int64_t carry0;
+    int64_t carry1;
+    int64_t carry2;
+    int64_t carry3;
+    int64_t carry4;
+    int64_t carry5;
+    int64_t carry6;
+    int64_t carry7;
+    int64_t carry8;
+    int64_t carry9;
+    int64_t carry10;
+    int64_t carry11;
+    int64_t carry12;
+    int64_t carry13;
+    int64_t carry14;
+    int64_t carry15;
+    int64_t carry16;
+
+    s11 += s23 * 666643;
+    s12 += s23 * 470296;
+    s13 += s23 * 654183;
+    s14 -= s23 * 997805;
+    s15 += s23 * 136657;
+    s16 -= s23 * 683901;
+
+    s10 += s22 * 666643;
+    s11 += s22 * 470296;
+    s12 += s22 * 654183;
+    s13 -= s22 * 997805;
+    s14 += s22 * 136657;
+    s15 -= s22 * 683901;
+
+    s9 += s21 * 666643;
+    s10 += s21 * 470296;
+    s11 += s21 * 654183;
+    s12 -= s21 * 997805;
+    s13 += s21 * 136657;
+    s14 -= s21 * 683901;
+
+    s8 += s20 * 666643;
+    s9 += s20 * 470296;
+    s10 += s20 * 654183;
+    s11 -= s20 * 997805;
+    s12 += s20 * 136657;
+    s13 -= s20 * 683901;
+
+    s7 += s19 * 666643;
+    s8 += s19 * 470296;
+    s9 += s19 * 654183;
+    s10 -= s19 * 997805;
+    s11 += s19 * 136657;
+    s12 -= s19 * 683901;
+
+    s6 += s18 * 666643;
+    s7 += s18 * 470296;
+    s8 += s18 * 654183;
+    s9 -= s18 * 997805;
+    s10 += s18 * 136657;
+    s11 -= s18 * 683901;
+
+    carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+    carry12 = (s12 + (int64_t) (1L << 20)) >> 21;
+    s13 += carry12;
+    s12 -= carry12 * ((uint64_t) 1L << 21);
+    carry14 = (s14 + (int64_t) (1L << 20)) >> 21;
+    s15 += carry14;
+    s14 -= carry14 * ((uint64_t) 1L << 21);
+    carry16 = (s16 + (int64_t) (1L << 20)) >> 21;
+    s17 += carry16;
+    s16 -= carry16 * ((uint64_t) 1L << 21);
+
+    carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
+    s12 += carry11;
+    s11 -= carry11 * ((uint64_t) 1L << 21);
+    carry13 = (s13 + (int64_t) (1L << 20)) >> 21;
+    s14 += carry13;
+    s13 -= carry13 * ((uint64_t) 1L << 21);
+    carry15 = (s15 + (int64_t) (1L << 20)) >> 21;
+    s16 += carry15;
+    s15 -= carry15 * ((uint64_t) 1L << 21);
+
+    s5 += s17 * 666643;
+    s6 += s17 * 470296;
+    s7 += s17 * 654183;
+    s8 -= s17 * 997805;
+    s9 += s17 * 136657;
+    s10 -= s17 * 683901;
+
+    s4 += s16 * 666643;
+    s5 += s16 * 470296;
+    s6 += s16 * 654183;
+    s7 -= s16 * 997805;
+    s8 += s16 * 136657;
+    s9 -= s16 * 683901;
+
+    s3 += s15 * 666643;
+    s4 += s15 * 470296;
+    s5 += s15 * 654183;
+    s6 -= s15 * 997805;
+    s7 += s15 * 136657;
+    s8 -= s15 * 683901;
+
+    s2 += s14 * 666643;
+    s3 += s14 * 470296;
+    s4 += s14 * 654183;
+    s5 -= s14 * 997805;
+    s6 += s14 * 136657;
+    s7 -= s14 * 683901;
+
+    s1 += s13 * 666643;
+    s2 += s13 * 470296;
+    s3 += s13 * 654183;
+    s4 -= s13 * 997805;
+    s5 += s13 * 136657;
+    s6 -= s13 * 683901;
+
+    s0 += s12 * 666643;
+    s1 += s12 * 470296;
+    s2 += s12 * 654183;
+    s3 -= s12 * 997805;
+    s4 += s12 * 136657;
+    s5 -= s12 * 683901;
+    s12 = 0;
+
+    carry0 = (s0 + (int64_t) (1L << 20)) >> 21;
+    s1 += carry0;
+    s0 -= carry0 * ((uint64_t) 1L << 21);
+    carry2 = (s2 + (int64_t) (1L << 20)) >> 21;
+    s3 += carry2;
+    s2 -= carry2 * ((uint64_t) 1L << 21);
+    carry4 = (s4 + (int64_t) (1L << 20)) >> 21;
+    s5 += carry4;
+    s4 -= carry4 * ((uint64_t) 1L << 21);
+    carry6 = (s6 + (int64_t) (1L << 20)) >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry8 = (s8 + (int64_t) (1L << 20)) >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry10 = (s10 + (int64_t) (1L << 20)) >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+
+    carry1 = (s1 + (int64_t) (1L << 20)) >> 21;
+    s2 += carry1;
+    s1 -= carry1 * ((uint64_t) 1L << 21);
+    carry3 = (s3 + (int64_t) (1L << 20)) >> 21;
+    s4 += carry3;
+    s3 -= carry3 * ((uint64_t) 1L << 21);
+    carry5 = (s5 + (int64_t) (1L << 20)) >> 21;
+    s6 += carry5;
+    s5 -= carry5 * ((uint64_t) 1L << 21);
+    carry7 = (s7 + (int64_t) (1L << 20)) >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry9 = (s9 + (int64_t) (1L << 20)) >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry11 = (s11 + (int64_t) (1L << 20)) >> 21;
+    s12 += carry11;
+    s11 -= carry11 * ((uint64_t) 1L << 21);
+
+    s0 += s12 * 666643;
+    s1 += s12 * 470296;
+    s2 += s12 * 654183;
+    s3 -= s12 * 997805;
+    s4 += s12 * 136657;
+    s5 -= s12 * 683901;
+    s12 = 0;
+
+    carry0 = s0 >> 21;
+    s1 += carry0;
+    s0 -= carry0 * ((uint64_t) 1L << 21);
+    carry1 = s1 >> 21;
+    s2 += carry1;
+    s1 -= carry1 * ((uint64_t) 1L << 21);
+    carry2 = s2 >> 21;
+    s3 += carry2;
+    s2 -= carry2 * ((uint64_t) 1L << 21);
+    carry3 = s3 >> 21;
+    s4 += carry3;
+    s3 -= carry3 * ((uint64_t) 1L << 21);
+    carry4 = s4 >> 21;
+    s5 += carry4;
+    s4 -= carry4 * ((uint64_t) 1L << 21);
+    carry5 = s5 >> 21;
+    s6 += carry5;
+    s5 -= carry5 * ((uint64_t) 1L << 21);
+    carry6 = s6 >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry7 = s7 >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry8 = s8 >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry9 = s9 >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry10 = s10 >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+    carry11 = s11 >> 21;
+    s12 += carry11;
+    s11 -= carry11 * ((uint64_t) 1L << 21);
+
+    s0 += s12 * 666643;
+    s1 += s12 * 470296;
+    s2 += s12 * 654183;
+    s3 -= s12 * 997805;
+    s4 += s12 * 136657;
+    s5 -= s12 * 683901;
+
+    carry0 = s0 >> 21;
+    s1 += carry0;
+    s0 -= carry0 * ((uint64_t) 1L << 21);
+    carry1 = s1 >> 21;
+    s2 += carry1;
+    s1 -= carry1 * ((uint64_t) 1L << 21);
+    carry2 = s2 >> 21;
+    s3 += carry2;
+    s2 -= carry2 * ((uint64_t) 1L << 21);
+    carry3 = s3 >> 21;
+    s4 += carry3;
+    s3 -= carry3 * ((uint64_t) 1L << 21);
+    carry4 = s4 >> 21;
+    s5 += carry4;
+    s4 -= carry4 * ((uint64_t) 1L << 21);
+    carry5 = s5 >> 21;
+    s6 += carry5;
+    s5 -= carry5 * ((uint64_t) 1L << 21);
+    carry6 = s6 >> 21;
+    s7 += carry6;
+    s6 -= carry6 * ((uint64_t) 1L << 21);
+    carry7 = s7 >> 21;
+    s8 += carry7;
+    s7 -= carry7 * ((uint64_t) 1L << 21);
+    carry8 = s8 >> 21;
+    s9 += carry8;
+    s8 -= carry8 * ((uint64_t) 1L << 21);
+    carry9 = s9 >> 21;
+    s10 += carry9;
+    s9 -= carry9 * ((uint64_t) 1L << 21);
+    carry10 = s10 >> 21;
+    s11 += carry10;
+    s10 -= carry10 * ((uint64_t) 1L << 21);
+
+    s[0]  = s0 >> 0;
+    s[1]  = s0 >> 8;
+    s[2]  = (s0 >> 16) | (s1 * ((uint64_t) 1 << 5));
+    s[3]  = s1 >> 3;
+    s[4]  = s1 >> 11;
+    s[5]  = (s1 >> 19) | (s2 * ((uint64_t) 1 << 2));
+    s[6]  = s2 >> 6;
+    s[7]  = (s2 >> 14) | (s3 * ((uint64_t) 1 << 7));
+    s[8]  = s3 >> 1;
+    s[9]  = s3 >> 9;
+    s[10] = (s3 >> 17) | (s4 * ((uint64_t) 1 << 4));
+    s[11] = s4 >> 4;
+    s[12] = s4 >> 12;
+    s[13] = (s4 >> 20) | (s5 * ((uint64_t) 1 << 1));
+    s[14] = s5 >> 7;
+    s[15] = (s5 >> 15) | (s6 * ((uint64_t) 1 << 6));
+    s[16] = s6 >> 2;
+    s[17] = s6 >> 10;
+    s[18] = (s6 >> 18) | (s7 * ((uint64_t) 1 << 3));
+    s[19] = s7 >> 5;
+    s[20] = s7 >> 13;
+    s[21] = s8 >> 0;
+    s[22] = s8 >> 8;
+    s[23] = (s8 >> 16) | (s9 * ((uint64_t) 1 << 5));
+    s[24] = s9 >> 3;
+    s[25] = s9 >> 11;
+    s[26] = (s9 >> 19) | (s10 * ((uint64_t) 1 << 2));
+    s[27] = s10 >> 6;
+    s[28] = (s10 >> 14) | (s11 * ((uint64_t) 1 << 7));
+    s[29] = s11 >> 1;
+    s[30] = s11 >> 9;
+    s[31] = s11 >> 17;
+}
+
+int
+sc25519_is_canonical(const unsigned char s[32])
+{
+    /* 2^252+27742317777372353535851937790883648493 */
+    static const unsigned char L[32] = {
+        0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7,
+        0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10
+    };
+    unsigned char c = 0;
+    unsigned char n = 1;
+    unsigned int  i = 32;
+
+    do {
+        i--;
+        c |= ((s[i] - L[i]) >> 8) & n;
+        n &= ((s[i] ^ L[i]) - 1) >> 8;
+    } while (i != 0);
+
+    return (c != 0);
+}
+
+/* multiply by the cofactor */
+static void
+ge25519_clear_cofactor(ge25519_p3 *p3)
+{
+    ge25519_p1p1 p1;
+    ge25519_p2   p2;
+
+    ge25519_p3_dbl(&p1, p3);
+    ge25519_p1p1_to_p2(&p2, &p1);
+    ge25519_p2_dbl(&p1, &p2);
+    ge25519_p1p1_to_p2(&p2, &p1);
+    ge25519_p2_dbl(&p1, &p2);
+    ge25519_p1p1_to_p3(p3, &p1);
+}
+
+static void
+ge25519_elligator2(unsigned char s[32], const fe25519 r, const unsigned char x_sign)
+{
+    fe25519      gx;
+    fe25519      negx;
+    fe25519      rr2;
+    fe25519      x, x2, x3;
+    ge25519_p3   p3;
+    unsigned int notsquare;
+
+    fe25519_sq2(rr2, r);
+    rr2[0]++;
+    fe25519_invert(rr2, rr2);
+    fe25519_mul32(x, rr2, curve25519_A[0]);
+    fe25519_neg(x, x);
+
+    fe25519_sq(x2, x);
+    fe25519_mul(x3, x, x2);
+    fe25519_add(gx, x3, x);
+    fe25519_mul32(x2, x2, curve25519_A[0]);
+    fe25519_add(gx, x2, gx);
+
+    notsquare = fe25519_notsquare(gx);
+    fe25519_neg(negx, x);
+    fe25519_cmov(x, negx, notsquare);
+    fe25519_0(x2);
+    fe25519_cmov(x2, curve25519_A, notsquare);
+    fe25519_sub(x, x, x2);
+
+    /* yed = (x-1)/(x+1) */
+    {
+        fe25519 one;
+        fe25519 x_plus_one;
+        fe25519 x_plus_one_inv;
+        fe25519 x_minus_one;
+        fe25519 yed;
+
+        fe25519_1(one);
+        fe25519_add(x_plus_one, x, one);
+        fe25519_sub(x_minus_one, x, one);
+        fe25519_invert(x_plus_one_inv, x_plus_one);
+        fe25519_mul(yed, x_minus_one, x_plus_one_inv);
+        fe25519_tobytes(s, yed);
+    }
+
+    /* recover x */
+    s[31] |= x_sign;
+    if (ge25519_frombytes(&p3, s) != 0) {
+        abort(); /* LCOV_EXCL_LINE */
+    }
+
+    ge25519_clear_cofactor(&p3);
+    ge25519_p3_tobytes(s, &p3);
+}
+
+void
+ge25519_from_uniform(unsigned char s[32], const unsigned char r[32])
+{
+    fe25519       r_fe;
+    unsigned char x_sign;
+
+    memcpy(s, r, 32);
+    x_sign = s[31] & 0x80;
+    s[31] &= 0x7f;
+    fe25519_frombytes(r_fe, s);
+    ge25519_elligator2(s, r_fe, x_sign);
+}
+
+void
+ge25519_from_hash(unsigned char s[32], const unsigned char h[64])
+{
+    unsigned char fl[32];
+    unsigned char gl[32];
+    fe25519       fe_f;
+    fe25519       fe_g;
+    size_t        i;
+    unsigned char x_sign;
+
+    x_sign = h[0] & 0x80;
+    for (i = 0; i < 32; i++) {
+        fl[i] = h[63 - i];
+        gl[i] = h[31 - i];
+    }
+    fl[31] &= 0x7f;
+    gl[31] &= 0x7f;
+    fe25519_frombytes(fe_f, fl);
+    fe25519_frombytes(fe_g, gl);
+    fe_f[0] += (h[32] >> 7) * 19;
+    for (i = 0; i < sizeof (fe25519) / sizeof fe_f[0]; i++) {
+        fe_f[i] += 38 * fe_g[i];
+    }
+    fe25519_reduce(fe_f, fe_f);
+    ge25519_elligator2(s, fe_f, x_sign);
+}
+
+/* Ristretto group */
+
+static int
+ristretto255_sqrt_ratio_m1(fe25519 x, const fe25519 u, const fe25519 v)
+{
+    fe25519 v3;
+    fe25519 vxx;
+    fe25519 m_root_check, p_root_check, f_root_check;
+    fe25519 x_sqrtm1;
+    int     has_m_root, has_p_root, has_f_root;
+
+    fe25519_sq(v3, v);
+    fe25519_mul(v3, v3, v); /* v3 = v^3 */
+    fe25519_sq(x, v3);
+    fe25519_mul(x, x, v);
+    fe25519_mul(x, x, u); /* x = uv^7 */
+
+    fe25519_pow22523(x, x); /* x = (uv^7)^((q-5)/8) */
+    fe25519_mul(x, x, v3);
+    fe25519_mul(x, x, u); /* x = uv^3(uv^7)^((q-5)/8) */
+
+    fe25519_sq(vxx, x);
+    fe25519_mul(vxx, vxx, v); /* vx^2 */
+    fe25519_sub(m_root_check, vxx, u); /* vx^2-u */
+    fe25519_add(p_root_check, vxx, u); /* vx^2+u */
+    fe25519_mul(f_root_check, u, sqrtm1); /* u*sqrt(-1) */
+    fe25519_add(f_root_check, vxx, f_root_check); /* vx^2+u*sqrt(-1) */
+    has_m_root = fe25519_iszero(m_root_check);
+    has_p_root = fe25519_iszero(p_root_check);
+    has_f_root = fe25519_iszero(f_root_check);
+    fe25519_mul(x_sqrtm1, x, sqrtm1); /* x*sqrt(-1) */
+
+    fe25519_cmov(x, x_sqrtm1, has_p_root | has_f_root);
+    fe25519_abs(x, x);
+
+    return has_m_root | has_p_root;
+}
+
+static int
+ristretto255_is_canonical(const unsigned char *s)
+{
+    unsigned char c;
+    unsigned char d;
+    unsigned char e;
+    unsigned int  i;
+
+    c = (s[31] & 0x7f) ^ 0x7f;
+    for (i = 30; i > 0; i--) {
+        c |= s[i] ^ 0xff;
+    }
+    c = (((unsigned int) c) - 1U) >> 8;
+    d = (0xed - 1U - (unsigned int) s[0]) >> 8;
+    e = s[31] >> 7;
+
+    return 1 - (((c & d) | e | s[0]) & 1);
+}
+
+int
+ristretto255_frombytes(ge25519_p3 *h, const unsigned char *s)
+{
+    fe25519 inv_sqrt;
+    fe25519 one;
+    fe25519 s_;
+    fe25519 ss;
+    fe25519 u1, u2;
+    fe25519 u1u1, u2u2;
+    fe25519 v;
+    fe25519 v_u2u2;
+    int     was_square;
+
+    if (ristretto255_is_canonical(s) == 0) {
+        return -1;
+    }
+    fe25519_frombytes(s_, s);
+    fe25519_sq(ss, s_);                /* ss = s^2 */
+
+    fe25519_1(u1);
+    fe25519_sub(u1, u1, ss);           /* u1 = 1-ss */
+    fe25519_sq(u1u1, u1);              /* u1u1 = u1^2 */
+
+    fe25519_1(u2);
+    fe25519_add(u2, u2, ss);           /* u2 = 1+ss */
+    fe25519_sq(u2u2, u2);              /* u2u2 = u2^2 */
+
+    fe25519_mul(v, d, u1u1);           /* v = d*u1^2 */
+    fe25519_neg(v, v);                 /* v = -d*u1^2 */
+    fe25519_sub(v, v, u2u2);           /* v = -(d*u1^2)-u2^2 */
+
+    fe25519_mul(v_u2u2, v, u2u2);      /* v_u2u2 = v*u2^2 */
+
+    fe25519_1(one);
+    was_square = ristretto255_sqrt_ratio_m1(inv_sqrt, one, v_u2u2);
+    fe25519_mul(h->X, inv_sqrt, u2);
+    fe25519_mul(h->Y, inv_sqrt, h->X);
+    fe25519_mul(h->Y, h->Y, v);
+
+    fe25519_mul(h->X, h->X, s_);
+    fe25519_add(h->X, h->X, h->X);
+    fe25519_abs(h->X, h->X);
+    fe25519_mul(h->Y, u1, h->Y);
+    fe25519_1(h->Z);
+    fe25519_mul(h->T, h->X, h->Y);
+
+    return - ((1 - was_square) |
+              fe25519_isnegative(h->T) | fe25519_iszero(h->Y));
+}
+
+void
+ristretto255_p3_tobytes(unsigned char *s, const ge25519_p3 *h)
+{
+    fe25519 den1, den2;
+    fe25519 den_inv;
+    fe25519 eden;
+    fe25519 inv_sqrt;
+    fe25519 ix, iy;
+    fe25519 one;
+    fe25519 s_;
+    fe25519 t_z_inv;
+    fe25519 u1, u2;
+    fe25519 u1_u2u2;
+    fe25519 x_, y_;
+    fe25519 x_z_inv;
+    fe25519 z_inv;
+    fe25519 zmy;
+    int     rotate;
+
+    fe25519_add(u1, h->Z, h->Y);       /* u1 = Z+Y */
+    fe25519_sub(zmy, h->Z, h->Y);      /* zmy = Z-Y */
+    fe25519_mul(u1, u1, zmy);          /* u1 = (Z+Y)*(Z-Y) */
+    fe25519_mul(u2, h->X, h->Y);       /* u2 = X*Y */
+
+    fe25519_sq(u1_u2u2, u2);           /* u1_u2u2 = u2^2 */
+    fe25519_mul(u1_u2u2, u1, u1_u2u2); /* u1_u2u2 = u1*u2^2 */
+
+    fe25519_1(one);
+    (void) ristretto255_sqrt_ratio_m1(inv_sqrt, one, u1_u2u2);
+    fe25519_mul(den1, inv_sqrt, u1);   /* den1 = inv_sqrt*u1 */
+    fe25519_mul(den2, inv_sqrt, u2);   /* den2 = inv_sqrt*u2 */
+    fe25519_mul(z_inv, den1, den2);    /* z_inv = den1*den2 */
+    fe25519_mul(z_inv, z_inv, h->T);   /* z_inv = den1*den2*T */
+
+    fe25519_mul(ix, h->X, sqrtm1);     /* ix = X*sqrt(-1) */
+    fe25519_mul(iy, h->Y, sqrtm1);     /* iy = Y*sqrt(-1) */
+    fe25519_mul(eden, den1, invsqrtamd); /* eden = den1/sqrt(a-d) */
+
+    fe25519_mul(t_z_inv, h->T, z_inv); /* t_z_inv = T*z_inv */
+    rotate = fe25519_isnegative(t_z_inv);
+
+    fe25519_copy(x_, h->X);
+    fe25519_copy(y_, h->Y);
+    fe25519_copy(den_inv, den2);
+
+    fe25519_cmov(x_, iy, rotate);
+    fe25519_cmov(y_, ix, rotate);
+    fe25519_cmov(den_inv, eden, rotate);
+
+    fe25519_mul(x_z_inv, x_, z_inv);
+    fe25519_cneg(y_, y_, fe25519_isnegative(x_z_inv));
+
+    fe25519_sub(s_, h->Z, y_);
+    fe25519_mul(s_, den_inv, s_);
+    fe25519_abs(s_, s_);
+    fe25519_tobytes(s, s_);
+}
+
+static void
+ristretto255_elligator(ge25519_p3 *p, const fe25519 t)
+{
+    fe25519 c;
+    fe25519 n;
+    fe25519 one;
+    fe25519 r;
+    fe25519 rpd;
+    fe25519 s, s_prime;
+    fe25519 ss;
+    fe25519 u, v;
+    fe25519 w0, w1, w2, w3;
+    int     wasnt_square;
+
+    fe25519_1(one);
+    fe25519_sq(r, t);                  /* r = t^2 */
+    fe25519_mul(r, sqrtm1, r);         /* r = sqrt(-1)*t^2 */
+    fe25519_add(u, r, one);            /* u = r+1 */
+    fe25519_mul(u, u, onemsqd);        /* u = (r+1)*(1-d^2) */
+    fe25519_1(c);
+    fe25519_neg(c, c);                 /* c = -1 */
+    fe25519_add(rpd, r, d);            /* rpd = r+d */
+    fe25519_mul(v, r, d);              /* v = r*d */
+    fe25519_sub(v, c, v);              /* v = c-r*d */
+    fe25519_mul(v, v, rpd);            /* v = (c-r*d)*(r+d) */
+
+    wasnt_square = 1 - ristretto255_sqrt_ratio_m1(s, u, v);
+    fe25519_mul(s_prime, s, t);
+    fe25519_abs(s_prime, s_prime);
+    fe25519_neg(s_prime, s_prime);     /* s_prime = -|s*t| */
+    fe25519_cmov(s, s_prime, wasnt_square);
+    fe25519_cmov(c, r, wasnt_square);
+
+    fe25519_sub(n, r, one);            /* n = r-1 */
+    fe25519_mul(n, n, c);              /* n = c*(r-1) */
+    fe25519_mul(n, n, sqdmone);        /* n = c*(r-1)*(d-1)^2 */
+    fe25519_sub(n, n, v);              /* n =  c*(r-1)*(d-1)^2-v */
+
+    fe25519_add(w0, s, s);             /* w0 = 2s */
+    fe25519_mul(w0, w0, v);            /* w0 = 2s*v */
+    fe25519_mul(w1, n, sqrtadm1);      /* w1 = n*sqrt(ad-1) */
+    fe25519_sq(ss, s);                 /* ss = s^2 */
+    fe25519_sub(w2, one, ss);          /* w2 = 1-s^2 */
+    fe25519_add(w3, one, ss);          /* w3 = 1+s^2 */
+
+    fe25519_mul(p->X, w0, w3);
+    fe25519_mul(p->Y, w2, w1);
+    fe25519_mul(p->Z, w1, w3);
+    fe25519_mul(p->T, w0, w2);
+}
+
+void
+ristretto255_from_hash(unsigned char s[32], const unsigned char h[64])
+{
+    fe25519        r0, r1;
+    ge25519_cached p1_cached;
+    ge25519_p1p1   p_p1p1;
+    ge25519_p3     p0, p1;
+    ge25519_p3     p;
+
+    fe25519_frombytes(r0, h);
+    fe25519_frombytes(r1, h + 32);
+    ristretto255_elligator(&p0, r0);
+    ristretto255_elligator(&p1, r1);
+    ge25519_p3_to_cached(&p1_cached, &p1);
+    ge25519_add(&p_p1p1, &p0, &p1_cached);
+    ge25519_p1p1_to_p3(&p, &p_p1p1);
+    ristretto255_p3_tobytes(s, &p);
+}
diff --git a/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/base.h b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/base.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/base.h
@@ -0,0 +1,1344 @@
+{ /* 0/31 */
+  {
+    { 25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605 },
+    { -12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378 },
+    { -8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546 }
+  },
+  {
+    { -12815894, -12976347, -21581243, 11784320, -25355658, -2750717, -11717903, -3814571, -358445, -10211303 },
+    { -21703237, 6903825, 27185491, 6451973, -29577724, -9554005, -15616551, 11189268, -26829678, -5319081 },
+    { 26966642, 11152617, 32442495, 15396054, 14353839, -12752335, -3128826, -9541118, -15472047, -4166697 }
+  },
+  {
+    { 15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024 },
+    { 16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574 },
+    { 30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357 }
+  },
+  {
+    { -17036878, 13921892, 10945806, -6033431, 27105052, -16084379, -28926210, 15006023, 3284568, -6276540 },
+    { 23599295, -8306047, -11193664, -7687416, 13236774, 10506355, 7464579, 9656445, 13059162, 10374397 },
+    { 7798556, 16710257, 3033922, 2874086, 28997861, 2835604, 32406664, -3839045, -641708, -101325 }
+  },
+  {
+    { 10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380 },
+    { 4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306 },
+    { 19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942 }
+  },
+  {
+    { -15371964, -12862754, 32573250, 4720197, -26436522, 5875511, -19188627, -15224819, -9818940, -12085777 },
+    { -8549212, 109983, 15149363, 2178705, 22900618, 4543417, 3044240, -15689887, 1762328, 14866737 },
+    { -18199695, -15951423, -10473290, 1707278, -17185920, 3916101, -28236412, 3959421, 27914454, 4383652 }
+  },
+  {
+    { 5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766 },
+    { -30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701 },
+    { 28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300 }
+  },
+  {
+    { 14499471, -2729599, -33191113, -4254652, 28494862, 14271267, 30290735, 10876454, -33154098, 2381726 },
+    { -7195431, -2655363, -14730155, 462251, -27724326, 3941372, -6236617, 3696005, -32300832, 15351955 },
+    { 27431194, 8222322, 16448760, -3907995, -18707002, 11938355, -32961401, -2970515, 29551813, 10109425 }
+  }
+},
+{ /* 1/31 */
+  {
+    { -13657040, -13155431, -31283750, 11777098, 21447386, 6519384, -2378284, -1627556, 10092783, -4764171 },
+    { 27939166, 14210322, 4677035, 16277044, -22964462, -12398139, -32508754, 12005538, -17810127, 12803510 },
+    { 17228999, -15661624, -1233527, 300140, -1224870, -11714777, 30364213, -9038194, 18016357, 4397660 }
+  },
+  {
+    { -10958843, -7690207, 4776341, -14954238, 27850028, -15602212, -26619106, 14544525, -17477504, 982639 },
+    { 29253598, 15796703, -2863982, -9908884, 10057023, 3163536, 7332899, -4120128, -21047696, 9934963 },
+    { 5793303, 16271923, -24131614, -10116404, 29188560, 1206517, -14747930, 4559895, -30123922, -10897950 }
+  },
+  {
+    { -27643952, -11493006, 16282657, -11036493, 28414021, -15012264, 24191034, 4541697, -13338309, 5500568 },
+    { 12650548, -1497113, 9052871, 11355358, -17680037, -8400164, -17430592, 12264343, 10874051, 13524335 },
+    { 25556948, -3045990, 714651, 2510400, 23394682, -10415330, 33119038, 5080568, -22528059, 5376628 }
+  },
+  {
+    { -26088264, -4011052, -17013699, -3537628, -6726793, 1920897, -22321305, -9447443, 4535768, 1569007 },
+    { -2255422, 14606630, -21692440, -8039818, 28430649, 8775819, -30494562, 3044290, 31848280, 12543772 },
+    { -22028579, 2943893, -31857513, 6777306, 13784462, -4292203, -27377195, -2062731, 7718482, 14474653 }
+  },
+  {
+    { 2385315, 2454213, -22631320, 46603, -4437935, -15680415, 656965, -7236665, 24316168, -5253567 },
+    { 13741529, 10911568, -33233417, -8603737, -20177830, -1033297, 33040651, -13424532, -20729456, 8321686 },
+    { 21060490, -2212744, 15712757, -4336099, 1639040, 10656336, 23845965, -11874838, -9984458, 608372 }
+  },
+  {
+    { -13672732, -15087586, -10889693, -7557059, -6036909, 11305547, 1123968, -6780577, 27229399, 23887 },
+    { -23244140, -294205, -11744728, 14712571, -29465699, -2029617, 12797024, -6440308, -1633405, 16678954 },
+    { -29500620, 4770662, -16054387, 14001338, 7830047, 9564805, -1508144, -4795045, -17169265, 4904953 }
+  },
+  {
+    { 24059557, 14617003, 19037157, -15039908, 19766093, -14906429, 5169211, 16191880, 2128236, -4326833 },
+    { -16981152, 4124966, -8540610, -10653797, 30336522, -14105247, -29806336, 916033, -6882542, -2986532 },
+    { -22630907, 12419372, -7134229, -7473371, -16478904, 16739175, 285431, 2763829, 15736322, 4143876 }
+  },
+  {
+    { 2379352, 11839345, -4110402, -5988665, 11274298, 794957, 212801, -14594663, 23527084, -16458268 },
+    { 33431127, -11130478, -17838966, -15626900, 8909499, 8376530, -32625340, 4087881, -15188911, -14416214 },
+    { 1767683, 7197987, -13205226, -2022635, -13091350, 448826, 5799055, 4357868, -4774191, -16323038 }
+  }
+},
+{ /* 2/31 */
+  {
+    { 6721966, 13833823, -23523388, -1551314, 26354293, -11863321, 23365147, -3949732, 7390890, 2759800 },
+    { 4409041, 2052381, 23373853, 10530217, 7676779, -12885954, 21302353, -4264057, 1244380, -12919645 },
+    { -4421239, 7169619, 4982368, -2957590, 30256825, -2777540, 14086413, 9208236, 15886429, 16489664 }
+  },
+  {
+    { 1996075, 10375649, 14346367, 13311202, -6874135, -16438411, -13693198, 398369, -30606455, -712933 },
+    { -25307465, 9795880, -2777414, 14878809, -33531835, 14780363, 13348553, 12076947, -30836462, 5113182 },
+    { -17770784, 11797796, 31950843, 13929123, -25888302, 12288344, -30341101, -7336386, 13847711, 5387222 }
+  },
+  {
+    { -18582163, -3416217, 17824843, -2340966, 22744343, -10442611, 8763061, 3617786, -19600662, 10370991 },
+    { 20246567, -14369378, 22358229, -543712, 18507283, -10413996, 14554437, -8746092, 32232924, 16763880 },
+    { 9648505, 10094563, 26416693, 14745928, -30374318, -6472621, 11094161, 15689506, 3140038, -16510092 }
+  },
+  {
+    { -16160072, 5472695, 31895588, 4744994, 8823515, 10365685, -27224800, 9448613, -28774454, 366295 },
+    { 19153450, 11523972, -11096490, -6503142, -24647631, 5420647, 28344573, 8041113, 719605, 11671788 },
+    { 8678025, 2694440, -6808014, 2517372, 4964326, 11152271, -15432916, -15266516, 27000813, -10195553 }
+  },
+  {
+    { -15157904, 7134312, 8639287, -2814877, -7235688, 10421742, 564065, 5336097, 6750977, -14521026 },
+    { 11836410, -3979488, 26297894, 16080799, 23455045, 15735944, 1695823, -8819122, 8169720, 16220347 },
+    { -18115838, 8653647, 17578566, -6092619, -8025777, -16012763, -11144307, -2627664, -5990708, -14166033 }
+  },
+  {
+    { -23308498, -10968312, 15213228, -10081214, -30853605, -11050004, 27884329, 2847284, 2655861, 1738395 },
+    { -27537433, -14253021, -25336301, -8002780, -9370762, 8129821, 21651608, -3239336, -19087449, -11005278 },
+    { 1533110, 3437855, 23735889, 459276, 29970501, 11335377, 26030092, 5821408, 10478196, 8544890 }
+  },
+  {
+    { 32173121, -16129311, 24896207, 3921497, 22579056, -3410854, 19270449, 12217473, 17789017, -3395995 },
+    { -30552961, -2228401, -15578829, -10147201, 13243889, 517024, 15479401, -3853233, 30460520, 1052596 },
+    { -11614875, 13323618, 32618793, 8175907, -15230173, 12596687, 27491595, -4612359, 3179268, -9478891 }
+  },
+  {
+    { 31947069, -14366651, -4640583, -15339921, -15125977, -6039709, -14756777, -16411740, 19072640, -9511060 },
+    { 11685058, 11822410, 3158003, -13952594, 33402194, -4165066, 5977896, -5215017, 473099, 5040608 },
+    { -20290863, 8198642, -27410132, 11602123, 1290375, -2799760, 28326862, 1721092, -19558642, -3131606 }
+  }
+},
+{ /* 3/31 */
+  {
+    { 7881532, 10687937, 7578723, 7738378, -18951012, -2553952, 21820786, 8076149, -27868496, 11538389 },
+    { -19935666, 3899861, 18283497, -6801568, -15728660, -11249211, 8754525, 7446702, -5676054, 5797016 },
+    { -11295600, -3793569, -15782110, -7964573, 12708869, -8456199, 2014099, -9050574, -2369172, -5877341 }
+  },
+  {
+    { -22472376, -11568741, -27682020, 1146375, 18956691, 16640559, 1192730, -3714199, 15123619, 10811505 },
+    { 14352098, -3419715, -18942044, 10822655, 32750596, 4699007, -70363, 15776356, -28886779, -11974553 },
+    { -28241164, -8072475, -4978962, -5315317, 29416931, 1847569, -20654173, -16484855, 4714547, -9600655 }
+  },
+  {
+    { 15200332, 8368572, 19679101, 15970074, -31872674, 1959451, 24611599, -4543832, -11745876, 12340220 },
+    { 12876937, -10480056, 33134381, 6590940, -6307776, 14872440, 9613953, 8241152, 15370987, 9608631 },
+    { -4143277, -12014408, 8446281, -391603, 4407738, 13629032, -7724868, 15866074, -28210621, -8814099 }
+  },
+  {
+    { 26660628, -15677655, 8393734, 358047, -7401291, 992988, -23904233, 858697, 20571223, 8420556 },
+    { 14620715, 13067227, -15447274, 8264467, 14106269, 15080814, 33531827, 12516406, -21574435, -12476749 },
+    { 236881, 10476226, 57258, -14677024, 6472998, 2466984, 17258519, 7256740, 8791136, 15069930 }
+  },
+  {
+    { 1276410, -9371918, 22949635, -16322807, -23493039, -5702186, 14711875, 4874229, -30663140, -2331391 },
+    { 5855666, 4990204, -13711848, 7294284, -7804282, 1924647, -1423175, -7912378, -33069337, 9234253 },
+    { 20590503, -9018988, 31529744, -7352666, -2706834, 10650548, 31559055, -11609587, 18979186, 13396066 }
+  },
+  {
+    { 24474287, 4968103, 22267082, 4407354, 24063882, -8325180, -18816887, 13594782, 33514650, 7021958 },
+    { -11566906, -6565505, -21365085, 15928892, -26158305, 4315421, -25948728, -3916677, -21480480, 12868082 },
+    { -28635013, 13504661, 19988037, -2132761, 21078225, 6443208, -21446107, 2244500, -12455797, -8089383 }
+  },
+  {
+    { -30595528, 13793479, -5852820, 319136, -25723172, -6263899, 33086546, 8957937, -15233648, 5540521 },
+    { -11630176, -11503902, -8119500, -7643073, 2620056, 1022908, -23710744, -1568984, -16128528, -14962807 },
+    { 23152971, 775386, 27395463, 14006635, -9701118, 4649512, 1689819, 892185, -11513277, -15205948 }
+  },
+  {
+    { 9770129, 9586738, 26496094, 4324120, 1556511, -3550024, 27453819, 4763127, -19179614, 5867134 },
+    { -32765025, 1927590, 31726409, -4753295, 23962434, -16019500, 27846559, 5931263, -29749703, -16108455 },
+    { 27461885, -2977536, 22380810, 1815854, -23033753, -3031938, 7283490, -15148073, -19526700, 7734629 }
+  }
+},
+{ /* 4/31 */
+  {
+    { -8010264, -9590817, -11120403, 6196038, 29344158, -13430885, 7585295, -3176626, 18549497, 15302069 },
+    { -32658337, -6171222, -7672793, -11051681, 6258878, 13504381, 10458790, -6418461, -8872242, 8424746 },
+    { 24687205, 8613276, -30667046, -3233545, 1863892, -1830544, 19206234, 7134917, -11284482, -828919 }
+  },
+  {
+    { 11334899, -9218022, 8025293, 12707519, 17523892, -10476071, 10243738, -14685461, -5066034, 16498837 },
+    { 8911542, 6887158, -9584260, -6958590, 11145641, -9543680, 17303925, -14124238, 6536641, 10543906 },
+    { -28946384, 15479763, -17466835, 568876, -1497683, 11223454, -2669190, -16625574, -27235709, 8876771 }
+  },
+  {
+    { -25742899, -12566864, -15649966, -846607, -33026686, -796288, -33481822, 15824474, -604426, -9039817 },
+    { 10330056, 70051, 7957388, -9002667, 9764902, 15609756, 27698697, -4890037, 1657394, 3084098 },
+    { 10477963, -7470260, 12119566, -13250805, 29016247, -5365589, 31280319, 14396151, -30233575, 15272409 }
+  },
+  {
+    { -12288309, 3169463, 28813183, 16658753, 25116432, -5630466, -25173957, -12636138, -25014757, 1950504 },
+    { -26180358, 9489187, 11053416, -14746161, -31053720, 5825630, -8384306, -8767532, 15341279, 8373727 },
+    { 28685821, 7759505, -14378516, -12002860, -31971820, 4079242, 298136, -10232602, -2878207, 15190420 }
+  },
+  {
+    { -32932876, 13806336, -14337485, -15794431, -24004620, 10940928, 8669718, 2742393, -26033313, -6875003 },
+    { -1580388, -11729417, -25979658, -11445023, -17411874, -10912854, 9291594, -16247779, -12154742, 6048605 },
+    { -30305315, 14843444, 1539301, 11864366, 20201677, 1900163, 13934231, 5128323, 11213262, 9168384 }
+  },
+  {
+    { -26280513, 11007847, 19408960, -940758, -18592965, -4328580, -5088060, -11105150, 20470157, -16398701 },
+    { -23136053, 9282192, 14855179, -15390078, -7362815, -14408560, -22783952, 14461608, 14042978, 5230683 },
+    { 29969567, -2741594, -16711867, -8552442, 9175486, -2468974, 21556951, 3506042, -5933891, -12449708 }
+  },
+  {
+    { -3144746, 8744661, 19704003, 4581278, -20430686, 6830683, -21284170, 8971513, -28539189, 15326563 },
+    { -19464629, 10110288, -17262528, -3503892, -23500387, 1355669, -15523050, 15300988, -20514118, 9168260 },
+    { -5353335, 4488613, -23803248, 16314347, 7780487, -15638939, -28948358, 9601605, 33087103, -9011387 }
+  },
+  {
+    { -19443170, -15512900, -20797467, -12445323, -29824447, 10229461, -27444329, -15000531, -5996870, 15664672 },
+    { 23294591, -16632613, -22650781, -8470978, 27844204, 11461195, 13099750, -2460356, 18151676, 13417686 },
+    { -24722913, -4176517, -31150679, 5988919, -26858785, 6685065, 1661597, -12551441, 15271676, -15452665 }
+  }
+},
+{ /* 5/31 */
+  {
+    { 11433042, -13228665, 8239631, -5279517, -1985436, -725718, -18698764, 2167544, -6921301, -13440182 },
+    { -31436171, 15575146, 30436815, 12192228, -22463353, 9395379, -9917708, -8638997, 12215110, 12028277 },
+    { 14098400, 6555944, 23007258, 5757252, -15427832, -12950502, 30123440, 4617780, -16900089, -655628 }
+  },
+  {
+    { -4026201, -15240835, 11893168, 13718664, -14809462, 1847385, -15819999, 10154009, 23973261, -12684474 },
+    { -26531820, -3695990, -1908898, 2534301, -31870557, -16550355, 18341390, -11419951, 32013174, -10103539 },
+    { -25479301, 10876443, -11771086, -14625140, -12369567, 1838104, 21911214, 6354752, 4425632, -837822 }
+  },
+  {
+    { -10433389, -14612966, 22229858, -3091047, -13191166, 776729, -17415375, -12020462, 4725005, 14044970 },
+    { 19268650, -7304421, 1555349, 8692754, -21474059, -9910664, 6347390, -1411784, -19522291, -16109756 },
+    { -24864089, 12986008, -10898878, -5558584, -11312371, -148526, 19541418, 8180106, 9282262, 10282508 }
+  },
+  {
+    { -26205082, 4428547, -8661196, -13194263, 4098402, -14165257, 15522535, 8372215, 5542595, -10702683 },
+    { -10562541, 14895633, 26814552, -16673850, -17480754, -2489360, -2781891, 6993761, -18093885, 10114655 },
+    { -20107055, -929418, 31422704, 10427861, -7110749, 6150669, -29091755, -11529146, 25953725, -106158 }
+  },
+  {
+    { -4234397, -8039292, -9119125, 3046000, 2101609, -12607294, 19390020, 6094296, -3315279, 12831125 },
+    { -15998678, 7578152, 5310217, 14408357, -33548620, -224739, 31575954, 6326196, 7381791, -2421839 },
+    { -20902779, 3296811, 24736065, -16328389, 18374254, 7318640, 6295303, 8082724, -15362489, 12339664 }
+  },
+  {
+    { 27724736, 2291157, 6088201, -14184798, 1792727, 5857634, 13848414, 15768922, 25091167, 14856294 },
+    { -18866652, 8331043, 24373479, 8541013, -701998, -9269457, 12927300, -12695493, -22182473, -9012899 },
+    { -11423429, -5421590, 11632845, 3405020, 30536730, -11674039, -27260765, 13866390, 30146206, 9142070 }
+  },
+  {
+    { 3924129, -15307516, -13817122, -10054960, 12291820, -668366, -27702774, 9326384, -8237858, 4171294 },
+    { -15921940, 16037937, 6713787, 16606682, -21612135, 2790944, 26396185, 3731949, 345228, -5462949 },
+    { -21327538, 13448259, 25284571, 1143661, 20614966, -8849387, 2031539, -12391231, -16253183, -13582083 }
+  },
+  {
+    { 31016211, -16722429, 26371392, -14451233, -5027349, 14854137, 17477601, 3842657, 28012650, -16405420 },
+    { -5075835, 9368966, -8562079, -4600902, -15249953, 6970560, -9189873, 16292057, -8867157, 3507940 },
+    { 29439664, 3537914, 23333589, 6997794, -17555561, -11018068, -15209202, -15051267, -9164929, 6580396 }
+  }
+},
+{ /* 6/31 */
+  {
+    { -12185861, -7679788, 16438269, 10826160, -8696817, -6235611, 17860444, -9273846, -2095802, 9304567 },
+    { 20714564, -4336911, 29088195, 7406487, 11426967, -5095705, 14792667, -14608617, 5289421, -477127 },
+    { -16665533, -10650790, -6160345, -13305760, 9192020, -1802462, 17271490, 12349094, 26939669, -3752294 }
+  },
+  {
+    { -12889898, 9373458, 31595848, 16374215, 21471720, 13221525, -27283495, -12348559, -3698806, 117887 },
+    { 22263325, -6560050, 3984570, -11174646, -15114008, -566785, 28311253, 5358056, -23319780, 541964 },
+    { 16259219, 3261970, 2309254, -15534474, -16885711, -4581916, 24134070, -16705829, -13337066, -13552195 }
+  },
+  {
+    { 9378160, -13140186, -22845982, -12745264, 28198281, -7244098, -2399684, -717351, 690426, 14876244 },
+    { 24977353, -314384, -8223969, -13465086, 28432343, -1176353, -13068804, -12297348, -22380984, 6618999 },
+    { -1538174, 11685646, 12944378, 13682314, -24389511, -14413193, 8044829, -13817328, 32239829, -5652762 }
+  },
+  {
+    { -18603066, 4762990, -926250, 8885304, -28412480, -3187315, 9781647, -10350059, 32779359, 5095274 },
+    { -33008130, -5214506, -32264887, -3685216, 9460461, -9327423, -24601656, 14506724, 21639561, -2630236 },
+    { -16400943, -13112215, 25239338, 15531969, 3987758, -4499318, -1289502, -6863535, 17874574, 558605 }
+  },
+  {
+    { -13600129, 10240081, 9171883, 16131053, -20869254, 9599700, 33499487, 5080151, 2085892, 5119761 },
+    { -22205145, -2519528, -16381601, 414691, -25019550, 2170430, 30634760, -8363614, -31999993, -5759884 },
+    { -6845704, 15791202, 8550074, -1312654, 29928809, -12092256, 27534430, -7192145, -22351378, 12961482 }
+  },
+  {
+    { -24492060, -9570771, 10368194, 11582341, -23397293, -2245287, 16533930, 8206996, -30194652, -5159638 },
+    { -11121496, -3382234, 2307366, 6362031, -135455, 8868177, -16835630, 7031275, 7589640, 8945490 },
+    { -32152748, 8917967, 6661220, -11677616, -1192060, -15793393, 7251489, -11182180, 24099109, -14456170 }
+  },
+  {
+    { 5019558, -7907470, 4244127, -14714356, -26933272, 6453165, -19118182, -13289025, -6231896, -10280736 },
+    { 10853594, 10721687, 26480089, 5861829, -22995819, 1972175, -1866647, -10557898, -3363451, -6441124 },
+    { -17002408, 5906790, 221599, -6563147, 7828208, -13248918, 24362661, -2008168, -13866408, 7421392 }
+  },
+  {
+    { 8139927, -6546497, 32257646, -5890546, 30375719, 1886181, -21175108, 15441252, 28826358, -4123029 },
+    { 6267086, 9695052, 7709135, -16603597, -32869068, -1886135, 14795160, -7840124, 13746021, -1742048 },
+    { 28584902, 7787108, -6732942, -15050729, 22846041, -7571236, -3181936, -363524, 4771362, -8419958 }
+  }
+},
+{ /* 7/31 */
+  {
+    { 24949256, 6376279, -27466481, -8174608, -18646154, -9930606, 33543569, -12141695, 3569627, 11342593 },
+    { 26514989, 4740088, 27912651, 3697550, 19331575, -11472339, 6809886, 4608608, 7325975, -14801071 },
+    { -11618399, -14554430, -24321212, 7655128, -1369274, 5214312, -27400540, 10258390, -17646694, -8186692 }
+  },
+  {
+    { 11431204, 15823007, 26570245, 14329124, 18029990, 4796082, -31446179, 15580664, 9280358, -3973687 },
+    { -160783, -10326257, -22855316, -4304997, -20861367, -13621002, -32810901, -11181622, -15545091, 4387441 },
+    { -20799378, 12194512, 3937617, -5805892, -27154820, 9340370, -24513992, 8548137, 20617071, -7482001 }
+  },
+  {
+    { -938825, -3930586, -8714311, 16124718, 24603125, -6225393, -13775352, -11875822, 24345683, 10325460 },
+    { -19855277, -1568885, -22202708, 8714034, 14007766, 6928528, 16318175, -1010689, 4766743, 3552007 },
+    { -21751364, -16730916, 1351763, -803421, -4009670, 3950935, 3217514, 14481909, 10988822, -3994762 }
+  },
+  {
+    { 15564307, -14311570, 3101243, 5684148, 30446780, -8051356, 12677127, -6505343, -8295852, 13296005 },
+    { -9442290, 6624296, -30298964, -11913677, -4670981, -2057379, 31521204, 9614054, -30000824, 12074674 },
+    { 4771191, -135239, 14290749, -13089852, 27992298, 14998318, -1413936, -1556716, 29832613, -16391035 }
+  },
+  {
+    { 7064884, -7541174, -19161962, -5067537, -18891269, -2912736, 25825242, 5293297, -27122660, 13101590 },
+    { -2298563, 2439670, -7466610, 1719965, -27267541, -16328445, 32512469, -5317593, -30356070, -4190957 },
+    { -30006540, 10162316, -33180176, 3981723, -16482138, -13070044, 14413974, 9515896, 19568978, 9628812 }
+  },
+  {
+    { 33053803, 199357, 15894591, 1583059, 27380243, -4580435, -17838894, -6106839, -6291786, 3437740 },
+    { -18978877, 3884493, 19469877, 12726490, 15913552, 13614290, -22961733, 70104, 7463304, 4176122 },
+    { -27124001, 10659917, 11482427, -16070381, 12771467, -6635117, -32719404, -5322751, 24216882, 5944158 }
+  },
+  {
+    { 8894125, 7450974, -2664149, -9765752, -28080517, -12389115, 19345746, 14680796, 11632993, 5847885 },
+    { 26942781, -2315317, 9129564, -4906607, 26024105, 11769399, -11518837, 6367194, -9727230, 4782140 },
+    { 19916461, -4828410, -22910704, -11414391, 25606324, -5972441, 33253853, 8220911, 6358847, -1873857 }
+  },
+  {
+    { 801428, -2081702, 16569428, 11065167, 29875704, 96627, 7908388, -4480480, -13538503, 1387155 },
+    { 19646058, 5720633, -11416706, 12814209, 11607948, 12749789, 14147075, 15156355, -21866831, 11835260 },
+    { 19299512, 1155910, 28703737, 14890794, 2925026, 7269399, 26121523, 15467869, -26560550, 5052483 }
+  }
+},
+{ /* 8/31 */
+  {
+    { -3017432, 10058206, 1980837, 3964243, 22160966, 12322533, -6431123, -12618185, 12228557, -7003677 },
+    { 32944382, 14922211, -22844894, 5188528, 21913450, -8719943, 4001465, 13238564, -6114803, 8653815 },
+    { 22865569, -4652735, 27603668, -12545395, 14348958, 8234005, 24808405, 5719875, 28483275, 2841751 }
+  },
+  {
+    { -16420968, -1113305, -327719, -12107856, 21886282, -15552774, -1887966, -315658, 19932058, -12739203 },
+    { -11656086, 10087521, -8864888, -5536143, -19278573, -3055912, 3999228, 13239134, -4777469, -13910208 },
+    { 1382174, -11694719, 17266790, 9194690, -13324356, 9720081, 20403944, 11284705, -14013818, 3093230 }
+  },
+  {
+    { 16650921, -11037932, -1064178, 1570629, -8329746, 7352753, -302424, 16271225, -24049421, -6691850 },
+    { -21911077, -5927941, -4611316, -5560156, -31744103, -10785293, 24123614, 15193618, -21652117, -16739389 },
+    { -9935934, -4289447, -25279823, 4372842, 2087473, 10399484, 31870908, 14690798, 17361620, 11864968 }
+  },
+  {
+    { -11307610, 6210372, 13206574, 5806320, -29017692, -13967200, -12331205, -7486601, -25578460, -16240689 },
+    { 14668462, -12270235, 26039039, 15305210, 25515617, 4542480, 10453892, 6577524, 9145645, -6443880 },
+    { 5974874, 3053895, -9433049, -10385191, -31865124, 3225009, -7972642, 3936128, -5652273, -3050304 }
+  },
+  {
+    { 30625386, -4729400, -25555961, -12792866, -20484575, 7695099, 17097188, -16303496, -27999779, 1803632 },
+    { -3553091, 9865099, -5228566, 4272701, -5673832, -16689700, 14911344, 12196514, -21405489, 7047412 },
+    { 20093277, 9920966, -11138194, -5343857, 13161587, 12044805, -32856851, 4124601, -32343828, -10257566 }
+  },
+  {
+    { -20788824, 14084654, -13531713, 7842147, 19119038, -13822605, 4752377, -8714640, -21679658, 2288038 },
+    { -26819236, -3283715, 29965059, 3039786, -14473765, 2540457, 29457502, 14625692, -24819617, 12570232 },
+    { -1063558, -11551823, 16920318, 12494842, 1278292, -5869109, -21159943, -3498680, -11974704, 4724943 }
+  },
+  {
+    { 17960970, -11775534, -4140968, -9702530, -8876562, -1410617, -12907383, -8659932, -29576300, 1903856 },
+    { 23134274, -14279132, -10681997, -1611936, 20684485, 15770816, -12989750, 3190296, 26955097, 14109738 },
+    { 15308788, 5320727, -30113809, -14318877, 22902008, 7767164, 29425325, -11277562, 31960942, 11934971 }
+  },
+  {
+    { -27395711, 8435796, 4109644, 12222639, -24627868, 14818669, 20638173, 4875028, 10491392, 1379718 },
+    { -13159415, 9197841, 3875503, -8936108, -1383712, -5879801, 33518459, 16176658, 21432314, 12180697 },
+    { -11787308, 11500838, 13787581, -13832590, -22430679, 10140205, 1465425, 12689540, -10301319, -13872883 }
+  }
+},
+{ /* 9/31 */
+  {
+    { 5414091, -15386041, -21007664, 9643570, 12834970, 1186149, -2622916, -1342231, 26128231, 6032912 },
+    { -26337395, -13766162, 32496025, -13653919, 17847801, -12669156, 3604025, 8316894, -25875034, -10437358 },
+    { 3296484, 6223048, 24680646, -12246460, -23052020, 5903205, -8862297, -4639164, 12376617, 3188849 }
+  },
+  {
+    { 29190488, -14659046, 27549113, -1183516, 3520066, -10697301, 32049515, -7309113, -16109234, -9852307 },
+    { -14744486, -9309156, 735818, -598978, -20407687, -5057904, 25246078, -15795669, 18640741, -960977 },
+    { -6928835, -16430795, 10361374, 5642961, 4910474, 12345252, -31638386, -494430, 10530747, 1053335 }
+  },
+  {
+    { -29265967, -14186805, -13538216, -12117373, -19457059, -10655384, -31462369, -2948985, 24018831, 15026644 },
+    { -22592535, -3145277, -2289276, 5953843, -13440189, 9425631, 25310643, 13003497, -2314791, -15145616 },
+    { -27419985, -603321, -8043984, -1669117, -26092265, 13987819, -27297622, 187899, -23166419, -2531735 }
+  },
+  {
+    { -21744398, -13810475, 1844840, 5021428, -10434399, -15911473, 9716667, 16266922, -5070217, 726099 },
+    { 29370922, -6053998, 7334071, -15342259, 9385287, 2247707, -13661962, -4839461, 30007388, -15823341 },
+    { -936379, 16086691, 23751945, -543318, -1167538, -5189036, 9137109, 730663, 9835848, 4555336 }
+  },
+  {
+    { -23376435, 1410446, -22253753, -12899614, 30867635, 15826977, 17693930, 544696, -11985298, 12422646 },
+    { 31117226, -12215734, -13502838, 6561947, -9876867, -12757670, -5118685, -4096706, 29120153, 13924425 },
+    { -17400879, -14233209, 19675799, -2734756, -11006962, -5858820, -9383939, -11317700, 7240931, -237388 }
+  },
+  {
+    { -31361739, -11346780, -15007447, -5856218, -22453340, -12152771, 1222336, 4389483, 3293637, -15551743 },
+    { -16684801, -14444245, 11038544, 11054958, -13801175, -3338533, -24319580, 7733547, 12796905, -6335822 },
+    { -8759414, -10817836, -25418864, 10783769, -30615557, -9746811, -28253339, 3647836, 3222231, -11160462 }
+  },
+  {
+    { 18606113, 1693100, -25448386, -15170272, 4112353, 10045021, 23603893, -2048234, -7550776, 2484985 },
+    { 9255317, -3131197, -12156162, -1004256, 13098013, -9214866, 16377220, -2102812, -19802075, -3034702 },
+    { -22729289, 7496160, -5742199, 11329249, 19991973, -3347502, -31718148, 9936966, -30097688, -10618797 }
+  },
+  {
+    { 21878590, -5001297, 4338336, 13643897, -3036865, 13160960, 19708896, 5415497, -7360503, -4109293 },
+    { 27736861, 10103576, 12500508, 8502413, -3413016, -9633558, 10436918, -1550276, -23659143, -8132100 },
+    { 19492550, -12104365, -29681976, -852630, -3208171, 12403437, 30066266, 8367329, 13243957, 8709688 }
+  }
+},
+{ /* 10/31 */
+  {
+    { 12015105, 2801261, 28198131, 10151021, 24818120, -4743133, -11194191, -5645734, 5150968, 7274186 },
+    { 2831366, -12492146, 1478975, 6122054, 23825128, -12733586, 31097299, 6083058, 31021603, -9793610 },
+    { -2529932, -2229646, 445613, 10720828, -13849527, -11505937, -23507731, 16354465, 15067285, -14147707 }
+  },
+  {
+    { 7840942, 14037873, -33364863, 15934016, -728213, -3642706, 21403988, 1057586, -19379462, -12403220 },
+    { 915865, -16469274, 15608285, -8789130, -24357026, 6060030, -17371319, 8410997, -7220461, 16527025 },
+    { 32922597, -556987, 20336074, -16184568, 10903705, -5384487, 16957574, 52992, 23834301, 6588044 }
+  },
+  {
+    { 32752030, 11232950, 3381995, -8714866, 22652988, -10744103, 17159699, 16689107, -20314580, -1305992 },
+    { -4689649, 9166776, -25710296, -10847306, 11576752, 12733943, 7924251, -2752281, 1976123, -7249027 },
+    { 21251222, 16309901, -2983015, -6783122, 30810597, 12967303, 156041, -3371252, 12331345, -8237197 }
+  },
+  {
+    { 8651614, -4477032, -16085636, -4996994, 13002507, 2950805, 29054427, -5106970, 10008136, -4667901 },
+    { 31486080, 15114593, -14261250, 12951354, 14369431, -7387845, 16347321, -13662089, 8684155, -10532952 },
+    { 19443825, 11385320, 24468943, -9659068, -23919258, 2187569, -26263207, -6086921, 31316348, 14219878 }
+  },
+  {
+    { -28594490, 1193785, 32245219, 11392485, 31092169, 15722801, 27146014, 6992409, 29126555, 9207390 },
+    { 32382935, 1110093, 18477781, 11028262, -27411763, -7548111, -4980517, 10843782, -7957600, -14435730 },
+    { 2814918, 7836403, 27519878, -7868156, -20894015, -11553689, -21494559, 8550130, 28346258, 1994730 }
+  },
+  {
+    { -19578299, 8085545, -14000519, -3948622, 2785838, -16231307, -19516951, 7174894, 22628102, 8115180 },
+    { -30405132, 955511, -11133838, -15078069, -32447087, -13278079, -25651578, 3317160, -9943017, 930272 },
+    { -15303681, -6833769, 28856490, 1357446, 23421993, 1057177, 24091212, -1388970, -22765376, -10650715 }
+  },
+  {
+    { -22751231, -5303997, -12907607, -12768866, -15811511, -7797053, -14839018, -16554220, -1867018, 8398970 },
+    { -31969310, 2106403, -4736360, 1362501, 12813763, 16200670, 22981545, -6291273, 18009408, -15772772 },
+    { -17220923, -9545221, -27784654, 14166835, 29815394, 7444469, 29551787, -3727419, 19288549, 1325865 }
+  },
+  {
+    { 15100157, -15835752, -23923978, -1005098, -26450192, 15509408, 12376730, -3479146, 33166107, -8042750 },
+    { 20909231, 13023121, -9209752, 16251778, -5778415, -8094914, 12412151, 10018715, 2213263, -13878373 },
+    { 32529814, -11074689, 30361439, -16689753, -9135940, 1513226, 22922121, 6382134, -5766928, 8371348 }
+  }
+},
+{ /* 11/31 */
+  {
+    { 9923462, 11271500, 12616794, 3544722, -29998368, -1721626, 12891687, -8193132, -26442943, 10486144 },
+    { -22597207, -7012665, 8587003, -8257861, 4084309, -12970062, 361726, 2610596, -23921530, -11455195 },
+    { 5408411, -1136691, -4969122, 10561668, 24145918, 14240566, 31319731, -4235541, 19985175, -3436086 }
+  },
+  {
+    { -13994457, 16616821, 14549246, 3341099, 32155958, 13648976, -17577068, 8849297, 65030, 8370684 },
+    { -8320926, -12049626, 31204563, 5839400, -20627288, -1057277, -19442942, 6922164, 12743482, -9800518 },
+    { -2361371, 12678785, 28815050, 4759974, -23893047, 4884717, 23783145, 11038569, 18800704, 255233 }
+  },
+  {
+    { -5269658, -1773886, 13957886, 7990715, 23132995, 728773, 13393847, 9066957, 19258688, -14753793 },
+    { -2936654, -10827535, -10432089, 14516793, -3640786, 4372541, -31934921, 2209390, -1524053, 2055794 },
+    { 580882, 16705327, 5468415, -2683018, -30926419, -14696000, -7203346, -8994389, -30021019, 7394435 }
+  },
+  {
+    { 23838809, 1822728, -15738443, 15242727, 8318092, -3733104, -21672180, -3492205, -4821741, 14799921 },
+    { 13345610, 9759151, 3371034, -16137791, 16353039, 8577942, 31129804, 13496856, -9056018, 7402518 },
+    { 2286874, -4435931, -20042458, -2008336, -13696227, 5038122, 11006906, -15760352, 8205061, 1607563 }
+  },
+  {
+    { 14414086, -8002132, 3331830, -3208217, 22249151, -5594188, 18364661, -2906958, 30019587, -9029278 },
+    { -27688051, 1585953, -10775053, 931069, -29120221, -11002319, -14410829, 12029093, 9944378, 8024 },
+    { 4368715, -3709630, 29874200, -15022983, -20230386, -11410704, -16114594, -999085, -8142388, 5640030 }
+  },
+  {
+    { 10299610, 13746483, 11661824, 16234854, 7630238, 5998374, 9809887, -16694564, 15219798, -14327783 },
+    { 27425505, -5719081, 3055006, 10660664, 23458024, 595578, -15398605, -1173195, -18342183, 9742717 },
+    { 6744077, 2427284, 26042789, 2720740, -847906, 1118974, 32324614, 7406442, 12420155, 1994844 }
+  },
+  {
+    { 14012521, -5024720, -18384453, -9578469, -26485342, -3936439, -13033478, -10909803, 24319929, -6446333 },
+    { 16412690, -4507367, 10772641, 15929391, -17068788, -4658621, 10555945, -10484049, -30102368, -4739048 },
+    { 22397382, -7767684, -9293161, -12792868, 17166287, -9755136, -27333065, 6199366, 21880021, -12250760 }
+  },
+  {
+    { -4283307, 5368523, -31117018, 8163389, -30323063, 3209128, 16557151, 8890729, 8840445, 4957760 },
+    { -15447727, 709327, -6919446, -10870178, -29777922, 6522332, -21720181, 12130072, -14796503, 5005757 },
+    { -2114751, -14308128, 23019042, 15765735, -25269683, 6002752, 10183197, -13239326, -16395286, -2176112 }
+  }
+},
+{ /* 12/31 */
+  {
+    { -19025756, 1632005, 13466291, -7995100, -23640451, 16573537, -32013908, -3057104, 22208662, 2000468 },
+    { 3065073, -1412761, -25598674, -361432, -17683065, -5703415, -8164212, 11248527, -3691214, -7414184 },
+    { 10379208, -6045554, 8877319, 1473647, -29291284, -12507580, 16690915, 2553332, -3132688, 16400289 }
+  },
+  {
+    { 15716668, 1254266, -18472690, 7446274, -8448918, 6344164, -22097271, -7285580, 26894937, 9132066 },
+    { 24158887, 12938817, 11085297, -8177598, -28063478, -4457083, -30576463, 64452, -6817084, -2692882 },
+    { 13488534, 7794716, 22236231, 5989356, 25426474, -12578208, 2350710, -3418511, -4688006, 2364226 }
+  },
+  {
+    { 16335052, 9132434, 25640582, 6678888, 1725628, 8517937, -11807024, -11697457, 15445875, -7798101 },
+    { 29004207, -7867081, 28661402, -640412, -12794003, -7943086, 31863255, -4135540, -278050, -15759279 },
+    { -6122061, -14866665, -28614905, 14569919, -10857999, -3591829, 10343412, -6976290, -29828287, -10815811 }
+  },
+  {
+    { 27081650, 3463984, 14099042, -4517604, 1616303, -6205604, 29542636, 15372179, 17293797, 960709 },
+    { 20263915, 11434237, -5765435, 11236810, 13505955, -10857102, -16111345, 6493122, -19384511, 7639714 },
+    { -2830798, -14839232, 25403038, -8215196, -8317012, -16173699, 18006287, -16043750, 29994677, -15808121 }
+  },
+  {
+    { 9769828, 5202651, -24157398, -13631392, -28051003, -11561624, -24613141, -13860782, -31184575, 709464 },
+    { 12286395, 13076066, -21775189, -1176622, -25003198, 4057652, -32018128, -8890874, 16102007, 13205847 },
+    { 13733362, 5599946, 10557076, 3195751, -5557991, 8536970, -25540170, 8525972, 10151379, 10394400 }
+  },
+  {
+    { 4024660, -16137551, 22436262, 12276534, -9099015, -2686099, 19698229, 11743039, -33302334, 8934414 },
+    { -15879800, -4525240, -8580747, -2934061, 14634845, -698278, -9449077, 3137094, -11536886, 11721158 },
+    { 17555939, -5013938, 8268606, 2331751, -22738815, 9761013, 9319229, 8835153, -9205489, -1280045 }
+  },
+  {
+    { -461409, -7830014, 20614118, 16688288, -7514766, -4807119, 22300304, 505429, 6108462, -6183415 },
+    { -5070281, 12367917, -30663534, 3234473, 32617080, -8422642, 29880583, -13483331, -26898490, -7867459 },
+    { -31975283, 5726539, 26934134, 10237677, -3173717, -605053, 24199304, 3795095, 7592688, -14992079 }
+  },
+  {
+    { 21594432, -14964228, 17466408, -4077222, 32537084, 2739898, 6407723, 12018833, -28256052, 4298412 },
+    { -20650503, -11961496, -27236275, 570498, 3767144, -1717540, 13891942, -1569194, 13717174, 10805743 },
+    { -14676630, -15644296, 15287174, 11927123, 24177847, -8175568, -796431, 14860609, -26938930, -5863836 }
+  }
+},
+{ /* 13/31 */
+  {
+    { 12962541, 5311799, -10060768, 11658280, 18855286, -7954201, 13286263, -12808704, -4381056, 9882022 },
+    { 18512079, 11319350, -20123124, 15090309, 18818594, 5271736, -22727904, 3666879, -23967430, -3299429 },
+    { -6789020, -3146043, 16192429, 13241070, 15898607, -14206114, -10084880, -6661110, -2403099, 5276065 }
+  },
+  {
+    { 30169808, -5317648, 26306206, -11750859, 27814964, 7069267, 7152851, 3684982, 1449224, 13082861 },
+    { 10342826, 3098505, 2119311, 193222, 25702612, 12233820, 23697382, 15056736, -21016438, -8202000 },
+    { -33150110, 3261608, 22745853, 7948688, 19370557, -15177665, -26171976, 6482814, -10300080, -11060101 }
+  },
+  {
+    { 32869458, -5408545, 25609743, 15678670, -10687769, -15471071, 26112421, 2521008, -22664288, 6904815 },
+    { 29506923, 4457497, 3377935, -9796444, -30510046, 12935080, 1561737, 3841096, -29003639, -6657642 },
+    { 10340844, -6630377, -18656632, -2278430, 12621151, -13339055, 30878497, -11824370, -25584551, 5181966 }
+  },
+  {
+    { 25940115, -12658025, 17324188, -10307374, -8671468, 15029094, 24396252, -16450922, -2322852, -12388574 },
+    { -21765684, 9916823, -1300409, 4079498, -1028346, 11909559, 1782390, 12641087, 20603771, -6561742 },
+    { -18882287, -11673380, 24849422, 11501709, 13161720, -4768874, 1925523, 11914390, 4662781, 7820689 }
+  },
+  {
+    { 12241050, -425982, 8132691, 9393934, 32846760, -1599620, 29749456, 12172924, 16136752, 15264020 },
+    { -10349955, -14680563, -8211979, 2330220, -17662549, -14545780, 10658213, 6671822, 19012087, 3772772 },
+    { 3753511, -3421066, 10617074, 2028709, 14841030, -6721664, 28718732, -15762884, 20527771, 12988982 }
+  },
+  {
+    { -14822485, -5797269, -3707987, 12689773, -898983, -10914866, -24183046, -10564943, 3299665, -12424953 },
+    { -16777703, -15253301, -9642417, 4978983, 3308785, 8755439, 6943197, 6461331, -25583147, 8991218 },
+    { -17226263, 1816362, -1673288, -6086439, 31783888, -8175991, -32948145, 7417950, -30242287, 1507265 }
+  },
+  {
+    { 29692663, 6829891, -10498800, 4334896, 20945975, -11906496, -28887608, 8209391, 14606362, -10647073 },
+    { -3481570, 8707081, 32188102, 5672294, 22096700, 1711240, -33020695, 9761487, 4170404, -2085325 },
+    { -11587470, 14855945, -4127778, -1531857, -26649089, 15084046, 22186522, 16002000, -14276837, -8400798 }
+  },
+  {
+    { -4811456, 13761029, -31703877, -2483919, -3312471, 7869047, -7113572, -9620092, 13240845, 10965870 },
+    { -7742563, -8256762, -14768334, -13656260, -23232383, 12387166, 4498947, 14147411, 29514390, 4302863 },
+    { -13413405, -12407859, 20757302, -13801832, 14785143, 8976368, -5061276, -2144373, 17846988, -13971927 }
+  }
+},
+{ /* 14/31 */
+  {
+    { -2244452, -754728, -4597030, -1066309, -6247172, 1455299, -21647728, -9214789, -5222701, 12650267 },
+    { -9906797, -16070310, 21134160, 12198166, -27064575, 708126, 387813, 13770293, -19134326, 10958663 },
+    { 22470984, 12369526, 23446014, -5441109, -21520802, -9698723, -11772496, -11574455, -25083830, 4271862 }
+  },
+  {
+    { -25169565, -10053642, -19909332, 15361595, -5984358, 2159192, 75375, -4278529, -32526221, 8469673 },
+    { 15854970, 4148314, -8893890, 7259002, 11666551, 13824734, -30531198, 2697372, 24154791, -9460943 },
+    { 15446137, -15806644, 29759747, 14019369, 30811221, -9610191, -31582008, 12840104, 24913809, 9815020 }
+  },
+  {
+    { -4709286, -5614269, -31841498, -12288893, -14443537, 10799414, -9103676, 13438769, 18735128, 9466238 },
+    { 11933045, 9281483, 5081055, -5183824, -2628162, -4905629, -7727821, -10896103, -22728655, 16199064 },
+    { 14576810, 379472, -26786533, -8317236, -29426508, -10812974, -102766, 1876699, 30801119, 2164795 }
+  },
+  {
+    { 15995086, 3199873, 13672555, 13712240, -19378835, -4647646, -13081610, -15496269, -13492807, 1268052 },
+    { -10290614, -3659039, -3286592, 10948818, 23037027, 3794475, -3470338, -12600221, -17055369, 3565904 },
+    { 29210088, -9419337, -5919792, -4952785, 10834811, -13327726, -16512102, -10820713, -27162222, -14030531 }
+  },
+  {
+    { -13161890, 15508588, 16663704, -8156150, -28349942, 9019123, -29183421, -3769423, 2244111, -14001979 },
+    { -5152875, -3800936, -9306475, -6071583, 16243069, 14684434, -25673088, -16180800, 13491506, 4641841 },
+    { 10813417, 643330, -19188515, -728916, 30292062, -16600078, 27548447, -7721242, 14476989, -12767431 }
+  },
+  {
+    { 10292079, 9984945, 6481436, 8279905, -7251514, 7032743, 27282937, -1644259, -27912810, 12651324 },
+    { -31185513, -813383, 22271204, 11835308, 10201545, 15351028, 17099662, 3988035, 21721536, -3148940 },
+    { 10202177, -6545839, -31373232, -9574638, -32150642, -8119683, -12906320, 3852694, 13216206, 14842320 }
+  },
+  {
+    { -15815640, -10601066, -6538952, -7258995, -6984659, -6581778, -31500847, 13765824, -27434397, 9900184 },
+    { 14465505, -13833331, -32133984, -14738873, -27443187, 12990492, 33046193, 15796406, -7051866, -8040114 },
+    { 30924417, -8279620, 6359016, -12816335, 16508377, 9071735, -25488601, 15413635, 9524356, -7018878 }
+  },
+  {
+    { 12274201, -13175547, 32627641, -1785326, 6736625, 13267305, 5237659, -5109483, 15663516, 4035784 },
+    { -2951309, 8903985, 17349946, 601635, -16432815, -4612556, -13732739, -15889334, -22258478, 4659091 },
+    { -16916263, -4952973, -30393711, -15158821, 20774812, 15897498, 5736189, 15026997, -2178256, -13455585 }
+  }
+},
+{ /* 15/31 */
+  {
+    { -8858980, -2219056, 28571666, -10155518, -474467, -10105698, -3801496, 278095, 23440562, -290208 },
+    { 10226241, -5928702, 15139956, 120818, -14867693, 5218603, 32937275, 11551483, -16571960, -7442864 },
+    { 17932739, -12437276, -24039557, 10749060, 11316803, 7535897, 22503767, 5561594, -3646624, 3898661 }
+  },
+  {
+    { 7749907, -969567, -16339731, -16464, -25018111, 15122143, -1573531, 7152530, 21831162, 1245233 },
+    { 26958459, -14658026, 4314586, 8346991, -5677764, 11960072, -32589295, -620035, -30402091, -16716212 },
+    { -12165896, 9166947, 33491384, 13673479, 29787085, 13096535, 6280834, 14587357, -22338025, 13987525 }
+  },
+  {
+    { -24349909, 7778775, 21116000, 15572597, -4833266, -5357778, -4300898, -5124639, -7469781, -2858068 },
+    { 9681908, -6737123, -31951644, 13591838, -6883821, 386950, 31622781, 6439245, -14581012, 4091397 },
+    { -8426427, 1470727, -28109679, -1596990, 3978627, -5123623, -19622683, 12092163, 29077877, -14741988 }
+  },
+  {
+    { 5269168, -6859726, -13230211, -8020715, 25932563, 1763552, -5606110, -5505881, -20017847, 2357889 },
+    { 32264008, -15407652, -5387735, -1160093, -2091322, -3946900, 23104804, -12869908, 5727338, 189038 },
+    { 14609123, -8954470, -6000566, -16622781, -14577387, -7743898, -26745169, 10942115, -25888931, -14884697 }
+  },
+  {
+    { 20513500, 5557931, -15604613, 7829531, 26413943, -2019404, -21378968, 7471781, 13913677, -5137875 },
+    { -25574376, 11967826, 29233242, 12948236, -6754465, 4713227, -8940970, 14059180, 12878652, 8511905 },
+    { -25656801, 3393631, -2955415, -7075526, -2250709, 9366908, -30223418, 6812974, 5568676, -3127656 }
+  },
+  {
+    { 11630004, 12144454, 2116339, 13606037, 27378885, 15676917, -17408753, -13504373, -14395196, 8070818 },
+    { 27117696, -10007378, -31282771, -5570088, 1127282, 12772488, -29845906, 10483306, -11552749, -1028714 },
+    { 10637467, -5688064, 5674781, 1072708, -26343588, -6982302, -1683975, 9177853, -27493162, 15431203 }
+  },
+  {
+    { 20525145, 10892566, -12742472, 12779443, -29493034, 16150075, -28240519, 14943142, -15056790, -7935931 },
+    { -30024462, 5626926, -551567, -9981087, 753598, 11981191, 25244767, -3239766, -3356550, 9594024 },
+    { -23752644, 2636870, -5163910, -10103818, 585134, 7877383, 11345683, -6492290, 13352335, -10977084 }
+  },
+  {
+    { -1931799, -5407458, 3304649, -12884869, 17015806, -4877091, -29783850, -7752482, -13215537, -319204 },
+    { 20239939, 6607058, 6203985, 3483793, -18386976, -779229, -20723742, 15077870, -22750759, 14523817 },
+    { 27406042, -6041657, 27423596, -4497394, 4996214, 10002360, -28842031, -4545494, -30172742, -4805667 }
+  }
+},
+{ /* 16/31 */
+  {
+    { 11374242, 12660715, 17861383, -12540833, 10935568, 1099227, -13886076, -9091740, -27727044, 11358504 },
+    { -12730809, 10311867, 1510375, 10778093, -2119455, -9145702, 32676003, 11149336, -26123651, 4985768 },
+    { -19096303, 341147, -6197485, -239033, 15756973, -8796662, -983043, 13794114, -19414307, -15621255 }
+  },
+  {
+    { 6490081, 11940286, 25495923, -7726360, 8668373, -8751316, 3367603, 6970005, -1691065, -9004790 },
+    { 1656497, 13457317, 15370807, 6364910, 13605745, 8362338, -19174622, -5475723, -16796596, -5031438 },
+    { -22273315, -13524424, -64685, -4334223, -18605636, -10921968, -20571065, -7007978, -99853, -10237333 }
+  },
+  {
+    { 17747465, 10039260, 19368299, -4050591, -20630635, -16041286, 31992683, -15857976, -29260363, -5511971 },
+    { 31932027, -4986141, -19612382, 16366580, 22023614, 88450, 11371999, -3744247, 4882242, -10626905 },
+    { 29796507, 37186, 19818052, 10115756, -11829032, 3352736, 18551198, 3272828, -5190932, -4162409 }
+  },
+  {
+    { 12501286, 4044383, -8612957, -13392385, -32430052, 5136599, -19230378, -3529697, 330070, -3659409 },
+    { 6384877, 2899513, 17807477, 7663917, -2358888, 12363165, 25366522, -8573892, -271295, 12071499 },
+    { -8365515, -4042521, 25133448, -4517355, -6211027, 2265927, -32769618, 1936675, -5159697, 3829363 }
+  },
+  {
+    { 28425966, -5835433, -577090, -4697198, -14217555, 6870930, 7921550, -6567787, 26333140, 14267664 },
+    { -11067219, 11871231, 27385719, -10559544, -4585914, -11189312, 10004786, -8709488, -21761224, 8930324 },
+    { -21197785, -16396035, 25654216, -1725397, 12282012, 11008919, 1541940, 4757911, -26491501, -16408940 }
+  },
+  {
+    { 13537262, -7759490, -20604840, 10961927, -5922820, -13218065, -13156584, 6217254, -15943699, 13814990 },
+    { -17422573, 15157790, 18705543, 29619, 24409717, -260476, 27361681, 9257833, -1956526, -1776914 },
+    { -25045300, -10191966, 15366585, 15166509, -13105086, 8423556, -29171540, 12361135, -18685978, 4578290 }
+  },
+  {
+    { 24579768, 3711570, 1342322, -11180126, -27005135, 14124956, -22544529, 14074919, 21964432, 8235257 },
+    { -6528613, -2411497, 9442966, -5925588, 12025640, -1487420, -2981514, -1669206, 13006806, 2355433 },
+    { -16304899, -13605259, -6632427, -5142349, 16974359, -10911083, 27202044, 1719366, 1141648, -12796236 }
+  },
+  {
+    { -12863944, -13219986, -8318266, -11018091, -6810145, -4843894, 13475066, -3133972, 32674895, 13715045 },
+    { 11423335, -5468059, 32344216, 8962751, 24989809, 9241752, -13265253, 16086212, -28740881, -15642093 },
+    { -1409668, 12530728, -6368726, 10847387, 19531186, -14132160, -11709148, 7791794, -27245943, 4383347 }
+  }
+},
+{ /* 17/31 */
+  {
+    { -28970898, 5271447, -1266009, -9736989, -12455236, 16732599, -4862407, -4906449, 27193557, 6245191 },
+    { -15193956, 5362278, -1783893, 2695834, 4960227, 12840725, 23061898, 3260492, 22510453, 8577507 },
+    { -12632451, 11257346, -32692994, 13548177, -721004, 10879011, 31168030, 13952092, -29571492, -3635906 }
+  },
+  {
+    { 3877321, -9572739, 32416692, 5405324, -11004407, -13656635, 3759769, 11935320, 5611860, 8164018 },
+    { -16275802, 14667797, 15906460, 12155291, -22111149, -9039718, 32003002, -8832289, 5773085, -8422109 },
+    { -23788118, -8254300, 1950875, 8937633, 18686727, 16459170, -905725, 12376320, 31632953, 190926 }
+  },
+  {
+    { -24593607, -16138885, -8423991, 13378746, 14162407, 6901328, -8288749, 4508564, -25341555, -3627528 },
+    { 8884438, -5884009, 6023974, 10104341, -6881569, -4941533, 18722941, -14786005, -1672488, 827625 },
+    { -32720583, -16289296, -32503547, 7101210, 13354605, 2659080, -1800575, -14108036, -24878478, 1541286 }
+  },
+  {
+    { 2901347, -1117687, 3880376, -10059388, -17620940, -3612781, -21802117, -3567481, 20456845, -1885033 },
+    { 27019610, 12299467, -13658288, -1603234, -12861660, -4861471, -19540150, -5016058, 29439641, 15138866 },
+    { 21536104, -6626420, -32447818, -10690208, -22408077, 5175814, -5420040, -16361163, 7779328, 109896 }
+  },
+  {
+    { 30279744, 14648750, -8044871, 6425558, 13639621, -743509, 28698390, 12180118, 23177719, -554075 },
+    { 26572847, 3405927, -31701700, 12890905, -19265668, 5335866, -6493768, 2378492, 4439158, -13279347 },
+    { -22716706, 3489070, -9225266, -332753, 18875722, -1140095, 14819434, -12731527, -17717757, -5461437 }
+  },
+  {
+    { -5056483, 16566551, 15953661, 3767752, -10436499, 15627060, -820954, 2177225, 8550082, -15114165 },
+    { -18473302, 16596775, -381660, 15663611, 22860960, 15585581, -27844109, -3582739, -23260460, -8428588 },
+    { -32480551, 15707275, -8205912, -5652081, 29464558, 2713815, -22725137, 15860482, -21902570, 1494193 }
+  },
+  {
+    { -19562091, -14087393, -25583872, -9299552, 13127842, 759709, 21923482, 16529112, 8742704, 12967017 },
+    { -28464899, 1553205, 32536856, -10473729, -24691605, -406174, -8914625, -2933896, -29903758, 15553883 },
+    { 21877909, 3230008, 9881174, 10539357, -4797115, 2841332, 11543572, 14513274, 19375923, -12647961 }
+  },
+  {
+    { 8832269, -14495485, 13253511, 5137575, 5037871, 4078777, 24880818, -6222716, 2862653, 9455043 },
+    { 29306751, 5123106, 20245049, -14149889, 9592566, 8447059, -2077124, -2990080, 15511449, 4789663 },
+    { -20679756, 7004547, 8824831, -9434977, -4045704, -3750736, -5754762, 108893, 23513200, 16652362 }
+  }
+},
+{ /* 18/31 */
+  {
+    { -33256173, 4144782, -4476029, -6579123, 10770039, -7155542, -6650416, -12936300, -18319198, 10212860 },
+    { 2756081, 8598110, 7383731, -6859892, 22312759, -1105012, 21179801, 2600940, -9988298, -12506466 },
+    { -24645692, 13317462, -30449259, -15653928, 21365574, -10869657, 11344424, 864440, -2499677, -16710063 }
+  },
+  {
+    { -26432803, 6148329, -17184412, -14474154, 18782929, -275997, -22561534, 211300, 2719757, 4940997 },
+    { -1323882, 3911313, -6948744, 14759765, -30027150, 7851207, 21690126, 8518463, 26699843, 5276295 },
+    { -13149873, -6429067, 9396249, 365013, 24703301, -10488939, 1321586, 149635, -15452774, 7159369 }
+  },
+  {
+    { 9987780, -3404759, 17507962, 9505530, 9731535, -2165514, 22356009, 8312176, 22477218, -8403385 },
+    { 18155857, -16504990, 19744716, 9006923, 15154154, -10538976, 24256460, -4864995, -22548173, 9334109 },
+    { 2986088, -4911893, 10776628, -3473844, 10620590, -7083203, -21413845, 14253545, -22587149, 536906 }
+  },
+  {
+    { 4377756, 8115836, 24567078, 15495314, 11625074, 13064599, 7390551, 10589625, 10838060, -15420424 },
+    { -19342404, 867880, 9277171, -3218459, -14431572, -1986443, 19295826, -15796950, 6378260, 699185 },
+    { 7895026, 4057113, -7081772, -13077756, -17886831, -323126, -716039, 15693155, -5045064, -13373962 }
+  },
+  {
+    { -7737563, -5869402, -14566319, -7406919, 11385654, 13201616, 31730678, -10962840, -3918636, -9669325 },
+    { 10188286, -15770834, -7336361, 13427543, 22223443, 14896287, 30743455, 7116568, -21786507, 5427593 },
+    { 696102, 13206899, 27047647, -10632082, 15285305, -9853179, 10798490, -4578720, 19236243, 12477404 }
+  },
+  {
+    { -11229439, 11243796, -17054270, -8040865, -788228, -8167967, -3897669, 11180504, -23169516, 7733644 },
+    { 17800790, -14036179, -27000429, -11766671, 23887827, 3149671, 23466177, -10538171, 10322027, 15313801 },
+    { 26246234, 11968874, 32263343, -5468728, 6830755, -13323031, -15794704, -101982, -24449242, 10890804 }
+  },
+  {
+    { -31365647, 10271363, -12660625, -6267268, 16690207, -13062544, -14982212, 16484931, 25180797, -5334884 },
+    { -586574, 10376444, -32586414, -11286356, 19801893, 10997610, 2276632, 9482883, 316878, 13820577 },
+    { -9882808, -4510367, -2115506, 16457136, -11100081, 11674996, 30756178, -7515054, 30696930, -3712849 }
+  },
+  {
+    { 32988917, -9603412, 12499366, 7910787, -10617257, -11931514, -7342816, -9985397, -32349517, 7392473 },
+    { -8855661, 15927861, 9866406, -3649411, -2396914, -16655781, -30409476, -9134995, 25112947, -2926644 },
+    { -2504044, -436966, 25621774, -5678772, 15085042, -5479877, -24884878, -13526194, 5537438, -13914319 }
+  }
+},
+{ /* 19/31 */
+  {
+    { -11225584, 2320285, -9584280, 10149187, -33444663, 5808648, -14876251, -1729667, 31234590, 6090599 },
+    { -9633316, 116426, 26083934, 2897444, -6364437, -2688086, 609721, 15878753, -6970405, -9034768 },
+    { -27757857, 247744, -15194774, -9002551, 23288161, -10011936, -23869595, 6503646, 20650474, 1804084 }
+  },
+  {
+    { -27589786, 15456424, 8972517, 8469608, 15640622, 4439847, 3121995, -10329713, 27842616, -202328 },
+    { -15306973, 2839644, 22530074, 10026331, 4602058, 5048462, 28248656, 5031932, -11375082, 12714369 },
+    { 20807691, -7270825, 29286141, 11421711, -27876523, -13868230, -21227475, 1035546, -19733229, 12796920 }
+  },
+  {
+    { 12076899, -14301286, -8785001, -11848922, -25012791, 16400684, -17591495, -12899438, 3480665, -15182815 },
+    { -32361549, 5457597, 28548107, 7833186, 7303070, -11953545, -24363064, -15921875, -33374054, 2771025 },
+    { -21389266, 421932, 26597266, 6860826, 22486084, -6737172, -17137485, -4210226, -24552282, 15673397 }
+  },
+  {
+    { -20184622, 2338216, 19788685, -9620956, -4001265, -8740893, -20271184, 4733254, 3727144, -12934448 },
+    { 6120119, 814863, -11794402, -622716, 6812205, -15747771, 2019594, 7975683, 31123697, -10958981 },
+    { 30069250, -11435332, 30434654, 2958439, 18399564, -976289, 12296869, 9204260, -16432438, 9648165 }
+  },
+  {
+    { 32705432, -1550977, 30705658, 7451065, -11805606, 9631813, 3305266, 5248604, -26008332, -11377501 },
+    { 17219865, 2375039, -31570947, -5575615, -19459679, 9219903, 294711, 15298639, 2662509, -16297073 },
+    { -1172927, -7558695, -4366770, -4287744, -21346413, -8434326, 32087529, -1222777, 32247248, -14389861 }
+  },
+  {
+    { 14312628, 1221556, 17395390, -8700143, -4945741, -8684635, -28197744, -9637817, -16027623, -13378845 },
+    { -1428825, -9678990, -9235681, 6549687, -7383069, -468664, 23046502, 9803137, 17597934, 2346211 },
+    { 18510800, 15337574, 26171504, 981392, -22241552, 7827556, -23491134, -11323352, 3059833, -11782870 }
+  },
+  {
+    { 10141598, 6082907, 17829293, -1947643, 9830092, 13613136, -25556636, -5544586, -33502212, 3592096 },
+    { 33114168, -15889352, -26525686, -13343397, 33076705, 8716171, 1151462, 1521897, -982665, -6837803 },
+    { -32939165, -4255815, 23947181, -324178, -33072974, -12305637, -16637686, 3891704, 26353178, 693168 }
+  },
+  {
+    { 30374239, 1595580, -16884039, 13186931, 4600344, 406904, 9585294, -400668, 31375464, 14369965 },
+    { -14370654, -7772529, 1510301, 6434173, -18784789, -6262728, 32732230, -13108839, 17901441, 16011505 },
+    { 18171223, -11934626, -12500402, 15197122, -11038147, -15230035, -19172240, -16046376, 8764035, 12309598 }
+  }
+},
+{ /* 20/31 */
+  {
+    { 5975908, -5243188, -19459362, -9681747, -11541277, 14015782, -23665757, 1228319, 17544096, -10593782 },
+    { 5811932, -1715293, 3442887, -2269310, -18367348, -8359541, -18044043, -15410127, -5565381, 12348900 },
+    { -31399660, 11407555, 25755363, 6891399, -3256938, 14872274, -24849353, 8141295, -10632534, -585479 }
+  },
+  {
+    { -12675304, 694026, -5076145, 13300344, 14015258, -14451394, -9698672, -11329050, 30944593, 1130208 },
+    { 8247766, -6710942, -26562381, -7709309, -14401939, -14648910, 4652152, 2488540, 23550156, -271232 },
+    { 17294316, -3788438, 7026748, 15626851, 22990044, 113481, 2267737, -5908146, -408818, -137719 }
+  },
+  {
+    { 16091085, -16253926, 18599252, 7340678, 2137637, -1221657, -3364161, 14550936, 3260525, -7166271 },
+    { -4910104, -13332887, 18550887, 10864893, -16459325, -7291596, -23028869, -13204905, -12748722, 2701326 },
+    { -8574695, 16099415, 4629974, -16340524, -20786213, -6005432, -10018363, 9276971, 11329923, 1862132 }
+  },
+  {
+    { 14763076, -15903608, -30918270, 3689867, 3511892, 10313526, -21951088, 12219231, -9037963, -940300 },
+    { 8894987, -3446094, 6150753, 3013931, 301220, 15693451, -31981216, -2909717, -15438168, 11595570 },
+    { 15214962, 3537601, -26238722, -14058872, 4418657, -15230761, 13947276, 10730794, -13489462, -4363670 }
+  },
+  {
+    { -2538306, 7682793, 32759013, 263109, -29984731, -7955452, -22332124, -10188635, 977108, 699994 },
+    { -12466472, 4195084, -9211532, 550904, -15565337, 12917920, 19118110, -439841, -30534533, -14337913 },
+    { 31788461, -14507657, 4799989, 7372237, 8808585, -14747943, 9408237, -10051775, 12493932, -5409317 }
+  },
+  {
+    { -25680606, 5260744, -19235809, -6284470, -3695942, 16566087, 27218280, 2607121, 29375955, 6024730 },
+    { 842132, -2794693, -4763381, -8722815, 26332018, -12405641, 11831880, 6985184, -9940361, 2854096 },
+    { -4847262, -7969331, 2516242, -5847713, 9695691, -7221186, 16512645, 960770, 12121869, 16648078 }
+  },
+  {
+    { -15218652, 14667096, -13336229, 2013717, 30598287, -464137, -31504922, -7882064, 20237806, 2838411 },
+    { -19288047, 4453152, 15298546, -16178388, 22115043, -15972604, 12544294, -13470457, 1068881, -12499905 },
+    { -9558883, -16518835, 33238498, 13506958, 30505848, -1114596, -8486907, -2630053, 12521378, 4845654 }
+  },
+  {
+    { -28198521, 10744108, -2958380, 10199664, 7759311, -13088600, 3409348, -873400, -6482306, -12885870 },
+    { -23561822, 6230156, -20382013, 10655314, -24040585, -11621172, 10477734, -1240216, -3113227, 13974498 },
+    { 12966261, 15550616, -32038948, -1615346, 21025980, -629444, 5642325, 7188737, 18895762, 12629579 }
+  }
+},
+{ /* 21/31 */
+  {
+    { 14741879, -14946887, 22177208, -11721237, 1279741, 8058600, 11758140, 789443, 32195181, 3895677 },
+    { 10758205, 15755439, -4509950, 9243698, -4879422, 6879879, -2204575, -3566119, -8982069, 4429647 },
+    { -2453894, 15725973, -20436342, -10410672, -5803908, -11040220, -7135870, -11642895, 18047436, -15281743 }
+  },
+  {
+    { -25173001, -11307165, 29759956, 11776784, -22262383, -15820455, 10993114, -12850837, -17620701, -9408468 },
+    { 21987233, 700364, -24505048, 14972008, -7774265, -5718395, 32155026, 2581431, -29958985, 8773375 },
+    { -25568350, 454463, -13211935, 16126715, 25240068, 8594567, 20656846, 12017935, -7874389, -13920155 }
+  },
+  {
+    { 6028182, 6263078, -31011806, -11301710, -818919, 2461772, -31841174, -5468042, -1721788, -2776725 },
+    { -12278994, 16624277, 987579, -5922598, 32908203, 1248608, 7719845, -4166698, 28408820, 6816612 },
+    { -10358094, -8237829, 19549651, -12169222, 22082623, 16147817, 20613181, 13982702, -10339570, 5067943 }
+  },
+  {
+    { -30505967, -3821767, 12074681, 13582412, -19877972, 2443951, -19719286, 12746132, 5331210, -10105944 },
+    { 30528811, 3601899, -1957090, 4619785, -27361822, -15436388, 24180793, -12570394, 27679908, -1648928 },
+    { 9402404, -13957065, 32834043, 10838634, -26580150, -13237195, 26653274, -8685565, 22611444, -12715406 }
+  },
+  {
+    { 22190590, 1118029, 22736441, 15130463, -30460692, -5991321, 19189625, -4648942, 4854859, 6622139 },
+    { -8310738, -2953450, -8262579, -3388049, -10401731, -271929, 13424426, -3567227, 26404409, 13001963 },
+    { -31241838, -15415700, -2994250, 8939346, 11562230, -12840670, -26064365, -11621720, -15405155, 11020693 }
+  },
+  {
+    { 1866042, -7949489, -7898649, -10301010, 12483315, 13477547, 3175636, -12424163, 28761762, 1406734 },
+    { -448555, -1777666, 13018551, 3194501, -9580420, -11161737, 24760585, -4347088, 25577411, -13378680 },
+    { -24290378, 4759345, -690653, -1852816, 2066747, 10693769, -29595790, 9884936, -9368926, 4745410 }
+  },
+  {
+    { -9141284, 6049714, -19531061, -4341411, -31260798, 9944276, -15462008, -11311852, 10931924, -11931931 },
+    { -16561513, 14112680, -8012645, 4817318, -8040464, -11414606, -22853429, 10856641, -20470770, 13434654 },
+    { 22759489, -10073434, -16766264, -1871422, 13637442, -10168091, 1765144, -12654326, 28445307, -5364710 }
+  },
+  {
+    { 29875063, 12493613, 2795536, -3786330, 1710620, 15181182, -10195717, -8788675, 9074234, 1167180 },
+    { -26205683, 11014233, -9842651, -2635485, -26908120, 7532294, -18716888, -9535498, 3843903, 9367684 },
+    { -10969595, -6403711, 9591134, 9582310, 11349256, 108879, 16235123, 8601684, -139197, 4242895 }
+  }
+},
+{ /* 22/31 */
+  {
+    { 22092954, -13191123, -2042793, -11968512, 32186753, -11517388, -6574341, 2470660, -27417366, 16625501 },
+    { -11057722, 3042016, 13770083, -9257922, 584236, -544855, -7770857, 2602725, -27351616, 14247413 },
+    { 6314175, -10264892, -32772502, 15957557, -10157730, 168750, -8618807, 14290061, 27108877, -1180880 }
+  },
+  {
+    { -8586597, -7170966, 13241782, 10960156, -32991015, -13794596, 33547976, -11058889, -27148451, 981874 },
+    { 22833440, 9293594, -32649448, -13618667, -9136966, 14756819, -22928859, -13970780, -10479804, -16197962 },
+    { -7768587, 3326786, -28111797, 10783824, 19178761, 14905060, 22680049, 13906969, -15933690, 3797899 }
+  },
+  {
+    { 21721356, -4212746, -12206123, 9310182, -3882239, -13653110, 23740224, -2709232, 20491983, -8042152 },
+    { 9209270, -15135055, -13256557, -6167798, -731016, 15289673, 25947805, 15286587, 30997318, -6703063 },
+    { 7392032, 16618386, 23946583, -8039892, -13265164, -1533858, -14197445, -2321576, 17649998, -250080 }
+  },
+  {
+    { -9301088, -14193827, 30609526, -3049543, -25175069, -1283752, -15241566, -9525724, -2233253, 7662146 },
+    { -17558673, 1763594, -33114336, 15908610, -30040870, -12174295, 7335080, -8472199, -3174674, 3440183 },
+    { -19889700, -5977008, -24111293, -9688870, 10799743, -16571957, 40450, -4431835, 4862400, 1133 }
+  },
+  {
+    { -32856209, -7873957, -5422389, 14860950, -16319031, 7956142, 7258061, 311861, -30594991, -7379421 },
+    { -3773428, -1565936, 28985340, 7499440, 24445838, 9325937, 29727763, 16527196, 18278453, 15405622 },
+    { -4381906, 8508652, -19898366, -3674424, -5984453, 15149970, -13313598, 843523, -21875062, 13626197 }
+  },
+  {
+    { 2281448, -13487055, -10915418, -2609910, 1879358, 16164207, -10783882, 3953792, 13340839, 15928663 },
+    { 31727126, -7179855, -18437503, -8283652, 2875793, -16390330, -25269894, -7014826, -23452306, 5964753 },
+    { 4100420, -5959452, -17179337, 6017714, -18705837, 12227141, -26684835, 11344144, 2538215, -7570755 }
+  },
+  {
+    { -9433605, 6123113, 11159803, -2156608, 30016280, 14966241, -20474983, 1485421, -629256, -15958862 },
+    { -26804558, 4260919, 11851389, 9658551, -32017107, 16367492, -20205425, -13191288, 11659922, -11115118 },
+    { 26180396, 10015009, -30844224, -8581293, 5418197, 9480663, 2231568, -10170080, 33100372, -1306171 }
+  },
+  {
+    { 15121113, -5201871, -10389905, 15427821, -27509937, -15992507, 21670947, 4486675, -5931810, -14466380 },
+    { 16166486, -9483733, -11104130, 6023908, -31926798, -1364923, 2340060, -16254968, -10735770, -10039824 },
+    { 28042865, -3557089, -12126526, 12259706, -3717498, -6945899, 6766453, -8689599, 18036436, 5803270 }
+  }
+},
+{ /* 23/31 */
+  {
+    { -817581, 6763912, 11803561, 1585585, 10958447, -2671165, 23855391, 4598332, -6159431, -14117438 },
+    { -31031306, -14256194, 17332029, -2383520, 31312682, -5967183, 696309, 50292, -20095739, 11763584 },
+    { -594563, -2514283, -32234153, 12643980, 12650761, 14811489, 665117, -12613632, -19773211, -10713562 }
+  },
+  {
+    { 30464590, -11262872, -4127476, -12734478, 19835327, -7105613, -24396175, 2075773, -17020157, 992471 },
+    { 18357185, -6994433, 7766382, 16342475, -29324918, 411174, 14578841, 8080033, -11574335, -10601610 },
+    { 19598397, 10334610, 12555054, 2555664, 18821899, -10339780, 21873263, 16014234, 26224780, 16452269 }
+  },
+  {
+    { -30223925, 5145196, 5944548, 16385966, 3976735, 2009897, -11377804, -7618186, -20533829, 3698650 },
+    { 14187449, 3448569, -10636236, -10810935, -22663880, -3433596, 7268410, -10890444, 27394301, 12015369 },
+    { 19695761, 16087646, 28032085, 12999827, 6817792, 11427614, 20244189, -1312777, -13259127, -3402461 }
+  },
+  {
+    { 30860103, 12735208, -1888245, -4699734, -16974906, 2256940, -8166013, 12298312, -8550524, -10393462 },
+    { -5719826, -11245325, -1910649, 15569035, 26642876, -7587760, -5789354, -15118654, -4976164, 12651793 },
+    { -2848395, 9953421, 11531313, -5282879, 26895123, -12697089, -13118820, -16517902, 9768698, -2533218 }
+  },
+  {
+    { -24719459, 1894651, -287698, -4704085, 15348719, -8156530, 32767513, 12765450, 4940095, 10678226 },
+    { 18860224, 15980149, -18987240, -1562570, -26233012, -11071856, -7843882, 13944024, -24372348, 16582019 },
+    { -15504260, 4970268, -29893044, 4175593, -20993212, -2199756, -11704054, 15444560, -11003761, 7989037 }
+  },
+  {
+    { 31490452, 5568061, -2412803, 2182383, -32336847, 4531686, -32078269, 6200206, -19686113, -14800171 },
+    { -17308668, -15879940, -31522777, -2831, -32887382, 16375549, 8680158, -16371713, 28550068, -6857132 },
+    { -28126887, -5688091, 16837845, -1820458, -6850681, 12700016, -30039981, 4364038, 1155602, 5988841 }
+  },
+  {
+    { 21890435, -13272907, -12624011, 12154349, -7831873, 15300496, 23148983, -4470481, 24618407, 8283181 },
+    { -33136107, -10512751, 9975416, 6841041, -31559793, 16356536, 3070187, -7025928, 1466169, 10740210 },
+    { -1509399, -15488185, -13503385, -10655916, 32799044, 909394, -13938903, -5779719, -32164649, -15327040 }
+  },
+  {
+    { 3960823, -14267803, -28026090, -15918051, -19404858, 13146868, 15567327, 951507, -3260321, -573935 },
+    { 24740841, 5052253, -30094131, 8961361, 25877428, 6165135, -24368180, 14397372, -7380369, -6144105 },
+    { -28888365, 3510803, -28103278, -1158478, -11238128, -10631454, -15441463, -14453128, -1625486, -6494814 }
+  }
+},
+{ /* 24/31 */
+  {
+    { 793299, -9230478, 8836302, -6235707, -27360908, -2369593, 33152843, -4885251, -9906200, -621852 },
+    { 5666233, 525582, 20782575, -8038419, -24538499, 14657740, 16099374, 1468826, -6171428, -15186581 },
+    { -4859255, -3779343, -2917758, -6748019, 7778750, 11688288, -30404353, -9871238, -1558923, -9863646 }
+  },
+  {
+    { 10896332, -7719704, 824275, 472601, -19460308, 3009587, 25248958, 14783338, -30581476, -15757844 },
+    { 10566929, 12612572, -31944212, 11118703, -12633376, 12362879, 21752402, 8822496, 24003793, 14264025 },
+    { 27713862, -7355973, -11008240, 9227530, 27050101, 2504721, 23886875, -13117525, 13958495, -5732453 }
+  },
+  {
+    { -23481610, 4867226, -27247128, 3900521, 29838369, -8212291, -31889399, -10041781, 7340521, -15410068 },
+    { 4646514, -8011124, -22766023, -11532654, 23184553, 8566613, 31366726, -1381061, -15066784, -10375192 },
+    { -17270517, 12723032, -16993061, 14878794, 21619651, -6197576, 27584817, 3093888, -8843694, 3849921 }
+  },
+  {
+    { -9064912, 2103172, 25561640, -15125738, -5239824, 9582958, 32477045, -9017955, 5002294, -15550259 },
+    { -12057553, -11177906, 21115585, -13365155, 8808712, -12030708, 16489530, 13378448, -25845716, 12741426 },
+    { -5946367, 10645103, -30911586, 15390284, -3286982, -7118677, 24306472, 15852464, 28834118, -7646072 }
+  },
+  {
+    { -17335748, -9107057, -24531279, 9434953, -8472084, -583362, -13090771, 455841, 20461858, 5491305 },
+    { 13669248, -16095482, -12481974, -10203039, -14569770, -11893198, -24995986, 11293807, -28588204, -9421832 },
+    { 28497928, 6272777, -33022994, 14470570, 8906179, -1225630, 18504674, -14165166, 29867745, -8795943 }
+  },
+  {
+    { -16207023, 13517196, -27799630, -13697798, 24009064, -6373891, -6367600, -13175392, 22853429, -4012011 },
+    { 24191378, 16712145, -13931797, 15217831, 14542237, 1646131, 18603514, -11037887, 12876623, -2112447 },
+    { 17902668, 4518229, -411702, -2829247, 26878217, 5258055, -12860753, 608397, 16031844, 3723494 }
+  },
+  {
+    { -28632773, 12763728, -20446446, 7577504, 33001348, -13017745, 17558842, -7872890, 23896954, -4314245 },
+    { -20005381, -12011952, 31520464, 605201, 2543521, 5991821, -2945064, 7229064, -9919646, -8826859 },
+    { 28816045, 298879, -28165016, -15920938, 19000928, -1665890, -12680833, -2949325, -18051778, -2082915 }
+  },
+  {
+    { 16000882, -344896, 3493092, -11447198, -29504595, -13159789, 12577740, 16041268, -19715240, 7847707 },
+    { 10151868, 10572098, 27312476, 7922682, 14825339, 4723128, -32855931, -6519018, -10020567, 3852848 },
+    { -11430470, 15697596, -21121557, -4420647, 5386314, 15063598, 16514493, -15932110, 29330899, -15076224 }
+  }
+},
+{ /* 25/31 */
+  {
+    { -25499735, -4378794, -15222908, -6901211, 16615731, 2051784, 3303702, 15490, -27548796, 12314391 },
+    { 15683520, -6003043, 18109120, -9980648, 15337968, -5997823, -16717435, 15921866, 16103996, -3731215 },
+    { -23169824, -10781249, 13588192, -1628807, -3798557, -1074929, -19273607, 5402699, -29815713, -9841101 }
+  },
+  {
+    { 23190676, 2384583, -32714340, 3462154, -29903655, -1529132, -11266856, 8911517, -25205859, 2739713 },
+    { 21374101, -3554250, -33524649, 9874411, 15377179, 11831242, -33529904, 6134907, 4931255, 11987849 },
+    { -7732, -2978858, -16223486, 7277597, 105524, -322051, -31480539, 13861388, -30076310, 10117930 }
+  },
+  {
+    { -29501170, -10744872, -26163768, 13051539, -25625564, 5089643, -6325503, 6704079, 12890019, 15728940 },
+    { -21972360, -11771379, -951059, -4418840, 14704840, 2695116, 903376, -10428139, 12885167, 8311031 },
+    { -17516482, 5352194, 10384213, -13811658, 7506451, 13453191, 26423267, 4384730, 1888765, -5435404 }
+  },
+  {
+    { -25817338, -3107312, -13494599, -3182506, 30896459, -13921729, -32251644, -12707869, -19464434, -3340243 },
+    { -23607977, -2665774, -526091, 4651136, 5765089, 4618330, 6092245, 14845197, 17151279, -9854116 },
+    { -24830458, -12733720, -15165978, 10367250, -29530908, -265356, 22825805, -7087279, -16866484, 16176525 }
+  },
+  {
+    { -23583256, 6564961, 20063689, 3798228, -4740178, 7359225, 2006182, -10363426, -28746253, -10197509 },
+    { -10626600, -4486402, -13320562, -5125317, 3432136, -6393229, 23632037, -1940610, 32808310, 1099883 },
+    { 15030977, 5768825, -27451236, -2887299, -6427378, -15361371, -15277896, -6809350, 2051441, -15225865 }
+  },
+  {
+    { -3362323, -7239372, 7517890, 9824992, 23555850, 295369, 5148398, -14154188, -22686354, 16633660 },
+    { 4577086, -16752288, 13249841, -15304328, 19958763, -14537274, 18559670, -10759549, 8402478, -9864273 },
+    { -28406330, -1051581, -26790155, -907698, -17212414, -11030789, 9453451, -14980072, 17983010, 9967138 }
+  },
+  {
+    { -25762494, 6524722, 26585488, 9969270, 24709298, 1220360, -1677990, 7806337, 17507396, 3651560 },
+    { -10420457, -4118111, 14584639, 15971087, -15768321, 8861010, 26556809, -5574557, -18553322, -11357135 },
+    { 2839101, 14284142, 4029895, 3472686, 14402957, 12689363, -26642121, 8459447, -5605463, -7621941 }
+  },
+  {
+    { -4839289, -3535444, 9744961, 2871048, 25113978, 3187018, -25110813, -849066, 17258084, -7977739 },
+    { 18164541, -10595176, -17154882, -1542417, 19237078, -9745295, 23357533, -15217008, 26908270, 12150756 },
+    { -30264870, -7647865, 5112249, -7036672, -1499807, -6974257, 43168, -5537701, -32302074, 16215819 }
+  }
+},
+{ /* 26/31 */
+  {
+    { -6898905, 9824394, -12304779, -4401089, -31397141, -6276835, 32574489, 12532905, -7503072, -8675347 },
+    { -27343522, -16515468, -27151524, -10722951, 946346, 16291093, 254968, 7168080, 21676107, -1943028 },
+    { 21260961, -8424752, -16831886, -11920822, -23677961, 3968121, -3651949, -6215466, -3556191, -7913075 }
+  },
+  {
+    { 16544754, 13250366, -16804428, 15546242, -4583003, 12757258, -2462308, -8680336, -18907032, -9662799 },
+    { -2415239, -15577728, 18312303, 4964443, -15272530, -12653564, 26820651, 16690659, 25459437, -4564609 },
+    { -25144690, 11425020, 28423002, -11020557, -6144921, -15826224, 9142795, -2391602, -6432418, -1644817 }
+  },
+  {
+    { -23104652, 6253476, 16964147, -3768872, -25113972, -12296437, -27457225, -16344658, 6335692, 7249989 },
+    { -30333227, 13979675, 7503222, -12368314, -11956721, -4621693, -30272269, 2682242, 25993170, -12478523 },
+    { 4364628, 5930691, 32304656, -10044554, -8054781, 15091131, 22857016, -10598955, 31820368, 15075278 }
+  },
+  {
+    { 31879134, -8918693, 17258761, 90626, -8041836, -4917709, 24162788, -9650886, -17970238, 12833045 },
+    { 19073683, 14851414, -24403169, -11860168, 7625278, 11091125, -19619190, 2074449, -9413939, 14905377 },
+    { 24483667, -11935567, -2518866, -11547418, -1553130, 15355506, -25282080, 9253129, 27628530, -7555480 }
+  },
+  {
+    { 17597607, 8340603, 19355617, 552187, 26198470, -3176583, 4593324, -9157582, -14110875, 15297016 },
+    { 510886, 14337390, -31785257, 16638632, 6328095, 2713355, -20217417, -11864220, 8683221, 2921426 },
+    { 18606791, 11874196, 27155355, -5281482, -24031742, 6265446, -25178240, -1278924, 4674690, 13890525 }
+  },
+  {
+    { 13609624, 13069022, -27372361, -13055908, 24360586, 9592974, 14977157, 9835105, 4389687, 288396 },
+    { 9922506, -519394, 13613107, 5883594, -18758345, -434263, -12304062, 8317628, 23388070, 16052080 },
+    { 12720016, 11937594, -31970060, -5028689, 26900120, 8561328, -20155687, -11632979, -14754271, -10812892 }
+  },
+  {
+    { 15961858, 14150409, 26716931, -665832, -22794328, 13603569, 11829573, 7467844, -28822128, 929275 },
+    { 11038231, -11582396, -27310482, -7316562, -10498527, -16307831, -23479533, -9371869, -21393143, 2465074 },
+    { 20017163, -4323226, 27915242, 1529148, 12396362, 15675764, 13817261, -9658066, 2463391, -4622140 }
+  },
+  {
+    { -16358878, -12663911, -12065183, 4996454, -1256422, 1073572, 9583558, 12851107, 4003896, 12673717 },
+    { -1731589, -15155870, -3262930, 16143082, 19294135, 13385325, 14741514, -9103726, 7903886, 2348101 },
+    { 24536016, -16515207, 12715592, -3862155, 1511293, 10047386, -3842346, -7129159, -28377538, 10048127 }
+  }
+},
+{ /* 27/31 */
+  {
+    { -12622226, -6204820, 30718825, 2591312, -10617028, 12192840, 18873298, -7297090, -32297756, 15221632 },
+    { -26478122, -11103864, 11546244, -1852483, 9180880, 7656409, -21343950, 2095755, 29769758, 6593415 },
+    { -31994208, -2907461, 4176912, 3264766, 12538965, -868111, 26312345, -6118678, 30958054, 8292160 }
+  },
+  {
+    { 31429822, -13959116, 29173532, 15632448, 12174511, -2760094, 32808831, 3977186, 26143136, -3148876 },
+    { 22648901, 1402143, -22799984, 13746059, 7936347, 365344, -8668633, -1674433, -3758243, -2304625 },
+    { -15491917, 8012313, -2514730, -12702462, -23965846, -10254029, -1612713, -1535569, -16664475, 8194478 }
+  },
+  {
+    { 27338066, -7507420, -7414224, 10140405, -19026427, -6589889, 27277191, 8855376, 28572286, 3005164 },
+    { 26287124, 4821776, 25476601, -4145903, -3764513, -15788984, -18008582, 1182479, -26094821, -13079595 },
+    { -7171154, 3178080, 23970071, 6201893, -17195577, -4489192, -21876275, -13982627, 32208683, -1198248 }
+  },
+  {
+    { -16657702, 2817643, -10286362, 14811298, 6024667, 13349505, -27315504, -10497842, -27672585, -11539858 },
+    { 15941029, -9405932, -21367050, 8062055, 31876073, -238629, -15278393, -1444429, 15397331, -4130193 },
+    { 8934485, -13485467, -23286397, -13423241, -32446090, 14047986, 31170398, -1441021, -27505566, 15087184 }
+  },
+  {
+    { -18357243, -2156491, 24524913, -16677868, 15520427, -6360776, -15502406, 11461896, 16788528, -5868942 },
+    { -1947386, 16013773, 21750665, 3714552, -17401782, -16055433, -3770287, -10323320, 31322514, -11615635 },
+    { 21426655, -5650218, -13648287, -5347537, -28812189, -4920970, -18275391, -14621414, 13040862, -12112948 }
+  },
+  {
+    { 11293895, 12478086, -27136401, 15083750, -29307421, 14748872, 14555558, -13417103, 1613711, 4896935 },
+    { -25894883, 15323294, -8489791, -8057900, 25967126, -13425460, 2825960, -4897045, -23971776, -11267415 },
+    { -15924766, -5229880, -17443532, 6410664, 3622847, 10243618, 20615400, 12405433, -23753030, -8436416 }
+  },
+  {
+    { -7091295, 12556208, -20191352, 9025187, -17072479, 4333801, 4378436, 2432030, 23097949, -566018 },
+    { 4565804, -16025654, 20084412, -7842817, 1724999, 189254, 24767264, 10103221, -18512313, 2424778 },
+    { 366633, -11976806, 8173090, -6890119, 30788634, 5745705, -7168678, 1344109, -3642553, 12412659 }
+  },
+  {
+    { -24001791, 7690286, 14929416, -168257, -32210835, -13412986, 24162697, -15326504, -3141501, 11179385 },
+    { 18289522, -14724954, 8056945, 16430056, -21729724, 7842514, -6001441, -1486897, -18684645, -11443503 },
+    { 476239, 6601091, -6152790, -9723375, 17503545, -4863900, 27672959, 13403813, 11052904, 5219329 }
+  }
+},
+{ /* 28/31 */
+  {
+    { 20678546, -8375738, -32671898, 8849123, -5009758, 14574752, 31186971, -3973730, 9014762, -8579056 },
+    { -13644050, -10350239, -15962508, 5075808, -1514661, -11534600, -33102500, 9160280, 8473550, -3256838 },
+    { 24900749, 14435722, 17209120, -15292541, -22592275, 9878983, -7689309, -16335821, -24568481, 11788948 }
+  },
+  {
+    { -3118155, -11395194, -13802089, 14797441, 9652448, -6845904, -20037437, 10410733, -24568470, -1458691 },
+    { -15659161, 16736706, -22467150, 10215878, -9097177, 7563911, 11871841, -12505194, -18513325, 8464118 },
+    { -23400612, 8348507, -14585951, -861714, -3950205, -6373419, 14325289, 8628612, 33313881, -8370517 }
+  },
+  {
+    { -20186973, -4967935, 22367356, 5271547, -1097117, -4788838, -24805667, -10236854, -8940735, -5818269 },
+    { -6948785, -1795212, -32625683, -16021179, 32635414, -7374245, 15989197, -12838188, 28358192, -4253904 },
+    { -23561781, -2799059, -32351682, -1661963, -9147719, 10429267, -16637684, 4072016, -5351664, 5596589 }
+  },
+  {
+    { -28236598, -3390048, 12312896, 6213178, 3117142, 16078565, 29266239, 2557221, 1768301, 15373193 },
+    { -7243358, -3246960, -4593467, -7553353, -127927, -912245, -1090902, -4504991, -24660491, 3442910 },
+    { -30210571, 5124043, 14181784, 8197961, 18964734, -11939093, 22597931, 7176455, -18585478, 13365930 }
+  },
+  {
+    { -7877390, -1499958, 8324673, 4690079, 6261860, 890446, 24538107, -8570186, -9689599, -3031667 },
+    { 25008904, -10771599, -4305031, -9638010, 16265036, 15721635, 683793, -11823784, 15723479, -15163481 },
+    { -9660625, 12374379, -27006999, -7026148, -7724114, -12314514, 11879682, 5400171, 519526, -1235876 }
+  },
+  {
+    { 22258397, -16332233, -7869817, 14613016, -22520255, -2950923, -20353881, 7315967, 16648397, 7605640 },
+    { -8081308, -8464597, -8223311, 9719710, 19259459, -15348212, 23994942, -5281555, -9468848, 4763278 },
+    { -21699244, 9220969, -15730624, 1084137, -25476107, -2852390, 31088447, -7764523, -11356529, 728112 }
+  },
+  {
+    { 26047220, -11751471, -6900323, -16521798, 24092068, 9158119, -4273545, -12555558, -29365436, -5498272 },
+    { 17510331, -322857, 5854289, 8403524, 17133918, -3112612, -28111007, 12327945, 10750447, 10014012 },
+    { -10312768, 3936952, 9156313, -8897683, 16498692, -994647, -27481051, -666732, 3424691, 7540221 }
+  },
+  {
+    { 30322361, -6964110, 11361005, -4143317, 7433304, 4989748, -7071422, -16317219, -9244265, 15258046 },
+    { 13054562, -2779497, 19155474, 469045, -12482797, 4566042, 5631406, 2711395, 1062915, -5136345 },
+    { -19240248, -11254599, -29509029, -7499965, -5835763, 13005411, -6066489, 12194497, 32960380, 1459310 }
+  }
+},
+{ /* 29/31 */
+  {
+    { 19852034, 7027924, 23669353, 10020366, 8586503, -6657907, 394197, -6101885, 18638003, -11174937 },
+    { 31395534, 15098109, 26581030, 8030562, -16527914, -5007134, 9012486, -7584354, -6643087, -5442636 },
+    { -9192165, -2347377, -1997099, 4529534, 25766844, 607986, -13222, 9677543, -32294889, -6456008 }
+  },
+  {
+    { -2444496, -149937, 29348902, 8186665, 1873760, 12489863, -30934579, -7839692, -7852844, -8138429 },
+    { -15236356, -15433509, 7766470, 746860, 26346930, -10221762, -27333451, 10754588, -9431476, 5203576 },
+    { 31834314, 14135496, -770007, 5159118, 20917671, -16768096, -7467973, -7337524, 31809243, 7347066 }
+  },
+  {
+    { -9606723, -11874240, 20414459, 13033986, 13716524, -11691881, 19797970, -12211255, 15192876, -2087490 },
+    { -12663563, -2181719, 1168162, -3804809, 26747877, -14138091, 10609330, 12694420, 33473243, -13382104 },
+    { 33184999, 11180355, 15832085, -11385430, -1633671, 225884, 15089336, -11023903, -6135662, 14480053 }
+  },
+  {
+    { 31308717, -5619998, 31030840, -1897099, 15674547, -6582883, 5496208, 13685227, 27595050, 8737275 },
+    { -20318852, -15150239, 10933843, -16178022, 8335352, -7546022, -31008351, -12610604, 26498114, 66511 },
+    { 22644454, -8761729, -16671776, 4884562, -3105614, -13559366, 30540766, -4286747, -13327787, -7515095 }
+  },
+  {
+    { -28017847, 9834845, 18617207, -2681312, -3401956, -13307506, 8205540, 13585437, -17127465, 15115439 },
+    { 23711543, -672915, 31206561, -8362711, 6164647, -9709987, -33535882, -1426096, 8236921, 16492939 },
+    { -23910559, -13515526, -26299483, -4503841, 25005590, -7687270, 19574902, 10071562, 6708380, -6222424 }
+  },
+  {
+    { 2101391, -4930054, 19702731, 2367575, -15427167, 1047675, 5301017, 9328700, 29955601, -11678310 },
+    { 3096359, 9271816, -21620864, -15521844, -14847996, -7592937, -25892142, -12635595, -9917575, 6216608 },
+    { -32615849, 338663, -25195611, 2510422, -29213566, -13820213, 24822830, -6146567, -26767480, 7525079 }
+  },
+  {
+    { -23066649, -13985623, 16133487, -7896178, -3389565, 778788, -910336, -2782495, -19386633, 11994101 },
+    { 21691500, -13624626, -641331, -14367021, 3285881, -3483596, -25064666, 9718258, -7477437, 13381418 },
+    { 18445390, -4202236, 14979846, 11622458, -1727110, -3582980, 23111648, -6375247, 28535282, 15779576 }
+  },
+  {
+    { 30098053, 3089662, -9234387, 16662135, -21306940, 11308411, -14068454, 12021730, 9955285, -16303356 },
+    { 9734894, -14576830, -7473633, -9138735, 2060392, 11313496, -18426029, 9924399, 20194861, 13380996 },
+    { -26378102, -7965207, -22167821, 15789297, -18055342, -6168792, -1984914, 15707771, 26342023, 10146099 }
+  }
+},
+{ /* 30/31 */
+  {
+    { -26016874, -219943, 21339191, -41388, 19745256, -2878700, -29637280, 2227040, 21612326, -545728 },
+    { -13077387, 1184228, 23562814, -5970442, -20351244, -6348714, 25764461, 12243797, -20856566, 11649658 },
+    { -10031494, 11262626, 27384172, 2271902, 26947504, -15997771, 39944, 6114064, 33514190, 2333242 }
+  },
+  {
+    { -21433588, -12421821, 8119782, 7219913, -21830522, -9016134, -6679750, -12670638, 24350578, -13450001 },
+    { -4116307, -11271533, -23886186, 4843615, -30088339, 690623, -31536088, -10406836, 8317860, 12352766 },
+    { 18200138, -14475911, -33087759, -2696619, -23702521, -9102511, -23552096, -2287550, 20712163, 6719373 }
+  },
+  {
+    { 26656208, 6075253, -7858556, 1886072, -28344043, 4262326, 11117530, -3763210, 26224235, -3297458 },
+    { -17168938, -14854097, -3395676, -16369877, -19954045, 14050420, 21728352, 9493610, 18620611, -16428628 },
+    { -13323321, 13325349, 11432106, 5964811, 18609221, 6062965, -5269471, -9725556, -30701573, -16479657 }
+  },
+  {
+    { -23860538, -11233159, 26961357, 1640861, -32413112, -16737940, 12248509, -5240639, 13735342, 1934062 },
+    { 25089769, 6742589, 17081145, -13406266, 21909293, -16067981, -15136294, -3765346, -21277997, 5473616 },
+    { 31883677, -7961101, 1083432, -11572403, 22828471, 13290673, -7125085, 12469656, 29111212, -5451014 }
+  },
+  {
+    { 24244947, -15050407, -26262976, 2791540, -14997599, 16666678, 24367466, 6388839, -10295587, 452383 },
+    { -25640782, -3417841, 5217916, 16224624, 19987036, -4082269, -24236251, -5915248, 15766062, 8407814 },
+    { -20406999, 13990231, 15495425, 16395525, 5377168, 15166495, -8917023, -4388953, -8067909, 2276718 }
+  },
+  {
+    { 30157918, 12924066, -17712050, 9245753, 19895028, 3368142, -23827587, 5096219, 22740376, -7303417 },
+    { 2041139, -14256350, 7783687, 13876377, -25946985, -13352459, 24051124, 13742383, -15637599, 13295222 },
+    { 33338237, -8505733, 12532113, 7977527, 9106186, -1715251, -17720195, -4612972, -4451357, -14669444 }
+  },
+  {
+    { -20045281, 5454097, -14346548, 6447146, 28862071, 1883651, -2469266, -4141880, 7770569, 9620597 },
+    { 23208068, 7979712, 33071466, 8149229, 1758231, -10834995, 30945528, -1694323, -33502340, -14767970 },
+    { 1439958, -16270480, -1079989, -793782, 4625402, 10647766, -5043801, 1220118, 30494170, -11440799 }
+  },
+  {
+    { -5037580, -13028295, -2970559, -3061767, 15640974, -6701666, -26739026, 926050, -1684339, -13333647 },
+    { 13908495, -3549272, 30919928, -6273825, -21521863, 7989039, 9021034, 9078865, 3353509, 4033511 },
+    { -29663431, -15113610, 32259991, -344482, 24295849, -12912123, 23161163, 8839127, 27485041, 7356032 }
+  }
+},
+{ /* 31/31 */
+  {
+    { 9661027, 705443, 11980065, -5370154, -1628543, 14661173, -6346142, 2625015, 28431036, -16771834 },
+    { -23839233, -8311415, -25945511, 7480958, -17681669, -8354183, -22545972, 14150565, 15970762, 4099461 },
+    { 29262576, 16756590, 26350592, -8793563, 8529671, -11208050, 13617293, -9937143, 11465739, 8317062 }
+  },
+  {
+    { -25493081, -6962928, 32500200, -9419051, -23038724, -2302222, 14898637, 3848455, 20969334, -5157516 },
+    { -20384450, -14347713, -18336405, 13884722, -33039454, 2842114, -21610826, -3649888, 11177095, 14989547 },
+    { -24496721, -11716016, 16959896, 2278463, 12066309, 10137771, 13515641, 2581286, -28487508, 9930240 }
+  },
+  {
+    { -17751622, -2097826, 16544300, -13009300, -15914807, -14949081, 18345767, -13403753, 16291481, -5314038 },
+    { -33229194, 2553288, 32678213, 9875984, 8534129, 6889387, -9676774, 6957617, 4368891, 9788741 },
+    { 16660756, 7281060, -10830758, 12911820, 20108584, -8101676, -21722536, -8613148, 16250552, -11111103 }
+  },
+  {
+    { -19765507, 2390526, -16551031, 14161980, 1905286, 6414907, 4689584, 10604807, -30190403, 4782747 },
+    { -1354539, 14736941, -7367442, -13292886, 7710542, -14155590, -9981571, 4383045, 22546403, 437323 },
+    { 31665577, -12180464, -16186830, 1491339, -18368625, 3294682, 27343084, 2786261, -30633590, -14097016 }
+  },
+  {
+    { -14467279, -683715, -33374107, 7448552, 19294360, 14334329, -19690631, 2355319, -19284671, -6114373 },
+    { 15121312, -15796162, 6377020, -6031361, -10798111, -12957845, 18952177, 15496498, -29380133, 11754228 },
+    { -2637277, -13483075, 8488727, -14303896, 12728761, -1622493, 7141596, 11724556, 22761615, -10134141 }
+  },
+  {
+    { 16918416, 11729663, -18083579, 3022987, -31015732, -13339659, -28741185, -12227393, 32851222, 11717399 },
+    { 11166634, 7338049, -6722523, 4531520, -29468672, -7302055, 31474879, 3483633, -1193175, -4030831 },
+    { -185635, 9921305, 31456609, -13536438, -12013818, 13348923, 33142652, 6546660, -19985279, -3948376 }
+  },
+  {
+    { -32460596, 11266712, -11197107, -7899103, 31703694, 3855903, -8537131, -12833048, -30772034, -15486313 },
+    { -18006477, 12709068, 3991746, -6479188, -21491523, -10550425, -31135347, -16049879, 10928917, 3011958 },
+    { -6957757, -15594337, 31696059, 334240, 29576716, 14796075, -30831056, -12805180, 18008031, 10258577 }
+  },
+  {
+    { -22448644, 15655569, 7018479, -4410003, -30314266, -1201591, -1853465, 1367120, 25127874, 6671743 },
+    { 29701166, -14373934, -10878120, 9279288, -17568, 13127210, 21382910, 11042292, 25838796, 4642684 },
+    { -20430234, 14955537, -24126347, 8124619, -5369288, -5990470, 30468147, -13900640, 18423289, 4177476 }
+  }
+}
diff --git a/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/base2.h b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/base2.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/base2.h
@@ -0,0 +1,40 @@
+{
+  { 25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605 },
+  { -12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378 },
+  { -8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546 }
+},
+{
+  { 15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024 },
+  { 16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574 },
+  { 30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357 }
+},
+{
+  { 10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380 },
+  { 4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306 },
+  { 19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942 }
+},
+{
+  { 5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766 },
+  { -30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701 },
+  { 28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300 }
+},
+{
+  { -22518993, -6692182, 14201702, -8745502, -23510406, 8844726, 18474211, -1361450, -13062696, 13821877 },
+  { -6455177, -7839871, 3374702, -4740862, -27098617, -10571707, 31655028, -7212327, 18853322, -14220951 },
+  { 4566830, -12963868, -28974889, -12240689, -7602672, -2830569, -8514358, -10431137, 2207753, -3209784 }
+},
+{
+  { -25154831, -4185821, 29681144, 7868801, -6854661, -9423865, -12437364, -663000, -31111463, -16132436 },
+  { 25576264, -2703214, 7349804, -11814844, 16472782, 9300885, 3844789, 15725684, 171356, 6466918 },
+  { 23103977, 13316479, 9739013, -16149481, 817875, -15038942, 8965339, -14088058, -30714912, 16193877 }
+},
+{
+  { -33521811, 3180713, -2394130, 14003687, -16903474, -16270840, 17238398, 4729455, -18074513, 9256800 },
+  { -25182317, -4174131, 32336398, 5036987, -21236817, 11360617, 22616405, 9761698, -19827198, 630305 },
+  { -13720693, 2639453, -24237460, -7406481, 9494427, -5774029, -6554551, -15960994, -2449256, -14291300 }
+},
+{
+  { -3151181, -5046075, 9282714, 6866145, -31907062, -863023, -18940575, 15033784, 25105118, -7894876 },
+  { -24326370, 15950226, -31801215, -14592823, -11662737, -5090925, 1573892, -2625887, 2198790, -15804619 },
+  { -3099351, 10324967, -2241613, 7453183, -5446979, -2735503, -13812022, -16236442, -32461234, -12290683 }
+}
diff --git a/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h
@@ -0,0 +1,40 @@
+/* 37095705934669439343138083508754565189542113879843219016388785533085940283555 */
+static const fe25519 d = {
+    -10913610, 13857413, -15372611, 6949391,   114729, -8787816, -6275908, -3247719, -18696448, -12055116
+};
+
+/* 2 * d =
+ * 16295367250680780974490674513165176452449235426866156013048779062215315747161
+ */
+static const fe25519 d2 = {
+    -21827239, -5839606,  -30745221, 13898782, 229458, 15978800, -12551817, -6495438, 29715968, 9444199 };
+
+/* sqrt(-1) */
+static const fe25519 sqrtm1 = {
+    -32595792, -7943725,  9377950,  3500415, 12389472, -272473, -25146209, -2005654, 326686, 11406482
+};
+
+/* A = 486662 */
+static const fe25519 curve25519_A = {
+    486662, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/* sqrt(ad - 1) with a = -1 (mod p) */
+static const fe25519 sqrtadm1 = {
+    24849947, -153582, -23613485, 6347715, -21072328, -667138, -25271143, -15367704, -870347, 14525639
+};
+
+/* 1 / sqrt(a - d) */
+static const fe25519 invsqrtamd = {
+    6111485, 4156064, -27798727, 12243468, -25904040, 120897, 20826367, -7060776, 6093568, -1986012
+};
+
+/* 1 - d ^ 2 */
+static const fe25519 onemsqd = {
+    6275446, -16617371, -22938544, -3773710, 11667077, 7397348, -27922721, 1766195, -24433858, 672203
+};
+
+/* (d - 1) ^ 2 */
+static const fe25519 sqdmone = {
+    15551795, -11097455, -13425098, -10125071, -11896535, 10178284, -26634327, 4729244, -5282110, -10116402
+};
diff --git a/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/fe.h b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/fe.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_25_5/fe.h
@@ -0,0 +1,220 @@
+/*
+ Ignores top bit of s.
+ */
+
+void
+fe25519_frombytes(fe25519 h, const unsigned char *s)
+{
+    int64_t h0 = load_4(s);
+    int64_t h1 = load_3(s + 4) << 6;
+    int64_t h2 = load_3(s + 7) << 5;
+    int64_t h3 = load_3(s + 10) << 3;
+    int64_t h4 = load_3(s + 13) << 2;
+    int64_t h5 = load_4(s + 16);
+    int64_t h6 = load_3(s + 20) << 7;
+    int64_t h7 = load_3(s + 23) << 5;
+    int64_t h8 = load_3(s + 26) << 4;
+    int64_t h9 = (load_3(s + 29) & 8388607) << 2;
+
+    int64_t carry0;
+    int64_t carry1;
+    int64_t carry2;
+    int64_t carry3;
+    int64_t carry4;
+    int64_t carry5;
+    int64_t carry6;
+    int64_t carry7;
+    int64_t carry8;
+    int64_t carry9;
+
+    carry9 = (h9 + (int64_t)(1L << 24)) >> 25;
+    h0 += carry9 * 19;
+    h9 -= carry9 * ((uint64_t) 1L << 25);
+    carry1 = (h1 + (int64_t)(1L << 24)) >> 25;
+    h2 += carry1;
+    h1 -= carry1 * ((uint64_t) 1L << 25);
+    carry3 = (h3 + (int64_t)(1L << 24)) >> 25;
+    h4 += carry3;
+    h3 -= carry3 * ((uint64_t) 1L << 25);
+    carry5 = (h5 + (int64_t)(1L << 24)) >> 25;
+    h6 += carry5;
+    h5 -= carry5 * ((uint64_t) 1L << 25);
+    carry7 = (h7 + (int64_t)(1L << 24)) >> 25;
+    h8 += carry7;
+    h7 -= carry7 * ((uint64_t) 1L << 25);
+
+    carry0 = (h0 + (int64_t)(1L << 25)) >> 26;
+    h1 += carry0;
+    h0 -= carry0 * ((uint64_t) 1L << 26);
+    carry2 = (h2 + (int64_t)(1L << 25)) >> 26;
+    h3 += carry2;
+    h2 -= carry2 * ((uint64_t) 1L << 26);
+    carry4 = (h4 + (int64_t)(1L << 25)) >> 26;
+    h5 += carry4;
+    h4 -= carry4 * ((uint64_t) 1L << 26);
+    carry6 = (h6 + (int64_t)(1L << 25)) >> 26;
+    h7 += carry6;
+    h6 -= carry6 * ((uint64_t) 1L << 26);
+    carry8 = (h8 + (int64_t)(1L << 25)) >> 26;
+    h9 += carry8;
+    h8 -= carry8 * ((uint64_t) 1L << 26);
+
+    h[0] = (int32_t) h0;
+    h[1] = (int32_t) h1;
+    h[2] = (int32_t) h2;
+    h[3] = (int32_t) h3;
+    h[4] = (int32_t) h4;
+    h[5] = (int32_t) h5;
+    h[6] = (int32_t) h6;
+    h[7] = (int32_t) h7;
+    h[8] = (int32_t) h8;
+    h[9] = (int32_t) h9;
+}
+
+/*
+ Preconditions:
+ |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+
+ Write p=2^255-19; q=floor(h/p).
+ Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))).
+
+ Proof:
+ Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4.
+ Also have |h-2^230 h9|<2^231 so |19 2^(-255)(h-2^230 h9)|<1/4.
+
+ Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9).
+ Then 0<y<1.
+
+ Write r=h-pq.
+ Have 0<=r<=p-1=2^255-20.
+ Thus 0<=r+19(2^-255)r<r+19(2^-255)2^255<=2^255-1.
+
+ Write x=r+19(2^-255)r+y.
+ Then 0<x<2^255 so floor(2^(-255)x) = 0 so floor(q+2^(-255)x) = q.
+
+ Have q+2^(-255)x = 2^(-255)(h + 19 2^(-25) h9 + 2^(-1))
+ so floor(2^(-255)(h + 19 2^(-25) h9 + 2^(-1))) = q.
+*/
+
+static void
+fe25519_reduce(fe25519 h, const fe25519 f)
+{
+    int32_t h0 = f[0];
+    int32_t h1 = f[1];
+    int32_t h2 = f[2];
+    int32_t h3 = f[3];
+    int32_t h4 = f[4];
+    int32_t h5 = f[5];
+    int32_t h6 = f[6];
+    int32_t h7 = f[7];
+    int32_t h8 = f[8];
+    int32_t h9 = f[9];
+
+    int32_t q;
+    int32_t carry0, carry1, carry2, carry3, carry4, carry5, carry6, carry7, carry8, carry9;
+
+    q = (19 * h9 + ((uint32_t) 1L << 24)) >> 25;
+    q = (h0 + q) >> 26;
+    q = (h1 + q) >> 25;
+    q = (h2 + q) >> 26;
+    q = (h3 + q) >> 25;
+    q = (h4 + q) >> 26;
+    q = (h5 + q) >> 25;
+    q = (h6 + q) >> 26;
+    q = (h7 + q) >> 25;
+    q = (h8 + q) >> 26;
+    q = (h9 + q) >> 25;
+
+    /* Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20. */
+    h0 += 19 * q;
+    /* Goal: Output h-2^255 q, which is between 0 and 2^255-20. */
+
+    carry0 = h0 >> 26;
+    h1 += carry0;
+    h0 -= carry0 * ((uint32_t) 1L << 26);
+    carry1 = h1 >> 25;
+    h2 += carry1;
+    h1 -= carry1 * ((uint32_t) 1L << 25);
+    carry2 = h2 >> 26;
+    h3 += carry2;
+    h2 -= carry2 * ((uint32_t) 1L << 26);
+    carry3 = h3 >> 25;
+    h4 += carry3;
+    h3 -= carry3 * ((uint32_t) 1L << 25);
+    carry4 = h4 >> 26;
+    h5 += carry4;
+    h4 -= carry4 * ((uint32_t) 1L << 26);
+    carry5 = h5 >> 25;
+    h6 += carry5;
+    h5 -= carry5 * ((uint32_t) 1L << 25);
+    carry6 = h6 >> 26;
+    h7 += carry6;
+    h6 -= carry6 * ((uint32_t) 1L << 26);
+    carry7 = h7 >> 25;
+    h8 += carry7;
+    h7 -= carry7 * ((uint32_t) 1L << 25);
+    carry8 = h8 >> 26;
+    h9 += carry8;
+    h8 -= carry8 * ((uint32_t) 1L << 26);
+    carry9 = h9 >> 25;
+    h9 -= carry9 * ((uint32_t) 1L << 25);
+
+    h[0] = h0;
+    h[1] = h1;
+    h[2] = h2;
+    h[3] = h3;
+    h[4] = h4;
+    h[5] = h5;
+    h[6] = h6;
+    h[7] = h7;
+    h[8] = h8;
+    h[9] = h9;
+}
+
+/*
+ Goal: Output h0+...+2^255 h10-2^255 q, which is between 0 and 2^255-20.
+ Have h0+...+2^230 h9 between 0 and 2^255-1;
+ evidently 2^255 h10-2^255 q = 0.
+
+ Goal: Output h0+...+2^230 h9.
+ */
+
+void
+fe25519_tobytes(unsigned char *s, const fe25519 h)
+{
+    fe25519 t;
+
+    fe25519_reduce(t, h);
+    s[0]  = t[0] >> 0;
+    s[1]  = t[0] >> 8;
+    s[2]  = t[0] >> 16;
+    s[3]  = (t[0] >> 24) | (t[1] * ((uint32_t) 1 << 2));
+    s[4]  = t[1] >> 6;
+    s[5]  = t[1] >> 14;
+    s[6]  = (t[1] >> 22) | (t[2] * ((uint32_t) 1 << 3));
+    s[7]  = t[2] >> 5;
+    s[8]  = t[2] >> 13;
+    s[9]  = (t[2] >> 21) | (t[3] * ((uint32_t) 1 << 5));
+    s[10] = t[3] >> 3;
+    s[11] = t[3] >> 11;
+    s[12] = (t[3] >> 19) | (t[4] * ((uint32_t) 1 << 6));
+    s[13] = t[4] >> 2;
+    s[14] = t[4] >> 10;
+    s[15] = t[4] >> 18;
+    s[16] = t[5] >> 0;
+    s[17] = t[5] >> 8;
+    s[18] = t[5] >> 16;
+    s[19] = (t[5] >> 24) | (t[6] * ((uint32_t) 1 << 1));
+    s[20] = t[6] >> 7;
+    s[21] = t[6] >> 15;
+    s[22] = (t[6] >> 23) | (t[7] * ((uint32_t) 1 << 3));
+    s[23] = t[7] >> 5;
+    s[24] = t[7] >> 13;
+    s[25] = (t[7] >> 21) | (t[8] * ((uint32_t) 1 << 4));
+    s[26] = t[8] >> 4;
+    s[27] = t[8] >> 12;
+    s[28] = (t[8] >> 20) | (t[9] * ((uint32_t) 1 << 6));
+    s[29] = t[9] >> 2;
+    s[30] = t[9] >> 10;
+    s[31] = t[9] >> 18;
+}
diff --git a/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/base.h b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/base.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/base.h
@@ -0,0 +1,1344 @@
+{ /* 0/31 */
+  {
+    { 1288382639258501, 245678601348599, 269427782077623, 1462984067271730, 137412439391563 },
+    { 62697248952638, 204681361388450, 631292143396476, 338455783676468, 1213667448819585 },
+    { 301289933810280, 1259582250014073, 1422107436869536, 796239922652654, 1953934009299142 }
+  },
+  {
+    { 1380971894829527, 790832306631236, 2067202295274102, 1995808275510000, 1566530869037010 },
+    { 463307831301544, 432984605774163, 1610641361907204, 750899048855000, 1894842303421586 },
+    { 748439484463711, 1033211726465151, 1396005112841647, 1611506220286469, 1972177495910992 }
+  },
+  {
+    { 1601611775252272, 1720807796594148, 1132070835939856, 1260455018889551, 2147779492816911 },
+    { 316559037616741, 2177824224946892, 1459442586438991, 1461528397712656, 751590696113597 },
+    { 1850748884277385, 1200145853858453, 1068094770532492, 672251375690438, 1586055907191707 }
+  },
+  {
+    { 934282339813791, 1846903124198670, 1172395437954843, 1007037127761661, 1830588347719256 },
+    { 1694390458783935, 1735906047636159, 705069562067493, 648033061693059, 696214010414170 },
+    { 1121406372216585, 192876649532226, 190294192191717, 1994165897297032, 2245000007398739 }
+  },
+  {
+    { 769950342298419, 132954430919746, 844085933195555, 974092374476333, 726076285546016 },
+    { 425251763115706, 608463272472562, 442562545713235, 837766094556764, 374555092627893 },
+    { 1086255230780037, 274979815921559, 1960002765731872, 929474102396301, 1190409889297339 }
+  },
+  {
+    { 1388594989461809, 316767091099457, 394298842192982, 1230079486801005, 1440737038838979 },
+    { 7380825640100, 146210432690483, 304903576448906, 1198869323871120, 997689833219095 },
+    { 1181317918772081, 114573476638901, 262805072233344, 265712217171332, 294181933805782 }
+  },
+  {
+    { 665000864555967, 2065379846933859, 370231110385876, 350988370788628, 1233371373142985 },
+    { 2019367628972465, 676711900706637, 110710997811333, 1108646842542025, 517791959672113 },
+    { 965130719900578, 247011430587952, 526356006571389, 91986625355052, 2157223321444601 }
+  },
+  {
+    { 2068619540119183, 1966274918058806, 957728544705549, 729906502578991, 159834893065166 },
+    { 2073601412052185, 31021124762708, 264500969797082, 248034690651703, 1030252227928288 },
+    { 551790716293402, 1989538725166328, 801169423371717, 2052451893578887, 678432056995012 }
+  }
+},
+{ /* 1/31 */
+  {
+    { 1368953770187805, 790347636712921, 437508475667162, 2142576377050580, 1932081720066286 },
+    { 953638594433374, 1092333936795051, 1419774766716690, 805677984380077, 859228993502513 },
+    { 1200766035879111, 20142053207432, 1465634435977050, 1645256912097844, 295121984874596 }
+  },
+  {
+    { 1735718747031557, 1248237894295956, 1204753118328107, 976066523550493, 65943769534592 },
+    { 1060098822528990, 1586825862073490, 212301317240126, 1975302711403555, 666724059764335 },
+    { 1091990273418756, 1572899409348578, 80968014455247, 306009358661350, 1520450739132526 }
+  },
+  {
+    { 1480517209436112, 1511153322193952, 1244343858991172, 304788150493241, 369136856496443 },
+    { 2151330273626164, 762045184746182, 1688074332551515, 823046109005759, 907602769079491 },
+    { 2047386910586836, 168470092900250, 1552838872594810, 340951180073789, 360819374702533 }
+  },
+  {
+    { 1982622644432056, 2014393600336956, 128909208804214, 1617792623929191, 105294281913815 },
+    { 980234343912898, 1712256739246056, 588935272190264, 204298813091998, 841798321043288 },
+    { 197561292938973, 454817274782871, 1963754960082318, 2113372252160468, 971377527342673 }
+  },
+  {
+    { 164699448829328, 3127451757672, 1199504971548753, 1766155447043652, 1899238924683527 },
+    { 732262946680281, 1674412764227063, 2182456405662809, 1350894754474250, 558458873295247 },
+    { 2103305098582922, 1960809151316468, 715134605001343, 1454892949167181, 40827143824949 }
+  },
+  {
+    { 1239289043050212, 1744654158124578, 758702410031698, 1796762995074688, 1603056663766 },
+    { 2232056027107988, 987343914584615, 2115594492994461, 1819598072792159, 1119305654014850 },
+    { 320153677847348, 939613871605645, 641883205761567, 1930009789398224, 329165806634126 }
+  },
+  {
+    { 980930490474130, 1242488692177893, 1251446316964684, 1086618677993530, 1961430968465772 },
+    { 276821765317453, 1536835591188030, 1305212741412361, 61473904210175, 2051377036983058 },
+    { 833449923882501, 1750270368490475, 1123347002068295, 185477424765687, 278090826653186 }
+  },
+  {
+    { 794524995833413, 1849907304548286, 53348672473145, 1272368559505217, 1147304168324779 },
+    { 1504846112759364, 1203096289004681, 562139421471418, 274333017451844, 1284344053775441 },
+    { 483048732424432, 2116063063343382, 30120189902313, 292451576741007, 1156379271702225 }
+  }
+},
+{ /* 2/31 */
+  {
+    { 928372153029038, 2147692869914564, 1455665844462196, 1986737809425946, 185207050258089 },
+    { 137732961814206, 706670923917341, 1387038086865771, 1965643813686352, 1384777115696347 },
+    { 481144981981577, 2053319313589856, 2065402289827512, 617954271490316, 1106602634668125 }
+  },
+  {
+    { 696298019648792, 893299659040895, 1148636718636009, 26734077349617, 2203955659340681 },
+    { 657390353372855, 998499966885562, 991893336905797, 810470207106761, 343139804608786 },
+    { 791736669492960, 934767652997115, 824656780392914, 1759463253018643, 361530362383518 }
+  },
+  {
+    { 2022541353055597, 2094700262587466, 1551008075025686, 242785517418164, 695985404963562 },
+    { 1287487199965223, 2215311941380308, 1552928390931986, 1664859529680196, 1125004975265243 },
+    { 677434665154918, 989582503122485, 1817429540898386, 1052904935475344, 1143826298169798 }
+  },
+  {
+    { 367266328308408, 318431188922404, 695629353755355, 634085657580832, 24581612564426 },
+    { 773360688841258, 1815381330538070, 363773437667376, 539629987070205, 783280434248437 },
+    { 180820816194166, 168937968377394, 748416242794470, 1227281252254508, 1567587861004268 }
+  },
+  {
+    { 478775558583645, 2062896624554807, 699391259285399, 358099408427873, 1277310261461761 },
+    { 1984740906540026, 1079164179400229, 1056021349262661, 1659958556483663, 1088529069025527 },
+    { 580736401511151, 1842931091388998, 1177201471228238, 2075460256527244, 1301133425678027 }
+  },
+  {
+    { 1515728832059182, 1575261009617579, 1510246567196186, 191078022609704, 116661716289141 },
+    { 1295295738269652, 1714742313707026, 545583042462581, 2034411676262552, 1513248090013606 },
+    { 230710545179830, 30821514358353, 760704303452229, 390668103790604, 573437871383156 }
+  },
+  {
+    { 1169380107545646, 263167233745614, 2022901299054448, 819900753251120, 2023898464874585 },
+    { 2102254323485823, 1570832666216754, 34696906544624, 1993213739807337, 70638552271463 },
+    { 894132856735058, 548675863558441, 845349339503395, 1942269668326667, 1615682209874691 }
+  },
+  {
+    { 1287670217537834, 1222355136884920, 1846481788678694, 1150426571265110, 1613523400722047 },
+    { 793388516527298, 1315457083650035, 1972286999342417, 1901825953052455, 338269477222410 },
+    { 550201530671806, 778605267108140, 2063911101902983, 115500557286349, 2041641272971022 }
+  }
+},
+{ /* 3/31 */
+  {
+    { 717255318455100, 519313764361315, 2080406977303708, 541981206705521, 774328150311600 },
+    { 261715221532238, 1795354330069993, 1496878026850283, 499739720521052, 389031152673770 },
+    { 1997217696294013, 1717306351628065, 1684313917746180, 1644426076011410, 1857378133465451 }
+  },
+  {
+    { 1475434724792648, 76931896285979, 1116729029771667, 2002544139318042, 725547833803938 },
+    { 2022306639183567, 726296063571875, 315345054448644, 1058733329149221, 1448201136060677 },
+    { 1710065158525665, 1895094923036397, 123988286168546, 1145519900776355, 1607510767693874 }
+  },
+  {
+    { 561605375422540, 1071733543815037, 131496498800990, 1946868434569999, 828138133964203 },
+    { 1548495173745801, 442310529226540, 998072547000384, 553054358385281, 644824326376171 },
+    { 1445526537029440, 2225519789662536, 914628859347385, 1064754194555068, 1660295614401091 }
+  },
+  {
+    { 1199690223111956, 24028135822341, 66638289244341, 57626156285975, 565093967979607 },
+    { 876926774220824, 554618976488214, 1012056309841565, 839961821554611, 1414499340307677 },
+    { 703047626104145, 1266841406201770, 165556500219173, 486991595001879, 1011325891650656 }
+  },
+  {
+    { 1622861044480487, 1156394801573634, 1869132565415504, 327103985777730, 2095342781472284 },
+    { 334886927423922, 489511099221528, 129160865966726, 1720809113143481, 619700195649254 },
+    { 1646545795166119, 1758370782583567, 714746174550637, 1472693650165135, 898994790308209 }
+  },
+  {
+    { 333403773039279, 295772542452938, 1693106465353610, 912330357530760, 471235657950362 },
+    { 1811196219982022, 1068969825533602, 289602974833439, 1988956043611592, 863562343398367 },
+    { 906282429780072, 2108672665779781, 432396390473936, 150625823801893, 1708930497638539 }
+  },
+  {
+    { 925664675702328, 21416848568684, 1831436641861340, 601157008940113, 371818055044496 },
+    { 1479786007267725, 1738881859066675, 68646196476567, 2146507056100328, 1247662817535471 },
+    { 52035296774456, 939969390708103, 312023458773250, 59873523517659, 1231345905848899 }
+  },
+  {
+    { 643355106415761, 290186807495774, 2013561737429023, 319648069511546, 393736678496162 },
+    { 129358342392716, 1932811617704777, 1176749390799681, 398040349861790, 1170779668090425 },
+    { 2051980782668029, 121859921510665, 2048329875753063, 1235229850149665, 519062146124755 }
+  }
+},
+{ /* 4/31 */
+  {
+    { 1608170971973096, 415809060360428, 1350468408164766, 2038620059057678, 1026904485989112 },
+    { 1837656083115103, 1510134048812070, 906263674192061, 1821064197805734, 565375124676301 },
+    { 578027192365650, 2034800251375322, 2128954087207123, 478816193810521, 2196171989962750 }
+  },
+  {
+    { 1633188840273139, 852787172373708, 1548762607215796, 1266275218902681, 1107218203325133 },
+    { 462189358480054, 1784816734159228, 1611334301651368, 1303938263943540, 707589560319424 },
+    { 1038829280972848, 38176604650029, 753193246598573, 1136076426528122, 595709990562434 }
+  },
+  {
+    { 1408451820859834, 2194984964010833, 2198361797561729, 1061962440055713, 1645147963442934 },
+    { 4701053362120, 1647641066302348, 1047553002242085, 1923635013395977, 206970314902065 },
+    { 1750479161778571, 1362553355169293, 1891721260220598, 966109370862782, 1024913988299801 }
+  },
+  {
+    { 212699049131723, 1117950018299775, 1873945661751056, 1403802921984058, 130896082652698 },
+    { 636808533673210, 1262201711667560, 390951380330599, 1663420692697294, 561951321757406 },
+    { 520731594438141, 1446301499955692, 273753264629267, 1565101517999256, 1019411827004672 }
+  },
+  {
+    { 926527492029409, 1191853477411379, 734233225181171, 184038887541270, 1790426146325343 },
+    { 1464651961852572, 1483737295721717, 1519450561335517, 1161429831763785, 405914998179977 },
+    { 996126634382301, 796204125879525, 127517800546509, 344155944689303, 615279846169038 }
+  },
+  {
+    { 738724080975276, 2188666632415296, 1961313708559162, 1506545807547587, 1151301638969740 },
+    { 622917337413835, 1218989177089035, 1284857712846592, 970502061709359, 351025208117090 },
+    { 2067814584765580, 1677855129927492, 2086109782475197, 235286517313238, 1416314046739645 }
+  },
+  {
+    { 586844262630358, 307444381952195, 458399356043426, 602068024507062, 1028548203415243 },
+    { 678489922928203, 2016657584724032, 90977383049628, 1026831907234582, 615271492942522 },
+    { 301225714012278, 1094837270268560, 1202288391010439, 644352775178361, 1647055902137983 }
+  },
+  {
+    { 1210746697896478, 1416608304244708, 686487477217856, 1245131191434135, 1051238336855737 },
+    { 1135604073198207, 1683322080485474, 769147804376683, 2086688130589414, 900445683120379 },
+    { 1971518477615628, 401909519527336, 448627091057375, 1409486868273821, 1214789035034363 }
+  }
+},
+{ /* 5/31 */
+  {
+    { 1364039144731711, 1897497433586190, 2203097701135459, 145461396811251, 1349844460790699 },
+    { 1045230323257973, 818206601145807, 630513189076103, 1672046528998132, 807204017562437 },
+    { 439961968385997, 386362664488986, 1382706320807688, 309894000125359, 2207801346498567 }
+  },
+  {
+    { 1229004686397588, 920643968530863, 123975893911178, 681423993215777, 1400559197080973 },
+    { 2003766096898049, 170074059235165, 1141124258967971, 1485419893480973, 1573762821028725 },
+    { 729905708611432, 1270323270673202, 123353058984288, 426460209632942, 2195574535456672 }
+  },
+  {
+    { 1271140255321235, 2044363183174497, 52125387634689, 1445120246694705, 942541986339084 },
+    { 1761608437466135, 583360847526804, 1586706389685493, 2157056599579261, 1170692369685772 },
+    { 871476219910823, 1878769545097794, 2241832391238412, 548957640601001, 690047440233174 }
+  },
+  {
+    { 297194732135507, 1366347803776820, 1301185512245601, 561849853336294, 1533554921345731 },
+    { 999628998628371, 1132836708493400, 2084741674517453, 469343353015612, 678782988708035 },
+    { 2189427607417022, 699801937082607, 412764402319267, 1478091893643349, 2244675696854460 }
+  },
+  {
+    { 1712292055966563, 204413590624874, 1405738637332841, 408981300829763, 861082219276721 },
+    { 508561155940631, 966928475686665, 2236717801150132, 424543858577297, 2089272956986143 },
+    { 221245220129925, 1156020201681217, 491145634799213, 542422431960839, 828100817819207 }
+  },
+  {
+    { 153756971240384, 1299874139923977, 393099165260502, 1058234455773022, 996989038681183 },
+    { 559086812798481, 573177704212711, 1629737083816402, 1399819713462595, 1646954378266038 },
+    { 1887963056288059, 228507035730124, 1468368348640282, 930557653420194, 613513962454686 }
+  },
+  {
+    { 1224529808187553, 1577022856702685, 2206946542980843, 625883007765001, 279930793512158 },
+    { 1076287717051609, 1114455570543035, 187297059715481, 250446884292121, 1885187512550540 },
+    { 902497362940219, 76749815795675, 1657927525633846, 1420238379745202, 1340321636548352 }
+  },
+  {
+    { 1129576631190784, 1281994010027327, 996844254743018, 257876363489249, 1150850742055018 },
+    { 628740660038789, 1943038498527841, 467786347793886, 1093341428303375, 235413859513003 },
+    { 237425418909360, 469614029179605, 1512389769174935, 1241726368345357, 441602891065214 }
+  }
+},
+{ /* 6/31 */
+  {
+    { 1736417953058555, 726531315520508, 1833335034432527, 1629442561574747, 624418919286085 },
+    { 1960754663920689, 497040957888962, 1909832851283095, 1271432136996826, 2219780368020940 },
+    { 1537037379417136, 1358865369268262, 2130838645654099, 828733687040705, 1999987652890901 }
+  },
+  {
+    { 629042105241814, 1098854999137608, 887281544569320, 1423102019874777, 7911258951561 },
+    { 1811562332665373, 1501882019007673, 2213763501088999, 359573079719636, 36370565049116 },
+    { 218907117361280, 1209298913016966, 1944312619096112, 1130690631451061, 1342327389191701 }
+  },
+  {
+    { 1369976867854704, 1396479602419169, 1765656654398856, 2203659200586299, 998327836117241 },
+    { 2230701885562825, 1348173180338974, 2172856128624598, 1426538746123771, 444193481326151 },
+    { 784210426627951, 918204562375674, 1284546780452985, 1324534636134684, 1872449409642708 }
+  },
+  {
+    { 319638829540294, 596282656808406, 2037902696412608, 1557219121643918, 341938082688094 },
+    { 1901860206695915, 2004489122065736, 1625847061568236, 973529743399879, 2075287685312905 },
+    { 1371853944110545, 1042332820512553, 1949855697918254, 1791195775521505, 37487364849293 }
+  },
+  {
+    { 687200189577855, 1082536651125675, 644224940871546, 340923196057951, 343581346747396 },
+    { 2082717129583892, 27829425539422, 145655066671970, 1690527209845512, 1865260509673478 },
+    { 1059729620568824, 2163709103470266, 1440302280256872, 1769143160546397, 869830310425069 }
+  },
+  {
+    { 1609516219779025, 777277757338817, 2101121130363987, 550762194946473, 1905542338659364 },
+    { 2024821921041576, 426948675450149, 595133284085473, 471860860885970, 600321679413000 },
+    { 598474602406721, 1468128276358244, 1191923149557635, 1501376424093216, 1281662691293476 }
+  },
+  {
+    { 1721138489890707, 1264336102277790, 433064545421287, 1359988423149466, 1561871293409447 },
+    { 719520245587143, 393380711632345, 132350400863381, 1543271270810729, 1819543295798660 },
+    { 396397949784152, 1811354474471839, 1362679985304303, 2117033964846756, 498041172552279 }
+  },
+  {
+    { 1812471844975748, 1856491995543149, 126579494584102, 1036244859282620, 1975108050082550 },
+    { 650623932407995, 1137551288410575, 2125223403615539, 1725658013221271, 2134892965117796 },
+    { 522584000310195, 1241762481390450, 1743702789495384, 2227404127826575, 1686746002148897 }
+  }
+},
+{ /* 7/31 */
+  {
+    { 427904865186312, 1703211129693455, 1585368107547509, 1436984488744336, 761188534613978 },
+    { 318101947455002, 248138407995851, 1481904195303927, 309278454311197, 1258516760217879 },
+    { 1275068538599310, 513726919533379, 349926553492294, 688428871968420, 1702400196000666 }
+  },
+  {
+    { 1061864036265233, 961611260325381, 321859632700838, 1045600629959517, 1985130202504038 },
+    { 1558816436882417, 1962896332636523, 1337709822062152, 1501413830776938, 294436165831932 },
+    { 818359826554971, 1862173000996177, 626821592884859, 573655738872376, 1749691246745455 }
+  },
+  {
+    { 1988022651432119, 1082111498586040, 1834020786104821, 1454826876423687, 692929915223122 },
+    { 2146513703733331, 584788900394667, 464965657279958, 2183973639356127, 238371159456790 },
+    { 1129007025494441, 2197883144413266, 265142755578169, 971864464758890, 1983715884903702 }
+  },
+  {
+    { 1291366624493075, 381456718189114, 1711482489312444, 1815233647702022, 892279782992467 },
+    { 444548969917454, 1452286453853356, 2113731441506810, 645188273895859, 810317625309512 },
+    { 2242724082797924, 1373354730327868, 1006520110883049, 2147330369940688, 1151816104883620 }
+  },
+  {
+    { 1745720200383796, 1911723143175317, 2056329390702074, 355227174309849, 879232794371100 },
+    { 163723479936298, 115424889803150, 1156016391581227, 1894942220753364, 1970549419986329 },
+    { 681981452362484, 267208874112496, 1374683991933094, 638600984916117, 646178654558546 }
+  },
+  {
+    { 13378654854251, 106237307029567, 1944412051589651, 1841976767925457, 230702819835573 },
+    { 260683893467075, 854060306077237, 913639551980112, 4704576840123, 280254810808712 },
+    { 715374893080287, 1173334812210491, 1806524662079626, 1894596008000979, 398905715033393 }
+  },
+  {
+    { 500026409727661, 1596431288195371, 1420380351989370, 985211561521489, 392444930785633 },
+    { 2096421546958141, 1922523000950363, 789831022876840, 427295144688779, 320923973161730 },
+    { 1927770723575450, 1485792977512719, 1850996108474547, 551696031508956, 2126047405475647 }
+  },
+  {
+    { 2112099158080148, 742570803909715, 6484558077432, 1951119898618916, 93090382703416 },
+    { 383905201636970, 859946997631870, 855623867637644, 1017125780577795, 794250831877809 },
+    { 77571826285752, 999304298101753, 487841111777762, 1038031143212339, 339066367948762 }
+  }
+},
+{ /* 8/31 */
+  {
+    { 674994775520533, 266035846330789, 826951213393478, 1405007746162285, 1781791018620876 },
+    { 1001412661522686, 348196197067298, 1666614366723946, 888424995032760, 580747687801357 },
+    { 1939560076207777, 1409892634407635, 552574736069277, 383854338280405, 190706709864139 }
+  },
+  {
+    { 2177087163428741, 1439255351721944, 1208070840382793, 2230616362004769, 1396886392021913 },
+    { 676962063230039, 1880275537148808, 2046721011602706, 888463247083003, 1318301552024067 },
+    { 1466980508178206, 617045217998949, 652303580573628, 757303753529064, 207583137376902 }
+  },
+  {
+    { 1511056752906902, 105403126891277, 493434892772846, 1091943425335976, 1802717338077427 },
+    { 1853982405405128, 1878664056251147, 1528011020803992, 1019626468153565, 1128438412189035 },
+    { 1963939888391106, 293456433791664, 697897559513649, 985882796904380, 796244541237972 }
+  },
+  {
+    { 416770998629779, 389655552427054, 1314476859406756, 1749382513022778, 1161905598739491 },
+    { 1428358296490651, 1027115282420478, 304840698058337, 441410174026628, 1819358356278573 },
+    { 204943430200135, 1554861433819175, 216426658514651, 264149070665950, 2047097371738319 }
+  },
+  {
+    { 1934415182909034, 1393285083565062, 516409331772960, 1157690734993892, 121039666594268 },
+    { 662035583584445, 286736105093098, 1131773000510616, 818494214211439, 472943792054479 },
+    { 665784778135882, 1893179629898606, 808313193813106, 276797254706413, 1563426179676396 }
+  },
+  {
+    { 945205108984232, 526277562959295, 1324180513733566, 1666970227868664, 153547609289173 },
+    { 2031433403516252, 203996615228162, 170487168837083, 981513604791390, 843573964916831 },
+    { 1476570093962618, 838514669399805, 1857930577281364, 2017007352225784, 317085545220047 }
+  },
+  {
+    { 1461557121912842, 1600674043318359, 2157134900399597, 1670641601940616, 127765583803283 },
+    { 1293543509393474, 2143624609202546, 1058361566797508, 214097127393994, 946888515472729 },
+    { 357067959932916, 1290876214345711, 521245575443703, 1494975468601005, 800942377643885 }
+  },
+  {
+    { 566116659100033, 820247422481740, 994464017954148, 327157611686365, 92591318111744 },
+    { 617256647603209, 1652107761099439, 1857213046645471, 1085597175214970, 817432759830522 },
+    { 771808161440705, 1323510426395069, 680497615846440, 851580615547985, 1320806384849017 }
+  }
+},
+{ /* 9/31 */
+  {
+    { 1219260086131915, 647169006596815, 79601124759706, 2161724213426748, 404861897060198 },
+    { 1327968293887866, 1335500852943256, 1401587164534264, 558137311952440, 1551360549268902 },
+    { 417621685193956, 1429953819744454, 396157358457099, 1940470778873255, 214000046234152 }
+  },
+  {
+    { 1268047918491973, 2172375426948536, 1533916099229249, 1761293575457130, 1590622667026765 },
+    { 1627072914981959, 2211603081280073, 1912369601616504, 1191770436221309, 2187309757525860 },
+    { 1149147819689533, 378692712667677, 828475842424202, 2218619146419342, 70688125792186 }
+  },
+  {
+    { 1299739417079761, 1438616663452759, 1536729078504412, 2053896748919838, 1008421032591246 },
+    { 2040723824657366, 399555637875075, 632543375452995, 872649937008051, 1235394727030233 },
+    { 2211311599327900, 2139787259888175, 938706616835350, 12609661139114, 2081897930719789 }
+  },
+  {
+    { 1324994503390450, 336982330582631, 1183998925654177, 1091654665913274, 48727673971319 },
+    { 1845522914617879, 1222198248335542, 150841072760134, 1927029069940982, 1189913404498011 },
+    { 1079559557592645, 2215338383666441, 1903569501302605, 49033973033940, 305703433934152 }
+  },
+  {
+    { 94653405416909, 1386121349852999, 1062130477891762, 36553947479274, 833669648948846 },
+    { 1432015813136298, 440364795295369, 1395647062821501, 1976874522764578, 934452372723352 },
+    { 1296625309219774, 2068273464883862, 1858621048097805, 1492281814208508, 2235868981918946 }
+  },
+  {
+    { 1490330266465570, 1858795661361448, 1436241134969763, 294573218899647, 1208140011028933 },
+    { 1282462923712748, 741885683986255, 2027754642827561, 518989529541027, 1826610009555945 },
+    { 1525827120027511, 723686461809551, 1597702369236987, 244802101764964, 1502833890372311 }
+  },
+  {
+    { 113622036244513, 1233740067745854, 674109952278496, 2114345180342965, 166764512856263 },
+    { 2041668749310338, 2184405322203901, 1633400637611036, 2110682505536899, 2048144390084644 },
+    { 503058759232932, 760293024620937, 2027152777219493, 666858468148475, 1539184379870952 }
+  },
+  {
+    { 1916168475367211, 915626432541343, 883217071712575, 363427871374304, 1976029821251593 },
+    { 678039535434506, 570587290189340, 1605302676614120, 2147762562875701, 1706063797091704 },
+    { 1439489648586438, 2194580753290951, 832380563557396, 561521973970522, 584497280718389 }
+  }
+},
+{ /* 10/31 */
+  {
+    { 187989455492609, 681223515948275, 1933493571072456, 1872921007304880, 488162364135671 },
+    { 1413466089534451, 410844090765630, 1397263346404072, 408227143123410, 1594561803147811 },
+    { 2102170800973153, 719462588665004, 1479649438510153, 1097529543970028, 1302363283777685 }
+  },
+  {
+    { 942065717847195, 1069313679352961, 2007341951411051, 70973416446291, 1419433790163706 },
+    { 1146565545556377, 1661971299445212, 406681704748893, 564452436406089, 1109109865829139 },
+    { 2214421081775077, 1165671861210569, 1890453018796184, 3556249878661, 442116172656317 }
+  },
+  {
+    { 753830546620811, 1666955059895019, 1530775289309243, 1119987029104146, 2164156153857580 },
+    { 615171919212796, 1523849404854568, 854560460547503, 2067097370290715, 1765325848586042 },
+    { 1094538949313667, 1796592198908825, 870221004284388, 2025558921863561, 1699010892802384 }
+  },
+  {
+    { 1951351290725195, 1916457206844795, 198025184438026, 1909076887557595, 1938542290318919 },
+    { 1014323197538413, 869150639940606, 1756009942696599, 1334952557375672, 1544945379082874 },
+    { 764055910920305, 1603590757375439, 146805246592357, 1843313433854297, 954279890114939 }
+  },
+  {
+    { 80113526615750, 764536758732259, 1055139345100233, 469252651759390, 617897512431515 },
+    { 74497112547268, 740094153192149, 1745254631717581, 727713886503130, 1283034364416928 },
+    { 525892105991110, 1723776830270342, 1476444848991936, 573789489857760, 133864092632978 }
+  },
+  {
+    { 542611720192581, 1986812262899321, 1162535242465837, 481498966143464, 544600533583622 },
+    { 64123227344372, 1239927720647794, 1360722983445904, 222610813654661, 62429487187991 },
+    { 1793193323953132, 91096687857833, 70945970938921, 2158587638946380, 1537042406482111 }
+  },
+  {
+    { 1895854577604609, 1394895708949416, 1728548428495944, 1140864900240149, 563645333603061 },
+    { 141358280486863, 91435889572504, 1087208572552643, 1829599652522921, 1193307020643647 },
+    { 1611230858525381, 950720175540785, 499589887488610, 2001656988495019, 88977313255908 }
+  },
+  {
+    { 1189080501479658, 2184348804772597, 1040818725742319, 2018318290311834, 1712060030915354 },
+    { 873966876953756, 1090638350350440, 1708559325189137, 672344594801910, 1320437969700239 },
+    { 1508590048271766, 1131769479776094, 101550868699323, 428297785557897, 561791648661744 }
+  }
+},
+{ /* 11/31 */
+  {
+    { 756417570499462, 237882279232602, 2136263418594016, 1701968045454886, 703713185137472 },
+    { 1781187809325462, 1697624151492346, 1381393690939988, 175194132284669, 1483054666415238 },
+    { 2175517777364616, 708781536456029, 955668231122942, 1967557500069555, 2021208005604118 }
+  },
+  {
+    { 1115135966606887, 224217372950782, 915967306279222, 593866251291540, 561747094208006 },
+    { 1443163092879439, 391875531646162, 2180847134654632, 464538543018753, 1594098196837178 },
+    { 850858855888869, 319436476624586, 327807784938441, 740785849558761, 17128415486016 }
+  },
+  {
+    { 2132756334090067, 536247820155645, 48907151276867, 608473197600695, 1261689545022784 },
+    { 1525176236978354, 974205476721062, 293436255662638, 148269621098039, 137961998433963 },
+    { 1121075518299410, 2071745529082111, 1265567917414828, 1648196578317805, 496232102750820 }
+  },
+  {
+    { 122321229299801, 1022922077493685, 2001275453369484, 2017441881607947, 993205880778002 },
+    { 654925550560074, 1168810995576858, 575655959430926, 905758704861388, 496774564663534 },
+    { 1954109525779738, 2117022646152485, 338102630417180, 1194140505732026, 107881734943492 }
+  },
+  {
+    { 1714785840001267, 2036500018681589, 1876380234251966, 2056717182974196, 1645855254384642 },
+    { 106431476499341, 62482972120563, 1513446655109411, 807258751769522, 538491469114 },
+    { 2002850762893643, 1243624520538135, 1486040410574605, 2184752338181213, 378495998083531 }
+  },
+  {
+    { 922510868424903, 1089502620807680, 402544072617374, 1131446598479839, 1290278588136533 },
+    { 1867998812076769, 715425053580701, 39968586461416, 2173068014586163, 653822651801304 },
+    { 162892278589453, 182585796682149, 75093073137630, 497037941226502, 133871727117371 }
+  },
+  {
+    { 1914596576579670, 1608999621851578, 1987629837704609, 1519655314857977, 1819193753409464 },
+    { 1949315551096831, 1069003344994464, 1939165033499916, 1548227205730856, 1933767655861407 },
+    { 1730519386931635, 1393284965610134, 1597143735726030, 416032382447158, 1429665248828629 }
+  },
+  {
+    { 360275475604565, 547835731063078, 215360904187529, 596646739879007, 332709650425085 },
+    { 47602113726801, 1522314509708010, 437706261372925, 814035330438027, 335930650933545 },
+    { 1291597595523886, 1058020588994081, 402837842324045, 1363323695882781, 2105763393033193 }
+  }
+},
+{ /* 12/31 */
+  {
+    { 109521982566564, 1715257748585139, 1112231216891516, 2046641005101484, 134249157157013 },
+    { 2156991030936798, 2227544497153325, 1869050094431622, 754875860479115, 1754242344267058 },
+    { 1846089562873800, 98894784984326, 1412430299204844, 171351226625762, 1100604760929008 }
+  },
+  {
+    { 84172382130492, 499710970700046, 425749630620778, 1762872794206857, 612842602127960 },
+    { 868309334532756, 1703010512741873, 1952690008738057, 4325269926064, 2071083554962116 },
+    { 523094549451158, 401938899487815, 1407690589076010, 2022387426254453, 158660516411257 }
+  },
+  {
+    { 612867287630009, 448212612103814, 571629077419196, 1466796750919376, 1728478129663858 },
+    { 1723848973783452, 2208822520534681, 1718748322776940, 1974268454121942, 1194212502258141 },
+    { 1254114807944608, 977770684047110, 2010756238954993, 1783628927194099, 1525962994408256 }
+  },
+  {
+    { 232464058235826, 1948628555342434, 1835348780427694, 1031609499437291, 64472106918373 },
+    { 767338676040683, 754089548318405, 1523192045639075, 435746025122062, 512692508440385 },
+    { 1255955808701983, 1700487367990941, 1166401238800299, 1175121994891534, 1190934801395380 }
+  },
+  {
+    { 349144008168292, 1337012557669162, 1475912332999108, 1321618454900458, 47611291904320 },
+    { 877519947135419, 2172838026132651, 272304391224129, 1655143327559984, 886229406429814 },
+    { 375806028254706, 214463229793940, 572906353144089, 572168269875638, 697556386112979 }
+  },
+  {
+    { 1168827102357844, 823864273033637, 2071538752104697, 788062026895924, 599578340743362 },
+    { 1948116082078088, 2054898304487796, 2204939184983900, 210526805152138, 786593586607626 },
+    { 1915320147894736, 156481169009469, 655050471180417, 592917090415421, 2165897438660879 }
+  },
+  {
+    { 1726336468579724, 1119932070398949, 1929199510967666, 33918788322959, 1836837863503150 },
+    { 829996854845988, 217061778005138, 1686565909803640, 1346948817219846, 1723823550730181 },
+    { 384301494966394, 687038900403062, 2211195391021739, 254684538421383, 1245698430589680 }
+  },
+  {
+    { 1247567493562688, 1978182094455847, 183871474792955, 806570235643435, 288461518067916 },
+    { 1449077384734201, 38285445457996, 2136537659177832, 2146493000841573, 725161151123125 },
+    { 1201928866368855, 800415690605445, 1703146756828343, 997278587541744, 1858284414104014 }
+  }
+},
+{ /* 13/31 */
+  {
+    { 356468809648877, 782373916933152, 1718002439402870, 1392222252219254, 663171266061951 },
+    { 759628738230460, 1012693474275852, 353780233086498, 246080061387552, 2030378857679162 },
+    { 2040672435071076, 888593182036908, 1298443657189359, 1804780278521327, 354070726137060 }
+  },
+  {
+    { 1894938527423184, 1463213041477277, 474410505497651, 247294963033299, 877975941029128 },
+    { 207937160991127, 12966911039119, 820997788283092, 1010440472205286, 1701372890140810 },
+    { 218882774543183, 533427444716285, 1233243976733245, 435054256891319, 1509568989549904 }
+  },
+  {
+    { 1888838535711826, 1052177758340622, 1213553803324135, 169182009127332, 463374268115872 },
+    { 299137589460312, 1594371588983567, 868058494039073, 257771590636681, 1805012993142921 },
+    { 1806842755664364, 2098896946025095, 1356630998422878, 1458279806348064, 347755825962072 }
+  },
+  {
+    { 1402334161391744, 1560083671046299, 1008585416617747, 1147797150908892, 1420416683642459 },
+    { 665506704253369, 273770475169863, 799236974202630, 848328990077558, 1811448782807931 },
+    { 1468412523962641, 771866649897997, 1931766110147832, 799561180078482, 524837559150077 }
+  },
+  {
+    { 2223212657821850, 630416247363666, 2144451165500328, 816911130947791, 1024351058410032 },
+    { 1266603897524861, 156378408858100, 1275649024228779, 447738405888420, 253186462063095 },
+    { 2022215964509735, 136144366993649, 1800716593296582, 1193970603800203, 871675847064218 }
+  },
+  {
+    { 1862751661970328, 851596246739884, 1519315554814041, 1542798466547449, 1417975335901520 },
+    { 1228168094547481, 334133883362894, 587567568420081, 433612590281181, 603390400373205 },
+    { 121893973206505, 1843345804916664, 1703118377384911, 497810164760654, 101150811654673 }
+  },
+  {
+    { 458346255946468, 290909935619344, 1452768413850679, 550922875254215, 1537286854336538 },
+    { 584322311184395, 380661238802118, 114839394528060, 655082270500073, 2111856026034852 },
+    { 996965581008991, 2148998626477022, 1012273164934654, 1073876063914522, 1688031788934939 }
+  },
+  {
+    { 923487018849600, 2085106799623355, 528082801620136, 1606206360876188, 735907091712524 },
+    { 1697697887804317, 1335343703828273, 831288615207040, 949416685250051, 288760277392022 },
+    { 1419122478109648, 1325574567803701, 602393874111094, 2107893372601700, 1314159682671307 }
+  }
+},
+{ /* 14/31 */
+  {
+    { 2201150872731804, 2180241023425241, 97663456423163, 1633405770247824, 848945042443986 },
+    { 1173339555550611, 818605084277583, 47521504364289, 924108720564965, 735423405754506 },
+    { 830104860549448, 1886653193241086, 1600929509383773, 1475051275443631, 286679780900937 }
+  },
+  {
+    { 1577111294832995, 1030899169768747, 144900916293530, 1964672592979567, 568390100955250 },
+    { 278388655910247, 487143369099838, 927762205508727, 181017540174210, 1616886700741287 },
+    { 1191033906638969, 940823957346562, 1606870843663445, 861684761499847, 658674867251089 }
+  },
+  {
+    { 1875032594195546, 1427106132796197, 724736390962158, 901860512044740, 635268497268760 },
+    { 622869792298357, 1903919278950367, 1922588621661629, 1520574711600434, 1087100760174640 },
+    { 25465949416618, 1693639527318811, 1526153382657203, 125943137857169, 145276964043999 }
+  },
+  {
+    { 214739857969358, 920212862967915, 1939901550972269, 1211862791775221, 85097515720120 },
+    { 2006245852772938, 734762734836159, 254642929763427, 1406213292755966, 239303749517686 },
+    { 1619678837192149, 1919424032779215, 1357391272956794, 1525634040073113, 1310226789796241 }
+  },
+  {
+    { 1040763709762123, 1704449869235352, 605263070456329, 1998838089036355, 1312142911487502 },
+    { 1996723311435669, 1844342766567060, 985455700466044, 1165924681400960, 311508689870129 },
+    { 43173156290518, 2202883069785309, 1137787467085917, 1733636061944606, 1394992037553852 }
+  },
+  {
+    { 670078326344559, 555655025059356, 471959386282438, 2141455487356409, 849015953823125 },
+    { 2197214573372804, 794254097241315, 1030190060513737, 267632515541902, 2040478049202624 },
+    { 1812516004670529, 1609256702920783, 1706897079364493, 258549904773295, 996051247540686 }
+  },
+  {
+    { 1540374301420584, 1764656898914615, 1810104162020396, 923808779163088, 664390074196579 },
+    { 1323460699404750, 1262690757880991, 871777133477900, 1060078894988977, 1712236889662886 },
+    { 1696163952057966, 1391710137550823, 608793846867416, 1034391509472039, 1780770894075012 }
+  },
+  {
+    { 1367603834210841, 2131988646583224, 890353773628144, 1908908219165595, 270836895252891 },
+    { 597536315471731, 40375058742586, 1942256403956049, 1185484645495932, 312666282024145 },
+    { 1919411405316294, 1234508526402192, 1066863051997083, 1008444703737597, 1348810787701552 }
+  }
+},
+{ /* 15/31 */
+  {
+    { 2102881477513865, 1570274565945361, 1573617900503708, 18662635732583, 2232324307922098 },
+    { 1853931367696942, 8107973870707, 350214504129299, 775206934582587, 1752317649166792 },
+    { 1417148368003523, 721357181628282, 505725498207811, 373232277872983, 261634707184480 }
+  },
+  {
+    { 2186733281493267, 2250694917008620, 1014829812957440, 479998161452389, 83566193876474 },
+    { 1268116367301224, 560157088142809, 802626839600444, 2210189936605713, 1129993785579988 },
+    { 615183387352312, 917611676109240, 878893615973325, 978940963313282, 938686890583575 }
+  },
+  {
+    { 522024729211672, 1045059315315808, 1892245413707790, 1907891107684253, 2059998109500714 },
+    { 1799679152208884, 912132775900387, 25967768040979, 432130448590461, 274568990261996 },
+    { 98698809797682, 2144627600856209, 1907959298569602, 811491302610148, 1262481774981493 }
+  },
+  {
+    { 1791451399743152, 1713538728337276, 118349997257490, 1882306388849954, 158235232210248 },
+    { 1217809823321928, 2173947284933160, 1986927836272325, 1388114931125539, 12686131160169 },
+    { 1650875518872272, 1136263858253897, 1732115601395988, 734312880662190, 1252904681142109 }
+  },
+  {
+    { 372986456113865, 525430915458171, 2116279931702135, 501422713587815, 1907002872974925 },
+    { 803147181835288, 868941437997146, 316299302989663, 943495589630550, 571224287904572 },
+    { 227742695588364, 1776969298667369, 628602552821802, 457210915378118, 2041906378111140 }
+  },
+  {
+    { 815000523470260, 913085688728307, 1052060118271173, 1345536665214223, 541623413135555 },
+    { 1580216071604333, 1877997504342444, 857147161260913, 703522726778478, 2182763974211603 },
+    { 1870080310923419, 71988220958492, 1783225432016732, 615915287105016, 1035570475990230 }
+  },
+  {
+    { 730987750830150, 857613889540280, 1083813157271766, 1002817255970169, 1719228484436074 },
+    { 377616581647602, 1581980403078513, 804044118130621, 2034382823044191, 643844048472185 },
+    { 176957326463017, 1573744060478586, 528642225008045, 1816109618372371, 1515140189765006 }
+  },
+  {
+    { 1888911448245718, 1387110895611080, 1924503794066429, 1731539523700949, 2230378382645454 },
+    { 443392177002051, 233793396845137, 2199506622312416, 1011858706515937, 974676837063129 },
+    { 1846351103143623, 1949984838808427, 671247021915253, 1946756846184401, 1929296930380217 }
+  }
+},
+{ /* 16/31 */
+  {
+    { 849646212452002, 1410198775302919, 73767886183695, 1641663456615812, 762256272452411 },
+    { 692017667358279, 723305578826727, 1638042139863265, 748219305990306, 334589200523901 },
+    { 22893968530686, 2235758574399251, 1661465835630252, 925707319443452, 1203475116966621 }
+  },
+  {
+    { 801299035785166, 1733292596726131, 1664508947088596, 467749120991922, 1647498584535623 },
+    { 903105258014366, 427141894933047, 561187017169777, 1884330244401954, 1914145708422219 },
+    { 1344191060517578, 1960935031767890, 1518838929955259, 1781502350597190, 1564784025565682 }
+  },
+  {
+    { 673723351748086, 1979969272514923, 1175287312495508, 1187589090978666, 1881897672213940 },
+    { 1917185587363432, 1098342571752737, 5935801044414, 2000527662351839, 1538640296181569 },
+    { 2495540013192, 678856913479236, 224998292422872, 219635787698590, 1972465269000940 }
+  },
+  {
+    { 271413961212179, 1353052061471651, 344711291283483, 2014925838520662, 2006221033113941 },
+    { 194583029968109, 514316781467765, 829677956235672, 1676415686873082, 810104584395840 },
+    { 1980510813313589, 1948645276483975, 152063780665900, 129968026417582, 256984195613935 }
+  },
+  {
+    { 1860190562533102, 1936576191345085, 461100292705964, 1811043097042830, 957486749306835 },
+    { 796664815624365, 1543160838872951, 1500897791837765, 1667315977988401, 599303877030711 },
+    { 1151480509533204, 2136010406720455, 738796060240027, 319298003765044, 1150614464349587 }
+  },
+  {
+    { 1731069268103150, 735642447616087, 1364750481334268, 417232839982871, 927108269127661 },
+    { 1017222050227968, 1987716148359, 2234319589635701, 621282683093392, 2132553131763026 },
+    { 1567828528453324, 1017807205202360, 565295260895298, 829541698429100, 307243822276582 }
+  },
+  {
+    { 249079270936248, 1501514259790706, 947909724204848, 944551802437487, 552658763982480 },
+    { 2089966982947227, 1854140343916181, 2151980759220007, 2139781292261749, 158070445864917 },
+    { 1338766321464554, 1906702607371284, 1519569445519894, 115384726262267, 1393058953390992 }
+  },
+  {
+    { 1364621558265400, 1512388234908357, 1926731583198686, 2041482526432505, 920401122333774 },
+    { 1884844597333588, 601480070269079, 620203503079537, 1079527400117915, 1202076693132015 },
+    { 840922919763324, 727955812569642, 1303406629750194, 522898432152867, 294161410441865 }
+  }
+},
+{ /* 17/31 */
+  {
+    { 353760790835310, 1598361541848743, 1122905698202299, 1922533590158905, 419107700666580 },
+    { 359856369838236, 180914355488683, 861726472646627, 218807937262986, 575626773232501 },
+    { 755467689082474, 909202735047934, 730078068932500, 936309075711518, 2007798262842972 }
+  },
+  {
+    { 1609384177904073, 362745185608627, 1335318541768201, 800965770436248, 547877979267412 },
+    { 984339177776787, 815727786505884, 1645154585713747, 1659074964378553, 1686601651984156 },
+    { 1697863093781930, 599794399429786, 1104556219769607, 830560774794755, 12812858601017 }
+  },
+  {
+    { 1168737550514982, 897832437380552, 463140296333799, 302564600022547, 2008360505135501 },
+    { 1856930662813910, 678090852002597, 1920179140755167, 1259527833759868, 55540971895511 },
+    { 1158643631044921, 476554103621892, 178447851439725, 1305025542653569, 103433927680625 }
+  },
+  {
+    { 2176793111709008, 1576725716350391, 2009350167273523, 2012390194631546, 2125297410909580 },
+    { 825403285195098, 2144208587560784, 1925552004644643, 1915177840006985, 1015952128947864 },
+    { 1807108316634472, 1534392066433717, 347342975407218, 1153820745616376, 7375003497471 }
+  },
+  {
+    { 983061001799725, 431211889901241, 2201903782961093, 817393911064341, 2214616493042167 },
+    { 228567918409756, 865093958780220, 358083886450556, 159617889659320, 1360637926292598 },
+    { 234147501399755, 2229469128637390, 2175289352258889, 1397401514549353, 1885288963089922 }
+  },
+  {
+    { 1111762412951562, 252849572507389, 1048714233823341, 146111095601446, 1237505378776770 },
+    { 1113790697840279, 1051167139966244, 1045930658550944, 2011366241542643, 1686166824620755 },
+    { 1054097349305049, 1872495070333352, 182121071220717, 1064378906787311, 100273572924182 }
+  },
+  {
+    { 1306410853171605, 1627717417672447, 50983221088417, 1109249951172250, 870201789081392 },
+    { 104233794644221, 1548919791188248, 2224541913267306, 2054909377116478, 1043803389015153 },
+    { 216762189468802, 707284285441622, 190678557969733, 973969342604308, 1403009538434867 }
+  },
+  {
+    { 1279024291038477, 344776835218310, 273722096017199, 1834200436811442, 634517197663804 },
+    { 343805853118335, 1302216857414201, 566872543223541, 2051138939539004, 321428858384280 },
+    { 470067171324852, 1618629234173951, 2000092177515639, 7307679772789, 1117521120249968 }
+  }
+},
+{ /* 18/31 */
+  {
+    { 278151578291475, 1810282338562947, 1771599529530998, 1383659409671631, 685373414471841 },
+    { 577009397403102, 1791440261786291, 2177643735971638, 174546149911960, 1412505077782326 },
+    { 893719721537457, 1201282458018197, 1522349501711173, 58011597740583, 1130406465887139 }
+  },
+  {
+    { 412607348255453, 1280455764199780, 2233277987330768, 14180080401665, 331584698417165 },
+    { 262483770854550, 990511055108216, 526885552771698, 571664396646158, 354086190278723 },
+    { 1820352417585487, 24495617171480, 1547899057533253, 10041836186225, 480457105094042 }
+  },
+  {
+    { 2023310314989233, 637905337525881, 2106474638900687, 557820711084072, 1687858215057826 },
+    { 1144168702609745, 604444390410187, 1544541121756138, 1925315550126027, 626401428894002 },
+    { 1922168257351784, 2018674099908659, 1776454117494445, 956539191509034, 36031129147635 }
+  },
+  {
+    { 544644538748041, 1039872944430374, 876750409130610, 710657711326551, 1216952687484972 },
+    { 58242421545916, 2035812695641843, 2118491866122923, 1191684463816273, 46921517454099 },
+    { 272268252444639, 1374166457774292, 2230115177009552, 1053149803909880, 1354288411641016 }
+  },
+  {
+    { 1857910905368338, 1754729879288912, 885945464109877, 1516096106802166, 1602902393369811 },
+    { 1193437069800958, 901107149704790, 999672920611411, 477584824802207, 364239578697845 },
+    { 886299989548838, 1538292895758047, 1590564179491896, 1944527126709657, 837344427345298 }
+  },
+  {
+    { 754558365378305, 1712186480903618, 1703656826337531, 750310918489786, 518996040250900 },
+    { 1309847803895382, 1462151862813074, 211370866671570, 1544595152703681, 1027691798954090 },
+    { 803217563745370, 1884799722343599, 1357706345069218, 2244955901722095, 730869460037413 }
+  },
+  {
+    { 689299471295966, 1831210565161071, 1375187341585438, 1106284977546171, 1893781834054269 },
+    { 696351368613042, 1494385251239250, 738037133616932, 636385507851544, 927483222611406 },
+    { 1949114198209333, 1104419699537997, 783495707664463, 1747473107602770, 2002634765788641 }
+  },
+  {
+    { 1607325776830197, 530883941415333, 1451089452727895, 1581691157083423, 496100432831154 },
+    { 1068900648804224, 2006891997072550, 1134049269345549, 1638760646180091, 2055396084625778 },
+    { 2222475519314561, 1870703901472013, 1884051508440561, 1344072275216753, 1318025677799069 }
+  }
+},
+{ /* 19/31 */
+  {
+    { 155711679280656, 681100400509288, 389811735211209, 2135723811340709, 408733211204125 },
+    { 7813206966729, 194444201427550, 2071405409526507, 1065605076176312, 1645486789731291 },
+    { 16625790644959, 1647648827778410, 1579910185572704, 436452271048548, 121070048451050 }
+  },
+  {
+    { 1037263028552531, 568385780377829, 297953104144430, 1558584511931211, 2238221839292471 },
+    { 190565267697443, 672855706028058, 338796554369226, 337687268493904, 853246848691734 },
+    { 1763863028400139, 766498079432444, 1321118624818005, 69494294452268, 858786744165651 }
+  },
+  {
+    { 1292056768563024, 1456632109855638, 1100631247050184, 1386133165675321, 1232898350193752 },
+    { 366253102478259, 525676242508811, 1449610995265438, 1183300845322183, 185960306491545 },
+    { 28315355815982, 460422265558930, 1799675876678724, 1969256312504498, 1051823843138725 }
+  },
+  {
+    { 156914999361983, 1606148405719949, 1665208410108430, 317643278692271, 1383783705665320 },
+    { 54684536365732, 2210010038536222, 1194984798155308, 535239027773705, 1516355079301361 },
+    { 1484387703771650, 198537510937949, 2186282186359116, 617687444857508, 647477376402122 }
+  },
+  {
+    { 2147715541830533, 500032538445817, 646380016884826, 352227855331122, 1488268620408052 },
+    { 159386186465542, 1877626593362941, 618737197060512, 1026674284330807, 1158121760792685 },
+    { 1744544377739822, 1964054180355661, 1685781755873170, 2169740670377448, 1286112621104591 }
+  },
+  {
+    { 81977249784993, 1667943117713086, 1668983819634866, 1605016835177615, 1353960708075544 },
+    { 1602253788689063, 439542044889886, 2220348297664483, 657877410752869, 157451572512238 },
+    { 1029287186166717, 65860128430192, 525298368814832, 1491902500801986, 1461064796385400 }
+  },
+  {
+    { 408216988729246, 2121095722306989, 913562102267595, 1879708920318308, 241061448436731 },
+    { 1185483484383269, 1356339572588553, 584932367316448, 102132779946470, 1792922621116791 },
+    { 1966196870701923, 2230044620318636, 1425982460745905, 261167817826569, 46517743394330 }
+  },
+  {
+    { 107077591595359, 884959942172345, 27306869797400, 2224911448949390, 964352058245223 },
+    { 1730194207717538, 431790042319772, 1831515233279467, 1372080552768581, 1074513929381760 },
+    { 1450880638731607, 1019861580989005, 1229729455116861, 1174945729836143, 826083146840706 }
+  }
+},
+{ /* 20/31 */
+  {
+    { 1899935429242705, 1602068751520477, 940583196550370, 82431069053859, 1540863155745696 },
+    { 2136688454840028, 2099509000964294, 1690800495246475, 1217643678575476, 828720645084218 },
+    { 765548025667841, 462473984016099, 998061409979798, 546353034089527, 2212508972466858 }
+  },
+  {
+    { 46575283771160, 892570971573071, 1281983193144090, 1491520128287375, 75847005908304 },
+    { 1801436127943107, 1734436817907890, 1268728090345068, 167003097070711, 2233597765834956 },
+    { 1997562060465113, 1048700225534011, 7615603985628, 1855310849546841, 2242557647635213 }
+  },
+  {
+    { 1161017320376250, 492624580169043, 2169815802355237, 976496781732542, 1770879511019629 },
+    { 1357044908364776, 729130645262438, 1762469072918979, 1365633616878458, 181282906404941 },
+    { 1080413443139865, 1155205815510486, 1848782073549786, 622566975152580, 124965574467971 }
+  },
+  {
+    { 1184526762066993, 247622751762817, 692129017206356, 820018689412496, 2188697339828085 },
+    { 2020536369003019, 202261491735136, 1053169669150884, 2056531979272544, 778165514694311 },
+    { 237404399610207, 1308324858405118, 1229680749538400, 720131409105291, 1958958863624906 }
+  },
+  {
+    { 515583508038846, 17656978857189, 1717918437373989, 1568052070792483, 46975803123923 },
+    { 281527309158085, 36970532401524, 866906920877543, 2222282602952734, 1289598729589882 },
+    { 1278207464902042, 494742455008756, 1262082121427081, 1577236621659884, 1888786707293291 }
+  },
+  {
+    { 353042527954210, 1830056151907359, 1111731275799225, 174960955838824, 404312815582675 },
+    { 2064251142068628, 1666421603389706, 1419271365315441, 468767774902855, 191535130366583 },
+    { 1716987058588002, 1859366439773457, 1767194234188234, 64476199777924, 1117233614485261 }
+  },
+  {
+    { 984292135520292, 135138246951259, 2220652137473167, 1722843421165029, 190482558012909 },
+    { 298845952651262, 1166086588952562, 1179896526238434, 1347812759398693, 1412945390096208 },
+    { 1143239552672925, 906436640714209, 2177000572812152, 2075299936108548, 325186347798433 }
+  },
+  {
+    { 721024854374772, 684487861263316, 1373438744094159, 2193186935276995, 1387043709851261 },
+    { 418098668140962, 715065997721283, 1471916138376055, 2168570337288357, 937812682637044 },
+    { 1043584187226485, 2143395746619356, 2209558562919611, 482427979307092, 847556718384018 }
+  }
+},
+{ /* 21/31 */
+  {
+    { 1248731221520759, 1465200936117687, 540803492710140, 52978634680892, 261434490176109 },
+    { 1057329623869501, 620334067429122, 461700859268034, 2012481616501857, 297268569108938 },
+    { 1055352180870759, 1553151421852298, 1510903185371259, 1470458349428097, 1226259419062731 }
+  },
+  {
+    { 1492988790301668, 790326625573331, 1190107028409745, 1389394752159193, 1620408196604194 },
+    { 47000654413729, 1004754424173864, 1868044813557703, 173236934059409, 588771199737015 },
+    { 30498470091663, 1082245510489825, 576771653181956, 806509986132686, 1317634017056939 }
+  },
+  {
+    { 420308055751555, 1493354863316002, 165206721528088, 1884845694919786, 2065456951573059 },
+    { 1115636332012334, 1854340990964155, 83792697369514, 1972177451994021, 457455116057587 },
+    { 1698968457310898, 1435137169051090, 1083661677032510, 938363267483709, 340103887207182 }
+  },
+  {
+    { 1995325341336574, 911500251774648, 164010755403692, 855378419194762, 1573601397528842 },
+    { 241719380661528, 310028521317150, 1215881323380194, 1408214976493624, 2141142156467363 },
+    { 1315157046163473, 727368447885818, 1363466668108618, 1668921439990361, 1398483384337907 }
+  },
+  {
+    { 75029678299646, 1015388206460473, 1849729037055212, 1939814616452984, 444404230394954 },
+    { 2053597130993710, 2024431685856332, 2233550957004860, 2012407275509545, 872546993104440 },
+    { 1217269667678610, 599909351968693, 1390077048548598, 1471879360694802, 739586172317596 }
+  },
+  {
+    { 1718318639380794, 1560510726633958, 904462881159922, 1418028351780052, 94404349451937 },
+    { 2132502667405250, 214379346175414, 1502748313768060, 1960071701057800, 1353971822643138 },
+    { 319394212043702, 2127459436033571, 717646691535162, 663366796076914, 318459064945314 }
+  },
+  {
+    { 405989424923593, 1960452633787083, 667349034401665, 1492674260767112, 1451061489880787 },
+    { 947085906234007, 323284730494107, 1485778563977200, 728576821512394, 901584347702286 },
+    { 1575783124125742, 2126210792434375, 1569430791264065, 1402582372904727, 1891780248341114 }
+  },
+  {
+    { 838432205560695, 1997703511451664, 1018791879907867, 1662001808174331, 78328132957753 },
+    { 739152638255629, 2074935399403557, 505483666745895, 1611883356514088, 628654635394878 },
+    { 1822054032121349, 643057948186973, 7306757352712, 577249257962099, 284735863382083 }
+  }
+},
+{ /* 22/31 */
+  {
+    { 1366558556363930, 1448606567552086, 1478881020944768, 165803179355898, 1115718458123498 },
+    { 204146226972102, 1630511199034723, 2215235214174763, 174665910283542, 956127674017216 },
+    { 1562934578796716, 1070893489712745, 11324610642270, 958989751581897, 2172552325473805 }
+  },
+  {
+    { 1770564423056027, 735523631664565, 1326060113795289, 1509650369341127, 65892421582684 },
+    { 623682558650637, 1337866509471512, 990313350206649, 1314236615762469, 1164772974270275 },
+    { 223256821462517, 723690150104139, 1000261663630601, 933280913953265, 254872671543046 }
+  },
+  {
+    { 1969087237026041, 624795725447124, 1335555107635969, 2069986355593023, 1712100149341902 },
+    { 1236103475266979, 1837885883267218, 1026072585230455, 1025865513954973, 1801964901432134 },
+    { 1115241013365517, 1712251818829143, 2148864332502771, 2096001471438138, 2235017246626125 }
+  },
+  {
+    { 1299268198601632, 2047148477845621, 2165648650132450, 1612539282026145, 514197911628890 },
+    { 118352772338543, 1067608711804704, 1434796676193498, 1683240170548391, 230866769907437 },
+    { 1850689576796636, 1601590730430274, 1139674615958142, 1954384401440257, 76039205311 }
+  },
+  {
+    { 1723387471374172, 997301467038410, 533927635123657, 20928644693965, 1756575222802513 },
+    { 2146711623855116, 503278928021499, 625853062251406, 1109121378393107, 1033853809911861 },
+    { 571005965509422, 2005213373292546, 1016697270349626, 56607856974274, 914438579435146 }
+  },
+  {
+    { 1346698876211176, 2076651707527589, 1084761571110205, 265334478828406, 1068954492309671 },
+    { 1769967932677654, 1695893319756416, 1151863389675920, 1781042784397689, 400287774418285 },
+    { 1851867764003121, 403841933237558, 820549523771987, 761292590207581, 1743735048551143 }
+  },
+  {
+    { 410915148140008, 2107072311871739, 1004367461876503, 99684895396761, 1180818713503224 },
+    { 285945406881439, 648174397347453, 1098403762631981, 1366547441102991, 1505876883139217 },
+    { 672095903120153, 1675918957959872, 636236529315028, 1569297300327696, 2164144194785875 }
+  },
+  {
+    { 1902708175321798, 1035343530915438, 1178560808893263, 301095684058146, 1280977479761118 },
+    { 1615357281742403, 404257611616381, 2160201349780978, 1160947379188955, 1578038619549541 },
+    { 2013087639791217, 822734930507457, 1785668418619014, 1668650702946164, 389450875221715 }
+  }
+},
+{ /* 23/31 */
+  {
+    { 453918449698368, 106406819929001, 2072540975937135, 308588860670238, 1304394580755385 },
+    { 1295082798350326, 2091844511495996, 1851348972587817, 3375039684596, 789440738712837 },
+    { 2083069137186154, 848523102004566, 993982213589257, 1405313299916317, 1532824818698468 }
+  },
+  {
+    { 1495961298852430, 1397203457344779, 1774950217066942, 139302743555696, 66603584342787 },
+    { 1782411379088302, 1096724939964781, 27593390721418, 542241850291353, 1540337798439873 },
+    { 693543956581437, 171507720360750, 1557908942697227, 1074697073443438, 1104093109037196 }
+  },
+  {
+    { 345288228393419, 1099643569747172, 134881908403743, 1740551994106740, 248212179299770 },
+    { 231429562203065, 1526290236421172, 2021375064026423, 1520954495658041, 806337791525116 },
+    { 1079623667189886, 872403650198613, 766894200588288, 2163700860774109, 2023464507911816 }
+  },
+  {
+    { 854645372543796, 1936406001954827, 151460662541253, 825325739271555, 1554306377287556 },
+    { 1497138821904622, 1044820250515590, 1742593886423484, 1237204112746837, 849047450816987 },
+    { 667962773375330, 1897271816877105, 1399712621683474, 1143302161683099, 2081798441209593 }
+  },
+  {
+    { 127147851567005, 1936114012888110, 1704424366552046, 856674880716312, 716603621335359 },
+    { 1072409664800960, 2146937497077528, 1508780108920651, 935767602384853, 1112800433544068 },
+    { 333549023751292, 280219272863308, 2104176666454852, 1036466864875785, 536135186520207 }
+  },
+  {
+    { 373666279883137, 146457241530109, 304116267127857, 416088749147715, 1258577131183391 },
+    { 1186115062588401, 2251609796968486, 1098944457878953, 1153112761201374, 1791625503417267 },
+    { 1870078460219737, 2129630962183380, 852283639691142, 292865602592851, 401904317342226 }
+  },
+  {
+    { 1361070124828035, 815664541425524, 1026798897364671, 1951790935390647, 555874891834790 },
+    { 1546301003424277, 459094500062839, 1097668518375311, 1780297770129643, 720763293687608 },
+    { 1212405311403990, 1536693382542438, 61028431067459, 1863929423417129, 1223219538638038 }
+  },
+  {
+    { 1294303766540260, 1183557465955093, 882271357233093, 63854569425375, 2213283684565087 },
+    { 339050984211414, 601386726509773, 413735232134068, 966191255137228, 1839475899458159 },
+    { 235605972169408, 2174055643032978, 1538335001838863, 1281866796917192, 1815940222628465 }
+  }
+},
+{ /* 24/31 */
+  {
+    { 1632352921721536, 1833328609514701, 2092779091951987, 1923956201873226, 2210068022482919 },
+    { 35271216625062, 1712350667021807, 983664255668860, 98571260373038, 1232645608559836 },
+    { 1998172393429622, 1798947921427073, 784387737563581, 1589352214827263, 1589861734168180 }
+  },
+  {
+    { 1733739258725305, 31715717059538, 201969945218860, 992093044556990, 1194308773174556 },
+    { 846415389605137, 746163495539180, 829658752826080, 592067705956946, 957242537821393 },
+    { 1758148849754419, 619249044817679, 168089007997045, 1371497636330523, 1867101418880350 }
+  },
+  {
+    { 326633984209635, 261759506071016, 1700682323676193, 1577907266349064, 1217647663383016 },
+    { 1714182387328607, 1477856482074168, 574895689942184, 2159118410227270, 1555532449716575 },
+    { 853828206885131, 998498946036955, 1835887550391235, 207627336608048, 258363815956050 }
+  },
+  {
+    { 141141474651677, 1236728744905256, 643101419899887, 1646615130509173, 1208239602291765 },
+    { 1501663228068911, 1354879465566912, 1444432675498247, 897812463852601, 855062598754348 },
+    { 714380763546606, 1032824444965790, 1774073483745338, 1063840874947367, 1738680636537158 }
+  },
+  {
+    { 1640635546696252, 633168953192112, 2212651044092396, 30590958583852, 368515260889378 },
+    { 1171650314802029, 1567085444565577, 1453660792008405, 757914533009261, 1619511342778196 },
+    { 420958967093237, 971103481109486, 2169549185607107, 1301191633558497, 1661514101014240 }
+  },
+  {
+    { 907123651818302, 1332556122804146, 1824055253424487, 1367614217442959, 1982558335973172 },
+    { 1121533090144639, 1021251337022187, 110469995947421, 1511059774758394, 2110035908131662 },
+    { 303213233384524, 2061932261128138, 352862124777736, 40828818670255, 249879468482660 }
+  },
+  {
+    { 856559257852200, 508517664949010, 1378193767894916, 1723459126947129, 1962275756614521 },
+    { 1445691340537320, 40614383122127, 402104303144865, 485134269878232, 1659439323587426 },
+    { 20057458979482, 1183363722525800, 2140003847237215, 2053873950687614, 2112017736174909 }
+  },
+  {
+    { 2228654250927986, 1483591363415267, 1368661293910956, 1076511285177291, 526650682059608 },
+    { 709481497028540, 531682216165724, 316963769431931, 1814315888453765, 258560242424104 },
+    { 1053447823660455, 1955135194248683, 1010900954918985, 1182614026976701, 1240051576966610 }
+  }
+},
+{ /* 25/31 */
+  {
+    { 1957943897155497, 1788667368028035, 137692910029106, 1039519607062, 826404763313028 },
+    { 1848942433095597, 1582009882530495, 1849292741020143, 1068498323302788, 2001402229799484 },
+    { 1528282417624269, 2142492439828191, 2179662545816034, 362568973150328, 1591374675250271 }
+  },
+  {
+    { 160026679434388, 232341189218716, 2149181472355545, 598041771119831, 183859001910173 },
+    { 2013278155187349, 662660471354454, 793981225706267, 411706605985744, 804490933124791 },
+    { 2051892037280204, 488391251096321, 2230187337030708, 930221970662692, 679002758255210 }
+  },
+  {
+    { 1530723630438670, 875873929577927, 341560134269988, 449903119530753, 1055551308214179 },
+    { 1461835919309432, 1955256480136428, 180866187813063, 1551979252664528, 557743861963950 },
+    { 359179641731115, 1324915145732949, 902828372691474, 294254275669987, 1887036027752957 }
+  },
+  {
+    { 2043271609454323, 2038225437857464, 1317528426475850, 1398989128982787, 2027639881006861 },
+    { 2072902725256516, 312132452743412, 309930885642209, 996244312618453, 1590501300352303 },
+    { 1397254305160710, 695734355138021, 2233992044438756, 1776180593969996, 1085588199351115 }
+  },
+  {
+    { 440567051331029, 254894786356681, 493869224930222, 1556322069683366, 1567456540319218 },
+    { 1950722461391320, 1907845598854797, 1822757481635527, 2121567704750244, 73811931471221 },
+    { 387139307395758, 2058036430315676, 1220915649965325, 1794832055328951, 1230009312169328 }
+  },
+  {
+    { 1765973779329517, 659344059446977, 19821901606666, 1301928341311214, 1116266004075885 },
+    { 1127572801181483, 1224743760571696, 1276219889847274, 1529738721702581, 1589819666871853 },
+    { 2181229378964934, 2190885205260020, 1511536077659137, 1246504208580490, 668883326494241 }
+  },
+  {
+    { 437866655573314, 669026411194768, 81896997980338, 523874406393178, 245052060935236 },
+    { 1975438052228868, 1071801519999806, 594652299224319, 1877697652668809, 1489635366987285 },
+    { 958592545673770, 233048016518599, 851568750216589, 567703851596087, 1740300006094761 }
+  },
+  {
+    { 2014540178270324, 192672779514432, 213877182641530, 2194819933853411, 1716422829364835 },
+    { 1540769606609725, 2148289943846077, 1597804156127445, 1230603716683868, 815423458809453 },
+    { 1738560251245018, 1779576754536888, 1783765347671392, 1880170990446751, 1088225159617541 }
+  }
+},
+{ /* 26/31 */
+  {
+    { 659303913929492, 1956447718227573, 1830568515922666, 841069049744408, 1669607124206368 },
+    { 1143465490433355, 1532194726196059, 1093276745494697, 481041706116088, 2121405433561163 },
+    { 1686424298744462, 1451806974487153, 266296068846582, 1834686947542675, 1720762336132256 }
+  },
+  {
+    { 889217026388959, 1043290623284660, 856125087551909, 1669272323124636, 1603340330827879 },
+    { 1206396181488998, 333158148435054, 1402633492821422, 1120091191722026, 1945474114550509 },
+    { 766720088232571, 1512222781191002, 1189719893490790, 2091302129467914, 2141418006894941 }
+  },
+  {
+    { 419663647306612, 1998875112167987, 1426599870253707, 1154928355379510, 486538532138187 },
+    { 938160078005954, 1421776319053174, 1941643234741774, 180002183320818, 1414380336750546 },
+    { 398001940109652, 1577721237663248, 1012748649830402, 1540516006905144, 1011684812884559 }
+  },
+  {
+    { 1653276489969630, 6081825167624, 1921777941170836, 1604139841794531, 861211053640641 },
+    { 996661541407379, 1455877387952927, 744312806857277, 139213896196746, 1000282908547789 },
+    { 1450817495603008, 1476865707053229, 1030490562252053, 620966950353376, 1744760161539058 }
+  },
+  {
+    { 559728410002599, 37056661641185, 2038622963352006, 1637244893271723, 1026565352238948 },
+    { 962165956135846, 1116599660248791, 182090178006815, 1455605467021751, 196053588803284 },
+    { 796863823080135, 1897365583584155, 420466939481601, 2165972651724672, 932177357788289 }
+  },
+  {
+    { 877047233620632, 1375632631944375, 643773611882121, 660022738847877, 19353932331831 },
+    { 2216943882299338, 394841323190322, 2222656898319671, 558186553950529, 1077236877025190 },
+    { 801118384953213, 1914330175515892, 574541023311511, 1471123787903705, 1526158900256288 }
+  },
+  {
+    { 949617889087234, 2207116611267331, 912920039141287, 501158539198789, 62362560771472 },
+    { 1474518386765335, 1760793622169197, 1157399790472736, 1622864308058898, 165428294422792 },
+    { 1961673048027128, 102619413083113, 1051982726768458, 1603657989805485, 1941613251499678 }
+  },
+  {
+    { 1401939116319266, 335306339903072, 72046196085786, 862423201496006, 850518754531384 },
+    { 1234706593321979, 1083343891215917, 898273974314935, 1640859118399498, 157578398571149 },
+    { 1143483057726416, 1992614991758919, 674268662140796, 1773370048077526, 674318359920189 }
+  }
+},
+{ /* 27/31 */
+  {
+    { 1835401379538542, 173900035308392, 818247630716732, 1762100412152786, 1021506399448291 },
+    { 1506632088156630, 2127481795522179, 513812919490255, 140643715928370, 442476620300318 },
+    { 2056683376856736, 219094741662735, 2193541883188309, 1841182310235800, 556477468664293 }
+  },
+  {
+    { 1315019427910827, 1049075855992603, 2066573052986543, 266904467185534, 2040482348591520 },
+    { 94096246544434, 922482381166992, 24517828745563, 2139430508542503, 2097139044231004 },
+    { 537697207950515, 1399352016347350, 1563663552106345, 2148749520888918, 549922092988516 }
+  },
+  {
+    { 1747985413252434, 680511052635695, 1809559829982725, 594274250930054, 201673170745982 },
+    { 323583936109569, 1973572998577657, 1192219029966558, 79354804385273, 1374043025560347 },
+    { 213277331329947, 416202017849623, 1950535221091783, 1313441578103244, 2171386783823658 }
+  },
+  {
+    { 189088804229831, 993969372859110, 895870121536987, 1547301535298256, 1477373024911350 },
+    { 1620578418245010, 541035331188469, 2235785724453865, 2154865809088198, 1974627268751826 },
+    { 1346805451740245, 1350981335690626, 942744349501813, 2155094562545502, 1012483751693409 }
+  },
+  {
+    { 2107080134091762, 1132567062788208, 1824935377687210, 769194804343737, 1857941799971888 },
+    { 1074666112436467, 249279386739593, 1174337926625354, 1559013532006480, 1472287775519121 },
+    { 1872620123779532, 1892932666768992, 1921559078394978, 1270573311796160, 1438913646755037 }
+  },
+  {
+    { 837390187648199, 1012253300223599, 989780015893987, 1351393287739814, 328627746545550 },
+    { 1028328827183114, 1711043289969857, 1350832470374933, 1923164689604327, 1495656368846911 },
+    { 1900828492104143, 430212361082163, 687437570852799, 832514536673512, 1685641495940794 }
+  },
+  {
+    { 842632847936398, 605670026766216, 290836444839585, 163210774892356, 2213815011799645 },
+    { 1176336383453996, 1725477294339771, 12700622672454, 678015708818208, 162724078519879 },
+    { 1448049969043497, 1789411762943521, 385587766217753, 90201620913498, 832999441066823 }
+  },
+  {
+    { 516086333293313, 2240508292484616, 1351669528166508, 1223255565316488, 750235824427138 },
+    { 1263624896582495, 1102602401673328, 526302183714372, 2152015839128799, 1483839308490010 },
+    { 442991718646863, 1599275157036458, 1925389027579192, 899514691371390, 350263251085160 }
+  }
+},
+{ /* 28/31 */
+  {
+    { 1689713572022143, 593854559254373, 978095044791970, 1985127338729499, 1676069120347625 },
+    { 1557207018622683, 340631692799603, 1477725909476187, 614735951619419, 2033237123746766 },
+    { 968764929340557, 1225534776710944, 662967304013036, 1155521416178595, 791142883466590 }
+  },
+  {
+    { 1487081286167458, 993039441814934, 1792378982844640, 698652444999874, 2153908693179754 },
+    { 1123181311102823, 685575944875442, 507605465509927, 1412590462117473, 568017325228626 },
+    { 560258797465417, 2193971151466401, 1824086900849026, 579056363542056, 1690063960036441 }
+  },
+  {
+    { 1918407319222416, 353767553059963, 1930426334528099, 1564816146005724, 1861342381708096 },
+    { 2131325168777276, 1176636658428908, 1756922641512981, 1390243617176012, 1966325177038383 },
+    { 2063958120364491, 2140267332393533, 699896251574968, 273268351312140, 375580724713232 }
+  },
+  {
+    { 2024297515263178, 416959329722687, 1079014235017302, 171612225573183, 1031677520051053 },
+    { 2033900009388450, 1744902869870788, 2190580087917640, 1949474984254121, 231049754293748 },
+    { 343868674606581, 550155864008088, 1450580864229630, 481603765195050, 896972360018042 }
+  },
+  {
+    { 2151139328380127, 314745882084928, 59756825775204, 1676664391494651, 2048348075599360 },
+    { 1528930066340597, 1605003907059576, 1055061081337675, 1458319101947665, 1234195845213142 },
+    { 830430507734812, 1780282976102377, 1425386760709037, 362399353095425, 2168861579799910 }
+  },
+  {
+    { 1155762232730333, 980662895504006, 2053766700883521, 490966214077606, 510405877041357 },
+    { 1683750316716132, 652278688286128, 1221798761193539, 1897360681476669, 319658166027343 },
+    { 618808732869972, 72755186759744, 2060379135624181, 1730731526741822, 48862757828238 }
+  },
+  {
+    { 1463171970593505, 1143040711767452, 614590986558883, 1409210575145591, 1882816996436803 },
+    { 2230133264691131, 563950955091024, 2042915975426398, 827314356293472, 672028980152815 },
+    { 264204366029760, 1654686424479449, 2185050199932931, 2207056159091748, 506015669043634 }
+  },
+  {
+    { 1784446333136569, 1973746527984364, 334856327359575, 1156769775884610, 1023950124675478 },
+    { 2065270940578383, 31477096270353, 306421879113491, 181958643936686, 1907105536686083 },
+    { 1496516440779464, 1748485652986458, 872778352227340, 818358834654919, 97932669284220 }
+  }
+},
+{ /* 29/31 */
+  {
+    { 471636015770351, 672455402793577, 1804995246884103, 1842309243470804, 1501862504981682 },
+    { 1013216974933691, 538921919682598, 1915776722521558, 1742822441583877, 1886550687916656 },
+    { 2094270000643336, 303971879192276, 40801275554748, 649448917027930, 1818544418535447 }
+  },
+  {
+    { 2241737709499165, 549397817447461, 838180519319392, 1725686958520781, 1705639080897747 },
+    { 1216074541925116, 50120933933509, 1565829004133810, 721728156134580, 349206064666188 },
+    { 948617110470858, 346222547451945, 1126511960599975, 1759386906004538, 493053284802266 }
+  },
+  {
+    { 1454933046815146, 874696014266362, 1467170975468588, 1432316382418897, 2111710746366763 },
+    { 2105387117364450, 1996463405126433, 1303008614294500, 851908115948209, 1353742049788635 },
+    { 750300956351719, 1487736556065813, 15158817002104, 1511998221598392, 971739901354129 }
+  },
+  {
+    { 1874648163531693, 2124487685930551, 1810030029384882, 918400043048335, 586348627300650 },
+    { 1235084464747900, 1166111146432082, 1745394857881591, 1405516473883040, 4463504151617 },
+    { 1663810156463827, 327797390285791, 1341846161759410, 1964121122800605, 1747470312055380 }
+  },
+  {
+    { 660005247548233, 2071860029952887, 1358748199950107, 911703252219107, 1014379923023831 },
+    { 2206641276178231, 1690587809721504, 1600173622825126, 2156096097634421, 1106822408548216 },
+    { 1344788193552206, 1949552134239140, 1735915881729557, 675891104100469, 1834220014427292 }
+  },
+  {
+    { 1920949492387964, 158885288387530, 70308263664033, 626038464897817, 1468081726101009 },
+    { 622221042073383, 1210146474039168, 1742246422343683, 1403839361379025, 417189490895736 },
+    { 22727256592983, 168471543384997, 1324340989803650, 1839310709638189, 504999476432775 }
+  },
+  {
+    { 1313240518756327, 1721896294296942, 52263574587266, 2065069734239232, 804910473424630 },
+    { 1337466662091884, 1287645354669772, 2018019646776184, 652181229374245, 898011753211715 },
+    { 1969792547910734, 779969968247557, 2011350094423418, 1823964252907487, 1058949448296945 }
+  },
+  {
+    { 207343737062002, 1118176942430253, 758894594548164, 806764629546266, 1157700123092949 },
+    { 1273565321399022, 1638509681964574, 759235866488935, 666015124346707, 897983460943405 },
+    { 1717263794012298, 1059601762860786, 1837819172257618, 1054130665797229, 680893204263559 }
+  }
+},
+{ /* 30/31 */
+  {
+    { 2237039662793603, 2249022333361206, 2058613546633703, 149454094845279, 2215176649164582 },
+    { 79472182719605, 1851130257050174, 1825744808933107, 821667333481068, 781795293511946 },
+    { 755822026485370, 152464789723500, 1178207602290608, 410307889503239, 156581253571278 }
+  },
+  {
+    { 1418185496130297, 484520167728613, 1646737281442950, 1401487684670265, 1349185550126961 },
+    { 1495380034400429, 325049476417173, 46346894893933, 1553408840354856, 828980101835683 },
+    { 1280337889310282, 2070832742866672, 1640940617225222, 2098284908289951, 450929509534434 }
+  },
+  {
+    { 407703353998781, 126572141483652, 286039827513621, 1999255076709338, 2030511179441770 },
+    { 1254958221100483, 1153235960999843, 942907704968834, 637105404087392, 1149293270147267 },
+    { 894249020470196, 400291701616810, 406878712230981, 1599128793487393, 1145868722604026 }
+  },
+  {
+    { 1497955250203334, 110116344653260, 1128535642171976, 1900106496009660, 129792717460909 },
+    { 452487513298665, 1352120549024569, 1173495883910956, 1999111705922009, 367328130454226 },
+    { 1717539401269642, 1475188995688487, 891921989653942, 836824441505699, 1885988485608364 }
+  },
+  {
+    { 1241784121422547, 187337051947583, 1118481812236193, 428747751936362, 30358898927325 },
+    { 2022432361201842, 1088816090685051, 1977843398539868, 1854834215890724, 564238862029357 },
+    { 938868489100585, 1100285072929025, 1017806255688848, 1957262154788833, 152787950560442 }
+  },
+  {
+    { 867319417678923, 620471962942542, 226032203305716, 342001443957629, 1761675818237336 },
+    { 1295072362439987, 931227904689414, 1355731432641687, 922235735834035, 892227229410209 },
+    { 1680989767906154, 535362787031440, 2136691276706570, 1942228485381244, 1267350086882274 }
+  },
+  {
+    { 366018233770527, 432660629755596, 126409707644535, 1973842949591662, 645627343442376 },
+    { 535509430575217, 546885533737322, 1524675609547799, 2138095752851703, 1260738089896827 },
+    { 1159906385590467, 2198530004321610, 714559485023225, 81880727882151, 1484020820037082 }
+  },
+  {
+    { 1377485731340769, 2046328105512000, 1802058637158797, 62146136768173, 1356993908853901 },
+    { 2013612215646735, 1830770575920375, 536135310219832, 609272325580394, 270684344495013 },
+    { 1237542585982777, 2228682050256790, 1385281931622824, 593183794882890, 493654978552689 }
+  }
+},
+{ /* 31/31 */
+  {
+    { 47341488007760, 1891414891220257, 983894663308928, 176161768286818, 1126261115179708 },
+    { 1694030170963455, 502038567066200, 1691160065225467, 949628319562187, 275110186693066 },
+    { 1124515748676336, 1661673816593408, 1499640319059718, 1584929449166988, 558148594103306 }
+  },
+  {
+    { 1784525599998356, 1619698033617383, 2097300287550715, 258265458103756, 1905684794832758 },
+    { 1288941072872766, 931787902039402, 190731008859042, 2006859954667190, 1005931482221702 },
+    { 1465551264822703, 152905080555927, 680334307368453, 173227184634745, 666407097159852 }
+  },
+  {
+    { 2111017076203943, 1378760485794347, 1248583954016456, 1352289194864422, 1895180776543896 },
+    { 171348223915638, 662766099800389, 462338943760497, 466917763340314, 656911292869115 },
+    { 488623681976577, 866497561541722, 1708105560937768, 1673781214218839, 1506146329818807 }
+  },
+  {
+    { 160425464456957, 950394373239689, 430497123340934, 711676555398832, 320964687779005 },
+    { 988979367990485, 1359729327576302, 1301834257246029, 294141160829308, 29348272277475 },
+    { 1434382743317910, 100082049942065, 221102347892623, 186982837860588, 1305765053501834 }
+  },
+  {
+    { 2205916462268190, 499863829790820, 961960554686616, 158062762756985, 1841471168298305 },
+    { 1191737341426592, 1847042034978363, 1382213545049056, 1039952395710448, 788812858896859 },
+    { 1346965964571152, 1291881610839830, 2142916164336056, 786821641205979, 1571709146321039 }
+  },
+  {
+    { 787164375951248, 202869205373189, 1356590421032140, 1431233331032510, 786341368775957 },
+    { 492448143532951, 304105152670757, 1761767168301056, 233782684697790, 1981295323106089 },
+    { 665807507761866, 1343384868355425, 895831046139653, 439338948736892, 1986828765695105 }
+  },
+  {
+    { 756096210874553, 1721699973539149, 258765301727885, 1390588532210645, 1212530909934781 },
+    { 852891097972275, 1816988871354562, 1543772755726524, 1174710635522444, 202129090724628 },
+    { 1205281565824323, 22430498399418, 992947814485516, 1392458699738672, 688441466734558 }
+  },
+  {
+    { 1050627428414972, 1955849529137135, 2171162376368357, 91745868298214, 447733118757826 },
+    { 1287181461435438, 622722465530711, 880952150571872, 741035693459198, 311565274989772 },
+    { 1003649078149734, 545233927396469, 1849786171789880, 1318943684880434, 280345687170552 }
+  }
+}
diff --git a/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/base2.h b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/base2.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/base2.h
@@ -0,0 +1,40 @@
+{
+  { 1288382639258501, 245678601348599, 269427782077623, 1462984067271730, 137412439391563 },
+  { 62697248952638, 204681361388450, 631292143396476, 338455783676468, 1213667448819585 },
+  { 301289933810280, 1259582250014073, 1422107436869536, 796239922652654, 1953934009299142 }
+},
+{
+  { 1601611775252272, 1720807796594148, 1132070835939856, 1260455018889551, 2147779492816911 },
+  { 316559037616741, 2177824224946892, 1459442586438991, 1461528397712656, 751590696113597 },
+  { 1850748884277385, 1200145853858453, 1068094770532492, 672251375690438, 1586055907191707 }
+},
+{
+  { 769950342298419, 132954430919746, 844085933195555, 974092374476333, 726076285546016 },
+  { 425251763115706, 608463272472562, 442562545713235, 837766094556764, 374555092627893 },
+  { 1086255230780037, 274979815921559, 1960002765731872, 929474102396301, 1190409889297339 }
+},
+{
+  { 665000864555967, 2065379846933859, 370231110385876, 350988370788628, 1233371373142985 },
+  { 2019367628972465, 676711900706637, 110710997811333, 1108646842542025, 517791959672113 },
+  { 965130719900578, 247011430587952, 526356006571389, 91986625355052, 2157223321444601 }
+},
+{
+  { 1802695059465007, 1664899123557221, 593559490740857, 2160434469266659, 927570450755031 },
+  { 1725674970513508, 1933645953859181, 1542344539275782, 1767788773573747, 1297447965928905 },
+  { 1381809363726107, 1430341051343062, 2061843536018959, 1551778050872521, 2036394857967624 }
+},
+{
+  { 1970894096313054, 528066325833207, 1619374932191227, 2207306624415883, 1169170329061080 },
+  { 2070390218572616, 1458919061857835, 624171843017421, 1055332792707765, 433987520732508 },
+  { 893653801273833, 1168026499324677, 1242553501121234, 1306366254304474, 1086752658510815 }
+},
+{
+  { 213454002618221, 939771523987438, 1159882208056014, 317388369627517, 621213314200687 },
+  { 1971678598905747, 338026507889165, 762398079972271, 655096486107477, 42299032696322 },
+  { 177130678690680, 1754759263300204, 1864311296286618, 1180675631479880, 1292726903152791 }
+},
+{
+  { 1913163449625248, 460779200291993, 2193883288642314, 1008900146920800, 1721983679009502 },
+  { 1070401523076875, 1272492007800961, 1910153608563310, 2075579521696771, 1191169788841221 },
+  { 692896803108118, 500174642072499, 2068223309439677, 1162190621851337, 1426986007309901 }
+}
diff --git a/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h
@@ -0,0 +1,41 @@
+/* 37095705934669439343138083508754565189542113879843219016388785533085940283555 */
+static const fe25519 d = {
+    929955233495203, 466365720129213, 1662059464998953, 2033849074728123, 1442794654840575
+};
+
+/* 2 * d =
+ * 16295367250680780974490674513165176452449235426866156013048779062215315747161
+ */
+static const fe25519 d2 = {
+    1859910466990425, 932731440258426, 1072319116312658, 1815898335770999, 633789495995903
+};
+
+/* sqrt(-1) */
+static const fe25519 sqrtm1 = {
+    1718705420411056, 234908883556509, 2233514472574048, 2117202627021982, 765476049583133
+};
+
+/* A = 486662 */
+static const fe25519 curve25519_A = {
+    486662, 0, 0, 0, 0
+};
+
+/* sqrt(ad - 1) with a = -1 (mod p) */
+static const fe25519 sqrtadm1 = {
+    2241493124984347, 425987919032274, 2207028919301688, 1220490630685848, 974799131293748
+};
+
+/* 1 / sqrt(a - d) */
+static const fe25519 invsqrtamd = {
+    278908739862762, 821645201101625, 8113234426968, 1777959178193151, 2118520810568447
+};
+
+/* 1 - d ^ 2 */
+static const fe25519 onemsqd = {
+    1136626929484150, 1998550399581263, 496427632559748, 118527312129759, 45110755273534
+};
+
+/* (d - 1) ^ 2 */
+static const fe25519 sqdmone = {
+    1507062230895904, 1572317787530805, 683053064812840, 317374165784489, 1572899562415810
+};
diff --git a/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/fe.h b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/fe.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/ed25519/ref10/fe_51/fe.h
@@ -0,0 +1,116 @@
+/*
+ Ignores top bit of s.
+ */
+
+void
+fe25519_frombytes(fe25519 h, const unsigned char *s)
+{
+    const uint64_t mask = 0x7ffffffffffffULL;
+    uint64_t h0, h1, h2, h3, h4;
+
+    h0 = (LOAD64_LE(s     )      ) & mask;
+    h1 = (LOAD64_LE(s +  6) >>  3) & mask;
+    h2 = (LOAD64_LE(s + 12) >>  6) & mask;
+    h3 = (LOAD64_LE(s + 19) >>  1) & mask;
+    h4 = (LOAD64_LE(s + 24) >> 12) & mask;
+
+    h[0] = h0;
+    h[1] = h1;
+    h[2] = h2;
+    h[3] = h3;
+    h[4] = h4;
+}
+
+static void
+fe25519_reduce(fe25519 h, const fe25519 f)
+{
+    const uint64_t mask = 0x7ffffffffffffULL;
+    uint128_t t[5];
+
+    t[0] = f[0];
+    t[1] = f[1];
+    t[2] = f[2];
+    t[3] = f[3];
+    t[4] = f[4];
+
+    t[1] += t[0] >> 51;
+    t[0] &= mask;
+    t[2] += t[1] >> 51;
+    t[1] &= mask;
+    t[3] += t[2] >> 51;
+    t[2] &= mask;
+    t[4] += t[3] >> 51;
+    t[3] &= mask;
+    t[0] += 19 * (t[4] >> 51);
+    t[4] &= mask;
+
+    t[1] += t[0] >> 51;
+    t[0] &= mask;
+    t[2] += t[1] >> 51;
+    t[1] &= mask;
+    t[3] += t[2] >> 51;
+    t[2] &= mask;
+    t[4] += t[3] >> 51;
+    t[3] &= mask;
+    t[0] += 19 * (t[4] >> 51);
+    t[4] &= mask;
+
+    /* now t is between 0 and 2^255-1, properly carried. */
+    /* case 1: between 0 and 2^255-20. case 2: between 2^255-19 and 2^255-1. */
+
+    t[0] += 19ULL;
+
+    t[1] += t[0] >> 51;
+    t[0] &= mask;
+    t[2] += t[1] >> 51;
+    t[1] &= mask;
+    t[3] += t[2] >> 51;
+    t[2] &= mask;
+    t[4] += t[3] >> 51;
+    t[3] &= mask;
+    t[0] += 19ULL * (t[4] >> 51);
+    t[4] &= mask;
+
+    /* now between 19 and 2^255-1 in both cases, and offset by 19. */
+
+    t[0] += 0x8000000000000 - 19ULL;
+    t[1] += 0x8000000000000 - 1ULL;
+    t[2] += 0x8000000000000 - 1ULL;
+    t[3] += 0x8000000000000 - 1ULL;
+    t[4] += 0x8000000000000 - 1ULL;
+
+    /* now between 2^255 and 2^256-20, and offset by 2^255. */
+
+    t[1] += t[0] >> 51;
+    t[0] &= mask;
+    t[2] += t[1] >> 51;
+    t[1] &= mask;
+    t[3] += t[2] >> 51;
+    t[2] &= mask;
+    t[4] += t[3] >> 51;
+    t[3] &= mask;
+    t[4] &= mask;
+
+    h[0] = t[0];
+    h[1] = t[1];
+    h[2] = t[2];
+    h[3] = t[3];
+    h[4] = t[4];
+}
+
+void
+fe25519_tobytes(unsigned char *s, const fe25519 h)
+{
+    fe25519  t;
+    uint64_t t0, t1, t2, t3;
+
+    fe25519_reduce(t, h);
+    t0 = t[0] | (t[1] << 51);
+    t1 = (t[1] >> 13) | (t[2] << 38);
+    t2 = (t[2] >> 26) | (t[3] << 25);
+    t3 = (t[3] >> 39) | (t[4] << 12);
+    STORE64_LE(s +  0, t0);
+    STORE64_LE(s +  8, t1);
+    STORE64_LE(s + 16, t2);
+    STORE64_LE(s + 24, t3);
+}
diff --git a/vendor/external/libsodium/crypto_core/hchacha20/core_hchacha20.c b/vendor/external/libsodium/crypto_core/hchacha20/core_hchacha20.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/hchacha20/core_hchacha20.c
@@ -0,0 +1,93 @@
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "crypto_core_hchacha20.h"
+#include "private/common.h"
+
+#define QUARTERROUND(A, B, C, D)     \
+  do {                               \
+      A += B; D = ROTL32(D ^ A, 16); \
+      C += D; B = ROTL32(B ^ C, 12); \
+      A += B; D = ROTL32(D ^ A,  8); \
+      C += D; B = ROTL32(B ^ C,  7); \
+  } while(0)
+
+int
+crypto_core_hchacha20(unsigned char *out, const unsigned char *in,
+                      const unsigned char *k, const unsigned char *c)
+{
+    int      i;
+    uint32_t x0, x1, x2, x3, x4, x5, x6, x7;
+    uint32_t x8, x9, x10, x11, x12, x13, x14, x15;
+
+    if (c == NULL) {
+        x0 = 0x61707865;
+        x1 = 0x3320646e;
+        x2 = 0x79622d32;
+        x3 = 0x6b206574;
+    } else {
+        x0 = LOAD32_LE(c +  0);
+        x1 = LOAD32_LE(c +  4);
+        x2 = LOAD32_LE(c +  8);
+        x3 = LOAD32_LE(c + 12);
+    }
+    x4  = LOAD32_LE(k +  0);
+    x5  = LOAD32_LE(k +  4);
+    x6  = LOAD32_LE(k +  8);
+    x7  = LOAD32_LE(k + 12);
+    x8  = LOAD32_LE(k + 16);
+    x9  = LOAD32_LE(k + 20);
+    x10 = LOAD32_LE(k + 24);
+    x11 = LOAD32_LE(k + 28);
+    x12 = LOAD32_LE(in +  0);
+    x13 = LOAD32_LE(in +  4);
+    x14 = LOAD32_LE(in +  8);
+    x15 = LOAD32_LE(in + 12);
+
+    for (i = 0; i < 10; i++) {
+        QUARTERROUND(x0, x4,  x8, x12);
+        QUARTERROUND(x1, x5,  x9, x13);
+        QUARTERROUND(x2, x6, x10, x14);
+        QUARTERROUND(x3, x7, x11, x15);
+        QUARTERROUND(x0, x5, x10, x15);
+        QUARTERROUND(x1, x6, x11, x12);
+        QUARTERROUND(x2, x7,  x8, x13);
+        QUARTERROUND(x3, x4,  x9, x14);
+    }
+
+    STORE32_LE(out +  0, x0);
+    STORE32_LE(out +  4, x1);
+    STORE32_LE(out +  8, x2);
+    STORE32_LE(out + 12, x3);
+    STORE32_LE(out + 16, x12);
+    STORE32_LE(out + 20, x13);
+    STORE32_LE(out + 24, x14);
+    STORE32_LE(out + 28, x15);
+
+    return 0;
+}
+
+size_t
+crypto_core_hchacha20_outputbytes(void)
+{
+    return crypto_core_hchacha20_OUTPUTBYTES;
+}
+
+size_t
+crypto_core_hchacha20_inputbytes(void)
+{
+    return crypto_core_hchacha20_INPUTBYTES;
+}
+
+size_t
+crypto_core_hchacha20_keybytes(void)
+{
+    return crypto_core_hchacha20_KEYBYTES;
+}
+
+size_t
+crypto_core_hchacha20_constbytes(void)
+{
+    return crypto_core_hchacha20_CONSTBYTES;
+}
diff --git a/vendor/external/libsodium/crypto_core/hsalsa20/core_hsalsa20.c b/vendor/external/libsodium/crypto_core/hsalsa20/core_hsalsa20.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/hsalsa20/core_hsalsa20.c
@@ -0,0 +1,21 @@
+#include "crypto_core_hsalsa20.h"
+
+size_t
+crypto_core_hsalsa20_outputbytes(void) {
+    return crypto_core_hsalsa20_OUTPUTBYTES;
+}
+
+size_t
+crypto_core_hsalsa20_inputbytes(void) {
+    return crypto_core_hsalsa20_INPUTBYTES;
+}
+
+size_t
+crypto_core_hsalsa20_keybytes(void) {
+    return crypto_core_hsalsa20_KEYBYTES;
+}
+
+size_t
+crypto_core_hsalsa20_constbytes(void) {
+    return crypto_core_hsalsa20_CONSTBYTES;
+}
diff --git a/vendor/external/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c b/vendor/external/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c
@@ -0,0 +1,95 @@
+/*
+version 20080912
+D. J. Bernstein
+Public domain.
+*/
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "crypto_core_hsalsa20.h"
+#include "private/common.h"
+
+#define ROUNDS 20
+#define U32C(v) (v##U)
+
+int
+crypto_core_hsalsa20(unsigned char *out,
+                     const unsigned char *in,
+                     const unsigned char *k,
+                     const unsigned char *c)
+{
+    uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8,
+             x9, x10, x11, x12, x13, x14,  x15;
+    int      i;
+
+    if (c == NULL) {
+        x0 = U32C(0x61707865);
+        x5 = U32C(0x3320646e);
+        x10 = U32C(0x79622d32);
+        x15 = U32C(0x6b206574);
+    } else {
+        x0 = LOAD32_LE(c + 0);
+        x5 = LOAD32_LE(c + 4);
+        x10 = LOAD32_LE(c + 8);
+        x15 = LOAD32_LE(c + 12);
+    }
+    x1 = LOAD32_LE(k + 0);
+    x2 = LOAD32_LE(k + 4);
+    x3 = LOAD32_LE(k + 8);
+    x4 = LOAD32_LE(k + 12);
+    x11 = LOAD32_LE(k + 16);
+    x12 = LOAD32_LE(k + 20);
+    x13 = LOAD32_LE(k + 24);
+    x14 = LOAD32_LE(k + 28);
+    x6 = LOAD32_LE(in + 0);
+    x7 = LOAD32_LE(in + 4);
+    x8 = LOAD32_LE(in + 8);
+    x9 = LOAD32_LE(in + 12);
+
+    for (i = ROUNDS; i > 0; i -= 2) {
+        x4 ^= ROTL32(x0 + x12, 7);
+        x8 ^= ROTL32(x4 + x0, 9);
+        x12 ^= ROTL32(x8 + x4, 13);
+        x0 ^= ROTL32(x12 + x8, 18);
+        x9 ^= ROTL32(x5 + x1, 7);
+        x13 ^= ROTL32(x9 + x5, 9);
+        x1 ^= ROTL32(x13 + x9, 13);
+        x5 ^= ROTL32(x1 + x13, 18);
+        x14 ^= ROTL32(x10 + x6, 7);
+        x2 ^= ROTL32(x14 + x10, 9);
+        x6 ^= ROTL32(x2 + x14, 13);
+        x10 ^= ROTL32(x6 + x2, 18);
+        x3 ^= ROTL32(x15 + x11, 7);
+        x7 ^= ROTL32(x3 + x15, 9);
+        x11 ^= ROTL32(x7 + x3, 13);
+        x15 ^= ROTL32(x11 + x7, 18);
+        x1 ^= ROTL32(x0 + x3, 7);
+        x2 ^= ROTL32(x1 + x0, 9);
+        x3 ^= ROTL32(x2 + x1, 13);
+        x0 ^= ROTL32(x3 + x2, 18);
+        x6 ^= ROTL32(x5 + x4, 7);
+        x7 ^= ROTL32(x6 + x5, 9);
+        x4 ^= ROTL32(x7 + x6, 13);
+        x5 ^= ROTL32(x4 + x7, 18);
+        x11 ^= ROTL32(x10 + x9, 7);
+        x8 ^= ROTL32(x11 + x10, 9);
+        x9 ^= ROTL32(x8 + x11, 13);
+        x10 ^= ROTL32(x9 + x8, 18);
+        x12 ^= ROTL32(x15 + x14, 7);
+        x13 ^= ROTL32(x12 + x15, 9);
+        x14 ^= ROTL32(x13 + x12, 13);
+        x15 ^= ROTL32(x14 + x13, 18);
+    }
+
+    STORE32_LE(out + 0, x0);
+    STORE32_LE(out + 4, x5);
+    STORE32_LE(out + 8, x10);
+    STORE32_LE(out + 12, x15);
+    STORE32_LE(out + 16, x6);
+    STORE32_LE(out + 20, x7);
+    STORE32_LE(out + 24, x8);
+    STORE32_LE(out + 28, x9);
+
+    return 0;
+}
diff --git a/vendor/external/libsodium/crypto_core/salsa/ref/core_salsa_ref.c b/vendor/external/libsodium/crypto_core/salsa/ref/core_salsa_ref.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_core/salsa/ref/core_salsa_ref.c
@@ -0,0 +1,195 @@
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "crypto_core_salsa20.h"
+#include "crypto_core_salsa2012.h"
+#include "crypto_core_salsa208.h"
+#include "private/common.h"
+
+static void
+crypto_core_salsa(unsigned char *out, const unsigned char *in,
+                  const unsigned char *k, const unsigned char *c,
+                  const int rounds)
+{
+    uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14,
+        x15;
+    uint32_t j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14,
+        j15;
+    int i;
+
+    j0  = x0  = 0x61707865;
+    j5  = x5  = 0x3320646e;
+    j10 = x10 = 0x79622d32;
+    j15 = x15 = 0x6b206574;
+    if (c != NULL) {
+        j0  = x0  = LOAD32_LE(c + 0);
+        j5  = x5  = LOAD32_LE(c + 4);
+        j10 = x10 = LOAD32_LE(c + 8);
+        j15 = x15 = LOAD32_LE(c + 12);
+    }
+    j1  = x1  = LOAD32_LE(k + 0);
+    j2  = x2  = LOAD32_LE(k + 4);
+    j3  = x3  = LOAD32_LE(k + 8);
+    j4  = x4  = LOAD32_LE(k + 12);
+    j11 = x11 = LOAD32_LE(k + 16);
+    j12 = x12 = LOAD32_LE(k + 20);
+    j13 = x13 = LOAD32_LE(k + 24);
+    j14 = x14 = LOAD32_LE(k + 28);
+
+    j6  = x6  = LOAD32_LE(in + 0);
+    j7  = x7  = LOAD32_LE(in + 4);
+    j8  = x8  = LOAD32_LE(in + 8);
+    j9  = x9  = LOAD32_LE(in + 12);
+
+    for (i = 0; i < rounds; i += 2) {
+        x4  ^= ROTL32(x0  + x12, 7);
+        x8  ^= ROTL32(x4  + x0, 9);
+        x12 ^= ROTL32(x8  + x4, 13);
+        x0  ^= ROTL32(x12 + x8, 18);
+        x9  ^= ROTL32(x5  + x1, 7);
+        x13 ^= ROTL32(x9  + x5, 9);
+        x1  ^= ROTL32(x13 + x9, 13);
+        x5  ^= ROTL32(x1  + x13, 18);
+        x14 ^= ROTL32(x10 + x6, 7);
+        x2  ^= ROTL32(x14 + x10, 9);
+        x6  ^= ROTL32(x2  + x14, 13);
+        x10 ^= ROTL32(x6  + x2, 18);
+        x3  ^= ROTL32(x15 + x11, 7);
+        x7  ^= ROTL32(x3  + x15, 9);
+        x11 ^= ROTL32(x7  + x3, 13);
+        x15 ^= ROTL32(x11 + x7, 18);
+        x1  ^= ROTL32(x0  + x3, 7);
+        x2  ^= ROTL32(x1  + x0, 9);
+        x3  ^= ROTL32(x2  + x1, 13);
+        x0  ^= ROTL32(x3  + x2, 18);
+        x6  ^= ROTL32(x5  + x4, 7);
+        x7  ^= ROTL32(x6  + x5, 9);
+        x4  ^= ROTL32(x7  + x6, 13);
+        x5  ^= ROTL32(x4  + x7, 18);
+        x11 ^= ROTL32(x10 + x9, 7);
+        x8  ^= ROTL32(x11 + x10, 9);
+        x9  ^= ROTL32(x8  + x11, 13);
+        x10 ^= ROTL32(x9  + x8, 18);
+        x12 ^= ROTL32(x15 + x14, 7);
+        x13 ^= ROTL32(x12 + x15, 9);
+        x14 ^= ROTL32(x13 + x12, 13);
+        x15 ^= ROTL32(x14 + x13, 18);
+    }
+    STORE32_LE(out + 0,  x0  + j0);
+    STORE32_LE(out + 4,  x1  + j1);
+    STORE32_LE(out + 8,  x2  + j2);
+    STORE32_LE(out + 12, x3  + j3);
+    STORE32_LE(out + 16, x4  + j4);
+    STORE32_LE(out + 20, x5  + j5);
+    STORE32_LE(out + 24, x6  + j6);
+    STORE32_LE(out + 28, x7  + j7);
+    STORE32_LE(out + 32, x8  + j8);
+    STORE32_LE(out + 36, x9  + j9);
+    STORE32_LE(out + 40, x10 + j10);
+    STORE32_LE(out + 44, x11 + j11);
+    STORE32_LE(out + 48, x12 + j12);
+    STORE32_LE(out + 52, x13 + j13);
+    STORE32_LE(out + 56, x14 + j14);
+    STORE32_LE(out + 60, x15 + j15);
+}
+
+int
+crypto_core_salsa20(unsigned char *out, const unsigned char *in,
+                    const unsigned char *k, const unsigned char *c)
+{
+    crypto_core_salsa(out, in, k, c, 20);
+    return 0;
+}
+
+size_t
+crypto_core_salsa20_outputbytes(void)
+{
+    return crypto_core_salsa20_OUTPUTBYTES;
+}
+
+size_t
+crypto_core_salsa20_inputbytes(void)
+{
+    return crypto_core_salsa20_INPUTBYTES;
+}
+
+size_t
+crypto_core_salsa20_keybytes(void)
+{
+    return crypto_core_salsa20_KEYBYTES;
+}
+
+size_t
+crypto_core_salsa20_constbytes(void)
+{
+    return crypto_core_salsa20_CONSTBYTES;
+}
+
+#ifndef MINIMAL
+/* LCOV_EXCL_START */
+int
+crypto_core_salsa2012(unsigned char *out, const unsigned char *in,
+                      const unsigned char *k, const unsigned char *c)
+{
+    crypto_core_salsa(out, in, k, c, 12);
+    return 0;
+}
+
+size_t
+crypto_core_salsa2012_outputbytes(void)
+{
+    return crypto_core_salsa2012_OUTPUTBYTES;
+}
+
+size_t
+crypto_core_salsa2012_inputbytes(void)
+{
+    return crypto_core_salsa2012_INPUTBYTES;
+}
+
+size_t
+crypto_core_salsa2012_keybytes(void)
+{
+    return crypto_core_salsa2012_KEYBYTES;
+}
+
+size_t
+crypto_core_salsa2012_constbytes(void)
+{
+    return crypto_core_salsa2012_CONSTBYTES;
+}
+
+int
+crypto_core_salsa208(unsigned char *out, const unsigned char *in,
+                     const unsigned char *k, const unsigned char *c)
+{
+    crypto_core_salsa(out, in, k, c, 8);
+    return 0;
+}
+
+size_t
+crypto_core_salsa208_outputbytes(void)
+{
+    return crypto_core_salsa208_OUTPUTBYTES;
+}
+
+size_t
+crypto_core_salsa208_inputbytes(void)
+{
+    return crypto_core_salsa208_INPUTBYTES;
+}
+
+size_t
+crypto_core_salsa208_keybytes(void)
+{
+    return crypto_core_salsa208_KEYBYTES;
+}
+
+size_t
+crypto_core_salsa208_constbytes(void)
+{
+    return crypto_core_salsa208_CONSTBYTES;
+}
+/* LCOV_EXCL_END */
+#endif
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/generichash_blake2.c b/vendor/external/libsodium/crypto_generichash/blake2b/generichash_blake2.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/generichash_blake2.c
@@ -0,0 +1,55 @@
+#include "crypto_generichash_blake2b.h"
+#include "randombytes.h"
+
+size_t
+crypto_generichash_blake2b_bytes_min(void) {
+    return crypto_generichash_blake2b_BYTES_MIN;
+}
+
+size_t
+crypto_generichash_blake2b_bytes_max(void) {
+    return crypto_generichash_blake2b_BYTES_MAX;
+}
+
+size_t
+crypto_generichash_blake2b_bytes(void) {
+    return crypto_generichash_blake2b_BYTES;
+}
+
+size_t
+crypto_generichash_blake2b_keybytes_min(void) {
+    return crypto_generichash_blake2b_KEYBYTES_MIN;
+}
+
+size_t
+crypto_generichash_blake2b_keybytes_max(void) {
+    return crypto_generichash_blake2b_KEYBYTES_MAX;
+}
+
+size_t
+crypto_generichash_blake2b_keybytes(void) {
+    return crypto_generichash_blake2b_KEYBYTES;
+}
+
+size_t
+crypto_generichash_blake2b_saltbytes(void) {
+    return crypto_generichash_blake2b_SALTBYTES;
+}
+
+size_t
+crypto_generichash_blake2b_personalbytes(void) {
+    return crypto_generichash_blake2b_PERSONALBYTES;
+}
+
+size_t
+crypto_generichash_blake2b_statebytes(void)
+{
+    return (sizeof(crypto_generichash_blake2b_state) + (size_t) 63U)
+        & ~(size_t) 63U;
+}
+
+void
+crypto_generichash_blake2b_keygen(unsigned char k[crypto_generichash_blake2b_KEYBYTES])
+{
+    randombytes_buf(k, crypto_generichash_blake2b_KEYBYTES);
+}
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2.h b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2.h
@@ -0,0 +1,106 @@
+/*
+   BLAKE2 reference source code package - reference C implementations
+
+   Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
+
+   To the extent possible under law, the author(s) have dedicated all copyright
+   and related and neighboring rights to this software to the public domain
+   worldwide. This software is distributed without any warranty.
+
+   All code is triple-licensed under the
+   [CC0](http://creativecommons.org/publicdomain/zero/1.0), the
+   [OpenSSL Licence](https://www.openssl.org/source/license.html), or
+   the [Apache Public License 2.0](http://www.apache.org/licenses/LICENSE-2.0),
+   at your choosing.
+ */
+
+#ifndef blake2_H
+#define blake2_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "crypto_generichash_blake2b.h"
+#include "export.h"
+
+enum blake2b_constant {
+    BLAKE2B_BLOCKBYTES    = 128,
+    BLAKE2B_OUTBYTES      = 64,
+    BLAKE2B_KEYBYTES      = 64,
+    BLAKE2B_SALTBYTES     = 16,
+    BLAKE2B_PERSONALBYTES = 16
+};
+
+#ifdef __IBMC__
+# pragma pack(1)
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+# pragma pack(1)
+#else
+# pragma pack(push, 1)
+#endif
+
+typedef struct blake2b_param_ {
+    uint8_t digest_length;                   /*  1 */
+    uint8_t key_length;                      /*  2 */
+    uint8_t fanout;                          /*  3 */
+    uint8_t depth;                           /*  4 */
+    uint8_t leaf_length[4];                  /*  8 */
+    uint8_t node_offset[8];                  /* 16 */
+    uint8_t node_depth;                      /* 17 */
+    uint8_t inner_length;                    /* 18 */
+    uint8_t reserved[14];                    /* 32 */
+    uint8_t salt[BLAKE2B_SALTBYTES];         /* 48 */
+    uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */
+} blake2b_param;
+
+typedef struct blake2b_state {
+    uint64_t h[8];
+    uint64_t t[2];
+    uint64_t f[2];
+    uint8_t  buf[2 * 128];
+    size_t   buflen;
+    uint8_t  last_node;
+} blake2b_state;
+
+#ifdef __IBMC__
+# pragma pack(pop)
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+# pragma pack()
+#else
+# pragma pack(pop)
+#endif
+
+/* Streaming API */
+int blake2b_init(blake2b_state *S, const uint8_t outlen);
+int blake2b_init_salt_personal(blake2b_state *S, const uint8_t outlen,
+                               const void *salt, const void *personal);
+int blake2b_init_key(blake2b_state *S, const uint8_t outlen, const void *key,
+                     const uint8_t keylen);
+int blake2b_init_key_salt_personal(blake2b_state *S, const uint8_t outlen,
+                                   const void *key, const uint8_t keylen,
+                                   const void *salt, const void *personal);
+int blake2b_init_param(blake2b_state *S, const blake2b_param *P);
+int blake2b_update(blake2b_state *S, const uint8_t *in, uint64_t inlen);
+int blake2b_final(blake2b_state *S, uint8_t *out, uint8_t outlen);
+
+/* Simple API */
+int blake2b(uint8_t *out, const void *in, const void *key, const uint8_t outlen,
+            const uint64_t inlen, uint8_t keylen);
+int blake2b_salt_personal(uint8_t *out, const void *in, const void *key,
+                          const uint8_t outlen, const uint64_t inlen,
+                          uint8_t keylen, const void *salt,
+                          const void *personal);
+
+typedef int (*blake2b_compress_fn)(blake2b_state *S,
+                                   const uint8_t  block[BLAKE2B_BLOCKBYTES]);
+int blake2b_pick_best_implementation(void);
+int blake2b_compress_ref(blake2b_state *S,
+                         const uint8_t  block[BLAKE2B_BLOCKBYTES]);
+int blake2b_compress_ssse3(blake2b_state *S,
+                           const uint8_t  block[BLAKE2B_BLOCKBYTES]);
+int blake2b_compress_sse41(blake2b_state *S,
+                           const uint8_t  block[BLAKE2B_BLOCKBYTES]);
+int blake2b_compress_avx2(blake2b_state *S,
+                          const uint8_t  block[BLAKE2B_BLOCKBYTES]);
+
+#endif
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c
@@ -0,0 +1,49 @@
+
+#define BLAKE2_USE_SSSE3
+#define BLAKE2_USE_SSE41
+#define BLAKE2_USE_AVX2
+
+#include <stdint.h>
+#include <string.h>
+
+#include "blake2.h"
+#include "private/common.h"
+
+#if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \
+    defined(HAVE_TMMINTRIN_H) && defined(HAVE_SMMINTRIN_H)
+
+# ifdef __GNUC__
+#  pragma GCC target("sse2")
+#  pragma GCC target("ssse3")
+#  pragma GCC target("sse4.1")
+#  pragma GCC target("avx2")
+# endif
+
+# include <emmintrin.h>
+# include <immintrin.h>
+# include <smmintrin.h>
+# include <tmmintrin.h>
+# include "private/sse2_64_32.h"
+
+# include "blake2b-compress-avx2.h"
+
+CRYPTO_ALIGN(64)
+static const uint64_t blake2b_IV[8] = {
+    0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL,
+    0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
+    0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
+};
+
+int
+blake2b_compress_avx2(blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES])
+{
+    __m256i a = LOADU(&S->h[0]);
+    __m256i b = LOADU(&S->h[4]);
+    BLAKE2B_COMPRESS_V1(a, b, block, S->t[0], S->t[1], S->f[0], S->f[1]);
+    STOREU(&S->h[0], a);
+    STOREU(&S->h[4], b);
+
+    return 0;
+}
+
+#endif
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h
@@ -0,0 +1,142 @@
+
+#ifndef blake2b_compress_avx2_H
+#define blake2b_compress_avx2_H
+
+#define LOADU128(p) _mm_loadu_si128((const __m128i *) (p))
+#define STOREU128(p, r) _mm_storeu_si128((__m128i *) (p), r)
+
+#define LOADU(p) _mm256_loadu_si256((const __m256i *) (p))
+#define STOREU(p, r) _mm256_storeu_si256((__m256i *) (p), r)
+
+#if defined(__INTEL_COMPILER) || defined(_MSC_VER) || defined(__GNUC__)
+# define LOAD(p) _mm256_load_si256((const __m256i *) (p))
+# define STORE(p, r) _mm256_store_si256((__m256i *) (p), r)
+#else
+# define LOAD(p) LOADU(p)
+# define STORE(p, r) STOREU(p, r)
+#endif
+
+static inline uint64_t
+LOADU64(const void *p)
+{
+    uint64_t v;
+    memcpy(&v, p, sizeof v);
+    return v;
+}
+
+#define ROTATE16                                                              \
+    _mm256_setr_epi8(2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9, 2, \
+                     3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9)
+
+#define ROTATE24                                                              \
+    _mm256_setr_epi8(3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10, 3, \
+                     4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10)
+
+#define ADD(a, b) _mm256_add_epi64(a, b)
+#define SUB(a, b) _mm256_sub_epi64(a, b)
+
+#define XOR(a, b) _mm256_xor_si256(a, b)
+#define AND(a, b) _mm256_and_si256(a, b)
+#define OR(a, b) _mm256_or_si256(a, b)
+
+#define ROT32(x) _mm256_shuffle_epi32((x), _MM_SHUFFLE(2, 3, 0, 1))
+#define ROT24(x) _mm256_shuffle_epi8((x), ROTATE24)
+#define ROT16(x) _mm256_shuffle_epi8((x), ROTATE16)
+#define ROT63(x) _mm256_or_si256(_mm256_srli_epi64((x), 63), ADD((x), (x)))
+
+#define BLAKE2B_G1_V1(a, b, c, d, m) \
+    do {                             \
+        a = ADD(a, m);               \
+        a = ADD(a, b);               \
+        d = XOR(d, a);               \
+        d = ROT32(d);                \
+        c = ADD(c, d);               \
+        b = XOR(b, c);               \
+        b = ROT24(b);                \
+    } while (0)
+
+#define BLAKE2B_G2_V1(a, b, c, d, m) \
+    do {                             \
+        a = ADD(a, m);               \
+        a = ADD(a, b);               \
+        d = XOR(d, a);               \
+        d = ROT16(d);                \
+        c = ADD(c, d);               \
+        b = XOR(b, c);               \
+        b = ROT63(b);                \
+    } while (0)
+
+#define BLAKE2B_DIAG_V1(a, b, c, d)                               \
+    do {                                                          \
+        a = _mm256_permute4x64_epi64(a, _MM_SHUFFLE(2, 1, 0, 3)); \
+        d = _mm256_permute4x64_epi64(d, _MM_SHUFFLE(1, 0, 3, 2)); \
+        c = _mm256_permute4x64_epi64(c, _MM_SHUFFLE(0, 3, 2, 1)); \
+    } while(0)
+
+#define BLAKE2B_UNDIAG_V1(a, b, c, d)                             \
+    do {                                                          \
+        a = _mm256_permute4x64_epi64(a, _MM_SHUFFLE(0, 3, 2, 1)); \
+        d = _mm256_permute4x64_epi64(d, _MM_SHUFFLE(1, 0, 3, 2)); \
+        c = _mm256_permute4x64_epi64(c, _MM_SHUFFLE(2, 1, 0, 3)); \
+    } while(0)
+
+#include "blake2b-load-avx2.h"
+
+#define BLAKE2B_ROUND_V1(a, b, c, d, r, m) \
+    do {                                   \
+        __m256i b0;                        \
+        BLAKE2B_LOAD_MSG_##r##_1(b0);      \
+        BLAKE2B_G1_V1(a, b, c, d, b0);     \
+        BLAKE2B_LOAD_MSG_##r##_2(b0);      \
+        BLAKE2B_G2_V1(a, b, c, d, b0);     \
+        BLAKE2B_DIAG_V1(a, b, c, d);       \
+        BLAKE2B_LOAD_MSG_##r##_3(b0);      \
+        BLAKE2B_G1_V1(a, b, c, d, b0);     \
+        BLAKE2B_LOAD_MSG_##r##_4(b0);      \
+        BLAKE2B_G2_V1(a, b, c, d, b0);     \
+        BLAKE2B_UNDIAG_V1(a, b, c, d);     \
+    } while (0)
+
+#define BLAKE2B_ROUNDS_V1(a, b, c, d, m)       \
+    do {                                       \
+        BLAKE2B_ROUND_V1(a, b, c, d, 0, (m));  \
+        BLAKE2B_ROUND_V1(a, b, c, d, 1, (m));  \
+        BLAKE2B_ROUND_V1(a, b, c, d, 2, (m));  \
+        BLAKE2B_ROUND_V1(a, b, c, d, 3, (m));  \
+        BLAKE2B_ROUND_V1(a, b, c, d, 4, (m));  \
+        BLAKE2B_ROUND_V1(a, b, c, d, 5, (m));  \
+        BLAKE2B_ROUND_V1(a, b, c, d, 6, (m));  \
+        BLAKE2B_ROUND_V1(a, b, c, d, 7, (m));  \
+        BLAKE2B_ROUND_V1(a, b, c, d, 8, (m));  \
+        BLAKE2B_ROUND_V1(a, b, c, d, 9, (m));  \
+        BLAKE2B_ROUND_V1(a, b, c, d, 10, (m)); \
+        BLAKE2B_ROUND_V1(a, b, c, d, 11, (m)); \
+    } while (0)
+
+#define DECLARE_MESSAGE_WORDS(m)                                         \
+    const __m256i m0 = _mm256_broadcastsi128_si256(LOADU128((m) + 0));   \
+    const __m256i m1 = _mm256_broadcastsi128_si256(LOADU128((m) + 16));  \
+    const __m256i m2 = _mm256_broadcastsi128_si256(LOADU128((m) + 32));  \
+    const __m256i m3 = _mm256_broadcastsi128_si256(LOADU128((m) + 48));  \
+    const __m256i m4 = _mm256_broadcastsi128_si256(LOADU128((m) + 64));  \
+    const __m256i m5 = _mm256_broadcastsi128_si256(LOADU128((m) + 80));  \
+    const __m256i m6 = _mm256_broadcastsi128_si256(LOADU128((m) + 96));  \
+    const __m256i m7 = _mm256_broadcastsi128_si256(LOADU128((m) + 112)); \
+    __m256i       t0, t1;
+
+#define BLAKE2B_COMPRESS_V1(a, b, m, t0, t1, f0, f1)                      \
+    do {                                                                  \
+        DECLARE_MESSAGE_WORDS(m)                                          \
+        const __m256i iv0 = a;                                            \
+        const __m256i iv1 = b;                                            \
+        __m256i       c   = LOAD(&blake2b_IV[0]);                         \
+        __m256i       d =                                                 \
+            XOR(LOAD(&blake2b_IV[4]), _mm256_set_epi64x(f1, f0, t1, t0)); \
+        BLAKE2B_ROUNDS_V1(a, b, c, d, m);                                 \
+        a = XOR(a, c);                                                    \
+        b = XOR(b, d);                                                    \
+        a = XOR(a, iv0);                                                  \
+        b = XOR(b, iv1);                                                  \
+    } while (0)
+
+#endif
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c
@@ -0,0 +1,93 @@
+
+#include <stdint.h>
+#include <string.h>
+
+#include "blake2.h"
+#include "private/common.h"
+
+CRYPTO_ALIGN(64)
+static const uint64_t blake2b_IV[8] = {
+    0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL,
+    0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
+    0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
+};
+
+static const uint8_t blake2b_sigma[12][16] = {
+    { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
+    { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },
+    { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },
+    { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 },
+    { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },
+    { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 },
+    { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 },
+    { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 },
+    { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 },
+    { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },
+    { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
+    { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }
+};
+
+int
+blake2b_compress_ref(blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES])
+{
+    uint64_t m[16];
+    uint64_t v[16];
+    int      i;
+
+    for (i = 0; i < 16; ++i) {
+        m[i] = LOAD64_LE(block + i * sizeof m[i]);
+    }
+    for (i = 0; i < 8; ++i) {
+        v[i] = S->h[i];
+    }
+    v[8]  = blake2b_IV[0];
+    v[9]  = blake2b_IV[1];
+    v[10] = blake2b_IV[2];
+    v[11] = blake2b_IV[3];
+    v[12] = S->t[0] ^ blake2b_IV[4];
+    v[13] = S->t[1] ^ blake2b_IV[5];
+    v[14] = S->f[0] ^ blake2b_IV[6];
+    v[15] = S->f[1] ^ blake2b_IV[7];
+#define G(r, i, a, b, c, d)                      \
+    do {                                         \
+        a += b + m[blake2b_sigma[r][2 * i + 0]]; \
+        d = ROTR64(d ^ a, 32);                   \
+        c += d;                                  \
+        b = ROTR64(b ^ c, 24);                   \
+        a += b + m[blake2b_sigma[r][2 * i + 1]]; \
+        d = ROTR64(d ^ a, 16);                   \
+        c += d;                                  \
+        b = ROTR64(b ^ c, 63);                   \
+    } while (0)
+#define ROUND(r)                           \
+    do {                                   \
+        G(r, 0, v[0], v[4], v[8], v[12]);  \
+        G(r, 1, v[1], v[5], v[9], v[13]);  \
+        G(r, 2, v[2], v[6], v[10], v[14]); \
+        G(r, 3, v[3], v[7], v[11], v[15]); \
+        G(r, 4, v[0], v[5], v[10], v[15]); \
+        G(r, 5, v[1], v[6], v[11], v[12]); \
+        G(r, 6, v[2], v[7], v[8], v[13]);  \
+        G(r, 7, v[3], v[4], v[9], v[14]);  \
+    } while (0)
+    ROUND(0);
+    ROUND(1);
+    ROUND(2);
+    ROUND(3);
+    ROUND(4);
+    ROUND(5);
+    ROUND(6);
+    ROUND(7);
+    ROUND(8);
+    ROUND(9);
+    ROUND(10);
+    ROUND(11);
+
+    for (i = 0; i < 8; ++i) {
+        S->h[i] = S->h[i] ^ v[i] ^ v[i + 8];
+    }
+
+#undef G
+#undef ROUND
+    return 0;
+}
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.c b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.c
@@ -0,0 +1,87 @@
+
+#define BLAKE2_USE_SSSE3
+#define BLAKE2_USE_SSE41
+
+#include <stdint.h>
+#include <string.h>
+
+#include "blake2.h"
+#include "private/common.h"
+
+#if defined(HAVE_EMMINTRIN_H) && defined(HAVE_TMMINTRIN_H) && \
+    defined(HAVE_SMMINTRIN_H)
+
+# ifdef __GNUC__
+#  pragma GCC target("sse2")
+#  pragma GCC target("ssse3")
+#  pragma GCC target("sse4.1")
+# endif
+
+# include <emmintrin.h>
+# include <smmintrin.h>
+# include <tmmintrin.h>
+# include "private/sse2_64_32.h"
+
+# include "blake2b-compress-sse41.h"
+
+CRYPTO_ALIGN(64)
+static const uint64_t blake2b_IV[8] = {
+    0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL,
+    0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
+    0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
+};
+
+int
+blake2b_compress_sse41(blake2b_state *S,
+                       const uint8_t  block[BLAKE2B_BLOCKBYTES])
+{
+    __m128i       row1l, row1h;
+    __m128i       row2l, row2h;
+    __m128i       row3l, row3h;
+    __m128i       row4l, row4h;
+    __m128i       b0, b1;
+    __m128i       t0, t1;
+    const __m128i r16 =
+        _mm_setr_epi8(2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9);
+    const __m128i r24 =
+        _mm_setr_epi8(3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10);
+    const __m128i m0 = LOADU(block + 00);
+    const __m128i m1 = LOADU(block + 16);
+    const __m128i m2 = LOADU(block + 32);
+    const __m128i m3 = LOADU(block + 48);
+    const __m128i m4 = LOADU(block + 64);
+    const __m128i m5 = LOADU(block + 80);
+    const __m128i m6 = LOADU(block + 96);
+    const __m128i m7 = LOADU(block + 112);
+    row1l            = LOADU(&S->h[0]);
+    row1h            = LOADU(&S->h[2]);
+    row2l            = LOADU(&S->h[4]);
+    row2h            = LOADU(&S->h[6]);
+    row3l            = LOADU(&blake2b_IV[0]);
+    row3h            = LOADU(&blake2b_IV[2]);
+    row4l            = _mm_xor_si128(LOADU(&blake2b_IV[4]), LOADU(&S->t[0]));
+    row4h            = _mm_xor_si128(LOADU(&blake2b_IV[6]), LOADU(&S->f[0]));
+    ROUND(0);
+    ROUND(1);
+    ROUND(2);
+    ROUND(3);
+    ROUND(4);
+    ROUND(5);
+    ROUND(6);
+    ROUND(7);
+    ROUND(8);
+    ROUND(9);
+    ROUND(10);
+    ROUND(11);
+    row1l = _mm_xor_si128(row3l, row1l);
+    row1h = _mm_xor_si128(row3h, row1h);
+    STOREU(&S->h[0], _mm_xor_si128(LOADU(&S->h[0]), row1l));
+    STOREU(&S->h[2], _mm_xor_si128(LOADU(&S->h[2]), row1h));
+    row2l = _mm_xor_si128(row4l, row2l);
+    row2h = _mm_xor_si128(row4h, row2h);
+    STOREU(&S->h[4], _mm_xor_si128(LOADU(&S->h[4]), row2l));
+    STOREU(&S->h[6], _mm_xor_si128(LOADU(&S->h[6]), row2h));
+    return 0;
+}
+
+#endif
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.h b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.h
@@ -0,0 +1,106 @@
+
+#ifndef blake2b_compress_sse41_H
+#define blake2b_compress_sse41_H
+
+#define LOADU(p) _mm_loadu_si128((const __m128i *) (const void *) (p))
+#define STOREU(p, r) _mm_storeu_si128((__m128i *) (void *) (p), r)
+
+#if !(defined(_mm_roti_epi64) && defined(__XOP__))
+#undef  _mm_roti_epi64
+#define _mm_roti_epi64(x, c)                                         \
+    (-(c) == 32)                                                     \
+        ? _mm_shuffle_epi32((x), _MM_SHUFFLE(2, 3, 0, 1))            \
+        : (-(c) == 24)                                               \
+              ? _mm_shuffle_epi8((x), r24)                           \
+              : (-(c) == 16)                                         \
+                    ? _mm_shuffle_epi8((x), r16)                     \
+                    : (-(c) == 63)                                   \
+                          ? _mm_xor_si128(_mm_srli_epi64((x), -(c)), \
+                                          _mm_add_epi64((x), (x)))   \
+                          : _mm_xor_si128(_mm_srli_epi64((x), -(c)), \
+                                          _mm_slli_epi64((x), 64 - (-(c))))
+#endif
+
+#define G1(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1) \
+    row1l = _mm_add_epi64(_mm_add_epi64(row1l, b0), row2l);                \
+    row1h = _mm_add_epi64(_mm_add_epi64(row1h, b1), row2h);                \
+                                                                           \
+    row4l = _mm_xor_si128(row4l, row1l);                                   \
+    row4h = _mm_xor_si128(row4h, row1h);                                   \
+                                                                           \
+    row4l = _mm_roti_epi64(row4l, -32);                                    \
+    row4h = _mm_roti_epi64(row4h, -32);                                    \
+                                                                           \
+    row3l = _mm_add_epi64(row3l, row4l);                                   \
+    row3h = _mm_add_epi64(row3h, row4h);                                   \
+                                                                           \
+    row2l = _mm_xor_si128(row2l, row3l);                                   \
+    row2h = _mm_xor_si128(row2h, row3h);                                   \
+                                                                           \
+    row2l = _mm_roti_epi64(row2l, -24);                                    \
+    row2h = _mm_roti_epi64(row2h, -24);
+
+#define G2(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1) \
+    row1l = _mm_add_epi64(_mm_add_epi64(row1l, b0), row2l);                \
+    row1h = _mm_add_epi64(_mm_add_epi64(row1h, b1), row2h);                \
+                                                                           \
+    row4l = _mm_xor_si128(row4l, row1l);                                   \
+    row4h = _mm_xor_si128(row4h, row1h);                                   \
+                                                                           \
+    row4l = _mm_roti_epi64(row4l, -16);                                    \
+    row4h = _mm_roti_epi64(row4h, -16);                                    \
+                                                                           \
+    row3l = _mm_add_epi64(row3l, row4l);                                   \
+    row3h = _mm_add_epi64(row3h, row4h);                                   \
+                                                                           \
+    row2l = _mm_xor_si128(row2l, row3l);                                   \
+    row2h = _mm_xor_si128(row2h, row3h);                                   \
+                                                                           \
+    row2l = _mm_roti_epi64(row2l, -63);                                    \
+    row2h = _mm_roti_epi64(row2h, -63);
+
+#define DIAGONALIZE(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h) \
+    t0    = _mm_alignr_epi8(row2h, row2l, 8);                               \
+    t1    = _mm_alignr_epi8(row2l, row2h, 8);                               \
+    row2l = t0;                                                             \
+    row2h = t1;                                                             \
+                                                                            \
+    t0    = row3l;                                                          \
+    row3l = row3h;                                                          \
+    row3h = t0;                                                             \
+                                                                            \
+    t0    = _mm_alignr_epi8(row4h, row4l, 8);                               \
+    t1    = _mm_alignr_epi8(row4l, row4h, 8);                               \
+    row4l = t1;                                                             \
+    row4h = t0;
+
+#define UNDIAGONALIZE(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h) \
+    t0    = _mm_alignr_epi8(row2l, row2h, 8);                                 \
+    t1    = _mm_alignr_epi8(row2h, row2l, 8);                                 \
+    row2l = t0;                                                               \
+    row2h = t1;                                                               \
+                                                                              \
+    t0    = row3l;                                                            \
+    row3l = row3h;                                                            \
+    row3h = t0;                                                               \
+                                                                              \
+    t0    = _mm_alignr_epi8(row4l, row4h, 8);                                 \
+    t1    = _mm_alignr_epi8(row4h, row4l, 8);                                 \
+    row4l = t1;                                                               \
+    row4h = t0;
+
+#include "blake2b-load-sse41.h"
+
+#define ROUND(r)                                                         \
+    LOAD_MSG_##r##_1(b0, b1);                                            \
+    G1(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1);  \
+    LOAD_MSG_##r##_2(b0, b1);                                            \
+    G2(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1);  \
+    DIAGONALIZE(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h); \
+    LOAD_MSG_##r##_3(b0, b1);                                            \
+    G1(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1);  \
+    LOAD_MSG_##r##_4(b0, b1);                                            \
+    G2(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1);  \
+    UNDIAGONALIZE(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h);
+
+#endif
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c
@@ -0,0 +1,90 @@
+
+#include <stdint.h>
+#include <string.h>
+
+#include "blake2.h"
+#include "private/common.h"
+
+#if defined(HAVE_EMMINTRIN_H) && defined(HAVE_TMMINTRIN_H)
+
+# ifdef __GNUC__
+#  pragma GCC target("sse2")
+#  pragma GCC target("ssse3")
+# endif
+
+# include <emmintrin.h>
+# include <tmmintrin.h>
+# include "private/sse2_64_32.h"
+
+# include "blake2b-compress-ssse3.h"
+
+CRYPTO_ALIGN(64)
+static const uint64_t blake2b_IV[8] = {
+    0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL,
+    0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
+    0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
+};
+
+int
+blake2b_compress_ssse3(blake2b_state *S,
+                       const uint8_t  block[BLAKE2B_BLOCKBYTES])
+{
+    __m128i       row1l, row1h;
+    __m128i       row2l, row2h;
+    __m128i       row3l, row3h;
+    __m128i       row4l, row4h;
+    __m128i       b0, b1;
+    __m128i       t0, t1;
+    const __m128i r16 =
+        _mm_setr_epi8(2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9);
+    const __m128i r24 =
+        _mm_setr_epi8(3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10);
+    const uint64_t m0  = ((const uint64_t *) block)[0];
+    const uint64_t m1  = ((const uint64_t *) block)[1];
+    const uint64_t m2  = ((const uint64_t *) block)[2];
+    const uint64_t m3  = ((const uint64_t *) block)[3];
+    const uint64_t m4  = ((const uint64_t *) block)[4];
+    const uint64_t m5  = ((const uint64_t *) block)[5];
+    const uint64_t m6  = ((const uint64_t *) block)[6];
+    const uint64_t m7  = ((const uint64_t *) block)[7];
+    const uint64_t m8  = ((const uint64_t *) block)[8];
+    const uint64_t m9  = ((const uint64_t *) block)[9];
+    const uint64_t m10 = ((const uint64_t *) block)[10];
+    const uint64_t m11 = ((const uint64_t *) block)[11];
+    const uint64_t m12 = ((const uint64_t *) block)[12];
+    const uint64_t m13 = ((const uint64_t *) block)[13];
+    const uint64_t m14 = ((const uint64_t *) block)[14];
+    const uint64_t m15 = ((const uint64_t *) block)[15];
+
+    row1l = LOADU(&S->h[0]);
+    row1h = LOADU(&S->h[2]);
+    row2l = LOADU(&S->h[4]);
+    row2h = LOADU(&S->h[6]);
+    row3l = LOADU(&blake2b_IV[0]);
+    row3h = LOADU(&blake2b_IV[2]);
+    row4l = _mm_xor_si128(LOADU(&blake2b_IV[4]), LOADU(&S->t[0]));
+    row4h = _mm_xor_si128(LOADU(&blake2b_IV[6]), LOADU(&S->f[0]));
+    ROUND(0);
+    ROUND(1);
+    ROUND(2);
+    ROUND(3);
+    ROUND(4);
+    ROUND(5);
+    ROUND(6);
+    ROUND(7);
+    ROUND(8);
+    ROUND(9);
+    ROUND(10);
+    ROUND(11);
+    row1l = _mm_xor_si128(row3l, row1l);
+    row1h = _mm_xor_si128(row3h, row1h);
+    STOREU(&S->h[0], _mm_xor_si128(LOADU(&S->h[0]), row1l));
+    STOREU(&S->h[2], _mm_xor_si128(LOADU(&S->h[2]), row1h));
+    row2l = _mm_xor_si128(row4l, row2l);
+    row2h = _mm_xor_si128(row4h, row2h);
+    STOREU(&S->h[4], _mm_xor_si128(LOADU(&S->h[4]), row2l));
+    STOREU(&S->h[6], _mm_xor_si128(LOADU(&S->h[6]), row2h));
+    return 0;
+}
+
+#endif
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.h b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.h
@@ -0,0 +1,106 @@
+
+#ifndef blake2b_compress_ssse3_H
+#define blake2b_compress_ssse3_H
+
+#define LOADU(p) _mm_loadu_si128((const __m128i *) (const void *) (p))
+#define STOREU(p, r) _mm_storeu_si128((__m128i *) (void *) (p), r)
+
+#if !(defined(_mm_roti_epi64) && defined(__XOP__))
+#undef  _mm_roti_epi64
+#define _mm_roti_epi64(x, c)                                         \
+    (-(c) == 32)                                                     \
+        ? _mm_shuffle_epi32((x), _MM_SHUFFLE(2, 3, 0, 1))            \
+        : (-(c) == 24)                                               \
+              ? _mm_shuffle_epi8((x), r24)                           \
+              : (-(c) == 16)                                         \
+                    ? _mm_shuffle_epi8((x), r16)                     \
+                    : (-(c) == 63)                                   \
+                          ? _mm_xor_si128(_mm_srli_epi64((x), -(c)), \
+                                          _mm_add_epi64((x), (x)))   \
+                          : _mm_xor_si128(_mm_srli_epi64((x), -(c)), \
+                                          _mm_slli_epi64((x), 64 - (-(c))))
+#endif
+
+#define G1(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1) \
+    row1l = _mm_add_epi64(_mm_add_epi64(row1l, b0), row2l);                \
+    row1h = _mm_add_epi64(_mm_add_epi64(row1h, b1), row2h);                \
+                                                                           \
+    row4l = _mm_xor_si128(row4l, row1l);                                   \
+    row4h = _mm_xor_si128(row4h, row1h);                                   \
+                                                                           \
+    row4l = _mm_roti_epi64(row4l, -32);                                    \
+    row4h = _mm_roti_epi64(row4h, -32);                                    \
+                                                                           \
+    row3l = _mm_add_epi64(row3l, row4l);                                   \
+    row3h = _mm_add_epi64(row3h, row4h);                                   \
+                                                                           \
+    row2l = _mm_xor_si128(row2l, row3l);                                   \
+    row2h = _mm_xor_si128(row2h, row3h);                                   \
+                                                                           \
+    row2l = _mm_roti_epi64(row2l, -24);                                    \
+    row2h = _mm_roti_epi64(row2h, -24);
+
+#define G2(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1) \
+    row1l = _mm_add_epi64(_mm_add_epi64(row1l, b0), row2l);                \
+    row1h = _mm_add_epi64(_mm_add_epi64(row1h, b1), row2h);                \
+                                                                           \
+    row4l = _mm_xor_si128(row4l, row1l);                                   \
+    row4h = _mm_xor_si128(row4h, row1h);                                   \
+                                                                           \
+    row4l = _mm_roti_epi64(row4l, -16);                                    \
+    row4h = _mm_roti_epi64(row4h, -16);                                    \
+                                                                           \
+    row3l = _mm_add_epi64(row3l, row4l);                                   \
+    row3h = _mm_add_epi64(row3h, row4h);                                   \
+                                                                           \
+    row2l = _mm_xor_si128(row2l, row3l);                                   \
+    row2h = _mm_xor_si128(row2h, row3h);                                   \
+                                                                           \
+    row2l = _mm_roti_epi64(row2l, -63);                                    \
+    row2h = _mm_roti_epi64(row2h, -63);
+
+#define DIAGONALIZE(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h) \
+    t0    = _mm_alignr_epi8(row2h, row2l, 8);                               \
+    t1    = _mm_alignr_epi8(row2l, row2h, 8);                               \
+    row2l = t0;                                                             \
+    row2h = t1;                                                             \
+                                                                            \
+    t0    = row3l;                                                          \
+    row3l = row3h;                                                          \
+    row3h = t0;                                                             \
+                                                                            \
+    t0    = _mm_alignr_epi8(row4h, row4l, 8);                               \
+    t1    = _mm_alignr_epi8(row4l, row4h, 8);                               \
+    row4l = t1;                                                             \
+    row4h = t0;
+
+#define UNDIAGONALIZE(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h) \
+    t0    = _mm_alignr_epi8(row2l, row2h, 8);                                 \
+    t1    = _mm_alignr_epi8(row2h, row2l, 8);                                 \
+    row2l = t0;                                                               \
+    row2h = t1;                                                               \
+                                                                              \
+    t0    = row3l;                                                            \
+    row3l = row3h;                                                            \
+    row3h = t0;                                                               \
+                                                                              \
+    t0    = _mm_alignr_epi8(row4l, row4h, 8);                                 \
+    t1    = _mm_alignr_epi8(row4h, row4l, 8);                                 \
+    row4l = t1;                                                               \
+    row4h = t0;
+
+#include "blake2b-load-sse2.h"
+
+#define ROUND(r)                                                         \
+    LOAD_MSG_##r##_1(b0, b1);                                            \
+    G1(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1);  \
+    LOAD_MSG_##r##_2(b0, b1);                                            \
+    G2(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1);  \
+    DIAGONALIZE(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h); \
+    LOAD_MSG_##r##_3(b0, b1);                                            \
+    G1(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1);  \
+    LOAD_MSG_##r##_4(b0, b1);                                            \
+    G2(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h, b0, b1);  \
+    UNDIAGONALIZE(row1l, row2l, row3l, row4l, row1h, row2h, row3h, row4h);
+
+#endif
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-avx2.h b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-avx2.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-avx2.h
@@ -0,0 +1,340 @@
+#ifndef blake2b_load_avx2_H
+#define blake2b_load_avx2_H
+
+#define BLAKE2B_LOAD_MSG_0_1(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m0, m1);    \
+        t1 = _mm256_unpacklo_epi64(m2, m3);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_0_2(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m0, m1);    \
+        t1 = _mm256_unpackhi_epi64(m2, m3);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_0_3(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m7, m4);    \
+        t1 = _mm256_unpacklo_epi64(m5, m6);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_0_4(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m7, m4);    \
+        t1 = _mm256_unpackhi_epi64(m5, m6);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_1_1(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m7, m2);    \
+        t1 = _mm256_unpackhi_epi64(m4, m6);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_1_2(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m5, m4);    \
+        t1 = _mm256_alignr_epi8(m3, m7, 8);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_1_3(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m2, m0);    \
+        t1 = _mm256_blend_epi32(m5, m0, 0x33); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_1_4(b0)               \
+    do {                                       \
+        t0 = _mm256_alignr_epi8(m6, m1, 8);    \
+        t1 = _mm256_blend_epi32(m3, m1, 0x33); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_2_1(b0)               \
+    do {                                       \
+        t0 = _mm256_alignr_epi8(m6, m5, 8);    \
+        t1 = _mm256_unpackhi_epi64(m2, m7);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_2_2(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m4, m0);    \
+        t1 = _mm256_blend_epi32(m6, m1, 0x33); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_2_3(b0)               \
+    do {                                       \
+        t0 = _mm256_alignr_epi8(m5, m4, 8);    \
+        t1 = _mm256_unpackhi_epi64(m1, m3);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_2_4(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m2, m7);    \
+        t1 = _mm256_blend_epi32(m0, m3, 0x33); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_3_1(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m3, m1);    \
+        t1 = _mm256_unpackhi_epi64(m6, m5);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_3_2(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m4, m0);    \
+        t1 = _mm256_unpacklo_epi64(m6, m7);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_3_3(b0)                                \
+    do {                                                        \
+        t0 = _mm256_alignr_epi8(m1, m7, 8);                     \
+        t1 = _mm256_shuffle_epi32(m2, _MM_SHUFFLE(1, 0, 3, 2)); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0);                  \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_3_4(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m4, m3);    \
+        t1 = _mm256_unpacklo_epi64(m5, m0);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_4_1(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m4, m2);    \
+        t1 = _mm256_unpacklo_epi64(m1, m5);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_4_2(b0)               \
+    do {                                       \
+        t0 = _mm256_blend_epi32(m3, m0, 0x33); \
+        t1 = _mm256_blend_epi32(m7, m2, 0x33); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_4_3(b0)               \
+    do {                                       \
+        t0 = _mm256_alignr_epi8(m7, m1, 8);    \
+        t1 = _mm256_alignr_epi8(m3, m5, 8);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_4_4(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m6, m0);    \
+        t1 = _mm256_unpacklo_epi64(m6, m4);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_5_1(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m1, m3);    \
+        t1 = _mm256_unpacklo_epi64(m0, m4);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_5_2(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m6, m5);    \
+        t1 = _mm256_unpackhi_epi64(m5, m1);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_5_3(b0)               \
+    do {                                       \
+        t0 = _mm256_alignr_epi8(m2, m0, 8);    \
+        t1 = _mm256_unpackhi_epi64(m3, m7);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_5_4(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m4, m6);    \
+        t1 = _mm256_alignr_epi8(m7, m2, 8);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_6_1(b0)               \
+    do {                                       \
+        t0 = _mm256_blend_epi32(m0, m6, 0x33); \
+        t1 = _mm256_unpacklo_epi64(m7, m2);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_6_2(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m2, m7);    \
+        t1 = _mm256_alignr_epi8(m5, m6, 8);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_6_3(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m4, m0);    \
+        t1 = _mm256_blend_epi32(m4, m3, 0x33); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_6_4(b0)                                \
+    do {                                                        \
+        t0 = _mm256_unpackhi_epi64(m5, m3);                     \
+        t1 = _mm256_shuffle_epi32(m1, _MM_SHUFFLE(1, 0, 3, 2)); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0);                  \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_7_1(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m6, m3);    \
+        t1 = _mm256_blend_epi32(m1, m6, 0x33); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_7_2(b0)               \
+    do {                                       \
+        t0 = _mm256_alignr_epi8(m7, m5, 8);    \
+        t1 = _mm256_unpackhi_epi64(m0, m4);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_7_3(b0)               \
+    do {                                       \
+        t0 = _mm256_blend_epi32(m2, m1, 0x33); \
+        t1 = _mm256_alignr_epi8(m4, m7, 8);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_7_4(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m5, m0);    \
+        t1 = _mm256_unpacklo_epi64(m2, m3);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_8_1(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m3, m7);    \
+        t1 = _mm256_alignr_epi8(m0, m5, 8);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_8_2(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m7, m4);    \
+        t1 = _mm256_alignr_epi8(m4, m1, 8);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_8_3(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m5, m6);    \
+        t1 = _mm256_unpackhi_epi64(m6, m0);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_8_4(b0)               \
+    do {                                       \
+        t0 = _mm256_alignr_epi8(m1, m2, 8);    \
+        t1 = _mm256_alignr_epi8(m2, m3, 8);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_9_1(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m5, m4);    \
+        t1 = _mm256_unpackhi_epi64(m3, m0);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_9_2(b0)               \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m1, m2);    \
+        t1 = _mm256_blend_epi32(m2, m3, 0x33); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_9_3(b0)               \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m6, m7);    \
+        t1 = _mm256_unpackhi_epi64(m4, m1);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_9_4(b0)               \
+    do {                                       \
+        t0 = _mm256_blend_epi32(m5, m0, 0x33); \
+        t1 = _mm256_unpacklo_epi64(m7, m6);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_10_1(b0)              \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m0, m1);    \
+        t1 = _mm256_unpacklo_epi64(m2, m3);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_10_2(b0)              \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m0, m1);    \
+        t1 = _mm256_unpackhi_epi64(m2, m3);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_10_3(b0)              \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m7, m4);    \
+        t1 = _mm256_unpacklo_epi64(m5, m6);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_10_4(b0)              \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m7, m4);    \
+        t1 = _mm256_unpackhi_epi64(m5, m6);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_11_1(b0)              \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m7, m2);    \
+        t1 = _mm256_unpackhi_epi64(m4, m6);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_11_2(b0)              \
+    do {                                       \
+        t0 = _mm256_unpacklo_epi64(m5, m4);    \
+        t1 = _mm256_alignr_epi8(m3, m7, 8);    \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_11_3(b0)              \
+    do {                                       \
+        t0 = _mm256_unpackhi_epi64(m2, m0);    \
+        t1 = _mm256_blend_epi32(m5, m0, 0x33); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#define BLAKE2B_LOAD_MSG_11_4(b0)              \
+    do {                                       \
+        t0 = _mm256_alignr_epi8(m6, m1, 8);    \
+        t1 = _mm256_blend_epi32(m3, m1, 0x33); \
+        b0 = _mm256_blend_epi32(t0, t1, 0xF0); \
+    } while (0)
+
+#endif
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse2.h b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse2.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse2.h
@@ -0,0 +1,164 @@
+/*
+   BLAKE2 reference source code package - optimized C implementations
+
+   Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
+
+   To the extent possible under law, the author(s) have dedicated all copyright
+   and related and neighboring rights to this software to the public domain
+   worldwide. This software is distributed without any warranty.
+
+   You should have received a copy of the CC0 Public Domain Dedication along
+   with
+   this software. If not, see
+   <http://creativecommons.org/publicdomain/zero/1.0/>.
+*/
+
+#ifndef blake2b_load_sse2_H
+#define blake2b_load_sse2_H
+
+#define LOAD_MSG_0_1(b0, b1)     \
+    b0 = _mm_set_epi64x(m2, m0); \
+    b1 = _mm_set_epi64x(m6, m4)
+#define LOAD_MSG_0_2(b0, b1)     \
+    b0 = _mm_set_epi64x(m3, m1); \
+    b1 = _mm_set_epi64x(m7, m5)
+#define LOAD_MSG_0_3(b0, b1)      \
+    b0 = _mm_set_epi64x(m10, m8); \
+    b1 = _mm_set_epi64x(m14, m12)
+#define LOAD_MSG_0_4(b0, b1)      \
+    b0 = _mm_set_epi64x(m11, m9); \
+    b1 = _mm_set_epi64x(m15, m13)
+#define LOAD_MSG_1_1(b0, b1)      \
+    b0 = _mm_set_epi64x(m4, m14); \
+    b1 = _mm_set_epi64x(m13, m9)
+#define LOAD_MSG_1_2(b0, b1)      \
+    b0 = _mm_set_epi64x(m8, m10); \
+    b1 = _mm_set_epi64x(m6, m15)
+#define LOAD_MSG_1_3(b0, b1)     \
+    b0 = _mm_set_epi64x(m0, m1); \
+    b1 = _mm_set_epi64x(m5, m11)
+#define LOAD_MSG_1_4(b0, b1)      \
+    b0 = _mm_set_epi64x(m2, m12); \
+    b1 = _mm_set_epi64x(m3, m7)
+#define LOAD_MSG_2_1(b0, b1)       \
+    b0 = _mm_set_epi64x(m12, m11); \
+    b1 = _mm_set_epi64x(m15, m5)
+#define LOAD_MSG_2_2(b0, b1)     \
+    b0 = _mm_set_epi64x(m0, m8); \
+    b1 = _mm_set_epi64x(m13, m2)
+#define LOAD_MSG_2_3(b0, b1)      \
+    b0 = _mm_set_epi64x(m3, m10); \
+    b1 = _mm_set_epi64x(m9, m7)
+#define LOAD_MSG_2_4(b0, b1)      \
+    b0 = _mm_set_epi64x(m6, m14); \
+    b1 = _mm_set_epi64x(m4, m1)
+#define LOAD_MSG_3_1(b0, b1)     \
+    b0 = _mm_set_epi64x(m3, m7); \
+    b1 = _mm_set_epi64x(m11, m13)
+#define LOAD_MSG_3_2(b0, b1)     \
+    b0 = _mm_set_epi64x(m1, m9); \
+    b1 = _mm_set_epi64x(m14, m12)
+#define LOAD_MSG_3_3(b0, b1)     \
+    b0 = _mm_set_epi64x(m5, m2); \
+    b1 = _mm_set_epi64x(m15, m4)
+#define LOAD_MSG_3_4(b0, b1)      \
+    b0 = _mm_set_epi64x(m10, m6); \
+    b1 = _mm_set_epi64x(m8, m0)
+#define LOAD_MSG_4_1(b0, b1)     \
+    b0 = _mm_set_epi64x(m5, m9); \
+    b1 = _mm_set_epi64x(m10, m2)
+#define LOAD_MSG_4_2(b0, b1)     \
+    b0 = _mm_set_epi64x(m7, m0); \
+    b1 = _mm_set_epi64x(m15, m4)
+#define LOAD_MSG_4_3(b0, b1)       \
+    b0 = _mm_set_epi64x(m11, m14); \
+    b1 = _mm_set_epi64x(m3, m6)
+#define LOAD_MSG_4_4(b0, b1)      \
+    b0 = _mm_set_epi64x(m12, m1); \
+    b1 = _mm_set_epi64x(m13, m8)
+#define LOAD_MSG_5_1(b0, b1)     \
+    b0 = _mm_set_epi64x(m6, m2); \
+    b1 = _mm_set_epi64x(m8, m0)
+#define LOAD_MSG_5_2(b0, b1)       \
+    b0 = _mm_set_epi64x(m10, m12); \
+    b1 = _mm_set_epi64x(m3, m11)
+#define LOAD_MSG_5_3(b0, b1)     \
+    b0 = _mm_set_epi64x(m7, m4); \
+    b1 = _mm_set_epi64x(m1, m15)
+#define LOAD_MSG_5_4(b0, b1)      \
+    b0 = _mm_set_epi64x(m5, m13); \
+    b1 = _mm_set_epi64x(m9, m14)
+#define LOAD_MSG_6_1(b0, b1)      \
+    b0 = _mm_set_epi64x(m1, m12); \
+    b1 = _mm_set_epi64x(m4, m14)
+#define LOAD_MSG_6_2(b0, b1)      \
+    b0 = _mm_set_epi64x(m15, m5); \
+    b1 = _mm_set_epi64x(m10, m13)
+#define LOAD_MSG_6_3(b0, b1)     \
+    b0 = _mm_set_epi64x(m6, m0); \
+    b1 = _mm_set_epi64x(m8, m9)
+#define LOAD_MSG_6_4(b0, b1)     \
+    b0 = _mm_set_epi64x(m3, m7); \
+    b1 = _mm_set_epi64x(m11, m2)
+#define LOAD_MSG_7_1(b0, b1)      \
+    b0 = _mm_set_epi64x(m7, m13); \
+    b1 = _mm_set_epi64x(m3, m12)
+#define LOAD_MSG_7_2(b0, b1)       \
+    b0 = _mm_set_epi64x(m14, m11); \
+    b1 = _mm_set_epi64x(m9, m1)
+#define LOAD_MSG_7_3(b0, b1)      \
+    b0 = _mm_set_epi64x(m15, m5); \
+    b1 = _mm_set_epi64x(m2, m8)
+#define LOAD_MSG_7_4(b0, b1)     \
+    b0 = _mm_set_epi64x(m4, m0); \
+    b1 = _mm_set_epi64x(m10, m6)
+#define LOAD_MSG_8_1(b0, b1)      \
+    b0 = _mm_set_epi64x(m14, m6); \
+    b1 = _mm_set_epi64x(m0, m11)
+#define LOAD_MSG_8_2(b0, b1)      \
+    b0 = _mm_set_epi64x(m9, m15); \
+    b1 = _mm_set_epi64x(m8, m3)
+#define LOAD_MSG_8_3(b0, b1)       \
+    b0 = _mm_set_epi64x(m13, m12); \
+    b1 = _mm_set_epi64x(m10, m1)
+#define LOAD_MSG_8_4(b0, b1)     \
+    b0 = _mm_set_epi64x(m7, m2); \
+    b1 = _mm_set_epi64x(m5, m4)
+#define LOAD_MSG_9_1(b0, b1)      \
+    b0 = _mm_set_epi64x(m8, m10); \
+    b1 = _mm_set_epi64x(m1, m7)
+#define LOAD_MSG_9_2(b0, b1)     \
+    b0 = _mm_set_epi64x(m4, m2); \
+    b1 = _mm_set_epi64x(m5, m6)
+#define LOAD_MSG_9_3(b0, b1)      \
+    b0 = _mm_set_epi64x(m9, m15); \
+    b1 = _mm_set_epi64x(m13, m3)
+#define LOAD_MSG_9_4(b0, b1)       \
+    b0 = _mm_set_epi64x(m14, m11); \
+    b1 = _mm_set_epi64x(m0, m12)
+#define LOAD_MSG_10_1(b0, b1)    \
+    b0 = _mm_set_epi64x(m2, m0); \
+    b1 = _mm_set_epi64x(m6, m4)
+#define LOAD_MSG_10_2(b0, b1)    \
+    b0 = _mm_set_epi64x(m3, m1); \
+    b1 = _mm_set_epi64x(m7, m5)
+#define LOAD_MSG_10_3(b0, b1)     \
+    b0 = _mm_set_epi64x(m10, m8); \
+    b1 = _mm_set_epi64x(m14, m12)
+#define LOAD_MSG_10_4(b0, b1)     \
+    b0 = _mm_set_epi64x(m11, m9); \
+    b1 = _mm_set_epi64x(m15, m13)
+#define LOAD_MSG_11_1(b0, b1)     \
+    b0 = _mm_set_epi64x(m4, m14); \
+    b1 = _mm_set_epi64x(m13, m9)
+#define LOAD_MSG_11_2(b0, b1)     \
+    b0 = _mm_set_epi64x(m8, m10); \
+    b1 = _mm_set_epi64x(m6, m15)
+#define LOAD_MSG_11_3(b0, b1)    \
+    b0 = _mm_set_epi64x(m0, m1); \
+    b1 = _mm_set_epi64x(m5, m11)
+#define LOAD_MSG_11_4(b0, b1)     \
+    b0 = _mm_set_epi64x(m2, m12); \
+    b1 = _mm_set_epi64x(m3, m7)
+
+#endif
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse41.h b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse41.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse41.h
@@ -0,0 +1,307 @@
+/*
+   BLAKE2 reference source code package - optimized C implementations
+
+   Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
+
+   To the extent possible under law, the author(s) have dedicated all copyright
+   and related and neighboring rights to this software to the public domain
+   worldwide. This software is distributed without any warranty.
+
+   You should have received a copy of the CC0 Public Domain Dedication along
+   with
+   this software. If not, see
+   <http://creativecommons.org/publicdomain/zero/1.0/>.
+*/
+
+#ifndef blake2b_load_sse41_H
+#define blake2b_load_sse41_H
+
+#define LOAD_MSG_0_1(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m0, m1); \
+        b1 = _mm_unpacklo_epi64(m2, m3); \
+    } while (0)
+
+#define LOAD_MSG_0_2(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpackhi_epi64(m0, m1); \
+        b1 = _mm_unpackhi_epi64(m2, m3); \
+    } while (0)
+
+#define LOAD_MSG_0_3(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m4, m5); \
+        b1 = _mm_unpacklo_epi64(m6, m7); \
+    } while (0)
+
+#define LOAD_MSG_0_4(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpackhi_epi64(m4, m5); \
+        b1 = _mm_unpackhi_epi64(m6, m7); \
+    } while (0)
+
+#define LOAD_MSG_1_1(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m7, m2); \
+        b1 = _mm_unpackhi_epi64(m4, m6); \
+    } while (0)
+
+#define LOAD_MSG_1_2(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m5, m4); \
+        b1 = _mm_alignr_epi8(m3, m7, 8); \
+    } while (0)
+
+#define LOAD_MSG_1_3(b0, b1)                                 \
+    do {                                                     \
+        b0 = _mm_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); \
+        b1 = _mm_unpackhi_epi64(m5, m2);                     \
+    } while (0)
+
+#define LOAD_MSG_1_4(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m6, m1); \
+        b1 = _mm_unpackhi_epi64(m3, m1); \
+    } while (0)
+
+#define LOAD_MSG_2_1(b0, b1)             \
+    do {                                 \
+        b0 = _mm_alignr_epi8(m6, m5, 8); \
+        b1 = _mm_unpackhi_epi64(m2, m7); \
+    } while (0)
+
+#define LOAD_MSG_2_2(b0, b1)                \
+    do {                                    \
+        b0 = _mm_unpacklo_epi64(m4, m0);    \
+        b1 = _mm_blend_epi16(m1, m6, 0xF0); \
+    } while (0)
+
+#define LOAD_MSG_2_3(b0, b1)                \
+    do {                                    \
+        b0 = _mm_blend_epi16(m5, m1, 0xF0); \
+        b1 = _mm_unpackhi_epi64(m3, m4);    \
+    } while (0)
+
+#define LOAD_MSG_2_4(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m7, m3); \
+        b1 = _mm_alignr_epi8(m2, m0, 8); \
+    } while (0)
+
+#define LOAD_MSG_3_1(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpackhi_epi64(m3, m1); \
+        b1 = _mm_unpackhi_epi64(m6, m5); \
+    } while (0)
+
+#define LOAD_MSG_3_2(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpackhi_epi64(m4, m0); \
+        b1 = _mm_unpacklo_epi64(m6, m7); \
+    } while (0)
+
+#define LOAD_MSG_3_3(b0, b1)                \
+    do {                                    \
+        b0 = _mm_blend_epi16(m1, m2, 0xF0); \
+        b1 = _mm_blend_epi16(m2, m7, 0xF0); \
+    } while (0)
+
+#define LOAD_MSG_3_4(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m3, m5); \
+        b1 = _mm_unpacklo_epi64(m0, m4); \
+    } while (0)
+
+#define LOAD_MSG_4_1(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpackhi_epi64(m4, m2); \
+        b1 = _mm_unpacklo_epi64(m1, m5); \
+    } while (0)
+
+#define LOAD_MSG_4_2(b0, b1)                \
+    do {                                    \
+        b0 = _mm_blend_epi16(m0, m3, 0xF0); \
+        b1 = _mm_blend_epi16(m2, m7, 0xF0); \
+    } while (0)
+
+#define LOAD_MSG_4_3(b0, b1)                \
+    do {                                    \
+        b0 = _mm_blend_epi16(m7, m5, 0xF0); \
+        b1 = _mm_blend_epi16(m3, m1, 0xF0); \
+    } while (0)
+
+#define LOAD_MSG_4_4(b0, b1)                \
+    do {                                    \
+        b0 = _mm_alignr_epi8(m6, m0, 8);    \
+        b1 = _mm_blend_epi16(m4, m6, 0xF0); \
+    } while (0)
+
+#define LOAD_MSG_5_1(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m1, m3); \
+        b1 = _mm_unpacklo_epi64(m0, m4); \
+    } while (0)
+
+#define LOAD_MSG_5_2(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m6, m5); \
+        b1 = _mm_unpackhi_epi64(m5, m1); \
+    } while (0)
+
+#define LOAD_MSG_5_3(b0, b1)                \
+    do {                                    \
+        b0 = _mm_blend_epi16(m2, m3, 0xF0); \
+        b1 = _mm_unpackhi_epi64(m7, m0);    \
+    } while (0)
+
+#define LOAD_MSG_5_4(b0, b1)                \
+    do {                                    \
+        b0 = _mm_unpackhi_epi64(m6, m2);    \
+        b1 = _mm_blend_epi16(m7, m4, 0xF0); \
+    } while (0)
+
+#define LOAD_MSG_6_1(b0, b1)                \
+    do {                                    \
+        b0 = _mm_blend_epi16(m6, m0, 0xF0); \
+        b1 = _mm_unpacklo_epi64(m7, m2);    \
+    } while (0)
+
+#define LOAD_MSG_6_2(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpackhi_epi64(m2, m7); \
+        b1 = _mm_alignr_epi8(m5, m6, 8); \
+    } while (0)
+
+#define LOAD_MSG_6_3(b0, b1)                                 \
+    do {                                                     \
+        b0 = _mm_unpacklo_epi64(m0, m3);                     \
+        b1 = _mm_shuffle_epi32(m4, _MM_SHUFFLE(1, 0, 3, 2)); \
+    } while (0)
+
+#define LOAD_MSG_6_4(b0, b1)                \
+    do {                                    \
+        b0 = _mm_unpackhi_epi64(m3, m1);    \
+        b1 = _mm_blend_epi16(m1, m5, 0xF0); \
+    } while (0)
+
+#define LOAD_MSG_7_1(b0, b1)                \
+    do {                                    \
+        b0 = _mm_unpackhi_epi64(m6, m3);    \
+        b1 = _mm_blend_epi16(m6, m1, 0xF0); \
+    } while (0)
+
+#define LOAD_MSG_7_2(b0, b1)             \
+    do {                                 \
+        b0 = _mm_alignr_epi8(m7, m5, 8); \
+        b1 = _mm_unpackhi_epi64(m0, m4); \
+    } while (0)
+
+#define LOAD_MSG_7_3(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpackhi_epi64(m2, m7); \
+        b1 = _mm_unpacklo_epi64(m4, m1); \
+    } while (0)
+
+#define LOAD_MSG_7_4(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m0, m2); \
+        b1 = _mm_unpacklo_epi64(m3, m5); \
+    } while (0)
+
+#define LOAD_MSG_8_1(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m3, m7); \
+        b1 = _mm_alignr_epi8(m0, m5, 8); \
+    } while (0)
+
+#define LOAD_MSG_8_2(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpackhi_epi64(m7, m4); \
+        b1 = _mm_alignr_epi8(m4, m1, 8); \
+    } while (0)
+
+#define LOAD_MSG_8_3(b0, b1)             \
+    do {                                 \
+        b0 = m6;                         \
+        b1 = _mm_alignr_epi8(m5, m0, 8); \
+    } while (0)
+
+#define LOAD_MSG_8_4(b0, b1)                \
+    do {                                    \
+        b0 = _mm_blend_epi16(m1, m3, 0xF0); \
+        b1 = m2;                            \
+    } while (0)
+
+#define LOAD_MSG_9_1(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m5, m4); \
+        b1 = _mm_unpackhi_epi64(m3, m0); \
+    } while (0)
+
+#define LOAD_MSG_9_2(b0, b1)                \
+    do {                                    \
+        b0 = _mm_unpacklo_epi64(m1, m2);    \
+        b1 = _mm_blend_epi16(m3, m2, 0xF0); \
+    } while (0)
+
+#define LOAD_MSG_9_3(b0, b1)             \
+    do {                                 \
+        b0 = _mm_unpackhi_epi64(m7, m4); \
+        b1 = _mm_unpackhi_epi64(m1, m6); \
+    } while (0)
+
+#define LOAD_MSG_9_4(b0, b1)             \
+    do {                                 \
+        b0 = _mm_alignr_epi8(m7, m5, 8); \
+        b1 = _mm_unpacklo_epi64(m6, m0); \
+    } while (0)
+
+#define LOAD_MSG_10_1(b0, b1)            \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m0, m1); \
+        b1 = _mm_unpacklo_epi64(m2, m3); \
+    } while (0)
+
+#define LOAD_MSG_10_2(b0, b1)            \
+    do {                                 \
+        b0 = _mm_unpackhi_epi64(m0, m1); \
+        b1 = _mm_unpackhi_epi64(m2, m3); \
+    } while (0)
+
+#define LOAD_MSG_10_3(b0, b1)            \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m4, m5); \
+        b1 = _mm_unpacklo_epi64(m6, m7); \
+    } while (0)
+
+#define LOAD_MSG_10_4(b0, b1)            \
+    do {                                 \
+        b0 = _mm_unpackhi_epi64(m4, m5); \
+        b1 = _mm_unpackhi_epi64(m6, m7); \
+    } while (0)
+
+#define LOAD_MSG_11_1(b0, b1)            \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m7, m2); \
+        b1 = _mm_unpackhi_epi64(m4, m6); \
+    } while (0)
+
+#define LOAD_MSG_11_2(b0, b1)            \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m5, m4); \
+        b1 = _mm_alignr_epi8(m3, m7, 8); \
+    } while (0)
+
+#define LOAD_MSG_11_3(b0, b1)                                \
+    do {                                                     \
+        b0 = _mm_shuffle_epi32(m0, _MM_SHUFFLE(1, 0, 3, 2)); \
+        b1 = _mm_unpackhi_epi64(m5, m2);                     \
+    } while (0)
+
+#define LOAD_MSG_11_4(b0, b1)            \
+    do {                                 \
+        b0 = _mm_unpacklo_epi64(m6, m1); \
+        b1 = _mm_unpackhi_epi64(m3, m1); \
+    } while (0)
+
+#endif
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c
@@ -0,0 +1,438 @@
+/*
+   BLAKE2 reference source code package - C implementations
+
+   Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
+
+   To the extent possible under law, the author(s) have dedicated all copyright
+   and related and neighboring rights to this software to the public domain
+   worldwide. This software is distributed without any warranty.
+
+   You should have received a copy of the CC0 Public Domain Dedication along
+   with
+   this software. If not, see
+   <http://creativecommons.org/publicdomain/zero/1.0/>.
+*/
+
+#include <assert.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "blake2.h"
+#include "core.h"
+#include "private/common.h"
+#include "runtime.h"
+#include "utils.h"
+
+static blake2b_compress_fn blake2b_compress = blake2b_compress_ref;
+
+static const uint64_t blake2b_IV[8] = {
+    0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL,
+    0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
+    0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
+};
+
+/* LCOV_EXCL_START */
+static inline int
+blake2b_set_lastnode(blake2b_state *S)
+{
+    S->f[1] = -1;
+    return 0;
+}
+/* LCOV_EXCL_STOP */
+
+static inline int
+blake2b_is_lastblock(const blake2b_state *S)
+{
+    return S->f[0] != 0;
+}
+
+static inline int
+blake2b_set_lastblock(blake2b_state *S)
+{
+    if (S->last_node) {
+        blake2b_set_lastnode(S);
+    }
+    S->f[0] = -1;
+    return 0;
+}
+
+static inline int
+blake2b_increment_counter(blake2b_state *S, const uint64_t inc)
+{
+#ifdef HAVE_TI_MODE
+    uint128_t t = ((uint128_t) S->t[1] << 64) | S->t[0];
+    t += inc;
+    S->t[0] = (uint64_t)(t >> 0);
+    S->t[1] = (uint64_t)(t >> 64);
+#else
+    S->t[0] += inc;
+    S->t[1] += (S->t[0] < inc);
+#endif
+    return 0;
+}
+
+/* Parameter-related functions */
+static inline int
+blake2b_param_set_salt(blake2b_param *P, const uint8_t salt[BLAKE2B_SALTBYTES])
+{
+    memcpy(P->salt, salt, BLAKE2B_SALTBYTES);
+    return 0;
+}
+
+static inline int
+blake2b_param_set_personal(blake2b_param *P,
+                           const uint8_t  personal[BLAKE2B_PERSONALBYTES])
+{
+    memcpy(P->personal, personal, BLAKE2B_PERSONALBYTES);
+    return 0;
+}
+
+static inline int
+blake2b_init0(blake2b_state *S)
+{
+    int i;
+
+    for (i  = 0; i < 8; i++) {
+        S->h[i] = blake2b_IV[i];
+    }
+    /* zero everything between .t and .last_node */
+    memset((void *) &S->t, 0,
+           offsetof(blake2b_state, last_node) + sizeof(S->last_node)
+           - offsetof(blake2b_state, t));
+    return 0;
+}
+
+/* init xors IV with input parameter block */
+int
+blake2b_init_param(blake2b_state *S, const blake2b_param *P)
+{
+    size_t         i;
+    const uint8_t *p;
+
+    COMPILER_ASSERT(sizeof *P == 64);
+    blake2b_init0(S);
+    p = (const uint8_t *) (P);
+
+    /* IV XOR ParamBlock */
+    for (i = 0; i < 8; i++) {
+        S->h[i] ^= LOAD64_LE(p + sizeof(S->h[i]) * i);
+    }
+    return 0;
+}
+
+int
+blake2b_init(blake2b_state *S, const uint8_t outlen)
+{
+    blake2b_param P[1];
+
+    if ((!outlen) || (outlen > BLAKE2B_OUTBYTES)) {
+        sodium_misuse();
+    }
+    P->digest_length = outlen;
+    P->key_length    = 0;
+    P->fanout        = 1;
+    P->depth         = 1;
+    STORE32_LE(P->leaf_length, 0);
+    STORE64_LE(P->node_offset, 0);
+    P->node_depth   = 0;
+    P->inner_length = 0;
+    memset(P->reserved, 0, sizeof(P->reserved));
+    memset(P->salt, 0, sizeof(P->salt));
+    memset(P->personal, 0, sizeof(P->personal));
+    return blake2b_init_param(S, P);
+}
+
+int
+blake2b_init_salt_personal(blake2b_state *S, const uint8_t outlen,
+                           const void *salt, const void *personal)
+{
+    blake2b_param P[1];
+
+    if ((!outlen) || (outlen > BLAKE2B_OUTBYTES)) {
+        sodium_misuse();
+    }
+    P->digest_length = outlen;
+    P->key_length    = 0;
+    P->fanout        = 1;
+    P->depth         = 1;
+    STORE32_LE(P->leaf_length, 0);
+    STORE64_LE(P->node_offset, 0);
+    P->node_depth   = 0;
+    P->inner_length = 0;
+    memset(P->reserved, 0, sizeof(P->reserved));
+    if (salt != NULL) {
+        blake2b_param_set_salt(P, (const uint8_t *) salt);
+    } else {
+        memset(P->salt, 0, sizeof(P->salt));
+    }
+    if (personal != NULL) {
+        blake2b_param_set_personal(P, (const uint8_t *) personal);
+    } else {
+        memset(P->personal, 0, sizeof(P->personal));
+    }
+    return blake2b_init_param(S, P);
+}
+
+int
+blake2b_init_key(blake2b_state *S, const uint8_t outlen, const void *key,
+                 const uint8_t keylen)
+{
+    blake2b_param P[1];
+
+    if ((!outlen) || (outlen > BLAKE2B_OUTBYTES)) {
+        sodium_misuse();
+    }
+    if (!key || !keylen || keylen > BLAKE2B_KEYBYTES) {
+        sodium_misuse(); /* does not return */
+    }
+    P->digest_length = outlen;
+    P->key_length    = keylen;
+    P->fanout        = 1;
+    P->depth         = 1;
+    STORE32_LE(P->leaf_length, 0);
+    STORE64_LE(P->node_offset, 0);
+    P->node_depth   = 0;
+    P->inner_length = 0;
+    memset(P->reserved, 0, sizeof(P->reserved));
+    memset(P->salt, 0, sizeof(P->salt));
+    memset(P->personal, 0, sizeof(P->personal));
+
+    if (blake2b_init_param(S, P) < 0) {
+        sodium_misuse();
+    }
+    {
+        uint8_t block[BLAKE2B_BLOCKBYTES];
+        memset(block, 0, BLAKE2B_BLOCKBYTES);
+        memcpy(block, key, keylen); /* key and keylen cannot be 0 */
+        blake2b_update(S, block, BLAKE2B_BLOCKBYTES);
+        sodium_memzero(block, BLAKE2B_BLOCKBYTES); /* Burn the key from stack */
+    }
+    return 0;
+}
+
+int
+blake2b_init_key_salt_personal(blake2b_state *S, const uint8_t outlen,
+                               const void *key, const uint8_t keylen,
+                               const void *salt, const void *personal)
+{
+    blake2b_param P[1];
+
+    if ((!outlen) || (outlen > BLAKE2B_OUTBYTES)) {
+        sodium_misuse();
+    }
+    if (!key || !keylen || keylen > BLAKE2B_KEYBYTES) {
+        sodium_misuse(); /* does not return */
+    }
+    P->digest_length = outlen;
+    P->key_length    = keylen;
+    P->fanout        = 1;
+    P->depth         = 1;
+    STORE32_LE(P->leaf_length, 0);
+    STORE64_LE(P->node_offset, 0);
+    P->node_depth   = 0;
+    P->inner_length = 0;
+    memset(P->reserved, 0, sizeof(P->reserved));
+    if (salt != NULL) {
+        blake2b_param_set_salt(P, (const uint8_t *) salt);
+    } else {
+        memset(P->salt, 0, sizeof(P->salt));
+    }
+    if (personal != NULL) {
+        blake2b_param_set_personal(P, (const uint8_t *) personal);
+    } else {
+        memset(P->personal, 0, sizeof(P->personal));
+    }
+
+    if (blake2b_init_param(S, P) < 0) {
+        sodium_misuse();
+    }
+    {
+        uint8_t block[BLAKE2B_BLOCKBYTES];
+        memset(block, 0, BLAKE2B_BLOCKBYTES);
+        memcpy(block, key, keylen); /* key and keylen cannot be 0 */
+        blake2b_update(S, block, BLAKE2B_BLOCKBYTES);
+        sodium_memzero(block, BLAKE2B_BLOCKBYTES); /* Burn the key from stack */
+    }
+    return 0;
+}
+
+/* inlen now in bytes */
+int
+blake2b_update(blake2b_state *S, const uint8_t *in, uint64_t inlen)
+{
+    while (inlen > 0) {
+        size_t left = S->buflen;
+        size_t fill = 2 * BLAKE2B_BLOCKBYTES - left;
+
+        if (inlen > fill) {
+            memcpy(S->buf + left, in, fill); /* Fill buffer */
+            S->buflen += fill;
+            blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
+            blake2b_compress(S, S->buf); /* Compress */
+            memcpy(S->buf, S->buf + BLAKE2B_BLOCKBYTES,
+                   BLAKE2B_BLOCKBYTES); /* Shift buffer left */
+            S->buflen -= BLAKE2B_BLOCKBYTES;
+            in += fill;
+            inlen -= fill;
+        } else /* inlen <= fill */
+        {
+            memcpy(S->buf + left, in, inlen);
+            S->buflen += inlen; /* Be lazy, do not compress */
+            in += inlen;
+            inlen -= inlen;
+        }
+    }
+
+    return 0;
+}
+
+int
+blake2b_final(blake2b_state *S, uint8_t *out, uint8_t outlen)
+{
+    unsigned char buffer[BLAKE2B_OUTBYTES];
+
+    if (!outlen || outlen > BLAKE2B_OUTBYTES) {
+        sodium_misuse();
+    }
+    if (blake2b_is_lastblock(S)) {
+        return -1;
+    }
+    if (S->buflen > BLAKE2B_BLOCKBYTES) {
+        blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
+        blake2b_compress(S, S->buf);
+        S->buflen -= BLAKE2B_BLOCKBYTES;
+        assert(S->buflen <= BLAKE2B_BLOCKBYTES);
+        memcpy(S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen);
+    }
+
+    blake2b_increment_counter(S, S->buflen);
+    blake2b_set_lastblock(S);
+    memset(S->buf + S->buflen, 0,
+           2 * BLAKE2B_BLOCKBYTES - S->buflen); /* Padding */
+    blake2b_compress(S, S->buf);
+
+    COMPILER_ASSERT(sizeof buffer == 64U);
+    STORE64_LE(buffer + 8 * 0, S->h[0]);
+    STORE64_LE(buffer + 8 * 1, S->h[1]);
+    STORE64_LE(buffer + 8 * 2, S->h[2]);
+    STORE64_LE(buffer + 8 * 3, S->h[3]);
+    STORE64_LE(buffer + 8 * 4, S->h[4]);
+    STORE64_LE(buffer + 8 * 5, S->h[5]);
+    STORE64_LE(buffer + 8 * 6, S->h[6]);
+    STORE64_LE(buffer + 8 * 7, S->h[7]);
+    memcpy(out, buffer, outlen); /* outlen <= BLAKE2B_OUTBYTES (64) */
+
+    sodium_memzero(S->h, sizeof S->h);
+    sodium_memzero(S->buf, sizeof S->buf);
+
+    return 0;
+}
+
+/* inlen, at least, should be uint64_t. Others can be size_t. */
+int
+blake2b(uint8_t *out, const void *in, const void *key, const uint8_t outlen,
+        const uint64_t inlen, uint8_t keylen)
+{
+    CRYPTO_ALIGN(64) blake2b_state S[1];
+
+    /* Verify parameters */
+    if (NULL == in && inlen > 0) {
+        sodium_misuse();
+    }
+    if (NULL == out) {
+        sodium_misuse();
+    }
+    if (!outlen || outlen > BLAKE2B_OUTBYTES) {
+        sodium_misuse();
+    }
+    if (NULL == key && keylen > 0) {
+        sodium_misuse();
+    }
+    if (keylen > BLAKE2B_KEYBYTES) {
+        sodium_misuse();
+    }
+    if (keylen > 0) {
+        if (blake2b_init_key(S, outlen, key, keylen) < 0) {
+            sodium_misuse();
+        }
+    } else {
+        if (blake2b_init(S, outlen) < 0) {
+            sodium_misuse();
+        }
+    }
+
+    blake2b_update(S, (const uint8_t *) in, inlen);
+    blake2b_final(S, out, outlen);
+    return 0;
+}
+
+int
+blake2b_salt_personal(uint8_t *out, const void *in, const void *key,
+                      const uint8_t outlen, const uint64_t inlen,
+                      uint8_t keylen, const void *salt, const void *personal)
+{
+    CRYPTO_ALIGN(64) blake2b_state S[1];
+
+    /* Verify parameters */
+    if (NULL == in && inlen > 0) {
+        sodium_misuse();
+    }
+    if (NULL == out) {
+        sodium_misuse();
+    }
+    if (!outlen || outlen > BLAKE2B_OUTBYTES) {
+        sodium_misuse();
+    }
+    if (NULL == key && keylen > 0) {
+        sodium_misuse();
+    }
+    if (keylen > BLAKE2B_KEYBYTES) {
+        sodium_misuse();
+    }
+    if (keylen > 0) {
+        if (blake2b_init_key_salt_personal(S, outlen, key, keylen, salt,
+                                           personal) < 0) {
+            sodium_misuse();
+        }
+    } else {
+        if (blake2b_init_salt_personal(S, outlen, salt, personal) < 0) {
+            sodium_misuse();
+        }
+    }
+
+    blake2b_update(S, (const uint8_t *) in, inlen);
+    blake2b_final(S, out, outlen);
+    return 0;
+}
+
+int
+blake2b_pick_best_implementation(void)
+{
+/* LCOV_EXCL_START */
+#if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_TMMINTRIN_H) && \
+    defined(HAVE_SMMINTRIN_H)
+    if (sodium_runtime_has_avx2()) {
+        blake2b_compress = blake2b_compress_avx2;
+        return 0;
+    }
+#endif
+#if defined(HAVE_EMMINTRIN_H) && defined(HAVE_TMMINTRIN_H) && \
+    defined(HAVE_SMMINTRIN_H)
+    if (sodium_runtime_has_sse41()) {
+        blake2b_compress = blake2b_compress_sse41;
+        return 0;
+    }
+#endif
+#if defined(HAVE_EMMINTRIN_H) && defined(HAVE_TMMINTRIN_H)
+    if (sodium_runtime_has_ssse3()) {
+        blake2b_compress = blake2b_compress_ssse3;
+        return 0;
+    }
+#endif
+    blake2b_compress = blake2b_compress_ref;
+
+    return 0;
+    /* LCOV_EXCL_STOP */
+}
diff --git a/vendor/external/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c b/vendor/external/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c
@@ -0,0 +1,116 @@
+
+#include <assert.h>
+#include <limits.h>
+#include <stdint.h>
+
+#include "blake2.h"
+#include "crypto_generichash_blake2b.h"
+#include "private/common.h"
+#include "private/implementations.h"
+
+int
+crypto_generichash_blake2b(unsigned char *out, size_t outlen,
+                           const unsigned char *in, unsigned long long inlen,
+                           const unsigned char *key, size_t keylen)
+{
+    if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
+        keylen > BLAKE2B_KEYBYTES || inlen > UINT64_MAX) {
+        return -1;
+    }
+    assert(outlen <= UINT8_MAX);
+    assert(keylen <= UINT8_MAX);
+
+    return blake2b((uint8_t *) out, in, key, (uint8_t) outlen, (uint64_t) inlen,
+                   (uint8_t) keylen);
+}
+
+int
+crypto_generichash_blake2b_salt_personal(
+    unsigned char *out, size_t outlen, const unsigned char *in,
+    unsigned long long inlen, const unsigned char *key, size_t keylen,
+    const unsigned char *salt, const unsigned char *personal)
+{
+    if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
+        keylen > BLAKE2B_KEYBYTES || inlen > UINT64_MAX) {
+        return -1;
+    }
+    assert(outlen <= UINT8_MAX);
+    assert(keylen <= UINT8_MAX);
+
+    return blake2b_salt_personal((uint8_t *) out, in, key, (uint8_t) outlen,
+                                 (uint64_t) inlen, (uint8_t) keylen, salt,
+                                 personal);
+}
+
+int
+crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
+                                const unsigned char *key, const size_t keylen,
+                                const size_t outlen)
+{
+    if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
+        keylen > BLAKE2B_KEYBYTES) {
+        return -1;
+    }
+    assert(outlen <= UINT8_MAX);
+    assert(keylen <= UINT8_MAX);
+    COMPILER_ASSERT(sizeof(blake2b_state) <= sizeof *state);
+    if (key == NULL || keylen <= 0U) {
+        if (blake2b_init((blake2b_state *) (void *) state, (uint8_t) outlen) != 0) {
+            return -1; /* LCOV_EXCL_LINE */
+        }
+    } else if (blake2b_init_key((blake2b_state *) (void *) state, (uint8_t) outlen, key,
+                                (uint8_t) keylen) != 0) {
+        return -1; /* LCOV_EXCL_LINE */
+    }
+    return 0;
+}
+
+int
+crypto_generichash_blake2b_init_salt_personal(
+    crypto_generichash_blake2b_state *state, const unsigned char *key,
+    const size_t keylen, const size_t outlen, const unsigned char *salt,
+    const unsigned char *personal)
+{
+    if (outlen <= 0U || outlen > BLAKE2B_OUTBYTES ||
+        keylen > BLAKE2B_KEYBYTES) {
+        return -1;
+    }
+    assert(outlen <= UINT8_MAX);
+    assert(keylen <= UINT8_MAX);
+    if (key == NULL || keylen <= 0U) {
+        if (blake2b_init_salt_personal((blake2b_state *) (void *) state,
+                                       (uint8_t) outlen, salt, personal) != 0) {
+            return -1; /* LCOV_EXCL_LINE */
+        }
+    } else if (blake2b_init_key_salt_personal((blake2b_state *) (void *) state,
+                                              (uint8_t) outlen, key,
+                                              (uint8_t) keylen, salt,
+                                              personal) != 0) {
+        return -1; /* LCOV_EXCL_LINE */
+    }
+    return 0;
+}
+
+int
+crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state,
+                                  const unsigned char *in,
+                                  unsigned long long inlen)
+{
+    return blake2b_update((blake2b_state *) (void *) state,
+                          (const uint8_t *) in, (uint64_t) inlen);
+}
+
+int
+crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state,
+                                 unsigned char *out, const size_t outlen)
+{
+    assert(outlen <= UINT8_MAX);
+    return blake2b_final((blake2b_state *) (void *) state,
+                         (uint8_t *) out, (uint8_t) outlen);
+}
+
+int
+_crypto_generichash_blake2b_pick_best_implementation(void)
+{
+    return blake2b_pick_best_implementation();
+}
diff --git a/vendor/external/libsodium/crypto_generichash/crypto_generichash.c b/vendor/external/libsodium/crypto_generichash/crypto_generichash.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_generichash/crypto_generichash.c
@@ -0,0 +1,91 @@
+
+#include "crypto_generichash.h"
+#include "randombytes.h"
+
+size_t
+crypto_generichash_bytes_min(void)
+{
+    return crypto_generichash_BYTES_MIN;
+}
+
+size_t
+crypto_generichash_bytes_max(void)
+{
+    return crypto_generichash_BYTES_MAX;
+}
+
+size_t
+crypto_generichash_bytes(void)
+{
+    return crypto_generichash_BYTES;
+}
+
+size_t
+crypto_generichash_keybytes_min(void)
+{
+    return crypto_generichash_KEYBYTES_MIN;
+}
+
+size_t
+crypto_generichash_keybytes_max(void)
+{
+    return crypto_generichash_KEYBYTES_MAX;
+}
+
+size_t
+crypto_generichash_keybytes(void)
+{
+    return crypto_generichash_KEYBYTES;
+}
+
+const char *
+crypto_generichash_primitive(void)
+{
+    return crypto_generichash_PRIMITIVE;
+}
+
+size_t
+crypto_generichash_statebytes(void)
+{
+    return (sizeof(crypto_generichash_state) + (size_t) 63U) & ~(size_t) 63U;
+}
+
+int
+crypto_generichash(unsigned char *out, size_t outlen, const unsigned char *in,
+                   unsigned long long inlen, const unsigned char *key,
+                   size_t keylen)
+{
+    return crypto_generichash_blake2b(out, outlen, in, inlen, key, keylen);
+}
+
+int
+crypto_generichash_init(crypto_generichash_state *state,
+                        const unsigned char *key,
+                        const size_t keylen, const size_t outlen)
+{
+    return crypto_generichash_blake2b_init
+        ((crypto_generichash_blake2b_state *) state, key, keylen, outlen);
+}
+
+int
+crypto_generichash_update(crypto_generichash_state *state,
+                          const unsigned char *in,
+                          unsigned long long inlen)
+{
+    return crypto_generichash_blake2b_update
+        ((crypto_generichash_blake2b_state *) state, in, inlen);
+}
+
+int
+crypto_generichash_final(crypto_generichash_state *state,
+                         unsigned char *out, const size_t outlen)
+{
+    return crypto_generichash_blake2b_final
+        ((crypto_generichash_blake2b_state *) state, out, outlen);
+}
+
+void
+crypto_generichash_keygen(unsigned char k[crypto_generichash_KEYBYTES])
+{
+    randombytes_buf(k, crypto_generichash_KEYBYTES);
+}
diff --git a/vendor/external/libsodium/crypto_hash/crypto_hash.c b/vendor/external/libsodium/crypto_hash/crypto_hash.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_hash/crypto_hash.c
@@ -0,0 +1,20 @@
+
+#include "crypto_hash.h"
+
+size_t
+crypto_hash_bytes(void)
+{
+    return crypto_hash_BYTES;
+}
+
+int
+crypto_hash(unsigned char *out, const unsigned char *in,
+            unsigned long long inlen)
+{
+    return crypto_hash_sha512(out, in, inlen);
+}
+
+const char *
+crypto_hash_primitive(void) {
+    return crypto_hash_PRIMITIVE;
+}
diff --git a/vendor/external/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c b/vendor/external/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c
@@ -0,0 +1,256 @@
+
+/*-
+ * Copyright 2005,2007,2009 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/types.h>
+
+#include "crypto_hash_sha256.h"
+#include "private/common.h"
+#include "utils.h"
+
+static void
+be32enc_vect(unsigned char *dst, const uint32_t *src, size_t len)
+{
+    size_t i;
+
+    for (i = 0; i < len / 4; i++) {
+        STORE32_BE(dst + i * 4, src[i]);
+    }
+}
+
+static void
+be32dec_vect(uint32_t *dst, const unsigned char *src, size_t len)
+{
+    size_t i;
+
+    for (i = 0; i < len / 4; i++) {
+        dst[i] = LOAD32_BE(src + i * 4);
+    }
+}
+
+static const uint32_t Krnd[64] = {
+    0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
+    0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+    0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
+    0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+    0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
+    0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
+    0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
+    0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+    0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
+    0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+    0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+};
+
+#define Ch(x, y, z) ((x & (y ^ z)) ^ z)
+#define Maj(x, y, z) ((x & (y | z)) | (y & z))
+#define SHR(x, n) (x >> n)
+#define ROTR(x, n) ROTR32(x, n)
+#define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
+#define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
+#define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3))
+#define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10))
+
+#define RND(a, b, c, d, e, f, g, h, k) \
+    h += S1(e) + Ch(e, f, g) + k;      \
+    d += h;                            \
+    h += S0(a) + Maj(a, b, c);
+
+#define RNDr(S, W, i, ii)                                                   \
+    RND(S[(64 - i) % 8], S[(65 - i) % 8], S[(66 - i) % 8], S[(67 - i) % 8], \
+        S[(68 - i) % 8], S[(69 - i) % 8], S[(70 - i) % 8], S[(71 - i) % 8], \
+        W[i + ii] + Krnd[i + ii])
+
+#define MSCH(W, ii, i) \
+    W[i + ii + 16] =   \
+        s1(W[i + ii + 14]) + W[i + ii + 9] + s0(W[i + ii + 1]) + W[i + ii]
+
+static void
+SHA256_Transform(uint32_t state[8], const uint8_t block[64], uint32_t W[64],
+                 uint32_t S[8])
+{
+    int i;
+
+    be32dec_vect(W, block, 64);
+    memcpy(S, state, 32);
+    for (i = 0; i < 64; i += 16) {
+        RNDr(S, W, 0, i);
+        RNDr(S, W, 1, i);
+        RNDr(S, W, 2, i);
+        RNDr(S, W, 3, i);
+        RNDr(S, W, 4, i);
+        RNDr(S, W, 5, i);
+        RNDr(S, W, 6, i);
+        RNDr(S, W, 7, i);
+        RNDr(S, W, 8, i);
+        RNDr(S, W, 9, i);
+        RNDr(S, W, 10, i);
+        RNDr(S, W, 11, i);
+        RNDr(S, W, 12, i);
+        RNDr(S, W, 13, i);
+        RNDr(S, W, 14, i);
+        RNDr(S, W, 15, i);
+        if (i == 48) {
+            break;
+        }
+        MSCH(W, 0, i);
+        MSCH(W, 1, i);
+        MSCH(W, 2, i);
+        MSCH(W, 3, i);
+        MSCH(W, 4, i);
+        MSCH(W, 5, i);
+        MSCH(W, 6, i);
+        MSCH(W, 7, i);
+        MSCH(W, 8, i);
+        MSCH(W, 9, i);
+        MSCH(W, 10, i);
+        MSCH(W, 11, i);
+        MSCH(W, 12, i);
+        MSCH(W, 13, i);
+        MSCH(W, 14, i);
+        MSCH(W, 15, i);
+    }
+    for (i = 0; i < 8; i++) {
+        state[i] += S[i];
+    }
+}
+
+static const uint8_t PAD[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+                                 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+                                 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+                                 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+                                 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+static void
+SHA256_Pad(crypto_hash_sha256_state *state, uint32_t tmp32[64 + 8])
+{
+    unsigned int r;
+    unsigned int i;
+
+    ACQUIRE_FENCE;
+    r = (unsigned int) ((state->count >> 3) & 0x3f);
+    if (r < 56) {
+        for (i = 0; i < 56 - r; i++) {
+            state->buf[r + i] = PAD[i];
+        }
+    } else {
+        for (i = 0; i < 64 - r; i++) {
+            state->buf[r + i] = PAD[i];
+        }
+        SHA256_Transform(state->state, state->buf, &tmp32[0], &tmp32[64]);
+        memset(&state->buf[0], 0, 56);
+    }
+    STORE64_BE(&state->buf[56], state->count);
+    SHA256_Transform(state->state, state->buf, &tmp32[0], &tmp32[64]);
+}
+
+int
+crypto_hash_sha256_init(crypto_hash_sha256_state *state)
+{
+    static const uint32_t sha256_initial_state[8] = { 0x6a09e667, 0xbb67ae85,
+                                                      0x3c6ef372, 0xa54ff53a,
+                                                      0x510e527f, 0x9b05688c,
+                                                      0x1f83d9ab, 0x5be0cd19 };
+
+    state->count = (uint64_t) 0U;
+    memcpy(state->state, sha256_initial_state, sizeof sha256_initial_state);
+
+    return 0;
+}
+
+int
+crypto_hash_sha256_update(crypto_hash_sha256_state *state,
+                          const unsigned char *in, unsigned long long inlen)
+{
+    uint32_t           tmp32[64 + 8];
+    unsigned long long i;
+    unsigned long long r;
+
+    if (inlen <= 0U) {
+        return 0;
+    }
+    ACQUIRE_FENCE;
+    r = (unsigned long long) ((state->count >> 3) & 0x3f);
+
+    state->count += ((uint64_t) inlen) << 3;
+    if (inlen < 64 - r) {
+        for (i = 0; i < inlen; i++) {
+            state->buf[r + i] = in[i];
+        }
+        return 0;
+    }
+    for (i = 0; i < 64 - r; i++) {
+        state->buf[r + i] = in[i];
+    }
+    SHA256_Transform(state->state, state->buf, &tmp32[0], &tmp32[64]);
+    in += 64 - r;
+    inlen -= 64 - r;
+
+    while (inlen >= 64) {
+        SHA256_Transform(state->state, in, &tmp32[0], &tmp32[64]);
+        in += 64;
+        inlen -= 64;
+    }
+    inlen &= 63;
+    for (i = 0; i < inlen; i++) {
+        state->buf[i] = in[i];
+    }
+    sodium_memzero((void *) tmp32, sizeof tmp32);
+
+    return 0;
+}
+
+int
+crypto_hash_sha256_final(crypto_hash_sha256_state *state, unsigned char *out)
+{
+    uint32_t tmp32[64 + 8];
+
+    SHA256_Pad(state, tmp32);
+    be32enc_vect(out, state->state, 32);
+    sodium_memzero((void *) tmp32, sizeof tmp32);
+    sodium_memzero((void *) state, sizeof *state);
+
+    return 0;
+}
+
+int
+crypto_hash_sha256(unsigned char *out, const unsigned char *in,
+                   unsigned long long inlen)
+{
+    crypto_hash_sha256_state state;
+
+    crypto_hash_sha256_init(&state);
+    crypto_hash_sha256_update(&state, in, inlen);
+    crypto_hash_sha256_final(&state, out);
+
+    return 0;
+}
diff --git a/vendor/external/libsodium/crypto_hash/sha256/hash_sha256.c b/vendor/external/libsodium/crypto_hash/sha256/hash_sha256.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_hash/sha256/hash_sha256.c
@@ -0,0 +1,13 @@
+#include "crypto_hash_sha256.h"
+
+size_t
+crypto_hash_sha256_bytes(void)
+{
+    return crypto_hash_sha256_BYTES;
+}
+
+size_t
+crypto_hash_sha256_statebytes(void)
+{
+    return sizeof(crypto_hash_sha256_state);
+}
diff --git a/vendor/external/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c b/vendor/external/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c
@@ -0,0 +1,284 @@
+
+/*-
+ * Copyright 2005,2007,2009 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/types.h>
+
+#include "crypto_hash_sha512.h"
+#include "private/common.h"
+#include "utils.h"
+
+static void
+be64enc_vect(unsigned char *dst, const uint64_t *src, size_t len)
+{
+    size_t i;
+
+    for (i = 0; i < len / 8; i++) {
+        STORE64_BE(dst + i * 8, src[i]);
+    }
+}
+
+static void
+be64dec_vect(uint64_t *dst, const unsigned char *src, size_t len)
+{
+    size_t i;
+
+    for (i = 0; i < len / 8; i++) {
+        dst[i] = LOAD64_BE(src + i * 8);
+    }
+}
+
+static const uint64_t Krnd[80] = {
+    0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL,
+    0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
+    0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL,
+    0x12835b0145706fbeULL, 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
+    0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL,
+    0xc19bf174cf692694ULL, 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
+    0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, 0x2de92c6f592b0275ULL,
+    0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
+    0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL,
+    0xbf597fc7beef0ee4ULL, 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
+    0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, 0x27b70a8546d22ffcULL,
+    0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
+    0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL,
+    0x92722c851482353bULL, 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
+    0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, 0xd192e819d6ef5218ULL,
+    0xd69906245565a910ULL, 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
+    0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL,
+    0x34b0bcb5e19b48a8ULL, 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
+    0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, 0x748f82ee5defb2fcULL,
+    0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
+    0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL,
+    0xc67178f2e372532bULL, 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
+    0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, 0x06f067aa72176fbaULL,
+    0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
+    0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL,
+    0x431d67c49c100d4cULL, 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
+    0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL
+};
+
+#define Ch(x, y, z) ((x & (y ^ z)) ^ z)
+#define Maj(x, y, z) ((x & (y | z)) | (y & z))
+#define SHR(x, n) (x >> n)
+#define ROTR(x, n) ROTR64(x, n)
+#define S0(x) (ROTR(x, 28) ^ ROTR(x, 34) ^ ROTR(x, 39))
+#define S1(x) (ROTR(x, 14) ^ ROTR(x, 18) ^ ROTR(x, 41))
+#define s0(x) (ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x, 7))
+#define s1(x) (ROTR(x, 19) ^ ROTR(x, 61) ^ SHR(x, 6))
+
+#define RND(a, b, c, d, e, f, g, h, k) \
+    h += S1(e) + Ch(e, f, g) + k;      \
+    d += h;                            \
+    h += S0(a) + Maj(a, b, c);
+
+#define RNDr(S, W, i, ii)                                                   \
+    RND(S[(80 - i) % 8], S[(81 - i) % 8], S[(82 - i) % 8], S[(83 - i) % 8], \
+        S[(84 - i) % 8], S[(85 - i) % 8], S[(86 - i) % 8], S[(87 - i) % 8], \
+        W[i + ii] + Krnd[i + ii])
+
+#define MSCH(W, ii, i) \
+    W[i + ii + 16] =   \
+        s1(W[i + ii + 14]) + W[i + ii + 9] + s0(W[i + ii + 1]) + W[i + ii]
+
+static void
+SHA512_Transform(uint64_t *state, const uint8_t block[128], uint64_t W[80],
+                 uint64_t S[8])
+{
+    int i;
+
+    be64dec_vect(W, block, 128);
+    memcpy(S, state, 64);
+    for (i = 0; i < 80; i += 16) {
+        RNDr(S, W, 0, i);
+        RNDr(S, W, 1, i);
+        RNDr(S, W, 2, i);
+        RNDr(S, W, 3, i);
+        RNDr(S, W, 4, i);
+        RNDr(S, W, 5, i);
+        RNDr(S, W, 6, i);
+        RNDr(S, W, 7, i);
+        RNDr(S, W, 8, i);
+        RNDr(S, W, 9, i);
+        RNDr(S, W, 10, i);
+        RNDr(S, W, 11, i);
+        RNDr(S, W, 12, i);
+        RNDr(S, W, 13, i);
+        RNDr(S, W, 14, i);
+        RNDr(S, W, 15, i);
+        if (i == 64) {
+            break;
+        }
+        MSCH(W, 0, i);
+        MSCH(W, 1, i);
+        MSCH(W, 2, i);
+        MSCH(W, 3, i);
+        MSCH(W, 4, i);
+        MSCH(W, 5, i);
+        MSCH(W, 6, i);
+        MSCH(W, 7, i);
+        MSCH(W, 8, i);
+        MSCH(W, 9, i);
+        MSCH(W, 10, i);
+        MSCH(W, 11, i);
+        MSCH(W, 12, i);
+        MSCH(W, 13, i);
+        MSCH(W, 14, i);
+        MSCH(W, 15, i);
+    }
+    for (i = 0; i < 8; i++) {
+        state[i] += S[i];
+    }
+}
+
+static const uint8_t PAD[128] = {
+    0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static void
+SHA512_Pad(crypto_hash_sha512_state *state, uint64_t tmp64[80 + 8])
+{
+    unsigned int r;
+    unsigned int i;
+
+    ACQUIRE_FENCE;
+    r = (unsigned int) ((state->count[1] >> 3) & 0x7f);
+    if (r < 112) {
+        for (i = 0; i < 112 - r; i++) {
+            state->buf[r + i] = PAD[i];
+        }
+    } else {
+        for (i = 0; i < 128 - r; i++) {
+            state->buf[r + i] = PAD[i];
+        }
+        SHA512_Transform(state->state, state->buf, &tmp64[0], &tmp64[80]);
+        memset(&state->buf[0], 0, 112);
+    }
+    be64enc_vect(&state->buf[112], state->count, 16);
+    SHA512_Transform(state->state, state->buf, &tmp64[0], &tmp64[80]);
+}
+
+int
+crypto_hash_sha512_init(crypto_hash_sha512_state *state)
+{
+    static const uint64_t sha512_initial_state[8] = {
+        0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL,
+        0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
+        0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
+    };
+
+    state->count[0] = state->count[1] = (uint64_t) 0U;
+    memcpy(state->state, sha512_initial_state, sizeof sha512_initial_state);
+
+    return 0;
+}
+
+int
+crypto_hash_sha512_update(crypto_hash_sha512_state *state,
+                          const unsigned char *in, unsigned long long inlen)
+{
+    uint64_t           tmp64[80 + 8];
+    uint64_t           bitlen[2];
+    unsigned long long i;
+    unsigned long long r;
+
+    if (inlen <= 0U) {
+        return 0;
+    }
+    ACQUIRE_FENCE;
+    r = (unsigned long long) ((state->count[1] >> 3) & 0x7f);
+
+    bitlen[1] = ((uint64_t) inlen) << 3;
+    bitlen[0] = ((uint64_t) inlen) >> 61;
+    /* LCOV_EXCL_START */
+    if ((state->count[1] += bitlen[1]) < bitlen[1]) {
+        state->count[0]++;
+    }
+    /* LCOV_EXCL_STOP */
+    state->count[0] += bitlen[0];
+    if (inlen < 128 - r) {
+        for (i = 0; i < inlen; i++) {
+            state->buf[r + i] = in[i];
+        }
+        return 0;
+    }
+    for (i = 0; i < 128 - r; i++) {
+        state->buf[r + i] = in[i];
+    }
+    SHA512_Transform(state->state, state->buf, &tmp64[0], &tmp64[80]);
+    in += 128 - r;
+    inlen -= 128 - r;
+
+    while (inlen >= 128) {
+        SHA512_Transform(state->state, in, &tmp64[0], &tmp64[80]);
+        in += 128;
+        inlen -= 128;
+    }
+    inlen &= 127;
+    for (i = 0; i < inlen; i++) {
+        state->buf[i] = in[i];
+    }
+    sodium_memzero((void *) tmp64, sizeof tmp64);
+
+    return 0;
+}
+
+int
+crypto_hash_sha512_final(crypto_hash_sha512_state *state, unsigned char *out)
+{
+    uint64_t tmp64[80 + 8];
+
+    SHA512_Pad(state, tmp64);
+    be64enc_vect(out, state->state, 64);
+    sodium_memzero((void *) tmp64, sizeof tmp64);
+    sodium_memzero((void *) state, sizeof *state);
+
+    return 0;
+}
+
+int
+crypto_hash_sha512(unsigned char *out, const unsigned char *in,
+                   unsigned long long inlen)
+{
+    crypto_hash_sha512_state state;
+
+    crypto_hash_sha512_init(&state);
+    crypto_hash_sha512_update(&state, in, inlen);
+    crypto_hash_sha512_final(&state, out);
+
+    return 0;
+}
diff --git a/vendor/external/libsodium/crypto_hash/sha512/hash_sha512.c b/vendor/external/libsodium/crypto_hash/sha512/hash_sha512.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_hash/sha512/hash_sha512.c
@@ -0,0 +1,13 @@
+#include "crypto_hash_sha512.h"
+
+size_t
+crypto_hash_sha512_bytes(void)
+{
+    return crypto_hash_sha512_BYTES;
+}
+
+size_t
+crypto_hash_sha512_statebytes(void)
+{
+    return sizeof(crypto_hash_sha512_state);
+}
diff --git a/vendor/external/libsodium/crypto_onetimeauth/crypto_onetimeauth.c b/vendor/external/libsodium/crypto_onetimeauth/crypto_onetimeauth.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_onetimeauth/crypto_onetimeauth.c
@@ -0,0 +1,71 @@
+
+#include "crypto_onetimeauth.h"
+#include "randombytes.h"
+
+size_t
+crypto_onetimeauth_statebytes(void)
+{
+    return sizeof(crypto_onetimeauth_state);
+}
+
+size_t
+crypto_onetimeauth_bytes(void)
+{
+    return crypto_onetimeauth_BYTES;
+}
+
+size_t
+crypto_onetimeauth_keybytes(void)
+{
+    return crypto_onetimeauth_KEYBYTES;
+}
+
+int
+crypto_onetimeauth(unsigned char *out, const unsigned char *in,
+                   unsigned long long inlen, const unsigned char *k)
+{
+    return crypto_onetimeauth_poly1305(out, in, inlen, k);
+}
+
+int
+crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in,
+                          unsigned long long inlen, const unsigned char *k)
+{
+    return crypto_onetimeauth_poly1305_verify(h, in, inlen, k);
+}
+
+int
+crypto_onetimeauth_init(crypto_onetimeauth_state *state,
+                        const unsigned char *key)
+{
+    return crypto_onetimeauth_poly1305_init
+        ((crypto_onetimeauth_poly1305_state *) state, key);
+}
+
+int
+crypto_onetimeauth_update(crypto_onetimeauth_state *state,
+                          const unsigned char *in,
+                          unsigned long long inlen)
+{
+    return crypto_onetimeauth_poly1305_update
+        ((crypto_onetimeauth_poly1305_state *) state, in, inlen);
+}
+
+int
+crypto_onetimeauth_final(crypto_onetimeauth_state *state,
+                         unsigned char *out)
+{
+    return crypto_onetimeauth_poly1305_final
+        ((crypto_onetimeauth_poly1305_state *) state, out);
+}
+
+const char *
+crypto_onetimeauth_primitive(void)
+{
+    return crypto_onetimeauth_PRIMITIVE;
+}
+
+void crypto_onetimeauth_keygen(unsigned char k[crypto_onetimeauth_KEYBYTES])
+{
+    randombytes_buf(k, crypto_onetimeauth_KEYBYTES);
+}
diff --git a/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.c b/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.c
@@ -0,0 +1,124 @@
+
+#include "poly1305_donna.h"
+#include "crypto_verify_16.h"
+#include "private/common.h"
+#include "utils.h"
+
+#ifdef HAVE_TI_MODE
+#include "poly1305_donna64.h"
+#else
+#include "poly1305_donna32.h"
+#endif
+#include "../onetimeauth_poly1305.h"
+
+static void
+poly1305_update(poly1305_state_internal_t *st, const unsigned char *m,
+                unsigned long long bytes)
+{
+    unsigned long long i;
+
+    /* handle leftover */
+    if (st->leftover) {
+        unsigned long long want = (poly1305_block_size - st->leftover);
+
+        if (want > bytes) {
+            want = bytes;
+        }
+        for (i = 0; i < want; i++) {
+            st->buffer[st->leftover + i] = m[i];
+        }
+        bytes -= want;
+        m += want;
+        st->leftover += want;
+        if (st->leftover < poly1305_block_size) {
+            return;
+        }
+        poly1305_blocks(st, st->buffer, poly1305_block_size);
+        st->leftover = 0;
+    }
+
+    /* process full blocks */
+    if (bytes >= poly1305_block_size) {
+        unsigned long long want = (bytes & ~(poly1305_block_size - 1));
+
+        poly1305_blocks(st, m, want);
+        m += want;
+        bytes -= want;
+    }
+
+    /* store leftover */
+    if (bytes) {
+        for (i = 0; i < bytes; i++) {
+            st->buffer[st->leftover + i] = m[i];
+        }
+        st->leftover += bytes;
+    }
+}
+
+static int
+crypto_onetimeauth_poly1305_donna(unsigned char *out, const unsigned char *m,
+                                  unsigned long long   inlen,
+                                  const unsigned char *key)
+{
+    CRYPTO_ALIGN(64) poly1305_state_internal_t state;
+
+    poly1305_init(&state, key);
+    poly1305_update(&state, m, inlen);
+    poly1305_finish(&state, out);
+
+    return 0;
+}
+
+static int
+crypto_onetimeauth_poly1305_donna_init(crypto_onetimeauth_poly1305_state *state,
+                                       const unsigned char *key)
+{
+    COMPILER_ASSERT(sizeof(crypto_onetimeauth_poly1305_state) >=
+        sizeof(poly1305_state_internal_t));
+    poly1305_init((poly1305_state_internal_t *) (void *) state, key);
+
+    return 0;
+}
+
+static int
+crypto_onetimeauth_poly1305_donna_update(
+    crypto_onetimeauth_poly1305_state *state, const unsigned char *in,
+    unsigned long long inlen)
+{
+    poly1305_update((poly1305_state_internal_t *) (void *) state, in, inlen);
+
+    return 0;
+}
+
+static int
+crypto_onetimeauth_poly1305_donna_final(
+    crypto_onetimeauth_poly1305_state *state, unsigned char *out)
+{
+    poly1305_finish((poly1305_state_internal_t *) (void *) state, out);
+
+    return 0;
+}
+
+static int
+crypto_onetimeauth_poly1305_donna_verify(const unsigned char *h,
+                                         const unsigned char *in,
+                                         unsigned long long   inlen,
+                                         const unsigned char *k)
+{
+    unsigned char correct[16];
+
+    crypto_onetimeauth_poly1305_donna(correct, in, inlen, k);
+
+    return crypto_verify_16(h, correct);
+}
+
+struct crypto_onetimeauth_poly1305_implementation
+    crypto_onetimeauth_poly1305_donna_implementation = {
+        SODIUM_C99(.onetimeauth =) crypto_onetimeauth_poly1305_donna,
+        SODIUM_C99(.onetimeauth_verify =)
+            crypto_onetimeauth_poly1305_donna_verify,
+        SODIUM_C99(.onetimeauth_init =) crypto_onetimeauth_poly1305_donna_init,
+        SODIUM_C99(.onetimeauth_update =)
+            crypto_onetimeauth_poly1305_donna_update,
+        SODIUM_C99(.onetimeauth_final =) crypto_onetimeauth_poly1305_donna_final
+    };
diff --git a/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h b/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h
@@ -0,0 +1,12 @@
+#ifndef poly1305_donna_H
+#define poly1305_donna_H
+
+#include <stddef.h>
+
+#include "crypto_onetimeauth_poly1305.h"
+#include "external/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.h"
+
+extern struct crypto_onetimeauth_poly1305_implementation
+    crypto_onetimeauth_poly1305_donna_implementation;
+
+#endif /* poly1305_donna_H */
diff --git a/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h b/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h
@@ -0,0 +1,235 @@
+/*
+   poly1305 implementation using 32 bit * 32 bit = 64 bit multiplication
+   and 64 bit addition
+*/
+
+#if defined(_MSC_VER)
+# define POLY1305_NOINLINE __declspec(noinline)
+#elif defined(__clang__) || defined(__GNUC__)
+# define POLY1305_NOINLINE __attribute__((noinline))
+#else
+# define POLY1305_NOINLINE
+#endif
+
+#include "private/common.h"
+
+#define poly1305_block_size 16
+
+/* 17 + sizeof(unsigned long long) + 14*sizeof(unsigned long) */
+typedef struct poly1305_state_internal_t {
+    unsigned long      r[5];
+    unsigned long      h[5];
+    unsigned long      pad[4];
+    unsigned long long leftover;
+    unsigned char      buffer[poly1305_block_size];
+    unsigned char      final;
+} poly1305_state_internal_t;
+
+static void
+poly1305_init(poly1305_state_internal_t *st, const unsigned char key[32])
+{
+    /* r &= 0xffffffc0ffffffc0ffffffc0fffffff - wiped after finalization */
+    st->r[0] = (LOAD32_LE(&key[0])) & 0x3ffffff;
+    st->r[1] = (LOAD32_LE(&key[3]) >> 2) & 0x3ffff03;
+    st->r[2] = (LOAD32_LE(&key[6]) >> 4) & 0x3ffc0ff;
+    st->r[3] = (LOAD32_LE(&key[9]) >> 6) & 0x3f03fff;
+    st->r[4] = (LOAD32_LE(&key[12]) >> 8) & 0x00fffff;
+
+    /* h = 0 */
+    st->h[0] = 0;
+    st->h[1] = 0;
+    st->h[2] = 0;
+    st->h[3] = 0;
+    st->h[4] = 0;
+
+    /* save pad for later */
+    st->pad[0] = LOAD32_LE(&key[16]);
+    st->pad[1] = LOAD32_LE(&key[20]);
+    st->pad[2] = LOAD32_LE(&key[24]);
+    st->pad[3] = LOAD32_LE(&key[28]);
+
+    st->leftover = 0;
+    st->final    = 0;
+}
+
+static void
+poly1305_blocks(poly1305_state_internal_t *st, const unsigned char *m,
+                unsigned long long bytes)
+{
+    const unsigned long hibit = (st->final) ? 0UL : (1UL << 24); /* 1 << 128 */
+    unsigned long       r0, r1, r2, r3, r4;
+    unsigned long       s1, s2, s3, s4;
+    unsigned long       h0, h1, h2, h3, h4;
+    unsigned long long  d0, d1, d2, d3, d4;
+    unsigned long       c;
+
+    r0 = st->r[0];
+    r1 = st->r[1];
+    r2 = st->r[2];
+    r3 = st->r[3];
+    r4 = st->r[4];
+
+    s1 = r1 * 5;
+    s2 = r2 * 5;
+    s3 = r3 * 5;
+    s4 = r4 * 5;
+
+    h0 = st->h[0];
+    h1 = st->h[1];
+    h2 = st->h[2];
+    h3 = st->h[3];
+    h4 = st->h[4];
+
+    while (bytes >= poly1305_block_size) {
+        /* h += m[i] */
+        h0 += (LOAD32_LE(m + 0)) & 0x3ffffff;
+        h1 += (LOAD32_LE(m + 3) >> 2) & 0x3ffffff;
+        h2 += (LOAD32_LE(m + 6) >> 4) & 0x3ffffff;
+        h3 += (LOAD32_LE(m + 9) >> 6) & 0x3ffffff;
+        h4 += (LOAD32_LE(m + 12) >> 8) | hibit;
+
+        /* h *= r */
+        d0 = ((unsigned long long) h0 * r0) + ((unsigned long long) h1 * s4) +
+             ((unsigned long long) h2 * s3) + ((unsigned long long) h3 * s2) +
+             ((unsigned long long) h4 * s1);
+        d1 = ((unsigned long long) h0 * r1) + ((unsigned long long) h1 * r0) +
+             ((unsigned long long) h2 * s4) + ((unsigned long long) h3 * s3) +
+             ((unsigned long long) h4 * s2);
+        d2 = ((unsigned long long) h0 * r2) + ((unsigned long long) h1 * r1) +
+             ((unsigned long long) h2 * r0) + ((unsigned long long) h3 * s4) +
+             ((unsigned long long) h4 * s3);
+        d3 = ((unsigned long long) h0 * r3) + ((unsigned long long) h1 * r2) +
+             ((unsigned long long) h2 * r1) + ((unsigned long long) h3 * r0) +
+             ((unsigned long long) h4 * s4);
+        d4 = ((unsigned long long) h0 * r4) + ((unsigned long long) h1 * r3) +
+             ((unsigned long long) h2 * r2) + ((unsigned long long) h3 * r1) +
+             ((unsigned long long) h4 * r0);
+
+        /* (partial) h %= p */
+        c  = (unsigned long) (d0 >> 26);
+        h0 = (unsigned long) d0 & 0x3ffffff;
+        d1 += c;
+        c  = (unsigned long) (d1 >> 26);
+        h1 = (unsigned long) d1 & 0x3ffffff;
+        d2 += c;
+        c  = (unsigned long) (d2 >> 26);
+        h2 = (unsigned long) d2 & 0x3ffffff;
+        d3 += c;
+        c  = (unsigned long) (d3 >> 26);
+        h3 = (unsigned long) d3 & 0x3ffffff;
+        d4 += c;
+        c  = (unsigned long) (d4 >> 26);
+        h4 = (unsigned long) d4 & 0x3ffffff;
+        h0 += c * 5;
+        c  = (h0 >> 26);
+        h0 &= 0x3ffffff;
+        h1 += c;
+
+        m += poly1305_block_size;
+        bytes -= poly1305_block_size;
+    }
+
+    st->h[0] = h0;
+    st->h[1] = h1;
+    st->h[2] = h2;
+    st->h[3] = h3;
+    st->h[4] = h4;
+}
+
+static POLY1305_NOINLINE void
+poly1305_finish(poly1305_state_internal_t *st, unsigned char mac[16])
+{
+    unsigned long      h0, h1, h2, h3, h4, c;
+    unsigned long      g0, g1, g2, g3, g4;
+    unsigned long long f;
+    unsigned long      mask;
+
+    /* process the remaining block */
+    if (st->leftover) {
+        unsigned long long i = st->leftover;
+
+        st->buffer[i++] = 1;
+        for (; i < poly1305_block_size; i++) {
+            st->buffer[i] = 0;
+        }
+        st->final = 1;
+        poly1305_blocks(st, st->buffer, poly1305_block_size);
+    }
+
+    /* fully carry h */
+    h0 = st->h[0];
+    h1 = st->h[1];
+    h2 = st->h[2];
+    h3 = st->h[3];
+    h4 = st->h[4];
+
+    c  = h1 >> 26;
+    h1 = h1 & 0x3ffffff;
+    h2 += c;
+    c  = h2 >> 26;
+    h2 = h2 & 0x3ffffff;
+    h3 += c;
+    c  = h3 >> 26;
+    h3 = h3 & 0x3ffffff;
+    h4 += c;
+    c  = h4 >> 26;
+    h4 = h4 & 0x3ffffff;
+    h0 += c * 5;
+    c  = h0 >> 26;
+    h0 = h0 & 0x3ffffff;
+    h1 += c;
+
+    /* compute h + -p */
+    g0 = h0 + 5;
+    c  = g0 >> 26;
+    g0 &= 0x3ffffff;
+    g1 = h1 + c;
+    c  = g1 >> 26;
+    g1 &= 0x3ffffff;
+    g2 = h2 + c;
+    c  = g2 >> 26;
+    g2 &= 0x3ffffff;
+    g3 = h3 + c;
+    c  = g3 >> 26;
+    g3 &= 0x3ffffff;
+    g4 = h4 + c - (1UL << 26);
+
+    /* select h if h < p, or h + -p if h >= p */
+    mask = (g4 >> ((sizeof(unsigned long) * 8) - 1)) - 1;
+    g0 &= mask;
+    g1 &= mask;
+    g2 &= mask;
+    g3 &= mask;
+    g4 &= mask;
+    mask = ~mask;
+
+    h0 = (h0 & mask) | g0;
+    h1 = (h1 & mask) | g1;
+    h2 = (h2 & mask) | g2;
+    h3 = (h3 & mask) | g3;
+    h4 = (h4 & mask) | g4;
+
+    /* h = h % (2^128) */
+    h0 = ((h0) | (h1 << 26)) & 0xffffffff;
+    h1 = ((h1 >> 6) | (h2 << 20)) & 0xffffffff;
+    h2 = ((h2 >> 12) | (h3 << 14)) & 0xffffffff;
+    h3 = ((h3 >> 18) | (h4 << 8)) & 0xffffffff;
+
+    /* mac = (h + pad) % (2^128) */
+    f  = (unsigned long long) h0 + st->pad[0];
+    h0 = (unsigned long) f;
+    f  = (unsigned long long) h1 + st->pad[1] + (f >> 32);
+    h1 = (unsigned long) f;
+    f  = (unsigned long long) h2 + st->pad[2] + (f >> 32);
+    h2 = (unsigned long) f;
+    f  = (unsigned long long) h3 + st->pad[3] + (f >> 32);
+    h3 = (unsigned long) f;
+
+    STORE32_LE(mac + 0, (uint32_t) h0);
+    STORE32_LE(mac + 4, (uint32_t) h1);
+    STORE32_LE(mac + 8, (uint32_t) h2);
+    STORE32_LE(mac + 12, (uint32_t) h3);
+
+    /* zero out the state */
+    sodium_memzero((void *) st, sizeof *st);
+}
diff --git a/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h b/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h
@@ -0,0 +1,221 @@
+/*
+   poly1305 implementation using 64 bit * 64 bit = 128 bit multiplication
+   and 128 bit addition
+*/
+
+#include "private/common.h"
+
+#define MUL(out, x, y) out = ((uint128_t) x * y)
+#define ADD(out, in) out += in
+#define ADDLO(out, in) out += in
+#define SHR(in, shift) (unsigned long long) (in >> (shift))
+#define LO(in) (unsigned long long) (in)
+
+#if defined(_MSC_VER)
+# define POLY1305_NOINLINE __declspec(noinline)
+#elif defined(__clang__) || defined(__GNUC__)
+# define POLY1305_NOINLINE __attribute__((noinline))
+#else
+# define POLY1305_NOINLINE
+#endif
+
+#define poly1305_block_size 16
+
+/* 17 + sizeof(unsigned long long) + 8*sizeof(unsigned long long) */
+typedef struct poly1305_state_internal_t {
+    unsigned long long r[3];
+    unsigned long long h[3];
+    unsigned long long pad[2];
+    unsigned long long leftover;
+    unsigned char      buffer[poly1305_block_size];
+    unsigned char      final;
+} poly1305_state_internal_t;
+
+static void
+poly1305_init(poly1305_state_internal_t *st, const unsigned char key[32])
+{
+    unsigned long long t0, t1;
+
+    /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */
+    t0 = LOAD64_LE(&key[0]);
+    t1 = LOAD64_LE(&key[8]);
+
+    /* wiped after finalization */
+    st->r[0] = (t0) & 0xffc0fffffff;
+    st->r[1] = ((t0 >> 44) | (t1 << 20)) & 0xfffffc0ffff;
+    st->r[2] = ((t1 >> 24)) & 0x00ffffffc0f;
+
+    /* h = 0 */
+    st->h[0] = 0;
+    st->h[1] = 0;
+    st->h[2] = 0;
+
+    /* save pad for later */
+    st->pad[0] = LOAD64_LE(&key[16]);
+    st->pad[1] = LOAD64_LE(&key[24]);
+
+    st->leftover = 0;
+    st->final    = 0;
+}
+
+static void
+poly1305_blocks(poly1305_state_internal_t *st, const unsigned char *m,
+                unsigned long long bytes)
+{
+    const unsigned long long hibit =
+        (st->final) ? 0ULL : (1ULL << 40); /* 1 << 128 */
+    unsigned long long r0, r1, r2;
+    unsigned long long s1, s2;
+    unsigned long long h0, h1, h2;
+    unsigned long long c;
+    uint128_t          d0, d1, d2, d;
+
+    r0 = st->r[0];
+    r1 = st->r[1];
+    r2 = st->r[2];
+
+    h0 = st->h[0];
+    h1 = st->h[1];
+    h2 = st->h[2];
+
+    s1 = r1 * (5 << 2);
+    s2 = r2 * (5 << 2);
+
+    while (bytes >= poly1305_block_size) {
+        unsigned long long t0, t1;
+
+        /* h += m[i] */
+        t0 = LOAD64_LE(&m[0]);
+        t1 = LOAD64_LE(&m[8]);
+
+        h0 += t0 & 0xfffffffffff;
+        h1 += ((t0 >> 44) | (t1 << 20)) & 0xfffffffffff;
+        h2 += (((t1 >> 24)) & 0x3ffffffffff) | hibit;
+
+        /* h *= r */
+        MUL(d0, h0, r0);
+        MUL(d, h1, s2);
+        ADD(d0, d);
+        MUL(d, h2, s1);
+        ADD(d0, d);
+        MUL(d1, h0, r1);
+        MUL(d, h1, r0);
+        ADD(d1, d);
+        MUL(d, h2, s2);
+        ADD(d1, d);
+        MUL(d2, h0, r2);
+        MUL(d, h1, r1);
+        ADD(d2, d);
+        MUL(d, h2, r0);
+        ADD(d2, d);
+
+        /* (partial) h %= p */
+        c  = SHR(d0, 44);
+        h0 = LO(d0) & 0xfffffffffff;
+        ADDLO(d1, c);
+        c  = SHR(d1, 44);
+        h1 = LO(d1) & 0xfffffffffff;
+        ADDLO(d2, c);
+        c  = SHR(d2, 42);
+        h2 = LO(d2) & 0x3ffffffffff;
+        h0 += c * 5;
+        c  = (h0 >> 44);
+        h0 &= 0xfffffffffff;
+        h1 += c;
+
+        m += poly1305_block_size;
+        bytes -= poly1305_block_size;
+    }
+
+    st->h[0] = h0;
+    st->h[1] = h1;
+    st->h[2] = h2;
+}
+
+static POLY1305_NOINLINE void
+poly1305_finish(poly1305_state_internal_t *st, unsigned char mac[16])
+{
+    unsigned long long h0, h1, h2, c;
+    unsigned long long g0, g1, g2;
+    unsigned long long t0, t1;
+    unsigned long long mask;
+
+    /* process the remaining block */
+    if (st->leftover) {
+        unsigned long long i = st->leftover;
+
+        st->buffer[i] = 1;
+
+        for (i = i + 1; i < poly1305_block_size; i++) {
+            st->buffer[i] = 0;
+        }
+        st->final = 1;
+        poly1305_blocks(st, st->buffer, poly1305_block_size);
+    }
+
+    /* fully carry h */
+    h0 = st->h[0];
+    h1 = st->h[1];
+    h2 = st->h[2];
+
+    c = h1 >> 44;
+    h1 &= 0xfffffffffff;
+    h2 += c;
+    c = h2 >> 42;
+    h2 &= 0x3ffffffffff;
+    h0 += c * 5;
+    c = h0 >> 44;
+    h0 &= 0xfffffffffff;
+    h1 += c;
+    c = h1 >> 44;
+    h1 &= 0xfffffffffff;
+    h2 += c;
+    c = h2 >> 42;
+    h2 &= 0x3ffffffffff;
+    h0 += c * 5;
+    c = h0 >> 44;
+    h0 &= 0xfffffffffff;
+    h1 += c;
+
+    /* compute h + -p */
+    g0 = h0 + 5;
+    c  = g0 >> 44;
+    g0 &= 0xfffffffffff;
+    g1 = h1 + c;
+    c  = g1 >> 44;
+    g1 &= 0xfffffffffff;
+    g2 = h2 + c - (1ULL << 42);
+
+    /* select h if h < p, or h + -p if h >= p */
+    mask = (g2 >> ((sizeof(unsigned long long) * 8) - 1)) - 1;
+    g0   &= mask;
+    g1   &= mask;
+    g2   &= mask;
+    mask =  ~mask;
+    h0   =  (h0 & mask) | g0;
+    h1   =  (h1 & mask) | g1;
+    h2   =  (h2 & mask) | g2;
+
+    /* h = (h + pad) */
+    t0 = st->pad[0];
+    t1 = st->pad[1];
+
+    h0 += ((t0) &0xfffffffffff);
+    c = (h0 >> 44);
+    h0 &= 0xfffffffffff;
+    h1 += (((t0 >> 44) | (t1 << 20)) & 0xfffffffffff) + c;
+    c = (h1 >> 44);
+    h1 &= 0xfffffffffff;
+    h2 += (((t1 >> 24)) & 0x3ffffffffff) + c;
+    h2 &= 0x3ffffffffff;
+
+    /* mac = h % (2^128) */
+    h0 = (h0) | (h1 << 44);
+    h1 = (h1 >> 20) | (h2 << 24);
+
+    STORE64_LE(&mac[0], h0);
+    STORE64_LE(&mac[8], h1);
+
+    /* zero out the state */
+    sodium_memzero((void *) st, sizeof *st);
+}
diff --git a/vendor/external/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c b/vendor/external/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c
@@ -0,0 +1,90 @@
+
+#include "onetimeauth_poly1305.h"
+#include "crypto_onetimeauth_poly1305.h"
+#include "private/common.h"
+#include "private/implementations.h"
+#include "randombytes.h"
+#include "runtime.h"
+
+#include "donna/poly1305_donna.h"
+#if defined(HAVE_TI_MODE) && defined(HAVE_EMMINTRIN_H)
+# include "sse2/poly1305_sse2.h"
+#endif
+
+static const crypto_onetimeauth_poly1305_implementation *implementation =
+    &crypto_onetimeauth_poly1305_donna_implementation;
+
+int
+crypto_onetimeauth_poly1305(unsigned char *out, const unsigned char *in,
+                            unsigned long long inlen, const unsigned char *k)
+{
+    return implementation->onetimeauth(out, in, inlen, k);
+}
+
+int
+crypto_onetimeauth_poly1305_verify(const unsigned char *h,
+                                   const unsigned char *in,
+                                   unsigned long long   inlen,
+                                   const unsigned char *k)
+{
+    return implementation->onetimeauth_verify(h, in, inlen, k);
+}
+
+int
+crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state,
+                                 const unsigned char *key)
+{
+    return implementation->onetimeauth_init(state, key);
+}
+
+int
+crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state,
+                                   const unsigned char *in,
+                                   unsigned long long inlen)
+{
+    return implementation->onetimeauth_update(state, in, inlen);
+}
+
+int
+crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state,
+                                  unsigned char *out)
+{
+    return implementation->onetimeauth_final(state, out);
+}
+
+size_t
+crypto_onetimeauth_poly1305_bytes(void)
+{
+    return crypto_onetimeauth_poly1305_BYTES;
+}
+
+size_t
+crypto_onetimeauth_poly1305_keybytes(void)
+{
+    return crypto_onetimeauth_poly1305_KEYBYTES;
+}
+
+size_t
+crypto_onetimeauth_poly1305_statebytes(void)
+{
+    return sizeof(crypto_onetimeauth_poly1305_state);
+}
+
+void
+crypto_onetimeauth_poly1305_keygen(
+    unsigned char k[crypto_onetimeauth_poly1305_KEYBYTES])
+{
+    randombytes_buf(k, crypto_onetimeauth_poly1305_KEYBYTES);
+}
+
+int
+_crypto_onetimeauth_poly1305_pick_best_implementation(void)
+{
+    implementation = &crypto_onetimeauth_poly1305_donna_implementation;
+#if defined(HAVE_TI_MODE) && defined(HAVE_EMMINTRIN_H)
+    if (sodium_runtime_has_sse2()) {
+        implementation = &crypto_onetimeauth_poly1305_sse2_implementation;
+    }
+#endif
+    return 0;
+}
diff --git a/vendor/external/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.h b/vendor/external/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.h
@@ -0,0 +1,21 @@
+
+#ifndef onetimeauth_poly1305_H
+#define onetimeauth_poly1305_H
+
+#include "crypto_onetimeauth_poly1305.h"
+
+typedef struct crypto_onetimeauth_poly1305_implementation {
+    int (*onetimeauth)(unsigned char *out, const unsigned char *in,
+                       unsigned long long inlen, const unsigned char *k);
+    int (*onetimeauth_verify)(const unsigned char *h, const unsigned char *in,
+                              unsigned long long inlen, const unsigned char *k);
+    int (*onetimeauth_init)(crypto_onetimeauth_poly1305_state *state,
+                            const unsigned char *              key);
+    int (*onetimeauth_update)(crypto_onetimeauth_poly1305_state *state,
+                              const unsigned char *              in,
+                              unsigned long long                 inlen);
+    int (*onetimeauth_final)(crypto_onetimeauth_poly1305_state *state,
+                             unsigned char *                    out);
+} crypto_onetimeauth_poly1305_implementation;
+
+#endif
diff --git a/vendor/external/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c b/vendor/external/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c
@@ -0,0 +1,949 @@
+
+#include <stdint.h>
+#include <string.h>
+
+#include "../onetimeauth_poly1305.h"
+#include "crypto_verify_16.h"
+#include "poly1305_sse2.h"
+#include "private/common.h"
+#include "utils.h"
+
+#if defined(HAVE_TI_MODE) && defined(HAVE_EMMINTRIN_H)
+
+# ifdef __GNUC__
+#  pragma GCC target("sse2")
+# endif
+
+# include <emmintrin.h>
+# include "private/sse2_64_32.h"
+
+typedef __m128i xmmi;
+
+# if defined(_MSC_VER)
+#  define POLY1305_NOINLINE __declspec(noinline)
+# elif defined(__clang__) || defined(__GNUC__)
+#  define POLY1305_NOINLINE __attribute__((noinline))
+# else
+#  define POLY1305_NOINLINE
+# endif
+
+# define poly1305_block_size 32
+
+enum poly1305_state_flags_t {
+    poly1305_started       = 1,
+    poly1305_final_shift8  = 4,
+    poly1305_final_shift16 = 8,
+    poly1305_final_r2_r    = 16, /* use [r^2,r] for the final block */
+    poly1305_final_r_1     = 32  /* use [r,1] for the final block */
+};
+
+typedef struct poly1305_state_internal_t {
+    union {
+        uint64_t h[3];
+        uint32_t hh[10];
+    } H;                                            /*  40 bytes */
+    uint32_t           R[5];                        /*  20 bytes */
+    uint32_t           R2[5];                       /*  20 bytes */
+    uint32_t           R4[5];                       /*  20 bytes */
+    uint64_t           pad[2];                      /*  16 bytes */
+    uint64_t           flags;                       /*   8 bytes */
+    unsigned long long leftover;                    /*   8 bytes */
+    unsigned char      buffer[poly1305_block_size]; /*  32 bytes */
+} poly1305_state_internal_t;                        /* 164 bytes total */
+
+/*
+ * _mm_loadl_epi64() is turned into a simple MOVQ. So, unaligned accesses are
+ * totally fine, even though this intrinsic requires a __m128i* input.
+ * This confuses dynamic analysis, so force alignment, only in debug mode.
+ */
+# ifdef DEBUG
+static xmmi
+_fakealign_mm_loadl_epi64(const void *m)
+{
+    xmmi tmp;
+    memcpy(&tmp, m, 8);
+
+    return _mm_loadl_epi64(&tmp);
+}
+# define _mm_loadl_epi64(X) _fakealign_mm_loadl_epi64(X)
+#endif
+
+/* copy 0-31 bytes */
+static inline void
+poly1305_block_copy31(unsigned char *dst, const unsigned char *src,
+                      unsigned long long bytes)
+{
+    if (bytes & 16) {
+        _mm_store_si128((xmmi *) (void *) dst,
+                        _mm_loadu_si128((const xmmi *) (const void *) src));
+        src += 16;
+        dst += 16;
+    }
+    if (bytes & 8) {
+        memcpy(dst, src, 8);
+        src += 8;
+        dst += 8;
+    }
+    if (bytes & 4) {
+        memcpy(dst, src, 4);
+        src += 4;
+        dst += 4;
+    }
+    if (bytes & 2) {
+        memcpy(dst, src, 2);
+        src += 2;
+        dst += 2;
+    }
+    if (bytes & 1) {
+        *dst = *src;
+    }
+}
+
+static POLY1305_NOINLINE void
+poly1305_init_ext(poly1305_state_internal_t *st, const unsigned char key[32],
+                  unsigned long long bytes)
+{
+    uint32_t          *R;
+    uint128_t          d[3];
+    uint64_t           r0, r1, r2;
+    uint64_t           rt0, rt1, rt2, st2, c;
+    uint64_t           t0, t1;
+    unsigned long long i;
+
+    if (!bytes) {
+        bytes = ~(unsigned long long) 0;
+    }
+    /* H = 0 */
+    _mm_storeu_si128((xmmi *) (void *) &st->H.hh[0], _mm_setzero_si128());
+    _mm_storeu_si128((xmmi *) (void *) &st->H.hh[4], _mm_setzero_si128());
+    _mm_storeu_si128((xmmi *) (void *) &st->H.hh[8], _mm_setzero_si128());
+
+    /* clamp key */
+    memcpy(&t0, key, 8);
+    memcpy(&t1, key + 8, 8);
+    r0 = t0 & 0xffc0fffffff;
+    t0 >>= 44;
+    t0 |= t1 << 20;
+    r1 = t0 & 0xfffffc0ffff;
+    t1 >>= 24;
+    r2 = t1 & 0x00ffffffc0f;
+
+    /* r^1 */
+    R    = st->R;
+    R[0] = (uint32_t)(r0) &0x3ffffff;
+    R[1] = (uint32_t)((r0 >> 26) | (r1 << 18)) & 0x3ffffff;
+    R[2] = (uint32_t)((r1 >> 8)) & 0x3ffffff;
+    R[3] = (uint32_t)((r1 >> 34) | (r2 << 10)) & 0x3ffffff;
+    R[4] = (uint32_t)((r2 >> 16));
+
+    /* save pad */
+    memcpy(&st->pad[0], key + 16, 8);
+    memcpy(&st->pad[1], key + 24, 8);
+
+    rt0 = r0;
+    rt1 = r1;
+    rt2 = r2;
+
+    /* r^2, r^4 */
+    for (i = 0; i < 2; i++) {
+        if (i == 0) {
+            R = st->R2;
+            if (bytes <= 16) {
+                break;
+            }
+        } else if (i == 1) {
+            R = st->R4;
+            if (bytes < 96) {
+                break;
+            }
+        }
+        st2 = rt2 * (5 << 2);
+
+        d[0] = ((uint128_t) rt0 * rt0) + ((uint128_t)(rt1 * 2) * st2);
+        d[1] = ((uint128_t) rt2 * st2) + ((uint128_t)(rt0 * 2) * rt1);
+        d[2] = ((uint128_t) rt1 * rt1) + ((uint128_t)(rt2 * 2) * rt0);
+
+        rt0 = (uint64_t) d[0] & 0xfffffffffff;
+        c   = (uint64_t)(d[0] >> 44);
+        d[1] += c;
+
+        rt1 = (uint64_t) d[1] & 0xfffffffffff;
+        c   = (uint64_t)(d[1] >> 44);
+        d[2] += c;
+
+        rt2 = (uint64_t) d[2] & 0x3ffffffffff;
+        c   = (uint64_t)(d[2] >> 42);
+        rt0 += c * 5;
+        c   = (rt0 >> 44);
+        rt0 = rt0 & 0xfffffffffff;
+        rt1 += c;
+        c   = (rt1 >> 44);
+        rt1 = rt1 & 0xfffffffffff;
+        rt2 += c; /* even if rt2 overflows, it will still fit in rp4 safely, and
+                     is safe to multiply with */
+
+        R[0] = (uint32_t)(rt0) &0x3ffffff;
+        R[1] = (uint32_t)((rt0 >> 26) | (rt1 << 18)) & 0x3ffffff;
+        R[2] = (uint32_t)((rt1 >> 8)) & 0x3ffffff;
+        R[3] = (uint32_t)((rt1 >> 34) | (rt2 << 10)) & 0x3ffffff;
+        R[4] = (uint32_t)((rt2 >> 16));
+    }
+    st->flags    = 0;
+    st->leftover = 0U;
+}
+
+static POLY1305_NOINLINE void
+poly1305_blocks(poly1305_state_internal_t *st, const unsigned char *m,
+                unsigned long long bytes)
+{
+    CRYPTO_ALIGN(64)
+    xmmi HIBIT =
+        _mm_shuffle_epi32(_mm_cvtsi32_si128(1 << 24), _MM_SHUFFLE(1, 0, 1, 0));
+    const xmmi MMASK = _mm_shuffle_epi32(_mm_cvtsi32_si128((1 << 26) - 1),
+                                         _MM_SHUFFLE(1, 0, 1, 0));
+    const xmmi FIVE =
+        _mm_shuffle_epi32(_mm_cvtsi32_si128(5), _MM_SHUFFLE(1, 0, 1, 0));
+    xmmi H0, H1, H2, H3, H4;
+    xmmi T0, T1, T2, T3, T4, T5, T6, T7, T8;
+    xmmi M0, M1, M2, M3, M4;
+    xmmi M5, M6, M7, M8;
+    xmmi C1, C2;
+    xmmi R20, R21, R22, R23, R24, S21, S22, S23, S24;
+    xmmi R40, R41, R42, R43, R44, S41, S42, S43, S44;
+
+    if (st->flags & poly1305_final_shift8) {
+        HIBIT = _mm_srli_si128(HIBIT, 8);
+    }
+    if (st->flags & poly1305_final_shift16) {
+        HIBIT = _mm_setzero_si128();
+    }
+    if (!(st->flags & poly1305_started)) {
+        /* H = [Mx,My] */
+        T5 = _mm_unpacklo_epi64(
+            _mm_loadl_epi64((const xmmi *) (const void *) (m + 0)),
+            _mm_loadl_epi64((const xmmi *) (const void *) (m + 16)));
+        T6 = _mm_unpacklo_epi64(
+            _mm_loadl_epi64((const xmmi *) (const void *) (m + 8)),
+            _mm_loadl_epi64((const xmmi *) (const void *) (m + 24)));
+        H0 = _mm_and_si128(MMASK, T5);
+        H1 = _mm_and_si128(MMASK, _mm_srli_epi64(T5, 26));
+        T5 = _mm_or_si128(_mm_srli_epi64(T5, 52), _mm_slli_epi64(T6, 12));
+        H2 = _mm_and_si128(MMASK, T5);
+        H3 = _mm_and_si128(MMASK, _mm_srli_epi64(T5, 26));
+        H4 = _mm_srli_epi64(T6, 40);
+        H4 = _mm_or_si128(H4, HIBIT);
+        m += 32;
+        bytes -= 32;
+        st->flags |= poly1305_started;
+    } else {
+        T0 = _mm_loadu_si128((const xmmi *) (const void *) &st->H.hh[0]);
+        T1 = _mm_loadu_si128((const xmmi *) (const void *) &st->H.hh[4]);
+        T2 = _mm_loadu_si128((const xmmi *) (const void *) &st->H.hh[8]);
+        H0 = _mm_shuffle_epi32(T0, _MM_SHUFFLE(1, 1, 0, 0));
+        H1 = _mm_shuffle_epi32(T0, _MM_SHUFFLE(3, 3, 2, 2));
+        H2 = _mm_shuffle_epi32(T1, _MM_SHUFFLE(1, 1, 0, 0));
+        H3 = _mm_shuffle_epi32(T1, _MM_SHUFFLE(3, 3, 2, 2));
+        H4 = _mm_shuffle_epi32(T2, _MM_SHUFFLE(1, 1, 0, 0));
+    }
+    if (st->flags & (poly1305_final_r2_r | poly1305_final_r_1)) {
+        if (st->flags & poly1305_final_r2_r) {
+            /* use [r^2, r] */
+            T2  = _mm_loadu_si128((const xmmi *) (const void *) &st->R[0]);
+            T3  = _mm_cvtsi32_si128(st->R[4]);
+            T0  = _mm_loadu_si128((const xmmi *) (const void *) &st->R2[0]);
+            T1  = _mm_cvtsi32_si128(st->R2[4]);
+            T4  = _mm_unpacklo_epi32(T0, T2);
+            T5  = _mm_unpackhi_epi32(T0, T2);
+            R24 = _mm_unpacklo_epi64(T1, T3);
+        } else {
+            /* use [r^1, 1] */
+            T0  = _mm_loadu_si128((const xmmi *) (const void *) &st->R[0]);
+            T1  = _mm_cvtsi32_si128(st->R[4]);
+            T2  = _mm_cvtsi32_si128(1);
+            T4  = _mm_unpacklo_epi32(T0, T2);
+            T5  = _mm_unpackhi_epi32(T0, T2);
+            R24 = T1;
+        }
+        R20 = _mm_shuffle_epi32(T4, _MM_SHUFFLE(1, 1, 0, 0));
+        R21 = _mm_shuffle_epi32(T4, _MM_SHUFFLE(3, 3, 2, 2));
+        R22 = _mm_shuffle_epi32(T5, _MM_SHUFFLE(1, 1, 0, 0));
+        R23 = _mm_shuffle_epi32(T5, _MM_SHUFFLE(3, 3, 2, 2));
+    } else {
+        /* use [r^2, r^2] */
+        T0  = _mm_loadu_si128((const xmmi *) (const void *) &st->R2[0]);
+        T1  = _mm_cvtsi32_si128(st->R2[4]);
+        R20 = _mm_shuffle_epi32(T0, _MM_SHUFFLE(0, 0, 0, 0));
+        R21 = _mm_shuffle_epi32(T0, _MM_SHUFFLE(1, 1, 1, 1));
+        R22 = _mm_shuffle_epi32(T0, _MM_SHUFFLE(2, 2, 2, 2));
+        R23 = _mm_shuffle_epi32(T0, _MM_SHUFFLE(3, 3, 3, 3));
+        R24 = _mm_shuffle_epi32(T1, _MM_SHUFFLE(0, 0, 0, 0));
+    }
+    S21 = _mm_mul_epu32(R21, FIVE);
+    S22 = _mm_mul_epu32(R22, FIVE);
+    S23 = _mm_mul_epu32(R23, FIVE);
+    S24 = _mm_mul_epu32(R24, FIVE);
+
+    if (bytes >= 64) {
+        T0  = _mm_loadu_si128((const xmmi *) (const void *) &st->R4[0]);
+        T1  = _mm_cvtsi32_si128(st->R4[4]);
+        R40 = _mm_shuffle_epi32(T0, _MM_SHUFFLE(0, 0, 0, 0));
+        R41 = _mm_shuffle_epi32(T0, _MM_SHUFFLE(1, 1, 1, 1));
+        R42 = _mm_shuffle_epi32(T0, _MM_SHUFFLE(2, 2, 2, 2));
+        R43 = _mm_shuffle_epi32(T0, _MM_SHUFFLE(3, 3, 3, 3));
+        R44 = _mm_shuffle_epi32(T1, _MM_SHUFFLE(0, 0, 0, 0));
+        S41 = _mm_mul_epu32(R41, FIVE);
+        S42 = _mm_mul_epu32(R42, FIVE);
+        S43 = _mm_mul_epu32(R43, FIVE);
+        S44 = _mm_mul_epu32(R44, FIVE);
+
+        while (bytes >= 64) {
+            xmmi v00, v01, v02, v03, v04;
+            xmmi v10, v11, v12, v13, v14;
+            xmmi v20, v21, v22, v23, v24;
+            xmmi v30, v31, v32, v33, v34;
+            xmmi v40, v41, v42, v43, v44;
+            xmmi T14, T15;
+
+            /* H *= [r^4,r^4], preload [Mx,My] */
+            T15 = S42;
+            T0  = H4;
+            T0  = _mm_mul_epu32(T0, S41);
+            v01 = H3;
+            v01 = _mm_mul_epu32(v01, T15);
+            T14 = S43;
+            T1  = H4;
+            T1  = _mm_mul_epu32(T1, T15);
+            v11 = H3;
+            v11 = _mm_mul_epu32(v11, T14);
+            T2  = H4;
+            T2  = _mm_mul_epu32(T2, T14);
+            T0  = _mm_add_epi64(T0, v01);
+            T15 = S44;
+            v02 = H2;
+            v02 = _mm_mul_epu32(v02, T14);
+            T3  = H4;
+            T3  = _mm_mul_epu32(T3, T15);
+            T1  = _mm_add_epi64(T1, v11);
+            v03 = H1;
+            v03 = _mm_mul_epu32(v03, T15);
+            v12 = H2;
+            v12 = _mm_mul_epu32(v12, T15);
+            T0  = _mm_add_epi64(T0, v02);
+            T14 = R40;
+            v21 = H3;
+            v21 = _mm_mul_epu32(v21, T15);
+            v31 = H3;
+            v31 = _mm_mul_epu32(v31, T14);
+            T0  = _mm_add_epi64(T0, v03);
+            T4  = H4;
+            T4  = _mm_mul_epu32(T4, T14);
+            T1  = _mm_add_epi64(T1, v12);
+            v04 = H0;
+            v04 = _mm_mul_epu32(v04, T14);
+            T2  = _mm_add_epi64(T2, v21);
+            v13 = H1;
+            v13 = _mm_mul_epu32(v13, T14);
+            T3  = _mm_add_epi64(T3, v31);
+            T15 = R41;
+            v22 = H2;
+            v22 = _mm_mul_epu32(v22, T14);
+            v32 = H2;
+            v32 = _mm_mul_epu32(v32, T15);
+            T0  = _mm_add_epi64(T0, v04);
+            v41 = H3;
+            v41 = _mm_mul_epu32(v41, T15);
+            T1  = _mm_add_epi64(T1, v13);
+            v14 = H0;
+            v14 = _mm_mul_epu32(v14, T15);
+            T2  = _mm_add_epi64(T2, v22);
+            T14 = R42;
+            T5  = _mm_unpacklo_epi64(
+                _mm_loadl_epi64((const xmmi *) (const void *) (m + 0)),
+                _mm_loadl_epi64((const xmmi *) (const void *) (m + 16)));
+            v23 = H1;
+            v23 = _mm_mul_epu32(v23, T15);
+            T3  = _mm_add_epi64(T3, v32);
+            v33 = H1;
+            v33 = _mm_mul_epu32(v33, T14);
+            T4  = _mm_add_epi64(T4, v41);
+            v42 = H2;
+            v42 = _mm_mul_epu32(v42, T14);
+            T1  = _mm_add_epi64(T1, v14);
+            T15 = R43;
+            T6  = _mm_unpacklo_epi64(
+                _mm_loadl_epi64((const xmmi *) (const void *) (m + 8)),
+                _mm_loadl_epi64((const xmmi *) (const void *) (m + 24)));
+            v24 = H0;
+            v24 = _mm_mul_epu32(v24, T14);
+            T2  = _mm_add_epi64(T2, v23);
+            v34 = H0;
+            v34 = _mm_mul_epu32(v34, T15);
+            T3  = _mm_add_epi64(T3, v33);
+            M0  = _mm_and_si128(MMASK, T5);
+            v43 = H1;
+            v43 = _mm_mul_epu32(v43, T15);
+            T4  = _mm_add_epi64(T4, v42);
+            M1  = _mm_and_si128(MMASK, _mm_srli_epi64(T5, 26));
+            v44 = H0;
+            v44 = _mm_mul_epu32(v44, R44);
+            T2  = _mm_add_epi64(T2, v24);
+            T5  = _mm_or_si128(_mm_srli_epi64(T5, 52), _mm_slli_epi64(T6, 12));
+            T3  = _mm_add_epi64(T3, v34);
+            M3  = _mm_and_si128(MMASK, _mm_srli_epi64(T6, 14));
+            T4  = _mm_add_epi64(T4, v43);
+            M2  = _mm_and_si128(MMASK, T5);
+            T4  = _mm_add_epi64(T4, v44);
+            M4  = _mm_or_si128(_mm_srli_epi64(T6, 40), HIBIT);
+
+            /* H += [Mx',My'] */
+            T5 = _mm_loadu_si128((const xmmi *) (const void *) (m + 32));
+            T6 = _mm_loadu_si128((const xmmi *) (const void *) (m + 48));
+            T7 = _mm_unpacklo_epi32(T5, T6);
+            T8 = _mm_unpackhi_epi32(T5, T6);
+            M5 = _mm_unpacklo_epi32(T7, _mm_setzero_si128());
+            M6 = _mm_unpackhi_epi32(T7, _mm_setzero_si128());
+            M7 = _mm_unpacklo_epi32(T8, _mm_setzero_si128());
+            M8 = _mm_unpackhi_epi32(T8, _mm_setzero_si128());
+            M6 = _mm_slli_epi64(M6, 6);
+            M7 = _mm_slli_epi64(M7, 12);
+            M8 = _mm_slli_epi64(M8, 18);
+            T0 = _mm_add_epi64(T0, M5);
+            T1 = _mm_add_epi64(T1, M6);
+            T2 = _mm_add_epi64(T2, M7);
+            T3 = _mm_add_epi64(T3, M8);
+            T4 = _mm_add_epi64(T4, HIBIT);
+
+            /* H += [Mx,My]*[r^2,r^2] */
+            T15 = S22;
+            v00 = M4;
+            v00 = _mm_mul_epu32(v00, S21);
+            v01 = M3;
+            v01 = _mm_mul_epu32(v01, T15);
+            T14 = S23;
+            v10 = M4;
+            v10 = _mm_mul_epu32(v10, T15);
+            v11 = M3;
+            v11 = _mm_mul_epu32(v11, T14);
+            T0  = _mm_add_epi64(T0, v00);
+            v20 = M4;
+            v20 = _mm_mul_epu32(v20, T14);
+            T0  = _mm_add_epi64(T0, v01);
+            T15 = S24;
+            v02 = M2;
+            v02 = _mm_mul_epu32(v02, T14);
+            T1  = _mm_add_epi64(T1, v10);
+            v30 = M4;
+            v30 = _mm_mul_epu32(v30, T15);
+            T1  = _mm_add_epi64(T1, v11);
+            v03 = M1;
+            v03 = _mm_mul_epu32(v03, T15);
+            T2  = _mm_add_epi64(T2, v20);
+            v12 = M2;
+            v12 = _mm_mul_epu32(v12, T15);
+            T0  = _mm_add_epi64(T0, v02);
+            T14 = R20;
+            v21 = M3;
+            v21 = _mm_mul_epu32(v21, T15);
+            T3  = _mm_add_epi64(T3, v30);
+            v31 = M3;
+            v31 = _mm_mul_epu32(v31, T14);
+            T0  = _mm_add_epi64(T0, v03);
+            v40 = M4;
+            v40 = _mm_mul_epu32(v40, T14);
+            T1  = _mm_add_epi64(T1, v12);
+            v04 = M0;
+            v04 = _mm_mul_epu32(v04, T14);
+            T2  = _mm_add_epi64(T2, v21);
+            v13 = M1;
+            v13 = _mm_mul_epu32(v13, T14);
+            T3  = _mm_add_epi64(T3, v31);
+            T15 = R21;
+            v22 = M2;
+            v22 = _mm_mul_epu32(v22, T14);
+            T4  = _mm_add_epi64(T4, v40);
+            v32 = M2;
+            v32 = _mm_mul_epu32(v32, T15);
+            T0  = _mm_add_epi64(T0, v04);
+            v41 = M3;
+            v41 = _mm_mul_epu32(v41, T15);
+            T1  = _mm_add_epi64(T1, v13);
+            v14 = M0;
+            v14 = _mm_mul_epu32(v14, T15);
+            T2  = _mm_add_epi64(T2, v22);
+            T14 = R22;
+            v23 = M1;
+            v23 = _mm_mul_epu32(v23, T15);
+            T3  = _mm_add_epi64(T3, v32);
+            v33 = M1;
+            v33 = _mm_mul_epu32(v33, T14);
+            T4  = _mm_add_epi64(T4, v41);
+            v42 = M2;
+            v42 = _mm_mul_epu32(v42, T14);
+            T1  = _mm_add_epi64(T1, v14);
+            T15 = R23;
+            v24 = M0;
+            v24 = _mm_mul_epu32(v24, T14);
+            T2  = _mm_add_epi64(T2, v23);
+            v34 = M0;
+            v34 = _mm_mul_epu32(v34, T15);
+            T3  = _mm_add_epi64(T3, v33);
+            v43 = M1;
+            v43 = _mm_mul_epu32(v43, T15);
+            T4  = _mm_add_epi64(T4, v42);
+            v44 = M0;
+            v44 = _mm_mul_epu32(v44, R24);
+            T2  = _mm_add_epi64(T2, v24);
+            T3  = _mm_add_epi64(T3, v34);
+            T4  = _mm_add_epi64(T4, v43);
+            T4  = _mm_add_epi64(T4, v44);
+
+            /* reduce */
+            C1 = _mm_srli_epi64(T0, 26);
+            C2 = _mm_srli_epi64(T3, 26);
+            T0 = _mm_and_si128(T0, MMASK);
+            T3 = _mm_and_si128(T3, MMASK);
+            T1 = _mm_add_epi64(T1, C1);
+            T4 = _mm_add_epi64(T4, C2);
+            C1 = _mm_srli_epi64(T1, 26);
+            C2 = _mm_srli_epi64(T4, 26);
+            T1 = _mm_and_si128(T1, MMASK);
+            T4 = _mm_and_si128(T4, MMASK);
+            T2 = _mm_add_epi64(T2, C1);
+            T0 = _mm_add_epi64(T0, _mm_mul_epu32(C2, FIVE));
+            C1 = _mm_srli_epi64(T2, 26);
+            C2 = _mm_srli_epi64(T0, 26);
+            T2 = _mm_and_si128(T2, MMASK);
+            T0 = _mm_and_si128(T0, MMASK);
+            T3 = _mm_add_epi64(T3, C1);
+            T1 = _mm_add_epi64(T1, C2);
+            C1 = _mm_srli_epi64(T3, 26);
+            T3 = _mm_and_si128(T3, MMASK);
+            T4 = _mm_add_epi64(T4, C1);
+
+            /* Final: H = (H*[r^4,r^4] + [Mx,My]*[r^2,r^2] + [Mx',My']) */
+            H0 = T0;
+            H1 = T1;
+            H2 = T2;
+            H3 = T3;
+            H4 = T4;
+
+            m += 64;
+            bytes -= 64;
+        }
+    }
+
+    if (bytes >= 32) {
+        xmmi v01, v02, v03, v04;
+        xmmi v11, v12, v13, v14;
+        xmmi v21, v22, v23, v24;
+        xmmi v31, v32, v33, v34;
+        xmmi v41, v42, v43, v44;
+        xmmi T14, T15;
+
+        /* H *= [r^2,r^2] */
+        T15 = S22;
+        T0  = H4;
+        T0  = _mm_mul_epu32(T0, S21);
+        v01 = H3;
+        v01 = _mm_mul_epu32(v01, T15);
+        T14 = S23;
+        T1  = H4;
+        T1  = _mm_mul_epu32(T1, T15);
+        v11 = H3;
+        v11 = _mm_mul_epu32(v11, T14);
+        T2  = H4;
+        T2  = _mm_mul_epu32(T2, T14);
+        T0  = _mm_add_epi64(T0, v01);
+        T15 = S24;
+        v02 = H2;
+        v02 = _mm_mul_epu32(v02, T14);
+        T3  = H4;
+        T3  = _mm_mul_epu32(T3, T15);
+        T1  = _mm_add_epi64(T1, v11);
+        v03 = H1;
+        v03 = _mm_mul_epu32(v03, T15);
+        v12 = H2;
+        v12 = _mm_mul_epu32(v12, T15);
+        T0  = _mm_add_epi64(T0, v02);
+        T14 = R20;
+        v21 = H3;
+        v21 = _mm_mul_epu32(v21, T15);
+        v31 = H3;
+        v31 = _mm_mul_epu32(v31, T14);
+        T0  = _mm_add_epi64(T0, v03);
+        T4  = H4;
+        T4  = _mm_mul_epu32(T4, T14);
+        T1  = _mm_add_epi64(T1, v12);
+        v04 = H0;
+        v04 = _mm_mul_epu32(v04, T14);
+        T2  = _mm_add_epi64(T2, v21);
+        v13 = H1;
+        v13 = _mm_mul_epu32(v13, T14);
+        T3  = _mm_add_epi64(T3, v31);
+        T15 = R21;
+        v22 = H2;
+        v22 = _mm_mul_epu32(v22, T14);
+        v32 = H2;
+        v32 = _mm_mul_epu32(v32, T15);
+        T0  = _mm_add_epi64(T0, v04);
+        v41 = H3;
+        v41 = _mm_mul_epu32(v41, T15);
+        T1  = _mm_add_epi64(T1, v13);
+        v14 = H0;
+        v14 = _mm_mul_epu32(v14, T15);
+        T2  = _mm_add_epi64(T2, v22);
+        T14 = R22;
+        v23 = H1;
+        v23 = _mm_mul_epu32(v23, T15);
+        T3  = _mm_add_epi64(T3, v32);
+        v33 = H1;
+        v33 = _mm_mul_epu32(v33, T14);
+        T4  = _mm_add_epi64(T4, v41);
+        v42 = H2;
+        v42 = _mm_mul_epu32(v42, T14);
+        T1  = _mm_add_epi64(T1, v14);
+        T15 = R23;
+        v24 = H0;
+        v24 = _mm_mul_epu32(v24, T14);
+        T2  = _mm_add_epi64(T2, v23);
+        v34 = H0;
+        v34 = _mm_mul_epu32(v34, T15);
+        T3  = _mm_add_epi64(T3, v33);
+        v43 = H1;
+        v43 = _mm_mul_epu32(v43, T15);
+        T4  = _mm_add_epi64(T4, v42);
+        v44 = H0;
+        v44 = _mm_mul_epu32(v44, R24);
+        T2  = _mm_add_epi64(T2, v24);
+        T3  = _mm_add_epi64(T3, v34);
+        T4  = _mm_add_epi64(T4, v43);
+        T4  = _mm_add_epi64(T4, v44);
+
+        /* H += [Mx,My] */
+        if (m) {
+            T5 = _mm_loadu_si128((const xmmi *) (const void *) (m + 0));
+            T6 = _mm_loadu_si128((const xmmi *) (const void *) (m + 16));
+            T7 = _mm_unpacklo_epi32(T5, T6);
+            T8 = _mm_unpackhi_epi32(T5, T6);
+            M0 = _mm_unpacklo_epi32(T7, _mm_setzero_si128());
+            M1 = _mm_unpackhi_epi32(T7, _mm_setzero_si128());
+            M2 = _mm_unpacklo_epi32(T8, _mm_setzero_si128());
+            M3 = _mm_unpackhi_epi32(T8, _mm_setzero_si128());
+            M1 = _mm_slli_epi64(M1, 6);
+            M2 = _mm_slli_epi64(M2, 12);
+            M3 = _mm_slli_epi64(M3, 18);
+            T0 = _mm_add_epi64(T0, M0);
+            T1 = _mm_add_epi64(T1, M1);
+            T2 = _mm_add_epi64(T2, M2);
+            T3 = _mm_add_epi64(T3, M3);
+            T4 = _mm_add_epi64(T4, HIBIT);
+        }
+
+        /* reduce */
+        C1 = _mm_srli_epi64(T0, 26);
+        C2 = _mm_srli_epi64(T3, 26);
+        T0 = _mm_and_si128(T0, MMASK);
+        T3 = _mm_and_si128(T3, MMASK);
+        T1 = _mm_add_epi64(T1, C1);
+        T4 = _mm_add_epi64(T4, C2);
+        C1 = _mm_srli_epi64(T1, 26);
+        C2 = _mm_srli_epi64(T4, 26);
+        T1 = _mm_and_si128(T1, MMASK);
+        T4 = _mm_and_si128(T4, MMASK);
+        T2 = _mm_add_epi64(T2, C1);
+        T0 = _mm_add_epi64(T0, _mm_mul_epu32(C2, FIVE));
+        C1 = _mm_srli_epi64(T2, 26);
+        C2 = _mm_srli_epi64(T0, 26);
+        T2 = _mm_and_si128(T2, MMASK);
+        T0 = _mm_and_si128(T0, MMASK);
+        T3 = _mm_add_epi64(T3, C1);
+        T1 = _mm_add_epi64(T1, C2);
+        C1 = _mm_srli_epi64(T3, 26);
+        T3 = _mm_and_si128(T3, MMASK);
+        T4 = _mm_add_epi64(T4, C1);
+
+        /* H = (H*[r^2,r^2] + [Mx,My]) */
+        H0 = T0;
+        H1 = T1;
+        H2 = T2;
+        H3 = T3;
+        H4 = T4;
+    }
+
+    if (m) {
+        T0 = _mm_shuffle_epi32(H0, _MM_SHUFFLE(0, 0, 2, 0));
+        T1 = _mm_shuffle_epi32(H1, _MM_SHUFFLE(0, 0, 2, 0));
+        T2 = _mm_shuffle_epi32(H2, _MM_SHUFFLE(0, 0, 2, 0));
+        T3 = _mm_shuffle_epi32(H3, _MM_SHUFFLE(0, 0, 2, 0));
+        T4 = _mm_shuffle_epi32(H4, _MM_SHUFFLE(0, 0, 2, 0));
+        T0 = _mm_unpacklo_epi64(T0, T1);
+        T1 = _mm_unpacklo_epi64(T2, T3);
+        _mm_storeu_si128((xmmi *) (void *) &st->H.hh[0], T0);
+        _mm_storeu_si128((xmmi *) (void *) &st->H.hh[4], T1);
+        _mm_storel_epi64((xmmi *) (void *) &st->H.hh[8], T4);
+    } else {
+        uint32_t t0, t1, t2, t3, t4, b;
+        uint64_t h0, h1, h2, g0, g1, g2, c, nc;
+
+        /* H = H[0]+H[1] */
+        T0 = H0;
+        T1 = H1;
+        T2 = H2;
+        T3 = H3;
+        T4 = H4;
+
+        T0 = _mm_add_epi64(T0, _mm_srli_si128(T0, 8));
+        T1 = _mm_add_epi64(T1, _mm_srli_si128(T1, 8));
+        T2 = _mm_add_epi64(T2, _mm_srli_si128(T2, 8));
+        T3 = _mm_add_epi64(T3, _mm_srli_si128(T3, 8));
+        T4 = _mm_add_epi64(T4, _mm_srli_si128(T4, 8));
+
+        t0 = _mm_cvtsi128_si32(T0);
+        b  = (t0 >> 26);
+        t0 &= 0x3ffffff;
+        t1 = _mm_cvtsi128_si32(T1) + b;
+        b  = (t1 >> 26);
+        t1 &= 0x3ffffff;
+        t2 = _mm_cvtsi128_si32(T2) + b;
+        b  = (t2 >> 26);
+        t2 &= 0x3ffffff;
+        t3 = _mm_cvtsi128_si32(T3) + b;
+        b  = (t3 >> 26);
+        t3 &= 0x3ffffff;
+        t4 = _mm_cvtsi128_si32(T4) + b;
+
+        /* everything except t4 is in range, so this is all safe */
+        h0 = (((uint64_t) t0) | ((uint64_t) t1 << 26)) & 0xfffffffffffull;
+        h1 = (((uint64_t) t1 >> 18) | ((uint64_t) t2 << 8) |
+              ((uint64_t) t3 << 34)) &
+             0xfffffffffffull;
+        h2 = (((uint64_t) t3 >> 10) | ((uint64_t) t4 << 16));
+
+        c = (h2 >> 42);
+        h2 &= 0x3ffffffffff;
+        h0 += c * 5;
+        c = (h0 >> 44);
+        h0 &= 0xfffffffffff;
+        h1 += c;
+        c = (h1 >> 44);
+        h1 &= 0xfffffffffff;
+        h2 += c;
+        c = (h2 >> 42);
+        h2 &= 0x3ffffffffff;
+        h0 += c * 5;
+        c = (h0 >> 44);
+        h0 &= 0xfffffffffff;
+        h1 += c;
+
+        g0 = h0 + 5;
+        c  = (g0 >> 44);
+        g0 &= 0xfffffffffff;
+        g1 = h1 + c;
+        c  = (g1 >> 44);
+        g1 &= 0xfffffffffff;
+        g2 = h2 + c - ((uint64_t) 1 << 42);
+
+        c  = (g2 >> 63) - 1;
+        nc = ~c;
+        h0 = (h0 & nc) | (g0 & c);
+        h1 = (h1 & nc) | (g1 & c);
+        h2 = (h2 & nc) | (g2 & c);
+
+        st->H.h[0] = h0;
+        st->H.h[1] = h1;
+        st->H.h[2] = h2;
+    }
+}
+
+static void
+poly1305_update(poly1305_state_internal_t *st, const unsigned char *m,
+                unsigned long long bytes)
+{
+    unsigned long long i;
+
+    /* handle leftover */
+    if (st->leftover) {
+        unsigned long long want = (poly1305_block_size - st->leftover);
+
+        if (want > bytes) {
+            want = bytes;
+        }
+        for (i = 0; i < want; i++) {
+            st->buffer[st->leftover + i] = m[i];
+        }
+        bytes -= want;
+        m += want;
+        st->leftover += want;
+        if (st->leftover < poly1305_block_size) {
+            return;
+        }
+        poly1305_blocks(st, st->buffer, poly1305_block_size);
+        st->leftover = 0;
+    }
+
+    /* process full blocks */
+    if (bytes >= poly1305_block_size) {
+        unsigned long long want = (bytes & ~(poly1305_block_size - 1));
+
+        poly1305_blocks(st, m, want);
+        m += want;
+        bytes -= want;
+    }
+
+    /* store leftover */
+    if (bytes) {
+        for (i = 0; i < bytes; i++) {
+            st->buffer[st->leftover + i] = m[i];
+        }
+        st->leftover += bytes;
+    }
+}
+
+static POLY1305_NOINLINE void
+poly1305_finish_ext(poly1305_state_internal_t *st, const unsigned char *m,
+                    unsigned long long leftover, unsigned char mac[16])
+{
+    uint64_t h0, h1, h2;
+
+    if (leftover) {
+        CRYPTO_ALIGN(16) unsigned char final[32] = { 0 };
+
+        poly1305_block_copy31(final, m, leftover);
+        if (leftover != 16) {
+            final[leftover] = 1;
+        }
+        st->flags |=
+            (leftover >= 16) ? poly1305_final_shift8 : poly1305_final_shift16;
+        poly1305_blocks(st, final, 32);
+    }
+
+    if (st->flags & poly1305_started) {
+        /* finalize, H *= [r^2,r], or H *= [r,1] */
+        if (!leftover || (leftover > 16)) {
+            st->flags |= poly1305_final_r2_r;
+        } else {
+            st->flags |= poly1305_final_r_1;
+        }
+        poly1305_blocks(st, NULL, 32);
+    }
+
+    h0 = st->H.h[0];
+    h1 = st->H.h[1];
+    h2 = st->H.h[2];
+
+    /* pad */
+    h0 = ((h0) | (h1 << 44));
+    h1 = ((h1 >> 20) | (h2 << 24));
+#ifdef HAVE_AMD64_ASM
+    __asm__ __volatile__(
+        "addq %2, %0 ;\n"
+        "adcq %3, %1 ;\n"
+        : "+r"(h0), "+r"(h1)
+        : "r"(st->pad[0]), "r"(st->pad[1])
+        : "flags", "cc");
+#else
+    {
+        uint128_t h;
+
+        memcpy(&h, &st->pad[0], 16);
+        h += ((uint128_t) h1 << 64) | h0;
+        h0 = (uint64_t) h;
+        h1 = (uint64_t)(h >> 64);
+    }
+#endif
+    _mm_storeu_si128((xmmi *) (void *) st + 0, _mm_setzero_si128());
+    _mm_storeu_si128((xmmi *) (void *) st + 1, _mm_setzero_si128());
+    _mm_storeu_si128((xmmi *) (void *) st + 2, _mm_setzero_si128());
+    _mm_storeu_si128((xmmi *) (void *) st + 3, _mm_setzero_si128());
+    _mm_storeu_si128((xmmi *) (void *) st + 4, _mm_setzero_si128());
+    _mm_storeu_si128((xmmi *) (void *) st + 5, _mm_setzero_si128());
+    _mm_storeu_si128((xmmi *) (void *) st + 6, _mm_setzero_si128());
+    _mm_storeu_si128((xmmi *) (void *) st + 7, _mm_setzero_si128());
+
+    memcpy(&mac[0], &h0, 8);
+    memcpy(&mac[8], &h1, 8);
+
+    sodium_memzero((void *) st, sizeof *st);
+}
+
+static void
+poly1305_finish(poly1305_state_internal_t *st, unsigned char mac[16])
+{
+    poly1305_finish_ext(st, st->buffer, st->leftover, mac);
+}
+
+static int
+crypto_onetimeauth_poly1305_sse2_init(crypto_onetimeauth_poly1305_state *state,
+                                      const unsigned char *key)
+{
+    COMPILER_ASSERT(sizeof(crypto_onetimeauth_poly1305_state) >=
+                    sizeof(poly1305_state_internal_t));
+    poly1305_init_ext((poly1305_state_internal_t *) (void *) state, key, 0U);
+
+    return 0;
+}
+
+static int
+crypto_onetimeauth_poly1305_sse2_update(
+    crypto_onetimeauth_poly1305_state *state, const unsigned char *in,
+    unsigned long long inlen)
+{
+    poly1305_update((poly1305_state_internal_t *) (void *) state, in, inlen);
+
+    return 0;
+}
+
+static int
+crypto_onetimeauth_poly1305_sse2_final(crypto_onetimeauth_poly1305_state *state,
+                                       unsigned char *out)
+{
+    poly1305_finish((poly1305_state_internal_t *) (void *) state, out);
+
+    return 0;
+}
+
+static int
+crypto_onetimeauth_poly1305_sse2(unsigned char *out, const unsigned char *m,
+                                 unsigned long long   inlen,
+                                 const unsigned char *key)
+{
+    CRYPTO_ALIGN(64) poly1305_state_internal_t st;
+    unsigned long long                         blocks;
+
+    poly1305_init_ext(&st, key, inlen);
+    blocks = inlen & ~31;
+    if (blocks > 0) {
+        poly1305_blocks(&st, m, blocks);
+        m += blocks;
+        inlen -= blocks;
+    }
+    poly1305_finish_ext(&st, m, inlen, out);
+
+    return 0;
+}
+
+static int
+crypto_onetimeauth_poly1305_sse2_verify(const unsigned char *h,
+                                        const unsigned char *in,
+                                        unsigned long long   inlen,
+                                        const unsigned char *k)
+{
+    unsigned char correct[16];
+
+    crypto_onetimeauth_poly1305_sse2(correct, in, inlen, k);
+
+    return crypto_verify_16(h, correct);
+}
+
+struct crypto_onetimeauth_poly1305_implementation
+    crypto_onetimeauth_poly1305_sse2_implementation = {
+        SODIUM_C99(.onetimeauth =) crypto_onetimeauth_poly1305_sse2,
+        SODIUM_C99(.onetimeauth_verify =)
+            crypto_onetimeauth_poly1305_sse2_verify,
+        SODIUM_C99(.onetimeauth_init =) crypto_onetimeauth_poly1305_sse2_init,
+        SODIUM_C99(.onetimeauth_update =)
+            crypto_onetimeauth_poly1305_sse2_update,
+        SODIUM_C99(.onetimeauth_final =) crypto_onetimeauth_poly1305_sse2_final
+    };
+
+#endif
diff --git a/vendor/external/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.h b/vendor/external/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.h
@@ -0,0 +1,12 @@
+#ifndef poly1305_sse2_H
+#define poly1305_sse2_H
+
+#include <stddef.h>
+
+#include "crypto_onetimeauth_poly1305.h"
+#include "external/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.h"
+
+extern struct crypto_onetimeauth_poly1305_implementation
+    crypto_onetimeauth_poly1305_sse2_implementation;
+
+#endif /* poly1305_sse2_H */
diff --git a/vendor/external/libsodium/crypto_scalarmult/crypto_scalarmult.c b/vendor/external/libsodium/crypto_scalarmult/crypto_scalarmult.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/crypto_scalarmult.c
@@ -0,0 +1,33 @@
+
+#include "crypto_scalarmult.h"
+
+const char *
+crypto_scalarmult_primitive(void)
+{
+    return crypto_scalarmult_PRIMITIVE;
+}
+
+int
+crypto_scalarmult_base(unsigned char *q, const unsigned char *n)
+{
+    return crypto_scalarmult_curve25519_base(q, n);
+}
+
+int
+crypto_scalarmult(unsigned char *q, const unsigned char *n,
+                  const unsigned char *p)
+{
+    return crypto_scalarmult_curve25519(q, n, p);
+}
+
+size_t
+crypto_scalarmult_bytes(void)
+{
+    return crypto_scalarmult_BYTES;
+}
+
+size_t
+crypto_scalarmult_scalarbytes(void)
+{
+    return crypto_scalarmult_SCALARBYTES;
+}
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c b/vendor/external/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c
@@ -0,0 +1,182 @@
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "../scalarmult_curve25519.h"
+#include "export.h"
+#include "private/ed25519_ref10.h"
+#include "utils.h"
+#include "x25519_ref10.h"
+
+/*
+ * Reject small order points early to mitigate the implications of
+ * unexpected optimizations that would affect the ref10 code.
+ * See https://eprint.iacr.org/2017/806.pdf for reference.
+ */
+static int
+has_small_order(const unsigned char s[32])
+{
+    CRYPTO_ALIGN(16)
+    static const unsigned char blacklist[][32] = {
+        /* 0 (order 4) */
+        { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+        /* 1 (order 1) */
+        { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+        /* 325606250916557431795983626356110631294008115727848805560023387167927233504
+           (order 8) */
+        { 0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3,
+          0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32,
+          0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00 },
+        /* 39382357235489614581723060781553021112529911719440698176882885853963445705823
+           (order 8) */
+        { 0x5f, 0x9c, 0x95, 0xbc, 0xa3, 0x50, 0x8c, 0x24, 0xb1, 0xd0, 0xb1,
+          0x55, 0x9c, 0x83, 0xef, 0x5b, 0x04, 0x44, 0x5c, 0xc4, 0x58, 0x1c,
+          0x8e, 0x86, 0xd8, 0x22, 0x4e, 0xdd, 0xd0, 0x9f, 0x11, 0x57 },
+        /* p-1 (order 2) */
+        { 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f },
+        /* p (=0, order 4) */
+        { 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f },
+        /* p+1 (=1, order 1) */
+        { 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+          0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }
+    };
+    unsigned char c[7] = { 0 };
+    unsigned int  k;
+    size_t        i, j;
+
+    COMPILER_ASSERT(7 == sizeof blacklist / sizeof blacklist[0]);
+    for (j = 0; j < 31; j++) {
+        for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
+            c[i] |= s[j] ^ blacklist[i][j];
+        }
+    }
+    for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
+        c[i] |= (s[j] & 0x7f) ^ blacklist[i][j];
+    }
+    k = 0;
+    for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
+        k |= (c[i] - 1);
+    }
+    return (int) ((k >> 8) & 1);
+}
+
+static int
+crypto_scalarmult_curve25519_ref10(unsigned char *q,
+                                   const unsigned char *n,
+                                   const unsigned char *p)
+{
+    unsigned char  t[32];
+    unsigned int   i;
+    fe25519        x1;
+    fe25519        x2;
+    fe25519        z2;
+    fe25519        x3;
+    fe25519        z3;
+    fe25519        tmp0;
+    fe25519        tmp1;
+    int            pos;
+    unsigned int   swap;
+    unsigned int   b;
+
+    if (has_small_order(p)) {
+        return -1;
+    }
+    for (i = 0; i < 32; i++) {
+        t[i] = n[i];
+    }
+    t[0] &= 248;
+    t[31] &= 127;
+    t[31] |= 64;
+    fe25519_frombytes(x1, p);
+    fe25519_1(x2);
+    fe25519_0(z2);
+    fe25519_copy(x3, x1);
+    fe25519_1(z3);
+
+    swap = 0;
+    for (pos = 254; pos >= 0; --pos) {
+        b = t[pos / 8] >> (pos & 7);
+        b &= 1;
+        swap ^= b;
+        fe25519_cswap(x2, x3, swap);
+        fe25519_cswap(z2, z3, swap);
+        swap = b;
+        fe25519_sub(tmp0, x3, z3);
+        fe25519_sub(tmp1, x2, z2);
+        fe25519_add(x2, x2, z2);
+        fe25519_add(z2, x3, z3);
+        fe25519_mul(z3, tmp0, x2);
+        fe25519_mul(z2, z2, tmp1);
+        fe25519_sq(tmp0, tmp1);
+        fe25519_sq(tmp1, x2);
+        fe25519_add(x3, z3, z2);
+        fe25519_sub(z2, z3, z2);
+        fe25519_mul(x2, tmp1, tmp0);
+        fe25519_sub(tmp1, tmp1, tmp0);
+        fe25519_sq(z2, z2);
+        fe25519_mul32(z3, tmp1, 121666);
+        fe25519_sq(x3, x3);
+        fe25519_add(tmp0, tmp0, z3);
+        fe25519_mul(z3, x1, z2);
+        fe25519_mul(z2, tmp1, tmp0);
+    }
+    fe25519_cswap(x2, x3, swap);
+    fe25519_cswap(z2, z3, swap);
+
+    fe25519_invert(z2, z2);
+    fe25519_mul(x2, x2, z2);
+    fe25519_tobytes(q, x2);
+
+    sodium_memzero(t, sizeof t);
+
+    return 0;
+}
+
+static void
+edwards_to_montgomery(fe25519 montgomeryX, const fe25519 edwardsY, const fe25519 edwardsZ)
+{
+    fe25519 tempX;
+    fe25519 tempZ;
+
+    fe25519_add(tempX, edwardsZ, edwardsY);
+    fe25519_sub(tempZ, edwardsZ, edwardsY);
+    fe25519_invert(tempZ, tempZ);
+    fe25519_mul(montgomeryX, tempX, tempZ);
+}
+
+static int
+crypto_scalarmult_curve25519_ref10_base(unsigned char *q,
+                                        const unsigned char *n)
+{
+    unsigned char *t = q;
+    ge25519_p3     A;
+    fe25519        pk;
+    unsigned int   i;
+
+    for (i = 0; i < 32; i++) {
+        t[i] = n[i];
+    }
+    t[0] &= 248;
+    t[31] &= 127;
+    t[31] |= 64;
+    ge25519_scalarmult_base(&A, t);
+    edwards_to_montgomery(pk, A.Y, A.Z);
+    fe25519_tobytes(q, pk);
+
+    return 0;
+}
+
+struct crypto_scalarmult_curve25519_implementation
+    crypto_scalarmult_curve25519_ref10_implementation = {
+        SODIUM_C99(.mult =) crypto_scalarmult_curve25519_ref10,
+        SODIUM_C99(.mult_base =) crypto_scalarmult_curve25519_ref10_base
+    };
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.h b/vendor/external/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.h
@@ -0,0 +1,10 @@
+#ifndef x25519_ref10_H
+#define x25519_ref10_H
+
+#include "crypto_scalarmult_curve25519.h"
+#include "external/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.h"
+
+extern struct crypto_scalarmult_curve25519_implementation
+    crypto_scalarmult_curve25519_ref10_implementation;
+
+#endif
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h
@@ -0,0 +1,20 @@
+#ifndef consts_namespace_H
+#define consts_namespace_H
+
+#define v0_0 crypto_scalarmult_curve25519_sandy2x_v0_0
+#define v1_0 crypto_scalarmult_curve25519_sandy2x_v1_0
+#define v2_1 crypto_scalarmult_curve25519_sandy2x_v2_1
+#define v9_0 crypto_scalarmult_curve25519_sandy2x_v9_0
+#define v9_9 crypto_scalarmult_curve25519_sandy2x_v9_9
+#define v19_19 crypto_scalarmult_curve25519_sandy2x_v19_19
+#define v38_1 crypto_scalarmult_curve25519_sandy2x_v38_1
+#define v38_38 crypto_scalarmult_curve25519_sandy2x_v38_38
+#define v121666_121666 crypto_scalarmult_curve25519_sandy2x_v121666_121666
+#define m25 crypto_scalarmult_curve25519_sandy2x_m25
+#define m26 crypto_scalarmult_curve25519_sandy2x_m26
+#define subc0 crypto_scalarmult_curve25519_sandy2x_subc0
+#define subc2 crypto_scalarmult_curve25519_sandy2x_subc2
+#define REDMASK51 crypto_scalarmult_curve25519_sandy2x_REDMASK51
+
+#endif /* ifndef consts_namespace_H */
+
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c
@@ -0,0 +1,71 @@
+/*
+   This file is adapted from ref10/scalarmult.c:
+   The code for Mongomery ladder is replace by the ladder assembly function;
+   Inversion is done in the same way as amd64-51/.
+   (fe is first converted into fe51 after Mongomery ladder)
+*/
+
+#include <stddef.h>
+
+#ifdef HAVE_AVX_ASM
+
+#include "utils.h"
+#include "curve25519_sandy2x.h"
+#include "../scalarmult_curve25519.h"
+#include "fe.h"
+#include "fe51.h"
+#include "ladder.h"
+
+#define x1 var[0]
+#define x2 var[1]
+#define z2 var[2]
+
+static int
+crypto_scalarmult_curve25519_sandy2x(unsigned char *q, const unsigned char *n,
+                                     const unsigned char *p)
+{
+    unsigned char  t[32];
+    fe             var[3];
+    fe51           x_51;
+    fe51           z_51;
+    unsigned int   i;
+
+    for (i = 0; i < 32; i++) {
+        t[i] = n[i];
+    }
+    t[0] &= 248;
+    t[31] &= 127;
+    t[31] |= 64;
+
+    fe_frombytes(x1, p);
+
+    ladder(var, t);
+
+    z_51.v[0] = (z2[1] << 26) + z2[0];
+    z_51.v[1] = (z2[3] << 26) + z2[2];
+    z_51.v[2] = (z2[5] << 26) + z2[4];
+    z_51.v[3] = (z2[7] << 26) + z2[6];
+    z_51.v[4] = (z2[9] << 26) + z2[8];
+
+    x_51.v[0] = (x2[1] << 26) + x2[0];
+    x_51.v[1] = (x2[3] << 26) + x2[2];
+    x_51.v[2] = (x2[5] << 26) + x2[4];
+    x_51.v[3] = (x2[7] << 26) + x2[6];
+    x_51.v[4] = (x2[9] << 26) + x2[8];
+
+    fe51_invert(&z_51, &z_51);
+    fe51_mul(&x_51, &x_51, &z_51);
+    fe51_pack(q, &x_51);
+
+    sodium_memzero(t, sizeof t);
+
+    return 0;
+}
+
+struct crypto_scalarmult_curve25519_implementation
+crypto_scalarmult_curve25519_sandy2x_implementation = {
+    SODIUM_C99(.mult = ) crypto_scalarmult_curve25519_sandy2x,
+    SODIUM_C99(.mult_base = ) NULL
+};
+
+#endif
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.h b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.h
@@ -0,0 +1,9 @@
+#ifndef curve25519_sandy2x_H
+#define curve25519_sandy2x_H
+
+#include "crypto_scalarmult_curve25519.h"
+
+extern struct crypto_scalarmult_curve25519_implementation
+    crypto_scalarmult_curve25519_sandy2x_implementation;
+
+#endif
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h
@@ -0,0 +1,26 @@
+/*
+   This file is adapted from ref10/fe.h:
+   All the redundant functions are removed.
+*/
+
+#ifndef fe_H
+#define fe_H
+
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef uint64_t fe[10];
+
+/*
+fe means field element.
+Here the field is \Z/(2^255-19).
+An element t, entries t[0]...t[9], represents the integer
+t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9].
+Bounds on each t[i] vary depending on context.
+*/
+
+#define fe_frombytes crypto_scalarmult_curve25519_sandy2x_fe_frombytes
+
+extern void fe_frombytes(fe, const unsigned char *);
+
+#endif
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h
@@ -0,0 +1,35 @@
+/*
+   This file is adapted from amd64-51/fe25519.h:
+   'fe25519' is renamed as 'fe51';
+   All the redundant functions are removed;
+   New function fe51_nsquare is introduced.
+*/
+
+#ifndef fe51_H
+#define fe51_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "fe51_namespace.h"
+
+typedef struct
+{
+    uint64_t v[5];
+}
+fe51;
+
+extern void fe51_pack(unsigned char *, const fe51 *);
+extern void fe51_mul(fe51 *, const fe51 *, const fe51 *);
+extern void fe51_nsquare(fe51 *, const fe51 *, int);
+extern void fe51_invert(fe51 *, const fe51 *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c
@@ -0,0 +1,58 @@
+/*
+   This file is adapted from amd64-51/fe25519_invert.c:
+   Loops of squares are replaced by nsquares for better performance.
+*/
+
+#include "fe51.h"
+
+#ifdef HAVE_AVX_ASM
+
+#define fe51_square(x, y) fe51_nsquare(x, y, 1)
+
+void
+fe51_invert(fe51 *r, const fe51 *x)
+{
+    fe51 z2;
+    fe51 z9;
+    fe51 z11;
+    fe51 z2_5_0;
+    fe51 z2_10_0;
+    fe51 z2_20_0;
+    fe51 z2_50_0;
+    fe51 z2_100_0;
+    fe51 t;
+
+    /* 2 */ fe51_square(&z2,x);
+    /* 4 */ fe51_square(&t,&z2);
+    /* 8 */ fe51_square(&t,&t);
+    /* 9 */ fe51_mul(&z9,&t,x);
+    /* 11 */ fe51_mul(&z11,&z9,&z2);
+    /* 22 */ fe51_square(&t,&z11);
+    /* 2^5 - 2^0 = 31 */ fe51_mul(&z2_5_0,&t,&z9);
+
+    /* 2^10 - 2^5 */ fe51_nsquare(&t,&z2_5_0, 5);
+    /* 2^10 - 2^0 */ fe51_mul(&z2_10_0,&t,&z2_5_0);
+
+    /* 2^20 - 2^10 */ fe51_nsquare(&t,&z2_10_0, 10);
+    /* 2^20 - 2^0 */ fe51_mul(&z2_20_0,&t,&z2_10_0);
+
+    /* 2^40 - 2^20 */ fe51_nsquare(&t,&z2_20_0, 20);
+    /* 2^40 - 2^0 */ fe51_mul(&t,&t,&z2_20_0);
+
+    /* 2^50 - 2^10 */ fe51_nsquare(&t,&t,10);
+    /* 2^50 - 2^0 */ fe51_mul(&z2_50_0,&t,&z2_10_0);
+
+    /* 2^100 - 2^50 */ fe51_nsquare(&t,&z2_50_0, 50);
+    /* 2^100 - 2^0 */ fe51_mul(&z2_100_0,&t,&z2_50_0);
+
+    /* 2^200 - 2^100 */ fe51_nsquare(&t,&z2_100_0, 100);
+    /* 2^200 - 2^0 */ fe51_mul(&t,&t,&z2_100_0);
+
+    /* 2^250 - 2^50 */ fe51_nsquare(&t,&t, 50);
+    /* 2^250 - 2^0 */ fe51_mul(&t,&t,&z2_50_0);
+
+    /* 2^255 - 2^5 */ fe51_nsquare(&t,&t,5);
+    /* 2^255 - 21 */ fe51_mul(r,&t,&z11);
+}
+
+#endif
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_namespace.h b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_namespace.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_namespace.h
@@ -0,0 +1,16 @@
+#ifndef fe51_namespace_H
+#define fe51_namespace_H
+
+#define  fe51              crypto_scalarmult_curve25519_sandy2x_fe51
+#define _fe51             _crypto_scalarmult_curve25519_sandy2x_fe51
+#define  fe51_pack         crypto_scalarmult_curve25519_sandy2x_fe51_pack
+#define _fe51_pack        _crypto_scalarmult_curve25519_sandy2x_fe51_pack
+#define  fe51_mul          crypto_scalarmult_curve25519_sandy2x_fe51_mul
+#define _fe51_mul         _crypto_scalarmult_curve25519_sandy2x_fe51_mul
+#define  fe51_nsquare      crypto_scalarmult_curve25519_sandy2x_fe51_nsquare
+#define _fe51_nsquare     _crypto_scalarmult_curve25519_sandy2x_fe51_nsquare
+
+#define  fe51_invert       crypto_scalarmult_curve25519_sandy2x_fe51_invert
+
+#endif /* ifndef fe51_namespace_H */
+
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c
@@ -0,0 +1,78 @@
+/*
+   This file is basically ref10/fe_frombytes.h.
+*/
+
+#include "fe.h"
+
+#ifdef HAVE_AVX_ASM
+
+static uint64_t
+load_3(const unsigned char *in)
+{
+    uint64_t result;
+    result = (uint64_t) in[0];
+    result |= ((uint64_t) in[1]) << 8;
+    result |= ((uint64_t) in[2]) << 16;
+    return result;
+}
+
+static uint64_t
+load_4(const unsigned char *in)
+{
+    uint64_t result;
+    result = (uint64_t) in[0];
+    result |= ((uint64_t) in[1]) << 8;
+    result |= ((uint64_t) in[2]) << 16;
+    result |= ((uint64_t) in[3]) << 24;
+    return result;
+}
+
+void
+fe_frombytes(fe h, const unsigned char *s)
+{
+    uint64_t h0 = load_4(s);
+    uint64_t h1 = load_3(s + 4) << 6;
+    uint64_t h2 = load_3(s + 7) << 5;
+    uint64_t h3 = load_3(s + 10) << 3;
+    uint64_t h4 = load_3(s + 13) << 2;
+    uint64_t h5 = load_4(s + 16);
+    uint64_t h6 = load_3(s + 20) << 7;
+    uint64_t h7 = load_3(s + 23) << 5;
+    uint64_t h8 = load_3(s + 26) << 4;
+    uint64_t h9 = (load_3(s + 29) & 8388607) << 2;
+    uint64_t carry0;
+    uint64_t carry1;
+    uint64_t carry2;
+    uint64_t carry3;
+    uint64_t carry4;
+    uint64_t carry5;
+    uint64_t carry6;
+    uint64_t carry7;
+    uint64_t carry8;
+    uint64_t carry9;
+
+    carry9 = h9 >> 25; h0 += carry9 * 19; h9 &= 0x1FFFFFF;
+    carry1 = h1 >> 25; h2 += carry1; h1 &= 0x1FFFFFF;
+    carry3 = h3 >> 25; h4 += carry3; h3 &= 0x1FFFFFF;
+    carry5 = h5 >> 25; h6 += carry5; h5 &= 0x1FFFFFF;
+    carry7 = h7 >> 25; h8 += carry7; h7 &= 0x1FFFFFF;
+
+    carry0 = h0 >> 26; h1 += carry0; h0 &= 0x3FFFFFF;
+    carry2 = h2 >> 26; h3 += carry2; h2 &= 0x3FFFFFF;
+    carry4 = h4 >> 26; h5 += carry4; h4 &= 0x3FFFFFF;
+    carry6 = h6 >> 26; h7 += carry6; h6 &= 0x3FFFFFF;
+    carry8 = h8 >> 26; h9 += carry8; h8 &= 0x3FFFFFF;
+
+    h[0] = h0;
+    h[1] = h1;
+    h[2] = h2;
+    h[3] = h3;
+    h[4] = h4;
+    h[5] = h5;
+    h[6] = h6;
+    h[7] = h7;
+    h[8] = h8;
+    h[9] = h9;
+}
+
+#endif
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.h b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.h
@@ -0,0 +1,18 @@
+#ifndef ladder_H
+#define ladder_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "fe.h"
+#include "ladder_namespace.h"
+
+extern void ladder(fe *, const unsigned char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ifndef ladder_H */
+
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h
@@ -0,0 +1,8 @@
+#ifndef ladder_namespace_H
+#define ladder_namespace_H
+
+#define  ladder  crypto_scalarmult_curve25519_sandy2x_ladder
+#define _ladder _crypto_scalarmult_curve25519_sandy2x_ladder
+
+#endif /* ifndef ladder_namespace_H */
+
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c b/vendor/external/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c
@@ -0,0 +1,60 @@
+
+#include "crypto_scalarmult_curve25519.h"
+#include "private/implementations.h"
+#include "scalarmult_curve25519.h"
+#include "runtime.h"
+
+#ifdef HAVE_AVX_ASM
+# include "sandy2x/curve25519_sandy2x.h"
+#endif
+#include "ref10/x25519_ref10.h"
+static const crypto_scalarmult_curve25519_implementation *implementation =
+    &crypto_scalarmult_curve25519_ref10_implementation;
+
+int
+crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
+                             const unsigned char *p)
+{
+    size_t                 i;
+    volatile unsigned char d = 0;
+
+    if (implementation->mult(q, n, p) != 0) {
+        return -1; /* LCOV_EXCL_LINE */
+    }
+    for (i = 0; i < crypto_scalarmult_curve25519_BYTES; i++) {
+        d |= q[i];
+    }
+    return -(1 & ((d - 1) >> 8));
+}
+
+int
+crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n)
+{
+    return crypto_scalarmult_curve25519_ref10_implementation
+        .mult_base(q, n);
+}
+
+size_t
+crypto_scalarmult_curve25519_bytes(void)
+{
+    return crypto_scalarmult_curve25519_BYTES;
+}
+
+size_t
+crypto_scalarmult_curve25519_scalarbytes(void)
+{
+    return crypto_scalarmult_curve25519_SCALARBYTES;
+}
+
+int
+_crypto_scalarmult_curve25519_pick_best_implementation(void)
+{
+    implementation = &crypto_scalarmult_curve25519_ref10_implementation;
+
+#ifdef HAVE_AVX_ASM
+    if (sodium_runtime_has_avx()) {
+        implementation = &crypto_scalarmult_curve25519_sandy2x_implementation;
+    }
+#endif
+    return 0;
+}
diff --git a/vendor/external/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.h b/vendor/external/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.h
@@ -0,0 +1,11 @@
+
+#ifndef scalarmult_poly1305_H
+#define scalarmult_poly1305_H
+
+typedef struct crypto_scalarmult_curve25519_implementation {
+    int (*mult)(unsigned char *q, const unsigned char *n,
+                const unsigned char *p);
+    int (*mult_base)(unsigned char *q, const unsigned char *n);
+} crypto_scalarmult_curve25519_implementation;
+
+#endif
diff --git a/vendor/external/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c b/vendor/external/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c
@@ -0,0 +1,121 @@
+
+#include <string.h>
+
+#include "crypto_scalarmult_ed25519.h"
+#include "private/ed25519_ref10.h"
+#include "utils.h"
+
+static int
+_crypto_scalarmult_ed25519_is_inf(const unsigned char s[32])
+{
+    unsigned char c;
+    unsigned int  i;
+
+    c = s[0] ^ 0x01;
+    for (i = 1; i < 31; i++) {
+        c |= s[i];
+    }
+    c |= s[31] & 0x7f;
+
+    return ((((unsigned int) c) - 1U) >> 8) & 1;
+}
+
+static inline void
+_crypto_scalarmult_ed25519_clamp(unsigned char k[32])
+{
+    k[0] &= 248;
+    k[31] |= 64;
+}
+
+static int
+_crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n,
+                           const unsigned char *p, const int clamp)
+{
+    unsigned char *t = q;
+    ge25519_p3     Q;
+    ge25519_p3     P;
+    unsigned int   i;
+
+    if (ge25519_is_canonical(p) == 0 || ge25519_has_small_order(p) != 0 ||
+        ge25519_frombytes(&P, p) != 0 || ge25519_is_on_main_subgroup(&P) == 0) {
+        return -1;
+    }
+    for (i = 0; i < 32; ++i) {
+        t[i] = n[i];
+    }
+    if (clamp != 0) {
+        _crypto_scalarmult_ed25519_clamp(t);
+    }
+    t[31] &= 127;
+
+    ge25519_scalarmult(&Q, t, &P);
+    ge25519_p3_tobytes(q, &Q);
+    if (_crypto_scalarmult_ed25519_is_inf(q) != 0 || sodium_is_zero(n, 32)) {
+        return -1;
+    }
+    return 0;
+}
+
+int
+crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n,
+                          const unsigned char *p)
+{
+    return _crypto_scalarmult_ed25519(q, n, p, 1);
+}
+
+int
+crypto_scalarmult_ed25519_noclamp(unsigned char *q, const unsigned char *n,
+                                  const unsigned char *p)
+{
+    return _crypto_scalarmult_ed25519(q, n, p, 0);
+}
+
+static int
+_crypto_scalarmult_ed25519_base(unsigned char *q,
+                                const unsigned char *n, const int clamp)
+{
+    unsigned char *t = q;
+    ge25519_p3     Q;
+    unsigned int   i;
+
+    for (i = 0; i < 32; ++i) {
+        t[i] = n[i];
+    }
+    if (clamp != 0) {
+        _crypto_scalarmult_ed25519_clamp(t);
+    }
+    t[31] &= 127;
+
+    ge25519_scalarmult_base(&Q, t);
+    ge25519_p3_tobytes(q, &Q);
+    if (_crypto_scalarmult_ed25519_is_inf(q) != 0 || sodium_is_zero(n, 32)) {
+        return -1;
+    }
+    return 0;
+}
+
+int
+crypto_scalarmult_ed25519_base(unsigned char *q,
+                               const unsigned char *n)
+{
+    return _crypto_scalarmult_ed25519_base(q, n, 1);
+}
+
+int
+crypto_scalarmult_ed25519_base_noclamp(unsigned char *q,
+                                       const unsigned char *n)
+{
+    return _crypto_scalarmult_ed25519_base(q, n, 0);
+}
+
+size_t
+crypto_scalarmult_ed25519_bytes(void)
+{
+    return crypto_scalarmult_ed25519_BYTES;
+}
+
+size_t
+crypto_scalarmult_ed25519_scalarbytes(void)
+{
+    return crypto_scalarmult_ed25519_SCALARBYTES;
+}
diff --git a/vendor/external/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c b/vendor/external/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c
@@ -0,0 +1,313 @@
+#include <stdint.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+
+#include "core.h"
+#include "crypto_aead_chacha20poly1305.h"
+#include "crypto_aead_xchacha20poly1305.h"
+#include "crypto_core_hchacha20.h"
+#include "crypto_onetimeauth_poly1305.h"
+#include "crypto_secretstream_xchacha20poly1305.h"
+#include "randombytes.h"
+#include "utils.h"
+
+#include "private/common.h"
+
+#define crypto_secretstream_xchacha20poly1305_COUNTERBYTES  4U
+#define crypto_secretstream_xchacha20poly1305_INONCEBYTES   8U
+
+#define STATE_COUNTER(STATE) ((STATE)->nonce)
+#define STATE_INONCE(STATE)  ((STATE)->nonce + \
+                              crypto_secretstream_xchacha20poly1305_COUNTERBYTES)
+
+static const unsigned char _pad0[16] = { 0 };
+
+static inline void
+_crypto_secretstream_xchacha20poly1305_counter_reset
+    (crypto_secretstream_xchacha20poly1305_state *state)
+{
+    memset(STATE_COUNTER(state), 0,
+           crypto_secretstream_xchacha20poly1305_COUNTERBYTES);
+    STATE_COUNTER(state)[0] = 1;
+}
+
+void
+crypto_secretstream_xchacha20poly1305_keygen
+   (unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
+{
+    randombytes_buf(k, crypto_secretstream_xchacha20poly1305_KEYBYTES);
+}
+
+int
+crypto_secretstream_xchacha20poly1305_init_push
+   (crypto_secretstream_xchacha20poly1305_state *state,
+    unsigned char out[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
+    const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
+{
+    COMPILER_ASSERT(crypto_secretstream_xchacha20poly1305_HEADERBYTES ==
+                    crypto_core_hchacha20_INPUTBYTES +
+                    crypto_secretstream_xchacha20poly1305_INONCEBYTES);
+    COMPILER_ASSERT(crypto_secretstream_xchacha20poly1305_HEADERBYTES ==
+                    crypto_aead_xchacha20poly1305_ietf_NPUBBYTES);
+    COMPILER_ASSERT(sizeof state->nonce ==
+                    crypto_secretstream_xchacha20poly1305_INONCEBYTES +
+                    crypto_secretstream_xchacha20poly1305_COUNTERBYTES);
+
+    randombytes_buf(out, crypto_secretstream_xchacha20poly1305_HEADERBYTES);
+    crypto_core_hchacha20(state->k, out, k, NULL);
+    _crypto_secretstream_xchacha20poly1305_counter_reset(state);
+    memcpy(STATE_INONCE(state), out + crypto_core_hchacha20_INPUTBYTES,
+           crypto_secretstream_xchacha20poly1305_INONCEBYTES);
+    memset(state->_pad, 0, sizeof state->_pad);
+
+    return 0;
+}
+
+int
+crypto_secretstream_xchacha20poly1305_init_pull
+   (crypto_secretstream_xchacha20poly1305_state *state,
+    const unsigned char in[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
+    const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
+{
+    crypto_core_hchacha20(state->k, in, k, NULL);
+    _crypto_secretstream_xchacha20poly1305_counter_reset(state);
+    memcpy(STATE_INONCE(state), in + crypto_core_hchacha20_INPUTBYTES,
+           crypto_secretstream_xchacha20poly1305_INONCEBYTES);
+    memset(state->_pad, 0, sizeof state->_pad);
+
+    return 0;
+}
+
+void
+crypto_secretstream_xchacha20poly1305_rekey
+    (crypto_secretstream_xchacha20poly1305_state *state)
+{
+    unsigned char new_key_and_inonce[crypto_stream_chacha20_ietf_KEYBYTES +
+                                     crypto_secretstream_xchacha20poly1305_INONCEBYTES];
+    size_t        i;
+
+    for (i = 0U; i < crypto_stream_chacha20_ietf_KEYBYTES; i++) {
+        new_key_and_inonce[i] = state->k[i];
+    }
+    for (i = 0U; i < crypto_secretstream_xchacha20poly1305_INONCEBYTES; i++) {
+        new_key_and_inonce[crypto_stream_chacha20_ietf_KEYBYTES + i] =
+            STATE_INONCE(state)[i];
+    }
+    crypto_stream_chacha20_ietf_xor(new_key_and_inonce, new_key_and_inonce,
+                                    sizeof new_key_and_inonce,
+                                    state->nonce, state->k);
+    for (i = 0U; i < crypto_stream_chacha20_ietf_KEYBYTES; i++) {
+        state->k[i] = new_key_and_inonce[i];
+    }
+    for (i = 0U; i < crypto_secretstream_xchacha20poly1305_INONCEBYTES; i++) {
+        STATE_INONCE(state)[i] =
+            new_key_and_inonce[crypto_stream_chacha20_ietf_KEYBYTES + i];
+    }
+    _crypto_secretstream_xchacha20poly1305_counter_reset(state);
+}
+
+int
+crypto_secretstream_xchacha20poly1305_push
+   (crypto_secretstream_xchacha20poly1305_state *state,
+    unsigned char *out, unsigned long long *outlen_p,
+    const unsigned char *m, unsigned long long mlen,
+    const unsigned char *ad, unsigned long long adlen, unsigned char tag)
+{
+    crypto_onetimeauth_poly1305_state poly1305_state;
+    unsigned char                     block[64U];
+    unsigned char                     slen[8U];
+    unsigned char                    *c;
+    unsigned char                    *mac;
+
+    if (outlen_p != NULL) {
+        *outlen_p = 0U;
+    }
+    COMPILER_ASSERT(crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX
+                    <= crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX);
+    if (mlen > crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    crypto_stream_chacha20_ietf(block, sizeof block, state->nonce, state->k);
+    crypto_onetimeauth_poly1305_init(&poly1305_state, block);
+    sodium_memzero(block, sizeof block);
+
+    crypto_onetimeauth_poly1305_update(&poly1305_state, ad, adlen);
+    crypto_onetimeauth_poly1305_update(&poly1305_state, _pad0,
+                                       (0x10 - adlen) & 0xf);
+    memset(block, 0, sizeof block);
+    block[0] = tag;
+
+    crypto_stream_chacha20_ietf_xor_ic(block, block, sizeof block,
+                                       state->nonce, 1U, state->k);
+    crypto_onetimeauth_poly1305_update(&poly1305_state, block, sizeof block);
+    out[0] = block[0];
+
+    c = out + (sizeof tag);
+    crypto_stream_chacha20_ietf_xor_ic(c, m, mlen, state->nonce, 2U, state->k);
+    crypto_onetimeauth_poly1305_update(&poly1305_state, c, mlen);
+    crypto_onetimeauth_poly1305_update
+        (&poly1305_state, _pad0, (0x10 - (sizeof block) + mlen) & 0xf);
+
+    STORE64_LE(slen, (uint64_t) adlen);
+    crypto_onetimeauth_poly1305_update(&poly1305_state, slen, sizeof slen);
+    STORE64_LE(slen, (sizeof block) + mlen);
+    crypto_onetimeauth_poly1305_update(&poly1305_state, slen, sizeof slen);
+
+    mac = c + mlen;
+    crypto_onetimeauth_poly1305_final(&poly1305_state, mac);
+    sodium_memzero(&poly1305_state, sizeof poly1305_state);
+
+    COMPILER_ASSERT(crypto_onetimeauth_poly1305_BYTES >=
+                    crypto_secretstream_xchacha20poly1305_INONCEBYTES);
+    XOR_BUF(STATE_INONCE(state), mac,
+            crypto_secretstream_xchacha20poly1305_INONCEBYTES);
+    sodium_increment(STATE_COUNTER(state),
+                     crypto_secretstream_xchacha20poly1305_COUNTERBYTES);
+    if ((tag & crypto_secretstream_xchacha20poly1305_TAG_REKEY) != 0 ||
+        sodium_is_zero(STATE_COUNTER(state),
+                       crypto_secretstream_xchacha20poly1305_COUNTERBYTES)) {
+        crypto_secretstream_xchacha20poly1305_rekey(state);
+    }
+    if (outlen_p != NULL) {
+        *outlen_p = crypto_secretstream_xchacha20poly1305_ABYTES + mlen;
+    }
+    return 0;
+}
+
+int
+crypto_secretstream_xchacha20poly1305_pull
+   (crypto_secretstream_xchacha20poly1305_state *state,
+    unsigned char *m, unsigned long long *mlen_p, unsigned char *tag_p,
+    const unsigned char *in, unsigned long long inlen,
+    const unsigned char *ad, unsigned long long adlen)
+{
+    crypto_onetimeauth_poly1305_state poly1305_state;
+    unsigned char                     block[64U];
+    unsigned char                     slen[8U];
+    unsigned char                     mac[crypto_onetimeauth_poly1305_BYTES];
+    const unsigned char              *c;
+    const unsigned char              *stored_mac;
+    unsigned long long                mlen;
+    unsigned char                     tag;
+
+    if (mlen_p != NULL) {
+        *mlen_p = 0U;
+    }
+    if (tag_p != NULL) {
+        *tag_p = 0xff;
+    }
+    if (inlen < crypto_secretstream_xchacha20poly1305_ABYTES) {
+        return -1;
+    }
+    mlen = inlen - crypto_secretstream_xchacha20poly1305_ABYTES;
+    if (mlen > crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    crypto_stream_chacha20_ietf(block, sizeof block, state->nonce, state->k);
+    crypto_onetimeauth_poly1305_init(&poly1305_state, block);
+    sodium_memzero(block, sizeof block);
+
+    crypto_onetimeauth_poly1305_update(&poly1305_state, ad, adlen);
+    crypto_onetimeauth_poly1305_update(&poly1305_state, _pad0,
+                                       (0x10 - adlen) & 0xf);
+
+    memset(block, 0, sizeof block);
+    block[0] = in[0];
+    crypto_stream_chacha20_ietf_xor_ic(block, block, sizeof block,
+                                       state->nonce, 1U, state->k);
+    tag = block[0];
+    block[0] = in[0];
+    crypto_onetimeauth_poly1305_update(&poly1305_state, block, sizeof block);
+
+    c = in + (sizeof tag);
+    crypto_onetimeauth_poly1305_update(&poly1305_state, c, mlen);
+    crypto_onetimeauth_poly1305_update
+        (&poly1305_state, _pad0, (0x10 - (sizeof block) + mlen) & 0xf);
+
+    STORE64_LE(slen, (uint64_t) adlen);
+    crypto_onetimeauth_poly1305_update(&poly1305_state, slen, sizeof slen);
+    STORE64_LE(slen, (sizeof block) + mlen);
+    crypto_onetimeauth_poly1305_update(&poly1305_state, slen, sizeof slen);
+
+    crypto_onetimeauth_poly1305_final(&poly1305_state, mac);
+    sodium_memzero(&poly1305_state, sizeof poly1305_state);
+
+    stored_mac = c + mlen;
+    if (sodium_memcmp(mac, stored_mac, sizeof mac) != 0) {
+        sodium_memzero(mac, sizeof mac);
+        return -1;
+    }
+
+    crypto_stream_chacha20_ietf_xor_ic(m, c, mlen, state->nonce, 2U, state->k);
+    XOR_BUF(STATE_INONCE(state), mac,
+            crypto_secretstream_xchacha20poly1305_INONCEBYTES);
+    sodium_increment(STATE_COUNTER(state),
+                     crypto_secretstream_xchacha20poly1305_COUNTERBYTES);
+    if ((tag & crypto_secretstream_xchacha20poly1305_TAG_REKEY) != 0 ||
+        sodium_is_zero(STATE_COUNTER(state),
+                       crypto_secretstream_xchacha20poly1305_COUNTERBYTES)) {
+        crypto_secretstream_xchacha20poly1305_rekey(state);
+    }
+    if (mlen_p != NULL) {
+        *mlen_p = mlen;
+    }
+    if (tag_p != NULL) {
+        *tag_p = tag;
+    }
+    return 0;
+}
+
+size_t
+crypto_secretstream_xchacha20poly1305_statebytes(void)
+{
+    return sizeof(crypto_secretstream_xchacha20poly1305_state);
+}
+
+size_t
+crypto_secretstream_xchacha20poly1305_abytes(void)
+{
+    return crypto_secretstream_xchacha20poly1305_ABYTES;
+}
+
+size_t
+crypto_secretstream_xchacha20poly1305_headerbytes(void)
+{
+    return crypto_secretstream_xchacha20poly1305_HEADERBYTES;
+}
+
+size_t
+crypto_secretstream_xchacha20poly1305_keybytes(void)
+{
+    return crypto_secretstream_xchacha20poly1305_KEYBYTES;
+}
+
+size_t
+crypto_secretstream_xchacha20poly1305_messagebytes_max(void)
+{
+    return crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX;
+}
+
+unsigned char
+crypto_secretstream_xchacha20poly1305_tag_message(void)
+{
+    return crypto_secretstream_xchacha20poly1305_TAG_MESSAGE;
+}
+
+unsigned char
+crypto_secretstream_xchacha20poly1305_tag_push(void)
+{
+    return crypto_secretstream_xchacha20poly1305_TAG_PUSH;
+}
+
+unsigned char
+crypto_secretstream_xchacha20poly1305_tag_rekey(void)
+{
+    return crypto_secretstream_xchacha20poly1305_TAG_REKEY;
+}
+
+unsigned char
+crypto_secretstream_xchacha20poly1305_tag_final(void)
+{
+    return crypto_secretstream_xchacha20poly1305_TAG_FINAL;
+}
diff --git a/vendor/external/libsodium/crypto_sign/crypto_sign.c b/vendor/external/libsodium/crypto_sign/crypto_sign.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_sign/crypto_sign.c
@@ -0,0 +1,115 @@
+
+#include "crypto_sign.h"
+
+size_t
+crypto_sign_statebytes(void)
+{
+    return sizeof(crypto_sign_state);
+}
+
+size_t
+crypto_sign_bytes(void)
+{
+    return crypto_sign_BYTES;
+}
+
+size_t
+crypto_sign_seedbytes(void)
+{
+    return crypto_sign_SEEDBYTES;
+}
+
+size_t
+crypto_sign_publickeybytes(void)
+{
+    return crypto_sign_PUBLICKEYBYTES;
+}
+
+size_t
+crypto_sign_secretkeybytes(void)
+{
+    return crypto_sign_SECRETKEYBYTES;
+}
+
+size_t
+crypto_sign_messagebytes_max(void)
+{
+    return crypto_sign_MESSAGEBYTES_MAX;
+}
+
+const char *
+crypto_sign_primitive(void)
+{
+    return crypto_sign_PRIMITIVE;
+}
+
+int
+crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
+                         const unsigned char *seed)
+{
+    return crypto_sign_ed25519_seed_keypair(pk, sk, seed);
+}
+
+int
+crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
+{
+    return crypto_sign_ed25519_keypair(pk, sk);
+}
+
+int
+crypto_sign(unsigned char *sm, unsigned long long *smlen_p,
+            const unsigned char *m, unsigned long long mlen,
+            const unsigned char *sk)
+{
+    return crypto_sign_ed25519(sm, smlen_p, m, mlen, sk);
+}
+
+int
+crypto_sign_open(unsigned char *m, unsigned long long *mlen_p,
+                 const unsigned char *sm, unsigned long long smlen,
+                 const unsigned char *pk)
+{
+    return crypto_sign_ed25519_open(m, mlen_p, sm, smlen, pk);
+}
+
+int
+crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p,
+                     const unsigned char *m, unsigned long long mlen,
+                     const unsigned char *sk)
+{
+    return crypto_sign_ed25519_detached(sig, siglen_p, m, mlen, sk);
+}
+
+int
+crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m,
+                            unsigned long long mlen, const unsigned char *pk)
+{
+    return crypto_sign_ed25519_verify_detached(sig, m, mlen, pk);
+}
+
+int
+crypto_sign_init(crypto_sign_state *state)
+{
+    return crypto_sign_ed25519ph_init(state);
+}
+
+int
+crypto_sign_update(crypto_sign_state *state, const unsigned char *m,
+                   unsigned long long mlen)
+{
+    return crypto_sign_ed25519ph_update(state, m, mlen);
+}
+
+int
+crypto_sign_final_create(crypto_sign_state *state, unsigned char *sig,
+                         unsigned long long *siglen_p, const unsigned char *sk)
+{
+    return crypto_sign_ed25519ph_final_create(state, sig, siglen_p, sk);
+}
+
+int
+crypto_sign_final_verify(crypto_sign_state *state, const unsigned char *sig,
+                         const unsigned char *pk)
+{
+    return crypto_sign_ed25519ph_final_verify(state, sig, pk);
+}
diff --git a/vendor/external/libsodium/crypto_sign/ed25519/ref10/keypair.c b/vendor/external/libsodium/crypto_sign/ed25519/ref10/keypair.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_sign/ed25519/ref10/keypair.c
@@ -0,0 +1,83 @@
+
+#include <string.h>
+
+#include "crypto_hash_sha512.h"
+#include "crypto_scalarmult_curve25519.h"
+#include "crypto_sign_ed25519.h"
+#include "sign_ed25519_ref10.h"
+#include "private/ed25519_ref10.h"
+#include "randombytes.h"
+#include "utils.h"
+
+int
+crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk,
+                                 const unsigned char *seed)
+{
+    ge25519_p3 A;
+
+    crypto_hash_sha512(sk, seed, 32);
+    sk[0] &= 248;
+    sk[31] &= 127;
+    sk[31] |= 64;
+
+    ge25519_scalarmult_base(&A, sk);
+    ge25519_p3_tobytes(pk, &A);
+
+    memmove(sk, seed, 32);
+    memmove(sk + 32, pk, 32);
+
+    return 0;
+}
+
+int
+crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk)
+{
+    unsigned char seed[32];
+    int           ret;
+
+    randombytes_buf(seed, sizeof seed);
+    ret = crypto_sign_ed25519_seed_keypair(pk, sk, seed);
+    sodium_memzero(seed, sizeof seed);
+
+    return ret;
+}
+
+int
+crypto_sign_ed25519_pk_to_curve25519(unsigned char *curve25519_pk,
+                                     const unsigned char *ed25519_pk)
+{
+    ge25519_p3 A;
+    fe25519    x;
+    fe25519    one_minus_y;
+
+    if (ge25519_has_small_order(ed25519_pk) != 0 ||
+        ge25519_frombytes_negate_vartime(&A, ed25519_pk) != 0 ||
+        ge25519_is_on_main_subgroup(&A) == 0) {
+        return -1;
+    }
+    fe25519_1(one_minus_y);
+    fe25519_sub(one_minus_y, one_minus_y, A.Y);
+    fe25519_1(x);
+    fe25519_add(x, x, A.Y);
+    fe25519_invert(one_minus_y, one_minus_y);
+    fe25519_mul(x, x, one_minus_y);
+    fe25519_tobytes(curve25519_pk, x);
+
+    return 0;
+}
+
+int
+crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk,
+                                     const unsigned char *ed25519_sk)
+{
+    unsigned char h[crypto_hash_sha512_BYTES];
+
+    crypto_hash_sha512(h, ed25519_sk, 32);
+    h[0] &= 248;
+    h[31] &= 127;
+    h[31] |= 64;
+    memcpy(curve25519_sk, h, crypto_scalarmult_curve25519_BYTES);
+    sodium_memzero(h, sizeof h);
+
+    return 0;
+}
diff --git a/vendor/external/libsodium/crypto_sign/ed25519/ref10/obsolete.c b/vendor/external/libsodium/crypto_sign/ed25519/ref10/obsolete.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_sign/ed25519/ref10/obsolete.c
@@ -0,0 +1,118 @@
+
+#include <limits.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "crypto_hash_sha512.h"
+#include "crypto_sign_edwards25519sha512batch.h"
+#include "crypto_verify_32.h"
+#include "private/ed25519_ref10.h"
+#include "randombytes.h"
+#include "utils.h"
+
+/* LCOV_EXCL_START */
+int
+crypto_sign_edwards25519sha512batch_keypair(unsigned char *pk,
+                                            unsigned char *sk)
+{
+    ge25519_p3 A;
+
+    randombytes_buf(sk, 32);
+    crypto_hash_sha512(sk, sk, 32);
+    sk[0] &= 248;
+    sk[31] &= 127;
+    sk[31] |= 64;
+    ge25519_scalarmult_base(&A, sk);
+    ge25519_p3_tobytes(pk, &A);
+
+    return 0;
+}
+
+int
+crypto_sign_edwards25519sha512batch(unsigned char       *sm,
+                                    unsigned long long  *smlen_p,
+                                    const unsigned char *m,
+                                    unsigned long long   mlen,
+                                    const unsigned char *sk)
+{
+    crypto_hash_sha512_state hs;
+    unsigned char            nonce[64];
+    unsigned char            hram[64];
+    unsigned char            sig[64];
+    ge25519_p3               A;
+    ge25519_p3               R;
+
+    crypto_hash_sha512_init(&hs);
+    crypto_hash_sha512_update(&hs, sk + 32, 32);
+    crypto_hash_sha512_update(&hs, m, mlen);
+    crypto_hash_sha512_final(&hs, nonce);
+    ge25519_scalarmult_base(&A, sk);
+    ge25519_p3_tobytes(sig + 32, &A);
+    sc25519_reduce(nonce);
+    ge25519_scalarmult_base(&R, nonce);
+    ge25519_p3_tobytes(sig, &R);
+    crypto_hash_sha512_init(&hs);
+    crypto_hash_sha512_update(&hs, sig, 32);
+    crypto_hash_sha512_update(&hs, m, mlen);
+    crypto_hash_sha512_final(&hs, hram);
+    sc25519_reduce(hram);
+    sc25519_muladd(sig + 32, hram, nonce, sk);
+    sodium_memzero(hram, sizeof hram);
+    memmove(sm + 32, m, (size_t) mlen);
+    memcpy(sm, sig, 32);
+    memcpy(sm + 32 + mlen, sig + 32, 32);
+    *smlen_p = mlen + 64U;
+
+    return 0;
+}
+
+int
+crypto_sign_edwards25519sha512batch_open(unsigned char       *m,
+                                         unsigned long long  *mlen_p,
+                                         const unsigned char *sm,
+                                         unsigned long long   smlen,
+                                         const unsigned char *pk)
+{
+    unsigned char      h[64];
+    unsigned char      t1[32], t2[32];
+    unsigned long long mlen;
+    ge25519_cached     Ai;
+    ge25519_p1p1       csa;
+    ge25519_p2         cs;
+    ge25519_p3         A;
+    ge25519_p3         R;
+    ge25519_p3         cs3;
+
+    *mlen_p = 0;
+    if (smlen < 64 || smlen - 64 > crypto_sign_edwards25519sha512batch_MESSAGEBYTES_MAX) {
+        return -1;
+    }
+    mlen = smlen - 64;
+    if (sm[smlen - 1] & 224) {
+        return -1;
+    }
+    if (ge25519_has_small_order(pk) != 0 ||
+        ge25519_frombytes_negate_vartime(&A, pk) != 0 ||
+        ge25519_has_small_order(sm) != 0 ||
+        ge25519_frombytes_negate_vartime(&R, sm) != 0) {
+        return -1;
+    }
+    ge25519_p3_to_cached(&Ai, &A);
+    crypto_hash_sha512(h, sm, mlen + 32);
+    sc25519_reduce(h);
+    ge25519_scalarmult(&cs3, h, &R);
+    ge25519_add(&csa, &cs3, &Ai);
+    ge25519_p1p1_to_p2(&cs, &csa);
+    ge25519_tobytes(t1, &cs);
+    t1[31] ^= 1 << 7;
+    ge25519_scalarmult_base(&R, sm + 32 + mlen);
+    ge25519_p3_tobytes(t2, &R);
+    if (crypto_verify_32(t1, t2) != 0) {
+        return -1;
+    }
+    *mlen_p = mlen;
+    memmove(m, sm + 32, mlen);
+
+    return 0;
+}
+/* LCOV_EXCL_END */
diff --git a/vendor/external/libsodium/crypto_sign/ed25519/ref10/open.c b/vendor/external/libsodium/crypto_sign/ed25519/ref10/open.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_sign/ed25519/ref10/open.c
@@ -0,0 +1,98 @@
+
+#include <limits.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "crypto_hash_sha512.h"
+#include "crypto_sign_ed25519.h"
+#include "crypto_verify_32.h"
+#include "sign_ed25519_ref10.h"
+#include "private/common.h"
+#include "private/ed25519_ref10.h"
+#include "utils.h"
+
+int
+_crypto_sign_ed25519_verify_detached(const unsigned char *sig,
+                                     const unsigned char *m,
+                                     unsigned long long   mlen,
+                                     const unsigned char *pk,
+                                     int prehashed)
+{
+    crypto_hash_sha512_state hs;
+    unsigned char            h[64];
+    unsigned char            rcheck[32];
+    ge25519_p3               A;
+    ge25519_p2               R;
+
+    ACQUIRE_FENCE;
+#ifdef ED25519_COMPAT
+    if (sig[63] & 224) {
+        return -1;
+    }
+#else
+    if (sc25519_is_canonical(sig + 32) == 0 ||
+        ge25519_has_small_order(sig) != 0) {
+        return -1;
+    }
+    if (ge25519_is_canonical(pk) == 0 ||
+        ge25519_has_small_order(pk) != 0) {
+        return -1;
+    }
+#endif
+    if (ge25519_frombytes_negate_vartime(&A, pk) != 0) {
+        return -1;
+    }
+    _crypto_sign_ed25519_ref10_hinit(&hs, prehashed);
+    crypto_hash_sha512_update(&hs, sig, 32);
+    crypto_hash_sha512_update(&hs, pk, 32);
+    crypto_hash_sha512_update(&hs, m, mlen);
+    crypto_hash_sha512_final(&hs, h);
+    sc25519_reduce(h);
+
+    ge25519_double_scalarmult_vartime(&R, h, &A, sig + 32);
+    ge25519_tobytes(rcheck, &R);
+
+    return crypto_verify_32(rcheck, sig) | (-(rcheck == sig)) |
+           sodium_memcmp(sig, rcheck, 32);
+}
+
+int
+crypto_sign_ed25519_verify_detached(const unsigned char *sig,
+                                    const unsigned char *m,
+                                    unsigned long long   mlen,
+                                    const unsigned char *pk)
+{
+    return _crypto_sign_ed25519_verify_detached(sig, m, mlen, pk, 0);
+}
+
+int
+crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p,
+                         const unsigned char *sm, unsigned long long smlen,
+                         const unsigned char *pk)
+{
+    unsigned long long mlen;
+
+    if (smlen < 64 || smlen - 64 > crypto_sign_ed25519_MESSAGEBYTES_MAX) {
+        goto badsig;
+    }
+    mlen = smlen - 64;
+    if (crypto_sign_ed25519_verify_detached(sm, sm + 64, mlen, pk) != 0) {
+        if (m != NULL) {
+            memset(m, 0, mlen);
+        }
+        goto badsig;
+    }
+    if (mlen_p != NULL) {
+        *mlen_p = mlen;
+    }
+    if (m != NULL) {
+        memmove(m, sm + 64, mlen);
+    }
+    return 0;
+
+badsig:
+    if (mlen_p != NULL) {
+        *mlen_p = 0;
+    }
+    return -1;
+}
diff --git a/vendor/external/libsodium/crypto_sign/ed25519/ref10/sign.c b/vendor/external/libsodium/crypto_sign/ed25519/ref10/sign.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_sign/ed25519/ref10/sign.c
@@ -0,0 +1,128 @@
+
+#include <string.h>
+
+#include "crypto_hash_sha512.h"
+#include "crypto_sign_ed25519.h"
+#include "sign_ed25519_ref10.h"
+#include "private/ed25519_ref10.h"
+#include "randombytes.h"
+#include "utils.h"
+
+void
+_crypto_sign_ed25519_ref10_hinit(crypto_hash_sha512_state *hs, int prehashed)
+{
+    static const unsigned char DOM2PREFIX[32 + 2] = {
+        'S', 'i', 'g', 'E', 'd', '2', '5', '5', '1', '9', ' ',
+        'n', 'o', ' ',
+        'E', 'd', '2', '5', '5', '1', '9', ' ',
+        'c', 'o', 'l', 'l', 'i', 's', 'i', 'o', 'n', 's', 1, 0
+    };
+
+    crypto_hash_sha512_init(hs);
+    if (prehashed) {
+        crypto_hash_sha512_update(hs, DOM2PREFIX, sizeof DOM2PREFIX);
+    }
+}
+
+static inline void
+_crypto_sign_ed25519_clamp(unsigned char k[32])
+{
+    k[0] &= 248;
+    k[31] &= 127;
+    k[31] |= 64;
+}
+
+#ifdef ED25519_NONDETERMINISTIC
+/* r = hash(k || K || noise || pad || M) (mod q) */
+static void
+_crypto_sign_ed25519_synthetic_r_hv(crypto_hash_sha512_state *hs,
+                                    unsigned char tmp[64],
+                                    const unsigned char az[64])
+{
+    crypto_hash_sha512_update(hs, az, 64);
+    randombytes_buf(tmp, 32);
+    memset(tmp + 32, 0, 32);
+    crypto_hash_sha512_update(hs, tmp, 64);
+}
+#endif
+
+int
+_crypto_sign_ed25519_detached(unsigned char *sig, unsigned long long *siglen_p,
+                              const unsigned char *m, unsigned long long mlen,
+                              const unsigned char *sk, int prehashed)
+{
+    crypto_hash_sha512_state hs;
+    unsigned char            az[64];
+    unsigned char            nonce[64];
+    unsigned char            hram[64];
+    ge25519_p3               R;
+
+    _crypto_sign_ed25519_ref10_hinit(&hs, prehashed);
+
+    crypto_hash_sha512(az, sk, 32);
+#ifdef ED25519_NONDETERMINISTIC
+    _crypto_sign_ed25519_synthetic_r_hv(&hs, nonce /* tmp */, az);
+#else
+    crypto_hash_sha512_update(&hs, az + 32, 32);
+#endif
+
+    crypto_hash_sha512_update(&hs, m, mlen);
+    crypto_hash_sha512_final(&hs, nonce);
+
+    memmove(sig + 32, sk + 32, 32);
+
+    sc25519_reduce(nonce);
+    ge25519_scalarmult_base(&R, nonce);
+    ge25519_p3_tobytes(sig, &R);
+
+    _crypto_sign_ed25519_ref10_hinit(&hs, prehashed);
+    crypto_hash_sha512_update(&hs, sig, 64);
+    crypto_hash_sha512_update(&hs, m, mlen);
+    crypto_hash_sha512_final(&hs, hram);
+
+    sc25519_reduce(hram);
+    _crypto_sign_ed25519_clamp(az);
+    sc25519_muladd(sig + 32, hram, az, nonce);
+
+    sodium_memzero(az, sizeof az);
+    sodium_memzero(nonce, sizeof nonce);
+
+    if (siglen_p != NULL) {
+        *siglen_p = 64U;
+    }
+    return 0;
+}
+
+int
+crypto_sign_ed25519_detached(unsigned char *sig, unsigned long long *siglen_p,
+                             const unsigned char *m, unsigned long long mlen,
+                             const unsigned char *sk)
+{
+    return _crypto_sign_ed25519_detached(sig, siglen_p, m, mlen, sk, 0);
+}
+
+int
+crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p,
+                    const unsigned char *m, unsigned long long mlen,
+                    const unsigned char *sk)
+{
+    unsigned long long siglen;
+
+    memmove(sm + crypto_sign_ed25519_BYTES, m, mlen);
+    /* LCOV_EXCL_START */
+    if (crypto_sign_ed25519_detached(
+            sm, &siglen, sm + crypto_sign_ed25519_BYTES, mlen, sk) != 0 ||
+        siglen != crypto_sign_ed25519_BYTES) {
+        if (smlen_p != NULL) {
+            *smlen_p = 0;
+        }
+        memset(sm, 0, mlen + crypto_sign_ed25519_BYTES);
+        return -1;
+    }
+    /* LCOV_EXCL_STOP */
+
+    if (smlen_p != NULL) {
+        *smlen_p = mlen + siglen;
+    }
+    return 0;
+}
diff --git a/vendor/external/libsodium/crypto_sign/ed25519/ref10/sign_ed25519_ref10.h b/vendor/external/libsodium/crypto_sign/ed25519/ref10/sign_ed25519_ref10.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_sign/ed25519/ref10/sign_ed25519_ref10.h
@@ -0,0 +1,18 @@
+#ifndef sign_ed25519_ref10_H
+#define sign_ed25519_ref10_H
+
+void _crypto_sign_ed25519_ref10_hinit(crypto_hash_sha512_state *hs,
+                                      int prehashed);
+
+int _crypto_sign_ed25519_detached(unsigned char *sig,
+                                  unsigned long long *siglen_p,
+                                  const unsigned char *m,
+                                  unsigned long long mlen,
+                                  const unsigned char *sk, int prehashed);
+
+int _crypto_sign_ed25519_verify_detached(const unsigned char *sig,
+                                         const unsigned char *m,
+                                         unsigned long long   mlen,
+                                         const unsigned char *pk,
+                                         int prehashed);
+#endif
diff --git a/vendor/external/libsodium/crypto_sign/ed25519/sign_ed25519.c b/vendor/external/libsodium/crypto_sign/ed25519/sign_ed25519.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_sign/ed25519/sign_ed25519.c
@@ -0,0 +1,97 @@
+
+#include <string.h>
+
+#include "crypto_hash_sha512.h"
+#include "crypto_sign_ed25519.h"
+#include "ref10/sign_ed25519_ref10.h"
+
+size_t
+crypto_sign_ed25519ph_statebytes(void)
+{
+    return sizeof(crypto_sign_ed25519ph_state);
+}
+
+size_t
+crypto_sign_ed25519_bytes(void)
+{
+    return crypto_sign_ed25519_BYTES;
+}
+
+size_t
+crypto_sign_ed25519_seedbytes(void)
+{
+    return crypto_sign_ed25519_SEEDBYTES;
+}
+
+size_t
+crypto_sign_ed25519_publickeybytes(void)
+{
+    return crypto_sign_ed25519_PUBLICKEYBYTES;
+}
+
+size_t
+crypto_sign_ed25519_secretkeybytes(void)
+{
+    return crypto_sign_ed25519_SECRETKEYBYTES;
+}
+
+size_t
+crypto_sign_ed25519_messagebytes_max(void)
+{
+    return crypto_sign_ed25519_MESSAGEBYTES_MAX;
+}
+
+int
+crypto_sign_ed25519_sk_to_seed(unsigned char *seed, const unsigned char *sk)
+{
+    memmove(seed, sk, crypto_sign_ed25519_SEEDBYTES);
+
+    return 0;
+}
+
+int
+crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk)
+{
+    memmove(pk, sk + crypto_sign_ed25519_SEEDBYTES,
+            crypto_sign_ed25519_PUBLICKEYBYTES);
+    return 0;
+}
+
+int
+crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state)
+{
+    crypto_hash_sha512_init(&state->hs);
+    return 0;
+}
+
+int
+crypto_sign_ed25519ph_update(crypto_sign_ed25519ph_state *state,
+                             const unsigned char *m, unsigned long long mlen)
+{
+    return crypto_hash_sha512_update(&state->hs, m, mlen);
+}
+
+int
+crypto_sign_ed25519ph_final_create(crypto_sign_ed25519ph_state *state,
+                                   unsigned char               *sig,
+                                   unsigned long long          *siglen_p,
+                                   const unsigned char         *sk)
+{
+    unsigned char ph[crypto_hash_sha512_BYTES];
+
+    crypto_hash_sha512_final(&state->hs, ph);
+
+    return _crypto_sign_ed25519_detached(sig, siglen_p, ph, sizeof ph, sk, 1);
+}
+
+int
+crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state *state,
+                                   const unsigned char         *sig,
+                                   const unsigned char         *pk)
+{
+    unsigned char ph[crypto_hash_sha512_BYTES];
+
+    crypto_hash_sha512_final(&state->hs, ph);
+
+    return _crypto_sign_ed25519_verify_detached(sig, ph, sizeof ph, pk, 1);
+}
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c
@@ -0,0 +1,177 @@
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "core.h"
+#include "crypto_stream_chacha20.h"
+#include "private/common.h"
+#include "utils.h"
+
+#if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \
+        defined(HAVE_TMMINTRIN_H) && defined(HAVE_SMMINTRIN_H)
+
+# ifdef __GNUC__
+#  pragma GCC target("sse2")
+#  pragma GCC target("ssse3")
+#  pragma GCC target("sse4.1")
+#  pragma GCC target("avx2")
+# endif
+
+# include <emmintrin.h>
+# include <immintrin.h>
+# include <smmintrin.h>
+# include <tmmintrin.h>
+# include "private/sse2_64_32.h"
+
+# include "../stream_chacha20.h"
+# include "chacha20_dolbeau-avx2.h"
+
+# define ROUNDS 20
+
+typedef struct chacha_ctx {
+    uint32_t input[16];
+} chacha_ctx;
+
+static void
+chacha_keysetup(chacha_ctx *ctx, const uint8_t *k)
+{
+    ctx->input[0]  = 0x61707865;
+    ctx->input[1]  = 0x3320646e;
+    ctx->input[2]  = 0x79622d32;
+    ctx->input[3]  = 0x6b206574;
+    ctx->input[4]  = LOAD32_LE(k + 0);
+    ctx->input[5]  = LOAD32_LE(k + 4);
+    ctx->input[6]  = LOAD32_LE(k + 8);
+    ctx->input[7]  = LOAD32_LE(k + 12);
+    ctx->input[8]  = LOAD32_LE(k + 16);
+    ctx->input[9]  = LOAD32_LE(k + 20);
+    ctx->input[10] = LOAD32_LE(k + 24);
+    ctx->input[11] = LOAD32_LE(k + 28);
+}
+
+static void
+chacha_ivsetup(chacha_ctx *ctx, const uint8_t *iv, const uint8_t *counter)
+{
+    ctx->input[12] = counter == NULL ? 0 : LOAD32_LE(counter + 0);
+    ctx->input[13] = counter == NULL ? 0 : LOAD32_LE(counter + 4);
+    ctx->input[14] = LOAD32_LE(iv + 0);
+    ctx->input[15] = LOAD32_LE(iv + 4);
+}
+
+static void
+chacha_ietf_ivsetup(chacha_ctx *ctx, const uint8_t *iv, const uint8_t *counter)
+{
+    ctx->input[12] = counter == NULL ? 0 : LOAD32_LE(counter);
+    ctx->input[13] = LOAD32_LE(iv + 0);
+    ctx->input[14] = LOAD32_LE(iv + 4);
+    ctx->input[15] = LOAD32_LE(iv + 8);
+}
+
+static void
+chacha20_encrypt_bytes(chacha_ctx *ctx, const uint8_t *m, uint8_t *c,
+                       unsigned long long bytes)
+{
+    uint32_t * const x = &ctx->input[0];
+
+    if (!bytes) {
+        return; /* LCOV_EXCL_LINE */
+    }
+# include "u8.h"
+# include "u4.h"
+# include "u1.h"
+# include "u0.h"
+}
+
+static int
+stream_ref(unsigned char *c, unsigned long long clen, const unsigned char *n,
+           const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+
+    if (!clen) {
+        return 0;
+    }
+    COMPILER_ASSERT(crypto_stream_chacha20_KEYBYTES == 256 / 8);
+    chacha_keysetup(&ctx, k);
+    chacha_ivsetup(&ctx, n, NULL);
+    memset(c, 0, clen);
+    chacha20_encrypt_bytes(&ctx, c, c, clen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+static int
+stream_ietf_ext_ref(unsigned char *c, unsigned long long clen,
+                    const unsigned char *n, const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+
+    if (!clen) {
+        return 0;
+    }
+    COMPILER_ASSERT(crypto_stream_chacha20_KEYBYTES == 256 / 8);
+    chacha_keysetup(&ctx, k);
+    chacha_ietf_ivsetup(&ctx, n, NULL);
+    memset(c, 0, clen);
+    chacha20_encrypt_bytes(&ctx, c, c, clen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+static int
+stream_ref_xor_ic(unsigned char *c, const unsigned char *m,
+                  unsigned long long mlen, const unsigned char *n, uint64_t ic,
+                  const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+    uint8_t           ic_bytes[8];
+    uint32_t          ic_high;
+    uint32_t          ic_low;
+
+    if (!mlen) {
+        return 0;
+    }
+    ic_high = (uint32_t) (ic >> 32);
+    ic_low  = (uint32_t) ic;
+    STORE32_LE(&ic_bytes[0], ic_low);
+    STORE32_LE(&ic_bytes[4], ic_high);
+    chacha_keysetup(&ctx, k);
+    chacha_ivsetup(&ctx, n, ic_bytes);
+    chacha20_encrypt_bytes(&ctx, m, c, mlen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+static int
+stream_ietf_ext_ref_xor_ic(unsigned char *c, const unsigned char *m,
+                           unsigned long long mlen, const unsigned char *n,
+                           uint32_t ic, const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+    uint8_t           ic_bytes[4];
+
+    if (!mlen) {
+        return 0;
+    }
+    STORE32_LE(ic_bytes, ic);
+    chacha_keysetup(&ctx, k);
+    chacha_ietf_ivsetup(&ctx, n, ic_bytes);
+    chacha20_encrypt_bytes(&ctx, m, c, mlen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+struct crypto_stream_chacha20_implementation
+    crypto_stream_chacha20_dolbeau_avx2_implementation = {
+        SODIUM_C99(.stream =) stream_ref,
+        SODIUM_C99(.stream_ietf_ext =) stream_ietf_ext_ref,
+        SODIUM_C99(.stream_xor_ic =) stream_ref_xor_ic,
+        SODIUM_C99(.stream_ietf_ext_xor_ic =) stream_ietf_ext_ref_xor_ic
+    };
+
+#endif
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.h b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.h
@@ -0,0 +1,8 @@
+
+#include <stdint.h>
+
+#include "../stream_chacha20.h"
+#include "crypto_stream_chacha20.h"
+
+extern struct crypto_stream_chacha20_implementation
+    crypto_stream_chacha20_dolbeau_avx2_implementation;
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c
@@ -0,0 +1,171 @@
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "core.h"
+#include "crypto_stream_chacha20.h"
+#include "private/common.h"
+#include "utils.h"
+
+#if defined(HAVE_EMMINTRIN_H) && defined(HAVE_TMMINTRIN_H)
+
+# ifdef __GNUC__
+#  pragma GCC target("sse2")
+#  pragma GCC target("ssse3")
+# endif
+
+# include <emmintrin.h>
+# include <tmmintrin.h>
+# include "private/sse2_64_32.h"
+
+# include "../stream_chacha20.h"
+# include "chacha20_dolbeau-ssse3.h"
+
+# define ROUNDS 20
+
+typedef struct chacha_ctx {
+    uint32_t input[16];
+} chacha_ctx;
+
+static void
+chacha_keysetup(chacha_ctx *ctx, const uint8_t *k)
+{
+    ctx->input[0]  = 0x61707865;
+    ctx->input[1]  = 0x3320646e;
+    ctx->input[2]  = 0x79622d32;
+    ctx->input[3]  = 0x6b206574;
+    ctx->input[4]  = LOAD32_LE(k + 0);
+    ctx->input[5]  = LOAD32_LE(k + 4);
+    ctx->input[6]  = LOAD32_LE(k + 8);
+    ctx->input[7]  = LOAD32_LE(k + 12);
+    ctx->input[8]  = LOAD32_LE(k + 16);
+    ctx->input[9]  = LOAD32_LE(k + 20);
+    ctx->input[10] = LOAD32_LE(k + 24);
+    ctx->input[11] = LOAD32_LE(k + 28);
+}
+
+static void
+chacha_ivsetup(chacha_ctx *ctx, const uint8_t *iv, const uint8_t *counter)
+{
+    ctx->input[12] = counter == NULL ? 0 : LOAD32_LE(counter + 0);
+    ctx->input[13] = counter == NULL ? 0 : LOAD32_LE(counter + 4);
+    ctx->input[14] = LOAD32_LE(iv + 0);
+    ctx->input[15] = LOAD32_LE(iv + 4);
+}
+
+static void
+chacha_ietf_ivsetup(chacha_ctx *ctx, const uint8_t *iv, const uint8_t *counter)
+{
+    ctx->input[12] = counter == NULL ? 0 : LOAD32_LE(counter);
+    ctx->input[13] = LOAD32_LE(iv + 0);
+    ctx->input[14] = LOAD32_LE(iv + 4);
+    ctx->input[15] = LOAD32_LE(iv + 8);
+}
+
+static void
+chacha20_encrypt_bytes(chacha_ctx *ctx, const uint8_t *m, uint8_t *c,
+                       unsigned long long bytes)
+{
+    uint32_t * const x = &ctx->input[0];
+
+    if (!bytes) {
+        return; /* LCOV_EXCL_LINE */
+    }
+# include "u4.h"
+# include "u1.h"
+# include "u0.h"
+}
+
+static int
+stream_ref(unsigned char *c, unsigned long long clen, const unsigned char *n,
+           const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+
+    if (!clen) {
+        return 0;
+    }
+    COMPILER_ASSERT(crypto_stream_chacha20_KEYBYTES == 256 / 8);
+    chacha_keysetup(&ctx, k);
+    chacha_ivsetup(&ctx, n, NULL);
+    memset(c, 0, clen);
+    chacha20_encrypt_bytes(&ctx, c, c, clen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+static int
+stream_ietf_ext_ref(unsigned char *c, unsigned long long clen,
+                    const unsigned char *n, const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+
+    if (!clen) {
+        return 0;
+    }
+    COMPILER_ASSERT(crypto_stream_chacha20_KEYBYTES == 256 / 8);
+    chacha_keysetup(&ctx, k);
+    chacha_ietf_ivsetup(&ctx, n, NULL);
+    memset(c, 0, clen);
+    chacha20_encrypt_bytes(&ctx, c, c, clen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+static int
+stream_ref_xor_ic(unsigned char *c, const unsigned char *m,
+                  unsigned long long mlen, const unsigned char *n, uint64_t ic,
+                  const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+    uint8_t           ic_bytes[8];
+    uint32_t          ic_high;
+    uint32_t          ic_low;
+
+    if (!mlen) {
+        return 0;
+    }
+    ic_high = (uint32_t) (ic >> 32);
+    ic_low  = (uint32_t) ic;
+    STORE32_LE(&ic_bytes[0], ic_low);
+    STORE32_LE(&ic_bytes[4], ic_high);
+    chacha_keysetup(&ctx, k);
+    chacha_ivsetup(&ctx, n, ic_bytes);
+    chacha20_encrypt_bytes(&ctx, m, c, mlen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+static int
+stream_ietf_ext_ref_xor_ic(unsigned char *c, const unsigned char *m,
+                           unsigned long long mlen, const unsigned char *n,
+                           uint32_t ic, const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+    uint8_t           ic_bytes[4];
+
+    if (!mlen) {
+        return 0;
+    }
+    STORE32_LE(ic_bytes, ic);
+    chacha_keysetup(&ctx, k);
+    chacha_ietf_ivsetup(&ctx, n, ic_bytes);
+    chacha20_encrypt_bytes(&ctx, m, c, mlen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+struct crypto_stream_chacha20_implementation
+    crypto_stream_chacha20_dolbeau_ssse3_implementation = {
+        SODIUM_C99(.stream =) stream_ref,
+        SODIUM_C99(.stream_ietf_ext =) stream_ietf_ext_ref,
+        SODIUM_C99(.stream_xor_ic =) stream_ref_xor_ic,
+        SODIUM_C99(.stream_ietf_ext_xor_ic =) stream_ietf_ext_ref_xor_ic
+    };
+
+#endif
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.h b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.h
@@ -0,0 +1,8 @@
+
+#include <stdint.h>
+
+#include "../stream_chacha20.h"
+#include "crypto_stream_chacha20.h"
+
+extern struct crypto_stream_chacha20_implementation
+    crypto_stream_chacha20_dolbeau_ssse3_implementation;
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u0.h b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u0.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u0.h
@@ -0,0 +1,86 @@
+if (bytes > 0) {
+    __m128i       x_0, x_1, x_2, x_3;
+    __m128i       t_1;
+    const __m128i rot16 =
+        _mm_set_epi8(13, 12, 15, 14, 9, 8, 11, 10, 5, 4, 7, 6, 1, 0, 3, 2);
+    const __m128i rot8 =
+        _mm_set_epi8(14, 13, 12, 15, 10, 9, 8, 11, 6, 5, 4, 7, 2, 1, 0, 3);
+    uint8_t partialblock[64];
+
+    unsigned int i;
+
+    x_0 = _mm_loadu_si128((const __m128i*) (x + 0));
+    x_1 = _mm_loadu_si128((const __m128i*) (x + 4));
+    x_2 = _mm_loadu_si128((const __m128i*) (x + 8));
+    x_3 = _mm_loadu_si128((const __m128i*) (x + 12));
+
+    for (i = 0; i < ROUNDS; i += 2) {
+        x_0 = _mm_add_epi32(x_0, x_1);
+        x_3 = _mm_xor_si128(x_3, x_0);
+        x_3 = _mm_shuffle_epi8(x_3, rot16);
+
+        x_2 = _mm_add_epi32(x_2, x_3);
+        x_1 = _mm_xor_si128(x_1, x_2);
+
+        t_1 = x_1;
+        x_1 = _mm_slli_epi32(x_1, 12);
+        t_1 = _mm_srli_epi32(t_1, 20);
+        x_1 = _mm_xor_si128(x_1, t_1);
+
+        x_0 = _mm_add_epi32(x_0, x_1);
+        x_3 = _mm_xor_si128(x_3, x_0);
+        x_0 = _mm_shuffle_epi32(x_0, 0x93);
+        x_3 = _mm_shuffle_epi8(x_3, rot8);
+
+        x_2 = _mm_add_epi32(x_2, x_3);
+        x_3 = _mm_shuffle_epi32(x_3, 0x4e);
+        x_1 = _mm_xor_si128(x_1, x_2);
+        x_2 = _mm_shuffle_epi32(x_2, 0x39);
+
+        t_1 = x_1;
+        x_1 = _mm_slli_epi32(x_1, 7);
+        t_1 = _mm_srli_epi32(t_1, 25);
+        x_1 = _mm_xor_si128(x_1, t_1);
+
+        x_0 = _mm_add_epi32(x_0, x_1);
+        x_3 = _mm_xor_si128(x_3, x_0);
+        x_3 = _mm_shuffle_epi8(x_3, rot16);
+
+        x_2 = _mm_add_epi32(x_2, x_3);
+        x_1 = _mm_xor_si128(x_1, x_2);
+
+        t_1 = x_1;
+        x_1 = _mm_slli_epi32(x_1, 12);
+        t_1 = _mm_srli_epi32(t_1, 20);
+        x_1 = _mm_xor_si128(x_1, t_1);
+
+        x_0 = _mm_add_epi32(x_0, x_1);
+        x_3 = _mm_xor_si128(x_3, x_0);
+        x_0 = _mm_shuffle_epi32(x_0, 0x39);
+        x_3 = _mm_shuffle_epi8(x_3, rot8);
+
+        x_2 = _mm_add_epi32(x_2, x_3);
+        x_3 = _mm_shuffle_epi32(x_3, 0x4e);
+        x_1 = _mm_xor_si128(x_1, x_2);
+        x_2 = _mm_shuffle_epi32(x_2, 0x93);
+
+        t_1 = x_1;
+        x_1 = _mm_slli_epi32(x_1, 7);
+        t_1 = _mm_srli_epi32(t_1, 25);
+        x_1 = _mm_xor_si128(x_1, t_1);
+    }
+    x_0 = _mm_add_epi32(x_0, _mm_loadu_si128((const __m128i*) (x + 0)));
+    x_1 = _mm_add_epi32(x_1, _mm_loadu_si128((const __m128i*) (x + 4)));
+    x_2 = _mm_add_epi32(x_2, _mm_loadu_si128((const __m128i*) (x + 8)));
+    x_3 = _mm_add_epi32(x_3, _mm_loadu_si128((const __m128i*) (x + 12)));
+    _mm_storeu_si128((__m128i*) (partialblock + 0), x_0);
+    _mm_storeu_si128((__m128i*) (partialblock + 16), x_1);
+    _mm_storeu_si128((__m128i*) (partialblock + 32), x_2);
+    _mm_storeu_si128((__m128i*) (partialblock + 48), x_3);
+
+    for (i = 0; i < bytes; i++) {
+        c[i] = m[i] ^ partialblock[i];
+    }
+
+    sodium_memzero(partialblock, sizeof partialblock);
+}
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u1.h b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u1.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u1.h
@@ -0,0 +1,98 @@
+while (bytes >= 64) {
+    __m128i       x_0, x_1, x_2, x_3;
+    __m128i       t_1;
+    const __m128i rot16 =
+        _mm_set_epi8(13, 12, 15, 14, 9, 8, 11, 10, 5, 4, 7, 6, 1, 0, 3, 2);
+    const __m128i rot8 =
+        _mm_set_epi8(14, 13, 12, 15, 10, 9, 8, 11, 6, 5, 4, 7, 2, 1, 0, 3);
+
+    uint32_t in12;
+    uint32_t in13;
+    int      i;
+
+    x_0 = _mm_loadu_si128((const __m128i*) (x + 0));
+    x_1 = _mm_loadu_si128((const __m128i*) (x + 4));
+    x_2 = _mm_loadu_si128((const __m128i*) (x + 8));
+    x_3 = _mm_loadu_si128((const __m128i*) (x + 12));
+
+    for (i = 0; i < ROUNDS; i += 2) {
+        x_0 = _mm_add_epi32(x_0, x_1);
+        x_3 = _mm_xor_si128(x_3, x_0);
+        x_3 = _mm_shuffle_epi8(x_3, rot16);
+
+        x_2 = _mm_add_epi32(x_2, x_3);
+        x_1 = _mm_xor_si128(x_1, x_2);
+
+        t_1 = x_1;
+        x_1 = _mm_slli_epi32(x_1, 12);
+        t_1 = _mm_srli_epi32(t_1, 20);
+        x_1 = _mm_xor_si128(x_1, t_1);
+
+        x_0 = _mm_add_epi32(x_0, x_1);
+        x_3 = _mm_xor_si128(x_3, x_0);
+        x_0 = _mm_shuffle_epi32(x_0, 0x93);
+        x_3 = _mm_shuffle_epi8(x_3, rot8);
+
+        x_2 = _mm_add_epi32(x_2, x_3);
+        x_3 = _mm_shuffle_epi32(x_3, 0x4e);
+        x_1 = _mm_xor_si128(x_1, x_2);
+        x_2 = _mm_shuffle_epi32(x_2, 0x39);
+
+        t_1 = x_1;
+        x_1 = _mm_slli_epi32(x_1, 7);
+        t_1 = _mm_srli_epi32(t_1, 25);
+        x_1 = _mm_xor_si128(x_1, t_1);
+
+        x_0 = _mm_add_epi32(x_0, x_1);
+        x_3 = _mm_xor_si128(x_3, x_0);
+        x_3 = _mm_shuffle_epi8(x_3, rot16);
+
+        x_2 = _mm_add_epi32(x_2, x_3);
+        x_1 = _mm_xor_si128(x_1, x_2);
+
+        t_1 = x_1;
+        x_1 = _mm_slli_epi32(x_1, 12);
+        t_1 = _mm_srli_epi32(t_1, 20);
+        x_1 = _mm_xor_si128(x_1, t_1);
+
+        x_0 = _mm_add_epi32(x_0, x_1);
+        x_3 = _mm_xor_si128(x_3, x_0);
+        x_0 = _mm_shuffle_epi32(x_0, 0x39);
+        x_3 = _mm_shuffle_epi8(x_3, rot8);
+
+        x_2 = _mm_add_epi32(x_2, x_3);
+        x_3 = _mm_shuffle_epi32(x_3, 0x4e);
+        x_1 = _mm_xor_si128(x_1, x_2);
+        x_2 = _mm_shuffle_epi32(x_2, 0x93);
+
+        t_1 = x_1;
+        x_1 = _mm_slli_epi32(x_1, 7);
+        t_1 = _mm_srli_epi32(t_1, 25);
+        x_1 = _mm_xor_si128(x_1, t_1);
+    }
+    x_0 = _mm_add_epi32(x_0, _mm_loadu_si128((const __m128i*) (x + 0)));
+    x_1 = _mm_add_epi32(x_1, _mm_loadu_si128((const __m128i*) (x + 4)));
+    x_2 = _mm_add_epi32(x_2, _mm_loadu_si128((const __m128i*) (x + 8)));
+    x_3 = _mm_add_epi32(x_3, _mm_loadu_si128((const __m128i*) (x + 12)));
+    x_0 = _mm_xor_si128(x_0, _mm_loadu_si128((const __m128i*) (m + 0)));
+    x_1 = _mm_xor_si128(x_1, _mm_loadu_si128((const __m128i*) (m + 16)));
+    x_2 = _mm_xor_si128(x_2, _mm_loadu_si128((const __m128i*) (m + 32)));
+    x_3 = _mm_xor_si128(x_3, _mm_loadu_si128((const __m128i*) (m + 48)));
+    _mm_storeu_si128((__m128i*) (c + 0), x_0);
+    _mm_storeu_si128((__m128i*) (c + 16), x_1);
+    _mm_storeu_si128((__m128i*) (c + 32), x_2);
+    _mm_storeu_si128((__m128i*) (c + 48), x_3);
+
+    in12 = x[12];
+    in13 = x[13];
+    in12++;
+    if (in12 == 0) {
+        in13++;
+    }
+    x[12] = in12;
+    x[13] = in13;
+
+    bytes -= 64;
+    c += 64;
+    m += 64;
+}
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u4.h b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u4.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u4.h
@@ -0,0 +1,177 @@
+
+#define VEC4_ROT(A, IMM) \
+    _mm_or_si128(_mm_slli_epi32(A, IMM), _mm_srli_epi32(A, (32 - IMM)))
+
+/* same, but replace 2 of the shift/shift/or "rotation" by byte shuffles (8 &
+ * 16) (better) */
+#define VEC4_QUARTERROUND_SHUFFLE(A, B, C, D) \
+    x_##A = _mm_add_epi32(x_##A, x_##B);      \
+    t_##A = _mm_xor_si128(x_##D, x_##A);      \
+    x_##D = _mm_shuffle_epi8(t_##A, rot16);   \
+    x_##C = _mm_add_epi32(x_##C, x_##D);      \
+    t_##C = _mm_xor_si128(x_##B, x_##C);      \
+    x_##B = VEC4_ROT(t_##C, 12);              \
+    x_##A = _mm_add_epi32(x_##A, x_##B);      \
+    t_##A = _mm_xor_si128(x_##D, x_##A);      \
+    x_##D = _mm_shuffle_epi8(t_##A, rot8);    \
+    x_##C = _mm_add_epi32(x_##C, x_##D);      \
+    t_##C = _mm_xor_si128(x_##B, x_##C);      \
+    x_##B = VEC4_ROT(t_##C, 7)
+
+#define VEC4_QUARTERROUND(A, B, C, D) VEC4_QUARTERROUND_SHUFFLE(A, B, C, D)
+
+if (bytes >= 256) {
+    /* constant for shuffling bytes (replacing multiple-of-8 rotates) */
+    __m128i rot16 =
+        _mm_set_epi8(13, 12, 15, 14, 9, 8, 11, 10, 5, 4, 7, 6, 1, 0, 3, 2);
+    __m128i rot8 =
+        _mm_set_epi8(14, 13, 12, 15, 10, 9, 8, 11, 6, 5, 4, 7, 2, 1, 0, 3);
+
+    __m128i x_0  = _mm_set1_epi32(x[0]);
+    __m128i x_1  = _mm_set1_epi32(x[1]);
+    __m128i x_2  = _mm_set1_epi32(x[2]);
+    __m128i x_3  = _mm_set1_epi32(x[3]);
+    __m128i x_4  = _mm_set1_epi32(x[4]);
+    __m128i x_5  = _mm_set1_epi32(x[5]);
+    __m128i x_6  = _mm_set1_epi32(x[6]);
+    __m128i x_7  = _mm_set1_epi32(x[7]);
+    __m128i x_8  = _mm_set1_epi32(x[8]);
+    __m128i x_9  = _mm_set1_epi32(x[9]);
+    __m128i x_10 = _mm_set1_epi32(x[10]);
+    __m128i x_11 = _mm_set1_epi32(x[11]);
+    __m128i x_12;
+    __m128i x_13;
+    __m128i x_14   = _mm_set1_epi32(x[14]);
+    __m128i x_15   = _mm_set1_epi32(x[15]);
+    __m128i orig0  = x_0;
+    __m128i orig1  = x_1;
+    __m128i orig2  = x_2;
+    __m128i orig3  = x_3;
+    __m128i orig4  = x_4;
+    __m128i orig5  = x_5;
+    __m128i orig6  = x_6;
+    __m128i orig7  = x_7;
+    __m128i orig8  = x_8;
+    __m128i orig9  = x_9;
+    __m128i orig10 = x_10;
+    __m128i orig11 = x_11;
+    __m128i orig12;
+    __m128i orig13;
+    __m128i orig14 = x_14;
+    __m128i orig15 = x_15;
+    __m128i t_0, t_1, t_2, t_3, t_4, t_5, t_6, t_7, t_8, t_9, t_10, t_11, t_12,
+        t_13, t_14, t_15;
+
+    uint32_t in12, in13;
+    int      i;
+
+    while (bytes >= 256) {
+        const __m128i addv12 = _mm_set_epi64x(1, 0);
+        const __m128i addv13 = _mm_set_epi64x(3, 2);
+        __m128i       t12, t13;
+        uint64_t      in1213;
+
+        x_0  = orig0;
+        x_1  = orig1;
+        x_2  = orig2;
+        x_3  = orig3;
+        x_4  = orig4;
+        x_5  = orig5;
+        x_6  = orig6;
+        x_7  = orig7;
+        x_8  = orig8;
+        x_9  = orig9;
+        x_10 = orig10;
+        x_11 = orig11;
+        x_14 = orig14;
+        x_15 = orig15;
+
+        in12   = x[12];
+        in13   = x[13];
+        in1213 = ((uint64_t) in12) | (((uint64_t) in13) << 32);
+        t12    = _mm_set1_epi64x(in1213);
+        t13    = _mm_set1_epi64x(in1213);
+
+        x_12 = _mm_add_epi64(addv12, t12);
+        x_13 = _mm_add_epi64(addv13, t13);
+
+        t12 = _mm_unpacklo_epi32(x_12, x_13);
+        t13 = _mm_unpackhi_epi32(x_12, x_13);
+
+        x_12 = _mm_unpacklo_epi32(t12, t13);
+        x_13 = _mm_unpackhi_epi32(t12, t13);
+
+        orig12 = x_12;
+        orig13 = x_13;
+
+        in1213 += 4;
+
+        x[12] = in1213 & 0xFFFFFFFF;
+        x[13] = (in1213 >> 32) & 0xFFFFFFFF;
+
+        for (i = 0; i < ROUNDS; i += 2) {
+            VEC4_QUARTERROUND(0, 4, 8, 12);
+            VEC4_QUARTERROUND(1, 5, 9, 13);
+            VEC4_QUARTERROUND(2, 6, 10, 14);
+            VEC4_QUARTERROUND(3, 7, 11, 15);
+            VEC4_QUARTERROUND(0, 5, 10, 15);
+            VEC4_QUARTERROUND(1, 6, 11, 12);
+            VEC4_QUARTERROUND(2, 7, 8, 13);
+            VEC4_QUARTERROUND(3, 4, 9, 14);
+        }
+
+#define ONEQUAD_TRANSPOSE(A, B, C, D)                                          \
+    {                                                                          \
+        __m128i t0, t1, t2, t3;                                                \
+                                                                               \
+        x_##A = _mm_add_epi32(x_##A, orig##A);                                 \
+        x_##B = _mm_add_epi32(x_##B, orig##B);                                 \
+        x_##C = _mm_add_epi32(x_##C, orig##C);                                 \
+        x_##D = _mm_add_epi32(x_##D, orig##D);                                 \
+        t_##A = _mm_unpacklo_epi32(x_##A, x_##B);                              \
+        t_##B = _mm_unpacklo_epi32(x_##C, x_##D);                              \
+        t_##C = _mm_unpackhi_epi32(x_##A, x_##B);                              \
+        t_##D = _mm_unpackhi_epi32(x_##C, x_##D);                              \
+        x_##A = _mm_unpacklo_epi64(t_##A, t_##B);                              \
+        x_##B = _mm_unpackhi_epi64(t_##A, t_##B);                              \
+        x_##C = _mm_unpacklo_epi64(t_##C, t_##D);                              \
+        x_##D = _mm_unpackhi_epi64(t_##C, t_##D);                              \
+                                                                               \
+        t0 = _mm_xor_si128(x_##A, _mm_loadu_si128((const __m128i*) (m + 0)));  \
+        _mm_storeu_si128((__m128i*) (c + 0), t0);                              \
+        t1 = _mm_xor_si128(x_##B, _mm_loadu_si128((const __m128i*) (m + 64))); \
+        _mm_storeu_si128((__m128i*) (c + 64), t1);                             \
+        t2 =                                                                   \
+            _mm_xor_si128(x_##C, _mm_loadu_si128((const __m128i*) (m + 128))); \
+        _mm_storeu_si128((__m128i*) (c + 128), t2);                            \
+        t3 =                                                                   \
+            _mm_xor_si128(x_##D, _mm_loadu_si128((const __m128i*) (m + 192))); \
+        _mm_storeu_si128((__m128i*) (c + 192), t3);                            \
+    }
+
+#define ONEQUAD(A, B, C, D) ONEQUAD_TRANSPOSE(A, B, C, D)
+
+        ONEQUAD(0, 1, 2, 3);
+        m += 16;
+        c += 16;
+        ONEQUAD(4, 5, 6, 7);
+        m += 16;
+        c += 16;
+        ONEQUAD(8, 9, 10, 11);
+        m += 16;
+        c += 16;
+        ONEQUAD(12, 13, 14, 15);
+        m -= 48;
+        c -= 48;
+
+#undef ONEQUAD
+#undef ONEQUAD_TRANSPOSE
+
+        bytes -= 256;
+        c += 256;
+        m += 256;
+    }
+}
+#undef VEC4_ROT
+#undef VEC4_QUARTERROUND
+#undef VEC4_QUARTERROUND_SHUFFLE
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u8.h b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u8.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/dolbeau/u8.h
@@ -0,0 +1,326 @@
+
+#define VEC8_ROT(A, IMM) \
+    _mm256_or_si256(_mm256_slli_epi32(A, IMM), _mm256_srli_epi32(A, (32 - IMM)))
+
+/* same, but replace 2 of the shift/shift/or "rotation" by byte shuffles (8 &
+ * 16) (better) */
+#define VEC8_QUARTERROUND_SHUFFLE(A, B, C, D)  \
+    x_##A = _mm256_add_epi32(x_##A, x_##B);    \
+    t_##A = _mm256_xor_si256(x_##D, x_##A);    \
+    x_##D = _mm256_shuffle_epi8(t_##A, rot16); \
+    x_##C = _mm256_add_epi32(x_##C, x_##D);    \
+    t_##C = _mm256_xor_si256(x_##B, x_##C);    \
+    x_##B = VEC8_ROT(t_##C, 12);               \
+    x_##A = _mm256_add_epi32(x_##A, x_##B);    \
+    t_##A = _mm256_xor_si256(x_##D, x_##A);    \
+    x_##D = _mm256_shuffle_epi8(t_##A, rot8);  \
+    x_##C = _mm256_add_epi32(x_##C, x_##D);    \
+    t_##C = _mm256_xor_si256(x_##B, x_##C);    \
+    x_##B = VEC8_ROT(t_##C, 7)
+
+#define VEC8_QUARTERROUND(A, B, C, D) VEC8_QUARTERROUND_SHUFFLE(A, B, C, D)
+
+#define VEC8_LINE1(A, B, C, D)              \
+    x_##A = _mm256_add_epi32(x_##A, x_##B); \
+    x_##D = _mm256_shuffle_epi8(_mm256_xor_si256(x_##D, x_##A), rot16)
+#define VEC8_LINE2(A, B, C, D)              \
+    x_##C = _mm256_add_epi32(x_##C, x_##D); \
+    x_##B = VEC8_ROT(_mm256_xor_si256(x_##B, x_##C), 12)
+#define VEC8_LINE3(A, B, C, D)              \
+    x_##A = _mm256_add_epi32(x_##A, x_##B); \
+    x_##D = _mm256_shuffle_epi8(_mm256_xor_si256(x_##D, x_##A), rot8)
+#define VEC8_LINE4(A, B, C, D)              \
+    x_##C = _mm256_add_epi32(x_##C, x_##D); \
+    x_##B = VEC8_ROT(_mm256_xor_si256(x_##B, x_##C), 7)
+
+#define VEC8_ROUND_SEQ(A1, B1, C1, D1, A2, B2, C2, D2, A3, B3, C3, D3, A4, B4, \
+                       C4, D4)                                                 \
+    VEC8_LINE1(A1, B1, C1, D1);                                                \
+    VEC8_LINE1(A2, B2, C2, D2);                                                \
+    VEC8_LINE1(A3, B3, C3, D3);                                                \
+    VEC8_LINE1(A4, B4, C4, D4);                                                \
+    VEC8_LINE2(A1, B1, C1, D1);                                                \
+    VEC8_LINE2(A2, B2, C2, D2);                                                \
+    VEC8_LINE2(A3, B3, C3, D3);                                                \
+    VEC8_LINE2(A4, B4, C4, D4);                                                \
+    VEC8_LINE3(A1, B1, C1, D1);                                                \
+    VEC8_LINE3(A2, B2, C2, D2);                                                \
+    VEC8_LINE3(A3, B3, C3, D3);                                                \
+    VEC8_LINE3(A4, B4, C4, D4);                                                \
+    VEC8_LINE4(A1, B1, C1, D1);                                                \
+    VEC8_LINE4(A2, B2, C2, D2);                                                \
+    VEC8_LINE4(A3, B3, C3, D3);                                                \
+    VEC8_LINE4(A4, B4, C4, D4)
+
+#define VEC8_ROUND_HALF(A1, B1, C1, D1, A2, B2, C2, D2, A3, B3, C3, D3, A4, \
+                        B4, C4, D4)                                         \
+    VEC8_LINE1(A1, B1, C1, D1);                                             \
+    VEC8_LINE1(A2, B2, C2, D2);                                             \
+    VEC8_LINE2(A1, B1, C1, D1);                                             \
+    VEC8_LINE2(A2, B2, C2, D2);                                             \
+    VEC8_LINE3(A1, B1, C1, D1);                                             \
+    VEC8_LINE3(A2, B2, C2, D2);                                             \
+    VEC8_LINE4(A1, B1, C1, D1);                                             \
+    VEC8_LINE4(A2, B2, C2, D2);                                             \
+    VEC8_LINE1(A3, B3, C3, D3);                                             \
+    VEC8_LINE1(A4, B4, C4, D4);                                             \
+    VEC8_LINE2(A3, B3, C3, D3);                                             \
+    VEC8_LINE2(A4, B4, C4, D4);                                             \
+    VEC8_LINE3(A3, B3, C3, D3);                                             \
+    VEC8_LINE3(A4, B4, C4, D4);                                             \
+    VEC8_LINE4(A3, B3, C3, D3);                                             \
+    VEC8_LINE4(A4, B4, C4, D4)
+
+#define VEC8_ROUND_HALFANDHALF(A1, B1, C1, D1, A2, B2, C2, D2, A3, B3, C3, D3, \
+                               A4, B4, C4, D4)                                 \
+    VEC8_LINE1(A1, B1, C1, D1);                                                \
+    VEC8_LINE1(A2, B2, C2, D2);                                                \
+    VEC8_LINE2(A1, B1, C1, D1);                                                \
+    VEC8_LINE2(A2, B2, C2, D2);                                                \
+    VEC8_LINE1(A3, B3, C3, D3);                                                \
+    VEC8_LINE1(A4, B4, C4, D4);                                                \
+    VEC8_LINE2(A3, B3, C3, D3);                                                \
+    VEC8_LINE2(A4, B4, C4, D4);                                                \
+    VEC8_LINE3(A1, B1, C1, D1);                                                \
+    VEC8_LINE3(A2, B2, C2, D2);                                                \
+    VEC8_LINE4(A1, B1, C1, D1);                                                \
+    VEC8_LINE4(A2, B2, C2, D2);                                                \
+    VEC8_LINE3(A3, B3, C3, D3);                                                \
+    VEC8_LINE3(A4, B4, C4, D4);                                                \
+    VEC8_LINE4(A3, B3, C3, D3);                                                \
+    VEC8_LINE4(A4, B4, C4, D4)
+
+#define VEC8_ROUND(A1, B1, C1, D1, A2, B2, C2, D2, A3, B3, C3, D3, A4, B4, C4, \
+                   D4)                                                         \
+    VEC8_ROUND_SEQ(A1, B1, C1, D1, A2, B2, C2, D2, A3, B3, C3, D3, A4, B4, C4, \
+                   D4)
+
+if (bytes >= 512) {
+    /* constant for shuffling bytes (replacing multiple-of-8 rotates) */
+    __m256i rot16 =
+        _mm256_set_epi8(13, 12, 15, 14, 9, 8, 11, 10, 5, 4, 7, 6, 1, 0, 3, 2,
+                        13, 12, 15, 14, 9, 8, 11, 10, 5, 4, 7, 6, 1, 0, 3, 2);
+    __m256i rot8 =
+        _mm256_set_epi8(14, 13, 12, 15, 10, 9, 8, 11, 6, 5, 4, 7, 2, 1, 0, 3,
+                        14, 13, 12, 15, 10, 9, 8, 11, 6, 5, 4, 7, 2, 1, 0, 3);
+    uint32_t in12, in13;
+
+    /* the naive way seems as fast (if not a bit faster) than the vector way */
+    __m256i x_0  = _mm256_set1_epi32(x[0]);
+    __m256i x_1  = _mm256_set1_epi32(x[1]);
+    __m256i x_2  = _mm256_set1_epi32(x[2]);
+    __m256i x_3  = _mm256_set1_epi32(x[3]);
+    __m256i x_4  = _mm256_set1_epi32(x[4]);
+    __m256i x_5  = _mm256_set1_epi32(x[5]);
+    __m256i x_6  = _mm256_set1_epi32(x[6]);
+    __m256i x_7  = _mm256_set1_epi32(x[7]);
+    __m256i x_8  = _mm256_set1_epi32(x[8]);
+    __m256i x_9  = _mm256_set1_epi32(x[9]);
+    __m256i x_10 = _mm256_set1_epi32(x[10]);
+    __m256i x_11 = _mm256_set1_epi32(x[11]);
+    __m256i x_12;
+    __m256i x_13;
+    __m256i x_14 = _mm256_set1_epi32(x[14]);
+    __m256i x_15 = _mm256_set1_epi32(x[15]);
+
+    __m256i orig0  = x_0;
+    __m256i orig1  = x_1;
+    __m256i orig2  = x_2;
+    __m256i orig3  = x_3;
+    __m256i orig4  = x_4;
+    __m256i orig5  = x_5;
+    __m256i orig6  = x_6;
+    __m256i orig7  = x_7;
+    __m256i orig8  = x_8;
+    __m256i orig9  = x_9;
+    __m256i orig10 = x_10;
+    __m256i orig11 = x_11;
+    __m256i orig12;
+    __m256i orig13;
+    __m256i orig14 = x_14;
+    __m256i orig15 = x_15;
+    __m256i t_0, t_1, t_2, t_3, t_4, t_5, t_6, t_7, t_8, t_9, t_10, t_11, t_12,
+        t_13, t_14, t_15;
+
+    while (bytes >= 512) {
+        const __m256i addv12  = _mm256_set_epi64x(3, 2, 1, 0);
+        const __m256i addv13  = _mm256_set_epi64x(7, 6, 5, 4);
+        const __m256i permute = _mm256_set_epi32(7, 6, 3, 2, 5, 4, 1, 0);
+        __m256i       t12, t13;
+
+        uint64_t in1213;
+        int      i;
+
+        x_0  = orig0;
+        x_1  = orig1;
+        x_2  = orig2;
+        x_3  = orig3;
+        x_4  = orig4;
+        x_5  = orig5;
+        x_6  = orig6;
+        x_7  = orig7;
+        x_8  = orig8;
+        x_9  = orig9;
+        x_10 = orig10;
+        x_11 = orig11;
+        x_14 = orig14;
+        x_15 = orig15;
+
+        in12   = x[12];
+        in13   = x[13];
+        in1213 = ((uint64_t) in12) | (((uint64_t) in13) << 32);
+        x_12 = x_13 = _mm256_broadcastq_epi64(_mm_cvtsi64_si128(in1213));
+
+        t12 = _mm256_add_epi64(addv12, x_12);
+        t13 = _mm256_add_epi64(addv13, x_13);
+
+        x_12 = _mm256_unpacklo_epi32(t12, t13);
+        x_13 = _mm256_unpackhi_epi32(t12, t13);
+
+        t12 = _mm256_unpacklo_epi32(x_12, x_13);
+        t13 = _mm256_unpackhi_epi32(x_12, x_13);
+
+        /* required because unpack* are intra-lane */
+        x_12 = _mm256_permutevar8x32_epi32(t12, permute);
+        x_13 = _mm256_permutevar8x32_epi32(t13, permute);
+
+        orig12 = x_12;
+        orig13 = x_13;
+
+        in1213 += 8;
+
+        x[12] = in1213 & 0xFFFFFFFF;
+        x[13] = (in1213 >> 32) & 0xFFFFFFFF;
+
+        for (i = 0; i < ROUNDS; i += 2) {
+            VEC8_ROUND(0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15);
+            VEC8_ROUND(0, 5, 10, 15, 1, 6, 11, 12, 2, 7, 8, 13, 3, 4, 9, 14);
+        }
+
+#define ONEQUAD_TRANSPOSE(A, B, C, D)                                     \
+    {                                                                     \
+        __m128i t0, t1, t2, t3;                                           \
+        x_##A = _mm256_add_epi32(x_##A, orig##A);                         \
+        x_##B = _mm256_add_epi32(x_##B, orig##B);                         \
+        x_##C = _mm256_add_epi32(x_##C, orig##C);                         \
+        x_##D = _mm256_add_epi32(x_##D, orig##D);                         \
+        t_##A = _mm256_unpacklo_epi32(x_##A, x_##B);                      \
+        t_##B = _mm256_unpacklo_epi32(x_##C, x_##D);                      \
+        t_##C = _mm256_unpackhi_epi32(x_##A, x_##B);                      \
+        t_##D = _mm256_unpackhi_epi32(x_##C, x_##D);                      \
+        x_##A = _mm256_unpacklo_epi64(t_##A, t_##B);                      \
+        x_##B = _mm256_unpackhi_epi64(t_##A, t_##B);                      \
+        x_##C = _mm256_unpacklo_epi64(t_##C, t_##D);                      \
+        x_##D = _mm256_unpackhi_epi64(t_##C, t_##D);                      \
+        t0    = _mm_xor_si128(_mm256_extracti128_si256(x_##A, 0),         \
+                           _mm_loadu_si128((const __m128i*) (m + 0))); \
+        _mm_storeu_si128((__m128i*) (c + 0), t0);                         \
+        t1 = _mm_xor_si128(_mm256_extracti128_si256(x_##B, 0),            \
+                           _mm_loadu_si128((const __m128i*) (m + 64)));   \
+        _mm_storeu_si128((__m128i*) (c + 64), t1);                        \
+        t2 = _mm_xor_si128(_mm256_extracti128_si256(x_##C, 0),            \
+                           _mm_loadu_si128((const __m128i*) (m + 128)));  \
+        _mm_storeu_si128((__m128i*) (c + 128), t2);                       \
+        t3 = _mm_xor_si128(_mm256_extracti128_si256(x_##D, 0),            \
+                           _mm_loadu_si128((const __m128i*) (m + 192)));  \
+        _mm_storeu_si128((__m128i*) (c + 192), t3);                       \
+        t0 = _mm_xor_si128(_mm256_extracti128_si256(x_##A, 1),            \
+                           _mm_loadu_si128((const __m128i*) (m + 256)));  \
+        _mm_storeu_si128((__m128i*) (c + 256), t0);                       \
+        t1 = _mm_xor_si128(_mm256_extracti128_si256(x_##B, 1),            \
+                           _mm_loadu_si128((const __m128i*) (m + 320)));  \
+        _mm_storeu_si128((__m128i*) (c + 320), t1);                       \
+        t2 = _mm_xor_si128(_mm256_extracti128_si256(x_##C, 1),            \
+                           _mm_loadu_si128((const __m128i*) (m + 384)));  \
+        _mm_storeu_si128((__m128i*) (c + 384), t2);                       \
+        t3 = _mm_xor_si128(_mm256_extracti128_si256(x_##D, 1),            \
+                           _mm_loadu_si128((const __m128i*) (m + 448)));  \
+        _mm_storeu_si128((__m128i*) (c + 448), t3);                       \
+    }
+
+#define ONEQUAD(A, B, C, D) ONEQUAD_TRANSPOSE(A, B, C, D)
+
+#define ONEQUAD_UNPCK(A, B, C, D)                    \
+    {                                                \
+        x_##A = _mm256_add_epi32(x_##A, orig##A);    \
+        x_##B = _mm256_add_epi32(x_##B, orig##B);    \
+        x_##C = _mm256_add_epi32(x_##C, orig##C);    \
+        x_##D = _mm256_add_epi32(x_##D, orig##D);    \
+        t_##A = _mm256_unpacklo_epi32(x_##A, x_##B); \
+        t_##B = _mm256_unpacklo_epi32(x_##C, x_##D); \
+        t_##C = _mm256_unpackhi_epi32(x_##A, x_##B); \
+        t_##D = _mm256_unpackhi_epi32(x_##C, x_##D); \
+        x_##A = _mm256_unpacklo_epi64(t_##A, t_##B); \
+        x_##B = _mm256_unpackhi_epi64(t_##A, t_##B); \
+        x_##C = _mm256_unpacklo_epi64(t_##C, t_##D); \
+        x_##D = _mm256_unpackhi_epi64(t_##C, t_##D); \
+    }
+
+#define ONEOCTO(A, B, C, D, A2, B2, C2, D2)                          \
+    {                                                                \
+        ONEQUAD_UNPCK(A, B, C, D);                                   \
+        ONEQUAD_UNPCK(A2, B2, C2, D2);                               \
+        t_##A  = _mm256_permute2x128_si256(x_##A, x_##A2, 0x20);     \
+        t_##A2 = _mm256_permute2x128_si256(x_##A, x_##A2, 0x31);     \
+        t_##B  = _mm256_permute2x128_si256(x_##B, x_##B2, 0x20);     \
+        t_##B2 = _mm256_permute2x128_si256(x_##B, x_##B2, 0x31);     \
+        t_##C  = _mm256_permute2x128_si256(x_##C, x_##C2, 0x20);     \
+        t_##C2 = _mm256_permute2x128_si256(x_##C, x_##C2, 0x31);     \
+        t_##D  = _mm256_permute2x128_si256(x_##D, x_##D2, 0x20);     \
+        t_##D2 = _mm256_permute2x128_si256(x_##D, x_##D2, 0x31);     \
+        t_##A  = _mm256_xor_si256(                                   \
+            t_##A, _mm256_loadu_si256((const __m256i*) (m + 0)));   \
+        t_##B = _mm256_xor_si256(                                    \
+            t_##B, _mm256_loadu_si256((const __m256i*) (m + 64)));   \
+        t_##C = _mm256_xor_si256(                                    \
+            t_##C, _mm256_loadu_si256((const __m256i*) (m + 128)));  \
+        t_##D = _mm256_xor_si256(                                    \
+            t_##D, _mm256_loadu_si256((const __m256i*) (m + 192)));  \
+        t_##A2 = _mm256_xor_si256(                                   \
+            t_##A2, _mm256_loadu_si256((const __m256i*) (m + 256))); \
+        t_##B2 = _mm256_xor_si256(                                   \
+            t_##B2, _mm256_loadu_si256((const __m256i*) (m + 320))); \
+        t_##C2 = _mm256_xor_si256(                                   \
+            t_##C2, _mm256_loadu_si256((const __m256i*) (m + 384))); \
+        t_##D2 = _mm256_xor_si256(                                   \
+            t_##D2, _mm256_loadu_si256((const __m256i*) (m + 448))); \
+        _mm256_storeu_si256((__m256i*) (c + 0), t_##A);              \
+        _mm256_storeu_si256((__m256i*) (c + 64), t_##B);             \
+        _mm256_storeu_si256((__m256i*) (c + 128), t_##C);            \
+        _mm256_storeu_si256((__m256i*) (c + 192), t_##D);            \
+        _mm256_storeu_si256((__m256i*) (c + 256), t_##A2);           \
+        _mm256_storeu_si256((__m256i*) (c + 320), t_##B2);           \
+        _mm256_storeu_si256((__m256i*) (c + 384), t_##C2);           \
+        _mm256_storeu_si256((__m256i*) (c + 448), t_##D2);           \
+    }
+
+        ONEOCTO(0, 1, 2, 3, 4, 5, 6, 7);
+        m += 32;
+        c += 32;
+        ONEOCTO(8, 9, 10, 11, 12, 13, 14, 15);
+        m -= 32;
+        c -= 32;
+
+#undef ONEQUAD
+#undef ONEQUAD_TRANSPOSE
+#undef ONEQUAD_UNPCK
+#undef ONEOCTO
+
+        bytes -= 512;
+        c += 512;
+        m += 512;
+    }
+}
+#undef VEC8_ROT
+#undef VEC8_QUARTERROUND
+#undef VEC8_QUARTERROUND_NAIVE
+#undef VEC8_QUARTERROUND_SHUFFLE
+#undef VEC8_QUARTERROUND_SHUFFLE2
+#undef VEC8_LINE1
+#undef VEC8_LINE2
+#undef VEC8_LINE3
+#undef VEC8_LINE4
+#undef VEC8_ROUND
+#undef VEC8_ROUND_SEQ
+#undef VEC8_ROUND_HALF
+#undef VEC8_ROUND_HALFANDHALF
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c b/vendor/external/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c
@@ -0,0 +1,312 @@
+
+/*
+ chacha-merged.c version 20080118
+ D. J. Bernstein
+ Public domain.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "core.h"
+#include "crypto_stream_chacha20.h"
+#include "private/common.h"
+#include "utils.h"
+
+#include "../stream_chacha20.h"
+#include "chacha20_ref.h"
+
+struct chacha_ctx {
+    uint32_t input[16];
+};
+
+typedef struct chacha_ctx chacha_ctx;
+
+#define U32C(v) (v##U)
+
+#define U32V(v) ((uint32_t)(v) &U32C(0xFFFFFFFF))
+
+#define ROTATE(v, c) (ROTL32(v, c))
+#define XOR(v, w) ((v) ^ (w))
+#define PLUS(v, w) (U32V((v) + (w)))
+#define PLUSONE(v) (PLUS((v), 1))
+
+#define QUARTERROUND(a, b, c, d) \
+    a = PLUS(a, b);              \
+    d = ROTATE(XOR(d, a), 16);   \
+    c = PLUS(c, d);              \
+    b = ROTATE(XOR(b, c), 12);   \
+    a = PLUS(a, b);              \
+    d = ROTATE(XOR(d, a), 8);    \
+    c = PLUS(c, d);              \
+    b = ROTATE(XOR(b, c), 7);
+
+static void
+chacha_keysetup(chacha_ctx *ctx, const uint8_t *k)
+{
+    ctx->input[0]  = U32C(0x61707865);
+    ctx->input[1]  = U32C(0x3320646e);
+    ctx->input[2]  = U32C(0x79622d32);
+    ctx->input[3]  = U32C(0x6b206574);
+    ctx->input[4]  = LOAD32_LE(k + 0);
+    ctx->input[5]  = LOAD32_LE(k + 4);
+    ctx->input[6]  = LOAD32_LE(k + 8);
+    ctx->input[7]  = LOAD32_LE(k + 12);
+    ctx->input[8]  = LOAD32_LE(k + 16);
+    ctx->input[9]  = LOAD32_LE(k + 20);
+    ctx->input[10] = LOAD32_LE(k + 24);
+    ctx->input[11] = LOAD32_LE(k + 28);
+}
+
+static void
+chacha_ivsetup(chacha_ctx *ctx, const uint8_t *iv, const uint8_t *counter)
+{
+    ctx->input[12] = counter == NULL ? 0 : LOAD32_LE(counter + 0);
+    ctx->input[13] = counter == NULL ? 0 : LOAD32_LE(counter + 4);
+    ctx->input[14] = LOAD32_LE(iv + 0);
+    ctx->input[15] = LOAD32_LE(iv + 4);
+}
+
+static void
+chacha_ietf_ivsetup(chacha_ctx *ctx, const uint8_t *iv, const uint8_t *counter)
+{
+    ctx->input[12] = counter == NULL ? 0 : LOAD32_LE(counter);
+    ctx->input[13] = LOAD32_LE(iv + 0);
+    ctx->input[14] = LOAD32_LE(iv + 4);
+    ctx->input[15] = LOAD32_LE(iv + 8);
+}
+
+static void
+chacha20_encrypt_bytes(chacha_ctx *ctx, const uint8_t *m, uint8_t *c,
+                       unsigned long long bytes)
+{
+    uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14,
+        x15;
+    uint32_t j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14,
+        j15;
+    uint8_t     *ctarget = NULL;
+    uint8_t      tmp[64];
+    unsigned int i;
+
+    if (!bytes) {
+        return; /* LCOV_EXCL_LINE */
+    }
+    j0  = ctx->input[0];
+    j1  = ctx->input[1];
+    j2  = ctx->input[2];
+    j3  = ctx->input[3];
+    j4  = ctx->input[4];
+    j5  = ctx->input[5];
+    j6  = ctx->input[6];
+    j7  = ctx->input[7];
+    j8  = ctx->input[8];
+    j9  = ctx->input[9];
+    j10 = ctx->input[10];
+    j11 = ctx->input[11];
+    j12 = ctx->input[12];
+    j13 = ctx->input[13];
+    j14 = ctx->input[14];
+    j15 = ctx->input[15];
+
+    for (;;) {
+        if (bytes < 64) {
+            memset(tmp, 0, 64);
+            for (i = 0; i < bytes; ++i) {
+                tmp[i] = m[i];
+            }
+            m       = tmp;
+            ctarget = c;
+            c       = tmp;
+        }
+        x0  = j0;
+        x1  = j1;
+        x2  = j2;
+        x3  = j3;
+        x4  = j4;
+        x5  = j5;
+        x6  = j6;
+        x7  = j7;
+        x8  = j8;
+        x9  = j9;
+        x10 = j10;
+        x11 = j11;
+        x12 = j12;
+        x13 = j13;
+        x14 = j14;
+        x15 = j15;
+        for (i = 20; i > 0; i -= 2) {
+            QUARTERROUND(x0, x4, x8, x12)
+            QUARTERROUND(x1, x5, x9, x13)
+            QUARTERROUND(x2, x6, x10, x14)
+            QUARTERROUND(x3, x7, x11, x15)
+            QUARTERROUND(x0, x5, x10, x15)
+            QUARTERROUND(x1, x6, x11, x12)
+            QUARTERROUND(x2, x7, x8, x13)
+            QUARTERROUND(x3, x4, x9, x14)
+        }
+        x0  = PLUS(x0, j0);
+        x1  = PLUS(x1, j1);
+        x2  = PLUS(x2, j2);
+        x3  = PLUS(x3, j3);
+        x4  = PLUS(x4, j4);
+        x5  = PLUS(x5, j5);
+        x6  = PLUS(x6, j6);
+        x7  = PLUS(x7, j7);
+        x8  = PLUS(x8, j8);
+        x9  = PLUS(x9, j9);
+        x10 = PLUS(x10, j10);
+        x11 = PLUS(x11, j11);
+        x12 = PLUS(x12, j12);
+        x13 = PLUS(x13, j13);
+        x14 = PLUS(x14, j14);
+        x15 = PLUS(x15, j15);
+
+        x0  = XOR(x0, LOAD32_LE(m + 0));
+        x1  = XOR(x1, LOAD32_LE(m + 4));
+        x2  = XOR(x2, LOAD32_LE(m + 8));
+        x3  = XOR(x3, LOAD32_LE(m + 12));
+        x4  = XOR(x4, LOAD32_LE(m + 16));
+        x5  = XOR(x5, LOAD32_LE(m + 20));
+        x6  = XOR(x6, LOAD32_LE(m + 24));
+        x7  = XOR(x7, LOAD32_LE(m + 28));
+        x8  = XOR(x8, LOAD32_LE(m + 32));
+        x9  = XOR(x9, LOAD32_LE(m + 36));
+        x10 = XOR(x10, LOAD32_LE(m + 40));
+        x11 = XOR(x11, LOAD32_LE(m + 44));
+        x12 = XOR(x12, LOAD32_LE(m + 48));
+        x13 = XOR(x13, LOAD32_LE(m + 52));
+        x14 = XOR(x14, LOAD32_LE(m + 56));
+        x15 = XOR(x15, LOAD32_LE(m + 60));
+
+        j12 = PLUSONE(j12);
+        /* LCOV_EXCL_START */
+        if (!j12) {
+            j13 = PLUSONE(j13);
+        }
+        /* LCOV_EXCL_STOP */
+
+        STORE32_LE(c + 0, x0);
+        STORE32_LE(c + 4, x1);
+        STORE32_LE(c + 8, x2);
+        STORE32_LE(c + 12, x3);
+        STORE32_LE(c + 16, x4);
+        STORE32_LE(c + 20, x5);
+        STORE32_LE(c + 24, x6);
+        STORE32_LE(c + 28, x7);
+        STORE32_LE(c + 32, x8);
+        STORE32_LE(c + 36, x9);
+        STORE32_LE(c + 40, x10);
+        STORE32_LE(c + 44, x11);
+        STORE32_LE(c + 48, x12);
+        STORE32_LE(c + 52, x13);
+        STORE32_LE(c + 56, x14);
+        STORE32_LE(c + 60, x15);
+
+        if (bytes <= 64) {
+            if (bytes < 64) {
+                for (i = 0; i < (unsigned int) bytes; ++i) {
+                    ctarget[i] = c[i]; /* ctarget cannot be NULL */
+                }
+            }
+            ctx->input[12] = j12;
+            ctx->input[13] = j13;
+
+            return;
+        }
+        bytes -= 64;
+        c += 64;
+        m += 64;
+    }
+}
+
+static int
+stream_ref(unsigned char *c, unsigned long long clen, const unsigned char *n,
+           const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+
+    if (!clen) {
+        return 0;
+    }
+    COMPILER_ASSERT(crypto_stream_chacha20_KEYBYTES == 256 / 8);
+    chacha_keysetup(&ctx, k);
+    chacha_ivsetup(&ctx, n, NULL);
+    memset(c, 0, clen);
+    chacha20_encrypt_bytes(&ctx, c, c, clen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+static int
+stream_ietf_ext_ref(unsigned char *c, unsigned long long clen,
+                    const unsigned char *n, const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+
+    if (!clen) {
+        return 0;
+    }
+    COMPILER_ASSERT(crypto_stream_chacha20_KEYBYTES == 256 / 8);
+    chacha_keysetup(&ctx, k);
+    chacha_ietf_ivsetup(&ctx, n, NULL);
+    memset(c, 0, clen);
+    chacha20_encrypt_bytes(&ctx, c, c, clen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+static int
+stream_ref_xor_ic(unsigned char *c, const unsigned char *m,
+                  unsigned long long mlen, const unsigned char *n, uint64_t ic,
+                  const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+    uint8_t           ic_bytes[8];
+    uint32_t          ic_high;
+    uint32_t          ic_low;
+
+    if (!mlen) {
+        return 0;
+    }
+    ic_high = U32V(ic >> 32);
+    ic_low  = U32V(ic);
+    STORE32_LE(&ic_bytes[0], ic_low);
+    STORE32_LE(&ic_bytes[4], ic_high);
+    chacha_keysetup(&ctx, k);
+    chacha_ivsetup(&ctx, n, ic_bytes);
+    chacha20_encrypt_bytes(&ctx, m, c, mlen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+static int
+stream_ietf_ext_ref_xor_ic(unsigned char *c, const unsigned char *m,
+                           unsigned long long mlen, const unsigned char *n,
+                           uint32_t ic, const unsigned char *k)
+{
+    struct chacha_ctx ctx;
+    uint8_t           ic_bytes[4];
+
+    if (!mlen) {
+        return 0;
+    }
+    STORE32_LE(ic_bytes, ic);
+    chacha_keysetup(&ctx, k);
+    chacha_ietf_ivsetup(&ctx, n, ic_bytes);
+    chacha20_encrypt_bytes(&ctx, m, c, mlen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+struct crypto_stream_chacha20_implementation
+    crypto_stream_chacha20_ref_implementation = {
+        SODIUM_C99(.stream =) stream_ref,
+        SODIUM_C99(.stream_ietf_ext =) stream_ietf_ext_ref,
+        SODIUM_C99(.stream_xor_ic =) stream_ref_xor_ic,
+        SODIUM_C99(.stream_ietf_ext_xor_ic =) stream_ietf_ext_ref_xor_ic
+    };
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/ref/chacha20_ref.h b/vendor/external/libsodium/crypto_stream/chacha20/ref/chacha20_ref.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/ref/chacha20_ref.h
@@ -0,0 +1,8 @@
+
+#include <stdint.h>
+
+#include "../stream_chacha20.h"
+#include "crypto_stream_chacha20.h"
+
+extern struct crypto_stream_chacha20_implementation
+    crypto_stream_chacha20_ref_implementation;
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/stream_chacha20.c b/vendor/external/libsodium/crypto_stream/chacha20/stream_chacha20.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/stream_chacha20.c
@@ -0,0 +1,184 @@
+#include "crypto_stream_chacha20.h"
+#include "core.h"
+#include "private/chacha20_ietf_ext.h"
+#include "private/common.h"
+#include "private/implementations.h"
+#include "randombytes.h"
+#include "runtime.h"
+#include "stream_chacha20.h"
+
+#include "ref/chacha20_ref.h"
+#if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \
+    defined(HAVE_TMMINTRIN_H) && defined(HAVE_SMMINTRIN_H)
+# include "dolbeau/chacha20_dolbeau-avx2.h"
+#endif
+#if defined(HAVE_EMMINTRIN_H) && defined(HAVE_TMMINTRIN_H)
+# include "dolbeau/chacha20_dolbeau-ssse3.h"
+#endif
+
+static const crypto_stream_chacha20_implementation *implementation =
+    &crypto_stream_chacha20_ref_implementation;
+
+size_t
+crypto_stream_chacha20_keybytes(void) {
+    return crypto_stream_chacha20_KEYBYTES;
+}
+
+size_t
+crypto_stream_chacha20_noncebytes(void) {
+    return crypto_stream_chacha20_NONCEBYTES;
+}
+
+size_t
+crypto_stream_chacha20_messagebytes_max(void)
+{
+    return crypto_stream_chacha20_MESSAGEBYTES_MAX;
+}
+
+size_t
+crypto_stream_chacha20_ietf_keybytes(void) {
+    return crypto_stream_chacha20_ietf_KEYBYTES;
+}
+
+size_t
+crypto_stream_chacha20_ietf_noncebytes(void) {
+    return crypto_stream_chacha20_ietf_NONCEBYTES;
+}
+
+size_t
+crypto_stream_chacha20_ietf_messagebytes_max(void)
+{
+    return crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX;
+}
+
+int
+crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
+                       const unsigned char *n, const unsigned char *k)
+{
+    if (clen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    return implementation->stream(c, clen, n, k);
+}
+
+int
+crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m,
+                              unsigned long long mlen,
+                              const unsigned char *n, uint64_t ic,
+                              const unsigned char *k)
+{
+    if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    return implementation->stream_xor_ic(c, m, mlen, n, ic, k);
+}
+
+int
+crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m,
+                           unsigned long long mlen, const unsigned char *n,
+                           const unsigned char *k)
+{
+    if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    return implementation->stream_xor_ic(c, m, mlen, n, 0U, k);
+}
+
+int
+crypto_stream_chacha20_ietf_ext(unsigned char *c, unsigned long long clen,
+                                const unsigned char *n, const unsigned char *k)
+{
+    if (clen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    return implementation->stream_ietf_ext(c, clen, n, k);
+}
+
+int
+crypto_stream_chacha20_ietf_ext_xor_ic(unsigned char *c, const unsigned char *m,
+                                       unsigned long long mlen,
+                                       const unsigned char *n, uint32_t ic,
+                                       const unsigned char *k)
+{
+    if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    return implementation->stream_ietf_ext_xor_ic(c, m, mlen, n, ic, k);
+}
+
+static int
+crypto_stream_chacha20_ietf_ext_xor(unsigned char *c, const unsigned char *m,
+                                    unsigned long long mlen, const unsigned char *n,
+                                    const unsigned char *k)
+{
+    if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    return implementation->stream_ietf_ext_xor_ic(c, m, mlen, n, 0U, k);
+}
+
+int
+crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen,
+                            const unsigned char *n, const unsigned char *k)
+{
+    if (clen > crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    return crypto_stream_chacha20_ietf_ext(c, clen, n, k);
+}
+
+int
+crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m,
+                                   unsigned long long mlen,
+                                   const unsigned char *n, uint32_t ic,
+                                   const unsigned char *k)
+{
+    if ((unsigned long long) ic >
+        (64ULL * (1ULL << 32)) / 64ULL - (mlen + 63ULL) / 64ULL) {
+        sodium_misuse();
+    }
+    return crypto_stream_chacha20_ietf_ext_xor_ic(c, m, mlen, n, ic, k);
+}
+
+int
+crypto_stream_chacha20_ietf_xor(unsigned char *c, const unsigned char *m,
+                                unsigned long long mlen, const unsigned char *n,
+                                const unsigned char *k)
+{
+    if (mlen > crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX) {
+        sodium_misuse();
+    }
+    return crypto_stream_chacha20_ietf_ext_xor(c, m, mlen, n, k);
+}
+
+void
+crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES])
+{
+    randombytes_buf(k, crypto_stream_chacha20_ietf_KEYBYTES);
+}
+
+void
+crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES])
+{
+    randombytes_buf(k, crypto_stream_chacha20_KEYBYTES);
+}
+
+int
+_crypto_stream_chacha20_pick_best_implementation(void)
+{
+    implementation = &crypto_stream_chacha20_ref_implementation;
+#if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \
+    defined(HAVE_TMMINTRIN_H) && defined(HAVE_SMMINTRIN_H)
+    if (sodium_runtime_has_avx2()) {
+        implementation = &crypto_stream_chacha20_dolbeau_avx2_implementation;
+        return 0;
+    }
+#endif
+#if defined(HAVE_EMMINTRIN_H) && defined(HAVE_TMMINTRIN_H)
+    if (sodium_runtime_has_ssse3()) {
+        implementation = &crypto_stream_chacha20_dolbeau_ssse3_implementation;
+        return 0;
+    }
+#endif
+    return 0;
+}
diff --git a/vendor/external/libsodium/crypto_stream/chacha20/stream_chacha20.h b/vendor/external/libsodium/crypto_stream/chacha20/stream_chacha20.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/chacha20/stream_chacha20.h
@@ -0,0 +1,22 @@
+
+#ifndef stream_chacha20_H
+#define stream_chacha20_H
+
+#include <stdint.h>
+
+typedef struct crypto_stream_chacha20_implementation {
+    int (*stream)(unsigned char *c, unsigned long long clen,
+                  const unsigned char *n, const unsigned char *k);
+    int (*stream_ietf_ext)(unsigned char *c, unsigned long long clen,
+                           const unsigned char *n, const unsigned char *k);
+    int (*stream_xor_ic)(unsigned char *c, const unsigned char *m,
+                         unsigned long long mlen,
+                         const unsigned char *n, uint64_t ic,
+                         const unsigned char *k);
+    int (*stream_ietf_ext_xor_ic)(unsigned char *c, const unsigned char *m,
+                                  unsigned long long mlen,
+                                  const unsigned char *n, uint32_t ic,
+                                  const unsigned char *k);
+} crypto_stream_chacha20_implementation;
+
+#endif
diff --git a/vendor/external/libsodium/crypto_stream/crypto_stream.c b/vendor/external/libsodium/crypto_stream/crypto_stream.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/crypto_stream.c
@@ -0,0 +1,49 @@
+
+#include "crypto_stream.h"
+#include "randombytes.h"
+
+size_t
+crypto_stream_keybytes(void)
+{
+    return crypto_stream_KEYBYTES;
+}
+
+size_t
+crypto_stream_noncebytes(void)
+{
+    return crypto_stream_NONCEBYTES;
+}
+
+size_t
+crypto_stream_messagebytes_max(void)
+{
+    return crypto_stream_MESSAGEBYTES_MAX;
+}
+
+const char *
+crypto_stream_primitive(void)
+{
+    return crypto_stream_PRIMITIVE;
+}
+
+int
+crypto_stream(unsigned char *c, unsigned long long clen,
+              const unsigned char *n, const unsigned char *k)
+{
+    return crypto_stream_xsalsa20(c, clen, n, k);
+}
+
+
+int
+crypto_stream_xor(unsigned char *c, const unsigned char *m,
+                  unsigned long long mlen, const unsigned char *n,
+                  const unsigned char *k)
+{
+    return crypto_stream_xsalsa20_xor(c, m, mlen, n, k);
+}
+
+void
+crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES])
+{
+    randombytes_buf(k, crypto_stream_KEYBYTES);
+}
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/ref/salsa20_ref.c b/vendor/external/libsodium/crypto_stream/salsa20/ref/salsa20_ref.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/ref/salsa20_ref.c
@@ -0,0 +1,120 @@
+/*
+version 20140420
+D. J. Bernstein
+Public domain.
+*/
+
+#include <stdint.h>
+
+#include "crypto_core_salsa20.h"
+#include "crypto_stream_salsa20.h"
+#include "utils.h"
+
+#include "../stream_salsa20.h"
+#include "salsa20_ref.h"
+
+#ifndef HAVE_AMD64_ASM
+
+static int
+stream_ref(unsigned char *c, unsigned long long clen, const unsigned char *n,
+           const unsigned char *k)
+{
+    unsigned char in[16];
+    unsigned char block[64];
+    unsigned char kcopy[32];
+    unsigned int  i;
+    unsigned int  u;
+
+    if (!clen) {
+        return 0;
+    }
+    for (i = 0; i < 32; i++) {
+        kcopy[i] = k[i];
+    }
+    for (i = 0; i < 8; i++) {
+        in[i] = n[i];
+    }
+    for (i = 8; i < 16; i++) {
+        in[i] = 0;
+    }
+    while (clen >= 64) {
+        crypto_core_salsa20(c, in, kcopy, NULL);
+        u = 1;
+        for (i = 8; i < 16; i++) {
+            u += (unsigned int) in[i];
+            in[i] = u;
+            u >>= 8;
+        }
+        clen -= 64;
+        c += 64;
+    }
+    if (clen) {
+        crypto_core_salsa20(block, in, kcopy, NULL);
+        for (i = 0; i < (unsigned int) clen; i++) {
+            c[i] = block[i];
+        }
+    }
+    sodium_memzero(block, sizeof block);
+    sodium_memzero(kcopy, sizeof kcopy);
+
+    return 0;
+}
+
+static int
+stream_ref_xor_ic(unsigned char *c, const unsigned char *m,
+                  unsigned long long mlen, const unsigned char *n, uint64_t ic,
+                  const unsigned char *k)
+{
+    unsigned char in[16];
+    unsigned char block[64];
+    unsigned char kcopy[32];
+    unsigned int  i;
+    unsigned int  u;
+
+    if (!mlen) {
+        return 0;
+    }
+    for (i = 0; i < 32; i++) {
+        kcopy[i] = k[i];
+    }
+    for (i = 0; i < 8; i++) {
+        in[i] = n[i];
+    }
+    for (i = 8; i < 16; i++) {
+        in[i] = (unsigned char) (ic & 0xff);
+        ic >>= 8;
+    }
+    while (mlen >= 64) {
+        crypto_core_salsa20(block, in, kcopy, NULL);
+        for (i = 0; i < 64; i++) {
+            c[i] = m[i] ^ block[i];
+        }
+        u = 1;
+        for (i = 8; i < 16; i++) {
+            u += (unsigned int) in[i];
+            in[i] = u;
+            u >>= 8;
+        }
+        mlen -= 64;
+        c += 64;
+        m += 64;
+    }
+    if (mlen) {
+        crypto_core_salsa20(block, in, kcopy, NULL);
+        for (i = 0; i < (unsigned int) mlen; i++) {
+            c[i] = m[i] ^ block[i];
+        }
+    }
+    sodium_memzero(block, sizeof block);
+    sodium_memzero(kcopy, sizeof kcopy);
+
+    return 0;
+}
+
+struct crypto_stream_salsa20_implementation
+    crypto_stream_salsa20_ref_implementation = {
+        SODIUM_C99(.stream =) stream_ref,
+        SODIUM_C99(.stream_xor_ic =) stream_ref_xor_ic,
+    };
+
+#endif
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/ref/salsa20_ref.h b/vendor/external/libsodium/crypto_stream/salsa20/ref/salsa20_ref.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/ref/salsa20_ref.h
@@ -0,0 +1,8 @@
+
+#include <stdint.h>
+
+#include "../stream_salsa20.h"
+#include "crypto_stream_salsa20.h"
+
+extern struct crypto_stream_salsa20_implementation
+    crypto_stream_salsa20_ref_implementation;
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/stream_salsa20.c b/vendor/external/libsodium/crypto_stream/salsa20/stream_salsa20.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/stream_salsa20.c
@@ -0,0 +1,100 @@
+#include "crypto_stream_salsa20.h"
+#include "private/common.h"
+#include "private/implementations.h"
+#include "randombytes.h"
+#include "runtime.h"
+#include "stream_salsa20.h"
+
+#ifdef HAVE_AMD64_ASM
+# include "xmm6/salsa20_xmm6.h"
+#else
+# include "ref/salsa20_ref.h"
+#endif
+#if !defined(HAVE_AMD64_ASM) && defined(HAVE_EMMINTRIN_H)
+# include "xmm6int/salsa20_xmm6int-sse2.h"
+#endif
+#if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \
+    defined(HAVE_TMMINTRIN_H) && defined(HAVE_SMMINTRIN_H)
+# include "xmm6int/salsa20_xmm6int-avx2.h"
+#endif
+
+#if HAVE_AMD64_ASM
+static const crypto_stream_salsa20_implementation *implementation =
+    &crypto_stream_salsa20_xmm6_implementation;
+#else
+static const crypto_stream_salsa20_implementation *implementation =
+    &crypto_stream_salsa20_ref_implementation;
+#endif
+
+size_t
+crypto_stream_salsa20_keybytes(void)
+{
+    return crypto_stream_salsa20_KEYBYTES;
+}
+
+size_t
+crypto_stream_salsa20_noncebytes(void)
+{
+    return crypto_stream_salsa20_NONCEBYTES;
+}
+
+size_t
+crypto_stream_salsa20_messagebytes_max(void)
+{
+    return crypto_stream_salsa20_MESSAGEBYTES_MAX;
+}
+
+int
+crypto_stream_salsa20(unsigned char *c, unsigned long long clen,
+                      const unsigned char *n, const unsigned char *k)
+{
+    return implementation->stream(c, clen, n, k);
+}
+
+int
+crypto_stream_salsa20_xor_ic(unsigned char *c, const unsigned char *m,
+                             unsigned long long mlen,
+                             const unsigned char *n, uint64_t ic,
+                             const unsigned char *k)
+{
+    return implementation->stream_xor_ic(c, m, mlen, n, ic, k);
+}
+
+int
+crypto_stream_salsa20_xor(unsigned char *c, const unsigned char *m,
+                          unsigned long long mlen, const unsigned char *n,
+                          const unsigned char *k)
+{
+    return implementation->stream_xor_ic(c, m, mlen, n, 0U, k);
+}
+
+void
+crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES])
+{
+    randombytes_buf(k, crypto_stream_salsa20_KEYBYTES);
+}
+
+int
+_crypto_stream_salsa20_pick_best_implementation(void)
+{
+#ifdef HAVE_AMD64_ASM
+    implementation = &crypto_stream_salsa20_xmm6_implementation;
+#else
+    implementation = &crypto_stream_salsa20_ref_implementation;
+#endif
+
+#if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \
+    defined(HAVE_TMMINTRIN_H) && defined(HAVE_SMMINTRIN_H)
+    if (sodium_runtime_has_avx2()) {
+        implementation = &crypto_stream_salsa20_xmm6int_avx2_implementation;
+        return 0;
+    }
+#endif
+#if !defined(HAVE_AMD64_ASM) && defined(HAVE_EMMINTRIN_H)
+    if (sodium_runtime_has_sse2()) {
+        implementation = &crypto_stream_salsa20_xmm6int_sse2_implementation;
+        return 0;
+    }
+#endif
+    return 0; /* LCOV_EXCL_LINE */
+}
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/stream_salsa20.h b/vendor/external/libsodium/crypto_stream/salsa20/stream_salsa20.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/stream_salsa20.h
@@ -0,0 +1,16 @@
+
+#ifndef stream_salsa20_H
+#define stream_salsa20_H
+
+#include <stdint.h>
+
+typedef struct crypto_stream_salsa20_implementation {
+    int (*stream)(unsigned char *c, unsigned long long clen,
+                  const unsigned char *n, const unsigned char *k);
+    int (*stream_xor_ic)(unsigned char *c, const unsigned char *m,
+                         unsigned long long mlen,
+                         const unsigned char *n, uint64_t ic,
+                         const unsigned char *k);
+} crypto_stream_salsa20_implementation;
+
+#endif
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.c b/vendor/external/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.c
@@ -0,0 +1,31 @@
+
+#include <stdint.h>
+
+#include "utils.h"
+
+#include "../stream_salsa20.h"
+#include "salsa20_xmm6.h"
+
+#ifdef HAVE_AMD64_ASM
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int stream_salsa20_xmm6(unsigned char *c, unsigned long long clen,
+                               const unsigned char *n, const unsigned char *k);
+
+extern int stream_salsa20_xmm6_xor_ic(unsigned char *c, const unsigned char *m,
+                                      unsigned long long mlen,
+                                      const unsigned char *n,
+                                      uint64_t ic, const unsigned char *k);
+#ifdef __cplusplus
+}
+#endif
+
+struct crypto_stream_salsa20_implementation
+    crypto_stream_salsa20_xmm6_implementation = {
+        SODIUM_C99(.stream =) stream_salsa20_xmm6,
+        SODIUM_C99(.stream_xor_ic =) stream_salsa20_xmm6_xor_ic,
+    };
+
+#endif
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.h b/vendor/external/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.h
@@ -0,0 +1,8 @@
+
+#include <stdint.h>
+
+#include "../stream_salsa20.h"
+#include "crypto_stream_salsa20.h"
+
+extern struct crypto_stream_salsa20_implementation
+    crypto_stream_salsa20_xmm6_implementation;
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.c b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.c
@@ -0,0 +1,131 @@
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "crypto_stream_salsa20.h"
+#include "private/common.h"
+#include "utils.h"
+
+#if defined(HAVE_AVX2INTRIN_H) && defined(HAVE_EMMINTRIN_H) && \
+    defined(HAVE_TMMINTRIN_H) && defined(HAVE_SMMINTRIN_H)
+
+# ifdef __GNUC__
+#  pragma GCC target("sse2")
+#  pragma GCC target("ssse3")
+#  pragma GCC target("sse4.1")
+#  pragma GCC target("avx2")
+# endif
+
+#include <emmintrin.h>
+#include <immintrin.h>
+#include <smmintrin.h>
+#include <tmmintrin.h>
+#include "private/sse2_64_32.h"
+
+# include "../stream_salsa20.h"
+# include "salsa20_xmm6int-avx2.h"
+
+# define ROUNDS 20
+
+typedef struct salsa_ctx {
+    uint32_t input[16];
+} salsa_ctx;
+
+static const int TR[16] = {
+    0, 5, 10, 15, 12, 1, 6, 11, 8, 13, 2, 7, 4, 9, 14, 3
+};
+
+static void
+salsa_keysetup(salsa_ctx *ctx, const uint8_t *k)
+{
+    ctx->input[TR[1]]  = LOAD32_LE(k + 0);
+    ctx->input[TR[2]]  = LOAD32_LE(k + 4);
+    ctx->input[TR[3]]  = LOAD32_LE(k + 8);
+    ctx->input[TR[4]]  = LOAD32_LE(k + 12);
+    ctx->input[TR[11]] = LOAD32_LE(k + 16);
+    ctx->input[TR[12]] = LOAD32_LE(k + 20);
+    ctx->input[TR[13]] = LOAD32_LE(k + 24);
+    ctx->input[TR[14]] = LOAD32_LE(k + 28);
+    ctx->input[TR[0]]  = 0x61707865;
+    ctx->input[TR[5]]  = 0x3320646e;
+    ctx->input[TR[10]] = 0x79622d32;
+    ctx->input[TR[15]] = 0x6b206574;
+}
+
+static void
+salsa_ivsetup(salsa_ctx *ctx, const uint8_t *iv, const uint8_t *counter)
+{
+    ctx->input[TR[6]] = LOAD32_LE(iv + 0);
+    ctx->input[TR[7]] = LOAD32_LE(iv + 4);
+    ctx->input[TR[8]] = counter == NULL ? 0 : LOAD32_LE(counter + 0);
+    ctx->input[TR[9]] = counter == NULL ? 0 : LOAD32_LE(counter + 4);
+}
+
+static void
+salsa20_encrypt_bytes(salsa_ctx *ctx, const uint8_t *m, uint8_t *c,
+                      unsigned long long bytes)
+{
+    uint32_t * const x = &ctx->input[0];
+
+    if (!bytes) {
+        return; /* LCOV_EXCL_LINE */
+    }
+
+#include "u8.h"
+#include "u4.h"
+#include "u1.h"
+#include "u0.h"
+}
+
+static int
+stream_avx2(unsigned char *c, unsigned long long clen, const unsigned char *n,
+            const unsigned char *k)
+{
+    struct salsa_ctx ctx;
+
+    if (!clen) {
+        return 0;
+    }
+    COMPILER_ASSERT(crypto_stream_salsa20_KEYBYTES == 256 / 8);
+    salsa_keysetup(&ctx, k);
+    salsa_ivsetup(&ctx, n, NULL);
+    memset(c, 0, clen);
+    salsa20_encrypt_bytes(&ctx, c, c, clen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+static int
+stream_avx2_xor_ic(unsigned char *c, const unsigned char *m,
+                   unsigned long long mlen, const unsigned char *n, uint64_t ic,
+                   const unsigned char *k)
+{
+    struct salsa_ctx ctx;
+    uint8_t          ic_bytes[8];
+    uint32_t         ic_high;
+    uint32_t         ic_low;
+
+    if (!mlen) {
+        return 0;
+    }
+    ic_high = (uint32_t) (ic >> 32);
+    ic_low  = (uint32_t) ic;
+    STORE32_LE(&ic_bytes[0], ic_low);
+    STORE32_LE(&ic_bytes[4], ic_high);
+    salsa_keysetup(&ctx, k);
+    salsa_ivsetup(&ctx, n, ic_bytes);
+    salsa20_encrypt_bytes(&ctx, m, c, mlen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+struct crypto_stream_salsa20_implementation
+    crypto_stream_salsa20_xmm6int_avx2_implementation = {
+        SODIUM_C99(.stream =) stream_avx2,
+        SODIUM_C99(.stream_xor_ic =) stream_avx2_xor_ic
+    };
+
+#endif
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.h b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.h
@@ -0,0 +1,8 @@
+
+#include <stdint.h>
+
+#include "../stream_salsa20.h"
+#include "crypto_stream_salsa20.h"
+
+extern struct crypto_stream_salsa20_implementation
+    crypto_stream_salsa20_xmm6int_avx2_implementation;
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c
@@ -0,0 +1,122 @@
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "crypto_stream_salsa20.h"
+#include "private/common.h"
+#include "utils.h"
+
+#ifdef HAVE_EMMINTRIN_H
+
+# ifdef __GNUC__
+#  pragma GCC target("sse2")
+# endif
+# include <emmintrin.h>
+# include "private/sse2_64_32.h"
+
+# include "../stream_salsa20.h"
+# include "salsa20_xmm6int-sse2.h"
+
+# define ROUNDS 20
+
+typedef struct salsa_ctx {
+    uint32_t input[16];
+} salsa_ctx;
+
+static const int TR[16] = {
+    0, 5, 10, 15, 12, 1, 6, 11, 8, 13, 2, 7, 4, 9, 14, 3
+};
+
+static void
+salsa_keysetup(salsa_ctx *ctx, const uint8_t *k)
+{
+    ctx->input[TR[1]]  = LOAD32_LE(k + 0);
+    ctx->input[TR[2]]  = LOAD32_LE(k + 4);
+    ctx->input[TR[3]]  = LOAD32_LE(k + 8);
+    ctx->input[TR[4]]  = LOAD32_LE(k + 12);
+    ctx->input[TR[11]] = LOAD32_LE(k + 16);
+    ctx->input[TR[12]] = LOAD32_LE(k + 20);
+    ctx->input[TR[13]] = LOAD32_LE(k + 24);
+    ctx->input[TR[14]] = LOAD32_LE(k + 28);
+    ctx->input[TR[0]]  = 0x61707865;
+    ctx->input[TR[5]]  = 0x3320646e;
+    ctx->input[TR[10]] = 0x79622d32;
+    ctx->input[TR[15]] = 0x6b206574;
+}
+
+static void
+salsa_ivsetup(salsa_ctx *ctx, const uint8_t *iv, const uint8_t *counter)
+{
+    ctx->input[TR[6]] = LOAD32_LE(iv + 0);
+    ctx->input[TR[7]] = LOAD32_LE(iv + 4);
+    ctx->input[TR[8]] = counter == NULL ? 0 : LOAD32_LE(counter + 0);
+    ctx->input[TR[9]] = counter == NULL ? 0 : LOAD32_LE(counter + 4);
+}
+
+static void
+salsa20_encrypt_bytes(salsa_ctx *ctx, const uint8_t *m, uint8_t *c,
+                      unsigned long long bytes)
+{
+    uint32_t * const x = &ctx->input[0];
+
+    if (!bytes) {
+        return; /* LCOV_EXCL_LINE */
+    }
+
+#include "u4.h"
+#include "u1.h"
+#include "u0.h"
+}
+
+static int
+stream_sse2(unsigned char *c, unsigned long long clen, const unsigned char *n,
+            const unsigned char *k)
+{
+    struct salsa_ctx ctx;
+
+    if (!clen) {
+        return 0;
+    }
+    COMPILER_ASSERT(crypto_stream_salsa20_KEYBYTES == 256 / 8);
+    salsa_keysetup(&ctx, k);
+    salsa_ivsetup(&ctx, n, NULL);
+    memset(c, 0, clen);
+    salsa20_encrypt_bytes(&ctx, c, c, clen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+static int
+stream_sse2_xor_ic(unsigned char *c, const unsigned char *m,
+                   unsigned long long mlen, const unsigned char *n, uint64_t ic,
+                   const unsigned char *k)
+{
+    struct salsa_ctx ctx;
+    uint8_t          ic_bytes[8];
+    uint32_t         ic_high;
+    uint32_t         ic_low;
+
+    if (!mlen) {
+        return 0;
+    }
+    ic_high = (uint32_t) (ic >> 32);
+    ic_low  = (uint32_t) (ic);
+    STORE32_LE(&ic_bytes[0], ic_low);
+    STORE32_LE(&ic_bytes[4], ic_high);
+    salsa_keysetup(&ctx, k);
+    salsa_ivsetup(&ctx, n, ic_bytes);
+    salsa20_encrypt_bytes(&ctx, m, c, mlen);
+    sodium_memzero(&ctx, sizeof ctx);
+
+    return 0;
+}
+
+struct crypto_stream_salsa20_implementation
+    crypto_stream_salsa20_xmm6int_sse2_implementation = {
+        SODIUM_C99(.stream =) stream_sse2,
+        SODIUM_C99(.stream_xor_ic =) stream_sse2_xor_ic
+    };
+
+#endif
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.h b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.h
@@ -0,0 +1,8 @@
+
+#include <stdint.h>
+
+#include "../stream_salsa20.h"
+#include "crypto_stream_salsa20.h"
+
+extern struct crypto_stream_salsa20_implementation
+    crypto_stream_salsa20_xmm6int_sse2_implementation;
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u0.h b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u0.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u0.h
@@ -0,0 +1,195 @@
+if (bytes > 0) {
+    __m128i diag0 = _mm_loadu_si128((const __m128i *) (x + 0));
+    __m128i diag1 = _mm_loadu_si128((const __m128i *) (x + 4));
+    __m128i diag2 = _mm_loadu_si128((const __m128i *) (x + 8));
+    __m128i diag3 = _mm_loadu_si128((const __m128i *) (x + 12));
+    __m128i a0, a1, a2, a3, a4, a5, a6, a7;
+    __m128i b0, b1, b2, b3, b4, b5, b6, b7;
+    uint8_t partialblock[64] = { 0 };
+
+    unsigned int i;
+
+    a0 = diag1;
+    for (i = 0; i < ROUNDS; i += 4) {
+        a0    = _mm_add_epi32(a0, diag0);
+        a1    = diag0;
+        b0    = a0;
+        a0    = _mm_slli_epi32(a0, 7);
+        b0    = _mm_srli_epi32(b0, 25);
+        diag3 = _mm_xor_si128(diag3, a0);
+
+        diag3 = _mm_xor_si128(diag3, b0);
+
+        a1    = _mm_add_epi32(a1, diag3);
+        a2    = diag3;
+        b1    = a1;
+        a1    = _mm_slli_epi32(a1, 9);
+        b1    = _mm_srli_epi32(b1, 23);
+        diag2 = _mm_xor_si128(diag2, a1);
+        diag3 = _mm_shuffle_epi32(diag3, 0x93);
+        diag2 = _mm_xor_si128(diag2, b1);
+
+        a2    = _mm_add_epi32(a2, diag2);
+        a3    = diag2;
+        b2    = a2;
+        a2    = _mm_slli_epi32(a2, 13);
+        b2    = _mm_srli_epi32(b2, 19);
+        diag1 = _mm_xor_si128(diag1, a2);
+        diag2 = _mm_shuffle_epi32(diag2, 0x4e);
+        diag1 = _mm_xor_si128(diag1, b2);
+
+        a3    = _mm_add_epi32(a3, diag1);
+        a4    = diag3;
+        b3    = a3;
+        a3    = _mm_slli_epi32(a3, 18);
+        b3    = _mm_srli_epi32(b3, 14);
+        diag0 = _mm_xor_si128(diag0, a3);
+        diag1 = _mm_shuffle_epi32(diag1, 0x39);
+        diag0 = _mm_xor_si128(diag0, b3);
+
+        a4    = _mm_add_epi32(a4, diag0);
+        a5    = diag0;
+        b4    = a4;
+        a4    = _mm_slli_epi32(a4, 7);
+        b4    = _mm_srli_epi32(b4, 25);
+        diag1 = _mm_xor_si128(diag1, a4);
+
+        diag1 = _mm_xor_si128(diag1, b4);
+
+        a5    = _mm_add_epi32(a5, diag1);
+        a6    = diag1;
+        b5    = a5;
+        a5    = _mm_slli_epi32(a5, 9);
+        b5    = _mm_srli_epi32(b5, 23);
+        diag2 = _mm_xor_si128(diag2, a5);
+        diag1 = _mm_shuffle_epi32(diag1, 0x93);
+        diag2 = _mm_xor_si128(diag2, b5);
+
+        a6    = _mm_add_epi32(a6, diag2);
+        a7    = diag2;
+        b6    = a6;
+        a6    = _mm_slli_epi32(a6, 13);
+        b6    = _mm_srli_epi32(b6, 19);
+        diag3 = _mm_xor_si128(diag3, a6);
+        diag2 = _mm_shuffle_epi32(diag2, 0x4e);
+        diag3 = _mm_xor_si128(diag3, b6);
+
+        a7    = _mm_add_epi32(a7, diag3);
+        a0    = diag1;
+        b7    = a7;
+        a7    = _mm_slli_epi32(a7, 18);
+        b7    = _mm_srli_epi32(b7, 14);
+        diag0 = _mm_xor_si128(diag0, a7);
+        diag3 = _mm_shuffle_epi32(diag3, 0x39);
+        diag0 = _mm_xor_si128(diag0, b7);
+
+        a0    = _mm_add_epi32(a0, diag0);
+        a1    = diag0;
+        b0    = a0;
+        a0    = _mm_slli_epi32(a0, 7);
+        b0    = _mm_srli_epi32(b0, 25);
+        diag3 = _mm_xor_si128(diag3, a0);
+
+        diag3 = _mm_xor_si128(diag3, b0);
+
+        a1    = _mm_add_epi32(a1, diag3);
+        a2    = diag3;
+        b1    = a1;
+        a1    = _mm_slli_epi32(a1, 9);
+        b1    = _mm_srli_epi32(b1, 23);
+        diag2 = _mm_xor_si128(diag2, a1);
+        diag3 = _mm_shuffle_epi32(diag3, 0x93);
+        diag2 = _mm_xor_si128(diag2, b1);
+
+        a2    = _mm_add_epi32(a2, diag2);
+        a3    = diag2;
+        b2    = a2;
+        a2    = _mm_slli_epi32(a2, 13);
+        b2    = _mm_srli_epi32(b2, 19);
+        diag1 = _mm_xor_si128(diag1, a2);
+        diag2 = _mm_shuffle_epi32(diag2, 0x4e);
+        diag1 = _mm_xor_si128(diag1, b2);
+
+        a3    = _mm_add_epi32(a3, diag1);
+        a4    = diag3;
+        b3    = a3;
+        a3    = _mm_slli_epi32(a3, 18);
+        b3    = _mm_srli_epi32(b3, 14);
+        diag0 = _mm_xor_si128(diag0, a3);
+        diag1 = _mm_shuffle_epi32(diag1, 0x39);
+        diag0 = _mm_xor_si128(diag0, b3);
+
+        a4    = _mm_add_epi32(a4, diag0);
+        a5    = diag0;
+        b4    = a4;
+        a4    = _mm_slli_epi32(a4, 7);
+        b4    = _mm_srli_epi32(b4, 25);
+        diag1 = _mm_xor_si128(diag1, a4);
+
+        diag1 = _mm_xor_si128(diag1, b4);
+
+        a5    = _mm_add_epi32(a5, diag1);
+        a6    = diag1;
+        b5    = a5;
+        a5    = _mm_slli_epi32(a5, 9);
+        b5    = _mm_srli_epi32(b5, 23);
+        diag2 = _mm_xor_si128(diag2, a5);
+        diag1 = _mm_shuffle_epi32(diag1, 0x93);
+        diag2 = _mm_xor_si128(diag2, b5);
+
+        a6    = _mm_add_epi32(a6, diag2);
+        a7    = diag2;
+        b6    = a6;
+        a6    = _mm_slli_epi32(a6, 13);
+        b6    = _mm_srli_epi32(b6, 19);
+        diag3 = _mm_xor_si128(diag3, a6);
+        diag2 = _mm_shuffle_epi32(diag2, 0x4e);
+        diag3 = _mm_xor_si128(diag3, b6);
+
+        a7    = _mm_add_epi32(a7, diag3);
+        a0    = diag1;
+        b7    = a7;
+        a7    = _mm_slli_epi32(a7, 18);
+        b7    = _mm_srli_epi32(b7, 14);
+        diag0 = _mm_xor_si128(diag0, a7);
+        diag3 = _mm_shuffle_epi32(diag3, 0x39);
+        diag0 = _mm_xor_si128(diag0, b7);
+    }
+
+    diag0 = _mm_add_epi32(diag0, _mm_loadu_si128((const __m128i *) (x + 0)));
+    diag1 = _mm_add_epi32(diag1, _mm_loadu_si128((const __m128i *) (x + 4)));
+    diag2 = _mm_add_epi32(diag2, _mm_loadu_si128((const __m128i *) (x + 8)));
+    diag3 = _mm_add_epi32(diag3, _mm_loadu_si128((const __m128i *) (x + 12)));
+
+#define ONEQUAD_SHUFFLE(A, B, C, D)                                              \
+    do {                                                                         \
+        uint32_t in##A                         = _mm_cvtsi128_si32(diag0);       \
+        uint32_t in##B                         = _mm_cvtsi128_si32(diag1);       \
+        uint32_t in##C                         = _mm_cvtsi128_si32(diag2);       \
+        uint32_t in##D                         = _mm_cvtsi128_si32(diag3);       \
+        diag0                                  = _mm_shuffle_epi32(diag0, 0x39); \
+        diag1                                  = _mm_shuffle_epi32(diag1, 0x39); \
+        diag2                                  = _mm_shuffle_epi32(diag2, 0x39); \
+        diag3                                  = _mm_shuffle_epi32(diag3, 0x39); \
+        *(uint32_t *) (partialblock + (A * 4)) = in##A;                          \
+        *(uint32_t *) (partialblock + (B * 4)) = in##B;                          \
+        *(uint32_t *) (partialblock + (C * 4)) = in##C;                          \
+        *(uint32_t *) (partialblock + (D * 4)) = in##D;                          \
+    } while (0)
+
+#define ONEQUAD(A, B, C, D) ONEQUAD_SHUFFLE(A, B, C, D)
+
+    ONEQUAD(0, 12, 8, 4);
+    ONEQUAD(5, 1, 13, 9);
+    ONEQUAD(10, 6, 2, 14);
+    ONEQUAD(15, 11, 7, 3);
+
+#undef ONEQUAD
+#undef ONEQUAD_SHUFFLE
+
+    for (i = 0; i < bytes; i++) {
+        c[i] = m[i] ^ partialblock[i];
+    }
+
+    sodium_memzero(partialblock, sizeof partialblock);
+}
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u1.h b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u1.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u1.h
@@ -0,0 +1,207 @@
+while (bytes >= 64) {
+    __m128i diag0 = _mm_loadu_si128((const __m128i *) (x + 0));
+    __m128i diag1 = _mm_loadu_si128((const __m128i *) (x + 4));
+    __m128i diag2 = _mm_loadu_si128((const __m128i *) (x + 8));
+    __m128i diag3 = _mm_loadu_si128((const __m128i *) (x + 12));
+    __m128i a0, a1, a2, a3, a4, a5, a6, a7;
+    __m128i b0, b1, b2, b3, b4, b5, b6, b7;
+
+    uint32_t in8;
+    uint32_t in9;
+    int      i;
+
+    a0 = diag1;
+    for (i = 0; i < ROUNDS; i += 4) {
+        a0    = _mm_add_epi32(a0, diag0);
+        a1    = diag0;
+        b0    = a0;
+        a0    = _mm_slli_epi32(a0, 7);
+        b0    = _mm_srli_epi32(b0, 25);
+        diag3 = _mm_xor_si128(diag3, a0);
+
+        diag3 = _mm_xor_si128(diag3, b0);
+
+        a1    = _mm_add_epi32(a1, diag3);
+        a2    = diag3;
+        b1    = a1;
+        a1    = _mm_slli_epi32(a1, 9);
+        b1    = _mm_srli_epi32(b1, 23);
+        diag2 = _mm_xor_si128(diag2, a1);
+        diag3 = _mm_shuffle_epi32(diag3, 0x93);
+        diag2 = _mm_xor_si128(diag2, b1);
+
+        a2    = _mm_add_epi32(a2, diag2);
+        a3    = diag2;
+        b2    = a2;
+        a2    = _mm_slli_epi32(a2, 13);
+        b2    = _mm_srli_epi32(b2, 19);
+        diag1 = _mm_xor_si128(diag1, a2);
+        diag2 = _mm_shuffle_epi32(diag2, 0x4e);
+        diag1 = _mm_xor_si128(diag1, b2);
+
+        a3    = _mm_add_epi32(a3, diag1);
+        a4    = diag3;
+        b3    = a3;
+        a3    = _mm_slli_epi32(a3, 18);
+        b3    = _mm_srli_epi32(b3, 14);
+        diag0 = _mm_xor_si128(diag0, a3);
+        diag1 = _mm_shuffle_epi32(diag1, 0x39);
+        diag0 = _mm_xor_si128(diag0, b3);
+
+        a4    = _mm_add_epi32(a4, diag0);
+        a5    = diag0;
+        b4    = a4;
+        a4    = _mm_slli_epi32(a4, 7);
+        b4    = _mm_srli_epi32(b4, 25);
+        diag1 = _mm_xor_si128(diag1, a4);
+
+        diag1 = _mm_xor_si128(diag1, b4);
+
+        a5    = _mm_add_epi32(a5, diag1);
+        a6    = diag1;
+        b5    = a5;
+        a5    = _mm_slli_epi32(a5, 9);
+        b5    = _mm_srli_epi32(b5, 23);
+        diag2 = _mm_xor_si128(diag2, a5);
+        diag1 = _mm_shuffle_epi32(diag1, 0x93);
+        diag2 = _mm_xor_si128(diag2, b5);
+
+        a6    = _mm_add_epi32(a6, diag2);
+        a7    = diag2;
+        b6    = a6;
+        a6    = _mm_slli_epi32(a6, 13);
+        b6    = _mm_srli_epi32(b6, 19);
+        diag3 = _mm_xor_si128(diag3, a6);
+        diag2 = _mm_shuffle_epi32(diag2, 0x4e);
+        diag3 = _mm_xor_si128(diag3, b6);
+
+        a7    = _mm_add_epi32(a7, diag3);
+        a0    = diag1;
+        b7    = a7;
+        a7    = _mm_slli_epi32(a7, 18);
+        b7    = _mm_srli_epi32(b7, 14);
+        diag0 = _mm_xor_si128(diag0, a7);
+        diag3 = _mm_shuffle_epi32(diag3, 0x39);
+        diag0 = _mm_xor_si128(diag0, b7);
+
+        a0    = _mm_add_epi32(a0, diag0);
+        a1    = diag0;
+        b0    = a0;
+        a0    = _mm_slli_epi32(a0, 7);
+        b0    = _mm_srli_epi32(b0, 25);
+        diag3 = _mm_xor_si128(diag3, a0);
+
+        diag3 = _mm_xor_si128(diag3, b0);
+
+        a1    = _mm_add_epi32(a1, diag3);
+        a2    = diag3;
+        b1    = a1;
+        a1    = _mm_slli_epi32(a1, 9);
+        b1    = _mm_srli_epi32(b1, 23);
+        diag2 = _mm_xor_si128(diag2, a1);
+        diag3 = _mm_shuffle_epi32(diag3, 0x93);
+        diag2 = _mm_xor_si128(diag2, b1);
+
+        a2    = _mm_add_epi32(a2, diag2);
+        a3    = diag2;
+        b2    = a2;
+        a2    = _mm_slli_epi32(a2, 13);
+        b2    = _mm_srli_epi32(b2, 19);
+        diag1 = _mm_xor_si128(diag1, a2);
+        diag2 = _mm_shuffle_epi32(diag2, 0x4e);
+        diag1 = _mm_xor_si128(diag1, b2);
+
+        a3    = _mm_add_epi32(a3, diag1);
+        a4    = diag3;
+        b3    = a3;
+        a3    = _mm_slli_epi32(a3, 18);
+        b3    = _mm_srli_epi32(b3, 14);
+        diag0 = _mm_xor_si128(diag0, a3);
+        diag1 = _mm_shuffle_epi32(diag1, 0x39);
+        diag0 = _mm_xor_si128(diag0, b3);
+
+        a4    = _mm_add_epi32(a4, diag0);
+        a5    = diag0;
+        b4    = a4;
+        a4    = _mm_slli_epi32(a4, 7);
+        b4    = _mm_srli_epi32(b4, 25);
+        diag1 = _mm_xor_si128(diag1, a4);
+
+        diag1 = _mm_xor_si128(diag1, b4);
+
+        a5    = _mm_add_epi32(a5, diag1);
+        a6    = diag1;
+        b5    = a5;
+        a5    = _mm_slli_epi32(a5, 9);
+        b5    = _mm_srli_epi32(b5, 23);
+        diag2 = _mm_xor_si128(diag2, a5);
+        diag1 = _mm_shuffle_epi32(diag1, 0x93);
+        diag2 = _mm_xor_si128(diag2, b5);
+
+        a6    = _mm_add_epi32(a6, diag2);
+        a7    = diag2;
+        b6    = a6;
+        a6    = _mm_slli_epi32(a6, 13);
+        b6    = _mm_srli_epi32(b6, 19);
+        diag3 = _mm_xor_si128(diag3, a6);
+        diag2 = _mm_shuffle_epi32(diag2, 0x4e);
+        diag3 = _mm_xor_si128(diag3, b6);
+
+        a7    = _mm_add_epi32(a7, diag3);
+        a0    = diag1;
+        b7    = a7;
+        a7    = _mm_slli_epi32(a7, 18);
+        b7    = _mm_srli_epi32(b7, 14);
+        diag0 = _mm_xor_si128(diag0, a7);
+        diag3 = _mm_shuffle_epi32(diag3, 0x39);
+        diag0 = _mm_xor_si128(diag0, b7);
+    }
+
+    diag0 = _mm_add_epi32(diag0, _mm_loadu_si128((const __m128i *) (x + 0)));
+    diag1 = _mm_add_epi32(diag1, _mm_loadu_si128((const __m128i *) (x + 4)));
+    diag2 = _mm_add_epi32(diag2, _mm_loadu_si128((const __m128i *) (x + 8)));
+    diag3 = _mm_add_epi32(diag3, _mm_loadu_si128((const __m128i *) (x + 12)));
+
+#define ONEQUAD_SHUFFLE(A, B, C, D)                      \
+    do {                                                 \
+        uint32_t in##A = _mm_cvtsi128_si32(diag0);       \
+        uint32_t in##B = _mm_cvtsi128_si32(diag1);       \
+        uint32_t in##C = _mm_cvtsi128_si32(diag2);       \
+        uint32_t in##D = _mm_cvtsi128_si32(diag3);       \
+        diag0          = _mm_shuffle_epi32(diag0, 0x39); \
+        diag1          = _mm_shuffle_epi32(diag1, 0x39); \
+        diag2          = _mm_shuffle_epi32(diag2, 0x39); \
+        diag3          = _mm_shuffle_epi32(diag3, 0x39); \
+        in##A ^= *(const uint32_t *) (m + (A * 4));      \
+        in##B ^= *(const uint32_t *) (m + (B * 4));      \
+        in##C ^= *(const uint32_t *) (m + (C * 4));      \
+        in##D ^= *(const uint32_t *) (m + (D * 4));      \
+        *(uint32_t *) (c + (A * 4)) = in##A;             \
+        *(uint32_t *) (c + (B * 4)) = in##B;             \
+        *(uint32_t *) (c + (C * 4)) = in##C;             \
+        *(uint32_t *) (c + (D * 4)) = in##D;             \
+    } while (0)
+
+#define ONEQUAD(A, B, C, D) ONEQUAD_SHUFFLE(A, B, C, D)
+
+    ONEQUAD(0, 12, 8, 4);
+    ONEQUAD(5, 1, 13, 9);
+    ONEQUAD(10, 6, 2, 14);
+    ONEQUAD(15, 11, 7, 3);
+
+#undef ONEQUAD
+#undef ONEQUAD_SHUFFLE
+
+    in8 = x[8];
+    in9 = x[13];
+    in8++;
+    if (in8 == 0) {
+        in9++;
+    }
+    x[8]  = in8;
+    x[13] = in9;
+
+    c += 64;
+    m += 64;
+    bytes -= 64;
+}
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u4.h b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u4.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u4.h
@@ -0,0 +1,547 @@
+if (bytes >= 256) {
+    __m128i y0, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14,
+        y15;
+    __m128i z0, z1, z2, z3, z4, z5, z6, z7, z8, z9, z10, z11, z12, z13, z14,
+        z15;
+    __m128i orig0, orig1, orig2, orig3, orig4, orig5, orig6, orig7, orig8,
+        orig9, orig10, orig11, orig12, orig13, orig14, orig15;
+
+    uint32_t in8;
+    uint32_t in9;
+    int      i;
+
+    /* element broadcast immediate for _mm_shuffle_epi32 are in order:
+       0x00, 0x55, 0xaa, 0xff */
+    z0  = _mm_loadu_si128((const __m128i *) (x + 0));
+    z5  = _mm_shuffle_epi32(z0, 0x55);
+    z10 = _mm_shuffle_epi32(z0, 0xaa);
+    z15 = _mm_shuffle_epi32(z0, 0xff);
+    z0  = _mm_shuffle_epi32(z0, 0x00);
+    z1  = _mm_loadu_si128((const __m128i *) (x + 4));
+    z6  = _mm_shuffle_epi32(z1, 0xaa);
+    z11 = _mm_shuffle_epi32(z1, 0xff);
+    z12 = _mm_shuffle_epi32(z1, 0x00);
+    z1  = _mm_shuffle_epi32(z1, 0x55);
+    z2  = _mm_loadu_si128((const __m128i *) (x + 8));
+    z7  = _mm_shuffle_epi32(z2, 0xff);
+    z13 = _mm_shuffle_epi32(z2, 0x55);
+    z2  = _mm_shuffle_epi32(z2, 0xaa);
+    /* no z8 -> first half of the nonce, will fill later */
+    z3  = _mm_loadu_si128((const __m128i *) (x + 12));
+    z4  = _mm_shuffle_epi32(z3, 0x00);
+    z14 = _mm_shuffle_epi32(z3, 0xaa);
+    z3  = _mm_shuffle_epi32(z3, 0xff);
+    /* no z9 -> second half of the nonce, will fill later */
+    orig0  = z0;
+    orig1  = z1;
+    orig2  = z2;
+    orig3  = z3;
+    orig4  = z4;
+    orig5  = z5;
+    orig6  = z6;
+    orig7  = z7;
+    orig10 = z10;
+    orig11 = z11;
+    orig12 = z12;
+    orig13 = z13;
+    orig14 = z14;
+    orig15 = z15;
+
+    while (bytes >= 256) {
+        /* vector implementation for z8 and z9 */
+        /* not sure if it helps for only 4 blocks */
+        const __m128i addv8 = _mm_set_epi64x(1, 0);
+        const __m128i addv9 = _mm_set_epi64x(3, 2);
+        __m128i       t8, t9;
+        uint64_t      in89;
+
+        in8  = x[8];
+        in9  = x[13];
+        in89 = ((uint64_t) in8) | (((uint64_t) in9) << 32);
+        t8   = _mm_set1_epi64x(in89);
+        t9   = _mm_set1_epi64x(in89);
+
+        z8 = _mm_add_epi64(addv8, t8);
+        z9 = _mm_add_epi64(addv9, t9);
+
+        t8 = _mm_unpacklo_epi32(z8, z9);
+        t9 = _mm_unpackhi_epi32(z8, z9);
+
+        z8 = _mm_unpacklo_epi32(t8, t9);
+        z9 = _mm_unpackhi_epi32(t8, t9);
+
+        orig8 = z8;
+        orig9 = z9;
+
+        in89 += 4;
+
+        x[8]  = in89 & 0xFFFFFFFF;
+        x[13] = (in89 >> 32) & 0xFFFFFFFF;
+
+        z5  = orig5;
+        z10 = orig10;
+        z15 = orig15;
+        z14 = orig14;
+        z3  = orig3;
+        z6  = orig6;
+        z11 = orig11;
+        z1  = orig1;
+
+        z7  = orig7;
+        z13 = orig13;
+        z2  = orig2;
+        z9  = orig9;
+        z0  = orig0;
+        z12 = orig12;
+        z4  = orig4;
+        z8  = orig8;
+
+        for (i = 0; i < ROUNDS; i += 2) {
+            /* the inner loop is a direct translation (regexp search/replace)
+             * from the amd64-xmm6 ASM */
+            __m128i r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13,
+                r14, r15;
+
+            y4 = z12;
+            y4 = _mm_add_epi32(y4, z0);
+            r4 = y4;
+            y4 = _mm_slli_epi32(y4, 7);
+            z4 = _mm_xor_si128(z4, y4);
+            r4 = _mm_srli_epi32(r4, 25);
+            z4 = _mm_xor_si128(z4, r4);
+
+            y9 = z1;
+            y9 = _mm_add_epi32(y9, z5);
+            r9 = y9;
+            y9 = _mm_slli_epi32(y9, 7);
+            z9 = _mm_xor_si128(z9, y9);
+            r9 = _mm_srli_epi32(r9, 25);
+            z9 = _mm_xor_si128(z9, r9);
+
+            y8 = z0;
+            y8 = _mm_add_epi32(y8, z4);
+            r8 = y8;
+            y8 = _mm_slli_epi32(y8, 9);
+            z8 = _mm_xor_si128(z8, y8);
+            r8 = _mm_srli_epi32(r8, 23);
+            z8 = _mm_xor_si128(z8, r8);
+
+            y13 = z5;
+            y13 = _mm_add_epi32(y13, z9);
+            r13 = y13;
+            y13 = _mm_slli_epi32(y13, 9);
+            z13 = _mm_xor_si128(z13, y13);
+            r13 = _mm_srli_epi32(r13, 23);
+            z13 = _mm_xor_si128(z13, r13);
+
+            y12 = z4;
+            y12 = _mm_add_epi32(y12, z8);
+            r12 = y12;
+            y12 = _mm_slli_epi32(y12, 13);
+            z12 = _mm_xor_si128(z12, y12);
+            r12 = _mm_srli_epi32(r12, 19);
+            z12 = _mm_xor_si128(z12, r12);
+
+            y1 = z9;
+            y1 = _mm_add_epi32(y1, z13);
+            r1 = y1;
+            y1 = _mm_slli_epi32(y1, 13);
+            z1 = _mm_xor_si128(z1, y1);
+            r1 = _mm_srli_epi32(r1, 19);
+            z1 = _mm_xor_si128(z1, r1);
+
+            y0 = z8;
+            y0 = _mm_add_epi32(y0, z12);
+            r0 = y0;
+            y0 = _mm_slli_epi32(y0, 18);
+            z0 = _mm_xor_si128(z0, y0);
+            r0 = _mm_srli_epi32(r0, 14);
+            z0 = _mm_xor_si128(z0, r0);
+
+            y5 = z13;
+            y5 = _mm_add_epi32(y5, z1);
+            r5 = y5;
+            y5 = _mm_slli_epi32(y5, 18);
+            z5 = _mm_xor_si128(z5, y5);
+            r5 = _mm_srli_epi32(r5, 14);
+            z5 = _mm_xor_si128(z5, r5);
+
+            y14 = z6;
+            y14 = _mm_add_epi32(y14, z10);
+            r14 = y14;
+            y14 = _mm_slli_epi32(y14, 7);
+            z14 = _mm_xor_si128(z14, y14);
+            r14 = _mm_srli_epi32(r14, 25);
+            z14 = _mm_xor_si128(z14, r14);
+
+            y3 = z11;
+            y3 = _mm_add_epi32(y3, z15);
+            r3 = y3;
+            y3 = _mm_slli_epi32(y3, 7);
+            z3 = _mm_xor_si128(z3, y3);
+            r3 = _mm_srli_epi32(r3, 25);
+            z3 = _mm_xor_si128(z3, r3);
+
+            y2 = z10;
+            y2 = _mm_add_epi32(y2, z14);
+            r2 = y2;
+            y2 = _mm_slli_epi32(y2, 9);
+            z2 = _mm_xor_si128(z2, y2);
+            r2 = _mm_srli_epi32(r2, 23);
+            z2 = _mm_xor_si128(z2, r2);
+
+            y7 = z15;
+            y7 = _mm_add_epi32(y7, z3);
+            r7 = y7;
+            y7 = _mm_slli_epi32(y7, 9);
+            z7 = _mm_xor_si128(z7, y7);
+            r7 = _mm_srli_epi32(r7, 23);
+            z7 = _mm_xor_si128(z7, r7);
+
+            y6 = z14;
+            y6 = _mm_add_epi32(y6, z2);
+            r6 = y6;
+            y6 = _mm_slli_epi32(y6, 13);
+            z6 = _mm_xor_si128(z6, y6);
+            r6 = _mm_srli_epi32(r6, 19);
+            z6 = _mm_xor_si128(z6, r6);
+
+            y11 = z3;
+            y11 = _mm_add_epi32(y11, z7);
+            r11 = y11;
+            y11 = _mm_slli_epi32(y11, 13);
+            z11 = _mm_xor_si128(z11, y11);
+            r11 = _mm_srli_epi32(r11, 19);
+            z11 = _mm_xor_si128(z11, r11);
+
+            y10 = z2;
+            y10 = _mm_add_epi32(y10, z6);
+            r10 = y10;
+            y10 = _mm_slli_epi32(y10, 18);
+            z10 = _mm_xor_si128(z10, y10);
+            r10 = _mm_srli_epi32(r10, 14);
+            z10 = _mm_xor_si128(z10, r10);
+
+            y1 = z3;
+            y1 = _mm_add_epi32(y1, z0);
+            r1 = y1;
+            y1 = _mm_slli_epi32(y1, 7);
+            z1 = _mm_xor_si128(z1, y1);
+            r1 = _mm_srli_epi32(r1, 25);
+            z1 = _mm_xor_si128(z1, r1);
+
+            y15 = z7;
+            y15 = _mm_add_epi32(y15, z11);
+            r15 = y15;
+            y15 = _mm_slli_epi32(y15, 18);
+            z15 = _mm_xor_si128(z15, y15);
+            r15 = _mm_srli_epi32(r15, 14);
+            z15 = _mm_xor_si128(z15, r15);
+
+            y6 = z4;
+            y6 = _mm_add_epi32(y6, z5);
+            r6 = y6;
+            y6 = _mm_slli_epi32(y6, 7);
+            z6 = _mm_xor_si128(z6, y6);
+            r6 = _mm_srli_epi32(r6, 25);
+            z6 = _mm_xor_si128(z6, r6);
+
+            y2 = z0;
+            y2 = _mm_add_epi32(y2, z1);
+            r2 = y2;
+            y2 = _mm_slli_epi32(y2, 9);
+            z2 = _mm_xor_si128(z2, y2);
+            r2 = _mm_srli_epi32(r2, 23);
+            z2 = _mm_xor_si128(z2, r2);
+
+            y7 = z5;
+            y7 = _mm_add_epi32(y7, z6);
+            r7 = y7;
+            y7 = _mm_slli_epi32(y7, 9);
+            z7 = _mm_xor_si128(z7, y7);
+            r7 = _mm_srli_epi32(r7, 23);
+            z7 = _mm_xor_si128(z7, r7);
+
+            y3 = z1;
+            y3 = _mm_add_epi32(y3, z2);
+            r3 = y3;
+            y3 = _mm_slli_epi32(y3, 13);
+            z3 = _mm_xor_si128(z3, y3);
+            r3 = _mm_srli_epi32(r3, 19);
+            z3 = _mm_xor_si128(z3, r3);
+
+            y4 = z6;
+            y4 = _mm_add_epi32(y4, z7);
+            r4 = y4;
+            y4 = _mm_slli_epi32(y4, 13);
+            z4 = _mm_xor_si128(z4, y4);
+            r4 = _mm_srli_epi32(r4, 19);
+            z4 = _mm_xor_si128(z4, r4);
+
+            y0 = z2;
+            y0 = _mm_add_epi32(y0, z3);
+            r0 = y0;
+            y0 = _mm_slli_epi32(y0, 18);
+            z0 = _mm_xor_si128(z0, y0);
+            r0 = _mm_srli_epi32(r0, 14);
+            z0 = _mm_xor_si128(z0, r0);
+
+            y5 = z7;
+            y5 = _mm_add_epi32(y5, z4);
+            r5 = y5;
+            y5 = _mm_slli_epi32(y5, 18);
+            z5 = _mm_xor_si128(z5, y5);
+            r5 = _mm_srli_epi32(r5, 14);
+            z5 = _mm_xor_si128(z5, r5);
+
+            y11 = z9;
+            y11 = _mm_add_epi32(y11, z10);
+            r11 = y11;
+            y11 = _mm_slli_epi32(y11, 7);
+            z11 = _mm_xor_si128(z11, y11);
+            r11 = _mm_srli_epi32(r11, 25);
+            z11 = _mm_xor_si128(z11, r11);
+
+            y12 = z14;
+            y12 = _mm_add_epi32(y12, z15);
+            r12 = y12;
+            y12 = _mm_slli_epi32(y12, 7);
+            z12 = _mm_xor_si128(z12, y12);
+            r12 = _mm_srli_epi32(r12, 25);
+            z12 = _mm_xor_si128(z12, r12);
+
+            y8 = z10;
+            y8 = _mm_add_epi32(y8, z11);
+            r8 = y8;
+            y8 = _mm_slli_epi32(y8, 9);
+            z8 = _mm_xor_si128(z8, y8);
+            r8 = _mm_srli_epi32(r8, 23);
+            z8 = _mm_xor_si128(z8, r8);
+
+            y13 = z15;
+            y13 = _mm_add_epi32(y13, z12);
+            r13 = y13;
+            y13 = _mm_slli_epi32(y13, 9);
+            z13 = _mm_xor_si128(z13, y13);
+            r13 = _mm_srli_epi32(r13, 23);
+            z13 = _mm_xor_si128(z13, r13);
+
+            y9 = z11;
+            y9 = _mm_add_epi32(y9, z8);
+            r9 = y9;
+            y9 = _mm_slli_epi32(y9, 13);
+            z9 = _mm_xor_si128(z9, y9);
+            r9 = _mm_srli_epi32(r9, 19);
+            z9 = _mm_xor_si128(z9, r9);
+
+            y14 = z12;
+            y14 = _mm_add_epi32(y14, z13);
+            r14 = y14;
+            y14 = _mm_slli_epi32(y14, 13);
+            z14 = _mm_xor_si128(z14, y14);
+            r14 = _mm_srli_epi32(r14, 19);
+            z14 = _mm_xor_si128(z14, r14);
+
+            y10 = z8;
+            y10 = _mm_add_epi32(y10, z9);
+            r10 = y10;
+            y10 = _mm_slli_epi32(y10, 18);
+            z10 = _mm_xor_si128(z10, y10);
+            r10 = _mm_srli_epi32(r10, 14);
+            z10 = _mm_xor_si128(z10, r10);
+
+            y15 = z13;
+            y15 = _mm_add_epi32(y15, z14);
+            r15 = y15;
+            y15 = _mm_slli_epi32(y15, 18);
+            z15 = _mm_xor_si128(z15, y15);
+            r15 = _mm_srli_epi32(r15, 14);
+            z15 = _mm_xor_si128(z15, r15);
+        }
+
+/* store data ; this macro replicates the original amd64-xmm6 code */
+#define ONEQUAD_SHUFFLE(A, B, C, D)        \
+    z##A  = _mm_add_epi32(z##A, orig##A);  \
+    z##B  = _mm_add_epi32(z##B, orig##B);  \
+    z##C  = _mm_add_epi32(z##C, orig##C);  \
+    z##D  = _mm_add_epi32(z##D, orig##D);  \
+    in##A = _mm_cvtsi128_si32(z##A);       \
+    in##B = _mm_cvtsi128_si32(z##B);       \
+    in##C = _mm_cvtsi128_si32(z##C);       \
+    in##D = _mm_cvtsi128_si32(z##D);       \
+    z##A  = _mm_shuffle_epi32(z##A, 0x39); \
+    z##B  = _mm_shuffle_epi32(z##B, 0x39); \
+    z##C  = _mm_shuffle_epi32(z##C, 0x39); \
+    z##D  = _mm_shuffle_epi32(z##D, 0x39); \
+                                           \
+    in##A ^= *(uint32_t *) (m + 0);        \
+    in##B ^= *(uint32_t *) (m + 4);        \
+    in##C ^= *(uint32_t *) (m + 8);        \
+    in##D ^= *(uint32_t *) (m + 12);       \
+                                           \
+    *(uint32_t *) (c + 0)  = in##A;        \
+    *(uint32_t *) (c + 4)  = in##B;        \
+    *(uint32_t *) (c + 8)  = in##C;        \
+    *(uint32_t *) (c + 12) = in##D;        \
+                                           \
+    in##A = _mm_cvtsi128_si32(z##A);       \
+    in##B = _mm_cvtsi128_si32(z##B);       \
+    in##C = _mm_cvtsi128_si32(z##C);       \
+    in##D = _mm_cvtsi128_si32(z##D);       \
+    z##A  = _mm_shuffle_epi32(z##A, 0x39); \
+    z##B  = _mm_shuffle_epi32(z##B, 0x39); \
+    z##C  = _mm_shuffle_epi32(z##C, 0x39); \
+    z##D  = _mm_shuffle_epi32(z##D, 0x39); \
+                                           \
+    in##A ^= *(uint32_t *) (m + 64);       \
+    in##B ^= *(uint32_t *) (m + 68);       \
+    in##C ^= *(uint32_t *) (m + 72);       \
+    in##D ^= *(uint32_t *) (m + 76);       \
+    *(uint32_t *) (c + 64) = in##A;        \
+    *(uint32_t *) (c + 68) = in##B;        \
+    *(uint32_t *) (c + 72) = in##C;        \
+    *(uint32_t *) (c + 76) = in##D;        \
+                                           \
+    in##A = _mm_cvtsi128_si32(z##A);       \
+    in##B = _mm_cvtsi128_si32(z##B);       \
+    in##C = _mm_cvtsi128_si32(z##C);       \
+    in##D = _mm_cvtsi128_si32(z##D);       \
+    z##A  = _mm_shuffle_epi32(z##A, 0x39); \
+    z##B  = _mm_shuffle_epi32(z##B, 0x39); \
+    z##C  = _mm_shuffle_epi32(z##C, 0x39); \
+    z##D  = _mm_shuffle_epi32(z##D, 0x39); \
+                                           \
+    in##A ^= *(uint32_t *) (m + 128);      \
+    in##B ^= *(uint32_t *) (m + 132);      \
+    in##C ^= *(uint32_t *) (m + 136);      \
+    in##D ^= *(uint32_t *) (m + 140);      \
+    *(uint32_t *) (c + 128) = in##A;       \
+    *(uint32_t *) (c + 132) = in##B;       \
+    *(uint32_t *) (c + 136) = in##C;       \
+    *(uint32_t *) (c + 140) = in##D;       \
+                                           \
+    in##A = _mm_cvtsi128_si32(z##A);       \
+    in##B = _mm_cvtsi128_si32(z##B);       \
+    in##C = _mm_cvtsi128_si32(z##C);       \
+    in##D = _mm_cvtsi128_si32(z##D);       \
+                                           \
+    in##A ^= *(uint32_t *) (m + 192);      \
+    in##B ^= *(uint32_t *) (m + 196);      \
+    in##C ^= *(uint32_t *) (m + 200);      \
+    in##D ^= *(uint32_t *) (m + 204);      \
+    *(uint32_t *) (c + 192) = in##A;       \
+    *(uint32_t *) (c + 196) = in##B;       \
+    *(uint32_t *) (c + 200) = in##C;       \
+    *(uint32_t *) (c + 204) = in##D
+
+/* store data ; this macro replaces shuffle+mov by a direct extract; not much
+ * difference */
+#define ONEQUAD_EXTRACT(A, B, C, D)       \
+    z##A  = _mm_add_epi32(z##A, orig##A); \
+    z##B  = _mm_add_epi32(z##B, orig##B); \
+    z##C  = _mm_add_epi32(z##C, orig##C); \
+    z##D  = _mm_add_epi32(z##D, orig##D); \
+    in##A = _mm_cvtsi128_si32(z##A);      \
+    in##B = _mm_cvtsi128_si32(z##B);      \
+    in##C = _mm_cvtsi128_si32(z##C);      \
+    in##D = _mm_cvtsi128_si32(z##D);      \
+    in##A ^= *(uint32_t *) (m + 0);       \
+    in##B ^= *(uint32_t *) (m + 4);       \
+    in##C ^= *(uint32_t *) (m + 8);       \
+    in##D ^= *(uint32_t *) (m + 12);      \
+    *(uint32_t *) (c + 0)  = in##A;       \
+    *(uint32_t *) (c + 4)  = in##B;       \
+    *(uint32_t *) (c + 8)  = in##C;       \
+    *(uint32_t *) (c + 12) = in##D;       \
+                                          \
+    in##A = _mm_extract_epi32(z##A, 1);   \
+    in##B = _mm_extract_epi32(z##B, 1);   \
+    in##C = _mm_extract_epi32(z##C, 1);   \
+    in##D = _mm_extract_epi32(z##D, 1);   \
+                                          \
+    in##A ^= *(uint32_t *) (m + 64);      \
+    in##B ^= *(uint32_t *) (m + 68);      \
+    in##C ^= *(uint32_t *) (m + 72);      \
+    in##D ^= *(uint32_t *) (m + 76);      \
+    *(uint32_t *) (c + 64) = in##A;       \
+    *(uint32_t *) (c + 68) = in##B;       \
+    *(uint32_t *) (c + 72) = in##C;       \
+    *(uint32_t *) (c + 76) = in##D;       \
+                                          \
+    in##A = _mm_extract_epi32(z##A, 2);   \
+    in##B = _mm_extract_epi32(z##B, 2);   \
+    in##C = _mm_extract_epi32(z##C, 2);   \
+    in##D = _mm_extract_epi32(z##D, 2);   \
+                                          \
+    in##A ^= *(uint32_t *) (m + 128);     \
+    in##B ^= *(uint32_t *) (m + 132);     \
+    in##C ^= *(uint32_t *) (m + 136);     \
+    in##D ^= *(uint32_t *) (m + 140);     \
+    *(uint32_t *) (c + 128) = in##A;      \
+    *(uint32_t *) (c + 132) = in##B;      \
+    *(uint32_t *) (c + 136) = in##C;      \
+    *(uint32_t *) (c + 140) = in##D;      \
+                                          \
+    in##A = _mm_extract_epi32(z##A, 3);   \
+    in##B = _mm_extract_epi32(z##B, 3);   \
+    in##C = _mm_extract_epi32(z##C, 3);   \
+    in##D = _mm_extract_epi32(z##D, 3);   \
+                                          \
+    in##A ^= *(uint32_t *) (m + 192);     \
+    in##B ^= *(uint32_t *) (m + 196);     \
+    in##C ^= *(uint32_t *) (m + 200);     \
+    in##D ^= *(uint32_t *) (m + 204);     \
+    *(uint32_t *) (c + 192) = in##A;      \
+    *(uint32_t *) (c + 196) = in##B;      \
+    *(uint32_t *) (c + 200) = in##C;      \
+    *(uint32_t *) (c + 204) = in##D
+
+/* store data ; this macro first transpose data in-registers, and then store
+ * them in memory. much faster with icc. */
+#define ONEQUAD_TRANSPOSE(A, B, C, D)                                         \
+    z##A = _mm_add_epi32(z##A, orig##A);                                      \
+    z##B = _mm_add_epi32(z##B, orig##B);                                      \
+    z##C = _mm_add_epi32(z##C, orig##C);                                      \
+    z##D = _mm_add_epi32(z##D, orig##D);                                      \
+    y##A = _mm_unpacklo_epi32(z##A, z##B);                                    \
+    y##B = _mm_unpacklo_epi32(z##C, z##D);                                    \
+    y##C = _mm_unpackhi_epi32(z##A, z##B);                                    \
+    y##D = _mm_unpackhi_epi32(z##C, z##D);                                    \
+    z##A = _mm_unpacklo_epi64(y##A, y##B);                                    \
+    z##B = _mm_unpackhi_epi64(y##A, y##B);                                    \
+    z##C = _mm_unpacklo_epi64(y##C, y##D);                                    \
+    z##D = _mm_unpackhi_epi64(y##C, y##D);                                    \
+    y##A = _mm_xor_si128(z##A, _mm_loadu_si128((const __m128i *) (m + 0)));   \
+    _mm_storeu_si128((__m128i *) (c + 0), y##A);                              \
+    y##B = _mm_xor_si128(z##B, _mm_loadu_si128((const __m128i *) (m + 64)));  \
+    _mm_storeu_si128((__m128i *) (c + 64), y##B);                             \
+    y##C = _mm_xor_si128(z##C, _mm_loadu_si128((const __m128i *) (m + 128))); \
+    _mm_storeu_si128((__m128i *) (c + 128), y##C);                            \
+    y##D = _mm_xor_si128(z##D, _mm_loadu_si128((const __m128i *) (m + 192))); \
+    _mm_storeu_si128((__m128i *) (c + 192), y##D)
+
+#define ONEQUAD(A, B, C, D) ONEQUAD_TRANSPOSE(A, B, C, D)
+
+        ONEQUAD(0, 1, 2, 3);
+        m += 16;
+        c += 16;
+        ONEQUAD(4, 5, 6, 7);
+        m += 16;
+        c += 16;
+        ONEQUAD(8, 9, 10, 11);
+        m += 16;
+        c += 16;
+        ONEQUAD(12, 13, 14, 15);
+        m -= 48;
+        c -= 48;
+
+#undef ONEQUAD
+#undef ONEQUAD_TRANSPOSE
+#undef ONEQUAD_EXTRACT
+#undef ONEQUAD_SHUFFLE
+
+        bytes -= 256;
+        c += 256;
+        m += 256;
+    }
+}
diff --git a/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u8.h b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u8.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa20/xmm6int/u8.h
@@ -0,0 +1,477 @@
+if (bytes >= 512) {
+    __m256i y0, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14,
+        y15;
+
+    /* the naive way seems as fast (if not a bit faster) than the vector way */
+    __m256i z0  = _mm256_set1_epi32(x[0]);
+    __m256i z5  = _mm256_set1_epi32(x[1]);
+    __m256i z10 = _mm256_set1_epi32(x[2]);
+    __m256i z15 = _mm256_set1_epi32(x[3]);
+    __m256i z12 = _mm256_set1_epi32(x[4]);
+    __m256i z1  = _mm256_set1_epi32(x[5]);
+    __m256i z6  = _mm256_set1_epi32(x[6]);
+    __m256i z11 = _mm256_set1_epi32(x[7]);
+    __m256i z8; /* useless */
+    __m256i z13 = _mm256_set1_epi32(x[9]);
+    __m256i z2  = _mm256_set1_epi32(x[10]);
+    __m256i z7  = _mm256_set1_epi32(x[11]);
+    __m256i z4  = _mm256_set1_epi32(x[12]);
+    __m256i z9; /* useless */
+    __m256i z14 = _mm256_set1_epi32(x[14]);
+    __m256i z3  = _mm256_set1_epi32(x[15]);
+
+    __m256i orig0 = z0;
+    __m256i orig1 = z1;
+    __m256i orig2 = z2;
+    __m256i orig3 = z3;
+    __m256i orig4 = z4;
+    __m256i orig5 = z5;
+    __m256i orig6 = z6;
+    __m256i orig7 = z7;
+    __m256i orig8;
+    __m256i orig9;
+    __m256i orig10 = z10;
+    __m256i orig11 = z11;
+    __m256i orig12 = z12;
+    __m256i orig13 = z13;
+    __m256i orig14 = z14;
+    __m256i orig15 = z15;
+
+    uint32_t in8;
+    uint32_t in9;
+    int      i;
+
+    while (bytes >= 512) {
+        /* vector implementation for z8 and z9 */
+        /* faster than the naive version for 8 blocks */
+        const __m256i addv8   = _mm256_set_epi64x(3, 2, 1, 0);
+        const __m256i addv9   = _mm256_set_epi64x(7, 6, 5, 4);
+        const __m256i permute = _mm256_set_epi32(7, 6, 3, 2, 5, 4, 1, 0);
+
+        __m256i  t8, t9;
+        uint64_t in89;
+
+        in8  = x[8];
+        in9  = x[13]; /* see arrays above for the address translation */
+        in89 = ((uint64_t) in8) | (((uint64_t) in9) << 32);
+
+        z8 = z9 = _mm256_broadcastq_epi64(_mm_cvtsi64_si128(in89));
+
+        t8 = _mm256_add_epi64(addv8, z8);
+        t9 = _mm256_add_epi64(addv9, z9);
+
+        z8 = _mm256_unpacklo_epi32(t8, t9);
+        z9 = _mm256_unpackhi_epi32(t8, t9);
+
+        t8 = _mm256_unpacklo_epi32(z8, z9);
+        t9 = _mm256_unpackhi_epi32(z8, z9);
+
+        /* required because unpack* are intra-lane */
+        z8 = _mm256_permutevar8x32_epi32(t8, permute);
+        z9 = _mm256_permutevar8x32_epi32(t9, permute);
+
+        orig8 = z8;
+        orig9 = z9;
+
+        in89 += 8;
+
+        x[8]  = in89 & 0xFFFFFFFF;
+        x[13] = (in89 >> 32) & 0xFFFFFFFF;
+
+        z5  = orig5;
+        z10 = orig10;
+        z15 = orig15;
+        z14 = orig14;
+        z3  = orig3;
+        z6  = orig6;
+        z11 = orig11;
+        z1  = orig1;
+
+        z7  = orig7;
+        z13 = orig13;
+        z2  = orig2;
+        z9  = orig9;
+        z0  = orig0;
+        z12 = orig12;
+        z4  = orig4;
+        z8  = orig8;
+
+        for (i = 0; i < ROUNDS; i += 2) {
+            /* the inner loop is a direct translation (regexp search/replace)
+             * from the amd64-xmm6 ASM */
+            __m256i r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13,
+                r14, r15;
+
+            y4 = z12;
+            y4 = _mm256_add_epi32(y4, z0);
+            r4 = y4;
+            y4 = _mm256_slli_epi32(y4, 7);
+            z4 = _mm256_xor_si256(z4, y4);
+            r4 = _mm256_srli_epi32(r4, 25);
+            z4 = _mm256_xor_si256(z4, r4);
+
+            y9 = z1;
+            y9 = _mm256_add_epi32(y9, z5);
+            r9 = y9;
+            y9 = _mm256_slli_epi32(y9, 7);
+            z9 = _mm256_xor_si256(z9, y9);
+            r9 = _mm256_srli_epi32(r9, 25);
+            z9 = _mm256_xor_si256(z9, r9);
+
+            y8 = z0;
+            y8 = _mm256_add_epi32(y8, z4);
+            r8 = y8;
+            y8 = _mm256_slli_epi32(y8, 9);
+            z8 = _mm256_xor_si256(z8, y8);
+            r8 = _mm256_srli_epi32(r8, 23);
+            z8 = _mm256_xor_si256(z8, r8);
+
+            y13 = z5;
+            y13 = _mm256_add_epi32(y13, z9);
+            r13 = y13;
+            y13 = _mm256_slli_epi32(y13, 9);
+            z13 = _mm256_xor_si256(z13, y13);
+            r13 = _mm256_srli_epi32(r13, 23);
+            z13 = _mm256_xor_si256(z13, r13);
+
+            y12 = z4;
+            y12 = _mm256_add_epi32(y12, z8);
+            r12 = y12;
+            y12 = _mm256_slli_epi32(y12, 13);
+            z12 = _mm256_xor_si256(z12, y12);
+            r12 = _mm256_srli_epi32(r12, 19);
+            z12 = _mm256_xor_si256(z12, r12);
+
+            y1 = z9;
+            y1 = _mm256_add_epi32(y1, z13);
+            r1 = y1;
+            y1 = _mm256_slli_epi32(y1, 13);
+            z1 = _mm256_xor_si256(z1, y1);
+            r1 = _mm256_srli_epi32(r1, 19);
+            z1 = _mm256_xor_si256(z1, r1);
+
+            y0 = z8;
+            y0 = _mm256_add_epi32(y0, z12);
+            r0 = y0;
+            y0 = _mm256_slli_epi32(y0, 18);
+            z0 = _mm256_xor_si256(z0, y0);
+            r0 = _mm256_srli_epi32(r0, 14);
+            z0 = _mm256_xor_si256(z0, r0);
+
+            y5 = z13;
+            y5 = _mm256_add_epi32(y5, z1);
+            r5 = y5;
+            y5 = _mm256_slli_epi32(y5, 18);
+            z5 = _mm256_xor_si256(z5, y5);
+            r5 = _mm256_srli_epi32(r5, 14);
+            z5 = _mm256_xor_si256(z5, r5);
+
+            y14 = z6;
+            y14 = _mm256_add_epi32(y14, z10);
+            r14 = y14;
+            y14 = _mm256_slli_epi32(y14, 7);
+            z14 = _mm256_xor_si256(z14, y14);
+            r14 = _mm256_srli_epi32(r14, 25);
+            z14 = _mm256_xor_si256(z14, r14);
+
+            y3 = z11;
+            y3 = _mm256_add_epi32(y3, z15);
+            r3 = y3;
+            y3 = _mm256_slli_epi32(y3, 7);
+            z3 = _mm256_xor_si256(z3, y3);
+            r3 = _mm256_srli_epi32(r3, 25);
+            z3 = _mm256_xor_si256(z3, r3);
+
+            y2 = z10;
+            y2 = _mm256_add_epi32(y2, z14);
+            r2 = y2;
+            y2 = _mm256_slli_epi32(y2, 9);
+            z2 = _mm256_xor_si256(z2, y2);
+            r2 = _mm256_srli_epi32(r2, 23);
+            z2 = _mm256_xor_si256(z2, r2);
+
+            y7 = z15;
+            y7 = _mm256_add_epi32(y7, z3);
+            r7 = y7;
+            y7 = _mm256_slli_epi32(y7, 9);
+            z7 = _mm256_xor_si256(z7, y7);
+            r7 = _mm256_srli_epi32(r7, 23);
+            z7 = _mm256_xor_si256(z7, r7);
+
+            y6 = z14;
+            y6 = _mm256_add_epi32(y6, z2);
+            r6 = y6;
+            y6 = _mm256_slli_epi32(y6, 13);
+            z6 = _mm256_xor_si256(z6, y6);
+            r6 = _mm256_srli_epi32(r6, 19);
+            z6 = _mm256_xor_si256(z6, r6);
+
+            y11 = z3;
+            y11 = _mm256_add_epi32(y11, z7);
+            r11 = y11;
+            y11 = _mm256_slli_epi32(y11, 13);
+            z11 = _mm256_xor_si256(z11, y11);
+            r11 = _mm256_srli_epi32(r11, 19);
+            z11 = _mm256_xor_si256(z11, r11);
+
+            y10 = z2;
+            y10 = _mm256_add_epi32(y10, z6);
+            r10 = y10;
+            y10 = _mm256_slli_epi32(y10, 18);
+            z10 = _mm256_xor_si256(z10, y10);
+            r10 = _mm256_srli_epi32(r10, 14);
+            z10 = _mm256_xor_si256(z10, r10);
+
+            y1 = z3;
+            y1 = _mm256_add_epi32(y1, z0);
+            r1 = y1;
+            y1 = _mm256_slli_epi32(y1, 7);
+            z1 = _mm256_xor_si256(z1, y1);
+            r1 = _mm256_srli_epi32(r1, 25);
+            z1 = _mm256_xor_si256(z1, r1);
+
+            y15 = z7;
+            y15 = _mm256_add_epi32(y15, z11);
+            r15 = y15;
+            y15 = _mm256_slli_epi32(y15, 18);
+            z15 = _mm256_xor_si256(z15, y15);
+            r15 = _mm256_srli_epi32(r15, 14);
+            z15 = _mm256_xor_si256(z15, r15);
+
+            y6 = z4;
+            y6 = _mm256_add_epi32(y6, z5);
+            r6 = y6;
+            y6 = _mm256_slli_epi32(y6, 7);
+            z6 = _mm256_xor_si256(z6, y6);
+            r6 = _mm256_srli_epi32(r6, 25);
+            z6 = _mm256_xor_si256(z6, r6);
+
+            y2 = z0;
+            y2 = _mm256_add_epi32(y2, z1);
+            r2 = y2;
+            y2 = _mm256_slli_epi32(y2, 9);
+            z2 = _mm256_xor_si256(z2, y2);
+            r2 = _mm256_srli_epi32(r2, 23);
+            z2 = _mm256_xor_si256(z2, r2);
+
+            y7 = z5;
+            y7 = _mm256_add_epi32(y7, z6);
+            r7 = y7;
+            y7 = _mm256_slli_epi32(y7, 9);
+            z7 = _mm256_xor_si256(z7, y7);
+            r7 = _mm256_srli_epi32(r7, 23);
+            z7 = _mm256_xor_si256(z7, r7);
+
+            y3 = z1;
+            y3 = _mm256_add_epi32(y3, z2);
+            r3 = y3;
+            y3 = _mm256_slli_epi32(y3, 13);
+            z3 = _mm256_xor_si256(z3, y3);
+            r3 = _mm256_srli_epi32(r3, 19);
+            z3 = _mm256_xor_si256(z3, r3);
+
+            y4 = z6;
+            y4 = _mm256_add_epi32(y4, z7);
+            r4 = y4;
+            y4 = _mm256_slli_epi32(y4, 13);
+            z4 = _mm256_xor_si256(z4, y4);
+            r4 = _mm256_srli_epi32(r4, 19);
+            z4 = _mm256_xor_si256(z4, r4);
+
+            y0 = z2;
+            y0 = _mm256_add_epi32(y0, z3);
+            r0 = y0;
+            y0 = _mm256_slli_epi32(y0, 18);
+            z0 = _mm256_xor_si256(z0, y0);
+            r0 = _mm256_srli_epi32(r0, 14);
+            z0 = _mm256_xor_si256(z0, r0);
+
+            y5 = z7;
+            y5 = _mm256_add_epi32(y5, z4);
+            r5 = y5;
+            y5 = _mm256_slli_epi32(y5, 18);
+            z5 = _mm256_xor_si256(z5, y5);
+            r5 = _mm256_srli_epi32(r5, 14);
+            z5 = _mm256_xor_si256(z5, r5);
+
+            y11 = z9;
+            y11 = _mm256_add_epi32(y11, z10);
+            r11 = y11;
+            y11 = _mm256_slli_epi32(y11, 7);
+            z11 = _mm256_xor_si256(z11, y11);
+            r11 = _mm256_srli_epi32(r11, 25);
+            z11 = _mm256_xor_si256(z11, r11);
+
+            y12 = z14;
+            y12 = _mm256_add_epi32(y12, z15);
+            r12 = y12;
+            y12 = _mm256_slli_epi32(y12, 7);
+            z12 = _mm256_xor_si256(z12, y12);
+            r12 = _mm256_srli_epi32(r12, 25);
+            z12 = _mm256_xor_si256(z12, r12);
+
+            y8 = z10;
+            y8 = _mm256_add_epi32(y8, z11);
+            r8 = y8;
+            y8 = _mm256_slli_epi32(y8, 9);
+            z8 = _mm256_xor_si256(z8, y8);
+            r8 = _mm256_srli_epi32(r8, 23);
+            z8 = _mm256_xor_si256(z8, r8);
+
+            y13 = z15;
+            y13 = _mm256_add_epi32(y13, z12);
+            r13 = y13;
+            y13 = _mm256_slli_epi32(y13, 9);
+            z13 = _mm256_xor_si256(z13, y13);
+            r13 = _mm256_srli_epi32(r13, 23);
+            z13 = _mm256_xor_si256(z13, r13);
+
+            y9 = z11;
+            y9 = _mm256_add_epi32(y9, z8);
+            r9 = y9;
+            y9 = _mm256_slli_epi32(y9, 13);
+            z9 = _mm256_xor_si256(z9, y9);
+            r9 = _mm256_srli_epi32(r9, 19);
+            z9 = _mm256_xor_si256(z9, r9);
+
+            y14 = z12;
+            y14 = _mm256_add_epi32(y14, z13);
+            r14 = y14;
+            y14 = _mm256_slli_epi32(y14, 13);
+            z14 = _mm256_xor_si256(z14, y14);
+            r14 = _mm256_srli_epi32(r14, 19);
+            z14 = _mm256_xor_si256(z14, r14);
+
+            y10 = z8;
+            y10 = _mm256_add_epi32(y10, z9);
+            r10 = y10;
+            y10 = _mm256_slli_epi32(y10, 18);
+            z10 = _mm256_xor_si256(z10, y10);
+            r10 = _mm256_srli_epi32(r10, 14);
+            z10 = _mm256_xor_si256(z10, r10);
+
+            y15 = z13;
+            y15 = _mm256_add_epi32(y15, z14);
+            r15 = y15;
+            y15 = _mm256_slli_epi32(y15, 18);
+            z15 = _mm256_xor_si256(z15, y15);
+            r15 = _mm256_srli_epi32(r15, 14);
+            z15 = _mm256_xor_si256(z15, r15);
+        }
+
+/* store data ; this macro first transpose data in-registers, and then store
+ * them in memory. much faster with icc. */
+#define ONEQUAD_TRANSPOSE(A, B, C, D)                                    \
+    {                                                                    \
+        __m128i t0, t1, t2, t3;                                          \
+        z##A = _mm256_add_epi32(z##A, orig##A);                          \
+        z##B = _mm256_add_epi32(z##B, orig##B);                          \
+        z##C = _mm256_add_epi32(z##C, orig##C);                          \
+        z##D = _mm256_add_epi32(z##D, orig##D);                          \
+        y##A = _mm256_unpacklo_epi32(z##A, z##B);                        \
+        y##B = _mm256_unpacklo_epi32(z##C, z##D);                        \
+        y##C = _mm256_unpackhi_epi32(z##A, z##B);                        \
+        y##D = _mm256_unpackhi_epi32(z##C, z##D);                        \
+        z##A = _mm256_unpacklo_epi64(y##A, y##B);                        \
+        z##B = _mm256_unpackhi_epi64(y##A, y##B);                        \
+        z##C = _mm256_unpacklo_epi64(y##C, y##D);                        \
+        z##D = _mm256_unpackhi_epi64(y##C, y##D);                        \
+        t0   = _mm_xor_si128(_mm256_extracti128_si256(z##A, 0),          \
+                           _mm_loadu_si128((const __m128i*) (m + 0))); \
+        _mm_storeu_si128((__m128i*) (c + 0), t0);                        \
+        t1 = _mm_xor_si128(_mm256_extracti128_si256(z##B, 0),            \
+                           _mm_loadu_si128((const __m128i*) (m + 64)));  \
+        _mm_storeu_si128((__m128i*) (c + 64), t1);                       \
+        t2 = _mm_xor_si128(_mm256_extracti128_si256(z##C, 0),            \
+                           _mm_loadu_si128((const __m128i*) (m + 128))); \
+        _mm_storeu_si128((__m128i*) (c + 128), t2);                      \
+        t3 = _mm_xor_si128(_mm256_extracti128_si256(z##D, 0),            \
+                           _mm_loadu_si128((const __m128i*) (m + 192))); \
+        _mm_storeu_si128((__m128i*) (c + 192), t3);                      \
+        t0 = _mm_xor_si128(_mm256_extracti128_si256(z##A, 1),            \
+                           _mm_loadu_si128((const __m128i*) (m + 256))); \
+        _mm_storeu_si128((__m128i*) (c + 256), t0);                      \
+        t1 = _mm_xor_si128(_mm256_extracti128_si256(z##B, 1),            \
+                           _mm_loadu_si128((const __m128i*) (m + 320))); \
+        _mm_storeu_si128((__m128i*) (c + 320), t1);                      \
+        t2 = _mm_xor_si128(_mm256_extracti128_si256(z##C, 1),            \
+                           _mm_loadu_si128((const __m128i*) (m + 384))); \
+        _mm_storeu_si128((__m128i*) (c + 384), t2);                      \
+        t3 = _mm_xor_si128(_mm256_extracti128_si256(z##D, 1),            \
+                           _mm_loadu_si128((const __m128i*) (m + 448))); \
+        _mm_storeu_si128((__m128i*) (c + 448), t3);                      \
+    }
+
+#define ONEQUAD(A, B, C, D) ONEQUAD_TRANSPOSE(A, B, C, D)
+
+#define ONEQUAD_UNPCK(A, B, C, D)                 \
+    {                                             \
+        z##A = _mm256_add_epi32(z##A, orig##A);   \
+        z##B = _mm256_add_epi32(z##B, orig##B);   \
+        z##C = _mm256_add_epi32(z##C, orig##C);   \
+        z##D = _mm256_add_epi32(z##D, orig##D);   \
+        y##A = _mm256_unpacklo_epi32(z##A, z##B); \
+        y##B = _mm256_unpacklo_epi32(z##C, z##D); \
+        y##C = _mm256_unpackhi_epi32(z##A, z##B); \
+        y##D = _mm256_unpackhi_epi32(z##C, z##D); \
+        z##A = _mm256_unpacklo_epi64(y##A, y##B); \
+        z##B = _mm256_unpackhi_epi64(y##A, y##B); \
+        z##C = _mm256_unpacklo_epi64(y##C, y##D); \
+        z##D = _mm256_unpackhi_epi64(y##C, y##D); \
+    }
+
+#define ONEOCTO(A, B, C, D, A2, B2, C2, D2)                                    \
+    {                                                                          \
+        ONEQUAD_UNPCK(A, B, C, D);                                             \
+        ONEQUAD_UNPCK(A2, B2, C2, D2);                                         \
+        y##A  = _mm256_permute2x128_si256(z##A, z##A2, 0x20);                  \
+        y##A2 = _mm256_permute2x128_si256(z##A, z##A2, 0x31);                  \
+        y##B  = _mm256_permute2x128_si256(z##B, z##B2, 0x20);                  \
+        y##B2 = _mm256_permute2x128_si256(z##B, z##B2, 0x31);                  \
+        y##C  = _mm256_permute2x128_si256(z##C, z##C2, 0x20);                  \
+        y##C2 = _mm256_permute2x128_si256(z##C, z##C2, 0x31);                  \
+        y##D  = _mm256_permute2x128_si256(z##D, z##D2, 0x20);                  \
+        y##D2 = _mm256_permute2x128_si256(z##D, z##D2, 0x31);                  \
+        y##A  = _mm256_xor_si256(y##A,                                         \
+                                _mm256_loadu_si256((const __m256i*) (m + 0))); \
+        y##B  = _mm256_xor_si256(                                              \
+            y##B, _mm256_loadu_si256((const __m256i*) (m + 64)));              \
+        y##C = _mm256_xor_si256(                                               \
+            y##C, _mm256_loadu_si256((const __m256i*) (m + 128)));             \
+        y##D = _mm256_xor_si256(                                               \
+            y##D, _mm256_loadu_si256((const __m256i*) (m + 192)));             \
+        y##A2 = _mm256_xor_si256(                                              \
+            y##A2, _mm256_loadu_si256((const __m256i*) (m + 256)));            \
+        y##B2 = _mm256_xor_si256(                                              \
+            y##B2, _mm256_loadu_si256((const __m256i*) (m + 320)));            \
+        y##C2 = _mm256_xor_si256(                                              \
+            y##C2, _mm256_loadu_si256((const __m256i*) (m + 384)));            \
+        y##D2 = _mm256_xor_si256(                                              \
+            y##D2, _mm256_loadu_si256((const __m256i*) (m + 448)));            \
+        _mm256_storeu_si256((__m256i*) (c + 0), y##A);                         \
+        _mm256_storeu_si256((__m256i*) (c + 64), y##B);                        \
+        _mm256_storeu_si256((__m256i*) (c + 128), y##C);                       \
+        _mm256_storeu_si256((__m256i*) (c + 192), y##D);                       \
+        _mm256_storeu_si256((__m256i*) (c + 256), y##A2);                      \
+        _mm256_storeu_si256((__m256i*) (c + 320), y##B2);                      \
+        _mm256_storeu_si256((__m256i*) (c + 384), y##C2);                      \
+        _mm256_storeu_si256((__m256i*) (c + 448), y##D2);                      \
+    }
+
+        ONEOCTO(0, 1, 2, 3, 4, 5, 6, 7);
+        m += 32;
+        c += 32;
+        ONEOCTO(8, 9, 10, 11, 12, 13, 14, 15);
+        m -= 32;
+        c -= 32;
+
+#undef ONEQUAD
+#undef ONEQUAD_TRANSPOSE
+#undef ONEQUAD_UNPCK
+#undef ONEOCTO
+
+        bytes -= 512;
+        c += 512;
+        m += 512;
+    }
+}
diff --git a/vendor/external/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012_ref.c b/vendor/external/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012_ref.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012_ref.c
@@ -0,0 +1,106 @@
+/*
+version 20140420
+D. J. Bernstein
+Public domain.
+*/
+
+#include <stdint.h>
+
+#include "crypto_core_salsa2012.h"
+#include "crypto_stream_salsa2012.h"
+#include "utils.h"
+
+int
+crypto_stream_salsa2012(unsigned char *c, unsigned long long clen,
+                        const unsigned char *n, const unsigned char *k)
+{
+    unsigned char in[16];
+    unsigned char block[64];
+    unsigned char kcopy[32];
+    unsigned int  i;
+    unsigned int  u;
+
+    if (!clen) {
+        return 0;
+    }
+    for (i = 0; i < 32; ++i) {
+        kcopy[i] = k[i];
+    }
+    for (i = 0; i < 8; ++i) {
+        in[i] = n[i];
+    }
+    for (i = 8; i < 16; ++i) {
+        in[i] = 0;
+    }
+    while (clen >= 64) {
+        crypto_core_salsa2012(c, in, kcopy, NULL);
+        u = 1;
+        for (i = 8; i < 16; ++i) {
+            u += (unsigned int)in[i];
+            in[i] = u;
+            u >>= 8;
+        }
+        clen -= 64;
+        c += 64;
+    }
+    if (clen) {
+        crypto_core_salsa2012(block, in, kcopy, NULL);
+        for (i = 0; i < (unsigned int)clen; ++i) {
+            c[i] = block[i];
+        }
+    }
+    sodium_memzero(block, sizeof block);
+    sodium_memzero(kcopy, sizeof kcopy);
+
+    return 0;
+}
+
+int
+crypto_stream_salsa2012_xor(unsigned char *c, const unsigned char *m,
+                            unsigned long long mlen, const unsigned char *n,
+                            const unsigned char *k)
+{
+    unsigned char in[16];
+    unsigned char block[64];
+    unsigned char kcopy[32];
+    unsigned int  i;
+    unsigned int  u;
+
+    if (!mlen) {
+        return 0;
+    }
+    for (i = 0; i < 32; ++i) {
+        kcopy[i] = k[i];
+    }
+    for (i = 0; i < 8; ++i) {
+        in[i] = n[i];
+    }
+    for (i = 8; i < 16; ++i) {
+        in[i] = 0;
+    }
+    while (mlen >= 64) {
+        crypto_core_salsa2012(block, in, kcopy, NULL);
+        for (i = 0; i < 64; ++i) {
+            c[i] = m[i] ^ block[i];
+        }
+        u = 1;
+        for (i = 8; i < 16; ++i) {
+            u += (unsigned int)in[i];
+            in[i] = u;
+            u >>= 8;
+        }
+        mlen -= 64;
+        c += 64;
+        m += 64;
+    }
+    if (mlen) {
+        crypto_core_salsa2012(block, in, kcopy, NULL);
+        for (i = 0; i < (unsigned int)mlen; ++i) {
+            c[i] = m[i] ^ block[i];
+        }
+    }
+    sodium_memzero(block, sizeof block);
+    sodium_memzero(kcopy, sizeof kcopy);
+
+    return 0;
+}
diff --git a/vendor/external/libsodium/crypto_stream/salsa2012/stream_salsa2012.c b/vendor/external/libsodium/crypto_stream/salsa2012/stream_salsa2012.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa2012/stream_salsa2012.c
@@ -0,0 +1,26 @@
+#include "crypto_stream_salsa2012.h"
+#include "randombytes.h"
+
+size_t
+crypto_stream_salsa2012_keybytes(void)
+{
+    return crypto_stream_salsa2012_KEYBYTES;
+}
+
+size_t
+crypto_stream_salsa2012_noncebytes(void)
+{
+    return crypto_stream_salsa2012_NONCEBYTES;
+}
+
+size_t
+crypto_stream_salsa2012_messagebytes_max(void)
+{
+    return crypto_stream_salsa2012_MESSAGEBYTES_MAX;
+}
+
+void
+crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES])
+{
+    randombytes_buf(k, crypto_stream_salsa2012_KEYBYTES);
+}
diff --git a/vendor/external/libsodium/crypto_stream/salsa208/ref/stream_salsa208_ref.c b/vendor/external/libsodium/crypto_stream/salsa208/ref/stream_salsa208_ref.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa208/ref/stream_salsa208_ref.c
@@ -0,0 +1,106 @@
+/*
+version 20140420
+D. J. Bernstein
+Public domain.
+*/
+
+#include <stdint.h>
+
+#include "crypto_core_salsa208.h"
+#include "crypto_stream_salsa208.h"
+#include "utils.h"
+
+int
+crypto_stream_salsa208(unsigned char *c, unsigned long long clen,
+                       const unsigned char *n, const unsigned char *k)
+{
+    unsigned char in[16];
+    unsigned char block[64];
+    unsigned char kcopy[32];
+    unsigned int  i;
+    unsigned int  u;
+
+    if (!clen) {
+        return 0;
+    }
+    for (i = 0; i < 32; ++i) {
+        kcopy[i] = k[i];
+    }
+    for (i = 0; i < 8; ++i) {
+        in[i] = n[i];
+    }
+    for (i = 8; i < 16; ++i) {
+        in[i] = 0;
+    }
+    while (clen >= 64) {
+        crypto_core_salsa208(c, in, kcopy, NULL);
+        u = 1;
+        for (i = 8; i < 16; ++i) {
+            u += (unsigned int)in[i];
+            in[i] = u;
+            u >>= 8;
+        }
+        clen -= 64;
+        c += 64;
+    }
+    if (clen) {
+        crypto_core_salsa208(block, in, kcopy, NULL);
+        for (i = 0; i < (unsigned int)clen; ++i) {
+            c[i] = block[i];
+        }
+    }
+    sodium_memzero(block, sizeof block);
+    sodium_memzero(kcopy, sizeof kcopy);
+
+    return 0;
+}
+
+int
+crypto_stream_salsa208_xor(unsigned char *c, const unsigned char *m,
+                           unsigned long long mlen, const unsigned char *n,
+                           const unsigned char *k)
+{
+    unsigned char in[16];
+    unsigned char block[64];
+    unsigned char kcopy[32];
+    unsigned int  i;
+    unsigned int  u;
+
+    if (!mlen) {
+        return 0;
+    }
+    for (i = 0; i < 32; ++i) {
+        kcopy[i] = k[i];
+    }
+    for (i = 0; i < 8; ++i) {
+        in[i] = n[i];
+    }
+    for (i = 8; i < 16; ++i) {
+        in[i] = 0;
+    }
+    while (mlen >= 64) {
+        crypto_core_salsa208(block, in, kcopy, NULL);
+        for (i = 0; i < 64; ++i) {
+            c[i] = m[i] ^ block[i];
+        }
+        u = 1;
+        for (i = 8; i < 16; ++i) {
+            u += (unsigned int)in[i];
+            in[i] = u;
+            u >>= 8;
+        }
+        mlen -= 64;
+        c += 64;
+        m += 64;
+    }
+    if (mlen) {
+        crypto_core_salsa208(block, in, kcopy, NULL);
+        for (i = 0; i < (unsigned int)mlen; ++i) {
+            c[i] = m[i] ^ block[i];
+        }
+    }
+    sodium_memzero(block, sizeof block);
+    sodium_memzero(kcopy, sizeof kcopy);
+
+    return 0;
+}
diff --git a/vendor/external/libsodium/crypto_stream/salsa208/stream_salsa208.c b/vendor/external/libsodium/crypto_stream/salsa208/stream_salsa208.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/salsa208/stream_salsa208.c
@@ -0,0 +1,26 @@
+#include "crypto_stream_salsa208.h"
+#include "randombytes.h"
+
+size_t
+crypto_stream_salsa208_keybytes(void)
+{
+    return crypto_stream_salsa208_KEYBYTES;
+}
+
+size_t
+crypto_stream_salsa208_noncebytes(void)
+{
+    return crypto_stream_salsa208_NONCEBYTES;
+}
+
+size_t
+crypto_stream_salsa208_messagebytes_max(void)
+{
+    return crypto_stream_salsa208_MESSAGEBYTES_MAX;
+}
+
+void
+crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES])
+{
+    randombytes_buf(k, crypto_stream_salsa208_KEYBYTES);
+}
diff --git a/vendor/external/libsodium/crypto_stream/xchacha20/stream_xchacha20.c b/vendor/external/libsodium/crypto_stream/xchacha20/stream_xchacha20.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/xchacha20/stream_xchacha20.c
@@ -0,0 +1,69 @@
+
+#include <stdlib.h>
+
+#include "crypto_core_hchacha20.h"
+#include "crypto_stream_chacha20.h"
+#include "crypto_stream_xchacha20.h"
+#include "private/common.h"
+#include "randombytes.h"
+
+size_t
+crypto_stream_xchacha20_keybytes(void)
+{
+    return crypto_stream_xchacha20_KEYBYTES;
+}
+
+size_t
+crypto_stream_xchacha20_noncebytes(void)
+{
+    return crypto_stream_xchacha20_NONCEBYTES;
+}
+
+size_t
+crypto_stream_xchacha20_messagebytes_max(void)
+{
+    return crypto_stream_xchacha20_MESSAGEBYTES_MAX;
+}
+
+int
+crypto_stream_xchacha20(unsigned char *c, unsigned long long clen,
+                        const unsigned char *n, const unsigned char *k)
+{
+    unsigned char k2[crypto_core_hchacha20_OUTPUTBYTES];
+
+    crypto_core_hchacha20(k2, n, k, NULL);
+    COMPILER_ASSERT(crypto_stream_chacha20_KEYBYTES <= sizeof k2);
+    COMPILER_ASSERT(crypto_stream_chacha20_NONCEBYTES ==
+                    crypto_stream_xchacha20_NONCEBYTES -
+                        crypto_core_hchacha20_INPUTBYTES);
+
+    return crypto_stream_chacha20(c, clen, n + crypto_core_hchacha20_INPUTBYTES,
+                                  k2);
+}
+
+int
+crypto_stream_xchacha20_xor_ic(unsigned char *c, const unsigned char *m,
+                               unsigned long long mlen, const unsigned char *n,
+                               uint64_t ic, const unsigned char *k)
+{
+    unsigned char k2[crypto_core_hchacha20_OUTPUTBYTES];
+
+    crypto_core_hchacha20(k2, n, k, NULL);
+    return crypto_stream_chacha20_xor_ic(
+        c, m, mlen, n + crypto_core_hchacha20_INPUTBYTES, ic, k2);
+}
+
+int
+crypto_stream_xchacha20_xor(unsigned char *c, const unsigned char *m,
+                            unsigned long long mlen, const unsigned char *n,
+                            const unsigned char *k)
+{
+    return crypto_stream_xchacha20_xor_ic(c, m, mlen, n, 0U, k);
+}
+
+void
+crypto_stream_xchacha20_keygen(
+    unsigned char k[crypto_stream_xchacha20_KEYBYTES])
+{
+    randombytes_buf(k, crypto_stream_xchacha20_KEYBYTES);
+}
diff --git a/vendor/external/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c b/vendor/external/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c
@@ -0,0 +1,66 @@
+#include "crypto_core_hsalsa20.h"
+#include "crypto_stream_salsa20.h"
+#include "crypto_stream_xsalsa20.h"
+#include "randombytes.h"
+#include "utils.h"
+
+int
+crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen,
+                       const unsigned char *n, const unsigned char *k)
+{
+    unsigned char subkey[32];
+    int           ret;
+
+    crypto_core_hsalsa20(subkey, n, k, NULL);
+    ret = crypto_stream_salsa20(c, clen, n + 16, subkey);
+    sodium_memzero(subkey, sizeof subkey);
+
+    return ret;
+}
+
+int
+crypto_stream_xsalsa20_xor_ic(unsigned char *c, const unsigned char *m,
+                              unsigned long long mlen, const unsigned char *n,
+                              uint64_t ic, const unsigned char *k)
+{
+    unsigned char subkey[32];
+    int           ret;
+
+    crypto_core_hsalsa20(subkey, n, k, NULL);
+    ret = crypto_stream_salsa20_xor_ic(c, m, mlen, n + 16, ic, subkey);
+    sodium_memzero(subkey, sizeof subkey);
+
+    return ret;
+}
+
+int
+crypto_stream_xsalsa20_xor(unsigned char *c, const unsigned char *m,
+                           unsigned long long mlen, const unsigned char *n,
+                           const unsigned char *k)
+{
+    return crypto_stream_xsalsa20_xor_ic(c, m, mlen, n, 0ULL, k);
+}
+
+size_t
+crypto_stream_xsalsa20_keybytes(void)
+{
+    return crypto_stream_xsalsa20_KEYBYTES;
+}
+
+size_t
+crypto_stream_xsalsa20_noncebytes(void)
+{
+    return crypto_stream_xsalsa20_NONCEBYTES;
+}
+
+size_t
+crypto_stream_xsalsa20_messagebytes_max(void)
+{
+    return crypto_stream_xsalsa20_MESSAGEBYTES_MAX;
+}
+
+void
+crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES])
+{
+    randombytes_buf(k, crypto_stream_xsalsa20_KEYBYTES);
+}
diff --git a/vendor/external/libsodium/crypto_verify/verify.c b/vendor/external/libsodium/crypto_verify/verify.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/crypto_verify/verify.c
@@ -0,0 +1,98 @@
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "crypto_verify_16.h"
+#include "crypto_verify_32.h"
+#include "crypto_verify_64.h"
+
+size_t
+crypto_verify_16_bytes(void)
+{
+    return crypto_verify_16_BYTES;
+}
+
+size_t
+crypto_verify_32_bytes(void)
+{
+    return crypto_verify_32_BYTES;
+}
+
+size_t
+crypto_verify_64_bytes(void)
+{
+    return crypto_verify_64_BYTES;
+}
+
+#if defined(HAVE_EMMINTRIN_H) && defined(__SSE2__)
+
+# ifdef __GNUC__
+#  pragma GCC target("sse2")
+# endif
+# include <emmintrin.h>
+
+static inline int
+crypto_verify_n(const unsigned char *x_, const unsigned char *y_,
+                const int n)
+{
+    const    __m128i zero = _mm_setzero_si128();
+    volatile __m128i v1, v2, z;
+    volatile int     m;
+    int              i;
+
+    const volatile __m128i *volatile x =
+        (const volatile __m128i *volatile) (const void *) x_;
+    const volatile __m128i *volatile y =
+        (const volatile __m128i *volatile) (const void *) y_;
+    v1 = _mm_loadu_si128((const __m128i *) &x[0]);
+    v2 = _mm_loadu_si128((const __m128i *) &y[0]);
+    z = _mm_xor_si128(v1, v2);
+    for (i = 1; i < n / 16; i++) {
+        v1 = _mm_loadu_si128((const __m128i *) &x[i]);
+        v2 = _mm_loadu_si128((const __m128i *) &y[i]);
+        z = _mm_or_si128(z, _mm_xor_si128(v1, v2));
+    }
+    m = _mm_movemask_epi8(_mm_cmpeq_epi32(z, zero));
+    v1 = zero; v2 = zero; z = zero;
+
+    return (int) (((uint32_t) m + 1U) >> 16) - 1;
+}
+
+#else
+
+static inline int
+crypto_verify_n(const unsigned char *x_, const unsigned char *y_,
+                const int n)
+{
+    const volatile unsigned char *volatile x =
+        (const volatile unsigned char *volatile) x_;
+    const volatile unsigned char *volatile y =
+        (const volatile unsigned char *volatile) y_;
+    volatile uint_fast16_t d = 0U;
+    int i;
+
+    for (i = 0; i < n; i++) {
+        d |= x[i] ^ y[i];
+    }
+    return (1 & ((d - 1) >> 8)) - 1;
+}
+
+#endif
+
+int
+crypto_verify_16(const unsigned char *x, const unsigned char *y)
+{
+    return crypto_verify_n(x, y, crypto_verify_16_BYTES);
+}
+
+int
+crypto_verify_32(const unsigned char *x, const unsigned char *y)
+{
+    return crypto_verify_n(x, y, crypto_verify_32_BYTES);
+}
+
+int
+crypto_verify_64(const unsigned char *x, const unsigned char *y)
+{
+    return crypto_verify_n(x, y, crypto_verify_64_BYTES);
+}
diff --git a/vendor/external/libsodium/include/sodium.h b/vendor/external/libsodium/include/sodium.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium.h
@@ -0,0 +1,73 @@
+
+#ifndef sodium_H
+#define sodium_H
+
+#include "sodium/version.h"
+
+#include "external/libsodium/include/sodium/core.h"
+#include "external/libsodium/include/sodium/crypto_aead_aegis128l.h"
+#include "external/libsodium/include/sodium/crypto_aead_aegis256.h"
+#include "external/libsodium/include/sodium/crypto_aead_aes256gcm.h"
+#include "external/libsodium/include/sodium/crypto_aead_chacha20poly1305.h"
+#include "external/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h"
+#include "external/libsodium/include/sodium/crypto_auth.h"
+#include "external/libsodium/include/sodium/crypto_auth_hmacsha256.h"
+#include "external/libsodium/include/sodium/crypto_auth_hmacsha512.h"
+#include "external/libsodium/include/sodium/crypto_auth_hmacsha512256.h"
+#include "external/libsodium/include/sodium/crypto_box.h"
+#include "external/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h"
+#include "external/libsodium/include/sodium/crypto_core_hchacha20.h"
+#include "external/libsodium/include/sodium/crypto_core_hsalsa20.h"
+#include "external/libsodium/include/sodium/crypto_core_salsa20.h"
+#include "external/libsodium/include/sodium/crypto_core_salsa2012.h"
+#include "external/libsodium/include/sodium/crypto_core_salsa208.h"
+#include "external/libsodium/include/sodium/crypto_generichash.h"
+#include "external/libsodium/include/sodium/crypto_generichash_blake2b.h"
+#include "external/libsodium/include/sodium/crypto_hash.h"
+#include "external/libsodium/include/sodium/crypto_hash_sha256.h"
+#include "external/libsodium/include/sodium/crypto_hash_sha512.h"
+#include "external/libsodium/include/sodium/crypto_kdf.h"
+#include "external/libsodium/include/sodium/crypto_kdf_blake2b.h"
+#include "external/libsodium/include/sodium/crypto_kdf_hkdf_sha256.h"
+#include "external/libsodium/include/sodium/crypto_kdf_hkdf_sha512.h"
+#include "external/libsodium/include/sodium/crypto_kx.h"
+#include "external/libsodium/include/sodium/crypto_onetimeauth.h"
+#include "external/libsodium/include/sodium/crypto_onetimeauth_poly1305.h"
+#include "external/libsodium/include/sodium/crypto_pwhash.h"
+#include "external/libsodium/include/sodium/crypto_pwhash_argon2i.h"
+#include "external/libsodium/include/sodium/crypto_scalarmult.h"
+#include "external/libsodium/include/sodium/crypto_scalarmult_curve25519.h"
+#include "external/libsodium/include/sodium/crypto_secretbox.h"
+#include "external/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h"
+#include "external/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h"
+#include "external/libsodium/include/sodium/crypto_shorthash.h"
+#include "external/libsodium/include/sodium/crypto_shorthash_siphash24.h"
+#include "external/libsodium/include/sodium/crypto_sign.h"
+#include "external/libsodium/include/sodium/crypto_sign_ed25519.h"
+#include "external/libsodium/include/sodium/crypto_stream.h"
+#include "external/libsodium/include/sodium/crypto_stream_chacha20.h"
+#include "external/libsodium/include/sodium/crypto_stream_salsa20.h"
+#include "external/libsodium/include/sodium/crypto_stream_xsalsa20.h"
+#include "external/libsodium/include/sodium/crypto_verify_16.h"
+#include "external/libsodium/include/sodium/crypto_verify_32.h"
+#include "external/libsodium/include/sodium/crypto_verify_64.h"
+#include "external/libsodium/include/sodium/randombytes.h"
+#include "external/libsodium/include/sodium/randombytes_internal_random.h"
+#include "external/libsodium/include/sodium/randombytes_sysrandom.h"
+#include "external/libsodium/include/sodium/runtime.h"
+#include "external/libsodium/include/sodium/utils.h"
+
+#ifndef SODIUM_LIBRARY_MINIMAL
+#include "external/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h"
+#include "external/libsodium/include/sodium/crypto_core_ed25519.h"
+#include "external/libsodium/include/sodium/crypto_core_ristretto255.h"
+#include "external/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h"
+#include "external/libsodium/include/sodium/crypto_scalarmult_ed25519.h"
+#include "external/libsodium/include/sodium/crypto_scalarmult_ristretto255.h"
+#include "external/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h"
+#include "external/libsodium/include/sodium/crypto_stream_salsa2012.h"
+#include "external/libsodium/include/sodium/crypto_stream_salsa208.h"
+#include "external/libsodium/include/sodium/crypto_stream_xchacha20.h"
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/core.h b/vendor/external/libsodium/include/sodium/core.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/core.h
@@ -0,0 +1,28 @@
+
+#ifndef sodium_core_H
+#define sodium_core_H
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+int sodium_init(void)
+            __attribute__ ((warn_unused_result));
+
+/* ---- */
+
+SODIUM_EXPORT
+int sodium_set_misuse_handler(void (*handler)(void));
+
+SODIUM_EXPORT
+void sodium_misuse(void)
+            __attribute__ ((noreturn));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_aead_aegis128l.h b/vendor/external/libsodium/include/sodium/crypto_aead_aegis128l.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_aead_aegis128l.h
@@ -0,0 +1,92 @@
+#ifndef crypto_aead_aegis128l_H
+#define crypto_aead_aegis128l_H
+
+#include <stddef.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-Wlong-long"
+#endif
+extern "C" {
+#endif
+
+#define crypto_aead_aegis128l_KEYBYTES 16U
+SODIUM_EXPORT
+size_t crypto_aead_aegis128l_keybytes(void);
+
+#define crypto_aead_aegis128l_NSECBYTES 0U
+SODIUM_EXPORT
+size_t crypto_aead_aegis128l_nsecbytes(void);
+
+#define crypto_aead_aegis128l_NPUBBYTES 16U
+SODIUM_EXPORT
+size_t crypto_aead_aegis128l_npubbytes(void);
+
+#define crypto_aead_aegis128l_ABYTES 32U
+SODIUM_EXPORT
+size_t crypto_aead_aegis128l_abytes(void);
+
+#define crypto_aead_aegis128l_MESSAGEBYTES_MAX \
+    SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aegis128l_ABYTES, (1ULL << 61) - 1)
+SODIUM_EXPORT
+size_t crypto_aead_aegis128l_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_aead_aegis128l_encrypt(unsigned char       *c,
+                                  unsigned long long  *clen_p,
+                                  const unsigned char *m,
+                                  unsigned long long   mlen,
+                                  const unsigned char *ad,
+                                  unsigned long long   adlen,
+                                  const unsigned char *nsec,
+                                  const unsigned char *npub,
+                                  const unsigned char *k) __attribute__((nonnull(1, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_aegis128l_decrypt(unsigned char       *m,
+                                  unsigned long long  *mlen_p,
+                                  unsigned char       *nsec,
+                                  const unsigned char *c,
+                                  unsigned long long   clen,
+                                  const unsigned char *ad,
+                                  unsigned long long   adlen,
+                                  const unsigned char *npub,
+                                  const unsigned char *k) __attribute__((warn_unused_result))
+__attribute__((nonnull(4, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_aegis128l_encrypt_detached(unsigned char       *c,
+                                           unsigned char       *mac,
+                                           unsigned long long  *maclen_p,
+                                           const unsigned char *m,
+                                           unsigned long long   mlen,
+                                           const unsigned char *ad,
+                                           unsigned long long   adlen,
+                                           const unsigned char *nsec,
+                                           const unsigned char *npub,
+                                           const unsigned char *k)
+    __attribute__((nonnull(1, 2, 9, 10)));
+
+SODIUM_EXPORT
+int crypto_aead_aegis128l_decrypt_detached(unsigned char       *m,
+                                           unsigned char       *nsec,
+                                           const unsigned char *c,
+                                           unsigned long long   clen,
+                                           const unsigned char *mac,
+                                           const unsigned char *ad,
+                                           unsigned long long   adlen,
+                                           const unsigned char *npub,
+                                           const unsigned char *k)
+    __attribute__((warn_unused_result)) __attribute__((nonnull(3, 5, 8, 9)));
+
+SODIUM_EXPORT
+void crypto_aead_aegis128l_keygen(unsigned char k[crypto_aead_aegis128l_KEYBYTES])
+    __attribute__((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_aead_aegis256.h b/vendor/external/libsodium/include/sodium/crypto_aead_aegis256.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_aead_aegis256.h
@@ -0,0 +1,92 @@
+#ifndef crypto_aead_aegis256_H
+#define crypto_aead_aegis256_H
+
+#include <stddef.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-Wlong-long"
+#endif
+extern "C" {
+#endif
+
+#define crypto_aead_aegis256_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_aead_aegis256_keybytes(void);
+
+#define crypto_aead_aegis256_NSECBYTES 0U
+SODIUM_EXPORT
+size_t crypto_aead_aegis256_nsecbytes(void);
+
+#define crypto_aead_aegis256_NPUBBYTES 32U
+SODIUM_EXPORT
+size_t crypto_aead_aegis256_npubbytes(void);
+
+#define crypto_aead_aegis256_ABYTES 32U
+SODIUM_EXPORT
+size_t crypto_aead_aegis256_abytes(void);
+
+#define crypto_aead_aegis256_MESSAGEBYTES_MAX \
+    SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aegis256_ABYTES, (1ULL << 61) - 1)
+SODIUM_EXPORT
+size_t crypto_aead_aegis256_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_aead_aegis256_encrypt(unsigned char       *c,
+                                 unsigned long long  *clen_p,
+                                 const unsigned char *m,
+                                 unsigned long long   mlen,
+                                 const unsigned char *ad,
+                                 unsigned long long   adlen,
+                                 const unsigned char *nsec,
+                                 const unsigned char *npub,
+                                 const unsigned char *k) __attribute__((nonnull(1, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_aegis256_decrypt(unsigned char       *m,
+                                 unsigned long long  *mlen_p,
+                                 unsigned char       *nsec,
+                                 const unsigned char *c,
+                                 unsigned long long   clen,
+                                 const unsigned char *ad,
+                                 unsigned long long   adlen,
+                                 const unsigned char *npub,
+                                 const unsigned char *k) __attribute__((warn_unused_result))
+__attribute__((nonnull(4, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_aegis256_encrypt_detached(unsigned char       *c,
+                                          unsigned char       *mac,
+                                          unsigned long long  *maclen_p,
+                                          const unsigned char *m,
+                                          unsigned long long   mlen,
+                                          const unsigned char *ad,
+                                          unsigned long long   adlen,
+                                          const unsigned char *nsec,
+                                          const unsigned char *npub,
+                                          const unsigned char *k)
+    __attribute__((nonnull(1, 2, 9, 10)));
+
+SODIUM_EXPORT
+int crypto_aead_aegis256_decrypt_detached(unsigned char       *m,
+                                          unsigned char       *nsec,
+                                          const unsigned char *c,
+                                          unsigned long long   clen,
+                                          const unsigned char *mac,
+                                          const unsigned char *ad,
+                                          unsigned long long   adlen,
+                                          const unsigned char *npub,
+                                          const unsigned char *k)
+    __attribute__((warn_unused_result)) __attribute__((nonnull(3, 5, 8, 9)));
+
+SODIUM_EXPORT
+void crypto_aead_aegis256_keygen(unsigned char k[crypto_aead_aegis256_KEYBYTES])
+    __attribute__((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_aead_aes256gcm.h b/vendor/external/libsodium/include/sodium/crypto_aead_aes256gcm.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_aead_aes256gcm.h
@@ -0,0 +1,179 @@
+#ifndef crypto_aead_aes256gcm_H
+#define crypto_aead_aes256gcm_H
+
+/*
+ * WARNING: Despite being the most popular AEAD construction due to its
+ * use in TLS, safely using AES-GCM in a different context is tricky.
+ *
+ * No more than ~ 350 GB of input data should be encrypted with a given key.
+ * This is for ~ 16 KB messages -- Actual figures vary according to
+ * message sizes.
+ *
+ * In addition, nonces are short and repeated nonces would totally destroy
+ * the security of this scheme.
+ *
+ * Nonces should thus come from atomic counters, which can be difficult to
+ * set up in a distributed environment.
+ *
+ * Unless you absolutely need AES-GCM, use crypto_aead_xchacha20poly1305_ietf_*()
+ * instead. It doesn't have any of these limitations.
+ * Or, if you don't need to authenticate additional data, just stick to
+ * crypto_secretbox().
+ */
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+int crypto_aead_aes256gcm_is_available(void);
+
+#define crypto_aead_aes256gcm_KEYBYTES  32U
+SODIUM_EXPORT
+size_t crypto_aead_aes256gcm_keybytes(void);
+
+#define crypto_aead_aes256gcm_NSECBYTES 0U
+SODIUM_EXPORT
+size_t crypto_aead_aes256gcm_nsecbytes(void);
+
+#define crypto_aead_aes256gcm_NPUBBYTES 12U
+SODIUM_EXPORT
+size_t crypto_aead_aes256gcm_npubbytes(void);
+
+#define crypto_aead_aes256gcm_ABYTES    16U
+SODIUM_EXPORT
+size_t crypto_aead_aes256gcm_abytes(void);
+
+#define crypto_aead_aes256gcm_MESSAGEBYTES_MAX \
+    SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aes256gcm_ABYTES, \
+               (16ULL * ((1ULL << 32) - 2ULL)))
+SODIUM_EXPORT
+size_t crypto_aead_aes256gcm_messagebytes_max(void);
+
+typedef struct CRYPTO_ALIGN(16) crypto_aead_aes256gcm_state_ {
+    unsigned char opaque[512];
+} crypto_aead_aes256gcm_state;
+
+SODIUM_EXPORT
+size_t crypto_aead_aes256gcm_statebytes(void);
+
+SODIUM_EXPORT
+int crypto_aead_aes256gcm_encrypt(unsigned char *c,
+                                  unsigned long long *clen_p,
+                                  const unsigned char *m,
+                                  unsigned long long mlen,
+                                  const unsigned char *ad,
+                                  unsigned long long adlen,
+                                  const unsigned char *nsec,
+                                  const unsigned char *npub,
+                                  const unsigned char *k)
+            __attribute__ ((nonnull(1, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_aes256gcm_decrypt(unsigned char *m,
+                                  unsigned long long *mlen_p,
+                                  unsigned char *nsec,
+                                  const unsigned char *c,
+                                  unsigned long long clen,
+                                  const unsigned char *ad,
+                                  unsigned long long adlen,
+                                  const unsigned char *npub,
+                                  const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_aes256gcm_encrypt_detached(unsigned char *c,
+                                           unsigned char *mac,
+                                           unsigned long long *maclen_p,
+                                           const unsigned char *m,
+                                           unsigned long long mlen,
+                                           const unsigned char *ad,
+                                           unsigned long long adlen,
+                                           const unsigned char *nsec,
+                                           const unsigned char *npub,
+                                           const unsigned char *k)
+            __attribute__ ((nonnull(1, 2, 9, 10)));
+
+SODIUM_EXPORT
+int crypto_aead_aes256gcm_decrypt_detached(unsigned char *m,
+                                           unsigned char *nsec,
+                                           const unsigned char *c,
+                                           unsigned long long clen,
+                                           const unsigned char *mac,
+                                           const unsigned char *ad,
+                                           unsigned long long adlen,
+                                           const unsigned char *npub,
+                                           const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
+
+/* -- Precomputation interface -- */
+
+SODIUM_EXPORT
+int crypto_aead_aes256gcm_beforenm(crypto_aead_aes256gcm_state *ctx_,
+                                   const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_aead_aes256gcm_encrypt_afternm(unsigned char *c,
+                                          unsigned long long *clen_p,
+                                          const unsigned char *m,
+                                          unsigned long long mlen,
+                                          const unsigned char *ad,
+                                          unsigned long long adlen,
+                                          const unsigned char *nsec,
+                                          const unsigned char *npub,
+                                          const crypto_aead_aes256gcm_state *ctx_)
+            __attribute__ ((nonnull(1, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_aes256gcm_decrypt_afternm(unsigned char *m,
+                                          unsigned long long *mlen_p,
+                                          unsigned char *nsec,
+                                          const unsigned char *c,
+                                          unsigned long long clen,
+                                          const unsigned char *ad,
+                                          unsigned long long adlen,
+                                          const unsigned char *npub,
+                                          const crypto_aead_aes256gcm_state *ctx_)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_aes256gcm_encrypt_detached_afternm(unsigned char *c,
+                                                   unsigned char *mac,
+                                                   unsigned long long *maclen_p,
+                                                   const unsigned char *m,
+                                                   unsigned long long mlen,
+                                                   const unsigned char *ad,
+                                                   unsigned long long adlen,
+                                                   const unsigned char *nsec,
+                                                   const unsigned char *npub,
+                                                   const crypto_aead_aes256gcm_state *ctx_)
+            __attribute__ ((nonnull(1, 2, 9, 10)));
+
+SODIUM_EXPORT
+int crypto_aead_aes256gcm_decrypt_detached_afternm(unsigned char *m,
+                                                   unsigned char *nsec,
+                                                   const unsigned char *c,
+                                                   unsigned long long clen,
+                                                   const unsigned char *mac,
+                                                   const unsigned char *ad,
+                                                   unsigned long long adlen,
+                                                   const unsigned char *npub,
+                                                   const crypto_aead_aes256gcm_state *ctx_)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
+
+SODIUM_EXPORT
+void crypto_aead_aes256gcm_keygen(unsigned char k[crypto_aead_aes256gcm_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_aead_chacha20poly1305.h b/vendor/external/libsodium/include/sodium/crypto_aead_chacha20poly1305.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_aead_chacha20poly1305.h
@@ -0,0 +1,180 @@
+#ifndef crypto_aead_chacha20poly1305_H
+#define crypto_aead_chacha20poly1305_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+/* -- IETF ChaCha20-Poly1305 construction with a 96-bit nonce and a 32-bit internal counter -- */
+
+#define crypto_aead_chacha20poly1305_ietf_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_ietf_keybytes(void);
+
+#define crypto_aead_chacha20poly1305_ietf_NSECBYTES 0U
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_ietf_nsecbytes(void);
+
+#define crypto_aead_chacha20poly1305_ietf_NPUBBYTES 12U
+
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_ietf_npubbytes(void);
+
+#define crypto_aead_chacha20poly1305_ietf_ABYTES 16U
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_ietf_abytes(void);
+
+#define crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX \
+    SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ietf_ABYTES, \
+               (64ULL * ((1ULL << 32) - 1ULL)))
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_ietf_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_aead_chacha20poly1305_ietf_encrypt(unsigned char *c,
+                                              unsigned long long *clen_p,
+                                              const unsigned char *m,
+                                              unsigned long long mlen,
+                                              const unsigned char *ad,
+                                              unsigned long long adlen,
+                                              const unsigned char *nsec,
+                                              const unsigned char *npub,
+                                              const unsigned char *k)
+            __attribute__ ((nonnull(1, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_chacha20poly1305_ietf_decrypt(unsigned char *m,
+                                              unsigned long long *mlen_p,
+                                              unsigned char *nsec,
+                                              const unsigned char *c,
+                                              unsigned long long clen,
+                                              const unsigned char *ad,
+                                              unsigned long long adlen,
+                                              const unsigned char *npub,
+                                              const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_chacha20poly1305_ietf_encrypt_detached(unsigned char *c,
+                                                       unsigned char *mac,
+                                                       unsigned long long *maclen_p,
+                                                       const unsigned char *m,
+                                                       unsigned long long mlen,
+                                                       const unsigned char *ad,
+                                                       unsigned long long adlen,
+                                                       const unsigned char *nsec,
+                                                       const unsigned char *npub,
+                                                       const unsigned char *k)
+            __attribute__ ((nonnull(1, 2, 9, 10)));
+
+SODIUM_EXPORT
+int crypto_aead_chacha20poly1305_ietf_decrypt_detached(unsigned char *m,
+                                                       unsigned char *nsec,
+                                                       const unsigned char *c,
+                                                       unsigned long long clen,
+                                                       const unsigned char *mac,
+                                                       const unsigned char *ad,
+                                                       unsigned long long adlen,
+                                                       const unsigned char *npub,
+                                                       const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
+
+SODIUM_EXPORT
+void crypto_aead_chacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_chacha20poly1305_ietf_KEYBYTES])
+            __attribute__ ((nonnull));
+
+/* -- Original ChaCha20-Poly1305 construction with a 64-bit nonce and a 64-bit internal counter -- */
+
+#define crypto_aead_chacha20poly1305_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_keybytes(void);
+
+#define crypto_aead_chacha20poly1305_NSECBYTES 0U
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_nsecbytes(void);
+
+#define crypto_aead_chacha20poly1305_NPUBBYTES 8U
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_npubbytes(void);
+
+#define crypto_aead_chacha20poly1305_ABYTES 16U
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_abytes(void);
+
+#define crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX \
+    (SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ABYTES)
+SODIUM_EXPORT
+size_t crypto_aead_chacha20poly1305_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
+                                         unsigned long long *clen_p,
+                                         const unsigned char *m,
+                                         unsigned long long mlen,
+                                         const unsigned char *ad,
+                                         unsigned long long adlen,
+                                         const unsigned char *nsec,
+                                         const unsigned char *npub,
+                                         const unsigned char *k)
+            __attribute__ ((nonnull(1, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_chacha20poly1305_decrypt(unsigned char *m,
+                                         unsigned long long *mlen_p,
+                                         unsigned char *nsec,
+                                         const unsigned char *c,
+                                         unsigned long long clen,
+                                         const unsigned char *ad,
+                                         unsigned long long adlen,
+                                         const unsigned char *npub,
+                                         const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_chacha20poly1305_encrypt_detached(unsigned char *c,
+                                                  unsigned char *mac,
+                                                  unsigned long long *maclen_p,
+                                                  const unsigned char *m,
+                                                  unsigned long long mlen,
+                                                  const unsigned char *ad,
+                                                  unsigned long long adlen,
+                                                  const unsigned char *nsec,
+                                                  const unsigned char *npub,
+                                                  const unsigned char *k)
+            __attribute__ ((nonnull(1, 2, 9, 10)));
+
+SODIUM_EXPORT
+int crypto_aead_chacha20poly1305_decrypt_detached(unsigned char *m,
+                                                  unsigned char *nsec,
+                                                  const unsigned char *c,
+                                                  unsigned long long clen,
+                                                  const unsigned char *mac,
+                                                  const unsigned char *ad,
+                                                  unsigned long long adlen,
+                                                  const unsigned char *npub,
+                                                  const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
+
+SODIUM_EXPORT
+void crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_chacha20poly1305_KEYBYTES])
+            __attribute__ ((nonnull));
+
+/* Aliases */
+
+#define crypto_aead_chacha20poly1305_IETF_KEYBYTES         crypto_aead_chacha20poly1305_ietf_KEYBYTES
+#define crypto_aead_chacha20poly1305_IETF_NSECBYTES        crypto_aead_chacha20poly1305_ietf_NSECBYTES
+#define crypto_aead_chacha20poly1305_IETF_NPUBBYTES        crypto_aead_chacha20poly1305_ietf_NPUBBYTES
+#define crypto_aead_chacha20poly1305_IETF_ABYTES           crypto_aead_chacha20poly1305_ietf_ABYTES
+#define crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h b/vendor/external/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h
@@ -0,0 +1,100 @@
+#ifndef crypto_aead_xchacha20poly1305_H
+#define crypto_aead_xchacha20poly1305_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_aead_xchacha20poly1305_ietf_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_aead_xchacha20poly1305_ietf_keybytes(void);
+
+#define crypto_aead_xchacha20poly1305_ietf_NSECBYTES 0U
+SODIUM_EXPORT
+size_t crypto_aead_xchacha20poly1305_ietf_nsecbytes(void);
+
+#define crypto_aead_xchacha20poly1305_ietf_NPUBBYTES 24U
+SODIUM_EXPORT
+size_t crypto_aead_xchacha20poly1305_ietf_npubbytes(void);
+
+#define crypto_aead_xchacha20poly1305_ietf_ABYTES 16U
+SODIUM_EXPORT
+size_t crypto_aead_xchacha20poly1305_ietf_abytes(void);
+
+#define crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX \
+    (SODIUM_SIZE_MAX - crypto_aead_xchacha20poly1305_ietf_ABYTES)
+SODIUM_EXPORT
+size_t crypto_aead_xchacha20poly1305_ietf_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_aead_xchacha20poly1305_ietf_encrypt(unsigned char *c,
+                                               unsigned long long *clen_p,
+                                               const unsigned char *m,
+                                               unsigned long long mlen,
+                                               const unsigned char *ad,
+                                               unsigned long long adlen,
+                                               const unsigned char *nsec,
+                                               const unsigned char *npub,
+                                               const unsigned char *k)
+            __attribute__ ((nonnull(1, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_xchacha20poly1305_ietf_decrypt(unsigned char *m,
+                                               unsigned long long *mlen_p,
+                                               unsigned char *nsec,
+                                               const unsigned char *c,
+                                               unsigned long long clen,
+                                               const unsigned char *ad,
+                                               unsigned long long adlen,
+                                               const unsigned char *npub,
+                                               const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
+
+SODIUM_EXPORT
+int crypto_aead_xchacha20poly1305_ietf_encrypt_detached(unsigned char *c,
+                                                        unsigned char *mac,
+                                                        unsigned long long *maclen_p,
+                                                        const unsigned char *m,
+                                                        unsigned long long mlen,
+                                                        const unsigned char *ad,
+                                                        unsigned long long adlen,
+                                                        const unsigned char *nsec,
+                                                        const unsigned char *npub,
+                                                        const unsigned char *k)
+            __attribute__ ((nonnull(1, 2, 9, 10)));
+
+SODIUM_EXPORT
+int crypto_aead_xchacha20poly1305_ietf_decrypt_detached(unsigned char *m,
+                                                        unsigned char *nsec,
+                                                        const unsigned char *c,
+                                                        unsigned long long clen,
+                                                        const unsigned char *mac,
+                                                        const unsigned char *ad,
+                                                        unsigned long long adlen,
+                                                        const unsigned char *npub,
+                                                        const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
+
+SODIUM_EXPORT
+void crypto_aead_xchacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchacha20poly1305_ietf_KEYBYTES])
+            __attribute__ ((nonnull));
+
+/* Aliases */
+
+#define crypto_aead_xchacha20poly1305_IETF_KEYBYTES         crypto_aead_xchacha20poly1305_ietf_KEYBYTES
+#define crypto_aead_xchacha20poly1305_IETF_NSECBYTES        crypto_aead_xchacha20poly1305_ietf_NSECBYTES
+#define crypto_aead_xchacha20poly1305_IETF_NPUBBYTES        crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
+#define crypto_aead_xchacha20poly1305_IETF_ABYTES           crypto_aead_xchacha20poly1305_ietf_ABYTES
+#define crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_auth.h b/vendor/external/libsodium/include/sodium/crypto_auth.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_auth.h
@@ -0,0 +1,46 @@
+#ifndef crypto_auth_H
+#define crypto_auth_H
+
+#include <stddef.h>
+
+#include "crypto_auth_hmacsha512256.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES
+SODIUM_EXPORT
+size_t  crypto_auth_bytes(void);
+
+#define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES
+SODIUM_EXPORT
+size_t  crypto_auth_keybytes(void);
+
+#define crypto_auth_PRIMITIVE "hmacsha512256"
+SODIUM_EXPORT
+const char *crypto_auth_primitive(void);
+
+SODIUM_EXPORT
+int crypto_auth(unsigned char *out, const unsigned char *in,
+                unsigned long long inlen, const unsigned char *k)
+            __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_auth_verify(const unsigned char *h, const unsigned char *in,
+                       unsigned long long inlen, const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+void crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_auth_hmacsha256.h b/vendor/external/libsodium/include/sodium/crypto_auth_hmacsha256.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_auth_hmacsha256.h
@@ -0,0 +1,70 @@
+#ifndef crypto_auth_hmacsha256_H
+#define crypto_auth_hmacsha256_H
+
+#include <stddef.h>
+#include "crypto_hash_sha256.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_auth_hmacsha256_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha256_bytes(void);
+
+#define crypto_auth_hmacsha256_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha256_keybytes(void);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha256(unsigned char *out,
+                           const unsigned char *in,
+                           unsigned long long inlen,
+                           const unsigned char *k) __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha256_verify(const unsigned char *h,
+                                  const unsigned char *in,
+                                  unsigned long long inlen,
+                                  const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
+
+/* ------------------------------------------------------------------------- */
+
+typedef struct crypto_auth_hmacsha256_state {
+    crypto_hash_sha256_state ictx;
+    crypto_hash_sha256_state octx;
+} crypto_auth_hmacsha256_state;
+
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha256_statebytes(void);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state,
+                                const unsigned char *key,
+                                size_t keylen) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha256_update(crypto_auth_hmacsha256_state *state,
+                                  const unsigned char *in,
+                                  unsigned long long inlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state *state,
+                                 unsigned char *out) __attribute__ ((nonnull));
+
+
+SODIUM_EXPORT
+void crypto_auth_hmacsha256_keygen(unsigned char k[crypto_auth_hmacsha256_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_auth_hmacsha512.h b/vendor/external/libsodium/include/sodium/crypto_auth_hmacsha512.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_auth_hmacsha512.h
@@ -0,0 +1,68 @@
+#ifndef crypto_auth_hmacsha512_H
+#define crypto_auth_hmacsha512_H
+
+#include <stddef.h>
+#include "crypto_hash_sha512.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_auth_hmacsha512_BYTES 64U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha512_bytes(void);
+
+#define crypto_auth_hmacsha512_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha512_keybytes(void);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512(unsigned char *out,
+                           const unsigned char *in,
+                           unsigned long long inlen,
+                           const unsigned char *k) __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512_verify(const unsigned char *h,
+                                  const unsigned char *in,
+                                  unsigned long long inlen,
+                                  const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
+
+/* ------------------------------------------------------------------------- */
+
+typedef struct crypto_auth_hmacsha512_state {
+    crypto_hash_sha512_state ictx;
+    crypto_hash_sha512_state octx;
+} crypto_auth_hmacsha512_state;
+
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha512_statebytes(void);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state,
+                                const unsigned char *key,
+                                size_t keylen) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512_update(crypto_auth_hmacsha512_state *state,
+                                  const unsigned char *in,
+                                  unsigned long long inlen) __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512_final(crypto_auth_hmacsha512_state *state,
+                                 unsigned char *out) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_auth_hmacsha512_keygen(unsigned char k[crypto_auth_hmacsha512_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_auth_hmacsha512256.h b/vendor/external/libsodium/include/sodium/crypto_auth_hmacsha512256.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_auth_hmacsha512256.h
@@ -0,0 +1,65 @@
+#ifndef crypto_auth_hmacsha512256_H
+#define crypto_auth_hmacsha512256_H
+
+#include <stddef.h>
+#include "crypto_auth_hmacsha512.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_auth_hmacsha512256_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha512256_bytes(void);
+
+#define crypto_auth_hmacsha512256_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha512256_keybytes(void);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512256(unsigned char *out,
+                              const unsigned char *in,
+                              unsigned long long inlen,
+                              const unsigned char *k) __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512256_verify(const unsigned char *h,
+                                     const unsigned char *in,
+                                     unsigned long long inlen,
+                                     const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
+
+/* ------------------------------------------------------------------------- */
+
+typedef crypto_auth_hmacsha512_state crypto_auth_hmacsha512256_state;
+
+SODIUM_EXPORT
+size_t crypto_auth_hmacsha512256_statebytes(void);
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state,
+                                   const unsigned char *key,
+                                   size_t keylen) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512256_update(crypto_auth_hmacsha512256_state *state,
+                                     const unsigned char *in,
+                                     unsigned long long inlen) __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state *state,
+                                    unsigned char *out) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_auth_hmacsha512256_keygen(unsigned char k[crypto_auth_hmacsha512256_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_box.h b/vendor/external/libsodium/include/sodium/crypto_box.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_box.h
@@ -0,0 +1,177 @@
+#ifndef crypto_box_H
+#define crypto_box_H
+
+/*
+ * THREAD SAFETY: crypto_box_keypair() is thread-safe,
+ * provided that sodium_init() was called before.
+ *
+ * Other functions are always thread-safe.
+ */
+
+#include <stddef.h>
+
+#include "crypto_box_curve25519xsalsa20poly1305.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_box_SEEDBYTES crypto_box_curve25519xsalsa20poly1305_SEEDBYTES
+SODIUM_EXPORT
+size_t  crypto_box_seedbytes(void);
+
+#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
+SODIUM_EXPORT
+size_t  crypto_box_publickeybytes(void);
+
+#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES
+SODIUM_EXPORT
+size_t  crypto_box_secretkeybytes(void);
+
+#define crypto_box_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_NONCEBYTES
+SODIUM_EXPORT
+size_t  crypto_box_noncebytes(void);
+
+#define crypto_box_MACBYTES crypto_box_curve25519xsalsa20poly1305_MACBYTES
+SODIUM_EXPORT
+size_t  crypto_box_macbytes(void);
+
+#define crypto_box_MESSAGEBYTES_MAX crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX
+SODIUM_EXPORT
+size_t  crypto_box_messagebytes_max(void);
+
+#define crypto_box_PRIMITIVE "curve25519xsalsa20poly1305"
+SODIUM_EXPORT
+const char *crypto_box_primitive(void);
+
+SODIUM_EXPORT
+int crypto_box_seed_keypair(unsigned char *pk, unsigned char *sk,
+                            const unsigned char *seed)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_box_keypair(unsigned char *pk, unsigned char *sk)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_box_easy(unsigned char *c, const unsigned char *m,
+                    unsigned long long mlen, const unsigned char *n,
+                    const unsigned char *pk, const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_box_open_easy(unsigned char *m, const unsigned char *c,
+                         unsigned long long clen, const unsigned char *n,
+                         const unsigned char *pk, const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_box_detached(unsigned char *c, unsigned char *mac,
+                        const unsigned char *m, unsigned long long mlen,
+                        const unsigned char *n, const unsigned char *pk,
+                        const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 2, 5, 6, 7)));
+
+SODIUM_EXPORT
+int crypto_box_open_detached(unsigned char *m, const unsigned char *c,
+                             const unsigned char *mac,
+                             unsigned long long clen,
+                             const unsigned char *n,
+                             const unsigned char *pk,
+                             const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6, 7)));
+
+/* -- Precomputation interface -- */
+
+#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES
+SODIUM_EXPORT
+size_t  crypto_box_beforenmbytes(void);
+
+SODIUM_EXPORT
+int crypto_box_beforenm(unsigned char *k, const unsigned char *pk,
+                        const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_box_easy_afternm(unsigned char *c, const unsigned char *m,
+                            unsigned long long mlen, const unsigned char *n,
+                            const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_box_open_easy_afternm(unsigned char *m, const unsigned char *c,
+                                 unsigned long long clen, const unsigned char *n,
+                                 const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_box_detached_afternm(unsigned char *c, unsigned char *mac,
+                                const unsigned char *m, unsigned long long mlen,
+                                const unsigned char *n, const unsigned char *k)
+            __attribute__ ((nonnull(1, 2, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_box_open_detached_afternm(unsigned char *m, const unsigned char *c,
+                                     const unsigned char *mac,
+                                     unsigned long long clen, const unsigned char *n,
+                                     const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
+
+/* -- Ephemeral SK interface -- */
+
+#define crypto_box_SEALBYTES (crypto_box_PUBLICKEYBYTES + crypto_box_MACBYTES)
+SODIUM_EXPORT
+size_t crypto_box_sealbytes(void);
+
+SODIUM_EXPORT
+int crypto_box_seal(unsigned char *c, const unsigned char *m,
+                    unsigned long long mlen, const unsigned char *pk)
+            __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_box_seal_open(unsigned char *m, const unsigned char *c,
+                         unsigned long long clen,
+                         const unsigned char *pk, const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
+
+/* -- NaCl compatibility interface ; Requires padding -- */
+
+#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
+SODIUM_EXPORT
+size_t  crypto_box_zerobytes(void);
+
+#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES
+SODIUM_EXPORT
+size_t  crypto_box_boxzerobytes(void);
+
+SODIUM_EXPORT
+int crypto_box(unsigned char *c, const unsigned char *m,
+               unsigned long long mlen, const unsigned char *n,
+               const unsigned char *pk, const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_box_open(unsigned char *m, const unsigned char *c,
+                    unsigned long long clen, const unsigned char *n,
+                    const unsigned char *pk, const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_box_afternm(unsigned char *c, const unsigned char *m,
+                       unsigned long long mlen, const unsigned char *n,
+                       const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_box_open_afternm(unsigned char *m, const unsigned char *c,
+                            unsigned long long clen, const unsigned char *n,
+                            const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h b/vendor/external/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h
@@ -0,0 +1,164 @@
+
+#ifndef crypto_box_curve25519xchacha20poly1305_H
+#define crypto_box_curve25519xchacha20poly1305_H
+
+#include <stddef.h>
+#include "crypto_stream_xchacha20.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_box_curve25519xchacha20poly1305_SEEDBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xchacha20poly1305_seedbytes(void);
+
+#define crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xchacha20poly1305_publickeybytes(void);
+
+#define crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xchacha20poly1305_secretkeybytes(void);
+
+#define crypto_box_curve25519xchacha20poly1305_BEFORENMBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xchacha20poly1305_beforenmbytes(void);
+
+#define crypto_box_curve25519xchacha20poly1305_NONCEBYTES 24U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xchacha20poly1305_noncebytes(void);
+
+#define crypto_box_curve25519xchacha20poly1305_MACBYTES 16U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xchacha20poly1305_macbytes(void);
+
+#define crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX \
+    (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_box_curve25519xchacha20poly1305_MACBYTES)
+SODIUM_EXPORT
+size_t crypto_box_curve25519xchacha20poly1305_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_seed_keypair(unsigned char *pk,
+                                                        unsigned char *sk,
+                                                        const unsigned char *seed)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_keypair(unsigned char *pk,
+                                                   unsigned char *sk)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_easy(unsigned char *c,
+                                                const unsigned char *m,
+                                                unsigned long long mlen,
+                                                const unsigned char *n,
+                                                const unsigned char *pk,
+                                                const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_open_easy(unsigned char *m,
+                                                     const unsigned char *c,
+                                                     unsigned long long clen,
+                                                     const unsigned char *n,
+                                                     const unsigned char *pk,
+                                                     const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_detached(unsigned char *c,
+                                                    unsigned char *mac,
+                                                    const unsigned char *m,
+                                                    unsigned long long mlen,
+                                                    const unsigned char *n,
+                                                    const unsigned char *pk,
+                                                    const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 2, 5, 6, 7)));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_open_detached(unsigned char *m,
+                                                         const unsigned char *c,
+                                                         const unsigned char *mac,
+                                                         unsigned long long clen,
+                                                         const unsigned char *n,
+                                                         const unsigned char *pk,
+                                                         const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6, 7)));
+
+/* -- Precomputation interface -- */
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_beforenm(unsigned char *k,
+                                                    const unsigned char *pk,
+                                                    const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_easy_afternm(unsigned char *c,
+                                                        const unsigned char *m,
+                                                        unsigned long long mlen,
+                                                        const unsigned char *n,
+                                                        const unsigned char *k)
+            __attribute__ ((nonnull(1, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_open_easy_afternm(unsigned char *m,
+                                                             const unsigned char *c,
+                                                             unsigned long long clen,
+                                                             const unsigned char *n,
+                                                             const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_detached_afternm(unsigned char *c,
+                                                            unsigned char *mac,
+                                                            const unsigned char *m,
+                                                            unsigned long long mlen,
+                                                            const unsigned char *n,
+                                                            const unsigned char *k)
+            __attribute__ ((nonnull(1, 2, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_open_detached_afternm(unsigned char *m,
+                                                                 const unsigned char *c,
+                                                                 const unsigned char *mac,
+                                                                 unsigned long long clen,
+                                                                 const unsigned char *n,
+                                                                 const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
+
+/* -- Ephemeral SK interface -- */
+
+#define crypto_box_curve25519xchacha20poly1305_SEALBYTES \
+    (crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES + \
+     crypto_box_curve25519xchacha20poly1305_MACBYTES)
+
+SODIUM_EXPORT
+size_t crypto_box_curve25519xchacha20poly1305_sealbytes(void);
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_seal(unsigned char *c,
+                                                const unsigned char *m,
+                                                unsigned long long mlen,
+                                                const unsigned char *pk)
+            __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xchacha20poly1305_seal_open(unsigned char *m,
+                                                     const unsigned char *c,
+                                                     unsigned long long clen,
+                                                     const unsigned char *pk,
+                                                     const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h b/vendor/external/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h
@@ -0,0 +1,112 @@
+#ifndef crypto_box_curve25519xsalsa20poly1305_H
+#define crypto_box_curve25519xsalsa20poly1305_H
+
+#include <stddef.h>
+#include "crypto_stream_xsalsa20.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_box_curve25519xsalsa20poly1305_SEEDBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_seedbytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_publickeybytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_secretkeybytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES 32U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_beforenmbytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_NONCEBYTES 24U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_noncebytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_MACBYTES 16U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void);
+
+/* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */
+#define crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX \
+    (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_box_curve25519xsalsa20poly1305_MACBYTES)
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
+                                                       unsigned char *sk,
+                                                       const unsigned char *seed)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk,
+                                                  unsigned char *sk)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
+                                                   const unsigned char *pk,
+                                                   const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+/* -- NaCl compatibility interface ; Requires padding -- */
+
+#define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES 16U
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void);
+
+#define crypto_box_curve25519xsalsa20poly1305_ZEROBYTES \
+    (crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES + \
+     crypto_box_curve25519xsalsa20poly1305_MACBYTES)
+SODIUM_EXPORT
+size_t crypto_box_curve25519xsalsa20poly1305_zerobytes(void);
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305(unsigned char *c,
+                                          const unsigned char *m,
+                                          unsigned long long mlen,
+                                          const unsigned char *n,
+                                          const unsigned char *pk,
+                                          const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m,
+                                               const unsigned char *c,
+                                               unsigned long long clen,
+                                               const unsigned char *n,
+                                               const unsigned char *pk,
+                                               const unsigned char *sk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_afternm(unsigned char *c,
+                                                  const unsigned char *m,
+                                                  unsigned long long mlen,
+                                                  const unsigned char *n,
+                                                  const unsigned char *k)
+            __attribute__ ((nonnull(1, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_box_curve25519xsalsa20poly1305_open_afternm(unsigned char *m,
+                                                       const unsigned char *c,
+                                                       unsigned long long clen,
+                                                       const unsigned char *n,
+                                                       const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_core_ed25519.h b/vendor/external/libsodium/include/sodium/crypto_core_ed25519.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_core_ed25519.h
@@ -0,0 +1,100 @@
+#ifndef crypto_core_ed25519_H
+#define crypto_core_ed25519_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_core_ed25519_BYTES 32
+SODIUM_EXPORT
+size_t crypto_core_ed25519_bytes(void);
+
+#define crypto_core_ed25519_UNIFORMBYTES 32
+SODIUM_EXPORT
+size_t crypto_core_ed25519_uniformbytes(void);
+
+#define crypto_core_ed25519_HASHBYTES 64
+SODIUM_EXPORT
+size_t crypto_core_ed25519_hashbytes(void);
+
+#define crypto_core_ed25519_SCALARBYTES 32
+SODIUM_EXPORT
+size_t crypto_core_ed25519_scalarbytes(void);
+
+#define crypto_core_ed25519_NONREDUCEDSCALARBYTES 64
+SODIUM_EXPORT
+size_t crypto_core_ed25519_nonreducedscalarbytes(void);
+
+SODIUM_EXPORT
+int crypto_core_ed25519_is_valid_point(const unsigned char *p)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_core_ed25519_add(unsigned char *r,
+                            const unsigned char *p, const unsigned char *q)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_core_ed25519_sub(unsigned char *r,
+                            const unsigned char *p, const unsigned char *q)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_core_ed25519_from_uniform(unsigned char *p, const unsigned char *r)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_core_ed25519_from_hash(unsigned char *p, const unsigned char *h)
+            __attribute__ ((nonnull)) __attribute__ ((deprecated));
+
+SODIUM_EXPORT
+void crypto_core_ed25519_random(unsigned char *p)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ed25519_scalar_random(unsigned char *r)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_core_ed25519_scalar_invert(unsigned char *recip, const unsigned char *s)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ed25519_scalar_negate(unsigned char *neg, const unsigned char *s)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ed25519_scalar_complement(unsigned char *comp, const unsigned char *s)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ed25519_scalar_add(unsigned char *z, const unsigned char *x,
+                                    const unsigned char *y)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ed25519_scalar_sub(unsigned char *z, const unsigned char *x,
+                                    const unsigned char *y)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ed25519_scalar_mul(unsigned char *z, const unsigned char *x,
+                                    const unsigned char *y)
+            __attribute__ ((nonnull));
+
+/*
+ * The interval `s` is sampled from should be at least 317 bits to ensure almost
+ * uniformity of `r` over `L`.
+ */
+SODIUM_EXPORT
+void crypto_core_ed25519_scalar_reduce(unsigned char *r, const unsigned char *s)
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_core_hchacha20.h b/vendor/external/libsodium/include/sodium/crypto_core_hchacha20.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_core_hchacha20.h
@@ -0,0 +1,36 @@
+#ifndef crypto_core_hchacha20_H
+#define crypto_core_hchacha20_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_core_hchacha20_OUTPUTBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_hchacha20_outputbytes(void);
+
+#define crypto_core_hchacha20_INPUTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_hchacha20_inputbytes(void);
+
+#define crypto_core_hchacha20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_hchacha20_keybytes(void);
+
+#define crypto_core_hchacha20_CONSTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_hchacha20_constbytes(void);
+
+SODIUM_EXPORT
+int crypto_core_hchacha20(unsigned char *out, const unsigned char *in,
+                          const unsigned char *k, const unsigned char *c)
+            __attribute__ ((nonnull(1, 2, 3)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_core_hsalsa20.h b/vendor/external/libsodium/include/sodium/crypto_core_hsalsa20.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_core_hsalsa20.h
@@ -0,0 +1,36 @@
+#ifndef crypto_core_hsalsa20_H
+#define crypto_core_hsalsa20_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_core_hsalsa20_OUTPUTBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_hsalsa20_outputbytes(void);
+
+#define crypto_core_hsalsa20_INPUTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_hsalsa20_inputbytes(void);
+
+#define crypto_core_hsalsa20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_hsalsa20_keybytes(void);
+
+#define crypto_core_hsalsa20_CONSTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_hsalsa20_constbytes(void);
+
+SODIUM_EXPORT
+int crypto_core_hsalsa20(unsigned char *out, const unsigned char *in,
+                         const unsigned char *k, const unsigned char *c)
+            __attribute__ ((nonnull(1, 2, 3)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_core_ristretto255.h b/vendor/external/libsodium/include/sodium/crypto_core_ristretto255.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_core_ristretto255.h
@@ -0,0 +1,100 @@
+#ifndef crypto_core_ristretto255_H
+#define crypto_core_ristretto255_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_core_ristretto255_BYTES 32
+SODIUM_EXPORT
+size_t crypto_core_ristretto255_bytes(void);
+
+#define crypto_core_ristretto255_HASHBYTES 64
+SODIUM_EXPORT
+size_t crypto_core_ristretto255_hashbytes(void);
+
+#define crypto_core_ristretto255_SCALARBYTES 32
+SODIUM_EXPORT
+size_t crypto_core_ristretto255_scalarbytes(void);
+
+#define crypto_core_ristretto255_NONREDUCEDSCALARBYTES 64
+SODIUM_EXPORT
+size_t crypto_core_ristretto255_nonreducedscalarbytes(void);
+
+SODIUM_EXPORT
+int crypto_core_ristretto255_is_valid_point(const unsigned char *p)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_core_ristretto255_add(unsigned char *r,
+                                 const unsigned char *p, const unsigned char *q)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_core_ristretto255_sub(unsigned char *r,
+                                 const unsigned char *p, const unsigned char *q)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_core_ristretto255_from_hash(unsigned char *p,
+                                       const unsigned char *r)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ristretto255_random(unsigned char *p)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ristretto255_scalar_random(unsigned char *r)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_core_ristretto255_scalar_invert(unsigned char *recip,
+                                           const unsigned char *s)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ristretto255_scalar_negate(unsigned char *neg,
+                                            const unsigned char *s)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ristretto255_scalar_complement(unsigned char *comp,
+                                                const unsigned char *s)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ristretto255_scalar_add(unsigned char *z,
+                                         const unsigned char *x,
+                                         const unsigned char *y)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ristretto255_scalar_sub(unsigned char *z,
+                                         const unsigned char *x,
+                                         const unsigned char *y)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_core_ristretto255_scalar_mul(unsigned char *z,
+                                         const unsigned char *x,
+                                         const unsigned char *y)
+            __attribute__ ((nonnull));
+
+/*
+ * The interval `s` is sampled from should be at least 317 bits to ensure almost
+ * uniformity of `r` over `L`.
+ */
+SODIUM_EXPORT
+void crypto_core_ristretto255_scalar_reduce(unsigned char *r,
+                                            const unsigned char *s)
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_core_salsa20.h b/vendor/external/libsodium/include/sodium/crypto_core_salsa20.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_core_salsa20.h
@@ -0,0 +1,36 @@
+#ifndef crypto_core_salsa20_H
+#define crypto_core_salsa20_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_core_salsa20_OUTPUTBYTES 64U
+SODIUM_EXPORT
+size_t crypto_core_salsa20_outputbytes(void);
+
+#define crypto_core_salsa20_INPUTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa20_inputbytes(void);
+
+#define crypto_core_salsa20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_salsa20_keybytes(void);
+
+#define crypto_core_salsa20_CONSTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa20_constbytes(void);
+
+SODIUM_EXPORT
+int crypto_core_salsa20(unsigned char *out, const unsigned char *in,
+                        const unsigned char *k, const unsigned char *c)
+            __attribute__ ((nonnull(1, 2, 3)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_core_salsa2012.h b/vendor/external/libsodium/include/sodium/crypto_core_salsa2012.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_core_salsa2012.h
@@ -0,0 +1,36 @@
+#ifndef crypto_core_salsa2012_H
+#define crypto_core_salsa2012_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_core_salsa2012_OUTPUTBYTES 64U
+SODIUM_EXPORT
+size_t crypto_core_salsa2012_outputbytes(void);
+
+#define crypto_core_salsa2012_INPUTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa2012_inputbytes(void);
+
+#define crypto_core_salsa2012_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_salsa2012_keybytes(void);
+
+#define crypto_core_salsa2012_CONSTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa2012_constbytes(void);
+
+SODIUM_EXPORT
+int crypto_core_salsa2012(unsigned char *out, const unsigned char *in,
+                          const unsigned char *k, const unsigned char *c)
+            __attribute__ ((nonnull(1, 2, 3)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_core_salsa208.h b/vendor/external/libsodium/include/sodium/crypto_core_salsa208.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_core_salsa208.h
@@ -0,0 +1,40 @@
+#ifndef crypto_core_salsa208_H
+#define crypto_core_salsa208_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_core_salsa208_OUTPUTBYTES 64U
+SODIUM_EXPORT
+size_t crypto_core_salsa208_outputbytes(void)
+            __attribute__ ((deprecated));
+
+#define crypto_core_salsa208_INPUTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa208_inputbytes(void)
+            __attribute__ ((deprecated));
+
+#define crypto_core_salsa208_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_core_salsa208_keybytes(void)
+            __attribute__ ((deprecated));
+
+#define crypto_core_salsa208_CONSTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_core_salsa208_constbytes(void)
+            __attribute__ ((deprecated));
+
+SODIUM_EXPORT
+int crypto_core_salsa208(unsigned char *out, const unsigned char *in,
+                         const unsigned char *k, const unsigned char *c)
+            __attribute__ ((nonnull(1, 2, 3)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_generichash.h b/vendor/external/libsodium/include/sodium/crypto_generichash.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_generichash.h
@@ -0,0 +1,84 @@
+#ifndef crypto_generichash_H
+#define crypto_generichash_H
+
+#include <stddef.h>
+
+#include "crypto_generichash_blake2b.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_generichash_BYTES_MIN crypto_generichash_blake2b_BYTES_MIN
+SODIUM_EXPORT
+size_t  crypto_generichash_bytes_min(void);
+
+#define crypto_generichash_BYTES_MAX crypto_generichash_blake2b_BYTES_MAX
+SODIUM_EXPORT
+size_t  crypto_generichash_bytes_max(void);
+
+#define crypto_generichash_BYTES crypto_generichash_blake2b_BYTES
+SODIUM_EXPORT
+size_t  crypto_generichash_bytes(void);
+
+#define crypto_generichash_KEYBYTES_MIN crypto_generichash_blake2b_KEYBYTES_MIN
+SODIUM_EXPORT
+size_t  crypto_generichash_keybytes_min(void);
+
+#define crypto_generichash_KEYBYTES_MAX crypto_generichash_blake2b_KEYBYTES_MAX
+SODIUM_EXPORT
+size_t  crypto_generichash_keybytes_max(void);
+
+#define crypto_generichash_KEYBYTES crypto_generichash_blake2b_KEYBYTES
+SODIUM_EXPORT
+size_t  crypto_generichash_keybytes(void);
+
+#define crypto_generichash_PRIMITIVE "blake2b"
+SODIUM_EXPORT
+const char *crypto_generichash_primitive(void);
+
+/*
+ * Important when writing bindings for other programming languages:
+ * the state address should be 64-bytes aligned.
+ */
+typedef crypto_generichash_blake2b_state crypto_generichash_state;
+
+SODIUM_EXPORT
+size_t  crypto_generichash_statebytes(void);
+
+SODIUM_EXPORT
+int crypto_generichash(unsigned char *out, size_t outlen,
+                       const unsigned char *in, unsigned long long inlen,
+                       const unsigned char *key, size_t keylen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_generichash_init(crypto_generichash_state *state,
+                            const unsigned char *key,
+                            const size_t keylen, const size_t outlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_generichash_update(crypto_generichash_state *state,
+                              const unsigned char *in,
+                              unsigned long long inlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_generichash_final(crypto_generichash_state *state,
+                             unsigned char *out, const size_t outlen)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_generichash_keygen(unsigned char k[crypto_generichash_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_generichash_blake2b.h b/vendor/external/libsodium/include/sodium/crypto_generichash_blake2b.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_generichash_blake2b.h
@@ -0,0 +1,122 @@
+#ifndef crypto_generichash_blake2b_H
+#define crypto_generichash_blake2b_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#ifdef __IBMC__
+# pragma pack(1)
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+# pragma pack(1)
+#else
+# pragma pack(push, 1)
+#endif
+
+typedef struct CRYPTO_ALIGN(64) crypto_generichash_blake2b_state {
+    unsigned char opaque[384];
+} crypto_generichash_blake2b_state;
+
+#ifdef __IBMC__
+# pragma pack(pop)
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+# pragma pack()
+#else
+# pragma pack(pop)
+#endif
+
+#define crypto_generichash_blake2b_BYTES_MIN     16U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_bytes_min(void);
+
+#define crypto_generichash_blake2b_BYTES_MAX     64U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_bytes_max(void);
+
+#define crypto_generichash_blake2b_BYTES         32U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_bytes(void);
+
+#define crypto_generichash_blake2b_KEYBYTES_MIN  16U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_keybytes_min(void);
+
+#define crypto_generichash_blake2b_KEYBYTES_MAX  64U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_keybytes_max(void);
+
+#define crypto_generichash_blake2b_KEYBYTES      32U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_keybytes(void);
+
+#define crypto_generichash_blake2b_SALTBYTES     16U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_saltbytes(void);
+
+#define crypto_generichash_blake2b_PERSONALBYTES 16U
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_personalbytes(void);
+
+SODIUM_EXPORT
+size_t crypto_generichash_blake2b_statebytes(void);
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b(unsigned char *out, size_t outlen,
+                               const unsigned char *in,
+                               unsigned long long inlen,
+                               const unsigned char *key, size_t keylen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b_salt_personal(unsigned char *out, size_t outlen,
+                                             const unsigned char *in,
+                                             unsigned long long inlen,
+                                             const unsigned char *key,
+                                             size_t keylen,
+                                             const unsigned char *salt,
+                                             const unsigned char *personal)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
+                                    const unsigned char *key,
+                                    const size_t keylen, const size_t outlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b_init_salt_personal(crypto_generichash_blake2b_state *state,
+                                                  const unsigned char *key,
+                                                  const size_t keylen, const size_t outlen,
+                                                  const unsigned char *salt,
+                                                  const unsigned char *personal)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state,
+                                      const unsigned char *in,
+                                      unsigned long long inlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state,
+                                     unsigned char *out,
+                                     const size_t outlen) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_generichash_blake2b_keygen(unsigned char k[crypto_generichash_blake2b_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_hash.h b/vendor/external/libsodium/include/sodium/crypto_hash.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_hash.h
@@ -0,0 +1,40 @@
+#ifndef crypto_hash_H
+#define crypto_hash_H
+
+/*
+ * WARNING: Unless you absolutely need to use SHA512 for interoperability,
+ * purposes, you might want to consider crypto_generichash() instead.
+ * Unlike SHA512, crypto_generichash() is not vulnerable to length
+ * extension attacks.
+ */
+
+#include <stddef.h>
+
+#include "crypto_hash_sha512.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_hash_BYTES crypto_hash_sha512_BYTES
+SODIUM_EXPORT
+size_t crypto_hash_bytes(void);
+
+SODIUM_EXPORT
+int crypto_hash(unsigned char *out, const unsigned char *in,
+                unsigned long long inlen) __attribute__ ((nonnull(1)));
+
+#define crypto_hash_PRIMITIVE "sha512"
+SODIUM_EXPORT
+const char *crypto_hash_primitive(void)
+            __attribute__ ((warn_unused_result));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_hash_sha256.h b/vendor/external/libsodium/include/sodium/crypto_hash_sha256.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_hash_sha256.h
@@ -0,0 +1,60 @@
+#ifndef crypto_hash_sha256_H
+#define crypto_hash_sha256_H
+
+/*
+ * WARNING: Unless you absolutely need to use SHA256 for interoperability,
+ * purposes, you might want to consider crypto_generichash() instead.
+ * Unlike SHA256, crypto_generichash() is not vulnerable to length
+ * extension attacks.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef struct crypto_hash_sha256_state {
+    uint32_t state[8];
+    uint64_t count;
+    uint8_t  buf[64];
+} crypto_hash_sha256_state;
+
+SODIUM_EXPORT
+size_t crypto_hash_sha256_statebytes(void);
+
+#define crypto_hash_sha256_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_hash_sha256_bytes(void);
+
+SODIUM_EXPORT
+int crypto_hash_sha256(unsigned char *out, const unsigned char *in,
+                       unsigned long long inlen) __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_hash_sha256_init(crypto_hash_sha256_state *state)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_hash_sha256_update(crypto_hash_sha256_state *state,
+                              const unsigned char *in,
+                              unsigned long long inlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_hash_sha256_final(crypto_hash_sha256_state *state,
+                             unsigned char *out)
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_hash_sha512.h b/vendor/external/libsodium/include/sodium/crypto_hash_sha512.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_hash_sha512.h
@@ -0,0 +1,60 @@
+#ifndef crypto_hash_sha512_H
+#define crypto_hash_sha512_H
+
+/*
+ * WARNING: Unless you absolutely need to use SHA512 for interoperability,
+ * purposes, you might want to consider crypto_generichash() instead.
+ * Unlike SHA512, crypto_generichash() is not vulnerable to length
+ * extension attacks.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef struct crypto_hash_sha512_state {
+    uint64_t state[8];
+    uint64_t count[2];
+    uint8_t  buf[128];
+} crypto_hash_sha512_state;
+
+SODIUM_EXPORT
+size_t crypto_hash_sha512_statebytes(void);
+
+#define crypto_hash_sha512_BYTES 64U
+SODIUM_EXPORT
+size_t crypto_hash_sha512_bytes(void);
+
+SODIUM_EXPORT
+int crypto_hash_sha512(unsigned char *out, const unsigned char *in,
+                       unsigned long long inlen) __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_hash_sha512_init(crypto_hash_sha512_state *state)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_hash_sha512_update(crypto_hash_sha512_state *state,
+                              const unsigned char *in,
+                              unsigned long long inlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_hash_sha512_final(crypto_hash_sha512_state *state,
+                             unsigned char *out)
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_kdf.h b/vendor/external/libsodium/include/sodium/crypto_kdf.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_kdf.h
@@ -0,0 +1,53 @@
+#ifndef crypto_kdf_H
+#define crypto_kdf_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "crypto_kdf_blake2b.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_kdf_BYTES_MIN crypto_kdf_blake2b_BYTES_MIN
+SODIUM_EXPORT
+size_t crypto_kdf_bytes_min(void);
+
+#define crypto_kdf_BYTES_MAX crypto_kdf_blake2b_BYTES_MAX
+SODIUM_EXPORT
+size_t crypto_kdf_bytes_max(void);
+
+#define crypto_kdf_CONTEXTBYTES crypto_kdf_blake2b_CONTEXTBYTES
+SODIUM_EXPORT
+size_t crypto_kdf_contextbytes(void);
+
+#define crypto_kdf_KEYBYTES crypto_kdf_blake2b_KEYBYTES
+SODIUM_EXPORT
+size_t crypto_kdf_keybytes(void);
+
+#define crypto_kdf_PRIMITIVE "blake2b"
+SODIUM_EXPORT
+const char *crypto_kdf_primitive(void)
+            __attribute__ ((warn_unused_result));
+
+SODIUM_EXPORT
+int crypto_kdf_derive_from_key(unsigned char *subkey, size_t subkey_len,
+                               uint64_t subkey_id,
+                               const char ctx[crypto_kdf_CONTEXTBYTES],
+                               const unsigned char key[crypto_kdf_KEYBYTES])
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_kdf_blake2b.h b/vendor/external/libsodium/include/sodium/crypto_kdf_blake2b.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_kdf_blake2b.h
@@ -0,0 +1,44 @@
+#ifndef crypto_kdf_blake2b_H
+#define crypto_kdf_blake2b_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_kdf_blake2b_BYTES_MIN 16
+SODIUM_EXPORT
+size_t crypto_kdf_blake2b_bytes_min(void);
+
+#define crypto_kdf_blake2b_BYTES_MAX 64
+SODIUM_EXPORT
+size_t crypto_kdf_blake2b_bytes_max(void);
+
+#define crypto_kdf_blake2b_CONTEXTBYTES 8
+SODIUM_EXPORT
+size_t crypto_kdf_blake2b_contextbytes(void);
+
+#define crypto_kdf_blake2b_KEYBYTES 32
+SODIUM_EXPORT
+size_t crypto_kdf_blake2b_keybytes(void);
+
+SODIUM_EXPORT
+int crypto_kdf_blake2b_derive_from_key(unsigned char *subkey, size_t subkey_len,
+                                       uint64_t subkey_id,
+                                       const char ctx[crypto_kdf_blake2b_CONTEXTBYTES],
+                                       const unsigned char key[crypto_kdf_blake2b_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_kdf_hkdf_sha256.h b/vendor/external/libsodium/include/sodium/crypto_kdf_hkdf_sha256.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_kdf_hkdf_sha256.h
@@ -0,0 +1,74 @@
+#ifndef crypto_kdf_hkdf_sha256_H
+#define crypto_kdf_hkdf_sha256_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "crypto_kdf.h"
+#include "crypto_auth_hmacsha256.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_kdf_hkdf_sha256_KEYBYTES crypto_auth_hmacsha256_BYTES
+SODIUM_EXPORT
+size_t crypto_kdf_hkdf_sha256_keybytes(void);
+
+#define crypto_kdf_hkdf_sha256_BYTES_MIN 0U
+SODIUM_EXPORT
+size_t crypto_kdf_hkdf_sha256_bytes_min(void);
+
+#define crypto_kdf_hkdf_sha256_BYTES_MAX (0xff * crypto_auth_hmacsha256_BYTES)
+SODIUM_EXPORT
+size_t crypto_kdf_hkdf_sha256_bytes_max(void);
+
+SODIUM_EXPORT
+int crypto_kdf_hkdf_sha256_extract(unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES],
+                                   const unsigned char *salt, size_t salt_len,
+                                   const unsigned char *ikm, size_t ikm_len)
+            __attribute__ ((nonnull(4)));
+
+SODIUM_EXPORT
+void crypto_kdf_hkdf_sha256_keygen(unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES]);
+
+SODIUM_EXPORT
+int crypto_kdf_hkdf_sha256_expand(unsigned char *out, size_t out_len,
+                                  const char *ctx, size_t ctx_len,
+                                  const unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES])
+            __attribute__ ((nonnull(1)));
+
+/* ------------------------------------------------------------------------- */
+
+typedef struct crypto_kdf_hkdf_sha256_state {
+    crypto_auth_hmacsha256_state st;
+} crypto_kdf_hkdf_sha256_state;
+
+SODIUM_EXPORT
+size_t crypto_kdf_hkdf_sha256_statebytes(void);
+
+SODIUM_EXPORT
+int crypto_kdf_hkdf_sha256_extract_init(crypto_kdf_hkdf_sha256_state *state,
+                                        const unsigned char *salt, size_t salt_len)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_kdf_hkdf_sha256_extract_update(crypto_kdf_hkdf_sha256_state *state,
+                                          const unsigned char *ikm, size_t ikm_len)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_kdf_hkdf_sha256_extract_final(crypto_kdf_hkdf_sha256_state *state,
+                                         unsigned char prk[crypto_kdf_hkdf_sha256_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_kdf_hkdf_sha512.h b/vendor/external/libsodium/include/sodium/crypto_kdf_hkdf_sha512.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_kdf_hkdf_sha512.h
@@ -0,0 +1,75 @@
+#ifndef crypto_kdf_hkdf_sha512_H
+#define crypto_kdf_hkdf_sha512_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "crypto_kdf.h"
+#include "crypto_auth_hmacsha512.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_kdf_hkdf_sha512_KEYBYTES crypto_auth_hmacsha512_BYTES
+SODIUM_EXPORT
+size_t crypto_kdf_hkdf_sha512_keybytes(void);
+
+#define crypto_kdf_hkdf_sha512_BYTES_MIN 0U
+SODIUM_EXPORT
+size_t crypto_kdf_hkdf_sha512_bytes_min(void);
+
+#define crypto_kdf_hkdf_sha512_BYTES_MAX (0xff * crypto_auth_hmacsha512_BYTES)
+SODIUM_EXPORT
+size_t crypto_kdf_hkdf_sha512_bytes_max(void);
+
+SODIUM_EXPORT
+int crypto_kdf_hkdf_sha512_extract(unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES],
+                                   const unsigned char *salt, size_t salt_len,
+                                   const unsigned char *ikm, size_t ikm_len)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+void crypto_kdf_hkdf_sha512_keygen(unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_kdf_hkdf_sha512_expand(unsigned char *out, size_t out_len,
+                                  const char *ctx, size_t ctx_len,
+                                  const unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
+            __attribute__ ((nonnull(1)));
+
+/* ------------------------------------------------------------------------- */
+
+typedef struct crypto_kdf_hkdf_sha512_state {
+    crypto_auth_hmacsha512_state st;
+} crypto_kdf_hkdf_sha512_state;
+
+SODIUM_EXPORT
+size_t crypto_kdf_hkdf_sha512_statebytes(void);
+
+SODIUM_EXPORT
+int crypto_kdf_hkdf_sha512_extract_init(crypto_kdf_hkdf_sha512_state *state,
+                                        const unsigned char *salt, size_t salt_len)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_kdf_hkdf_sha512_extract_update(crypto_kdf_hkdf_sha512_state *state,
+                                          const unsigned char *ikm, size_t ikm_len)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_kdf_hkdf_sha512_extract_final(crypto_kdf_hkdf_sha512_state *state,
+                                         unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_kx.h b/vendor/external/libsodium/include/sodium/crypto_kx.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_kx.h
@@ -0,0 +1,66 @@
+#ifndef crypto_kx_H
+#define crypto_kx_H
+
+#include <stddef.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_kx_PUBLICKEYBYTES 32
+SODIUM_EXPORT
+size_t crypto_kx_publickeybytes(void);
+
+#define crypto_kx_SECRETKEYBYTES 32
+SODIUM_EXPORT
+size_t crypto_kx_secretkeybytes(void);
+
+#define crypto_kx_SEEDBYTES 32
+SODIUM_EXPORT
+size_t crypto_kx_seedbytes(void);
+
+#define crypto_kx_SESSIONKEYBYTES 32
+SODIUM_EXPORT
+size_t crypto_kx_sessionkeybytes(void);
+
+#define crypto_kx_PRIMITIVE "x25519blake2b"
+SODIUM_EXPORT
+const char *crypto_kx_primitive(void);
+
+SODIUM_EXPORT
+int crypto_kx_seed_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES],
+                           unsigned char sk[crypto_kx_SECRETKEYBYTES],
+                           const unsigned char seed[crypto_kx_SEEDBYTES])
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_kx_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES],
+                      unsigned char sk[crypto_kx_SECRETKEYBYTES])
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_kx_client_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
+                                  unsigned char tx[crypto_kx_SESSIONKEYBYTES],
+                                  const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES],
+                                  const unsigned char client_sk[crypto_kx_SECRETKEYBYTES],
+                                  const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES])
+            __attribute__ ((warn_unused_result))  __attribute__ ((nonnull(3, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_kx_server_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
+                                  unsigned char tx[crypto_kx_SESSIONKEYBYTES],
+                                  const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES],
+                                  const unsigned char server_sk[crypto_kx_SECRETKEYBYTES],
+                                  const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES])
+            __attribute__ ((warn_unused_result))  __attribute__ ((nonnull(3, 4, 5)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_onetimeauth.h b/vendor/external/libsodium/include/sodium/crypto_onetimeauth.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_onetimeauth.h
@@ -0,0 +1,65 @@
+#ifndef crypto_onetimeauth_H
+#define crypto_onetimeauth_H
+
+#include <stddef.h>
+
+#include "crypto_onetimeauth_poly1305.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef crypto_onetimeauth_poly1305_state crypto_onetimeauth_state;
+
+SODIUM_EXPORT
+size_t  crypto_onetimeauth_statebytes(void);
+
+#define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES
+SODIUM_EXPORT
+size_t  crypto_onetimeauth_bytes(void);
+
+#define crypto_onetimeauth_KEYBYTES crypto_onetimeauth_poly1305_KEYBYTES
+SODIUM_EXPORT
+size_t  crypto_onetimeauth_keybytes(void);
+
+#define crypto_onetimeauth_PRIMITIVE "poly1305"
+SODIUM_EXPORT
+const char *crypto_onetimeauth_primitive(void);
+
+SODIUM_EXPORT
+int crypto_onetimeauth(unsigned char *out, const unsigned char *in,
+                       unsigned long long inlen, const unsigned char *k)
+            __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in,
+                              unsigned long long inlen, const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_onetimeauth_init(crypto_onetimeauth_state *state,
+                            const unsigned char *key) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_onetimeauth_update(crypto_onetimeauth_state *state,
+                              const unsigned char *in,
+                              unsigned long long inlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_onetimeauth_final(crypto_onetimeauth_state *state,
+                             unsigned char *out) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_onetimeauth_keygen(unsigned char k[crypto_onetimeauth_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_onetimeauth_poly1305.h b/vendor/external/libsodium/include/sodium/crypto_onetimeauth_poly1305.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_onetimeauth_poly1305.h
@@ -0,0 +1,72 @@
+#ifndef crypto_onetimeauth_poly1305_H
+#define crypto_onetimeauth_poly1305_H
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <sys/types.h>
+
+#include "export.h"
+
+typedef struct CRYPTO_ALIGN(16) crypto_onetimeauth_poly1305_state {
+    unsigned char opaque[256];
+} crypto_onetimeauth_poly1305_state;
+
+SODIUM_EXPORT
+size_t crypto_onetimeauth_poly1305_statebytes(void);
+
+#define crypto_onetimeauth_poly1305_BYTES 16U
+SODIUM_EXPORT
+size_t crypto_onetimeauth_poly1305_bytes(void);
+
+#define crypto_onetimeauth_poly1305_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_onetimeauth_poly1305_keybytes(void);
+
+SODIUM_EXPORT
+int crypto_onetimeauth_poly1305(unsigned char *out,
+                                const unsigned char *in,
+                                unsigned long long inlen,
+                                const unsigned char *k)
+            __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_onetimeauth_poly1305_verify(const unsigned char *h,
+                                       const unsigned char *in,
+                                       unsigned long long inlen,
+                                       const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state,
+                                     const unsigned char *key)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state,
+                                       const unsigned char *in,
+                                       unsigned long long inlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state,
+                                      unsigned char *out)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_onetimeauth_poly1305_keygen(unsigned char k[crypto_onetimeauth_poly1305_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_pwhash.h b/vendor/external/libsodium/include/sodium/crypto_pwhash.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_pwhash.h
@@ -0,0 +1,147 @@
+#ifndef crypto_pwhash_H
+#define crypto_pwhash_H
+
+#include <stddef.h>
+
+#include "crypto_pwhash_argon2i.h"
+#include "crypto_pwhash_argon2id.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_pwhash_ALG_ARGON2I13 crypto_pwhash_argon2i_ALG_ARGON2I13
+SODIUM_EXPORT
+int crypto_pwhash_alg_argon2i13(void);
+
+#define crypto_pwhash_ALG_ARGON2ID13 crypto_pwhash_argon2id_ALG_ARGON2ID13
+SODIUM_EXPORT
+int crypto_pwhash_alg_argon2id13(void);
+
+#define crypto_pwhash_ALG_DEFAULT crypto_pwhash_ALG_ARGON2ID13
+SODIUM_EXPORT
+int crypto_pwhash_alg_default(void);
+
+#define crypto_pwhash_BYTES_MIN crypto_pwhash_argon2id_BYTES_MIN
+SODIUM_EXPORT
+size_t crypto_pwhash_bytes_min(void);
+
+#define crypto_pwhash_BYTES_MAX crypto_pwhash_argon2id_BYTES_MAX
+SODIUM_EXPORT
+size_t crypto_pwhash_bytes_max(void);
+
+#define crypto_pwhash_PASSWD_MIN crypto_pwhash_argon2id_PASSWD_MIN
+SODIUM_EXPORT
+size_t crypto_pwhash_passwd_min(void);
+
+#define crypto_pwhash_PASSWD_MAX crypto_pwhash_argon2id_PASSWD_MAX
+SODIUM_EXPORT
+size_t crypto_pwhash_passwd_max(void);
+
+#define crypto_pwhash_SALTBYTES crypto_pwhash_argon2id_SALTBYTES
+SODIUM_EXPORT
+size_t crypto_pwhash_saltbytes(void);
+
+#define crypto_pwhash_STRBYTES crypto_pwhash_argon2id_STRBYTES
+SODIUM_EXPORT
+size_t crypto_pwhash_strbytes(void);
+
+#define crypto_pwhash_STRPREFIX crypto_pwhash_argon2id_STRPREFIX
+SODIUM_EXPORT
+const char *crypto_pwhash_strprefix(void);
+
+#define crypto_pwhash_OPSLIMIT_MIN crypto_pwhash_argon2id_OPSLIMIT_MIN
+SODIUM_EXPORT
+size_t crypto_pwhash_opslimit_min(void);
+
+#define crypto_pwhash_OPSLIMIT_MAX crypto_pwhash_argon2id_OPSLIMIT_MAX
+SODIUM_EXPORT
+size_t crypto_pwhash_opslimit_max(void);
+
+#define crypto_pwhash_MEMLIMIT_MIN crypto_pwhash_argon2id_MEMLIMIT_MIN
+SODIUM_EXPORT
+size_t crypto_pwhash_memlimit_min(void);
+
+#define crypto_pwhash_MEMLIMIT_MAX crypto_pwhash_argon2id_MEMLIMIT_MAX
+SODIUM_EXPORT
+size_t crypto_pwhash_memlimit_max(void);
+
+#define crypto_pwhash_OPSLIMIT_INTERACTIVE crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE
+SODIUM_EXPORT
+size_t crypto_pwhash_opslimit_interactive(void);
+
+#define crypto_pwhash_MEMLIMIT_INTERACTIVE crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE
+SODIUM_EXPORT
+size_t crypto_pwhash_memlimit_interactive(void);
+
+#define crypto_pwhash_OPSLIMIT_MODERATE crypto_pwhash_argon2id_OPSLIMIT_MODERATE
+SODIUM_EXPORT
+size_t crypto_pwhash_opslimit_moderate(void);
+
+#define crypto_pwhash_MEMLIMIT_MODERATE crypto_pwhash_argon2id_MEMLIMIT_MODERATE
+SODIUM_EXPORT
+size_t crypto_pwhash_memlimit_moderate(void);
+
+#define crypto_pwhash_OPSLIMIT_SENSITIVE crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE
+SODIUM_EXPORT
+size_t crypto_pwhash_opslimit_sensitive(void);
+
+#define crypto_pwhash_MEMLIMIT_SENSITIVE crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE
+SODIUM_EXPORT
+size_t crypto_pwhash_memlimit_sensitive(void);
+
+/*
+ * With this function, do not forget to store all parameters, including the
+ * algorithm identifier in order to produce deterministic output.
+ * The crypto_pwhash_* definitions, including crypto_pwhash_ALG_DEFAULT,
+ * may change.
+ */
+SODIUM_EXPORT
+int crypto_pwhash(unsigned char * const out, unsigned long long outlen,
+                  const char * const passwd, unsigned long long passwdlen,
+                  const unsigned char * const salt,
+                  unsigned long long opslimit, size_t memlimit, int alg)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+/*
+ * The output string already includes all the required parameters, including
+ * the algorithm identifier. The string is all that has to be stored in
+ * order to verify a password.
+ */
+SODIUM_EXPORT
+int crypto_pwhash_str(char out[crypto_pwhash_STRBYTES],
+                      const char * const passwd, unsigned long long passwdlen,
+                      unsigned long long opslimit, size_t memlimit)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_str_alg(char out[crypto_pwhash_STRBYTES],
+                          const char * const passwd, unsigned long long passwdlen,
+                          unsigned long long opslimit, size_t memlimit, int alg)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_str_verify(const char *str,
+                             const char * const passwd,
+                             unsigned long long passwdlen)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_str_needs_rehash(const char *str,
+                                   unsigned long long opslimit, size_t memlimit)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+#define crypto_pwhash_PRIMITIVE "argon2i"
+SODIUM_EXPORT
+const char *crypto_pwhash_primitive(void)
+            __attribute__ ((warn_unused_result));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_pwhash_argon2i.h b/vendor/external/libsodium/include/sodium/crypto_pwhash_argon2i.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_pwhash_argon2i.h
@@ -0,0 +1,122 @@
+#ifndef crypto_pwhash_argon2i_H
+#define crypto_pwhash_argon2i_H
+
+#include <limits.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_pwhash_argon2i_ALG_ARGON2I13 1
+SODIUM_EXPORT
+int crypto_pwhash_argon2i_alg_argon2i13(void);
+
+#define crypto_pwhash_argon2i_BYTES_MIN 16U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_bytes_min(void);
+
+#define crypto_pwhash_argon2i_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_bytes_max(void);
+
+#define crypto_pwhash_argon2i_PASSWD_MIN 0U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_passwd_min(void);
+
+#define crypto_pwhash_argon2i_PASSWD_MAX 4294967295U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_passwd_max(void);
+
+#define crypto_pwhash_argon2i_SALTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_saltbytes(void);
+
+#define crypto_pwhash_argon2i_STRBYTES 128U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_strbytes(void);
+
+#define crypto_pwhash_argon2i_STRPREFIX "$argon2i$"
+SODIUM_EXPORT
+const char *crypto_pwhash_argon2i_strprefix(void);
+
+#define crypto_pwhash_argon2i_OPSLIMIT_MIN 3U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_opslimit_min(void);
+
+#define crypto_pwhash_argon2i_OPSLIMIT_MAX 4294967295U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_opslimit_max(void);
+
+#define crypto_pwhash_argon2i_MEMLIMIT_MIN 8192U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_memlimit_min(void);
+
+#define crypto_pwhash_argon2i_MEMLIMIT_MAX \
+    ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_memlimit_max(void);
+
+#define crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE 4U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_opslimit_interactive(void);
+
+#define crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE 33554432U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_memlimit_interactive(void);
+
+#define crypto_pwhash_argon2i_OPSLIMIT_MODERATE 6U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_opslimit_moderate(void);
+
+#define crypto_pwhash_argon2i_MEMLIMIT_MODERATE 134217728U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_memlimit_moderate(void);
+
+#define crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE 8U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_opslimit_sensitive(void);
+
+#define crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE 536870912U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2i_memlimit_sensitive(void);
+
+SODIUM_EXPORT
+int crypto_pwhash_argon2i(unsigned char * const out,
+                          unsigned long long outlen,
+                          const char * const passwd,
+                          unsigned long long passwdlen,
+                          const unsigned char * const salt,
+                          unsigned long long opslimit, size_t memlimit,
+                          int alg)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_argon2i_str(char out[crypto_pwhash_argon2i_STRBYTES],
+                              const char * const passwd,
+                              unsigned long long passwdlen,
+                              unsigned long long opslimit, size_t memlimit)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_argon2i_str_verify(const char * str,
+                                     const char * const passwd,
+                                     unsigned long long passwdlen)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_argon2i_str_needs_rehash(const char * str,
+                                           unsigned long long opslimit, size_t memlimit)
+            __attribute__ ((warn_unused_result))  __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_pwhash_argon2id.h b/vendor/external/libsodium/include/sodium/crypto_pwhash_argon2id.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_pwhash_argon2id.h
@@ -0,0 +1,122 @@
+#ifndef crypto_pwhash_argon2id_H
+#define crypto_pwhash_argon2id_H
+
+#include <limits.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_pwhash_argon2id_ALG_ARGON2ID13 2
+SODIUM_EXPORT
+int crypto_pwhash_argon2id_alg_argon2id13(void);
+
+#define crypto_pwhash_argon2id_BYTES_MIN 16U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_bytes_min(void);
+
+#define crypto_pwhash_argon2id_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_bytes_max(void);
+
+#define crypto_pwhash_argon2id_PASSWD_MIN 0U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_passwd_min(void);
+
+#define crypto_pwhash_argon2id_PASSWD_MAX 4294967295U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_passwd_max(void);
+
+#define crypto_pwhash_argon2id_SALTBYTES 16U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_saltbytes(void);
+
+#define crypto_pwhash_argon2id_STRBYTES 128U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_strbytes(void);
+
+#define crypto_pwhash_argon2id_STRPREFIX "$argon2id$"
+SODIUM_EXPORT
+const char *crypto_pwhash_argon2id_strprefix(void);
+
+#define crypto_pwhash_argon2id_OPSLIMIT_MIN 1U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_opslimit_min(void);
+
+#define crypto_pwhash_argon2id_OPSLIMIT_MAX 4294967295U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_opslimit_max(void);
+
+#define crypto_pwhash_argon2id_MEMLIMIT_MIN 8192U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_memlimit_min(void);
+
+#define crypto_pwhash_argon2id_MEMLIMIT_MAX \
+    ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_memlimit_max(void);
+
+#define crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE 2U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_opslimit_interactive(void);
+
+#define crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE 67108864U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_memlimit_interactive(void);
+
+#define crypto_pwhash_argon2id_OPSLIMIT_MODERATE 3U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_opslimit_moderate(void);
+
+#define crypto_pwhash_argon2id_MEMLIMIT_MODERATE 268435456U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_memlimit_moderate(void);
+
+#define crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE 4U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_opslimit_sensitive(void);
+
+#define crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE 1073741824U
+SODIUM_EXPORT
+size_t crypto_pwhash_argon2id_memlimit_sensitive(void);
+
+SODIUM_EXPORT
+int crypto_pwhash_argon2id(unsigned char * const out,
+                           unsigned long long outlen,
+                           const char * const passwd,
+                           unsigned long long passwdlen,
+                           const unsigned char * const salt,
+                           unsigned long long opslimit, size_t memlimit,
+                           int alg)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_argon2id_str(char out[crypto_pwhash_argon2id_STRBYTES],
+                               const char * const passwd,
+                               unsigned long long passwdlen,
+                               unsigned long long opslimit, size_t memlimit)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_argon2id_str_verify(const char * str,
+                                      const char * const passwd,
+                                      unsigned long long passwdlen)
+            __attribute__ ((warn_unused_result))  __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_argon2id_str_needs_rehash(const char * str,
+                                            unsigned long long opslimit, size_t memlimit)
+            __attribute__ ((warn_unused_result))  __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h b/vendor/external/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h
@@ -0,0 +1,120 @@
+#ifndef crypto_pwhash_scryptsalsa208sha256_H
+#define crypto_pwhash_scryptsalsa208sha256_H
+
+#include <limits.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_pwhash_scryptsalsa208sha256_BYTES_MIN 16U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_bytes_min(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_BYTES_MAX \
+    SODIUM_MIN(SODIUM_SIZE_MAX, 0x1fffffffe0ULL)
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_bytes_max(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN 0U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_passwd_min(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX SODIUM_SIZE_MAX
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_passwd_max(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_SALTBYTES 32U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_saltbytes(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_STRBYTES 102U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_strbytes(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_STRPREFIX "$7$"
+SODIUM_EXPORT
+const char *crypto_pwhash_scryptsalsa208sha256_strprefix(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN 32768U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_opslimit_min(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX 4294967295U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_opslimit_max(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN 16777216U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_memlimit_min(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX \
+    SODIUM_MIN(SIZE_MAX, 68719476736ULL)
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_memlimit_max(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 524288U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 16777216U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 33554432U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(void);
+
+#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 1073741824U
+SODIUM_EXPORT
+size_t crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void);
+
+SODIUM_EXPORT
+int crypto_pwhash_scryptsalsa208sha256(unsigned char * const out,
+                                       unsigned long long outlen,
+                                       const char * const passwd,
+                                       unsigned long long passwdlen,
+                                       const unsigned char * const salt,
+                                       unsigned long long opslimit,
+                                       size_t memlimit)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
+                                           const char * const passwd,
+                                           unsigned long long passwdlen,
+                                           unsigned long long opslimit,
+                                           size_t memlimit)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_scryptsalsa208sha256_str_verify(const char * str,
+                                                  const char * const passwd,
+                                                  unsigned long long passwdlen)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdlen,
+                                          const uint8_t * salt, size_t saltlen,
+                                          uint64_t N, uint32_t r, uint32_t p,
+                                          uint8_t * buf, size_t buflen)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash(const char * str,
+                                                        unsigned long long opslimit,
+                                                        size_t memlimit)
+            __attribute__ ((warn_unused_result))  __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_scalarmult.h b/vendor/external/libsodium/include/sodium/crypto_scalarmult.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_scalarmult.h
@@ -0,0 +1,46 @@
+#ifndef crypto_scalarmult_H
+#define crypto_scalarmult_H
+
+#include <stddef.h>
+
+#include "crypto_scalarmult_curve25519.h"
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_scalarmult_BYTES crypto_scalarmult_curve25519_BYTES
+SODIUM_EXPORT
+size_t  crypto_scalarmult_bytes(void);
+
+#define crypto_scalarmult_SCALARBYTES crypto_scalarmult_curve25519_SCALARBYTES
+SODIUM_EXPORT
+size_t  crypto_scalarmult_scalarbytes(void);
+
+#define crypto_scalarmult_PRIMITIVE "curve25519"
+SODIUM_EXPORT
+const char *crypto_scalarmult_primitive(void);
+
+SODIUM_EXPORT
+int crypto_scalarmult_base(unsigned char *q, const unsigned char *n)
+            __attribute__ ((nonnull));
+
+/*
+ * NOTE: Do not use the result of this function directly for key exchange.
+ *
+ * Hash the result with the public keys in order to compute a shared
+ * secret key: H(q || client_pk || server_pk)
+ *
+ * Or unless this is not an option, use the crypto_kx() API instead.
+ */
+SODIUM_EXPORT
+int crypto_scalarmult(unsigned char *q, const unsigned char *n,
+                      const unsigned char *p)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_scalarmult_curve25519.h b/vendor/external/libsodium/include/sodium/crypto_scalarmult_curve25519.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_scalarmult_curve25519.h
@@ -0,0 +1,42 @@
+#ifndef crypto_scalarmult_curve25519_H
+#define crypto_scalarmult_curve25519_H
+
+#include <stddef.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_scalarmult_curve25519_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_scalarmult_curve25519_bytes(void);
+
+#define crypto_scalarmult_curve25519_SCALARBYTES 32U
+SODIUM_EXPORT
+size_t crypto_scalarmult_curve25519_scalarbytes(void);
+
+/*
+ * NOTE: Do not use the result of this function directly for key exchange.
+ *
+ * Hash the result with the public keys in order to compute a shared
+ * secret key: H(q || client_pk || server_pk)
+ *
+ * Or unless this is not an option, use the crypto_kx() API instead.
+ */
+SODIUM_EXPORT
+int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
+                                 const unsigned char *p)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_scalarmult_curve25519_base(unsigned char *q,
+                                      const unsigned char *n)
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_scalarmult_ed25519.h b/vendor/external/libsodium/include/sodium/crypto_scalarmult_ed25519.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_scalarmult_ed25519.h
@@ -0,0 +1,51 @@
+
+#ifndef crypto_scalarmult_ed25519_H
+#define crypto_scalarmult_ed25519_H
+
+#include <stddef.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_scalarmult_ed25519_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_scalarmult_ed25519_bytes(void);
+
+#define crypto_scalarmult_ed25519_SCALARBYTES 32U
+SODIUM_EXPORT
+size_t crypto_scalarmult_ed25519_scalarbytes(void);
+
+/*
+ * NOTE: Do not use the result of this function directly for key exchange.
+ *
+ * Hash the result with the public keys in order to compute a shared
+ * secret key: H(q || client_pk || server_pk)
+ *
+ * Or unless this is not an option, use the crypto_kx() API instead.
+ */
+SODIUM_EXPORT
+int crypto_scalarmult_ed25519(unsigned char *q, const unsigned char *n,
+                              const unsigned char *p)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_scalarmult_ed25519_noclamp(unsigned char *q, const unsigned char *n,
+                                      const unsigned char *p)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_scalarmult_ed25519_base(unsigned char *q, const unsigned char *n)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_scalarmult_ed25519_base_noclamp(unsigned char *q, const unsigned char *n)
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_scalarmult_ristretto255.h b/vendor/external/libsodium/include/sodium/crypto_scalarmult_ristretto255.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_scalarmult_ristretto255.h
@@ -0,0 +1,43 @@
+
+#ifndef crypto_scalarmult_ristretto255_H
+#define crypto_scalarmult_ristretto255_H
+
+#include <stddef.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_scalarmult_ristretto255_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_scalarmult_ristretto255_bytes(void);
+
+#define crypto_scalarmult_ristretto255_SCALARBYTES 32U
+SODIUM_EXPORT
+size_t crypto_scalarmult_ristretto255_scalarbytes(void);
+
+/*
+ * NOTE: Do not use the result of this function directly for key exchange.
+ *
+ * Hash the result with the public keys in order to compute a shared
+ * secret key: H(q || client_pk || server_pk)
+ *
+ * Or unless this is not an option, use the crypto_kx() API instead.
+ */
+SODIUM_EXPORT
+int crypto_scalarmult_ristretto255(unsigned char *q, const unsigned char *n,
+                                   const unsigned char *p)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_scalarmult_ristretto255_base(unsigned char *q,
+                                        const unsigned char *n)
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_secretbox.h b/vendor/external/libsodium/include/sodium/crypto_secretbox.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_secretbox.h
@@ -0,0 +1,93 @@
+#ifndef crypto_secretbox_H
+#define crypto_secretbox_H
+
+#include <stddef.h>
+
+#include "crypto_secretbox_xsalsa20poly1305.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_secretbox_KEYBYTES crypto_secretbox_xsalsa20poly1305_KEYBYTES
+SODIUM_EXPORT
+size_t  crypto_secretbox_keybytes(void);
+
+#define crypto_secretbox_NONCEBYTES crypto_secretbox_xsalsa20poly1305_NONCEBYTES
+SODIUM_EXPORT
+size_t  crypto_secretbox_noncebytes(void);
+
+#define crypto_secretbox_MACBYTES crypto_secretbox_xsalsa20poly1305_MACBYTES
+SODIUM_EXPORT
+size_t  crypto_secretbox_macbytes(void);
+
+#define crypto_secretbox_PRIMITIVE "xsalsa20poly1305"
+SODIUM_EXPORT
+const char *crypto_secretbox_primitive(void);
+
+#define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX
+SODIUM_EXPORT
+size_t crypto_secretbox_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_secretbox_easy(unsigned char *c, const unsigned char *m,
+                          unsigned long long mlen, const unsigned char *n,
+                          const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_secretbox_open_easy(unsigned char *m, const unsigned char *c,
+                               unsigned long long clen, const unsigned char *n,
+                               const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
+                              const unsigned char *m,
+                              unsigned long long mlen,
+                              const unsigned char *n,
+                              const unsigned char *k)
+            __attribute__ ((nonnull(1, 2, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_secretbox_open_detached(unsigned char *m,
+                                   const unsigned char *c,
+                                   const unsigned char *mac,
+                                   unsigned long long clen,
+                                   const unsigned char *n,
+                                   const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
+
+SODIUM_EXPORT
+void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES])
+            __attribute__ ((nonnull));
+
+/* -- NaCl compatibility interface ; Requires padding -- */
+
+#define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES
+SODIUM_EXPORT
+size_t  crypto_secretbox_zerobytes(void);
+
+#define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES
+SODIUM_EXPORT
+size_t  crypto_secretbox_boxzerobytes(void);
+
+SODIUM_EXPORT
+int crypto_secretbox(unsigned char *c, const unsigned char *m,
+                     unsigned long long mlen, const unsigned char *n,
+                     const unsigned char *k) __attribute__ ((nonnull(1, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_secretbox_open(unsigned char *m, const unsigned char *c,
+                          unsigned long long clen, const unsigned char *n,
+                          const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h b/vendor/external/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h
@@ -0,0 +1,70 @@
+#ifndef crypto_secretbox_xchacha20poly1305_H
+#define crypto_secretbox_xchacha20poly1305_H
+
+#include <stddef.h>
+#include "crypto_stream_xchacha20.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_secretbox_xchacha20poly1305_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_secretbox_xchacha20poly1305_keybytes(void);
+
+#define crypto_secretbox_xchacha20poly1305_NONCEBYTES 24U
+SODIUM_EXPORT
+size_t crypto_secretbox_xchacha20poly1305_noncebytes(void);
+
+#define crypto_secretbox_xchacha20poly1305_MACBYTES 16U
+SODIUM_EXPORT
+size_t crypto_secretbox_xchacha20poly1305_macbytes(void);
+
+#define crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX \
+    (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES)
+SODIUM_EXPORT
+size_t crypto_secretbox_xchacha20poly1305_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_secretbox_xchacha20poly1305_easy(unsigned char *c,
+                                            const unsigned char *m,
+                                            unsigned long long mlen,
+                                            const unsigned char *n,
+                                            const unsigned char *k)
+            __attribute__ ((nonnull(1, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_secretbox_xchacha20poly1305_open_easy(unsigned char *m,
+                                                 const unsigned char *c,
+                                                 unsigned long long clen,
+                                                 const unsigned char *n,
+                                                 const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_secretbox_xchacha20poly1305_detached(unsigned char *c,
+                                                unsigned char *mac,
+                                                const unsigned char *m,
+                                                unsigned long long mlen,
+                                                const unsigned char *n,
+                                                const unsigned char *k)
+            __attribute__ ((nonnull(1, 2, 5, 6)));
+
+SODIUM_EXPORT
+int crypto_secretbox_xchacha20poly1305_open_detached(unsigned char *m,
+                                                     const unsigned char *c,
+                                                     const unsigned char *mac,
+                                                     unsigned long long clen,
+                                                     const unsigned char *n,
+                                                     const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 3, 5, 6)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h b/vendor/external/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h
@@ -0,0 +1,69 @@
+#ifndef crypto_secretbox_xsalsa20poly1305_H
+#define crypto_secretbox_xsalsa20poly1305_H
+
+#include <stddef.h>
+#include "crypto_stream_xsalsa20.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_secretbox_xsalsa20poly1305_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_secretbox_xsalsa20poly1305_keybytes(void);
+
+#define crypto_secretbox_xsalsa20poly1305_NONCEBYTES 24U
+SODIUM_EXPORT
+size_t crypto_secretbox_xsalsa20poly1305_noncebytes(void);
+
+#define crypto_secretbox_xsalsa20poly1305_MACBYTES 16U
+SODIUM_EXPORT
+size_t crypto_secretbox_xsalsa20poly1305_macbytes(void);
+
+/* Only for the libsodium API - The NaCl compatibility API would require BOXZEROBYTES extra bytes */
+#define crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX \
+    (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_secretbox_xsalsa20poly1305_MACBYTES)
+SODIUM_EXPORT
+size_t crypto_secretbox_xsalsa20poly1305_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_secretbox_xsalsa20poly1305(unsigned char *c,
+                                      const unsigned char *m,
+                                      unsigned long long mlen,
+                                      const unsigned char *n,
+                                      const unsigned char *k)
+            __attribute__ ((nonnull(1, 4, 5)));
+
+SODIUM_EXPORT
+int crypto_secretbox_xsalsa20poly1305_open(unsigned char *m,
+                                           const unsigned char *c,
+                                           unsigned long long clen,
+                                           const unsigned char *n,
+                                           const unsigned char *k)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(2, 4, 5)));
+
+SODIUM_EXPORT
+void crypto_secretbox_xsalsa20poly1305_keygen(unsigned char k[crypto_secretbox_xsalsa20poly1305_KEYBYTES])
+            __attribute__ ((nonnull));
+
+/* -- NaCl compatibility interface ; Requires padding -- */
+
+#define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U
+SODIUM_EXPORT
+size_t crypto_secretbox_xsalsa20poly1305_boxzerobytes(void);
+
+#define crypto_secretbox_xsalsa20poly1305_ZEROBYTES \
+    (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + \
+     crypto_secretbox_xsalsa20poly1305_MACBYTES)
+SODIUM_EXPORT
+size_t crypto_secretbox_xsalsa20poly1305_zerobytes(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h b/vendor/external/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h
@@ -0,0 +1,108 @@
+#ifndef crypto_secretstream_xchacha20poly1305_H
+#define crypto_secretstream_xchacha20poly1305_H
+
+#include <stddef.h>
+
+#include "crypto_aead_xchacha20poly1305.h"
+#include "crypto_stream_chacha20.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_secretstream_xchacha20poly1305_ABYTES \
+    (1U + crypto_aead_xchacha20poly1305_ietf_ABYTES)
+SODIUM_EXPORT
+size_t crypto_secretstream_xchacha20poly1305_abytes(void);
+
+#define crypto_secretstream_xchacha20poly1305_HEADERBYTES \
+    crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
+SODIUM_EXPORT
+size_t crypto_secretstream_xchacha20poly1305_headerbytes(void);
+
+#define crypto_secretstream_xchacha20poly1305_KEYBYTES \
+    crypto_aead_xchacha20poly1305_ietf_KEYBYTES
+SODIUM_EXPORT
+size_t crypto_secretstream_xchacha20poly1305_keybytes(void);
+
+#define crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX \
+    SODIUM_MIN(SODIUM_SIZE_MAX - crypto_secretstream_xchacha20poly1305_ABYTES, \
+              (64ULL * ((1ULL << 32) - 2ULL)))
+SODIUM_EXPORT
+size_t crypto_secretstream_xchacha20poly1305_messagebytes_max(void);
+
+#define crypto_secretstream_xchacha20poly1305_TAG_MESSAGE 0x00
+SODIUM_EXPORT
+unsigned char crypto_secretstream_xchacha20poly1305_tag_message(void);
+
+#define crypto_secretstream_xchacha20poly1305_TAG_PUSH    0x01
+SODIUM_EXPORT
+unsigned char crypto_secretstream_xchacha20poly1305_tag_push(void);
+
+#define crypto_secretstream_xchacha20poly1305_TAG_REKEY   0x02
+SODIUM_EXPORT
+unsigned char crypto_secretstream_xchacha20poly1305_tag_rekey(void);
+
+#define crypto_secretstream_xchacha20poly1305_TAG_FINAL \
+    (crypto_secretstream_xchacha20poly1305_TAG_PUSH | \
+     crypto_secretstream_xchacha20poly1305_TAG_REKEY)
+SODIUM_EXPORT
+unsigned char crypto_secretstream_xchacha20poly1305_tag_final(void);
+
+typedef struct crypto_secretstream_xchacha20poly1305_state {
+    unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES];
+    unsigned char nonce[crypto_stream_chacha20_ietf_NONCEBYTES];
+    unsigned char _pad[8];
+} crypto_secretstream_xchacha20poly1305_state;
+
+SODIUM_EXPORT
+size_t crypto_secretstream_xchacha20poly1305_statebytes(void);
+
+SODIUM_EXPORT
+void crypto_secretstream_xchacha20poly1305_keygen
+   (unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_secretstream_xchacha20poly1305_init_push
+   (crypto_secretstream_xchacha20poly1305_state *state,
+    unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
+    const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_secretstream_xchacha20poly1305_push
+   (crypto_secretstream_xchacha20poly1305_state *state,
+    unsigned char *c, unsigned long long *clen_p,
+    const unsigned char *m, unsigned long long mlen,
+    const unsigned char *ad, unsigned long long adlen, unsigned char tag)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_secretstream_xchacha20poly1305_init_pull
+   (crypto_secretstream_xchacha20poly1305_state *state,
+    const unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES],
+    const unsigned char k[crypto_secretstream_xchacha20poly1305_KEYBYTES])
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_secretstream_xchacha20poly1305_pull
+   (crypto_secretstream_xchacha20poly1305_state *state,
+    unsigned char *m, unsigned long long *mlen_p, unsigned char *tag_p,
+    const unsigned char *c, unsigned long long clen,
+    const unsigned char *ad, unsigned long long adlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+void crypto_secretstream_xchacha20poly1305_rekey
+    (crypto_secretstream_xchacha20poly1305_state *state);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_shorthash.h b/vendor/external/libsodium/include/sodium/crypto_shorthash.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_shorthash.h
@@ -0,0 +1,41 @@
+#ifndef crypto_shorthash_H
+#define crypto_shorthash_H
+
+#include <stddef.h>
+
+#include "crypto_shorthash_siphash24.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES
+SODIUM_EXPORT
+size_t  crypto_shorthash_bytes(void);
+
+#define crypto_shorthash_KEYBYTES crypto_shorthash_siphash24_KEYBYTES
+SODIUM_EXPORT
+size_t  crypto_shorthash_keybytes(void);
+
+#define crypto_shorthash_PRIMITIVE "siphash24"
+SODIUM_EXPORT
+const char *crypto_shorthash_primitive(void);
+
+SODIUM_EXPORT
+int crypto_shorthash(unsigned char *out, const unsigned char *in,
+                     unsigned long long inlen, const unsigned char *k)
+            __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+void crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_shorthash_siphash24.h b/vendor/external/libsodium/include/sodium/crypto_shorthash_siphash24.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_shorthash_siphash24.h
@@ -0,0 +1,50 @@
+#ifndef crypto_shorthash_siphash24_H
+#define crypto_shorthash_siphash24_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+/* -- 64-bit output -- */
+
+#define crypto_shorthash_siphash24_BYTES 8U
+SODIUM_EXPORT
+size_t crypto_shorthash_siphash24_bytes(void);
+
+#define crypto_shorthash_siphash24_KEYBYTES 16U
+SODIUM_EXPORT
+size_t crypto_shorthash_siphash24_keybytes(void);
+
+SODIUM_EXPORT
+int crypto_shorthash_siphash24(unsigned char *out, const unsigned char *in,
+                               unsigned long long inlen, const unsigned char *k)
+            __attribute__ ((nonnull(1, 4)));
+
+#ifndef SODIUM_LIBRARY_MINIMAL
+/* -- 128-bit output -- */
+
+#define crypto_shorthash_siphashx24_BYTES 16U
+SODIUM_EXPORT
+size_t crypto_shorthash_siphashx24_bytes(void);
+
+#define crypto_shorthash_siphashx24_KEYBYTES 16U
+SODIUM_EXPORT
+size_t crypto_shorthash_siphashx24_keybytes(void);
+
+SODIUM_EXPORT
+int crypto_shorthash_siphashx24(unsigned char *out, const unsigned char *in,
+                                unsigned long long inlen, const unsigned char *k)
+            __attribute__ ((nonnull(1, 4)));
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_sign.h b/vendor/external/libsodium/include/sodium/crypto_sign.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_sign.h
@@ -0,0 +1,107 @@
+#ifndef crypto_sign_H
+#define crypto_sign_H
+
+/*
+ * THREAD SAFETY: crypto_sign_keypair() is thread-safe,
+ * provided that sodium_init() was called before.
+ *
+ * Other functions, including crypto_sign_seed_keypair() are always thread-safe.
+ */
+
+#include <stddef.h>
+
+#include "crypto_sign_ed25519.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef crypto_sign_ed25519ph_state crypto_sign_state;
+
+SODIUM_EXPORT
+size_t  crypto_sign_statebytes(void);
+
+#define crypto_sign_BYTES crypto_sign_ed25519_BYTES
+SODIUM_EXPORT
+size_t  crypto_sign_bytes(void);
+
+#define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES
+SODIUM_EXPORT
+size_t  crypto_sign_seedbytes(void);
+
+#define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES
+SODIUM_EXPORT
+size_t  crypto_sign_publickeybytes(void);
+
+#define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES
+SODIUM_EXPORT
+size_t  crypto_sign_secretkeybytes(void);
+
+#define crypto_sign_MESSAGEBYTES_MAX crypto_sign_ed25519_MESSAGEBYTES_MAX
+SODIUM_EXPORT
+size_t  crypto_sign_messagebytes_max(void);
+
+#define crypto_sign_PRIMITIVE "ed25519"
+SODIUM_EXPORT
+const char *crypto_sign_primitive(void);
+
+SODIUM_EXPORT
+int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
+                             const unsigned char *seed)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_sign(unsigned char *sm, unsigned long long *smlen_p,
+                const unsigned char *m, unsigned long long mlen,
+                const unsigned char *sk) __attribute__ ((nonnull(1, 5)));
+
+SODIUM_EXPORT
+int crypto_sign_open(unsigned char *m, unsigned long long *mlen_p,
+                     const unsigned char *sm, unsigned long long smlen,
+                     const unsigned char *pk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5)));
+
+SODIUM_EXPORT
+int crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p,
+                         const unsigned char *m, unsigned long long mlen,
+                         const unsigned char *sk) __attribute__ ((nonnull(1, 5)));
+
+SODIUM_EXPORT
+int crypto_sign_verify_detached(const unsigned char *sig,
+                                const unsigned char *m,
+                                unsigned long long mlen,
+                                const unsigned char *pk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_sign_init(crypto_sign_state *state);
+
+SODIUM_EXPORT
+int crypto_sign_update(crypto_sign_state *state,
+                       const unsigned char *m, unsigned long long mlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_sign_final_create(crypto_sign_state *state, unsigned char *sig,
+                             unsigned long long *siglen_p,
+                             const unsigned char *sk)
+            __attribute__ ((nonnull(1, 2, 4)));
+
+SODIUM_EXPORT
+int crypto_sign_final_verify(crypto_sign_state *state, const unsigned char *sig,
+                             const unsigned char *pk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_sign_ed25519.h b/vendor/external/libsodium/include/sodium/crypto_sign_ed25519.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_sign_ed25519.h
@@ -0,0 +1,124 @@
+#ifndef crypto_sign_ed25519_H
+#define crypto_sign_ed25519_H
+
+#include <stddef.h>
+#include "crypto_hash_sha512.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef struct crypto_sign_ed25519ph_state {
+    crypto_hash_sha512_state hs;
+} crypto_sign_ed25519ph_state;
+
+SODIUM_EXPORT
+size_t crypto_sign_ed25519ph_statebytes(void);
+
+#define crypto_sign_ed25519_BYTES 64U
+SODIUM_EXPORT
+size_t crypto_sign_ed25519_bytes(void);
+
+#define crypto_sign_ed25519_SEEDBYTES 32U
+SODIUM_EXPORT
+size_t crypto_sign_ed25519_seedbytes(void);
+
+#define crypto_sign_ed25519_PUBLICKEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_sign_ed25519_publickeybytes(void);
+
+#define crypto_sign_ed25519_SECRETKEYBYTES (32U + 32U)
+SODIUM_EXPORT
+size_t crypto_sign_ed25519_secretkeybytes(void);
+
+#define crypto_sign_ed25519_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES)
+SODIUM_EXPORT
+size_t crypto_sign_ed25519_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p,
+                        const unsigned char *m, unsigned long long mlen,
+                        const unsigned char *sk)
+            __attribute__ ((nonnull(1, 5)));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p,
+                             const unsigned char *sm, unsigned long long smlen,
+                             const unsigned char *pk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5)));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_detached(unsigned char *sig,
+                                 unsigned long long *siglen_p,
+                                 const unsigned char *m,
+                                 unsigned long long mlen,
+                                 const unsigned char *sk)
+            __attribute__ ((nonnull(1, 5)));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_verify_detached(const unsigned char *sig,
+                                        const unsigned char *m,
+                                        unsigned long long mlen,
+                                        const unsigned char *pk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk,
+                                     const unsigned char *seed)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_pk_to_curve25519(unsigned char *curve25519_pk,
+                                         const unsigned char *ed25519_pk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk,
+                                         const unsigned char *ed25519_sk)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_sk_to_seed(unsigned char *seed,
+                                   const unsigned char *sk)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state *state)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519ph_update(crypto_sign_ed25519ph_state *state,
+                                 const unsigned char *m,
+                                 unsigned long long mlen)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519ph_final_create(crypto_sign_ed25519ph_state *state,
+                                       unsigned char *sig,
+                                       unsigned long long *siglen_p,
+                                       const unsigned char *sk)
+            __attribute__ ((nonnull(1, 2, 4)));
+
+SODIUM_EXPORT
+int crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state *state,
+                                       const unsigned char *sig,
+                                       const unsigned char *pk)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h b/vendor/external/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h
@@ -0,0 +1,55 @@
+#ifndef crypto_sign_edwards25519sha512batch_H
+#define crypto_sign_edwards25519sha512batch_H
+
+/*
+ * WARNING: This construction was a prototype, which should not be used
+ * any more in new projects.
+ *
+ * crypto_sign_edwards25519sha512batch is provided for applications
+ * initially built with NaCl, but as recommended by the author of this
+ * construction, new applications should use ed25519 instead.
+ *
+ * In Sodium, you should use the high-level crypto_sign_*() functions instead.
+ */
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_sign_edwards25519sha512batch_BYTES 64U
+#define crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES 32U
+#define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES (32U + 32U)
+#define crypto_sign_edwards25519sha512batch_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_edwards25519sha512batch_BYTES)
+
+SODIUM_EXPORT
+int crypto_sign_edwards25519sha512batch(unsigned char *sm,
+                                        unsigned long long *smlen_p,
+                                        const unsigned char *m,
+                                        unsigned long long mlen,
+                                        const unsigned char *sk)
+            __attribute__ ((deprecated)) __attribute__ ((nonnull(1, 5)));
+
+SODIUM_EXPORT
+int crypto_sign_edwards25519sha512batch_open(unsigned char *m,
+                                             unsigned long long *mlen_p,
+                                             const unsigned char *sm,
+                                             unsigned long long smlen,
+                                             const unsigned char *pk)
+            __attribute__ ((deprecated)) __attribute__ ((nonnull(3, 5)));
+
+SODIUM_EXPORT
+int crypto_sign_edwards25519sha512batch_keypair(unsigned char *pk,
+                                                unsigned char *sk)
+            __attribute__ ((deprecated)) __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_stream.h b/vendor/external/libsodium/include/sodium/crypto_stream.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_stream.h
@@ -0,0 +1,59 @@
+#ifndef crypto_stream_H
+#define crypto_stream_H
+
+/*
+ *  WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ *  While it provides some protection against eavesdropping, it does NOT
+ *  provide any security against active attacks.
+ *  Unless you know what you're doing, what you are looking for is probably
+ *  the crypto_box functions.
+ */
+
+#include <stddef.h>
+
+#include "crypto_stream_xsalsa20.h"
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES
+SODIUM_EXPORT
+size_t  crypto_stream_keybytes(void);
+
+#define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES
+SODIUM_EXPORT
+size_t  crypto_stream_noncebytes(void);
+
+#define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX
+SODIUM_EXPORT
+size_t  crypto_stream_messagebytes_max(void);
+
+#define crypto_stream_PRIMITIVE "xsalsa20"
+SODIUM_EXPORT
+const char *crypto_stream_primitive(void);
+
+SODIUM_EXPORT
+int crypto_stream(unsigned char *c, unsigned long long clen,
+                  const unsigned char *n, const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_xor(unsigned char *c, const unsigned char *m,
+                      unsigned long long mlen, const unsigned char *n,
+                      const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_stream_keygen(unsigned char k[crypto_stream_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_stream_chacha20.h b/vendor/external/libsodium/include/sodium/crypto_stream_chacha20.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_stream_chacha20.h
@@ -0,0 +1,106 @@
+#ifndef crypto_stream_chacha20_H
+#define crypto_stream_chacha20_H
+
+/*
+ *  WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ *  While it provides some protection against eavesdropping, it does NOT
+ *  provide any security against active attacks.
+ *  Unless you know what you're doing, what you are looking for is probably
+ *  the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_chacha20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_chacha20_keybytes(void);
+
+#define crypto_stream_chacha20_NONCEBYTES 8U
+SODIUM_EXPORT
+size_t crypto_stream_chacha20_noncebytes(void);
+
+#define crypto_stream_chacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
+SODIUM_EXPORT
+size_t crypto_stream_chacha20_messagebytes_max(void);
+
+/* ChaCha20 with a 64-bit nonce and a 64-bit counter, as originally designed */
+
+SODIUM_EXPORT
+int crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
+                           const unsigned char *n, const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m,
+                               unsigned long long mlen, const unsigned char *n,
+                               const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m,
+                                  unsigned long long mlen,
+                                  const unsigned char *n, uint64_t ic,
+                                  const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES])
+            __attribute__ ((nonnull));
+
+/* ChaCha20 with a 96-bit nonce and a 32-bit counter (IETF) */
+
+#define crypto_stream_chacha20_ietf_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_chacha20_ietf_keybytes(void);
+
+#define crypto_stream_chacha20_ietf_NONCEBYTES 12U
+SODIUM_EXPORT
+size_t crypto_stream_chacha20_ietf_noncebytes(void);
+
+#define crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX \
+    SODIUM_MIN(SODIUM_SIZE_MAX, 64ULL * (1ULL << 32))
+SODIUM_EXPORT
+size_t crypto_stream_chacha20_ietf_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen,
+                                const unsigned char *n, const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_chacha20_ietf_xor(unsigned char *c, const unsigned char *m,
+                                    unsigned long long mlen, const unsigned char *n,
+                                    const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m,
+                                       unsigned long long mlen,
+                                       const unsigned char *n, uint32_t ic,
+                                       const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_stream_chacha20_ietf_keygen(unsigned char k[crypto_stream_chacha20_ietf_KEYBYTES])
+            __attribute__ ((nonnull));
+
+/* Aliases */
+
+#define crypto_stream_chacha20_IETF_KEYBYTES crypto_stream_chacha20_ietf_KEYBYTES
+#define crypto_stream_chacha20_IETF_NONCEBYTES crypto_stream_chacha20_ietf_NONCEBYTES
+#define crypto_stream_chacha20_IETF_MESSAGEBYTES_MAX crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_stream_salsa20.h b/vendor/external/libsodium/include/sodium/crypto_stream_salsa20.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_stream_salsa20.h
@@ -0,0 +1,61 @@
+#ifndef crypto_stream_salsa20_H
+#define crypto_stream_salsa20_H
+
+/*
+ *  WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ *  While it provides some protection against eavesdropping, it does NOT
+ *  provide any security against active attacks.
+ *  Unless you know what you're doing, what you are looking for is probably
+ *  the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_salsa20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_salsa20_keybytes(void);
+
+#define crypto_stream_salsa20_NONCEBYTES 8U
+SODIUM_EXPORT
+size_t crypto_stream_salsa20_noncebytes(void);
+
+#define crypto_stream_salsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
+SODIUM_EXPORT
+size_t crypto_stream_salsa20_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_stream_salsa20(unsigned char *c, unsigned long long clen,
+                          const unsigned char *n, const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_salsa20_xor(unsigned char *c, const unsigned char *m,
+                              unsigned long long mlen, const unsigned char *n,
+                              const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_salsa20_xor_ic(unsigned char *c, const unsigned char *m,
+                                 unsigned long long mlen,
+                                 const unsigned char *n, uint64_t ic,
+                                 const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_stream_salsa20_keygen(unsigned char k[crypto_stream_salsa20_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_stream_salsa2012.h b/vendor/external/libsodium/include/sodium/crypto_stream_salsa2012.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_stream_salsa2012.h
@@ -0,0 +1,53 @@
+#ifndef crypto_stream_salsa2012_H
+#define crypto_stream_salsa2012_H
+
+/*
+ *  WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ *  While it provides some protection against eavesdropping, it does NOT
+ *  provide any security against active attacks.
+ *  Unless you know what you're doing, what you are looking for is probably
+ *  the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_salsa2012_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_salsa2012_keybytes(void);
+
+#define crypto_stream_salsa2012_NONCEBYTES 8U
+SODIUM_EXPORT
+size_t crypto_stream_salsa2012_noncebytes(void);
+
+#define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
+SODIUM_EXPORT
+size_t crypto_stream_salsa2012_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_stream_salsa2012(unsigned char *c, unsigned long long clen,
+                            const unsigned char *n, const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_salsa2012_xor(unsigned char *c, const unsigned char *m,
+                                unsigned long long mlen, const unsigned char *n,
+                                const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_stream_salsa2012_keygen(unsigned char k[crypto_stream_salsa2012_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_stream_salsa208.h b/vendor/external/libsodium/include/sodium/crypto_stream_salsa208.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_stream_salsa208.h
@@ -0,0 +1,56 @@
+#ifndef crypto_stream_salsa208_H
+#define crypto_stream_salsa208_H
+
+/*
+ *  WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ *  While it provides some protection against eavesdropping, it does NOT
+ *  provide any security against active attacks.
+ *  Unless you know what you're doing, what you are looking for is probably
+ *  the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_salsa208_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_salsa208_keybytes(void)
+            __attribute__ ((deprecated));
+
+#define crypto_stream_salsa208_NONCEBYTES 8U
+SODIUM_EXPORT
+size_t crypto_stream_salsa208_noncebytes(void)
+            __attribute__ ((deprecated));
+
+#define crypto_stream_salsa208_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
+    SODIUM_EXPORT
+size_t crypto_stream_salsa208_messagebytes_max(void)
+            __attribute__ ((deprecated));
+
+SODIUM_EXPORT
+int crypto_stream_salsa208(unsigned char *c, unsigned long long clen,
+                           const unsigned char *n, const unsigned char *k)
+            __attribute__ ((deprecated)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_salsa208_xor(unsigned char *c, const unsigned char *m,
+                               unsigned long long mlen, const unsigned char *n,
+                               const unsigned char *k)
+            __attribute__ ((deprecated)) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES])
+            __attribute__ ((deprecated)) __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_stream_xchacha20.h b/vendor/external/libsodium/include/sodium/crypto_stream_xchacha20.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_stream_xchacha20.h
@@ -0,0 +1,61 @@
+#ifndef crypto_stream_xchacha20_H
+#define crypto_stream_xchacha20_H
+
+/*
+ *  WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ *  While it provides some protection against eavesdropping, it does NOT
+ *  provide any security against active attacks.
+ *  Unless you know what you're doing, what you are looking for is probably
+ *  the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_xchacha20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_xchacha20_keybytes(void);
+
+#define crypto_stream_xchacha20_NONCEBYTES 24U
+SODIUM_EXPORT
+size_t crypto_stream_xchacha20_noncebytes(void);
+
+#define crypto_stream_xchacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
+SODIUM_EXPORT
+size_t crypto_stream_xchacha20_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_stream_xchacha20(unsigned char *c, unsigned long long clen,
+                            const unsigned char *n, const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_xchacha20_xor(unsigned char *c, const unsigned char *m,
+                                unsigned long long mlen, const unsigned char *n,
+                                const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_xchacha20_xor_ic(unsigned char *c, const unsigned char *m,
+                                   unsigned long long mlen,
+                                   const unsigned char *n, uint64_t ic,
+                                   const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_stream_xsalsa20.h b/vendor/external/libsodium/include/sodium/crypto_stream_xsalsa20.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_stream_xsalsa20.h
@@ -0,0 +1,61 @@
+#ifndef crypto_stream_xsalsa20_H
+#define crypto_stream_xsalsa20_H
+
+/*
+ *  WARNING: This is just a stream cipher. It is NOT authenticated encryption.
+ *  While it provides some protection against eavesdropping, it does NOT
+ *  provide any security against active attacks.
+ *  Unless you know what you're doing, what you are looking for is probably
+ *  the crypto_box functions.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+#define crypto_stream_xsalsa20_KEYBYTES 32U
+SODIUM_EXPORT
+size_t crypto_stream_xsalsa20_keybytes(void);
+
+#define crypto_stream_xsalsa20_NONCEBYTES 24U
+SODIUM_EXPORT
+size_t crypto_stream_xsalsa20_noncebytes(void);
+
+#define crypto_stream_xsalsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX
+SODIUM_EXPORT
+size_t crypto_stream_xsalsa20_messagebytes_max(void);
+
+SODIUM_EXPORT
+int crypto_stream_xsalsa20(unsigned char *c, unsigned long long clen,
+                           const unsigned char *n, const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_xsalsa20_xor(unsigned char *c, const unsigned char *m,
+                               unsigned long long mlen, const unsigned char *n,
+                               const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int crypto_stream_xsalsa20_xor_ic(unsigned char *c, const unsigned char *m,
+                                  unsigned long long mlen,
+                                  const unsigned char *n, uint64_t ic,
+                                  const unsigned char *k)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void crypto_stream_xsalsa20_keygen(unsigned char k[crypto_stream_xsalsa20_KEYBYTES])
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_verify_16.h b/vendor/external/libsodium/include/sodium/crypto_verify_16.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_verify_16.h
@@ -0,0 +1,23 @@
+#ifndef crypto_verify_16_H
+#define crypto_verify_16_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_verify_16_BYTES 16U
+SODIUM_EXPORT
+size_t crypto_verify_16_bytes(void);
+
+SODIUM_EXPORT
+int crypto_verify_16(const unsigned char *x, const unsigned char *y)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_verify_32.h b/vendor/external/libsodium/include/sodium/crypto_verify_32.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_verify_32.h
@@ -0,0 +1,23 @@
+#ifndef crypto_verify_32_H
+#define crypto_verify_32_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_verify_32_BYTES 32U
+SODIUM_EXPORT
+size_t crypto_verify_32_bytes(void);
+
+SODIUM_EXPORT
+int crypto_verify_32(const unsigned char *x, const unsigned char *y)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/crypto_verify_64.h b/vendor/external/libsodium/include/sodium/crypto_verify_64.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/crypto_verify_64.h
@@ -0,0 +1,23 @@
+#ifndef crypto_verify_64_H
+#define crypto_verify_64_H
+
+#include <stddef.h>
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define crypto_verify_64_BYTES 64U
+SODIUM_EXPORT
+size_t crypto_verify_64_bytes(void);
+
+SODIUM_EXPORT
+int crypto_verify_64(const unsigned char *x, const unsigned char *y)
+            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/export.h b/vendor/external/libsodium/include/sodium/export.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/export.h
@@ -0,0 +1,57 @@
+
+#ifndef sodium_export_H
+#define sodium_export_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <limits.h>
+
+#if !defined(__clang__) && !defined(__GNUC__)
+# ifdef __attribute__
+#  undef __attribute__
+# endif
+# define __attribute__(a)
+#endif
+
+#ifdef SODIUM_STATIC
+# define SODIUM_EXPORT
+# define SODIUM_EXPORT_WEAK
+#else
+# if defined(_MSC_VER)
+#  ifdef SODIUM_DLL_EXPORT
+#   define SODIUM_EXPORT __declspec(dllexport)
+#  else
+#   define SODIUM_EXPORT __declspec(dllimport)
+#  endif
+# else
+#  if defined(__SUNPRO_C)
+#   ifndef __GNU_C__
+#    define SODIUM_EXPORT __attribute__ (visibility(__global))
+#   else
+#    define SODIUM_EXPORT __attribute__ __global
+#   endif
+#  elif defined(_MSG_VER)
+#   define SODIUM_EXPORT extern __declspec(dllexport)
+#  else
+#   define SODIUM_EXPORT __attribute__ ((visibility ("default")))
+#  endif
+# endif
+# if defined(__ELF__) && !defined(SODIUM_DISABLE_WEAK_FUNCTIONS)
+#  define SODIUM_EXPORT_WEAK SODIUM_EXPORT __attribute__((weak))
+# else
+#  define SODIUM_EXPORT_WEAK SODIUM_EXPORT
+# endif
+#endif
+
+#ifndef CRYPTO_ALIGN
+# if defined(__INTEL_COMPILER) || defined(_MSC_VER)
+#  define CRYPTO_ALIGN(x) __declspec(align(x))
+# else
+#  define CRYPTO_ALIGN(x) __attribute__ ((aligned(x)))
+# endif
+#endif
+
+#define SODIUM_MIN(A, B) ((A) < (B) ? (A) : (B))
+#define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX)
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/private/asm_cet.h b/vendor/external/libsodium/include/sodium/private/asm_cet.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/private/asm_cet.h
@@ -0,0 +1,11 @@
+#ifndef asm_cet_H
+#define asm_cet_H 1
+
+#if HAVE_CET_H
+# include <cet.h>
+#endif
+#ifndef _CET_ENDBR
+# define _CET_ENDBR
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/private/chacha20_ietf_ext.h b/vendor/external/libsodium/include/sodium/private/chacha20_ietf_ext.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/private/chacha20_ietf_ext.h
@@ -0,0 +1,16 @@
+#ifndef chacha20_ietf_ext_H
+#define chacha20_ietf_ext_H
+
+#include <stdint.h>
+
+/* The ietf_ext variant allows the internal counter to overflow into the IV */
+
+int crypto_stream_chacha20_ietf_ext(unsigned char *c, unsigned long long clen,
+                                    const unsigned char *n, const unsigned char *k);
+
+int crypto_stream_chacha20_ietf_ext_xor_ic(unsigned char *c, const unsigned char *m,
+                                           unsigned long long mlen,
+                                           const unsigned char *n, uint32_t ic,
+                                           const unsigned char *k);
+#endif
+
diff --git a/vendor/external/libsodium/include/sodium/private/common.h b/vendor/external/libsodium/include/sodium/private/common.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/private/common.h
@@ -0,0 +1,282 @@
+#ifndef common_H
+#define common_H 1
+
+#if !defined(_MSC_VER) && !defined(DEV_MODE) && 0
+# warning *** This is unstable, untested, development code.
+# warning It might not compile. It might not work as expected.
+# warning It might be totally insecure.
+# warning Do not use this except if you are planning to contribute code.
+# warning Use releases available at https://download.libsodium.org/libsodium/releases/ instead.
+# warning Alternatively, use the "stable" branch in the git repository.
+#endif
+
+#if !defined(_MSC_VER) && (!defined(CONFIGURED) || CONFIGURED != 1)
+# warning *** The library is being compiled using an undocumented method.
+# warning This is not supported. It has not been tested, it might not
+# warning work as expected, and performance is likely to be suboptimal.
+#endif
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define COMPILER_ASSERT(X) (void) sizeof(char[(X) ? 1 : -1])
+
+#ifdef HAVE_TI_MODE
+# if defined(__SIZEOF_INT128__)
+typedef unsigned __int128 uint128_t;
+# else
+typedef unsigned uint128_t __attribute__((mode(TI)));
+# endif
+#endif
+
+#define ROTL32(X, B) rotl32((X), (B))
+static inline uint32_t
+rotl32(const uint32_t x, const int b)
+{
+    return (x << b) | (x >> (32 - b));
+}
+
+#define ROTL64(X, B) rotl64((X), (B))
+static inline uint64_t
+rotl64(const uint64_t x, const int b)
+{
+    return (x << b) | (x >> (64 - b));
+}
+
+#define ROTR32(X, B) rotr32((X), (B))
+static inline uint32_t
+rotr32(const uint32_t x, const int b)
+{
+    return (x >> b) | (x << (32 - b));
+}
+
+#define ROTR64(X, B) rotr64((X), (B))
+static inline uint64_t
+rotr64(const uint64_t x, const int b)
+{
+    return (x >> b) | (x << (64 - b));
+}
+
+#define LOAD64_LE(SRC) load64_le(SRC)
+static inline uint64_t
+load64_le(const uint8_t src[8])
+{
+#ifdef NATIVE_LITTLE_ENDIAN
+    uint64_t w;
+    memcpy(&w, src, sizeof w);
+    return w;
+#else
+    uint64_t w = (uint64_t) src[0];
+    w |= (uint64_t) src[1] <<  8;
+    w |= (uint64_t) src[2] << 16;
+    w |= (uint64_t) src[3] << 24;
+    w |= (uint64_t) src[4] << 32;
+    w |= (uint64_t) src[5] << 40;
+    w |= (uint64_t) src[6] << 48;
+    w |= (uint64_t) src[7] << 56;
+    return w;
+#endif
+}
+
+#define STORE64_LE(DST, W) store64_le((DST), (W))
+static inline void
+store64_le(uint8_t dst[8], uint64_t w)
+{
+#ifdef NATIVE_LITTLE_ENDIAN
+    memcpy(dst, &w, sizeof w);
+#else
+    dst[0] = (uint8_t) w; w >>= 8;
+    dst[1] = (uint8_t) w; w >>= 8;
+    dst[2] = (uint8_t) w; w >>= 8;
+    dst[3] = (uint8_t) w; w >>= 8;
+    dst[4] = (uint8_t) w; w >>= 8;
+    dst[5] = (uint8_t) w; w >>= 8;
+    dst[6] = (uint8_t) w; w >>= 8;
+    dst[7] = (uint8_t) w;
+#endif
+}
+
+#define LOAD32_LE(SRC) load32_le(SRC)
+static inline uint32_t
+load32_le(const uint8_t src[4])
+{
+#ifdef NATIVE_LITTLE_ENDIAN
+    uint32_t w;
+    memcpy(&w, src, sizeof w);
+    return w;
+#else
+    uint32_t w = (uint32_t) src[0];
+    w |= (uint32_t) src[1] <<  8;
+    w |= (uint32_t) src[2] << 16;
+    w |= (uint32_t) src[3] << 24;
+    return w;
+#endif
+}
+
+#define STORE32_LE(DST, W) store32_le((DST), (W))
+static inline void
+store32_le(uint8_t dst[4], uint32_t w)
+{
+#ifdef NATIVE_LITTLE_ENDIAN
+    memcpy(dst, &w, sizeof w);
+#else
+    dst[0] = (uint8_t) w; w >>= 8;
+    dst[1] = (uint8_t) w; w >>= 8;
+    dst[2] = (uint8_t) w; w >>= 8;
+    dst[3] = (uint8_t) w;
+#endif
+}
+
+/* ----- */
+
+#define LOAD64_BE(SRC) load64_be(SRC)
+static inline uint64_t
+load64_be(const uint8_t src[8])
+{
+#ifdef NATIVE_BIG_ENDIAN
+    uint64_t w;
+    memcpy(&w, src, sizeof w);
+    return w;
+#else
+    uint64_t w = (uint64_t) src[7];
+    w |= (uint64_t) src[6] <<  8;
+    w |= (uint64_t) src[5] << 16;
+    w |= (uint64_t) src[4] << 24;
+    w |= (uint64_t) src[3] << 32;
+    w |= (uint64_t) src[2] << 40;
+    w |= (uint64_t) src[1] << 48;
+    w |= (uint64_t) src[0] << 56;
+    return w;
+#endif
+}
+
+#define STORE64_BE(DST, W) store64_be((DST), (W))
+static inline void
+store64_be(uint8_t dst[8], uint64_t w)
+{
+#ifdef NATIVE_BIG_ENDIAN
+    memcpy(dst, &w, sizeof w);
+#else
+    dst[7] = (uint8_t) w; w >>= 8;
+    dst[6] = (uint8_t) w; w >>= 8;
+    dst[5] = (uint8_t) w; w >>= 8;
+    dst[4] = (uint8_t) w; w >>= 8;
+    dst[3] = (uint8_t) w; w >>= 8;
+    dst[2] = (uint8_t) w; w >>= 8;
+    dst[1] = (uint8_t) w; w >>= 8;
+    dst[0] = (uint8_t) w;
+#endif
+}
+
+#define LOAD32_BE(SRC) load32_be(SRC)
+static inline uint32_t
+load32_be(const uint8_t src[4])
+{
+#ifdef NATIVE_BIG_ENDIAN
+    uint32_t w;
+    memcpy(&w, src, sizeof w);
+    return w;
+#else
+    uint32_t w = (uint32_t) src[3];
+    w |= (uint32_t) src[2] <<  8;
+    w |= (uint32_t) src[1] << 16;
+    w |= (uint32_t) src[0] << 24;
+    return w;
+#endif
+}
+
+#define STORE32_BE(DST, W) store32_be((DST), (W))
+static inline void
+store32_be(uint8_t dst[4], uint32_t w)
+{
+#ifdef NATIVE_BIG_ENDIAN
+    memcpy(dst, &w, sizeof w);
+#else
+    dst[3] = (uint8_t) w; w >>= 8;
+    dst[2] = (uint8_t) w; w >>= 8;
+    dst[1] = (uint8_t) w; w >>= 8;
+    dst[0] = (uint8_t) w;
+#endif
+}
+
+#define XOR_BUF(OUT, IN, N) xor_buf((OUT), (IN), (N))
+static inline void
+xor_buf(unsigned char *out, const unsigned char *in, size_t n)
+{
+    size_t i;
+
+    for (i = 0; i < n; i++) {
+        out[i] ^= in[i];
+    }
+}
+
+#if !defined(__clang__) && !defined(__GNUC__)
+# ifdef __attribute__
+#  undef __attribute__
+# endif
+# define __attribute__(a)
+#endif
+
+#ifndef CRYPTO_ALIGN
+# if defined(__INTEL_COMPILER) || defined(_MSC_VER)
+#  define CRYPTO_ALIGN(x) __declspec(align(x))
+# else
+#  define CRYPTO_ALIGN(x) __attribute__ ((aligned(x)))
+# endif
+#endif
+
+#ifdef _MSC_VER
+
+# if defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86)
+#  include <intrin.h>
+
+#  define HAVE_INTRIN_H    1
+#  define HAVE_MMINTRIN_H  1
+#  define HAVE_EMMINTRIN_H 1
+#  define HAVE_PMMINTRIN_H 1
+#  define HAVE_TMMINTRIN_H 1
+#  define HAVE_SMMINTRIN_H 1
+#  define HAVE_AVXINTRIN_H 1
+#  if _MSC_VER >= 1600
+#   define HAVE_WMMINTRIN_H 1
+#  endif
+#  if _MSC_VER >= 1700 && defined(_M_X64)
+#   define HAVE_AVX2INTRIN_H 1
+#  endif
+#  if _MSC_VER >= 1910 && defined(_M_X64)
+#   define HAVE_AVX512FINTRIN_H 1
+#  endif
+
+# elif defined(_M_ARM64)
+
+#  ifndef __ARM_NEON
+#   define __ARM_NEON 1
+#  endif
+#  define HAVE_ARMCRYPTO 1
+
+# endif /* _MSC_VER */
+
+#elif defined(HAVE_INTRIN_H)
+# include <intrin.h>
+#endif
+
+#ifdef HAVE_LIBCTGRIND
+extern void ct_poison  (const void *, size_t);
+extern void ct_unpoison(const void *, size_t);
+# define POISON(X, L)   ct_poison((X), (L))
+# define UNPOISON(X, L) ct_unpoison((X), (L))
+#else
+# define POISON(X, L)   (void) 0
+# define UNPOISON(X, L) (void) 0
+#endif
+
+#ifdef HAVE_GCC_MEMORY_FENCES
+# define ACQUIRE_FENCE __atomic_thread_fence(__ATOMIC_ACQUIRE)
+#elif defined(HAVE_C11_MEMORY_FENCES)
+# define ACQUIRE_FENCE atomic_thread_fence(memory_order_acquire)
+#else
+# define ACQUIRE_FENCE (void) 0
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/private/ed25519_ref10.h b/vendor/external/libsodium/include/sodium/private/ed25519_ref10.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/private/ed25519_ref10.h
@@ -0,0 +1,142 @@
+#ifndef ed25519_ref10_H
+#define ed25519_ref10_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+/*
+ fe means field element.
+ Here the field is \Z/(2^255-19).
+ */
+
+#ifdef HAVE_TI_MODE
+typedef uint64_t fe25519[5];
+#else
+typedef int32_t fe25519[10];
+#endif
+
+void fe25519_invert(fe25519 out, const fe25519 z);
+void fe25519_frombytes(fe25519 h, const unsigned char *s);
+void fe25519_tobytes(unsigned char *s, const fe25519 h);
+
+#ifdef HAVE_TI_MODE
+# include "ed25519_ref10_fe_51.h"
+#else
+# include "ed25519_ref10_fe_25_5.h"
+#endif
+
+
+/*
+ ge means group element.
+
+ Here the group is the set of pairs (x,y) of field elements
+ satisfying -x^2 + y^2 = 1 + d x^2y^2
+ where d = -121665/121666.
+
+ Representations:
+ ge25519_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z
+ ge25519_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
+ ge25519_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
+ ge25519_precomp (Duif): (y+x,y-x,2dxy)
+ */
+
+typedef struct {
+    fe25519 X;
+    fe25519 Y;
+    fe25519 Z;
+} ge25519_p2;
+
+typedef struct {
+    fe25519 X;
+    fe25519 Y;
+    fe25519 Z;
+    fe25519 T;
+} ge25519_p3;
+
+typedef struct {
+    fe25519 X;
+    fe25519 Y;
+    fe25519 Z;
+    fe25519 T;
+} ge25519_p1p1;
+
+typedef struct {
+    fe25519 yplusx;
+    fe25519 yminusx;
+    fe25519 xy2d;
+} ge25519_precomp;
+
+typedef struct {
+    fe25519 YplusX;
+    fe25519 YminusX;
+    fe25519 Z;
+    fe25519 T2d;
+} ge25519_cached;
+
+void ge25519_tobytes(unsigned char *s, const ge25519_p2 *h);
+
+void ge25519_p3_tobytes(unsigned char *s, const ge25519_p3 *h);
+
+int ge25519_frombytes(ge25519_p3 *h, const unsigned char *s);
+
+int ge25519_frombytes_negate_vartime(ge25519_p3 *h, const unsigned char *s);
+
+void ge25519_p3_to_cached(ge25519_cached *r, const ge25519_p3 *p);
+
+void ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p);
+
+void ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p);
+
+void ge25519_add(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q);
+
+void ge25519_sub(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q);
+
+void ge25519_scalarmult_base(ge25519_p3 *h, const unsigned char *a);
+
+void ge25519_double_scalarmult_vartime(ge25519_p2 *r, const unsigned char *a,
+                                       const ge25519_p3 *A,
+                                       const unsigned char *b);
+
+void ge25519_scalarmult(ge25519_p3 *h, const unsigned char *a,
+                        const ge25519_p3 *p);
+
+int ge25519_is_canonical(const unsigned char *s);
+
+int ge25519_is_on_curve(const ge25519_p3 *p);
+
+int ge25519_is_on_main_subgroup(const ge25519_p3 *p);
+
+int ge25519_has_small_order(const unsigned char s[32]);
+
+void ge25519_from_uniform(unsigned char s[32], const unsigned char r[32]);
+
+void ge25519_from_hash(unsigned char s[32], const unsigned char h[64]);
+
+/*
+ Ristretto group
+ */
+
+int ristretto255_frombytes(ge25519_p3 *h, const unsigned char *s);
+
+void ristretto255_p3_tobytes(unsigned char *s, const ge25519_p3 *h);
+
+void ristretto255_from_hash(unsigned char s[32], const unsigned char h[64]);
+
+/*
+ The set of scalars is \Z/l
+ where l = 2^252 + 27742317777372353535851937790883648493.
+ */
+
+void sc25519_invert(unsigned char recip[32], const unsigned char s[32]);
+
+void sc25519_reduce(unsigned char s[64]);
+
+void sc25519_mul(unsigned char s[32], const unsigned char a[32],
+                 const unsigned char b[32]);
+
+void sc25519_muladd(unsigned char s[32], const unsigned char a[32],
+                    const unsigned char b[32], const unsigned char c[32]);
+
+int sc25519_is_canonical(const unsigned char s[32]);
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h b/vendor/external/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h
@@ -0,0 +1,1030 @@
+#include <string.h>
+
+#include "private/common.h"
+#include "utils.h"
+
+/*
+ h = 0
+ */
+
+static inline void
+fe25519_0(fe25519 h)
+{
+    memset(&h[0], 0, 10 * sizeof h[0]);
+}
+
+/*
+ h = 1
+ */
+
+static inline void
+fe25519_1(fe25519 h)
+{
+    h[0] = 1;
+    h[1] = 0;
+    memset(&h[2], 0, 8 * sizeof h[0]);
+}
+
+/*
+ h = f + g
+ Can overlap h with f or g.
+ *
+ Preconditions:
+ |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ *
+ Postconditions:
+ |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+ */
+
+static inline void
+fe25519_add(fe25519 h, const fe25519 f, const fe25519 g)
+{
+    int32_t h0 = f[0] + g[0];
+    int32_t h1 = f[1] + g[1];
+    int32_t h2 = f[2] + g[2];
+    int32_t h3 = f[3] + g[3];
+    int32_t h4 = f[4] + g[4];
+    int32_t h5 = f[5] + g[5];
+    int32_t h6 = f[6] + g[6];
+    int32_t h7 = f[7] + g[7];
+    int32_t h8 = f[8] + g[8];
+    int32_t h9 = f[9] + g[9];
+
+    h[0] = h0;
+    h[1] = h1;
+    h[2] = h2;
+    h[3] = h3;
+    h[4] = h4;
+    h[5] = h5;
+    h[6] = h6;
+    h[7] = h7;
+    h[8] = h8;
+    h[9] = h9;
+}
+
+/*
+ h = f - g
+ Can overlap h with f or g.
+ *
+ Preconditions:
+ |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ *
+ Postconditions:
+ |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+ */
+
+static void
+fe25519_sub(fe25519 h, const fe25519 f, const fe25519 g)
+{
+    int32_t h0 = f[0] - g[0];
+    int32_t h1 = f[1] - g[1];
+    int32_t h2 = f[2] - g[2];
+    int32_t h3 = f[3] - g[3];
+    int32_t h4 = f[4] - g[4];
+    int32_t h5 = f[5] - g[5];
+    int32_t h6 = f[6] - g[6];
+    int32_t h7 = f[7] - g[7];
+    int32_t h8 = f[8] - g[8];
+    int32_t h9 = f[9] - g[9];
+
+    h[0] = h0;
+    h[1] = h1;
+    h[2] = h2;
+    h[3] = h3;
+    h[4] = h4;
+    h[5] = h5;
+    h[6] = h6;
+    h[7] = h7;
+    h[8] = h8;
+    h[9] = h9;
+}
+
+/*
+ h = -f
+ *
+ Preconditions:
+ |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ *
+ Postconditions:
+ |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
+ */
+
+static inline void
+fe25519_neg(fe25519 h, const fe25519 f)
+{
+    int32_t h0 = -f[0];
+    int32_t h1 = -f[1];
+    int32_t h2 = -f[2];
+    int32_t h3 = -f[3];
+    int32_t h4 = -f[4];
+    int32_t h5 = -f[5];
+    int32_t h6 = -f[6];
+    int32_t h7 = -f[7];
+    int32_t h8 = -f[8];
+    int32_t h9 = -f[9];
+
+    h[0] = h0;
+    h[1] = h1;
+    h[2] = h2;
+    h[3] = h3;
+    h[4] = h4;
+    h[5] = h5;
+    h[6] = h6;
+    h[7] = h7;
+    h[8] = h8;
+    h[9] = h9;
+}
+
+/*
+ Replace (f,g) with (g,g) if b == 1;
+ replace (f,g) with (f,g) if b == 0.
+ *
+ Preconditions: b in {0,1}.
+ */
+
+static void
+fe25519_cmov(fe25519 f, const fe25519 g, unsigned int b)
+{
+    const uint32_t mask = (uint32_t) (-(int32_t) b);
+
+    int32_t f0 = f[0];
+    int32_t f1 = f[1];
+    int32_t f2 = f[2];
+    int32_t f3 = f[3];
+    int32_t f4 = f[4];
+    int32_t f5 = f[5];
+    int32_t f6 = f[6];
+    int32_t f7 = f[7];
+    int32_t f8 = f[8];
+    int32_t f9 = f[9];
+
+    int32_t x0 = f0 ^ g[0];
+    int32_t x1 = f1 ^ g[1];
+    int32_t x2 = f2 ^ g[2];
+    int32_t x3 = f3 ^ g[3];
+    int32_t x4 = f4 ^ g[4];
+    int32_t x5 = f5 ^ g[5];
+    int32_t x6 = f6 ^ g[6];
+    int32_t x7 = f7 ^ g[7];
+    int32_t x8 = f8 ^ g[8];
+    int32_t x9 = f9 ^ g[9];
+
+    x0 &= mask;
+    x1 &= mask;
+    x2 &= mask;
+    x3 &= mask;
+    x4 &= mask;
+    x5 &= mask;
+    x6 &= mask;
+    x7 &= mask;
+    x8 &= mask;
+    x9 &= mask;
+
+    f[0] = f0 ^ x0;
+    f[1] = f1 ^ x1;
+    f[2] = f2 ^ x2;
+    f[3] = f3 ^ x3;
+    f[4] = f4 ^ x4;
+    f[5] = f5 ^ x5;
+    f[6] = f6 ^ x6;
+    f[7] = f7 ^ x7;
+    f[8] = f8 ^ x8;
+    f[9] = f9 ^ x9;
+}
+
+static void
+fe25519_cswap(fe25519 f, fe25519 g, unsigned int b)
+{
+    const uint32_t mask = (uint32_t) (-(int64_t) b);
+
+    int32_t f0 = f[0];
+    int32_t f1 = f[1];
+    int32_t f2 = f[2];
+    int32_t f3 = f[3];
+    int32_t f4 = f[4];
+    int32_t f5 = f[5];
+    int32_t f6 = f[6];
+    int32_t f7 = f[7];
+    int32_t f8 = f[8];
+    int32_t f9 = f[9];
+
+    int32_t g0 = g[0];
+    int32_t g1 = g[1];
+    int32_t g2 = g[2];
+    int32_t g3 = g[3];
+    int32_t g4 = g[4];
+    int32_t g5 = g[5];
+    int32_t g6 = g[6];
+    int32_t g7 = g[7];
+    int32_t g8 = g[8];
+    int32_t g9 = g[9];
+
+    int32_t x0 = f0 ^ g0;
+    int32_t x1 = f1 ^ g1;
+    int32_t x2 = f2 ^ g2;
+    int32_t x3 = f3 ^ g3;
+    int32_t x4 = f4 ^ g4;
+    int32_t x5 = f5 ^ g5;
+    int32_t x6 = f6 ^ g6;
+    int32_t x7 = f7 ^ g7;
+    int32_t x8 = f8 ^ g8;
+    int32_t x9 = f9 ^ g9;
+
+    x0 &= mask;
+    x1 &= mask;
+    x2 &= mask;
+    x3 &= mask;
+    x4 &= mask;
+    x5 &= mask;
+    x6 &= mask;
+    x7 &= mask;
+    x8 &= mask;
+    x9 &= mask;
+
+    f[0] = f0 ^ x0;
+    f[1] = f1 ^ x1;
+    f[2] = f2 ^ x2;
+    f[3] = f3 ^ x3;
+    f[4] = f4 ^ x4;
+    f[5] = f5 ^ x5;
+    f[6] = f6 ^ x6;
+    f[7] = f7 ^ x7;
+    f[8] = f8 ^ x8;
+    f[9] = f9 ^ x9;
+
+    g[0] = g0 ^ x0;
+    g[1] = g1 ^ x1;
+    g[2] = g2 ^ x2;
+    g[3] = g3 ^ x3;
+    g[4] = g4 ^ x4;
+    g[5] = g5 ^ x5;
+    g[6] = g6 ^ x6;
+    g[7] = g7 ^ x7;
+    g[8] = g8 ^ x8;
+    g[9] = g9 ^ x9;
+}
+
+/*
+ h = f
+ */
+
+static inline void
+fe25519_copy(fe25519 h, const fe25519 f)
+{
+    memcpy(h, f, 10 * sizeof h[0]);
+}
+
+/*
+ return 1 if f is in {1,3,5,...,q-2}
+ return 0 if f is in {0,2,4,...,q-1}
+
+ Preconditions:
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+ */
+
+static inline int
+fe25519_isnegative(const fe25519 f)
+{
+    unsigned char s[32];
+
+    fe25519_tobytes(s, f);
+
+    return s[0] & 1;
+}
+
+/*
+ return 1 if f == 0
+ return 0 if f != 0
+
+ Preconditions:
+ |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
+ */
+
+static inline int
+fe25519_iszero(const fe25519 f)
+{
+    unsigned char s[32];
+
+    fe25519_tobytes(s, f);
+
+    return sodium_is_zero(s, 32);
+}
+
+/*
+ h = f * g
+ Can overlap h with f or g.
+ *
+ Preconditions:
+ |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+ |g| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+ *
+ Postconditions:
+ |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
+ */
+
+/*
+ Notes on implementation strategy:
+ *
+ Using schoolbook multiplication.
+ Karatsuba would save a little in some cost models.
+ *
+ Most multiplications by 2 and 19 are 32-bit precomputations;
+ cheaper than 64-bit postcomputations.
+ *
+ There is one remaining multiplication by 19 in the carry chain;
+ one *19 precomputation can be merged into this,
+ but the resulting data flow is considerably less clean.
+ *
+ There are 12 carries below.
+ 10 of them are 2-way parallelizable and vectorizable.
+ Can get away with 11 carries, but then data flow is much deeper.
+ *
+ With tighter constraints on inputs can squeeze carries into int32.
+ */
+
+static void
+fe25519_mul(fe25519 h, const fe25519 f, const fe25519 g)
+{
+    int32_t f0 = f[0];
+    int32_t f1 = f[1];
+    int32_t f2 = f[2];
+    int32_t f3 = f[3];
+    int32_t f4 = f[4];
+    int32_t f5 = f[5];
+    int32_t f6 = f[6];
+    int32_t f7 = f[7];
+    int32_t f8 = f[8];
+    int32_t f9 = f[9];
+
+    int32_t g0 = g[0];
+    int32_t g1 = g[1];
+    int32_t g2 = g[2];
+    int32_t g3 = g[3];
+    int32_t g4 = g[4];
+    int32_t g5 = g[5];
+    int32_t g6 = g[6];
+    int32_t g7 = g[7];
+    int32_t g8 = g[8];
+    int32_t g9 = g[9];
+
+    int32_t g1_19 = 19 * g1; /* 1.959375*2^29 */
+    int32_t g2_19 = 19 * g2; /* 1.959375*2^30; still ok */
+    int32_t g3_19 = 19 * g3;
+    int32_t g4_19 = 19 * g4;
+    int32_t g5_19 = 19 * g5;
+    int32_t g6_19 = 19 * g6;
+    int32_t g7_19 = 19 * g7;
+    int32_t g8_19 = 19 * g8;
+    int32_t g9_19 = 19 * g9;
+    int32_t f1_2  = 2 * f1;
+    int32_t f3_2  = 2 * f3;
+    int32_t f5_2  = 2 * f5;
+    int32_t f7_2  = 2 * f7;
+    int32_t f9_2  = 2 * f9;
+
+    int64_t f0g0    = f0 * (int64_t) g0;
+    int64_t f0g1    = f0 * (int64_t) g1;
+    int64_t f0g2    = f0 * (int64_t) g2;
+    int64_t f0g3    = f0 * (int64_t) g3;
+    int64_t f0g4    = f0 * (int64_t) g4;
+    int64_t f0g5    = f0 * (int64_t) g5;
+    int64_t f0g6    = f0 * (int64_t) g6;
+    int64_t f0g7    = f0 * (int64_t) g7;
+    int64_t f0g8    = f0 * (int64_t) g8;
+    int64_t f0g9    = f0 * (int64_t) g9;
+    int64_t f1g0    = f1 * (int64_t) g0;
+    int64_t f1g1_2  = f1_2 * (int64_t) g1;
+    int64_t f1g2    = f1 * (int64_t) g2;
+    int64_t f1g3_2  = f1_2 * (int64_t) g3;
+    int64_t f1g4    = f1 * (int64_t) g4;
+    int64_t f1g5_2  = f1_2 * (int64_t) g5;
+    int64_t f1g6    = f1 * (int64_t) g6;
+    int64_t f1g7_2  = f1_2 * (int64_t) g7;
+    int64_t f1g8    = f1 * (int64_t) g8;
+    int64_t f1g9_38 = f1_2 * (int64_t) g9_19;
+    int64_t f2g0    = f2 * (int64_t) g0;
+    int64_t f2g1    = f2 * (int64_t) g1;
+    int64_t f2g2    = f2 * (int64_t) g2;
+    int64_t f2g3    = f2 * (int64_t) g3;
+    int64_t f2g4    = f2 * (int64_t) g4;
+    int64_t f2g5    = f2 * (int64_t) g5;
+    int64_t f2g6    = f2 * (int64_t) g6;
+    int64_t f2g7    = f2 * (int64_t) g7;
+    int64_t f2g8_19 = f2 * (int64_t) g8_19;
+    int64_t f2g9_19 = f2 * (int64_t) g9_19;
+    int64_t f3g0    = f3 * (int64_t) g0;
+    int64_t f3g1_2  = f3_2 * (int64_t) g1;
+    int64_t f3g2    = f3 * (int64_t) g2;
+    int64_t f3g3_2  = f3_2 * (int64_t) g3;
+    int64_t f3g4    = f3 * (int64_t) g4;
+    int64_t f3g5_2  = f3_2 * (int64_t) g5;
+    int64_t f3g6    = f3 * (int64_t) g6;
+    int64_t f3g7_38 = f3_2 * (int64_t) g7_19;
+    int64_t f3g8_19 = f3 * (int64_t) g8_19;
+    int64_t f3g9_38 = f3_2 * (int64_t) g9_19;
+    int64_t f4g0    = f4 * (int64_t) g0;
+    int64_t f4g1    = f4 * (int64_t) g1;
+    int64_t f4g2    = f4 * (int64_t) g2;
+    int64_t f4g3    = f4 * (int64_t) g3;
+    int64_t f4g4    = f4 * (int64_t) g4;
+    int64_t f4g5    = f4 * (int64_t) g5;
+    int64_t f4g6_19 = f4 * (int64_t) g6_19;
+    int64_t f4g7_19 = f4 * (int64_t) g7_19;
+    int64_t f4g8_19 = f4 * (int64_t) g8_19;
+    int64_t f4g9_19 = f4 * (int64_t) g9_19;
+    int64_t f5g0    = f5 * (int64_t) g0;
+    int64_t f5g1_2  = f5_2 * (int64_t) g1;
+    int64_t f5g2    = f5 * (int64_t) g2;
+    int64_t f5g3_2  = f5_2 * (int64_t) g3;
+    int64_t f5g4    = f5 * (int64_t) g4;
+    int64_t f5g5_38 = f5_2 * (int64_t) g5_19;
+    int64_t f5g6_19 = f5 * (int64_t) g6_19;
+    int64_t f5g7_38 = f5_2 * (int64_t) g7_19;
+    int64_t f5g8_19 = f5 * (int64_t) g8_19;
+    int64_t f5g9_38 = f5_2 * (int64_t) g9_19;
+    int64_t f6g0    = f6 * (int64_t) g0;
+    int64_t f6g1    = f6 * (int64_t) g1;
+    int64_t f6g2    = f6 * (int64_t) g2;
+    int64_t f6g3    = f6 * (int64_t) g3;
+    int64_t f6g4_19 = f6 * (int64_t) g4_19;
+    int64_t f6g5_19 = f6 * (int64_t) g5_19;
+    int64_t f6g6_19 = f6 * (int64_t) g6_19;
+    int64_t f6g7_19 = f6 * (int64_t) g7_19;
+    int64_t f6g8_19 = f6 * (int64_t) g8_19;
+    int64_t f6g9_19 = f6 * (int64_t) g9_19;
+    int64_t f7g0    = f7 * (int64_t) g0;
+    int64_t f7g1_2  = f7_2 * (int64_t) g1;
+    int64_t f7g2    = f7 * (int64_t) g2;
+    int64_t f7g3_38 = f7_2 * (int64_t) g3_19;
+    int64_t f7g4_19 = f7 * (int64_t) g4_19;
+    int64_t f7g5_38 = f7_2 * (int64_t) g5_19;
+    int64_t f7g6_19 = f7 * (int64_t) g6_19;
+    int64_t f7g7_38 = f7_2 * (int64_t) g7_19;
+    int64_t f7g8_19 = f7 * (int64_t) g8_19;
+    int64_t f7g9_38 = f7_2 * (int64_t) g9_19;
+    int64_t f8g0    = f8 * (int64_t) g0;
+    int64_t f8g1    = f8 * (int64_t) g1;
+    int64_t f8g2_19 = f8 * (int64_t) g2_19;
+    int64_t f8g3_19 = f8 * (int64_t) g3_19;
+    int64_t f8g4_19 = f8 * (int64_t) g4_19;
+    int64_t f8g5_19 = f8 * (int64_t) g5_19;
+    int64_t f8g6_19 = f8 * (int64_t) g6_19;
+    int64_t f8g7_19 = f8 * (int64_t) g7_19;
+    int64_t f8g8_19 = f8 * (int64_t) g8_19;
+    int64_t f8g9_19 = f8 * (int64_t) g9_19;
+    int64_t f9g0    = f9 * (int64_t) g0;
+    int64_t f9g1_38 = f9_2 * (int64_t) g1_19;
+    int64_t f9g2_19 = f9 * (int64_t) g2_19;
+    int64_t f9g3_38 = f9_2 * (int64_t) g3_19;
+    int64_t f9g4_19 = f9 * (int64_t) g4_19;
+    int64_t f9g5_38 = f9_2 * (int64_t) g5_19;
+    int64_t f9g6_19 = f9 * (int64_t) g6_19;
+    int64_t f9g7_38 = f9_2 * (int64_t) g7_19;
+    int64_t f9g8_19 = f9 * (int64_t) g8_19;
+    int64_t f9g9_38 = f9_2 * (int64_t) g9_19;
+
+    int64_t h0 = f0g0 + f1g9_38 + f2g8_19 + f3g7_38 + f4g6_19 + f5g5_38 +
+                 f6g4_19 + f7g3_38 + f8g2_19 + f9g1_38;
+    int64_t h1 = f0g1 + f1g0 + f2g9_19 + f3g8_19 + f4g7_19 + f5g6_19 + f6g5_19 +
+                 f7g4_19 + f8g3_19 + f9g2_19;
+    int64_t h2 = f0g2 + f1g1_2 + f2g0 + f3g9_38 + f4g8_19 + f5g7_38 + f6g6_19 +
+                 f7g5_38 + f8g4_19 + f9g3_38;
+    int64_t h3 = f0g3 + f1g2 + f2g1 + f3g0 + f4g9_19 + f5g8_19 + f6g7_19 +
+                 f7g6_19 + f8g5_19 + f9g4_19;
+    int64_t h4 = f0g4 + f1g3_2 + f2g2 + f3g1_2 + f4g0 + f5g9_38 + f6g8_19 +
+                 f7g7_38 + f8g6_19 + f9g5_38;
+    int64_t h5 = f0g5 + f1g4 + f2g3 + f3g2 + f4g1 + f5g0 + f6g9_19 + f7g8_19 +
+                 f8g7_19 + f9g6_19;
+    int64_t h6 = f0g6 + f1g5_2 + f2g4 + f3g3_2 + f4g2 + f5g1_2 + f6g0 +
+                 f7g9_38 + f8g8_19 + f9g7_38;
+    int64_t h7 = f0g7 + f1g6 + f2g5 + f3g4 + f4g3 + f5g2 + f6g1 + f7g0 +
+                 f8g9_19 + f9g8_19;
+    int64_t h8 = f0g8 + f1g7_2 + f2g6 + f3g5_2 + f4g4 + f5g3_2 + f6g2 + f7g1_2 +
+                 f8g0 + f9g9_38;
+    int64_t h9 =
+        f0g9 + f1g8 + f2g7 + f3g6 + f4g5 + f5g4 + f6g3 + f7g2 + f8g1 + f9g0;
+
+    int64_t carry0;
+    int64_t carry1;
+    int64_t carry2;
+    int64_t carry3;
+    int64_t carry4;
+    int64_t carry5;
+    int64_t carry6;
+    int64_t carry7;
+    int64_t carry8;
+    int64_t carry9;
+
+    /*
+     |h0| <= (1.65*1.65*2^52*(1+19+19+19+19)+1.65*1.65*2^50*(38+38+38+38+38))
+     i.e. |h0| <= 1.4*2^60; narrower ranges for h2, h4, h6, h8
+     |h1| <= (1.65*1.65*2^51*(1+1+19+19+19+19+19+19+19+19))
+     i.e. |h1| <= 1.7*2^59; narrower ranges for h3, h5, h7, h9
+     */
+
+    carry0 = (h0 + (int64_t)(1L << 25)) >> 26;
+    h1 += carry0;
+    h0 -= carry0 * ((uint64_t) 1L << 26);
+    carry4 = (h4 + (int64_t)(1L << 25)) >> 26;
+    h5 += carry4;
+    h4 -= carry4 * ((uint64_t) 1L << 26);
+    /* |h0| <= 2^25 */
+    /* |h4| <= 2^25 */
+    /* |h1| <= 1.71*2^59 */
+    /* |h5| <= 1.71*2^59 */
+
+    carry1 = (h1 + (int64_t)(1L << 24)) >> 25;
+    h2 += carry1;
+    h1 -= carry1 * ((uint64_t) 1L << 25);
+    carry5 = (h5 + (int64_t)(1L << 24)) >> 25;
+    h6 += carry5;
+    h5 -= carry5 * ((uint64_t) 1L << 25);
+    /* |h1| <= 2^24; from now on fits into int32 */
+    /* |h5| <= 2^24; from now on fits into int32 */
+    /* |h2| <= 1.41*2^60 */
+    /* |h6| <= 1.41*2^60 */
+
+    carry2 = (h2 + (int64_t)(1L << 25)) >> 26;
+    h3 += carry2;
+    h2 -= carry2 * ((uint64_t) 1L << 26);
+    carry6 = (h6 + (int64_t)(1L << 25)) >> 26;
+    h7 += carry6;
+    h6 -= carry6 * ((uint64_t) 1L << 26);
+    /* |h2| <= 2^25; from now on fits into int32 unchanged */
+    /* |h6| <= 2^25; from now on fits into int32 unchanged */
+    /* |h3| <= 1.71*2^59 */
+    /* |h7| <= 1.71*2^59 */
+
+    carry3 = (h3 + (int64_t)(1L << 24)) >> 25;
+    h4 += carry3;
+    h3 -= carry3 * ((uint64_t) 1L << 25);
+    carry7 = (h7 + (int64_t)(1L << 24)) >> 25;
+    h8 += carry7;
+    h7 -= carry7 * ((uint64_t) 1L << 25);
+    /* |h3| <= 2^24; from now on fits into int32 unchanged */
+    /* |h7| <= 2^24; from now on fits into int32 unchanged */
+    /* |h4| <= 1.72*2^34 */
+    /* |h8| <= 1.41*2^60 */
+
+    carry4 = (h4 + (int64_t)(1L << 25)) >> 26;
+    h5 += carry4;
+    h4 -= carry4 * ((uint64_t) 1L << 26);
+    carry8 = (h8 + (int64_t)(1L << 25)) >> 26;
+    h9 += carry8;
+    h8 -= carry8 * ((uint64_t) 1L << 26);
+    /* |h4| <= 2^25; from now on fits into int32 unchanged */
+    /* |h8| <= 2^25; from now on fits into int32 unchanged */
+    /* |h5| <= 1.01*2^24 */
+    /* |h9| <= 1.71*2^59 */
+
+    carry9 = (h9 + (int64_t)(1L << 24)) >> 25;
+    h0 += carry9 * 19;
+    h9 -= carry9 * ((uint64_t) 1L << 25);
+    /* |h9| <= 2^24; from now on fits into int32 unchanged */
+    /* |h0| <= 1.1*2^39 */
+
+    carry0 = (h0 + (int64_t)(1L << 25)) >> 26;
+    h1 += carry0;
+    h0 -= carry0 * ((uint64_t) 1L << 26);
+    /* |h0| <= 2^25; from now on fits into int32 unchanged */
+    /* |h1| <= 1.01*2^24 */
+
+    h[0] = (int32_t) h0;
+    h[1] = (int32_t) h1;
+    h[2] = (int32_t) h2;
+    h[3] = (int32_t) h3;
+    h[4] = (int32_t) h4;
+    h[5] = (int32_t) h5;
+    h[6] = (int32_t) h6;
+    h[7] = (int32_t) h7;
+    h[8] = (int32_t) h8;
+    h[9] = (int32_t) h9;
+}
+
+/*
+ h = f * f
+ Can overlap h with f.
+ *
+ Preconditions:
+ |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+ *
+ Postconditions:
+ |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
+ */
+
+static void
+fe25519_sq(fe25519 h, const fe25519 f)
+{
+    int32_t f0 = f[0];
+    int32_t f1 = f[1];
+    int32_t f2 = f[2];
+    int32_t f3 = f[3];
+    int32_t f4 = f[4];
+    int32_t f5 = f[5];
+    int32_t f6 = f[6];
+    int32_t f7 = f[7];
+    int32_t f8 = f[8];
+    int32_t f9 = f[9];
+
+    int32_t f0_2  = 2 * f0;
+    int32_t f1_2  = 2 * f1;
+    int32_t f2_2  = 2 * f2;
+    int32_t f3_2  = 2 * f3;
+    int32_t f4_2  = 2 * f4;
+    int32_t f5_2  = 2 * f5;
+    int32_t f6_2  = 2 * f6;
+    int32_t f7_2  = 2 * f7;
+    int32_t f5_38 = 38 * f5; /* 1.959375*2^30 */
+    int32_t f6_19 = 19 * f6; /* 1.959375*2^30 */
+    int32_t f7_38 = 38 * f7; /* 1.959375*2^30 */
+    int32_t f8_19 = 19 * f8; /* 1.959375*2^30 */
+    int32_t f9_38 = 38 * f9; /* 1.959375*2^30 */
+
+    int64_t f0f0    = f0 * (int64_t) f0;
+    int64_t f0f1_2  = f0_2 * (int64_t) f1;
+    int64_t f0f2_2  = f0_2 * (int64_t) f2;
+    int64_t f0f3_2  = f0_2 * (int64_t) f3;
+    int64_t f0f4_2  = f0_2 * (int64_t) f4;
+    int64_t f0f5_2  = f0_2 * (int64_t) f5;
+    int64_t f0f6_2  = f0_2 * (int64_t) f6;
+    int64_t f0f7_2  = f0_2 * (int64_t) f7;
+    int64_t f0f8_2  = f0_2 * (int64_t) f8;
+    int64_t f0f9_2  = f0_2 * (int64_t) f9;
+    int64_t f1f1_2  = f1_2 * (int64_t) f1;
+    int64_t f1f2_2  = f1_2 * (int64_t) f2;
+    int64_t f1f3_4  = f1_2 * (int64_t) f3_2;
+    int64_t f1f4_2  = f1_2 * (int64_t) f4;
+    int64_t f1f5_4  = f1_2 * (int64_t) f5_2;
+    int64_t f1f6_2  = f1_2 * (int64_t) f6;
+    int64_t f1f7_4  = f1_2 * (int64_t) f7_2;
+    int64_t f1f8_2  = f1_2 * (int64_t) f8;
+    int64_t f1f9_76 = f1_2 * (int64_t) f9_38;
+    int64_t f2f2    = f2 * (int64_t) f2;
+    int64_t f2f3_2  = f2_2 * (int64_t) f3;
+    int64_t f2f4_2  = f2_2 * (int64_t) f4;
+    int64_t f2f5_2  = f2_2 * (int64_t) f5;
+    int64_t f2f6_2  = f2_2 * (int64_t) f6;
+    int64_t f2f7_2  = f2_2 * (int64_t) f7;
+    int64_t f2f8_38 = f2_2 * (int64_t) f8_19;
+    int64_t f2f9_38 = f2 * (int64_t) f9_38;
+    int64_t f3f3_2  = f3_2 * (int64_t) f3;
+    int64_t f3f4_2  = f3_2 * (int64_t) f4;
+    int64_t f3f5_4  = f3_2 * (int64_t) f5_2;
+    int64_t f3f6_2  = f3_2 * (int64_t) f6;
+    int64_t f3f7_76 = f3_2 * (int64_t) f7_38;
+    int64_t f3f8_38 = f3_2 * (int64_t) f8_19;
+    int64_t f3f9_76 = f3_2 * (int64_t) f9_38;
+    int64_t f4f4    = f4 * (int64_t) f4;
+    int64_t f4f5_2  = f4_2 * (int64_t) f5;
+    int64_t f4f6_38 = f4_2 * (int64_t) f6_19;
+    int64_t f4f7_38 = f4 * (int64_t) f7_38;
+    int64_t f4f8_38 = f4_2 * (int64_t) f8_19;
+    int64_t f4f9_38 = f4 * (int64_t) f9_38;
+    int64_t f5f5_38 = f5 * (int64_t) f5_38;
+    int64_t f5f6_38 = f5_2 * (int64_t) f6_19;
+    int64_t f5f7_76 = f5_2 * (int64_t) f7_38;
+    int64_t f5f8_38 = f5_2 * (int64_t) f8_19;
+    int64_t f5f9_76 = f5_2 * (int64_t) f9_38;
+    int64_t f6f6_19 = f6 * (int64_t) f6_19;
+    int64_t f6f7_38 = f6 * (int64_t) f7_38;
+    int64_t f6f8_38 = f6_2 * (int64_t) f8_19;
+    int64_t f6f9_38 = f6 * (int64_t) f9_38;
+    int64_t f7f7_38 = f7 * (int64_t) f7_38;
+    int64_t f7f8_38 = f7_2 * (int64_t) f8_19;
+    int64_t f7f9_76 = f7_2 * (int64_t) f9_38;
+    int64_t f8f8_19 = f8 * (int64_t) f8_19;
+    int64_t f8f9_38 = f8 * (int64_t) f9_38;
+    int64_t f9f9_38 = f9 * (int64_t) f9_38;
+
+    int64_t h0 = f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38;
+    int64_t h1 = f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38;
+    int64_t h2 = f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19;
+    int64_t h3 = f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38;
+    int64_t h4 = f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38;
+    int64_t h5 = f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38;
+    int64_t h6 = f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19;
+    int64_t h7 = f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38;
+    int64_t h8 = f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38;
+    int64_t h9 = f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2;
+
+    int64_t carry0;
+    int64_t carry1;
+    int64_t carry2;
+    int64_t carry3;
+    int64_t carry4;
+    int64_t carry5;
+    int64_t carry6;
+    int64_t carry7;
+    int64_t carry8;
+    int64_t carry9;
+
+    carry0 = (h0 + (int64_t)(1L << 25)) >> 26;
+    h1 += carry0;
+    h0 -= carry0 * ((uint64_t) 1L << 26);
+    carry4 = (h4 + (int64_t)(1L << 25)) >> 26;
+    h5 += carry4;
+    h4 -= carry4 * ((uint64_t) 1L << 26);
+
+    carry1 = (h1 + (int64_t)(1L << 24)) >> 25;
+    h2 += carry1;
+    h1 -= carry1 * ((uint64_t) 1L << 25);
+    carry5 = (h5 + (int64_t)(1L << 24)) >> 25;
+    h6 += carry5;
+    h5 -= carry5 * ((uint64_t) 1L << 25);
+
+    carry2 = (h2 + (int64_t)(1L << 25)) >> 26;
+    h3 += carry2;
+    h2 -= carry2 * ((uint64_t) 1L << 26);
+    carry6 = (h6 + (int64_t)(1L << 25)) >> 26;
+    h7 += carry6;
+    h6 -= carry6 * ((uint64_t) 1L << 26);
+
+    carry3 = (h3 + (int64_t)(1L << 24)) >> 25;
+    h4 += carry3;
+    h3 -= carry3 * ((uint64_t) 1L << 25);
+    carry7 = (h7 + (int64_t)(1L << 24)) >> 25;
+    h8 += carry7;
+    h7 -= carry7 * ((uint64_t) 1L << 25);
+
+    carry4 = (h4 + (int64_t)(1L << 25)) >> 26;
+    h5 += carry4;
+    h4 -= carry4 * ((uint64_t) 1L << 26);
+    carry8 = (h8 + (int64_t)(1L << 25)) >> 26;
+    h9 += carry8;
+    h8 -= carry8 * ((uint64_t) 1L << 26);
+
+    carry9 = (h9 + (int64_t)(1L << 24)) >> 25;
+    h0 += carry9 * 19;
+    h9 -= carry9 * ((uint64_t) 1L << 25);
+
+    carry0 = (h0 + (int64_t)(1L << 25)) >> 26;
+    h1 += carry0;
+    h0 -= carry0 * ((uint64_t) 1L << 26);
+
+    h[0] = (int32_t) h0;
+    h[1] = (int32_t) h1;
+    h[2] = (int32_t) h2;
+    h[3] = (int32_t) h3;
+    h[4] = (int32_t) h4;
+    h[5] = (int32_t) h5;
+    h[6] = (int32_t) h6;
+    h[7] = (int32_t) h7;
+    h[8] = (int32_t) h8;
+    h[9] = (int32_t) h9;
+}
+
+/*
+ h = 2 * f * f
+ Can overlap h with f.
+ *
+ Preconditions:
+ |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc.
+ *
+ Postconditions:
+ |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc.
+ */
+
+static void
+fe25519_sq2(fe25519 h, const fe25519 f)
+{
+    int32_t f0 = f[0];
+    int32_t f1 = f[1];
+    int32_t f2 = f[2];
+    int32_t f3 = f[3];
+    int32_t f4 = f[4];
+    int32_t f5 = f[5];
+    int32_t f6 = f[6];
+    int32_t f7 = f[7];
+    int32_t f8 = f[8];
+    int32_t f9 = f[9];
+
+    int32_t f0_2  = 2 * f0;
+    int32_t f1_2  = 2 * f1;
+    int32_t f2_2  = 2 * f2;
+    int32_t f3_2  = 2 * f3;
+    int32_t f4_2  = 2 * f4;
+    int32_t f5_2  = 2 * f5;
+    int32_t f6_2  = 2 * f6;
+    int32_t f7_2  = 2 * f7;
+    int32_t f5_38 = 38 * f5; /* 1.959375*2^30 */
+    int32_t f6_19 = 19 * f6; /* 1.959375*2^30 */
+    int32_t f7_38 = 38 * f7; /* 1.959375*2^30 */
+    int32_t f8_19 = 19 * f8; /* 1.959375*2^30 */
+    int32_t f9_38 = 38 * f9; /* 1.959375*2^30 */
+
+    int64_t f0f0    = f0 * (int64_t) f0;
+    int64_t f0f1_2  = f0_2 * (int64_t) f1;
+    int64_t f0f2_2  = f0_2 * (int64_t) f2;
+    int64_t f0f3_2  = f0_2 * (int64_t) f3;
+    int64_t f0f4_2  = f0_2 * (int64_t) f4;
+    int64_t f0f5_2  = f0_2 * (int64_t) f5;
+    int64_t f0f6_2  = f0_2 * (int64_t) f6;
+    int64_t f0f7_2  = f0_2 * (int64_t) f7;
+    int64_t f0f8_2  = f0_2 * (int64_t) f8;
+    int64_t f0f9_2  = f0_2 * (int64_t) f9;
+    int64_t f1f1_2  = f1_2 * (int64_t) f1;
+    int64_t f1f2_2  = f1_2 * (int64_t) f2;
+    int64_t f1f3_4  = f1_2 * (int64_t) f3_2;
+    int64_t f1f4_2  = f1_2 * (int64_t) f4;
+    int64_t f1f5_4  = f1_2 * (int64_t) f5_2;
+    int64_t f1f6_2  = f1_2 * (int64_t) f6;
+    int64_t f1f7_4  = f1_2 * (int64_t) f7_2;
+    int64_t f1f8_2  = f1_2 * (int64_t) f8;
+    int64_t f1f9_76 = f1_2 * (int64_t) f9_38;
+    int64_t f2f2    = f2 * (int64_t) f2;
+    int64_t f2f3_2  = f2_2 * (int64_t) f3;
+    int64_t f2f4_2  = f2_2 * (int64_t) f4;
+    int64_t f2f5_2  = f2_2 * (int64_t) f5;
+    int64_t f2f6_2  = f2_2 * (int64_t) f6;
+    int64_t f2f7_2  = f2_2 * (int64_t) f7;
+    int64_t f2f8_38 = f2_2 * (int64_t) f8_19;
+    int64_t f2f9_38 = f2 * (int64_t) f9_38;
+    int64_t f3f3_2  = f3_2 * (int64_t) f3;
+    int64_t f3f4_2  = f3_2 * (int64_t) f4;
+    int64_t f3f5_4  = f3_2 * (int64_t) f5_2;
+    int64_t f3f6_2  = f3_2 * (int64_t) f6;
+    int64_t f3f7_76 = f3_2 * (int64_t) f7_38;
+    int64_t f3f8_38 = f3_2 * (int64_t) f8_19;
+    int64_t f3f9_76 = f3_2 * (int64_t) f9_38;
+    int64_t f4f4    = f4 * (int64_t) f4;
+    int64_t f4f5_2  = f4_2 * (int64_t) f5;
+    int64_t f4f6_38 = f4_2 * (int64_t) f6_19;
+    int64_t f4f7_38 = f4 * (int64_t) f7_38;
+    int64_t f4f8_38 = f4_2 * (int64_t) f8_19;
+    int64_t f4f9_38 = f4 * (int64_t) f9_38;
+    int64_t f5f5_38 = f5 * (int64_t) f5_38;
+    int64_t f5f6_38 = f5_2 * (int64_t) f6_19;
+    int64_t f5f7_76 = f5_2 * (int64_t) f7_38;
+    int64_t f5f8_38 = f5_2 * (int64_t) f8_19;
+    int64_t f5f9_76 = f5_2 * (int64_t) f9_38;
+    int64_t f6f6_19 = f6 * (int64_t) f6_19;
+    int64_t f6f7_38 = f6 * (int64_t) f7_38;
+    int64_t f6f8_38 = f6_2 * (int64_t) f8_19;
+    int64_t f6f9_38 = f6 * (int64_t) f9_38;
+    int64_t f7f7_38 = f7 * (int64_t) f7_38;
+    int64_t f7f8_38 = f7_2 * (int64_t) f8_19;
+    int64_t f7f9_76 = f7_2 * (int64_t) f9_38;
+    int64_t f8f8_19 = f8 * (int64_t) f8_19;
+    int64_t f8f9_38 = f8 * (int64_t) f9_38;
+    int64_t f9f9_38 = f9 * (int64_t) f9_38;
+
+    int64_t h0 = f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38;
+    int64_t h1 = f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38;
+    int64_t h2 = f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19;
+    int64_t h3 = f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38;
+    int64_t h4 = f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38;
+    int64_t h5 = f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38;
+    int64_t h6 = f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19;
+    int64_t h7 = f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38;
+    int64_t h8 = f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38;
+    int64_t h9 = f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2;
+
+    int64_t carry0;
+    int64_t carry1;
+    int64_t carry2;
+    int64_t carry3;
+    int64_t carry4;
+    int64_t carry5;
+    int64_t carry6;
+    int64_t carry7;
+    int64_t carry8;
+    int64_t carry9;
+
+    h0 += h0;
+    h1 += h1;
+    h2 += h2;
+    h3 += h3;
+    h4 += h4;
+    h5 += h5;
+    h6 += h6;
+    h7 += h7;
+    h8 += h8;
+    h9 += h9;
+
+    carry0 = (h0 + (int64_t)(1L << 25)) >> 26;
+    h1 += carry0;
+    h0 -= carry0 * ((uint64_t) 1L << 26);
+    carry4 = (h4 + (int64_t)(1L << 25)) >> 26;
+    h5 += carry4;
+    h4 -= carry4 * ((uint64_t) 1L << 26);
+
+    carry1 = (h1 + (int64_t)(1L << 24)) >> 25;
+    h2 += carry1;
+    h1 -= carry1 * ((uint64_t) 1L << 25);
+    carry5 = (h5 + (int64_t)(1L << 24)) >> 25;
+    h6 += carry5;
+    h5 -= carry5 * ((uint64_t) 1L << 25);
+
+    carry2 = (h2 + (int64_t)(1L << 25)) >> 26;
+    h3 += carry2;
+    h2 -= carry2 * ((uint64_t) 1L << 26);
+    carry6 = (h6 + (int64_t)(1L << 25)) >> 26;
+    h7 += carry6;
+    h6 -= carry6 * ((uint64_t) 1L << 26);
+
+    carry3 = (h3 + (int64_t)(1L << 24)) >> 25;
+    h4 += carry3;
+    h3 -= carry3 * ((uint64_t) 1L << 25);
+    carry7 = (h7 + (int64_t)(1L << 24)) >> 25;
+    h8 += carry7;
+    h7 -= carry7 * ((uint64_t) 1L << 25);
+
+    carry4 = (h4 + (int64_t)(1L << 25)) >> 26;
+    h5 += carry4;
+    h4 -= carry4 * ((uint64_t) 1L << 26);
+    carry8 = (h8 + (int64_t)(1L << 25)) >> 26;
+    h9 += carry8;
+    h8 -= carry8 * ((uint64_t) 1L << 26);
+
+    carry9 = (h9 + (int64_t)(1L << 24)) >> 25;
+    h0 += carry9 * 19;
+    h9 -= carry9 * ((uint64_t) 1L << 25);
+
+    carry0 = (h0 + (int64_t)(1L << 25)) >> 26;
+    h1 += carry0;
+    h0 -= carry0 * ((uint64_t) 1L << 26);
+
+    h[0] = (int32_t) h0;
+    h[1] = (int32_t) h1;
+    h[2] = (int32_t) h2;
+    h[3] = (int32_t) h3;
+    h[4] = (int32_t) h4;
+    h[5] = (int32_t) h5;
+    h[6] = (int32_t) h6;
+    h[7] = (int32_t) h7;
+    h[8] = (int32_t) h8;
+    h[9] = (int32_t) h9;
+}
+
+static inline void
+fe25519_mul32(fe25519 h, const fe25519 f, uint32_t n)
+{
+    int64_t sn = (int64_t) n;
+    int32_t f0 = f[0];
+    int32_t f1 = f[1];
+    int32_t f2 = f[2];
+    int32_t f3 = f[3];
+    int32_t f4 = f[4];
+    int32_t f5 = f[5];
+    int32_t f6 = f[6];
+    int32_t f7 = f[7];
+    int32_t f8 = f[8];
+    int32_t f9 = f[9];
+    int64_t h0 = f0 * sn;
+    int64_t h1 = f1 * sn;
+    int64_t h2 = f2 * sn;
+    int64_t h3 = f3 * sn;
+    int64_t h4 = f4 * sn;
+    int64_t h5 = f5 * sn;
+    int64_t h6 = f6 * sn;
+    int64_t h7 = f7 * sn;
+    int64_t h8 = f8 * sn;
+    int64_t h9 = f9 * sn;
+    int64_t carry0, carry1, carry2, carry3, carry4, carry5, carry6, carry7,
+            carry8, carry9;
+
+    carry9 = (h9 + ((int64_t) 1 << 24)) >> 25;
+    h0 += carry9 * 19;
+    h9 -= carry9 * ((int64_t) 1 << 25);
+    carry1 = (h1 + ((int64_t) 1 << 24)) >> 25;
+    h2 += carry1;
+    h1 -= carry1 * ((int64_t) 1 << 25);
+    carry3 = (h3 + ((int64_t) 1 << 24)) >> 25;
+    h4 += carry3;
+    h3 -= carry3 * ((int64_t) 1 << 25);
+    carry5 = (h5 + ((int64_t) 1 << 24)) >> 25;
+    h6 += carry5;
+    h5 -= carry5 * ((int64_t) 1 << 25);
+    carry7 = (h7 + ((int64_t) 1 << 24)) >> 25;
+    h8 += carry7;
+    h7 -= carry7 * ((int64_t) 1 << 25);
+
+    carry0 = (h0 + ((int64_t) 1 << 25)) >> 26;
+    h1 += carry0;
+    h0 -= carry0 * ((int64_t) 1 << 26);
+    carry2 = (h2 + ((int64_t) 1 << 25)) >> 26;
+    h3 += carry2;
+    h2 -= carry2 * ((int64_t) 1 << 26);
+    carry4 = (h4 + ((int64_t) 1 << 25)) >> 26;
+    h5 += carry4;
+    h4 -= carry4 * ((int64_t) 1 << 26);
+    carry6 = (h6 + ((int64_t) 1 << 25)) >> 26;
+    h7 += carry6;
+    h6 -= carry6 * ((int64_t) 1 << 26);
+    carry8 = (h8 + ((int64_t) 1 << 25)) >> 26;
+    h9 += carry8;
+    h8 -= carry8 * ((int64_t) 1 << 26);
+
+    h[0] = (int32_t) h0;
+    h[1] = (int32_t) h1;
+    h[2] = (int32_t) h2;
+    h[3] = (int32_t) h3;
+    h[4] = (int32_t) h4;
+    h[5] = (int32_t) h5;
+    h[6] = (int32_t) h6;
+    h[7] = (int32_t) h7;
+    h[8] = (int32_t) h8;
+    h[9] = (int32_t) h9;
+}
diff --git a/vendor/external/libsodium/include/sodium/private/ed25519_ref10_fe_51.h b/vendor/external/libsodium/include/sodium/private/ed25519_ref10_fe_51.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/private/ed25519_ref10_fe_51.h
@@ -0,0 +1,508 @@
+#include <string.h>
+
+#include "private/common.h"
+#include "utils.h"
+
+/*
+ h = 0
+ */
+
+static inline void
+fe25519_0(fe25519 h)
+{
+    memset(&h[0], 0, 5 * sizeof h[0]);
+}
+
+/*
+ h = 1
+ */
+
+static inline void
+fe25519_1(fe25519 h)
+{
+    h[0] = 1;
+    memset(&h[1], 0, 4 * sizeof h[0]);
+}
+
+/*
+ h = f + g
+ Can overlap h with f or g.
+ */
+
+static inline void
+fe25519_add(fe25519 h, const fe25519 f, const fe25519 g)
+{
+    uint64_t h0 = f[0] + g[0];
+    uint64_t h1 = f[1] + g[1];
+    uint64_t h2 = f[2] + g[2];
+    uint64_t h3 = f[3] + g[3];
+    uint64_t h4 = f[4] + g[4];
+
+    h[0] = h0;
+    h[1] = h1;
+    h[2] = h2;
+    h[3] = h3;
+    h[4] = h4;
+}
+
+/*
+ h = f - g
+ */
+
+static void
+fe25519_sub(fe25519 h, const fe25519 f, const fe25519 g)
+{
+    const uint64_t mask = 0x7ffffffffffffULL;
+    uint64_t h0, h1, h2, h3, h4;
+
+    h0 = g[0];
+    h1 = g[1];
+    h2 = g[2];
+    h3 = g[3];
+    h4 = g[4];
+
+    h1 += h0 >> 51;
+    h0 &= mask;
+    h2 += h1 >> 51;
+    h1 &= mask;
+    h3 += h2 >> 51;
+    h2 &= mask;
+    h4 += h3 >> 51;
+    h3 &= mask;
+    h0 += 19ULL * (h4 >> 51);
+    h4 &= mask;
+
+    h0 = (f[0] + 0xfffffffffffdaULL) - h0;
+    h1 = (f[1] + 0xffffffffffffeULL) - h1;
+    h2 = (f[2] + 0xffffffffffffeULL) - h2;
+    h3 = (f[3] + 0xffffffffffffeULL) - h3;
+    h4 = (f[4] + 0xffffffffffffeULL) - h4;
+
+    h[0] = h0;
+    h[1] = h1;
+    h[2] = h2;
+    h[3] = h3;
+    h[4] = h4;
+}
+
+/*
+ h = -f
+ */
+
+static inline void
+fe25519_neg(fe25519 h, const fe25519 f)
+{
+    fe25519 zero;
+
+    fe25519_0(zero);
+    fe25519_sub(h, zero, f);
+}
+
+/*
+ Replace (f,g) with (g,g) if b == 1;
+ replace (f,g) with (f,g) if b == 0.
+ *
+ Preconditions: b in {0,1}.
+ */
+
+static void
+fe25519_cmov(fe25519 f, const fe25519 g, unsigned int b)
+{
+    const uint64_t mask = (uint64_t) (-(int64_t) b);
+
+    uint64_t f0 = f[0];
+    uint64_t f1 = f[1];
+    uint64_t f2 = f[2];
+    uint64_t f3 = f[3];
+    uint64_t f4 = f[4];
+
+    uint64_t x0 = f0 ^ g[0];
+    uint64_t x1 = f1 ^ g[1];
+    uint64_t x2 = f2 ^ g[2];
+    uint64_t x3 = f3 ^ g[3];
+    uint64_t x4 = f4 ^ g[4];
+
+    x0 &= mask;
+    x1 &= mask;
+    x2 &= mask;
+    x3 &= mask;
+    x4 &= mask;
+
+    f[0] = f0 ^ x0;
+    f[1] = f1 ^ x1;
+    f[2] = f2 ^ x2;
+    f[3] = f3 ^ x3;
+    f[4] = f4 ^ x4;
+}
+
+/*
+Replace (f,g) with (g,f) if b == 1;
+replace (f,g) with (f,g) if b == 0.
+
+Preconditions: b in {0,1}.
+*/
+
+static void
+fe25519_cswap(fe25519 f, fe25519 g, unsigned int b)
+{
+    const uint64_t mask = (uint64_t) (-(int64_t) b);
+
+    uint64_t f0 = f[0];
+    uint64_t f1 = f[1];
+    uint64_t f2 = f[2];
+    uint64_t f3 = f[3];
+    uint64_t f4 = f[4];
+
+    uint64_t g0 = g[0];
+    uint64_t g1 = g[1];
+    uint64_t g2 = g[2];
+    uint64_t g3 = g[3];
+    uint64_t g4 = g[4];
+
+    uint64_t x0 = f0 ^ g0;
+    uint64_t x1 = f1 ^ g1;
+    uint64_t x2 = f2 ^ g2;
+    uint64_t x3 = f3 ^ g3;
+    uint64_t x4 = f4 ^ g4;
+
+    x0 &= mask;
+    x1 &= mask;
+    x2 &= mask;
+    x3 &= mask;
+    x4 &= mask;
+
+    f[0] = f0 ^ x0;
+    f[1] = f1 ^ x1;
+    f[2] = f2 ^ x2;
+    f[3] = f3 ^ x3;
+    f[4] = f4 ^ x4;
+
+    g[0] = g0 ^ x0;
+    g[1] = g1 ^ x1;
+    g[2] = g2 ^ x2;
+    g[3] = g3 ^ x3;
+    g[4] = g4 ^ x4;
+}
+
+/*
+ h = f
+ */
+
+static inline void
+fe25519_copy(fe25519 h, const fe25519 f)
+{
+    memcpy(h, f, 5 * sizeof h[0]);
+}
+
+/*
+ return 1 if f is in {1,3,5,...,q-2}
+ return 0 if f is in {0,2,4,...,q-1}
+ */
+
+static inline int
+fe25519_isnegative(const fe25519 f)
+{
+    unsigned char s[32];
+
+    fe25519_tobytes(s, f);
+
+    return s[0] & 1;
+}
+
+/*
+ return 1 if f == 0
+ return 0 if f != 0
+ */
+
+static inline int
+fe25519_iszero(const fe25519 f)
+{
+    unsigned char s[32];
+
+    fe25519_tobytes(s, f);
+
+    return sodium_is_zero(s, 32);
+}
+
+/*
+ h = f * g
+ Can overlap h with f or g.
+ */
+
+static void
+fe25519_mul(fe25519 h, const fe25519 f, const fe25519 g)
+{
+    const uint64_t mask = 0x7ffffffffffffULL;
+    uint128_t r0, r1, r2, r3, r4, carry;
+    uint64_t  f0, f1, f2, f3, f4;
+    uint64_t  f1_19, f2_19, f3_19, f4_19;
+    uint64_t  g0, g1, g2, g3, g4;
+    uint64_t  r00, r01, r02, r03, r04;
+
+    f0 = f[0];
+    f1 = f[1];
+    f2 = f[2];
+    f3 = f[3];
+    f4 = f[4];
+
+    g0 = g[0];
+    g1 = g[1];
+    g2 = g[2];
+    g3 = g[3];
+    g4 = g[4];
+
+    f1_19 = 19ULL * f1;
+    f2_19 = 19ULL * f2;
+    f3_19 = 19ULL * f3;
+    f4_19 = 19ULL * f4;
+
+    r0  = ((uint128_t) f0   ) * ((uint128_t) g0);
+    r0 += ((uint128_t) f1_19) * ((uint128_t) g4);
+    r0 += ((uint128_t) f2_19) * ((uint128_t) g3);
+    r0 += ((uint128_t) f3_19) * ((uint128_t) g2);
+    r0 += ((uint128_t) f4_19) * ((uint128_t) g1);
+
+    r1  = ((uint128_t) f0   ) * ((uint128_t) g1);
+    r1 += ((uint128_t) f1   ) * ((uint128_t) g0);
+    r1 += ((uint128_t) f2_19) * ((uint128_t) g4);
+    r1 += ((uint128_t) f3_19) * ((uint128_t) g3);
+    r1 += ((uint128_t) f4_19) * ((uint128_t) g2);
+
+    r2  = ((uint128_t) f0   ) * ((uint128_t) g2);
+    r2 += ((uint128_t) f1   ) * ((uint128_t) g1);
+    r2 += ((uint128_t) f2   ) * ((uint128_t) g0);
+    r2 += ((uint128_t) f3_19) * ((uint128_t) g4);
+    r2 += ((uint128_t) f4_19) * ((uint128_t) g3);
+
+    r3  = ((uint128_t) f0   ) * ((uint128_t) g3);
+    r3 += ((uint128_t) f1   ) * ((uint128_t) g2);
+    r3 += ((uint128_t) f2   ) * ((uint128_t) g1);
+    r3 += ((uint128_t) f3   ) * ((uint128_t) g0);
+    r3 += ((uint128_t) f4_19) * ((uint128_t) g4);
+
+    r4  = ((uint128_t) f0   ) * ((uint128_t) g4);
+    r4 += ((uint128_t) f1   ) * ((uint128_t) g3);
+    r4 += ((uint128_t) f2   ) * ((uint128_t) g2);
+    r4 += ((uint128_t) f3   ) * ((uint128_t) g1);
+    r4 += ((uint128_t) f4   ) * ((uint128_t) g0);
+
+    r00    = ((uint64_t) r0) & mask;
+    carry  = r0 >> 51;
+    r1    += carry;
+    r01    = ((uint64_t) r1) & mask;
+    carry  = r1 >> 51;
+    r2    += carry;
+    r02    = ((uint64_t) r2) & mask;
+    carry  = r2 >> 51;
+    r3    += carry;
+    r03    = ((uint64_t) r3) & mask;
+    carry  = r3 >> 51;
+    r4    += carry;
+    r04    = ((uint64_t) r4) & mask;
+    carry  = r4 >> 51;
+    r00   += 19ULL * (uint64_t) carry;
+    carry  = r00 >> 51;
+    r00   &= mask;
+    r01   += (uint64_t) carry;
+    carry  = r01 >> 51;
+    r01   &= mask;
+    r02   += (uint64_t) carry;
+
+    h[0] = r00;
+    h[1] = r01;
+    h[2] = r02;
+    h[3] = r03;
+    h[4] = r04;
+}
+
+/*
+ h = f * f
+ Can overlap h with f.
+ */
+
+static void
+fe25519_sq(fe25519 h, const fe25519 f)
+{
+    const uint64_t mask = 0x7ffffffffffffULL;
+    uint128_t r0, r1, r2, r3, r4, carry;
+    uint64_t  f0, f1, f2, f3, f4;
+    uint64_t  f0_2, f1_2, f1_38, f2_38, f3_38, f3_19, f4_19;
+    uint64_t  r00, r01, r02, r03, r04;
+
+    f0 = f[0];
+    f1 = f[1];
+    f2 = f[2];
+    f3 = f[3];
+    f4 = f[4];
+
+    f0_2 = f0 << 1;
+    f1_2 = f1 << 1;
+
+    f1_38 = 38ULL * f1;
+    f2_38 = 38ULL * f2;
+    f3_38 = 38ULL * f3;
+
+    f3_19 = 19ULL * f3;
+    f4_19 = 19ULL * f4;
+
+    r0  = ((uint128_t) f0   ) * ((uint128_t) f0);
+    r0 += ((uint128_t) f1_38) * ((uint128_t) f4);
+    r0 += ((uint128_t) f2_38) * ((uint128_t) f3);
+
+    r1  = ((uint128_t) f0_2 ) * ((uint128_t) f1);
+    r1 += ((uint128_t) f2_38) * ((uint128_t) f4);
+    r1 += ((uint128_t) f3_19) * ((uint128_t) f3);
+
+    r2  = ((uint128_t) f0_2 ) * ((uint128_t) f2);
+    r2 += ((uint128_t) f1   ) * ((uint128_t) f1);
+    r2 += ((uint128_t) f3_38) * ((uint128_t) f4);
+
+    r3  = ((uint128_t) f0_2 ) * ((uint128_t) f3);
+    r3 += ((uint128_t) f1_2 ) * ((uint128_t) f2);
+    r3 += ((uint128_t) f4_19) * ((uint128_t) f4);
+
+    r4  = ((uint128_t) f0_2 ) * ((uint128_t) f4);
+    r4 += ((uint128_t) f1_2 ) * ((uint128_t) f3);
+    r4 += ((uint128_t) f2   ) * ((uint128_t) f2);
+
+    r00    = ((uint64_t) r0) & mask;
+    carry  = r0 >> 51;
+    r1    += carry;
+    r01    = ((uint64_t) r1) & mask;
+    carry  = r1 >> 51;
+    r2    += carry;
+    r02    = ((uint64_t) r2) & mask;
+    carry  = r2 >> 51;
+    r3    += carry;
+    r03    = ((uint64_t) r3) & mask;
+    carry  = r3 >> 51;
+    r4    += carry;
+    r04    = ((uint64_t) r4) & mask;
+    carry  = r4 >> 51;
+    r00   += 19ULL * (uint64_t) carry;
+    carry  = r00 >> 51;
+    r00   &= mask;
+    r01   += (uint64_t) carry;
+    carry  = r01 >> 51;
+    r01   &= mask;
+    r02   += (uint64_t) carry;
+
+    h[0] = r00;
+    h[1] = r01;
+    h[2] = r02;
+    h[3] = r03;
+    h[4] = r04;
+}
+
+/*
+ h = 2 * f * f
+ Can overlap h with f.
+*/
+
+static void
+fe25519_sq2(fe25519 h, const fe25519 f)
+{
+    const uint64_t mask = 0x7ffffffffffffULL;
+    uint128_t r0, r1, r2, r3, r4, carry;
+    uint64_t  f0, f1, f2, f3, f4;
+    uint64_t  f0_2, f1_2, f1_38, f2_38, f3_38, f3_19, f4_19;
+    uint64_t  r00, r01, r02, r03, r04;
+
+    f0 = f[0];
+    f1 = f[1];
+    f2 = f[2];
+    f3 = f[3];
+    f4 = f[4];
+
+    f0_2 = f0 << 1;
+    f1_2 = f1 << 1;
+
+    f1_38 = 38ULL * f1;
+    f2_38 = 38ULL * f2;
+    f3_38 = 38ULL * f3;
+
+    f3_19 = 19ULL * f3;
+    f4_19 = 19ULL * f4;
+
+    r0  = ((uint128_t) f0   ) * ((uint128_t) f0);
+    r0 += ((uint128_t) f1_38) * ((uint128_t) f4);
+    r0 += ((uint128_t) f2_38) * ((uint128_t) f3);
+
+    r1  = ((uint128_t) f0_2 ) * ((uint128_t) f1);
+    r1 += ((uint128_t) f2_38) * ((uint128_t) f4);
+    r1 += ((uint128_t) f3_19) * ((uint128_t) f3);
+
+    r2  = ((uint128_t) f0_2 ) * ((uint128_t) f2);
+    r2 += ((uint128_t) f1   ) * ((uint128_t) f1);
+    r2 += ((uint128_t) f3_38) * ((uint128_t) f4);
+
+    r3  = ((uint128_t) f0_2 ) * ((uint128_t) f3);
+    r3 += ((uint128_t) f1_2 ) * ((uint128_t) f2);
+    r3 += ((uint128_t) f4_19) * ((uint128_t) f4);
+
+    r4  = ((uint128_t) f0_2 ) * ((uint128_t) f4);
+    r4 += ((uint128_t) f1_2 ) * ((uint128_t) f3);
+    r4 += ((uint128_t) f2   ) * ((uint128_t) f2);
+
+    r0 <<= 1;
+    r1 <<= 1;
+    r2 <<= 1;
+    r3 <<= 1;
+    r4 <<= 1;
+
+    r00    = ((uint64_t) r0) & mask;
+    carry  = r0 >> 51;
+    r1    += carry;
+    r01    = ((uint64_t) r1) & mask;
+    carry  = r1 >> 51;
+    r2    += carry;
+    r02    = ((uint64_t) r2) & mask;
+    carry  = r2 >> 51;
+    r3    += carry;
+    r03    = ((uint64_t) r3) & mask;
+    carry  = r3 >> 51;
+    r4    += carry;
+    r04    = ((uint64_t) r4) & mask;
+    carry  = r4 >> 51;
+    r00   += 19ULL * (uint64_t) carry;
+    carry  = r00 >> 51;
+    r00   &= mask;
+    r01   += (uint64_t) carry;
+    carry  = r01 >> 51;
+    r01   &= mask;
+    r02   += (uint64_t) carry;
+
+    h[0] = r00;
+    h[1] = r01;
+    h[2] = r02;
+    h[3] = r03;
+    h[4] = r04;
+}
+
+static inline void
+fe25519_mul32(fe25519 h, const fe25519 f, uint32_t n)
+{
+    const uint64_t mask = 0x7ffffffffffffULL;
+    uint128_t a;
+    uint128_t sn = (uint128_t) n;
+    uint64_t  h0, h1, h2, h3, h4;
+
+    a  = f[0] * sn;
+    h0 = ((uint64_t) a) & mask;
+    a  = f[1] * sn + ((uint64_t) (a >> 51));
+    h1 = ((uint64_t) a) & mask;
+    a  = f[2] * sn + ((uint64_t) (a >> 51));
+    h2 = ((uint64_t) a) & mask;
+    a  = f[3] * sn + ((uint64_t) (a >> 51));
+    h3 = ((uint64_t) a) & mask;
+    a  = f[4] * sn + ((uint64_t) (a >> 51));
+    h4 = ((uint64_t) a) & mask;
+
+    h0 += (a >> 51) * 19ULL;
+
+    h[0] = h0;
+    h[1] = h1;
+    h[2] = h2;
+    h[3] = h3;
+    h[4] = h4;
+}
diff --git a/vendor/external/libsodium/include/sodium/private/implementations.h b/vendor/external/libsodium/include/sodium/private/implementations.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/private/implementations.h
@@ -0,0 +1,13 @@
+#ifndef implementations_H
+#define implementations_H
+
+int _crypto_generichash_blake2b_pick_best_implementation(void);
+int _crypto_onetimeauth_poly1305_pick_best_implementation(void);
+int _crypto_pwhash_argon2_pick_best_implementation(void);
+int _crypto_scalarmult_curve25519_pick_best_implementation(void);
+int _crypto_stream_chacha20_pick_best_implementation(void);
+int _crypto_stream_salsa20_pick_best_implementation(void);
+int _crypto_aead_aegis128l_pick_best_implementation(void);
+int _crypto_aead_aegis256_pick_best_implementation(void);
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/private/mutex.h b/vendor/external/libsodium/include/sodium/private/mutex.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/private/mutex.h
@@ -0,0 +1,7 @@
+#ifndef mutex_H
+#define mutex_H 1
+
+extern int sodium_crit_enter(void);
+extern int sodium_crit_leave(void);
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/private/softaes.h b/vendor/external/libsodium/include/sodium/private/softaes.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/private/softaes.h
@@ -0,0 +1,56 @@
+#ifndef softaes_H
+#define softaes_H 1
+
+#include <stdint.h>
+
+#include "private/common.h"
+
+typedef struct SoftAesBlock {
+    uint32_t w0;
+    uint32_t w1;
+    uint32_t w2;
+    uint32_t w3;
+} SoftAesBlock;
+
+SoftAesBlock softaes_block_encrypt(const SoftAesBlock block, const SoftAesBlock rk);
+
+static inline SoftAesBlock
+softaes_block_load(const uint8_t in[16])
+{
+    const SoftAesBlock out = { LOAD32_LE(in + 0), LOAD32_LE(in + 4), LOAD32_LE(in + 8),
+                               LOAD32_LE(in + 12) };
+    return out;
+}
+
+static inline SoftAesBlock
+softaes_block_load64x2(const uint64_t a, const uint64_t b)
+{
+    const SoftAesBlock out = { (uint32_t) b, (uint32_t) (b >> 32), (uint32_t) a,
+                               (uint32_t) (a >> 32) };
+    return out;
+}
+
+static inline void
+softaes_block_store(uint8_t out[16], const SoftAesBlock in)
+{
+    STORE32_LE(out + 0, in.w0);
+    STORE32_LE(out + 4, in.w1);
+    STORE32_LE(out + 8, in.w2);
+    STORE32_LE(out + 12, in.w3);
+}
+
+static inline SoftAesBlock
+softaes_block_xor(const SoftAesBlock a, const SoftAesBlock b)
+{
+    const SoftAesBlock out = { a.w0 ^ b.w0, a.w1 ^ b.w1, a.w2 ^ b.w2, a.w3 ^ b.w3 };
+    return out;
+}
+
+static inline SoftAesBlock
+softaes_block_and(const SoftAesBlock a, const SoftAesBlock b)
+{
+    const SoftAesBlock out = { a.w0 & b.w0, a.w1 & b.w1, a.w2 & b.w2, a.w3 & b.w3 };
+    return out;
+}
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/private/sse2_64_32.h b/vendor/external/libsodium/include/sodium/private/sse2_64_32.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/private/sse2_64_32.h
@@ -0,0 +1,50 @@
+#ifndef sse2_64_32_H
+#define sse2_64_32_H 1
+
+#include "private/common.h"
+
+#ifdef HAVE_INTRIN_H
+# include <intrin.h>
+#endif
+
+#if defined(HAVE_EMMINTRIN_H) && \
+    !(defined(__amd64) || defined(__amd64__) || defined(__x86_64__) || \
+      defined(_M_X64) || defined(_M_AMD64))
+
+# include <emmintrin.h>
+# include <stdint.h>
+
+# ifndef _mm_set_epi64x
+#  define _mm_set_epi64x(Q0, Q1) sodium__mm_set_epi64x((Q0), (Q1))
+static inline __m128i
+sodium__mm_set_epi64x(int64_t q1, int64_t q0)
+{
+    union { int64_t as64; int32_t as32[2]; } x0, x1;
+    x0.as64 = q0; x1.as64 = q1;
+    return _mm_set_epi32(x1.as32[1], x1.as32[0], x0.as32[1], x0.as32[0]);
+}
+# endif
+
+# ifndef _mm_set1_epi64x
+#  define _mm_set1_epi64x(Q) sodium__mm_set1_epi64x(Q)
+static inline __m128i
+sodium__mm_set1_epi64x(int64_t q)
+{
+    return _mm_set_epi64x(q, q);
+}
+# endif
+
+# ifndef _mm_cvtsi64_si128
+#  define _mm_cvtsi64_si128(Q) sodium__mm_cvtsi64_si128(Q)
+static inline __m128i
+sodium__mm_cvtsi64_si128(int64_t q)
+{
+    union { int64_t as64; int32_t as32[2]; } x;
+    x.as64 = q;
+    return _mm_setr_epi32(x.as32[0], x.as32[1], 0, 0);
+}
+# endif
+
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/randombytes.h b/vendor/external/libsodium/include/sodium/randombytes.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/randombytes.h
@@ -0,0 +1,72 @@
+
+#ifndef randombytes_H
+#define randombytes_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <sys/types.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+# ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+extern "C" {
+#endif
+
+typedef struct randombytes_implementation {
+    const char *(*implementation_name)(void); /* required */
+    uint32_t    (*random)(void);              /* required */
+    void        (*stir)(void);                /* optional */
+    uint32_t    (*uniform)(const uint32_t upper_bound); /* optional, a default implementation will be used if NULL */
+    void        (*buf)(void * const buf, const size_t size); /* required */
+    int         (*close)(void);               /* optional */
+} randombytes_implementation;
+
+#define randombytes_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 0xffffffffUL)
+
+#define randombytes_SEEDBYTES 32U
+SODIUM_EXPORT
+size_t randombytes_seedbytes(void);
+
+SODIUM_EXPORT
+void randombytes_buf(void * const buf, const size_t size)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+void randombytes_buf_deterministic(void * const buf, const size_t size,
+                                   const unsigned char seed[randombytes_SEEDBYTES])
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+uint32_t randombytes_random(void);
+
+SODIUM_EXPORT
+uint32_t randombytes_uniform(const uint32_t upper_bound);
+
+SODIUM_EXPORT
+void randombytes_stir(void);
+
+SODIUM_EXPORT
+int randombytes_close(void);
+
+SODIUM_EXPORT
+int randombytes_set_implementation(const randombytes_implementation *impl)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+const char *randombytes_implementation_name(void);
+
+/* -- NaCl compatibility interface -- */
+
+SODIUM_EXPORT
+void randombytes(unsigned char * const buf, const unsigned long long buf_len)
+            __attribute__ ((nonnull));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/randombytes_internal_random.h b/vendor/external/libsodium/include/sodium/randombytes_internal_random.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/randombytes_internal_random.h
@@ -0,0 +1,22 @@
+
+#ifndef randombytes_internal_random_H
+#define randombytes_internal_random_H
+
+#include "export.h"
+#include "randombytes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+extern struct randombytes_implementation randombytes_internal_implementation;
+
+/* Backwards compatibility with libsodium < 1.0.18 */
+#define randombytes_salsa20_implementation randombytes_internal_implementation
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/randombytes_sysrandom.h b/vendor/external/libsodium/include/sodium/randombytes_sysrandom.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/randombytes_sysrandom.h
@@ -0,0 +1,19 @@
+
+#ifndef randombytes_sysrandom_H
+#define randombytes_sysrandom_H
+
+#include "export.h"
+#include "randombytes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+extern struct randombytes_implementation randombytes_sysrandom_implementation;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/runtime.h b/vendor/external/libsodium/include/sodium/runtime.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/runtime.h
@@ -0,0 +1,55 @@
+
+#ifndef sodium_runtime_H
+#define sodium_runtime_H
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_neon(void);
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_armcrypto(void);
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_sse2(void);
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_sse3(void);
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_ssse3(void);
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_sse41(void);
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_avx(void);
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_avx2(void);
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_avx512f(void);
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_pclmul(void);
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_aesni(void);
+
+SODIUM_EXPORT_WEAK
+int sodium_runtime_has_rdrand(void);
+
+/* ------------------------------------------------------------------------- */
+
+int _sodium_runtime_get_cpu_features(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/utils.h b/vendor/external/libsodium/include/sodium/utils.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/utils.h
@@ -0,0 +1,179 @@
+
+#ifndef sodium_utils_H
+#define sodium_utils_H
+
+#include <stddef.h>
+
+#include "export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SODIUM_C99
+# if defined(__cplusplus) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
+#  define SODIUM_C99(X)
+# else
+#  define SODIUM_C99(X) X
+# endif
+#endif
+
+SODIUM_EXPORT
+void sodium_memzero(void * const pnt, const size_t len);
+
+SODIUM_EXPORT
+void sodium_stackzero(const size_t len);
+
+/*
+ * WARNING: sodium_memcmp() must be used to verify if two secret keys
+ * are equal, in constant time.
+ * It returns 0 if the keys are equal, and -1 if they differ.
+ * This function is not designed for lexicographical comparisons.
+ */
+SODIUM_EXPORT
+int sodium_memcmp(const void * const b1_, const void * const b2_, size_t len)
+            __attribute__ ((warn_unused_result));
+
+/*
+ * sodium_compare() returns -1 if b1_ < b2_, 1 if b1_ > b2_ and 0 if b1_ == b2_
+ * It is suitable for lexicographical comparisons, or to compare nonces
+ * and counters stored in little-endian format.
+ * However, it is slower than sodium_memcmp().
+ */
+SODIUM_EXPORT
+int sodium_compare(const unsigned char *b1_, const unsigned char *b2_,
+                   size_t len) __attribute__ ((warn_unused_result));
+
+SODIUM_EXPORT
+int sodium_is_zero(const unsigned char *n, const size_t nlen);
+
+SODIUM_EXPORT
+void sodium_increment(unsigned char *n, const size_t nlen);
+
+SODIUM_EXPORT
+void sodium_add(unsigned char *a, const unsigned char *b, const size_t len);
+
+SODIUM_EXPORT
+void sodium_sub(unsigned char *a, const unsigned char *b, const size_t len);
+
+SODIUM_EXPORT
+char *sodium_bin2hex(char * const hex, const size_t hex_maxlen,
+                     const unsigned char * const bin, const size_t bin_len)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int sodium_hex2bin(unsigned char * const bin, const size_t bin_maxlen,
+                   const char * const hex, const size_t hex_len,
+                   const char * const ignore, size_t * const bin_len,
+                   const char ** const hex_end)
+            __attribute__ ((nonnull(1)));
+
+#define sodium_base64_VARIANT_ORIGINAL            1
+#define sodium_base64_VARIANT_ORIGINAL_NO_PADDING 3
+#define sodium_base64_VARIANT_URLSAFE             5
+#define sodium_base64_VARIANT_URLSAFE_NO_PADDING  7
+
+/*
+ * Computes the required length to encode BIN_LEN bytes as a base64 string
+ * using the given variant. The computed length includes a trailing \0.
+ */
+#define sodium_base64_ENCODED_LEN(BIN_LEN, VARIANT) \
+    (((BIN_LEN) / 3U) * 4U + \
+    ((((BIN_LEN) - ((BIN_LEN) / 3U) * 3U) | (((BIN_LEN) - ((BIN_LEN) / 3U) * 3U) >> 1)) & 1U) * \
+     (4U - (~((((VARIANT) & 2U) >> 1) - 1U) & (3U - ((BIN_LEN) - ((BIN_LEN) / 3U) * 3U)))) + 1U)
+
+SODIUM_EXPORT
+size_t sodium_base64_encoded_len(const size_t bin_len, const int variant);
+
+SODIUM_EXPORT
+char *sodium_bin2base64(char * const b64, const size_t b64_maxlen,
+                        const unsigned char * const bin, const size_t bin_len,
+                        const int variant) __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen,
+                      const char * const b64, const size_t b64_len,
+                      const char * const ignore, size_t * const bin_len,
+                      const char ** const b64_end, const int variant)
+            __attribute__ ((nonnull(1)));
+
+SODIUM_EXPORT
+int sodium_mlock(void * const addr, const size_t len)
+            __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int sodium_munlock(void * const addr, const size_t len)
+            __attribute__ ((nonnull));
+
+/* WARNING: sodium_malloc() and sodium_allocarray() are not general-purpose
+ * allocation functions.
+ *
+ * They return a pointer to a region filled with 0xd0 bytes, immediately
+ * followed by a guard page.
+ * As a result, accessing a single byte after the requested allocation size
+ * will intentionally trigger a segmentation fault.
+ *
+ * A canary and an additional guard page placed before the beginning of the
+ * region may also kill the process if a buffer underflow is detected.
+ *
+ * The memory layout is:
+ * [unprotected region size (read only)][guard page (no access)][unprotected pages (read/write)][guard page (no access)]
+ * With the layout of the unprotected pages being:
+ * [optional padding][16-bytes canary][user region]
+ *
+ * However:
+ * - These functions are significantly slower than standard functions
+ * - Each allocation requires 3 or 4 additional pages
+ * - The returned address will not be aligned if the allocation size is not
+ *   a multiple of the required alignment. For this reason, these functions
+ *   are designed to store data, such as secret keys and messages.
+ *
+ * sodium_malloc() can be used to allocate any libsodium data structure.
+ *
+ * The crypto_generichash_state structure is packed and its length is
+ * either 357 or 361 bytes. For this reason, when using sodium_malloc() to
+ * allocate a crypto_generichash_state structure, padding must be added in
+ * order to ensure proper alignment. crypto_generichash_statebytes()
+ * returns the rounded up structure size, and should be preferred to sizeof():
+ * state = sodium_malloc(crypto_generichash_statebytes());
+ */
+
+SODIUM_EXPORT
+void *sodium_malloc(const size_t size)
+            __attribute__ ((malloc));
+
+SODIUM_EXPORT
+void *sodium_allocarray(size_t count, size_t size)
+            __attribute__ ((malloc));
+
+SODIUM_EXPORT
+void sodium_free(void *ptr);
+
+SODIUM_EXPORT
+int sodium_mprotect_noaccess(void *ptr) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int sodium_mprotect_readonly(void *ptr) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int sodium_mprotect_readwrite(void *ptr) __attribute__ ((nonnull));
+
+SODIUM_EXPORT
+int sodium_pad(size_t *padded_buflen_p, unsigned char *buf,
+               size_t unpadded_buflen, size_t blocksize, size_t max_buflen)
+            __attribute__ ((nonnull(2)));
+
+SODIUM_EXPORT
+int sodium_unpad(size_t *unpadded_buflen_p, const unsigned char *buf,
+                 size_t padded_buflen, size_t blocksize)
+            __attribute__ ((nonnull(2)));
+
+/* -------- */
+
+int _sodium_alloc_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/include/sodium/version.h b/vendor/external/libsodium/include/sodium/version.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/include/sodium/version.h
@@ -0,0 +1,33 @@
+
+#ifndef sodium_version_H
+#define sodium_version_H
+
+#include "export.h"
+
+#define SODIUM_VERSION_STRING "1.0.19"
+
+#define SODIUM_LIBRARY_VERSION_MAJOR 26
+#define SODIUM_LIBRARY_VERSION_MINOR 1
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SODIUM_EXPORT
+const char *sodium_version_string(void);
+
+SODIUM_EXPORT
+int         sodium_library_version_major(void);
+
+SODIUM_EXPORT
+int         sodium_library_version_minor(void);
+
+SODIUM_EXPORT
+int         sodium_library_minimal(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/vendor/external/libsodium/randombytes/internal/randombytes_internal_random.c b/vendor/external/libsodium/randombytes/internal/randombytes_internal_random.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/randombytes/internal/randombytes_internal_random.c
@@ -0,0 +1,635 @@
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdlib.h>
+#include <string.h>
+#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+# include <unistd.h>
+#endif
+
+#include <sys/types.h>
+#ifndef _WIN32
+# include <sys/stat.h>
+# include <sys/time.h>
+#endif
+#ifdef __linux__
+# define _LINUX_SOURCE
+#endif
+#ifdef HAVE_SYS_RANDOM_H
+# include <sys/random.h>
+#endif
+#ifdef __linux__
+# ifdef HAVE_GETRANDOM
+#  define HAVE_LINUX_COMPATIBLE_GETRANDOM
+# else
+#  include <sys/syscall.h>
+#  if defined(SYS_getrandom) && defined(__NR_getrandom)
+#   define getrandom(B, S, F) syscall(SYS_getrandom, (B), (int) (S), (F))
+#   define HAVE_LINUX_COMPATIBLE_GETRANDOM
+#  endif
+# endif
+#elif defined(__FreeBSD__)
+# include <sys/param.h>
+# if defined(__FreeBSD_version) && __FreeBSD_version >= 1200000
+#  define HAVE_LINUX_COMPATIBLE_GETRANDOM
+# endif
+#endif
+#if !defined(NO_BLOCKING_RANDOM_POLL) && defined(__linux__)
+# define BLOCK_ON_DEV_RANDOM
+#endif
+#ifdef BLOCK_ON_DEV_RANDOM
+# include <poll.h>
+#endif
+#ifdef HAVE_RDRAND
+# pragma GCC target("rdrnd")
+# include <immintrin.h>
+#endif
+
+#include "core.h"
+#include "crypto_core_hchacha20.h"
+#include "crypto_stream_chacha20.h"
+#include "private/common.h"
+#include "randombytes.h"
+#include "randombytes_internal_random.h"
+#include "runtime.h"
+#include "utils.h"
+
+#ifdef _WIN32
+# include <windows.h>
+# include <sys/timeb.h>
+# define RtlGenRandom SystemFunction036
+# if defined(__cplusplus)
+extern "C"
+# endif
+BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
+# pragma comment(lib, "advapi32.lib")
+# ifdef __BORLANDC__
+#  define _ftime ftime
+#  define _timeb timeb
+# endif
+#endif
+
+#define INTERNAL_RANDOM_BLOCK_SIZE crypto_core_hchacha20_OUTPUTBYTES
+
+#if defined(__OpenBSD__) || defined(__CloudABI__) || defined(__wasi__)
+# define HAVE_SAFE_ARC4RANDOM 1
+#endif
+#if defined(__CloudABI__) || defined(__wasm__)
+# define NONEXISTENT_DEV_RANDOM 1
+#endif
+
+#ifndef SSIZE_MAX
+# define SSIZE_MAX (SIZE_MAX / 2 - 1)
+#endif
+#ifndef S_ISNAM
+# ifdef __COMPCERT__
+#  define S_ISNAM(X) 1
+# else
+#  define S_ISNAM(X) 0
+# endif
+#endif
+
+#if !defined(TLS) && !defined(__STDC_NO_THREADS__) && \
+    defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+# define TLS _Thread_local
+#endif
+#ifndef TLS
+# ifdef _WIN32
+#  define TLS __declspec(thread)
+# else
+#  define TLS
+# endif
+#endif
+
+typedef struct InternalRandomGlobal_ {
+    int           initialized;
+    int           random_data_source_fd;
+    int           getentropy_available;
+    int           getrandom_available;
+    int           rdrand_available;
+#ifdef HAVE_GETPID
+    pid_t         pid;
+#endif
+} InternalRandomGlobal;
+
+typedef struct InternalRandom_ {
+    int           initialized;
+    size_t        rnd32_outleft;
+    unsigned char key[crypto_stream_chacha20_KEYBYTES];
+    unsigned char rnd32[16U * INTERNAL_RANDOM_BLOCK_SIZE];
+    uint64_t      nonce;
+} InternalRandom;
+
+static InternalRandomGlobal global = {
+    SODIUM_C99(.initialized =) 0,
+    SODIUM_C99(.random_data_source_fd =) -1
+};
+
+static TLS InternalRandom stream = {
+    SODIUM_C99(.initialized =) 0,
+    SODIUM_C99(.rnd32_outleft =) (size_t) 0U
+};
+
+
+/*
+ * Get a high-resolution timestamp, as a uint64_t value
+ */
+
+#ifdef _WIN32
+static uint64_t
+sodium_hrtime(void)
+{
+    struct _timeb tb;
+# pragma warning(push)
+# pragma warning(disable: 4996)
+    _ftime(&tb);
+# pragma warning(pop)
+    return ((uint64_t) tb.time) * 1000000U + ((uint64_t) tb.millitm) * 1000U;
+}
+
+#else /* _WIN32 */
+
+static uint64_t
+sodium_hrtime(void)
+{
+    struct timeval tv;
+
+    if (gettimeofday(&tv, NULL) != 0) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+    return ((uint64_t) tv.tv_sec) * 1000000U + (uint64_t) tv.tv_usec;
+}
+#endif /* _WIN32 */
+
+/*
+ * Initialize the entropy source
+ */
+
+#ifdef _WIN32
+
+static void
+randombytes_internal_random_init(void)
+{
+    global.rdrand_available = sodium_runtime_has_rdrand();
+}
+
+#else /* _WIN32 */
+
+# ifdef HAVE_GETENTROPY
+static int
+_randombytes_getentropy(void * const buf, const size_t size)
+{
+    assert(size <= 256U);
+    if (getentropy(buf, size) != 0) {
+        return -1; /* LCOV_EXCL_LINE */
+    }
+    return 0;
+}
+
+static int
+randombytes_getentropy(void * const buf_, size_t size)
+{
+    unsigned char *buf = (unsigned char *) buf_;
+    size_t         chunk_size = 256U;
+
+    do {
+        if (size < chunk_size) {
+            chunk_size = size;
+            assert(chunk_size > (size_t) 0U);
+        }
+        if (_randombytes_getentropy(buf, chunk_size) != 0) {
+            return -1; /* LCOV_EXCL_LINE */
+        }
+        size -= chunk_size;
+        buf += chunk_size;
+    } while (size > (size_t) 0U);
+
+    return 0;
+}
+
+# elif defined(HAVE_LINUX_COMPATIBLE_GETRANDOM)
+
+static int
+_randombytes_linux_getrandom(void * const buf, const size_t size)
+{
+    int readnb;
+
+    assert(size <= 256U);
+    do {
+        readnb = getrandom(buf, size, 0);
+    } while (readnb < 0 && (errno == EINTR || errno == EAGAIN));
+
+    return (readnb == (int) size) - 1;
+}
+
+static int
+randombytes_linux_getrandom(void * const buf_, size_t size)
+{
+    unsigned char *buf = (unsigned char *) buf_;
+    size_t         chunk_size = 256U;
+
+    do {
+        if (size < chunk_size) {
+            chunk_size = size;
+            assert(chunk_size > (size_t) 0U);
+        }
+        if (_randombytes_linux_getrandom(buf, chunk_size) != 0) {
+            return -1;
+        }
+        size -= chunk_size;
+        buf += chunk_size;
+    } while (size > (size_t) 0U);
+
+    return 0;
+}
+# endif
+
+# ifndef NONEXISTENT_DEV_RANDOM
+
+#  ifdef BLOCK_ON_DEV_RANDOM
+static int
+randombytes_block_on_dev_random(void)
+{
+    struct pollfd pfd;
+    int           fd;
+    int           pret;
+
+    fd = open("/dev/random", O_RDONLY);
+    if (fd == -1) {
+        return 0;
+    }
+    pfd.fd = fd;
+    pfd.events = POLLIN;
+    pfd.revents = 0;
+    do {
+        pret = poll(&pfd, 1, -1);
+    } while (pret < 0 && (errno == EINTR || errno == EAGAIN));
+    if (pret != 1) {
+        (void) close(fd);
+        errno = EIO;
+        return -1;
+    }
+    return close(fd);
+}
+#  endif
+
+/* LCOV_EXCL_START */
+static int
+randombytes_internal_random_random_dev_open(void)
+{
+    struct stat       st;
+    static const char *devices[] = {
+#  ifndef USE_BLOCKING_RANDOM
+        "/dev/urandom",
+#  endif
+        "/dev/random", NULL
+    };
+    const char      **device = devices;
+    int               fd;
+
+#  ifdef BLOCK_ON_DEV_RANDOM
+    if (randombytes_block_on_dev_random() != 0) {
+        return -1;
+    }
+#  endif
+    do {
+        fd = open(*device, O_RDONLY);
+        if (fd != -1) {
+            if (fstat(fd, &st) == 0 && (S_ISNAM(st.st_mode) || S_ISCHR(st.st_mode))) {
+#  if defined(F_SETFD) && defined(FD_CLOEXEC)
+                (void) fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+#  endif
+                return fd;
+            }
+            (void) close(fd);
+        } else if (errno == EINTR) {
+            continue;
+        }
+        device++;
+    } while (*device != NULL);
+
+    errno = EIO;
+    return -1;
+}
+/* LCOV_EXCL_STOP */
+
+static ssize_t
+safe_read(const int fd, void * const buf_, size_t size)
+{
+    unsigned char *buf = (unsigned char *) buf_;
+    ssize_t        readnb;
+
+    assert(size > (size_t) 0U);
+    assert(size <= SSIZE_MAX);
+    do {
+        while ((readnb = read(fd, buf, size)) < (ssize_t) 0 &&
+               (errno == EINTR || errno == EAGAIN)); /* LCOV_EXCL_LINE */
+        if (readnb < (ssize_t) 0) {
+            return readnb; /* LCOV_EXCL_LINE */
+        }
+        if (readnb == (ssize_t) 0) {
+            break; /* LCOV_EXCL_LINE */
+        }
+        size -= (size_t) readnb;
+        buf += readnb;
+    } while (size > (ssize_t) 0);
+
+    return (ssize_t) (buf - (unsigned char *) buf_);
+}
+
+# endif /* !NONEXISTENT_DEV_RANDOM */
+
+static void
+randombytes_internal_random_init(void)
+{
+    const int errno_save = errno;
+
+    global.rdrand_available = sodium_runtime_has_rdrand();
+    global.getentropy_available = 0;
+    global.getrandom_available = 0;
+
+# ifdef HAVE_GETENTROPY
+    {
+        unsigned char fodder[16];
+
+        if (randombytes_getentropy(fodder, sizeof fodder) == 0) {
+            global.getentropy_available = 1;
+            errno = errno_save;
+            return;
+        }
+    }
+# elif defined(HAVE_LINUX_COMPATIBLE_GETRANDOM)
+    {
+        unsigned char fodder[16];
+
+        if (randombytes_linux_getrandom(fodder, sizeof fodder) == 0) {
+            global.getrandom_available = 1;
+            errno = errno_save;
+            return;
+        }
+    }
+# endif
+/* LCOV_EXCL_START */
+# if !defined(NONEXISTENT_DEV_RANDOM)
+    assert((global.getentropy_available | global.getrandom_available) == 0);
+    if ((global.random_data_source_fd =
+         randombytes_internal_random_random_dev_open()) == -1) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+    errno = errno_save;
+    return;
+# endif
+/* LCOV_EXCL_STOP */
+# ifndef HAVE_SAFE_ARC4RANDOM
+    sodium_misuse();
+# endif
+}
+
+#endif /* _WIN32 */
+
+/*
+ * (Re)seed the generator using the entropy source
+ */
+
+static void
+randombytes_internal_random_stir(void)
+{
+    stream.nonce = sodium_hrtime();
+    assert(stream.nonce != (uint64_t) 0U);
+    memset(stream.rnd32, 0, sizeof stream.rnd32);
+    stream.rnd32_outleft = (size_t) 0U;
+    if (global.initialized == 0) {
+        randombytes_internal_random_init();
+        global.initialized = 1;
+    }
+#ifdef HAVE_GETPID
+    global.pid = getpid();
+#endif
+
+#ifndef _WIN32
+
+# ifdef HAVE_GETENTROPY
+     if (global.getentropy_available != 0) {
+         if (randombytes_getentropy(stream.key, sizeof stream.key) != 0) {
+             sodium_misuse(); /* LCOV_EXCL_LINE */
+         }
+     }
+# elif defined(HAVE_LINUX_COMPATIBLE_GETRANDOM)
+     if (global.getrandom_available != 0) {
+         if (randombytes_linux_getrandom(stream.key, sizeof stream.key) != 0) {
+             sodium_misuse(); /* LCOV_EXCL_LINE */
+         }
+     }
+# elif defined(NONEXISTENT_DEV_RANDOM) && defined(HAVE_SAFE_ARC4RANDOM)
+    arc4random_buf(stream.key, sizeof stream.key);
+# elif !defined(NONEXISTENT_DEV_RANDOM)
+    if (global.random_data_source_fd == -1 ||
+        safe_read(global.random_data_source_fd, stream.key,
+                  sizeof stream.key) != (ssize_t) sizeof stream.key) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+# else
+    sodium_misuse();
+# endif
+
+#else /* _WIN32 */
+    if (! RtlGenRandom((PVOID) stream.key, (ULONG) sizeof stream.key)) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+#endif
+
+    stream.initialized = 1;
+}
+
+/*
+ * Reseed the generator if it hasn't been initialized yet
+ */
+
+static void
+randombytes_internal_random_stir_if_needed(void)
+{
+#ifdef HAVE_GETPID
+    if (stream.initialized == 0) {
+        randombytes_internal_random_stir();
+    } else if (global.pid != getpid()) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+#else
+    if (stream.initialized == 0) {
+        randombytes_internal_random_stir();
+    }
+#endif
+}
+
+/*
+ * Close the stream, free global resources
+ */
+
+#ifdef _WIN32
+static int
+randombytes_internal_random_close(void)
+{
+    int ret = -1;
+
+    if (global.initialized != 0) {
+        global.initialized = 0;
+        ret = 0;
+    }
+    sodium_memzero(&stream, sizeof stream);
+
+    return ret;
+}
+#else
+static int
+randombytes_internal_random_close(void)
+{
+    int ret = -1;
+
+# ifdef HAVE_GETENTROPY
+    if (global.getentropy_available != 0) {
+        ret = 0;
+    }
+# elif defined(HAVE_LINUX_COMPATIBLE_GETRANDOM)
+    if (global.getrandom_available != 0) {
+        ret = 0;
+    }
+# elif !defined(NONEXISTENT_DEV_RANDOM) && defined(HAVE_SAFE_ARC4RANDOM)
+    ret = 0;
+# else
+    if (global.random_data_source_fd != -1 &&
+        close(global.random_data_source_fd) == 0) {
+        global.random_data_source_fd = -1;
+        global.initialized = 0;
+# ifdef HAVE_GETPID
+        global.pid = (pid_t) 0;
+# endif
+        ret = 0;
+    }
+# endif
+
+    sodium_memzero(&stream, sizeof stream);
+
+    return ret;
+}
+#endif
+
+/*
+ * RDRAND is only used to mitigate prediction if a key is compromised
+ */
+
+static void
+randombytes_internal_random_xorhwrand(void)
+{
+/* LCOV_EXCL_START */
+#ifdef HAVE_RDRAND
+    unsigned int r;
+
+    if (global.rdrand_available == 0) {
+        return;
+    }
+    (void) _rdrand32_step(&r);
+    * (uint32_t *) (void *)
+        &stream.key[crypto_stream_chacha20_KEYBYTES - 4] ^= (uint32_t) r;
+#endif
+/* LCOV_EXCL_STOP */
+}
+
+/*
+ * XOR the key with another same-length secret
+ */
+
+static inline void
+randombytes_internal_random_xorkey(const unsigned char * const mix)
+{
+    unsigned char *key = stream.key;
+    size_t         i;
+
+    for (i = (size_t) 0U; i < sizeof stream.key; i++) {
+        key[i] ^= mix[i];
+    }
+}
+
+/*
+ * Put `size` random bytes into `buf` and overwrite the key
+ */
+
+static void
+randombytes_internal_random_buf(void * const buf, const size_t size)
+{
+    size_t i;
+    int    ret;
+
+    randombytes_internal_random_stir_if_needed();
+    COMPILER_ASSERT(sizeof stream.nonce == crypto_stream_chacha20_NONCEBYTES);
+#if defined(ULLONG_MAX) && defined(SIZE_MAX)
+# if SIZE_MAX > ULLONG_MAX
+    /* coverity[result_independent_of_operands] */
+    assert(size <= ULLONG_MAX);
+# endif
+#endif
+    ret = crypto_stream_chacha20((unsigned char *) buf, (unsigned long long) size,
+                                 (unsigned char *) &stream.nonce, stream.key);
+    assert(ret == 0);
+    for (i = 0U; i < sizeof size; i++) {
+        stream.key[i] ^= ((const unsigned char *) (const void *) &size)[i];
+    }
+    randombytes_internal_random_xorhwrand();
+    stream.nonce++;
+    crypto_stream_chacha20_xor(stream.key, stream.key, sizeof stream.key,
+                               (unsigned char *) &stream.nonce, stream.key);
+}
+
+/*
+ * Pop a 32-bit value from the random pool
+ *
+ * Overwrite the key after the pool gets refilled.
+ */
+
+static uint32_t
+randombytes_internal_random(void)
+{
+    uint32_t val;
+    int      ret;
+
+    COMPILER_ASSERT(sizeof stream.rnd32 >= (sizeof stream.key) + (sizeof val));
+    COMPILER_ASSERT(((sizeof stream.rnd32) - (sizeof stream.key))
+                    % sizeof val == (size_t) 0U);
+    if (stream.rnd32_outleft <= (size_t) 0U) {
+        randombytes_internal_random_stir_if_needed();
+        COMPILER_ASSERT(sizeof stream.nonce == crypto_stream_chacha20_NONCEBYTES);
+        ret = crypto_stream_chacha20((unsigned char *) stream.rnd32,
+                                     (unsigned long long) sizeof stream.rnd32,
+                                     (unsigned char *) &stream.nonce,
+                                     stream.key);
+        assert(ret == 0);
+        stream.rnd32_outleft = (sizeof stream.rnd32) - (sizeof stream.key);
+        randombytes_internal_random_xorhwrand();
+        randombytes_internal_random_xorkey(&stream.rnd32[stream.rnd32_outleft]);
+        memset(&stream.rnd32[stream.rnd32_outleft], 0, sizeof stream.key);
+        stream.nonce++;
+    }
+    stream.rnd32_outleft -= sizeof val;
+    memcpy(&val, &stream.rnd32[stream.rnd32_outleft], sizeof val);
+    memset(&stream.rnd32[stream.rnd32_outleft], 0, sizeof val);
+
+    return val;
+}
+
+static const char *
+randombytes_internal_implementation_name(void)
+{
+    return "internal";
+}
+
+struct randombytes_implementation randombytes_internal_implementation = {
+    SODIUM_C99(.implementation_name =) randombytes_internal_implementation_name,
+    SODIUM_C99(.random =) randombytes_internal_random,
+    SODIUM_C99(.stir =) randombytes_internal_random_stir,
+    SODIUM_C99(.uniform =) NULL,
+    SODIUM_C99(.buf =) randombytes_internal_random_buf,
+    SODIUM_C99(.close =) randombytes_internal_random_close
+};
diff --git a/vendor/external/libsodium/randombytes/randombytes.c b/vendor/external/libsodium/randombytes/randombytes.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/randombytes/randombytes.c
@@ -0,0 +1,199 @@
+
+#include <assert.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <sys/types.h>
+
+#ifdef __EMSCRIPTEN__
+# include <emscripten.h>
+#endif
+
+#include "core.h"
+#include "crypto_stream_chacha20.h"
+#include "randombytes.h"
+#ifndef RANDOMBYTES_CUSTOM_IMPLEMENTATION
+# ifdef RANDOMBYTES_DEFAULT_IMPLEMENTATION
+#  include "randombytes_internal.h"
+# endif
+# include "randombytes_sysrandom.h"
+#endif
+#include "private/common.h"
+
+/* C++Builder defines a "random" macro */
+#undef random
+
+static const randombytes_implementation *implementation;
+
+#ifndef RANDOMBYTES_DEFAULT_IMPLEMENTATION
+# ifdef __EMSCRIPTEN__
+#  define RANDOMBYTES_DEFAULT_IMPLEMENTATION NULL
+# else
+#  define RANDOMBYTES_DEFAULT_IMPLEMENTATION &randombytes_sysrandom_implementation;
+# endif
+#endif
+
+static void
+randombytes_init_if_needed(void)
+{
+    if (implementation == NULL) {
+        implementation = RANDOMBYTES_DEFAULT_IMPLEMENTATION;
+        randombytes_stir();
+    }
+}
+
+int
+randombytes_set_implementation(const randombytes_implementation *impl)
+{
+    implementation = impl;
+
+    return 0;
+}
+
+const char *
+randombytes_implementation_name(void)
+{
+#ifndef __EMSCRIPTEN__
+    randombytes_init_if_needed();
+    return implementation->implementation_name();
+#else
+    return "js";
+#endif
+}
+
+uint32_t
+randombytes_random(void)
+{
+#ifndef __EMSCRIPTEN__
+    randombytes_init_if_needed();
+    return implementation->random();
+#else
+    return EM_ASM_INT_V({
+        return Module.getRandomValue();
+    });
+#endif
+}
+
+void
+randombytes_stir(void)
+{
+#ifndef __EMSCRIPTEN__
+    randombytes_init_if_needed();
+    if (implementation->stir != NULL) {
+        implementation->stir();
+    }
+#else
+    EM_ASM({
+        if (Module.getRandomValue === undefined) {
+            try {
+                var window_ = 'object' === typeof window ? window : self;
+                var crypto_ = typeof window_.crypto !== 'undefined' ? window_.crypto : window_.msCrypto;
+                var randomValuesStandard = function() {
+                    var buf = new Uint32Array(1);
+                    crypto_.getRandomValues(buf);
+                    return buf[0] >>> 0;
+                };
+                randomValuesStandard();
+                Module.getRandomValue = randomValuesStandard;
+            } catch (e) {
+                try {
+                    var crypto = require('crypto');
+                    var randomValueNodeJS = function() {
+                        var buf = crypto['randomBytes'](4);
+                        return (buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]) >>> 0;
+                    };
+                    randomValueNodeJS();
+                    Module.getRandomValue = randomValueNodeJS;
+                } catch (e) {
+                    throw 'No secure random number generator found';
+                }
+            }
+        }
+    });
+#endif
+}
+
+uint32_t
+randombytes_uniform(const uint32_t upper_bound)
+{
+    uint32_t min;
+    uint32_t r;
+
+#ifndef __EMSCRIPTEN__
+    randombytes_init_if_needed();
+    if (implementation->uniform != NULL) {
+        return implementation->uniform(upper_bound);
+    }
+#endif
+    if (upper_bound < 2) {
+        return 0;
+    }
+    min = (1U + ~upper_bound) % upper_bound; /* = 2**32 mod upper_bound */
+    do {
+        r = randombytes_random();
+    } while (r < min);
+    /* r is now clamped to a set whose size mod upper_bound == 0
+     * the worst case (2**31+1) requires ~ 2 attempts */
+
+    return r % upper_bound;
+}
+
+void
+randombytes_buf(void * const buf, const size_t size)
+{
+#ifndef __EMSCRIPTEN__
+    randombytes_init_if_needed();
+    if (size > (size_t) 0U) {
+        implementation->buf(buf, size);
+    }
+#else
+    unsigned char *p = (unsigned char *) buf;
+    size_t         i;
+
+    for (i = (size_t) 0U; i < size; i++) {
+        p[i] = (unsigned char) randombytes_random();
+    }
+#endif
+}
+
+void
+randombytes_buf_deterministic(void * const buf, const size_t size,
+                              const unsigned char seed[randombytes_SEEDBYTES])
+{
+    static const unsigned char nonce[crypto_stream_chacha20_ietf_NONCEBYTES] = {
+        'L', 'i', 'b', 's', 'o', 'd', 'i', 'u', 'm', 'D', 'R', 'G'
+    };
+
+    COMPILER_ASSERT(randombytes_SEEDBYTES == crypto_stream_chacha20_ietf_KEYBYTES);
+#if SIZE_MAX > 0x4000000000ULL
+    COMPILER_ASSERT(randombytes_BYTES_MAX <= 0x4000000000ULL);
+    if (size > 0x4000000000ULL) {
+        sodium_misuse();
+    }
+#endif
+    crypto_stream_chacha20_ietf((unsigned char *) buf, (unsigned long long) size,
+                                nonce, seed);
+}
+
+size_t
+randombytes_seedbytes(void)
+{
+    return randombytes_SEEDBYTES;
+}
+
+int
+randombytes_close(void)
+{
+    if (implementation != NULL && implementation->close != NULL) {
+        return implementation->close();
+    }
+    return 0;
+}
+
+void
+randombytes(unsigned char * const buf, const unsigned long long buf_len)
+{
+    assert(buf_len <= SIZE_MAX);
+    randombytes_buf(buf, (size_t) buf_len);
+}
diff --git a/vendor/external/libsodium/randombytes/sysrandom/randombytes_sysrandom.c b/vendor/external/libsodium/randombytes/sysrandom/randombytes_sysrandom.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/randombytes/sysrandom/randombytes_sysrandom.c
@@ -0,0 +1,396 @@
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
+#include <string.h>
+#ifndef _WIN32
+# include <unistd.h>
+#endif
+#include <stdlib.h>
+
+#include <sys/types.h>
+#ifndef _WIN32
+# include <sys/stat.h>
+# include <sys/time.h>
+#endif
+#ifdef __linux__
+# define _LINUX_SOURCE
+#endif
+#ifdef HAVE_SYS_RANDOM_H
+# include <sys/random.h>
+#endif
+#ifdef __linux__
+# ifdef HAVE_GETRANDOM
+#  define HAVE_LINUX_COMPATIBLE_GETRANDOM
+# else
+#  include <sys/syscall.h>
+#  if defined(SYS_getrandom) && defined(__NR_getrandom)
+#   define getrandom(B, S, F) syscall(SYS_getrandom, (B), (int) (S), (F))
+#   define HAVE_LINUX_COMPATIBLE_GETRANDOM
+#  endif
+# endif
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
+# include <sys/param.h>
+# if (defined(__FreeBSD_version) && __FreeBSD_version >= 1200000) || \
+     (defined(__DragonFly_version) && __DragonFly_version >= 500700)
+#  define HAVE_LINUX_COMPATIBLE_GETRANDOM
+# endif
+#endif
+#if !defined(NO_BLOCKING_RANDOM_POLL) && defined(__linux__)
+# define BLOCK_ON_DEV_RANDOM
+#endif
+#ifdef BLOCK_ON_DEV_RANDOM
+# include <poll.h>
+#endif
+
+#include "core.h"
+#include "private/common.h"
+#include "randombytes.h"
+#include "randombytes_sysrandom.h"
+#include "utils.h"
+
+#ifdef _WIN32
+/* `RtlGenRandom` is used over `CryptGenRandom` on Microsoft Windows based systems:
+ *  - `CryptGenRandom` requires pulling in `CryptoAPI` which causes unnecessary
+ *     memory overhead if this API is not being used for other purposes
+ *  - `RtlGenRandom` is thus called directly instead. A detailed explanation
+ *     can be found here: https://blogs.msdn.microsoft.com/michael_howard/2005/01/14/cryptographically-secure-random-number-on-windows-without-using-cryptoapi/
+ *
+ * In spite of the disclaimer on the `RtlGenRandom` documentation page that was
+ * written back in the Windows XP days, this function is here to stay. The CRT
+ * function `rand_s()` directly depends on it, so touching it would break many
+ * applications released since Windows XP.
+ *
+ * Also note that Rust, Firefox and BoringSSL (thus, Google Chrome and everything
+ * based on Chromium) also depend on it, and that libsodium allows the RNG to be
+ * replaced without patching nor recompiling the library.
+ */
+# include <windows.h>
+# define RtlGenRandom SystemFunction036
+# if defined(__cplusplus)
+extern "C"
+# endif
+BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
+# pragma comment(lib, "advapi32.lib")
+#endif
+
+#if defined(__OpenBSD__) || defined(__CloudABI__) || defined(__wasi__)
+# define HAVE_SAFE_ARC4RANDOM 1
+#endif
+
+#ifndef SSIZE_MAX
+# define SSIZE_MAX (SIZE_MAX / 2 - 1)
+#endif
+
+#ifdef HAVE_SAFE_ARC4RANDOM
+
+static uint32_t
+randombytes_sysrandom(void)
+{
+    return arc4random();
+}
+
+static void
+randombytes_sysrandom_stir(void)
+{
+}
+
+static void
+randombytes_sysrandom_buf(void * const buf, const size_t size)
+{
+    arc4random_buf(buf, size);
+}
+
+static int
+randombytes_sysrandom_close(void)
+{
+    return 0;
+}
+
+#else /* HAVE_SAFE_ARC4RANDOM */
+
+typedef struct SysRandom_ {
+    int random_data_source_fd;
+    int initialized;
+    int getrandom_available;
+} SysRandom;
+
+static SysRandom stream = {
+    SODIUM_C99(.random_data_source_fd =) -1,
+    SODIUM_C99(.initialized =) 0,
+    SODIUM_C99(.getrandom_available =) 0
+};
+
+# ifndef _WIN32
+static ssize_t
+safe_read(const int fd, void * const buf_, size_t size)
+{
+    unsigned char *buf = (unsigned char *) buf_;
+    ssize_t        readnb;
+
+    assert(size > (size_t) 0U);
+    assert(size <= SSIZE_MAX);
+    do {
+        while ((readnb = read(fd, buf, size)) < (ssize_t) 0 &&
+               (errno == EINTR || errno == EAGAIN)); /* LCOV_EXCL_LINE */
+        if (readnb < (ssize_t) 0) {
+            return readnb; /* LCOV_EXCL_LINE */
+        }
+        if (readnb == (ssize_t) 0) {
+            break; /* LCOV_EXCL_LINE */
+        }
+        size -= (size_t) readnb;
+        buf += readnb;
+    } while (size > (ssize_t) 0);
+
+    return (ssize_t) (buf - (unsigned char *) buf_);
+}
+
+#  ifdef BLOCK_ON_DEV_RANDOM
+static int
+randombytes_block_on_dev_random(void)
+{
+    struct pollfd pfd;
+    int           fd;
+    int           pret;
+
+    fd = open("/dev/random", O_RDONLY);
+    if (fd == -1) {
+        return 0;
+    }
+    pfd.fd = fd;
+    pfd.events = POLLIN;
+    pfd.revents = 0;
+    do {
+        pret = poll(&pfd, 1, -1);
+    } while (pret < 0 && (errno == EINTR || errno == EAGAIN));
+    if (pret != 1) {
+        (void) close(fd);
+        errno = EIO;
+        return -1;
+    }
+    return close(fd);
+}
+#  endif /* BLOCK_ON_DEV_RANDOM */
+
+static int
+randombytes_sysrandom_random_dev_open(void)
+{
+/* LCOV_EXCL_START */
+    struct stat        st;
+    static const char *devices[] = {
+#  ifndef USE_BLOCKING_RANDOM
+        "/dev/urandom",
+#  endif
+        "/dev/random", NULL
+    };
+    const char       **device = devices;
+    int                fd;
+
+#  ifdef BLOCK_ON_DEV_RANDOM
+    if (randombytes_block_on_dev_random() != 0) {
+        return -1;
+    }
+#  endif
+    do {
+        fd = open(*device, O_RDONLY);
+        if (fd != -1) {
+            if (fstat(fd, &st) == 0 &&
+#  ifdef __COMPCERT__
+                1
+#  elif defined(S_ISNAM)
+                (S_ISNAM(st.st_mode) || S_ISCHR(st.st_mode))
+#  else
+                S_ISCHR(st.st_mode)
+#  endif
+               ) {
+#  if defined(F_SETFD) && defined(FD_CLOEXEC)
+                (void) fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+#  endif
+                return fd;
+            }
+            (void) close(fd);
+        } else if (errno == EINTR) {
+            continue;
+        }
+        device++;
+    } while (*device != NULL);
+
+    errno = EIO;
+    return -1;
+/* LCOV_EXCL_STOP */
+}
+
+#  ifdef HAVE_LINUX_COMPATIBLE_GETRANDOM
+static int
+_randombytes_linux_getrandom(void * const buf, const size_t size)
+{
+    int readnb;
+
+    assert(size <= 256U);
+    do {
+        readnb = getrandom(buf, size, 0);
+    } while (readnb < 0 && (errno == EINTR || errno == EAGAIN));
+
+    return (readnb == (int) size) - 1;
+}
+
+static int
+randombytes_linux_getrandom(void * const buf_, size_t size)
+{
+    unsigned char *buf = (unsigned char *) buf_;
+    size_t         chunk_size = 256U;
+
+    do {
+        if (size < chunk_size) {
+            chunk_size = size;
+            assert(chunk_size > (size_t) 0U);
+        }
+        if (_randombytes_linux_getrandom(buf, chunk_size) != 0) {
+            return -1;
+        }
+        size -= chunk_size;
+        buf += chunk_size;
+    } while (size > (size_t) 0U);
+
+    return 0;
+}
+#  endif /* HAVE_LINUX_COMPATIBLE_GETRANDOM */
+
+static void
+randombytes_sysrandom_init(void)
+{
+    const int     errno_save = errno;
+
+#  ifdef HAVE_LINUX_COMPATIBLE_GETRANDOM
+    {
+        unsigned char fodder[16];
+
+        if (randombytes_linux_getrandom(fodder, sizeof fodder) == 0) {
+            stream.getrandom_available = 1;
+            errno = errno_save;
+            return;
+        }
+        stream.getrandom_available = 0;
+    }
+#  endif
+
+    if ((stream.random_data_source_fd =
+         randombytes_sysrandom_random_dev_open()) == -1) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+    errno = errno_save;
+}
+
+# else /* _WIN32 */
+
+static void
+randombytes_sysrandom_init(void)
+{
+}
+# endif /* _WIN32 */
+
+static void
+randombytes_sysrandom_stir(void)
+{
+    if (stream.initialized == 0) {
+        randombytes_sysrandom_init();
+        stream.initialized = 1;
+    }
+}
+
+static void
+randombytes_sysrandom_stir_if_needed(void)
+{
+    if (stream.initialized == 0) {
+        randombytes_sysrandom_stir();
+    }
+}
+
+static int
+randombytes_sysrandom_close(void)
+{
+    int ret = -1;
+
+# ifndef _WIN32
+    if (stream.random_data_source_fd != -1 &&
+        close(stream.random_data_source_fd) == 0) {
+        stream.random_data_source_fd = -1;
+        stream.initialized = 0;
+        ret = 0;
+    }
+#  ifdef HAVE_LINUX_COMPATIBLE_GETRANDOM
+    if (stream.getrandom_available != 0) {
+        ret = 0;
+    }
+#  endif
+# else /* _WIN32 */
+    if (stream.initialized != 0) {
+        stream.initialized = 0;
+        ret = 0;
+    }
+# endif /* _WIN32 */
+    return ret;
+}
+
+static void
+randombytes_sysrandom_buf(void * const buf, const size_t size)
+{
+    randombytes_sysrandom_stir_if_needed();
+# if defined(ULLONG_MAX) && defined(SIZE_MAX)
+#  if SIZE_MAX > ULLONG_MAX
+    /* coverity[result_independent_of_operands] */
+    assert(size <= ULLONG_MAX);
+#  endif
+# endif
+# ifndef _WIN32
+#  ifdef HAVE_LINUX_COMPATIBLE_GETRANDOM
+    if (stream.getrandom_available != 0) {
+        if (randombytes_linux_getrandom(buf, size) != 0) {
+            sodium_misuse(); /* LCOV_EXCL_LINE */
+        }
+        return;
+    }
+#  endif
+    if (stream.random_data_source_fd == -1 ||
+        safe_read(stream.random_data_source_fd, buf, size) != (ssize_t) size) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+# else /* _WIN32 */
+    COMPILER_ASSERT(randombytes_BYTES_MAX <= 0xffffffffUL);
+    if (size > (size_t) 0xffffffffUL) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+    if (! RtlGenRandom((PVOID) buf, (ULONG) size)) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+# endif /* _WIN32 */
+}
+
+static uint32_t
+randombytes_sysrandom(void)
+{
+    uint32_t r;
+
+    randombytes_sysrandom_buf(&r, sizeof r);
+
+    return r;
+}
+
+#endif /* HAVE_SAFE_ARC4RANDOM */
+
+static const char *
+randombytes_sysrandom_implementation_name(void)
+{
+    return "sysrandom";
+}
+
+struct randombytes_implementation randombytes_sysrandom_implementation = {
+    SODIUM_C99(.implementation_name =) randombytes_sysrandom_implementation_name,
+    SODIUM_C99(.random =) randombytes_sysrandom,
+    SODIUM_C99(.stir =) randombytes_sysrandom_stir,
+    SODIUM_C99(.uniform =) NULL,
+    SODIUM_C99(.buf =) randombytes_sysrandom_buf,
+    SODIUM_C99(.close =) randombytes_sysrandom_close
+};
diff --git a/vendor/external/libsodium/sodium/codecs.c b/vendor/external/libsodium/sodium/codecs.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/sodium/codecs.c
@@ -0,0 +1,335 @@
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "core.h"
+#include "private/common.h"
+#include "utils.h"
+
+/* Derived from original code by CodesInChaos */
+char *
+sodium_bin2hex(char *const hex, const size_t hex_maxlen,
+               const unsigned char *const bin, const size_t bin_len)
+{
+    size_t       i = (size_t) 0U;
+    unsigned int x;
+    int          b;
+    int          c;
+
+    if (bin_len >= SIZE_MAX / 2 || hex_maxlen <= bin_len * 2U) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+    while (i < bin_len) {
+        c = bin[i] & 0xf;
+        b = bin[i] >> 4;
+        x = (unsigned char) (87U + c + (((c - 10U) >> 8) & ~38U)) << 8 |
+            (unsigned char) (87U + b + (((b - 10U) >> 8) & ~38U));
+        hex[i * 2U] = (char) x;
+        x >>= 8;
+        hex[i * 2U + 1U] = (char) x;
+        i++;
+    }
+    hex[i * 2U] = 0U;
+
+    return hex;
+}
+
+int
+sodium_hex2bin(unsigned char *const bin, const size_t bin_maxlen,
+               const char *const hex, const size_t hex_len,
+               const char *const ignore, size_t *const bin_len,
+               const char **const hex_end)
+{
+    size_t        bin_pos = (size_t) 0U;
+    size_t        hex_pos = (size_t) 0U;
+    int           ret     = 0;
+    unsigned char c;
+    unsigned char c_acc = 0U;
+    unsigned char c_alpha0, c_alpha;
+    unsigned char c_num0, c_num;
+    unsigned char c_val;
+    unsigned char state = 0U;
+
+    while (hex_pos < hex_len) {
+        c        = (unsigned char) hex[hex_pos];
+        c_num    = c ^ 48U;
+        c_num0   = (c_num - 10U) >> 8;
+        c_alpha  = (c & ~32U) - 55U;
+        c_alpha0 = ((c_alpha - 10U) ^ (c_alpha - 16U)) >> 8;
+        if ((c_num0 | c_alpha0) == 0U) {
+            if (ignore != NULL && state == 0U && strchr(ignore, c) != NULL) {
+                hex_pos++;
+                continue;
+            }
+            break;
+        }
+        c_val = (c_num0 & c_num) | (c_alpha0 & c_alpha);
+        if (bin_pos >= bin_maxlen) {
+            ret   = -1;
+            errno = ERANGE;
+            break;
+        }
+        if (state == 0U) {
+            c_acc = c_val * 16U;
+        } else {
+            bin[bin_pos++] = c_acc | c_val;
+        }
+        state = ~state;
+        hex_pos++;
+    }
+    if (state != 0U) {
+        hex_pos--;
+        errno = EINVAL;
+        ret = -1;
+    }
+    if (ret != 0) {
+        bin_pos = (size_t) 0U;
+    }
+    if (hex_end != NULL) {
+        *hex_end = &hex[hex_pos];
+    } else if (hex_pos != hex_len) {
+        errno = EINVAL;
+        ret = -1;
+    }
+    if (bin_len != NULL) {
+        *bin_len = bin_pos;
+    }
+    return ret;
+}
+
+/*
+ * Some macros for constant-time comparisons. These work over values in
+ * the 0..255 range. Returned value is 0x00 on "false", 0xFF on "true".
+ *
+ * Original code by Thomas Pornin.
+ */
+#define EQ(x, y) \
+    ((((0U - ((unsigned int) (x) ^ (unsigned int) (y))) >> 8) & 0xFF) ^ 0xFF)
+#define GT(x, y) ((((unsigned int) (y) - (unsigned int) (x)) >> 8) & 0xFF)
+#define GE(x, y) (GT(y, x) ^ 0xFF)
+#define LT(x, y) GT(y, x)
+#define LE(x, y) GE(y, x)
+
+static int
+b64_byte_to_char(unsigned int x)
+{
+    return (LT(x, 26) & (x + 'A')) |
+           (GE(x, 26) & LT(x, 52) & (x + ('a' - 26))) |
+           (GE(x, 52) & LT(x, 62) & (x + ('0' - 52))) | (EQ(x, 62) & '+') |
+           (EQ(x, 63) & '/');
+}
+
+static unsigned int
+b64_char_to_byte(int c)
+{
+    const unsigned int x =
+        (GE(c, 'A') & LE(c, 'Z') & (c - 'A')) |
+        (GE(c, 'a') & LE(c, 'z') & (c - ('a' - 26))) |
+        (GE(c, '0') & LE(c, '9') & (c - ('0' - 52))) | (EQ(c, '+') & 62) |
+        (EQ(c, '/') & 63);
+
+    return x | (EQ(x, 0) & (EQ(c, 'A') ^ 0xFF));
+}
+
+static int
+b64_byte_to_urlsafe_char(unsigned int x)
+{
+    return (LT(x, 26) & (x + 'A')) |
+           (GE(x, 26) & LT(x, 52) & (x + ('a' - 26))) |
+           (GE(x, 52) & LT(x, 62) & (x + ('0' - 52))) | (EQ(x, 62) & '-') |
+           (EQ(x, 63) & '_');
+}
+
+static unsigned int
+b64_urlsafe_char_to_byte(int c)
+{
+    const unsigned x =
+        (GE(c, 'A') & LE(c, 'Z') & (c - 'A')) |
+        (GE(c, 'a') & LE(c, 'z') & (c - ('a' - 26))) |
+        (GE(c, '0') & LE(c, '9') & (c - ('0' - 52))) | (EQ(c, '-') & 62) |
+        (EQ(c, '_') & 63);
+
+    return x | (EQ(x, 0) & (EQ(c, 'A') ^ 0xFF));
+}
+
+
+#define VARIANT_NO_PADDING_MASK 0x2U
+#define VARIANT_URLSAFE_MASK    0x4U
+
+static void
+sodium_base64_check_variant(const int variant)
+{
+    if ((((unsigned int) variant) & ~ 0x6U) != 0x1U) {
+        sodium_misuse();
+    }
+}
+
+size_t
+sodium_base64_encoded_len(const size_t bin_len, const int variant)
+{
+    sodium_base64_check_variant(variant);
+
+    return sodium_base64_ENCODED_LEN(bin_len, variant);
+}
+
+char *
+sodium_bin2base64(char * const b64, const size_t b64_maxlen,
+                  const unsigned char * const bin, const size_t bin_len,
+                  const int variant)
+{
+    size_t       acc_len = (size_t) 0;
+    size_t       b64_len;
+    size_t       b64_pos = (size_t) 0;
+    size_t       bin_pos = (size_t) 0;
+    size_t       nibbles;
+    size_t       remainder;
+    unsigned int acc = 0U;
+
+    sodium_base64_check_variant(variant);
+    nibbles = bin_len / 3;
+    remainder = bin_len - 3 * nibbles;
+    b64_len = nibbles * 4;
+    if (remainder != 0) {
+        if ((((unsigned int) variant) & VARIANT_NO_PADDING_MASK) == 0U) {
+            b64_len += 4;
+        } else {
+            b64_len += 2 + (remainder >> 1);
+        }
+    }
+    if (b64_maxlen <= b64_len) {
+        sodium_misuse();
+    }
+    if ((((unsigned int) variant) & VARIANT_URLSAFE_MASK) != 0U) {
+        while (bin_pos < bin_len) {
+            acc = (acc << 8) + bin[bin_pos++];
+            acc_len += 8;
+            while (acc_len >= 6) {
+                acc_len -= 6;
+                b64[b64_pos++] = (char) b64_byte_to_urlsafe_char((acc >> acc_len) & 0x3F);
+            }
+        }
+        if (acc_len > 0) {
+            b64[b64_pos++] = (char) b64_byte_to_urlsafe_char((acc << (6 - acc_len)) & 0x3F);
+        }
+    } else {
+        while (bin_pos < bin_len) {
+            acc = (acc << 8) + bin[bin_pos++];
+            acc_len += 8;
+            while (acc_len >= 6) {
+                acc_len -= 6;
+                b64[b64_pos++] = (char) b64_byte_to_char((acc >> acc_len) & 0x3F);
+            }
+        }
+        if (acc_len > 0) {
+            b64[b64_pos++] = (char) b64_byte_to_char((acc << (6 - acc_len)) & 0x3F);
+        }
+    }
+    assert(b64_pos <= b64_len);
+    while (b64_pos < b64_len) {
+        b64[b64_pos++] = '=';
+    }
+    do {
+        b64[b64_pos++] = 0U;
+    } while (b64_pos < b64_maxlen);
+
+    return b64;
+}
+
+static int
+_sodium_base642bin_skip_padding(const char * const b64, const size_t b64_len,
+                                size_t * const b64_pos_p,
+                                const char * const ignore, size_t padding_len)
+{
+    int c;
+
+    while (padding_len > 0) {
+        if (*b64_pos_p >= b64_len) {
+            errno = ERANGE;
+            return -1;
+        }
+        ACQUIRE_FENCE;
+        c = b64[*b64_pos_p];
+        if (c == '=') {
+            padding_len--;
+        } else if (ignore == NULL || strchr(ignore, c) == NULL) {
+            errno = EINVAL;
+            return -1;
+        }
+        (*b64_pos_p)++;
+    }
+    return 0;
+}
+
+int
+sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen,
+                  const char * const b64, const size_t b64_len,
+                  const char * const ignore, size_t * const bin_len,
+                  const char ** const b64_end, const int variant)
+{
+    size_t       acc_len = (size_t) 0;
+    size_t       b64_pos = (size_t) 0;
+    size_t       bin_pos = (size_t) 0;
+    int          is_urlsafe;
+    int          ret = 0;
+    unsigned int acc = 0U;
+    unsigned int d;
+    char         c;
+
+    sodium_base64_check_variant(variant);
+    is_urlsafe = ((unsigned int) variant) & VARIANT_URLSAFE_MASK;
+    while (b64_pos < b64_len) {
+        c = b64[b64_pos];
+        if (is_urlsafe) {
+            d = b64_urlsafe_char_to_byte(c);
+        } else {
+            d = b64_char_to_byte(c);
+        }
+        if (d == 0xFF) {
+            if (ignore != NULL && strchr(ignore, c) != NULL) {
+                b64_pos++;
+                continue;
+            }
+            break;
+        }
+        acc = (acc << 6) + d;
+        acc_len += 6;
+        if (acc_len >= 8) {
+            acc_len -= 8;
+            if (bin_pos >= bin_maxlen) {
+                errno = ERANGE;
+                ret = -1;
+                break;
+            }
+            bin[bin_pos++] = (acc >> acc_len) & 0xFF;
+        }
+        b64_pos++;
+    }
+    if (acc_len > 4U || (acc & ((1U << acc_len) - 1U)) != 0U) {
+        ret = -1;
+    } else if (ret == 0 &&
+               (((unsigned int) variant) & VARIANT_NO_PADDING_MASK) == 0U) {
+        ret = _sodium_base642bin_skip_padding(b64, b64_len, &b64_pos, ignore,
+                                              acc_len / 2);
+    }
+    if (ret != 0) {
+        bin_pos = (size_t) 0U;
+    } else if (ignore != NULL) {
+        while (b64_pos < b64_len && strchr(ignore, b64[b64_pos]) != NULL) {
+            b64_pos++;
+        }
+    }
+    if (b64_end != NULL) {
+        *b64_end = &b64[b64_pos];
+    } else if (b64_pos != b64_len) {
+        errno = EINVAL;
+        ret = -1;
+    }
+    if (bin_len != NULL) {
+        *bin_len = bin_pos;
+    }
+    return ret;
+}
diff --git a/vendor/external/libsodium/sodium/core.c b/vendor/external/libsodium/sodium/core.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/sodium/core.c
@@ -0,0 +1,213 @@
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#ifdef _WIN32
+# include <windows.h>
+#elif defined(HAVE_PTHREAD)
+# include <pthread.h>
+#endif
+
+#include "core.h"
+#include "crypto_generichash.h"
+#include "crypto_onetimeauth.h"
+#include "crypto_scalarmult.h"
+#include "crypto_stream_chacha20.h"
+#include "crypto_stream_salsa20.h"
+#include "randombytes.h"
+#include "runtime.h"
+#include "utils.h"
+#include "private/implementations.h"
+#include "private/mutex.h"
+
+static volatile int initialized;
+static volatile int locked;
+
+int
+sodium_init(void)
+{
+    if (sodium_crit_enter() != 0) {
+        return -1; /* LCOV_EXCL_LINE */
+    }
+    if (initialized != 0) {
+        if (sodium_crit_leave() != 0) {
+            return -1; /* LCOV_EXCL_LINE */
+        }
+        return 1;
+    }
+    _sodium_runtime_get_cpu_features();
+    randombytes_stir();
+    _sodium_alloc_init();
+    _crypto_generichash_blake2b_pick_best_implementation();
+    _crypto_onetimeauth_poly1305_pick_best_implementation();
+    _crypto_scalarmult_curve25519_pick_best_implementation();
+    _crypto_stream_chacha20_pick_best_implementation();
+    initialized = 1;
+
+    if (sodium_crit_leave() != 0) {
+        return -1; /* LCOV_EXCL_LINE */
+    }
+    return 0;
+}
+
+#ifdef _WIN32
+
+static CRITICAL_SECTION _sodium_lock;
+static volatile LONG    _sodium_lock_initialized;
+
+static int
+_sodium_crit_init(void)
+{
+    LONG status = 0L;
+
+    while ((status = InterlockedCompareExchange(&_sodium_lock_initialized,
+                                                1L, 0L)) == 1L) {
+        Sleep(0);
+    }
+
+    switch (status) {
+    case 0L:
+        InitializeCriticalSection(&_sodium_lock);
+        return InterlockedExchange(&_sodium_lock_initialized, 2L) == 1L ? 0 : -1;
+    case 2L:
+        return 0;
+    default: /* should never be reached */
+        return -1;
+    }
+}
+
+int
+sodium_crit_enter(void)
+{
+    if (_sodium_crit_init() != 0) {
+        return -1; /* LCOV_EXCL_LINE */
+    }
+    EnterCriticalSection(&_sodium_lock);
+    assert(locked == 0);
+    locked = 1;
+
+    return 0;
+}
+
+int
+sodium_crit_leave(void)
+{
+    if (locked == 0) {
+# ifdef EPERM
+        errno = EPERM;
+# endif
+        return -1;
+    }
+    locked = 0;
+    LeaveCriticalSection(&_sodium_lock);
+
+    return 0;
+}
+
+#elif defined(HAVE_PTHREAD) && !defined(__EMSCRIPTEN__)
+
+static pthread_mutex_t _sodium_lock = PTHREAD_MUTEX_INITIALIZER;
+
+int
+sodium_crit_enter(void)
+{
+    int ret;
+
+    if ((ret = pthread_mutex_lock(&_sodium_lock)) == 0) {
+        assert(locked == 0);
+        locked = 1;
+    }
+    return ret;
+}
+
+int
+sodium_crit_leave(void)
+{
+    if (locked == 0) {
+# ifdef EPERM
+        errno = EPERM;
+# endif
+        return -1;
+    }
+    locked = 0;
+
+    return pthread_mutex_unlock(&_sodium_lock);
+}
+
+#elif defined(HAVE_ATOMIC_OPS) && !defined(__EMSCRIPTEN__)
+
+static volatile int _sodium_lock;
+
+int
+sodium_crit_enter(void)
+{
+# ifdef HAVE_NANOSLEEP
+    struct timespec q;
+    memset(&q, 0, sizeof q);
+# endif
+    while (__sync_lock_test_and_set(&_sodium_lock, 1) != 0) {
+# ifdef HAVE_NANOSLEEP
+        (void) nanosleep(&q, NULL);
+# elif defined(__x86_64__) || defined(__i386__)
+        __asm__ __volatile__ ("pause");
+# endif
+    }
+    return 0;
+}
+
+int
+sodium_crit_leave(void)
+{
+    __sync_lock_release(&_sodium_lock);
+
+    return 0;
+}
+
+#else
+
+int
+sodium_crit_enter(void)
+{
+    return 0;
+}
+
+int
+sodium_crit_leave(void)
+{
+    return 0;
+}
+
+#endif
+
+static void (*_misuse_handler)(void);
+
+void
+sodium_misuse(void)
+{
+    void (*handler)(void);
+
+    (void) sodium_crit_leave();
+    if (sodium_crit_enter() == 0) {
+        handler = _misuse_handler;
+        if (handler != NULL) {
+            handler();
+        }
+    }
+/* LCOV_EXCL_START */
+    abort();
+}
+/* LCOV_EXCL_STOP */
+
+int
+sodium_set_misuse_handler(void (*handler)(void))
+{
+    if (sodium_crit_enter() != 0) {
+        return -1; /* LCOV_EXCL_LINE */
+    }
+    _misuse_handler = handler;
+    if (sodium_crit_leave() != 0) {
+        return -1; /* LCOV_EXCL_LINE */
+    }
+    return 0;
+}
diff --git a/vendor/external/libsodium/sodium/runtime.c b/vendor/external/libsodium/sodium/runtime.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/sodium/runtime.c
@@ -0,0 +1,392 @@
+#include <stddef.h>
+#include <stdint.h>
+#ifdef HAVE_ANDROID_GETCPUFEATURES
+# include <cpu-features.h>
+#endif
+#ifdef __APPLE__
+# include <sys/types.h>
+# include <sys/sysctl.h>
+# include <mach/machine.h>
+#endif
+#ifdef HAVE_SYS_AUXV_H
+# include <sys/auxv.h>
+#endif
+
+#include "private/common.h"
+#include "runtime.h"
+
+typedef struct CPUFeatures_ {
+    int initialized;
+    int has_neon;
+    int has_armcrypto;
+    int has_sse2;
+    int has_sse3;
+    int has_ssse3;
+    int has_sse41;
+    int has_avx;
+    int has_avx2;
+    int has_avx512f;
+    int has_pclmul;
+    int has_aesni;
+    int has_rdrand;
+} CPUFeatures;
+
+static CPUFeatures _cpu_features;
+
+#define CPUID_EBX_AVX2    0x00000020
+#define CPUID_EBX_AVX512F 0x00010000
+
+#define CPUID_ECX_SSE3    0x00000001
+#define CPUID_ECX_PCLMUL  0x00000002
+#define CPUID_ECX_SSSE3   0x00000200
+#define CPUID_ECX_SSE41   0x00080000
+#define CPUID_ECX_AESNI   0x02000000
+#define CPUID_ECX_XSAVE   0x04000000
+#define CPUID_ECX_OSXSAVE 0x08000000
+#define CPUID_ECX_AVX     0x10000000
+#define CPUID_ECX_RDRAND  0x40000000
+
+#define CPUID_EDX_SSE2    0x04000000
+
+#define XCR0_SSE       0x00000002
+#define XCR0_AVX       0x00000004
+#define XCR0_OPMASK    0x00000020
+#define XCR0_ZMM_HI256 0x00000040
+#define XCR0_HI16_ZMM  0x00000080
+
+static int
+_sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
+{
+    cpu_features->has_neon = 0;
+    cpu_features->has_armcrypto = 0;
+
+#ifndef __ARM_ARCH
+    return -1; /* LCOV_EXCL_LINE */
+#endif
+
+#if defined(__ARM_NEON) || defined(__aarch64__) || defined(_M_ARM64)
+    cpu_features->has_neon = 1;
+#elif defined(HAVE_ANDROID_GETCPUFEATURES)
+    cpu_features->has_neon =
+        (android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_ASIMD) != 0x0;
+#elif (defined(__aarch64__) || defined(_M_ARM64)) && defined(AT_HWCAP)
+# ifdef HAVE_GETAUXVAL
+    cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 1)) != 0;
+# elif defined(HAVE_ELF_AUX_INFO)
+    {
+        unsigned long buf;
+        if (elf_aux_info(AT_HWCAP, (void *) &buf, (int) sizeof buf) == 0) {
+            cpu_features->has_neon = (buf & (1L << 1)) != 0;
+        }
+    }
+# endif
+#elif defined(__arm__) && defined(AT_HWCAP)
+# ifdef HAVE_GETAUXVAL
+    cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 12)) != 0;
+# elif defined(HAVE_ELF_AUX_INFO)
+    {
+        unsigned long buf;
+        if (elf_aux_info(AT_HWCAP, (void *) &buf, (int) sizeof buf) == 0) {
+            cpu_features->has_neon = (buf & (1L << 12)) != 0;
+        }
+    }
+# endif
+#endif
+
+    if (cpu_features->has_neon == 0) {
+        return 0;
+    }
+
+#if defined(__ARM_FEATURE_CRYPTO) && defined(__ARM_FEATURE_AES)
+    cpu_features->has_armcrypto = 1;
+#elif defined(_M_ARM64)
+    cpu_features->has_armcrypto = 1; /* assuming all CPUs supported by ARM Windows have the crypto extensions */
+#elif defined(__APPLE__) && defined(CPU_TYPE_ARM64) && defined(CPU_SUBTYPE_ARM64E)
+    {
+        cpu_type_t    cpu_type;
+        cpu_subtype_t cpu_subtype;
+        size_t        cpu_type_len = sizeof cpu_type;
+        size_t        cpu_subtype_len = sizeof cpu_subtype;
+
+        if (sysctlbyname("hw.cputype", &cpu_type, &cpu_type_len,
+                         NULL, 0) == 0 && cpu_type == CPU_TYPE_ARM64 &&
+            sysctlbyname("hw.cpusubtype", &cpu_subtype, &cpu_subtype_len,
+                         NULL, 0) == 0 &&
+            (cpu_subtype == CPU_SUBTYPE_ARM64E ||
+                cpu_subtype == CPU_SUBTYPE_ARM64_V8)) {
+            cpu_features->has_armcrypto = 1;
+        }
+    }
+#elif defined(HAVE_ANDROID_GETCPUFEATURES)
+    cpu_features->has_armcrypto =
+        (android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_AES) != 0x0;
+#elif (defined(__aarch64__) || defined(_M_ARM64)) && defined(AT_HWCAP)
+# ifdef HAVE_GETAUXVAL
+    cpu_features->has_armcrypto = (getauxval(AT_HWCAP) & (1L << 3)) != 0;
+# elif defined(HAVE_ELF_AUX_INFO)
+    {
+        unsigned long buf;
+        if (elf_aux_info(AT_HWCAP, (void *) &buf, (int) sizeof buf) == 0) {
+            cpu_features->has_armcrypto = (buf & (1L << 3)) != 0;
+        }
+    }
+# endif
+#elif defined(__arm__) && defined(AT_HWCAP2)
+# ifdef HAVE_GETAUXVAL
+    cpu_features->has_armcrypto = (getauxval(AT_HWCAP2) & (1L << 0)) != 0;
+# elif defined(HAVE_ELF_AUX_INFO)
+    {
+        unsigned long buf;
+        if (elf_aux_info(AT_HWCAP2, (void *) &buf, (int) sizeof buf) == 0) {
+            cpu_features->has_armcrypto = (buf & (1L << 0)) != 0;
+        }
+    }
+# endif
+#endif
+
+    return 0;
+}
+
+static void
+_cpuid(unsigned int cpu_info[4U], const unsigned int cpu_info_type)
+{
+#if defined(_MSC_VER) && \
+    (defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86))
+    __cpuid((int *) cpu_info, cpu_info_type);
+#elif defined(HAVE_CPUID)
+    cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
+# ifdef __i386__
+    __asm__ __volatile__(
+        "pushfl; pushfl; "
+        "popl %0; "
+        "movl %0, %1; xorl %2, %0; "
+        "pushl %0; "
+        "popfl; pushfl; popl %0; popfl"
+        : "=&r"(cpu_info[0]), "=&r"(cpu_info[1])
+        : "i"(0x200000));
+    if (((cpu_info[0] ^ cpu_info[1]) & 0x200000) == 0x0) {
+        return; /* LCOV_EXCL_LINE */
+    }
+# endif
+# ifdef __i386__
+    __asm__ __volatile__("xchgl %%ebx, %k1; cpuid; xchgl %%ebx, %k1"
+                         : "=a"(cpu_info[0]), "=&r"(cpu_info[1]),
+                           "=c"(cpu_info[2]), "=d"(cpu_info[3])
+                         : "0"(cpu_info_type), "2"(0U));
+# elif defined(__x86_64__)
+    __asm__ __volatile__("xchgq %%rbx, %q1; cpuid; xchgq %%rbx, %q1"
+                         : "=a"(cpu_info[0]), "=&r"(cpu_info[1]),
+                           "=c"(cpu_info[2]), "=d"(cpu_info[3])
+                         : "0"(cpu_info_type), "2"(0U));
+# else
+    __asm__ __volatile__("cpuid"
+                         : "=a"(cpu_info[0]), "=b"(cpu_info[1]),
+                           "=c"(cpu_info[2]), "=d"(cpu_info[3])
+                         : "0"(cpu_info_type), "2"(0U));
+# endif
+#else
+    (void) cpu_info_type;
+    cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
+#endif
+}
+
+static int
+_sodium_runtime_intel_cpu_features(CPUFeatures * const cpu_features)
+{
+    unsigned int cpu_info[4];
+    uint32_t     xcr0 = 0U;
+
+    _cpuid(cpu_info, 0x0);
+    if (cpu_info[0] == 0U) {
+        return -1; /* LCOV_EXCL_LINE */
+    }
+    _cpuid(cpu_info, 0x00000001);
+#ifdef HAVE_EMMINTRIN_H
+    cpu_features->has_sse2 = ((cpu_info[3] & CPUID_EDX_SSE2) != 0x0);
+#else
+    cpu_features->has_sse2   = 0;
+#endif
+
+#ifdef HAVE_PMMINTRIN_H
+    cpu_features->has_sse3 = ((cpu_info[2] & CPUID_ECX_SSE3) != 0x0);
+#else
+    cpu_features->has_sse3   = 0;
+#endif
+
+#ifdef HAVE_TMMINTRIN_H
+    cpu_features->has_ssse3 = ((cpu_info[2] & CPUID_ECX_SSSE3) != 0x0);
+#else
+    cpu_features->has_ssse3  = 0;
+#endif
+
+#ifdef HAVE_SMMINTRIN_H
+    cpu_features->has_sse41 = ((cpu_info[2] & CPUID_ECX_SSE41) != 0x0);
+#else
+    cpu_features->has_sse41  = 0;
+#endif
+
+    cpu_features->has_avx = 0;
+
+    (void) xcr0;
+#ifdef HAVE_AVXINTRIN_H
+    if ((cpu_info[2] & (CPUID_ECX_AVX | CPUID_ECX_XSAVE | CPUID_ECX_OSXSAVE)) ==
+        (CPUID_ECX_AVX | CPUID_ECX_XSAVE | CPUID_ECX_OSXSAVE)) {
+        xcr0 = 0U;
+# if defined(HAVE__XGETBV) || \
+        (defined(_MSC_VER) && defined(_XCR_XFEATURE_ENABLED_MASK) && _MSC_FULL_VER >= 160040219)
+        xcr0 = (uint32_t) _xgetbv(0);
+# elif defined(_MSC_VER) && defined(_M_IX86)
+        /*
+         * Visual Studio documentation states that eax/ecx/edx don't need to
+         * be preserved in inline assembly code. But that doesn't seem to
+         * always hold true on Visual Studio 2010.
+         */
+        __asm {
+            push eax
+            push ecx
+            push edx
+            xor ecx, ecx
+            _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0
+            mov xcr0, eax
+            pop edx
+            pop ecx
+            pop eax
+        }
+# elif defined(HAVE_AVX_ASM)
+        __asm__ __volatile__(".byte 0x0f, 0x01, 0xd0" /* XGETBV */
+                             : "=a"(xcr0)
+                             : "c"((uint32_t) 0U)
+                             : "%edx");
+# endif
+        if ((xcr0 & (XCR0_SSE | XCR0_AVX)) == (XCR0_SSE | XCR0_AVX)) {
+            cpu_features->has_avx = 1;
+        }
+    }
+#endif
+
+    cpu_features->has_avx2 = 0;
+#ifdef HAVE_AVX2INTRIN_H
+    if (cpu_features->has_avx) {
+        unsigned int cpu_info7[4];
+
+        _cpuid(cpu_info7, 0x00000007);
+        cpu_features->has_avx2 = ((cpu_info7[1] & CPUID_EBX_AVX2) != 0x0);
+    }
+#endif
+
+    cpu_features->has_avx512f = 0;
+#ifdef HAVE_AVX512FINTRIN_H
+    if (cpu_features->has_avx2) {
+        unsigned int cpu_info7[4];
+
+        _cpuid(cpu_info7, 0x00000007);
+        /* LCOV_EXCL_START */
+        if ((cpu_info7[1] & CPUID_EBX_AVX512F) == CPUID_EBX_AVX512F &&
+            (xcr0 & (XCR0_OPMASK | XCR0_ZMM_HI256 | XCR0_HI16_ZMM))
+            == (XCR0_OPMASK | XCR0_ZMM_HI256 | XCR0_HI16_ZMM)) {
+            cpu_features->has_avx512f = 1;
+        }
+        /* LCOV_EXCL_STOP */
+    }
+#endif
+
+#ifdef HAVE_WMMINTRIN_H
+    cpu_features->has_pclmul = ((cpu_info[2] & CPUID_ECX_PCLMUL) != 0x0);
+    cpu_features->has_aesni  = ((cpu_info[2] & CPUID_ECX_AESNI) != 0x0);
+#else
+    cpu_features->has_pclmul = 0;
+    cpu_features->has_aesni  = 0;
+#endif
+
+#ifdef HAVE_RDRAND
+    cpu_features->has_rdrand = ((cpu_info[2] & CPUID_ECX_RDRAND) != 0x0);
+#else
+    cpu_features->has_rdrand = 0;
+#endif
+
+    return 0;
+}
+
+int
+_sodium_runtime_get_cpu_features(void)
+{
+    int ret = -1;
+
+    ret &= _sodium_runtime_arm_cpu_features(&_cpu_features);
+    ret &= _sodium_runtime_intel_cpu_features(&_cpu_features);
+    _cpu_features.initialized = 1;
+
+    return ret;
+}
+
+int
+sodium_runtime_has_neon(void)
+{
+    return _cpu_features.has_neon;
+}
+
+int
+sodium_runtime_has_armcrypto(void)
+{
+    return _cpu_features.has_armcrypto;
+}
+
+int
+sodium_runtime_has_sse2(void)
+{
+    return _cpu_features.has_sse2;
+}
+
+int
+sodium_runtime_has_sse3(void)
+{
+    return _cpu_features.has_sse3;
+}
+
+int
+sodium_runtime_has_ssse3(void)
+{
+    return _cpu_features.has_ssse3;
+}
+
+int
+sodium_runtime_has_sse41(void)
+{
+    return _cpu_features.has_sse41;
+}
+
+int
+sodium_runtime_has_avx(void)
+{
+    return _cpu_features.has_avx;
+}
+
+int
+sodium_runtime_has_avx2(void)
+{
+    return _cpu_features.has_avx2;
+}
+
+int
+sodium_runtime_has_avx512f(void)
+{
+    return _cpu_features.has_avx512f;
+}
+
+int
+sodium_runtime_has_pclmul(void)
+{
+    return _cpu_features.has_pclmul;
+}
+
+int
+sodium_runtime_has_aesni(void)
+{
+    return _cpu_features.has_aesni;
+}
+
+int
+sodium_runtime_has_rdrand(void)
+{
+    return _cpu_features.has_rdrand;
+}
diff --git a/vendor/external/libsodium/sodium/utils.c b/vendor/external/libsodium/sodium/utils.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/sodium/utils.c
@@ -0,0 +1,809 @@
+#ifndef __STDC_WANT_LIB_EXT1__
+# define __STDC_WANT_LIB_EXT1__ 1
+#endif
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(HAVE_RAISE) && !defined(__wasm__)
+# include <signal.h>
+#endif
+
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
+
+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+#ifdef _WIN32
+# include <windows.h>
+# include <wincrypt.h>
+#else
+# include <unistd.h>
+#endif
+
+#ifndef HAVE_C_VARARRAYS
+# ifdef HAVE_ALLOCA_H
+#  include <alloca.h>
+# elif !defined(alloca)
+#  if defined(__clang__) || defined(__GNUC__)
+#   define alloca __builtin_alloca
+#  elif defined _AIX
+#   define alloca __alloca
+#  elif defined _MSC_VER
+#   include <malloc.h>
+#   define alloca _alloca
+#  else
+#   include <stddef.h>
+#   ifdef  __cplusplus
+extern "C"
+#   endif
+void *alloca (size_t);
+#  endif
+# endif
+#endif
+
+#include "core.h"
+#include "randombytes.h"
+#include "utils.h"
+
+#ifndef ENOSYS
+# define ENOSYS ENXIO
+#endif
+
+#if defined(_WIN32) && \
+    (!defined(WINAPI_FAMILY) || WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
+# define WINAPI_DESKTOP
+#endif
+
+#define CANARY_SIZE 16U
+#define GARBAGE_VALUE 0xdb
+
+#ifndef MAP_NOCORE
+# ifdef MAP_CONCEAL
+#  define MAP_NOCORE MAP_CONCEAL
+# else
+#  define MAP_NOCORE 0
+# endif
+#endif
+#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
+# define MAP_ANON MAP_ANONYMOUS
+#endif
+#if defined(WINAPI_DESKTOP) || (defined(MAP_ANON) && defined(HAVE_MMAP)) || \
+    defined(HAVE_POSIX_MEMALIGN)
+# define HAVE_ALIGNED_MALLOC
+#endif
+
+#if defined(HAVE_MPROTECT) && \
+    !(defined(PROT_NONE) && defined(PROT_READ) && defined(PROT_WRITE))
+# undef HAVE_MPROTECT
+#endif
+#if defined(HAVE_ALIGNED_MALLOC) && \
+    (defined(WINAPI_DESKTOP) || defined(HAVE_MPROTECT))
+# define HAVE_PAGE_PROTECTION
+#endif
+#if !defined(MADV_DODUMP) && defined(MADV_CORE)
+# define MADV_DODUMP   MADV_CORE
+# define MADV_DONTDUMP MADV_NOCORE
+#endif
+
+#ifndef DEFAULT_PAGE_SIZE
+# ifdef PAGE_SIZE
+#  define DEFAULT_PAGE_SIZE PAGE_SIZE
+# else
+#  define DEFAULT_PAGE_SIZE 0x10000
+# endif
+#endif
+
+static size_t        page_size = DEFAULT_PAGE_SIZE;
+static unsigned char canary[CANARY_SIZE];
+
+/* LCOV_EXCL_START */
+#ifdef HAVE_WEAK_SYMBOLS
+__attribute__((weak)) void
+_sodium_dummy_symbol_to_prevent_memzero_lto(void *const  pnt,
+                                            const size_t len);
+__attribute__((weak)) void
+_sodium_dummy_symbol_to_prevent_memzero_lto(void *const  pnt,
+                                            const size_t len)
+{
+    (void) pnt; /* LCOV_EXCL_LINE */
+    (void) len; /* LCOV_EXCL_LINE */
+}
+#endif
+/* LCOV_EXCL_STOP */
+
+void
+sodium_memzero(void * const pnt, const size_t len)
+{
+#if defined(_WIN32) && !defined(__CRT_INLINE)
+    SecureZeroMemory(pnt, len);
+#elif defined(HAVE_MEMSET_S)
+    if (len > 0U && memset_s(pnt, (rsize_t) len, 0, (rsize_t) len) != 0) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+#elif defined(HAVE_EXPLICIT_BZERO)
+    explicit_bzero(pnt, len);
+#elif defined(HAVE_MEMSET_EXPLICIT)
+    memset_explicit(pnt, 0, len);
+#elif defined(HAVE_EXPLICIT_MEMSET)
+    explicit_memset(pnt, 0, len);
+#elif HAVE_WEAK_SYMBOLS
+    if (len > 0U) {
+        memset(pnt, 0, len);
+        _sodium_dummy_symbol_to_prevent_memzero_lto(pnt, len);
+    }
+# ifdef HAVE_INLINE_ASM
+    __asm__ __volatile__ ("" : : "r"(pnt) : "memory");
+# endif
+#else
+    volatile unsigned char *volatile pnt_ =
+        (volatile unsigned char *volatile) pnt;
+    size_t i = (size_t) 0U;
+
+    while (i < len) {
+        pnt_[i++] = 0U;
+    }
+#endif
+}
+
+void
+sodium_stackzero(const size_t len)
+{
+#ifdef HAVE_C_VARARRAYS
+    unsigned char fodder[len];
+    sodium_memzero(fodder, len);
+#elif HAVE_ALLOCA
+    sodium_memzero(alloca(len), len);
+#endif
+}
+
+#ifdef HAVE_WEAK_SYMBOLS
+__attribute__((weak)) void
+_sodium_dummy_symbol_to_prevent_memcmp_lto(const unsigned char *b1,
+                                           const unsigned char *b2,
+                                           const size_t         len);
+__attribute__((weak)) void
+_sodium_dummy_symbol_to_prevent_memcmp_lto(const unsigned char *b1,
+                                           const unsigned char *b2,
+                                           const size_t         len)
+{
+    (void) b1;
+    (void) b2;
+    (void) len;
+}
+#endif
+
+int
+sodium_memcmp(const void *const b1_, const void *const b2_, size_t len)
+{
+#ifdef HAVE_WEAK_SYMBOLS
+    const unsigned char *b1 = (const unsigned char *) b1_;
+    const unsigned char *b2 = (const unsigned char *) b2_;
+#else
+    const volatile unsigned char *volatile b1 =
+        (const volatile unsigned char *volatile) b1_;
+    const volatile unsigned char *volatile b2 =
+        (const volatile unsigned char *volatile) b2_;
+#endif
+    size_t                 i;
+    volatile unsigned char d = 0U;
+
+#if HAVE_WEAK_SYMBOLS
+    _sodium_dummy_symbol_to_prevent_memcmp_lto(b1, b2, len);
+#endif
+    for (i = 0U; i < len; i++) {
+        d |= b1[i] ^ b2[i];
+    }
+    return (1 & ((d - 1) >> 8)) - 1;
+}
+
+#ifdef HAVE_WEAK_SYMBOLS
+__attribute__((weak)) void
+_sodium_dummy_symbol_to_prevent_compare_lto(const unsigned char *b1,
+                                            const unsigned char *b2,
+                                            const size_t         len);
+__attribute__((weak)) void
+_sodium_dummy_symbol_to_prevent_compare_lto(const unsigned char *b1,
+                                            const unsigned char *b2,
+                                            const size_t         len)
+{
+    (void) b1;
+    (void) b2;
+    (void) len;
+}
+#endif
+
+int
+sodium_compare(const unsigned char *b1_, const unsigned char *b2_, size_t len)
+{
+#ifdef HAVE_WEAK_SYMBOLS
+    const unsigned char *b1 = b1_;
+    const unsigned char *b2 = b2_;
+#else
+    const volatile unsigned char *volatile b1 =
+        (const volatile unsigned char *volatile) b1_;
+    const volatile unsigned char *volatile b2 =
+        (const volatile unsigned char *volatile) b2_;
+#endif
+    size_t                 i;
+    volatile unsigned char gt = 0U;
+    volatile unsigned char eq = 1U;
+    uint16_t               x1, x2;
+
+#if HAVE_WEAK_SYMBOLS
+    _sodium_dummy_symbol_to_prevent_compare_lto(b1, b2, len);
+#endif
+    i = len;
+    while (i != 0U) {
+        i--;
+        x1 = b1[i];
+        x2 = b2[i];
+        gt |= (((unsigned int) x2 - (unsigned int) x1) >> 8) & eq;
+        eq &= (((unsigned int) (x2 ^ x1)) - 1) >> 8;
+    }
+    return (int) (gt + gt + eq) - 1;
+}
+
+int
+sodium_is_zero(const unsigned char *n, const size_t nlen)
+{
+    size_t                 i;
+    volatile unsigned char d = 0U;
+
+    for (i = 0U; i < nlen; i++) {
+        d |= n[i];
+    }
+    return 1 & ((d - 1) >> 8);
+}
+
+void
+sodium_increment(unsigned char *n, const size_t nlen)
+{
+    size_t        i = 0U;
+    uint_fast16_t c = 1U;
+
+#ifdef HAVE_AMD64_ASM
+    uint64_t t64, t64_2;
+    uint32_t t32;
+
+    if (nlen == 12U) {
+        __asm__ __volatile__(
+            "xorq %[t64], %[t64] \n"
+            "xorl %[t32], %[t32] \n"
+            "stc \n"
+            "adcq %[t64], (%[out]) \n"
+            "adcl %[t32], 8(%[out]) \n"
+            : [t64] "=&r"(t64), [t32] "=&r"(t32)
+            : [out] "D"(n)
+            : "memory", "flags", "cc");
+        return;
+    } else if (nlen == 24U) {
+        __asm__ __volatile__(
+            "movq $1, %[t64] \n"
+            "xorq %[t64_2], %[t64_2] \n"
+            "addq %[t64], (%[out]) \n"
+            "adcq %[t64_2], 8(%[out]) \n"
+            "adcq %[t64_2], 16(%[out]) \n"
+            : [t64] "=&r"(t64), [t64_2] "=&r"(t64_2)
+            : [out] "D"(n)
+            : "memory", "flags", "cc");
+        return;
+    } else if (nlen == 8U) {
+        __asm__ __volatile__("incq (%[out]) \n"
+                             :
+                             : [out] "D"(n)
+                             : "memory", "flags", "cc");
+        return;
+    }
+#endif
+    for (; i < nlen; i++) {
+        c += (uint_fast16_t) n[i];
+        n[i] = (unsigned char) c;
+        c >>= 8;
+    }
+}
+
+void
+sodium_add(unsigned char *a, const unsigned char *b, const size_t len)
+{
+    size_t        i;
+    uint_fast16_t c = 0U;
+
+#ifdef HAVE_AMD64_ASM
+    uint64_t t64, t64_2, t64_3;
+    uint32_t t32;
+
+    if (len == 12U) {
+        __asm__ __volatile__(
+            "movq (%[in]), %[t64] \n"
+            "movl 8(%[in]), %[t32] \n"
+            "addq %[t64], (%[out]) \n"
+            "adcl %[t32], 8(%[out]) \n"
+            : [t64] "=&r"(t64), [t32] "=&r"(t32)
+            : [in] "S"(b), [out] "D"(a)
+            : "memory", "flags", "cc");
+        return;
+    } else if (len == 24U) {
+        __asm__ __volatile__(
+            "movq (%[in]), %[t64] \n"
+            "movq 8(%[in]), %[t64_2] \n"
+            "movq 16(%[in]), %[t64_3] \n"
+            "addq %[t64], (%[out]) \n"
+            "adcq %[t64_2], 8(%[out]) \n"
+            "adcq %[t64_3], 16(%[out]) \n"
+            : [t64] "=&r"(t64), [t64_2] "=&r"(t64_2), [t64_3] "=&r"(t64_3)
+            : [in] "S"(b), [out] "D"(a)
+            : "memory", "flags", "cc");
+        return;
+    } else if (len == 8U) {
+        __asm__ __volatile__(
+            "movq (%[in]), %[t64] \n"
+            "addq %[t64], (%[out]) \n"
+            : [t64] "=&r"(t64)
+            : [in] "S"(b), [out] "D"(a)
+            : "memory", "flags", "cc");
+        return;
+    }
+#endif
+    for (i = 0U; i < len; i++) {
+        c += (uint_fast16_t) a[i] + (uint_fast16_t) b[i];
+        a[i] = (unsigned char) c;
+        c >>= 8;
+    }
+}
+
+void
+sodium_sub(unsigned char *a, const unsigned char *b, const size_t len)
+{
+    uint_fast16_t c = 0U;
+    size_t        i;
+
+#ifdef HAVE_AMD64_ASM
+    uint64_t t64_1, t64_2, t64_3, t64_4;
+    uint64_t t64_5, t64_6, t64_7, t64_8;
+    uint32_t t32;
+
+    if (len == 64U) {
+        __asm__ __volatile__(
+            "movq   (%[in]), %[t64_1] \n"
+            "movq  8(%[in]), %[t64_2] \n"
+            "movq 16(%[in]), %[t64_3] \n"
+            "movq 24(%[in]), %[t64_4] \n"
+            "movq 32(%[in]), %[t64_5] \n"
+            "movq 40(%[in]), %[t64_6] \n"
+            "movq 48(%[in]), %[t64_7] \n"
+            "movq 56(%[in]), %[t64_8] \n"
+            "subq %[t64_1],   (%[out]) \n"
+            "sbbq %[t64_2],  8(%[out]) \n"
+            "sbbq %[t64_3], 16(%[out]) \n"
+            "sbbq %[t64_4], 24(%[out]) \n"
+            "sbbq %[t64_5], 32(%[out]) \n"
+            "sbbq %[t64_6], 40(%[out]) \n"
+            "sbbq %[t64_7], 48(%[out]) \n"
+            "sbbq %[t64_8], 56(%[out]) \n"
+            : [t64_1] "=&r"(t64_1), [t64_2] "=&r"(t64_2), [t64_3] "=&r"(t64_3), [t64_4] "=&r"(t64_4),
+              [t64_5] "=&r"(t64_5), [t64_6] "=&r"(t64_6), [t64_7] "=&r"(t64_7), [t64_8] "=&r"(t64_8)
+            : [in] "S"(b), [out] "D"(a)
+            : "memory", "flags", "cc");
+        return;
+    }
+#endif
+    for (i = 0U; i < len; i++) {
+        c = (uint_fast16_t) a[i] - (uint_fast16_t) b[i] - c;
+        a[i] = (unsigned char) c;
+        c = (c >> 8) & 1U;
+    }
+}
+
+int
+_sodium_alloc_init(void)
+{
+#ifdef HAVE_ALIGNED_MALLOC
+# if defined(_SC_PAGESIZE) && defined(HAVE_SYSCONF)
+    long page_size_ = sysconf(_SC_PAGESIZE);
+    if (page_size_ > 0L) {
+        page_size = (size_t) page_size_;
+    }
+# elif defined(WINAPI_DESKTOP)
+    SYSTEM_INFO si;
+    GetSystemInfo(&si);
+    page_size = (size_t) si.dwPageSize;
+# elif !defined(PAGE_SIZE)
+#  warning Unknown page size
+# endif
+    if (page_size < CANARY_SIZE || page_size < sizeof(size_t)) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+#endif
+    randombytes_buf(canary, sizeof canary);
+
+    return 0;
+}
+
+int
+sodium_mlock(void *const addr, const size_t len)
+{
+#if defined(MADV_DONTDUMP) && defined(HAVE_MADVISE)
+    (void) madvise(addr, len, MADV_DONTDUMP);
+#endif
+#ifdef HAVE_MLOCK
+    return mlock(addr, len);
+#elif defined(WINAPI_DESKTOP)
+    return -(VirtualLock(addr, len) == 0);
+#else
+    errno = ENOSYS;
+    return -1;
+#endif
+}
+
+int
+sodium_munlock(void *const addr, const size_t len)
+{
+    sodium_memzero(addr, len);
+#if defined(MADV_DODUMP) && defined(HAVE_MADVISE)
+    (void) madvise(addr, len, MADV_DODUMP);
+#endif
+#ifdef HAVE_MLOCK
+    return munlock(addr, len);
+#elif defined(WINAPI_DESKTOP)
+    return -(VirtualUnlock(addr, len) == 0);
+#else
+    errno = ENOSYS;
+    return -1;
+#endif
+}
+
+static int
+_mprotect_noaccess(void *ptr, size_t size)
+{
+#ifdef HAVE_MPROTECT
+    return mprotect(ptr, size, PROT_NONE);
+#elif defined(WINAPI_DESKTOP)
+    DWORD old;
+    return -(VirtualProtect(ptr, size, PAGE_NOACCESS, &old) == 0);
+#else
+    errno = ENOSYS;
+    return -1;
+#endif
+}
+
+static int
+_mprotect_readonly(void *ptr, size_t size)
+{
+#ifdef HAVE_MPROTECT
+    return mprotect(ptr, size, PROT_READ);
+#elif defined(WINAPI_DESKTOP)
+    DWORD old;
+    return -(VirtualProtect(ptr, size, PAGE_READONLY, &old) == 0);
+#else
+    errno = ENOSYS;
+    return -1;
+#endif
+}
+
+static int
+_mprotect_readwrite(void *ptr, size_t size)
+{
+#ifdef HAVE_MPROTECT
+    return mprotect(ptr, size, PROT_READ | PROT_WRITE);
+#elif defined(WINAPI_DESKTOP)
+    DWORD old;
+    return -(VirtualProtect(ptr, size, PAGE_READWRITE, &old) == 0);
+#else
+    errno = ENOSYS;
+    return -1;
+#endif
+}
+
+#ifdef HAVE_ALIGNED_MALLOC
+
+__attribute__((noreturn)) static void
+_out_of_bounds(void)
+{
+# if defined(HAVE_RAISE) && !defined(__wasm__)
+#  ifdef SIGPROT
+    raise(SIGPROT);
+#  elif defined(SIGSEGV)
+    raise(SIGSEGV);
+#  elif defined(SIGKILL)
+    raise(SIGKILL);
+#  endif
+# endif
+    abort(); /* not something we want any higher-level API to catch */
+} /* LCOV_EXCL_LINE */
+
+static inline size_t
+_page_round(const size_t size)
+{
+    const size_t page_mask = page_size - 1U;
+
+    return (size + page_mask) & ~page_mask;
+}
+
+static __attribute__((malloc)) unsigned char *
+_alloc_aligned(const size_t size)
+{
+    void *ptr;
+
+# if defined(MAP_ANON) && defined(HAVE_MMAP)
+    if ((ptr = mmap(NULL, size, PROT_READ | PROT_WRITE,
+                    MAP_ANON | MAP_PRIVATE | MAP_NOCORE, -1, 0)) ==
+        MAP_FAILED) {
+        ptr = NULL; /* LCOV_EXCL_LINE */
+    }               /* LCOV_EXCL_LINE */
+# elif defined(HAVE_POSIX_MEMALIGN)
+    if (posix_memalign(&ptr, page_size, size) != 0) {
+        ptr = NULL; /* LCOV_EXCL_LINE */
+    }               /* LCOV_EXCL_LINE */
+# elif defined(WINAPI_DESKTOP)
+    ptr = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
+# else
+#  error Bug
+# endif
+    return (unsigned char *) ptr;
+}
+
+static void
+_free_aligned(unsigned char *const ptr, const size_t size)
+{
+# if defined(MAP_ANON) && defined(HAVE_MMAP)
+    (void) munmap(ptr, size);
+# elif defined(HAVE_POSIX_MEMALIGN)
+    free(ptr);
+# elif defined(WINAPI_DESKTOP)
+    VirtualFree(ptr, 0U, MEM_RELEASE);
+# else
+#  error Bug
+#endif
+}
+
+static unsigned char *
+_unprotected_ptr_from_user_ptr(void *const ptr)
+{
+    uintptr_t      unprotected_ptr_u;
+    unsigned char *canary_ptr;
+    size_t         page_mask;
+
+    canary_ptr = ((unsigned char *) ptr) - sizeof canary;
+    page_mask = page_size - 1U;
+    unprotected_ptr_u = ((uintptr_t) canary_ptr & (uintptr_t) ~page_mask);
+    if (unprotected_ptr_u <= page_size * 2U) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+    return (unsigned char *) unprotected_ptr_u;
+}
+
+#endif /* HAVE_ALIGNED_MALLOC */
+
+#ifndef HAVE_ALIGNED_MALLOC
+static __attribute__((malloc)) void *
+_sodium_malloc(const size_t size)
+{
+    return malloc(size > (size_t) 0U ? size : (size_t) 1U);
+}
+#else
+static __attribute__((malloc)) void *
+_sodium_malloc(const size_t size)
+{
+    void          *user_ptr;
+    unsigned char *base_ptr;
+    unsigned char *canary_ptr;
+    unsigned char *unprotected_ptr;
+    size_t         size_with_canary;
+    size_t         total_size;
+    size_t         unprotected_size;
+
+    if (size >= (size_t) SIZE_MAX - page_size * 4U) {
+        errno = ENOMEM;
+        return NULL;
+    }
+    if (page_size <= sizeof canary || page_size < sizeof unprotected_size) {
+        sodium_misuse(); /* LCOV_EXCL_LINE */
+    }
+    size_with_canary = (sizeof canary) + size;
+    unprotected_size = _page_round(size_with_canary);
+    total_size       = page_size + page_size + unprotected_size + page_size;
+    if ((base_ptr = _alloc_aligned(total_size)) == NULL) {
+        return NULL; /* LCOV_EXCL_LINE */
+    }
+    unprotected_ptr = base_ptr + page_size * 2U;
+    _mprotect_noaccess(base_ptr + page_size, page_size);
+# ifndef HAVE_PAGE_PROTECTION
+    memcpy(unprotected_ptr + unprotected_size, canary, sizeof canary);
+# endif
+    _mprotect_noaccess(unprotected_ptr + unprotected_size, page_size);
+    (void) sodium_mlock(unprotected_ptr, unprotected_size); /* not a hard error in the context of sodium_malloc() */
+    canary_ptr =
+        unprotected_ptr + _page_round(size_with_canary) - size_with_canary;
+    user_ptr = canary_ptr + sizeof canary;
+    memcpy(canary_ptr, canary, sizeof canary);
+    memcpy(base_ptr, &unprotected_size, sizeof unprotected_size);
+    _mprotect_readonly(base_ptr, page_size);
+    assert(_unprotected_ptr_from_user_ptr(user_ptr) == unprotected_ptr);
+
+    return user_ptr;
+}
+#endif /* !HAVE_ALIGNED_MALLOC */
+
+__attribute__((malloc)) void *
+sodium_malloc(const size_t size)
+{
+    void *ptr;
+
+    if ((ptr = _sodium_malloc(size)) == NULL) {
+        return NULL;
+    }
+    memset(ptr, (int) GARBAGE_VALUE, size);
+
+    return ptr;
+}
+
+__attribute__((malloc)) void *
+sodium_allocarray(size_t count, size_t size)
+{
+    if (count > (size_t) 0U && size >= (size_t) SIZE_MAX / count) {
+        errno = ENOMEM;
+        return NULL;
+    }
+    return sodium_malloc(count * size);
+}
+
+#ifndef HAVE_ALIGNED_MALLOC
+void
+sodium_free(void *ptr)
+{
+    free(ptr);
+}
+#else
+void
+sodium_free(void *ptr)
+{
+    unsigned char *base_ptr;
+    unsigned char *canary_ptr;
+    unsigned char *unprotected_ptr;
+    size_t         total_size;
+    size_t         unprotected_size;
+
+    if (ptr == NULL) {
+        return;
+    }
+    canary_ptr      = ((unsigned char *) ptr) - sizeof canary;
+    unprotected_ptr = _unprotected_ptr_from_user_ptr(ptr);
+    base_ptr        = unprotected_ptr - page_size * 2U;
+    memcpy(&unprotected_size, base_ptr, sizeof unprotected_size);
+    total_size = page_size + page_size + unprotected_size + page_size;
+    _mprotect_readwrite(base_ptr, total_size);
+    if (sodium_memcmp(canary_ptr, canary, sizeof canary) != 0) {
+        _out_of_bounds();
+    }
+# ifndef HAVE_PAGE_PROTECTION
+    if (sodium_memcmp(unprotected_ptr + unprotected_size, canary,
+                      sizeof canary) != 0) {
+        _out_of_bounds();
+    }
+# endif
+    (void) sodium_munlock(unprotected_ptr, unprotected_size);
+    _free_aligned(base_ptr, total_size);
+}
+#endif /* HAVE_ALIGNED_MALLOC */
+
+#ifndef HAVE_PAGE_PROTECTION
+static int
+_sodium_mprotect(void *ptr, int (*cb)(void *ptr, size_t size))
+{
+    (void) ptr;
+    (void) cb;
+    errno = ENOSYS;
+    return -1;
+}
+#else
+static int
+_sodium_mprotect(void *ptr, int (*cb)(void *ptr, size_t size))
+{
+    unsigned char *base_ptr;
+    unsigned char *unprotected_ptr;
+    size_t         unprotected_size;
+
+    unprotected_ptr = _unprotected_ptr_from_user_ptr(ptr);
+    base_ptr        = unprotected_ptr - page_size * 2U;
+    memcpy(&unprotected_size, base_ptr, sizeof unprotected_size);
+
+    return cb(unprotected_ptr, unprotected_size);
+}
+#endif
+
+int
+sodium_mprotect_noaccess(void *ptr)
+{
+    return _sodium_mprotect(ptr, _mprotect_noaccess);
+}
+
+int
+sodium_mprotect_readonly(void *ptr)
+{
+    return _sodium_mprotect(ptr, _mprotect_readonly);
+}
+
+int
+sodium_mprotect_readwrite(void *ptr)
+{
+    return _sodium_mprotect(ptr, _mprotect_readwrite);
+}
+
+int
+sodium_pad(size_t *padded_buflen_p, unsigned char *buf,
+           size_t unpadded_buflen, size_t blocksize, size_t max_buflen)
+{
+    unsigned char          *tail;
+    size_t                  i;
+    size_t                  xpadlen;
+    size_t                  xpadded_len;
+    volatile unsigned char  mask;
+    unsigned char           barrier_mask;
+
+    if (blocksize <= 0U) {
+        return -1;
+    }
+    xpadlen = blocksize - 1U;
+    if ((blocksize & (blocksize - 1U)) == 0U) {
+        xpadlen -= unpadded_buflen & (blocksize - 1U);
+    } else {
+        xpadlen -= unpadded_buflen % blocksize;
+    }
+    if ((size_t) SIZE_MAX - unpadded_buflen <= xpadlen) {
+        sodium_misuse();
+    }
+    xpadded_len = unpadded_buflen + xpadlen;
+    if (xpadded_len >= max_buflen) {
+        return -1;
+    }
+    tail = &buf[xpadded_len];
+    if (padded_buflen_p != NULL) {
+        *padded_buflen_p = xpadded_len + 1U;
+    }
+    mask = 0U;
+    for (i = 0; i < blocksize; i++) {
+        barrier_mask = (unsigned char) (((i ^ xpadlen) - 1U)
+           >> ((sizeof(size_t) - 1) * CHAR_BIT));
+        *(tail - i) = ((*(tail - i)) & mask) | (0x80 & barrier_mask);
+        mask |= barrier_mask;
+    }
+    return 0;
+}
+
+int
+sodium_unpad(size_t *unpadded_buflen_p, const unsigned char *buf,
+             size_t padded_buflen, size_t blocksize)
+{
+    const unsigned char *tail;
+    unsigned char        acc = 0U;
+    unsigned char        c;
+    unsigned char        valid = 0U;
+    volatile size_t      pad_len = 0U;
+    size_t               i;
+    size_t               is_barrier;
+
+    if (padded_buflen < blocksize || blocksize <= 0U) {
+        return -1;
+    }
+    tail = &buf[padded_buflen - 1U];
+
+    for (i = 0U; i < blocksize; i++) {
+        c = *(tail - i);
+        is_barrier =
+            (( (acc - 1U) & (pad_len - 1U) & ((c ^ 0x80) - 1U) ) >> 8) & 1U;
+        acc |= c;
+        pad_len |= i & (1U + ~is_barrier);
+        valid |= (unsigned char) is_barrier;
+    }
+    *unpadded_buflen_p = padded_buflen - 1U - pad_len;
+
+    return (int) (valid - 1U);
+}
diff --git a/vendor/external/libsodium/sodium/version.c b/vendor/external/libsodium/sodium/version.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/libsodium/sodium/version.c
@@ -0,0 +1,30 @@
+
+#include "version.h"
+
+const char *
+sodium_version_string(void)
+{
+    return SODIUM_VERSION_STRING;
+}
+
+int
+sodium_library_version_major(void)
+{
+    return SODIUM_LIBRARY_VERSION_MAJOR;
+}
+
+int
+sodium_library_version_minor(void)
+{
+    return SODIUM_LIBRARY_VERSION_MINOR;
+}
+
+int
+sodium_library_minimal(void)
+{
+#ifdef SODIUM_LIBRARY_MINIMAL
+    return 1;
+#else
+    return 0;
+#endif
+}
diff --git a/vendor/external/ripemd160/LICENSE b/vendor/external/ripemd160/LICENSE
new file mode 100644
--- /dev/null
+++ b/vendor/external/ripemd160/LICENSE
@@ -0,0 +1,30 @@
+This RIPEMD-160 implementation is in the public domain.
+
+The full dedication and warranty notices are preserved verbatim at the top of
+ripemd160.c. They are reproduced here for convenience:
+
+  adapted by Pieter Wuille in 2012; all changes are in the public domain
+
+  RIPEMD160.c : RIPEMD-160 implementation
+
+  Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
+
+  ===================================================================
+  The contents of this file are dedicated to the public domain.  To
+  the extent that dedication to the public domain is not available,
+  everyone is granted a worldwide, perpetual, royalty-free,
+  non-exclusive license to exercise all rights associated with the
+  contents of this file for any purpose whatsoever.
+  No rights are reserved.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+  SOFTWARE.
+  ===================================================================
+
+  Country of origin: Canada
diff --git a/vendor/external/ripemd160/VERSION.txt b/vendor/external/ripemd160/VERSION.txt
new file mode 100644
--- /dev/null
+++ b/vendor/external/ripemd160/VERSION.txt
@@ -0,0 +1,18 @@
+Upstream:  ripemd160.c / ripemd160.h
+Origin:    https://github.com/trezor/trezor-firmware (crypto/ripemd160.c, crypto/ripemd160.h)
+Lineage:   Written in 2008 by Dwayne C. Litzenberger; public-domain changes by
+           Pieter Wuille (2012), via https://github.com/sipa/Coin25519
+Commit:    fb471a96f226737ec1c22bbf88078f5b36a572bc (trezor-firmware, path crypto/ripemd160.c)
+License:   Public domain (see LICENSE in this directory and the notice at the
+           top of ripemd160.c, both preserved verbatim).
+
+Provides:  ripemd160_init / ripemd160_process / ripemd160_done and the
+           one-shot ripemd160(), producing a 20-byte RIPEMD-160 digest.
+
+Removed / changed to keep this self-contained (no algorithm or copyright text
+altered):
+  - Dropped #include "memzero.h" (a trezor-firmware internal header) and
+    replaced it with a local "#define memzero(p, n) memset((p), 0, (n))" so
+    the pair of files compiles with no external dependency beyond libc.
+  - Nothing else from the upstream files was removed; the source is already a
+    single self-contained translation unit plus its header.
diff --git a/vendor/external/ripemd160/ripemd160.c b/vendor/external/ripemd160/ripemd160.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/ripemd160/ripemd160.c
@@ -0,0 +1,361 @@
+#include "ripemd160.h"
+#include <assert.h>
+#include <string.h>
+
+/* cardano-c: upstream pulled memzero() from trezor-firmware/crypto/memzero.h.
+ * Vendor it locally as a memset-based shim to keep this a self-contained pair
+ * of files. No algorithm or copyright text was changed. */
+#define memzero(p, n) memset((p), 0, (n))
+
+// Downlaoded from https://github.com/sipa/Coin25519/blob/master/src/crypto/ripemd160.c
+
+// adapted by Pieter Wuille in 2012; all changes are in the public domain
+
+/*
+ *
+ *  RIPEMD160.c : RIPEMD-160 implementation
+ *
+ * Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
+ *
+ * ===================================================================
+ * The contents of this file are dedicated to the public domain.  To
+ * the extent that dedication to the public domain is not available,
+ * everyone is granted a worldwide, perpetual, royalty-free,
+ * non-exclusive license to exercise all rights associated with the
+ * contents of this file for any purpose whatsoever.
+ * No rights are reserved.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ * ===================================================================
+ *
+ * Country of origin: Canada
+ *
+ * This implementation (written in C) is based on an implementation the author
+ * wrote in Python.
+ *
+ * This implementation was written with reference to the RIPEMD-160
+ * specification, which is available at:
+ * http://homes.esat.kuleuven.be/~cosicart/pdf/AB-9601/
+ *
+ * It is also documented in the _Handbook of Applied Cryptography_, as
+ * Algorithm 9.55.  It's on page 30 of the following PDF file:
+ * http://www.cacr.math.uwaterloo.ca/hac/about/chap9.pdf
+ *
+ * The RIPEMD-160 specification doesn't really tell us how to do padding, but
+ * since RIPEMD-160 is inspired by MD4, you can use the padding algorithm from
+ * RFC 1320.
+ *
+ * According to http://www.users.zetnet.co.uk/hopwood/crypto/scan/md.html:
+ *   "RIPEMD-160 is big-bit-endian, little-byte-endian, and left-justified."
+ */
+
+#include <stdint.h>
+
+#include <string.h>
+
+#define RIPEMD160_DIGEST_SIZE RIPEMD160_DIGEST_LENGTH
+
+/* cyclic left-shift the 32-bit word n left by s bits */
+#define ROL(s, n) (((n) << (s)) | ((n) >> (32-(s))))
+
+/* Initial values for the chaining variables.
+ * This is just 0123456789ABCDEFFEDCBA9876543210F0E1D2C3 in little-endian. */
+static const uint32_t initial_h[5] = { 0x67452301u, 0xEFCDAB89u, 0x98BADCFEu, 0x10325476u, 0xC3D2E1F0u };
+
+/* Ordering of message words.  Based on the permutations rho(i) and pi(i), defined as follows:
+ *
+ *  rho(i) := { 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8 }[i]  0 <= i <= 15
+ *
+ *  pi(i) := 9*i + 5 (mod 16)
+ *
+ *  Line  |  Round 1  |  Round 2  |  Round 3  |  Round 4  |  Round 5
+ * -------+-----------+-----------+-----------+-----------+-----------
+ *  left  |    id     |    rho    |   rho^2   |   rho^3   |   rho^4
+ *  right |    pi     |   rho pi  |  rho^2 pi |  rho^3 pi |  rho^4 pi
+ */
+
+/* Left line */
+static const uint8_t RL[5][16] = {
+    { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },   /* Round 1: id */
+    { 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8 },   /* Round 2: rho */
+    { 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12 },   /* Round 3: rho^2 */
+    { 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2 },   /* Round 4: rho^3 */
+    { 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 }    /* Round 5: rho^4 */
+};
+
+/* Right line */
+static const uint8_t RR[5][16] = {
+    { 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12 },   /* Round 1: pi */
+    { 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2 },   /* Round 2: rho pi */
+    { 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13 },   /* Round 3: rho^2 pi */
+    { 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14 },   /* Round 4: rho^3 pi */
+    { 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 }    /* Round 5: rho^4 pi */
+};
+
+/*
+ * Shifts - Since we don't actually re-order the message words according to
+ * the permutations above (we could, but it would be slower), these tables
+ * come with the permutations pre-applied.
+ */
+
+/* Shifts, left line */
+static const uint8_t SL[5][16] = {
+    { 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8 }, /* Round 1 */
+    { 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12 }, /* Round 2 */
+    { 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5 }, /* Round 3 */
+    { 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12 }, /* Round 4 */
+    { 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 }  /* Round 5 */
+};
+
+/* Shifts, right line */
+static const uint8_t SR[5][16] = {
+    { 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6 }, /* Round 1 */
+    { 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11 }, /* Round 2 */
+    { 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5 }, /* Round 3 */
+    { 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8 }, /* Round 4 */
+    { 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 }  /* Round 5 */
+};
+
+/* Boolean functions */
+
+#define F1(x, y, z) ((x) ^ (y) ^ (z))
+#define F2(x, y, z) (((x) & (y)) | (~(x) & (z)))
+#define F3(x, y, z) (((x) | ~(y)) ^ (z))
+#define F4(x, y, z) (((x) & (z)) | ((y) & ~(z)))
+#define F5(x, y, z) ((x) ^ ((y) | ~(z)))
+
+/* Round constants, left line */
+static const uint32_t KL[5] = {
+    0x00000000u,    /* Round 1: 0 */
+    0x5A827999u,    /* Round 2: floor(2**30 * sqrt(2)) */
+    0x6ED9EBA1u,    /* Round 3: floor(2**30 * sqrt(3)) */
+    0x8F1BBCDCu,    /* Round 4: floor(2**30 * sqrt(5)) */
+    0xA953FD4Eu     /* Round 5: floor(2**30 * sqrt(7)) */
+};
+
+/* Round constants, right line */
+static const uint32_t KR[5] = {
+    0x50A28BE6u,    /* Round 1: floor(2**30 * cubert(2)) */
+    0x5C4DD124u,    /* Round 2: floor(2**30 * cubert(3)) */
+    0x6D703EF3u,    /* Round 3: floor(2**30 * cubert(5)) */
+    0x7A6D76E9u,    /* Round 4: floor(2**30 * cubert(7)) */
+    0x00000000u     /* Round 5: 0 */
+};
+
+void ripemd160_init(ripemd160_state *self)
+{
+
+    memcpy(self->h, initial_h, RIPEMD160_DIGEST_SIZE);
+    memset(&self->buf, 0, sizeof(self->buf));
+    self->length = 0;
+    self->bufpos = 0;
+}
+
+#ifdef PCT_BIG_ENDIAN
+static inline void byteswap32(uint32_t *v)
+{
+    union { uint32_t w; uint8_t b[4]; } x = {0}, y = {0};
+
+    x.w = *v;
+    y.b[0] = x.b[3];
+    y.b[1] = x.b[2];
+    y.b[2] = x.b[1];
+    y.b[3] = x.b[0];
+    *v = y.w;
+
+    /* Wipe temporary variables */
+    x.w = y.w = 0;
+}
+
+static inline void byteswap_digest(uint32_t *p)
+{
+    unsigned int i = 0;
+
+    for (i = 0; i < 4; i++) {
+        byteswap32(p++);
+        byteswap32(p++);
+        byteswap32(p++);
+        byteswap32(p++);
+    }
+}
+#endif
+
+/* The RIPEMD160 compression function.  Operates on self->buf */
+static void ripemd160_compress(ripemd160_state *self)
+{
+    uint8_t w = 0, round = 0;
+    uint32_t T = 0;
+    uint32_t AL = 0, BL = 0, CL = 0, DL = 0, EL = 0;    /* left line */
+    uint32_t AR = 0, BR = 0, CR = 0, DR = 0, ER = 0;    /* right line */
+
+    /* Sanity check */
+    assert(self->bufpos == 64);
+
+    /* Byte-swap the buffer if we're on a big-endian machine */
+#ifdef PCT_BIG_ENDIAN
+    byteswap_digest(self->buf.w);
+#endif
+
+    /* Load the left and right lines with the initial state */
+    AL = AR = self->h[0];
+    BL = BR = self->h[1];
+    CL = CR = self->h[2];
+    DL = DR = self->h[3];
+    EL = ER = self->h[4];
+
+    /* Round 1 */
+    round = 0;
+    for (w = 0; w < 16; w++) { /* left line */
+        T = ROL(SL[round][w], AL + F1(BL, CL, DL) + self->buf.w[RL[round][w]] + KL[round]) + EL;
+        AL = EL; EL = DL; DL = ROL(10, CL); CL = BL; BL = T;
+    }
+    for (w = 0; w < 16; w++) { /* right line */
+        T = ROL(SR[round][w], AR + F5(BR, CR, DR) + self->buf.w[RR[round][w]] + KR[round]) + ER;
+        AR = ER; ER = DR; DR = ROL(10, CR); CR = BR; BR = T;
+    }
+
+    /* Round 2 */
+    round++;
+    for (w = 0; w < 16; w++) { /* left line */
+        T = ROL(SL[round][w], AL + F2(BL, CL, DL) + self->buf.w[RL[round][w]] + KL[round]) + EL;
+        AL = EL; EL = DL; DL = ROL(10, CL); CL = BL; BL = T;
+    }
+    for (w = 0; w < 16; w++) { /* right line */
+        T = ROL(SR[round][w], AR + F4(BR, CR, DR) + self->buf.w[RR[round][w]] + KR[round]) + ER;
+        AR = ER; ER = DR; DR = ROL(10, CR); CR = BR; BR = T;
+    }
+
+    /* Round 3 */
+    round++;
+    for (w = 0; w < 16; w++) { /* left line */
+        T = ROL(SL[round][w], AL + F3(BL, CL, DL) + self->buf.w[RL[round][w]] + KL[round]) + EL;
+        AL = EL; EL = DL; DL = ROL(10, CL); CL = BL; BL = T;
+    }
+    for (w = 0; w < 16; w++) { /* right line */
+        T = ROL(SR[round][w], AR + F3(BR, CR, DR) + self->buf.w[RR[round][w]] + KR[round]) + ER;
+        AR = ER; ER = DR; DR = ROL(10, CR); CR = BR; BR = T;
+    }
+
+    /* Round 4 */
+    round++;
+    for (w = 0; w < 16; w++) { /* left line */
+        T = ROL(SL[round][w], AL + F4(BL, CL, DL) + self->buf.w[RL[round][w]] + KL[round]) + EL;
+        AL = EL; EL = DL; DL = ROL(10, CL); CL = BL; BL = T;
+    }
+    for (w = 0; w < 16; w++) { /* right line */
+        T = ROL(SR[round][w], AR + F2(BR, CR, DR) + self->buf.w[RR[round][w]] + KR[round]) + ER;
+        AR = ER; ER = DR; DR = ROL(10, CR); CR = BR; BR = T;
+    }
+
+    /* Round 5 */
+    round++;
+    for (w = 0; w < 16; w++) { /* left line */
+        T = ROL(SL[round][w], AL + F5(BL, CL, DL) + self->buf.w[RL[round][w]] + KL[round]) + EL;
+        AL = EL; EL = DL; DL = ROL(10, CL); CL = BL; BL = T;
+    }
+    for (w = 0; w < 16; w++) { /* right line */
+        T = ROL(SR[round][w], AR + F1(BR, CR, DR) + self->buf.w[RR[round][w]] + KR[round]) + ER;
+        AR = ER; ER = DR; DR = ROL(10, CR); CR = BR; BR = T;
+    }
+
+    /* Final mixing stage */
+    T = self->h[1] + CL + DR;
+    self->h[1] = self->h[2] + DL + ER;
+    self->h[2] = self->h[3] + EL + AR;
+    self->h[3] = self->h[4] + AL + BR;
+    self->h[4] = self->h[0] + BL + CR;
+    self->h[0] = T;
+
+    /* Clear the buffer and wipe the temporary variables */
+    memzero(&self->buf, sizeof(self->buf));
+    memzero(&T, sizeof(T));
+    memzero(&AL, sizeof(AL));
+    memzero(&BL, sizeof(BL));
+    memzero(&CL, sizeof(CL));
+    memzero(&DL, sizeof(DL));
+    memzero(&EL, sizeof(EL));
+    memzero(&AR, sizeof(AR));
+    memzero(&BR, sizeof(BR));
+    memzero(&CR, sizeof(CR));
+    memzero(&DR, sizeof(DR));
+    memzero(&ER, sizeof(ER));
+    self->bufpos = 0;
+}
+
+void ripemd160_process(ripemd160_state * self, const uint8_t *p, size_t length)
+{
+    unsigned long bytes_needed = 0;
+
+    /* Some assertions */
+    assert(p != NULL);
+
+    /* We never leave a full buffer */
+    assert(self->bufpos < 64);
+
+    while (length > 0) {
+        /* Figure out how many bytes we need to fill the internal buffer. */
+        bytes_needed = 64 - self->bufpos;
+
+        if ((unsigned long) length >= bytes_needed) {
+            /* We have enough bytes, so copy them into the internal buffer and run
+             * the compression function. */
+            memcpy(&self->buf.b[self->bufpos], p, bytes_needed);
+            self->bufpos += bytes_needed;
+            self->length += bytes_needed << 3;    /* length is in bits */
+            p += bytes_needed;
+            ripemd160_compress(self);
+            length -= bytes_needed;
+            continue;
+        }
+
+        /* We do not have enough bytes to fill the internal buffer.
+         * Copy what's there and return. */
+        memcpy(&self->buf.b[self->bufpos], p, length);
+        self->bufpos += length;
+        self->length += length << 3;    /* length is in bits */
+        return;
+    }
+}
+
+void ripemd160_done(ripemd160_state * self, uint8_t out[RIPEMD160_DIGEST_LENGTH])
+{
+    /* Append the padding */
+    self->buf.b[self->bufpos++] = 0x80;
+
+    if (self->bufpos > 56) {
+        self->bufpos = 64;
+        ripemd160_compress(self);
+    }
+
+    /* Append the length */
+    self->buf.w[14] = (uint32_t) (self->length & 0xFFFFffffu);
+    self->buf.w[15] = (uint32_t) ((self->length >> 32) & 0xFFFFffffu);
+#ifdef PCT_BIG_ENDIAN
+    byteswap32(&self->buf.w[14]);
+    byteswap32(&self->buf.w[15]);
+#endif
+    self->bufpos = 64;
+    ripemd160_compress(self);
+
+    /* Copy the final state into the output buffer */
+#ifdef PCT_BIG_ENDIAN
+    byteswap_digest(self->h);
+#endif
+    memcpy(out, &self->h, RIPEMD160_DIGEST_SIZE);
+    memzero(self, sizeof(ripemd160_state));
+}
+
+void ripemd160(const uint8_t *in, size_t length, uint8_t out[RIPEMD160_DIGEST_LENGTH])
+{
+  ripemd160_state md = {0};
+  ripemd160_init(&md);
+  ripemd160_process(&md, in, length);
+  ripemd160_done(&md, out);
+}
diff --git a/vendor/external/ripemd160/ripemd160.h b/vendor/external/ripemd160/ripemd160.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/ripemd160/ripemd160.h
@@ -0,0 +1,24 @@
+#ifndef __RIPEMD160_H__
+#define __RIPEMD160_H__
+
+#include <stdint.h>
+#include <stddef.h>
+
+#define RIPEMD160_BLOCK_LENGTH 64
+#define RIPEMD160_DIGEST_LENGTH 20
+
+typedef struct {
+  uint64_t length;
+  union {
+    uint32_t w[16];
+    uint8_t  b[64];
+  } buf;
+  uint32_t h[5];
+  uint8_t bufpos;
+} ripemd160_state;
+
+void ripemd160_init(ripemd160_state * self);
+void ripemd160_process(ripemd160_state * self, const uint8_t *in, size_t length);
+void ripemd160_done(ripemd160_state * self, uint8_t out[RIPEMD160_DIGEST_LENGTH]);
+void ripemd160(const uint8_t *in, size_t length, uint8_t out[RIPEMD160_DIGEST_LENGTH]);
+#endif
diff --git a/vendor/external/secp256k1/COPYING b/vendor/external/secp256k1/COPYING
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/COPYING
@@ -0,0 +1,19 @@
+Copyright (c) 2013 Pieter Wuille
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/external/secp256k1/VERSION.txt b/vendor/external/secp256k1/VERSION.txt
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/VERSION.txt
@@ -0,0 +1,65 @@
+Upstream:  bitcoin-core/secp256k1
+Origin:    https://github.com/bitcoin-core/secp256k1
+Tag:       v0.6.0
+Commit:    0cdc758a56360bf58a851fe91085a327ec97685a
+License:   MIT (see COPYING in this directory)
+
+Provides the secp256k1 ECDSA-verify and Schnorr (BIP340) verify primitives for
+the Plutus builtins verifyEcdsaSecp256k1Signature and
+verifySchnorrSecp256k1Signature. Only the verify path of the core library plus
+the extrakeys and schnorrsig modules are compiled.
+
+Build configuration (no autotools, no code generation):
+  This release configures purely through preprocessor defines; it does not
+  generate a libsecp256k1-config.h and does not need HAVE_CONFIG_H. The build
+  defines are set on the isolated CMake OBJECT target (see lib/CMakeLists.txt):
+    ENABLE_MODULE_EXTRAKEYS=1   - x-only public keys (schnorr dependency)
+    ENABLE_MODULE_SCHNORRSIG=1  - BIP340 Schnorr signatures
+    ECMULT_WINDOW_SIZE=8        - small ecmult window: the verify table is 8 KiB
+                                  (vs 1 MiB at the upstream default of 15); secp
+                                  verify is a rarely-used cold path, so the lean
+                                  binary is worth the small verify slowdown
+    SECP256K1_STATIC            - consume the API as a static library (no DLL
+                                  import/export decoration on Windows)
+  The recovery, ECDH, ellswift and musig modules are intentionally not defined
+  and therefore not compiled. Wide multiplication, field and scalar backends are
+  auto-selected by src/util.h with a portable C fallback; no assembly is forced.
+
+Precomputed tables:
+  src/precomputed_ecmult.c and src/precomputed_ecmult_gen.c are the generated
+  tables that ship checked in with this release. They are compiled as-is, so no
+  precompute/codegen step (precompute_ecmult.c / precompute_ecmult_gen.c) and no
+  autotools run is required. Those two generator programs are not vendored.
+
+Vendored files:
+  COPYING                          - upstream MIT license, copied verbatim.
+  include/secp256k1.h              - core public API.
+  include/secp256k1_preallocated.h - included by secp256k1.c.
+  include/secp256k1_extrakeys.h    - x-only pubkey public API.
+  include/secp256k1_schnorrsig.h   - BIP340 public API.
+  src/secp256k1.c                  - the single core translation unit; it pulls
+                                     in the enabled module impls by ENABLE_MODULE_*.
+  src/precomputed_ecmult.c         - checked-in ecmult table.
+  src/precomputed_ecmult_gen.c     - checked-in ecmult-gen table.
+  src/*.h                          - the internal headers secp256k1.c includes
+                                     (field/group/scalar/ecmult/ecdsa/eckey/hash/
+                                     modinv/int128/scratch/hsort/assumptions/
+                                     checkmem/selftest/util and the precomputed
+                                     table headers).
+  src/modules/extrakeys/main_impl.h
+  src/modules/schnorrsig/main_impl.h
+
+Removed from the upstream tree to keep this lean (no copyright text altered):
+  - Unused modules: src/modules/{ecdh,recovery,ellswift,musig} and their public
+    headers include/secp256k1_{ecdh,recovery,ellswift,musig}.h.
+  - Tests and benchmarks: src/tests.c, src/tests_exhaustive.c, src/ctime_tests.c,
+    src/bench*.c, src/bench.h, the wycheproof test vectors and the per-module
+    tests_impl.h / tests_exhaustive_impl.h / bench_impl.h.
+  - Test-only internal headers: src/testrand*.h, src/testutil.h, and the
+    exhaustive-test scalar backend src/scalar_low.h / src/scalar_low_impl.h
+    (only included under EXHAUSTIVE_TEST_ORDER, which is never defined here).
+  - The table generators src/precompute_ecmult.c and src/precompute_ecmult_gen.c
+    (the checked-in tables above are used instead).
+  - Build tooling: configure.ac, Makefile.am, autogen.sh, CMakeLists.txt,
+    cmake/, src/CMakeLists.txt, the asm sources under src/asm, the examples/ and
+    contrib/ trees, CI and documentation files.
diff --git a/vendor/external/secp256k1/include/secp256k1.h b/vendor/external/secp256k1/include/secp256k1.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/include/secp256k1.h
@@ -0,0 +1,899 @@
+#ifndef SECP256K1_H
+#define SECP256K1_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stddef.h>
+
+/** Unless explicitly stated all pointer arguments must not be NULL.
+ *
+ * The following rules specify the order of arguments in API calls:
+ *
+ * 1. Context pointers go first, followed by output arguments, combined
+ *    output/input arguments, and finally input-only arguments.
+ * 2. Array lengths always immediately follow the argument whose length
+ *    they describe, even if this violates rule 1.
+ * 3. Within the OUT/OUTIN/IN groups, pointers to data that is typically generated
+ *    later go first. This means: signatures, public nonces, secret nonces,
+ *    messages, public keys, secret keys, tweaks.
+ * 4. Arguments that are not data pointers go last, from more complex to less
+ *    complex: function pointers, algorithm names, messages, void pointers,
+ *    counts, flags, booleans.
+ * 5. Opaque data pointers follow the function pointer they are to be passed to.
+ */
+
+/** Opaque data structure that holds context information
+ *
+ *  The primary purpose of context objects is to store randomization data for
+ *  enhanced protection against side-channel leakage. This protection is only
+ *  effective if the context is randomized after its creation. See
+ *  secp256k1_context_create for creation of contexts and
+ *  secp256k1_context_randomize for randomization.
+ *
+ *  A secondary purpose of context objects is to store pointers to callback
+ *  functions that the library will call when certain error states arise. See
+ *  secp256k1_context_set_error_callback as well as
+ *  secp256k1_context_set_illegal_callback for details. Future library versions
+ *  may use context objects for additional purposes.
+ *
+ *  A constructed context can safely be used from multiple threads
+ *  simultaneously, but API calls that take a non-const pointer to a context
+ *  need exclusive access to it. In particular this is the case for
+ *  secp256k1_context_destroy, secp256k1_context_preallocated_destroy,
+ *  and secp256k1_context_randomize.
+ *
+ *  Regarding randomization, either do it once at creation time (in which case
+ *  you do not need any locking for the other calls), or use a read-write lock.
+ */
+typedef struct secp256k1_context_struct secp256k1_context;
+
+/** Opaque data structure that holds a parsed and valid public key.
+ *
+ *  The exact representation of data inside is implementation defined and not
+ *  guaranteed to be portable between different platforms or versions. It is
+ *  however guaranteed to be 64 bytes in size, and can be safely copied/moved.
+ *  If you need to convert to a format suitable for storage or transmission,
+ *  use secp256k1_ec_pubkey_serialize and secp256k1_ec_pubkey_parse. To
+ *  compare keys, use secp256k1_ec_pubkey_cmp.
+ */
+typedef struct secp256k1_pubkey {
+    unsigned char data[64];
+} secp256k1_pubkey;
+
+/** Opaque data structure that holds a parsed ECDSA signature.
+ *
+ *  The exact representation of data inside is implementation defined and not
+ *  guaranteed to be portable between different platforms or versions. It is
+ *  however guaranteed to be 64 bytes in size, and can be safely copied/moved.
+ *  If you need to convert to a format suitable for storage, transmission, or
+ *  comparison, use the secp256k1_ecdsa_signature_serialize_* and
+ *  secp256k1_ecdsa_signature_parse_* functions.
+ */
+typedef struct secp256k1_ecdsa_signature {
+    unsigned char data[64];
+} secp256k1_ecdsa_signature;
+
+/** A pointer to a function to deterministically generate a nonce.
+ *
+ * Returns: 1 if a nonce was successfully generated. 0 will cause signing to fail.
+ * Out:     nonce32:   pointer to a 32-byte array to be filled by the function.
+ * In:      msg32:     the 32-byte message hash being verified (will not be NULL)
+ *          key32:     pointer to a 32-byte secret key (will not be NULL)
+ *          algo16:    pointer to a 16-byte array describing the signature
+ *                     algorithm (will be NULL for ECDSA for compatibility).
+ *          data:      Arbitrary data pointer that is passed through.
+ *          attempt:   how many iterations we have tried to find a nonce.
+ *                     This will almost always be 0, but different attempt values
+ *                     are required to result in a different nonce.
+ *
+ * Except for test cases, this function should compute some cryptographic hash of
+ * the message, the algorithm, the key and the attempt.
+ */
+typedef int (*secp256k1_nonce_function)(
+    unsigned char *nonce32,
+    const unsigned char *msg32,
+    const unsigned char *key32,
+    const unsigned char *algo16,
+    void *data,
+    unsigned int attempt
+);
+
+# if !defined(SECP256K1_GNUC_PREREQ)
+#  if defined(__GNUC__)&&defined(__GNUC_MINOR__)
+#   define SECP256K1_GNUC_PREREQ(_maj,_min) \
+ ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
+#  else
+#   define SECP256K1_GNUC_PREREQ(_maj,_min) 0
+#  endif
+# endif
+
+/*  When this header is used at build-time the SECP256K1_BUILD define needs to be set
+ *  to correctly setup export attributes and nullness checks.  This is normally done
+ *  by secp256k1.c but to guard against this header being included before secp256k1.c
+ *  has had a chance to set the define (e.g. via test harnesses that just includes
+ *  secp256k1.c) we set SECP256K1_NO_BUILD when this header is processed without the
+ *  BUILD define so this condition can be caught.
+ */
+#ifndef SECP256K1_BUILD
+# define SECP256K1_NO_BUILD
+#endif
+
+/* Symbol visibility. */
+#if defined(_WIN32)
+  /* GCC for Windows (e.g., MinGW) accepts the __declspec syntax
+   * for MSVC compatibility. A __declspec declaration implies (but is not
+   * exactly equivalent to) __attribute__ ((visibility("default"))), and so we
+   * actually want __declspec even on GCC, see "Microsoft Windows Function
+   * Attributes" in the GCC manual and the recommendations in
+   * https://gcc.gnu.org/wiki/Visibility. */
+# if defined(SECP256K1_BUILD)
+#  if defined(DLL_EXPORT) || defined(SECP256K1_DLL_EXPORT)
+    /* Building libsecp256k1 as a DLL.
+     * 1. If using Libtool, it defines DLL_EXPORT automatically.
+     * 2. In other cases, SECP256K1_DLL_EXPORT must be defined. */
+#   define SECP256K1_API extern __declspec (dllexport)
+#  else
+    /* Building libsecp256k1 as a static library on Windows.
+     * No declspec is needed, and so we would want the non-Windows-specific
+     * logic below take care of this case. However, this may result in setting
+     * __attribute__ ((visibility("default"))), which is supposed to be a noop
+     * on Windows but may trigger warnings when compiling with -flto due to a
+     * bug in GCC, see
+     * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116478 . */
+#   define SECP256K1_API extern
+#  endif
+  /* The user must define SECP256K1_STATIC when consuming libsecp256k1 as a static
+   * library on Windows. */
+# elif !defined(SECP256K1_STATIC)
+   /* Consuming libsecp256k1 as a DLL. */
+#  define SECP256K1_API extern __declspec (dllimport)
+# endif
+#endif
+#ifndef SECP256K1_API
+/* All cases not captured by the Windows-specific logic. */
+# if defined(__GNUC__) && (__GNUC__ >= 4) && defined(SECP256K1_BUILD)
+   /* Building libsecp256k1 using GCC or compatible. */
+#  define SECP256K1_API extern __attribute__ ((visibility ("default")))
+# else
+   /* Fall back to standard C's extern. */
+#  define SECP256K1_API extern
+# endif
+#endif
+
+/* Warning attributes
+ * NONNULL is not used if SECP256K1_BUILD is set to avoid the compiler optimizing out
+ * some paranoid null checks. */
+# if defined(__GNUC__) && SECP256K1_GNUC_PREREQ(3, 4)
+#  define SECP256K1_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
+# else
+#  define SECP256K1_WARN_UNUSED_RESULT
+# endif
+# if !defined(SECP256K1_BUILD) && defined(__GNUC__) && SECP256K1_GNUC_PREREQ(3, 4)
+#  define SECP256K1_ARG_NONNULL(_x)  __attribute__ ((__nonnull__(_x)))
+# else
+#  define SECP256K1_ARG_NONNULL(_x)
+# endif
+
+/* Attribute for marking functions, types, and variables as deprecated */
+#if !defined(SECP256K1_BUILD) && defined(__has_attribute)
+# if __has_attribute(__deprecated__)
+#  define SECP256K1_DEPRECATED(_msg) __attribute__ ((__deprecated__(_msg)))
+# else
+#  define SECP256K1_DEPRECATED(_msg)
+# endif
+#else
+# define SECP256K1_DEPRECATED(_msg)
+#endif
+
+/* All flags' lower 8 bits indicate what they're for. Do not use directly. */
+#define SECP256K1_FLAGS_TYPE_MASK ((1 << 8) - 1)
+#define SECP256K1_FLAGS_TYPE_CONTEXT (1 << 0)
+#define SECP256K1_FLAGS_TYPE_COMPRESSION (1 << 1)
+/* The higher bits contain the actual data. Do not use directly. */
+#define SECP256K1_FLAGS_BIT_CONTEXT_VERIFY (1 << 8)
+#define SECP256K1_FLAGS_BIT_CONTEXT_SIGN (1 << 9)
+#define SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY (1 << 10)
+#define SECP256K1_FLAGS_BIT_COMPRESSION (1 << 8)
+
+/** Context flags to pass to secp256k1_context_create, secp256k1_context_preallocated_size, and
+ *  secp256k1_context_preallocated_create. */
+#define SECP256K1_CONTEXT_NONE (SECP256K1_FLAGS_TYPE_CONTEXT)
+
+/** Deprecated context flags. These flags are treated equivalent to SECP256K1_CONTEXT_NONE. */
+#define SECP256K1_CONTEXT_VERIFY (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_VERIFY)
+#define SECP256K1_CONTEXT_SIGN (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_SIGN)
+
+/* Testing flag. Do not use. */
+#define SECP256K1_CONTEXT_DECLASSIFY (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY)
+
+/** Flag to pass to secp256k1_ec_pubkey_serialize. */
+#define SECP256K1_EC_COMPRESSED (SECP256K1_FLAGS_TYPE_COMPRESSION | SECP256K1_FLAGS_BIT_COMPRESSION)
+#define SECP256K1_EC_UNCOMPRESSED (SECP256K1_FLAGS_TYPE_COMPRESSION)
+
+/** Prefix byte used to tag various encoded curvepoints for specific purposes */
+#define SECP256K1_TAG_PUBKEY_EVEN 0x02
+#define SECP256K1_TAG_PUBKEY_ODD 0x03
+#define SECP256K1_TAG_PUBKEY_UNCOMPRESSED 0x04
+#define SECP256K1_TAG_PUBKEY_HYBRID_EVEN 0x06
+#define SECP256K1_TAG_PUBKEY_HYBRID_ODD 0x07
+
+/** A built-in constant secp256k1 context object with static storage duration, to be
+ *  used in conjunction with secp256k1_selftest.
+ *
+ *  This context object offers *only limited functionality* , i.e., it cannot be used
+ *  for API functions that perform computations involving secret keys, e.g., signing
+ *  and public key generation. If this restriction applies to a specific API function,
+ *  it is mentioned in its documentation. See secp256k1_context_create if you need a
+ *  full context object that supports all functionality offered by the library.
+ *
+ *  It is highly recommended to call secp256k1_selftest before using this context.
+ */
+SECP256K1_API const secp256k1_context *secp256k1_context_static;
+
+/** Deprecated alias for secp256k1_context_static. */
+SECP256K1_API const secp256k1_context *secp256k1_context_no_precomp
+SECP256K1_DEPRECATED("Use secp256k1_context_static instead");
+
+/** Perform basic self tests (to be used in conjunction with secp256k1_context_static)
+ *
+ *  This function performs self tests that detect some serious usage errors and
+ *  similar conditions, e.g., when the library is compiled for the wrong endianness.
+ *  This is a last resort measure to be used in production. The performed tests are
+ *  very rudimentary and are not intended as a replacement for running the test
+ *  binaries.
+ *
+ *  It is highly recommended to call this before using secp256k1_context_static.
+ *  It is not necessary to call this function before using a context created with
+ *  secp256k1_context_create (or secp256k1_context_preallocated_create), which will
+ *  take care of performing the self tests.
+ *
+ *  If the tests fail, this function will call the default error handler to abort the
+ *  program (see secp256k1_context_set_error_callback).
+ */
+SECP256K1_API void secp256k1_selftest(void);
+
+
+/** Create a secp256k1 context object (in dynamically allocated memory).
+ *
+ *  This function uses malloc to allocate memory. It is guaranteed that malloc is
+ *  called at most once for every call of this function. If you need to avoid dynamic
+ *  memory allocation entirely, see secp256k1_context_static and the functions in
+ *  secp256k1_preallocated.h.
+ *
+ *  Returns: pointer to a newly created context object.
+ *  In:      flags: Always set to SECP256K1_CONTEXT_NONE (see below).
+ *
+ *  The only valid non-deprecated flag in recent library versions is
+ *  SECP256K1_CONTEXT_NONE, which will create a context sufficient for all functionality
+ *  offered by the library. All other (deprecated) flags will be treated as equivalent
+ *  to the SECP256K1_CONTEXT_NONE flag. Though the flags parameter primarily exists for
+ *  historical reasons, future versions of the library may introduce new flags.
+ *
+ *  If the context is intended to be used for API functions that perform computations
+ *  involving secret keys, e.g., signing and public key generation, then it is highly
+ *  recommended to call secp256k1_context_randomize on the context before calling
+ *  those API functions. This will provide enhanced protection against side-channel
+ *  leakage, see secp256k1_context_randomize for details.
+ *
+ *  Do not create a new context object for each operation, as construction and
+ *  randomization can take non-negligible time.
+ */
+SECP256K1_API secp256k1_context *secp256k1_context_create(
+    unsigned int flags
+) SECP256K1_WARN_UNUSED_RESULT;
+
+/** Copy a secp256k1 context object (into dynamically allocated memory).
+ *
+ *  This function uses malloc to allocate memory. It is guaranteed that malloc is
+ *  called at most once for every call of this function. If you need to avoid dynamic
+ *  memory allocation entirely, see the functions in secp256k1_preallocated.h.
+ *
+ *  Cloning secp256k1_context_static is not possible, and should not be emulated by
+ *  the caller (e.g., using memcpy). Create a new context instead.
+ *
+ *  Returns: pointer to a newly created context object.
+ *  Args:    ctx: pointer to a context to copy (not secp256k1_context_static).
+ */
+SECP256K1_API secp256k1_context *secp256k1_context_clone(
+    const secp256k1_context *ctx
+) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT;
+
+/** Destroy a secp256k1 context object (created in dynamically allocated memory).
+ *
+ *  The context pointer may not be used afterwards.
+ *
+ *  The context to destroy must have been created using secp256k1_context_create
+ *  or secp256k1_context_clone. If the context has instead been created using
+ *  secp256k1_context_preallocated_create or secp256k1_context_preallocated_clone, the
+ *  behaviour is undefined. In that case, secp256k1_context_preallocated_destroy must
+ *  be used instead.
+ *
+ *  Args:   ctx: pointer to a context to destroy, constructed using
+ *               secp256k1_context_create or secp256k1_context_clone
+ *               (i.e., not secp256k1_context_static).
+ */
+SECP256K1_API void secp256k1_context_destroy(
+    secp256k1_context *ctx
+) SECP256K1_ARG_NONNULL(1);
+
+/** Set a callback function to be called when an illegal argument is passed to
+ *  an API call. It will only trigger for violations that are mentioned
+ *  explicitly in the header.
+ *
+ *  The philosophy is that these shouldn't be dealt with through a
+ *  specific return value, as calling code should not have branches to deal with
+ *  the case that this code itself is broken.
+ *
+ *  On the other hand, during debug stage, one would want to be informed about
+ *  such mistakes, and the default (crashing) may be inadvisable.
+ *  When this callback is triggered, the API function called is guaranteed not
+ *  to cause a crash, though its return value and output arguments are
+ *  undefined.
+ *
+ *  When this function has not been called (or called with fn==NULL), then the
+ *  default handler will be used. The library provides a default handler which
+ *  writes the message to stderr and calls abort. This default handler can be
+ *  replaced at link time if the preprocessor macro
+ *  USE_EXTERNAL_DEFAULT_CALLBACKS is defined, which is the case if the build
+ *  has been configured with --enable-external-default-callbacks. Then the
+ *  following two symbols must be provided to link against:
+ *   - void secp256k1_default_illegal_callback_fn(const char *message, void *data);
+ *   - void secp256k1_default_error_callback_fn(const char *message, void *data);
+ *  The library can call these default handlers even before a proper callback data
+ *  pointer could have been set using secp256k1_context_set_illegal_callback or
+ *  secp256k1_context_set_error_callback, e.g., when the creation of a context
+ *  fails. In this case, the corresponding default handler will be called with
+ *  the data pointer argument set to NULL.
+ *
+ *  Args: ctx:  pointer to a context object.
+ *  In:   fun:  pointer to a function to call when an illegal argument is
+ *              passed to the API, taking a message and an opaque pointer.
+ *              (NULL restores the default handler.)
+ *        data: the opaque pointer to pass to fun above, must be NULL for the default handler.
+ *
+ *  See also secp256k1_context_set_error_callback.
+ */
+SECP256K1_API void secp256k1_context_set_illegal_callback(
+    secp256k1_context *ctx,
+    void (*fun)(const char *message, void *data),
+    const void *data
+) SECP256K1_ARG_NONNULL(1);
+
+/** Set a callback function to be called when an internal consistency check
+ *  fails.
+ *
+ *  The default callback writes an error message to stderr and calls abort
+ *  to abort the program.
+ *
+ *  This can only trigger in case of a hardware failure, miscompilation,
+ *  memory corruption, serious bug in the library, or other error would can
+ *  otherwise result in undefined behaviour. It will not trigger due to mere
+ *  incorrect usage of the API (see secp256k1_context_set_illegal_callback
+ *  for that). After this callback returns, anything may happen, including
+ *  crashing.
+ *
+ *  Args: ctx:  pointer to a context object.
+ *  In:   fun:  pointer to a function to call when an internal error occurs,
+ *              taking a message and an opaque pointer (NULL restores the
+ *              default handler, see secp256k1_context_set_illegal_callback
+ *              for details).
+ *        data: the opaque pointer to pass to fun above, must be NULL for the default handler.
+ *
+ *  See also secp256k1_context_set_illegal_callback.
+ */
+SECP256K1_API void secp256k1_context_set_error_callback(
+    secp256k1_context *ctx,
+    void (*fun)(const char *message, void *data),
+    const void *data
+) SECP256K1_ARG_NONNULL(1);
+
+/** Parse a variable-length public key into the pubkey object.
+ *
+ *  Returns: 1 if the public key was fully valid.
+ *           0 if the public key could not be parsed or is invalid.
+ *  Args: ctx:      pointer to a context object.
+ *  Out:  pubkey:   pointer to a pubkey object. If 1 is returned, it is set to a
+ *                  parsed version of input. If not, its value is undefined.
+ *  In:   input:    pointer to a serialized public key
+ *        inputlen: length of the array pointed to by input
+ *
+ *  This function supports parsing compressed (33 bytes, header byte 0x02 or
+ *  0x03), uncompressed (65 bytes, header byte 0x04), or hybrid (65 bytes, header
+ *  byte 0x06 or 0x07) format public keys.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_parse(
+    const secp256k1_context *ctx,
+    secp256k1_pubkey *pubkey,
+    const unsigned char *input,
+    size_t inputlen
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Serialize a pubkey object into a serialized byte sequence.
+ *
+ *  Returns: 1 always.
+ *  Args:   ctx:        pointer to a context object.
+ *  Out:    output:     pointer to a 65-byte (if compressed==0) or 33-byte (if
+ *                      compressed==1) byte array to place the serialized key
+ *                      in.
+ *  In/Out: outputlen:  pointer to an integer which is initially set to the
+ *                      size of output, and is overwritten with the written
+ *                      size.
+ *  In:     pubkey:     pointer to a secp256k1_pubkey containing an
+ *                      initialized public key.
+ *          flags:      SECP256K1_EC_COMPRESSED if serialization should be in
+ *                      compressed format, otherwise SECP256K1_EC_UNCOMPRESSED.
+ */
+SECP256K1_API int secp256k1_ec_pubkey_serialize(
+    const secp256k1_context *ctx,
+    unsigned char *output,
+    size_t *outputlen,
+    const secp256k1_pubkey *pubkey,
+    unsigned int flags
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4);
+
+/** Compare two public keys using lexicographic (of compressed serialization) order
+ *
+ *  Returns: <0 if the first public key is less than the second
+ *           >0 if the first public key is greater than the second
+ *           0 if the two public keys are equal
+ *  Args: ctx:      pointer to a context object
+ *  In:   pubkey1:  first public key to compare
+ *        pubkey2:  second public key to compare
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_cmp(
+    const secp256k1_context *ctx,
+    const secp256k1_pubkey *pubkey1,
+    const secp256k1_pubkey *pubkey2
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Sort public keys using lexicographic (of compressed serialization) order
+ *
+ *  Returns: 0 if the arguments are invalid. 1 otherwise.
+ *
+ *  Args:     ctx: pointer to a context object
+ *  In:   pubkeys: array of pointers to pubkeys to sort
+ *      n_pubkeys: number of elements in the pubkeys array
+ */
+SECP256K1_API int secp256k1_ec_pubkey_sort(
+    const secp256k1_context *ctx,
+    const secp256k1_pubkey **pubkeys,
+    size_t n_pubkeys
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2);
+
+/** Parse an ECDSA signature in compact (64 bytes) format.
+ *
+ *  Returns: 1 when the signature could be parsed, 0 otherwise.
+ *  Args: ctx:      pointer to a context object
+ *  Out:  sig:      pointer to a signature object
+ *  In:   input64:  pointer to the 64-byte array to parse
+ *
+ *  The signature must consist of a 32-byte big endian R value, followed by a
+ *  32-byte big endian S value. If R or S fall outside of [0..order-1], the
+ *  encoding is invalid. R and S with value 0 are allowed in the encoding.
+ *
+ *  After the call, sig will always be initialized. If parsing failed or R or
+ *  S are zero, the resulting sig value is guaranteed to fail verification for
+ *  any message and public key.
+ */
+SECP256K1_API int secp256k1_ecdsa_signature_parse_compact(
+    const secp256k1_context *ctx,
+    secp256k1_ecdsa_signature *sig,
+    const unsigned char *input64
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Parse a DER ECDSA signature.
+ *
+ *  Returns: 1 when the signature could be parsed, 0 otherwise.
+ *  Args: ctx:      pointer to a context object
+ *  Out:  sig:      pointer to a signature object
+ *  In:   input:    pointer to the signature to be parsed
+ *        inputlen: the length of the array pointed to be input
+ *
+ *  This function will accept any valid DER encoded signature, even if the
+ *  encoded numbers are out of range.
+ *
+ *  After the call, sig will always be initialized. If parsing failed or the
+ *  encoded numbers are out of range, signature verification with it is
+ *  guaranteed to fail for every message and public key.
+ */
+SECP256K1_API int secp256k1_ecdsa_signature_parse_der(
+    const secp256k1_context *ctx,
+    secp256k1_ecdsa_signature *sig,
+    const unsigned char *input,
+    size_t inputlen
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Serialize an ECDSA signature in DER format.
+ *
+ *  Returns: 1 if enough space was available to serialize, 0 otherwise
+ *  Args:   ctx:       pointer to a context object
+ *  Out:    output:    pointer to an array to store the DER serialization
+ *  In/Out: outputlen: pointer to a length integer. Initially, this integer
+ *                     should be set to the length of output. After the call
+ *                     it will be set to the length of the serialization (even
+ *                     if 0 was returned).
+ *  In:     sig:       pointer to an initialized signature object
+ */
+SECP256K1_API int secp256k1_ecdsa_signature_serialize_der(
+    const secp256k1_context *ctx,
+    unsigned char *output,
+    size_t *outputlen,
+    const secp256k1_ecdsa_signature *sig
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4);
+
+/** Serialize an ECDSA signature in compact (64 byte) format.
+ *
+ *  Returns: 1
+ *  Args:   ctx:       pointer to a context object
+ *  Out:    output64:  pointer to a 64-byte array to store the compact serialization
+ *  In:     sig:       pointer to an initialized signature object
+ *
+ *  See secp256k1_ecdsa_signature_parse_compact for details about the encoding.
+ */
+SECP256K1_API int secp256k1_ecdsa_signature_serialize_compact(
+    const secp256k1_context *ctx,
+    unsigned char *output64,
+    const secp256k1_ecdsa_signature *sig
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Verify an ECDSA signature.
+ *
+ *  Returns: 1: correct signature
+ *           0: incorrect or unparseable signature
+ *  Args:    ctx:       pointer to a context object
+ *  In:      sig:       the signature being verified.
+ *           msghash32: the 32-byte message hash being verified.
+ *                      The verifier must make sure to apply a cryptographic
+ *                      hash function to the message by itself and not accept an
+ *                      msghash32 value directly. Otherwise, it would be easy to
+ *                      create a "valid" signature without knowledge of the
+ *                      secret key. See also
+ *                      https://bitcoin.stackexchange.com/a/81116/35586 for more
+ *                      background on this topic.
+ *           pubkey:    pointer to an initialized public key to verify with.
+ *
+ * To avoid accepting malleable signatures, only ECDSA signatures in lower-S
+ * form are accepted.
+ *
+ * If you need to accept ECDSA signatures from sources that do not obey this
+ * rule, apply secp256k1_ecdsa_signature_normalize to the signature prior to
+ * verification, but be aware that doing so results in malleable signatures.
+ *
+ * For details, see the comments for that function.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_verify(
+    const secp256k1_context *ctx,
+    const secp256k1_ecdsa_signature *sig,
+    const unsigned char *msghash32,
+    const secp256k1_pubkey *pubkey
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4);
+
+/** Convert a signature to a normalized lower-S form.
+ *
+ *  Returns: 1 if sigin was not normalized, 0 if it already was.
+ *  Args: ctx:    pointer to a context object
+ *  Out:  sigout: pointer to a signature to fill with the normalized form,
+ *                or copy if the input was already normalized. (can be NULL if
+ *                you're only interested in whether the input was already
+ *                normalized).
+ *  In:   sigin:  pointer to a signature to check/normalize (can be identical to sigout)
+ *
+ *  With ECDSA a third-party can forge a second distinct signature of the same
+ *  message, given a single initial signature, but without knowing the key. This
+ *  is done by negating the S value modulo the order of the curve, 'flipping'
+ *  the sign of the random point R which is not included in the signature.
+ *
+ *  Forgery of the same message isn't universally problematic, but in systems
+ *  where message malleability or uniqueness of signatures is important this can
+ *  cause issues. This forgery can be blocked by all verifiers forcing signers
+ *  to use a normalized form.
+ *
+ *  The lower-S form reduces the size of signatures slightly on average when
+ *  variable length encodings (such as DER) are used and is cheap to verify,
+ *  making it a good choice. Security of always using lower-S is assured because
+ *  anyone can trivially modify a signature after the fact to enforce this
+ *  property anyway.
+ *
+ *  The lower S value is always between 0x1 and
+ *  0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
+ *  inclusive.
+ *
+ *  No other forms of ECDSA malleability are known and none seem likely, but
+ *  there is no formal proof that ECDSA, even with this additional restriction,
+ *  is free of other malleability. Commonly used serialization schemes will also
+ *  accept various non-unique encodings, so care should be taken when this
+ *  property is required for an application.
+ *
+ *  The secp256k1_ecdsa_sign function will by default create signatures in the
+ *  lower-S form, and secp256k1_ecdsa_verify will not accept others. In case
+ *  signatures come from a system that cannot enforce this property,
+ *  secp256k1_ecdsa_signature_normalize must be called before verification.
+ */
+SECP256K1_API int secp256k1_ecdsa_signature_normalize(
+    const secp256k1_context *ctx,
+    secp256k1_ecdsa_signature *sigout,
+    const secp256k1_ecdsa_signature *sigin
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3);
+
+/** An implementation of RFC6979 (using HMAC-SHA256) as nonce generation function.
+ * If a data pointer is passed, it is assumed to be a pointer to 32 bytes of
+ * extra entropy.
+ */
+SECP256K1_API const secp256k1_nonce_function secp256k1_nonce_function_rfc6979;
+
+/** A default safe nonce generation function (currently equal to secp256k1_nonce_function_rfc6979). */
+SECP256K1_API const secp256k1_nonce_function secp256k1_nonce_function_default;
+
+/** Create an ECDSA signature.
+ *
+ *  Returns: 1: signature created
+ *           0: the nonce generation function failed, or the secret key was invalid.
+ *  Args:    ctx:       pointer to a context object (not secp256k1_context_static).
+ *  Out:     sig:       pointer to an array where the signature will be placed.
+ *  In:      msghash32: the 32-byte message hash being signed.
+ *           seckey:    pointer to a 32-byte secret key.
+ *           noncefp:   pointer to a nonce generation function. If NULL,
+ *                      secp256k1_nonce_function_default is used.
+ *           ndata:     pointer to arbitrary data used by the nonce generation function
+ *                      (can be NULL). If it is non-NULL and
+ *                      secp256k1_nonce_function_default is used, then ndata must be a
+ *                      pointer to 32-bytes of additional data.
+ *
+ * The created signature is always in lower-S form. See
+ * secp256k1_ecdsa_signature_normalize for more details.
+ */
+SECP256K1_API int secp256k1_ecdsa_sign(
+    const secp256k1_context *ctx,
+    secp256k1_ecdsa_signature *sig,
+    const unsigned char *msghash32,
+    const unsigned char *seckey,
+    secp256k1_nonce_function noncefp,
+    const void *ndata
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4);
+
+/** Verify an elliptic curve secret key.
+ *
+ *  A secret key is valid if it is not 0 and less than the secp256k1 curve order
+ *  when interpreted as an integer (most significant byte first). The
+ *  probability of choosing a 32-byte string uniformly at random which is an
+ *  invalid secret key is negligible. However, if it does happen it should
+ *  be assumed that the randomness source is severely broken and there should
+ *  be no retry.
+ *
+ *  Returns: 1: secret key is valid
+ *           0: secret key is invalid
+ *  Args:    ctx: pointer to a context object.
+ *  In:      seckey: pointer to a 32-byte secret key.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_verify(
+    const secp256k1_context *ctx,
+    const unsigned char *seckey
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2);
+
+/** Compute the public key for a secret key.
+ *
+ *  Returns: 1: secret was valid, public key stores.
+ *           0: secret was invalid, try again.
+ *  Args:    ctx:    pointer to a context object (not secp256k1_context_static).
+ *  Out:     pubkey: pointer to the created public key.
+ *  In:      seckey: pointer to a 32-byte secret key.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create(
+    const secp256k1_context *ctx,
+    secp256k1_pubkey *pubkey,
+    const unsigned char *seckey
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Negates a secret key in place.
+ *
+ *  Returns: 0 if the given secret key is invalid according to
+ *           secp256k1_ec_seckey_verify. 1 otherwise
+ *  Args:   ctx:    pointer to a context object
+ *  In/Out: seckey: pointer to the 32-byte secret key to be negated. If the
+ *                  secret key is invalid according to
+ *                  secp256k1_ec_seckey_verify, this function returns 0 and
+ *                  seckey will be set to some unspecified value.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_negate(
+    const secp256k1_context *ctx,
+    unsigned char *seckey
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2);
+
+/** Same as secp256k1_ec_seckey_negate, but DEPRECATED. Will be removed in
+ *  future versions. */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_negate(
+    const secp256k1_context *ctx,
+    unsigned char *seckey
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
+  SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_negate instead");
+
+/** Negates a public key in place.
+ *
+ *  Returns: 1 always
+ *  Args:   ctx:        pointer to a context object
+ *  In/Out: pubkey:     pointer to the public key to be negated.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_negate(
+    const secp256k1_context *ctx,
+    secp256k1_pubkey *pubkey
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2);
+
+/** Tweak a secret key by adding tweak to it.
+ *
+ *  Returns: 0 if the arguments are invalid or the resulting secret key would be
+ *           invalid (only when the tweak is the negation of the secret key). 1
+ *           otherwise.
+ *  Args:    ctx:   pointer to a context object.
+ *  In/Out: seckey: pointer to a 32-byte secret key. If the secret key is
+ *                  invalid according to secp256k1_ec_seckey_verify, this
+ *                  function returns 0. seckey will be set to some unspecified
+ *                  value if this function returns 0.
+ *  In:    tweak32: pointer to a 32-byte tweak, which must be valid according to
+ *                  secp256k1_ec_seckey_verify or 32 zero bytes. For uniformly
+ *                  random 32-byte tweaks, the chance of being invalid is
+ *                  negligible (around 1 in 2^128).
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_tweak_add(
+    const secp256k1_context *ctx,
+    unsigned char *seckey,
+    const unsigned char *tweak32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Same as secp256k1_ec_seckey_tweak_add, but DEPRECATED. Will be removed in
+ *  future versions. */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add(
+    const secp256k1_context *ctx,
+    unsigned char *seckey,
+    const unsigned char *tweak32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
+  SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_tweak_add instead");
+
+/** Tweak a public key by adding tweak times the generator to it.
+ *
+ *  Returns: 0 if the arguments are invalid or the resulting public key would be
+ *           invalid (only when the tweak is the negation of the corresponding
+ *           secret key). 1 otherwise.
+ *  Args:    ctx:   pointer to a context object.
+ *  In/Out: pubkey: pointer to a public key object. pubkey will be set to an
+ *                  invalid value if this function returns 0.
+ *  In:    tweak32: pointer to a 32-byte tweak, which must be valid according to
+ *                  secp256k1_ec_seckey_verify or 32 zero bytes. For uniformly
+ *                  random 32-byte tweaks, the chance of being invalid is
+ *                  negligible (around 1 in 2^128).
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add(
+    const secp256k1_context *ctx,
+    secp256k1_pubkey *pubkey,
+    const unsigned char *tweak32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Tweak a secret key by multiplying it by a tweak.
+ *
+ *  Returns: 0 if the arguments are invalid. 1 otherwise.
+ *  Args:   ctx:    pointer to a context object.
+ *  In/Out: seckey: pointer to a 32-byte secret key. If the secret key is
+ *                  invalid according to secp256k1_ec_seckey_verify, this
+ *                  function returns 0. seckey will be set to some unspecified
+ *                  value if this function returns 0.
+ *  In:    tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to
+ *                  secp256k1_ec_seckey_verify, this function returns 0. For
+ *                  uniformly random 32-byte arrays the chance of being invalid
+ *                  is negligible (around 1 in 2^128).
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_tweak_mul(
+    const secp256k1_context *ctx,
+    unsigned char *seckey,
+    const unsigned char *tweak32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Same as secp256k1_ec_seckey_tweak_mul, but DEPRECATED. Will be removed in
+ *  future versions. */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul(
+    const secp256k1_context *ctx,
+    unsigned char *seckey,
+    const unsigned char *tweak32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
+  SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_tweak_mul instead");
+
+/** Tweak a public key by multiplying it by a tweak value.
+ *
+ *  Returns: 0 if the arguments are invalid. 1 otherwise.
+ *  Args:    ctx:   pointer to a context object.
+ *  In/Out: pubkey: pointer to a public key object. pubkey will be set to an
+ *                  invalid value if this function returns 0.
+ *  In:    tweak32: pointer to a 32-byte tweak. If the tweak is invalid according to
+ *                  secp256k1_ec_seckey_verify, this function returns 0. For
+ *                  uniformly random 32-byte arrays the chance of being invalid
+ *                  is negligible (around 1 in 2^128).
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_mul(
+    const secp256k1_context *ctx,
+    secp256k1_pubkey *pubkey,
+    const unsigned char *tweak32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Randomizes the context to provide enhanced protection against side-channel leakage.
+ *
+ *  Returns: 1: randomization successful
+ *           0: error
+ *  Args:    ctx:       pointer to a context object (not secp256k1_context_static).
+ *  In:      seed32:    pointer to a 32-byte random seed (NULL resets to initial state).
+ *
+ * While secp256k1 code is written and tested to be constant-time no matter what
+ * secret values are, it is possible that a compiler may output code which is not,
+ * and also that the CPU may not emit the same radio frequencies or draw the same
+ * amount of power for all values. Randomization of the context shields against
+ * side-channel observations which aim to exploit secret-dependent behaviour in
+ * certain computations which involve secret keys.
+ *
+ * It is highly recommended to call this function on contexts returned from
+ * secp256k1_context_create or secp256k1_context_clone (or from the corresponding
+ * functions in secp256k1_preallocated.h) before using these contexts to call API
+ * functions that perform computations involving secret keys, e.g., signing and
+ * public key generation. It is possible to call this function more than once on
+ * the same context, and doing so before every few computations involving secret
+ * keys is recommended as a defense-in-depth measure. Randomization of the static
+ * context secp256k1_context_static is not supported.
+ *
+ * Currently, the random seed is mainly used for blinding multiplications of a
+ * secret scalar with the elliptic curve base point. Multiplications of this
+ * kind are performed by exactly those API functions which are documented to
+ * require a context that is not secp256k1_context_static. As a rule of thumb,
+ * these are all functions which take a secret key (or a keypair) as an input.
+ * A notable exception to that rule is the ECDH module, which relies on a different
+ * kind of elliptic curve point multiplication and thus does not benefit from
+ * enhanced protection against side-channel leakage currently.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_context_randomize(
+    secp256k1_context *ctx,
+    const unsigned char *seed32
+) SECP256K1_ARG_NONNULL(1);
+
+/** Add a number of public keys together.
+ *
+ *  Returns: 1: the sum of the public keys is valid.
+ *           0: the sum of the public keys is not valid.
+ *  Args:   ctx:        pointer to a context object.
+ *  Out:    out:        pointer to a public key object for placing the resulting public key.
+ *  In:     ins:        pointer to array of pointers to public keys.
+ *          n:          the number of public keys to add together (must be at least 1).
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_combine(
+    const secp256k1_context *ctx,
+    secp256k1_pubkey *out,
+    const secp256k1_pubkey * const *ins,
+    size_t n
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Compute a tagged hash as defined in BIP-340.
+ *
+ *  This is useful for creating a message hash and achieving domain separation
+ *  through an application-specific tag. This function returns
+ *  SHA256(SHA256(tag)||SHA256(tag)||msg). Therefore, tagged hash
+ *  implementations optimized for a specific tag can precompute the SHA256 state
+ *  after hashing the tag hashes.
+ *
+ *  Returns: 1 always.
+ *  Args:    ctx: pointer to a context object
+ *  Out:  hash32: pointer to a 32-byte array to store the resulting hash
+ *  In:      tag: pointer to an array containing the tag
+ *        taglen: length of the tag array
+ *           msg: pointer to an array containing the message
+ *        msglen: length of the message array
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_tagged_sha256(
+    const secp256k1_context *ctx,
+    unsigned char *hash32,
+    const unsigned char *tag,
+    size_t taglen,
+    const unsigned char *msg,
+    size_t msglen
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(5);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SECP256K1_H */
diff --git a/vendor/external/secp256k1/include/secp256k1_extrakeys.h b/vendor/external/secp256k1/include/secp256k1_extrakeys.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/include/secp256k1_extrakeys.h
@@ -0,0 +1,250 @@
+#ifndef SECP256K1_EXTRAKEYS_H
+#define SECP256K1_EXTRAKEYS_H
+
+#include "secp256k1.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Opaque data structure that holds a parsed and valid "x-only" public key.
+ *  An x-only pubkey encodes a point whose Y coordinate is even. It is
+ *  serialized using only its X coordinate (32 bytes). See BIP-340 for more
+ *  information about x-only pubkeys.
+ *
+ *  The exact representation of data inside is implementation defined and not
+ *  guaranteed to be portable between different platforms or versions. It is
+ *  however guaranteed to be 64 bytes in size, and can be safely copied/moved.
+ *  If you need to convert to a format suitable for storage, transmission, use
+ *  use secp256k1_xonly_pubkey_serialize and secp256k1_xonly_pubkey_parse. To
+ *  compare keys, use secp256k1_xonly_pubkey_cmp.
+ */
+typedef struct secp256k1_xonly_pubkey {
+    unsigned char data[64];
+} secp256k1_xonly_pubkey;
+
+/** Opaque data structure that holds a keypair consisting of a secret and a
+ *  public key.
+ *
+ *  The exact representation of data inside is implementation defined and not
+ *  guaranteed to be portable between different platforms or versions. It is
+ *  however guaranteed to be 96 bytes in size, and can be safely copied/moved.
+ */
+typedef struct secp256k1_keypair {
+    unsigned char data[96];
+} secp256k1_keypair;
+
+/** Parse a 32-byte sequence into a xonly_pubkey object.
+ *
+ *  Returns: 1 if the public key was fully valid.
+ *           0 if the public key could not be parsed or is invalid.
+ *
+ *  Args:   ctx: pointer to a context object.
+ *  Out: pubkey: pointer to a pubkey object. If 1 is returned, it is set to a
+ *               parsed version of input. If not, it's set to an invalid value.
+ *  In: input32: pointer to a serialized xonly_pubkey.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_xonly_pubkey_parse(
+    const secp256k1_context *ctx,
+    secp256k1_xonly_pubkey *pubkey,
+    const unsigned char *input32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Serialize an xonly_pubkey object into a 32-byte sequence.
+ *
+ *  Returns: 1 always.
+ *
+ *  Args:     ctx: pointer to a context object.
+ *  Out: output32: pointer to a 32-byte array to place the serialized key in.
+ *  In:    pubkey: pointer to a secp256k1_xonly_pubkey containing an initialized public key.
+ */
+SECP256K1_API int secp256k1_xonly_pubkey_serialize(
+    const secp256k1_context *ctx,
+    unsigned char *output32,
+    const secp256k1_xonly_pubkey *pubkey
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Compare two x-only public keys using lexicographic order
+ *
+ *  Returns: <0 if the first public key is less than the second
+ *           >0 if the first public key is greater than the second
+ *           0 if the two public keys are equal
+ *  Args: ctx:      pointer to a context object.
+ *  In:   pubkey1:  first public key to compare
+ *        pubkey2:  second public key to compare
+ */
+SECP256K1_API int secp256k1_xonly_pubkey_cmp(
+    const secp256k1_context *ctx,
+    const secp256k1_xonly_pubkey *pk1,
+    const secp256k1_xonly_pubkey *pk2
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Converts a secp256k1_pubkey into a secp256k1_xonly_pubkey.
+ *
+ *  Returns: 1 always.
+ *
+ *  Args:         ctx: pointer to a context object.
+ *  Out: xonly_pubkey: pointer to an x-only public key object for placing the converted public key.
+ *          pk_parity: Ignored if NULL. Otherwise, pointer to an integer that
+ *                     will be set to 1 if the point encoded by xonly_pubkey is
+ *                     the negation of the pubkey and set to 0 otherwise.
+ *  In:        pubkey: pointer to a public key that is converted.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_xonly_pubkey_from_pubkey(
+    const secp256k1_context *ctx,
+    secp256k1_xonly_pubkey *xonly_pubkey,
+    int *pk_parity,
+    const secp256k1_pubkey *pubkey
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(4);
+
+/** Tweak an x-only public key by adding the generator multiplied with tweak32
+ *  to it.
+ *
+ *  Note that the resulting point can not in general be represented by an x-only
+ *  pubkey because it may have an odd Y coordinate. Instead, the output_pubkey
+ *  is a normal secp256k1_pubkey.
+ *
+ *  Returns: 0 if the arguments are invalid or the resulting public key would be
+ *           invalid (only when the tweak is the negation of the corresponding
+ *           secret key). 1 otherwise.
+ *
+ *  Args:           ctx: pointer to a context object.
+ *  Out:  output_pubkey: pointer to a public key to store the result. Will be set
+ *                       to an invalid value if this function returns 0.
+ *  In: internal_pubkey: pointer to an x-only pubkey to apply the tweak to.
+ *              tweak32: pointer to a 32-byte tweak, which must be valid
+ *                       according to secp256k1_ec_seckey_verify or 32 zero
+ *                       bytes. For uniformly random 32-byte tweaks, the chance of
+ *                       being invalid is negligible (around 1 in 2^128).
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_xonly_pubkey_tweak_add(
+    const secp256k1_context *ctx,
+    secp256k1_pubkey *output_pubkey,
+    const secp256k1_xonly_pubkey *internal_pubkey,
+    const unsigned char *tweak32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4);
+
+/** Checks that a tweaked pubkey is the result of calling
+ *  secp256k1_xonly_pubkey_tweak_add with internal_pubkey and tweak32.
+ *
+ *  The tweaked pubkey is represented by its 32-byte x-only serialization and
+ *  its pk_parity, which can both be obtained by converting the result of
+ *  tweak_add to a secp256k1_xonly_pubkey.
+ *
+ *  Note that this alone does _not_ verify that the tweaked pubkey is a
+ *  commitment. If the tweak is not chosen in a specific way, the tweaked pubkey
+ *  can easily be the result of a different internal_pubkey and tweak.
+ *
+ *  Returns: 0 if the arguments are invalid or the tweaked pubkey is not the
+ *           result of tweaking the internal_pubkey with tweak32. 1 otherwise.
+ *  Args:            ctx: pointer to a context object.
+ *  In: tweaked_pubkey32: pointer to a serialized xonly_pubkey.
+ *     tweaked_pk_parity: the parity of the tweaked pubkey (whose serialization
+ *                        is passed in as tweaked_pubkey32). This must match the
+ *                        pk_parity value that is returned when calling
+ *                        secp256k1_xonly_pubkey with the tweaked pubkey, or
+ *                        this function will fail.
+ *       internal_pubkey: pointer to an x-only public key object to apply the tweak to.
+ *               tweak32: pointer to a 32-byte tweak.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_xonly_pubkey_tweak_add_check(
+    const secp256k1_context *ctx,
+    const unsigned char *tweaked_pubkey32,
+    int tweaked_pk_parity,
+    const secp256k1_xonly_pubkey *internal_pubkey,
+    const unsigned char *tweak32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5);
+
+/** Compute the keypair for a valid secret key.
+ *
+ *  See the documentation of `secp256k1_ec_seckey_verify` for more information
+ *  about the validity of secret keys.
+ *
+ *  Returns: 1: secret key is valid
+ *           0: secret key is invalid
+ *  Args:    ctx: pointer to a context object (not secp256k1_context_static).
+ *  Out: keypair: pointer to the created keypair.
+ *  In:   seckey: pointer to a 32-byte secret key.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_keypair_create(
+    const secp256k1_context *ctx,
+    secp256k1_keypair *keypair,
+    const unsigned char *seckey
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Get the secret key from a keypair.
+ *
+ *  Returns: 1 always.
+ *  Args:   ctx: pointer to a context object.
+ *  Out: seckey: pointer to a 32-byte buffer for the secret key.
+ *  In: keypair: pointer to a keypair.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_keypair_sec(
+    const secp256k1_context *ctx,
+    unsigned char *seckey,
+    const secp256k1_keypair *keypair
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Get the public key from a keypair.
+ *
+ *  Returns: 1 always.
+ *  Args:   ctx: pointer to a context object.
+ *  Out: pubkey: pointer to a pubkey object, set to the keypair public key.
+ *  In: keypair: pointer to a keypair.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_keypair_pub(
+    const secp256k1_context *ctx,
+    secp256k1_pubkey *pubkey,
+    const secp256k1_keypair *keypair
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+/** Get the x-only public key from a keypair.
+ *
+ *  This is the same as calling secp256k1_keypair_pub and then
+ *  secp256k1_xonly_pubkey_from_pubkey.
+ *
+ *  Returns: 1 always.
+ *  Args:   ctx: pointer to a context object.
+ *  Out: pubkey: pointer to an xonly_pubkey object, set to the keypair
+ *               public key after converting it to an xonly_pubkey.
+ *    pk_parity: Ignored if NULL. Otherwise, pointer to an integer that will be set to the
+ *               pk_parity argument of secp256k1_xonly_pubkey_from_pubkey.
+ *  In: keypair: pointer to a keypair.
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_keypair_xonly_pub(
+    const secp256k1_context *ctx,
+    secp256k1_xonly_pubkey *pubkey,
+    int *pk_parity,
+    const secp256k1_keypair *keypair
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(4);
+
+/** Tweak a keypair by adding tweak32 to the secret key and updating the public
+ *  key accordingly.
+ *
+ *  Calling this function and then secp256k1_keypair_pub results in the same
+ *  public key as calling secp256k1_keypair_xonly_pub and then
+ *  secp256k1_xonly_pubkey_tweak_add.
+ *
+ *  Returns: 0 if the arguments are invalid or the resulting keypair would be
+ *           invalid (only when the tweak is the negation of the keypair's
+ *           secret key). 1 otherwise.
+ *
+ *  Args:       ctx: pointer to a context object.
+ *  In/Out: keypair: pointer to a keypair to apply the tweak to. Will be set to
+ *                   an invalid value if this function returns 0.
+ *  In:     tweak32: pointer to a 32-byte tweak, which must be valid according to
+ *                   secp256k1_ec_seckey_verify or 32 zero bytes. For uniformly
+ *                   random 32-byte tweaks, the chance of being invalid is
+ *                   negligible (around 1 in 2^128).
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_keypair_xonly_tweak_add(
+    const secp256k1_context *ctx,
+    secp256k1_keypair *keypair,
+    const unsigned char *tweak32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SECP256K1_EXTRAKEYS_H */
diff --git a/vendor/external/secp256k1/include/secp256k1_preallocated.h b/vendor/external/secp256k1/include/secp256k1_preallocated.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/include/secp256k1_preallocated.h
@@ -0,0 +1,134 @@
+#ifndef SECP256K1_PREALLOCATED_H
+#define SECP256K1_PREALLOCATED_H
+
+#include "secp256k1.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The module provided by this header file is intended for settings in which it
+ * is not possible or desirable to rely on dynamic memory allocation. It provides
+ * functions for creating, cloning, and destroying secp256k1 context objects in a
+ * contiguous fixed-size block of memory provided by the caller.
+ *
+ * Context objects created by functions in this module can be used like contexts
+ * objects created by functions in secp256k1.h, i.e., they can be passed to any
+ * API function that expects a context object (see secp256k1.h for details). The
+ * only exception is that context objects created by functions in this module
+ * must be destroyed using secp256k1_context_preallocated_destroy (in this
+ * module) instead of secp256k1_context_destroy (in secp256k1.h).
+ *
+ * It is guaranteed that functions in this module will not call malloc or its
+ * friends realloc, calloc, and free.
+ */
+
+/** Determine the memory size of a secp256k1 context object to be created in
+ *  caller-provided memory.
+ *
+ *  The purpose of this function is to determine how much memory must be provided
+ *  to secp256k1_context_preallocated_create.
+ *
+ *  Returns: the required size of the caller-provided memory block
+ *  In:      flags:    which parts of the context to initialize.
+ */
+SECP256K1_API size_t secp256k1_context_preallocated_size(
+    unsigned int flags
+) SECP256K1_WARN_UNUSED_RESULT;
+
+/** Create a secp256k1 context object in caller-provided memory.
+ *
+ *  The caller must provide a pointer to a rewritable contiguous block of memory
+ *  of size at least secp256k1_context_preallocated_size(flags) bytes, suitably
+ *  aligned to hold an object of any type.
+ *
+ *  The block of memory is exclusively owned by the created context object during
+ *  the lifetime of this context object, which begins with the call to this
+ *  function and ends when a call to secp256k1_context_preallocated_destroy
+ *  (which destroys the context object again) returns. During the lifetime of the
+ *  context object, the caller is obligated not to access this block of memory,
+ *  i.e., the caller may not read or write the memory, e.g., by copying the memory
+ *  contents to a different location or trying to create a second context object
+ *  in the memory. In simpler words, the prealloc pointer (or any pointer derived
+ *  from it) should not be used during the lifetime of the context object.
+ *
+ *  Returns: pointer to newly created context object.
+ *  In:      prealloc: pointer to a rewritable contiguous block of memory of
+ *                     size at least secp256k1_context_preallocated_size(flags)
+ *                     bytes, as detailed above.
+ *           flags:    which parts of the context to initialize.
+ *
+ *  See secp256k1_context_create (in secp256k1.h) for further details.
+ *
+ *  See also secp256k1_context_randomize (in secp256k1.h)
+ *  and secp256k1_context_preallocated_destroy.
+ */
+SECP256K1_API secp256k1_context *secp256k1_context_preallocated_create(
+    void *prealloc,
+    unsigned int flags
+) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT;
+
+/** Determine the memory size of a secp256k1 context object to be copied into
+ *  caller-provided memory.
+ *
+ *  Returns: the required size of the caller-provided memory block.
+ *  In:      ctx: pointer to a context to copy.
+ */
+SECP256K1_API size_t secp256k1_context_preallocated_clone_size(
+    const secp256k1_context *ctx
+) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT;
+
+/** Copy a secp256k1 context object into caller-provided memory.
+ *
+ *  The caller must provide a pointer to a rewritable contiguous block of memory
+ *  of size at least secp256k1_context_preallocated_size(flags) bytes, suitably
+ *  aligned to hold an object of any type.
+ *
+ *  The block of memory is exclusively owned by the created context object during
+ *  the lifetime of this context object, see the description of
+ *  secp256k1_context_preallocated_create for details.
+ *
+ *  Cloning secp256k1_context_static is not possible, and should not be emulated by
+ *  the caller (e.g., using memcpy). Create a new context instead.
+ *
+ *  Returns: pointer to a newly created context object.
+ *  Args:    ctx:      pointer to a context to copy (not secp256k1_context_static).
+ *  In:      prealloc: pointer to a rewritable contiguous block of memory of
+ *                     size at least secp256k1_context_preallocated_size(flags)
+ *                     bytes, as detailed above.
+ */
+SECP256K1_API secp256k1_context *secp256k1_context_preallocated_clone(
+    const secp256k1_context *ctx,
+    void *prealloc
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_WARN_UNUSED_RESULT;
+
+/** Destroy a secp256k1 context object that has been created in
+ *  caller-provided memory.
+ *
+ *  The context pointer may not be used afterwards.
+ *
+ *  The context to destroy must have been created using
+ *  secp256k1_context_preallocated_create or secp256k1_context_preallocated_clone.
+ *  If the context has instead been created using secp256k1_context_create or
+ *  secp256k1_context_clone, the behaviour is undefined. In that case,
+ *  secp256k1_context_destroy must be used instead.
+ *
+ *  If required, it is the responsibility of the caller to deallocate the block
+ *  of memory properly after this function returns, e.g., by calling free on the
+ *  preallocated pointer given to secp256k1_context_preallocated_create or
+ *  secp256k1_context_preallocated_clone.
+ *
+ *  Args:   ctx: pointer to a context to destroy, constructed using
+ *               secp256k1_context_preallocated_create or
+ *               secp256k1_context_preallocated_clone
+ *               (i.e., not secp256k1_context_static).
+ */
+SECP256K1_API void secp256k1_context_preallocated_destroy(
+    secp256k1_context *ctx
+) SECP256K1_ARG_NONNULL(1);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SECP256K1_PREALLOCATED_H */
diff --git a/vendor/external/secp256k1/include/secp256k1_schnorrsig.h b/vendor/external/secp256k1/include/secp256k1_schnorrsig.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/include/secp256k1_schnorrsig.h
@@ -0,0 +1,190 @@
+#ifndef SECP256K1_SCHNORRSIG_H
+#define SECP256K1_SCHNORRSIG_H
+
+#include "secp256k1.h"
+#include "secp256k1_extrakeys.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** This module implements a variant of Schnorr signatures compliant with
+ *  Bitcoin Improvement Proposal 340 "Schnorr Signatures for secp256k1"
+ *  (https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki).
+ */
+
+/** A pointer to a function to deterministically generate a nonce.
+ *
+ *  Same as secp256k1_nonce function with the exception of accepting an
+ *  additional pubkey argument and not requiring an attempt argument. The pubkey
+ *  argument can protect signature schemes with key-prefixed challenge hash
+ *  inputs against reusing the nonce when signing with the wrong precomputed
+ *  pubkey.
+ *
+ *  Returns: 1 if a nonce was successfully generated. 0 will cause signing to
+ *           return an error.
+ *  Out:  nonce32: pointer to a 32-byte array to be filled by the function
+ *  In:       msg: the message being verified. Is NULL if and only if msglen
+ *                 is 0.
+ *         msglen: the length of the message
+ *          key32: pointer to a 32-byte secret key (will not be NULL)
+ *     xonly_pk32: the 32-byte serialized xonly pubkey corresponding to key32
+ *                 (will not be NULL)
+ *           algo: pointer to an array describing the signature
+ *                 algorithm (will not be NULL)
+ *        algolen: the length of the algo array
+ *           data: arbitrary data pointer that is passed through
+ *
+ *  Except for test cases, this function should compute some cryptographic hash of
+ *  the message, the key, the pubkey, the algorithm description, and data.
+ */
+typedef int (*secp256k1_nonce_function_hardened)(
+    unsigned char *nonce32,
+    const unsigned char *msg,
+    size_t msglen,
+    const unsigned char *key32,
+    const unsigned char *xonly_pk32,
+    const unsigned char *algo,
+    size_t algolen,
+    void *data
+);
+
+/** An implementation of the nonce generation function as defined in Bitcoin
+ *  Improvement Proposal 340 "Schnorr Signatures for secp256k1"
+ *  (https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki).
+ *
+ *  If a data pointer is passed, it is assumed to be a pointer to 32 bytes of
+ *  auxiliary random data as defined in BIP-340. If the data pointer is NULL,
+ *  the nonce derivation procedure follows BIP-340 by setting the auxiliary
+ *  random data to zero. The algo argument must be non-NULL, otherwise the
+ *  function will fail and return 0. The hash will be tagged with algo.
+ *  Therefore, to create BIP-340 compliant signatures, algo must be set to
+ *  "BIP0340/nonce" and algolen to 13.
+ */
+SECP256K1_API const secp256k1_nonce_function_hardened secp256k1_nonce_function_bip340;
+
+/** Data structure that contains additional arguments for schnorrsig_sign_custom.
+ *
+ *  A schnorrsig_extraparams structure object can be initialized correctly by
+ *  setting it to SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT.
+ *
+ *  Members:
+ *      magic: set to SECP256K1_SCHNORRSIG_EXTRAPARAMS_MAGIC at initialization
+ *             and has no other function than making sure the object is
+ *             initialized.
+ *    noncefp: pointer to a nonce generation function. If NULL,
+ *             secp256k1_nonce_function_bip340 is used
+ *      ndata: pointer to arbitrary data used by the nonce generation function
+ *             (can be NULL). If it is non-NULL and
+ *             secp256k1_nonce_function_bip340 is used, then ndata must be a
+ *             pointer to 32-byte auxiliary randomness as per BIP-340.
+ */
+typedef struct secp256k1_schnorrsig_extraparams {
+    unsigned char magic[4];
+    secp256k1_nonce_function_hardened noncefp;
+    void *ndata;
+} secp256k1_schnorrsig_extraparams;
+
+#define SECP256K1_SCHNORRSIG_EXTRAPARAMS_MAGIC { 0xda, 0x6f, 0xb3, 0x8c }
+#define SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT {\
+    SECP256K1_SCHNORRSIG_EXTRAPARAMS_MAGIC,\
+    NULL,\
+    NULL\
+}
+
+/** Create a Schnorr signature.
+ *
+ *  Does _not_ strictly follow BIP-340 because it does not verify the resulting
+ *  signature. Instead, you can manually use secp256k1_schnorrsig_verify and
+ *  abort if it fails.
+ *
+ *  This function only signs 32-byte messages. If you have messages of a
+ *  different size (or the same size but without a context-specific tag
+ *  prefix), it is recommended to create a 32-byte message hash with
+ *  secp256k1_tagged_sha256 and then sign the hash. Tagged hashing allows
+ *  providing an context-specific tag for domain separation. This prevents
+ *  signatures from being valid in multiple contexts by accident.
+ *
+ *  Returns 1 on success, 0 on failure.
+ *  Args:    ctx: pointer to a context object (not secp256k1_context_static).
+ *  Out:   sig64: pointer to a 64-byte array to store the serialized signature.
+ *  In:    msg32: the 32-byte message being signed.
+ *       keypair: pointer to an initialized keypair.
+ *    aux_rand32: 32 bytes of fresh randomness. While recommended to provide
+ *                this, it is only supplemental to security and can be NULL. A
+ *                NULL argument is treated the same as an all-zero one. See
+ *                BIP-340 "Default Signing" for a full explanation of this
+ *                argument and for guidance if randomness is expensive.
+ */
+SECP256K1_API int secp256k1_schnorrsig_sign32(
+    const secp256k1_context *ctx,
+    unsigned char *sig64,
+    const unsigned char *msg32,
+    const secp256k1_keypair *keypair,
+    const unsigned char *aux_rand32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4);
+
+/** Same as secp256k1_schnorrsig_sign32, but DEPRECATED. Will be removed in
+ *  future versions. */
+SECP256K1_API int secp256k1_schnorrsig_sign(
+    const secp256k1_context *ctx,
+    unsigned char *sig64,
+    const unsigned char *msg32,
+    const secp256k1_keypair *keypair,
+    const unsigned char *aux_rand32
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
+  SECP256K1_DEPRECATED("Use secp256k1_schnorrsig_sign32 instead");
+
+/** Create a Schnorr signature with a more flexible API.
+ *
+ *  Same arguments as secp256k1_schnorrsig_sign except that it allows signing
+ *  variable length messages and accepts a pointer to an extraparams object that
+ *  allows customizing signing by passing additional arguments.
+ *
+ *  Equivalent to secp256k1_schnorrsig_sign32(..., aux_rand32) if msglen is 32
+ *  and extraparams is initialized as follows:
+ *  ```
+ *  secp256k1_schnorrsig_extraparams extraparams = SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT;
+ *  extraparams.ndata = (unsigned char*)aux_rand32;
+ *  ```
+ *
+ *  Returns 1 on success, 0 on failure.
+ *  Args:   ctx: pointer to a context object (not secp256k1_context_static).
+ *  Out:  sig64: pointer to a 64-byte array to store the serialized signature.
+ *  In:     msg: the message being signed. Can only be NULL if msglen is 0.
+ *       msglen: length of the message.
+ *      keypair: pointer to an initialized keypair.
+ *  extraparams: pointer to an extraparams object (can be NULL).
+ */
+SECP256K1_API int secp256k1_schnorrsig_sign_custom(
+    const secp256k1_context *ctx,
+    unsigned char *sig64,
+    const unsigned char *msg,
+    size_t msglen,
+    const secp256k1_keypair *keypair,
+    secp256k1_schnorrsig_extraparams *extraparams
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(5);
+
+/** Verify a Schnorr signature.
+ *
+ *  Returns: 1: correct signature
+ *           0: incorrect signature
+ *  Args:    ctx: pointer to a context object.
+ *  In:    sig64: pointer to the 64-byte signature to verify.
+ *           msg: the message being verified. Can only be NULL if msglen is 0.
+ *        msglen: length of the message
+ *        pubkey: pointer to an x-only public key to verify with
+ */
+SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_schnorrsig_verify(
+    const secp256k1_context *ctx,
+    const unsigned char *sig64,
+    const unsigned char *msg,
+    size_t msglen,
+    const secp256k1_xonly_pubkey *pubkey
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(5);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SECP256K1_SCHNORRSIG_H */
diff --git a/vendor/external/secp256k1/src/assumptions.h b/vendor/external/secp256k1/src/assumptions.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/assumptions.h
@@ -0,0 +1,87 @@
+/***********************************************************************
+ * Copyright (c) 2020 Pieter Wuille                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_ASSUMPTIONS_H
+#define SECP256K1_ASSUMPTIONS_H
+
+#include <limits.h>
+
+#include "util.h"
+#if defined(SECP256K1_INT128_NATIVE)
+#include "int128_native.h"
+#endif
+
+/* This library, like most software, relies on a number of compiler implementation defined (but not undefined)
+   behaviours. Although the behaviours we require are essentially universal we test them specifically here to
+   reduce the odds of experiencing an unwelcome surprise.
+*/
+
+#if defined(__has_attribute)
+# if __has_attribute(__unavailable__)
+__attribute__((__unavailable__("Don't call this function. It only exists because STATIC_ASSERT cannot be used outside a function.")))
+# endif
+#endif
+static void secp256k1_assumption_checker(void) {
+    /* Bytes are 8 bits. */
+    STATIC_ASSERT(CHAR_BIT == 8);
+
+    /* No integer promotion for uint32_t. This ensures that we can multiply uintXX_t values where XX >= 32
+       without signed overflow, which would be undefined behaviour. */
+    STATIC_ASSERT(UINT_MAX <= UINT32_MAX);
+
+    /* Conversions from unsigned to signed outside of the bounds of the signed type are
+       implementation-defined. Verify that they function as reinterpreting the lower
+       bits of the input in two's complement notation. Do this for conversions:
+       - from uint(N)_t to int(N)_t with negative result
+       - from uint(2N)_t to int(N)_t with negative result
+       - from int(2N)_t to int(N)_t with negative result
+       - from int(2N)_t to int(N)_t with positive result */
+
+    /* To int8_t. */
+    STATIC_ASSERT(((int8_t)(uint8_t)0xAB == (int8_t)-(int8_t)0x55));
+    STATIC_ASSERT((int8_t)(uint16_t)0xABCD == (int8_t)-(int8_t)0x33);
+    STATIC_ASSERT((int8_t)(int16_t)(uint16_t)0xCDEF == (int8_t)(uint8_t)0xEF);
+    STATIC_ASSERT((int8_t)(int16_t)(uint16_t)0x9234 == (int8_t)(uint8_t)0x34);
+
+    /* To int16_t. */
+    STATIC_ASSERT((int16_t)(uint16_t)0xBCDE == (int16_t)-(int16_t)0x4322);
+    STATIC_ASSERT((int16_t)(uint32_t)0xA1B2C3D4 == (int16_t)-(int16_t)0x3C2C);
+    STATIC_ASSERT((int16_t)(int32_t)(uint32_t)0xC1D2E3F4 == (int16_t)(uint16_t)0xE3F4);
+    STATIC_ASSERT((int16_t)(int32_t)(uint32_t)0x92345678 == (int16_t)(uint16_t)0x5678);
+
+    /* To int32_t. */
+    STATIC_ASSERT((int32_t)(uint32_t)0xB2C3D4E5 == (int32_t)-(int32_t)0x4D3C2B1B);
+    STATIC_ASSERT((int32_t)(uint64_t)0xA123B456C789D012ULL == (int32_t)-(int32_t)0x38762FEE);
+    STATIC_ASSERT((int32_t)(int64_t)(uint64_t)0xC1D2E3F4A5B6C7D8ULL == (int32_t)(uint32_t)0xA5B6C7D8);
+    STATIC_ASSERT((int32_t)(int64_t)(uint64_t)0xABCDEF0123456789ULL == (int32_t)(uint32_t)0x23456789);
+
+    /* To int64_t. */
+    STATIC_ASSERT((int64_t)(uint64_t)0xB123C456D789E012ULL == (int64_t)-(int64_t)0x4EDC3BA928761FEEULL);
+#if defined(SECP256K1_INT128_NATIVE)
+    STATIC_ASSERT((int64_t)(((uint128_t)0xA1234567B8901234ULL << 64) + 0xC5678901D2345678ULL) == (int64_t)-(int64_t)0x3A9876FE2DCBA988ULL);
+    STATIC_ASSERT(((int64_t)(int128_t)(((uint128_t)0xB1C2D3E4F5A6B7C8ULL << 64) + 0xD9E0F1A2B3C4D5E6ULL)) == (int64_t)(uint64_t)0xD9E0F1A2B3C4D5E6ULL);
+    STATIC_ASSERT(((int64_t)(int128_t)(((uint128_t)0xABCDEF0123456789ULL << 64) + 0x0123456789ABCDEFULL)) == (int64_t)(uint64_t)0x0123456789ABCDEFULL);
+
+    /* To int128_t. */
+    STATIC_ASSERT((int128_t)(((uint128_t)0xB1234567C8901234ULL << 64) + 0xD5678901E2345678ULL) == (int128_t)(-(int128_t)0x8E1648B3F50E80DCULL * 0x8E1648B3F50E80DDULL + 0x5EA688D5482F9464ULL));
+#endif
+
+    /* Right shift on negative signed values is implementation defined. Verify that it
+       acts as a right shift in two's complement with sign extension (i.e duplicating
+       the top bit into newly added bits). */
+    STATIC_ASSERT((((int8_t)0xE8) >> 2) == (int8_t)(uint8_t)0xFA);
+    STATIC_ASSERT((((int16_t)0xE9AC) >> 4) == (int16_t)(uint16_t)0xFE9A);
+    STATIC_ASSERT((((int32_t)0x937C918A) >> 9) == (int32_t)(uint32_t)0xFFC9BE48);
+    STATIC_ASSERT((((int64_t)0xA8B72231DF9CF4B9ULL) >> 19) == (int64_t)(uint64_t)0xFFFFF516E4463BF3ULL);
+#if defined(SECP256K1_INT128_NATIVE)
+    STATIC_ASSERT((((int128_t)(((uint128_t)0xCD833A65684A0DBCULL << 64) + 0xB349312F71EA7637ULL)) >> 39) == (int128_t)(((uint128_t)0xFFFFFFFFFF9B0674ULL << 64) + 0xCAD0941B79669262ULL));
+#endif
+
+    /* This function is not supposed to be called. */
+    VERIFY_CHECK(0);
+}
+
+#endif /* SECP256K1_ASSUMPTIONS_H */
diff --git a/vendor/external/secp256k1/src/checkmem.h b/vendor/external/secp256k1/src/checkmem.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/checkmem.h
@@ -0,0 +1,102 @@
+/***********************************************************************
+ * Copyright (c) 2022 Pieter Wuille                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+/* The code here is inspired by Kris Kwiatkowski's approach in
+ * https://github.com/kriskwiatkowski/pqc/blob/main/src/common/ct_check.h
+ * to provide a general interface for memory-checking mechanisms, primarily
+ * for constant-time checking.
+ */
+
+/* These macros are defined by this header file:
+ *
+ * - SECP256K1_CHECKMEM_ENABLED:
+ *   - 1 if memory-checking integration is available, 0 otherwise.
+ *     This is just a compile-time macro. Use the next macro to check it is actually
+ *     available at runtime.
+ * - SECP256K1_CHECKMEM_RUNNING():
+ *   - Acts like a function call, returning 1 if memory checking is available
+ *     at runtime.
+ * - SECP256K1_CHECKMEM_CHECK(p, len):
+ *   - Assert or otherwise fail in case the len-byte memory block pointed to by p is
+ *     not considered entirely defined.
+ * - SECP256K1_CHECKMEM_CHECK_VERIFY(p, len):
+ *   - Like SECP256K1_CHECKMEM_CHECK, but only works in VERIFY mode.
+ * - SECP256K1_CHECKMEM_UNDEFINE(p, len):
+ *   - marks the len-byte memory block pointed to by p as undefined data (secret data,
+ *     in the context of constant-time checking).
+ * - SECP256K1_CHECKMEM_DEFINE(p, len):
+ *   - marks the len-byte memory pointed to by p as defined data (public data, in the
+ *     context of constant-time checking).
+ * - SECP256K1_CHECKMEM_MSAN_DEFINE(p, len):
+ *   - Like SECP256K1_CHECKMEM_DEFINE, but applies only to memory_sanitizer.
+ *
+ */
+
+#ifndef SECP256K1_CHECKMEM_H
+#define SECP256K1_CHECKMEM_H
+
+/* Define a statement-like macro that ignores the arguments. */
+#define SECP256K1_CHECKMEM_NOOP(p, len) do { (void)(p); (void)(len); } while(0)
+
+/* If compiling under msan, map the SECP256K1_CHECKMEM_* functionality to msan.
+ * Choose this preferentially, even when VALGRIND is defined, as msan-compiled
+ * binaries can't be run under valgrind anyway. */
+#if defined(__has_feature)
+#  if __has_feature(memory_sanitizer)
+#    include <sanitizer/msan_interface.h>
+#    define SECP256K1_CHECKMEM_ENABLED 1
+#    define SECP256K1_CHECKMEM_UNDEFINE(p, len) __msan_allocated_memory((p), (len))
+#    define SECP256K1_CHECKMEM_DEFINE(p, len) __msan_unpoison((p), (len))
+#    define SECP256K1_CHECKMEM_MSAN_DEFINE(p, len) __msan_unpoison((p), (len))
+#    define SECP256K1_CHECKMEM_CHECK(p, len) __msan_check_mem_is_initialized((p), (len))
+#    define SECP256K1_CHECKMEM_RUNNING() (1)
+#  endif
+#endif
+
+#if !defined SECP256K1_CHECKMEM_MSAN_DEFINE
+#  define SECP256K1_CHECKMEM_MSAN_DEFINE(p, len) SECP256K1_CHECKMEM_NOOP((p), (len))
+#endif
+
+/* If valgrind integration is desired (through the VALGRIND define), implement the
+ * SECP256K1_CHECKMEM_* macros using valgrind. */
+#if !defined SECP256K1_CHECKMEM_ENABLED
+#  if defined VALGRIND
+#    include <stddef.h>
+#  if defined(__clang__) && defined(__APPLE__)
+#    pragma clang diagnostic push
+#    pragma clang diagnostic ignored "-Wreserved-identifier"
+#  endif
+#    include <valgrind/memcheck.h>
+#  if defined(__clang__) && defined(__APPLE__)
+#    pragma clang diagnostic pop
+#  endif
+#    define SECP256K1_CHECKMEM_ENABLED 1
+#    define SECP256K1_CHECKMEM_UNDEFINE(p, len) VALGRIND_MAKE_MEM_UNDEFINED((p), (len))
+#    define SECP256K1_CHECKMEM_DEFINE(p, len) VALGRIND_MAKE_MEM_DEFINED((p), (len))
+#    define SECP256K1_CHECKMEM_CHECK(p, len) VALGRIND_CHECK_MEM_IS_DEFINED((p), (len))
+     /* VALGRIND_MAKE_MEM_DEFINED returns 0 iff not running on memcheck.
+      * This is more precise than the RUNNING_ON_VALGRIND macro, which
+      * checks for valgrind in general instead of memcheck specifically. */
+#    define SECP256K1_CHECKMEM_RUNNING() (VALGRIND_MAKE_MEM_DEFINED(NULL, 0) != 0)
+#  endif
+#endif
+
+/* As a fall-back, map these macros to dummy statements. */
+#if !defined SECP256K1_CHECKMEM_ENABLED
+#  define SECP256K1_CHECKMEM_ENABLED 0
+#  define SECP256K1_CHECKMEM_UNDEFINE(p, len) SECP256K1_CHECKMEM_NOOP((p), (len))
+#  define SECP256K1_CHECKMEM_DEFINE(p, len) SECP256K1_CHECKMEM_NOOP((p), (len))
+#  define SECP256K1_CHECKMEM_CHECK(p, len) SECP256K1_CHECKMEM_NOOP((p), (len))
+#  define SECP256K1_CHECKMEM_RUNNING() (0)
+#endif
+
+#if defined VERIFY
+#define SECP256K1_CHECKMEM_CHECK_VERIFY(p, len) SECP256K1_CHECKMEM_CHECK((p), (len))
+#else
+#define SECP256K1_CHECKMEM_CHECK_VERIFY(p, len) SECP256K1_CHECKMEM_NOOP((p), (len))
+#endif
+
+#endif /* SECP256K1_CHECKMEM_H */
diff --git a/vendor/external/secp256k1/src/ecdsa.h b/vendor/external/secp256k1/src/ecdsa.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecdsa.h
@@ -0,0 +1,21 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_ECDSA_H
+#define SECP256K1_ECDSA_H
+
+#include <stddef.h>
+
+#include "scalar.h"
+#include "group.h"
+#include "ecmult.h"
+
+static int secp256k1_ecdsa_sig_parse(secp256k1_scalar *r, secp256k1_scalar *s, const unsigned char *sig, size_t size);
+static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const secp256k1_scalar *r, const secp256k1_scalar *s);
+static int secp256k1_ecdsa_sig_verify(const secp256k1_scalar* r, const secp256k1_scalar* s, const secp256k1_ge *pubkey, const secp256k1_scalar *message);
+static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, secp256k1_scalar* r, secp256k1_scalar* s, const secp256k1_scalar *seckey, const secp256k1_scalar *message, const secp256k1_scalar *nonce, int *recid);
+
+#endif /* SECP256K1_ECDSA_H */
diff --git a/vendor/external/secp256k1/src/ecdsa_impl.h b/vendor/external/secp256k1/src/ecdsa_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecdsa_impl.h
@@ -0,0 +1,304 @@
+/***********************************************************************
+ * Copyright (c) 2013-2015 Pieter Wuille                               *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+
+#ifndef SECP256K1_ECDSA_IMPL_H
+#define SECP256K1_ECDSA_IMPL_H
+
+#include "scalar.h"
+#include "field.h"
+#include "group.h"
+#include "ecmult.h"
+#include "ecmult_gen.h"
+#include "ecdsa.h"
+
+/** Group order for secp256k1 defined as 'n' in "Standards for Efficient Cryptography" (SEC2) 2.7.1
+ *  $ sage -c 'load("secp256k1_params.sage"); print(hex(N))'
+ *  0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
+ */
+static const secp256k1_fe secp256k1_ecdsa_const_order_as_fe = SECP256K1_FE_CONST(
+    0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFEUL,
+    0xBAAEDCE6UL, 0xAF48A03BUL, 0xBFD25E8CUL, 0xD0364141UL
+);
+
+/** Difference between field and order, values 'p' and 'n' values defined in
+ *  "Standards for Efficient Cryptography" (SEC2) 2.7.1.
+ *  $ sage -c 'load("secp256k1_params.sage"); print(hex(P-N))'
+ *  0x14551231950b75fc4402da1722fc9baee
+ */
+static const secp256k1_fe secp256k1_ecdsa_const_p_minus_order = SECP256K1_FE_CONST(
+    0, 0, 0, 1, 0x45512319UL, 0x50B75FC4UL, 0x402DA172UL, 0x2FC9BAEEUL
+);
+
+static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const unsigned char *sigend) {
+    size_t lenleft;
+    unsigned char b1;
+    VERIFY_CHECK(len != NULL);
+    *len = 0;
+    if (*sigp >= sigend) {
+        return 0;
+    }
+    b1 = *((*sigp)++);
+    if (b1 == 0xFF) {
+        /* X.690-0207 8.1.3.5.c the value 0xFF shall not be used. */
+        return 0;
+    }
+    if ((b1 & 0x80) == 0) {
+        /* X.690-0207 8.1.3.4 short form length octets */
+        *len = b1;
+        return 1;
+    }
+    if (b1 == 0x80) {
+        /* Indefinite length is not allowed in DER. */
+        return 0;
+    }
+    /* X.690-207 8.1.3.5 long form length octets */
+    lenleft = b1 & 0x7F; /* lenleft is at least 1 */
+    if (lenleft > (size_t)(sigend - *sigp)) {
+        return 0;
+    }
+    if (**sigp == 0) {
+        /* Not the shortest possible length encoding. */
+        return 0;
+    }
+    if (lenleft > sizeof(size_t)) {
+        /* The resulting length would exceed the range of a size_t, so
+         * it is certainly longer than the passed array size. */
+        return 0;
+    }
+    while (lenleft > 0) {
+        *len = (*len << 8) | **sigp;
+        (*sigp)++;
+        lenleft--;
+    }
+    if (*len > (size_t)(sigend - *sigp)) {
+        /* Result exceeds the length of the passed array.
+           (Checking this is the responsibility of the caller but it
+           can't hurt do it here, too.) */
+        return 0;
+    }
+    if (*len < 128) {
+        /* Not the shortest possible length encoding. */
+        return 0;
+    }
+    return 1;
+}
+
+static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char **sig, const unsigned char *sigend) {
+    int overflow = 0;
+    unsigned char ra[32] = {0};
+    size_t rlen;
+
+    if (*sig == sigend || **sig != 0x02) {
+        /* Not a primitive integer (X.690-0207 8.3.1). */
+        return 0;
+    }
+    (*sig)++;
+    if (secp256k1_der_read_len(&rlen, sig, sigend) == 0) {
+        return 0;
+    }
+    if (rlen == 0 || rlen > (size_t)(sigend - *sig)) {
+        /* Exceeds bounds or not at least length 1 (X.690-0207 8.3.1).  */
+        return 0;
+    }
+    if (**sig == 0x00 && rlen > 1 && (((*sig)[1]) & 0x80) == 0x00) {
+        /* Excessive 0x00 padding. */
+        return 0;
+    }
+    if (**sig == 0xFF && rlen > 1 && (((*sig)[1]) & 0x80) == 0x80) {
+        /* Excessive 0xFF padding. */
+        return 0;
+    }
+    if ((**sig & 0x80) == 0x80) {
+        /* Negative. */
+        overflow = 1;
+    }
+    /* There is at most one leading zero byte:
+     * if there were two leading zero bytes, we would have failed and returned 0
+     * because of excessive 0x00 padding already. */
+    if (rlen > 0 && **sig == 0) {
+        /* Skip leading zero byte */
+        rlen--;
+        (*sig)++;
+    }
+    if (rlen > 32) {
+        overflow = 1;
+    }
+    if (!overflow) {
+        if (rlen) memcpy(ra + 32 - rlen, *sig, rlen);
+        secp256k1_scalar_set_b32(r, ra, &overflow);
+    }
+    if (overflow) {
+        secp256k1_scalar_set_int(r, 0);
+    }
+    (*sig) += rlen;
+    return 1;
+}
+
+static int secp256k1_ecdsa_sig_parse(secp256k1_scalar *rr, secp256k1_scalar *rs, const unsigned char *sig, size_t size) {
+    const unsigned char *sigend = sig + size;
+    size_t rlen;
+    if (sig == sigend || *(sig++) != 0x30) {
+        /* The encoding doesn't start with a constructed sequence (X.690-0207 8.9.1). */
+        return 0;
+    }
+    if (secp256k1_der_read_len(&rlen, &sig, sigend) == 0) {
+        return 0;
+    }
+    if (rlen != (size_t)(sigend - sig)) {
+        /* Tuple exceeds bounds or garage after tuple. */
+        return 0;
+    }
+
+    if (!secp256k1_der_parse_integer(rr, &sig, sigend)) {
+        return 0;
+    }
+    if (!secp256k1_der_parse_integer(rs, &sig, sigend)) {
+        return 0;
+    }
+
+    if (sig != sigend) {
+        /* Trailing garbage inside tuple. */
+        return 0;
+    }
+
+    return 1;
+}
+
+static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const secp256k1_scalar* ar, const secp256k1_scalar* as) {
+    unsigned char r[33] = {0}, s[33] = {0};
+    unsigned char *rp = r, *sp = s;
+    size_t lenR = 33, lenS = 33;
+    secp256k1_scalar_get_b32(&r[1], ar);
+    secp256k1_scalar_get_b32(&s[1], as);
+    while (lenR > 1 && rp[0] == 0 && rp[1] < 0x80) { lenR--; rp++; }
+    while (lenS > 1 && sp[0] == 0 && sp[1] < 0x80) { lenS--; sp++; }
+    if (*size < 6+lenS+lenR) {
+        *size = 6 + lenS + lenR;
+        return 0;
+    }
+    *size = 6 + lenS + lenR;
+    sig[0] = 0x30;
+    sig[1] = 4 + lenS + lenR;
+    sig[2] = 0x02;
+    sig[3] = lenR;
+    memcpy(sig+4, rp, lenR);
+    sig[4+lenR] = 0x02;
+    sig[5+lenR] = lenS;
+    memcpy(sig+lenR+6, sp, lenS);
+    return 1;
+}
+
+static int secp256k1_ecdsa_sig_verify(const secp256k1_scalar *sigr, const secp256k1_scalar *sigs, const secp256k1_ge *pubkey, const secp256k1_scalar *message) {
+    unsigned char c[32];
+    secp256k1_scalar sn, u1, u2;
+#if !defined(EXHAUSTIVE_TEST_ORDER)
+    secp256k1_fe xr;
+#endif
+    secp256k1_gej pubkeyj;
+    secp256k1_gej pr;
+
+    if (secp256k1_scalar_is_zero(sigr) || secp256k1_scalar_is_zero(sigs)) {
+        return 0;
+    }
+
+    secp256k1_scalar_inverse_var(&sn, sigs);
+    secp256k1_scalar_mul(&u1, &sn, message);
+    secp256k1_scalar_mul(&u2, &sn, sigr);
+    secp256k1_gej_set_ge(&pubkeyj, pubkey);
+    secp256k1_ecmult(&pr, &pubkeyj, &u2, &u1);
+    if (secp256k1_gej_is_infinity(&pr)) {
+        return 0;
+    }
+
+#if defined(EXHAUSTIVE_TEST_ORDER)
+{
+    secp256k1_scalar computed_r;
+    secp256k1_ge pr_ge;
+    secp256k1_ge_set_gej(&pr_ge, &pr);
+    secp256k1_fe_normalize(&pr_ge.x);
+
+    secp256k1_fe_get_b32(c, &pr_ge.x);
+    secp256k1_scalar_set_b32(&computed_r, c, NULL);
+    return secp256k1_scalar_eq(sigr, &computed_r);
+}
+#else
+    secp256k1_scalar_get_b32(c, sigr);
+    /* we can ignore the fe_set_b32_limit return value, because we know the input is in range */
+    (void)secp256k1_fe_set_b32_limit(&xr, c);
+
+    /** We now have the recomputed R point in pr, and its claimed x coordinate (modulo n)
+     *  in xr. Naively, we would extract the x coordinate from pr (requiring a inversion modulo p),
+     *  compute the remainder modulo n, and compare it to xr. However:
+     *
+     *        xr == X(pr) mod n
+     *    <=> exists h. (xr + h * n < p && xr + h * n == X(pr))
+     *    [Since 2 * n > p, h can only be 0 or 1]
+     *    <=> (xr == X(pr)) || (xr + n < p && xr + n == X(pr))
+     *    [In Jacobian coordinates, X(pr) is pr.x / pr.z^2 mod p]
+     *    <=> (xr == pr.x / pr.z^2 mod p) || (xr + n < p && xr + n == pr.x / pr.z^2 mod p)
+     *    [Multiplying both sides of the equations by pr.z^2 mod p]
+     *    <=> (xr * pr.z^2 mod p == pr.x) || (xr + n < p && (xr + n) * pr.z^2 mod p == pr.x)
+     *
+     *  Thus, we can avoid the inversion, but we have to check both cases separately.
+     *  secp256k1_gej_eq_x implements the (xr * pr.z^2 mod p == pr.x) test.
+     */
+    if (secp256k1_gej_eq_x_var(&xr, &pr)) {
+        /* xr * pr.z^2 mod p == pr.x, so the signature is valid. */
+        return 1;
+    }
+    if (secp256k1_fe_cmp_var(&xr, &secp256k1_ecdsa_const_p_minus_order) >= 0) {
+        /* xr + n >= p, so we can skip testing the second case. */
+        return 0;
+    }
+    secp256k1_fe_add(&xr, &secp256k1_ecdsa_const_order_as_fe);
+    if (secp256k1_gej_eq_x_var(&xr, &pr)) {
+        /* (xr + n) * pr.z^2 mod p == pr.x, so the signature is valid. */
+        return 1;
+    }
+    return 0;
+#endif
+}
+
+static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, secp256k1_scalar *sigr, secp256k1_scalar *sigs, const secp256k1_scalar *seckey, const secp256k1_scalar *message, const secp256k1_scalar *nonce, int *recid) {
+    unsigned char b[32];
+    secp256k1_gej rp;
+    secp256k1_ge r;
+    secp256k1_scalar n;
+    int overflow = 0;
+    int high;
+
+    secp256k1_ecmult_gen(ctx, &rp, nonce);
+    secp256k1_ge_set_gej(&r, &rp);
+    secp256k1_fe_normalize(&r.x);
+    secp256k1_fe_normalize(&r.y);
+    secp256k1_fe_get_b32(b, &r.x);
+    secp256k1_scalar_set_b32(sigr, b, &overflow);
+    if (recid) {
+        /* The overflow condition is cryptographically unreachable as hitting it requires finding the discrete log
+         * of some P where P.x >= order, and only 1 in about 2^127 points meet this criteria.
+         */
+        *recid = (overflow << 1) | secp256k1_fe_is_odd(&r.y);
+    }
+    secp256k1_scalar_mul(&n, sigr, seckey);
+    secp256k1_scalar_add(&n, &n, message);
+    secp256k1_scalar_inverse(sigs, nonce);
+    secp256k1_scalar_mul(sigs, sigs, &n);
+    secp256k1_scalar_clear(&n);
+    secp256k1_gej_clear(&rp);
+    secp256k1_ge_clear(&r);
+    high = secp256k1_scalar_is_high(sigs);
+    secp256k1_scalar_cond_negate(sigs, high);
+    if (recid) {
+        *recid ^= high;
+    }
+    /* P.x = order is on the curve, so technically sig->r could end up being zero, which would be an invalid signature.
+     * This is cryptographically unreachable as hitting it requires finding the discrete log of P.x = N.
+     */
+    return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
+}
+
+#endif /* SECP256K1_ECDSA_IMPL_H */
diff --git a/vendor/external/secp256k1/src/eckey.h b/vendor/external/secp256k1/src/eckey.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/eckey.h
@@ -0,0 +1,25 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_ECKEY_H
+#define SECP256K1_ECKEY_H
+
+#include <stddef.h>
+
+#include "group.h"
+#include "scalar.h"
+#include "ecmult.h"
+#include "ecmult_gen.h"
+
+static int secp256k1_eckey_pubkey_parse(secp256k1_ge *elem, const unsigned char *pub, size_t size);
+static int secp256k1_eckey_pubkey_serialize(secp256k1_ge *elem, unsigned char *pub, size_t *size, int compressed);
+
+static int secp256k1_eckey_privkey_tweak_add(secp256k1_scalar *key, const secp256k1_scalar *tweak);
+static int secp256k1_eckey_pubkey_tweak_add(secp256k1_ge *key, const secp256k1_scalar *tweak);
+static int secp256k1_eckey_privkey_tweak_mul(secp256k1_scalar *key, const secp256k1_scalar *tweak);
+static int secp256k1_eckey_pubkey_tweak_mul(secp256k1_ge *key, const secp256k1_scalar *tweak);
+
+#endif /* SECP256K1_ECKEY_H */
diff --git a/vendor/external/secp256k1/src/eckey_impl.h b/vendor/external/secp256k1/src/eckey_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/eckey_impl.h
@@ -0,0 +1,92 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_ECKEY_IMPL_H
+#define SECP256K1_ECKEY_IMPL_H
+
+#include "eckey.h"
+
+#include "scalar.h"
+#include "field.h"
+#include "group.h"
+#include "ecmult_gen.h"
+
+static int secp256k1_eckey_pubkey_parse(secp256k1_ge *elem, const unsigned char *pub, size_t size) {
+    if (size == 33 && (pub[0] == SECP256K1_TAG_PUBKEY_EVEN || pub[0] == SECP256K1_TAG_PUBKEY_ODD)) {
+        secp256k1_fe x;
+        return secp256k1_fe_set_b32_limit(&x, pub+1) && secp256k1_ge_set_xo_var(elem, &x, pub[0] == SECP256K1_TAG_PUBKEY_ODD);
+    } else if (size == 65 && (pub[0] == SECP256K1_TAG_PUBKEY_UNCOMPRESSED || pub[0] == SECP256K1_TAG_PUBKEY_HYBRID_EVEN || pub[0] == SECP256K1_TAG_PUBKEY_HYBRID_ODD)) {
+        secp256k1_fe x, y;
+        if (!secp256k1_fe_set_b32_limit(&x, pub+1) || !secp256k1_fe_set_b32_limit(&y, pub+33)) {
+            return 0;
+        }
+        secp256k1_ge_set_xy(elem, &x, &y);
+        if ((pub[0] == SECP256K1_TAG_PUBKEY_HYBRID_EVEN || pub[0] == SECP256K1_TAG_PUBKEY_HYBRID_ODD) &&
+            secp256k1_fe_is_odd(&y) != (pub[0] == SECP256K1_TAG_PUBKEY_HYBRID_ODD)) {
+            return 0;
+        }
+        return secp256k1_ge_is_valid_var(elem);
+    } else {
+        return 0;
+    }
+}
+
+static int secp256k1_eckey_pubkey_serialize(secp256k1_ge *elem, unsigned char *pub, size_t *size, int compressed) {
+    if (secp256k1_ge_is_infinity(elem)) {
+        return 0;
+    }
+    secp256k1_fe_normalize_var(&elem->x);
+    secp256k1_fe_normalize_var(&elem->y);
+    secp256k1_fe_get_b32(&pub[1], &elem->x);
+    if (compressed) {
+        *size = 33;
+        pub[0] = secp256k1_fe_is_odd(&elem->y) ? SECP256K1_TAG_PUBKEY_ODD : SECP256K1_TAG_PUBKEY_EVEN;
+    } else {
+        *size = 65;
+        pub[0] = SECP256K1_TAG_PUBKEY_UNCOMPRESSED;
+        secp256k1_fe_get_b32(&pub[33], &elem->y);
+    }
+    return 1;
+}
+
+static int secp256k1_eckey_privkey_tweak_add(secp256k1_scalar *key, const secp256k1_scalar *tweak) {
+    secp256k1_scalar_add(key, key, tweak);
+    return !secp256k1_scalar_is_zero(key);
+}
+
+static int secp256k1_eckey_pubkey_tweak_add(secp256k1_ge *key, const secp256k1_scalar *tweak) {
+    secp256k1_gej pt;
+    secp256k1_gej_set_ge(&pt, key);
+    secp256k1_ecmult(&pt, &pt, &secp256k1_scalar_one, tweak);
+
+    if (secp256k1_gej_is_infinity(&pt)) {
+        return 0;
+    }
+    secp256k1_ge_set_gej(key, &pt);
+    return 1;
+}
+
+static int secp256k1_eckey_privkey_tweak_mul(secp256k1_scalar *key, const secp256k1_scalar *tweak) {
+    int ret;
+    ret = !secp256k1_scalar_is_zero(tweak);
+
+    secp256k1_scalar_mul(key, key, tweak);
+    return ret;
+}
+
+static int secp256k1_eckey_pubkey_tweak_mul(secp256k1_ge *key, const secp256k1_scalar *tweak) {
+    secp256k1_gej pt;
+    if (secp256k1_scalar_is_zero(tweak)) {
+        return 0;
+    }
+
+    secp256k1_gej_set_ge(&pt, key);
+    secp256k1_ecmult(&pt, &pt, tweak, &secp256k1_scalar_zero);
+    secp256k1_ge_set_gej(key, &pt);
+    return 1;
+}
+
+#endif /* SECP256K1_ECKEY_IMPL_H */
diff --git a/vendor/external/secp256k1/src/ecmult.h b/vendor/external/secp256k1/src/ecmult.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecmult.h
@@ -0,0 +1,61 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014, 2017 Pieter Wuille, Andrew Poelstra       *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_ECMULT_H
+#define SECP256K1_ECMULT_H
+
+#include "group.h"
+#include "scalar.h"
+#include "scratch.h"
+
+#ifndef ECMULT_WINDOW_SIZE
+#  define ECMULT_WINDOW_SIZE 15
+#  ifdef DEBUG_CONFIG
+#     pragma message DEBUG_CONFIG_MSG("ECMULT_WINDOW_SIZE undefined, assuming default value")
+#  endif
+#endif
+
+#ifdef DEBUG_CONFIG
+#  pragma message DEBUG_CONFIG_DEF(ECMULT_WINDOW_SIZE)
+#endif
+
+/* No one will ever need more than a window size of 24. The code might
+ * be correct for larger values of ECMULT_WINDOW_SIZE but this is not
+ * tested.
+ *
+ * The following limitations are known, and there are probably more:
+ * If WINDOW_G > 27 and size_t has 32 bits, then the code is incorrect
+ * because the size of the memory object that we allocate (in bytes)
+ * will not fit in a size_t.
+ * If WINDOW_G > 31 and int has 32 bits, then the code is incorrect
+ * because certain expressions will overflow.
+ */
+#if ECMULT_WINDOW_SIZE < 2 || ECMULT_WINDOW_SIZE > 24
+#  error Set ECMULT_WINDOW_SIZE to an integer in range [2..24].
+#endif
+
+/** The number of entries a table with precomputed multiples needs to have. */
+#define ECMULT_TABLE_SIZE(w) (1L << ((w)-2))
+
+/** Double multiply: R = na*A + ng*G */
+static void secp256k1_ecmult(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng);
+
+typedef int (secp256k1_ecmult_multi_callback)(secp256k1_scalar *sc, secp256k1_ge *pt, size_t idx, void *data);
+
+/**
+ * Multi-multiply: R = inp_g_sc * G + sum_i ni * Ai.
+ * Chooses the right algorithm for a given number of points and scratch space
+ * size. Resets and overwrites the given scratch space. If the points do not
+ * fit in the scratch space the algorithm is repeatedly run with batches of
+ * points. If no scratch space is given then a simple algorithm is used that
+ * simply multiplies the points with the corresponding scalars and adds them up.
+ * Returns: 1 on success (including when inp_g_sc is NULL and n is 0)
+ *          0 if there is not enough scratch space for a single point or
+ *          callback returns 0
+ */
+static int secp256k1_ecmult_multi_var(const secp256k1_callback* error_callback, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n);
+
+#endif /* SECP256K1_ECMULT_H */
diff --git a/vendor/external/secp256k1/src/ecmult_compute_table.h b/vendor/external/secp256k1/src/ecmult_compute_table.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecmult_compute_table.h
@@ -0,0 +1,16 @@
+/*****************************************************************************************************
+ * Copyright (c) 2013, 2014, 2017, 2021 Pieter Wuille, Andrew Poelstra, Jonas Nick, Russell O'Connor *
+ * Distributed under the MIT software license, see the accompanying                                  *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.                              *
+ *****************************************************************************************************/
+
+#ifndef SECP256K1_ECMULT_COMPUTE_TABLE_H
+#define SECP256K1_ECMULT_COMPUTE_TABLE_H
+
+/* Construct table of all odd multiples of gen in range 1..(2**(window_g-1)-1). */
+static void secp256k1_ecmult_compute_table(secp256k1_ge_storage* table, int window_g, const secp256k1_gej* gen);
+
+/* Like secp256k1_ecmult_compute_table, but one for both gen and gen*2^128. */
+static void secp256k1_ecmult_compute_two_tables(secp256k1_ge_storage* table, secp256k1_ge_storage* table_128, int window_g, const secp256k1_ge* gen);
+
+#endif /* SECP256K1_ECMULT_COMPUTE_TABLE_H */
diff --git a/vendor/external/secp256k1/src/ecmult_compute_table_impl.h b/vendor/external/secp256k1/src/ecmult_compute_table_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecmult_compute_table_impl.h
@@ -0,0 +1,49 @@
+/*****************************************************************************************************
+ * Copyright (c) 2013, 2014, 2017, 2021 Pieter Wuille, Andrew Poelstra, Jonas Nick, Russell O'Connor *
+ * Distributed under the MIT software license, see the accompanying                                  *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.                              *
+ *****************************************************************************************************/
+
+#ifndef SECP256K1_ECMULT_COMPUTE_TABLE_IMPL_H
+#define SECP256K1_ECMULT_COMPUTE_TABLE_IMPL_H
+
+#include "ecmult_compute_table.h"
+#include "group_impl.h"
+#include "field_impl.h"
+#include "ecmult.h"
+#include "util.h"
+
+static void secp256k1_ecmult_compute_table(secp256k1_ge_storage* table, int window_g, const secp256k1_gej* gen) {
+    secp256k1_gej gj;
+    secp256k1_ge ge, dgen;
+    int j;
+
+    gj = *gen;
+    secp256k1_ge_set_gej_var(&ge, &gj);
+    secp256k1_ge_to_storage(&table[0], &ge);
+
+    secp256k1_gej_double_var(&gj, gen, NULL);
+    secp256k1_ge_set_gej_var(&dgen, &gj);
+
+    for (j = 1; j < ECMULT_TABLE_SIZE(window_g); ++j) {
+        secp256k1_gej_set_ge(&gj, &ge);
+        secp256k1_gej_add_ge_var(&gj, &gj, &dgen, NULL);
+        secp256k1_ge_set_gej_var(&ge, &gj);
+        secp256k1_ge_to_storage(&table[j], &ge);
+    }
+}
+
+/* Like secp256k1_ecmult_compute_table, but one for both gen and gen*2^128. */
+static void secp256k1_ecmult_compute_two_tables(secp256k1_ge_storage* table, secp256k1_ge_storage* table_128, int window_g, const secp256k1_ge* gen) {
+    secp256k1_gej gj;
+    int i;
+
+    secp256k1_gej_set_ge(&gj, gen);
+    secp256k1_ecmult_compute_table(table, window_g, &gj);
+    for (i = 0; i < 128; ++i) {
+        secp256k1_gej_double_var(&gj, &gj, NULL);
+    }
+    secp256k1_ecmult_compute_table(table_128, window_g, &gj);
+}
+
+#endif /* SECP256K1_ECMULT_COMPUTE_TABLE_IMPL_H */
diff --git a/vendor/external/secp256k1/src/ecmult_const.h b/vendor/external/secp256k1/src/ecmult_const.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecmult_const.h
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Copyright (c) 2015 Andrew Poelstra                                  *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_ECMULT_CONST_H
+#define SECP256K1_ECMULT_CONST_H
+
+#include "scalar.h"
+#include "group.h"
+
+/**
+ * Multiply: R = q*A (in constant-time for q)
+ */
+static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, const secp256k1_scalar *q);
+
+/**
+ * Same as secp256k1_ecmult_const, but takes in an x coordinate of the base point
+ * only, specified as fraction n/d (numerator/denominator). Only the x coordinate of the result is
+ * returned.
+ *
+ * If known_on_curve is 0, a verification is performed that n/d is a valid X
+ * coordinate, and 0 is returned if not. Otherwise, 1 is returned.
+ *
+ * d being NULL is interpreted as d=1. If non-NULL, d must not be zero. q must not be zero.
+ *
+ * Constant time in the value of q, but not any other inputs.
+ */
+static int secp256k1_ecmult_const_xonly(
+    secp256k1_fe *r,
+    const secp256k1_fe *n,
+    const secp256k1_fe *d,
+    const secp256k1_scalar *q,
+    int known_on_curve
+);
+
+#endif /* SECP256K1_ECMULT_CONST_H */
diff --git a/vendor/external/secp256k1/src/ecmult_const_impl.h b/vendor/external/secp256k1/src/ecmult_const_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecmult_const_impl.h
@@ -0,0 +1,399 @@
+/***********************************************************************
+ * Copyright (c) 2015, 2022 Pieter Wuille, Andrew Poelstra             *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_ECMULT_CONST_IMPL_H
+#define SECP256K1_ECMULT_CONST_IMPL_H
+
+#include "scalar.h"
+#include "group.h"
+#include "ecmult_const.h"
+#include "ecmult_impl.h"
+
+#if defined(EXHAUSTIVE_TEST_ORDER)
+/* We need 2^ECMULT_CONST_GROUP_SIZE - 1 to be less than EXHAUSTIVE_TEST_ORDER, because
+ * the tables cannot have infinities in them (this breaks the effective-affine technique's
+ * z-ratio tracking) */
+#  if EXHAUSTIVE_TEST_ORDER == 199
+#    define ECMULT_CONST_GROUP_SIZE 4
+#  elif EXHAUSTIVE_TEST_ORDER == 13
+#    define ECMULT_CONST_GROUP_SIZE 3
+#  elif EXHAUSTIVE_TEST_ORDER == 7
+#    define ECMULT_CONST_GROUP_SIZE 2
+#  else
+#    error "Unknown EXHAUSTIVE_TEST_ORDER"
+#  endif
+#else
+/* Group size 4 or 5 appears optimal. */
+#  define ECMULT_CONST_GROUP_SIZE 5
+#endif
+
+#define ECMULT_CONST_TABLE_SIZE (1L << (ECMULT_CONST_GROUP_SIZE - 1))
+#define ECMULT_CONST_GROUPS ((129 + ECMULT_CONST_GROUP_SIZE - 1) / ECMULT_CONST_GROUP_SIZE)
+#define ECMULT_CONST_BITS (ECMULT_CONST_GROUPS * ECMULT_CONST_GROUP_SIZE)
+
+/** Fill a table 'pre' with precomputed odd multiples of a.
+ *
+ *  The resulting point set is brought to a single constant Z denominator, stores the X and Y
+ *  coordinates as ge points in pre, and stores the global Z in globalz.
+ *
+ *  'pre' must be an array of size ECMULT_CONST_TABLE_SIZE.
+ */
+static void secp256k1_ecmult_const_odd_multiples_table_globalz(secp256k1_ge *pre, secp256k1_fe *globalz, const secp256k1_gej *a) {
+    secp256k1_fe zr[ECMULT_CONST_TABLE_SIZE];
+
+    secp256k1_ecmult_odd_multiples_table(ECMULT_CONST_TABLE_SIZE, pre, zr, globalz, a);
+    secp256k1_ge_table_set_globalz(ECMULT_CONST_TABLE_SIZE, pre, zr);
+}
+
+/* Given a table 'pre' with odd multiples of a point, put in r the signed-bit multiplication of n with that point.
+ *
+ * For example, if ECMULT_CONST_GROUP_SIZE is 4, then pre is expected to contain 8 entries:
+ * [1*P, 3*P, 5*P, 7*P, 9*P, 11*P, 13*P, 15*P]. n is then expected to be a 4-bit integer (range 0-15), and its
+ * bits are interpreted as signs of powers of two to look up.
+ *
+ * For example, if n=4, which is 0100 in binary, which is interpreted as [- + - -], so the looked up value is
+ * [ -(2^3) + (2^2) - (2^1) - (2^0) ]*P = -7*P. Every valid n translates to an odd number in range [-15,15],
+ * which means we just need to look up one of the precomputed values, and optionally negate it.
+ */
+#define ECMULT_CONST_TABLE_GET_GE(r,pre,n) do { \
+    unsigned int m = 0; \
+    /* If the top bit of n is 0, we want the negation. */ \
+    volatile unsigned int negative = ((n) >> (ECMULT_CONST_GROUP_SIZE - 1)) ^ 1; \
+    /* Let n[i] be the i-th bit of n, then the index is
+     *     sum(cnot(n[i]) * 2^i, i=0..l-2)
+     * where cnot(b) = b if n[l-1] = 1 and 1 - b otherwise.
+     * For example, if n = 4, in binary 0100, the index is 3, in binary 011.
+     *
+     * Proof:
+     *     Let
+     *         x = sum((2*n[i] - 1)*2^i, i=0..l-1)
+     *           = 2*sum(n[i] * 2^i, i=0..l-1) - 2^l + 1
+     *     be the value represented by n.
+     *     The index is (x - 1)/2 if x > 0 and -(x + 1)/2 otherwise.
+     *     Case x > 0:
+     *         n[l-1] = 1
+     *         index = sum(n[i] * 2^i, i=0..l-1) - 2^(l-1)
+     *               = sum(n[i] * 2^i, i=0..l-2)
+     *     Case x <= 0:
+     *         n[l-1] = 0
+     *          index = -(2*sum(n[i] * 2^i, i=0..l-1) - 2^l + 2)/2
+     *                = 2^(l-1) - 1 - sum(n[i] * 2^i, i=0..l-1)
+     *                = sum((1 - n[i]) * 2^i, i=0..l-2)
+     */ \
+    unsigned int index = ((unsigned int)(-negative) ^ n) & ((1U << (ECMULT_CONST_GROUP_SIZE - 1)) - 1U); \
+    secp256k1_fe neg_y; \
+    VERIFY_CHECK((n) < (1U << ECMULT_CONST_GROUP_SIZE)); \
+    VERIFY_CHECK(index < (1U << (ECMULT_CONST_GROUP_SIZE - 1))); \
+    /* Unconditionally set r->x = (pre)[m].x. r->y = (pre)[m].y. because it's either the correct one
+     * or will get replaced in the later iterations, this is needed to make sure `r` is initialized. */ \
+    (r)->x = (pre)[m].x; \
+    (r)->y = (pre)[m].y; \
+    for (m = 1; m < ECMULT_CONST_TABLE_SIZE; m++) { \
+        /* This loop is used to avoid secret data in array indices. See
+         * the comment in ecmult_gen_impl.h for rationale. */ \
+        secp256k1_fe_cmov(&(r)->x, &(pre)[m].x, m == index); \
+        secp256k1_fe_cmov(&(r)->y, &(pre)[m].y, m == index); \
+    } \
+    (r)->infinity = 0; \
+    secp256k1_fe_negate(&neg_y, &(r)->y, 1); \
+    secp256k1_fe_cmov(&(r)->y, &neg_y, negative); \
+} while(0)
+
+/* For K as defined in the comment of secp256k1_ecmult_const, we have several precomputed
+ * formulas/constants.
+ * - in exhaustive test mode, we give an explicit expression to compute it at compile time: */
+#ifdef EXHAUSTIVE_TEST_ORDER
+static const secp256k1_scalar secp256k1_ecmult_const_K = ((SECP256K1_SCALAR_CONST(0, 0, 0, (1U << (ECMULT_CONST_BITS - 128)) - 2U, 0, 0, 0, 0) + EXHAUSTIVE_TEST_ORDER - 1U) * (1U + EXHAUSTIVE_TEST_LAMBDA)) % EXHAUSTIVE_TEST_ORDER;
+/* - for the real secp256k1 group we have constants for various ECMULT_CONST_BITS values. */
+#elif ECMULT_CONST_BITS == 129
+/* For GROUP_SIZE = 1,3. */
+static const secp256k1_scalar secp256k1_ecmult_const_K = SECP256K1_SCALAR_CONST(0xac9c52b3ul, 0x3fa3cf1ful, 0x5ad9e3fdul, 0x77ed9ba4ul, 0xa880b9fcul, 0x8ec739c2ul, 0xe0cfc810ul, 0xb51283ceul);
+#elif ECMULT_CONST_BITS == 130
+/* For GROUP_SIZE = 2,5. */
+static const secp256k1_scalar secp256k1_ecmult_const_K = SECP256K1_SCALAR_CONST(0xa4e88a7dul, 0xcb13034eul, 0xc2bdd6bful, 0x7c118d6bul, 0x589ae848ul, 0x26ba29e4ul, 0xb5c2c1dcul, 0xde9798d9ul);
+#elif ECMULT_CONST_BITS == 132
+/* For GROUP_SIZE = 4,6 */
+static const secp256k1_scalar secp256k1_ecmult_const_K = SECP256K1_SCALAR_CONST(0x76b1d93dul, 0x0fae3c6bul, 0x3215874bul, 0x94e93813ul, 0x7937fe0dul, 0xb66bcaaful, 0xb3749ca5ul, 0xd7b6171bul);
+#else
+#  error "Unknown ECMULT_CONST_BITS"
+#endif
+
+static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, const secp256k1_scalar *q) {
+    /* The approach below combines the signed-digit logic from Mike Hamburg's
+     * "Fast and compact elliptic-curve cryptography" (https://eprint.iacr.org/2012/309)
+     * Section 3.3, with the GLV endomorphism.
+     *
+     * The idea there is to interpret the bits of a scalar as signs (1 = +, 0 = -), and compute a
+     * point multiplication in that fashion. Let v be an n-bit non-negative integer (0 <= v < 2^n),
+     * and v[i] its i'th bit (so v = sum(v[i] * 2^i, i=0..n-1)). Then define:
+     *
+     *   C_l(v, A) = sum((2*v[i] - 1) * 2^i*A, i=0..l-1)
+     *
+     * Then it holds that C_l(v, A) = sum((2*v[i] - 1) * 2^i*A, i=0..l-1)
+     *                              = (2*sum(v[i] * 2^i, i=0..l-1) + 1 - 2^l) * A
+     *                              = (2*v + 1 - 2^l) * A
+     *
+     * Thus, one can compute q*A as C_256((q + 2^256 - 1) / 2, A). This is the basis for the
+     * paper's signed-digit multi-comb algorithm for multiplication using a precomputed table.
+     *
+     * It is appealing to try to combine this with the GLV optimization: the idea that a scalar
+     * s can be written as s1 + lambda*s2, where lambda is a curve-specific constant such that
+     * lambda*A is easy to compute, and where s1 and s2 are small. In particular we have the
+     * secp256k1_scalar_split_lambda function which performs such a split with the resulting s1
+     * and s2 in range (-2^128, 2^128) mod n. This does work, but is uninteresting:
+     *
+     *   To compute q*A:
+     *   - Let s1, s2 = split_lambda(q)
+     *   - Let R1 = C_256((s1 + 2^256 - 1) / 2, A)
+     *   - Let R2 = C_256((s2 + 2^256 - 1) / 2, lambda*A)
+     *   - Return R1 + R2
+     *
+     * The issue is that while s1 and s2 are small-range numbers, (s1 + 2^256 - 1) / 2 (mod n)
+     * and (s2 + 2^256 - 1) / 2 (mod n) are not, undoing the benefit of the splitting.
+     *
+     * To make it work, we want to modify the input scalar q first, before splitting, and then only
+     * add a 2^128 offset of the split results (so that they end up in the single 129-bit range
+     * [0,2^129]). A slightly smaller offset would work due to the bounds on the split, but we pick
+     * 2^128 for simplicity. Let s be the scalar fed to split_lambda, and f(q) the function to
+     * compute it from q:
+     *
+     *   To compute q*A:
+     *   - Compute s = f(q)
+     *   - Let s1, s2 = split_lambda(s)
+     *   - Let v1 = s1 + 2^128 (mod n)
+     *   - Let v2 = s2 + 2^128 (mod n)
+     *   - Let R1 = C_l(v1, A)
+     *   - Let R2 = C_l(v2, lambda*A)
+     *   - Return R1 + R2
+     *
+     * l will thus need to be at least 129, but we may overshoot by a few bits (see
+     * further), so keep it as a variable.
+     *
+     * To solve for s, we reason:
+     *     q*A  = R1 + R2
+     * <=> q*A  = C_l(s1 + 2^128, A) + C_l(s2 + 2^128, lambda*A)
+     * <=> q*A  = (2*(s1 + 2^128) + 1 - 2^l) * A + (2*(s2 + 2^128) + 1 - 2^l) * lambda*A
+     * <=> q*A  = (2*(s1 + s2*lambda) + (2^129 + 1 - 2^l) * (1 + lambda)) * A
+     * <=> q    = 2*(s1 + s2*lambda) + (2^129 + 1 - 2^l) * (1 + lambda) (mod n)
+     * <=> q    = 2*s + (2^129 + 1 - 2^l) * (1 + lambda) (mod n)
+     * <=> s    = (q + (2^l - 2^129 - 1) * (1 + lambda)) / 2 (mod n)
+     * <=> f(q) = (q + K) / 2 (mod n)
+     *            where K = (2^l - 2^129 - 1)*(1 + lambda) (mod n)
+     *
+     * We will process the computation of C_l(v1, A) and C_l(v2, lambda*A) in groups of
+     * ECMULT_CONST_GROUP_SIZE, so we set l to the smallest multiple of ECMULT_CONST_GROUP_SIZE
+     * that is not less than 129; this equals ECMULT_CONST_BITS.
+     */
+
+    /* The offset to add to s1 and s2 to make them non-negative. Equal to 2^128. */
+    static const secp256k1_scalar S_OFFSET = SECP256K1_SCALAR_CONST(0, 0, 0, 1, 0, 0, 0, 0);
+    secp256k1_scalar s, v1, v2;
+    secp256k1_ge pre_a[ECMULT_CONST_TABLE_SIZE];
+    secp256k1_ge pre_a_lam[ECMULT_CONST_TABLE_SIZE];
+    secp256k1_fe global_z;
+    int group, i;
+
+    /* We're allowed to be non-constant time in the point, and the code below (in particular,
+     * secp256k1_ecmult_const_odd_multiples_table_globalz) cannot deal with infinity in a
+     * constant-time manner anyway. */
+    if (secp256k1_ge_is_infinity(a)) {
+        secp256k1_gej_set_infinity(r);
+        return;
+    }
+
+    /* Compute v1 and v2. */
+    secp256k1_scalar_add(&s, q, &secp256k1_ecmult_const_K);
+    secp256k1_scalar_half(&s, &s);
+    secp256k1_scalar_split_lambda(&v1, &v2, &s);
+    secp256k1_scalar_add(&v1, &v1, &S_OFFSET);
+    secp256k1_scalar_add(&v2, &v2, &S_OFFSET);
+
+#ifdef VERIFY
+    /* Verify that v1 and v2 are in range [0, 2^129-1]. */
+    for (i = 129; i < 256; ++i) {
+        VERIFY_CHECK(secp256k1_scalar_get_bits_limb32(&v1, i, 1) == 0);
+        VERIFY_CHECK(secp256k1_scalar_get_bits_limb32(&v2, i, 1) == 0);
+    }
+#endif
+
+    /* Calculate odd multiples of A and A*lambda.
+     * All multiples are brought to the same Z 'denominator', which is stored
+     * in global_z. Due to secp256k1' isomorphism we can do all operations pretending
+     * that the Z coordinate was 1, use affine addition formulae, and correct
+     * the Z coordinate of the result once at the end.
+     */
+    secp256k1_gej_set_ge(r, a);
+    secp256k1_ecmult_const_odd_multiples_table_globalz(pre_a, &global_z, r);
+    for (i = 0; i < ECMULT_CONST_TABLE_SIZE; i++) {
+        secp256k1_ge_mul_lambda(&pre_a_lam[i], &pre_a[i]);
+    }
+
+    /* Next, we compute r = C_l(v1, A) + C_l(v2, lambda*A).
+     *
+     * We proceed in groups of ECMULT_CONST_GROUP_SIZE bits, operating on that many bits
+     * at a time, from high in v1, v2 to low. Call these bits1 (from v1) and bits2 (from v2).
+     *
+     * Now note that ECMULT_CONST_TABLE_GET_GE(&t, pre_a, bits1) loads into t a point equal
+     * to C_{ECMULT_CONST_GROUP_SIZE}(bits1, A), and analogously for pre_lam_a / bits2.
+     * This means that all we need to do is add these looked up values together, multiplied
+     * by 2^(ECMULT_GROUP_SIZE * group).
+     */
+    for (group = ECMULT_CONST_GROUPS - 1; group >= 0; --group) {
+        /* Using the _var get_bits function is ok here, since it's only variable in offset and count, not in the scalar. */
+        unsigned int bits1 = secp256k1_scalar_get_bits_var(&v1, group * ECMULT_CONST_GROUP_SIZE, ECMULT_CONST_GROUP_SIZE);
+        unsigned int bits2 = secp256k1_scalar_get_bits_var(&v2, group * ECMULT_CONST_GROUP_SIZE, ECMULT_CONST_GROUP_SIZE);
+        secp256k1_ge t;
+        int j;
+
+        ECMULT_CONST_TABLE_GET_GE(&t, pre_a, bits1);
+        if (group == ECMULT_CONST_GROUPS - 1) {
+            /* Directly set r in the first iteration. */
+            secp256k1_gej_set_ge(r, &t);
+        } else {
+            /* Shift the result so far up. */
+            for (j = 0; j < ECMULT_CONST_GROUP_SIZE; ++j) {
+                secp256k1_gej_double(r, r);
+            }
+            secp256k1_gej_add_ge(r, r, &t);
+        }
+        ECMULT_CONST_TABLE_GET_GE(&t, pre_a_lam, bits2);
+        secp256k1_gej_add_ge(r, r, &t);
+    }
+
+    /* Map the result back to the secp256k1 curve from the isomorphic curve. */
+    secp256k1_fe_mul(&r->z, &r->z, &global_z);
+}
+
+static int secp256k1_ecmult_const_xonly(secp256k1_fe* r, const secp256k1_fe *n, const secp256k1_fe *d, const secp256k1_scalar *q, int known_on_curve) {
+
+    /* This algorithm is a generalization of Peter Dettman's technique for
+     * avoiding the square root in a random-basepoint x-only multiplication
+     * on a Weierstrass curve:
+     * https://mailarchive.ietf.org/arch/msg/cfrg/7DyYY6gg32wDgHAhgSb6XxMDlJA/
+     *
+     *
+     * === Background: the effective affine technique ===
+     *
+     * Let phi_u be the isomorphism that maps (x, y) on secp256k1 curve y^2 = x^3 + 7 to
+     * x' = u^2*x, y' = u^3*y on curve y'^2 = x'^3 + u^6*7. This new curve has the same order as
+     * the original (it is isomorphic), but moreover, has the same addition/doubling formulas, as
+     * the curve b=7 coefficient does not appear in those formulas (or at least does not appear in
+     * the formulas implemented in this codebase, both affine and Jacobian). See also Example 9.5.2
+     * in https://www.math.auckland.ac.nz/~sgal018/crypto-book/ch9.pdf.
+     *
+     * This means any linear combination of secp256k1 points can be computed by applying phi_u
+     * (with non-zero u) on all input points (including the generator, if used), computing the
+     * linear combination on the isomorphic curve (using the same group laws), and then applying
+     * phi_u^{-1} to get back to secp256k1.
+     *
+     * Switching to Jacobian coordinates, note that phi_u applied to (X, Y, Z) is simply
+     * (X, Y, Z/u). Thus, if we want to compute (X1, Y1, Z) + (X2, Y2, Z), with identical Z
+     * coordinates, we can use phi_Z to transform it to (X1, Y1, 1) + (X2, Y2, 1) on an isomorphic
+     * curve where the affine addition formula can be used instead.
+     * If (X3, Y3, Z3) = (X1, Y1) + (X2, Y2) on that curve, then our answer on secp256k1 is
+     * (X3, Y3, Z3*Z).
+     *
+     * This is the effective affine technique: if we have a linear combination of group elements
+     * to compute, and all those group elements have the same Z coordinate, we can simply pretend
+     * that all those Z coordinates are 1, perform the computation that way, and then multiply the
+     * original Z coordinate back in.
+     *
+     * The technique works on any a=0 short Weierstrass curve. It is possible to generalize it to
+     * other curves too, but there the isomorphic curves will have different 'a' coefficients,
+     * which typically does affect the group laws.
+     *
+     *
+     * === Avoiding the square root for x-only point multiplication ===
+     *
+     * In this function, we want to compute the X coordinate of q*(n/d, y), for
+     * y = sqrt((n/d)^3 + 7). Its negation would also be a valid Y coordinate, but by convention
+     * we pick whatever sqrt returns (which we assume to be a deterministic function).
+     *
+     * Let g = y^2*d^3 = n^3 + 7*d^3. This also means y = sqrt(g/d^3).
+     * Further let v = sqrt(d*g), which must exist as d*g = y^2*d^4 = (y*d^2)^2.
+     *
+     * The input point (n/d, y) also has Jacobian coordinates:
+     *
+     *     (n/d, y, 1)
+     *   = (n/d * v^2, y * v^3, v)
+     *   = (n/d * d*g, y * sqrt(d^3*g^3), v)
+     *   = (n/d * d*g, sqrt(y^2 * d^3*g^3), v)
+     *   = (n*g, sqrt(g/d^3 * d^3*g^3), v)
+     *   = (n*g, sqrt(g^4), v)
+     *   = (n*g, g^2, v)
+     *
+     * It is easy to verify that both (n*g, g^2, v) and its negation (n*g, -g^2, v) have affine X
+     * coordinate n/d, and this holds even when the square root function doesn't have a
+     * deterministic sign. We choose the (n*g, g^2, v) version.
+     *
+     * Now switch to the effective affine curve using phi_v, where the input point has coordinates
+     * (n*g, g^2). Compute (X, Y, Z) = q * (n*g, g^2) there.
+     *
+     * Back on secp256k1, that means q * (n*g, g^2, v) = (X, Y, v*Z). This last point has affine X
+     * coordinate X / (v^2*Z^2) = X / (d*g*Z^2). Determining the affine Y coordinate would involve
+     * a square root, but as long as we only care about the resulting X coordinate, no square root
+     * is needed anywhere in this computation.
+     */
+
+    secp256k1_fe g, i;
+    secp256k1_ge p;
+    secp256k1_gej rj;
+
+    /* Compute g = (n^3 + B*d^3). */
+    secp256k1_fe_sqr(&g, n);
+    secp256k1_fe_mul(&g, &g, n);
+    if (d) {
+        secp256k1_fe b;
+        VERIFY_CHECK(!secp256k1_fe_normalizes_to_zero(d));
+        secp256k1_fe_sqr(&b, d);
+        VERIFY_CHECK(SECP256K1_B <= 8); /* magnitude of b will be <= 8 after the next call */
+        secp256k1_fe_mul_int(&b, SECP256K1_B);
+        secp256k1_fe_mul(&b, &b, d);
+        secp256k1_fe_add(&g, &b);
+        if (!known_on_curve) {
+            /* We need to determine whether (n/d)^3 + 7 is square.
+             *
+             *     is_square((n/d)^3 + 7)
+             * <=> is_square(((n/d)^3 + 7) * d^4)
+             * <=> is_square((n^3 + 7*d^3) * d)
+             * <=> is_square(g * d)
+             */
+            secp256k1_fe c;
+            secp256k1_fe_mul(&c, &g, d);
+            if (!secp256k1_fe_is_square_var(&c)) return 0;
+        }
+    } else {
+        secp256k1_fe_add_int(&g, SECP256K1_B);
+        if (!known_on_curve) {
+            /* g at this point equals x^3 + 7. Test if it is square. */
+            if (!secp256k1_fe_is_square_var(&g)) return 0;
+        }
+    }
+
+    /* Compute base point P = (n*g, g^2), the effective affine version of (n*g, g^2, v), which has
+     * corresponding affine X coordinate n/d. */
+    secp256k1_fe_mul(&p.x, &g, n);
+    secp256k1_fe_sqr(&p.y, &g);
+    p.infinity = 0;
+
+    /* Perform x-only EC multiplication of P with q. */
+    VERIFY_CHECK(!secp256k1_scalar_is_zero(q));
+    secp256k1_ecmult_const(&rj, &p, q);
+    VERIFY_CHECK(!secp256k1_gej_is_infinity(&rj));
+
+    /* The resulting (X, Y, Z) point on the effective-affine isomorphic curve corresponds to
+     * (X, Y, Z*v) on the secp256k1 curve. The affine version of that has X coordinate
+     * (X / (Z^2*d*g)). */
+    secp256k1_fe_sqr(&i, &rj.z);
+    secp256k1_fe_mul(&i, &i, &g);
+    if (d) secp256k1_fe_mul(&i, &i, d);
+    secp256k1_fe_inv(&i, &i);
+    secp256k1_fe_mul(r, &rj.x, &i);
+
+    return 1;
+}
+
+#endif /* SECP256K1_ECMULT_CONST_IMPL_H */
diff --git a/vendor/external/secp256k1/src/ecmult_gen.h b/vendor/external/secp256k1/src/ecmult_gen.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecmult_gen.h
@@ -0,0 +1,143 @@
+/***********************************************************************
+ * Copyright (c) Pieter Wuille, Peter Dettman                          *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_ECMULT_GEN_H
+#define SECP256K1_ECMULT_GEN_H
+
+#include "scalar.h"
+#include "group.h"
+
+
+/* Configuration parameters for the signed-digit multi-comb algorithm:
+ *
+ * - COMB_BLOCKS is the number of blocks the input is split into. Each
+ *   has a corresponding table.
+ * - COMB_TEETH is the number of bits simultaneously covered by one table.
+ * - COMB_RANGE is the number of bits in supported scalars. For production
+ *   purposes, only 256 is reasonable, but smaller numbers are supported for
+ *   exhaustive test mode.
+ *
+ * The comb's spacing (COMB_SPACING), or the distance between the teeth,
+ * is defined as ceil(COMB_RANGE / (COMB_BLOCKS * COMB_TEETH)). Each block covers
+ * COMB_SPACING * COMB_TEETH consecutive bits in the input.
+ *
+ * The size of the precomputed table is COMB_BLOCKS * (1 << (COMB_TEETH - 1))
+ * secp256k1_ge_storages.
+ *
+ * The number of point additions equals COMB_BLOCKS * COMB_SPACING. Each point
+ * addition involves a cmov from (1 << (COMB_TEETH - 1)) table entries and a
+ * conditional negation.
+ *
+ * The number of point doublings is COMB_SPACING - 1. */
+
+#if defined(EXHAUSTIVE_TEST_ORDER)
+/* We need to control these values for exhaustive tests because
+ * the table cannot have infinities in them (secp256k1_ge_storage
+ * doesn't support infinities) */
+#  undef COMB_BLOCKS
+#  undef COMB_TEETH
+#  if EXHAUSTIVE_TEST_ORDER == 7
+#    define COMB_RANGE 3
+#    define COMB_BLOCKS 1
+#    define COMB_TEETH 2
+#  elif EXHAUSTIVE_TEST_ORDER == 13
+#    define COMB_RANGE 4
+#    define COMB_BLOCKS 1
+#    define COMB_TEETH 2
+#  elif EXHAUSTIVE_TEST_ORDER == 199
+#    define COMB_RANGE 8
+#    define COMB_BLOCKS 2
+#    define COMB_TEETH 3
+#  else
+#    error "Unknown exhaustive test order"
+#  endif
+#  if (COMB_RANGE >= 32) || ((EXHAUSTIVE_TEST_ORDER >> (COMB_RANGE - 1)) != 1)
+#    error "COMB_RANGE != ceil(log2(EXHAUSTIVE_TEST_ORDER+1))"
+#  endif
+#else /* !defined(EXHAUSTIVE_TEST_ORDER) */
+#  define COMB_RANGE 256
+#endif /* defined(EXHAUSTIVE_TEST_ORDER) */
+
+/* Use (11, 6) as default configuration, which results in a 22 kB table. */
+#ifndef COMB_BLOCKS
+#  define COMB_BLOCKS 11
+#  ifdef DEBUG_CONFIG
+#    pragma message DEBUG_CONFIG_MSG("COMB_BLOCKS undefined, assuming default value")
+#  endif
+#endif
+#ifndef COMB_TEETH
+#  define COMB_TEETH 6
+#  ifdef DEBUG_CONFIG
+#    pragma message DEBUG_CONFIG_MSG("COMB_TEETH undefined, assuming default value")
+#  endif
+#endif
+/* Use ceil(COMB_RANGE / (COMB_BLOCKS * COMB_TEETH)) as COMB_SPACING. */
+#define COMB_SPACING CEIL_DIV(COMB_RANGE, COMB_BLOCKS * COMB_TEETH)
+
+/* Range checks on the parameters. */
+
+/* The remaining COMB_* parameters are derived values, don't modify these. */
+/* - The number of bits covered by all the blocks; must be at least COMB_RANGE. */
+#define COMB_BITS (COMB_BLOCKS * COMB_TEETH * COMB_SPACING)
+/* - The number of entries per table. */
+#define COMB_POINTS (1 << (COMB_TEETH - 1))
+
+/* Sanity checks. */
+#if !(1 <= COMB_BLOCKS && COMB_BLOCKS <= 256)
+#  error "COMB_BLOCKS must be in the range [1, 256]"
+#endif
+#if !(1 <= COMB_TEETH && COMB_TEETH <= 8)
+#  error "COMB_TEETH must be in the range [1, 8]"
+#endif
+#if COMB_BITS < COMB_RANGE
+#  error "COMB_BLOCKS * COMB_TEETH * COMB_SPACING is too low"
+#endif
+
+/* These last 2 checks are not strictly required, but prevent gratuitously inefficient
+ * configurations. Note that they compare with 256 rather than COMB_RANGE, so they do
+ * permit somewhat excessive values for the exhaustive test case, where testing with
+ * suboptimal parameters may be desirable. */
+#if (COMB_BLOCKS - 1) * COMB_TEETH * COMB_SPACING >= 256
+#  error "COMB_BLOCKS can be reduced"
+#endif
+#if COMB_BLOCKS * (COMB_TEETH - 1) * COMB_SPACING >= 256
+#  error "COMB_TEETH can be reduced"
+#endif
+
+#ifdef DEBUG_CONFIG
+#  pragma message DEBUG_CONFIG_DEF(COMB_RANGE)
+#  pragma message DEBUG_CONFIG_DEF(COMB_BLOCKS)
+#  pragma message DEBUG_CONFIG_DEF(COMB_TEETH)
+#  pragma message DEBUG_CONFIG_DEF(COMB_SPACING)
+#endif
+
+typedef struct {
+    /* Whether the context has been built. */
+    int built;
+
+    /* Values chosen such that
+     *
+     *   n*G == comb(n + scalar_offset, G/2) + ge_offset.
+     *
+     * This expression lets us use scalar blinding and optimize the comb precomputation. See
+     * ecmult_gen_impl.h for more details. */
+    secp256k1_scalar scalar_offset;
+    secp256k1_ge ge_offset;
+
+    /* Factor used for projective blinding. This value is used to rescale the Z
+     * coordinate of the first table lookup. */
+    secp256k1_fe proj_blind;
+} secp256k1_ecmult_gen_context;
+
+static void secp256k1_ecmult_gen_context_build(secp256k1_ecmult_gen_context* ctx);
+static void secp256k1_ecmult_gen_context_clear(secp256k1_ecmult_gen_context* ctx);
+
+/** Multiply with the generator: R = a*G */
+static void secp256k1_ecmult_gen(const secp256k1_ecmult_gen_context* ctx, secp256k1_gej *r, const secp256k1_scalar *a);
+
+static void secp256k1_ecmult_gen_blind(secp256k1_ecmult_gen_context *ctx, const unsigned char *seed32);
+
+#endif /* SECP256K1_ECMULT_GEN_H */
diff --git a/vendor/external/secp256k1/src/ecmult_gen_compute_table.h b/vendor/external/secp256k1/src/ecmult_gen_compute_table.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecmult_gen_compute_table.h
@@ -0,0 +1,14 @@
+/***********************************************************************
+ * Copyright (c) Pieter Wuille, Gregory Maxwell                        *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_ECMULT_GEN_COMPUTE_TABLE_H
+#define SECP256K1_ECMULT_GEN_COMPUTE_TABLE_H
+
+#include "ecmult_gen.h"
+
+static void secp256k1_ecmult_gen_compute_table(secp256k1_ge_storage* table, const secp256k1_ge* gen, int blocks, int teeth, int spacing);
+
+#endif /* SECP256K1_ECMULT_GEN_COMPUTE_TABLE_H */
diff --git a/vendor/external/secp256k1/src/ecmult_gen_compute_table_impl.h b/vendor/external/secp256k1/src/ecmult_gen_compute_table_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecmult_gen_compute_table_impl.h
@@ -0,0 +1,108 @@
+/***********************************************************************
+ * Copyright (c) Pieter Wuille, Gregory Maxwell, Peter Dettman         *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_ECMULT_GEN_COMPUTE_TABLE_IMPL_H
+#define SECP256K1_ECMULT_GEN_COMPUTE_TABLE_IMPL_H
+
+#include "ecmult_gen_compute_table.h"
+#include "group_impl.h"
+#include "field_impl.h"
+#include "scalar_impl.h"
+#include "ecmult_gen.h"
+#include "util.h"
+
+static void secp256k1_ecmult_gen_compute_table(secp256k1_ge_storage* table, const secp256k1_ge* gen, int blocks, int teeth, int spacing) {
+    size_t points = ((size_t)1) << (teeth - 1);
+    size_t points_total = points * blocks;
+    secp256k1_ge* prec = checked_malloc(&default_error_callback, points_total * sizeof(*prec));
+    secp256k1_gej* ds = checked_malloc(&default_error_callback, teeth * sizeof(*ds));
+    secp256k1_gej* vs = checked_malloc(&default_error_callback, points_total * sizeof(*vs));
+    secp256k1_gej u;
+    size_t vs_pos = 0;
+    secp256k1_scalar half;
+    int block, i;
+
+    VERIFY_CHECK(points_total > 0);
+
+    /* u is the running power of two times gen we're working with, initially gen/2. */
+    secp256k1_scalar_half(&half, &secp256k1_scalar_one);
+    secp256k1_gej_set_infinity(&u);
+    for (i = 255; i >= 0; --i) {
+        /* Use a very simple multiplication ladder to avoid dependency on ecmult. */
+        secp256k1_gej_double_var(&u, &u, NULL);
+        if (secp256k1_scalar_get_bits_limb32(&half, i, 1)) {
+            secp256k1_gej_add_ge_var(&u, &u, gen, NULL);
+        }
+    }
+#ifdef VERIFY
+    {
+        /* Verify that u*2 = gen. */
+        secp256k1_gej double_u;
+        secp256k1_gej_double_var(&double_u, &u, NULL);
+        VERIFY_CHECK(secp256k1_gej_eq_ge_var(&double_u, gen));
+    }
+#endif
+
+    for (block = 0; block < blocks; ++block) {
+        int tooth;
+        /* Here u = 2^(block*teeth*spacing) * gen/2. */
+        secp256k1_gej sum;
+        secp256k1_gej_set_infinity(&sum);
+        for (tooth = 0; tooth < teeth; ++tooth) {
+            /* Here u = 2^((block*teeth + tooth)*spacing) * gen/2. */
+            /* Make sum = sum(2^((block*teeth + t)*spacing), t=0..tooth) * gen/2. */
+            secp256k1_gej_add_var(&sum, &sum, &u, NULL);
+            /* Make u = 2^((block*teeth + tooth)*spacing + 1) * gen/2. */
+            secp256k1_gej_double_var(&u, &u, NULL);
+            /* Make ds[tooth] = u = 2^((block*teeth + tooth)*spacing + 1) * gen/2. */
+            ds[tooth] = u;
+            /* Make u = 2^((block*teeth + tooth + 1)*spacing) * gen/2, unless at the end. */
+            if (block + tooth != blocks + teeth - 2) {
+                int bit_off;
+                for (bit_off = 1; bit_off < spacing; ++bit_off) {
+                    secp256k1_gej_double_var(&u, &u, NULL);
+                }
+            }
+        }
+        /* Now u = 2^((block*teeth + teeth)*spacing) * gen/2
+         *       = 2^((block+1)*teeth*spacing) * gen/2       */
+
+        /* Next, compute the table entries for block number block in Jacobian coordinates.
+         * The entries will occupy vs[block*points + i] for i=0..points-1.
+         * We start by computing the first (i=0) value corresponding to all summed
+         * powers of two times G being negative. */
+        secp256k1_gej_neg(&vs[vs_pos++], &sum);
+        /* And then teeth-1 times "double" the range of i values for which the table
+         * is computed: in each iteration, double the table by taking an existing
+         * table entry and adding ds[tooth]. */
+        for (tooth = 0; tooth < teeth - 1; ++tooth) {
+            size_t stride = ((size_t)1) << tooth;
+            size_t index;
+            for (index = 0; index < stride; ++index, ++vs_pos) {
+                secp256k1_gej_add_var(&vs[vs_pos], &vs[vs_pos - stride], &ds[tooth], NULL);
+            }
+        }
+    }
+    VERIFY_CHECK(vs_pos == points_total);
+
+    /* Convert all points simultaneously from secp256k1_gej to secp256k1_ge. */
+    secp256k1_ge_set_all_gej_var(prec, vs, points_total);
+    /* Convert all points from secp256k1_ge to secp256k1_ge_storage output. */
+    for (block = 0; block < blocks; ++block) {
+        size_t index;
+        for (index = 0; index < points; ++index) {
+            VERIFY_CHECK(!secp256k1_ge_is_infinity(&prec[block * points + index]));
+            secp256k1_ge_to_storage(&table[block * points + index], &prec[block * points + index]);
+        }
+    }
+
+    /* Free memory. */
+    free(vs);
+    free(ds);
+    free(prec);
+}
+
+#endif /* SECP256K1_ECMULT_GEN_COMPUTE_TABLE_IMPL_H */
diff --git a/vendor/external/secp256k1/src/ecmult_gen_impl.h b/vendor/external/secp256k1/src/ecmult_gen_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecmult_gen_impl.h
@@ -0,0 +1,341 @@
+/***********************************************************************
+ * Copyright (c) Pieter Wuille, Gregory Maxwell, Peter Dettman         *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_ECMULT_GEN_IMPL_H
+#define SECP256K1_ECMULT_GEN_IMPL_H
+
+#include "util.h"
+#include "scalar.h"
+#include "group.h"
+#include "ecmult_gen.h"
+#include "hash_impl.h"
+#include "precomputed_ecmult_gen.h"
+
+static void secp256k1_ecmult_gen_context_build(secp256k1_ecmult_gen_context *ctx) {
+    secp256k1_ecmult_gen_blind(ctx, NULL);
+    ctx->built = 1;
+}
+
+static int secp256k1_ecmult_gen_context_is_built(const secp256k1_ecmult_gen_context* ctx) {
+    return ctx->built;
+}
+
+static void secp256k1_ecmult_gen_context_clear(secp256k1_ecmult_gen_context *ctx) {
+    ctx->built = 0;
+    secp256k1_scalar_clear(&ctx->scalar_offset);
+    secp256k1_ge_clear(&ctx->ge_offset);
+    secp256k1_fe_clear(&ctx->proj_blind);
+}
+
+/* Compute the scalar (2^COMB_BITS - 1) / 2, the difference between the gn argument to
+ * secp256k1_ecmult_gen, and the scalar whose encoding the table lookup bits are drawn
+ * from (before applying blinding). */
+static void secp256k1_ecmult_gen_scalar_diff(secp256k1_scalar* diff) {
+    int i;
+
+    /* Compute scalar -1/2. */
+    secp256k1_scalar neghalf;
+    secp256k1_scalar_half(&neghalf, &secp256k1_scalar_one);
+    secp256k1_scalar_negate(&neghalf, &neghalf);
+
+    /* Compute offset = 2^(COMB_BITS - 1). */
+    *diff = secp256k1_scalar_one;
+    for (i = 0; i < COMB_BITS - 1; ++i) {
+        secp256k1_scalar_add(diff, diff, diff);
+    }
+
+    /* The result is the sum 2^(COMB_BITS - 1) + (-1/2). */
+    secp256k1_scalar_add(diff, diff, &neghalf);
+}
+
+static void secp256k1_ecmult_gen(const secp256k1_ecmult_gen_context *ctx, secp256k1_gej *r, const secp256k1_scalar *gn) {
+    uint32_t comb_off;
+    secp256k1_ge add;
+    secp256k1_fe neg;
+    secp256k1_ge_storage adds;
+    secp256k1_scalar d;
+    /* Array of uint32_t values large enough to store COMB_BITS bits. Only the bottom
+     * 8 are ever nonzero, but having the zero padding at the end if COMB_BITS>256
+     * avoids the need to deal with out-of-bounds reads from a scalar. */
+    uint32_t recoded[(COMB_BITS + 31) >> 5] = {0};
+    int first = 1, i;
+
+    memset(&adds, 0, sizeof(adds));
+
+    /* We want to compute R = gn*G.
+     *
+     * To blind the scalar used in the computation, we rewrite this to be
+     * R = (gn - b)*G + b*G, with a blinding value b determined by the context.
+     *
+     * The multiplication (gn-b)*G will be performed using a signed-digit multi-comb (see Section
+     * 3.3 of "Fast and compact elliptic-curve cryptography" by Mike Hamburg,
+     * https://eprint.iacr.org/2012/309).
+     *
+     * Let comb(s, P) = sum((2*s[i]-1)*2^i*P for i=0..COMB_BITS-1), where s[i] is the i'th bit of
+     * the binary representation of scalar s. So the s[i] values determine whether -2^i*P (s[i]=0)
+     * or +2^i*P (s[i]=1) are added together. COMB_BITS is at least 256, so all bits of s are
+     * covered. By manipulating:
+     *
+     *     comb(s, P) = sum((2*s[i]-1)*2^i*P for i=0..COMB_BITS-1)
+     * <=> comb(s, P) = sum((2*s[i]-1)*2^i for i=0..COMB_BITS-1) * P
+     * <=> comb(s, P) = (2*sum(s[i]*2^i for i=0..COMB_BITS-1) - sum(2^i for i=0..COMB_BITS-1)) * P
+     * <=> comb(s, P) = (2*s - (2^COMB_BITS - 1)) * P
+     *
+     * If we wanted to compute (gn-b)*G as comb(s, G), it would need to hold that
+     *
+     *     (gn - b) * G = (2*s - (2^COMB_BITS - 1)) * G
+     * <=> s = (gn - b + (2^COMB_BITS - 1))/2 (mod order)
+     *
+     * We use an alternative here that avoids the modular division by two: instead we compute
+     * (gn-b)*G as comb(d, G/2). For that to hold it must be the case that
+     *
+     *     (gn - b) * G = (2*d - (2^COMB_BITS - 1)) * (G/2)
+     * <=> d = gn - b + (2^COMB_BITS - 1)/2 (mod order)
+     *
+     * Adding precomputation, our final equations become:
+     *
+     *     ctx->scalar_offset = (2^COMB_BITS - 1)/2 - b (mod order)
+     *     ctx->ge_offset = b*G
+     *     d = gn + ctx->scalar_offset (mod order)
+     *     R = comb(d, G/2) + ctx->ge_offset
+     *
+     * comb(d, G/2) function is then computed by summing + or - 2^(i-1)*G, for i=0..COMB_BITS-1,
+     * depending on the value of the bits d[i] of the binary representation of scalar d.
+     */
+
+    /* Compute the scalar d = (gn + ctx->scalar_offset). */
+    secp256k1_scalar_add(&d, &ctx->scalar_offset, gn);
+    /* Convert to recoded array. */
+    for (i = 0; i < 8 && i < ((COMB_BITS + 31) >> 5); ++i) {
+        recoded[i] = secp256k1_scalar_get_bits_limb32(&d, 32 * i, 32);
+    }
+    secp256k1_scalar_clear(&d);
+
+    /* In secp256k1_ecmult_gen_prec_table we have precomputed sums of the
+     * (2*d[i]-1) * 2^(i-1) * G points, for various combinations of i positions.
+     * We rewrite our equation in terms of these table entries.
+     *
+     * Let mask(b) = sum(2^((b*COMB_TEETH + t)*COMB_SPACING) for t=0..COMB_TEETH-1),
+     * with b ranging from 0 to COMB_BLOCKS-1. So for example with COMB_BLOCKS=11,
+     * COMB_TEETH=6, COMB_SPACING=4, we would have:
+     *   mask(0)  = 2^0   + 2^4   + 2^8   + 2^12  + 2^16  + 2^20,
+     *   mask(1)  = 2^24  + 2^28  + 2^32  + 2^36  + 2^40  + 2^44,
+     *   mask(2)  = 2^48  + 2^52  + 2^56  + 2^60  + 2^64  + 2^68,
+     *   ...
+     *   mask(10) = 2^240 + 2^244 + 2^248 + 2^252 + 2^256 + 2^260
+     *
+     * We will split up the bits d[i] using these masks. Specifically, each mask is
+     * used COMB_SPACING times, with different shifts:
+     *
+     * d = (d & mask(0)<<0) + (d & mask(1)<<0) + ... + (d & mask(COMB_BLOCKS-1)<<0) +
+     *     (d & mask(0)<<1) + (d & mask(1)<<1) + ... + (d & mask(COMB_BLOCKS-1)<<1) +
+     *     ...
+     *     (d & mask(0)<<(COMB_SPACING-1)) + ...
+     *
+     * Now define table(b, m) = (m - mask(b)/2) * G, and we will precompute these values for
+     * b=0..COMB_BLOCKS-1, and for all values m which (d & mask(b)) can take (so m can take on
+     * 2^COMB_TEETH distinct values).
+     *
+     * If m=(d & mask(b)), then table(b, m) is the sum of 2^i * (2*d[i]-1) * G/2, with i
+     * iterating over the set bits in mask(b). In our example, table(2, 2^48 + 2^56 + 2^68)
+     * would equal (2^48 - 2^52 + 2^56 - 2^60 - 2^64 + 2^68) * G/2.
+     *
+     * With that, we can rewrite comb(d, G/2) as:
+     *
+     *     2^0 * (table(0, d>>0 & mask(0)) + ... + table(COMB_BLOCKS-1, d>>0 & mask(COMP_BLOCKS-1)))
+     *   + 2^1 * (table(0, d>>1 & mask(0)) + ... + table(COMB_BLOCKS-1, d>>1 & mask(COMP_BLOCKS-1)))
+     *   + 2^2 * (table(0, d>>2 & mask(0)) + ... + table(COMB_BLOCKS-1, d>>2 & mask(COMP_BLOCKS-1)))
+     *   + ...
+     *   + 2^(COMB_SPACING-1) * (table(0, d>>(COMB_SPACING-1) & mask(0)) + ...)
+     *
+     * Or more generically as
+     *
+     *   sum(2^i * sum(table(b, d>>i & mask(b)), b=0..COMB_BLOCKS-1), i=0..COMB_SPACING-1)
+     *
+     * This is implemented using an outer loop that runs in reverse order over the lines of this
+     * equation, which in each iteration runs an inner loop that adds the terms of that line and
+     * then doubles the result before proceeding to the next line.
+     *
+     * In pseudocode:
+     *   c = infinity
+     *   for comb_off in range(COMB_SPACING - 1, -1, -1):
+     *     for block in range(COMB_BLOCKS):
+     *       c += table(block, (d >> comb_off) & mask(block))
+     *     if comb_off > 0:
+     *       c = 2*c
+     *   return c
+     *
+     * This computes c = comb(d, G/2), and thus finally R = c + ctx->ge_offset. Note that it would
+     * be possible to apply an initial offset instead of a final offset (moving ge_offset to take
+     * the place of infinity above), but the chosen approach allows using (in a future improvement)
+     * an incomplete addition formula for most of the multiplication.
+     *
+     * The last question is how to implement the table(b, m) function. For any value of b,
+     * m=(d & mask(b)) can only take on at most 2^COMB_TEETH possible values (the last one may have
+     * fewer as there mask(b) may exceed the curve order). So we could create COMB_BLOCK tables
+     * which contain a value for each such m value.
+     *
+     * Now note that if m=(d & mask(b)), then flipping the relevant bits of m results in negating
+     * the result of table(b, m). This is because table(b,m XOR mask(b)) = table(b, mask(b) - m) =
+     * (mask(b) - m - mask(b)/2)*G = (-m + mask(b)/2)*G = -(m - mask(b)/2)*G = -table(b, m).
+     * Because of this it suffices to only store the first half of the m values for every b. If an
+     * entry from the second half is needed, we look up its bit-flipped version instead, and negate
+     * it.
+     *
+     * secp256k1_ecmult_gen_prec_table[b][index] stores the table(b, m) entries. Index
+     * is the relevant mask(b) bits of m packed together without gaps. */
+
+    /* Outer loop: iterate over comb_off from COMB_SPACING - 1 down to 0. */
+    comb_off = COMB_SPACING - 1;
+    while (1) {
+        uint32_t block;
+        uint32_t bit_pos = comb_off;
+        /* Inner loop: for each block, add table entries to the result. */
+        for (block = 0; block < COMB_BLOCKS; ++block) {
+            /* Gather the mask(block)-selected bits of d into bits. They're packed:
+             * bits[tooth] = d[(block*COMB_TEETH + tooth)*COMB_SPACING + comb_off]. */
+            uint32_t bits = 0, sign, abs, index, tooth;
+            /* Instead of reading individual bits here to construct the bits variable,
+             * build up the result by xoring rotated reads together. In every iteration,
+             * one additional bit is made correct, starting at the bottom. The bits
+             * above that contain junk. This reduces leakage by avoiding computations
+             * on variables that can have only a low number of possible values (e.g.,
+             * just two values when reading a single bit into a variable.) See:
+             * https://www.usenix.org/system/files/conference/usenixsecurity18/sec18-alam.pdf
+             */
+            for (tooth = 0; tooth < COMB_TEETH; ++tooth) {
+                /* Construct bitdata s.t. the bottom bit is the bit we'd like to read.
+                 *
+                 * We could just set bitdata = recoded[bit_pos >> 5] >> (bit_pos & 0x1f)
+                 * but this would simply discard the bits that fall off at the bottom,
+                 * and thus, for example, bitdata could still have only two values if we
+                 * happen to shift by exactly 31 positions. We use a rotation instead,
+                 * which ensures that bitdata doesn't loose entropy. This relies on the
+                 * rotation being atomic, i.e., the compiler emitting an actual rot
+                 * instruction. */
+                uint32_t bitdata = secp256k1_rotr32(recoded[bit_pos >> 5], bit_pos & 0x1f);
+
+                /* Clear the bit at position tooth, but sssh, don't tell clang. */
+                uint32_t volatile vmask = ~(1 << tooth);
+                bits &= vmask;
+
+                /* Write the bit into position tooth (and junk into higher bits). */
+                bits ^= bitdata << tooth;
+                bit_pos += COMB_SPACING;
+            }
+
+            /* If the top bit of bits is 1, flip them all (corresponding to looking up
+             * the negated table value), and remember to negate the result in sign. */
+            sign = (bits >> (COMB_TEETH - 1)) & 1;
+            abs = (bits ^ -sign) & (COMB_POINTS - 1);
+            VERIFY_CHECK(sign == 0 || sign == 1);
+            VERIFY_CHECK(abs < COMB_POINTS);
+
+            /** This uses a conditional move to avoid any secret data in array indexes.
+             *   _Any_ use of secret indexes has been demonstrated to result in timing
+             *   sidechannels, even when the cache-line access patterns are uniform.
+             *  See also:
+             *   "A word of warning", CHES 2013 Rump Session, by Daniel J. Bernstein and Peter Schwabe
+             *    (https://cryptojedi.org/peter/data/chesrump-20130822.pdf) and
+             *   "Cache Attacks and Countermeasures: the Case of AES", RSA 2006,
+             *    by Dag Arne Osvik, Adi Shamir, and Eran Tromer
+             *    (https://www.tau.ac.il/~tromer/papers/cache.pdf)
+             */
+            for (index = 0; index < COMB_POINTS; ++index) {
+                secp256k1_ge_storage_cmov(&adds, &secp256k1_ecmult_gen_prec_table[block][index], index == abs);
+            }
+
+            /* Set add=adds or add=-adds, in constant time, based on sign. */
+            secp256k1_ge_from_storage(&add, &adds);
+            secp256k1_fe_negate(&neg, &add.y, 1);
+            secp256k1_fe_cmov(&add.y, &neg, sign);
+
+            /* Add the looked up and conditionally negated value to r. */
+            if (EXPECT(first, 0)) {
+                /* If this is the first table lookup, we can skip addition. */
+                secp256k1_gej_set_ge(r, &add);
+                /* Give the entry a random Z coordinate to blind intermediary results. */
+                secp256k1_gej_rescale(r, &ctx->proj_blind);
+                first = 0;
+            } else {
+                secp256k1_gej_add_ge(r, r, &add);
+            }
+        }
+
+        /* Double the result, except in the last iteration. */
+        if (comb_off-- == 0) break;
+        secp256k1_gej_double(r, r);
+    }
+
+    /* Correct for the scalar_offset added at the start (ge_offset = b*G, while b was
+     * subtracted from the input scalar gn). */
+    secp256k1_gej_add_ge(r, r, &ctx->ge_offset);
+
+    /* Cleanup. */
+    secp256k1_fe_clear(&neg);
+    secp256k1_ge_clear(&add);
+    secp256k1_memclear(&adds, sizeof(adds));
+    secp256k1_memclear(&recoded, sizeof(recoded));
+}
+
+/* Setup blinding values for secp256k1_ecmult_gen. */
+static void secp256k1_ecmult_gen_blind(secp256k1_ecmult_gen_context *ctx, const unsigned char *seed32) {
+    secp256k1_scalar b;
+    secp256k1_scalar diff;
+    secp256k1_gej gb;
+    secp256k1_fe f;
+    unsigned char nonce32[32];
+    secp256k1_rfc6979_hmac_sha256 rng;
+    unsigned char keydata[64];
+
+    /* Compute the (2^COMB_BITS - 1)/2 term once. */
+    secp256k1_ecmult_gen_scalar_diff(&diff);
+
+    if (seed32 == NULL) {
+        /* When seed is NULL, reset the final point and blinding value. */
+        secp256k1_ge_neg(&ctx->ge_offset, &secp256k1_ge_const_g);
+        secp256k1_scalar_add(&ctx->scalar_offset, &secp256k1_scalar_one, &diff);
+        ctx->proj_blind = secp256k1_fe_one;
+        return;
+    }
+    /* The prior blinding value (if not reset) is chained forward by including it in the hash. */
+    secp256k1_scalar_get_b32(keydata, &ctx->scalar_offset);
+    /** Using a CSPRNG allows a failure free interface, avoids needing large amounts of random data,
+     *   and guards against weak or adversarial seeds.  This is a simpler and safer interface than
+     *   asking the caller for blinding values directly and expecting them to retry on failure.
+     */
+    VERIFY_CHECK(seed32 != NULL);
+    memcpy(keydata + 32, seed32, 32);
+    secp256k1_rfc6979_hmac_sha256_initialize(&rng, keydata, 64);
+    secp256k1_memclear(keydata, sizeof(keydata));
+
+    /* Compute projective blinding factor (cannot be 0). */
+    secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32);
+    secp256k1_fe_set_b32_mod(&f, nonce32);
+    secp256k1_fe_cmov(&f, &secp256k1_fe_one, secp256k1_fe_normalizes_to_zero(&f));
+    ctx->proj_blind = f;
+
+    /* For a random blinding value b, set scalar_offset=diff-b, ge_offset=bG */
+    secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32);
+    secp256k1_scalar_set_b32(&b, nonce32, NULL);
+    /* The blinding value cannot be zero, as that would mean ge_offset = infinity,
+     * which secp256k1_gej_add_ge cannot handle. */
+    secp256k1_scalar_cmov(&b, &secp256k1_scalar_one, secp256k1_scalar_is_zero(&b));
+    secp256k1_rfc6979_hmac_sha256_finalize(&rng);
+    secp256k1_ecmult_gen(ctx, &gb, &b);
+    secp256k1_scalar_negate(&b, &b);
+    secp256k1_scalar_add(&ctx->scalar_offset, &b, &diff);
+    secp256k1_ge_set_gej(&ctx->ge_offset, &gb);
+
+    /* Clean up. */
+    secp256k1_memclear(nonce32, sizeof(nonce32));
+    secp256k1_scalar_clear(&b);
+    secp256k1_gej_clear(&gb);
+    secp256k1_fe_clear(&f);
+    secp256k1_rfc6979_hmac_sha256_clear(&rng);
+}
+
+#endif /* SECP256K1_ECMULT_GEN_IMPL_H */
diff --git a/vendor/external/secp256k1/src/ecmult_impl.h b/vendor/external/secp256k1/src/ecmult_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/ecmult_impl.h
@@ -0,0 +1,853 @@
+/******************************************************************************
+ * Copyright (c) 2013, 2014, 2017 Pieter Wuille, Andrew Poelstra, Jonas Nick  *
+ * Distributed under the MIT software license, see the accompanying           *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.       *
+ ******************************************************************************/
+
+#ifndef SECP256K1_ECMULT_IMPL_H
+#define SECP256K1_ECMULT_IMPL_H
+
+#include <string.h>
+#include <stdint.h>
+
+#include "util.h"
+#include "group.h"
+#include "scalar.h"
+#include "ecmult.h"
+#include "precomputed_ecmult.h"
+
+#if defined(EXHAUSTIVE_TEST_ORDER)
+/* We need to lower these values for exhaustive tests because
+ * the tables cannot have infinities in them (this breaks the
+ * affine-isomorphism stuff which tracks z-ratios) */
+#  if EXHAUSTIVE_TEST_ORDER > 128
+#    define WINDOW_A 5
+#  elif EXHAUSTIVE_TEST_ORDER > 8
+#    define WINDOW_A 4
+#  else
+#    define WINDOW_A 2
+#  endif
+#else
+/* optimal for 128-bit and 256-bit exponents. */
+#  define WINDOW_A 5
+/** Larger values for ECMULT_WINDOW_SIZE result in possibly better
+ *  performance at the cost of an exponentially larger precomputed
+ *  table. The exact table size is
+ *      (1 << (WINDOW_G - 2)) * sizeof(secp256k1_ge_storage)  bytes,
+ *  where sizeof(secp256k1_ge_storage) is typically 64 bytes but can
+ *  be larger due to platform-specific padding and alignment.
+ *  Two tables of this size are used (due to the endomorphism
+ *  optimization).
+ */
+#endif
+
+#define WNAF_BITS 128
+#define WNAF_SIZE_BITS(bits, w) CEIL_DIV(bits, w)
+#define WNAF_SIZE(w) WNAF_SIZE_BITS(WNAF_BITS, w)
+
+/* The number of objects allocated on the scratch space for ecmult_multi algorithms */
+#define PIPPENGER_SCRATCH_OBJECTS 6
+#define STRAUSS_SCRATCH_OBJECTS 5
+
+#define PIPPENGER_MAX_BUCKET_WINDOW 12
+
+/* Minimum number of points for which pippenger_wnaf is faster than strauss wnaf */
+#define ECMULT_PIPPENGER_THRESHOLD 88
+
+#define ECMULT_MAX_POINTS_PER_BATCH 5000000
+
+/** Fill a table 'pre_a' with precomputed odd multiples of a.
+ *  pre_a will contain [1*a,3*a,...,(2*n-1)*a], so it needs space for n group elements.
+ *  zr needs space for n field elements.
+ *
+ *  Although pre_a is an array of _ge rather than _gej, it actually represents elements
+ *  in Jacobian coordinates with their z coordinates omitted. The omitted z-coordinates
+ *  can be recovered using z and zr. Using the notation z(b) to represent the omitted
+ *  z coordinate of b:
+ *  - z(pre_a[n-1]) = 'z'
+ *  - z(pre_a[i-1]) = z(pre_a[i]) / zr[i] for n > i > 0
+ *
+ *  Lastly the zr[0] value, which isn't used above, is set so that:
+ *  - a.z = z(pre_a[0]) / zr[0]
+ */
+static void secp256k1_ecmult_odd_multiples_table(int n, secp256k1_ge *pre_a, secp256k1_fe *zr, secp256k1_fe *z, const secp256k1_gej *a) {
+    secp256k1_gej d, ai;
+    secp256k1_ge d_ge;
+    int i;
+
+    VERIFY_CHECK(!a->infinity);
+
+    secp256k1_gej_double_var(&d, a, NULL);
+
+    /*
+     * Perform the additions using an isomorphic curve Y^2 = X^3 + 7*C^6 where C := d.z.
+     * The isomorphism, phi, maps a secp256k1 point (x, y) to the point (x*C^2, y*C^3) on the other curve.
+     * In Jacobian coordinates phi maps (x, y, z) to (x*C^2, y*C^3, z) or, equivalently to (x, y, z/C).
+     *
+     *     phi(x, y, z) = (x*C^2, y*C^3, z) = (x, y, z/C)
+     *   d_ge := phi(d) = (d.x, d.y, 1)
+     *     ai := phi(a) = (a.x*C^2, a.y*C^3, a.z)
+     *
+     * The group addition functions work correctly on these isomorphic curves.
+     * In particular phi(d) is easy to represent in affine coordinates under this isomorphism.
+     * This lets us use the faster secp256k1_gej_add_ge_var group addition function that we wouldn't be able to use otherwise.
+     */
+    secp256k1_ge_set_xy(&d_ge, &d.x, &d.y);
+    secp256k1_ge_set_gej_zinv(&pre_a[0], a, &d.z);
+    secp256k1_gej_set_ge(&ai, &pre_a[0]);
+    ai.z = a->z;
+
+    /* pre_a[0] is the point (a.x*C^2, a.y*C^3, a.z*C) which is equivalent to a.
+     * Set zr[0] to C, which is the ratio between the omitted z(pre_a[0]) value and a.z.
+     */
+    zr[0] = d.z;
+
+    for (i = 1; i < n; i++) {
+        secp256k1_gej_add_ge_var(&ai, &ai, &d_ge, &zr[i]);
+        secp256k1_ge_set_xy(&pre_a[i], &ai.x, &ai.y);
+    }
+
+    /* Multiply the last z-coordinate by C to undo the isomorphism.
+     * Since the z-coordinates of the pre_a values are implied by the zr array of z-coordinate ratios,
+     * undoing the isomorphism here undoes the isomorphism for all pre_a values.
+     */
+    secp256k1_fe_mul(z, &ai.z, &d.z);
+}
+
+SECP256K1_INLINE static void secp256k1_ecmult_table_verify(int n, int w) {
+    (void)n;
+    (void)w;
+    VERIFY_CHECK(((n) & 1) == 1);
+    VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1));
+    VERIFY_CHECK((n) <=  ((1 << ((w)-1)) - 1));
+}
+
+SECP256K1_INLINE static void secp256k1_ecmult_table_get_ge(secp256k1_ge *r, const secp256k1_ge *pre, int n, int w) {
+    secp256k1_ecmult_table_verify(n,w);
+    if (n > 0) {
+        *r = pre[(n-1)/2];
+    } else {
+        *r = pre[(-n-1)/2];
+        secp256k1_fe_negate(&(r->y), &(r->y), 1);
+    }
+}
+
+SECP256K1_INLINE static void secp256k1_ecmult_table_get_ge_lambda(secp256k1_ge *r, const secp256k1_ge *pre, const secp256k1_fe *x, int n, int w) {
+    secp256k1_ecmult_table_verify(n,w);
+    if (n > 0) {
+        secp256k1_ge_set_xy(r, &x[(n-1)/2], &pre[(n-1)/2].y);
+    } else {
+        secp256k1_ge_set_xy(r, &x[(-n-1)/2], &pre[(-n-1)/2].y);
+        secp256k1_fe_negate(&(r->y), &(r->y), 1);
+    }
+}
+
+SECP256K1_INLINE static void secp256k1_ecmult_table_get_ge_storage(secp256k1_ge *r, const secp256k1_ge_storage *pre, int n, int w) {
+    secp256k1_ecmult_table_verify(n,w);
+    if (n > 0) {
+        secp256k1_ge_from_storage(r, &pre[(n-1)/2]);
+    } else {
+        secp256k1_ge_from_storage(r, &pre[(-n-1)/2]);
+        secp256k1_fe_negate(&(r->y), &(r->y), 1);
+    }
+}
+
+/** Convert a number to WNAF notation. The number becomes represented by sum(2^i * wnaf[i], i=0..bits),
+ *  with the following guarantees:
+ *  - each wnaf[i] is either 0, or an odd integer between -(1<<(w-1) - 1) and (1<<(w-1) - 1)
+ *  - two non-zero entries in wnaf are separated by at least w-1 zeroes.
+ *  - the number of set values in wnaf is returned. This number is at most 256, and at most one more
+ *    than the number of bits in the (absolute value) of the input.
+ */
+static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a, int w) {
+    secp256k1_scalar s;
+    int last_set_bit = -1;
+    int bit = 0;
+    int sign = 1;
+    int carry = 0;
+
+    VERIFY_CHECK(wnaf != NULL);
+    VERIFY_CHECK(0 <= len && len <= 256);
+    VERIFY_CHECK(a != NULL);
+    VERIFY_CHECK(2 <= w && w <= 31);
+
+    for (bit = 0; bit < len; bit++) {
+        wnaf[bit] = 0;
+    }
+
+    s = *a;
+    if (secp256k1_scalar_get_bits_limb32(&s, 255, 1)) {
+        secp256k1_scalar_negate(&s, &s);
+        sign = -1;
+    }
+
+    bit = 0;
+    while (bit < len) {
+        int now;
+        int word;
+        if (secp256k1_scalar_get_bits_limb32(&s, bit, 1) == (unsigned int)carry) {
+            bit++;
+            continue;
+        }
+
+        now = w;
+        if (now > len - bit) {
+            now = len - bit;
+        }
+
+        word = secp256k1_scalar_get_bits_var(&s, bit, now) + carry;
+
+        carry = (word >> (w-1)) & 1;
+        word -= carry << w;
+
+        wnaf[bit] = sign * word;
+        last_set_bit = bit;
+
+        bit += now;
+    }
+#ifdef VERIFY
+    {
+        int verify_bit = bit;
+
+        VERIFY_CHECK(carry == 0);
+
+        while (verify_bit < 256) {
+            VERIFY_CHECK(secp256k1_scalar_get_bits_limb32(&s, verify_bit, 1) == 0);
+            verify_bit++;
+        }
+    }
+#endif
+    return last_set_bit + 1;
+}
+
+struct secp256k1_strauss_point_state {
+    int wnaf_na_1[129];
+    int wnaf_na_lam[129];
+    int bits_na_1;
+    int bits_na_lam;
+};
+
+struct secp256k1_strauss_state {
+    /* aux is used to hold z-ratios, and then used to hold pre_a[i].x * BETA values. */
+    secp256k1_fe* aux;
+    secp256k1_ge* pre_a;
+    struct secp256k1_strauss_point_state* ps;
+};
+
+static void secp256k1_ecmult_strauss_wnaf(const struct secp256k1_strauss_state *state, secp256k1_gej *r, size_t num, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) {
+    secp256k1_ge tmpa;
+    secp256k1_fe Z;
+    /* Split G factors. */
+    secp256k1_scalar ng_1, ng_128;
+    int wnaf_ng_1[129];
+    int bits_ng_1 = 0;
+    int wnaf_ng_128[129];
+    int bits_ng_128 = 0;
+    int i;
+    int bits = 0;
+    size_t np;
+    size_t no = 0;
+
+    secp256k1_fe_set_int(&Z, 1);
+    for (np = 0; np < num; ++np) {
+        secp256k1_gej tmp;
+        secp256k1_scalar na_1, na_lam;
+        if (secp256k1_scalar_is_zero(&na[np]) || secp256k1_gej_is_infinity(&a[np])) {
+            continue;
+        }
+        /* split na into na_1 and na_lam (where na = na_1 + na_lam*lambda, and na_1 and na_lam are ~128 bit) */
+        secp256k1_scalar_split_lambda(&na_1, &na_lam, &na[np]);
+
+        /* build wnaf representation for na_1 and na_lam. */
+        state->ps[no].bits_na_1   = secp256k1_ecmult_wnaf(state->ps[no].wnaf_na_1,   129, &na_1,   WINDOW_A);
+        state->ps[no].bits_na_lam = secp256k1_ecmult_wnaf(state->ps[no].wnaf_na_lam, 129, &na_lam, WINDOW_A);
+        VERIFY_CHECK(state->ps[no].bits_na_1 <= 129);
+        VERIFY_CHECK(state->ps[no].bits_na_lam <= 129);
+        if (state->ps[no].bits_na_1 > bits) {
+            bits = state->ps[no].bits_na_1;
+        }
+        if (state->ps[no].bits_na_lam > bits) {
+            bits = state->ps[no].bits_na_lam;
+        }
+
+        /* Calculate odd multiples of a.
+         * All multiples are brought to the same Z 'denominator', which is stored
+         * in Z. Due to secp256k1' isomorphism we can do all operations pretending
+         * that the Z coordinate was 1, use affine addition formulae, and correct
+         * the Z coordinate of the result once at the end.
+         * The exception is the precomputed G table points, which are actually
+         * affine. Compared to the base used for other points, they have a Z ratio
+         * of 1/Z, so we can use secp256k1_gej_add_zinv_var, which uses the same
+         * isomorphism to efficiently add with a known Z inverse.
+         */
+        tmp = a[np];
+        if (no) {
+            secp256k1_gej_rescale(&tmp, &Z);
+        }
+        secp256k1_ecmult_odd_multiples_table(ECMULT_TABLE_SIZE(WINDOW_A), state->pre_a + no * ECMULT_TABLE_SIZE(WINDOW_A), state->aux + no * ECMULT_TABLE_SIZE(WINDOW_A), &Z, &tmp);
+        if (no) secp256k1_fe_mul(state->aux + no * ECMULT_TABLE_SIZE(WINDOW_A), state->aux + no * ECMULT_TABLE_SIZE(WINDOW_A), &(a[np].z));
+
+        ++no;
+    }
+
+    /* Bring them to the same Z denominator. */
+    if (no) {
+        secp256k1_ge_table_set_globalz(ECMULT_TABLE_SIZE(WINDOW_A) * no, state->pre_a, state->aux);
+    }
+
+    for (np = 0; np < no; ++np) {
+        for (i = 0; i < ECMULT_TABLE_SIZE(WINDOW_A); i++) {
+            secp256k1_fe_mul(&state->aux[np * ECMULT_TABLE_SIZE(WINDOW_A) + i], &state->pre_a[np * ECMULT_TABLE_SIZE(WINDOW_A) + i].x, &secp256k1_const_beta);
+        }
+    }
+
+    if (ng) {
+        /* split ng into ng_1 and ng_128 (where gn = gn_1 + gn_128*2^128, and gn_1 and gn_128 are ~128 bit) */
+        secp256k1_scalar_split_128(&ng_1, &ng_128, ng);
+
+        /* Build wnaf representation for ng_1 and ng_128 */
+        bits_ng_1   = secp256k1_ecmult_wnaf(wnaf_ng_1,   129, &ng_1,   WINDOW_G);
+        bits_ng_128 = secp256k1_ecmult_wnaf(wnaf_ng_128, 129, &ng_128, WINDOW_G);
+        if (bits_ng_1 > bits) {
+            bits = bits_ng_1;
+        }
+        if (bits_ng_128 > bits) {
+            bits = bits_ng_128;
+        }
+    }
+
+    secp256k1_gej_set_infinity(r);
+
+    for (i = bits - 1; i >= 0; i--) {
+        int n;
+        secp256k1_gej_double_var(r, r, NULL);
+        for (np = 0; np < no; ++np) {
+            if (i < state->ps[np].bits_na_1 && (n = state->ps[np].wnaf_na_1[i])) {
+                secp256k1_ecmult_table_get_ge(&tmpa, state->pre_a + np * ECMULT_TABLE_SIZE(WINDOW_A), n, WINDOW_A);
+                secp256k1_gej_add_ge_var(r, r, &tmpa, NULL);
+            }
+            if (i < state->ps[np].bits_na_lam && (n = state->ps[np].wnaf_na_lam[i])) {
+                secp256k1_ecmult_table_get_ge_lambda(&tmpa, state->pre_a + np * ECMULT_TABLE_SIZE(WINDOW_A), state->aux + np * ECMULT_TABLE_SIZE(WINDOW_A), n, WINDOW_A);
+                secp256k1_gej_add_ge_var(r, r, &tmpa, NULL);
+            }
+        }
+        if (i < bits_ng_1 && (n = wnaf_ng_1[i])) {
+            secp256k1_ecmult_table_get_ge_storage(&tmpa, secp256k1_pre_g, n, WINDOW_G);
+            secp256k1_gej_add_zinv_var(r, r, &tmpa, &Z);
+        }
+        if (i < bits_ng_128 && (n = wnaf_ng_128[i])) {
+            secp256k1_ecmult_table_get_ge_storage(&tmpa, secp256k1_pre_g_128, n, WINDOW_G);
+            secp256k1_gej_add_zinv_var(r, r, &tmpa, &Z);
+        }
+    }
+
+    if (!r->infinity) {
+        secp256k1_fe_mul(&r->z, &r->z, &Z);
+    }
+}
+
+static void secp256k1_ecmult(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) {
+    secp256k1_fe aux[ECMULT_TABLE_SIZE(WINDOW_A)];
+    secp256k1_ge pre_a[ECMULT_TABLE_SIZE(WINDOW_A)];
+    struct secp256k1_strauss_point_state ps[1];
+    struct secp256k1_strauss_state state;
+
+    state.aux = aux;
+    state.pre_a = pre_a;
+    state.ps = ps;
+    secp256k1_ecmult_strauss_wnaf(&state, r, 1, a, na, ng);
+}
+
+static size_t secp256k1_strauss_scratch_size(size_t n_points) {
+    static const size_t point_size = (sizeof(secp256k1_ge) + sizeof(secp256k1_fe)) * ECMULT_TABLE_SIZE(WINDOW_A) + sizeof(struct secp256k1_strauss_point_state) + sizeof(secp256k1_gej) + sizeof(secp256k1_scalar);
+    return n_points*point_size;
+}
+
+static int secp256k1_ecmult_strauss_batch(const secp256k1_callback* error_callback, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n_points, size_t cb_offset) {
+    secp256k1_gej* points;
+    secp256k1_scalar* scalars;
+    struct secp256k1_strauss_state state;
+    size_t i;
+    const size_t scratch_checkpoint = secp256k1_scratch_checkpoint(error_callback, scratch);
+
+    secp256k1_gej_set_infinity(r);
+    if (inp_g_sc == NULL && n_points == 0) {
+        return 1;
+    }
+
+    /* We allocate STRAUSS_SCRATCH_OBJECTS objects on the scratch space. If these
+     * allocations change, make sure to update the STRAUSS_SCRATCH_OBJECTS
+     * constant and strauss_scratch_size accordingly. */
+    points = (secp256k1_gej*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_gej));
+    scalars = (secp256k1_scalar*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(secp256k1_scalar));
+    state.aux = (secp256k1_fe*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_fe));
+    state.pre_a = (secp256k1_ge*)secp256k1_scratch_alloc(error_callback, scratch, n_points * ECMULT_TABLE_SIZE(WINDOW_A) * sizeof(secp256k1_ge));
+    state.ps = (struct secp256k1_strauss_point_state*)secp256k1_scratch_alloc(error_callback, scratch, n_points * sizeof(struct secp256k1_strauss_point_state));
+
+    if (points == NULL || scalars == NULL || state.aux == NULL || state.pre_a == NULL || state.ps == NULL) {
+        secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
+        return 0;
+    }
+
+    for (i = 0; i < n_points; i++) {
+        secp256k1_ge point;
+        if (!cb(&scalars[i], &point, i+cb_offset, cbdata)) {
+            secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
+            return 0;
+        }
+        secp256k1_gej_set_ge(&points[i], &point);
+    }
+    secp256k1_ecmult_strauss_wnaf(&state, r, n_points, points, scalars, inp_g_sc);
+    secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
+    return 1;
+}
+
+/* Wrapper for secp256k1_ecmult_multi_func interface */
+static int secp256k1_ecmult_strauss_batch_single(const secp256k1_callback* error_callback, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n) {
+    return secp256k1_ecmult_strauss_batch(error_callback, scratch, r, inp_g_sc, cb, cbdata, n, 0);
+}
+
+static size_t secp256k1_strauss_max_points(const secp256k1_callback* error_callback, secp256k1_scratch *scratch) {
+    return secp256k1_scratch_max_allocation(error_callback, scratch, STRAUSS_SCRATCH_OBJECTS) / secp256k1_strauss_scratch_size(1);
+}
+
+/** Convert a number to WNAF notation.
+ *  The number becomes represented by sum(2^{wi} * wnaf[i], i=0..WNAF_SIZE(w)+1) - return_val.
+ *  It has the following guarantees:
+ *  - each wnaf[i] is either 0 or an odd integer between -(1 << w) and (1 << w)
+ *  - the number of words set is always WNAF_SIZE(w)
+ *  - the returned skew is 0 or 1
+ */
+static int secp256k1_wnaf_fixed(int *wnaf, const secp256k1_scalar *s, int w) {
+    int skew = 0;
+    int pos;
+    int max_pos;
+    int last_w;
+    const secp256k1_scalar *work = s;
+
+    if (secp256k1_scalar_is_zero(s)) {
+        for (pos = 0; pos < WNAF_SIZE(w); pos++) {
+            wnaf[pos] = 0;
+        }
+        return 0;
+    }
+
+    if (secp256k1_scalar_is_even(s)) {
+        skew = 1;
+    }
+
+    wnaf[0] = secp256k1_scalar_get_bits_var(work, 0, w) + skew;
+    /* Compute last window size. Relevant when window size doesn't divide the
+     * number of bits in the scalar */
+    last_w = WNAF_BITS - (WNAF_SIZE(w) - 1) * w;
+
+    /* Store the position of the first nonzero word in max_pos to allow
+     * skipping leading zeros when calculating the wnaf. */
+    for (pos = WNAF_SIZE(w) - 1; pos > 0; pos--) {
+        int val = secp256k1_scalar_get_bits_var(work, pos * w, pos == WNAF_SIZE(w)-1 ? last_w : w);
+        if(val != 0) {
+            break;
+        }
+        wnaf[pos] = 0;
+    }
+    max_pos = pos;
+    pos = 1;
+
+    while (pos <= max_pos) {
+        int val = secp256k1_scalar_get_bits_var(work, pos * w, pos == WNAF_SIZE(w)-1 ? last_w : w);
+        if ((val & 1) == 0) {
+            wnaf[pos - 1] -= (1 << w);
+            wnaf[pos] = (val + 1);
+        } else {
+            wnaf[pos] = val;
+        }
+        /* Set a coefficient to zero if it is 1 or -1 and the proceeding digit
+         * is strictly negative or strictly positive respectively. Only change
+         * coefficients at previous positions because above code assumes that
+         * wnaf[pos - 1] is odd.
+         */
+        if (pos >= 2 && ((wnaf[pos - 1] == 1 && wnaf[pos - 2] < 0) || (wnaf[pos - 1] == -1 && wnaf[pos - 2] > 0))) {
+            if (wnaf[pos - 1] == 1) {
+                wnaf[pos - 2] += 1 << w;
+            } else {
+                wnaf[pos - 2] -= 1 << w;
+            }
+            wnaf[pos - 1] = 0;
+        }
+        ++pos;
+    }
+
+    return skew;
+}
+
+struct secp256k1_pippenger_point_state {
+    int skew_na;
+    size_t input_pos;
+};
+
+struct secp256k1_pippenger_state {
+    int *wnaf_na;
+    struct secp256k1_pippenger_point_state* ps;
+};
+
+/*
+ * pippenger_wnaf computes the result of a multi-point multiplication as
+ * follows: The scalars are brought into wnaf with n_wnaf elements each. Then
+ * for every i < n_wnaf, first each point is added to a "bucket" corresponding
+ * to the point's wnaf[i]. Second, the buckets are added together such that
+ * r += 1*bucket[0] + 3*bucket[1] + 5*bucket[2] + ...
+ */
+static int secp256k1_ecmult_pippenger_wnaf(secp256k1_gej *buckets, int bucket_window, struct secp256k1_pippenger_state *state, secp256k1_gej *r, const secp256k1_scalar *sc, const secp256k1_ge *pt, size_t num) {
+    size_t n_wnaf = WNAF_SIZE(bucket_window+1);
+    size_t np;
+    size_t no = 0;
+    int i;
+    int j;
+
+    for (np = 0; np < num; ++np) {
+        if (secp256k1_scalar_is_zero(&sc[np]) || secp256k1_ge_is_infinity(&pt[np])) {
+            continue;
+        }
+        state->ps[no].input_pos = np;
+        state->ps[no].skew_na = secp256k1_wnaf_fixed(&state->wnaf_na[no*n_wnaf], &sc[np], bucket_window+1);
+        no++;
+    }
+    secp256k1_gej_set_infinity(r);
+
+    if (no == 0) {
+        return 1;
+    }
+
+    for (i = n_wnaf - 1; i >= 0; i--) {
+        secp256k1_gej running_sum;
+
+        for(j = 0; j < ECMULT_TABLE_SIZE(bucket_window+2); j++) {
+            secp256k1_gej_set_infinity(&buckets[j]);
+        }
+
+        for (np = 0; np < no; ++np) {
+            int n = state->wnaf_na[np*n_wnaf + i];
+            struct secp256k1_pippenger_point_state point_state = state->ps[np];
+            secp256k1_ge tmp;
+            int idx;
+
+            if (i == 0) {
+                /* correct for wnaf skew */
+                int skew = point_state.skew_na;
+                if (skew) {
+                    secp256k1_ge_neg(&tmp, &pt[point_state.input_pos]);
+                    secp256k1_gej_add_ge_var(&buckets[0], &buckets[0], &tmp, NULL);
+                }
+            }
+            if (n > 0) {
+                idx = (n - 1)/2;
+                secp256k1_gej_add_ge_var(&buckets[idx], &buckets[idx], &pt[point_state.input_pos], NULL);
+            } else if (n < 0) {
+                idx = -(n + 1)/2;
+                secp256k1_ge_neg(&tmp, &pt[point_state.input_pos]);
+                secp256k1_gej_add_ge_var(&buckets[idx], &buckets[idx], &tmp, NULL);
+            }
+        }
+
+        for(j = 0; j < bucket_window; j++) {
+            secp256k1_gej_double_var(r, r, NULL);
+        }
+
+        secp256k1_gej_set_infinity(&running_sum);
+        /* Accumulate the sum: bucket[0] + 3*bucket[1] + 5*bucket[2] + 7*bucket[3] + ...
+         *                   = bucket[0] +   bucket[1] +   bucket[2] +   bucket[3] + ...
+         *                   +         2 *  (bucket[1] + 2*bucket[2] + 3*bucket[3] + ...)
+         * using an intermediate running sum:
+         * running_sum = bucket[0] +   bucket[1] +   bucket[2] + ...
+         *
+         * The doubling is done implicitly by deferring the final window doubling (of 'r').
+         */
+        for(j = ECMULT_TABLE_SIZE(bucket_window+2) - 1; j > 0; j--) {
+            secp256k1_gej_add_var(&running_sum, &running_sum, &buckets[j], NULL);
+            secp256k1_gej_add_var(r, r, &running_sum, NULL);
+        }
+
+        secp256k1_gej_add_var(&running_sum, &running_sum, &buckets[0], NULL);
+        secp256k1_gej_double_var(r, r, NULL);
+        secp256k1_gej_add_var(r, r, &running_sum, NULL);
+    }
+    return 1;
+}
+
+/**
+ * Returns optimal bucket_window (number of bits of a scalar represented by a
+ * set of buckets) for a given number of points.
+ */
+static int secp256k1_pippenger_bucket_window(size_t n) {
+    if (n <= 1) {
+        return 1;
+    } else if (n <= 4) {
+        return 2;
+    } else if (n <= 20) {
+        return 3;
+    } else if (n <= 57) {
+        return 4;
+    } else if (n <= 136) {
+        return 5;
+    } else if (n <= 235) {
+        return 6;
+    } else if (n <= 1260) {
+        return 7;
+    } else if (n <= 4420) {
+        return 9;
+    } else if (n <= 7880) {
+        return 10;
+    } else if (n <= 16050) {
+        return 11;
+    } else {
+        return PIPPENGER_MAX_BUCKET_WINDOW;
+    }
+}
+
+/**
+ * Returns the maximum optimal number of points for a bucket_window.
+ */
+static size_t secp256k1_pippenger_bucket_window_inv(int bucket_window) {
+    switch(bucket_window) {
+        case 1: return 1;
+        case 2: return 4;
+        case 3: return 20;
+        case 4: return 57;
+        case 5: return 136;
+        case 6: return 235;
+        case 7: return 1260;
+        case 8: return 1260;
+        case 9: return 4420;
+        case 10: return 7880;
+        case 11: return 16050;
+        case PIPPENGER_MAX_BUCKET_WINDOW: return SIZE_MAX;
+    }
+    return 0;
+}
+
+
+SECP256K1_INLINE static void secp256k1_ecmult_endo_split(secp256k1_scalar *s1, secp256k1_scalar *s2, secp256k1_ge *p1, secp256k1_ge *p2) {
+    secp256k1_scalar tmp = *s1;
+    secp256k1_scalar_split_lambda(s1, s2, &tmp);
+    secp256k1_ge_mul_lambda(p2, p1);
+
+    if (secp256k1_scalar_is_high(s1)) {
+        secp256k1_scalar_negate(s1, s1);
+        secp256k1_ge_neg(p1, p1);
+    }
+    if (secp256k1_scalar_is_high(s2)) {
+        secp256k1_scalar_negate(s2, s2);
+        secp256k1_ge_neg(p2, p2);
+    }
+}
+
+/**
+ * Returns the scratch size required for a given number of points (excluding
+ * base point G) without considering alignment.
+ */
+static size_t secp256k1_pippenger_scratch_size(size_t n_points, int bucket_window) {
+    size_t entries = 2*n_points + 2;
+    size_t entry_size = sizeof(secp256k1_ge) + sizeof(secp256k1_scalar) + sizeof(struct secp256k1_pippenger_point_state) + (WNAF_SIZE(bucket_window+1)+1)*sizeof(int);
+    return (sizeof(secp256k1_gej) << bucket_window) + sizeof(struct secp256k1_pippenger_state) + entries * entry_size;
+}
+
+static int secp256k1_ecmult_pippenger_batch(const secp256k1_callback* error_callback, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n_points, size_t cb_offset) {
+    const size_t scratch_checkpoint = secp256k1_scratch_checkpoint(error_callback, scratch);
+    /* Use 2(n+1) with the endomorphism, when calculating batch
+     * sizes. The reason for +1 is that we add the G scalar to the list of
+     * other scalars. */
+    size_t entries = 2*n_points + 2;
+    secp256k1_ge *points;
+    secp256k1_scalar *scalars;
+    secp256k1_gej *buckets;
+    struct secp256k1_pippenger_state *state_space;
+    size_t idx = 0;
+    size_t point_idx = 0;
+    int bucket_window;
+
+    secp256k1_gej_set_infinity(r);
+    if (inp_g_sc == NULL && n_points == 0) {
+        return 1;
+    }
+    bucket_window = secp256k1_pippenger_bucket_window(n_points);
+
+    /* We allocate PIPPENGER_SCRATCH_OBJECTS objects on the scratch space. If
+     * these allocations change, make sure to update the
+     * PIPPENGER_SCRATCH_OBJECTS constant and pippenger_scratch_size
+     * accordingly. */
+    points = (secp256k1_ge *) secp256k1_scratch_alloc(error_callback, scratch, entries * sizeof(*points));
+    scalars = (secp256k1_scalar *) secp256k1_scratch_alloc(error_callback, scratch, entries * sizeof(*scalars));
+    state_space = (struct secp256k1_pippenger_state *) secp256k1_scratch_alloc(error_callback, scratch, sizeof(*state_space));
+    if (points == NULL || scalars == NULL || state_space == NULL) {
+        secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
+        return 0;
+    }
+    state_space->ps = (struct secp256k1_pippenger_point_state *) secp256k1_scratch_alloc(error_callback, scratch, entries * sizeof(*state_space->ps));
+    state_space->wnaf_na = (int *) secp256k1_scratch_alloc(error_callback, scratch, entries*(WNAF_SIZE(bucket_window+1)) * sizeof(int));
+    buckets = (secp256k1_gej *) secp256k1_scratch_alloc(error_callback, scratch, ((size_t)1 << bucket_window) * sizeof(*buckets));
+    if (state_space->ps == NULL || state_space->wnaf_na == NULL || buckets == NULL) {
+        secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
+        return 0;
+    }
+
+    if (inp_g_sc != NULL) {
+        scalars[0] = *inp_g_sc;
+        points[0] = secp256k1_ge_const_g;
+        idx++;
+        secp256k1_ecmult_endo_split(&scalars[0], &scalars[1], &points[0], &points[1]);
+        idx++;
+    }
+
+    while (point_idx < n_points) {
+        if (!cb(&scalars[idx], &points[idx], point_idx + cb_offset, cbdata)) {
+            secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
+            return 0;
+        }
+        idx++;
+        secp256k1_ecmult_endo_split(&scalars[idx - 1], &scalars[idx], &points[idx - 1], &points[idx]);
+        idx++;
+        point_idx++;
+    }
+
+    secp256k1_ecmult_pippenger_wnaf(buckets, bucket_window, state_space, r, scalars, points, idx);
+    secp256k1_scratch_apply_checkpoint(error_callback, scratch, scratch_checkpoint);
+    return 1;
+}
+
+/* Wrapper for secp256k1_ecmult_multi_func interface */
+static int secp256k1_ecmult_pippenger_batch_single(const secp256k1_callback* error_callback, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n) {
+    return secp256k1_ecmult_pippenger_batch(error_callback, scratch, r, inp_g_sc, cb, cbdata, n, 0);
+}
+
+/**
+ * Returns the maximum number of points in addition to G that can be used with
+ * a given scratch space. The function ensures that fewer points may also be
+ * used.
+ */
+static size_t secp256k1_pippenger_max_points(const secp256k1_callback* error_callback, secp256k1_scratch *scratch) {
+    size_t max_alloc = secp256k1_scratch_max_allocation(error_callback, scratch, PIPPENGER_SCRATCH_OBJECTS);
+    int bucket_window;
+    size_t res = 0;
+
+    for (bucket_window = 1; bucket_window <= PIPPENGER_MAX_BUCKET_WINDOW; bucket_window++) {
+        size_t n_points;
+        size_t max_points = secp256k1_pippenger_bucket_window_inv(bucket_window);
+        size_t space_for_points;
+        size_t space_overhead;
+        size_t entry_size = sizeof(secp256k1_ge) + sizeof(secp256k1_scalar) + sizeof(struct secp256k1_pippenger_point_state) + (WNAF_SIZE(bucket_window+1)+1)*sizeof(int);
+
+        entry_size = 2*entry_size;
+        space_overhead = (sizeof(secp256k1_gej) << bucket_window) + entry_size + sizeof(struct secp256k1_pippenger_state);
+        if (space_overhead > max_alloc) {
+            break;
+        }
+        space_for_points = max_alloc - space_overhead;
+
+        n_points = space_for_points/entry_size;
+        n_points = n_points > max_points ? max_points : n_points;
+        if (n_points > res) {
+            res = n_points;
+        }
+        if (n_points < max_points) {
+            /* A larger bucket_window may support even more points. But if we
+             * would choose that then the caller couldn't safely use any number
+             * smaller than what this function returns */
+            break;
+        }
+    }
+    return res;
+}
+
+/* Computes ecmult_multi by simply multiplying and adding each point. Does not
+ * require a scratch space */
+static int secp256k1_ecmult_multi_simple_var(secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n_points) {
+    size_t point_idx;
+    secp256k1_gej tmpj;
+
+    secp256k1_gej_set_infinity(r);
+    secp256k1_gej_set_infinity(&tmpj);
+    /* r = inp_g_sc*G */
+    secp256k1_ecmult(r, &tmpj, &secp256k1_scalar_zero, inp_g_sc);
+    for (point_idx = 0; point_idx < n_points; point_idx++) {
+        secp256k1_ge point;
+        secp256k1_gej pointj;
+        secp256k1_scalar scalar;
+        if (!cb(&scalar, &point, point_idx, cbdata)) {
+            return 0;
+        }
+        /* r += scalar*point */
+        secp256k1_gej_set_ge(&pointj, &point);
+        secp256k1_ecmult(&tmpj, &pointj, &scalar, NULL);
+        secp256k1_gej_add_var(r, r, &tmpj, NULL);
+    }
+    return 1;
+}
+
+/* Compute the number of batches and the batch size given the maximum batch size and the
+ * total number of points */
+static int secp256k1_ecmult_multi_batch_size_helper(size_t *n_batches, size_t *n_batch_points, size_t max_n_batch_points, size_t n) {
+    if (max_n_batch_points == 0) {
+        return 0;
+    }
+    if (max_n_batch_points > ECMULT_MAX_POINTS_PER_BATCH) {
+        max_n_batch_points = ECMULT_MAX_POINTS_PER_BATCH;
+    }
+    if (n == 0) {
+        *n_batches = 0;
+        *n_batch_points = 0;
+        return 1;
+    }
+    /* Compute ceil(n/max_n_batch_points) and ceil(n/n_batches) */
+    *n_batches = CEIL_DIV(n, max_n_batch_points);
+    *n_batch_points = CEIL_DIV(n, *n_batches);
+    return 1;
+}
+
+typedef int (*secp256k1_ecmult_multi_func)(const secp256k1_callback* error_callback, secp256k1_scratch*, secp256k1_gej*, const secp256k1_scalar*, secp256k1_ecmult_multi_callback cb, void*, size_t);
+static int secp256k1_ecmult_multi_var(const secp256k1_callback* error_callback, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n) {
+    size_t i;
+
+    int (*f)(const secp256k1_callback* error_callback, secp256k1_scratch*, secp256k1_gej*, const secp256k1_scalar*, secp256k1_ecmult_multi_callback cb, void*, size_t, size_t);
+    size_t n_batches;
+    size_t n_batch_points;
+
+    secp256k1_gej_set_infinity(r);
+    if (inp_g_sc == NULL && n == 0) {
+        return 1;
+    } else if (n == 0) {
+        secp256k1_ecmult(r, r, &secp256k1_scalar_zero, inp_g_sc);
+        return 1;
+    }
+    if (scratch == NULL) {
+        return secp256k1_ecmult_multi_simple_var(r, inp_g_sc, cb, cbdata, n);
+    }
+
+    /* Compute the batch sizes for Pippenger's algorithm given a scratch space. If it's greater than
+     * a threshold use Pippenger's algorithm. Otherwise use Strauss' algorithm.
+     * As a first step check if there's enough space for Pippenger's algo (which requires less space
+     * than Strauss' algo) and if not, use the simple algorithm. */
+    if (!secp256k1_ecmult_multi_batch_size_helper(&n_batches, &n_batch_points, secp256k1_pippenger_max_points(error_callback, scratch), n)) {
+        return secp256k1_ecmult_multi_simple_var(r, inp_g_sc, cb, cbdata, n);
+    }
+    if (n_batch_points >= ECMULT_PIPPENGER_THRESHOLD) {
+        f = secp256k1_ecmult_pippenger_batch;
+    } else {
+        if (!secp256k1_ecmult_multi_batch_size_helper(&n_batches, &n_batch_points, secp256k1_strauss_max_points(error_callback, scratch), n)) {
+            return secp256k1_ecmult_multi_simple_var(r, inp_g_sc, cb, cbdata, n);
+        }
+        f = secp256k1_ecmult_strauss_batch;
+    }
+    for(i = 0; i < n_batches; i++) {
+        size_t nbp = n < n_batch_points ? n : n_batch_points;
+        size_t offset = n_batch_points*i;
+        secp256k1_gej tmp;
+        if (!f(error_callback, scratch, &tmp, i == 0 ? inp_g_sc : NULL, cb, cbdata, nbp, offset)) {
+            return 0;
+        }
+        secp256k1_gej_add_var(r, r, &tmp, NULL);
+        n -= nbp;
+    }
+    return 1;
+}
+
+#endif /* SECP256K1_ECMULT_IMPL_H */
diff --git a/vendor/external/secp256k1/src/field.h b/vendor/external/secp256k1/src/field.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/field.h
@@ -0,0 +1,350 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_FIELD_H
+#define SECP256K1_FIELD_H
+
+#include "util.h"
+
+/* This file defines the generic interface for working with secp256k1_fe
+ * objects, which represent field elements (integers modulo 2^256 - 2^32 - 977).
+ *
+ * The actual definition of the secp256k1_fe type depends on the chosen field
+ * implementation; see the field_5x52.h and field_10x26.h files for details.
+ *
+ * All secp256k1_fe objects have implicit properties that determine what
+ * operations are permitted on it. These are purely a function of what
+ * secp256k1_fe_ operations are applied on it, generally (implicitly) fixed at
+ * compile time, and do not depend on the chosen field implementation. Despite
+ * that, what these properties actually entail for the field representation
+ * values depends on the chosen field implementation. These properties are:
+ * - magnitude: an integer in [0,32]
+ * - normalized: 0 or 1; normalized=1 implies magnitude <= 1.
+ *
+ * In VERIFY mode, they are materialized explicitly as fields in the struct,
+ * allowing run-time verification of these properties. In that case, the field
+ * implementation also provides a secp256k1_fe_verify routine to verify that
+ * these fields match the run-time value and perform internal consistency
+ * checks. */
+#ifdef VERIFY
+#  define SECP256K1_FE_VERIFY_FIELDS \
+    int magnitude; \
+    int normalized;
+#else
+#  define SECP256K1_FE_VERIFY_FIELDS
+#endif
+
+#if defined(SECP256K1_WIDEMUL_INT128)
+#include "field_5x52.h"
+#elif defined(SECP256K1_WIDEMUL_INT64)
+#include "field_10x26.h"
+#else
+#error "Please select wide multiplication implementation"
+#endif
+
+#ifdef VERIFY
+/* Magnitude and normalized value for constants. */
+#define SECP256K1_FE_VERIFY_CONST(d7, d6, d5, d4, d3, d2, d1, d0) \
+    /* Magnitude is 0 for constant 0; 1 otherwise. */ \
+    , (((d7) | (d6) | (d5) | (d4) | (d3) | (d2) | (d1) | (d0)) != 0) \
+    /* Normalized is 1 unless sum(d_i<<(32*i) for i=0..7) exceeds field modulus. */ \
+    , (!(((d7) & (d6) & (d5) & (d4) & (d3) & (d2)) == 0xfffffffful && ((d1) == 0xfffffffful || ((d1) == 0xfffffffe && (d0 >= 0xfffffc2f)))))
+#else
+#define SECP256K1_FE_VERIFY_CONST(d7, d6, d5, d4, d3, d2, d1, d0)
+#endif
+
+/** This expands to an initializer for a secp256k1_fe valued sum((i*32) * d_i, i=0..7) mod p.
+ *
+ * It has magnitude 1, unless d_i are all 0, in which case the magnitude is 0.
+ * It is normalized, unless sum(2^(i*32) * d_i, i=0..7) >= p.
+ *
+ * SECP256K1_FE_CONST_INNER is provided by the implementation.
+ */
+#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)) SECP256K1_FE_VERIFY_CONST((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)) }
+
+static const secp256k1_fe secp256k1_fe_one = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1);
+static const secp256k1_fe secp256k1_const_beta = SECP256K1_FE_CONST(
+    0x7ae96a2bul, 0x657c0710ul, 0x6e64479eul, 0xac3434e9ul,
+    0x9cf04975ul, 0x12f58995ul, 0xc1396c28ul, 0x719501eeul
+);
+
+#ifndef VERIFY
+/* In non-VERIFY mode, we #define the fe operations to be identical to their
+ * internal field implementation, to avoid the potential overhead of a
+ * function call (even though presumably inlinable). */
+#  define secp256k1_fe_normalize secp256k1_fe_impl_normalize
+#  define secp256k1_fe_normalize_weak secp256k1_fe_impl_normalize_weak
+#  define secp256k1_fe_normalize_var secp256k1_fe_impl_normalize_var
+#  define secp256k1_fe_normalizes_to_zero secp256k1_fe_impl_normalizes_to_zero
+#  define secp256k1_fe_normalizes_to_zero_var secp256k1_fe_impl_normalizes_to_zero_var
+#  define secp256k1_fe_set_int secp256k1_fe_impl_set_int
+#  define secp256k1_fe_is_zero secp256k1_fe_impl_is_zero
+#  define secp256k1_fe_is_odd secp256k1_fe_impl_is_odd
+#  define secp256k1_fe_cmp_var secp256k1_fe_impl_cmp_var
+#  define secp256k1_fe_set_b32_mod secp256k1_fe_impl_set_b32_mod
+#  define secp256k1_fe_set_b32_limit secp256k1_fe_impl_set_b32_limit
+#  define secp256k1_fe_get_b32 secp256k1_fe_impl_get_b32
+#  define secp256k1_fe_negate_unchecked secp256k1_fe_impl_negate_unchecked
+#  define secp256k1_fe_mul_int_unchecked secp256k1_fe_impl_mul_int_unchecked
+#  define secp256k1_fe_add secp256k1_fe_impl_add
+#  define secp256k1_fe_mul secp256k1_fe_impl_mul
+#  define secp256k1_fe_sqr secp256k1_fe_impl_sqr
+#  define secp256k1_fe_cmov secp256k1_fe_impl_cmov
+#  define secp256k1_fe_to_storage secp256k1_fe_impl_to_storage
+#  define secp256k1_fe_from_storage secp256k1_fe_impl_from_storage
+#  define secp256k1_fe_inv secp256k1_fe_impl_inv
+#  define secp256k1_fe_inv_var secp256k1_fe_impl_inv_var
+#  define secp256k1_fe_get_bounds secp256k1_fe_impl_get_bounds
+#  define secp256k1_fe_half secp256k1_fe_impl_half
+#  define secp256k1_fe_add_int secp256k1_fe_impl_add_int
+#  define secp256k1_fe_is_square_var secp256k1_fe_impl_is_square_var
+#endif /* !defined(VERIFY) */
+
+/** Normalize a field element.
+ *
+ * On input, r must be a valid field element.
+ * On output, r represents the same value but has normalized=1 and magnitude=1.
+ */
+static void secp256k1_fe_normalize(secp256k1_fe *r);
+
+/** Give a field element magnitude 1.
+ *
+ * On input, r must be a valid field element.
+ * On output, r represents the same value but has magnitude=1. Normalized is unchanged.
+ */
+static void secp256k1_fe_normalize_weak(secp256k1_fe *r);
+
+/** Normalize a field element, without constant-time guarantee.
+ *
+ * Identical in behavior to secp256k1_fe_normalize, but not constant time in r.
+ */
+static void secp256k1_fe_normalize_var(secp256k1_fe *r);
+
+/** Determine whether r represents field element 0.
+ *
+ * On input, r must be a valid field element.
+ * Returns whether r = 0 (mod p).
+ */
+static int secp256k1_fe_normalizes_to_zero(const secp256k1_fe *r);
+
+/** Determine whether r represents field element 0, without constant-time guarantee.
+ *
+ * Identical in behavior to secp256k1_normalizes_to_zero, but not constant time in r.
+ */
+static int secp256k1_fe_normalizes_to_zero_var(const secp256k1_fe *r);
+
+/** Set a field element to an integer in range [0,0x7FFF].
+ *
+ * On input, r does not need to be initialized, a must be in [0,0x7FFF].
+ * On output, r represents value a, is normalized and has magnitude (a!=0).
+ */
+static void secp256k1_fe_set_int(secp256k1_fe *r, int a);
+
+/** Clear a field element to prevent leaking sensitive information. */
+static void secp256k1_fe_clear(secp256k1_fe *a);
+
+/** Determine whether a represents field element 0.
+ *
+ * On input, a must be a valid normalized field element.
+ * Returns whether a = 0 (mod p).
+ *
+ * This behaves identical to secp256k1_normalizes_to_zero{,_var}, but requires
+ * normalized input (and is much faster).
+ */
+static int secp256k1_fe_is_zero(const secp256k1_fe *a);
+
+/** Determine whether a (mod p) is odd.
+ *
+ * On input, a must be a valid normalized field element.
+ * Returns (int(a) mod p) & 1.
+ */
+static int secp256k1_fe_is_odd(const secp256k1_fe *a);
+
+/** Determine whether two field elements are equal.
+ *
+ * On input, a and b must be valid field elements with magnitudes not exceeding
+ * 1 and 31, respectively.
+ * Returns a = b (mod p).
+ */
+static int secp256k1_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b);
+
+/** Compare the values represented by 2 field elements, without constant-time guarantee.
+ *
+ * On input, a and b must be valid normalized field elements.
+ * Returns 1 if a > b, -1 if a < b, and 0 if a = b (comparisons are done as integers
+ * in range 0..p-1).
+ */
+static int secp256k1_fe_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b);
+
+/** Set a field element equal to the element represented by a provided 32-byte big endian value
+ * interpreted modulo p.
+ *
+ * On input, r does not need to be initialized. a must be a pointer to an initialized 32-byte array.
+ * On output, r = a (mod p). It will have magnitude 1, and not be normalized.
+ */
+static void secp256k1_fe_set_b32_mod(secp256k1_fe *r, const unsigned char *a);
+
+/** Set a field element equal to a provided 32-byte big endian value, checking for overflow.
+ *
+ * On input, r does not need to be initialized. a must be a pointer to an initialized 32-byte array.
+ * On output, r = a if (a < p), it will be normalized with magnitude 1, and 1 is returned.
+ * If a >= p, 0 is returned, and r will be made invalid (and must not be used without overwriting).
+ */
+static int secp256k1_fe_set_b32_limit(secp256k1_fe *r, const unsigned char *a);
+
+/** Convert a field element to 32-byte big endian byte array.
+ * On input, a must be a valid normalized field element, and r a pointer to a 32-byte array.
+ * On output, r = a (mod p).
+ */
+static void secp256k1_fe_get_b32(unsigned char *r, const secp256k1_fe *a);
+
+/** Negate a field element.
+ *
+ * On input, r does not need to be initialized. a must be a valid field element with
+ * magnitude not exceeding m. m must be an integer constant expression in [0,31].
+ * Performs {r = -a}.
+ * On output, r will not be normalized, and will have magnitude m+1.
+ */
+#define secp256k1_fe_negate(r, a, m) ASSERT_INT_CONST_AND_DO(m, secp256k1_fe_negate_unchecked(r, a, m))
+
+/** Like secp256k1_fe_negate_unchecked but m is not checked to be an integer constant expression.
+ *
+ * Should not be called directly outside of tests.
+ */
+static void secp256k1_fe_negate_unchecked(secp256k1_fe *r, const secp256k1_fe *a, int m);
+
+/** Add a small integer to a field element.
+ *
+ * Performs {r += a}. The magnitude of r increases by 1, and normalized is cleared.
+ * a must be in range [0,0x7FFF].
+ */
+static void secp256k1_fe_add_int(secp256k1_fe *r, int a);
+
+/** Multiply a field element with a small integer.
+ *
+ * On input, r must be a valid field element. a must be an integer constant expression in [0,32].
+ * The magnitude of r times a must not exceed 32.
+ * Performs {r *= a}.
+ * On output, r's magnitude is multiplied by a, and r will not be normalized.
+ */
+#define secp256k1_fe_mul_int(r, a) ASSERT_INT_CONST_AND_DO(a, secp256k1_fe_mul_int_unchecked(r, a))
+
+/** Like secp256k1_fe_mul_int but a is not checked to be an integer constant expression.
+ * 
+ * Should not be called directly outside of tests.
+ */
+static void secp256k1_fe_mul_int_unchecked(secp256k1_fe *r, int a);
+
+/** Increment a field element by another.
+ *
+ * On input, r and a must be valid field elements, not necessarily normalized.
+ * The sum of their magnitudes must not exceed 32.
+ * Performs {r += a}.
+ * On output, r will not be normalized, and will have magnitude incremented by a's.
+ */
+static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a);
+
+/** Multiply two field elements.
+ *
+ * On input, a and b must be valid field elements; r does not need to be initialized.
+ * r and a may point to the same object, but neither may point to the object pointed
+ * to by b. The magnitudes of a and b must not exceed 8.
+ * Performs {r = a * b}
+ * On output, r will have magnitude 1, but won't be normalized.
+ */
+static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b);
+
+/** Square a field element.
+ *
+ * On input, a must be a valid field element; r does not need to be initialized. The magnitude
+ * of a must not exceed 8.
+ * Performs {r = a**2}
+ * On output, r will have magnitude 1, but won't be normalized.
+ */
+static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a);
+
+/** Compute a square root of a field element.
+ *
+ * On input, a must be a valid field element with magnitude<=8; r need not be initialized.
+ * If sqrt(a) exists, performs {r = sqrt(a)} and returns 1.
+ * Otherwise, sqrt(-a) exists. The function performs {r = sqrt(-a)} and returns 0.
+ * The resulting value represented by r will be a square itself.
+ * Variables r and a must not point to the same object.
+ * On output, r will have magnitude 1 but will not be normalized.
+ */
+static int secp256k1_fe_sqrt(secp256k1_fe * SECP256K1_RESTRICT r, const secp256k1_fe * SECP256K1_RESTRICT a);
+
+/** Compute the modular inverse of a field element.
+ *
+ * On input, a must be a valid field element; r need not be initialized.
+ * Performs {r = a**(p-2)} (which maps 0 to 0, and every other element to its
+ * inverse).
+ * On output, r will have magnitude (a.magnitude != 0) and be normalized.
+ */
+static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *a);
+
+/** Compute the modular inverse of a field element, without constant-time guarantee.
+ *
+ * Behaves identically to secp256k1_fe_inv, but is not constant-time in a.
+ */
+static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *a);
+
+/** Convert a field element to secp256k1_fe_storage.
+ *
+ * On input, a must be a valid normalized field element.
+ * Performs {r = a}.
+ */
+static void secp256k1_fe_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a);
+
+/** Convert a field element back from secp256k1_fe_storage.
+ *
+ * On input, r need not be initialized.
+ * Performs {r = a}.
+ * On output, r will be normalized and will have magnitude 1.
+ */
+static void secp256k1_fe_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a);
+
+/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time.  Both *r and *a must be initialized.*/
+static void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag);
+
+/** Conditionally move a field element in constant time.
+ *
+ * On input, both r and a must be valid field elements. Flag must be 0 or 1.
+ * Performs {r = flag ? a : r}.
+ *
+ * On output, r's magnitude will be the maximum of both input magnitudes.
+ * It will be normalized if and only if both inputs were normalized.
+ */
+static void secp256k1_fe_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag);
+
+/** Halve the value of a field element modulo the field prime in constant-time.
+ *
+ * On input, r must be a valid field element.
+ * On output, r will be normalized and have magnitude floor(m/2) + 1 where m is
+ * the magnitude of r on input.
+ */
+static void secp256k1_fe_half(secp256k1_fe *r);
+
+/** Sets r to a field element with magnitude m, normalized if (and only if) m==0.
+ *  The value is chosen so that it is likely to trigger edge cases related to
+ *  internal overflows. */
+static void secp256k1_fe_get_bounds(secp256k1_fe *r, int m);
+
+/** Determine whether a is a square (modulo p).
+ *
+ * On input, a must be a valid field element.
+ */
+static int secp256k1_fe_is_square_var(const secp256k1_fe *a);
+
+/** Check invariants on a field element (no-op unless VERIFY is enabled). */
+static void secp256k1_fe_verify(const secp256k1_fe *a);
+#define SECP256K1_FE_VERIFY(a) secp256k1_fe_verify(a)
+
+/** Check that magnitude of a is at most m (no-op unless VERIFY is enabled). */
+static void secp256k1_fe_verify_magnitude(const secp256k1_fe *a, int m);
+#define SECP256K1_FE_VERIFY_MAGNITUDE(a, m) secp256k1_fe_verify_magnitude(a, m)
+
+#endif /* SECP256K1_FIELD_H */
diff --git a/vendor/external/secp256k1/src/field_10x26.h b/vendor/external/secp256k1/src/field_10x26.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/field_10x26.h
@@ -0,0 +1,57 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_FIELD_REPR_H
+#define SECP256K1_FIELD_REPR_H
+
+#include <stdint.h>
+
+/** This field implementation represents the value as 10 uint32_t limbs in base
+ *  2^26. */
+typedef struct {
+   /* A field element f represents the sum(i=0..9, f.n[i] << (i*26)) mod p,
+    * where p is the field modulus, 2^256 - 2^32 - 977.
+    *
+    * The individual limbs f.n[i] can exceed 2^26; the field's magnitude roughly
+    * corresponds to how much excess is allowed. The value
+    * sum(i=0..9, f.n[i] << (i*26)) may exceed p, unless the field element is
+    * normalized. */
+    uint32_t n[10];
+    /*
+     * Magnitude m requires:
+     *     n[i] <= 2 * m * (2^26 - 1) for i=0..8
+     *     n[9] <= 2 * m * (2^22 - 1)
+     *
+     * Normalized requires:
+     *     n[i] <= (2^26 - 1) for i=0..8
+     *     sum(i=0..9, n[i] << (i*26)) < p
+     *     (together these imply n[9] <= 2^22 - 1)
+     */
+    SECP256K1_FE_VERIFY_FIELDS
+} secp256k1_fe;
+
+/* Unpacks a constant into a overlapping multi-limbed FE element. */
+#define SECP256K1_FE_CONST_INNER(d7, d6, d5, d4, d3, d2, d1, d0) { \
+    (d0) & 0x3FFFFFFUL, \
+    (((uint32_t)d0) >> 26) | (((uint32_t)(d1) & 0xFFFFFUL) << 6), \
+    (((uint32_t)d1) >> 20) | (((uint32_t)(d2) & 0x3FFFUL) << 12), \
+    (((uint32_t)d2) >> 14) | (((uint32_t)(d3) & 0xFFUL) << 18), \
+    (((uint32_t)d3) >> 8) | (((uint32_t)(d4) & 0x3UL) << 24), \
+    (((uint32_t)d4) >> 2) & 0x3FFFFFFUL, \
+    (((uint32_t)d4) >> 28) | (((uint32_t)(d5) & 0x3FFFFFUL) << 4), \
+    (((uint32_t)d5) >> 22) | (((uint32_t)(d6) & 0xFFFFUL) << 10), \
+    (((uint32_t)d6) >> 16) | (((uint32_t)(d7) & 0x3FFUL) << 16), \
+    (((uint32_t)d7) >> 10) \
+}
+
+typedef struct {
+    uint32_t n[8];
+} secp256k1_fe_storage;
+
+#define SECP256K1_FE_STORAGE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}
+#define SECP256K1_FE_STORAGE_CONST_GET(d) d.n[7], d.n[6], d.n[5], d.n[4],d.n[3], d.n[2], d.n[1], d.n[0]
+
+#endif /* SECP256K1_FIELD_REPR_H */
diff --git a/vendor/external/secp256k1/src/field_10x26_impl.h b/vendor/external/secp256k1/src/field_10x26_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/field_10x26_impl.h
@@ -0,0 +1,1232 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_FIELD_REPR_IMPL_H
+#define SECP256K1_FIELD_REPR_IMPL_H
+
+#include "checkmem.h"
+#include "util.h"
+#include "field.h"
+#include "modinv32_impl.h"
+
+#ifdef VERIFY
+static void secp256k1_fe_impl_verify(const secp256k1_fe *a) {
+    const uint32_t *d = a->n;
+    int m = a->normalized ? 1 : 2 * a->magnitude;
+    VERIFY_CHECK(d[0] <= 0x3FFFFFFUL * m);
+    VERIFY_CHECK(d[1] <= 0x3FFFFFFUL * m);
+    VERIFY_CHECK(d[2] <= 0x3FFFFFFUL * m);
+    VERIFY_CHECK(d[3] <= 0x3FFFFFFUL * m);
+    VERIFY_CHECK(d[4] <= 0x3FFFFFFUL * m);
+    VERIFY_CHECK(d[5] <= 0x3FFFFFFUL * m);
+    VERIFY_CHECK(d[6] <= 0x3FFFFFFUL * m);
+    VERIFY_CHECK(d[7] <= 0x3FFFFFFUL * m);
+    VERIFY_CHECK(d[8] <= 0x3FFFFFFUL * m);
+    VERIFY_CHECK(d[9] <= 0x03FFFFFUL * m);
+    if (a->normalized) {
+        if (d[9] == 0x03FFFFFUL) {
+            uint32_t mid = d[8] & d[7] & d[6] & d[5] & d[4] & d[3] & d[2];
+            if (mid == 0x3FFFFFFUL) {
+                VERIFY_CHECK((d[1] + 0x40UL + ((d[0] + 0x3D1UL) >> 26)) <= 0x3FFFFFFUL);
+            }
+        }
+    }
+}
+#endif
+
+static void secp256k1_fe_impl_get_bounds(secp256k1_fe *r, int m) {
+    r->n[0] = 0x3FFFFFFUL * 2 * m;
+    r->n[1] = 0x3FFFFFFUL * 2 * m;
+    r->n[2] = 0x3FFFFFFUL * 2 * m;
+    r->n[3] = 0x3FFFFFFUL * 2 * m;
+    r->n[4] = 0x3FFFFFFUL * 2 * m;
+    r->n[5] = 0x3FFFFFFUL * 2 * m;
+    r->n[6] = 0x3FFFFFFUL * 2 * m;
+    r->n[7] = 0x3FFFFFFUL * 2 * m;
+    r->n[8] = 0x3FFFFFFUL * 2 * m;
+    r->n[9] = 0x03FFFFFUL * 2 * m;
+}
+
+static void secp256k1_fe_impl_normalize(secp256k1_fe *r) {
+    uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4],
+             t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9];
+
+    /* Reduce t9 at the start so there will be at most a single carry from the first pass */
+    uint32_t m;
+    uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL;
+
+    /* The first pass ensures the magnitude is 1, ... */
+    t0 += x * 0x3D1UL; t1 += (x << 6);
+    t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL;
+    t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL;
+    t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; m = t2;
+    t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; m &= t3;
+    t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; m &= t4;
+    t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; m &= t5;
+    t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; m &= t6;
+    t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; m &= t7;
+    t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; m &= t8;
+
+    /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */
+    VERIFY_CHECK(t9 >> 23 == 0);
+
+    /* At most a single final reduction is needed; check if the value is >= the field characteristic */
+    x = (t9 >> 22) | ((t9 == 0x03FFFFFUL) & (m == 0x3FFFFFFUL)
+        & ((t1 + 0x40UL + ((t0 + 0x3D1UL) >> 26)) > 0x3FFFFFFUL));
+
+    /* Apply the final reduction (for constant-time behaviour, we do it always) */
+    t0 += x * 0x3D1UL; t1 += (x << 6);
+    t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL;
+    t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL;
+    t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL;
+    t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL;
+    t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL;
+    t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL;
+    t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL;
+    t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL;
+    t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL;
+
+    /* If t9 didn't carry to bit 22 already, then it should have after any final reduction */
+    VERIFY_CHECK(t9 >> 22 == x);
+
+    /* Mask off the possible multiple of 2^256 from the final reduction */
+    t9 &= 0x03FFFFFUL;
+
+    r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4;
+    r->n[5] = t5; r->n[6] = t6; r->n[7] = t7; r->n[8] = t8; r->n[9] = t9;
+}
+
+static void secp256k1_fe_impl_normalize_weak(secp256k1_fe *r) {
+    uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4],
+             t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9];
+
+    /* Reduce t9 at the start so there will be at most a single carry from the first pass */
+    uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL;
+
+    /* The first pass ensures the magnitude is 1, ... */
+    t0 += x * 0x3D1UL; t1 += (x << 6);
+    t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL;
+    t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL;
+    t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL;
+    t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL;
+    t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL;
+    t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL;
+    t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL;
+    t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL;
+    t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL;
+
+    /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */
+    VERIFY_CHECK(t9 >> 23 == 0);
+
+    r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4;
+    r->n[5] = t5; r->n[6] = t6; r->n[7] = t7; r->n[8] = t8; r->n[9] = t9;
+}
+
+static void secp256k1_fe_impl_normalize_var(secp256k1_fe *r) {
+    uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4],
+             t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9];
+
+    /* Reduce t9 at the start so there will be at most a single carry from the first pass */
+    uint32_t m;
+    uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL;
+
+    /* The first pass ensures the magnitude is 1, ... */
+    t0 += x * 0x3D1UL; t1 += (x << 6);
+    t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL;
+    t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL;
+    t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; m = t2;
+    t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; m &= t3;
+    t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; m &= t4;
+    t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; m &= t5;
+    t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; m &= t6;
+    t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; m &= t7;
+    t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; m &= t8;
+
+    /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */
+    VERIFY_CHECK(t9 >> 23 == 0);
+
+    /* At most a single final reduction is needed; check if the value is >= the field characteristic */
+    x = (t9 >> 22) | ((t9 == 0x03FFFFFUL) & (m == 0x3FFFFFFUL)
+        & ((t1 + 0x40UL + ((t0 + 0x3D1UL) >> 26)) > 0x3FFFFFFUL));
+
+    if (x) {
+        t0 += 0x3D1UL; t1 += (x << 6);
+        t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL;
+        t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL;
+        t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL;
+        t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL;
+        t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL;
+        t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL;
+        t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL;
+        t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL;
+        t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL;
+
+        /* If t9 didn't carry to bit 22 already, then it should have after any final reduction */
+        VERIFY_CHECK(t9 >> 22 == x);
+
+        /* Mask off the possible multiple of 2^256 from the final reduction */
+        t9 &= 0x03FFFFFUL;
+    }
+
+    r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4;
+    r->n[5] = t5; r->n[6] = t6; r->n[7] = t7; r->n[8] = t8; r->n[9] = t9;
+}
+
+static int secp256k1_fe_impl_normalizes_to_zero(const secp256k1_fe *r) {
+    uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4],
+             t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9];
+
+    /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */
+    uint32_t z0, z1;
+
+    /* Reduce t9 at the start so there will be at most a single carry from the first pass */
+    uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL;
+
+    /* The first pass ensures the magnitude is 1, ... */
+    t0 += x * 0x3D1UL; t1 += (x << 6);
+    t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; z0  = t0; z1  = t0 ^ 0x3D0UL;
+    t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; z0 |= t1; z1 &= t1 ^ 0x40UL;
+    t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; z0 |= t2; z1 &= t2;
+    t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; z0 |= t3; z1 &= t3;
+    t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; z0 |= t4; z1 &= t4;
+    t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; z0 |= t5; z1 &= t5;
+    t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; z0 |= t6; z1 &= t6;
+    t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; z0 |= t7; z1 &= t7;
+    t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; z0 |= t8; z1 &= t8;
+                                         z0 |= t9; z1 &= t9 ^ 0x3C00000UL;
+
+    /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */
+    VERIFY_CHECK(t9 >> 23 == 0);
+
+    return (z0 == 0) | (z1 == 0x3FFFFFFUL);
+}
+
+static int secp256k1_fe_impl_normalizes_to_zero_var(const secp256k1_fe *r) {
+    uint32_t t0, t1, t2, t3, t4, t5, t6, t7, t8, t9;
+    uint32_t z0, z1;
+    uint32_t x;
+
+    t0 = r->n[0];
+    t9 = r->n[9];
+
+    /* Reduce t9 at the start so there will be at most a single carry from the first pass */
+    x = t9 >> 22;
+
+    /* The first pass ensures the magnitude is 1, ... */
+    t0 += x * 0x3D1UL;
+
+    /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */
+    z0 = t0 & 0x3FFFFFFUL;
+    z1 = z0 ^ 0x3D0UL;
+
+    /* Fast return path should catch the majority of cases */
+    if ((z0 != 0UL) & (z1 != 0x3FFFFFFUL)) {
+        return 0;
+    }
+
+    t1 = r->n[1];
+    t2 = r->n[2];
+    t3 = r->n[3];
+    t4 = r->n[4];
+    t5 = r->n[5];
+    t6 = r->n[6];
+    t7 = r->n[7];
+    t8 = r->n[8];
+
+    t9 &= 0x03FFFFFUL;
+    t1 += (x << 6);
+
+    t1 += (t0 >> 26);
+    t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; z0 |= t1; z1 &= t1 ^ 0x40UL;
+    t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; z0 |= t2; z1 &= t2;
+    t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; z0 |= t3; z1 &= t3;
+    t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; z0 |= t4; z1 &= t4;
+    t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; z0 |= t5; z1 &= t5;
+    t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; z0 |= t6; z1 &= t6;
+    t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; z0 |= t7; z1 &= t7;
+    t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; z0 |= t8; z1 &= t8;
+                                         z0 |= t9; z1 &= t9 ^ 0x3C00000UL;
+
+    /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */
+    VERIFY_CHECK(t9 >> 23 == 0);
+
+    return (z0 == 0) | (z1 == 0x3FFFFFFUL);
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_set_int(secp256k1_fe *r, int a) {
+    r->n[0] = a;
+    r->n[1] = r->n[2] = r->n[3] = r->n[4] = r->n[5] = r->n[6] = r->n[7] = r->n[8] = r->n[9] = 0;
+}
+
+SECP256K1_INLINE static int secp256k1_fe_impl_is_zero(const secp256k1_fe *a) {
+    const uint32_t *t = a->n;
+    return (t[0] | t[1] | t[2] | t[3] | t[4] | t[5] | t[6] | t[7] | t[8] | t[9]) == 0;
+}
+
+SECP256K1_INLINE static int secp256k1_fe_impl_is_odd(const secp256k1_fe *a) {
+    return a->n[0] & 1;
+}
+
+static int secp256k1_fe_impl_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b) {
+    int i;
+    for (i = 9; i >= 0; i--) {
+        if (a->n[i] > b->n[i]) {
+            return 1;
+        }
+        if (a->n[i] < b->n[i]) {
+            return -1;
+        }
+    }
+    return 0;
+}
+
+static void secp256k1_fe_impl_set_b32_mod(secp256k1_fe *r, const unsigned char *a) {
+    r->n[0] = (uint32_t)a[31] | ((uint32_t)a[30] << 8) | ((uint32_t)a[29] << 16) | ((uint32_t)(a[28] & 0x3) << 24);
+    r->n[1] = (uint32_t)((a[28] >> 2) & 0x3f) | ((uint32_t)a[27] << 6) | ((uint32_t)a[26] << 14) | ((uint32_t)(a[25] & 0xf) << 22);
+    r->n[2] = (uint32_t)((a[25] >> 4) & 0xf) | ((uint32_t)a[24] << 4) | ((uint32_t)a[23] << 12) | ((uint32_t)(a[22] & 0x3f) << 20);
+    r->n[3] = (uint32_t)((a[22] >> 6) & 0x3) | ((uint32_t)a[21] << 2) | ((uint32_t)a[20] << 10) | ((uint32_t)a[19] << 18);
+    r->n[4] = (uint32_t)a[18] | ((uint32_t)a[17] << 8) | ((uint32_t)a[16] << 16) | ((uint32_t)(a[15] & 0x3) << 24);
+    r->n[5] = (uint32_t)((a[15] >> 2) & 0x3f) | ((uint32_t)a[14] << 6) | ((uint32_t)a[13] << 14) | ((uint32_t)(a[12] & 0xf) << 22);
+    r->n[6] = (uint32_t)((a[12] >> 4) & 0xf) | ((uint32_t)a[11] << 4) | ((uint32_t)a[10] << 12) | ((uint32_t)(a[9] & 0x3f) << 20);
+    r->n[7] = (uint32_t)((a[9] >> 6) & 0x3) | ((uint32_t)a[8] << 2) | ((uint32_t)a[7] << 10) | ((uint32_t)a[6] << 18);
+    r->n[8] = (uint32_t)a[5] | ((uint32_t)a[4] << 8) | ((uint32_t)a[3] << 16) | ((uint32_t)(a[2] & 0x3) << 24);
+    r->n[9] = (uint32_t)((a[2] >> 2) & 0x3f) | ((uint32_t)a[1] << 6) | ((uint32_t)a[0] << 14);
+}
+
+static int secp256k1_fe_impl_set_b32_limit(secp256k1_fe *r, const unsigned char *a) {
+    secp256k1_fe_impl_set_b32_mod(r, a);
+    return !((r->n[9] == 0x3FFFFFUL) & ((r->n[8] & r->n[7] & r->n[6] & r->n[5] & r->n[4] & r->n[3] & r->n[2]) == 0x3FFFFFFUL) & ((r->n[1] + 0x40UL + ((r->n[0] + 0x3D1UL) >> 26)) > 0x3FFFFFFUL));
+}
+
+/** Convert a field element to a 32-byte big endian value. Requires the input to be normalized */
+static void secp256k1_fe_impl_get_b32(unsigned char *r, const secp256k1_fe *a) {
+    r[0] = (a->n[9] >> 14) & 0xff;
+    r[1] = (a->n[9] >> 6) & 0xff;
+    r[2] = ((a->n[9] & 0x3F) << 2) | ((a->n[8] >> 24) & 0x3);
+    r[3] = (a->n[8] >> 16) & 0xff;
+    r[4] = (a->n[8] >> 8) & 0xff;
+    r[5] = a->n[8] & 0xff;
+    r[6] = (a->n[7] >> 18) & 0xff;
+    r[7] = (a->n[7] >> 10) & 0xff;
+    r[8] = (a->n[7] >> 2) & 0xff;
+    r[9] = ((a->n[7] & 0x3) << 6) | ((a->n[6] >> 20) & 0x3f);
+    r[10] = (a->n[6] >> 12) & 0xff;
+    r[11] = (a->n[6] >> 4) & 0xff;
+    r[12] = ((a->n[6] & 0xf) << 4) | ((a->n[5] >> 22) & 0xf);
+    r[13] = (a->n[5] >> 14) & 0xff;
+    r[14] = (a->n[5] >> 6) & 0xff;
+    r[15] = ((a->n[5] & 0x3f) << 2) | ((a->n[4] >> 24) & 0x3);
+    r[16] = (a->n[4] >> 16) & 0xff;
+    r[17] = (a->n[4] >> 8) & 0xff;
+    r[18] = a->n[4] & 0xff;
+    r[19] = (a->n[3] >> 18) & 0xff;
+    r[20] = (a->n[3] >> 10) & 0xff;
+    r[21] = (a->n[3] >> 2) & 0xff;
+    r[22] = ((a->n[3] & 0x3) << 6) | ((a->n[2] >> 20) & 0x3f);
+    r[23] = (a->n[2] >> 12) & 0xff;
+    r[24] = (a->n[2] >> 4) & 0xff;
+    r[25] = ((a->n[2] & 0xf) << 4) | ((a->n[1] >> 22) & 0xf);
+    r[26] = (a->n[1] >> 14) & 0xff;
+    r[27] = (a->n[1] >> 6) & 0xff;
+    r[28] = ((a->n[1] & 0x3f) << 2) | ((a->n[0] >> 24) & 0x3);
+    r[29] = (a->n[0] >> 16) & 0xff;
+    r[30] = (a->n[0] >> 8) & 0xff;
+    r[31] = a->n[0] & 0xff;
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_negate_unchecked(secp256k1_fe *r, const secp256k1_fe *a, int m) {
+    /* For all legal values of m (0..31), the following properties hold: */
+    VERIFY_CHECK(0x3FFFC2FUL * 2 * (m + 1) >= 0x3FFFFFFUL * 2 * m);
+    VERIFY_CHECK(0x3FFFFBFUL * 2 * (m + 1) >= 0x3FFFFFFUL * 2 * m);
+    VERIFY_CHECK(0x3FFFFFFUL * 2 * (m + 1) >= 0x3FFFFFFUL * 2 * m);
+    VERIFY_CHECK(0x03FFFFFUL * 2 * (m + 1) >= 0x03FFFFFUL * 2 * m);
+
+    /* Due to the properties above, the left hand in the subtractions below is never less than
+     * the right hand. */
+    r->n[0] = 0x3FFFC2FUL * 2 * (m + 1) - a->n[0];
+    r->n[1] = 0x3FFFFBFUL * 2 * (m + 1) - a->n[1];
+    r->n[2] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[2];
+    r->n[3] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[3];
+    r->n[4] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[4];
+    r->n[5] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[5];
+    r->n[6] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[6];
+    r->n[7] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[7];
+    r->n[8] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[8];
+    r->n[9] = 0x03FFFFFUL * 2 * (m + 1) - a->n[9];
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_mul_int_unchecked(secp256k1_fe *r, int a) {
+    r->n[0] *= a;
+    r->n[1] *= a;
+    r->n[2] *= a;
+    r->n[3] *= a;
+    r->n[4] *= a;
+    r->n[5] *= a;
+    r->n[6] *= a;
+    r->n[7] *= a;
+    r->n[8] *= a;
+    r->n[9] *= a;
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_add(secp256k1_fe *r, const secp256k1_fe *a) {
+    r->n[0] += a->n[0];
+    r->n[1] += a->n[1];
+    r->n[2] += a->n[2];
+    r->n[3] += a->n[3];
+    r->n[4] += a->n[4];
+    r->n[5] += a->n[5];
+    r->n[6] += a->n[6];
+    r->n[7] += a->n[7];
+    r->n[8] += a->n[8];
+    r->n[9] += a->n[9];
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_add_int(secp256k1_fe *r, int a) {
+    r->n[0] += a;
+}
+
+#if defined(USE_EXTERNAL_ASM)
+
+/* External assembler implementation */
+void secp256k1_fe_mul_inner(uint32_t *r, const uint32_t *a, const uint32_t * SECP256K1_RESTRICT b);
+void secp256k1_fe_sqr_inner(uint32_t *r, const uint32_t *a);
+
+#else
+
+#define VERIFY_BITS(x, n) VERIFY_CHECK(((x) >> (n)) == 0)
+
+SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint32_t *r, const uint32_t *a, const uint32_t * SECP256K1_RESTRICT b) {
+    uint64_t c, d;
+    uint64_t u0, u1, u2, u3, u4, u5, u6, u7, u8;
+    uint32_t t9, t1, t0, t2, t3, t4, t5, t6, t7;
+    const uint32_t M = 0x3FFFFFFUL, R0 = 0x3D10UL, R1 = 0x400UL;
+
+    VERIFY_BITS(a[0], 30);
+    VERIFY_BITS(a[1], 30);
+    VERIFY_BITS(a[2], 30);
+    VERIFY_BITS(a[3], 30);
+    VERIFY_BITS(a[4], 30);
+    VERIFY_BITS(a[5], 30);
+    VERIFY_BITS(a[6], 30);
+    VERIFY_BITS(a[7], 30);
+    VERIFY_BITS(a[8], 30);
+    VERIFY_BITS(a[9], 26);
+    VERIFY_BITS(b[0], 30);
+    VERIFY_BITS(b[1], 30);
+    VERIFY_BITS(b[2], 30);
+    VERIFY_BITS(b[3], 30);
+    VERIFY_BITS(b[4], 30);
+    VERIFY_BITS(b[5], 30);
+    VERIFY_BITS(b[6], 30);
+    VERIFY_BITS(b[7], 30);
+    VERIFY_BITS(b[8], 30);
+    VERIFY_BITS(b[9], 26);
+
+    /** [... a b c] is a shorthand for ... + a<<52 + b<<26 + c<<0 mod n.
+     *  for 0 <= x <= 9, px is a shorthand for sum(a[i]*b[x-i], i=0..x).
+     *  for 9 <= x <= 18, px is a shorthand for sum(a[i]*b[x-i], i=(x-9)..9)
+     *  Note that [x 0 0 0 0 0 0 0 0 0 0] = [x*R1 x*R0].
+     */
+
+    d  = (uint64_t)a[0] * b[9]
+       + (uint64_t)a[1] * b[8]
+       + (uint64_t)a[2] * b[7]
+       + (uint64_t)a[3] * b[6]
+       + (uint64_t)a[4] * b[5]
+       + (uint64_t)a[5] * b[4]
+       + (uint64_t)a[6] * b[3]
+       + (uint64_t)a[7] * b[2]
+       + (uint64_t)a[8] * b[1]
+       + (uint64_t)a[9] * b[0];
+    /* VERIFY_BITS(d, 64); */
+    /* [d 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */
+    t9 = d & M; d >>= 26;
+    VERIFY_BITS(t9, 26);
+    VERIFY_BITS(d, 38);
+    /* [d t9 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */
+
+    c  = (uint64_t)a[0] * b[0];
+    VERIFY_BITS(c, 60);
+    /* [d t9 0 0 0 0 0 0 0 0 c] = [p9 0 0 0 0 0 0 0 0 p0] */
+    d += (uint64_t)a[1] * b[9]
+       + (uint64_t)a[2] * b[8]
+       + (uint64_t)a[3] * b[7]
+       + (uint64_t)a[4] * b[6]
+       + (uint64_t)a[5] * b[5]
+       + (uint64_t)a[6] * b[4]
+       + (uint64_t)a[7] * b[3]
+       + (uint64_t)a[8] * b[2]
+       + (uint64_t)a[9] * b[1];
+    VERIFY_BITS(d, 63);
+    /* [d t9 0 0 0 0 0 0 0 0 c] = [p10 p9 0 0 0 0 0 0 0 0 p0] */
+    u0 = d & M; d >>= 26; c += u0 * R0;
+    VERIFY_BITS(u0, 26);
+    VERIFY_BITS(d, 37);
+    VERIFY_BITS(c, 61);
+    /* [d u0 t9 0 0 0 0 0 0 0 0 c-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */
+    t0 = c & M; c >>= 26; c += u0 * R1;
+    VERIFY_BITS(t0, 26);
+    VERIFY_BITS(c, 37);
+    /* [d u0 t9 0 0 0 0 0 0 0 c-u0*R1 t0-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */
+    /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */
+
+    c += (uint64_t)a[0] * b[1]
+       + (uint64_t)a[1] * b[0];
+    VERIFY_BITS(c, 62);
+    /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 p1 p0] */
+    d += (uint64_t)a[2] * b[9]
+       + (uint64_t)a[3] * b[8]
+       + (uint64_t)a[4] * b[7]
+       + (uint64_t)a[5] * b[6]
+       + (uint64_t)a[6] * b[5]
+       + (uint64_t)a[7] * b[4]
+       + (uint64_t)a[8] * b[3]
+       + (uint64_t)a[9] * b[2];
+    VERIFY_BITS(d, 63);
+    /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */
+    u1 = d & M; d >>= 26; c += u1 * R0;
+    VERIFY_BITS(u1, 26);
+    VERIFY_BITS(d, 37);
+    VERIFY_BITS(c, 63);
+    /* [d u1 0 t9 0 0 0 0 0 0 0 c-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */
+    t1 = c & M; c >>= 26; c += u1 * R1;
+    VERIFY_BITS(t1, 26);
+    VERIFY_BITS(c, 38);
+    /* [d u1 0 t9 0 0 0 0 0 0 c-u1*R1 t1-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */
+    /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */
+
+    c += (uint64_t)a[0] * b[2]
+       + (uint64_t)a[1] * b[1]
+       + (uint64_t)a[2] * b[0];
+    VERIFY_BITS(c, 62);
+    /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */
+    d += (uint64_t)a[3] * b[9]
+       + (uint64_t)a[4] * b[8]
+       + (uint64_t)a[5] * b[7]
+       + (uint64_t)a[6] * b[6]
+       + (uint64_t)a[7] * b[5]
+       + (uint64_t)a[8] * b[4]
+       + (uint64_t)a[9] * b[3];
+    VERIFY_BITS(d, 63);
+    /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */
+    u2 = d & M; d >>= 26; c += u2 * R0;
+    VERIFY_BITS(u2, 26);
+    VERIFY_BITS(d, 37);
+    VERIFY_BITS(c, 63);
+    /* [d u2 0 0 t9 0 0 0 0 0 0 c-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */
+    t2 = c & M; c >>= 26; c += u2 * R1;
+    VERIFY_BITS(t2, 26);
+    VERIFY_BITS(c, 38);
+    /* [d u2 0 0 t9 0 0 0 0 0 c-u2*R1 t2-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */
+    /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */
+
+    c += (uint64_t)a[0] * b[3]
+       + (uint64_t)a[1] * b[2]
+       + (uint64_t)a[2] * b[1]
+       + (uint64_t)a[3] * b[0];
+    VERIFY_BITS(c, 63);
+    /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */
+    d += (uint64_t)a[4] * b[9]
+       + (uint64_t)a[5] * b[8]
+       + (uint64_t)a[6] * b[7]
+       + (uint64_t)a[7] * b[6]
+       + (uint64_t)a[8] * b[5]
+       + (uint64_t)a[9] * b[4];
+    VERIFY_BITS(d, 63);
+    /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */
+    u3 = d & M; d >>= 26; c += u3 * R0;
+    VERIFY_BITS(u3, 26);
+    VERIFY_BITS(d, 37);
+    /* VERIFY_BITS(c, 64); */
+    /* [d u3 0 0 0 t9 0 0 0 0 0 c-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */
+    t3 = c & M; c >>= 26; c += u3 * R1;
+    VERIFY_BITS(t3, 26);
+    VERIFY_BITS(c, 39);
+    /* [d u3 0 0 0 t9 0 0 0 0 c-u3*R1 t3-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */
+
+    c += (uint64_t)a[0] * b[4]
+       + (uint64_t)a[1] * b[3]
+       + (uint64_t)a[2] * b[2]
+       + (uint64_t)a[3] * b[1]
+       + (uint64_t)a[4] * b[0];
+    VERIFY_BITS(c, 63);
+    /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */
+    d += (uint64_t)a[5] * b[9]
+       + (uint64_t)a[6] * b[8]
+       + (uint64_t)a[7] * b[7]
+       + (uint64_t)a[8] * b[6]
+       + (uint64_t)a[9] * b[5];
+    VERIFY_BITS(d, 62);
+    /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */
+    u4 = d & M; d >>= 26; c += u4 * R0;
+    VERIFY_BITS(u4, 26);
+    VERIFY_BITS(d, 36);
+    /* VERIFY_BITS(c, 64); */
+    /* [d u4 0 0 0 0 t9 0 0 0 0 c-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */
+    t4 = c & M; c >>= 26; c += u4 * R1;
+    VERIFY_BITS(t4, 26);
+    VERIFY_BITS(c, 39);
+    /* [d u4 0 0 0 0 t9 0 0 0 c-u4*R1 t4-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */
+
+    c += (uint64_t)a[0] * b[5]
+       + (uint64_t)a[1] * b[4]
+       + (uint64_t)a[2] * b[3]
+       + (uint64_t)a[3] * b[2]
+       + (uint64_t)a[4] * b[1]
+       + (uint64_t)a[5] * b[0];
+    VERIFY_BITS(c, 63);
+    /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */
+    d += (uint64_t)a[6] * b[9]
+       + (uint64_t)a[7] * b[8]
+       + (uint64_t)a[8] * b[7]
+       + (uint64_t)a[9] * b[6];
+    VERIFY_BITS(d, 62);
+    /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */
+    u5 = d & M; d >>= 26; c += u5 * R0;
+    VERIFY_BITS(u5, 26);
+    VERIFY_BITS(d, 36);
+    /* VERIFY_BITS(c, 64); */
+    /* [d u5 0 0 0 0 0 t9 0 0 0 c-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */
+    t5 = c & M; c >>= 26; c += u5 * R1;
+    VERIFY_BITS(t5, 26);
+    VERIFY_BITS(c, 39);
+    /* [d u5 0 0 0 0 0 t9 0 0 c-u5*R1 t5-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */
+
+    c += (uint64_t)a[0] * b[6]
+       + (uint64_t)a[1] * b[5]
+       + (uint64_t)a[2] * b[4]
+       + (uint64_t)a[3] * b[3]
+       + (uint64_t)a[4] * b[2]
+       + (uint64_t)a[5] * b[1]
+       + (uint64_t)a[6] * b[0];
+    VERIFY_BITS(c, 63);
+    /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */
+    d += (uint64_t)a[7] * b[9]
+       + (uint64_t)a[8] * b[8]
+       + (uint64_t)a[9] * b[7];
+    VERIFY_BITS(d, 61);
+    /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */
+    u6 = d & M; d >>= 26; c += u6 * R0;
+    VERIFY_BITS(u6, 26);
+    VERIFY_BITS(d, 35);
+    /* VERIFY_BITS(c, 64); */
+    /* [d u6 0 0 0 0 0 0 t9 0 0 c-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */
+    t6 = c & M; c >>= 26; c += u6 * R1;
+    VERIFY_BITS(t6, 26);
+    VERIFY_BITS(c, 39);
+    /* [d u6 0 0 0 0 0 0 t9 0 c-u6*R1 t6-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */
+
+    c += (uint64_t)a[0] * b[7]
+       + (uint64_t)a[1] * b[6]
+       + (uint64_t)a[2] * b[5]
+       + (uint64_t)a[3] * b[4]
+       + (uint64_t)a[4] * b[3]
+       + (uint64_t)a[5] * b[2]
+       + (uint64_t)a[6] * b[1]
+       + (uint64_t)a[7] * b[0];
+    /* VERIFY_BITS(c, 64); */
+    VERIFY_CHECK(c <= 0x8000007C00000007ULL);
+    /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */
+    d += (uint64_t)a[8] * b[9]
+       + (uint64_t)a[9] * b[8];
+    VERIFY_BITS(d, 58);
+    /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */
+    u7 = d & M; d >>= 26; c += u7 * R0;
+    VERIFY_BITS(u7, 26);
+    VERIFY_BITS(d, 32);
+    /* VERIFY_BITS(c, 64); */
+    VERIFY_CHECK(c <= 0x800001703FFFC2F7ULL);
+    /* [d u7 0 0 0 0 0 0 0 t9 0 c-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */
+    t7 = c & M; c >>= 26; c += u7 * R1;
+    VERIFY_BITS(t7, 26);
+    VERIFY_BITS(c, 38);
+    /* [d u7 0 0 0 0 0 0 0 t9 c-u7*R1 t7-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */
+
+    c += (uint64_t)a[0] * b[8]
+       + (uint64_t)a[1] * b[7]
+       + (uint64_t)a[2] * b[6]
+       + (uint64_t)a[3] * b[5]
+       + (uint64_t)a[4] * b[4]
+       + (uint64_t)a[5] * b[3]
+       + (uint64_t)a[6] * b[2]
+       + (uint64_t)a[7] * b[1]
+       + (uint64_t)a[8] * b[0];
+    /* VERIFY_BITS(c, 64); */
+    VERIFY_CHECK(c <= 0x9000007B80000008ULL);
+    /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    d += (uint64_t)a[9] * b[9];
+    VERIFY_BITS(d, 57);
+    /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    u8 = d & M; d >>= 26; c += u8 * R0;
+    VERIFY_BITS(u8, 26);
+    VERIFY_BITS(d, 31);
+    /* VERIFY_BITS(c, 64); */
+    VERIFY_CHECK(c <= 0x9000016FBFFFC2F8ULL);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+
+    r[3] = t3;
+    VERIFY_BITS(r[3], 26);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[4] = t4;
+    VERIFY_BITS(r[4], 26);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[5] = t5;
+    VERIFY_BITS(r[5], 26);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[6] = t6;
+    VERIFY_BITS(r[6], 26);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[7] = t7;
+    VERIFY_BITS(r[7], 26);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+
+    r[8] = c & M; c >>= 26; c += u8 * R1;
+    VERIFY_BITS(r[8], 26);
+    VERIFY_BITS(c, 39);
+    /* [d u8 0 0 0 0 0 0 0 0 t9+c-u8*R1 r8-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 0 0 0 0 t9+c r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    c   += d * R0 + t9;
+    VERIFY_BITS(c, 45);
+    /* [d 0 0 0 0 0 0 0 0 0 c-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[9] = c & (M >> 4); c >>= 22; c += d * (R1 << 4);
+    VERIFY_BITS(r[9], 22);
+    VERIFY_BITS(c, 46);
+    /* [d 0 0 0 0 0 0 0 0 r9+((c-d*R1<<4)<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 0 0 -d*R1 r9+(c<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+
+    d    = c * (R0 >> 4) + t0;
+    VERIFY_BITS(d, 56);
+    /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 d-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[0] = d & M; d >>= 26;
+    VERIFY_BITS(r[0], 26);
+    VERIFY_BITS(d, 30);
+    /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1+d r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    d   += c * (R1 >> 4) + t1;
+    VERIFY_BITS(d, 53);
+    VERIFY_CHECK(d <= 0x10000003FFFFBFULL);
+    /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 d-c*R1>>4 r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    /* [r9 r8 r7 r6 r5 r4 r3 t2 d r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[1] = d & M; d >>= 26;
+    VERIFY_BITS(r[1], 26);
+    VERIFY_BITS(d, 27);
+    VERIFY_CHECK(d <= 0x4000000ULL);
+    /* [r9 r8 r7 r6 r5 r4 r3 t2+d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    d   += t2;
+    VERIFY_BITS(d, 27);
+    /* [r9 r8 r7 r6 r5 r4 r3 d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[2] = d;
+    VERIFY_BITS(r[2], 27);
+    /* [r9 r8 r7 r6 r5 r4 r3 r2 r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+}
+
+SECP256K1_INLINE static void secp256k1_fe_sqr_inner(uint32_t *r, const uint32_t *a) {
+    uint64_t c, d;
+    uint64_t u0, u1, u2, u3, u4, u5, u6, u7, u8;
+    uint32_t t9, t0, t1, t2, t3, t4, t5, t6, t7;
+    const uint32_t M = 0x3FFFFFFUL, R0 = 0x3D10UL, R1 = 0x400UL;
+
+    VERIFY_BITS(a[0], 30);
+    VERIFY_BITS(a[1], 30);
+    VERIFY_BITS(a[2], 30);
+    VERIFY_BITS(a[3], 30);
+    VERIFY_BITS(a[4], 30);
+    VERIFY_BITS(a[5], 30);
+    VERIFY_BITS(a[6], 30);
+    VERIFY_BITS(a[7], 30);
+    VERIFY_BITS(a[8], 30);
+    VERIFY_BITS(a[9], 26);
+
+    /** [... a b c] is a shorthand for ... + a<<52 + b<<26 + c<<0 mod n.
+     *  px is a shorthand for sum(a[i]*a[x-i], i=0..x).
+     *  Note that [x 0 0 0 0 0 0 0 0 0 0] = [x*R1 x*R0].
+     */
+
+    d  = (uint64_t)(a[0]*2) * a[9]
+       + (uint64_t)(a[1]*2) * a[8]
+       + (uint64_t)(a[2]*2) * a[7]
+       + (uint64_t)(a[3]*2) * a[6]
+       + (uint64_t)(a[4]*2) * a[5];
+    /* VERIFY_BITS(d, 64); */
+    /* [d 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */
+    t9 = d & M; d >>= 26;
+    VERIFY_BITS(t9, 26);
+    VERIFY_BITS(d, 38);
+    /* [d t9 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */
+
+    c  = (uint64_t)a[0] * a[0];
+    VERIFY_BITS(c, 60);
+    /* [d t9 0 0 0 0 0 0 0 0 c] = [p9 0 0 0 0 0 0 0 0 p0] */
+    d += (uint64_t)(a[1]*2) * a[9]
+       + (uint64_t)(a[2]*2) * a[8]
+       + (uint64_t)(a[3]*2) * a[7]
+       + (uint64_t)(a[4]*2) * a[6]
+       + (uint64_t)a[5] * a[5];
+    VERIFY_BITS(d, 63);
+    /* [d t9 0 0 0 0 0 0 0 0 c] = [p10 p9 0 0 0 0 0 0 0 0 p0] */
+    u0 = d & M; d >>= 26; c += u0 * R0;
+    VERIFY_BITS(u0, 26);
+    VERIFY_BITS(d, 37);
+    VERIFY_BITS(c, 61);
+    /* [d u0 t9 0 0 0 0 0 0 0 0 c-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */
+    t0 = c & M; c >>= 26; c += u0 * R1;
+    VERIFY_BITS(t0, 26);
+    VERIFY_BITS(c, 37);
+    /* [d u0 t9 0 0 0 0 0 0 0 c-u0*R1 t0-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */
+    /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */
+
+    c += (uint64_t)(a[0]*2) * a[1];
+    VERIFY_BITS(c, 62);
+    /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 p1 p0] */
+    d += (uint64_t)(a[2]*2) * a[9]
+       + (uint64_t)(a[3]*2) * a[8]
+       + (uint64_t)(a[4]*2) * a[7]
+       + (uint64_t)(a[5]*2) * a[6];
+    VERIFY_BITS(d, 63);
+    /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */
+    u1 = d & M; d >>= 26; c += u1 * R0;
+    VERIFY_BITS(u1, 26);
+    VERIFY_BITS(d, 37);
+    VERIFY_BITS(c, 63);
+    /* [d u1 0 t9 0 0 0 0 0 0 0 c-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */
+    t1 = c & M; c >>= 26; c += u1 * R1;
+    VERIFY_BITS(t1, 26);
+    VERIFY_BITS(c, 38);
+    /* [d u1 0 t9 0 0 0 0 0 0 c-u1*R1 t1-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */
+    /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */
+
+    c += (uint64_t)(a[0]*2) * a[2]
+       + (uint64_t)a[1] * a[1];
+    VERIFY_BITS(c, 62);
+    /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */
+    d += (uint64_t)(a[3]*2) * a[9]
+       + (uint64_t)(a[4]*2) * a[8]
+       + (uint64_t)(a[5]*2) * a[7]
+       + (uint64_t)a[6] * a[6];
+    VERIFY_BITS(d, 63);
+    /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */
+    u2 = d & M; d >>= 26; c += u2 * R0;
+    VERIFY_BITS(u2, 26);
+    VERIFY_BITS(d, 37);
+    VERIFY_BITS(c, 63);
+    /* [d u2 0 0 t9 0 0 0 0 0 0 c-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */
+    t2 = c & M; c >>= 26; c += u2 * R1;
+    VERIFY_BITS(t2, 26);
+    VERIFY_BITS(c, 38);
+    /* [d u2 0 0 t9 0 0 0 0 0 c-u2*R1 t2-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */
+    /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */
+
+    c += (uint64_t)(a[0]*2) * a[3]
+       + (uint64_t)(a[1]*2) * a[2];
+    VERIFY_BITS(c, 63);
+    /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */
+    d += (uint64_t)(a[4]*2) * a[9]
+       + (uint64_t)(a[5]*2) * a[8]
+       + (uint64_t)(a[6]*2) * a[7];
+    VERIFY_BITS(d, 63);
+    /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */
+    u3 = d & M; d >>= 26; c += u3 * R0;
+    VERIFY_BITS(u3, 26);
+    VERIFY_BITS(d, 37);
+    /* VERIFY_BITS(c, 64); */
+    /* [d u3 0 0 0 t9 0 0 0 0 0 c-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */
+    t3 = c & M; c >>= 26; c += u3 * R1;
+    VERIFY_BITS(t3, 26);
+    VERIFY_BITS(c, 39);
+    /* [d u3 0 0 0 t9 0 0 0 0 c-u3*R1 t3-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */
+
+    c += (uint64_t)(a[0]*2) * a[4]
+       + (uint64_t)(a[1]*2) * a[3]
+       + (uint64_t)a[2] * a[2];
+    VERIFY_BITS(c, 63);
+    /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */
+    d += (uint64_t)(a[5]*2) * a[9]
+       + (uint64_t)(a[6]*2) * a[8]
+       + (uint64_t)a[7] * a[7];
+    VERIFY_BITS(d, 62);
+    /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */
+    u4 = d & M; d >>= 26; c += u4 * R0;
+    VERIFY_BITS(u4, 26);
+    VERIFY_BITS(d, 36);
+    /* VERIFY_BITS(c, 64); */
+    /* [d u4 0 0 0 0 t9 0 0 0 0 c-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */
+    t4 = c & M; c >>= 26; c += u4 * R1;
+    VERIFY_BITS(t4, 26);
+    VERIFY_BITS(c, 39);
+    /* [d u4 0 0 0 0 t9 0 0 0 c-u4*R1 t4-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */
+
+    c += (uint64_t)(a[0]*2) * a[5]
+       + (uint64_t)(a[1]*2) * a[4]
+       + (uint64_t)(a[2]*2) * a[3];
+    VERIFY_BITS(c, 63);
+    /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */
+    d += (uint64_t)(a[6]*2) * a[9]
+       + (uint64_t)(a[7]*2) * a[8];
+    VERIFY_BITS(d, 62);
+    /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */
+    u5 = d & M; d >>= 26; c += u5 * R0;
+    VERIFY_BITS(u5, 26);
+    VERIFY_BITS(d, 36);
+    /* VERIFY_BITS(c, 64); */
+    /* [d u5 0 0 0 0 0 t9 0 0 0 c-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */
+    t5 = c & M; c >>= 26; c += u5 * R1;
+    VERIFY_BITS(t5, 26);
+    VERIFY_BITS(c, 39);
+    /* [d u5 0 0 0 0 0 t9 0 0 c-u5*R1 t5-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */
+
+    c += (uint64_t)(a[0]*2) * a[6]
+       + (uint64_t)(a[1]*2) * a[5]
+       + (uint64_t)(a[2]*2) * a[4]
+       + (uint64_t)a[3] * a[3];
+    VERIFY_BITS(c, 63);
+    /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */
+    d += (uint64_t)(a[7]*2) * a[9]
+       + (uint64_t)a[8] * a[8];
+    VERIFY_BITS(d, 61);
+    /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */
+    u6 = d & M; d >>= 26; c += u6 * R0;
+    VERIFY_BITS(u6, 26);
+    VERIFY_BITS(d, 35);
+    /* VERIFY_BITS(c, 64); */
+    /* [d u6 0 0 0 0 0 0 t9 0 0 c-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */
+    t6 = c & M; c >>= 26; c += u6 * R1;
+    VERIFY_BITS(t6, 26);
+    VERIFY_BITS(c, 39);
+    /* [d u6 0 0 0 0 0 0 t9 0 c-u6*R1 t6-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */
+
+    c += (uint64_t)(a[0]*2) * a[7]
+       + (uint64_t)(a[1]*2) * a[6]
+       + (uint64_t)(a[2]*2) * a[5]
+       + (uint64_t)(a[3]*2) * a[4];
+    /* VERIFY_BITS(c, 64); */
+    VERIFY_CHECK(c <= 0x8000007C00000007ULL);
+    /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */
+    d += (uint64_t)(a[8]*2) * a[9];
+    VERIFY_BITS(d, 58);
+    /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */
+    u7 = d & M; d >>= 26; c += u7 * R0;
+    VERIFY_BITS(u7, 26);
+    VERIFY_BITS(d, 32);
+    /* VERIFY_BITS(c, 64); */
+    VERIFY_CHECK(c <= 0x800001703FFFC2F7ULL);
+    /* [d u7 0 0 0 0 0 0 0 t9 0 c-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */
+    t7 = c & M; c >>= 26; c += u7 * R1;
+    VERIFY_BITS(t7, 26);
+    VERIFY_BITS(c, 38);
+    /* [d u7 0 0 0 0 0 0 0 t9 c-u7*R1 t7-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */
+
+    c += (uint64_t)(a[0]*2) * a[8]
+       + (uint64_t)(a[1]*2) * a[7]
+       + (uint64_t)(a[2]*2) * a[6]
+       + (uint64_t)(a[3]*2) * a[5]
+       + (uint64_t)a[4] * a[4];
+    /* VERIFY_BITS(c, 64); */
+    VERIFY_CHECK(c <= 0x9000007B80000008ULL);
+    /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    d += (uint64_t)a[9] * a[9];
+    VERIFY_BITS(d, 57);
+    /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    u8 = d & M; d >>= 26; c += u8 * R0;
+    VERIFY_BITS(u8, 26);
+    VERIFY_BITS(d, 31);
+    /* VERIFY_BITS(c, 64); */
+    VERIFY_CHECK(c <= 0x9000016FBFFFC2F8ULL);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+
+    r[3] = t3;
+    VERIFY_BITS(r[3], 26);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[4] = t4;
+    VERIFY_BITS(r[4], 26);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[5] = t5;
+    VERIFY_BITS(r[5], 26);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[6] = t6;
+    VERIFY_BITS(r[6], 26);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[7] = t7;
+    VERIFY_BITS(r[7], 26);
+    /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+
+    r[8] = c & M; c >>= 26; c += u8 * R1;
+    VERIFY_BITS(r[8], 26);
+    VERIFY_BITS(c, 39);
+    /* [d u8 0 0 0 0 0 0 0 0 t9+c-u8*R1 r8-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 0 0 0 0 t9+c r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    c   += d * R0 + t9;
+    VERIFY_BITS(c, 45);
+    /* [d 0 0 0 0 0 0 0 0 0 c-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[9] = c & (M >> 4); c >>= 22; c += d * (R1 << 4);
+    VERIFY_BITS(r[9], 22);
+    VERIFY_BITS(c, 46);
+    /* [d 0 0 0 0 0 0 0 0 r9+((c-d*R1<<4)<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    /* [d 0 0 0 0 0 0 0 -d*R1 r9+(c<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+
+    d    = c * (R0 >> 4) + t0;
+    VERIFY_BITS(d, 56);
+    /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 d-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[0] = d & M; d >>= 26;
+    VERIFY_BITS(r[0], 26);
+    VERIFY_BITS(d, 30);
+    /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1+d r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    d   += c * (R1 >> 4) + t1;
+    VERIFY_BITS(d, 53);
+    VERIFY_CHECK(d <= 0x10000003FFFFBFULL);
+    /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 d-c*R1>>4 r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    /* [r9 r8 r7 r6 r5 r4 r3 t2 d r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[1] = d & M; d >>= 26;
+    VERIFY_BITS(r[1], 26);
+    VERIFY_BITS(d, 27);
+    VERIFY_CHECK(d <= 0x4000000ULL);
+    /* [r9 r8 r7 r6 r5 r4 r3 t2+d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    d   += t2;
+    VERIFY_BITS(d, 27);
+    /* [r9 r8 r7 r6 r5 r4 r3 d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[2] = d;
+    VERIFY_BITS(r[2], 27);
+    /* [r9 r8 r7 r6 r5 r4 r3 r2 r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+}
+#endif
+
+SECP256K1_INLINE static void secp256k1_fe_impl_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b) {
+    secp256k1_fe_mul_inner(r->n, a->n, b->n);
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_sqr(secp256k1_fe *r, const secp256k1_fe *a) {
+    secp256k1_fe_sqr_inner(r->n, a->n);
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag) {
+    uint32_t mask0, mask1;
+    volatile int vflag = flag;
+    SECP256K1_CHECKMEM_CHECK_VERIFY(r->n, sizeof(r->n));
+    mask0 = vflag + ~((uint32_t)0);
+    mask1 = ~mask0;
+    r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1);
+    r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1);
+    r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1);
+    r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1);
+    r->n[4] = (r->n[4] & mask0) | (a->n[4] & mask1);
+    r->n[5] = (r->n[5] & mask0) | (a->n[5] & mask1);
+    r->n[6] = (r->n[6] & mask0) | (a->n[6] & mask1);
+    r->n[7] = (r->n[7] & mask0) | (a->n[7] & mask1);
+    r->n[8] = (r->n[8] & mask0) | (a->n[8] & mask1);
+    r->n[9] = (r->n[9] & mask0) | (a->n[9] & mask1);
+}
+
+static SECP256K1_INLINE void secp256k1_fe_impl_half(secp256k1_fe *r) {
+    uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4],
+             t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9];
+    uint32_t one = (uint32_t)1;
+    uint32_t mask = -(t0 & one) >> 6;
+
+    /* Bounds analysis (over the rationals).
+     *
+     * Let m = r->magnitude
+     *     C = 0x3FFFFFFUL * 2
+     *     D = 0x03FFFFFUL * 2
+     *
+     * Initial bounds: t0..t8 <= C * m
+     *                     t9 <= D * m
+     */
+
+    t0 += 0x3FFFC2FUL & mask;
+    t1 += 0x3FFFFBFUL & mask;
+    t2 += mask;
+    t3 += mask;
+    t4 += mask;
+    t5 += mask;
+    t6 += mask;
+    t7 += mask;
+    t8 += mask;
+    t9 += mask >> 4;
+
+    VERIFY_CHECK((t0 & one) == 0);
+
+    /* t0..t8: added <= C/2
+     *     t9: added <= D/2
+     *
+     * Current bounds: t0..t8 <= C * (m + 1/2)
+     *                     t9 <= D * (m + 1/2)
+     */
+
+    r->n[0] = (t0 >> 1) + ((t1 & one) << 25);
+    r->n[1] = (t1 >> 1) + ((t2 & one) << 25);
+    r->n[2] = (t2 >> 1) + ((t3 & one) << 25);
+    r->n[3] = (t3 >> 1) + ((t4 & one) << 25);
+    r->n[4] = (t4 >> 1) + ((t5 & one) << 25);
+    r->n[5] = (t5 >> 1) + ((t6 & one) << 25);
+    r->n[6] = (t6 >> 1) + ((t7 & one) << 25);
+    r->n[7] = (t7 >> 1) + ((t8 & one) << 25);
+    r->n[8] = (t8 >> 1) + ((t9 & one) << 25);
+    r->n[9] = (t9 >> 1);
+
+    /* t0..t8: shifted right and added <= C/4 + 1/2
+     *     t9: shifted right
+     *
+     * Current bounds: t0..t8 <= C * (m/2 + 1/2)
+     *                     t9 <= D * (m/2 + 1/4)
+     *
+     * Therefore the output magnitude (M) has to be set such that:
+     *     t0..t8: C * M >= C * (m/2 + 1/2)
+     *         t9: D * M >= D * (m/2 + 1/4)
+     *
+     * It suffices for all limbs that, for any input magnitude m:
+     *     M >= m/2 + 1/2
+     *
+     * and since we want the smallest such integer value for M:
+     *     M == floor(m/2) + 1
+     */
+}
+
+static SECP256K1_INLINE void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag) {
+    uint32_t mask0, mask1;
+    volatile int vflag = flag;
+    SECP256K1_CHECKMEM_CHECK_VERIFY(r->n, sizeof(r->n));
+    mask0 = vflag + ~((uint32_t)0);
+    mask1 = ~mask0;
+    r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1);
+    r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1);
+    r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1);
+    r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1);
+    r->n[4] = (r->n[4] & mask0) | (a->n[4] & mask1);
+    r->n[5] = (r->n[5] & mask0) | (a->n[5] & mask1);
+    r->n[6] = (r->n[6] & mask0) | (a->n[6] & mask1);
+    r->n[7] = (r->n[7] & mask0) | (a->n[7] & mask1);
+}
+
+static void secp256k1_fe_impl_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a) {
+    r->n[0] = a->n[0] | a->n[1] << 26;
+    r->n[1] = a->n[1] >> 6 | a->n[2] << 20;
+    r->n[2] = a->n[2] >> 12 | a->n[3] << 14;
+    r->n[3] = a->n[3] >> 18 | a->n[4] << 8;
+    r->n[4] = a->n[4] >> 24 | a->n[5] << 2 | a->n[6] << 28;
+    r->n[5] = a->n[6] >> 4 | a->n[7] << 22;
+    r->n[6] = a->n[7] >> 10 | a->n[8] << 16;
+    r->n[7] = a->n[8] >> 16 | a->n[9] << 10;
+}
+
+static SECP256K1_INLINE void secp256k1_fe_impl_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a) {
+    r->n[0] = a->n[0] & 0x3FFFFFFUL;
+    r->n[1] = a->n[0] >> 26 | ((a->n[1] << 6) & 0x3FFFFFFUL);
+    r->n[2] = a->n[1] >> 20 | ((a->n[2] << 12) & 0x3FFFFFFUL);
+    r->n[3] = a->n[2] >> 14 | ((a->n[3] << 18) & 0x3FFFFFFUL);
+    r->n[4] = a->n[3] >> 8 | ((a->n[4] << 24) & 0x3FFFFFFUL);
+    r->n[5] = (a->n[4] >> 2) & 0x3FFFFFFUL;
+    r->n[6] = a->n[4] >> 28 | ((a->n[5] << 4) & 0x3FFFFFFUL);
+    r->n[7] = a->n[5] >> 22 | ((a->n[6] << 10) & 0x3FFFFFFUL);
+    r->n[8] = a->n[6] >> 16 | ((a->n[7] << 16) & 0x3FFFFFFUL);
+    r->n[9] = a->n[7] >> 10;
+}
+
+static void secp256k1_fe_from_signed30(secp256k1_fe *r, const secp256k1_modinv32_signed30 *a) {
+    const uint32_t M26 = UINT32_MAX >> 6;
+    const uint32_t a0 = a->v[0], a1 = a->v[1], a2 = a->v[2], a3 = a->v[3], a4 = a->v[4],
+                   a5 = a->v[5], a6 = a->v[6], a7 = a->v[7], a8 = a->v[8];
+
+    /* The output from secp256k1_modinv32{_var} should be normalized to range [0,modulus), and
+     * have limbs in [0,2^30). The modulus is < 2^256, so the top limb must be below 2^(256-30*8).
+     */
+    VERIFY_CHECK(a0 >> 30 == 0);
+    VERIFY_CHECK(a1 >> 30 == 0);
+    VERIFY_CHECK(a2 >> 30 == 0);
+    VERIFY_CHECK(a3 >> 30 == 0);
+    VERIFY_CHECK(a4 >> 30 == 0);
+    VERIFY_CHECK(a5 >> 30 == 0);
+    VERIFY_CHECK(a6 >> 30 == 0);
+    VERIFY_CHECK(a7 >> 30 == 0);
+    VERIFY_CHECK(a8 >> 16 == 0);
+
+    r->n[0] =  a0                   & M26;
+    r->n[1] = (a0 >> 26 | a1 <<  4) & M26;
+    r->n[2] = (a1 >> 22 | a2 <<  8) & M26;
+    r->n[3] = (a2 >> 18 | a3 << 12) & M26;
+    r->n[4] = (a3 >> 14 | a4 << 16) & M26;
+    r->n[5] = (a4 >> 10 | a5 << 20) & M26;
+    r->n[6] = (a5 >>  6 | a6 << 24) & M26;
+    r->n[7] = (a6 >>  2           ) & M26;
+    r->n[8] = (a6 >> 28 | a7 <<  2) & M26;
+    r->n[9] = (a7 >> 24 | a8 <<  6);
+}
+
+static void secp256k1_fe_to_signed30(secp256k1_modinv32_signed30 *r, const secp256k1_fe *a) {
+    const uint32_t M30 = UINT32_MAX >> 2;
+    const uint64_t a0 = a->n[0], a1 = a->n[1], a2 = a->n[2], a3 = a->n[3], a4 = a->n[4],
+                   a5 = a->n[5], a6 = a->n[6], a7 = a->n[7], a8 = a->n[8], a9 = a->n[9];
+
+    r->v[0] = (a0       | a1 << 26) & M30;
+    r->v[1] = (a1 >>  4 | a2 << 22) & M30;
+    r->v[2] = (a2 >>  8 | a3 << 18) & M30;
+    r->v[3] = (a3 >> 12 | a4 << 14) & M30;
+    r->v[4] = (a4 >> 16 | a5 << 10) & M30;
+    r->v[5] = (a5 >> 20 | a6 <<  6) & M30;
+    r->v[6] = (a6 >> 24 | a7 <<  2
+                        | a8 << 28) & M30;
+    r->v[7] = (a8 >>  2 | a9 << 24) & M30;
+    r->v[8] =  a9 >>  6;
+}
+
+static const secp256k1_modinv32_modinfo secp256k1_const_modinfo_fe = {
+    {{-0x3D1, -4, 0, 0, 0, 0, 0, 0, 65536}},
+    0x2DDACACFL
+};
+
+static void secp256k1_fe_impl_inv(secp256k1_fe *r, const secp256k1_fe *x) {
+    secp256k1_fe tmp = *x;
+    secp256k1_modinv32_signed30 s;
+
+    secp256k1_fe_normalize(&tmp);
+    secp256k1_fe_to_signed30(&s, &tmp);
+    secp256k1_modinv32(&s, &secp256k1_const_modinfo_fe);
+    secp256k1_fe_from_signed30(r, &s);
+}
+
+static void secp256k1_fe_impl_inv_var(secp256k1_fe *r, const secp256k1_fe *x) {
+    secp256k1_fe tmp = *x;
+    secp256k1_modinv32_signed30 s;
+
+    secp256k1_fe_normalize_var(&tmp);
+    secp256k1_fe_to_signed30(&s, &tmp);
+    secp256k1_modinv32_var(&s, &secp256k1_const_modinfo_fe);
+    secp256k1_fe_from_signed30(r, &s);
+}
+
+static int secp256k1_fe_impl_is_square_var(const secp256k1_fe *x) {
+    secp256k1_fe tmp;
+    secp256k1_modinv32_signed30 s;
+    int jac, ret;
+
+    tmp = *x;
+    secp256k1_fe_normalize_var(&tmp);
+    /* secp256k1_jacobi32_maybe_var cannot deal with input 0. */
+    if (secp256k1_fe_is_zero(&tmp)) return 1;
+    secp256k1_fe_to_signed30(&s, &tmp);
+    jac = secp256k1_jacobi32_maybe_var(&s, &secp256k1_const_modinfo_fe);
+    if (jac == 0) {
+        /* secp256k1_jacobi32_maybe_var failed to compute the Jacobi symbol. Fall back
+         * to computing a square root. This should be extremely rare with random
+         * input (except in VERIFY mode, where a lower iteration count is used). */
+        secp256k1_fe dummy;
+        ret = secp256k1_fe_sqrt(&dummy, &tmp);
+    } else {
+        ret = jac >= 0;
+    }
+    return ret;
+}
+
+#endif /* SECP256K1_FIELD_REPR_IMPL_H */
diff --git a/vendor/external/secp256k1/src/field_5x52.h b/vendor/external/secp256k1/src/field_5x52.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/field_5x52.h
@@ -0,0 +1,62 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_FIELD_REPR_H
+#define SECP256K1_FIELD_REPR_H
+
+#include <stdint.h>
+
+/** This field implementation represents the value as 5 uint64_t limbs in base
+ *  2^52. */
+typedef struct {
+   /* A field element f represents the sum(i=0..4, f.n[i] << (i*52)) mod p,
+    * where p is the field modulus, 2^256 - 2^32 - 977.
+    *
+    * The individual limbs f.n[i] can exceed 2^52; the field's magnitude roughly
+    * corresponds to how much excess is allowed. The value
+    * sum(i=0..4, f.n[i] << (i*52)) may exceed p, unless the field element is
+    * normalized. */
+    uint64_t n[5];
+    /*
+     * Magnitude m requires:
+     *     n[i] <= 2 * m * (2^52 - 1) for i=0..3
+     *     n[4] <= 2 * m * (2^48 - 1)
+     *
+     * Normalized requires:
+     *     n[i] <= (2^52 - 1) for i=0..3
+     *     sum(i=0..4, n[i] << (i*52)) < p
+     *     (together these imply n[4] <= 2^48 - 1)
+     */
+    SECP256K1_FE_VERIFY_FIELDS
+} secp256k1_fe;
+
+/* Unpacks a constant into a overlapping multi-limbed FE element. */
+#define SECP256K1_FE_CONST_INNER(d7, d6, d5, d4, d3, d2, d1, d0) { \
+    (d0) | (((uint64_t)(d1) & 0xFFFFFUL) << 32), \
+    ((uint64_t)(d1) >> 20) | (((uint64_t)(d2)) << 12) | (((uint64_t)(d3) & 0xFFUL) << 44), \
+    ((uint64_t)(d3) >> 8) | (((uint64_t)(d4) & 0xFFFFFFFUL) << 24), \
+    ((uint64_t)(d4) >> 28) | (((uint64_t)(d5)) << 4) | (((uint64_t)(d6) & 0xFFFFUL) << 36), \
+    ((uint64_t)(d6) >> 16) | (((uint64_t)(d7)) << 16) \
+}
+
+typedef struct {
+    uint64_t n[4];
+} secp256k1_fe_storage;
+
+#define SECP256K1_FE_STORAGE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{ \
+    (d0) | (((uint64_t)(d1)) << 32), \
+    (d2) | (((uint64_t)(d3)) << 32), \
+    (d4) | (((uint64_t)(d5)) << 32), \
+    (d6) | (((uint64_t)(d7)) << 32) \
+}}
+
+#define SECP256K1_FE_STORAGE_CONST_GET(d) \
+    (uint32_t)(d.n[3] >> 32), (uint32_t)d.n[3], \
+    (uint32_t)(d.n[2] >> 32), (uint32_t)d.n[2], \
+    (uint32_t)(d.n[1] >> 32), (uint32_t)d.n[1], \
+    (uint32_t)(d.n[0] >> 32), (uint32_t)d.n[0]
+
+#endif /* SECP256K1_FIELD_REPR_H */
diff --git a/vendor/external/secp256k1/src/field_5x52_impl.h b/vendor/external/secp256k1/src/field_5x52_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/field_5x52_impl.h
@@ -0,0 +1,522 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_FIELD_REPR_IMPL_H
+#define SECP256K1_FIELD_REPR_IMPL_H
+
+#include "checkmem.h"
+#include "util.h"
+#include "field.h"
+#include "modinv64_impl.h"
+
+#include "field_5x52_int128_impl.h"
+
+#ifdef VERIFY
+static void secp256k1_fe_impl_verify(const secp256k1_fe *a) {
+    const uint64_t *d = a->n;
+    int m = a->normalized ? 1 : 2 * a->magnitude;
+   /* secp256k1 'p' value defined in "Standards for Efficient Cryptography" (SEC2) 2.7.1. */
+    VERIFY_CHECK(d[0] <= 0xFFFFFFFFFFFFFULL * m);
+    VERIFY_CHECK(d[1] <= 0xFFFFFFFFFFFFFULL * m);
+    VERIFY_CHECK(d[2] <= 0xFFFFFFFFFFFFFULL * m);
+    VERIFY_CHECK(d[3] <= 0xFFFFFFFFFFFFFULL * m);
+    VERIFY_CHECK(d[4] <= 0x0FFFFFFFFFFFFULL * m);
+    if (a->normalized) {
+        if ((d[4] == 0x0FFFFFFFFFFFFULL) && ((d[3] & d[2] & d[1]) == 0xFFFFFFFFFFFFFULL)) {
+            VERIFY_CHECK(d[0] < 0xFFFFEFFFFFC2FULL);
+        }
+    }
+}
+#endif
+
+static void secp256k1_fe_impl_get_bounds(secp256k1_fe *r, int m) {
+    r->n[0] = 0xFFFFFFFFFFFFFULL * 2 * m;
+    r->n[1] = 0xFFFFFFFFFFFFFULL * 2 * m;
+    r->n[2] = 0xFFFFFFFFFFFFFULL * 2 * m;
+    r->n[3] = 0xFFFFFFFFFFFFFULL * 2 * m;
+    r->n[4] = 0x0FFFFFFFFFFFFULL * 2 * m;
+}
+
+static void secp256k1_fe_impl_normalize(secp256k1_fe *r) {
+    uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4];
+
+    /* Reduce t4 at the start so there will be at most a single carry from the first pass */
+    uint64_t m;
+    uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL;
+
+    /* The first pass ensures the magnitude is 1, ... */
+    t0 += x * 0x1000003D1ULL;
+    t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL;
+    t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; m = t1;
+    t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; m &= t2;
+    t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; m &= t3;
+
+    /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */
+    VERIFY_CHECK(t4 >> 49 == 0);
+
+    /* At most a single final reduction is needed; check if the value is >= the field characteristic */
+    x = (t4 >> 48) | ((t4 == 0x0FFFFFFFFFFFFULL) & (m == 0xFFFFFFFFFFFFFULL)
+        & (t0 >= 0xFFFFEFFFFFC2FULL));
+
+    /* Apply the final reduction (for constant-time behaviour, we do it always) */
+    t0 += x * 0x1000003D1ULL;
+    t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL;
+    t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL;
+    t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL;
+    t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL;
+
+    /* If t4 didn't carry to bit 48 already, then it should have after any final reduction */
+    VERIFY_CHECK(t4 >> 48 == x);
+
+    /* Mask off the possible multiple of 2^256 from the final reduction */
+    t4 &= 0x0FFFFFFFFFFFFULL;
+
+    r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4;
+}
+
+static void secp256k1_fe_impl_normalize_weak(secp256k1_fe *r) {
+    uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4];
+
+    /* Reduce t4 at the start so there will be at most a single carry from the first pass */
+    uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL;
+
+    /* The first pass ensures the magnitude is 1, ... */
+    t0 += x * 0x1000003D1ULL;
+    t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL;
+    t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL;
+    t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL;
+    t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL;
+
+    /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */
+    VERIFY_CHECK(t4 >> 49 == 0);
+
+    r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4;
+}
+
+static void secp256k1_fe_impl_normalize_var(secp256k1_fe *r) {
+    uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4];
+
+    /* Reduce t4 at the start so there will be at most a single carry from the first pass */
+    uint64_t m;
+    uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL;
+
+    /* The first pass ensures the magnitude is 1, ... */
+    t0 += x * 0x1000003D1ULL;
+    t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL;
+    t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; m = t1;
+    t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; m &= t2;
+    t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; m &= t3;
+
+    /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */
+    VERIFY_CHECK(t4 >> 49 == 0);
+
+    /* At most a single final reduction is needed; check if the value is >= the field characteristic */
+    x = (t4 >> 48) | ((t4 == 0x0FFFFFFFFFFFFULL) & (m == 0xFFFFFFFFFFFFFULL)
+        & (t0 >= 0xFFFFEFFFFFC2FULL));
+
+    if (x) {
+        t0 += 0x1000003D1ULL;
+        t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL;
+        t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL;
+        t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL;
+        t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL;
+
+        /* If t4 didn't carry to bit 48 already, then it should have after any final reduction */
+        VERIFY_CHECK(t4 >> 48 == x);
+
+        /* Mask off the possible multiple of 2^256 from the final reduction */
+        t4 &= 0x0FFFFFFFFFFFFULL;
+    }
+
+    r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4;
+}
+
+static int secp256k1_fe_impl_normalizes_to_zero(const secp256k1_fe *r) {
+    uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4];
+
+    /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */
+    uint64_t z0, z1;
+
+    /* Reduce t4 at the start so there will be at most a single carry from the first pass */
+    uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL;
+
+    /* The first pass ensures the magnitude is 1, ... */
+    t0 += x * 0x1000003D1ULL;
+    t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; z0  = t0; z1  = t0 ^ 0x1000003D0ULL;
+    t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; z0 |= t1; z1 &= t1;
+    t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; z0 |= t2; z1 &= t2;
+    t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; z0 |= t3; z1 &= t3;
+                                                z0 |= t4; z1 &= t4 ^ 0xF000000000000ULL;
+
+    /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */
+    VERIFY_CHECK(t4 >> 49 == 0);
+
+    return (z0 == 0) | (z1 == 0xFFFFFFFFFFFFFULL);
+}
+
+static int secp256k1_fe_impl_normalizes_to_zero_var(const secp256k1_fe *r) {
+    uint64_t t0, t1, t2, t3, t4;
+    uint64_t z0, z1;
+    uint64_t x;
+
+    t0 = r->n[0];
+    t4 = r->n[4];
+
+    /* Reduce t4 at the start so there will be at most a single carry from the first pass */
+    x = t4 >> 48;
+
+    /* The first pass ensures the magnitude is 1, ... */
+    t0 += x * 0x1000003D1ULL;
+
+    /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */
+    z0 = t0 & 0xFFFFFFFFFFFFFULL;
+    z1 = z0 ^ 0x1000003D0ULL;
+
+    /* Fast return path should catch the majority of cases */
+    if ((z0 != 0ULL) & (z1 != 0xFFFFFFFFFFFFFULL)) {
+        return 0;
+    }
+
+    t1 = r->n[1];
+    t2 = r->n[2];
+    t3 = r->n[3];
+
+    t4 &= 0x0FFFFFFFFFFFFULL;
+
+    t1 += (t0 >> 52);
+    t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; z0 |= t1; z1 &= t1;
+    t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; z0 |= t2; z1 &= t2;
+    t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; z0 |= t3; z1 &= t3;
+                                                z0 |= t4; z1 &= t4 ^ 0xF000000000000ULL;
+
+    /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */
+    VERIFY_CHECK(t4 >> 49 == 0);
+
+    return (z0 == 0) | (z1 == 0xFFFFFFFFFFFFFULL);
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_set_int(secp256k1_fe *r, int a) {
+    r->n[0] = a;
+    r->n[1] = r->n[2] = r->n[3] = r->n[4] = 0;
+}
+
+SECP256K1_INLINE static int secp256k1_fe_impl_is_zero(const secp256k1_fe *a) {
+    const uint64_t *t = a->n;
+    return (t[0] | t[1] | t[2] | t[3] | t[4]) == 0;
+}
+
+SECP256K1_INLINE static int secp256k1_fe_impl_is_odd(const secp256k1_fe *a) {
+    return a->n[0] & 1;
+}
+
+static int secp256k1_fe_impl_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b) {
+    int i;
+    for (i = 4; i >= 0; i--) {
+        if (a->n[i] > b->n[i]) {
+            return 1;
+        }
+        if (a->n[i] < b->n[i]) {
+            return -1;
+        }
+    }
+    return 0;
+}
+
+static void secp256k1_fe_impl_set_b32_mod(secp256k1_fe *r, const unsigned char *a) {
+    r->n[0] = (uint64_t)a[31]
+            | ((uint64_t)a[30] << 8)
+            | ((uint64_t)a[29] << 16)
+            | ((uint64_t)a[28] << 24)
+            | ((uint64_t)a[27] << 32)
+            | ((uint64_t)a[26] << 40)
+            | ((uint64_t)(a[25] & 0xF)  << 48);
+    r->n[1] = (uint64_t)((a[25] >> 4) & 0xF)
+            | ((uint64_t)a[24] << 4)
+            | ((uint64_t)a[23] << 12)
+            | ((uint64_t)a[22] << 20)
+            | ((uint64_t)a[21] << 28)
+            | ((uint64_t)a[20] << 36)
+            | ((uint64_t)a[19] << 44);
+    r->n[2] = (uint64_t)a[18]
+            | ((uint64_t)a[17] << 8)
+            | ((uint64_t)a[16] << 16)
+            | ((uint64_t)a[15] << 24)
+            | ((uint64_t)a[14] << 32)
+            | ((uint64_t)a[13] << 40)
+            | ((uint64_t)(a[12] & 0xF) << 48);
+    r->n[3] = (uint64_t)((a[12] >> 4) & 0xF)
+            | ((uint64_t)a[11] << 4)
+            | ((uint64_t)a[10] << 12)
+            | ((uint64_t)a[9]  << 20)
+            | ((uint64_t)a[8]  << 28)
+            | ((uint64_t)a[7]  << 36)
+            | ((uint64_t)a[6]  << 44);
+    r->n[4] = (uint64_t)a[5]
+            | ((uint64_t)a[4] << 8)
+            | ((uint64_t)a[3] << 16)
+            | ((uint64_t)a[2] << 24)
+            | ((uint64_t)a[1] << 32)
+            | ((uint64_t)a[0] << 40);
+}
+
+static int secp256k1_fe_impl_set_b32_limit(secp256k1_fe *r, const unsigned char *a) {
+    secp256k1_fe_impl_set_b32_mod(r, a);
+    return !((r->n[4] == 0x0FFFFFFFFFFFFULL) & ((r->n[3] & r->n[2] & r->n[1]) == 0xFFFFFFFFFFFFFULL) & (r->n[0] >= 0xFFFFEFFFFFC2FULL));
+}
+
+/** Convert a field element to a 32-byte big endian value. Requires the input to be normalized */
+static void secp256k1_fe_impl_get_b32(unsigned char *r, const secp256k1_fe *a) {
+    r[0] = (a->n[4] >> 40) & 0xFF;
+    r[1] = (a->n[4] >> 32) & 0xFF;
+    r[2] = (a->n[4] >> 24) & 0xFF;
+    r[3] = (a->n[4] >> 16) & 0xFF;
+    r[4] = (a->n[4] >> 8) & 0xFF;
+    r[5] = a->n[4] & 0xFF;
+    r[6] = (a->n[3] >> 44) & 0xFF;
+    r[7] = (a->n[3] >> 36) & 0xFF;
+    r[8] = (a->n[3] >> 28) & 0xFF;
+    r[9] = (a->n[3] >> 20) & 0xFF;
+    r[10] = (a->n[3] >> 12) & 0xFF;
+    r[11] = (a->n[3] >> 4) & 0xFF;
+    r[12] = ((a->n[2] >> 48) & 0xF) | ((a->n[3] & 0xF) << 4);
+    r[13] = (a->n[2] >> 40) & 0xFF;
+    r[14] = (a->n[2] >> 32) & 0xFF;
+    r[15] = (a->n[2] >> 24) & 0xFF;
+    r[16] = (a->n[2] >> 16) & 0xFF;
+    r[17] = (a->n[2] >> 8) & 0xFF;
+    r[18] = a->n[2] & 0xFF;
+    r[19] = (a->n[1] >> 44) & 0xFF;
+    r[20] = (a->n[1] >> 36) & 0xFF;
+    r[21] = (a->n[1] >> 28) & 0xFF;
+    r[22] = (a->n[1] >> 20) & 0xFF;
+    r[23] = (a->n[1] >> 12) & 0xFF;
+    r[24] = (a->n[1] >> 4) & 0xFF;
+    r[25] = ((a->n[0] >> 48) & 0xF) | ((a->n[1] & 0xF) << 4);
+    r[26] = (a->n[0] >> 40) & 0xFF;
+    r[27] = (a->n[0] >> 32) & 0xFF;
+    r[28] = (a->n[0] >> 24) & 0xFF;
+    r[29] = (a->n[0] >> 16) & 0xFF;
+    r[30] = (a->n[0] >> 8) & 0xFF;
+    r[31] = a->n[0] & 0xFF;
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_negate_unchecked(secp256k1_fe *r, const secp256k1_fe *a, int m) {
+    /* For all legal values of m (0..31), the following properties hold: */
+    VERIFY_CHECK(0xFFFFEFFFFFC2FULL * 2 * (m + 1) >= 0xFFFFFFFFFFFFFULL * 2 * m);
+    VERIFY_CHECK(0xFFFFFFFFFFFFFULL * 2 * (m + 1) >= 0xFFFFFFFFFFFFFULL * 2 * m);
+    VERIFY_CHECK(0x0FFFFFFFFFFFFULL * 2 * (m + 1) >= 0x0FFFFFFFFFFFFULL * 2 * m);
+
+    /* Due to the properties above, the left hand in the subtractions below is never less than
+     * the right hand. */
+    r->n[0] = 0xFFFFEFFFFFC2FULL * 2 * (m + 1) - a->n[0];
+    r->n[1] = 0xFFFFFFFFFFFFFULL * 2 * (m + 1) - a->n[1];
+    r->n[2] = 0xFFFFFFFFFFFFFULL * 2 * (m + 1) - a->n[2];
+    r->n[3] = 0xFFFFFFFFFFFFFULL * 2 * (m + 1) - a->n[3];
+    r->n[4] = 0x0FFFFFFFFFFFFULL * 2 * (m + 1) - a->n[4];
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_mul_int_unchecked(secp256k1_fe *r, int a) {
+    r->n[0] *= a;
+    r->n[1] *= a;
+    r->n[2] *= a;
+    r->n[3] *= a;
+    r->n[4] *= a;
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_add_int(secp256k1_fe *r, int a) {
+    r->n[0] += a;
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_add(secp256k1_fe *r, const secp256k1_fe *a) {
+    r->n[0] += a->n[0];
+    r->n[1] += a->n[1];
+    r->n[2] += a->n[2];
+    r->n[3] += a->n[3];
+    r->n[4] += a->n[4];
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b) {
+    secp256k1_fe_mul_inner(r->n, a->n, b->n);
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_sqr(secp256k1_fe *r, const secp256k1_fe *a) {
+    secp256k1_fe_sqr_inner(r->n, a->n);
+}
+
+SECP256K1_INLINE static void secp256k1_fe_impl_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag) {
+    uint64_t mask0, mask1;
+    volatile int vflag = flag;
+    SECP256K1_CHECKMEM_CHECK_VERIFY(r->n, sizeof(r->n));
+    mask0 = vflag + ~((uint64_t)0);
+    mask1 = ~mask0;
+    r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1);
+    r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1);
+    r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1);
+    r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1);
+    r->n[4] = (r->n[4] & mask0) | (a->n[4] & mask1);
+}
+
+static SECP256K1_INLINE void secp256k1_fe_impl_half(secp256k1_fe *r) {
+    uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4];
+    uint64_t one = (uint64_t)1;
+    uint64_t mask = -(t0 & one) >> 12;
+
+    /* Bounds analysis (over the rationals).
+     *
+     * Let m = r->magnitude
+     *     C = 0xFFFFFFFFFFFFFULL * 2
+     *     D = 0x0FFFFFFFFFFFFULL * 2
+     *
+     * Initial bounds: t0..t3 <= C * m
+     *                     t4 <= D * m
+     */
+
+    t0 += 0xFFFFEFFFFFC2FULL & mask;
+    t1 += mask;
+    t2 += mask;
+    t3 += mask;
+    t4 += mask >> 4;
+
+    VERIFY_CHECK((t0 & one) == 0);
+
+    /* t0..t3: added <= C/2
+     *     t4: added <= D/2
+     *
+     * Current bounds: t0..t3 <= C * (m + 1/2)
+     *                     t4 <= D * (m + 1/2)
+     */
+
+    r->n[0] = (t0 >> 1) + ((t1 & one) << 51);
+    r->n[1] = (t1 >> 1) + ((t2 & one) << 51);
+    r->n[2] = (t2 >> 1) + ((t3 & one) << 51);
+    r->n[3] = (t3 >> 1) + ((t4 & one) << 51);
+    r->n[4] = (t4 >> 1);
+
+    /* t0..t3: shifted right and added <= C/4 + 1/2
+     *     t4: shifted right
+     *
+     * Current bounds: t0..t3 <= C * (m/2 + 1/2)
+     *                     t4 <= D * (m/2 + 1/4)
+     *
+     * Therefore the output magnitude (M) has to be set such that:
+     *     t0..t3: C * M >= C * (m/2 + 1/2)
+     *         t4: D * M >= D * (m/2 + 1/4)
+     *
+     * It suffices for all limbs that, for any input magnitude m:
+     *     M >= m/2 + 1/2
+     *
+     * and since we want the smallest such integer value for M:
+     *     M == floor(m/2) + 1
+     */
+}
+
+static SECP256K1_INLINE void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag) {
+    uint64_t mask0, mask1;
+    volatile int vflag = flag;
+    SECP256K1_CHECKMEM_CHECK_VERIFY(r->n, sizeof(r->n));
+    mask0 = vflag + ~((uint64_t)0);
+    mask1 = ~mask0;
+    r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1);
+    r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1);
+    r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1);
+    r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1);
+}
+
+static void secp256k1_fe_impl_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a) {
+    r->n[0] = a->n[0] | a->n[1] << 52;
+    r->n[1] = a->n[1] >> 12 | a->n[2] << 40;
+    r->n[2] = a->n[2] >> 24 | a->n[3] << 28;
+    r->n[3] = a->n[3] >> 36 | a->n[4] << 16;
+}
+
+static SECP256K1_INLINE void secp256k1_fe_impl_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a) {
+    r->n[0] = a->n[0] & 0xFFFFFFFFFFFFFULL;
+    r->n[1] = a->n[0] >> 52 | ((a->n[1] << 12) & 0xFFFFFFFFFFFFFULL);
+    r->n[2] = a->n[1] >> 40 | ((a->n[2] << 24) & 0xFFFFFFFFFFFFFULL);
+    r->n[3] = a->n[2] >> 28 | ((a->n[3] << 36) & 0xFFFFFFFFFFFFFULL);
+    r->n[4] = a->n[3] >> 16;
+}
+
+static void secp256k1_fe_from_signed62(secp256k1_fe *r, const secp256k1_modinv64_signed62 *a) {
+    const uint64_t M52 = UINT64_MAX >> 12;
+    const uint64_t a0 = a->v[0], a1 = a->v[1], a2 = a->v[2], a3 = a->v[3], a4 = a->v[4];
+
+    /* The output from secp256k1_modinv64{_var} should be normalized to range [0,modulus), and
+     * have limbs in [0,2^62). The modulus is < 2^256, so the top limb must be below 2^(256-62*4).
+     */
+    VERIFY_CHECK(a0 >> 62 == 0);
+    VERIFY_CHECK(a1 >> 62 == 0);
+    VERIFY_CHECK(a2 >> 62 == 0);
+    VERIFY_CHECK(a3 >> 62 == 0);
+    VERIFY_CHECK(a4 >> 8 == 0);
+
+    r->n[0] =  a0                   & M52;
+    r->n[1] = (a0 >> 52 | a1 << 10) & M52;
+    r->n[2] = (a1 >> 42 | a2 << 20) & M52;
+    r->n[3] = (a2 >> 32 | a3 << 30) & M52;
+    r->n[4] = (a3 >> 22 | a4 << 40);
+}
+
+static void secp256k1_fe_to_signed62(secp256k1_modinv64_signed62 *r, const secp256k1_fe *a) {
+    const uint64_t M62 = UINT64_MAX >> 2;
+    const uint64_t a0 = a->n[0], a1 = a->n[1], a2 = a->n[2], a3 = a->n[3], a4 = a->n[4];
+
+    r->v[0] = (a0       | a1 << 52) & M62;
+    r->v[1] = (a1 >> 10 | a2 << 42) & M62;
+    r->v[2] = (a2 >> 20 | a3 << 32) & M62;
+    r->v[3] = (a3 >> 30 | a4 << 22) & M62;
+    r->v[4] =  a4 >> 40;
+}
+
+static const secp256k1_modinv64_modinfo secp256k1_const_modinfo_fe = {
+    {{-0x1000003D1LL, 0, 0, 0, 256}},
+    0x27C7F6E22DDACACFLL
+};
+
+static void secp256k1_fe_impl_inv(secp256k1_fe *r, const secp256k1_fe *x) {
+    secp256k1_fe tmp = *x;
+    secp256k1_modinv64_signed62 s;
+
+    secp256k1_fe_normalize(&tmp);
+    secp256k1_fe_to_signed62(&s, &tmp);
+    secp256k1_modinv64(&s, &secp256k1_const_modinfo_fe);
+    secp256k1_fe_from_signed62(r, &s);
+}
+
+static void secp256k1_fe_impl_inv_var(secp256k1_fe *r, const secp256k1_fe *x) {
+    secp256k1_fe tmp = *x;
+    secp256k1_modinv64_signed62 s;
+
+    secp256k1_fe_normalize_var(&tmp);
+    secp256k1_fe_to_signed62(&s, &tmp);
+    secp256k1_modinv64_var(&s, &secp256k1_const_modinfo_fe);
+    secp256k1_fe_from_signed62(r, &s);
+}
+
+static int secp256k1_fe_impl_is_square_var(const secp256k1_fe *x) {
+    secp256k1_fe tmp;
+    secp256k1_modinv64_signed62 s;
+    int jac, ret;
+
+    tmp = *x;
+    secp256k1_fe_normalize_var(&tmp);
+    /* secp256k1_jacobi64_maybe_var cannot deal with input 0. */
+    if (secp256k1_fe_is_zero(&tmp)) return 1;
+    secp256k1_fe_to_signed62(&s, &tmp);
+    jac = secp256k1_jacobi64_maybe_var(&s, &secp256k1_const_modinfo_fe);
+    if (jac == 0) {
+        /* secp256k1_jacobi64_maybe_var failed to compute the Jacobi symbol. Fall back
+         * to computing a square root. This should be extremely rare with random
+         * input (except in VERIFY mode, where a lower iteration count is used). */
+        secp256k1_fe dummy;
+        ret = secp256k1_fe_sqrt(&dummy, &tmp);
+    } else {
+        ret = jac >= 0;
+    }
+    return ret;
+}
+
+#endif /* SECP256K1_FIELD_REPR_IMPL_H */
diff --git a/vendor/external/secp256k1/src/field_5x52_int128_impl.h b/vendor/external/secp256k1/src/field_5x52_int128_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/field_5x52_int128_impl.h
@@ -0,0 +1,274 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_FIELD_INNER5X52_IMPL_H
+#define SECP256K1_FIELD_INNER5X52_IMPL_H
+
+#include <stdint.h>
+
+#include "int128.h"
+#include "util.h"
+
+#define VERIFY_BITS(x, n) VERIFY_CHECK(((x) >> (n)) == 0)
+#define VERIFY_BITS_128(x, n) VERIFY_CHECK(secp256k1_u128_check_bits((x), (n)))
+
+SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint64_t *r, const uint64_t *a, const uint64_t * SECP256K1_RESTRICT b) {
+    secp256k1_uint128 c, d;
+    uint64_t t3, t4, tx, u0;
+    uint64_t a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4];
+    const uint64_t M = 0xFFFFFFFFFFFFFULL, R = 0x1000003D10ULL;
+
+    VERIFY_BITS(a[0], 56);
+    VERIFY_BITS(a[1], 56);
+    VERIFY_BITS(a[2], 56);
+    VERIFY_BITS(a[3], 56);
+    VERIFY_BITS(a[4], 52);
+    VERIFY_BITS(b[0], 56);
+    VERIFY_BITS(b[1], 56);
+    VERIFY_BITS(b[2], 56);
+    VERIFY_BITS(b[3], 56);
+    VERIFY_BITS(b[4], 52);
+    VERIFY_CHECK(r != b);
+    VERIFY_CHECK(a != b);
+
+    /*  [... a b c] is a shorthand for ... + a<<104 + b<<52 + c<<0 mod n.
+     *  for 0 <= x <= 4, px is a shorthand for sum(a[i]*b[x-i], i=0..x).
+     *  for 4 <= x <= 8, px is a shorthand for sum(a[i]*b[x-i], i=(x-4)..4)
+     *  Note that [x 0 0 0 0 0] = [x*R].
+     */
+
+    secp256k1_u128_mul(&d, a0, b[3]);
+    secp256k1_u128_accum_mul(&d, a1, b[2]);
+    secp256k1_u128_accum_mul(&d, a2, b[1]);
+    secp256k1_u128_accum_mul(&d, a3, b[0]);
+    VERIFY_BITS_128(&d, 114);
+    /* [d 0 0 0] = [p3 0 0 0] */
+    secp256k1_u128_mul(&c, a4, b[4]);
+    VERIFY_BITS_128(&c, 112);
+    /* [c 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */
+    secp256k1_u128_accum_mul(&d, R, secp256k1_u128_to_u64(&c)); secp256k1_u128_rshift(&c, 64);
+    VERIFY_BITS_128(&d, 115);
+    VERIFY_BITS_128(&c, 48);
+    /* [(c<<12) 0 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */
+    t3 = secp256k1_u128_to_u64(&d) & M; secp256k1_u128_rshift(&d, 52);
+    VERIFY_BITS(t3, 52);
+    VERIFY_BITS_128(&d, 63);
+    /* [(c<<12) 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */
+
+    secp256k1_u128_accum_mul(&d, a0, b[4]);
+    secp256k1_u128_accum_mul(&d, a1, b[3]);
+    secp256k1_u128_accum_mul(&d, a2, b[2]);
+    secp256k1_u128_accum_mul(&d, a3, b[1]);
+    secp256k1_u128_accum_mul(&d, a4, b[0]);
+    VERIFY_BITS_128(&d, 115);
+    /* [(c<<12) 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */
+    secp256k1_u128_accum_mul(&d, R << 12, secp256k1_u128_to_u64(&c));
+    VERIFY_BITS_128(&d, 116);
+    /* [d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */
+    t4 = secp256k1_u128_to_u64(&d) & M; secp256k1_u128_rshift(&d, 52);
+    VERIFY_BITS(t4, 52);
+    VERIFY_BITS_128(&d, 64);
+    /* [d t4 t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */
+    tx = (t4 >> 48); t4 &= (M >> 4);
+    VERIFY_BITS(tx, 4);
+    VERIFY_BITS(t4, 48);
+    /* [d t4+(tx<<48) t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */
+
+    secp256k1_u128_mul(&c, a0, b[0]);
+    VERIFY_BITS_128(&c, 112);
+    /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 0 p4 p3 0 0 p0] */
+    secp256k1_u128_accum_mul(&d, a1, b[4]);
+    secp256k1_u128_accum_mul(&d, a2, b[3]);
+    secp256k1_u128_accum_mul(&d, a3, b[2]);
+    secp256k1_u128_accum_mul(&d, a4, b[1]);
+    VERIFY_BITS_128(&d, 114);
+    /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */
+    u0 = secp256k1_u128_to_u64(&d) & M; secp256k1_u128_rshift(&d, 52);
+    VERIFY_BITS(u0, 52);
+    VERIFY_BITS_128(&d, 62);
+    /* [d u0 t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */
+    /* [d 0 t4+(tx<<48)+(u0<<52) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */
+    u0 = (u0 << 4) | tx;
+    VERIFY_BITS(u0, 56);
+    /* [d 0 t4+(u0<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */
+    secp256k1_u128_accum_mul(&c, u0, R >> 4);
+    VERIFY_BITS_128(&c, 113);
+    /* [d 0 t4 t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */
+    r[0] = secp256k1_u128_to_u64(&c) & M; secp256k1_u128_rshift(&c, 52);
+    VERIFY_BITS(r[0], 52);
+    VERIFY_BITS_128(&c, 61);
+    /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 0 p0] */
+
+    secp256k1_u128_accum_mul(&c, a0, b[1]);
+    secp256k1_u128_accum_mul(&c, a1, b[0]);
+    VERIFY_BITS_128(&c, 114);
+    /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 p1 p0] */
+    secp256k1_u128_accum_mul(&d, a2, b[4]);
+    secp256k1_u128_accum_mul(&d, a3, b[3]);
+    secp256k1_u128_accum_mul(&d, a4, b[2]);
+    VERIFY_BITS_128(&d, 114);
+    /* [d 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */
+    secp256k1_u128_accum_mul(&c, secp256k1_u128_to_u64(&d) & M, R); secp256k1_u128_rshift(&d, 52);
+    VERIFY_BITS_128(&c, 115);
+    VERIFY_BITS_128(&d, 62);
+    /* [d 0 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */
+    r[1] = secp256k1_u128_to_u64(&c) & M; secp256k1_u128_rshift(&c, 52);
+    VERIFY_BITS(r[1], 52);
+    VERIFY_BITS_128(&c, 63);
+    /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */
+
+    secp256k1_u128_accum_mul(&c, a0, b[2]);
+    secp256k1_u128_accum_mul(&c, a1, b[1]);
+    secp256k1_u128_accum_mul(&c, a2, b[0]);
+    VERIFY_BITS_128(&c, 114);
+    /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 p2 p1 p0] */
+    secp256k1_u128_accum_mul(&d, a3, b[4]);
+    secp256k1_u128_accum_mul(&d, a4, b[3]);
+    VERIFY_BITS_128(&d, 114);
+    /* [d 0 0 t4 t3 c t1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    secp256k1_u128_accum_mul(&c, R, secp256k1_u128_to_u64(&d)); secp256k1_u128_rshift(&d, 64);
+    VERIFY_BITS_128(&c, 115);
+    VERIFY_BITS_128(&d, 50);
+    /* [(d<<12) 0 0 0 t4 t3 c r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+
+    r[2] = secp256k1_u128_to_u64(&c) & M; secp256k1_u128_rshift(&c, 52);
+    VERIFY_BITS(r[2], 52);
+    VERIFY_BITS_128(&c, 63);
+    /* [(d<<12) 0 0 0 t4 t3+c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    secp256k1_u128_accum_mul(&c, R << 12, secp256k1_u128_to_u64(&d));
+    secp256k1_u128_accum_u64(&c, t3);
+    VERIFY_BITS_128(&c, 100);
+    /* [t4 c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[3] = secp256k1_u128_to_u64(&c) & M; secp256k1_u128_rshift(&c, 52);
+    VERIFY_BITS(r[3], 52);
+    VERIFY_BITS_128(&c, 48);
+    /* [t4+c r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[4] = secp256k1_u128_to_u64(&c) + t4;
+    VERIFY_BITS(r[4], 49);
+    /* [r4 r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+}
+
+SECP256K1_INLINE static void secp256k1_fe_sqr_inner(uint64_t *r, const uint64_t *a) {
+    secp256k1_uint128 c, d;
+    uint64_t a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4];
+    uint64_t t3, t4, tx, u0;
+    const uint64_t M = 0xFFFFFFFFFFFFFULL, R = 0x1000003D10ULL;
+
+    VERIFY_BITS(a[0], 56);
+    VERIFY_BITS(a[1], 56);
+    VERIFY_BITS(a[2], 56);
+    VERIFY_BITS(a[3], 56);
+    VERIFY_BITS(a[4], 52);
+
+    /**  [... a b c] is a shorthand for ... + a<<104 + b<<52 + c<<0 mod n.
+     *  px is a shorthand for sum(a[i]*a[x-i], i=0..x).
+     *  Note that [x 0 0 0 0 0] = [x*R].
+     */
+
+    secp256k1_u128_mul(&d, a0*2, a3);
+    secp256k1_u128_accum_mul(&d, a1*2, a2);
+    VERIFY_BITS_128(&d, 114);
+    /* [d 0 0 0] = [p3 0 0 0] */
+    secp256k1_u128_mul(&c, a4, a4);
+    VERIFY_BITS_128(&c, 112);
+    /* [c 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */
+    secp256k1_u128_accum_mul(&d, R, secp256k1_u128_to_u64(&c)); secp256k1_u128_rshift(&c, 64);
+    VERIFY_BITS_128(&d, 115);
+    VERIFY_BITS_128(&c, 48);
+    /* [(c<<12) 0 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */
+    t3 = secp256k1_u128_to_u64(&d) & M; secp256k1_u128_rshift(&d, 52);
+    VERIFY_BITS(t3, 52);
+    VERIFY_BITS_128(&d, 63);
+    /* [(c<<12) 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */
+
+    a4 *= 2;
+    secp256k1_u128_accum_mul(&d, a0, a4);
+    secp256k1_u128_accum_mul(&d, a1*2, a3);
+    secp256k1_u128_accum_mul(&d, a2, a2);
+    VERIFY_BITS_128(&d, 115);
+    /* [(c<<12) 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */
+    secp256k1_u128_accum_mul(&d, R << 12, secp256k1_u128_to_u64(&c));
+    VERIFY_BITS_128(&d, 116);
+    /* [d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */
+    t4 = secp256k1_u128_to_u64(&d) & M; secp256k1_u128_rshift(&d, 52);
+    VERIFY_BITS(t4, 52);
+    VERIFY_BITS_128(&d, 64);
+    /* [d t4 t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */
+    tx = (t4 >> 48); t4 &= (M >> 4);
+    VERIFY_BITS(tx, 4);
+    VERIFY_BITS(t4, 48);
+    /* [d t4+(tx<<48) t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */
+
+    secp256k1_u128_mul(&c, a0, a0);
+    VERIFY_BITS_128(&c, 112);
+    /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 0 p4 p3 0 0 p0] */
+    secp256k1_u128_accum_mul(&d, a1, a4);
+    secp256k1_u128_accum_mul(&d, a2*2, a3);
+    VERIFY_BITS_128(&d, 114);
+    /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */
+    u0 = secp256k1_u128_to_u64(&d) & M; secp256k1_u128_rshift(&d, 52);
+    VERIFY_BITS(u0, 52);
+    VERIFY_BITS_128(&d, 62);
+    /* [d u0 t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */
+    /* [d 0 t4+(tx<<48)+(u0<<52) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */
+    u0 = (u0 << 4) | tx;
+    VERIFY_BITS(u0, 56);
+    /* [d 0 t4+(u0<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */
+    secp256k1_u128_accum_mul(&c, u0, R >> 4);
+    VERIFY_BITS_128(&c, 113);
+    /* [d 0 t4 t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */
+    r[0] = secp256k1_u128_to_u64(&c) & M; secp256k1_u128_rshift(&c, 52);
+    VERIFY_BITS(r[0], 52);
+    VERIFY_BITS_128(&c, 61);
+    /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 0 p0] */
+
+    a0 *= 2;
+    secp256k1_u128_accum_mul(&c, a0, a1);
+    VERIFY_BITS_128(&c, 114);
+    /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 p1 p0] */
+    secp256k1_u128_accum_mul(&d, a2, a4);
+    secp256k1_u128_accum_mul(&d, a3, a3);
+    VERIFY_BITS_128(&d, 114);
+    /* [d 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */
+    secp256k1_u128_accum_mul(&c, secp256k1_u128_to_u64(&d) & M, R); secp256k1_u128_rshift(&d, 52);
+    VERIFY_BITS_128(&c, 115);
+    VERIFY_BITS_128(&d, 62);
+    /* [d 0 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */
+    r[1] = secp256k1_u128_to_u64(&c) & M; secp256k1_u128_rshift(&c, 52);
+    VERIFY_BITS(r[1], 52);
+    VERIFY_BITS_128(&c, 63);
+    /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */
+
+    secp256k1_u128_accum_mul(&c, a0, a2);
+    secp256k1_u128_accum_mul(&c, a1, a1);
+    VERIFY_BITS_128(&c, 114);
+    /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 p2 p1 p0] */
+    secp256k1_u128_accum_mul(&d, a3, a4);
+    VERIFY_BITS_128(&d, 114);
+    /* [d 0 0 t4 t3 c r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    secp256k1_u128_accum_mul(&c, R, secp256k1_u128_to_u64(&d)); secp256k1_u128_rshift(&d, 64);
+    VERIFY_BITS_128(&c, 115);
+    VERIFY_BITS_128(&d, 50);
+    /* [(d<<12) 0 0 0 t4 t3 c r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[2] = secp256k1_u128_to_u64(&c) & M; secp256k1_u128_rshift(&c, 52);
+    VERIFY_BITS(r[2], 52);
+    VERIFY_BITS_128(&c, 63);
+    /* [(d<<12) 0 0 0 t4 t3+c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+
+    secp256k1_u128_accum_mul(&c, R << 12, secp256k1_u128_to_u64(&d));
+    secp256k1_u128_accum_u64(&c, t3);
+    VERIFY_BITS_128(&c, 100);
+    /* [t4 c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[3] = secp256k1_u128_to_u64(&c) & M; secp256k1_u128_rshift(&c, 52);
+    VERIFY_BITS(r[3], 52);
+    VERIFY_BITS_128(&c, 48);
+    /* [t4+c r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+    r[4] = secp256k1_u128_to_u64(&c) + t4;
+    VERIFY_BITS(r[4], 49);
+    /* [r4 r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */
+}
+
+#endif /* SECP256K1_FIELD_INNER5X52_IMPL_H */
diff --git a/vendor/external/secp256k1/src/field_impl.h b/vendor/external/secp256k1/src/field_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/field_impl.h
@@ -0,0 +1,457 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_FIELD_IMPL_H
+#define SECP256K1_FIELD_IMPL_H
+
+#include "field.h"
+#include "util.h"
+
+#if defined(SECP256K1_WIDEMUL_INT128)
+#include "field_5x52_impl.h"
+#elif defined(SECP256K1_WIDEMUL_INT64)
+#include "field_10x26_impl.h"
+#else
+#error "Please select wide multiplication implementation"
+#endif
+
+SECP256K1_INLINE static void secp256k1_fe_clear(secp256k1_fe *a) {
+    secp256k1_memclear(a, sizeof(secp256k1_fe));
+}
+
+SECP256K1_INLINE static int secp256k1_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b) {
+    secp256k1_fe na;
+    SECP256K1_FE_VERIFY(a);
+    SECP256K1_FE_VERIFY(b);
+    SECP256K1_FE_VERIFY_MAGNITUDE(a, 1);
+    SECP256K1_FE_VERIFY_MAGNITUDE(b, 31);
+
+    secp256k1_fe_negate(&na, a, 1);
+    secp256k1_fe_add(&na, b);
+    return secp256k1_fe_normalizes_to_zero(&na);
+}
+
+static int secp256k1_fe_sqrt(secp256k1_fe * SECP256K1_RESTRICT r, const secp256k1_fe * SECP256K1_RESTRICT a) {
+    /** Given that p is congruent to 3 mod 4, we can compute the square root of
+     *  a mod p as the (p+1)/4'th power of a.
+     *
+     *  As (p+1)/4 is an even number, it will have the same result for a and for
+     *  (-a). Only one of these two numbers actually has a square root however,
+     *  so we test at the end by squaring and comparing to the input.
+     *  Also because (p+1)/4 is an even number, the computed square root is
+     *  itself always a square (a ** ((p+1)/4) is the square of a ** ((p+1)/8)).
+     */
+    secp256k1_fe x2, x3, x6, x9, x11, x22, x44, x88, x176, x220, x223, t1;
+    int j, ret;
+
+    VERIFY_CHECK(r != a);
+    SECP256K1_FE_VERIFY(a);
+    SECP256K1_FE_VERIFY_MAGNITUDE(a, 8);
+
+    /** The binary representation of (p + 1)/4 has 3 blocks of 1s, with lengths in
+     *  { 2, 22, 223 }. Use an addition chain to calculate 2^n - 1 for each block:
+     *  1, [2], 3, 6, 9, 11, [22], 44, 88, 176, 220, [223]
+     */
+
+    secp256k1_fe_sqr(&x2, a);
+    secp256k1_fe_mul(&x2, &x2, a);
+
+    secp256k1_fe_sqr(&x3, &x2);
+    secp256k1_fe_mul(&x3, &x3, a);
+
+    x6 = x3;
+    for (j=0; j<3; j++) {
+        secp256k1_fe_sqr(&x6, &x6);
+    }
+    secp256k1_fe_mul(&x6, &x6, &x3);
+
+    x9 = x6;
+    for (j=0; j<3; j++) {
+        secp256k1_fe_sqr(&x9, &x9);
+    }
+    secp256k1_fe_mul(&x9, &x9, &x3);
+
+    x11 = x9;
+    for (j=0; j<2; j++) {
+        secp256k1_fe_sqr(&x11, &x11);
+    }
+    secp256k1_fe_mul(&x11, &x11, &x2);
+
+    x22 = x11;
+    for (j=0; j<11; j++) {
+        secp256k1_fe_sqr(&x22, &x22);
+    }
+    secp256k1_fe_mul(&x22, &x22, &x11);
+
+    x44 = x22;
+    for (j=0; j<22; j++) {
+        secp256k1_fe_sqr(&x44, &x44);
+    }
+    secp256k1_fe_mul(&x44, &x44, &x22);
+
+    x88 = x44;
+    for (j=0; j<44; j++) {
+        secp256k1_fe_sqr(&x88, &x88);
+    }
+    secp256k1_fe_mul(&x88, &x88, &x44);
+
+    x176 = x88;
+    for (j=0; j<88; j++) {
+        secp256k1_fe_sqr(&x176, &x176);
+    }
+    secp256k1_fe_mul(&x176, &x176, &x88);
+
+    x220 = x176;
+    for (j=0; j<44; j++) {
+        secp256k1_fe_sqr(&x220, &x220);
+    }
+    secp256k1_fe_mul(&x220, &x220, &x44);
+
+    x223 = x220;
+    for (j=0; j<3; j++) {
+        secp256k1_fe_sqr(&x223, &x223);
+    }
+    secp256k1_fe_mul(&x223, &x223, &x3);
+
+    /* The final result is then assembled using a sliding window over the blocks. */
+
+    t1 = x223;
+    for (j=0; j<23; j++) {
+        secp256k1_fe_sqr(&t1, &t1);
+    }
+    secp256k1_fe_mul(&t1, &t1, &x22);
+    for (j=0; j<6; j++) {
+        secp256k1_fe_sqr(&t1, &t1);
+    }
+    secp256k1_fe_mul(&t1, &t1, &x2);
+    secp256k1_fe_sqr(&t1, &t1);
+    secp256k1_fe_sqr(r, &t1);
+
+    /* Check that a square root was actually calculated */
+
+    secp256k1_fe_sqr(&t1, r);
+    ret = secp256k1_fe_equal(&t1, a);
+
+#ifdef VERIFY
+    if (!ret) {
+        secp256k1_fe_negate(&t1, &t1, 1);
+        secp256k1_fe_normalize_var(&t1);
+        VERIFY_CHECK(secp256k1_fe_equal(&t1, a));
+    }
+#endif
+    return ret;
+}
+
+#ifndef VERIFY
+static void secp256k1_fe_verify(const secp256k1_fe *a) { (void)a; }
+static void secp256k1_fe_verify_magnitude(const secp256k1_fe *a, int m) { (void)a; (void)m; }
+#else
+static void secp256k1_fe_impl_verify(const secp256k1_fe *a);
+static void secp256k1_fe_verify(const secp256k1_fe *a) {
+    /* Magnitude between 0 and 32. */
+    SECP256K1_FE_VERIFY_MAGNITUDE(a, 32);
+    /* Normalized is 0 or 1. */
+    VERIFY_CHECK((a->normalized == 0) || (a->normalized == 1));
+    /* If normalized, magnitude must be 0 or 1. */
+    if (a->normalized) SECP256K1_FE_VERIFY_MAGNITUDE(a, 1);
+    /* Invoke implementation-specific checks. */
+    secp256k1_fe_impl_verify(a);
+}
+
+static void secp256k1_fe_verify_magnitude(const secp256k1_fe *a, int m) {
+    VERIFY_CHECK(m >= 0);
+    VERIFY_CHECK(m <= 32);
+    VERIFY_CHECK(a->magnitude <= m);
+}
+
+static void secp256k1_fe_impl_normalize(secp256k1_fe *r);
+SECP256K1_INLINE static void secp256k1_fe_normalize(secp256k1_fe *r) {
+    SECP256K1_FE_VERIFY(r);
+
+    secp256k1_fe_impl_normalize(r);
+    r->magnitude = 1;
+    r->normalized = 1;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_normalize_weak(secp256k1_fe *r);
+SECP256K1_INLINE static void secp256k1_fe_normalize_weak(secp256k1_fe *r) {
+    SECP256K1_FE_VERIFY(r);
+
+    secp256k1_fe_impl_normalize_weak(r);
+    r->magnitude = 1;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_normalize_var(secp256k1_fe *r);
+SECP256K1_INLINE static void secp256k1_fe_normalize_var(secp256k1_fe *r) {
+    SECP256K1_FE_VERIFY(r);
+
+    secp256k1_fe_impl_normalize_var(r);
+    r->magnitude = 1;
+    r->normalized = 1;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static int secp256k1_fe_impl_normalizes_to_zero(const secp256k1_fe *r);
+SECP256K1_INLINE static int secp256k1_fe_normalizes_to_zero(const secp256k1_fe *r) {
+    SECP256K1_FE_VERIFY(r);
+
+    return secp256k1_fe_impl_normalizes_to_zero(r);
+}
+
+static int secp256k1_fe_impl_normalizes_to_zero_var(const secp256k1_fe *r);
+SECP256K1_INLINE static int secp256k1_fe_normalizes_to_zero_var(const secp256k1_fe *r) {
+    SECP256K1_FE_VERIFY(r);
+
+    return secp256k1_fe_impl_normalizes_to_zero_var(r);
+}
+
+static void secp256k1_fe_impl_set_int(secp256k1_fe *r, int a);
+SECP256K1_INLINE static void secp256k1_fe_set_int(secp256k1_fe *r, int a) {
+    VERIFY_CHECK(0 <= a && a <= 0x7FFF);
+
+    secp256k1_fe_impl_set_int(r, a);
+    r->magnitude = (a != 0);
+    r->normalized = 1;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_add_int(secp256k1_fe *r, int a);
+SECP256K1_INLINE static void secp256k1_fe_add_int(secp256k1_fe *r, int a) {
+    VERIFY_CHECK(0 <= a && a <= 0x7FFF);
+    SECP256K1_FE_VERIFY(r);
+
+    secp256k1_fe_impl_add_int(r, a);
+    r->magnitude += 1;
+    r->normalized = 0;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static int secp256k1_fe_impl_is_zero(const secp256k1_fe *a);
+SECP256K1_INLINE static int secp256k1_fe_is_zero(const secp256k1_fe *a) {
+    SECP256K1_FE_VERIFY(a);
+    VERIFY_CHECK(a->normalized);
+
+    return secp256k1_fe_impl_is_zero(a);
+}
+
+static int secp256k1_fe_impl_is_odd(const secp256k1_fe *a);
+SECP256K1_INLINE static int secp256k1_fe_is_odd(const secp256k1_fe *a) {
+    SECP256K1_FE_VERIFY(a);
+    VERIFY_CHECK(a->normalized);
+
+    return secp256k1_fe_impl_is_odd(a);
+}
+
+static int secp256k1_fe_impl_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b);
+SECP256K1_INLINE static int secp256k1_fe_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b) {
+    SECP256K1_FE_VERIFY(a);
+    SECP256K1_FE_VERIFY(b);
+    VERIFY_CHECK(a->normalized);
+    VERIFY_CHECK(b->normalized);
+
+    return secp256k1_fe_impl_cmp_var(a, b);
+}
+
+static void secp256k1_fe_impl_set_b32_mod(secp256k1_fe *r, const unsigned char *a);
+SECP256K1_INLINE static void secp256k1_fe_set_b32_mod(secp256k1_fe *r, const unsigned char *a) {
+    secp256k1_fe_impl_set_b32_mod(r, a);
+    r->magnitude = 1;
+    r->normalized = 0;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static int secp256k1_fe_impl_set_b32_limit(secp256k1_fe *r, const unsigned char *a);
+SECP256K1_INLINE static int secp256k1_fe_set_b32_limit(secp256k1_fe *r, const unsigned char *a) {
+    if (secp256k1_fe_impl_set_b32_limit(r, a)) {
+        r->magnitude = 1;
+        r->normalized = 1;
+        SECP256K1_FE_VERIFY(r);
+        return 1;
+    } else {
+        /* Mark the output field element as invalid. */
+        r->magnitude = -1;
+        return 0;
+    }
+}
+
+static void secp256k1_fe_impl_get_b32(unsigned char *r, const secp256k1_fe *a);
+SECP256K1_INLINE static void secp256k1_fe_get_b32(unsigned char *r, const secp256k1_fe *a) {
+    SECP256K1_FE_VERIFY(a);
+    VERIFY_CHECK(a->normalized);
+
+    secp256k1_fe_impl_get_b32(r, a);
+}
+
+static void secp256k1_fe_impl_negate_unchecked(secp256k1_fe *r, const secp256k1_fe *a, int m);
+SECP256K1_INLINE static void secp256k1_fe_negate_unchecked(secp256k1_fe *r, const secp256k1_fe *a, int m) {
+    SECP256K1_FE_VERIFY(a);
+    VERIFY_CHECK(m >= 0 && m <= 31);
+    SECP256K1_FE_VERIFY_MAGNITUDE(a, m);
+
+    secp256k1_fe_impl_negate_unchecked(r, a, m);
+    r->magnitude = m + 1;
+    r->normalized = 0;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_mul_int_unchecked(secp256k1_fe *r, int a);
+SECP256K1_INLINE static void secp256k1_fe_mul_int_unchecked(secp256k1_fe *r, int a) {
+    SECP256K1_FE_VERIFY(r);
+
+    VERIFY_CHECK(a >= 0 && a <= 32);
+    VERIFY_CHECK(a*r->magnitude <= 32);
+    secp256k1_fe_impl_mul_int_unchecked(r, a);
+    r->magnitude *= a;
+    r->normalized = 0;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_add(secp256k1_fe *r, const secp256k1_fe *a);
+SECP256K1_INLINE static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a) {
+    SECP256K1_FE_VERIFY(r);
+    SECP256K1_FE_VERIFY(a);
+    VERIFY_CHECK(r->magnitude + a->magnitude <= 32);
+
+    secp256k1_fe_impl_add(r, a);
+    r->magnitude += a->magnitude;
+    r->normalized = 0;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b);
+SECP256K1_INLINE static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b) {
+    SECP256K1_FE_VERIFY(a);
+    SECP256K1_FE_VERIFY(b);
+    SECP256K1_FE_VERIFY_MAGNITUDE(a, 8);
+    SECP256K1_FE_VERIFY_MAGNITUDE(b, 8);
+    VERIFY_CHECK(r != b);
+    VERIFY_CHECK(a != b);
+
+    secp256k1_fe_impl_mul(r, a, b);
+    r->magnitude = 1;
+    r->normalized = 0;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_sqr(secp256k1_fe *r, const secp256k1_fe *a);
+SECP256K1_INLINE static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a) {
+    SECP256K1_FE_VERIFY(a);
+    SECP256K1_FE_VERIFY_MAGNITUDE(a, 8);
+
+    secp256k1_fe_impl_sqr(r, a);
+    r->magnitude = 1;
+    r->normalized = 0;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag);
+SECP256K1_INLINE static void secp256k1_fe_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag) {
+    VERIFY_CHECK(flag == 0 || flag == 1);
+    SECP256K1_FE_VERIFY(a);
+    SECP256K1_FE_VERIFY(r);
+
+    secp256k1_fe_impl_cmov(r, a, flag);
+    if (a->magnitude > r->magnitude) r->magnitude = a->magnitude;
+    if (!a->normalized) r->normalized = 0;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a);
+SECP256K1_INLINE static void secp256k1_fe_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a) {
+    SECP256K1_FE_VERIFY(a);
+    VERIFY_CHECK(a->normalized);
+
+    secp256k1_fe_impl_to_storage(r, a);
+}
+
+static void secp256k1_fe_impl_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a);
+SECP256K1_INLINE static void secp256k1_fe_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a) {
+    secp256k1_fe_impl_from_storage(r, a);
+    r->magnitude = 1;
+    r->normalized = 1;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_inv(secp256k1_fe *r, const secp256k1_fe *x);
+SECP256K1_INLINE static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *x) {
+    int input_is_zero = secp256k1_fe_normalizes_to_zero(x);
+    SECP256K1_FE_VERIFY(x);
+
+    secp256k1_fe_impl_inv(r, x);
+    r->magnitude = x->magnitude > 0;
+    r->normalized = 1;
+
+    VERIFY_CHECK(secp256k1_fe_normalizes_to_zero(r) == input_is_zero);
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_inv_var(secp256k1_fe *r, const secp256k1_fe *x);
+SECP256K1_INLINE static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *x) {
+    int input_is_zero = secp256k1_fe_normalizes_to_zero(x);
+    SECP256K1_FE_VERIFY(x);
+
+    secp256k1_fe_impl_inv_var(r, x);
+    r->magnitude = x->magnitude > 0;
+    r->normalized = 1;
+
+    VERIFY_CHECK(secp256k1_fe_normalizes_to_zero(r) == input_is_zero);
+    SECP256K1_FE_VERIFY(r);
+}
+
+static int secp256k1_fe_impl_is_square_var(const secp256k1_fe *x);
+SECP256K1_INLINE static int secp256k1_fe_is_square_var(const secp256k1_fe *x) {
+    int ret;
+    secp256k1_fe tmp = *x, sqrt;
+    SECP256K1_FE_VERIFY(x);
+
+    ret = secp256k1_fe_impl_is_square_var(x);
+    secp256k1_fe_normalize_weak(&tmp);
+    VERIFY_CHECK(ret == secp256k1_fe_sqrt(&sqrt, &tmp));
+    return ret;
+}
+
+static void secp256k1_fe_impl_get_bounds(secp256k1_fe* r, int m);
+SECP256K1_INLINE static void secp256k1_fe_get_bounds(secp256k1_fe* r, int m) {
+    VERIFY_CHECK(m >= 0);
+    VERIFY_CHECK(m <= 32);
+
+    secp256k1_fe_impl_get_bounds(r, m);
+    r->magnitude = m;
+    r->normalized = (m == 0);
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+static void secp256k1_fe_impl_half(secp256k1_fe *r);
+SECP256K1_INLINE static void secp256k1_fe_half(secp256k1_fe *r) {
+    SECP256K1_FE_VERIFY(r);
+    SECP256K1_FE_VERIFY_MAGNITUDE(r, 31);
+
+    secp256k1_fe_impl_half(r);
+    r->magnitude = (r->magnitude >> 1) + 1;
+    r->normalized = 0;
+
+    SECP256K1_FE_VERIFY(r);
+}
+
+#endif /* defined(VERIFY) */
+
+#endif /* SECP256K1_FIELD_IMPL_H */
diff --git a/vendor/external/secp256k1/src/group.h b/vendor/external/secp256k1/src/group.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/group.h
@@ -0,0 +1,212 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_GROUP_H
+#define SECP256K1_GROUP_H
+
+#include "field.h"
+
+/** A group element in affine coordinates on the secp256k1 curve,
+ *  or occasionally on an isomorphic curve of the form y^2 = x^3 + 7*t^6.
+ *  Note: For exhaustive test mode, secp256k1 is replaced by a small subgroup of a different curve.
+ */
+typedef struct {
+    secp256k1_fe x;
+    secp256k1_fe y;
+    int infinity; /* whether this represents the point at infinity */
+} secp256k1_ge;
+
+#define SECP256K1_GE_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_CONST((i),(j),(k),(l),(m),(n),(o),(p)), 0}
+#define SECP256K1_GE_CONST_INFINITY {SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), 1}
+
+/** A group element of the secp256k1 curve, in jacobian coordinates.
+ *  Note: For exhastive test mode, secp256k1 is replaced by a small subgroup of a different curve.
+ */
+typedef struct {
+    secp256k1_fe x; /* actual X: x/z^2 */
+    secp256k1_fe y; /* actual Y: y/z^3 */
+    secp256k1_fe z;
+    int infinity; /* whether this represents the point at infinity */
+} secp256k1_gej;
+
+#define SECP256K1_GEJ_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_CONST((i),(j),(k),(l),(m),(n),(o),(p)), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1), 0}
+#define SECP256K1_GEJ_CONST_INFINITY {SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), 1}
+
+typedef struct {
+    secp256k1_fe_storage x;
+    secp256k1_fe_storage y;
+} secp256k1_ge_storage;
+
+#define SECP256K1_GE_STORAGE_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_STORAGE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_STORAGE_CONST((i),(j),(k),(l),(m),(n),(o),(p))}
+
+#define SECP256K1_GE_STORAGE_CONST_GET(t) SECP256K1_FE_STORAGE_CONST_GET(t.x), SECP256K1_FE_STORAGE_CONST_GET(t.y)
+
+/** Maximum allowed magnitudes for group element coordinates
+ *  in affine (x, y) and jacobian (x, y, z) representation. */
+#define SECP256K1_GE_X_MAGNITUDE_MAX  4
+#define SECP256K1_GE_Y_MAGNITUDE_MAX  3
+#define SECP256K1_GEJ_X_MAGNITUDE_MAX 4
+#define SECP256K1_GEJ_Y_MAGNITUDE_MAX 4
+#define SECP256K1_GEJ_Z_MAGNITUDE_MAX 1
+
+/** Set a group element equal to the point with given X and Y coordinates */
+static void secp256k1_ge_set_xy(secp256k1_ge *r, const secp256k1_fe *x, const secp256k1_fe *y);
+
+/** Set a group element (affine) equal to the point with the given X coordinate, and given oddness
+ *  for Y. Return value indicates whether the result is valid. */
+static int secp256k1_ge_set_xo_var(secp256k1_ge *r, const secp256k1_fe *x, int odd);
+
+/** Determine whether x is a valid X coordinate on the curve. */
+static int secp256k1_ge_x_on_curve_var(const secp256k1_fe *x);
+
+/** Determine whether fraction xn/xd is a valid X coordinate on the curve (xd != 0). */
+static int secp256k1_ge_x_frac_on_curve_var(const secp256k1_fe *xn, const secp256k1_fe *xd);
+
+/** Check whether a group element is the point at infinity. */
+static int secp256k1_ge_is_infinity(const secp256k1_ge *a);
+
+/** Check whether a group element is valid (i.e., on the curve). */
+static int secp256k1_ge_is_valid_var(const secp256k1_ge *a);
+
+/** Set r equal to the inverse of a (i.e., mirrored around the X axis) */
+static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a);
+
+/** Set a group element equal to another which is given in jacobian coordinates. Constant time. */
+static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a);
+
+/** Set a group element equal to another which is given in jacobian coordinates. */
+static void secp256k1_ge_set_gej_var(secp256k1_ge *r, secp256k1_gej *a);
+
+/** Set a batch of group elements equal to the inputs given in jacobian coordinates */
+static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a, size_t len);
+
+/** Bring a batch of inputs to the same global z "denominator", based on ratios between
+ *  (omitted) z coordinates of adjacent elements.
+ *
+ *  Although the elements a[i] are _ge rather than _gej, they actually represent elements
+ *  in Jacobian coordinates with their z coordinates omitted.
+ *
+ *  Using the notation z(b) to represent the omitted z coordinate of b, the array zr of
+ *  z coordinate ratios must satisfy zr[i] == z(a[i]) / z(a[i-1]) for 0 < 'i' < len.
+ *  The zr[0] value is unused.
+ *
+ *  This function adjusts the coordinates of 'a' in place so that for all 'i', z(a[i]) == z(a[len-1]).
+ *  In other words, the initial value of z(a[len-1]) becomes the global z "denominator". Only the
+ *  a[i].x and a[i].y coordinates are explicitly modified; the adjustment of the omitted z coordinate is
+ *  implicit.
+ *
+ *  The coordinates of the final element a[len-1] are not changed.
+ */
+static void secp256k1_ge_table_set_globalz(size_t len, secp256k1_ge *a, const secp256k1_fe *zr);
+
+/** Check two group elements (affine) for equality in variable time. */
+static int secp256k1_ge_eq_var(const secp256k1_ge *a, const secp256k1_ge *b);
+
+/** Set a group element (affine) equal to the point at infinity. */
+static void secp256k1_ge_set_infinity(secp256k1_ge *r);
+
+/** Set a group element (jacobian) equal to the point at infinity. */
+static void secp256k1_gej_set_infinity(secp256k1_gej *r);
+
+/** Set a group element (jacobian) equal to another which is given in affine coordinates. */
+static void secp256k1_gej_set_ge(secp256k1_gej *r, const secp256k1_ge *a);
+
+/** Check two group elements (jacobian) for equality in variable time. */
+static int secp256k1_gej_eq_var(const secp256k1_gej *a, const secp256k1_gej *b);
+
+/** Check two group elements (jacobian and affine) for equality in variable time. */
+static int secp256k1_gej_eq_ge_var(const secp256k1_gej *a, const secp256k1_ge *b);
+
+/** Compare the X coordinate of a group element (jacobian).
+  * The magnitude of the group element's X coordinate must not exceed 31. */
+static int secp256k1_gej_eq_x_var(const secp256k1_fe *x, const secp256k1_gej *a);
+
+/** Set r equal to the inverse of a (i.e., mirrored around the X axis) */
+static void secp256k1_gej_neg(secp256k1_gej *r, const secp256k1_gej *a);
+
+/** Check whether a group element is the point at infinity. */
+static int secp256k1_gej_is_infinity(const secp256k1_gej *a);
+
+/** Set r equal to the double of a. Constant time. */
+static void secp256k1_gej_double(secp256k1_gej *r, const secp256k1_gej *a);
+
+/** Set r equal to the double of a. If rzr is not-NULL this sets *rzr such that r->z == a->z * *rzr (where infinity means an implicit z = 0). */
+static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr);
+
+/** Set r equal to the sum of a and b. If rzr is non-NULL this sets *rzr such that r->z == a->z * *rzr (a cannot be infinity in that case). */
+static void secp256k1_gej_add_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_gej *b, secp256k1_fe *rzr);
+
+/** Set r equal to the sum of a and b (with b given in affine coordinates, and not infinity). */
+static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b);
+
+/** Set r equal to the sum of a and b (with b given in affine coordinates). This is more efficient
+    than secp256k1_gej_add_var. It is identical to secp256k1_gej_add_ge but without constant-time
+    guarantee, and b is allowed to be infinity. If rzr is non-NULL this sets *rzr such that r->z == a->z * *rzr (a cannot be infinity in that case). */
+static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr);
+
+/** Set r equal to the sum of a and b (with the inverse of b's Z coordinate passed as bzinv). */
+static void secp256k1_gej_add_zinv_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, const secp256k1_fe *bzinv);
+
+/** Set r to be equal to lambda times a, where lambda is chosen in a way such that this is very fast. */
+static void secp256k1_ge_mul_lambda(secp256k1_ge *r, const secp256k1_ge *a);
+
+/** Clear a secp256k1_gej to prevent leaking sensitive information. */
+static void secp256k1_gej_clear(secp256k1_gej *r);
+
+/** Clear a secp256k1_ge to prevent leaking sensitive information. */
+static void secp256k1_ge_clear(secp256k1_ge *r);
+
+/** Convert a group element to the storage type. */
+static void secp256k1_ge_to_storage(secp256k1_ge_storage *r, const secp256k1_ge *a);
+
+/** Convert a group element back from the storage type. */
+static void secp256k1_ge_from_storage(secp256k1_ge *r, const secp256k1_ge_storage *a);
+
+/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time.  Both *r and *a must be initialized.*/
+static void secp256k1_gej_cmov(secp256k1_gej *r, const secp256k1_gej *a, int flag);
+
+/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time.  Both *r and *a must be initialized.*/
+static void secp256k1_ge_storage_cmov(secp256k1_ge_storage *r, const secp256k1_ge_storage *a, int flag);
+
+/** Rescale a jacobian point by b which must be non-zero. Constant-time. */
+static void secp256k1_gej_rescale(secp256k1_gej *r, const secp256k1_fe *b);
+
+/** Convert a group element that is not infinity to a 64-byte array. The output
+ *  array is platform-dependent. */
+static void secp256k1_ge_to_bytes(unsigned char *buf, const secp256k1_ge *a);
+
+/** Convert a 64-byte array into group element. This function assumes that the
+ *  provided buffer correctly encodes a group element. */
+static void secp256k1_ge_from_bytes(secp256k1_ge *r, const unsigned char *buf);
+
+/** Convert a group element (that is allowed to be infinity) to a 64-byte
+ *  array. The output array is platform-dependent. */
+static void secp256k1_ge_to_bytes_ext(unsigned char *data, const secp256k1_ge *ge);
+
+/** Convert a 64-byte array into a group element. This function assumes that the
+ *  provided buffer is the output of secp256k1_ge_to_bytes_ext. */
+static void secp256k1_ge_from_bytes_ext(secp256k1_ge *ge, const unsigned char *data);
+
+/** Determine if a point (which is assumed to be on the curve) is in the correct (sub)group of the curve.
+ *
+ * In normal mode, the used group is secp256k1, which has cofactor=1 meaning that every point on the curve is in the
+ * group, and this function returns always true.
+ *
+ * When compiling in exhaustive test mode, a slightly different curve equation is used, leading to a group with a
+ * (very) small subgroup, and that subgroup is what is used for all cryptographic operations. In that mode, this
+ * function checks whether a point that is on the curve is in fact also in that subgroup.
+ */
+static int secp256k1_ge_is_in_correct_subgroup(const secp256k1_ge* ge);
+
+/** Check invariants on an affine group element (no-op unless VERIFY is enabled). */
+static void secp256k1_ge_verify(const secp256k1_ge *a);
+#define SECP256K1_GE_VERIFY(a) secp256k1_ge_verify(a)
+
+/** Check invariants on a Jacobian group element (no-op unless VERIFY is enabled). */
+static void secp256k1_gej_verify(const secp256k1_gej *a);
+#define SECP256K1_GEJ_VERIFY(a) secp256k1_gej_verify(a)
+
+#endif /* SECP256K1_GROUP_H */
diff --git a/vendor/external/secp256k1/src/group_impl.h b/vendor/external/secp256k1/src/group_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/group_impl.h
@@ -0,0 +1,974 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_GROUP_IMPL_H
+#define SECP256K1_GROUP_IMPL_H
+
+#include <string.h>
+
+#include "field.h"
+#include "group.h"
+#include "util.h"
+
+/* Begin of section generated by sage/gen_exhaustive_groups.sage. */
+#define SECP256K1_G_ORDER_7 SECP256K1_GE_CONST(\
+    0x66625d13, 0x317ffe44, 0x63d32cff, 0x1ca02b9b,\
+    0xe5c6d070, 0x50b4b05e, 0x81cc30db, 0xf5166f0a,\
+    0x1e60e897, 0xa7c00c7c, 0x2df53eb6, 0x98274ff4,\
+    0x64252f42, 0x8ca44e17, 0x3b25418c, 0xff4ab0cf\
+)
+#define SECP256K1_G_ORDER_13 SECP256K1_GE_CONST(\
+    0xa2482ff8, 0x4bf34edf, 0xa51262fd, 0xe57921db,\
+    0xe0dd2cb7, 0xa5914790, 0xbc71631f, 0xc09704fb,\
+    0x942536cb, 0xa3e49492, 0x3a701cc3, 0xee3e443f,\
+    0xdf182aa9, 0x15b8aa6a, 0x166d3b19, 0xba84b045\
+)
+#define SECP256K1_G_ORDER_199 SECP256K1_GE_CONST(\
+    0x7fb07b5c, 0xd07c3bda, 0x553902e2, 0x7a87ea2c,\
+    0x35108a7f, 0x051f41e5, 0xb76abad5, 0x1f2703ad,\
+    0x0a251539, 0x5b4c4438, 0x952a634f, 0xac10dd4d,\
+    0x6d6f4745, 0x98990c27, 0x3a4f3116, 0xd32ff969\
+)
+/** Generator for secp256k1, value 'g' defined in
+ *  "Standards for Efficient Cryptography" (SEC2) 2.7.1.
+ */
+#define SECP256K1_G SECP256K1_GE_CONST(\
+    0x79be667e, 0xf9dcbbac, 0x55a06295, 0xce870b07,\
+    0x029bfcdb, 0x2dce28d9, 0x59f2815b, 0x16f81798,\
+    0x483ada77, 0x26a3c465, 0x5da4fbfc, 0x0e1108a8,\
+    0xfd17b448, 0xa6855419, 0x9c47d08f, 0xfb10d4b8\
+)
+/* These exhaustive group test orders and generators are chosen such that:
+ * - The field size is equal to that of secp256k1, so field code is the same.
+ * - The curve equation is of the form y^2=x^3+B for some small constant B.
+ * - The subgroup has a generator 2*P, where P.x is as small as possible.
+ * - The subgroup has size less than 1000 to permit exhaustive testing.
+ * - The subgroup admits an endomorphism of the form lambda*(x,y) == (beta*x,y).
+ */
+#if defined(EXHAUSTIVE_TEST_ORDER)
+#  if EXHAUSTIVE_TEST_ORDER == 7
+
+static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G_ORDER_7;
+#define SECP256K1_B 6
+
+#  elif EXHAUSTIVE_TEST_ORDER == 13
+
+static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G_ORDER_13;
+#define SECP256K1_B 2
+
+#  elif EXHAUSTIVE_TEST_ORDER == 199
+
+static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G_ORDER_199;
+#define SECP256K1_B 4
+
+#  else
+#    error No known generator for the specified exhaustive test group order.
+#  endif
+#else
+
+static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_G;
+#define SECP256K1_B 7
+
+#endif
+/* End of section generated by sage/gen_exhaustive_groups.sage. */
+
+static void secp256k1_ge_verify(const secp256k1_ge *a) {
+    SECP256K1_FE_VERIFY(&a->x);
+    SECP256K1_FE_VERIFY(&a->y);
+    SECP256K1_FE_VERIFY_MAGNITUDE(&a->x, SECP256K1_GE_X_MAGNITUDE_MAX);
+    SECP256K1_FE_VERIFY_MAGNITUDE(&a->y, SECP256K1_GE_Y_MAGNITUDE_MAX);
+    VERIFY_CHECK(a->infinity == 0 || a->infinity == 1);
+    (void)a;
+}
+
+static void secp256k1_gej_verify(const secp256k1_gej *a) {
+    SECP256K1_FE_VERIFY(&a->x);
+    SECP256K1_FE_VERIFY(&a->y);
+    SECP256K1_FE_VERIFY(&a->z);
+    SECP256K1_FE_VERIFY_MAGNITUDE(&a->x, SECP256K1_GEJ_X_MAGNITUDE_MAX);
+    SECP256K1_FE_VERIFY_MAGNITUDE(&a->y, SECP256K1_GEJ_Y_MAGNITUDE_MAX);
+    SECP256K1_FE_VERIFY_MAGNITUDE(&a->z, SECP256K1_GEJ_Z_MAGNITUDE_MAX);
+    VERIFY_CHECK(a->infinity == 0 || a->infinity == 1);
+    (void)a;
+}
+
+/* Set r to the affine coordinates of Jacobian point (a.x, a.y, 1/zi). */
+static void secp256k1_ge_set_gej_zinv(secp256k1_ge *r, const secp256k1_gej *a, const secp256k1_fe *zi) {
+    secp256k1_fe zi2;
+    secp256k1_fe zi3;
+    SECP256K1_GEJ_VERIFY(a);
+    SECP256K1_FE_VERIFY(zi);
+    VERIFY_CHECK(!a->infinity);
+
+    secp256k1_fe_sqr(&zi2, zi);
+    secp256k1_fe_mul(&zi3, &zi2, zi);
+    secp256k1_fe_mul(&r->x, &a->x, &zi2);
+    secp256k1_fe_mul(&r->y, &a->y, &zi3);
+    r->infinity = a->infinity;
+
+    SECP256K1_GE_VERIFY(r);
+}
+
+/* Set r to the affine coordinates of Jacobian point (a.x, a.y, 1/zi). */
+static void secp256k1_ge_set_ge_zinv(secp256k1_ge *r, const secp256k1_ge *a, const secp256k1_fe *zi) {
+    secp256k1_fe zi2;
+    secp256k1_fe zi3;
+    SECP256K1_GE_VERIFY(a);
+    SECP256K1_FE_VERIFY(zi);
+    VERIFY_CHECK(!a->infinity);
+
+    secp256k1_fe_sqr(&zi2, zi);
+    secp256k1_fe_mul(&zi3, &zi2, zi);
+    secp256k1_fe_mul(&r->x, &a->x, &zi2);
+    secp256k1_fe_mul(&r->y, &a->y, &zi3);
+    r->infinity = a->infinity;
+
+    SECP256K1_GE_VERIFY(r);
+}
+
+static void secp256k1_ge_set_xy(secp256k1_ge *r, const secp256k1_fe *x, const secp256k1_fe *y) {
+    SECP256K1_FE_VERIFY(x);
+    SECP256K1_FE_VERIFY(y);
+
+    r->infinity = 0;
+    r->x = *x;
+    r->y = *y;
+
+    SECP256K1_GE_VERIFY(r);
+}
+
+static int secp256k1_ge_is_infinity(const secp256k1_ge *a) {
+    SECP256K1_GE_VERIFY(a);
+
+    return a->infinity;
+}
+
+static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a) {
+    SECP256K1_GE_VERIFY(a);
+
+    *r = *a;
+    secp256k1_fe_normalize_weak(&r->y);
+    secp256k1_fe_negate(&r->y, &r->y, 1);
+
+    SECP256K1_GE_VERIFY(r);
+}
+
+static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a) {
+    secp256k1_fe z2, z3;
+    SECP256K1_GEJ_VERIFY(a);
+
+    r->infinity = a->infinity;
+    secp256k1_fe_inv(&a->z, &a->z);
+    secp256k1_fe_sqr(&z2, &a->z);
+    secp256k1_fe_mul(&z3, &a->z, &z2);
+    secp256k1_fe_mul(&a->x, &a->x, &z2);
+    secp256k1_fe_mul(&a->y, &a->y, &z3);
+    secp256k1_fe_set_int(&a->z, 1);
+    r->x = a->x;
+    r->y = a->y;
+
+    SECP256K1_GEJ_VERIFY(a);
+    SECP256K1_GE_VERIFY(r);
+}
+
+static void secp256k1_ge_set_gej_var(secp256k1_ge *r, secp256k1_gej *a) {
+    secp256k1_fe z2, z3;
+    SECP256K1_GEJ_VERIFY(a);
+
+    if (secp256k1_gej_is_infinity(a)) {
+        secp256k1_ge_set_infinity(r);
+        return;
+    }
+    r->infinity = 0;
+    secp256k1_fe_inv_var(&a->z, &a->z);
+    secp256k1_fe_sqr(&z2, &a->z);
+    secp256k1_fe_mul(&z3, &a->z, &z2);
+    secp256k1_fe_mul(&a->x, &a->x, &z2);
+    secp256k1_fe_mul(&a->y, &a->y, &z3);
+    secp256k1_fe_set_int(&a->z, 1);
+    secp256k1_ge_set_xy(r, &a->x, &a->y);
+
+    SECP256K1_GEJ_VERIFY(a);
+    SECP256K1_GE_VERIFY(r);
+}
+
+static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a, size_t len) {
+    secp256k1_fe u;
+    size_t i;
+    size_t last_i = SIZE_MAX;
+#ifdef VERIFY
+    for (i = 0; i < len; i++) {
+        SECP256K1_GEJ_VERIFY(&a[i]);
+    }
+#endif
+
+    for (i = 0; i < len; i++) {
+        if (a[i].infinity) {
+            secp256k1_ge_set_infinity(&r[i]);
+        } else {
+            /* Use destination's x coordinates as scratch space */
+            if (last_i == SIZE_MAX) {
+                r[i].x = a[i].z;
+            } else {
+                secp256k1_fe_mul(&r[i].x, &r[last_i].x, &a[i].z);
+            }
+            last_i = i;
+        }
+    }
+    if (last_i == SIZE_MAX) {
+        return;
+    }
+    secp256k1_fe_inv_var(&u, &r[last_i].x);
+
+    i = last_i;
+    while (i > 0) {
+        i--;
+        if (!a[i].infinity) {
+            secp256k1_fe_mul(&r[last_i].x, &r[i].x, &u);
+            secp256k1_fe_mul(&u, &u, &a[last_i].z);
+            last_i = i;
+        }
+    }
+    VERIFY_CHECK(!a[last_i].infinity);
+    r[last_i].x = u;
+
+    for (i = 0; i < len; i++) {
+        if (!a[i].infinity) {
+            secp256k1_ge_set_gej_zinv(&r[i], &a[i], &r[i].x);
+        }
+    }
+
+#ifdef VERIFY
+    for (i = 0; i < len; i++) {
+        SECP256K1_GE_VERIFY(&r[i]);
+    }
+#endif
+}
+
+static void secp256k1_ge_table_set_globalz(size_t len, secp256k1_ge *a, const secp256k1_fe *zr) {
+    size_t i;
+    secp256k1_fe zs;
+#ifdef VERIFY
+    for (i = 0; i < len; i++) {
+        SECP256K1_GE_VERIFY(&a[i]);
+        SECP256K1_FE_VERIFY(&zr[i]);
+    }
+#endif
+
+    if (len > 0) {
+        i = len - 1;
+        /* Ensure all y values are in weak normal form for fast negation of points */
+        secp256k1_fe_normalize_weak(&a[i].y);
+        zs = zr[i];
+
+        /* Work our way backwards, using the z-ratios to scale the x/y values. */
+        while (i > 0) {
+            if (i != len - 1) {
+                secp256k1_fe_mul(&zs, &zs, &zr[i]);
+            }
+            i--;
+            secp256k1_ge_set_ge_zinv(&a[i], &a[i], &zs);
+        }
+    }
+
+#ifdef VERIFY
+    for (i = 0; i < len; i++) {
+        SECP256K1_GE_VERIFY(&a[i]);
+    }
+#endif
+}
+
+static void secp256k1_gej_set_infinity(secp256k1_gej *r) {
+    r->infinity = 1;
+    secp256k1_fe_set_int(&r->x, 0);
+    secp256k1_fe_set_int(&r->y, 0);
+    secp256k1_fe_set_int(&r->z, 0);
+
+    SECP256K1_GEJ_VERIFY(r);
+}
+
+static void secp256k1_ge_set_infinity(secp256k1_ge *r) {
+    r->infinity = 1;
+    secp256k1_fe_set_int(&r->x, 0);
+    secp256k1_fe_set_int(&r->y, 0);
+
+    SECP256K1_GE_VERIFY(r);
+}
+
+static void secp256k1_gej_clear(secp256k1_gej *r) {
+    secp256k1_memclear(r, sizeof(secp256k1_gej));
+}
+
+static void secp256k1_ge_clear(secp256k1_ge *r) {
+    secp256k1_memclear(r, sizeof(secp256k1_ge));
+}
+
+static int secp256k1_ge_set_xo_var(secp256k1_ge *r, const secp256k1_fe *x, int odd) {
+    secp256k1_fe x2, x3;
+    int ret;
+    SECP256K1_FE_VERIFY(x);
+
+    r->x = *x;
+    secp256k1_fe_sqr(&x2, x);
+    secp256k1_fe_mul(&x3, x, &x2);
+    r->infinity = 0;
+    secp256k1_fe_add_int(&x3, SECP256K1_B);
+    ret = secp256k1_fe_sqrt(&r->y, &x3);
+    secp256k1_fe_normalize_var(&r->y);
+    if (secp256k1_fe_is_odd(&r->y) != odd) {
+        secp256k1_fe_negate(&r->y, &r->y, 1);
+    }
+
+    SECP256K1_GE_VERIFY(r);
+    return ret;
+}
+
+static void secp256k1_gej_set_ge(secp256k1_gej *r, const secp256k1_ge *a) {
+   SECP256K1_GE_VERIFY(a);
+
+   r->infinity = a->infinity;
+   r->x = a->x;
+   r->y = a->y;
+   secp256k1_fe_set_int(&r->z, 1);
+
+   SECP256K1_GEJ_VERIFY(r);
+}
+
+static int secp256k1_gej_eq_var(const secp256k1_gej *a, const secp256k1_gej *b) {
+    secp256k1_gej tmp;
+    SECP256K1_GEJ_VERIFY(b);
+    SECP256K1_GEJ_VERIFY(a);
+
+    secp256k1_gej_neg(&tmp, a);
+    secp256k1_gej_add_var(&tmp, &tmp, b, NULL);
+    return secp256k1_gej_is_infinity(&tmp);
+}
+
+static int secp256k1_gej_eq_ge_var(const secp256k1_gej *a, const secp256k1_ge *b) {
+    secp256k1_gej tmp;
+    SECP256K1_GEJ_VERIFY(a);
+    SECP256K1_GE_VERIFY(b);
+
+    secp256k1_gej_neg(&tmp, a);
+    secp256k1_gej_add_ge_var(&tmp, &tmp, b, NULL);
+    return secp256k1_gej_is_infinity(&tmp);
+}
+
+static int secp256k1_ge_eq_var(const secp256k1_ge *a, const secp256k1_ge *b) {
+    secp256k1_fe tmp;
+    SECP256K1_GE_VERIFY(a);
+    SECP256K1_GE_VERIFY(b);
+
+    if (a->infinity != b->infinity) return 0;
+    if (a->infinity) return 1;
+
+    tmp = a->x;
+    secp256k1_fe_normalize_weak(&tmp);
+    if (!secp256k1_fe_equal(&tmp, &b->x)) return 0;
+
+    tmp = a->y;
+    secp256k1_fe_normalize_weak(&tmp);
+    if (!secp256k1_fe_equal(&tmp, &b->y)) return 0;
+
+    return 1;
+}
+
+static int secp256k1_gej_eq_x_var(const secp256k1_fe *x, const secp256k1_gej *a) {
+    secp256k1_fe r;
+    SECP256K1_FE_VERIFY(x);
+    SECP256K1_GEJ_VERIFY(a);
+    VERIFY_CHECK(!a->infinity);
+
+    secp256k1_fe_sqr(&r, &a->z); secp256k1_fe_mul(&r, &r, x);
+    return secp256k1_fe_equal(&r, &a->x);
+}
+
+static void secp256k1_gej_neg(secp256k1_gej *r, const secp256k1_gej *a) {
+    SECP256K1_GEJ_VERIFY(a);
+
+    r->infinity = a->infinity;
+    r->x = a->x;
+    r->y = a->y;
+    r->z = a->z;
+    secp256k1_fe_normalize_weak(&r->y);
+    secp256k1_fe_negate(&r->y, &r->y, 1);
+
+    SECP256K1_GEJ_VERIFY(r);
+}
+
+static int secp256k1_gej_is_infinity(const secp256k1_gej *a) {
+    SECP256K1_GEJ_VERIFY(a);
+
+    return a->infinity;
+}
+
+static int secp256k1_ge_is_valid_var(const secp256k1_ge *a) {
+    secp256k1_fe y2, x3;
+    SECP256K1_GE_VERIFY(a);
+
+    if (a->infinity) {
+        return 0;
+    }
+    /* y^2 = x^3 + 7 */
+    secp256k1_fe_sqr(&y2, &a->y);
+    secp256k1_fe_sqr(&x3, &a->x); secp256k1_fe_mul(&x3, &x3, &a->x);
+    secp256k1_fe_add_int(&x3, SECP256K1_B);
+    return secp256k1_fe_equal(&y2, &x3);
+}
+
+static SECP256K1_INLINE void secp256k1_gej_double(secp256k1_gej *r, const secp256k1_gej *a) {
+    /* Operations: 3 mul, 4 sqr, 8 add/half/mul_int/negate */
+    secp256k1_fe l, s, t;
+    SECP256K1_GEJ_VERIFY(a);
+
+    r->infinity = a->infinity;
+
+    /* Formula used:
+     * L = (3/2) * X1^2
+     * S = Y1^2
+     * T = -X1*S
+     * X3 = L^2 + 2*T
+     * Y3 = -(L*(X3 + T) + S^2)
+     * Z3 = Y1*Z1
+     */
+
+    secp256k1_fe_mul(&r->z, &a->z, &a->y); /* Z3 = Y1*Z1 (1) */
+    secp256k1_fe_sqr(&s, &a->y);           /* S = Y1^2 (1) */
+    secp256k1_fe_sqr(&l, &a->x);           /* L = X1^2 (1) */
+    secp256k1_fe_mul_int(&l, 3);           /* L = 3*X1^2 (3) */
+    secp256k1_fe_half(&l);                 /* L = 3/2*X1^2 (2) */
+    secp256k1_fe_negate(&t, &s, 1);        /* T = -S (2) */
+    secp256k1_fe_mul(&t, &t, &a->x);       /* T = -X1*S (1) */
+    secp256k1_fe_sqr(&r->x, &l);           /* X3 = L^2 (1) */
+    secp256k1_fe_add(&r->x, &t);           /* X3 = L^2 + T (2) */
+    secp256k1_fe_add(&r->x, &t);           /* X3 = L^2 + 2*T (3) */
+    secp256k1_fe_sqr(&s, &s);              /* S' = S^2 (1) */
+    secp256k1_fe_add(&t, &r->x);           /* T' = X3 + T (4) */
+    secp256k1_fe_mul(&r->y, &t, &l);       /* Y3 = L*(X3 + T) (1) */
+    secp256k1_fe_add(&r->y, &s);           /* Y3 = L*(X3 + T) + S^2 (2) */
+    secp256k1_fe_negate(&r->y, &r->y, 2);  /* Y3 = -(L*(X3 + T) + S^2) (3) */
+
+    SECP256K1_GEJ_VERIFY(r);
+}
+
+static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr) {
+    SECP256K1_GEJ_VERIFY(a);
+
+    /** For secp256k1, 2Q is infinity if and only if Q is infinity. This is because if 2Q = infinity,
+     *  Q must equal -Q, or that Q.y == -(Q.y), or Q.y is 0. For a point on y^2 = x^3 + 7 to have
+     *  y=0, x^3 must be -7 mod p. However, -7 has no cube root mod p.
+     *
+     *  Having said this, if this function receives a point on a sextic twist, e.g. by
+     *  a fault attack, it is possible for y to be 0. This happens for y^2 = x^3 + 6,
+     *  since -6 does have a cube root mod p. For this point, this function will not set
+     *  the infinity flag even though the point doubles to infinity, and the result
+     *  point will be gibberish (z = 0 but infinity = 0).
+     */
+    if (a->infinity) {
+        secp256k1_gej_set_infinity(r);
+        if (rzr != NULL) {
+            secp256k1_fe_set_int(rzr, 1);
+        }
+        return;
+    }
+
+    if (rzr != NULL) {
+        *rzr = a->y;
+        secp256k1_fe_normalize_weak(rzr);
+    }
+
+    secp256k1_gej_double(r, a);
+
+    SECP256K1_GEJ_VERIFY(r);
+}
+
+static void secp256k1_gej_add_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_gej *b, secp256k1_fe *rzr) {
+    /* 12 mul, 4 sqr, 11 add/negate/normalizes_to_zero (ignoring special cases) */
+    secp256k1_fe z22, z12, u1, u2, s1, s2, h, i, h2, h3, t;
+    SECP256K1_GEJ_VERIFY(a);
+    SECP256K1_GEJ_VERIFY(b);
+
+    if (a->infinity) {
+        VERIFY_CHECK(rzr == NULL);
+        *r = *b;
+        return;
+    }
+    if (b->infinity) {
+        if (rzr != NULL) {
+            secp256k1_fe_set_int(rzr, 1);
+        }
+        *r = *a;
+        return;
+    }
+
+    secp256k1_fe_sqr(&z22, &b->z);
+    secp256k1_fe_sqr(&z12, &a->z);
+    secp256k1_fe_mul(&u1, &a->x, &z22);
+    secp256k1_fe_mul(&u2, &b->x, &z12);
+    secp256k1_fe_mul(&s1, &a->y, &z22); secp256k1_fe_mul(&s1, &s1, &b->z);
+    secp256k1_fe_mul(&s2, &b->y, &z12); secp256k1_fe_mul(&s2, &s2, &a->z);
+    secp256k1_fe_negate(&h, &u1, 1); secp256k1_fe_add(&h, &u2);
+    secp256k1_fe_negate(&i, &s2, 1); secp256k1_fe_add(&i, &s1);
+    if (secp256k1_fe_normalizes_to_zero_var(&h)) {
+        if (secp256k1_fe_normalizes_to_zero_var(&i)) {
+            secp256k1_gej_double_var(r, a, rzr);
+        } else {
+            if (rzr != NULL) {
+                secp256k1_fe_set_int(rzr, 0);
+            }
+            secp256k1_gej_set_infinity(r);
+        }
+        return;
+    }
+
+    r->infinity = 0;
+    secp256k1_fe_mul(&t, &h, &b->z);
+    if (rzr != NULL) {
+        *rzr = t;
+    }
+    secp256k1_fe_mul(&r->z, &a->z, &t);
+
+    secp256k1_fe_sqr(&h2, &h);
+    secp256k1_fe_negate(&h2, &h2, 1);
+    secp256k1_fe_mul(&h3, &h2, &h);
+    secp256k1_fe_mul(&t, &u1, &h2);
+
+    secp256k1_fe_sqr(&r->x, &i);
+    secp256k1_fe_add(&r->x, &h3);
+    secp256k1_fe_add(&r->x, &t);
+    secp256k1_fe_add(&r->x, &t);
+
+    secp256k1_fe_add(&t, &r->x);
+    secp256k1_fe_mul(&r->y, &t, &i);
+    secp256k1_fe_mul(&h3, &h3, &s1);
+    secp256k1_fe_add(&r->y, &h3);
+
+    SECP256K1_GEJ_VERIFY(r);
+}
+
+static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr) {
+    /* Operations: 8 mul, 3 sqr, 11 add/negate/normalizes_to_zero (ignoring special cases) */
+    secp256k1_fe z12, u1, u2, s1, s2, h, i, h2, h3, t;
+    SECP256K1_GEJ_VERIFY(a);
+    SECP256K1_GE_VERIFY(b);
+
+    if (a->infinity) {
+        VERIFY_CHECK(rzr == NULL);
+        secp256k1_gej_set_ge(r, b);
+        return;
+    }
+    if (b->infinity) {
+        if (rzr != NULL) {
+            secp256k1_fe_set_int(rzr, 1);
+        }
+        *r = *a;
+        return;
+    }
+
+    secp256k1_fe_sqr(&z12, &a->z);
+    u1 = a->x;
+    secp256k1_fe_mul(&u2, &b->x, &z12);
+    s1 = a->y;
+    secp256k1_fe_mul(&s2, &b->y, &z12); secp256k1_fe_mul(&s2, &s2, &a->z);
+    secp256k1_fe_negate(&h, &u1, SECP256K1_GEJ_X_MAGNITUDE_MAX); secp256k1_fe_add(&h, &u2);
+    secp256k1_fe_negate(&i, &s2, 1); secp256k1_fe_add(&i, &s1);
+    if (secp256k1_fe_normalizes_to_zero_var(&h)) {
+        if (secp256k1_fe_normalizes_to_zero_var(&i)) {
+            secp256k1_gej_double_var(r, a, rzr);
+        } else {
+            if (rzr != NULL) {
+                secp256k1_fe_set_int(rzr, 0);
+            }
+            secp256k1_gej_set_infinity(r);
+        }
+        return;
+    }
+
+    r->infinity = 0;
+    if (rzr != NULL) {
+        *rzr = h;
+    }
+    secp256k1_fe_mul(&r->z, &a->z, &h);
+
+    secp256k1_fe_sqr(&h2, &h);
+    secp256k1_fe_negate(&h2, &h2, 1);
+    secp256k1_fe_mul(&h3, &h2, &h);
+    secp256k1_fe_mul(&t, &u1, &h2);
+
+    secp256k1_fe_sqr(&r->x, &i);
+    secp256k1_fe_add(&r->x, &h3);
+    secp256k1_fe_add(&r->x, &t);
+    secp256k1_fe_add(&r->x, &t);
+
+    secp256k1_fe_add(&t, &r->x);
+    secp256k1_fe_mul(&r->y, &t, &i);
+    secp256k1_fe_mul(&h3, &h3, &s1);
+    secp256k1_fe_add(&r->y, &h3);
+
+    SECP256K1_GEJ_VERIFY(r);
+    if (rzr != NULL) SECP256K1_FE_VERIFY(rzr);
+}
+
+static void secp256k1_gej_add_zinv_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, const secp256k1_fe *bzinv) {
+    /* Operations: 9 mul, 3 sqr, 11 add/negate/normalizes_to_zero (ignoring special cases) */
+    secp256k1_fe az, z12, u1, u2, s1, s2, h, i, h2, h3, t;
+    SECP256K1_GEJ_VERIFY(a);
+    SECP256K1_GE_VERIFY(b);
+    SECP256K1_FE_VERIFY(bzinv);
+
+    if (a->infinity) {
+        secp256k1_fe bzinv2, bzinv3;
+        r->infinity = b->infinity;
+        secp256k1_fe_sqr(&bzinv2, bzinv);
+        secp256k1_fe_mul(&bzinv3, &bzinv2, bzinv);
+        secp256k1_fe_mul(&r->x, &b->x, &bzinv2);
+        secp256k1_fe_mul(&r->y, &b->y, &bzinv3);
+        secp256k1_fe_set_int(&r->z, 1);
+        SECP256K1_GEJ_VERIFY(r);
+        return;
+    }
+    if (b->infinity) {
+        *r = *a;
+        return;
+    }
+
+    /** We need to calculate (rx,ry,rz) = (ax,ay,az) + (bx,by,1/bzinv). Due to
+     *  secp256k1's isomorphism we can multiply the Z coordinates on both sides
+     *  by bzinv, and get: (rx,ry,rz*bzinv) = (ax,ay,az*bzinv) + (bx,by,1).
+     *  This means that (rx,ry,rz) can be calculated as
+     *  (ax,ay,az*bzinv) + (bx,by,1), when not applying the bzinv factor to rz.
+     *  The variable az below holds the modified Z coordinate for a, which is used
+     *  for the computation of rx and ry, but not for rz.
+     */
+    secp256k1_fe_mul(&az, &a->z, bzinv);
+
+    secp256k1_fe_sqr(&z12, &az);
+    u1 = a->x;
+    secp256k1_fe_mul(&u2, &b->x, &z12);
+    s1 = a->y;
+    secp256k1_fe_mul(&s2, &b->y, &z12); secp256k1_fe_mul(&s2, &s2, &az);
+    secp256k1_fe_negate(&h, &u1, SECP256K1_GEJ_X_MAGNITUDE_MAX); secp256k1_fe_add(&h, &u2);
+    secp256k1_fe_negate(&i, &s2, 1); secp256k1_fe_add(&i, &s1);
+    if (secp256k1_fe_normalizes_to_zero_var(&h)) {
+        if (secp256k1_fe_normalizes_to_zero_var(&i)) {
+            secp256k1_gej_double_var(r, a, NULL);
+        } else {
+            secp256k1_gej_set_infinity(r);
+        }
+        return;
+    }
+
+    r->infinity = 0;
+    secp256k1_fe_mul(&r->z, &a->z, &h);
+
+    secp256k1_fe_sqr(&h2, &h);
+    secp256k1_fe_negate(&h2, &h2, 1);
+    secp256k1_fe_mul(&h3, &h2, &h);
+    secp256k1_fe_mul(&t, &u1, &h2);
+
+    secp256k1_fe_sqr(&r->x, &i);
+    secp256k1_fe_add(&r->x, &h3);
+    secp256k1_fe_add(&r->x, &t);
+    secp256k1_fe_add(&r->x, &t);
+
+    secp256k1_fe_add(&t, &r->x);
+    secp256k1_fe_mul(&r->y, &t, &i);
+    secp256k1_fe_mul(&h3, &h3, &s1);
+    secp256k1_fe_add(&r->y, &h3);
+
+    SECP256K1_GEJ_VERIFY(r);
+}
+
+
+static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b) {
+    /* Operations: 7 mul, 5 sqr, 21 add/cmov/half/mul_int/negate/normalizes_to_zero */
+    secp256k1_fe zz, u1, u2, s1, s2, t, tt, m, n, q, rr;
+    secp256k1_fe m_alt, rr_alt;
+    int degenerate;
+    SECP256K1_GEJ_VERIFY(a);
+    SECP256K1_GE_VERIFY(b);
+    VERIFY_CHECK(!b->infinity);
+
+    /*  In:
+     *    Eric Brier and Marc Joye, Weierstrass Elliptic Curves and Side-Channel Attacks.
+     *    In D. Naccache and P. Paillier, Eds., Public Key Cryptography, vol. 2274 of Lecture Notes in Computer Science, pages 335-345. Springer-Verlag, 2002.
+     *  we find as solution for a unified addition/doubling formula:
+     *    lambda = ((x1 + x2)^2 - x1 * x2 + a) / (y1 + y2), with a = 0 for secp256k1's curve equation.
+     *    x3 = lambda^2 - (x1 + x2)
+     *    2*y3 = lambda * (x1 + x2 - 2 * x3) - (y1 + y2).
+     *
+     *  Substituting x_i = Xi / Zi^2 and yi = Yi / Zi^3, for i=1,2,3, gives:
+     *    U1 = X1*Z2^2, U2 = X2*Z1^2
+     *    S1 = Y1*Z2^3, S2 = Y2*Z1^3
+     *    Z = Z1*Z2
+     *    T = U1+U2
+     *    M = S1+S2
+     *    Q = -T*M^2
+     *    R = T^2-U1*U2
+     *    X3 = R^2+Q
+     *    Y3 = -(R*(2*X3+Q)+M^4)/2
+     *    Z3 = M*Z
+     *  (Note that the paper uses xi = Xi / Zi and yi = Yi / Zi instead.)
+     *
+     *  This formula has the benefit of being the same for both addition
+     *  of distinct points and doubling. However, it breaks down in the
+     *  case that either point is infinity, or that y1 = -y2. We handle
+     *  these cases in the following ways:
+     *
+     *    - If b is infinity we simply bail by means of a VERIFY_CHECK.
+     *
+     *    - If a is infinity, we detect this, and at the end of the
+     *      computation replace the result (which will be meaningless,
+     *      but we compute to be constant-time) with b.x : b.y : 1.
+     *
+     *    - If a = -b, we have y1 = -y2, which is a degenerate case.
+     *      But here the answer is infinity, so we simply set the
+     *      infinity flag of the result, overriding the computed values
+     *      without even needing to cmov.
+     *
+     *    - If y1 = -y2 but x1 != x2, which does occur thanks to certain
+     *      properties of our curve (specifically, 1 has nontrivial cube
+     *      roots in our field, and the curve equation has no x coefficient)
+     *      then the answer is not infinity but also not given by the above
+     *      equation. In this case, we cmov in place an alternate expression
+     *      for lambda. Specifically (y1 - y2)/(x1 - x2). Where both these
+     *      expressions for lambda are defined, they are equal, and can be
+     *      obtained from each other by multiplication by (y1 + y2)/(y1 + y2)
+     *      then substitution of x^3 + 7 for y^2 (using the curve equation).
+     *      For all pairs of nonzero points (a, b) at least one is defined,
+     *      so this covers everything.
+     */
+
+    secp256k1_fe_sqr(&zz, &a->z);                       /* z = Z1^2 */
+    u1 = a->x;                                          /* u1 = U1 = X1*Z2^2 (GEJ_X_M) */
+    secp256k1_fe_mul(&u2, &b->x, &zz);                  /* u2 = U2 = X2*Z1^2 (1) */
+    s1 = a->y;                                          /* s1 = S1 = Y1*Z2^3 (GEJ_Y_M) */
+    secp256k1_fe_mul(&s2, &b->y, &zz);                  /* s2 = Y2*Z1^2 (1) */
+    secp256k1_fe_mul(&s2, &s2, &a->z);                  /* s2 = S2 = Y2*Z1^3 (1) */
+    t = u1; secp256k1_fe_add(&t, &u2);                  /* t = T = U1+U2 (GEJ_X_M+1) */
+    m = s1; secp256k1_fe_add(&m, &s2);                  /* m = M = S1+S2 (GEJ_Y_M+1) */
+    secp256k1_fe_sqr(&rr, &t);                          /* rr = T^2 (1) */
+    secp256k1_fe_negate(&m_alt, &u2, 1);                /* Malt = -X2*Z1^2 (2) */
+    secp256k1_fe_mul(&tt, &u1, &m_alt);                 /* tt = -U1*U2 (1) */
+    secp256k1_fe_add(&rr, &tt);                         /* rr = R = T^2-U1*U2 (2) */
+    /* If lambda = R/M = R/0 we have a problem (except in the "trivial"
+     * case that Z = z1z2 = 0, and this is special-cased later on). */
+    degenerate = secp256k1_fe_normalizes_to_zero(&m);
+    /* This only occurs when y1 == -y2 and x1^3 == x2^3, but x1 != x2.
+     * This means either x1 == beta*x2 or beta*x1 == x2, where beta is
+     * a nontrivial cube root of one. In either case, an alternate
+     * non-indeterminate expression for lambda is (y1 - y2)/(x1 - x2),
+     * so we set R/M equal to this. */
+    rr_alt = s1;
+    secp256k1_fe_mul_int(&rr_alt, 2);       /* rr_alt = Y1*Z2^3 - Y2*Z1^3 (GEJ_Y_M*2) */
+    secp256k1_fe_add(&m_alt, &u1);          /* Malt = X1*Z2^2 - X2*Z1^2 (GEJ_X_M+2) */
+
+    secp256k1_fe_cmov(&rr_alt, &rr, !degenerate);       /* rr_alt (GEJ_Y_M*2) */
+    secp256k1_fe_cmov(&m_alt, &m, !degenerate);         /* m_alt (GEJ_X_M+2) */
+    /* Now Ralt / Malt = lambda and is guaranteed not to be Ralt / 0.
+     * From here on out Ralt and Malt represent the numerator
+     * and denominator of lambda; R and M represent the explicit
+     * expressions x1^2 + x2^2 + x1x2 and y1 + y2. */
+    secp256k1_fe_sqr(&n, &m_alt);                       /* n = Malt^2 (1) */
+    secp256k1_fe_negate(&q, &t,
+        SECP256K1_GEJ_X_MAGNITUDE_MAX + 1);             /* q = -T (GEJ_X_M+2) */
+    secp256k1_fe_mul(&q, &q, &n);                       /* q = Q = -T*Malt^2 (1) */
+    /* These two lines use the observation that either M == Malt or M == 0,
+     * so M^3 * Malt is either Malt^4 (which is computed by squaring), or
+     * zero (which is "computed" by cmov). So the cost is one squaring
+     * versus two multiplications. */
+    secp256k1_fe_sqr(&n, &n);                           /* n = Malt^4 (1) */
+    secp256k1_fe_cmov(&n, &m, degenerate);              /* n = M^3 * Malt (GEJ_Y_M+1) */
+    secp256k1_fe_sqr(&t, &rr_alt);                      /* t = Ralt^2 (1) */
+    secp256k1_fe_mul(&r->z, &a->z, &m_alt);             /* r->z = Z3 = Malt*Z (1) */
+    secp256k1_fe_add(&t, &q);                           /* t = Ralt^2 + Q (2) */
+    r->x = t;                                           /* r->x = X3 = Ralt^2 + Q (2) */
+    secp256k1_fe_mul_int(&t, 2);                        /* t = 2*X3 (4) */
+    secp256k1_fe_add(&t, &q);                           /* t = 2*X3 + Q (5) */
+    secp256k1_fe_mul(&t, &t, &rr_alt);                  /* t = Ralt*(2*X3 + Q) (1) */
+    secp256k1_fe_add(&t, &n);                           /* t = Ralt*(2*X3 + Q) + M^3*Malt (GEJ_Y_M+2) */
+    secp256k1_fe_negate(&r->y, &t,
+        SECP256K1_GEJ_Y_MAGNITUDE_MAX + 2);             /* r->y = -(Ralt*(2*X3 + Q) + M^3*Malt) (GEJ_Y_M+3) */
+    secp256k1_fe_half(&r->y);                           /* r->y = Y3 = -(Ralt*(2*X3 + Q) + M^3*Malt)/2 ((GEJ_Y_M+3)/2 + 1) */
+
+    /* In case a->infinity == 1, replace r with (b->x, b->y, 1). */
+    secp256k1_fe_cmov(&r->x, &b->x, a->infinity);
+    secp256k1_fe_cmov(&r->y, &b->y, a->infinity);
+    secp256k1_fe_cmov(&r->z, &secp256k1_fe_one, a->infinity);
+
+    /* Set r->infinity if r->z is 0.
+     *
+     * If a->infinity is set, then r->infinity = (r->z == 0) = (1 == 0) = false,
+     * which is correct because the function assumes that b is not infinity.
+     *
+     * Now assume !a->infinity. This implies Z = Z1 != 0.
+     *
+     * Case y1 = -y2:
+     * In this case we could have a = -b, namely if x1 = x2.
+     * We have degenerate = true, r->z = (x1 - x2) * Z.
+     * Then r->infinity = ((x1 - x2)Z == 0) = (x1 == x2) = (a == -b).
+     *
+     * Case y1 != -y2:
+     * In this case, we can't have a = -b.
+     * We have degenerate = false, r->z = (y1 + y2) * Z.
+     * Then r->infinity = ((y1 + y2)Z == 0) = (y1 == -y2) = false. */
+    r->infinity = secp256k1_fe_normalizes_to_zero(&r->z);
+
+    SECP256K1_GEJ_VERIFY(r);
+}
+
+static void secp256k1_gej_rescale(secp256k1_gej *r, const secp256k1_fe *s) {
+    /* Operations: 4 mul, 1 sqr */
+    secp256k1_fe zz;
+    SECP256K1_GEJ_VERIFY(r);
+    SECP256K1_FE_VERIFY(s);
+    VERIFY_CHECK(!secp256k1_fe_normalizes_to_zero_var(s));
+
+    secp256k1_fe_sqr(&zz, s);
+    secp256k1_fe_mul(&r->x, &r->x, &zz);                /* r->x *= s^2 */
+    secp256k1_fe_mul(&r->y, &r->y, &zz);
+    secp256k1_fe_mul(&r->y, &r->y, s);                  /* r->y *= s^3 */
+    secp256k1_fe_mul(&r->z, &r->z, s);                  /* r->z *= s   */
+
+    SECP256K1_GEJ_VERIFY(r);
+}
+
+static void secp256k1_ge_to_storage(secp256k1_ge_storage *r, const secp256k1_ge *a) {
+    secp256k1_fe x, y;
+    SECP256K1_GE_VERIFY(a);
+    VERIFY_CHECK(!a->infinity);
+
+    x = a->x;
+    secp256k1_fe_normalize(&x);
+    y = a->y;
+    secp256k1_fe_normalize(&y);
+    secp256k1_fe_to_storage(&r->x, &x);
+    secp256k1_fe_to_storage(&r->y, &y);
+}
+
+static void secp256k1_ge_from_storage(secp256k1_ge *r, const secp256k1_ge_storage *a) {
+    secp256k1_fe_from_storage(&r->x, &a->x);
+    secp256k1_fe_from_storage(&r->y, &a->y);
+    r->infinity = 0;
+
+    SECP256K1_GE_VERIFY(r);
+}
+
+static SECP256K1_INLINE void secp256k1_gej_cmov(secp256k1_gej *r, const secp256k1_gej *a, int flag) {
+    SECP256K1_GEJ_VERIFY(r);
+    SECP256K1_GEJ_VERIFY(a);
+
+    secp256k1_fe_cmov(&r->x, &a->x, flag);
+    secp256k1_fe_cmov(&r->y, &a->y, flag);
+    secp256k1_fe_cmov(&r->z, &a->z, flag);
+    r->infinity ^= (r->infinity ^ a->infinity) & flag;
+
+    SECP256K1_GEJ_VERIFY(r);
+}
+
+static SECP256K1_INLINE void secp256k1_ge_storage_cmov(secp256k1_ge_storage *r, const secp256k1_ge_storage *a, int flag) {
+    secp256k1_fe_storage_cmov(&r->x, &a->x, flag);
+    secp256k1_fe_storage_cmov(&r->y, &a->y, flag);
+}
+
+static void secp256k1_ge_mul_lambda(secp256k1_ge *r, const secp256k1_ge *a) {
+    SECP256K1_GE_VERIFY(a);
+
+    *r = *a;
+    secp256k1_fe_mul(&r->x, &r->x, &secp256k1_const_beta);
+
+    SECP256K1_GE_VERIFY(r);
+}
+
+static int secp256k1_ge_is_in_correct_subgroup(const secp256k1_ge* ge) {
+#ifdef EXHAUSTIVE_TEST_ORDER
+    secp256k1_gej out;
+    int i;
+    SECP256K1_GE_VERIFY(ge);
+
+    /* A very simple EC multiplication ladder that avoids a dependency on ecmult. */
+    secp256k1_gej_set_infinity(&out);
+    for (i = 0; i < 32; ++i) {
+        secp256k1_gej_double_var(&out, &out, NULL);
+        if ((((uint32_t)EXHAUSTIVE_TEST_ORDER) >> (31 - i)) & 1) {
+            secp256k1_gej_add_ge_var(&out, &out, ge, NULL);
+        }
+    }
+    return secp256k1_gej_is_infinity(&out);
+#else
+    SECP256K1_GE_VERIFY(ge);
+
+    (void)ge;
+    /* The real secp256k1 group has cofactor 1, so the subgroup is the entire curve. */
+    return 1;
+#endif
+}
+
+static int secp256k1_ge_x_on_curve_var(const secp256k1_fe *x) {
+    secp256k1_fe c;
+    secp256k1_fe_sqr(&c, x);
+    secp256k1_fe_mul(&c, &c, x);
+    secp256k1_fe_add_int(&c, SECP256K1_B);
+    return secp256k1_fe_is_square_var(&c);
+}
+
+static int secp256k1_ge_x_frac_on_curve_var(const secp256k1_fe *xn, const secp256k1_fe *xd) {
+    /* We want to determine whether (xn/xd) is on the curve.
+     *
+     * (xn/xd)^3 + 7 is square <=> xd*xn^3 + 7*xd^4 is square (multiplying by xd^4, a square).
+     */
+     secp256k1_fe r, t;
+     VERIFY_CHECK(!secp256k1_fe_normalizes_to_zero_var(xd));
+
+     secp256k1_fe_mul(&r, xd, xn); /* r = xd*xn */
+     secp256k1_fe_sqr(&t, xn); /* t = xn^2 */
+     secp256k1_fe_mul(&r, &r, &t); /* r = xd*xn^3 */
+     secp256k1_fe_sqr(&t, xd); /* t = xd^2 */
+     secp256k1_fe_sqr(&t, &t); /* t = xd^4 */
+     VERIFY_CHECK(SECP256K1_B <= 31);
+     secp256k1_fe_mul_int(&t, SECP256K1_B); /* t = 7*xd^4 */
+     secp256k1_fe_add(&r, &t); /* r = xd*xn^3 + 7*xd^4 */
+     return secp256k1_fe_is_square_var(&r);
+}
+
+static void secp256k1_ge_to_bytes(unsigned char *buf, const secp256k1_ge *a) {
+    secp256k1_ge_storage s;
+
+    /* We require that the secp256k1_ge_storage type is exactly 64 bytes.
+     * This is formally not guaranteed by the C standard, but should hold on any
+     * sane compiler in the real world. */
+    STATIC_ASSERT(sizeof(secp256k1_ge_storage) == 64);
+    VERIFY_CHECK(!secp256k1_ge_is_infinity(a));
+    secp256k1_ge_to_storage(&s, a);
+    memcpy(buf, &s, 64);
+}
+
+static void secp256k1_ge_from_bytes(secp256k1_ge *r, const unsigned char *buf) {
+    secp256k1_ge_storage s;
+
+    STATIC_ASSERT(sizeof(secp256k1_ge_storage) == 64);
+    memcpy(&s, buf, 64);
+    secp256k1_ge_from_storage(r, &s);
+}
+
+static void secp256k1_ge_to_bytes_ext(unsigned char *data, const secp256k1_ge *ge) {
+    if (secp256k1_ge_is_infinity(ge)) {
+        memset(data, 0, 64);
+    } else {
+        secp256k1_ge_to_bytes(data, ge);
+    }
+}
+
+static void secp256k1_ge_from_bytes_ext(secp256k1_ge *ge, const unsigned char *data) {
+    static const unsigned char zeros[64] = { 0 };
+    if (secp256k1_memcmp_var(data, zeros, sizeof(zeros)) == 0) {
+        secp256k1_ge_set_infinity(ge);
+    } else {
+        secp256k1_ge_from_bytes(ge, data);
+    }
+}
+
+#endif /* SECP256K1_GROUP_IMPL_H */
diff --git a/vendor/external/secp256k1/src/hash.h b/vendor/external/secp256k1/src/hash.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/hash.h
@@ -0,0 +1,44 @@
+/***********************************************************************
+ * Copyright (c) 2014 Pieter Wuille                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_HASH_H
+#define SECP256K1_HASH_H
+
+#include <stdlib.h>
+#include <stdint.h>
+
+typedef struct {
+    uint32_t s[8];
+    unsigned char buf[64];
+    uint64_t bytes;
+} secp256k1_sha256;
+
+static void secp256k1_sha256_initialize(secp256k1_sha256 *hash);
+static void secp256k1_sha256_write(secp256k1_sha256 *hash, const unsigned char *data, size_t size);
+static void secp256k1_sha256_finalize(secp256k1_sha256 *hash, unsigned char *out32);
+static void secp256k1_sha256_clear(secp256k1_sha256 *hash);
+
+typedef struct {
+    secp256k1_sha256 inner, outer;
+} secp256k1_hmac_sha256;
+
+static void secp256k1_hmac_sha256_initialize(secp256k1_hmac_sha256 *hash, const unsigned char *key, size_t size);
+static void secp256k1_hmac_sha256_write(secp256k1_hmac_sha256 *hash, const unsigned char *data, size_t size);
+static void secp256k1_hmac_sha256_finalize(secp256k1_hmac_sha256 *hash, unsigned char *out32);
+static void secp256k1_hmac_sha256_clear(secp256k1_hmac_sha256 *hash);
+
+typedef struct {
+    unsigned char v[32];
+    unsigned char k[32];
+    int retry;
+} secp256k1_rfc6979_hmac_sha256;
+
+static void secp256k1_rfc6979_hmac_sha256_initialize(secp256k1_rfc6979_hmac_sha256 *rng, const unsigned char *key, size_t keylen);
+static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256 *rng, unsigned char *out, size_t outlen);
+static void secp256k1_rfc6979_hmac_sha256_finalize(secp256k1_rfc6979_hmac_sha256 *rng);
+static void secp256k1_rfc6979_hmac_sha256_clear(secp256k1_rfc6979_hmac_sha256 *rng);
+
+#endif /* SECP256K1_HASH_H */
diff --git a/vendor/external/secp256k1/src/hash_impl.h b/vendor/external/secp256k1/src/hash_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/hash_impl.h
@@ -0,0 +1,299 @@
+/***********************************************************************
+ * Copyright (c) 2014 Pieter Wuille                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_HASH_IMPL_H
+#define SECP256K1_HASH_IMPL_H
+
+#include "hash.h"
+#include "util.h"
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#define Ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
+#define Maj(x,y,z) (((x) & (y)) | ((z) & ((x) | (y))))
+#define Sigma0(x) (((x) >> 2 | (x) << 30) ^ ((x) >> 13 | (x) << 19) ^ ((x) >> 22 | (x) << 10))
+#define Sigma1(x) (((x) >> 6 | (x) << 26) ^ ((x) >> 11 | (x) << 21) ^ ((x) >> 25 | (x) << 7))
+#define sigma0(x) (((x) >> 7 | (x) << 25) ^ ((x) >> 18 | (x) << 14) ^ ((x) >> 3))
+#define sigma1(x) (((x) >> 17 | (x) << 15) ^ ((x) >> 19 | (x) << 13) ^ ((x) >> 10))
+
+#define Round(a,b,c,d,e,f,g,h,k,w) do { \
+    uint32_t t1 = (h) + Sigma1(e) + Ch((e), (f), (g)) + (k) + (w); \
+    uint32_t t2 = Sigma0(a) + Maj((a), (b), (c)); \
+    (d) += t1; \
+    (h) = t1 + t2; \
+} while(0)
+
+static void secp256k1_sha256_initialize(secp256k1_sha256 *hash) {
+    hash->s[0] = 0x6a09e667ul;
+    hash->s[1] = 0xbb67ae85ul;
+    hash->s[2] = 0x3c6ef372ul;
+    hash->s[3] = 0xa54ff53aul;
+    hash->s[4] = 0x510e527ful;
+    hash->s[5] = 0x9b05688cul;
+    hash->s[6] = 0x1f83d9abul;
+    hash->s[7] = 0x5be0cd19ul;
+    hash->bytes = 0;
+}
+
+/** Perform one SHA-256 transformation, processing 16 big endian 32-bit words. */
+static void secp256k1_sha256_transform(uint32_t* s, const unsigned char* buf) {
+    uint32_t a = s[0], b = s[1], c = s[2], d = s[3], e = s[4], f = s[5], g = s[6], h = s[7];
+    uint32_t w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15;
+
+    Round(a, b, c, d, e, f, g, h, 0x428a2f98,  w0 = secp256k1_read_be32(&buf[0]));
+    Round(h, a, b, c, d, e, f, g, 0x71374491,  w1 = secp256k1_read_be32(&buf[4]));
+    Round(g, h, a, b, c, d, e, f, 0xb5c0fbcf,  w2 = secp256k1_read_be32(&buf[8]));
+    Round(f, g, h, a, b, c, d, e, 0xe9b5dba5,  w3 = secp256k1_read_be32(&buf[12]));
+    Round(e, f, g, h, a, b, c, d, 0x3956c25b,  w4 = secp256k1_read_be32(&buf[16]));
+    Round(d, e, f, g, h, a, b, c, 0x59f111f1,  w5 = secp256k1_read_be32(&buf[20]));
+    Round(c, d, e, f, g, h, a, b, 0x923f82a4,  w6 = secp256k1_read_be32(&buf[24]));
+    Round(b, c, d, e, f, g, h, a, 0xab1c5ed5,  w7 = secp256k1_read_be32(&buf[28]));
+    Round(a, b, c, d, e, f, g, h, 0xd807aa98,  w8 = secp256k1_read_be32(&buf[32]));
+    Round(h, a, b, c, d, e, f, g, 0x12835b01,  w9 = secp256k1_read_be32(&buf[36]));
+    Round(g, h, a, b, c, d, e, f, 0x243185be, w10 = secp256k1_read_be32(&buf[40]));
+    Round(f, g, h, a, b, c, d, e, 0x550c7dc3, w11 = secp256k1_read_be32(&buf[44]));
+    Round(e, f, g, h, a, b, c, d, 0x72be5d74, w12 = secp256k1_read_be32(&buf[48]));
+    Round(d, e, f, g, h, a, b, c, 0x80deb1fe, w13 = secp256k1_read_be32(&buf[52]));
+    Round(c, d, e, f, g, h, a, b, 0x9bdc06a7, w14 = secp256k1_read_be32(&buf[56]));
+    Round(b, c, d, e, f, g, h, a, 0xc19bf174, w15 = secp256k1_read_be32(&buf[60]));
+
+    Round(a, b, c, d, e, f, g, h, 0xe49b69c1, w0 += sigma1(w14) + w9 + sigma0(w1));
+    Round(h, a, b, c, d, e, f, g, 0xefbe4786, w1 += sigma1(w15) + w10 + sigma0(w2));
+    Round(g, h, a, b, c, d, e, f, 0x0fc19dc6, w2 += sigma1(w0) + w11 + sigma0(w3));
+    Round(f, g, h, a, b, c, d, e, 0x240ca1cc, w3 += sigma1(w1) + w12 + sigma0(w4));
+    Round(e, f, g, h, a, b, c, d, 0x2de92c6f, w4 += sigma1(w2) + w13 + sigma0(w5));
+    Round(d, e, f, g, h, a, b, c, 0x4a7484aa, w5 += sigma1(w3) + w14 + sigma0(w6));
+    Round(c, d, e, f, g, h, a, b, 0x5cb0a9dc, w6 += sigma1(w4) + w15 + sigma0(w7));
+    Round(b, c, d, e, f, g, h, a, 0x76f988da, w7 += sigma1(w5) + w0 + sigma0(w8));
+    Round(a, b, c, d, e, f, g, h, 0x983e5152, w8 += sigma1(w6) + w1 + sigma0(w9));
+    Round(h, a, b, c, d, e, f, g, 0xa831c66d, w9 += sigma1(w7) + w2 + sigma0(w10));
+    Round(g, h, a, b, c, d, e, f, 0xb00327c8, w10 += sigma1(w8) + w3 + sigma0(w11));
+    Round(f, g, h, a, b, c, d, e, 0xbf597fc7, w11 += sigma1(w9) + w4 + sigma0(w12));
+    Round(e, f, g, h, a, b, c, d, 0xc6e00bf3, w12 += sigma1(w10) + w5 + sigma0(w13));
+    Round(d, e, f, g, h, a, b, c, 0xd5a79147, w13 += sigma1(w11) + w6 + sigma0(w14));
+    Round(c, d, e, f, g, h, a, b, 0x06ca6351, w14 += sigma1(w12) + w7 + sigma0(w15));
+    Round(b, c, d, e, f, g, h, a, 0x14292967, w15 += sigma1(w13) + w8 + sigma0(w0));
+
+    Round(a, b, c, d, e, f, g, h, 0x27b70a85, w0 += sigma1(w14) + w9 + sigma0(w1));
+    Round(h, a, b, c, d, e, f, g, 0x2e1b2138, w1 += sigma1(w15) + w10 + sigma0(w2));
+    Round(g, h, a, b, c, d, e, f, 0x4d2c6dfc, w2 += sigma1(w0) + w11 + sigma0(w3));
+    Round(f, g, h, a, b, c, d, e, 0x53380d13, w3 += sigma1(w1) + w12 + sigma0(w4));
+    Round(e, f, g, h, a, b, c, d, 0x650a7354, w4 += sigma1(w2) + w13 + sigma0(w5));
+    Round(d, e, f, g, h, a, b, c, 0x766a0abb, w5 += sigma1(w3) + w14 + sigma0(w6));
+    Round(c, d, e, f, g, h, a, b, 0x81c2c92e, w6 += sigma1(w4) + w15 + sigma0(w7));
+    Round(b, c, d, e, f, g, h, a, 0x92722c85, w7 += sigma1(w5) + w0 + sigma0(w8));
+    Round(a, b, c, d, e, f, g, h, 0xa2bfe8a1, w8 += sigma1(w6) + w1 + sigma0(w9));
+    Round(h, a, b, c, d, e, f, g, 0xa81a664b, w9 += sigma1(w7) + w2 + sigma0(w10));
+    Round(g, h, a, b, c, d, e, f, 0xc24b8b70, w10 += sigma1(w8) + w3 + sigma0(w11));
+    Round(f, g, h, a, b, c, d, e, 0xc76c51a3, w11 += sigma1(w9) + w4 + sigma0(w12));
+    Round(e, f, g, h, a, b, c, d, 0xd192e819, w12 += sigma1(w10) + w5 + sigma0(w13));
+    Round(d, e, f, g, h, a, b, c, 0xd6990624, w13 += sigma1(w11) + w6 + sigma0(w14));
+    Round(c, d, e, f, g, h, a, b, 0xf40e3585, w14 += sigma1(w12) + w7 + sigma0(w15));
+    Round(b, c, d, e, f, g, h, a, 0x106aa070, w15 += sigma1(w13) + w8 + sigma0(w0));
+
+    Round(a, b, c, d, e, f, g, h, 0x19a4c116, w0 += sigma1(w14) + w9 + sigma0(w1));
+    Round(h, a, b, c, d, e, f, g, 0x1e376c08, w1 += sigma1(w15) + w10 + sigma0(w2));
+    Round(g, h, a, b, c, d, e, f, 0x2748774c, w2 += sigma1(w0) + w11 + sigma0(w3));
+    Round(f, g, h, a, b, c, d, e, 0x34b0bcb5, w3 += sigma1(w1) + w12 + sigma0(w4));
+    Round(e, f, g, h, a, b, c, d, 0x391c0cb3, w4 += sigma1(w2) + w13 + sigma0(w5));
+    Round(d, e, f, g, h, a, b, c, 0x4ed8aa4a, w5 += sigma1(w3) + w14 + sigma0(w6));
+    Round(c, d, e, f, g, h, a, b, 0x5b9cca4f, w6 += sigma1(w4) + w15 + sigma0(w7));
+    Round(b, c, d, e, f, g, h, a, 0x682e6ff3, w7 += sigma1(w5) + w0 + sigma0(w8));
+    Round(a, b, c, d, e, f, g, h, 0x748f82ee, w8 += sigma1(w6) + w1 + sigma0(w9));
+    Round(h, a, b, c, d, e, f, g, 0x78a5636f, w9 += sigma1(w7) + w2 + sigma0(w10));
+    Round(g, h, a, b, c, d, e, f, 0x84c87814, w10 += sigma1(w8) + w3 + sigma0(w11));
+    Round(f, g, h, a, b, c, d, e, 0x8cc70208, w11 += sigma1(w9) + w4 + sigma0(w12));
+    Round(e, f, g, h, a, b, c, d, 0x90befffa, w12 += sigma1(w10) + w5 + sigma0(w13));
+    Round(d, e, f, g, h, a, b, c, 0xa4506ceb, w13 += sigma1(w11) + w6 + sigma0(w14));
+    Round(c, d, e, f, g, h, a, b, 0xbef9a3f7, w14 + sigma1(w12) + w7 + sigma0(w15));
+    Round(b, c, d, e, f, g, h, a, 0xc67178f2, w15 + sigma1(w13) + w8 + sigma0(w0));
+
+    s[0] += a;
+    s[1] += b;
+    s[2] += c;
+    s[3] += d;
+    s[4] += e;
+    s[5] += f;
+    s[6] += g;
+    s[7] += h;
+}
+
+static void secp256k1_sha256_write(secp256k1_sha256 *hash, const unsigned char *data, size_t len) {
+    size_t bufsize = hash->bytes & 0x3F;
+    hash->bytes += len;
+    VERIFY_CHECK(hash->bytes >= len);
+    while (len >= 64 - bufsize) {
+        /* Fill the buffer, and process it. */
+        size_t chunk_len = 64 - bufsize;
+        memcpy(hash->buf + bufsize, data, chunk_len);
+        data += chunk_len;
+        len -= chunk_len;
+        secp256k1_sha256_transform(hash->s, hash->buf);
+        bufsize = 0;
+    }
+    if (len) {
+        /* Fill the buffer with what remains. */
+        memcpy(hash->buf + bufsize, data, len);
+    }
+}
+
+static void secp256k1_sha256_finalize(secp256k1_sha256 *hash, unsigned char *out32) {
+    static const unsigned char pad[64] = {0x80};
+    unsigned char sizedesc[8];
+    int i;
+    /* The maximum message size of SHA256 is 2^64-1 bits. */
+    VERIFY_CHECK(hash->bytes < ((uint64_t)1 << 61));
+    secp256k1_write_be32(&sizedesc[0], hash->bytes >> 29);
+    secp256k1_write_be32(&sizedesc[4], hash->bytes << 3);
+    secp256k1_sha256_write(hash, pad, 1 + ((119 - (hash->bytes % 64)) % 64));
+    secp256k1_sha256_write(hash, sizedesc, 8);
+    for (i = 0; i < 8; i++) {
+        secp256k1_write_be32(&out32[4*i], hash->s[i]);
+        hash->s[i] = 0;
+    }
+}
+
+/* Initializes a sha256 struct and writes the 64 byte string
+ * SHA256(tag)||SHA256(tag) into it. */
+static void secp256k1_sha256_initialize_tagged(secp256k1_sha256 *hash, const unsigned char *tag, size_t taglen) {
+    unsigned char buf[32];
+    secp256k1_sha256_initialize(hash);
+    secp256k1_sha256_write(hash, tag, taglen);
+    secp256k1_sha256_finalize(hash, buf);
+
+    secp256k1_sha256_initialize(hash);
+    secp256k1_sha256_write(hash, buf, 32);
+    secp256k1_sha256_write(hash, buf, 32);
+}
+
+static void secp256k1_sha256_clear(secp256k1_sha256 *hash) {
+    secp256k1_memclear(hash, sizeof(*hash));
+}
+
+static void secp256k1_hmac_sha256_initialize(secp256k1_hmac_sha256 *hash, const unsigned char *key, size_t keylen) {
+    size_t n;
+    unsigned char rkey[64];
+    if (keylen <= sizeof(rkey)) {
+        memcpy(rkey, key, keylen);
+        memset(rkey + keylen, 0, sizeof(rkey) - keylen);
+    } else {
+        secp256k1_sha256 sha256;
+        secp256k1_sha256_initialize(&sha256);
+        secp256k1_sha256_write(&sha256, key, keylen);
+        secp256k1_sha256_finalize(&sha256, rkey);
+        memset(rkey + 32, 0, 32);
+    }
+
+    secp256k1_sha256_initialize(&hash->outer);
+    for (n = 0; n < sizeof(rkey); n++) {
+        rkey[n] ^= 0x5c;
+    }
+    secp256k1_sha256_write(&hash->outer, rkey, sizeof(rkey));
+
+    secp256k1_sha256_initialize(&hash->inner);
+    for (n = 0; n < sizeof(rkey); n++) {
+        rkey[n] ^= 0x5c ^ 0x36;
+    }
+    secp256k1_sha256_write(&hash->inner, rkey, sizeof(rkey));
+    secp256k1_memclear(rkey, sizeof(rkey));
+}
+
+static void secp256k1_hmac_sha256_write(secp256k1_hmac_sha256 *hash, const unsigned char *data, size_t size) {
+    secp256k1_sha256_write(&hash->inner, data, size);
+}
+
+static void secp256k1_hmac_sha256_finalize(secp256k1_hmac_sha256 *hash, unsigned char *out32) {
+    unsigned char temp[32];
+    secp256k1_sha256_finalize(&hash->inner, temp);
+    secp256k1_sha256_write(&hash->outer, temp, 32);
+    secp256k1_memclear(temp, sizeof(temp));
+    secp256k1_sha256_finalize(&hash->outer, out32);
+}
+
+static void secp256k1_hmac_sha256_clear(secp256k1_hmac_sha256 *hash) {
+    secp256k1_memclear(hash, sizeof(*hash));
+}
+
+static void secp256k1_rfc6979_hmac_sha256_initialize(secp256k1_rfc6979_hmac_sha256 *rng, const unsigned char *key, size_t keylen) {
+    secp256k1_hmac_sha256 hmac;
+    static const unsigned char zero[1] = {0x00};
+    static const unsigned char one[1] = {0x01};
+
+    memset(rng->v, 0x01, 32); /* RFC6979 3.2.b. */
+    memset(rng->k, 0x00, 32); /* RFC6979 3.2.c. */
+
+    /* RFC6979 3.2.d. */
+    secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32);
+    secp256k1_hmac_sha256_write(&hmac, rng->v, 32);
+    secp256k1_hmac_sha256_write(&hmac, zero, 1);
+    secp256k1_hmac_sha256_write(&hmac, key, keylen);
+    secp256k1_hmac_sha256_finalize(&hmac, rng->k);
+    secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32);
+    secp256k1_hmac_sha256_write(&hmac, rng->v, 32);
+    secp256k1_hmac_sha256_finalize(&hmac, rng->v);
+
+    /* RFC6979 3.2.f. */
+    secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32);
+    secp256k1_hmac_sha256_write(&hmac, rng->v, 32);
+    secp256k1_hmac_sha256_write(&hmac, one, 1);
+    secp256k1_hmac_sha256_write(&hmac, key, keylen);
+    secp256k1_hmac_sha256_finalize(&hmac, rng->k);
+    secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32);
+    secp256k1_hmac_sha256_write(&hmac, rng->v, 32);
+    secp256k1_hmac_sha256_finalize(&hmac, rng->v);
+    rng->retry = 0;
+}
+
+static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256 *rng, unsigned char *out, size_t outlen) {
+    /* RFC6979 3.2.h. */
+    static const unsigned char zero[1] = {0x00};
+    if (rng->retry) {
+        secp256k1_hmac_sha256 hmac;
+        secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32);
+        secp256k1_hmac_sha256_write(&hmac, rng->v, 32);
+        secp256k1_hmac_sha256_write(&hmac, zero, 1);
+        secp256k1_hmac_sha256_finalize(&hmac, rng->k);
+        secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32);
+        secp256k1_hmac_sha256_write(&hmac, rng->v, 32);
+        secp256k1_hmac_sha256_finalize(&hmac, rng->v);
+    }
+
+    while (outlen > 0) {
+        secp256k1_hmac_sha256 hmac;
+        int now = outlen;
+        secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32);
+        secp256k1_hmac_sha256_write(&hmac, rng->v, 32);
+        secp256k1_hmac_sha256_finalize(&hmac, rng->v);
+        if (now > 32) {
+            now = 32;
+        }
+        memcpy(out, rng->v, now);
+        out += now;
+        outlen -= now;
+    }
+
+    rng->retry = 1;
+}
+
+static void secp256k1_rfc6979_hmac_sha256_finalize(secp256k1_rfc6979_hmac_sha256 *rng) {
+    (void) rng;
+}
+
+static void secp256k1_rfc6979_hmac_sha256_clear(secp256k1_rfc6979_hmac_sha256 *rng) {
+    secp256k1_memclear(rng, sizeof(*rng));
+}
+
+#undef Round
+#undef sigma1
+#undef sigma0
+#undef Sigma1
+#undef Sigma0
+#undef Maj
+#undef Ch
+
+#endif /* SECP256K1_HASH_IMPL_H */
diff --git a/vendor/external/secp256k1/src/hsort.h b/vendor/external/secp256k1/src/hsort.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/hsort.h
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Copyright (c) 2021 Russell O'Connor, Jonas Nick                     *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_HSORT_H
+#define SECP256K1_HSORT_H
+
+#include <stddef.h>
+#include <string.h>
+
+/* In-place, iterative heapsort with an interface matching glibc's qsort_r. This
+ * is preferred over standard library implementations because they generally
+ * make no guarantee about being fast for malicious inputs.
+ * Remember that heapsort is unstable.
+ *
+ * In/Out: ptr: pointer to the array to sort. The contents of the array are
+ *              sorted in ascending order according to the comparison function.
+ * In:   count: number of elements in the array.
+ *        size: size in bytes of each element.
+ *         cmp: pointer to a comparison function that is called with two
+ *              arguments that point to the objects being compared. The cmp_data
+ *              argument of secp256k1_hsort is passed as third argument. The
+ *              function must return an integer less than, equal to, or greater
+ *              than zero if the first argument is considered to be respectively
+ *              less than, equal to, or greater than the second.
+ *    cmp_data: pointer passed as third argument to cmp.
+ */
+static void secp256k1_hsort(void *ptr, size_t count, size_t size,
+                            int (*cmp)(const void *, const void *, void *),
+                            void *cmp_data);
+#endif
diff --git a/vendor/external/secp256k1/src/hsort_impl.h b/vendor/external/secp256k1/src/hsort_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/hsort_impl.h
@@ -0,0 +1,125 @@
+/***********************************************************************
+ * Copyright (c) 2021 Russell O'Connor, Jonas Nick                     *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_HSORT_IMPL_H
+#define SECP256K1_HSORT_IMPL_H
+
+#include "hsort.h"
+
+/* An array is a heap when, for all non-zero indexes i, the element at index i
+ * compares as less than or equal to the element at index parent(i) = (i-1)/2.
+ */
+
+static SECP256K1_INLINE size_t secp256k1_heap_child1(size_t i) {
+    VERIFY_CHECK(i <= (SIZE_MAX - 1)/2);
+    return 2*i + 1;
+}
+
+static SECP256K1_INLINE size_t secp256k1_heap_child2(size_t i) {
+    VERIFY_CHECK(i <= SIZE_MAX/2 - 1);
+    return secp256k1_heap_child1(i)+1;
+}
+
+static SECP256K1_INLINE void secp256k1_heap_swap64(unsigned char *a, unsigned char *b, size_t len) {
+    unsigned char tmp[64];
+    VERIFY_CHECK(len <= 64);
+    memcpy(tmp, a, len);
+    memmove(a, b, len);
+    memcpy(b, tmp, len);
+}
+
+static SECP256K1_INLINE void secp256k1_heap_swap(unsigned char *arr, size_t i, size_t j, size_t stride) {
+    unsigned char *a = arr + i*stride;
+    unsigned char *b = arr + j*stride;
+    size_t len = stride;
+    while (64 < len) {
+        secp256k1_heap_swap64(a + (len - 64), b + (len - 64), 64);
+        len -= 64;
+    }
+    secp256k1_heap_swap64(a, b, len);
+}
+
+/* This function accepts an array arr containing heap_size elements, each of
+ * size stride. The elements in the array at indices >i satisfy the max-heap
+ * property, i.e., for any element at index j (where j > i), all of its children
+ * are smaller than the element itself. The purpose of the function is to update
+ * the array so that all elements at indices >=i satisfy the max-heap
+ * property. */
+static SECP256K1_INLINE void secp256k1_heap_down(unsigned char *arr, size_t i, size_t heap_size, size_t stride,
+                            int (*cmp)(const void *, const void *, void *), void *cmp_data) {
+    while (i < heap_size/2) {
+        VERIFY_CHECK(i <= SIZE_MAX/2 - 1);
+        /* Proof:
+         * i < heap_size/2
+         * i + 1 <= heap_size/2
+         * 2*i + 2 <= heap_size <= SIZE_MAX
+         * 2*i <= SIZE_MAX - 2
+         */
+
+        VERIFY_CHECK(secp256k1_heap_child1(i) < heap_size);
+        /* Proof:
+         * i < heap_size/2
+         * i + 1 <= heap_size/2
+         * 2*i + 2 <= heap_size
+         * 2*i + 1 < heap_size
+         * child1(i) < heap_size
+         */
+
+        /* Let [x] be notation for the contents at arr[x*stride].
+         *
+         * If [child1(i)] > [i] and [child2(i)] > [i],
+         *   swap [i] with the larger child to ensure the new parent is larger
+         *   than both children. When [child1(i)] == [child2(i)], swap [i] with
+         *   [child2(i)].
+         * Else if [child1(i)] > [i], swap [i] with [child1(i)].
+         * Else if [child2(i)] > [i], swap [i] with [child2(i)].
+         */
+        if (secp256k1_heap_child2(i) < heap_size
+                && 0 <= cmp(arr + secp256k1_heap_child2(i)*stride, arr + secp256k1_heap_child1(i)*stride, cmp_data)) {
+            if (0 < cmp(arr + secp256k1_heap_child2(i)*stride, arr + i*stride, cmp_data)) {
+                secp256k1_heap_swap(arr, i, secp256k1_heap_child2(i), stride);
+                i = secp256k1_heap_child2(i);
+            } else {
+                /* At this point we have [child2(i)] >= [child1(i)] and we have
+                 * [child2(i)] <= [i], and thus [child1(i)] <= [i] which means
+                 * that the next comparison can be skipped. */
+                return;
+            }
+        } else if (0 < cmp(arr + secp256k1_heap_child1(i)*stride, arr +         i*stride, cmp_data)) {
+            secp256k1_heap_swap(arr, i, secp256k1_heap_child1(i), stride);
+            i = secp256k1_heap_child1(i);
+        } else {
+            return;
+        }
+    }
+    /* heap_size/2 <= i
+     * heap_size/2 < i + 1
+     * heap_size < 2*i + 2
+     * heap_size <= 2*i + 1
+     * heap_size <= child1(i)
+     * Thus child1(i) and child2(i) are now out of bounds and we are at a leaf.
+     */
+}
+
+/* In-place heap sort. */
+static void secp256k1_hsort(void *ptr, size_t count, size_t size,
+                            int (*cmp)(const void *, const void *, void *),
+                            void *cmp_data) {
+    size_t i;
+
+    for (i = count/2; 0 < i; --i) {
+        secp256k1_heap_down(ptr, i-1, count, size, cmp, cmp_data);
+    }
+    for (i = count; 1 < i; --i) {
+        /* Extract the largest value from the heap */
+        secp256k1_heap_swap(ptr, 0, i-1, size);
+
+        /* Repair the heap condition */
+        secp256k1_heap_down(ptr, 0, i-1, size, cmp, cmp_data);
+    }
+}
+
+#endif
diff --git a/vendor/external/secp256k1/src/int128.h b/vendor/external/secp256k1/src/int128.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/int128.h
@@ -0,0 +1,90 @@
+#ifndef SECP256K1_INT128_H
+#define SECP256K1_INT128_H
+
+#include "util.h"
+
+#if defined(SECP256K1_WIDEMUL_INT128)
+#  if defined(SECP256K1_INT128_NATIVE)
+#    include "int128_native.h"
+#  elif defined(SECP256K1_INT128_STRUCT)
+#    include "int128_struct.h"
+#  else
+#    error "Please select int128 implementation"
+#  endif
+
+/* Construct an unsigned 128-bit value from a high and a low 64-bit value. */
+static SECP256K1_INLINE void secp256k1_u128_load(secp256k1_uint128 *r, uint64_t hi, uint64_t lo);
+
+/* Multiply two unsigned 64-bit values a and b and write the result to r. */
+static SECP256K1_INLINE void secp256k1_u128_mul(secp256k1_uint128 *r, uint64_t a, uint64_t b);
+
+/* Multiply two unsigned 64-bit values a and b and add the result to r.
+ * The final result is taken modulo 2^128.
+ */
+static SECP256K1_INLINE void secp256k1_u128_accum_mul(secp256k1_uint128 *r, uint64_t a, uint64_t b);
+
+/* Add an unsigned 64-bit value a to r.
+ * The final result is taken modulo 2^128.
+ */
+static SECP256K1_INLINE void secp256k1_u128_accum_u64(secp256k1_uint128 *r, uint64_t a);
+
+/* Unsigned (logical) right shift.
+ * Non-constant time in n.
+ */
+static SECP256K1_INLINE void secp256k1_u128_rshift(secp256k1_uint128 *r, unsigned int n);
+
+/* Return the low 64-bits of a 128-bit value as an unsigned 64-bit value. */
+static SECP256K1_INLINE uint64_t secp256k1_u128_to_u64(const secp256k1_uint128 *a);
+
+/* Return the high 64-bits of a 128-bit value as an unsigned 64-bit value. */
+static SECP256K1_INLINE uint64_t secp256k1_u128_hi_u64(const secp256k1_uint128 *a);
+
+/* Write an unsigned 64-bit value to r. */
+static SECP256K1_INLINE void secp256k1_u128_from_u64(secp256k1_uint128 *r, uint64_t a);
+
+/* Tests if r is strictly less than to 2^n.
+ * n must be strictly less than 128.
+ */
+static SECP256K1_INLINE int secp256k1_u128_check_bits(const secp256k1_uint128 *r, unsigned int n);
+
+/* Construct an signed 128-bit value from a high and a low 64-bit value. */
+static SECP256K1_INLINE void secp256k1_i128_load(secp256k1_int128 *r, int64_t hi, uint64_t lo);
+
+/* Multiply two signed 64-bit values a and b and write the result to r. */
+static SECP256K1_INLINE void secp256k1_i128_mul(secp256k1_int128 *r, int64_t a, int64_t b);
+
+/* Multiply two signed 64-bit values a and b and add the result to r.
+ * Overflow or underflow from the addition is undefined behaviour.
+ */
+static SECP256K1_INLINE void secp256k1_i128_accum_mul(secp256k1_int128 *r, int64_t a, int64_t b);
+
+/* Compute a*d - b*c from signed 64-bit values and write the result to r. */
+static SECP256K1_INLINE void secp256k1_i128_det(secp256k1_int128 *r, int64_t a, int64_t b, int64_t c, int64_t d);
+
+/* Signed (arithmetic) right shift.
+ * Non-constant time in b.
+ */
+static SECP256K1_INLINE void secp256k1_i128_rshift(secp256k1_int128 *r, unsigned int b);
+
+/* Return the input value modulo 2^64. */
+static SECP256K1_INLINE uint64_t secp256k1_i128_to_u64(const secp256k1_int128 *a);
+
+/* Return the value as a signed 64-bit value.
+ * Requires the input to be between INT64_MIN and INT64_MAX.
+ */
+static SECP256K1_INLINE int64_t secp256k1_i128_to_i64(const secp256k1_int128 *a);
+
+/* Write a signed 64-bit value to r. */
+static SECP256K1_INLINE void secp256k1_i128_from_i64(secp256k1_int128 *r, int64_t a);
+
+/* Compare two 128-bit values for equality. */
+static SECP256K1_INLINE int secp256k1_i128_eq_var(const secp256k1_int128 *a, const secp256k1_int128 *b);
+
+/* Tests if r is equal to sign*2^n (sign must be 1 or -1).
+ * n must be strictly less than 127.
+ */
+static SECP256K1_INLINE int secp256k1_i128_check_pow2(const secp256k1_int128 *r, unsigned int n, int sign);
+
+#endif
+
+#endif
diff --git a/vendor/external/secp256k1/src/int128_impl.h b/vendor/external/secp256k1/src/int128_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/int128_impl.h
@@ -0,0 +1,18 @@
+#ifndef SECP256K1_INT128_IMPL_H
+#define SECP256K1_INT128_IMPL_H
+
+#include "util.h"
+
+#include "int128.h"
+
+#if defined(SECP256K1_WIDEMUL_INT128)
+#  if defined(SECP256K1_INT128_NATIVE)
+#    include "int128_native_impl.h"
+#  elif defined(SECP256K1_INT128_STRUCT)
+#    include "int128_struct_impl.h"
+#  else
+#    error "Please select int128 implementation"
+#  endif
+#endif
+
+#endif
diff --git a/vendor/external/secp256k1/src/int128_native.h b/vendor/external/secp256k1/src/int128_native.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/int128_native.h
@@ -0,0 +1,19 @@
+#ifndef SECP256K1_INT128_NATIVE_H
+#define SECP256K1_INT128_NATIVE_H
+
+#include <stdint.h>
+#include "util.h"
+
+#if !defined(UINT128_MAX) && defined(__SIZEOF_INT128__)
+SECP256K1_GNUC_EXT typedef unsigned __int128 uint128_t;
+SECP256K1_GNUC_EXT typedef __int128 int128_t;
+# define UINT128_MAX ((uint128_t)(-1))
+# define INT128_MAX ((int128_t)(UINT128_MAX >> 1))
+# define INT128_MIN (-INT128_MAX - 1)
+/* No (U)INT128_C macros because compilers providing __int128 do not support 128-bit literals.  */
+#endif
+
+typedef uint128_t secp256k1_uint128;
+typedef int128_t secp256k1_int128;
+
+#endif
diff --git a/vendor/external/secp256k1/src/int128_native_impl.h b/vendor/external/secp256k1/src/int128_native_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/int128_native_impl.h
@@ -0,0 +1,94 @@
+#ifndef SECP256K1_INT128_NATIVE_IMPL_H
+#define SECP256K1_INT128_NATIVE_IMPL_H
+
+#include "int128.h"
+#include "util.h"
+
+static SECP256K1_INLINE void secp256k1_u128_load(secp256k1_uint128 *r, uint64_t hi, uint64_t lo) {
+    *r = (((uint128_t)hi) << 64) + lo;
+}
+
+static SECP256K1_INLINE void secp256k1_u128_mul(secp256k1_uint128 *r, uint64_t a, uint64_t b) {
+   *r = (uint128_t)a * b;
+}
+
+static SECP256K1_INLINE void secp256k1_u128_accum_mul(secp256k1_uint128 *r, uint64_t a, uint64_t b) {
+   *r += (uint128_t)a * b;
+}
+
+static SECP256K1_INLINE void secp256k1_u128_accum_u64(secp256k1_uint128 *r, uint64_t a) {
+   *r += a;
+}
+
+static SECP256K1_INLINE void secp256k1_u128_rshift(secp256k1_uint128 *r, unsigned int n) {
+   VERIFY_CHECK(n < 128);
+   *r >>= n;
+}
+
+static SECP256K1_INLINE uint64_t secp256k1_u128_to_u64(const secp256k1_uint128 *a) {
+   return (uint64_t)(*a);
+}
+
+static SECP256K1_INLINE uint64_t secp256k1_u128_hi_u64(const secp256k1_uint128 *a) {
+   return (uint64_t)(*a >> 64);
+}
+
+static SECP256K1_INLINE void secp256k1_u128_from_u64(secp256k1_uint128 *r, uint64_t a) {
+   *r = a;
+}
+
+static SECP256K1_INLINE int secp256k1_u128_check_bits(const secp256k1_uint128 *r, unsigned int n) {
+   VERIFY_CHECK(n < 128);
+   return (*r >> n == 0);
+}
+
+static SECP256K1_INLINE void secp256k1_i128_load(secp256k1_int128 *r, int64_t hi, uint64_t lo) {
+    *r = (((uint128_t)(uint64_t)hi) << 64) + lo;
+}
+
+static SECP256K1_INLINE void secp256k1_i128_mul(secp256k1_int128 *r, int64_t a, int64_t b) {
+   *r = (int128_t)a * b;
+}
+
+static SECP256K1_INLINE void secp256k1_i128_accum_mul(secp256k1_int128 *r, int64_t a, int64_t b) {
+   int128_t ab = (int128_t)a * b;
+   VERIFY_CHECK(0 <= ab ? *r <= INT128_MAX - ab : INT128_MIN - ab <= *r);
+   *r += ab;
+}
+
+static SECP256K1_INLINE void secp256k1_i128_det(secp256k1_int128 *r, int64_t a, int64_t b, int64_t c, int64_t d) {
+   int128_t ad = (int128_t)a * d;
+   int128_t bc = (int128_t)b * c;
+   VERIFY_CHECK(0 <= bc ? INT128_MIN + bc <= ad : ad <= INT128_MAX + bc);
+   *r = ad - bc;
+}
+
+static SECP256K1_INLINE void secp256k1_i128_rshift(secp256k1_int128 *r, unsigned int n) {
+   VERIFY_CHECK(n < 128);
+   *r >>= n;
+}
+
+static SECP256K1_INLINE uint64_t secp256k1_i128_to_u64(const secp256k1_int128 *a) {
+   return (uint64_t)*a;
+}
+
+static SECP256K1_INLINE int64_t secp256k1_i128_to_i64(const secp256k1_int128 *a) {
+   VERIFY_CHECK(INT64_MIN <= *a && *a <= INT64_MAX);
+   return *a;
+}
+
+static SECP256K1_INLINE void secp256k1_i128_from_i64(secp256k1_int128 *r, int64_t a) {
+   *r = a;
+}
+
+static SECP256K1_INLINE int secp256k1_i128_eq_var(const secp256k1_int128 *a, const secp256k1_int128 *b) {
+   return *a == *b;
+}
+
+static SECP256K1_INLINE int secp256k1_i128_check_pow2(const secp256k1_int128 *r, unsigned int n, int sign) {
+   VERIFY_CHECK(n < 127);
+   VERIFY_CHECK(sign == 1 || sign == -1);
+   return (*r == (int128_t)((uint128_t)sign << n));
+}
+
+#endif
diff --git a/vendor/external/secp256k1/src/int128_struct.h b/vendor/external/secp256k1/src/int128_struct.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/int128_struct.h
@@ -0,0 +1,14 @@
+#ifndef SECP256K1_INT128_STRUCT_H
+#define SECP256K1_INT128_STRUCT_H
+
+#include <stdint.h>
+#include "util.h"
+
+typedef struct {
+  uint64_t lo;
+  uint64_t hi;
+} secp256k1_uint128;
+
+typedef secp256k1_uint128 secp256k1_int128;
+
+#endif
diff --git a/vendor/external/secp256k1/src/int128_struct_impl.h b/vendor/external/secp256k1/src/int128_struct_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/int128_struct_impl.h
@@ -0,0 +1,205 @@
+#ifndef SECP256K1_INT128_STRUCT_IMPL_H
+#define SECP256K1_INT128_STRUCT_IMPL_H
+
+#include "int128.h"
+#include "util.h"
+
+#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64)) /* MSVC */
+#    include <intrin.h>
+#    if defined(_M_ARM64) || defined(SECP256K1_MSVC_MULH_TEST_OVERRIDE)
+/* On ARM64 MSVC, use __(u)mulh for the upper half of 64x64 multiplications.
+   (Define SECP256K1_MSVC_MULH_TEST_OVERRIDE to test this code path on X64,
+   which supports both __(u)mulh and _umul128.) */
+#        if defined(SECP256K1_MSVC_MULH_TEST_OVERRIDE)
+#            pragma message(__FILE__ ": SECP256K1_MSVC_MULH_TEST_OVERRIDE is defined, forcing use of __(u)mulh.")
+#        endif
+static SECP256K1_INLINE uint64_t secp256k1_umul128(uint64_t a, uint64_t b, uint64_t* hi) {
+    *hi = __umulh(a, b);
+    return a * b;
+}
+
+static SECP256K1_INLINE int64_t secp256k1_mul128(int64_t a, int64_t b, int64_t* hi) {
+    *hi = __mulh(a, b);
+    return (uint64_t)a * (uint64_t)b;
+}
+#    else
+/* On x84_64 MSVC, use native _(u)mul128 for 64x64->128 multiplications. */
+#        define secp256k1_umul128 _umul128
+#        define secp256k1_mul128 _mul128
+#    endif
+#else
+/* On other systems, emulate 64x64->128 multiplications using 32x32->64 multiplications. */
+static SECP256K1_INLINE uint64_t secp256k1_umul128(uint64_t a, uint64_t b, uint64_t* hi) {
+    uint64_t ll = (uint64_t)(uint32_t)a * (uint32_t)b;
+    uint64_t lh = (uint32_t)a * (b >> 32);
+    uint64_t hl = (a >> 32) * (uint32_t)b;
+    uint64_t hh = (a >> 32) * (b >> 32);
+    uint64_t mid34 = (ll >> 32) + (uint32_t)lh + (uint32_t)hl;
+    *hi = hh + (lh >> 32) + (hl >> 32) + (mid34 >> 32);
+    return (mid34 << 32) + (uint32_t)ll;
+}
+
+static SECP256K1_INLINE int64_t secp256k1_mul128(int64_t a, int64_t b, int64_t* hi) {
+    uint64_t ll = (uint64_t)(uint32_t)a * (uint32_t)b;
+    int64_t lh = (uint32_t)a * (b >> 32);
+    int64_t hl = (a >> 32) * (uint32_t)b;
+    int64_t hh = (a >> 32) * (b >> 32);
+    uint64_t mid34 = (ll >> 32) + (uint32_t)lh + (uint32_t)hl;
+    *hi = hh + (lh >> 32) + (hl >> 32) + (mid34 >> 32);
+    return (mid34 << 32) + (uint32_t)ll;
+}
+#endif
+
+static SECP256K1_INLINE void secp256k1_u128_load(secp256k1_uint128 *r, uint64_t hi, uint64_t lo) {
+    r->hi = hi;
+    r->lo = lo;
+}
+
+static SECP256K1_INLINE void secp256k1_u128_mul(secp256k1_uint128 *r, uint64_t a, uint64_t b) {
+   r->lo = secp256k1_umul128(a, b, &r->hi);
+}
+
+static SECP256K1_INLINE void secp256k1_u128_accum_mul(secp256k1_uint128 *r, uint64_t a, uint64_t b) {
+   uint64_t lo, hi;
+   lo = secp256k1_umul128(a, b, &hi);
+   r->lo += lo;
+   r->hi += hi + (r->lo < lo);
+}
+
+static SECP256K1_INLINE void secp256k1_u128_accum_u64(secp256k1_uint128 *r, uint64_t a) {
+   r->lo += a;
+   r->hi += r->lo < a;
+}
+
+/* Unsigned (logical) right shift.
+ * Non-constant time in n.
+ */
+static SECP256K1_INLINE void secp256k1_u128_rshift(secp256k1_uint128 *r, unsigned int n) {
+   VERIFY_CHECK(n < 128);
+   if (n >= 64) {
+     r->lo = r->hi >> (n-64);
+     r->hi = 0;
+   } else if (n > 0) {
+#if defined(_MSC_VER) && defined(_M_X64)
+     VERIFY_CHECK(n < 64);
+     r->lo = __shiftright128(r->lo, r->hi, n);
+#else
+     r->lo = ((1U * r->hi) << (64-n)) | r->lo >> n;
+#endif
+     r->hi >>= n;
+   }
+}
+
+static SECP256K1_INLINE uint64_t secp256k1_u128_to_u64(const secp256k1_uint128 *a) {
+   return a->lo;
+}
+
+static SECP256K1_INLINE uint64_t secp256k1_u128_hi_u64(const secp256k1_uint128 *a) {
+   return a->hi;
+}
+
+static SECP256K1_INLINE void secp256k1_u128_from_u64(secp256k1_uint128 *r, uint64_t a) {
+   r->hi = 0;
+   r->lo = a;
+}
+
+static SECP256K1_INLINE int secp256k1_u128_check_bits(const secp256k1_uint128 *r, unsigned int n) {
+   VERIFY_CHECK(n < 128);
+   return n >= 64 ? r->hi >> (n - 64) == 0
+                  : r->hi == 0 && r->lo >> n == 0;
+}
+
+static SECP256K1_INLINE void secp256k1_i128_load(secp256k1_int128 *r, int64_t hi, uint64_t lo) {
+    r->hi = hi;
+    r->lo = lo;
+}
+
+static SECP256K1_INLINE void secp256k1_i128_mul(secp256k1_int128 *r, int64_t a, int64_t b) {
+   int64_t hi;
+   r->lo = (uint64_t)secp256k1_mul128(a, b, &hi);
+   r->hi = (uint64_t)hi;
+}
+
+static SECP256K1_INLINE void secp256k1_i128_accum_mul(secp256k1_int128 *r, int64_t a, int64_t b) {
+   int64_t hi;
+   uint64_t lo = (uint64_t)secp256k1_mul128(a, b, &hi);
+   r->lo += lo;
+   hi += r->lo < lo;
+   /* Verify no overflow.
+    * If r represents a positive value (the sign bit is not set) and the value we are adding is a positive value (the sign bit is not set),
+    * then we require that the resulting value also be positive (the sign bit is not set).
+    * Note that (X <= Y) means (X implies Y) when X and Y are boolean values (i.e. 0 or 1).
+    */
+   VERIFY_CHECK((r->hi <= 0x7fffffffffffffffu && (uint64_t)hi <= 0x7fffffffffffffffu) <= (r->hi + (uint64_t)hi <= 0x7fffffffffffffffu));
+   /* Verify no underflow.
+    * If r represents a negative value (the sign bit is set) and the value we are adding is a negative value (the sign bit is set),
+    * then we require that the resulting value also be negative (the sign bit is set).
+    */
+   VERIFY_CHECK((r->hi > 0x7fffffffffffffffu && (uint64_t)hi > 0x7fffffffffffffffu) <= (r->hi + (uint64_t)hi > 0x7fffffffffffffffu));
+   r->hi += hi;
+}
+
+static SECP256K1_INLINE void secp256k1_i128_dissip_mul(secp256k1_int128 *r, int64_t a, int64_t b) {
+   int64_t hi;
+   uint64_t lo = (uint64_t)secp256k1_mul128(a, b, &hi);
+   hi += r->lo < lo;
+   /* Verify no overflow.
+    * If r represents a positive value (the sign bit is not set) and the value we are subtracting is a negative value (the sign bit is set),
+    * then we require that the resulting value also be positive (the sign bit is not set).
+    */
+   VERIFY_CHECK((r->hi <= 0x7fffffffffffffffu && (uint64_t)hi > 0x7fffffffffffffffu) <= (r->hi - (uint64_t)hi <= 0x7fffffffffffffffu));
+   /* Verify no underflow.
+    * If r represents a negative value (the sign bit is set) and the value we are subtracting is a positive value (the sign sign bit is not set),
+    * then we require that the resulting value also be negative (the sign bit is set).
+    */
+   VERIFY_CHECK((r->hi > 0x7fffffffffffffffu && (uint64_t)hi <= 0x7fffffffffffffffu) <= (r->hi - (uint64_t)hi > 0x7fffffffffffffffu));
+   r->hi -= hi;
+   r->lo -= lo;
+}
+
+static SECP256K1_INLINE void secp256k1_i128_det(secp256k1_int128 *r, int64_t a, int64_t b, int64_t c, int64_t d) {
+   secp256k1_i128_mul(r, a, d);
+   secp256k1_i128_dissip_mul(r, b, c);
+}
+
+/* Signed (arithmetic) right shift.
+ * Non-constant time in n.
+ */
+static SECP256K1_INLINE void secp256k1_i128_rshift(secp256k1_int128 *r, unsigned int n) {
+   VERIFY_CHECK(n < 128);
+   if (n >= 64) {
+     r->lo = (uint64_t)((int64_t)(r->hi) >> (n-64));
+     r->hi = (uint64_t)((int64_t)(r->hi) >> 63);
+   } else if (n > 0) {
+     r->lo = ((1U * r->hi) << (64-n)) | r->lo >> n;
+     r->hi = (uint64_t)((int64_t)(r->hi) >> n);
+   }
+}
+
+static SECP256K1_INLINE uint64_t secp256k1_i128_to_u64(const secp256k1_int128 *a) {
+   return a->lo;
+}
+
+static SECP256K1_INLINE int64_t secp256k1_i128_to_i64(const secp256k1_int128 *a) {
+   /* Verify that a represents a 64 bit signed value by checking that the high bits are a sign extension of the low bits. */
+   VERIFY_CHECK(a->hi == -(a->lo >> 63));
+   return (int64_t)secp256k1_i128_to_u64(a);
+}
+
+static SECP256K1_INLINE void secp256k1_i128_from_i64(secp256k1_int128 *r, int64_t a) {
+   r->hi = (uint64_t)(a >> 63);
+   r->lo = (uint64_t)a;
+}
+
+static SECP256K1_INLINE int secp256k1_i128_eq_var(const secp256k1_int128 *a, const secp256k1_int128 *b) {
+   return a->hi == b->hi && a->lo == b->lo;
+}
+
+static SECP256K1_INLINE int secp256k1_i128_check_pow2(const secp256k1_int128 *r, unsigned int n, int sign) {
+    VERIFY_CHECK(n < 127);
+    VERIFY_CHECK(sign == 1 || sign == -1);
+    return n >= 64 ? r->hi == (uint64_t)sign << (n - 64) && r->lo == 0
+                   : r->hi == (uint64_t)(sign >> 1) && r->lo == (uint64_t)sign << n;
+}
+
+#endif
diff --git a/vendor/external/secp256k1/src/modinv32.h b/vendor/external/secp256k1/src/modinv32.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/modinv32.h
@@ -0,0 +1,43 @@
+/***********************************************************************
+ * Copyright (c) 2020 Peter Dettman                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ **********************************************************************/
+
+#ifndef SECP256K1_MODINV32_H
+#define SECP256K1_MODINV32_H
+
+#include "util.h"
+
+/* A signed 30-bit limb representation of integers.
+ *
+ * Its value is sum(v[i] * 2^(30*i), i=0..8). */
+typedef struct {
+    int32_t v[9];
+} secp256k1_modinv32_signed30;
+
+typedef struct {
+    /* The modulus in signed30 notation, must be odd and in [3, 2^256]. */
+    secp256k1_modinv32_signed30 modulus;
+
+    /* modulus^{-1} mod 2^30 */
+    uint32_t modulus_inv30;
+} secp256k1_modinv32_modinfo;
+
+/* Replace x with its modular inverse mod modinfo->modulus. x must be in range [0, modulus).
+ * If x is zero, the result will be zero as well. If not, the inverse must exist (i.e., the gcd of
+ * x and modulus must be 1). These rules are automatically satisfied if the modulus is prime.
+ *
+ * On output, all of x's limbs will be in [0, 2^30).
+ */
+static void secp256k1_modinv32_var(secp256k1_modinv32_signed30 *x, const secp256k1_modinv32_modinfo *modinfo);
+
+/* Same as secp256k1_modinv32_var, but constant time in x (not in the modulus). */
+static void secp256k1_modinv32(secp256k1_modinv32_signed30 *x, const secp256k1_modinv32_modinfo *modinfo);
+
+/* Compute the Jacobi symbol for (x | modinfo->modulus). x must be coprime with modulus (and thus
+ * cannot be 0, as modulus >= 3). All limbs of x must be non-negative. Returns 0 if the result
+ * cannot be computed. */
+static int secp256k1_jacobi32_maybe_var(const secp256k1_modinv32_signed30 *x, const secp256k1_modinv32_modinfo *modinfo);
+
+#endif /* SECP256K1_MODINV32_H */
diff --git a/vendor/external/secp256k1/src/modinv32_impl.h b/vendor/external/secp256k1/src/modinv32_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/modinv32_impl.h
@@ -0,0 +1,725 @@
+/***********************************************************************
+ * Copyright (c) 2020 Peter Dettman                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ **********************************************************************/
+
+#ifndef SECP256K1_MODINV32_IMPL_H
+#define SECP256K1_MODINV32_IMPL_H
+
+#include "modinv32.h"
+
+#include "util.h"
+
+#include <stdlib.h>
+
+/* This file implements modular inversion based on the paper "Fast constant-time gcd computation and
+ * modular inversion" by Daniel J. Bernstein and Bo-Yin Yang.
+ *
+ * For an explanation of the algorithm, see doc/safegcd_implementation.md. This file contains an
+ * implementation for N=30, using 30-bit signed limbs represented as int32_t.
+ */
+
+#ifdef VERIFY
+static const secp256k1_modinv32_signed30 SECP256K1_SIGNED30_ONE = {{1}};
+
+/* Compute a*factor and put it in r. All but the top limb in r will be in range [0,2^30). */
+static void secp256k1_modinv32_mul_30(secp256k1_modinv32_signed30 *r, const secp256k1_modinv32_signed30 *a, int alen, int32_t factor) {
+    const int32_t M30 = (int32_t)(UINT32_MAX >> 2);
+    int64_t c = 0;
+    int i;
+    for (i = 0; i < 8; ++i) {
+        if (i < alen) c += (int64_t)a->v[i] * factor;
+        r->v[i] = (int32_t)c & M30; c >>= 30;
+    }
+    if (8 < alen) c += (int64_t)a->v[8] * factor;
+    VERIFY_CHECK(c == (int32_t)c);
+    r->v[8] = (int32_t)c;
+}
+
+/* Return -1 for a<b*factor, 0 for a==b*factor, 1 for a>b*factor. A consists of alen limbs; b has 9. */
+static int secp256k1_modinv32_mul_cmp_30(const secp256k1_modinv32_signed30 *a, int alen, const secp256k1_modinv32_signed30 *b, int32_t factor) {
+    int i;
+    secp256k1_modinv32_signed30 am, bm;
+    secp256k1_modinv32_mul_30(&am, a, alen, 1); /* Normalize all but the top limb of a. */
+    secp256k1_modinv32_mul_30(&bm, b, 9, factor);
+    for (i = 0; i < 8; ++i) {
+        /* Verify that all but the top limb of a and b are normalized. */
+        VERIFY_CHECK(am.v[i] >> 30 == 0);
+        VERIFY_CHECK(bm.v[i] >> 30 == 0);
+    }
+    for (i = 8; i >= 0; --i) {
+        if (am.v[i] < bm.v[i]) return -1;
+        if (am.v[i] > bm.v[i]) return 1;
+    }
+    return 0;
+}
+#endif
+
+/* Take as input a signed30 number in range (-2*modulus,modulus), and add a multiple of the modulus
+ * to it to bring it to range [0,modulus). If sign < 0, the input will also be negated in the
+ * process. The input must have limbs in range (-2^30,2^30). The output will have limbs in range
+ * [0,2^30). */
+static void secp256k1_modinv32_normalize_30(secp256k1_modinv32_signed30 *r, int32_t sign, const secp256k1_modinv32_modinfo *modinfo) {
+    const int32_t M30 = (int32_t)(UINT32_MAX >> 2);
+    int32_t r0 = r->v[0], r1 = r->v[1], r2 = r->v[2], r3 = r->v[3], r4 = r->v[4],
+            r5 = r->v[5], r6 = r->v[6], r7 = r->v[7], r8 = r->v[8];
+    volatile int32_t cond_add, cond_negate;
+
+#ifdef VERIFY
+    /* Verify that all limbs are in range (-2^30,2^30). */
+    int i;
+    for (i = 0; i < 9; ++i) {
+        VERIFY_CHECK(r->v[i] >= -M30);
+        VERIFY_CHECK(r->v[i] <= M30);
+    }
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(r, 9, &modinfo->modulus, -2) > 0); /* r > -2*modulus */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(r, 9, &modinfo->modulus, 1) < 0); /* r < modulus */
+#endif
+
+    /* In a first step, add the modulus if the input is negative, and then negate if requested.
+     * This brings r from range (-2*modulus,modulus) to range (-modulus,modulus). As all input
+     * limbs are in range (-2^30,2^30), this cannot overflow an int32_t. Note that the right
+     * shifts below are signed sign-extending shifts (see assumptions.h for tests that that is
+     * indeed the behavior of the right shift operator). */
+    cond_add = r8 >> 31;
+    r0 += modinfo->modulus.v[0] & cond_add;
+    r1 += modinfo->modulus.v[1] & cond_add;
+    r2 += modinfo->modulus.v[2] & cond_add;
+    r3 += modinfo->modulus.v[3] & cond_add;
+    r4 += modinfo->modulus.v[4] & cond_add;
+    r5 += modinfo->modulus.v[5] & cond_add;
+    r6 += modinfo->modulus.v[6] & cond_add;
+    r7 += modinfo->modulus.v[7] & cond_add;
+    r8 += modinfo->modulus.v[8] & cond_add;
+    cond_negate = sign >> 31;
+    r0 = (r0 ^ cond_negate) - cond_negate;
+    r1 = (r1 ^ cond_negate) - cond_negate;
+    r2 = (r2 ^ cond_negate) - cond_negate;
+    r3 = (r3 ^ cond_negate) - cond_negate;
+    r4 = (r4 ^ cond_negate) - cond_negate;
+    r5 = (r5 ^ cond_negate) - cond_negate;
+    r6 = (r6 ^ cond_negate) - cond_negate;
+    r7 = (r7 ^ cond_negate) - cond_negate;
+    r8 = (r8 ^ cond_negate) - cond_negate;
+    /* Propagate the top bits, to bring limbs back to range (-2^30,2^30). */
+    r1 += r0 >> 30; r0 &= M30;
+    r2 += r1 >> 30; r1 &= M30;
+    r3 += r2 >> 30; r2 &= M30;
+    r4 += r3 >> 30; r3 &= M30;
+    r5 += r4 >> 30; r4 &= M30;
+    r6 += r5 >> 30; r5 &= M30;
+    r7 += r6 >> 30; r6 &= M30;
+    r8 += r7 >> 30; r7 &= M30;
+
+    /* In a second step add the modulus again if the result is still negative, bringing r to range
+     * [0,modulus). */
+    cond_add = r8 >> 31;
+    r0 += modinfo->modulus.v[0] & cond_add;
+    r1 += modinfo->modulus.v[1] & cond_add;
+    r2 += modinfo->modulus.v[2] & cond_add;
+    r3 += modinfo->modulus.v[3] & cond_add;
+    r4 += modinfo->modulus.v[4] & cond_add;
+    r5 += modinfo->modulus.v[5] & cond_add;
+    r6 += modinfo->modulus.v[6] & cond_add;
+    r7 += modinfo->modulus.v[7] & cond_add;
+    r8 += modinfo->modulus.v[8] & cond_add;
+    /* And propagate again. */
+    r1 += r0 >> 30; r0 &= M30;
+    r2 += r1 >> 30; r1 &= M30;
+    r3 += r2 >> 30; r2 &= M30;
+    r4 += r3 >> 30; r3 &= M30;
+    r5 += r4 >> 30; r4 &= M30;
+    r6 += r5 >> 30; r5 &= M30;
+    r7 += r6 >> 30; r6 &= M30;
+    r8 += r7 >> 30; r7 &= M30;
+
+    r->v[0] = r0;
+    r->v[1] = r1;
+    r->v[2] = r2;
+    r->v[3] = r3;
+    r->v[4] = r4;
+    r->v[5] = r5;
+    r->v[6] = r6;
+    r->v[7] = r7;
+    r->v[8] = r8;
+
+    VERIFY_CHECK(r0 >> 30 == 0);
+    VERIFY_CHECK(r1 >> 30 == 0);
+    VERIFY_CHECK(r2 >> 30 == 0);
+    VERIFY_CHECK(r3 >> 30 == 0);
+    VERIFY_CHECK(r4 >> 30 == 0);
+    VERIFY_CHECK(r5 >> 30 == 0);
+    VERIFY_CHECK(r6 >> 30 == 0);
+    VERIFY_CHECK(r7 >> 30 == 0);
+    VERIFY_CHECK(r8 >> 30 == 0);
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(r, 9, &modinfo->modulus, 0) >= 0); /* r >= 0 */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(r, 9, &modinfo->modulus, 1) < 0); /* r < modulus */
+}
+
+/* Data type for transition matrices (see section 3 of explanation).
+ *
+ * t = [ u  v ]
+ *     [ q  r ]
+ */
+typedef struct {
+    int32_t u, v, q, r;
+} secp256k1_modinv32_trans2x2;
+
+/* Compute the transition matrix and zeta for 30 divsteps.
+ *
+ * Input:  zeta: initial zeta
+ *         f0:   bottom limb of initial f
+ *         g0:   bottom limb of initial g
+ * Output: t: transition matrix
+ * Return: final zeta
+ *
+ * Implements the divsteps_n_matrix function from the explanation.
+ */
+static int32_t secp256k1_modinv32_divsteps_30(int32_t zeta, uint32_t f0, uint32_t g0, secp256k1_modinv32_trans2x2 *t) {
+    /* u,v,q,r are the elements of the transformation matrix being built up,
+     * starting with the identity matrix. Semantically they are signed integers
+     * in range [-2^30,2^30], but here represented as unsigned mod 2^32. This
+     * permits left shifting (which is UB for negative numbers). The range
+     * being inside [-2^31,2^31) means that casting to signed works correctly.
+     */
+    uint32_t u = 1, v = 0, q = 0, r = 1;
+    volatile uint32_t c1, c2;
+    uint32_t mask1, mask2, f = f0, g = g0, x, y, z;
+    int i;
+
+    for (i = 0; i < 30; ++i) {
+        VERIFY_CHECK((f & 1) == 1); /* f must always be odd */
+        VERIFY_CHECK((u * f0 + v * g0) == f << i);
+        VERIFY_CHECK((q * f0 + r * g0) == g << i);
+        /* Compute conditional masks for (zeta < 0) and for (g & 1). */
+        c1 = zeta >> 31;
+        mask1 = c1;
+        c2 = g & 1;
+        mask2 = -c2;
+        /* Compute x,y,z, conditionally negated versions of f,u,v. */
+        x = (f ^ mask1) - mask1;
+        y = (u ^ mask1) - mask1;
+        z = (v ^ mask1) - mask1;
+        /* Conditionally add x,y,z to g,q,r. */
+        g += x & mask2;
+        q += y & mask2;
+        r += z & mask2;
+        /* In what follows, mask1 is a condition mask for (zeta < 0) and (g & 1). */
+        mask1 &= mask2;
+        /* Conditionally change zeta into -zeta-2 or zeta-1. */
+        zeta = (zeta ^ mask1) - 1;
+        /* Conditionally add g,q,r to f,u,v. */
+        f += g & mask1;
+        u += q & mask1;
+        v += r & mask1;
+        /* Shifts */
+        g >>= 1;
+        u <<= 1;
+        v <<= 1;
+        /* Bounds on zeta that follow from the bounds on iteration count (max 20*30 divsteps). */
+        VERIFY_CHECK(zeta >= -601 && zeta <= 601);
+    }
+    /* Return data in t and return value. */
+    t->u = (int32_t)u;
+    t->v = (int32_t)v;
+    t->q = (int32_t)q;
+    t->r = (int32_t)r;
+    /* The determinant of t must be a power of two. This guarantees that multiplication with t
+     * does not change the gcd of f and g, apart from adding a power-of-2 factor to it (which
+     * will be divided out again). As each divstep's individual matrix has determinant 2, the
+     * aggregate of 30 of them will have determinant 2^30. */
+    VERIFY_CHECK((int64_t)t->u * t->r - (int64_t)t->v * t->q == ((int64_t)1) << 30);
+    return zeta;
+}
+
+/* secp256k1_modinv32_inv256[i] = -(2*i+1)^-1 (mod 256) */
+static const uint8_t secp256k1_modinv32_inv256[128] = {
+    0xFF, 0x55, 0x33, 0x49, 0xC7, 0x5D, 0x3B, 0x11, 0x0F, 0xE5, 0xC3, 0x59,
+    0xD7, 0xED, 0xCB, 0x21, 0x1F, 0x75, 0x53, 0x69, 0xE7, 0x7D, 0x5B, 0x31,
+    0x2F, 0x05, 0xE3, 0x79, 0xF7, 0x0D, 0xEB, 0x41, 0x3F, 0x95, 0x73, 0x89,
+    0x07, 0x9D, 0x7B, 0x51, 0x4F, 0x25, 0x03, 0x99, 0x17, 0x2D, 0x0B, 0x61,
+    0x5F, 0xB5, 0x93, 0xA9, 0x27, 0xBD, 0x9B, 0x71, 0x6F, 0x45, 0x23, 0xB9,
+    0x37, 0x4D, 0x2B, 0x81, 0x7F, 0xD5, 0xB3, 0xC9, 0x47, 0xDD, 0xBB, 0x91,
+    0x8F, 0x65, 0x43, 0xD9, 0x57, 0x6D, 0x4B, 0xA1, 0x9F, 0xF5, 0xD3, 0xE9,
+    0x67, 0xFD, 0xDB, 0xB1, 0xAF, 0x85, 0x63, 0xF9, 0x77, 0x8D, 0x6B, 0xC1,
+    0xBF, 0x15, 0xF3, 0x09, 0x87, 0x1D, 0xFB, 0xD1, 0xCF, 0xA5, 0x83, 0x19,
+    0x97, 0xAD, 0x8B, 0xE1, 0xDF, 0x35, 0x13, 0x29, 0xA7, 0x3D, 0x1B, 0xF1,
+    0xEF, 0xC5, 0xA3, 0x39, 0xB7, 0xCD, 0xAB, 0x01
+};
+
+/* Compute the transition matrix and eta for 30 divsteps (variable time).
+ *
+ * Input:  eta: initial eta
+ *         f0:  bottom limb of initial f
+ *         g0:  bottom limb of initial g
+ * Output: t: transition matrix
+ * Return: final eta
+ *
+ * Implements the divsteps_n_matrix_var function from the explanation.
+ */
+static int32_t secp256k1_modinv32_divsteps_30_var(int32_t eta, uint32_t f0, uint32_t g0, secp256k1_modinv32_trans2x2 *t) {
+    /* Transformation matrix; see comments in secp256k1_modinv32_divsteps_30. */
+    uint32_t u = 1, v = 0, q = 0, r = 1;
+    uint32_t f = f0, g = g0, m;
+    uint16_t w;
+    int i = 30, limit, zeros;
+
+    for (;;) {
+        /* Use a sentinel bit to count zeros only up to i. */
+        zeros = secp256k1_ctz32_var(g | (UINT32_MAX << i));
+        /* Perform zeros divsteps at once; they all just divide g by two. */
+        g >>= zeros;
+        u <<= zeros;
+        v <<= zeros;
+        eta -= zeros;
+        i -= zeros;
+         /* We're done once we've done 30 divsteps. */
+        if (i == 0) break;
+        VERIFY_CHECK((f & 1) == 1);
+        VERIFY_CHECK((g & 1) == 1);
+        VERIFY_CHECK((u * f0 + v * g0) == f << (30 - i));
+        VERIFY_CHECK((q * f0 + r * g0) == g << (30 - i));
+        /* Bounds on eta that follow from the bounds on iteration count (max 25*30 divsteps). */
+        VERIFY_CHECK(eta >= -751 && eta <= 751);
+        /* If eta is negative, negate it and replace f,g with g,-f. */
+        if (eta < 0) {
+            uint32_t tmp;
+            eta = -eta;
+            tmp = f; f = g; g = -tmp;
+            tmp = u; u = q; q = -tmp;
+            tmp = v; v = r; r = -tmp;
+        }
+        /* eta is now >= 0. In what follows we're going to cancel out the bottom bits of g. No more
+         * than i can be cancelled out (as we'd be done before that point), and no more than eta+1
+         * can be done as its sign will flip once that happens. */
+        limit = ((int)eta + 1) > i ? i : ((int)eta + 1);
+        /* m is a mask for the bottom min(limit, 8) bits (our table only supports 8 bits). */
+        VERIFY_CHECK(limit > 0 && limit <= 30);
+        m = (UINT32_MAX >> (32 - limit)) & 255U;
+        /* Find what multiple of f must be added to g to cancel its bottom min(limit, 8) bits. */
+        w = (g * secp256k1_modinv32_inv256[(f >> 1) & 127]) & m;
+        /* Do so. */
+        g += f * w;
+        q += u * w;
+        r += v * w;
+        VERIFY_CHECK((g & m) == 0);
+    }
+    /* Return data in t and return value. */
+    t->u = (int32_t)u;
+    t->v = (int32_t)v;
+    t->q = (int32_t)q;
+    t->r = (int32_t)r;
+    /* The determinant of t must be a power of two. This guarantees that multiplication with t
+     * does not change the gcd of f and g, apart from adding a power-of-2 factor to it (which
+     * will be divided out again). As each divstep's individual matrix has determinant 2, the
+     * aggregate of 30 of them will have determinant 2^30. */
+    VERIFY_CHECK((int64_t)t->u * t->r - (int64_t)t->v * t->q == ((int64_t)1) << 30);
+    return eta;
+}
+
+/* Compute the transition matrix and eta for 30 posdivsteps (variable time, eta=-delta), and keeps track
+ * of the Jacobi symbol along the way. f0 and g0 must be f and g mod 2^32 rather than 2^30, because
+ * Jacobi tracking requires knowing (f mod 8) rather than just (f mod 2).
+ *
+ * Input:        eta: initial eta
+ *               f0:  bottom limb of initial f
+ *               g0:  bottom limb of initial g
+ * Output:       t: transition matrix
+ * Input/Output: (*jacp & 1) is bitflipped if and only if the Jacobi symbol of (f | g) changes sign
+ *               by applying the returned transformation matrix to it. The other bits of *jacp may
+ *               change, but are meaningless.
+ * Return: final eta
+ */
+static int32_t secp256k1_modinv32_posdivsteps_30_var(int32_t eta, uint32_t f0, uint32_t g0, secp256k1_modinv32_trans2x2 *t, int *jacp) {
+    /* Transformation matrix. */
+    uint32_t u = 1, v = 0, q = 0, r = 1;
+    uint32_t f = f0, g = g0, m;
+    uint16_t w;
+    int i = 30, limit, zeros;
+    int jac = *jacp;
+
+    for (;;) {
+        /* Use a sentinel bit to count zeros only up to i. */
+        zeros = secp256k1_ctz32_var(g | (UINT32_MAX << i));
+        /* Perform zeros divsteps at once; they all just divide g by two. */
+        g >>= zeros;
+        u <<= zeros;
+        v <<= zeros;
+        eta -= zeros;
+        i -= zeros;
+        /* Update the bottom bit of jac: when dividing g by an odd power of 2,
+         * if (f mod 8) is 3 or 5, the Jacobi symbol changes sign. */
+        jac ^= (zeros & ((f >> 1) ^ (f >> 2)));
+        /* We're done once we've done 30 posdivsteps. */
+        if (i == 0) break;
+        VERIFY_CHECK((f & 1) == 1);
+        VERIFY_CHECK((g & 1) == 1);
+        VERIFY_CHECK((u * f0 + v * g0) == f << (30 - i));
+        VERIFY_CHECK((q * f0 + r * g0) == g << (30 - i));
+        /* If eta is negative, negate it and replace f,g with g,f. */
+        if (eta < 0) {
+            uint32_t tmp;
+            eta = -eta;
+            /* Update bottom bit of jac: when swapping f and g, the Jacobi symbol changes sign
+             * if both f and g are 3 mod 4. */
+            jac ^= ((f & g) >> 1);
+            tmp = f; f = g; g = tmp;
+            tmp = u; u = q; q = tmp;
+            tmp = v; v = r; r = tmp;
+        }
+        /* eta is now >= 0. In what follows we're going to cancel out the bottom bits of g. No more
+         * than i can be cancelled out (as we'd be done before that point), and no more than eta+1
+         * can be done as its sign will flip once that happens. */
+        limit = ((int)eta + 1) > i ? i : ((int)eta + 1);
+        /* m is a mask for the bottom min(limit, 8) bits (our table only supports 8 bits). */
+        VERIFY_CHECK(limit > 0 && limit <= 30);
+        m = (UINT32_MAX >> (32 - limit)) & 255U;
+        /* Find what multiple of f must be added to g to cancel its bottom min(limit, 8) bits. */
+        w = (g * secp256k1_modinv32_inv256[(f >> 1) & 127]) & m;
+        /* Do so. */
+        g += f * w;
+        q += u * w;
+        r += v * w;
+        VERIFY_CHECK((g & m) == 0);
+    }
+    /* Return data in t and return value. */
+    t->u = (int32_t)u;
+    t->v = (int32_t)v;
+    t->q = (int32_t)q;
+    t->r = (int32_t)r;
+    /* The determinant of t must be a power of two. This guarantees that multiplication with t
+     * does not change the gcd of f and g, apart from adding a power-of-2 factor to it (which
+     * will be divided out again). As each divstep's individual matrix has determinant 2 or -2,
+     * the aggregate of 30 of them will have determinant 2^30 or -2^30. */
+    VERIFY_CHECK((int64_t)t->u * t->r - (int64_t)t->v * t->q == ((int64_t)1) << 30 ||
+                 (int64_t)t->u * t->r - (int64_t)t->v * t->q == -(((int64_t)1) << 30));
+    *jacp = jac;
+    return eta;
+}
+
+/* Compute (t/2^30) * [d, e] mod modulus, where t is a transition matrix for 30 divsteps.
+ *
+ * On input and output, d and e are in range (-2*modulus,modulus). All output limbs will be in range
+ * (-2^30,2^30).
+ *
+ * This implements the update_de function from the explanation.
+ */
+static void secp256k1_modinv32_update_de_30(secp256k1_modinv32_signed30 *d, secp256k1_modinv32_signed30 *e, const secp256k1_modinv32_trans2x2 *t, const secp256k1_modinv32_modinfo* modinfo) {
+    const int32_t M30 = (int32_t)(UINT32_MAX >> 2);
+    const int32_t u = t->u, v = t->v, q = t->q, r = t->r;
+    int32_t di, ei, md, me, sd, se;
+    int64_t cd, ce;
+    int i;
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(d, 9, &modinfo->modulus, -2) > 0); /* d > -2*modulus */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(d, 9, &modinfo->modulus, 1) < 0);  /* d <    modulus */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(e, 9, &modinfo->modulus, -2) > 0); /* e > -2*modulus */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(e, 9, &modinfo->modulus, 1) < 0);  /* e <    modulus */
+    VERIFY_CHECK(labs(u) <= (M30 + 1 - labs(v))); /* |u|+|v| <= 2^30 */
+    VERIFY_CHECK(labs(q) <= (M30 + 1 - labs(r))); /* |q|+|r| <= 2^30 */
+
+    /* [md,me] start as zero; plus [u,q] if d is negative; plus [v,r] if e is negative. */
+    sd = d->v[8] >> 31;
+    se = e->v[8] >> 31;
+    md = (u & sd) + (v & se);
+    me = (q & sd) + (r & se);
+    /* Begin computing t*[d,e]. */
+    di = d->v[0];
+    ei = e->v[0];
+    cd = (int64_t)u * di + (int64_t)v * ei;
+    ce = (int64_t)q * di + (int64_t)r * ei;
+    /* Correct md,me so that t*[d,e]+modulus*[md,me] has 30 zero bottom bits. */
+    md -= (modinfo->modulus_inv30 * (uint32_t)cd + md) & M30;
+    me -= (modinfo->modulus_inv30 * (uint32_t)ce + me) & M30;
+    /* Update the beginning of computation for t*[d,e]+modulus*[md,me] now md,me are known. */
+    cd += (int64_t)modinfo->modulus.v[0] * md;
+    ce += (int64_t)modinfo->modulus.v[0] * me;
+    /* Verify that the low 30 bits of the computation are indeed zero, and then throw them away. */
+    VERIFY_CHECK(((int32_t)cd & M30) == 0); cd >>= 30;
+    VERIFY_CHECK(((int32_t)ce & M30) == 0); ce >>= 30;
+    /* Now iteratively compute limb i=1..8 of t*[d,e]+modulus*[md,me], and store them in output
+     * limb i-1 (shifting down by 30 bits). */
+    for (i = 1; i < 9; ++i) {
+        di = d->v[i];
+        ei = e->v[i];
+        cd += (int64_t)u * di + (int64_t)v * ei;
+        ce += (int64_t)q * di + (int64_t)r * ei;
+        cd += (int64_t)modinfo->modulus.v[i] * md;
+        ce += (int64_t)modinfo->modulus.v[i] * me;
+        d->v[i - 1] = (int32_t)cd & M30; cd >>= 30;
+        e->v[i - 1] = (int32_t)ce & M30; ce >>= 30;
+    }
+    /* What remains is limb 9 of t*[d,e]+modulus*[md,me]; store it as output limb 8. */
+    d->v[8] = (int32_t)cd;
+    e->v[8] = (int32_t)ce;
+
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(d, 9, &modinfo->modulus, -2) > 0); /* d > -2*modulus */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(d, 9, &modinfo->modulus, 1) < 0);  /* d <    modulus */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(e, 9, &modinfo->modulus, -2) > 0); /* e > -2*modulus */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(e, 9, &modinfo->modulus, 1) < 0);  /* e <    modulus */
+}
+
+/* Compute (t/2^30) * [f, g], where t is a transition matrix for 30 divsteps.
+ *
+ * This implements the update_fg function from the explanation.
+ */
+static void secp256k1_modinv32_update_fg_30(secp256k1_modinv32_signed30 *f, secp256k1_modinv32_signed30 *g, const secp256k1_modinv32_trans2x2 *t) {
+    const int32_t M30 = (int32_t)(UINT32_MAX >> 2);
+    const int32_t u = t->u, v = t->v, q = t->q, r = t->r;
+    int32_t fi, gi;
+    int64_t cf, cg;
+    int i;
+    /* Start computing t*[f,g]. */
+    fi = f->v[0];
+    gi = g->v[0];
+    cf = (int64_t)u * fi + (int64_t)v * gi;
+    cg = (int64_t)q * fi + (int64_t)r * gi;
+    /* Verify that the bottom 30 bits of the result are zero, and then throw them away. */
+    VERIFY_CHECK(((int32_t)cf & M30) == 0); cf >>= 30;
+    VERIFY_CHECK(((int32_t)cg & M30) == 0); cg >>= 30;
+    /* Now iteratively compute limb i=1..8 of t*[f,g], and store them in output limb i-1 (shifting
+     * down by 30 bits). */
+    for (i = 1; i < 9; ++i) {
+        fi = f->v[i];
+        gi = g->v[i];
+        cf += (int64_t)u * fi + (int64_t)v * gi;
+        cg += (int64_t)q * fi + (int64_t)r * gi;
+        f->v[i - 1] = (int32_t)cf & M30; cf >>= 30;
+        g->v[i - 1] = (int32_t)cg & M30; cg >>= 30;
+    }
+    /* What remains is limb 9 of t*[f,g]; store it as output limb 8. */
+    f->v[8] = (int32_t)cf;
+    g->v[8] = (int32_t)cg;
+}
+
+/* Compute (t/2^30) * [f, g], where t is a transition matrix for 30 divsteps.
+ *
+ * Version that operates on a variable number of limbs in f and g.
+ *
+ * This implements the update_fg function from the explanation in modinv64_impl.h.
+ */
+static void secp256k1_modinv32_update_fg_30_var(int len, secp256k1_modinv32_signed30 *f, secp256k1_modinv32_signed30 *g, const secp256k1_modinv32_trans2x2 *t) {
+    const int32_t M30 = (int32_t)(UINT32_MAX >> 2);
+    const int32_t u = t->u, v = t->v, q = t->q, r = t->r;
+    int32_t fi, gi;
+    int64_t cf, cg;
+    int i;
+    VERIFY_CHECK(len > 0);
+    /* Start computing t*[f,g]. */
+    fi = f->v[0];
+    gi = g->v[0];
+    cf = (int64_t)u * fi + (int64_t)v * gi;
+    cg = (int64_t)q * fi + (int64_t)r * gi;
+    /* Verify that the bottom 62 bits of the result are zero, and then throw them away. */
+    VERIFY_CHECK(((int32_t)cf & M30) == 0); cf >>= 30;
+    VERIFY_CHECK(((int32_t)cg & M30) == 0); cg >>= 30;
+    /* Now iteratively compute limb i=1..len of t*[f,g], and store them in output limb i-1 (shifting
+     * down by 30 bits). */
+    for (i = 1; i < len; ++i) {
+        fi = f->v[i];
+        gi = g->v[i];
+        cf += (int64_t)u * fi + (int64_t)v * gi;
+        cg += (int64_t)q * fi + (int64_t)r * gi;
+        f->v[i - 1] = (int32_t)cf & M30; cf >>= 30;
+        g->v[i - 1] = (int32_t)cg & M30; cg >>= 30;
+    }
+    /* What remains is limb (len) of t*[f,g]; store it as output limb (len-1). */
+    f->v[len - 1] = (int32_t)cf;
+    g->v[len - 1] = (int32_t)cg;
+}
+
+/* Compute the inverse of x modulo modinfo->modulus, and replace x with it (constant time in x). */
+static void secp256k1_modinv32(secp256k1_modinv32_signed30 *x, const secp256k1_modinv32_modinfo *modinfo) {
+    /* Start with d=0, e=1, f=modulus, g=x, zeta=-1. */
+    secp256k1_modinv32_signed30 d = {{0}};
+    secp256k1_modinv32_signed30 e = {{1}};
+    secp256k1_modinv32_signed30 f = modinfo->modulus;
+    secp256k1_modinv32_signed30 g = *x;
+    int i;
+    int32_t zeta = -1; /* zeta = -(delta+1/2); delta is initially 1/2. */
+
+    /* Do 20 iterations of 30 divsteps each = 600 divsteps. 590 suffices for 256-bit inputs. */
+    for (i = 0; i < 20; ++i) {
+        /* Compute transition matrix and new zeta after 30 divsteps. */
+        secp256k1_modinv32_trans2x2 t;
+        zeta = secp256k1_modinv32_divsteps_30(zeta, f.v[0], g.v[0], &t);
+        /* Update d,e using that transition matrix. */
+        secp256k1_modinv32_update_de_30(&d, &e, &t, modinfo);
+        /* Update f,g using that transition matrix. */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, 9, &modinfo->modulus, -1) > 0); /* f > -modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, 9, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, 9, &modinfo->modulus, -1) > 0); /* g > -modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, 9, &modinfo->modulus, 1) < 0);  /* g <  modulus */
+
+        secp256k1_modinv32_update_fg_30(&f, &g, &t);
+
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, 9, &modinfo->modulus, -1) > 0); /* f > -modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, 9, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, 9, &modinfo->modulus, -1) > 0); /* g > -modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, 9, &modinfo->modulus, 1) < 0);  /* g <  modulus */
+    }
+
+    /* At this point sufficient iterations have been performed that g must have reached 0
+     * and (if g was not originally 0) f must now equal +/- GCD of the initial f, g
+     * values i.e. +/- 1, and d now contains +/- the modular inverse. */
+
+    /* g == 0 */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, 9, &SECP256K1_SIGNED30_ONE, 0) == 0);
+    /* |f| == 1, or (x == 0 and d == 0 and f == modulus) */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, 9, &SECP256K1_SIGNED30_ONE, -1) == 0 ||
+                 secp256k1_modinv32_mul_cmp_30(&f, 9, &SECP256K1_SIGNED30_ONE, 1) == 0 ||
+                 (secp256k1_modinv32_mul_cmp_30(x, 9, &SECP256K1_SIGNED30_ONE, 0) == 0 &&
+                  secp256k1_modinv32_mul_cmp_30(&d, 9, &SECP256K1_SIGNED30_ONE, 0) == 0 &&
+                  secp256k1_modinv32_mul_cmp_30(&f, 9, &modinfo->modulus, 1) == 0));
+
+    /* Optionally negate d, normalize to [0,modulus), and return it. */
+    secp256k1_modinv32_normalize_30(&d, f.v[8], modinfo);
+    *x = d;
+}
+
+/* Compute the inverse of x modulo modinfo->modulus, and replace x with it (variable time). */
+static void secp256k1_modinv32_var(secp256k1_modinv32_signed30 *x, const secp256k1_modinv32_modinfo *modinfo) {
+    /* Start with d=0, e=1, f=modulus, g=x, eta=-1. */
+    secp256k1_modinv32_signed30 d = {{0, 0, 0, 0, 0, 0, 0, 0, 0}};
+    secp256k1_modinv32_signed30 e = {{1, 0, 0, 0, 0, 0, 0, 0, 0}};
+    secp256k1_modinv32_signed30 f = modinfo->modulus;
+    secp256k1_modinv32_signed30 g = *x;
+#ifdef VERIFY
+    int i = 0;
+#endif
+    int j, len = 9;
+    int32_t eta = -1; /* eta = -delta; delta is initially 1 (faster for the variable-time code) */
+    int32_t cond, fn, gn;
+
+    /* Do iterations of 30 divsteps each until g=0. */
+    while (1) {
+        /* Compute transition matrix and new eta after 30 divsteps. */
+        secp256k1_modinv32_trans2x2 t;
+        eta = secp256k1_modinv32_divsteps_30_var(eta, f.v[0], g.v[0], &t);
+        /* Update d,e using that transition matrix. */
+        secp256k1_modinv32_update_de_30(&d, &e, &t, modinfo);
+        /* Update f,g using that transition matrix. */
+
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, len, &modinfo->modulus, -1) > 0); /* f > -modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, len, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, len, &modinfo->modulus, -1) > 0); /* g > -modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, len, &modinfo->modulus, 1) < 0);  /* g <  modulus */
+
+        secp256k1_modinv32_update_fg_30_var(len, &f, &g, &t);
+        /* If the bottom limb of g is 0, there is a chance g=0. */
+        if (g.v[0] == 0) {
+            cond = 0;
+            /* Check if all other limbs are also 0. */
+            for (j = 1; j < len; ++j) {
+                cond |= g.v[j];
+            }
+            /* If so, we're done. */
+            if (cond == 0) break;
+        }
+
+        /* Determine if len>1 and limb (len-1) of both f and g is 0 or -1. */
+        fn = f.v[len - 1];
+        gn = g.v[len - 1];
+        cond = ((int32_t)len - 2) >> 31;
+        cond |= fn ^ (fn >> 31);
+        cond |= gn ^ (gn >> 31);
+        /* If so, reduce length, propagating the sign of f and g's top limb into the one below. */
+        if (cond == 0) {
+            f.v[len - 2] |= (uint32_t)fn << 30;
+            g.v[len - 2] |= (uint32_t)gn << 30;
+            --len;
+        }
+
+        VERIFY_CHECK(++i < 25); /* We should never need more than 25*30 = 750 divsteps */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, len, &modinfo->modulus, -1) > 0); /* f > -modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, len, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, len, &modinfo->modulus, -1) > 0); /* g > -modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, len, &modinfo->modulus, 1) < 0);  /* g <  modulus */
+    }
+
+    /* At this point g is 0 and (if g was not originally 0) f must now equal +/- GCD of
+     * the initial f, g values i.e. +/- 1, and d now contains +/- the modular inverse. */
+
+    /* g == 0 */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, len, &SECP256K1_SIGNED30_ONE, 0) == 0);
+    /* |f| == 1, or (x == 0 and d == 0 and f == modulus) */
+    VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, len, &SECP256K1_SIGNED30_ONE, -1) == 0 ||
+                 secp256k1_modinv32_mul_cmp_30(&f, len, &SECP256K1_SIGNED30_ONE, 1) == 0 ||
+                 (secp256k1_modinv32_mul_cmp_30(x, 9, &SECP256K1_SIGNED30_ONE, 0) == 0 &&
+                  secp256k1_modinv32_mul_cmp_30(&d, 9, &SECP256K1_SIGNED30_ONE, 0) == 0 &&
+                  secp256k1_modinv32_mul_cmp_30(&f, len, &modinfo->modulus, 1) == 0));
+
+    /* Optionally negate d, normalize to [0,modulus), and return it. */
+    secp256k1_modinv32_normalize_30(&d, f.v[len - 1], modinfo);
+    *x = d;
+}
+
+/* Do up to 50 iterations of 30 posdivsteps (up to 1500 steps; more is extremely rare) each until f=1.
+ * In VERIFY mode use a lower number of iterations (750, close to the median 756), so failure actually occurs. */
+#ifdef VERIFY
+#define JACOBI32_ITERATIONS 25
+#else
+#define JACOBI32_ITERATIONS 50
+#endif
+
+/* Compute the Jacobi symbol of x modulo modinfo->modulus (variable time). gcd(x,modulus) must be 1. */
+static int secp256k1_jacobi32_maybe_var(const secp256k1_modinv32_signed30 *x, const secp256k1_modinv32_modinfo *modinfo) {
+    /* Start with f=modulus, g=x, eta=-1. */
+    secp256k1_modinv32_signed30 f = modinfo->modulus;
+    secp256k1_modinv32_signed30 g = *x;
+    int j, len = 9;
+    int32_t eta = -1; /* eta = -delta; delta is initially 1 */
+    int32_t cond, fn, gn;
+    int jac = 0;
+    int count;
+
+    /* The input limbs must all be non-negative. */
+    VERIFY_CHECK(g.v[0] >= 0 && g.v[1] >= 0 && g.v[2] >= 0 && g.v[3] >= 0 && g.v[4] >= 0 && g.v[5] >= 0 && g.v[6] >= 0 && g.v[7] >= 0 && g.v[8] >= 0);
+
+    /* If x > 0, then if the loop below converges, it converges to f=g=gcd(x,modulus). Since we
+     * require that gcd(x,modulus)=1 and modulus>=3, x cannot be 0. Thus, we must reach f=1 (or
+     * time out). */
+    VERIFY_CHECK((g.v[0] | g.v[1] | g.v[2] | g.v[3] | g.v[4] | g.v[5] | g.v[6] | g.v[7] | g.v[8]) != 0);
+
+    for (count = 0; count < JACOBI32_ITERATIONS; ++count) {
+        /* Compute transition matrix and new eta after 30 posdivsteps. */
+        secp256k1_modinv32_trans2x2 t;
+        eta = secp256k1_modinv32_posdivsteps_30_var(eta, f.v[0] | ((uint32_t)f.v[1] << 30), g.v[0] | ((uint32_t)g.v[1] << 30), &t, &jac);
+        /* Update f,g using that transition matrix. */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, len, &modinfo->modulus, 0) > 0); /* f > 0 */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, len, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, len, &modinfo->modulus, 0) > 0); /* g > 0 */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, len, &modinfo->modulus, 1) < 0);  /* g < modulus */
+
+        secp256k1_modinv32_update_fg_30_var(len, &f, &g, &t);
+        /* If the bottom limb of f is 1, there is a chance that f=1. */
+        if (f.v[0] == 1) {
+            cond = 0;
+            /* Check if the other limbs are also 0. */
+            for (j = 1; j < len; ++j) {
+                cond |= f.v[j];
+            }
+            /* If so, we're done. If f=1, the Jacobi symbol (g | f)=1. */
+            if (cond == 0) return 1 - 2*(jac & 1);
+        }
+
+        /* Determine if len>1 and limb (len-1) of both f and g is 0. */
+        fn = f.v[len - 1];
+        gn = g.v[len - 1];
+        cond = ((int32_t)len - 2) >> 31;
+        cond |= fn;
+        cond |= gn;
+        /* If so, reduce length. */
+        if (cond == 0) --len;
+
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, len, &modinfo->modulus, 0) > 0); /* f > 0 */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&f, len, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, len, &modinfo->modulus, 0) > 0); /* g > 0 */
+        VERIFY_CHECK(secp256k1_modinv32_mul_cmp_30(&g, len, &modinfo->modulus, 1) < 0);  /* g < modulus */
+    }
+
+    /* The loop failed to converge to f=g after 1500 iterations. Return 0, indicating unknown result. */
+    return 0;
+}
+
+#endif /* SECP256K1_MODINV32_IMPL_H */
diff --git a/vendor/external/secp256k1/src/modinv64.h b/vendor/external/secp256k1/src/modinv64.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/modinv64.h
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2020 Peter Dettman                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ **********************************************************************/
+
+#ifndef SECP256K1_MODINV64_H
+#define SECP256K1_MODINV64_H
+
+#include "util.h"
+
+#ifndef SECP256K1_WIDEMUL_INT128
+#error "modinv64 requires 128-bit wide multiplication support"
+#endif
+
+/* A signed 62-bit limb representation of integers.
+ *
+ * Its value is sum(v[i] * 2^(62*i), i=0..4). */
+typedef struct {
+    int64_t v[5];
+} secp256k1_modinv64_signed62;
+
+typedef struct {
+    /* The modulus in signed62 notation, must be odd and in [3, 2^256]. */
+    secp256k1_modinv64_signed62 modulus;
+
+    /* modulus^{-1} mod 2^62 */
+    uint64_t modulus_inv62;
+} secp256k1_modinv64_modinfo;
+
+/* Replace x with its modular inverse mod modinfo->modulus. x must be in range [0, modulus).
+ * If x is zero, the result will be zero as well. If not, the inverse must exist (i.e., the gcd of
+ * x and modulus must be 1). These rules are automatically satisfied if the modulus is prime.
+ *
+ * On output, all of x's limbs will be in [0, 2^62).
+ */
+static void secp256k1_modinv64_var(secp256k1_modinv64_signed62 *x, const secp256k1_modinv64_modinfo *modinfo);
+
+/* Same as secp256k1_modinv64_var, but constant time in x (not in the modulus). */
+static void secp256k1_modinv64(secp256k1_modinv64_signed62 *x, const secp256k1_modinv64_modinfo *modinfo);
+
+/* Compute the Jacobi symbol for (x | modinfo->modulus). x must be coprime with modulus (and thus
+ * cannot be 0, as modulus >= 3). All limbs of x must be non-negative. Returns 0 if the result
+ * cannot be computed. */
+static int secp256k1_jacobi64_maybe_var(const secp256k1_modinv64_signed62 *x, const secp256k1_modinv64_modinfo *modinfo);
+
+#endif /* SECP256K1_MODINV64_H */
diff --git a/vendor/external/secp256k1/src/modinv64_impl.h b/vendor/external/secp256k1/src/modinv64_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/modinv64_impl.h
@@ -0,0 +1,780 @@
+/***********************************************************************
+ * Copyright (c) 2020 Peter Dettman                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ **********************************************************************/
+
+#ifndef SECP256K1_MODINV64_IMPL_H
+#define SECP256K1_MODINV64_IMPL_H
+
+#include "int128.h"
+#include "modinv64.h"
+
+/* This file implements modular inversion based on the paper "Fast constant-time gcd computation and
+ * modular inversion" by Daniel J. Bernstein and Bo-Yin Yang.
+ *
+ * For an explanation of the algorithm, see doc/safegcd_implementation.md. This file contains an
+ * implementation for N=62, using 62-bit signed limbs represented as int64_t.
+ */
+
+/* Data type for transition matrices (see section 3 of explanation).
+ *
+ * t = [ u  v ]
+ *     [ q  r ]
+ */
+typedef struct {
+    int64_t u, v, q, r;
+} secp256k1_modinv64_trans2x2;
+
+#ifdef VERIFY
+/* Helper function to compute the absolute value of an int64_t.
+ * (we don't use abs/labs/llabs as it depends on the int sizes). */
+static int64_t secp256k1_modinv64_abs(int64_t v) {
+    VERIFY_CHECK(v > INT64_MIN);
+    if (v < 0) return -v;
+    return v;
+}
+
+static const secp256k1_modinv64_signed62 SECP256K1_SIGNED62_ONE = {{1}};
+
+/* Compute a*factor and put it in r. All but the top limb in r will be in range [0,2^62). */
+static void secp256k1_modinv64_mul_62(secp256k1_modinv64_signed62 *r, const secp256k1_modinv64_signed62 *a, int alen, int64_t factor) {
+    const uint64_t M62 = UINT64_MAX >> 2;
+    secp256k1_int128 c, d;
+    int i;
+    secp256k1_i128_from_i64(&c, 0);
+    for (i = 0; i < 4; ++i) {
+        if (i < alen) secp256k1_i128_accum_mul(&c, a->v[i], factor);
+        r->v[i] = secp256k1_i128_to_u64(&c) & M62; secp256k1_i128_rshift(&c, 62);
+    }
+    if (4 < alen) secp256k1_i128_accum_mul(&c, a->v[4], factor);
+    secp256k1_i128_from_i64(&d, secp256k1_i128_to_i64(&c));
+    VERIFY_CHECK(secp256k1_i128_eq_var(&c, &d));
+    r->v[4] = secp256k1_i128_to_i64(&c);
+}
+
+/* Return -1 for a<b*factor, 0 for a==b*factor, 1 for a>b*factor. A has alen limbs; b has 5. */
+static int secp256k1_modinv64_mul_cmp_62(const secp256k1_modinv64_signed62 *a, int alen, const secp256k1_modinv64_signed62 *b, int64_t factor) {
+    int i;
+    secp256k1_modinv64_signed62 am, bm;
+    secp256k1_modinv64_mul_62(&am, a, alen, 1); /* Normalize all but the top limb of a. */
+    secp256k1_modinv64_mul_62(&bm, b, 5, factor);
+    for (i = 0; i < 4; ++i) {
+        /* Verify that all but the top limb of a and b are normalized. */
+        VERIFY_CHECK(am.v[i] >> 62 == 0);
+        VERIFY_CHECK(bm.v[i] >> 62 == 0);
+    }
+    for (i = 4; i >= 0; --i) {
+        if (am.v[i] < bm.v[i]) return -1;
+        if (am.v[i] > bm.v[i]) return 1;
+    }
+    return 0;
+}
+
+/* Check if the determinant of t is equal to 1 << n. If abs, check if |det t| == 1 << n. */
+static int secp256k1_modinv64_det_check_pow2(const secp256k1_modinv64_trans2x2 *t, unsigned int n, int abs) {
+    secp256k1_int128 a;
+    secp256k1_i128_det(&a, t->u, t->v, t->q, t->r);
+    if (secp256k1_i128_check_pow2(&a, n, 1)) return 1;
+    if (abs && secp256k1_i128_check_pow2(&a, n, -1)) return 1;
+    return 0;
+}
+#endif
+
+/* Take as input a signed62 number in range (-2*modulus,modulus), and add a multiple of the modulus
+ * to it to bring it to range [0,modulus). If sign < 0, the input will also be negated in the
+ * process. The input must have limbs in range (-2^62,2^62). The output will have limbs in range
+ * [0,2^62). */
+static void secp256k1_modinv64_normalize_62(secp256k1_modinv64_signed62 *r, int64_t sign, const secp256k1_modinv64_modinfo *modinfo) {
+    const int64_t M62 = (int64_t)(UINT64_MAX >> 2);
+    int64_t r0 = r->v[0], r1 = r->v[1], r2 = r->v[2], r3 = r->v[3], r4 = r->v[4];
+    volatile int64_t cond_add, cond_negate;
+
+#ifdef VERIFY
+    /* Verify that all limbs are in range (-2^62,2^62). */
+    int i;
+    for (i = 0; i < 5; ++i) {
+        VERIFY_CHECK(r->v[i] >= -M62);
+        VERIFY_CHECK(r->v[i] <= M62);
+    }
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(r, 5, &modinfo->modulus, -2) > 0); /* r > -2*modulus */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(r, 5, &modinfo->modulus, 1) < 0); /* r < modulus */
+#endif
+
+    /* In a first step, add the modulus if the input is negative, and then negate if requested.
+     * This brings r from range (-2*modulus,modulus) to range (-modulus,modulus). As all input
+     * limbs are in range (-2^62,2^62), this cannot overflow an int64_t. Note that the right
+     * shifts below are signed sign-extending shifts (see assumptions.h for tests that that is
+     * indeed the behavior of the right shift operator). */
+    cond_add = r4 >> 63;
+    r0 += modinfo->modulus.v[0] & cond_add;
+    r1 += modinfo->modulus.v[1] & cond_add;
+    r2 += modinfo->modulus.v[2] & cond_add;
+    r3 += modinfo->modulus.v[3] & cond_add;
+    r4 += modinfo->modulus.v[4] & cond_add;
+    cond_negate = sign >> 63;
+    r0 = (r0 ^ cond_negate) - cond_negate;
+    r1 = (r1 ^ cond_negate) - cond_negate;
+    r2 = (r2 ^ cond_negate) - cond_negate;
+    r3 = (r3 ^ cond_negate) - cond_negate;
+    r4 = (r4 ^ cond_negate) - cond_negate;
+    /* Propagate the top bits, to bring limbs back to range (-2^62,2^62). */
+    r1 += r0 >> 62; r0 &= M62;
+    r2 += r1 >> 62; r1 &= M62;
+    r3 += r2 >> 62; r2 &= M62;
+    r4 += r3 >> 62; r3 &= M62;
+
+    /* In a second step add the modulus again if the result is still negative, bringing
+     * r to range [0,modulus). */
+    cond_add = r4 >> 63;
+    r0 += modinfo->modulus.v[0] & cond_add;
+    r1 += modinfo->modulus.v[1] & cond_add;
+    r2 += modinfo->modulus.v[2] & cond_add;
+    r3 += modinfo->modulus.v[3] & cond_add;
+    r4 += modinfo->modulus.v[4] & cond_add;
+    /* And propagate again. */
+    r1 += r0 >> 62; r0 &= M62;
+    r2 += r1 >> 62; r1 &= M62;
+    r3 += r2 >> 62; r2 &= M62;
+    r4 += r3 >> 62; r3 &= M62;
+
+    r->v[0] = r0;
+    r->v[1] = r1;
+    r->v[2] = r2;
+    r->v[3] = r3;
+    r->v[4] = r4;
+
+    VERIFY_CHECK(r0 >> 62 == 0);
+    VERIFY_CHECK(r1 >> 62 == 0);
+    VERIFY_CHECK(r2 >> 62 == 0);
+    VERIFY_CHECK(r3 >> 62 == 0);
+    VERIFY_CHECK(r4 >> 62 == 0);
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(r, 5, &modinfo->modulus, 0) >= 0); /* r >= 0 */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(r, 5, &modinfo->modulus, 1) < 0); /* r < modulus */
+}
+
+/* Compute the transition matrix and eta for 59 divsteps (where zeta=-(delta+1/2)).
+ * Note that the transformation matrix is scaled by 2^62 and not 2^59.
+ *
+ * Input:  zeta: initial zeta
+ *         f0:   bottom limb of initial f
+ *         g0:   bottom limb of initial g
+ * Output: t: transition matrix
+ * Return: final zeta
+ *
+ * Implements the divsteps_n_matrix function from the explanation.
+ */
+static int64_t secp256k1_modinv64_divsteps_59(int64_t zeta, uint64_t f0, uint64_t g0, secp256k1_modinv64_trans2x2 *t) {
+    /* u,v,q,r are the elements of the transformation matrix being built up,
+     * starting with the identity matrix times 8 (because the caller expects
+     * a result scaled by 2^62). Semantically they are signed integers
+     * in range [-2^62,2^62], but here represented as unsigned mod 2^64. This
+     * permits left shifting (which is UB for negative numbers). The range
+     * being inside [-2^63,2^63) means that casting to signed works correctly.
+     */
+    uint64_t u = 8, v = 0, q = 0, r = 8;
+    volatile uint64_t c1, c2;
+    uint64_t mask1, mask2, f = f0, g = g0, x, y, z;
+    int i;
+
+    for (i = 3; i < 62; ++i) {
+        VERIFY_CHECK((f & 1) == 1); /* f must always be odd */
+        VERIFY_CHECK((u * f0 + v * g0) == f << i);
+        VERIFY_CHECK((q * f0 + r * g0) == g << i);
+        /* Compute conditional masks for (zeta < 0) and for (g & 1). */
+        c1 = zeta >> 63;
+        mask1 = c1;
+        c2 = g & 1;
+        mask2 = -c2;
+        /* Compute x,y,z, conditionally negated versions of f,u,v. */
+        x = (f ^ mask1) - mask1;
+        y = (u ^ mask1) - mask1;
+        z = (v ^ mask1) - mask1;
+        /* Conditionally add x,y,z to g,q,r. */
+        g += x & mask2;
+        q += y & mask2;
+        r += z & mask2;
+        /* In what follows, c1 is a condition mask for (zeta < 0) and (g & 1). */
+        mask1 &= mask2;
+        /* Conditionally change zeta into -zeta-2 or zeta-1. */
+        zeta = (zeta ^ mask1) - 1;
+        /* Conditionally add g,q,r to f,u,v. */
+        f += g & mask1;
+        u += q & mask1;
+        v += r & mask1;
+        /* Shifts */
+        g >>= 1;
+        u <<= 1;
+        v <<= 1;
+        /* Bounds on zeta that follow from the bounds on iteration count (max 10*59 divsteps). */
+        VERIFY_CHECK(zeta >= -591 && zeta <= 591);
+    }
+    /* Return data in t and return value. */
+    t->u = (int64_t)u;
+    t->v = (int64_t)v;
+    t->q = (int64_t)q;
+    t->r = (int64_t)r;
+
+    /* The determinant of t must be a power of two. This guarantees that multiplication with t
+     * does not change the gcd of f and g, apart from adding a power-of-2 factor to it (which
+     * will be divided out again). As each divstep's individual matrix has determinant 2, the
+     * aggregate of 59 of them will have determinant 2^59. Multiplying with the initial
+     * 8*identity (which has determinant 2^6) means the overall outputs has determinant
+     * 2^65. */
+    VERIFY_CHECK(secp256k1_modinv64_det_check_pow2(t, 65, 0));
+
+    return zeta;
+}
+
+/* Compute the transition matrix and eta for 62 divsteps (variable time, eta=-delta).
+ *
+ * Input:  eta: initial eta
+ *         f0:  bottom limb of initial f
+ *         g0:  bottom limb of initial g
+ * Output: t: transition matrix
+ * Return: final eta
+ *
+ * Implements the divsteps_n_matrix_var function from the explanation.
+ */
+static int64_t secp256k1_modinv64_divsteps_62_var(int64_t eta, uint64_t f0, uint64_t g0, secp256k1_modinv64_trans2x2 *t) {
+    /* Transformation matrix; see comments in secp256k1_modinv64_divsteps_62. */
+    uint64_t u = 1, v = 0, q = 0, r = 1;
+    uint64_t f = f0, g = g0, m;
+    uint32_t w;
+    int i = 62, limit, zeros;
+
+    for (;;) {
+        /* Use a sentinel bit to count zeros only up to i. */
+        zeros = secp256k1_ctz64_var(g | (UINT64_MAX << i));
+        /* Perform zeros divsteps at once; they all just divide g by two. */
+        g >>= zeros;
+        u <<= zeros;
+        v <<= zeros;
+        eta -= zeros;
+        i -= zeros;
+        /* We're done once we've done 62 divsteps. */
+        if (i == 0) break;
+        VERIFY_CHECK((f & 1) == 1);
+        VERIFY_CHECK((g & 1) == 1);
+        VERIFY_CHECK((u * f0 + v * g0) == f << (62 - i));
+        VERIFY_CHECK((q * f0 + r * g0) == g << (62 - i));
+        /* Bounds on eta that follow from the bounds on iteration count (max 12*62 divsteps). */
+        VERIFY_CHECK(eta >= -745 && eta <= 745);
+        /* If eta is negative, negate it and replace f,g with g,-f. */
+        if (eta < 0) {
+            uint64_t tmp;
+            eta = -eta;
+            tmp = f; f = g; g = -tmp;
+            tmp = u; u = q; q = -tmp;
+            tmp = v; v = r; r = -tmp;
+            /* Use a formula to cancel out up to 6 bits of g. Also, no more than i can be cancelled
+             * out (as we'd be done before that point), and no more than eta+1 can be done as its
+             * sign will flip again once that happens. */
+            limit = ((int)eta + 1) > i ? i : ((int)eta + 1);
+            VERIFY_CHECK(limit > 0 && limit <= 62);
+            /* m is a mask for the bottom min(limit, 6) bits. */
+            m = (UINT64_MAX >> (64 - limit)) & 63U;
+            /* Find what multiple of f must be added to g to cancel its bottom min(limit, 6)
+             * bits. */
+            w = (f * g * (f * f - 2)) & m;
+        } else {
+            /* In this branch, use a simpler formula that only lets us cancel up to 4 bits of g, as
+             * eta tends to be smaller here. */
+            limit = ((int)eta + 1) > i ? i : ((int)eta + 1);
+            VERIFY_CHECK(limit > 0 && limit <= 62);
+            /* m is a mask for the bottom min(limit, 4) bits. */
+            m = (UINT64_MAX >> (64 - limit)) & 15U;
+            /* Find what multiple of f must be added to g to cancel its bottom min(limit, 4)
+             * bits. */
+            w = f + (((f + 1) & 4) << 1);
+            w = (-w * g) & m;
+        }
+        g += f * w;
+        q += u * w;
+        r += v * w;
+        VERIFY_CHECK((g & m) == 0);
+    }
+    /* Return data in t and return value. */
+    t->u = (int64_t)u;
+    t->v = (int64_t)v;
+    t->q = (int64_t)q;
+    t->r = (int64_t)r;
+
+    /* The determinant of t must be a power of two. This guarantees that multiplication with t
+     * does not change the gcd of f and g, apart from adding a power-of-2 factor to it (which
+     * will be divided out again). As each divstep's individual matrix has determinant 2, the
+     * aggregate of 62 of them will have determinant 2^62. */
+    VERIFY_CHECK(secp256k1_modinv64_det_check_pow2(t, 62, 0));
+
+    return eta;
+}
+
+/* Compute the transition matrix and eta for 62 posdivsteps (variable time, eta=-delta), and keeps track
+ * of the Jacobi symbol along the way. f0 and g0 must be f and g mod 2^64 rather than 2^62, because
+ * Jacobi tracking requires knowing (f mod 8) rather than just (f mod 2).
+ *
+ * Input:        eta: initial eta
+ *               f0:  bottom limb of initial f
+ *               g0:  bottom limb of initial g
+ * Output:       t: transition matrix
+ * Input/Output: (*jacp & 1) is bitflipped if and only if the Jacobi symbol of (f | g) changes sign
+ *               by applying the returned transformation matrix to it. The other bits of *jacp may
+ *               change, but are meaningless.
+ * Return:       final eta
+ */
+static int64_t secp256k1_modinv64_posdivsteps_62_var(int64_t eta, uint64_t f0, uint64_t g0, secp256k1_modinv64_trans2x2 *t, int *jacp) {
+    /* Transformation matrix; see comments in secp256k1_modinv64_divsteps_62. */
+    uint64_t u = 1, v = 0, q = 0, r = 1;
+    uint64_t f = f0, g = g0, m;
+    uint32_t w;
+    int i = 62, limit, zeros;
+    int jac = *jacp;
+
+    for (;;) {
+        /* Use a sentinel bit to count zeros only up to i. */
+        zeros = secp256k1_ctz64_var(g | (UINT64_MAX << i));
+        /* Perform zeros divsteps at once; they all just divide g by two. */
+        g >>= zeros;
+        u <<= zeros;
+        v <<= zeros;
+        eta -= zeros;
+        i -= zeros;
+        /* Update the bottom bit of jac: when dividing g by an odd power of 2,
+         * if (f mod 8) is 3 or 5, the Jacobi symbol changes sign. */
+        jac ^= (zeros & ((f >> 1) ^ (f >> 2)));
+        /* We're done once we've done 62 posdivsteps. */
+        if (i == 0) break;
+        VERIFY_CHECK((f & 1) == 1);
+        VERIFY_CHECK((g & 1) == 1);
+        VERIFY_CHECK((u * f0 + v * g0) == f << (62 - i));
+        VERIFY_CHECK((q * f0 + r * g0) == g << (62 - i));
+        /* If eta is negative, negate it and replace f,g with g,f. */
+        if (eta < 0) {
+            uint64_t tmp;
+            eta = -eta;
+            tmp = f; f = g; g = tmp;
+            tmp = u; u = q; q = tmp;
+            tmp = v; v = r; r = tmp;
+            /* Update bottom bit of jac: when swapping f and g, the Jacobi symbol changes sign
+             * if both f and g are 3 mod 4. */
+            jac ^= ((f & g) >> 1);
+            /* Use a formula to cancel out up to 6 bits of g. Also, no more than i can be cancelled
+             * out (as we'd be done before that point), and no more than eta+1 can be done as its
+             * sign will flip again once that happens. */
+            limit = ((int)eta + 1) > i ? i : ((int)eta + 1);
+            VERIFY_CHECK(limit > 0 && limit <= 62);
+            /* m is a mask for the bottom min(limit, 6) bits. */
+            m = (UINT64_MAX >> (64 - limit)) & 63U;
+            /* Find what multiple of f must be added to g to cancel its bottom min(limit, 6)
+             * bits. */
+            w = (f * g * (f * f - 2)) & m;
+        } else {
+            /* In this branch, use a simpler formula that only lets us cancel up to 4 bits of g, as
+             * eta tends to be smaller here. */
+            limit = ((int)eta + 1) > i ? i : ((int)eta + 1);
+            VERIFY_CHECK(limit > 0 && limit <= 62);
+            /* m is a mask for the bottom min(limit, 4) bits. */
+            m = (UINT64_MAX >> (64 - limit)) & 15U;
+            /* Find what multiple of f must be added to g to cancel its bottom min(limit, 4)
+             * bits. */
+            w = f + (((f + 1) & 4) << 1);
+            w = (-w * g) & m;
+        }
+        g += f * w;
+        q += u * w;
+        r += v * w;
+        VERIFY_CHECK((g & m) == 0);
+    }
+    /* Return data in t and return value. */
+    t->u = (int64_t)u;
+    t->v = (int64_t)v;
+    t->q = (int64_t)q;
+    t->r = (int64_t)r;
+
+    /* The determinant of t must be a power of two. This guarantees that multiplication with t
+     * does not change the gcd of f and g, apart from adding a power-of-2 factor to it (which
+     * will be divided out again). As each divstep's individual matrix has determinant 2 or -2,
+     * the aggregate of 62 of them will have determinant 2^62 or -2^62. */
+    VERIFY_CHECK(secp256k1_modinv64_det_check_pow2(t, 62, 1));
+
+    *jacp = jac;
+    return eta;
+}
+
+/* Compute (t/2^62) * [d, e] mod modulus, where t is a transition matrix scaled by 2^62.
+ *
+ * On input and output, d and e are in range (-2*modulus,modulus). All output limbs will be in range
+ * (-2^62,2^62).
+ *
+ * This implements the update_de function from the explanation.
+ */
+static void secp256k1_modinv64_update_de_62(secp256k1_modinv64_signed62 *d, secp256k1_modinv64_signed62 *e, const secp256k1_modinv64_trans2x2 *t, const secp256k1_modinv64_modinfo* modinfo) {
+    const uint64_t M62 = UINT64_MAX >> 2;
+    const int64_t d0 = d->v[0], d1 = d->v[1], d2 = d->v[2], d3 = d->v[3], d4 = d->v[4];
+    const int64_t e0 = e->v[0], e1 = e->v[1], e2 = e->v[2], e3 = e->v[3], e4 = e->v[4];
+    const int64_t u = t->u, v = t->v, q = t->q, r = t->r;
+    int64_t md, me, sd, se;
+    secp256k1_int128 cd, ce;
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(d, 5, &modinfo->modulus, -2) > 0); /* d > -2*modulus */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(d, 5, &modinfo->modulus, 1) < 0);  /* d <    modulus */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(e, 5, &modinfo->modulus, -2) > 0); /* e > -2*modulus */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(e, 5, &modinfo->modulus, 1) < 0);  /* e <    modulus */
+    VERIFY_CHECK(secp256k1_modinv64_abs(u) <= (((int64_t)1 << 62) - secp256k1_modinv64_abs(v))); /* |u|+|v| <= 2^62 */
+    VERIFY_CHECK(secp256k1_modinv64_abs(q) <= (((int64_t)1 << 62) - secp256k1_modinv64_abs(r))); /* |q|+|r| <= 2^62 */
+
+    /* [md,me] start as zero; plus [u,q] if d is negative; plus [v,r] if e is negative. */
+    sd = d4 >> 63;
+    se = e4 >> 63;
+    md = (u & sd) + (v & se);
+    me = (q & sd) + (r & se);
+    /* Begin computing t*[d,e]. */
+    secp256k1_i128_mul(&cd, u, d0);
+    secp256k1_i128_accum_mul(&cd, v, e0);
+    secp256k1_i128_mul(&ce, q, d0);
+    secp256k1_i128_accum_mul(&ce, r, e0);
+    /* Correct md,me so that t*[d,e]+modulus*[md,me] has 62 zero bottom bits. */
+    md -= (modinfo->modulus_inv62 * secp256k1_i128_to_u64(&cd) + md) & M62;
+    me -= (modinfo->modulus_inv62 * secp256k1_i128_to_u64(&ce) + me) & M62;
+    /* Update the beginning of computation for t*[d,e]+modulus*[md,me] now md,me are known. */
+    secp256k1_i128_accum_mul(&cd, modinfo->modulus.v[0], md);
+    secp256k1_i128_accum_mul(&ce, modinfo->modulus.v[0], me);
+    /* Verify that the low 62 bits of the computation are indeed zero, and then throw them away. */
+    VERIFY_CHECK((secp256k1_i128_to_u64(&cd) & M62) == 0); secp256k1_i128_rshift(&cd, 62);
+    VERIFY_CHECK((secp256k1_i128_to_u64(&ce) & M62) == 0); secp256k1_i128_rshift(&ce, 62);
+    /* Compute limb 1 of t*[d,e]+modulus*[md,me], and store it as output limb 0 (= down shift). */
+    secp256k1_i128_accum_mul(&cd, u, d1);
+    secp256k1_i128_accum_mul(&cd, v, e1);
+    secp256k1_i128_accum_mul(&ce, q, d1);
+    secp256k1_i128_accum_mul(&ce, r, e1);
+    if (modinfo->modulus.v[1]) { /* Optimize for the case where limb of modulus is zero. */
+        secp256k1_i128_accum_mul(&cd, modinfo->modulus.v[1], md);
+        secp256k1_i128_accum_mul(&ce, modinfo->modulus.v[1], me);
+    }
+    d->v[0] = secp256k1_i128_to_u64(&cd) & M62; secp256k1_i128_rshift(&cd, 62);
+    e->v[0] = secp256k1_i128_to_u64(&ce) & M62; secp256k1_i128_rshift(&ce, 62);
+    /* Compute limb 2 of t*[d,e]+modulus*[md,me], and store it as output limb 1. */
+    secp256k1_i128_accum_mul(&cd, u, d2);
+    secp256k1_i128_accum_mul(&cd, v, e2);
+    secp256k1_i128_accum_mul(&ce, q, d2);
+    secp256k1_i128_accum_mul(&ce, r, e2);
+    if (modinfo->modulus.v[2]) { /* Optimize for the case where limb of modulus is zero. */
+        secp256k1_i128_accum_mul(&cd, modinfo->modulus.v[2], md);
+        secp256k1_i128_accum_mul(&ce, modinfo->modulus.v[2], me);
+    }
+    d->v[1] = secp256k1_i128_to_u64(&cd) & M62; secp256k1_i128_rshift(&cd, 62);
+    e->v[1] = secp256k1_i128_to_u64(&ce) & M62; secp256k1_i128_rshift(&ce, 62);
+    /* Compute limb 3 of t*[d,e]+modulus*[md,me], and store it as output limb 2. */
+    secp256k1_i128_accum_mul(&cd, u, d3);
+    secp256k1_i128_accum_mul(&cd, v, e3);
+    secp256k1_i128_accum_mul(&ce, q, d3);
+    secp256k1_i128_accum_mul(&ce, r, e3);
+    if (modinfo->modulus.v[3]) { /* Optimize for the case where limb of modulus is zero. */
+        secp256k1_i128_accum_mul(&cd, modinfo->modulus.v[3], md);
+        secp256k1_i128_accum_mul(&ce, modinfo->modulus.v[3], me);
+    }
+    d->v[2] = secp256k1_i128_to_u64(&cd) & M62; secp256k1_i128_rshift(&cd, 62);
+    e->v[2] = secp256k1_i128_to_u64(&ce) & M62; secp256k1_i128_rshift(&ce, 62);
+    /* Compute limb 4 of t*[d,e]+modulus*[md,me], and store it as output limb 3. */
+    secp256k1_i128_accum_mul(&cd, u, d4);
+    secp256k1_i128_accum_mul(&cd, v, e4);
+    secp256k1_i128_accum_mul(&ce, q, d4);
+    secp256k1_i128_accum_mul(&ce, r, e4);
+    secp256k1_i128_accum_mul(&cd, modinfo->modulus.v[4], md);
+    secp256k1_i128_accum_mul(&ce, modinfo->modulus.v[4], me);
+    d->v[3] = secp256k1_i128_to_u64(&cd) & M62; secp256k1_i128_rshift(&cd, 62);
+    e->v[3] = secp256k1_i128_to_u64(&ce) & M62; secp256k1_i128_rshift(&ce, 62);
+    /* What remains is limb 5 of t*[d,e]+modulus*[md,me]; store it as output limb 4. */
+    d->v[4] = secp256k1_i128_to_i64(&cd);
+    e->v[4] = secp256k1_i128_to_i64(&ce);
+
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(d, 5, &modinfo->modulus, -2) > 0); /* d > -2*modulus */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(d, 5, &modinfo->modulus, 1) < 0);  /* d <    modulus */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(e, 5, &modinfo->modulus, -2) > 0); /* e > -2*modulus */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(e, 5, &modinfo->modulus, 1) < 0);  /* e <    modulus */
+}
+
+/* Compute (t/2^62) * [f, g], where t is a transition matrix scaled by 2^62.
+ *
+ * This implements the update_fg function from the explanation.
+ */
+static void secp256k1_modinv64_update_fg_62(secp256k1_modinv64_signed62 *f, secp256k1_modinv64_signed62 *g, const secp256k1_modinv64_trans2x2 *t) {
+    const uint64_t M62 = UINT64_MAX >> 2;
+    const int64_t f0 = f->v[0], f1 = f->v[1], f2 = f->v[2], f3 = f->v[3], f4 = f->v[4];
+    const int64_t g0 = g->v[0], g1 = g->v[1], g2 = g->v[2], g3 = g->v[3], g4 = g->v[4];
+    const int64_t u = t->u, v = t->v, q = t->q, r = t->r;
+    secp256k1_int128 cf, cg;
+    /* Start computing t*[f,g]. */
+    secp256k1_i128_mul(&cf, u, f0);
+    secp256k1_i128_accum_mul(&cf, v, g0);
+    secp256k1_i128_mul(&cg, q, f0);
+    secp256k1_i128_accum_mul(&cg, r, g0);
+    /* Verify that the bottom 62 bits of the result are zero, and then throw them away. */
+    VERIFY_CHECK((secp256k1_i128_to_u64(&cf) & M62) == 0); secp256k1_i128_rshift(&cf, 62);
+    VERIFY_CHECK((secp256k1_i128_to_u64(&cg) & M62) == 0); secp256k1_i128_rshift(&cg, 62);
+    /* Compute limb 1 of t*[f,g], and store it as output limb 0 (= down shift). */
+    secp256k1_i128_accum_mul(&cf, u, f1);
+    secp256k1_i128_accum_mul(&cf, v, g1);
+    secp256k1_i128_accum_mul(&cg, q, f1);
+    secp256k1_i128_accum_mul(&cg, r, g1);
+    f->v[0] = secp256k1_i128_to_u64(&cf) & M62; secp256k1_i128_rshift(&cf, 62);
+    g->v[0] = secp256k1_i128_to_u64(&cg) & M62; secp256k1_i128_rshift(&cg, 62);
+    /* Compute limb 2 of t*[f,g], and store it as output limb 1. */
+    secp256k1_i128_accum_mul(&cf, u, f2);
+    secp256k1_i128_accum_mul(&cf, v, g2);
+    secp256k1_i128_accum_mul(&cg, q, f2);
+    secp256k1_i128_accum_mul(&cg, r, g2);
+    f->v[1] = secp256k1_i128_to_u64(&cf) & M62; secp256k1_i128_rshift(&cf, 62);
+    g->v[1] = secp256k1_i128_to_u64(&cg) & M62; secp256k1_i128_rshift(&cg, 62);
+    /* Compute limb 3 of t*[f,g], and store it as output limb 2. */
+    secp256k1_i128_accum_mul(&cf, u, f3);
+    secp256k1_i128_accum_mul(&cf, v, g3);
+    secp256k1_i128_accum_mul(&cg, q, f3);
+    secp256k1_i128_accum_mul(&cg, r, g3);
+    f->v[2] = secp256k1_i128_to_u64(&cf) & M62; secp256k1_i128_rshift(&cf, 62);
+    g->v[2] = secp256k1_i128_to_u64(&cg) & M62; secp256k1_i128_rshift(&cg, 62);
+    /* Compute limb 4 of t*[f,g], and store it as output limb 3. */
+    secp256k1_i128_accum_mul(&cf, u, f4);
+    secp256k1_i128_accum_mul(&cf, v, g4);
+    secp256k1_i128_accum_mul(&cg, q, f4);
+    secp256k1_i128_accum_mul(&cg, r, g4);
+    f->v[3] = secp256k1_i128_to_u64(&cf) & M62; secp256k1_i128_rshift(&cf, 62);
+    g->v[3] = secp256k1_i128_to_u64(&cg) & M62; secp256k1_i128_rshift(&cg, 62);
+    /* What remains is limb 5 of t*[f,g]; store it as output limb 4. */
+    f->v[4] = secp256k1_i128_to_i64(&cf);
+    g->v[4] = secp256k1_i128_to_i64(&cg);
+}
+
+/* Compute (t/2^62) * [f, g], where t is a transition matrix for 62 divsteps.
+ *
+ * Version that operates on a variable number of limbs in f and g.
+ *
+ * This implements the update_fg function from the explanation.
+ */
+static void secp256k1_modinv64_update_fg_62_var(int len, secp256k1_modinv64_signed62 *f, secp256k1_modinv64_signed62 *g, const secp256k1_modinv64_trans2x2 *t) {
+    const uint64_t M62 = UINT64_MAX >> 2;
+    const int64_t u = t->u, v = t->v, q = t->q, r = t->r;
+    int64_t fi, gi;
+    secp256k1_int128 cf, cg;
+    int i;
+    VERIFY_CHECK(len > 0);
+    /* Start computing t*[f,g]. */
+    fi = f->v[0];
+    gi = g->v[0];
+    secp256k1_i128_mul(&cf, u, fi);
+    secp256k1_i128_accum_mul(&cf, v, gi);
+    secp256k1_i128_mul(&cg, q, fi);
+    secp256k1_i128_accum_mul(&cg, r, gi);
+    /* Verify that the bottom 62 bits of the result are zero, and then throw them away. */
+    VERIFY_CHECK((secp256k1_i128_to_u64(&cf) & M62) == 0); secp256k1_i128_rshift(&cf, 62);
+    VERIFY_CHECK((secp256k1_i128_to_u64(&cg) & M62) == 0); secp256k1_i128_rshift(&cg, 62);
+    /* Now iteratively compute limb i=1..len of t*[f,g], and store them in output limb i-1 (shifting
+     * down by 62 bits). */
+    for (i = 1; i < len; ++i) {
+        fi = f->v[i];
+        gi = g->v[i];
+        secp256k1_i128_accum_mul(&cf, u, fi);
+        secp256k1_i128_accum_mul(&cf, v, gi);
+        secp256k1_i128_accum_mul(&cg, q, fi);
+        secp256k1_i128_accum_mul(&cg, r, gi);
+        f->v[i - 1] = secp256k1_i128_to_u64(&cf) & M62; secp256k1_i128_rshift(&cf, 62);
+        g->v[i - 1] = secp256k1_i128_to_u64(&cg) & M62; secp256k1_i128_rshift(&cg, 62);
+    }
+    /* What remains is limb (len) of t*[f,g]; store it as output limb (len-1). */
+    f->v[len - 1] = secp256k1_i128_to_i64(&cf);
+    g->v[len - 1] = secp256k1_i128_to_i64(&cg);
+}
+
+/* Compute the inverse of x modulo modinfo->modulus, and replace x with it (constant time in x). */
+static void secp256k1_modinv64(secp256k1_modinv64_signed62 *x, const secp256k1_modinv64_modinfo *modinfo) {
+    /* Start with d=0, e=1, f=modulus, g=x, zeta=-1. */
+    secp256k1_modinv64_signed62 d = {{0, 0, 0, 0, 0}};
+    secp256k1_modinv64_signed62 e = {{1, 0, 0, 0, 0}};
+    secp256k1_modinv64_signed62 f = modinfo->modulus;
+    secp256k1_modinv64_signed62 g = *x;
+    int i;
+    int64_t zeta = -1; /* zeta = -(delta+1/2); delta starts at 1/2. */
+
+    /* Do 10 iterations of 59 divsteps each = 590 divsteps. This suffices for 256-bit inputs. */
+    for (i = 0; i < 10; ++i) {
+        /* Compute transition matrix and new zeta after 59 divsteps. */
+        secp256k1_modinv64_trans2x2 t;
+        zeta = secp256k1_modinv64_divsteps_59(zeta, f.v[0], g.v[0], &t);
+        /* Update d,e using that transition matrix. */
+        secp256k1_modinv64_update_de_62(&d, &e, &t, modinfo);
+        /* Update f,g using that transition matrix. */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, 5, &modinfo->modulus, -1) > 0); /* f > -modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, 5, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, 5, &modinfo->modulus, -1) > 0); /* g > -modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, 5, &modinfo->modulus, 1) < 0);  /* g <  modulus */
+
+        secp256k1_modinv64_update_fg_62(&f, &g, &t);
+
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, 5, &modinfo->modulus, -1) > 0); /* f > -modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, 5, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, 5, &modinfo->modulus, -1) > 0); /* g > -modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, 5, &modinfo->modulus, 1) < 0);  /* g <  modulus */
+    }
+
+    /* At this point sufficient iterations have been performed that g must have reached 0
+     * and (if g was not originally 0) f must now equal +/- GCD of the initial f, g
+     * values i.e. +/- 1, and d now contains +/- the modular inverse. */
+
+    /* g == 0 */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, 5, &SECP256K1_SIGNED62_ONE, 0) == 0);
+    /* |f| == 1, or (x == 0 and d == 0 and f == modulus) */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, 5, &SECP256K1_SIGNED62_ONE, -1) == 0 ||
+                 secp256k1_modinv64_mul_cmp_62(&f, 5, &SECP256K1_SIGNED62_ONE, 1) == 0 ||
+                 (secp256k1_modinv64_mul_cmp_62(x, 5, &SECP256K1_SIGNED62_ONE, 0) == 0 &&
+                  secp256k1_modinv64_mul_cmp_62(&d, 5, &SECP256K1_SIGNED62_ONE, 0) == 0 &&
+                  secp256k1_modinv64_mul_cmp_62(&f, 5, &modinfo->modulus, 1) == 0));
+
+    /* Optionally negate d, normalize to [0,modulus), and return it. */
+    secp256k1_modinv64_normalize_62(&d, f.v[4], modinfo);
+    *x = d;
+}
+
+/* Compute the inverse of x modulo modinfo->modulus, and replace x with it (variable time). */
+static void secp256k1_modinv64_var(secp256k1_modinv64_signed62 *x, const secp256k1_modinv64_modinfo *modinfo) {
+    /* Start with d=0, e=1, f=modulus, g=x, eta=-1. */
+    secp256k1_modinv64_signed62 d = {{0, 0, 0, 0, 0}};
+    secp256k1_modinv64_signed62 e = {{1, 0, 0, 0, 0}};
+    secp256k1_modinv64_signed62 f = modinfo->modulus;
+    secp256k1_modinv64_signed62 g = *x;
+#ifdef VERIFY
+    int i = 0;
+#endif
+    int j, len = 5;
+    int64_t eta = -1; /* eta = -delta; delta is initially 1 */
+    int64_t cond, fn, gn;
+
+    /* Do iterations of 62 divsteps each until g=0. */
+    while (1) {
+        /* Compute transition matrix and new eta after 62 divsteps. */
+        secp256k1_modinv64_trans2x2 t;
+        eta = secp256k1_modinv64_divsteps_62_var(eta, f.v[0], g.v[0], &t);
+        /* Update d,e using that transition matrix. */
+        secp256k1_modinv64_update_de_62(&d, &e, &t, modinfo);
+        /* Update f,g using that transition matrix. */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, -1) > 0); /* f > -modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, len, &modinfo->modulus, -1) > 0); /* g > -modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, len, &modinfo->modulus, 1) < 0);  /* g <  modulus */
+
+        secp256k1_modinv64_update_fg_62_var(len, &f, &g, &t);
+        /* If the bottom limb of g is zero, there is a chance that g=0. */
+        if (g.v[0] == 0) {
+            cond = 0;
+            /* Check if the other limbs are also 0. */
+            for (j = 1; j < len; ++j) {
+                cond |= g.v[j];
+            }
+            /* If so, we're done. */
+            if (cond == 0) break;
+        }
+
+        /* Determine if len>1 and limb (len-1) of both f and g is 0 or -1. */
+        fn = f.v[len - 1];
+        gn = g.v[len - 1];
+        cond = ((int64_t)len - 2) >> 63;
+        cond |= fn ^ (fn >> 63);
+        cond |= gn ^ (gn >> 63);
+        /* If so, reduce length, propagating the sign of f and g's top limb into the one below. */
+        if (cond == 0) {
+            f.v[len - 2] |= (uint64_t)fn << 62;
+            g.v[len - 2] |= (uint64_t)gn << 62;
+            --len;
+        }
+
+        VERIFY_CHECK(++i < 12); /* We should never need more than 12*62 = 744 divsteps */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, -1) > 0); /* f > -modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, len, &modinfo->modulus, -1) > 0); /* g > -modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, len, &modinfo->modulus, 1) < 0);  /* g <  modulus */
+    }
+
+    /* At this point g is 0 and (if g was not originally 0) f must now equal +/- GCD of
+     * the initial f, g values i.e. +/- 1, and d now contains +/- the modular inverse. */
+
+    /* g == 0 */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, len, &SECP256K1_SIGNED62_ONE, 0) == 0);
+    /* |f| == 1, or (x == 0 and d == 0 and f == modulus) */
+    VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &SECP256K1_SIGNED62_ONE, -1) == 0 ||
+                 secp256k1_modinv64_mul_cmp_62(&f, len, &SECP256K1_SIGNED62_ONE, 1) == 0 ||
+                 (secp256k1_modinv64_mul_cmp_62(x, 5, &SECP256K1_SIGNED62_ONE, 0) == 0 &&
+                  secp256k1_modinv64_mul_cmp_62(&d, 5, &SECP256K1_SIGNED62_ONE, 0) == 0 &&
+                  secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, 1) == 0));
+
+    /* Optionally negate d, normalize to [0,modulus), and return it. */
+    secp256k1_modinv64_normalize_62(&d, f.v[len - 1], modinfo);
+    *x = d;
+}
+
+/* Do up to 25 iterations of 62 posdivsteps (up to 1550 steps; more is extremely rare) each until f=1.
+ * In VERIFY mode use a lower number of iterations (744, close to the median 756), so failure actually occurs. */
+#ifdef VERIFY
+#define JACOBI64_ITERATIONS 12
+#else
+#define JACOBI64_ITERATIONS 25
+#endif
+
+/* Compute the Jacobi symbol of x modulo modinfo->modulus (variable time). gcd(x,modulus) must be 1. */
+static int secp256k1_jacobi64_maybe_var(const secp256k1_modinv64_signed62 *x, const secp256k1_modinv64_modinfo *modinfo) {
+    /* Start with f=modulus, g=x, eta=-1. */
+    secp256k1_modinv64_signed62 f = modinfo->modulus;
+    secp256k1_modinv64_signed62 g = *x;
+    int j, len = 5;
+    int64_t eta = -1; /* eta = -delta; delta is initially 1 */
+    int64_t cond, fn, gn;
+    int jac = 0;
+    int count;
+
+    /* The input limbs must all be non-negative. */
+    VERIFY_CHECK(g.v[0] >= 0 && g.v[1] >= 0 && g.v[2] >= 0 && g.v[3] >= 0 && g.v[4] >= 0);
+
+    /* If x > 0, then if the loop below converges, it converges to f=g=gcd(x,modulus). Since we
+     * require that gcd(x,modulus)=1 and modulus>=3, x cannot be 0. Thus, we must reach f=1 (or
+     * time out). */
+    VERIFY_CHECK((g.v[0] | g.v[1] | g.v[2] | g.v[3] | g.v[4]) != 0);
+
+    for (count = 0; count < JACOBI64_ITERATIONS; ++count) {
+        /* Compute transition matrix and new eta after 62 posdivsteps. */
+        secp256k1_modinv64_trans2x2 t;
+        eta = secp256k1_modinv64_posdivsteps_62_var(eta, f.v[0] | ((uint64_t)f.v[1] << 62), g.v[0] | ((uint64_t)g.v[1] << 62), &t, &jac);
+        /* Update f,g using that transition matrix. */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, 0) > 0); /* f > 0 */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, len, &modinfo->modulus, 0) > 0); /* g > 0 */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, len, &modinfo->modulus, 1) < 0);  /* g < modulus */
+
+        secp256k1_modinv64_update_fg_62_var(len, &f, &g, &t);
+        /* If the bottom limb of f is 1, there is a chance that f=1. */
+        if (f.v[0] == 1) {
+            cond = 0;
+            /* Check if the other limbs are also 0. */
+            for (j = 1; j < len; ++j) {
+                cond |= f.v[j];
+            }
+            /* If so, we're done. When f=1, the Jacobi symbol (g | f)=1. */
+            if (cond == 0) return 1 - 2*(jac & 1);
+        }
+
+        /* Determine if len>1 and limb (len-1) of both f and g is 0. */
+        fn = f.v[len - 1];
+        gn = g.v[len - 1];
+        cond = ((int64_t)len - 2) >> 63;
+        cond |= fn;
+        cond |= gn;
+        /* If so, reduce length. */
+        if (cond == 0) --len;
+
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, 0) > 0); /* f > 0 */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&f, len, &modinfo->modulus, 1) <= 0); /* f <= modulus */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, len, &modinfo->modulus, 0) > 0); /* g > 0 */
+        VERIFY_CHECK(secp256k1_modinv64_mul_cmp_62(&g, len, &modinfo->modulus, 1) < 0);  /* g < modulus */
+    }
+
+    /* The loop failed to converge to f=g after 1550 iterations. Return 0, indicating unknown result. */
+    return 0;
+}
+
+#endif /* SECP256K1_MODINV64_IMPL_H */
diff --git a/vendor/external/secp256k1/src/modules/extrakeys/main_impl.h b/vendor/external/secp256k1/src/modules/extrakeys/main_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/modules/extrakeys/main_impl.h
@@ -0,0 +1,285 @@
+/***********************************************************************
+ * Copyright (c) 2020 Jonas Nick                                       *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_MODULE_EXTRAKEYS_MAIN_H
+#define SECP256K1_MODULE_EXTRAKEYS_MAIN_H
+
+#include "../../../include/secp256k1.h"
+#include "../../../include/secp256k1_extrakeys.h"
+#include "../../util.h"
+
+static SECP256K1_INLINE int secp256k1_xonly_pubkey_load(const secp256k1_context* ctx, secp256k1_ge *ge, const secp256k1_xonly_pubkey *pubkey) {
+    return secp256k1_pubkey_load(ctx, ge, (const secp256k1_pubkey *) pubkey);
+}
+
+static SECP256K1_INLINE void secp256k1_xonly_pubkey_save(secp256k1_xonly_pubkey *pubkey, secp256k1_ge *ge) {
+    secp256k1_pubkey_save((secp256k1_pubkey *) pubkey, ge);
+}
+
+int secp256k1_xonly_pubkey_parse(const secp256k1_context* ctx, secp256k1_xonly_pubkey *pubkey, const unsigned char *input32) {
+    secp256k1_ge pk;
+    secp256k1_fe x;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(pubkey != NULL);
+    memset(pubkey, 0, sizeof(*pubkey));
+    ARG_CHECK(input32 != NULL);
+
+    if (!secp256k1_fe_set_b32_limit(&x, input32)) {
+        return 0;
+    }
+    if (!secp256k1_ge_set_xo_var(&pk, &x, 0)) {
+        return 0;
+    }
+    if (!secp256k1_ge_is_in_correct_subgroup(&pk)) {
+        return 0;
+    }
+    secp256k1_xonly_pubkey_save(pubkey, &pk);
+    return 1;
+}
+
+int secp256k1_xonly_pubkey_serialize(const secp256k1_context* ctx, unsigned char *output32, const secp256k1_xonly_pubkey *pubkey) {
+    secp256k1_ge pk;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(output32 != NULL);
+    memset(output32, 0, 32);
+    ARG_CHECK(pubkey != NULL);
+
+    if (!secp256k1_xonly_pubkey_load(ctx, &pk, pubkey)) {
+        return 0;
+    }
+    secp256k1_fe_get_b32(output32, &pk.x);
+    return 1;
+}
+
+int secp256k1_xonly_pubkey_cmp(const secp256k1_context* ctx, const secp256k1_xonly_pubkey* pk0, const secp256k1_xonly_pubkey* pk1) {
+    unsigned char out[2][32];
+    const secp256k1_xonly_pubkey* pk[2];
+    int i;
+
+    VERIFY_CHECK(ctx != NULL);
+    pk[0] = pk0; pk[1] = pk1;
+    for (i = 0; i < 2; i++) {
+        /* If the public key is NULL or invalid, xonly_pubkey_serialize will
+         * call the illegal_callback and return 0. In that case we will
+         * serialize the key as all zeros which is less than any valid public
+         * key. This results in consistent comparisons even if NULL or invalid
+         * pubkeys are involved and prevents edge cases such as sorting
+         * algorithms that use this function and do not terminate as a
+         * result. */
+        if (!secp256k1_xonly_pubkey_serialize(ctx, out[i], pk[i])) {
+            /* Note that xonly_pubkey_serialize should already set the output to
+             * zero in that case, but it's not guaranteed by the API, we can't
+             * test it and writing a VERIFY_CHECK is more complex than
+             * explicitly memsetting (again). */
+            memset(out[i], 0, sizeof(out[i]));
+        }
+    }
+    return secp256k1_memcmp_var(out[0], out[1], sizeof(out[1]));
+}
+
+/** Keeps a group element as is if it has an even Y and otherwise negates it.
+ *  y_parity is set to 0 in the former case and to 1 in the latter case.
+ *  Requires that the coordinates of r are normalized. */
+static int secp256k1_extrakeys_ge_even_y(secp256k1_ge *r) {
+    int y_parity = 0;
+    VERIFY_CHECK(!secp256k1_ge_is_infinity(r));
+
+    if (secp256k1_fe_is_odd(&r->y)) {
+        secp256k1_fe_negate(&r->y, &r->y, 1);
+        y_parity = 1;
+    }
+    return y_parity;
+}
+
+int secp256k1_xonly_pubkey_from_pubkey(const secp256k1_context* ctx, secp256k1_xonly_pubkey *xonly_pubkey, int *pk_parity, const secp256k1_pubkey *pubkey) {
+    secp256k1_ge pk;
+    int tmp;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(xonly_pubkey != NULL);
+    ARG_CHECK(pubkey != NULL);
+
+    if (!secp256k1_pubkey_load(ctx, &pk, pubkey)) {
+        return 0;
+    }
+    tmp = secp256k1_extrakeys_ge_even_y(&pk);
+    if (pk_parity != NULL) {
+        *pk_parity = tmp;
+    }
+    secp256k1_xonly_pubkey_save(xonly_pubkey, &pk);
+    return 1;
+}
+
+int secp256k1_xonly_pubkey_tweak_add(const secp256k1_context* ctx, secp256k1_pubkey *output_pubkey, const secp256k1_xonly_pubkey *internal_pubkey, const unsigned char *tweak32) {
+    secp256k1_ge pk;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(output_pubkey != NULL);
+    memset(output_pubkey, 0, sizeof(*output_pubkey));
+    ARG_CHECK(internal_pubkey != NULL);
+    ARG_CHECK(tweak32 != NULL);
+
+    if (!secp256k1_xonly_pubkey_load(ctx, &pk, internal_pubkey)
+        || !secp256k1_ec_pubkey_tweak_add_helper(&pk, tweak32)) {
+        return 0;
+    }
+    secp256k1_pubkey_save(output_pubkey, &pk);
+    return 1;
+}
+
+int secp256k1_xonly_pubkey_tweak_add_check(const secp256k1_context* ctx, const unsigned char *tweaked_pubkey32, int tweaked_pk_parity, const secp256k1_xonly_pubkey *internal_pubkey, const unsigned char *tweak32) {
+    secp256k1_ge pk;
+    unsigned char pk_expected32[32];
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(internal_pubkey != NULL);
+    ARG_CHECK(tweaked_pubkey32 != NULL);
+    ARG_CHECK(tweak32 != NULL);
+
+    if (!secp256k1_xonly_pubkey_load(ctx, &pk, internal_pubkey)
+        || !secp256k1_ec_pubkey_tweak_add_helper(&pk, tweak32)) {
+        return 0;
+    }
+    secp256k1_fe_normalize_var(&pk.x);
+    secp256k1_fe_normalize_var(&pk.y);
+    secp256k1_fe_get_b32(pk_expected32, &pk.x);
+
+    return secp256k1_memcmp_var(&pk_expected32, tweaked_pubkey32, 32) == 0
+            && secp256k1_fe_is_odd(&pk.y) == tweaked_pk_parity;
+}
+
+static void secp256k1_keypair_save(secp256k1_keypair *keypair, const secp256k1_scalar *sk, secp256k1_ge *pk) {
+    secp256k1_scalar_get_b32(&keypair->data[0], sk);
+    secp256k1_pubkey_save((secp256k1_pubkey *)&keypair->data[32], pk);
+}
+
+
+static int secp256k1_keypair_seckey_load(const secp256k1_context* ctx, secp256k1_scalar *sk, const secp256k1_keypair *keypair) {
+    int ret;
+
+    ret = secp256k1_scalar_set_b32_seckey(sk, &keypair->data[0]);
+    /* We can declassify ret here because sk is only zero if a keypair function
+     * failed (which zeroes the keypair) and its return value is ignored. */
+    secp256k1_declassify(ctx, &ret, sizeof(ret));
+    ARG_CHECK(ret);
+    return ret;
+}
+
+/* Load a keypair into pk and sk (if non-NULL). This function declassifies pk
+ * and ARG_CHECKs that the keypair is not invalid. It always initializes sk and
+ * pk with dummy values. */
+static int secp256k1_keypair_load(const secp256k1_context* ctx, secp256k1_scalar *sk, secp256k1_ge *pk, const secp256k1_keypair *keypair) {
+    int ret;
+    const secp256k1_pubkey *pubkey = (const secp256k1_pubkey *)&keypair->data[32];
+
+    /* Need to declassify the pubkey because pubkey_load ARG_CHECKs if it's
+     * invalid. */
+    secp256k1_declassify(ctx, pubkey, sizeof(*pubkey));
+    ret = secp256k1_pubkey_load(ctx, pk, pubkey);
+    if (sk != NULL) {
+        ret = ret && secp256k1_keypair_seckey_load(ctx, sk, keypair);
+    }
+    if (!ret) {
+        *pk = secp256k1_ge_const_g;
+        if (sk != NULL) {
+            *sk = secp256k1_scalar_one;
+        }
+    }
+    return ret;
+}
+
+int secp256k1_keypair_create(const secp256k1_context* ctx, secp256k1_keypair *keypair, const unsigned char *seckey32) {
+    secp256k1_scalar sk;
+    secp256k1_ge pk;
+    int ret = 0;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(keypair != NULL);
+    memset(keypair, 0, sizeof(*keypair));
+    ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx));
+    ARG_CHECK(seckey32 != NULL);
+
+    ret = secp256k1_ec_pubkey_create_helper(&ctx->ecmult_gen_ctx, &sk, &pk, seckey32);
+    secp256k1_keypair_save(keypair, &sk, &pk);
+    secp256k1_memczero(keypair, sizeof(*keypair), !ret);
+
+    secp256k1_scalar_clear(&sk);
+    return ret;
+}
+
+int secp256k1_keypair_sec(const secp256k1_context* ctx, unsigned char *seckey, const secp256k1_keypair *keypair) {
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(seckey != NULL);
+    memset(seckey, 0, 32);
+    ARG_CHECK(keypair != NULL);
+
+    memcpy(seckey, &keypair->data[0], 32);
+    return 1;
+}
+
+int secp256k1_keypair_pub(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const secp256k1_keypair *keypair) {
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(pubkey != NULL);
+    memset(pubkey, 0, sizeof(*pubkey));
+    ARG_CHECK(keypair != NULL);
+
+    memcpy(pubkey->data, &keypair->data[32], sizeof(*pubkey));
+    return 1;
+}
+
+int secp256k1_keypair_xonly_pub(const secp256k1_context* ctx, secp256k1_xonly_pubkey *pubkey, int *pk_parity, const secp256k1_keypair *keypair) {
+    secp256k1_ge pk;
+    int tmp;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(pubkey != NULL);
+    memset(pubkey, 0, sizeof(*pubkey));
+    ARG_CHECK(keypair != NULL);
+
+    if (!secp256k1_keypair_load(ctx, NULL, &pk, keypair)) {
+        return 0;
+    }
+    tmp = secp256k1_extrakeys_ge_even_y(&pk);
+    if (pk_parity != NULL) {
+        *pk_parity = tmp;
+    }
+    secp256k1_xonly_pubkey_save(pubkey, &pk);
+
+    return 1;
+}
+
+int secp256k1_keypair_xonly_tweak_add(const secp256k1_context* ctx, secp256k1_keypair *keypair, const unsigned char *tweak32) {
+    secp256k1_ge pk;
+    secp256k1_scalar sk;
+    int y_parity;
+    int ret;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(keypair != NULL);
+    ARG_CHECK(tweak32 != NULL);
+
+    ret = secp256k1_keypair_load(ctx, &sk, &pk, keypair);
+    memset(keypair, 0, sizeof(*keypair));
+
+    y_parity = secp256k1_extrakeys_ge_even_y(&pk);
+    if (y_parity == 1) {
+        secp256k1_scalar_negate(&sk, &sk);
+    }
+
+    ret &= secp256k1_ec_seckey_tweak_add_helper(&sk, tweak32);
+    ret &= secp256k1_ec_pubkey_tweak_add_helper(&pk, tweak32);
+
+    secp256k1_declassify(ctx, &ret, sizeof(ret));
+    if (ret) {
+        secp256k1_keypair_save(keypair, &sk, &pk);
+    }
+
+    secp256k1_scalar_clear(&sk);
+    return ret;
+}
+
+#endif
diff --git a/vendor/external/secp256k1/src/modules/schnorrsig/main_impl.h b/vendor/external/secp256k1/src/modules/schnorrsig/main_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/modules/schnorrsig/main_impl.h
@@ -0,0 +1,269 @@
+/***********************************************************************
+ * Copyright (c) 2018-2020 Andrew Poelstra, Jonas Nick                 *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_MODULE_SCHNORRSIG_MAIN_H
+#define SECP256K1_MODULE_SCHNORRSIG_MAIN_H
+
+#include "../../../include/secp256k1.h"
+#include "../../../include/secp256k1_schnorrsig.h"
+#include "../../hash.h"
+
+/* Initializes SHA256 with fixed midstate. This midstate was computed by applying
+ * SHA256 to SHA256("BIP0340/nonce")||SHA256("BIP0340/nonce"). */
+static void secp256k1_nonce_function_bip340_sha256_tagged(secp256k1_sha256 *sha) {
+    secp256k1_sha256_initialize(sha);
+    sha->s[0] = 0x46615b35ul;
+    sha->s[1] = 0xf4bfbff7ul;
+    sha->s[2] = 0x9f8dc671ul;
+    sha->s[3] = 0x83627ab3ul;
+    sha->s[4] = 0x60217180ul;
+    sha->s[5] = 0x57358661ul;
+    sha->s[6] = 0x21a29e54ul;
+    sha->s[7] = 0x68b07b4cul;
+
+    sha->bytes = 64;
+}
+
+/* Initializes SHA256 with fixed midstate. This midstate was computed by applying
+ * SHA256 to SHA256("BIP0340/aux")||SHA256("BIP0340/aux"). */
+static void secp256k1_nonce_function_bip340_sha256_tagged_aux(secp256k1_sha256 *sha) {
+    secp256k1_sha256_initialize(sha);
+    sha->s[0] = 0x24dd3219ul;
+    sha->s[1] = 0x4eba7e70ul;
+    sha->s[2] = 0xca0fabb9ul;
+    sha->s[3] = 0x0fa3166dul;
+    sha->s[4] = 0x3afbe4b1ul;
+    sha->s[5] = 0x4c44df97ul;
+    sha->s[6] = 0x4aac2739ul;
+    sha->s[7] = 0x249e850aul;
+
+    sha->bytes = 64;
+}
+
+/* algo argument for nonce_function_bip340 to derive the nonce exactly as stated in BIP-340
+ * by using the correct tagged hash function. */
+static const unsigned char bip340_algo[] = {'B', 'I', 'P', '0', '3', '4', '0', '/', 'n', 'o', 'n', 'c', 'e'};
+
+static const unsigned char schnorrsig_extraparams_magic[4] = SECP256K1_SCHNORRSIG_EXTRAPARAMS_MAGIC;
+
+static int nonce_function_bip340(unsigned char *nonce32, const unsigned char *msg, size_t msglen, const unsigned char *key32, const unsigned char *xonly_pk32, const unsigned char *algo, size_t algolen, void *data) {
+    secp256k1_sha256 sha;
+    unsigned char masked_key[32];
+    int i;
+
+    if (algo == NULL) {
+        return 0;
+    }
+
+    if (data != NULL) {
+        secp256k1_nonce_function_bip340_sha256_tagged_aux(&sha);
+        secp256k1_sha256_write(&sha, data, 32);
+        secp256k1_sha256_finalize(&sha, masked_key);
+        for (i = 0; i < 32; i++) {
+            masked_key[i] ^= key32[i];
+        }
+    } else {
+        /* Precomputed TaggedHash("BIP0340/aux", 0x0000...00); */
+        static const unsigned char ZERO_MASK[32] = {
+              84, 241, 105, 207, 201, 226, 229, 114,
+             116, 128,  68,  31, 144, 186,  37, 196,
+             136, 244,  97, 199,  11,  94, 165, 220,
+             170, 247, 175, 105, 39,  10, 165,  20
+        };
+        for (i = 0; i < 32; i++) {
+            masked_key[i] = key32[i] ^ ZERO_MASK[i];
+        }
+    }
+
+    /* Tag the hash with algo which is important to avoid nonce reuse across
+     * algorithms. If this nonce function is used in BIP-340 signing as defined
+     * in the spec, an optimized tagging implementation is used. */
+    if (algolen == sizeof(bip340_algo)
+            && secp256k1_memcmp_var(algo, bip340_algo, algolen) == 0) {
+        secp256k1_nonce_function_bip340_sha256_tagged(&sha);
+    } else {
+        secp256k1_sha256_initialize_tagged(&sha, algo, algolen);
+    }
+
+    /* Hash masked-key||pk||msg using the tagged hash as per the spec */
+    secp256k1_sha256_write(&sha, masked_key, 32);
+    secp256k1_sha256_write(&sha, xonly_pk32, 32);
+    secp256k1_sha256_write(&sha, msg, msglen);
+    secp256k1_sha256_finalize(&sha, nonce32);
+    secp256k1_sha256_clear(&sha);
+    return 1;
+}
+
+const secp256k1_nonce_function_hardened secp256k1_nonce_function_bip340 = nonce_function_bip340;
+
+/* Initializes SHA256 with fixed midstate. This midstate was computed by applying
+ * SHA256 to SHA256("BIP0340/challenge")||SHA256("BIP0340/challenge"). */
+static void secp256k1_schnorrsig_sha256_tagged(secp256k1_sha256 *sha) {
+    secp256k1_sha256_initialize(sha);
+    sha->s[0] = 0x9cecba11ul;
+    sha->s[1] = 0x23925381ul;
+    sha->s[2] = 0x11679112ul;
+    sha->s[3] = 0xd1627e0ful;
+    sha->s[4] = 0x97c87550ul;
+    sha->s[5] = 0x003cc765ul;
+    sha->s[6] = 0x90f61164ul;
+    sha->s[7] = 0x33e9b66aul;
+    sha->bytes = 64;
+}
+
+static void secp256k1_schnorrsig_challenge(secp256k1_scalar* e, const unsigned char *r32, const unsigned char *msg, size_t msglen, const unsigned char *pubkey32)
+{
+    unsigned char buf[32];
+    secp256k1_sha256 sha;
+
+    /* tagged hash(r.x, pk.x, msg) */
+    secp256k1_schnorrsig_sha256_tagged(&sha);
+    secp256k1_sha256_write(&sha, r32, 32);
+    secp256k1_sha256_write(&sha, pubkey32, 32);
+    secp256k1_sha256_write(&sha, msg, msglen);
+    secp256k1_sha256_finalize(&sha, buf);
+    /* Set scalar e to the challenge hash modulo the curve order as per
+     * BIP340. */
+    secp256k1_scalar_set_b32(e, buf, NULL);
+}
+
+static int secp256k1_schnorrsig_sign_internal(const secp256k1_context* ctx, unsigned char *sig64, const unsigned char *msg, size_t msglen, const secp256k1_keypair *keypair, secp256k1_nonce_function_hardened noncefp, void *ndata) {
+    secp256k1_scalar sk;
+    secp256k1_scalar e;
+    secp256k1_scalar k;
+    secp256k1_gej rj;
+    secp256k1_ge pk;
+    secp256k1_ge r;
+    unsigned char buf[32] = { 0 };
+    unsigned char pk_buf[32];
+    unsigned char seckey[32];
+    int ret = 1;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx));
+    ARG_CHECK(sig64 != NULL);
+    ARG_CHECK(msg != NULL || msglen == 0);
+    ARG_CHECK(keypair != NULL);
+
+    if (noncefp == NULL) {
+        noncefp = secp256k1_nonce_function_bip340;
+    }
+
+    ret &= secp256k1_keypair_load(ctx, &sk, &pk, keypair);
+    /* Because we are signing for a x-only pubkey, the secret key is negated
+     * before signing if the point corresponding to the secret key does not
+     * have an even Y. */
+    if (secp256k1_fe_is_odd(&pk.y)) {
+        secp256k1_scalar_negate(&sk, &sk);
+    }
+
+    secp256k1_scalar_get_b32(seckey, &sk);
+    secp256k1_fe_get_b32(pk_buf, &pk.x);
+    ret &= !!noncefp(buf, msg, msglen, seckey, pk_buf, bip340_algo, sizeof(bip340_algo), ndata);
+    secp256k1_scalar_set_b32(&k, buf, NULL);
+    ret &= !secp256k1_scalar_is_zero(&k);
+    secp256k1_scalar_cmov(&k, &secp256k1_scalar_one, !ret);
+
+    secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &rj, &k);
+    secp256k1_ge_set_gej(&r, &rj);
+
+    /* We declassify r to allow using it as a branch point. This is fine
+     * because r is not a secret. */
+    secp256k1_declassify(ctx, &r, sizeof(r));
+    secp256k1_fe_normalize_var(&r.y);
+    if (secp256k1_fe_is_odd(&r.y)) {
+        secp256k1_scalar_negate(&k, &k);
+    }
+    secp256k1_fe_normalize_var(&r.x);
+    secp256k1_fe_get_b32(&sig64[0], &r.x);
+
+    secp256k1_schnorrsig_challenge(&e, &sig64[0], msg, msglen, pk_buf);
+    secp256k1_scalar_mul(&e, &e, &sk);
+    secp256k1_scalar_add(&e, &e, &k);
+    secp256k1_scalar_get_b32(&sig64[32], &e);
+
+    secp256k1_memczero(sig64, 64, !ret);
+    secp256k1_scalar_clear(&k);
+    secp256k1_scalar_clear(&sk);
+    secp256k1_memclear(seckey, sizeof(seckey));
+    secp256k1_gej_clear(&rj);
+
+    return ret;
+}
+
+int secp256k1_schnorrsig_sign32(const secp256k1_context* ctx, unsigned char *sig64, const unsigned char *msg32, const secp256k1_keypair *keypair, const unsigned char *aux_rand32) {
+    /* We cast away const from the passed aux_rand32 argument since we know the default nonce function does not modify it. */
+    return secp256k1_schnorrsig_sign_internal(ctx, sig64, msg32, 32, keypair, secp256k1_nonce_function_bip340, (unsigned char*)aux_rand32);
+}
+
+int secp256k1_schnorrsig_sign(const secp256k1_context* ctx, unsigned char *sig64, const unsigned char *msg32, const secp256k1_keypair *keypair, const unsigned char *aux_rand32) {
+    return secp256k1_schnorrsig_sign32(ctx, sig64, msg32, keypair, aux_rand32);
+}
+
+int secp256k1_schnorrsig_sign_custom(const secp256k1_context* ctx, unsigned char *sig64, const unsigned char *msg, size_t msglen, const secp256k1_keypair *keypair, secp256k1_schnorrsig_extraparams *extraparams) {
+    secp256k1_nonce_function_hardened noncefp = NULL;
+    void *ndata = NULL;
+    VERIFY_CHECK(ctx != NULL);
+
+    if (extraparams != NULL) {
+        ARG_CHECK(secp256k1_memcmp_var(extraparams->magic,
+                                       schnorrsig_extraparams_magic,
+                                       sizeof(extraparams->magic)) == 0);
+        noncefp = extraparams->noncefp;
+        ndata = extraparams->ndata;
+    }
+    return secp256k1_schnorrsig_sign_internal(ctx, sig64, msg, msglen, keypair, noncefp, ndata);
+}
+
+int secp256k1_schnorrsig_verify(const secp256k1_context* ctx, const unsigned char *sig64, const unsigned char *msg, size_t msglen, const secp256k1_xonly_pubkey *pubkey) {
+    secp256k1_scalar s;
+    secp256k1_scalar e;
+    secp256k1_gej rj;
+    secp256k1_ge pk;
+    secp256k1_gej pkj;
+    secp256k1_fe rx;
+    secp256k1_ge r;
+    unsigned char buf[32];
+    int overflow;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(sig64 != NULL);
+    ARG_CHECK(msg != NULL || msglen == 0);
+    ARG_CHECK(pubkey != NULL);
+
+    if (!secp256k1_fe_set_b32_limit(&rx, &sig64[0])) {
+        return 0;
+    }
+
+    secp256k1_scalar_set_b32(&s, &sig64[32], &overflow);
+    if (overflow) {
+        return 0;
+    }
+
+    if (!secp256k1_xonly_pubkey_load(ctx, &pk, pubkey)) {
+        return 0;
+    }
+
+    /* Compute e. */
+    secp256k1_fe_get_b32(buf, &pk.x);
+    secp256k1_schnorrsig_challenge(&e, &sig64[0], msg, msglen, buf);
+
+    /* Compute rj =  s*G + (-e)*pkj */
+    secp256k1_scalar_negate(&e, &e);
+    secp256k1_gej_set_ge(&pkj, &pk);
+    secp256k1_ecmult(&rj, &pkj, &e, &s);
+
+    secp256k1_ge_set_gej_var(&r, &rj);
+    if (secp256k1_ge_is_infinity(&r)) {
+        return 0;
+    }
+
+    secp256k1_fe_normalize_var(&r.y);
+    return !secp256k1_fe_is_odd(&r.y) &&
+           secp256k1_fe_equal(&rx, &r.x);
+}
+
+#endif
diff --git a/vendor/external/secp256k1/src/precomputed_ecmult.c b/vendor/external/secp256k1/src/precomputed_ecmult.c
new file mode 100644
# file too large to diff: vendor/external/secp256k1/src/precomputed_ecmult.c
diff --git a/vendor/external/secp256k1/src/precomputed_ecmult.h b/vendor/external/secp256k1/src/precomputed_ecmult.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/precomputed_ecmult.h
@@ -0,0 +1,38 @@
+/*****************************************************************************************************
+ * Copyright (c) 2013, 2014, 2017, 2021 Pieter Wuille, Andrew Poelstra, Jonas Nick, Russell O'Connor *
+ * Distributed under the MIT software license, see the accompanying                                  *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.                              *
+ *****************************************************************************************************/
+
+#ifndef SECP256K1_PRECOMPUTED_ECMULT_H
+#define SECP256K1_PRECOMPUTED_ECMULT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ecmult.h"
+#include "group.h"
+#if defined(EXHAUSTIVE_TEST_ORDER)
+#    if EXHAUSTIVE_TEST_ORDER == 7
+#        define WINDOW_G 3
+#    elif EXHAUSTIVE_TEST_ORDER == 13
+#        define WINDOW_G 4
+#    elif EXHAUSTIVE_TEST_ORDER == 199
+#        define WINDOW_G 8
+#    else
+#        error No known generator for the specified exhaustive test group order.
+#    endif
+static secp256k1_ge_storage secp256k1_pre_g[ECMULT_TABLE_SIZE(WINDOW_G)];
+static secp256k1_ge_storage secp256k1_pre_g_128[ECMULT_TABLE_SIZE(WINDOW_G)];
+#else /* !defined(EXHAUSTIVE_TEST_ORDER) */
+#    define WINDOW_G ECMULT_WINDOW_SIZE
+extern const secp256k1_ge_storage secp256k1_pre_g[ECMULT_TABLE_SIZE(WINDOW_G)];
+extern const secp256k1_ge_storage secp256k1_pre_g_128[ECMULT_TABLE_SIZE(WINDOW_G)];
+#endif /* defined(EXHAUSTIVE_TEST_ORDER) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SECP256K1_PRECOMPUTED_ECMULT_H */
diff --git a/vendor/external/secp256k1/src/precomputed_ecmult_gen.c b/vendor/external/secp256k1/src/precomputed_ecmult_gen.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/precomputed_ecmult_gen.c
@@ -0,0 +1,1779 @@
+/* This file was automatically generated by precompute_ecmult_gen. */
+/* See ecmult_gen_impl.h for details about the contents of this file. */
+#include "group.h"
+#include "ecmult_gen.h"
+#include "precomputed_ecmult_gen.h"
+#ifdef EXHAUSTIVE_TEST_ORDER
+#    error Cannot compile precomputed_ecmult_gen.c in exhaustive test mode
+#endif /* EXHAUSTIVE_TEST_ORDER */
+#define S(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SECP256K1_GE_STORAGE_CONST(0x##a##u,0x##b##u,0x##c##u,0x##d##u,0x##e##u,0x##f##u,0x##g##u,0x##h##u,0x##i##u,0x##j##u,0x##k##u,0x##l##u,0x##m##u,0x##n##u,0x##o##u,0x##p##u)
+const secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[COMB_BLOCKS][COMB_POINTS] = {
+#if 0
+#elif (COMB_BLOCKS == 2) && (COMB_TEETH == 5) && (COMB_SPACING == 26)
+{S(7081b567,8cb87d01,99c9c76e,d1e0a5e0,1d784be9,27f6b135,161e0fd0,3f39b473,ad5222ac,f062cb39,21b234a7,15b626ae,f780b307,9b5122d1,53210f42,d9369242),
+S(228af17e,df90d1cc,a40173e9,478fa445,9780dacd,c3f15b90,fda5d00e,1faa1b51,8ff47c4d,a4ba636a,f656da9,12a81f79,6252496d,1e519886,b2c2b073,25be2b4a),
+S(b515ebe0,f48fb34e,9e01824c,d90553af,db116579,96667847,5ebaa700,242fd722,4cf08191,510fbf0,51f9e19a,198f11f6,ea31268c,2a6d384c,60557250,f0553c50),
+S(c37581f1,35446ff3,e80cde04,ec987f08,5af3af9f,71d87494,99b03ba,dcb8f78c,9e46324a,8d8754fe,fbda7c34,2446cf72,b7472708,25cfb92f,a22a4e73,4f1e9bc7),
+S(768392e3,b2ccbbc,21792f2d,6f43c63d,efcc249,bcd549cb,96abd8ef,4ae59e90,5d061a40,ac3f93d1,82f0f7a9,914fff5d,90bbacb9,1965882c,591e89bf,c49da994),
+S(a9db5de9,2d96c715,8ce5ee00,3d186cf1,976f6a76,f1be0714,726594fb,6c1ba564,743df2a8,ee73fb4a,47b3d0f,2f2b8cab,5af5227,f232946a,82676e4e,8bb70c8b),
+S(58921d8d,3712f640,657e762a,737ccd0a,cece1459,a2ba8323,20b43903,d4953f93,78c26959,7e422c02,c01fcbef,484a9d44,9f635c82,849bc2a3,2a9bf6ef,3e6f1e7e),
+S(bae41760,ade541bb,60028015,f6906b78,aa41515a,d995dc40,afa091da,77ae8b9a,716ff74d,ad6dc24c,77ebe31f,abe19792,41d18b0f,43ff7598,c6ea04c6,6899219f),
+S(e836ff6c,6f9e02e2,4e6f6bcc,2f2460b4,9de88730,6d69241f,b22fa574,7e100f80,77c41df1,4d87b6d3,de74deca,ad426635,f85daca0,ab966a4,5a26a972,32105c5),
+S(c7f17d19,fbbf28e2,543fceb2,4268ff6f,1b85e189,79b09991,7457fca0,9ba1b5a4,23a6d4aa,83ee15bf,f1655575,3e4162c5,8acedadb,4c4abfc2,54b7018,f477514b),
+S(79c337ad,8835046e,572eea35,df76276b,84e99172,7bbc68a6,8c0b743,28619a,af6cf2b3,9c6b51c9,f1f92e42,6598dcbe,39da6196,2abae0da,d5fc8d0a,aa16a875),
+S(1e77739b,12d20887,2bfe200b,d202972a,544804f5,2b0969c5,c22fbe1c,b8b23837,880c7490,c0455322,a0f1e67d,34b3fd1e,33c1e7da,83b9b047,5aef7bc1,332ccee5),
+S(b1d314c1,74d493f6,c36a893a,830d90b,f1e86d0c,6deceee0,edb77ff4,31e9607f,8a4ba010,ec3e47cb,29d8f056,e056eb73,3b6b35f6,4c742d06,9ab832f4,68bcd3be),
+S(2498aea6,471f748a,f14e50e6,bc17e0a3,ee09514d,fccbd174,f8a21d02,dd0fae48,55a3949f,2e4188e2,b3d344ce,6f0276b5,99b121bc,358e8fe6,bc4f03f5,a8219d08),
+S(42d0778e,27e87710,dd19285e,d531af1e,7064386d,11b1b3c9,fb788bf2,b0c112dc,37888909,d943825a,9610e37a,362549f,547b7c7d,ae64a27e,c34290f0,b4fc5fcc),
+S(af09a9f8,3a21b2fd,69ce14c5,495c680e,df18e426,c1ca5a1c,af56246f,d6ea5bbd,8eae43ca,8e591017,62c4cb02,9e5cacd2,58f0fdb1,ddbef7e2,c5765208,107c96af)},
+{S(4a7f72ed,ebd8df1f,13db15be,3ab296a8,d67edee4,37965f03,eb501205,3518ddea,1f8c4dc1,2d0e59e7,7d30a326,fd4ecbf8,aacd5fb6,7dc7169,898a9708,ac46b972),
+S(c4d4f8d4,949d1ff6,559925db,f4d34972,af16062b,d59493b8,b1e0d546,c2870874,cd7f93e6,c0ee3fdc,4267625a,a6620540,4f6d80c3,d0f7210a,ce6b52e,c350706e),
+S(773627f7,dcc56184,7eabafa3,42fffade,325b8ee2,a96f2f77,cbe675a6,2942277d,fb0ad731,9bff4c9c,270d93d1,89a4c380,218ec9df,1f564228,641ab35c,46526bd6),
+S(ff443101,befd0bd9,e1914864,3eceea06,b9cf711b,1405e3d5,3883a29f,906063ed,aa1b7d9f,59cbddf7,bc1ad03c,44c4295e,efb406ca,7960c683,eca508d1,b2a9a2dd),
+S(cbfb6813,a6874b65,9234e866,c2875f70,e45f9f76,3d634752,3f86040c,880a2e56,ed85d1a,6620c1a4,85ba3038,d2ee6590,4e27206b,eaa531ec,1eb5b886,8232cbca),
+S(4e85c77b,27788563,aaeba139,975f7125,f3c933b4,8d67ba6a,2e964243,bdd7bb51,200a9d9b,3400c87b,1fb98422,3200aeb8,e6a5af1d,58c061f0,d059c0b8,d431c08a),
+S(d58178ed,f0ce32e3,39a524f7,ad389f7d,8817f41f,ed782612,45218816,2a67d4f0,4840df81,5dab9596,93f9284c,54bdee72,f4861d39,3944c648,ecd76ec5,6dd3225e),
+S(670f8f7,9b66496d,13692558,d56d4cd7,a1eeb0d6,9e5133ab,4f0a064b,7152fce4,1a72206,6f530586,927c2e39,370d11f3,e251bd9e,eee10303,406b7592,716333d6),
+S(10b41abd,ed4de2fe,b7a40050,e61e5982,89a8cf3,6eaa608c,f2a82c63,5788f1d0,532d168d,680e9c74,4d5111da,6aab902a,9a0f5283,7836b9d9,585dbc8b,1a407de4),
+S(76abd21b,103aea9a,f04b4040,297894ce,a501474d,9d38d30,8ed02cc7,137bc7c9,b5a432ad,9e92935f,7040897e,3b04152f,693c5f2,cc1e1d53,2c33f70d,185318e1),
+S(4335e10d,5e4f02e6,f1b58a0d,ffb473ec,15f735a3,bf96c140,50bae78c,37061db2,1301143b,1f29f122,afcd0230,d46b6b38,b154e589,92b7eeb4,16088968,a7d57485),
+S(2b3966f0,7e37e771,ac4c68ad,b8eef3c0,977cb895,2f47676b,e658aa86,76057f67,5382a6c5,bcdd1a01,6d79d817,80faf650,c0a486bc,ea8fb592,1cd3492c,42c91c3e),
+S(f7738800,b7fdf237,dc7f03fc,43724011,8b53aea4,4d7953d4,276f3b4d,bf5c0ff8,c1de7924,ef8dfeed,c4fb409,f1a15d4c,5e8ab42c,90ea9c92,867b5b5c,f2921605),
+S(5cb07874,ac4ffb86,2da619be,4c8fa38b,e8b261ec,3ec73a12,cd4cf8fc,4f8d5dae,549d1896,4931dabf,ba4553a2,461f2660,87733454,ea8eec6b,f671e3de,60c70340),
+S(5cc85d41,7b2ae9ac,dedb1b44,ce78d8a7,8f56b878,1a4b3af6,635a55c1,fead3be7,66a48c79,301e57d4,54cc8644,d2e778a8,45d85762,2c10eb98,d77eb873,e58bbeca),
+S(f27211c9,a067b01c,7fe7fbf7,7b5d9b0,eb0f2475,9d541457,6eb24ba4,19fd3db8,e26d28eb,89f7b518,e9ae0b88,fadbfb9b,641d3a44,c59c6f93,ec28a541,486e041e)}
+#elif (COMB_BLOCKS == 11) && (COMB_TEETH == 6) && (COMB_SPACING == 4)
+{S(629bee58,a391595f,eb20c534,4933937a,cdb2eba1,86d49f8b,845c1b5f,4ca87182,8dae4162,73c6c068,2e2aede4,76efa86b,7612c07e,f72070d0,dc4486f1,47e95085),
+S(6fd5e13c,a94b874b,28cd574b,726efdbf,143ab108,1089b846,7b5b2ebe,6c6a3c8f,4a4db306,52c9772a,868b2859,57c5a005,d83f6afa,6e65d87c,700da998,ce651396),
+S(609b6576,191514f4,83f5b428,500cfbaf,96871b8b,3348fe5c,1a131768,bb266b6f,90abb9c1,1bf184d2,8dbc424a,bbf74eb8,de4e0582,2ea5dd93,7d1e8b30,e5f695e7),
+S(b5ec0263,27cfd922,23a46abf,a755e6fc,547806ea,333666cf,a43865a3,f4ae647,143353c,cc733d02,617f7764,7dc29c65,67a2e245,aed27120,e5fc11b3,95ffb9c9),
+S(ac1fff6,cd869ed5,ca920544,1ceb990c,ce304998,10e27587,6536dcd8,1d4cd15,67a7a012,3e5ea292,85dedf0a,9f138b80,58a1d23c,2a233c5d,783bec39,b6482126),
+S(c1807552,644130a3,f9b8aea0,29fdccdd,59e03e27,ff2cb1f9,9d13cf0d,42da7b13,85e99587,f77a25b0,bc64b882,bd279fa3,5be0262e,c2f5253c,70a43261,bd1fe361),
+S(42919187,2b3c6877,c3b91266,79266e49,9fa37a8d,74d094a8,8c4a3638,89c2717c,1e4bd2df,a9757d42,285cca1d,856b49b0,ad481ad,828d826e,8921f744,7e04d6ad),
+S(d4b10124,283afe03,4b278e5a,91daf61b,be608417,fc845e1f,9b9f52a5,43659f2,fd070859,75e2bad6,b34e0396,47b81a87,cab9fb,fdba802f,6ae3cc8b,67cc98cb),
+S(ec4c2c4c,722a54ae,edc37acd,cb6ac490,3077bdf6,3f2c145c,7eb25e74,87c046aa,327bfe37,d745283b,a385dfd0,8e30b61e,2b4e5499,4432be41,fd3f0d31,c00e9ed7),
+S(559e40a7,e151eeeb,46442b86,aaf4922c,12030adf,7279bb2,2bca24c6,67566a05,5483756f,60d26b97,82033592,cec21681,c5b5496a,c47f600,2013e5e5,f2ea82df),
+S(c1d2e92,19c0138a,9f0a34fd,acc92f4,eafe13cf,1c004b6a,3175133d,6cc7bf12,8fa653f2,a20c1262,be59c7db,20f12579,b2adb1ff,54d84ebc,e5ad4116,3d2ebc23),
+S(1becc6c0,e4861825,576624e4,fa622c01,139d9cb0,50c12062,9b87ae6b,9622245,d8516472,656ea10f,5b23839d,43f64e,85fc727b,faafcb6c,fc9c6e89,bf9c038d),
+S(c483c2b3,8ceefd35,a9fa9e7a,da242c,d618cd6c,8b3bcb62,e39d68e,c1effab2,71964aca,9101863a,d7c865f2,41e814ef,3c20face,f46246b6,4a742026,471b2495),
+S(3487162e,40c7efa6,92bc827f,9af9121e,af5ac549,b4ab6585,6353d699,a94a3783,f5b29042,28833bd6,e3ce0deb,dc0396ca,42701752,f930f437,d042cab2,8f135c1a),
+S(eb3b21fa,f733f15a,b94ee0e4,3378e9b6,47571aff,d69292ad,a1b107c8,ad511d5f,cd95b4ad,b8768858,cb750cbb,4fa64523,6b6fde59,ceb71dd4,73a7fe48,9e5a2304),
+S(21c8dd7c,34d3f333,758d1d1b,72748fe0,8695af46,3d0bd9ad,e4a6498d,1d01e9df,634d8671,7b885f36,a54b6691,35c3c026,667f3cb6,f2577701,beb0d3bb,84f07940),
+S(608e33b8,14998177,5d78e286,d5c6436f,99623417,4e887da0,a95274a0,d120b57d,5d094ca1,181f8dca,87d1e043,f798bfaa,f1004edf,a470fce0,7ff8b124,328397a5),
+S(f77710b4,dbc5f7fb,ac6b015e,956ed26a,6bbfb540,6a931a30,d4215aed,de610c7,7508a762,a7333ca8,ac244d6,47e47647,c62c82d,387d8df6,175fb563,1de83d54),
+S(f37040aa,b0347fe,976d5980,cbd83db5,4d8cb90e,7f2d2118,85159911,af769d61,df228dd7,67fa0d5c,d44c3f6d,b09e662b,99faa5c6,688b088d,949ddab1,6f11e42),
+S(7bf929f3,25374a1b,a0cbaa50,db47fea2,a5d1e3f9,3c34bddc,ea5c2250,d8252071,8fe2d2bf,b23a6755,50f16760,a6511ae8,4e4d316c,45d7cd62,4411ad3f,c72805c),
+S(261bc0f3,a69d636a,b82248,6132bf91,2ab7ca95,e9a4925,b3f68bb4,745ee63a,68f52f7,df1ec349,77856c74,7b280907,cb3d456f,988ff7a7,225c4ace,8457a804),
+S(60ef138d,e7086d09,711defff,68dad211,88d7f878,d616efb6,dbd3d498,5b730243,ca7c3297,3c56b178,b0cfb8a,da98748a,c3d06cc0,7fe050d7,3a6a9695,52500f8e),
+S(8bfef3d6,4be90cac,8b83bf20,906b4277,75a6d982,23d5141f,b74e3851,50bc5eec,ea8b6b4c,c7c8d9ba,809ca811,3621c72c,b82006d7,81ff5f25,32010fc9,57858324),
+S(9ca85f3d,4ba47ab0,e9fc0a28,74cd10a4,a8ba9aeb,ff319405,6140fea9,6e395ff3,41182ce8,96554f45,93768fc3,a656981e,69719f05,5469f9e4,ba79de22,bcfe8a8e),
+S(38cd0c79,437b1299,9567999a,f54d4f8e,82a6354c,8a93a5ef,56ca2ff5,8a1ce180,c96f5ed,d78de5,9f560716,82b60b13,f06de5f9,49206258,80544bfc,73dfa76a),
+S(be37e05b,9369b159,6b390290,3eb8fa0f,f221f599,1270c5f0,47edf62e,a1d0e6e2,4fc860a7,1fa69a27,fbefd8c0,906fc68f,4713fa2a,b37aaa2a,7edd3c8c,d100963c),
+S(aa640e99,b091512f,85faed73,a3ac8ede,ee120513,b661f812,9a046a74,d624aaaf,dfb48ad1,a01fd508,e5652406,b681cc9e,13d0d600,68411dae,72d68061,6f6b94ff),
+S(d08bb931,f008a1a7,38a16200,9fbf1ab3,d3d455dd,47f45cd6,617e81,8b8e0245,18d92218,21c9a2ed,bcaa5d26,2b7aba18,1f7f1e,7f2007a9,ec6f7d18,f038d723),
+S(4e6ed1f6,c39c894f,eaa53e1c,e115fda,75fecf8a,55794628,d9a2202a,9dd5c719,1bb97d73,2e0e137c,e9c94d4c,763f9a6d,e1496548,904460d,df1c3a2f,73b66c1e),
+S(867e83ae,610a24bf,401119d,8e1af6dd,414a7161,52b2ffdc,50f71f77,2fa8409c,d5d21ad5,ef365994,b3ad0533,92df82a5,6f677cb3,8500781b,a769dd50,1f6d235),
+S(6031361c,6dffc505,dc7e1887,bc75c1d9,5a9db023,8b7240e4,c254f855,b35686fa,b9a9a979,c6b8c576,11eeb783,8b4ac2ae,66506bb0,a203fdf6,3efa9b59,98c7643d),
+S(8502d0f,34684503,68784822,f4510c5c,562ad30f,be29a792,f0667e83,b6f95773,cd0e6511,763674b5,57fac9f1,bb62f9e2,3163a0a4,cf08cd52,a6d10064,d8b02ade)},
+{S(840e41bf,13203a96,f41ea041,1ec034fd,db0dac3d,53b6bbc9,4f8a3a78,d0371235,71b51550,a79af319,56c9b3de,fcb167d0,c3e318eb,a852eedc,78490dc5,fdaaca85),
+S(5678a034,a24a1607,d78036b2,23eaa3c3,845c9f9e,7293f656,7390354,2f714d5f,57f624be,ff5d1774,c6962dd4,d14cc565,acae170c,7aaf8c6d,b0552daf,e3bdf48c),
+S(722012a5,57ed9c9f,9d737a87,39954469,ca12ab29,9dedbaca,507c1259,7a27c6f1,6c28881e,a0e62453,80d73a7f,499f05a4,d9a9c04f,c2ba11e6,9fdd0b6,7c5d5ee4),
+S(70c638d9,3eeab892,8bccf1e4,82368eac,a03ca8f1,b30f7b2d,34258539,8c95c014,f8635082,3dc2a200,67dfb293,891929cf,18a810f2,5c85c169,159a4b44,b190a029),
+S(2ce4a530,b5f6c77d,c0c4d891,6e89b24b,c25c04c2,723842d4,29300f82,5e260458,6f306154,4d1195ea,98b972e,91a962e2,95a2a4eb,9be03949,a789b01c,f61dd705),
+S(89e71182,851bb441,c0af4e31,cad89dc7,3947369b,fef12eb6,b1dfa71a,72498c51,20b7ffd5,878718c2,2b5bfdc,ac422794,63aac0da,4bcdec2a,8f3b538e,3a9f574d),
+S(f01f06b8,da0ba34c,e1045e83,adb95fbe,b76f134b,35235539,6b07f8de,9dd25869,afa0fb5b,45ad1f24,73460f17,5ff4bfd8,f162262,65c423fd,ebd92bc1,72f3aa7b),
+S(f0c217c8,1dda2201,1f46648a,e096906d,71fba006,1b4dfdb9,85dfe59c,9d8f1894,d5ddd6b7,bdf2a6f6,cba166ae,4c01c60,b012c9ee,ad954a46,6f631f9f,928b3fc),
+S(bd9acff2,87cc2a2b,396aef61,b0937a49,c43a2366,a2c3c461,c1283987,a7b6f53,828de0ad,b9067b2d,8f8fefe6,ce3a5c94,e7d63ea1,7c891d2c,5f266e8c,a5fac116),
+S(ee314d97,2b9c10a4,fec9f8d,ccab0015,d4923e52,d915eae8,b319911c,7a8fe379,82057aef,ff05c496,ba8b4753,c4e57832,aba9a724,adf70a9f,1b3765ef,952ab52),
+S(d39fa7b,9b87ee2a,aa32454a,13470406,c8024c39,cf387143,3364de62,cb94c103,5cf1309,530f9e09,c9b38ad9,3a778ec5,533f60f6,4a42e31,1cd97c2f,c984b9cc),
+S(5ab1a07e,5f6aff68,16780e5a,23c9faff,b29cd7d7,5bfb8984,4834fb6b,c6b34a14,deac47fd,6567023e,b5ec7a94,a0133bbf,158c0425,c0a6d288,23558986,314d54bd),
+S(b1a4ecc6,94bb5212,98e80464,cffacd32,331ebc7c,4d545141,a129b522,a4818830,9772044f,3722ec57,d76a049b,2afce2b6,319f0bbc,b17c7f06,175a288f,3ce3534d),
+S(56015e42,81aed744,a0859e29,eb913a7c,b44ebd39,2ed8c0b7,1eb42f9c,9c93c8ba,8f973650,45f7d8a9,24a276ac,20056895,fb2b0aaa,4b35468a,a51f41f,722b9d33),
+S(7d99a5c5,21543229,c8f9c7b,50dbaa64,b200bf86,47c71b35,a0105dde,2b3a8e0c,eae09ef,3ffdec8b,9a30291c,244c0a72,6466c26d,fe2c8d30,174f57fd,ec6aba60),
+S(ab7d21f9,1e7dac68,afd6e4e4,794551d5,55a9f42,59825109,5b25652e,946ebdae,8805a806,710ed7b0,fb99ff30,130c074c,6a0be3d2,abe6e155,f9c07496,f8b92454),
+S(b31a5f85,d65e5200,8f5261cd,fd6d36f6,4b2a1f3a,6f08d7b8,defc7e84,21d0f7db,2e6d46c3,3733b3b5,597a133f,7459ee2b,570ba333,4d1e7648,1980dda,1aa8d2d3),
+S(30af789e,850c8ef8,9eeb226b,27786679,442a9a0c,35cb7337,98345400,29220fc5,f6651170,c83e24e1,eb6e8da,ffa0b0bb,a6c53676,72558d44,c5b77176,3d9b5d7f),
+S(8d87f808,98fb8007,ffd5093a,bc6bad2d,23e09e90,e6967031,48d5418,4c60e0ae,3d14332c,21df527f,a2e98243,d3ed4bd0,6634d799,9f62efd,e8d6c919,8ed716a3),
+S(a961c219,eb9ea127,205af30d,909ef732,8cc599a,b2080966,f615796e,1126dd98,3e235ae0,37b10074,32e5cee5,56778856,1d552e3e,bf40bb82,5b527cac,8e1e5b9c),
+S(b9c2de21,40cea728,2aec5293,bb77dc7b,550a72c8,84389c05,310651bc,7570f2ea,74171cd9,4a5683b7,5bc7c5d9,b4c8fc10,1fecc3b1,b7349ce,840b6ca4,877fed21),
+S(cd041ff2,e8191946,8fd7ef0,c33021d2,9533cd75,64772252,c686f718,7e33166b,3f54a9af,e8597bb,faccbbd2,9280e60,93d31bc5,b366aff2,2c95e21b,fbca6041),
+S(adfce0b5,8a9cef85,e690b84a,c7ccc6,8f5aa4de,ada5e265,3720412b,e1f19ae,8ae2dcdb,c6ce83be,825593d6,87f9afbe,a88af079,564c60d5,c9b88898,897515ea),
+S(833a50c2,cb5507c6,60bd450e,cde341c9,64f2809a,e400215,c52dfaa0,9825df96,de85e216,493cdb4c,4541f720,201f4c67,1472b6a,d61cf8ea,3cf54ccd,a4584b77),
+S(3475027a,628ea423,2d689d70,d45e975d,39d62303,282b16b,1f94a427,3d7ea746,97c3052d,9270df78,6efbd2e7,beaa58cd,f864e28,905e3ab5,507cb9aa,e3c69160),
+S(cbda2707,e61d9e40,124668ef,7ed83973,dd293dfd,221396a8,d27e7aa1,392edcb3,fd5023a8,af8eff08,f0e3c8b9,b6a22a99,b3ec3aeb,7e0104dc,1f8409cc,d83d8a02),
+S(963722ec,aced2105,2bf447fe,619a8532,dc78816e,2e17a111,3ffc601d,9bec0381,f31feba,259f7d0e,3c326c69,53aae60c,1e0479da,5ca839ea,77c6f1a4,9419172c),
+S(fc531e1d,49d2a984,83c861b2,b299b8fd,b26831e0,3bced6da,5c4449b0,18363be7,9f9cc9b0,8d72ced1,998c6329,a17695d9,c94cfc76,ba9f6943,1c5dab83,60f2942),
+S(dab255f5,b47d96d8,ec5272b,5cde4ca4,33070920,84aa4866,d53b674a,330aea2,feeda13b,a544f090,b790514a,42064cea,509bb3f3,9dbd4567,6bd75414,37579d7c),
+S(ac5b161c,fcc42998,71b49d1f,8cf35bd4,dd6bf98e,5f84f2f6,420bc363,b9cac257,4511d4d3,1fa26d7f,e56f671d,7467bbd0,41358b36,b60775f8,65f7d491,3d17b685),
+S(b62fbfcc,2aca0706,b0fe67f4,ed5d96b,4a65b048,f73e8f4c,9782e1ee,36189e31,6549e8c2,f77bc824,4e1a90b4,e42ca64a,5ade1768,a0996d69,8d7b047,7bfbf862),
+S(56938443,5e509000,5cf3dd18,ea629078,e15097e9,da7bb5c5,737cfa0a,a40e8818,f86a1815,4f379054,11016994,9b2eba6b,477c32b8,b68091a4,4b14990a,5e8eaf92)},
+{S(7c028bd1,75367939,74871a6b,cc957d95,3813331c,87ae606c,17aecbdf,a704ebb4,4fea040b,a0ef0319,91ff9b8b,7829c0c3,93895439,d506c5c3,1a1a3fd9,e32e7e59),
+S(24e966d0,bf1227ca,11eb8fd7,8dc5369d,2bb9b681,927990b6,dd02b948,fc18a169,72b7fa7c,f929a6b1,c556a372,4149a279,8d57f504,4b50a1a7,922cfddc,17308ca7),
+S(a2b7db3a,265b30aa,94823577,6d5ea839,c4fe564b,97a5e3da,313f7fc4,5de617c5,5e895546,a2778162,4a91ea4e,c104c911,85f3e954,f8378fc2,bea41a3,f1cc9e15),
+S(e365c695,449c9976,cb67ede3,325d9229,ee526349,e6b255f7,f4e72184,6722580b,eff99cdf,a0920505,ac37e46,b812d47b,31a29113,e491208,a19e3edb,557ac2e),
+S(c3d90905,297c3a65,2c6c3d5d,915cd9c2,d741f472,4a47c8cf,35e5cf3,cac9dd11,8e9ebbd,34a7dd02,24fa6e33,193cdd72,4906dc81,a5aa41ee,4a34d3d0,4b2ee5b3),
+S(6e4e23cd,ee4388d6,e8b61f8a,af7678d1,a62b3e1a,3385d278,895a02a,de4c9f00,f69b843b,ae39cf41,11fe9b99,a0287057,5695421e,e1ea690e,2e76d937,e7e32c01),
+S(92eb38a6,3743088a,39b58cad,4eb4a27e,a8b08c27,444d704,6d2aa5f4,89713217,22af8d6c,d3567a6d,cf7403ef,e0afea02,48ea4266,1577005a,9afb5f2a,19611864),
+S(b3c84323,e2d022fd,d2a80d07,203f4a26,f5d32dae,62842072,9663a994,3a829d08,9a899de,82329d94,83b88e1e,1bce53ed,8714cad4,c68cd491,1b71bc0a,e3839821),
+S(daae5199,57a6002,8958b22e,6dbbee20,c4bbd8e1,7ed589e,b8528f35,7a4dbb40,afec8a03,321586ec,ac38e941,7fa8e342,f0542193,59decf5e,56479a39,c32f92af),
+S(7afb9a56,89fd1344,cdbc5c72,62dff7b,718c2e47,a6e19ec,665af795,86ed0161,d1c2c9cb,60a191a9,a3db7e20,2ebc2eff,444bbaa8,d81ba086,6f8825f3,8c765f53),
+S(8d0c4a2a,e72b54c6,236d997d,61a2a24f,ddbd39c7,ee16f1e7,d7c45b22,b4bfdac8,15a58f4f,fdad9e3f,b4d33c7e,170747cc,6a5abfdd,bfbe5814,ef0c3611,6a0a9e91),
+S(24d8c0ca,53400126,347e67f3,72f19298,595b6d33,76ba2f19,2fba6dd1,7b57bda1,7c01404f,bd316814,f10734a1,559049ca,d6f20e90,d6b13ed5,f9542630,db77f9ec),
+S(4c2b7a58,87a49df4,f98cfc72,22fdd832,362b8cc4,c5f4fff4,d0a20674,c9749bde,c2a1cfcd,e8636288,31a5c450,fb5cf552,c76e581f,9274e5d9,888a3a68,c37ca349),
+S(2028e381,f42cc2f7,a8829308,bb72881e,94e5b54e,3331d848,898ccabc,bf971cb,16debea0,203f0709,d9b55b0d,2b8651b5,cb085d8c,8f56708d,c1fe4d33,a616dfab),
+S(d11e0753,f72b7c4e,641ed50f,84dfa24d,a0baea77,98fcf062,8b2696ba,a7ec2529,55af37fe,88324646,777387e5,a9b18059,ace20e9,becd7488,5e43fee5,fa6809e2),
+S(72309865,b8a1a6f3,9d6d561f,43ddf5b7,f2d022ed,95df130b,2563eaff,9008a95,f3fca0be,3ce7d9eb,e1648964,58eba87e,934d000b,a535f223,868dae11,dd5230e),
+S(adca4785,cbf38a0f,28de7b36,daccc761,89b8b918,f3fafa7b,abbbd9b1,4ed5485f,880d76a6,fbcce864,657edb9b,349f124d,1b22c7af,2b0ff833,40d7a0c4,84b49de0),
+S(bb43e0c0,93d58c6f,3946e58e,4727d7e2,d223c84d,513c4e2,222406bc,aafb03c2,c00f7dc8,fcbd55b3,6a95f2f4,a3a07b7f,9599736f,af099a69,e2fc2630,a2aef1d5),
+S(179eb588,d1c7aa5a,24e51f5e,6d86e4ed,2e6f0f98,bf956b71,ec1caca1,b7f775cf,42f461c8,a784f643,d5a8682a,6ec9b470,455f0ab9,f269140,b1ad2376,95f64afd),
+S(9144fc75,b00f8608,714f027,16b30575,be19dc01,d3689e8d,2665d967,6a077d11,b168c324,7dc6c31e,8302b6df,a2e7c053,dd849538,f9d45b87,14d889ec,cc789704),
+S(d6cd2a7a,b7253b86,34231eb3,2793f062,bdf103b2,4fade912,6206e745,a3b429a7,9903e507,dc5e3a61,d73fc83c,5c4ba476,6ae92655,9b208369,bee55948,4bfe444a),
+S(264845ed,623bd3f3,808ca51e,517def45,1fbc237b,e47e3ded,70c3769b,391a9f83,cb5022fe,3d535f4d,192e73d8,5d9ede23,78e0824c,e560a97,d53aabdd,f8717377),
+S(2df9621c,cf3e67da,54c47ddf,81e3ba7e,7b50e713,cc7d08ac,d64f47e9,85c4f334,8058f6e8,139d8e87,cce4a389,c470e3d8,45da3537,ccead4f3,abbccf42,a5fcc49f),
+S(ccfd6c4,c5966144,32d2efc4,1ccfa0eb,3e0b44ed,a4558128,c3e4d68d,949a5cac,bc77b87b,5f50d3a9,6b28d5cf,fb371b4a,36cc1360,15c548b3,f98d661a,beda8acf),
+S(4e2e6052,cd35d585,6531fcf1,73bf124d,3c569bf6,6cc54ed6,9a520d42,cb836296,6381d100,e5d9ae50,f1821122,b8e91a5e,f365edee,556fee1c,2fdb6d17,3fd29c65),
+S(6603d715,ed0f8725,7d9c3f29,cf86ad4c,aa0500ca,fa16a708,3168e265,b87d0255,9d2eda4a,6195e2c4,a4576e4d,5d02383,a3a01b2c,f94ab8fd,fef2f338,15807d31),
+S(f09ef30d,fade81df,2fcafe31,387ed34,5a8029cb,e93fec3b,eaaeb8ac,8adc9803,f9f3039e,5b73c7cc,cf841eb8,1c15203f,ba192e,9eb39aeb,36f56c29,44b286bb),
+S(ebf4611f,cb3a44a9,f9d5b00a,c559dbb5,394840c8,41a06496,bbd2011a,2508cc34,1e183324,9a610584,5d62ef4b,685152e5,c75c7525,c703f81,51bdd87c,6fda0d43),
+S(31fc3226,c19aea7b,4845ff2a,ddeca6a9,36505a49,92102cb3,499d66f8,a6e1a3b5,49babd41,b1e8a6c,a728f971,d8d8cb76,47cdb94b,89767a67,fd975ac6,93f144d1),
+S(be1e37d9,dadc4b4b,7a5ba74d,fb7eb55c,2b0a4fdd,81564f8d,51038afe,f716e3d2,de6f0c3d,b6efc974,975a7d6d,3c6e9d44,a712879e,4e95c612,164273bc,5de1f4b),
+S(f8034e14,2425cdce,31e82b49,cde33ba8,3630d1ae,283b8b47,73960539,c67f1652,a302e3b1,860252a5,e7114568,748746ad,1e02c2e4,280bc913,dd4b4d2f,92a561af),
+S(21e709bf,369cdb2d,b7f51b10,f0ff56c1,2c1938d6,18419d00,34e57d94,7b83d5e2,d7e09ab1,2e7d04f5,aab3a75f,8cf75876,ddc3cf0d,cb4b9526,ea7f755a,dfe1e495)},
+{S(638b6618,c1498946,75a1a943,8755a68,30d7dd3c,9d8a9f20,d65a7161,9c8b477f,e4e66035,e947c73a,c34a48b,b43a3762,d1038e6,893dee23,cf658a12,190d2a56),
+S(4b6ce93a,acd4954e,cf0febd1,fc9a965e,ae7fbc1e,e24a12d3,a4b86573,62eb255d,8cea4838,1bdf4e5d,79e25ed0,1aab94b3,5f00267b,3ec7eeb6,63833507,583407b3),
+S(e2a42110,3e8e2a80,a6451f71,b348434d,7d508023,beeed16a,d87417b8,5c7b7913,5fc15b62,124014e7,fa8f95cf,78ce8415,d46a1f97,d88be55a,76431786,8de3d605),
+S(6949956,91582c2c,2e14576f,5ec0dd37,65133237,a4e43369,633edf69,933d1f75,5ca8c2a6,329882f5,2daf48e2,e291c48d,febbbd29,9ccc9ff,3ad54ed,33ccef43),
+S(55d836af,2dd4b8a5,7f20eb57,6886790e,a3ccfcf9,2a2940b3,646f263d,685f62cd,7cc1ffe6,37781c72,d3cc26dd,9d4147c2,183c8e0a,95b87742,52ac47ac,19db266),
+S(442a3090,46bbf3ef,503a138,b60ddfa0,ea4a5901,ae801003,f3f18ad9,9703a44e,129d9913,eff78c49,16e67c4c,cb658784,fa47da35,92ea1c98,4054b371,a275639b),
+S(76981efa,29944c2d,9463fc94,67a92e1f,9403c287,dd595292,4860aee4,b78626ca,c87cb5c9,ce93ff3c,23189404,cabf8e09,996c4cde,e67935d5,874c705d,6a7f95ae),
+S(42ad08fc,2a1eafc3,d793f04e,304831e,c1bae89,c7d00b24,7785d870,904bef5c,c3913fd3,6b8c08c2,553b9c48,5b90221e,ecdc8d02,6d558bc2,5fdd6ba3,df78ed63),
+S(4d70ffbe,efc6254d,cee74a89,70244bd3,384b3af5,8510ca61,258fcbf8,f0c82575,ba3e19d,b022a75b,c75cbaea,84ff912b,867124d,a20e0d28,a007fb74,9a9d1c7b),
+S(4ec8dca8,7079487c,adfd516,da2df139,5477b524,df4aa6d6,4db5e206,cfb14b9f,e88e5bad,c8654d60,fe1f8f6a,73328209,63bb10cd,31aae381,ea1b4d9c,eaf9cb27),
+S(2e5a47c9,a47cbbb5,ef701784,34798a6c,48244df9,dab1e5d8,83c7f732,b89c7d79,7c8202dd,cf7fb6ec,471856d5,830d59e6,99c04377,c553d835,f64cb333,cc405c35),
+S(3ca98150,bc5f116a,e7034a07,628d698f,67cbb8d3,74869ab1,534464f5,5e8ed24f,fad702ec,c6b738de,5b653f78,f51c98d2,1e4bad57,4db97730,58324d1e,12b89f9),
+S(f414495d,9093ad22,11e001f8,b07b38bd,f5430a11,72899bcc,2c553b55,a9d4a225,bc130e93,998db229,6aef128a,5b8e5b9,9cf67eb7,713aa7d9,9fc4c902,af660f4b),
+S(44e794c9,5a28ee80,f9b64193,9c626a78,4a851a4f,84f28887,9eaec508,1b60e508,b219e000,1b07a275,f63dfb3b,e977a40a,f505be1e,d3eb8194,b919b9ea,70d7198a),
+S(35024622,bc17bec1,9c352280,297ddf7f,41654c08,61c3744b,13c74ed5,6673b98,64aece4c,3ec0b19c,cdbc06b7,4eb15704,50ff689e,6c5bafb7,6ae99396,12f4cca0),
+S(45c4f36c,ac4c4738,ab216363,e12b2475,50b8ef09,7a986ce1,60b0462f,f8725a58,fb944806,dee59834,7d256885,3761e3a,9ae666b,9b0ee095,fea33ec7,bbce9a5f),
+S(20a0b4f7,cfb58bd8,d09d008d,70e7f807,b4fa61ff,65f2e15,f00bddeb,55df1124,7961d1de,e98ca40f,4d09e5fc,52ae4916,cafdd6e,2bdb9f9d,2776239c,a3480157),
+S(fa10af8c,eb2de4c9,3c0c2cb0,95f95911,755b19d9,90f17e33,69930d6,6002fcd3,68a3bfb4,533bb5f0,54fbf91c,b771b08e,e388a61a,9727bb7f,a3a1f67e,60b2eba7),
+S(d417d7dd,30ebe9f1,7d52edd6,c82d91f9,25d5987f,a6f53b0e,d769a34f,e557c11e,ea89c810,619e32f2,369258ae,8ad8a456,cc36d87e,b45a42d3,83956039,62e437c8),
+S(349b002d,ecee0e4,1788a3c0,cabb9ff7,c17848e2,78ef8905,63924c55,52d59853,47583a2e,7ff61b9,6fa168b5,1191b363,efa3e0a1,ce825a3c,5bb04e5b,e403b4b0),
+S(4b8efc8d,7eeb3554,b5128e8d,ce20c29,697f79cb,29f61b4e,a2f7ac28,57910bb,e3cef657,7b5c0d2f,dee52c96,b6353073,b099fc9c,65688969,24cd744b,981c5ff0),
+S(f356e8cf,5785b05e,e99a2b4,d202b64,2b1e98c2,57741e60,7241fb9f,d3f5ea2f,9079fd65,59d5a93f,91370d16,20ba487a,a8c6ad3d,e67f2c83,a1c335,fb5398a2),
+S(bfb74aa2,15e5ce36,97cb6156,c2666ef7,1b579a50,56ff60ba,d3d5e10a,7eb2d31f,3def8a80,ddc3f407,e30d11fb,232f0e31,191bba1,d51a7eaf,b86d7f97,45d78dce),
+S(658748bc,bbc75ba,30c969fa,371fc1d7,76c32a5c,7e632201,264deb36,b296ad2a,c173fe4b,14ead07c,2c6574c,8887500b,53f6c02e,dbd4048b,e69aab41,9267ef9f),
+S(f51a5ca6,fd6dde25,447fa46f,c0984d26,66004c02,8d402624,8886d0d4,604f6ad8,fd4290e1,7b2928aa,f2e03b98,97252b82,d481c4c5,ad4edda6,16dc1cd8,e7ee83b2),
+S(20ef1ab3,491b8d0d,a1565e2,8dd92dff,efcb88f,e88c6c2f,6b100b30,b58249b6,6814d32,7b5b94c4,12fb770e,2fc4077f,fa9a336c,9e7db2a4,bc7dffa4,286eee0),
+S(d98785a,82dfe5de,343bea0,d91cd8c4,93344b86,7fffe1e6,efd7758a,90cdd899,37ad7f7c,5783d262,5204bac3,4405c207,972b7fb4,cccc3585,ee152f0a,48ee16c4),
+S(3885e910,18a66e64,2d3f0c76,bca6dc82,a6916cb,1e46a858,7aff5ea2,d9390689,20765590,83ba89c2,14be9178,46e40553,ea195c49,de203c9,d175296e,a4430819),
+S(c88cf650,3b50f5eb,7bac15fe,2097ff76,9c57b983,1b5d05c9,fbd8dc58,d4a9a746,b6443b76,64984192,e7056478,e9f372cb,21a0c7c0,cfcb0e84,850443a0,25ff42b6),
+S(2831fddb,2ba2d301,2dedd58,a3f47434,3450985e,80e4e4c1,646745cb,1abc69d4,1b04e1b7,db84b6c4,882f264c,7bba91d5,2256dc97,fdd22e58,483dec32,5020a257),
+S(5e492bf,c9d19dcb,c3bcb9a8,b7bec84c,23c359de,a78aa0a1,e0522232,df037abc,614fe5b7,cffedd76,35d371b5,2d89baf0,55af687d,e6c12d80,b221d0b3,9d03d0ac),
+S(bbc64d06,681957e9,685c9864,c5f9bfda,34b4dd02,6b749399,a12bd8de,87f311e7,3c525096,dd6b7d11,26c6ca50,5064da63,f7f6a203,87594f4f,e4ae0403,fb4d66b6)},
+{S(2b00c7db,16887372,753ab219,17092563,8c603992,f501b07c,9d8442b3,721addf9,8e7c5f66,4c2493ec,77cc74ef,d9221235,f26bd3bd,6f505347,39f0fe19,c41b9fad),
+S(56b9a3eb,d9360224,56267f52,21ade9f9,674863ee,4bacb7c9,ef0155ca,b36b336e,2e2b1a4d,f6c150c8,6dcfe9d2,e2836579,f82ac4d4,2f8fa4d5,d814b952,e92da69e),
+S(ff52bbc2,83bd15ad,523e6d08,873a8896,9449a1c1,c5ec8570,ed532000,5a92aa3f,dd9c534b,e59d3845,a1943435,1a20513d,1a829424,e65ed8ad,60342b38,6578b21),
+S(84f79356,86b0d45a,13a1ce22,7e7c925e,d80be5d9,9fd7e671,270c4c35,7254e9ce,3dfe2058,1e91dc25,12c16951,c667fbe6,83192bf3,3fc0bdec,c760dff6,730f82be),
+S(db14da0a,86bcd275,71cb9348,36268bb,85c306c8,9ee1b78b,83c247a1,71c7355d,66ba535e,81e877b4,71b0b75a,6545970d,6e33cbe0,ff011e3f,d653d026,f4fff395),
+S(28bfbd9e,44554371,74a4c24a,cc65ef45,5fd4d39e,b466e94,358cef4b,b0eeaa5,5f5ce6de,2925acc9,e503d731,d46601aa,7e668001,669819cf,fa54b3e3,dbb98f32),
+S(a7b21a3f,a07b4049,7f9f5087,c763b431,d5f04cd0,e7b7e0dc,f9c6c664,df7c6ac7,daf23f35,b903ecc,af4f50cf,459deac9,85d0d008,3b5afa73,7131a61d,8591bf9c),
+S(12fac42a,40935aa,e881894d,245b9691,cd1f6ad0,e0481e1f,444e0ccb,6ee88781,c519e0b9,e3c19fc8,f67c07e4,f357f43d,589ec23c,7714f7a0,4347be96,4ca572fb),
+S(5c2e28bc,94f8639e,50133dba,9b6c8a35,348eefdd,2fdbc18f,2abb792,eb8807dd,c546b3c2,5f2809e2,7977a8e2,3a1c3ddf,36229f31,434c90e9,1386ee84,b64e8fdb),
+S(e8e73382,fbe8b94e,58bef90b,aeb28305,d27ea48d,9c5f6e08,ef47e4dd,5fad6b78,d3529a2e,86240f06,a63ba03b,ce419c05,24d22622,fab9107d,aaf3016c,6ff7fe3e),
+S(26b93629,ebe68d1e,878e94b7,5babd663,6fe1f6f8,659b155a,e10801eb,c2cc51d9,f4630056,b3e532f7,32238911,555c0ffd,f4951c9a,b2f45119,cb12e774,aaa2666),
+S(57b3b642,431f793f,24862328,dbd271ae,19d343eb,c3b0ca7c,affe4fcb,319d8d94,1d7ed35a,5abc7e39,1858a9fd,b90f907e,6a065648,c00f94a7,75f06d2b,1cacef1a),
+S(c2123794,d98f0311,c1327522,1767236a,6f45cb14,8fcd65d7,e0be8d13,2a650953,d5a382f,fcc2ffba,3917763d,ebe0549d,66f358b,d727c281,288551f8,4ecd193b),
+S(16789662,9208b510,7528efd1,36036980,994d6c3e,5b34c69f,ef3b86a4,3db9e8f2,217105f8,39b0ae0e,932b5207,e8e7c190,3ea463c5,40c043aa,e4f8b106,97ccc84b),
+S(3a0b8ffc,83a1702e,214adfc3,79bec5a9,753274ef,9e3271ca,8ec5b067,a5f3b6cf,2c3de01b,f27dd574,4496c2a4,75a07e60,71ee60ef,7eaf1c94,c257418b,744d1338),
+S(482e5ac2,6477feb7,6c848d58,40173d87,1687c5b7,3b2970ec,b8dd69e9,3393f923,dfb3995a,ca5b54a3,b48e1dc,107023d4,dbd7a918,6adf2af0,61f92160,76e7f78c),
+S(3869373d,638a30cb,63177204,bfb194f0,2c6ff503,3cb4ef1f,b146741a,f3b495ed,f2ac9f3a,ca159c7,c2ce9f48,e895c543,d3f19066,74f335b9,efdc4b47,4ccc23c3),
+S(98c16ec8,54b34ea2,f08aa4fd,3ce1877d,4a36f2a6,4e673191,17f74e5d,86e57f4e,3448646f,c9aaab0f,4d9ec298,8f7c07ef,448888e7,6318e0ac,552d7cc,b59820a3),
+S(1b3a4ebc,8ad1c200,2847e182,de7c9eba,f0f7a408,e2aa172d,484bb9d3,ab897b73,b93decef,69cf2da4,5c3a2373,ac2abd77,311fc1f9,21e7df8,5f5b3504,a5ecbdb4),
+S(57b5b2d2,87bec103,e4aa7b96,16129718,64780441,fb5ef847,19f16d,a1c909fe,2c2d983c,d8c37a7d,653716e6,15756121,9e5ad5ab,25664967,67a0fbd8,e8180c71),
+S(cd7e277b,ae1498a1,8e7bc00c,2c299a49,69f6862b,bf96e6d9,f5143db8,7b582115,f9548ddf,c27108bb,38f80025,6ffdc25e,28621c17,c370a40e,5009b968,d40660bc),
+S(80615f12,82ed7a8f,bdd70890,77c24f18,c03fa395,3cbea7bd,32a26c7c,260102e7,8d54a3a2,83383d6c,a633d17d,e2f4f756,3bcc3826,10cc1012,3f2f192b,e654c2cb),
+S(9b16f5dd,c8c8c8d,53786b49,e2d025a6,838f6322,700fe105,7de6d78e,92281a9e,a36aa3c2,f2034285,76f5c570,63bb1bd7,e6e0410,2e1cd2dd,f100a54e,431ca08f),
+S(f1d04075,35ffd40f,2a0b59f9,14ecf368,67700c5,b33e15c5,153fa9b1,c724d36c,22a8b48e,4db1d3d1,28cc735f,99db74d9,ba7457cc,67b8fb39,7b38fcbb,153f7c0a),
+S(c252ae6b,cb711704,659c37a6,f425b215,1ac8a4c6,63420eba,899127e8,1d8df3b7,8e9a75ab,c5a2cd8c,d44331ea,b07e5d97,a30c6619,8e382261,642c0e10,8f6d46b3),
+S(59f6fadb,4a8a3389,999b93d4,cdf1f8f0,4735b397,9fa5397e,64df420b,85876ed5,c6e8baae,fdeb7019,23a68b71,9c88596f,60742a38,db04d7e5,76bd1b8d,1ae25a6b),
+S(3c2e03c9,3f610ffd,db519c7,80c201ce,b58ffed8,ee10e21f,d1610e99,33fd08c7,d339d979,38e1c5de,7492e7d2,d64fe34d,ed889d48,54670345,1c51432f,ec6c829),
+S(59d16070,f9147ce5,5bac599e,aaace0ef,24c02ea6,85249cc6,ccfbeecb,a4bba83f,8105bf41,47f22f7b,18c73941,3a85ef06,40bf6805,51c68a10,e16be920,193977f),
+S(3aca1182,3f31b2b,a12e628b,604b1010,62c45fce,22e15dd0,8b9b5ef9,a53dc02,bdca8ab2,d2dcab6e,3a98e7f8,7e192c19,cae60952,fc6f54bb,d46acb49,60d51c0a),
+S(261e9b93,3648c7d8,d5255219,fd0634eb,112e1dd3,fcce0a04,135b2784,e67b5e32,e0eb5ec4,30b1f9ef,2bd10916,b21f4fe1,4cfc80c,2bc179e0,fceb8678,ff933068),
+S(75918e0c,a0f03b34,40cd6239,c108bb72,f293a881,a1f2e9a,73c604b8,8c451c39,7f02a925,80e50aa2,5b786d10,422f1d80,2c42cb37,27f09ff1,1f5e0dd9,bf6a6c1c),
+S(42025e76,3c05c64c,311a275d,d6f1fb3f,2da2108a,39ed24be,3de83123,b1c1d1e9,dba2eec,7405b67c,a1915b13,45702062,7bfeebb8,6b90dbd4,87849e5a,756921c6)},
+{S(ef2c5fa8,b23285e3,50d7f05d,bd8c96bc,6e662824,5b10e1cb,4b659bc5,ded5836f,1b37679e,1177b653,8975790a,4d5d2abe,3626d636,1d863e0e,1db5881e,8e0c54a8),
+S(a1d5a92c,93df3c75,a06f9c2b,a604789d,fd487513,62d957be,68c033e8,3e202fe7,64c1c00a,3964fd5,b35fb52,b423b285,77c8d269,bb1ffd16,325c5e0f,7be08bdb),
+S(ef13ec66,d46813ce,68038fcd,541e5e8,bdbc970d,337d7b5b,9099d0e4,3fa4288,7ad7f4f0,c8345229,96341248,b1455ebb,89aaeb6e,1ae9db25,1b86930c,9f779fd9),
+S(aea7cf4c,afc1079e,e61396b6,2df9bac3,bf334745,54af4678,8621e337,4c7486c7,c0538605,5911c893,459b98b0,4be449f1,2e9f98cf,ef4cc292,9975d42a,f460d65),
+S(8f082b3b,6476b4e9,ffb317e6,1fec0cbe,8e389041,1fdc87d6,8d4d26f5,44c2e6e3,eafc2bd0,d6570a7a,cf8bb5d1,6cdc1020,456473c9,e7fec1b7,fc6217cd,89d0a2a1),
+S(e0d6310d,e5e664b3,164faddf,39c93676,4ddd3f0d,f5e007ef,5293ee35,980ae0cc,de093cfa,ca1033bf,47e88723,4978758a,74b93cc5,2cef48a3,daf4dda9,adc79ccb),
+S(2518110d,5d064422,5ead0e2a,5ac8b8b6,b1fb7fe1,55e351c5,1d39673d,dab0f6a7,84f0d6e4,b497043a,95b6af9d,e72cd502,a7b6a68d,ecaa01b0,9e0d8ff9,9d8a16c9),
+S(6dc820b8,5db42353,c97453eb,d7d768cc,af9732d7,c261bc6f,8399caab,34cf5b93,30b168c0,2509e2f7,2035f60,8be8b89d,577b6e72,540f521,934fe980,7412459c),
+S(bddc1c75,5bca9911,3c9ae05d,c14441e,2c707fe5,8a329f8d,feaa36ff,12771376,8c0087ca,b7688dcf,5a3cf1a3,3c27c7b9,cee36007,3aeb9b9f,d7088623,af20f62a),
+S(b6e5ef5a,a84c6d2c,a209d50e,8fa8e1d7,93c61ed9,bfbc22d5,2ecf293c,9489ac13,f76e3adc,a89cb983,b6b670f9,5a7e774a,c015de5,1ba56417,40ac1f68,e3df377a),
+S(26699dfe,93788eb8,d91cb601,cae628e5,75e8468e,73f6cefe,588755b8,c396071c,e5f9e00f,bcf6f1cc,cd39ab13,41cd06b0,ef2e789a,17d761f6,6a7a83b1,c036791f),
+S(72f7e16f,77f0a4f7,92db2cd0,354382af,34282dc0,7b8cb290,a89a5d60,894e8090,54d32ecc,2cd022c6,c03f1379,657450b0,db9f08e9,6e2be5ab,5233dd84,62733cf),
+S(f84ae7f8,a03b60,af9cc359,36f0ae78,96935b2c,534f852,8ad159bb,6c0b44e7,68f4dfc6,20a354d9,d6904bae,67792622,337e3180,ab340828,80bf04fd,f47cc23b),
+S(5dea33b1,b5207880,6debbcbf,83ca17db,4617488c,ac5c6997,ad4092a9,8a7bff7b,99976fe5,ae88d36f,597e16bc,6dbbd4b4,547f4dcd,7e85786c,d10af30e,1d81bbaa),
+S(31be76bd,4f946e41,7de73037,ceaa0dd7,c6eccedd,74399e14,2ae6fb2f,d2b59def,54ad8748,ef129085,dc3172aa,904cc376,e203fa69,38783007,2af33889,52cc6549),
+S(b6124d0b,f603a00a,22662897,8dd0da87,fcaca5c4,fb04ebaa,81a7d13b,39f2e307,34ce08c7,4463b06c,afb03c02,583288eb,7bfa6f2d,3eedfed4,91e31781,dcff10da),
+S(6aa4bd60,90bee70a,295c451c,c8af72bd,3665680f,545f46c0,bf5af990,aab5f43d,9c2364d8,25406b76,94ec9db,a0ea2f9d,bb36fb2c,5bda62a2,bec941c6,874e68f7),
+S(f72faef0,e268a7b0,a9b00a57,3674d846,c1f0dcab,c9a586da,be318b1c,d2874d8b,16b3cfda,65db0f3d,1b5274cd,20b1329e,61ea0404,1f702e71,cd98708e,28c9307),
+S(1d26df15,98a6b9a8,7c0a6171,767539e1,86d51d1d,cef130da,1001226f,87872c5c,f227cd82,becf5493,e2fc7635,6a37bb48,3e681a19,ab4d9dc7,92edb114,3a7b072e),
+S(28690cb1,db697840,13e9eec4,d9388723,4c28451c,cf9dd51a,746d1274,b13b4610,d9bc39ef,19228981,a1ead1f8,94deb254,162fed5d,cbb58a76,6d361e04,3d8f62ea),
+S(4b0b5258,22dbc31b,1966b004,4d39c5de,f2e16d5,1e032045,f9973b1e,fe83ca12,2db33ff4,3631fdc3,b3608b40,7dd494f6,ae730212,9619ae35,f6ea08eb,51aded12),
+S(a5b4e205,462ae419,8fffc1e7,393d366f,c5a9eea4,e98c67ee,1684d63f,cc09aa64,d3c11017,de4ad175,17cd076f,cf6c0ce0,4d3108ed,60eabdf0,935499f9,4226078b),
+S(d4f1af69,2a3e9fee,1f92d892,b14eef6a,a0ec1f4e,d4d455f3,c70bcb19,52fa9837,115c7ee,73b90adf,f142191b,eca0be01,7d5a651f,93e2e90,5a36646e,21790294),
+S(c275c715,9d6e9757,d2adef47,2ee53856,dcf067db,bd4f380e,892c9832,708d46b6,70da1cdd,853a0dc8,a6a9043,3c319371,25590c9,5807284c,ae168f65,62e4465e),
+S(d2e38b27,83156e2a,a8e4eac0,149bf2bd,bc2918af,1cfa2a23,d1c7136e,15dca7b,738a0fe,751ecfa3,459e005f,72b7461f,a4b5e1ed,736420d2,22c5428e,2ec1348c),
+S(f8f5b3d,b3659174,e0149fc6,fa747c22,9607c434,8f9eab60,900bfe92,b23f9a4d,d89eff33,94a093fb,549fece1,4e11028a,614cdce2,21d5ac26,1bc25f32,dca3919c),
+S(5e266403,e49fb860,e6ed0928,45bc0811,a214a0e,dcd6174b,290ecca9,3539d862,ab300acf,5d8b8a14,2fc9e93f,ea995d2c,d7a2bdb8,6a146f65,2b8bd49c,4e8dac1e),
+S(8ff869a7,60230ba6,aa5adf91,1ba61702,17cbfdc,5ffa4018,b8a09b9e,4088d634,db5a5aae,bdb946db,80e4c207,22ce38c9,4921bf41,47eea510,70e5aac5,c592f32a),
+S(f3d39b65,95bd5ab9,aeedc43f,f49bdb20,73a211f4,5ec2c1b7,72226a97,a31c059b,ea41abf,9322d733,bb5971ac,194da6a0,a6d41c6c,a0d0acaf,a53e17bd,dabcdc68),
+S(18ba0c34,10169914,7f7589f9,179b94f9,daed92c9,287f3468,d283bdcc,d71cc637,b3512d25,c199d2a4,c115bd11,eb53d6a1,6ef16c3d,97be6291,5ff76b76,890ba675),
+S(2cf3354d,7f96c58f,3c6336a0,6fa30c83,8da767af,48f89fc5,5ced5b40,e0b86cee,403ac306,f6c3ad55,be1ee5bc,29cdd46e,2e3d83ac,71050909,5f117d21,7ef015cf),
+S(5d31d140,f754d6c,5943deb7,6aa4d867,cac81abd,9911618b,82327795,da8d085f,c25f99d0,5bc5d583,a3a72b41,4e5eac5f,c14ced01,98247ded,79ba482c,882bec49)},
+{S(e0ad91c6,6ca95326,d440f44,df91c1cd,cd3ec344,e906d0ef,51fd4a48,31ce293d,3559f3c,e349f7b3,cf66c17b,2c3fe7e6,8ba3804e,438c0816,b68ecfe2,30da18d),
+S(d8b8c50c,ae9f285f,d6d9282c,373607d8,5fda59dc,71ba0066,148b378b,37440076,ef83dd08,ddc115cc,24948009,f9eb4afe,dcd65c64,b6ef2194,bb4ddd0f,ece180e6),
+S(881fbbf1,a9627bd,369abbc2,edda8026,a61b10f,4161e442,530a5e36,447a0290,6a63cb8f,7e5094d3,c8beba5a,2a1d7b54,bc33005c,efdd5a1b,20d51f74,d00c2fcc),
+S(36bc0df,fd1441be,1a4efd6a,43ab9d83,243d44bc,a6e108dc,fa9a79fe,23106f0e,eeec58b7,dc37eedb,4432dcff,4de7f88b,2a0e0721,da2c0a72,eadac4dd,71037ed9),
+S(7652c155,c2ca8a23,7680f015,a62c7c31,31682752,a99c4329,77ccfb9d,cb58b03e,5339a51b,36ad4548,197d3018,4bde4428,b38ed983,d624bd18,a5f8c4e7,21871c5),
+S(904774bb,fb8b0c12,e2b3f91a,e5a2a0c1,a92971f9,86e29fda,9edc609e,e85b222d,ee843f1,8039e251,9c7b23b3,725ca099,114b4f0,26970111,35ded92b,94445e2d),
+S(1c7c82cb,fc14b9b2,cdb3c12c,32df33b6,a08e7af9,df62f310,79fa0710,f28f5f95,93471b5a,17c84eea,a45948df,80c0f56,d8684f35,1aa2ce73,ab84b3c,1b8250a4),
+S(bb060f5d,971ce062,427a5630,8f114532,40ec54fe,6479d5e7,9ce81444,27f07927,fcbeaa69,8278eff3,d4dad904,836c0233,40a866b2,d8f66774,70d1159e,201501dd),
+S(287c5b8b,8dc168ea,197200ea,97c4f63d,db0b620c,7f30d623,7934f856,a558438a,260630e6,ce310eb0,366acd78,bb58f4ef,27fe4836,edc8ff0f,5d5ff987,b659bd20),
+S(7d4c5c6a,d6bb0f0a,47b45a35,1264f4e6,a81ee0b1,65a7e665,4b226c95,feb59dbb,e89691f3,ceb4c57f,5aabc1b7,4acd9aef,41531851,b41ec1c6,608f16a2,2243ab5e),
+S(ff806f2b,9eaea4f6,47d85077,d8aa5052,9d4b96d2,1e0b31e0,7c86b14b,73b7ab4f,9acc2f77,a994997c,7a2b1aa0,79c0b5d4,c84f6715,e4a50e33,628b871f,8885ef9),
+S(3ce795ba,1d91a9bc,b0260654,3450ced8,c94184dc,8a41ac5,e1b84856,e88927de,3492e696,cd1ab2dd,587d4707,ae34fd67,3ab7902c,d0c0972f,ef419795,1ad88a1),
+S(299ad528,afa3f36b,c80a757f,f081a8d,c4a6ddc2,d2b57fbe,1e3d361b,ee5a5d8c,9fe823da,74eda2f,266a8e9b,331d511b,623dcd32,ef9ab7a7,f1d1cb4a,7e6fa65c),
+S(bc4b0549,16177aa9,b52b29b7,cb91673c,9ffce4c,7d0066b,e4249383,4467e3b9,55bc6436,7db68687,e699cf6c,f2db9dd8,c2b9a438,8202fef5,11acdce0,ab06f969),
+S(a8e8b02c,ff5de02a,9e6652cc,6fbe41cf,6e87ae0a,abb14ac5,a178b3d9,e697d0a1,285d4af9,405b03da,c57c993e,4b40df8e,82c6979,f8de57ce,4543b7ef,3381e0a8),
+S(e50aa8b6,d7dcc055,4f406959,b056dac5,21a7842c,ffaf09a1,ac24a3d9,8aef5228,46656395,ee84d061,a9f5788a,cb05975d,5ffa5fae,edced564,1f81b5cd,2491c23f),
+S(cb516899,98a214c3,c31e4f2,692cd7d,fad6f1aa,eb8afd1f,b29c23ce,429c224b,2292b8a4,5a89eb80,167238ef,2027f975,98a2aea9,a4460c5,3646d088,82403c63),
+S(ded04c06,74c6eb16,557b5bed,4b6703d2,cc37c6aa,bae466e,ee7b5665,6693c3c9,4f3ea70f,8e75b02b,76934cc3,645d2af,eee8e9d0,8d100117,40e8a16c,dbf01113),
+S(f3d0a253,edb74436,897e6cc6,621c74e1,30457b41,e0690b6f,7b2a203e,8ccf8ac8,89cb07e0,97495bdf,403490fa,d58eefe3,e79ffa33,1deb5cfd,2c548ec0,8771be67),
+S(d4c66267,aa73ed55,bd68fee3,2a166a4a,4ec660fc,4cb13e18,fb6ab0fb,19a5f330,7c2efa2e,4509b221,97589483,40b6c74a,8ee2b5b6,5fbb794,7f838c47,ee03e2f0),
+S(dbe9a638,f262f9a4,b3a8955f,22293feb,50ef4b32,20df0184,f363a373,d7110981,4c563e83,5e957756,5e6a8996,97510c67,9561972e,5601c1cb,2f2f789a,c1e0b5dc),
+S(70c7c07,1b1e6fd0,a97b55cc,5ee34297,166f4d02,417a796b,eadcfd43,96e1b338,b5c49a6e,2ab03e55,f4755f37,e5211d4b,e23339d9,d464fd28,6781bb29,56db23bb),
+S(aabc501c,6d52961a,a613fe66,96f0bacf,fad74fcf,8386cbf8,b18704bc,a1392ffc,cb72ba86,70bc3f7c,85a00d3d,76b11596,6cfa0fc7,44b31e01,9129da9,a5b04b77),
+S(47f72ec6,e7820788,f0f7814f,aefd6e2e,af5d90f3,f877677d,ae72569f,c6a2e8f5,6709731b,ef2dd880,4696a6,a0661d13,fe579704,5e0a9bc0,e5fdc0af,789c5830),
+S(20026251,d9413e42,47a5884c,209b144c,98e36f7d,8ef3f56a,68efd475,8a2ba8c6,9c5531b6,94ba0d24,a943d0c0,94bb623,75c798ca,c9716181,a9d659af,2acb978c),
+S(8dfc6293,9b300c9b,fb617d23,6885f652,424b4f12,d04f8bf1,151d1ccf,935e445d,9a519433,18e94107,5472aa9d,6ec3390,59bd3bcb,bbbf6937,c9290e48,9da25f8f),
+S(afef3520,3b558495,6fde0eff,5cfab48d,8fb08806,3c1d7cbe,d7e352c2,9d49176f,a764e6e7,bd0c8fa0,8a6f7f30,aa38d7de,fe71773,fb7ea484,68b3fd9a,8adfd650),
+S(354c0a98,1628dfff,8be8ede,ed809db4,bc39c686,39a26828,ff28dd47,90801c46,8ff40299,d607036b,acd7c0ab,66a102ab,38f8d3a8,a271e2a5,20b43cbb,687cce6e),
+S(da2e7eb1,1a1e66d9,5001ec4,f7b66c1e,d9f7d0ba,ea3bb326,672b9069,5cf4bebb,cbc1c7da,b9bf7e0c,dea9297c,5f45ad0b,9c4fb093,318b55f6,1e4a8951,726c4021),
+S(6f780994,d0662667,8fa74156,4232bafb,b3a7f54b,a5b66507,9df32545,c192c3fb,5f11f0f3,af1a763e,4c9fdcb1,1e5e57a5,6dfe0d0f,f27535b4,4343a312,90e375e3),
+S(8e28948c,729c1438,5bd09316,31ed3eb8,7acfc5f4,2a9eb4f8,afa50362,33591cec,2c09fa1c,bf0044eb,a78ae81f,bdbd4271,2a89ffdc,f7d476af,881d29fa,2627f250),
+S(4011cf05,a85ef14f,1875cf3f,4f78a51,a52a89bd,a8930a4b,8e13802d,b85f319f,35045b10,45c4f71c,c762fa78,5b8d4daf,aa2a1c07,ba37d82d,ee0592ae,ad807810)},
+{S(9089bcb7,1c1559bf,e17f6c0b,91fc098,c63785fa,18a42d69,798b063f,a0930175,de229175,5e4ebf17,1047f79a,37d81b9f,9004a7cf,df747589,7365e174,ae367969),
+S(4d1caeb3,41f25459,3b06f715,9e9418df,e29ee076,76c26e6a,51d8add2,5c70a5d1,bf773e4e,4151d17,650aa7ed,1d6a5505,2d622264,75c50f31,3261aea2,cf68dc37),
+S(b0760330,517c0d66,2571cfae,830da7fc,a7e0d86c,1ca7f75f,5150f625,db50ad2,d8d10ef3,9c84bc13,32c2cc01,4d4df0fb,45e5c546,1849fb1b,81b7fdd0,7484d35b),
+S(3db731e4,273e5b20,2de984c9,74b4112a,d0feebe3,7bb0d2c7,db38c7a,21bd8c67,b425c1d3,46b6a61f,2893a3aa,a243d60f,5563cba2,40018cca,3f80925f,71f4f1b1),
+S(3a74a50d,cfbf2ff2,5c99c4d0,1a13a917,9f510c2d,eca1d5a,7ac8fb69,7eb9795,d2b468b6,714681f4,57bc586f,40585c01,e1dc14a1,a42ce887,9ce044d9,ddb92d82),
+S(b9139ad5,4f44fed8,4917ad55,c49c23c7,8d62aadc,e83c9ebd,9efde865,cb1eb298,18068856,c80abc3e,2a02a441,bb7a7609,aae8d2d7,8abf4e2e,378fa3d0,a27aa900),
+S(bcf5cf94,5887f183,e58a0128,4ed9a4f9,fcf918dd,4e68d70c,5a54eeff,166cb44c,8235f63b,bb06a1a6,d9ad2ae8,47aeb2b3,4838c962,9608943a,93294c6d,e21a3ab9),
+S(4b598ce3,a77680c4,c5f66e90,1b76627a,27f35301,9641520f,53ea3894,dcbbd187,357af043,f77cb9fe,c04ce1f4,dd9b610f,9151d15b,3b7383e4,ecc5384a,8ff7c5cd),
+S(b588aec9,2dc045e9,a95abd7e,da929837,28b5a7dc,d637001,ce7f0917,1283b16e,e682f53b,5e94fd84,914b7bed,5afc28a,30ae6f53,e12d948b,3c0d88fd,adc5d0e6),
+S(eb8f5080,218ac5c3,cd792042,b59e80ed,e3857a75,a81d67e0,7c2221de,d3b7a677,c5f272cc,3734e0f4,6a5cf40,626973ae,1aa76839,1953f211,eb52693d,254a7fc3),
+S(87d119ee,65a60dd9,aac3e784,22049cfb,4123d262,ac9e7473,4c9cc418,fb7ce4f0,5185ac,7bcaee8f,f1334eeb,cdf2c39e,83b8b665,1ef9d8f5,48a029c6,464242da),
+S(cfd0438b,186d0f5,c64b5f38,a190baf7,35b67512,a439f486,fb79d501,90294683,985edeea,243e9c6b,d9c57cb5,c7372202,7492156f,e10bd2e5,67edd14,8603daf6),
+S(52abfb67,5fa8b12f,1b0cf0d,8e85f402,47696662,64c7252f,69562590,839ce4f8,8483ab43,2d4851d7,4f432c0a,8e3863b9,783cff58,3d4c390a,9865d7f7,d1aed67f),
+S(52926df,cf12eebd,3008459d,3c91dc1,73532f1d,ce3c5d0a,874ea4c,67331787,18b48fe6,1bd74ac6,4b34f2d0,e7de8920,2c875625,bcad84bd,cb3c81dc,cc86dd87),
+S(695e09db,8c4479cf,4c305005,b5737ca0,63f89d02,aced2010,5600d65f,58e26401,32123a91,8bb23fd8,79715cc7,488184b7,53e0eb00,6dbbc95a,ef9d815f,3833c08d),
+S(97c35716,e5aac70c,45dcdd45,a5ca0155,5962f09a,cc22c16b,c79ec272,ce1c12d3,93869464,6470f8e3,c0db18b6,2e4378e6,5caa7203,c4d6a079,a10c8182,b8eaec3a),
+S(35197cbb,8da9188a,fc60faf9,71cf08fe,73372e15,f857b93b,6afd77e6,bf4db7ed,4e0efeb5,2db601dc,a539c777,14f4aede,c5ff121d,77dbdeee,7f16fb0c,4cfc19af),
+S(afb2f842,e0818237,46c294b5,9ae8afd2,279e834f,100f7d1a,58a9551a,98408d49,5bf5ac43,a3609b4f,f058d6dc,6ae09fec,19a19864,6d12096b,6bd3e06d,95d15ae8),
+S(a37f6113,882459,b1dc6335,26253a8d,287c9285,b7862721,f9bee74a,d2c4c09b,9ed3252a,303c6d,e01c9985,c5b3edce,1074d478,db56b961,d91fdaf5,1b1d07cd),
+S(4579a503,cb12a345,182b28f6,9a3fb98c,4a80579b,2ff592d1,ab18b32d,212098d8,8c61c503,df79dcf2,6083f15b,c3ee1f99,9e1e0960,8bf6af9f,b3175699,cb0e32d5),
+S(545031f7,883a2c8e,bd56a405,52719096,4aa1d40d,b22a1730,242f3064,530ce326,ecb024e8,e762b456,f62072e,5f471180,bbc817e7,54e830ee,7757ed7b,df5c9300),
+S(b127fb32,bb3e193c,99d232e,d50dcad0,3b45c072,e0d521dd,de72daa9,e20e97b4,b198428,12a344b9,2e8a8d26,f7964c66,82cb3652,66ab3e28,2ba56197,a159f1a),
+S(28cb3582,d312cfcc,75ab637d,66c646f7,5157dc74,7a464e9b,933c0820,2326b6cd,a87042b8,510ef9b3,ecf918d,916128e5,f946f43,6f18fd5f,ad62c46c,5882a23c),
+S(8a46cb3,27efbeb6,850e3861,c4845ab1,21414f12,9fb27387,4560826d,c9116886,ab09eda1,9156f1f7,194b7b17,fce15268,ba041c96,24765ce,fd964ede,d1f05b3e),
+S(b73af914,10ad56f7,d490dc37,1a2584bb,633de0f5,3f00cd0f,6b8a6019,53c7ef16,3dbf4e52,753e5d33,3fd23cc1,c839f278,38eacb3d,5980cba5,bf1be426,b27641a4),
+S(b38c1896,427a0108,3f24a917,2a64314c,d9dc1759,60971135,1b2db6f7,d66ab745,d3a71a74,f80d6919,b65629f9,80c7757a,cc49c2aa,78dc67d3,d6f76d06,91a90d85),
+S(6f6ac108,aa819a27,6dae862e,276b3ebd,8ed5a3ad,9b0296e0,4f8b65a7,f6a5ac1a,e3048583,7aa2140e,de381363,788d6d95,25a7ee33,9e3a3ed1,2518619b,30d9f71),
+S(72f5809c,7c282ab3,4dd81851,33070d85,53999a6f,14fd753f,2ed8deec,ed7adc5b,112bf5fc,8cfd71e1,84ca1967,d05da765,801f12b4,c852768f,60afa7f1,e9576534),
+S(4c348833,10f7dd6f,b385ce25,e2d6eef9,8556a59b,5e79a084,ec83425b,37150085,9c4c97e1,be47b073,5209ecf1,5f05cd8a,58ece74c,1b35a92d,96a70287,11d95add),
+S(f16e4513,2291b577,ab360b42,c1babcdd,ac61e623,da85819,e9c4c73d,463204b2,5556d7d3,a2d45955,28781d15,16b59aad,941ea356,1b5c88ec,94d09314,555ea64b),
+S(3580d3f7,896fb70e,d48d40f8,1b31a72b,51405574,2c2b4369,e3e7dcb,aca4ca22,e38da3af,f409e459,82098305,87aa0eb3,b2339959,75af2e33,501115ce,648360ee),
+S(407e63d2,c0cd6d37,84c27734,f7e517fb,4bdf7847,296dc7c,a8714fab,16199828,2dbe5da7,4b29bcc,fe9adabb,69157830,987ac51f,389c6001,2577f298,710025f1)},
+{S(f61f644b,e2414c07,66c6caf7,5d32683d,efafb133,cb4d341d,7eb565e8,9f6e4158,2848548f,15a6e7d7,2b2eefc1,1b76e318,15ebb4b2,1e3bb938,e0c2e9d4,5ad4f7d1),
+S(5b891f8,ec902550,429a5ea8,33fc29c0,bfdddf6b,a6f62c19,87a14050,a9689a9e,77901539,1ef92985,6d3e3b35,4e4ba2db,3bad967c,dedf331a,c0bff08e,f25f2e99),
+S(d8c5a617,62655ffa,c943ba35,3b595b46,88012282,af068e52,d918bbec,46bec87b,9263db7f,6f74aa,df0dbdaa,7e7ccd76,cb3a498b,44de2bd5,f9b23029,2ebc6009),
+S(2e940645,cd189edd,2d6cc2f4,f9b49e4d,305cfe8a,46f2a596,fbb55200,89fa5b21,4c197028,e89ef8a5,b5b6cbb1,3733e90,408877fe,7425d58,1f4bd063,ce286fb2),
+S(396c3bd0,9c6af07d,123a8441,c9f79ab3,a783b8f3,fdd69dba,ba61c7ec,f65e3098,534c8657,aeb8cdc6,ea34b372,68f1c70,70881797,46b8e335,477c8525,cd17aa8b),
+S(c34e6be,b079f3e8,d1355754,4246d2b7,a82d551b,740b4b59,b9220bbb,768796fe,57806a7,653ff7f9,3d7cb6,b3acf68e,aed049c5,75988fa5,f03b1ab5,1103aee8),
+S(5d2d6aa5,252fc9b2,55d89773,e920891e,7021f233,5f7d0ff8,c6bde5eb,b65c5149,1fdbd2c5,6b8bd095,2d16c304,8d9c588b,2a26379a,17f748d,f1345695,1c5959c4),
+S(dec812f5,745fcbed,fc36c635,76874bc5,96dde8ef,68a8724c,201b6af3,be7c6e2c,1715328a,f75f9661,d58c667e,5c5514d4,c99dc881,8cfbe702,e0c3c8cf,662e6906),
+S(32499061,83487250,f65684b9,9434489d,3a83ec93,61531dfe,48086b2e,b2bd18fa,53217af1,2a25fc6f,45555d93,98fe46df,4247d38d,7b162e34,945f8928,bfe148ba),
+S(d3e9381d,83f31116,ee161490,c9b5d1e5,7e086c6c,1552160,2c913315,af033ddb,97ae863d,34271b26,a4d6577a,32028c12,f092a54,8a18ae1b,a83de384,3b8fb84),
+S(1347dca6,d097faa5,7c6583c1,c292c6b3,ed87b31e,9f7afe8f,d0d151ee,50ebdeb0,570a9be,e4806ee3,e30696c9,71b5d905,65d09ee6,8b4fa8e2,8acc54c0,7fabb492),
+S(691f9995,af2bccbb,f556f624,b28a1da0,67854c15,4f014e92,a56a8cdd,9a43c25c,81babe0,ae44984c,bfdfa958,4dc5c677,881d1b0f,63993075,a3fc462d,e986866a),
+S(cbfb62c0,b91cedb2,5a9d4b3,ada43cac,7839dd18,33174711,24688ca5,5f162cb,77c12161,e8199410,b040dd57,4d90c39c,2f1b499e,6b7c17c7,fb21438d,aff4e674),
+S(53627516,8de62d6,2c792f64,f87996af,3ed8ec88,653532a8,ad60942e,cae4a339,d8449a0c,c6ae32ff,45a11652,97b3d3a0,57e67c64,42d3bdb1,ea2cbcbc,cf0655cc),
+S(2a81679,7505601c,763e6f6d,f7ed5c0c,14ee7fbf,d75b8755,7bd57f3b,e2d3c7c,99f26af2,10540397,b8423da2,c4809942,63734d99,f0d642d8,96b5f216,767b759e),
+S(54b2c03b,7a7ea964,220a255b,bb688767,99ff1b83,f0934e4f,fd03c2bb,51490e22,b3cc56a9,ada9240a,a3730828,26733090,ace3d7e3,91200d08,2cbfacfc,bcdb9c08),
+S(aac88c8b,7c96e629,6f023e5e,8f260324,9f4e645,bd701705,8f38e9f3,a034eb57,da03ca87,b98ab6fb,e4869756,7c2db04b,7f9948d9,ea65d93f,d222d52f,6d48c552),
+S(bfdd8394,fb49f93d,630f6b8d,469da38b,105529d6,70b9a1ab,e3196816,d2a13978,39a97919,4249f78e,c336b00e,475722e8,7ca734d4,3d1e97d4,d2aed074,abfacbe9),
+S(5b5dc3d8,66ba3647,d2aab2ac,3338abbe,4d1ca08c,6cc6fb26,4335f40d,4dfb2331,3432ba31,46a0f15a,beca45e4,1ded8729,e6a0a49e,70315745,bfcb3388,4e1b9e64),
+S(77057b28,a1d139a1,91e05ad,a8d72f3a,c7bbd198,7647070a,b6a21355,7bc0c73c,46f32321,4519afd2,f830cf7d,567aacc9,47ae6b8f,8c841adf,988e39ad,e7b9757b),
+S(f6c8d1da,e28a3d23,2a388998,1b638b23,f381618f,18dc81ed,67bfa696,4cf1626f,2ad8c92d,43378941,8d298dc8,2cbf288e,86d21467,ac73c0e3,383ef3e0,a03142fe),
+S(b75b5cc3,77a55310,a3b97067,34f1929,fc0db732,3265e6da,71405f37,729d5a90,be077940,4dc94ea3,3cff505c,e1aef457,bc120359,521eae05,1de1963d,b1948053),
+S(a66d54d4,4b4d06ea,f141307e,27e1c225,41274eef,5c0b1743,e6398b22,fbaa4068,51b6b8a8,48e1c27f,107f82cd,d0554643,b9e16611,fa93b789,a2199b3e,3bdce296),
+S(56b2f9,ab707dde,3479d0ea,baeb62a7,6cb9bf03,66278eed,559e027e,a1ea6b3b,27c47e9d,646684dd,2a54db0f,c245fcdd,721416f7,22ed568b,736e3e1b,f195b379),
+S(a9642a49,83b19c3f,f5f63ea2,9e76afbf,a25dd0c0,221b32b7,6e67373,36e7f5db,8ada3766,9207c6b6,a6b6006b,5240a4d6,cdb8b807,c0c16a56,91289b7d,62b3a051),
+S(18eef8d,f9e64c1c,548db40,ad77d92b,11f3ac43,60c63792,5f7d598d,7d8d5155,806db24,eefc3a64,c84da338,937811e1,20c6d0e6,9cde79ee,9957a4fe,c53d0e12),
+S(d11359fe,61861a36,8b3809cc,c727320e,42905036,774d0e83,98453ac0,68d404b9,d4182ce7,2500637c,8e14b977,34fcad09,f061838d,57c555fa,420fbd50,9abf6b81),
+S(7ea072e8,f60ff273,9cad1d8f,c560f208,b54149a2,5748900b,50830e3f,738b2db2,af09e54b,d44feb44,b39956af,fdca6894,91c7c6fd,f029e71b,e780f8f6,77a48a0f),
+S(f53406ab,9fb1317,b038dc28,f0165abc,115b37fa,77d23bc9,e51993a7,8a15ba00,a293f429,f7fb281,9cb60b53,b2e6f07,afb6537a,39a18be,a5ad4cfa,55aea13a),
+S(b1674e5f,9f194a16,94fd12d1,4b64ac8,bba69432,241aefd9,9a1c49d,23287635,83cb0060,1f5c33be,9436d946,22c3b3ce,68d20733,ee1e2392,8c3d6c14,a7cde085),
+S(22b72e08,66b96344,ee53b898,ea725f7a,b5832c12,7c0881ce,862ea945,5eafee85,b886e8e9,cba29b15,be5c22d6,ada99b02,1098be69,d1c500fe,6fd2ef8b,f1ecae25),
+S(9b7151af,698a85d,2246c88e,8ffb14a0,c762c2e2,64ab70b7,e30e2434,9b8370b7,fd9c3d89,46ee9d90,e7fb6d26,796062eb,4cb6c160,76df4834,eecd2748,c8a7bb4b)},
+{S(5ba26c2d,53b04b63,d260c6cf,392786d9,41a1a7c,b88331c1,149cd3b9,9c207f5c,9c7f6303,bd72850e,d4da618,3427e7f3,eee078,6f67cf9,85d483ef,79c2eab7),
+S(f7d26944,6d29f81e,39a44a88,49f12184,b9f42eef,16c5d88f,60c96a28,cf0c3e48,e7ec965e,d0a966a7,45087e09,a058421b,852c8a7c,3790a3ef,7abc6ccc,e17c6084),
+S(98590b7d,36bd2ef9,37ce788b,22cab951,d921724b,87c3ad83,8263416f,b5a67dc9,b711c21e,5af72a36,5cc1b220,7ed09ebe,be918555,55e9239a,e9b03d75,c0261d5c),
+S(92e1cc4e,5f57514e,9ed13535,5f3e2cda,b0b22f8,8f56a972,a657dba4,7263463d,14d296bd,452f2faa,7d6f42e1,550fe35b,3c47eb2e,fe7636c6,2eef90b2,e7822da8),
+S(33de9b1b,e153bdd6,efaf9d1a,30aa9b3d,faf26a32,4486b6aa,ecb1f958,f11c4673,7ef29223,4d3a565b,c0f0e295,deffa3c9,a86a6bf1,933a084f,9334b790,51eb0270),
+S(f9fad0b7,e1dfd4b2,47cd2cbe,bd863e1,95b3be25,6cf7a707,5d422b9b,f5631ca6,fd5262f9,e6ca0cee,e1c7e531,83d9f3c0,7ac518b,c024681b,56c06a1d,1826f5ef),
+S(455ec5ea,f34c02c6,961469ed,27bc7883,c07c9a18,663e22ca,83830a66,569b2b36,4dbf1b57,a7de2fdd,7c0380c2,b38fa5d3,697a5995,8ca0c0f7,6405244d,bff4c9),
+S(940fa05,d96fb400,bac8fa39,e696c536,71a490d7,c98b3851,ef76ed35,c62bac19,b6de17b4,1a045978,5755497f,1c2a953f,17554b4,20f2ccaa,9fcfedf3,5afb9b46),
+S(16012402,4ded6478,72374af4,6daf9c2d,a9000841,9a7d4672,98b627c2,420981b,7c2607e0,a4b86f7a,d5df7371,60987d21,35d2ce2d,bc422ab9,b643d080,26f84323),
+S(caf887e3,339046ff,42c629ff,c954873,2c629ecf,319c44be,6701a9f7,c81bf842,d253a688,3b3d51c5,a914ffb7,46e7ab68,70c2b1ab,5b7e46c1,7a5119e8,4ab6c878),
+S(41a5b720,595bfc66,18406547,d59ec09b,4efba0ec,5bbd3191,9e9256ce,f40a7afb,87ee1be5,2233ba8c,82dc06a3,6fd0a1b,4ee8d7d3,ce89cb56,1dc96c19,dad79613),
+S(8bdcbe80,fe8533a,174045a8,3cf9d89a,ca438ef0,8f6393cf,6e24d923,edb02586,8d21379f,c053e8dc,c628f0cb,83a7782c,b4e946e3,ca88d467,36232762,fc6f8fdf),
+S(409a4482,6b6f0ff6,36178d65,aedd64cd,2d28b39f,3e9cd93d,a0afe712,b75fcd19,25a3bec4,74216dae,d686825b,bee6aac,487a6d07,606e5aed,7c3032df,f4911eba),
+S(b7f414a8,4c0af927,64ed5b52,e96dad38,6995771c,2cd90af1,1986bdc3,cbeb61c0,702b0a68,4e93f0a6,26b807d8,8049db6a,3e65001a,d75a476c,e4be230,89574e8e),
+S(58b0cdd7,bed4f327,bcecd493,d835c0f0,e45f6fa4,3687d1d2,f19de285,5bcb5c11,21b0a478,2c1d14db,9c67817d,7b23db21,a96e456e,62a85c3f,2a02c76d,78dcad10),
+S(c75cbf00,893447ba,5b3f8462,9d6897ff,64be841a,9a6bb714,54adb849,8df03900,15f68903,ae20ae4b,9b3fc7c4,f8135936,c09de15,18317dde,bcf66190,2db79f72),
+S(e6258fd4,b63be23f,38361a16,cf3f81cf,f2d7343e,515b2d0c,ea0bfe38,6d4400a9,aedca212,9b73e49b,9757cd7d,a39a1e92,f885b267,a188521b,32089ae7,6d351eb0),
+S(7c61b66d,d76f759f,be92708,8b075147,2ba10db2,eee4f0a4,2eac1ad0,d2dac3a6,c2b79de,70372e1a,6c9449af,2612e34a,8e101cc2,81ef378b,97cd77aa,bff004af),
+S(29c71194,bbe41f4e,b2f58bf5,799616c3,7b247283,c993bce4,630929d7,55f7c8c4,c0fb083f,d68f63d3,599c2da,9d0c1f03,b6903545,a47581ff,3caecbf4,359e0235),
+S(f1cd983,5bd3eb61,f8207495,48da075b,ff4191ff,d5b1521a,a1f4413f,2173a68e,beac8102,13b643a9,4658cdbc,71713894,39b72abc,f8644697,2fe6310b,4ff0233f),
+S(94f2137a,ae170855,3af3dd45,8f8fc9d3,c1bf07e4,35a62798,25d5b93a,37380144,e952d6af,b27f9b2b,80ccbe89,59fb8b15,5fe1b2db,f3ffbf14,cf9c1fe9,b8e8209d),
+S(f4f0cd2,e28cb8a1,9b469b18,90033912,4a40a39e,67ae1642,a3a677b9,fa1a9a3c,75412f04,5c41770d,73d7cd77,bce0da96,1e6fc69,cfc6cb9,8f691d43,dce1e548),
+S(15ba2fd,b652ea98,f2b326ee,e5e1629b,ec8f8e7a,36078d7,cb8a80c8,c943e98a,db416844,cf757376,cfcd5a9a,9a318b51,184f8c89,fcda3d97,e735c120,43d47c35),
+S(5754903c,ffa8cb6a,3ffe3488,e484c498,69163b77,7c07183e,8d2da037,78b8da34,508312e,6c2fd008,fac12bd,afdf8e50,1940a81b,d05efd38,5277a85c,ccf125da),
+S(3bc76f6b,8abc155a,dbba76a1,9c0fef85,373bb1bc,9775f431,1b3ccb12,9c7fb29c,48036702,aea467ec,daa8b809,97c41c07,9e38c414,f798bdc3,a531b08b,fb4ae303),
+S(2992c410,306d3d40,313ef69c,a2e3383,88f592d4,a9c2bd36,ebd9f51e,883aa33,cdecc5df,41cd193a,ecb26700,baa42486,a0506372,d56de3e2,2fa09156,7b525519),
+S(baa7d83d,6d70a528,e6392adb,b2af797c,72772b92,ace96a25,90d65c37,b0ff1bc,9943b555,4e44b480,28815d8b,e50189d3,6617e9b6,c8f07393,8309e04c,9978fad7),
+S(935488ea,4c88c2e3,cda6c0ab,5b42d519,e7fabe09,fdd3e36a,7c78c9bd,730612fe,705c8f8b,228be0c5,539eae13,1f4f4bdc,2fecf6ce,6cc567c4,dc692af9,7c1d506d),
+S(8edeb68d,e63c35e2,5e36bc8,61445a63,8b0637ab,d14557bc,f0b0648b,db43f86a,d20bd0ec,14ef4f35,68954130,6577ef85,baeeeed1,c1004130,80687a5a,94a9e9a3),
+S(9a39617a,27c2ff2d,9869acff,b22fad1e,a7d04271,be154547,43234f54,7f21924b,917bf9f3,fe0563a9,8daacf90,dfdcd8eb,e657f023,3fb15711,79bc5ce6,e6f5dd56),
+S(41dcb02d,21137ea3,a179b469,199f9ed7,9b831923,68719a4e,5c727ce0,d42e95d,4669d53,82147266,8327cd6b,31c21b80,d3394bf7,fa29a43c,2ed7441,d866f5e1),
+S(d4e3e3cc,387e0364,6688a62d,9390d585,a69ff43e,1060811,431dea8,d868355e,3309af2c,b3d7ca6,55334f2e,c53de6aa,debf5d57,1618ecc2,9dc9830f,ec46144a)},
+{S(90edfd0,61871350,b7f1f029,c4114190,b050065b,2030a400,9a8a7a6f,4b92aae8,872d4f07,5f60ae2d,dcec2f12,98a22da2,53d54de4,fde85560,690dde89,1628db56),
+S(27e3ce53,b4258f97,a499f408,ecab24f0,60aabae1,dafe992e,5a34952d,5e6e486,d393fad2,9be684f4,7ecec306,332ad969,75b79d29,b5863d98,5f959c4c,b8ffb442),
+S(420f1078,27c75c95,d5bc657b,a46cbe2b,415a7d42,ad62cdf1,6c84ee89,22215379,8b257a28,e0b15fcc,ae0b555a,cdadf4a,be93bbb3,a208ee45,77710a9e,d58da7fa),
+S(28859abc,b60a95e6,b26c0996,566bf798,60c1a194,2d3342f7,9655f286,32f9d5df,2a770426,5eeca5d8,87840cab,3923d868,aa7b7b18,f9d19941,738ca006,54ccba6b),
+S(c33c317b,490e2266,2649a021,e87f6596,3897633c,90be208a,193f1d52,28614059,af850be0,d18708bf,d0e1f523,c1a4fda8,9a6c156a,55f82518,2bd99bb9,b999a358),
+S(2333793d,b961d3d6,740fc725,6cf9d833,81b5dc92,85b6d83c,5c343aa8,5baea83b,accc199a,ced3012f,b6db99c4,7a36c30a,f88e7eee,b62c2ed4,1352b488,ba0167bd),
+S(4834aa89,caa9c25,a99ee4da,e4a64c15,25a5d74f,9ce573ab,ff44b63f,c3a578aa,fb189539,448a265b,eb87a268,b71a18db,f12fe8ac,e502720,c83ca156,c1cc7a39),
+S(432cc05f,c78b0d56,e605391f,e4708bda,a1ff3edc,96a729ca,aad3cb0,300c4d4d,6675d8ee,ece8c078,e1bad373,247ce383,d4c65519,4a6aed20,a7ca5eca,34a89c30),
+S(874fda6c,b284ca2d,a216bbda,28249388,88da3968,7f615ab,52c8e61f,b72a1fd,2d7199e2,b0b88f45,18e6eeb1,240b2ffd,a9bfcee4,6f754a4a,3db7959,dfe857e6),
+S(7fe21a0f,3ef67d60,1de05f67,2b163285,a5577948,ee78274b,19fc35cf,2d2f6801,62fb2ade,5e2fffe1,28542038,91a6ea73,aabfa35b,1f7fb000,95190adc,de6663f6),
+S(cd0540e9,efe497b6,2beb2227,a2da819,a1ac3bed,8eae24c2,6e2991c0,a707dd69,446c3218,7d0c9229,d65dad2,1392e4a1,66445386,4a5c1620,bf768fad,20a45c06),
+S(a533c295,74e78024,52218573,66c30001,6159d772,f5bedcff,28d7f7cc,3051457,b61a106e,e0166d54,5e1b945a,f3e4e285,31a34cb8,56a34dd0,cd21184a,9555eeee),
+S(5e144f44,ed88845a,c089331c,eb58811e,4c164e02,5d1758ee,51a7a522,c66deb30,ff95cab7,597cf62f,e1aa8df8,a2cd3844,d71ab4dd,4eb02a9e,6175077d,261e2540),
+S(97487a40,9562ee2,7620fc2b,c5bd55ac,6509d487,8ab41257,53884b97,7c5a84be,e52a282,1430c540,5f1143d0,62b69faa,16592f02,cb9b8602,d52c9fc3,70769091),
+S(906f9ac1,d3db4690,d74771b7,f1940679,b0de7731,a68d7d35,89caae34,c3760eea,6f2be7,2275dd5,1e77a066,b8d3c303,f565cb97,b8fb0dd3,14445d18,876665a6),
+S(4c355a31,d17617f3,5d4066c7,a125b2bf,1d6f77e6,27b585ba,2d271a29,a88c81b1,6a686e69,237b75a1,a1ecb86f,b715e858,35aa0686,e2ef10bb,38b762ca,5646e9db),
+S(15aac1a8,9b6b7629,57375d4e,aad87c9d,e1fc2617,89e57d29,731fe96c,1380140c,2968c0b2,2c3dd83f,3286d37a,639bcc14,3d89e75f,cac1da56,7e07799a,62af1008),
+S(4642f29b,37b87118,65767998,d00b41b9,fca6718d,bfc55785,1c459efc,2ea15037,a1ded31c,be33cc1,425df851,998ddd11,1518ed13,f84756c1,c7cc46cf,3f5e9a72),
+S(9554abe,9e092bd2,c4ff46a0,abd0b7c7,fb73d85f,1c01fd96,83146559,306ea727,89e2c07d,db1fe6b0,9872ce91,66ce9ca8,1124986c,c7e48e09,f80aa3cd,70987711),
+S(1c0977a,a773c56,2e36dd15,58b95fff,d35b4dea,ac464011,ad7b79cd,26227238,e04ce4c5,b0b165e9,87dfef97,d32094ea,3e86e6dc,33a4c96f,c9470336,34b0db68),
+S(71d44171,60361c39,6295e5cf,b1540ef2,1ca046b5,98645a23,e8c9772,ac21be4f,7122d5b,32a654a0,1476a47f,d3317a25,ed51536,4a21253,f4068dc8,14660c55),
+S(d906f59b,4d56bc12,f26d60e6,6fc31733,e5450707,89025ea3,8a6193c8,520ddbc7,cd7f414b,c6cc79aa,4c65b943,ff914234,a9d85cf1,9853be59,2a71fe1d,dbb20163),
+S(11b7dfb3,17dd5c23,6b8084d4,f3cc157f,c25c0e70,8248b472,240963dd,9a3fbca7,dd2c8caa,2a2d14d7,fbec267c,9fe87ab2,8b1ddd92,dd100449,f75ef1da,97d4e5e),
+S(3ef8274a,fca8fbb3,1894d7a2,d1ad59a9,4951b21,328b1e84,ecaa6df9,cc1ef473,2e4f0c04,f5da671d,4a2b641,46ae749,27bc35b5,98a54190,3883469b,3e7874de),
+S(a861fc27,f5e6300d,ec0fbf6c,3315d053,98f90b84,2422992,bdfba11b,1c1c7e34,75a7458,5d98bca4,e3517897,afef848,8e524168,a586d8da,18834171,4b51846b),
+S(9537019f,57d7869,2a358758,47e885bd,1594a426,4412c595,62eea9ba,4ab34de8,21bfd84e,a66650dd,79cc8c13,7217a351,57b9c046,938f20b7,246362c8,6637d5f4),
+S(71c80c38,b1889d4f,507132a1,87af0c91,79994b84,1b816c8a,6d130a,df1b500f,8de1f76c,100e75b5,1572da6,d08c76b2,10cdc447,cf903e0e,2b00e002,5dee0ce2),
+S(2fa9ce2f,59865d10,17880d74,d31cd446,5c28ff56,50f29e6b,d74a810,977ef9ec,6c5a2073,55c0dd3a,b994778a,6bd02b87,80ba8e1a,899330ee,cd8781b7,6e15cddc),
+S(96ca6bb4,bf74c748,75703386,ae02dc29,13329d9e,a5395892,df1c6f57,4a84fa4a,fcb510b6,dcfe8da5,690f8fc9,4dea8ac0,e42af209,35c33347,b088cc79,52e98b1d),
+S(36a066ae,694f2645,25cba884,956ebd46,ae568acf,11664965,63cee00d,a32f2199,5d1e975a,856ebd1a,cb1fe254,101e89ab,ea089e8a,b38bbd0f,1100e914,709fd965),
+S(4922879f,800234c9,63f4b572,d236843,4c4da5c8,ff741982,c3d1e341,841d1309,9b259470,24b5f4cb,97c68d18,f7f8dfca,1e57f7de,63208765,2ce15770,98f35494),
+S(ee27e2b,acf95f6d,dbb5ebae,bbf181bb,43322a3d,6db87e78,14e57a3d,41b581e0,3d6a18a,daf69ae4,88ecc9d8,7d6b1bf2,c8d65544,3f4b45b4,c5a0ac51,7b1dc3ca)}
+#elif (COMB_BLOCKS == 43) && (COMB_TEETH == 6) && (COMB_SPACING == 1)
+{S(e3adcb1a,fe947e6e,7cc4f5a2,df78310a,b235e2c3,bcd75eba,1904de80,c8814c50,e0b27ead,c4bbb9d2,37dad580,6e366674,4a9f9c3d,e024f2bd,1edb11d2,fafc0a22),
+S(612c2ec6,f0e9c4ec,c2200d23,ddca77eb,d003be35,61e52b1,890bf846,3bb53ea5,9e944d7b,dfc7a952,c1c5ee15,485d7199,dda19551,2d729628,c215a9e0,285f656a),
+S(42053dc0,9f90a7f7,86feca60,d68a5c3c,789e44d2,3479aa13,2d1a427c,621373a3,b338f891,f3930ec7,738669bb,3a29ae2d,637be08a,954f2a8c,acb661af,a660bd22),
+S(4d227ea1,5194ed57,10f8ea4d,a639be04,fa68ecb4,f3d2d9c9,43ec32f2,80f74051,28a94075,bda4c195,40c20493,b5391df7,166b1264,b957fef9,683cfbec,4c6e6875),
+S(8ec4abf4,d4db3b0,2b0712dc,ef54a405,54b6cac9,3f88fa9d,d8cad4c0,9b94eb1e,4e37e159,517346ee,17e948c4,a17912b0,b29c303e,497cfb38,16796752,99aaf9e8),
+S(ab186398,117fb83d,db8b9392,cc888fe2,50d2f604,5a0c3f89,92d8a82c,382175c0,79437224,b3b1604c,fae64902,e3030448,51ef17b8,9af02d7c,54a92c34,7fa2abda),
+S(2bd09ae7,1e8d85a2,ba550bf2,9c1787a2,3d2c8985,e2ed07bd,1d39e7b9,8ef8135,ddaebb19,195bfd6c,a44ce82f,b7f3c65a,8af935ae,52e2d2fb,33cc231d,c4b16082),
+S(e6da6560,c8265e7c,8f62edca,78dc739b,74bd6543,44a939cd,bac0f489,12b920af,147f5ce4,a98377cb,981dfaf0,1a1e4740,238f1c5d,ee69cfff,a54f3aeb,e53980eb),
+S(7df5abfa,d6b46a37,30bd5892,69edb6fa,b70a0d31,936c0787,407d5d6,96506263,bc5cbafd,1f5fee67,1aa449ff,bacefc67,cf7c529f,86100d7c,a8160e4c,376c76d4),
+S(ad672823,cfe3ac01,50038d30,81a1a109,d8629b4a,a4e26779,373ee0db,44a466d9,c288397c,f91157e6,770c401e,dc84b328,87b22534,d11e11c,c8415a4b,743fef9b),
+S(72032cac,3177c280,ceb3076d,7f510405,2413706c,956ecf38,acf410ad,a12473a6,8bbaf50b,95797824,2994e6d0,a4bf6d07,149792bf,f2a74847,1095f845,bb332036),
+S(36a1f78c,3bebf8c7,1fae5e29,cf08485d,d9debdae,348a20,ad84ba5d,4308fec9,842f57e2,e900d07b,eefda7e5,9dc40139,c5deefcf,11c07c42,4629c59d,593e01af),
+S(5f418454,72e80d51,1c1b8bc2,b6b89224,9119ed43,5b915809,f7b26d01,8427f579,dfc29fdc,f3c65221,a6615262,cebd9a14,acba91ba,cca22ec5,d84303cc,1fe0085e),
+S(5577ced2,f6bf41f9,503aa4a7,c0060fae,6d33cda6,e3c8ec55,1eaec315,bb91fedb,858ded64,6c3d6231,87c0967a,84ee5253,2b21c4e5,b329bdbb,76f6a6d4,93cdcb4b),
+S(bc74b56a,c94ef36f,2b356bc5,dfd11d2e,7a371087,653ad607,dbfcfeb8,27abc502,d57d74e7,39e758ee,96a422e2,f1fa61f7,4f6308f5,71e6dca6,3b0b0103,e83cf1f3),
+S(727ed91f,be4c5086,50a0d365,b28ae4aa,c9434c0,735fce3c,7b3ebb42,f4be911a,8c595547,5e627c22,6bfa855a,22ebbc56,d3d0b331,9120d8e9,13bed868,7d3bf331),
+S(6286bb90,71f8887b,c4fbb3f0,a9ecb19e,fcdd2cf1,5e286da7,1bb60c9b,5ff5e644,73731ec5,ea3e537c,c6060ac5,dde716b7,2aef4117,ba747b12,1c26fc9,eddbda74),
+S(3905682b,72282a78,2b8d8dba,72cf147a,de0025dc,a21521e1,ea989040,c248852b,5da3bf52,dceaa14a,a3534068,c05bb015,2cf9c722,cc80c56,cf828ace,d96fc390),
+S(561a2ccd,ca12b67f,dad28ee2,c3cee78a,cf811766,9e4a2543,c81b1ca6,eb4bd16e,3b386a9d,553c2746,893477f5,17a05e99,bbc8ddf0,896249e3,85e406d6,a57b9ed9),
+S(75bdfa06,6a1a42a7,50f283e8,3ec91cc0,a5b68829,6e6aa24a,28a61e33,65f378e5,c73224ec,797d6736,c1a541ab,34523d91,e1ec3754,fe7fed44,474f9cba,29f305e5),
+S(e881a840,847aa2e2,2417cd3d,3e798c56,1e630290,5dff6bf7,754d9419,98d401e3,8816d775,f1555452,f624e45,710a240e,90fc5e23,7536d217,cf555349,b5e31bac),
+S(1fb527e9,4e9c70e8,657de745,8b81ef9e,e3c2b4e0,128a675b,f7e28980,e18b201e,bab00a09,1145407e,693d5353,7818bd30,49e1f364,757d228,58b8aac5,416e3e78),
+S(1c2bd878,b94169da,722a9de0,c4e317ce,a8802aa9,60458301,11a89d1d,9de4270c,95b7d99,bc3df31e,f0dbf17a,a09ef148,71ae6c5d,870ebe75,1f52aaad,a48dfcc5),
+S(41f7fa0a,9a59513a,e221e3b8,4b91995f,c9d40eb5,d120a6d8,e663452a,d92099c8,813dbbe,92ec4b62,25d1cc5e,5820ebb7,dbdc2964,d5dd1ab3,deabceb9,5e793d32),
+S(e5cbd627,89c6a843,25a24407,89b88dbb,1dc55afb,9e8296e6,bb8af7de,57a50e60,2cf01cea,ae4f4fed,46c4efd7,86ca5e4d,ef5af524,e9393d74,e9dd224c,604b9408),
+S(eb3bc68c,623b1f46,ab905412,c7f2d588,fa25abb7,7a7bd782,ba9bb3aa,c05a70ae,df9f46e0,5dc1d126,2f72ef3e,8db01fbc,11915af6,4aee0c51,da1cfa,b4d15ef0),
+S(5702fb8a,2602f41f,52699f68,8d4b005a,128762e1,1dfd13fd,22ea751c,cbedb2ef,a77105b3,7af534e6,46f58c3,b02543fd,9e0666c1,58051952,a61f8389,73f5847),
+S(66954eca,5434263,4036fc7,fc0fe33,81f5195e,88433bc3,2c5a8a60,341e2859,d8b1b14,40e9f123,f39c8658,f9d64e7d,fe4071f0,ada879ea,42eebad6,4d37f4fc),
+S(592152c3,98d6c719,636a03a6,dad64246,a5a6814a,a62c156b,ce5332f,6759b031,8d22d1e2,d93dcccc,889f3b6e,dd5e2098,2f5586d4,bac06842,d689a37b,4b845c12),
+S(5699b93f,c6e1bd29,e09a328d,657a607b,4155b61a,6b5fcbed,d7c12df7,c67df8f5,c147ee87,14325497,6b2e534c,e6902748,2a5c33dc,867732a5,8338f05,73368388),
+S(c62c910e,502cb615,a27c5851,2b6cc2c9,4f5742f7,6cb3d12e,c993400a,3695d413,e80c2522,898d8a22,2c4dc0b9,8dc9ce88,740fe252,5144656a,c30f978d,dba83c1f),
+S(0,0,3b,78ce563f,89a0ed94,14f5aa28,ad0d96d6,795f9c63,3f3979bf,72ae8202,983dc989,aec7f2ff,2ed91bdd,69ce02fc,700ca10,e59ddf3)},
+{S(efbbec14,ff6d7e18,a8015d68,ba3ceb19,d4cbfbb8,a1bbc09c,ce755a23,e9d4b3f4,a76faa08,2b02b8a4,405573c9,5ac067f3,ab936127,24bfc14e,a27f923d,3adf0133),
+S(f02f6744,a0ee7b0c,7bf0abb3,c7ec0a5a,3275d109,92be2893,7e9ef649,23fa932d,955f3630,c5621787,13e6d8f,39efee26,d91a0947,8da36db9,4ab4a89f,aaf9019a),
+S(1c6f9f0f,d6ecbca1,fbcfbe9d,1f3d2476,dbd3b6ca,ac8e18a5,949b993d,8c0063e5,e3e3770e,33081dc9,5125d69d,c631450e,5494d21b,2ddf48f1,fbc3169f,3cc1eb91),
+S(2062725b,739b793d,c9798397,dfc7b1a7,24ebe8f7,5e5654df,536adff1,25970841,22f3e3e5,c0201265,5e6d8e58,b8ba633d,9a9216b5,445a7f78,a2605688,4a5b6092),
+S(57ffda66,e0c29448,7a1570f7,e2f5dc58,ecf9b906,5f374046,5bd1734,841785df,22ae8728,a8800436,1264c380,3beddb65,a9dee575,6f0cfa97,c01dc047,3c806def),
+S(4b49fa7d,463cbb43,b14928c6,7b3a85a6,8132ad9c,427d3cc3,bba76d1a,7c9a69dc,7e7e3133,3782b30,5c7c3bd6,94e3c306,b3f9829f,86f76f08,d44b1a76,a207f2c5),
+S(411a3b18,c9b638fa,38a0e811,ee370f34,5c9476db,61df1843,863d6d7f,4e803ccf,bb306f97,e97e492d,e74afcd0,a771570a,8210b51,9e61df78,4e6e97e0,ac23e109),
+S(c8227510,49de1572,37afdf55,d175196d,5d315001,3670b478,a0255a4c,ebe95075,16be5950,a3f12be9,5905fb52,8d5bd93,23eb5908,211d2e8c,26204b32,556c5c45),
+S(e46bdb74,8692d0fa,e6fc9f50,6685487,31d61f8a,5717fb88,4e1f7a41,70e4997e,35398e06,48bea42,cc48fa4f,2805efbe,6bead663,c054eb08,2c15ad46,c0611052),
+S(d18293cb,d0902dab,e4c014e1,22969601,84aedbbf,a01526a8,6978e144,88ca794f,3a5b423e,32c1d2f4,bf754f42,9da3c9b6,84bb798c,ea73f637,1777ba77,1aae6086),
+S(7b9cbbfa,a53923fd,e9f50845,3130101,3b17548a,8097433,79d3a526,d1c90c31,3fd7b71,5b6801cf,30fe22a9,8b7895d8,1b483f6e,9fdefe7e,6c59fec8,fb9786b4),
+S(ab6e185c,be9ee393,5ad6278c,167396fa,aa4d936,80524d16,27ca8e93,48fce67c,7154007d,3f96ce60,d09499a5,1262c7bc,3ab5e9aa,929e0594,994a9671,8f912987),
+S(56ffb418,8b9c9c13,4a110c03,8df8636a,71141ff9,8448cb79,eb6dece8,a28b65b4,1d728ed5,23ab821,ac0c40e2,b9348e27,191536c6,79a73835,8bd9b3c,b43dcafe),
+S(bdba1eff,bf6af786,dca1da26,cc226102,1f95d56f,245298c0,b87a40e1,fa9a0cbc,fa18673b,41f765b8,25d13f2d,7963f1c6,b3308a14,b033fecd,e1d0d597,583440b2),
+S(d9a4a7f5,5b3af93b,1c49ffa7,4f8154e8,23aa1477,16b16441,39fbc86b,2d9346ef,19ca90e7,538ac3d8,a28e1aad,5d8b1dcc,756f8a84,240e5769,a0f561d,f53289b),
+S(ee5c17b2,74c78b87,9eda9341,256b1506,25582835,60a0bdcc,c8eba320,32d58638,d7d02f4a,b81215b1,7843e3c6,abb63755,c7e05d20,6c61a4f6,bb08d1b0,256409ee),
+S(6953ae81,7ec599fa,5f739bef,dc4cd8b,4670eac6,912bd03a,a3fbe91a,5122ba0b,61bca3fe,36245ced,31cae918,fab6d463,50856947,f64a3be,d0eb62d6,f9f16059),
+S(3bd721f7,59f7c3a9,93474472,4ffd3e34,503cbe45,fa7fa5ef,40a5a173,b8bebcea,bd7cbfbb,797034c2,d293aa64,1bf175dc,74a44dba,84b8d99b,8182d2be,6512ef2),
+S(ab6e36ae,f5b7ff2f,fd2f42f5,8c408b7f,3ac84253,e1d8a43a,55cac222,678dd38e,ff0dc59e,51e504b2,9a0ba824,3ef26eb1,2446f628,78293da2,d924028c,21f57342),
+S(bf1a1f6d,7f73b09d,3efbd73,eb9ea2c6,23e17911,9063489b,42fb1303,7b53fce4,236566ae,5371fc97,b5449b9c,2db32175,90e02412,b44539d3,bda7a814,3cd4a634),
+S(fa0c6aa3,4c4825de,304cfece,37a20bbb,f72044e3,94cad202,c9e1edc3,b288ed57,df8e64ba,5f5e8381,4b6891b6,14dd4753,fed5f566,956a6dd,95540bdd,25c73995),
+S(d2ea634d,ab56961f,52e39ba8,ebc5c150,ba9eeb1c,6178aef9,64fa97d5,e80581c6,2928f71e,a09a35b9,6fc1976c,f6cd3c1c,7d1fcea0,2142eb80,9666917d,c9a0621b),
+S(827d6a36,697cb2f1,cf19e27a,ac30c06d,20d818c9,fe869309,6435f1f2,171c9b75,53237d41,3781a1df,d0d977c2,9690d488,b051dc2a,841ba226,c552cc28,12ae7caf),
+S(59dafec5,4df05695,e123004d,38d9aa12,6a06c399,e5215245,5392e5e3,f1a47dd6,ff7d173d,ceda39ec,ca8d2c95,ab1658a8,6ad99618,e3fdb7cb,b07b03c5,2f96a86b),
+S(5c4f5b9,2acb30ee,8c7ec4b0,ec577f41,a9502af9,a5a384dd,3386f230,3e62a830,8aea5f7,145de3a3,679c86ce,72e8b36,f3d6ac81,bb1d2043,9d719c32,ca2f8b30),
+S(38add3d6,209080c8,efb65551,3d9420aa,457f06ac,d3ec84e8,db84e208,a0664ba9,ad95a891,c60f01a1,5fcddf2c,923790e2,d5596334,4d83a21c,dfe5f6bc,4c2b32b3),
+S(9038876f,21c3bc14,111d5f6a,4749d07,34e40a53,7d398c68,809355f,764cf1ba,da030216,5e661aff,53367578,4a4d3447,707f14af,cf0d771a,53e8e687,b9dc29e5),
+S(b07d3e8,dbbe686e,5e163725,8402cac3,e1e4f29,fdf154f7,bf008c5f,9969da10,c8b668e0,56bf8173,2d9778e2,eaa069d0,cdfbf826,47f615c3,6d0b311a,b2e14922),
+S(8bc89c2,f919ed15,8885c356,844d49,890905c7,9b357322,609c4570,6ce6b514,2cec0c32,283233e9,21889013,c4a76d3e,e8d2cfa9,eed8890f,909c0b30,5736aad8),
+S(308913a2,7a52d922,2bc77683,8f73f576,a4d04712,2a9b184b,5ec32ad,51b03f6c,b5a4f6a,bc0141a0,6e1cace0,993fc8a2,57ccc015,7d42e0ed,9f54a102,1701afc8),
+S(3f0e80e5,74456d8f,8fa64e04,4b2eb72e,a22eb53f,e1efe3a4,43933aca,7f8cb0e3,34992828,d693436e,16f463f7,b7a2fe4c,6afedac5,59a4ac5b,34fd761c,15a0bbe0),
+S(d30199d7,4fb5a22d,47b6e054,e2f378ce,dacffcb8,9904a61d,75d0dbd4,7143e65,6afc7262,f51c2a3c,4c292136,167c7f9a,e089f33c,9b127e69,fa4c00df,dbef9176)},
+{S(983e1ca0,5dd64afe,8d39e15e,43c1cf9f,6badf550,12cdea89,5fd85021,b49f173b,18200e81,d75a745,c1ecfe5a,3ead988e,4327693b,7e3c0e04,329b0c80,3d9934ba),
+S(4e1200fe,d3e5048f,f6c9fe53,cdff8ef7,5d78e601,4df471fe,369f3d1e,80e46674,a62aca58,4ecf32bd,cc297b38,c1951c71,a66966f,b9ceb2ad,de411da7,d175df94),
+S(82f5f27b,83d49042,63e69f48,b676c9a9,2446955,cbc18ec7,fd4346fe,37e0b0a1,e523d039,d0b8ccae,737bfc11,9b83dfd3,d6878403,862618bd,40ddfc89,9a688557),
+S(a8c0fd4e,ab1f0e3a,cab37da6,58fbab3d,949ad9a4,31d6461,b2648308,35762d19,950200a9,63c3dc2e,6d2771e2,eff401d1,f9ce037e,75782943,3fd3c560,a169713a),
+S(25c1b464,33068900,bff89a4,ee973937,b03c11a,5b33d16c,4f672fd4,bfaa11f9,471f1f8c,df18e73a,e12cae35,43506cf2,c57894a8,f633ad4c,e1c5330f,eae42b43),
+S(497e56ce,8793bfec,4dc6f972,dbaf4a72,aa5d8412,3bcac5d4,2aa9baf8,ccfd6723,1d3d028e,b70105b6,eae66785,5dfe7e0b,7c0a6b3a,b069a475,bd913aa9,c29cf426),
+S(68a285b0,d30c2dbb,b543e480,f66824b1,69aa339f,7e2282c1,5dc60f50,8e3f2fa6,87529a0e,1d53588d,21064447,99a8fee8,ffc791a7,cacc9e26,f7a7d94b,25e74cdf),
+S(721c92ae,931712f6,15f4d7c,498dda23,e1029dbc,944cea16,9442b22e,d755a100,7ef052e6,a0d2646c,a5dff39f,3b2a1019,de43e3b2,5e51913f,d636281d,cee74a85),
+S(aae8418f,1b124d79,ad15f773,1bdcea1b,453493ad,4cb0cd6b,ee5c9a8e,34335ba3,c2558bb1,4a7addab,62d1f308,1a9e6fd5,92a06976,3be877d2,af9ae1e8,b510d98c),
+S(b6a06052,b492d74,c68640de,8bd3251d,fbaaeb0,ce1eb997,f2127ead,4bd0b81,7bb4269c,4a9ece8b,e8ea2f0f,d663a193,2a571249,2814eb73,4ae1493a,6a97b39a),
+S(42fbe048,38761203,11e43178,6af555ed,d7bea551,d4d5aa18,afaa4c05,2c6d0c19,9ba562c0,a4cdc664,87caf55c,291d8246,65c29f32,2a56360e,90138b06,f109d83b),
+S(9d6dcb88,b378e7bd,233464e0,25e97bf9,97768e29,6e4aac31,301fa1c8,bfbcc27b,f434ea54,3f7269cb,1ae1279d,4178dd25,bbc337ad,2f0d5141,610dc061,80daa8c0),
+S(fa6fa5c8,1e6713d8,90cd6f29,cc8b7d03,c5f8f2d5,88963652,7c199f6e,8f98e060,726194a,2a5da1b5,85eba1a5,5e06ce36,5aebb89d,ba5f7971,db3c1571,c848c5f9),
+S(809167d6,85e432c7,372dc111,8573e620,d9ce7e9b,c3ebc15b,ea7e866a,3a8addf4,bf0cb694,f00fd1b4,b62119b3,9dd6c88a,22ef1fed,a94ac0a0,9cf33225,9298b968),
+S(99d28ee0,962c1bd2,fa63109d,f5485653,964059df,bd514206,24117eb4,e582ad46,8cbdbb66,4ee209b3,419c0b80,36affa24,85cdfbc6,e6644429,33908490,f6f6353e),
+S(559d0617,e0860cd1,87f1c68,e9a9951b,fef7dba,3a67594a,eade6e25,e2df593f,194595af,721e3b26,786fc25a,cf5b2d77,1fe00649,b0cc4938,7168a9ea,1fd2947e),
+S(ab9a7228,f0d533a3,4a95af3a,51021b55,bb324229,8d101a66,eb362c97,eac48b02,80a6d111,e451eb09,cbebdd5,a3ce4fdb,42b3665,f8974df8,912221b0,fc7db6af),
+S(42c6680d,18b0f528,274c2eb5,422e4731,560ea862,adcc4419,68bb5f3a,5bbfcf16,c8961934,e5bd6e7d,d64d4b1d,f7867c7b,978d182e,48315ae4,3fe2e082,a9455792),
+S(e8bc0f9a,c3687bb,69627de1,df71fb34,21e0252a,e33d15da,3039a200,43ec3374,15de9e9e,2ac74839,5116ef76,1267300d,78c2e583,9286e6b6,366c8a6a,540036cf),
+S(604ee928,4ea1c8a9,a0a75bf7,be3a5c02,8f52d71,b5fb6340,53401e8d,8f5d3d6,43bc16af,5875b25d,8e2427b3,3913f6e0,bda886a7,52a3b812,f8f191cf,f7bee54b),
+S(7f589067,5b771ce,ac754412,a9984352,4f2a4a6b,a5cecae8,5106bb81,f7e4d9dd,a74f2eee,584696c6,88157a3f,fc27085c,6445c7eb,e363c6ed,7a1f5902,63de2024),
+S(80aa63b3,1fdd0d2d,ef602bab,dd88a15,71abd052,270988a4,63abe269,fc489fcb,9a145d0f,6dcf0edb,a4873287,a2f221dc,4be613df,f70f7755,f28879a,6e7d9978),
+S(ca9793bd,796ae0c1,d778f3,6445bb8b,aa50d859,4be28fe0,ea1e2d16,30972503,7304af4,4c56106e,f0064436,c09b411b,926c4c56,cd82577f,f8c01ab9,9f7c4c6),
+S(4cca305c,baf6615e,8cdc8a58,f3a9e52e,97ee20f3,ef080793,ce105a03,a1f1d3d2,637ea84c,9578321b,b5dcc239,7f6206bd,abdfff2a,128d3645,47d474f4,8a8ae493),
+S(cb7813b1,a7227a24,cc53b458,1985592a,a9077113,28fb2a05,1d4972a2,3127a913,208b7263,f8f8193b,76dbfb1a,6c4f9264,dd12f63f,e852aa8f,8375fd00,eef83482),
+S(d61676be,a11dd1a5,79164cfb,b2488e54,555d7d55,23ddc8a5,454c49e,4a86d8ea,1875b5d5,6db950bc,60b1eeb8,17a94af6,5a19f690,d48aacb0,e483ad52,61995cd9),
+S(7142872,6f59c2c8,b398b22f,2ab5c3ca,e803a34c,ab580947,9b7b4d83,1f8e8c0d,3702510e,324c0911,b3154c61,e064ba23,68eff5fe,6f05353a,34980ec1,87ab9ad),
+S(72a73d15,9cf7f79b,950971b7,1c66f362,54d13783,c5ef67b8,4da61dcd,4cf432aa,77d711e5,c1793c36,eabf9b86,bf3a692d,234f02db,e4d5854f,5deef926,b9818d2f),
+S(ab3b2de,c0a8f23a,a7d3b9d2,88870969,2e45ef47,37a792a5,d65af92b,e58f6347,ac4e4ac9,1bbb57cc,1437e612,e4d4ce37,3d4f0286,5905b621,56826d80,895cb48f),
+S(fe5efdb4,32715fed,f9bbb16f,d65ddf6,4ce9bb13,14a491c3,3bfedeba,cb4704ef,e5dc36f5,5fac6974,eaf9d8e4,232a22c3,8aacc6b9,1225a97c,2e695940,ec795c21),
+S(5f94851c,a4149e75,e44a0d8,17e81c75,132eb242,c96ae41f,53f30ab9,c8c828a,d9473c47,505e0117,1a0f8682,777d0ca1,7399208a,b03974fb,4014f5bf,c8cbaeaf),
+S(5d1bdb4e,a172fa79,fce4cc29,83d8f8d9,fc318b85,f423de0d,edcb6306,9b920471,d7bc7d98,86c861d1,86b4466b,c75dd9a9,8614e166,693a9184,8fccf998,847cb2c)},
+{S(8cf1437b,d87e7faf,550fcbe8,81b0741c,ae0b48e6,e0b3c3d9,9b1b1924,2a925a26,17b40146,c313b1c5,3bdf52e0,efebda45,80d86783,910996fb,8b2d0acf,9bd253a8),
+S(fedc65f0,d622743c,53fa6172,e68d983c,2c9b8fbc,58943f48,ad06a852,c98403e1,ca5dcf28,1a2f20d1,5fed06db,89dfd290,8c9d32a,cf40fe6,817e861f,7f168ea9),
+S(846c6a48,e771b90,4ae1e8d9,d3daf1ff,d1cb4c88,bbd1de98,454bc817,954654f0,5a4947a5,8a0ab994,3cd0a90,6c1d1f0c,3fb73d2a,49b9c0d1,a9bd35b2,99475dd7),
+S(4998795e,a7d80937,e4abee13,6c14585b,40b2dbbb,3fd3c80f,c8c61b45,cd1d59e8,8c817eab,e210398b,59b31660,267c099,baf29e4c,894e09d9,a50894b4,ebbe97f6),
+S(76c29921,eb3f3d12,5c11b906,3d1ac276,a205804b,b3e7484b,72ae0483,e4b3c517,48d8a8a5,fe658e1a,4d736bd1,8f07b5ad,28cbb775,d9388e7c,4fecd837,c8eb964e),
+S(78de8fb2,b15ff39a,487135a2,636bdcea,57bb3a14,efc329f5,a06bcefa,7ffeaf09,a55c9e98,5e1f529b,ba7ccb6d,3a5c00ce,28cb14f3,e9012d5f,9f66d8cd,5e45113d),
+S(71fb3464,b0600c08,7fe70906,2792a676,27830e50,a0bfb473,ec909530,30799282,fe036726,cb928a8a,8affed30,38977377,2a016e7b,1dbde8f3,6db810d7,cd423f36),
+S(f1f23de6,bf779cfc,d864dbc7,b46009cd,d2306b1d,cd0de2c3,65f3006e,565d9e21,84f5a011,74ff8e7c,c9a98f52,3f2980eb,4b013695,f6239016,9cc5a1d2,acd8193),
+S(f18909a5,a5db0daa,ece22ac7,12ae04ee,53484793,6fd8355f,9ff5ffcc,ab6ca78d,6306f08d,13ce2b0c,b60b3b8a,b0bd5f46,b3ef2a83,7edce51f,2cb5ce41,79f46344),
+S(7598d96b,189f476c,bcb1992d,9a38adcf,9d1b6ce9,6c87058e,24584514,a0df4770,7f288be1,b82da02c,a37f655b,d23643ba,bf3d5cff,3b6c2726,9ece7409,ed78bcd6),
+S(1e44193e,8223b57d,8fc68641,924cded8,3a04d806,cf9dc18b,7af06010,4e6216eb,45ea3ada,fd726fbe,2b1d6fd1,858ccc2d,57b237bb,bc2965ca,ebcd1b63,53c2f2e1),
+S(80954b78,4872286,8fe38891,2d76dfba,d676b4e7,7901e559,dd5983e4,e908f13b,6fe564cd,a0966639,e0237f29,46e92d29,4aee124f,cb33da53,974e8882,b0acf22f),
+S(6dd8a9a9,ad7196c1,3c36464a,5cb9fb41,aad8b0cc,423b99fa,a281c5d5,a6ce6ead,79a51469,8767adcf,ed287aa4,914eedc5,8382af71,5485c2aa,c3a77c4,efe2aafe),
+S(1895cc13,f99534a1,187a3d65,d1480669,f0d0c0bf,b42b2a9f,1a6392d8,7e1d2c6e,b7905afa,c0eb9b66,51de3583,2cfb9ac7,ae8d2355,1e334d59,32909de9,ed400a0c),
+S(f1efcb8a,86f94997,65b38fa5,8edced68,7737b8e9,49dc05f2,190b359d,9ed2c0a9,79b2c874,22de216b,904572b7,a39f320d,f53e392,8dd8e533,a1a28d93,fdd4945e),
+S(2944af80,c207d107,ce89fb90,ea6daa2a,c65c1360,503c36c5,ad798333,90432ce4,44b53d27,fd6730f2,33b8c29,f1256136,c637740,86e001a7,60bc1ff0,f8b6211a),
+S(938a1dff,117540c8,f6ee7df6,2d3c2cf3,31b38593,131527c3,9804c6d9,874752fb,4683d049,f096bc21,2e0dc20,a8600b8a,a02133d5,d0ae8d6c,b26e4694,ed6f2aa9),
+S(b1b3b2c9,54d1fb6e,98fcf939,efc18803,2f693989,81f19c32,f5e55b30,1f59eb16,423a6754,1a29bb01,95adfe15,c1df1c9d,81394e96,2bd1926c,cc789f5b,eef9ec29),
+S(52e23f2b,19048d43,b1725695,e3bdfc7a,f4ebd2bf,594f013b,b80d6d0c,ec10632f,258a6236,67090b8a,73881e39,746906f8,eabb6683,4bc3473e,1c6fa8b6,54641cdc),
+S(5799a463,cc817bfa,26bcc543,efe0e00b,ca9d2320,1989e854,620fc9b1,ffc14afe,645238d1,8c69338f,9c9395fa,5ef7c9b0,f62b7dc9,c4c6b9e,c545c850,95b6b7ad),
+S(1c493b52,3f5a4467,6268220a,58246228,608a603d,f6edb1c9,1a90b060,70b16069,8d311a45,5af92640,e9fe08f0,2981db57,3b22bf4,8fd5e76f,31c175be,23e24fd4),
+S(84f5a9c9,cda291c0,71aa9f8d,d7af5a8b,f2ee0dda,fb9139ed,fee08f0f,3f9cec2,df381327,16527be1,d86991a9,bc28966a,c3c6c081,4fc0def8,85e5d160,f59f4458),
+S(712c18a0,ae87e7e,87856c8b,ff6e3f6d,996ae157,970e754f,bba80bee,421fcde7,b2788ba,e69d34ba,eb5dfd62,830396df,3b8934a9,551c6070,ae8203c,ccc50ac9),
+S(a5104184,ee996a34,7122a460,cd2eba5a,11d04aaa,a47d2ede,25ea13fa,41ee01f4,f4b5f2b3,f7ec9061,7ab5f3cb,763233d0,afc8d4bf,fc535076,5dc5fd41,cc547ffc),
+S(79383075,a46a8eb,559ac95e,7dbeb9ee,51b6e906,27e55b9b,922473fd,5f2eb63a,243f56e9,84fd2673,58754a67,2bac56a7,9ae71a5d,68150740,8eaf8c2d,b55ef1a0),
+S(2b22635f,b83ab0d4,9b82edfa,a54d6234,8d3bee6f,edbe3315,9470b18a,96f97821,41d9f3a9,52f17182,ccf02725,b58ebd7a,1f37235,1fbb8f2c,15403890,e8b25b82),
+S(272fdefe,148ef7e6,957fb8a1,4a07f0ad,b17c27ea,49532547,5114c1f4,76170a0,789b8eb,5846e50b,d489bf66,cebd873f,7cf05619,3674e7d7,147ea691,6a9b8451),
+S(2c2da4c0,8a6e73c0,2efd6e7d,13006135,f09990a1,4c0a0eac,1f286108,f4a2a0e0,8011a521,d7fa0ab2,75765bcf,50dba163,9e89c9,300e8a25,31942cc3,fdade63d),
+S(19a9e5f,1c4cae30,797a98db,a24051a4,38ea755c,7b062094,a34ed6e8,8a8ff2cf,e199e398,157a50a1,56f9d6d,afed48cf,f3181411,77b792ca,c5881898,24f1b8dd),
+S(f7a4be3d,fc6579fb,43c5a960,890893a,f4026165,ed9e3ab2,e6929378,b63968b6,29221093,17dc39ea,de2d6fcf,c735ad2d,668fd047,2eefefa1,b6b225cc,2f3cb3ad),
+S(e5380fe8,575f26ad,b7924ae0,d58138d2,68112776,b11bd34b,3eb5e196,33f0e9aa,4680278c,6f784be2,a496ec9c,6db371fe,9046b1a2,b97ce71,3b45bec8,bf7d8a20),
+S(4c1b9866,ed9a7e9b,553973c6,c93b02bf,b62fb01,2edfb59d,d2712a5c,af92c541,3e086d2c,df4175f0,804348ac,31a91963,39ad1528,1bc14e52,8d3b0c01,39701c0f)},
+{S(5a13b9b2,5aa6944,1b0b5fb7,f7665dda,95aff48,e3250b4e,34cf8e28,87406c1c,245f250d,78fd66ef,24745e09,f067f16d,d400c387,66d2a1a9,af51e84f,733d0ba2),
+S(617b41c6,8534072f,2302290a,4956171e,902634bb,4356bd27,ab83a377,13d8ef6,c867779b,97383817,dfd0971f,64c09c71,7c468a5d,e1bb8ed0,feb98f5a,305d8e6a),
+S(ac118ae,ed46b08b,488202f6,96d9469a,e9af3cc7,ddc8eb71,44903a3c,ee43c654,f992fcea,8268ca6b,79f5ce69,c87dcfa8,42ea0345,d7c85a5e,a1b89f1c,9d0217aa),
+S(741dc47d,2e0d1424,3f2bd96d,9033d8c2,9008c1e3,66bfb5a1,1434f1cb,3d85310f,c3135d44,e86f574c,266f97d0,f0279dc7,52aee0ab,8e3ed78b,ee0fc646,c133000e),
+S(2e973138,f6cea9c0,5adfbb5f,49a7b928,5ae0c15d,120a8b1f,2d0c76ea,1fdcc7e,a05bc93e,68bc82da,7a7c7e38,95a647d8,7f724f20,c5b312b,738c6dee,90de771a),
+S(9d938d6a,cf56104b,5522351a,3c424e01,e4d21c33,771ca94c,f55357fc,fe51f91e,881d05fd,4658b08b,edf87396,be3fbb95,ec9f371d,79ff4586,6ddc803b,65ae763f),
+S(37a8ed2b,4085961b,84645ad9,8f2c901d,fe9a9a8b,4de8fc89,2cfbca5,c8909835,b1bdacde,94fdc3a8,78cd0eac,f8865d64,77e2cff5,efef834,97b93835,5b7b401a),
+S(da1ba954,899cb05,dae6fea2,dc8ddd7c,5ef9e91c,3455838c,a49d2858,ec217d66,14051c3a,12332d70,f8ad8ffa,567765fb,def69640,4291b81e,d3978bf4,51f788a0),
+S(92d2ef44,5a10dbc6,73f8c1e6,af093596,13bd1e3,c1b24705,bad2b3de,e8f11b81,adfed916,800d3e94,91a42c59,dd72e3ea,57d47081,b9afe668,f853cec2,c72cbab7),
+S(e62208bd,52620df8,91b3ddbf,e6cf0641,6059ce50,be3b00ce,14e7a53,6d1acb07,1fb71455,53b2f4c,431fd86f,c72d51af,5e2edb41,dd3f69a1,9a971371,d9679dc5),
+S(191fec47,a48ee268,35ed37ff,6758a80a,532f7011,ab099048,b024efbf,cde1d0ab,47b6389,b3f5534d,a632924d,5b65918d,f65c9c2a,2904ee95,4f24aeb8,c6a02557),
+S(60c822fe,a74d52b7,d5203720,b2c2a361,b7628aea,d2a683bd,80655636,bed15714,5d9a9c0,120211b2,e8285b77,8f8d4bc0,b06240d9,22944248,e1cfce73,826bb67d),
+S(f602da1c,788ea65b,cc339a38,c353bc08,1c43c2f2,6e05ea6d,ab52648f,890c9101,21468929,89348f8c,67cfdeda,31ef3429,23b5a450,9fbe9a49,f011d42e,57f998e6),
+S(756240c0,5274101b,3059d23c,76d9ecdf,33e1312b,7a36af,ea21e6a6,c52cdbb5,ab24e853,900c7ff1,3e4f813d,a2acdd5f,53ce1710,b785ffbd,e74494ab,43e583ee),
+S(8e815b45,7adf482e,e30e475a,4949e5ae,c7ff494a,a918f07f,c39441e2,360d112c,a966f04,2dd9edb9,436b0005,7473aa66,dd19b4d2,cbb3bd95,932ba98e,f1a1f406),
+S(216d5970,36c661f2,cf6122c0,a136cc33,9660306f,1c190ee5,5f3bf438,e7189261,5bd23797,c6753eee,6fb934bf,dc897ec1,25b31c9b,9e797ef1,56d8cdda,2ec1d128),
+S(a30ed06e,ce34d29,a92fdeef,6954b5ed,4065d592,3af09be4,f0ad4a73,e7c24346,f6aea418,6b38c188,b84fb6f4,2b6559be,f52dc13e,b7ddeccb,6e85a76a,8d4efeaa),
+S(aa42d20d,8acf7c47,fe40ac15,3fcaf1ac,6c4ecc37,dfa39c39,fe5c7657,c78444d5,bc3becdf,464ce930,e42a05b2,c52d3589,fd45ff37,c7d1767e,f8462811,89634059),
+S(7585f8cb,4812e306,de02393c,c06e9871,1953133c,bcb67ec5,c6a79228,69124ff5,c242853d,1a2c1c9,a1cd1b5b,364888fd,28bb23c1,2b0e169,67961b3,e7c8b95b),
+S(b096a1aa,fb969483,185ba1fb,a5fa3f3a,d1da87dc,a10344a4,d74ef471,45cc45ce,edbc9490,23801861,44ee39a5,7bdec0a,230df57a,72649e04,c4c99883,a147f0f),
+S(7034d8cf,df226df1,6b310628,35dc02c9,f3e3f91a,635ad93c,46be292d,56c0ec2d,f783b6e8,29447cf2,32769a13,7ff33f82,f9fb166a,aec8c3ad,1679c48,c1a913a0),
+S(9f88b01b,b936defd,f61156a,b55ca290,cf282a2f,3718b0cc,2d32dd3c,49248b4f,c24ebc35,27052f77,41087cb0,e772ce12,1035042e,603f1301,e19cee0d,30029230),
+S(14443190,51f05d23,343367e9,6add133d,fcb63209,2f218847,59ad81ba,c65e7445,745216d2,d11f2556,7e3b224b,6dce478c,bb988b96,a1240093,964e4ba6,f3b15554),
+S(54aa2e02,3038fd83,f17a633f,d9ab441f,e039dd0c,57f9368,3da013f1,751c6813,f4d163ac,a9af3e08,c009b44c,b358ebaf,31aacc5e,e0bdb917,d1b4df5,420d2d34),
+S(fd44e742,b04ca4df,693e3109,3ec52ad6,1f67264e,100618e5,88d638d6,d96efa41,7ac09cb1,2134a246,b17ce054,b38f3bb7,7d794f9b,2fca3786,a0ba665d,3eb0f14e),
+S(f662f214,10cf6e6b,7f79fca8,7ea3925,6760d83,17478419,ff4671f0,2bd2ab6c,be4ad0b7,a56c87a4,8fbc166b,da8473ba,6518385d,bd004b5d,c85126bf,7b9309bb),
+S(520e2755,1cd804d2,67f9b4ca,b3986952,612bb099,cbd3f3be,a54f505e,bba4db64,e3c75cd2,c831c539,b095ac18,3bb13a72,ba7cb152,5b9c214c,288509a3,98a9cc3b),
+S(4d16fa3,2d74de13,111b3f22,c4133ea5,377921ba,e54af1d,666d6e9f,b01e117d,a63bdf75,78d73f03,75aed657,fbb8675,67230c3f,868f2cf7,b7275ec8,b02ac46f),
+S(ab928c61,ad1c2f68,905b9e95,3c2629ad,9bb7c8cf,ad9f5a4b,35b35fad,69a92568,bf39ec2f,6c1ae222,ff383375,6bd83882,c05be6ae,692539a4,5124b972,e72159ee),
+S(8731aaa4,93580732,66b96577,7bc24a46,17fb8363,51c5ad8f,c8bc053e,802dd07d,36957f16,1020430f,69a3b1c3,1a6df993,d9ca8e2a,8f487b7f,b2ccd44c,7f528ce9),
+S(3514d41e,8b9388e4,33d1155c,c777c398,22ab36c6,3c2aaad7,ce674831,21231d11,7657cdaf,e9fe8147,10bb2ee1,a97c6100,6c7b0ce2,f5086141,ac2904be,1c7a9e3a),
+S(9bb8a13,2dcad2f2,c8731a0b,37cbcafd,b3b2dd82,4f23cd3e,7f64eae,9ad1b1f7,6ba44d4d,50111c46,490622d7,b079c17a,f0ab57bf,b8ad2ac,9becf9d7,3c7edfaf)},
+{S(e60e88f1,dc24f079,f835b687,778307af,83446e,71809086,e6dac0db,9f191de4,25a0b86e,ff05c849,d79a176,1a634d82,29d2a759,fbd003c,b6ca4147,85726362),
+S(55a5e6cd,c9e11103,749d469,dae84a88,9e744dd5,d9309762,15050a83,fef66fe,31278ace,a971a41,e2f9fb16,8e80ec03,37009cd5,b0a49938,c28c902c,a7c71fd2),
+S(5f25326d,e99a7c5a,d81bf2ea,61a9195d,48832bfa,8caa9777,53e483f2,b5a62580,40b69a1b,baa2d0d1,5cb78a3d,3d184c08,5b4c16d2,90751ec9,bf3eb3c1,d3ec2ab5),
+S(1a32cc7a,f88976b6,cbc89865,89e685ac,49381a29,1579bd2a,13f9488,c0333d19,4667a3e2,2048f781,11f009ae,5d7b1b97,850a3a5b,86f77880,b128c8c6,a9720acc),
+S(1d78e74c,66247be9,352c9797,5fbc1299,743f9c74,68c64d1,f2d8affd,1b098769,37adf553,fa2a11e2,6913ab02,e59c4f2a,48133fe7,d9aa3c24,a76e9af9,48a29d8f),
+S(8bb6f83f,6be5c2e2,b2bb265a,9bb3c931,bd5cce6a,48efccdf,daa040da,535dbc86,eb96a982,23278b81,6284fee7,b5b8a121,7350cdba,d56b6078,89602bba,bc003481),
+S(a9f19ca8,1d2ebafc,4bb5d881,76bce19a,d2d2564e,185f905b,8f9eeca5,d6b12d6b,ab23a468,3279a9f8,e2e8f880,e0accbba,844bd4e9,4d3e4b43,74db2b55,d998771e),
+S(19680305,c887467a,c3bfe44a,dbe65431,7323d8e5,62271e25,1a794b78,618befcc,48e9303a,3d6371f7,cf0a904c,cf16f606,b0007583,87ae0952,c6119521,dde25532),
+S(18b3bd03,ed4696c4,7c3f896e,5df7481d,6f19a5ef,53d62ff8,2948f1b2,154175c,85fb04fd,6573a19f,2c136753,a1ca2585,d39dd64e,6e6e3fa5,fba362b4,ae9dad36),
+S(38e3bee1,3cc3e18,a57aef97,4ffee58a,a392c311,14ac8baa,1376b56d,f8ac017e,8596c7f9,8abf3e44,4ab5491b,fe659619,f6defb58,f48e2b7b,57842193,cd48fb5c),
+S(dba5da08,8cd17c33,3e892bcc,46261694,d2ff3a22,2a26f92c,17c5e1e2,797b235f,ebc15bfc,5729e986,85a19afb,d7f9a219,e60d2784,e9b283cd,3697f782,630fe222),
+S(60456426,caea7fc4,48970eea,fab9c632,3e66fcee,50f92630,7b130937,25b85ee8,dd22df89,c5dae339,49459593,1433f2f6,5f719379,68e56f92,a38d1290,17881924),
+S(f1ceac82,15670212,279f36e,f0c8ce28,3a192f66,460e4875,d90b2f51,a38f5712,ec11f026,c76c271e,fabd7d55,c8488d99,3298f6ff,c05ad4a1,26be9447,7d878b9e),
+S(2c2fb5de,5dea249a,7bf6b196,8bdec8d6,1838da2c,12147045,18d6494,f09e50e,6c0d020a,d6bfd730,5ee73634,e939ac89,ca2b7d4f,dcbe760c,2d14ade2,659a5b8c),
+S(2858ea8c,d40ce264,3c9a305,c0e2c758,af5b0b4d,5c57ed21,60cf7ec4,154ffdc2,33586bf,a61a3cde,4f402bea,123c69e2,2410c0e,590a71d8,9a1e8130,85cbb579),
+S(2749a250,4e7cefa3,a3647088,6bec22fa,339fec0d,ec63c02,19e6af39,7fdec3e0,d3415104,a9070af8,b61acdf0,77954d37,57fcf742,a006129a,5c0d3529,3aa95407),
+S(8edf3ad8,39e661b5,f7f16a85,dce3caf5,d571acf4,d0c6195c,53b618e,5311ac65,fca0efba,35a14d3a,9944367e,db4ac982,7dcb7aa0,12438c5b,aa5627c4,c4a15ed1),
+S(dbb92358,8b083294,5d6d3b62,9cced57d,7085d3e2,d0890bde,95d80400,98c22745,42816661,5515429a,aa023737,5fb77804,624546f2,1f0a34ac,1ed4e4ee,dceddccd),
+S(aaca9896,6196ce2,e13df3c7,d058a5e5,10566df0,5fefc04e,51f9dd,85a4349d,be389d02,789548e0,aaf67c57,3b91b389,c7e6ed80,ca3e637a,2a147262,80cd5620),
+S(104804ab,e621b098,61fc540f,f4d6be9a,750e3cfb,706170db,e34c06ed,e0a431ea,14b700ed,a465915a,eff84ab9,fa568535,f63e4f44,1387ab4b,d841072d,97739071),
+S(b2215070,a8ea71f9,b71f1a73,d6ce366,c322b8ac,4d135b3d,ccea68e5,a51f1c0f,9e415cce,3bcc4e62,6f3c8caf,fd632eea,862a046e,bb45e8bc,84fc05a7,a4b87e00),
+S(600c6e28,be5ebd28,d83e6c86,bbbd9b0b,aca22006,42234634,6124133f,3348e6f7,822b1816,79e253db,a47ddd76,c0023991,5c0c0206,8f422415,94ac38b8,ff7994fc),
+S(f8b9b45f,c6298dc7,13355bf1,3ee33ca9,c4c1aace,c09776e2,56b3746d,ccae0dc,bf4b7f96,1844aa2c,6ed8c8a5,6626386d,174e77fb,98c0c23e,e2b6de90,3f1f79cd),
+S(63987b18,67fe5a17,333eef28,5385a0a6,576163e,2c74cd00,ba87b6fc,96a57faa,23ce6655,51d48ca3,c702a5be,87a05d98,b5aa1097,dd5877e8,11e32d76,4873e6cc),
+S(2eb06c4f,5ea9ad2b,124a1202,cb13c1ae,aec4394f,4af7c96,d6a9ecba,540ee04d,b96173dc,77b46ef0,6f4141ec,96ce8d1,4adfcfde,f0bd7ea2,479ba6d7,522d037f),
+S(5db39904,153002b3,1498bb01,16efd0b5,838e3495,62d9428c,912987f1,3aae5ae,2115b896,479d0d0f,75ffcb54,ff9e3f73,d1356ff1,4b14292c,6bfe8d54,e9e08861),
+S(c0f14110,7f324ffc,f3d3e6c,78d5a628,6000d57d,7e85bc7c,fda15f75,79cef3ed,6eb03650,c8142b12,b330b96b,81214a4d,d01b068a,74827611,53d2c52e,e1315ce5),
+S(7e3d1510,ed767345,bbb3515b,6f9819bf,33ed9dea,fab35d01,a7284cc2,371b0e66,4c6b3aca,5159023b,d43ec0b2,57e77e87,e5a6b745,178bb017,9960c89,361fd97),
+S(f98b5dbc,3e54c227,b002f458,94850ff4,3b15b2d6,1607851c,50d1e4d1,8b20907d,1d2af742,b0b5ec05,bd6c648f,94563361,be03261f,da56f1ca,7caece63,a336d580),
+S(188ef3bf,ab103784,37e1859a,7d53e899,6124c395,ca422c05,d6b21b3c,efc76ac1,19036685,fad04566,2ffa04e7,30c671c7,1b299217,c389c78a,cae9fcd4,ad70fb73),
+S(b89070ae,96ead4dc,49be16f6,a1a30bc2,41b4e98b,c18d0227,4c9d9d87,dcbf00eb,90db373d,375d2770,b8dd6b1b,3e3b5899,34f274f9,49469598,e480e431,e4f195e1),
+S(381c4ad7,a7a97bfd,a61c6031,c118495f,c4ea4bc0,8f6766d6,76bee908,47d297fd,6c950ac4,dc71111b,70c1a058,f66ea133,fbaefcd,246c63ff,6c531ce6,82b6bc6a)},
+{S(704a26e5,19071bb0,24eb2a16,48b66a6e,157b07a5,52fc4258,381f7d02,e8fd9b9e,d169ea55,8650aa3b,ce52c645,278422a3,69326e74,46039381,920f5857,fa3492fa),
+S(705063f5,e481735,60afe9dd,5b2beeda,d6e46391,75ad7fb6,f73350df,51edf53c,32290956,61cacec9,472dd014,bda52364,3399d7cd,9ce2bb31,a5b23590,22c6ee5c),
+S(972e7585,f8b1725f,4a7d18e7,77939aa6,3600a7b,a07c4d94,5da9511e,889473f5,aae4382a,49b4c97a,bc3edb7d,26ba7bad,16752047,dc99b434,f306c673,2851310b),
+S(260530bb,e338f4a9,71930b12,4f18c82d,e33f22d7,32de9375,81e2b0d5,15e59d97,77c66c36,d6b09205,8ade9c0c,a311b60,a705c8c8,73fd2d4,8e6327cb,71eefd4a),
+S(15464351,d21d2513,f792ee32,aca3eca7,a52cdaaf,9862172a,e7224a03,804581dd,d9ee19f4,502f1c44,f656ad4e,add6adbb,d8a04f5e,5344b554,894721eb,8e3e2285),
+S(4fcc68a3,caf3ff91,dcce9770,11ad5157,6c844132,321791ca,a652593f,6cafcd04,e8db3aea,a35371bf,9700a9bf,b85e90b3,93cc088,9cd655e3,fb18635b,49fb59eb),
+S(301c65ad,567952dc,6b39134e,c361030b,3f5203ed,da89784b,225548ec,45c75eee,95e2c0bc,7b4a7cde,8ce3dace,a691bafb,f78fb03f,3170b347,ee807f42,6b947560),
+S(96ca5edd,8047ec6f,b5f8c37c,a734533d,13f0e6e7,f55d28,b8b10b5,121f4abe,1a21f1ba,f6a2e336,247f6ee0,88cca9ff,816b0667,3badc241,d9ed00fc,d2070f1f),
+S(c94633f5,783c4e68,12143fc4,6e670978,8e8a526,819afea9,404dfa00,df1bd839,874f8760,33dba9,de463f86,b597219a,c1ea37f3,970bdadf,97c96c48,feec4ec5),
+S(963146d4,5bdaa05a,b5115ac2,3ee862a0,2305ba9c,75003f4e,ab838f7,e9adcdfa,d75766de,299e5cf3,c8796234,5db9866c,cf011c5c,f108a794,5642a6b9,dd33eb0f),
+S(dde8c870,ec4e9890,2a820a7b,c5784034,19ac261e,de5afd0b,82b8c5a0,7c2863df,e7833936,50d4af7,427158e4,6c753ac1,a5143c9b,c09de97b,3b27065,6f622b82),
+S(546c6b00,c5e34a8c,4cc7255c,2edea33,d9f77e7a,c67ee629,bbdf1879,4622265e,5ae149da,f65aba8d,e214fa63,be9bbf11,3dd3c220,12d206bd,d56026e7,4a019897),
+S(4340c850,d91b63fd,bdaf41bc,f8d8c010,d3f30eb5,79eeefc9,e67c127a,33324071,dd66033e,eb5ae8b3,3c47a940,2482bcdd,4db5c8e,dda3b422,35627434,dc3bad1f),
+S(f796431f,679d9cb5,77bce62d,236d1fe9,b5042a83,fdd1cf94,1a2e00c0,5a261d11,718fffe7,68aa2591,d3fb1fd6,1a00537,3b529f9d,f9c27f79,31ad0df9,9aa74859),
+S(f3d17ae9,d5b4cf41,27423894,916318bc,adfb5a9a,6c2ca219,1b918e43,eb5ed129,9da6d033,49c64d79,7ad09a33,bf71cf87,8e0ae6a7,9fa7bc3f,1451126,18415960),
+S(23899a73,a4b52d27,29ab52a8,370ceef8,4c7684c,cd535f4a,ec360eab,cfa5a787,f1bcde3c,5c4740c7,37b066b3,8a1a88fa,c43357f7,f3fa23a7,b00815a3,85336320),
+S(5805914f,5418971b,106305cf,c397dc12,f63a3b2d,8b451e5d,c1b60c2e,3d9e9208,616e2764,67a5f1b6,46279ee9,6e8645f3,76a80192,31e17a5,c92e26ec,1b76e62b),
+S(85ffc326,1991848b,5e918c4a,53f291a8,31796b52,d56a5c38,8bebe625,d78cd07e,95fd6f12,7b155e6f,806c089f,3f5abe95,344e9014,e2c72fdb,e720bb8a,93d864a6),
+S(6f1a57d0,6566bf81,f4b16329,19f477ef,aab4f829,e29dda4b,27627b96,1cbfe3eb,de1e8359,7ff20c63,3d28b909,caef273a,a57898f1,a797fd91,e00e2e7,da1872f4),
+S(3d28eba0,4d0ae2f6,208adc71,cd6af3b0,e208860c,722903ab,e106feb0,af3185e9,cf8bad18,40d3d2b4,abfb5b28,b50702dc,512527d9,5bcd403d,9713ec7b,ef1dda13),
+S(46511979,2b845113,1b32663e,baa14c4,20a5408c,1f53afb2,43cd496e,c4b18118,40bd602b,d740096e,842b40fd,8304ee73,842b074e,415d5ac,c5e2243,28b241f9),
+S(393a8bb8,7ffe4265,51678524,8ac940c6,4aa70e71,512ebbc2,3485596c,a6d9da5,25773032,d2c1f80b,3954715a,6e4132a1,74b4468e,658f6cc,4d5f5d63,d458980b),
+S(aeb37eed,35274696,2b85a21c,86b9fe34,60433606,9ae4ce6e,3a8235a5,e43c48ad,d94165e1,5372330a,7b5507f0,377a966a,541b6fcb,949398c8,dd6d6f52,2411d86d),
+S(b0bbb4d3,100ce417,dec58f46,95ed8b30,4306f21f,ee11f899,585fb37e,a9905c59,89141fcc,9344e617,7742e31c,42c565d0,45c7ccb8,6f88df7c,5c36d23e,45e51d75),
+S(49694de7,330b4c3,1431d452,f3e9e562,eddfe029,1cce58c,73b69cdc,b89e0f49,4715ea3,b6fdccf8,e224b93a,ffdfd1ac,ad8baf44,c5bce735,e7c9b4ef,3faa2656),
+S(9a7720b3,ff0363dd,7263e1ad,83c32526,67b67d3b,72c2c14c,95f0804a,dd20f7a8,815a769c,494824a,a819ea,54b560ed,e1df9bca,d7df2d63,aae69c4,a02f9f20),
+S(b89c399f,cdb3aacf,99796fd0,95c17cc9,786d79b4,9a1a255d,5c9ee510,38d3620e,ee3c4936,d4f9d1f9,d2642043,d25b21a1,aa32fa3e,ef44f409,73db47a,96965cdc),
+S(add68bac,d7180ac1,4e9bbc5d,1e0c3911,f2202d90,1f9ba649,46b06507,b86ed5e9,fcffc13e,a9be67be,8d090a77,9fd9107b,f62bc785,3f98e97a,c0358b3b,7719944d),
+S(9bf62cdc,cdabe928,c1ab44ce,38cd0611,135971ed,81ce6c6f,dfc5eb5b,d9c3996f,885b2381,e0e785d3,cc3f78c7,f9fd54b,ecdd9d9f,c2979e23,f97e9bd2,a4f10d3c),
+S(bb223cee,f11450d5,c5e0b75d,20eb44be,9d44dcff,28574117,12fc5875,3b839339,8bb29985,87eb6f5c,c8cb615,285d9e69,71db8e31,8d81fd5d,6318909b,8311a00b),
+S(9ed73f09,2263e84c,d022388e,da82361b,445f573d,b646cc62,fa0bf5c5,1d33fd27,49ce7698,144e1115,118a4b0c,bdb98dab,6b57dc1a,4d1bb6cb,a68d4d20,d8e937d7),
+S(e747333f,d75d5175,5a0cc9f0,a7287084,65a02c58,7737a7b8,b8fa1b8b,4bb2629a,d5001fe,baf8f3ee,b33bc9fc,7fb3da7e,377c8955,91e56965,607269e4,96b90559)},
+{S(516ea742,3f956765,a15f856,182f1e7c,18d3e548,b9fdca94,ea46024a,1a8fcbc0,cfddd98f,be500604,28beb901,92c01282,aaf9ed93,76f0e26b,e912ac42,a378d542),
+S(8ed072cb,13eb90c9,e5c107f6,ba576a87,ac75a431,53025e6a,86addb95,bba7862f,eece8a5a,f28d356b,f1a84c14,2549ae7f,894f7c07,305194f3,18e30e0c,873fb5b0),
+S(3e0e488b,1c8acc24,f81bfa1a,f6761afd,b4fa5f5e,6317ba72,bfba2f07,6c2ff593,2c4ec39b,2f37b948,fdbc9e3b,a3fa82c0,dcfde2e2,57830a04,4c178759,ef5bbc8b),
+S(f6b3f19f,cd7eac5a,13630ad1,bbf331b9,5608b7a0,ceaa67e2,4a1e830b,5eed9825,a2a64078,19ba0f7e,7a890df9,523c6736,50ad08d5,c2557cd1,53c6ee65,ef493ce5),
+S(e2de599a,879285ad,398b1031,8e1a8387,21a5c4f7,1105469e,affc8e37,189548a,dd977e62,3dc05cd6,3155a71d,d87d91d1,d74d6e31,5f73434b,679b605d,9db264df),
+S(bc52359,683840a8,59fc2c8e,22d72ec5,da2493a4,bb5073a7,f658517a,de83f867,76a13651,712ff42e,a0c10f09,45c4ce41,2cc8c4f2,ac3ae446,7cb383c8,656d3186),
+S(d87e2b08,154e38c0,13847a5a,2f84c276,dc088b6f,c19a9bf3,90a8a433,fa937fda,d91447f,7c9042e4,6f64a9c6,40a5c294,1a6f08f5,d3eed464,b09b2a1,1c402c0c),
+S(4359ac5c,5dd70bf1,d4f24f00,1301b9f6,17d9c69b,63350dad,9a8cd192,655ea801,c9e14f94,d8ec39aa,46092657,5d770426,350794a4,b1ef2410,a9b0118c,ac5d55c1),
+S(3ab3f503,29e22bf6,8fe9882b,3b4dc989,36dfd840,be6af588,ab6d61de,48094b9e,4a40c435,9f4dd21b,11664095,4b55e6b9,f0308786,eec32fca,6bcdd5d5,8d055ac6),
+S(a0f1ac27,d046d987,b9a98bf3,f770205,931fce93,59b75944,6494d221,dc2752b2,bf1bfdc6,47a15997,97b5b6cf,2d8a2a44,e9c36b9a,20b53abe,58ce9e0a,395fab70),
+S(a9aa63ed,3b0260d2,b35b030c,7a5511c8,679b6170,b8a4f386,fae0bfa8,92735905,2f654620,4dba9b31,99bd648c,cb1605f7,62f312d1,67123d98,ed66f02e,4d794e90),
+S(e51da157,5e566ef3,bad3fa66,e55432e1,29be6c36,32e390c0,f4d76719,bae34b7b,55930b79,2ffc91de,674820b1,eec290d7,74ecd79d,1ca07d6f,5ea2f817,4759984e),
+S(8b69a891,b417ea65,7ba52bae,58920eb7,f101bb92,e150dc1b,c961c37e,73cd18b7,5b824edb,f4a68988,39de0d70,ec16ee1c,a01a4692,f29263e1,1069aec8,6b149214),
+S(ee5c1186,77462649,6d37fba,e48e797,dc69f31c,d6ad22cc,937c7224,ef7ce8db,13f7987c,f2cc4551,e058d410,3d5c24d5,13c2d602,ddccadae,fddcab82,d14d5310),
+S(b961cb45,5de8b5b6,c4c5c2d5,75303c81,35b5d278,503a15d2,371b0551,5b236b,3ed18486,5ca969ba,31c734a,19055129,1cd664be,576925a3,2a142769,4fc40df2),
+S(83effa4,c127b5ad,7a0c53df,5be5596b,d4a42987,2eafd8f1,5498a6d2,47b87314,efa99759,c9360b14,7643de2d,64ad07ea,39cfabe0,2bc94e00,dc9b2e70,c2e2c217),
+S(f253fc52,4fb0254e,e772f50e,5d6c16d8,48692455,c855d4be,15ea9f9e,9a5411dc,59bd1f8,2cece609,8a63fa1d,48e4166a,d79174ec,5f8216c3,16c48c1f,e5c9a0d7),
+S(6b61024e,e6451d97,1446b55,1476c3ec,eb6b19ec,16155acd,317bc2be,11086411,8de5c6e,37b562da,ca5a203e,ea028b76,e6befaff,e54b49d2,6605f169,592242cd),
+S(1691a90b,9cf72621,3680a72d,af59ef24,985448ff,5f35372a,ab6e2aef,df8b33e5,83d2032b,6ca761d1,286c1348,31250054,5a230558,cba391e6,f0db9c9f,97c2d618),
+S(42a078dd,cf749f25,aec7a1f2,8e976f79,e268c36,a7b5b0cd,6aaee3e0,925746ea,c60f1846,6f025987,e0ea6ca0,3eb98df6,99389753,b57abbf4,f5739509,bfd09d1e),
+S(21bfc1a7,16b09543,5142c31e,5038d4ea,4643d9c3,2fd4728d,1374dba8,1ca1f07a,a991d491,2601ca23,8e289e71,e9d743da,4385aed6,c732f808,6dc21406,74540acb),
+S(e75223e8,fe247a98,5220cbfe,52151978,c98d1460,746f8de2,8696d235,71f3336b,dbbb8075,ab489582,52472982,c7b0c3bb,d82a0762,36c07c05,44417ff3,883f6f18),
+S(7a756a,72fee88c,7a2758a5,3294da85,6b06129c,1978e217,2bc7952c,92b05265,c4ad3a0d,be72fd27,bfa475d0,fbd16a92,5e939362,bc0748c,c39ba9f0,3ad84133),
+S(2bc697fa,d947fd62,63bb2841,1a274520,f5d582f6,7f039114,293438fc,9aad7c82,543109b9,82097efc,cb44d854,11fc5230,6c7a219f,2f58b37e,3dd354a8,2ffb28ad),
+S(3862db95,1ed8994b,a8cc0178,f6dc97ef,db6e1380,c18719ab,cd24a88c,87039744,af1e8ac9,2b195d3,6fe1b1be,a68e9215,a453e638,67e65d88,64a8baf3,ff5c1267),
+S(7b648cfa,40ce7274,59a6fae2,2836ea1d,b18ada4,9b18a61d,748127f7,7ceee771,f2a30c56,42887135,30124a69,da2c0355,8688bac3,dae6d95f,a252855,a85a9b4f),
+S(f803d7c6,1820f980,ebe0b297,87aa688c,ddadefca,229b99b3,a6bde5e9,922f94d2,a5f8b450,34dc7de1,461dfb74,e7ed9c49,80407bf0,4b0d9159,af703a9e,1e0f9c61),
+S(2247f630,9be2f3aa,e30c5907,c29095d4,b9198d25,1a17bb34,7cf5cb35,a2ecb1f1,82685964,20d87b07,1c5a4044,b79b069f,7fa6ecf2,cfc0f839,b2161475,5728c2f1),
+S(1d770ace,ceb2183,fea7c924,a8fba197,579df37a,908992be,d42c8e80,8bd98ee1,d87077fa,b910a21,8769cfc7,49aad579,c809e35b,f1c2a813,6047e85,e2c6fc65),
+S(5d134e5c,5da47f7b,a495f216,b4994d90,4a79057a,3d0076be,34f09013,99f1f366,fc4e10b2,c1f7bafb,d241d5b5,1c57d48c,30fd29e9,df5774c6,1d4f2c15,3b66ed03),
+S(a49ed10e,aaab9323,3a5f485d,4bd18c06,28ab2629,f0b8c3db,4d05956d,6c953fa9,338d476b,99f0ac67,1fcb893f,5f202204,a5178acb,6971e7e4,984d42dc,b904afbd),
+S(4d000b62,1adb87e1,c53261af,9db2e179,141ecae0,b331a187,aa4040a,ee752b08,95f2a470,e71f2daa,34927daa,7d268d33,34820a0e,e638d6c5,c18d7adf,b7cfcf45)},
+{S(44d42980,eb92b3e3,b16816f5,56858355,e031b88c,99117385,def6599e,f274e56f,6e3de5ba,4f693fdc,747caacd,b2cf0107,f29fa7c,9c6a1a09,a527cd16,4c2c1484),
+S(9812d508,d6da303,6f08fa7b,54cae319,232f925d,6af91d71,fe6c2fb3,bc86be5,735081a0,35fc17f6,7547b9b8,f0f91ac7,f0ddb965,19f6f398,dea745a9,81441e2c),
+S(5a022ba,a90ddc87,42246783,4f692ecf,dd2c2dcf,b054308f,4afeb17a,7ff6ddcf,6fc2a9a5,4c7a130d,fd26ca48,82406fb9,f67db0ab,7e6a6d95,1675fef,2e2d4256),
+S(c181ffeb,a8ea7d69,c524cd42,18af3030,1cac8e97,69eaf6f6,ba73027d,30fb7bd6,e88959e5,b07b7d3e,693756a,f94590bf,997763b,afa7d850,a80dd9fb,88e6e904),
+S(e29375b8,21c056c,30954b81,4f9ce795,c1493dfb,ebf06f6f,f32c92c8,c74839f1,a9040ad0,95c9d45b,1527c624,bac86841,a1f28b7,ccf8dd37,b7e950b4,858e6e18),
+S(69445948,ebec5ae3,9fcb505d,7efb7902,6bc1e8fd,5d3024ac,2b772439,72142d80,5b6c2694,abac3938,db899396,62635c21,e64fe2aa,40d18678,9c246e9,fe3f4be6),
+S(a86f3aad,85d0bbb3,8270956f,58c2fd65,f5425428,27d7a658,da1b111f,64c02c36,dec740b0,ee35208c,dbec5b7f,69bb94f0,7fccd075,7868a37,6ecec7b6,dcbe20e0),
+S(ba2bf65f,aac92da5,6c252b50,8dd74e3e,99ace1bc,42b9d2db,9d0ead3d,b6820306,37bcd01a,75027b42,eb0d7b85,564bedf9,67153930,6fc97106,ab6623e9,90b031ba),
+S(78419e61,4e8b5eb9,d09e0c09,79ce4eaa,26271696,fcc68269,4cddf1d9,6a4c7fa,a32dbb3b,46f9b6b4,9adf4dde,f1986af9,72662a6,2ed6b6a2,f8b920b6,82b32363),
+S(71163271,204207c8,a84b5993,88beb505,640898ab,b24c4c10,42195dd8,15d77985,aab43609,9370f246,7035ddc2,e71d73f3,c0f1aa13,148303bd,840459da,ae307e8d),
+S(473f52a1,fb7c3920,f09ba6e0,a3c891c3,3f4a13cd,9dbf51f0,f3d39ef2,d6bc07d0,b2c403d2,4aef71eb,1b834df2,8bc08b67,5130897f,a6d9855a,eb21ccf2,780444cc),
+S(581e93b2,99b8c50e,e6338c0f,f426502a,d8699563,f17935dd,abe08a73,6932b71f,46e7c7c5,1e076fd8,9b8aa98c,f0b3933b,8ca82cc4,d21783a4,d74ae1b6,ca9896e6),
+S(e65d9e24,e7340122,875a9d86,d6071a48,691ed5e5,a94b315c,76f169f7,f3d69c48,73575103,a70b7a59,90d9b880,8698b651,271c8c0c,ac93122a,66873bf1,fa3c6fab),
+S(cceab216,41d0597,f9c7ab64,7f99154c,b22d4827,70395d6f,ddd6db5a,dc752825,4084c57d,5aafc328,e7a250d0,a7c3c0a9,627ddd70,c77c2be7,e5a1af34,359b9b86),
+S(4222ee66,5baff421,17f47df5,c1c1df5a,dbafb790,d5c75bb7,2646cf85,7ae85923,43088d6c,a029903f,f5a789f8,16730345,5a5cd0af,cab57e15,12781396,fcc9b6da),
+S(391c5d0b,17a8c11,3440cd30,83434841,969b0833,71758b30,27e38a25,e778da6a,69f3d295,be55f859,4bbb2fb4,116de5d0,b24b5a80,ed62c1e2,8fca9b8,3f6d7439),
+S(803b7149,f87e86c0,13599898,b0c9050c,d4a6e030,e07e8d7c,a49c46a3,8a6ea6a1,6b367fcc,6d5916e,72f670a6,5ada9c39,54800e90,a8830fad,c9ea17c0,494cd9aa),
+S(f7aa1c64,f8f92f20,1319f316,353d89bb,eaa4d65a,e148b01f,ab66aff6,c9deb179,e9b407d9,4c2b385a,74f22eba,93dc35e9,bebca7d5,17401b7b,576b7d2b,e13ff0c0),
+S(f1c34d52,2b7493ec,cefd49da,99732e00,85ace2c9,fd14e9b0,69b67dcd,5acd5e23,29460fc7,dd77494e,a5a7764c,7ca6db5d,5d7a5e3f,65e865b9,e5f85d58,e77713e9),
+S(db19a1f6,38ef7034,5340e3df,8d384944,7500640d,cdbc3be4,df3b191c,edb9db87,baac873,a76e0b91,c4847770,9dbe88e9,6195e9c4,ac4d7749,71ca204d,4a5e748b),
+S(4ad12e00,f384c7f6,ea669c71,3649da6,55e0abec,67551a58,224b9f9d,de6bdaf9,2e0314a,8e3f32da,33a22ecf,ccac4965,1f1f6f5,20baeddf,39a02bd8,423cd40c),
+S(c9130b88,cd451d4f,6eafffc8,357ba391,ae920c27,69e7c48b,49881070,fd088ad5,aac7c2f,4f2f8b90,bea9267,897e0079,7d6515e1,937fa4fb,1043111,6b5e1de),
+S(88260ca,df81b391,be79bde7,b54f8a98,428aeacf,970cd843,d683e6e9,50686db9,3b9b187a,b998a22b,56b2933c,fcd09333,9c23889d,1180e365,10dc086,9869cf2c),
+S(3984fce2,ab73c70f,a5538206,c2a61e60,2f160b1d,2eb61980,fe174cbe,fe464dac,b7e65c1a,46b50c72,621e3fc8,4f4c7cf3,6860567f,abf00743,5fd1b13f,7400326a),
+S(e6b48495,c8277598,23b73f35,762c55fd,8cd20420,fe5be6ad,f27f12b0,68bdd63c,ccbb7124,3b0300fd,993dc9d3,4b55534a,12515243,e07ab78a,8d8fd528,46e5a69b),
+S(6af5144f,342f492f,3f506ee7,fc515d3d,d3c93d02,27ba841d,74bc6548,97d4830e,b195d9e0,8113eeaf,fab92a2,81ddeaa0,95356053,a51cf84a,b5d60fec,5368f98),
+S(14439b7f,e40ca407,374da12e,217edd9a,86c84397,e2fcf6fc,965023,ba984a1f,112ad656,47c47c30,f19ae62,e0c06b35,effd49bf,d5e604d,6d621471,9f088fee),
+S(d4a7e4b3,863fece9,660baefc,ee57d09f,6f60cd25,f4aa178c,cb6f8a17,5fda9d4f,4985a973,ab0e8627,f6de7ef4,470de4c7,1adecaf9,f3766197,a86f4e40,14ea474c),
+S(facc2a9b,9d3ad0e8,9fa479e0,ba777a0c,90a0c229,59d4b719,a9304df5,f1e96ff0,6e12c914,70c78733,3e5a65b9,8c01d342,827810aa,be3e4e33,cba0b7bf,eb283b91),
+S(3d1b3f54,2809a7d7,79ca2416,a7b7d007,4a728599,e4f30cc9,14bbbba8,3daa091f,dccd0d01,e56c7e6b,90829ec1,f0fc733c,8f1cbcb8,79916982,3b466448,cc21674e),
+S(a8c1ec56,3cf9596,d761e41a,bd6bc960,562eeaf5,b54eb83e,3d7e7259,f69671d5,a03c9fae,e160ba53,8aaf38cd,96ebe3a6,db59a04c,ce7074e7,dc3757f1,ccc244e9),
+S(219b4f9c,ef6c6000,7659c79c,45b0533b,3cc9d916,ce29dbff,133b40ca,a2e96db8,db2639fa,26a61015,a5bbe7f,3fc8d591,c6b0753a,c16fa89a,d820fe57,72c49068)},
+{S(b445babc,55be50ee,bedb8c27,dfc6c37b,492649ef,8a65de02,111b9f74,29b8c3af,6f74c5b9,f9a022b1,8d3a706c,5c608b31,9f7ce25d,8424d893,4cbd2f90,84b78bcb),
+S(dbed76fb,7e46e1d4,1b507edd,8994fefc,f94bd651,a9720d9f,8d62dc3e,9f329104,c047fc1a,41689ba6,9855f063,c563bfe8,49bd8b5d,37b3836b,d8bc57ca,fd02ef64),
+S(844426e0,860ff2db,f012ed29,ad2919d6,f46eb102,68073862,c1792e99,f1b2b33c,243512c9,c6ca739f,fb181482,a901ecc6,a41893f1,371d6b12,31d5427b,fb486394),
+S(1df697b5,9a2f9c91,b2c5d4a7,8035ea2a,351dc000,4e1c3bd5,5973020c,24836aa1,e89f949c,f6af652e,d7e79758,74a994ff,46475df5,4f7b17f2,a5c29cd9,7f722831),
+S(cf4ffa86,87d9a39,7b4727ba,a033cd02,7d8a5377,46903db3,34c35f1d,855999a1,d1316b65,e027ed02,b4be11bc,4c21c1a8,585bb247,45cdfa67,5fb9cccc,faf0c546),
+S(e3eed1d6,1813e3ec,d1b9fcfe,3e8bd700,bf3412ff,78a0a9b9,724d4dde,ddfd98b,dcb09803,b70d4c34,ee2bd7ae,6444724e,9ab27c20,5c3c736b,172af37f,cc673105),
+S(3a202c1d,94a94eef,18fa396e,5cb8a867,8c3ae45a,e4ee64b0,822d207e,6c814fe7,147992e5,ab565bc2,ad1b1355,60f37dc6,b5cbee74,fef8e5ca,4e4f418f,811a0482),
+S(6ce8f558,a853dacf,205db4a5,80c4cbab,8ef477a6,47bca6cc,9e676cb6,5f3f696a,e88e3934,b2857ec,6edb911f,acd132fa,f0078971,2805aa59,9afb3d80,942dc23c),
+S(7fef9aa5,b2df37ac,99ca488a,ba598b4d,eb222149,55e1cb4d,c3ef1e7e,7bd38945,d4b7cb4a,8f9edfd2,3a0efd1,9882baf,98312b6f,7b5775ca,65e9dbf1,f2c32870),
+S(6ec1ce91,d1eff7ed,9beba2b8,2f4a526f,736e717d,6442dd29,b55ae2e5,3371e0a2,28240ee,12e2b1ed,b40698e,ba6f087a,145eb772,caece880,b3e94b97,700dbd58),
+S(645b9fba,2cb739ee,9b148b29,8fbe9884,f284893d,968c21d9,50696d2f,efbbf0bd,b06977a1,2d19836f,add50b7,b73399bc,698729fb,fd182026,d918a267,eab4b7c6),
+S(7b930561,3a4a7cc5,ce1e7f5f,29314e1b,40bc8b93,40604f81,76578c18,69abf6c5,55a7e3e3,3f19805e,b5056d15,deaaa4f7,aea07a46,f9dc6a09,6ce15392,e146fb3c),
+S(bbcc74ca,3697ef46,e7415ec6,b31a0808,1e6ade01,c7e2264c,f9d4d94d,d849ccaf,27bf64e,e1005f13,989639a0,8772c42c,b4249ba6,9d90cae,3f542ee1,78929f26),
+S(4a45fd82,af96af67,9e640bbf,561cb385,2585a8e6,1b57df7a,e028ed33,a017c680,4ba76ea1,19a0267a,f019b3b9,89cde9ce,7b1c0b6e,da3c773d,ca31e44,61e048ed),
+S(c3efb1ce,ddc6a749,a5db9daf,48032a6f,3f1a848b,aef9e44c,ebd76127,a9c90d0e,3de258cf,e593b489,8f92e8ac,50be894c,3636019b,a9f31f70,28468eac,687b8f89),
+S(ec71a2a4,6f24acb2,8fda6bbd,ab9326e9,6590a96f,b9b9a4ef,405949a5,e3d2858d,31a91fa1,71207da3,1b0acc25,cace1e7c,5126ca2b,4c8d9733,4c50a7f5,29bc61d2),
+S(65dc268e,cfd191fa,f07421f0,dcb16701,f979ad24,81ac5ddb,1f77d3ab,41a773e0,f8c9ac90,255d6460,15ddd1d3,57b92522,53bb55c7,e2f5d843,d7d9a025,2766d2c0),
+S(62152eaf,df564900,4379891,4b53ddd7,3b91fb60,f16f2d18,941caa96,18d8ffd3,3a185ef0,a8d8a35d,112f678a,6a04a654,df565a8f,87e99abd,95fb4977,1b278ce1),
+S(f68e6fcd,b2c49661,ae59bff1,f24e97e6,fffe7cfd,f185d0b8,133d58e3,bec1c89b,223dee27,5e9cc518,af12be21,ee7ef3a9,ab39c7d4,4f950fdd,9ce5c78e,b50514a2),
+S(5d02e9c4,108860e8,2b1ae04a,4afbe1e2,9e0a8444,89876776,7e5b60d9,3fe5c753,25fdcc35,5f1970c1,43dae96c,a1ef0a7c,f95853e4,102548f3,d869d3d5,8bcf962d),
+S(f6217e4d,4e6d06d1,27668a01,8225f88f,a1e0fcd8,e8654fd,ab26c8a5,4c6d4751,65a6acbc,19bb2835,13eea5d2,5fae521d,aeed63ca,50f9aed8,edb74dd9,c43d066b),
+S(c18bb768,bae77077,35b4d3d0,e82cac24,fe3d7ee8,dcba20b6,a320ba6b,4695a406,b7a7ded3,a589153f,8ee504cf,fb5b45eb,b2d8e121,40f2f475,186153df,1fcf84d6),
+S(36fc443c,1350b40b,881e41c4,d3c15952,31f8da9f,cdcac4be,f1d0c5da,ceb9844b,9843bb7b,fd0ebca1,762785cd,55669233,16c36aa2,d2c37b3f,2b196f78,bfa5830a),
+S(ba7b8c09,d5293e6b,a2548e6f,ff3c939b,80d2ac54,34903039,dfb8b661,29e19cfc,54fe2a,9353fc1d,a0d34e07,b6d34d1f,f3a1f67d,f4aafa7e,57919142,95c2a5e3),
+S(50a8ddf1,17a91c92,37a48fe8,f1a00e72,a5dff682,7398a4c5,d2f78b4d,d49ee339,f91d9b20,da28e51b,99fa102f,13f5e451,ab22e139,80052384,6b9c66bf,b7da1578),
+S(642ece53,832d1859,c6543147,56b618f9,520a5888,2549277f,6b27f16,e08e3d1f,d9963beb,2c6da204,339a49c5,f253498c,48cc3e99,b715ea8f,a5eb00cb,1d6cffbb),
+S(a68c0d3c,13d764d0,7b513390,5842c9,a7171e4f,755a9737,609db06e,1a44e5e0,a2c3fdd7,b7938a87,86f3756d,dbc66b29,72469e79,839a1448,b367db5a,2bc52c15),
+S(5b33d730,288fde53,b123fdee,177758b1,ec113adf,74e79eac,513eadd4,cef377ac,1bbc10e,9d45cb00,db58fceb,bc4bcf4,a0e2bcd2,a7d3ec12,7d87beb7,a134a20b),
+S(aa6dc4d3,ce531af3,e68590fc,acbe7816,c8293af0,d77914a3,c7119e23,e50ce56e,14386670,5dbe1ad6,91e09123,a19a199c,3ee67b25,708ef57,4620c5ca,821224f6),
+S(180a4ece,d74ceaab,e0f7db3b,b038034e,5e659c61,3c66a534,8d962d14,efa32402,b675b2a8,b845281d,524403d0,db01417a,59fd3a6c,80232e74,cdfc87f1,3b76b0e1),
+S(3a55690d,abb5e00d,c2d0d8a4,96d16c44,76ee767c,a9d0d1d3,694c856e,e5b7ad0d,3c1d71e6,8a5f9a84,4de0453,6810660c,fe353475,353cede7,2936786e,4d173828),
+S(33b35baa,195e729d,c350f319,996950df,3bc15b8d,3d0389e7,77d2808b,f13f0351,5a75fe7a,9bf54078,6b9bfc9,db72ad43,559a9f10,4377648f,d43afc32,34728817)},
+{S(52f79560,fdfadd45,6165a204,6bf61bbb,726cd726,3a3ed2d2,45f07631,5b0b6ae8,e6c46e55,5b4a0410,bf38965e,5a7ba381,fd259482,2280482f,877a7ec5,84d14012),
+S(29eeb07c,7b27f82a,1b031881,11d324a9,4df77713,a8cadb36,2ce4012f,52cafb19,b7538574,28faf258,f240d4a9,f464797c,dffd0a68,f9f978fc,476f9bf0,1a0a2df5),
+S(2191ebbd,a95c29f8,e7062f21,a70cb368,ac67ed59,dc44b167,66e52120,cfe8e742,2812f1fe,557496f8,f21b1f11,2df7bd19,db6aad90,59494ad4,eaed4d77,49f66a4c),
+S(3c29d849,e25364d7,576779ec,78755ff1,8aa64e2a,65140a2,bbcf22e3,da33a4f3,3658d9ff,e2e283c,f8973cc0,ede5af6b,69ac4970,3c6b1370,f6a2ba4a,78a28a97),
+S(37230e16,e11db299,f54ca0f9,f5423ac6,5f05840a,e166175a,ff0732be,c72ba88d,2a26ac2c,e8f9ebdd,20f1f5f0,f628d3d,d0e02745,6132cbf8,78b614b4,51db28f2),
+S(8fbb3be7,98e16bfd,b738a512,ceeea92c,1be8eeb8,5374702b,e927c614,ab1f1baa,8280f387,64a48061,26392be0,c95f0c58,3607343f,d0b24b98,afe3605b,8f7e79f4),
+S(fb639ee6,29dd1f03,8e12330c,bf40ec7e,129d7da7,655c1c21,86452fe4,9589c89e,171adbae,2efe213c,8d01e273,ed9c5d47,c4e85503,de3849b4,d909823a,bb1da898),
+S(2399064b,876b7584,8c977bf8,e35d6b32,2e45d1a0,c4243fe1,2a31a581,d1d5d826,79c1ef29,c1af9497,f3b3db13,17432d42,86fa014e,17e5d780,a0d39df,b61369c1),
+S(dd5663da,63acee49,eb7fde29,6ac1215a,772512ee,6a080f3b,1266c7ef,51da5dd2,d19c7348,3754112e,9cb3a4ce,8986f748,3eba26ab,c415abdc,5effc956,27efb7dc),
+S(30862c58,43b161ba,c127bea6,7b23d3cc,46b6c42f,8faaa281,6ae47092,8ae47993,44ea1101,26a7c448,dfed4995,46a0fc8a,3658e540,d7d0c2b4,18f8cba0,accf9537),
+S(df7ebbdd,4e416e4d,6b1e67aa,34915da2,cc15bf8f,f6d79ebf,273b63a8,32d6610a,d05fddd7,e9618753,21f473b1,bfb5ff48,65b3c4f7,5cf4ae26,549989a9,e13056d8),
+S(13adba8d,2485bda5,1ac7994b,c45a7e4a,1b21aa9e,8188e631,59b217a,29d4237c,6256a795,3f24b25a,c1f59384,aac3eabb,4458e504,af3b99c1,99ae614f,8def4ff4),
+S(c160f7ac,9a453a1f,8811d031,9849be43,22d8bbe4,89cad7a9,cb815927,d4b54720,7958b41c,751ef3a1,fb985ea9,c7cc85f6,c16282a4,c374fed,5999d8d6,3227b720),
+S(c66af931,82a7a9d6,588e9c7b,3eda3b49,40fdcb99,346aa55e,e6549d4f,f9382228,ffe4d0df,43f00af4,fe885b10,92ae38fb,97d21a8d,26aa5f69,9751d52c,a9ccea4b),
+S(d3a4f4d7,d208b43e,c4c2fd00,798d882d,922f302d,a199b707,76a70f36,5ff404aa,8df220d9,63faa827,1c4ee360,67a536ab,25813239,82252483,311616d0,1458e1b),
+S(47bdd428,d57ed451,cd8754ea,817c5f5f,9658274c,ef6757b8,70527b4e,96f372f9,fbcf0ee,9fb14de6,3c288dbd,b1888fcf,72f0265d,3fe2209e,12c85841,2c375b53),
+S(6e6deb95,7f2eea30,5d625288,3cb311c7,f0365a42,480fb807,36315c4c,62495438,ba0fdd63,9b8678f2,ab0fe3e9,a16512e,ffd9ec23,e691cd4f,86146969,534978aa),
+S(dcd2775,7cd691e8,28e21987,d6eb6b54,e8def24d,27238cd5,dfb36a3d,d0f05caf,40bf37e7,bd776a62,ab420209,c71df7df,74d185c,f0d6b038,dea9c8e0,c1dad163),
+S(eda569f9,9bccdc21,580da94f,92d89312,cef87d13,f08d8ad5,f1574e12,30a64ce6,4e1da1ac,dd274e3,f9d7def7,746f0652,678e549,ad5476d1,410adbbf,aa3c1e42),
+S(5d3d4a29,734fb7ad,2846ae12,4c803364,ea3d57bf,e8d77d9e,6a3b3f8c,9cff26b6,d3e598a7,1a469323,a357df08,319dcd1a,d7337a32,c9894b80,6a30c575,b19756b0),
+S(10161fa4,61e87595,f269da7a,ae3ccf01,40e910fa,891276c2,df1bd91a,95e4d046,b36eb5f4,b8291a01,18691f1e,50235d8b,f66e14a7,f0641dd6,18ad7ddd,ea150196),
+S(7ba1b276,3df207f3,cfd1d58d,5190eb91,99cf82f4,9d2d0927,f5f260f7,2ea0f178,cb9fcac,4be96ef5,3134f513,5509c178,99af24c6,4eabd650,afc599d8,3927969d),
+S(4bd6edd3,aaa1802a,b0f46e05,418ada37,e75728e8,6ea4b293,6619c92f,57674dc3,c9e962d3,de71eafc,7fc9a329,3bfd721f,305e876e,a2a4755a,f9567dca,21aa3c0b),
+S(95fa0b32,40b24ba,29a484d7,f8f022eb,b3f30349,9d8abc1,9a69b690,3e885b68,dfe6b88e,56d7b923,dcf8bac6,2241d663,3ac2ae55,c3a01fcb,9f966d62,8f3acadd),
+S(d0fd4d10,18c37114,2d5f8a86,617c250e,b6c3d5,210ca465,6ec84e87,d0ae42b3,4e3bf443,290404a9,3af38e72,a54fa06c,3b2d6a81,161fc8de,554edd9b,f3399587),
+S(992e1183,d4e7afde,166c45e1,37c71c88,d4039709,4262163,b4ae38e,538293f1,c29534fb,55e47a08,ecee311c,8f0ba4c0,39096edf,b2d7ed63,21a2810,32e85900),
+S(9c124ecd,4e6ce167,f60dcf38,25976f33,64cc30ff,61f7dde,966f8c23,4c13a4d9,7ad73bdb,e0afe3c2,c89d9135,d445ba4c,796066eb,1909349,9e6ec14a,f74f664c),
+S(b09cdc9b,d102f89f,bcca0ed5,888519b,7c5c02b1,64ccbfa0,3d0fe42,b1b113e4,f409865f,6ab4371d,f52790eb,88df67d,84b3b74,f17edbc1,29b802cb,d5e49a59),
+S(6b4f628e,beb6d619,1d616e87,3233ae37,ca4cc3f2,ac881e59,9c2c8e3d,295ccdc0,1140b988,60f4ac7b,659eb012,6fdfb796,c0baa652,2202cce0,bf54b3a4,865f171b),
+S(a728c830,10169439,3af3f780,b1ceae3a,6ca08ea,4bdc7554,2ae84564,f542c28b,7b68fde9,8c97db32,eb3cdbd7,15816e51,9aa58458,259dc74f,5d722dc,f48f1933),
+S(21ce4401,4ce959de,f16b3912,e88ff48b,d44ef79f,5fed2d35,bdd2dc78,de8f7605,cdc598fd,c5d30508,a2690299,e0e25b91,b1ccb69,97b99fd3,eca1baed,76aae6d0),
+S(89912259,11b9132d,28f5c6bc,763ceab7,d18c3706,e8bd1d7,ed44db75,60788c1e,2574b267,83365364,d84789ca,a64ec905,c969637b,21061ee,9ca3bddc,7170ed3e)},
+{S(5914f66e,28c1a0a3,47f461d8,1d7f2c55,845e35eb,3dc39945,584b5efa,8d71a215,cd2ac885,3f681e4d,884e308e,ed3ca185,b47e2d63,3fdfff6e,efb6dc67,4d7de056),
+S(519834c0,d16c807a,7867b8fe,c99dc93c,3b9ed218,87a9ca17,9343729d,3ba9e294,b867d57e,fe2dd7c7,8586303,152f02fd,f67b5648,78a7727a,190d304e,64f97203),
+S(959eda70,cbabcb05,fa8fae96,7227b6be,876db942,ae38bfea,a9c3d359,977e1c52,86373396,9338053b,b00d206c,5d67abd,f95d35e6,992ad69d,8d8a3322,7370fdc),
+S(a40279c8,48dc042b,a3ee929c,2910e326,eded6051,9d9eb1a4,98fdd7e1,fc88a6bd,f2c962a9,f2950d2c,acbfcf29,35bad39e,2709c0e7,36378968,fa04d957,1dadc4ee),
+S(650b8181,edcfe46c,eea03ec9,f8ee5af2,c288e618,7d634961,6c95554e,25957334,ce140ddc,c2e2b07,a57e5627,62da3eb5,ca1acba5,463e97,fff7eae3,55b954c0),
+S(eb04688d,5f4c8d2e,4ccd509a,3d003b30,8c5539b2,dd160a45,cbe71efe,36fd9005,37d80690,2062bde0,b96fc8ba,7a7f751f,9461f774,a1d6f3e8,8999c676,a2ae76b),
+S(f79206b6,7813cd64,9f946313,3bac4aca,3762975e,954e0ef5,a876b78e,4b5a5d24,6033d4ee,936e956a,af117dca,6086eb1f,6466ab18,d503503d,4b011315,365242d8),
+S(539c99d7,728cf662,13e024c0,9f1226f5,ca5d09cf,67bac12d,47814b2b,b1e7d611,87efd14e,e58fbff,5491bf85,aafd48ae,6680f37,e0d928f0,13fb6cec,6f417f76),
+S(2308281d,e761f602,66fb8228,45eec88b,e32f8fdd,4a06b8b9,3dfad9c3,75d64a8e,933f4071,e4f2a9ae,95f4a299,f4267098,94b661de,c96443c5,f03f6cb,f3be87ed),
+S(a93d05ae,fa31c0c1,54c02f68,9184c1ff,344c670b,e13eb304,2de517f2,1f6124ed,b7549c5,4651fa60,61f4103e,27d316a5,db531e3e,d7396a46,e360341e,f53ed274),
+S(35717dcb,4feada90,b039aa79,10cf064a,c8c998b5,fcbb037c,22bf9e92,eba560d8,b6ff9371,d98bf532,f82d7fdb,24fffa69,2afeb0e6,59ba30da,602b3399,2bbe5a5),
+S(941d37ef,1671d5f5,675be9d0,d5cb1f0a,ab6dffdd,2bd342c5,c5b62be9,88d5a0aa,4834d5ee,a8f9ae8e,ba5cc8b,2fb52260,33e35767,d55b6aa6,d204e0e1,a38b42ed),
+S(c22cecb,aff78c61,f6e34c9d,9367c4f4,1acc9c35,29e9d894,7989a874,1d70bccf,38a37fb0,5fd9036e,762e2f0c,fef8fcbd,c04a92a5,4cb72ee2,ba08213c,4b58f1e1),
+S(7863ac2f,1704fd,5015f0ed,30edf5d4,33c5ea2c,e150833b,a15c1db8,a5e4d2f4,7468fa15,eeab5653,c9f982b4,ad9e4c99,2f44083f,a7a93e9a,25ff70e5,b8742b4d),
+S(f702cfa6,f0cfd275,a2c7af50,b53d0c94,bb965063,c433f4f2,cfd13d99,800da48d,3da4a4e1,bc5f2c6d,2f8daec4,599a9704,7c1b930a,b37d6b2c,f8a586cd,ef7dce1),
+S(c3a1da3c,6e6b8f2c,2a8eb81a,1875f2b9,1e9cd286,414862d6,57626b47,a413d7dd,983d0892,5983d42e,bdbce2d8,df116bc2,f5cf8c87,aeb833da,e5e7e9ca,f9699798),
+S(df0a4106,d61fc3c6,b2a14ecf,ebea3dcf,7e38069b,8faac576,a0b8a1b,7c8e7b5e,dd97a06b,840d64db,1798cee4,9334b033,e8d3f4a,79da565d,c6130da,f0bea75b),
+S(ee9901fd,9312a21c,879d4e1b,24d5a299,b8200a15,6e65e147,4a2055c8,a2363423,1bb2933c,8b10f8e8,ab93ecee,16f861ff,a86781ea,59b891b7,740fdc2d,f6c206d),
+S(52890b99,c8dc48c4,b6b1e4ae,5b823fca,ad9495b9,8217fa4a,b4f8e960,77cdaf9,6ca2ba73,72606e82,9c3395fb,dd2e4b74,8c771231,e86fade,5e2d728f,e5e7391e),
+S(a372b545,bf56b58,b7c4628d,aca9bc14,e8bc634d,d79d139d,8eb7a2d4,13465c3e,afde23df,fad41c68,df94abdf,90a642b,31d62f84,c6254c4b,4cad2934,376372f2),
+S(89d02f41,f88b1f7c,90b01078,d7599a70,a1eb9c23,1059e856,4237b0a3,2c18010a,7e8e810b,b063d75b,c224f41,a842972d,6fe065c2,aa6b16e5,7bf224fe,e44b2275),
+S(7ef367d7,23fedacf,86425861,f67c5ba2,2deaf04,69e31988,7a3a3a12,2f39576a,4b81e743,e00bfbc,1d98cbc2,5c98c516,55e574,fc7fa1f5,86f15d9b,1b5b7ac1),
+S(2eec37a1,5fdd1caf,b4c0855f,e86c5534,1a78cdc,b3944798,311b1cf4,7df768ac,1c18cf5c,1a98fe9,70d1e635,ab133668,4e0d964b,4df0b16d,7c51ea01,c9a63),
+S(72208b8c,fd9840d,76dfa6e0,f36cf57e,502f285b,422f0ba1,9b119500,6b2ddd11,fa09196e,a89ce6a,888415ec,a8eb92f4,149bb39a,50174a85,8a29bf63,65b4e577),
+S(9f46479a,69411d57,c3c7ea6a,dfa833f9,1fb2109a,fd30c790,2ce323ae,4b14be0c,6cd6d7e0,8494cb95,9e67c258,1be426f6,4eee4514,83e9a9a1,278b073d,758487c3),
+S(a9aaf56b,5016db58,5b8116dd,cbad1169,4b16de8d,9db5ea5a,279ccf4d,91b1d7a,218fed41,389a4abc,44fb2a83,7016eb50,99c40e86,bb419265,7f57714e,194a5900),
+S(5f950f20,b610c06b,76949dab,52fc6149,97d254be,a1330a0,493f1ea2,1d608864,d9098481,823b3ff9,d1c0b7d0,bce90856,186b45ec,6f20da26,9b158283,8a4c96df),
+S(ed621f77,98add722,b0dc5e52,9c6fec6b,dff60827,b0b12c85,18d798dc,761f1075,a8973e79,a9caf1fc,e3165145,df08b7db,6b7187a5,28b12712,6c62bb5d,4f0c46d7),
+S(15b8390d,652d7338,e18ee091,97e0e176,74f8c4ba,fa2e7b85,8f5badc9,9c89240f,87930df3,710172f7,c5422833,385a6066,4cfc9854,a3e5ccca,d1d06106,1cd90be5),
+S(ac2acb9b,21999a70,540708ab,68338266,aef650ee,d81c5b30,da1e87d8,a8a923b7,897bbd7a,ee3e8db2,e36505f2,ec2614c,9f4f2f40,ed2d85b0,5d23edb4,2832db89),
+S(17c072d5,6bdd1382,a782481b,8aa4d223,2db79438,5870bcad,c3063330,a5cd5379,26fe420b,d7c25f9b,1883edb8,50e2fcb0,76a65389,d9a452f2,8351fad,4ef72f0a),
+S(8d262002,50cebdae,120ef31b,4c80cd5,d4cddc8,eadbcf29,fc696d32,c0ade462,1412c44b,8ea40bc8,2ce090d2,3c11c945,e2b504b1,8d9874c5,271f5745,f0d9b523)},
+{S(ad9144f1,bdcc3673,26d51685,a047ea9c,3c4feb3c,da4b9b83,80e1ada6,300ba487,68003744,ab5b2c8a,cca5bcfd,e1c4262e,88ffbc0f,b0ad4206,2d57dcf8,62c93c47),
+S(f3b90a0d,7a8cbf1d,9b994b19,7ce215f9,b8ed861d,d526228,59fe1811,68727bab,95f48e8b,c05a7bf1,e47fdc86,87513ae,5a56472a,44f384f6,1153a954,2db68b81),
+S(24af6d7a,99122466,45b07a1d,29b4bb1,a68b5b0e,f9422065,b5bb0050,61d43cdb,f9dc7725,f628cc4e,d4e5554e,f0166b22,566d59e0,4d55c28,a4d0e975,8306c31a),
+S(f704aa4c,2bf19c9b,128311c7,1bab5f8a,f2a3865b,728f4838,b8ccc7d7,82574cdf,ae7c46ce,c44d54a7,2e3f758a,e855710,dee6b189,1223d120,9e059620,38d12453),
+S(f701adf5,a1bd988d,d7e1fadd,9903c453,e6798760,252579c8,b90cdce2,a046d9a7,db39a987,48aa20d0,5d8b8538,fc4b7d77,95e2810b,160198c7,ad98305,96407c31),
+S(bfe36081,c492ed7e,3b91059d,bb1af376,47dca509,69be6665,50f94903,d948ca7c,a1fc9468,2c3dc954,764ee858,822b8c1a,5d0184e0,93f12bbe,21e9931,18911f03),
+S(e707057a,297a3d7d,904a615d,ac1b8e81,78f52481,32fa166e,afb621e3,af3f4f34,9161a930,bfd583c0,bfd3b121,acf574a3,6eb534ab,5198aa84,ef38253d,9ca19bc1),
+S(27a6c7a7,970a9e3a,7cd42b6b,4478be62,31f53ff8,481791c,4394e78a,968fdddb,e4bf1b16,6bd56269,9e2c341b,b1a51c8a,c2ac7d28,807899e1,3ab1f726,90f44108),
+S(e65f799a,8fb3b6c,ad088351,614db5c3,d64660ef,8c977ec1,2bbe58fa,a53314d6,5897f680,253a948e,fc260fa2,8ac39377,4e6a445d,d2bde00e,4e01ff03,b4398e2),
+S(8406a84c,e9e63204,761dd406,9651f20d,6fc3efe3,f98951d0,d0a2db9b,cf86e0a4,ef81aeb3,eac17e5,676f4455,b4372ccc,e405b786,f11a871b,d781e54c,6307d1f2),
+S(c012cad9,4742fd49,8daaedfe,5b847f34,7a45c792,53c8a645,2192e905,e256c7a1,c4866f98,48f31660,8a81da9f,da112a71,34232f9c,75e388,7ff987b6,8404cd42),
+S(73795313,e9de1efe,3d91ae5,15c620c4,4f9c6bb3,a21e3097,c8794710,b2032683,548ce754,93817f22,cb96c674,5d67708d,c7b9b133,c71cba5f,fede1316,c55245f7),
+S(352b89f4,78a47e86,b5575fbe,ee1373bc,e93ca316,1f594564,9efaf048,a60bfebe,d784e6cd,88d7862a,d82747d9,b23340cd,b50235c7,65f30be2,ab5d313b,edb0624d),
+S(8a0b3d0a,80d41abc,4b8a028c,6c523923,7b040445,525dc345,d2d8a319,c4708316,7b7a427a,f0e1f902,dd1b9bb4,65b6b376,ee68b9a3,f495cffa,c52fcb9c,705443e9),
+S(b4bf6756,61462829,53f9a44a,ee3b5427,2485b45,951013a2,8d59346d,62f65894,85d0c26d,2987dbd9,e26c9673,71ca86af,3b8cfb4f,cbf97404,c99ef900,5379a1c6),
+S(bff69744,3ac23a6e,574bd1ac,d0fea305,2f05ea65,14814f1c,65e86e9d,5b46a2a5,36961462,5b998565,9324f5f,c8714d9d,57ff314b,5d5c2cc6,99a4ab39,69add4f4),
+S(ecb09f5d,122adf91,e68e98ea,d39e5790,27e7c4ca,405bcaf2,e086d4a3,e68242ed,aa214cca,8a601fa0,a92633cd,a353ca02,7a7dee71,cf335af8,fc75de56,a3405f60),
+S(310d957f,10fb34ef,ca3a2a0b,35c901f5,35c0862c,68310134,10982d7d,e74af8ae,289cda3f,29a489a8,86121f4b,4e75a90d,2bc4ff20,e95aa103,4044ea80,cff56378),
+S(3a5f1ad7,c59ee6cf,e090f210,7040b419,4ca15fa7,dc8e9f69,20825fc4,e012ac2e,8ac8986b,48d7bd1f,5ae99535,2505b0ad,78f855e,d8411b03,15725571,dc99c920),
+S(725f136d,1b426894,c24f8782,43fdc1d3,79636a23,d682f389,dbaf71de,d4672067,db0ffaac,ec5ffadd,f32396be,3f01fe2f,45bb0cbe,eb0d98bc,2390f3ca,c3dfec84),
+S(b28e523e,6fc68192,445180d9,5da3e411,2fe0db1a,5b3bd5e8,e00a1090,39c69d53,7c172a4b,31339fb3,47db74a6,beedf59d,c24e6aea,c71e2a0c,434714b4,d61a2f70),
+S(b808db0c,e34b5607,8166b308,1dd4b2ca,cf9d2d51,3079648f,fc3c617b,8e45ba09,d69c4ab2,fc7e490f,6887f2c2,49e0b71a,746e3e2b,97a7415f,34475bd6,f6dee79),
+S(5e0b091f,3144d7bd,c7e40dbc,98c716cf,d7e64eda,ee9c1fa4,6838bcd9,e0c6878f,1586cf7c,da66b005,8b2d0d49,f588d444,65eecf42,1d94c004,a078dbd,47e0bd20),
+S(1c3e88b3,ba46410d,8e08f9fd,5db8b53f,8dff33c6,4f5314f5,e005442d,10cef1f8,ba365020,5f85aa9f,71a42c0,392345b7,4a17a5ab,9ff91109,4d81252c,d8c8f72f),
+S(b4926018,fb0e9c,e80c5614,37c3f22c,cc223412,384321e3,6f408e4c,ec0d81ac,55544f6e,cea3575d,e81649b8,4950f225,8a94e78f,13325ffb,16debe1a,8387173d),
+S(f4bfac1c,b0834e1a,e332b7b7,1ab84500,b1c8460d,c8c2efad,6a5efbb8,ae78cd1d,5faab691,59ce9d3f,6bdb1818,676684b1,cc2309af,1401b5d5,137e1c61,5fbe287),
+S(220ed3d1,fe028d87,b96e8ad9,37ede03e,ed8f262,ce877c0a,42718ab9,cb2ddfb6,5ee2d60d,f96a1b8b,e11c9139,7abf9b4f,a0671966,34bf37a2,8d26864,31933fb6),
+S(dca5fad2,d045526,b6a4c309,de1d95b5,23f9a7db,e669b558,edd75ca9,40c85878,f350337e,877c9c61,98fc912b,5d53876c,78ea94cb,bbf3744b,62a52fa5,f5ae4399),
+S(486ba509,3272eb1d,16ece443,861eae7b,2d8604f3,37014bc5,11267485,9872642,688d4585,9fa732c4,f582d65c,45930567,8c27dc6e,5525d47c,3908daff,f0a534fe),
+S(96bc1bd3,b4840354,14aa92eb,6db81f5,403e2858,c0552d5a,6b21d33e,c468f31a,83027873,f4066b5e,ba6f413d,6a7d4d18,d57f4a62,25cc9289,b514f153,91ede3b9),
+S(9f131ffa,b53e20b4,e9cd9e33,793f4614,922c03df,7d11222c,7fffec33,42fddec6,c4deffeb,3f4cd90b,102cb6b,3f713728,2c5cdcab,bc6e7153,91ea890d,76207bdd),
+S(c15c8c23,d90c8e35,c1a214dd,e2d4383c,735ae45,bef61f10,aa1a1c25,5984cf74,d456ab27,d7adddca,372390ba,1da02845,b84088d2,af4fea5d,3b5b7326,c6334c2f)},
+{S(e24b71ae,8fdea24b,2d42a2c6,5cb022a8,2aa9e03a,3067a889,e778caf8,34903fa,f87d5757,cae83263,1233b840,296d6066,52cd1ddc,e8334629,25c992db,7e0ee14a),
+S(886a7626,6203c559,807acbf6,7e1631ae,1f6bcacf,3fde277b,ddcd795b,292c38f6,b1f590a1,52d3ecc3,2b699c23,a89b2601,de78be2d,fa11b20a,1ef1235d,93ed9e99),
+S(3079f709,3d5270f2,95fee75e,a6c5cd3a,5638ee37,aef535b6,523604d2,eed0d57e,492dd2cf,d76705d7,42187f38,f38982d1,85efa30a,fd1639cb,984a8772,3e912a91),
+S(7773469e,c557e3e9,4097bd55,33a87583,a79e3eb4,2e421cd6,592363c2,76641966,f827b0dd,46f4b5fb,4a656731,d827cf21,df1ec610,f36dc2d1,215f33fa,20a08020),
+S(ebeec367,eb032a6f,7c421ae6,f8fb56f9,3fcdaa68,f6741e46,1992d019,7567336d,6e78af43,e10c742c,35467149,3323f8c4,a6cff91e,7b1f1c2c,65b21fa1,e63f3a6f),
+S(b41658a,3683b512,c751d817,f5d92f8e,5d158632,1f2eb836,b446aebf,d276030,9396ba60,ca61b35e,4e52e879,a457ce5b,fee9121a,b2673c19,15e78236,483e069a),
+S(2e2ed965,a926700a,1428af7b,68b7dbf7,61d1bf53,6eb9f75e,d56afa0b,63852cd6,8d77656e,d5f11224,3a94e462,3dcfbbdc,61749930,dfcca6cd,c4303cc4,617e9133),
+S(4b54bd22,e5604384,9ff2268e,88c695d6,4766e0c8,4f598f5b,634e1dac,d03063ba,176c68e4,a1f25683,37c14fee,dcf9a64b,17cba4f7,283428c,1514990c,98d29d71),
+S(b6cf7c38,2d4c63cf,78557116,55b5de99,1fd32da6,8b8d2dd4,cfcd6f5c,59c45251,c4c190ac,2870142f,2a13d7bd,5d6768b8,fb5ccdfa,b99d0e3f,6bda805f,7741ff52),
+S(857b6db4,79177eca,82a6c801,bd763647,c1a49021,e5b4f405,ad02e6ec,7ccc3629,586cde8e,cbf7907f,704a6610,f7a8a910,16599e9a,93bc6a6b,1b70d59e,39c0db4b),
+S(a18a23b7,6643d92a,9e1bd2c7,7bfee61d,c5171b33,12f64d7f,821fbe05,6a771ee2,321f460b,b9525303,c159fe3a,6762dd97,60432307,919a2f1d,6120c946,47cd8568),
+S(19b91028,cc2e5434,b162cee8,c77351d9,d38d9eb6,8ff9b09b,f26cb25f,4b88510e,cbcf2e52,3335ee5c,56ee2a06,7c565627,a5c60f16,808ea8e9,94250c15,e427c883),
+S(657e2f30,b1e0241,82c0e57d,996cccf4,7bdf8eec,5a4da875,1638b3f4,9bcdbd2e,8e0a3117,12da36b2,2d0cd048,a9a99b26,5faadec2,14162083,5210f1bc,bb79fe3),
+S(576879e4,f4a8e697,45014bee,36ba4267,cf72038a,f5997d38,cf512f08,f0ccf6b0,3f313f,388c011c,18ba0938,51b0e7e,84627277,2e9da999,b839b58,92ede5c0),
+S(ed72d681,6516c2f2,7a9e97c7,1a7c99f2,faeb8e31,a5f29260,faa0bbf8,6475117f,331fb25b,e71c24fe,f4d2133b,f1591f3f,e5f8830b,15615134,36fc47fc,522ad4b),
+S(e4ed422d,9152f00b,96bce64b,bc3ddaee,6089e1a4,1ffbb58a,109c688e,ba44699f,6dae6420,2dc6cec2,e4a49203,6b16c9f5,9c517436,bf3b9d9b,7e8f458f,7fcba8e9),
+S(fc3b8afc,fe39404c,29622db5,b06c989a,8d7a0c4d,85018796,d006bd5e,43dec087,7b77feef,2211c1a5,724af5e9,a841e09c,d7940bc5,43d70c7e,51676689,7682ef15),
+S(9c2421ee,e2e7e66b,decbd152,a8839f1e,4cf03808,649399bd,ba55cfbd,9dda6360,8d9477c1,c66a532b,967895ae,66c7585e,608e9653,4f870bd2,c97d7398,74a84700),
+S(22040517,334bb5cd,2252d1b9,8a9da91f,a0bd32b5,562c8218,4d991e01,d94e8f13,167d3dd5,738a467e,f8e03064,d6482c2d,64503892,b4f5b9d3,c4b04684,fe2f15c0),
+S(b648a617,3c728243,f3c0c7ec,2aadcb13,dfab92fd,77da9aca,1602d47a,80022dd4,7199a3cf,89c596e0,d607d05e,de95c8db,ad763ac0,76fa7ee8,ba7ae6e1,4c14308a),
+S(a7d7ab3,6722b9d7,940b2a15,c94bb9fb,41a139d4,26215286,bfff84ec,57386dae,25ea853a,c3e772b6,f400d850,a7cf5760,ed568add,a145ea75,6f20b77a,c32d9f28),
+S(9787a21d,ea3dab74,366214b4,933a702c,7a07c4ab,696eddb7,3a84cb5f,80f2ba41,8663b959,2214a018,e373e360,a9e035be,f68d9e01,f6fff1ab,f8ad9b8d,3f6f324),
+S(1d2ebbd0,65bd4f50,8dd697db,9c8bafff,b548edef,856fa4e,39f893cd,349ff205,85d0716b,109ab208,a96367e3,bd0a2314,ad2c8586,169096ef,9521d780,61df01a4),
+S(d0a506ce,14e88414,46c08a61,98ea0aaf,75b9dfc2,c4d2cc58,1238a597,154981b4,dc8c863c,7c4611a1,85744975,34c8c02d,7cb7504b,dffa91f5,96765a25,98d1f506),
+S(b6c4d103,a57d0af,27e93627,f55a34b7,75b2ef48,47d7612a,5fac0748,b41afee9,dc9440a1,596cbfd9,ff87fade,8b426091,4799dad1,ce0f7b60,d032e94b,bbaf53f9),
+S(5b5d965c,f2f37462,86f088e8,b58887ab,2182f874,484686dd,43a245e3,dcbc55c7,6718ba28,cf43ba30,eeba6e49,a7234ec8,7f01762,e915ff12,41fb461b,6d87a875),
+S(bc85aec9,55e6e99a,c5fa7738,c7972354,57b3935b,bb69e8e1,ddc69d01,d34a47f5,59dd49e8,cb3100a0,9c48ceaa,20cbde82,5072e13a,7af0a44e,601044a,361dd971),
+S(66b7ffeb,a34d8cbc,e00b4d1b,a0558741,5123d8b2,89ebdba0,47587d66,b260bc99,43bafb96,c88a5917,c6333dd9,b4a546b5,1c37ab48,3f3873a3,6932ab97,efd79712),
+S(3cf9208a,b230b73d,68470411,bf3d4899,e0f19675,f829e32f,cd148d,3c07d7c8,21fc39b3,ea5079a2,ae131935,9a3e98df,62b97b37,2a473a63,f3b56e24,25b30e27),
+S(66e3fcef,b7b24cf7,af0f8de2,8e53c2df,2bd1dfb2,c0289b10,31239da0,948e129e,df4074b0,488f3f09,a674a40c,b3207f34,a0282661,2e5ac4ae,8d443c9e,d1184045),
+S(28df781d,4ec05680,590f4658,713c8a91,fef23763,87ddb6dd,674a35c8,b0e74459,eb66159,95ecf0e8,34f24e87,6f0dd86b,5c86a45a,fe5190f5,721f833e,10a196c0),
+S(85d8da47,48ad1a73,dec8409b,e84f1a13,16e65c51,96aad27e,766746f,3d477c2d,a76b74ac,99a3996f,a794ac9a,ce103843,6b4f5fdf,cc3b2a59,df867e8f,382e1ebf)},
+{S(39ca1e6b,9fd848fb,ac24c444,5a9f398b,8639fa6f,c0c2f2b0,8058d84e,6c0caf1a,8797227c,f956ba7e,5228a452,91cdd51f,8958ab7f,43f6c8b5,e06176b0,dc9048e4),
+S(4c87e538,c9eac9ba,d5a2a81e,43a6f1e5,f8403c01,68ad5020,4adef77d,5e3aecde,6ee8b74d,dd0b9bb7,c8b7ed7a,728dd99d,a9fab941,f0132d0e,998e65b9,ffbcb9a),
+S(1226617,9f5dabe4,6d963b7,e96247e1,e29f2440,f831c8be,578d628a,78561987,2d3552bf,ddb5ec6e,a7758830,9badce7b,41d71926,857962d3,c3bb28cd,5d68ce7f),
+S(866c0a90,893b6b3d,807a96fe,3c67b928,67c1d95,e05146fb,40038476,26981201,8d8f3188,da86e510,b7a7642a,97778201,3926dae6,4ce80663,335bc448,d204413d),
+S(8eeb2e94,9a66824,26a6f474,9e7578d3,1b356aa8,d1b42049,5fb83e5f,5d08f723,e439d710,c45063c6,d23aad9e,ac0cae8e,36552ab,ca6f2c02,6eeb03ff,6162a052),
+S(ffc93fcd,85fd9502,78369b3d,291f1ffd,5da44964,888d5eba,3c3f60c,95082bfa,9aa66635,a4b0defc,b2514e97,515aa0ec,3f65ce8,6f6962f7,72eaca41,d5ea7983),
+S(605ccd66,4f18c83d,edf36f62,e5089f14,4ed23f4,f88635fa,ab161567,fd20c8d5,cfccf020,363a805c,1d614aa5,b9a912ec,99cfea61,5c088789,275ef531,dddf2418),
+S(d1e4f37e,7d3902aa,dfdd7254,fc727a44,98eb9303,a12fe71b,4d193be4,8dba6913,bdd29d53,4881cbc6,c2e301fb,7d757bc9,9224f12f,4296e834,9badb88f,84fcc289),
+S(f30b6d53,f330e6b6,b23d21df,7b4350a0,c42ad202,4a92751a,5dfed94c,47bbe60f,b5ca6c03,b31d06cb,183b0b18,4432a06d,8143d511,8af4bc01,c364f024,b46e0c38),
+S(540944cd,42101851,c2cdb0ad,61264e18,cbf948cf,2090df68,54482628,74271ecf,cd16820b,4ccf9131,476b8778,ba3e83,f5970507,7110686c,653be572,2e99db3f),
+S(846e5478,5d9cad5b,5109c7e4,6fd62b04,f686c723,1fc3c0af,66bea20a,d9d60dd0,4b1a28c1,78bd097f,aeee951f,fd4f46a9,4658a76c,268ee7b7,9aea4bcd,e75fc8ff),
+S(16e732f4,43b4c616,24a495d5,4497a23c,c95612d0,58df9f81,11d1340c,4b2b8b5f,61ee476f,30ac2be7,e3ff09f3,ebf0b3e,2d76177a,30573465,101f4cc4,ec0585be),
+S(4f30ef37,2c730ba,a6a40ff1,94b6b58f,436111d6,848b4e60,10be9b9f,abef17b7,b579a133,7f3247f2,8c6afc05,644778f2,3668e73a,a7c6d14b,649bf948,ef126142),
+S(595a0d2f,1668c0b4,9ba0994f,3b681c42,6e3a67be,e957bf52,47acd9c4,7cb7d009,fb10684b,3ef1b0ee,37684ba7,53858b3,3586b837,aba6d82a,958eb947,2eca319e),
+S(85dfb59e,d7ef6e0e,355e0ce1,304fe5dc,8bc6a3ad,74de3352,2089f224,8894e0c4,7a9b9ad1,10099903,d0d84a33,6838d422,5f98abde,32d82ab1,a383969c,1fb98bb2),
+S(c8e13980,cf58416d,8719bc94,96e21774,c29f2e1c,5a36e760,2ce7783e,2c810fd5,5bdcded7,bb484d46,48bc40e3,ee6a3761,cf995e36,2af21f0,10048a91,6fbd4717),
+S(80b98fb8,e48f44e,db69fd8b,18eec95,2404fb59,45c8a35c,bf3616e8,c746aecd,d44010a7,20622d14,6af5319e,155fe4ff,591bb829,f5086c7b,1fc1ed6a,32ccbaa5),
+S(17629b1,cf015e58,eccdc7a,de049215,fca806e7,805e0e35,951df2ed,5cb87d38,afd56698,44f6aefb,528dcea4,29438e0c,d10c4b21,23f02444,a950834,97a61f17),
+S(592677f8,695479dc,b215af2d,bbc90621,e7f3cba8,650563fe,1b2a8765,6c44107b,3741e4e1,b39b0e2a,58373166,854a1d31,ed062a25,c4e3e1fe,bc82e941,eeaaf50d),
+S(98d5f85a,a93c9d87,e34e3bb3,597d9380,f0a7e5c5,b03ec219,4025c89e,42126453,dbe42a83,66753aec,61f7f01d,e5dfde1e,b4b989cf,95bd36bc,a66ddc0e,ffeea196),
+S(9187b546,70d2b9a6,b711c88d,353bee60,72a1f5d9,ce75288d,4e6c9111,80dd4126,80e73529,d211ea24,d4bccff2,b9de3e31,c6307ee2,3cd9267e,b2d372ef,78f8d2c0),
+S(e38c81ad,8ddfd8ca,4e01f380,78eafecb,f8edba6,8e33e565,309a3ad9,f0abe0eb,9f0ace1,f05f0a85,a1488644,88cce81a,2cf55eb3,a91fc10a,e6b82f47,60dbe618),
+S(7ee9955f,99e218e7,dadfed94,dad7054e,3e0b97ba,932338db,69ed056b,6f8adf55,5244e198,524a105e,2b5de11,81d7bfe9,ad56aa0,128a3d87,8cbcc5c0,25b41ca),
+S(eb9e5ae8,cdf64b28,76349aab,c3f75c9c,9d95a335,3214d0cd,d43123c,265b08d,858611ee,f67a32b9,7b8a9090,6639e998,a05d9bbf,8ccb7c1b,9e5eb711,4216b877),
+S(2aa74ebd,7e8b6b2d,952effaf,e5545eb9,e99b9678,a2515698,975247ac,c83ff081,1ec12cbe,6877aafc,f353f641,1a5edf9f,e4bcc09f,31422df,d076932d,8f0defbf),
+S(1b7b8fee,a3ed4af1,cf9b07fe,b435ef76,1d081b1d,f1007697,f78fe5d9,89076aec,b4aa0d8a,efbc71d9,d338e998,197054f0,20c5a2df,7a9504b1,ca7cb603,6641f85d),
+S(3f293b75,9f152a4c,b92e319d,e5d02b82,f5dcfbc,2ee7a53d,fdf7ef6c,e2595c32,b67babb8,d1d1963,fd742c22,5ad5bbe4,27e57d6e,b9e17bbb,f91d2c1e,a455c1d0),
+S(3eb9968a,c9b01fd0,882ec65a,8f9f5a5a,b0fbec2d,e2dcbf88,cc9a70b7,887ca59a,1a4de130,4a46fcc7,6719c254,dad5e88e,9d6a0839,9a9a28ac,7f171aa5,9624ee2d),
+S(a559381a,f41b944f,e2bab9d9,62ec7c53,efb25ce4,1ff1a456,54a99f46,d97ce20c,ebc6f66f,75ad7322,4c1319c6,4268c997,4142,11ca65b4,58c5f79a,be0ba0cd),
+S(a8bc942f,c60ff2e1,140f9a97,3d7e0b8b,77698254,57098005,f9186e97,9e430593,2a82070f,25480267,c4fca773,3173b354,fcd5cc1b,ae497af8,58b7d451,8f048c73),
+S(2f456ca2,c4f8806b,ce4caf12,32446b07,3405dcab,7b3cdcc0,247dd079,adc7a626,7308e58,5b9bafab,b2dee049,9bbf60ac,fdb37242,3e915156,15314ffe,5ad866fd),
+S(b56f4e9f,9e4fd1fc,7d8edde0,98f935f8,4c750d70,5f0c132b,d8c465b6,6a540f17,cd171acb,d63357a9,2c23ee52,fa7d2e2,de2bd69c,343357ab,b95d0350,fdffec02)},
+{S(ec474055,43c52e68,5c9e6c75,97616fbe,edb70df4,fe3c375d,d7d24729,2b120851,22c1c1a7,30066375,5ef8c2fc,86452667,90347223,f11a32d7,9f1c0169,a467530c),
+S(3f50e502,c45fd922,94fcc46c,b3118a86,43af00d1,634bd694,dfc0eeb8,be2dd4d5,7cb992e0,f29fbc5f,2887161e,6d1e266d,f11fb723,3b6c020f,26eee393,fe96b526),
+S(443007f2,43c3f6f9,76914031,c41e0d49,61337340,9bd4a681,f20e4c79,934fc2de,df67adec,c9ce5f6a,e6c8312,699e0353,68ee87e3,1e96790f,f0bd3408,94af74e2),
+S(1e15b9e9,c28f77df,75837a0,cc9504ab,a3a49aef,26a88d99,543fa7d2,a875620b,2a081093,6afbc025,3808ba31,f5597287,e32898ac,77fd0021,9e6fc298,26b0370c),
+S(cfff0258,ff6c0d97,99823447,775b75b9,1881e06e,bbd72ba4,28f8248c,5cf2144e,61e63569,5c4a8fb4,f68f974,219bbf4e,e0c277dd,4b74b843,88f99041,f97809e8),
+S(2824f4b,f72f9229,2aa04058,7a0c5395,4c87e7dd,bc5dd199,af6918e,6db62f1e,16ab1473,3bf8382c,521af6fd,27f8b2b3,b421dbdd,bcf06c62,3bcd86b6,4bf33274),
+S(5dc7571e,27d6b955,6c789b4a,80d49fd3,17416fa4,e04a7eb2,3cdbb88c,9c253a44,b7261e2e,39327d68,a5456abc,9d4600c7,fb6d6e51,a732c7f6,c64cbd0d,56de4a17),
+S(e93f3aaa,5d9edc53,6029d332,9ac0bffe,af27d4dd,40f550e5,3df879a2,a5c1d993,25b442d7,f2e2e03e,c7f1588,16a1af43,b5d2870f,e0cdf429,babb19e8,951c0982),
+S(8f91f5a5,7aa40d62,ba407d8,6ea5678b,65c84ea8,f241e2aa,dd6df242,52635a86,e9333d7b,d6c319be,3ff4f5b6,f286a8eb,27d5a1bd,29646cdf,77441c40,f716a6f0),
+S(77d398e0,228add30,e9e120ea,b16436be,30c254ae,65016672,8bea1198,de1fb17f,749a20c8,ad6f4312,fb6e6fa,c390a4a8,209704be,3355362f,31db9b45,f3876963),
+S(96976a85,b6dfc4b6,13dde357,c21c3518,a5f55c7b,a2d22976,592d7632,3b5a8546,96dc660f,8ef3b0b6,adbe77b5,69024fb5,dd713566,617cfc51,c8013f2,5b424e9a),
+S(49093c4d,26194278,623c2ff9,6c8e2f11,f9edf3b,13c33099,57b57f1,9db451c6,5d53ff56,50b82edc,9dee9f43,ed6db93b,f6a26233,2dbcd699,130aa9ce,5130384f),
+S(49187f03,d5f5f628,b9210b88,8ac4f1b5,2f754015,541e9f38,162e969d,6a99f4f8,276aacaf,d38d0bbb,416bcd0b,8ea590d9,7735a3f2,8de72aaa,76bed0d,6644bd80),
+S(7d64e446,65c03917,87fe0b14,16ab1048,3a6025af,b20e8c19,3bbba444,2864c587,2c0da181,6507f8b6,4c9e5684,a4d53d98,d6b88215,772def9f,fa5a7a1b,f2b2ccee),
+S(2223484b,9ee12b26,2a21a18d,2682ab01,c291ee1c,fe3b4b9e,2e93fb67,aa08535d,4cd26418,bf0d62fd,b266a768,5f7aaffe,d7bc95e1,be41c6bc,7a0c9076,1ace3974),
+S(aac92330,7d6a55d8,552ce6f3,9c531d5e,afdd5313,f801242c,21df07b3,a656c618,93d9be6c,590901a9,1413cc23,94cb426e,e6a61593,93511c,e67e1ffe,68b8f3c4),
+S(6ec1a0c7,fe40c40a,f3515ff6,60f0b53b,8fb6be3d,d912f8b2,c7a473d2,3e49d201,b10f000c,191e9423,60fe6b5b,2b6b7b85,73c0c2ee,384dedd6,e3dc04a9,7834f93b),
+S(bd982a5d,a4d0291c,38568fae,ebc76df3,f2b0e5b9,1cd0d3b6,d2f32077,6c35c43,48566068,d5142f6a,90b13105,e7841d32,38d869d4,fcc7319,3e3cc9ea,76739c5b),
+S(25d54513,b9084ddc,a3f20e18,94382290,115ad5f2,dc72c267,ba845b3c,6ade39f9,e908508,7fc5efab,a6f62c41,ea8fe856,226c8e2f,95dc31fd,2b49a7c3,6aa53b39),
+S(29ab6cd5,add595d0,cb64ead9,c3d275a6,ce383f15,9340faf5,118ec2d2,9bb9a62d,54584613,dc27c249,d5d1210e,9e121aa4,7d606fad,1c4621e1,67f67b90,d8f3434c),
+S(4cfd960,86f86d5,bd805667,55979c32,d5419dbc,946d63a3,40dcc6f,6d6dcd48,f032b7b5,9d85d0a9,fdc290bd,a1fc703,55b5404c,f70d45c,d15fa9e1,33ee9319),
+S(9c786066,b6642e11,139aa303,800314b0,6afd4d97,e8314a1,de9d7002,5b7bbbf4,463a2ded,e2185c8d,944f29f0,140f6b66,9ad6e3aa,8ab6e292,a2af551e,685e58ca),
+S(4e98485,f15c506d,6cd29d7c,3f9a59ea,4bfab065,78d86b63,f25e74e3,e7aea96,2baf3fb1,c26f2b0b,1a0725b1,5d1ceeaa,7ccece9,a1dd8f2,7f80d825,d8cf1d71),
+S(8412c389,bc88e9bc,b157d835,85af0dfd,48689532,e38044b9,117b8acd,ce3b62cb,17eaa404,ffc1f62a,38f7ce99,6216b1f,40bb62e9,6d1f7a5,8bca370,c0d30b44),
+S(31b9b8dd,7d37b38e,892e94c7,a5e817c8,ffaa1c1c,f56979ff,7f25815b,758b6d09,cdb680a,ae795ef1,f94e7e87,50ad9077,7a55eec6,c6f0795a,ef951e3c,ab45d186),
+S(2be45d05,e89c58b1,8212890b,b6eaf935,6f03e37a,fd957291,4ab71a97,7af8350d,c3b05f04,c9f7a1db,b6689fe0,6ecf7a80,3ecaa147,8d09a1ec,9a7d71dd,a75406da),
+S(5185cfa5,fe6302c,b5573594,61f375dd,c483a66b,c615b5f9,30abbd4a,5c7ae0c,83cc447e,53c91e07,6f44d265,389bef06,549b8d78,9776000b,5c35ce36,5fcff98d),
+S(cd42328d,e4a16323,c51ef888,b7e67ba,f9ee1c53,82161b90,65e1db15,bddcffd9,caed06b1,7e86b470,b665de93,74725fdc,94792c57,5509ebfd,f012133e,122302f3),
+S(7a1ffea,8fe5114b,8a638306,3b7811c3,25a40c19,42451557,679e75e2,b304ab91,1ef3fbde,4f0283ab,96efbc83,bcbb5a6a,d781a215,e6ff6262,ca50b9c3,986816db),
+S(cf0bdf47,a3f15b24,5c7136c2,3a3e38f2,661fa8a9,4df29fbd,8b41ef22,c291dc6e,c73d1fe3,919e0aee,5b3adc4b,1a86e709,4b039302,d44a0d56,638c3eba,24857a99),
+S(3a571630,935c1f02,d6fd8744,2c082060,cd5e792a,1c6f92bd,c4eed01,686df50d,7a1ec78c,4a660cd0,ae90c00d,1a8f5f22,1f5507e1,4487e5ee,2dea74d6,17a69494),
+S(1c5e5481,32b49a7f,66ae9fed,8323480e,d1ab974,622e7cf0,8993895e,ec87fac,b00309f0,7c80b970,d446a605,e2b3d52c,5c215314,d901cdb3,aaa284c1,a03d2740)},
+{S(2b081f0,268d6ff4,1090561d,79144bb9,554b1f3f,1f0f2cfb,c9344e2,b692157a,597920fb,c528543c,26499af1,8b5e7d7b,5ebf5ada,5df4a46c,edef52f2,1e2fda5e),
+S(2ce45dc7,d84d3143,884d6696,73738e55,e30f6045,8bac95cc,c30e86f8,71779827,deb79108,80a1b675,a628fb09,725c9307,d1629b07,8027f566,29f8560c,2ea80458),
+S(9dfa0cb6,2a63244a,35ce3a0c,f102e7c7,93a4530e,21c6c03f,15a4fb91,e116c480,b01c1aff,902f0831,bc8cd268,663f0ce3,6d8e22be,86026460,a8950636,ce44626b),
+S(61a32d1d,cbd7e887,def51ffc,9c1dfd55,d06d72f6,a73ee2df,f83cfa0f,52d47bb4,69a3b17c,fa91e3d6,faf28d83,2695aa66,c87b14ee,7b2d987c,80242fc,ce2cc42e),
+S(8cbbac63,5414c0ac,b6d7f659,5c6eca39,886c3ceb,82549f72,d07a4019,e3076eb8,c838dc49,fd5af1b5,e503a430,71901bcc,90e1ea38,9f735e31,236491ec,43e7b621),
+S(d3f77c5f,663c6efa,670b46bf,dfa96af4,fc4720d8,e1df6e8c,1ffc5696,f37cb55,aeea0c3e,50eee6a9,16462a13,90ce5d47,c060efff,1fd3108,1db77513,34300332),
+S(6f774118,4a0210a0,79695d20,f93f861b,658137c,3a072076,7d80e5fb,8b1ebdff,c12aecc9,b55bff04,bd6b6e73,870deadc,666973b8,ec498bfd,bcc4c33d,23f5d674),
+S(fecfabd4,897a948e,5fab7200,969f9955,9eb1c9dd,2a31325f,34dc4f80,13da72c9,ba70c9bc,c8048aee,6fdaf5f1,8ef638ba,ce739c0c,76ec4c13,fd4dd6c1,1663d02d),
+S(d1a1a1d4,24fb5ab1,3e985c86,9bd7c02f,f81b4633,dcd22e96,c3f33489,2e80d543,cd5b79ae,af62769f,dce99530,8b921b5e,39a60fd6,f989dd7e,1d0d7219,e9ee8865),
+S(7099682a,c3c083a8,80467746,fb924d4a,56f23d16,a3b57f10,1a824b9e,653d45,6a9c296b,cdd72c93,df840003,24ce78b9,1f9df6b2,bfa33922,ef32733,fe49cb31),
+S(1035866a,4e9ff0fe,6b0066c6,3f0a2392,c0b8cd61,36e13ada,21f6dae9,f22c39eb,6390f9ae,ec1989de,2146cd00,a5eee99e,76ea4536,423e9bf2,c778ff29,85538fa8),
+S(e18351cf,163e4df7,d31851c0,409b5705,a5ffd472,dbda5dd3,bf05e66b,fae50fec,264c1d26,41f185e2,72b908d4,77222484,c651e8e1,9a9e1fb0,1ec5ed4a,8a4b6c08),
+S(dfbee778,ae4bc89,24f32c18,bc0a740f,d01922b1,28e1a595,283bfb4a,fd8f2f76,d11f9b3c,25ae3619,99ec2c9c,2f1a5903,d80eae59,e096c5d,c5e37201,81756acb),
+S(842cdb54,414fa977,58ae3fb1,9316ef32,af9c4f0d,649f0abd,cb94267a,124b59fe,a016f899,288f4caf,dcc6edcc,3cbcb561,fdb4047a,f789e1a8,51ad21b3,be62f5c8),
+S(3deb5d22,a81540ef,cff29ac5,585a056a,204e4d67,2fb858f3,5c23e939,790c744f,20d73911,5b24b1a0,a4b31302,73321dc5,d8b74398,d6516439,4e1423f8,b4022d6f),
+S(3108e61a,1e0f079,f76e3ab0,d69cf068,779674e6,49768aab,718a09b0,640251bc,245a9f2d,141f390c,f1a17bcc,a06c5a66,5cf3a87c,1096f5e9,b04c4fd6,737d9a56),
+S(63b9eaa,ce6b32cb,e4cf4a69,6599f8fb,3797bff5,9103ba0,c1351e78,b16cb0fa,938ac414,ef911df6,bda32b5f,1f69cd7a,87a25d82,177763de,568ca95,e846fa5a),
+S(f37a5a41,cc96a04c,c882c27e,e362d054,7d6267f1,c91c5403,2daa5c12,1700abda,108bd6ad,27aa72de,48406693,758a74df,53a3ff98,d490e303,54c45ffa,c64638bc),
+S(52afb7fd,6a16dc6b,98f9d7d9,555068d2,c2317035,b7492e8a,fbf28aea,3b1fcaf3,548d8ca1,2cf7a11a,b0100455,c7240290,6cb2e92b,101d1e2e,32ab263a,3f3de413),
+S(f644fce7,874e9154,8f3fb284,b7d1ba17,fad6eb6e,c581f57d,5aa11804,86de9889,b2acbd8f,5bed4270,ec131ea,1891c99d,ddb46648,60acaf39,d68d2a54,a58b92bc),
+S(863cdfdc,66065a4,50c2b7c3,1d694c58,e63ccc09,fccfacdb,4fdf0b1a,b150e937,14d168dc,c84d859b,55a3d5af,9d17ce4e,83bd90ed,55e099f2,50932dad,b5d2693a),
+S(9f5569e0,50a26288,5d91f82e,9cacdf9e,f4487676,730f4da1,46ce8769,3d8807ba,cba008af,547e01f,6a9c6c45,8f9d71e1,8ad062c4,4b305b52,3f3a6655,3979a2b9),
+S(a0f14b6b,99f0bd74,cf9864bb,17b1c43d,51ade513,6cd72a15,89312dee,706d50c1,e2bd2d82,c549b4da,cebfb888,c1a7c5d2,f0757fe8,53e07fb4,747eb7a1,542137cc),
+S(9e7bd727,fbab45a9,db36d17d,5e5437eb,f028a10b,392ea470,d5cff0d3,2e9bb0fc,fb52eb32,e43133db,28125280,e3cc55a6,76877c58,b4051f70,9c031f84,24f12d9f),
+S(7d8b1a30,4c0c8931,2d5d712d,ab396efc,7a117483,7f62bb38,62a81a3,660b1068,472a2dbf,ee99c398,94d14c1e,ce87cf17,c8aee10a,4720357c,c5ce79a6,19aafe2b),
+S(d5eb073c,a5afa126,70602de8,417fe50d,bd8f0768,d615ef2f,565e421b,4e7842f9,52571e4c,e4f0c424,fd288f3e,8b6c54b7,7481c3a,43230fc7,4c6f48b,d4041089),
+S(3c41cd8a,77728b07,ea592254,5ac45462,2c7927fb,6a7aeefd,61635cc4,217acc90,eab0f00e,84099fcc,c2f4d339,77ff7d68,4c035b3f,34c6c4e6,aa812c9f,43af366c),
+S(1eeeca5e,cadfae31,188218ae,7beda45,57f85c25,5c99dd64,1d00d8ce,2e6f7809,d7e5c2ff,4ddf421f,cf09b655,113b8cf1,a4c25e90,d02b871,91dbac55,d6606ef1),
+S(54c13737,454414e1,76bfaf1e,b4402bf8,678daab1,555412d0,c6d3fd44,653510ae,753f6a,f382d0be,f1dab47c,1b9368f9,57d586c4,acef0d19,dc241ce,f008ea3a),
+S(4d608c37,1fd6f635,9ffc57c1,9f1aa5b3,5b0f5702,55851cec,34278d2f,465fc8f4,12d1592d,c2cbccc3,7e5c9fae,4b864e9a,ca6967e,9d4852e,9adc9e31,1000670f),
+S(71157d64,8c0a1a33,19b713af,f806cf9b,c91a446e,2ba48ca2,fdd1ed4e,8c43da59,c2ac2aeb,a298fcfa,c0d5eefc,6eae54ec,330f5c0,5b34952a,9821ded3,9b72d383),
+S(327f876c,93652555,fa80a054,968b4712,930dc930,12ee6b8d,c10263ed,3b89a762,4d2bfb15,4cadbfd9,4f6696da,a1e66846,8aacaf8f,1428201,636026a5,46dfc92e)},
+{S(4d3b98d0,b5926a8b,3e5622d6,10b30e88,caa6e7ba,eb10bc3c,38aec3c9,c1267578,e84056d8,4726291d,e6880a2f,2d3b0b01,371dfa27,5b8c9cff,4805d18e,a5bdc788),
+S(6e463689,111d1a5d,d10b09e1,5d0f438b,1cebdb67,7a6cd230,bf6349c3,70667db9,de10eb3f,5d2f4320,7265952f,b33fc23f,154972fd,d3394cc0,21b66276,1b51db3),
+S(48235e7b,76c94c32,b0d21bf1,7fc215ed,df036366,a9ef494,19723485,78db8943,4f5ac8ce,36c77403,b2fa83ba,1fd0e88a,3da4c8cd,3c10ddb,aafe2d0,5da40a2d),
+S(668af7c1,4063dfba,1a4187f3,f69cb457,cae4edbf,a3bf9669,4080b6de,bc3e2f0e,ec95f37c,7bac26a0,df23275a,283828a8,5a102d8,f33eef1e,87cb56c1,850740cf),
+S(d4426fcd,cbdfd904,725fb501,656b9f2e,2a9f9ee3,c6522064,f078165f,61c31d97,e73f2a38,c56838a7,174ee704,948d28fa,5b5fdc34,7774df9f,72f27834,a85eb4d),
+S(d0f49ec3,42076b68,4cd91172,f15584fc,ea38aaf0,a3201063,f854ff1d,f68d4600,28d95ef2,82dd7d6d,72be7854,e8858b1d,a142002b,ad7b7b4d,bd1e582e,94341e16),
+S(8a36f3c3,50bc0f1a,1b1687ed,4ff83a68,1578d74c,c28fa875,f6969e52,4887bbb1,15ab9e05,c3ff823d,ba090e21,1033c34c,fa713d39,feec4346,88e3ecba,4b431e10),
+S(4d1ef23b,b316e821,7d2cc409,a1baa273,cc06f79,8fdd4d16,5d5b6805,3718e238,fc37e62b,db18154a,2add98b0,ec221e8b,bd1a2096,ac2dd1fb,cf8e2e64,821301fe),
+S(eec1f8e5,76e87803,bac48bb4,65ed923a,a68b2965,64365d45,bd1c24c4,cf7041b0,2c6985e4,7cccbc38,3b85be66,ab34a166,c98a8000,aad08f73,616e4d2,2a15a009),
+S(9fbc20e4,de372a38,90443786,bd7cfc40,c6195b29,4cf51874,6ccd9ecb,cee223e9,f734bfc8,a6973209,903edaf8,52f63bca,b23fc1a4,879906b9,1c5df169,9d24683a),
+S(7984c8ec,a2b02dd4,e8b9c69c,6f803418,48f108fc,b63d7038,de58e567,e64a894,49adeb11,13c705a0,9eb01e50,dea5be48,86e5d424,689282ba,6d64f745,74f45e8c),
+S(29a7400b,16f5712a,2324becc,29fc4b98,57fbb926,f8741dcb,324c26d9,6cd178a3,90770be5,5c0a94a8,16bcfa38,aeab11aa,5ec3b7d9,eb4e7d29,1bee1c02,69e87267),
+S(8299d2fc,84770bff,a4e630b9,8f2e6744,99b1c7f5,719e907a,d70515f5,140a00c0,c790968f,a3c3d4ee,3e25a1ee,8e1d4923,3c22f034,ba7c172,b5d7d91c,99eabfa8),
+S(5cfbd498,5b608db3,5d1a2872,b9cd03fd,d775e498,4629f41,61a2bde4,fb2582f1,8288fa89,81056333,acd1720b,bde757b4,e83d0a49,9c5f2220,521a0bc8,dbe827f8),
+S(281f1fb8,e144e39d,9ec2104a,96bf0f1d,494eaff3,57fe084,63825228,ecd286e1,ae40e075,d19ee5f1,1dd7e22b,f1c277ed,9a02abe9,975609c,a7c811f9,7c54e493),
+S(51698bc6,73d3289d,6b4882b0,cab14e67,97d31221,e5bc6e53,af061aa1,9f546daf,7b850099,fe977f6c,f50abe00,bb3a0b68,90f47c45,24e9ae02,94304b6b,20bd986c),
+S(db701e92,9b696c86,d7fb459c,97af90df,ef847bf5,1d235337,2a2a4792,5fa8ae53,edc7e98f,1a108bc4,8fdbe65c,2904058f,7da5e188,e71d194c,4e9dbfe6,8a55d18),
+S(c900f57f,e9a31d4c,9715a822,5a906e90,22d81c12,714006d5,81be0c7b,aeb5a490,8493eb00,90517d9c,b70a4bc,39043ffb,e0863475,17cde2,a9bd0d95,f616bb66),
+S(d74e842a,fe2da0df,df6342bb,582fc223,717e0641,f1ce0e14,584c5c63,f379ad72,cefdbd7b,b4ecbdaf,409a0fa3,9a0a305,b1bd986,4913f977,bec6c47d,5d525c10),
+S(b00a5f4,f033d126,64366147,a1bbb9b6,ea60a38b,863c5f3a,e323e8e5,1aee200c,11e9f1f7,b7701a4c,26a881ce,30fac1e0,92e157d7,b9c2e4ce,cffeb38a,172ead87),
+S(5772b134,68bf9f09,d26074c5,16dd7472,d3a83624,92306cc5,c7544ec0,d73de280,2e2a7931,aefe2a31,6dbad1c,e7f9d42b,7f38197f,43024f16,9e27fbc,7af31d0b),
+S(8bf8af02,ccdafb15,598f6725,5f172fb4,ba8960e0,6c81ffa5,b4c1c313,6f95f29b,96041af,1efd128,ef133e5e,b0aa3d9a,6ac3a651,92598b09,ed649847,385a9b2c),
+S(292889a2,d8329139,3410385f,cf5bf489,7e1ee23c,e0e3b5ed,82ceb340,d89f87a5,41099fb2,bcec7e07,d4d4ad14,3cf605d1,b0a32487,1736063b,e49b06f6,d648aa69),
+S(ad227b2b,737dfd02,665c15d5,9b28c7e8,76413dfa,25c9068b,90efa79,ce83142b,82f1eef1,7e2f6b86,87137302,741f8486,26fad679,9c6a22fb,3a49e341,c7e51e9a),
+S(b4245dc5,5df02839,4cff2610,4a4255ef,89f3e708,21541c3a,4631ee4c,145bf85,5a40f72b,7a67540b,6858e5e,b15005c1,3fee862f,3cc54a52,7643204f,d0b8be2f),
+S(15aaef61,568537a4,695c1990,c05ecb9,2c605232,f705c3e3,729720de,7e9c2400,e6efd1fb,b74e9e43,ec1244e0,bb4cff2,2a5ede8c,848a4f5f,5eec6f8c,77b6f5af),
+S(ade2e63d,4a828328,b4c53763,30790331,734d7f90,37c1a584,59570c8,f31e72d1,c42898ab,3633dc7b,f3a454f9,d5475c4e,fcf1f786,d1f609fa,23616f26,b23a1a97),
+S(d8a9043d,297681ea,c5ed63a5,de306500,6b66e4fb,167aa5ec,c76a8e2e,df426e7a,cd3de058,a0a93d7d,7122d777,1446b2b4,d4cf53a7,1759fea3,78adcf03,5093f4f6),
+S(30651cb,592d282b,5348f192,5be3f04d,da5033bc,39e2fc7b,1e61500d,9769b57c,dadf77cc,44853f67,53b1dbdc,17a97d3c,e6d5b2e7,8c6087fa,800c5af9,ccdc54c),
+S(aa21c60d,6f7d6253,9d42bafe,95c58f30,33c0396c,fa0ceef9,6d2f91ed,d6569044,4d519779,3b19515,92e2d952,2be520b1,11a5453e,ec6d7ccb,3e6db3bd,3d0c84c9),
+S(5335cea5,e99eeb23,765b3444,d9bc7be6,1da67d6,91bcc42f,d43ae543,e9c22bc,c4072fdf,8963addb,5f980f7f,f314795,373cf3dc,935e0e64,c3d3d98c,342530cf),
+S(708a530e,9e52c73b,ee87c9d8,8161c810,5d5762,2c29ae69,1cf999a8,3a1187a5,6477b7ee,1e065768,569a923,4492c7d7,c13258c3,92cac175,a75b0e63,b8c2426f)},
+{S(3fbd5a4d,ebbeff54,8c2271e5,33dbaed3,fb8ccc23,e3fa2579,4c8f7fd4,47ae186e,fdee4625,45bf75f5,5c29a724,6496d970,4616c54,ba01d0ba,feb9155b,cafdb555),
+S(c1483ec1,78ba8414,c371b57c,49c687fa,69669e2,e3e1067,cc6d2a93,b1a9d24e,edf94395,962adfed,c2ebb3bb,29346136,e4dc870c,5c76299e,3b07da35,6bb26bed),
+S(26df4b09,693a3905,2cb7a1be,5bc2cc97,222b70e3,3d297a54,43741228,beb77017,a3d6b908,cc6d5f80,aecda93,99e17a8,ce33c423,f00cfc4,dea8354,af502760),
+S(b6c265d5,90475506,e15b2388,b894718b,be67aee5,ba40ceca,51876946,e336d903,b451d3f1,2c666c85,bf9486cb,296c39f9,49f9f98e,96d50a19,80f86f85,a1efb999),
+S(da6cf69c,feec7b1f,c848639a,7e27932a,f49cd695,a2e56a50,693fa862,6e257c66,4506f44e,e6e0d822,7e67dc4a,9f8e2ec2,d3ec0c3a,c2a70c7d,d25fa9c,34cbe3ae),
+S(d57648db,adf18b77,db185ffe,3f86f859,6adeec05,ffb86215,4b894a0,75776eac,a3f2fec7,7186d81e,4228cb1f,691e00e4,82a125a5,bbe9e6ec,45a53604,4932491e),
+S(4de6cc4,d64d52c8,49c0e8d2,45409ba0,88248399,1916df3c,238be4de,ee2504d2,b389e7f1,ca72e9e,1cec2ed7,70f21441,590f0bab,1b963f1c,411f9bff,d3df03f0),
+S(15f1bb11,78b01439,f26412,1d36a44d,b8333fbc,eabeb471,da2e6c1,1b8b3ee3,bf137117,35e10854,95acf3ad,97fe510b,33d6628f,e67d0067,499169e6,6c12274c),
+S(badc76d5,481e77,9df71d6e,223c6965,9e9ecba5,8415a95b,eb7118cc,b1f931a4,475e47ee,115d258,3f0607f1,7542ccde,626e6d57,6ea884f9,61b41354,aef37247),
+S(13015ae5,d770f4a9,75825bae,a6cbbece,78536dcb,78d7116e,d304aaca,199add2b,f5e28585,7a99ff0d,a4fd15e,8ac650a,98421629,aa102bca,25df3930,7e5cfcbb),
+S(7734d2ac,707b9b53,afbd2a64,50c9b609,1905c391,958d7215,f92353ee,fd3c7be5,751d38f,ef48bfea,8fa5de06,8188a658,ae6c9c75,a359a4ea,efaac5e0,b5e859aa),
+S(91814384,7fe2ed34,e9cc9c61,3fc2c67f,2b76a208,561d0e06,271b812f,6c678856,9a97f6e0,9888e076,93c9ebec,b8773485,c3c5d208,c793a77c,6984fb09,cdfd67b2),
+S(98c516fa,2a2c8073,70ca9d7c,b4187108,ea345652,c8f814b8,b4a9405f,b48c2469,7b3446f3,2e8c4764,a8eb0846,4be3bc6d,f42b8d14,b7da65a2,ac96a018,d0831c7a),
+S(5691d1e3,713302c7,48bf633,189ce032,10832e4a,9af1dbc2,abc3e99b,cb4faa01,d802e21a,fab84c54,5d665ed3,54130d9d,f7f18283,30b3a1fe,e30c2298,8b71654b),
+S(1f8cb624,6440b640,aadba62d,c02f4ce7,a0ba9be7,d535987,64072fed,95c0d1a1,647a9dea,abf8247e,f46b60c6,53cdcd5e,cff0d1c6,88b7519b,a778f9ff,c894e1f6),
+S(1489af53,94878f07,5cfb2e20,931fa3a4,e585d494,78818e4,f47f05e1,2be54d14,cd5bd721,4e535822,43270bc2,dc692ba4,c57e494c,eba92d4c,dd2e13c8,e24d8550),
+S(66159248,2b2229d,ea70ff76,d2a5e70f,ad1905c0,9211e3d6,2d1d652f,ccd709a7,8f5ab85,57948aec,67e7b538,fa9c704b,ae939c22,4041e6e1,65f6045b,a6fd0fdf),
+S(bc894efc,d0fb7497,ba70d654,961aa79b,6ac5a795,95537c80,82c525c,2c44c3a1,d5254292,ef0fb6fc,db587393,3b17adfd,87d13320,858ff783,75e356fb,b0d3415e),
+S(f117d7f6,85457601,9b559bf5,f5bc150c,13363e7b,72123435,b441d98b,d169dd27,a8f4a23e,dd0d8f2f,8950c124,1abac43e,e629b0e1,8505c3bf,780ea378,20c8623f),
+S(2a8d99c2,65a66a51,56b60556,775c61bc,b2a81a62,34896a31,16238c2a,b7716ec3,5e842306,efe11f66,5a049c0b,fe3ac74d,d72c5033,6dbd04bf,2a77b0d2,4d7ea651),
+S(ea747597,1a6b6d94,2e368bcd,9979876e,afa4622d,313d819d,5e8291c8,2da95830,41d4a478,e0950bb9,e6595bef,3c197e5,d0f77ae,6340ca8f,2947fec4,70465193),
+S(114150c3,fe8853ed,9f3e26f7,bc9f3d6f,aa50ba0e,6ae2d8ff,97924b04,dd9678b4,5530c22f,4ac30716,2b272015,460426ba,9602256c,ab735174,1a2fbbfd,cd71d134),
+S(65d96017,c91a746a,656eb595,d39dc9bb,3476dc0b,1a1036f2,df7a4ea8,1846631,de46bfad,6999b108,1f358edd,7809919e,4de768f1,fb21dc09,4b248bbd,56b3dc76),
+S(f2aec214,61c040c0,ebd18204,bc277312,732b452,266bfd55,aa071853,e458bea7,52a1b71a,eefe2c48,5ae2918,e236f1d2,1622d37,13b4bc04,36124567,d48cc453),
+S(370ef89d,c39e637e,8bf6be31,63a4f76,7cebb202,c868647e,db18f991,977681de,e6d402ba,9769363a,b963729,822bd6aa,9794592f,36e54461,579ae53d,4c8bc4cd),
+S(8db6356c,4f31f46f,961e4342,a1ff50a1,8240629c,a0decc36,e1bb24af,f6742e57,8ee033bb,96958466,15626ad6,736e9025,fb76320b,c2d0ceb8,ce3400cd,743f934f),
+S(14a1a08,502510e7,1060f291,1316ee01,b1fc2bd3,c88eaa1b,656cba0e,8e3515e4,5a4dc536,b62c349b,c9bfc6d7,fb677231,1368655e,fcb9c89e,572aa58d,a57f08c6),
+S(d530fc7c,4d5b4fd1,5f44ba0,c0f08f24,889b278a,93ee30ab,935fc112,5e244a58,39c0ea88,5984c2d1,d5119a28,7cd842ca,d3cb54c8,ab6aa222,c01e7152,98aad10f),
+S(50f3c13c,a474f604,ca992658,bca68207,76acff7d,d507d63a,b5e18b28,5c5be81,685e151c,7d8fddee,6c9d8513,dbf167e2,c32dd70f,b6932397,38eb63fb,3e4f7afe),
+S(c0a72dda,13174682,726ede1f,7ecbaa68,b4b137f6,d44298d3,4e17b7fc,10e19d4a,1e45ff3e,4a4239ba,4a897489,a265a60d,9a91f3f2,83fe2e75,9e770156,c9ebb3ca),
+S(7121e14e,7e2a2c57,76b5702e,c83a845c,28785c79,9099a007,54b50fca,b4d9279c,e6b3ff5,ce62fa35,adf45e69,2ccafb91,b805d7cc,b6eff2e1,38dfd680,d0684401),
+S(c0c01f34,ae41b8cf,e466b4c9,c6a5d5f6,14f570d6,fcbef768,a81a6c8f,5ff4adb,f47b0a41,1bca80a3,836c85f4,bf8a4731,3243bc2e,8f2ea47a,3b1008b,53caebca)},
+{S(4f20ce51,84fb2949,443286cd,8ea201eb,15248749,6e15aab6,f3ea2597,d4cbf47c,bf37770,62691c5a,d6c6cb8d,c30fd3b1,73578a3,bcac43c2,c8404b6e,c085c97c),
+S(17ceec36,7fad4365,520599d7,62c66c12,5abeff81,ce7242dc,bde4e799,402759c0,91e024e1,e2147fe9,73091001,984dd3c0,9f887257,73bbbedf,47f00c7b,c5c9f626),
+S(dcffc4a,5557f2a6,ac7a3527,5a8228ec,325ea0bd,d9bf52c3,8a78217,6bd716,87658163,dcfc39e2,ad08a499,898a1505,988d9b86,72b6d1e9,64e6845b,cb41129e),
+S(625fff43,45337aa2,1efa0884,73a6662e,d5340470,a79576a4,362e30dc,bcf762d4,92ad0a66,d0bea2a6,d7eedfe0,e33295b9,3a656e45,9220026a,5ff3be8f,83184187),
+S(410b96fe,7db23faa,7d123e97,c1a82a9,7b24a26a,80143e50,dcc6d9a9,1a6e81d2,ca0da356,dce88799,5f8cc790,64d197aa,6532dcf1,20fe93c3,7e2ff4e2,f14394a7),
+S(8136e51d,ca68170b,136d40fe,76980b4d,d4f435fd,e38f3017,99de734c,b2491551,823dd1ed,de1d326,676649a3,9d5ba083,7c48e180,ecd0a648,eaffe7c8,2894e819),
+S(64a67d9a,a7a31390,3ed9e348,e7300917,6c1d52d0,be63f54b,aa3ee8f3,f1227a52,ef770581,df4aa013,6d191e99,cde7f42,a14fdfbb,11e1b709,bb540100,1dcda1ed),
+S(5fcf0465,a905aa8a,a1da5073,d524e8a3,30af663e,f4307359,c03a4c6c,c423dd9a,58641e67,fa821fc1,2307a66e,fe0129e6,4ace7c36,c3f5395c,db87667e,5e742a42),
+S(aae6747f,ac3d8c9a,148009ea,c2d25574,39a8b546,455fb3a4,5016891a,f9372dbc,66084f19,b1d97f2c,22e182c,d5450d43,d56636e4,92651cf6,22772a7c,5b46d9),
+S(377dc2c8,13e36bb4,642d1e02,cafce754,2ac6d9fd,c2212edb,5432674f,38e242c7,8395dc2a,39d3b1cd,ae9d7d37,d0c4597a,11f931d8,75c8bcf5,8eab03d3,674d5841),
+S(35c598c0,7ac5dc3,7afe6895,29d815e9,406e2608,292ffa0e,7b24df65,3278d8ce,e793aaf1,45f538f6,c133309e,53cb5343,dc1dcc74,985c57f,27361c6,aae23e7b),
+S(e9666336,6bb286d6,c86f425a,2d5658cc,1d733223,9ec2e9de,c8ab7295,4b329845,908dc533,b6098e9e,9b737e4,b96e7345,e635f591,60bb3df2,75e165bd,d1cc5998),
+S(46fab0d4,7fc6586a,31cf861d,ff5e0bb8,cc12b60a,53103007,c8974ab8,204af703,845ab7de,7654fb36,618dbfb1,287534a9,2d43db6f,2a2cdfe4,5365b4b1,893fbe9d),
+S(4d80486f,fe748d1e,f88aabff,76bb82c6,a45db736,76ee0ff7,d77cdffa,2c69d07c,2a52044b,d4fc6a59,fd16dabb,df35bb6,8057ad4c,292e87b5,528a3847,c8784638),
+S(2c1d108b,f4945c0e,df62cc15,6bf0830f,7a45ca,1baa636e,9f759bb8,bf078a55,81e34495,d269afbc,1be39ce7,5417ebf7,d45decb6,eaddb635,4480a7f7,8d7dd34d),
+S(320a08af,eac009eb,7f254b8d,395d836f,ca6ea527,4e2f309d,dfb7f120,2f1b3cdb,75269a2,41199c0e,5f1cd9e2,d102a294,2324a3ea,cfae231f,99ccc5f3,e0af00c2),
+S(8b893fcb,9a524af2,6de5aa38,8ac3dc,2159817c,7062e5c9,d5c9e7f7,dd889ad8,cec6a5ba,481f7e3,88c1cab,c11505f2,39afa143,68977ed6,52ea2d6a,19d2cbfd),
+S(ea89b95b,36cd5203,22c8e5af,7461f9e1,a054f23d,2720469,fa74cd67,3a52aab5,5325d16c,4b866865,2437b6b8,598b31c4,59e6101,2cc1b147,e0473527,5935ada5),
+S(cdfea79a,8c16ce78,75a9fa1c,5b7647fb,ad641ffc,5b73fb31,d9354a1c,3c1cabfc,184c309b,b0f52999,2a3f6b93,77b9e6a7,6da6b943,d8031408,b71223cf,b3ba9100),
+S(3daaaf0f,785a6397,c652331,630931ee,a975c522,35899736,1b7e5fcb,409880fa,952efec1,ebd4c107,b26a98f3,c6683903,a498c840,ff4a36c7,ade569e4,c899919b),
+S(7cea5226,a56d21cd,45bfdbb0,7fea6670,40247c70,ef43da28,d1f8bbf0,6e4ef2a6,b03edff9,6a5f32c5,6f8f63f6,ba9feb68,f43cca62,391ea587,81396c7,5d963b67),
+S(1f5f4c27,847ba921,c63cef52,8b57fef5,5bdb5344,ea67a23,c173828d,c59199e1,d37f6918,e0b774ad,317dbcac,75c82188,c8a421f0,ff5756bd,853a05b0,c95ef089),
+S(36cd4da9,2a77613b,6417deac,1d9a0dad,1bf0e506,de26b529,7fffbd03,4a4663f3,ec1dd8f6,6226bf5f,fedb071f,7027f9d8,d931e6af,e378396c,d0d296eb,a63737e3),
+S(9835c156,1be21ce5,db788f1,3c0aea13,fde6861e,97cb2cc7,a67fbd37,17eefadc,7fad454b,7372d969,a6e754ef,c73415d7,fcd4d589,c8e255c5,1adf5a9a,82228f42),
+S(5e218414,d9c9f0ad,35ded20e,76a484a1,d41b3894,ba9d3be4,bcb4546b,371d0e4d,76966ecf,9c8f1c9a,452cf971,10ca6555,2ca59d31,21092e93,333bbd61,6eb9cfcb),
+S(b105f4f4,40e7ea66,e3272da9,d6b2b76e,d00e96a5,6f95224,34ca0df1,5340c585,9e8fea7f,35bc9eec,f82ae118,bcb6dc33,acae587b,f37b149,1f8312e2,4ffc86d8),
+S(81d5713e,a732b4d,98d085a9,75cac9b5,3fa65171,e5cf49f4,684a7856,7c24fea9,32480cf7,a0bc0c50,a4de8200,9343b524,4a0f2aa8,ce67b11f,4a5482cc,6fa00bf2),
+S(d47b4f1,88f5e7ed,a9eab2e5,8ad2c140,c6278d63,517bfaca,8cfb64aa,cfbcc7ec,524f6580,9d3ee034,afb1e64b,1a0f8ae1,1e464915,3722e345,bfda9671,1b94a5),
+S(16e85ad8,6a953564,39b97957,7bedd0e9,6e2eed72,76ba269a,626fbd58,447996c0,8bf74f51,4bdbb6c1,4de81a3,1ff12aa5,de49bd52,63a962ab,b777439a,47eadee7),
+S(c299c6b0,6e6c78ae,852bd55c,dea35f99,d264cb5a,e836b77d,ab209ac9,c05201e1,a558c66d,c9ee7fa4,c777b0db,288b328,428b230a,7c53d516,522ccec4,af0ae08c),
+S(63c4624,35ef974b,393b05b3,7d1c89d7,b0d8958,ebd541d7,584e2bbc,7235c795,1d806446,ecfc7bfb,bce099f2,6ce37a49,61b53453,5b65642,c0cd23f5,a4eef9d7),
+S(6d36d105,ed8cc5ce,53f2cb69,8ab620f9,469a3e5c,b25bf6e6,d413f414,c5af726a,1b45a3cb,1c889961,8d273993,6a3affd6,233a66c9,4bef75ca,3a8fb6e4,ec05ffb2)},
+{S(abdd85c7,a2f8bc31,343382d4,e405978,3874c8d0,1405ef14,85047cf7,f0f71d50,d5a03157,798fe828,a03ab63e,84bb007,b53a5315,1db7af14,e4ab612a,736232d4),
+S(31297c6c,f567267b,3c8d65a9,72afc752,e8525eb3,de2958aa,76f72e14,5ad903d7,f4735877,a6c6d89b,d1beb50b,edd1235b,5f5e5d0a,878e4610,e7d756c5,34813389),
+S(64706e69,11a7d0a1,2e587c86,91117a27,cbfa64ad,1d5617fc,81e55b8f,64e0da86,59d9af3a,419957d2,b3de7570,15fd8531,a5d07430,5cfd7444,5e7e70b3,57e62772),
+S(a4988ed2,89d8397c,f1b897d3,b81d80fa,92658ce,2b935f4e,e2e3f0f9,b193af51,813fb8,73270570,50f23c3,f8082bcb,563ee366,1f6b2af3,f631f5f,916c8478),
+S(3c2769bf,af401993,595a01d9,9c72a6f2,699591fe,4b869077,8c6b5ee0,f172a866,f3e0d8b6,cff168c,95873f44,871d27b,df1e79a2,d9e0bd4f,6f90f682,538c1f24),
+S(49d93e09,df655edd,19548fbe,affce201,4c6822a7,e196eb98,b9ddfad7,3cb70125,26e6957f,84ced17b,c64f710f,b37656d,31ba088a,98350337,8f7323cf,c57f0eee),
+S(53c06842,49997cb2,6e5b4cc,5f166fe7,db0ec0bd,52639a27,d8fedea7,214a78bb,8a8dd3f1,b3081dd4,948255ed,dd178089,a0fa7342,1ea616a5,1f639057,34a489c6),
+S(7a8e7d18,3f2aa640,d0e2ea02,4cdca5fa,1767d9f,9ae38805,5d38e8e4,a81d33b7,c2fb92e3,5556fd14,4a894be2,3d97c6d4,30872ccb,25e239c0,d959a24f,aaa77397),
+S(a5221a2d,29cf3ef2,f066897e,4ee74ac2,95b34cd7,54390814,297537ae,abdf603f,ec0ff395,8c3a1d1b,5a379417,5a61cd97,782c9683,aa2c7c07,5d147db0,2b134278),
+S(3f49da9c,1d62eccc,afc4b88c,814e44dc,8440341d,f347de1,fb60126d,59578dbd,c3cf8e96,2fa9478a,f1be08dc,961734ca,5021a65d,b1b45f80,78fa8e8f,d2813a79),
+S(47b16636,f5a64b07,534be14d,6ae37af1,9da79b42,666b201d,d0afda9a,2daeb6b6,f1218111,31ebd87e,e1fd7c9b,d24a0a11,a12e842c,6c00f445,6a342309,9b171f12),
+S(a7b5a8ea,1f23ff1e,c1768eaa,2fef0d66,b75744c6,dc925d3f,9068beff,d69b32f4,fe01a23c,b0e5acac,e60058a2,889f9434,9ffce6c,b24f4a3a,662e0079,99bcb690),
+S(3e14e2c,e7044716,d42e9b6e,54cb0500,a1e4374e,18917336,e3205e31,4a878b47,18af982d,2c78ac23,818644f1,ec657da8,ad66bdb,3d5a9b84,3f8bb988,4ef8dc3f),
+S(71393e6,746d3072,830299c6,c1244303,750742be,361c5f08,6eb314a4,76f1736a,dc30a7ea,9b644339,ce8f1fe4,eeeba07,5bb08934,8135e819,cb061559,aa14e42f),
+S(37721b73,e6861f15,7993696d,aded49d3,78994f3d,e2b573a7,defc907e,d6f301f2,ee0e1755,d8efb25a,5cf4d783,ec847425,746fa442,d460cead,56e73a69,42561de1),
+S(7803c663,509fc9cc,55b372e1,dc0fa76f,149a0ca6,3db4516c,4abc0ad7,5961e4ac,356c72f7,794a70e4,db3463be,eaa847cb,256c58cd,b6a7d862,fde4feef,d896a46f),
+S(32976d3d,a3d033cd,c073b0f,c7d2f445,25646893,fbded1c8,1a0a1761,a8703206,5e6b7900,a069ce4c,65cd84cd,f290f092,2b936bda,af6ea40d,9c36a321,a7c9dcfc),
+S(c52c7b18,b5fae5fd,a4e3597f,39c96b8c,6d6c856a,80f1210d,a1ebfc15,34850763,b87e50f6,20b66865,307d0747,a02ba22a,b310712b,cb0bab6b,963c589c,c5a208b1),
+S(7de59c8c,3922fd51,68f4151e,cb783775,cd0bc0b,1185ecd3,6ee075e1,14e66cf7,688e2cad,e4d49da7,fe691497,412c9372,c67288e8,ca4b64de,308eabeb,723fda15),
+S(ac49d6f3,32cda691,c345f099,667ace08,f6496126,830c39ed,877223a8,cedc8be7,267e6a52,5ddae4f6,7e05f0e8,52b9dfe,5101c491,64d791c9,82249937,c3a7b031),
+S(5a92401b,698cc394,c9b714c8,bdcd92d1,20fa72e9,b1311839,1c383024,f469ed22,e29f2926,84c255a9,a739ef0e,5d13cc55,987f5b3a,5c6ed623,29431033,70edb4a2),
+S(3609dfba,51616095,ab060e77,d6779025,6456eddb,f4b651c6,442cd673,f893878b,f85fa9b9,442050d8,ad9d9314,9ede8698,91dfc99e,c05a2a48,5854cbeb,55a6c380),
+S(332bb85e,92c90a15,3bf602f,45dc33ab,3dea5ef8,7034af81,944113a7,4edc94d9,59b6c879,5f2a824,96d631b5,ceff8708,507db41a,375c7257,7533d8f1,461fbaf1),
+S(16e9e054,916b894e,730d7126,27b1bc81,e7689efc,23cfeacb,a423362,df49d87f,303d0428,b701f1e5,fe8ae460,e54adeb2,d4b5aa93,a9c7d7ec,7b903cdb,20e440f3),
+S(4e62ab89,1d4c4cf0,2c44915a,4e2fd522,88d75aa8,e22b7463,30dbfbca,97ed9515,a7c21be3,3b5cd522,4de0bd25,faa9c2de,5d6b2f50,b50a6901,b7167b3,c4def4fc),
+S(649eedbd,5612c429,2aedbacc,b846e759,4a2b5870,f21452f3,1ac9e697,fc055db9,ca694303,ee206a4a,acfc4cb3,1aa9f117,8fcbe37f,d6bd11a4,669289cc,7c37b0a),
+S(e858f72a,5fe2314,951ca096,8ba59760,e3d2a667,e76dcae8,c3ae2d7a,4721afbc,f1c7131d,3e2d0468,ebb89bce,700e0eca,ae83afee,75620938,60e1fc70,cfc7810a),
+S(cd351498,29ccb1e6,9b18e35a,72a24b30,e074793d,aab4028b,1c5eefe2,b7b3163d,6bbd52b2,93b43cb3,a19f6291,69ba5b2a,59785099,16842093,1e58dc1,a040c57b),
+S(19ffe344,69ba3e43,7d901863,3be7c298,ad8b65a0,49c30dc1,bae30ca5,97ab38fb,c33ca345,efeec662,96802e95,69f0f34d,12ceb64f,30fc704b,b77261f0,ce5c98eb),
+S(8a2f772a,a38a5b55,a7081d0a,61bc27d5,89f9832b,1326a230,d81b9f58,4d634293,a4707a0e,a7bf528c,ac62e361,6f09287c,182aa3b6,6862430,dcfef3c2,69d1567),
+S(e583bee3,1dbc8f0e,572eb18f,366f88e9,3a7a0484,b4299b9d,335f7836,a222636,8a4fae1b,be122228,be9d8afe,be223c53,dac161ae,ca77ff4f,e14d9c78,894fdfec),
+S(8b6e862a,35566848,50b6d4f4,39a25950,47abf695,c08b6414,f95a1335,8dd553fd,15a1f76e,f12ee34b,f2ef43d2,b14605e,db53c3a5,e7cc7c2f,27fc252b,c1641642)},
+{S(1c185b5d,e988ae93,eebe0aa4,a98396aa,fff2671d,8246ce2a,4394db96,7a541ad4,dddf4244,3532024f,d225f86d,133b8156,3ea8c92b,f0ddc354,88e6a04a,d41da5fc),
+S(addee173,b29de510,58dc107a,47fad47e,c48bf332,2f7c138d,51060322,571faacd,3890624e,c6920ca8,6a9aadb9,90a15156,799dd771,901823e4,9f3bfcb6,8bf05d5c),
+S(9e20bbed,ccdd5c05,d683b2ef,852760b8,e246e5d9,6a8900ea,999ac8bf,5e8f12e3,9f28e5a,b4257f6b,b826d076,ffff259e,1caeda5b,7d34f658,ddfa0401,7cd4768e),
+S(dc825d1,5f707c17,46920014,9d7be56,acf2d1d3,c444fa27,cefe5019,6f5b317f,226d4960,2f349d4e,9cd10a57,6bf01681,e4981cb6,4235d347,72a1e5ce,7694a20c),
+S(812e2cda,3f473919,1f2ac087,7d70d0e0,2ca0551f,10c96d95,51ba4199,22780f90,c8d05855,6b6364bc,d9aff119,5b9ef26b,85cffa72,1e880b83,eed73cbd,d23b91e1),
+S(aebb0870,76f5918e,68194fce,42d0b925,cfd2a506,359af62,146c8ceb,8502231a,c1c19605,e0456cb1,3e57229b,45c83ff7,c3695a2a,31908bc0,31b08140,9c2040fb),
+S(af7332f3,3ec274c8,d34f47ac,fcbacf8f,7980cca5,7220012b,8fd5ff94,cbf3d8b,d439f1a2,89799dc8,92b7e53d,a84a9e82,7bf7bdb,7240c34a,caef59a,777188a8),
+S(baf71cf,7851a758,12d7e09b,192741f2,1b5d2a36,6e31892e,e54c282c,81163a6b,1ef3bf2c,a81acdfe,17cd6b45,266241a0,22caf299,ed4d87cd,68d3d4d4,526b4d38),
+S(615991c5,d250cebf,8c7bd1b2,969213f0,403c7da1,a3ba913,44fd0490,88c2474d,4f014177,12142cca,163f29a1,f5790004,32726712,93c2e87e,f46d2138,c14040b6),
+S(b1574b39,26ff27c7,b2dace6,6108b93f,3fc75d48,478567cc,66bba29e,750c0c86,2759967d,8d05be25,3f88a66f,830dfb83,5139e32d,6f42cf3a,43b199ce,ab85b55c),
+S(5fe92a7f,d1c407fc,967dbb19,e9fd4d,8361aefc,a3d5a9a4,2f8237a3,458e5e90,9b89ce35,57d469b6,9b9034d6,cee93609,c291d023,d1d9349a,d9bcf47a,aed8b2a9),
+S(d65b0a5c,41b2dc6b,e5aa87e4,adfef952,621f9d99,550e424d,176ee180,65f666e,a76fad91,3b80b0cc,3d3ceac3,9a465cb9,4d8c79de,92adf9cd,7a4efae7,c85c30a4),
+S(61d7de65,fe34ec4c,f82f67b1,75887263,11683263,145cbeae,18ed192d,14ced48d,effac049,d7e5412c,5052160a,6d1b2230,7157669b,856af0e,e3e46a25,2d2ee19),
+S(9a77de66,5165a9be,3dd2758c,39aa7a14,1f052358,fbac634,5ea701c8,c93bc4a9,1044e428,bb381024,70108d56,b8b3e3bc,7512300c,5a6ae44b,93b2098f,a13fc023),
+S(4ccb2426,b6eed0f9,651f80d5,72b23e78,d84d6928,57648077,3663216a,bc8a418f,1840c,bf5ccdd7,19f7fa8a,33e7151,aa351d,2f620972,6ec67d1f,fdada8c6),
+S(53f96bb7,86516e0f,2ac7611a,1aac61d3,cfbca76a,9609fe,e4cae036,52f68271,97e3acbc,468b777b,bd1c8263,5332dcc4,b08b9fb1,9608fb35,cd51e49b,f09d9087),
+S(395253a1,b6a349a6,dfdb0d6e,65695572,2a597411,fdea9294,6e48d107,596d8ac8,c57110d4,dd0d35a7,663fb3aa,e15d8c4,dce5cb67,d3173d91,a6ff7ea2,1bd28107),
+S(d7becbeb,c47d0de0,899ffdff,8620124d,b29c8e5a,fd71a0ed,76e0df76,bd4e26e6,d8b52fa3,e16e7f19,e925e769,3b5a731e,18f3163b,1ad4db34,7f878381,da75fc15),
+S(fa3afae0,4f8c1fa2,778446af,88e29150,256b0413,d9bfeb44,45288e41,29be15a5,9dc76b39,574453ab,2d46cf23,ce8cdb06,cbe7df15,d03fd390,4470a86a,822028df),
+S(da56da00,dfdd788f,90a12219,db03cac1,403efef3,ae706031,e153aa16,b3a52eb3,1012ca8e,ae20efdf,41c77128,93fce97,fc66b187,caec55db,7aaa81ef,cc12838f),
+S(f07866f0,cca3474c,40e7fa59,26df41c0,e46fbfce,faab92e8,9ccd1170,3ccf79bf,37ed66d5,5e891f4,e644fa04,182f34b6,1f1aedbc,d2a71aac,dd1523bf,f579dace),
+S(853f72d1,edc4d953,348528b8,3656894d,67032333,28a16801,64a84511,15c5e968,197737d0,de83e73b,247d861,510ac76c,3ca214d8,ebbb958a,74ce1c31,5e715e87),
+S(7c7eae74,dce7ef76,9ef0ce86,cf6ac861,ffc3d4a9,6313f379,fb2c0325,daa91aba,131e1689,fb017e15,e869d858,2dcfc4f9,153d1e8d,246fd613,b3922302,5b5c3767),
+S(56028652,bce9dc6c,c8b4ad5c,f9f222c3,412e5bb7,8d556225,2c06c2e4,25a6e31a,2aa8e093,d8653f6,2153972c,e54806ba,666d49ba,3787934a,a37bd65e,79374ac0),
+S(2eb98b01,550a00dc,59d280b0,71e472b5,a65eea89,298fe4b0,9f6f0e07,9315ad7b,74e22fc5,3daecdee,6a0b50be,e17f1d7d,d9481e77,28778957,274c8d29,a0d89fdc),
+S(7268b61b,f65d73aa,37766a99,9960d998,18aa4ef2,ae8a97b1,db8476fb,32f891a4,824e99db,3157b706,38573513,618f6901,ce1fcff8,f25019d7,c5c45bb2,f3bb4d47),
+S(cdea8771,4a764e3f,a94e7356,879b7d9e,da7c5b6f,28c172a6,1c0ab012,9b9ddd7b,daf49b12,34ce20aa,263b4349,f9f88cc5,1334db26,59b7c587,212f407f,cbb2644b),
+S(38831af3,193c8860,690a9d74,cc0079c0,9e3ae0fa,ebe0da02,67ad6e23,99059d19,be188500,5193f11f,e34e70a7,e470cedc,902bee92,e7041403,c2f1ae53,7a8bb077),
+S(df3acf55,bc6d97ce,34ebeb46,34fe1010,ed3d6d6,383c11a7,53a93123,e9c8381f,94c22735,ae6f858a,59f663e2,12532e14,4efe6a81,981c7619,e5002968,dcb81df5),
+S(a8b08b86,4946ac6d,a101eb85,ee7bdf55,24282ca1,a9956e4a,eeb1afe9,87a43ddc,80ff0174,375c95fe,cea6e00,20f17123,5cda4bba,d4ef893c,78ffe37c,205d5577),
+S(fd9941ce,e1c26864,248f7035,352787d1,aba9e93e,f5edd333,d08c89b8,4bb9dc8f,85be138a,42bf190b,921681fa,8777a619,878d4d02,11016c72,8bc151ab,1a687b5a),
+S(7e2cd40e,f8c94077,f44b1d15,48425e3d,7e125be6,46707bad,2818b0ed,a7dc0151,6fa48af7,d523054c,7d59e574,cde106a2,776411bf,5111f7d3,65c43ac5,df8ddd68)},
+{S(282c5bc7,5b9c3f76,73e244af,29f22b80,c171bcac,d7e39b4f,ac7ba6cc,656d9010,e8db2eb0,a56699f1,73d5b5f7,99d39e14,dde34648,f159ad0d,c1c7767a,19ae72aa),
+S(d5a3eb7,cad9c548,839ceb7f,67145e0e,96c60d8d,68415f76,73b73700,5ce3a8b,34ae4e12,355d1df1,25149efb,1a9050fd,490e251c,4404fb37,31b6dcc9,e233b9f1),
+S(68718b29,86197989,3c5f7b1b,48abc254,13bd23c8,96c8828,7000ebe6,6db742a2,bef9d2a1,bb596fdb,3caeef3b,4d950568,8a94b436,4fd85f37,30b20de,b9e9a4fe),
+S(a5ed1709,7932011f,9a597511,a526e61d,f22d0bd8,ae3e15ce,655820e6,b1ff1238,dd6dc7d0,81e70b57,4f235c10,c7c3dbed,a57743c1,15e6fe01,a20ac751,34cdace),
+S(ec37904d,9662a487,1a471d9f,778bdef3,430df9e2,26fc42e4,7fc4bf5f,80e3a9c4,8413f2f,1ed55d8b,8448e336,ac9d1418,c48846e2,acb43509,f1a3d935,8cd18ed6),
+S(b09f9c76,1cbbb685,f695328,61c459a4,d2b16989,3cbbad2f,dd49c87,1d860db4,dbbf9049,31b18454,21c41f2d,2185e3d6,c8f55dad,f1514ab0,655c856e,3391278e),
+S(ed1a335,48864e9d,b41abcad,3344f4e7,ebe57841,9371095a,6b95fe4e,ae59edd7,d1146be9,83adc77d,bd9c107f,3092a9c2,9c271248,d78ce913,7831127c,c403f44c),
+S(d39507d2,6ba377f5,c7116aca,78df331d,a795cdfb,54e5c912,8558c0e,997b74f3,fa7971d4,32cb5a44,589dc705,de28ad0,382206f1,6e11229f,86ff82a,efef3131),
+S(641dc311,baa77b14,35f408e1,528445df,53c5ac5c,32803a3d,84e8fb66,60d71d,2b355a47,76980bfc,8a4e0ac6,a3bd7b02,a6b20ffb,f8650b16,89010456,6953e49c),
+S(c3dd73bc,cfb744bc,57bc95f9,3c260df7,7f3b7e74,9e4a5237,f3865f8f,f0c89489,15d58dfb,83654754,80e53bb2,a1ba430a,ce213c38,ea71c7b7,51b4143a,fe2bd124),
+S(3f883fa2,e834df1a,6e9b5c46,b663880e,9a0b42f1,891b92c,eb30600d,5641813e,7acff194,a5fb76e5,bd3d8fd4,2c7f07a8,3a991ba6,7f0e4edd,c55e1d8d,3025d590),
+S(70c8d4f5,21d808e7,221bd5c6,31f171a9,5e7aa358,4477068c,2549c59e,228688bf,52badf20,6106d5a8,d7bff921,580eb5f5,3a53aeff,e0369f9a,1bcb282d,7b4cc26c),
+S(ae08db34,874d39ff,bfb9c92c,5e4253ca,7ed508fd,d12841e9,63600461,b2b3a0e1,dc0504ef,d209be71,381eefd2,91508120,fb6ec1e,df62d24a,cb1d77a9,4eebf1be),
+S(627027ad,4aa88477,c6240517,87a25b88,7d5b98f,b968221e,8e45d584,3db6e0bc,34b553a7,c6ac7004,69367afd,17c5eaf8,7605ca18,6a57667b,650fd8c7,18ab76aa),
+S(573ef2ae,72ae8fd5,eeb0b720,f8967b44,f7d9d96d,c8a4825c,23a3dbed,fd2bb442,264f508e,efe5e0a2,55e55a54,bbf739b5,757d0a15,994ea9b8,4e139738,7c484786),
+S(28907848,cf84eec6,773a384,ce5f4a5a,24c8afc8,606488a2,ccdeff25,6f896dab,ea87d4f,41df8727,2fe84537,d11126d5,62618bee,a51008ca,895a8375,4f05ec5e),
+S(163db4c4,536114f0,75521627,c61f62d9,14214d64,ac9e66b0,d85b9991,62c54c5b,7ffc24e1,11c0c845,1c574e9b,e4b56610,696d3667,a6e6abbe,9d1a5ea9,4122aa1f),
+S(2ec11f2b,71ffc28c,fb5e779e,7739098e,c969bc78,3cca5a22,77d2bf53,e6574d1c,c5e9fdf2,89a3090d,e24d13a1,bc8377d9,de0bcf4,63482ebd,9620cbdf,8b238fb0),
+S(30549ae0,9a46820f,f49423b8,9c6fdd48,703132fd,ac166dc9,90609a32,49039f0a,b8c94b4b,36d39247,732976e,fc16d500,ccdc07f0,d7b97db5,7a1d9fbf,d8cb5d2),
+S(98685f94,a043399c,89e74674,240322ac,5a595bf5,41aaa44e,d781781a,10fe9225,4506b1ef,7561b811,53f44e8f,325f9222,e999013,30523885,d8c59864,db13a3ef),
+S(9acba196,3014ea9,1baba28c,e273c6e5,b9a2e1a0,98216c3b,194a0b56,dbda7db6,f0a3358e,eec737af,2e313262,b29ddf6,2adb9e97,9f56def2,65102272,6b976290),
+S(e81e91a1,7aeec75c,19df0ef7,fd07ce2b,e477c031,179e3f99,4ca13857,e2b5ff93,65236424,aaa8b6cb,fdb2fb20,46ae3c3d,839d97ed,217edc6c,c774f889,d2ce8b45),
+S(61e60aeb,821c3f80,b53ca78,2c3b4d21,960eb0d2,c90202f0,a5fba651,1725ddba,b029275f,690d10bc,b52e8bb2,acceb071,f07834fe,64175088,a97e26f9,8ff34432),
+S(a931c410,8fcb4346,6802dd4a,8ec2cf62,cf4c5558,8129299c,b3a87e95,6fba2a34,c21a8dd1,43d4a639,339fec49,f56d717c,658a55af,ad72da1,c754fb9a,117cf6e7),
+S(fb5c106f,da32fcfe,ffe9b5a2,7ac8cfd8,d9a73da1,5fa6340f,e09d187a,7a83cb88,a3f4c60f,90003375,11c39100,ba4c4721,c6c138c1,cbae09dc,46d1a1d2,5baa95fb),
+S(dc25e18a,18f0035c,2a05e80d,d6b38830,7fb3b176,a66ae451,8c5640db,7540dd24,3ba83beb,3e6b29c2,97a0ead6,148f9b93,711556e2,e5fd513e,ee649228,c62d8f3c),
+S(ecf7b689,ca03b840,739283e9,c3003a01,65ea3f,3bd17e06,9260c0e9,ad403273,5e0dbad6,47997fca,c0d7ba2a,170a7954,67036ae8,e61dc532,b5fe184a,deb8a7ea),
+S(263e593b,10c982d5,1bf89ec9,71f6a3f4,60e53bf4,cb2f6af3,2381214b,2e981bbc,e255bc11,11470eb8,894ead67,c618d7ca,a6b76ae1,a230ef05,3830d028,4a7faf37),
+S(f79781e7,a4137ac4,7a9a9d00,9d239b37,6cd0fa3c,b9f5de46,8cba5a11,ffcdd69,d10ba78,896e086d,5e25444,165e79d9,7b3d485,1a448e03,26d8906b,2f27745b),
+S(a4d28024,11f577c1,c5d08fbc,457a46bd,428f4d2a,b29475ea,ef622876,593e49f0,e4855491,ac0342b1,dc804bc2,7ae23877,82eeaf22,52874a00,4d4e0d66,b07b434f),
+S(87195a80,dc83be4e,cfc9d4b8,29725cbe,11101c26,13c98f2,641753af,1ee840f8,f9fce233,66931c51,4ea09224,b565dec7,22763d8f,6f572057,fdd7d96e,9811289a),
+S(210a917a,d9df2779,6746ff30,1ad9ccc8,78f61a5f,1ff4082b,5364dacd,57b4a278,98f1e4ab,af4a1a84,85c6417e,7298c82,c87619e5,500df403,80d8ec01,f384d9fe)},
+{S(6c16768c,433a000b,adc47b10,ba4e132c,f5480e65,ae83d1a6,8aec34d2,c00c76dd,ca1a47dd,66c2d74a,ddb69283,2ea289a6,ae679669,edd80bdd,4ffdab2a,defbb542),
+S(f757e860,ed04db61,594bd647,5ae81b7e,d6d2fa58,80cad10a,7756fa26,810b8543,f2aad599,4e491e02,9b1ae256,2c90912a,1c9aa6cd,dfc2331d,a0069a79,861208a),
+S(d9f269d2,9aa777c6,9989d706,91403dfd,9025b491,ba03ddf2,dab8c9,af7dc764,1b39b85c,cb4749fb,7f47086a,ce63924f,3ebb4213,af5dfc95,fda796e6,c6b0b8b0),
+S(d05e14f6,fe6ca50,a23e9339,e449f771,98e842d4,80a72d5f,8f5e4c06,43547cb9,869e3bea,6b19e0f2,de83fa8a,e932086d,d66e838b,637ea603,5f0fa081,5912c8f1),
+S(9f723d81,1818046f,b7512abb,faeb46d3,52d8da9b,3abe819f,3861f9c9,963c583b,37df0657,3f2bb428,6c8b3efe,f6941e2c,4e48d90b,931cd0a5,78a4b52c,6581ee7a),
+S(e65f0b42,54ad9df9,681c0db,3428ccaa,11194df3,9e837aab,4564e1fa,254e6f97,43e59d10,54aa35b5,80373e08,cfc02aaa,4f581406,58341e67,7e50977e,5bd893dc),
+S(605d61db,589fd91,78a65cb5,99697001,73afca81,23f663ac,5fffd0b9,8f5e7a64,a976a9d,a47745f,447ad4dd,7eb63875,c228b979,a7dda50a,d994df7b,545d0ede),
+S(43298aaa,faf20e9d,c2240256,493ef19f,5630db6b,f6376e4a,356bd034,98f1be7e,737551c3,653af1cb,4f8c1e8a,347f50ca,142c03e0,29007f29,c76bb763,b52ed053),
+S(8afba782,d6373f0c,54734f1b,4b854e63,bf2a3b4f,23f57a3e,6c2eae86,25c691c6,da3054aa,228b9757,b7321da0,64516249,652fd814,15017584,2c7683ce,1a3638a2),
+S(3156d359,e01d64fa,9c8fd8b2,c47c3492,82dd459a,fe89d94f,35906da2,c6d0208,85a23f48,f0a7448f,c57ee545,3978e2cb,6f2bbe54,864477d8,a63775f7,7ff7289f),
+S(88e1a44b,1e206eab,49fe97af,30be5e47,25e1011f,312a5222,e9e80819,b3f26357,63dfe52e,10317c4e,227b2a5a,d61b713e,2d93aba7,f0a51e0,b5621191,40c58ded),
+S(d10de96b,f2e4a6f8,78e0f37e,15569f3c,b9717a38,7fb98928,6d65d171,4b81b301,2c0a46c9,6a2e3884,e7f3b146,acc170d2,6d12b959,4b75a901,dd535016,f0355ae2),
+S(eb36b865,812ae4bd,7893e50,5aef6f14,bfc90c1b,42e75ea5,91615aa,a2101784,1523537b,790b2a61,fb6696d0,a622ff31,efea1255,e1dceb86,763985e2,6c5ca8df),
+S(d54be697,e41396c6,3d63f96f,bde9bba2,36ab1649,3c156159,3df81d69,c906fe60,89de1769,433b5678,1f7a2206,ca98258,20d0c7dd,a6d5b672,f77029c2,6bb59f33),
+S(d5aa72fc,9063c2f8,bd0fec97,da30dcd2,a5b36aee,7894463a,f7042795,1998c979,ed90095d,bf2d3a67,2d2f1a0f,9737c4d,e8f3e773,c04b77d3,a2345dda,ab662199),
+S(ee8cd53e,8ab64281,b5cad323,f03fd06d,7aa166eb,df9185b4,8d0eb0e6,1bd0bc61,4781263d,fc518e4,809e5ea7,7f9df238,1ee7b6ee,ab25c1d9,5cbf3fce,72fdd615),
+S(ddc5e95e,2a46736d,9bbeee74,74364bf9,e1d2724f,c43522c,cffa05a8,7d078be9,60908fb,809ae964,98a26cd9,67532df2,409491aa,73c46803,eb58861,7ad86745),
+S(ae503a2b,b6250ff6,6ee615d8,41cae4e,751160fe,aef7f33b,dd1feaad,ab236b58,6e53d2a8,8f09f78f,96d49a6,2f98773b,a282b575,ab6e24f8,4d604c3c,8583a66c),
+S(8a502d08,bb3cc1da,438c5780,e2120c50,12c1a972,8aaab6bc,5d908b6e,2a83dbdb,fa02e62b,85d7de78,8cf11d9e,ab406523,bba1f912,53006a89,f3a491cc,dd99575c),
+S(b52891bf,5acb0019,a8d10b94,87fa47c4,22f83a00,ef539e91,44bd9f7a,d5075716,ae58653a,b167a9e4,b71eecd7,4f4a8786,19c19026,29c0018d,9f082e7d,5920b2f),
+S(176170af,b40a3e79,8a88b98f,fb6c578c,d1ab56b5,b7f4142e,b2d84a59,1b009f97,6e1d5682,36176d58,ce5fcac6,4d4d2885,5db107dd,5215c71f,b4076aaf,d31c5d24),
+S(27359f7e,8d3e3dcd,ea35f603,d8fb15c0,bd63c08c,3ae4d2fe,8cb6434a,ae2e716d,a0d64207,8fba00dd,4683d597,27f3c67f,3c25075d,802a4ea8,eb08c20b,47a941f9),
+S(1e9d955a,2f68478,5227e866,491990a5,62c802ed,1b106bb5,42d02d29,93542067,fbf5f466,57707b3,3f116a23,fe5991a8,90a9583f,fd063943,37a19aa7,e125ccab),
+S(b5c4c10b,1b0e0813,37deef6f,c089d2e1,ee14da2d,cbb48e6,74b7dbd4,429e22eb,fdac245,b109947,8f6a53a2,8a1ec4fe,da43b4a9,2ef49e25,8f9296c2,88c48378),
+S(bd2f651c,ff6e614b,1d6535cf,c3a2c5d2,da5307b0,1cbd3f48,655623c2,55503916,3715b0bd,bcf29d97,63d7fb35,f9c5b54c,769a863,3517a2d6,8dde74e4,c4277779),
+S(c4c2a8e8,f1e257a8,fcd0b11b,30635c5e,782fedcf,f99b0b95,828e1369,3ee0af73,3a08abb4,777a066b,49ec4c01,aa5b0868,f100a473,e555def1,7c5a9d84,b1fd9ae),
+S(4aa77ce,15dd97ff,47c1125a,77bcf0e9,d302b79a,e8a919c6,a875e5ed,eab8c2ec,31a09dc4,89a90240,334836f6,302d7e81,57f19762,a9b5f727,6c276e63,560a9d10),
+S(3731162e,66a8d2d8,ff4df3e,95950103,f5a03f9a,86bf37e5,605746,cf4be846,e19d7835,10af5daf,724be4b1,932dfac6,23899ccf,7e3e58ab,5bf3265c,667cbf28),
+S(6e2114ed,297ba44f,c3926603,bc03a87c,af3e9f2c,8bd84e64,afcd9846,bd9c8f0a,faa6e5f3,3d90f91d,82592af0,7f3a26e2,f6f4138a,2f06a6a1,4286eb71,2e95cf94),
+S(50d775b5,f72d186b,266a14e5,254cb5aa,49fd8633,81c36b09,842632d7,ff004130,cbfe11c4,f0b15aa8,3ae8dbcb,9feff9c0,d68a26ba,11095b3c,ba94739a,2091bbc2),
+S(8f3ccf31,f8b74b9b,624a5d1b,7cb1096e,202fe5e7,233777aa,859864d3,775732c0,980e32c1,d2c61ace,7610b926,6831ac27,56f19788,ab7a77da,18c421a0,9a46bad4),
+S(24cfc017,6da2b46f,a8bb5bf9,636be1ef,fd7e297f,29122fb3,e84c9ab0,c18ada5f,14007044,f8639e59,67978eb2,a21256d8,126a635e,5b07eb0d,97059ec5,6875a3c4)},
+{S(6efcde8b,e99d9ee8,ee0d6b8f,a76584bd,5deb67b1,415e729b,48f3d41a,f1cc1386,4ddcef4a,a6ad5be2,d1e83449,9eca4a8c,73219f80,464a4a9e,ebb7f3f1,b70c9fd2),
+S(24fdd052,a1e535e2,4eb79ffd,f03093f8,5778241a,b845b548,31b9a82,730ee3e,c6ff8ebc,7edfd9df,9b7410a,7f54c93d,ff0c682b,152bf4db,1b79c0a6,9889797d),
+S(aaaf86ed,31dbf395,687c959,6c445b6c,dcd1fe7e,ba2aa13d,1bf41867,dc87b30b,582b9683,729be5c,85fa83e,2ba2abac,e3037262,2a24aa35,c7753312,1de2fb93),
+S(23930d0d,2400db1d,56525bb4,67172fe5,e930bf86,21124fa4,6c5a421e,10b059ea,5e11f202,beca3d5e,dc9b282c,2e86d5d9,30f8f5d,27a5c4d,d2cd6dde,6d1497ef),
+S(76ad10d0,bc92ad8f,55b665a1,8ee84e01,2e92dcc9,37e0c604,59bd6fd4,ded2d9d2,d4ca7386,ce0c4c5,fd37da9b,eb8fb040,97d98891,35a5ecc0,320dfffc,95ed3c10),
+S(10b324b,e959f0c8,c8a82142,4a8f87c1,fdeb7f88,258e1021,c9cfaa66,b131f3a4,590e672a,daa8d547,161f635f,153fa12,b3500694,677af3f8,90dd4ca6,9620bb56),
+S(afdb2acb,ebfdc11b,3577177c,d8bcde00,65151495,79c6ad2b,f7386275,a9314317,87d7786f,5ba775c0,ea47b141,cd0d4274,c7e58634,b64e4c58,f7f0c595,5a307250),
+S(574cddbd,59b34df5,30f5dc4,61884ebd,1c867ed5,6cb60832,4a11b1f5,29ebf733,1bfea852,34256807,1fdb4f5c,485caa73,7136e3c3,b4b8a39a,389d7dc8,724f16fa),
+S(97ffea2b,5de34e1d,495ce082,d0097b72,e7daddb8,1cb622c,2c14e814,bb0ae278,45fd3d2a,9d1e6530,61b4a356,65aa9e70,43766950,622e1c25,2baab265,6d4ed95f),
+S(de627f6a,a7b56d85,535c398,80d0276b,b910ce4a,6066435b,512e5e0,21ef55ef,753033a6,ef89f053,c0e662c8,1557e6cc,d8b4c8d4,5204f5d,e1c8c742,72b96277),
+S(b126c35a,d7993bd0,164867c,58c88421,d2cddb6f,d16a5966,7d9683bb,1b428eb5,a9ed1bb9,e9eacf9e,e712bcda,be629143,ad0e7652,82cbfab8,e586cb07,131e5b1d),
+S(847b90cb,8837f488,ef027a05,71b2be6c,620cf86f,ead235ad,e76e3408,d0dd1073,9a2667be,6ce36e7b,d76117a9,fdb8f1b8,7c7cb45e,1a03f53e,7b32bc63,6f274b4e),
+S(8ea21457,6f1bc2c8,fbee9065,c2cf5c3e,7a3b9fe5,403fb980,96040c2e,c6fe1488,dd75b454,acef4d3b,1b355a63,f0cd17a6,66aa9e65,f1262629,f0c7d1e0,33571b58),
+S(9e11bb60,ba4b2d5d,fe53bb9c,598edb16,f3926bea,1cc90eb4,3e05ca34,e83f1896,263d7ea,50d83b8,791fc911,a4f73cac,4d42a09a,85f5ae68,86cb268a,fd562dd0),
+S(f741856e,f353a7c7,17db9a13,4ab4aaf9,13c1f7da,cef08bfd,6f81dce5,b1130e20,ee63dd2f,48e15f68,d1acbf49,705fe010,231e26b5,14146c47,1a689960,d568eca4),
+S(671ef05a,410b41d9,3b092b04,e523468d,44837d2d,26dba670,27400715,eeefa2b5,686d318b,b49eccbf,40dc18af,f1938fa9,b16d4d2c,c19dd2ac,47c7830f,89b8d55c),
+S(59ea10a1,e5bffd6,a34593f4,b986e37b,5294ddbc,60d92906,52c6e9d5,75f88c55,c0a2eb5,6d04ab99,abb5b76f,7b2b55c9,c09d44f3,3785e3d4,64554c3e,dc7a334c),
+S(37f2c7c5,69c6fd15,9b721d8b,8d40138e,a8873b6b,452af0a7,89a50551,e9703c1e,d114109f,f9e6d7c0,c51a542f,b2e3ef5b,74654bef,5eb84aef,c87f5096,2a30c078),
+S(1d280637,9d77e509,126a440e,b1e56f1a,8723728e,97c92420,5ed13081,98c868b9,85003989,93a4a600,dfd0f092,b13a1186,c1c52dd8,8fc8eace,9bd4f1c1,b47741d8),
+S(39aed6e6,a123061c,228d3d1f,857e0c9b,29b70cdc,549b4ea1,9fb6802a,8d8beacf,6bf86967,98e3dbf6,75865a1a,b86d5bbb,10f16e8,4f9104a0,87602c,e6946aec),
+S(aa770804,4a996b1d,5bda074c,941b30c1,d1474da6,47d7c4ed,248d3a9f,c3c3c525,10ba5652,b20482f,fc2434ce,ac185d8d,af6cc6e3,61e77d3f,258abc0b,55610879),
+S(7626a96,9f9ef188,3ea82737,83e5571e,4054fb73,6190977a,299c2a05,d29f60c7,172d4618,e5f88055,ebfcdf9f,55267ee5,cdf18396,1d5a2a22,55b87ba3,c7d7d2b9),
+S(1a550684,d1195da7,c4b09349,f149eae2,5a1ef23,c9a81109,115d93e4,c98cdbda,c31d7dc1,b7efd019,c491010e,30f90ed8,7503c4bb,1b37fbce,3dae199,6609e3b1),
+S(8d2306d2,dd8c753f,2b093e62,86fc282,ba3e1dbd,7b4ba101,83d1070e,d2d06e67,97dd14c2,d2c1d147,486a3dfc,d608ba28,d63fc03,251a106c,9811b088,978e3a5e),
+S(f31a69ab,97039589,940851f3,cdc98bc5,d400ff93,63794f81,4d88215,4f00db99,56e510be,7f41b009,89792401,13641590,40f5f305,f27fe1e2,db1cd7ae,887ff5e2),
+S(ce96b3e9,6eb94b7c,8bdc7b57,efd2186f,62e23e72,f11337ab,be7405d3,43b4d762,cc0dc898,33e7a632,d0fed52d,487f2c60,96c69664,f698a71c,3f7f8a29,4f181add),
+S(bed97e25,7d31b5fd,36b41227,462d9122,706da670,d432ceff,5d37d83e,fefda56c,c0cfe30a,2c3b3074,1af492b6,e3797c4f,3b00593c,6806e2e2,f2cff401,6e877ff6),
+S(923bc6c9,960f6e4d,ca2a7070,6d160e19,83a16b6c,8535783f,12c5ac69,4aad226a,c47f08b,6b2056d2,8e9f119,9ec6d5ce,b48801b8,7ee56280,d6a48352,b2b42b1),
+S(b3cb28fb,7465cdda,85823dcf,819400b,357bce11,23d9229a,eddb8262,53b246c3,cf035ed0,b624dd68,8a31eb5f,3b28e83e,c0bf9453,649dfe4f,44078eac,9345f2a6),
+S(c69aa2b9,ab3c5e45,8713a912,e7f95bb,4e5498a6,d4090323,5cfed1c9,c2a60709,2e95e198,85637d55,744e32a7,98c02c7e,b29f3bf5,7cf7c870,7cafdf41,f6710f0c),
+S(45996af,5795ea6e,43e0fd29,671e119b,8b8d6ad2,4eac90ec,d27d5db1,b4fb6a39,2c0651f3,1c7d93cc,98d79d7d,f21110fc,8c1dd74b,f1ffefac,a3d52484,f8da40cd),
+S(264559d8,7829256b,ed116900,d82d0c37,9f0e4d12,53c68e6f,cf2d41ae,7cddab8b,861a42e6,d92caed3,108439c8,fcbf8d28,8579ce50,c6350e19,3609b4b9,ffe217bc)},
+{S(ac13e0db,846df259,fc38d6,3b0248ec,9fcfa8d4,bcee368b,1f4a66c6,d41f9163,6721b0df,2ed06fda,9b485cc2,aa56f1f3,3a913e99,f6809577,95280451,9ddc96ec),
+S(b6b7227f,228da269,a0e5640b,8a2cfa34,555ccdec,2243dd0d,4b2da0a9,b4cb5e4,6afe41f9,dc129d28,4786bb76,17786c8d,42597435,240f998a,f970620,90d32059),
+S(460672e4,4f2768b9,842a98a5,ca8b90df,7d9f52bc,3fa2665c,4272d7ad,5f48b992,6d7f8b36,13b38fa5,80ed1d4a,21d196bf,be491b46,49c96da8,342441d3,f4af4ca2),
+S(1d3d4ab8,b7c06136,8dfd612a,25f04016,2bd3f6cd,cd9cf58d,c11647a0,d28b629f,434dca08,17bbf964,eb0a316c,b2b0df20,eb2e965d,c4d8d795,1d4a6e66,5ed23d38),
+S(9c5d6342,303bc7c,73763cb9,2e3d7069,7d913f6c,1a6e2f47,39470da3,22b7c1b,825c1a54,395b9b41,ccc2e3b5,3fe1092,f04c382f,b2ee3a29,fd59e255,5f22fc15),
+S(5c751285,a4b55535,fe24fe27,568868f3,afb43cf,aad1d2b1,c6367daa,ac9493b2,e2388ab4,414c4e4f,e34a4c78,c869dd93,7094ce2d,4f4666a8,2eef8047,3b681fb6),
+S(8c1592f3,8d73e277,d3c18d4,ee3eabce,32e86f92,2b27c2f0,1f50509e,74dbc211,399c9507,43cd9e7b,200c255b,bd25670e,cc111462,2d5dfacf,9dbebdb,53ee59ab),
+S(85320e36,5f40235e,621171d5,c8008845,890f521b,d7e2cccb,88c7fb7f,a08200c,96bbe8ec,74b5f1b1,2a6ecbee,2aea6f0c,b6d0657,aac3556c,ddc4e46f,17cd31f1),
+S(5fc21f20,13403705,687b8ad3,387a725a,f2e6300e,13d28403,569d4cb6,5dda7f34,bb709fbf,be95aeef,c00846b6,a4645b72,dbb4e1ed,866edb57,7bc5d9a8,2b774b0b),
+S(fa40e658,588f8a5e,29d380e9,c1a6482c,888f53e5,e331f8ed,9b1273a,56d094e5,5486cff5,3b7baaaa,de8a51a6,1d1a9255,95ecbea3,39955c0e,172de4c3,4762eca1),
+S(9f87d04c,5fcc48f,375c40af,3197c28f,c62cf3c5,10fcdbde,5aec79a7,4e6a6bc0,9a6cc172,23a770c7,a03b5333,6922170d,e9409f3b,9846b9f4,41832ae1,f70f5c57),
+S(bb66dd5b,2f88786e,736b50,e536a0f0,3d59b86,511e95ca,1bab2cb8,875bb187,f8215527,c76a5af,e5e76a33,eb2622d,5f822ad1,d284c68b,c840f65d,4f731c63),
+S(74d223e4,bce2d6b9,b2fa9482,46327e04,18eda6c,cfdd76c7,cda8be62,3f6dd3a9,b7276bb3,817c0e72,e1ab002d,50531065,e1c4ca30,9c6d6f18,bb5796ee,457b4270),
+S(80298b62,eb4d3ff2,e10607dd,dbcacda4,3bb30e57,f3c8c7e7,6f9f3968,bf391316,fc72362b,48c8b606,4e428e6d,1ef2ac87,931caf75,e936a33c,228a5caa,c460c5f0),
+S(8519f27d,9560acdc,509fddee,9b4a4a7a,8b13496f,14760a08,22609f3b,2ae07963,193aa9db,b98293f8,e70d7253,51d3893,a9f5fc73,6f3c8e65,28a2dfd6,5dedc220),
+S(49d734f9,c8eff915,fd66757b,d6484bc9,548f20a,d8c05959,f651eb36,e45cb88,4c594f79,7651b49e,929932a4,59e3bf21,3e74c0b8,acb20907,697a25a7,ed21057b),
+S(6a528c6d,19b1e28d,b4d9ec9e,19c4f7be,184ef845,1f41b322,e5932f05,575bcc4a,7350b90b,c22ab41f,40c13a80,18749e8c,275d3e5e,5d687df0,ddd47133,c092eadc),
+S(6f3df40f,5647143f,cb93b23,4795d9a7,708db6b8,2e2df53c,f214de4b,61eebaa9,dee10664,54b625ba,34ce4b54,f7285714,7874b5d0,6b38b1dc,37b7471f,9208dcbe),
+S(5abfd7eb,c4c5dc14,cbf0e335,f2e87e7a,7db96a2c,b78000aa,64fa8aca,517ee1e5,d65a98d4,20d872e4,4c43997,55cca5c0,bb94ccc0,b25e30fe,8b5a4fcc,7006364f),
+S(1bf3714b,da04d769,782e37cb,c4a4b347,f9fc769d,a18e4940,d19a205a,bdd22a23,d0852b21,33b04274,183f4de4,9a20769e,4a08ea16,ca8782bd,84a4da7c,64c928a2),
+S(773ab884,a4e90454,ea467caf,f18c3b64,e316468c,b5789fa6,4958f73e,ec3204f1,62213b85,b4838d8a,fa3a14f9,32db7d79,dec538c7,d872d9d2,be1640a2,4e367caa),
+S(33a283d9,9b7564ed,6ed10d88,ba26ba,fbf3a375,e00e10d1,577fce27,2c204324,bf84dac3,40736625,cf0e6be6,98072c6c,5fb8bf9d,2850be84,ded3f652,569370d2),
+S(62bdb467,596ffefa,22b735fd,d3dfd959,d4a6e187,a19d4c1f,4d647b4e,db380c3b,210a8e93,d1a184d0,a3548be7,6283d180,8e4f32d9,52834c,515953f0,4ecf9acf),
+S(ef16d3a3,233f03da,5864801a,c246756b,d1356137,971bc164,b5512067,b369dad2,480e3d32,7f1df8b0,646c3b58,a51126a3,e91522de,ab77d6d2,f2bedadf,1219b877),
+S(a6834869,c006d044,a9dcfb9,8a5a14df,86469fd1,fd0cba06,a4e8ec1e,1fba89d6,c1a3e0ff,7abeb1e,8cac11a6,8c1b4c1c,f663e615,9f508c35,f4747f50,84b247e9),
+S(203d13c6,53a3c36e,55a836de,b38c7443,681d7b7,c681d71a,38fb0fde,986ce9c3,5d7dba97,573ffd85,b3fd4417,f09192e1,92461c4c,125a9947,ced9c737,ecac65b2),
+S(c48819,b8f32966,bd50f162,30f5c0a1,45cb3570,d9c4b104,4c306696,2f4d6667,feb08ff9,1f543c1,35b6e0f0,b21d7624,91ac096a,181bf093,fcf8f4b7,bf6559a2),
+S(31441031,ceabfbf8,59bcdd8b,6e177f91,df7bfe08,f9015172,1ead3acd,ab64acff,e36315bf,6f087118,32894704,8d2fd259,6b8beae2,e1917341,d690a1f,786db5f9),
+S(e3e4750a,310c48,38920654,b6afa032,79589d52,74e48139,6e22d9cd,3c05fbdd,f05868fe,5452da6f,fadcafb6,69e5edfb,4b9a7840,3a305004,345ddce1,eaca43ac),
+S(3659ba70,60d8200c,9512facb,5c730111,4cdc2b9b,aa5bde14,8ad9bf9d,d8f8fb8c,b1185617,f91fe5e8,ec68da07,138b6780,e1ebd12b,1bb44eca,8a1b9472,8337585e),
+S(1a46b7e9,fe99a4ea,492fbc90,3281b924,6831fe59,9360af53,bde4ce8b,43ed5996,97c317e1,5c0e23a8,f1c11f7b,5f9c140a,af786b56,10ad8ba3,d11b12ed,17379f81),
+S(f16a409c,677a40be,402f8efb,3752373c,aced053c,6f702b82,8bda222c,a412b6fd,d5becee8,ebacd866,285958a5,8b1cf1b1,e9abf9a6,db61435b,d9725187,135fa955)},
+{S(32c932eb,6fa35974,90a408a6,ce962d7a,ef2bd22,72cdaa,cb80f798,9836abc3,3e145848,c2f8197e,f0264d7c,370d1784,7d21a09c,77fd9f7a,73245ce7,2ce5f3f6),
+S(49d837bb,63890b4e,8a4a63ea,6d88599a,c9961c20,80dcc955,aca6a101,bc935f16,358a7f6d,b540ac03,78d83bc,304cabf1,84c7580c,46c258ec,58f22254,e3e03aa),
+S(23516ddd,40dab9d8,63dcad6c,cd325503,b783379,d870ace0,9a0b238c,d7b6b2bf,b1fb8268,a7814efc,54f3d637,88956b67,a3997a31,10a738a4,94786d95,a5fa1c59),
+S(6b4e215e,df56e6ce,6378fa98,5d604f68,e3561275,788283d6,c40cb249,6d16310e,cdf9537e,e6f4304,dbcb9df,f8b97a71,a12f014e,29867e5,6b09b388,78c9ce8d),
+S(f4f30433,c933dddb,949ad868,cc0d52e5,247149a,7ec98f12,3e7f63b4,acf6b7b9,949123eb,9fb848fc,d7b94401,a64b21a3,53fde44c,d93dae3e,b7a2d3d4,78055af2),
+S(dc3523f4,cd24be1b,30787dd7,5140fff,b66e4487,55e9a3c9,6124fe59,c07faa28,47b945d7,6d37b855,8ede59fe,e297a8e7,81d3ea96,f0a81588,b68db767,9b9641f5),
+S(b92cace4,e31dc724,3b3530b1,f90de1c3,47cc39e5,5b247455,a1296912,4e3c2a09,78f89163,c735cb13,b1d8fe7e,547027f,68d8f864,a1f093b,22c0d9cb,95fe28c2),
+S(8f7ed1f1,77238a68,bbe32e4d,ae6d67fd,be07c9a2,9fc6b940,6ef81a77,65a8fb75,98e627d8,d32095bd,5913daa5,920c5c60,334691be,537b08d6,da5b8c19,7bf81c8f),
+S(47fa27ac,e035176f,34c59581,8d3dca2c,a2b40e53,29756c55,7cf81f75,4f99316a,ddee5921,f381ce26,3634a34d,1b4f9513,4d9f0e50,5e96bb79,b87d98b5,282aee7c),
+S(7584cb68,60ae81f2,e0df701c,97d7aa29,8132cb96,fee4ad59,15424bec,2e280dcd,4b76458b,e3926b5b,bf59ad77,da4a96c9,1f9147bd,88a234c0,74b0e09c,a6993228),
+S(2cd4c11e,70d432ff,38550aca,481667f4,d09ad11f,9aed62d4,968492d7,5de28dae,82514708,3e5bf46,341177e8,9ad2cfb3,a215578c,52f9436,d3952432,e9acd430),
+S(2b524c99,2b18a6e0,30863716,362d236d,e385a10c,3679eec,2774edb7,a1a89be9,1abb3b28,3477769a,5c7b4580,93efb22e,f2e61296,da90d4d3,1d6b2ff9,1766f89d),
+S(d642c258,9d0e47ef,f5b2b60d,9321db58,727315ad,522daf58,3bdf35d3,336f1081,1019505a,994030be,484e5340,abea0b7a,51276c99,29cd1f1b,9d19798d,aaacf3d9),
+S(3e5e09b,451bcf5d,549f1d66,b96da0ea,25e63270,dae59606,bfc3165b,f89f29fd,2ce591f5,32d57be6,4fc48aa4,ba40231d,9c104615,b76ed6bf,11957694,16d2f0e9),
+S(4756965b,82fc23bf,64041d23,a23cba32,cb71d3e7,ef3e6c03,51b20f3f,dec049b6,75f3a293,eae07f4,362c47e9,44a78561,323244ac,bcecef0c,6ba2f5fe,d1933679),
+S(f296e9c1,41694ce2,c197ba85,bb9f172,54fc0bc7,f89347,a0e92b8,58491a39,73c7fbdd,91c88ce2,bbcadaae,df8880f6,aff07e8d,3a1ce05,a468e3c2,3008d98d),
+S(b437d387,ddae39cf,e26edc85,b0e600bc,2a199b6d,b521f9c9,88d921dd,7e6fc761,ce2111f4,d937905e,2af7f2dc,559f9eb8,bef286dd,909a5965,53c7f61c,f51aed18),
+S(bacd4a38,f3e1b7b1,b601fa5a,2a579e87,459fd189,a607314,5a0dcfb6,1ad3c21b,8be8d6b3,9553648f,2a94754f,4c6c14,c4917296,aa9987f0,deeb7e66,d81c3777),
+S(d8164748,8ac6bca,945fce70,e8f6a256,90512c8c,dd4c8fbf,b553c131,96f7f607,16b75474,65a80a67,86b5246f,e086d32c,4db03b83,58271938,41877c38,2b5bebed),
+S(9c2b0749,cef57b4e,36b31328,e01503dd,ddbd2834,5cd86ca2,5224b967,1b7897d5,f020f978,4eed44cf,cc4aa33f,b2eb4b71,f24b5f3a,a8dc1d72,569bdefb,5f6276fc),
+S(ea277814,9f0ab428,63b05bb1,c113ea7b,91afb815,e8f0791,12c11573,eb044e4d,8199dc4f,4e72b691,1c562ded,1220aec3,ab967029,139d30ac,58c753d2,f4548030),
+S(4be6fcf8,40673659,5a9e4f2e,877ad7bf,28e25177,63d74238,6e43e6da,1c1c43fd,eb5456f3,d1c40592,2eec37ab,3e0d08da,b7cd257d,9babab02,44e5b2d6,a827a7cb),
+S(3f1e9ab5,160733e2,9e7aeb6a,378d169f,9be5c266,a6462e2d,e736be07,f88c1da1,907fa0b9,814da057,9bb11309,aab51902,a0699aad,9422e1f,b8f1a8c4,aa9d4399),
+S(eb730dbb,1ba9b2f,50453837,35ec6da2,ac4b5019,86cf03f0,3f5061e2,a28285f9,41dc3a0f,f42fb1b5,d3b464a5,6e305fe5,c60c4561,d6e5a6a7,8cba87ce,15c392fa),
+S(aeac891d,f7032059,54d0bab7,41927702,1a595a4c,37bfc34c,5d315876,3e85f3ce,168f8260,1331b5c5,edf941d9,9f1cfe0b,72fd2a1c,3e4bbc2c,c62d47e6,6399105d),
+S(667e04e6,daca6315,4888ac26,a268876a,f4b754fb,87687ca7,3c4cff77,d6dac204,1826a26a,cdca828,8e2ac81b,855a4d40,86f3009b,162fba82,83cb1d17,b9f7aa4c),
+S(240ec754,24e46326,8e2e4ce0,240f335c,78c46150,1e18cedc,b32e3c51,77ade3e5,be09c744,cf6e9c6a,75976c03,530329af,5e11e5ed,3fb13e8c,af40bc5f,95872645),
+S(7b83e4b7,70e7a442,3efbb501,c23881c5,2bbde4b9,d5aacc38,7071decf,79690025,d242ed74,441d1ae6,61b97c83,70be2f52,dcbc2831,1e8707e0,1b44c827,420dcd45),
+S(63589c41,fa8975f4,c8738f57,579cc0d8,447218c,69da1a34,ee06af0c,215f6c27,c34f2ede,7589760b,80dbae48,94a3c13c,7351bf5c,33a35351,9988ba67,c2a56d48),
+S(db092b0f,4638ee45,190473c7,cb60cfec,45c94d96,99aaf289,82d28af,16ba1c66,8a96ecdf,29ad2fd6,3a85a7fc,b73ab6d7,719bbd6b,98d052b3,3a0cd91,ab924f46),
+S(11c4dd8d,3eddc0cd,9a832dd2,dc91c8bd,491fdb51,f5da21c5,732dfb7a,362b8df9,ba4c2789,740b53d5,51bc9fbc,776f049b,e848182d,9d13abb7,e7cd860,96911eff),
+S(a65a3a01,df3b5ef2,e620d431,49fbe1,4d71457f,19d1ed35,aea39d57,89303fdd,86715f6b,f300a390,470bc272,6f12d389,7979e2fd,b0512c35,252bb571,fd19752c)},
+{S(d8558716,b7033a9b,29afb346,fd71663a,79b6e86,2719bf12,6e532dc3,f581b7d,a790d460,1e5b2630,1ad6ec43,62f79120,d75449d,8a500e2e,6f17c021,8037a405),
+S(842c01b3,54353026,c43dedc7,8829ead1,db35b63d,8c4d0d36,8cd7b661,2eb5e11,f173cab1,a37ee0d0,68e097af,17bf859c,13bb4823,255abddb,f0dbeffc,573e06e7),
+S(acac5cae,414c3556,38e293fa,e7cda051,18924e9d,abb81bdd,29123768,c7f21443,5d17b909,5b997254,5f56770c,dcb8af40,e37e1a8b,6e01a989,34ec22fb,f7d04537),
+S(c8e73810,c024c6eb,d5398bda,3784261e,542279e5,3438d49e,83b2639f,80889aea,7a2183e7,be4f81,b0337993,935657c4,c55d20df,729d2e8d,b25af238,f3d85f4b),
+S(f78c5f53,5e7ccb53,555a6f2c,b1de1c5f,da379360,f6a7fc52,eaf86ecb,dbb3bf90,cf2d33f5,eab2ee1d,5a32eea3,18f9927b,cc982fed,cc9add2e,2461ba14,9def0292),
+S(4cd40c43,bdb8a042,2babc95d,eb00a405,59519074,5906a8b7,b5ea00da,b7f995f5,a0bd1c74,79125d2f,5baec520,21fb7c62,415817f7,2afb80,b2315dda,40cf4c4b),
+S(647c5950,f8a7fe9,e6945b3d,6da91932,b486a4fb,ed903836,9fbc20f9,a849ac08,d331cf32,d72e148,b47af547,6794a33d,55f49ffb,be47db02,7d2de73c,542bbbc5),
+S(97664e78,980a49f0,8269ff19,649e86cd,7da88a76,eb1441d8,a5f3fd2a,6ea335d2,b2898268,9a8cd91b,b1b16be8,ee46b4bc,252f7016,f72432c0,431f1264,8d7450a7),
+S(523f68b,b39c2ded,81d22a4e,575483ee,d8748c9f,52c06081,391c27d7,7afe3805,5c331672,4464dc47,cc9cfe32,864b6095,ee8bd6a8,42c1af98,b3e33183,a46e2471),
+S(cad866de,5cbf4938,989b835d,5aed958,cd7c316b,980b7c76,2109d688,d7ef5b25,3ae79c30,e77d6d4e,fe404b8f,324179c2,f677f434,8a1c4367,2a0fb5eb,b706607a),
+S(ba065cef,b47170a,d6796033,d157fd1c,f22052d0,7b7f9992,6cd58e03,316f95a5,26177c08,bc535702,7f5d03a4,9d982637,d74a6b20,696be76e,742243be,b9ecddca),
+S(27ca8178,be756f12,22cebe6c,d05310d8,5a6c4f59,eec71613,7777b625,e6d44c97,de547a17,ddee9fc5,1fecee01,45f9cda1,b65f097,5d1b9544,aa2317f5,102537cb),
+S(bfab1d94,d04f4909,dee00998,78f77cc7,d9de94a7,96b5b770,5f3c759d,2ae97ec1,6ec39a8d,9e900a79,b8b88098,d1e5d79d,b75ef91,e442cb2f,27ea531a,2db21bb9),
+S(b48a4f25,9d82242,59f08a08,29b05ac8,ae6b97b5,56cccb84,20a479f5,df92701e,beef137f,9f9acdc,8d31a780,2290fe79,9d9470a7,3c8a01a,35abcbee,9730d17a),
+S(e3f5d307,ed2f2f13,d23ae5b5,9dd567f0,8161996,776d506f,b53e14f2,70a52370,40ecc697,7da3771f,32a66438,cf70ea9e,550194be,1af85a08,c8a4515d,32365803),
+S(818b0462,d5a815b1,57216ab2,4d795886,17cc99bb,7a7abd91,655cacb7,ba99335e,c6ad05a6,7d2a391,a15b6600,7716e02c,9fe40db2,f82283ef,c9c0a7d5,ebe854f4),
+S(7e3c52ed,23220b73,ba47613a,bf39a9fb,b3a6bb6e,22c972a9,3ef21a61,50cdf830,b3e4a95b,875719b3,bec1b113,9e29670d,4ba8f39a,2fb76700,f69961fc,bd01fa2c),
+S(594e4129,9c1a117e,ce8564bf,ba88ce04,297f2e14,7ecda07c,5f12913c,14d9a5cc,60bd54c8,7395fee2,7fedccfb,ca9524a9,b5750b2d,d712621d,e73e0692,46c2e347),
+S(3686bf4c,f387e340,6fc314e,f02c637,ee6f5062,ee9bb567,235b00e6,4d516648,915e5904,b106e057,a0db43,151ac9f8,4871e843,126d5285,337dc3b4,52c67165),
+S(338dbd1f,42480753,516d3cb2,c535492b,72849870,a7828b48,643dc143,b966ea61,e51f11ec,86104334,9e9dae17,78116032,949c66c5,3c4d441d,3c88cf4,c7ad61c9),
+S(56f935ae,f58bb403,7649198d,1a5da704,26fd944e,c5694c18,38c94287,2130215e,a9c48fd0,3b059474,e528016f,9c998e02,cac7c40b,8c859852,b58b9082,b638222b),
+S(1faadcd3,da472591,cc723754,82546c81,c4f53c14,d0d8dc5e,ab95a58f,379e6899,5bdcc45f,42d0ba3f,783a0806,a5d08c74,a1b1b9f5,a559248a,8681b153,74e74958),
+S(532d8cd8,fdf838c7,70b87ca1,4703a884,116dd928,74acc660,6ddddd61,8eb053e8,67a31325,853db4d,3e5877b1,c76e7e39,468d2d77,37cb8a6d,af4f16b8,17cd8ad8),
+S(8a8cbfd6,d45e5740,aa9f0a21,f40e3671,ef897fe,bf2bf753,ee2d2f75,844ab648,d00eed6,efefa26,46c36895,3a54045d,96da4cce,8ffc554b,9bc989ac,2f62acaf),
+S(38ae095a,3c705343,38e542ff,6789902b,cc1b0b5,7763cc43,2f50cd9a,d26d0f1f,100de239,87026f09,e483839c,fe9e1f10,11bcfafa,662a9331,95a8e4ec,e4fc804c),
+S(82d9e5a8,385de1f4,fa541796,a00533d9,a3aa4656,74583d07,c4b3c344,b6ff8cb6,70bf2bd3,5765165b,a466171e,f26439e8,f790e178,f67ef5,d2e15e98,435b4261),
+S(1843988b,42ddec86,dcc6c9ab,36b381ad,a0ca745e,aba36bf0,237e2830,579aaafb,f1bdc95c,d76337e,cb3cfd65,d9c30b7a,e7c7d667,65c9db5a,6130edf5,e240cec4),
+S(a32f7415,9c2743c7,2ef192bf,4a68e838,97a86a0a,3997d1ce,fda3c581,b4fbe683,8862903b,db791be1,dbab5031,ca57f161,b6449bcc,db061438,f45e610d,50ff3bef),
+S(b09dcc04,d9c30c35,2bd63880,a766da1,f6314287,dc201bbf,9605516,3db2a09,7580cf9b,7e30dbf2,8f72e9c,a5152ff1,956ae42b,3e952b18,512824c4,7f4e5b9c),
+S(ca07cbfb,b24ad1a5,edd9a12a,8ac54157,6f3f2ba1,4b878d82,ab7dc996,bd7e2c95,5123ceef,cd20f120,b575dd98,43ef9936,c53cf90c,c481f340,fa166452,72af1c8d),
+S(f8058324,c6b9c2e7,e62147e9,a41ad78d,60e3ecf4,17524c05,80832add,f11349e2,6a39f1a5,f577a932,3217e559,f15eeddc,af6b674a,9d921772,a053b960,a4dfd633),
+S(2e3c0532,6255d80f,a42fc69,d5c92aa4,cd326a5,3e8535f0,435efb7b,694a09ec,ffe0076e,9a93904a,42251dbf,47d03e54,1fb75ac3,8f8499ae,dacb797d,7738c9b1)},
+{S(7bd8469f,80f009fa,b4960cdc,bbfbd4ad,d8e37bb,a4b2a34e,d5c95d17,7a94c207,f3062154,c3bcc160,b2aee99,aac98446,516a277d,85b37fe9,34be9359,4af905c6),
+S(139b7c10,ce844844,f5d0a9db,bd7e1679,17b37e93,9bb6fd2b,4f19643,f22a6af1,32d4e929,27f5951b,ffa4ddde,4b091ec8,531a6f23,f1772c9d,ada292db,2b88c1da),
+S(f49cdd14,14b38e5a,2dd34bff,3d01e1cf,ddefb954,2a641edb,df698d83,774ee70,5c10a6d9,200253e4,a932a42d,2e770f18,69d0336f,3c44f480,ce4a3305,83050c31),
+S(ee145304,4771c862,745f03b,4776ade3,104ea0cf,eda8710a,5fa108eb,1e946826,b91f14,b6127808,f1175b72,2c09e02c,66eae622,109f4156,261d65ff,506b88bd),
+S(c9ebbdda,867f333d,39142483,2e4150a8,c98090ec,d8ba9c09,3673330a,8777d790,c46d72c6,6028477c,e4754960,d40bd10b,b2defc1a,17dbf018,538b71b2,d208372b),
+S(707bf0e3,9f2c8c6c,73a5d0d3,3edb32e3,46e73ac5,dbeef6c,60fb5ebe,b95ece24,adc6edbe,151bcb7c,2ed5fab,1cb9b2de,3ba2f3c5,ca762082,902582cd,e9e27f54),
+S(4a002722,9fda7d33,320fc533,27b6c9cb,88a09c2d,e95aad01,65f68f45,1c82e2a9,233416cf,1cc1ee38,90816a09,17c5fd0d,da0bb8f5,d33c709f,6f1b07b9,916282e0),
+S(8efefe27,b45a4cc0,3088b6e2,2a0baeb0,3e772763,58af3217,f39c7222,1e20b59a,b9f3fcdf,65771acf,cc7b7486,9b10bc3f,b0e8fb2,960cad82,24ea2430,fdad1634),
+S(7bd3815d,6779f321,195047a5,b1772b19,ab29a99f,cc082e93,c442e927,b1ddb235,eeeb4bb7,480f3dd0,92e627a,a042533d,a9eb598a,6cd1ed9,2d75aa89,a592ae8f),
+S(883f939b,6bc9169a,3860d36,9894c4b5,2863b5d8,d0348c4c,62368a94,737fc3cb,96e37629,c05b7231,8800ad96,8e922f7e,5b8a2c39,62a25210,9b3e4949,4b24934f),
+S(4ad8cfb8,e8ba3265,4d32a656,76822176,95c40b92,e97c6d3b,af26449e,149f4b3c,491d3eda,89930ffe,e401b994,54919947,7ef33a8d,6cfdfb9,eb28295a,c5ce94fa),
+S(ff15cd1a,4b185632,c6f11ee7,19319bd3,abce5167,65539608,b1ee3a4e,1671369,24df322b,ab157296,40aeb039,c00ab8,91c96833,4142f87a,1e00d105,b08c63a2),
+S(3fc8e63e,995fda97,1d09d96d,4c84e18c,3e0f4d6a,9f8bca41,20c7c832,c4e9d49b,e17b239d,8e6f7fe7,3c4e46d,3aef9040,6bd631f2,da1677c8,db698484,85922ae0),
+S(d88b3d3,6bfe995e,45812e9f,63e8b6e7,d5a87562,1c4a23b7,ab46f6ad,2f7d1e81,63079694,7c97b00e,311bfdb6,198c2c4e,eda57d09,b17fd74f,7140b40e,d2842d06),
+S(da6971d1,4c0e9c37,e5b1379b,9cedd83e,218ba47,95e4af56,7956922,c64750cc,a14a0bd1,ebd0727a,258c1246,3aaff478,fcb490f0,53d08a40,44cedc97,61be43fa),
+S(d098ccf,e2fee442,74377e1c,57d0b924,45f0954f,7af643d8,b7ed5d9e,956fba23,85c99754,17df24ef,2786621b,c0be5069,a9c59da1,61e14759,ee26b524,e9587d18),
+S(633f9b18,9dd98f3d,8c4de,528f7170,1c9d5972,cabe3219,cc4e5f0e,e7e094e0,3d69c877,28c859e5,d9e8ea27,3c04ec98,ca084df5,d7c9cb34,9fa537ad,f7da0b5e),
+S(2e14be9,af0dda46,8d59df19,9ac9edb0,c875f829,5715cdda,5ba3bed5,d54fcab2,a04688b,64c5d34c,752396d7,f864a9e1,59eea9aa,db8c93c1,5b4d7cd2,539bfa0),
+S(adc92567,7678b197,1e45ed31,38a991dd,a4cd3586,a1ce1498,3ea30be0,642a2dbf,70f2c69b,7e47aa55,cab6ab22,e6482571,e8e1ea52,a52df934,d5ab99d9,acce2770),
+S(ab89aaff,b04be186,183e8076,46c64111,476c552d,10df84ba,10a1efdb,32c01162,fccc1e20,17ac63a4,b9f78ca5,af245a74,4174c952,cfe29491,11ce1d71,e4be8f87),
+S(1195576c,ca3a49b9,4db3f827,1ff2308e,66b66739,a30d73cd,e8acda4,a382002c,6a2be3a1,c6ae9f0d,b314a7d4,728977f2,17e7c7d0,199868fb,c7f79d31,6cd7d32),
+S(8a15bed9,bfa215f5,42c62c89,da0adb8,c68cbc33,d9c879d7,a2f2803,b7068556,ef437bc1,1786cd73,6dc321d0,a3360517,3e7572f5,bce04b7a,3c8cdb85,cb56e697),
+S(b4521d6d,f9b20080,4d3799ca,4cdc87bc,ea970d60,a3005071,e910210f,5654da88,c4ddf348,2a23e98f,b86ab9e8,4decc6b6,ad18d879,e96435d7,4b944d8c,f7cc1587),
+S(4074523e,b75634f7,6442c3bf,ed9a52d4,5f6636f0,77a10e84,5e6ed950,b673a9ea,d8889a02,ec95b511,aa74db1a,10c91547,45b89b57,981011a0,9d4ce57b,e4e1f032),
+S(b2e71794,e6ac98d1,ce532974,df79215e,bed8c668,561dc391,505e9e26,8444a858,94d8ff19,b8a74599,fbe5f471,e7f3e1ff,e0238cc9,2504f99a,9c4f5fbc,2e482854),
+S(2e672209,8a6b4ca3,905a8910,6d23daf5,aeee63e4,34e7bade,70395df0,e5a1af87,708e9fd2,a3c0a3b1,b0e03f96,c3d477d2,abf6dc0c,bb8a7181,ca4b18db,ed12e3f7),
+S(7ec0fbda,63fe7404,438e36,d567d9b0,bdf18b09,d929329b,24a8bc91,816fd433,f80ab84a,99d214fa,5d288e3b,c2b5560f,a1791412,9c3d16ff,cabed23,736e4f85),
+S(f166252a,34572146,8bf3a3d7,bdd2c67c,b0d36b02,d7a70033,add26f97,128b1637,134eea4a,42b482c7,ad625407,bb89a615,656e3a2d,232f4bbb,a33660b2,403d6f63),
+S(7af860e0,27d3b1df,aa0244e2,51f9459e,488afbce,6a3aa610,e5e223b7,81ba2d93,6ad22116,415c668,7dd3f4f7,b5a00599,bd35705,951e1093,3f85f815,4d0c8af7),
+S(e4ad03b7,e01c5d04,7030fe59,6e7e7960,77d9847a,e604d2c1,d801a5eb,e21c0731,c7757ea8,f57af58f,b64f3eb9,c7762bc9,544f28d,a80d760f,c46b0c9,589019e8),
+S(ffb2f941,f27aa8ad,6a59ed01,24e83bb,d49f2588,a5602389,15329f6d,f77220dc,6812c00,7dd44185,fc3f0687,6f7a62d0,d31adc40,c0a1a060,c67df13b,e4cd4873),
+S(42ca15ab,9f245041,ce991e19,3d696f4f,4c277df9,8cad603,8ad0772c,2da6e03,972d10d9,37e3a836,9b831b2e,347ff11,29917a59,7ef94158,7c977604,73cb849c)},
+{S(576abbcb,8b768480,882aefc,81380709,831625a4,b9de63a7,b9c3390b,9cb4c7fe,b49453e4,6e17bbae,2f1f8f9b,91c3ed04,80d5f194,33917cbb,d28b878,bc6e6c4e),
+S(f9d8a157,c151181,3e085c1d,ef2958fb,df2a17b2,6b330a0b,2d512c87,69e5c14,7eacca29,26aa402f,f8b78d57,f5e02add,91087da9,d607bb41,b56a40f8,f7b19b78),
+S(d31dff73,7d2d3422,7fe39dee,b2eb4bcf,dc84bd39,d6cfc4ea,ff09812,23400a80,4af55e8a,fe8e8ab1,2e2c4463,d41824df,7b53e44d,efd946ad,b6128214,4244055d),
+S(9ff2bce8,a9fe6c7e,e68a8292,f0d2f4c4,8d963c47,63018a55,89a2c130,667bc861,eb138923,94aadfc9,6eca7c5,78c0fcc,bb31a40f,98d02e93,a140abd3,cdf041b3),
+S(1397cd8b,aed3c601,b6eee616,243a61dc,fead22fa,da50db4c,1f9e2776,6e5bc9da,534a8e23,59316503,cae233f0,3b6ef0bf,1c7e0105,119d1a49,ee688f04,40695c66),
+S(4ee38986,511024ab,5385f710,42bc3778,7cbedd0a,ad13ba24,b77f42c8,2ae935d6,cf87468,24a38404,f313965,a64c927e,4ba0b7e0,140f6b36,47e2049e,35a74e4f),
+S(7614cd7f,9b5f1455,74d0d38a,370f69ca,f3050297,10af5242,e5ccf19b,187dd189,b946eded,e4b72db1,6dad876e,396e836a,875d7c9a,28a9c739,f665c741,29ab7648),
+S(67fd2372,5bfb445e,5254bc42,f7dbc1a1,65bd4017,cd1019b0,8a3f96cb,7b3c7cec,b556e950,a144febd,a81dd3f2,f729ecb,fe43fc78,8658bb7d,2b9735d7,b06a920a),
+S(57572b1f,1f17070e,e9b30b6b,c7168cb2,4741ec5a,b3496b1a,c06ec0f2,5f910fce,8cfe2940,3dc97084,7ab28da7,167e78fe,f2310c83,ca476a97,91ca35a9,610bc560),
+S(1f111332,1e31a294,cab4df73,5a0ef333,e753c2f,7c83705c,9a5bf27,1321c4f8,8fed26de,202c92dc,5b51b13b,6e9bae41,3c7c88d7,b858dd72,a11f073b,e2945f9b),
+S(23c9e313,b04eebff,15fb0625,43de6975,d19decf6,6416f4d1,855083bb,d738f882,90673370,f380ca49,e876d5f4,b6649de0,24f4454,29cf9d91,96f4f196,8a49ed99),
+S(b9251407,6ef7f01e,379aafe8,8f22c156,65a85ead,f671d8c9,89602c5f,804725e7,b3a9409f,7bf973b4,aebe08e1,5ac65562,56983f89,23415e0d,eeda4f4a,c0d7c5f2),
+S(1bf9deee,948b3fe1,b4345800,51c67266,8fdb7af2,99275a83,706f9716,7e38e38a,688fc563,771b7d27,f9c09953,c40cf009,a55d7329,5fae0b7d,8fc37710,729a3911),
+S(34e20de5,9d00dd45,19a70b3f,2994fc4,588ca9b2,beaf6afe,4a1daae2,10692f33,7804aff0,a43f1ba0,438c05ff,8d013e3b,e5180bb7,3a969825,fc97ef52,6da1b6a8),
+S(80fc119e,85e88b0c,8c84d23f,9e44e96,1c7722d8,51d4c9bf,f1824fb3,365823ef,efee941a,a60743a,28b6ffd,39762f9e,437d2b00,206e718,7fc423bf,4eff0caa),
+S(89ab0f45,e3860393,f24b1845,7578fe79,b812926a,6bff3788,c8baf283,89fdbf0e,57d4fc21,42bf446f,8e4d9331,659e7673,90391fe6,62e77ee7,f7a4886c,8f440c8d),
+S(1f092931,664bb98b,79d8fb4c,efb287a0,f72641fb,1cebe711,820c92e0,42f26437,59f63ca0,b8e2e959,a97b1c1d,1cfa4c02,380dc42f,db7cb5b0,995ceba1,d7e45d94),
+S(95ac9f36,f447928f,344eb4e1,9ea806,717600e5,148ad222,fdd52a83,86bc3537,cdef5355,e928b1e8,225b5a53,bb976822,6fb50d1f,6c6cde20,758d5ab0,e9f28543),
+S(a9ce5ddd,9941ea69,1343ea71,c85fcd73,6269826d,6eda5008,44cdd1b9,4a66044d,29504563,1fcb7590,27d904c5,4ffc325,2ce3c8a2,169f4649,907db751,2ef3ce43),
+S(2edf81,45c4bcf9,62425707,ccb36a3e,7fa1fadb,4062d14d,f78771eb,f3ec15d9,dcfc961c,547548f2,73206d9e,aa0d829,a235f66c,5afbba92,68fdf9e6,abc8260b),
+S(fcf5b985,c935e207,92907b93,e9976ceb,ed320a14,3cf286ad,b38540ad,b4077dee,8a0e0b4d,1ab114b1,caf7d0d,f749f219,b75acea5,6a71b3f6,aa18557b,1da85262),
+S(2bd4391f,42b70803,2baf4816,54569f48,95f1434e,be6f146d,41447f45,f14581b3,dbc9937a,61f43af7,42635810,5cdfa02c,49a5186,ce67bbbd,7ced2842,19a37506),
+S(eb00deae,6cf69ccb,abe6b93e,e5493e05,d22e53c1,b069a6c,4660330a,4e3bc069,18002f2f,61b08dbb,60c784b8,4c6d71d4,6b004e6a,3089a0d5,f853d659,83242d9b),
+S(c7c62a5f,ce15326f,25b2fc5b,697cc7f7,26d231e9,e7e9f15f,5998b8b0,10605524,8ad4b370,ea0506f6,f25eb16a,78f87ef2,f408cd17,fa4ec63d,4ee21448,1d5286b7),
+S(aa1c2baf,632673de,6f6704aa,5a76c077,be0c24b5,223de654,88d1386f,15a1a002,de4648e4,fda7db79,41efc5e8,6fec516b,c6aef164,62d6dc08,fe93ebc7,a85261f5),
+S(11871161,13c3c670,e7f5366,edd22282,1f76ec98,d1a3500d,f0e483d1,e53f2666,d0042c9e,8dc1d72c,f53836f3,2c76b5b6,52fd5ec1,9e8fde42,aed1a7e0,9d242745),
+S(e232a92c,9ffdabcf,24422182,34078534,6b6b79f5,983ddd57,2580c3df,e4ee4118,6c1144c7,471342d8,7a784fe1,587ef576,483f8980,bbab12f9,35aa0d84,83c1d76d),
+S(1ab6237,3998ded,e50aec45,8043f830,8a7b4564,2dd3c9bb,4804f98e,a7c2e0c9,5528e158,6a23aec9,81f04b51,b90576a9,a9e7feb5,53200e51,e604898f,e55996f3),
+S(3bc24bc9,cbc58de3,46644de9,b17ffa7,39a0f7d8,83eb9f52,af19eaf4,d8d52891,f71cf5b,7587c275,8014127b,f404b70b,b257bad7,f5b78d2e,c792e1d6,b2fa4493),
+S(a2bf9afe,e6eec182,ef5866a,b4bdfe2e,9d045323,343aa422,8c1a13ae,fee515dd,a5ee438e,3aa35484,c5f5a1d5,43fa15d7,ff0d1c55,6571678b,a3c5694e,f93cfa1d),
+S(a0b2b4f,ed0ddd23,8812806c,fccdfa9,7fb3b42a,748721ae,6477dc9b,18953133,325ee7d3,4a540d0,fc3e3935,79ba7372,905c7b17,4f12b456,b43db5c7,cb50ec66),
+S(e7b9796b,5ca006d1,632f482d,7f0fe393,2cf16a5a,e104eea7,a7ea1c25,1073e879,ed476773,e6e961d0,20bdefd5,8c833e35,634a40da,1256750c,c718ef75,45575e97)},
+{S(a8565dfb,75f8eea8,ca9ca6e7,c7d18a5,bf3e437,5d1f4e87,68d5f51a,57199ac5,daa7d7c6,cb86b215,a682141f,2308d9b,4c204196,eb779f32,fcddf0a2,da194921),
+S(974619cb,86016199,20f507ee,62d10295,44abdd66,456952a0,54e945bd,7890250f,6c8d8bc8,21da8234,1ffd0cf0,548be1dc,a1bb7e1f,47354dc8,3e5d96c8,2c9676f3),
+S(24bbdc24,1396b6e1,75f23a6,4bfb41fe,f8329b80,d306586a,ecb69e41,2a2014b8,aa6448ec,f00a0710,27b46f09,d696642b,9274ce3a,11a3e986,e84536e3,7fd7b2f8),
+S(eed9a6b4,68004486,e3bd388d,591d3b65,2f35a3f1,9401e5de,81a86f5e,b7cd972c,c81f9aaa,d7300671,b3dbdd73,a095c79a,d73ffbd5,9f845eed,9fe3a57f,a41e9468),
+S(5260e0f6,fdc6858a,8d519d3f,6c71929e,36979b65,431a6f3a,a7507797,e54654e2,5af860e5,fbcf9676,bb00c329,d3e2e058,efc860e5,cb9006ad,224caa32,9fd49f07),
+S(11e53f67,d844c511,b8118f28,de6ed9b8,66b70bf,214d4d1,ed79adfc,18f7d6bb,20dd984d,7b9eb626,77e411da,2e823045,685a4bc5,2a3f4e5a,3aedea95,1060b330),
+S(98c9f3f6,81e220e6,d4bba711,fa8b212a,dcc21bc4,8219b813,eabdfac5,70e6fffe,bd0890be,d9cf4ec9,44f6abb1,56250329,a37d2cc4,64c931ba,8606c2ce,55127aa2),
+S(f644f4f0,43d7713,ba4380d8,26ad0f3f,44106352,142fef13,7c6e05ce,5e9f1571,3192280b,f3971223,c00ed336,94779866,536020b6,79ba8cb5,c4f9c515,69d2f97d),
+S(334ab869,32c4097c,8d8d8a23,d529b079,6a759d47,a907b047,548e735,5b3b766b,18f11736,d54c9d00,89149b07,35f5a9de,b15d9c,cde4ee06,155a4f3f,de98a7bb),
+S(983542dc,61b43ee5,c4a7f36f,22da008e,832d4eac,6791d838,1a095d0e,6d8a14b5,cd225f2c,334d1ba9,94b0a681,d6be7696,16bfb2a2,426e9939,d2238cd4,43bebd02),
+S(dbbac008,1b678270,4a0fcef0,73683822,a3d4107,d7f1a71b,41497da2,9cc942a0,cd25ef66,36f21a8b,532371ae,b91b67a,deea5797,983dc36f,54aed202,d9845515),
+S(477949e6,9ed28a74,879bc8cc,660696cb,115e6392,5a63817b,60e5187f,1f77f3be,dd8ca490,fb8e3bc1,44f5fe9f,aa41ce73,56a1dce1,cc8e11c3,ca5725e,d1b764ae),
+S(7616b9e8,b451d4e2,e4826586,9bfad6c8,ddbf5fd2,2342c6c8,42d6bbe0,398f94a2,4e3bb1a9,76efd345,3c4474ad,e6a494f6,4f97c6dc,c98cf68,72bca24b,dd9e946f),
+S(b87fb86f,6ec4ad7d,5bec3bee,e8d68618,c8e4906d,1c584368,ec819f2f,871ca8c3,c64723c0,aa587911,4dda9c75,493f739b,e8c2221b,b2e75ee5,b25def54,a1d40c2f),
+S(56ea4572,61a6ccfb,46fced99,1258b31e,8573a488,aa53b7ad,65333452,b06d41c4,d8529601,4145e12e,a72ae4d1,5ae6e5f6,9cc88ba1,4d79467a,3df3bfef,33d84290),
+S(e4c6540a,19682e0d,e1f1258a,103037a0,af4df5ad,f27cbb7c,9e3ce67d,e23e13d8,a31e1b08,4bdb5728,36e53d93,1de035,c90b1efe,b5343b23,cac0e7a2,bf5b3868),
+S(1902cf3b,90fae93,1855d758,24995b03,e1604861,199853c6,ece84903,c8bd67de,3b3d41e3,a2dd4c28,16d492c3,e6c53c83,e5203c7c,a8100d41,24cbdcd0,e12fe222),
+S(6519f4d3,b5d731fe,eada6806,727623a4,daf924d9,b6337a51,56096ec4,16ab42d4,62e2c1ea,afa990bd,6dd91675,e3b2d1e2,acb2fee8,e56ec30b,eb25bdce,2d3ad30e),
+S(e1128682,519b965e,a933f197,eb0997a0,16114459,4c0915cc,9c55ea4,a30c1ad1,cb1370ba,f8707c78,84817ee2,8227da3b,7b7c97c8,266af491,e0d52bc4,ea0f9614),
+S(4366960c,6ff595d4,143d4cd4,f0f0df2d,3bf864d5,73790abc,23419c7d,6ed9201b,623faab8,2caebb5a,b4c42bf6,b2a686cd,4640cde1,a95a65a1,f8d32836,9e5ee0cb),
+S(5acdf691,3c1e283,c1220355,6efd99c5,d347ef69,bda1d040,44cbf0d1,ae41b16a,1bca567a,71698c35,e35e031c,e8a98dd,e34270d1,4e2e2439,9276a7c3,6a1f35df),
+S(807ecc04,81aae374,1efec46c,8c6c194b,faa0607c,cf5b7cda,fc270fb5,f5b416bd,cc60be6a,6736dd94,848fbb05,375f6459,d556866d,165a2c16,41984411,dda33fc3),
+S(29c470bd,97737284,765adcaa,68a98af7,5e6c275f,fa4fcd5d,6c71d428,bd3bfd79,b19ab40f,33c15201,41fed31f,681f176,4a464373,23283677,a40b4018,99a6eec0),
+S(41a6d6f9,40bb8abd,9e8748,dcfd23f0,5333eafc,4ce311a3,161440a6,619efabb,b2a3702e,900788cd,bf35204,27e0facd,b090804,62f65418,89a3c34f,ae2cc008),
+S(d5f5096d,776ffdb,f694b9c5,c9a9ae0,ab5897ff,c5ca3320,82cb2a2b,8afcfe89,6461e24e,28560d11,336244da,2038e13,c69ed5,a7a435a6,d07a1d72,be43daa0),
+S(f65a00d9,5707ce6c,6bd55e8b,4b0ef381,1eca65b2,9845433,d7b307e,518ea724,7ae079e,9aecabf0,4ec5210a,b85328f7,e60c8ff7,3deb037b,c8e6e1d3,34774734),
+S(346cff42,23c9ed2d,a1082d46,eeaff341,f7866e72,d95561b9,678def2d,9f7cd187,f97f85d8,92002750,11efcc9e,f8ff58e4,894f105f,b94e7390,7e185806,575698b3),
+S(d0e3cdff,a47417f3,86f64a2,4029e3fd,9bc7a464,6e839bf9,232a0d50,349ecaac,5bdbecfa,2a2b35d3,ce2e9837,222535c1,57ec5bda,5fd70186,1920803d,a279989e),
+S(f6bbbd77,b8dba8fd,704a3f02,1bc418c0,f8524c49,ccfcd14d,fcbf7f04,c9a18d,38184001,f39b257b,6755a132,86bdfd92,1a8ff771,fdd5530d,48eb8227,ea70be1),
+S(6717bbd0,f019990a,c01a2996,e34f0912,9bf60a3a,71d8124e,fd86c777,9cfad879,9581f790,a16825d8,f44f316f,db3f0bde,108643cc,b390bdc0,75f3dccb,6520029f),
+S(417c765,ca91a120,2b07459e,3713d5e1,bbcdfa82,bbc26cc9,279fa2d2,59251fa2,8d281a2a,ed38a80a,cb697989,9839d7c5,265b4e78,8a9e1176,66cfb6fc,4143a935),
+S(e2f349b0,f89c69bd,3c8cf2a4,10730dc5,8e0beed4,7048c58c,15f9ffc2,508d2cc2,e014d0d7,f07d8dc8,7e79f513,89fdea45,bdcbb417,1f63424c,81cb8426,1f2b3be0)},
+{S(aceb57c9,187a5202,118c4dbe,573906e1,646b0325,781c1352,574ed15,e02b87b,68ece7f4,4037ff05,d4b89120,d90f08c6,f0499fee,d4e9e02a,a2e68bcc,2d7b70a),
+S(365e555e,de9130af,99f996b2,106229c,c36c1ea5,8b065cb5,38af3a5d,2cec1145,81fc523c,b4b97bd3,cccce1e1,d1980769,fbc25a9f,a403adba,8e7e8074,13c87f9c),
+S(d0a3812c,b9244d7b,c1f5b652,adbb0df,22d15d41,b1724071,fd297d00,bc8cbb01,f8d7650e,fda2be30,24ded196,eb3baf7f,351d2013,2479640,16ee4c6,b469951),
+S(8f4ce1e2,a51c0ebf,f5e34cb1,c6aedd87,85e415dc,e7307119,143bbe9a,3e7fc632,617009a,ee7d4d81,1ba2bf14,d1647911,bf1a3bbe,cba8dfda,9030ead3,803fc217),
+S(ea23d837,54cb2e9f,9b884ef,f4d1a708,bc1826c6,59fea53b,f52c51b4,9fe0e21b,7e8c691b,cfc3b7e,56a7699c,4f56a11a,fca5710d,963d602b,b102e1c5,b36dc3f7),
+S(e3c970b2,c764c9f4,ad8bdc15,cf995690,807f5d09,4a849787,9d278d18,eed6ceea,aad8c7d7,13ce5439,b9125d9e,c14b5d8a,1c694cfc,f84e6922,b7e58df1,4ab8a34),
+S(8ade30a,94b236b9,9597be14,bd421130,b6843895,a85f3613,efcfa0ce,9781a96e,78e4bf57,974cfc0f,c310330e,6aa47de8,2b0f5009,5a703fa,50093d5b,a8e8f0ef),
+S(fa5f1cd3,4427d71a,de7e79b2,b0a17ba9,66d05324,1f9996e,be8143c1,9186d24a,3481bd18,2319ddf8,f344e4b0,196b3ddb,10deef4,d8d75c0e,49fc5fe4,cbd6e1fc),
+S(8b88b79e,8cd28dc8,58e3f1a6,155146b9,af1e3697,d57b7435,c649f6c3,bf8574ca,e736106c,8ffb9bf4,d83d79f2,4faf8fe2,ba5dc258,e4ae1b1b,b58a1a7e,4922c95b),
+S(12078a5,5c46d721,96a148d2,fdf6505b,d059e423,c5d5295e,facc2b82,aec51f5d,66a4332d,cd265085,add9a141,2fae2562,17441d7,dd9596ad,46309a0d,bfb4e55e),
+S(841523ef,29f5bffa,b31a526d,bf74b16b,fac3a3aa,391f7404,6675cba8,7808c171,7a3fc3f5,bac300b5,7ef843df,e334c995,cf66de11,2283fdfc,767cb57e,e7e7329c),
+S(c8831ece,f4545c2b,387378b4,f88173d3,f1cc7db9,d064774d,60394f0a,ecaf5af6,f32f1a48,bb802757,34e66cbe,58a3ed3f,adf28dd9,374a42a,a824a095,6701322a),
+S(30001ff3,7b1b1691,9a135a31,287e3a3d,383ef3ca,94748e33,a52c146,586dc4b9,9d71b25d,6fc35db7,26b58d1f,642dabb,46dfa64d,e0ec2a12,c53c414a,9dd2574b),
+S(a17d3621,74d3c789,c4e00888,fd4b0f4e,ea3929cf,afea9e9f,7439901e,d6b0fe44,2bcf09ef,2d374194,510fc057,dc973fe1,bb687428,91e9056d,a5b4df7a,de79bf),
+S(4725e2cb,19f95359,2da72565,d8405e09,92a64299,9ad74ed5,b41f5d24,44cb6b0f,be23fa82,7aec3121,7b90028d,b61d1092,764b2824,9f3fa0ef,91929db9,b2e0246b),
+S(67c560dd,74c276c4,df3efbe3,b95dca4e,a56c4563,cc7ae225,ebea90e0,f5e212fa,2c9e3120,d52ef31d,7e9e36d6,eafbcdbf,ed8a28c6,7edefb94,1df7f38b,cb05c160),
+S(8468da98,7b33b79b,e08da5fd,57cee298,ef86f624,3bb975da,2f4261e8,f7531d92,455d8a8e,b4f45693,2e8b6f77,ddefe070,591dd37f,d6ad3a27,5774055b,8a63e650),
+S(3416d4bb,78de7570,b1e9e912,83a3e8fc,be6524d7,4463dee6,82e84e52,72c0953c,94e55458,2c17fffd,321364c9,16658093,986b56,f88b4818,129e19c8,ce685dcc),
+S(5c66928c,a39a6e22,672c1dba,8bb6331b,41a7f43c,a72276a6,afd3e209,6416a9c5,181cdfc4,15e7d6a3,c24be94b,7fe328cc,ab624c0d,dfabb1b8,f9a73b56,cdfe1b28),
+S(971f7a13,210680a3,ff6a12ad,17481a63,ef624d0c,e4121166,7e63aaf7,9cafce,5de2fd1b,3149e321,2980c7d,88a49018,26f83f18,7438061e,9bdb8d33,6a4b08f6),
+S(650277a7,9ae7682d,c5f3526b,8411342e,b48277a4,9876caa7,61ec6815,9a1f13c3,a903255,fcf09808,cd97d92a,26dbd2e4,7a29571f,ae91107a,7cb6f0cc,3aea1985),
+S(76a79cc9,7fb80ab3,e8d31e5a,d11f5ce4,74696d23,f1ee7aab,3928848b,556f483e,1779bc5d,c763d1ef,7611b402,4583f07d,c7dc9c96,7afcf83f,e6b6ee42,da75972e),
+S(6e0b4015,474fe250,d372400f,13efa0b,70c4e8df,816c0e8b,8d27a7,a8168d54,f01dafc8,8178dcf7,15f8fcc2,e7163137,9e1dd4cb,6c88cfbd,e9a051f,ad204c3f),
+S(ee5dd472,b5efeba9,d0e354dc,21228d22,40a69088,842d00dd,6b6358e4,309d1f5b,bce93ac,3fd4a098,9e74448f,5832643a,a2a172f2,eff1e2c6,c61ea99,cc6e7cdc),
+S(df99a925,ef2e9f9e,57208fe6,5373ff94,876b1448,368dd453,436c59d0,f2a857e2,88dcfe81,4397f990,56f92a27,143c902a,2a6a66f7,f7e9652e,e0b16f13,33252a1e),
+S(9186f095,43dc64db,ad582561,cab96a38,89be54ad,e1cdb27d,674af836,22b5d284,71ae31d5,a73b29f,54af1aa3,2d8e541b,14f7cebc,9279ac26,c846d466,aa975e20),
+S(645da454,63357bfb,61b5b932,1897a73b,87af6077,81487bc8,af1a66ba,49bc5e37,4b925aab,aa7bbc19,5963025e,f1896cb5,b6463242,cd8a35f3,b1b404b0,7faf8e94),
+S(5cd9a6c4,e9d372db,90a65f11,1f1a1b5,f28bc3b8,3d05f599,39979c91,5277eab1,c147420f,7dfc4ef4,d7d1f08c,1c523771,86a8d7a7,10cd7017,82b97c55,63287aa8),
+S(4fd699b1,2c720ccd,7b977e5b,dc622671,18ac3028,bd635b26,fce648cf,335cacbb,3936f10c,aee5f51,26b86240,3249e1d3,5566714d,17ddc19e,cc4d1056,71e523f6),
+S(b3fa0545,83510d6b,91226711,4bac7f4,ba4ae5fb,baad7230,3003efcc,4c3c18e1,57a3db8a,6cbf0a94,845e7d67,f9b01902,55aa5b66,ef31abd,34ee0410,ed55d0e0),
+S(fd73c052,b194c6c6,dd46aca9,d640981a,ec796009,17a565eb,e77fd534,649a2115,9df8973e,37e877bb,fdf5454f,d9082926,fb09fea9,d162bde0,fb635483,59458f55),
+S(2982dbbc,5f366c9f,78e29ebb,ecb1bb22,3deb5c4e,e638b458,3bd3a9af,3149f8ef,59e4a416,5099ddf5,4605acc6,384a4362,f6a2466b,ed1c127b,a918d94e,e93859e7)},
+{S(8aff982a,fbe09f67,6d6e0f49,e2b68f88,8f20dd2e,6387b420,8157ab24,d19027ed,f2350ea9,d00fd861,41259f03,b51b5326,6ce05a34,74508bd4,31ca74e1,366eaf92),
+S(27ff285b,1e14961d,a042bd31,56aa44af,5e73717d,fa413a47,b300f358,e1960dd0,8b578851,264a8fea,2e29bbcb,cb9c90e4,93e8c731,983f4bba,65381e88,bc83a8a7),
+S(fc6acf61,4a214859,1418ab5e,e0f0274a,309a8248,2cf01f73,db8a9790,825486df,190b9c0d,46953d99,c9de2bdc,bcc15d23,ee90485c,c4c152d8,e28322e5,4c927d54),
+S(743bcc6,ac86b0be,a25cce81,1fdcfc13,73f23926,e3116fc8,9415b8c0,4c1983ac,f3df10fd,4afbd3b2,dc0678c9,102150e6,3d005680,6a5e45fe,c95ea495,9f2b8555),
+S(bb165428,2c13362b,b1e017e6,6402613e,f82bbe22,9429f29c,6a1a522e,4956d67c,ec542c4f,7fbf3c6c,32e71aaa,86e3e4e7,e52b0d43,98589e15,1f17417a,40b31b07),
+S(b3f74ed2,5a7fd474,5820a2f6,221349aa,e41af762,25c2b706,160a463d,1d59e7bc,a9af9d2d,89dcdfe0,21ca46e8,5f09bdb5,197c8f23,bc56d705,851974da,1608dad2),
+S(20c0914e,f88902a8,6af0ff68,a08f96ea,25f15ea6,b1128900,120028a1,1049a77a,339567f2,71a1f1c7,16eb1d56,2f009537,68ff4cd3,9a81c6d9,6359d2f5,5d04db9c),
+S(a3555aea,2e96f05,d25a145e,4ad0d2f7,fb453974,8c4a3097,a703c0f5,404a0e7a,ee236b76,8fa04380,b0448beb,d2589665,e43299ee,b9fc78fe,5a64db69,ac92b7df),
+S(37191a66,1d2a7bd,c96a0767,ce47d97d,7acfb8c0,ce251e9a,1421e2d6,29230c2b,57093393,4783afd7,2df6524e,871c8e67,ff2f48c9,c73e2054,fb219cf,d3c2a68c),
+S(1a2f5b6c,5fbe300,8b01407a,b0b28c3d,c823cca9,b4c71a1e,4fc814f1,e186e062,b2f1c632,a9d92a4c,82d31a55,f4fd50bd,d53ee99a,2e1452a4,e43e5ac4,b8cbb7c6),
+S(2976575c,c5e70e47,cd9c10e1,32a593dd,12b65215,38613cb7,22390022,73fb41d0,c3f0b08d,a2a3a046,d87dcb13,38c35824,1a8b9959,e2567543,852dcf73,c4f5cba2),
+S(bca28e75,5cd6ab74,85884b30,ef399f,44188695,fe9c4143,6016bdec,25d502f7,b67538d4,a571e935,cbefe237,c5a01f77,4ade337c,fec9f95f,3e9cf042,f0dbab6c),
+S(3dfe1718,beafee83,b858048d,25d46ee6,7741d3bc,bec1e52d,3ce308cf,738b715,8499a8b3,a0c7c599,f62f056a,a8364494,ec6e0198,2c47bbf8,7e2df591,de0ff537),
+S(bde6252e,a9e4823f,36bd1737,ce188fae,be4a271,9984c9e6,76f9f4ff,d070c1c1,2e5db82d,e02a1fe1,39d903,7e7adeef,12d40366,de0eb164,c04b2ef4,b1e849b6),
+S(2c74b766,eebac93c,479fc0bd,78a3805,de50be2d,a6ad70c6,9048e43e,c91343af,ab7a929d,588ff993,55094f83,6e7b3b58,c6381bfb,b284f9bf,7dc44cc2,67cc741c),
+S(f0e084a7,af9abfaf,b6ebf3c5,b526d545,b8b1cf5e,8e09a06c,3670aa37,6af83a3d,6bb279db,abdb2b2d,fcc97510,2b075dfe,b42d9e6a,5a8af760,f4b63788,c315f8dc),
+S(715aa28f,4e52fc26,a2f4b9f,391894b0,6adc3b69,b508827b,4732396f,5eb7edb5,c5d0d68b,3a8c6532,2f6303ab,99b6c48a,88572c4c,56c780d1,d51d2441,86ba110c),
+S(8f980e69,3511ec3,cca89b2c,362835bd,24d9c8a6,97deff86,5540f7c2,b0bacf8b,2d5e8470,f2041ca6,f158ac83,e92a2345,4059492f,af27ada2,92bbe51a,d67ee5aa),
+S(6823a4e9,d80838b2,750dada3,cc31f59f,3cc9d6c8,3f33aa5,38d949aa,c4d6d657,e087127a,3ddc19cb,e4088a2a,6df61863,e8e81cf5,c5cea4a8,8cd2ab51,bfbcba8d),
+S(8c9af14b,11add28a,818f85f3,276d1d7a,1e3478f4,23e74b72,caaf2440,24558538,a7c17174,da1eed2,7eeb7b6,c1d93e4e,9e4515c5,3cd888d5,e4527cdb,94a64fb1),
+S(5fadb7c4,74b13592,a1a27f76,b7c2011a,102b66a0,c6ffbc02,a7306e1b,a9ccf49c,7bf61c4f,134f8b4,7a5f90a1,938918a1,4d151f2c,7f1c4bea,cb8c4773,cf11609d),
+S(79a21b82,9325fbe5,c01ac979,8b89cc47,379eac4b,682fd747,47e0c04b,879b404d,abfa4d5c,7ff916c4,9f489c12,5235bd9d,a0395b6b,84d6699f,c96f9c0a,5a4cab2b),
+S(b213d11d,e4b5601a,5f10827e,d39a7825,adc36bc0,1130a055,cf8b3e8e,fc96d10b,27c0e5b7,a739fcd0,5eb73321,3fd1bbb7,873de0a1,2b92cbc,21de57c6,2bc812b1),
+S(299ef8e,e131f523,72949d7e,fc2f0f7f,9965e69b,56725b55,4d513435,ac8b0b3e,8ba93fa0,2a4d97b3,54d47c10,d5d791c5,f724b68,4f501eda,1931e563,2c6faf06),
+S(5143ab76,43a21de7,7ffd0f3b,c4746fb0,589be22d,9d9ca2fb,89403a39,86d1cd37,20991000,a7c01e4b,26d9236a,45568bbd,91c968d6,c87dbe05,15063af,d8db5a03),
+S(738ce787,49783066,923ceec9,a841d60b,56855e09,93e67cb9,9d52a0ca,7a64b5b2,aba44aa,272945fc,5eee0330,976b659a,a6455dde,feb5c894,cd274414,71610384),
+S(6bb9bbe0,4c3dbaf,6c60adcf,5ec5fa59,29cdb04b,14633c10,5dfca2c,183e1d97,b7dac59b,5c35c3cc,15521da5,89c0d333,9dac05c6,614acaf1,d8b9e834,8e02c3c9),
+S(f325eeb8,49a32b2a,fb19491d,8c3c112f,a7ca3443,438c8c19,99bdf791,6981472a,169df94,a26f26b1,e5aaf810,7a148faa,17742c3,10cac320,6daa69,f8aad67b),
+S(d279bc0c,f7f58a85,b5abbe25,936d5088,4d8ae8a4,b415ea30,2c0f1133,de98603c,1e69875e,2e38f9af,222e03b1,6c833bd1,12bc10f8,1724da7e,bc780e6f,5228fd17),
+S(224d079c,750eb1b4,2d70aa25,5fa0c3fd,c2d07c1d,ae4d6cb1,17c1e61c,5ec1c6b3,e54dc4fa,b0e05362,60d27fa7,ba53c37c,a37ce30e,617365dd,1c58a59d,2c93ed00),
+S(f4741ca2,b3de5414,49426531,d546272d,ab8fc55d,8f65eb3d,5ea780a,d25cb53b,3b7290bf,dda0d0f,e3704f27,d8537063,f2fe9571,4a0791a3,e1a25865,96a5b0b1),
+S(e931258e,8eb5559c,6d697272,8a704c17,b775a26,5b4527d4,a4d4d742,bbfd71fa,4e1ccc9,b3c0211f,17a14be9,636ab4bf,4c6b931e,44a1ca0c,c2642f2b,e8b2c928)},
+{S(fa01dd32,fada2843,c51845e6,3cdc1b76,79dee47b,d2f4b767,5133aa5e,62029057,6ea6596a,b0ea0201,b6c8bbbc,e9d07fd0,8040e1fa,198c8767,67ab6055,34a33),
+S(97ec9d33,a9d88115,471619b5,3fc58a08,e6997662,7a28afc0,b75b2f49,55eba300,92ad1d6a,f8a0a100,27d9ba90,4f7fea6a,571f3c32,53393a7c,79abb0cf,9a558390),
+S(ef364ba7,626d72a6,87bc9776,3f2c0833,50640bec,6ff4d80,9dabcf2,9ea9145c,7f8d7c48,1bd80ff4,8eccfa9d,2de5eeb9,800cb98,c02da539,3b3d6c83,8fe4a2ff),
+S(45961303,a778b47a,89109231,3242304,30a17859,7d940e9f,fc2f25bd,1be61c00,5fa356b6,daad2b1d,7bb19cce,b9148d31,58d2651a,b4b436c0,b99193f6,61cb037d),
+S(8aa677f4,d73c0725,e2163e5d,ed3dc312,7ad5ee29,f9bad8b8,5ab8f50d,ec6d77e9,1fcb9da0,d3fb9bc3,3a45bcdc,50aa2ba1,16c2b05e,836b539c,863163c7,2436c334),
+S(8c6b2873,33082bf5,a3597a26,7cc14696,2b689f20,59caf1d9,35972c98,9b14c86b,aa86d282,a1107f8e,21307e0,2ad1420a,a4061fea,3e3dd6f5,9b5d6900,6bf4827c),
+S(46c963f0,3bdbf433,cbd60858,5a4d659e,9815c286,9f684eaa,cd879d66,ceed05ed,be2a8d60,636c5b80,e443b13a,9e21c91e,90a9e781,1c35101a,dfd61a49,88193e86),
+S(cdbe43bc,582f3936,314a88f9,fa21b29d,f4b5acf5,96cdac3,4667e9c4,b02b926b,8f2a5b62,4f20b20d,cce97348,d73d5653,8651dd41,dfedd476,8792fa61,1bac16fa),
+S(6f9c5a84,1ffededc,ec45dc63,7ad15aea,207116aa,a3036ea,ddfb0656,1dfd074d,ddf1c22f,9168232d,cf9c36a5,dfb7835e,62d28405,bd32ec15,5e3ddb3e,df834088),
+S(42000663,3223b99,e15a2a65,bd95b229,820abee9,5ba5be39,6f8879b7,3f421e7b,9f3f3d66,40de91bf,c6872619,87487226,57e60a4,3ac633cc,48f684c0,cf42696b),
+S(f02335b9,9cb524b7,45fa9167,41da4259,f70279d8,efe851ab,f5b0b8a5,32a087ff,e1bc6767,ba068b22,cb7389e1,36805da5,c30ca62a,e59b92f5,48e4dd1d,5327cfbc),
+S(5bbda2dc,cf8154e8,28ed49b1,2fdabc3e,eb8c3f9,d0da5878,77611ff4,49d72e7c,312377c3,6277addb,d5b044e,fe136626,d5f7e7e7,a73cfc4b,9751e8ec,e4f77084),
+S(5cd5cb83,ba2f225d,1ef4faf6,22e226e1,eaa85a5e,99721d3,82aae23a,f9dff565,254f58ba,9c49244a,4178a067,b0e4bf6f,dd7f3e15,65e21637,bc41f9f3,55045908),
+S(3b20ebc6,b453aa16,e5b61381,1d81ca1,f87dce6d,b54ba85b,d8578ee3,23bff228,8c9d3054,56627a,7313505b,4aa5140d,9fc40d83,bcc298a6,43842f04,70a335f4),
+S(cd531999,cf33db75,df4430c6,bbcf32d0,642be18,5736d79b,f2947989,e52c8da8,c7e99c34,2a5c1112,400edc69,f58246e3,d3cebbef,2c43ff47,7520b027,e2aa7d78),
+S(40b3856b,273bd2a5,145b70f,d16a2972,e488b33a,f3719143,db7bc567,26ff23c4,d8bf895f,71d96e6e,20d523dd,1256bd56,44e11442,c4757d74,f116ae44,69dc9b21),
+S(1a0cf029,2d7cce75,32b74bae,acec6864,9e682788,3cef4bbd,c8b24fdb,53e885a5,32c87d92,6f969f69,7989837d,d8ec8ef1,c284d9db,2a86ecd3,5bbb6772,dea06692),
+S(7fd5d251,93dd6c17,8d0be92c,342f94a3,c92c061,27998f4d,54f7dfb6,1326fefa,ea7d0755,e0a804bb,8b7ac8f2,dbe1dd7f,9ccd36ca,2fa94365,631ae455,5d080075),
+S(51820145,6c07fa3e,70d7b24a,7754b11,e42828e9,c1b96b0f,fd79bead,2f44050e,126f5526,1a55b724,7d08c868,366d697f,a6898c66,d14094f3,44b0a6b3,613d043c),
+S(86f2c87d,46038770,3be5ddc6,c2ba1ccc,7dfdd56c,a9986663,882f85da,345886da,ed34fc59,4b66f7e,f06f54de,84f3c7f6,ea1d877b,bbfc4185,3df800f2,fa805027),
+S(7f7d8a69,5b86ca13,d6a0ba07,99e60cbe,f5c4e1f4,c74a62bb,93d94d4f,8c1f296e,44a14061,b2c741c4,6a52639e,9bf08776,5db5d496,92bb6d1b,e97f9ced,a89953e7),
+S(ec61e956,83714c55,1b72ed5f,c5b09663,6dbdea9a,64d13ef8,c9cf0c55,89da5ae4,39a6e38f,9f7927cf,ffcd0847,df91e856,4188bf58,276bb4df,3721335a,5357c77a),
+S(e5906c85,4a75bee9,322d70be,a5d31c76,31a59389,2f479bf,8dc11bef,9ad5101c,125b3a58,8c6c1c5f,288402f4,3ce74ec5,fe9c2dd3,3f3605df,9ab41210,32641524),
+S(6c9faca8,b1b435b9,213fde17,ce967f05,46e6f27a,cf0e131,8496bcfd,d856b092,a04ac67d,4bb07624,6b59df97,2fbe2c1f,bb04be99,e269d33f,ccc81f76,3f567577),
+S(61031a0c,730cf279,d929b4f,5608f16e,6b1b1440,c04e5a9,fa300ff8,27303def,acc4d732,afb4730e,39a10c0f,5ae2cee9,5099be03,bf5612ac,391900fd,b51238c2),
+S(e58fa07f,ebc3aa4c,61ff4fe3,bfc8d04d,48a1e3c9,935317e1,83d537f9,7f35826b,d2402844,7e63c3e0,be630190,8139a75e,2e1a2b22,b05ce52b,e453ccf7,7c35f1fa),
+S(4d4d2982,b45a339,1720af,cf6b92df,2c201d38,5b9b6c3a,8fc53b4f,fd3bfdd1,d72650fb,d130482d,116524fa,e2b3dd71,c68b4bbd,54fc55a8,f9824578,cff67503),
+S(9adeb6f9,6ffcbb56,f171919c,a8a64c70,9b8ae835,828bd573,b7a1bbc1,3efb0360,6d920a2e,d2e3f41b,4820d838,ca342b66,9af35a7f,7b6d09fd,b1ba4298,9abe027c),
+S(64ba9514,d8680f6c,dd66895d,9c5ad45f,6e29,33506f8e,d7be9770,822aa9b8,7ed8c0dd,59bce424,481f88d7,3e641b61,a010e490,97cf84ca,16c2e045,49e9c6ca),
+S(9e4ac64d,9ca58a04,46ca18bf,c1700f2c,16937ef9,c82e8b55,9ccbd751,2a0c0222,315ba2e2,601b18b2,cf7f1720,9c4cff2f,e39dfcf0,c2546fb1,e930898b,5b023274),
+S(f13a99e5,8dc72fcb,c62a492,d2850704,621ddf48,f1f433e6,9a9814c4,17d4b84a,cc3d3732,f0f4166a,55946e32,e1c01f91,491c82b8,ef0d269d,7a66f039,ac02dfae),
+S(fd6451fb,84cfb18d,3ef0acf8,56c4ef4d,553c562,f7ae4d2a,303f2ea3,3e8f62bb,18ba314d,4e78ea87,490185a3,e43cbb33,5d54b6d,2dff17c0,2f526f78,ecd3f31e)},
+{S(f1a749e,6cab100e,2aeef8ee,6a654551,c0ff906e,e7d11d77,f390955e,9d29d783,a60f7295,3c8c3bf7,f1dc1358,e39baf76,3dba22a0,1ce7917e,aeabd996,e21e845b),
+S(e8c45020,4c9d9ad,f7878aa4,184a1576,d4c65d5a,c1c4d494,ff427e86,8b42ec1e,aabff02d,8a715c2c,34414b27,808882c3,f656389c,71c26d6b,d7ac8013,83f4c57c),
+S(c1febd79,1784fea9,bf378237,a05522de,1081df6c,27d22ea2,aad805dc,7c2f1c4c,c38782e9,fcc1004e,aa677f79,536aa069,7dd9002d,ac16936a,1f0b8736,8734174e),
+S(91925564,4d9bdf2d,4522825b,5758b3f0,4d32da73,3a4e772,bfe3eb2c,9909f4ef,2568e18c,1a0448ab,d038ae62,a652d152,4bdec1c1,a0293695,9772bb65,d78450af),
+S(25bb4202,9880c39,f5bde432,c1fa357c,7f4867f,6fee48b9,24ecc824,5e1a5253,5d43db2,64c23715,b4b0eeae,63127cf6,9b4bc79e,f96ea8cc,d17cb53c,c3ac0fc5),
+S(2597e080,e772d36f,df500782,5f92f797,c61c72c7,8d801dd1,3deb1bfb,9e91b12a,fd5918b8,938ded17,a458d0ae,559c552f,bd45feb2,5b4f59a8,f5b735cb,bdab92c1),
+S(70231b28,f578dc12,9f8ac54d,fd4e3577,73d0fcbf,65be0dcd,51132882,5a36e7e1,d12aaf89,4dff3e42,405a4140,58524e30,b7c6c4a1,83763268,6852acff,83d2b7cb),
+S(f8ddfd5e,5f3b46a1,ab363169,12b74c97,b0bd654d,87824040,bf6d2cad,b4fcbf95,931fc58f,5b429636,5e080d5a,8fb35ba0,f92104d3,891d6584,8d24c0f7,fc95bda3),
+S(a033f432,670a382c,57e2408d,3bdcd2a6,6758e63d,77574598,6b123e4,d927bf10,83b52f69,d79e7445,b6e33545,c23f16fd,52691151,96ee60d6,2ecf6de5,b2961a0c),
+S(8e77f9ed,9a643f3c,bf197b09,80f92860,f37d8b83,93633230,6c902c38,3bb7f96d,71b4da9f,f736f9f1,f8c3c099,c34c1bc4,30bb5d26,3c861e2c,726fe891,cdf7d1ce),
+S(f34153e2,29934c71,5d895102,778425f5,e92f4ee5,b96d1333,df207e62,6761b328,954584f1,64c8f35f,2c4e0188,76186ceb,3e91523a,5e8ac03,d5998253,49b7b8ac),
+S(e133aa94,c0252f05,379b5bd7,75ba3f1f,92de2876,68613613,28946904,11b3ed52,40363801,613423b7,cc6c0cc5,af3641f4,dc2a7ac4,48b178ae,d1393605,103bd6dc),
+S(28119c6f,a57d02ac,856edb00,f594c7be,22772b0d,700ad14,713affe5,7e385b5c,969b6cb2,8ef483a0,db4a96bb,92e2d332,6e6d86a1,73bc3d5,831bcbf2,5efc437d),
+S(8c728d65,8b78d96,44003708,dadb48b,65dcf6f,6d9412c0,e31cce3d,b5384d00,bb3cf660,9908467d,285f1c7f,40f4f18,ca618093,92633beb,b4ce30c4,72680662),
+S(477321b6,1fd5b4ef,3acd1e8d,8432ef5d,e70576ee,6b8490e6,839f1985,dec96490,88008466,2244e3f9,7d2ded5d,2193c70e,2d72c67b,9b7cd70e,9f14cb05,70306bee),
+S(ebedd345,ccdd0e04,4bd3d4d7,e1f1cb6b,ec06ad10,5ec2cec8,821580f5,d08a63d4,4278bfb0,88e4ff81,a3fe15bb,e01be36,40450f85,885da0ae,e15c6b9f,e78ad14a),
+S(f4795df9,41b315e2,24a98dac,d9149ff2,8b9a7bf,e758a1f3,5cb6336e,8e1f9814,6982bc20,285c27d8,12c5c648,d0635c7,fdab85e6,fc6905d8,65da387e,596da791),
+S(65a5964e,ea76e30c,74c472bd,3ddd5169,11dcfb3e,1f2d7ff2,9661e254,4a38ea30,a7c394af,80ebbd32,e442271f,b061bb42,a7b1758f,44d7d952,89152fa2,a88fe3f9),
+S(f3d10725,da6b6c76,6da6fb5b,969ba7c6,3e33b4f2,d062a446,4ffb20bc,dea2d376,4d65ff69,64518942,bc3142a6,2148137,7bb609dd,6545bc26,9678ea19,62812ddb),
+S(f5fe0f35,cde00589,301584a2,f4f5b1e9,3977082e,9c9bd50d,7c2c672b,ef05cc9f,1b49ac82,486e6344,dea32ca3,c96cd5c1,446ac2fb,2a658a42,50425f32,e8d72e94),
+S(fce17cd4,d9519a53,f0a100f,ca54d1f9,fa87eded,98a12654,769c95be,151e33c3,40d342ef,83a4d715,bd13df0,f21197c6,e189681b,efa0d925,248733f,5ee07b8),
+S(fd5d90d4,a97c1d1c,4fe18a10,6808f46,f6ea4422,c4408860,c2256b66,618af8e0,7ffc76c3,539bdec8,f59a9a7b,b36fd534,99306cf3,2dd1fe43,a2db5b59,af2f7e3b),
+S(1c71f824,1b147abd,9e3c1ca3,fad5146b,e531dae7,c9c0d586,4f2d8bd8,7a6457aa,23e7e758,2cfc92dd,e498c0af,b942182a,92e02bb0,7e95bc1b,763d8030,9ddc9137),
+S(dfb018bd,9bc352,f36889b8,2a46512,8850a158,872554cb,3a3dad28,a0496f20,2daa780b,d615d778,3de8f5e8,25cbd934,5c021df1,9ef80a6d,39ff87db,67a1e5ca),
+S(bbd320ee,dacc1282,d3fd2109,c26f6bcd,46205ec1,d96b806,dca35dc1,4baa823d,ae7beed,3b5f72bc,ba66c794,89c05666,efa85966,14bacc45,9a99d882,8edbdbfe),
+S(c9cd8f21,a068f78b,ce5129c0,9084be52,e48d688b,f474e690,b7720360,e362dfce,a10b9fe2,78c7814e,37851b5a,36aa4246,54c6279e,89df8fc2,ed189ad8,11518f22),
+S(ddcf39db,aba52181,72c36a53,50883245,39ccddd8,46ec4258,e72dcd71,40041491,85cadc4a,a569265d,412c8fa9,4872bce1,51a750f7,b43385e2,2db405e3,54428a5b),
+S(391562c3,f19436b1,a6e41d06,7435fbe8,27de66b5,555540c5,3ca7a0cc,c7876457,c3a5d917,5b56f67c,66ff269f,72c0a1ac,74503106,9059aaad,f3e66dad,45a80ee0),
+S(63d4b224,7b2d441d,680a0437,604533cf,1dc48c9,bdcb9e10,e0249960,f966b2d4,e25cb896,ba165d4,46f73344,61e6856d,4c186736,402dc6a0,d866f97e,bd5cdfff),
+S(5fe057df,5d2508c7,611dc21d,412739fe,3e7cf9e9,670812df,cbb00255,4d44cb22,33b88e83,9f22a7bd,17c149bb,65bd4a49,29b2a29e,b975776c,e82189de,80c7d45c),
+S(5ac83bf,498f7eb0,79507ac,d5fbc587,f758afa9,b6a1ee51,4c857f8d,608a7b1f,1c866393,8a91904,f0530bdd,ba15390a,4c10fc4c,ef8a2f07,d799c89f,69a33097),
+S(b0f9e4b9,b29790b6,33bcc04f,d860cb0f,823d8d1a,4cc1a1c1,413c1606,cc9a8e2c,b617d40e,7bc52192,be344f46,f9021c0f,ccaf33fd,3e8e3118,93df993a,20c2ee7b)},
+{S(eccf169c,9514a854,8f7e1131,a7438469,4df7dc2,fab96462,20e5799d,6d3f672d,452e53a2,aaf17617,37055bb7,24b64f4a,8fef29ed,f8571ff9,a3a6d2c4,6acdb91e),
+S(a77bcddd,a0fecd39,a99c6387,57bda1bf,30257248,6a3fa08a,e2d6ff17,e6e4b6ea,debf4c03,b4bb5c7a,8a386a7b,1e459426,6c78eec6,55f01cd9,f137ff18,c5fbdb1d),
+S(a77b91ec,6db6a66e,a48de424,65079a2e,ce220fba,da221601,840546ec,2295c2a2,3c721fea,81f5fe05,163562a9,849bdb15,90bc818e,86674ea2,57fe8d0f,4050086c),
+S(99a28a1a,3bf2af79,ef2bf134,d31880a,71c2aad3,824fb7df,23fc4fb7,d54b2910,620e2918,df14e3c5,dbfceada,1905941d,32d77592,89ec607a,f9851a6c,5592803d),
+S(7eb52616,71402db8,905c7097,2af96b72,2bd77d,f124bbcc,5418f217,f6d8c7be,ce1e663c,8276bf42,99919592,11feb13b,66aefa37,5d6dca15,8b7b66a3,ffc6d7ec),
+S(c88b1815,f183e6ea,3ce8469f,ada5b88b,805288d6,828473ba,368d52f,2145e7a4,55e78f2d,3784952e,cb47f6b0,113eb471,8cc58225,85f9d1e,2198dc60,af3f90c9),
+S(dd893c5e,a2e4e70a,fcc161ac,47232d3b,77f16c95,54c98770,9a7a6f64,c0cf7ab1,a1a58b41,c7d4d0c5,6d6c908b,32d97467,b8b6ed20,73e6a677,54935665,6a92a480),
+S(591b8422,eddbfaf9,d2c27c28,dd84dd30,712a15a0,deb752dd,dee682cc,34722ea7,877b0c99,6a248082,fd442509,b0ce4cc1,b181d4f8,8ff755dd,5f0dba66,ebf95d1f),
+S(75f9e3a1,ffdd902,be5d1d2b,3ed18b37,62e42e95,8b024ce8,f892ee13,ab35c674,57fabc84,7c68cfdf,272effee,e7a6ee2c,5fecdeb4,8e4877c,ccf2a8de,2e2264cc),
+S(c8a53d5,e1895cdf,db61c1a2,395a866b,ad803773,23ea43ca,775408f7,a4141cc6,ddeff9c9,97a11e4d,d0afab30,f63229f8,1b52ac,c25749ae,2749ddb4,2b201196),
+S(8827d23,668f3006,b966cb19,698a066d,aea556b7,4108739d,d6414d8,e8dd78c9,3d009ac7,2baabb53,2e3658e1,8941d4b1,efe512b8,fd7696d5,14b12216,215f10e0),
+S(dde6b713,5cf165c6,53c7f5db,542501bc,b0a41e3c,c6779aa6,194ac1d1,8a830b01,25c04b4a,937e16b6,e72616e2,d64a413b,6a7c29ac,71dfcbf6,826261dc,2507c16),
+S(8cf6210c,5426b3a5,ed594699,da6cb8b9,8069a3d7,b926cae9,fedb2e96,25d20010,78017fc1,7915e3c8,62557896,acd002fc,7263bd7f,aed38fca,d63ccaa3,57391f30),
+S(35772904,91661db6,340e7d1c,a98db8bc,2f50f557,283ccf11,8e446f71,925ade9b,fd8a4a56,b82dff95,a59e29ea,bd5d8e8b,a876bf95,4abf0537,60832d1b,d7edc31c),
+S(60e4201c,4dbd9c99,c5eda030,f041f51d,f648f77b,13ec2072,4d89b6be,f249d793,ebd96057,d60b7cae,71349c51,1a3ca99e,847419ff,cdcaa0c8,54d75d40,8263d81b),
+S(f39d686,b17ad518,3a7d300f,1bfd015c,57541f08,a96b5943,43d2ef82,bf20bb6e,f1298c9c,633a958a,a0d12b87,8c95836d,f9f93b5f,5e3a6bbd,93a75ba1,1b96d4d0),
+S(37ea7dc7,2a3a0b4e,72412814,bc1e1233,17ea3e1c,c4ede35f,cab5d31c,93cc330b,aebaca93,8b14b315,708360e,5662e6a1,af25069b,cc07f581,225dd131,c656c607),
+S(ff1f61ed,ba3cfc6f,2fdf3043,37205bab,301c965b,501e4f2f,fcacde00,dd127b25,fb1edca5,90e00f87,eeb56ef9,94e9bb12,b64ad1ea,f5ef0afe,6f0125b4,e100a483),
+S(3376e0a5,b93f15b6,c46b92ea,e313ea2d,c5d0b961,a2623487,8919cf5e,25e9ae38,a4cfc1be,fd24647a,20ae014b,2041ab3f,6cb7585d,48a607f8,299e0c10,96bcfdf1),
+S(be575f99,842187b,30bcb312,987ea218,3d613442,8878804,b5e7d920,12e58d9c,154e02b0,b573c81b,d2079a4f,4a6efe5f,5f37502b,33225064,4eb38b2c,3f0a1767),
+S(5a215836,f1f2997d,9b09d4d0,6473c55c,46cd3006,70d85d6f,6b5531aa,c8da043f,ef5fba1e,b6e1deaf,bd83e480,fcd4984d,cf60f91f,4799e8b4,3f4edd15,f94b6d33),
+S(d73fee2,16a503e3,a7d6b0a2,675adb1d,197c3fae,4d43835c,b6b043f5,d44909f5,6f2cc9ee,fbc36b4d,a5b3e704,c13daee9,cb81ce9d,470f1290,8b32f047,ae231053),
+S(26fda2e4,d07ec613,ded58e14,ee84e421,ea58e5b9,5beed698,d847f6a6,db185f6,683c0002,bcd6d8b7,1d06e592,db4b961d,f2518fbb,47cb4ad9,96020d84,ed8a5909),
+S(cd3d4e87,e433f2b5,5dc55c6,a3f280fc,57f899e1,f8f0777f,32705f3,eb24551c,2315d85b,7521e4e3,8e69f29b,a49a3203,abc7f280,ad49365a,4c78f21c,3ee12542),
+S(652476ac,2c9b871c,e108fa13,6a739766,879a76ec,60d787ac,a1b7447a,67f8afd8,b66bf6db,cd3a1393,f70ac7b6,d53069d2,5f084dd7,f05c97a8,76f7f646,c7b67fa8),
+S(61ab4f97,61c96446,ea7a75de,7ed36224,7b5ce8b9,e7b442c3,432f9fa0,ec74355e,f391652b,17a910f,6d476c29,89e854f7,d31a5f31,fead5fbd,5013ea56,e44985db),
+S(36e4bb36,e62f78a6,a6155351,36a73637,13fe8be8,1c8c3460,a94bb642,4f7c80de,12b38983,c10079f9,b0016df7,fba0685d,5eb87518,234c65c0,7dff006,dbb6a563),
+S(f5e4cb89,101e90d4,b2f50097,aa0b22fa,df076932,f4045e9b,7a9ce8d6,ba178780,c12ec4ae,56db7971,3a1bb0f,2559e3a1,de3f8200,650c809,74101940,181eb52b),
+S(1138ad12,333790f9,20e979f6,a6471274,2a9bb567,2356e3c,80ffff89,a9de533,4caada48,a78ae26b,790f23c1,606a5820,98642f4,bab5bfff,95748f6a,2ccd6bc),
+S(e0346d21,121ff741,fe4eaa23,938a4347,a71df442,9e55359e,aa20d691,c9f40840,c1197c8e,c36676a9,28a92b56,811845d5,d9632c65,9142cc12,3c65e54f,c282dbd),
+S(d42011d6,1061388,fec6b7f,3f332b20,24ab318f,2a9ba7ed,23731207,3e32478e,451a2b16,5c82b1f3,e4d2a0a0,bb407b84,904db4d0,caaf733c,e31fa97d,2fb1735b),
+S(63964eee,619074e0,780140fe,2e90836,e72328d2,448386d4,59c5be23,187f5048,c49304c5,947630be,5c60064e,3cb40436,c2a7f46c,b221937b,c7c5d7b1,76cf5e37)},
+{S(8f741868,43906722,ab9f5c6e,c796573b,622fa2ae,6d985bfe,ea4d51a1,8f141792,61ecd858,d6992c4a,bdc22472,fb8fd242,929dc5b5,36ea8e35,d1c8c513,bcb9e31e),
+S(f2dd67e5,6f75c397,76b29366,149ba4ff,69385651,53afb385,3853acb7,9fc2bd59,3a24641c,d48ca39f,fe992bf1,50291604,79066af4,a0cf364c,9e52a9f,9b51eb66),
+S(9386aa5e,c3452728,a8f65141,e2f43a14,c250173,9349c96d,e1968a4e,48cd30,a3a38a85,4f68048,d8f81002,3eef9966,780262cb,aacbe859,a8fc66fc,27c37f32),
+S(6c9901ea,920c0f4c,ce51fde7,ab283f98,eebc30dd,c76a3219,1df4c4c9,db467aac,6773f8ae,e601201a,84dd4485,fa560e22,81d5eabb,25a3b3d8,525f4a56,65f79d05),
+S(ed1eafec,876154e0,58597caa,8250b0ef,7262ff70,b719ec9b,63c0b2ff,9d167fe3,73505073,2b563f93,89078cc3,93ff9837,227ab8a6,c7d789c,6d2bc835,2018f77b),
+S(515806b5,13d4d4bf,83533b56,3b39bf9c,4e808426,f2e4cf16,562e759,cf2d56ab,83c2fb,673a08a6,b8a86b1f,e1ba23d9,3347903a,d6855059,130d8d39,737ddead),
+S(30a726d4,d8db1cfa,d59331a0,8f4b5376,36848547,914dcd75,37a80e40,109b8e35,8f628b92,6a11ddc0,dfb1cebb,934aeaa4,3840d442,a61145d1,803f771f,7bf65d7d),
+S(116867a8,d72fb00e,80a6f267,e8163770,34affeff,36d667cd,38219f0a,e3c9038d,270f15be,b2a3d50a,4088720a,e9a2c3dd,df00817e,31e1a5b1,d850fe23,dfe51657),
+S(abea2899,e4575c6a,201c96fb,a60a24ee,1f1fe0c9,b718b54d,18981938,4f33a1f4,d43d54e3,9e8d433a,ce66ad94,e52662fa,8013e778,f8bc2e3f,31938a6d,5681c660),
+S(1fa796d,9f658aa8,6ccd0fb4,6a735651,102e3181,302e371b,8c965dd4,5f078b30,69815d18,43c3b4d9,f7fa4af7,3d2e5dda,390e5372,28608912,79826a53,a437031b),
+S(f5022faa,c8caa29f,304ab6c3,d00931c5,e09085e2,73beab04,c1d18f87,1c0fde73,c6abd143,73213fe8,ffa5ec64,8a22dddd,fdf2cb25,e32afd58,4f92dca7,838e8249),
+S(8190b10b,97bc72b9,301b1dc,cc60e69e,460e389e,ce7d5d11,4e2284de,853ea02f,f1ffb850,dbff0f06,561b75f6,5d2ae823,cb13881f,d1150eff,274db4cf,112d2253),
+S(ea230fbe,c58d7e2f,1a3cea60,f9018562,d2fefb49,8efa312f,4beafcd3,139da094,6045d69d,b27bee6f,3357180c,e92d3866,b480faf4,2debc033,cfa118fb,b89c3bd2),
+S(333d063,ccef6aa1,f78c81b3,4a84975c,82bc2cc2,bb897608,f0bed49d,cd08829,90ad105e,f72b7e4f,a927240d,9c69729b,a0aae3a2,3a45342,3be2c385,488840a1),
+S(4d95cb48,58d808a3,be82f42c,da4f64a8,c64ae176,3b50257f,2e4ae655,fcc4802,5f6efffc,99bdde54,6d8ffde5,e9a551d0,121a39c3,86db540d,1caf74b4,894c5559),
+S(b87b5eca,6e0111bc,5b756816,fa82acf9,77f81376,af796cdd,1e8fcb09,4d363d1,442fa845,9c2a7799,2c09015a,db80f26a,28428851,62432660,56026009,5f2f9d8),
+S(34baf43a,a82cce1b,19945590,ef3cb582,2ab03142,6538ea5f,74571582,ee14cf00,9a76705b,c0141e29,75d11543,215377b5,3c051c31,156697cb,e8f56721,da386e2b),
+S(f07c5d98,a2579c17,53b3fb58,22a139a1,53e7deeb,ae9304b,114bb188,d61cdd0a,ec18ce0c,1e51b8bc,e12f3d85,23739f8,bc25708f,32deb81d,a780cc4a,1010692d),
+S(9a146c80,5ee261ad,3e708885,aa41041a,53bd3758,b3d1ab7a,1a44aa7e,29acca7,fc553e71,4ad8a192,90f94ed7,7c171f9d,9ad9a047,6791f045,4a3ab7d3,f8834f02),
+S(c8088409,650feb74,9f9fe21,61772279,128db1d7,58610a9a,8b9fc4b,ef9683b7,692a6be3,132a08d3,82295ee7,1c469465,ae7d63d6,c20c7357,36935003,28799639),
+S(53bdc8b2,3edd83b6,b149b79,c88130c6,b207f999,e7045285,7e828f81,b325b9d8,a9a039d1,79486167,8fda727b,1706e9ec,7ec3eba3,26e6a4a7,e27db3f0,8a6ee238),
+S(fd08fb47,4af98207,3d8b4ef6,d39012f4,78225f1a,bde3c841,6fe3881b,4fd276c6,d38b53a9,100da1fd,1d2a987e,6907370e,7bca492e,98a22e5d,74a10c9b,93a197e1),
+S(5c42ad93,2306363e,a0edf86d,31d14b04,c3f7bc09,c9fe1326,d1ad085d,c84fb7ca,1bdbf812,e9ad6486,ff572d4e,de5be4c9,59de7be3,f21e0dd8,76534091,f13ca3d3),
+S(66257876,115e7eef,fc0e6132,9f177d3a,437c81c4,1150f86b,45904f86,30bae971,df830e1e,33aeded,721a0a6a,62a3a402,1d2b7ab7,438b7b3c,d834d67,3a857aed),
+S(4feea8d8,2cc6601,c847deff,35581c1d,bf1f4070,402bb948,ce9a41ee,16661627,c09a7686,ad6bcec4,ea9ab0f7,8316adc0,7c7a2899,9332cee7,5d70c50d,249a0007),
+S(2d3bb180,73f5345e,cff0c901,9a6f2fb4,e0a237a3,9315fc11,fd53c7d5,aec43670,58a9459c,2710ac75,ff2510ce,4c9c5fb8,b4f739c9,c6611494,daf896db,e43b080),
+S(bd539f5f,47b25116,7159153,f402e0af,8650c17a,de7c5dde,2d9d9cc2,d0a3103d,407cab4f,ca581f10,eb386e20,9158541b,8649951e,b2f5e454,2a7032b6,53f0caa),
+S(c7a72935,87ba5114,744c3d0,9030be19,9ccea57c,7f80be87,bfb5b79a,8f8e200,7c2a98f8,b4526422,b211bea0,875a81f1,d379012,486db005,e31b9682,404e14a3),
+S(cdf20316,f4b63ca4,c472e1cd,b3a938be,291d98b9,3ad8f3f2,4f3e1a4d,f1a6cc80,ab993e8a,68988d4d,2749760f,241399c8,136ee9d2,3d4ae7d1,e6d26df4,6056587b),
+S(1d341e6,2eca1f48,165bb2f3,86207da1,f2c7fc86,dff7a75,cb63976e,f21bb074,923b53ed,fe2f5bb5,56aa7cae,2a08ff86,160e3344,c4adc09a,e7aeadfd,f31e2b9c),
+S(8704f69d,9d335975,f0e3bb83,5aa3024a,60103d89,e5578253,fbb3d537,1983ce4e,94f4adfa,31dbd13d,95c738b2,8a569453,cba45efd,1cfd20b6,78f6a724,e9a8d025),
+S(7175407f,1b58f010,d4cda4c6,2511e59d,b7edcf28,f5476d99,5cf39944,b26b64f1,bc4baabc,bb1c2aaf,c92cbfe,ecb33791,4fe01748,8bb8e2d5,bd918104,4dbdc75a)},
+{S(a16a4734,9afd167f,d5e79d24,9784d87,5121fa24,2c3a54a,88f9b176,72669aa1,4df3fb81,7021efdc,e5296735,3a177b5c,51cc7762,4755ba28,1084db5c,4809e02c),
+S(91d1abe3,8d3f9671,54337e03,d27fa6f8,c3007f32,323d15c8,31306b3a,30900328,b1b8c71d,b388009b,98000f9f,291b66e3,f890d42c,a5812f34,5c070f6,e73b89f6),
+S(61b64b1c,f2a0e720,e9bb4853,537b9f38,66baff87,388df7f9,f14c06c7,12080b96,44444011,b6ddadc5,7ee00eed,b6af3772,e4116711,c3853f13,7f9c7b00,2bf2a1dc),
+S(3b96b2ee,d9cf1ed6,3aaed8e9,aca3a464,d6a6fbf5,e6fd48f0,5aacc318,dfdbc87,51c41c26,506cac9e,bd0c5dbc,8ce8788a,3469e42d,de794707,9e0cd0d9,826e9c58),
+S(7bbd147f,77b293ac,ff797b9,a52778de,5874b754,c08df397,72ed8ef7,53242efc,3e843df6,75abef2b,e4d32c83,205322cb,f53bde0,2563eb8e,b5dfbe6f,27d4cada),
+S(becb7fc5,de84f994,9f97e55d,bdb6981e,f38c0c45,1e0e454,519c9411,5bae3d7,754145ec,ee6f9c7c,f91963fb,5b0a683a,ef24313f,1125570c,c9b9c7d2,afab99a8),
+S(87936626,aa88346d,6d4330d9,3a188ed6,992bdbb8,387b395e,d21dab93,63d833eb,a28c868a,18dbe0e7,12ca5237,53f6a50b,9313e687,85f3b31f,ec778fac,87aa9327),
+S(e79d4b2d,e33de1e2,e7eeeb44,d197aec1,f5883ad6,1394dd79,de274ef9,76e3b022,9c73ade7,7c661527,ec2ec6cd,b370c130,380bdd9a,4bcb668a,86e8259a,ca85f293),
+S(863f0d65,34de1222,237a07bd,ebb066b5,2c1cdd83,d7a6d3df,278e57c8,bb59b8c7,c546940b,99d04ae2,5cf7c881,28a985cc,9b6223a6,ffc06fe9,8a3e0f68,439b9db6),
+S(71e9b0d1,3972d9e0,2225bbda,5a1024e9,c373eeb,f6514eb1,c113ef88,dffdc3a,4436c52e,c58a34c,562638c7,8d76e3fa,29e3586d,fa667577,2fe0b932,c4a1ade2),
+S(ef4a500d,c9369125,78fcfcbe,3c313bbf,f0323caa,75750b6b,a317e1e3,dd8054e3,e807e9cf,7911c919,fef82e40,a3ae1b9b,ed8ded38,e74126ed,863199de,c031f2a1),
+S(806dd4e0,fbf72904,c7b0080b,4e7526bc,c71fc52d,f143da80,e571041,dd964915,2f4e2e67,3348c32d,6bcc0741,2e76f4fe,944f96bb,d73382c8,c6880cf6,629eac8a),
+S(9ea889e8,acf0441d,6e299687,c532ea8f,8b9453ed,5fea0d47,f735056b,1eb3bfa1,e43f79a8,4d302f3c,88698896,5fa7b8f1,a92c620,dfcb3462,c4befe3f,4afbff5e),
+S(9a990a22,1d27d8f3,40e79489,58cff3ca,2720dd3d,ac71688d,9c3c9e2f,afeee215,4957ac76,db370918,7992b0b,63370656,7e0f4a0a,9e5f1d9a,be8f7d5e,8a950eef),
+S(d3291003,98ad3d92,1d6cbc6e,b37ac3f3,9360cea6,23edd794,64d34a51,fa7adc60,657c110,5bd8df6b,fe52addb,2fdfc41b,810a1ff7,8662021c,7c220b0d,b3509d14),
+S(65eac576,e149d97,3cbd772c,60570870,e437e92c,2e5138ac,9c0534df,b7a45582,ebecb6a,edb87cc1,417e066e,fef8e52e,c61eb00c,dfd98205,91d63c08,9dfd5347),
+S(b6976b99,c2515be2,2bc901fd,8671255b,f8fd76ca,1f3474cd,5eebe39e,98f6f14f,84ab17d,da67b61c,fd01881e,b1087e69,845aecc9,ce1535fe,1c7245fa,8df98181),
+S(c7f5967f,f9910e10,54c93e1e,d0290102,9bf31787,15f53758,f5c53cd3,c79a52bf,bfb01210,5c1ec69c,847ceffc,d1105ac0,528129fe,3b4d3086,2b6e9562,836f5eb2),
+S(ffa0da7a,e8984e4,d02a0fe3,acfb4e81,2a63d6b1,682dcd78,fd2635bf,88cfdf1d,49459ee5,3fad1097,2da786fe,45a2d201,e4a52260,7779b1d4,23defafe,29e70098),
+S(5a53d683,3bc1740f,d02f278b,2ac15a87,f137f2,c798f157,725a4aac,63f1798d,ac5e7ec5,86d5960f,e25f9e25,7cf9ee05,110d9595,e440d032,c416d444,6242d10),
+S(70f67487,9b030a4d,9ccc0bf2,90d5b78,c455f8bd,a1fa2b52,efaf0200,6b70a6cb,10f5b1c5,dc46c0c0,68757804,93805aa7,5a259dbd,95b4bd14,d031daef,a81bf7bb),
+S(a4baf0d7,d3a53c29,e78ff81a,52d634a,e009391b,30a9aa91,df8f7bb6,13e3c16,c9f9d001,7f388f09,b6802c45,e1fa036e,99443467,c3847937,8b384a9,dada35cc),
+S(351b8e4a,dd336c28,5d140c57,9f2b089d,3c656a05,b1ed6,4cdbaf7e,e5bc671b,b996e61c,cb14553c,b7b79803,c82332b6,704ce97,fb4e19a5,1f70b13d,f8e2732f),
+S(d248350,92898c0,5dbb4465,18695efa,e59ac007,d58b5df5,bb3b7038,82f18e61,23455e7f,5104051a,44600be5,2e242a90,95213d25,b4fd65a7,62c3f9fc,9234c2a5),
+S(d3fc6d75,10cb0b20,77b52b00,93e84d47,54dd1a28,4f3928f2,a9e3cc02,f1869588,26e86b02,c16171d4,4238aecf,666146f4,9386e0eb,52dfed87,7ac0b409,51ced10b),
+S(1c611335,3d115906,182b0e4a,7eb3d39f,552c49f0,c5928aa1,15ae00dd,c23a3b70,1c3e3c4e,ed65ce47,ea82a33f,df8fa6b5,532977d9,53aed38a,f0f4dab3,98477c6b),
+S(6487c5c6,abb6e673,821c4b0,2c485f83,3e149af1,83b3f025,71a81fbe,660e98e3,63c4f6b4,7eb37ed6,7668b41,1e83d9c8,9ea323f3,2d9e8918,20b65276,a8a7b7d6),
+S(1b0baf63,6daaf2c4,28a62bce,bdd41de2,a4d7cf69,93f0b931,222a40cb,9f5f9a2f,af9a62cd,f91e2c6b,47f308af,e2de8f16,def4972f,24bf4c5b,2b1f92ac,f63a21d2),
+S(95bbd974,78e1b8a4,1622e460,8aa82fe9,e77d43e7,492a0d21,1146d987,f9b8f255,412bc52e,d61c3880,210d3df7,f0d2f27,d458d51,388803e,fef1c016,d7c9e7f6),
+S(a3466715,5b6ea598,2d3945fb,743a1510,c671b96f,a3494a57,e0349010,55ae087,de35a05a,1a943a42,7210165e,55d5cfae,3ac15490,dc6b0f43,34c0c99b,dd778608),
+S(2ed76c11,52ac3600,7aa17c85,a5f902f1,7c845a05,a4e0aaa0,7b05e836,cbcad59,9c60b2bf,bc47a0dd,d3259151,37e89812,a08d39fe,cf5806be,eb538575,3b159531),
+S(20e6e2e7,96946bb6,30c7071e,f1b92ea3,d53d280e,e450111,5f5da36f,840dd273,2c528501,b0eaa61b,b5f45e52,6878b9aa,7ee13686,c25796c3,3f8302e9,44b9469c)},
+{S(f040a2fa,b839c753,4e216425,6c2e8dd8,57c52dac,e75cab3d,512a7b1d,562075d2,9e211cf4,bab24e0e,f745e2a0,9b59565b,be7b2449,8123f6b2,ba383b25,29554b36),
+S(c66813b,904831cc,12f89e3f,bde93eb3,11ade6dd,f6cfdf72,21cc61a2,ff46bf26,3b60c8c9,9da35a58,7b9650af,f85ca785,ece41146,e7ed8d6d,ef8d26d1,f3d055ce),
+S(cd38ece8,7c7a9cbb,e23b58ef,59925633,734de285,f93b3ac4,eb01e03a,adab904b,a5f48fcd,afe414f4,1a44917a,5dcb80b9,30373af9,70e9f22d,c1af80f,a8b06320),
+S(72d6f7db,199564a2,6e823a49,eb0171cb,ebb76a2a,add56c7c,6d3102a,9c3ee18c,bd2039ec,c390839f,e2d4451c,9437fef6,3e98dc62,3ab0eea4,c56376f2,e270f626),
+S(2ea6c313,1e101867,2454e15c,d34d5fad,13829d5,4ca86062,f074e512,a274167e,67e3d34a,56f12e1b,43687f51,c2d56395,14355d7d,9cc52726,22f62ab8,91c8d5de),
+S(d66bdd78,8b20da57,b2485804,a2f6e2ef,78c7ca87,ae1c5c66,fc533533,5b624162,1a8688a1,300e6d39,e130037d,3f074ccc,57addd1b,88977e64,2ab296ac,d6e054c9),
+S(6d6458d5,d1683d85,8f9e40,15e5a94a,73868bda,54f6139c,446b5283,6d211542,e44c7ca8,33761e13,ca5458ff,dc682f22,3819411c,a3c5feb6,24f06412,471b9f5a),
+S(49f8063,b3d98f6,f159f2e6,65b0e07,8ef8c7df,44da06c3,55b592ac,13402b9d,b0b2d838,4b24ab11,de895013,e897e825,45c3e8dd,6cdb0990,555cd871,5841f8cd),
+S(8b2fb6bd,e60449da,2684f8e3,6267fff7,254051ac,faea37cb,102c9bfa,91abb2ca,c82cb9ab,c33c1817,10d3fb19,60f2850b,5072eb47,404266f7,c7964fb,f98027d3),
+S(cf90331d,73644476,47c8f86e,eaa6e67b,f3fb4b3c,4c895b82,30ab2f38,80df1e42,9c493d94,3471efd5,ea90f723,db576a35,8cd1ee6,1a119b56,6c65b16,112eb2b4),
+S(e70667cd,8d2759e,43f99417,ecc505a7,953d80dd,e7ce2cba,3c8c948b,d43a912a,92a534b3,51449a66,82395a3,b75877ae,851923a2,e791acc3,7293d728,777a2247),
+S(4cc07d11,4a715e9f,4b4d0811,f0337c7e,f4bdff74,2fb008d2,1ce8a9ea,50520d47,478b279,613d92d3,dd24ae31,2658eda8,28a7d628,f0346e04,5d5d9dff,7178f093),
+S(2a1cee60,4cdd3b2c,1f859bfa,af63d7e3,9aaad910,92c2a38f,a9362798,9753c30d,325c248e,d409e8f3,b96dccab,6fdb62a6,83b7eaf3,36d2864e,b821663d,ed31a6f5),
+S(7c18d0bb,9a01969d,302616cb,bad8722e,d00103fa,9985a50b,765f0e2b,9a2ea14c,f6365a6c,b06e4749,c48c212c,63fff571,8f46e0cf,6fdc8c42,34d4db64,ceb72080),
+S(a706754,65cde407,e853e882,8fb7a2fe,98638d7e,64b8df0f,b0a7a0b4,e629d0ee,fd694b2c,1354a5e9,415926d0,1590eaac,dbd1b36b,5ecc46b5,72467c3f,e2cc5393),
+S(7ff57a63,36ec73da,cc1dc527,928cc6ff,4ec063b1,56b36292,23b8bbb0,a8ba2c7d,4d6dfc43,da0fe33a,1e75dbf5,5e5d669e,be6471d,eb8a4102,6db1a41e,9d5da637),
+S(d4b1f7bc,87558c27,7e0fdf91,22bfe488,b3182555,599dd384,5cc039b5,93218e9f,992f79dd,c8f46682,5c44a54d,626b352f,7f59139b,d545f78b,44bd0b10,55c3c1fa),
+S(897773f,a9de63a7,46ebf58e,248d0c21,10f90230,a792f0b6,ea5a25a0,9d1940d2,b7c7dd27,d561dde6,ca7588b,8e3a09c7,16297ba3,9d501744,f9639a25,b16b4f64),
+S(2f9cb312,b071a600,e5d24cfc,79b0fdbb,f6da1527,10ec395d,53078453,1a3b07e7,49260f95,757b9b66,feeb5c20,16aa051,b444bfc8,836fd8a2,ab913e98,731fa97e),
+S(5c53b27c,4c0ae241,8569c806,8dd43a5c,6fa23ac6,74d001b4,eee6a748,d86c9e6d,4e0e720a,f430972f,b0ab89b8,79a56eb4,f0af5161,cae83ca1,964a8099,f9d497c1),
+S(2671ef50,5a321387,9560f0d9,e8588707,1c2b87b5,d06bb9d,dec3d179,6275b098,750ea18b,dbdcbd58,be994eb5,cb3539f5,8c3dc630,7d50bbf1,f69050d6,235826be),
+S(59baa5ce,9d6e707b,b0738f4f,d37c9890,801ed796,a82afb2a,ecd2c5ba,195be65b,e6b66356,20a8a106,b58dc202,10cccdd1,e0e8c579,c92f3fbf,8b335765,b30d8291),
+S(bb422d0,88abedca,e4686479,295aa1a1,77d7e68b,293bcd31,4097ddc1,af764b90,a96d33f6,46d4861d,a471f853,e0c6ae32,b1eea619,a7441504,a773f5e6,fc548805),
+S(8d7df8a5,f08ba2b0,923662fc,e594f111,5295cf6e,c5aec9ca,df0f7236,fe51b362,26452215,7d8572d0,f057ec9,6f572f11,ebad3fd0,56032240,26b54df2,991f9046),
+S(9e2b1637,352d8988,1e76fdec,c2dc8533,6a71b18b,3c98e59d,397602f5,8b9087d7,b997404f,1c0b1e64,90cff078,fdc47c42,aedf245a,e69d844c,18a146fa,6d8c3d13),
+S(972c7bc4,6362bca6,b58f1d0b,87c0b8dc,fe91a217,7f0cd7af,404f6f06,47e09358,cfda778,a59d944b,4ec08bcb,3aabd70a,cd6f29c5,204c9161,fe2e5bd5,71d03f6c),
+S(f7dd32ed,89ceaace,52e7f26b,202ea6a5,c7e8ff42,6c7ebc16,12106f7c,6fe51a54,7349c17d,d8ea6ad1,cb346e3d,26989950,3de00c11,4205b3b5,50d27ff7,67efe75d),
+S(c9f96f88,3e34aed,97351928,fa77b07a,f4b01bb4,e4515f0,59745ee5,decc9fbc,6fd62453,dd6c9dab,10fb7d79,c15b4822,178eba31,258800e4,519e627e,91ef20c9),
+S(9c28cc93,809b35b3,96a4c9cd,d6976391,17402ffb,5588cd76,7c41a92f,e971a9a,ca3b2634,28513516,86a661c4,747aece4,c8130d93,ff4108a6,3365e725,2bbb80ce),
+S(263a3fca,437c4dbf,48ca36e6,aa892d61,abf58f6a,d3c82b1f,fe945dc,c45a15f8,604c5bec,69e0f1a7,3e8f8a80,4f762cda,96ba2198,35268887,910c8df0,e83d3044),
+S(7fe42dfb,b3466ed4,d7cb8242,5e66b5e1,14a70516,b118911f,9170656a,3dbb04fa,d11385f4,b0a3a0bc,cf09374f,868cb30f,55175d77,2d3e463a,a298b6ed,1e6f6fa6),
+S(53f2432b,a8171714,3fa9df3d,ff41ced2,4a29b314,bc5a8c96,f5f6400a,d7c0979,42ad1004,3e0f8648,332b1c1f,6ee4f821,b42a5b0a,361747ba,60816f2,ac84c58d)},
+{S(b8b52efd,bc367a5c,a1534bb2,f339a048,50fc4941,1668780,dcdb8b51,2daa7526,306a2236,856070ea,1e0fd846,cd571889,e20968cf,cd490bc9,facfc4e5,a5970b2a),
+S(27e226b6,ed59c89,5bd20232,bc677c35,495d9601,5f37493f,5075718c,2017e42c,a130a5c8,54ed8ab3,ed657e0f,ee4a04cc,1b59a291,6e96465a,74b36144,7cc621f0),
+S(1733f1c0,da38fa79,a7b37988,1822ef51,2392d8cb,59d1ad1e,afaf535a,e151fb64,a93ddb00,af779565,eeb230af,815f9434,958ad39b,387d9069,a03cfcb,8563a920),
+S(e3f4b777,d06c8839,c63dfb41,73281787,72debac0,ed45b991,724c19bd,85ab3c58,2d6a84ea,745decd9,e6444b7a,dbb59fa3,21957b7c,3f8141e6,fd633d3f,7539dcdb),
+S(a2b42fb8,9ac10df9,ebe804b6,c105e855,25cb05eb,7407d383,3031e216,64491ff5,d0973dbd,346a87b4,f4ddfddd,12be3131,e6c6a397,8e17be2c,bda23683,62f80765),
+S(66d441a2,6b28378b,cf23d33b,ffac1163,7c23bbb7,7ad352e7,ff5cc09f,41bf6e91,982aa46e,5fa0b19a,28ecfdee,539c0ec,b5f06e2a,217f7687,6c3cbf1d,e92a6068),
+S(3721fccc,20338f8a,779aceb8,eae3fc7f,bb0e4040,1de2c8e5,27941ad7,f789d0f7,d9516c54,8f457b6e,d44f6bbb,23f36c7c,e6fdc548,60e5042a,b3dd4f67,ad5ae3ea),
+S(959e980,4618bed2,73b5cc48,5565df27,b8e09c9,a128a9e5,ea92e347,66e02015,cee3a227,1bddee01,3582d65d,c3e26c8a,f80a4601,abcff432,b1737127,91ca15a4),
+S(f2e81d16,c19466a6,1b56931,935d03e2,aad6b8d0,7f193d97,bacdc29e,13cdcf38,afb8e973,8d563dc4,1e7688f6,c6b43b71,f366b576,9479f093,88fd09e5,faa1063f),
+S(98305a48,800f92e0,bd815192,7b8658fc,60a97c64,c9f97383,68812614,3563910e,d32db8e2,6699b969,5b644c08,39f2399,f8ef45ad,a0d857c5,2d0c7c3f,96a62993),
+S(8dbd4fba,113c50ba,ff3f251c,96aba9c0,440d8e69,8a1e4ec1,84fba97a,e497c443,f642b1d9,b012eef2,40c6ad38,fe441d11,cfb42ec2,a3c15540,45e64c76,c15be491),
+S(deea5bb6,c7eac0a2,93e90817,836a3e55,2a7f1354,395296c8,97964c2a,4527a727,4cbe143c,c9fde617,c6142335,4323b9d8,bba13dd7,fbd46db5,cbf4ce2a,11c9c00),
+S(349f46a5,8621034,9f207a07,4558787d,336cb0cf,a56c1e67,8dd3b04a,4d717f4b,a6479d8,f7f017a6,32c369c0,8679fecd,985b3c16,ff444ba0,3fe43575,8b96455a),
+S(a6d818c9,dc182fd7,81343bc,b737811f,611c8499,e44a6cdb,33a36beb,7e44b545,1a8ee36e,d6e9b191,b9cbf840,3924e6b8,ac3c3f8a,cbc9a0b5,ff965d6c,734d741d),
+S(f9cad333,7b82ea41,b00f3ef1,bba37b8b,fcb24e8a,175fe380,8e399b67,d21837e7,cb206854,4e7f2cda,28c035f1,b8b50009,319797da,bb498b99,d31e24e2,4fa27ca9),
+S(25042b59,f9b29a9c,83d04515,c78f1c25,5b72f97f,7b387113,e88c36b9,9da3ebdc,d966ba9e,a7eb9734,e1481cb7,2df63252,7492e1c4,43f1fc9,c0efe0af,442b5a13),
+S(e19c4319,b5c9a01e,b588c629,8a7c6b76,1b80bf4b,e39424e0,666ddc45,fd57e0f6,1b0a2c30,4a1bb1b1,9dd0b50d,29df625,bf958a73,46cc6b1d,81a213a3,b6636285),
+S(59c26fc1,6d151c0c,7da0edf6,c474463c,587c45cb,7e407589,d15aad89,de223fa0,f7b227b5,4855c1c4,1e576431,8a7106eb,ea214686,ef815b42,db8c18ae,d5c940a5),
+S(d967d546,e07ac1c2,31fd50df,a1d25a51,60594d88,3e816f6a,bd62c15c,446aeff6,8eee6c03,6e22a014,5d9cf3af,9b44e005,cd1d36ce,d7c420f5,e2db918b,e4fbf83a),
+S(424b149d,9104254e,3f5772b3,7d973cf2,a46bd110,89d8f850,7666f04d,382c972b,7272ad07,54c18fbd,66e2abb3,952c526,d8113d5b,166283a3,9ac8ecb6,2b7a3e46),
+S(40b4b2ac,bd299270,e64bc470,8607c586,3bb50913,45e573f3,a5e2461b,47dbc053,d094311e,fd81bb1f,4622d17e,68044107,a2a8ed54,3cd5ff8c,b531b28b,9b8ec99e),
+S(79e79ded,6bc0d851,fa769b5e,8d65857c,f3c1c18e,6c990cb6,116fc45b,63e9f924,4fa89e89,ae4214fc,ba2aecdb,41984788,8154eaa6,bcbbe29f,f04a6262,7299f469),
+S(a11ad5ea,59c644b2,8dd7402a,5f96a970,68d96e2e,eb77d59a,fe0c2fc,cc6b252f,38e379d5,150109df,36ed7ad3,a2daa41b,4fb9c731,718cf5e3,8f8f8cf7,d1f3d770),
+S(b3002b00,ec5be154,cd8e5226,4b97f5c9,f444b305,8f59c4c,bcda5edf,9d10dc88,f7e9ae65,6ad2c823,8e8e0436,e007d821,b17d9405,984eccc4,617e3977,2f25d636),
+S(8d1267b1,94da1334,fd20cb8f,77fa01cf,9e9ced90,43107e41,d1ec4057,eb6115a2,a7ba1b9e,2c6f0f19,5ff1f50a,7a8da22f,da3003fa,44b818b9,953b44d3,e6d6a0df),
+S(dde6a3a0,87ef41db,2359e4e7,ca7cb064,424301e7,c5cbb5bc,4b6e504a,f3af4837,24175b1c,b4b39b7e,23718e26,be4a22bb,8bf54302,1f156234,e7f18010,d538aeb),
+S(79efa584,2fb89f4e,85f556e,c4be170d,5c1ef88a,3f3f75cf,6b20fc1a,96984ad,b0704aaf,e4d8f30f,4f29fa85,6d55da13,91f5f3ce,36cdef6f,25133999,cc8541a),
+S(3aa09dc0,5546977f,7369fa0a,7b60c94b,eab86a1,10d85af7,7b826475,7d67eaf5,343b4cf3,aa6c5ebc,ed041d7f,2381be57,f7fd32d0,29a2f42,a7c8821,4f425d8),
+S(53fe8af9,8f9419fb,1445bb6a,94750d46,46be9f37,b7155763,88b11064,df2e6ffa,6cd77e81,84aeab9d,e9bf3093,bb9b21a3,a04a0719,fc428f3d,d5e14c8c,9b16cd7a),
+S(fc395dc4,a5114dc8,bcb0f7f0,3a4d3e9,38a87a3d,78d33864,d1dc4cba,9e41e20e,c7991f6e,f72f82f6,b3147e56,74224929,fddeb8a5,97a1b1d4,8852733c,1830b941),
+S(b1d25d51,b4558f5f,d0ccb868,3af9a9cf,62a169c6,91627fa5,92d80b18,36695f94,8f92258d,fcf16f4e,8415f53,e65457e8,9f090e72,5479c123,5a481464,a11cd4f9),
+S(b866d6b1,42df940f,2cf28b54,c92f0c12,94e0b6a2,2a91f2ef,44bcd88c,4384480d,e6eb4f4c,bd95148f,765d8728,15652853,db1add7f,b4e27929,f19a64b7,f3b34c87)},
+{S(d4aaf32e,dd897f48,5ab16466,76d747cd,fec5b7a0,a05c917b,60c07311,45d16f89,4857e649,beff4089,2470f700,cadb73ae,d4866a84,c3f0b975,6fd8570e,df9d29d8),
+S(4ebe5b8a,f3b1583c,9f41bd98,afaba549,f45c381e,c93ec9d1,4a543d87,9cefbaf3,63ed1d17,9b215f34,f1f580be,4b3f671f,2fa14689,74cd03d1,19fadae3,c92935ff),
+S(20df6160,556dd3c5,a26620a8,70ff5323,cbbab94,be3e3bdd,ad8b936c,554f28f1,7168e7ab,cdbafad,26fbb5be,a09dadde,ed36c20f,c8deafaf,75a480b5,f980e981),
+S(86c663f2,cc6f7ee2,50be25fd,fb35fd8e,5873481b,c477bf5b,c0f1bc1e,3f1320f,c13c5795,cce0ad92,e31240da,90a823d0,d2352314,f2852e67,cb62e0c2,8570994a),
+S(3fd8085e,57f6870,b25e41d9,7df00126,150f6022,a7ede22f,d27da581,d234ccaa,c6657746,98d6ac03,ed1ea2d7,bd3f70be,86351c5d,407a4d7c,227fd7d0,c330ef04),
+S(1510fcf0,b0fb5a23,c15e041,2a7f6d89,9fac4244,8ce316bf,d88fb58b,10e23118,1879dc07,b34d0a62,f0b9517f,3629ae0f,e8aa6d30,5a783f37,69bdf65,3b40408e),
+S(67e9982b,c40f427,98df055c,2d8bdcc0,2ea97bad,68d34024,85498e27,d99e19e4,4f087caa,efc5fd7f,b099c134,a273635c,d1d5ace3,26e3103f,9b2fe22c,e95f288e),
+S(e8eeab21,6c3395d6,d16338ea,de4108da,1c25e471,67fb13d5,99e8daaf,93e7345f,7fd2ba87,7c7266a5,65a31548,99950ea1,e5e3d73f,612addea,318ad5bc,a965228d),
+S(ab20c7c8,9dd74c20,447bc762,e374c548,e7a8ac31,eec11123,1a040cd1,36e9a546,facacfb2,52eb9532,9106a26a,60128a0f,ae1d7e5c,fd39483c,aeb54dd9,231b55ee),
+S(a9004211,b7cf5494,1c530a0e,d658fb6e,3b5d2ee1,37b7d7de,45fef6b5,efddbf0f,58cbaf67,5cc5a131,54eef7a1,462b5d1c,408d5d56,3553ca55,45388d77,c6391d4f),
+S(8db64274,422ae0f5,6474b83a,89912fa,e3a39b6c,b3fb8370,308a572e,b6b3c020,9b71a72d,431fd44,aa8632ee,23bc678,61d96edd,b7ec72ab,4b1679b8,a4ba73e4),
+S(301b330,c478189d,dce4314f,380cb2d8,38bbd416,5dfad8c4,90f2443f,2a56148b,737da0,1c05cf73,db36a1a4,5005f562,1327167f,d3b60ece,3da3705d,131903fe),
+S(b9cbc7a3,4a1cbdd1,300e789d,b7ffec1c,dfe1f738,fbe1fe19,67dd7c14,92ee3ba7,5a816a0,9d08c4be,2b8d062f,200fde4c,534fbdbf,854c7e53,64532c08,60c97c01),
+S(6a15e51,6f9f0a7c,25f2eac7,649285ea,d86a1e01,5a386dc,c7f94ba8,4782b45b,63eafaf4,660642ef,988aeee7,642e7c4b,71124a1c,2ca2f5c3,d4f2eec9,ea72d70e),
+S(f4c696f3,34c56e08,2ab2e627,4d450f34,fa7fbce,29f3e14d,332bcadf,87d5fe0d,6ee44edf,f574d9a8,363f98b6,b863a648,27d3020,1e652935,be12041c,1bbcc7c3),
+S(d2f3d5ad,237ba177,ed312bbb,1d02fb2a,e4bda20f,41f5c217,8b70dd9a,c26ee9b0,cc5912d4,2ea1af01,aa914b98,8c42cef8,46a5a059,664c8545,fc00b662,e0327920),
+S(5588b0a4,757beb33,e668af5f,adf87fb3,2aed8e16,e6ceabf1,1576ae17,c6a2b843,70d8961b,ac203e89,c437b88b,ce331309,c4f7eca8,d614299c,74aef9b2,17c741de),
+S(f993cd07,f6eb75ad,d41426d5,cc653886,18dde1f0,88aaf3cd,b2631eea,158373e0,1e74f804,5f60349e,a85b90e1,206f0ea4,b0cd3740,861186be,648063e8,58c2b395),
+S(2cd04170,78291a50,750218b9,44a11a64,1cb75e7d,cd5cc4f9,64f53c8d,a1ef08f4,1f54a70f,f66ce343,c7ed3001,78d7b99e,49129e23,90b5a026,7ba25af5,3467b6d3),
+S(52fc09a1,d4f0cc2e,c7ba6cba,1b30e1f0,b9e37f31,3bf59c33,60fc02e3,3b0c15e8,9bd14bcd,a7c7b6ab,dd7e17dd,ab81a1cf,846be336,a76858a1,8e8a0194,776f0a80),
+S(90d29aba,764a9b49,1e2878c2,9b964bf6,e510af,3dd5aeb9,3fe29e13,b8f03b23,396b1f6d,e9b8fd1f,463ca064,11b09823,26cb6ab7,4bbbcaef,43031497,f149a620),
+S(ce1d6e8e,ddd063f4,316cb006,b4a4213d,9e0952c8,43e6e1e7,570a35e,aad7fa53,a1abcd7,e2c23ad0,895c5aa8,82a805cd,1d7d434c,72f0c528,2ceec0b7,a7016f7c),
+S(4df6e1d3,93a4be66,6fd88c75,e1e686a1,e2cb1844,f5f1303e,f7b0a751,99b42bf5,262d8b9,f7e202a3,78a51928,91ee3fc9,f269ef5d,e14dd0ff,f1fec9f4,4cdb9058),
+S(f71b9bfa,bcc353a4,11a055eb,a7d6f48f,47c4e437,96382bcc,d5b882cd,a9059638,bfc1c3f8,fea7df8b,d1cd088c,b1f02e47,377d6656,9b3bd8a2,8b457ba5,e6453468),
+S(ad5e9212,d3ef76d,8319fd98,72ee753f,ec99fab0,6244f4e2,a9567068,a635eb53,65fb538f,cb570092,7b0f775a,73ffb0c1,4e6c2274,e253f3a6,2dba9caa,27a3e5e4),
+S(81a7dfa0,7659fdbd,57e1c8ae,20c14a80,ee8bfc51,46caa8db,b077b653,23bad4a,ac9d2438,3ef0d99f,26744be4,77e69d51,49d44ab9,84801bb,759d3a5b,7fed1e2e),
+S(3bf8c1d0,a613316b,e90eab62,6788c8c3,b1641d65,d0e50245,9e5b19c1,ab1eb617,e1edb59a,8594d73,669e6f93,ca10e210,1254946b,8c9e8eac,3fa84a49,e4e2944f),
+S(30f9283a,767c551c,e9fe87d9,5730eff6,fc302a4a,1810e4de,11ba62af,fa17eaae,1f383ac5,e714240d,67980617,d96b0c05,76008599,f8e3fa04,d57454e9,927e729b),
+S(1c5d4ac6,91d37d0c,9db5e071,c809a59e,99056263,fbd83028,ee9530e9,c2b3f3c9,b98c7be9,7a2fb196,3d3d4a75,4f7fecce,2fbeb8fd,cf23c229,73b6875,86bd276a),
+S(3dfe48e5,2f055be1,1db79fa4,501b44d8,f5ae8447,c5a1293a,a79f683f,1e1e9bf,2d7e8303,b988fc17,18c9b64c,1c03373d,27fd0c32,13c26e6c,b684ca94,49f79d5e),
+S(adc4251b,c3ef6d5a,a4d6eb22,46ab2787,bc835b65,1d17ceae,489f181d,57d37248,4f0c489d,1c3a1814,a2f9c1c9,d6fe908f,4623aa44,ebaf4143,79fb8352,15234014),
+S(edfe16b2,db401803,11f98920,7a2fef7,d05b2a3b,b676899f,9c6e2192,d38f93e0,1196fd0e,35a24c9,6b28b055,b4fa2f2d,a4c2aeff,3b91dd81,c2fe86c1,1d6bf682)},
+{S(b4b57b34,6e1b41b,7394e655,e059cc93,44c5d83e,f0ef17db,2789db5d,13777b78,6fa187a7,4d983b7e,cea6a268,61039430,63e599e7,cba73144,fe3eb23,677c6265),
+S(9937238,7300054a,1a8713b7,6942f003,99818b28,6c6fba5d,ca60b9da,1aa7767,6c003e1,848ce30a,65601eb,e7b76acf,b2e122b6,882d7439,f463c042,ef1b31a),
+S(ebd177f8,b5757665,58851c7f,a7ada38b,e3596080,f2679181,f994efd3,82714784,d0fe8eb0,97c852f7,b284d5f,bd81f77f,79c35af7,cc30338f,4e63211e,9e20a244),
+S(367ef258,b279f923,a18215b7,67d396e4,c6bc874d,2be6b369,b01afffa,2e041741,bd961242,2452eddb,33831dcf,fb3a0273,30ef141f,6db77d91,5bec2ecb,553b6e6c),
+S(d89f40c4,f752cff4,5bae5762,37f5096e,f27d46d0,d934d4de,c3011a28,59464e8e,9d32661e,e2319d6,f6427ea,a3014b5,cf98306c,666c4a9e,970dba2e,65e04886),
+S(ef6ff862,1d84c5d5,22e490f4,db21181f,a17bafea,3e097868,4f1f0215,759772b9,ae006f11,aa85db2d,3624cf51,ae319ad2,8b4970e7,eac03301,1eb15db8,dc59d62b),
+S(8b0a1b1b,d476bbfb,6da1d071,68d3a988,3b49802f,8ffa04a3,bbba1313,17c67a00,d8c74ae5,65c38597,8d9fda2e,dff6b932,1512e40b,ec5b62e2,59d4d81c,9b657b55),
+S(9aa9250f,12ffde38,21384434,849d7eb7,bcafbae5,9a3b861f,68a3addb,d75d3715,19b4b1a8,8d8bfeee,38b54564,30d5f73e,ed0365fe,49092d4a,2f52fa12,b65e3ac7),
+S(aaccc00f,55e96f0c,e66d9b43,12f9abd2,6772d8b4,30a6c62,edd2aab4,97acbc22,5af203cf,97d11147,82374056,f012f5f9,2825476a,820dce2e,6e1c4b33,cef5337c),
+S(43c34546,2836b544,ddd6e432,6aa19b4a,9de7fdfb,86f43cae,ce98ce7c,32b1ccaf,dd518249,f1fbc1c7,1f905860,17a6f60b,15be97d4,18c66d42,f4f9adcd,d722c096),
+S(9a38eb25,935441ab,8983097a,d58c821f,d784f091,5f85dc26,3f0c020b,b80c39a0,d8e6dc57,41e4ba5c,576179e8,9a6dcb4a,bd7178c6,13a1100b,e2bd731b,f3e819e2),
+S(6b10527,204a4f7c,e8afcacc,fe771634,376f18da,f12774e,50f23a90,9efe0223,b443a451,529b4208,c8c98904,f5eb2ee,2e2ede2d,80ca50c5,aa29b95a,714181a),
+S(1a88fecc,71d7550a,abf7faf0,8e884e95,835f6dc8,1815d2d7,7dab66ea,b238d6b2,82cf6711,1dd38ff,d0daebbc,ea2c064b,17b6b21d,34804f93,4a037936,9edec692),
+S(a6b1751,f30507fe,5927b6d4,a92ebbbd,77358c02,9b750d05,a56e4d41,efb99144,ccf7c048,a2a0983d,fdcccfd,a071b80,e8035866,c479ea3a,3bbe7c80,12dfd618),
+S(e186601e,8b545292,f23ae7fa,4cadc80f,1fcaa1a3,430ddec6,cfd2af47,c835cdf9,fd471f16,7c3683c9,2e5fc0c2,89b646a5,c8ebda6d,5b6da213,d862c3f6,2c292e9c),
+S(91b3935,d8ce2b80,c179ee0b,87850140,4c418c7f,7cf94e4a,64b9fc9c,e396a093,45a5043b,8184546c,9083982f,550807d7,d61fe677,ce73ef21,9b3aa573,97c4eca1),
+S(3fbe61fd,2a387654,dfc428e7,dac09e91,5e1ae7d6,d3794288,743f2535,20858ef5,206fd9a0,e3265118,e0a6475c,4df87e43,cc7c8898,59d8aa08,23b6dfff,b68b34d7),
+S(31a35020,697d9d52,55476289,ce4fcbdc,4e1e0690,c2c36d1b,a4f4640f,e4c5ba18,91f660f9,159d463a,857f08ad,fc3c5ddd,804507c5,92f73de4,2ee44555,da538553),
+S(7dc6b83a,10f26e71,e12c0bd,7ebcccc6,61b4394a,68f576fe,bfca1c23,256e8aa2,b4796977,bd386b98,f3e2fa8e,798b6548,fae52a80,40bb12ea,7e6ad675,64fc8736),
+S(67a9c3ff,9c7b99b2,5318ff9e,2b85ee23,ec244655,8042ea8b,d880e23e,7d3ce221,a7bcbbbb,895ca7b1,847a43fa,98809ce4,98016123,bbb3c099,7d34debd,cb023f8d),
+S(36602997,eba2c6c5,aab4cb65,8d4efd46,65ab3965,f643ff66,831646dc,f6443bf3,c82d0e80,ef775f9c,7ec7862a,e3158556,a57038d,e6850dd1,e349629c,2546239),
+S(9eb9244b,299bfd76,f63bb140,ae2f42a1,4af1e072,83f8259f,6478ac03,d411df24,e43f91da,13c2ba21,a9d17d2f,7a8a629d,9051346,93a6552a,538d590,9d2bdd38),
+S(ba4450fa,27d57993,3d949a1a,66013906,7d1a9716,6794993d,e45d9426,b4bfc5ed,8e3f3b9b,d8cb8210,7a5ae2af,92b96259,b73633f,6528ac04,20c3e101,6bb6d8a8),
+S(e6d5335f,b67abd36,2712c7fe,575ee769,53d488b,236e8589,5664fb04,7f385248,9e255154,e070a5bb,e98e97f6,281fb999,a75e68ea,7681fdf6,fea093bd,919aa5a4),
+S(63c099a9,300a331a,3bc4348a,a373e514,c84a810e,1ea8a8d1,4ac8d7cb,818eb534,ed7d4029,3cc4a086,b1d40c24,6086109,a02dbcb5,a864777,27939024,6fd6bf91),
+S(7088617f,66cd93f,8130eaeb,874c3f77,3bcb0daa,78923b70,a65512a2,992554dc,5a3ff995,3c712066,291ac4a2,dfc2573e,1d0aed56,75ef526b,b15f61b0,d20f8156),
+S(cc354aaf,746d756b,9387730f,2f12b999,4fcd815c,6d25cdab,2e1185aa,4aa639b3,fb1dead9,4fd76859,1aac8d79,5c337924,dc155fbe,5cd5c953,4d55ee31,f6d284a6),
+S(e7e47c3a,e2bf4307,7f33ec3d,ac1ae2a7,5c669e61,e248f588,590cfe07,3e2186e0,46e9c4d5,4429fdcf,5efb375e,18f46cc8,3fa7a403,6013777f,e450e228,aebd4cd0),
+S(c6ed5e63,28ec31b1,37041108,42d4ac23,fbb883bb,349d88db,1d747cf7,325fe9cc,21b8bfa4,b62807cf,d6cd11ed,a38084d5,7bb068d4,9f0dd30e,f3f431e2,b57022e4),
+S(331924c7,50b3417e,48e279ff,6ed7f3dc,ba2e121e,9f69f8fb,e64093b6,c38a8cc6,357086be,e4cc0fe7,d45a49fe,41d004ce,80466165,316164ab,3b171f03,b9a7841f),
+S(b4319cc9,f3e0d3b,313626ae,5385796b,c49b300c,88ba4553,dec0aa4a,77829372,b8f82bb6,6590afd4,48501f,63de3a5d,8f84edea,35c1ee44,88d6333e,f522a808),
+S(da433d5e,11ceccc0,abc5c762,6ce7bab4,2e89b221,f785c409,282de545,f3fceb19,1b67242c,de57efcf,e214423b,506a1ade,718803d2,6dd84d88,97b18ede,590a2fcb)},
+{S(ebae7464,ece277b8,309d056c,cf3775e2,11a77aa,81c316a4,b6b7b953,6f90f539,62a4d6a2,95fdd811,f2051715,322f17e5,1753c9d0,835ef9a0,3e8dc9f5,c69bda31),
+S(5b20700c,1af63394,a3e4cadb,b0ea682e,19cf495a,b908418a,d41f4c6c,ea4477f0,8435d15e,34b03a22,ca89c73d,326c2f88,142d2e23,8964ef6d,99287125,79738f78),
+S(b2f25f91,138b974b,561328c0,92f50fdf,8a694004,fd4879d0,12a4a6cc,c8059d1d,d9ec0b2d,b8e81b2,f6feaf55,9776ff78,cda3401b,47826de0,ca06e579,9d866c09),
+S(64e79790,7783d6fb,321eb785,acdeb2ff,4628270,fec3342c,527c8db0,a34c516e,c0c4da5d,abf3da9c,a8613f82,ca28e84,a1a18376,c9967c08,aaf70bea,7a2f34c2),
+S(a50cae84,a08f4f32,4984853a,d4c6bdaf,77eaa788,9cb8fe95,72fd56e,9078ee73,120ecbf,76e47b38,503067c8,36853003,60ed261a,40fdf440,161ef2cd,19786b93),
+S(76ff3ac8,80a451a9,6741fc70,82bc4c82,7bd51c08,95eea8c8,b422b8a9,96ba4794,25555d71,d4313a60,b189a154,58e0a40,c643c204,277334e,966e2abd,3a23f6c3),
+S(307e5caa,8b708760,3d9f845b,b78f4f10,72c49c10,9747f91d,192f8d6e,70c0f4be,f5992f76,37167e1d,55cd31a6,1cdb4756,85eb1503,34fb6009,e0240a18,fa8302b8),
+S(d8e62e47,b28fd165,4d420137,884dcf21,c10cb159,d9885843,da34b0d9,d09b2758,675c75b4,b903ad28,2055a71b,2c470e2b,1dce69bf,ecf160cf,3a027de2,55b723a9),
+S(ec5639c7,73dac23d,3008dabf,732dc005,3154703d,26ee3bbc,7689286e,4a73e39f,aaa5ea4a,2cf5c23d,57cdd0d8,8accbbf9,9fd2c213,97bb45f8,83547876,3aab1248),
+S(3d928ee3,2065557a,27722f08,5202f48f,40917ed6,c7ac1963,2a122226,8b0cb9df,ece112a4,e7a05ad6,17c2fd83,76f89102,9eb94eb0,930fb23c,a342d7f1,f021a0c7),
+S(616228a5,cc6c3a92,cd694cec,4b2b8574,5dfffa90,b2a36d8f,32eaa6cc,2530de51,50d8d140,4d506a78,700f8e82,967b36a5,1b4de644,a8e22271,d509c8d2,4adf3148),
+S(6f85f308,e847b145,c13a07be,bebdd4ba,6c138939,6afd8670,733f44a8,969406d0,864bcde1,be36c9c7,b7e04ef8,cd2366e2,b3c22902,5ee7efce,d005ef5b,ff7dae2b),
+S(f3d1ecc3,53a82621,1bd78f0f,aa029076,c6ca779,9bdc54b2,128fa3d2,aec00c6d,75aa0cf9,fd0b7bed,19183e34,58142f66,c94a5aa9,3915435e,ae51c1fe,96625ccd),
+S(a5918de3,f18cd8d1,2a234f9f,3a19fcaa,2d83671d,ad566f16,8aea2b1f,b9de41b0,c515dda6,43c0f6c8,d8fea16,5d595917,16b7f521,43d3b941,f28585ed,8a49c06c),
+S(3c49e2ef,1d2d3464,81e05fa0,33366609,1615ebcf,535f68,be257f35,7bd91592,57901e0a,c8af3a31,aa404987,72c903fd,175c9b00,5c7458ee,ed667f11,57754132),
+S(6c45ff2,c0c30320,83c343e6,dc80b4f7,bb64502a,52f412ff,ada521d4,a544a9f0,e9936037,f1e641eb,1cd6f801,a25271d3,cffe67d,c9bd7162,babf9855,9628a9a8),
+S(66df5d95,acdf4260,ee0e465c,e3916d79,395df522,aa086aeb,6c283bb7,18296d46,cb1f3deb,8aea0337,625f46dd,903416d1,5647be91,1633c4c0,cf0e629a,413476fc),
+S(428bbba5,ef351762,9eee4059,a3339213,40c7fee2,5ccb051c,88d75e53,ba618858,ef18809c,28227ccc,115876df,b3f378cd,374c0670,2c658501,7990e767,922c3999),
+S(e8993820,d782657,ed8badc2,d515e360,df336730,860ef49e,65ca58dd,1a385815,feb41189,16c7e8f6,53c7f5a6,5fd7b6be,7a029814,149c4645,847073be,770959de),
+S(2b77e42a,63502244,d6c7d1be,54b7857,9e2742d2,7143d689,fa3f70a3,5986ccf1,721e9da8,bee88ad4,2155dc9a,28be505,86648378,1d6af5b1,382cd47d,771e6428),
+S(acffce3a,ed6beea3,2ad71633,21e1ca53,6f69ce76,fb5cd394,9d9dcc14,bbcee96,5384c97d,eac946c0,afc85b54,f3a56b79,fe263bff,63e1894c,6d52ef1b,9b456602),
+S(e13d8d4b,25bece8d,90a008e4,c004824e,223b06b,7cf65ebd,1215e910,2e67b639,3e92b1f,14cbee57,9640b377,6ed5938f,9aee0e11,b139a678,3f207cf4,6dd7e20b),
+S(d8f356d9,d2498eaa,b3fa12a,cb64562b,dff3e270,c7809a31,25a9ae65,9cb1f3c5,a5403cda,2d499a7c,7402b57c,c9f99e3,64f5085a,91fd8cfd,8a67c7a8,dbce04fb),
+S(350062b5,22fb5d0a,8c79a5db,29e92216,79b9fbc6,3e1f95ca,e7d087f3,fedffc49,74cacf57,5e79c85b,d7e77a40,796e8750,a3ca57f2,a47cce8f,3d2de02d,b014df0b),
+S(c159e630,9ab23135,58ebfb6b,22edaf93,eac8e16,77cd9f3b,1cd9492,20bf8e54,99244263,53f32608,831c6d74,da51d61,c344defe,f4c1e401,6a3db44b,4c57f4ae),
+S(9e568b70,36a2daa2,fe7a3a52,49c56eb8,3fe4afa2,decebd60,c6c3245f,17bc6a13,b6643644,274eab9f,5e83c598,14978681,17c5a078,765156ae,3cb65fd3,830e06ae),
+S(9bee7471,6b6c1ff5,62c1bc36,57a65de3,99a91d72,115703f4,4c3819a1,87828478,bb23a3da,ed34028a,7d39a7ed,fe2e23b,73e085a2,d6c2e51a,ef2a2076,a7c902ad),
+S(c430c044,91228a7a,ea835698,ecf0f552,9aeef469,a36305cb,52902ccd,1c897473,40d0ee56,61cca82,80d11da,bffe97c4,f10c93aa,5e07224c,154b666e,bcd58c74),
+S(2be073f6,b294a01b,eda0b0db,6832e4bc,23ef3889,7a859853,5ee726ef,ae0f15b1,6153f846,349c2a98,26008065,8be2a7d8,311a5e70,cc310ff8,7935a901,8d575813),
+S(2934de46,a6d921f8,720567e6,b46e6362,36a7ed53,483b13ed,20958452,3225accd,5979698,26927cd7,abfe4c57,c53fc72a,48b71679,174c749d,aecdb057,e6a2d961),
+S(4e9991b,92fa8c4e,4e8efe45,66966073,319e80d3,a54d4b7a,b61cfcc4,7ddaa5d5,9d03ea22,21d4d80e,261952e2,73f6a8cf,c31f6091,e5aa0a8f,2281ffbf,1345df9e),
+S(ff3d6136,ffac5b0c,bfc6c5c0,c30dc01a,7ea3d56c,20bd3103,b178e3d3,ae180068,eccdc641,7b1bfff1,bf2fc8d3,2269523e,ab89890d,bffe0a19,8f594490,e7739bb8)}
+#else
+#    error Configuration mismatch, invalid COMB_* parameters. Try deleting precomputed_ecmult_gen.c before the build.
+#endif
+};
+#undef S
diff --git a/vendor/external/secp256k1/src/precomputed_ecmult_gen.h b/vendor/external/secp256k1/src/precomputed_ecmult_gen.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/precomputed_ecmult_gen.h
@@ -0,0 +1,26 @@
+/*********************************************************************************
+ * Copyright (c) 2013, 2014, 2015, 2021 Thomas Daede, Cory Fields, Pieter Wuille *
+ * Distributed under the MIT software license, see the accompanying              *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.          *
+ *********************************************************************************/
+
+#ifndef SECP256K1_PRECOMPUTED_ECMULT_GEN_H
+#define SECP256K1_PRECOMPUTED_ECMULT_GEN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "group.h"
+#include "ecmult_gen.h"
+#ifdef EXHAUSTIVE_TEST_ORDER
+static secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[COMB_BLOCKS][COMB_POINTS];
+#else
+extern const secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[COMB_BLOCKS][COMB_POINTS];
+#endif /* defined(EXHAUSTIVE_TEST_ORDER) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SECP256K1_PRECOMPUTED_ECMULT_GEN_H */
diff --git a/vendor/external/secp256k1/src/scalar.h b/vendor/external/secp256k1/src/scalar.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/scalar.h
@@ -0,0 +1,105 @@
+/***********************************************************************
+ * Copyright (c) 2014 Pieter Wuille                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_SCALAR_H
+#define SECP256K1_SCALAR_H
+
+#include "util.h"
+
+#if defined(EXHAUSTIVE_TEST_ORDER)
+#include "scalar_low.h"
+#elif defined(SECP256K1_WIDEMUL_INT128)
+#include "scalar_4x64.h"
+#elif defined(SECP256K1_WIDEMUL_INT64)
+#include "scalar_8x32.h"
+#else
+#error "Please select wide multiplication implementation"
+#endif
+
+/** Clear a scalar to prevent the leak of sensitive data. */
+static void secp256k1_scalar_clear(secp256k1_scalar *r);
+
+/** Access bits (1 < count <= 32) from a scalar. All requested bits must belong to the same 32-bit limb. */
+static uint32_t secp256k1_scalar_get_bits_limb32(const secp256k1_scalar *a, unsigned int offset, unsigned int count);
+
+/** Access bits (1 < count <= 32) from a scalar. offset + count must be < 256. Not constant time in offset and count. */
+static uint32_t secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count);
+
+/** Set a scalar from a big endian byte array. The scalar will be reduced modulo group order `n`.
+ * In:      bin:        pointer to a 32-byte array.
+ * Out:     r:          scalar to be set.
+ *          overflow:   non-zero if the scalar was bigger or equal to `n` before reduction, zero otherwise (can be NULL).
+ */
+static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *bin, int *overflow);
+
+/** Set a scalar from a big endian byte array and returns 1 if it is a valid
+ *  seckey and 0 otherwise. */
+static int secp256k1_scalar_set_b32_seckey(secp256k1_scalar *r, const unsigned char *bin);
+
+/** Set a scalar to an unsigned integer. */
+static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v);
+
+/** Convert a scalar to a byte array. */
+static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a);
+
+/** Add two scalars together (modulo the group order). Returns whether it overflowed. */
+static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b);
+
+/** Conditionally add a power of two to a scalar. The result is not allowed to overflow. */
+static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag);
+
+/** Multiply two scalars (modulo the group order). */
+static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b);
+
+/** Compute the inverse of a scalar (modulo the group order). */
+static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar *a);
+
+/** Compute the inverse of a scalar (modulo the group order), without constant-time guarantee. */
+static void secp256k1_scalar_inverse_var(secp256k1_scalar *r, const secp256k1_scalar *a);
+
+/** Compute the complement of a scalar (modulo the group order). */
+static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a);
+
+/** Multiply a scalar with the multiplicative inverse of 2. */
+static void secp256k1_scalar_half(secp256k1_scalar *r, const secp256k1_scalar *a);
+
+/** Check whether a scalar equals zero. */
+static int secp256k1_scalar_is_zero(const secp256k1_scalar *a);
+
+/** Check whether a scalar equals one. */
+static int secp256k1_scalar_is_one(const secp256k1_scalar *a);
+
+/** Check whether a scalar, considered as an nonnegative integer, is even. */
+static int secp256k1_scalar_is_even(const secp256k1_scalar *a);
+
+/** Check whether a scalar is higher than the group order divided by 2. */
+static int secp256k1_scalar_is_high(const secp256k1_scalar *a);
+
+/** Conditionally negate a number, in constant time.
+ * Returns -1 if the number was negated, 1 otherwise */
+static int secp256k1_scalar_cond_negate(secp256k1_scalar *a, int flag);
+
+/** Compare two scalars. */
+static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b);
+
+/** Find r1 and r2 such that r1+r2*2^128 = k. */
+static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *k);
+/** Find r1 and r2 such that r1+r2*lambda = k, where r1 and r2 or their
+ *  negations are maximum 128 bits long (see secp256k1_ge_mul_lambda). It is
+ *  required that r1, r2, and k all point to different objects. */
+static void secp256k1_scalar_split_lambda(secp256k1_scalar * SECP256K1_RESTRICT r1, secp256k1_scalar * SECP256K1_RESTRICT r2, const secp256k1_scalar * SECP256K1_RESTRICT k);
+
+/** Multiply a and b (without taking the modulus!), divide by 2**shift, and round to the nearest integer. Shift must be at least 256. */
+static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift);
+
+/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time.  Both *r and *a must be initialized.*/
+static void secp256k1_scalar_cmov(secp256k1_scalar *r, const secp256k1_scalar *a, int flag);
+
+/** Check invariants on a scalar (no-op unless VERIFY is enabled). */
+static void secp256k1_scalar_verify(const secp256k1_scalar *r);
+#define SECP256K1_SCALAR_VERIFY(r) secp256k1_scalar_verify(r)
+
+#endif /* SECP256K1_SCALAR_H */
diff --git a/vendor/external/secp256k1/src/scalar_4x64.h b/vendor/external/secp256k1/src/scalar_4x64.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/scalar_4x64.h
@@ -0,0 +1,19 @@
+/***********************************************************************
+ * Copyright (c) 2014 Pieter Wuille                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_SCALAR_REPR_H
+#define SECP256K1_SCALAR_REPR_H
+
+#include <stdint.h>
+
+/** A scalar modulo the group order of the secp256k1 curve. */
+typedef struct {
+    uint64_t d[4];
+} secp256k1_scalar;
+
+#define SECP256K1_SCALAR_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{((uint64_t)(d1)) << 32 | (d0), ((uint64_t)(d3)) << 32 | (d2), ((uint64_t)(d5)) << 32 | (d4), ((uint64_t)(d7)) << 32 | (d6)}}
+
+#endif /* SECP256K1_SCALAR_REPR_H */
diff --git a/vendor/external/secp256k1/src/scalar_4x64_impl.h b/vendor/external/secp256k1/src/scalar_4x64_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/scalar_4x64_impl.h
@@ -0,0 +1,1000 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_SCALAR_REPR_IMPL_H
+#define SECP256K1_SCALAR_REPR_IMPL_H
+
+#include "checkmem.h"
+#include "int128.h"
+#include "modinv64_impl.h"
+#include "util.h"
+
+/* Limbs of the secp256k1 order. */
+#define SECP256K1_N_0 ((uint64_t)0xBFD25E8CD0364141ULL)
+#define SECP256K1_N_1 ((uint64_t)0xBAAEDCE6AF48A03BULL)
+#define SECP256K1_N_2 ((uint64_t)0xFFFFFFFFFFFFFFFEULL)
+#define SECP256K1_N_3 ((uint64_t)0xFFFFFFFFFFFFFFFFULL)
+
+/* Limbs of 2^256 minus the secp256k1 order. */
+#define SECP256K1_N_C_0 (~SECP256K1_N_0 + 1)
+#define SECP256K1_N_C_1 (~SECP256K1_N_1)
+#define SECP256K1_N_C_2 (1)
+
+/* Limbs of half the secp256k1 order. */
+#define SECP256K1_N_H_0 ((uint64_t)0xDFE92F46681B20A0ULL)
+#define SECP256K1_N_H_1 ((uint64_t)0x5D576E7357A4501DULL)
+#define SECP256K1_N_H_2 ((uint64_t)0xFFFFFFFFFFFFFFFFULL)
+#define SECP256K1_N_H_3 ((uint64_t)0x7FFFFFFFFFFFFFFFULL)
+
+SECP256K1_INLINE static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v) {
+    r->d[0] = v;
+    r->d[1] = 0;
+    r->d[2] = 0;
+    r->d[3] = 0;
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+SECP256K1_INLINE static uint32_t secp256k1_scalar_get_bits_limb32(const secp256k1_scalar *a, unsigned int offset, unsigned int count) {
+    SECP256K1_SCALAR_VERIFY(a);
+    VERIFY_CHECK(count > 0 && count <= 32);
+    VERIFY_CHECK((offset + count - 1) >> 6 == offset >> 6);
+
+    return (a->d[offset >> 6] >> (offset & 0x3F)) & (0xFFFFFFFF >> (32 - count));
+}
+
+SECP256K1_INLINE static uint32_t secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count) {
+    SECP256K1_SCALAR_VERIFY(a);
+    VERIFY_CHECK(count > 0 && count <= 32);
+    VERIFY_CHECK(offset + count <= 256);
+
+    if ((offset + count - 1) >> 6 == offset >> 6) {
+        return secp256k1_scalar_get_bits_limb32(a, offset, count);
+    } else {
+        VERIFY_CHECK((offset >> 6) + 1 < 4);
+        return ((a->d[offset >> 6] >> (offset & 0x3F)) | (a->d[(offset >> 6) + 1] << (64 - (offset & 0x3F)))) & (0xFFFFFFFF >> (32 - count));
+    }
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_check_overflow(const secp256k1_scalar *a) {
+    int yes = 0;
+    int no = 0;
+    no |= (a->d[3] < SECP256K1_N_3); /* No need for a > check. */
+    no |= (a->d[2] < SECP256K1_N_2);
+    yes |= (a->d[2] > SECP256K1_N_2) & ~no;
+    no |= (a->d[1] < SECP256K1_N_1);
+    yes |= (a->d[1] > SECP256K1_N_1) & ~no;
+    yes |= (a->d[0] >= SECP256K1_N_0) & ~no;
+    return yes;
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_reduce(secp256k1_scalar *r, unsigned int overflow) {
+    secp256k1_uint128 t;
+    VERIFY_CHECK(overflow <= 1);
+
+    secp256k1_u128_from_u64(&t, r->d[0]);
+    secp256k1_u128_accum_u64(&t, overflow * SECP256K1_N_C_0);
+    r->d[0] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, r->d[1]);
+    secp256k1_u128_accum_u64(&t, overflow * SECP256K1_N_C_1);
+    r->d[1] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, r->d[2]);
+    secp256k1_u128_accum_u64(&t, overflow * SECP256K1_N_C_2);
+    r->d[2] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, r->d[3]);
+    r->d[3] = secp256k1_u128_to_u64(&t);
+
+    SECP256K1_SCALAR_VERIFY(r);
+    return overflow;
+}
+
+static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) {
+    int overflow;
+    secp256k1_uint128 t;
+    SECP256K1_SCALAR_VERIFY(a);
+    SECP256K1_SCALAR_VERIFY(b);
+
+    secp256k1_u128_from_u64(&t, a->d[0]);
+    secp256k1_u128_accum_u64(&t, b->d[0]);
+    r->d[0] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, a->d[1]);
+    secp256k1_u128_accum_u64(&t, b->d[1]);
+    r->d[1] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, a->d[2]);
+    secp256k1_u128_accum_u64(&t, b->d[2]);
+    r->d[2] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, a->d[3]);
+    secp256k1_u128_accum_u64(&t, b->d[3]);
+    r->d[3] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    overflow = secp256k1_u128_to_u64(&t) + secp256k1_scalar_check_overflow(r);
+    VERIFY_CHECK(overflow == 0 || overflow == 1);
+    secp256k1_scalar_reduce(r, overflow);
+
+    SECP256K1_SCALAR_VERIFY(r);
+    return overflow;
+}
+
+static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag) {
+    secp256k1_uint128 t;
+    volatile int vflag = flag;
+    SECP256K1_SCALAR_VERIFY(r);
+    VERIFY_CHECK(bit < 256);
+
+    bit += ((uint32_t) vflag - 1) & 0x100;  /* forcing (bit >> 6) > 3 makes this a noop */
+    secp256k1_u128_from_u64(&t, r->d[0]);
+    secp256k1_u128_accum_u64(&t, ((uint64_t)((bit >> 6) == 0)) << (bit & 0x3F));
+    r->d[0] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, r->d[1]);
+    secp256k1_u128_accum_u64(&t, ((uint64_t)((bit >> 6) == 1)) << (bit & 0x3F));
+    r->d[1] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, r->d[2]);
+    secp256k1_u128_accum_u64(&t, ((uint64_t)((bit >> 6) == 2)) << (bit & 0x3F));
+    r->d[2] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, r->d[3]);
+    secp256k1_u128_accum_u64(&t, ((uint64_t)((bit >> 6) == 3)) << (bit & 0x3F));
+    r->d[3] = secp256k1_u128_to_u64(&t);
+
+    SECP256K1_SCALAR_VERIFY(r);
+    VERIFY_CHECK(secp256k1_u128_hi_u64(&t) == 0);
+}
+
+static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *b32, int *overflow) {
+    int over;
+    r->d[0] = secp256k1_read_be64(&b32[24]);
+    r->d[1] = secp256k1_read_be64(&b32[16]);
+    r->d[2] = secp256k1_read_be64(&b32[8]);
+    r->d[3] = secp256k1_read_be64(&b32[0]);
+    over = secp256k1_scalar_reduce(r, secp256k1_scalar_check_overflow(r));
+    if (overflow) {
+        *overflow = over;
+    }
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a) {
+    SECP256K1_SCALAR_VERIFY(a);
+
+    secp256k1_write_be64(&bin[0],  a->d[3]);
+    secp256k1_write_be64(&bin[8],  a->d[2]);
+    secp256k1_write_be64(&bin[16], a->d[1]);
+    secp256k1_write_be64(&bin[24], a->d[0]);
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_is_zero(const secp256k1_scalar *a) {
+    SECP256K1_SCALAR_VERIFY(a);
+
+    return (a->d[0] | a->d[1] | a->d[2] | a->d[3]) == 0;
+}
+
+static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a) {
+    uint64_t nonzero = 0xFFFFFFFFFFFFFFFFULL * (secp256k1_scalar_is_zero(a) == 0);
+    secp256k1_uint128 t;
+    SECP256K1_SCALAR_VERIFY(a);
+
+    secp256k1_u128_from_u64(&t, ~a->d[0]);
+    secp256k1_u128_accum_u64(&t, SECP256K1_N_0 + 1);
+    r->d[0] = secp256k1_u128_to_u64(&t) & nonzero; secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, ~a->d[1]);
+    secp256k1_u128_accum_u64(&t, SECP256K1_N_1);
+    r->d[1] = secp256k1_u128_to_u64(&t) & nonzero; secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, ~a->d[2]);
+    secp256k1_u128_accum_u64(&t, SECP256K1_N_2);
+    r->d[2] = secp256k1_u128_to_u64(&t) & nonzero; secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, ~a->d[3]);
+    secp256k1_u128_accum_u64(&t, SECP256K1_N_3);
+    r->d[3] = secp256k1_u128_to_u64(&t) & nonzero;
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static void secp256k1_scalar_half(secp256k1_scalar *r, const secp256k1_scalar *a) {
+    /* Writing `/` for field division and `//` for integer division, we compute
+     *
+     *   a/2 = (a - (a&1))/2 + (a&1)/2
+     *       = (a >> 1) + (a&1 ?    1/2 : 0)
+     *       = (a >> 1) + (a&1 ? n//2+1 : 0),
+     *
+     * where n is the group order and in the last equality we have used 1/2 = n//2+1 (mod n).
+     * For n//2, we have the constants SECP256K1_N_H_0, ...
+     *
+     * This sum does not overflow. The most extreme case is a = -2, the largest odd scalar. Here:
+     * - the left summand is:  a >> 1 = (a - a&1)/2 = (n-2-1)//2           = (n-3)//2
+     * - the right summand is: a&1 ? n//2+1 : 0 = n//2+1 = (n-1)//2 + 2//2 = (n+1)//2
+     * Together they sum to (n-3)//2 + (n+1)//2 = (2n-2)//2 = n - 1, which is less than n.
+     */
+    uint64_t mask = -(uint64_t)(a->d[0] & 1U);
+    secp256k1_uint128 t;
+    SECP256K1_SCALAR_VERIFY(a);
+
+    secp256k1_u128_from_u64(&t, (a->d[0] >> 1) | (a->d[1] << 63));
+    secp256k1_u128_accum_u64(&t, (SECP256K1_N_H_0 + 1U) & mask);
+    r->d[0] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, (a->d[1] >> 1) | (a->d[2] << 63));
+    secp256k1_u128_accum_u64(&t, SECP256K1_N_H_1 & mask);
+    r->d[1] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, (a->d[2] >> 1) | (a->d[3] << 63));
+    secp256k1_u128_accum_u64(&t, SECP256K1_N_H_2 & mask);
+    r->d[2] = secp256k1_u128_to_u64(&t); secp256k1_u128_rshift(&t, 64);
+    r->d[3] = secp256k1_u128_to_u64(&t) + (a->d[3] >> 1) + (SECP256K1_N_H_3 & mask);
+#ifdef VERIFY
+    /* The line above only computed the bottom 64 bits of r->d[3]; redo the computation
+     * in full 128 bits to make sure the top 64 bits are indeed zero. */
+    secp256k1_u128_accum_u64(&t, a->d[3] >> 1);
+    secp256k1_u128_accum_u64(&t, SECP256K1_N_H_3 & mask);
+    secp256k1_u128_rshift(&t, 64);
+    VERIFY_CHECK(secp256k1_u128_to_u64(&t) == 0);
+
+    SECP256K1_SCALAR_VERIFY(r);
+#endif
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_is_one(const secp256k1_scalar *a) {
+    SECP256K1_SCALAR_VERIFY(a);
+
+    return ((a->d[0] ^ 1) | a->d[1] | a->d[2] | a->d[3]) == 0;
+}
+
+static int secp256k1_scalar_is_high(const secp256k1_scalar *a) {
+    int yes = 0;
+    int no = 0;
+    SECP256K1_SCALAR_VERIFY(a);
+
+    no |= (a->d[3] < SECP256K1_N_H_3);
+    yes |= (a->d[3] > SECP256K1_N_H_3) & ~no;
+    no |= (a->d[2] < SECP256K1_N_H_2) & ~yes; /* No need for a > check. */
+    no |= (a->d[1] < SECP256K1_N_H_1) & ~yes;
+    yes |= (a->d[1] > SECP256K1_N_H_1) & ~no;
+    yes |= (a->d[0] > SECP256K1_N_H_0) & ~no;
+    return yes;
+}
+
+static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) {
+    /* If we are flag = 0, mask = 00...00 and this is a no-op;
+     * if we are flag = 1, mask = 11...11 and this is identical to secp256k1_scalar_negate */
+    volatile int vflag = flag;
+    uint64_t mask = -vflag;
+    uint64_t nonzero = (secp256k1_scalar_is_zero(r) != 0) - 1;
+    secp256k1_uint128 t;
+    SECP256K1_SCALAR_VERIFY(r);
+
+    secp256k1_u128_from_u64(&t, r->d[0] ^ mask);
+    secp256k1_u128_accum_u64(&t, (SECP256K1_N_0 + 1) & mask);
+    r->d[0] = secp256k1_u128_to_u64(&t) & nonzero; secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, r->d[1] ^ mask);
+    secp256k1_u128_accum_u64(&t, SECP256K1_N_1 & mask);
+    r->d[1] = secp256k1_u128_to_u64(&t) & nonzero; secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, r->d[2] ^ mask);
+    secp256k1_u128_accum_u64(&t, SECP256K1_N_2 & mask);
+    r->d[2] = secp256k1_u128_to_u64(&t) & nonzero; secp256k1_u128_rshift(&t, 64);
+    secp256k1_u128_accum_u64(&t, r->d[3] ^ mask);
+    secp256k1_u128_accum_u64(&t, SECP256K1_N_3 & mask);
+    r->d[3] = secp256k1_u128_to_u64(&t) & nonzero;
+
+    SECP256K1_SCALAR_VERIFY(r);
+    return 2 * (mask == 0) - 1;
+}
+
+/* Inspired by the macros in OpenSSL's crypto/bn/asm/x86_64-gcc.c. */
+
+/** Add a*b to the number defined by (c0,c1,c2). c2 must never overflow. */
+#define muladd(a,b) { \
+    uint64_t tl, th; \
+    { \
+        secp256k1_uint128 t; \
+        secp256k1_u128_mul(&t, a, b); \
+        th = secp256k1_u128_hi_u64(&t);  /* at most 0xFFFFFFFFFFFFFFFE */ \
+        tl = secp256k1_u128_to_u64(&t); \
+    } \
+    c0 += tl;                 /* overflow is handled on the next line */ \
+    th += (c0 < tl);          /* at most 0xFFFFFFFFFFFFFFFF */ \
+    c1 += th;                 /* overflow is handled on the next line */ \
+    c2 += (c1 < th);          /* never overflows by contract (verified in the next line) */ \
+    VERIFY_CHECK((c1 >= th) || (c2 != 0)); \
+}
+
+/** Add a*b to the number defined by (c0,c1). c1 must never overflow. */
+#define muladd_fast(a,b) { \
+    uint64_t tl, th; \
+    { \
+        secp256k1_uint128 t; \
+        secp256k1_u128_mul(&t, a, b); \
+        th = secp256k1_u128_hi_u64(&t);  /* at most 0xFFFFFFFFFFFFFFFE */ \
+        tl = secp256k1_u128_to_u64(&t); \
+    } \
+    c0 += tl;                 /* overflow is handled on the next line */ \
+    th += (c0 < tl);          /* at most 0xFFFFFFFFFFFFFFFF */ \
+    c1 += th;                 /* never overflows by contract (verified in the next line) */ \
+    VERIFY_CHECK(c1 >= th); \
+}
+
+/** Add a to the number defined by (c0,c1,c2). c2 must never overflow. */
+#define sumadd(a) { \
+    unsigned int over; \
+    c0 += (a);                  /* overflow is handled on the next line */ \
+    over = (c0 < (a));         \
+    c1 += over;                 /* overflow is handled on the next line */ \
+    c2 += (c1 < over);          /* never overflows by contract */ \
+}
+
+/** Add a to the number defined by (c0,c1). c1 must never overflow, c2 must be zero. */
+#define sumadd_fast(a) { \
+    c0 += (a);                 /* overflow is handled on the next line */ \
+    c1 += (c0 < (a));          /* never overflows by contract (verified the next line) */ \
+    VERIFY_CHECK((c1 != 0) | (c0 >= (a))); \
+    VERIFY_CHECK(c2 == 0); \
+}
+
+/** Extract the lowest 64 bits of (c0,c1,c2) into n, and left shift the number 64 bits. */
+#define extract(n) { \
+    (n) = c0; \
+    c0 = c1; \
+    c1 = c2; \
+    c2 = 0; \
+}
+
+/** Extract the lowest 64 bits of (c0,c1,c2) into n, and left shift the number 64 bits. c2 is required to be zero. */
+#define extract_fast(n) { \
+    (n) = c0; \
+    c0 = c1; \
+    c1 = 0; \
+    VERIFY_CHECK(c2 == 0); \
+}
+
+static void secp256k1_scalar_reduce_512(secp256k1_scalar *r, const uint64_t *l) {
+#ifdef USE_ASM_X86_64
+    /* Reduce 512 bits into 385. */
+    uint64_t m0, m1, m2, m3, m4, m5, m6;
+    uint64_t p0, p1, p2, p3, p4;
+    uint64_t c;
+
+    __asm__ __volatile__(
+    /* Preload. */
+    "movq 32(%%rsi), %%r11\n"
+    "movq 40(%%rsi), %%r12\n"
+    "movq 48(%%rsi), %%r13\n"
+    "movq 56(%%rsi), %%r14\n"
+    /* Initialize r8,r9,r10 */
+    "movq 0(%%rsi), %%r8\n"
+    "xorq %%r9, %%r9\n"
+    "xorq %%r10, %%r10\n"
+    /* (r8,r9) += n0 * c0 */
+    "movq %8, %%rax\n"
+    "mulq %%r11\n"
+    "addq %%rax, %%r8\n"
+    "adcq %%rdx, %%r9\n"
+    /* extract m0 */
+    "movq %%r8, %q0\n"
+    "xorq %%r8, %%r8\n"
+    /* (r9,r10) += l1 */
+    "addq 8(%%rsi), %%r9\n"
+    "adcq $0, %%r10\n"
+    /* (r9,r10,r8) += n1 * c0 */
+    "movq %8, %%rax\n"
+    "mulq %%r12\n"
+    "addq %%rax, %%r9\n"
+    "adcq %%rdx, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* (r9,r10,r8) += n0 * c1 */
+    "movq %9, %%rax\n"
+    "mulq %%r11\n"
+    "addq %%rax, %%r9\n"
+    "adcq %%rdx, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* extract m1 */
+    "movq %%r9, %q1\n"
+    "xorq %%r9, %%r9\n"
+    /* (r10,r8,r9) += l2 */
+    "addq 16(%%rsi), %%r10\n"
+    "adcq $0, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* (r10,r8,r9) += n2 * c0 */
+    "movq %8, %%rax\n"
+    "mulq %%r13\n"
+    "addq %%rax, %%r10\n"
+    "adcq %%rdx, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* (r10,r8,r9) += n1 * c1 */
+    "movq %9, %%rax\n"
+    "mulq %%r12\n"
+    "addq %%rax, %%r10\n"
+    "adcq %%rdx, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* (r10,r8,r9) += n0 */
+    "addq %%r11, %%r10\n"
+    "adcq $0, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* extract m2 */
+    "movq %%r10, %q2\n"
+    "xorq %%r10, %%r10\n"
+    /* (r8,r9,r10) += l3 */
+    "addq 24(%%rsi), %%r8\n"
+    "adcq $0, %%r9\n"
+    "adcq $0, %%r10\n"
+    /* (r8,r9,r10) += n3 * c0 */
+    "movq %8, %%rax\n"
+    "mulq %%r14\n"
+    "addq %%rax, %%r8\n"
+    "adcq %%rdx, %%r9\n"
+    "adcq $0, %%r10\n"
+    /* (r8,r9,r10) += n2 * c1 */
+    "movq %9, %%rax\n"
+    "mulq %%r13\n"
+    "addq %%rax, %%r8\n"
+    "adcq %%rdx, %%r9\n"
+    "adcq $0, %%r10\n"
+    /* (r8,r9,r10) += n1 */
+    "addq %%r12, %%r8\n"
+    "adcq $0, %%r9\n"
+    "adcq $0, %%r10\n"
+    /* extract m3 */
+    "movq %%r8, %q3\n"
+    "xorq %%r8, %%r8\n"
+    /* (r9,r10,r8) += n3 * c1 */
+    "movq %9, %%rax\n"
+    "mulq %%r14\n"
+    "addq %%rax, %%r9\n"
+    "adcq %%rdx, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* (r9,r10,r8) += n2 */
+    "addq %%r13, %%r9\n"
+    "adcq $0, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* extract m4 */
+    "movq %%r9, %q4\n"
+    /* (r10,r8) += n3 */
+    "addq %%r14, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* extract m5 */
+    "movq %%r10, %q5\n"
+    /* extract m6 */
+    "movq %%r8, %q6\n"
+    : "=&g"(m0), "=&g"(m1), "=&g"(m2), "=g"(m3), "=g"(m4), "=g"(m5), "=g"(m6)
+    : "S"(l), "i"(SECP256K1_N_C_0), "i"(SECP256K1_N_C_1)
+    : "rax", "rdx", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "cc");
+
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&m0, sizeof(m0));
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&m1, sizeof(m1));
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&m2, sizeof(m2));
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&m3, sizeof(m3));
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&m4, sizeof(m4));
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&m5, sizeof(m5));
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&m6, sizeof(m6));
+
+    /* Reduce 385 bits into 258. */
+    __asm__ __volatile__(
+    /* Preload */
+    "movq %q9, %%r11\n"
+    "movq %q10, %%r12\n"
+    "movq %q11, %%r13\n"
+    /* Initialize (r8,r9,r10) */
+    "movq %q5, %%r8\n"
+    "xorq %%r9, %%r9\n"
+    "xorq %%r10, %%r10\n"
+    /* (r8,r9) += m4 * c0 */
+    "movq %12, %%rax\n"
+    "mulq %%r11\n"
+    "addq %%rax, %%r8\n"
+    "adcq %%rdx, %%r9\n"
+    /* extract p0 */
+    "movq %%r8, %q0\n"
+    "xorq %%r8, %%r8\n"
+    /* (r9,r10) += m1 */
+    "addq %q6, %%r9\n"
+    "adcq $0, %%r10\n"
+    /* (r9,r10,r8) += m5 * c0 */
+    "movq %12, %%rax\n"
+    "mulq %%r12\n"
+    "addq %%rax, %%r9\n"
+    "adcq %%rdx, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* (r9,r10,r8) += m4 * c1 */
+    "movq %13, %%rax\n"
+    "mulq %%r11\n"
+    "addq %%rax, %%r9\n"
+    "adcq %%rdx, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* extract p1 */
+    "movq %%r9, %q1\n"
+    "xorq %%r9, %%r9\n"
+    /* (r10,r8,r9) += m2 */
+    "addq %q7, %%r10\n"
+    "adcq $0, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* (r10,r8,r9) += m6 * c0 */
+    "movq %12, %%rax\n"
+    "mulq %%r13\n"
+    "addq %%rax, %%r10\n"
+    "adcq %%rdx, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* (r10,r8,r9) += m5 * c1 */
+    "movq %13, %%rax\n"
+    "mulq %%r12\n"
+    "addq %%rax, %%r10\n"
+    "adcq %%rdx, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* (r10,r8,r9) += m4 */
+    "addq %%r11, %%r10\n"
+    "adcq $0, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* extract p2 */
+    "movq %%r10, %q2\n"
+    /* (r8,r9) += m3 */
+    "addq %q8, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* (r8,r9) += m6 * c1 */
+    "movq %13, %%rax\n"
+    "mulq %%r13\n"
+    "addq %%rax, %%r8\n"
+    "adcq %%rdx, %%r9\n"
+    /* (r8,r9) += m5 */
+    "addq %%r12, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* extract p3 */
+    "movq %%r8, %q3\n"
+    /* (r9) += m6 */
+    "addq %%r13, %%r9\n"
+    /* extract p4 */
+    "movq %%r9, %q4\n"
+    : "=&g"(p0), "=&g"(p1), "=&g"(p2), "=g"(p3), "=g"(p4)
+    : "g"(m0), "g"(m1), "g"(m2), "g"(m3), "g"(m4), "g"(m5), "g"(m6), "i"(SECP256K1_N_C_0), "i"(SECP256K1_N_C_1)
+    : "rax", "rdx", "r8", "r9", "r10", "r11", "r12", "r13", "cc");
+
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&p0, sizeof(p0));
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&p1, sizeof(p1));
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&p2, sizeof(p2));
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&p3, sizeof(p3));
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&p4, sizeof(p4));
+
+    /* Reduce 258 bits into 256. */
+    __asm__ __volatile__(
+    /* Preload */
+    "movq %q5, %%r10\n"
+    /* (rax,rdx) = p4 * c0 */
+    "movq %7, %%rax\n"
+    "mulq %%r10\n"
+    /* (rax,rdx) += p0 */
+    "addq %q1, %%rax\n"
+    "adcq $0, %%rdx\n"
+    /* extract r0 */
+    "movq %%rax, 0(%q6)\n"
+    /* Move to (r8,r9) */
+    "movq %%rdx, %%r8\n"
+    "xorq %%r9, %%r9\n"
+    /* (r8,r9) += p1 */
+    "addq %q2, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* (r8,r9) += p4 * c1 */
+    "movq %8, %%rax\n"
+    "mulq %%r10\n"
+    "addq %%rax, %%r8\n"
+    "adcq %%rdx, %%r9\n"
+    /* Extract r1 */
+    "movq %%r8, 8(%q6)\n"
+    "xorq %%r8, %%r8\n"
+    /* (r9,r8) += p4 */
+    "addq %%r10, %%r9\n"
+    "adcq $0, %%r8\n"
+    /* (r9,r8) += p2 */
+    "addq %q3, %%r9\n"
+    "adcq $0, %%r8\n"
+    /* Extract r2 */
+    "movq %%r9, 16(%q6)\n"
+    "xorq %%r9, %%r9\n"
+    /* (r8,r9) += p3 */
+    "addq %q4, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* Extract r3 */
+    "movq %%r8, 24(%q6)\n"
+    /* Extract c */
+    "movq %%r9, %q0\n"
+    : "=g"(c)
+    : "g"(p0), "g"(p1), "g"(p2), "g"(p3), "g"(p4), "D"(r), "i"(SECP256K1_N_C_0), "i"(SECP256K1_N_C_1)
+    : "rax", "rdx", "r8", "r9", "r10", "cc", "memory");
+
+    SECP256K1_CHECKMEM_MSAN_DEFINE(r, sizeof(*r));
+    SECP256K1_CHECKMEM_MSAN_DEFINE(&c, sizeof(c));
+
+#else
+    secp256k1_uint128 c128;
+    uint64_t c, c0, c1, c2;
+    uint64_t n0 = l[4], n1 = l[5], n2 = l[6], n3 = l[7];
+    uint64_t m0, m1, m2, m3, m4, m5;
+    uint32_t m6;
+    uint64_t p0, p1, p2, p3;
+    uint32_t p4;
+
+    /* Reduce 512 bits into 385. */
+    /* m[0..6] = l[0..3] + n[0..3] * SECP256K1_N_C. */
+    c0 = l[0]; c1 = 0; c2 = 0;
+    muladd_fast(n0, SECP256K1_N_C_0);
+    extract_fast(m0);
+    sumadd_fast(l[1]);
+    muladd(n1, SECP256K1_N_C_0);
+    muladd(n0, SECP256K1_N_C_1);
+    extract(m1);
+    sumadd(l[2]);
+    muladd(n2, SECP256K1_N_C_0);
+    muladd(n1, SECP256K1_N_C_1);
+    sumadd(n0);
+    extract(m2);
+    sumadd(l[3]);
+    muladd(n3, SECP256K1_N_C_0);
+    muladd(n2, SECP256K1_N_C_1);
+    sumadd(n1);
+    extract(m3);
+    muladd(n3, SECP256K1_N_C_1);
+    sumadd(n2);
+    extract(m4);
+    sumadd_fast(n3);
+    extract_fast(m5);
+    VERIFY_CHECK(c0 <= 1);
+    m6 = c0;
+
+    /* Reduce 385 bits into 258. */
+    /* p[0..4] = m[0..3] + m[4..6] * SECP256K1_N_C. */
+    c0 = m0; c1 = 0; c2 = 0;
+    muladd_fast(m4, SECP256K1_N_C_0);
+    extract_fast(p0);
+    sumadd_fast(m1);
+    muladd(m5, SECP256K1_N_C_0);
+    muladd(m4, SECP256K1_N_C_1);
+    extract(p1);
+    sumadd(m2);
+    muladd(m6, SECP256K1_N_C_0);
+    muladd(m5, SECP256K1_N_C_1);
+    sumadd(m4);
+    extract(p2);
+    sumadd_fast(m3);
+    muladd_fast(m6, SECP256K1_N_C_1);
+    sumadd_fast(m5);
+    extract_fast(p3);
+    p4 = c0 + m6;
+    VERIFY_CHECK(p4 <= 2);
+
+    /* Reduce 258 bits into 256. */
+    /* r[0..3] = p[0..3] + p[4] * SECP256K1_N_C. */
+    secp256k1_u128_from_u64(&c128, p0);
+    secp256k1_u128_accum_mul(&c128, SECP256K1_N_C_0, p4);
+    r->d[0] = secp256k1_u128_to_u64(&c128); secp256k1_u128_rshift(&c128, 64);
+    secp256k1_u128_accum_u64(&c128, p1);
+    secp256k1_u128_accum_mul(&c128, SECP256K1_N_C_1, p4);
+    r->d[1] = secp256k1_u128_to_u64(&c128); secp256k1_u128_rshift(&c128, 64);
+    secp256k1_u128_accum_u64(&c128, p2);
+    secp256k1_u128_accum_u64(&c128, p4);
+    r->d[2] = secp256k1_u128_to_u64(&c128); secp256k1_u128_rshift(&c128, 64);
+    secp256k1_u128_accum_u64(&c128, p3);
+    r->d[3] = secp256k1_u128_to_u64(&c128);
+    c = secp256k1_u128_hi_u64(&c128);
+#endif
+
+    /* Final reduction of r. */
+    secp256k1_scalar_reduce(r, c + secp256k1_scalar_check_overflow(r));
+}
+
+static void secp256k1_scalar_mul_512(uint64_t *l8, const secp256k1_scalar *a, const secp256k1_scalar *b) {
+#ifdef USE_ASM_X86_64
+    const uint64_t *pb = b->d;
+    __asm__ __volatile__(
+    /* Preload */
+    "movq 0(%%rdi), %%r15\n"
+    "movq 8(%%rdi), %%rbx\n"
+    "movq 16(%%rdi), %%rcx\n"
+    "movq 0(%%rdx), %%r11\n"
+    "movq 8(%%rdx), %%r12\n"
+    "movq 16(%%rdx), %%r13\n"
+    "movq 24(%%rdx), %%r14\n"
+    /* (rax,rdx) = a0 * b0 */
+    "movq %%r15, %%rax\n"
+    "mulq %%r11\n"
+    /* Extract l8[0] */
+    "movq %%rax, 0(%%rsi)\n"
+    /* (r8,r9,r10) = (rdx) */
+    "movq %%rdx, %%r8\n"
+    "xorq %%r9, %%r9\n"
+    "xorq %%r10, %%r10\n"
+    /* (r8,r9,r10) += a0 * b1 */
+    "movq %%r15, %%rax\n"
+    "mulq %%r12\n"
+    "addq %%rax, %%r8\n"
+    "adcq %%rdx, %%r9\n"
+    "adcq $0, %%r10\n"
+    /* (r8,r9,r10) += a1 * b0 */
+    "movq %%rbx, %%rax\n"
+    "mulq %%r11\n"
+    "addq %%rax, %%r8\n"
+    "adcq %%rdx, %%r9\n"
+    "adcq $0, %%r10\n"
+    /* Extract l8[1] */
+    "movq %%r8, 8(%%rsi)\n"
+    "xorq %%r8, %%r8\n"
+    /* (r9,r10,r8) += a0 * b2 */
+    "movq %%r15, %%rax\n"
+    "mulq %%r13\n"
+    "addq %%rax, %%r9\n"
+    "adcq %%rdx, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* (r9,r10,r8) += a1 * b1 */
+    "movq %%rbx, %%rax\n"
+    "mulq %%r12\n"
+    "addq %%rax, %%r9\n"
+    "adcq %%rdx, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* (r9,r10,r8) += a2 * b0 */
+    "movq %%rcx, %%rax\n"
+    "mulq %%r11\n"
+    "addq %%rax, %%r9\n"
+    "adcq %%rdx, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* Extract l8[2] */
+    "movq %%r9, 16(%%rsi)\n"
+    "xorq %%r9, %%r9\n"
+    /* (r10,r8,r9) += a0 * b3 */
+    "movq %%r15, %%rax\n"
+    "mulq %%r14\n"
+    "addq %%rax, %%r10\n"
+    "adcq %%rdx, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* Preload a3 */
+    "movq 24(%%rdi), %%r15\n"
+    /* (r10,r8,r9) += a1 * b2 */
+    "movq %%rbx, %%rax\n"
+    "mulq %%r13\n"
+    "addq %%rax, %%r10\n"
+    "adcq %%rdx, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* (r10,r8,r9) += a2 * b1 */
+    "movq %%rcx, %%rax\n"
+    "mulq %%r12\n"
+    "addq %%rax, %%r10\n"
+    "adcq %%rdx, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* (r10,r8,r9) += a3 * b0 */
+    "movq %%r15, %%rax\n"
+    "mulq %%r11\n"
+    "addq %%rax, %%r10\n"
+    "adcq %%rdx, %%r8\n"
+    "adcq $0, %%r9\n"
+    /* Extract l8[3] */
+    "movq %%r10, 24(%%rsi)\n"
+    "xorq %%r10, %%r10\n"
+    /* (r8,r9,r10) += a1 * b3 */
+    "movq %%rbx, %%rax\n"
+    "mulq %%r14\n"
+    "addq %%rax, %%r8\n"
+    "adcq %%rdx, %%r9\n"
+    "adcq $0, %%r10\n"
+    /* (r8,r9,r10) += a2 * b2 */
+    "movq %%rcx, %%rax\n"
+    "mulq %%r13\n"
+    "addq %%rax, %%r8\n"
+    "adcq %%rdx, %%r9\n"
+    "adcq $0, %%r10\n"
+    /* (r8,r9,r10) += a3 * b1 */
+    "movq %%r15, %%rax\n"
+    "mulq %%r12\n"
+    "addq %%rax, %%r8\n"
+    "adcq %%rdx, %%r9\n"
+    "adcq $0, %%r10\n"
+    /* Extract l8[4] */
+    "movq %%r8, 32(%%rsi)\n"
+    "xorq %%r8, %%r8\n"
+    /* (r9,r10,r8) += a2 * b3 */
+    "movq %%rcx, %%rax\n"
+    "mulq %%r14\n"
+    "addq %%rax, %%r9\n"
+    "adcq %%rdx, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* (r9,r10,r8) += a3 * b2 */
+    "movq %%r15, %%rax\n"
+    "mulq %%r13\n"
+    "addq %%rax, %%r9\n"
+    "adcq %%rdx, %%r10\n"
+    "adcq $0, %%r8\n"
+    /* Extract l8[5] */
+    "movq %%r9, 40(%%rsi)\n"
+    /* (r10,r8) += a3 * b3 */
+    "movq %%r15, %%rax\n"
+    "mulq %%r14\n"
+    "addq %%rax, %%r10\n"
+    "adcq %%rdx, %%r8\n"
+    /* Extract l8[6] */
+    "movq %%r10, 48(%%rsi)\n"
+    /* Extract l8[7] */
+    "movq %%r8, 56(%%rsi)\n"
+    : "+d"(pb)
+    : "S"(l8), "D"(a->d)
+    : "rax", "rbx", "rcx", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "cc", "memory");
+
+    SECP256K1_CHECKMEM_MSAN_DEFINE(l8, sizeof(*l8) * 8);
+
+#else
+    /* 160 bit accumulator. */
+    uint64_t c0 = 0, c1 = 0;
+    uint32_t c2 = 0;
+
+    /* l8[0..7] = a[0..3] * b[0..3]. */
+    muladd_fast(a->d[0], b->d[0]);
+    extract_fast(l8[0]);
+    muladd(a->d[0], b->d[1]);
+    muladd(a->d[1], b->d[0]);
+    extract(l8[1]);
+    muladd(a->d[0], b->d[2]);
+    muladd(a->d[1], b->d[1]);
+    muladd(a->d[2], b->d[0]);
+    extract(l8[2]);
+    muladd(a->d[0], b->d[3]);
+    muladd(a->d[1], b->d[2]);
+    muladd(a->d[2], b->d[1]);
+    muladd(a->d[3], b->d[0]);
+    extract(l8[3]);
+    muladd(a->d[1], b->d[3]);
+    muladd(a->d[2], b->d[2]);
+    muladd(a->d[3], b->d[1]);
+    extract(l8[4]);
+    muladd(a->d[2], b->d[3]);
+    muladd(a->d[3], b->d[2]);
+    extract(l8[5]);
+    muladd_fast(a->d[3], b->d[3]);
+    extract_fast(l8[6]);
+    VERIFY_CHECK(c1 == 0);
+    l8[7] = c0;
+#endif
+}
+
+#undef sumadd
+#undef sumadd_fast
+#undef muladd
+#undef muladd_fast
+#undef extract
+#undef extract_fast
+
+static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) {
+    uint64_t l[8];
+    SECP256K1_SCALAR_VERIFY(a);
+    SECP256K1_SCALAR_VERIFY(b);
+
+    secp256k1_scalar_mul_512(l, a, b);
+    secp256k1_scalar_reduce_512(r, l);
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *k) {
+    SECP256K1_SCALAR_VERIFY(k);
+
+    r1->d[0] = k->d[0];
+    r1->d[1] = k->d[1];
+    r1->d[2] = 0;
+    r1->d[3] = 0;
+    r2->d[0] = k->d[2];
+    r2->d[1] = k->d[3];
+    r2->d[2] = 0;
+    r2->d[3] = 0;
+
+    SECP256K1_SCALAR_VERIFY(r1);
+    SECP256K1_SCALAR_VERIFY(r2);
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) {
+    SECP256K1_SCALAR_VERIFY(a);
+    SECP256K1_SCALAR_VERIFY(b);
+
+    return ((a->d[0] ^ b->d[0]) | (a->d[1] ^ b->d[1]) | (a->d[2] ^ b->d[2]) | (a->d[3] ^ b->d[3])) == 0;
+}
+
+SECP256K1_INLINE static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift) {
+    uint64_t l[8];
+    unsigned int shiftlimbs;
+    unsigned int shiftlow;
+    unsigned int shifthigh;
+    SECP256K1_SCALAR_VERIFY(a);
+    SECP256K1_SCALAR_VERIFY(b);
+    VERIFY_CHECK(shift >= 256);
+
+    secp256k1_scalar_mul_512(l, a, b);
+    shiftlimbs = shift >> 6;
+    shiftlow = shift & 0x3F;
+    shifthigh = 64 - shiftlow;
+    r->d[0] = shift < 512 ? (l[0 + shiftlimbs] >> shiftlow | (shift < 448 && shiftlow ? (l[1 + shiftlimbs] << shifthigh) : 0)) : 0;
+    r->d[1] = shift < 448 ? (l[1 + shiftlimbs] >> shiftlow | (shift < 384 && shiftlow ? (l[2 + shiftlimbs] << shifthigh) : 0)) : 0;
+    r->d[2] = shift < 384 ? (l[2 + shiftlimbs] >> shiftlow | (shift < 320 && shiftlow ? (l[3 + shiftlimbs] << shifthigh) : 0)) : 0;
+    r->d[3] = shift < 320 ? (l[3 + shiftlimbs] >> shiftlow) : 0;
+    secp256k1_scalar_cadd_bit(r, 0, (l[(shift - 1) >> 6] >> ((shift - 1) & 0x3f)) & 1);
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static SECP256K1_INLINE void secp256k1_scalar_cmov(secp256k1_scalar *r, const secp256k1_scalar *a, int flag) {
+    uint64_t mask0, mask1;
+    volatile int vflag = flag;
+    SECP256K1_SCALAR_VERIFY(a);
+    SECP256K1_CHECKMEM_CHECK_VERIFY(r->d, sizeof(r->d));
+
+    mask0 = vflag + ~((uint64_t)0);
+    mask1 = ~mask0;
+    r->d[0] = (r->d[0] & mask0) | (a->d[0] & mask1);
+    r->d[1] = (r->d[1] & mask0) | (a->d[1] & mask1);
+    r->d[2] = (r->d[2] & mask0) | (a->d[2] & mask1);
+    r->d[3] = (r->d[3] & mask0) | (a->d[3] & mask1);
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static void secp256k1_scalar_from_signed62(secp256k1_scalar *r, const secp256k1_modinv64_signed62 *a) {
+    const uint64_t a0 = a->v[0], a1 = a->v[1], a2 = a->v[2], a3 = a->v[3], a4 = a->v[4];
+
+    /* The output from secp256k1_modinv64{_var} should be normalized to range [0,modulus), and
+     * have limbs in [0,2^62). The modulus is < 2^256, so the top limb must be below 2^(256-62*4).
+     */
+    VERIFY_CHECK(a0 >> 62 == 0);
+    VERIFY_CHECK(a1 >> 62 == 0);
+    VERIFY_CHECK(a2 >> 62 == 0);
+    VERIFY_CHECK(a3 >> 62 == 0);
+    VERIFY_CHECK(a4 >> 8 == 0);
+
+    r->d[0] = a0      | a1 << 62;
+    r->d[1] = a1 >> 2 | a2 << 60;
+    r->d[2] = a2 >> 4 | a3 << 58;
+    r->d[3] = a3 >> 6 | a4 << 56;
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static void secp256k1_scalar_to_signed62(secp256k1_modinv64_signed62 *r, const secp256k1_scalar *a) {
+    const uint64_t M62 = UINT64_MAX >> 2;
+    const uint64_t a0 = a->d[0], a1 = a->d[1], a2 = a->d[2], a3 = a->d[3];
+    SECP256K1_SCALAR_VERIFY(a);
+
+    r->v[0] =  a0                   & M62;
+    r->v[1] = (a0 >> 62 | a1 <<  2) & M62;
+    r->v[2] = (a1 >> 60 | a2 <<  4) & M62;
+    r->v[3] = (a2 >> 58 | a3 <<  6) & M62;
+    r->v[4] =  a3 >> 56;
+}
+
+static const secp256k1_modinv64_modinfo secp256k1_const_modinfo_scalar = {
+    {{0x3FD25E8CD0364141LL, 0x2ABB739ABD2280EELL, -0x15LL, 0, 256}},
+    0x34F20099AA774EC1LL
+};
+
+static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar *x) {
+    secp256k1_modinv64_signed62 s;
+#ifdef VERIFY
+    int zero_in = secp256k1_scalar_is_zero(x);
+#endif
+    SECP256K1_SCALAR_VERIFY(x);
+
+    secp256k1_scalar_to_signed62(&s, x);
+    secp256k1_modinv64(&s, &secp256k1_const_modinfo_scalar);
+    secp256k1_scalar_from_signed62(r, &s);
+
+    SECP256K1_SCALAR_VERIFY(r);
+    VERIFY_CHECK(secp256k1_scalar_is_zero(r) == zero_in);
+}
+
+static void secp256k1_scalar_inverse_var(secp256k1_scalar *r, const secp256k1_scalar *x) {
+    secp256k1_modinv64_signed62 s;
+#ifdef VERIFY
+    int zero_in = secp256k1_scalar_is_zero(x);
+#endif
+    SECP256K1_SCALAR_VERIFY(x);
+
+    secp256k1_scalar_to_signed62(&s, x);
+    secp256k1_modinv64_var(&s, &secp256k1_const_modinfo_scalar);
+    secp256k1_scalar_from_signed62(r, &s);
+
+    SECP256K1_SCALAR_VERIFY(r);
+    VERIFY_CHECK(secp256k1_scalar_is_zero(r) == zero_in);
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_is_even(const secp256k1_scalar *a) {
+    SECP256K1_SCALAR_VERIFY(a);
+
+    return !(a->d[0] & 1);
+}
+
+#endif /* SECP256K1_SCALAR_REPR_IMPL_H */
diff --git a/vendor/external/secp256k1/src/scalar_8x32.h b/vendor/external/secp256k1/src/scalar_8x32.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/scalar_8x32.h
@@ -0,0 +1,19 @@
+/***********************************************************************
+ * Copyright (c) 2014 Pieter Wuille                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_SCALAR_REPR_H
+#define SECP256K1_SCALAR_REPR_H
+
+#include <stdint.h>
+
+/** A scalar modulo the group order of the secp256k1 curve. */
+typedef struct {
+    uint32_t d[8];
+} secp256k1_scalar;
+
+#define SECP256K1_SCALAR_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)}}
+
+#endif /* SECP256K1_SCALAR_REPR_H */
diff --git a/vendor/external/secp256k1/src/scalar_8x32_impl.h b/vendor/external/secp256k1/src/scalar_8x32_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/scalar_8x32_impl.h
@@ -0,0 +1,816 @@
+/***********************************************************************
+ * Copyright (c) 2014 Pieter Wuille                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_SCALAR_REPR_IMPL_H
+#define SECP256K1_SCALAR_REPR_IMPL_H
+
+#include "checkmem.h"
+#include "modinv32_impl.h"
+#include "util.h"
+
+/* Limbs of the secp256k1 order. */
+#define SECP256K1_N_0 ((uint32_t)0xD0364141UL)
+#define SECP256K1_N_1 ((uint32_t)0xBFD25E8CUL)
+#define SECP256K1_N_2 ((uint32_t)0xAF48A03BUL)
+#define SECP256K1_N_3 ((uint32_t)0xBAAEDCE6UL)
+#define SECP256K1_N_4 ((uint32_t)0xFFFFFFFEUL)
+#define SECP256K1_N_5 ((uint32_t)0xFFFFFFFFUL)
+#define SECP256K1_N_6 ((uint32_t)0xFFFFFFFFUL)
+#define SECP256K1_N_7 ((uint32_t)0xFFFFFFFFUL)
+
+/* Limbs of 2^256 minus the secp256k1 order. */
+#define SECP256K1_N_C_0 (~SECP256K1_N_0 + 1)
+#define SECP256K1_N_C_1 (~SECP256K1_N_1)
+#define SECP256K1_N_C_2 (~SECP256K1_N_2)
+#define SECP256K1_N_C_3 (~SECP256K1_N_3)
+#define SECP256K1_N_C_4 (1)
+
+/* Limbs of half the secp256k1 order. */
+#define SECP256K1_N_H_0 ((uint32_t)0x681B20A0UL)
+#define SECP256K1_N_H_1 ((uint32_t)0xDFE92F46UL)
+#define SECP256K1_N_H_2 ((uint32_t)0x57A4501DUL)
+#define SECP256K1_N_H_3 ((uint32_t)0x5D576E73UL)
+#define SECP256K1_N_H_4 ((uint32_t)0xFFFFFFFFUL)
+#define SECP256K1_N_H_5 ((uint32_t)0xFFFFFFFFUL)
+#define SECP256K1_N_H_6 ((uint32_t)0xFFFFFFFFUL)
+#define SECP256K1_N_H_7 ((uint32_t)0x7FFFFFFFUL)
+
+SECP256K1_INLINE static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v) {
+    r->d[0] = v;
+    r->d[1] = 0;
+    r->d[2] = 0;
+    r->d[3] = 0;
+    r->d[4] = 0;
+    r->d[5] = 0;
+    r->d[6] = 0;
+    r->d[7] = 0;
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+SECP256K1_INLINE static uint32_t secp256k1_scalar_get_bits_limb32(const secp256k1_scalar *a, unsigned int offset, unsigned int count) {
+    SECP256K1_SCALAR_VERIFY(a);
+    VERIFY_CHECK(count > 0 && count <= 32);
+    VERIFY_CHECK((offset + count - 1) >> 5 == offset >> 5);
+
+    return (a->d[offset >> 5] >> (offset & 0x1F)) & (0xFFFFFFFF >> (32 - count));
+}
+
+SECP256K1_INLINE static uint32_t secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count) {
+    SECP256K1_SCALAR_VERIFY(a);
+    VERIFY_CHECK(count > 0 && count <= 32);
+    VERIFY_CHECK(offset + count <= 256);
+
+    if ((offset + count - 1) >> 5 == offset >> 5) {
+        return secp256k1_scalar_get_bits_limb32(a, offset, count);
+    } else {
+        VERIFY_CHECK((offset >> 5) + 1 < 8);
+        return ((a->d[offset >> 5] >> (offset & 0x1F)) | (a->d[(offset >> 5) + 1] << (32 - (offset & 0x1F)))) & (0xFFFFFFFF >> (32 - count));
+    }
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_check_overflow(const secp256k1_scalar *a) {
+    int yes = 0;
+    int no = 0;
+    no |= (a->d[7] < SECP256K1_N_7); /* No need for a > check. */
+    no |= (a->d[6] < SECP256K1_N_6); /* No need for a > check. */
+    no |= (a->d[5] < SECP256K1_N_5); /* No need for a > check. */
+    no |= (a->d[4] < SECP256K1_N_4);
+    yes |= (a->d[4] > SECP256K1_N_4) & ~no;
+    no |= (a->d[3] < SECP256K1_N_3) & ~yes;
+    yes |= (a->d[3] > SECP256K1_N_3) & ~no;
+    no |= (a->d[2] < SECP256K1_N_2) & ~yes;
+    yes |= (a->d[2] > SECP256K1_N_2) & ~no;
+    no |= (a->d[1] < SECP256K1_N_1) & ~yes;
+    yes |= (a->d[1] > SECP256K1_N_1) & ~no;
+    yes |= (a->d[0] >= SECP256K1_N_0) & ~no;
+    return yes;
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_reduce(secp256k1_scalar *r, uint32_t overflow) {
+    uint64_t t;
+    VERIFY_CHECK(overflow <= 1);
+
+    t = (uint64_t)r->d[0] + overflow * SECP256K1_N_C_0;
+    r->d[0] = t & 0xFFFFFFFFUL; t >>= 32;
+    t += (uint64_t)r->d[1] + overflow * SECP256K1_N_C_1;
+    r->d[1] = t & 0xFFFFFFFFUL; t >>= 32;
+    t += (uint64_t)r->d[2] + overflow * SECP256K1_N_C_2;
+    r->d[2] = t & 0xFFFFFFFFUL; t >>= 32;
+    t += (uint64_t)r->d[3] + overflow * SECP256K1_N_C_3;
+    r->d[3] = t & 0xFFFFFFFFUL; t >>= 32;
+    t += (uint64_t)r->d[4] + overflow * SECP256K1_N_C_4;
+    r->d[4] = t & 0xFFFFFFFFUL; t >>= 32;
+    t += (uint64_t)r->d[5];
+    r->d[5] = t & 0xFFFFFFFFUL; t >>= 32;
+    t += (uint64_t)r->d[6];
+    r->d[6] = t & 0xFFFFFFFFUL; t >>= 32;
+    t += (uint64_t)r->d[7];
+    r->d[7] = t & 0xFFFFFFFFUL;
+
+    SECP256K1_SCALAR_VERIFY(r);
+    return overflow;
+}
+
+static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) {
+    int overflow;
+    uint64_t t = (uint64_t)a->d[0] + b->d[0];
+    SECP256K1_SCALAR_VERIFY(a);
+    SECP256K1_SCALAR_VERIFY(b);
+
+    r->d[0] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)a->d[1] + b->d[1];
+    r->d[1] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)a->d[2] + b->d[2];
+    r->d[2] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)a->d[3] + b->d[3];
+    r->d[3] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)a->d[4] + b->d[4];
+    r->d[4] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)a->d[5] + b->d[5];
+    r->d[5] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)a->d[6] + b->d[6];
+    r->d[6] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)a->d[7] + b->d[7];
+    r->d[7] = t & 0xFFFFFFFFULL; t >>= 32;
+    overflow = t + secp256k1_scalar_check_overflow(r);
+    VERIFY_CHECK(overflow == 0 || overflow == 1);
+    secp256k1_scalar_reduce(r, overflow);
+
+    SECP256K1_SCALAR_VERIFY(r);
+    return overflow;
+}
+
+static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag) {
+    uint64_t t;
+    volatile int vflag = flag;
+    SECP256K1_SCALAR_VERIFY(r);
+    VERIFY_CHECK(bit < 256);
+
+    bit += ((uint32_t) vflag - 1) & 0x100;  /* forcing (bit >> 5) > 7 makes this a noop */
+    t = (uint64_t)r->d[0] + (((uint32_t)((bit >> 5) == 0)) << (bit & 0x1F));
+    r->d[0] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)r->d[1] + (((uint32_t)((bit >> 5) == 1)) << (bit & 0x1F));
+    r->d[1] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)r->d[2] + (((uint32_t)((bit >> 5) == 2)) << (bit & 0x1F));
+    r->d[2] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)r->d[3] + (((uint32_t)((bit >> 5) == 3)) << (bit & 0x1F));
+    r->d[3] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)r->d[4] + (((uint32_t)((bit >> 5) == 4)) << (bit & 0x1F));
+    r->d[4] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)r->d[5] + (((uint32_t)((bit >> 5) == 5)) << (bit & 0x1F));
+    r->d[5] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)r->d[6] + (((uint32_t)((bit >> 5) == 6)) << (bit & 0x1F));
+    r->d[6] = t & 0xFFFFFFFFULL; t >>= 32;
+    t += (uint64_t)r->d[7] + (((uint32_t)((bit >> 5) == 7)) << (bit & 0x1F));
+    r->d[7] = t & 0xFFFFFFFFULL;
+
+    SECP256K1_SCALAR_VERIFY(r);
+    VERIFY_CHECK((t >> 32) == 0);
+}
+
+static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *b32, int *overflow) {
+    int over;
+    r->d[0] = secp256k1_read_be32(&b32[28]);
+    r->d[1] = secp256k1_read_be32(&b32[24]);
+    r->d[2] = secp256k1_read_be32(&b32[20]);
+    r->d[3] = secp256k1_read_be32(&b32[16]);
+    r->d[4] = secp256k1_read_be32(&b32[12]);
+    r->d[5] = secp256k1_read_be32(&b32[8]);
+    r->d[6] = secp256k1_read_be32(&b32[4]);
+    r->d[7] = secp256k1_read_be32(&b32[0]);
+    over = secp256k1_scalar_reduce(r, secp256k1_scalar_check_overflow(r));
+    if (overflow) {
+        *overflow = over;
+    }
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a) {
+    SECP256K1_SCALAR_VERIFY(a);
+
+    secp256k1_write_be32(&bin[0], a->d[7]);
+    secp256k1_write_be32(&bin[4], a->d[6]);
+    secp256k1_write_be32(&bin[8], a->d[5]);
+    secp256k1_write_be32(&bin[12], a->d[4]);
+    secp256k1_write_be32(&bin[16], a->d[3]);
+    secp256k1_write_be32(&bin[20], a->d[2]);
+    secp256k1_write_be32(&bin[24], a->d[1]);
+    secp256k1_write_be32(&bin[28], a->d[0]);
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_is_zero(const secp256k1_scalar *a) {
+    SECP256K1_SCALAR_VERIFY(a);
+
+    return (a->d[0] | a->d[1] | a->d[2] | a->d[3] | a->d[4] | a->d[5] | a->d[6] | a->d[7]) == 0;
+}
+
+static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a) {
+    uint32_t nonzero = 0xFFFFFFFFUL * (secp256k1_scalar_is_zero(a) == 0);
+    uint64_t t = (uint64_t)(~a->d[0]) + SECP256K1_N_0 + 1;
+    SECP256K1_SCALAR_VERIFY(a);
+
+    r->d[0] = t & nonzero; t >>= 32;
+    t += (uint64_t)(~a->d[1]) + SECP256K1_N_1;
+    r->d[1] = t & nonzero; t >>= 32;
+    t += (uint64_t)(~a->d[2]) + SECP256K1_N_2;
+    r->d[2] = t & nonzero; t >>= 32;
+    t += (uint64_t)(~a->d[3]) + SECP256K1_N_3;
+    r->d[3] = t & nonzero; t >>= 32;
+    t += (uint64_t)(~a->d[4]) + SECP256K1_N_4;
+    r->d[4] = t & nonzero; t >>= 32;
+    t += (uint64_t)(~a->d[5]) + SECP256K1_N_5;
+    r->d[5] = t & nonzero; t >>= 32;
+    t += (uint64_t)(~a->d[6]) + SECP256K1_N_6;
+    r->d[6] = t & nonzero; t >>= 32;
+    t += (uint64_t)(~a->d[7]) + SECP256K1_N_7;
+    r->d[7] = t & nonzero;
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static void secp256k1_scalar_half(secp256k1_scalar *r, const secp256k1_scalar *a) {
+    /* Writing `/` for field division and `//` for integer division, we compute
+     *
+     *   a/2 = (a - (a&1))/2 + (a&1)/2
+     *       = (a >> 1) + (a&1 ?    1/2 : 0)
+     *       = (a >> 1) + (a&1 ? n//2+1 : 0),
+     *
+     * where n is the group order and in the last equality we have used 1/2 = n//2+1 (mod n).
+     * For n//2, we have the constants SECP256K1_N_H_0, ...
+     *
+     * This sum does not overflow. The most extreme case is a = -2, the largest odd scalar. Here:
+     * - the left summand is:  a >> 1 = (a - a&1)/2 = (n-2-1)//2           = (n-3)//2
+     * - the right summand is: a&1 ? n//2+1 : 0 = n//2+1 = (n-1)//2 + 2//2 = (n+1)//2
+     * Together they sum to (n-3)//2 + (n+1)//2 = (2n-2)//2 = n - 1, which is less than n.
+     */
+    uint32_t mask = -(uint32_t)(a->d[0] & 1U);
+    uint64_t t = (uint32_t)((a->d[0] >> 1) | (a->d[1] << 31));
+    SECP256K1_SCALAR_VERIFY(a);
+
+    t += (SECP256K1_N_H_0 + 1U) & mask;
+    r->d[0] = t; t >>= 32;
+    t += (uint32_t)((a->d[1] >> 1) | (a->d[2] << 31));
+    t += SECP256K1_N_H_1 & mask;
+    r->d[1] = t; t >>= 32;
+    t += (uint32_t)((a->d[2] >> 1) | (a->d[3] << 31));
+    t += SECP256K1_N_H_2 & mask;
+    r->d[2] = t; t >>= 32;
+    t += (uint32_t)((a->d[3] >> 1) | (a->d[4] << 31));
+    t += SECP256K1_N_H_3 & mask;
+    r->d[3] = t; t >>= 32;
+    t += (uint32_t)((a->d[4] >> 1) | (a->d[5] << 31));
+    t += SECP256K1_N_H_4 & mask;
+    r->d[4] = t; t >>= 32;
+    t += (uint32_t)((a->d[5] >> 1) | (a->d[6] << 31));
+    t += SECP256K1_N_H_5 & mask;
+    r->d[5] = t; t >>= 32;
+    t += (uint32_t)((a->d[6] >> 1) | (a->d[7] << 31));
+    t += SECP256K1_N_H_6 & mask;
+    r->d[6] = t; t >>= 32;
+    r->d[7] = (uint32_t)t + (uint32_t)(a->d[7] >> 1) + (SECP256K1_N_H_7 & mask);
+
+    /* The line above only computed the bottom 32 bits of r->d[7]. Redo the computation
+     * in full 64 bits to make sure the top 32 bits are indeed zero. */
+    VERIFY_CHECK((t + (a->d[7] >> 1) + (SECP256K1_N_H_7 & mask)) >> 32 == 0);
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_is_one(const secp256k1_scalar *a) {
+    SECP256K1_SCALAR_VERIFY(a);
+
+    return ((a->d[0] ^ 1) | a->d[1] | a->d[2] | a->d[3] | a->d[4] | a->d[5] | a->d[6] | a->d[7]) == 0;
+}
+
+static int secp256k1_scalar_is_high(const secp256k1_scalar *a) {
+    int yes = 0;
+    int no = 0;
+    SECP256K1_SCALAR_VERIFY(a);
+
+    no |= (a->d[7] < SECP256K1_N_H_7);
+    yes |= (a->d[7] > SECP256K1_N_H_7) & ~no;
+    no |= (a->d[6] < SECP256K1_N_H_6) & ~yes; /* No need for a > check. */
+    no |= (a->d[5] < SECP256K1_N_H_5) & ~yes; /* No need for a > check. */
+    no |= (a->d[4] < SECP256K1_N_H_4) & ~yes; /* No need for a > check. */
+    no |= (a->d[3] < SECP256K1_N_H_3) & ~yes;
+    yes |= (a->d[3] > SECP256K1_N_H_3) & ~no;
+    no |= (a->d[2] < SECP256K1_N_H_2) & ~yes;
+    yes |= (a->d[2] > SECP256K1_N_H_2) & ~no;
+    no |= (a->d[1] < SECP256K1_N_H_1) & ~yes;
+    yes |= (a->d[1] > SECP256K1_N_H_1) & ~no;
+    yes |= (a->d[0] > SECP256K1_N_H_0) & ~no;
+    return yes;
+}
+
+static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) {
+    /* If we are flag = 0, mask = 00...00 and this is a no-op;
+     * if we are flag = 1, mask = 11...11 and this is identical to secp256k1_scalar_negate */
+    volatile int vflag = flag;
+    uint32_t mask = -vflag;
+    uint32_t nonzero = 0xFFFFFFFFUL * (secp256k1_scalar_is_zero(r) == 0);
+    uint64_t t = (uint64_t)(r->d[0] ^ mask) + ((SECP256K1_N_0 + 1) & mask);
+    SECP256K1_SCALAR_VERIFY(r);
+
+    r->d[0] = t & nonzero; t >>= 32;
+    t += (uint64_t)(r->d[1] ^ mask) + (SECP256K1_N_1 & mask);
+    r->d[1] = t & nonzero; t >>= 32;
+    t += (uint64_t)(r->d[2] ^ mask) + (SECP256K1_N_2 & mask);
+    r->d[2] = t & nonzero; t >>= 32;
+    t += (uint64_t)(r->d[3] ^ mask) + (SECP256K1_N_3 & mask);
+    r->d[3] = t & nonzero; t >>= 32;
+    t += (uint64_t)(r->d[4] ^ mask) + (SECP256K1_N_4 & mask);
+    r->d[4] = t & nonzero; t >>= 32;
+    t += (uint64_t)(r->d[5] ^ mask) + (SECP256K1_N_5 & mask);
+    r->d[5] = t & nonzero; t >>= 32;
+    t += (uint64_t)(r->d[6] ^ mask) + (SECP256K1_N_6 & mask);
+    r->d[6] = t & nonzero; t >>= 32;
+    t += (uint64_t)(r->d[7] ^ mask) + (SECP256K1_N_7 & mask);
+    r->d[7] = t & nonzero;
+
+    SECP256K1_SCALAR_VERIFY(r);
+    return 2 * (mask == 0) - 1;
+}
+
+
+/* Inspired by the macros in OpenSSL's crypto/bn/asm/x86_64-gcc.c. */
+
+/** Add a*b to the number defined by (c0,c1,c2). c2 must never overflow. */
+#define muladd(a,b) { \
+    uint32_t tl, th; \
+    { \
+        uint64_t t = (uint64_t)a * b; \
+        th = t >> 32;         /* at most 0xFFFFFFFE */ \
+        tl = t; \
+    } \
+    c0 += tl;                 /* overflow is handled on the next line */ \
+    th += (c0 < tl);          /* at most 0xFFFFFFFF */ \
+    c1 += th;                 /* overflow is handled on the next line */ \
+    c2 += (c1 < th);          /* never overflows by contract (verified in the next line) */ \
+    VERIFY_CHECK((c1 >= th) || (c2 != 0)); \
+}
+
+/** Add a*b to the number defined by (c0,c1). c1 must never overflow. */
+#define muladd_fast(a,b) { \
+    uint32_t tl, th; \
+    { \
+        uint64_t t = (uint64_t)a * b; \
+        th = t >> 32;         /* at most 0xFFFFFFFE */ \
+        tl = t; \
+    } \
+    c0 += tl;                 /* overflow is handled on the next line */ \
+    th += (c0 < tl);          /* at most 0xFFFFFFFF */ \
+    c1 += th;                 /* never overflows by contract (verified in the next line) */ \
+    VERIFY_CHECK(c1 >= th); \
+}
+
+/** Add a to the number defined by (c0,c1,c2). c2 must never overflow. */
+#define sumadd(a) { \
+    unsigned int over; \
+    c0 += (a);                  /* overflow is handled on the next line */ \
+    over = (c0 < (a)); \
+    c1 += over;                 /* overflow is handled on the next line */ \
+    c2 += (c1 < over);          /* never overflows by contract */ \
+}
+
+/** Add a to the number defined by (c0,c1). c1 must never overflow, c2 must be zero. */
+#define sumadd_fast(a) { \
+    c0 += (a);                 /* overflow is handled on the next line */ \
+    c1 += (c0 < (a));          /* never overflows by contract (verified the next line) */ \
+    VERIFY_CHECK((c1 != 0) | (c0 >= (a))); \
+    VERIFY_CHECK(c2 == 0); \
+}
+
+/** Extract the lowest 32 bits of (c0,c1,c2) into n, and left shift the number 32 bits. */
+#define extract(n) { \
+    (n) = c0; \
+    c0 = c1; \
+    c1 = c2; \
+    c2 = 0; \
+}
+
+/** Extract the lowest 32 bits of (c0,c1,c2) into n, and left shift the number 32 bits. c2 is required to be zero. */
+#define extract_fast(n) { \
+    (n) = c0; \
+    c0 = c1; \
+    c1 = 0; \
+    VERIFY_CHECK(c2 == 0); \
+}
+
+static void secp256k1_scalar_reduce_512(secp256k1_scalar *r, const uint32_t *l) {
+    uint64_t c;
+    uint32_t n0 = l[8], n1 = l[9], n2 = l[10], n3 = l[11], n4 = l[12], n5 = l[13], n6 = l[14], n7 = l[15];
+    uint32_t m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12;
+    uint32_t p0, p1, p2, p3, p4, p5, p6, p7, p8;
+
+    /* 96 bit accumulator. */
+    uint32_t c0, c1, c2;
+
+    /* Reduce 512 bits into 385. */
+    /* m[0..12] = l[0..7] + n[0..7] * SECP256K1_N_C. */
+    c0 = l[0]; c1 = 0; c2 = 0;
+    muladd_fast(n0, SECP256K1_N_C_0);
+    extract_fast(m0);
+    sumadd_fast(l[1]);
+    muladd(n1, SECP256K1_N_C_0);
+    muladd(n0, SECP256K1_N_C_1);
+    extract(m1);
+    sumadd(l[2]);
+    muladd(n2, SECP256K1_N_C_0);
+    muladd(n1, SECP256K1_N_C_1);
+    muladd(n0, SECP256K1_N_C_2);
+    extract(m2);
+    sumadd(l[3]);
+    muladd(n3, SECP256K1_N_C_0);
+    muladd(n2, SECP256K1_N_C_1);
+    muladd(n1, SECP256K1_N_C_2);
+    muladd(n0, SECP256K1_N_C_3);
+    extract(m3);
+    sumadd(l[4]);
+    muladd(n4, SECP256K1_N_C_0);
+    muladd(n3, SECP256K1_N_C_1);
+    muladd(n2, SECP256K1_N_C_2);
+    muladd(n1, SECP256K1_N_C_3);
+    sumadd(n0);
+    extract(m4);
+    sumadd(l[5]);
+    muladd(n5, SECP256K1_N_C_0);
+    muladd(n4, SECP256K1_N_C_1);
+    muladd(n3, SECP256K1_N_C_2);
+    muladd(n2, SECP256K1_N_C_3);
+    sumadd(n1);
+    extract(m5);
+    sumadd(l[6]);
+    muladd(n6, SECP256K1_N_C_0);
+    muladd(n5, SECP256K1_N_C_1);
+    muladd(n4, SECP256K1_N_C_2);
+    muladd(n3, SECP256K1_N_C_3);
+    sumadd(n2);
+    extract(m6);
+    sumadd(l[7]);
+    muladd(n7, SECP256K1_N_C_0);
+    muladd(n6, SECP256K1_N_C_1);
+    muladd(n5, SECP256K1_N_C_2);
+    muladd(n4, SECP256K1_N_C_3);
+    sumadd(n3);
+    extract(m7);
+    muladd(n7, SECP256K1_N_C_1);
+    muladd(n6, SECP256K1_N_C_2);
+    muladd(n5, SECP256K1_N_C_3);
+    sumadd(n4);
+    extract(m8);
+    muladd(n7, SECP256K1_N_C_2);
+    muladd(n6, SECP256K1_N_C_3);
+    sumadd(n5);
+    extract(m9);
+    muladd(n7, SECP256K1_N_C_3);
+    sumadd(n6);
+    extract(m10);
+    sumadd_fast(n7);
+    extract_fast(m11);
+    VERIFY_CHECK(c0 <= 1);
+    m12 = c0;
+
+    /* Reduce 385 bits into 258. */
+    /* p[0..8] = m[0..7] + m[8..12] * SECP256K1_N_C. */
+    c0 = m0; c1 = 0; c2 = 0;
+    muladd_fast(m8, SECP256K1_N_C_0);
+    extract_fast(p0);
+    sumadd_fast(m1);
+    muladd(m9, SECP256K1_N_C_0);
+    muladd(m8, SECP256K1_N_C_1);
+    extract(p1);
+    sumadd(m2);
+    muladd(m10, SECP256K1_N_C_0);
+    muladd(m9, SECP256K1_N_C_1);
+    muladd(m8, SECP256K1_N_C_2);
+    extract(p2);
+    sumadd(m3);
+    muladd(m11, SECP256K1_N_C_0);
+    muladd(m10, SECP256K1_N_C_1);
+    muladd(m9, SECP256K1_N_C_2);
+    muladd(m8, SECP256K1_N_C_3);
+    extract(p3);
+    sumadd(m4);
+    muladd(m12, SECP256K1_N_C_0);
+    muladd(m11, SECP256K1_N_C_1);
+    muladd(m10, SECP256K1_N_C_2);
+    muladd(m9, SECP256K1_N_C_3);
+    sumadd(m8);
+    extract(p4);
+    sumadd(m5);
+    muladd(m12, SECP256K1_N_C_1);
+    muladd(m11, SECP256K1_N_C_2);
+    muladd(m10, SECP256K1_N_C_3);
+    sumadd(m9);
+    extract(p5);
+    sumadd(m6);
+    muladd(m12, SECP256K1_N_C_2);
+    muladd(m11, SECP256K1_N_C_3);
+    sumadd(m10);
+    extract(p6);
+    sumadd_fast(m7);
+    muladd_fast(m12, SECP256K1_N_C_3);
+    sumadd_fast(m11);
+    extract_fast(p7);
+    p8 = c0 + m12;
+    VERIFY_CHECK(p8 <= 2);
+
+    /* Reduce 258 bits into 256. */
+    /* r[0..7] = p[0..7] + p[8] * SECP256K1_N_C. */
+    c = p0 + (uint64_t)SECP256K1_N_C_0 * p8;
+    r->d[0] = c & 0xFFFFFFFFUL; c >>= 32;
+    c += p1 + (uint64_t)SECP256K1_N_C_1 * p8;
+    r->d[1] = c & 0xFFFFFFFFUL; c >>= 32;
+    c += p2 + (uint64_t)SECP256K1_N_C_2 * p8;
+    r->d[2] = c & 0xFFFFFFFFUL; c >>= 32;
+    c += p3 + (uint64_t)SECP256K1_N_C_3 * p8;
+    r->d[3] = c & 0xFFFFFFFFUL; c >>= 32;
+    c += p4 + (uint64_t)p8;
+    r->d[4] = c & 0xFFFFFFFFUL; c >>= 32;
+    c += p5;
+    r->d[5] = c & 0xFFFFFFFFUL; c >>= 32;
+    c += p6;
+    r->d[6] = c & 0xFFFFFFFFUL; c >>= 32;
+    c += p7;
+    r->d[7] = c & 0xFFFFFFFFUL; c >>= 32;
+
+    /* Final reduction of r. */
+    secp256k1_scalar_reduce(r, c + secp256k1_scalar_check_overflow(r));
+}
+
+static void secp256k1_scalar_mul_512(uint32_t *l, const secp256k1_scalar *a, const secp256k1_scalar *b) {
+    /* 96 bit accumulator. */
+    uint32_t c0 = 0, c1 = 0, c2 = 0;
+
+    /* l[0..15] = a[0..7] * b[0..7]. */
+    muladd_fast(a->d[0], b->d[0]);
+    extract_fast(l[0]);
+    muladd(a->d[0], b->d[1]);
+    muladd(a->d[1], b->d[0]);
+    extract(l[1]);
+    muladd(a->d[0], b->d[2]);
+    muladd(a->d[1], b->d[1]);
+    muladd(a->d[2], b->d[0]);
+    extract(l[2]);
+    muladd(a->d[0], b->d[3]);
+    muladd(a->d[1], b->d[2]);
+    muladd(a->d[2], b->d[1]);
+    muladd(a->d[3], b->d[0]);
+    extract(l[3]);
+    muladd(a->d[0], b->d[4]);
+    muladd(a->d[1], b->d[3]);
+    muladd(a->d[2], b->d[2]);
+    muladd(a->d[3], b->d[1]);
+    muladd(a->d[4], b->d[0]);
+    extract(l[4]);
+    muladd(a->d[0], b->d[5]);
+    muladd(a->d[1], b->d[4]);
+    muladd(a->d[2], b->d[3]);
+    muladd(a->d[3], b->d[2]);
+    muladd(a->d[4], b->d[1]);
+    muladd(a->d[5], b->d[0]);
+    extract(l[5]);
+    muladd(a->d[0], b->d[6]);
+    muladd(a->d[1], b->d[5]);
+    muladd(a->d[2], b->d[4]);
+    muladd(a->d[3], b->d[3]);
+    muladd(a->d[4], b->d[2]);
+    muladd(a->d[5], b->d[1]);
+    muladd(a->d[6], b->d[0]);
+    extract(l[6]);
+    muladd(a->d[0], b->d[7]);
+    muladd(a->d[1], b->d[6]);
+    muladd(a->d[2], b->d[5]);
+    muladd(a->d[3], b->d[4]);
+    muladd(a->d[4], b->d[3]);
+    muladd(a->d[5], b->d[2]);
+    muladd(a->d[6], b->d[1]);
+    muladd(a->d[7], b->d[0]);
+    extract(l[7]);
+    muladd(a->d[1], b->d[7]);
+    muladd(a->d[2], b->d[6]);
+    muladd(a->d[3], b->d[5]);
+    muladd(a->d[4], b->d[4]);
+    muladd(a->d[5], b->d[3]);
+    muladd(a->d[6], b->d[2]);
+    muladd(a->d[7], b->d[1]);
+    extract(l[8]);
+    muladd(a->d[2], b->d[7]);
+    muladd(a->d[3], b->d[6]);
+    muladd(a->d[4], b->d[5]);
+    muladd(a->d[5], b->d[4]);
+    muladd(a->d[6], b->d[3]);
+    muladd(a->d[7], b->d[2]);
+    extract(l[9]);
+    muladd(a->d[3], b->d[7]);
+    muladd(a->d[4], b->d[6]);
+    muladd(a->d[5], b->d[5]);
+    muladd(a->d[6], b->d[4]);
+    muladd(a->d[7], b->d[3]);
+    extract(l[10]);
+    muladd(a->d[4], b->d[7]);
+    muladd(a->d[5], b->d[6]);
+    muladd(a->d[6], b->d[5]);
+    muladd(a->d[7], b->d[4]);
+    extract(l[11]);
+    muladd(a->d[5], b->d[7]);
+    muladd(a->d[6], b->d[6]);
+    muladd(a->d[7], b->d[5]);
+    extract(l[12]);
+    muladd(a->d[6], b->d[7]);
+    muladd(a->d[7], b->d[6]);
+    extract(l[13]);
+    muladd_fast(a->d[7], b->d[7]);
+    extract_fast(l[14]);
+    VERIFY_CHECK(c1 == 0);
+    l[15] = c0;
+}
+
+#undef sumadd
+#undef sumadd_fast
+#undef muladd
+#undef muladd_fast
+#undef extract
+#undef extract_fast
+
+static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) {
+    uint32_t l[16];
+    SECP256K1_SCALAR_VERIFY(a);
+    SECP256K1_SCALAR_VERIFY(b);
+
+    secp256k1_scalar_mul_512(l, a, b);
+    secp256k1_scalar_reduce_512(r, l);
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *k) {
+    SECP256K1_SCALAR_VERIFY(k);
+
+    r1->d[0] = k->d[0];
+    r1->d[1] = k->d[1];
+    r1->d[2] = k->d[2];
+    r1->d[3] = k->d[3];
+    r1->d[4] = 0;
+    r1->d[5] = 0;
+    r1->d[6] = 0;
+    r1->d[7] = 0;
+    r2->d[0] = k->d[4];
+    r2->d[1] = k->d[5];
+    r2->d[2] = k->d[6];
+    r2->d[3] = k->d[7];
+    r2->d[4] = 0;
+    r2->d[5] = 0;
+    r2->d[6] = 0;
+    r2->d[7] = 0;
+
+    SECP256K1_SCALAR_VERIFY(r1);
+    SECP256K1_SCALAR_VERIFY(r2);
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) {
+    SECP256K1_SCALAR_VERIFY(a);
+    SECP256K1_SCALAR_VERIFY(b);
+
+    return ((a->d[0] ^ b->d[0]) | (a->d[1] ^ b->d[1]) | (a->d[2] ^ b->d[2]) | (a->d[3] ^ b->d[3]) | (a->d[4] ^ b->d[4]) | (a->d[5] ^ b->d[5]) | (a->d[6] ^ b->d[6]) | (a->d[7] ^ b->d[7])) == 0;
+}
+
+SECP256K1_INLINE static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift) {
+    uint32_t l[16];
+    unsigned int shiftlimbs;
+    unsigned int shiftlow;
+    unsigned int shifthigh;
+    SECP256K1_SCALAR_VERIFY(a);
+    SECP256K1_SCALAR_VERIFY(b);
+    VERIFY_CHECK(shift >= 256);
+
+    secp256k1_scalar_mul_512(l, a, b);
+    shiftlimbs = shift >> 5;
+    shiftlow = shift & 0x1F;
+    shifthigh = 32 - shiftlow;
+    r->d[0] = shift < 512 ? (l[0 + shiftlimbs] >> shiftlow | (shift < 480 && shiftlow ? (l[1 + shiftlimbs] << shifthigh) : 0)) : 0;
+    r->d[1] = shift < 480 ? (l[1 + shiftlimbs] >> shiftlow | (shift < 448 && shiftlow ? (l[2 + shiftlimbs] << shifthigh) : 0)) : 0;
+    r->d[2] = shift < 448 ? (l[2 + shiftlimbs] >> shiftlow | (shift < 416 && shiftlow ? (l[3 + shiftlimbs] << shifthigh) : 0)) : 0;
+    r->d[3] = shift < 416 ? (l[3 + shiftlimbs] >> shiftlow | (shift < 384 && shiftlow ? (l[4 + shiftlimbs] << shifthigh) : 0)) : 0;
+    r->d[4] = shift < 384 ? (l[4 + shiftlimbs] >> shiftlow | (shift < 352 && shiftlow ? (l[5 + shiftlimbs] << shifthigh) : 0)) : 0;
+    r->d[5] = shift < 352 ? (l[5 + shiftlimbs] >> shiftlow | (shift < 320 && shiftlow ? (l[6 + shiftlimbs] << shifthigh) : 0)) : 0;
+    r->d[6] = shift < 320 ? (l[6 + shiftlimbs] >> shiftlow | (shift < 288 && shiftlow ? (l[7 + shiftlimbs] << shifthigh) : 0)) : 0;
+    r->d[7] = shift < 288 ? (l[7 + shiftlimbs] >> shiftlow)  : 0;
+    secp256k1_scalar_cadd_bit(r, 0, (l[(shift - 1) >> 5] >> ((shift - 1) & 0x1f)) & 1);
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static SECP256K1_INLINE void secp256k1_scalar_cmov(secp256k1_scalar *r, const secp256k1_scalar *a, int flag) {
+    uint32_t mask0, mask1;
+    volatile int vflag = flag;
+    SECP256K1_SCALAR_VERIFY(a);
+    SECP256K1_CHECKMEM_CHECK_VERIFY(r->d, sizeof(r->d));
+
+    mask0 = vflag + ~((uint32_t)0);
+    mask1 = ~mask0;
+    r->d[0] = (r->d[0] & mask0) | (a->d[0] & mask1);
+    r->d[1] = (r->d[1] & mask0) | (a->d[1] & mask1);
+    r->d[2] = (r->d[2] & mask0) | (a->d[2] & mask1);
+    r->d[3] = (r->d[3] & mask0) | (a->d[3] & mask1);
+    r->d[4] = (r->d[4] & mask0) | (a->d[4] & mask1);
+    r->d[5] = (r->d[5] & mask0) | (a->d[5] & mask1);
+    r->d[6] = (r->d[6] & mask0) | (a->d[6] & mask1);
+    r->d[7] = (r->d[7] & mask0) | (a->d[7] & mask1);
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static void secp256k1_scalar_from_signed30(secp256k1_scalar *r, const secp256k1_modinv32_signed30 *a) {
+    const uint32_t a0 = a->v[0], a1 = a->v[1], a2 = a->v[2], a3 = a->v[3], a4 = a->v[4],
+                   a5 = a->v[5], a6 = a->v[6], a7 = a->v[7], a8 = a->v[8];
+
+    /* The output from secp256k1_modinv32{_var} should be normalized to range [0,modulus), and
+     * have limbs in [0,2^30). The modulus is < 2^256, so the top limb must be below 2^(256-30*8).
+     */
+    VERIFY_CHECK(a0 >> 30 == 0);
+    VERIFY_CHECK(a1 >> 30 == 0);
+    VERIFY_CHECK(a2 >> 30 == 0);
+    VERIFY_CHECK(a3 >> 30 == 0);
+    VERIFY_CHECK(a4 >> 30 == 0);
+    VERIFY_CHECK(a5 >> 30 == 0);
+    VERIFY_CHECK(a6 >> 30 == 0);
+    VERIFY_CHECK(a7 >> 30 == 0);
+    VERIFY_CHECK(a8 >> 16 == 0);
+
+    r->d[0] = a0       | a1 << 30;
+    r->d[1] = a1 >>  2 | a2 << 28;
+    r->d[2] = a2 >>  4 | a3 << 26;
+    r->d[3] = a3 >>  6 | a4 << 24;
+    r->d[4] = a4 >>  8 | a5 << 22;
+    r->d[5] = a5 >> 10 | a6 << 20;
+    r->d[6] = a6 >> 12 | a7 << 18;
+    r->d[7] = a7 >> 14 | a8 << 16;
+
+    SECP256K1_SCALAR_VERIFY(r);
+}
+
+static void secp256k1_scalar_to_signed30(secp256k1_modinv32_signed30 *r, const secp256k1_scalar *a) {
+    const uint32_t M30 = UINT32_MAX >> 2;
+    const uint32_t a0 = a->d[0], a1 = a->d[1], a2 = a->d[2], a3 = a->d[3],
+                   a4 = a->d[4], a5 = a->d[5], a6 = a->d[6], a7 = a->d[7];
+    SECP256K1_SCALAR_VERIFY(a);
+
+    r->v[0] =  a0                   & M30;
+    r->v[1] = (a0 >> 30 | a1 <<  2) & M30;
+    r->v[2] = (a1 >> 28 | a2 <<  4) & M30;
+    r->v[3] = (a2 >> 26 | a3 <<  6) & M30;
+    r->v[4] = (a3 >> 24 | a4 <<  8) & M30;
+    r->v[5] = (a4 >> 22 | a5 << 10) & M30;
+    r->v[6] = (a5 >> 20 | a6 << 12) & M30;
+    r->v[7] = (a6 >> 18 | a7 << 14) & M30;
+    r->v[8] =  a7 >> 16;
+}
+
+static const secp256k1_modinv32_modinfo secp256k1_const_modinfo_scalar = {
+    {{0x10364141L, 0x3F497A33L, 0x348A03BBL, 0x2BB739ABL, -0x146L, 0, 0, 0, 65536}},
+    0x2A774EC1L
+};
+
+static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar *x) {
+    secp256k1_modinv32_signed30 s;
+#ifdef VERIFY
+    int zero_in = secp256k1_scalar_is_zero(x);
+#endif
+    SECP256K1_SCALAR_VERIFY(x);
+
+    secp256k1_scalar_to_signed30(&s, x);
+    secp256k1_modinv32(&s, &secp256k1_const_modinfo_scalar);
+    secp256k1_scalar_from_signed30(r, &s);
+
+    SECP256K1_SCALAR_VERIFY(r);
+    VERIFY_CHECK(secp256k1_scalar_is_zero(r) == zero_in);
+}
+
+static void secp256k1_scalar_inverse_var(secp256k1_scalar *r, const secp256k1_scalar *x) {
+    secp256k1_modinv32_signed30 s;
+#ifdef VERIFY
+    int zero_in = secp256k1_scalar_is_zero(x);
+#endif
+    SECP256K1_SCALAR_VERIFY(x);
+
+    secp256k1_scalar_to_signed30(&s, x);
+    secp256k1_modinv32_var(&s, &secp256k1_const_modinfo_scalar);
+    secp256k1_scalar_from_signed30(r, &s);
+
+    SECP256K1_SCALAR_VERIFY(r);
+    VERIFY_CHECK(secp256k1_scalar_is_zero(r) == zero_in);
+}
+
+SECP256K1_INLINE static int secp256k1_scalar_is_even(const secp256k1_scalar *a) {
+    SECP256K1_SCALAR_VERIFY(a);
+
+    return !(a->d[0] & 1);
+}
+
+#endif /* SECP256K1_SCALAR_REPR_IMPL_H */
diff --git a/vendor/external/secp256k1/src/scalar_impl.h b/vendor/external/secp256k1/src/scalar_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/scalar_impl.h
@@ -0,0 +1,321 @@
+/***********************************************************************
+ * Copyright (c) 2014 Pieter Wuille                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_SCALAR_IMPL_H
+#define SECP256K1_SCALAR_IMPL_H
+
+#ifdef VERIFY
+#include <string.h>
+#endif
+
+#include "scalar.h"
+#include "util.h"
+
+#if defined(EXHAUSTIVE_TEST_ORDER)
+#include "scalar_low_impl.h"
+#elif defined(SECP256K1_WIDEMUL_INT128)
+#include "scalar_4x64_impl.h"
+#elif defined(SECP256K1_WIDEMUL_INT64)
+#include "scalar_8x32_impl.h"
+#else
+#error "Please select wide multiplication implementation"
+#endif
+
+static const secp256k1_scalar secp256k1_scalar_one = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 1);
+static const secp256k1_scalar secp256k1_scalar_zero = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0);
+
+SECP256K1_INLINE static void secp256k1_scalar_clear(secp256k1_scalar *r) {
+    secp256k1_memclear(r, sizeof(secp256k1_scalar));
+}
+
+static int secp256k1_scalar_set_b32_seckey(secp256k1_scalar *r, const unsigned char *bin) {
+    int overflow;
+    secp256k1_scalar_set_b32(r, bin, &overflow);
+
+    SECP256K1_SCALAR_VERIFY(r);
+    return (!overflow) & (!secp256k1_scalar_is_zero(r));
+}
+
+static void secp256k1_scalar_verify(const secp256k1_scalar *r) {
+    VERIFY_CHECK(secp256k1_scalar_check_overflow(r) == 0);
+
+    (void)r;
+}
+
+#if defined(EXHAUSTIVE_TEST_ORDER)
+/* Begin of section generated by sage/gen_exhaustive_groups.sage. */
+#  if EXHAUSTIVE_TEST_ORDER == 7
+#    define EXHAUSTIVE_TEST_LAMBDA 2
+#  elif EXHAUSTIVE_TEST_ORDER == 13
+#    define EXHAUSTIVE_TEST_LAMBDA 9
+#  elif EXHAUSTIVE_TEST_ORDER == 199
+#    define EXHAUSTIVE_TEST_LAMBDA 92
+#  else
+#    error No known lambda for the specified exhaustive test group order.
+#  endif
+/* End of section generated by sage/gen_exhaustive_groups.sage. */
+
+/**
+ * Find r1 and r2 given k, such that r1 + r2 * lambda == k mod n; unlike in the
+ * full case we don't bother making r1 and r2 be small, we just want them to be
+ * nontrivial to get full test coverage for the exhaustive tests. We therefore
+ * (arbitrarily) set r2 = k + 5 (mod n) and r1 = k - r2 * lambda (mod n).
+ */
+static void secp256k1_scalar_split_lambda(secp256k1_scalar * SECP256K1_RESTRICT r1, secp256k1_scalar * SECP256K1_RESTRICT r2, const secp256k1_scalar * SECP256K1_RESTRICT k) {
+    SECP256K1_SCALAR_VERIFY(k);
+    VERIFY_CHECK(r1 != k);
+    VERIFY_CHECK(r2 != k);
+    VERIFY_CHECK(r1 != r2);
+
+    *r2 = (*k + 5) % EXHAUSTIVE_TEST_ORDER;
+    *r1 = (*k + (EXHAUSTIVE_TEST_ORDER - *r2) * EXHAUSTIVE_TEST_LAMBDA) % EXHAUSTIVE_TEST_ORDER;
+
+    SECP256K1_SCALAR_VERIFY(r1);
+    SECP256K1_SCALAR_VERIFY(r2);
+}
+#else
+/**
+ * The Secp256k1 curve has an endomorphism, where lambda * (x, y) = (beta * x, y), where
+ * lambda is: */
+static const secp256k1_scalar secp256k1_const_lambda = SECP256K1_SCALAR_CONST(
+    0x5363AD4CUL, 0xC05C30E0UL, 0xA5261C02UL, 0x8812645AUL,
+    0x122E22EAUL, 0x20816678UL, 0xDF02967CUL, 0x1B23BD72UL
+);
+
+#ifdef VERIFY
+static void secp256k1_scalar_split_lambda_verify(const secp256k1_scalar *r1, const secp256k1_scalar *r2, const secp256k1_scalar *k);
+#endif
+
+/*
+ * Both lambda and beta are primitive cube roots of unity.  That is lamba^3 == 1 mod n and
+ * beta^3 == 1 mod p, where n is the curve order and p is the field order.
+ *
+ * Furthermore, because (X^3 - 1) = (X - 1)(X^2 + X + 1), the primitive cube roots of unity are
+ * roots of X^2 + X + 1.  Therefore lambda^2 + lamba == -1 mod n and beta^2 + beta == -1 mod p.
+ * (The other primitive cube roots of unity are lambda^2 and beta^2 respectively.)
+ *
+ * Let l = -1/2 + i*sqrt(3)/2, the complex root of X^2 + X + 1. We can define a ring
+ * homomorphism phi : Z[l] -> Z_n where phi(a + b*l) == a + b*lambda mod n. The kernel of phi
+ * is a lattice over Z[l] (considering Z[l] as a Z-module). This lattice is generated by a
+ * reduced basis {a1 + b1*l, a2 + b2*l} where
+ *
+ * - a1 =      {0x30,0x86,0xd2,0x21,0xa7,0xd4,0x6b,0xcd,0xe8,0x6c,0x90,0xe4,0x92,0x84,0xeb,0x15}
+ * - b1 =     -{0xe4,0x43,0x7e,0xd6,0x01,0x0e,0x88,0x28,0x6f,0x54,0x7f,0xa9,0x0a,0xbf,0xe4,0xc3}
+ * - a2 = {0x01,0x14,0xca,0x50,0xf7,0xa8,0xe2,0xf3,0xf6,0x57,0xc1,0x10,0x8d,0x9d,0x44,0xcf,0xd8}
+ * - b2 =      {0x30,0x86,0xd2,0x21,0xa7,0xd4,0x6b,0xcd,0xe8,0x6c,0x90,0xe4,0x92,0x84,0xeb,0x15}
+ *
+ * "Guide to Elliptic Curve Cryptography" (Hankerson, Menezes, Vanstone) gives an algorithm
+ * (algorithm 3.74) to find k1 and k2 given k, such that k1 + k2 * lambda == k mod n, and k1
+ * and k2 are small in absolute value.
+ *
+ * The algorithm computes c1 = round(b2 * k / n) and c2 = round((-b1) * k / n), and gives
+ * k1 = k - (c1*a1 + c2*a2) and k2 = -(c1*b1 + c2*b2). Instead, we use modular arithmetic, and
+ * compute r2 = k2 mod n, and r1 = k1 mod n = (k - r2 * lambda) mod n, avoiding the need for
+ * the constants a1 and a2.
+ *
+ * g1, g2 are precomputed constants used to replace division with a rounded multiplication
+ * when decomposing the scalar for an endomorphism-based point multiplication.
+ *
+ * The possibility of using precomputed estimates is mentioned in "Guide to Elliptic Curve
+ * Cryptography" (Hankerson, Menezes, Vanstone) in section 3.5.
+ *
+ * The derivation is described in the paper "Efficient Software Implementation of Public-Key
+ * Cryptography on Sensor Networks Using the MSP430X Microcontroller" (Gouvea, Oliveira, Lopez),
+ * Section 4.3 (here we use a somewhat higher-precision estimate):
+ * d = a1*b2 - b1*a2
+ * g1 = round(2^384 * b2/d)
+ * g2 = round(2^384 * (-b1)/d)
+ *
+ * (Note that d is also equal to the curve order, n, here because [a1,b1] and [a2,b2]
+ * can be found as outputs of the Extended Euclidean Algorithm on inputs n and lambda).
+ *
+ * The function below splits k into r1 and r2, such that
+ * - r1 + lambda * r2 == k (mod n)
+ * - either r1 < 2^128 or -r1 mod n < 2^128
+ * - either r2 < 2^128 or -r2 mod n < 2^128
+ *
+ * See proof below.
+ */
+static void secp256k1_scalar_split_lambda(secp256k1_scalar * SECP256K1_RESTRICT r1, secp256k1_scalar * SECP256K1_RESTRICT r2, const secp256k1_scalar * SECP256K1_RESTRICT k) {
+    secp256k1_scalar c1, c2;
+    static const secp256k1_scalar minus_b1 = SECP256K1_SCALAR_CONST(
+        0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL,
+        0xE4437ED6UL, 0x010E8828UL, 0x6F547FA9UL, 0x0ABFE4C3UL
+    );
+    static const secp256k1_scalar minus_b2 = SECP256K1_SCALAR_CONST(
+        0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFEUL,
+        0x8A280AC5UL, 0x0774346DUL, 0xD765CDA8UL, 0x3DB1562CUL
+    );
+    static const secp256k1_scalar g1 = SECP256K1_SCALAR_CONST(
+        0x3086D221UL, 0xA7D46BCDUL, 0xE86C90E4UL, 0x9284EB15UL,
+        0x3DAA8A14UL, 0x71E8CA7FUL, 0xE893209AUL, 0x45DBB031UL
+    );
+    static const secp256k1_scalar g2 = SECP256K1_SCALAR_CONST(
+        0xE4437ED6UL, 0x010E8828UL, 0x6F547FA9UL, 0x0ABFE4C4UL,
+        0x221208ACUL, 0x9DF506C6UL, 0x1571B4AEUL, 0x8AC47F71UL
+    );
+    SECP256K1_SCALAR_VERIFY(k);
+    VERIFY_CHECK(r1 != k);
+    VERIFY_CHECK(r2 != k);
+    VERIFY_CHECK(r1 != r2);
+
+    /* these _var calls are constant time since the shift amount is constant */
+    secp256k1_scalar_mul_shift_var(&c1, k, &g1, 384);
+    secp256k1_scalar_mul_shift_var(&c2, k, &g2, 384);
+    secp256k1_scalar_mul(&c1, &c1, &minus_b1);
+    secp256k1_scalar_mul(&c2, &c2, &minus_b2);
+    secp256k1_scalar_add(r2, &c1, &c2);
+    secp256k1_scalar_mul(r1, r2, &secp256k1_const_lambda);
+    secp256k1_scalar_negate(r1, r1);
+    secp256k1_scalar_add(r1, r1, k);
+
+    SECP256K1_SCALAR_VERIFY(r1);
+    SECP256K1_SCALAR_VERIFY(r2);
+#ifdef VERIFY
+    secp256k1_scalar_split_lambda_verify(r1, r2, k);
+#endif
+}
+
+#ifdef VERIFY
+/*
+ * Proof for secp256k1_scalar_split_lambda's bounds.
+ *
+ * Let
+ *  - epsilon1 = 2^256 * |g1/2^384 - b2/d|
+ *  - epsilon2 = 2^256 * |g2/2^384 - (-b1)/d|
+ *  - c1 = round(k*g1/2^384)
+ *  - c2 = round(k*g2/2^384)
+ *
+ * Lemma 1: |c1 - k*b2/d| < 2^-1 + epsilon1
+ *
+ *    |c1 - k*b2/d|
+ *  =
+ *    |c1 - k*g1/2^384 + k*g1/2^384 - k*b2/d|
+ * <=   {triangle inequality}
+ *    |c1 - k*g1/2^384| + |k*g1/2^384 - k*b2/d|
+ *  =
+ *    |c1 - k*g1/2^384| + k*|g1/2^384 - b2/d|
+ * <    {rounding in c1 and 0 <= k < 2^256}
+ *    2^-1 + 2^256 * |g1/2^384 - b2/d|
+ *  =   {definition of epsilon1}
+ *    2^-1 + epsilon1
+ *
+ * Lemma 2: |c2 - k*(-b1)/d| < 2^-1 + epsilon2
+ *
+ *    |c2 - k*(-b1)/d|
+ *  =
+ *    |c2 - k*g2/2^384 + k*g2/2^384 - k*(-b1)/d|
+ * <=   {triangle inequality}
+ *    |c2 - k*g2/2^384| + |k*g2/2^384 - k*(-b1)/d|
+ *  =
+ *    |c2 - k*g2/2^384| + k*|g2/2^384 - (-b1)/d|
+ * <    {rounding in c2 and 0 <= k < 2^256}
+ *    2^-1 + 2^256 * |g2/2^384 - (-b1)/d|
+ *  =   {definition of epsilon2}
+ *    2^-1 + epsilon2
+ *
+ * Let
+ *  - k1 = k - c1*a1 - c2*a2
+ *  - k2 = - c1*b1 - c2*b2
+ *
+ * Lemma 3: |k1| < (a1 + a2 + 1)/2 < 2^128
+ *
+ *    |k1|
+ *  =   {definition of k1}
+ *    |k - c1*a1 - c2*a2|
+ *  =   {(a1*b2 - b1*a2)/n = 1}
+ *    |k*(a1*b2 - b1*a2)/n - c1*a1 - c2*a2|
+ *  =
+ *    |a1*(k*b2/n - c1) + a2*(k*(-b1)/n - c2)|
+ * <=   {triangle inequality}
+ *    a1*|k*b2/n - c1| + a2*|k*(-b1)/n - c2|
+ * <    {Lemma 1 and Lemma 2}
+ *    a1*(2^-1 + epsilon1) + a2*(2^-1 + epsilon2)
+ * <    {rounding up to an integer}
+ *    (a1 + a2 + 1)/2
+ * <    {rounding up to a power of 2}
+ *    2^128
+ *
+ * Lemma 4: |k2| < (-b1 + b2)/2 + 1 < 2^128
+ *
+ *    |k2|
+ *  =   {definition of k2}
+ *    |- c1*a1 - c2*a2|
+ *  =   {(b1*b2 - b1*b2)/n = 0}
+ *    |k*(b1*b2 - b1*b2)/n - c1*b1 - c2*b2|
+ *  =
+ *    |b1*(k*b2/n - c1) + b2*(k*(-b1)/n - c2)|
+ * <=   {triangle inequality}
+ *    (-b1)*|k*b2/n - c1| + b2*|k*(-b1)/n - c2|
+ * <    {Lemma 1 and Lemma 2}
+ *    (-b1)*(2^-1 + epsilon1) + b2*(2^-1 + epsilon2)
+ * <    {rounding up to an integer}
+ *    (-b1 + b2)/2 + 1
+ * <    {rounding up to a power of 2}
+ *    2^128
+ *
+ * Let
+ *  - r2 = k2 mod n
+ *  - r1 = k - r2*lambda mod n.
+ *
+ * Notice that r1 is defined such that r1 + r2 * lambda == k (mod n).
+ *
+ * Lemma 5: r1 == k1 mod n.
+ *
+ *    r1
+ * ==   {definition of r1 and r2}
+ *    k - k2*lambda
+ * ==   {definition of k2}
+ *    k - (- c1*b1 - c2*b2)*lambda
+ * ==
+ *    k + c1*b1*lambda + c2*b2*lambda
+ * ==  {a1 + b1*lambda == 0 mod n and a2 + b2*lambda == 0 mod n}
+ *    k - c1*a1 - c2*a2
+ * ==  {definition of k1}
+ *    k1
+ *
+ * From Lemma 3, Lemma 4, Lemma 5 and the definition of r2, we can conclude that
+ *
+ *  - either r1 < 2^128 or -r1 mod n < 2^128
+ *  - either r2 < 2^128 or -r2 mod n < 2^128.
+ *
+ * Q.E.D.
+ */
+static void secp256k1_scalar_split_lambda_verify(const secp256k1_scalar *r1, const secp256k1_scalar *r2, const secp256k1_scalar *k) {
+    secp256k1_scalar s;
+    unsigned char buf1[32];
+    unsigned char buf2[32];
+
+    /* (a1 + a2 + 1)/2 is 0xa2a8918ca85bafe22016d0b917e4dd77 */
+    static const unsigned char k1_bound[32] = {
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0xa2, 0xa8, 0x91, 0x8c, 0xa8, 0x5b, 0xaf, 0xe2, 0x20, 0x16, 0xd0, 0xb9, 0x17, 0xe4, 0xdd, 0x77
+    };
+
+    /* (-b1 + b2)/2 + 1 is 0x8a65287bd47179fb2be08846cea267ed */
+    static const unsigned char k2_bound[32] = {
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x8a, 0x65, 0x28, 0x7b, 0xd4, 0x71, 0x79, 0xfb, 0x2b, 0xe0, 0x88, 0x46, 0xce, 0xa2, 0x67, 0xed
+    };
+
+    secp256k1_scalar_mul(&s, &secp256k1_const_lambda, r2);
+    secp256k1_scalar_add(&s, &s, r1);
+    VERIFY_CHECK(secp256k1_scalar_eq(&s, k));
+
+    secp256k1_scalar_negate(&s, r1);
+    secp256k1_scalar_get_b32(buf1, r1);
+    secp256k1_scalar_get_b32(buf2, &s);
+    VERIFY_CHECK(secp256k1_memcmp_var(buf1, k1_bound, 32) < 0 || secp256k1_memcmp_var(buf2, k1_bound, 32) < 0);
+
+    secp256k1_scalar_negate(&s, r2);
+    secp256k1_scalar_get_b32(buf1, r2);
+    secp256k1_scalar_get_b32(buf2, &s);
+    VERIFY_CHECK(secp256k1_memcmp_var(buf1, k2_bound, 32) < 0 || secp256k1_memcmp_var(buf2, k2_bound, 32) < 0);
+}
+#endif /* VERIFY */
+#endif /* !defined(EXHAUSTIVE_TEST_ORDER) */
+
+#endif /* SECP256K1_SCALAR_IMPL_H */
diff --git a/vendor/external/secp256k1/src/scratch.h b/vendor/external/secp256k1/src/scratch.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/scratch.h
@@ -0,0 +1,44 @@
+/***********************************************************************
+ * Copyright (c) 2017 Andrew Poelstra                                  *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_SCRATCH_H
+#define SECP256K1_SCRATCH_H
+
+/* The typedef is used internally; the struct name is used in the public API
+ * (where it is exposed as a different typedef) */
+typedef struct secp256k1_scratch_space_struct {
+    /** guard against interpreting this object as other types */
+    unsigned char magic[8];
+    /** actual allocated data */
+    void *data;
+    /** amount that has been allocated (i.e. `data + offset` is the next
+     *  available pointer)  */
+    size_t alloc_size;
+    /** maximum size available to allocate */
+    size_t max_size;
+} secp256k1_scratch;
+
+typedef struct secp256k1_scratch_space_struct secp256k1_scratch_space;
+
+static secp256k1_scratch* secp256k1_scratch_create(const secp256k1_callback* error_callback, size_t max_size);
+
+static void secp256k1_scratch_destroy(const secp256k1_callback* error_callback, secp256k1_scratch* scratch);
+
+/** Returns an opaque object used to "checkpoint" a scratch space. Used
+ *  with `secp256k1_scratch_apply_checkpoint` to undo allocations. */
+static size_t secp256k1_scratch_checkpoint(const secp256k1_callback* error_callback, const secp256k1_scratch* scratch);
+
+/** Applies a check point received from `secp256k1_scratch_checkpoint`,
+ *  undoing all allocations since that point. */
+static void secp256k1_scratch_apply_checkpoint(const secp256k1_callback* error_callback, secp256k1_scratch* scratch, size_t checkpoint);
+
+/** Returns the maximum allocation the scratch space will allow */
+static size_t secp256k1_scratch_max_allocation(const secp256k1_callback* error_callback, const secp256k1_scratch* scratch, size_t n_objects);
+
+/** Returns a pointer into the most recently allocated frame, or NULL if there is insufficient available space */
+static void *secp256k1_scratch_alloc(const secp256k1_callback* error_callback, secp256k1_scratch* scratch, size_t n);
+
+#endif
diff --git a/vendor/external/secp256k1/src/scratch_impl.h b/vendor/external/secp256k1/src/scratch_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/scratch_impl.h
@@ -0,0 +1,99 @@
+/***********************************************************************
+ * Copyright (c) 2017 Andrew Poelstra                                  *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_SCRATCH_IMPL_H
+#define SECP256K1_SCRATCH_IMPL_H
+
+#include "util.h"
+#include "scratch.h"
+
+static secp256k1_scratch* secp256k1_scratch_create(const secp256k1_callback* error_callback, size_t size) {
+    const size_t base_alloc = ROUND_TO_ALIGN(sizeof(secp256k1_scratch));
+    void *alloc = checked_malloc(error_callback, base_alloc + size);
+    secp256k1_scratch* ret = (secp256k1_scratch *)alloc;
+    if (ret != NULL) {
+        memset(ret, 0, sizeof(*ret));
+        memcpy(ret->magic, "scratch", 8);
+        ret->data = (void *) ((char *) alloc + base_alloc);
+        ret->max_size = size;
+    }
+    return ret;
+}
+
+static void secp256k1_scratch_destroy(const secp256k1_callback* error_callback, secp256k1_scratch* scratch) {
+    if (scratch != NULL) {
+        if (secp256k1_memcmp_var(scratch->magic, "scratch", 8) != 0) {
+            secp256k1_callback_call(error_callback, "invalid scratch space");
+            return;
+        }
+        VERIFY_CHECK(scratch->alloc_size == 0); /* all checkpoints should be applied */
+        memset(scratch->magic, 0, sizeof(scratch->magic));
+        free(scratch);
+    }
+}
+
+static size_t secp256k1_scratch_checkpoint(const secp256k1_callback* error_callback, const secp256k1_scratch* scratch) {
+    if (secp256k1_memcmp_var(scratch->magic, "scratch", 8) != 0) {
+        secp256k1_callback_call(error_callback, "invalid scratch space");
+        return 0;
+    }
+    return scratch->alloc_size;
+}
+
+static void secp256k1_scratch_apply_checkpoint(const secp256k1_callback* error_callback, secp256k1_scratch* scratch, size_t checkpoint) {
+    if (secp256k1_memcmp_var(scratch->magic, "scratch", 8) != 0) {
+        secp256k1_callback_call(error_callback, "invalid scratch space");
+        return;
+    }
+    if (checkpoint > scratch->alloc_size) {
+        secp256k1_callback_call(error_callback, "invalid checkpoint");
+        return;
+    }
+    scratch->alloc_size = checkpoint;
+}
+
+static size_t secp256k1_scratch_max_allocation(const secp256k1_callback* error_callback, const secp256k1_scratch* scratch, size_t objects) {
+    if (secp256k1_memcmp_var(scratch->magic, "scratch", 8) != 0) {
+        secp256k1_callback_call(error_callback, "invalid scratch space");
+        return 0;
+    }
+    /* Ensure that multiplication will not wrap around */
+    if (ALIGNMENT > 1 && objects > SIZE_MAX/(ALIGNMENT - 1)) {
+        return 0;
+    }
+    if (scratch->max_size - scratch->alloc_size <= objects * (ALIGNMENT - 1)) {
+        return 0;
+    }
+    return scratch->max_size - scratch->alloc_size - objects * (ALIGNMENT - 1);
+}
+
+static void *secp256k1_scratch_alloc(const secp256k1_callback* error_callback, secp256k1_scratch* scratch, size_t size) {
+    void *ret;
+    size_t rounded_size;
+
+    rounded_size = ROUND_TO_ALIGN(size);
+    /* Check that rounding did not wrap around */
+    if (rounded_size < size) {
+        return NULL;
+    }
+    size = rounded_size;
+
+    if (secp256k1_memcmp_var(scratch->magic, "scratch", 8) != 0) {
+        secp256k1_callback_call(error_callback, "invalid scratch space");
+        return NULL;
+    }
+
+    if (size > scratch->max_size - scratch->alloc_size) {
+        return NULL;
+    }
+    ret = (void *) ((char *) scratch->data + scratch->alloc_size);
+    memset(ret, 0, size);
+    scratch->alloc_size += size;
+
+    return ret;
+}
+
+#endif
diff --git a/vendor/external/secp256k1/src/secp256k1.c b/vendor/external/secp256k1/src/secp256k1.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/secp256k1.c
@@ -0,0 +1,831 @@
+/***********************************************************************
+ * Copyright (c) 2013-2015 Pieter Wuille                               *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+/* This is a C project. It should not be compiled with a C++ compiler,
+ * and we error out if we detect one.
+ *
+ * We still want to be able to test the project with a C++ compiler
+ * because it is still good to know if this will lead to real trouble, so
+ * there is a possibility to override the check. But be warned that
+ * compiling with a C++ compiler is not supported. */
+#if defined(__cplusplus) && !defined(SECP256K1_CPLUSPLUS_TEST_OVERRIDE)
+#error Trying to compile a C project with a C++ compiler.
+#endif
+
+#define SECP256K1_BUILD
+
+#include "../include/secp256k1.h"
+#include "../include/secp256k1_preallocated.h"
+
+#include "assumptions.h"
+#include "checkmem.h"
+#include "util.h"
+
+#include "field_impl.h"
+#include "scalar_impl.h"
+#include "group_impl.h"
+#include "ecmult_impl.h"
+#include "ecmult_const_impl.h"
+#include "ecmult_gen_impl.h"
+#include "ecdsa_impl.h"
+#include "eckey_impl.h"
+#include "hash_impl.h"
+#include "int128_impl.h"
+#include "scratch_impl.h"
+#include "selftest.h"
+#include "hsort_impl.h"
+
+#ifdef SECP256K1_NO_BUILD
+# error "secp256k1.h processed without SECP256K1_BUILD defined while building secp256k1.c"
+#endif
+
+#define ARG_CHECK(cond) do { \
+    if (EXPECT(!(cond), 0)) { \
+        secp256k1_callback_call(&ctx->illegal_callback, #cond); \
+        return 0; \
+    } \
+} while(0)
+
+#define ARG_CHECK_VOID(cond) do { \
+    if (EXPECT(!(cond), 0)) { \
+        secp256k1_callback_call(&ctx->illegal_callback, #cond); \
+        return; \
+    } \
+} while(0)
+
+/* Note that whenever you change the context struct, you must also change the
+ * context_eq function. */
+struct secp256k1_context_struct {
+    secp256k1_ecmult_gen_context ecmult_gen_ctx;
+    secp256k1_callback illegal_callback;
+    secp256k1_callback error_callback;
+    int declassify;
+};
+
+static const secp256k1_context secp256k1_context_static_ = {
+    { 0 },
+    { secp256k1_default_illegal_callback_fn, 0 },
+    { secp256k1_default_error_callback_fn, 0 },
+    0
+};
+const secp256k1_context *secp256k1_context_static = &secp256k1_context_static_;
+const secp256k1_context *secp256k1_context_no_precomp = &secp256k1_context_static_;
+
+/* Helper function that determines if a context is proper, i.e., is not the static context or a copy thereof.
+ *
+ * This is intended for "context" functions such as secp256k1_context_clone. Functions that need specific
+ * features of a context should still check for these features directly. For example, a function that needs
+ * ecmult_gen should directly check for the existence of the ecmult_gen context. */
+static int secp256k1_context_is_proper(const secp256k1_context* ctx) {
+    return secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx);
+}
+
+void secp256k1_selftest(void) {
+    if (!secp256k1_selftest_passes()) {
+        secp256k1_callback_call(&default_error_callback, "self test failed");
+    }
+}
+
+size_t secp256k1_context_preallocated_size(unsigned int flags) {
+    size_t ret = sizeof(secp256k1_context);
+    /* A return value of 0 is reserved as an indicator for errors when we call this function internally. */
+    VERIFY_CHECK(ret != 0);
+
+    if (EXPECT((flags & SECP256K1_FLAGS_TYPE_MASK) != SECP256K1_FLAGS_TYPE_CONTEXT, 0)) {
+            secp256k1_callback_call(&default_illegal_callback,
+                                    "Invalid flags");
+            return 0;
+    }
+
+    if (EXPECT(!SECP256K1_CHECKMEM_RUNNING() && (flags & SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY), 0)) {
+            secp256k1_callback_call(&default_illegal_callback,
+                                    "Declassify flag requires running with memory checking");
+            return 0;
+    }
+
+    return ret;
+}
+
+size_t secp256k1_context_preallocated_clone_size(const secp256k1_context* ctx) {
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(secp256k1_context_is_proper(ctx));
+    return sizeof(secp256k1_context);
+}
+
+secp256k1_context* secp256k1_context_preallocated_create(void* prealloc, unsigned int flags) {
+    size_t prealloc_size;
+    secp256k1_context* ret;
+
+    secp256k1_selftest();
+
+    prealloc_size = secp256k1_context_preallocated_size(flags);
+    if (prealloc_size == 0) {
+        return NULL;
+    }
+    VERIFY_CHECK(prealloc != NULL);
+    ret = (secp256k1_context*)prealloc;
+    ret->illegal_callback = default_illegal_callback;
+    ret->error_callback = default_error_callback;
+
+    /* Flags have been checked by secp256k1_context_preallocated_size. */
+    VERIFY_CHECK((flags & SECP256K1_FLAGS_TYPE_MASK) == SECP256K1_FLAGS_TYPE_CONTEXT);
+    secp256k1_ecmult_gen_context_build(&ret->ecmult_gen_ctx);
+    ret->declassify = !!(flags & SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY);
+
+    return ret;
+}
+
+secp256k1_context* secp256k1_context_create(unsigned int flags) {
+    size_t const prealloc_size = secp256k1_context_preallocated_size(flags);
+    secp256k1_context* ctx = (secp256k1_context*)checked_malloc(&default_error_callback, prealloc_size);
+    if (EXPECT(secp256k1_context_preallocated_create(ctx, flags) == NULL, 0)) {
+        free(ctx);
+        return NULL;
+    }
+
+    return ctx;
+}
+
+secp256k1_context* secp256k1_context_preallocated_clone(const secp256k1_context* ctx, void* prealloc) {
+    secp256k1_context* ret;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(prealloc != NULL);
+    ARG_CHECK(secp256k1_context_is_proper(ctx));
+
+    ret = (secp256k1_context*)prealloc;
+    *ret = *ctx;
+    return ret;
+}
+
+secp256k1_context* secp256k1_context_clone(const secp256k1_context* ctx) {
+    secp256k1_context* ret;
+    size_t prealloc_size;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(secp256k1_context_is_proper(ctx));
+
+    prealloc_size = secp256k1_context_preallocated_clone_size(ctx);
+    ret = (secp256k1_context*)checked_malloc(&ctx->error_callback, prealloc_size);
+    ret = secp256k1_context_preallocated_clone(ctx, ret);
+    return ret;
+}
+
+void secp256k1_context_preallocated_destroy(secp256k1_context* ctx) {
+    ARG_CHECK_VOID(ctx == NULL || secp256k1_context_is_proper(ctx));
+
+    /* Defined as noop */
+    if (ctx == NULL) {
+        return;
+    }
+
+    secp256k1_ecmult_gen_context_clear(&ctx->ecmult_gen_ctx);
+}
+
+void secp256k1_context_destroy(secp256k1_context* ctx) {
+    ARG_CHECK_VOID(ctx == NULL || secp256k1_context_is_proper(ctx));
+
+    /* Defined as noop */
+    if (ctx == NULL) {
+        return;
+    }
+
+    secp256k1_context_preallocated_destroy(ctx);
+    free(ctx);
+}
+
+void secp256k1_context_set_illegal_callback(secp256k1_context* ctx, void (*fun)(const char* message, void* data), const void* data) {
+    /* We compare pointers instead of checking secp256k1_context_is_proper() here
+       because setting callbacks is allowed on *copies* of the static context:
+       it's harmless and makes testing easier. */
+    ARG_CHECK_VOID(ctx != secp256k1_context_static);
+    if (fun == NULL) {
+        fun = secp256k1_default_illegal_callback_fn;
+    }
+    ctx->illegal_callback.fn = fun;
+    ctx->illegal_callback.data = data;
+}
+
+void secp256k1_context_set_error_callback(secp256k1_context* ctx, void (*fun)(const char* message, void* data), const void* data) {
+    /* We compare pointers instead of checking secp256k1_context_is_proper() here
+       because setting callbacks is allowed on *copies* of the static context:
+       it's harmless and makes testing easier. */
+    ARG_CHECK_VOID(ctx != secp256k1_context_static);
+    if (fun == NULL) {
+        fun = secp256k1_default_error_callback_fn;
+    }
+    ctx->error_callback.fn = fun;
+    ctx->error_callback.data = data;
+}
+
+static secp256k1_scratch_space* secp256k1_scratch_space_create(const secp256k1_context* ctx, size_t max_size) {
+    VERIFY_CHECK(ctx != NULL);
+    return secp256k1_scratch_create(&ctx->error_callback, max_size);
+}
+
+static void secp256k1_scratch_space_destroy(const secp256k1_context *ctx, secp256k1_scratch_space* scratch) {
+    VERIFY_CHECK(ctx != NULL);
+    secp256k1_scratch_destroy(&ctx->error_callback, scratch);
+}
+
+/* Mark memory as no-longer-secret for the purpose of analysing constant-time behaviour
+ *  of the software.
+ */
+static SECP256K1_INLINE void secp256k1_declassify(const secp256k1_context* ctx, const void *p, size_t len) {
+    if (EXPECT(ctx->declassify, 0)) SECP256K1_CHECKMEM_DEFINE(p, len);
+}
+
+static int secp256k1_pubkey_load(const secp256k1_context* ctx, secp256k1_ge* ge, const secp256k1_pubkey* pubkey) {
+    secp256k1_ge_from_bytes(ge, pubkey->data);
+    ARG_CHECK(!secp256k1_fe_is_zero(&ge->x));
+    return 1;
+}
+
+static void secp256k1_pubkey_save(secp256k1_pubkey* pubkey, secp256k1_ge* ge) {
+    secp256k1_ge_to_bytes(pubkey->data, ge);
+}
+
+int secp256k1_ec_pubkey_parse(const secp256k1_context* ctx, secp256k1_pubkey* pubkey, const unsigned char *input, size_t inputlen) {
+    secp256k1_ge Q;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(pubkey != NULL);
+    memset(pubkey, 0, sizeof(*pubkey));
+    ARG_CHECK(input != NULL);
+    if (!secp256k1_eckey_pubkey_parse(&Q, input, inputlen)) {
+        return 0;
+    }
+    if (!secp256k1_ge_is_in_correct_subgroup(&Q)) {
+        return 0;
+    }
+    secp256k1_pubkey_save(pubkey, &Q);
+    secp256k1_ge_clear(&Q);
+    return 1;
+}
+
+int secp256k1_ec_pubkey_serialize(const secp256k1_context* ctx, unsigned char *output, size_t *outputlen, const secp256k1_pubkey* pubkey, unsigned int flags) {
+    secp256k1_ge Q;
+    size_t len;
+    int ret = 0;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(outputlen != NULL);
+    ARG_CHECK(*outputlen >= ((flags & SECP256K1_FLAGS_BIT_COMPRESSION) ? 33u : 65u));
+    len = *outputlen;
+    *outputlen = 0;
+    ARG_CHECK(output != NULL);
+    memset(output, 0, len);
+    ARG_CHECK(pubkey != NULL);
+    ARG_CHECK((flags & SECP256K1_FLAGS_TYPE_MASK) == SECP256K1_FLAGS_TYPE_COMPRESSION);
+    if (secp256k1_pubkey_load(ctx, &Q, pubkey)) {
+        ret = secp256k1_eckey_pubkey_serialize(&Q, output, &len, flags & SECP256K1_FLAGS_BIT_COMPRESSION);
+        if (ret) {
+            *outputlen = len;
+        }
+    }
+    return ret;
+}
+
+int secp256k1_ec_pubkey_cmp(const secp256k1_context* ctx, const secp256k1_pubkey* pubkey0, const secp256k1_pubkey* pubkey1) {
+    unsigned char out[2][33];
+    const secp256k1_pubkey* pk[2];
+    int i;
+
+    VERIFY_CHECK(ctx != NULL);
+    pk[0] = pubkey0; pk[1] = pubkey1;
+    for (i = 0; i < 2; i++) {
+        size_t out_size = sizeof(out[i]);
+        /* If the public key is NULL or invalid, ec_pubkey_serialize will call
+         * the illegal_callback and return 0. In that case we will serialize the
+         * key as all zeros which is less than any valid public key. This
+         * results in consistent comparisons even if NULL or invalid pubkeys are
+         * involved and prevents edge cases such as sorting algorithms that use
+         * this function and do not terminate as a result. */
+        if (!secp256k1_ec_pubkey_serialize(ctx, out[i], &out_size, pk[i], SECP256K1_EC_COMPRESSED)) {
+            /* Note that ec_pubkey_serialize should already set the output to
+             * zero in that case, but it's not guaranteed by the API, we can't
+             * test it and writing a VERIFY_CHECK is more complex than
+             * explicitly memsetting (again). */
+            memset(out[i], 0, sizeof(out[i]));
+        }
+    }
+    return secp256k1_memcmp_var(out[0], out[1], sizeof(out[0]));
+}
+
+static int secp256k1_ec_pubkey_sort_cmp(const void* pk1, const void* pk2, void *ctx) {
+    return secp256k1_ec_pubkey_cmp((secp256k1_context *)ctx,
+                                     *(secp256k1_pubkey **)pk1,
+                                     *(secp256k1_pubkey **)pk2);
+}
+
+int secp256k1_ec_pubkey_sort(const secp256k1_context* ctx, const secp256k1_pubkey **pubkeys, size_t n_pubkeys) {
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(pubkeys != NULL);
+
+    /* Suppress wrong warning (fixed in MSVC 19.33) */
+    #if defined(_MSC_VER) && (_MSC_VER < 1933)
+    #pragma warning(push)
+    #pragma warning(disable: 4090)
+    #endif
+
+    /* Casting away const is fine because neither secp256k1_hsort nor
+     * secp256k1_ec_pubkey_sort_cmp modify the data pointed to by the cmp_data
+     * argument. */
+    secp256k1_hsort(pubkeys, n_pubkeys, sizeof(*pubkeys), secp256k1_ec_pubkey_sort_cmp, (void *)ctx);
+
+    #if defined(_MSC_VER) && (_MSC_VER < 1933)
+    #pragma warning(pop)
+    #endif
+
+    return 1;
+}
+
+static void secp256k1_ecdsa_signature_load(const secp256k1_context* ctx, secp256k1_scalar* r, secp256k1_scalar* s, const secp256k1_ecdsa_signature* sig) {
+    (void)ctx;
+    if (sizeof(secp256k1_scalar) == 32) {
+        /* When the secp256k1_scalar type is exactly 32 byte, use its
+         * representation inside secp256k1_ecdsa_signature, as conversion is very fast.
+         * Note that secp256k1_ecdsa_signature_save must use the same representation. */
+        memcpy(r, &sig->data[0], 32);
+        memcpy(s, &sig->data[32], 32);
+    } else {
+        secp256k1_scalar_set_b32(r, &sig->data[0], NULL);
+        secp256k1_scalar_set_b32(s, &sig->data[32], NULL);
+    }
+}
+
+static void secp256k1_ecdsa_signature_save(secp256k1_ecdsa_signature* sig, const secp256k1_scalar* r, const secp256k1_scalar* s) {
+    if (sizeof(secp256k1_scalar) == 32) {
+        memcpy(&sig->data[0], r, 32);
+        memcpy(&sig->data[32], s, 32);
+    } else {
+        secp256k1_scalar_get_b32(&sig->data[0], r);
+        secp256k1_scalar_get_b32(&sig->data[32], s);
+    }
+}
+
+int secp256k1_ecdsa_signature_parse_der(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) {
+    secp256k1_scalar r, s;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(sig != NULL);
+    ARG_CHECK(input != NULL);
+
+    if (secp256k1_ecdsa_sig_parse(&r, &s, input, inputlen)) {
+        secp256k1_ecdsa_signature_save(sig, &r, &s);
+        return 1;
+    } else {
+        memset(sig, 0, sizeof(*sig));
+        return 0;
+    }
+}
+
+int secp256k1_ecdsa_signature_parse_compact(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input64) {
+    secp256k1_scalar r, s;
+    int ret = 1;
+    int overflow = 0;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(sig != NULL);
+    ARG_CHECK(input64 != NULL);
+
+    secp256k1_scalar_set_b32(&r, &input64[0], &overflow);
+    ret &= !overflow;
+    secp256k1_scalar_set_b32(&s, &input64[32], &overflow);
+    ret &= !overflow;
+    if (ret) {
+        secp256k1_ecdsa_signature_save(sig, &r, &s);
+    } else {
+        memset(sig, 0, sizeof(*sig));
+    }
+    return ret;
+}
+
+int secp256k1_ecdsa_signature_serialize_der(const secp256k1_context* ctx, unsigned char *output, size_t *outputlen, const secp256k1_ecdsa_signature* sig) {
+    secp256k1_scalar r, s;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(output != NULL);
+    ARG_CHECK(outputlen != NULL);
+    ARG_CHECK(sig != NULL);
+
+    secp256k1_ecdsa_signature_load(ctx, &r, &s, sig);
+    return secp256k1_ecdsa_sig_serialize(output, outputlen, &r, &s);
+}
+
+int secp256k1_ecdsa_signature_serialize_compact(const secp256k1_context* ctx, unsigned char *output64, const secp256k1_ecdsa_signature* sig) {
+    secp256k1_scalar r, s;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(output64 != NULL);
+    ARG_CHECK(sig != NULL);
+
+    secp256k1_ecdsa_signature_load(ctx, &r, &s, sig);
+    secp256k1_scalar_get_b32(&output64[0], &r);
+    secp256k1_scalar_get_b32(&output64[32], &s);
+    return 1;
+}
+
+int secp256k1_ecdsa_signature_normalize(const secp256k1_context* ctx, secp256k1_ecdsa_signature *sigout, const secp256k1_ecdsa_signature *sigin) {
+    secp256k1_scalar r, s;
+    int ret = 0;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(sigin != NULL);
+
+    secp256k1_ecdsa_signature_load(ctx, &r, &s, sigin);
+    ret = secp256k1_scalar_is_high(&s);
+    if (sigout != NULL) {
+        if (ret) {
+            secp256k1_scalar_negate(&s, &s);
+        }
+        secp256k1_ecdsa_signature_save(sigout, &r, &s);
+    }
+
+    return ret;
+}
+
+int secp256k1_ecdsa_verify(const secp256k1_context* ctx, const secp256k1_ecdsa_signature *sig, const unsigned char *msghash32, const secp256k1_pubkey *pubkey) {
+    secp256k1_ge q;
+    secp256k1_scalar r, s;
+    secp256k1_scalar m;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(msghash32 != NULL);
+    ARG_CHECK(sig != NULL);
+    ARG_CHECK(pubkey != NULL);
+
+    secp256k1_scalar_set_b32(&m, msghash32, NULL);
+    secp256k1_ecdsa_signature_load(ctx, &r, &s, sig);
+    return (!secp256k1_scalar_is_high(&s) &&
+            secp256k1_pubkey_load(ctx, &q, pubkey) &&
+            secp256k1_ecdsa_sig_verify(&r, &s, &q, &m));
+}
+
+static SECP256K1_INLINE void buffer_append(unsigned char *buf, unsigned int *offset, const void *data, unsigned int len) {
+    memcpy(buf + *offset, data, len);
+    *offset += len;
+}
+
+static int nonce_function_rfc6979(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) {
+   unsigned char keydata[112];
+   unsigned int offset = 0;
+   secp256k1_rfc6979_hmac_sha256 rng;
+   unsigned int i;
+   secp256k1_scalar msg;
+   unsigned char msgmod32[32];
+   secp256k1_scalar_set_b32(&msg, msg32, NULL);
+   secp256k1_scalar_get_b32(msgmod32, &msg);
+   /* We feed a byte array to the PRNG as input, consisting of:
+    * - the private key (32 bytes) and reduced message (32 bytes), see RFC 6979 3.2d.
+    * - optionally 32 extra bytes of data, see RFC 6979 3.6 Additional Data.
+    * - optionally 16 extra bytes with the algorithm name.
+    * Because the arguments have distinct fixed lengths it is not possible for
+    *  different argument mixtures to emulate each other and result in the same
+    *  nonces.
+    */
+   buffer_append(keydata, &offset, key32, 32);
+   buffer_append(keydata, &offset, msgmod32, 32);
+   if (data != NULL) {
+       buffer_append(keydata, &offset, data, 32);
+   }
+   if (algo16 != NULL) {
+       buffer_append(keydata, &offset, algo16, 16);
+   }
+   secp256k1_rfc6979_hmac_sha256_initialize(&rng, keydata, offset);
+   for (i = 0; i <= counter; i++) {
+       secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32);
+   }
+   secp256k1_rfc6979_hmac_sha256_finalize(&rng);
+
+   secp256k1_memclear(keydata, sizeof(keydata));
+   secp256k1_rfc6979_hmac_sha256_clear(&rng);
+   return 1;
+}
+
+const secp256k1_nonce_function secp256k1_nonce_function_rfc6979 = nonce_function_rfc6979;
+const secp256k1_nonce_function secp256k1_nonce_function_default = nonce_function_rfc6979;
+
+static int secp256k1_ecdsa_sign_inner(const secp256k1_context* ctx, secp256k1_scalar* r, secp256k1_scalar* s, int* recid, const unsigned char *msg32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void* noncedata) {
+    secp256k1_scalar sec, non, msg;
+    int ret = 0;
+    int is_sec_valid;
+    unsigned char nonce32[32];
+    unsigned int count = 0;
+    /* Default initialization here is important so we won't pass uninit values to the cmov in the end */
+    *r = secp256k1_scalar_zero;
+    *s = secp256k1_scalar_zero;
+    if (recid) {
+        *recid = 0;
+    }
+    if (noncefp == NULL) {
+        noncefp = secp256k1_nonce_function_default;
+    }
+
+    /* Fail if the secret key is invalid. */
+    is_sec_valid = secp256k1_scalar_set_b32_seckey(&sec, seckey);
+    secp256k1_scalar_cmov(&sec, &secp256k1_scalar_one, !is_sec_valid);
+    secp256k1_scalar_set_b32(&msg, msg32, NULL);
+    while (1) {
+        int is_nonce_valid;
+        ret = !!noncefp(nonce32, msg32, seckey, NULL, (void*)noncedata, count);
+        if (!ret) {
+            break;
+        }
+        is_nonce_valid = secp256k1_scalar_set_b32_seckey(&non, nonce32);
+        /* The nonce is still secret here, but it being invalid is less likely than 1:2^255. */
+        secp256k1_declassify(ctx, &is_nonce_valid, sizeof(is_nonce_valid));
+        if (is_nonce_valid) {
+            ret = secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, r, s, &sec, &msg, &non, recid);
+            /* The final signature is no longer a secret, nor is the fact that we were successful or not. */
+            secp256k1_declassify(ctx, &ret, sizeof(ret));
+            if (ret) {
+                break;
+            }
+        }
+        count++;
+    }
+    /* We don't want to declassify is_sec_valid and therefore the range of
+     * seckey. As a result is_sec_valid is included in ret only after ret was
+     * used as a branching variable. */
+    ret &= is_sec_valid;
+    secp256k1_memclear(nonce32, sizeof(nonce32));
+    secp256k1_scalar_clear(&msg);
+    secp256k1_scalar_clear(&non);
+    secp256k1_scalar_clear(&sec);
+    secp256k1_scalar_cmov(r, &secp256k1_scalar_zero, !ret);
+    secp256k1_scalar_cmov(s, &secp256k1_scalar_zero, !ret);
+    if (recid) {
+        const int zero = 0;
+        secp256k1_int_cmov(recid, &zero, !ret);
+    }
+    return ret;
+}
+
+int secp256k1_ecdsa_sign(const secp256k1_context* ctx, secp256k1_ecdsa_signature *signature, const unsigned char *msghash32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void* noncedata) {
+    secp256k1_scalar r, s;
+    int ret;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx));
+    ARG_CHECK(msghash32 != NULL);
+    ARG_CHECK(signature != NULL);
+    ARG_CHECK(seckey != NULL);
+
+    ret = secp256k1_ecdsa_sign_inner(ctx, &r, &s, NULL, msghash32, seckey, noncefp, noncedata);
+    secp256k1_ecdsa_signature_save(signature, &r, &s);
+    return ret;
+}
+
+int secp256k1_ec_seckey_verify(const secp256k1_context* ctx, const unsigned char *seckey) {
+    secp256k1_scalar sec;
+    int ret;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(seckey != NULL);
+
+    ret = secp256k1_scalar_set_b32_seckey(&sec, seckey);
+    secp256k1_scalar_clear(&sec);
+    return ret;
+}
+
+static int secp256k1_ec_pubkey_create_helper(const secp256k1_ecmult_gen_context *ecmult_gen_ctx, secp256k1_scalar *seckey_scalar, secp256k1_ge *p, const unsigned char *seckey) {
+    secp256k1_gej pj;
+    int ret;
+
+    ret = secp256k1_scalar_set_b32_seckey(seckey_scalar, seckey);
+    secp256k1_scalar_cmov(seckey_scalar, &secp256k1_scalar_one, !ret);
+
+    secp256k1_ecmult_gen(ecmult_gen_ctx, &pj, seckey_scalar);
+    secp256k1_ge_set_gej(p, &pj);
+    secp256k1_gej_clear(&pj);
+    return ret;
+}
+
+int secp256k1_ec_pubkey_create(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *seckey) {
+    secp256k1_ge p;
+    secp256k1_scalar seckey_scalar;
+    int ret = 0;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(pubkey != NULL);
+    memset(pubkey, 0, sizeof(*pubkey));
+    ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx));
+    ARG_CHECK(seckey != NULL);
+
+    ret = secp256k1_ec_pubkey_create_helper(&ctx->ecmult_gen_ctx, &seckey_scalar, &p, seckey);
+    secp256k1_pubkey_save(pubkey, &p);
+    secp256k1_memczero(pubkey, sizeof(*pubkey), !ret);
+
+    secp256k1_scalar_clear(&seckey_scalar);
+    return ret;
+}
+
+int secp256k1_ec_seckey_negate(const secp256k1_context* ctx, unsigned char *seckey) {
+    secp256k1_scalar sec;
+    int ret = 0;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(seckey != NULL);
+
+    ret = secp256k1_scalar_set_b32_seckey(&sec, seckey);
+    secp256k1_scalar_cmov(&sec, &secp256k1_scalar_zero, !ret);
+    secp256k1_scalar_negate(&sec, &sec);
+    secp256k1_scalar_get_b32(seckey, &sec);
+
+    secp256k1_scalar_clear(&sec);
+    return ret;
+}
+
+int secp256k1_ec_privkey_negate(const secp256k1_context* ctx, unsigned char *seckey) {
+    return secp256k1_ec_seckey_negate(ctx, seckey);
+}
+
+int secp256k1_ec_pubkey_negate(const secp256k1_context* ctx, secp256k1_pubkey *pubkey) {
+    int ret = 0;
+    secp256k1_ge p;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(pubkey != NULL);
+
+    ret = secp256k1_pubkey_load(ctx, &p, pubkey);
+    memset(pubkey, 0, sizeof(*pubkey));
+    if (ret) {
+        secp256k1_ge_neg(&p, &p);
+        secp256k1_pubkey_save(pubkey, &p);
+    }
+    return ret;
+}
+
+
+static int secp256k1_ec_seckey_tweak_add_helper(secp256k1_scalar *sec, const unsigned char *tweak32) {
+    secp256k1_scalar term;
+    int overflow = 0;
+    int ret = 0;
+
+    secp256k1_scalar_set_b32(&term, tweak32, &overflow);
+    ret = (!overflow) & secp256k1_eckey_privkey_tweak_add(sec, &term);
+    secp256k1_scalar_clear(&term);
+    return ret;
+}
+
+int secp256k1_ec_seckey_tweak_add(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak32) {
+    secp256k1_scalar sec;
+    int ret = 0;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(seckey != NULL);
+    ARG_CHECK(tweak32 != NULL);
+
+    ret = secp256k1_scalar_set_b32_seckey(&sec, seckey);
+    ret &= secp256k1_ec_seckey_tweak_add_helper(&sec, tweak32);
+    secp256k1_scalar_cmov(&sec, &secp256k1_scalar_zero, !ret);
+    secp256k1_scalar_get_b32(seckey, &sec);
+
+    secp256k1_scalar_clear(&sec);
+    return ret;
+}
+
+int secp256k1_ec_privkey_tweak_add(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak32) {
+    return secp256k1_ec_seckey_tweak_add(ctx, seckey, tweak32);
+}
+
+static int secp256k1_ec_pubkey_tweak_add_helper(secp256k1_ge *p, const unsigned char *tweak32) {
+    secp256k1_scalar term;
+    int overflow = 0;
+    secp256k1_scalar_set_b32(&term, tweak32, &overflow);
+    return !overflow && secp256k1_eckey_pubkey_tweak_add(p, &term);
+}
+
+int secp256k1_ec_pubkey_tweak_add(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *tweak32) {
+    secp256k1_ge p;
+    int ret = 0;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(pubkey != NULL);
+    ARG_CHECK(tweak32 != NULL);
+
+    ret = secp256k1_pubkey_load(ctx, &p, pubkey);
+    memset(pubkey, 0, sizeof(*pubkey));
+    ret = ret && secp256k1_ec_pubkey_tweak_add_helper(&p, tweak32);
+    if (ret) {
+        secp256k1_pubkey_save(pubkey, &p);
+    }
+
+    return ret;
+}
+
+int secp256k1_ec_seckey_tweak_mul(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak32) {
+    secp256k1_scalar factor;
+    secp256k1_scalar sec;
+    int ret = 0;
+    int overflow = 0;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(seckey != NULL);
+    ARG_CHECK(tweak32 != NULL);
+
+    secp256k1_scalar_set_b32(&factor, tweak32, &overflow);
+    ret = secp256k1_scalar_set_b32_seckey(&sec, seckey);
+    ret &= (!overflow) & secp256k1_eckey_privkey_tweak_mul(&sec, &factor);
+    secp256k1_scalar_cmov(&sec, &secp256k1_scalar_zero, !ret);
+    secp256k1_scalar_get_b32(seckey, &sec);
+
+    secp256k1_scalar_clear(&sec);
+    secp256k1_scalar_clear(&factor);
+    return ret;
+}
+
+int secp256k1_ec_privkey_tweak_mul(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak32) {
+    return secp256k1_ec_seckey_tweak_mul(ctx, seckey, tweak32);
+}
+
+int secp256k1_ec_pubkey_tweak_mul(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *tweak32) {
+    secp256k1_ge p;
+    secp256k1_scalar factor;
+    int ret = 0;
+    int overflow = 0;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(pubkey != NULL);
+    ARG_CHECK(tweak32 != NULL);
+
+    secp256k1_scalar_set_b32(&factor, tweak32, &overflow);
+    ret = !overflow && secp256k1_pubkey_load(ctx, &p, pubkey);
+    memset(pubkey, 0, sizeof(*pubkey));
+    if (ret) {
+        if (secp256k1_eckey_pubkey_tweak_mul(&p, &factor)) {
+            secp256k1_pubkey_save(pubkey, &p);
+        } else {
+            ret = 0;
+        }
+    }
+
+    return ret;
+}
+
+int secp256k1_context_randomize(secp256k1_context* ctx, const unsigned char *seed32) {
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(secp256k1_context_is_proper(ctx));
+
+    if (secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx)) {
+        secp256k1_ecmult_gen_blind(&ctx->ecmult_gen_ctx, seed32);
+    }
+    return 1;
+}
+
+int secp256k1_ec_pubkey_combine(const secp256k1_context* ctx, secp256k1_pubkey *pubnonce, const secp256k1_pubkey * const *pubnonces, size_t n) {
+    size_t i;
+    secp256k1_gej Qj;
+    secp256k1_ge Q;
+
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(pubnonce != NULL);
+    memset(pubnonce, 0, sizeof(*pubnonce));
+    ARG_CHECK(n >= 1);
+    ARG_CHECK(pubnonces != NULL);
+
+    secp256k1_gej_set_infinity(&Qj);
+
+    for (i = 0; i < n; i++) {
+        ARG_CHECK(pubnonces[i] != NULL);
+        secp256k1_pubkey_load(ctx, &Q, pubnonces[i]);
+        secp256k1_gej_add_ge(&Qj, &Qj, &Q);
+    }
+    if (secp256k1_gej_is_infinity(&Qj)) {
+        return 0;
+    }
+    secp256k1_ge_set_gej(&Q, &Qj);
+    secp256k1_pubkey_save(pubnonce, &Q);
+    return 1;
+}
+
+int secp256k1_tagged_sha256(const secp256k1_context* ctx, unsigned char *hash32, const unsigned char *tag, size_t taglen, const unsigned char *msg, size_t msglen) {
+    secp256k1_sha256 sha;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(hash32 != NULL);
+    ARG_CHECK(tag != NULL);
+    ARG_CHECK(msg != NULL);
+
+    secp256k1_sha256_initialize_tagged(&sha, tag, taglen);
+    secp256k1_sha256_write(&sha, msg, msglen);
+    secp256k1_sha256_finalize(&sha, hash32);
+    secp256k1_sha256_clear(&sha);
+    return 1;
+}
+
+#ifdef ENABLE_MODULE_ECDH
+# include "modules/ecdh/main_impl.h"
+#endif
+
+#ifdef ENABLE_MODULE_RECOVERY
+# include "modules/recovery/main_impl.h"
+#endif
+
+#ifdef ENABLE_MODULE_EXTRAKEYS
+# include "modules/extrakeys/main_impl.h"
+#endif
+
+#ifdef ENABLE_MODULE_SCHNORRSIG
+# include "modules/schnorrsig/main_impl.h"
+#endif
+
+#ifdef ENABLE_MODULE_MUSIG
+# include "modules/musig/main_impl.h"
+#endif
+
+#ifdef ENABLE_MODULE_ELLSWIFT
+# include "modules/ellswift/main_impl.h"
+#endif
diff --git a/vendor/external/secp256k1/src/selftest.h b/vendor/external/secp256k1/src/selftest.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/selftest.h
@@ -0,0 +1,32 @@
+/***********************************************************************
+ * Copyright (c) 2020 Pieter Wuille                                    *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_SELFTEST_H
+#define SECP256K1_SELFTEST_H
+
+#include "hash.h"
+
+#include <string.h>
+
+static int secp256k1_selftest_sha256(void) {
+    static const char *input63 = "For this sample, this 63-byte string will be used as input data";
+    static const unsigned char output32[32] = {
+        0xf0, 0x8a, 0x78, 0xcb, 0xba, 0xee, 0x08, 0x2b, 0x05, 0x2a, 0xe0, 0x70, 0x8f, 0x32, 0xfa, 0x1e,
+        0x50, 0xc5, 0xc4, 0x21, 0xaa, 0x77, 0x2b, 0xa5, 0xdb, 0xb4, 0x06, 0xa2, 0xea, 0x6b, 0xe3, 0x42,
+    };
+    unsigned char out[32];
+    secp256k1_sha256 hasher;
+    secp256k1_sha256_initialize(&hasher);
+    secp256k1_sha256_write(&hasher, (const unsigned char*)input63, 63);
+    secp256k1_sha256_finalize(&hasher, out);
+    return secp256k1_memcmp_var(out, output32, 32) == 0;
+}
+
+static int secp256k1_selftest_passes(void) {
+    return secp256k1_selftest_sha256();
+}
+
+#endif /* SECP256K1_SELFTEST_H */
diff --git a/vendor/external/secp256k1/src/util.h b/vendor/external/secp256k1/src/util.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/secp256k1/src/util.h
@@ -0,0 +1,451 @@
+/***********************************************************************
+ * Copyright (c) 2013, 2014 Pieter Wuille                              *
+ * Distributed under the MIT software license, see the accompanying    *
+ * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
+ ***********************************************************************/
+
+#ifndef SECP256K1_UTIL_H
+#define SECP256K1_UTIL_H
+
+#include "../include/secp256k1.h"
+#include "checkmem.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <limits.h>
+#if defined(_MSC_VER)
+/* For SecureZeroMemory */
+#include <Windows.h>
+#endif
+
+#define STR_(x) #x
+#define STR(x) STR_(x)
+#define DEBUG_CONFIG_MSG(x) "DEBUG_CONFIG: " x
+#define DEBUG_CONFIG_DEF(x) DEBUG_CONFIG_MSG(#x "=" STR(x))
+
+/* Debug helper for printing arrays of unsigned char. */
+#define PRINT_BUF(buf, len) do { \
+    printf("%s[%lu] = ", #buf, (unsigned long)len); \
+    print_buf_plain(buf, len); \
+} while(0)
+
+static void print_buf_plain(const unsigned char *buf, size_t len) {
+    size_t i;
+    printf("{");
+    for (i = 0; i < len; i++) {
+        if (i % 8 == 0) {
+            printf("\n    ");
+        } else {
+            printf(" ");
+        }
+        printf("0x%02X,", buf[i]);
+    }
+    printf("\n}\n");
+}
+
+# if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
+#  if SECP256K1_GNUC_PREREQ(2,7)
+#   define SECP256K1_INLINE __inline__
+#  elif (defined(_MSC_VER))
+#   define SECP256K1_INLINE __inline
+#  else
+#   define SECP256K1_INLINE
+#  endif
+# else
+#  define SECP256K1_INLINE inline
+# endif
+
+/** Assert statically that expr is true.
+ *
+ * This is a statement-like macro and can only be used inside functions.
+ */
+#define STATIC_ASSERT(expr) do { \
+    switch(0) { \
+        case 0: \
+        /* If expr evaluates to 0, we have two case labels "0", which is illegal. */ \
+        case /* ERROR: static assertion failed */ (expr): \
+        ; \
+    } \
+} while(0)
+
+/** Assert statically that expr is an integer constant expression, and run stmt.
+ *
+ * Useful for example to enforce that magnitude arguments are constant.
+ */
+#define ASSERT_INT_CONST_AND_DO(expr, stmt) do { \
+    switch(42) { \
+        /* C allows only integer constant expressions as case labels. */ \
+        case /* ERROR: integer argument is not constant */ (expr): \
+            break; \
+        default: ; \
+    } \
+    stmt; \
+} while(0)
+
+typedef struct {
+    void (*fn)(const char *text, void* data);
+    const void* data;
+} secp256k1_callback;
+
+static SECP256K1_INLINE void secp256k1_callback_call(const secp256k1_callback * const cb, const char * const text) {
+    cb->fn(text, (void*)cb->data);
+}
+
+#ifndef USE_EXTERNAL_DEFAULT_CALLBACKS
+static void secp256k1_default_illegal_callback_fn(const char* str, void* data) {
+    (void)data;
+    fprintf(stderr, "[libsecp256k1] illegal argument: %s\n", str);
+    abort();
+}
+static void secp256k1_default_error_callback_fn(const char* str, void* data) {
+    (void)data;
+    fprintf(stderr, "[libsecp256k1] internal consistency check failed: %s\n", str);
+    abort();
+}
+#else
+void secp256k1_default_illegal_callback_fn(const char* str, void* data);
+void secp256k1_default_error_callback_fn(const char* str, void* data);
+#endif
+
+static const secp256k1_callback default_illegal_callback = {
+    secp256k1_default_illegal_callback_fn,
+    NULL
+};
+
+static const secp256k1_callback default_error_callback = {
+    secp256k1_default_error_callback_fn,
+    NULL
+};
+
+
+#ifdef DETERMINISTIC
+#define TEST_FAILURE(msg) do { \
+    fprintf(stderr, "%s\n", msg); \
+    abort(); \
+} while(0);
+#else
+#define TEST_FAILURE(msg) do { \
+    fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, msg); \
+    abort(); \
+} while(0)
+#endif
+
+#if SECP256K1_GNUC_PREREQ(3, 0)
+#define EXPECT(x,c) __builtin_expect((x),(c))
+#else
+#define EXPECT(x,c) (x)
+#endif
+
+#ifdef DETERMINISTIC
+#define CHECK(cond) do { \
+    if (EXPECT(!(cond), 0)) { \
+        TEST_FAILURE("test condition failed"); \
+    } \
+} while(0)
+#else
+#define CHECK(cond) do { \
+    if (EXPECT(!(cond), 0)) { \
+        TEST_FAILURE("test condition failed: " #cond); \
+    } \
+} while(0)
+#endif
+
+/* Like assert(), but when VERIFY is defined. */
+#if defined(VERIFY)
+#define VERIFY_CHECK CHECK
+#else
+#define VERIFY_CHECK(cond)
+#endif
+
+static SECP256K1_INLINE void *checked_malloc(const secp256k1_callback* cb, size_t size) {
+    void *ret = malloc(size);
+    if (ret == NULL) {
+        secp256k1_callback_call(cb, "Out of memory");
+    }
+    return ret;
+}
+
+#if defined(__BIGGEST_ALIGNMENT__)
+#define ALIGNMENT __BIGGEST_ALIGNMENT__
+#else
+/* Using 16 bytes alignment because common architectures never have alignment
+ * requirements above 8 for any of the types we care about. In addition we
+ * leave some room because currently we don't care about a few bytes. */
+#define ALIGNMENT 16
+#endif
+
+/* ceil(x/y) for integers x > 0 and y > 0. Here, / denotes rational division. */
+#define CEIL_DIV(x, y) (1 + ((x) - 1) / (y))
+
+#define ROUND_TO_ALIGN(size) (CEIL_DIV(size, ALIGNMENT) * ALIGNMENT)
+
+/* Macro for restrict, when available and not in a VERIFY build. */
+#if defined(SECP256K1_BUILD) && defined(VERIFY)
+# define SECP256K1_RESTRICT
+#else
+# if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
+#  if SECP256K1_GNUC_PREREQ(3,0)
+#   define SECP256K1_RESTRICT __restrict__
+#  elif (defined(_MSC_VER) && _MSC_VER >= 1400)
+#   define SECP256K1_RESTRICT __restrict
+#  else
+#   define SECP256K1_RESTRICT
+#  endif
+# else
+#  define SECP256K1_RESTRICT restrict
+# endif
+#endif
+
+#if defined(__GNUC__)
+# define SECP256K1_GNUC_EXT __extension__
+#else
+# define SECP256K1_GNUC_EXT
+#endif
+
+/* Zero memory if flag == 1. Flag must be 0 or 1. Constant time. */
+static SECP256K1_INLINE void secp256k1_memczero(void *s, size_t len, int flag) {
+    unsigned char *p = (unsigned char *)s;
+    /* Access flag with a volatile-qualified lvalue.
+       This prevents clang from figuring out (after inlining) that flag can
+       take only be 0 or 1, which leads to variable time code. */
+    volatile int vflag = flag;
+    unsigned char mask = -(unsigned char) vflag;
+    while (len) {
+        *p &= ~mask;
+        p++;
+        len--;
+    }
+}
+
+/* Cleanses memory to prevent leaking sensitive info. Won't be optimized out. */
+static SECP256K1_INLINE void secp256k1_memclear(void *ptr, size_t len) {
+#if defined(_MSC_VER)
+    /* SecureZeroMemory is guaranteed not to be optimized out by MSVC. */
+    SecureZeroMemory(ptr, len);
+#elif defined(__GNUC__)
+    /* We use a memory barrier that scares the compiler away from optimizing out the memset.
+     *
+     * Quoting Adam Langley <agl@google.com> in commit ad1907fe73334d6c696c8539646c21b11178f20f
+     * in BoringSSL (ISC License):
+     *    As best as we can tell, this is sufficient to break any optimisations that
+     *    might try to eliminate "superfluous" memsets.
+     * This method is used in memzero_explicit() the Linux kernel, too. Its advantage is that it
+     * is pretty efficient, because the compiler can still implement the memset() efficently,
+     * just not remove it entirely. See "Dead Store Elimination (Still) Considered Harmful" by
+     * Yang et al. (USENIX Security 2017) for more background.
+     */
+    memset(ptr, 0, len);
+    __asm__ __volatile__("" : : "r"(ptr) : "memory");
+#else
+    void *(*volatile const volatile_memset)(void *, int, size_t) = memset;
+    volatile_memset(ptr, 0, len);
+#endif
+#ifdef VERIFY
+    SECP256K1_CHECKMEM_UNDEFINE(ptr, len);
+#endif
+}
+
+/** Semantics like memcmp. Variable-time.
+ *
+ * We use this to avoid possible compiler bugs with memcmp, e.g.
+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189
+ */
+static SECP256K1_INLINE int secp256k1_memcmp_var(const void *s1, const void *s2, size_t n) {
+    const unsigned char *p1 = s1, *p2 = s2;
+    size_t i;
+
+    for (i = 0; i < n; i++) {
+        int diff = p1[i] - p2[i];
+        if (diff != 0) {
+            return diff;
+        }
+    }
+    return 0;
+}
+
+/* Return 1 if all elements of array s are 0 and otherwise return 0.
+ * Constant-time. */
+static SECP256K1_INLINE int secp256k1_is_zero_array(const unsigned char *s, size_t len) {
+    unsigned char acc = 0;
+    int ret;
+    size_t i;
+
+    for (i = 0; i < len; i++) {
+        acc |= s[i];
+    }
+    ret = (acc == 0);
+    /* acc may contain secret values. Try to explicitly clear it. */
+    secp256k1_memclear(&acc, sizeof(acc));
+    return ret;
+}
+
+/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time.  Both *r and *a must be initialized and non-negative.*/
+static SECP256K1_INLINE void secp256k1_int_cmov(int *r, const int *a, int flag) {
+    unsigned int mask0, mask1, r_masked, a_masked;
+    /* Access flag with a volatile-qualified lvalue.
+       This prevents clang from figuring out (after inlining) that flag can
+       take only be 0 or 1, which leads to variable time code. */
+    volatile int vflag = flag;
+
+    /* Casting a negative int to unsigned and back to int is implementation defined behavior */
+    VERIFY_CHECK(*r >= 0 && *a >= 0);
+
+    mask0 = (unsigned int)vflag + ~0u;
+    mask1 = ~mask0;
+    r_masked = ((unsigned int)*r & mask0);
+    a_masked = ((unsigned int)*a & mask1);
+
+    *r = (int)(r_masked | a_masked);
+}
+
+#if defined(USE_FORCE_WIDEMUL_INT128_STRUCT)
+/* If USE_FORCE_WIDEMUL_INT128_STRUCT is set, use int128_struct. */
+# define SECP256K1_WIDEMUL_INT128 1
+# define SECP256K1_INT128_STRUCT 1
+#elif defined(USE_FORCE_WIDEMUL_INT128)
+/* If USE_FORCE_WIDEMUL_INT128 is set, use int128. */
+# define SECP256K1_WIDEMUL_INT128 1
+# define SECP256K1_INT128_NATIVE 1
+#elif defined(USE_FORCE_WIDEMUL_INT64)
+/* If USE_FORCE_WIDEMUL_INT64 is set, use int64. */
+# define SECP256K1_WIDEMUL_INT64 1
+#elif defined(UINT128_MAX) || defined(__SIZEOF_INT128__)
+/* If a native 128-bit integer type exists, use int128. */
+# define SECP256K1_WIDEMUL_INT128 1
+# define SECP256K1_INT128_NATIVE 1
+#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
+/* On 64-bit MSVC targets (x86_64 and arm64), use int128_struct
+ * (which has special logic to implement using intrinsics on those systems). */
+# define SECP256K1_WIDEMUL_INT128 1
+# define SECP256K1_INT128_STRUCT 1
+#elif SIZE_MAX > 0xffffffff
+/* Systems with 64-bit pointers (and thus registers) very likely benefit from
+ * using 64-bit based arithmetic (even if we need to fall back to 32x32->64 based
+ * multiplication logic). */
+# define SECP256K1_WIDEMUL_INT128 1
+# define SECP256K1_INT128_STRUCT 1
+#else
+/* Lastly, fall back to int64 based arithmetic. */
+# define SECP256K1_WIDEMUL_INT64 1
+#endif
+
+#ifndef __has_builtin
+#define __has_builtin(x) 0
+#endif
+
+/* Determine the number of trailing zero bits in a (non-zero) 32-bit x.
+ * This function is only intended to be used as fallback for
+ * secp256k1_ctz32_var, but permits it to be tested separately. */
+static SECP256K1_INLINE int secp256k1_ctz32_var_debruijn(uint32_t x) {
+    static const uint8_t debruijn[32] = {
+        0x00, 0x01, 0x02, 0x18, 0x03, 0x13, 0x06, 0x19, 0x16, 0x04, 0x14, 0x0A,
+        0x10, 0x07, 0x0C, 0x1A, 0x1F, 0x17, 0x12, 0x05, 0x15, 0x09, 0x0F, 0x0B,
+        0x1E, 0x11, 0x08, 0x0E, 0x1D, 0x0D, 0x1C, 0x1B
+    };
+    return debruijn[(uint32_t)((x & -x) * 0x04D7651FU) >> 27];
+}
+
+/* Determine the number of trailing zero bits in a (non-zero) 64-bit x.
+ * This function is only intended to be used as fallback for
+ * secp256k1_ctz64_var, but permits it to be tested separately. */
+static SECP256K1_INLINE int secp256k1_ctz64_var_debruijn(uint64_t x) {
+    static const uint8_t debruijn[64] = {
+        0, 1, 2, 53, 3, 7, 54, 27, 4, 38, 41, 8, 34, 55, 48, 28,
+        62, 5, 39, 46, 44, 42, 22, 9, 24, 35, 59, 56, 49, 18, 29, 11,
+        63, 52, 6, 26, 37, 40, 33, 47, 61, 45, 43, 21, 23, 58, 17, 10,
+        51, 25, 36, 32, 60, 20, 57, 16, 50, 31, 19, 15, 30, 14, 13, 12
+    };
+    return debruijn[(uint64_t)((x & -x) * 0x022FDD63CC95386DU) >> 58];
+}
+
+/* Determine the number of trailing zero bits in a (non-zero) 32-bit x. */
+static SECP256K1_INLINE int secp256k1_ctz32_var(uint32_t x) {
+    VERIFY_CHECK(x != 0);
+#if (__has_builtin(__builtin_ctz) || SECP256K1_GNUC_PREREQ(3,4))
+    /* If the unsigned type is sufficient to represent the largest uint32_t, consider __builtin_ctz. */
+    if (((unsigned)UINT32_MAX) == UINT32_MAX) {
+        return __builtin_ctz(x);
+    }
+#endif
+#if (__has_builtin(__builtin_ctzl) || SECP256K1_GNUC_PREREQ(3,4))
+    /* Otherwise consider __builtin_ctzl (the unsigned long type is always at least 32 bits). */
+    return __builtin_ctzl(x);
+#else
+    /* If no suitable CTZ builtin is available, use a (variable time) software emulation. */
+    return secp256k1_ctz32_var_debruijn(x);
+#endif
+}
+
+/* Determine the number of trailing zero bits in a (non-zero) 64-bit x. */
+static SECP256K1_INLINE int secp256k1_ctz64_var(uint64_t x) {
+    VERIFY_CHECK(x != 0);
+#if (__has_builtin(__builtin_ctzl) || SECP256K1_GNUC_PREREQ(3,4))
+    /* If the unsigned long type is sufficient to represent the largest uint64_t, consider __builtin_ctzl. */
+    if (((unsigned long)UINT64_MAX) == UINT64_MAX) {
+        return __builtin_ctzl(x);
+    }
+#endif
+#if (__has_builtin(__builtin_ctzll) || SECP256K1_GNUC_PREREQ(3,4))
+    /* Otherwise consider __builtin_ctzll (the unsigned long long type is always at least 64 bits). */
+    return __builtin_ctzll(x);
+#else
+    /* If no suitable CTZ builtin is available, use a (variable time) software emulation. */
+    return secp256k1_ctz64_var_debruijn(x);
+#endif
+}
+
+/* Read a uint32_t in big endian */
+SECP256K1_INLINE static uint32_t secp256k1_read_be32(const unsigned char* p) {
+    return (uint32_t)p[0] << 24 |
+           (uint32_t)p[1] << 16 |
+           (uint32_t)p[2] << 8  |
+           (uint32_t)p[3];
+}
+
+/* Write a uint32_t in big endian */
+SECP256K1_INLINE static void secp256k1_write_be32(unsigned char* p, uint32_t x) {
+    p[3] = x;
+    p[2] = x >>  8;
+    p[1] = x >> 16;
+    p[0] = x >> 24;
+}
+
+/* Read a uint64_t in big endian */
+SECP256K1_INLINE static uint64_t secp256k1_read_be64(const unsigned char* p) {
+    return (uint64_t)p[0] << 56 |
+           (uint64_t)p[1] << 48 |
+           (uint64_t)p[2] << 40 |
+           (uint64_t)p[3] << 32 |
+           (uint64_t)p[4] << 24 |
+           (uint64_t)p[5] << 16 |
+           (uint64_t)p[6] << 8  |
+           (uint64_t)p[7];
+}
+
+/* Write a uint64_t in big endian */
+SECP256K1_INLINE static void secp256k1_write_be64(unsigned char* p, uint64_t x) {
+    p[7] = x;
+    p[6] = x >>  8;
+    p[5] = x >> 16;
+    p[4] = x >> 24;
+    p[3] = x >> 32;
+    p[2] = x >> 40;
+    p[1] = x >> 48;
+    p[0] = x >> 56;
+}
+
+/* Rotate a uint32_t to the right. */
+SECP256K1_INLINE static uint32_t secp256k1_rotr32(const uint32_t x, const unsigned int by) {
+#if defined(_MSC_VER)
+    return _rotr(x, by);  /* needs <stdlib.h> */
+#else
+    /* Reduce rotation amount to avoid UB when shifting. */
+    const unsigned int mask = CHAR_BIT * sizeof(x) - 1;
+    /* Turned into a rot instruction by GCC and clang. */
+    return (x >> (by & mask)) | (x << ((-by) & mask));
+#endif
+}
+
+#endif /* SECP256K1_UTIL_H */
diff --git a/vendor/external/sha3/LICENSE b/vendor/external/sha3/LICENSE
new file mode 100644
--- /dev/null
+++ b/vendor/external/sha3/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Markku-Juhani O. Saarinen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/vendor/external/sha3/VERSION.txt b/vendor/external/sha3/VERSION.txt
new file mode 100644
--- /dev/null
+++ b/vendor/external/sha3/VERSION.txt
@@ -0,0 +1,26 @@
+Upstream:  tiny_sha3 (Markku-Juhani O. Saarinen)
+Origin:    https://github.com/mjosaarinen/tiny_sha3
+Commit:    dcbb3192047c2a721f5f851db591871d428036a9
+License:   MIT (see LICENSE in this directory)
+
+Vendored files:
+  sha3.c, sha3.h   - the Keccak-f[1600] permutation and the OpenSSL-style
+                     init/update/final sponge API.
+  LICENSE          - upstream MIT license, copied verbatim.
+
+Provides both digests required by Plutus, which share the Keccak-f permutation
+and the 136-byte rate for a 256-bit output and differ only in the domain pad
+byte appended at finalization:
+  - SHA3-256 : pad byte 0x06 (FIPS-202), via sha3_final().
+  - Keccak-256 (Ethereum-style) : pad byte 0x01, via sha3_final_pad().
+
+Removed from the upstream sources to keep this lean:
+  - main.c, Makefile, README.md (test driver and build glue, not vendored).
+  - The SHAKE128/SHAKE256 extensible-output functions (shake_xof, shake_out)
+    and their convenience macros from sha3.h/sha3.c - not needed by Plutus.
+
+Added (cardano-c local change, no upstream copyright text altered):
+  - sha3_final_pad(md, c, pad): the upstream sha3_final body parameterized by
+    the pad byte so both SHA3-256 (0x06) and Keccak-256 (0x01) are produced
+    from the same vendored permutation. The original sha3_final is kept and
+    now delegates to sha3_final_pad(md, c, 0x06), preserving its behaviour.
diff --git a/vendor/external/sha3/sha3.c b/vendor/external/sha3/sha3.c
new file mode 100644
--- /dev/null
+++ b/vendor/external/sha3/sha3.c
@@ -0,0 +1,172 @@
+// sha3.c
+// 19-Nov-11  Markku-Juhani O. Saarinen <mjos@iki.fi>
+
+// Revised 07-Aug-15 to match with official release of FIPS PUB 202 "SHA3"
+// Revised 03-Sep-15 for portability + OpenSSL - style API
+
+#include "sha3.h"
+
+// update the state with given number of rounds
+
+void sha3_keccakf(uint64_t st[25])
+{
+    // constants
+    const uint64_t keccakf_rndc[24] = {
+        0x0000000000000001, 0x0000000000008082, 0x800000000000808a,
+        0x8000000080008000, 0x000000000000808b, 0x0000000080000001,
+        0x8000000080008081, 0x8000000000008009, 0x000000000000008a,
+        0x0000000000000088, 0x0000000080008009, 0x000000008000000a,
+        0x000000008000808b, 0x800000000000008b, 0x8000000000008089,
+        0x8000000000008003, 0x8000000000008002, 0x8000000000000080,
+        0x000000000000800a, 0x800000008000000a, 0x8000000080008081,
+        0x8000000000008080, 0x0000000080000001, 0x8000000080008008
+    };
+    const int keccakf_rotc[24] = {
+        1,  3,  6,  10, 15, 21, 28, 36, 45, 55, 2,  14,
+        27, 41, 56, 8,  25, 43, 62, 18, 39, 61, 20, 44
+    };
+    const int keccakf_piln[24] = {
+        10, 7,  11, 17, 18, 3, 5,  16, 8,  21, 24, 4,
+        15, 23, 19, 13, 12, 2, 20, 14, 22, 9,  6,  1
+    };
+
+    // variables
+    int i, j, r;
+    uint64_t t, bc[5];
+
+#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
+    uint8_t *v;
+
+    // endianess conversion. this is redundant on little-endian targets
+    for (i = 0; i < 25; i++) {
+        v = (uint8_t *) &st[i];
+        st[i] = ((uint64_t) v[0])     | (((uint64_t) v[1]) << 8) |
+            (((uint64_t) v[2]) << 16) | (((uint64_t) v[3]) << 24) |
+            (((uint64_t) v[4]) << 32) | (((uint64_t) v[5]) << 40) |
+            (((uint64_t) v[6]) << 48) | (((uint64_t) v[7]) << 56);
+    }
+#endif
+
+    // actual iteration
+    for (r = 0; r < KECCAKF_ROUNDS; r++) {
+
+        // Theta
+        for (i = 0; i < 5; i++)
+            bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20];
+
+        for (i = 0; i < 5; i++) {
+            t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1);
+            for (j = 0; j < 25; j += 5)
+                st[j + i] ^= t;
+        }
+
+        // Rho Pi
+        t = st[1];
+        for (i = 0; i < 24; i++) {
+            j = keccakf_piln[i];
+            bc[0] = st[j];
+            st[j] = ROTL64(t, keccakf_rotc[i]);
+            t = bc[0];
+        }
+
+        //  Chi
+        for (j = 0; j < 25; j += 5) {
+            for (i = 0; i < 5; i++)
+                bc[i] = st[j + i];
+            for (i = 0; i < 5; i++)
+                st[j + i] ^= (~bc[(i + 1) % 5]) & bc[(i + 2) % 5];
+        }
+
+        //  Iota
+        st[0] ^= keccakf_rndc[r];
+    }
+
+#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
+    // endianess conversion. this is redundant on little-endian targets
+    for (i = 0; i < 25; i++) {
+        v = (uint8_t *) &st[i];
+        t = st[i];
+        v[0] = t & 0xFF;
+        v[1] = (t >> 8) & 0xFF;
+        v[2] = (t >> 16) & 0xFF;
+        v[3] = (t >> 24) & 0xFF;
+        v[4] = (t >> 32) & 0xFF;
+        v[5] = (t >> 40) & 0xFF;
+        v[6] = (t >> 48) & 0xFF;
+        v[7] = (t >> 56) & 0xFF;
+    }
+#endif
+}
+
+// Initialize the context for SHA3
+
+int sha3_init(sha3_ctx_t *c, int mdlen)
+{
+    int i;
+
+    for (i = 0; i < 25; i++)
+        c->st.q[i] = 0;
+    c->mdlen = mdlen;
+    c->rsiz = 200 - 2 * mdlen;
+    c->pt = 0;
+
+    return 1;
+}
+
+// update state with more data
+
+int sha3_update(sha3_ctx_t *c, const void *data, size_t len)
+{
+    size_t i;
+    int j;
+
+    j = c->pt;
+    for (i = 0; i < len; i++) {
+        c->st.b[j++] ^= ((const uint8_t *) data)[i];
+        if (j >= c->rsiz) {
+            sha3_keccakf(c->st.q);
+            j = 0;
+        }
+    }
+    c->pt = j;
+
+    return 1;
+}
+
+// finalize and output a hash with the given pad byte
+// (0x06 = FIPS-202 SHA-3, 0x01 = original Keccak)
+
+int sha3_final_pad(void *md, sha3_ctx_t *c, uint8_t pad)
+{
+    int i;
+
+    c->st.b[c->pt] ^= pad;
+    c->st.b[c->rsiz - 1] ^= 0x80;
+    sha3_keccakf(c->st.q);
+
+    for (i = 0; i < c->mdlen; i++) {
+        ((uint8_t *) md)[i] = c->st.b[i];
+    }
+
+    return 1;
+}
+
+// finalize and output a hash
+
+int sha3_final(void *md, sha3_ctx_t *c)
+{
+    return sha3_final_pad(md, c, 0x06);
+}
+
+// compute a SHA-3 hash (md) of given byte length from "in"
+
+void *sha3(const void *in, size_t inlen, void *md, int mdlen)
+{
+    sha3_ctx_t sha3;
+
+    sha3_init(&sha3, mdlen);
+    sha3_update(&sha3, in, inlen);
+    sha3_final(md, &sha3);
+
+    return md;
+}
diff --git a/vendor/external/sha3/sha3.h b/vendor/external/sha3/sha3.h
new file mode 100644
--- /dev/null
+++ b/vendor/external/sha3/sha3.h
@@ -0,0 +1,43 @@
+// sha3.h
+// 19-Nov-11  Markku-Juhani O. Saarinen <mjos@iki.fi>
+
+#ifndef SHA3_H
+#define SHA3_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#ifndef KECCAKF_ROUNDS
+#define KECCAKF_ROUNDS 24
+#endif
+
+#ifndef ROTL64
+#define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y))))
+#endif
+
+// state context
+typedef struct {
+    union {                                 // state:
+        uint8_t b[200];                     // 8-bit bytes
+        uint64_t q[25];                     // 64-bit words
+    } st;
+    int pt, rsiz, mdlen;                    // these don't overflow
+} sha3_ctx_t;
+
+// Compression function.
+void sha3_keccakf(uint64_t st[25]);
+
+// OpenSSL - like interfece
+int sha3_init(sha3_ctx_t *c, int mdlen);    // mdlen = hash output in bytes
+int sha3_update(sha3_ctx_t *c, const void *data, size_t len);
+int sha3_final(void *md, sha3_ctx_t *c);    // digest goes to md
+
+// Same as sha3_final but with an explicit domain-separation/pad byte:
+// 0x06 yields FIPS-202 SHA-3, 0x01 yields the original (Ethereum) Keccak.
+// Added for cardano-c; not part of the upstream tiny_sha3 API.
+int sha3_final_pad(void *md, sha3_ctx_t *c, uint8_t pad);
+
+// compute a sha3 hash (md) of given byte length from "in"
+void *sha3(const void *in, size_t inlen, void *md, int mdlen);
+
+#endif
diff --git a/vendor/include/cardano/address/address.h b/vendor/include/cardano/address/address.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/address/address.h
@@ -0,0 +1,916 @@
+/**
+ * \file address.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address_type.h>
+#include <cardano/common/network_id.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* FORWARD DECLARATIONS *****************************************************/
+
+/**
+ * \brief Defines a pointer to a structure representing a Cardano base address.
+ */
+typedef struct cardano_base_address_t cardano_base_address_t;
+
+/**
+ * \brief Represents a Byron-era address in the Cardano blockchain.
+ */
+typedef struct cardano_byron_address_t cardano_byron_address_t;
+
+/**
+ * \brief Represents an enterprise address in the Cardano blockchain ecosystem.
+ *
+ * Enterprise addresses carry no stake rights, so using these addresses means that you are opting out of participation
+ * in the proof-of-stake protocol.
+ *
+ * Note that using addresses with no stake rights effectively decreases the total amount of stake, which plays
+ * into the hands of a potential adversary.
+ */
+typedef struct cardano_enterprise_address_t cardano_enterprise_address_t;
+
+/**
+ * \brief Represents a pointer address in the Cardano blockchain ecosystem.
+ *
+ * A pointer address indirectly specifies the stake key that should control the stake for the address. It references
+ * a stake key by a stake key pointer, which is a location on the blockchain of the stake key registration certificate
+ * for that key.
+ */
+typedef struct cardano_pointer_address_t cardano_pointer_address_t;
+
+/**
+ * \brief Represents a reward address in the Cardano blockchain ecosystem.
+ */
+typedef struct cardano_reward_address_t cardano_reward_address_t;
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a Cardano address.
+ *
+ * This structure encapsulates all the necessary information for a Cardano address.
+ */
+typedef struct cardano_address_t cardano_address_t;
+
+/**
+ * \brief Constructs a Cardano address from a serialized byte array.
+ *
+ * This function decodes a byte array into a \ref cardano_address_t object. The function ensures that the
+ * byte array provided conforms to the expected format for a Cardano address before creating the
+ * address object.
+ *
+ * \param[in] data A pointer to the byte array containing the serialized address data.
+ * \param[in] size The size of the byte array.
+ * \param[out] address A pointer to a pointer of \ref cardano_address_t that will be set to the
+ *                     address of the newly created address object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the address was successfully created, or an appropriate error code if an error occurred,
+ *         such as invalid format or insufficient data for decoding.
+ *
+ * \note The caller is responsible for freeing the created \ref cardano_address_t object by calling
+ *       \ref cardano_address_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t serialized_address[] = { ... };
+ * size_t size = sizeof(serialized_address);
+ * cardano_address_t* address = NULL;
+ *
+ * cardano_error_t result = cardano_address_from_bytes(serialized_address, size, &address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the address
+ *
+ *   // Clean up
+ *   cardano_address_unref(&address);
+ * }
+ * else
+ * {
+ *   printf("Failed to decode address: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_address_from_bytes(
+  const byte_t*       data,
+  size_t              size,
+  cardano_address_t** address);
+
+/**
+ * \brief Retrieves the size of the byte array required to serialize a Cardano address.
+ *
+ * This function calculates the number of bytes necessary to serialize the specified
+ * \ref cardano_address_t object. It is useful for allocating the appropriate amount of memory
+ * before serializing the address using \ref cardano_address_to_bytes.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_address_t object whose serialized
+ *                     size is to be determined. The object must not be NULL.
+ *
+ * \return The size in bytes required to store the serialized form of the address. If the input
+ *         address is NULL, the function returns 0, indicating an error in usage.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = cardano_address_from_bytes(...);
+ *
+ * if (address)
+ * {
+ *   size_t required_size = cardano_address_get_bytes_size(address);
+ *   byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ *   if (buffer)
+ *   {
+ *     // Serialize the address into buffer
+ *     cardano_address_to_bytes(address, buffer, required_size);
+ *     // Use the buffer ...
+ *     free(buffer);
+ *   }
+ *
+ *   // Clean up the address object
+ *   cardano_address_unref(&address);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_address_get_bytes_size(
+  const cardano_address_t* address);
+
+/**
+ * \brief Serializes a Cardano address into a byte array.
+ *
+ * This function serializes the given \ref cardano_address_t object into a preallocated buffer.
+ * The buffer must be large enough to hold the serialized data, which should be determined
+ * by calling \ref cardano_address_get_bytes_size prior to this function.
+ *
+ * \param[in] address  A constant pointer to the \ref cardano_address_t object that is to be serialized.
+ *                     The object must not be NULL.
+ * \param[out] data  A pointer to the buffer where the serialized data will be written.
+ * \param[in] size  The size of the buffer pointed to by \p data. It must be at least as large
+ *                  as the value returned by \ref cardano_address_get_bytes_size for successful serialization.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the buffer \p data
+ *         is too small, returns \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE. If \p address or \p data is NULL,
+ *         returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = cardano_address_from_bytes(...);
+ * size_t required_size = cardano_address_get_bytes_size(address);
+ * byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ * if (buffer)
+ * {
+ *   cardano_error_t result = cardano_address_to_bytes(address, buffer, required_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the serialized data
+ *   }
+ *
+ *   free(buffer);
+ * }
+ *
+ * cardano_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_address_to_bytes(
+  const cardano_address_t* address,
+  byte_t*                  data,
+  size_t                   size);
+
+/**
+ * \brief Retrieves a pointer to the internal byte array of a Cardano address.
+ *
+ * This function provides read-only access to the internal byte representation of a Cardano address.
+ * The returned pointer points directly to the internal data structure within the \ref cardano_address_t object.
+ * This approach avoids copying data and allows efficient access to the address's byte representation.
+ *
+ * \param[in] address  A constant pointer to the \ref cardano_address_t object whose byte array is to be accessed.
+ *
+ * \return A constant pointer to the internal byte array of the Cardano address. This pointer should not be modified
+ *         or freed by the caller, as it is managed internally by the Cardano library. The content pointed to remains
+ *         valid as long as the \ref cardano_address_t object itself is not freed or modified.
+ *
+ * \note Modifying or freeing the data pointed to by the returned pointer will lead to undefined behavior. Treat this pointer
+ * as read-only.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = cardano_address_from_bytes(...);
+ * const byte_t* byte_ptr = cardano_address_get_bytes(address);
+ *
+ * if (byte_ptr)
+ * {
+ *   // Read the bytes but do not modify them
+ * }
+ *
+ * cardano_address_unref(&address);  // This also invalidates byte_ptr
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_address_get_bytes(
+  const cardano_address_t* address);
+
+/**
+ * \brief Creates a Cardano address from a string representation.
+ *
+ * This function constructs a \ref cardano_address_t object by parsing the provided string. The string
+ * should contain a valid representation of a Cardano address, either in base58 or Bech32 format.
+ *
+ * \param[in] data A pointer to the character array containing the string representation of the address.
+ * \param[in] size The length of the string pointed to by \p data, not including the null terminator.
+ * \param[out] address A pointer to a pointer to \ref cardano_address_t that will be set to the address
+ *                     of the newly created Cardano address object upon successful parsing. The caller
+ *                     is responsible for managing the lifecycle of this object, including freeing it
+ *                     when it is no longer needed using \ref cardano_address_unref.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address is successfully created from the string. Returns
+ *         \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the string is not a valid address format. If the \p data is
+ *         NULL or \p address is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL. Returns
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if memory for the decoding buffers could not be allocated.
+ *         Allocation failures inside the Bech32 decoder itself are reported as \ref CARDANO_ERROR_DECODING.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* address_str = "addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x";
+ * size_t size = strlen(address_str);
+ * cardano_address_t* address = NULL;
+ *
+ * cardano_error_t result = cardano_address_from_string(address_str, size, &address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the address
+ * }
+ * else
+ * {
+ *   printf("Failed to parse address: %d\n", result);
+ * }
+ *
+ * // Clean up the address object once done
+ * cardano_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_address_from_string(
+  const char*         data,
+  size_t              size,
+  cardano_address_t** address);
+
+/**
+ * \brief Retrieves the size needed for the string representation of a Cardano address.
+ *
+ * This function calculates the size of the buffer required to hold the string representation
+ * of a \ref cardano_address_t object, including the null terminator. This size is necessary
+ * to ensure that the buffer allocated for converting the address to a string is sufficient.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_address_t object for which the string
+ *                    size is being calculated. The object must not be NULL.
+ *
+ * \return The size in bytes needed to store the string representation of the address, including
+ *         the null terminator. If the input \p address is NULL, the behavior is undefined.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = cardano_address_new(...);
+ * size_t required_size = cardano_address_get_string_size(address);
+ *
+ * char* address_str = (char*)malloc(required_size);
+ *
+ * if (address_str)
+ * {
+ *   cardano_error_t result = cardano_address_to_string(address, address_str, required_size);
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Address: %s\n", address_str);
+ *   }
+ *   free(address_str);
+ * }
+ *
+ * // Clean up the address object once done
+ * cardano_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_address_get_string_size(const cardano_address_t* address);
+
+/**
+ * \brief Converts a Cardano address into its string representation.
+ *
+ * This function serializes the given \ref cardano_address_t object into a string format.
+ * The string is written to a user-provided buffer, and the size of this buffer must be
+ * adequate to hold the entire string, including the null terminator. The required size
+ * can be determined by calling \ref cardano_address_get_string_size.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_address_t object that is to be converted to a string.
+ *                    The object must not be NULL.
+ * \param[out] data A pointer to the buffer where the string representation of the address will be written.
+ * \param[in] size The size of the buffer pointed to by \p data. This size should be at least as large as the value
+ *                 returned by \ref cardano_address_get_string_size to ensure successful serialization.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the conversion is successful. If the buffer is too small, returns
+ *         \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE. If the \p address or \p data is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = cardano_address_new(...);
+ * size_t required_size = cardano_address_get_string_size(address);
+ * char* address_str = (char*)malloc(required_size);
+ *
+ * if (address_str)
+ * {
+ *   cardano_error_t result = cardano_address_to_string(address, address_str, required_size);
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Address: %s\n", address_str);
+ *   }
+ *
+ *   free(address_str);
+ * }
+ *
+ * // Clean up the address object once done
+ * cardano_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_address_to_string(
+  const cardano_address_t* address,
+  char*                    data,
+  size_t                   size);
+
+/**
+ * \brief Retrieves the string representation of a Cardano address.
+ *
+ * This function provides access to the string form of the \ref cardano_address_t object. The function
+ * returns a pointer to a constant string which represents the address. This string should not be modified
+ * or freed by the user, as it is managed internally by the address object.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_address_t object from which
+ *                    the string is to be retrieved.
+ *
+ * \return A constant pointer to the internal string representation of the address. If the input
+ *         \p address is NULL, the return value is NULL, indicating an error.
+ *
+ * \note The returned string will remain valid as long as the \ref cardano_address_t object is not modified
+ *       or freed. Once \ref cardano_address_unref is called on the address object, the string pointer
+ *       should be considered invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = cardano_address_new(...);
+ * const char* address_str = cardano_address_get_string(address);
+ *
+ * if (address_str)
+ * {
+ *   printf("Address: %s\n", address_str);
+ * }
+ *
+ * // Clean up the address object once done
+ * cardano_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_address_get_string(const cardano_address_t* address);
+
+/**
+ * \brief Checks if the provided string is a valid Bech32-encoded Cardano address.
+ *
+ * This function verifies if the given string conforms to the Bech32 encoding format specific to Cardano addresses.
+ *
+ * \param[in] data A pointer to the character array containing the potential Bech32 address.
+ * \param[in] size The length of the string pointed to by \p data.
+ *
+ * \return \c true if the string is a valid Bech32-encoded Cardano address; otherwise, \c false.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* address = "addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgsqqxw8x";
+ * size_t address_length = strlen(address);
+ *
+ * bool is_valid = cardano_address_is_valid_bech32(address, address_length);
+ *
+ * if (is_valid)
+ * {
+ *   printf("The address is a valid Bech32 Cardano address.\n");
+ * }
+ * else
+ * {
+ *   printf("The address is not a valid Bech32 Cardano address.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_address_is_valid_bech32(const char* data, size_t size);
+
+/**
+ * \brief Checks if the provided string is a valid Byron-encoded Cardano address.
+ *
+ * This function verifies if the given string conforms to the Byron address encoding format used in earlier versions of the Cardano blockchain. It performs checks on the structure and integrity of the address, ensuring it follows the expected format and contains a valid checksum.
+ *
+ * \param[in] data A pointer to the character array containing the potential Byron address.
+ * \param[in] size The length of the string pointed to by \p data.
+ *
+ * \return \c true if the string is a valid Byron-encoded Cardano address; otherwise, \c false.
+ *
+ * \note This function does not modify the input string and does not allocate any dynamic memory.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* address = "Ae2tdPwUPEZFRbyhz3cpfC2CumGzNkFBN2L42rcUc2yjQpEkxDbkPodpMAi";
+ * size_t address_length = strlen(address);
+ *
+ * bool is_valid = cardano_address_is_valid_byron(address, address_length);
+ *
+ * if (is_valid)
+ * {
+ *   printf("The address is a valid Byron Cardano address.\n");
+ * }
+ * else
+ * {
+ *   printf("The address is not a valid Byron Cardano address.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_address_is_valid_byron(const char* data, size_t size);
+
+/**
+ * \brief Checks if the provided string is a valid Cardano address.
+ *
+ * This function verifies if the given string conforms to the encoding formats used for Cardano addresses,
+ * including both Byron and Shelley address formats. It checks the structure and integrity of the address, ensuring
+ * it follows the expected format.
+ *
+ * \param[in] data A pointer to the character array containing the potential Cardano address.
+ * \param[in] size The length of the string pointed to by \p data.
+ *
+ * \return \c true if the string is a valid Cardano address; otherwise, \c false.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* address = "addr1qxy2cnx2l2s54at80au205tswxpnuvsgsn9rqlat4zuyghqp6v3hj4t4c7szlevu9hxy6w2scv0hecqlq5v3x6jts0sqqx5scn";
+ * size_t address_length = strlen(address);
+ *
+ * bool is_valid = cardano_address_is_valid(address, address_length);
+ *
+ * if (is_valid)
+ * {
+ *   printf("The address is a valid Cardano address.\n");
+ * }
+ * else
+ * {
+ *   printf("The address is not a valid Cardano address.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_address_is_valid(const char* data, size_t size);
+
+/**
+ * \brief Retrieves the type of a given Cardano address.
+ *
+ * This function examines the provided \ref cardano_address_t object and determines its address type,
+ * such as whether it is a base, pointer, enterprise, reward, or Byron address. The address type is determined
+ * based on the structure and prefix of the address.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_address_t object whose type is to be determined.
+ *                    The object must not be NULL.
+ * \param[out] type A pointer to \ref cardano_address_type_t where the address type will be stored upon successful
+ *                  determination. This parameter cannot be NULL.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address type was successfully determined.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if the input address or type pointer is NULL.
+ *         Returns other error codes as defined in \ref cardano_error_t if the address type cannot be determined
+ *         due to the address not conforming to any known Cardano address format.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = NULL;
+ * cardano_address_type_t address_type;
+ *
+ * cardano_error_t result = cardano_address_from_string("addr1...", strlen("addr1..."), &address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   cardano_error_t get_type_result = cardano_address_get_type(address, &address_type);
+ *
+ *   if (get_type_result != CARDANO_SUCCESS)
+ *   {
+ *     printf("Failed to determine the address type.\n");
+ *   }
+ *   else
+ *   {
+ *     printf("Address type: %d\n", address_type);
+ *   }
+ * }
+ * else
+ * {
+ *   printf("Failed to determine the address type.\n");
+ * }
+ *
+ * cardano_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_address_get_type(
+  const cardano_address_t* address,
+  cardano_address_type_t*  type);
+
+/**
+ * \brief Retrieves the network ID from a given Cardano address.
+ *
+ * This function extracts the network identifier from the provided \ref cardano_address_t object.
+ * The network ID indicates whether the address belongs to the test network or the main network.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_address_t object from which the network ID is to be retrieved.
+ * \param[out] network_id A pointer to \ref cardano_network_id_t where the network ID will be stored upon successful
+ *                        extraction. This parameter cannot be NULL.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the network ID was successfully retrieved.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if the input address or network_id pointer is NULL.
+ *         Returns other error codes as defined in \ref cardano_error_t if the network ID cannot be retrieved due to
+ *         malformed or unrecognized address formats.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = NULL;
+ * cardano_network_id_t network_id;
+ *
+ * cardano_error_t result = cardano_address_from_string("addr1...", strlen("addr1..."), &address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   cardano_error_t get_network_id = cardano_address_get_network_id(address, &network_id);
+ *
+ *   if (get_network_id != CARDANO_SUCCESS)
+ *   {
+ *     printf("Failed to determine the address network id.\n");
+ *   }
+ *   else
+ *   {
+ *     printf("Network ID: %d\n", network_id);
+ *   }
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the network ID.\n");
+ * }
+ *
+ * cardano_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_address_get_network_id(
+  const cardano_address_t* address,
+  cardano_network_id_t*    network_id);
+
+/**
+ * \brief Converts a general Cardano address to a Byron-specific address format.
+ *
+ * This function creates a \ref cardano_byron_address_t object from a given \ref cardano_address_t object.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_address_t object to be converted.
+ *                    The object must not be NULL and must represent a valid Byron address.
+ *
+ * \return A pointer to a newly created \ref cardano_byron_address_t object if the conversion is successful.
+ *         Returns NULL if the address cannot be converted to a Byron address due to an invalid format or
+ *         if the provided address does not correspond to a Byron address. The caller is responsible for managing
+ *         the lifecycle of the returned object, including freeing it when it is no longer needed using
+ *         \ref cardano_byron_address_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* byron_address = cardano_address_to_byron_address(address);
+ *
+ * if (byron_address)
+ * {
+ *   // Byron address is successfully converted
+ *   // Proceed with operations that require a Byron address
+ *
+ *   cardano_byron_address_unref(&byron_address);
+ * }
+ * else
+ * {
+ *   printf("Conversion to Byron address format failed.\n");
+ * }
+ *
+ * cardano_address_unref(&shelley_address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_byron_address_t* cardano_address_to_byron_address(const cardano_address_t* address);
+
+/**
+ * \brief Converts a general Cardano address to a reward-specific address format.
+ *
+ * This function creates a \ref cardano_reward_address_t object from a given \ref cardano_address_t object.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_address_t object to be converted.
+ *                    The object must not be NULL and must represent a valid reward address.
+ *
+ * \return A pointer to a newly created \ref cardano_reward_address_t object if the conversion is successful.
+ *         Returns NULL if the address cannot be converted to a reward address due to an invalid format or
+ *         if the provided address does not correspond to a reward address. The caller is responsible for managing
+ *         the lifecycle of the returned object, including freeing it when it is no longer needed using
+ *         \ref cardano_reward_address_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_t* reward_address = cardano_address_to_reward_address(address);
+ *
+ * if (reward_address)
+ * {
+ *   // Reward address is successfully converted
+ *   // Proceed with operations that require a reward address
+ *
+ *   cardano_reward_address_unref(&reward_address);
+ * }
+ * else
+ * {
+ *   printf("Conversion to reward address format failed.\n");
+ * }
+ *
+ * cardano_address_unref(&general_address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_reward_address_t* cardano_address_to_reward_address(const cardano_address_t* address);
+
+/**
+ * \brief Converts a general Cardano address to a pointer address format.
+ *
+ * This function creates a \ref cardano_pointer_address_t object from a given \ref cardano_address_t object.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_address_t object to be converted.
+ *                    The object must not be NULL and must represent a valid pointer address.
+ *
+ * \return A pointer to a newly created \ref cardano_pointer_address_t object if the conversion is successful.
+ *         Returns NULL if the address cannot be converted to a pointer address due to an invalid format or
+ *         if the provided address does not correspond to a pointer address. The caller is responsible for managing
+ *         the lifecycle of the returned object, including freeing it when it is no longer needed using
+ *         \ref cardano_pointer_address_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = ...;
+ * cardano_pointer_address_t* pointer_address = cardano_address_to_pointer_address(address);
+ *
+ * if (pointer_address)
+ * {
+ *   // Pointer address is successfully converted
+ *   // Proceed with operations that require a pointer address
+ *
+ *   cardano_pointer_address_unref(&pointer_address);
+ * }
+ * else
+ * {
+ *   printf("Conversion to pointer address format failed.\n");
+ * }
+ *
+ * cardano_address_unref(&general_address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_pointer_address_t* cardano_address_to_pointer_address(const cardano_address_t* address);
+
+/**
+ * \brief Converts a general Cardano address to an enterprise address format.
+ *
+ * This function creates a \ref cardano_enterprise_address_t object from a given \ref cardano_address_t object.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_address_t object to be converted.
+ *                    The object must not be NULL and must represent a valid enterprise address.
+ *
+ * \return A pointer to a newly created \ref cardano_enterprise_address_t object if the conversion is successful.
+ *         Returns NULL if the address cannot be converted to an enterprise address due to an invalid format or
+ *         if the provided address does not correspond to an enterprise address. The caller is responsible for managing
+ *         the lifecycle of the returned object, including freeing it when it is no longer needed using
+ *         \ref cardano_enterprise_address_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = ...;
+ * cardano_enterprise_address_t* enterprise_address = cardano_address_to_enterprise_address(address);
+ *
+ * if (enterprise_address)
+ * {
+ *   // Enterprise address is successfully converted
+ *   // Proceed with operations that require an enterprise address
+ *
+ *   cardano_enterprise_address_unref(&enterprise_address);
+ * }
+ * else
+ * {
+ *   printf("Conversion to enterprise address format failed.\n");
+ * }
+ *
+ * cardano_address_unref(&general_address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_enterprise_address_t* cardano_address_to_enterprise_address(const cardano_address_t* address);
+
+/**
+ * \brief Converts a general Cardano address to a base address format.
+ *
+ * This function creates a \ref cardano_base_address_t object from a given \ref cardano_address_t object.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_address_t object to be converted.
+ *                    The object must not be NULL and must represent a valid base address.
+ *
+ * \return A pointer to a newly created \ref cardano_base_address_t object if the conversion is successful.
+ *         Returns NULL if the address cannot be converted to a base address due to an invalid format or
+ *         if the provided address does not correspond to a base address. The caller is responsible for managing
+ *         the lifecycle of the returned object, including freeing it when it is no longer needed using
+ *         \ref cardano_base_address_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = ...;
+ * cardano_base_address_t* base_address = cardano_address_to_base_address(address);
+ *
+ * if (base_address)
+ * {
+ *   // Base address is successfully converted
+ *   // Proceed with operations that require a base address
+ *
+ *   cardano_base_address_unref(&base_address);
+ * }
+ * else
+ * {
+ *   printf("Conversion to base address format failed.\n");
+ * }
+ *
+ * cardano_address_unref(&general_address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_base_address_t* cardano_address_to_base_address(const cardano_address_t* address);
+
+/**
+ * \brief Compares two address objects for equality.
+ *
+ * This function compares two address objects to determine if they are equal.
+ *
+ * \param[in] lhs Pointer to the first address object.
+ * \param[in] rhs Pointer to the second address object.
+ *
+ * \return \c true if the address objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address1 = NULL;
+ * cardano_address_t* address2 = NULL;
+ *
+ * // Assume address1 and address2 are initialized properly
+ *
+ * bool are_equal = cardano_address_equals(address1, address2);
+ *
+ * if (are_equal)
+ * {
+ *   printf("The address objects are equal.\n");
+ * }
+ * else
+ * {
+ *   printf("The address objects are not equal.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_address_unref(&address1);
+ * cardano_address_unref(&address2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_address_equals(const cardano_address_t* lhs, const cardano_address_t* rhs);
+
+/**
+ * \brief Decrements the address's reference count.
+ *
+ * If the reference count reaches zero, the address memory is deallocated.
+ *
+ * \param[in] address Pointer to the address whose reference count is to be decremented.
+ */
+CARDANO_EXPORT void cardano_address_unref(cardano_address_t** address);
+
+/**
+ * \brief Increments the address's reference count.
+ *
+ * Ensures that the address remains allocated until the last reference is released.
+ *
+ * \param[in] address address whose reference count is to be incremented.
+ */
+CARDANO_EXPORT void cardano_address_ref(cardano_address_t* address);
+
+/**
+ * \brief Retrieves the address's current reference count.
+ *
+ * \warning Does not account for transitive references.
+ *
+ * \param[in] address Target address.
+ * \return Current reference count of the address.
+ */
+CARDANO_EXPORT size_t cardano_address_refcount(const cardano_address_t* address);
+
+/**
+ * \brief Sets the last error message for a given address.
+ *
+ * This function records an error message in the address's last_error buffer,
+ * overwriting any previous message. The message is truncated if it exceeds
+ * the buffer size. This function is typically used to store descriptive
+ * error information that can be retrieved later with
+ * cardano_address_get_last_error.
+ *
+ * \param[in,out] address A pointer to the cardano_address_t instance whose last error
+ *               message is to be set. If the address is NULL, the function
+ *               has no effect.
+ * \param[in] message A null-terminated string containing the error message to be
+ *                recorded. If the message is NULL, the address's last_error
+ *                will be set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters due to the fixed size
+ *       of the last_error buffer (1024 characters), including the null
+ *       terminator. Messages longer than this limit will be truncated.
+ */
+CARDANO_EXPORT void cardano_address_set_last_error(cardano_address_t* address, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific address.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_address_set_last_error for the given
+ * address. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in,out] address A pointer to the \ref cardano_address_t instance whose last error
+ *               message is to be retrieved. If the address is \c NULL, the function
+ *               returns a generic error message indicating the null address.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified address. If the address is \c NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the address and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_address_set_last_error for the same address, or until
+ *       the address is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_address_get_last_error(const cardano_address_t* address);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_address_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_address_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_address_deep_clone(const cardano_address_t* source, cardano_address_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_H
diff --git a/vendor/include/cardano/address/address_type.h b/vendor/include/cardano/address/address_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/address/address_type.h
@@ -0,0 +1,126 @@
+/**
+ * \file address_type.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_TYPE_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumerates types of addresses used within the Cardano blockchain in the Shelley era and beyond.
+ *
+ * Shelley introduces several different types of addresses, each serving distinct purposes and supporting different functionalities.
+ * In addition to these new address types, Shelley continues to support Byron-era bootstrap addresses.
+ */
+typedef enum
+{
+  /** Base addresses with both payment and stake credentials as key hashes.
+   * \li bits 7-6 : 00
+   * \li bit  5   : stake cred is keyhash
+   * \li bit  4   : payment cred is keyhash
+   * \li bits 3-0 : network id
+   */
+  CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_KEY = 0b0000,
+
+  /** Base addresses with payment credentials as script hash and stake credentials as key hash.
+   * \li bits 7-6 : 00
+   * \li bit  5   : stake cred is keyhash
+   * \li bit  4   : payment cred is scripthash
+   * \li bits 3-0 : network id
+   */
+  CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY = 0b0001,
+
+  /** Base addresses with payment credentials as key hash and stake credentials as script hash.
+   * \li bits 7-6 : 00
+   * \li bit  5   : stake cred is scripthash
+   * \li bit  4   : payment cred is keyhash
+   * \li bits 3-0 : network id
+   */
+  CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_SCRIPT = 0b0010,
+
+  /** Base addresses with both payment and stake credentials as script hashes.
+   * \li bits 7-6 : 00
+   * \li bit  5   : stake cred is scripthash
+   * \li bit  4   : payment cred is scripthash
+   * \li bits 3-0 : network id
+   */
+  CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT = 0b0011,
+
+  /** Pointer addresses with payment credential as keyhash.
+   * \li bits 7-5 : 010
+   * \li bit  4   : payment cred is keyhash
+   * \li bits 3-0 : network id
+   */
+  CARDANO_ADDRESS_TYPE_POINTER_KEY = 0b0100,
+
+  /** Pointer addresses with payment credential as scripthash.
+   * \li bits 7-5 : 010
+   * \li bit  4   : payment cred is scripthash
+   * \li bits 3-0 : network id
+   */
+  CARDANO_ADDRESS_TYPE_POINTER_SCRIPT = 0b0101,
+
+  /** Enterprise addresses with payment credential as keyhash.
+   * \li bits 7-5 : 010
+   * \li bit  4   : payment cred is keyhash
+   * \li bits 3-0 : network id
+   */
+  CARDANO_ADDRESS_TYPE_ENTERPRISE_KEY = 0b0110,
+
+  /** Enterprise addresses with payment credential as scripthash.
+   * \li bits 7-5 : 010
+   * \li bit  4   : payment cred is scripthash
+   * \li bits 3-0 : network id
+   */
+  CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT = 0b0111,
+
+  /** Byron-era bootstrap addresses, continuing support for backward compatibility.
+   * \li bits 7-4 : 1000
+   * \li bits 3-0 : unrelated data (no network ID in Byron addresses)
+   */
+  CARDANO_ADDRESS_TYPE_BYRON = 0b1000,
+
+  /** Reward account addresses with credential as keyhash.
+   * \li bits 7-5 : 111
+   * \li bit  4   : credential is keyhash
+   * \li bits 3-0 : network id
+   */
+  CARDANO_ADDRESS_TYPE_REWARD_KEY = 0b1110,
+
+  /** Reward account addresses with credential as scripthash.
+   * \li bits 7-5 : 111
+   * \li bit  4   : credential is scripthash
+   * \li bits 3-0 : network id
+   */
+  CARDANO_ADDRESS_TYPE_REWARD_SCRIPT = 0b1111
+
+  // 1001-1101 are reserved for future formats
+} cardano_address_type_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_TYPE_H
diff --git a/vendor/include/cardano/address/base_address.h b/vendor/include/cardano/address/base_address.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/address/base_address.h
@@ -0,0 +1,697 @@
+/**
+ * \file base_address.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BASE_ADDRESS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BASE_ADDRESS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+#include <cardano/common/credential.h>
+#include <cardano/common/network_id.h>
+
+/* FORWARD DECLARATIONS *****************************************************/
+
+/**
+ * \brief Represents a Cardano address.
+ *
+ * This structure encapsulates all the necessary information for a Cardano address.
+ */
+typedef struct cardano_address_t cardano_address_t;
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Defines a pointer to a structure representing a Cardano base address.
+ */
+typedef struct cardano_base_address_t cardano_base_address_t;
+
+/**
+ * \brief Constructs a Cardano base address from payment and stake credentials.
+ *
+ * This function creates a base address by combining payment and stake credentials, along with specifying
+ * the network ID (either mainnet or testnet).
+ *
+ * \param[in]  network_id The network identifier, specifying whether the address is for mainnet or testnet.
+ * \param[in]  payment The payment credential, which is a pointer to a \ref cardano_credential_t that defines
+ *                     who controls the funds.
+ * \param[in]  stake The stake credential, which is a pointer to a \ref cardano_credential_t that who controls
+ *                   staking rewards are directed.
+ * \param[out] base_address A pointer to a pointer to \ref cardano_base_address_t that will hold the address
+ *                           if the function succeeds.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully created, otherwise it returns an
+ *         error code indicating what went wrong (e.g., CARDANO_ERROR_POINTER_IS_NULL if any input pointers are NULL).
+ *
+ * \note It is the caller's responsibility to manage the lifecycle of the created \ref cardano_base_address_t object,
+ *       which includes freeing it when it is no longer needed by calling \ref cardano_base_address_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* payment_credential = ...; // Assume this is initialized
+ * cardano_credential_t* stake_credential = ...; // Assume this is initialized
+ * cardano_base_address_t* base_address = NULL;
+ * cardano_error_t result = cardano_base_address_from_credentials(
+ *     CARDANO_NETWORK_ID_MAIN_NET, payment_credential, stake_credential, &base_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the base_address
+ *   cardano_base_address_unref(&base_address);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_base_address_from_credentials(
+  cardano_network_id_t     network_id,
+  cardano_credential_t*    payment,
+  cardano_credential_t*    stake,
+  cardano_base_address_t** base_address);
+
+/**
+ * \brief Converts a general Cardano address to a base address.
+ *
+ * This function takes a general Cardano address and attempts to interpret it as a base address,
+ * which is a specific type of Cardano address that includes separate payment and stake credentials.
+ * If the conversion is successful, a new \ref cardano_base_address_t object is created.
+ *
+ * \param[in]  address A constant pointer to the \ref cardano_address_t object representing the general
+ *                     Cardano address to be converted.
+ * \param[out] base_address A pointer to a pointer to \ref cardano_base_address_t that will hold the
+ *                           base address object if the conversion is successful.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the conversion is successful. If the address is not of a
+ *         base address type, returns an appropriate error code such as \ref CARDANO_ERROR_INVALID_ADDRESS_TYPE.
+ *         If the \p address is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \note The newly created \ref cardano_base_address_t object is fully managed by the caller, who is responsible
+ *       for freeing it when it is no longer needed by calling \ref cardano_base_address_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* general_address = ...; // Assume this is initialized as a general Cardano address
+ * cardano_base_address_t* base_address = NULL;
+ * cardano_error_t result = cardano_base_address_from_address(general_address, &base_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The conversion was successful, and base_address can now be used
+ *   cardano_base_address_unref(&base_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert to base address: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_base_address_from_address(
+  const cardano_address_t* address,
+  cardano_base_address_t** base_address);
+
+/**
+ * \brief Converts a base address to a general Cardano address.
+ *
+ * This function takes a \ref cardano_base_address_t object and converts it into a general
+ * \ref cardano_address_t object. This allows for the use of the base address in any context
+ * that requires a generic address format.
+ *
+ * \param[in] base_address A constant pointer to the \ref cardano_base_address_t object that
+ *                         is to be converted into a general Cardano address.
+ *
+ * \return A pointer to a new \ref cardano_address_t object that represents the general Cardano
+ *         address. If the conversion fails due to memory allocation issues, returns NULL.
+ *
+ * \note The newly created \ref cardano_address_t object is fully managed by the caller, who is
+ *       responsible for freeing it when it is no longer needed by calling \ref cardano_address_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_base_address_t* base_address = ...; // Assume this is initialized
+ * cardano_address_t* general_address = cardano_base_address_to_address(base_address);
+ *
+ * if (general_address)
+ * {
+ *   // The conversion was successful, and general_address can now be used
+ *   cardano_address_unref(&general_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert base address to general address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_address_t* cardano_base_address_to_address(
+  const cardano_base_address_t* base_address);
+
+/**
+ * \brief Retrieves the payment credential from a base address.
+ *
+ * This function extracts the payment credential from a \ref cardano_base_address_t object.
+ * The payment credential is a hash of a public key or a script that is authorized
+ * to spend funds from the address.
+ *
+ * \param[in] base_address A constant pointer to the \ref cardano_base_address_t object from which
+ *                         the payment credential is to be retrieved.
+ *
+ * \return A pointer to a \ref cardano_credential_t object that holds the payment credential. If
+ *         the base address does not have a payment credential or if an error occurs, returns NULL.
+ *
+ * \note The newly created \ref cardano_credential_t object is fully managed by the caller, who is
+ *       responsible for freeing it when it is no longer needed by calling \ref cardano_credential_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_base_address_t* base_address = ...; // Assume this is initialized
+ * cardano_credential_t* payment_credential = cardano_base_address_get_payment_credential(base_address);
+ *
+ * if (payment_credential)
+ * {
+ *   // Use the payment credential
+ *   cardano_credential_unref(&payment_credential);
+ * }
+ * else
+ * {
+ *    printf("Failed to retrieve payment credential from base address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_base_address_get_payment_credential(
+  cardano_base_address_t* base_address);
+
+/**
+ * \brief Retrieves the stake credential from a base address.
+ *
+ * This function extracts the stake credential from a \ref cardano_base_address_t object.
+ * The stake credential is a hash of a public key or a script that is in control
+ * of the staking rewards from the address.
+ *
+ * \param[in] base_address A constant pointer to the \ref cardano_base_address_t object from which
+ *                         the stake credential is to be retrieved.
+ *
+ * \return A pointer to a \ref cardano_credential_t object that holds the stake credential. If
+ *         the base address does not have a stake credential or if an error occurs, returns NULL.
+ *
+ * \note The newly created \ref cardano_credential_t object is fully managed by the caller, who is
+ *       responsible for freeing it when it is no longer needed by calling \ref cardano_credential_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_base_address_t* base_address = ...; // Assume this is initialized
+ * cardano_credential_t* stake_credential = cardano_base_address_get_stake_credential(base_address);
+ *
+ * if (stake_credential)
+ * {
+ *   // Use the stake credential
+ *   cardano_credential_unref(&stake_credential);
+ * }
+ * else
+ * {
+ *    printf("Failed to retrieve stake credential from base address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_base_address_get_stake_credential(
+  cardano_base_address_t* base_address);
+
+/**
+ * \brief Creates a base address from a serialized byte array.
+ *
+ * This function constructs a \ref cardano_base_address_t object from a byte array that
+ * contains serialized address data. It attempts to deserialize the data and create
+ * a base address object from it.
+ *
+ * \param[in] data A pointer to the byte array containing the serialized base address data.
+ * \param[in] size The size of the byte array in bytes.
+ * \param[out] address A pointer to a pointer to \ref cardano_base_address_t. On successful
+ *                     deserialization, this will point to a newly allocated base address object.
+ *
+ * \return A \ref cardano_error_t indicating the result of the function call. This will be
+ *         \ref CARDANO_SUCCESS if the address was successfully created from the provided data.
+ *         If an error occurs, a corresponding error code will be returned.
+ *
+ * \note The newly created \ref cardano_base_address_t object is fully managed by the caller,
+ *       who is responsible for freeing it when it is no longer needed by calling \ref cardano_address_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t serialized_data[] = {0x00, 0x01, 0x02, ...}; // example serialized data
+ * size_t size = sizeof(serialized_data);
+ * cardano_base_address_t* base_address = NULL;
+ * cardano_error_t result = cardano_base_address_from_bytes(serialized_data, size, &base_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the base_address
+ *
+ *   // Once done, ensure to clean up and release the base address
+ *   cardano_address_unref(&base_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to create base address from bytes: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_base_address_from_bytes(
+  const byte_t*            data,
+  size_t                   size,
+  cardano_base_address_t** address);
+
+/**
+ * \brief Retrieves the size of the byte array needed to serialize a base address.
+ *
+ * This function calculates the size in bytes that a serialized form of the specified
+ * \ref cardano_base_address_t object would occupy. This size is necessary to allocate a buffer
+ * of appropriate size for serialization.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_base_address_t object whose
+ *                    serialized size is to be calculated. The object must not be NULL.
+ *
+ * \return The size in bytes required to serialize the base address. If the input address is NULL,
+ *         the function returns 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_base_address_t* base_address = ...; // Assume this is initialized
+ * size_t required_size = cardano_base_address_get_bytes_size(base_address);
+ *
+ * if (required_size > 0)
+ * {
+ *   byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ *   if (buffer)
+ *   {
+ *     // Proceed to serialize the base address
+ *   }
+ *   free(buffer);
+ * }
+ * else
+ * {
+ *   printf("Failed to determine the size needed for serialization\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_base_address_get_bytes_size(const cardano_base_address_t* address);
+
+/**
+ * \brief Retrieves a pointer to the internal byte array representation of a base address.
+ *
+ * This function provides access to the internal byte array that represents the serialized form
+ * of a \ref cardano_base_address_t object. The data returned by this function is useful for
+ * operations that require direct access to the serialized address, such as hashing or networking.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_base_address_t object from which
+ *                    the byte array is to be retrieved. The object must not be NULL.
+ *
+ * \return A pointer to the constant byte array that represents the serialized base address.
+ *         If the input address is NULL, returns NULL. The data returned by this function should
+ *         not be modified or freed by the caller, as it is managed internally by the Cardano library.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_base_address_t* base_address = ...; // Assume this is initialized
+ * const byte_t* byte_data = cardano_base_address_get_bytes(base_address);
+ *
+ * if (byte_data)
+ * {
+ *   // Use the byte array for operations like sending over a network
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve byte data from base address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_base_address_get_bytes(const cardano_base_address_t* address);
+
+/**
+ * \brief Serializes a base address into a provided byte array.
+ *
+ * This function serializes the specified \ref cardano_base_address_t object into a byte array
+ * provided by the caller. The size of the buffer must be sufficient to hold the serialized data;
+ * the required size can be obtained by calling \ref cardano_base_address_get_bytes_size.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_base_address_t object to be serialized.
+ * \param[out] data A pointer to the buffer where the serialized data will be written. This buffer
+ *                  must be pre-allocated by the caller.
+ * \param[in] size The size of the buffer pointed to by \p data. It must be at least as large as the value
+ *                 returned by \ref cardano_base_address_get_bytes_size to ensure successful serialization.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the buffer is too small,
+ *         returns \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE. If the \p address or \p data is NULL, returns
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_base_address_t* base_address = ...; // Assume this is initialized
+ * size_t required_size = cardano_base_address_get_bytes_size(base_address);
+ * byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ * if (buffer)
+ * {
+ *   cardano_error_t result = cardano_base_address_to_bytes(base_address, buffer, required_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the serialized data
+ *   }
+ *
+ *   free(buffer);
+ * }
+ * else
+ * {
+ *   printf("Memory allocation failed\n");
+ * }
+ *
+ * cardano_base_address_unref(&base_address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_base_address_to_bytes(
+  const cardano_base_address_t* address,
+  byte_t*                       data,
+  size_t                        size);
+
+/**
+ * \brief Creates a base address from a Bech32 encoded string.
+ *
+ * This function decodes a Bech32 encoded string and constructs a \ref cardano_base_address_t object.
+ * The Bech32 string should correctly represent a Cardano base address according to the
+ * Cardano address specifications. This function will parse the string and if valid, will allocate
+ * and initialize a new base address object.
+ *
+ * \param[in] data A pointer to the character array containing the Bech32 encoded address.
+ * \param[in] size The length of the character array pointed to by \p data.
+ * \param[out] address A pointer to a pointer to \ref cardano_base_address_t. If the decoding is
+ *                     successful, this will be set to point to the newly created base address object.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the base address is successfully created from the Bech32 string.
+ *         Returns \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the Bech32 string does not conform to the expected format or
+ *         if the decoding fails. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *         Returns \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if memory for the decoding buffers could not be allocated.
+ *         Allocation failures inside the Bech32 decoder itself are reported as \ref CARDANO_ERROR_DECODING.
+ *
+ * \note The caller is responsible for freeing the created \ref cardano_base_address_t object using the
+ *       \ref cardano_base_address_unref function when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* bech32_data = "addr1qxy...";
+ * size_t bech32_size = strlen(bech32_data);
+ * cardano_base_address_t* base_address = NULL;
+ *
+ * cardano_error_t result = cardano_base_address_from_bech32(bech32_data, bech32_size, &base_address);
+ *
+ * if (result == CARDANO_SUCCESS && base_address != NULL)
+ * {
+ *   // The base address has been successfully created
+ *   // Use the base_address for operations
+ * }
+ * else
+ * {
+ *   printf("Failed to create base address from Bech32 data: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_base_address_unref(base_address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_base_address_from_bech32(
+  const char*              data,
+  size_t                   size,
+  cardano_base_address_t** address);
+
+/**
+ * \brief Calculates the size of the Bech32 encoded string of a base address.
+ *
+ * This function calculates the length of the Bech32 string that would be generated
+ * from the given \ref cardano_base_address_t object. This size includes the null
+ * terminator needed for string termination in C.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_base_address_t object
+ *                    whose Bech32 string size is to be calculated.
+ *
+ * \return The size in bytes of the Bech32 string representation of the address,
+ *         including the null terminator. If the input address is NULL, returns 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_base_address_t* base_address = ...; // Assume this is initialized
+ * size_t bech32_size = cardano_base_address_get_bech32_size(base_address);
+ *
+ * if (bech32_size > 0)
+ * {
+ *
+ *   char* bech32_string = (char*)malloc(bech32_size);
+ *
+ *   if (bech32_string)
+ *   {
+ *     // Proceed to encode or use the bech32_string as needed
+ *     free(bech32_string);
+ *   }
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_base_address_get_bech32_size(const cardano_base_address_t* address);
+
+/**
+ * \brief Encodes a base address into a Bech32 formatted string.
+ *
+ * This function converts a \ref cardano_base_address_t object into its corresponding
+ * Bech32 string representation. The caller must provide a buffer of sufficient size to hold
+ * the Bech32 encoded string, which can be determined by \ref cardano_base_address_get_bech32_size.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_base_address_t object to be encoded.
+ * \param[out] data A pointer to a buffer where the Bech32 string will be written.
+ * \param[in] size The size of the buffer provided in \p data. This size must be at least as large
+ *                 as the value returned by \ref cardano_base_address_get_bech32_size to ensure
+ *                 successful encoding.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully encoded into Bech32 format.
+ *         If the provided buffer is too small, returns \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE.
+ *         If \p address or \p data is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_base_address_t* base_address = ...; // Assume this is initialized
+ * size_t bech32_size = cardano_base_address_get_bech32_size(base_address);
+ *
+ * char* bech32_string = (char*)malloc(bech32_size);
+ *
+ * if (bech32_string)
+ * {
+ *   cardano_error_t result = cardano_base_address_to_bech32(base_address, bech32_string, bech32_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Bech32 Address: %s\n", bech32_string);
+ *   }
+ *   else
+ *   {
+ *     printf("Failed to encode base address to Bech32: %d\n", result);
+ *   }
+ *
+ *   free(bech32_string);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_base_address_to_bech32(
+  const cardano_base_address_t* address,
+  char*                         data,
+  size_t                        size);
+
+/**
+ * \brief Retrieves the string representation of a base address.
+ *
+ * This function provides access to the string representation of a \ref cardano_base_address_t object.
+ * The string is in Bech32 or another. This function does not allocate new memory for the string; instead,
+ * it returns a pointer to the internal representation within the object.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_base_address_t object from which
+ *                    the string representation is to be retrieved.
+ *
+ * \return A constant pointer to the internal string representation of the address. If the address
+ *         is NULL, returns NULL. The returned string should not be modified or freed by the caller,
+ *         as it is managed internally by the \ref cardano_base_address_t object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_base_address_t* base_address = ...; // Assume this is initialized
+ * const char* address_str = cardano_base_address_get_string(base_address);
+ *
+ * if (address_str)
+ * {
+ *   printf("Base Address: %s\n", address_str);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve string representation of the base address.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_base_address_get_string(const cardano_base_address_t* address);
+
+/**
+ * \brief Retrieves the network ID from a given Cardano base address.
+ *
+ * This function extracts the network identifier from the provided \ref cardano_base_address_t object.
+ * The network ID indicates whether the address belongs to the test network or the main network.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_base_address_t object from which the network ID is to be retrieved.
+ * \param[out] network_id A pointer to \ref cardano_network_id_t where the network ID will be stored upon successful
+ *                        extraction. This parameter cannot be NULL.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the network ID was successfully retrieved.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if the input address or network_id pointer is NULL.
+ *         Returns other error codes as defined in \ref cardano_error_t if the network ID cannot be retrieved due to
+ *         malformed or unrecognized address formats.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_base_address_t* address = NULL;
+ * cardano_network_id_t network_id;
+ *
+ * cardano_error_t get_network_id = cardano_base_address_get_network_id(address, &network_id);
+ *
+ * if (get_network_id != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to determine the network id.\n");
+ * }
+ * else
+ * {
+ *   printf("Network ID: %d\n", network_id);
+ * }
+ *
+ * cardano_base_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_base_address_get_network_id(
+  const cardano_base_address_t* address,
+  cardano_network_id_t*         network_id);
+
+/**
+ * \brief Decrements the base address's reference count.
+ *
+ * If the reference count reaches zero, the base address memory is deallocated.
+ *
+ * \param[in] address Pointer to the base address whose reference count is to be decremented.
+ */
+CARDANO_EXPORT void cardano_base_address_unref(cardano_base_address_t** address);
+
+/**
+ * \brief Increments the base address's reference count.
+ *
+ * Ensures that the base address remains allocated until the last reference is released.
+ *
+ * \param[in] address base address whose reference count is to be incremented.
+ */
+CARDANO_EXPORT void cardano_base_address_ref(cardano_base_address_t* address);
+
+/**
+ * \brief Retrieves the base address's current reference count.
+ *
+ * \warning Does not account for transitive references.
+ *
+ * \param[in] address Target base address.
+ * \return Current reference count of the base address.
+ */
+CARDANO_EXPORT size_t cardano_base_address_refcount(const cardano_base_address_t* address);
+
+/**
+ * \brief Sets the last error message for a given base address.
+ *
+ * This function records an error message in the base address's last_error buffer,
+ * overwriting any previous message. The message is truncated if it exceeds
+ * the buffer size. This function is typically used to store descriptive
+ * error information that can be retrieved later with
+ * cardano_base_address_get_last_error.
+ *
+ * \param[in,out] address A pointer to the cardano_base_address_t instance whose last error
+ *               message is to be set. If the base address is NULL, the function
+ *               has no effect.
+ * \param[in] message A null-terminated string containing the error message to be
+ *                recorded. If the message is NULL, the base address's last_error
+ *                will be set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters due to the fixed size
+ *       of the last_error buffer (1024 characters), including the null
+ *       terminator. Messages longer than this limit will be truncated.
+ */
+CARDANO_EXPORT void cardano_base_address_set_last_error(cardano_base_address_t* address, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific base address.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_base_address_set_last_error for the given
+ * base address. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in,out] address A pointer to the \ref cardano_base_address_t instance whose last error
+ *               message is to be retrieved. If the base address is \c NULL, the function
+ *               returns a generic error message indicating the null base address.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified base address. If the base address is \c NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the base address and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_base_address_set_last_error for the same base address, or until
+ *       the base address is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_base_address_get_last_error(const cardano_base_address_t* address);
+
+/**
+ * \brief Creates an independent deep copy of the address and its credentials.
+ * \param[in] source Address to copy. Must not be NULL.
+ * \param[out] clone Receives one owned reference, or NULL on failure. Must not be NULL.
+ * \return CARDANO_SUCCESS, CARDANO_ERROR_POINTER_IS_NULL, or CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ * \note Release the result with cardano_base_address_unref. The source is unchanged.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_base_address_deep_clone(const cardano_base_address_t* source, cardano_base_address_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BASE_ADDRESS_H
diff --git a/vendor/include/cardano/address/byron_address.h b/vendor/include/cardano/address/byron_address.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/address/byron_address.h
@@ -0,0 +1,751 @@
+/**
+ * \file byron_address.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/byron_address_attributes.h>
+#include <cardano/address/byron_address_type.h>
+#include <cardano/common/network_id.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* FORWARD DECLARATIONS *****************************************************/
+
+/**
+ * \brief Represents a Cardano address.
+ *
+ * This structure encapsulates all the necessary information for a Cardano address.
+ */
+typedef struct cardano_address_t cardano_address_t;
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a Byron-era address in the Cardano blockchain.
+ */
+typedef struct cardano_byron_address_t cardano_byron_address_t;
+
+/**
+ * \brief Creates a Byron-era address from given credentials.
+ *
+ * This function generates a \ref cardano_byron_address_t object based on the provided root hash, address attributes,
+ * and address type.
+ *
+ * \param[in] root A pointer to \ref cardano_blake2b_hash_t representing the root hash of the address.
+ * \param[in] attributes A \ref cardano_byron_address_attributes_t structure containing optional address attributes
+ *                       such as derivation path and network magic.
+ * \param[in] type The type of Byron address, defined by \ref cardano_byron_address_type_t, which indicates
+ *                 whether the address is based on a public key, a script, or a redeem key.
+ * \param[out] address A pointer to a pointer of \ref cardano_byron_address_t where the newly created Byron
+ *                     address object will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation. Returns \ref CARDANO_SUCCESS on success
+ *         or an appropriate error code on failure. Returns \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if memory for
+ *         the address could not be allocated.
+ *
+ * \note It is the caller's responsibility to manage the lifecycle of the created \ref cardano_byron_address_t object,
+ *       including freeing it when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* root_hash = ...; // Assume root_hash is initialized
+ * cardano_byron_address_attributes_t attributes = { .derivation_path = "...", .magic = 0x1234 };
+ * cardano_byron_address_t* byron_address = NULL;
+ *
+ * cardano_error_t result = cardano_byron_address_from_credentials(
+ *      root_hash, attributes,
+ *      CARDANO_BYRON_ADDRESS_TYPE_PUBKEY,
+ *      &byron_address);
+ *
+ * if (result == CARDANO_SUCCESS && byron_address)
+ * {
+ *   // Byron address has been successfully created and can be used
+ *   // Free the Byron address when done
+ *   cardano_byron_address_unref(byron_address);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_byron_address_from_credentials(
+  cardano_blake2b_hash_t*            root,
+  cardano_byron_address_attributes_t attributes,
+  cardano_byron_address_type_t       type,
+  cardano_byron_address_t**          address);
+
+/**
+ * \brief Converts a generic Cardano address to a Byron-era address.
+ *
+ * This function attempts to convert a \ref cardano_address_t object into a \ref cardano_byron_address_t object.
+ *
+ * \param[in] address A constant pointer to the generic \ref cardano_address_t object to be converted.
+ * \param[out] byron_address A pointer to a pointer of \ref cardano_byron_address_t where the newly created
+ *                           Byron address object will be stored if the conversion is successful.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation. Returns \ref CARDANO_SUCCESS on successful
+ *         conversion, \ref CARDANO_ERROR_INVALID_ADDRESS_TYPE if the input address is not a valid Byron address, or other
+ *         appropriate error codes for different failures.
+ *
+ * \note The caller is responsible for managing the lifecycle of the created \ref cardano_byron_address_t object,
+ *       including freeing it when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* generic_address = ...; // Assume this is initialized and points to a Byron address
+ * cardano_byron_address_t* byron_address = NULL;
+ *
+ * cardano_error_t result = cardano_byron_address_from_address(generic_address, &byron_address);
+ *
+ * if (result == CARDANO_SUCCESS && byron_address)
+ * {
+ *   // Byron address has been successfully converted and can be used
+ *   // Free the Byron address when done
+ *   cardano_byron_address_unref(byron_address);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_byron_address_from_address(
+  const cardano_address_t*  address,
+  cardano_byron_address_t** byron_address);
+
+/**
+ * \brief Converts a Byron-era address to a generic Cardano address.
+ *
+ * This function converts a \ref cardano_byron_address_t object to a \ref cardano_address_t object.
+ *
+ * \param[in] byron_address A constant pointer to the \ref cardano_byron_address_t object that represents the
+ *                          Byron-era address to be converted.
+ *
+ * \return A pointer to a new \ref cardano_address_t object representing the generic Cardano address. This object
+ *         represents a "strong reference" to the address, meaning that it is fully initialized and ready for use.
+ *         The caller is responsible for managing the lifecycle of this object, including freeing it when it is
+ *         no longer needed.
+ *
+ * \note If the conversion fails, NULL is returned. It is the caller's responsibility to check the return value
+ *       before using it.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* byron_address = ...; // Assume this is initialized
+ * cardano_address_t* cardano_address = cardano_byron_address_to_address(byron_address);
+ *
+ * if (cardano_address)
+ * {
+ *   // Use the generic Cardano address
+ *   // Remember to free the Cardano address when done
+ *   cardano_address_unref(&cardano_address);
+ * }
+ * else
+ * {
+ *   // Handle conversion failure
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_address_t* cardano_byron_address_to_address(
+  const cardano_byron_address_t* byron_address);
+
+/**
+ * \brief Retrieves attributes from a Byron-era address.
+ *
+ * This function extracts the attributes associated with a Byron-era address encapsulated in a \ref cardano_byron_address_t object.
+ * These attributes might include optional fields such as a derivation path or a network magic identifier, which were specific to
+ * the Byron address format.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_byron_address_t object from which the attributes are to be retrieved.
+ * \param[out] attributes A pointer to a \ref cardano_byron_address_attributes_t structure where the attributes of the address will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the attributes were successfully retrieved, or an appropriate error code if an error occurred.
+ *
+ * \note The function assumes the \p address pointer and the \p attributes pointer are not NULL. If either is NULL, the function
+ *       returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* byron_address = ...; // Assume this is initialized
+ * cardano_byron_address_attributes_t attributes;
+ * cardano_error_t result = cardano_byron_address_get_attributes(byron_address, &attributes);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the attributes
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to retrieve attributes: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_byron_address_get_attributes(
+  const cardano_byron_address_t*      address,
+  cardano_byron_address_attributes_t* attributes);
+
+/**
+ * \brief Retrieves the type of a Byron-era address.
+ *
+ * This function extracts the type from a Byron-era address encapsulated in a \ref cardano_byron_address_t object.
+ * The type determines the nature of the credentials used in the address, such as a public key, a script, or a redeem key.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_byron_address_t object from which the type is to be retrieved.
+ * \param[out] type A pointer to a \ref cardano_byron_address_type_t variable where the type of the address will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the type was successfully retrieved, or an appropriate error code if an error occurred.
+ *
+ * \note The function assumes the \p address pointer and the \p type pointer are not NULL. If either is NULL, the function
+ *       returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* byron_address = ...; // Assume this is initialized
+ * cardano_byron_address_type_t type;
+ * cardano_error_t result = cardano_byron_address_get_type(byron_address, &type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved type
+ *   switch (type)
+ *   {
+ *     case CARDANO_BYRON_ADDRESS_TYPE_PUBKEY:
+ *       printf("Address type is Public Key\n");
+ *       break;
+ *     case CARDANO_BYRON_ADDRESS_TYPE_SCRIPT:
+ *       printf("Address type is Script\n");
+ *       break;
+ *     case CARDANO_BYRON_ADDRESS_TYPE_REDEEM:
+ *       printf("Address type is Redeem Key\n");
+ *       break;
+ *     default:
+ *       printf("Unknown address type\n");
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to retrieve address type: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_byron_address_get_type(
+  const cardano_byron_address_t* address,
+  cardano_byron_address_type_t*  type);
+
+/**
+ * \brief Retrieves the root hash from a Byron-era address.
+ *
+ * This function extracts the root hash associated with a Byron-era address, which is encapsulated in a \ref cardano_byron_address_t object.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_byron_address_t object from which the root hash is to be retrieved.
+ * \param[out] root A pointer to a pointer of \ref cardano_blake2b_hash_t that will be set to point to the root hash of the address.
+ *                  The function will allocate memory for the root hash, and it is the caller's responsibility to free it using
+ *                  \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the root hash was successfully retrieved, or an appropriate error code if an error occurred.
+ *
+ * \note The function assumes the \p address pointer is not NULL and that \p root is a valid double pointer. If either is NULL,
+ *       the function returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* byron_address = ...; // Assume this is initialized
+ * cardano_blake2b_hash_t* root_hash = NULL;
+ * cardano_error_t result = cardano_byron_address_get_root(byron_address, &root_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the root hash
+ *   // ...
+ *
+ *   // Clean up
+ *   cardano_blake2b_hash_unref(&root_hash);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to retrieve root hash: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_byron_address_get_root(
+  const cardano_byron_address_t* address,
+  cardano_blake2b_hash_t**       root);
+
+/**
+ * \brief Constructs a Byron-era address from a byte array.
+ *
+ * This function creates a \ref cardano_byron_address_t object from raw byte data, interpreting it as a serialized Byron address.
+ * It verifies the structure and validity of the data before constructing the address object.
+ *
+ * \param[in] data A pointer to the byte array containing the serialized Byron address data.
+ * \param[in] size The size of the byte array in bytes.
+ * \param[out] address A pointer to a pointer of \ref cardano_byron_address_t that will be set to the address of the newly created
+ *                     Byron address object upon successful decoding.
+ *
+ * \return \ref CARDANO_SUCCESS if the Byron address is successfully created from the provided bytes, \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT
+ *         if the byte array does not represent a valid Byron address, or \ref CARDANO_ERROR_POINTER_IS_NULL if any pointer parameter is NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the created \ref cardano_byron_address_t object. Specifically,
+ *       once the address is no longer needed, the caller must release it by calling \ref cardano_address_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t address_data[] = {...}; // Assume this contains valid Byron address bytes
+ * size_t address_data_size = sizeof(address_data);
+ * cardano_byron_address_t* byron_address = NULL;
+ * cardano_error_t result = cardano_byron_address_from_bytes(address_data, address_data_size, &byron_address);
+ * if (result == CARDANO_SUCCESS) {
+ *   // Byron address is successfully created and can be used
+ *   // ...
+ *
+ *   // Once done, clean up
+ *   cardano_address_unref(&byron_address);
+ * } else {
+ *   printf("Failed to create Byron address from bytes: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_byron_address_from_bytes(
+  const byte_t*             data,
+  size_t                    size,
+  cardano_byron_address_t** address);
+
+/**
+ * \brief Retrieves the size in bytes of the serialized form of a Byron-era address.
+ *
+ * This function calculates the size of the byte array needed to store the serialized form of a given
+ * \ref cardano_byron_address_t object. This size is useful for allocating the correct amount of memory
+ * for serialization.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_byron_address_t object whose serialized size is to be determined.
+ *
+ * \return The size in bytes required to store the serialized form of the Byron address. Returns zero if the input address
+ *         is NULL or if any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* byron_address = ...; // Assume this is a valid Byron address object
+ * size_t required_size = cardano_byron_address_get_bytes_size(byron_address);
+ *
+ * if (required_size > 0)
+ * {
+ *   byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ *   if (buffer)
+ *   {
+ *     // Proceed to serialize the Byron address into the buffer
+ *     ...
+ *     free(buffer);
+ *   }
+ * }
+ * else
+ * {
+ *   printf("Error determining the required size for the serialized Byron address.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_byron_address_get_bytes_size(const cardano_byron_address_t* address);
+
+/**
+ * \brief Retrieves a pointer to the internal byte array representation of a Byron-era address.
+ *
+ * This function provides direct read-only access to the internal byte array that represents
+ * a Byron-era address in its serialized form. This is useful for operations that require direct
+ * access to the raw data of the address, such as hashing or verification.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_byron_address_t object from which
+ *                    the byte array is to be accessed.
+ *
+ * \return A pointer to the constant byte array representing the serialized Byron address. If the
+ *         input address is NULL, returns NULL. The data should not be modified, and the lifetime
+ *         of the returned pointer is tied to the lifetime of the \ref cardano_byron_address_t object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* byron_address = ...; // Assume this is a valid Byron address object
+ * const byte_t* byte_data = cardano_byron_address_get_bytes(byron_address);
+ *
+ * if (byte_data)
+ * {
+ *   // Use the byte data for reading purposes
+ *   ...
+ * }
+ * else
+ * {
+ *   printf("Failed to access the byte data of the Byron address.\n");
+ * }
+ * \endcode
+ *
+ * \note Modifying the data pointed to by the returned pointer is undefined behavior.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_byron_address_get_bytes(const cardano_byron_address_t* address);
+
+/**
+ * \brief Serializes a Byron-era address into a byte array.
+ *
+ * This function serializes the given \ref cardano_byron_address_t object into a preallocated buffer in its raw byte form.
+ * The buffer size can be determined by calling \ref cardano_byron_address_get_bytes_size prior to this function.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_byron_address_t object that is to be serialized.
+ * \param[out] data A pointer to the buffer where the serialized byte data will be written.
+ * \param[in] size The size of the buffer pointed to by \p data. It must be at least as large as the value
+ *                 returned by \ref cardano_byron_address_get_bytes_size to ensure successful serialization.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the buffer is too small, returns
+ *         \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE. If the \p address is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* byron_address = cardano_byron_address_new(...);
+ * size_t required_size = cardano_byron_address_get_bytes_size(byron_address);
+ * byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ * if (buffer)
+ * {
+ *   cardano_error_t result = cardano_byron_address_to_bytes(byron_address, buffer, required_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the serialized data
+ *   }
+ *   free(buffer);
+ * }
+ *
+ * cardano_byron_address_unref(&byron_address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_byron_address_to_bytes(
+  const cardano_byron_address_t* address,
+  byte_t*                        data,
+  size_t                         size);
+
+/**
+ * \brief Creates a Byron-era address from a Base58-encoded string.
+ *
+ * This function constructs a \ref cardano_byron_address_t object by decoding the provided
+ * Base58-encoded string that represents the address data.
+ *
+ * \param[in] data A pointer to a character array containing the Base58-encoded representation of the address.
+ * \param[in] size The size of the Base58 string in bytes.
+ * \param[out] address A pointer to a pointer to \ref cardano_byron_address_t that will be set to the address
+ *                     of the newly created Byron address object upon successful decoding.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully created. Returns \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p data or \p address pointer is NULL. Returns \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the Base58 data
+ *         could not be decoded into a valid Byron address.
+ *
+ * \note The function checks the format and validity of the Base58 string. It is the caller's responsibility to
+ *       ensure that the string is correctly formatted and of appropriate length. Malformed or incorrect Base58
+ *       data may lead to decoding errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* base58_address = "3P3QsMVK8...";
+ * size_t base58_size = strlen(base58_address);
+ * cardano_byron_address_t* byron_address = NULL;
+ *
+ * cardano_error_t result = cardano_byron_address_from_base58(base58_address, base58_size, &byron_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the Byron address
+ *
+ *   // Once done, ensure to clean up and release the Byron address
+ *   cardano_byron_address_unref(&byron_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to decode Byron address from Base58: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_byron_address_from_base58(
+  const char*               data,
+  size_t                    size,
+  cardano_byron_address_t** address);
+
+/**
+ * \brief Retrieves the size in bytes of the Base58-encoded representation of a Byron-era address.
+ *
+ * This function calculates the size necessary to store the Base58-encoded representation of a given
+ * \ref cardano_byron_address_t address object, including the null-termination character.
+ *
+ * \param[in] address A pointer to a \ref cardano_byron_address_t object whose Base58 size is to be retrieved.
+ *
+ * \return The size in bytes of the Base58-encoded representation of the address. Returns 0 if the \p address
+ *         pointer is NULL or if the address is invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* byron_address = NULL;
+ * // Assume byron_address is already created and valid
+ * size_t base58_size = cardano_byron_address_get_base58_size(byron_address);
+ *
+ * if (base58_size > 0)
+ * {
+ *   char* base58_string = (char*)malloc(base58_size);
+ *
+ *   if (base58_string)
+ *   {
+ *     // Proceed to convert address to Base58 string
+ *   }
+ *
+ *   free(base58_string);
+ * }
+ * else
+ * {
+ *   printf("Invalid address or unable to determine size\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_byron_address_get_base58_size(const cardano_byron_address_t* address);
+
+/**
+ * \brief Converts a Byron-era address into a Base58-encoded string.
+ *
+ * This function takes a \ref cardano_byron_address_t object and converts it to its Base58 string
+ * representation. The resulting string is written into the provided \p data buffer, which must be large
+ * enough to hold the Base58 string and the null-termination character.
+ *
+ * \param[in] address A pointer to the \ref cardano_byron_address_t object to be converted.
+ * \param[out] data A pointer to a character buffer where the Base58-encoded string will be stored.
+ * \param[in] size The size of the provided buffer in bytes. This size should be at least the value returned
+ *                 by \ref cardano_byron_address_get_base58_size for this address.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the conversion was successful. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         the \p address or \p data pointer is NULL. Returns \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE if the \p size is too
+ *         small to hold the Base58 representation including the null terminator.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* byron_address = NULL;
+ * // Assume byron_address is previously created and valid
+ * size_t base58_size = cardano_byron_address_get_base58_size(byron_address);
+ * char* base58_string = (char*) malloc(base58_size);
+ *
+ * if (base58_string)
+ * {
+ *   cardano_error_t result = cardano_byron_address_to_base58(byron_address, base58_string, base58_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Base58 representation: %s\n", base58_string);
+ *   }
+ *   else
+ *   {
+ *     printf("Failed to convert Byron address to Base58: %d\n", result);
+ *   }
+ *
+ *   free(base58_string);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_byron_address_to_base58(
+  const cardano_byron_address_t* address,
+  char*                          data,
+  size_t                         size);
+
+/**
+ * \brief Retrieves the string representation of a byron era address.
+ *
+ * This function provides access to the string representation of a \ref cardano_byron_address_t object.
+ * The string is in Base58. This function does not allocate new memory for the string; instead,
+ * it returns a pointer to the internal representation within the object.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_byron_address_t object from which
+ *                    the string representation is to be retrieved.
+ *
+ * \return A constant pointer to the internal string representation of the address. If the address
+ *         is NULL, returns NULL. The returned string should not be modified or freed by the caller,
+ *         as it is managed internally by the \ref cardano_byron_address_t object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* byron_address = ...; // Assume this is initialized
+ * const char* address_str = cardano_byron_address_get_string(byron_address);
+ *
+ * if (address_str)
+ * {
+ *   printf("Base Address: %s\n", address_str);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve string representation of the base address.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_byron_address_get_string(const cardano_byron_address_t* address);
+
+/**
+ * \brief Retrieves the network ID from a given Cardano byron address.
+ *
+ * This function extracts the network identifier from the provided \ref cardano_byron_address_t object.
+ * The network ID indicates whether the address belongs to the test network or the main network.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_byron_address_t object from which the network ID is to be retrieved.
+ * \param[out] network_id A pointer to \ref cardano_network_id_t where the network ID will be stored upon successful
+ *                        extraction. This parameter cannot be NULL.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the network ID was successfully retrieved.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if the input address or network_id pointer is NULL.
+ *         Returns other error codes as defined in \ref cardano_error_t if the network ID cannot be retrieved due to
+ *         malformed or unrecognized address formats.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_byron_address_t* address = NULL;
+ * cardano_network_id_t network_id;
+ *
+ * cardano_error_t get_network_id = cardano_byron_address_get_network_id(address, &network_id);
+ *
+ * if (get_network_id != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to determine the network id.\n");
+ * }
+ * else
+ * {
+ *   printf("Network ID: %d\n", network_id);
+ * }
+ *
+ * cardano_byron_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_byron_address_get_network_id(
+  const cardano_byron_address_t* address,
+  cardano_network_id_t*          network_id);
+
+/**
+ * \brief Decrements the byron address's reference count.
+ *
+ * If the reference count reaches zero, the byron address memory is deallocated.
+ *
+ * \param[in] address Pointer to the byron address whose reference count is to be decremented.
+ */
+CARDANO_EXPORT void cardano_byron_address_unref(cardano_byron_address_t** address);
+
+/**
+ * \brief Increments the byron address's reference count.
+ *
+ * Ensures that the byron address remains allocated until the last reference is released.
+ *
+ * \param[in] address byron address whose reference count is to be incremented.
+ */
+CARDANO_EXPORT void cardano_byron_address_ref(cardano_byron_address_t* address);
+
+/**
+ * \brief Retrieves the byron address's current reference count.
+ *
+ * \warning Does not account for transitive references.
+ *
+ * \param[in] address Target byron address.
+ * \return Current reference count of the byron address.
+ */
+CARDANO_EXPORT size_t cardano_byron_address_refcount(const cardano_byron_address_t* address);
+
+/**
+ * \brief Sets the last error message for a given byron address.
+ *
+ * This function records an error message in the byron address's last_error buffer,
+ * overwriting any previous message. The message is truncated if it exceeds
+ * the buffer size. This function is typically used to store descriptive
+ * error information that can be retrieved later with
+ * cardano_byron_address_get_last_error.
+ *
+ * \param[in,out] address A pointer to the cardano_byron_address_t instance whose last error
+ *               message is to be set. If the byron address is NULL, the function
+ *               has no effect.
+ * \param[in] message A null-terminated string containing the error message to be
+ *                recorded. If the message is NULL, the byron address's last_error
+ *                will be set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters due to the fixed size
+ *       of the last_error buffer (1024 characters), including the null
+ *       terminator. Messages longer than this limit will be truncated.
+ */
+CARDANO_EXPORT void cardano_byron_address_set_last_error(cardano_byron_address_t* address, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific byron address.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_byron_address_set_last_error for the given
+ * byron address. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in,out] address A pointer to the \ref cardano_byron_address_t instance whose last error
+ *               message is to be retrieved. If the byron address is \c NULL, the function
+ *               returns a generic error message indicating the null byron address.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified byron address. If the byron address is \c NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the byron address and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_byron_address_set_last_error for the same byron address, or until
+ *       the byron address is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_byron_address_get_last_error(const cardano_byron_address_t* address);
+
+/**
+ * \brief Creates an independent deep copy of the address and its credentials.
+ * \param[in] source Address to copy. Must not be NULL.
+ * \param[out] clone Receives one owned reference, or NULL on failure. Must not be NULL.
+ * \return CARDANO_SUCCESS, CARDANO_ERROR_POINTER_IS_NULL, or CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ * \note Release the result with cardano_byron_address_unref. The source is unchanged.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_byron_address_deep_clone(const cardano_byron_address_t* source, cardano_byron_address_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_H
diff --git a/vendor/include/cardano/address/byron_address_attributes.h b/vendor/include/cardano/address/byron_address_attributes.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/address/byron_address_attributes.h
@@ -0,0 +1,68 @@
+/**
+ * \file byron_address_attributes.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_ATTRIBUTES_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_ATTRIBUTES_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Attributes specific to Byron addresses in the Cardano blockchain.
+ *
+ * This structure holds optional attributes associated with Byron addresses. Byron addresses were used during
+ * the Byron era of the Cardano blockchain. The `derivation_path` attribute was utilized by legacy random wallets
+ * for key derivation, a practice that has since been replaced by more modern wallet structures such as Yoroi and
+ * Icarus. The `magic` attribute serves as a network tag, used primarily on test networks to distinguish between
+ * different network environments.
+ */
+typedef struct cardano_byron_address_attributes_t
+{
+    /**
+     * \brief  Holds the derivation path used by legacy wallets.
+     */
+    byte_t derivation_path[64];
+
+    /**
+     * \brief  The size of the derivation path encrypted data.
+     */
+    size_t derivation_path_size;
+
+    /**
+     * \brief * Network magic identifier used for network discrimination, primarily relevant in test network scenarios. This
+     * int32_t value helps ensure that transactions are broadcast on the correct Cardano network. It will be set to -1
+     * if the address is not associated with a specific network.
+     */
+    int64_t magic;
+} cardano_byron_address_attributes_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_ATTRIBUTES_H
diff --git a/vendor/include/cardano/address/byron_address_type.h b/vendor/include/cardano/address/byron_address_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/address/byron_address_type.h
@@ -0,0 +1,62 @@
+/**
+ * \file byron_address_type.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_TYPE_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumerates the types of spending data associated with Byron addresses.
+ *
+ * This enumeration defines the type of data that can be associated with a Byron address. Each type corresponds to a different method of controlling the spending of funds:
+ */
+typedef enum
+{
+  /**
+   * \brief Indicates that the address uses a public key to control spending. The payload for
+   * this address type is a public key.
+   */
+  CARDANO_BYRON_ADDRESS_TYPE_PUBKEY = 0,
+
+  /**
+   * \brief Indicates that the address uses a script to control spending. The payload for
+   * this address type includes the script itself and possibly its version, depending on the script type.
+   */
+  CARDANO_BYRON_ADDRESS_TYPE_SCRIPT = 1,
+
+  /**
+   * \brief Indicates that the address uses a redeem public key. Redeem addresses are a
+   * special type of address mainly used during the initial distribution phase of ADA.
+   * The payload is a redeem public key.
+   */
+  CARDANO_BYRON_ADDRESS_TYPE_REDEEM = 2
+} cardano_byron_address_type_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_TYPE_H
diff --git a/vendor/include/cardano/address/enterprise_address.h b/vendor/include/cardano/address/enterprise_address.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/address/enterprise_address.h
@@ -0,0 +1,685 @@
+/**
+ * \file enterprise_address.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ENTERPRISE_ADDRESS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ENTERPRISE_ADDRESS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/credential.h>
+#include <cardano/common/network_id.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* FORWARD DECLARATIONS *****************************************************/
+
+/**
+ * \brief Represents an enterprise address in the Cardano blockchain ecosystem.
+ *
+ * Enterprise addresses carry no stake rights, so using these addresses means that you are opting out of participation
+ * in the proof-of-stake protocol.
+ *
+ * Note that using addresses with no stake rights effectively decreases the total amount of stake, which plays
+ * into the hands of a potential adversary.
+ */
+typedef struct cardano_address_t cardano_address_t;
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents an enterprise address in the Cardano blockchain ecosystem.
+ *
+ * Enterprise addresses carry no stake rights, so using these addresses means that you are opting out of participation
+ * in the proof-of-stake protocol.
+ *
+ * Note that using addresses with no stake rights effectively decreases the total amount of stake, which plays
+ * into the hands of a potential adversary.
+ */
+typedef struct cardano_enterprise_address_t cardano_enterprise_address_t;
+
+/**
+ * \brief Creates an enterprise address from specified network and payment credentials.
+ *
+ * This function constructs a \ref cardano_enterprise_address_t object by combining a network identifier
+ * and payment credentials. The resulting enterprise address does not include staking capabilities.
+ *
+ * \param[in] network_id The network identifier, which specifies the Cardano network (e.g., mainnet, testnet).
+ * \param[in] payment A pointer to a \ref cardano_credential_t object representing the payment credentials.
+ * \param[out] enterprise_address A pointer to a pointer to \ref cardano_enterprise_address_t that will be set
+ *                                to the address of the newly created enterprise address object upon successful
+ *                                address creation.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the enterprise address was successfully created. Returns
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if the \p payment or \p enterprise_address pointer is NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the created \ref cardano_enterprise_address_t object.
+ *       This involves ensuring that `cardano_enterprise_address_unref` is called to free the address object when it is no longer needed, to avoid memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t payment_credentials = {...};  // Initialized elsewhere
+ * cardano_enterprise_address_t* address = NULL;
+ * cardano_error_t result = cardano_enterprise_address_from_credentials(CARDANO_NETWORK_ID_MAIN_NET, &payment_credentials, &address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the address for transactions
+ *   // Once done, ensure to clean up and release the enterprise address
+ *   cardano_enterprise_address_unref(&address);
+ * }
+ * else
+ * {
+ *   printf("Failed to create enterprise address: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_enterprise_address_from_credentials(
+  cardano_network_id_t           network_id,
+  cardano_credential_t*          payment,
+  cardano_enterprise_address_t** enterprise_address);
+
+/**
+ * \brief Converts a general Cardano address to an enterprise address.
+ *
+ * This function takes an existing \ref cardano_address_t object and attempts to create a corresponding
+ * \ref cardano_enterprise_address_t object.
+ *
+ * \param[in] address A pointer to the \ref cardano_address_t object that is to be converted into an enterprise address.
+ * \param[out] enterprise_address A pointer to a pointer to \ref cardano_enterprise_address_t that will be set
+ *                                to the address of the newly created enterprise address object upon successful
+ *                                conversion.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the conversion was successful. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         the \p address or \p enterprise_address pointer is NULL. Returns \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the
+ *         provided address cannot be converted to an enterprise address.
+ *
+ * \note It is the caller's responsibility to manage the lifecycle of the created \ref cardano_enterprise_address_t object,
+ *       including calling `cardano_enterprise_address_unref` to free the object when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* general_address = NULL;
+ * // Assume general_address is previously created and represents a valid Cardano address
+ * cardano_enterprise_address_t* enterprise_address = NULL;
+ * cardano_error_t result = cardano_enterprise_address_from_address(general_address, &enterprise_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The address has been successfully converted to an enterprise address
+ *   // Use the enterprise address for transactions
+ *
+ *   // Once done, ensure to clean up and release the enterprise address
+ *   cardano_enterprise_address_unref(&enterprise_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert to enterprise address: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_enterprise_address_from_address(
+  const cardano_address_t*       address,
+  cardano_enterprise_address_t** enterprise_address);
+
+/**
+ * \brief Converts an enterprise address to a general Cardano address.
+ *
+ * This function takes a \ref cardano_enterprise_address_t object representing an enterprise address and converts
+ * it to a general \ref cardano_address_t object.
+ *
+ * \param[in] enterprise_address A pointer to the \ref cardano_enterprise_address_t object that is to be converted
+ *                               into a general Cardano address.
+ *
+ * \return A pointer to a newly created \ref cardano_address_t object representing the general address. Returns NULL
+ *         if the \p enterprise_address is NULL or if the conversion fails due to an invalid address format.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_address_t object, including
+ *       calling `cardano_address_unref` to free the object when it is no longer needed. Failure to do so can result in
+ *       memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_enterprise_address_t* enterprise_address = NULL;
+ * // Assume enterprise_address is previously created and represents a valid enterprise address
+ * cardano_address_t* general_address = cardano_enterprise_address_to_address(enterprise_address);
+ *
+ * if (general_address != NULL)
+ * {
+ *   // The enterprise address has been successfully converted to a general Cardano address
+ *   // Use the general address as needed
+ *
+ *   // Once done, ensure to clean up and release the general address
+ *   cardano_address_unref(&general_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert enterprise address to a general address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_address_t* cardano_enterprise_address_to_address(
+  const cardano_enterprise_address_t* enterprise_address);
+
+/**
+ * \brief Retrieves the payment credential from an enterprise address.
+ *
+ * This function extracts the payment credential from a \ref cardano_enterprise_address_t object.
+ *
+ * \param[in] enterprise_address A pointer to the \ref cardano_enterprise_address_t object from which the payment
+ *                               credential is to be retrieved.
+ *
+ * \return A pointer to a \ref cardano_credential_t object representing the payment credential. Returns NULL if the
+ *         \p enterprise_address is NULL.
+ *
+ * \note The lifecycle of the returned \ref cardano_credential_t object must be managed by the caller. It is important to
+ *       call `cardano_credential_unref` to free this object when it is no longer needed to prevent memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_enterprise_address_t* enterprise_address = NULL;
+ * // Assume enterprise_address is previously created and represents a valid enterprise address
+ * cardano_credential_t* payment_credential = cardano_enterprise_address_get_payment_credential(enterprise_address);
+ *
+ * if (payment_credential != NULL)
+ * {
+ *   // The payment credential can be used to initiate transactions or for other purposes
+ *   // Once done with the credential, ensure to clean up and release it
+ *   cardano_credential_unref(&payment_credential);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve payment credential from enterprise address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_enterprise_address_get_payment_credential(
+  cardano_enterprise_address_t* enterprise_address);
+
+/**
+ * \brief Creates an enterprise address from a byte array.
+ *
+ * This function constructs a \ref cardano_enterprise_address_t object by decoding a byte array that
+ * represents an enterprise address in serialized form.
+ *
+ * \param[in] data A pointer to the byte array containing the serialized enterprise address data.
+ * \param[in] size The size of the byte array in bytes.
+ * \param[out] address A pointer to a pointer to \ref cardano_enterprise_address_t that will be set to the address
+ *                     of the newly created enterprise address object upon successful decoding.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully created. Returns \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p data or \p address pointer is NULL. Returns \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the byte array data
+ *         could not be decoded into a valid enterprise address.
+ *
+ * \note It is the caller's responsibility to manage the lifecycle of the created \ref cardano_enterprise_address_t object,
+ *       including ensuring that `cardano_enterprise_address_unref` is called to free the address object when it is no
+ *       longer needed, to prevent memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * byte_t serialized_address[] = { ... };  // Example serialized data
+ * size_t serialized_size = sizeof(serialized_address);
+ * cardano_enterprise_address_t* enterprise_address = NULL;
+ *
+ * cardano_error_t result = cardano_enterprise_address_from_bytes(serialized_address, serialized_size, &enterprise_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the enterprise address as needed
+ *   // Once done, ensure to clean up and release the enterprise address
+ *   cardano_enterprise_address_unref(&enterprise_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to create enterprise address from bytes: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_enterprise_address_from_bytes(
+  const byte_t*                  data,
+  size_t                         size,
+  cardano_enterprise_address_t** address);
+
+/**
+ * \brief Retrieves the size in bytes required to serialize an enterprise address.
+ *
+ * This function calculates the size necessary to store the serialized byte array representation of a given
+ * \ref cardano_enterprise_address_t object. This size is useful for allocating buffer space before serializing
+ * an enterprise address into its binary form.
+ *
+ * \param[in] address A pointer to the \ref cardano_enterprise_address_t object whose serialized size is to be retrieved.
+ *
+ * \return The size in bytes required to serialize the enterprise address. Returns 0 if the \p address pointer is NULL
+ *         or if the address is invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_enterprise_address_t* enterprise_address = NULL;
+ * // Assume enterprise_address is already created and valid
+ * size_t required_size = cardano_enterprise_address_get_bytes_size(enterprise_address);
+ *
+ * if (required_size > 0)
+ * {
+ *   byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ *   if (buffer)
+ *   {
+ *     // Proceed to serialize the enterprise address into buffer
+ *   }
+ *
+ *   free(buffer);
+ * }
+ * else
+ * {
+ *   printf("Invalid address or unable to determine size\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_enterprise_address_get_bytes_size(const cardano_enterprise_address_t* address);
+
+/**
+ * \brief Retrieves the byte array representation of an enterprise address.
+ *
+ * This function provides access to the serialized byte array form of a \ref cardano_enterprise_address_t object.
+ *
+ * \param[in] address A pointer to the \ref cardano_enterprise_address_t object whose byte array is to be retrieved.
+ *
+ * \return A pointer to the constant byte array representing the enterprise address. Returns NULL if the \p address
+ *         pointer is NULL.
+ *
+ * \note The returned byte array is managed internally and should not be freed or modified by the caller. It remains
+ *       valid as long as the \ref cardano_enterprise_address_t object is not modified or freed. Use
+ *       \ref cardano_enterprise_address_get_bytes_size to determine the size of the byte array.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_enterprise_address_t* enterprise_address = NULL;
+ * // Assume enterprise_address is already created and valid
+ * const byte_t* address_bytes = cardano_enterprise_address_get_bytes(enterprise_address);
+ *
+ * if (address_bytes != NULL)
+ * {
+ *   // Process or transmit the byte array
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve byte array from enterprise address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_enterprise_address_get_bytes(const cardano_enterprise_address_t* address);
+
+/**
+ * \brief Serializes an enterprise address into a byte array.
+ *
+ * This function takes a \ref cardano_enterprise_address_t object and serializes it into a binary format.
+ * The serialized bytes are written into the provided \p data buffer, which must be large enough to hold
+ * the entire binary representation of the address.
+ *
+ * \param[in] address A pointer to the \ref cardano_enterprise_address_t object to be serialized.
+ * \param[out] data A pointer to a byte array where the serialized data will be written.
+ * \param[in] size The size of the provided buffer in bytes. This size should be at least the value returned
+ *                 by \ref cardano_enterprise_address_get_bytes_size for this address.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully serialized into the byte array.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if the \p address or \p data pointer is NULL. Returns
+ *         \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE if the \p size is too small to hold the serialized data.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_enterprise_address_t* enterprise_address = NULL;
+ * // Assume enterprise_address is previously created and valid
+ * size_t required_size = cardano_enterprise_address_get_bytes_size(enterprise_address);
+ * byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ * if (buffer)
+ * {
+ *   cardano_error_t result = cardano_enterprise_address_to_bytes(enterprise_address, buffer, required_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // The buffer now contains the serialized address
+ *     // Proceed with using the buffer for storage, transmission, etc.
+ *   }
+ *   else
+ *   {
+ *     printf("Failed to serialize enterprise address: %d\n", result);
+ *   }
+ *
+ *   free(buffer);
+ * }
+ * else
+ * {
+ *   printf("Memory allocation for buffer failed\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_enterprise_address_to_bytes(
+  const cardano_enterprise_address_t* address,
+  byte_t*                             data,
+  size_t                              size);
+
+/**
+ * \brief Creates an enterprise address from a Bech32-encoded string.
+ *
+ * This function constructs a \ref cardano_enterprise_address_t object by decoding the provided
+ * Bech32-encoded string that represents the address data.
+ *
+ * \param[in] data A pointer to a character array containing the Bech32-encoded representation of the address.
+ * \param[in] size The size of the Bech32 string in bytes.
+ * \param[out] address A pointer to a pointer to \ref cardano_enterprise_address_t that will be set to the address
+ *                     of the newly created enterprise address object upon successful decoding.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully created. Returns \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p data or \p address pointer is NULL. Returns \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the Bech32 data
+ *         could not be decoded into a valid enterprise address. Returns \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         memory for the decoding buffers could not be allocated. Allocation failures inside the Bech32 decoder itself
+ *         are reported as \ref CARDANO_ERROR_DECODING.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* bech32_data = "addr1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx...";
+ * size_t bech32_size = strlen(bech32_data);
+ * cardano_enterprise_address_t* enterprise_address = NULL;
+ *
+ * cardano_error_t result = cardano_enterprise_address_from_bech32(bech32_data, bech32_size, &enterprise_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the enterprise address
+ *
+ *   // Once done, ensure to clean up and release the enterprise address
+ *   cardano_enterprise_address_unref(&enterprise_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to decode enterprise address from Bech32: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_enterprise_address_from_bech32(
+  const char*                    data,
+  size_t                         size,
+  cardano_enterprise_address_t** address);
+
+/**
+ * \brief Retrieves the size in bytes of the Bech32-encoded representation of an enterprise address.
+ *
+ * This function calculates the size necessary to store the Bech32-encoded representation of a given
+ * \ref cardano_enterprise_address_t address object. This size includes the characters needed to represent
+ * the Bech32 string but does not include the null-termination character.
+ *
+ * \param[in] address A pointer to the \ref cardano_enterprise_address_t object whose Bech32 size is to be retrieved.
+ *
+ * \return The size in bytes of the Bech32-encoded representation of the address, including the null terminator.
+ *         Returns 0 if the \p address pointer is NULL or if the address is invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_enterprise_address_t* enterprise_address = NULL;
+ * // Assume enterprise_address is already created and valid
+ * size_t bech32_size = cardano_enterprise_address_get_bech32_size(enterprise_address);
+ *
+ * if (bech32_size > 0)
+ * {
+ *   char* bech32_string = (char*) malloc(bech32_size);
+ *
+ *   if (bech32_string)
+ *   {
+ *     // Proceed to convert address to Bech32 string
+ *   }
+ *
+ *   free(bech32_string);
+ * }
+ * else
+ * {
+ *   printf("Invalid address or unable to determine size\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_enterprise_address_get_bech32_size(const cardano_enterprise_address_t* address);
+
+/**
+ * \brief Converts an enterprise address to a Bech32-encoded string.
+ *
+ * This function takes a \ref cardano_enterprise_address_t object and converts it into a Bech32 string,
+ * writing the result into the provided \p data buffer. The buffer must be large enough to hold the entire
+ * Bech32 string including the null-termination character.
+ *
+ * \param[in] address A pointer to the \ref cardano_enterprise_address_t object to be converted.
+ * \param[out] data A pointer to a character buffer where the Bech32-encoded string will be stored.
+ * \param[in] size The size of the provided buffer in bytes. This size must be at least the value returned
+ *                 by \ref cardano_enterprise_address_get_bech32_size to ensure it can hold the Bech32 string
+ *                 and the null terminator.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the conversion was successful. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         the \p address or \p data pointer is NULL. Returns \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE if the \p size is too
+ *         small to hold the Bech32 representation including the null terminator.
+ *
+ * \note It is crucial to ensure that the buffer provided in \p data is sufficiently large to accommodate the
+ *       Bech32 string and the null-termination character to prevent buffer overflow errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_enterprise_address_t* enterprise_address = NULL;
+ * // Assume enterprise_address is previously created and valid
+ * size_t required_size = cardano_enterprise_address_get_bech32_size(enterprise_address) + 1; // +1 for null-termination
+ * char* bech32_string = (char*) malloc(required_size);
+ * if (bech32_string)
+ * {
+ *   cardano_error_t result = cardano_enterprise_address_to_bech32(enterprise_address, bech32_string, required_size);
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Bech32 representation: %s\n", bech32_string);
+ *   }
+ *   else
+ *   {
+ *     printf("Failed to convert enterprise address to Bech32: %d\n", result);
+ *   }
+ *   free(bech32_string);
+ * }
+ * else
+ * {
+ *   printf("Memory allocation failed for Bech32 buffer\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_enterprise_address_to_bech32(
+  const cardano_enterprise_address_t* address,
+  char*                               data,
+  size_t                              size);
+
+/**
+ * \brief Retrieves the string representation of an enterprise address.
+ *
+ * This function provides access to the string form of a \ref cardano_enterprise_address_t object. It allows for
+ * easy display and logging of the address in a human-readable format.
+ *
+ * \param[in] address A pointer to the \ref cardano_enterprise_address_t object whose string representation is to be retrieved.
+ *
+ * \return A pointer to a constant character string representing the enterprise address. Returns NULL if the \p address
+ *         pointer is NULL or if the address cannot be properly serialized into a string form.
+ *
+ * \note The returned string is managed internally and should not be freed or modified by the caller. It remains
+ *       valid as long as the \ref cardano_enterprise_address_t object is not modified or freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_enterprise_address_t* enterprise_address = NULL;
+ * // Assume enterprise_address is previously created and valid
+ * const char* address_string = cardano_enterprise_address_get_string(enterprise_address);
+ *
+ * if (address_string != NULL)
+ * {
+ *   printf("Enterprise Address: %s\n", address_string);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve string representation of the enterprise address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_enterprise_address_get_string(const cardano_enterprise_address_t* address);
+
+/**
+ * \brief Retrieves the network ID from a given Cardano enterprise address.
+ *
+ * This function extracts the network identifier from the provided \ref cardano_enterprise_address_t object.
+ * The network ID indicates whether the address belongs to the test network or the main network.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_enterprise_address_t object from which the network ID is to be retrieved.
+ * \param[out] network_id A pointer to \ref cardano_network_id_t where the network ID will be stored upon successful
+ *                        extraction. This parameter cannot be NULL.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the network ID was successfully retrieved.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if the input address or network_id pointer is NULL.
+ *         Returns other error codes as defined in \ref cardano_error_t if the network ID cannot be retrieved due to
+ *         malformed or unrecognized address formats.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_enterprise_address_t* address = NULL;
+ * cardano_network_id_t network_id;
+ *
+ * cardano_error_t get_network_id = cardano_enterprise_address_get_network_id(address, &network_id);
+ *
+ * if (get_network_id != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to determine the network id.\n");
+ * }
+ * else
+ * {
+ *   printf("Network ID: %d\n", network_id);
+ * }
+ *
+ * cardano_enterprise_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_enterprise_address_get_network_id(
+  const cardano_enterprise_address_t* address,
+  cardano_network_id_t*               network_id);
+
+/**
+ * \brief Decrements the enterprise address's reference count.
+ *
+ * If the reference count reaches zero, the enterprise address memory is deallocated.
+ *
+ * \param[in] address Pointer to the enterprise address whose reference count is to be decremented.
+ */
+CARDANO_EXPORT void cardano_enterprise_address_unref(cardano_enterprise_address_t** address);
+
+/**
+ * \brief Increments the enterprise address's reference count.
+ *
+ * Ensures that the enterprise address remains allocated until the last reference is released.
+ *
+ * \param[in] address enterprise address whose reference count is to be incremented.
+ */
+CARDANO_EXPORT void cardano_enterprise_address_ref(cardano_enterprise_address_t* address);
+
+/**
+ * \brief Retrieves the enterprise address's current reference count.
+ *
+ * \warning Does not account for transitive references.
+ *
+ * \param[in] address Target enterprise address.
+ * \return Current reference count of the enterprise address.
+ */
+CARDANO_EXPORT size_t cardano_enterprise_address_refcount(const cardano_enterprise_address_t* address);
+
+/**
+ * \brief Sets the last error message for a given enterprise address.
+ *
+ * This function records an error message in the enterprise address's last_error buffer,
+ * overwriting any previous message. The message is truncated if it exceeds
+ * the buffer size. This function is typically used to store descriptive
+ * error information that can be retrieved later with
+ * cardano_enterprise_address_get_last_error.
+ *
+ * \param[in,out] address A pointer to the cardano_enterprise_address_t instance whose last error
+ *               message is to be set. If the enterprise address is NULL, the function
+ *               has no effect.
+ * \param[in] message A null-terminated string containing the error message to be
+ *                recorded. If the message is NULL, the enterprise address's last_error
+ *                will be set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters due to the fixed size
+ *       of the last_error buffer (1024 characters), including the null
+ *       terminator. Messages longer than this limit will be truncated.
+ */
+CARDANO_EXPORT void cardano_enterprise_address_set_last_error(cardano_enterprise_address_t* address, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific enterprise address.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_enterprise_address_set_last_error for the given
+ * enterprise address. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in,out] address A pointer to the \ref cardano_enterprise_address_t instance whose last error
+ *               message is to be retrieved. If the enterprise address is \c NULL, the function
+ *               returns a generic error message indicating the null enterprise address.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified enterprise address. If the enterprise address is \c NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the enterprise address and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_enterprise_address_set_last_error for the same enterprise address, or until
+ *       the enterprise address is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_enterprise_address_get_last_error(const cardano_enterprise_address_t* address);
+
+/**
+ * \brief Creates an independent deep copy of the address and its credentials.
+ * \param[in] source Address to copy. Must not be NULL.
+ * \param[out] clone Receives one owned reference, or NULL on failure. Must not be NULL.
+ * \return CARDANO_SUCCESS, CARDANO_ERROR_POINTER_IS_NULL, or CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ * \note Release the result with cardano_enterprise_address_unref. The source is unchanged.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_enterprise_address_deep_clone(const cardano_enterprise_address_t* source, cardano_enterprise_address_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ENTERPRISE_ADDRESS_H
diff --git a/vendor/include/cardano/address/pointer_address.h b/vendor/include/cardano/address/pointer_address.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/address/pointer_address.h
@@ -0,0 +1,733 @@
+/**
+ * \file pointer_address.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_POINTER_ADDRESS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_POINTER_ADDRESS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+#include <cardano/address/stake_pointer.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/network_id.h>
+
+/* FORWARD DECLARATIONS *****************************************************/
+
+/**
+ * \brief Represents a Cardano address.
+ *
+ * This structure encapsulates all the necessary information for a Cardano address.
+ */
+typedef struct cardano_address_t cardano_address_t;
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a pointer address in the Cardano blockchain ecosystem.
+ *
+ * A pointer address indirectly specifies the stake key that should control the stake for the address. It references
+ * a stake key by a stake key pointer, which is a location on the blockchain of the stake key registration certificate
+ * for that key.
+ */
+typedef struct cardano_pointer_address_t cardano_pointer_address_t;
+
+/**
+ * \brief Creates a pointer address from network and payment credentials and a stake pointer.
+ *
+ * This function constructs a \ref cardano_pointer_address_t object by using a network identifier,
+ * payment credentials, and a stake pointer. The stake pointer directs to a stake key registration
+ * certificate on the blockchain, allowing the address to indirectly specify staking rights without
+ * embedding a stake key.
+ *
+ * \param[in] network_id The network identifier, which specifies the Cardano network (e.g., mainnet, testnet).
+ * \param[in] payment A pointer to a \ref cardano_credential_t object representing the payment credentials.
+ * \param[in] pointer A \ref cardano_stake_pointer_t structure that specifies the location of the stake key
+ *                    registration certificate on the blockchain.
+ * \param[out] pointer_address A pointer to a pointer to \ref cardano_pointer_address_t that will be set to
+ *                              the address of the newly created pointer address object upon successful
+ *                              address creation.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the pointer address was successfully created. Returns
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if any of the pointers (\p payment or \p pointer_address) are NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the created \ref cardano_pointer_address_t
+ *       object, including ensuring that `cardano_pointer_address_unref` is called to free the address object
+ *       when it is no longer needed, to prevent memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* payment_credential = ...;     // Initialized elsewhere
+ * cardano_stake_pointer_t stake_pointer = { 5756214, 1, 0 };  // Example pointer to a stake key registration
+ * cardano_pointer_address_t* pointer_address = NULL;
+ * cardano_error_t result = cardano_pointer_address_from_credentials(
+ *      CARDANO_NETWORK_ID_MAIN_NET,
+ *      payment_credentials,
+ *      stake_pointer,
+ *      &pointer_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pointer address as needed
+ *   // Once done, ensure to clean up and release the pointer address
+ *   cardano_pointer_address_unref(&pointer_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to create pointer address: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pointer_address_from_credentials(
+  cardano_network_id_t        network_id,
+  cardano_credential_t*       payment,
+  cardano_stake_pointer_t     pointer,
+  cardano_pointer_address_t** pointer_address);
+
+/**
+ * \brief Converts a general Cardano address to a pointer address.
+ *
+ * This function takes an existing \ref cardano_address_t object and attempts to create a corresponding
+ * \ref cardano_pointer_address_t object.
+ *
+ * \param[in] address A pointer to the \ref cardano_address_t object that is to be converted into a pointer address.
+ * \param[out] pointer_address A pointer to a pointer to \ref cardano_pointer_address_t that will be set
+ *                              to the address of the newly created pointer address object upon successful
+ *                              conversion.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the conversion was successful. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         the \p address or \p pointer_address pointer is NULL. Returns \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the
+ *         provided address cannot be converted to a pointer address.
+ *
+ * \note It is the caller's responsibility to manage the lifecycle of the created \ref cardano_pointer_address_t object,
+ *       including calling `cardano_pointer_address_unref` to free the address object when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* general_address = NULL;
+ * // Assume general_address is previously created and represents a valid Cardano address
+ * cardano_pointer_address_t* pointer_address = NULL;
+ * cardano_error_t result = cardano_pointer_address_from_address(general_address, &pointer_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The address has been successfully converted to a pointer address
+ *   // Use the pointer address as needed
+ *
+ *   // Once done, ensure to clean up and release the pointer address
+ *   cardano_pointer_address_unref(&pointer_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert to pointer address: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pointer_address_from_address(
+  const cardano_address_t*    address,
+  cardano_pointer_address_t** pointer_address);
+
+/**
+ * \brief Converts a pointer address to a general Cardano address.
+ *
+ * This function takes a \ref cardano_pointer_address_t object representing a pointer address and converts
+ * it back to a general \ref cardano_address_t object. This is useful for operations that require the use of
+ * a generic address format instead of a pointer-specific format, particularly in interfaces that do not support
+ * the direct use of pointer addresses.
+ *
+ * \param[in] pointer_address A pointer to the \ref cardano_pointer_address_t object that is to be converted
+ *                            into a general Cardano address.
+ *
+ * \return A pointer to a newly created \ref cardano_address_t object representing the general address. Returns NULL
+ *         if the \p pointer_address is NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_address_t object, including
+ *       calling `cardano_address_unref` to free the object when it is no longer needed. Failure to do so can result in
+ *       memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pointer_address_t* pointer_address = NULL;
+ * // Assume pointer_address is previously created and represents a valid pointer address
+ * cardano_address_t* general_address = cardano_pointer_address_to_address(pointer_address);
+ *
+ * if (general_address != NULL)
+ * {
+ *   // The pointer address has been successfully converted to a general Cardano address
+ *   // Use the general address as needed
+ *
+ *   // Once done, ensure to clean up and release the general address
+ *   cardano_address_unref(&general_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert pointer address to a general address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_address_t* cardano_pointer_address_to_address(
+  const cardano_pointer_address_t* pointer_address);
+
+/**
+ * \brief Retrieves the payment credential from a pointer address.
+ *
+ * This function extracts the payment credential from a \ref cardano_pointer_address_t object.
+ *
+ * \param[in] pointer_address A pointer to the \ref cardano_pointer_address_t object from which the payment
+ *                            credential is to be retrieved.
+ *
+ * \return A pointer to a \ref cardano_credential_t object representing the payment credential. Returns NULL if the
+ *         \p pointer_address is NULL.
+ *
+ * \note The lifecycle of the returned \ref cardano_credential_t object must be managed by the caller. It is important to
+ *       call `cardano_credential_unref` to free this object when it is no longer needed to prevent memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pointer_address_t* pointer_address = NULL;
+ * // Assume pointer_address is previously created and represents a valid pointer address
+ * const cardano_credential_t* payment_credential = cardano_pointer_address_get_payment_credential(pointer_address);
+ *
+ * if (payment_credential != NULL)
+ * {
+ *   // The payment credential can be used to initiate transactions or for other purposes
+ *
+ *   cardano_credential_unref(&payment_credential);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve payment credential from pointer address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_pointer_address_get_payment_credential(
+  cardano_pointer_address_t* pointer_address);
+
+/**
+ * \brief Retrieves the stake pointer from a pointer address.
+ *
+ * This function extracts the stake pointer from a \ref cardano_pointer_address_t object.
+ *
+ * \param[in] address A pointer to the \ref cardano_pointer_address_t object from which the stake pointer
+ *                    is to be retrieved.
+ * \param[out] pointer A pointer to a \ref cardano_stake_pointer_t structure that will be populated with the
+ *                     stake pointer information if the retrieval is successful.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the stake pointer was successfully retrieved. Returns
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if the \p address or \p pointer argument is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pointer_address_t* pointer_address = NULL;
+ * // Assume pointer_address is previously created and represents a valid pointer address
+ * cardano_stake_pointer_t stake_pointer;
+ * cardano_error_t result = cardano_pointer_address_get_stake_pointer(pointer_address, &stake_pointer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Stake Pointer - Slot: %llu, Tx Index: %llu, Cert Index: %llu\n",
+ *          stake_pointer.slot, stake_pointer.tx_index, stake_pointer.cert_index);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve stake pointer from address: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pointer_address_get_stake_pointer(
+  const cardano_pointer_address_t* address,
+  cardano_stake_pointer_t*         pointer);
+
+/**
+ * \brief Creates a pointer address from a byte array.
+ *
+ * This function constructs a \ref cardano_pointer_address_t object by decoding a byte array that
+ * represents a pointer address in serialized form.
+ *
+ * \param[in] data A pointer to the byte array containing the serialized pointer address data.
+ * \param[in] size The size of the byte array in bytes.
+ * \param[out] address A pointer to a pointer to \ref cardano_pointer_address_t that will be set to the address
+ *                     of the newly created pointer address object upon successful decoding.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully created. Returns \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p data or \p address pointer is NULL. Returns \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the byte array data
+ *         could not be decoded into a valid pointer address.
+ *
+ * \note It is the caller's responsibility to manage the lifecycle of the created \ref cardano_pointer_address_t object,
+ *       including ensuring that `cardano_pointer_address_unref` is called to free the address object when it is no
+ *       longer needed, to prevent memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * byte_t serialized_address[] = { ... };
+ * size_t serialized_size = sizeof(serialized_address);
+ * cardano_pointer_address_t* pointer_address = NULL;
+ *
+ * cardano_error_t result = cardano_pointer_address_from_bytes(serialized_address, serialized_size, &pointer_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pointer address as needed
+ *   // Once done, ensure to clean up and release the pointer address
+ *   cardano_pointer_address_unref(&pointer_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to create pointer address from bytes: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pointer_address_from_bytes(
+  const byte_t*               data,
+  size_t                      size,
+  cardano_pointer_address_t** address);
+
+/**
+ * \brief Retrieves the size in bytes required to serialize a pointer address.
+ *
+ * This function calculates the size necessary to store the serialized byte array representation of a given
+ * \ref cardano_pointer_address_t object.
+ *
+ * \param[in] address A pointer to the \ref cardano_pointer_address_t object whose serialized size is to be retrieved.
+ *
+ * \return The size in bytes required to serialize the pointer address. Returns 0 if the \p address pointer is NULL
+ *         or if the address is invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pointer_address_t* pointer_address = NULL;
+ * // Assume pointer_address is already created and valid
+ * size_t required_size = cardano_pointer_address_get_bytes_size(pointer_address);
+ *
+ * if (required_size > 0)
+ * {
+ *   byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ *   if (buffer)
+ *   {
+ *     // Proceed to serialize the pointer address into buffer
+ *   }
+ *
+ *  free(buffer);
+ * }
+ * else
+ * {
+ *   printf("Invalid address or unable to determine size\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_pointer_address_get_bytes_size(const cardano_pointer_address_t* address);
+
+/**
+ * \brief Retrieves the byte array representation of a pointer address.
+ *
+ * This function provides access to the serialized byte array form of a \ref cardano_pointer_address_t object.
+ *
+ * \param[in] address A pointer to the \ref cardano_pointer_address_t object whose byte array is to be retrieved.
+ *
+ * \return A pointer to the constant byte array representing the pointer address. Returns NULL if the \p address
+ *         pointer is NULL.
+ *
+ * \note The returned byte array is managed internally and should not be freed or modified by the caller. It remains
+ *       valid as long as the \ref cardano_pointer_address_t object is not modified or freed. Use
+ *       \ref cardano_pointer_address_get_bytes_size to determine the size of the byte array.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pointer_address_t* pointer_address = NULL;
+ * // Assume pointer_address is already created and valid
+ * const byte_t* address_bytes = cardano_pointer_address_get_bytes(pointer_address);
+ * size_t bytes_size = cardano_pointer_address_get_bytes_size(pointer_address);
+ *
+ * if (address_bytes != NULL)
+ * {
+ *   // Process or transmit the byte array
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve byte array from pointer address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_pointer_address_get_bytes(const cardano_pointer_address_t* address);
+
+/**
+ * \brief Serializes a pointer address into a byte array.
+ *
+ * This function takes a \ref cardano_pointer_address_t object and serializes it into a binary format.
+ * The serialized bytes are written into the provided \p data buffer, which must be large enough to hold
+ * the entire binary representation of the address.
+ *
+ * \param[in] address A pointer to the \ref cardano_pointer_address_t object to be serialized.
+ * \param[out] data A pointer to a byte array where the serialized data will be written.
+ * \param[in] size The size of the provided buffer in bytes. This size should be at least the value returned
+ *                 by \ref cardano_pointer_address_get_bytes_size to ensure it can hold the serialized data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully serialized into the byte array.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if the \p address or \p data pointer is NULL. Returns
+ *         \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE if the \p size is too small to hold the serialized data.
+ *
+ * \note The buffer provided in \p data must be sufficiently large to accommodate
+ *       the serialized data to prevent buffer overflow errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pointer_address_t* pointer_address = NULL;
+ * // Assume pointer_address is previously created and valid
+ * size_t required_size = cardano_pointer_address_get_bytes_size(pointer_address);
+ * byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ * if (buffer)
+ * {
+ *   cardano_error_t result = cardano_pointer_address_to_bytes(pointer_address, buffer, required_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // The buffer now contains the serialized address
+ *     // Proceed with using the buffer for storage, transmission, etc.
+ *   }
+ *   else
+ *   {
+ *     printf("Failed to serialize pointer address: %d\n", result);
+ *   }
+ *
+ *  free(buffer);
+ * }
+ * else
+ * {
+ *   printf("Memory allocation for buffer failed\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pointer_address_to_bytes(
+  const cardano_pointer_address_t* address,
+  byte_t*                          data,
+  size_t                           size);
+
+/**
+ * \brief Creates a pointer address from a Bech32-encoded string.
+ *
+ * This function constructs a \ref cardano_pointer_address_t object by decoding the provided
+ * Bech32-encoded string that represents the address data.
+ *
+ * \param[in] data A pointer to a character array containing the Bech32-encoded representation of the address.
+ * \param[in] size The size of the Bech32 string in bytes.
+ * \param[out] address A pointer to a pointer to \ref cardano_pointer_address_t that will be set to the address
+ *                     of the newly created pointer address object upon successful decoding.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully created. Returns \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p data or \p address pointer is NULL. Returns \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the Bech32 data
+ *         could not be decoded into a valid pointer address. Returns \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         memory for the decoding buffers could not be allocated. Allocation failures inside the Bech32 decoder itself
+ *         are reported as \ref CARDANO_ERROR_DECODING.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* bech32_data = "addr1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx...";
+ * size_t bech32_size = strlen(bech32_data);
+ * cardano_pointer_address_t* cardano_pointer = NULL;
+ *
+ * cardano_error_t result = cardano_pointer_address_from_bech32(bech32_data, bech32_size, &cardano_pointer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pointer address
+ *
+ *   // Once done, ensure to clean up and release the pointer address
+ *   cardano_pointer_address_unref(&cardano_pointer);
+ * }
+ * else
+ * {
+ *   printf("Failed to decode pointer address from Bech32: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pointer_address_from_bech32(
+  const char*                 data,
+  size_t                      size,
+  cardano_pointer_address_t** address);
+
+/**
+ * \brief Retrieves the size in bytes of the Bech32-encoded representation of a pointer address.
+ *
+ * This function calculates the size necessary to store the Bech32-encoded representation of a given
+ * \ref cardano_pointer_address_t address object. This size includes the characters needed to represent
+ * the Bech32 string but does not include the null-termination character.
+ *
+ * \param[in] address A pointer to the \ref cardano_pointer_address_t object whose Bech32 size is to be retrieved.
+ *
+ * \return The size in bytes of the Bech32-encoded representation of the address, including the null terminator.
+ *         Returns 0 if the \p address pointer is NULL or if the address is invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pointer_address_t* cardano_pointer = NULL;
+ * // Assume cardano_pointer is already created and valid
+ * size_t bech32_size = cardano_pointer_address_get_bech32_size(cardano_pointer);
+ *
+ * if (bech32_size > 0)
+ * {
+ *   char* bech32_string = (char*) malloc(bech32_size);
+ *
+ *   if (bech32_string)
+ *   {
+ *     // Proceed to convert address to Bech32 string
+ *   }
+ *
+ *   free(bech32_string);
+ * }
+ * else
+ * {
+ *   printf("Invalid address or unable to determine size\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_pointer_address_get_bech32_size(const cardano_pointer_address_t* address);
+
+/**
+ * \brief Converts a pointer address to a Bech32-encoded string.
+ *
+ * This function takes a \ref cardano_pointer_address_t object and converts it into a Bech32 string,
+ * writing the result into the provided \p data buffer. The buffer must be large enough to hold the entire
+ * Bech32 string including the null-termination character.
+ *
+ * \param[in] address A pointer to the \ref cardano_pointer_address_t object to be converted.
+ * \param[out] data A pointer to a character buffer where the Bech32-encoded string will be stored.
+ * \param[in] size The size of the provided buffer in bytes. This size must be at least the value returned
+ *                 by \ref cardano_pointer_address_get_bech32_size to ensure it can hold the Bech32 string
+ *                 and the null terminator.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the conversion was successful. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         the \p address or \p data pointer is NULL. Returns \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE if the \p size is too
+ *         small to hold the Bech32 representation including the null terminator.
+ *
+ * \note It is crucial to ensure that the buffer provided in \p data is sufficiently large to accommodate the
+ *       Bech32 string and the null-termination character to prevent buffer overflow errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pointer_address_t* cardano_pointer = NULL;
+ * // Assume cardano_pointer is previously created and valid
+ * size_t required_size = cardano_pointer_address_get_bech32_size(cardano_pointer) + 1; // +1 for null-termination
+ * char* bech32_string = (char*) malloc(required_size);
+ * if (bech32_string)
+ * {
+ *   cardano_error_t result = cardano_pointer_address_to_bech32(cardano_pointer, bech32_string, required_size);
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Bech32 representation: %s\n", bech32_string);
+ *   }
+ *   else
+ *   {
+ *     printf("Failed to convert pointer address to Bech32: %d\n", result);
+ *   }
+ *   free(bech32_string);
+ * }
+ * else
+ * {
+ *   printf("Memory allocation failed for Bech32 buffer\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pointer_address_to_bech32(
+  const cardano_pointer_address_t* address,
+  char*                            data,
+  size_t                           size);
+
+/**
+ * \brief Retrieves the string representation of a pointer address.
+ *
+ * This function provides access to the string form of a \ref cardano_pointer_address_t object. It allows for
+ * easy display and logging of the address in a human-readable format.
+ *
+ * \param[in] address A pointer to the \ref cardano_pointer_address_t object whose string representation is to be retrieved.
+ *
+ * \return A pointer to a constant character string representing the pointer address. Returns NULL if the \p address
+ *         pointer is NULL or if the address cannot be properly serialized into a string form.
+ *
+ * \note The returned string is managed internally and should not be freed or modified by the caller. It remains
+ *       valid as long as the \ref cardano_pointer_address_t object is not modified or freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pointer_address_t* cardano_pointer = NULL;
+ * // Assume cardano_pointer is previously created and valid
+ * const char* address_string = cardano_pointer_address_get_string(cardano_pointer);
+ *
+ * if (address_string != NULL)
+ * {
+ *   printf("Pointer Address: %s\n", address_string);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve string representation of the pointer address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_pointer_address_get_string(const cardano_pointer_address_t* address);
+
+/**
+ * \brief Retrieves the network ID from a given Cardano pointer address.
+ *
+ * This function extracts the network identifier from the provided \ref cardano_pointer_address_t object.
+ * The network ID indicates whether the address belongs to the test network or the main network.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_pointer_address_t object from which the network ID is to be retrieved.
+ * \param[out] network_id A pointer to \ref cardano_network_id_t where the network ID will be stored upon successful
+ *                        extraction. This parameter cannot be NULL.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the network ID was successfully retrieved.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if the input address or network_id pointer is NULL.
+ *         Returns other error codes as defined in \ref cardano_error_t if the network ID cannot be retrieved due to
+ *         malformed or unrecognized address formats.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pointer_address_t* address = NULL;
+ * cardano_network_id_t network_id;
+ *
+ * cardano_error_t get_network_id = cardano_pointer_address_get_network_id(address, &network_id);
+ *
+ * if (get_network_id != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to determine the network id.\n");
+ * }
+ * else
+ * {
+ *   printf("Network ID: %d\n", network_id);
+ * }
+ *
+ * cardano_pointer_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pointer_address_get_network_id(
+  const cardano_pointer_address_t* address,
+  cardano_network_id_t*            network_id);
+
+/**
+ * \brief Decrements the pointer address's reference count.
+ *
+ * If the reference count reaches zero, the pointer address memory is deallocated.
+ *
+ * \param[in] address Pointer to the pointer address whose reference count is to be decremented.
+ */
+CARDANO_EXPORT void cardano_pointer_address_unref(cardano_pointer_address_t** address);
+
+/**
+ * \brief Increments the pointer address's reference count.
+ *
+ * Ensures that the pointer address remains allocated until the last reference is released.
+ *
+ * \param[in] address pointer address whose reference count is to be incremented.
+ */
+CARDANO_EXPORT void cardano_pointer_address_ref(cardano_pointer_address_t* address);
+
+/**
+ * \brief Retrieves the pointer address's current reference count.
+ *
+ * \warning Does not account for transitive references.
+ *
+ * \param[in] address Target pointer address.
+ * \return Current reference count of the pointer address.
+ */
+CARDANO_EXPORT size_t cardano_pointer_address_refcount(const cardano_pointer_address_t* address);
+
+/**
+ * \brief Sets the last error message for a given pointer address.
+ *
+ * This function records an error message in the pointer address's last_error buffer,
+ * overwriting any previous message. The message is truncated if it exceeds
+ * the buffer size. This function is typically used to store descriptive
+ * error information that can be retrieved later with
+ * cardano_pointer_address_get_last_error.
+ *
+ * \param[in,out] address A pointer to the cardano_pointer_address_t instance whose last error
+ *               message is to be set. If the pointer address is NULL, the function
+ *               has no effect.
+ * \param[in] message A null-terminated string containing the error message to be
+ *                recorded. If the message is NULL, the pointer address's last_error
+ *                will be set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters due to the fixed size
+ *       of the last_error buffer (1024 characters), including the null
+ *       terminator. Messages longer than this limit will be truncated.
+ */
+CARDANO_EXPORT void cardano_pointer_address_set_last_error(cardano_pointer_address_t* address, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific pointer address.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_pointer_address_set_last_error for the given
+ * pointer address. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in,out] address A pointer to the \ref cardano_pointer_address_t instance whose last error
+ *               message is to be retrieved. If the pointer address is \c NULL, the function
+ *               returns a generic error message indicating the null pointer address.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified pointer address. If the pointer address is \c NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the pointer address and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_pointer_address_set_last_error for the same pointer address, or until
+ *       the pointer address is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_pointer_address_get_last_error(const cardano_pointer_address_t* address);
+
+/**
+ * \brief Creates an independent deep copy of the address and its credentials.
+ * \param[in] source Address to copy. Must not be NULL.
+ * \param[out] clone Receives one owned reference, or NULL on failure. Must not be NULL.
+ * \return CARDANO_SUCCESS, CARDANO_ERROR_POINTER_IS_NULL, or CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ * \note Release the result with cardano_pointer_address_unref. The source is unchanged.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_pointer_address_deep_clone(const cardano_pointer_address_t* source, cardano_pointer_address_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_POINTER_ADDRESS_H
diff --git a/vendor/include/cardano/address/reward_address.h b/vendor/include/cardano/address/reward_address.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/address/reward_address.h
@@ -0,0 +1,668 @@
+/**
+ * \file reward_address.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_REWARD_ADDRESS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_REWARD_ADDRESS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/credential.h>
+#include <cardano/common/network_id.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* FORWARD DECLARATIONS *****************************************************/
+
+/**
+ * \brief Represents a reward address in the Cardano blockchain ecosystem.
+ */
+typedef struct cardano_address_t cardano_address_t;
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a reward address in the Cardano blockchain ecosystem.
+ *
+ * A reward address is a cryptographic hash of the public stake key of the address. Reward account addresses are used
+ * to distribute rewards for participating in the proof-of-stake protocol (either directly or via delegation).
+ */
+typedef struct cardano_reward_address_t cardano_reward_address_t;
+
+/**
+ * \brief Creates a reward address from network and credentials.
+ *
+ * This function constructs a \ref cardano_reward_address_t object by using a network identifier and
+ * credentials.
+ *
+ * \param[in] network_id The network identifier, which specifies the Cardano network (e.g., mainnet, testnet).
+ * \param[in] credential A pointer to a \ref cardano_credential_t object representing the credentials,
+ *                    typically linked to a staking key.
+ * \param[out] reward_address A pointer to a pointer to \ref cardano_reward_address_t that will be set to
+ *                            the address of the newly created reward address object upon successful
+ *                            address creation.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the reward address was successfully created. Returns
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if any of the pointers (\p  or \p reward_address) are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t credential = {...};  // Initialized elsewhere
+ * cardano_reward_address_t* reward_address = NULL;
+ * cardano_error_t result = cardano_reward_address_from_credentials(CARDANO_NETWORK_ID_MAIN_NET, &credential, &reward_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the reward address for receiving staking rewards
+ *   // Once done, ensure to clean up and release the reward address
+ *   cardano_reward_address_unref(&reward_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to create reward address: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_reward_address_from_credentials(
+  cardano_network_id_t       network_id,
+  cardano_credential_t*      credential,
+  cardano_reward_address_t** reward_address);
+
+/**
+ * \brief Converts a general Cardano address to a specific reward address.
+ *
+ * This function constructs a \ref cardano_reward_address_t object from an existing \ref cardano_address_t object.
+ *
+ * \param[in] address A pointer to the \ref cardano_address_t object that represents a general Cardano address.
+ * \param[out] reward_address A pointer to a pointer to \ref cardano_reward_address_t that will be set to
+ *                            the address of the newly created reward address object upon successful conversion.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the reward address was successfully created. Returns
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if any of the pointers (\p address or \p reward_address) are NULL.
+ *
+ * \note It is the responsibility of the caller to manage the lifecycle of the created \ref cardano_reward_address_t object,
+ *       ensuring that `cardano_reward_address_unref` is called to free the address object when it is no longer needed,
+ *       to prevent memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* general_address = NULL;  // Assume general_address is previously created and valid
+ * cardano_reward_address_t* reward_address = NULL;
+ * cardano_error_t result = cardano_reward_address_from_address(general_address, &reward_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Once done, ensure to clean up and release the reward address
+ *   cardano_reward_address_unref(&reward_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert to reward address: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_reward_address_from_address(
+  const cardano_address_t*   address,
+  cardano_reward_address_t** reward_address);
+
+/**
+ * \brief Converts a reward address to a general Cardano address.
+ *
+ * This function takes a \ref cardano_reward_address_t object representing a reward address and converts
+ * it back to a general \ref cardano_address_t object.
+ *
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t object that is to be converted
+ *                           into a general Cardano address.
+ *
+ * \return A pointer to a newly created \ref cardano_address_t object representing the general address. Returns NULL
+ *         if the \p reward_address is NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_address_t object, including
+ *       calling `cardano_address_unref` to free the object when it is no longer needed. Failure to do so can result in
+ *       memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_t* reward_address = NULL;
+ * // Assume reward_address is previously created and represents a valid reward address
+ * cardano_address_t* general_address = cardano_reward_address_to_address(reward_address);
+ *
+ * if (general_address != NULL)
+ * {
+ *   // The reward address has been successfully converted to a general Cardano address
+ *   // Use the general address as needed
+ *
+ *   // Once done, ensure to clean up and release the general address
+ *   cardano_address_unref(&general_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert reward address to a general address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_address_t* cardano_reward_address_to_address(
+  const cardano_reward_address_t* reward_address);
+
+/**
+ * \brief Retrieves the credential from a reward address.
+ *
+ * This function extracts the credential from a \ref cardano_reward_address_t object.
+ *
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t object from which the
+ *                           credential is to be retrieved.
+ *
+ * \note The lifecycle of the returned \ref cardano_credential_t object must be managed by the caller. It is important to
+ *       call `cardano_credential_unref` to free this object when it is no longer needed to prevent memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_t* reward_address = NULL;
+ * // Assume reward_address is previously created and represents a valid reward address
+ * const cardano_credential_t* _credential = cardano_reward_address_get__credential(reward_address);
+ *
+ * if (_credential != NULL)
+ * {
+ *   // The credential can be used for transactions or other purposes
+ *
+ *   cardano_credential_unref(&_credential);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve credential from reward address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_reward_address_get_credential(
+  cardano_reward_address_t* reward_address);
+
+/**
+ * \brief Creates a pointer address from a byte array.
+ *
+ * This function constructs a \ref cardano_reward_address_t object by decoding a byte array that
+ * represents a pointer address in serialized form.
+ *
+ * \param[in] data A pointer to the byte array containing the serialized pointer address data.
+ * \param[in] size The size of the byte array in bytes.
+ * \param[out] address A pointer to a pointer to \ref cardano_reward_address_t that will be set to the address
+ *                     of the newly created pointer address object upon successful decoding.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully created. Returns \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p data or \p address pointer is NULL. Returns \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the byte array data
+ *         could not be decoded into a valid pointer address.
+ *
+ * \note It is the caller's responsibility to manage the lifecycle of the created \ref cardano_reward_address_t object,
+ *       including ensuring that `cardano_reward_address_unref` is called to free the address object when it is no
+ *       longer needed, to prevent memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * byte_t serialized_address[] = { ... };
+ * size_t serialized_size = sizeof(serialized_address);
+ * cardano_reward_address_t* reward_address = NULL;
+ *
+ * cardano_error_t result = cardano_reward_address_from_bytes(serialized_address, serialized_size, &reward_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pointer address as needed
+ *   // Once done, ensure to clean up and release the pointer address
+ *   cardano_reward_address_unref(&reward_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to create pointer address from bytes: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_reward_address_from_bytes(
+  const byte_t*              data,
+  size_t                     size,
+  cardano_reward_address_t** address);
+
+/**
+ * \brief Retrieves the size in bytes required to serialize a pointer address.
+ *
+ * This function calculates the size necessary to store the serialized byte array representation of a given
+ * \ref cardano_reward_address_t object.
+ *
+ * \param[in] address A pointer to the \ref cardano_reward_address_t object whose serialized size is to be retrieved.
+ *
+ * \return The size in bytes required to serialize the pointer address. Returns 0 if the \p address pointer is NULL
+ *         or if the address is invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_t* reward_address = NULL;
+ * // Assume reward_address is already created and valid
+ * size_t required_size = cardano_reward_address_get_bytes_size(reward_address);
+ *
+ * if (required_size > 0)
+ * {
+ *   byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ *   if (buffer)
+ *   {
+ *     // Proceed to serialize the pointer address into buffer
+ *   }
+ *
+ *  free(buffer);
+ * }
+ * else
+ * {
+ *   printf("Invalid address or unable to determine size\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_reward_address_get_bytes_size(const cardano_reward_address_t* address);
+
+/**
+ * \brief Retrieves the byte array representation of a pointer address.
+ *
+ * This function provides access to the serialized byte array form of a \ref cardano_reward_address_t object.
+ *
+ * \param[in] address A pointer to the \ref cardano_reward_address_t object whose byte array is to be retrieved.
+ *
+ * \return A pointer to the constant byte array representing the pointer address. Returns NULL if the \p address
+ *         pointer is NULL.
+ *
+ * \note The returned byte array is managed internally and should not be freed or modified by the caller. It remains
+ *       valid as long as the \ref cardano_reward_address_t object is not modified or freed. Use
+ *       \ref cardano_reward_address_get_bytes_size to determine the size of the byte array.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_t* reward_address = NULL;
+ * // Assume reward_address is already created and valid
+ * const byte_t* address_bytes = cardano_reward_address_get_bytes(reward_address);
+ * size_t bytes_size = cardano_reward_address_get_bytes_size(reward_address);
+ *
+ * if (address_bytes != NULL)
+ * {
+ *   // Process or transmit the byte array
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve byte array from pointer address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_reward_address_get_bytes(const cardano_reward_address_t* address);
+
+/**
+ * \brief Serializes a pointer address into a byte array.
+ *
+ * This function takes a \ref cardano_reward_address_t object and serializes it into a binary format.
+ * The serialized bytes are written into the provided \p data buffer, which must be large enough to hold
+ * the entire binary representation of the address.
+ *
+ * \param[in] address A pointer to the \ref cardano_reward_address_t object to be serialized.
+ * \param[out] data A pointer to a byte array where the serialized data will be written.
+ * \param[in] size The size of the provided buffer in bytes. This size should be at least the value returned
+ *                 by \ref cardano_reward_address_get_bytes_size to ensure it can hold the serialized data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully serialized into the byte array.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if the \p address or \p data pointer is NULL. Returns
+ *         \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE if the \p size is too small to hold the serialized data.
+ *
+ * \note The buffer provided in \p data must be sufficiently large to accommodate
+ *       the serialized data to prevent buffer overflow errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_t* reward_address = NULL;
+ * // Assume reward_address is previously created and valid
+ * size_t required_size = cardano_reward_address_get_bytes_size(reward_address);
+ * byte_t* buffer = (byte_t*)malloc(required_size);
+ *
+ * if (buffer)
+ * {
+ *   cardano_error_t result = cardano_reward_address_to_bytes(reward_address, buffer, required_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // The buffer now contains the serialized address
+ *     // Proceed with using the buffer for storage, transmission, etc.
+ *   }
+ *   else
+ *   {
+ *     printf("Failed to serialize pointer address: %d\n", result);
+ *   }
+ *
+ *  free(buffer);
+ * }
+ * else
+ * {
+ *   printf("Memory allocation for buffer failed\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_reward_address_to_bytes(
+  const cardano_reward_address_t* address,
+  byte_t*                         data,
+  size_t                          size);
+
+/**
+ * \brief Creates an  reward address from a Bech32-encoded string.
+ *
+ * This function constructs a \ref cardano_reward_address_t object by decoding the provided
+ * Bech32-encoded string that represents the address data.
+ *
+ * \param[in] data A pointer to a character array containing the Bech32-encoded representation of the address.
+ * \param[in] size The size of the Bech32 string in bytes.
+ * \param[out] address A pointer to a pointer to \ref cardano_reward_address_t that will be set to the address
+ *                     of the newly created  reward address object upon successful decoding.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address was successfully created. Returns \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p data or \p address pointer is NULL. Returns \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the Bech32 data
+ *         could not be decoded into a valid reward address. Returns \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         memory for the decoding buffers could not be allocated. Allocation failures inside the Bech32 decoder itself
+ *         are reported as \ref CARDANO_ERROR_DECODING.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* bech32_data = "addr1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx...";
+ * size_t bech32_size = strlen(bech32_data);
+ * cardano_reward_address_t* cardano_reward_address = NULL;
+ *
+ * cardano_error_t result = cardano_reward_address_from_bech32(bech32_data, bech32_size, &cardano_reward_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the  reward address
+ *
+ *   // Once done, ensure to clean up and release the  reward address
+ *   cardano_reward_address_unref(&cardano_reward_address);
+ * }
+ * else
+ * {
+ *   printf("Failed to decode  reward address from Bech32: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_reward_address_from_bech32(
+  const char*                data,
+  size_t                     size,
+  cardano_reward_address_t** address);
+
+/**
+ * \brief Retrieves the size in bytes of the Bech32-encoded representation of an  reward address.
+ *
+ * This function calculates the size necessary to store the Bech32-encoded representation of a given
+ * \ref cardano_reward_address_t address object. This size includes the characters needed to represent
+ * the Bech32 string but does not include the null-termination character.
+ *
+ * \param[in] address A pointer to the \ref cardano_reward_address_t object whose Bech32 size is to be retrieved.
+ *
+ * \return The size in bytes of the Bech32-encoded representation of the address, including the null terminator.
+ *         Returns 0 if the \p address pointer is NULL or if the address is invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_t* cardano_reward_address = NULL;
+ * // Assume cardano_reward_address is already created and valid
+ * size_t bech32_size = cardano_reward_address_get_bech32_size(cardano_reward_address);
+ *
+ * if (bech32_size > 0)
+ * {
+ *   char* bech32_string = (char*) malloc(bech32_size);
+ *
+ *   if (bech32_string)
+ *   {
+ *     // Proceed to convert address to Bech32 string
+ *   }
+ *
+ *   free(bech32_string);
+ * }
+ * else
+ * {
+ *   printf("Invalid address or unable to determine size\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_reward_address_get_bech32_size(const cardano_reward_address_t* address);
+
+/**
+ * \brief Converts an  reward address to a Bech32-encoded string.
+ *
+ * This function takes a \ref cardano_reward_address_t object and converts it into a Bech32 string,
+ * writing the result into the provided \p data buffer. The buffer must be large enough to hold the entire
+ * Bech32 string including the null-termination character.
+ *
+ * \param[in] address A pointer to the \ref cardano_reward_address_t object to be converted.
+ * \param[out] data A pointer to a character buffer where the Bech32-encoded string will be stored.
+ * \param[in] size The size of the provided buffer in bytes. This size must be at least the value returned
+ *                 by \ref cardano_reward_address_get_bech32_size to ensure it can hold the Bech32 string
+ *                 and the null terminator.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the conversion was successful. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         the \p address or \p data pointer is NULL. Returns \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE if the \p size is too
+ *         small to hold the Bech32 representation including the null terminator.
+ *
+ * \note It is crucial to ensure that the buffer provided in \p data is sufficiently large to accommodate the
+ *       Bech32 string and the null-termination character to prevent buffer overflow errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_t* cardano_reward_address = NULL;
+ * // Assume cardano_reward_address is previously created and valid
+ * size_t required_size = cardano_reward_address_get_bech32_size(cardano_reward_address) + 1; // +1 for null-termination
+ * char* bech32_string = (char*) malloc(required_size);
+ * if (bech32_string)
+ * {
+ *   cardano_error_t result = cardano_reward_address_to_bech32(cardano_reward_address, bech32_string, required_size);
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Bech32 representation: %s\n", bech32_string);
+ *   }
+ *   else
+ *   {
+ *     printf("Failed to convert  reward address to Bech32: %d\n", result);
+ *   }
+ *   free(bech32_string);
+ * }
+ * else
+ * {
+ *   printf("Memory allocation failed for Bech32 buffer\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_reward_address_to_bech32(
+  const cardano_reward_address_t* address,
+  char*                           data,
+  size_t                          size);
+
+/**
+ * \brief Retrieves the string representation of an  reward address.
+ *
+ * This function provides access to the string form of a \ref cardano_reward_address_t object. It allows for
+ * easy display and logging of the address in a human-readable format.
+ *
+ * \param[in] address A pointer to the \ref cardano_reward_address_t object whose string representation is to be retrieved.
+ *
+ * \return A pointer to a constant character string representing the  reward address. Returns NULL if the \p address
+ *         pointer is NULL or if the address cannot be properly serialized into a string form.
+ *
+ * \note The returned string is managed internally and should not be freed or modified by the caller. It remains
+ *       valid as long as the \ref cardano_reward_address_t object is not modified or freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_t* cardano_reward_address = NULL;
+ * // Assume cardano_reward_address is previously created and valid
+ * const char* address_string = cardano_reward_address_get_string(cardano_reward_address);
+ *
+ * if (address_string != NULL)
+ * {
+ *   printf("Enterprise Address: %s\n", address_string);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve string representation of the  reward address\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_reward_address_get_string(const cardano_reward_address_t* address);
+
+/**
+ * \brief Retrieves the network ID from a given Cardano reward address.
+ *
+ * This function extracts the network identifier from the provided \ref cardano_reward_address_t object.
+ * The network ID indicates whether the address belongs to the test network or the main network.
+ *
+ * \param[in] address A constant pointer to the \ref cardano_reward_address_t object from which the network ID is to be retrieved.
+ * \param[out] network_id A pointer to \ref cardano_network_id_t where the network ID will be stored upon successful
+ *                        extraction. This parameter cannot be NULL.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the network ID was successfully retrieved.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if the input address or network_id pointer is NULL.
+ *         Returns other error codes as defined in \ref cardano_error_t if the network ID cannot be retrieved due to
+ *         malformed or unrecognized address formats.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_t* address = NULL;
+ * cardano_network_id_t network_id;
+ *
+ * cardano_error_t get_network_id = cardano_reward_address_get_network_id(address, &network_id);
+ *
+ * if (get_network_id != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to determine the network id.\n");
+ * }
+ * else
+ * {
+ *   printf("Network ID: %d\n", network_id);
+ * }
+ *
+ * cardano_reward_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_reward_address_get_network_id(
+  const cardano_reward_address_t* address,
+  cardano_network_id_t*           network_id);
+
+/**
+ * \brief Decrements the reward address's reference count.
+ *
+ * If the reference count reaches zero, the reward address memory is deallocated.
+ *
+ * \param[in] address Pointer to the reward address whose reference count is to be decremented.
+ */
+CARDANO_EXPORT void cardano_reward_address_unref(cardano_reward_address_t** address);
+
+/**
+ * \brief Increments the reward address's reference count.
+ *
+ * Ensures that the reward address remains allocated until the last reference is released.
+ *
+ * \param[in] address reward address whose reference count is to be incremented.
+ */
+CARDANO_EXPORT void cardano_reward_address_ref(cardano_reward_address_t* address);
+
+/**
+ * \brief Retrieves the reward address's current reference count.
+ *
+ * \warning Does not account for transitive references.
+ *
+ * \param[in] address Target reward address.
+ * \return Current reference count of the reward address.
+ */
+CARDANO_EXPORT size_t cardano_reward_address_refcount(const cardano_reward_address_t* address);
+
+/**
+ * \brief Sets the last error message for a given reward address.
+ *
+ * This function records an error message in the reward address's last_error buffer,
+ * overwriting any previous message. The message is truncated if it exceeds
+ * the buffer size. This function is typically used to store descriptive
+ * error information that can be retrieved later with
+ * cardano_reward_address_get_last_error.
+ *
+ * \param[in,out] address A pointer to the cardano_reward_address_t instance whose last error
+ *               message is to be set. If the reward address is NULL, the function
+ *               has no effect.
+ * \param[in] message A null-terminated string containing the error message to be
+ *                recorded. If the message is NULL, the reward address's last_error
+ *                will be set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters due to the fixed size
+ *       of the last_error buffer (1024 characters), including the null
+ *       terminator. Messages longer than this limit will be truncated.
+ */
+CARDANO_EXPORT void cardano_reward_address_set_last_error(cardano_reward_address_t* address, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific reward address.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_reward_address_set_last_error for the given
+ * reward address. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in,out] address A pointer to the \ref cardano_reward_address_t instance whose last error
+ *               message is to be retrieved. If the reward address is \c NULL, the function
+ *               returns a generic error message indicating the null reward address.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified reward address. If the reward address is \c NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the reward address and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_reward_address_set_last_error for the same reward address, or until
+ *       the reward address is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_reward_address_get_last_error(const cardano_reward_address_t* address);
+
+/**
+ * \brief Creates an independent deep copy of the address and its credentials.
+ * \param[in] source Address to copy. Must not be NULL.
+ * \param[out] clone Receives one owned reference, or NULL on failure. Must not be NULL.
+ * \return CARDANO_SUCCESS, CARDANO_ERROR_POINTER_IS_NULL, or CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ * \note Release the result with cardano_reward_address_unref. The source is unchanged.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_reward_address_deep_clone(const cardano_reward_address_t* source, cardano_reward_address_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_REWARD_ADDRESS_H
diff --git a/vendor/include/cardano/address/stake_pointer.h b/vendor/include/cardano/address/stake_pointer.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/address/stake_pointer.h
@@ -0,0 +1,67 @@
+/**
+ * \file stake_pointer.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_STAKE_POINTER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_STAKE_POINTER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a pointer to a stake key registration location on the blockchain.
+ *
+ * This structure is used to indirectly reference a stake key through its registration certificate location on the blockchain.
+ * It is used in Cardano pointer addresses, which allow for the specification of stake rights without directly embedding
+ * the stake key itself in the address.
+ */
+typedef struct cardano_stake_pointer_t
+{
+    /**
+     * \brief The slot number on the blockchain where the stake key registration certificate is recorded.
+     * This is a uint64_t value that represents the absolute slot since the genesis block of the blockchain.
+     */
+    uint64_t slot;
+
+    /**
+     * \brief The index of the transaction within the specified slot where the stake key registration certificate is located.
+     * This value helps pinpoint the exact transaction in a given slot that contains the certificate.
+     */
+    uint64_t tx_index;
+
+    /**
+     * \brief The index of the certificate within the transaction. Since a single transaction can contain multiple certificates,
+     * this value specifies which certificate in the transaction pertains to the stake key registration.
+     */
+    uint64_t cert_index;
+} cardano_stake_pointer_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_STAKE_POINTER_H
diff --git a/vendor/include/cardano/assets/asset_id.h b/vendor/include/cardano/assets/asset_id.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/assets/asset_id.h
@@ -0,0 +1,647 @@
+/**
+ * \file asset_id.h
+ *
+ * \author angel.castillo
+ * \date   Sep 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ASSET_ID_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ASSET_ID_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_name.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents an asset identifier in the Cardano blockchain.
+ *
+ * The `cardano_asset_id_t` structure encapsulates the unique identification of a native asset on the Cardano blockchain.
+ * Each asset is uniquely identified by a combination of its policy ID and asset name.
+ */
+typedef struct cardano_asset_id_t cardano_asset_id_t;
+
+/**
+ * \brief Creates and initializes a new instance of a Cardano asset identifier.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_asset_id_t object,
+ * which represents a unique asset identifier in the Cardano blockchain.
+ * The asset ID is composed of a policy ID and an asset name.
+ *
+ * - **Policy ID**: A cryptographic hash (Blake2b hash) that identifies the minting policy.
+ * - **Asset Name**: A user-defined name (max 32 bytes) associated with the asset.
+ *
+ * The function ensures that a valid asset identifier is created by linking the provided policy ID and asset name.
+ *
+ * \param[in] policy_id A pointer to an initialized \ref cardano_blake2b_hash_t object representing the minting policy ID.
+ *                      This value must not be NULL.
+ * \param[in] asset_name A pointer to an initialized \ref cardano_asset_name_t object representing the name of the asset.
+ *                       This value must not be NULL.
+ * \param[out] asset_id On successful creation, this will point to a newly created \ref cardano_asset_id_t object
+ *                      representing the asset. The caller is responsible for managing the lifecycle of this object by calling
+ *                      \ref cardano_asset_id_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the asset ID was
+ *         successfully created, or an appropriate error code indicating the failure reason, such as:
+ *         - \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *         - \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if memory allocation for the asset ID failed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* policy_id = ...; // Assume policy ID is initialized
+ * cardano_asset_name_t* asset_name = ...;  // Assume asset name is initialized
+ * cardano_asset_id_t* asset_id = NULL;
+ *
+ * // Create a new asset ID
+ * cardano_error_t result = cardano_asset_id_new(policy_id, asset_name, &asset_id);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset ID
+ *
+ *   // Once done, release the asset ID
+ *   cardano_asset_id_unref(&asset_id);
+ * }
+ * else
+ * {
+ *   printf("Failed to create asset ID: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_id_new(
+  cardano_blake2b_hash_t* policy_id,
+  cardano_asset_name_t*   asset_name,
+  cardano_asset_id_t**    asset_id);
+
+/**
+ * \brief Creates a new instance of the Cardano native asset identifier for Lovelace.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_asset_id_t object that represents
+ * the Cardano native coin, Lovelace. Lovelace is the smallest denomination of the ADA cryptocurrency, and it
+ * does not have an associated asset name or a policy ID like other assets. Instead, Lovelace is identified
+ * by the special identifier "lovelace."
+ *
+ * \param[out] asset_id On successful creation, this will point to a newly created \ref cardano_asset_id_t object
+ *                      representing the Lovelace asset. The caller is responsible for managing the lifecycle of this object
+ *                      and must release it by calling \ref cardano_asset_id_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the Lovelace asset ID
+ *         was successfully created, or an appropriate error code indicating the failure reason, such as:
+ *         - \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if memory allocation for the asset ID failed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_t* lovelace_asset_id = NULL;
+ *
+ * // Create a new asset ID for Lovelace
+ * cardano_error_t result = cardano_asset_id_new_lovelace(&lovelace_asset_id);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the Lovelace asset ID
+ *
+ *   // Once done, release the asset ID
+ *   cardano_asset_id_unref(&lovelace_asset_id);
+ * }
+ * else
+ * {
+ *   printf("Failed to create Lovelace asset ID: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_id_new_lovelace(cardano_asset_id_t** asset_id);
+
+/**
+ * \brief Creates and initializes a new instance of a Cardano asset ID from byte data.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_asset_id_t object,
+ * which represents a Cardano native asset. The asset ID is formed by concatenating the bytes
+ * of the policy ID and the asset name. The asset name can be an empty byte sequence, but the
+ * policy ID must always be present.
+ *
+ * \param[in] data A pointer to an array of bytes representing the concatenation of the policy ID
+ *                 and the asset name. The policy ID typically occupies the first 28 bytes, followed
+ *                 by the bytes of the asset name. The data pointer must not be NULL.
+ * \param[in] size The size of the byte array, which includes both the policy ID and the asset name.
+ *                 The size must be at least 28 bytes (the size of the policy ID), but it can be larger
+ *                 depending on the length of the asset name.
+ * \param[out] asset_id On successful initialization, this will point to a newly created \ref cardano_asset_id_t object.
+ *             This object represents a "strong reference" to the asset ID, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object. Specifically, once the asset ID is no longer needed,
+ *             the caller must release it by calling \ref cardano_asset_id_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the asset ID was successfully created from the provided bytes, or an appropriate error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input data pointer is NULL,
+ *         or \ref CARDANO_ERROR_INVALID_ARGUMENT if the size is less than 28 bytes or violates other constraints.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t* asset_data = ...; // Asset data should contain policy ID followed by asset name
+ * size_t asset_size = ...; // Size of asset_data (minimum 28 bytes)
+ * cardano_asset_id_t* asset_id = NULL;
+ *
+ * cardano_error_t result = cardano_asset_id_from_bytes(asset_data, asset_size, &asset_id);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_id
+ *   // Once done, ensure to clean up and release the asset_id
+ *   cardano_asset_id_unref(&asset_id);
+ * }
+ * else
+ * {
+ *   printf("Failed to create asset ID: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ *
+ * \note The byte data must include the policy ID followed by the asset name, which could be empty.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_id_from_bytes(
+  const byte_t*        data,
+  size_t               size,
+  cardano_asset_id_t** asset_id);
+
+/**
+ * \brief Creates and initializes a new instance of a Cardano asset ID from a hexadecimal string.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_asset_id_t object,
+ * which represents the ID of a Cardano native asset. The asset ID is derived from a hexadecimal-encoded
+ * string, typically representing a policy ID or asset name in hexadecimal format.
+ *
+ * \param[in] hex_string A pointer to a null-terminated string containing the asset ID in hexadecimal format.
+ *                       The string must only contain valid hexadecimal characters (0-9, a-f, A-F) and must not be NULL.
+ * \param[in] size The size of the hexadecimal string, not including the null terminator. This allows for flexible
+ *                 string lengths while excluding the null terminator from the conversion process.
+ * \param[out] asset_id On successful initialization, this will point to a newly created \ref cardano_asset_id_t object.
+ *             This object represents a "strong reference" to the asset ID, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object. Specifically, once the asset ID is no longer needed,
+ *             the caller must release it by calling \ref cardano_asset_id_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the asset ID was successfully created from the provided hexadecimal string, or an appropriate error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input string pointer is NULL,
+ *         or \ref CARDANO_ERROR_INVALID_ARGUMENT if the string contains invalid characters or does not meet other constraints.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* hex_string = "616263646566..."; // Hexadecimal representation of some asset data
+ * size_t hex_size = strlen(hex_string); // Size of the hexadecimal string
+ * cardano_asset_id_t* asset_id = NULL;
+ *
+ * cardano_error_t result = cardano_asset_id_from_hex(hex_string, hex_size, &asset_id);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_id
+ *   // Once done, ensure to clean up and release the asset_id
+ *   cardano_asset_id_unref(&asset_id);
+ * }
+ * else
+ * {
+ *   printf("Failed to create asset ID from hex: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_id_from_hex(
+  const char*          hex_string,
+  size_t               size,
+  cardano_asset_id_t** asset_id);
+
+/**
+ * \brief Retrieves the byte representation of a Cardano asset id.
+ *
+ * This function provides access to the underlying byte array of a \ref cardano_asset_id_t object.
+ * The byte array represents the asset id as it is stored and used within the Cardano ecosystem.
+ *
+ * \param[in] asset_id A pointer of an initialized \ref cardano_asset_id_t object.
+ *                       The pointer must not be NULL and should point to a valid asset id object.
+ *
+ * \return A pointer to the constant byte array representing the asset id. This pointer points to an
+ *         internal buffer and must not be modified or freed by the caller. If the input is NULL or an
+ *         error occurs, the function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_t* asset_id = ...; // Assume asset_id is already initialized
+ * const byte_t* name_bytes = cardano_asset_id_get_bytes(asset_id);
+ *
+ * if (name_bytes != NULL)
+ * {
+ *   // Process the bytes of the asset id
+ *   // Note: The length of the byte array should be known or determined separately
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the bytes of the asset id.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t*
+cardano_asset_id_get_bytes(const cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Retrieves the size of the byte array for a Cardano asset id.
+ *
+ * This function returns the size of the byte array representing the asset id contained within
+ * a \ref cardano_asset_id_t object.
+ *
+ * \param[in] asset_id A pointer of an initialized \ref cardano_asset_id_t object.
+ *                       The pointer must not be NULL and should point to a valid asset id object.
+ *
+ * \return The size of the byte array representing the asset id. If the input is NULL or an
+ *         error occurs, the function returns 0. This size does not include a null terminator, as
+ *         asset ids can contain arbitrary binary data.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_t* asset_id = ...; // Assume asset_id is already initialized
+ * size_t name_size = cardano_asset_id_get_bytes_size(asset_id);
+ *
+ * if (name_size > 0)
+ * {
+ *   const byte_t* name_bytes = cardano_asset_id_get_bytes(asset_id);
+ *   // Process the bytes knowing the exact size of the asset id
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the size of the asset id or asset id is empty.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t
+cardano_asset_id_get_bytes_size(const cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Retrieves the hexadecimal string representation of a Cardano asset ID.
+ *
+ * This function returns the hexadecimal string representation of a \ref cardano_asset_id_t object.
+ * The string encodes the asset ID, which consists of the concatenated bytes of the policy ID and asset name.
+ *
+ * \param[in] asset_id A pointer to an initialized \ref cardano_asset_id_t object.
+ *                     The pointer must not be NULL and should point to a valid asset ID object.
+ *
+ * \return A pointer to a null-terminated string representing the asset ID in hexadecimal format.
+ *         This string is owned by the \ref cardano_asset_id_t object and must not be modified or freed by the caller.
+ *         If the input is NULL or an error occurs, the function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_asset_id_t* asset_id = ...; // Assume asset_id is already initialized
+ * const char* hex_string = cardano_asset_id_get_hex(asset_id);
+ *
+ * if (hex_string != NULL)
+ * {
+ *   // Process the hexadecimal string of the asset ID
+ *   printf("Asset ID in hex: %s\n", hex_string);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the hexadecimal string of the asset ID.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char*
+cardano_asset_id_get_hex(const cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Retrieves the size of the hexadecimal string for a Cardano asset ID.
+ *
+ * This function returns the size of the hexadecimal string representation of a \ref cardano_asset_id_t object.
+ * The size includes the number of characters in the hexadecimal string, not including the null terminator.
+ *
+ * \param[in] asset_id A pointer to an initialized \ref cardano_asset_id_t object.
+ *                     The pointer must not be NULL and should point to a valid asset ID object.
+ *
+ * \return The size of the hexadecimal string representing the asset ID. If the input is NULL or an
+ *         error occurs, the function returns 0. The size does not include a null terminator.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_asset_id_t* asset_id = ...; // Assume asset_id is already initialized
+ * size_t hex_size = cardano_asset_id_get_hex_size(asset_id);
+ *
+ * if (hex_size > 0)
+ * {
+ *   const char* hex_string = cardano_asset_id_get_hex(asset_id);
+ *   // Process the hex string knowing the exact size of the asset ID
+ *   printf("Hexadecimal string size: %zu\n", hex_size);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the size of the asset ID in hex or asset ID is empty.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t
+cardano_asset_id_get_hex_size(const cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Checks if the given asset ID represents the native Cardano currency, Lovelace.
+ *
+ * This function determines if a \ref cardano_asset_id_t object corresponds to the Lovelace currency.
+ * Lovelace is the smallest unit of ADA, the native cryptocurrency of the Cardano network. A Lovelace
+ * asset ID is identified by the absence of an asset name and a specific policy ID.
+ *
+ * \param[in] asset_id A constant pointer to an initialized \ref cardano_asset_id_t object.
+ *
+ * \return \c true if the asset ID represents Lovelace, or \c false otherwise. If the input \c asset_id is NULL,
+ *         the function returns false.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_asset_id_t* asset_id = ...; // Assume asset_id is already initialized
+ * bool is_lovelace = cardano_asset_id_is_lovelace(asset_id);
+ *
+ * if (is_lovelace)
+ * {
+ *   printf("The asset is Lovelace.\n");
+ * }
+ * else
+ * {
+ *   printf("The asset is not Lovelace.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool
+cardano_asset_id_is_lovelace(const cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Retrieves the policy ID from a Cardano asset ID.
+ *
+ * This function extracts the policy ID from a given \ref cardano_asset_id_t object. The policy ID
+ * is a \ref cardano_blake2b_hash_t object representing the unique identifier of the policy under which
+ * the asset was issued.
+ *
+ * \param[in] asset_id A pointer to an initialized \ref cardano_asset_id_t object.
+ *
+ * \return A pointer to the \ref cardano_blake2b_hash_t object representing the policy ID. The returned
+ *         policy ID is a new reference, and the caller is responsible for releasing it with \ref cardano_blake2b_hash_unref
+ *         when it is no longer needed. If the asset ID is NULL, or if the asset represents Lovelace, the function returns NULL.
+ *
+ * \note For assets that represent the native currency Lovelace, there is no associated policy ID. Clients must first call
+ *       \ref cardano_asset_id_is_lovelace to check if the asset is Lovelace before attempting to retrieve the policy ID.
+ *       If the asset is Lovelace, this function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_t* asset_id = ...; // Assume asset_id is already initialized
+ * if (!cardano_asset_id_is_lovelace(asset_id))
+ * {
+ *   cardano_blake2b_hash_t* policy_id = cardano_asset_id_get_policy_id(asset_id);
+ *
+ *   if (policy_id != NULL)
+ *   {
+ *     // Use the policy ID
+ *     // Ensure to release the policy ID once done
+ *     cardano_blake2b_hash_unref(&policy_id);
+ *   }
+ *   else
+ *   {
+ *     printf("Failed to retrieve the policy ID or asset_id is NULL.\n");
+ *   }
+ * }
+ * else
+ * {
+ *   printf("This asset is Lovelace and has no policy ID.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t*
+cardano_asset_id_get_policy_id(cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Retrieves the asset name from a Cardano asset ID.
+ *
+ * This function extracts the asset name from a given \ref cardano_asset_id_t object. The asset name
+ * is a \ref cardano_asset_name_t object representing the name of the asset within the specified policy.
+ *
+ * \param[in] asset_id A pointer to an initialized \ref cardano_asset_id_t object.
+ *
+ * \return A pointer to the \ref cardano_asset_name_t object representing the asset name. The returned
+ *         asset name is a new reference, and the caller is responsible for releasing it with \ref cardano_asset_name_unref
+ *         when it is no longer needed. If the asset ID is NULL or if the asset represents Lovelace, the function returns NULL.
+ *
+ * \note For assets that represent the native currency Lovelace, there is no associated asset name. Clients must first call
+ *       \ref cardano_asset_id_is_lovelace to check if the asset is Lovelace before attempting to retrieve the asset name.
+ *       If the asset is Lovelace, this function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_t* asset_id = ...; // Assume asset_id is already initialized
+ *
+ * if (!cardano_asset_id_is_lovelace(asset_id))
+ * {
+ *   cardano_asset_name_t* asset_name = cardano_asset_id_get_asset_name(asset_id);
+ *
+ *   if (asset_name != NULL)
+ *   {
+ *     // Use the asset name
+ *     // Ensure to release the asset name once done
+ *     cardano_asset_name_unref(&asset_name);
+ *   }
+ *   else
+ *   {
+ *     printf("Failed to retrieve the asset name or asset_id is NULL.\n");
+ *   }
+ * }
+ * else
+ * {
+ *   printf("This asset is Lovelace and has no asset name.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_asset_name_t*
+cardano_asset_id_get_asset_name(cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Decrements the reference count of a cardano_asset_id_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_asset_id_t object
+ * by decreasing its reference count. When the reference count reaches zero, the asset_id is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] asset_id A pointer to the pointer of the asset_id object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_t* asset_id = cardano_asset_id_new(major, minor);
+ *
+ * // Perform operations with the asset_id...
+ *
+ * cardano_asset_id_unref(&asset_id);
+ * // At this point, asset_id is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_asset_id_unref, the pointer to the \ref cardano_asset_id_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_asset_id_unref(cardano_asset_id_t** asset_id);
+
+/**
+ * \brief Increases the reference count of the cardano_asset_id_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_asset_id_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_asset_id_unref.
+ *
+ * \param asset_id A pointer to the cardano_asset_id_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_id is a previously created asset_id object
+ *
+ * cardano_asset_id_ref(asset_id);
+ *
+ * // Now asset_id can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_asset_id_ref there is a corresponding
+ * call to \ref cardano_asset_id_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_asset_id_ref(cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_asset_id_t object.
+ *
+ * This function returns the number of active references to an cardano_asset_id_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_asset_id_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param asset_id A pointer to the cardano_asset_id_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_asset_id_t object. If the object
+ * is properly managed (i.e., every \ref cardano_asset_id_ref call is matched with a
+ * \ref cardano_asset_id_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_id is a previously created asset_id object
+ *
+ * size_t ref_count = cardano_asset_id_refcount(asset_id);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_asset_id_refcount(const cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Sets the last error message for a given cardano_asset_id_t object.
+ *
+ * Records an error message in the asset_id's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] asset_id A pointer to the \ref cardano_asset_id_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the asset_id's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_asset_id_set_last_error(
+  cardano_asset_id_t* asset_id,
+  const char*         message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific asset_id.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_asset_id_set_last_error for the given
+ * asset_id. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] asset_id A pointer to the \ref cardano_asset_id_t instance whose last error
+ *                   message is to be retrieved. If the asset_id is NULL, the function
+ *                   returns a generic error message indicating the null asset_id.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified asset_id. If the asset_id is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_asset_id_set_last_error for the same asset_id, or until
+ *       the asset_id is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_asset_id_get_last_error(
+  const cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_asset_id_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_asset_id_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_asset_id_deep_clone(const cardano_asset_id_t* source, cardano_asset_id_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ASSET_ID_H
diff --git a/vendor/include/cardano/assets/asset_id_list.h b/vendor/include/cardano/assets/asset_id_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/assets/asset_id_list.h
@@ -0,0 +1,336 @@
+/**
+ * \file asset_id_list.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ASSET_ID_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ASSET_ID_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents an asset identifier in the Cardano blockchain.
+ *
+ * The `cardano_asset_id_t` structure encapsulates the unique identification of a native asset on the Cardano blockchain.
+ * Each asset is uniquely identified by a combination of its policy ID and asset name.
+ */
+typedef struct cardano_asset_id_t cardano_asset_id_t;
+
+/**
+ * \brief Represents a list of asset ids.
+ */
+typedef struct cardano_asset_id_list_t cardano_asset_id_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a asset_id_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_asset_id_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] asset_id_list On successful initialization, this will point to a newly created
+ *             \ref cardano_asset_id_list_t object. This object represents a "strong reference"
+ *             to the asset_id_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the asset_id_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_asset_id_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the asset_id_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_list_t* asset_id_list = NULL;
+ *
+ * // Attempt to create a new asset_id_list
+ * cardano_error_t result = cardano_asset_id_list_new(&asset_id_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_id_list
+ *
+ *   // Once done, ensure to clean up and release the asset_id_list
+ *   cardano_asset_id_list_unref(&asset_id_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_id_list_new(cardano_asset_id_list_t** asset_id_list);
+
+/**
+ * \brief Retrieves the length of a asset id list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_asset_id_list_t object.
+ *
+ * \param[in] asset_id_list A constant pointer to the \ref cardano_asset_id_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the asset_id_list. Return 0 if the asset_id_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_list_t* asset_id_list = cardano_asset_id_list_new();
+ *
+ * // Populate asset_id_list with elements
+ *
+ * size_t length = cardano_asset_id_list_get_length(asset_id_list);
+ * printf("Length of the asset_id_list: %zu\n", length);
+ *
+ * // Clean up the asset_id_list object once done
+ * cardano_asset_id_list_unref(&asset_id_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_asset_id_list_get_length(const cardano_asset_id_list_t* asset_id_list);
+
+/**
+ * \brief Retrieves an element from a asset id list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_asset_id_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] asset_id_list A constant pointer to the \ref cardano_asset_id_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the asset id list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_asset_id_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_asset_id_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_list_t* asset_id_list = cardano_asset_id_list_new();
+ *
+ * // Populate asset_id_list with elements
+ *
+ * cardano_asset_id_t* element = NULL;
+ * cardano_error_t result = cardano_asset_id_list_get(asset_id_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_asset_id_unref(&element);
+ * }
+ *
+ * // Clean up the asset_id_list object once done
+ * cardano_asset_id_list_unref(&asset_id_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_id_list_get(const cardano_asset_id_list_t* asset_id_list, size_t index, cardano_asset_id_t** element);
+
+/**
+ * \brief Adds an element to a asset id list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_asset_id_list_t object.
+ *
+ * \param[in] asset_id_list A constant pointer to the \ref cardano_asset_id_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_asset_id_t object that is to be added to the asset_id_list.
+ *                    The element will be referenced by the asset_id_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the asset_id_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_list_t* asset_id_list = cardano_asset_id_list_new();
+ *
+ * // Create and initialize a new asset id element
+ * cardano_asset_id_t* element = { ... };
+ *
+ * // Add the element to the asset_id_list
+ * cardano_error_t result = cardano_asset_id_list_add(asset_id_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the asset_id_list object once done
+ * cardano_asset_id_list_unref(&asset_id_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_id_list_add(cardano_asset_id_list_t* asset_id_list, cardano_asset_id_t* element);
+
+/**
+ * \brief Decrements the reference count of a asset_id_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_asset_id_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the asset_id_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] asset_id_list A pointer to the pointer of the asset_id_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_list_t* asset_id_list = cardano_asset_id_list_new();
+ *
+ * // Perform operations with the asset_id_list...
+ *
+ * cardano_asset_id_list_unref(&asset_id_list);
+ * // At this point, asset_id_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_asset_id_list_unref, the pointer to the \ref cardano_asset_id_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_asset_id_list_unref(cardano_asset_id_list_t** asset_id_list);
+
+/**
+ * \brief Increases the reference count of the cardano_asset_id_list_t object.
+ *
+ * This function is used to manually increment the reference count of a asset_id_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_asset_id_list_unref.
+ *
+ * \param asset_id_list A pointer to the asset_id_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_id_list is a previously created asset_id_list object
+ *
+ * cardano_asset_id_list_ref(asset_id_list);
+ *
+ * // Now asset_id_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_asset_id_list_ref there is a corresponding
+ * call to \ref cardano_asset_id_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_asset_id_list_ref(cardano_asset_id_list_t* asset_id_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_asset_id_list_t object.
+ *
+ * This function returns the number of active references to a asset_id_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_asset_id_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param asset_id_list A pointer to the asset_id_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified asset_id_list object. If the object
+ * is properly managed (i.e., every \ref cardano_asset_id_list_ref call is matched with a
+ * \ref cardano_asset_id_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_id_list is a previously created asset_id_list object
+ *
+ * size_t ref_count = cardano_asset_id_list_refcount(asset_id_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_asset_id_list_refcount(const cardano_asset_id_list_t* asset_id_list);
+
+/**
+ * \brief Sets the last error message for a given asset_id_list object.
+ *
+ * Records an error message in the asset_id_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] asset_id_list A pointer to the \ref cardano_asset_id_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the asset_id_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_asset_id_list_set_last_error(cardano_asset_id_list_t* asset_id_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific asset_id_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_asset_id_list_set_last_error for the given
+ * asset_id_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] asset_id_list A pointer to the \ref cardano_asset_id_list_t instance whose last error
+ *                   message is to be retrieved. If the asset_id_list is NULL, the function
+ *                   returns a generic error message indicating the null asset_id_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified asset_id_list. If the asset_id_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_asset_id_list_set_last_error for the same asset_id_list, or until
+ *       the asset_id_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_asset_id_list_get_last_error(const cardano_asset_id_list_t* asset_id_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_asset_id_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_asset_id_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_asset_id_list_deep_clone(const cardano_asset_id_list_t* source, cardano_asset_id_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ASSET_ID_LIST_H
diff --git a/vendor/include/cardano/assets/asset_id_map.h b/vendor/include/cardano/assets/asset_id_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/assets/asset_id_map.h
@@ -0,0 +1,658 @@
+/**
+ * \file asset_id_map.h
+ *
+ * \author angel.castillo
+ * \date   Sep 05, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ASSET_ID_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ASSET_ID_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/assets/asset_id_list.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of asset id to coin amount.
+ */
+typedef struct cardano_asset_id_map_t cardano_asset_id_map_t;
+
+/**
+ * \brief Creates and initializes a new instance of a asset id map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_asset_id_map_t,
+ * representing a map structure. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] asset_id_map A pointer to a pointer to a \ref cardano_asset_id_map_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_asset_id_map_t
+ *                        object. This object represents a "strong reference" to the asset_id_map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the asset_id_map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_asset_id_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the asset_id_map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_map_t* asset_id_map = NULL;
+ *
+ * // Attempt to create a new asset_id_map
+ * cardano_error_t result = cardano_asset_id_map_new(&asset_id_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_id_map
+ *
+ *   // Once done, ensure to clean up and release the asset_id_map
+ *   cardano_asset_id_map_unref(&asset_id_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_id_map_new(cardano_asset_id_map_t** asset_id_map);
+
+/**
+ * \brief Retrieves the length of the asset_id_map.
+ *
+ * This function returns the number of key-value pairs contained in the specified asset_id_map.
+ *
+ * \param[in] asset_id_map A constant pointer to the \ref cardano_asset_id_map_t object for which
+ *                       the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the asset_id_map. Returns 0 if the asset_id_map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_map_t* asset_id_map = cardano_asset_id_map_new();
+ *
+ * // Populate the asset_id_map with key-value pairs
+ *
+ * size_t length = cardano_asset_id_map_get_length(asset_id_map);
+ * printf("The length of the asset_id_map is: %zu\n", length);
+ *
+ * cardano_asset_id_map_unref(&asset_id_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_asset_id_map_get_length(const cardano_asset_id_map_t* asset_id_map);
+
+/**
+ * \brief Retrieves the value associated with a given key in the asset id map.
+ *
+ * This function retrieves the value associated with the specified key in the provided asset id map.
+ * It returns the value through the output parameter `element`. If the key is not found in the asset id map,
+ * the output parameter `element` will be set to NULL.
+ *
+ * \param[in] asset_id_map A constant pointer to the \ref cardano_asset_id_map_t object from which
+ *                       the value is to be retrieved.
+ * \param[in] key The key whose associated value is to be retrieved from the asset_id_map.
+ * \param[out] element A pointer to a variable where the retrieved value will be stored. If the key
+ *                     is found in the asset id map, this variable will be set to the associated value.
+ *                     If the key is not found, this variable will be set to NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value associated with the key was successfully retrieved, or
+ *         an appropriate error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_map_t* asset_id_map = cardano_asset_id_map_new();
+ *
+ * // Populate the asset_id_map with key-value pairs
+ *
+ * cardano_asset_id_t* key = ...; // Create a asset_id object representing the key
+ * int64_t value = 0;
+ * cardano_error_t result = cardano_asset_id_map_get(asset_id_map, key, &value);
+ *
+ * if (result == CARDANO_SUCCESS && value != NULL)
+ * {
+ *   // Use the retrieved value
+ *   // ...
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_asset_id_unref(&key); // Clean up the key resource
+ * cardano_asset_id_map_unref(&asset_id_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_id_map_get(cardano_asset_id_map_t* asset_id_map, cardano_asset_id_t* key, int64_t* element);
+
+/**
+ * \brief Inserts a key-value pair into the asset id map.
+ *
+ * This function inserts the specified key-value pair into the provided asset id map.
+ *
+ * \param[in] asset_id_map A constant pointer to the \ref cardano_asset_id_map_t object where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The key to be inserted into the asset id map. The caller is responsible for managing
+ *                the lifecycle of the key object.
+ * \param[in] value The value to be associated with the key and inserted into the asset_id_map.
+ *                  The caller is responsible for managing the lifecycle of the value object.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * \remark If the key already exists in the asset id map, the value associated with the key will be updated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_map_t* asset_id_map = cardano_asset_id_map_new();
+ *
+ * // Create key and value objects
+ * cardano_asset_id_t* key = ...;
+ * int64_t value = 0;
+ *
+ * // Insert the key-value pair into the asset_id_map
+ * cardano_error_t result = cardano_asset_id_map_insert(asset_id_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value objects
+ * cardano_asset_id_unref(&key);
+ *
+ * cardano_asset_id_map_unref(&asset_id_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_id_map_insert(cardano_asset_id_map_t* asset_id_map, cardano_asset_id_t* key, int64_t value);
+
+/**
+ * \brief Retrieves the keys from the asset id map.
+ *
+ * This function retrieves all the keys from the provided asset id map and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_asset_id_list_t when it is no longer needed.
+ *
+ * \param[in] asset_id_map A constant pointer to the \ref cardano_asset_id_map_t object from which
+ *                       the keys are to be retrieved.
+ * \param[out] keys A pointer to a variable where the retrieved keys will be stored as a list.
+ *                  If successful, this variable will be set to point to the list of keys.
+ *                  The caller is responsible for managing the lifecycle of this list.
+ *                  It must be released by calling \ref cardano_asset_id_list_t when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the keys were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_map_t* asset_id_map = cardano_asset_id_map_new();
+ *
+ * // Populate the asset_id_map with key-value pairs
+ *
+ * cardano_asset_id_list_t* keys = NULL;
+ * cardano_error_t result = cardano_asset_id_map_get_keys(asset_id_map, &keys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of keys
+ *   // Keys must also be freed if retrieved from the list
+ *
+ *   // Once done, ensure to clean up and release the keys list
+ *   cardano_asset_id_list_unref(&keys);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_asset_id_map_unref(&asset_id_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_id_map_get_keys(cardano_asset_id_map_t* asset_id_map, cardano_asset_id_list_t** keys);
+
+/**
+ * \brief Retrieves the asset id at a specific index from the asset id map.
+ *
+ * This function retrieves the asset id at the specified index from the asset id map.
+ *
+ * \param[in] asset_id_map Pointer to the asset id map object.
+ * \param[in] index The index of the asset id to retrieve.
+ * \param[out] asset_id On successful retrieval, this will point to the asset id
+ *                        at the specified index. The caller is responsible for managing the lifecycle
+ *                        of this object. Specifically, once the asset id is no longer needed,
+ *                        the caller must release it by calling \ref cardano_asset_id_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the asset id was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_map_t* asset_id_map = NULL;
+ * cardano_asset_id_t* asset_id = NULL;
+ * size_t index = 0; // Index of the key hash to retrieve
+ *
+ * // Assume asset_id_map is initialized properly
+ *
+ * cardano_error_t result = cardano_asset_id_map_get_key_at(asset_id_map, index, &asset_id);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_id
+ *
+ *   // Once done, ensure to clean up and release the asset_id
+ *   cardano_asset_id_unref(&asset_id);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_id_map_get_key_at(
+  const cardano_asset_id_map_t* asset_id_map,
+  size_t                        index,
+  cardano_asset_id_t**          asset_id);
+
+/**
+ * \brief Retrieves the withdrawal amount at a specific index from the asset id map.
+ *
+ * This function retrieves the withdrawal amount at the specified index from the asset id map.
+ *
+ * \param[in] asset_id_map Pointer to the asset id map object.
+ * \param[in] index The index of the withdrawal amount to retrieve.
+ * \param[out] amount On successful retrieval, this will point to the withdrawal amount
+ *                    at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the withdrawal amount was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_map_t* asset_id_map = NULL;
+ * int64_t amount = 0;
+ * size_t index = 0; // Index of the withdrawal amount to retrieve
+ *
+ * // Assume asset_id_map is initialized properly
+ *
+ * cardano_error_t result = cardano_asset_id_map_get_value_at(asset_id_map, index, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the amount
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_id_map_get_value_at(
+  const cardano_asset_id_map_t* asset_id_map,
+  size_t                        index,
+  int64_t*                      amount);
+
+/**
+ * \brief Retrieves the asset id and withdrawal amount at the specified index.
+ *
+ * This function retrieves the asset id and withdrawal amount from the proposed withdrawal amounts
+ * at the specified index.
+ *
+ * \param[in]  asset_id_map    Pointer to the proposed withdrawal amounts object.
+ * \param[in]  index             The index at which to retrieve the key-value pair.
+ * \param[out] asset_id On successful retrieval, this will point to the asset id at the specified index.
+ *                            The caller is responsible for managing the lifecycle of this object and should release it using
+ *                            \ref cardano_asset_id_unref when it is no longer needed.
+ * \param[out] amount On successful retrieval, this will point to the withdrawal amount at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_map_t* asset_id_map = NULL;
+ * // Assume asset_id_map is initialized properly
+ *
+ * size_t index = 0;
+ * cardano_asset_id_t* asset_id = NULL;
+ * int64_t amount = 0;
+ *
+ * cardano_error_t result = cardano_asset_id_map_get_key_value_at(asset_id_map, index, &asset_id, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (asset_id != NULL && amount != NULL)
+ *   {
+ *     // Use the asset id and withdrawal amount
+ *   }
+ *   else
+ *   {
+ *     printf("Key-value pair not set at index %zu.\n", index);
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_asset_id_map_unref(&asset_id_map);
+ * cardano_asset_id_unref(&asset_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_id_map_get_key_value_at(
+  const cardano_asset_id_map_t* asset_id_map,
+  size_t                        index,
+  cardano_asset_id_t**          asset_id,
+  int64_t*                      amount);
+
+/**
+ * \brief Combines two asset id maps by adding the quantities of assets with the same asset ids.
+ *
+ * This function adds the asset quantities from two \ref cardano_asset_id_map_t objects. It combines the quantities
+ * of assets that have the same asset ids. If an asset id exists in both maps, their quantities are summed.
+ * If an asset id exists in only one of the maps, its quantity is copied to the result.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_asset_id_map_t object.
+ * \param[in] rhs A constant pointer to the second \ref cardano_asset_id_map_t object.
+ * \param[out] result On successful execution, this will point to a newly created \ref cardano_asset_id_map_t object
+ *             that represents the combined result of both input asset id maps.
+ *             The result is dynamically allocated and must be freed by the caller using \ref cardano_asset_id_map_unref
+ *             when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the assets were
+ *         successfully combined, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_asset_id_map_t* lhs = ...; // Assume lhs is already initialized with some assets
+ * const cardano_asset_id_map_t* rhs = ...; // Assume rhs is also initialized with some assets
+ * cardano_asset_id_map_t* result = NULL;
+ *
+ * cardano_error_t add_result = cardano_asset_id_map_add(lhs, rhs, &result);
+ * if (add_result == CARDANO_SUCCESS)
+ * {
+ *   // The assets have been successfully combined
+ *   // Use the result as needed
+ *
+ *   // When done, release the result
+ *   cardano_asset_id_map_unref(&result);
+ * }
+ * else
+ * {
+ *   printf("Failed to combine assets: %s\n", cardano_error_to_string(add_result));
+ * }
+ *
+ * // Cleanup resources
+ * cardano_asset_id_map_unref(&lhs);
+ * cardano_asset_id_map_unref(&rhs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_id_map_add(
+  const cardano_asset_id_map_t* lhs,
+  const cardano_asset_id_map_t* rhs,
+  cardano_asset_id_map_t**      result);
+
+/**
+ * \brief Subtracts the quantities of assets under each asset id from one asset id map to another.
+ *
+ * This function subtracts the assets from the second \ref cardano_asset_id_map_t object (rhs) from the first
+ * \ref cardano_asset_id_map_t object (lhs). It subtracts the quantities of assets under each asset id present
+ * in both maps. If an asset id exists only in the rhs, the value is copied as negative, effectively subtracting
+ * it from the lhs. If an asset id exists only in the lhs, the value is copied as is to the result.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_asset_id_map_t object from which assets will be subtracted.
+ * \param[in] rhs A constant pointer to the second \ref cardano_asset_id_map_t object that provides the quantities to subtract.
+ * \param[out] result On successful execution, this will point to a newly created \ref cardano_asset_id_map_t object
+ *             that represents the result of the subtraction.
+ *             The result is dynamically allocated and must be freed by the caller using \ref cardano_asset_id_map_unref
+ *             when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the assets were
+ *         successfully subtracted, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_asset_id_map_t* lhs = ...; // Assume lhs is already initialized with some assets
+ * const cardano_asset_id_map_t* rhs = ...; // Assume rhs is also initialized with some assets to subtract
+ * cardano_asset_id_map_t* result = NULL;
+ *
+ * cardano_error_t subtract_result = cardano_asset_id_map_subtract(lhs, rhs, &result);
+ * if (subtract_result == CARDANO_SUCCESS)
+ * {
+ *   // The assets have been successfully subtracted
+ *   // Use the result
+ *   cardano_asset_id_map_unref(&result);
+ * }
+ * else
+ * {
+ *   printf("Failed to subtract assets: %s\n", cardano_error_to_string(subtract_result));
+ * }
+ *
+ * // Cleanup resources
+ * cardano_asset_id_map_unref(&lhs);
+ * cardano_asset_id_map_unref(&rhs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_id_map_subtract(
+  const cardano_asset_id_map_t* lhs,
+  const cardano_asset_id_map_t* rhs,
+  cardano_asset_id_map_t**      result);
+
+/**
+ * \brief Compares two asset id map objects for equality.
+ *
+ * This function compares two asset_id_map objects to determine if they are equal.
+ *
+ * \param[in] lhs Pointer to the first asset id map object.
+ * \param[in] rhs Pointer to the second asset id map object.
+ *
+ * \return \c true if the asset id map objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_map_t* asset_id_map1 = NULL;
+ * cardano_asset_id_map_t* asset_id_map2 = NULL;
+ *
+ * // Assume asset_id_map1 and asset_id_map2 are initialized properly
+ *
+ * bool are_equal = cardano_asset_id_map_equals(asset_id_map1, asset_id_map2);
+ *
+ * if (are_equal)
+ * {
+ *   printf("The asset_id_map objects are equal.\n");
+ * }
+ * else
+ * {
+ *   printf("The asset_id_map objects are not equal.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_asset_id_map_unref(&asset_id_map1);
+ * cardano_asset_id_map_unref(&asset_id_map2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool
+cardano_asset_id_map_equals(const cardano_asset_id_map_t* lhs, const cardano_asset_id_map_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a asset_id_map object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_asset_id_map_t object
+ * by decreasing its reference count. When the reference count reaches zero, the asset_id_map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] asset_id_map A pointer to the pointer of the asset_id_map object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_map_t* asset_id_map = cardano_asset_id_map_new();
+ *
+ * // Perform operations with the asset_id_map...
+ *
+ * cardano_asset_id_map_unref(&asset_id_map);
+ * // At this point, asset_id_map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_asset_id_map_unref, the pointer to the \ref cardano_asset_id_map_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_asset_id_map_unref(cardano_asset_id_map_t** asset_id_map);
+
+/**
+ * \brief Increases the reference count of the cardano_asset_id_map_t object.
+ *
+ * This function is used to manually increment the reference count of a asset_id_map
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_asset_id_map_unref.
+ *
+ * \param asset_id_map A pointer to the asset_id_map object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_id_map is a previously created asset_id_map object
+ *
+ * cardano_asset_id_map_ref(asset_id_map);
+ *
+ * // Now asset_id_map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_asset_id_map_ref there is a corresponding
+ * call to \ref cardano_asset_id_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_asset_id_map_ref(cardano_asset_id_map_t* asset_id_map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_asset_id_map_t object.
+ *
+ * This function returns the number of active references to a asset_id_map object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_asset_id_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param asset_id_map A pointer to the asset_id_map object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified asset_id_map object. If the object
+ * is properly managed (i.e., every \ref cardano_asset_id_map_ref call is matched with a
+ * \ref cardano_asset_id_map_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_id_map is a previously created asset_id_map object
+ *
+ * size_t ref_count = cardano_asset_id_map_refcount(asset_id_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_asset_id_map_refcount(const cardano_asset_id_map_t* asset_id_map);
+
+/**
+ * \brief Sets the last error message for a given asset_id_map object.
+ *
+ * Records an error message in the asset_id_map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] asset_id_map A pointer to the \ref cardano_asset_id_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the asset_id_map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_asset_id_map_set_last_error(cardano_asset_id_map_t* asset_id_map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific asset_id_map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_asset_id_map_set_last_error for the given
+ * asset_id_map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] asset_id_map A pointer to the \ref cardano_asset_id_map_t instance whose last error
+ *                   message is to be retrieved. If the asset_id_map is NULL, the function
+ *                   returns a generic error message indicating the null asset_id_map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified asset_id_map. If the asset_id_map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_asset_id_map_set_last_error for the same asset_id_map, or until
+ *       the asset_id_map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_asset_id_map_get_last_error(const cardano_asset_id_map_t* asset_id_map);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_asset_id_map_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_asset_id_map_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_asset_id_map_deep_clone(const cardano_asset_id_map_t* source, cardano_asset_id_map_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ASSET_ID_MAP_H
diff --git a/vendor/include/cardano/assets/asset_name.h b/vendor/include/cardano/assets/asset_name.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/assets/asset_name.h
@@ -0,0 +1,645 @@
+/**
+ * \file asset_name.h
+ *
+ * \author angel.castillo
+ * \date   Mar 07, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ASSET_NAME_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ASSET_NAME_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents an asset name.
+ */
+typedef struct cardano_asset_name_t cardano_asset_name_t;
+
+/**
+ * \brief Creates and initializes a new instance of a Cardano asset name from byte data.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_asset_name_t object,
+ * which represents the name of a Cardano native asset. Native asset names in Cardano are arbitrary
+ * byte strings, typically used to uniquely identify assets within a policy.
+ *
+ * \param[in] data A pointer to an array of bytes representing the asset name. This array should contain
+ *                 the raw byte data of the asset name and must not be NULL.
+ * \param[in] size The size of the byte array. This value specifies how many bytes from the `data` array
+ *                 should be used for the asset name. The size must not exceed the maximum allowed length
+ *                 for asset names in Cardano.
+ * \param[out] asset_name On successful initialization, this will point to a newly created \ref cardano_asset_name_t object.
+ *             This object represents a "strong reference" to the asset name, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the asset name is no longer needed, the caller must release it
+ *             by calling \ref cardano_asset_name_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the asset name was successfully created from the provided bytes, or an appropriate error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input data pointer is NULL,
+ *         or \ref CARDANO_ERROR_INVALID_ARGUMENT if the size exceeds the maximum length or other constraints.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t* name_data = (const byte_t*)"example_asset";
+ * size_t name_size = strlen("example_asset");
+ * cardano_asset_name_t* asset_name = NULL;
+ *
+ * cardano_error_t result = cardano_asset_name_from_bytes(name_data, name_size, &asset_name);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_name
+ *   // Once done, ensure to clean up and release the asset_name
+ *   cardano_asset_name_unref(&asset_name);
+ * }
+ * else
+ * {
+ *   printf("Failed to create asset name: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_name_from_bytes(
+  const byte_t*          data,
+  size_t                 size,
+  cardano_asset_name_t** asset_name);
+
+/**
+ * \brief Creates and initializes a new instance of a Cardano asset name from a hexadecimal string.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_asset_name_t object,
+ * representing an asset name using a hexadecimal string. Asset names in Cardano are arbitrary byte strings,
+ * and this function specifically interprets the input as a hex-encoded representation of those bytes.
+ *
+ * \param[in] hex A pointer to a null-terminated string containing the hexadecimal representation of the asset name.
+ *                The string must not be NULL, must be properly hex-encoded, and must not contain non-hex characters.
+ * \param[in] size The number of characters in the hex string. This value must be even, as each pair of characters represents one byte.
+ * \param[out] asset_name On successful initialization, this will point to a newly created \ref cardano_asset_name_t object.
+ *             This object represents a "strong reference" to the asset name, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the asset name is no longer needed, the caller must release it
+ *             by calling \ref cardano_asset_name_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the asset name was successfully created from the provided hex string, or an appropriate error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input hex pointer is NULL,
+ *         or \ref CARDANO_ERROR_INVALID_ARGUMENT if the size is incorrect or the hex string is not valid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* hex_string = "6578616d706c65"; // Hex for "example"
+ * size_t hex_size = strlen(hex_string); // Should be an even number
+ * cardano_asset_name_t* asset_name = NULL;
+ *
+ * cardano_error_t result = cardano_asset_name_from_hex(hex_string, hex_size, &asset_name);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_name
+ *   // Once done, ensure to clean up and release the asset_name
+ *   cardano_asset_name_unref(&asset_name);
+ * }
+ * else
+ * {
+ *   printf("Failed to create asset name from hex: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_name_from_hex(
+  const char*            hex,
+  size_t                 size,
+  cardano_asset_name_t** asset_name);
+
+/**
+ * \brief Creates and initializes a new instance of a Cardano asset name from a UTF-8 string.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_asset_name_t object,
+ * which represents the name of a Cardano native asset. Asset names in Cardano are arbitrary byte strings,
+ * but this function specifically interprets the input as a UTF-8 encoded string, allowing for easier
+ * creation of asset names from human-readable text.
+ *
+ * \param[in] string A pointer to a null-terminated UTF-8 encoded string representing the asset name.
+ *                   This string must not be NULL and should be properly encoded in UTF-8.
+ * \param[in] size The number of bytes in the string, not including the null terminator. This allows
+ *                 for strings containing null bytes to be handled correctly.
+ * \param[out] asset_name On successful initialization, this will point to a newly created \ref cardano_asset_name_t object.
+ *             This object represents a "strong reference" to the asset name, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the asset name is no longer needed, the caller must release it
+ *             by calling \ref cardano_asset_name_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the asset name was successfully created from the provided string, or an appropriate error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input string pointer is NULL,
+ *         or \ref CARDANO_ERROR_INVALID_ARGUMENT if the size is incorrect or other constraints are not met.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* name_string = "example_asset";
+ * size_t name_length = strlen(name_string); // Not including the null terminator
+ * cardano_asset_name_t* asset_name = NULL;
+ *
+ * cardano_error_t result = cardano_asset_name_from_string(name_string, name_length, &asset_name);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_name
+ *   // Once done, ensure to clean up and release the asset_name
+ *   cardano_asset_name_unref(&asset_name);
+ * }
+ * else
+ * {
+ *   printf("Failed to create asset name: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_name_from_string(
+  const char*            string,
+  size_t                 size,
+  cardano_asset_name_t** asset_name);
+
+/**
+ * \brief Creates a \ref cardano_asset_name_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_asset_name_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a asset_name.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] asset_name A pointer to a pointer of \ref cardano_asset_name_t that will be set to the address
+ *                        of the newly created asset_name object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the asset name were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_asset_name_t object by calling
+ *       \ref cardano_asset_name_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_asset_name_t* asset_name = NULL;
+ *
+ * cardano_error_t result = cardano_asset_name_from_cbor(reader, &asset_name);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_name
+ *
+ *   // Once done, ensure to clean up and release the asset_name
+ *   cardano_asset_name_unref(&asset_name);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode asset_name: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_name_from_cbor(cardano_cbor_reader_t* reader, cardano_asset_name_t** asset_name);
+
+/**
+ * \brief Serializes asset name into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_asset_name_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] asset_name A constant pointer to the \ref cardano_asset_name_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p asset_name or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_t* asset_name = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_asset_name_to_cbor(asset_name, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_asset_name_unref(&asset_name);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_to_cbor(
+  const cardano_asset_name_t* asset_name,
+  cardano_cbor_writer_t*      writer);
+
+/**
+ * \brief Serializes an asset name to its CIP-116 JSON string representation.
+ *
+ * The function writes the hexadecimal representation of the asset name
+ * as a JSON string (e.g., "4d794173736574").
+ *
+ * \param[in]  asset_name Pointer to a valid \ref cardano_asset_name_t.
+ * \param[in]  writer     Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p asset_name or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_to_cip116_json(
+  const cardano_asset_name_t* asset_name,
+  cardano_json_writer_t*      writer);
+
+/**
+ * \brief Retrieves the string representation of a Cardano asset name.
+ *
+ * This function provides access to the string representation of a \ref cardano_asset_name_t object.
+ * The asset name is returned as a UTF-8 encoded null-terminated string. This string points to an internal
+ * buffer of the \ref cardano_asset_name_t object and must not be modified or freed by the caller. The string
+ * remains valid as long as the asset name object is not modified or freed.
+ *
+ * \param[in] asset_name A pointer an initialized \ref cardano_asset_name_t object.
+ *                       The pointer must not be NULL and should point to a valid asset name object.
+ *
+ * \return A pointer to a null-terminated UTF-8 string representing the asset name. If the input is NULL
+ *         or an error occurs, NULL is returned instead. The caller must not free this string as it is
+ *         managed internally by the asset name object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_t* asset_name = ...; // Assume asset_name is already initialized
+ * const char* name_str = cardano_asset_name_get_string(asset_name);
+ *
+ * if (name_str != NULL)
+ * {
+ *   printf("Asset Name: %s\n", name_str);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the asset name string.\n");
+ * }
+ * // No need to free name_str, it is managed internally
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char*
+cardano_asset_name_get_string(const cardano_asset_name_t* asset_name);
+
+/**
+ * \brief Retrieves the size of the string representation of a Cardano asset name, including the null terminator.
+ *
+ * This function calculates the length of the string representation of a \ref cardano_asset_name_t object,
+ * including the null terminator. This is useful for understanding the buffer size required to store the
+ * string representation of the asset name.
+ *
+ * \param[in] asset_name A pointer to an initialized \ref cardano_asset_name_t object.
+ *                       The pointer must not be NULL and should point to a valid asset name object.
+ *
+ * \return The size of the string in bytes, including the null terminator. If the input is NULL or an error occurs,
+ *         the function returns 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_t* asset_name = ...; // Assume asset_name is already initialized
+ * size_t name_size = cardano_asset_name_get_string_size(asset_name);
+ *
+ * if (name_size > 0)
+ * {
+ *   printf("Size of the asset name string including null terminator: %zu\n", name_size);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the size of the asset name string.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t
+cardano_asset_name_get_string_size(const cardano_asset_name_t* asset_name);
+
+/**
+ * \brief Retrieves the byte representation of a Cardano asset name.
+ *
+ * This function provides access to the underlying byte array of a \ref cardano_asset_name_t object.
+ * The byte array represents the asset name as it is stored and used within the Cardano ecosystem.
+ *
+ * \param[in] asset_name A pointer of an initialized \ref cardano_asset_name_t object.
+ *                       The pointer must not be NULL and should point to a valid asset name object.
+ *
+ * \return A pointer to the constant byte array representing the asset name. This pointer points to an
+ *         internal buffer and must not be modified or freed by the caller. If the input is NULL or an
+ *         error occurs, the function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_t* asset_name = ...; // Assume asset_name is already initialized
+ * const byte_t* name_bytes = cardano_asset_name_get_bytes(asset_name);
+ *
+ * if (name_bytes != NULL)
+ * {
+ *   // Process the bytes of the asset name
+ *   // Note: The length of the byte array should be known or determined separately
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the bytes of the asset name.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t*
+cardano_asset_name_get_bytes(const cardano_asset_name_t* asset_name);
+
+/**
+ * \brief Retrieves the size of the byte array for a Cardano asset name.
+ *
+ * This function returns the size of the byte array representing the asset name contained within
+ * a \ref cardano_asset_name_t object.
+ *
+ * \param[in] asset_name A pointer of an initialized \ref cardano_asset_name_t object.
+ *                       The pointer must not be NULL and should point to a valid asset name object.
+ *
+ * \return The size of the byte array representing the asset name. If the input is NULL or an
+ *         error occurs, the function returns 0. This size does not include a null terminator, as
+ *         asset names can contain arbitrary binary data.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_t* asset_name = ...; // Assume asset_name is already initialized
+ * size_t name_size = cardano_asset_name_get_bytes_size(asset_name);
+ *
+ * if (name_size > 0)
+ * {
+ *   const byte_t* name_bytes = cardano_asset_name_get_bytes(asset_name);
+ *   // Process the bytes knowing the exact size of the asset name
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the size of the asset name or asset name is empty.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t
+cardano_asset_name_get_bytes_size(const cardano_asset_name_t* asset_name);
+
+/**
+ * \brief Retrieves the hexadecimal string representation of a Cardano asset name.
+ *
+ * This function returns the hexadecimal string representation of a \ref cardano_asset_name_t object.
+ * The string encodes the asset name, which consists of the concatenated bytes of the policy ID and asset name.
+ *
+ * \param[in] asset_name A pointer to an initialized \ref cardano_asset_name_t object.
+ *                     The pointer must not be NULL and should point to a valid asset name object.
+ *
+ * \return A pointer to a null-terminated string representing the asset name in hexadecimal format.
+ *         This string is owned by the \ref cardano_asset_name_t object and must not be modified or freed by the caller.
+ *         If the input is NULL or an error occurs, the function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_asset_name_t* asset_name = ...; // Assume asset_name is already initialized
+ * const char* hex_string = cardano_asset_name_get_hex(asset_name);
+ *
+ * if (hex_string != NULL)
+ * {
+ *   // Process the hexadecimal string of the asset name
+ *   printf("Asset ID in hex: %s\n", hex_string);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the hexadecimal string of the asset name.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char*
+cardano_asset_name_get_hex(const cardano_asset_name_t* asset_name);
+
+/**
+ * \brief Retrieves the size of the hexadecimal string for a Cardano asset name.
+ *
+ * This function returns the size of the hexadecimal string representation of a \ref cardano_asset_name_t object.
+ * The size includes the number of characters in the hexadecimal string, not including the null terminator.
+ *
+ * \param[in] asset_name A pointer to an initialized \ref cardano_asset_name_t object.
+ *                     The pointer must not be NULL and should point to a valid asset name object.
+ *
+ * \return The size of the hexadecimal string representing the asset name. If the input is NULL or an
+ *         error occurs, the function returns 0. The size does not include a null terminator.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_asset_name_t* asset_name = ...; // Assume asset_name is already initialized
+ * size_t hex_size = cardano_asset_name_get_hex_size(asset_name);
+ *
+ * if (hex_size > 0)
+ * {
+ *   const char* hex_string = cardano_asset_name_get_hex(asset_name);
+ *   // Process the hex string knowing the exact size of the asset name
+ *   printf("Hexadecimal string size: %zu\n", hex_size);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the size of the asset name in hex or asset name is empty.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t
+cardano_asset_name_get_hex_size(const cardano_asset_name_t* asset_name);
+
+/**
+ * \brief Decrements the reference count of a cardano_asset_name_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_asset_name_t object
+ * by decreasing its reference count. When the reference count reaches zero, the asset_name is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] asset_name A pointer to the pointer of the asset_name object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_t* asset_name = cardano_asset_name_new(major, minor);
+ *
+ * // Perform operations with the asset_name...
+ *
+ * cardano_asset_name_unref(&asset_name);
+ * // At this point, asset_name is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_asset_name_unref, the pointer to the \ref cardano_asset_name_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_asset_name_unref(cardano_asset_name_t** asset_name);
+
+/**
+ * \brief Increases the reference count of the cardano_asset_name_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_asset_name_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_asset_name_unref.
+ *
+ * \param asset_name A pointer to the cardano_asset_name_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_name is a previously created asset_name object
+ *
+ * cardano_asset_name_ref(asset_name);
+ *
+ * // Now asset_name can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_asset_name_ref there is a corresponding
+ * call to \ref cardano_asset_name_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_asset_name_ref(cardano_asset_name_t* asset_name);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_asset_name_t object.
+ *
+ * This function returns the number of active references to an cardano_asset_name_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_asset_name_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param asset_name A pointer to the cardano_asset_name_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_asset_name_t object. If the object
+ * is properly managed (i.e., every \ref cardano_asset_name_ref call is matched with a
+ * \ref cardano_asset_name_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_name is a previously created asset_name object
+ *
+ * size_t ref_count = cardano_asset_name_refcount(asset_name);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_asset_name_refcount(const cardano_asset_name_t* asset_name);
+
+/**
+ * \brief Sets the last error message for a given cardano_asset_name_t object.
+ *
+ * Records an error message in the asset_name's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] asset_name A pointer to the \ref cardano_asset_name_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the asset_name's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_asset_name_set_last_error(
+  cardano_asset_name_t* asset_name,
+  const char*           message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific asset_name.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_asset_name_set_last_error for the given
+ * asset_name. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] asset_name A pointer to the \ref cardano_asset_name_t instance whose last error
+ *                   message is to be retrieved. If the asset_name is NULL, the function
+ *                   returns a generic error message indicating the null asset_name.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified asset_name. If the asset_name is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_asset_name_set_last_error for the same asset_name, or until
+ *       the asset_name is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_asset_name_get_last_error(
+  const cardano_asset_name_t* asset_name);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_asset_name_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_asset_name_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_asset_name_deep_clone(const cardano_asset_name_t* source, cardano_asset_name_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ASSET_NAME_H
diff --git a/vendor/include/cardano/assets/asset_name_list.h b/vendor/include/cardano/assets/asset_name_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/assets/asset_name_list.h
@@ -0,0 +1,333 @@
+/**
+ * \file asset_name_list.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ASSET_NAME_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ASSET_NAME_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents an asset name.
+ */
+typedef struct cardano_asset_name_t cardano_asset_name_t;
+
+/**
+ * \brief Represents a list of asset name.
+ */
+typedef struct cardano_asset_name_list_t cardano_asset_name_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a asset_name_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_asset_name_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] asset_name_list On successful initialization, this will point to a newly created
+ *             \ref cardano_asset_name_list_t object. This object represents a "strong reference"
+ *             to the asset_name_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the asset_name_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_asset_name_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the asset_name_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_list_t* asset_name_list = NULL;
+ *
+ * // Attempt to create a new asset_name_list
+ * cardano_error_t result = cardano_asset_name_list_new(&asset_name_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_name_list
+ *
+ *   // Once done, ensure to clean up and release the asset_name_list
+ *   cardano_asset_name_list_unref(&asset_name_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_name_list_new(cardano_asset_name_list_t** asset_name_list);
+
+/**
+ * \brief Retrieves the length of a asset name list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_asset_name_list_t object.
+ *
+ * \param[in] asset_name_list A constant pointer to the \ref cardano_asset_name_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the asset_name_list. Return 0 if the asset_name_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_list_t* asset_name_list = cardano_asset_name_list_new();
+ *
+ * // Populate asset_name_list with elements
+ *
+ * size_t length = cardano_asset_name_list_get_length(asset_name_list);
+ * printf("Length of the asset_name_list: %zu\n", length);
+ *
+ * // Clean up the asset_name_list object once done
+ * cardano_asset_name_list_unref(&asset_name_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_asset_name_list_get_length(const cardano_asset_name_list_t* asset_name_list);
+
+/**
+ * \brief Retrieves an element from a asset name list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_asset_name_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] asset_name_list A constant pointer to the \ref cardano_asset_name_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the asset name list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_asset_name_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_asset_name_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_list_t* asset_name_list = cardano_asset_name_list_new();
+ *
+ * // Populate asset_name_list with elements
+ *
+ * cardano_asset_name_t* element = NULL;
+ * cardano_error_t result = cardano_asset_name_list_get(asset_name_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_asset_name_unref(&element);
+ * }
+ *
+ * // Clean up the asset_name_list object once done
+ * cardano_asset_name_list_unref(&asset_name_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_list_get(const cardano_asset_name_list_t* asset_name_list, size_t index, cardano_asset_name_t** element);
+
+/**
+ * \brief Adds an element to a asset name list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_asset_name_list_t object.
+ *
+ * \param[in] asset_name_list A constant pointer to the \ref cardano_asset_name_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_asset_name_t object that is to be added to the asset_name_list.
+ *                    The element will be referenced by the asset_name_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the asset_name_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_list_t* asset_name_list = cardano_asset_name_list_new();
+ *
+ * // Create and initialize a new asset name element
+ * cardano_asset_name_t* element = { ... };
+ *
+ * // Add the element to the asset_name_list
+ * cardano_error_t result = cardano_asset_name_list_add(asset_name_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the asset_name_list object once done
+ * cardano_asset_name_list_unref(&asset_name_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_list_add(cardano_asset_name_list_t* asset_name_list, cardano_asset_name_t* element);
+
+/**
+ * \brief Decrements the reference count of a asset_name_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_asset_name_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the asset_name_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] asset_name_list A pointer to the pointer of the asset_name_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_list_t* asset_name_list = cardano_asset_name_list_new();
+ *
+ * // Perform operations with the asset_name_list...
+ *
+ * cardano_asset_name_list_unref(&asset_name_list);
+ * // At this point, asset_name_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_asset_name_list_unref, the pointer to the \ref cardano_asset_name_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_asset_name_list_unref(cardano_asset_name_list_t** asset_name_list);
+
+/**
+ * \brief Increases the reference count of the cardano_asset_name_list_t object.
+ *
+ * This function is used to manually increment the reference count of a asset_name_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_asset_name_list_unref.
+ *
+ * \param asset_name_list A pointer to the asset_name_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_name_list is a previously created asset_name_list object
+ *
+ * cardano_asset_name_list_ref(asset_name_list);
+ *
+ * // Now asset_name_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_asset_name_list_ref there is a corresponding
+ * call to \ref cardano_asset_name_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_asset_name_list_ref(cardano_asset_name_list_t* asset_name_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_asset_name_list_t object.
+ *
+ * This function returns the number of active references to a asset_name_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_asset_name_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param asset_name_list A pointer to the asset_name_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified asset_name_list object. If the object
+ * is properly managed (i.e., every \ref cardano_asset_name_list_ref call is matched with a
+ * \ref cardano_asset_name_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_name_list is a previously created asset_name_list object
+ *
+ * size_t ref_count = cardano_asset_name_list_refcount(asset_name_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_asset_name_list_refcount(const cardano_asset_name_list_t* asset_name_list);
+
+/**
+ * \brief Sets the last error message for a given asset_name_list object.
+ *
+ * Records an error message in the asset_name_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] asset_name_list A pointer to the \ref cardano_asset_name_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the asset_name_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_asset_name_list_set_last_error(cardano_asset_name_list_t* asset_name_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific asset_name_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_asset_name_list_set_last_error for the given
+ * asset_name_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] asset_name_list A pointer to the \ref cardano_asset_name_list_t instance whose last error
+ *                   message is to be retrieved. If the asset_name_list is NULL, the function
+ *                   returns a generic error message indicating the null asset_name_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified asset_name_list. If the asset_name_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_asset_name_list_set_last_error for the same asset_name_list, or until
+ *       the asset_name_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_asset_name_list_get_last_error(const cardano_asset_name_list_t* asset_name_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_asset_name_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_asset_name_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_asset_name_list_deep_clone(const cardano_asset_name_list_t* source, cardano_asset_name_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ASSET_NAME_LIST_H
diff --git a/vendor/include/cardano/assets/asset_name_map.h b/vendor/include/cardano/assets/asset_name_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/assets/asset_name_map.h
@@ -0,0 +1,786 @@
+/**
+ * \file asset_name_map.h
+ *
+ * \author angel.castillo
+ * \date   Sep 05, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ASSET_NAME_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ASSET_NAME_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_name.h>
+#include <cardano/assets/asset_name_list.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of asset name to coin amount.
+ */
+typedef struct cardano_asset_name_map_t cardano_asset_name_map_t;
+
+/**
+ * \brief Creates and initializes a new instance of a asset name map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_asset_name_map_t,
+ * representing a map structure. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] asset_name_map A pointer to a pointer to a \ref cardano_asset_name_map_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_asset_name_map_t
+ *                        object. This object represents a "strong reference" to the asset_name_map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the asset_name_map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_asset_name_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the asset_name_map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_map_t* asset_name_map = NULL;
+ *
+ * // Attempt to create a new asset_name_map
+ * cardano_error_t result = cardano_asset_name_map_new(&asset_name_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_name_map
+ *
+ *   // Once done, ensure to clean up and release the asset_name_map
+ *   cardano_asset_name_map_unref(&asset_name_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_name_map_new(cardano_asset_name_map_t** asset_name_map);
+
+/**
+ * \brief Creates a asset name map from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_asset_name_map_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a asset_name_map.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded asset_name_map data.
+ * \param[out] asset_name_map A pointer to a pointer of \ref cardano_asset_name_map_t that will be set to the address
+ *                        of the newly created asset_name_map object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the asset_name_map was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_asset_name_map_t object by calling
+ *       \ref cardano_asset_name_map_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_asset_name_map_t* asset_name_map = NULL;
+ *
+ * cardano_error_t result = cardano_asset_name_map_from_cbor(reader, &asset_name_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_name_map
+ *
+ *   // Once done, ensure to clean up and release the asset_name_map
+ *   cardano_asset_name_map_unref(&asset_name_map);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode asset_name_map: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_asset_name_map_from_cbor(cardano_cbor_reader_t* reader, cardano_asset_name_map_t** asset_name_map);
+
+/**
+ * \brief Serializes a asset name map into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_asset_name_map_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] asset_name_map A constant pointer to the \ref cardano_asset_name_map_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p asset_name_map or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_map_t* asset_name_map = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_asset_name_map_to_cbor(asset_name_map, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_asset_name_map_unref(&asset_name_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_map_to_cbor(
+  const cardano_asset_name_map_t* asset_name_map,
+  cardano_cbor_writer_t*          writer);
+
+/**
+ * \brief Serializes an asset name map to a CIP-116 JSON object.
+ *
+ * The function writes a JSON object where keys are the hexadecimal representation
+ * of the asset names, and values are the string representation of the amounts.
+ *
+ * \param[in]  map     Pointer to a valid \ref cardano_asset_name_map_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p map or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_map_to_cip116_json(
+  const cardano_asset_name_map_t* map,
+  cardano_json_writer_t*          writer);
+
+/**
+ * \brief Serializes an asset name map to a CIP-116 JSON array of key-value objects.
+ *
+ * This function converts the internal map structure of [AssetName -> Amount] into an
+ * ordered JSON array, matching the schema required for the 'assets' field within the 'Mint' structure
+ * (Transaction Body). Each map entry is serialized as a JSON object:
+ * { "asset_name": "<hex_string>", "amount": "<amount_string>" }
+ *
+ * \param[in]  map     Pointer to a valid \ref cardano_asset_name_map_t.
+ * \param[in]  writer  Pointer to the active \ref cardano_json_writer_t instance.
+ *
+ * \return CARDANO_SUCCESS               On successful serialization.
+ * \return CARDANO_ERROR_POINTER_IS_NULL If \p map or \p writer is NULL.
+ * \return CARDANO_ERROR_ENCODING        If an element within the map is NULL.
+ * \return Other                         Any error propagated from nested writers.
+ */
+cardano_error_t
+cardano_asset_name_map_to_cip116_json_ex(
+  const cardano_asset_name_map_t* map,
+  cardano_json_writer_t*          writer);
+
+/**
+ * \brief Retrieves the length of the asset_name_map.
+ *
+ * This function returns the number of key-value pairs contained in the specified asset_name_map.
+ *
+ * \param[in] asset_name_map A constant pointer to the \ref cardano_asset_name_map_t object for which
+ *                       the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the asset_name_map. Returns 0 if the asset_name_map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_map_t* asset_name_map = cardano_asset_name_map_new();
+ *
+ * // Populate the asset_name_map with key-value pairs
+ *
+ * size_t length = cardano_asset_name_map_get_length(asset_name_map);
+ * printf("The length of the asset_name_map is: %zu\n", length);
+ *
+ * cardano_asset_name_map_unref(&asset_name_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_asset_name_map_get_length(const cardano_asset_name_map_t* asset_name_map);
+
+/**
+ * \brief Retrieves the value associated with a given key in the asset name map.
+ *
+ * This function retrieves the value associated with the specified key in the provided asset name map.
+ * It returns the value through the output parameter `element`. If the key is not found in the asset name map,
+ * the output parameter `element` will be set to NULL.
+ *
+ * \param[in] asset_name_map A constant pointer to the \ref cardano_asset_name_map_t object from which
+ *                       the value is to be retrieved.
+ * \param[in] key The key whose associated value is to be retrieved from the asset_name_map.
+ * \param[out] element A pointer to a variable where the retrieved value will be stored. If the key
+ *                     is found in the asset name map, this variable will be set to the associated value.
+ *                     If the key is not found, this variable will be set to NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value associated with the key was successfully retrieved, or
+ *         an appropriate error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_map_t* asset_name_map = cardano_asset_name_map_new();
+ *
+ * // Populate the asset_name_map with key-value pairs
+ *
+ * cardano_asset_name_t* key = ...; // Create a asset_name object representing the key
+ * int64_t value = 0;
+ * cardano_error_t result = cardano_asset_name_map_get(asset_name_map, key, &value);
+ *
+ * if (result == CARDANO_SUCCESS && value != NULL)
+ * {
+ *   // Use the retrieved value
+ *   // ...
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_asset_name_unref(&key); // Clean up the key resource
+ * cardano_asset_name_map_unref(&asset_name_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_map_get(cardano_asset_name_map_t* asset_name_map, cardano_asset_name_t* key, int64_t* element);
+
+/**
+ * \brief Inserts a key-value pair into the asset name map.
+ *
+ * This function inserts the specified key-value pair into the provided asset name map.
+ *
+ * \param[in] asset_name_map A constant pointer to the \ref cardano_asset_name_map_t object where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The key to be inserted into the asset name map. The caller is responsible for managing
+ *                the lifecycle of the key object.
+ * \param[in] value The value to be associated with the key and inserted into the asset_name_map.
+ *                  The caller is responsible for managing the lifecycle of the value object.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * \remark If the key already exists in the asset name map, the value associated with the key will be updated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_map_t* asset_name_map = cardano_asset_name_map_new();
+ *
+ * // Create key and value objects
+ * cardano_asset_name_t* key = ...;
+ * int64_t value = 0;
+ *
+ * // Insert the key-value pair into the asset_name_map
+ * cardano_error_t result = cardano_asset_name_map_insert(asset_name_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value objects
+ * cardano_asset_name_unref(&key);
+ *
+ * cardano_asset_name_map_unref(&asset_name_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_map_insert(cardano_asset_name_map_t* asset_name_map, cardano_asset_name_t* key, int64_t value);
+
+/**
+ * \brief Retrieves the keys from the asset name map.
+ *
+ * This function retrieves all the keys from the provided asset name map and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_asset_name_list_t when it is no longer needed.
+ *
+ * \param[in] asset_name_map A constant pointer to the \ref cardano_asset_name_map_t object from which
+ *                       the keys are to be retrieved.
+ * \param[out] keys A pointer to a variable where the retrieved keys will be stored as a list.
+ *                  If successful, this variable will be set to point to the list of keys.
+ *                  The caller is responsible for managing the lifecycle of this list.
+ *                  It must be released by calling \ref cardano_asset_name_list_t when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the keys were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_map_t* asset_name_map = cardano_asset_name_map_new();
+ *
+ * // Populate the asset_name_map with key-value pairs
+ *
+ * cardano_asset_name_list_t* keys = NULL;
+ * cardano_error_t result = cardano_asset_name_map_get_keys(asset_name_map, &keys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of keys
+ *   // Keys must also be freed if retrieved from the list
+ *
+ *   // Once done, ensure to clean up and release the keys list
+ *   cardano_asset_name_list_unref(&keys);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_asset_name_map_unref(&asset_name_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_map_get_keys(cardano_asset_name_map_t* asset_name_map, cardano_asset_name_list_t** keys);
+
+/**
+ * \brief Retrieves the asset name at a specific index from the asset name map.
+ *
+ * This function retrieves the asset name at the specified index from the asset name map.
+ *
+ * \param[in] asset_name_map Pointer to the asset name map object.
+ * \param[in] index The index of the asset name to retrieve.
+ * \param[out] asset_name On successful retrieval, this will point to the asset name
+ *                        at the specified index. The caller is responsible for managing the lifecycle
+ *                        of this object. Specifically, once the asset name is no longer needed,
+ *                        the caller must release it by calling \ref cardano_asset_name_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the asset name was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_map_t* asset_name_map = NULL;
+ * cardano_asset_name_t* asset_name = NULL;
+ * size_t index = 0; // Index of the key hash to retrieve
+ *
+ * // Assume asset_name_map is initialized properly
+ *
+ * cardano_error_t result = cardano_asset_name_map_get_key_at(asset_name_map, index, &asset_name);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the asset_name
+ *
+ *   // Once done, ensure to clean up and release the asset_name
+ *   cardano_asset_name_unref(&asset_name);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_map_get_key_at(
+  const cardano_asset_name_map_t* asset_name_map,
+  size_t                          index,
+  cardano_asset_name_t**          asset_name);
+
+/**
+ * \brief Retrieves the withdrawal amount at a specific index from the asset name map.
+ *
+ * This function retrieves the withdrawal amount at the specified index from the asset name map.
+ *
+ * \param[in] asset_name_map Pointer to the asset name map object.
+ * \param[in] index The index of the withdrawal amount to retrieve.
+ * \param[out] amount On successful retrieval, this will point to the withdrawal amount
+ *                    at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the withdrawal amount was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_map_t* asset_name_map = NULL;
+ * int64_t amount = 0;
+ * size_t index = 0; // Index of the withdrawal amount to retrieve
+ *
+ * // Assume asset_name_map is initialized properly
+ *
+ * cardano_error_t result = cardano_asset_name_map_get_value_at(asset_name_map, index, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the amount
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_map_get_value_at(
+  const cardano_asset_name_map_t* asset_name_map,
+  size_t                          index,
+  int64_t*                        amount);
+
+/**
+ * \brief Retrieves the asset name and withdrawal amount at the specified index.
+ *
+ * This function retrieves the asset name and withdrawal amount from the proposed withdrawal amounts
+ * at the specified index.
+ *
+ * \param[in]  asset_name_map    Pointer to the proposed withdrawal amounts object.
+ * \param[in]  index             The index at which to retrieve the key-value pair.
+ * \param[out] asset_name On successful retrieval, this will point to the asset name at the specified index.
+ *                            The caller is responsible for managing the lifecycle of this object and should release it using
+ *                            \ref cardano_asset_name_unref when it is no longer needed.
+ * \param[out] amount On successful retrieval, this will point to the withdrawal amount at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_map_t* asset_name_map = NULL;
+ * // Assume asset_name_map is initialized properly
+ *
+ * size_t index = 0;
+ * cardano_asset_name_t* asset_name = NULL;
+ * int64_t amount = 0;
+ *
+ * cardano_error_t result = cardano_asset_name_map_get_key_value_at(asset_name_map, index, &asset_name, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (asset_name != NULL && amount != NULL)
+ *   {
+ *     // Use the asset name and withdrawal amount
+ *   }
+ *   else
+ *   {
+ *     printf("Key-value pair not set at index %zu.\n", index);
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_asset_name_map_unref(&asset_name_map);
+ * cardano_asset_name_unref(&asset_name);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_map_get_key_value_at(
+  const cardano_asset_name_map_t* asset_name_map,
+  size_t                          index,
+  cardano_asset_name_t**          asset_name,
+  int64_t*                        amount);
+
+/**
+ * \brief Combines two asset name maps by adding the quantities of assets with the same asset names.
+ *
+ * This function adds the asset quantities from two \ref cardano_asset_name_map_t objects. It combines the quantities
+ * of assets that have the same asset names. If an asset name exists in both maps, their quantities are summed.
+ * If an asset name exists in only one of the maps, its quantity is copied to the result.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_asset_name_map_t object.
+ * \param[in] rhs A constant pointer to the second \ref cardano_asset_name_map_t object.
+ * \param[out] result On successful execution, this will point to a newly created \ref cardano_asset_name_map_t object
+ *             that represents the combined result of both input asset name maps.
+ *             The result is dynamically allocated and must be freed by the caller using \ref cardano_asset_name_map_unref
+ *             when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the assets were
+ *         successfully combined, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_asset_name_map_t* lhs = ...; // Assume lhs is already initialized with some assets
+ * const cardano_asset_name_map_t* rhs = ...; // Assume rhs is also initialized with some assets
+ * cardano_asset_name_map_t* result = NULL;
+ *
+ * cardano_error_t add_result = cardano_asset_name_map_add(lhs, rhs, &result);
+ * if (add_result == CARDANO_SUCCESS)
+ * {
+ *   // The assets have been successfully combined
+ *   // Use the result as needed
+ *
+ *   // When done, release the result
+ *   cardano_asset_name_map_unref(&result);
+ * }
+ * else
+ * {
+ *   printf("Failed to combine assets: %s\n", cardano_error_to_string(add_result));
+ * }
+ *
+ * // Cleanup resources
+ * cardano_asset_name_map_unref(&lhs);
+ * cardano_asset_name_map_unref(&rhs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_map_add(
+  const cardano_asset_name_map_t* lhs,
+  const cardano_asset_name_map_t* rhs,
+  cardano_asset_name_map_t**      result);
+
+/**
+ * \brief Subtracts the quantities of assets under each asset name from one asset name map to another.
+ *
+ * This function subtracts the assets from the second \ref cardano_asset_name_map_t object (rhs) from the first
+ * \ref cardano_asset_name_map_t object (lhs). It subtracts the quantities of assets under each asset name present
+ * in both maps. If an asset name exists only in the rhs, the value is copied as negative, effectively subtracting
+ * it from the lhs. If an asset name exists only in the lhs, the value is copied as is to the result.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_asset_name_map_t object from which assets will be subtracted.
+ * \param[in] rhs A constant pointer to the second \ref cardano_asset_name_map_t object that provides the quantities to subtract.
+ * \param[out] result On successful execution, this will point to a newly created \ref cardano_asset_name_map_t object
+ *             that represents the result of the subtraction.
+ *             The result is dynamically allocated and must be freed by the caller using \ref cardano_asset_name_map_unref
+ *             when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the assets were
+ *         successfully subtracted, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_asset_name_map_t* lhs = ...; // Assume lhs is already initialized with some assets
+ * const cardano_asset_name_map_t* rhs = ...; // Assume rhs is also initialized with some assets to subtract
+ * cardano_asset_name_map_t* result = NULL;
+ *
+ * cardano_error_t subtract_result = cardano_asset_name_map_subtract(lhs, rhs, &result);
+ * if (subtract_result == CARDANO_SUCCESS)
+ * {
+ *   // The assets have been successfully subtracted
+ *   // Use the result
+ *   cardano_asset_name_map_unref(&result);
+ * }
+ * else
+ * {
+ *   printf("Failed to subtract assets: %s\n", cardano_error_to_string(subtract_result));
+ * }
+ *
+ * // Cleanup resources
+ * cardano_asset_name_map_unref(&lhs);
+ * cardano_asset_name_map_unref(&rhs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_asset_name_map_subtract(
+  const cardano_asset_name_map_t* lhs,
+  const cardano_asset_name_map_t* rhs,
+  cardano_asset_name_map_t**      result);
+
+/**
+ * \brief Compares two asset name map objects for equality.
+ *
+ * This function compares two asset_name_map objects to determine if they are equal.
+ *
+ * \param[in] lhs Pointer to the first asset name map object.
+ * \param[in] rhs Pointer to the second asset name map object.
+ *
+ * \return \c true if the asset name map objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_map_t* asset_name_map1 = NULL;
+ * cardano_asset_name_map_t* asset_name_map2 = NULL;
+ *
+ * // Assume asset_name_map1 and asset_name_map2 are initialized properly
+ *
+ * bool are_equal = cardano_asset_name_map_equals(asset_name_map1, asset_name_map2);
+ *
+ * if (are_equal)
+ * {
+ *   printf("The asset_name_map objects are equal.\n");
+ * }
+ * else
+ * {
+ *   printf("The asset_name_map objects are not equal.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_asset_name_map_unref(&asset_name_map1);
+ * cardano_asset_name_map_unref(&asset_name_map2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool
+cardano_asset_name_map_equals(const cardano_asset_name_map_t* lhs, const cardano_asset_name_map_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a asset_name_map object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_asset_name_map_t object
+ * by decreasing its reference count. When the reference count reaches zero, the asset_name_map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] asset_name_map A pointer to the pointer of the asset_name_map object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_name_map_t* asset_name_map = cardano_asset_name_map_new();
+ *
+ * // Perform operations with the asset_name_map...
+ *
+ * cardano_asset_name_map_unref(&asset_name_map);
+ * // At this point, asset_name_map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_asset_name_map_unref, the pointer to the \ref cardano_asset_name_map_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_asset_name_map_unref(cardano_asset_name_map_t** asset_name_map);
+
+/**
+ * \brief Increases the reference count of the cardano_asset_name_map_t object.
+ *
+ * This function is used to manually increment the reference count of a asset_name_map
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_asset_name_map_unref.
+ *
+ * \param asset_name_map A pointer to the asset_name_map object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_name_map is a previously created asset_name_map object
+ *
+ * cardano_asset_name_map_ref(asset_name_map);
+ *
+ * // Now asset_name_map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_asset_name_map_ref there is a corresponding
+ * call to \ref cardano_asset_name_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_asset_name_map_ref(cardano_asset_name_map_t* asset_name_map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_asset_name_map_t object.
+ *
+ * This function returns the number of active references to a asset_name_map object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_asset_name_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param asset_name_map A pointer to the asset_name_map object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified asset_name_map object. If the object
+ * is properly managed (i.e., every \ref cardano_asset_name_map_ref call is matched with a
+ * \ref cardano_asset_name_map_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming asset_name_map is a previously created asset_name_map object
+ *
+ * size_t ref_count = cardano_asset_name_map_refcount(asset_name_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_asset_name_map_refcount(const cardano_asset_name_map_t* asset_name_map);
+
+/**
+ * \brief Sets the last error message for a given asset_name_map object.
+ *
+ * Records an error message in the asset_name_map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] asset_name_map A pointer to the \ref cardano_asset_name_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the asset_name_map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_asset_name_map_set_last_error(cardano_asset_name_map_t* asset_name_map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific asset_name_map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_asset_name_map_set_last_error for the given
+ * asset_name_map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] asset_name_map A pointer to the \ref cardano_asset_name_map_t instance whose last error
+ *                   message is to be retrieved. If the asset_name_map is NULL, the function
+ *                   returns a generic error message indicating the null asset_name_map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified asset_name_map. If the asset_name_map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_asset_name_map_set_last_error for the same asset_name_map, or until
+ *       the asset_name_map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_asset_name_map_get_last_error(const cardano_asset_name_map_t* asset_name_map);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_asset_name_map_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_asset_name_map_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_asset_name_map_deep_clone(const cardano_asset_name_map_t* source, cardano_asset_name_map_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ASSET_NAME_MAP_H
diff --git a/vendor/include/cardano/assets/multi_asset.h b/vendor/include/cardano/assets/multi_asset.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/assets/multi_asset.h
@@ -0,0 +1,897 @@
+/**
+ * \file multi_asset.h
+ *
+ * \author angel.castillo
+ * \date   Sep 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_MULTI_ASSET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_MULTI_ASSET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/assets/asset_name.h>
+#include <cardano/assets/asset_name_map.h>
+#include <cardano/assets/policy_id_list.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a collection of assets in the Cardano blockchain.
+ *
+ * This struct is used to represent a multi-asset, which can include various native tokens.
+ * Each asset is identified by a unique combination of a policy ID and asset name, and the
+ * struct manages quantities of these assets.
+ */
+typedef struct cardano_multi_asset_t cardano_multi_asset_t;
+
+/**
+ * \brief Creates and initializes a new instance of a Multi-Asset.
+ *
+ * This function allocates and initializes a new instance of a Multi-Asset,
+ * which can hold various native tokens within the Cardano network.
+ *
+ * \param[out] multi_asset On successful initialization, this will point to a newly created
+ *             cardano_multi_asset_t object. This object represents a "strong reference",
+ *             meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the Multi-Asset is no longer needed, the caller must release it
+ *             by calling \ref cardano_multi_asset_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Multi-Asset was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_asset_t* multi_asset = NULL;
+ *
+ * // Attempt to create a new Multi-Asset object
+ * cardano_error_t result = cardano_multi_asset_new(&multi_asset);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the multi_asset
+ *
+ *   // Once done, ensure to clean up and release the multi_asset
+ *   cardano_multi_asset_unref(&multi_asset);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_multi_asset_new(cardano_multi_asset_t** multi_asset);
+
+/**
+ * \brief Creates a \ref cardano_multi_asset_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_multi_asset_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a multi_asset.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] multi_asset A pointer to a pointer of \ref cardano_multi_asset_t that will be set to the address
+ *                        of the newly created multi_asset object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the multi asset were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_multi_asset_t object by calling
+ *       \ref cardano_multi_asset_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_multi_asset_t* multi_asset = NULL;
+ *
+ * cardano_error_t result = cardano_multi_asset_from_cbor(reader, &multi_asset);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the multi_asset
+ *
+ *   // Once done, ensure to clean up and release the multi_asset
+ *   cardano_multi_asset_unref(&multi_asset);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode multi_asset: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_multi_asset_from_cbor(cardano_cbor_reader_t* reader, cardano_multi_asset_t** multi_asset);
+
+/**
+ * \brief Serializes multi asset into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_multi_asset_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] multi_asset A constant pointer to the \ref cardano_multi_asset_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p multi_asset or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark Policies whose inner asset name maps are empty are skipped, so the encoder never emits
+ *         empty inner policy maps.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_asset_t* multi_asset = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_multi_asset_to_cbor(multi_asset, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_multi_asset_unref(&multi_asset);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_to_cbor(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_cbor_writer_t*       writer);
+
+/**
+ * \brief Serializes a multi-asset collection to its CIP-116 JSON object representation.
+ *
+ * This function serializes the multi-asset structure into a JSON object where
+ * keys are the hex-encoded Policy IDs (ScriptHash) and values are the
+ * corresponding asset name maps (also JSON objects).
+ *
+ * This format is used for the "assets" field within a "Value" object.
+ *
+ * \param[in]  multi_asset Pointer to a valid \ref cardano_multi_asset_t.
+ * \param[in]  writer      Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p multi_asset or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_to_cip116_json(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_json_writer_t*       writer);
+
+/**
+ * \brief Serializes a multi-asset collection into the specific CIP-116 'Mint' array format.
+ *
+ * This function converts the internal map structure (Policy ID -> Asset Name Map) into
+ * a JSON **array** of policy objects, which is the format required for the 'mint' field in the
+ * \ref cardano_transaction_body_t. The output structure is:
+ * [ { "script_hash": "<policy_hex>", "assets": { ...asset_map... } }, ... ]
+ *
+ * \param[in]  multi_asset Pointer to the valid \ref cardano_multi_asset_t collection to be serialized.
+ * \param[in]  writer      Pointer to the active \ref cardano_json_writer_t instance.
+ *
+ * \return CARDANO_SUCCESS                 On successful serialization.
+ * \return CARDANO_ERROR_POINTER_IS_NULL   If \p multi_asset or \p writer is NULL.
+ * \return CARDANO_ERROR_ELEMENT_NOT_FOUND If a null element is encountered in the internal array.
+ * \return Other                           Any error propagated from nested serialization calls
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_to_cip116_json_ex(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_json_writer_t*       writer);
+
+/**
+ * \brief Retrieves the number of distinct policy IDs within a multi-asset container.
+ *
+ * This function counts the number of distinct policy IDs in a given \ref cardano_multi_asset_t object.
+ * Each policy ID can have one or more asset names associated with it, but this function only counts the
+ * unique policies.
+ *
+ * \param[in] multi_asset A constant pointer to an initialized \ref cardano_multi_asset_t object.
+ *                        The pointer must not be NULL.
+ *
+ * \return The number of unique policy IDs contained within the multi_asset object. If the input is NULL,
+ *         the function returns 0 as a safe guard. This helps in managing conditions where the
+ *         multi-asset container might be empty or incorrectly initialized.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_multi_asset_t* multi_asset = ...; // Assume multi_asset is already initialized
+ * size_t policy_count = cardano_multi_asset_get_policy_count(multi_asset);
+ *
+ * printf("The multi-asset container has %zu distinct policy IDs.\n", policy_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_multi_asset_get_policy_count(
+  const cardano_multi_asset_t* multi_asset);
+
+/**
+ * \brief Inserts assets under a specific policy ID into a multi-asset container.
+ *
+ * This function adds a collection of assets, identified by their names, along with their respective quantities,
+ * under a given policy ID into a \ref cardano_multi_asset_t object. If the policy ID already exists in the multi-asset,
+ * the assets are merged with the existing ones under that policy.
+ *
+ * \param[in,out] multi_asset A pointer to an initialized \ref cardano_multi_asset_t object.
+ *                            This object will be modified to include the new assets under the specified policy ID.
+ *                            The pointer must not be NULL.
+ * \param[in] policy_id A pointer to an initialized \ref cardano_blake2b_hash_t object representing the policy ID
+ *                      under which the assets are grouped. The pointer must not be NULL.
+ * \param[in] assets A pointer to an initialized \ref cardano_asset_name_map_t object containing the asset names
+ *                   and their corresponding quantities to be inserted. The pointer must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the assets
+ *         were successfully inserted, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \remark If the key already exists in the multi asset, the value associated with the policy id will be updated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_asset_t* multi_asset = cardano_multi_asset_new(...); // Assume multi_asset is already initialized
+ * cardano_blake2b_hash_t* policy_id = cardano_blake2b_hash_new(...); // Assume policy_id is initialized
+ * cardano_asset_name_map_t* assets = cardano_asset_name_map_new(...); // Assume assets are prepared
+ *
+ * // Populate assets map
+ * cardano_asset_name_t* asset_name = ...; // Assume asset_name is initialized
+ * uint64_t quantity = 1000;
+ * cardano_asset_name_map_insert(assets, asset_name, quantity);
+ *
+ * cardano_error_t result = cardano_multi_asset_insert_assets(multi_asset, policy_id, assets);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Assets successfully inserted under the policy ID.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to insert assets: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources
+ * cardano_multi_asset_unref(&multi_asset);
+ * cardano_blake2b_hash_unref(&policy_id);
+ * cardano_asset_name_map_unref(&assets);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_insert_assets(
+  cardano_multi_asset_t*    multi_asset,
+  cardano_blake2b_hash_t*   policy_id,
+  cardano_asset_name_map_t* assets);
+
+/**
+ * \brief Retrieves assets grouped under a specific policy ID from a multi-asset container.
+ *
+ * This function fetches the collection of assets associated with a given policy ID from a \ref cardano_multi_asset_t object.
+ * It returns a map of asset names to their quantities.
+ *
+ * \param[in] multi_asset A constant pointer to an initialized \ref cardano_multi_asset_t object.
+ *                        This object is queried to extract the assets associated with the specified policy ID.
+ *                        The pointer must not be NULL.
+ * \param[in] policy_id A pointer to an initialized \ref cardano_blake2b_hash_t object representing the policy ID
+ *                      under which the assets are grouped. The pointer must not be NULL.
+ * \param[out] assets On successful retrieval, this parameter will point to an initialized \ref cardano_asset_name_map_t object
+ *                    containing the asset names and their corresponding quantities under the given policy ID.
+ *                    The caller is responsible for managing the lifecycle of this object,
+ *                    specifically, once the assets map is no longer needed, the caller must release it
+ *                    by calling \ref cardano_asset_name_map_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the assets
+ *         were successfully retrieved, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the specified policy ID does not exist in the multi-asset container.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_multi_asset_t* multi_asset = ...; // Assume multi_asset is already initialized
+ * cardano_blake2b_hash_t* policy_id = cardano_blake2b_hash_new(...); // Assume policy_id is initialized
+ * cardano_asset_name_map_t* assets = NULL;
+ *
+ * cardano_error_t result = cardano_multi_asset_get_assets(multi_asset, policy_id, &assets);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the retrieved assets
+ *   // Iterate over assets map, access names and quantities
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve assets: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources
+ * if (assets)
+ * {
+ *   cardano_asset_name_map_unref(&assets);
+ * }
+ *
+ * cardano_blake2b_hash_unref(&policy_id);
+ * cardano_multi_asset_unref(&multi_asset);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_get_assets(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_blake2b_hash_t*      policy_id,
+  cardano_asset_name_map_t**   assets);
+
+/**
+ * \brief Retrieves the quantity of a specific asset identified by a policy ID and asset name from a multi-asset container.
+ *
+ * This function fetches the quantity of an asset based on its policy ID and asset name from a \ref cardano_multi_asset_t object.
+ * It provides a direct method to access the quantity of a specified asset within the broader multi-asset structure.
+ *
+ * \param[in] multi_asset A constant pointer to an initialized \ref cardano_multi_asset_t object from which the asset's quantity is to be retrieved.
+ *                        The pointer must not be NULL.
+ * \param[in] policy_id A pointer to an initialized \ref cardano_blake2b_hash_t object representing the policy ID under which the asset is grouped.
+ *                      The pointer must not be NULL.
+ * \param[in] asset A pointer to an initialized \ref cardano_asset_name_t object representing the name of the asset.
+ *                  The pointer must not be NULL.
+ * \param[out] value On successful retrieval, this will contain the quantity of the asset. The value is represented as a signed 64-bit integer,
+ *                   which accounts for possible negative quantities due to burning or other operations affecting asset balance.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the asset quantity was successfully retrieved,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL,
+ *         or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if either the specified policy ID or asset name does not exist within the multi-asset container.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_multi_asset_t* multi_asset = ...; // Assume multi_asset is already initialized
+ * cardano_blake2b_hash_t* policy_id = cardano_blake2b_hash_new(...); // Assume policy_id is initialized
+ * cardano_asset_name_t* asset = cardano_asset_name_new(...); // Assume asset is initialized
+ * int64_t value = 0;
+ *
+ * cardano_error_t result = cardano_multi_asset_get(multi_asset, policy_id, asset, &value);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Asset quantity: %ld\n", value);
+ *   // Process the retrieved asset quantity
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve asset quantity: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources
+ * cardano_blake2b_hash_unref(&policy_id);
+ * cardano_asset_name_unref(&asset);
+ * cardano_multi_asset_unref(&multi_asset);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_get(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_blake2b_hash_t*      policy_id,
+  cardano_asset_name_t*        asset,
+  int64_t*                     value);
+
+/**
+ * \brief Retrieves the amount associated with a specific asset ID from a multi-asset object.
+ *
+ * The `cardano_multi_asset_get_with_id` function allows you to retrieve the amount of a specific asset within
+ * a \ref cardano_multi_asset_t object by providing the asset’s unique identifier.
+ *
+ * \param[in] multi_asset A pointer to the \ref cardano_multi_asset_t object from which to retrieve the asset amount.
+ * \param[in] id A pointer to the \ref cardano_asset_id_t representing the unique identifier of the asset.
+ * \param[out] value A pointer to an int64_t where the amount of the specified asset will be stored if it exists.
+ *                   If the asset is not present, the function will store zero in this location.
+ *
+ * \return \ref CARDANO_SUCCESS if the amount was successfully retrieved or zeroed out if the asset is absent,
+ *         or an appropriate error code indicating failure (e.g., if the asset ID is invalid).
+ *
+ * \note This function does not modify the `multi_asset` object but requires a valid, non-null `id` and `value` pointer.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_multi_asset_t* multi_asset = ...;  // Multi-asset object containing various assets
+ * cardano_asset_id_t* asset_id = ...;              // The asset ID of the asset to retrieve
+ * int64_t amount = 0;
+ *
+ * cardano_error_t result = cardano_multi_asset_get_with_id(multi_asset, asset_id, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // 'amount' now holds the quantity of the specified asset, or zero if not present
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_get_with_id(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_asset_id_t*          id,
+  int64_t*                     value);
+
+/**
+ * \brief Sets the quantity of a specific asset identified by a policy ID and asset name in a multi-asset container.
+ *
+ * This function sets or updates the quantity of an asset within a \ref cardano_multi_asset_t object based on its policy ID and asset name.
+ * It allows the manipulation of asset quantities, such as issuing new assets or adjusting existing quantities.
+ *
+ * \param[in] multi_asset A constant pointer to an initialized \ref cardano_multi_asset_t object to which the asset's quantity will be set or updated.
+ *                        The pointer must not be NULL.
+ * \param[in] policy_id A pointer to an initialized \ref cardano_blake2b_hash_t object representing the policy ID under which the asset is grouped.
+ *                      The pointer must not be NULL.
+ * \param[in] asset A pointer to an initialized \ref cardano_asset_name_t object representing the name of the asset.
+ *                  The pointer must not be NULL.
+ * \param[in] value The new quantity for the asset. This is a signed 64-bit integer, allowing for the subtraction or addition of asset quantities.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the asset quantity was successfully set,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL,
+ *         or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if either the specified policy ID or asset name does not exist within the multi-asset container.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_asset_t* multi_asset = ...; // Assume multi_asset is already initialized
+ * cardano_blake2b_hash_t* policy_id = cardano_blake2b_hash_new(...); // Assume policy_id is initialized
+ * cardano_asset_name_t* asset = cardano_asset_name_new(...); // Assume asset is initialized
+ * int64_t new_quantity = 1000; // Define a new quantity for the asset
+ *
+ * cardano_error_t result = cardano_multi_asset_set(multi_asset, policy_id, asset, new_quantity);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Asset quantity set successfully.\n");
+ *   // Continue processing with the updated asset quantity
+ * }
+ * else
+ * {
+ *   printf("Failed to set asset quantity: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources
+ * cardano_blake2b_hash_unref(&policy_id);
+ * cardano_asset_name_unref(&asset);
+ * cardano_multi_asset_unref(&multi_asset);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_set(
+  cardano_multi_asset_t*  multi_asset,
+  cardano_blake2b_hash_t* policy_id,
+  cardano_asset_name_t*   asset,
+  int64_t                 value);
+
+/**
+ * \brief Retrieves a list of all policy IDs from a multi-asset container.
+ *
+ * This function extracts all policy IDs (keys) from a given \ref cardano_multi_asset_t object and stores them in a list.
+ * Each policy ID corresponds to a distinct set of assets grouped under that policy within the multi-asset structure.
+ *
+ * \param[in] multi_asset A constant pointer to an initialized \ref cardano_multi_asset_t object from which the policy IDs are to be retrieved.
+ *                        The pointer must not be NULL.
+ * \param[out] keys On successful execution, this will point to a newly created \ref cardano_policy_id_list_t object containing all the policy IDs.
+ *                  The list is dynamically allocated and must be freed by the caller using \ref cardano_policy_id_list_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the policy IDs were successfully retrieved,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the multi_asset pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_multi_asset_t* multi_asset = ...; // Assume multi_asset is already initialized
+ * cardano_policy_id_list_t* policy_ids = NULL;
+ *
+ * cardano_error_t result = cardano_multi_asset_get_keys(multi_asset, &policy_ids);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Policy IDs retrieved successfully.\n");
+ *   // Process the list of policy IDs
+ *   cardano_policy_id_list_unref(&policy_ids);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve policy IDs: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_get_keys(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_policy_id_list_t**   keys);
+
+/**
+ * \brief Combines two multi-asset containers by adding the quantities of assets under each policy.
+ *
+ * This function adds the assets from two \ref cardano_multi_asset_t objects. It combines the quantities
+ * of assets under each policy ID. If a policy ID exists in both objects, the assets under that policy are summed.
+ * If a policy ID exists in only one of the objects, the assets under that policy are copied to the result.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_multi_asset_t object.
+ * \param[in] rhs A constant pointer to the second \ref cardano_multi_asset_t object.
+ * \param[out] result On successful execution, this will point to a newly created \ref cardano_multi_asset_t object
+ *             that represents the combined result of both input multi-asset containers.
+ *             The result is dynamically allocated and must be freed by the caller using \ref cardano_multi_asset_unref
+ *             when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the assets were
+ *         successfully combined, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_multi_asset_t* lhs = ...; // Assume lhs is already initialized with some assets
+ * const cardano_multi_asset_t* rhs = ...; // Assume rhs is also initialized with some assets
+ * cardano_multi_asset_t* result = NULL;
+ *
+ * cardano_error_t add_result = cardano_multi_asset_add(lhs, rhs, &result);
+ * if (add_result == CARDANO_SUCCESS)
+ * {
+ *   // The assets have been successfully combined
+ *   // Use the result
+ *   cardano_multi_asset_unref(&result);
+ * }
+ * else
+ * {
+ *   printf("Failed to combine assets: %s\n", cardano_error_to_string(add_result));
+ * }
+ *
+ * cardano_multi_asset_unref(&lhs);
+ * cardano_multi_asset_unref(&rhs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_add(
+  const cardano_multi_asset_t* lhs,
+  const cardano_multi_asset_t* rhs,
+  cardano_multi_asset_t**      result);
+
+/**
+ * \brief Subtracts the quantities of assets under each policy from one multi-asset container to another.
+ *
+ * This function subtracts the assets from the second \ref cardano_multi_asset_t object (rhs) from the first
+ * \ref cardano_multi_asset_t object (lhs). It subtracts the quantities of assets under each policy ID present
+ * in both objects. If a policy ID exists only in the rhs, the value is copied as negative, effectively subtracting
+ * it from the lhs. If a policy ID exists only in the lhs, the value is copied as is to the result.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_multi_asset_t object from which assets will be subtracted.
+ * \param[in] rhs A constant pointer to the second \ref cardano_multi_asset_t object that provides the quantities to subtract.
+ * \param[out] result On successful execution, this will point to a newly created \ref cardano_multi_asset_t object
+ *             that represents the result of the subtraction.
+ *             The result is dynamically allocated and must be freed by the caller using \ref cardano_multi_asset_unref
+ *             when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the assets were
+ *         successfully subtracted, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_multi_asset_t* lhs = ...; // Assume lhs is already initialized with some assets
+ * const cardano_multi_asset_t* rhs = ...; // Assume rhs is also initialized with some assets to subtract
+ * cardano_multi_asset_t* result = NULL;
+ *
+ * cardano_error_t subtract_result = cardano_multi_asset_subtract(lhs, rhs, &result);
+ * if (subtract_result == CARDANO_SUCCESS)
+ * {
+ *   // The assets have been successfully subtracted
+ *   // Use the result
+ *   cardano_multi_asset_unref(&result);
+ * }
+ * else
+ * {
+ *   printf("Failed to subtract assets: %s\n", cardano_error_to_string(subtract_result));
+ * }
+ *
+ * cardano_multi_asset_unref(&lhs);
+ * cardano_multi_asset_unref(&rhs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_subtract(
+  const cardano_multi_asset_t* lhs,
+  const cardano_multi_asset_t* rhs,
+  cardano_multi_asset_t**      result);
+
+/**
+ * \brief Retrieves a multi-asset containing only assets with positive quantities from the given multi-asset.
+ *
+ * This function filters the provided \ref cardano_multi_asset_t object and creates a new multi-asset that includes
+ * only those assets whose quantities are positive (greater than zero). Assets with zero or negative quantities are
+ * excluded from the result.
+ *
+ * \param[in] multi_asset A pointer to an initialized \ref cardano_multi_asset_t object from which to extract assets with positive quantities.
+ *                The pointer must not be NULL.
+ * \param[out] result On successful execution, this will point to a newly created \ref cardano_multi_asset_t object
+ *             containing only the assets with positive quantities from the input multi-asset.
+ *             The result is dynamically allocated and must be freed by the caller using \ref cardano_multi_asset_unref
+ *             when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was
+ *         successful, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_asset_t* multi_asset = ...; // Assume lhs is already initialized with some assets
+ * cardano_multi_asset_t* positive_assets = NULL;
+ *
+ * cardano_error_t result = cardano_multi_asset_get_positive(multi_asset, &positive_assets);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // positive_assets now contains only assets with positive quantities
+ *   // Use positive_assets as needed
+ *
+ *   // When done, release the positive_assets
+ *   cardano_multi_asset_unref(&positive_assets);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve positive assets: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_get_positive(
+  cardano_multi_asset_t*  multi_asset,
+  cardano_multi_asset_t** result);
+
+/**
+ * \brief Retrieves a multi-asset containing only assets with negative quantities from the given multi-asset.
+ *
+ * This function filters the provided \ref cardano_multi_asset_t object and creates a new multi-asset that includes
+ * only those assets whose quantities are negative (less than zero). Assets with zero or positive quantities are
+ * excluded from the result.
+ *
+ * \param[in] multi_asset A pointer to an initialized \ref cardano_multi_asset_t object from which to extract assets with negative quantities.
+ *                        The pointer must not be NULL.
+ * \param[out] result On successful execution, this will point to a newly created \ref cardano_multi_asset_t object
+ *             containing only the assets with negative quantities from the input multi-asset.
+ *             The result is dynamically allocated and must be freed by the caller using \ref cardano_multi_asset_unref
+ *             when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was
+ *         successful, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_asset_t* multi_asset = ...; // Assume multi_asset is already initialized with some assets
+ * cardano_multi_asset_t* negative_assets = NULL;
+ *
+ * cardano_error_t result = cardano_multi_asset_get_negative(multi_asset, &negative_assets);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // negative_assets now contains only assets with negative quantities
+ *   // Use negative_assets as needed
+ *
+ *   // When done, release the negative_assets
+ *   cardano_multi_asset_unref(&negative_assets);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve negative assets: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_asset_get_negative(
+  cardano_multi_asset_t*  multi_asset,
+  cardano_multi_asset_t** result);
+
+/**
+ * \brief Compares two multi asset objects for equality.
+ *
+ * This function compares two multi_asset objects to determine if they are equal.
+ *
+ * \param[in] lhs Pointer to the first multi asset object.
+ * \param[in] rhs Pointer to the second multi asset object.
+ *
+ * \return \c true if the multi asset objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_asset_t* multi_asset1 = NULL;
+ * cardano_multi_asset_t* multi_asset2 = NULL;
+ *
+ * // Assume multi_asset1 and multi_asset2 are initialized properly
+ *
+ * bool are_equal = cardano_multi_asset_equals(multi_asset1, multi_asset2);
+ *
+ * if (are_equal)
+ * {
+ *   printf("The multi_asset objects are equal.\n");
+ * }
+ * else
+ * {
+ *   printf("The multi_asset objects are not equal.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_multi_asset_unref(&multi_asset1);
+ * cardano_multi_asset_unref(&multi_asset2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool
+cardano_multi_asset_equals(const cardano_multi_asset_t* lhs, const cardano_multi_asset_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a cardano_multi_asset_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_multi_asset_t object
+ * by decreasing its reference count. When the reference count reaches zero, the multi_asset is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] multi_asset A pointer to the pointer of the multi_asset object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_asset_t* multi_asset = cardano_multi_asset_new(major, minor);
+ *
+ * // Perform operations with the multi_asset...
+ *
+ * cardano_multi_asset_unref(&multi_asset);
+ * // At this point, multi_asset is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_multi_asset_unref, the pointer to the \ref cardano_multi_asset_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_multi_asset_unref(cardano_multi_asset_t** multi_asset);
+
+/**
+ * \brief Increases the reference count of the cardano_multi_asset_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_multi_asset_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_multi_asset_unref.
+ *
+ * \param multi_asset A pointer to the cardano_multi_asset_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming multi_asset is a previously created multi_asset object
+ *
+ * cardano_multi_asset_ref(multi_asset);
+ *
+ * // Now multi_asset can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_multi_asset_ref there is a corresponding
+ * call to \ref cardano_multi_asset_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_multi_asset_ref(cardano_multi_asset_t* multi_asset);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_multi_asset_t object.
+ *
+ * This function returns the number of active references to an cardano_multi_asset_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_multi_asset_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param multi_asset A pointer to the cardano_multi_asset_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_multi_asset_t object. If the object
+ * is properly managed (i.e., every \ref cardano_multi_asset_ref call is matched with a
+ * \ref cardano_multi_asset_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming multi_asset is a previously created multi_asset object
+ *
+ * size_t ref_count = cardano_multi_asset_refcount(multi_asset);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_multi_asset_refcount(const cardano_multi_asset_t* multi_asset);
+
+/**
+ * \brief Sets the last error message for a given cardano_multi_asset_t object.
+ *
+ * Records an error message in the multi_asset's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] multi_asset A pointer to the \ref cardano_multi_asset_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the multi_asset's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_multi_asset_set_last_error(
+  cardano_multi_asset_t* multi_asset,
+  const char*            message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific multi_asset.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_multi_asset_set_last_error for the given
+ * multi_asset. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] multi_asset A pointer to the \ref cardano_multi_asset_t instance whose last error
+ *                   message is to be retrieved. If the multi_asset is NULL, the function
+ *                   returns a generic error message indicating the null multi_asset.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified multi_asset. If the multi_asset is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_multi_asset_set_last_error for the same multi_asset, or until
+ *       the multi_asset is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_multi_asset_get_last_error(
+  const cardano_multi_asset_t* multi_asset);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_multi_asset_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_multi_asset_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_multi_asset_deep_clone(const cardano_multi_asset_t* source, cardano_multi_asset_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_MULTI_ASSET_H
diff --git a/vendor/include/cardano/assets/policy_id_list.h b/vendor/include/cardano/assets/policy_id_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/assets/policy_id_list.h
@@ -0,0 +1,333 @@
+/**
+ * \file policy_id_list.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_POLICY_ID_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_POLICY_ID_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a script hash.
+ */
+typedef struct cardano_blake2b_hash_t cardano_blake2b_hash_t;
+
+/**
+ * \brief Represents a list of reward address.
+ */
+typedef struct cardano_policy_id_list_t cardano_policy_id_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a policy_id_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_policy_id_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] policy_id_list On successful initialization, this will point to a newly created
+ *             \ref cardano_policy_id_list_t object. This object represents a "strong reference"
+ *             to the policy_id_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the policy_id_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_policy_id_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the policy_id_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_policy_id_list_t* policy_id_list = NULL;
+ *
+ * // Attempt to create a new policy_id_list
+ * cardano_error_t result = cardano_policy_id_list_new(&policy_id_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the policy_id_list
+ *
+ *   // Once done, ensure to clean up and release the policy_id_list
+ *   cardano_policy_id_list_unref(&policy_id_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_policy_id_list_new(cardano_policy_id_list_t** policy_id_list);
+
+/**
+ * \brief Retrieves the length of a policy id list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_policy_id_list_t object.
+ *
+ * \param[in] policy_id_list A constant pointer to the \ref cardano_policy_id_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the policy_id_list. Return 0 if the policy_id_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_policy_id_list_t* policy_id_list = cardano_policy_id_list_new();
+ *
+ * // Populate policy_id_list with elements
+ *
+ * size_t length = cardano_policy_id_list_get_length(policy_id_list);
+ * printf("Length of the policy_id_list: %zu\n", length);
+ *
+ * // Clean up the policy_id_list object once done
+ * cardano_policy_id_list_unref(&policy_id_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_policy_id_list_get_length(const cardano_policy_id_list_t* policy_id_list);
+
+/**
+ * \brief Retrieves an element from a policy id list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_policy_id_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] policy_id_list A constant pointer to the \ref cardano_policy_id_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the policy id list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_blake2b_hash_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_policy_id_list_t* policy_id_list = cardano_policy_id_list_new();
+ *
+ * // Populate policy_id_list with elements
+ *
+ * cardano_blake2b_hash_t* element = NULL;
+ * cardano_error_t result = cardano_policy_id_list_get(policy_id_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_blake2b_hash_unref(&element);
+ * }
+ *
+ * // Clean up the policy_id_list object once done
+ * cardano_policy_id_list_unref(&policy_id_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_policy_id_list_get(const cardano_policy_id_list_t* policy_id_list, size_t index, cardano_blake2b_hash_t** element);
+
+/**
+ * \brief Adds an element to a policy id list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_policy_id_list_t object.
+ *
+ * \param[in] policy_id_list A constant pointer to the \ref cardano_policy_id_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_blake2b_hash_t object that is to be added to the policy_id_list.
+ *                    The element will be referenced by the policy_id_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the policy_id_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_policy_id_list_t* policy_id_list = cardano_policy_id_list_new();
+ *
+ * // Create and initialize a new reward address element
+ * cardano_blake2b_hash_t* element = { ... };
+ *
+ * // Add the element to the policy_id_list
+ * cardano_error_t result = cardano_policy_id_list_add(policy_id_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the policy_id_list object once done
+ * cardano_policy_id_list_unref(&policy_id_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_policy_id_list_add(cardano_policy_id_list_t* policy_id_list, cardano_blake2b_hash_t* element);
+
+/**
+ * \brief Decrements the reference count of a policy_id_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_policy_id_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the policy_id_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] policy_id_list A pointer to the pointer of the policy_id_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_policy_id_list_t* policy_id_list = cardano_policy_id_list_new();
+ *
+ * // Perform operations with the policy_id_list...
+ *
+ * cardano_policy_id_list_unref(&policy_id_list);
+ * // At this point, policy_id_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_policy_id_list_unref, the pointer to the \ref cardano_policy_id_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_policy_id_list_unref(cardano_policy_id_list_t** policy_id_list);
+
+/**
+ * \brief Increases the reference count of the cardano_policy_id_list_t object.
+ *
+ * This function is used to manually increment the reference count of a policy_id_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_policy_id_list_unref.
+ *
+ * \param policy_id_list A pointer to the policy_id_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming policy_id_list is a previously created policy_id_list object
+ *
+ * cardano_policy_id_list_ref(policy_id_list);
+ *
+ * // Now policy_id_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_policy_id_list_ref there is a corresponding
+ * call to \ref cardano_policy_id_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_policy_id_list_ref(cardano_policy_id_list_t* policy_id_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_policy_id_list_t object.
+ *
+ * This function returns the number of active references to a policy_id_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_policy_id_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param policy_id_list A pointer to the policy_id_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified policy_id_list object. If the object
+ * is properly managed (i.e., every \ref cardano_policy_id_list_ref call is matched with a
+ * \ref cardano_policy_id_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming policy_id_list is a previously created policy_id_list object
+ *
+ * size_t ref_count = cardano_policy_id_list_refcount(policy_id_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_policy_id_list_refcount(const cardano_policy_id_list_t* policy_id_list);
+
+/**
+ * \brief Sets the last error message for a given policy_id_list object.
+ *
+ * Records an error message in the policy_id_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] policy_id_list A pointer to the \ref cardano_policy_id_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the policy_id_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_policy_id_list_set_last_error(cardano_policy_id_list_t* policy_id_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific policy_id_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_policy_id_list_set_last_error for the given
+ * policy_id_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] policy_id_list A pointer to the \ref cardano_policy_id_list_t instance whose last error
+ *                   message is to be retrieved. If the policy_id_list is NULL, the function
+ *                   returns a generic error message indicating the null policy_id_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified policy_id_list. If the policy_id_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_policy_id_list_set_last_error for the same policy_id_list, or until
+ *       the policy_id_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_policy_id_list_get_last_error(const cardano_policy_id_list_t* policy_id_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_policy_id_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_policy_id_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_policy_id_list_deep_clone(const cardano_policy_id_list_t* source, cardano_policy_id_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_POLICY_ID_LIST_H
diff --git a/vendor/include/cardano/auxiliary_data/auxiliary_data.h b/vendor/include/cardano/auxiliary_data/auxiliary_data.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/auxiliary_data/auxiliary_data.h
@@ -0,0 +1,953 @@
+/**
+ * \file auxiliary_data.h
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_AUXILIARY_DATA_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_AUXILIARY_DATA_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/plutus_v1_script_list.h>
+#include <cardano/auxiliary_data/plutus_v2_script_list.h>
+#include <cardano/auxiliary_data/plutus_v3_script_list.h>
+#include <cardano/auxiliary_data/plutus_v4_script_list.h>
+#include <cardano/auxiliary_data/transaction_metadata.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/scripts/native_scripts/native_script_list.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Auxiliary Data encapsulate certain optional information that can be attached
+ * to a transaction. This data includes transaction metadata and scripts.
+ *
+ * The Auxiliary Data is hashed and referenced in the transaction body.
+ */
+typedef struct cardano_auxiliary_data_t cardano_auxiliary_data_t;
+
+/**
+ * \brief Creates a new, empty auxiliary data object.
+ *
+ * This function allocates and initializes a new \ref cardano_auxiliary_data_t object, which can be used to
+ * hold transaction metadata or scripts that are included as auxiliary data in a Cardano transaction.
+ *
+ * \param[out] auxiliary_data A pointer to a location where the newly created \ref cardano_auxiliary_data_t
+ *                            object will be stored. This parameter must not be NULL. On success, \p *auxiliary_data
+ *                            will point to the newly created auxiliary data object.
+ *
+ * \return \ref CARDANO_SUCCESS if the auxiliary data object was successfully created, or an appropriate
+ *         error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         \p auxiliary_data pointer is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if memory allocation failed.
+ *
+ * \note The caller is responsible for managing the lifecycle of the created auxiliary data object.
+ *       When the auxiliary data object is no longer needed, the caller must release it by calling
+ *       \ref cardano_auxiliary_data_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ *
+ * cardano_auxiliary_data_t* auxiliary_data = NULL;
+ * cardano_error_t result = cardano_auxiliary_data_new(&transaction_output);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the auxiliary data
+ *   // Free resources when done
+ *   cardano_auxiliary_data_unref(&transaction_output);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the auxiliary data: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auxiliary_data_new(cardano_auxiliary_data_t** auxiliary_data);
+
+/**
+ * \brief Creates a \ref cardano_auxiliary_data_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_auxiliary_data_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a auxiliary_data.
+ *
+ * Tagged auxiliary-data maps must not contain duplicate field keys.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] auxiliary_data A pointer to a pointer of \ref cardano_auxiliary_data_t that will be set to the address
+ *                        of the newly created auxiliary_data object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the auxiliary data were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_auxiliary_data_t object by calling
+ *       \ref cardano_auxiliary_data_unref when it is no longer needed.
+ *
+ * \remark In Cardano, transactions are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical transaction representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the auxiliary data hash and invalidate any existing signatures.
+ *         To prevent this, when a transaction auxiliary data object is created using \ref cardano_auxiliary_data_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_auxiliary_data_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_auxiliary_data_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_auxiliary_data_t* auxiliary_data = NULL;
+ *
+ * cardano_error_t result = cardano_auxiliary_data_from_cbor(reader, &auxiliary_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the auxiliary_data
+ *
+ *   // Once done, ensure to clean up and release the auxiliary_data
+ *   cardano_auxiliary_data_unref(&auxiliary_data);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode auxiliary_data: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auxiliary_data_from_cbor(cardano_cbor_reader_t* reader, cardano_auxiliary_data_t** auxiliary_data);
+
+/**
+ * \brief Serializes auxiliary data into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_auxiliary_data_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] auxiliary_data A constant pointer to the \ref cardano_auxiliary_data_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p auxiliary_data or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark If the auxiliary data object was created by \ref cardano_auxiliary_data_from_cbor, the original CBOR encoding
+ *         will be cached and reused by this function to prevent round-trip encoding issues that can change the auxiliary data hash
+ *         and invalidate signatures.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_auxiliary_data_to_cbor(auxiliary_data, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_auxiliary_data_unref(&auxiliary_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_auxiliary_data_to_cbor(
+  const cardano_auxiliary_data_t* auxiliary_data,
+  cardano_cbor_writer_t*          writer);
+
+/**
+ * \brief Serializes auxiliary data to CIP-116 JSON.
+ *
+ * This function writes a JSON object representing the auxiliary data using the
+ * CIP-116 shapes for each component:
+ *
+ * - **metadata**: an array of `{ "key": "<decimal label>", "value": <TransactionMetadatum> }`
+ *   entries, where each value is encoded via \ref cardano_metadatum_to_cip116_json.
+ * - **native_scripts**: an array of CIP-116 NativeScript objects, encoded via
+ *   \ref cardano_native_script_list_to_cip116_json.
+ * - **plutus_scripts**: an array of Plutus script objects, each shaped as
+ *   `{ "language": "plutus_v1", "bytes": "<hex>" }` for Plutus v1 scripts
+ *   (encoded via \ref cardano_plutus_v1_script_list_to_cip116_json).
+ *
+ * The function writes the enclosing `{}` object. Properties that are not present
+ * (i.e., corresponding list or map is NULL or empty) are omitted.
+ *
+ * \param[in] auxiliary_data A valid pointer to a \ref cardano_auxiliary_data_t instance.
+ * \param[in] writer         A valid pointer to a \ref cardano_json_writer_t positioned
+ *                           where a JSON value is expected.
+ *
+ * \return \ref CARDANO_SUCCESS on success; an appropriate error code otherwise (e.g.,
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL for invalid arguments, or a downstream
+ *         serialization error).
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auxiliary_data_to_cip116_json(
+  const cardano_auxiliary_data_t* auxiliary_data,
+  cardano_json_writer_t*          writer);
+
+/**
+ * \brief Retrieves the transaction metadata from an auxiliary data object.
+ *
+ * This function extracts the transaction metadata from a given \ref cardano_auxiliary_data_t object.
+ *
+ * \param[in] auxiliary_data A pointer to an initialized \ref cardano_auxiliary_data_t object from which to retrieve the transaction metadata.
+ *                           This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_transaction_metadata_t object containing the transaction metadata.
+ *         If the auxiliary data does not contain any transaction metadata, the function returns \c NULL.
+ *         The returned object is a new reference, and the caller is responsible for managing its lifecycle.
+ *         Specifically, the caller must release it by calling \ref cardano_transaction_metadata_unref when it is no longer needed.
+ *
+ * \note The transaction metadata is optional in an auxiliary data object. Always check the returned pointer for \c NULL before using it.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume auxiliary_data is already initialized and may contain metadata
+ * cardano_auxiliary_data_t* auxiliary_data = ...;
+ *
+ * // Retrieve the transaction metadata
+ * cardano_transaction_metadata_t* metadata = cardano_auxiliary_data_get_transaction_metadata(auxiliary_data);
+ *
+ * if (metadata != NULL)
+ * {
+ *   // Process the metadata
+ *   // Release the metadata object when done
+ *   cardano_transaction_metadata_unref(&metadata);
+ * }
+ * else
+ * {
+ *   printf("No transaction metadata present in the auxiliary data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_metadata_t* cardano_auxiliary_data_get_transaction_metadata(cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Sets or unsets the transaction metadata for an auxiliary data object.
+ *
+ * This function assigns the specified transaction metadata to a given \ref cardano_auxiliary_data_t object.
+ * If the \p metadata parameter is `NULL`, it will remove any existing transaction metadata from the auxiliary data.
+ *
+ * \param[in,out] auxiliary_data A pointer to an initialized \ref cardano_auxiliary_data_t object
+ *                               to which the transaction metadata will be set or unset. This parameter must not be `NULL`.
+ * \param[in] metadata A pointer to an initialized \ref cardano_transaction_metadata_t object containing the metadata
+ *                     to be associated with the auxiliary data, or `NULL` to unset the metadata.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the metadata
+ *         was successfully set or unset, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p auxiliary_data pointer is `NULL`.
+ *
+ * \note If \p metadata is not `NULL`, this function increases the reference count of the \p metadata object, meaning that the caller retains
+ *       ownership of their reference and is responsible for managing its lifecycle. The caller must ensure that
+ *       the \ref cardano_transaction_metadata_unref function is called when the \p metadata object is no longer needed.
+ *       If \p metadata is `NULL`, any existing metadata in the auxiliary data will be removed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume auxiliary_data and metadata are already initialized
+ * cardano_auxiliary_data_t* auxiliary_data = ...;
+ * cardano_transaction_metadata_t* metadata = ...;
+ *
+ * // Set the transaction metadata for the auxiliary data object
+ * cardano_error_t result = cardano_auxiliary_data_set_transaction_metadata(auxiliary_data, metadata);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Transaction metadata successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set transaction metadata: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Unset the transaction metadata by passing NULL
+ * result = cardano_auxiliary_data_set_transaction_metadata(auxiliary_data, NULL);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Transaction metadata successfully unset.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to unset transaction metadata: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auxiliary_data_set_transaction_metadata(cardano_auxiliary_data_t* auxiliary_data, cardano_transaction_metadata_t* metadata);
+
+/**
+ * \brief Retrieves the list of native scripts from auxiliary data.
+ *
+ * This function extracts and returns a list of native scripts from the specified \ref cardano_auxiliary_data_t object.
+ *
+ * \param[in] auxiliary_data A pointer of an initialized \ref cardano_auxiliary_data_t object from which
+ *                           the native scripts will be retrieved. This parameter must not be `NULL`.
+ *
+ * \return A pointer to a \ref cardano_native_script_list_t object representing the list of native scripts. If the auxiliary data
+ *         does not contain any native scripts, this function returns `NULL`. The returned list is a new reference,
+ *         and the caller is responsible for managing its lifecycle. Specifically, the caller must release the list by calling
+ *         \ref cardano_native_script_list_unref when it is no longer needed.
+ *
+ * \note The returned native script list, if present, is a new reference, meaning the caller must manage the memory for this object.
+ *       If the auxiliary data contains no native scripts, the function will return `NULL`, and the caller should handle this case appropriately.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the native scripts were successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Assume initialized
+ * cardano_native_script_list_t* native_scripts = cardano_auxiliary_data_get_native_scripts(auxiliary_data);
+ *
+ * if (native_scripts != NULL)
+ * {
+ *   // Use the native scripts
+ *
+ *   // Ensure to release the native script list when done
+ *   cardano_native_script_list_unref(&native_scripts);
+ * }
+ * else
+ * {
+ *   printf("No native scripts found in auxiliary data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_native_script_list_t* cardano_auxiliary_data_get_native_scripts(cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Sets the list of native scripts in auxiliary data.
+ *
+ * This function assigns a list of native scripts to the specified \ref cardano_auxiliary_data_t object.
+ *
+ * \param[in,out] auxiliary_data A pointer to an initialized \ref cardano_auxiliary_data_t object where the native scripts will be set.
+ * \param[in] scripts A pointer to a \ref cardano_native_script_list_t object representing the list of native scripts to be added.
+ *                    This parameter can be `NULL` to unset the native scripts in the auxiliary data.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the native scripts were
+ *         successfully set, or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any
+ *         required pointers are `NULL`.
+ *
+ * \note If the `scripts` parameter is `NULL`, any existing native scripts in the auxiliary data will be removed.
+ *       The caller is responsible for managing the memory for the `scripts` object; this function will increment
+ *       the reference count of the `scripts` object if provided.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Assume initialized
+ * cardano_native_script_list_t* native_scripts = ...; // Assume native_scripts is initialized
+ *
+ * cardano_error_t result = cardano_auxiliary_data_set_native_scripts(auxiliary_data, native_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Native scripts successfully set in auxiliary data.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set native scripts: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources when done
+ * cardano_native_script_list_unref(&native_scripts);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auxiliary_data_set_native_scripts(cardano_auxiliary_data_t* auxiliary_data, cardano_native_script_list_t* scripts);
+
+/**
+ * \brief Retrieves the list of plutus v1 scripts from auxiliary data.
+ *
+ * This function extracts and returns a list of plutus v1 scripts from the specified \ref cardano_auxiliary_data_t object.
+ *
+ * \param[in] auxiliary_data A pointer of an initialized \ref cardano_auxiliary_data_t object from which
+ *                           the plutus v1 scripts will be retrieved. This parameter must not be `NULL`.
+ *
+ * \return A pointer to a \ref cardano_plutus_v1_script_list_t object representing the list of plutus v1 scripts. If the auxiliary data
+ *         does not contain any plutus v1 scripts, this function returns `NULL`. The returned list is a new reference,
+ *         and the caller is responsible for managing its lifecycle. Specifically, the caller must release the list by calling
+ *         \ref cardano_plutus_v1_script_list_unref when it is no longer needed.
+ *
+ * \note The returned plutus v1 script list, if present, is a new reference, meaning the caller must manage the memory for this object.
+ *       If the auxiliary data contains no plutus v1 scripts, the function will return `NULL`, and the caller should handle this case appropriately.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the plutus v1 scripts were successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Assume initialized
+ * cardano_plutus_v1_script_list_t* plutus_v1_scripts = cardano_auxiliary_data_get_plutus_v1_scripts(auxiliary_data);
+ *
+ * if (plutus_v1_scripts != NULL)
+ * {
+ *   // Use the plutus v1 scripts
+ *
+ *   // Ensure to release the plutus v1 script list when done
+ *   cardano_plutus_v1_script_list_unref(&plutus_v1_scripts);
+ * }
+ * else
+ * {
+ *   printf("No plutus v1 scripts found in auxiliary data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_plutus_v1_script_list_t* cardano_auxiliary_data_get_plutus_v1_scripts(cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Sets the list of plutus v1 scripts in auxiliary data.
+ *
+ * This function assigns a list of plutus v1 scripts to the specified \ref cardano_auxiliary_data_t object.
+ *
+ * \param[in,out] auxiliary_data A pointer to an initialized \ref cardano_auxiliary_data_t object where the plutus v1 scripts will be set.
+ * \param[in] scripts A pointer to a \ref cardano_plutus_v1_script_list_t object representing the list of plutus v1 scripts to be added.
+ *                    This parameter can be `NULL` to unset the plutus v1 scripts in the auxiliary data.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the plutus v1 scripts were
+ *         successfully set, or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any
+ *         required pointers are `NULL`.
+ *
+ * \note If the `scripts` parameter is `NULL`, any existing plutus v1 scripts in the auxiliary data will be removed.
+ *       The caller is responsible for managing the memory for the `scripts` object; this function will increment
+ *       the reference count of the `scripts` object if provided.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Assume initialized
+ * cardano_plutus_v1_script_list_t* plutus_v1_scripts = ...; // Assume plutus_v1_scripts is initialized
+ *
+ * cardano_error_t result = cardano_auxiliary_data_set_plutus_v1_scripts(auxiliary_data, plutus_v1_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Native scripts successfully set in auxiliary data.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set plutus v1 scripts: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources when done
+ * cardano_plutus_v1_script_list_unref(&plutus_v1_scripts);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auxiliary_data_set_plutus_v1_scripts(cardano_auxiliary_data_t* auxiliary_data, cardano_plutus_v1_script_list_t* scripts);
+
+/**
+ * \brief Retrieves the list of plutus v2 scripts from auxiliary data.
+ *
+ * This function extracts and returns a list of plutus v2 scripts from the specified \ref cardano_auxiliary_data_t object.
+ *
+ * \param[in] auxiliary_data A pointer of an initialized \ref cardano_auxiliary_data_t object from which
+ *                           the plutus v2 scripts will be retrieved. This parameter must not be `NULL`.
+ *
+ * \return A pointer to a \ref cardano_plutus_v2_script_list_t object representing the list of plutus v2 scripts. If the auxiliary data
+ *         does not contain any plutus v2 scripts, this function returns `NULL`. The returned list is a new reference,
+ *         and the caller is responsible for managing its lifecycle. Specifically, the caller must release the list by calling
+ *         \ref cardano_plutus_v2_script_list_unref when it is no longer needed.
+ *
+ * \note The returned plutus v2 script list, if present, is a new reference, meaning the caller must manage the memory for this object.
+ *       If the auxiliary data contains no plutus v2 scripts, the function will return `NULL`, and the caller should handle this case appropriately.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the plutus v2 scripts were successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Assume initialized
+ * cardano_plutus_v2_script_list_t* plutus_v2_scripts = cardano_auxiliary_data_get_plutus_v2_scripts(auxiliary_data);
+ *
+ * if (plutus_v2_scripts != NULL)
+ * {
+ *   // Use the plutus v2 scripts
+ *
+ *   // Ensure to release the plutus v2 script list when done
+ *   cardano_plutus_v2_script_list_unref(&plutus_v2_scripts);
+ * }
+ * else
+ * {
+ *   printf("No plutus v2 scripts found in auxiliary data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_plutus_v2_script_list_t* cardano_auxiliary_data_get_plutus_v2_scripts(cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Sets the list of plutus v2 scripts in auxiliary data.
+ *
+ * This function assigns a list of plutus v2 scripts to the specified \ref cardano_auxiliary_data_t object.
+ *
+ * \param[in,out] auxiliary_data A pointer to an initialized \ref cardano_auxiliary_data_t object where the plutus v2 scripts will be set.
+ * \param[in] scripts A pointer to a \ref cardano_plutus_v2_script_list_t object representing the list of plutus v2 scripts to be added.
+ *                    This parameter can be `NULL` to unset the plutus v2 scripts in the auxiliary data.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the plutus v2 scripts were
+ *         successfully set, or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any
+ *         required pointers are `NULL`.
+ *
+ * \note If the `scripts` parameter is `NULL`, any existing plutus v2 scripts in the auxiliary data will be removed.
+ *       The caller is responsible for managing the memory for the `scripts` object; this function will increment
+ *       the reference count of the `scripts` object if provided.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Assume initialized
+ * cardano_plutus_v2_script_list_t* plutus_v2_scripts = ...; // Assume plutus_v2_scripts is initialized
+ *
+ * cardano_error_t result = cardano_auxiliary_data_set_plutus_v2_scripts(auxiliary_data, plutus_v2_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Native scripts successfully set in auxiliary data.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set plutus v2 scripts: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources when done
+ * cardano_plutus_v2_script_list_unref(&plutus_v2_scripts);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auxiliary_data_set_plutus_v2_scripts(cardano_auxiliary_data_t* auxiliary_data, cardano_plutus_v2_script_list_t* scripts);
+
+/**
+ * \brief Retrieves the list of plutus v3 scripts from auxiliary data.
+ *
+ * This function extracts and returns a list of plutus v3 scripts from the specified \ref cardano_auxiliary_data_t object.
+ *
+ * \param[in] auxiliary_data A pointer of an initialized \ref cardano_auxiliary_data_t object from which
+ *                           the plutus v3 scripts will be retrieved. This parameter must not be `NULL`.
+ *
+ * \return A pointer to a \ref cardano_plutus_v3_script_list_t object representing the list of plutus v3 scripts. If the auxiliary data
+ *         does not contain any plutus v3 scripts, this function returns `NULL`. The returned list is a new reference,
+ *         and the caller is responsible for managing its lifecycle. Specifically, the caller must release the list by calling
+ *         \ref cardano_plutus_v3_script_list_unref when it is no longer needed.
+ *
+ * \note The returned plutus v3 script list, if present, is a new reference, meaning the caller must manage the memory for this object.
+ *       If the auxiliary data contains no plutus v3 scripts, the function will return `NULL`, and the caller should handle this case appropriately.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the plutus v3 scripts were successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Assume initialized
+ * cardano_plutus_v3_script_list_t* plutus_v3_scripts = cardano_auxiliary_data_get_plutus_v3_scripts(auxiliary_data);
+ *
+ * if (plutus_v3_scripts != NULL)
+ * {
+ *   // Use the plutus v3 scripts
+ *
+ *   // Ensure to release the plutus v3 script list when done
+ *   cardano_plutus_v3_script_list_unref(&plutus_v3_scripts);
+ * }
+ * else
+ * {
+ *   printf("No plutus v3 scripts found in auxiliary data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_plutus_v3_script_list_t* cardano_auxiliary_data_get_plutus_v3_scripts(cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Sets the list of plutus v3 scripts in auxiliary data.
+ *
+ * This function assigns a list of plutus v3 scripts to the specified \ref cardano_auxiliary_data_t object.
+ *
+ * \param[in,out] auxiliary_data A pointer to an initialized \ref cardano_auxiliary_data_t object where the plutus v3 scripts will be set.
+ * \param[in] scripts A pointer to a \ref cardano_plutus_v3_script_list_t object representing the list of plutus v3 scripts to be added.
+ *                    This parameter can be `NULL` to unset the plutus v3 scripts in the auxiliary data.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the plutus v3 scripts were
+ *         successfully set, or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any
+ *         required pointers are `NULL`.
+ *
+ * \note If the `scripts` parameter is `NULL`, any existing plutus v3 scripts in the auxiliary data will be removed.
+ *       The caller is responsible for managing the memory for the `scripts` object; this function will increment
+ *       the reference count of the `scripts` object if provided.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Assume initialized
+ * cardano_plutus_v3_script_list_t* plutus_v3_scripts = ...; // Assume plutus_v3_scripts is initialized
+ *
+ * cardano_error_t result = cardano_auxiliary_data_set_plutus_v3_scripts(auxiliary_data, plutus_v3_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Native scripts successfully set in auxiliary data.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set plutus v3 scripts: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources when done
+ * cardano_plutus_v3_script_list_unref(&plutus_v3_scripts);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auxiliary_data_set_plutus_v3_scripts(cardano_auxiliary_data_t* auxiliary_data, cardano_plutus_v3_script_list_t* scripts);
+
+/**
+ * \brief Retrieves the list of plutus v4 scripts from auxiliary data.
+ *
+ * This function extracts and returns a list of plutus v4 scripts from the specified \ref cardano_auxiliary_data_t object.
+ *
+ * \param[in] auxiliary_data A pointer of an initialized \ref cardano_auxiliary_data_t object from which
+ *                           the plutus v4 scripts will be retrieved. This parameter must not be `NULL`.
+ *
+ * \return A pointer to a \ref cardano_plutus_v4_script_list_t object representing the list of plutus v4 scripts. If the auxiliary data
+ *         does not contain any plutus v4 scripts, this function returns `NULL`. The returned list is a new reference,
+ *         and the caller is responsible for managing its lifecycle. Specifically, the caller must release the list by calling
+ *         \ref cardano_plutus_v4_script_list_unref when it is no longer needed.
+ *
+ * \note The returned plutus v4 script list, if present, is a new reference, meaning the caller must manage the memory for this object.
+ *       If the auxiliary data contains no plutus v4 scripts, the function will return `NULL`, and the caller should handle this case appropriately.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the plutus v4 scripts were successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Assume initialized
+ * cardano_plutus_v4_script_list_t* plutus_v4_scripts = cardano_auxiliary_data_get_plutus_v4_scripts(auxiliary_data);
+ *
+ * if (plutus_v4_scripts != NULL)
+ * {
+ *   // Use the plutus v4 scripts
+ *
+ *   // Ensure to release the plutus v4 script list when done
+ *   cardano_plutus_v4_script_list_unref(&plutus_v4_scripts);
+ * }
+ * else
+ * {
+ *   printf("No plutus v4 scripts found in auxiliary data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_plutus_v4_script_list_t* cardano_auxiliary_data_get_plutus_v4_scripts(cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Sets the list of plutus v4 scripts in auxiliary data.
+ *
+ * This function assigns a list of plutus v4 scripts to the specified \ref cardano_auxiliary_data_t object.
+ *
+ * \param[in,out] auxiliary_data A pointer to an initialized \ref cardano_auxiliary_data_t object where the plutus v4 scripts will be set.
+ * \param[in] scripts A pointer to a \ref cardano_plutus_v4_script_list_t object representing the list of plutus v4 scripts to be added.
+ *                    This parameter can be `NULL` to unset the plutus v4 scripts in the auxiliary data.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the plutus v4 scripts were
+ *         successfully set, or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any
+ *         required pointers are `NULL`.
+ *
+ * \note If the `scripts` parameter is `NULL`, any existing plutus v4 scripts in the auxiliary data will be removed.
+ *       The caller is responsible for managing the memory for the `scripts` object; this function will increment
+ *       the reference count of the `scripts` object if provided.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Assume initialized
+ * cardano_plutus_v4_script_list_t* plutus_v4_scripts = ...; // Assume plutus_v4_scripts is initialized
+ *
+ * cardano_error_t result = cardano_auxiliary_data_set_plutus_v4_scripts(auxiliary_data, plutus_v4_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Native scripts successfully set in auxiliary data.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set plutus v4 scripts: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources when done
+ * cardano_plutus_v4_script_list_unref(&plutus_v4_scripts);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auxiliary_data_set_plutus_v4_scripts(cardano_auxiliary_data_t* auxiliary_data, cardano_plutus_v4_script_list_t* scripts);
+
+/**
+ * \brief Retrieves the hash of a auxiliary data.
+ *
+ * This function computes and returns the hash of the given \ref cardano_auxiliary_data_t object. The hash is a unique identifier for the auxiliary data.
+ *
+ * \param[in] auxiliary_data A pointer to an initialized \ref cardano_auxiliary_data_t object. The object must be valid and not NULL.
+ *
+ * \return A pointer to a \ref cardano_blake2b_hash_t object representing the auxiliary data hash. The returned object is a new reference, and
+ *         the caller is responsible for releasing it by calling \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *         If the input is NULL, the function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Assume auxiliary_data is already initialized
+ * cardano_blake2b_hash_t* tx_body_hash = cardano_auxiliary_data_get_hash(auxiliary_data);
+ *
+ * if (tx_body_hash != NULL)
+ * {
+ *   // Use the auxiliary data hash for signing or verification
+ *
+ *   // Clean up when done
+ *   cardano_blake2b_hash_unref(&tx_body_hash);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the auxiliary data hash.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_auxiliary_data_get_hash(cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Clears the cached CBOR representation from a auxiliary data.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_auxiliary_data_t object.
+ * It is useful when you have modified the auxiliary data after it was created from CBOR using
+ * \ref cardano_auxiliary_data_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the auxiliary data, rather than using the original cached CBOR.
+ *
+ * \param[in,out] auxiliary_data A pointer to an initialized \ref cardano_auxiliary_data_t object
+ *                                 from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the auxiliary data when
+ *          serialized, which can alter the auxiliary data hash and invalidate any existing signatures.
+ *          Use this function with caution, especially if the transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume auxiliary_data was created using cardano_auxiliary_data_from_cbor
+ * cardano_auxiliary_data_t* auxiliary_data = ...;
+ *
+ * // Modify the auxiliary data as needed
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated auxiliary data
+ * cardano_auxiliary_data_clear_cbor_cache(auxiliary_data);
+ *
+ * // Serialize the auxiliary data to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_auxiliary_data_to_cbor(auxiliary_data, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_auxiliary_data_unref(&auxiliary_data);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_auxiliary_data_clear_cbor_cache(cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Decrements the reference count of a cardano_auxiliary_data_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_auxiliary_data_t object
+ * by decreasing its reference count. When the reference count reaches zero, the auxiliary_data is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] auxiliary_data A pointer to the pointer of the auxiliary_data object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auxiliary_data_t* auxiliary_data = cardano_auxiliary_data_new(major, minor);
+ *
+ * // Perform operations with the auxiliary_data...
+ *
+ * cardano_auxiliary_data_unref(&auxiliary_data);
+ * // At this point, auxiliary_data is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_auxiliary_data_unref, the pointer to the \ref cardano_auxiliary_data_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_auxiliary_data_unref(cardano_auxiliary_data_t** auxiliary_data);
+
+/**
+ * \brief Increases the reference count of the cardano_auxiliary_data_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_auxiliary_data_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_auxiliary_data_unref.
+ *
+ * \param auxiliary_data A pointer to the cardano_auxiliary_data_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming auxiliary_data is a previously created auxiliary_data object
+ *
+ * cardano_auxiliary_data_ref(auxiliary_data);
+ *
+ * // Now auxiliary_data can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_auxiliary_data_ref there is a corresponding
+ * call to \ref cardano_auxiliary_data_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_auxiliary_data_ref(cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_auxiliary_data_t object.
+ *
+ * This function returns the number of active references to an cardano_auxiliary_data_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_auxiliary_data_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param auxiliary_data A pointer to the cardano_auxiliary_data_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_auxiliary_data_t object. If the object
+ * is properly managed (i.e., every \ref cardano_auxiliary_data_ref call is matched with a
+ * \ref cardano_auxiliary_data_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming auxiliary_data is a previously created auxiliary_data object
+ *
+ * size_t ref_count = cardano_auxiliary_data_refcount(auxiliary_data);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_auxiliary_data_refcount(const cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Sets the last error message for a given cardano_auxiliary_data_t object.
+ *
+ * Records an error message in the auxiliary_data's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] auxiliary_data A pointer to the \ref cardano_auxiliary_data_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the auxiliary_data's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_auxiliary_data_set_last_error(
+  cardano_auxiliary_data_t* auxiliary_data,
+  const char*               message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific auxiliary_data.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_auxiliary_data_set_last_error for the given
+ * auxiliary_data. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] auxiliary_data A pointer to the \ref cardano_auxiliary_data_t instance whose last error
+ *                   message is to be retrieved. If the auxiliary_data is NULL, the function
+ *                   returns a generic error message indicating the null auxiliary_data.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified auxiliary_data. If the auxiliary_data is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_auxiliary_data_set_last_error for the same auxiliary_data, or until
+ *       the auxiliary_data is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_auxiliary_data_get_last_error(
+  const cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_auxiliary_data_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_auxiliary_data_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_auxiliary_data_deep_clone(const cardano_auxiliary_data_t* source, cardano_auxiliary_data_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_AUXILIARY_DATA_H
diff --git a/vendor/include/cardano/auxiliary_data/metadatum.h b/vendor/include/cardano/auxiliary_data/metadatum.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/auxiliary_data/metadatum.h
@@ -0,0 +1,1227 @@
+/**
+ * \file metadatum.h
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/metadatum_kind.h>
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/bigint.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of metadatum.
+ */
+typedef struct cardano_metadatum_map_t cardano_metadatum_map_t;
+
+/**
+ * \brief Represents a list of metadatum.
+ */
+typedef struct cardano_metadatum_list_t cardano_metadatum_list_t;
+
+/**
+ * \brief A type corresponding to the metadatum type.
+ *
+ * Use this type to build metadata structures that you want to be representable on-chain.
+ */
+typedef struct cardano_metadatum_t cardano_metadatum_t;
+
+/**
+ * \brief Creates and initializes a new instance of a metadatum from a metadatum_map.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_metadatum_t object
+ * from a given \ref cardano_metadatum_map_t object. It essentially converts a metadatum map
+ * into a metadatum. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] map A pointer to the \ref cardano_metadatum_map_t object from which
+ *                the metadatum will be created.
+ * \param[out] metadatum On successful initialization, this will point to a newly created
+ *             \ref cardano_metadatum_t object. This object represents a "strong reference"
+ *             to the metadatum, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the metadatum is no longer needed, the caller must release it
+ *             by calling \ref cardano_metadatum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_map_t* map = cardano_metadatum_map_new(...);
+ * cardano_metadatum_t* metadatum = NULL;
+ *
+ * // Attempt to create a new metadatum from a metadatum_map
+ * cardano_error_t result = cardano_metadatum_new_map(map, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *
+ *   // Once done, ensure to clean up and release the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ *
+ * // Clean up the metadatum_map object once done
+ * cardano_metadatum_map_unref(&map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_new_map(
+  cardano_metadatum_map_t* map,
+  cardano_metadatum_t**    metadatum);
+
+/**
+ * \brief Creates and initializes a new instance of a metadatum from a metadatum list.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_metadatum_t object
+ * from a given \ref cardano_metadatum_list_t object. It essentially converts a metadatum list
+ * into a metadatum. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] list A pointer to the \ref cardano_metadatum_list_t object from which
+ *                 the metadatum will be created. The object must not be NULL.
+ * \param[out] metadatum On successful initialization, this will point to a newly created
+ *             \ref cardano_metadatum_t object. This object represents a "strong reference"
+ *             to the metadatum, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the metadatum is no longer needed, the caller must release it
+ *             by calling \ref cardano_metadatum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_list_t* list = cardano_metadatum_list_new(...);
+ * cardano_metadatum_t* metadatum = NULL;
+ *
+ * // Attempt to create a new metadatum from a metadatum_list
+ * cardano_error_t result = cardano_metadatum_new_list(list, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *
+ *   // Once done, ensure to clean up and release the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ *
+ * // Clean up the metadatum_list object once done
+ * cardano_metadatum_list_unref(&list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_new_list(
+  cardano_metadatum_list_t* list,
+  cardano_metadatum_t**     metadatum);
+
+/**
+ * \brief Creates and initializes a new instance of metadatum from a bigint object.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_metadatum_t object
+ * from a given bigint object.
+ *
+ * \param[in] bigint A constant pointer to the \ref cardano_bigint_t object from which the metadatum will be created.
+ * \param[out] metadatum On successful initialization, this will point to a newly created
+ *             \ref cardano_metadatum_t object. This object represents a "strong reference"
+ *             to the metadatum, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the metadatum is no longer needed, the caller must release it
+ *             by calling \ref cardano_metadatum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume bigint is already initialized and set to a value
+ * cardano_bigint_t* bigint = ...;
+ * cardano_metadatum_t* metadatum = NULL;
+ *
+ * // Attempt to create a new metadatum from a bigint
+ * cardano_error_t result = cardano_metadatum_new_integer(bigint, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *
+ *   // Once done, ensure to clean up and release the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_new_integer(
+  const cardano_bigint_t* bigint,
+  cardano_metadatum_t**   metadatum);
+
+/**
+ * \brief Creates and initializes a new instance of metadatum from an integer value.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_metadatum_t object
+ * from a given `int64_t` integer. It converts an integer into a metadatum object, suitable
+ * for transactions and other blockchain-related operations. It returns an error code to indicate
+ * the success or failure of the operation.
+ *
+ * \param[in] integer The `int64_t` integer value from which the metadatum will be created.
+ * \param[out] metadatum On successful initialization, this will point to a newly created
+ *             \ref cardano_metadatum_t object. This object represents a "strong reference"
+ *             to the metadatum, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the metadatum is no longer needed, the caller must release it
+ *             by calling \ref cardano_metadatum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * int64_t integer_value = 42; // Example integer value
+ * cardano_metadatum_t* metadatum = NULL;
+ *
+ * // Attempt to create a new metadatum from an integer value
+ * cardano_error_t result = cardano_metadatum_new_integer_from_int(integer_value, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *
+ *   // Once done, ensure to clean up and release the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_new_integer_from_int(
+  int64_t               integer,
+  cardano_metadatum_t** metadatum);
+
+/**
+ * \brief Creates and initializes a new instance of metadatum from an unsigned integer value.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_metadatum_t object
+ * from a given `uint64_t` integer.
+ *
+ * \param[in] integer The `uint64_t` integer value from which the metadatum will be created.
+ * \param[out] metadatum On successful initialization, this will point to a newly created
+ *             \ref cardano_metadatum_t object. This object represents a "strong reference"
+ *             to the metadatum, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the metadatum is no longer needed, the caller must release it
+ *             by calling \ref cardano_metadatum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t integer_value = 18446744073709551615u; // Example unsigned integer value
+ * cardano_metadatum_t* metadatum = NULL;
+ *
+ * // Attempt to create a new metadatum from an unsigned integer value
+ * cardano_error_t result = cardano_metadatum_new_integer_from_uint(integer_value, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *
+ *   // Once done, ensure to clean up and release the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_new_integer_from_uint(
+  uint64_t              integer,
+  cardano_metadatum_t** metadatum);
+
+/**
+ * \brief Creates and initializes a new instance of Plutus data from a string representation of an integer in a specified base.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_metadatum_t object from a given string
+ * representing an integer, interpreted according to the specified base (e.g., 10 for decimal, 16 for hexadecimal).
+ *
+ * \param[in] string A pointer to the character string containing the numeric representation of the integer.
+ * \param[in] size The number of characters in the string, excluding the null terminator.
+ * \param[in] base The numerical base in which the string representation is expressed. Valid values are between 2 and 36.
+ * \param[out] metadatum On successful initialization, this will point to a newly created
+ *                         \ref cardano_metadatum_t object. This object represents a "strong reference"
+ *                         to the metadatum, meaning that it is fully initialized and ready for use.
+ *                         The caller is responsible for managing the lifecycle of this object.
+ *                         Specifically, once the metadatum is no longer needed, the caller must release it
+ *                         by calling \ref cardano_metadatum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* integer_str = "12345678901234567890"; // Example large integer value in string form
+ * cardano_metadatum_t* metadatum = NULL;
+ * int32_t base = 10; // Decimal base
+ *
+ * // Attempt to create a new metadatum from a string representation of an integer in decimal
+ * cardano_error_t result = cardano_metadatum_new_integer_from_string(integer_str, strlen(integer_str), base, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *
+ *   // Once done, ensure to clean up and release the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_new_integer_from_string(
+  const char*           string,
+  size_t                size,
+  int32_t               base,
+  cardano_metadatum_t** metadatum);
+
+/**
+ * \brief Creates and initializes a new instance of a metadatum from a byte array.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_metadatum_t object
+ * from a given byte array. It essentially converts a byte array into a metadatum.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] bytes A pointer to the byte array from which the metadatum will be created.
+ *                  The byte array must not be NULL.
+ * \param[in] size The size of the byte array.
+ * \param[out] metadatum On successful initialization, this will point to a newly created
+ *             \ref cardano_metadatum_t object. This object represents a "strong reference"
+ *             to the metadatum, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the metadatum is no longer needed, the caller must release it
+ *             by calling \ref cardano_metadatum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t bytes[] = {0x01, 0x02, 0x03, 0x04}; // Example byte array
+ * size_t size = sizeof(bytes) / sizeof(byte_t); // Calculate the size of the byte array
+ * cardano_metadatum_t* metadatum = NULL;
+ *
+ * // Attempt to create a new metadatum from a byte array
+ * cardano_error_t result = cardano_metadatum_new_bytes(bytes, size, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *
+ *   // Once done, ensure to clean up and release the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_new_bytes(
+  const byte_t*         bytes,
+  size_t                size,
+  cardano_metadatum_t** metadatum);
+
+/**
+ * \brief Creates and initializes a new instance of a metadatum from a hexadecimal string.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_metadatum_t object
+ * from a given hexadecimal string. It essentially converts a hexadecimal string into a metadatum,
+ * treating each pair of characters as a byte. It returns an error code to indicate the success or
+ * failure of the operation.
+ *
+ * \param[in] hex A pointer to the hexadecimal string from which the metadatum will be created.
+ *                The hexadecimal string must not be NULL.
+ * \param[in] size The size of the hexadecimal string.
+ * \param[out] metadatum On successful initialization, this will point to a newly created
+ *             \ref cardano_metadatum_t object. This object represents a "strong reference"
+ *             to the metadatum, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the metadatum is no longer needed, the caller must release it
+ *             by calling \ref cardano_metadatum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* hex_string = "0123456789abcdef"; // Example hexadecimal string
+ * size_t size = strlen(hex_string); // Calculate the size of the string
+ * cardano_metadatum_t* metadatum = NULL;
+ *
+ * // Attempt to create a new metadatum from a hexadecimal string
+ * cardano_error_t result = cardano_metadatum_new_bytes_from_hex(hex_string, size, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *
+ *   // Once done, ensure to clean up and release the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_new_bytes_from_hex(
+  const char*           hex,
+  size_t                size,
+  cardano_metadatum_t** metadatum);
+
+/**
+ * \brief Creates and initializes a new instance of a metadatum from a string.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_metadatum_t object
+ * from a given string.
+ *
+ * \param[in] string A pointer to the string from which the metadatum will be created.
+ *                The string must not be NULL.
+ * \param[in] size The size of the string.
+ * \param[out] metadatum On successful initialization, this will point to a newly created
+ *             \ref cardano_metadatum_t object. This object represents a "strong reference"
+ *             to the metadatum, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the metadatum is no longer needed, the caller must release it
+ *             by calling \ref cardano_metadatum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* string = "hello world"; // Example string
+ * size_t size = strlen(string); // Calculate the size of the string
+ * cardano_metadatum_t* metadatum = NULL;
+ *
+ * // Attempt to create a new metadatum from a string
+ * cardano_error_t result = cardano_metadatum_new_string(string, size, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *
+ *   // Once done, ensure to clean up and release the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_new_string(
+  const char*           string,
+  size_t                size,
+  cardano_metadatum_t** metadatum);
+
+/**
+ * \brief Creates a metadatum from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_metadatum_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a metadatum.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded metadatum.
+ * \param[out] metadatum A pointer to a pointer of \ref cardano_metadatum_t that will be set to the address
+ *                        of the newly created metadatum object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the metadatum was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_metadatum_t object by calling
+ *       \ref cardano_metadatum_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_metadatum_t* metadatum = NULL;
+ *
+ * cardano_error_t result = cardano_metadatum_from_cbor(reader, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *
+ *   // Once done, ensure to clean up and release the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode metadatum: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_from_cbor(cardano_cbor_reader_t* reader, cardano_metadatum_t** metadatum);
+
+/**
+ * \brief Creates a metadatum from a JSON string.
+ *
+ * This function parses JSON data using a provided JSON string and constructs a \ref cardano_metadatum_t object.
+ * It assumes that the JSON data corresponds to the structure expected for a metadatum.
+ *
+ * \param[in] json A pointer to a character array containing the JSON-encoded metadatum data.
+ * \param[in] json_size The size of the JSON data in bytes.
+ * \param[out] metadatum A pointer to a pointer of \ref cardano_metadatum_t that will be set to the address
+ *                           of the newly created metadatum object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the metadatum was successfully created, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* json_data = "{...}"; // Assume this contains valid JSON-encoded metadatum data
+ * size_t data_size = strlen(json_data);
+ * cardano_metadatum_t* metadatum = NULL;
+ *
+ * cardano_error_t result = cardano_metadatum_from_json(json_data, data_size, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *
+ *   // Once done, ensure to clean up and release the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to decode metadatum: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_from_json(const char* json, size_t json_size, cardano_metadatum_t** metadatum);
+
+/**
+ * \brief Computes the size needed for the JSON string representation of a metadatum.
+ *
+ * This function calculates the size in bytes required to represent a \ref cardano_metadatum_t
+ * as a null-terminated JSON string, including the null terminator. This is useful for allocating
+ * an appropriately sized buffer before converting the metadatum to JSON using
+ * \ref cardano_metadatum_to_json.
+ *
+ * \param[in] metadatum A pointer to the \ref cardano_metadatum_t instance whose JSON size is being queried.
+ *                      This parameter must not be NULL.
+ *
+ * \return The size in bytes required to represent the metadatum as a null-terminated JSON string,
+ *         including the null terminator. Returns 0 if \p metadatum is NULL or if an error occurs.
+ *
+ * \note The size returned includes space for the null terminator.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume metadatum is already initialized
+ * cardano_metadatum_t* metadatum = ...;
+ *
+ * size_t json_size = cardano_metadatum_get_json_size(metadatum);
+ *
+ * if (json_size > 0)
+ * {
+ *   // json_size now contains the size needed to store the JSON string, including null terminator
+ *   // You can allocate a buffer of this size for conversion
+ * }
+ * else
+ * {
+ *   printf("Failed to get the JSON size.\n");
+ *   // Handle error
+ * }
+ * \endcode
+ *
+ * \see cardano_metadatum_to_json
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_metadatum_get_json_size(cardano_metadatum_t* metadatum);
+
+/**
+ * \brief Converts a metadatum object to a JSON string.
+ *
+ * This function converts a \ref cardano_metadatum_t object to its JSON representation.
+ * The resulting JSON string is stored in the provided buffer, which must be pre-allocated by the caller.
+ * The buffer must be large enough to hold the entire JSON string, including the null terminator.
+ *
+ * To determine the required buffer size (including the null terminator), use
+ * \ref cardano_metadatum_get_json_size before calling this function.
+ *
+ * \param[in] metadatum A pointer to the \ref cardano_metadatum_t object to be converted.
+ *                      This parameter must not be NULL.
+ * \param[out] json A pointer to a character array where the null-terminated JSON string will be stored.
+ *                  The buffer must be allocated by the caller and have a size of at least \p json_size bytes.
+ *                  This parameter must not be NULL.
+ * \param[in] json_size The size of the \p json buffer in bytes, including space for the null terminator.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if \p metadatum or \p json is NULL.
+ *         Returns \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE if \p json_size is insufficient to hold the JSON string.
+ *
+ * \note The JSON string will be encoded in UTF-8.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume metadatum is already initialized
+ * cardano_metadatum_t* metadatum = ...;
+ *
+ * // Get the size needed for the JSON string (including null terminator)
+ * size_t json_size = cardano_metadatum_get_json_size(metadatum);
+ * if (json_size == 0)
+ * {
+ *   printf("Failed to get the JSON size.\n");
+ *   // Handle error
+ * }
+ * else
+ * {
+ *   // Allocate buffer for the JSON string
+ *   char* json_buffer = (char*)malloc(json_size);
+ *   if (json_buffer == NULL)
+ *   {
+ *     printf("Memory allocation failed.\n");
+ *     // Handle memory allocation failure
+ *   }
+ *   else
+ *   {
+ *     // Convert the metadatum to JSON
+ *     cardano_error_t result = cardano_metadatum_to_json(metadatum, json_buffer, json_size);
+ *     if (result == CARDANO_SUCCESS)
+ *     {
+ *       printf("Metadatum as JSON: %s\n", json_buffer);
+ *     }
+ *     else
+ *     {
+ *       printf("Failed to convert metadatum to JSON: %s\n", cardano_error_to_string(result));
+ *     }
+ *     // Free the buffer when done
+ *     free(json_buffer);
+ *   }
+ * }
+ *
+ * // Clean up the metadatum object once done
+ * cardano_metadatum_unref(&metadatum);
+ * \endcode
+ *
+ * \see cardano_metadatum_get_json_size
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_to_json(
+  cardano_metadatum_t* metadatum,
+  char*                json,
+  size_t               json_size);
+
+/**
+ * \brief Serializes a metadatum into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_metadatum_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] metadatum A constant pointer to the \ref cardano_metadatum_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p metadatum or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_t* metadatum = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_metadatum_to_cbor(metadatum, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_metadatum_unref(&metadatum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_to_cbor(
+  const cardano_metadatum_t* metadatum,
+  cardano_cbor_writer_t*     writer);
+
+/**
+ * \brief Serializes a \ref cardano_metadatum_t to CIP-116 JSON.
+ *
+ * This function emits a single JSON object representing a Cardano transaction metadatum
+ * using the CIP-116 JSON shape.
+ *
+ * The function always writes a complete JSON object (it begins with `{` and ends with `}`).
+ * It assumes \p writer is positioned where a value is valid (root, array element, or after a
+ * property name).
+ *
+ * \note Unlike on-chain CBOR encoding constraints, this JSON encoder does **not** enforce the
+ *  64-byte bounds on bytes/text metadata. It emits the full content as provided.
+ *
+ * \param[in] metadatum A valid pointer to the metadatum to serialize.
+ * \param[in,out] writer A valid JSON writer.
+ *
+ * \return CARDANO_SUCCESS on success.
+ * \return CARDANO_ERROR_POINTER_IS_NULL if any pointer parameter is NULL.
+ * \return CARDANO_ERROR_ENCODING on encoding errors (e.g., allocation failure or conversion failure).
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_to_cip116_json(
+  const cardano_metadatum_t* metadatum,
+  cardano_json_writer_t*     writer);
+
+/**
+ * \brief Retrieves the kind of the metadatum.
+ *
+ * This function retrieves the kind of a given \ref cardano_metadatum_t object and stores it in the provided
+ * output parameter. The metadatum kind is defined in the \ref cardano_metadatum_kind_t enumeration, which
+ * specifies whether the metadatum represents an integer, byte array, or other types.
+ *
+ * \param[in] metadatum A constant pointer to the \ref cardano_metadatum_t object from which
+ *                        the kind is to be retrieved. The object must not be NULL.
+ * \param[out] kind Pointer to a variable where the metadatum kind will be stored. This variable will
+ *                  be set to the value from the \ref cardano_metadatum_kind_t enumeration.
+ *
+ * \return \ref CARDANO_SUCCESS if the kind was successfully retrieved, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_t* metadatum = cardano_metadatum_new_bytes_from_hex(...);
+ * cardano_metadatum_kind_t kind;
+ * cardano_error_t result = cardano_metadatum_get_kind(metadatum, &kind);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (kind == CARDANO_METADATUM_KIND_INTEGER)
+ *   {
+ *     // Handle integer type metadatum
+ *   }
+ *   else if (kind == CARDANO_METADATUM_KIND_BYTES)
+ *   {
+ *     // Handle byte array type metadatum
+ *   }
+ *   // Add more cases as needed for other kinds
+ * }
+ *
+ * // Clean up the metadatum object once done
+ * cardano_metadatum_unref(&metadatum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_get_kind(
+  const cardano_metadatum_t* metadatum,
+  cardano_metadatum_kind_t*  kind);
+
+/**
+ * \brief Converts a metadatum object to a metadatum map object.
+ *
+ * This function converts a \ref cardano_metadatum_t object to a \ref cardano_metadatum_map_t object.
+ * It essentially creates a metadatum map object from the given metadatum, allowing the conversion
+ * between different types of metadatum. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] metadatum A constant pointer to the \ref cardano_metadatum_t object to be converted.
+ *                        The object must not be NULL.
+ * \param[out] map On successful conversion, this will point to a newly created
+ *                 \ref cardano_metadatum_map_t object. This object represents a "strong reference"
+ *                 to the metadatum_map, meaning that it is fully initialized and ready for use.
+ *                 The caller is responsible for managing the lifecycle of this object.
+ *                 Specifically, once the metadatum_map is no longer needed, the caller must release it
+ *                 by calling \ref cardano_metadatum_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_t* metadatum = ...; // Assume metadatum is a valid metadatum map object
+ * cardano_metadatum_map_t* map = NULL;
+ * cardano_error_t result = cardano_metadatum_to_map(metadatum, &map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum_map
+ *
+ *   // Once done, ensure to clean up and release the metadatum_map
+ *   cardano_metadatum_map_unref(&map);
+ * }
+ *
+ * // Clean up the metadatum object once done
+ * cardano_metadatum_unref(&metadatum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_to_map(
+  cardano_metadatum_t*      metadatum,
+  cardano_metadatum_map_t** map);
+
+/**
+ * \brief Converts a metadatum object to a metadatum list object.
+ *
+ * This function converts a \ref cardano_metadatum_t object to a \ref cardano_metadatum_list_t object.
+ * It essentially creates a metadatum list object from the given metadatum, allowing the conversion
+ * between different types of metadatum. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] metadatum A constant pointer to the \ref cardano_metadatum_t object to be converted.
+ * \param[out] list On successful conversion, this will point to a newly created
+ *                  \ref cardano_metadatum_list_t object. This object represents a "strong reference"
+ *                  to the metadatum_list, meaning that it is fully initialized and ready for use.
+ *                  The caller is responsible for managing the lifecycle of this object.
+ *                  Specifically, once the metadatum_list is no longer needed, the caller must release it
+ *                  by calling \ref cardano_metadatum_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_t* metadatum = ...; // Assume metadatum is a valid metadatum list object
+ * cardano_metadatum_list_t* list = NULL;
+ * cardano_error_t result = cardano_metadatum_to_list(metadatum, &list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum_list
+ *
+ *   // Once done, ensure to clean up and release the metadatum_list
+ *   cardano_metadatum_list_unref(&list);
+ * }
+ *
+ * // Clean up the metadatum object once done
+ * cardano_metadatum_unref(&metadatum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_to_list(
+  cardano_metadatum_t*       metadatum,
+  cardano_metadatum_list_t** list);
+
+/**
+ * \brief Converts a metadatum object to a bigint object.
+ *
+ * This function converts a \ref cardano_metadatum_t object to a \ref cardano_bigint_t object.
+ *
+ * \param[in] metadatum A constant pointer to the \ref cardano_metadatum_t object to be converted.
+ * \param[out] integer On successful conversion, this will point to a newly created \ref cardano_bigint_t object
+ *                     representing the extracted integer value. The caller is responsible for managing the memory
+ *                     of this object, including releasing it when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_t* metadatum = cardano_metadatum_new_integer_from_string("987456321478523698745");
+ * cardano_bigint_t* bigint = NULL;
+ * cardano_error_t result = cardano_metadatum_to_integer(metadatum, &bigint);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bigint object
+ *   const size_t size = cardano_bigint_get_string_size(bigint, 10);
+ *   char* buffer = (char*)malloc(size);
+ *
+ *   if (cardano_bigint_to_string(bigint, buffer, size, 10) == CARDANO_SUCCESS)
+ *   {
+ *     printf("Extracted bigint value: %s\n", buffer);
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_metadatum_unref(&metadatum);
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_to_integer(
+  const cardano_metadatum_t* metadatum,
+  cardano_bigint_t**         integer);
+
+/**
+ * \brief Converts a metadatum object to bounded bytes.
+ *
+ * This function converts a \ref cardano_metadatum_t object to bounded bytes.
+ * It extracts the bytes from the given metadatum, allowing the conversion
+ * between different types of metadatum. The resulting bytes are stored in a bounded bytes buffer.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] metadatum A constant pointer to the \ref cardano_metadatum_t object to be converted.
+ * \param[out] bounded_bytes On successful conversion, this will point to a newly created
+ *                           \ref cardano_buffer_t object containing the extracted bytes.
+ *                           This object represents a "strong reference" to the bounded bytes,
+ *                           meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the bounded bytes are no longer needed, the caller must release it
+ *                           by calling \ref cardano_buffer_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_t* metadatum = cardano_metadatum_new_bytes_from_hex("DEADBEEF", 8);
+ * cardano_buffer_t* bounded_bytes = NULL;
+ * cardano_error_t result = cardano_metadatum_to_bounded_bytes(metadatum, &bounded_bytes);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bounded bytes
+ *   printf("Extracted bounded bytes: ");
+ *
+ *   for (size_t i = 0; i < cardano_buffer_get_size(bounded_bytes); ++i)
+ *   {
+ *     printf("%02X ", cardano_buffer_get_data(bounded_bytes)[i]);
+ *   }
+ *
+ *   printf("\n");
+ *
+ *   // Once done, ensure to clean up and release the bounded bytes
+ *   cardano_buffer_unref(&bounded_bytes);
+ * }
+ *
+ * // Clean up the metadatum object once done
+ * cardano_metadatum_unref(&metadatum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_to_bounded_bytes(
+  cardano_metadatum_t* metadatum,
+  cardano_buffer_t**   bounded_bytes);
+
+/**
+ * \brief Computes the size needed for the null-terminated string representation of a metadatum.
+ *
+ * This function calculates the size in bytes required to represent a \ref cardano_metadatum_t
+ * as a null-terminated string, including the null terminator. This is useful for allocating
+ * an appropriately sized buffer before converting the metadatum to a string using
+ * \ref cardano_metadatum_to_string.
+ *
+ * \param[in] metadatum A pointer to the \ref cardano_metadatum_t instance whose string size is being queried.
+ *                      This parameter must not be NULL.
+ *
+ * \return The size in bytes required to represent the metadatum as a null-terminated string,
+ *         including the null terminator. Returns 0 if \p metadatum is NULL or if an error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume metadatum is already initialized
+ * cardano_metadatum_t* metadatum = ...;
+ *
+ * size_t size = cardano_metadatum_get_string_size(metadatum);
+ *
+ * if (size > 0)
+ * {
+ *     // size now contains the size needed to store the string, including null terminator
+ *     // You can allocate a buffer of this size for conversion
+ * }
+ * else
+ * {
+ *     printf("Failed to get the string size.\n");
+ *     // Handle error
+ * }
+ * \endcode
+ *
+ * \see cardano_metadatum_to_string
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_metadatum_get_string_size(cardano_metadatum_t* metadatum);
+
+/**
+ * \brief Converts a metadatum object to a null-terminated C string.
+ *
+ * This function converts a \ref cardano_metadatum_t object to its string representation.
+ * The resulting string is stored in the provided buffer, which must be pre-allocated by the caller.
+ * The buffer must be large enough to hold the entire string, including the null terminator.
+ *
+ * To determine the required buffer size (including the null terminator), use
+ * \ref cardano_metadatum_get_string_size before calling this function.
+ *
+ * \param[in] metadatum A pointer to the \ref cardano_metadatum_t object to be converted.
+ *                      This parameter must not be NULL.
+ * \param[out] buffer A pointer to a character array where the null-terminated string will be stored.
+ *                    The buffer must be allocated by the caller and have a size of at least \p buffer_size bytes.
+ *                    This parameter must not be NULL.
+ * \param[in] buffer_size The size of the \p buffer in bytes, including space for the null terminator.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if \p metadatum or \p buffer is NULL.
+ *         Returns \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE if \p buffer_size is insufficient to hold the string.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume metadatum is already initialized
+ * cardano_metadatum_t* metadatum = ...;
+ *
+ * // Get the size needed for the string (including null terminator)
+ * size_t string_size = cardano_metadatum_get_string_size(metadatum);
+ * if (string_size == 0)
+ * {
+ *     printf("Failed to get the string size.\n");
+ *     // Handle error
+ * }
+ * else
+ * {
+ *     // Allocate buffer for the string
+ *     char* buffer = (char*)malloc(string_size);
+ *     if (buffer == NULL)
+ *     {
+ *         printf("Memory allocation failed.\n");
+ *         // Handle memory allocation failure
+ *     }
+ *     else
+ *     {
+ *         // Convert the metadatum to string
+ *         cardano_error_t result = cardano_metadatum_to_string(metadatum, buffer, string_size);
+ *         if (result == CARDANO_SUCCESS)
+ *         {
+ *             printf("Metadatum as string: %s\n", buffer);
+ *         }
+ *         else
+ *         {
+ *             printf("Failed to convert metadatum to string: %s\n", cardano_error_to_string(result));
+ *         }
+ *         // Free the buffer when done
+ *         free(buffer);
+ *     }
+ * }
+ *
+ * // Clean up the metadatum object once done
+ * cardano_metadatum_unref(&metadatum);
+ * \endcode
+ *
+ * \see cardano_metadatum_get_string_size
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_to_string(
+  cardano_metadatum_t* metadatum,
+  char*                buffer,
+  size_t               buffer_size);
+
+/**
+ * \brief Checks if two metadatum objects are equal.
+ *
+ * This function compares two \ref cardano_metadatum_t objects for equality.
+ * It checks if the contents of the two metadatum objects are identical.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_metadatum_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_metadatum_t object to be compared.
+ *
+ * \return \c true if the two metadatum objects are equal (have the same contents), \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_t* metadatum1 = cardano_metadatum_new_bytes_from_hex("DEADBEEF", 8);
+ * cardano_metadatum_t* metadatum2 = cardano_metadatum_new_bytes_from_hex("DEADBEEF", 8);
+ *
+ * if (cardano_metadatum_equals(metadatum1, metadatum2))
+ * {
+ *   printf("metadatum1 is equal to metadatum2\n");
+ * }
+ * else
+ * {
+ *   printf("metadatum1 is not equal to metadatum2\n");
+ * }
+ *
+ * // Clean up the metadatum objects once done
+ * cardano_metadatum_unref(&metadatum1);
+ * cardano_metadatum_unref(&metadatum2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_metadatum_equals(const cardano_metadatum_t* lhs, const cardano_metadatum_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a metadatum object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_metadatum_t object
+ * by decreasing its reference count. When the reference count reaches zero, the metadatum is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] metadatum A pointer to the pointer of the metadatum object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_t* metadatum = cardano_metadatum_new();
+ *
+ * // Perform operations with the metadatum...
+ *
+ * cardano_metadatum_unref(&metadatum);
+ * // At this point, metadatum is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_metadatum_unref, the pointer to the \ref cardano_metadatum_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_metadatum_unref(cardano_metadatum_t** metadatum);
+
+/**
+ * \brief Increases the reference count of the cardano_metadatum_t object.
+ *
+ * This function is used to manually increment the reference count of a metadatum
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_metadatum_unref.
+ *
+ * \param metadatum A pointer to the metadatum object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming metadatum is a previously created metadatum object
+ *
+ * cardano_metadatum_ref(metadatum);
+ *
+ * // Now metadatum can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_metadatum_ref there is a corresponding
+ * call to \ref cardano_metadatum_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_metadatum_ref(cardano_metadatum_t* metadatum);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_metadatum_t object.
+ *
+ * This function returns the number of active references to a metadatum object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_metadatum_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param metadatum A pointer to the metadatum object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified metadatum object. If the object
+ * is properly managed (i.e., every \ref cardano_metadatum_ref call is matched with a
+ * \ref cardano_metadatum_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming metadatum is a previously created metadatum object
+ *
+ * size_t ref_count = cardano_metadatum_refcount(metadatum);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_metadatum_refcount(const cardano_metadatum_t* metadatum);
+
+/**
+ * \brief Sets the last error message for a given metadatum object.
+ *
+ * Records an error message in the metadatum's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] metadatum A pointer to the \ref cardano_metadatum_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the metadatum's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_metadatum_set_last_error(cardano_metadatum_t* metadatum, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific metadatum.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_metadatum_set_last_error for the given
+ * metadatum. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] metadatum A pointer to the \ref cardano_metadatum_t instance whose last error
+ *                   message is to be retrieved. If the metadatum is NULL, the function
+ *                   returns a generic error message indicating the null metadatum.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified metadatum. If the metadatum is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_metadatum_set_last_error for the same metadatum, or until
+ *       the metadatum is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_metadatum_get_last_error(const cardano_metadatum_t* metadatum);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_metadatum_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_metadatum_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_deep_clone(const cardano_metadatum_t* source, cardano_metadatum_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_H
diff --git a/vendor/include/cardano/auxiliary_data/metadatum_kind.h b/vendor/include/cardano/auxiliary_data/metadatum_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/auxiliary_data/metadatum_kind.h
@@ -0,0 +1,73 @@
+/**
+ * \file metadatum_kind.h
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_KIND_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \enum cardano_metadatum_kind_t
+ * \brief The metadatum type kind.
+ */
+typedef enum
+{
+  /**
+   * \brief A map of PlutusData as both key and values.
+   */
+  CARDANO_METADATUM_KIND_MAP,
+
+  /**
+   * \brief A list of PlutusData.
+   */
+  CARDANO_METADATUM_KIND_LIST,
+
+  /**
+   * \brief An integer.
+   */
+  CARDANO_METADATUM_KIND_INTEGER,
+
+  /**
+   * \brief Bounded bytes.
+   */
+  CARDANO_METADATUM_KIND_BYTES,
+
+  /**
+   * \brief Text string.
+   */
+  CARDANO_METADATUM_KIND_TEXT
+
+} cardano_metadatum_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_KIND_H
diff --git a/vendor/include/cardano/auxiliary_data/metadatum_label_list.h b/vendor/include/cardano/auxiliary_data/metadatum_label_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/auxiliary_data/metadatum_label_list.h
@@ -0,0 +1,322 @@
+/**
+ * \file metadatum_label_list.h
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_LABEL_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_LABEL_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a list of metadatum labels.
+ */
+typedef struct cardano_metadatum_label_list_t cardano_metadatum_label_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a metadatum_label_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_metadatum_label_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] metadatum_label_list On successful initialization, this will point to a newly created
+ *             \ref cardano_metadatum_label_list_t object. This object represents a "strong reference"
+ *             to the metadatum_label_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the metadatum_label_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_metadatum_label_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum_label_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_label_list_t* metadatum_label_list = NULL;
+ *
+ * // Attempt to create a new metadatum_label_list
+ * cardano_error_t result = cardano_metadatum_label_list_new(&metadatum_label_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum_label_list
+ *
+ *   // Once done, ensure to clean up and release the metadatum_label_list
+ *   cardano_metadatum_label_list_unref(&metadatum_label_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_label_list_new(cardano_metadatum_label_list_t** metadatum_label_list);
+
+/**
+ * \brief Retrieves the length of a metadatum label list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_metadatum_label_list_t object.
+ *
+ * \param[in] metadatum_label_list A constant pointer to the \ref cardano_metadatum_label_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the metadatum_label_list. Return 0 if the metadatum_label_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_label_list_t* metadatum_label_list = cardano_metadatum_label_list_new();
+ *
+ * // Populate metadatum_label_list with elements
+ *
+ * size_t length = cardano_metadatum_label_list_get_length(metadatum_label_list);
+ * printf("Length of the metadatum_label_list: %zu\n", length);
+ *
+ * // Clean up the metadatum_label_list object once done
+ * cardano_metadatum_label_list_unref(&metadatum_label_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_metadatum_label_list_get_length(const cardano_metadatum_label_list_t* metadatum_label_list);
+
+/**
+ * \brief Retrieves an element from a metadatum label list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_metadatum_label_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] metadatum_label_list A constant pointer to the \ref cardano_metadatum_label_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the metadatum label list. Indexing starts at 0.
+ * \param[out] element The label as an \c uint64_t.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_label_list_t* metadatum_label_list = cardano_metadatum_label_list_new();
+ *
+ * // Populate metadatum_label_list with elements
+ *
+ * uint64_t element = 0;
+ * cardano_error_t result = cardano_metadatum_label_list_get(metadatum_label_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ * }
+ *
+ * // Clean up the metadatum_label_list object once done
+ * cardano_metadatum_label_list_unref(&metadatum_label_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_label_list_get(const cardano_metadatum_label_list_t* metadatum_label_list, size_t index, uint64_t* element);
+
+/**
+ * \brief Adds an element to a metadatum label list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_metadatum_label_list_t object.
+ *
+ * \param[in] metadatum_label_list A constant pointer to the \ref cardano_metadatum_label_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element The metadatum label to be added.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the metadatum_label_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_label_list_t* metadatum_label_list = cardano_metadatum_label_list_new();
+ *
+ * // Create and initialize a new metadatum label element
+ * uint64_t element = 755;
+ *
+ * // Add the element to the metadatum_label_list
+ * cardano_error_t result = cardano_metadatum_label_list_add(metadatum_label_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the metadatum_label_list object once done
+ * cardano_metadatum_label_list_unref(&metadatum_label_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_label_list_add(cardano_metadatum_label_list_t* metadatum_label_list, uint64_t element);
+
+/**
+ * \brief Decrements the reference count of a metadatum_label_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_metadatum_label_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the metadatum_label_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] metadatum_label_list A pointer to the pointer of the metadatum_label_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_label_list_t* metadatum_label_list = cardano_metadatum_label_list_new();
+ *
+ * // Perform operations with the metadatum_label_list...
+ *
+ * cardano_metadatum_label_list_unref(&metadatum_label_list);
+ * // At this point, metadatum_label_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_metadatum_label_list_unref, the pointer to the \ref cardano_metadatum_label_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_metadatum_label_list_unref(cardano_metadatum_label_list_t** metadatum_label_list);
+
+/**
+ * \brief Increases the reference count of the cardano_metadatum_label_list_t object.
+ *
+ * This function is used to manually increment the reference count of a metadatum_label_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_metadatum_label_list_unref.
+ *
+ * \param metadatum_label_list A pointer to the metadatum_label_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming metadatum_label_list is a previously created metadatum_label_list object
+ *
+ * cardano_metadatum_label_list_ref(metadatum_label_list);
+ *
+ * // Now metadatum_label_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_metadatum_label_list_ref there is a corresponding
+ * call to \ref cardano_metadatum_label_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_metadatum_label_list_ref(cardano_metadatum_label_list_t* metadatum_label_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_metadatum_label_list_t object.
+ *
+ * This function returns the number of active references to a metadatum_label_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_metadatum_label_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param metadatum_label_list A pointer to the metadatum_label_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified metadatum_label_list object. If the object
+ * is properly managed (i.e., every \ref cardano_metadatum_label_list_ref call is matched with a
+ * \ref cardano_metadatum_label_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming metadatum_label_list is a previously created metadatum_label_list object
+ *
+ * size_t ref_count = cardano_metadatum_label_list_refcount(metadatum_label_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_metadatum_label_list_refcount(const cardano_metadatum_label_list_t* metadatum_label_list);
+
+/**
+ * \brief Sets the last error message for a given metadatum_label_list object.
+ *
+ * Records an error message in the metadatum_label_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] metadatum_label_list A pointer to the \ref cardano_metadatum_label_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the metadatum_label_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_metadatum_label_list_set_last_error(cardano_metadatum_label_list_t* metadatum_label_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific metadatum_label_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_metadatum_label_list_set_last_error for the given
+ * metadatum_label_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] metadatum_label_list A pointer to the \ref cardano_metadatum_label_list_t instance whose last error
+ *                   message is to be retrieved. If the metadatum_label_list is NULL, the function
+ *                   returns a generic error message indicating the null metadatum_label_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified metadatum_label_list. If the metadatum_label_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_metadatum_label_list_set_last_error for the same metadatum_label_list, or until
+ *       the metadatum_label_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_metadatum_label_list_get_last_error(const cardano_metadatum_label_list_t* metadatum_label_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_metadatum_label_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_metadatum_label_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_label_list_deep_clone(const cardano_metadatum_label_list_t* source, cardano_metadatum_label_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_LABEL_LIST_H
diff --git a/vendor/include/cardano/auxiliary_data/metadatum_list.h b/vendor/include/cardano/auxiliary_data/metadatum_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/auxiliary_data/metadatum_list.h
@@ -0,0 +1,480 @@
+/**
+ * \file metadatum_list.h
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A type corresponding to the metadatum type.
+ *
+ * Use this type to build metadata structures that you want to be representable on-chain.
+ */
+typedef struct cardano_metadatum_t cardano_metadatum_t;
+
+/**
+ * \brief Represents a list of metadatum.
+ */
+typedef struct cardano_metadatum_list_t cardano_metadatum_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a metadatum_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_metadatum_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] metadatum_list On successful initialization, this will point to a newly created
+ *             \ref cardano_metadatum_list_t object. This object represents a "strong reference"
+ *             to the metadatum_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the metadatum_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_metadatum_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_list_t* metadatum_list = NULL;
+ *
+ * // Attempt to create a new metadatum_list
+ * cardano_error_t result = cardano_metadatum_list_new(&metadatum_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum_list
+ *
+ *   // Once done, ensure to clean up and release the metadatum_list
+ *   cardano_metadatum_list_unref(&metadatum_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_list_new(cardano_metadatum_list_t** metadatum_list);
+
+/**
+ * \brief Creates a metadatum_list from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_metadatum_list_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a metadatum_list.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded metadatum_list data.
+ * \param[out] metadatum_list A pointer to a pointer of \ref cardano_metadatum_list_t that will be set to the address
+ *                        of the newly created metadatum_list object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the metadatum_list was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_metadatum_list_t object by calling
+ *       \ref cardano_metadatum_list_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_metadatum_list_t* metadatum_list = NULL;
+ *
+ * cardano_error_t result = cardano_metadatum_list_from_cbor(reader, &metadatum_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum_list
+ *
+ *   // Once done, ensure to clean up and release the metadatum_list
+ *   cardano_metadatum_list_unref(&metadatum_list);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode metadatum_list: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_list_from_cbor(cardano_cbor_reader_t* reader, cardano_metadatum_list_t** metadatum_list);
+
+/**
+ * \brief Serializes a metadatum_list into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_metadatum_list_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] metadatum_list A constant pointer to the \ref cardano_metadatum_list_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p metadatum_list or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_list_t* metadatum_list = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_metadatum_list_to_cbor(metadatum_list, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_metadatum_list_unref(&metadatum_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_list_to_cbor(
+  const cardano_metadatum_list_t* metadatum_list,
+  cardano_cbor_writer_t*          writer);
+
+/**
+ * \brief Serializes a \ref cardano_metadatum_list_t to CIP-116 JSON.
+ *
+ * Produces a single JSON object.
+ *
+ * Each element in \c contents is itself a full CIP-116 metadatum object as
+ * written by \ref cardano_metadatum_to_cip116_json.
+ *
+ * The function always writes a complete JSON object (it begins with \c { and ends with \c }).
+ * It assumes \p writer is positioned where a value is valid (root, array element, or after
+ * a property name).
+ *
+ * \note Property order ("tag" then "contents") is stable for readability, but not required by CIP-116.
+ *
+ * \param[in]  list A valid metadatum list to serialize.
+ * \param[in]  writer             A valid JSON writer.
+ *
+ * \return CARDANO_SUCCESS on success.
+ * \return CARDANO_ERROR_POINTER_IS_NULL if any pointer parameter is \c NULL.
+ * \return CARDANO_ERROR_ENCODING if an element cannot be retrieved or serialized.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_list_to_cip116_json(
+  const cardano_metadatum_list_t* list,
+  cardano_json_writer_t*          writer);
+
+/**
+ * \brief Retrieves the length of a metadatum list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_metadatum_list_t object.
+ *
+ * \param[in] metadatum_list A constant pointer to the \ref cardano_metadatum_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the metadatum_list. Return 0 if the metadatum_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_list_t* metadatum_list = cardano_metadatum_list_new();
+ *
+ * // Populate metadatum_list with elements
+ *
+ * size_t length = cardano_metadatum_list_get_length(metadatum_list);
+ * printf("Length of the metadatum_list: %zu\n", length);
+ *
+ * // Clean up the metadatum_list object once done
+ * cardano_metadatum_list_unref(&metadatum_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_metadatum_list_get_length(const cardano_metadatum_list_t* metadatum_list);
+
+/**
+ * \brief Retrieves an element from a metadatum list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_metadatum_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] metadatum_list A constant pointer to the \ref cardano_metadatum_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the metadatum list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_metadatum_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_metadatum_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_list_t* metadatum_list = cardano_metadatum_list_new();
+ *
+ * // Populate metadatum_list with elements
+ *
+ * cardano_metadatum_t* element = NULL;
+ * cardano_error_t result = cardano_metadatum_list_get(metadatum_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_metadatum_unref(&element);
+ * }
+ *
+ * // Clean up the metadatum_list object once done
+ * cardano_metadatum_list_unref(&metadatum_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_list_get(const cardano_metadatum_list_t* metadatum_list, size_t index, cardano_metadatum_t** element);
+
+/**
+ * \brief Adds an element to a metadatum list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_metadatum_list_t object.
+ *
+ * \param[in] metadatum_list A constant pointer to the \ref cardano_metadatum_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_metadatum_t object that is to be added to the metadatum_list.
+ *                    The element will be referenced by the metadatum_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the metadatum_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_list_t* metadatum_list = cardano_metadatum_list_new();
+ *
+ * // Create and initialize a new metadatum element
+ * cardano_metadatum_t* element = { ... };
+ *
+ * // Add the element to the metadatum_list
+ * cardano_error_t result = cardano_metadatum_list_add(metadatum_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the metadatum_list object once done
+ * cardano_metadatum_list_unref(&metadatum_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_list_add(cardano_metadatum_list_t* metadatum_list, cardano_metadatum_t* element);
+
+/**
+ * \brief Checks if two metadatum lists are equal.
+ *
+ * This function compares two \ref cardano_metadatum_list_t objects to determine if they are equal. Two metadatum lists
+ * are considered equal if they have the same number of elements and each corresponding pair of elements
+ * is equal according to the \ref cardano_metadatum_equals function.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_metadatum_list_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_metadatum_list_t object to be compared.
+ *
+ * \return \c true if the two metadatum_lists are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_list_t* list1 = { ... };  // Assume list1 is initialized here
+ * cardano_metadatum_list_t* list2 = { ... };  // Assume list2 is initialized here
+ *
+ * if (cardano_metadatum_list_equals(list1, list2))
+ * {
+ *   // The two metadatum_lists are equal
+ * }
+ * else
+ * {
+ *   // The two metadatum_lists are not equal
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_metadatum_list_equals(const cardano_metadatum_list_t* lhs, const cardano_metadatum_list_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a metadatum_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_metadatum_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the metadatum_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] metadatum_list A pointer to the pointer of the metadatum_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_list_t* metadatum_list = cardano_metadatum_list_new();
+ *
+ * // Perform operations with the metadatum_list...
+ *
+ * cardano_metadatum_list_unref(&metadatum_list);
+ * // At this point, metadatum_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_metadatum_list_unref, the pointer to the \ref cardano_metadatum_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_metadatum_list_unref(cardano_metadatum_list_t** metadatum_list);
+
+/**
+ * \brief Increases the reference count of the cardano_metadatum_list_t object.
+ *
+ * This function is used to manually increment the reference count of a metadatum_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_metadatum_list_unref.
+ *
+ * \param metadatum_list A pointer to the metadatum_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming metadatum_list is a previously created metadatum_list object
+ *
+ * cardano_metadatum_list_ref(metadatum_list);
+ *
+ * // Now metadatum_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_metadatum_list_ref there is a corresponding
+ * call to \ref cardano_metadatum_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_metadatum_list_ref(cardano_metadatum_list_t* metadatum_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_metadatum_list_t object.
+ *
+ * This function returns the number of active references to a metadatum_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_metadatum_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param metadatum_list A pointer to the metadatum_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified metadatum_list object. If the object
+ * is properly managed (i.e., every \ref cardano_metadatum_list_ref call is matched with a
+ * \ref cardano_metadatum_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming metadatum_list is a previously created metadatum_list object
+ *
+ * size_t ref_count = cardano_metadatum_list_refcount(metadatum_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_metadatum_list_refcount(const cardano_metadatum_list_t* metadatum_list);
+
+/**
+ * \brief Sets the last error message for a given metadatum_list object.
+ *
+ * Records an error message in the metadatum_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] metadatum_list A pointer to the \ref cardano_metadatum_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the metadatum_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_metadatum_list_set_last_error(cardano_metadatum_list_t* metadatum_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific metadatum_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_metadatum_list_set_last_error for the given
+ * metadatum_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] metadatum_list A pointer to the \ref cardano_metadatum_list_t instance whose last error
+ *                   message is to be retrieved. If the metadatum_list is NULL, the function
+ *                   returns a generic error message indicating the null metadatum_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified metadatum_list. If the metadatum_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_metadatum_list_set_last_error for the same metadatum_list, or until
+ *       the metadatum_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_metadatum_list_get_last_error(const cardano_metadatum_list_t* metadatum_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_metadatum_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_metadatum_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_list_deep_clone(const cardano_metadatum_list_t* source, cardano_metadatum_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_LIST_H
diff --git a/vendor/include/cardano/auxiliary_data/metadatum_map.h b/vendor/include/cardano/auxiliary_data/metadatum_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/auxiliary_data/metadatum_map.h
@@ -0,0 +1,641 @@
+/**
+ * \file metadatum_map.h
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of metadatum.
+ */
+typedef struct cardano_metadatum_map_t cardano_metadatum_map_t;
+
+/**
+ * \brief A type corresponding to the metadatum type.
+ *
+ * Use this type to build metadata structures that you want to be representable on-chain.
+ */
+typedef struct cardano_metadatum_t cardano_metadatum_t;
+
+/**
+ * \brief Represents a list of metadatum.
+ */
+typedef struct cardano_metadatum_list_t cardano_metadatum_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a metadatum map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_metadatum_map_t,
+ * representing a map structure. It returns an error code
+ * to indicate the success or failure of the operation.
+ *
+ * \param[out] metadatum_map A pointer to a pointer to a \ref cardano_metadatum_map_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_metadatum_map_t
+ *                        object. This object represents a "strong reference" to the metadatum_map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the metadatum_map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_metadatum_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum_map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_map_t* metadatum_map = NULL;
+ *
+ * // Attempt to create a new metadatum_map
+ * cardano_error_t result = cardano_metadatum_map_new(&metadatum_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum_map
+ *
+ *   // Once done, ensure to clean up and release the metadatum_map
+ *   cardano_metadatum_map_unref(&metadatum_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_map_new(cardano_metadatum_map_t** metadatum_map);
+
+/**
+ * \brief Creates a metadatum map from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_metadatum_map_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a metadatum_map.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded metadatum_map data.
+ * \param[out] metadatum_map A pointer to a pointer of \ref cardano_metadatum_map_t that will be set to the address
+ *                        of the newly created metadatum_map object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the metadatum_map was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_metadatum_map_t object by calling
+ *       \ref cardano_metadatum_map_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_metadatum_map_t* metadatum_map = NULL;
+ *
+ * cardano_error_t result = cardano_metadatum_map_from_cbor(reader, &metadatum_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum_map
+ *
+ *   // Once done, ensure to clean up and release the metadatum_map
+ *   cardano_metadatum_map_unref(&metadatum_map);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode metadatum_map: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_map_from_cbor(cardano_cbor_reader_t* reader, cardano_metadatum_map_t** metadatum_map);
+
+/**
+ * \brief Serializes a metadatum map into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_metadatum_map_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] metadatum_map A constant pointer to the \ref cardano_metadatum_map_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p metadatum_map or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_map_t* metadatum_map = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_metadatum_map_to_cbor(metadatum_map, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_metadatum_map_unref(&metadatum_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_map_to_cbor(
+  const cardano_metadatum_map_t* metadatum_map,
+  cardano_cbor_writer_t*         writer);
+
+/**
+ * \brief Serializes a \ref cardano_metadatum_map_t to CIP-116 JSON.
+ *
+ * Writes a single JSON object.
+ *
+ * Each \c key and \c value is serialized using
+ * \ref cardano_metadatum_to_cip116_json, so any valid metadatum type
+ * (map, list, int, bytes, string) is supported recursively.
+ *
+ * The function always writes a complete JSON object (enclosed in \c { } ).
+ *
+ * \param[in] map    A valid metadatum map to serialize.
+ * \param[in] writer A valid JSON writer positioned where a value is expected.
+ *
+ * \return CARDANO_SUCCESS on success.
+ * \return CARDANO_ERROR_POINTER_IS_NULL if \p map or \p writer is \c NULL.
+ * \return CARDANO_ERROR_ENCODING if a pair cannot be retrieved or an element
+ *         fails to serialize; a descriptive error is set on \p writer.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_map_to_cip116_json(
+  const cardano_metadatum_map_t* map,
+  cardano_json_writer_t*         writer);
+
+/**
+ * \brief Retrieves the length of the metadatum_map.
+ *
+ * This function returns the number of key-value pairs contained in the specified metadatum_map.
+ *
+ * \param[in] metadatum_map A constant pointer to the \ref cardano_metadatum_map_t object for which
+ *                       the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the metadatum_map. Returns 0 if the metadatum_map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_map_t* metadatum_map = cardano_metadatum_map_new();
+ *
+ * // Populate the metadatum_map with key-value pairs
+ *
+ * size_t length = cardano_metadatum_map_get_length(metadatum_map);
+ * printf("The length of the metadatum_map is: %zu\n", length);
+ *
+ * cardano_metadatum_map_unref(&metadatum_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_metadatum_map_get_length(const cardano_metadatum_map_t* metadatum_map);
+
+/**
+ * \brief Retrieves the value associated with a given key in the metadatum map.
+ *
+ * This function retrieves the value associated with the specified key in the provided metadatum map.
+ * It returns the value through the output parameter `element`. If the key is not found in the metadatum map,
+ * the output parameter `element` will be set to NULL.
+ *
+ * \param[in] metadatum_map A constant pointer to the \ref cardano_metadatum_map_t object from which
+ *                       the value is to be retrieved.
+ * \param[in] key The key whose associated value is to be retrieved from the metadatum_map.
+ * \param[out] element A pointer to a variable where the retrieved value will be stored. If the key
+ *                     is found in the metadatum map, this variable will be set to the associated value.
+ *                     If the key is not found, this variable will be set to NULL. The caller is
+ *                     responsible for releasing the value by calling \ref cardano_metadatum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the value associated with the key was successfully retrieved, or
+ *         an appropriate error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_map_t* metadatum_map = cardano_metadatum_map_new();
+ *
+ * // Populate the metadatum_map with key-value pairs
+ *
+ * cardano_metadatum_t* key = ...; // Create a metadatum object representing the key
+ * cardano_metadatum_t* value = NULL;
+ * cardano_error_t result = cardano_metadatum_map_get(metadatum_map, key, &value);
+ *
+ * if (result == CARDANO_SUCCESS && value != NULL)
+ * {
+ *   // Use the retrieved value
+ *   // ...
+ *   cardano_metadatum_unref(&value); // Clean up the value resource
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_metadatum_unref(&key); // Clean up the key resource
+ * cardano_metadatum_map_unref(&metadatum_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_map_get(cardano_metadatum_map_t* metadatum_map, cardano_metadatum_t* key, cardano_metadatum_t** element);
+
+/**
+ * \brief Retrieves the key/value pair at the given index from a metadatum map.
+ *
+ * Returns the \a index-th entry of \p metadatum_map, providing both the key and the
+ * associated value via output parameters. The index is zero-based and must be
+ * less than the number of entries in the map.
+ *
+ * On success, \p *key and \p *element receive strong references to the key and value
+ * at the requested position. The caller becomes responsible for releasing both by
+ * calling \ref cardano_metadatum_unref on each.
+ *
+ * \param[in]  metadatum_map A pointer to the \ref cardano_metadatum_map_t to query.
+ * \param[in]  index         Zero-based index of the entry to retrieve.
+ * \param[out] key           Receives the key metadatum at \p index. Must not be NULL.
+ *                           On success, \p *key is non-NULL and must be released with
+ *                           \ref cardano_metadatum_unref.
+ * \param[out] element       Receives the value metadatum at \p index. Must not be NULL.
+ *                           On success, \p *element is non-NULL and must be released with
+ *                           \ref cardano_metadatum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS on success; an appropriate error code otherwise, e.g.:
+ *         - \ref CARDANO_ERROR_POINTER_IS_NULL if any required pointer is NULL;
+ *         - \ref CARDANO_ERROR_INDEX_OUT_OF_BOUNDS (or equivalent) if \p index is invalid;
+ *         - \ref CARDANO_ERROR_ENCODING (or equivalent) if retrieval fails unexpectedly.
+ *
+ * \note The iteration order is the map’s internal order and may not correspond to insertion order.
+ *
+ * \par Usage Example
+ * \code{.c}
+ * size_t len = cardano_metadatum_map_get_length(map);
+ *
+ * for (size_t i = 0; i < len; ++i)
+ * {
+ *   cardano_metadatum_t* key = NULL;
+ *   cardano_metadatum_t* val = NULL;
+ *
+ *   cardano_error_t rc = cardano_metadatum_map_get_at(map, i, &key, &val);
+ *   if (rc != CARDANO_SUCCESS) {
+ *     // handle error...
+ *     break;
+ *   }
+ *
+ *   // Use key/val...
+ *
+ *   cardano_metadatum_unref(&key);
+ *   cardano_metadatum_unref(&val);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_map_get_at(
+  cardano_metadatum_map_t* metadatum_map,
+  size_t                   index,
+  cardano_metadatum_t**    key,
+  cardano_metadatum_t**    element);
+
+/**
+ * \brief Inserts a key-value pair into the metadatum map.
+ *
+ * This function inserts the specified key-value pair into the provided metadatum map.
+ *
+ * \param[in] metadatum_map A constant pointer to the \ref cardano_metadatum_map_t object where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The key to be inserted into the metadatum map. The caller is responsible for managing
+ *                the lifecycle of the key object.
+ * \param[in] value The value to be associated with the key and inserted into the metadatum_map.
+ *                  The caller is responsible for managing the lifecycle of the value object.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_map_t* metadatum_map = cardano_metadatum_map_new();
+ *
+ * // Create key and value objects
+ * cardano_metadatum_t* key = ...; // Create a metadatum object representing the key
+ * cardano_metadatum_t* value = ...; // Create a metadatum object representing the value
+ *
+ * // Insert the key-value pair into the metadatum_map
+ * cardano_error_t result = cardano_metadatum_map_insert(metadatum_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value objects
+ * cardano_metadatum_unref(&key);
+ * cardano_metadatum_unref(&value);
+ *
+ * cardano_metadatum_map_unref(&metadatum_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_map_insert(cardano_metadatum_map_t* metadatum_map, cardano_metadatum_t* key, cardano_metadatum_t* value);
+
+/**
+ * \brief Retrieves the keys from the metadatum map.
+ *
+ * This function retrieves all the keys from the provided metadatum map and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_metadatum_list_unref when it is no longer needed.
+ *
+ * \param[in] metadatum_map A constant pointer to the \ref cardano_metadatum_map_t object from which
+ *                       the keys are to be retrieved.
+ * \param[out] keys A pointer to a variable where the retrieved keys will be stored as a list.
+ *                  If successful, this variable will be set to point to the list of keys.
+ *                  The caller is responsible for managing the lifecycle of this list.
+ *                  It must be released by calling \ref cardano_metadatum_list_unref when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the keys were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_map_t* metadatum_map = cardano_metadatum_map_new();
+ *
+ * // Populate the metadatum_map with key-value pairs
+ *
+ * cardano_metadatum_list_t* keys = NULL;
+ * cardano_error_t result = cardano_metadatum_map_get_keys(metadatum_map, &keys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of keys
+ *   // Keys must also be freed if retrieved from the list
+ *
+ *   // Once done, ensure to clean up and release the keys list
+ *   cardano_metadatum_list_unref(&keys);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_metadatum_map_unref(&metadatum_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_map_get_keys(cardano_metadatum_map_t* metadatum_map, cardano_metadatum_list_t** keys);
+
+/**
+ * \brief Retrieves the values from the metadatum map.
+ *
+ * This function retrieves all the values from the provided metadatum map and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_metadatum_list_unref when it is no longer needed.
+ *
+ * \param[in] metadatum_map A constant pointer to the \ref cardano_metadatum_map_t object from which
+ *                       the values are to be retrieved.
+ * \param[out] values A pointer to a variable where the retrieved values will be stored as a list.
+ *                    If successful, this variable will be set to point to the list of values.
+ *                    The caller is responsible for managing the lifecycle of this list.
+ *                    It must be released by calling \ref cardano_metadatum_list_unref when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the values were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_map_t* metadatum_map = cardano_metadatum_map_new();
+ *
+ * // Populate the metadatum_map with key-value pairs
+ *
+ * cardano_metadatum_list_t* values = NULL;
+ * cardano_error_t result = cardano_metadatum_map_get_values(metadatum_map, &values);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of values
+ *
+ *   // Once done, ensure to clean up and release the values list
+ *   // Values must also be freed if retrieved from the list
+ *   cardano_metadatum_list_unref(&values);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_metadatum_map_unref(&metadatum_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_metadatum_map_get_values(cardano_metadatum_map_t* metadatum_map, cardano_metadatum_list_t** values);
+
+/**
+ * \brief Checks if two metadatum maps are equal.
+ *
+ * This function compares two metadatum maps for equality. Two metadatum maps are considered equal if they
+ * have the same keys and associated values.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_metadatum_map_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_metadatum_map_t object to be compared.
+ *
+ * \return \c true if the two metadatum maps are equal, otherwise \c false.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_map_t* map1 = ...; // Populate the first metadatum map
+ * cardano_metadatum_map_t* map2 = ...; // Populate the second metadatum map
+ *
+ * if (cardano_metadatum_map_equals(map1, map2))
+ * {
+ *   // The two metadatum maps are equal
+ * }
+ * else
+ * {
+ *   // The two metadatum maps are not equal
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_metadatum_map_equals(const cardano_metadatum_map_t* lhs, const cardano_metadatum_map_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a metadatum_map object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_metadatum_map_t object
+ * by decreasing its reference count. When the reference count reaches zero, the metadatum_map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] metadatum_map A pointer to the pointer of the metadatum_map object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_metadatum_map_t* metadatum_map = cardano_metadatum_map_new();
+ *
+ * // Perform operations with the metadatum_map...
+ *
+ * cardano_metadatum_map_unref(&metadatum_map);
+ * // At this point, metadatum_map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_metadatum_map_unref, the pointer to the \ref cardano_metadatum_map_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_metadatum_map_unref(cardano_metadatum_map_t** metadatum_map);
+
+/**
+ * \brief Increases the reference count of the cardano_metadatum_map_t object.
+ *
+ * This function is used to manually increment the reference count of a metadatum_map
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_metadatum_map_unref.
+ *
+ * \param metadatum_map A pointer to the metadatum_map object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming metadatum_map is a previously created metadatum_map object
+ *
+ * cardano_metadatum_map_ref(metadatum_map);
+ *
+ * // Now metadatum_map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_metadatum_map_ref there is a corresponding
+ * call to \ref cardano_metadatum_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_metadatum_map_ref(cardano_metadatum_map_t* metadatum_map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_metadatum_map_t object.
+ *
+ * This function returns the number of active references to a metadatum_map object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_metadatum_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param metadatum_map A pointer to the metadatum_map object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified metadatum_map object. If the object
+ * is properly managed (i.e., every \ref cardano_metadatum_map_ref call is matched with a
+ * \ref cardano_metadatum_map_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming metadatum_map is a previously created metadatum_map object
+ *
+ * size_t ref_count = cardano_metadatum_map_refcount(metadatum_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_metadatum_map_refcount(const cardano_metadatum_map_t* metadatum_map);
+
+/**
+ * \brief Sets the last error message for a given metadatum_map object.
+ *
+ * Records an error message in the metadatum_map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] metadatum_map A pointer to the \ref cardano_metadatum_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the metadatum_map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_metadatum_map_set_last_error(cardano_metadatum_map_t* metadatum_map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific metadatum_map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_metadatum_map_set_last_error for the given
+ * metadatum_map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] metadatum_map A pointer to the \ref cardano_metadatum_map_t instance whose last error
+ *                   message is to be retrieved. If the metadatum_map is NULL, the function
+ *                   returns a generic error message indicating the null metadatum_map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified metadatum_map. If the metadatum_map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_metadatum_map_set_last_error for the same metadatum_map, or until
+ *       the metadatum_map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_metadatum_map_get_last_error(const cardano_metadatum_map_t* metadatum_map);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_metadatum_map_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_metadatum_map_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_metadatum_map_deep_clone(const cardano_metadatum_map_t* source, cardano_metadatum_map_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_METADATUM_MAP_H
diff --git a/vendor/include/cardano/auxiliary_data/plutus_v1_script_list.h b/vendor/include/cardano/auxiliary_data/plutus_v1_script_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/auxiliary_data/plutus_v1_script_list.h
@@ -0,0 +1,455 @@
+/**
+ * \file plutus_v1_script_list.h
+ *
+ * \author angel.castillo
+ * \date   Sep 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V1_SCRIPT_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V1_SCRIPT_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V1 was the initial version of Plutus, introduced in the Alonzo hard fork.
+ */
+typedef struct cardano_plutus_v1_script_t cardano_plutus_v1_script_t;
+
+/**
+ * \brief Represents a list of plutus v1 scripts.
+ */
+typedef struct cardano_plutus_v1_script_list_t cardano_plutus_v1_script_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_v1_script_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_plutus_v1_script_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] plutus_v1_script_list On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v1_script_list_t object. This object represents a "strong reference"
+ *             to the plutus_v1_script_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_v1_script_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v1_script_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_v1_script_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_list_t* plutus_v1_script_list = NULL;
+ *
+ * // Attempt to create a new plutus_v1_script_list
+ * cardano_error_t result = cardano_plutus_v1_script_list_new(&plutus_v1_script_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v1_script_list
+ *
+ *   // Once done, ensure to clean up and release the plutus_v1_script_list
+ *   cardano_plutus_v1_script_list_unref(&plutus_v1_script_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_list_new(cardano_plutus_v1_script_list_t** plutus_v1_script_list);
+
+/**
+ * \brief Creates a plutus v1 script list from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v1_script_list_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v1_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v1_script data.
+ * \param[out] plutus_v1_scripts A pointer to a pointer of \ref cardano_plutus_v1_script_list_t that will be set to the address
+ *                        of the newly created plutus_v1_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v1_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v1_script_list_t object by calling
+ *       \ref cardano_plutus_v1_script_list_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v1_script_list_t* plutus_v1_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v1_script_list_from_cbor(reader, &plutus_v1_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v1_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v1_script
+ *   cardano_plutus_v1_script_list_unref(&plutus_v1_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v1_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_list_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v1_script_list_t** plutus_v1_scripts);
+
+/**
+ * \brief Serializes a plutus_v1_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v1_script_list_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v1_scripts A constant pointer to the \ref cardano_plutus_v1_script_list_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v1_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_list_t* plutus_v1_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v1_script_list_to_cbor(plutus_v1_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v1_script_list_unref(&plutus_v1_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v1_script_list_to_cbor(
+  const cardano_plutus_v1_script_list_t* plutus_v1_scripts,
+  cardano_cbor_writer_t*                 writer);
+
+/**
+ * \brief Serializes a list of Plutus v1 scripts to CIP-116 JSON.
+ *
+ * Writes a JSON array where each element is a Plutus v1 script object with the shape:
+ *
+ * \code{.json}
+ * [
+ *   { "language": "plutus_v1", "bytes": "<hex-bytes>" },
+ *   { "language": "plutus_v1", "bytes": "<hex-bytes>" }
+ * ]
+ * \endcode
+ *
+ * This function emits the surrounding array brackets (`[` and `]`). It does not write a
+ * property name; if you need this list as a field value inside another object, write the
+ * property name first (via \ref cardano_json_writer_write_property_name) and then call
+ * this function.
+ *
+ * Keys in each element are emitted in a stable order: `"language"`, then `"bytes"`.
+ *
+ * \param[in] plutus_v1_scripts A valid pointer to a list of Plutus v1 scripts.
+ * \param[in,out] writer        A valid JSON writer. The function writes exactly one JSON array.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or:
+ *         - \ref CARDANO_ERROR_POINTER_IS_NULL if \p plutus_v1_scripts or \p writer is NULL.
+ *         - Any error propagated from underlying list accessors or element serialization.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_list_to_cip116_json(
+  const cardano_plutus_v1_script_list_t* plutus_v1_scripts,
+  cardano_json_writer_t*                 writer);
+
+/**
+ * \brief Retrieves the length of a plutus v1 script list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_plutus_v1_script_list_t object.
+ *
+ * \param[in] plutus_v1_script_list A constant pointer to the \ref cardano_plutus_v1_script_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the plutus_v1_script_list. Return 0 if the plutus_v1_script_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_list_t* plutus_v1_script_list = cardano_plutus_v1_script_list_new();
+ *
+ * // Populate plutus_v1_script_list with elements
+ *
+ * size_t length = cardano_plutus_v1_script_list_get_length(plutus_v1_script_list);
+ * printf("Length of the plutus_v1_script_list: %zu\n", length);
+ *
+ * // Clean up the plutus_v1_script_list object once done
+ * cardano_plutus_v1_script_list_unref(&plutus_v1_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v1_script_list_get_length(const cardano_plutus_v1_script_list_t* plutus_v1_script_list);
+
+/**
+ * \brief Retrieves an element from a plutus v1 script list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_plutus_v1_script_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] plutus_v1_script_list A constant pointer to the \ref cardano_plutus_v1_script_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the plutus v1 script list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_plutus_v1_script_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_plutus_v1_script_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_list_t* plutus_v1_script_list = cardano_plutus_v1_script_list_new();
+ *
+ * // Populate plutus_v1_script_list with elements
+ *
+ * cardano_plutus_v1_script_t* element = NULL;
+ * cardano_error_t result = cardano_plutus_v1_script_list_get(plutus_v1_script_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_plutus_v1_script_unref(&element);
+ * }
+ *
+ * // Clean up the plutus_v1_script_list object once done
+ * cardano_plutus_v1_script_list_unref(&plutus_v1_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v1_script_list_get(const cardano_plutus_v1_script_list_t* plutus_v1_script_list, size_t index, cardano_plutus_v1_script_t** element);
+
+/**
+ * \brief Adds an element to a plutus v1 script list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_plutus_v1_script_list_t object.
+ *
+ * \param[in] plutus_v1_script_list A constant pointer to the \ref cardano_plutus_v1_script_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_plutus_v1_script_t object that is to be added to the plutus_v1_script_list.
+ *                    The element will be referenced by the plutus_v1_script_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the plutus_v1_script_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_list_t* plutus_v1_script_list = cardano_plutus_v1_script_list_new();
+ *
+ * // Create and initialize a new plutus v1 script element
+ * cardano_plutus_v1_script_t* element = { ... };
+ *
+ * // Add the element to the plutus_v1_script_list
+ * cardano_error_t result = cardano_plutus_v1_script_list_add(plutus_v1_script_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the plutus_v1_script_list object once done
+ * cardano_plutus_v1_script_list_unref(&plutus_v1_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v1_script_list_add(cardano_plutus_v1_script_list_t* plutus_v1_script_list, cardano_plutus_v1_script_t* element);
+
+/**
+ * \brief Decrements the reference count of a plutus_v1_script_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v1_script_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v1_script_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v1_script_list A pointer to the pointer of the plutus_v1_script_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_list_t* plutus_v1_script_list = cardano_plutus_v1_script_list_new();
+ *
+ * // Perform operations with the plutus_v1_script_list...
+ *
+ * cardano_plutus_v1_script_list_unref(&plutus_v1_script_list);
+ * // At this point, plutus_v1_script_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v1_script_list_unref, the pointer to the \ref cardano_plutus_v1_script_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v1_script_list_unref(cardano_plutus_v1_script_list_t** plutus_v1_script_list);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v1_script_list_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v1_script_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v1_script_list_unref.
+ *
+ * \param plutus_v1_script_list A pointer to the plutus_v1_script_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v1_script_list is a previously created plutus_v1_script_list object
+ *
+ * cardano_plutus_v1_script_list_ref(plutus_v1_script_list);
+ *
+ * // Now plutus_v1_script_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v1_script_list_ref there is a corresponding
+ * call to \ref cardano_plutus_v1_script_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v1_script_list_ref(cardano_plutus_v1_script_list_t* plutus_v1_script_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v1_script_list_t object.
+ *
+ * This function returns the number of active references to a plutus_v1_script_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v1_script_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v1_script_list A pointer to the plutus_v1_script_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v1_script_list object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v1_script_list_ref call is matched with a
+ * \ref cardano_plutus_v1_script_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v1_script_list is a previously created plutus_v1_script_list object
+ *
+ * size_t ref_count = cardano_plutus_v1_script_list_refcount(plutus_v1_script_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v1_script_list_refcount(const cardano_plutus_v1_script_list_t* plutus_v1_script_list);
+
+/**
+ * \brief Sets the last error message for a given plutus_v1_script_list object.
+ *
+ * Records an error message in the plutus_v1_script_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v1_script_list A pointer to the \ref cardano_plutus_v1_script_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v1_script_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v1_script_list_set_last_error(cardano_plutus_v1_script_list_t* plutus_v1_script_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v1_script_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v1_script_list_set_last_error for the given
+ * plutus_v1_script_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v1_script_list A pointer to the \ref cardano_plutus_v1_script_list_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v1_script_list is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v1_script_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v1_script_list. If the plutus_v1_script_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v1_script_list_set_last_error for the same plutus_v1_script_list, or until
+ *       the plutus_v1_script_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v1_script_list_get_last_error(const cardano_plutus_v1_script_list_t* plutus_v1_script_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v1_script_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v1_script_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_list_deep_clone(const cardano_plutus_v1_script_list_t* source, cardano_plutus_v1_script_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V1_SCRIPT_LIST_H
diff --git a/vendor/include/cardano/auxiliary_data/plutus_v2_script_list.h b/vendor/include/cardano/auxiliary_data/plutus_v2_script_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/auxiliary_data/plutus_v2_script_list.h
@@ -0,0 +1,463 @@
+/**
+ * \file plutus_v2_script_list.h
+ *
+ * \author angel.castillo
+ * \date   Sep 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V2_SCRIPT_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V2_SCRIPT_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V2 was introduced in the Vasil hard fork.
+ *
+ * The main changes in V2 of Plutus were to the interface to scripts. The ScriptContext was extended
+ * to include the following information:
+ *
+ *  - The full “redeemers” structure, which contains all the redeemers used in the transaction
+ *  - Reference inputs in the transaction (proposed in CIP-31)
+ *  - Inline datums in the transaction (proposed in CIP-32)
+ *  - Reference scripts in the transaction (proposed in CIP-33)
+ */
+typedef struct cardano_plutus_v2_script_t cardano_plutus_v2_script_t;
+
+/**
+ * \brief Represents a list of plutus v2 scripts.
+ */
+typedef struct cardano_plutus_v2_script_list_t cardano_plutus_v2_script_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_v2_script_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_plutus_v2_script_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] plutus_v2_script_list On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v2_script_list_t object. This object represents a "strong reference"
+ *             to the plutus_v2_script_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_v2_script_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v2_script_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_v2_script_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_list_t* plutus_v2_script_list = NULL;
+ *
+ * // Attempt to create a new plutus_v2_script_list
+ * cardano_error_t result = cardano_plutus_v2_script_list_new(&plutus_v2_script_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v2_script_list
+ *
+ *   // Once done, ensure to clean up and release the plutus_v2_script_list
+ *   cardano_plutus_v2_script_list_unref(&plutus_v2_script_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_list_new(cardano_plutus_v2_script_list_t** plutus_v2_script_list);
+
+/**
+ * \brief Creates a plutus v2 script list from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v2_script_list_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v2_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v2_script data.
+ * \param[out] plutus_v2_scripts A pointer to a pointer of \ref cardano_plutus_v2_script_list_t that will be set to the address
+ *                        of the newly created plutus_v2_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v2_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v2_script_list_t object by calling
+ *       \ref cardano_plutus_v2_script_list_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v2_script_list_t* plutus_v2_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v2_script_list_from_cbor(reader, &plutus_v2_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v2_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v2_script
+ *   cardano_plutus_v2_script_list_unref(&plutus_v2_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v2_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_list_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v2_script_list_t** plutus_v2_scripts);
+
+/**
+ * \brief Serializes a plutus_v2_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v2_script_list_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v2_scripts A constant pointer to the \ref cardano_plutus_v2_script_list_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v2_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_list_t* plutus_v2_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v2_script_list_to_cbor(plutus_v2_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v2_script_list_unref(&plutus_v2_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v2_script_list_to_cbor(
+  const cardano_plutus_v2_script_list_t* plutus_v2_scripts,
+  cardano_cbor_writer_t*                 writer);
+
+/**
+ * \brief Serializes a list of Plutus v2 scripts to CIP-116 JSON.
+ *
+ * Writes a JSON array where each element is a Plutus v2 script object with the shape:
+ *
+ * \code{.json}
+ * [
+ *   { "language": "plutus_v2", "bytes": "<hex-bytes>" },
+ *   { "language": "plutus_v2", "bytes": "<hex-bytes>" }
+ * ]
+ * \endcode
+ *
+ * This function emits the surrounding array brackets (`[` and `]`). It does not write a
+ * property name; if you need this list as a field value inside another object, write the
+ * property name first (via \ref cardano_json_writer_write_property_name) and then call
+ * this function.
+ *
+ * Keys in each element are emitted in a stable order: `"language"`, then `"bytes"`.
+ *
+ * \param[in] plutus_v2_scripts A valid pointer to a list of Plutus v2 scripts.
+ * \param[in,out] writer        A valid JSON writer. The function writes exactly one JSON array.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or:
+ *         - \ref CARDANO_ERROR_POINTER_IS_NULL if \p plutus_v2_scripts or \p writer is NULL.
+ *         - Any error propagated from underlying list accessors or element serialization.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_list_to_cip116_json(
+  const cardano_plutus_v2_script_list_t* plutus_v2_scripts,
+  cardano_json_writer_t*                 writer);
+
+/**
+ * \brief Retrieves the length of a plutus v2 script list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_plutus_v2_script_list_t object.
+ *
+ * \param[in] plutus_v2_script_list A constant pointer to the \ref cardano_plutus_v2_script_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the plutus_v2_script_list. Return 0 if the plutus_v2_script_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_list_t* plutus_v2_script_list = cardano_plutus_v2_script_list_new();
+ *
+ * // Populate plutus_v2_script_list with elements
+ *
+ * size_t length = cardano_plutus_v2_script_list_get_length(plutus_v2_script_list);
+ * printf("Length of the plutus_v2_script_list: %zu\n", length);
+ *
+ * // Clean up the plutus_v2_script_list object once done
+ * cardano_plutus_v2_script_list_unref(&plutus_v2_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v2_script_list_get_length(const cardano_plutus_v2_script_list_t* plutus_v2_script_list);
+
+/**
+ * \brief Retrieves an element from a plutus v2 script list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_plutus_v2_script_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] plutus_v2_script_list A constant pointer to the \ref cardano_plutus_v2_script_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the plutus v2 script list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_plutus_v2_script_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_plutus_v2_script_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_list_t* plutus_v2_script_list = cardano_plutus_v2_script_list_new();
+ *
+ * // Populate plutus_v2_script_list with elements
+ *
+ * cardano_plutus_v2_script_t* element = NULL;
+ * cardano_error_t result = cardano_plutus_v2_script_list_get(plutus_v2_script_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_plutus_v2_script_unref(&element);
+ * }
+ *
+ * // Clean up the plutus_v2_script_list object once done
+ * cardano_plutus_v2_script_list_unref(&plutus_v2_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v2_script_list_get(const cardano_plutus_v2_script_list_t* plutus_v2_script_list, size_t index, cardano_plutus_v2_script_t** element);
+
+/**
+ * \brief Adds an element to a plutus v2 script list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_plutus_v2_script_list_t object.
+ *
+ * \param[in] plutus_v2_script_list A constant pointer to the \ref cardano_plutus_v2_script_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_plutus_v2_script_t object that is to be added to the plutus_v2_script_list.
+ *                    The element will be referenced by the plutus_v2_script_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the plutus_v2_script_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_list_t* plutus_v2_script_list = cardano_plutus_v2_script_list_new();
+ *
+ * // Create and initialize a new plutus v2 script element
+ * cardano_plutus_v2_script_t* element = { ... };
+ *
+ * // Add the element to the plutus_v2_script_list
+ * cardano_error_t result = cardano_plutus_v2_script_list_add(plutus_v2_script_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the plutus_v2_script_list object once done
+ * cardano_plutus_v2_script_list_unref(&plutus_v2_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v2_script_list_add(cardano_plutus_v2_script_list_t* plutus_v2_script_list, cardano_plutus_v2_script_t* element);
+
+/**
+ * \brief Decrements the reference count of a plutus_v2_script_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v2_script_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v2_script_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v2_script_list A pointer to the pointer of the plutus_v2_script_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_list_t* plutus_v2_script_list = cardano_plutus_v2_script_list_new();
+ *
+ * // Perform operations with the plutus_v2_script_list...
+ *
+ * cardano_plutus_v2_script_list_unref(&plutus_v2_script_list);
+ * // At this point, plutus_v2_script_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v2_script_list_unref, the pointer to the \ref cardano_plutus_v2_script_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v2_script_list_unref(cardano_plutus_v2_script_list_t** plutus_v2_script_list);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v2_script_list_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v2_script_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v2_script_list_unref.
+ *
+ * \param plutus_v2_script_list A pointer to the plutus_v2_script_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v2_script_list is a previously created plutus_v2_script_list object
+ *
+ * cardano_plutus_v2_script_list_ref(plutus_v2_script_list);
+ *
+ * // Now plutus_v2_script_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v2_script_list_ref there is a corresponding
+ * call to \ref cardano_plutus_v2_script_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v2_script_list_ref(cardano_plutus_v2_script_list_t* plutus_v2_script_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v2_script_list_t object.
+ *
+ * This function returns the number of active references to a plutus_v2_script_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v2_script_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v2_script_list A pointer to the plutus_v2_script_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v2_script_list object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v2_script_list_ref call is matched with a
+ * \ref cardano_plutus_v2_script_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v2_script_list is a previously created plutus_v2_script_list object
+ *
+ * size_t ref_count = cardano_plutus_v2_script_list_refcount(plutus_v2_script_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v2_script_list_refcount(const cardano_plutus_v2_script_list_t* plutus_v2_script_list);
+
+/**
+ * \brief Sets the last error message for a given plutus_v2_script_list object.
+ *
+ * Records an error message in the plutus_v2_script_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v2_script_list A pointer to the \ref cardano_plutus_v2_script_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v2_script_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v2_script_list_set_last_error(cardano_plutus_v2_script_list_t* plutus_v2_script_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v2_script_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v2_script_list_set_last_error for the given
+ * plutus_v2_script_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v2_script_list A pointer to the \ref cardano_plutus_v2_script_list_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v2_script_list is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v2_script_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v2_script_list. If the plutus_v2_script_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v2_script_list_set_last_error for the same plutus_v2_script_list, or until
+ *       the plutus_v2_script_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v2_script_list_get_last_error(const cardano_plutus_v2_script_list_t* plutus_v2_script_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v2_script_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v2_script_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_list_deep_clone(const cardano_plutus_v2_script_list_t* source, cardano_plutus_v2_script_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V2_SCRIPT_LIST_H
diff --git a/vendor/include/cardano/auxiliary_data/plutus_v3_script_list.h b/vendor/include/cardano/auxiliary_data/plutus_v3_script_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/auxiliary_data/plutus_v3_script_list.h
@@ -0,0 +1,463 @@
+/**
+ * \file plutus_v3_script_list.h
+ *
+ * \author angel.castillo
+ * \date   Sep 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V3_SCRIPT_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V3_SCRIPT_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V3 was introduced in the Conway hard fork.
+ *
+ * The main changes in V3 of Plutus were to the interface to scripts. The ScriptContext was extended
+ * to include the following information:
+ *
+ *  - A Map with all the votes that were included in the transaction.
+ *  - A list with Proposals that will be turned into GovernanceActions, that everyone can vote on
+ *  - Optional amount for the current treasury. If included it will be checked to be equal the current amount in the treasury.
+ *  - Optional amount for donating to the current treasury. If included, specified amount will go into the treasury.
+ */
+typedef struct cardano_plutus_v3_script_t cardano_plutus_v3_script_t;
+
+/**
+ * \brief Represents a list of plutus v3 scripts.
+ */
+typedef struct cardano_plutus_v3_script_list_t cardano_plutus_v3_script_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_v3_script_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_plutus_v3_script_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] plutus_v3_script_list On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v3_script_list_t object. This object represents a "strong reference"
+ *             to the plutus_v3_script_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_v3_script_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v3_script_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_v3_script_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_list_t* plutus_v3_script_list = NULL;
+ *
+ * // Attempt to create a new plutus_v3_script_list
+ * cardano_error_t result = cardano_plutus_v3_script_list_new(&plutus_v3_script_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v3_script_list
+ *
+ *   // Once done, ensure to clean up and release the plutus_v3_script_list
+ *   cardano_plutus_v3_script_list_unref(&plutus_v3_script_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_list_new(cardano_plutus_v3_script_list_t** plutus_v3_script_list);
+
+/**
+ * \brief Creates a plutus v3 script list from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v3_script_list_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v3_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v3_script data.
+ * \param[out] plutus_v3_scripts A pointer to a pointer of \ref cardano_plutus_v3_script_list_t that will be set to the address
+ *                        of the newly created plutus_v3_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v3_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v3_script_list_t object by calling
+ *       \ref cardano_plutus_v3_script_list_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v3_script_list_t* plutus_v3_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v3_script_list_from_cbor(reader, &plutus_v3_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v3_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v3_script
+ *   cardano_plutus_v3_script_list_unref(&plutus_v3_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v3_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_list_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v3_script_list_t** plutus_v3_scripts);
+
+/**
+ * \brief Serializes a plutus_v3_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v3_script_list_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v3_scripts A constant pointer to the \ref cardano_plutus_v3_script_list_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v3_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_list_t* plutus_v3_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v3_script_list_to_cbor(plutus_v3_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v3_script_list_unref(&plutus_v3_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v3_script_list_to_cbor(
+  const cardano_plutus_v3_script_list_t* plutus_v3_scripts,
+  cardano_cbor_writer_t*                 writer);
+
+/**
+ * \brief Serializes a list of Plutus v3 scripts to CIP-116 JSON.
+ *
+ * Writes a JSON array where each element is a Plutus v3 script object with the shape:
+ *
+ * \code{.json}
+ * [
+ *   { "language": "plutus_v3", "bytes": "<hex-bytes>" },
+ *   { "language": "plutus_v3", "bytes": "<hex-bytes>" }
+ * ]
+ * \endcode
+ *
+ * This function emits the surrounding array brackets (`[` and `]`). It does not write a
+ * property name; if you need this list as a field value inside another object, write the
+ * property name first (via \ref cardano_json_writer_write_property_name) and then call
+ * this function.
+ *
+ * Keys in each element are emitted in a stable order: `"language"`, then `"bytes"`.
+ *
+ * \param[in] plutus_v3_scripts A valid pointer to a list of Plutus v3 scripts.
+ * \param[in,out] writer        A valid JSON writer. The function writes exactly one JSON array.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or:
+ *         - \ref CARDANO_ERROR_POINTER_IS_NULL if \p plutus_v3_scripts or \p writer is NULL.
+ *         - Any error propagated from underlying list accessors or element serialization.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_list_to_cip116_json(
+  const cardano_plutus_v3_script_list_t* plutus_v3_scripts,
+  cardano_json_writer_t*                 writer);
+
+/**
+ * \brief Retrieves the length of a plutus v3 script list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_plutus_v3_script_list_t object.
+ *
+ * \param[in] plutus_v3_script_list A constant pointer to the \ref cardano_plutus_v3_script_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the plutus_v3_script_list. Return 0 if the plutus_v3_script_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_list_t* plutus_v3_script_list = cardano_plutus_v3_script_list_new();
+ *
+ * // Populate plutus_v3_script_list with elements
+ *
+ * size_t length = cardano_plutus_v3_script_list_get_length(plutus_v3_script_list);
+ * printf("Length of the plutus_v3_script_list: %zu\n", length);
+ *
+ * // Clean up the plutus_v3_script_list object once done
+ * cardano_plutus_v3_script_list_unref(&plutus_v3_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v3_script_list_get_length(const cardano_plutus_v3_script_list_t* plutus_v3_script_list);
+
+/**
+ * \brief Retrieves an element from a plutus v3 script list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_plutus_v3_script_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] plutus_v3_script_list A constant pointer to the \ref cardano_plutus_v3_script_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the plutus v3 script list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_plutus_v3_script_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_plutus_v3_script_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_list_t* plutus_v3_script_list = cardano_plutus_v3_script_list_new();
+ *
+ * // Populate plutus_v3_script_list with elements
+ *
+ * cardano_plutus_v3_script_t* element = NULL;
+ * cardano_error_t result = cardano_plutus_v3_script_list_get(plutus_v3_script_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_plutus_v3_script_unref(&element);
+ * }
+ *
+ * // Clean up the plutus_v3_script_list object once done
+ * cardano_plutus_v3_script_list_unref(&plutus_v3_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v3_script_list_get(const cardano_plutus_v3_script_list_t* plutus_v3_script_list, size_t index, cardano_plutus_v3_script_t** element);
+
+/**
+ * \brief Adds an element to a plutus v3 script list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_plutus_v3_script_list_t object.
+ *
+ * \param[in] plutus_v3_script_list A constant pointer to the \ref cardano_plutus_v3_script_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_plutus_v3_script_t object that is to be added to the plutus_v3_script_list.
+ *                    The element will be referenced by the plutus_v3_script_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the plutus_v3_script_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_list_t* plutus_v3_script_list = cardano_plutus_v3_script_list_new();
+ *
+ * // Create and initialize a new plutus v3 script element
+ * cardano_plutus_v3_script_t* element = { ... };
+ *
+ * // Add the element to the plutus_v3_script_list
+ * cardano_error_t result = cardano_plutus_v3_script_list_add(plutus_v3_script_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the plutus_v3_script_list object once done
+ * cardano_plutus_v3_script_list_unref(&plutus_v3_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v3_script_list_add(cardano_plutus_v3_script_list_t* plutus_v3_script_list, cardano_plutus_v3_script_t* element);
+
+/**
+ * \brief Decrements the reference count of a plutus_v3_script_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v3_script_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v3_script_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v3_script_list A pointer to the pointer of the plutus_v3_script_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_list_t* plutus_v3_script_list = cardano_plutus_v3_script_list_new();
+ *
+ * // Perform operations with the plutus_v3_script_list...
+ *
+ * cardano_plutus_v3_script_list_unref(&plutus_v3_script_list);
+ * // At this point, plutus_v3_script_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v3_script_list_unref, the pointer to the \ref cardano_plutus_v3_script_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v3_script_list_unref(cardano_plutus_v3_script_list_t** plutus_v3_script_list);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v3_script_list_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v3_script_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v3_script_list_unref.
+ *
+ * \param plutus_v3_script_list A pointer to the plutus_v3_script_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v3_script_list is a previously created plutus_v3_script_list object
+ *
+ * cardano_plutus_v3_script_list_ref(plutus_v3_script_list);
+ *
+ * // Now plutus_v3_script_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v3_script_list_ref there is a corresponding
+ * call to \ref cardano_plutus_v3_script_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v3_script_list_ref(cardano_plutus_v3_script_list_t* plutus_v3_script_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v3_script_list_t object.
+ *
+ * This function returns the number of active references to a plutus_v3_script_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v3_script_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v3_script_list A pointer to the plutus_v3_script_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v3_script_list object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v3_script_list_ref call is matched with a
+ * \ref cardano_plutus_v3_script_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v3_script_list is a previously created plutus_v3_script_list object
+ *
+ * size_t ref_count = cardano_plutus_v3_script_list_refcount(plutus_v3_script_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v3_script_list_refcount(const cardano_plutus_v3_script_list_t* plutus_v3_script_list);
+
+/**
+ * \brief Sets the last error message for a given plutus_v3_script_list object.
+ *
+ * Records an error message in the plutus_v3_script_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v3_script_list A pointer to the \ref cardano_plutus_v3_script_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v3_script_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v3_script_list_set_last_error(cardano_plutus_v3_script_list_t* plutus_v3_script_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v3_script_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v3_script_list_set_last_error for the given
+ * plutus_v3_script_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v3_script_list A pointer to the \ref cardano_plutus_v3_script_list_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v3_script_list is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v3_script_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v3_script_list. If the plutus_v3_script_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v3_script_list_set_last_error for the same plutus_v3_script_list, or until
+ *       the plutus_v3_script_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v3_script_list_get_last_error(const cardano_plutus_v3_script_list_t* plutus_v3_script_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v3_script_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v3_script_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_list_deep_clone(const cardano_plutus_v3_script_list_t* source, cardano_plutus_v3_script_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V3_SCRIPT_LIST_H
diff --git a/vendor/include/cardano/auxiliary_data/plutus_v4_script_list.h b/vendor/include/cardano/auxiliary_data/plutus_v4_script_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/auxiliary_data/plutus_v4_script_list.h
@@ -0,0 +1,459 @@
+/**
+ * \file plutus_v4_script_list.h
+ *
+ * \author angel.castillo
+ * \date   Jul 17, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V4_SCRIPT_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V4_SCRIPT_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V4 was introduced in the Dijkstra hard fork.
+ *
+ * V4 scripts run from protocol version 12. They can be serialized in transactions as witness set
+ * scripts, reference scripts or auxiliary data scripts, and they are the only Plutus scripts that
+ * run inside a sub transaction.
+ */
+typedef struct cardano_plutus_v4_script_t cardano_plutus_v4_script_t;
+
+/**
+ * \brief Represents a list of plutus v4 scripts.
+ */
+typedef struct cardano_plutus_v4_script_list_t cardano_plutus_v4_script_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_v4_script_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_plutus_v4_script_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] plutus_v4_script_list On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v4_script_list_t object. This object represents a "strong reference"
+ *             to the plutus_v4_script_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_v4_script_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v4_script_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_v4_script_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_list_t* plutus_v4_script_list = NULL;
+ *
+ * // Attempt to create a new plutus_v4_script_list
+ * cardano_error_t result = cardano_plutus_v4_script_list_new(&plutus_v4_script_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v4_script_list
+ *
+ *   // Once done, ensure to clean up and release the plutus_v4_script_list
+ *   cardano_plutus_v4_script_list_unref(&plutus_v4_script_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_list_new(cardano_plutus_v4_script_list_t** plutus_v4_script_list);
+
+/**
+ * \brief Creates a plutus v4 script list from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v4_script_list_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v4_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v4_script data.
+ * \param[out] plutus_v4_scripts A pointer to a pointer of \ref cardano_plutus_v4_script_list_t that will be set to the address
+ *                        of the newly created plutus_v4_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v4_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v4_script_list_t object by calling
+ *       \ref cardano_plutus_v4_script_list_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v4_script_list_t* plutus_v4_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v4_script_list_from_cbor(reader, &plutus_v4_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v4_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v4_script
+ *   cardano_plutus_v4_script_list_unref(&plutus_v4_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v4_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_list_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v4_script_list_t** plutus_v4_scripts);
+
+/**
+ * \brief Serializes a plutus_v4_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v4_script_list_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v4_scripts A constant pointer to the \ref cardano_plutus_v4_script_list_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v4_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_list_t* plutus_v4_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v4_script_list_to_cbor(plutus_v4_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v4_script_list_unref(&plutus_v4_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v4_script_list_to_cbor(
+  const cardano_plutus_v4_script_list_t* plutus_v4_scripts,
+  cardano_cbor_writer_t*                 writer);
+
+/**
+ * \brief Serializes a list of Plutus v4 scripts to CIP-116 JSON.
+ *
+ * Writes a JSON array where each element is a Plutus v4 script object with the shape:
+ *
+ * \code{.json}
+ * [
+ *   { "language": "plutus_v4", "bytes": "<hex-bytes>" },
+ *   { "language": "plutus_v4", "bytes": "<hex-bytes>" }
+ * ]
+ * \endcode
+ *
+ * This function emits the surrounding array brackets (`[` and `]`). It does not write a
+ * property name; if you need this list as a field value inside another object, write the
+ * property name first (via \ref cardano_json_writer_write_property_name) and then call
+ * this function.
+ *
+ * Keys in each element are emitted in a stable order: `"language"`, then `"bytes"`.
+ *
+ * \param[in] plutus_v4_scripts A valid pointer to a list of Plutus v4 scripts.
+ * \param[in,out] writer        A valid JSON writer. The function writes exactly one JSON array.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or:
+ *         - \ref CARDANO_ERROR_POINTER_IS_NULL if \p plutus_v4_scripts or \p writer is NULL.
+ *         - Any error propagated from underlying list accessors or element serialization.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_list_to_cip116_json(
+  const cardano_plutus_v4_script_list_t* plutus_v4_scripts,
+  cardano_json_writer_t*                 writer);
+
+/**
+ * \brief Retrieves the length of a plutus v4 script list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_plutus_v4_script_list_t object.
+ *
+ * \param[in] plutus_v4_script_list A constant pointer to the \ref cardano_plutus_v4_script_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the plutus_v4_script_list. Return 0 if the plutus_v4_script_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_list_t* plutus_v4_script_list = cardano_plutus_v4_script_list_new();
+ *
+ * // Populate plutus_v4_script_list with elements
+ *
+ * size_t length = cardano_plutus_v4_script_list_get_length(plutus_v4_script_list);
+ * printf("Length of the plutus_v4_script_list: %zu\n", length);
+ *
+ * // Clean up the plutus_v4_script_list object once done
+ * cardano_plutus_v4_script_list_unref(&plutus_v4_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v4_script_list_get_length(const cardano_plutus_v4_script_list_t* plutus_v4_script_list);
+
+/**
+ * \brief Retrieves an element from a plutus v4 script list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_plutus_v4_script_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] plutus_v4_script_list A constant pointer to the \ref cardano_plutus_v4_script_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the plutus v4 script list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_plutus_v4_script_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_plutus_v4_script_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_list_t* plutus_v4_script_list = cardano_plutus_v4_script_list_new();
+ *
+ * // Populate plutus_v4_script_list with elements
+ *
+ * cardano_plutus_v4_script_t* element = NULL;
+ * cardano_error_t result = cardano_plutus_v4_script_list_get(plutus_v4_script_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_plutus_v4_script_unref(&element);
+ * }
+ *
+ * // Clean up the plutus_v4_script_list object once done
+ * cardano_plutus_v4_script_list_unref(&plutus_v4_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v4_script_list_get(const cardano_plutus_v4_script_list_t* plutus_v4_script_list, size_t index, cardano_plutus_v4_script_t** element);
+
+/**
+ * \brief Adds an element to a plutus v4 script list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_plutus_v4_script_list_t object.
+ *
+ * \param[in] plutus_v4_script_list A constant pointer to the \ref cardano_plutus_v4_script_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_plutus_v4_script_t object that is to be added to the plutus_v4_script_list.
+ *                    The element will be referenced by the plutus_v4_script_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the plutus_v4_script_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_list_t* plutus_v4_script_list = cardano_plutus_v4_script_list_new();
+ *
+ * // Create and initialize a new plutus v4 script element
+ * cardano_plutus_v4_script_t* element = { ... };
+ *
+ * // Add the element to the plutus_v4_script_list
+ * cardano_error_t result = cardano_plutus_v4_script_list_add(plutus_v4_script_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the plutus_v4_script_list object once done
+ * cardano_plutus_v4_script_list_unref(&plutus_v4_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v4_script_list_add(cardano_plutus_v4_script_list_t* plutus_v4_script_list, cardano_plutus_v4_script_t* element);
+
+/**
+ * \brief Decrements the reference count of a plutus_v4_script_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v4_script_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v4_script_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v4_script_list A pointer to the pointer of the plutus_v4_script_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_list_t* plutus_v4_script_list = cardano_plutus_v4_script_list_new();
+ *
+ * // Perform operations with the plutus_v4_script_list...
+ *
+ * cardano_plutus_v4_script_list_unref(&plutus_v4_script_list);
+ * // At this point, plutus_v4_script_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v4_script_list_unref, the pointer to the \ref cardano_plutus_v4_script_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v4_script_list_unref(cardano_plutus_v4_script_list_t** plutus_v4_script_list);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v4_script_list_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v4_script_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v4_script_list_unref.
+ *
+ * \param plutus_v4_script_list A pointer to the plutus_v4_script_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v4_script_list is a previously created plutus_v4_script_list object
+ *
+ * cardano_plutus_v4_script_list_ref(plutus_v4_script_list);
+ *
+ * // Now plutus_v4_script_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v4_script_list_ref there is a corresponding
+ * call to \ref cardano_plutus_v4_script_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v4_script_list_ref(cardano_plutus_v4_script_list_t* plutus_v4_script_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v4_script_list_t object.
+ *
+ * This function returns the number of active references to a plutus_v4_script_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v4_script_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v4_script_list A pointer to the plutus_v4_script_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v4_script_list object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v4_script_list_ref call is matched with a
+ * \ref cardano_plutus_v4_script_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v4_script_list is a previously created plutus_v4_script_list object
+ *
+ * size_t ref_count = cardano_plutus_v4_script_list_refcount(plutus_v4_script_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v4_script_list_refcount(const cardano_plutus_v4_script_list_t* plutus_v4_script_list);
+
+/**
+ * \brief Sets the last error message for a given plutus_v4_script_list object.
+ *
+ * Records an error message in the plutus_v4_script_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v4_script_list A pointer to the \ref cardano_plutus_v4_script_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v4_script_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v4_script_list_set_last_error(cardano_plutus_v4_script_list_t* plutus_v4_script_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v4_script_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v4_script_list_set_last_error for the given
+ * plutus_v4_script_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v4_script_list A pointer to the \ref cardano_plutus_v4_script_list_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v4_script_list is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v4_script_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v4_script_list. If the plutus_v4_script_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v4_script_list_set_last_error for the same plutus_v4_script_list, or until
+ *       the plutus_v4_script_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v4_script_list_get_last_error(const cardano_plutus_v4_script_list_t* plutus_v4_script_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v4_script_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v4_script_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_list_deep_clone(const cardano_plutus_v4_script_list_t* source, cardano_plutus_v4_script_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V4_SCRIPT_LIST_H
diff --git a/vendor/include/cardano/auxiliary_data/transaction_metadata.h b/vendor/include/cardano/auxiliary_data/transaction_metadata.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/auxiliary_data/transaction_metadata.h
@@ -0,0 +1,626 @@
+/**
+ * \file transaction_metadata.h
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_METADATA_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_METADATA_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/metadatum.h>
+#include <cardano/auxiliary_data/metadatum_label_list.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of metadatum_label to metadatum.
+ */
+typedef struct cardano_transaction_metadata_t cardano_transaction_metadata_t;
+
+/**
+ * \brief Creates and initializes a new instance of a transaction_metadata.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_transaction_metadata_t.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] transaction_metadata A pointer to a pointer to a \ref cardano_transaction_metadata_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_transaction_metadata_t
+ *                        object. This object represents a "strong reference" to the transaction_metadata,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the transaction_metadata is no longer
+ *                        needed, the caller must release it by calling \ref cardano_transaction_metadata_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction_metadata was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_metadata_t* transaction_metadata = NULL;
+ *
+ * // Attempt to create a new transaction_metadata
+ * cardano_error_t result = cardano_transaction_metadata_new(&transaction_metadata);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction_metadata
+ *
+ *   // Once done, ensure to clean up and release the transaction_metadata
+ *   cardano_transaction_metadata_unref(&transaction_metadata);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_metadata_new(cardano_transaction_metadata_t** transaction_metadata);
+
+/**
+ * \brief Creates a transaction_metadata from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_transaction_metadata_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a transaction_metadata.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded transaction_metadata data.
+ * \param[out] transaction_metadata A pointer to a pointer of \ref cardano_transaction_metadata_t that will be set to the address
+ *                        of the newly created transaction_metadata object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the transaction_metadata was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_transaction_metadata_t object by calling
+ *       \ref cardano_transaction_metadata_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_transaction_metadata_t* transaction_metadata = NULL;
+ *
+ * cardano_error_t result = cardano_transaction_metadata_from_cbor(reader, &transaction_metadata);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction_metadata
+ *
+ *   // Once done, ensure to clean up and release the transaction_metadata
+ *   cardano_transaction_metadata_unref(&transaction_metadata);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode transaction_metadata: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_metadata_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_metadata_t** transaction_metadata);
+
+/**
+ * \brief Serializes a transaction_metadata into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_transaction_metadata_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] transaction_metadata A constant pointer to the \ref cardano_transaction_metadata_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p transaction_metadata or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_metadata_t* transaction_metadata = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_transaction_metadata_to_cbor(transaction_metadata, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_transaction_metadata_unref(&transaction_metadata);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_metadata_to_cbor(
+  const cardano_transaction_metadata_t* transaction_metadata,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes transaction metadata to CIP-116 JSON.
+ *
+ * This function writes the transaction metadata (a map of metadatum labels to values)
+ * as a JSON array of key/value entries using the CIP-116 shape.
+ *
+ * Notes:
+ * - The \c key is the metadatum label serialized as a **decimal string**.
+ * - The \c value is produced by \ref cardano_metadatum_to_cip116_json.
+ * - The function writes both the opening `[` and closing `]` of the array.
+ * - The writer must be in a context where a JSON value is valid.
+ *
+ * \param[in]  metadata A valid pointer to a \ref cardano_transaction_metadata_t instance.
+ * \param[in]  writer   A valid pointer to a \ref cardano_json_writer_t positioned where a value is expected.
+ *
+ * \return \ref CARDANO_SUCCESS on success;
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if any pointer parameter is \c NULL;
+ *         \ref CARDANO_ERROR_ENCODING if an element cannot be retrieved or serialized.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_metadata_to_cip116_json(
+  const cardano_transaction_metadata_t* metadata,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Retrieves the length of the transaction metadata.
+ *
+ * This function returns the number of key-value pairs contained in the specified transaction metadata.
+ *
+ * \param[in] transaction_metadata A constant pointer to the \ref cardano_transaction_metadata_t object for which
+ *                       the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the transaction_metadata. Returns 0 if the transaction_metadata is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_metadata_t* transaction_metadata = cardano_transaction_metadata_new();
+ *
+ * // Populate the transaction_metadata with key-value pairs
+ *
+ * size_t length = cardano_transaction_metadata_get_length(transaction_metadata);
+ * printf("The length of the transaction_metadata is: %zu\n", length);
+ *
+ * cardano_transaction_metadata_unref(&transaction_metadata);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_transaction_metadata_get_length(const cardano_transaction_metadata_t* transaction_metadata);
+
+/**
+ * \brief Retrieves the value associated with a given key in the transaction_metadata.
+ *
+ * This function retrieves the value associated with the specified key in the provided transaction_metadata.
+ * It returns the value through the output parameter `element`. If the key is not found in the transaction_metadata,
+ * the output parameter `element` will be set to NULL.
+ *
+ * \param[in] transaction_metadata A constant pointer to the \ref cardano_transaction_metadata_t object from which
+ *                       the value is to be retrieved.
+ * \param[in] key The key whose associated value is to be retrieved from the transaction_metadata.
+ * \param[out] element A pointer to a variable where the retrieved value will be stored. If the key
+ *                     is found in the transaction_metadata, this variable will be set to the associated value.
+ *                     If the key is not found, this variable will be set to NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value associated with the key was successfully retrieved, or
+ *         an appropriate error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_metadata_t* transaction_metadata = cardano_transaction_metadata_new();
+ *
+ * // Populate the transaction_metadata with key-value pairs
+ *
+ * uint64_t key = 0;
+ * cardano_metadatum_t* value = NULL;
+ * cardano_error_t result = cardano_transaction_metadata_get(transaction_metadata, key, &value);
+ *
+ * if (result == CARDANO_SUCCESS && value != NULL)
+ * {
+ *   // Use the retrieved value
+ *   // ...
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_metadatum_unref(&value); // Clean up the value resource
+ * cardano_transaction_metadata_unref(&transaction_metadata);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_metadata_get(cardano_transaction_metadata_t* transaction_metadata, uint64_t key, cardano_metadatum_t** element);
+
+/**
+ * \brief Inserts a key-value pair into the transaction_metadata.
+ *
+ * This function inserts the specified key-value pair into the provided transaction_metadata.
+ *
+ * \param[in] transaction_metadata A constant pointer to the \ref cardano_transaction_metadata_t object where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The key to be inserted into the transaction_metadata.
+ * \param[in] value The value to be associated with the key and inserted into the transaction_metadata.
+ *                  The caller is responsible for managing the lifecycle of the value object.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_metadata_t* transaction_metadata = cardano_transaction_metadata_new();
+ *
+ * // Create key and value objects
+ * uint64_t key = 755;
+ * cardano_metadatum_t* value = {...}; // Assume value is properly initialized
+ *
+ * // Insert the key-value pair into the transaction_metadata
+ * cardano_error_t result = cardano_transaction_metadata_insert(transaction_metadata, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value objects
+ * cardano_metadatum_unref(&value);
+ * cardano_transaction_metadata_unref(&transaction_metadata);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_metadata_insert(cardano_transaction_metadata_t* transaction_metadata, uint64_t key, cardano_metadatum_t* value);
+
+/**
+ * \brief Retrieves the keys from the transaction_metadata.
+ *
+ * This function retrieves all the keys from the provided transaction_metadata and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_metadatum_label_list_t when it is no longer needed.
+ *
+ * \param[in] transaction_metadata A constant pointer to the \ref cardano_transaction_metadata_t object from which
+ *                       the keys are to be retrieved.
+ * \param[out] keys A pointer to a variable where the retrieved keys will be stored as a list.
+ *                  If successful, this variable will be set to point to the list of keys.
+ *                  The caller is responsible for managing the lifecycle of this list.
+ *                  It must be released by calling \ref cardano_metadatum_label_list_unref when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the keys were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_metadata_t* transaction_metadata = cardano_transaction_metadata_new();
+ *
+ * // Populate the transaction_metadata with key-value pairs
+ *
+ * cardano_metadatum_label_list_t* keys = NULL;
+ * cardano_error_t result = cardano_transaction_metadata_get_keys(transaction_metadata, &keys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of keys
+ *   // Keys must also be freed if retrieved from the list
+ *
+ *   // Once done, ensure to clean up and release the keys list
+ *   cardano_metadatum_label_list_unref(&keys);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_transaction_metadata_unref(&transaction_metadata);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_metadata_get_keys(cardano_transaction_metadata_t* transaction_metadata, cardano_metadatum_label_list_t** keys);
+
+/**
+ * \brief Retrieves the metadatum label at a specific index from the transaction metadata.
+ *
+ * This function retrieves the metadatum label at the specified index from the transaction_metadata.
+ *
+ * \param[in] transaction_metadata Pointer to the transaction_metadata object.
+ * \param[in] index The index of the metadatum label to retrieve.
+ * \param[out] metadatum_label The metadatum label as \c uint64_t.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the metadatum label was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_metadata_t* transaction_metadata = NULL;
+ * uint64_t metadatum_label = 0;
+ * size_t index = 0; // Index of the key hash to retrieve
+ *
+ * // Assume transaction_metadata is initialized properly
+ *
+ * cardano_error_t result = cardano_transaction_metadata_get_key_at(transaction_metadata, index, &metadatum_label);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum_label
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_metadata_get_key_at(
+  const cardano_transaction_metadata_t* transaction_metadata,
+  size_t                                index,
+  uint64_t*                             metadatum_label);
+
+/**
+ * \brief Retrieves the metadatum at a specific index from the transaction_metadata.
+ *
+ * This function retrieves the metadatum at the specified index from the transaction_metadata.
+ *
+ * \param[in] transaction_metadata Pointer to the transaction_metadata object.
+ * \param[in] index The index of the metadatum to retrieve.
+ * \param[out] metadatum On successful retrieval, this will point to the metadatum
+ *                    at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the metadatum was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_metadata_t* transaction_metadata = NULL;
+ * cardano_metadatum_t* metadatum = 0;
+ * size_t index = 0; // Index of the metadatum to retrieve
+ *
+ * // Assume transaction_metadata is initialized properly
+ *
+ * cardano_error_t result = cardano_transaction_metadata_get_value_at(transaction_metadata, index, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the metadatum
+ *   cardano_metadatum_unref(&metadatum);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_metadata_get_value_at(
+  const cardano_transaction_metadata_t* transaction_metadata,
+  size_t                                index,
+  cardano_metadatum_t**                 metadatum);
+
+/**
+ * \brief Retrieves the metadatum label and metadatum at the specified index.
+ *
+ * This function retrieves the metadatum label and metadatum from the metadata at the specified index.
+ *
+ * \param[in]  transaction_metadata Pointer to the proposed metadata object.
+ * \param[in]  index                The index at which to retrieve the key-value pair.
+ * \param[out] metadatum_label On successful retrieval, this will point to the metadatum label at the specified index.
+ * \param[out] metadatum On successful retrieval, this will point to the metadatum at the specified index.
+ *                            The caller is responsible for managing the lifecycle of this object and should release it using
+ *                            \ref cardano_metadatum_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_metadata_t* transaction_metadata = NULL;
+ * // Assume transaction_metadata is initialized properly
+ *
+ * size_t index = 0;
+ * uint64_t metadatum_label = 0;
+ * cardano_metadatum_t* metadatum = NULL;
+ *
+ * cardano_error_t result = cardano_transaction_metadata_get_key_value_at(transaction_metadata, index, &metadatum_label, &metadatum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (metadatum != NULL)
+ *   {
+ *     // Use the metadatum label and metadatum
+ *   }
+ *   else
+ *   {
+ *     printf("Key-value pair not set at index %zu.\n", index);
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_transaction_metadata_unref(&transaction_metadata);
+ * cardano_metadatum_unref(&metadatum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_metadata_get_key_value_at(
+  const cardano_transaction_metadata_t* transaction_metadata,
+  size_t                                index,
+  uint64_t*                             metadatum_label,
+  cardano_metadatum_t**                 metadatum);
+
+/**
+ * \brief Decrements the reference count of a transaction_metadata object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_transaction_metadata_t object
+ * by decreasing its reference count. When the reference count reaches zero, the transaction_metadata is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] transaction_metadata A pointer to the pointer of the transaction_metadata object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_metadata_t* transaction_metadata = cardano_transaction_metadata_new();
+ *
+ * // Perform operations with the transaction_metadata...
+ *
+ * cardano_transaction_metadata_unref(&transaction_metadata);
+ * // At this point, transaction_metadata is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_transaction_metadata_unref, the pointer to the \ref cardano_transaction_metadata_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_transaction_metadata_unref(cardano_transaction_metadata_t** transaction_metadata);
+
+/**
+ * \brief Increases the reference count of the cardano_transaction_metadata_t object.
+ *
+ * This function is used to manually increment the reference count of a transaction_metadata
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_transaction_metadata_unref.
+ *
+ * \param transaction_metadata A pointer to the transaction_metadata object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_metadata is a previously created transaction_metadata object
+ *
+ * cardano_transaction_metadata_ref(transaction_metadata);
+ *
+ * // Now transaction_metadata can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_transaction_metadata_ref there is a corresponding
+ * call to \ref cardano_transaction_metadata_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_transaction_metadata_ref(cardano_transaction_metadata_t* transaction_metadata);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_transaction_metadata_t object.
+ *
+ * This function returns the number of active references to a transaction_metadata object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_transaction_metadata_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param transaction_metadata A pointer to the transaction_metadata object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified transaction_metadata object. If the object
+ * is properly managed (i.e., every \ref cardano_transaction_metadata_ref call is matched with a
+ * \ref cardano_transaction_metadata_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_metadata is a previously created transaction_metadata object
+ *
+ * size_t ref_count = cardano_transaction_metadata_refcount(transaction_metadata);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_transaction_metadata_refcount(const cardano_transaction_metadata_t* transaction_metadata);
+
+/**
+ * \brief Sets the last error message for a given transaction_metadata object.
+ *
+ * Records an error message in the transaction_metadata's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] transaction_metadata A pointer to the \ref cardano_transaction_metadata_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the transaction_metadata's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_transaction_metadata_set_last_error(cardano_transaction_metadata_t* transaction_metadata, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific transaction_metadata.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_transaction_metadata_set_last_error for the given
+ * transaction_metadata. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] transaction_metadata A pointer to the \ref cardano_transaction_metadata_t instance whose last error
+ *                   message is to be retrieved. If the transaction_metadata is NULL, the function
+ *                   returns a generic error message indicating the null transaction_metadata.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified transaction_metadata. If the transaction_metadata is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_transaction_metadata_set_last_error for the same transaction_metadata, or until
+ *       the transaction_metadata is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_transaction_metadata_get_last_error(const cardano_transaction_metadata_t* transaction_metadata);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_transaction_metadata_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_transaction_metadata_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_metadata_deep_clone(const cardano_transaction_metadata_t* source, cardano_transaction_metadata_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_METADATA_H
diff --git a/vendor/include/cardano/bip39.h b/vendor/include/cardano/bip39.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/bip39.h
@@ -0,0 +1,177 @@
+/**
+ * \file bip39.h
+ *
+ * \author angel.castillo
+ * \date   Nov 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BIP39S_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BIP39S_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Converts entropy into a BIP-39 mnemonic word sequence.
+ *
+ * This function takes entropy (a binary sequence) and converts it into a corresponding
+ * BIP-39 mnemonic sequence of words. The mnemonic words are pointers to a static,
+ * preloaded wordlist and do not require dynamic memory management. The caller must
+ * not attempt to free the returned pointers.
+ *
+ * \param[in] entropy        Pointer to the entropy buffer. Must not be NULL.
+ * \param[in] entropy_size   Size of the entropy in bytes. Supported sizes are 16, 20, 24, 28, or 32 bytes.
+ * \param[out] words         Array of pointers to char* where the mnemonic words will be stored.
+ *                           The caller must provide an array of size 24 to hold the maximum possible words.
+ *                           Each element in the array will point to a statically allocated string.
+ * \param[out] word_count    Pointer to a size_t where the number of words in the mnemonic will be stored.
+ *                           The number of words depends on the entropy size:
+ *                             - 16 bytes (128 bits) → 12 words
+ *                             - 20 bytes (160 bits) → 15 words
+ *                             - 24 bytes (192 bits) → 18 words
+ *                             - 28 bytes (224 bits) → 21 words
+ *                             - 32 bytes (256 bits) → 24 words
+ *
+ * \return On success, returns CARDANO_SUCCESS. On failure, returns an error code indicating the
+ * reason for failure.
+ *
+ * \note
+ * - This function only supports the **English BIP-39 wordlist**.
+ * - The function does not allocate memory for the words; it simply assigns pointers
+ *   to statically allocated strings from the preloaded English wordlist.
+ * - The caller must not free the pointers in the `words` array as they point to
+ *   static memory.
+ *
+ * \code{.c}
+ * byte_t entropy[32] = { 256 bits of entropy  };
+ * char* words[24] = { 0 };
+ * size_t word_count = 0U;
+ *
+ * cardano_error_t result = cardano_bip39_entropy_to_mnemonic_words(entropy, sizeof(entropy), words, &word_count);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Mnemonic words:\n");
+ *
+ *   for (size_t i = 0; i < word_count; ++i)
+ *   {
+ *     printf("%s ", words[i]);
+ *   }
+ *
+ *   printf("\n");
+ * }
+ * else
+ * {
+ *    printf("Failed to create mnemonic words: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip39_entropy_to_mnemonic_words(
+  const byte_t* entropy,
+  size_t        entropy_size,
+  const char**  words,
+  size_t*       word_count);
+
+/**
+ * \brief Converts a BIP-39 mnemonic word sequence back into entropy.
+ *
+ * This function takes a mnemonic sequence of BIP-39 words and converts it back
+ * into the corresponding binary entropy. The provided mnemonic words must belong
+ * to the English BIP-39 wordlist. The resulting entropy will be written to the
+ * provided buffer.
+ *
+ * \param[in] words            Array of pointers to the mnemonic words. Each word must be a valid
+ *                             BIP-39 English word. Must not be NULL.
+ * \param[in] word_count       Number of words in the mnemonic sequence. Supported values are:
+ *                               - 12 words (128-bit entropy)
+ *                               - 15 words (160-bit entropy)
+ *                               - 18 words (192-bit entropy)
+ *                               - 21 words (224-bit entropy)
+ *                               - 24 words (256-bit entropy)
+ * \param[out] entropy         Pointer to the buffer where the resulting entropy will be stored.
+ *                             Must not be NULL.
+ * \param[in] entropy_buf_size Size of the entropy buffer provided (in bytes). Must be at least
+ *                             the size of the expected entropy corresponding to the word count
+ *                             (16–32 bytes).
+ * \param[out] entropy_size    Pointer to a size_t where the actual size of the resulting entropy
+ *                             (in bytes) will be stored. Must not be NULL.
+ *
+ * \return On success, returns `CARDANO_SUCCESS`. On failure, returns an error code indicating the
+ * reason for failure.
+ *
+ * \note
+ * - This function only supports the **English BIP-39 wordlist**.
+ * - The provided mnemonic words must be valid and match the BIP-39 specification.
+ * - The caller must ensure the entropy buffer is large enough to accommodate the resulting entropy.
+ *
+ * \code{.c}
+ * const char* words[12] = {
+ *   "abandon", "abandon", "abandon", "abandon", "abandon", "abandon",
+ *   "abandon", "abandon", "abandon", "abandon", "abandon", "about"
+ * };
+ * uint8_t entropy[32] = { 0 };
+ * size_t entropy_size = 0U;
+ *
+ * cardano_error_t result = cardano_bip39_mnemonic_words_to_entropy(
+ *     words,
+ *     12,
+ *     entropy,
+ *     sizeof(entropy),  // Provide the size of the buffer
+ *     &entropy_size     // Output parameter for the actual entropy size
+ * );
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Entropy (size: %zu bytes): ", entropy_size);
+ *
+ *   for (size_t i = 0; i < entropy_size; ++i)
+ *   {
+ *     printf("%02x", entropy[i]);
+ *   }
+ *
+ *   printf("\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to convert mnemonic words to entropy: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bip39_mnemonic_words_to_entropy(
+  const char** words,
+  size_t       word_count,
+  byte_t*      entropy,
+  size_t       entropy_buf_size,
+  size_t*      entropy_size);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BIP39S_H
diff --git a/vendor/include/cardano/buffer.h b/vendor/include/cardano/buffer.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/buffer.h
@@ -0,0 +1,1324 @@
+/**
+ * \file buffer.h
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUFFER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUFFER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A dynamic, reference-counted buffer with configurable exponential growth.
+ *
+ * This structure represents a dynamically sized buffer that uses reference counting for memory management and
+ * employs an exponential growth strategy to manage its capacity.
+ *
+ * The buffer's capacity automatically increases by a default growth factor of 1.5 whenever it becomes full. This
+ * approach to resizing is intended to balance between memory usage and the number of reallocations needed, as
+ * excessive reallocations can degrade performance.
+ *
+ * \note The default growth factor is chosen based on a <a href="http://groups.google.com/group/comp.lang.c++.moderated/msg/ba558b4924758e2e">recommendation from Andrew Koenig</a>, suggesting that it should
+ * be less than the golden ratio ((1+sqrt(5))/2, approximately 1.6) to ensure optimal performance. Users can
+ * configure the growth factor at compilation time by setting the `COLLECTION_GROW_FACTOR` environment variable,
+ * allowing for customization of the buffer's resizing behavior according to their needs.
+ */
+typedef struct cardano_buffer_t cardano_buffer_t;
+
+/**
+ * \brief Creates a new dynamic buffer with the specified initial capacity.
+ *
+ * This function allocates a new dynamic buffer with the given initial capacity. The buffer's capacity will
+ * automatically increase in an exponential manner as needed.
+ *
+ * \param[in] capacity Initial capacity of the buffer. Must be greater than 0. If 0 is provided, this function
+ * returns NULL, indicating an error in buffer creation due to invalid capacity.
+ *
+ * \return A pointer to the newly created \ref cardano_buffer_t instance, or NULL if memory allocation fails.
+ * The caller assumes ownership of the returned buffer and is responsible for its lifecycle management.
+ * To release the buffer when it is no longer needed, the caller must call \ref cardano_buffer_unref.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_buffer_t* cardano_buffer_new(size_t capacity);
+
+/**
+ * \brief Creates a new dynamic buffer and initializes it with a copy of the given data.
+ *
+ * This function allocates a new dynamic buffer and copies the provided data into it. The size of the buffer is
+ * automatically set to accommodate the specified data.
+ *
+ * \param[in] array A pointer to the data to initialize the buffer with. The data is copied into the new buffer.
+ * \param[in] size The size of the data to copy. Specifies how many bytes from \c array should be copied into
+ * the newly created buffer.
+ *
+ * \return A pointer to the newly created \ref cardano_buffer_t instance, or NULL if memory allocation fails.
+ * The caller assumes ownership of the returned buffer and is responsible for managing its lifecycle. When
+ * the buffer is no longer needed, it must be released by calling \ref cardano_buffer_unref.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_buffer_t* cardano_buffer_new_from(const byte_t* array, size_t size);
+
+/**
+ * \brief Concatenates two buffers into a new one, containing the combined data.
+ *
+ * This function creates a new dynamic buffer that contains the concatenated contents of two given buffers.
+ * The new buffer will first include the data from the first buffer (\c lhs), followed by the data from the
+ * second buffer (\c rhs). The resulting buffer's capacity is automatically adjusted to accommodate the total
+ * combined data size of both source buffers.
+ *
+ * \param[in] lhs A pointer to the first buffer to concatenate.
+ * \param[in] rhs A pointer to the second buffer to concatenate.
+ *
+ * \return A pointer to a new \ref cardano_buffer_t instance containing the concatenated data of both input buffers,
+ * or NULL if memory allocation fails. The caller assumes ownership of the returned buffer and is responsible for its
+ * lifecycle management. To properly release the buffer when it is no longer needed, the caller must call
+ * \ref cardano_buffer_unref.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_buffer_t* cardano_buffer_concat(const cardano_buffer_t* lhs, const cardano_buffer_t* rhs);
+
+/**
+ * \brief Extracts a portion of the buffer between specified indices, creating a new buffer with the slice.
+ *
+ * This function creates a new dynamic buffer that contains a specific slice of the source buffer, defined by the
+ * provided start and end indices. The start index is inclusive, meaning the slice will start from the element
+ * at this index, while the end index is exclusive, indicating the slice ends at the element before this index.
+ * This operation allows for selective copying of segments from a larger buffer into a new, smaller buffer.
+ *
+ * \param[in] buffer The source buffer from which the slice is to be extracted.
+ * \param[in] start The starting index of the slice, inclusive. Must be less than the size of the source buffer.
+ * \param[in] end The ending index of the slice, exclusive. Must be greater than or equal to the start index and
+ *                less than or equal to the size of the source buffer.
+ *
+ * \return A pointer to a new \ref cardano_buffer_t instance containing the specified slice of the source buffer,
+ * or NULL if the input is invalid or memory allocation fails. The caller assumes ownership of the returned buffer
+ * and is responsible for its lifecycle management. To properly release the buffer when it is no longer needed, the
+ * caller must call \ref cardano_buffer_unref.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_buffer_t* cardano_buffer_slice(const cardano_buffer_t* buffer, size_t start, size_t end);
+
+/**
+ * \brief Creates a new buffer by decoding a given hex string.
+ *
+ * This function allocates a new dynamic buffer and initializes its content by decoding the provided hex string.
+ * The hex string must represent binary data in hexadecimal format. Each pair of hex digits (two characters) is
+ * converted into a single byte, and the resulting bytes are stored in the new buffer. The size parameter
+ * indicates the number of characters in the hex string and should be even to ensure a complete byte representation.
+ *
+ * \param[in] hex_string A pointer to the hex string to be decoded.
+ * \param[in] size The number of characters in the hex string, excluding the null terminator.
+ *
+ * \return A pointer to a new \ref cardano_buffer_t instance containing the decoded data from the hex string,
+ * or NULL if memory allocation fails or the hex string format is invalid. The caller assumes ownership of the
+ * returned buffer and is responsible for its lifecycle management. To properly release the buffer when it is no
+ * longer needed, the caller must call \ref cardano_buffer_unref.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_buffer_t* cardano_buffer_from_hex(const char* hex_string, size_t size);
+
+/**
+ * \brief Calculates the size needed for a buffer's hexadecimal string representation,
+ * including the null terminator.
+ *
+ * This function determines the size of the buffer required to hold the hexadecimal string
+ * representation of a buffer's contents, including space for the null terminator. This size
+ * can be used to allocate memory for storing the hexadecimal string generated by \ref cardano_buffer_to_hex.
+ *
+ * \param[in] buffer The source buffer for which the hexadecimal string size is being calculated.
+ *
+ * \return The size in bytes required to store the buffer's contents as a hexadecimal string,
+ * including the null terminator. If the buffer is NULL or empty, returns 1 for
+ * the null terminator alone.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_buffer_t* buffer = cardano_buffer_new_from_data(someData, dataSize);
+ * size_t hex_string_size = cardano_buffer_get_hex_size(buffer);
+ * char* hex_string = (char*)malloc(hex_string_size);
+ * cardano_error_t result = cardano_buffer_to_hex(buffer, hex_string, hex_string_size);
+ *
+ * if (hex_string != NULL && result == CARDANO_SUCCESS)
+ * {
+ *   printf("Hex representation: %s\n", hex_string);
+ * }
+ *
+ * free(hex_string);
+ *
+ * cardano_buffer_unref(&buffer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_buffer_get_hex_size(const cardano_buffer_t* buffer);
+
+/**
+ * \brief Converts the contents of a buffer into a hexadecimal string representation and writes it
+ * to the provided buffer.
+ *
+ * This function takes a source buffer and generates a hexadecimal string representation of its contents,
+ * writing the result to a user-provided buffer. The size of the destination buffer must be sufficient to
+ * hold the hexadecimal string and the null terminator. The required size can be determined using the
+ * \ref cardano_buffer_get_hex_size function.
+ *
+ * \param[in] buffer The source buffer from which the hex string will be generated.
+ * \param[out] dest The destination buffer where the null-terminated hexadecimal string will be written.
+ * \param[in] dest_size The size of the destination buffer. This size must include space for the null terminator.
+ *
+ * \return On success, returns CARDANO_SUCCESS. On failure, returns an error code indicating the
+ * reason for failure, such as insufficient buffer size.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_buffer_t* buffer = cardano_buffer_new_from_data(someData, dataSize);
+ * size_t hex_string_size = cardano_buffer_get_hex_size(buffer);
+ * char* hex_string = (char*)malloc(hex_string_size);
+ * cardano_error_t result = cardano_buffer_to_hex(buffer, hex_string, hex_string_size);
+ *
+ * if (hex_string != NULL && result == CARDANO_SUCCESS)
+ * {
+ *     printf("Hex representation: %s\n", hex_string);
+ * }
+ *
+ * free(hex_string);
+ *
+ * cardano_buffer_unref(&buffer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_to_hex(const cardano_buffer_t* buffer, char* dest, size_t dest_size);
+
+/**
+ * \brief Computes the size needed for a null-terminated string representation of the buffer's contents.
+ *
+ * This function calculates the size of the buffer's content when represented as a null-terminated string.
+ * The calculated size includes space for the null terminator. This is useful for allocating an appropriately sized
+ * buffer before converting the buffer's binary data into a string with `cardano_buffer_to_str`.
+ *
+ * \param[in] buffer A pointer to the cardano_buffer_t instance whose string size is being queried.
+ *
+ * \return The size in bytes required to represent the buffer's content as a null-terminated string, including the null terminator.
+ *         Returns 0 if the buffer is NULL or contains no data.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_buffer_t* myBuffer = // assume this is initialized and contains data
+ *
+ * size_t strSize = cardano_buffer_get_str_size(myBuffer);
+ *
+ * // strSize now contains the size needed to store the buffer's data as a string
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_buffer_get_str_size(const cardano_buffer_t* buffer);
+
+/**
+ * \brief Converts the content of a buffer to a UTF-8 string.
+ *
+ * This function takes the binary content of the specified buffer and
+ * converts it to a null-terminated string. The caller must ensure
+ * that the destination buffer (\c dest) is large enough to hold the resulting
+ * string, including the null terminator.
+ *
+ * The size required for the destination buffer can be determined using
+ * \ref cardano_buffer_get_str_size.
+ *
+ * \param[in] buffer The source buffer containing the binary data to be converted.
+ * \param[out] dest The destination buffer where the resulting string will be stored.
+ * \param[in] dest_size The size of the destination buffer in bytes.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful and the string was
+ *         copied to \c dest. If the destination buffer is not large enough to hold the string,
+ *         an error code will be returned. Refer to \c cardano_error_t documentation
+ *         for details on possible error codes.
+ *
+ * Example usage:
+ * \code{.c}
+ * size_t needed_size = cardano_buffer_get_str_size(buffer);
+ * char* dest = (char*)malloc(needed_size);
+ *
+ * if (dest != NULL)
+ * {
+ *   if (cardano_buffer_to_str(buffer, dest, needed_size) == CARDANO_SUCCESS)
+ *   {
+ *     printf("Buffer content as string: %s\n", dest);
+ *   }
+ *   else
+ *   {
+ *     printf("Failed to convert buffer to string.\n");
+ *   }
+ *
+ *   free(dest);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_to_str(const cardano_buffer_t* buffer, char* dest, size_t dest_size);
+
+/**
+ * \brief Checks if two cardano_buffer_t objects are equal.
+ *
+ * This function compares the contents of two cardano_buffer_t objects, lhs and rhs, to determine if they are equal.
+ * If the contents of both buffers are identical in size and content, the function returns true. Otherwise, it returns false.
+ *
+ * \param[in] lhs A constant pointer to the first cardano_buffer_t object to be compared.
+ * \param[in] rhs A constant pointer to the second cardano_buffer_t object to be compared.
+ *
+ * \return true if the contents of the buffers are equal, false otherwise.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_buffer_equals(const cardano_buffer_t* lhs, const cardano_buffer_t* rhs);
+
+/**
+ * \brief Compares two buffer objects lexicographically.
+ *
+ * This function compares two buffer objects lexicographically and returns an integer indicating
+ * their relative order. The comparison is performed byte-by-byte.
+ *
+ * \param[in] lhs Pointer to the first buffer object.
+ * \param[in] rhs Pointer to the second buffer object.
+ *
+ * \return A negative value if lhs is less than rhs, zero if they are equal, and a positive value if lhs is greater than rhs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_buffer_t* buffer1 = NULL;
+ * cardano_buffer_t* buffer2 = NULL;
+ *
+ * // Assume buffer1 and buffer2 are initialized properly
+ *
+ * int32_t comparison = cardano_buffer_compare(buffer1, buffer2);
+ *
+ * if (comparison < 0)
+ * {
+ *   printf("buffer1 is less than buffer2.\n");
+ * }
+ * else if (comparison == 0)
+ * {
+ * {
+ *   printf("buffer1 is equal to buffer2.\n");
+ * }
+ * else
+ * {
+ *   printf("buffer1 is greater than buffer2.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_buffer_unref(&buffer1);
+ * cardano_buffer_unref(&buffer2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT int32_t cardano_buffer_compare(const cardano_buffer_t* lhs, const cardano_buffer_t* rhs);
+
+/**
+ * \brief Decrements the buffer's reference count.
+ *
+ * This function is used to decrement the reference count of a `cardano_buffer_t` instance.
+ * When the reference count reaches zero, the memory allocated for the buffer is automatically
+ * deallocated. It is important to ensure that `cardano_buffer_unref` is called for each
+ * `cardano_buffer_new`, `cardano_buffer_new_from`, `cardano_buffer_concat`, or any other
+ * function that returns a new buffer reference to prevent memory leaks.
+ *
+ * \param[in,out] buffer A double pointer to the buffer whose reference count is to be decremented.
+ *                       On invocation, `buffer` should point to a valid `cardano_buffer_t*`.
+ *                       After execution, the pointer is set to NULL to prevent further use.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_buffer_t* my_buffer = cardano_buffer_new(256);
+ *
+ * // Use the buffer...
+ * cardano_buffer_unref(&my_buffer); // Decrement ref count and possibly free the buffer
+ * assert(my_buffer == NULL); // myBuffer is now NULL
+ *
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_buffer_unref(cardano_buffer_t** buffer);
+
+/**
+ * \brief Increments the buffer's reference count.
+ *
+ * This function is used to increment the reference count of a `cardano_buffer_t` instance,
+ * indicating that there is an additional owner of the buffer. This ensures that the buffer
+ * remains allocated until the last reference is released. It is essential to match each call
+ * to `cardano_buffer_ref` with a corresponding call to `cardano_buffer_unref` to prevent memory
+ * leaks by ensuring that the buffer is deallocated when it is no longer in use.
+ *
+ * \param[in] buffer A pointer to the buffer whose reference count is to be incremented.
+ *                   `buffer` must point to a valid `cardano_buffer_t` instance.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_buffer_t* shared_buffer = cardano_buffer_new(128);
+ * cardano_buffer_ref(shared_buffer); // Increment ref count because buffer will be shared
+ *
+ * // Share the buffer. The receiver should also call cardano_buffer_ref when its done
+ * // with the buffer.
+ *
+ * cardano_buffer_unref(&shared_buffer); // Decrement our own reference when done with the buffer
+ *
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_buffer_ref(cardano_buffer_t* buffer);
+
+/**
+ * \brief Retrieves the buffer's current reference count.
+ *
+ * This function returns the current reference count of a `cardano_buffer_t` instance.
+ * The reference count indicates how many owners or references to the buffer exist.
+ * It is essential for managing the buffer's lifecycle, ensuring it remains allocated
+ * until the last reference is released. Note that this function does not account for
+ * transitive references, which means it only counts direct references to this buffer
+ * instance.
+ *
+ * \param[in] buffer A pointer to the target buffer. `buffer` must point to a valid
+ *                   `cardano_buffer_t` instance.
+ * \return The current reference count of the buffer.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_buffer_t* my_buffer = cardano_buffer_new(256);
+ * size_t ref_count = cardano_buffer_refcount(my_buffer);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ *
+ * cardano_buffer_unref(&my_buffer);
+ * \endcode
+ */
+CARDANO_EXPORT size_t cardano_buffer_refcount(const cardano_buffer_t* buffer);
+
+/**
+ * \brief Retrieves a direct pointer to the internal data of a buffer.
+ *
+ * This function provides access to the internal storage of the buffer, allowing for read-only operations on its contents.
+ * It is intended for situations where direct access to the data is necessary for performance or interoperability reasons.
+ *
+ * \warning The returned pointer provides raw, direct access to the buffer's internal data. It must not be used to
+ * deallocate it using free or similar memory management functions. The lifecycle of the data pointed to by the returned
+ * pointer is managed by the buffer's reference counting mechanism; therefore, the data remains valid as long as the
+ * buffer object exists and has not been deallocated.
+ *
+ * \param[in] buffer The buffer instance from which to retrieve the internal data pointer. The buffer must have been previously
+ * created and not yet deallocated.
+ *
+ * \return Returns a pointer to the internal data of the buffer. If the buffer is empty or if the buffer instance is invalid,
+ * returns NULL. The returned pointer provides direct access to the buffer's contents and must be used in accordance with the
+ * warning above to avoid unintended consequences.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT byte_t* cardano_buffer_get_data(const cardano_buffer_t* buffer);
+
+/**
+ * \brief Sets the logical size of the buffer to a specified value.
+ *
+ * This function updates the internal marker of the buffer to reflect a new logical size,
+ * indicating how much of the preallocated memory is considered "used" or contains valid data.
+ * It is important to note that this function does not allocate, deallocate, or initialize memory;
+ * it merely updates the buffer's state to reflect that a certain portion of its already allocated
+ * memory is now in use. This is particularly useful when data is written to the buffer in a manner
+ * where the exact amount of data written is known and does not need to be sequentially written or tracked.
+ *
+ * \warning This function should be used with caution as it directly affects how much of the buffer
+ *          is considered valid data.
+ *
+ * \param buffer A pointer to the `cardano_buffer_t` object whose size is to be set. The buffer
+ *               must have been properly initialized and should have enough memory allocated to
+ *               accommodate the new size.
+ * \param size The new logical size of the buffer. This value must not exceed the buffer's current
+ *             allocated memory size.
+ *
+ * \return Returns `CARDANO_SUCCESS` if the buffer's size was successfully updated. If the function
+ *         fails (e.g., due to an invalid buffer pointer, or the specified `size` exceeding the
+ *         buffer's allocated memory), a non-zero error code is returned.
+ *
+ * Example Usage:
+ * \code
+ * cardano_buffer_t* buffer = cardano_buffer_new(1024);
+ *
+ * // Write data to the buffer in a non-standard manner, or track written data externally
+ *
+ * // Artificially set the buffer's size after data has been written or manipulated
+ * size_t data_written = 512; // Assume 512 bytes of data are now considered "used"
+ * cardano_error_t error = cardano_buffer_set_size(&buffer, data_written);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The buffer now considers 512 bytes of its allocated memory as "used"
+ * }
+ *
+ * // Clean up
+ * cardano_buffer_unref(&buffer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_set_size(cardano_buffer_t* buffer, size_t size);
+
+/**
+ * \brief Securely wipes the contents of a buffer from memory.
+ *
+ * The `cardano_buffer_memzero` function is used to securely erase the sensitive data stored in the provided \p buffer.
+ * This ensures that the data is no longer recoverable from memory after it has been used.
+ *
+ * After use, sensitive data should be overwritten. However, traditional approaches like `memset()` or hand-written
+ * memory clearing routines can be stripped away by optimizing compilers or linkers, potentially leaving sensitive
+ * information exposed.
+ *
+ * The `cardano_buffer_memzero` function guarantees that the memory is cleared, even in the presence of compiler optimizations.
+ * It is especially important to call this function before freeing memory that contains sensitive information, such as
+ * cryptographic keys or decrypted data, to prevent the data from remaining in memory.
+ *
+ * \param[in] buffer A pointer to the buffer whose contents should be securely erased.
+ *
+ * \see cardano_buffer_unref() for releasing the buffer after calling this function.
+ *
+ * \example
+ * \code
+ * // Example usage after processing sensitive data
+ * cardano_buffer_t* sensitive_data = ...; // Buffer containing sensitive data
+ *
+ * // Wipe the buffer contents securely before releasing it
+ * cardano_buffer_memzero(sensitive_data);
+ * cardano_buffer_unref(sensitive_data);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_buffer_memzero(cardano_buffer_t* buffer);
+
+/**
+ * \brief Retrieves the current size of the buffer, indicating how much data it currently holds.
+ *
+ * This function provides the actual used space within the buffer, reflecting the amount of data it currently contains.
+ * It is useful for understanding the buffer's occupancy and managing data operations, such as reading or processing the buffer's contents.
+ *
+ * \note The returned size represents the amount of data currently stored in the buffer, which may be less than or equal to
+ * the buffer's total capacity. A return value of 0 indicates either that the buffer is empty or that the provided buffer reference
+ * is NULL.
+ *
+ * \param[in] buffer The buffer instance for which to retrieve the used space.
+ *
+ * \return The size of the used space within the buffer, in bytes. This value ranges from 0 to the buffer's total capacity.
+ * Returns 0 if the buffer is NULL, indicating an error condition or uninitialized buffer instance.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_buffer_get_size(const cardano_buffer_t* buffer);
+
+/**
+ * \brief Copies data from a Cardano buffer to a specified destination array.
+ *
+ * This function safely transfers bytes from a `cardano_buffer_t` object to a provided
+ * destination array.
+ *
+ * \param buffer A pointer to the `cardano_buffer_t` object from which data will be copied.
+ *               The buffer must be initialized and contain the data to be copied.
+ * \param dest A pointer to the destination array where the data will be copied. This array
+ *             must be allocated and have a size large enough to hold the data being copied.
+ * \param dest_size The size of the destination array in bytes. This value determines the
+ *                  maximum amount of data that can be safely copied to `dest`.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the data was successfully copied to the
+ *         destination array. If the function fails, a non-zero error code is returned,
+ *         indicating issues such as null pointers for `buffer` or `dest`, or an insufficient
+ *         `dest_size` to hold the buffer's data. In cases of failure, the content of `dest`
+ *         may be partially updated or left unchanged.
+ *
+ * Example Usage:
+ * \code
+ * const cardano_buffer_t* source_buffer = ...; // Assume source_buffer is initialized and filled with data
+ * byte_t destination_array[1024];
+ * const size_t destination_size = sizeof(destination_array);
+ *
+ * cardano_error_t error = cardano_buffer_copy_bytes(source_buffer, destination_array, destination_size);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Data has been successfully copied to destination_array
+ *   // Proceed with using the data in destination_array as needed
+ * }
+ * else
+ * {
+ *   // Handle the error (e.g., log it, attempt recovery, etc.)
+ * }
+ * \endcode
+ *
+ * \note The caller is responsible for ensuring that the destination array is properly allocated
+ *       and sized to accommodate the data being copied.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_copy_bytes(const cardano_buffer_t* buffer, byte_t* dest, size_t dest_size);
+
+/**
+ * \brief Retrieves the total capacity of the buffer.
+ *
+ * This function returns the total amount of space allocated for the buffer, indicating how much data
+ * it can hold before needing to expand. The capacity of a buffer is managed automatically, growing
+ * as needed to accommodate new data added to the buffer. This function provides a way to inspect
+ * the current capacity without affecting the buffer's state.
+ *
+ * \param[in] buffer The buffer instance whose total capacity is being queried. It must have been previously
+ * created using one of the buffer creation functions. If the buffer is NULL, indicating an invalid or
+ * uninitialized buffer instance, the function returns 0.
+ *
+ * \return The total capacity of the buffer in bytes, representing the maximum amount of data the buffer
+ * can currently hold. If the buffer is NULL, the function returns 0.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_buffer_get_capacity(const cardano_buffer_t* buffer);
+
+/**
+ * \brief Repositions the current position within a buffer to a specified offset.
+ *
+ * This function adjusts the current pointer position within the given `cardano_buffer_t`
+ * object to the specified `position`. It is used to set the read/write position within the
+ * buffer, allowing subsequent operations to start from the new location. This can be particularly
+ * useful for parsing structured data or for resetting the position to rewrite or reread portions
+ * of the buffer.
+ *
+ * \param buffer A pointer to the `cardano_buffer_t` object whose position is to be adjusted.
+ * \param position The new position within the buffer where the current pointer should be set.
+ *                 This value must be within the bounds of the buffer's current size.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the position within the buffer was
+ *         successfully updated. If the function fails, a non-zero error code is returned,
+ *         indicating an invalid `buffer`, an out-of-bounds `position`, or other errors
+ *         related to manipulating the buffer's position.
+ *
+ * Example Usage:
+ * \code
+ * cardano_buffer_t* buffer = ...; // Assume buffer is previously initialized and populated
+ * size_t new_position = 10; // Desired position to seek to within the buffer
+ *
+ * cardano_error_t error = cardano_buffer_seek(buffer, new_position);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The buffer's current position is now set to `new_position`
+ *   // Subsequent operations will start from this position
+ * }
+ *
+ * // Continue with further operations on `buffer`
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_seek(cardano_buffer_t* buffer, size_t position);
+
+/**
+ * \brief Appends data to the end of the buffer, expanding its capacity if necessary.
+ *
+ * This function allows for the addition of arbitrary data to the end of a dynamically sized buffer. If the
+ * buffer does not have enough capacity to accommodate the new data, it is automatically expanded.
+ *
+ * \param[in] buffer The buffer to which data will be appended. It must be a valid, previously allocated
+ * buffer instance. The buffer's capacity will be expanded if there is not enough space for the new data.
+ * \param[in] data A pointer to the byte array containing the data to be appended to the buffer. The function
+ * copies the specified number of bytes from this array into the buffer.
+ * \param[in] size The size of the data in bytes to be appended. This specifies how much of the data
+ * pointed to by `data` should be copied into the buffer.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the append operation was successful. If the operation encounters an error,
+ *        such as invalid parameters or issues with writing to the buffer, an appropriate error code is returned
+ *        indicating the reason for the failure. Consult the \ref cardano_error_t documentation for details on possible
+ *        error codes and their meanings.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write(cardano_buffer_t* buffer, const byte_t* data, size_t size);
+
+/**
+ * \brief Reads a specified amount of data from the buffer into a provided output array.
+ *
+ * This function attempts to copy a given number of bytes from the source buffer into the specified output
+ * array. If the buffer does not contain enough data to fulfill the requested read operation, an error is
+ * returned.
+ *
+ * \param[in] buffer The source buffer from which data will be read.
+ * \param[out] data An output array where the read data will be copied. The array must have sufficient space
+ * to store the number of bytes specified by `bytes_to_read`. It is the caller's responsibility to ensure
+ * that the size of `data` is at least as large as `bytes_to_read`.
+ * \param[in] bytes_to_read The number of bytes to read from the buffer and copy into the `data` output array.
+ * This specifies how much data the function should attempt to transfer from the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. \ref CARDANO_SUCCESS
+ * is returned if the specified amount of data was successfully read from the buffer and copied into the
+ * output array. If the operation fails, for example, because the buffer contains less data than requested,
+ * an appropriate error code is returned to indicate the specific reason for failure.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read(cardano_buffer_t* buffer, byte_t* data, size_t bytes_to_read);
+
+/**
+ * \brief Writes a 16-bit unsigned integer to the specified buffer, encoding the integer in little-endian byte order.
+ *
+ * This function takes a 16-bit unsigned integer and writes it to the target buffer in little-endian format.
+ *
+ * \param[in] buffer The buffer into which the 16-bit unsigned integer will be written.
+ * \param[in] value The 16-bit unsigned integer value to be written to the buffer. The function will
+ * split the integer into bytes according to little-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_uint16_le(cardano_buffer_t* buffer, uint16_t value);
+
+/**
+ * \brief Writes a 32-bit unsigned integer to the specified buffer, encoding the integer in little-endian byte order.
+ *
+ * This function takes a 32-bit unsigned integer and writes it to the target buffer in little-endian format.
+ *
+ * \param[in] buffer The buffer into which the 32-bit unsigned integer will be written.
+ * \param[in] value The 32-bit unsigned integer value to be encoded and written to the buffer. The function will
+ * split the integer into bytes according to little-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer value is
+ * successfully encoded and stored in the buffer, \ref CARDANO_SUCCESS is returned. In the event of an error, such
+ * as failure to expand the buffer's capacity, an error code will be returned that details the specific cause of
+ * the failure. Clients are encouraged to check this return value to verify that the write operation was successful
+ * and to handle any errors that may have occurred.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_uint32_le(cardano_buffer_t* buffer, uint32_t value);
+
+/**
+ * \brief Writes a 64-bit unsigned integer to the specified buffer, encoding the integer in little-endian byte order.
+ *
+ * This function takes a 64-bit unsigned integer and writes it to the target buffer in little-endian format.
+ *
+ * \param[in] buffer The buffer into which the 64-bit unsigned integer will be written.
+ * \param[in] value The 64-bit unsigned integer value to be encoded and written to the buffer. The function will
+ * split the integer into bytes according to little-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer value is
+ * successfully encoded and stored in the buffer, \ref CARDANO_SUCCESS is returned. In the event of an error, such
+ * as failure to expand the buffer's capacity, an error code will be returned that details the specific cause of
+ * the failure. Clients are encouraged to check this return value to verify that the write operation was successful
+ * and to handle any errors that may have occurred.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_uint64_le(cardano_buffer_t* buffer, uint64_t value);
+
+/**
+ * \brief Writes a 16-bit signed integer to the specified buffer, encoding the integer in little-endian byte order.
+ *
+ * This function takes a 16-bit signed integer and writes it to the target buffer in little-endian format.
+ *
+ * \param[in] buffer The buffer into which the 16-bit signed integer will be written.
+ * \param[in] value The 16-bit signed integer value to be written to the buffer. The function will
+ * split the integer into bytes according to little-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_int16_le(cardano_buffer_t* buffer, int16_t value);
+
+/**
+ * \brief Writes a 32-bit signed integer to the specified buffer, encoding the integer in little-endian byte order.
+ *
+ * This function takes a 32-bit signed integer and writes it to the target buffer in little-endian format.
+ *
+ * \param[in] buffer The buffer into which the 32-bit signed integer will be written.
+ * \param[in] value The 32-bit signed integer value to be written to the buffer. The function will
+ * split the integer into bytes according to little-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_int32_le(cardano_buffer_t* buffer, int32_t value);
+
+/**
+ * \brief Writes a 64-bit signed integer to the specified buffer, encoding the integer in little-endian byte order.
+ *
+ * This function takes a 64-bit signed integer and writes it to the target buffer in little-endian format.
+ *
+ * \param[in] buffer The buffer into which the 64-bit signed integer will be written.
+ * \param[in] value The 64-bit signed integer value to be written to the buffer. The function will
+ * split the integer into bytes according to little-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_int64_le(cardano_buffer_t* buffer, int64_t value);
+
+/**
+ * \brief Writes a floating-point number to the specified buffer, encoding the number in little-endian byte order.
+ *
+ * This function takes a floating-point number (float) and writes it to the target buffer in little-endian format.
+ *
+ * \param[in] buffer The buffer into which the floating-point number will be written.
+ * \param[in] value The floating-point number (float) to be written to the buffer. The function will
+ * split the float into bytes according to little-endian order and then store these bytes sequentially in
+ * the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the float is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_float_le(cardano_buffer_t* buffer, float value);
+
+/**
+ * \brief Writes a double number to the specified buffer, encoding the number in little-endian byte order.
+ *
+ * This function takes a double number and writes it to the target buffer in little-endian format.
+ *
+ * \param[in] buffer The buffer into which the double number will be written.
+ * \param[in] value The double number to be written to the buffer. The function will
+ * split the double into bytes according to little-endian order and then store these bytes sequentially in
+ * the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the double is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_double_le(cardano_buffer_t* buffer, double value);
+
+/**
+ * \brief Writes a 16-bit unsigned integer to the specified buffer, encoding the integer in big-endian byte order.
+ *
+ * This function takes a 16-bit unsigned integer and writes it to the target buffer in big-endian format.
+ *
+ * \param[in] buffer The buffer into which the 16-bit unsigned integer will be written.
+ * \param[in] value The 16-bit unsigned integer value to be written to the buffer. The function will
+ * split the integer into bytes according to big-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_uint16_be(cardano_buffer_t* buffer, uint16_t value);
+
+/**
+ * \brief Writes a 32-bit unsigned integer to the specified buffer, encoding the integer in big-endian byte order.
+ *
+ * This function takes a 32-bit unsigned integer and writes it to the target buffer in big-endian format.
+ *
+ * \param[in] buffer The buffer into which the 32-bit unsigned integer will be written.
+ * \param[in] value The 32-bit unsigned integer value to be written to the buffer. The function will
+ * split the integer into bytes according to big-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_uint32_be(cardano_buffer_t* buffer, uint32_t value);
+
+/**
+ * \brief Writes a 64-bit unsigned integer to the specified buffer, encoding the integer in big-endian byte order.
+ *
+ * This function takes a 64-bit unsigned integer and writes it to the target buffer in big-endian format.
+ *
+ * \param[in] buffer The buffer into which the 64-bit unsigned integer will be written.
+ * \param[in] value The 64-bit unsigned integer value to be written to the buffer. The function will
+ * split the integer into bytes according to big-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_uint64_be(cardano_buffer_t* buffer, uint64_t value);
+
+/**
+ * \brief Writes a 16-bit signed integer to the specified buffer, encoding the integer in big-endian byte order.
+ *
+ * This function takes a 16-bit signed integer and writes it to the target buffer in big-endian format.
+ *
+ * \param[in] buffer The buffer into which the 16-bit signed integer will be written.
+ * \param[in] value The 16-bit signed integer value to be written to the buffer. The function will
+ * split the integer into bytes according to big-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_int16_be(cardano_buffer_t* buffer, int16_t value);
+
+/**
+ * \brief Writes a 32-bit signed integer to the specified buffer, encoding the integer in big-endian byte order.
+ *
+ * This function takes a 32-bit signed integer and writes it to the target buffer in big-endian format.
+ *
+ * \param[in] buffer The buffer into which the 32-bit signed integer will be written.
+ * \param[in] value The 32-bit signed integer value to be written to the buffer. The function will
+ * split the integer into bytes according to big-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_int32_be(cardano_buffer_t* buffer, int32_t value);
+
+/**
+ * \brief Writes a 64-bit signed integer to the specified buffer, encoding the integer in big-endian byte order.
+ *
+ * This function takes a 64-bit signed integer and writes it to the target buffer in big-endian format.
+ *
+ * \param[in] buffer The buffer into which the 64-bit signed integer will be written.
+ * \param[in] value The 64-bit signed integer value to be written to the buffer. The function will
+ * split the integer into bytes according to big-endian order and then store these bytes sequentially in the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the integer is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_int64_be(cardano_buffer_t* buffer, int64_t value);
+
+/**
+ * \brief Writes a floating-point number to the specified buffer, encoding the number in big-endian byte order.
+ *
+ * This function takes a floating-point number (float) and writes it to the target buffer in big-endian format.
+ *
+ * \param[in] buffer The buffer into which the floating-point number will be written.
+ * \param[in] value The floating-point number (float) to be written to the buffer. The function will
+ * split the float into bytes according to big-endian order and then store these bytes sequentially in
+ * the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the float is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_float_be(cardano_buffer_t* buffer, float value);
+
+/**
+ * \brief Writes a double number to the specified buffer, encoding the number in big-endian byte order.
+ *
+ * This function takes a double number and writes it to the target buffer in big-endian format.
+ *
+ * \param[in] buffer The buffer into which the double number will be written.
+ * \param[in] value The double number to be written to the buffer. The function will
+ * split the double into bytes according to big-endian order and then store these bytes sequentially in
+ * the buffer.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the write operation. If the double is
+ * successfully written to the buffer, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ * error, such as an issue with expanding the buffer's capacity, an error code is returned that identifies
+ * the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_write_double_be(cardano_buffer_t* buffer, double value);
+
+/**
+ * \brief Reads a 16-bit unsigned integer from the specified buffer, decoding it from little-endian byte order.
+ *
+ * This function extracts a 16-bit unsigned integer from the buffer, assuming the number is stored in little-endian format.
+ *
+ * \param[in] buffer The buffer from which the 16-bit unsigned integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 16-bit unsigned integer variable where the decoded value will be stored.
+ * The value is converted from little-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 16-bit unsigned
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_uint16_le(cardano_buffer_t* buffer, uint16_t* value);
+
+/**
+ * \brief Reads a 32-bit unsigned integer from the specified buffer, decoding it from little-endian byte order.
+ *
+ * This function extracts a 32-bit unsigned integer from the buffer, assuming the number is stored in little-endian format.
+ *
+ * \param[in] buffer The buffer from which the 32-bit unsigned integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 32-bit unsigned integer variable where the decoded value will be stored.
+ * The value is converted from little-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 32-bit unsigned
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_uint32_le(cardano_buffer_t* buffer, uint32_t* value);
+
+/**
+ * \brief Reads a 64-bit unsigned integer from the specified buffer, decoding it from little-endian byte order.
+ *
+ * This function extracts a 64-bit unsigned integer from the buffer, assuming the number is stored in little-endian format.
+ *
+ * \param[in] buffer The buffer from which the 64-bit unsigned integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 64-bit unsigned integer variable where the decoded value will be stored.
+ * The value is converted from little-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 64-bit unsigned
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_uint64_le(cardano_buffer_t* buffer, uint64_t* value);
+
+/**
+ * \brief Reads a 16-bit signed integer from the specified buffer, decoding it from little-endian byte order.
+ *
+ * This function extracts a 16-bit signed integer from the buffer, assuming the number is stored in little-endian format.
+ *
+ * \param[in] buffer The buffer from which the 16-bit signed integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 16-bit signed integer variable where the decoded value will be stored.
+ * The value is converted from little-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 16-bit signed
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_int16_le(cardano_buffer_t* buffer, int16_t* value);
+
+/**
+ * \brief Reads a 32-bit signed integer from the specified buffer, decoding it from little-endian byte order.
+ *
+ * This function extracts a 32-bit signed integer from the buffer, assuming the number is stored in little-endian format.
+ *
+ * \param[in] buffer The buffer from which the 32-bit signed integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 32-bit signed integer variable where the decoded value will be stored.
+ * The value is converted from little-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 32-bit signed
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_int32_le(cardano_buffer_t* buffer, int32_t* value);
+
+/**
+ * \brief Reads a 64-bit signed integer from the specified buffer, decoding it from little-endian byte order.
+ *
+ * This function extracts a 64-bit signed integer from the buffer, assuming the number is stored in little-endian format.
+ *
+ * \param[in] buffer The buffer from which the 64-bit signed integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 64-bit signed integer variable where the decoded value will be stored.
+ * The value is converted from little-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 64-bit signed
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_int64_le(cardano_buffer_t* buffer, int64_t* value);
+
+/**
+ * \brief Reads a floating-point number from the specified buffer, decoding it from little-endian byte order.
+ *
+ * This function extracts a floating-point number (float) from the buffer, assuming the number is stored in
+ * little-endian format.
+ *
+ * \param[in] buffer The buffer from which the floating-point number will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a floating-point number variable where the decoded value will be stored.
+ * The value is converted from little-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the floating-point
+ * number is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_float_le(cardano_buffer_t* buffer, float* value);
+
+/**
+ * \brief Reads a double number from the specified buffer, decoding it from little-endian byte order.
+ *
+ * This function extracts a double number from the buffer, assuming the number is stored in
+ * little-endian format.
+ *
+ * \param[in] buffer The buffer from which the double number will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a double number variable where the decoded value will be stored.
+ * The value is converted from little-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the double
+ * number is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_double_le(cardano_buffer_t* buffer, double* value);
+
+/**
+ * \brief Reads a 16-bit unsigned integer from the specified buffer, decoding it from big-endian byte order.
+ *
+ * This function extracts a 16-bit unsigned integer from the buffer, assuming the number is stored in big-endian format.
+ *
+ * \param[in] buffer The buffer from which the 16-bit unsigned integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 16-bit unsigned integer variable where the decoded value will be stored.
+ * The value is converted from big-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 16-bit unsigned
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_uint16_be(cardano_buffer_t* buffer, uint16_t* value);
+
+/**
+ * \brief Reads a 32-bit unsigned integer from the specified buffer, decoding it from big-endian byte order.
+ *
+ * This function extracts a 32-bit unsigned integer from the buffer, assuming the number is stored in big-endian format.
+ *
+ * \param[in] buffer The buffer from which the 32-bit unsigned integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 32-bit unsigned integer variable where the decoded value will be stored.
+ * The value is converted from big-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 32-bit unsigned
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_uint32_be(cardano_buffer_t* buffer, uint32_t* value);
+
+/**
+ * \brief Reads a 64-bit unsigned integer from the specified buffer, decoding it from big-endian byte order.
+ *
+ * This function extracts a 64-bit unsigned integer from the buffer, assuming the number is stored in big-endian format.
+ *
+ * \param[in] buffer The buffer from which the 64-bit unsigned integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 64-bit unsigned integer variable where the decoded value will be stored.
+ * The value is converted from big-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 64-bit unsigned
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_uint64_be(cardano_buffer_t* buffer, uint64_t* value);
+
+/**
+ * \brief Reads a 16-bit signed integer from the specified buffer, decoding it from big-endian byte order.
+ *
+ * This function extracts a 16-bit signed integer from the buffer, assuming the number is stored in big-endian format.
+ *
+ * \param[in] buffer The buffer from which the 16-bit signed integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 16-bit signed integer variable where the decoded value will be stored.
+ * The value is converted from big-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 16-bit signed
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_int16_be(cardano_buffer_t* buffer, int16_t* value);
+
+/**
+ * \brief Reads a 32-bit signed integer from the specified buffer, decoding it from big-endian byte order.
+ *
+ * This function extracts a 32-bit signed integer from the buffer, assuming the number is stored in big-endian format.
+ *
+ * \param[in] buffer The buffer from which the 32-bit signed integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 32-bit signed integer variable where the decoded value will be stored.
+ * The value is converted from big-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 32-bit signed
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_int32_be(cardano_buffer_t* buffer, int32_t* value);
+
+/**
+ * \brief Reads a 64-bit signed integer from the specified buffer, decoding it from big-endian byte order.
+ *
+ * This function extracts a 64-bit signed integer from the buffer, assuming the number is stored in big-endian format.
+ *
+ * \param[in] buffer The buffer from which the 64-bit signed integer will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a 64-bit signed integer variable where the decoded value will be stored.
+ * The value is converted from big-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the 64-bit signed
+ * integer is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_int64_be(cardano_buffer_t* buffer, int64_t* value);
+
+/**
+ * \brief Reads a floating-point number from the specified buffer, decoding it from big-endian byte order.
+ *
+ * This function extracts a floating-point number (float) from the buffer, assuming the number is stored in
+ * big-endian format.
+ *
+ * \param[in] buffer The buffer from which the floating-point number will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a floating-point number variable where the decoded value will be stored.
+ * The value is converted from big-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the floating-point
+ * number is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_float_be(cardano_buffer_t* buffer, float* value);
+
+/**
+ * \brief Reads a double number from the specified buffer, decoding it from big-endian byte order.
+ *
+ * This function extracts a double number from the buffer, assuming the number is stored in
+ * big-endian format.
+ *
+ * \param[in] buffer The buffer from which the double number will be read. The buffer's current read position
+ * determines the starting point for reading the value.
+ * \param[out] value A pointer to a double number variable where the decoded value will be stored.
+ * The value is converted from big-endian byte order to the native byte order of the executing platform
+ * before being stored.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the read operation. If the double
+ * number is successfully read and decoded from the buffer, \ref CARDANO_SUCCESS is returned. If the operation
+ * encounters an error, such as attempting to read beyond the available data in the buffer, an error code
+ * is returned that identifies the specific failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_buffer_read_double_be(cardano_buffer_t* buffer, double* value);
+
+/**
+ * \brief Sets the last error message for a given buffer object.
+ *
+ * Records an error message in the buffer's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] buffer A pointer to the \ref cardano_buffer_t instance whose last error message is
+ *                   to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the buffer's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_buffer_set_last_error(cardano_buffer_t* buffer, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific object.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_buffer_set_last_error for the given
+ * object. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] buffer A pointer to the \ref cardano_buffer_t instance whose last error
+ *                   message is to be retrieved. If the object is NULL, the function
+ *                   returns a generic error message indicating the null object.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified object. If the object is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_buffer_set_last_error for the same object, or until
+ *       the object is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_buffer_get_last_error(const cardano_buffer_t* buffer);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_buffer_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_buffer_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_buffer_deep_clone(const cardano_buffer_t* source, cardano_buffer_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUFFER_H
diff --git a/vendor/include/cardano/cardano.h b/vendor/include/cardano/cardano.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/cardano.h
@@ -0,0 +1,305 @@
+/**
+ * \file cardano.h
+ *
+ * \author angel.castillo
+ * \date   Mar 13, 2024
+ *
+ * \section LICENSE
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/address/address_type.h>
+#include <cardano/address/base_address.h>
+#include <cardano/address/byron_address.h>
+#include <cardano/address/byron_address_attributes.h>
+#include <cardano/address/byron_address_type.h>
+#include <cardano/address/enterprise_address.h>
+#include <cardano/address/pointer_address.h>
+#include <cardano/address/reward_address.h>
+#include <cardano/address/stake_pointer.h>
+#include <cardano/assets/asset_id.h>
+#include <cardano/assets/asset_id_list.h>
+#include <cardano/assets/asset_id_map.h>
+#include <cardano/assets/asset_name.h>
+#include <cardano/assets/asset_name_list.h>
+#include <cardano/assets/asset_name_map.h>
+#include <cardano/assets/multi_asset.h>
+#include <cardano/assets/policy_id_list.h>
+#include <cardano/auxiliary_data/auxiliary_data.h>
+#include <cardano/auxiliary_data/metadatum.h>
+#include <cardano/auxiliary_data/metadatum_kind.h>
+#include <cardano/auxiliary_data/metadatum_label_list.h>
+#include <cardano/auxiliary_data/metadatum_list.h>
+#include <cardano/auxiliary_data/metadatum_map.h>
+#include <cardano/auxiliary_data/plutus_v1_script_list.h>
+#include <cardano/auxiliary_data/plutus_v2_script_list.h>
+#include <cardano/auxiliary_data/plutus_v3_script_list.h>
+#include <cardano/auxiliary_data/plutus_v4_script_list.h>
+#include <cardano/auxiliary_data/transaction_metadata.h>
+#include <cardano/bip39.h>
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_major_type.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_reader_state.h>
+#include <cardano/cbor/cbor_simple_value.h>
+#include <cardano/cbor/cbor_tag.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/certs/auth_committee_hot_cert.h>
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/certificate.h>
+#include <cardano/certs/certificate_set.h>
+#include <cardano/certs/genesis_key_delegation_cert.h>
+#include <cardano/certs/mir_cert.h>
+#include <cardano/certs/mir_cert_pot_type.h>
+#include <cardano/certs/mir_cert_type.h>
+#include <cardano/certs/mir_to_pot_cert.h>
+#include <cardano/certs/mir_to_stake_creds_cert.h>
+#include <cardano/certs/pool_registration_cert.h>
+#include <cardano/certs/pool_retirement_cert.h>
+#include <cardano/certs/register_drep_cert.h>
+#include <cardano/certs/registration_cert.h>
+#include <cardano/certs/resign_committee_cold_cert.h>
+#include <cardano/certs/stake_delegation_cert.h>
+#include <cardano/certs/stake_deregistration_cert.h>
+#include <cardano/certs/stake_registration_cert.h>
+#include <cardano/certs/stake_registration_delegation_cert.h>
+#include <cardano/certs/stake_vote_delegation_cert.h>
+#include <cardano/certs/stake_vote_registration_delegation_cert.h>
+#include <cardano/certs/unregister_drep_cert.h>
+#include <cardano/certs/unregistration_cert.h>
+#include <cardano/certs/update_drep_cert.h>
+#include <cardano/certs/vote_delegation_cert.h>
+#include <cardano/certs/vote_registration_delegation_cert.h>
+#include <cardano/common/anchor.h>
+#include <cardano/common/bigint.h>
+#include <cardano/common/byte_order.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/credential_type.h>
+#include <cardano/common/datum.h>
+#include <cardano/common/datum_type.h>
+#include <cardano/common/drep.h>
+#include <cardano/common/drep_type.h>
+#include <cardano/common/ex_units.h>
+#include <cardano/common/governance_action_id.h>
+#include <cardano/common/governance_key_type.h>
+#include <cardano/common/guard_set.h>
+#include <cardano/common/network_id.h>
+#include <cardano/common/protocol_version.h>
+#include <cardano/common/reward_address_list.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/common/utxo.h>
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/crypto/bip32_private_key.h>
+#include <cardano/crypto/bip32_public_key.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/blake2b_hash_set.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/crypto/crc32.h>
+#include <cardano/crypto/ed25519_private_key.h>
+#include <cardano/crypto/ed25519_public_key.h>
+#include <cardano/crypto/ed25519_signature.h>
+#include <cardano/crypto/emip3.h>
+#include <cardano/crypto/pbkdf2.h>
+#include <cardano/encoding/base58.h>
+#include <cardano/encoding/bech32.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_context.h>
+#include <cardano/json/json_format.h>
+#include <cardano/json/json_object.h>
+#include <cardano/json/json_object_type.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/key_handlers/account_derivation_path.h>
+#include <cardano/key_handlers/cip_1852_constants.h>
+#include <cardano/key_handlers/derivation_path.h>
+#include <cardano/key_handlers/secure_key_handler.h>
+#include <cardano/key_handlers/secure_key_handler_impl.h>
+#include <cardano/key_handlers/secure_key_handler_type.h>
+#include <cardano/key_handlers/software_secure_key_handler.h>
+#include <cardano/message_signing/cip8.h>
+#include <cardano/object.h>
+#include <cardano/plutus_data/constr_plutus_data.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/plutus_data/plutus_data_kind.h>
+#include <cardano/plutus_data/plutus_list.h>
+#include <cardano/plutus_data/plutus_map.h>
+#include <cardano/pool_params/bls_key.h>
+#include <cardano/pool_params/ipv4.h>
+#include <cardano/pool_params/ipv6.h>
+#include <cardano/pool_params/multi_host_name_relay.h>
+#include <cardano/pool_params/pool_metadata.h>
+#include <cardano/pool_params/pool_owners.h>
+#include <cardano/pool_params/pool_params.h>
+#include <cardano/pool_params/relay.h>
+#include <cardano/pool_params/relay_type.h>
+#include <cardano/pool_params/relays.h>
+#include <cardano/pool_params/single_host_addr_relay.h>
+#include <cardano/pool_params/single_host_name_relay.h>
+#include <cardano/proposal_procedures/committee.h>
+#include <cardano/proposal_procedures/committee_members_map.h>
+#include <cardano/proposal_procedures/constitution.h>
+#include <cardano/proposal_procedures/credential_set.h>
+#include <cardano/proposal_procedures/governance_action_type.h>
+#include <cardano/proposal_procedures/hard_fork_initiation_action.h>
+#include <cardano/proposal_procedures/info_action.h>
+#include <cardano/proposal_procedures/new_constitution_action.h>
+#include <cardano/proposal_procedures/no_confidence_action.h>
+#include <cardano/proposal_procedures/parameter_change_action.h>
+#include <cardano/proposal_procedures/proposal_procedure.h>
+#include <cardano/proposal_procedures/proposal_procedure_set.h>
+#include <cardano/proposal_procedures/treasury_withdrawals_action.h>
+#include <cardano/proposal_procedures/update_committee_action.h>
+#include <cardano/protocol_params/cost_model.h>
+#include <cardano/protocol_params/costmdls.h>
+#include <cardano/protocol_params/drep_voting_thresholds.h>
+#include <cardano/protocol_params/ex_unit_prices.h>
+#include <cardano/protocol_params/pool_voting_thresholds.h>
+#include <cardano/protocol_params/proposed_param_updates.h>
+#include <cardano/protocol_params/protocol_param_update.h>
+#include <cardano/protocol_params/update.h>
+#include <cardano/scripts/native_scripts/native_script.h>
+#include <cardano/scripts/native_scripts/native_script_list.h>
+#include <cardano/scripts/native_scripts/native_script_type.h>
+#include <cardano/scripts/native_scripts/script_all.h>
+#include <cardano/scripts/native_scripts/script_any.h>
+#include <cardano/scripts/native_scripts/script_invalid_after.h>
+#include <cardano/scripts/native_scripts/script_invalid_before.h>
+#include <cardano/scripts/native_scripts/script_n_of_k.h>
+#include <cardano/scripts/native_scripts/script_pubkey.h>
+#include <cardano/scripts/native_scripts/script_require_guard.h>
+#include <cardano/scripts/plutus_scripts/plutus_language_version.h>
+#include <cardano/scripts/plutus_scripts/plutus_v1_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v2_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v3_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v4_script.h>
+#include <cardano/scripts/script.h>
+#include <cardano/scripts/script_language.h>
+#include <cardano/slot_config.h>
+#include <cardano/time.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/transaction_body/account_balance_interval.h>
+#include <cardano/transaction_body/account_balance_intervals_map.h>
+#include <cardano/transaction_body/direct_deposit_map.h>
+#include <cardano/transaction_body/required_guards_map.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/transaction_body/transaction_input.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+#include <cardano/transaction_body/transaction_output.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+#include <cardano/transaction_body/value.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+#include <cardano/transaction_builder/balancing/implicit_coin.h>
+#include <cardano/transaction_builder/balancing/input_to_redeemer_map.h>
+#include <cardano/transaction_builder/balancing/transaction_balancing.h>
+#include <cardano/transaction_builder/coin_selection/coin_selection_request.h>
+#include <cardano/transaction_builder/coin_selection/coin_selection_strategy.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector_impl.h>
+#include <cardano/transaction_builder/coin_selection/large_first_coin_selector.h>
+#include <cardano/transaction_builder/coin_selection/random_improve_coin_selector.h>
+#include <cardano/transaction_builder/evaluation/native_tx_evaluator.h>
+#include <cardano/transaction_builder/evaluation/provider_tx_evaluator.h>
+#include <cardano/transaction_builder/evaluation/tx_evaluator.h>
+#include <cardano/transaction_builder/evaluation/tx_evaluator_impl.h>
+#include <cardano/transaction_builder/fee.h>
+#include <cardano/transaction_builder/script_data_hash.h>
+#include <cardano/transaction_builder/sub_transaction_builder.h>
+#include <cardano/transaction_builder/transaction_builder.h>
+#include <cardano/typedefs.h>
+#include <cardano/uplc/uplc_apply_params.h>
+#include <cardano/voting_procedures/governance_action_id_list.h>
+#include <cardano/voting_procedures/vote.h>
+#include <cardano/voting_procedures/voter.h>
+#include <cardano/voting_procedures/voter_list.h>
+#include <cardano/voting_procedures/voter_type.h>
+#include <cardano/voting_procedures/voting_procedure.h>
+#include <cardano/voting_procedures/voting_procedures.h>
+#include <cardano/witness_set/bootstrap_witness.h>
+#include <cardano/witness_set/bootstrap_witness_set.h>
+#include <cardano/witness_set/native_script_set.h>
+#include <cardano/witness_set/plutus_data_set.h>
+#include <cardano/witness_set/plutus_v1_script_set.h>
+#include <cardano/witness_set/plutus_v2_script_set.h>
+#include <cardano/witness_set/plutus_v3_script_set.h>
+#include <cardano/witness_set/plutus_v4_script_set.h>
+#include <cardano/witness_set/redeemer.h>
+#include <cardano/witness_set/redeemer_list.h>
+#include <cardano/witness_set/redeemer_tag.h>
+#include <cardano/witness_set/vkey_witness.h>
+#include <cardano/witness_set/vkey_witness_set.h>
+#include <cardano/witness_set/witness_set.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Retrieves the version of the Cardano C library.
+ *
+ * This function returns a string representing the version of the Cardano C library. The string
+ * is statically allocated and should not be freed by the caller. The version string follows the
+ * Semantic Versioning (SemVer) format, which consists of three segments: MAJOR.MINOR.PATCH
+ * (e.g., "1.0.3").
+ *
+ * \return A pointer to a statically allocated string containing the library's version. This string
+ * is located in read-only memory and must not be modified or freed by the caller.
+ */
+CARDANO_EXPORT const char* cardano_get_lib_version(void);
+
+/**
+ * \brief Securely wipes the contents of a buffer from memory.
+ *
+ * The `cardano_memzero` function is used to securely erase the sensitive data stored in the provided \p buffer.
+ * This ensures that the data is no longer recoverable from memory after it has been used.
+ *
+ * After use, sensitive data should be overwritten. However, traditional approaches like `memset()` or hand-written
+ * memory clearing routines can be stripped away by optimizing compilers or linkers, potentially leaving sensitive
+ * information exposed.
+ *
+ * The `cardano_memzero` function guarantees that the memory is cleared, even in the presence of compiler optimizations.
+ * It is especially important to call this function before freeing memory that contains sensitive information, such as
+ * cryptographic keys or decrypted data, to prevent the data from remaining in memory.
+ *
+ * \param[in] buffer A pointer to the buffer whose contents should be securely erased.
+ * \param[in] size The size of the buffer in bytes.
+ *
+ * \example
+ * \code
+ * // Example usage after processing sensitive data
+ * char sensitive_data[64] = ...; // Buffer containing sensitive data
+ *
+ * // Wipe the buffer contents securely
+ * cardano_memzero(sensitive_data, 64);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_memzero(void* buffer, size_t size);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_H
diff --git a/vendor/include/cardano/cbor/cbor_major_type.h b/vendor/include/cardano/cbor/cbor_major_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/cbor/cbor_major_type.h
@@ -0,0 +1,117 @@
+/**
+ * \file cbor_major_type.h
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_MAJOR_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_MAJOR_TYPE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents CBOR Major Types as defined in RFC 7049 section 2.1.
+ *
+ * These major types are used to identify the type of data in a CBOR data item.
+ */
+typedef enum
+{
+  /**
+   * \brief An unsigned integer.
+   *
+   * Range: 0 to 2^64-1 inclusive. The value of the encoded item is the argument itself.
+   */
+  CARDANO_CBOR_MAJOR_TYPE_UNSIGNED_INTEGER = 0,
+
+  /**
+   * \brief A negative integer.
+   *
+   * Range: -2^64 to -1 inclusive. The value of the item is -1 minus the argument.
+   */
+  CARDANO_CBOR_MAJOR_TYPE_NEGATIVE_INTEGER = 1,
+
+  /**
+   * \brief A byte string.
+   *
+   * The number of bytes in the string is equal to the argument.
+   */
+  CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING = 2,
+
+  /**
+   * \brief A text string encoded as UTF-8.
+   *
+   * Refer to Section 2 and RFC 3629. The number of bytes in the string is equal to the argument.
+   */
+  CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING = 3,
+
+  /**
+   * \brief An array of data items.
+   *
+   * Also known as lists, sequences, or tuples. A "CBOR sequence" is slightly different (see RFC 8742).
+   * The argument specifies the number of data items in the array.
+   */
+  CARDANO_CBOR_MAJOR_TYPE_ARRAY = 4,
+
+  /**
+   * \brief A map of pairs of data items.
+   *
+   * Also known as tables, dictionaries, hashes, or objects (in JSON).
+   */
+  CARDANO_CBOR_MAJOR_TYPE_MAP = 5,
+
+  /**
+   * \brief A tagged data item ("tag").
+   *
+   * Tag number ranges from 0 to 2^64-1 inclusive. The enclosed data item (tag content) follows the head.
+   */
+  CARDANO_CBOR_MAJOR_TYPE_TAG = 6,
+
+  /**
+   * \brief Simple values, floating-point numbers, and the "break" stop code.
+   */
+  CARDANO_CBOR_MAJOR_TYPE_SIMPLE = 7,
+
+  /**
+   * \brief Undefined major type.
+   */
+  CARDANO_CBOR_MAJOR_TYPE_UNDEFINED = 0xFFFFFFFF
+} cardano_cbor_major_type_t;
+
+/**
+ * \brief Converts CBOR major type to their human readable form if possible.
+ *
+ * \param[in] major_type The major type to get the string representation for.
+ * \return Human readable form of the given major type. If the major type is unknown,
+ * returns "Major Type: Unknown".
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_cbor_major_type_to_string(cardano_cbor_major_type_t major_type);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_MAJOR_TYPE_H
diff --git a/vendor/include/cardano/cbor/cbor_reader.h b/vendor/include/cardano/cbor/cbor_reader.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/cbor/cbor_reader.h
@@ -0,0 +1,1036 @@
+/**
+ * \file cbor_reader.h
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader_state.h>
+#include <cardano/cbor/cbor_simple_value.h>
+#include <cardano/cbor/cbor_tag.h>
+#include <cardano/common/bigint.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a reader for parsing Concise Binary Object Representation (CBOR) encoded data.
+ */
+typedef struct cardano_cbor_reader_t cardano_cbor_reader_t;
+
+/**
+ * \brief Creates a new instance of a cardano_cbor_reader_t object for reading CBOR encoded data.
+ *
+ * This function initializes a new CBOR reader object with a given buffer containing CBOR data.
+ * The created reader is capable of parsing the CBOR data, allowing for the extraction and
+ * interpretation of the encoded information.
+ *
+ * \param[in] cbor_data Pointer to the buffer containing the CBOR encoded data to be read.
+ * \param[in] size The size of the buffer in bytes.
+ *
+ * \return A pointer to the newly created \ref cardano_cbor_reader_t object. This object
+ * represents a "strong reference" to the CBOR reader, meaning that it is fully initialized
+ * and ready for use. The caller is responsible for managing the lifecycle of this object.
+ * Specifically, once the CBOR reader is no longer needed, the caller must release it by
+ * calling \ref cardano_cbor_reader_unref.
+ *
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Create a new CBOR reader
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(data, size_size);
+ *
+ * if (reader)
+ * {
+ *   // Use the reader for CBOR decoding tasks
+ *
+ *   // Once done, ensure to clean up and release the reader
+ *   cardano_cbor_reader_unref(&reader);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_cbor_reader_t* cardano_cbor_reader_new(const byte_t* cbor_data, size_t size);
+
+/**
+ * \brief Creates a new instance of a cardano_cbor_reader_t object for reading CBOR data from a hexadecimal string.
+ *
+ * \param[in] hex_string Pointer to the null-terminated string containing the hexadecimal representation of CBOR encoded data.
+ * \param[in] size The size of the hex string in bytes, not including the null terminator.
+ *
+ * \return On success, a pointer to the newly created \ref cardano_cbor_reader_t object. This object
+ * represents a "strong reference" to the CBOR reader, indicating that it is fully initialized
+ * and ready to parse the decoded CBOR data. The caller is responsible for managing the lifecycle
+ * of this object. Specifically, the object must be released by calling \ref cardano_cbor_reader_unref
+ * once it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming `hex_data` is a null-terminated string containing hexadecimal CBOR data
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_from_hex(hex_data, strlen(hex_data));
+ *
+ * if (reader)
+ * {
+ *   // Use the reader for CBOR decoding tasks
+ *
+ *   // Once done, ensure to clean up and release the reader
+ *   cardano_cbor_reader_unref(&reader);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_cbor_reader_t* cardano_cbor_reader_from_hex(const char* hex_string, size_t size);
+
+/**
+ * \brief Decrements the reference count of a CBOR reader object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_cbor_reader_t object
+ * by decreasing its reference count. When the reference count reaches zero, the CBOR reader is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] cbor_reader A pointer to the pointer of the CBOR reader object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new();
+ *
+ * // Perform operations with the reader...
+ *
+ * cardano_cbor_reader_unref(&reader);
+ * // At this point, reader is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_cbor_reader_unref, the pointer to the \ref cardano_cbor_reader_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_cbor_reader_unref(cardano_cbor_reader_t** cbor_reader);
+
+/**
+ * \brief Increases the reference count of the cardano_cbor_reader_t object.
+ *
+ * This function is used to manually increment the reference count of a CBOR reader
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_cbor_reader_unref.
+ *
+ * \param cbor_reader A pointer to the CBOR reader object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming reader is a previously created CBOR reader object
+ *
+ * cardano_cbor_reader_ref(reader);
+ *
+ * // Now reader can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_cbor_reader_ref there is a corresponding
+ * call to \ref cardano_cbor_reader_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_cbor_reader_ref(cardano_cbor_reader_t* cbor_reader);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_cbor_reader_t object.
+ *
+ * This function returns the number of active references to a CBOR reader object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_cbor_reader_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param cbor_reader A pointer to the CBOR reader object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified CBOR reader object. If the object
+ * is properly managed (i.e., every \ref cardano_cbor_reader_ref call is matched with a
+ * \ref cardano_cbor_reader_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming reader is a previously created CBOR reader object
+ *
+ * size_t ref_count = cardano_cbor_reader_refcount(reader);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_cbor_reader_refcount(const cardano_cbor_reader_t* cbor_reader);
+
+/**
+ * \brief Reads the next CBOR token from the reader without advancing the reader's internal position.
+ *
+ * This function examines the next CBOR token in the data stream, allowing the caller to inspect
+ * the type and structure of the upcoming data without actually consuming it. This is particularly
+ * useful for conditional parsing based on the upcoming data type or for implementing look-ahead
+ * parsing strategies in more complex CBOR structures.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the next CBOR token
+ * is to be examined.
+ * \param[out] state Pointer to a \ref cardano_cbor_reader_state_t variable where the current state of the
+ * CBOR reader will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on successful
+ * examination of the next CBOR token, or an appropriate error code indicating the reason for failure.
+ * Refer to \ref cardano_error_t documentation for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_state_t state;
+ * cardano_error_t error = cardano_cbor_reader_peek_state(&state);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Analyze `state` to decide how to proceed
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_peek_state(cardano_cbor_reader_t* reader, cardano_cbor_reader_state_t* state);
+
+/**
+ * \brief Retrieves the total number of unread bytes remaining in the CBOR reader's buffer.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the number of unread bytes is to be retrieved.
+ * \param[out] bytes_remaining A pointer to a size_t variable where the number of unread bytes
+ * remaining in the buffer will be stored. This value represents how much data is available
+ * for reading and processing before the end of the buffer is reached.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ * or an appropriate error code indicating the reason for failure. Refer to \ref cardano_error_t documentation
+ * for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * size_t bytes_remaining;
+ * cardano_error_t error = cardano_cbor_reader_get_bytes_remaining(&bytes_remaining);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   printf("Bytes remaining: %zu\n", bytes_remaining);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_get_bytes_remaining(cardano_cbor_reader_t* reader, size_t* bytes_remaining);
+
+/**
+ * \brief Retrieves the remaining bytes from the CBOR reader.
+ *
+ * This function copies the remainder of the bytes from the CBOR reader that have not yet been parsed.
+ * It's useful for scenarios where the parsing process is either partial or selective, and the caller
+ * needs access to the unparsed portion of the data.
+ *
+ * \param[in] reader The CBOR reader instance from which the remainder bytes are to be retrieved.
+ * \param[out] remainder_bytes A buffer with a copy of the remainder bytes. The caller
+ * is responsible for releasing this buffer using \ref cardano_buffer_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the remainder bytes were successfully retrieved and copied into
+ *         the provided buffer. If the operation fails due to an insufficient buffer size or
+ *         other issues, an appropriate error code is returned. Refer to \c cardano_error_t
+ *         documentation for details on possible error codes.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_buffer_t* remainder_bytes_buffer = NULL;
+ *
+ * if (cardano_cbor_reader_get_remainder_bytes(reader, buffer) == CARDANO_SUCCESS)
+ * {
+ *   // Use remainder_bytes_buffer as needed
+ *   cardano_buffer_unref(&remainder_bytes_buffer);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_get_remainder_bytes(cardano_cbor_reader_t* reader, cardano_buffer_t** remainder_bytes);
+
+/**
+ * \brief Clones a CBOR reader.
+ *
+ * This function creates a duplicate of the given \ref cardano_cbor_reader_t object.
+ * It allocates a new \ref cardano_cbor_reader_t object that is a clone of the provided reader.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t object to be cloned.
+ * \param[out] clone On successful cloning, this will point to a newly created
+ *                   \ref cardano_cbor_reader_t object. This object represents a "strong reference"
+ *                   to the cloned reader, meaning that it is fully initialized and ready for use.
+ *                   The caller is responsible for managing the lifecycle of this object.
+ *                   Specifically, once the cloned reader is no longer needed, the caller must release it
+ *                   by calling \ref cardano_cbor_reader_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the reader was successfully cloned, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* original_reader = cardano_cbor_reader_new(...); // Assume original_reader is initialized
+ * cardano_cbor_reader_t* cloned_reader = NULL;
+ *
+ * // Attempt to clone the original reader
+ * cardano_error_t result = cardano_cbor_reader_clone(original_reader, &cloned_reader);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the cloned reader
+ *
+ *   // Once done, ensure to clean up and release the cloned reader
+ *   cardano_cbor_reader_unref(&cloned_reader);
+ * }
+ *
+ * // Clean up the original reader object once done
+ * cardano_cbor_reader_unref(&original_reader);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_clone(cardano_cbor_reader_t* reader, cardano_cbor_reader_t** clone);
+
+/**
+ * \brief Skips the next CBOR data item and advances the reader.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the next CBOR data item
+ * is to be skipped.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ * or an appropriate error code indicating the reason for failure. Refer to \ref cardano_error_t documentation
+ * for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming `reader` is a previously initialized CBOR reader
+ * cardano_error_t error = cardano_cbor_reader_skip_value(reader);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The reader has successfully skipped the next CBOR data item
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_skip_value(cardano_cbor_reader_t* reader);
+
+/**
+ * \brief Reads the next CBOR data item, returning a subarray with the encoded value.
+ *
+ * This function reads the next CBOR data item from the reader and returns a subarray
+ * representing the encoded value as a contiguous region of memory. The subarray is
+ * returned as a pointer to a \ref cardano_buffer_t object, which contains the encoded
+ * data. For data items encoded with indefinite length, the returned subarray includes
+ * the "break" byte that marks the end of the data item.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the next
+ * CBOR data item is to be read.
+ * \param[out] encoded_value A pointer to a pointer to \ref cardano_buffer_t, which will be
+ * allocated and populated with the encoded value. The caller is responsible for releasing
+ * this buffer using \ref cardano_buffer_unref when it is no longer needed.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ * or an appropriate error code indicating the reason for failure. Refer to \ref cardano_error_t documentation
+ * for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_buffer_t* encoded_value = NULL;
+ * cardano_error_t error = cardano_cbor_reader_read_encoded_value(reader, &encoded_value);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Use `encoded_value` for further processing
+ *   cardano_buffer_unref(&encoded_value); // Clean up after use
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_encoded_value(cardano_cbor_reader_t* reader, cardano_buffer_t** encoded_value);
+
+/**
+ * \brief Reads the next data item as the start of an array (major type 4).
+ *
+ * This function attempts to read the next data item from the reader as the start of a CBOR array.
+ * It decodes the length of the array and provides this information through the size parameter.
+ * If the array is of indefinite length, the function returns a negative size value.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the start of the array is to be read.
+ * \param[out] size A pointer to an int64_t variable where the size of the array will be stored.
+ * If the array is of definite length, size will be set to the number of elements in the array.
+ * If the array is of indefinite length, size will be set to a negative value.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ * or an appropriate error code indicating the reason for failure. Refer to \ref cardano_error_t documentation
+ * for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * int64_t array_size = 0;
+ * cardano_error_t error = cardano_cbor_reader_read_start_array(reader, &array_size);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   if (arraySize >= 0)
+ *   {
+ *     printf("Definite-length array with %lld elements.\n", array_size);
+ *   }
+ *   else
+ *   {
+ *     printf("Indefinite-length array.\n");
+ *   }
+ *   // Proceed with reading array items
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ *
+ * \note The caller should check if the array is of indefinite length by examining
+ * if the size is negative, and should handle array items accordingly.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_start_array(cardano_cbor_reader_t* reader, int64_t* size);
+
+/**
+ * \brief Reads the end of an array (major type 4).
+ *
+ * This function is used to read the end marker of an array in CBOR format. For arrays of definite length,
+ * this function confirms the end of the array has been reached according to the previously read length.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the end of the array is to be read.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ * or an appropriate error code indicating the reason for failure. Refer to \ref cardano_error_t documentation
+ * for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming the start of an array has been read, and items processed
+ * cardano_error_t error = cardano_cbor_reader_read_end_array(reader);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   printf("End of array reached.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ *
+ * \note This function should be called after reading all elements of an array to ensure that
+ * the array is correctly terminated, especially in the case of indefinite length arrays.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_end_array(cardano_cbor_reader_t* reader);
+
+/**
+ * \brief Reads the next data item as a signed integer (major types 0,1).
+ *
+ * This function decodes and reads the next CBOR data item from the stream as a signed integer.
+ * It handles both positive and negative integers according to CBOR's major types 0 and 1 encoding rules.
+ * The decoded integer is stored in the provided `value` parameter.
+ * Values outside the int64_t range return \ref CARDANO_ERROR_INTEGER_OVERFLOW.
+ * On overflow, the output value and reader position remain unchanged.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the signed integer
+ * is to be read.
+ * \param[out] value Pointer to an `int64_t` variable where the decoded integer value will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ * or an appropriate error code indicating the reason for failure. Refer to \ref cardano_error_t documentation
+ * for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * int64_t value;
+ * cardano_error_t error = cardano_cbor_reader_read_int(reader, &value);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   printf("Decoded integer: %lld\n", (long long)value);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_int(cardano_cbor_reader_t* reader, int64_t* value);
+
+/**
+ * \brief Reads the next data item as an unsigned integer (major type 0).
+ *
+ * This function decodes and reads the next CBOR data item from the stream as an unsigned integer,
+ * following the CBOR major type 0 encoding rules. The decoded unsigned integer is stored in the
+ * provided `value` parameter.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the unsigned integer
+ * is to be read.
+ * \param[out] value Pointer to a `uint64_t` variable where the decoded unsigned integer value will
+ * be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ * or an appropriate error code indicating the reason for failure. Refer to \ref cardano_error_t documentation
+ * for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t value;
+ *
+ * cardano_error_t error = cardano_cbor_reader_read_uint(reader, &value);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   printf("Decoded unsigned integer: %llu\n", (unsigned long long)value);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_uint(cardano_cbor_reader_t* reader, uint64_t* value);
+
+/**
+ * \brief Reads the next data item as a negative integer (major type 1) and returns its raw argument.
+ *
+ * A CBOR negative integer carries an unsigned argument \c n and represents the value \c -1 - n.
+ * This function returns \c n unchanged, so every negative integer the encoding allows, down to
+ * \c -2^64, can be read without overflowing a signed 64-bit integer.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the negative integer
+ * is to be read.
+ * \param[out] argument Pointer to a `uint64_t` variable where the argument \c n will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ * or an appropriate error code indicating the reason for failure, such as \ref CARDANO_ERROR_DECODING when
+ * the next data item is not a negative integer.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t argument = 0;
+ *
+ * cardano_error_t error = cardano_cbor_reader_read_negative_int(reader, &argument);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   printf("Decoded negative integer: -1 - %llu\n", (unsigned long long)argument);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_negative_int(cardano_cbor_reader_t* reader, uint64_t* argument);
+
+/**
+ * \brief Decodes and reads a big integer (bignum) from CBOR format.
+ *
+ * This function reads and decodes a bignum from a provided CBOR reader, following the
+ * encoding format specified in RFC 7049, section 2.4.2. Bignums are used to represent
+ * integers that are too large to be represented directly in the available integer types
+ * of CBOR. The function interprets the appropriate tag and decodes the integer value: tag 2
+ * (unsigned bignum) yields the byte string magnitude \c n, and tag 3 (negative bignum) yields
+ * \c -1 - n, as defined in RFC 8949, section 3.4.3.
+ *
+ * \param[in] reader The \ref cardano_cbor_reader_t instance from which the bignum will be read.
+ * \param[out] bigint A pointer to a pointer that will be set to the address of the newly created \ref cardano_bigint_t object
+ *                    representing the decoded big integer value. The caller is responsible for managing the memory of this object.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the bignum value was successfully decoded and read from the
+ *         CBOR stream. If the operation encounters an error, such as invalid parameters or issues with
+ *         reading from the stream, an appropriate error code is returned indicating the reason for the failure.
+ *         Consult the \ref cardano_error_t documentation for details on possible error codes and their meanings.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, cbor_data_size);
+ * if (reader)
+ * {
+ *   cardano_bigint_t* bigint = NULL;
+ *   cardano_error_t result = cardano_cbor_reader_read_bigint(reader, &bigint);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Successfully read bignum from the reader
+ *     // Use the bigint
+ *   }
+ *
+ *   // Clean up
+ *   cardano_bigint_unref(&bigint);
+ *   cardano_cbor_reader_unref(&reader);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_bigint(cardano_cbor_reader_t* reader, cardano_bigint_t** bigint);
+
+/**
+ * \brief Reads the next data item as a double-precision floating point number (major type 7).
+ *
+ * This function decodes and reads the next CBOR data item from the stream as a double-precision floating point number.
+ * It handles the floating-point numbers according to CBOR's major type 7 encoding rules.
+ * The decoded double is stored in the provided `value` parameter.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the double-precision
+ * floating point number is to be read.
+ * \param[out] value Pointer to a `double` variable where the decoded floating point value will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ * or an appropriate error code indicating the reason for failure. Refer to \ref cardano_error_t documentation
+ * for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * double value;
+ *
+ * cardano_error_t error = cardano_cbor_reader_read_double(reader, &value);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   printf("Decoded double: %f\n", value);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_double(cardano_cbor_reader_t* reader, double* value);
+
+/**
+ * \brief Reads the next data item as a CBOR simple value (major type 7).
+ *
+ * This function decodes and reads the next CBOR data item from the stream as a CBOR simple value,
+ * according to CBOR's major type 7 encoding rules for simple values (e.g., true, false, null, undefined).
+ * The decoded simple value is stored in the provided `value` parameter.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the simple value is to be read.
+ * \param[out] value Pointer to a `cardano_cbor_simple_value_t` variable where the decoded simple value will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ * or an appropriate error code indicating the reason for failure. Refer to \ref cardano_error_t documentation
+ * for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_simple_value_t value;
+ *
+ * cardano_error_t error = cardano_cbor_reader_read_simple_value(reader, &value);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Process the decoded simple value
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_simple_value(cardano_cbor_reader_t* reader, cardano_cbor_simple_value_t* value);
+
+/**
+ * \brief Reads the next data item as the start of a map (major type 5).
+ *
+ * This function decodes and reads the next CBOR data item from the stream as the start of a map,
+ * following CBOR's major type 5 encoding rules for maps. Maps are collections of key-value pairs.
+ * The number of key-value pairs is stored in the provided `size` parameter. A `size` of -1 indicates
+ * an indefinite-length map, while a non-negative value indicates a definite-length map with that many
+ * key-value pairs.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the start of the map is to be read.
+ * \param[out] size Pointer to an `int64_t` variable where the size of the map (number of key-value pairs)
+ *                  will be stored. A value of -1 indicates an indefinite-length map.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ * or an appropriate error code indicating the reason for failure. Refer to \ref cardano_error_t documentation
+ * for details on possible error codes.
+ *
+ * \remark Map contents are consumed as if they were arrays twice the length of the map's declared size.
+ * For example, a map of size 1 containing a key of type int with a value of type string
+ * must be consumed by successive calls to readInt32 and readTextString.
+ *
+ * Usage Example:
+ * \code{.c}
+ * int64_t map_size;
+ *
+ * cardano_error_t error = cardano_cbor_reader_read_start_map(reader, &map_size);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Process the start of the map, prepare to read key-value pairs
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_start_map(cardano_cbor_reader_t* reader, int64_t* size);
+
+/**
+ * \brief Reads the end of a map (major type 5).
+ *
+ * This function is used to signify the end of reading a map encoded in CBOR format. It is applicable for
+ * maps that were started with \ref cardano_cbor_reader_read_start_map, especially for indefinite-length maps
+ * where an explicit end marker is needed. For definite-length maps, this function can be used as a validation
+ * step to ensure that the expected number of key-value pairs has been read.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the end of the map is to be read.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on successful
+ * reading of the map's end marker, or an appropriate error code indicating the reason for failure. Refer
+ * to \ref cardano_error_t documentation for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // After reading all key-value pairs of the map
+ * cardano_error_t error = cardano_cbor_reader_read_end_map(reader);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Successfully read the end of the map
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_end_map(cardano_cbor_reader_t* reader);
+
+/**
+ * \brief Reads the next data item as a boolean value (major type 7).
+ *
+ * This function reads and decodes the next data item from the CBOR stream as a boolean value.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the boolean value is to be read.
+ * \param[out] value Pointer to a boolean variable where the decoded value will be stored. The
+ * value is set to `true` if the CBOR data item represents true, and `false` if it represents false.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on successful
+ * reading and decoding of the boolean value, or an appropriate error code indicating the reason for failure.
+ * Refer to \ref cardano_error_t documentation for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * bool value;
+ * cardano_error_t error = cardano_cbor_reader_read_bool(reader, &value);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Successfully read the boolean value
+ *   if (value)
+ *   {
+ *     printf("The boolean value is true.\n");
+ *   }
+ *   else
+ *   {
+ *     printf("The boolean value is false.\n");
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_bool(cardano_cbor_reader_t* reader, bool* value);
+
+/**
+ * \brief Reads the next data item as a null value (major type 7).
+ *
+ * This function is used to read a null value from the CBOR stream, indicating the absence of a value.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the null value is to be read.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS if the next
+ * data item in the stream is correctly identified as a null value, or an appropriate error code indicating
+ * the reason for failure. Refer to \ref cardano_error_t documentation for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_error_t error = cardano_cbor_reader_read_null(reader);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Successfully read a null value
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ *
+ * \note This function advances the reader to the next item in the CBOR stream after successfully reading
+ * a null value. If the current data item is not a null value, an error will be returned.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_null(cardano_cbor_reader_t* reader);
+
+/**
+ * \brief Reads the next data item as a byte string (major type 2).
+ *
+ * This function reads a byte string from the CBOR stream. This function is capable of handling both
+ * definite-length byte strings and indefinite-length byte strings. In the case of indefinite-length
+ * strings, the function concatenates all segments into a single contiguous byte string.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the byte string is to be read.
+ * \param[out] byte_string A pointer to a pointer to a \ref cardano_buffer_t structure where the decoded byte
+ *                         string will be stored. The caller is responsible for freeing this buffer using
+ *                         \ref cardano_buffer_unref when it is no longer needed.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS if the byte string
+ * is successfully read from the CBOR stream, or an appropriate error code indicating the reason for failure.
+ * Refer to \ref cardano_error_t documentation for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_buffer_t* byte_string = NULL;
+ *
+ * cardano_error_t error = cardano_cbor_reader_read_bytestring(reader, &byte_string);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Successfully read a byte string, byte_string contains the data
+ *   // Process byte_string as needed
+ *   cardano_buffer_unref(&byte_string); // Clean up when done
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ *
+ * \note This function allocates a new \ref cardano_buffer_t to hold the byte string's data. It is the caller's
+ * responsibility to release this memory by calling \ref cardano_buffer_unref on the buffer pointer.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_bytestring(cardano_cbor_reader_t* reader, cardano_buffer_t** byte_string);
+
+/**
+ * \brief Reads the next data item as a text string (major type 3) from the CBOR stream.
+ *
+ * This function parses the next CBOR data item, expecting it to be a text string (major type 3),
+ * and returns its value as a newly created `cardano_buffer_t` instance containing the text string
+ * encoded as UTF-8. The function supports both definite-length strings and indefinite-length strings,
+ * seamlessly handling the concatenation of string fragments in the case of the latter.
+ *
+ * \param[in] reader A pointer to the `cardano_cbor_reader_t` instance responsible for reading the CBOR data.
+ * \param[out] text_string A pointer to a pointer of `cardano_buffer_t` where the text string will be stored.
+ *                On successful execution, this points to a newly allocated buffer containing the text string.
+ *                The caller assumes ownership of this buffer and is responsible for deallocating it using the
+ *                appropriate function (e.g., `cardano_buffer_unref`) when it is no longer needed.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS if the text string
+ * is successfully read from the CBOR stream, or an appropriate error code indicating the reason for failure.
+ * Refer to \ref cardano_error_t documentation for details on possible error codes.
+ *
+ * Usage example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_buffer_t* text_string = NULL;
+ *
+ * if (cardano_cbor_reader_read_textstring(reader, &text_string) == CARDANO_SUCCESS)
+ * {
+ *   // Use the text_string for your application logic
+ *
+ *   // Cleanup
+ *   cardano_buffer_unref(&text_string);
+ * }
+ * else
+ * {
+ *   printf("Failed to read text string from CBOR data.\n");
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_textstring(cardano_cbor_reader_t* reader, cardano_buffer_t** text_string);
+
+/**
+ * \brief Reads the next data item as a semantic tag (major type 6), advancing the reader.
+ *
+ * Tag values greater than INT32_MAX return \ref CARDANO_ERROR_INTEGER_OVERFLOW without
+ * changing the output or consuming input. Use \ref cardano_cbor_reader_skip_value or
+ * \ref cardano_cbor_reader_read_encoded_value to handle arbitrary unsigned 64-bit tags.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the tag is to be read.
+ * \param[out] tag A pointer to a \ref cardano_cbor_tag_t variable where the decoded tag value will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS if the tag is
+ * successfully read from the CBOR stream, or an appropriate error code indicating the reason for failure.
+ * Refer to \ref cardano_error_t documentation for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_tag_t tag;
+ *
+ * cardano_error_t error = cardano_cbor_reader_read_tag(reader, &tag);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Successfully read a semantic tag, tag contains the value
+ *   // Process the tag as needed
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_read_tag(cardano_cbor_reader_t* reader, cardano_cbor_tag_t* tag);
+
+/**
+ * \brief Peeks at the next semantic tag (major type 6) in the CBOR stream without consuming it.
+ *
+ * Tag values greater than INT32_MAX return \ref CARDANO_ERROR_INTEGER_OVERFLOW without
+ * changing the output or consuming input. Use \ref cardano_cbor_reader_skip_value or
+ * \ref cardano_cbor_reader_read_encoded_value to handle arbitrary unsigned 64-bit tags.
+ *
+ * This function peeks at the semantic tag ahead in the CBOR data stream. Semantic tags provide additional context
+ * to the subsequent data item, according to the CBOR specification (major type 6). This peek operation allows
+ * the application to inspect the tag without advancing the reader's position, enabling decisions based on the tag
+ * value before fully processing the associated data item.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance from which the tag is to be peeked.
+ * \param[out] tag A pointer to a \ref cardano_cbor_tag_t variable where the tag value will be stored if a tag is present.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS if a tag is successfully
+ * peeked at, or an appropriate error code indicating the reason for failure. Refer to \ref cardano_error_t
+ * documentation for details on possible error codes.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_tag_t tag;
+ *
+ * cardano_error_t error = cardano_cbor_reader_peek_tag(reader, &tag);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Successfully peeked at the next semantic tag, tag contains the value
+ *   // Decision making based on the peeked tag
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ *
+ * \note This function does not modify the reader's current position, allowing subsequent operations to
+ * process or skip the tag as needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_reader_peek_tag(cardano_cbor_reader_t* reader, cardano_cbor_tag_t* tag);
+
+/**
+ * \brief Sets the last error message for a given CBOR reader object.
+ *
+ * Records an error message in the CBOR reader's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance whose last error message is
+ *                   to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the reader's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_cbor_reader_set_last_error(cardano_cbor_reader_t* reader, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific reader.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_cbor_reader_set_last_error for the given
+ * reader. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance whose last error
+ *                   message is to be retrieved. If the reader is NULL, the function
+ *                   returns a generic error message indicating the null reader.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified reader. If the reader is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_cbor_reader_set_last_error for the same reader, or until
+ *       the reader is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_cbor_reader_get_last_error(const cardano_cbor_reader_t* reader);
+
+/**
+ * \brief Deep copies the reader buffer, position, and nested parsing state.
+ * \param[in] reader Reader to copy. Must not be NULL.
+ * \param[out] clone Receives one owned reference, or NULL on failure. Must not be NULL.
+ * \return CARDANO_SUCCESS, CARDANO_ERROR_POINTER_IS_NULL, or CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ * \note Release the result with cardano_cbor_reader_unref. Advancing either reader does not advance the other.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_cbor_reader_deep_clone(const cardano_cbor_reader_t* reader, cardano_cbor_reader_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_H
diff --git a/vendor/include/cardano/cbor/cbor_reader_state.h b/vendor/include/cardano/cbor/cbor_reader_state.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/cbor/cbor_reader_state.h
@@ -0,0 +1,169 @@
+/**
+ * \file cbor_reader_state.h
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_STATE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_STATE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Specifies the state of a CborReader instance.
+ *
+ * This enumeration outlines the possible states of a CborReader as it processes
+ * CBOR data items.
+ */
+typedef enum
+{
+  /**
+   * \brief Indicates the undefined state.
+   *
+   * This state is used when the CborReader has not yet begun processing
+   * or the state is otherwise unknown.
+   */
+  CARDANO_CBOR_READER_STATE_UNDEFINED = 0,
+
+  /**
+   * \brief Indicates that the next CBOR data item is an unsigned integer (major type 0).
+   */
+  CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER,
+
+  /**
+   * \brief Indicates that the next CBOR data item is a negative integer (major type 1).
+   */
+  CARDANO_CBOR_READER_STATE_NEGATIVE_INTEGER,
+
+  /**
+   * \brief Indicates that the next CBOR data item is a byte string (major type 2).
+   */
+  CARDANO_CBOR_READER_STATE_BYTESTRING,
+
+  /**
+   * \brief Indicates the start of an indefinite-length byte string (major type 2).
+   */
+  CARDANO_CBOR_READER_STATE_START_INDEFINITE_LENGTH_BYTESTRING,
+
+  /**
+   * \brief Indicates the end of an indefinite-length byte string (major type 2).
+   */
+  CARDANO_CBOR_READER_STATE_END_INDEFINITE_LENGTH_BYTESTRING,
+
+  /**
+   * \brief Indicates that the next CBOR data item is a UTF-8 string (major type 3).
+   */
+  CARDANO_CBOR_READER_STATE_TEXTSTRING,
+
+  /**
+   * \brief Indicates the start of an indefinite-length UTF-8 text string (major type 3).
+   */
+  CARDANO_CBOR_READER_STATE_START_INDEFINITE_LENGTH_TEXTSTRING,
+
+  /**
+   * \brief Indicates the end of an indefinite-length UTF-8 text string (major type 3).
+   */
+  CARDANO_CBOR_READER_STATE_END_INDEFINITE_LENGTH_TEXTSTRING,
+
+  /**
+   * \brief Indicates the start of an array (major type 4).
+   */
+  CARDANO_CBOR_READER_STATE_START_ARRAY,
+
+  /**
+   * \brief Indicates the end of an array (major type 4).
+   */
+  CARDANO_CBOR_READER_STATE_END_ARRAY,
+
+  /**
+   * \brief Indicates the start of a map (major type 5).
+   */
+  CARDANO_CBOR_READER_STATE_START_MAP,
+
+  /**
+   * \brief Indicates the end of a map (major type 5).
+   */
+  CARDANO_CBOR_READER_STATE_END_MAP,
+
+  /**
+   * \brief Indicates that the next CBOR data item is a semantic reader_state (major type 6).
+   */
+  CARDANO_CBOR_READER_STATE_TAG,
+
+  /**
+   * \brief Indicates that the next CBOR data item is a simple value (major type 7).
+   */
+  CARDANO_CBOR_READER_STATE_SIMPLE_VALUE,
+
+  /**
+   * \brief Indicates an IEEE 754 Half-Precision float (major type 7).
+   */
+  CARDANO_CBOR_READER_STATE_HALF_PRECISION_FLOAT,
+
+  /**
+   * \brief Indicates an IEEE 754 Single-Precision float (major type 7).
+   */
+  CARDANO_CBOR_READER_STATE_SINGLE_PRECISION_FLOAT,
+
+  /**
+   * \brief Indicates an IEEE 754 Double-Precision float (major type 7).
+   */
+  CARDANO_CBOR_READER_STATE_DOUBLE_PRECISION_FLOAT,
+
+  /**
+   * \brief Indicates a null literal (major type 7).
+   */
+  CARDANO_CBOR_READER_STATE_NULL,
+
+  /**
+   * \brief Indicates a bool value (major type 7).
+   */
+  CARDANO_CBOR_READER_STATE_BOOLEAN,
+
+  /**
+   * \brief Indicates the completion of reading a full CBOR document.
+   *
+   * This state is reached when the CborReader has successfully processed
+   * an entire CBOR document and there are no more data items to read.
+   */
+  CARDANO_CBOR_READER_STATE_FINISHED
+} cardano_cbor_reader_state_t;
+
+/**
+ * \brief Converts CBOR reader states to their human readable form if possible.
+ *
+ * \param[in] reader_state The reader state to get the string representation for.
+ * \return Human readable form of the given reader state. If the reader state is unknown,
+ * returns "Reader State: Unknown".
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_cbor_reader_state_to_string(cardano_cbor_reader_state_t reader_state);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_STATE_H
diff --git a/vendor/include/cardano/cbor/cbor_simple_value.h b/vendor/include/cardano/cbor/cbor_simple_value.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/cbor/cbor_simple_value.h
@@ -0,0 +1,89 @@
+/**
+ * \file cbor_simple_value.h
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_SIMPLE_VALUE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_SIMPLE_VALUE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a CBOR simple value (major type 7).
+ *
+ * These simple values are part of the CBOR data format as defined in RFC 7049, section 2.3,
+ * representing commonly used simple data items. This enumeration includes the simple values
+ * for 'false', 'true', 'null', and 'undefined', each of which has a specific role in the CBOR encoding
+ * and interpretation process.
+ */
+typedef enum
+{
+  /**
+   * \brief Represents the value 'false'.
+   *
+   * This value is used to represent the boolean false in CBOR-encoded data.
+   */
+  CARDANO_CBOR_SIMPLE_VALUE_FALSE = 20,
+
+  /**
+   * \brief Represents the value 'true'.
+   *
+   * This value is used to represent the boolean true in CBOR-encoded data.
+   */
+  CARDANO_CBOR_SIMPLE_VALUE_TRUE = 21,
+
+  /**
+   * \brief Represents the value 'null'.
+   *
+   * This value signifies a null reference or the absence of data in CBOR-encoded data.
+   */
+  CARDANO_CBOR_SIMPLE_VALUE_NULL = 22,
+
+  /**
+   * \brief Represents an undefined value.
+   *
+   * This value is used by an encoder as a substitute for a data item with an encoding problem,
+   * indicating the absence of meaningful or correct data.
+   */
+  CARDANO_CBOR_SIMPLE_VALUE_UNDEFINED = 23
+} cardano_cbor_simple_value_t;
+
+/**
+ * \brief Converts CBOR simple value to their human readable form.
+ *
+ * \param[in] simple_value The simple value to get the string representation for.
+ * \return Human readable form of the given simple value. If the simple value is unknown,
+ * returns "Simple Value: Unknown".
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_cbor_simple_value_to_string(cardano_cbor_simple_value_t simple_value);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_SIMPLE_VALUE_H
diff --git a/vendor/include/cardano/cbor/cbor_tag.h b/vendor/include/cardano/cbor/cbor_tag.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/cbor/cbor_tag.h
@@ -0,0 +1,131 @@
+/**
+ * \file cbor_tag.h
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_TAG_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_TAG_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a CBOR semantic tag (major type 6).
+ *
+ * Semantic tags in CBOR (Concise Binary Object Representation) provide additional context
+ * to the data items that follow them, as defined in the CBOR standard (RFC 7049). These tags
+ * indicate how the subsequent data should be interpreted, ranging from date/time formats
+ * to various encoding schemes and specialized data types.
+ */
+typedef enum
+{
+  /**
+   * \brief Tag value for RFC3339 date/time strings.
+   *
+   * Indicates that the following string data item is formatted according
+   * to the RFC3339 specification for date and time.
+   */
+  CARDANO_CBOR_TAG_DATE_TIME_STRING = 0,
+
+  /**
+   * \brief Tag value for Epoch-based date/time in seconds.
+   *
+   * Denotes that the following integer data item represents a date and time as
+   * the number of seconds elapsed since the Unix epoch (1970-01-01T00:00Z).
+   */
+  CARDANO_CBOR_TAG_UNIX_TIME_SECONDS = 1,
+
+  /**
+   * \brief Tag value for unsigned bignum encodings.
+   *
+   * Used to encode arbitrarily large unsigned integers that cannot fit within
+   * the standard integer data item types.
+   */
+  CARDANO_CBOR_TAG_UNSIGNED_BIG_NUM = 2,
+
+  /**
+   * \brief Tag value for negative bignum encodings.
+   *
+   * Represents arbitrarily large negative integers, complementing the unsigned
+   * bignum encoding for handling integers beyond the built-in integer types.
+   */
+  CARDANO_CBOR_TAG_NEGATIVE_BIG_NUM = 3,
+
+  /**
+   * \brief Tag value for decimal fraction encodings.
+   *
+   * Allows for the precise representation of decimal numbers using a base-10
+   * exponent notation. Followed by an array of two integers: the exponent and
+   * the significand.
+   */
+  CARDANO_CBOR_TAG_DECIMAL_FRACTION = 4,
+
+  /**
+   * \brief Tag value for big float encodings.
+   *
+   * Encodes floating-point numbers with arbitrary precision. Followed by an
+   * array of two integers representing the base-2 exponent and significand.
+   */
+  CARDANO_CBOR_TAG_BIG_FLOAT = 5,
+
+  /**
+   * \brief Tag value for byte strings containing embedded CBOR data item encodings.
+   */
+  CARDANO_ENCODED_CBOR_DATA_ITEM = 24,
+
+  /**
+   * \brief Tag value for Rational numbers, as defined in http://peteroupc.github.io/CBOR/rational.html.
+   */
+  CARDANO_ENCODED_CBOR_RATIONAL_NUMBER = 30,
+
+  /**
+   * \brief Tag value for `set<a> = #6.258([* a]) / [* a]`, `nonempty_set<a> = #6.258([+ a]) / [+ a]`, `nonempty_oset<a> = #6.258([+ a]) / [+ a]`
+   */
+  CARDANO_CBOR_TAG_SET = 258,
+
+  /**
+   * \brief Tag value for the Self-Describe CBOR header (0xd9d9f7).
+   *
+   * When placed at the beginning of a CBOR document, this tag signals that the
+   * document is encoded in CBOR, facilitating content type detection.
+   */
+  CARDANO_CBOR_TAG_SELF_DESCRIBE_CBOR = 55799
+} cardano_cbor_tag_t;
+
+/**
+ * \brief Converts CBOR tags to their human readable form if possible.
+ *
+ * \param[in] tag The tag to get the string representation for.
+ * \return Human readable form of the given tag. If the tag is unknown, returns "Tag: Custom".
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_cbor_tag_to_string(cardano_cbor_tag_t tag);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_TAG_H
diff --git a/vendor/include/cardano/cbor/cbor_writer.h b/vendor/include/cardano/cbor/cbor_writer.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/cbor/cbor_writer.h
@@ -0,0 +1,1044 @@
+/**
+ * \file cbor_writer.h
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_WRITER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_WRITER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_tag.h>
+#include <cardano/common/bigint.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A simple writer for Concise Binary Object Representation (CBOR) encoded data.
+ *
+ * This structure represents a writer that facilitates encoding data into the CBOR format.
+ * It abstracts the complexities involved in CBOR encoding, providing a simple interface
+ * for creating CBOR data streams. The writer maintains internal state to track the encoding
+ * process, ensuring efficient and accurate representation of various data types as per
+ * CBOR standards (RFC 7049).
+ */
+typedef struct cardano_cbor_writer_t cardano_cbor_writer_t;
+
+/**
+ * \brief Creates and initializes a new instance of a CBOR writer.
+ *
+ * This function allocates and returns a new instance of \ref cardano_cbor_writer_t,
+ * setting up its internal state for encoding CBOR data.
+ *
+ * \return A pointer to the newly created \ref cardano_cbor_writer_t object. This object
+ * represents a "strong reference" to the CBOR writer, meaning that it is fully initialized
+ * and ready for use. The caller is responsible for managing the lifecycle of this object.
+ * Specifically, once the CBOR writer is no longer needed, the caller must release it by
+ * calling \ref cardano_cbor_writer_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Create a new CBOR writer
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   // Use the writer for CBOR encoding tasks
+ *
+ *   // Once done, ensure to clean up and release the writer
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_cbor_writer_t* cardano_cbor_writer_new(void);
+
+/**
+ * \brief Decrements the reference count of a CBOR writer object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_cbor_writer_t object
+ * by decreasing its reference count. When the reference count reaches zero, the CBOR writer is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] cbor_writer A pointer to the pointer of the CBOR writer object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * // Perform operations with the writer...
+ *
+ * cardano_cbor_writer_unref(&writer);
+ * // At this point, writer is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_cbor_writer_unref, the pointer to the \ref cardano_cbor_writer_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_cbor_writer_unref(cardano_cbor_writer_t** cbor_writer);
+
+/**
+ * \brief Increases the reference count of the cardano_cbor_writer_t object.
+ *
+ * This function is used to manually increment the reference count of a CBOR writer
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_cbor_writer_unref.
+ *
+ * \param cbor_writer A pointer to the CBOR writer object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming writer is a previously created CBOR writer object
+ *
+ * cardano_cbor_writer_ref(writer);
+ *
+ * // Now writer can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_cbor_writer_ref there is a corresponding
+ * call to \ref cardano_cbor_writer_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_cbor_writer_ref(cardano_cbor_writer_t* cbor_writer);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_cbor_writer_t object.
+ *
+ * This function returns the number of active references to a CBOR writer object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_cbor_writer_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param cbor_writer A pointer to the CBOR writer object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified CBOR writer object. If the object
+ * is properly managed (i.e., every \ref cardano_cbor_writer_ref call is matched with a
+ * \ref cardano_cbor_writer_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming writer is a previously created CBOR writer object
+ *
+ * size_t ref_count = cardano_cbor_writer_refcount(writer);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_cbor_writer_refcount(const cardano_cbor_writer_t* cbor_writer);
+
+/**
+ * \brief Encodes and writes a big integer (bignum) in CBOR format.
+ *
+ * This function writes a provided big integer value as a bignum, following the
+ * encoding format specified in RFC 7049, section 2.4.2. Bignums are used to represent
+ * integers that are too large to be represented directly in the available integer types
+ * of CBOR. The function applies the appropriate tag before encoding the integer value: a value
+ * \c v >= 0 is written as tag 2 (unsigned bignum) with magnitude \c v, and a value \c v < 0 is
+ * written as tag 3 (negative bignum) with magnitude \c -1 - v, as defined in RFC 8949, section 3.4.3.
+ *
+ * \param[in] writer The \ref cardano_cbor_writer_t instance to which the bignum will be written.
+ * \param[in] bigint The \ref cardano_bigint_t object representing the big integer value to be encoded as a bignum.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the bignum value was successfully encoded and written to the
+ *         CBOR stream. If the operation encounters an error, such as invalid parameters or issues with
+ *         writing to the stream, an appropriate error code is returned indicating the reason for the failure.
+ *         Consult the \ref cardano_error_t documentation for details on possible error codes and their meanings.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   // Example large value to encode as bignum
+ *   cardano_bigint_t* bigint = NULL;
+ *   cardano_bigint_from_string("123456789123456789123456789", strln("123456789123456789123456789"), 10, &bigint);
+ *
+ *   cardano_error_t result = cardano_cbor_writer_write_bigint(writer, bigint);
+ *
+ *   ...
+ *
+ *   cardano_bigint_unref(&bigint);
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_bigint(cardano_cbor_writer_t* writer, const cardano_bigint_t* bigint);
+
+/**
+ * \brief Encodes and writes a boolean value in CBOR format as per RFC 7049, section 2.3.
+ *
+ * This function is responsible for encoding a boolean value (`true` or `false`) and writing it
+ * to the CBOR stream managed by the specified \ref cardano_cbor_writer_t instance. Boolean values
+ * are encoded in CBOR as major type 7, with specific additional information values to denote
+ * `true` (21) or `false` (20).
+ *
+ * \param[in] writer The \ref cardano_cbor_writer_t instance to which the boolean value will be written.
+ * \param[in] value The boolean value to write. A value of \c true will be encoded as a CBOR `true` value,
+ *                  and \c false as a CBOR `false` value.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the boolean value was successfully encoded and written to the
+ *         CBOR stream. If the operation encounters an error, such as invalid parameters or issues with
+ *         writing to the stream, an appropriate error code is returned indicating the reason for the failure.
+ *         Consult the \ref cardano_error_t documentation for details on possible error codes and their meanings.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_cbor_writer_write_bool(writer, true);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *   // The boolean value 'true' was successfully written as CBOR to the writer
+ *   }
+ *   else
+ *   {
+ *   // Handle error
+ *   }
+ *
+     cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_bool(cardano_cbor_writer_t* writer, bool value);
+
+/**
+ * \brief Encodes and writes a byte buffer as a CBOR byte string (major type 2).
+ *
+ * This function takes a byte buffer and writes it to the specified CBOR writer as a byte string,
+ * following the CBOR encoding rules for byte strings (major type 2). This is used to serialize
+ * raw binary data in CBOR format.
+ *
+ * \param[in] writer The \ref cardano_cbor_writer_t instance to which the byte string will be written.
+ * \param[in] data A pointer to the byte buffer containing the data to be written as a CBOR byte string.
+ *                 The data in this buffer will be copied exactly as it is into the CBOR stream, encoded
+ *                 as a byte string.
+ * \param[in] size The number of bytes in the \c data buffer that will be written as part of the CBOR
+ *                 byte string. This value determines the length of the resulting byte string in the
+ *                 CBOR stream.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the byte buffer was successfully serialized and written to the
+ *         CBOR stream as a byte string. If the function fails to perform the serialization or write operation,
+ *         it returns an error code that specifies the nature of the failure. For detailed information on
+ *         error codes and their meanings, refer to the \ref cardano_error_t documentation.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ * byte_t data[] = {0xde, 0xad, 0xbe, 0xef}; // Example binary data
+ * size_t data_size = sizeof(data);
+ *
+ * cardano_error_t result = cardano_cbor_writer_write_bytestring(writer, data, data_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The binary data was successfully written as a CBOR byte string
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_cbor_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_bytestring(cardano_cbor_writer_t* writer, const byte_t* data, size_t size);
+
+/**
+ * \brief Encodes and writes a UTF-8 encoded text string as a CBOR text string (major type 3).
+ *
+ * This function serializes a given text string, provided as a UTF-8 encoded `char` array, and writes it
+ * into the specified CBOR stream. Text strings are encoded in CBOR as major type 3, following the format
+ * outlined in the CBOR specification (RFC 7049).
+ *
+ * \param[in] writer A pointer to the \ref cardano_cbor_writer_t structure that represents the CBOR stream
+ *                   where the text string will be written.
+ * \param[in] data A pointer to the `char` array containing the UTF-8 encoded text string to be serialized
+ *                 and written to the CBOR stream.
+ * \param[in] size The length of the text string in bytes (characters), excluding any null terminator.
+ *                 This specifies the exact number of bytes to be written from the \c data array to the
+ *                 CBOR stream as the text string content.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the text string was successfully encoded and written to the
+ *         CBOR stream. If the function encounters an error, such as an issue with the parameters provided
+ *         or a problem with the CBOR stream, an appropriate error code is returned, indicating the reason
+ *         for the failure. Refer to the \ref cardano_error_t documentation for an exhaustive list of error
+ *         codes and their respective meanings.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   const char* text = "Hello, CBOR!";
+ *   size_t text_length = strlen(text);
+ *   cardano_error_t result = cardano_cbor_writer_write_textstring(writer, text, text_length);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Text string successfully written to CBOR stream
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_textstring(cardano_cbor_writer_t* writer, const char* data, size_t size);
+
+/**
+ * \brief Writes a buffer containing a pre-encoded CBOR data item into a CBOR stream.
+ *
+ * This function facilitates the insertion of a CBOR data item that has already been encoded
+ * into a CBOR stream. It is particularly useful in scenarios where the data item to be added
+ * to the stream exists in its final encoded form and needs to be included without alteration.
+ * The function ensures that the pre-encoded data is integrated into the stream seamlessly,
+ * maintaining the integrity and structure of the CBOR encoding.
+ *
+ * \param writer A pointer to the \ref cardano_cbor_writer_t structure representing the CBOR stream
+ *               to which the pre-encoded data item is to be added.
+ *
+ * \param data A pointer to the byte buffer that contains the pre-encoded CBOR data item. This
+ *             buffer should contain the data item in a format that complies with CBOR encoding
+ *             specifications. The function does not modify the content of this buffer; it simply
+ *             adds it to the CBOR stream as-is.
+ *
+ * \param size The size, in bytes, of the pre-encoded data buffer. This value specifies the number
+ *             of bytes to be written from the \c data buffer to the CBOR stream. It is the caller's
+ *             responsibility to ensure that this size accurately reflects the length of the pre-encoded
+ *             data item and that the data itself adheres to the correct CBOR encoding standards.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. If the pre-encoded data
+ *         item is successfully added to the CBOR stream, the function returns \ref CARDANO_SUCCESS. If
+ *         an error occurs during the operation, the function returns an error code identifying the
+ *         specific failure reason. Consult the documentation for \ref cardano_error_t for a detailed
+ *         list of potential error codes and their respective meanings.
+ *
+ * Example usage:
+ * \code{.c}
+ * // Assume writer is a previously initialized CBOR writer object
+ * byte_t pre_encoded_data[] = { ... }; // Pre-encoded CBOR data
+ * size_t data_size = sizeof(pre_encoded_data);
+ *
+ * cardano_error_t result = cardano_cbor_writer_write_encoded(writer, pre_encoded_data, data_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Pre-encoded data was successfully added to the CBOR stream
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_encoded(cardano_cbor_writer_t* writer, const byte_t* data, size_t size);
+
+/**
+ * \brief Initiates the writing of an array in the CBOR stream, supporting both definite and indefinite lengths.
+ *
+ * This function marks the start of an array within the CBOR data stream being constructed. CBOR arrays can be of
+ * definite length, where the total number of elements is known ahead of time, or of indefinite length, where the
+ * total number of elements is not predetermined. This function allows the caller to specify which type of array
+ * is being started by setting the \c size parameter accordingly.
+ *
+ * \param[in] writer A pointer to the \ref cardano_cbor_writer_t instance that is being used to construct the CBOR stream.
+ * \param[in] size   The total number of elements expected in the array for definite-length arrays, or -1 for starting an
+ *                   indefinite-length array. In the case of an indefinite-length array, the writing process is open-ended
+ *                   until the \ref cardano_cbor_writer_write_end_array function is called to signal the end of the array.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the array
+ *         start marker is successfully written to the stream. If an error occurs (e.g., due to an invalid \c writer pointer,
+ *         or if \c writer is not in a ready state), an error code corresponding to the specific failure reason is returned.
+ *         Consult the \ref cardano_error_t enumeration for a detailed list of error codes.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   // Start a definite-length array with 3 elements
+ *   cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 3);
+ *
+ *   if (result != CARDANO_SUCCESS)
+ *   {
+ *       // Handle error
+ *   }
+ *
+ *   // Alternatively, start an indefinite-length array
+ *   result = cardano_cbor_writer_write_start_array(writer, -1);
+ *
+ *   if (result != CARDANO_SUCCESS)
+ *   {
+ *     // Handle error
+ *   }
+ *
+ *   // Proceed with writing array elements...
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ * \endcode
+ *
+ * \note For indefinite-length arrays, you must call \ref cardano_cbor_writer_write_end_array after writing all
+ *       array elements to properly close the array in the CBOR stream.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_start_array(cardano_cbor_writer_t* writer, int64_t size);
+
+/**
+ * \brief Concludes the encoding of an indefinite-length array in the CBOR stream.
+ *
+ * This function marks the end of an indefinite-length array that was initiated with
+ * \ref cardano_cbor_writer_write_start_array using a length parameter of 0. It writes an
+ * end-of-array marker to the CBOR stream, signaling the closure of the array structure.
+ *
+ * \param[in] writer A pointer to the \ref cardano_cbor_writer_t instance representing the CBOR stream
+ *                   to which the end-of-array marker is to be added. It is imperative that this function
+ *                   is called only after a corresponding call to \ref cardano_cbor_writer_write_start_array
+ *                   with a length of 0.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. On successful addition
+ *         of the end-of-array marker, \ref CARDANO_SUCCESS is returned. If the operation encounters an
+ *         error, an error code specifying the nature of the issue is returned. Refer to the \ref cardano_error_t
+ *         enumeration for an exhaustive list of error codes and their corresponding meanings.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 0); // Start indefinite-length array
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Write array elements...
+ *     result = cardano_cbor_writer_write_end_array(writer); // End the indefinite-length array
+ *
+ *     if (result != CARDANO_SUCCESS)
+ *     {
+ *       // Handle error
+ *     }
+ *   }
+ *
+ *     cardano_cbor_writer_unref(&writer);
+ * }
+ * \endcode
+ *
+ * \note The function is specifically designed for arrays of indefinite length. Attempting to use this
+ *       function without a preceding call to \ref cardano_cbor_writer_write_start_array with a length
+ *       parameter of 0 may result in incorrect CBOR stream formation and should be avoided.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_end_array(cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Starts the writing of a map (key-value pairs) in the CBOR stream.
+ *
+ * This function is used to begin the encoding of a CBOR map, which consists of key-value pairs. It supports
+ * the creation of both definite-length maps, where the number of key-value pairs is known upfront, and
+ * indefinite-length maps, where the number of pairs is determined as the map is being written. The
+ * definite-length map is initiated by specifying the exact number of pairs, while the indefinite-length
+ * map is started by passing -1 as the length parameter.
+ *
+ * \param[in] writer A pointer to the \ref cardano_cbor_writer_t structure that represents the CBOR stream
+ *                   where the map will be encoded.
+ * \param[in] size   The number of key-value pairs for a definite-length map, or -1 to indicate the start
+ *                   of an indefinite-length map. For indefinite-length maps, the end must be explicitly
+ *                   marked using \ref cardano_cbor_writer_write_end_map to complete the map encoding.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         map's initiation is successfully written to the stream. If the operation encounters an error, an
+ *         error code is returned specifying the failure reason. Refer to the \ref cardano_error_t enumeration
+ *         for details on the possible error codes and their meanings.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   // Start a definite-length map with 2 key-value pairs
+ *   cardano_error_t result = cardano_cbor_writer_write_start_map(writer, 2);
+ *
+ *   if (result != CARDANO_SUCCESS)
+ *   {
+ *     // Handle error
+ *   }
+ *
+ *   // Alternatively, start an indefinite-length map
+ *   result = cardano_cbor_writer_write_start_map(writer, -1);
+ *   if (result != CARDANO_SUCCESS)
+ *   {
+ *     // Handle error
+ *   }
+ *
+ *   // Proceed with writing key-value pairs...
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ * \endcode
+ *
+ * \note For indefinite-length maps, you must call \ref cardano_cbor_writer_write_end_map after adding
+ *       all key-value pairs to correctly close the map structure in the CBOR stream.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_start_map(cardano_cbor_writer_t* writer, int64_t size);
+
+/**
+ * \brief Concludes the writing of an indefinite-length map (major type 5) in CBOR format.
+ *
+ * This function is used to signify the end of an indefinite-length map in a CBOR stream. It is specifically
+ * applicable when a map was started with cardano_cbor_writer_write_start_map() with a length parameter of 0,
+ * indicating an indefinite-length map. Definite-length maps, where the total number of key-value pairs is known
+ * and specified at the start, do not require this function to mark their end, as their boundaries are implicitly
+ * defined by the length parameter.
+ *
+ * It is important to ensure that all key-value pairs intended for the map have been written before calling this
+ * function, as it marks the map's closure in the CBOR encoding. After calling this function, new data items written
+ * to the stream will not be considered part of the map.
+ *
+ * \param writer A pointer to the \ref cardano_cbor_writer_t structure representing the CBOR stream
+ *               where the end-of-map marker will be written. The writer must have been previously
+ *               initialized and must be in a valid state for writing.
+ *
+ * \return A \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         upon successfully marking the end of the map in the CBOR stream. If the operation fails, an
+ *         appropriate error code is returned indicating the reason for failure. Refer to the
+ *         \ref cardano_error_t documentation for details on possible error codes.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_end_map(cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Encodes an unsigned integer as a CBOR data item and writes it to the CBOR stream.
+ *
+ * This function is designed to encode an unsigned integer value, following CBOR's major type 0
+ * specification, and then write this encoded value to the specified CBOR stream. It automatically
+ * optimizes the encoding based on the integer's value to ensure efficient representation within the
+ * CBOR format. This function supports encoding of the full range of unsigned 64-bit integers, from 0
+ * up to and including 2^64-1.
+ *
+ * \param[in] writer A pointer to a \ref cardano_cbor_writer_t instance representing the CBOR stream to
+ *                   which the encoded unsigned integer will be written.
+ * \param[in] value The unsigned 64-bit integer value to be encoded and written to the CBOR stream. This
+ *                  value is encoded according to the CBOR major type 0 rules.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the unsigned integer is successfully encoded and written to
+ *         the stream. If an error occurs during the process, a specific error code from the \ref cardano_error_t
+ *         enumeration is returned to indicate the failure reason.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   uint64_t value = 12345; // Example unsigned integer
+ *   cardano_error_t result = cardano_cbor_writer_write_uint(writer, value);
+ *
+ *   if (result != CARDANO_SUCCESS)
+ *   {
+ *     // Handle error
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_uint(cardano_cbor_writer_t* writer, uint64_t value);
+
+/**
+ * \brief Encodes and writes a negative integer (major type 1) from its raw argument.
+ *
+ * A CBOR negative integer carries an unsigned argument \c n and represents the value \c -1 - n.
+ * This function writes \c n unchanged, so every negative integer the encoding allows, down to
+ * \c -2^64, can be written, including those that do not fit in a signed 64-bit integer.
+ *
+ * \param[in] writer A pointer to the \ref cardano_cbor_writer_t instance tasked with constructing the CBOR stream.
+ * \param[in] argument The argument \c n of the negative integer \c -1 - n to be written.
+ *
+ * \return Returns \ref CARDANO_SUCCESS upon successful encoding and writing of the negative integer to the
+ *         CBOR stream. In the event of an error, a specific error code from the \ref cardano_error_t enumeration
+ *         is returned to detail the cause of the problem.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_cbor_writer_write_negative_int(writer, UINT64_MAX);
+ *
+ *   if (result != CARDANO_SUCCESS)
+ *   {
+ *     printf("Error: %s\n", cardano_error_to_string(result));
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_negative_int(cardano_cbor_writer_t* writer, uint64_t argument);
+
+/**
+ * \brief Encodes and writes a signed integer value to the CBOR stream, using CBOR major types 0 or 1.
+ *
+ * This function takes a signed integer value as input and encodes it into the CBOR format, automatically
+ * choosing between major type 0 for positive integers (including zero) and major type 1 for negative integers.
+ *
+ * \param[in] writer A pointer to the \ref cardano_cbor_writer_t instance tasked with constructing the CBOR stream.
+ * \param[in] value The signed 64-bit integer to be encoded and written to the stream. The function handles both
+ *                  positive and negative integers, automatically applying the correct CBOR major type based on
+ *                  the value's sign.
+ *
+ * \return Returns \ref CARDANO_SUCCESS upon successful encoding and writing of the signed integer value to the
+ *         CBOR stream. In the event of an error, a specific error code from the \ref cardano_error_t enumeration
+ *         is returned to detail the cause of the problem.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   int64_t value = -42; // Example negative integer
+ *   cardano_error_t result = cardano_cbor_writer_write_signed_int(writer, value);
+ *
+ *   if (result != CARDANO_SUCCESS)
+ *   {
+ *     // Handle error
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_signed_int(cardano_cbor_writer_t* writer, int64_t value);
+
+/**
+ * \brief Encodes a null value and writes it to the CBOR stream.
+ *
+ * This function is responsible for encoding a null value as per the CBOR specification
+ * (major type 7, additional information 22) and writing it to the specified CBOR stream.
+ * Null values are used to represent the absence of any meaningful value in CBOR data.
+ *
+ * \param[in] writer A pointer to the \ref cardano_cbor_writer_t structure representing the CBOR stream
+ *                   where the null value will be written.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the null value is successfully encoded and written to
+ *         the stream. If an error occurs, an error code from the \ref cardano_error_t enumeration
+ *         is returned, indicating the failure reason.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_cbor_writer_write_null(writer);
+ *
+ *   if (result != CARDANO_SUCCESS)
+ *   {
+ *     // Handle error
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ * \endcode
+ *
+ * \note
+ *   It is crucial that the writer is correctly initialized and in a state that permits
+ *   the addition of new encoded data to ensure the successful writing of the null value.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_null(cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Writes an undefined value to the CBOR stream (major type 7).
+ *
+ * In CBOR encoding, the "undefined" value is used to represent data that is explicitly unspecified.
+ *
+ * \param writer A pointer to the \ref cardano_cbor_writer_t structure representing the CBOR stream
+ *               to which the undefined value will be written. The writer should have been previously
+ *               initialized and must be in a valid state for writing. Using this function correctly
+ *               maintains the integrity of the CBOR stream by ensuring the undefined value is
+ *               properly encoded according to CBOR standards.
+ *
+ * \return A \ref cardano_error_t indicating the outcome of the operation. If the undefined value is
+ *         successfully encoded into the CBOR stream, \ref CARDANO_SUCCESS is returned. Should there be
+ *         a failure in writing the value, an appropriate error code is returned, providing insight
+ *         into the failure reason. Refer to the \ref cardano_error_t documentation for an exhaustive
+ *         list of potential error codes and their meanings.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_undefined(cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Assigns a semantic tag to the next data item in the CBOR stream.
+ *
+ * This function is used to give additional meaning or context to the succeeding data item by assigning a semantic tag to it,
+ * according to the CBOR specification. It's useful for indicating the type or purpose of the data that follows the tag,
+ * such as date-time strings, big numbers, or other specific data types.
+ *
+ * \param[in] writer The CBOR writer instance to which the tag will be written.
+ *
+ * \param[in] tag The semantic tag to assign to the next data item. It's an integer that represents the specific meaning
+ * or data type according to the predefined set of CBOR tags or potentially application-defined tags.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation. Returns \ref CARDANO_SUCCESS if the tag is successfully
+ * written to the CBOR stream. If the operation fails, an appropriate error code is returned to indicate the failure reason.
+ * See the documentation for \ref cardano_error_t for a list of error codes.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_write_tag(cardano_cbor_writer_t* writer, cardano_cbor_tag_t tag);
+
+/**
+ * \brief Calculates the required buffer size for the encoded data.
+ *
+ * This function determines the size of the buffer needed to store the  data encoded by the writer.
+ * It is intended to be used before calling `cardano_cbor_writer_encode` to allocate a buffer of appropriate size.
+ *
+ * \param[in] writer The source writer whose encoded data size is being calculated.
+ *
+ * \return The size of the buffer required to store the writer's encoded data. Returns 0 if the writer is NULL
+ * or contains no data.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * // Assume writer has been used to encode some CBOR data here
+ *
+ * size_t required_size = cardano_cbor_writer_get_encode_size(writer);
+ *
+ * // Now required_size can be used to allocate a buffer of appropriate size
+ * byte_t* data = (byte_t*)malloc(required_size);
+ *
+ * if (byte_t != NULL)
+ * {
+ *   if (cardano_cbor_writer_encode(writer, data, required_size) == CARDANO_SUCCESS)
+ *   {
+ *     // Operate on the encoded data
+ *   }
+ *
+ *   free(data); // Free the allocated string after use
+ * }
+ *
+ * cardano_cbor_writer_unref(&writer); // Properly dispose of the writer after use
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_cbor_writer_get_encode_size(cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Encodes data from the writer's context into CBOR format and outputs it to a provided buffer.
+ *
+ * This function encodes data prepared in the writer's internal context into CBOR format and writes it into an output
+ * buffer specified by the caller.
+ *
+ * \param[in] writer A pointer to the \ref cardano_cbor_writer_t structure representing the context and state for the CBOR encoding
+ *                   operation.
+ * \param[in] data A pointer to a byte array where the encoded data will be written. The function will fill this buffer with
+ *                 the CBOR-encoded data.
+ * \param[in] size The size of the data byte array, indicating how much space is available for writing the encoded data.
+ *
+ * \return A cardano_error_t indicating the outcome of the operation. Returns CARDANO_SUCCESS if the data is successfully
+ *         encoded into CBOR format and stored in the provided buffer. If the operation fails, an error code is returned indicating
+ *         the specific reason for failure. Detailed information on possible error codes and their meanings can be found in the
+ *         cardano_error_t documentation.
+ *
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * byte_t buffer[256]; // Pre-allocated buffer with sufficient space for the encoded data
+ *
+ * cardano_error_t result = cardano_cbor_writer_encode(writer, buffer, sizeof(buffer));
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Encoded CBOR data successfully. Bytes written: %zu\n", sizeof(buffer));
+ * }
+ * else
+ * {
+ *   printf("Failed to encode CBOR data. Error code: %d\n", result);
+ * }
+ *
+ * cardano_cbor_writer_unref(&writer); // Properly dispose of the writer after use
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_encode(cardano_cbor_writer_t* writer, byte_t* data, size_t size);
+
+/**
+ * \brief Encodes data from the writer's context into CBOR format and outputs it into a new buffer.
+ *
+ * This function encodes data prepared in the writer's internal context into CBOR format and writes it into a
+ * buffer. The function will create a new buffer instance to store the encoded data.
+ *
+ * \param[in] writer A pointer to the \ref cardano_cbor_writer_t structure representing the context and state for the CBOR encoding
+ *                   operation.
+ * \param[out] buffer A pointer to a \ref cardano_buffer_t object where the encoded data will be stored. The function will allocate
+ *                    and fill this buffer with the CBOR-encoded data. It is best to initialize this pointer as NULL. The caller is
+ *                    responsible for managing the lifecycle of the buffer, specifically releasing it by calling \ref cardano_buffer_unref
+ *                    when it is no longer needed.
+ *
+ * \return A cardano_error_t indicating the outcome of the operation. Returns CARDANO_SUCCESS if the data is successfully
+ *         encoded into CBOR format and stored in the provided buffer. If the operation fails, an error code is returned indicating
+ *         the specific reason for failure. Detailed information on possible error codes and their meanings can be found in the
+ *         cardano_error_t documentation.
+ *
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ * cardano_buffer_t* buffer = NULL; // Buffer will be allocated by the function
+ *
+ * cardano_error_t result = cardano_cbor_writer_encode_in_buffer(writer, &buffer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Encoded CBOR data successfully. Bytes written: %zu\n", cardano_buffer_get_size(buffer));
+ * }
+ * else
+ * {
+ *   printf("Failed to encode CBOR data. Error code: %d\n", result);
+ * }
+ *
+ * cardano_buffer_unref(&buffer); // Properly dispose of the buffer after use
+ * cardano_cbor_writer_unref(&writer); // Properly dispose of the writer after use
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_encode_in_buffer(cardano_cbor_writer_t* writer, cardano_buffer_t** buffer);
+
+/**
+ * \brief Calculates the required buffer size for the hex string representation of the encoded data.
+ *
+ * This function determines the size of the buffer needed to store the hexadecimal string representation
+ * of the data encoded by the writer. This size includes space for the null terminator. It is intended to
+ * be used before calling `cardano_cbor_writer_encode_hex` to allocate a buffer of appropriate size.
+ *
+ * \param[in] writer The source writer whose encoded data's hex string size is being calculated.
+ *
+ * \return The size of the buffer required to store the hex string representation of the writer's
+ * encoded data, including the null terminator. Returns 0 if the writer is NULL or contains no data.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * // Assume writer has been used to encode some CBOR data here
+ *
+ * // Calculate the required size for the hex string, including the null terminator
+ * size_t required_size = cardano_cbor_writer_get_hex_size(writer);
+ *
+ * // Now required_size can be used to allocate a buffer of appropriate size
+ * char* hex_string = (char*)malloc(required_size);
+ *
+ * if (hex_string != NULL)
+ * {
+ *   if (cardano_cbor_writer_encode_hex(writer, hex_string, required_size) == CARDANO_SUCCESS)
+ *   {
+ *     printf("Encoded CBOR data as hex: %s\n", hex_string);
+ *   }
+ *
+ *   free(hex_string); // Free the allocated string after use
+ * }
+ *
+ * cardano_cbor_writer_unref(&writer); // Properly dispose of the writer after use
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_cbor_writer_get_hex_size(const cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Writes the encoded data from the writer into a provided buffer as a hex string.
+ *
+ * This function converts the encoded data prepared in the writer's internal context into a
+ * hexadecimal string representation and writes it into the provided buffer. This approach
+ * is useful for debugging, logging, or any scenario where viewing the encoded data as a
+ * hex string is beneficial. The function requires the caller to allocate a buffer of
+ * appropriate size beforehand, based on the size obtained from \ref cardano_cbor_writer_get_hex_size.
+ *
+ * \param[in] writer The source writer whose data will be encoded into a hex string.
+ * \param[out] dest The destination buffer where the hex string will be written.
+ * \param[in] dest_size The size of the destination buffer, including space for the null terminator.
+ * The required size can be obtained using \ref cardano_cbor_writer_get_hex_size.
+ *
+ * \return A `cardano_error_t` indicating the result of the operation: `CARDANO_SUCCESS` on success,
+ * or an appropriate error code indicating the failure reason. Refer to \ref cardano_error_t documentation
+ * for details on possible error codes.
+ *
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * // Assume writer has been used to encode some CBOR data here
+ *
+ * size_t hex_size = cardano_cbor_writer_get_hex_size(writer);
+ * char* hex_string = (char*)malloc(hex_size);
+ * cardano_error_t result = cardano_cbor_writer_encode_hex(writer, hex_string, hex_size);
+ *
+ * if (hex_string != NULL && result == CARDANO_SUCCESS)
+ * {
+ *   printf("Encoded CBOR data as hex: %s\n", hex_string);
+ * }
+ * else
+ * {
+ *   printf("Failed to encode CBOR data as hex or allocate memory.\n");
+ * }
+ *
+ * free(hex_string); // Free the allocated string after use
+ *
+ * cardano_cbor_writer_unref(&writer); // Properly dispose of the writer after use
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_encode_hex(const cardano_cbor_writer_t* writer, char* dest, size_t dest_size);
+
+/**
+ * \brief Resets the writer, clearing all written data.
+ *
+ * This function resets the internal state of the CBOR writer, effectively removing any data that has been written to it.
+ * This is useful for reusing a writer instance without needing to create a new one, especially when working with
+ * sequences of data encoding tasks.
+ *
+ * \param[in] writer The CBOR writer instance to reset.
+ *
+ * \return A cardano_error_t indicating the outcome of the operation. CARDANO_SUCCESS is returned if the writer is
+ *         successfully reset. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if \p writer is NULL. Returns
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the new internal buffer could not be allocated; in that case the
+ *         writer keeps its previously written data and remains usable.
+ *
+ * \code{.c}
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * // Write some data to the writer here
+ *
+ * cardano_error_t reset_result = cardano_cbor_writer_reset(writer);
+ *
+ * if (reset_result == CARDANO_SUCCESS)
+ * {
+ *     printf("Writer reset successfully.\n");
+ * }
+ * else
+ * {
+ *     printf("Failed to reset writer. Error code: %d\n", reset_result);
+ * }
+ * // The writer can now be reused for new data without creating a new instance
+ *
+ * cardano_cbor_writer_unref(&writer); // Clean up when done using the writer
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cbor_writer_reset(cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Sets the last error message for a given CBOR writer object.
+ *
+ * Records an error message in the CBOR writer's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] writer A pointer to the \ref cardano_cbor_writer_t instance whose last error message is
+ *                   to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the writer's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_cbor_writer_set_last_error(cardano_cbor_writer_t* writer, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific writer.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_cbor_writer_set_last_error for the given
+ * writer. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] writer A pointer to the \ref cardano_cbor_writer_t instance whose last error
+ *                   message is to be retrieved. If the writer is NULL, the function
+ *                   returns a generic error message indicating the null writer.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified writer. If the writer is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_cbor_writer_set_last_error for the same writer, or until
+ *       the writer is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_cbor_writer_get_last_error(const cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_cbor_writer_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_cbor_writer_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_cbor_writer_deep_clone(const cardano_cbor_writer_t* source, cardano_cbor_writer_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_WRITER_H
diff --git a/vendor/include/cardano/certs/auth_committee_hot_cert.h b/vendor/include/cardano/certs/auth_committee_hot_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/auth_committee_hot_cert.h
@@ -0,0 +1,503 @@
+/**
+ * \file auth_committee_hot_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AUTH_COMMITTEE_HOT_CERT_H
+#define AUTH_COMMITTEE_HOT_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Constitutional Committee members maintain operational integrity by managing two credentials: a cold credential and a hot credential.
+ *
+ * One of the purposes of this credential management system is to provide multiple layers of security to help committee members prevent losing control
+ * over a cold credential and to give good options for recovery if necessary.
+ *
+ * This certificates registers the Hot credentials of a committee member and requires a signature from the CC member Cold key.
+ */
+typedef struct cardano_auth_committee_hot_cert_t cardano_auth_committee_hot_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates and initializes a new instance of an authorization committee hot certificate.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_auth_committee_hot_cert_t.
+ *
+ * \param[in] committee_cold_cred A \ref cardano_credential_t object representing the committee cold credential.
+ * \param[in] committee_hot_cred A \ref cardano_credential_t object representing the committee hot credential.
+ * \param[out] auth_committee_hot_cert On successful initialization, this will point to a newly created
+ *                                             \ref cardano_auth_committee_hot_cert_t object. The caller is responsible
+ *                                             for managing the lifecycle of this object. Specifically, once the authorization
+ *                                             committee hot certificate is no longer needed, the caller must release it
+ *                                             by calling \ref cardano_auth_committee_hot_cert_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the authorization committee hot certificate was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t committee_cold_cred = ...; // Assume committee_cold_cred is initialized
+ * cardano_credential_t committee_hot_cred = ...; // Assume committee_hot_cred is initialized
+ * cardano_auth_committee_hot_cert_t* auth_committee_hot_cert = NULL;
+ *
+ * // Attempt to create a new authorization committee hot certificate
+ * cardano_error_t result = cardano_auth_committee_hot_cert_new(committee_cold_cred, committee_hot_cred, &auth_committee_hot_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the auth_committee_hot_cert
+ *
+ *   // Once done, ensure to clean up and release the auth_committee_hot_cert
+ *   cardano_auth_committee_hot_cert_unref(&auth_committee_hot_cert);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auth_committee_hot_cert_new(
+  cardano_credential_t*               committee_cold_cred,
+  cardano_credential_t*               committee_hot_cred,
+  cardano_auth_committee_hot_cert_t** auth_committee_hot_cert);
+
+/**
+ * \brief Creates a \ref cardano_auth_committee_hot_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_auth_committee_hot_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a auth_committee_hot.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] auth_committee_hot A pointer to a pointer of \ref cardano_auth_committee_hot_cert_t that will be set to the address
+ *                        of the newly created auth_committee_hot object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_auth_committee_hot_cert_t object by calling
+ *       \ref cardano_auth_committee_hot_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_auth_committee_hot_cert_t* auth_committee_hot = NULL;
+ *
+ * cardano_error_t result = cardano_auth_committee_hot_cert_from_cbor(reader, &auth_committee_hot);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the auth_committee_hot
+ *
+ *   // Once done, ensure to clean up and release the auth_committee_hot
+ *   cardano_auth_committee_hot_cert_unref(&auth_committee_hot);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode auth_committee_hot: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auth_committee_hot_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_auth_committee_hot_cert_t** auth_committee_hot);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_auth_committee_hot_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] auth_committee_hot A constant pointer to the \ref cardano_auth_committee_hot_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p auth_committee_hot or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auth_committee_hot_cert_t* auth_committee_hot = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_auth_committee_hot_cert_to_cbor(auth_committee_hot, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_auth_committee_hot_cert_unref(&auth_committee_hot);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_auth_committee_hot_cert_to_cbor(
+  const cardano_auth_committee_hot_cert_t* auth_committee_hot,
+  cardano_cbor_writer_t*                   writer);
+
+/**
+ * \brief Serializes an auth-committee-hot certificate to CIP-116 JSON.
+ *
+ * Keys are written in deterministic order: "tag", "committee_cold_credential", "committee_hot_credential".
+ * The function writes the full JSON object, including surrounding braces.
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_auth_committee_hot_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ *         CARDANO_ERROR_POINTER_IS_NULL  If \p cert or \p writer is NULL.
+ *         CARDANO_ERROR_ENCODING         If required fields are missing/invalid.
+ *         Other                          Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_auth_committee_hot_cert_to_cip116_json(
+  const cardano_auth_committee_hot_cert_t* cert,
+  cardano_json_writer_t*                   writer);
+
+/**
+ * \brief Sets the cold credential for an authorization committee hot certificate.
+ *
+ * This function assigns a new cold credential to a given \ref cardano_auth_committee_hot_cert_t object.
+ *
+ * \param[in] auth_committee_hot A pointer to an initialized \ref cardano_auth_committee_hot_cert_t object to which the cold credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the new cold credential.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the cold credential was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auth_committee_hot_cert_t* auth_committee_hot = ...; // Assume auth_committee_hot is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_auth_committee_hot_cert_set_cold_cred(auth_committee_hot, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The cold credential is now set for the auth_committee_hot
+ * }
+ * else
+ * {
+ *   printf("Failed to set the cold credential.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_auth_committee_hot_cert_set_cold_cred(
+  cardano_auth_committee_hot_cert_t* auth_committee_hot,
+  cardano_credential_t*              credential);
+
+/**
+ * \brief Retrieves the cold credential from an authorization committee hot certificate.
+ *
+ * This function retrieves the cold credential from a given \ref cardano_auth_committee_hot_cert_t object.
+ *
+ * \param[in] auth_committee_hot A pointer to an initialized \ref cardano_auth_committee_hot_cert_t object.
+ * \param[out] credential On successful retrieval, this will point to the cold credential of the auth_committee_hot.
+ *                        The caller is responsible for managing the lifecycle of this object and must call the appropriate
+ *                        unref function to release it when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the cold credential was successfully retrieved, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note This function returns a new reference to the cold credential. Both the source auth_committee_hot object
+ *       and the retrieved credential must be unreferenced appropriately.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auth_committee_hot_cert_t* auth_committee_hot = ...; // Assume auth_committee_hot is already initialized
+ * cardano_credential_t* credential = NULL;
+ *
+ * cardano_error_t result = cardano_auth_committee_hot_cert_get_cold_cred(auth_committee_hot, &credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the credential
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the cold credential.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_auth_committee_hot_cert_get_cold_cred(
+  cardano_auth_committee_hot_cert_t* auth_committee_hot,
+  cardano_credential_t**             credential);
+
+/**
+ * \brief Sets the hot credential for an authorization committee hot certificate.
+ *
+ * This function assigns a new hot credential to a given \ref cardano_auth_committee_hot_cert_t object.
+ *
+ * \param[in] auth_committee_hot A pointer to an initialized \ref cardano_auth_committee_hot_cert_t object.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the hot credential.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the hot credential was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auth_committee_hot_cert_t* auth_committee_hot = ...; // Assume auth_committee_hot is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_auth_committee_hot_cert_set_hot_cred(auth_committee_hot, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The hot credential is now set for the auth_committee_hot
+ * }
+ * else
+ * {
+ *   printf("Failed to set the hot credential.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_auth_committee_hot_cert_set_hot_cred(
+  cardano_auth_committee_hot_cert_t* auth_committee_hot,
+  cardano_credential_t*              credential);
+
+/**
+ * \brief Retrieves the hot credential from an authorization committee hot certificate.
+ *
+ * This function retrieves the hot credential from a given \ref cardano_auth_committee_hot_cert_t object.
+ *
+ * \param[in] auth_committee_hot A pointer to an initialized \ref cardano_auth_committee_hot_cert_t object.
+ * \param[out] credential On successful retrieval, this will point to the hot credential of the auth_committee_hot object.
+ *                        The function returns a new reference to the credential, and the caller is responsible for managing
+ *                        its lifecycle, including calling \ref cardano_credential_unref when the credential is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the hot credential was successfully retrieved, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note This function returns a new reference to the hot credential. Both the caller and the auth_committee_hot object
+ *       must unreference the credential appropriately to avoid memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auth_committee_hot_cert_t* auth_committee_hot = ...; // Assume auth_committee_hot is already initialized
+ * cardano_credential_t* credential = NULL;
+ *
+ * cardano_error_t result = cardano_auth_committee_hot_cert_get_hot_cred(auth_committee_hot, &credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the hot credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the hot credential.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_auth_committee_hot_cert_get_hot_cred(
+  cardano_auth_committee_hot_cert_t* auth_committee_hot,
+  cardano_credential_t**             credential);
+
+/**
+ * \brief Decrements the reference count of a cardano_auth_committee_hot_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_auth_committee_hot_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the auth_committee_hot is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] auth_committee_hot A pointer to the pointer of the auth_committee_hot object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auth_committee_hot_cert_t* auth_committee_hot = cardano_auth_committee_hot_cert_new(major, minor);
+ *
+ * // Perform operations with the auth_committee_hot...
+ *
+ * cardano_auth_committee_hot_cert_unref(&auth_committee_hot);
+ * // At this point, auth_committee_hot is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_auth_committee_hot_cert_unref, the pointer to the \ref cardano_auth_committee_hot_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_auth_committee_hot_cert_unref(cardano_auth_committee_hot_cert_t** auth_committee_hot);
+
+/**
+ * \brief Increases the reference count of the cardano_auth_committee_hot_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_auth_committee_hot_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_auth_committee_hot_cert_unref.
+ *
+ * \param auth_committee_hot A pointer to the cardano_auth_committee_hot_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming auth_committee_hot is a previously created auth_committee_hot object
+ *
+ * cardano_auth_committee_hot_cert_ref(auth_committee_hot);
+ *
+ * // Now auth_committee_hot can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_auth_committee_hot_cert_ref there is a corresponding
+ * call to \ref cardano_auth_committee_hot_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_auth_committee_hot_cert_ref(cardano_auth_committee_hot_cert_t* auth_committee_hot);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_auth_committee_hot_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_auth_committee_hot_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_auth_committee_hot_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param auth_committee_hot A pointer to the cardano_auth_committee_hot_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_auth_committee_hot_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_auth_committee_hot_cert_ref call is matched with a
+ * \ref cardano_auth_committee_hot_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming auth_committee_hot is a previously created auth_committee_hot object
+ *
+ * size_t ref_count = cardano_auth_committee_hot_cert_refcount(auth_committee_hot);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_auth_committee_hot_cert_refcount(const cardano_auth_committee_hot_cert_t* auth_committee_hot);
+
+/**
+ * \brief Sets the last error message for a given cardano_auth_committee_hot_cert_t object.
+ *
+ * Records an error message in the auth_committee_hot's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] auth_committee_hot A pointer to the \ref cardano_auth_committee_hot_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the auth_committee_hot's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_auth_committee_hot_cert_set_last_error(
+  cardano_auth_committee_hot_cert_t* auth_committee_hot,
+  const char*                        message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific auth_committee_hot.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_auth_committee_hot_cert_set_last_error for the given
+ * auth_committee_hot. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] auth_committee_hot A pointer to the \ref cardano_auth_committee_hot_cert_t instance whose last error
+ *                   message is to be retrieved. If the auth_committee_hot is NULL, the function
+ *                   returns a generic error message indicating the null auth_committee_hot.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified auth_committee_hot. If the auth_committee_hot is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_auth_committee_hot_cert_set_last_error for the same auth_committee_hot, or until
+ *       the auth_committee_hot is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_auth_committee_hot_cert_get_last_error(
+  const cardano_auth_committee_hot_cert_t* auth_committee_hot);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_auth_committee_hot_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_auth_committee_hot_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_auth_committee_hot_cert_deep_clone(const cardano_auth_committee_hot_cert_t* source, cardano_auth_committee_hot_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // AUTH_COMMITTEE_HOT_CERT_H
diff --git a/vendor/include/cardano/certs/cert_type.h b/vendor/include/cardano/certs/cert_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/cert_type.h
@@ -0,0 +1,182 @@
+/**
+ * \file cert_type.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CERT_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CERT_TYPE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS *************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Certificates are used to register, update, or deregister stake pools, and delegate stake.
+ */
+typedef enum
+{
+  /**
+   * \brief This certificate is used when an individual wants to register as a stakeholder.
+   * It allows the holder to participate in the staking process by delegating their
+   * stake or creating a stake pool.
+   */
+  CARDANO_CERT_TYPE_STAKE_REGISTRATION = 0,
+
+  /**
+   * \brief This certificate is used when a stakeholder no longer wants to participate in
+   * staking. It revokes the stake registration and the associated stake is no
+   * longer counted when calculating stake pool rewards.
+   */
+  CARDANO_CERT_TYPE_STAKE_DEREGISTRATION = 1,
+
+  /**
+   * \brief This certificate is used when a stakeholder wants to delegate their stake to a
+   * specific stake pool. It includes the stake pool id to which the stake is delegated.
+   */
+  CARDANO_CERT_TYPE_STAKE_DELEGATION = 2,
+
+  /**
+   * \brief This certificate is used to register a new stake pool. It includes various details
+   * about the pool such as the pledge, costs, margin, reward account, and the pool's owners and relays.
+   */
+  CARDANO_CERT_TYPE_POOL_REGISTRATION = 3,
+
+  /**
+   * \brief This certificate is used to retire a stake pool. It includes an epoch number indicating when the pool will be retired.
+   */
+  CARDANO_CERT_TYPE_POOL_RETIREMENT = 4,
+
+  /**
+   * \brief This certificate is used to delegate from a Genesis key to a set of keys. This was primarily used in the early
+   * phases of the Cardano network's existence during the transition from the Byron to the Shelley era.
+   */
+  CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION = 5,
+
+  /**
+   * \brief Certificate used to facilitate an instantaneous transfer of rewards within the system.
+   */
+  CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS = 6,
+
+  /**
+   * \brief This certificate is used when an individual wants to register as a stakeholder.
+   * It allows the holder to participate in the staking process by delegating their
+   * stake or creating a stake pool.
+   *
+   * Deposit must match the expected deposit amount specified by `ppKeyDepositL` in
+   * the protocol parameters.
+   *
+   * Remark: Replaces the deprecated `StakeRegistration` in after Conway era.
+   */
+  CARDANO_CERT_TYPE_REGISTRATION = 7,
+
+  /**
+   * \brief This certificate is used when a stakeholder no longer wants to participate in
+   * staking. It revokes the stake registration and the associated stake is no
+   * longer counted when calculating stake pool rewards.
+   *
+   * Deposit must match the expected deposit amount specified by `ppKeyDepositL` in
+   * the protocol parameters.
+   *
+   * Remark: Replaces the deprecated `StakeDeregistration` in after Conway era.
+   */
+  CARDANO_CERT_TYPE_UNREGISTRATION = 8,
+
+  /**
+   * \brief This certificate is used when an individual wants to delegate their voting rights to any other DRep.
+   */
+  CARDANO_CERT_TYPE_VOTE_DELEGATION = 9,
+
+  /**
+   * \brief This certificate is used when an individual wants to delegate their voting
+   * rights to any other DRep and simultaneously wants to delegate their stake to a
+   * specific stake pool.
+   */
+  CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION = 10,
+
+  /**
+   * \brief This certificate Register the stake key and delegate with a single certificate to a stake pool.
+   */
+  CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION = 11,
+
+  /**
+   * \brief This certificate Register the stake key and delegate with a single certificate to a DRep.
+   */
+  CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION = 12,
+
+  /**
+   * \brief This certificate is used when an individual wants to register its stake key,
+   * delegate their voting rights to any other DRep and simultaneously wants to delegate
+   * their stake to a specific stake pool.
+   */
+  CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION = 13,
+
+  /**
+   * \brief This certificate registers the Hot and Cold credentials of a committee member.
+   */
+  CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT = 14,
+
+  /**
+   * \brief This certificate is used then a committee member wants to resign early (will be marked on-chain as an expired member).
+   */
+  CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD = 15,
+
+  /**
+   * \brief In Voltaire, existing stake credentials will be able to delegate their stake to DReps for voting
+   * purposes, in addition to the current delegation to stake pools for block production.
+   * DRep delegation will mimic the existing stake delegation mechanisms (via on-chain certificates).
+   *
+   * This certificate register a stake key as a DRep.
+   */
+  CARDANO_CERT_TYPE_DREP_REGISTRATION = 16,
+
+  /**
+   * \brief This certificate unregister an individual as a DRep.
+   *
+   * Note that a DRep is retired immediately upon the chain accepting a retirement certificate, and
+   * the deposit is returned as part of the transaction that submits the retirement certificate
+   * (the same way that stake credential registration deposits are returned).
+   */
+  CARDANO_CERT_TYPE_DREP_UNREGISTRATION = 17,
+
+  /**
+   * \brief Updates the DRep anchored metadata.
+   */
+  CARDANO_CERT_TYPE_UPDATE_DREP = 18
+} cardano_cert_type_t;
+
+/**
+ * \brief Converts certificate types to their human readable form.
+ *
+ * \param[in] type The certificate type to get the string representation for.
+ * \return Human readable form of the given certificate type.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_cert_type_to_string(cardano_cert_type_t type);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CERT_TYPE_H
diff --git a/vendor/include/cardano/certs/certificate.h b/vendor/include/cardano/certs/certificate.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/certificate.h
@@ -0,0 +1,1959 @@
+/**
+ * \file certificate.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CERTIFICATE_H
+#define CERTIFICATE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/certs/cert_type.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief This certificate registers the Hot and Cold credentials of a committee member.
+ */
+typedef struct cardano_auth_committee_hot_cert_t cardano_auth_committee_hot_cert_t;
+
+/**
+ * \brief This certificate is used to delegate from a Genesis key to a set of keys. This was primarily used in the early
+ * phases of the Cardano network's existence during the transition from the Byron to the Shelley era.
+ */
+typedef struct cardano_genesis_key_delegation_cert_t cardano_genesis_key_delegation_cert_t;
+
+/**
+ * \brief Certificate used to facilitate an instantaneous transfer of rewards within the system.
+ */
+typedef struct cardano_mir_cert_t cardano_mir_cert_t;
+
+/**
+ * \brief This certificate is used to register a new stake pool. It includes various details
+ * about the pool such as the pledge, costs, margin, reward account, and the pool's owners and relays.
+ */
+typedef struct cardano_pool_registration_cert_t cardano_pool_registration_cert_t;
+
+/**
+ * \brief This certificate is used to retire a stake pool. It includes an epoch number indicating when the pool will be retired.
+ */
+typedef struct cardano_pool_retirement_cert_t cardano_pool_retirement_cert_t;
+
+/**
+ * \brief In Voltaire, existing stake credentials will be able to delegate their stake to DReps for voting
+ * purposes, in addition to the current delegation to stake pools for block production.
+ * DRep delegation will mimic the existing stake delegation mechanisms (via on-chain certificates).
+ *
+ * This certificate register a stake key as a DRep.
+ */
+typedef struct cardano_register_drep_cert_t cardano_register_drep_cert_t;
+
+/**
+ * \brief This certificate is used when an individual wants to register as a stakeholder.
+ * It allows the holder to participate in the staking process by delegating their
+ * stake or creating a stake pool.
+ */
+typedef struct cardano_registration_cert_t cardano_registration_cert_t;
+
+/**
+ * \brief This certificate is used then a committee member wants to resign early (will be marked on-chain as an expired member).
+ */
+typedef struct cardano_resign_committee_cold_cert_t cardano_resign_committee_cold_cert_t;
+
+/**
+ * \brief This certificate is used when a stakeholder wants to delegate their stake to a
+ * specific stake pool. It includes the stake pool id to which the stake is delegated.
+ */
+typedef struct cardano_stake_delegation_cert_t cardano_stake_delegation_cert_t;
+
+/**
+ * \brief This certificate is used when a stakeholder no longer wants to participate in
+ * staking. It revokes the stake registration and the associated stake is no
+ * longer counted when calculating stake pool rewards.
+ */
+typedef struct cardano_stake_deregistration_cert_t cardano_stake_deregistration_cert_t;
+
+/**
+ * \brief This certificate is used when an individual wants to register as a stakeholder.
+ * It allows the holder to participate in the stake process by delegating their
+ * stake or creating a stake pool.
+ */
+typedef struct cardano_stake_registration_cert_t cardano_stake_registration_cert_t;
+
+/**
+ * \brief This certificate Register the stake key and delegate with a single certificate to a stake pool.
+ */
+typedef struct cardano_stake_registration_delegation_cert_t cardano_stake_registration_delegation_cert_t;
+
+/**
+ * \brief This certificate is used when an individual wants to delegate their voting
+ * rights to any other DRep and simultaneously wants to delegate their stake to a
+ * specific stake pool.
+ */
+typedef struct cardano_stake_vote_delegation_cert_t cardano_stake_vote_delegation_cert_t;
+
+/**
+ * \brief This certificate is used when an individual wants to register its stake key,
+ * delegate their voting rights to any other DRep and simultaneously wants to delegate
+ * their stake to a specific stake pool.
+ */
+typedef struct cardano_stake_vote_registration_delegation_cert_t cardano_stake_vote_registration_delegation_cert_t;
+
+/**
+ * \brief This certificate unregister an individual as a DRep.
+ *
+ * Note that a DRep is retired immediately upon the chain accepting a retirement certificate, and
+ * the deposit is returned as part of the transaction that submits the retirement certificate
+ * (the same way that stake credential registration deposits are returned).
+ */
+typedef struct cardano_unregister_drep_cert_t cardano_unregister_drep_cert_t;
+
+/**
+ * \brief This certificate is used when a stakeholder no longer wants to participate in
+ * staking. It revokes the stake Unregistration and the associated stake is no
+ * longer counted when calculating stake pool rewards.
+ */
+typedef struct cardano_unregistration_cert_t cardano_unregistration_cert_t;
+
+/**
+ * \brief Updates the DRep anchored metadata.
+ */
+typedef struct cardano_update_drep_cert_t cardano_update_drep_cert_t;
+
+/**
+ * \brief This certificate is used when an individual wants to delegate their voting rights to any other DRep.
+ */
+typedef struct cardano_vote_delegation_cert_t cardano_vote_delegation_cert_t;
+
+/**
+ * \brief This certificate Register the stake key and delegate with a single certificate to a DRep.
+ */
+typedef struct cardano_vote_registration_delegation_cert_t cardano_vote_registration_delegation_cert_t;
+
+/**
+ * \brief Creates a new Cardano certificate based on an authorization committee hot certificate.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_auth_committee_hot_cert_t object.
+ *
+ * \param[in] auth_committee_hot_cert A pointer to an initialized \ref cardano_auth_committee_hot_cert_t object that defines
+ *                                    the committee's hot certificate details.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_auth_committee_hot_cert_t* auth_cert = ...;  // Assume auth_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_auth_committee_hot(auth_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for authorization purposes in committee operations
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create authorization certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_auth_committee_hot_cert_unref(&auth_cert); // Cleanup the auth_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_auth_committee_hot(
+  cardano_auth_committee_hot_cert_t* auth_committee_hot_cert,
+  cardano_certificate_t**            certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for genesis key delegation.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object for the purpose of genesis key delegation,
+ * using the provided \ref cardano_genesis_key_delegation_cert_t object which contains the delegation details.
+ *
+ * \param[in] genesis_key_delegation A pointer to an initialized \ref cardano_genesis_key_delegation_cert_t object that
+ *                                   specifies the genesis key delegation parameters.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_genesis_key_delegation_cert_t* genesis_cert = ...;  // Assume genesis_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_genesis_key_delegation(genesis_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for genesis key delegation operations
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create genesis key delegation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_genesis_key_delegation_cert_unref(&genesis_cert); // Cleanup the genesis_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_genesis_key_delegation(
+  cardano_genesis_key_delegation_cert_t* genesis_key_delegation,
+  cardano_certificate_t**                certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for Move Instantaneous Rewards (MIR).
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object for the purpose of managing
+ * Move Instantaneous Rewards, using the provided \ref cardano_mir_cert_t object which contains the MIR details.
+ *
+ * \param[in] mir A pointer to an initialized \ref cardano_mir_cert_t object that specifies the MIR parameters.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_cert_t* mir_cert = ...;  // Assume mir_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_mir(mir_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for MIR operations
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create MIR certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_mir_cert_unref(&mir_cert); // Cleanup the mir_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_mir(
+  cardano_mir_cert_t*     mir,
+  cardano_certificate_t** certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for pool registration.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object specifically for registering
+ * a staking pool, using the provided \ref cardano_pool_registration_cert_t object which contains all the necessary
+ * parameters for pool registration.
+ *
+ * \param[in] pool_registration A pointer to an initialized \ref cardano_pool_registration_cert_t object that defines
+ *                              the staking pool's registration details.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_registration_cert_t* registration_cert = ...;  // Assume registration_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_pool_registration(registration_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for pool registration purposes
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create pool registration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_pool_registration_cert_unref(&registration_cert); // Cleanup the registration_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_pool_registration(
+  cardano_pool_registration_cert_t* pool_registration,
+  cardano_certificate_t**           certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for pool retirement.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object specifically for the retirement
+ * of a staking pool, using the provided \ref cardano_pool_retirement_cert_t object which contains all the necessary
+ * parameters for pool retirement.
+ *
+ * \param[in] pool_retirement A pointer to an initialized \ref cardano_pool_retirement_cert_t object that defines
+ *                            the staking pool's retirement details.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_retirement_cert_t* retirement_cert = ...;  // Assume retirement_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_pool_retirement(retirement_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for pool retirement purposes
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create pool retirement certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_pool_retirement_cert_unref(&retirement_cert); // Cleanup the retirement_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_pool_retirement(
+  cardano_pool_retirement_cert_t* pool_retirement,
+  cardano_certificate_t**         certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for registering a decentralized representation (drep).
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object for registering a drep,
+ * using the provided \ref cardano_register_drep_cert_t object which contains all necessary details
+ * for the registration.
+ *
+ * \param[in] register_drep A pointer to an initialized \ref cardano_register_drep_cert_t object that defines
+ *                          the details of the drep to be registered.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_register_drep_cert_t* drep_cert = ...;  // Assume drep_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_register_drep(drep_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for registering the drep
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create register drep certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_register_drep_cert_unref(&drep_cert); // Cleanup the drep_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_register_drep(
+  cardano_register_drep_cert_t* register_drep,
+  cardano_certificate_t**       certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for registration.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_registration_cert_t object, which contains the registration details.
+ *
+ * \param[in] registration A pointer to an initialized \ref cardano_registration_cert_t object that specifies
+ *                         the registration details.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_registration_cert_t* registration_cert = ...;  // Assume registration_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_registration(registration_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for the intended registration purpose
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create registration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_registration_cert_unref(&registration_cert); // Cleanup the registration_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_registration(
+  cardano_registration_cert_t* registration,
+  cardano_certificate_t**      certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for resigning a committee's cold key.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_resign_committee_cold_cert_t object, which contains the details for resigning a committee's cold key.
+ *
+ * \param[in] resign_committee_cold A pointer to an initialized \ref cardano_resign_committee_cold_cert_t object that specifies
+ *                                  the details for the resignation of the committee's cold key.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_resign_committee_cold_cert_t* resign_cert = ...;  // Assume resign_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_resign_committee_cold(resign_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for committee cold key resignation
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create resignation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_resign_committee_cold_cert_unref(&resign_cert); // Cleanup the resign_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_resign_committee_cold(
+  cardano_resign_committee_cold_cert_t* resign_committee_cold,
+  cardano_certificate_t**               certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for stake delegation.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_stake_delegation_cert_t object, which contains the details necessary for delegating stake in the Cardano network.
+ *
+ * \param[in] stake_delegation A pointer to an initialized \ref cardano_stake_delegation_cert_t object that specifies
+ *                             the delegation details, including the delegator's stake key and the target stake pool.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_delegation_cert_t* delegation_cert = ...;  // Assume delegation_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_stake_delegation(delegation_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for stake delegation purposes
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake delegation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_stake_delegation_cert_unref(&delegation_cert); // Cleanup the delegation_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_stake_delegation(
+  cardano_stake_delegation_cert_t* stake_delegation,
+  cardano_certificate_t**          certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for stake deregistration.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_stake_deregistration_cert_t object.
+ *
+ * \param[in] stake_deregistration A pointer to an initialized \ref cardano_stake_deregistration_cert_t object that specifies
+ *                                 the stake key to be deregistered.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_deregistration_cert_t* deregistration_cert = ...;  // Assume deregistration_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_stake_deregistration(deregistration_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for stake deregistration purposes
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake deregistration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_stake_deregistration_cert_unref(&deregistration_cert); // Cleanup the deregistration_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_stake_deregistration(
+  cardano_stake_deregistration_cert_t* stake_deregistration,
+  cardano_certificate_t**              certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for stake registration.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_stake_registration_cert_t object.
+ *
+ * \param[in] stake_registration A pointer to an initialized \ref cardano_stake_registration_cert_t object that specifies
+ *                               the stake key to be registered.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_registration_cert_t* registration_cert = ...;  // Assume registration_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_stake_registration(registration_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for stake registration purposes
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake registration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_stake_registration_cert_unref(&registration_cert); // Cleanup the registration_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_stake_registration(
+  cardano_stake_registration_cert_t* stake_registration,
+  cardano_certificate_t**            certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for stake registration with delegation.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_stake_registration_delegation_cert_t object.
+ *
+ * \param[in] stake_registration_delegation A pointer to an initialized \ref cardano_stake_registration_delegation_cert_t object
+ *                                          that specifies the stake key to be registered and the pool to which it will be delegated.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_registration_delegation_cert_t* reg_del_cert = ...;  // Assume reg_del_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_stake_registration_delegation(reg_del_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for stake registration and delegation purposes
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake registration and delegation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_stake_registration_delegation_cert_unref(&reg_del_cert); // Cleanup the reg_del_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_stake_registration_delegation(
+  cardano_stake_registration_delegation_cert_t* stake_registration_delegation,
+  cardano_certificate_t**                       certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for stake vote delegation.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_stake_vote_delegation_cert_t object.
+ *
+ * \param[in] stake_vote_delegation A pointer to an initialized \ref cardano_stake_vote_delegation_cert_t object
+ *                                  that specifies the stake key and the party to whom the voting rights are delegated.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_delegation_cert_t* vote_del_cert = ...;  // Assume vote_del_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_stake_vote_delegation(vote_del_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for delegating voting rights
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake vote delegation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_stake_vote_delegation_cert_unref(&vote_del_cert); // Cleanup the vote_del_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_stake_vote_delegation(
+  cardano_stake_vote_delegation_cert_t* stake_vote_delegation,
+  cardano_certificate_t**               certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for stake vote registration delegation.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * \param[in] stake_vote_registration_delegation A pointer to an initialized \ref cardano_stake_vote_registration_delegation_cert_t object
+ *                                                that specifies the stake key and the details necessary for registering and delegating
+ *                                                the voting rights.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_registration_delegation_cert_t* reg_del_cert = ...;  // Assume reg_del_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_stake_vote_registration_delegation(reg_del_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for registering and delegating voting rights
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake vote registration delegation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_stake_vote_registration_delegation_cert_unref(&reg_del_cert); // Cleanup the reg_del_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_stake_vote_registration_delegation(
+  cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration_delegation,
+  cardano_certificate_t**                            certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for unregistering a DRep.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_unregister_drep_cert_t object.
+ *
+ * \param[in] unregister_drep A pointer to an initialized \ref cardano_unregister_drep_cert_t object
+ *                             that specifies the details necessary for unregistering the DRep.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unregister_drep_cert_t* unregister_drep_cert = ...;  // Assume unregister_drep_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_unregister_drep(unregister_drep_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for unregistering the DRep
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create unregister DRep certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_unregister_drep_cert_unref(&unregister_drep_cert); // Cleanup the unregister_drep_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_unregister_drep(
+  cardano_unregister_drep_cert_t* unregister_drep,
+  cardano_certificate_t**         certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for unregistration.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_unregistration_cert_t object.
+ *
+ * \param[in] unregistration A pointer to an initialized \ref cardano_unregistration_cert_t object
+ *                           that specifies the details necessary for the unregistration process.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unregistration_cert_t* unregistration_cert = ...;  // Assume unregistration_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_unregistration(unregistration_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for unregistration purposes
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create unregistration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_unregistration_cert_unref(&unregistration_cert); // Cleanup the unregistration_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_unregistration(
+  cardano_unregistration_cert_t* unregistration,
+  cardano_certificate_t**        certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for updating a delegation representation (Drep).
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_update_drep_cert_t object.
+ *
+ * \param[in] update_drep A pointer to an initialized \ref cardano_update_drep_cert_t object
+ *                        that specifies the details necessary for the update process.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_drep_cert_t* update_drep_cert = ...;  // Assume update_drep_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_update_drep(update_drep_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for updating delegation representation
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create update Drep certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_update_drep_cert_unref(&update_drep_cert); // Cleanup the update_drep_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_update_drep(
+  cardano_update_drep_cert_t* update_drep,
+  cardano_certificate_t**     certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for vote delegation.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_vote_delegation_cert_t object.
+ *
+ * \param[in] vote_delegation A pointer to an initialized \ref cardano_vote_delegation_cert_t object
+ *                            that specifies the details necessary for the delegation of voting rights.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_delegation_cert_t* vote_delegation_cert = ...;  // Assume vote_delegation_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_vote_delegation(vote_delegation_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for voting delegation purposes
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create vote delegation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_vote_delegation_cert_unref(&vote_delegation_cert); // Cleanup the vote_delegation_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_vote_delegation(
+  cardano_vote_delegation_cert_t* vote_delegation,
+  cardano_certificate_t**         certificate);
+
+/**
+ * \brief Creates a new Cardano certificate for vote registration and delegation.
+ *
+ * This function allocates and initializes a \ref cardano_certificate_t object based on the provided
+ * \ref cardano_vote_registration_delegation_cert_t object.
+ *
+ * \param[in] vote_registration_delegation A pointer to an initialized \ref cardano_vote_registration_delegation_cert_t object
+ *                                         that specifies the details necessary for the registration and delegation of voting rights.
+ * \param[out] certificate On successful execution, this will point to a newly created \ref cardano_certificate_t object.
+ *                         The caller is responsible for releasing this resource using \ref cardano_certificate_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_registration_delegation_cert_t* vote_reg_del_cert = ...;  // Assume vote_reg_del_cert is already initialized
+ * cardano_certificate_t* certificate = NULL;
+ * cardano_error_t result = cardano_certificate_new_vote_registration_delegation(vote_reg_del_cert, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used for both registration and delegation of voting rights
+ *   // Remember to free the certificate when done
+ *   cardano_certificate_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create vote registration and delegation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_vote_registration_delegation_cert_unref(&vote_reg_del_cert); // Cleanup the vote_reg_del_cert
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_new_vote_registration_delegation(
+  cardano_vote_registration_delegation_cert_t* vote_registration_delegation,
+  cardano_certificate_t**                      certificate);
+
+/**
+ * \brief Creates a \ref cardano_certificate_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_certificate_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a auth_committee_hot.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] auth_committee_hot A pointer to a pointer of \ref cardano_certificate_t that will be set to the address
+ *                        of the newly created auth_committee_hot object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_certificate_t object by calling
+ *       \ref cardano_certificate_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_certificate_t* auth_committee_hot = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_from_cbor(reader, &auth_committee_hot);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the auth_committee_hot
+ *
+ *   // Once done, ensure to clean up and release the auth_committee_hot
+ *   cardano_certificate_unref(&auth_committee_hot);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode auth_committee_hot: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_from_cbor(cardano_cbor_reader_t* reader, cardano_certificate_t** auth_committee_hot);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_certificate_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] auth_committee_hot A constant pointer to the \ref cardano_certificate_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p auth_committee_hot or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* auth_committee_hot = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_certificate_to_cbor(auth_committee_hot, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_certificate_unref(&auth_committee_hot);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_certificate_to_cbor(
+  const cardano_certificate_t* auth_committee_hot,
+  cardano_cbor_writer_t*       writer);
+
+/**
+ * \brief Serializes a certificate to CIP-116 JSON.
+ *
+ * This function acts as a dispatcher, identifying the specific type of the certificate
+ * and calling the appropriate serialization function.
+ *
+ * \param[in]  certificate Pointer to a valid \ref cardano_certificate_t.
+ * \param[in]  writer      Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p certificate or \p writer is NULL.
+ * CARDANO_ERROR_INVALID_CERTIFICATE_TYPE If the certificate type is unknown or unsupported.
+ * Other                                     Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_cip116_json(
+  const cardano_certificate_t* certificate,
+  cardano_json_writer_t*       writer);
+
+/**
+ * \brief Retrieves the type of a Cardano certificate.
+ *
+ * This function determines the type of a given \ref cardano_certificate_t object, which indicates the specific kind
+ * of operations or permissions the certificate represents within the Cardano blockchain ecosystem.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_certificate_t object whose type is to be determined.
+ * \param[out] type A pointer to a \ref cardano_cert_type_t variable where the type of the certificate will be stored upon successful execution.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the type was successfully retrieved,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if either input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_cert_type_t type;
+ *
+ * cardano_error_t result = cardano_cert_get_type(certificate, &type);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Certificate type: %d\n", type);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve certificate type.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_cert_get_type(const cardano_certificate_t* certificate, cardano_cert_type_t* type);
+
+/**
+ * \brief Converts a certificate to an authorization committee hot certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_auth_committee_hot_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] auth_committee_hot_cert On successful conversion, this will point to the \ref cardano_auth_committee_hot_cert_t object derived from the certificate.
+ *                                     If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_auth_committee_hot_cert_t* auth_committee_hot_cert = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_auth_committee_hot(certificate, &auth_committee_hot_cert);
+ * if (result == CARDANO_SUCCESS && auth_committee_hot_cert != NULL)
+ * {
+ *   // Successfully converted certificate to auth committee hot certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, auth_committee_hot_cert will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_auth_committee_hot(
+  cardano_certificate_t*              certificate,
+  cardano_auth_committee_hot_cert_t** auth_committee_hot_cert);
+
+/**
+ * \brief Converts a certificate to a genesis key delegation certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_genesis_key_delegation_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] genesis_key_delegation On successful conversion, this will point to the \ref cardano_genesis_key_delegation_cert_t object derived from the certificate.
+ *                                    If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_genesis_key_delegation_cert_t* genesis_key_delegation = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_genesis_key_delegation(certificate, &genesis_key_delegation);
+ * if (result == CARDANO_SUCCESS && genesis_key_delegation != NULL)
+ * {
+ *   // Successfully converted certificate to genesis key delegation certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, genesis_key_delegation will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_genesis_key_delegation(
+  cardano_certificate_t*                  certificate,
+  cardano_genesis_key_delegation_cert_t** genesis_key_delegation);
+
+/**
+ * \brief Converts a certificate to an MIR certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_mir_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] mir On successful conversion, this will point to the \ref cardano_mir_cert_t object derived from the certificate.
+ *                 If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_mir_cert_t* mir = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_mir(certificate, &mir);
+ * if (result == CARDANO_SUCCESS && mir != NULL)
+ * {
+ *   // Successfully converted certificate to MIR certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, mir will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_mir(
+  cardano_certificate_t* certificate,
+  cardano_mir_cert_t**   mir);
+
+/**
+ * \brief Converts a certificate to a pool registration certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_pool_registration_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] pool_registration On successful conversion, this will point to the \ref cardano_pool_registration_cert_t object derived from the certificate.
+ *                               If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_pool_registration_cert_t* pool_registration = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_pool_registration(certificate, &pool_registration);
+ * if (result == CARDANO_SUCCESS && pool_registration != NULL)
+ * {
+ *   // Successfully converted certificate to pool registration certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, pool_registration will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_pool_registration(
+  cardano_certificate_t*             certificate,
+  cardano_pool_registration_cert_t** pool_registration);
+
+/**
+ * \brief Converts a certificate to a pool retirement certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_pool_retirement_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] pool_retirement On successful conversion, this will point to the \ref cardano_pool_retirement_cert_t object derived from the certificate.
+ *                             If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_pool_retirement_cert_t* pool_retirement = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_pool_retirement(certificate, &pool_retirement);
+ * if (result == CARDANO_SUCCESS && pool_retirement != NULL)
+ * {
+ *   // Successfully converted certificate to pool retirement certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, pool_retirement will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_pool_retirement(
+  cardano_certificate_t*           certificate,
+  cardano_pool_retirement_cert_t** pool_retirement);
+
+/**
+ * \brief Converts a certificate to a register drep certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_register_drep_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] register_drep On successful conversion, this will point to the \ref cardano_register_drep_cert_t object derived from the certificate.
+ *                           If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_register_drep_cert_t* register_drep = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_register_drep(certificate, &register_drep);
+ * if (result == CARDANO_SUCCESS && register_drep != NULL)
+ * {
+ *   // Successfully converted certificate to register drep certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, register_drep will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_register_drep(
+  cardano_certificate_t*         certificate,
+  cardano_register_drep_cert_t** register_drep);
+
+/**
+ * \brief Converts a certificate to a registration certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_registration_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] registration On successful conversion, this will point to the \ref cardano_registration_cert_t object derived from the certificate.
+ *                          If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_registration_cert_t* registration = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_registration(certificate, &registration);
+ * if (result == CARDANO_SUCCESS && registration != NULL)
+ * {
+ *   // Successfully converted certificate to registration certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, registration will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_registration(
+  cardano_certificate_t*        certificate,
+  cardano_registration_cert_t** registration);
+
+/**
+ * \brief Converts a certificate to a resign committee cold certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_resign_committee_cold_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] resign_committee_cold On successful conversion, this will point to the \ref cardano_resign_committee_cold_cert_t object derived from the certificate.
+ *                                   If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_resign_committee_cold_cert_t* resign_committee_cold = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_resign_committee_cold(certificate, &resign_committee_cold);
+ * if (result == CARDANO_SUCCESS && resign_committee_cold != NULL)
+ * {
+ *   // Successfully converted certificate to resign committee cold certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, resign_committee_cold will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_resign_committee_cold(
+  cardano_certificate_t*                 certificate,
+  cardano_resign_committee_cold_cert_t** resign_committee_cold);
+
+/**
+ * \brief Converts a certificate to a stake delegation certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_stake_delegation_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] stake_delegation On successful conversion, this will point to the \ref cardano_stake_delegation_cert_t object derived from the certificate.
+ *                              If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_stake_delegation_cert_t* stake_delegation = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_stake_delegation(certificate, &stake_delegation);
+ * if (result == CARDANO_SUCCESS && stake_delegation != NULL)
+ * {
+ *   // Successfully converted certificate to stake delegation certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, stake_delegation will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_stake_delegation(
+  cardano_certificate_t*            certificate,
+  cardano_stake_delegation_cert_t** stake_delegation);
+
+/**
+ * \brief Converts a certificate to a stake deregistration certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_stake_deregistration_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] stake_deregistration On successful conversion, this will point to the \ref cardano_stake_deregistration_cert_t object derived from the certificate.
+ *                                  If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_stake_deregistration_cert_t* stake_deregistration = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_stake_deregistration(certificate, &stake_deregistration);
+ * if (result == CARDANO_SUCCESS && stake_deregistration != NULL)
+ * {
+ *   // Successfully converted certificate to stake deregistration certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, stake_deregistration will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_stake_deregistration(
+  cardano_certificate_t*                certificate,
+  cardano_stake_deregistration_cert_t** stake_deregistration);
+
+/**
+ * \brief Converts a certificate to a stake registration certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_stake_registration_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] stake_registration On successful conversion, this will point to the \ref cardano_stake_registration_cert_t object derived from the certificate.
+ *                                If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_stake_registration_cert_t* stake_registration = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_stake_registration(certificate, &stake_registration);
+ * if (result == CARDANO_SUCCESS && stake_registration != NULL)
+ * {
+ *   // Successfully converted certificate to stake registration certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, stake_registration will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_stake_registration(
+  cardano_certificate_t*              certificate,
+  cardano_stake_registration_cert_t** stake_registration);
+
+/**
+ * \brief Converts a certificate to a stake registration delegation certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_stake_registration_delegation_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] stake_registration_delegation On successful conversion, this will point to the \ref cardano_stake_registration_delegation_cert_t object derived from the certificate.
+ *                                           If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_stake_registration_delegation_cert_t* stake_registration_delegation = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_stake_registration_delegation(certificate, &stake_registration_delegation);
+ * if (result == CARDANO_SUCCESS && stake_registration_delegation != NULL)
+ * {
+ *   // Successfully converted certificate to stake registration delegation certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, stake_registration_delegation will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_stake_registration_delegation(
+  cardano_certificate_t*                         certificate,
+  cardano_stake_registration_delegation_cert_t** stake_registration_delegation);
+
+/**
+ * \brief Converts a certificate to a stake vote delegation certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_stake_vote_delegation_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] stake_vote_delegation On successful conversion, this will point to the \ref cardano_stake_vote_delegation_cert_t object derived from the certificate.
+ *                                   If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_stake_vote_delegation_cert_t* stake_vote_delegation = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_stake_vote_delegation(certificate, &stake_vote_delegation);
+ * if (result == CARDANO_SUCCESS && stake_vote_delegation != NULL)
+ * {
+ *   // Successfully converted certificate to stake vote delegation certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, stake_vote_delegation will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_stake_vote_delegation(
+  cardano_certificate_t*                 certificate,
+  cardano_stake_vote_delegation_cert_t** stake_vote_delegation);
+
+/**
+ * \brief Converts a certificate to a stake vote registration delegation certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] stake_vote_registration_delegation On successful conversion, this will point to the \ref cardano_stake_vote_registration_delegation_cert_t object derived from the certificate.
+ *                                                 If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration_delegation = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_stake_vote_registration_delegation(certificate, &stake_vote_registration_delegation);
+ * if (result == CARDANO_SUCCESS && stake_vote_registration_delegation != NULL)
+ * {
+ *   // Successfully converted certificate to stake vote registration delegation certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, stake_vote_registration_delegation will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_stake_vote_registration_delegation(
+  cardano_certificate_t*                              certificate,
+  cardano_stake_vote_registration_delegation_cert_t** stake_vote_registration_delegation);
+
+/**
+ * \brief Converts a certificate to an unregister DREP certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_unregister_drep_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] unregister_drep On successful conversion, this will point to the \ref cardano_unregister_drep_cert_t object derived from the certificate.
+ *                             If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_unregister_drep_cert_t* unregister_drep = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_unregister_drep(certificate, &unregister_drep);
+ * if (result == CARDANO_SUCCESS && unregister_drep != NULL)
+ * {
+ *   // Successfully converted certificate to unregister DREP certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, unregister_drep will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_unregister_drep(
+  cardano_certificate_t*           certificate,
+  cardano_unregister_drep_cert_t** unregister_drep);
+
+/**
+ * \brief Converts a certificate to an unregistration certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_unregistration_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] unregistration On successful conversion, this will point to the \ref cardano_unregistration_cert_t object derived from the certificate.
+ *                            If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_unregistration_cert_t* unregistration = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_unregistration(certificate, &unregistration);
+ * if (result == CARDANO_SUCCESS && unregistration != NULL)
+ * {
+ *   // Successfully converted certificate to unregistration certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, unregistration will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_unregistration(
+  cardano_certificate_t*          certificate,
+  cardano_unregistration_cert_t** unregistration);
+
+/**
+ * \brief Converts a certificate to an update drep certificate type.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_update_drep_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] update_drep On successful conversion, this will point to the \ref cardano_update_drep_cert_t object derived from the certificate.
+ *                         If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_update_drep_cert_t* update_drep = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_update_drep(certificate, &update_drep);
+ * if (result == CARDANO_SUCCESS && update_drep != NULL)
+ * {
+ *   // Successfully converted certificate to update drep certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, update_drep will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_update_drep(
+  cardano_certificate_t*       certificate,
+  cardano_update_drep_cert_t** update_drep);
+
+/**
+ * \brief Converts a certificate to a vote delegation certificate.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_vote_delegation_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] vote_delegation On successful conversion, this will point to the \ref cardano_vote_delegation_cert_t object derived from the certificate.
+ *                             If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_vote_delegation_cert_t* vote_delegation = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_vote_delegation(certificate, &vote_delegation);
+ * if (result == CARDANO_SUCCESS && vote_delegation != NULL)
+ * {
+ *   // Successfully converted certificate to vote delegation certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, vote_delegation will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_vote_delegation(
+  cardano_certificate_t*           certificate,
+  cardano_vote_delegation_cert_t** vote_delegation);
+
+/**
+ * \brief Converts a certificate to a vote registration delegation certificate.
+ *
+ * This function attempts to convert a \ref cardano_certificate_t object into a \ref cardano_vote_registration_delegation_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object.
+ * \param[out] vote_registration_delegation On successful conversion, this will point to the \ref cardano_vote_registration_delegation_cert_t object derived from the certificate.
+ *                                          If the certificate is not of the correct type, this will be set to NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was successful,
+ *         or an appropriate error code indicating the failure reason. If the certificate type does not match, the function will return
+ *         \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_vote_registration_delegation_cert_t* vote_registration_delegation = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_to_vote_registration_delegation(certificate, &vote_registration_delegation);
+ * if (result == CARDANO_SUCCESS && vote_registration_delegation != NULL)
+ * {
+ *   // Successfully converted certificate to vote registration delegation certificate
+ * }
+ * else
+ * {
+ *   // Handle failure or incorrect certificate type
+ * }
+ * \endcode
+ *
+ * \note If the conversion fails or the certificate type is incorrect, vote_registration_delegation will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_to_vote_registration_delegation(
+  cardano_certificate_t*                        certificate,
+  cardano_vote_registration_delegation_cert_t** vote_registration_delegation);
+
+/**
+ * \brief Decrements the reference count of a cardano_certificate_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_certificate_t object
+ * by decreasing its reference count. When the reference count reaches zero, the auth_committee_hot is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] auth_committee_hot A pointer to the pointer of the auth_committee_hot object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_t* auth_committee_hot = cardano_certificate_new(major, minor);
+ *
+ * // Perform operations with the auth_committee_hot...
+ *
+ * cardano_certificate_unref(&auth_committee_hot);
+ * // At this point, auth_committee_hot is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_certificate_unref, the pointer to the \ref cardano_certificate_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_certificate_unref(cardano_certificate_t** auth_committee_hot);
+
+/**
+ * \brief Increases the reference count of the cardano_certificate_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_certificate_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_certificate_unref.
+ *
+ * \param auth_committee_hot A pointer to the cardano_certificate_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming auth_committee_hot is a previously created auth_committee_hot object
+ *
+ * cardano_certificate_ref(auth_committee_hot);
+ *
+ * // Now auth_committee_hot can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_certificate_ref there is a corresponding
+ * call to \ref cardano_certificate_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_certificate_ref(cardano_certificate_t* auth_committee_hot);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_certificate_t object.
+ *
+ * This function returns the number of active references to an cardano_certificate_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_certificate_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param auth_committee_hot A pointer to the cardano_certificate_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_certificate_t object. If the object
+ * is properly managed (i.e., every \ref cardano_certificate_ref call is matched with a
+ * \ref cardano_certificate_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming auth_committee_hot is a previously created auth_committee_hot object
+ *
+ * size_t ref_count = cardano_certificate_refcount(auth_committee_hot);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_certificate_refcount(const cardano_certificate_t* auth_committee_hot);
+
+/**
+ * \brief Sets the last error message for a given cardano_certificate_t object.
+ *
+ * Records an error message in the auth_committee_hot's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] auth_committee_hot A pointer to the \ref cardano_certificate_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the auth_committee_hot's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_certificate_set_last_error(
+  cardano_certificate_t* auth_committee_hot,
+  const char*            message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific auth_committee_hot.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_certificate_set_last_error for the given
+ * auth_committee_hot. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] auth_committee_hot A pointer to the \ref cardano_certificate_t instance whose last error
+ *                   message is to be retrieved. If the auth_committee_hot is NULL, the function
+ *                   returns a generic error message indicating the null auth_committee_hot.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified auth_committee_hot. If the auth_committee_hot is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_certificate_set_last_error for the same auth_committee_hot, or until
+ *       the auth_committee_hot is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_certificate_get_last_error(
+  const cardano_certificate_t* auth_committee_hot);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_certificate_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_certificate_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_deep_clone(const cardano_certificate_t* source, cardano_certificate_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // CERTIFICATE_H
diff --git a/vendor/include/cardano/certs/certificate_set.h b/vendor/include/cardano/certs/certificate_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/certificate_set.h
@@ -0,0 +1,441 @@
+/**
+ * \file certificate_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CERTIFICATE_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CERTIFICATE_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/certs/certificate.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Represents a set of certificates.
+ */
+typedef struct cardano_certificate_set_t cardano_certificate_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a certificate_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_certificate_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] certificate_set On successful initialization, this will point to a newly created
+ *             \ref cardano_certificate_set_t object. This object represents a "strong reference"
+ *             to the certificate_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the certificate_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_certificate_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_set_t* certificate_set = NULL;
+ *
+ * // Attempt to create a new certificate_set
+ * cardano_error_t result = cardano_certificate_set_new(&certificate_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the certificate_set
+ *
+ *   // Once done, ensure to clean up and release the certificate_set
+ *   cardano_certificate_set_unref(&certificate_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_set_new(cardano_certificate_set_t** certificate_set);
+
+/**
+ * \brief Creates a certificate set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_certificate_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a certificate.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded certificate data.
+ * \param[out] certificates A pointer to a pointer of \ref cardano_certificate_set_t that will be set to the address
+ *                        of the newly created certificate object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the certificate was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_certificate_set_t object by calling
+ *       \ref cardano_certificate_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_certificate_set_t* certificate = NULL;
+ *
+ * cardano_error_t result = cardano_certificate_set_from_cbor(reader, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the certificate
+ *
+ *   // Once done, ensure to clean up and release the certificate
+ *   cardano_certificate_set_unref(&certificate);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode certificate: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_set_from_cbor(cardano_cbor_reader_t* reader, cardano_certificate_set_t** certificates);
+
+/**
+ * \brief Serializes a certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_certificate_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] certificates A constant pointer to the \ref cardano_certificate_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p certificate or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_set_t* certificate = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_certificate_set_to_cbor(certificate, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_certificate_set_unref(&certificate);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_certificate_set_to_cbor(
+  const cardano_certificate_set_t* certificates,
+  cardano_cbor_writer_t*           writer);
+
+/**
+ * \brief Serializes a set of certificates to CIP-116 JSON.
+ *
+ * The function writes a JSON array containing the serialized certificates.
+ *
+ * \param[in]  certs   Pointer to a valid \ref cardano_certificate_set_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p certs or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_set_to_cip116_json(
+  const cardano_certificate_set_t* certs,
+  cardano_json_writer_t*           writer);
+
+/**
+ * \brief Retrieves the length of a certificate list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_certificate_set_t object.
+ *
+ * \param[in] certificate_set A constant pointer to the \ref cardano_certificate_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the certificate_set. Return 0 if the certificate_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_set_t* certificate_set = cardano_certificate_set_new();
+ *
+ * // Populate certificate_set with elements
+ *
+ * size_t length = cardano_certificate_set_get_length(certificate_set);
+ * printf("Length of the certificate_set: %zu\n", length);
+ *
+ * // Clean up the certificate_set object once done
+ * cardano_certificate_set_unref(&certificate_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_certificate_set_get_length(const cardano_certificate_set_t* certificate_set);
+
+/**
+ * \brief Retrieves an element from a certificate list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_certificate_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] certificate_set A constant pointer to the \ref cardano_certificate_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the certificate list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_certificate_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_certificate_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_set_t* certificate_set = cardano_certificate_set_new();
+ *
+ * // Populate certificate_set with elements
+ *
+ * cardano_certificate_t* element = NULL;
+ * cardano_error_t result = cardano_certificate_set_get(certificate_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_certificate_unref(&element);
+ * }
+ *
+ * // Clean up the certificate_set object once done
+ * cardano_certificate_set_unref(&certificate_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_certificate_set_get(const cardano_certificate_set_t* certificate_set, size_t index, cardano_certificate_t** element);
+
+/**
+ * \brief Adds an element to a certificate list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_certificate_set_t object.
+ *
+ * \param[in] certificate_set A constant pointer to the \ref cardano_certificate_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_certificate_t object that is to be added to the certificate_set.
+ *                    The element will be referenced by the certificate_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the certificate_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_set_t* certificate_set = cardano_certificate_set_new();
+ *
+ * // Create and initialize a new certificate element
+ * cardano_certificate_t* element = { ... };
+ *
+ * // Add the element to the certificate_set
+ * cardano_error_t result = cardano_certificate_set_add(certificate_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the certificate_set object once done
+ * cardano_certificate_set_unref(&certificate_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_certificate_set_add(cardano_certificate_set_t* certificate_set, cardano_certificate_t* element);
+
+/**
+ * \brief Decrements the reference count of a certificate_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_certificate_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the certificate_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] certificate_set A pointer to the pointer of the certificate_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_certificate_set_t* certificate_set = cardano_certificate_set_new();
+ *
+ * // Perform operations with the certificate_set...
+ *
+ * cardano_certificate_set_unref(&certificate_set);
+ * // At this point, certificate_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_certificate_set_unref, the pointer to the \ref cardano_certificate_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_certificate_set_unref(cardano_certificate_set_t** certificate_set);
+
+/**
+ * \brief Increases the reference count of the cardano_certificate_set_t object.
+ *
+ * This function is used to manually increment the reference count of a certificate_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_certificate_set_unref.
+ *
+ * \param certificate_set A pointer to the certificate_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming certificate_set is a previously created certificate_set object
+ *
+ * cardano_certificate_set_ref(certificate_set);
+ *
+ * // Now certificate_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_certificate_set_ref there is a corresponding
+ * call to \ref cardano_certificate_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_certificate_set_ref(cardano_certificate_set_t* certificate_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_certificate_set_t object.
+ *
+ * This function returns the number of active references to a certificate_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_certificate_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param certificate_set A pointer to the certificate_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified certificate_set object. If the object
+ * is properly managed (i.e., every \ref cardano_certificate_set_ref call is matched with a
+ * \ref cardano_certificate_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming certificate_set is a previously created certificate_set object
+ *
+ * size_t ref_count = cardano_certificate_set_refcount(certificate_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_certificate_set_refcount(const cardano_certificate_set_t* certificate_set);
+
+/**
+ * \brief Sets the last error message for a given certificate_set object.
+ *
+ * Records an error message in the certificate_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] certificate_set A pointer to the \ref cardano_certificate_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the certificate_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_certificate_set_set_last_error(cardano_certificate_set_t* certificate_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific certificate_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_certificate_set_set_last_error for the given
+ * certificate_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] certificate_set A pointer to the \ref cardano_certificate_set_t instance whose last error
+ *                   message is to be retrieved. If the certificate_set is NULL, the function
+ *                   returns a generic error message indicating the null certificate_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified certificate_set. If the certificate_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_certificate_set_set_last_error for the same certificate_set, or until
+ *       the certificate_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_certificate_set_get_last_error(const cardano_certificate_set_t* certificate_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_certificate_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_certificate_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_certificate_set_deep_clone(const cardano_certificate_set_t* source, cardano_certificate_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CERTIFICATE_SET_H
diff --git a/vendor/include/cardano/certs/genesis_key_delegation_cert.h b/vendor/include/cardano/certs/genesis_key_delegation_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/genesis_key_delegation_cert.h
@@ -0,0 +1,571 @@
+/**
+ * \file genesis_key_delegation_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef genesis_key_delegation_cert_H
+#define genesis_key_delegation_cert_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used to delegate from a Genesis key to a set of keys. This was primarily used in the early
+ * phases of the Cardano network's existence during the transition from the Byron to the Shelley era.
+ */
+typedef struct cardano_genesis_key_delegation_cert_t cardano_genesis_key_delegation_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new Genesis Key Delegation certificate.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_genesis_key_delegation_cert_t.
+ *
+ * \param[in] genesis_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the hash of the genesis block.
+ *                         This hash uniquely identifies the blockchain and ensures that the delegation occurs on the intended chain.
+ * \param[in] genesis_delegate_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the hash of the delegate's public key.
+ *                                  This delegate is the new recipient of the block production rights originally held by the genesis key.
+ * \param[in] vrf_key_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the hash of the VRF key belonging to the delegate.
+ * \param[out] cert On successful initialization, this parameter will point to the newly created \ref cardano_genesis_key_delegation_cert_t object.
+ *                  The caller is responsible for managing the lifecycle of this object, including its deallocation through the appropriate unref function.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was successfully created,
+ *         or an appropriate error code indicating the reason for failure, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* genesis_hash = ...; // Assume genesis_hash is already initialized
+ * cardano_blake2b_hash_t* genesis_delegate_hash = ...; // Assume genesis_delegate_hash is initialized
+ * cardano_blake2b_hash_t* vrf_key_hash = ...; // Assume vrf_key_hash is initialized
+ * cardano_genesis_key_delegation_cert_t* cert = NULL;
+ *
+ * cardano_error_t result = cardano_genesis_key_delegation_cert_new(genesis_hash, genesis_delegate_hash, vrf_key_hash, &cert);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The Genesis Key Delegation certificate is now ready to be used
+ *   // Remember to free the certificate when done
+ *   cardano_genesis_key_delegation_cert_unref(&cert);
+ * }
+ * else
+ * {
+ *   printf("Failed to create Genesis Key Delegation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_blake2b_hash_unref(&genesis_hash);
+ * cardano_blake2b_hash_unref(&genesis_delegate_hash);
+ * cardano_blake2b_hash_unref(&vrf_key_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_genesis_key_delegation_cert_new(
+  cardano_blake2b_hash_t*                 genesis_hash,
+  cardano_blake2b_hash_t*                 genesis_delegate_hash,
+  cardano_blake2b_hash_t*                 vrf_key_hash,
+  cardano_genesis_key_delegation_cert_t** cert);
+
+/**
+ * \brief Creates a \ref cardano_genesis_key_delegation_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_genesis_key_delegation_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a genesis_key_delegation_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] genesis_key_delegation_cert A pointer to a pointer of \ref cardano_genesis_key_delegation_cert_t that will be set to the address
+ *                        of the newly created genesis_key_delegation_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_genesis_key_delegation_cert_t object by calling
+ *       \ref cardano_genesis_key_delegation_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert = NULL;
+ *
+ * cardano_error_t result = cardano_genesis_key_delegation_cert_from_cbor(reader, &genesis_key_delegation_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the genesis_key_delegation_cert
+ *
+ *   // Once done, ensure to clean up and release the genesis_key_delegation_cert
+ *   cardano_genesis_key_delegation_cert_unref(&genesis_key_delegation_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode genesis_key_delegation_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_genesis_key_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_genesis_key_delegation_cert_t** genesis_key_delegation_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_genesis_key_delegation_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] genesis_key_delegation_cert A constant pointer to the \ref cardano_genesis_key_delegation_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p genesis_key_delegation_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_genesis_key_delegation_cert_to_cbor(genesis_key_delegation_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_genesis_key_delegation_cert_unref(&genesis_key_delegation_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_genesis_key_delegation_cert_to_cbor(
+  const cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert,
+  cardano_cbor_writer_t*                       writer);
+
+/**
+ * \brief Serializes a genesis-key-delegation certificate to CIP-116 JSON.
+ *
+ * Keys are written in deterministic order: "tag", "genesis_hash", "genesis_delegate_hash", "vrf_keyhash".
+ * The function writes the full JSON object, including surrounding braces.
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_genesis_key_delegation_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ *         CARDANO_ERROR_POINTER_IS_NULL  If \p cert or \p writer is NULL.
+ *         CARDANO_ERROR_ENCODING         If required fields are missing/invalid.
+ *         Other                          Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_genesis_key_delegation_cert_to_cip116_json(
+  const cardano_genesis_key_delegation_cert_t* cert,
+  cardano_json_writer_t*                       writer);
+
+/**
+ * \brief Retrieves the genesis hash from a genesis key delegation certificate.
+ *
+ * This function extracts the genesis hash from the specified \ref cardano_genesis_key_delegation_cert_t object.
+ * The genesis hash uniquely identifies the blockchain network and is used to confirm that the delegation occurs on the intended blockchain.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_genesis_key_delegation_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_blake2b_hash_t object containing the genesis hash. If the certificate is NULL or
+ *         if the genesis hash is not set, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_genesis_key_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_blake2b_hash_t* genesis_hash = cardano_genesis_key_delegation_cert_get_genesis_hash(certificate);
+ *
+ * if (genesis_hash != NULL)
+ * {
+ *   // Process the genesis hash
+ *   cardano_blake2b_hash_unref(&genesis_hash);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_genesis_key_delegation_cert_get_genesis_hash(
+  cardano_genesis_key_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the genesis hash in a genesis key delegation certificate.
+ *
+ * This function assigns a new genesis hash to the specified \ref cardano_genesis_key_delegation_cert_t object.
+ * The genesis hash uniquely identifies the blockchain network and is used to confirm that the delegation occurs on the intended blockchain.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_genesis_key_delegation_cert_t object.
+ * \param[in] hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the genesis hash.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the genesis hash
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_genesis_key_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_blake2b_hash_t* hash = ...; // Assume hash is initialized
+ * cardano_error_t result = cardano_genesis_key_delegation_cert_set_genesis_hash(certificate, hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Genesis hash set successfully.\n");
+ *
+ *  cardano_blake2b_hash_unref(&hash);
+ * }
+ * else
+ * {
+ *   printf("Failed to set genesis hash.\n");
+ * }
+ * \endcode
+ *
+ * \note This function does not take ownership of the hash; the caller is responsible for managing the lifecycle of the hash object.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_genesis_key_delegation_cert_set_genesis_hash(
+  cardano_genesis_key_delegation_cert_t* certificate,
+  cardano_blake2b_hash_t*                hash);
+
+/**
+ * \brief Retrieves the genesis delegate hash from a genesis key delegation certificate.
+ *
+ * This function extracts the genesis delegate hash from the specified \ref cardano_genesis_key_delegation_cert_t object.
+ * The genesis delegate hash is the public key hash of the delegate to whom the power of the genesis key is being delegated.
+ * This delegation is crucial during the transitional phase from the Byron era to the Shelley era, allowing specified delegates
+ * the rights to produce blocks.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_genesis_key_delegation_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_blake2b_hash_t object containing the genesis delegate hash. If the certificate is NULL or
+ *         if the genesis delegate hash is not set, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_genesis_key_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_blake2b_hash_t* delegate_hash = cardano_genesis_key_delegation_cert_get_genesis_delegate_hash(certificate);
+ *
+ * if (delegate_hash != NULL)
+ * {
+ *   // Process the genesis delegate hash
+ *   cardano_blake2b_hash_unref(&delegate_hash);
+ * }
+ * \endcode
+ *
+ * \note This function returns a new reference that must be managed by the caller.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_genesis_key_delegation_cert_get_genesis_delegate_hash(
+  cardano_genesis_key_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the genesis delegate hash for a genesis key delegation certificate.
+ *
+ * This function assigns a new genesis delegate hash to the specified \ref cardano_genesis_key_delegation_cert_t object.
+ * The genesis delegate hash is the public key hash of the delegate to whom the power of the genesis key is being delegated,
+ * crucial during the transitional phase from the Byron era to the Shelley era.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_genesis_key_delegation_cert_t object.
+ * \param[in] hash A constant pointer to an initialized \ref cardano_blake2b_hash_t object containing the new genesis delegate hash.
+ *                 The certificate object will hold a reference to this hash object, so it must remain valid for the duration of
+ *                 the certificate's lifecycle or until a different hash is set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the genesis delegate hash
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any
+ *         of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_genesis_key_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_blake2b_hash_t* delegate_hash = ...; // Assume delegate_hash is already initialized
+ *
+ * cardano_error_t result = cardano_genesis_key_delegation_cert_set_genesis_delegate_hash(certificate, delegate_hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Genesis delegate hash updated successfully.\n");
+ *   cardano_blake2b_hash_unref(&delegate_hash);
+ * }
+ * else
+ * {
+ *   printf("Failed to set the genesis delegate hash.\n");
+ * }
+ * \endcode
+ *
+ * \note This function does not take ownership of the hash; the caller is responsible for managing the lifecycle of the hash object.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_genesis_key_delegation_cert_set_genesis_delegate_hash(
+  cardano_genesis_key_delegation_cert_t* certificate,
+  cardano_blake2b_hash_t*                hash);
+
+/**
+ * \brief Retrieves the VRF key hash from a genesis key delegation certificate.
+ *
+ * This function extracts the VRF (Verifiable Random Function) key hash from the specified
+ * \ref cardano_genesis_key_delegation_cert_t object. The VRF key hash is critical for ensuring the integrity
+ * and security of the random selection process in the blockchain's consensus mechanism.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_genesis_key_delegation_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_blake2b_hash_t object containing the VRF key hash. If the certificate is NULL or
+ *         if the VRF key hash is not set, this function returns NULL. The returned hash object is a new reference, and
+ *         the caller is responsible for releasing it using \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_genesis_key_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_blake2b_hash_t* vrf_key_hash = cardano_genesis_key_delegation_cert_get_vrf_key_hash(certificate);
+ *
+ * if (vrf_key_hash != NULL)
+ * {
+ *   // Process the VRF key hash
+ *   cardano_blake2b_hash_unref(&vrf_key_hash);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve VRF key hash.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_genesis_key_delegation_cert_get_vrf_key_hash(
+  cardano_genesis_key_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the VRF key hash for a genesis key delegation certificate.
+ *
+ * This function assigns a VRF (Verifiable Random Function) key hash to a given \ref cardano_genesis_key_delegation_cert_t object.
+ * The VRF key hash is crucial for the secure and random selection process in the blockchain's consensus mechanism.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_genesis_key_delegation_cert_t object to which the VRF key hash will be set.
+ * \param[in] hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the VRF key hash.
+ *                 The certificate takes a reference to this hash, ensuring it remains valid for the duration of the certificate's usage.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the VRF key hash was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_genesis_key_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_blake2b_hash_t* vrf_key_hash = ...; // Assume vrf_key_hash is already initialized
+ *
+ * cardano_error_t result = cardano_genesis_key_delegation_cert_set_vrf_key_hash(certificate, vrf_key_hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("VRF key hash successfully set.\n");
+ *   cardano_blake2b_hash_unref(&vrf_key_hash);
+ * }
+ * else
+ * {
+ *   printf("Failed to set VRF key hash.\n");
+ * }
+ * \endcode
+ *
+ * \note This function does not take ownership of the hash; the caller is responsible for managing the lifecycle of the hash object.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_genesis_key_delegation_cert_set_vrf_key_hash(
+  cardano_genesis_key_delegation_cert_t* certificate,
+  cardano_blake2b_hash_t*                hash);
+
+/**
+ * \brief Decrements the reference count of a cardano_genesis_key_delegation_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_genesis_key_delegation_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the genesis_key_delegation_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] genesis_key_delegation_cert A pointer to the pointer of the genesis_key_delegation_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert = cardano_genesis_key_delegation_cert_new(major, minor);
+ *
+ * // Perform operations with the genesis_key_delegation_cert...
+ *
+ * cardano_genesis_key_delegation_cert_unref(&genesis_key_delegation_cert);
+ * // At this point, genesis_key_delegation_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_genesis_key_delegation_cert_unref, the pointer to the \ref cardano_genesis_key_delegation_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_genesis_key_delegation_cert_unref(
+  cardano_genesis_key_delegation_cert_t** genesis_key_delegation_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_genesis_key_delegation_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_genesis_key_delegation_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_genesis_key_delegation_cert_unref.
+ *
+ * \param genesis_key_delegation_cert A pointer to the cardano_genesis_key_delegation_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming genesis_key_delegation_cert is a previously created genesis_key_delegation_cert object
+ *
+ * cardano_genesis_key_delegation_cert_ref(genesis_key_delegation_cert);
+ *
+ * // Now genesis_key_delegation_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_genesis_key_delegation_cert_ref there is a corresponding
+ * call to \ref cardano_genesis_key_delegation_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_genesis_key_delegation_cert_ref(
+  cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_genesis_key_delegation_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_genesis_key_delegation_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_genesis_key_delegation_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param genesis_key_delegation_cert A pointer to the cardano_genesis_key_delegation_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_genesis_key_delegation_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_genesis_key_delegation_cert_ref call is matched with a
+ * \ref cardano_genesis_key_delegation_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming genesis_key_delegation_cert is a previously created genesis_key_delegation_cert object
+ *
+ * size_t ref_count = cardano_genesis_key_delegation_cert_refcount(genesis_key_delegation_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_genesis_key_delegation_cert_refcount(
+  const cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_genesis_key_delegation_cert_t object.
+ *
+ * Records an error message in the genesis_key_delegation_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] genesis_key_delegation_cert A pointer to the \ref cardano_genesis_key_delegation_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the genesis_key_delegation_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_genesis_key_delegation_cert_set_last_error(
+  cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert,
+  const char*                            message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific genesis_key_delegation_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_genesis_key_delegation_cert_set_last_error for the given
+ * genesis_key_delegation_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] genesis_key_delegation_cert A pointer to the \ref cardano_genesis_key_delegation_cert_t instance whose last error
+ *                   message is to be retrieved. If the genesis_key_delegation_cert is NULL, the function
+ *                   returns a generic error message indicating the null genesis_key_delegation_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified genesis_key_delegation_cert. If the genesis_key_delegation_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_genesis_key_delegation_cert_set_last_error for the same genesis_key_delegation_cert, or until
+ *       the genesis_key_delegation_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_genesis_key_delegation_cert_get_last_error(
+  const cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_genesis_key_delegation_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_genesis_key_delegation_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_genesis_key_delegation_cert_deep_clone(const cardano_genesis_key_delegation_cert_t* source, cardano_genesis_key_delegation_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // genesis_key_delegation_cert_H
diff --git a/vendor/include/cardano/certs/mir_cert.h b/vendor/include/cardano/certs/mir_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/mir_cert.h
@@ -0,0 +1,512 @@
+/**
+ * \file mir_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_MIR_CERT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_MIR_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/certs/mir_cert_type.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Certificate used to facilitate an instantaneous transfer of rewards within the system.
+ *
+ * Typically, rewards in Cardano are accumulated and distributed through a carefully designed
+ * process aligned with the staking and delegation mechanics. However, certain situations may
+ * require a more immediate or specialized handling of rewards, and that's where this type of
+ * certificate comes into play.
+ *
+ * The MoveInstantaneousReward certificate allows for immediate redistribution of rewards
+ * within pots, or to a specified se of stake addresses.
+ */
+typedef struct cardano_mir_cert_t cardano_mir_cert_t;
+
+/**
+ * \brief This certificate move instantaneous rewards funds between accounting pots.
+ */
+typedef struct cardano_mir_to_pot_cert_t cardano_mir_to_pot_cert_t;
+
+/**
+ * \brief Creates a move instantaneous rewards certificate that transfers funds to the given set of reward accounts.
+ */
+typedef struct cardano_mir_to_stake_creds_cert_t cardano_mir_to_stake_creds_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a Move Instantaneous Rewards (MIR) certificate for transferring funds to another accounting pot.
+ *
+ * This function initializes a new instance of \ref cardano_mir_cert_t that represents a certificate for moving
+ * instantaneous rewards between different accounting pots within the Cardano system.
+ *
+ * \param[in] to_other_pot_cert A pointer to the \ref cardano_mir_to_pot_cert_t object to cast as a \ref cardano_mir_cert_t.
+ * \param[out] mir_cert A pointer to a pointer that will be set to the address of the newly created \ref cardano_mir_cert_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate
+ *         was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_pot_cert_t* to_other_pot_cert = NULL;
+ * cardano_mir_cert_t* mir_cert = NULL;
+ *
+ * cardano_error_t result = cardano_mir_cert_new_to_other_pot(&to_other_pot_cert, &mir_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the MIR certificate
+ *
+ *   // Clean up
+ *   cardano_mir_to_pot_cert_unref(&to_other_pot_cert);
+ *   cardano_mir_cert_unref(&mir_cert);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_cert_new_to_other_pot(
+  cardano_mir_to_pot_cert_t* to_other_pot_cert,
+  cardano_mir_cert_t**       mir_cert);
+
+/**
+ * \brief Creates a Move Instantaneous Rewards (MIR) certificate for transferring funds to a set of reward accounts.
+ *
+ * This function initializes a new instance of \ref cardano_mir_cert_t that represents a certificate for moving
+ * instantaneous rewards to specified stake credentials within the Cardano system.
+ *
+ * \param[in] to_stake_creds_cert A pointer to a \ref cardano_mir_to_stake_creds_cert_t object representing the target stake credentials.
+ * \param[out] mir_cert A pointer to a pointer that will be set to the address of the newly created \ref cardano_mir_cert_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate
+ *         was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_stake_creds_cert_t* to_stake_creds_cert = ...; // Assume this is initialized
+ * cardano_mir_cert_t* mir_cert = NULL;
+ *
+ * cardano_error_t result = cardano_mir_cert_new_to_stake_creds(to_stake_creds_cert, &mir_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the MIR certificate
+ *
+ *   // Clean up
+ *   cardano_mir_to_stake_creds_cert_unref(&to_stake_creds_cert);
+ *   cardano_mir_cert_unref(&mir_cert);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_cert_new_to_stake_creds(
+  cardano_mir_to_stake_creds_cert_t* to_stake_creds_cert,
+  cardano_mir_cert_t**               mir_cert);
+
+/**
+ * \brief Creates a \ref cardano_mir_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_mir_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a mir_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] mir_cert A pointer to a pointer of \ref cardano_mir_cert_t that will be set to the address
+ *                        of the newly created mir_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_mir_cert_t object by calling
+ *       \ref cardano_mir_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_mir_cert_t* mir_cert = NULL;
+ *
+ * cardano_error_t result = cardano_mir_cert_from_cbor(reader, &mir_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the mir_cert
+ *
+ *   // Once done, ensure to clean up and release the mir_cert
+ *   cardano_mir_cert_unref(&mir_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode mir_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_mir_cert_t** mir_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_mir_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] mir_cert A constant pointer to the \ref cardano_mir_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p mir_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_cert_t* mir_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_mir_cert_to_cbor(mir_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_mir_cert_unref(&mir_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_mir_cert_to_cbor(
+  const cardano_mir_cert_t* mir_cert,
+  cardano_cbor_writer_t*    writer);
+
+/**
+ * \brief Serializes a Move Instantaneous Rewards (MIR) certificate to CIP-116 JSON.
+ *
+ * This function dispatches based on the MIR certificate variant and emits the
+ * corresponding CIP-116 JSON object exactly as produced by the concrete helpers:
+ *
+ * - \ref cardano_mir_to_pot_cert_to_cip116_json for MIR-to-pot certificates
+ * - \ref cardano_mir_to_stake_creds_cert_to_cip116_json for MIR-to-stake-creds
+ *
+ * \param[in]  cert   Pointer to a valid \ref cardano_mir_cert_t.
+ * \param[in]  writer Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ *         CARDANO_ERROR_POINTER_IS_NULL  If \p cert or \p writer is NULL.
+ *         CARDANO_ERROR_INVALID_CERTIFICATE_TYPE If the MIR variant is unknown.
+ *         Other                          Any error propagated from nested serializers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_cert_to_cip116_json(
+  const cardano_mir_cert_t* cert,
+  cardano_json_writer_t*    writer);
+
+/**
+ * \brief Retrieves the type of a Move Instantaneous Rewards (MIR) certificate.
+ *
+ * This function extracts the type of the specified \ref cardano_mir_cert_t object, which indicates
+ * whether the certificate moves funds between accounting pots or transfers funds to specified
+ * reward accounts.
+ *
+ * \param[in] mir_cert A constant pointer to the \ref cardano_mir_cert_t object whose type is to be retrieved.
+ * \param[out] type A pointer to a \ref cardano_mir_cert_type_t variable where the type of the MIR certificate will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the type
+ *         was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_cert_t* mir_cert = ...; // Assume this is initialized
+ * cardano_mir_cert_type_t type;
+ *
+ * cardano_error_t result = cardano_mir_cert_get_type(mir_cert, &type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the MIR certificate type
+ *   if (type == CARDANO_MIR_CERT_TYPE_TO_POT)
+ *   {
+ *     // Handle pot type
+ *   }
+ *   else if (type == CARDANO_MIR_CERT_TYPE_TO_STAKE_CREDS)
+ *   {
+ *     // Handle stake credentials type
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_mir_cert_unref(&mir_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_cert_get_type(const cardano_mir_cert_t* mir_cert, cardano_mir_cert_type_t* type);
+
+/**
+ * \brief Retrieves the Move Instantaneous Rewards (MIR) certificate as a 'to other pot' certificate.
+ *
+ * This function extracts the \ref cardano_mir_to_pot_cert_t object from the specified
+ * \ref cardano_mir_cert_t object if the MIR certificate type is \ref CARDANO_MIR_CERT_TYPE_TO_POT.
+ *
+ * \param[in] mir_cert A pointer to the \ref cardano_mir_cert_t object to be converted.
+ * \param[out] to_other_pot_cert A pointer to a pointer that will be set to the address of the
+ *             \ref cardano_mir_to_pot_cert_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the conversion was successful, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_cert_t* mir_cert = ...; // Assume this is initialized
+ * cardano_mir_to_pot_cert_t* to_other_pot_cert = NULL;
+ *
+ * cardano_error_t result = cardano_mir_cert_as_to_other_pot(mir_cert, &to_other_pot_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the to_other_pot_cert
+ * }
+ *
+ * // Clean up
+ * cardano_mir_cert_unref(&mir_cert);
+ * cardano_mir_to_pot_cert_unref(&to_other_pot_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_mir_cert_as_to_other_pot(
+  cardano_mir_cert_t*         mir_cert,
+  cardano_mir_to_pot_cert_t** to_other_pot_cert);
+
+/**
+ * \brief Retrieves the Move Instantaneous Rewards (MIR) certificate as a 'to stake credentials' certificate.
+ *
+ * This function extracts the \ref cardano_mir_to_stake_creds_cert_t object from the specified
+ * \ref cardano_mir_cert_t object if the MIR certificate type is \ref CARDANO_MIR_CERT_TYPE_TO_STAKE_CREDS.
+ *
+ * \param[in] mir_cert A pointer to the \ref cardano_mir_cert_t object to be converted.
+ * \param[out] to_stake_creds_cert A pointer to a pointer that will be set to the address of the
+ *             \ref cardano_mir_to_stake_creds_cert_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the conversion was successful, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_cert_t* mir_cert = ...; // Assume this is initialized
+ * cardano_mir_to_stake_creds_cert_t* to_stake_creds_cert = NULL;
+ *
+ * cardano_error_t result = cardano_mir_cert_as_to_stake_creds(mir_cert, &to_stake_creds_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the to_stake_creds_cert
+ * }
+ *
+ * // Clean up
+ * cardano_mir_cert_unref(&mir_cert);
+ * cardano_mir_to_stake_creds_cert_unref(&to_stake_creds_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_mir_cert_as_to_stake_creds(
+  cardano_mir_cert_t*                 mir_cert,
+  cardano_mir_to_stake_creds_cert_t** to_stake_creds_cert);
+
+/**
+ * \brief Decrements the reference count of a cardano_mir_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_mir_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the mir_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] mir_cert A pointer to the pointer of the mir_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_cert_t* mir_cert = cardano_mir_cert_new(major, minor);
+ *
+ * // Perform operations with the mir_cert...
+ *
+ * cardano_mir_cert_unref(&mir_cert);
+ * // At this point, mir_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_mir_cert_unref, the pointer to the \ref cardano_mir_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_mir_cert_unref(cardano_mir_cert_t** mir_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_mir_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_mir_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_mir_cert_unref.
+ *
+ * \param mir_cert A pointer to the cardano_mir_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming mir_cert is a previously created mir_cert object
+ *
+ * cardano_mir_cert_ref(mir_cert);
+ *
+ * // Now mir_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_mir_cert_ref there is a corresponding
+ * call to \ref cardano_mir_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_mir_cert_ref(cardano_mir_cert_t* mir_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_mir_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_mir_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_mir_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param mir_cert A pointer to the cardano_mir_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_mir_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_mir_cert_ref call is matched with a
+ * \ref cardano_mir_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming mir_cert is a previously created mir_cert object
+ *
+ * size_t ref_count = cardano_mir_cert_refcount(mir_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_mir_cert_refcount(const cardano_mir_cert_t* mir_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_mir_cert_t object.
+ *
+ * Records an error message in the mir_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] mir_cert A pointer to the \ref cardano_mir_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the mir_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_mir_cert_set_last_error(
+  cardano_mir_cert_t* mir_cert,
+  const char*         message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific mir_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_mir_cert_set_last_error for the given
+ * mir_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] mir_cert A pointer to the \ref cardano_mir_cert_t instance whose last error
+ *                   message is to be retrieved. If the mir_cert is NULL, the function
+ *                   returns a generic error message indicating the null mir_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified mir_cert. If the mir_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_mir_cert_set_last_error for the same mir_cert, or until
+ *       the mir_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_mir_cert_get_last_error(
+  const cardano_mir_cert_t* mir_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_mir_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_mir_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_mir_cert_deep_clone(const cardano_mir_cert_t* source, cardano_mir_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_MIR_CERT_H
diff --git a/vendor/include/cardano/certs/mir_cert_pot_type.h b/vendor/include/cardano/certs/mir_cert_pot_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/mir_cert_pot_type.h
@@ -0,0 +1,64 @@
+/**
+ * \file mir_cert_pot_type.h
+ *
+ * \author angel.castillo
+ * \date   jun 19, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license");
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_MIR_CERT_POT_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_MIR_CERT_POT_TYPE_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumerates the target pots for Move Instantaneous Reward (MIR) certificates.
+ *
+ * MIR certificates in Cardano can move funds between different accounting pots.
+ * This enumeration defines the types of pots to which funds can be transferred.
+ */
+typedef enum
+{
+  /**
+   * \brief Indicates that the MIR certificate moves funds to the reserve pot.
+   *
+   * The reserve pot in Cardano is a pool of ADA coins that are gradually released into
+   * circulation. This reserve is used to provide a continuous supply of ADA for staking
+   * rewards and other incentives. The reserve helps ensure the long-term sustainability
+   * of the Cardano network by maintaining a steady flow of rewards for network participants.
+   */
+  CARDANO_MIR_CERT_POT_TYPE_RESERVE = 0,
+
+  /**
+   * \brief Indicates that the MIR certificate moves funds to the treasury pot.
+   *
+   * The treasury pot in Cardano is a fund allocated for the development and improvement
+   * of the Cardano ecosystem. For example, it is used to finance projects, proposals, and initiatives
+   * through the Project Catalyst governance system. The treasury is filled by a portion
+   * of transaction fees and monetary expansion.
+   */
+  CARDANO_MIR_CERT_POT_TYPE_TREASURY = 1
+} cardano_mir_cert_pot_type_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_MIR_CERT_POT_TYPE_H
diff --git a/vendor/include/cardano/certs/mir_cert_type.h b/vendor/include/cardano/certs/mir_cert_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/mir_cert_type.h
@@ -0,0 +1,53 @@
+/**
+ * \file mir_cert_type.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_MIR_CERT_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_MIR_CERT_TYPE_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumerates the types of MIR certificates.
+ *
+ * This enumeration defines the possible types of Move Instantaneous Rewards (MIR) certificates in the Cardano system.
+ */
+typedef enum
+{
+  /**
+   * \brief This MIR certificate moves instantaneous rewards funds between accounting pots.
+   */
+  CARDANO_MIR_CERT_TYPE_TO_POT = 0,
+
+  /**
+   * \brief This MIR certificate transfers funds to the given set of reward accounts.
+   */
+  CARDANO_MIR_CERT_TYPE_TO_STAKE_CREDS = 1
+} cardano_mir_cert_type_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_MIR_CERT_TYPE_H
diff --git a/vendor/include/cardano/certs/mir_to_pot_cert.h b/vendor/include/cardano/certs/mir_to_pot_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/mir_to_pot_cert.h
@@ -0,0 +1,463 @@
+/**
+ * \file mir_to_pot_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_MIR_TO_POD_CERT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_MIR_TO_POD_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/certs/mir_cert_pot_type.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate move instantaneous rewards funds between accounting pots.
+ */
+typedef struct cardano_mir_to_pot_cert_t cardano_mir_to_pot_cert_t;
+
+/**
+ * \brief Certificate used to facilitate an instantaneous transfer of rewards within the system.
+ *
+ * Typically, rewards in Cardano are accumulated and distributed through a carefully designed
+ * process aligned with the staking and delegation mechanics. However, certain situations may
+ * require a more immediate or specialized handling of rewards, and that's where this type of
+ * certificate comes into play.
+ *
+ * The MoveInstantaneousReward certificate allows for immediate redistribution of rewards
+ * within pots, or to a specified se of stake addresses.
+ */
+typedef struct cardano_mir_cert_t cardano_mir_cert_t;
+
+/**
+ * \brief Initializes a new instance of the Move Instantaneous Reward (MIR) certificate for transferring funds between pots.
+ *
+ * This function initializes a new \ref cardano_mir_to_pot_cert_t object, which represents a MIR certificate
+ * designed to transfer a specified amount of ADA from one accounting pot to another within the Cardano ecosystem.
+ *
+ * \param[in] pot_type Determines the accounting pot from which the funds will be drawn. This is specified by the
+ *                     \ref cardano_mir_to_pot_cert_t enumeration, which includes options for the reserve pot or the treasury pot.
+ * \param[in] amount The amount of ADA to be transferred by this MIR certificate.
+ * \param[out] mir_to_pot_cert On successful creation, this will point to a newly created \ref cardano_mir_to_pot_cert_t object.
+ *                             The caller is responsible for managing the lifecycle of this object. Specifically,
+ *                             once the MIR certificate is no longer needed, the caller must release it by calling
+ *                             the appropriate deallocation function.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the MIR certificate was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_pot_cert_t* mir_to_pot_cert = NULL;
+ * cardano_error_t result = cardano_mir_to_pot_cert_new(CARDANO_MIR_CERT_POT_TYPE_RESERVE, 1000, &mir_to_pot_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the MIR certificate
+ *
+ *   // Once done, ensure to clean up and release the MIR certificate
+ *   cardano_mir_to_pot_cert_unref(&mir_to_pot_cert);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_pot_cert_new(
+  cardano_mir_cert_pot_type_t pot_type,
+  uint64_t                    amount,
+  cardano_mir_to_pot_cert_t** mir_to_pot_cert);
+
+/**
+ * \brief Creates a \ref cardano_mir_to_pot_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_mir_to_pot_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a mir_to_pot_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] mir_to_pot_cert A pointer to a pointer of \ref cardano_mir_to_pot_cert_t that will be set to the address
+ *                        of the newly created mir_to_pot_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_mir_to_pot_cert_t object by calling
+ *       \ref cardano_mir_to_pot_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_mir_to_pot_cert_t* mir_to_pot_cert = NULL;
+ *
+ * cardano_error_t result = cardano_mir_to_pot_cert_from_cbor(reader, &mir_to_pot_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the mir_to_pot_cert
+ *
+ *   // Once done, ensure to clean up and release the mir_to_pot_cert
+ *   cardano_mir_to_pot_cert_unref(&mir_to_pot_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode mir_to_pot_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_pot_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_mir_to_pot_cert_t** mir_to_pot_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_mir_to_pot_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] mir_to_pot_cert A constant pointer to the \ref cardano_mir_to_pot_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p mir_to_pot_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_pot_cert_t* mir_to_pot_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_mir_to_pot_cert_to_cbor(mir_to_pot_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_mir_to_pot_cert_unref(&mir_to_pot_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_mir_to_pot_cert_to_cbor(
+  const cardano_mir_to_pot_cert_t* mir_to_pot_cert,
+  cardano_cbor_writer_t*           writer);
+
+/**
+ * \brief Serializes a MIR-to-pot certificate to CIP-116 JSON.
+ *
+ * Keys are written in deterministic order: "tag", "pot", "amount".
+ * The function writes the full JSON object, including surrounding braces.
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_mir_to_pot_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ *         CARDANO_ERROR_POINTER_IS_NULL  If \p cert or \p writer is NULL.
+ *         CARDANO_ERROR_ENCODING         If required fields are missing/invalid.
+ *         Other                          Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_pot_cert_to_cip116_json(
+  const cardano_mir_to_pot_cert_t* cert,
+  cardano_json_writer_t*           writer);
+
+/**
+ * \brief Retrieves the pot type from a Move Instantaneous Reward (MIR) certificate.
+ *
+ * This function extracts the pot type from the given \ref cardano_mir_to_pot_cert_t object, indicating whether the funds
+ * are drawn from the reserve or the treasury.
+ *
+ * \param[in] mir_cert A constant pointer to the \ref cardano_mir_to_pot_cert_t object.
+ * \param[out] type A pointer to a \ref cardano_mir_cert_pot_type_t variable where the pot type will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pot type was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_pot_cert_t* mir_cert = ...; // Assume this is initialized
+ * cardano_mir_cert_pot_type_t pot_type;
+ * cardano_error_t result = cardano_mir_to_pot_cert_get_pot(mir_cert, &pot_type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pot type
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_pot_cert_get_pot(const cardano_mir_to_pot_cert_t* mir_cert, cardano_mir_cert_pot_type_t* type);
+
+/**
+ * \brief Sets the pot type for a Move Instantaneous Reward (MIR) certificate.
+ *
+ * This function assigns the specified pot type to the given \ref cardano_mir_to_pot_cert_t object, indicating whether the funds
+ * are drawn from the reserve or the treasury.
+ *
+ * \param[in,out] mir_cert A pointer to the \ref cardano_mir_to_pot_cert_t object.
+ * \param[in] type The pot type to be set, represented by \ref cardano_mir_cert_pot_type_t.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pot type was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_pot_cert_t* mir_cert = ...; // Assume this is initialized
+ * cardano_mir_cert_pot_type_t pot_type = CARDANO_MIR_CERT_POT_TYPE_RESERVE;
+ * cardano_error_t result = cardano_mir_to_pot_cert_set_pot(mir_cert, pot_type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Pot type was successfully set
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_pot_cert_set_pot(cardano_mir_to_pot_cert_t* mir_cert, cardano_mir_cert_pot_type_t type);
+
+/**
+ * \brief Retrieves the amount specified in a Move Instantaneous Reward (MIR) certificate.
+ *
+ * This function gets the amount to be transferred as specified in the given \ref cardano_mir_to_pot_cert_t object.
+ *
+ * \param[in] mir_cert A constant pointer to the \ref cardano_mir_to_pot_cert_t object.
+ * \param[out] amount A pointer to a uint64_t where the amount will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the amount was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_mir_to_pot_cert_t* mir_cert = ...; // Assume this is initialized
+ * uint64_t amount = 0;
+ * cardano_error_t result = cardano_mir_to_pot_cert_get_amount(mir_cert, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Amount was successfully retrieved
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_pot_cert_get_amount(const cardano_mir_to_pot_cert_t* mir_cert, uint64_t* amount);
+
+/**
+ * \brief Sets the amount in a Move Instantaneous Reward (MIR) certificate.
+ *
+ * This function sets the amount to be transferred in the given \ref cardano_mir_to_pot_cert_t object.
+ *
+ * \param[in,out] mir_cert A pointer to the \ref cardano_mir_to_pot_cert_t object.
+ * \param[in] amount The amount to be set in the MIR certificate.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the amount was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_pot_cert_t* mir_cert = ...; // Assume this is initialized
+ * uint64_t amount = 1000;
+ * cardano_error_t result = cardano_mir_to_pot_cert_set_amount(mir_cert, amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Amount was successfully set
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_pot_cert_set_amount(cardano_mir_to_pot_cert_t* mir_cert, uint64_t amount);
+
+/**
+ * \brief Decrements the reference count of a cardano_mir_to_pot_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_mir_to_pot_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the mir_to_pot_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] mir_to_pot_cert A pointer to the pointer of the mir_to_pot_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_pot_cert_t* mir_to_pot_cert = cardano_mir_to_pot_cert_new(major, minor);
+ *
+ * // Perform operations with the mir_to_pot_cert...
+ *
+ * cardano_mir_to_pot_cert_unref(&mir_to_pot_cert);
+ * // At this point, mir_to_pot_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_mir_to_pot_cert_unref, the pointer to the \ref cardano_mir_to_pot_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_mir_to_pot_cert_unref(cardano_mir_to_pot_cert_t** mir_to_pot_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_mir_to_pot_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_mir_to_pot_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_mir_to_pot_cert_unref.
+ *
+ * \param mir_to_pot_cert A pointer to the cardano_mir_to_pot_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming mir_to_pot_cert is a previously created mir_to_pot_cert object
+ *
+ * cardano_mir_to_pot_cert_ref(mir_to_pot_cert);
+ *
+ * // Now mir_to_pot_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_mir_to_pot_cert_ref there is a corresponding
+ * call to \ref cardano_mir_to_pot_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_mir_to_pot_cert_ref(cardano_mir_to_pot_cert_t* mir_to_pot_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_mir_to_pot_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_mir_to_pot_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_mir_to_pot_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param mir_to_pot_cert A pointer to the cardano_mir_to_pot_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_mir_to_pot_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_mir_to_pot_cert_ref call is matched with a
+ * \ref cardano_mir_to_pot_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming mir_to_pot_cert is a previously created mir_to_pot_cert object
+ *
+ * size_t ref_count = cardano_mir_to_pot_cert_refcount(mir_to_pot_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_mir_to_pot_cert_refcount(const cardano_mir_to_pot_cert_t* mir_to_pot_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_mir_to_pot_cert_t object.
+ *
+ * Records an error message in the mir_to_pot_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] mir_to_pot_cert A pointer to the \ref cardano_mir_to_pot_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the mir_to_pot_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_mir_to_pot_cert_set_last_error(
+  cardano_mir_to_pot_cert_t* mir_to_pot_cert,
+  const char*                message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific mir_to_pot_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_mir_to_pot_cert_set_last_error for the given
+ * mir_to_pot_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] mir_to_pot_cert A pointer to the \ref cardano_mir_to_pot_cert_t instance whose last error
+ *                   message is to be retrieved. If the mir_to_pot_cert is NULL, the function
+ *                   returns a generic error message indicating the null mir_to_pot_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified mir_to_pot_cert. If the mir_to_pot_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_mir_to_pot_cert_set_last_error for the same mir_to_pot_cert, or until
+ *       the mir_to_pot_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_mir_to_pot_cert_get_last_error(
+  const cardano_mir_to_pot_cert_t* mir_to_pot_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_mir_to_pot_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_mir_to_pot_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_pot_cert_deep_clone(const cardano_mir_to_pot_cert_t* source, cardano_mir_to_pot_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_MIR_TO_POD_CERT_H
diff --git a/vendor/include/cardano/certs/mir_to_stake_creds_cert.h b/vendor/include/cardano/certs/mir_to_stake_creds_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/mir_to_stake_creds_cert.h
@@ -0,0 +1,593 @@
+/**
+ * \file mir_to_stake_creds_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_MIR_TO_STAKE_CREDS_CERT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_MIR_TO_STAKE_CREDS_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include "mir_cert_pot_type.h"
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Certificate used to facilitate an instantaneous transfer of rewards within the system.
+ *
+ * Typically, rewards in Cardano are accumulated and distributed through a carefully designed
+ * process aligned with the staking and delegation mechanics. However, certain situations may
+ * require a more immediate or specialized handling of rewards, and that's where this type of
+ * certificate comes into play.
+ *
+ * The MoveInstantaneousReward certificate allows for immediate redistribution of rewards
+ * within pots, or to a specified se of stake addresses.
+ */
+typedef struct cardano_mir_cert_t cardano_mir_cert_t;
+
+/**
+ * \brief Creates a move instantaneous rewards certificate that transfers funds to the given set of reward accounts.
+ */
+typedef struct cardano_mir_to_stake_creds_cert_t cardano_mir_to_stake_creds_cert_t;
+
+/**
+ * \brief Creates a new Move Instantaneous Rewards to Stake Credentials certificate.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_mir_to_stake_creds_cert_t,
+ * which is used to facilitate the transfer of rewards to a set of stake credentials directly.
+ * The newly created certificate is capable of storing mappings from stake credentials to the amount
+ * of ADA to be transferred.
+ *
+ * \param[in] pot_type Determines the accounting pot from which the funds will be drawn. This is specified by the
+ *                     \ref cardano_mir_to_pot_cert_t enumeration, which includes options for the reserve pot or the treasury pot.
+ * \param[out] mir_to_stake_creds_cert On successful execution, this will point to the newly created
+ *            \ref cardano_mir_to_stake_creds_cert_t object. The caller is responsible for managing
+ *            the lifecycle of this object, including freeing it with the appropriate function when
+ *            it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the certificate was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_stake_creds_cert_t* cert = NULL;
+ * cardano_error_t result = cardano_mir_to_stake_creds_cert_new(CARDANO_MIR_CERT_POT_TYPE_RESERVE, &cert);
+ *
+ * if (result == CARDANO_SUCCESS) {
+ *   // Use the cert
+ *
+ *   // Once done, ensure to clean up and release the certificate
+ *   cardano_mir_to_stake_creds_cert_unref(&cert);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_stake_creds_cert_new(cardano_mir_cert_pot_type_t pot_type, cardano_mir_to_stake_creds_cert_t** mir_to_stake_creds_cert);
+
+/**
+ * \brief Creates a \ref cardano_mir_to_stake_creds_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_mir_to_stake_creds_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a mir_to_stake_creds_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] mir_to_stake_creds_cert A pointer to a pointer of \ref cardano_mir_to_stake_creds_cert_t that will be set to the address
+ *                        of the newly created mir_to_stake_creds_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_mir_to_stake_creds_cert_t object by calling
+ *       \ref cardano_mir_to_stake_creds_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert = NULL;
+ *
+ * cardano_error_t result = cardano_mir_to_stake_creds_cert_from_cbor(reader, &mir_to_stake_creds_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the mir_to_stake_creds_cert
+ *
+ *   // Once done, ensure to clean up and release the mir_to_stake_creds_cert
+ *   cardano_mir_to_stake_creds_cert_unref(&mir_to_stake_creds_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode mir_to_stake_creds_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_stake_creds_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_mir_to_stake_creds_cert_t** mir_to_stake_creds_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_mir_to_stake_creds_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] mir_to_stake_creds_cert A constant pointer to the \ref cardano_mir_to_stake_creds_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p mir_to_stake_creds_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_mir_to_stake_creds_cert_to_cbor(mir_to_stake_creds_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_mir_to_stake_creds_cert_unref(&mir_to_stake_creds_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_mir_to_stake_creds_cert_to_cbor(
+  const cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert,
+  cardano_cbor_writer_t*                   writer);
+
+/**
+ * \brief Serializes a MIR-to-stake-credentials certificate to CIP-116 JSON.
+ *
+ * Keys are written in deterministic order: "tag", "pot", then "rewards".
+ * The function writes the full JSON object, including surrounding braces.
+ *
+ * \param[in]  cert   Pointer to a valid \ref cardano_mir_to_stake_creds_cert_t.
+ * \param[in]  writer Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ *         CARDANO_ERROR_POINTER_IS_NULL  If \p cert or \p writer is NULL.
+ *         CARDANO_ERROR_ENCODING         If required fields are missing/invalid.
+ *         Other                          Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_stake_creds_cert_to_cip116_json(
+  const cardano_mir_to_stake_creds_cert_t* cert,
+  cardano_json_writer_t*                   writer);
+
+/**
+ * \brief Retrieves the source pot type from a Move Instantaneous Reward (MIR) certificate to stake credentials.
+ *
+ * This function gets the type of pot from which the funds are drawn in the given \ref cardano_mir_to_stake_creds_cert_t object.
+ *
+ * \param[in] mir_cert A constant pointer to the \ref cardano_mir_to_stake_creds_cert_t object.
+ * \param[out] type A pointer to the \ref cardano_mir_cert_pot_type_t where the type will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pot type was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_stake_creds_cert_t* mir_cert = ...; // Assume this is initialized
+ * cardano_mir_cert_pot_type_t type;
+ * cardano_error_t result = cardano_mir_to_stake_creds_cert_get_pot(mir_cert, &type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Type was successfully retrieved
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_stake_creds_cert_get_pot(const cardano_mir_to_stake_creds_cert_t* mir_cert, cardano_mir_cert_pot_type_t* type);
+
+/**
+ * \brief Sets the source pot type in a Move Instantaneous Reward (MIR) certificate to stake credentials.
+ *
+ * This function sets the type of pot from which the funds are drawn in the given \ref cardano_mir_to_stake_creds_cert_t object.
+ *
+ * \param[in] mir_cert A pointer to the \ref cardano_mir_to_stake_creds_cert_t object.
+ * \param[in] type The \ref cardano_mir_cert_pot_type_t value representing the source pot type to be set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pot type was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_stake_creds_cert_t* mir_cert = ...; // Assume this is initialized
+ * cardano_mir_cert_pot_type_t type = CARDANO_MIR_CERT_POT_TYPE_TREASURY;
+ * cardano_error_t result = cardano_mir_to_stake_creds_cert_set_pot(mir_cert, type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Type was successfully set
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_stake_creds_cert_set_pot(cardano_mir_to_stake_creds_cert_t* mir_cert, cardano_mir_cert_pot_type_t type);
+
+/**
+ * \brief Gets the size of the credential-to-amount map in a Move Instantaneous Reward (MIR) certificate to stake credentials.
+ *
+ * This function retrieves the number of entries in the map from credential to amount within the given \ref cardano_mir_to_stake_creds_cert_t object.
+ *
+ * \param[in] mir_to_stake_creds_cert A constant pointer to the \ref cardano_mir_to_stake_creds_cert_t object.
+ *
+ * \return The number of entries in the credential-to-amount map.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_mir_to_stake_creds_cert_t* mir_cert = ...; // Assume this is initialized
+ * size_t map_size = cardano_mir_to_stake_creds_cert_get_size(mir_cert);
+ * printf("Number of entries in the credential-to-amount map: %zu\n", map_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_mir_to_stake_creds_cert_get_size(const cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert);
+
+/**
+ * \brief Inserts a credential-to-amount mapping into a Move Instantaneous Reward (MIR) certificate to stake credentials.
+ *
+ * This function inserts a new entry into the map from credential to amount within the given
+ * \ref cardano_mir_to_stake_creds_cert_t object. The specified amount will be transferred
+ * as a reward to the provided credential from the selected pot.
+ *
+ * \param[in,out] mir_to_stake_creds_cert A pointer to the \ref cardano_mir_to_stake_creds_cert_t object.
+ * \param[in] credential A pointer to the \ref cardano_credential_t object representing the credential.
+ * \param[in] amount The amount associated with the credential to be inserted into the map.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         entry was successfully inserted, or an appropriate error code indicating the failure reason.
+ *
+ * \note The certificate does not take ownership of the \p credential. It only stores a reference to it.
+ *       The caller is responsible for freeing its own \ref cardano_credential_t instance and the
+ *       \ref cardano_mir_to_stake_creds_cert_t instance when they are no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_stake_creds_cert_t* mir_cert = ...; // Assume this is initialized
+ * cardano_credential_t* credential = ...; // Assume this is initialized
+ * uint64_t amount = 1000;
+ * cardano_error_t result = cardano_mir_to_stake_creds_cert_insert(mir_cert, credential, amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Entry was successfully inserted, and the specified amount will be transferred
+ *   // as a reward to the credential from the selected pot.
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ *
+ * // Free resources
+ * cardano_credential_unref(&credential);
+ * cardano_mir_to_stake_creds_cert_unref(&mir_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_mir_to_stake_creds_cert_insert(
+  cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert,
+  cardano_credential_t*              credential,
+  uint64_t                           amount);
+
+/**
+ * \brief Retrieves the credential key at a specified index from the Move Instantaneous Reward (MIR) certificate to stake credentials.
+ *
+ * This function retrieves the credential key at the specified index within the given
+ * \ref cardano_mir_to_stake_creds_cert_t object. The credential represents a specific
+ * entry in the map from credential to amount.
+ *
+ * \param[in] mir_to_stake_creds_cert A constant pointer to the \ref cardano_mir_to_stake_creds_cert_t object.
+ * \param[in] index The index of the entry to retrieve.
+ * \param[out] credential A pointer to a pointer that will be set to the address of a newly created
+ *                        \ref cardano_credential_t object, representing the retrieved credential.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         credential was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * \note The returned credential is a new reference, and the caller is responsible for managing its lifecycle.
+ *       Once the credential is no longer needed, the caller must release it by calling \ref cardano_credential_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_mir_to_stake_creds_cert_t* mir_cert = ...; // Assume this is initialized
+ * size_t index = 0;
+ * cardano_credential_t* credential = NULL;
+ * cardano_error_t result = cardano_mir_to_stake_creds_cert_get_key_at(mir_cert, index, &credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_mir_to_stake_creds_cert_get_key_at(
+  cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert,
+  size_t                             index,
+  cardano_credential_t**             credential);
+
+/**
+ * \brief Retrieves the amount associated with a credential at a specified index in a Move Instantaneous Reward (MIR) to stake credentials certificate.
+ *
+ * This function fetches the amount of ADA to be transferred as a reward to the stake credential at the specified index within the MIR certificate.
+ * The amount is intended for redistribution from the selected pot to the specified credential.
+ *
+ * \param[in] mir_to_stake_creds_cert A constant pointer to the \ref cardano_mir_to_stake_creds_cert_t object containing the mapping of credentials to amounts.
+ * \param[in] index The index of the credential within the certificate whose associated amount is to be retrieved.
+ * \param[out] amount A pointer to a uint64_t variable where the retrieved amount will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the amount was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_mir_to_stake_creds_cert_t* mir_cert = ...; // Assume this is initialized
+ * size_t index = 0;
+ * uint64_t amount = 0;
+ * cardano_error_t result = cardano_mir_to_stake_creds_cert_get_value_at(mir_cert, index, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Amount for credential at index %zu is %llu.\n", index, amount);
+ *   // Further processing...
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_mir_to_stake_creds_cert_get_value_at(
+  const cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert,
+  size_t                                   index,
+  uint64_t*                                amount);
+
+/**
+ * \brief Retrieves both the credential and the amount associated with it at a specified index in a Move Instantaneous Reward (MIR) to stake credentials certificate.
+ *
+ * This function provides access to the mapping at a given index within the MIR to stake credentials certificate, allowing the caller to retrieve the credential and the corresponding amount of ADA that is to be transferred as a reward. The credential and amount are used in the certificate's internal representation of transfers from the treasury or reserve to stake addresses.
+ *
+ * \param[in] mir_to_stake_creds_cert A constant pointer to the \ref cardano_mir_to_stake_creds_cert_t object.
+ * \param[in] index The index within the certificate's internal map from which to retrieve the credential and associated amount.
+ * \param[out] credential A pointer to a pointer of \ref cardano_credential_t that will be set to point to a newly created reference of the credential. The caller is responsible for managing the lifecycle of this credential reference by calling \ref cardano_credential_unref.
+ * \param[out] amount A pointer to a uint64_t where the amount of ADA to be transferred is stored.
+ *
+ * \return \ref cardano_error_t indicating the success or failure of the operation. Returns \ref CARDANO_SUCCESS if the data was successfully retrieved, or an appropriate error code indicating the reason for failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_mir_to_stake_creds_cert_t* mir_cert = ...; // Assume this is initialized
+ * size_t index = 0;
+ * cardano_credential_t* credential = NULL;
+ * uint64_t amount = 0;
+ *
+ * cardano_error_t result = cardano_mir_to_stake_creds_cert_get_key_value_at(mir_cert, index, &credential, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Credential at index %zu will receive %llu ADA.\n", index, amount);
+ *   // Further processing...
+ *
+ *   // Don't forget to free the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_mir_to_stake_creds_cert_get_key_value_at(
+  cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert,
+  size_t                             index,
+  cardano_credential_t**             credential,
+  uint64_t*                          amount);
+
+/**
+ * \brief Decrements the reference count of a cardano_mir_to_stake_creds_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_mir_to_stake_creds_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the mir_to_stake_creds_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] mir_to_stake_creds_cert A pointer to the pointer of the mir_to_stake_creds_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert = cardano_mir_to_stake_creds_cert_new(major, minor);
+ *
+ * // Perform operations with the mir_to_stake_creds_cert...
+ *
+ * cardano_mir_to_stake_creds_cert_unref(&mir_to_stake_creds_cert);
+ * // At this point, mir_to_stake_creds_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_mir_to_stake_creds_cert_unref, the pointer to the \ref cardano_mir_to_stake_creds_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_mir_to_stake_creds_cert_unref(cardano_mir_to_stake_creds_cert_t** mir_to_stake_creds_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_mir_to_stake_creds_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_mir_to_stake_creds_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_mir_to_stake_creds_cert_unref.
+ *
+ * \param mir_to_stake_creds_cert A pointer to the cardano_mir_to_stake_creds_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming mir_to_stake_creds_cert is a previously created mir_to_stake_creds_cert object
+ *
+ * cardano_mir_to_stake_creds_cert_ref(mir_to_stake_creds_cert);
+ *
+ * // Now mir_to_stake_creds_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_mir_to_stake_creds_cert_ref there is a corresponding
+ * call to \ref cardano_mir_to_stake_creds_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_mir_to_stake_creds_cert_ref(cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_mir_to_stake_creds_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_mir_to_stake_creds_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_mir_to_stake_creds_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param mir_to_stake_creds_cert A pointer to the cardano_mir_to_stake_creds_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_mir_to_stake_creds_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_mir_to_stake_creds_cert_ref call is matched with a
+ * \ref cardano_mir_to_stake_creds_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming mir_to_stake_creds_cert is a previously created mir_to_stake_creds_cert object
+ *
+ * size_t ref_count = cardano_mir_to_stake_creds_cert_refcount(mir_to_stake_creds_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_mir_to_stake_creds_cert_refcount(const cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_mir_to_stake_creds_cert_t object.
+ *
+ * Records an error message in the mir_to_stake_creds_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] mir_to_stake_creds_cert A pointer to the \ref cardano_mir_to_stake_creds_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the mir_to_stake_creds_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_mir_to_stake_creds_cert_set_last_error(
+  cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert,
+  const char*                        message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific mir_to_stake_creds_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_mir_to_stake_creds_cert_set_last_error for the given
+ * mir_to_stake_creds_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] mir_to_stake_creds_cert A pointer to the \ref cardano_mir_to_stake_creds_cert_t instance whose last error
+ *                   message is to be retrieved. If the mir_to_stake_creds_cert is NULL, the function
+ *                   returns a generic error message indicating the null mir_to_stake_creds_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified mir_to_stake_creds_cert. If the mir_to_stake_creds_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_mir_to_stake_creds_cert_set_last_error for the same mir_to_stake_creds_cert, or until
+ *       the mir_to_stake_creds_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_mir_to_stake_creds_cert_get_last_error(
+  const cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_mir_to_stake_creds_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_mir_to_stake_creds_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_mir_to_stake_creds_cert_deep_clone(const cardano_mir_to_stake_creds_cert_t* source, cardano_mir_to_stake_creds_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_MIR_TO_STAKE_CREDS_CERT_H
diff --git a/vendor/include/cardano/certs/pool_registration_cert.h b/vendor/include/cardano/certs/pool_registration_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/pool_registration_cert.h
@@ -0,0 +1,413 @@
+/**
+ * \file pool_registration_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POOL_REGISTRATION_CERT_H
+#define POOL_REGISTRATION_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/pool_params/pool_params.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used to register a new stake pool. It includes various details
+ * about the pool such as the pledge, costs, margin, reward account, and the pool's owners and relays.
+ */
+typedef struct cardano_pool_registration_cert_t cardano_pool_registration_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new pool registration certificate.
+ *
+ * This function allocates and initializes a new \ref cardano_pool_registration_cert_t object based on the provided pool parameters.
+ * A pool registration certificate is used in the Cardano network to register a new stake pool.
+ *
+ * \param[in] params A pointer to an initialized \ref cardano_pool_params_t object containing the parameters of the pool being registered.
+ * \param[out] cardano_pool_registration_cert On successful execution, this will point to a newly created \ref cardano_pool_registration_cert_t object.
+ *                                            The caller is responsible for managing the lifecycle of this object using \ref cardano_pool_registration_cert_unref
+ *                                            when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the pool registration certificate was
+ *         successfully created, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* params = ...; // Assume params is already initialized
+ * cardano_pool_registration_cert_t* registration_cert = NULL;
+ *
+ * cardano_error_t result = cardano_pool_registration_cert_new(params, &registration_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The pool registration certificate can now be used for pool registration
+ *   // Remember to free the certificate when done
+ *   cardano_pool_registration_cert_unref(&registration_cert);
+ * }
+ * else
+ * {
+ *   printf("Failed to create pool registration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_registration_cert_new(
+  cardano_pool_params_t*             params,
+  cardano_pool_registration_cert_t** cardano_pool_registration_cert);
+
+/**
+ * \brief Creates a \ref cardano_pool_registration_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_pool_registration_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a pool_registration_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] pool_registration_cert A pointer to a pointer of \ref cardano_pool_registration_cert_t that will be set to the address
+ *                        of the newly created pool_registration_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_pool_registration_cert_t object by calling
+ *       \ref cardano_pool_registration_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_pool_registration_cert_t* pool_registration_cert = NULL;
+ *
+ * cardano_error_t result = cardano_pool_registration_cert_from_cbor(reader, &pool_registration_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pool_registration_cert
+ *
+ *   // Once done, ensure to clean up and release the pool_registration_cert
+ *   cardano_pool_registration_cert_unref(&pool_registration_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode pool_registration_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_registration_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_registration_cert_t** pool_registration_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_pool_registration_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] pool_registration_cert A constant pointer to the \ref cardano_pool_registration_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p pool_registration_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_registration_cert_t* pool_registration_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_pool_registration_cert_to_cbor(pool_registration_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_pool_registration_cert_unref(&pool_registration_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_registration_cert_to_cbor(
+  const cardano_pool_registration_cert_t* pool_registration_cert,
+  cardano_cbor_writer_t*                  writer);
+
+/**
+ * \brief Serializes a pool registration certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "pool_params".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_pool_registration_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cert or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_registration_cert_to_cip116_json(
+  const cardano_pool_registration_cert_t* cert,
+  cardano_json_writer_t*                  writer);
+
+/**
+ * \brief Retrieves the pool parameters from a pool registration certificate.
+ *
+ * This function extracts the pool parameters from the specified \ref cardano_pool_registration_cert_t object.
+ * These parameters define the configurations of the stake pool being registered.
+ *
+ * \param[in] cert A pointer to an initialized \ref cardano_pool_registration_cert_t object from which the pool parameters are to be retrieved.
+ * \param[out] params On successful execution, this will point to the \ref cardano_pool_params_t object associated with the pool registration certificate.
+ *                    This output provides a reference to the pool parameters, which the caller must manage using \ref cardano_pool_params_unref when no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the pool parameters were successfully retrieved,
+ *         or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_registration_cert_t* registration_cert = ...; // Assume registration_cert is already initialized
+ * cardano_pool_params_t* params = NULL;
+ *
+ * cardano_error_t result = cardano_pool_registration_cert_get_params(registration_cert, &params);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the pool parameters
+ *   // Remember to free the params when done
+ *   cardano_pool_params_unref(&params);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve pool parameters: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_registration_cert_get_params(
+  cardano_pool_registration_cert_t* cert,
+  cardano_pool_params_t**           params);
+
+/**
+ * \brief Sets the parameters for a pool registration certificate.
+ *
+ * This function sets the pool parameters for an existing pool registration certificate. It updates the certificate
+ * to use the provided pool parameters.
+ *
+ * \param[in] cert A pointer to an initialized cardano_pool_registration_cert_t object representing the pool registration certificate.
+ * \param[in] params A pointer to an initialized cardano_pool_params_t object representing the pool parameters to set.
+ *
+ * \return cardano_error_t indicating the outcome of the operation. Returns CARDANO_SUCCESS if the parameters were successfully set.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_registration_cert_t* cert = ...; // Assume initialized
+ * cardano_pool_params_t* params = ...; // Assume initialized
+ * cardano_error_t result = cardano_pool_registration_cert_set_params(cert, params);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The pool registration certificate now has the updated parameters
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_registration_cert_set_params(
+  cardano_pool_registration_cert_t* cert,
+  cardano_pool_params_t*            params);
+
+/**
+ * \brief Decrements the reference count of a cardano_pool_registration_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_pool_registration_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the pool_registration_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] pool_registration_cert A pointer to the pointer of the pool_registration_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_registration_cert_t* pool_registration_cert = cardano_pool_registration_cert_new(major, minor);
+ *
+ * // Perform operations with the pool_registration_cert...
+ *
+ * cardano_pool_registration_cert_unref(&pool_registration_cert);
+ * // At this point, pool_registration_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_pool_registration_cert_unref, the pointer to the \ref cardano_pool_registration_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_pool_registration_cert_unref(cardano_pool_registration_cert_t** pool_registration_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_pool_registration_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_pool_registration_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_pool_registration_cert_unref.
+ *
+ * \param pool_registration_cert A pointer to the cardano_pool_registration_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_registration_cert is a previously created pool_registration_cert object
+ *
+ * cardano_pool_registration_cert_ref(pool_registration_cert);
+ *
+ * // Now pool_registration_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_pool_registration_cert_ref there is a corresponding
+ * call to \ref cardano_pool_registration_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_pool_registration_cert_ref(cardano_pool_registration_cert_t* pool_registration_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_pool_registration_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_pool_registration_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_pool_registration_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param pool_registration_cert A pointer to the cardano_pool_registration_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_pool_registration_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_pool_registration_cert_ref call is matched with a
+ * \ref cardano_pool_registration_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_registration_cert is a previously created pool_registration_cert object
+ *
+ * size_t ref_count = cardano_pool_registration_cert_refcount(pool_registration_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_pool_registration_cert_refcount(const cardano_pool_registration_cert_t* pool_registration_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_pool_registration_cert_t object.
+ *
+ * Records an error message in the pool_registration_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] pool_registration_cert A pointer to the \ref cardano_pool_registration_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the pool_registration_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_pool_registration_cert_set_last_error(
+  cardano_pool_registration_cert_t* pool_registration_cert,
+  const char*                       message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific pool_registration_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_pool_registration_cert_set_last_error for the given
+ * pool_registration_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] pool_registration_cert A pointer to the \ref cardano_pool_registration_cert_t instance whose last error
+ *                   message is to be retrieved. If the pool_registration_cert is NULL, the function
+ *                   returns a generic error message indicating the null pool_registration_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified pool_registration_cert. If the pool_registration_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_pool_registration_cert_set_last_error for the same pool_registration_cert, or until
+ *       the pool_registration_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_pool_registration_cert_get_last_error(
+  const cardano_pool_registration_cert_t* pool_registration_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_pool_registration_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_pool_registration_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_pool_registration_cert_deep_clone(const cardano_pool_registration_cert_t* source, cardano_pool_registration_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // POOL_REGISTRATION_CERT_H
diff --git a/vendor/include/cardano/certs/pool_retirement_cert.h b/vendor/include/cardano/certs/pool_retirement_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/pool_retirement_cert.h
@@ -0,0 +1,475 @@
+/**
+ * \file pool_retirement_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef POOL_RETIREMENT_CERT_H
+#define POOL_RETIREMENT_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used to retire a stake pool. It includes an epoch number indicating when the pool will be retired.
+ */
+typedef struct cardano_pool_retirement_cert_t cardano_pool_retirement_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new pool retirement certificate.
+ *
+ * This function allocates and initializes a new \ref cardano_pool_retirement_cert_t object, which signifies
+ * the intent to retire a stake pool at a specified epoch. The retirement certificate includes the stake pool's
+ * operator key hash and the epoch at which the pool is scheduled to retire.
+ *
+ * \param[in] pool_key_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the hash of the pool's operator key.
+ * \param[in] epoch The epoch number at which the pool is scheduled to retire.
+ * \param[out] pool_retirement_cert On successful execution, this will point to the newly created \ref cardano_pool_retirement_cert_t object.
+ *                                           The caller is responsible for releasing this resource using \ref cardano_pool_retirement_cert_unref when it
+ *                                           is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the pool retirement certificate was
+ *         successfully created, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* pool_key_hash = ...;  // Assume pool_key_hash is already initialized
+ * uint64_t epoch = 250;  // Specify the epoch for retirement
+ * cardano_pool_retirement_cert_t* retirement_cert = NULL;
+ *
+ * cardano_error_t result = cardano_pool_retirement_cert_new(pool_key_hash, epoch, &retirement_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The retirement certificate can now be used for scheduling pool retirement
+ *   // Remember to free the retirement certificate when done
+ *   cardano_pool_retirement_cert_unref(&retirement_cert);
+ * }
+ * else
+ * {
+ *   printf("Failed to create pool retirement certificate: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_retirement_cert_new(
+  cardano_blake2b_hash_t*          pool_key_hash,
+  uint64_t                         epoch,
+  cardano_pool_retirement_cert_t** pool_retirement_cert);
+
+/**
+ * \brief Creates a \ref cardano_pool_retirement_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_pool_retirement_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a pool_retirement_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] pool_retirement_cert A pointer to a pointer of \ref cardano_pool_retirement_cert_t that will be set to the address
+ *                        of the newly created pool_retirement_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_pool_retirement_cert_t object by calling
+ *       \ref cardano_pool_retirement_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_pool_retirement_cert_t* pool_retirement_cert = NULL;
+ *
+ * cardano_error_t result = cardano_pool_retirement_cert_from_cbor(reader, &pool_retirement_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pool_retirement_cert
+ *
+ *   // Once done, ensure to clean up and release the pool_retirement_cert
+ *   cardano_pool_retirement_cert_unref(&pool_retirement_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode pool_retirement_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_retirement_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_retirement_cert_t** pool_retirement_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_pool_retirement_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] pool_retirement_cert A constant pointer to the \ref cardano_pool_retirement_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p pool_retirement_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_retirement_cert_t* pool_retirement_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_pool_retirement_cert_to_cbor(pool_retirement_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_pool_retirement_cert_unref(&pool_retirement_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_retirement_cert_to_cbor(
+  const cardano_pool_retirement_cert_t* pool_retirement_cert,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes a pool retirement certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "pool_keyhash", "epoch".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_pool_retirement_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p cert or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_retirement_cert_to_cip116_json(
+  const cardano_pool_retirement_cert_t* cert,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Retrieves the pool key hash from a pool retirement certificate.
+ *
+ * This function extracts the pool key hash from the specified \ref cardano_pool_retirement_cert_t object.
+ * The pool key hash is the unique identifier for the stake pool.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_pool_retirement_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_blake2b_hash_t object containing the pool key hash. If the certificate
+ *         is NULL or if the pool key hash is not set, this function returns NULL. This function returns a reference
+ *         to the internal hash object, which should not be modified or freed by the caller. Use \ref cardano_blake2b_hash_unref
+ *         to safely reduce the reference count when the hash is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_pool_retirement_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_blake2b_hash_t* pool_key_hash = cardano_pool_retirement_cert_get_pool_key_hash(certificate);
+ *
+ * if (pool_key_hash != NULL)
+ * {
+ *   // Process the pool key hash
+ *   // No need to unref this specific reference since it is managed internally
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the pool key hash or certificate is not valid.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_pool_retirement_cert_get_pool_key_hash(cardano_pool_retirement_cert_t* certificate);
+
+/**
+ * \brief Sets the pool key hash for a pool retirement certificate.
+ *
+ * This function assigns a new pool key hash to a given \ref cardano_pool_retirement_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_pool_retirement_cert_t object to which the key hash will be set.
+ * \param[in] hash A pointer to a constant \ref cardano_blake2b_hash_t object representing the new pool key hash.
+ *                 This function increments the reference count of the hash object; it is the caller's responsibility to manage
+ *                 the lifecycle of the hash and decrement the reference count when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool key hash was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_retirement_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_blake2b_hash_t* new_pool_key_hash = ...; // Assume new_pool_key_hash is already initialized
+ *
+ * cardano_error_t result = cardano_pool_retirement_cert_set_pool_key_hash(certificate, new_pool_key_hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool key hash set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the pool key hash.\n");
+ * }
+ *
+ * // Remember to manage the reference count of new_pool_key_hash appropriately
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_retirement_cert_set_pool_key_hash(cardano_pool_retirement_cert_t* certificate, cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Retrieves the retirement epoch for a pool retirement certificate.
+ *
+ * This function extracts the epoch number from a given \ref cardano_pool_retirement_cert_t object.
+ * The epoch number specifies when the retirement of the stake pool will take effect on the Cardano blockchain.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_pool_retirement_cert_t object.
+ *
+ * \return The epoch number as a uint64_t at which the stake pool is scheduled to retire. If the certificate
+ *         is NULL or does not have an epoch set, this function returns 0 as a default value, which should be
+ *         handled appropriately by the caller.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_pool_retirement_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t retirement_epoch = cardano_pool_retirement_cert_get_epoch(certificate);
+ *
+ * printf("Stake pool scheduled to retire at epoch: %lu\n", retirement_epoch);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_pool_retirement_cert_get_epoch(const cardano_pool_retirement_cert_t* certificate);
+
+/**
+ * \brief Sets the retirement epoch for a pool retirement certificate.
+ *
+ * This function assigns a new retirement epoch to a given \ref cardano_pool_retirement_cert_t object.
+ * The epoch number specifies when the retirement of the stake pool will take effect on the Cardano blockchain.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_pool_retirement_cert_t object where the retirement epoch will be set.
+ * \param[in] epoch The epoch number at which the stake pool is scheduled to retire.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the epoch number was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_retirement_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t retirement_epoch = 250; // Example epoch number for retirement
+ *
+ * cardano_error_t result = cardano_pool_retirement_cert_set_epoch(certificate, retirement_epoch);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Retirement epoch set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the retirement epoch.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_retirement_cert_set_epoch(cardano_pool_retirement_cert_t* certificate, uint64_t epoch);
+
+/**
+ * \brief Decrements the reference count of a cardano_pool_retirement_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_pool_retirement_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the pool_retirement_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] pool_retirement_cert A pointer to the pointer of the pool_retirement_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_retirement_cert_t* pool_retirement_cert = cardano_pool_retirement_cert_new(major, minor);
+ *
+ * // Perform operations with the pool_retirement_cert...
+ *
+ * cardano_pool_retirement_cert_unref(&pool_retirement_cert);
+ * // At this point, pool_retirement_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_pool_retirement_cert_unref, the pointer to the \ref cardano_pool_retirement_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_pool_retirement_cert_unref(cardano_pool_retirement_cert_t** pool_retirement_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_pool_retirement_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_pool_retirement_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_pool_retirement_cert_unref.
+ *
+ * \param pool_retirement_cert A pointer to the cardano_pool_retirement_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_retirement_cert is a previously created pool_retirement_cert object
+ *
+ * cardano_pool_retirement_cert_ref(pool_retirement_cert);
+ *
+ * // Now pool_retirement_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_pool_retirement_cert_ref there is a corresponding
+ * call to \ref cardano_pool_retirement_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_pool_retirement_cert_ref(cardano_pool_retirement_cert_t* pool_retirement_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_pool_retirement_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_pool_retirement_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_pool_retirement_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param pool_retirement_cert A pointer to the cardano_pool_retirement_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_pool_retirement_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_pool_retirement_cert_ref call is matched with a
+ * \ref cardano_pool_retirement_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_retirement_cert is a previously created pool_retirement_cert object
+ *
+ * size_t ref_count = cardano_pool_retirement_cert_refcount(pool_retirement_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_pool_retirement_cert_refcount(const cardano_pool_retirement_cert_t* pool_retirement_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_pool_retirement_cert_t object.
+ *
+ * Records an error message in the pool_retirement_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] pool_retirement_cert A pointer to the \ref cardano_pool_retirement_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the pool_retirement_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_pool_retirement_cert_set_last_error(
+  cardano_pool_retirement_cert_t* pool_retirement_cert,
+  const char*                     message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific pool_retirement_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_pool_retirement_cert_set_last_error for the given
+ * pool_retirement_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] pool_retirement_cert A pointer to the \ref cardano_pool_retirement_cert_t instance whose last error
+ *                   message is to be retrieved. If the pool_retirement_cert is NULL, the function
+ *                   returns a generic error message indicating the null pool_retirement_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified pool_retirement_cert. If the pool_retirement_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_pool_retirement_cert_set_last_error for the same pool_retirement_cert, or until
+ *       the pool_retirement_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_pool_retirement_cert_get_last_error(
+  const cardano_pool_retirement_cert_t* pool_retirement_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_pool_retirement_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_pool_retirement_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_pool_retirement_cert_deep_clone(const cardano_pool_retirement_cert_t* source, cardano_pool_retirement_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // POOL_RETIREMENT_CERT_H
diff --git a/vendor/include/cardano/certs/register_drep_cert.h b/vendor/include/cardano/certs/register_drep_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/register_drep_cert.h
@@ -0,0 +1,550 @@
+/**
+ * \file register_drep_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef REGISTER_DREP_CERT_H
+#define REGISTER_DREP_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/anchor.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief In Voltaire, existing stake credentials will be able to delegate their stake to DReps for voting
+ * purposes, in addition to the current delegation to stake pools for block production.
+ * DRep delegation will mimic the existing stake delegation mechanisms (via on-chain certificates).
+ *
+ * This certificate register a stake key as a DRep.
+ */
+typedef struct cardano_register_drep_cert_t cardano_register_drep_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new DRep registration certificate.
+ *
+ * This function allocates and initializes a \ref cardano_register_drep_cert_t object,
+ * which represents a certificate for registering a DRep in the Cardano network.
+ *
+ * \param[in] drep_credential A pointer to an initialized \ref cardano_credential_t object representing
+ *                            the credential of the decentralized representative.
+ * \param[in] deposit The deposit amount required for registration.
+ * \param[in] anchor An instance of \ref cardano_anchor_t representing the anchor of the metadata linked to this DRep. This is optional.
+ * \param[out] register_drep_cert On successful execution, this will point to a newly created \ref cardano_register_drep_cert_t object.
+ *                                The caller is responsible for releasing this resource using \ref cardano_register_drep_cert_unref when it
+ *                                is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the DRep registration certificate was successfully created, or an appropriate error code indicating
+ *         the failure reason (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* drep_credential = ...; // Assume drep_credential is already initialized
+ * uint64_t deposit = 5000000; // Example deposit amount in lovelace
+ * cardano_anchor_t anchor = ...; // Assume anchor is initialized
+ * cardano_register_drep_cert_t* register_drep_cert = NULL;
+ *
+ * cardano_error_t result = cardano_register_drep_cert_new(drep_credential, deposit, anchor, &register_drep_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The DRep registration certificate can now be used
+ *   // Remember to free the register_drep_cert when done
+ *   cardano_register_drep_cert_unref(&register_drep_cert);
+ * }
+ * else
+ * {
+ *   printf("Failed to create DRep registration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_credential_unref(&drep_credential); // Cleanup the drep_credential
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_register_drep_cert_new(
+  cardano_credential_t*          drep_credential,
+  uint64_t                       deposit,
+  cardano_anchor_t*              anchor,
+  cardano_register_drep_cert_t** register_drep_cert);
+
+/**
+ * \brief Creates a \ref cardano_register_drep_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_register_drep_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a register_drep_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] register_drep_cert A pointer to a pointer of \ref cardano_register_drep_cert_t that will be set to the address
+ *                        of the newly created register_drep_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_register_drep_cert_t object by calling
+ *       \ref cardano_register_drep_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_register_drep_cert_t* register_drep_cert = NULL;
+ *
+ * cardano_error_t result = cardano_register_drep_cert_from_cbor(reader, &register_drep_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the register_drep_cert
+ *
+ *   // Once done, ensure to clean up and release the register_drep_cert
+ *   cardano_register_drep_cert_unref(&register_drep_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode register_drep_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_register_drep_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_register_drep_cert_t** register_drep_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_register_drep_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] register_drep_cert A constant pointer to the \ref cardano_register_drep_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p register_drep_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_register_drep_cert_t* register_drep_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_register_drep_cert_to_cbor(register_drep_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_register_drep_cert_unref(&register_drep_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_register_drep_cert_to_cbor(
+  const cardano_register_drep_cert_t* register_drep_cert,
+  cardano_cbor_writer_t*              writer);
+
+/**
+ * \brief Serializes a register DRep certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "drep_credential", "coin", "anchor".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_register_drep_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cert or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED  If memory allocation fails.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_register_drep_cert_to_cip116_json(
+  const cardano_register_drep_cert_t* cert,
+  cardano_json_writer_t*              writer);
+
+/**
+ * \brief Retrieves the DRep credential from a DRep registration certificate.
+ *
+ * This function extracts the decentralized representative's credential from the specified
+ * \ref cardano_register_drep_cert_t object. This credential is used to identify the DRep
+ * within the Cardano network.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_register_drep_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_credential_t object containing the DRep credential. If the certificate
+ *         is NULL or does not contain a DRep credential, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_register_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_credential_t* drep_credential = cardano_register_drep_cert_get_credential(certificate);
+ *
+ * if (drep_credential != NULL)
+ * {
+ *   // Process the DRep credential
+ *   // Note: The credential does not need to be freed; it is managed within the certificate object
+ * }
+ * else
+ * {
+ *   printf("No DRep credential is set for this certificate.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_register_drep_cert_get_credential(cardano_register_drep_cert_t* certificate);
+
+/**
+ * \brief Sets the DRep credential for a DRep registration certificate.
+ *
+ * This function updates the DRep credential in a \ref cardano_register_drep_cert_t object with the provided
+ * \ref cardano_credential_t. The DRep credential identifies the decentralized representative within the Cardano network.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_register_drep_cert_t object to which the credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the new DRep credential.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the DRep credential
+ *         was successfully updated, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_register_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_register_drep_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DRep credential updated successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to update DRep credential.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_register_drep_cert_set_credential(cardano_register_drep_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the deposit amount from a DRep registration certificate.
+ *
+ * This function fetches the deposit amount specified in a \ref cardano_register_drep_cert_t object.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_register_drep_cert_t object.
+ *
+ * \return The deposit amount in lovelace (1 ADA = 1,000,000 lovelace). If the certificate is NULL, this function will
+ *         return 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_register_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t deposit = cardano_register_drep_cert_get_deposit(certificate);
+ *
+ * if (deposit > 0)
+ * {
+ *   printf("Deposit amount: %lu lovelace\n", deposit);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve deposit amount.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_register_drep_cert_get_deposit(const cardano_register_drep_cert_t* certificate);
+
+/**
+ * \brief Sets the deposit amount in a DRep registration certificate.
+ *
+ * This function assigns a new deposit amount to a \ref cardano_register_drep_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_register_drep_cert_t object which will have its deposit updated.
+ * \param[in] deposit The deposit amount in lovelace (1 ADA = 1,000,000 lovelace) to be set in the certificate.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the deposit was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         certificate pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_register_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t deposit = 1000000; // Set deposit to 1 ADA
+ *
+ * cardano_error_t result = cardano_register_drep_cert_set_deposit(certificate, deposit);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Deposit amount set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the deposit amount.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_register_drep_cert_set_deposit(cardano_register_drep_cert_t* certificate, uint64_t deposit);
+
+/**
+ * \brief Retrieves the anchor from a DRep registration certificate.
+ *
+ * This function extracts the anchor from the specified \ref cardano_register_drep_cert_t object.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_register_drep_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_anchor_t object containing the anchor. If the certificate is NULL or
+ *         if the anchor is not set, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_register_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_anchor_t* anchor = cardano_register_drep_cert_get_anchor(certificate);
+ *
+ * if (anchor != NULL)
+ * {
+ *   // Process the anchor
+ *   printf("Anchor retrieved successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("No anchor set for this certificate.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_anchor_t* cardano_register_drep_cert_get_anchor(cardano_register_drep_cert_t* certificate);
+
+/**
+ * \brief Sets the anchor for a DRep registration certificate.
+ *
+ * This function updates the anchor in the specified \ref cardano_register_drep_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_register_drep_cert_t object
+ *                        which will receive the updated anchor.
+ * \param[in] anchor A pointer to an initialized \ref cardano_anchor_t object that represents
+ *                   the new anchor. This function copies the anchor into the certificate.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the anchor was successfully updated, or an appropriate error code indicating the
+ *         failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_register_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_anchor_t* anchor = ...; // Assume anchor is already initialized
+ *
+ * cardano_error_t result = cardano_register_drep_cert_set_anchor(certificate, anchor);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Anchor set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the anchor.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_register_drep_cert_set_anchor(cardano_register_drep_cert_t* certificate, cardano_anchor_t* anchor);
+
+/**
+ * \brief Decrements the reference count of a cardano_register_drep_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_register_drep_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the register_drep_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] register_drep_cert A pointer to the pointer of the register_drep_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_register_drep_cert_t* register_drep_cert = cardano_register_drep_cert_new(major, minor);
+ *
+ * // Perform operations with the register_drep_cert...
+ *
+ * cardano_register_drep_cert_unref(&register_drep_cert);
+ * // At this point, register_drep_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_register_drep_cert_unref, the pointer to the \ref cardano_register_drep_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_register_drep_cert_unref(cardano_register_drep_cert_t** register_drep_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_register_drep_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_register_drep_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_register_drep_cert_unref.
+ *
+ * \param register_drep_cert A pointer to the cardano_register_drep_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming register_drep_cert is a previously created register_drep_cert object
+ *
+ * cardano_register_drep_cert_ref(register_drep_cert);
+ *
+ * // Now register_drep_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_register_drep_cert_ref there is a corresponding
+ * call to \ref cardano_register_drep_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_register_drep_cert_ref(cardano_register_drep_cert_t* register_drep_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_register_drep_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_register_drep_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_register_drep_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param register_drep_cert A pointer to the cardano_register_drep_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_register_drep_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_register_drep_cert_ref call is matched with a
+ * \ref cardano_register_drep_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming register_drep_cert is a previously created register_drep_cert object
+ *
+ * size_t ref_count = cardano_register_drep_cert_refcount(register_drep_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_register_drep_cert_refcount(const cardano_register_drep_cert_t* register_drep_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_register_drep_cert_t object.
+ *
+ * Records an error message in the register_drep_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] register_drep_cert A pointer to the \ref cardano_register_drep_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the register_drep_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_register_drep_cert_set_last_error(
+  cardano_register_drep_cert_t* register_drep_cert,
+  const char*                   message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific register_drep_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_register_drep_cert_set_last_error for the given
+ * register_drep_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] register_drep_cert A pointer to the \ref cardano_register_drep_cert_t instance whose last error
+ *                   message is to be retrieved. If the register_drep_cert is NULL, the function
+ *                   returns a generic error message indicating the null register_drep_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified register_drep_cert. If the register_drep_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_register_drep_cert_set_last_error for the same register_drep_cert, or until
+ *       the register_drep_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_register_drep_cert_get_last_error(
+  const cardano_register_drep_cert_t* register_drep_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_register_drep_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_register_drep_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_register_drep_cert_deep_clone(const cardano_register_drep_cert_t* source, cardano_register_drep_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // REGISTER_DREP_CERT_H
diff --git a/vendor/include/cardano/certs/registration_cert.h b/vendor/include/cardano/certs/registration_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/registration_cert.h
@@ -0,0 +1,485 @@
+/**
+ * \file registration_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef REGISTRATION_CERT_H
+#define REGISTRATION_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used when an individual wants to register as a stakeholder.
+ * It allows the holder to participate in the staking process by delegating their
+ * stake or creating a stake pool.
+ *
+ * This certificate also provides the ability to specify the deposit amount.
+ *
+ * Deposit must match the expected deposit amount specified by `ppKeyDepositL` in
+ * the protocol parameters.
+ *
+ * \remark Replaces the deprecated `StakeRegistration` in after Conway era.
+ */
+typedef struct cardano_registration_cert_t cardano_registration_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new registration certificate.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_registration_cert_t,
+ * which represents a registration certificate in the Cardano blockchain. This certificate is used
+ * to register a stake credential, along with specifying the required deposit.
+ *
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the stake credential.
+ * \param[in] deposit The amount of the deposit that must match the expected deposit amount specified by the
+ *                    protocol parameters (ppKeyDepositL).
+ * \param[out] registration_cert On successful initialization, this will point to a newly created
+ *                               \ref cardano_registration_cert_t object. The caller is responsible for managing
+ *                               the lifecycle of this object. Specifically, once the registration certificate
+ *                               is no longer needed, the caller must release it by calling \ref cardano_registration_cert_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the registration certificate was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ * uint64_t deposit = 5000000; // Deposit amount in lovelace
+ *
+ * cardano_registration_cert_t* registration_cert = NULL;
+ * cardano_error_t result = cardano_registration_cert_new(credential, deposit, &registration_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The registration certificate is now ready to be used
+ *   // Remember to free the certificate when done
+ *   cardano_registration_cert_unref(&registration_cert);
+ * }
+ * else
+ * {
+ *   printf("Failed to create registration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_registration_cert_new(
+  cardano_credential_t*         credential,
+  uint64_t                      deposit,
+  cardano_registration_cert_t** registration_cert);
+
+/**
+ * \brief Creates a \ref cardano_registration_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_registration_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a registration_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] registration_cert A pointer to a pointer of \ref cardano_registration_cert_t that will be set to the address
+ *                        of the newly created registration_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_registration_cert_t object by calling
+ *       \ref cardano_registration_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_registration_cert_t* registration_cert = NULL;
+ *
+ * cardano_error_t result = cardano_registration_cert_from_cbor(reader, &registration_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the registration_cert
+ *
+ *   // Once done, ensure to clean up and release the registration_cert
+ *   cardano_registration_cert_unref(&registration_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode registration_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_registration_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_registration_cert_t** registration_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_registration_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] registration_cert A constant pointer to the \ref cardano_registration_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p registration_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_registration_cert_t* registration_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_registration_cert_to_cbor(registration_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_registration_cert_unref(&registration_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_registration_cert_to_cbor(
+  const cardano_registration_cert_t* registration_cert,
+  cardano_cbor_writer_t*             writer);
+
+/**
+ * \brief Serializes a registration certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "credential", "coin".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_registration_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cert or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_registration_cert_to_cip116_json(
+  const cardano_registration_cert_t* cert,
+  cardano_json_writer_t*             writer);
+
+/**
+ * \brief Retrieves the stake credential from a registration certificate.
+ *
+ * This function extracts the stake credential associated with a given \ref cardano_registration_cert_t object.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_registration_cert_t object from which
+ *                        the stake credential will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_credential_t object containing the stake credential. If the input
+ *         certificate is NULL, or if the stake credential is not set, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_registration_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_credential_t* credential = cardano_registration_cert_get_stake_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the stake credential
+ * }
+ * else
+ * {
+ *   printf("No stake credential is set in the certificate.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_registration_cert_get_stake_credential(cardano_registration_cert_t* certificate);
+
+/**
+ * \brief Sets the stake credential for a registration certificate.
+ *
+ * This function assigns a stake credential to a given \ref cardano_registration_cert_t object.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_registration_cert_t object to which the stake credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the stake credential.
+ *                        This function increments the reference count of the credential, so it remains valid even after the caller releases its own reference.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the stake credential was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_registration_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_registration_cert_set_stake_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The stake credential is now set for the certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to set the stake credential: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up: Release references when they are no longer needed
+ * cardano_credential_unref(&credential);
+ * \endcode
+ *
+ * \note The caller must manage the lifecycle of both the certificate and the newly referenced credential.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_registration_cert_set_stake_credential(cardano_registration_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the deposit amount from a registration certificate.
+ *
+ * This function extracts the deposit amount specified in a \ref cardano_registration_cert_t object.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_registration_cert_t object.
+ *
+ * \return The deposit amount associated with the registration certificate. If the certificate pointer is NULL,
+ *         the behavior is undefined, and it may cause a crash. It is the caller's responsibility to ensure
+ *         that the certificate is properly initialized.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_registration_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t deposit = cardano_registration_cert_get_deposit(certificate);
+ *
+ * printf("The registration deposit is: %llu ADA\n", deposit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_registration_cert_get_deposit(const cardano_registration_cert_t* certificate);
+
+/**
+ * \brief Sets the deposit amount for a registration certificate.
+ *
+ * This function updates the deposit amount in a \ref cardano_registration_cert_t object. The deposit is required when
+ * registering a new stake credential and is specified by the protocol parameters.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_registration_cert_t object to which the deposit will be set.
+ * \param[in] deposit The deposit amount to be set in lovelaces (1 ADA = 1,000,000 lovelaces).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the deposit was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the certificate pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_registration_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t deposit = 2000000; // Example deposit amount
+ *
+ * cardano_error_t result = cardano_registration_cert_set_deposit(certificate, deposit);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Deposit successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set deposit.\n");
+ * }
+ * \endcode
+ *
+ * \note It is the caller's responsibility to ensure that the certificate is properly initialized before calling this function.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_registration_cert_set_deposit(cardano_registration_cert_t* certificate, uint64_t deposit);
+
+/**
+ * \brief Decrements the reference count of a cardano_registration_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_registration_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the registration_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] registration_cert A pointer to the pointer of the registration_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_registration_cert_t* registration_cert = cardano_registration_cert_new(major, minor);
+ *
+ * // Perform operations with the registration_cert...
+ *
+ * cardano_registration_cert_unref(&registration_cert);
+ * // At this point, registration_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_registration_cert_unref, the pointer to the \ref cardano_registration_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_registration_cert_unref(cardano_registration_cert_t** registration_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_registration_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_registration_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_registration_cert_unref.
+ *
+ * \param registration_cert A pointer to the cardano_registration_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming registration_cert is a previously created registration_cert object
+ *
+ * cardano_registration_cert_ref(registration_cert);
+ *
+ * // Now registration_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_registration_cert_ref there is a corresponding
+ * call to \ref cardano_registration_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_registration_cert_ref(cardano_registration_cert_t* registration_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_registration_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_registration_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_registration_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param registration_cert A pointer to the cardano_registration_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_registration_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_registration_cert_ref call is matched with a
+ * \ref cardano_registration_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming registration_cert is a previously created registration_cert object
+ *
+ * size_t ref_count = cardano_registration_cert_refcount(registration_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_registration_cert_refcount(const cardano_registration_cert_t* registration_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_registration_cert_t object.
+ *
+ * Records an error message in the registration_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] registration_cert A pointer to the \ref cardano_registration_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the registration_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_registration_cert_set_last_error(
+  cardano_registration_cert_t* registration_cert,
+  const char*                  message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific registration_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_registration_cert_set_last_error for the given
+ * registration_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] registration_cert A pointer to the \ref cardano_registration_cert_t instance whose last error
+ *                   message is to be retrieved. If the registration_cert is NULL, the function
+ *                   returns a generic error message indicating the null registration_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified registration_cert. If the registration_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_registration_cert_set_last_error for the same registration_cert, or until
+ *       the registration_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_registration_cert_get_last_error(
+  const cardano_registration_cert_t* registration_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_registration_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_registration_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_registration_cert_deep_clone(const cardano_registration_cert_t* source, cardano_registration_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // REGISTRATION_CERT_H
diff --git a/vendor/include/cardano/certs/resign_committee_cold_cert.h b/vendor/include/cardano/certs/resign_committee_cold_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/resign_committee_cold_cert.h
@@ -0,0 +1,484 @@
+/**
+ * \file resign_committee_cold_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RESIGN_COMMITTEE_COLD_CERT_H
+#define RESIGN_COMMITTEE_COLD_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/anchor.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used then a committee member wants to resign early (will be marked on-chain as an expired member).
+ */
+typedef struct cardano_resign_committee_cold_cert_t cardano_resign_committee_cold_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new resignation certificate for a committee cold key.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_resign_committee_cold_cert_t.
+ *
+ * \param[in] committee_cold_cred A pointer to an initialized \ref cardano_credential_t object representing the committee's cold credential.
+ * \param[in] anchor A pointer to an initialized \ref cardano_anchor_t object associated with the resignation.
+ * \param[out] resign_committee_cold_cert On successful execution, this will point to a newly created \ref cardano_resign_committee_cold_cert_t object.
+ *                                        The caller is responsible for managing the lifecycle of this object, including releasing it
+ *                                        when it is no longer needed using the appropriate unref function.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* committee_cold_cred = ...; // Assume committee_cold_cred is already initialized
+ * cardano_anchor_t* anchor = ...; // Assume anchor is already initialized
+ * cardano_resign_committee_cold_cert_t* resign_committee_cold_cert = NULL;
+ *
+ * cardano_error_t result = cardano_resign_committee_cold_cert_new(committee_cold_cred, anchor, &resign_committee_cold_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The resign committee cold certificate can now be used for transaction signing or other purposes
+ *   // Remember to free the certificate when done
+ *   cardano_resign_committee_cold_cert_unref(&resign_committee_cold_cert);
+ * }
+ * else
+ * {
+ *   printf("Failed to create resign committee cold certificate: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_resign_committee_cold_cert_new(
+  cardano_credential_t*                  committee_cold_cred,
+  cardano_anchor_t*                      anchor,
+  cardano_resign_committee_cold_cert_t** resign_committee_cold_cert);
+
+/**
+ * \brief Creates a \ref cardano_resign_committee_cold_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_resign_committee_cold_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a resign_committee_cold.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] resign_committee_cold A pointer to a pointer of \ref cardano_resign_committee_cold_cert_t that will be set to the address
+ *                        of the newly created resign_committee_cold object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_resign_committee_cold_cert_t object by calling
+ *       \ref cardano_resign_committee_cold_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_resign_committee_cold_cert_t* resign_committee_cold = NULL;
+ *
+ * cardano_error_t result = cardano_resign_committee_cold_cert_from_cbor(reader, &resign_committee_cold);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the resign_committee_cold
+ *
+ *   // Once done, ensure to clean up and release the resign_committee_cold
+ *   cardano_resign_committee_cold_cert_unref(&resign_committee_cold);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode resign_committee_cold: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_resign_committee_cold_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_resign_committee_cold_cert_t** resign_committee_cold);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_resign_committee_cold_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] resign_committee_cold A constant pointer to the \ref cardano_resign_committee_cold_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p resign_committee_cold or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_resign_committee_cold_cert_t* resign_committee_cold = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_resign_committee_cold_cert_to_cbor(resign_committee_cold, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_resign_committee_cold_cert_unref(&resign_committee_cold);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_resign_committee_cold_cert_to_cbor(
+  const cardano_resign_committee_cold_cert_t* resign_committee_cold,
+  cardano_cbor_writer_t*                      writer);
+
+/**
+ * \brief Serializes a committee cold resignation certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "committee_cold_credential", "anchor".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_resign_committee_cold_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cert or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_resign_committee_cold_cert_to_cip116_json(
+  const cardano_resign_committee_cold_cert_t* cert,
+  cardano_json_writer_t*                      writer);
+
+/**
+ * \brief Retrieves the committee cold credential from a resignation certificate.
+ *
+ * This function extracts the committee's cold credential from a \ref cardano_resign_committee_cold_cert_t object.
+ * The returned credential is a reference counted object, and the caller is responsible for releasing it
+ * using \ref cardano_credential_unref when it is no longer needed.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_resign_committee_cold_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_credential_t object containing the committee's cold credential.
+ *         If the certificate is NULL or if the credential is not set, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_resign_committee_cold_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = cardano_resign_committee_cold_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the credential
+ *   cardano_credential_unref(&credential); // Remember to unref the credential when done
+ * }
+ * else
+ * {
+ *   printf("No credential is set for this certificate.\n");
+ * }
+ * \endcode
+ *
+ * \note This function increments the reference count of the returned credential. The caller must ensure to unref it to avoid memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_resign_committee_cold_cert_get_credential(cardano_resign_committee_cold_cert_t* certificate);
+
+/**
+ * \brief Sets the committee cold credential in a resignation certificate.
+ *
+ * This function assigns a new committee cold credential to a given \ref cardano_resign_committee_cold_cert_t object.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_resign_committee_cold_cert_t object to which the credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the committee's cold credential.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the committee cold credential was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_resign_committee_cold_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_resign_committee_cold_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The credential is now set for the certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to set the committee's cold credential.\n");
+ * }
+ * // Both objects need to be managed and eventually unreferenced by the caller
+ * cardano_credential_unref(&credential);
+ * cardano_resign_committee_cold_cert_unref(&certificate);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_resign_committee_cold_cert_set_credential(cardano_resign_committee_cold_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the anchor associated with a resignation committee cold certificate.
+ *
+ * This function returns the anchor used in a \ref cardano_resign_committee_cold_cert_t object.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_resign_committee_cold_cert_t object.
+ *
+ * \return A pointer to a \ref cardano_anchor_t object representing the anchor. If the certificate is NULL or does not have an anchor set,
+ *         this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_resign_committee_cold_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_anchor_t* anchor = cardano_resign_committee_cold_cert_get_anchor(certificate);
+ *
+ * if (anchor != NULL)
+ * {
+ *   // Process the anchor information
+ * }
+ * else
+ * {
+ *   printf("No anchor is set for this certificate.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_anchor_t* cardano_resign_committee_cold_cert_get_anchor(cardano_resign_committee_cold_cert_t* certificate);
+
+/**
+ * \brief Sets the anchor for a resignation committee cold certificate.
+ *
+ * This function assigns a new anchor to a given \ref cardano_resign_committee_cold_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_resign_committee_cold_cert_t object to which the anchor will be set.
+ * \param[in] anchor A pointer to an initialized \ref cardano_anchor_t object representing the new anchor. This function
+ *                    increases the reference count on the anchor, and the certificate will maintain its own reference
+ *                    to the anchor.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the anchor
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_resign_committee_cold_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_anchor_t* new_anchor = ...; // Assume new_anchor is already initialized
+ *
+ * cardano_error_t result = cardano_resign_committee_cold_cert_set_anchor(certificate, new_anchor);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Anchor set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the anchor.\n");
+ * }
+ *
+ * // Both certificate and new_anchor need their own unref calls when no longer needed
+ * \endcode
+ *
+ * \note This function increments the reference count of the anchor object passed to it. It is the caller's responsibility
+ *       to manage the lifecycle of both the certificate and the anchor.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_resign_committee_cold_cert_set_anchor(cardano_resign_committee_cold_cert_t* certificate, cardano_anchor_t* anchor);
+
+/**
+ * \brief Decrements the reference count of a cardano_resign_committee_cold_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_resign_committee_cold_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the resign_committee_cold is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] resign_committee_cold A pointer to the pointer of the resign_committee_cold object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_resign_committee_cold_cert_t* resign_committee_cold = cardano_resign_committee_cold_cert_new(major, minor);
+ *
+ * // Perform operations with the resign_committee_cold...
+ *
+ * cardano_resign_committee_cold_cert_unref(&resign_committee_cold);
+ * // At this point, resign_committee_cold is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_resign_committee_cold_cert_unref, the pointer to the \ref cardano_resign_committee_cold_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_resign_committee_cold_cert_unref(cardano_resign_committee_cold_cert_t** resign_committee_cold);
+
+/**
+ * \brief Increases the reference count of the cardano_resign_committee_cold_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_resign_committee_cold_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_resign_committee_cold_cert_unref.
+ *
+ * \param resign_committee_cold A pointer to the cardano_resign_committee_cold_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming resign_committee_cold is a previously created resign_committee_cold object
+ *
+ * cardano_resign_committee_cold_cert_ref(resign_committee_cold);
+ *
+ * // Now resign_committee_cold can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_resign_committee_cold_cert_ref there is a corresponding
+ * call to \ref cardano_resign_committee_cold_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_resign_committee_cold_cert_ref(cardano_resign_committee_cold_cert_t* resign_committee_cold);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_resign_committee_cold_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_resign_committee_cold_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_resign_committee_cold_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param resign_committee_cold A pointer to the cardano_resign_committee_cold_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_resign_committee_cold_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_resign_committee_cold_cert_ref call is matched with a
+ * \ref cardano_resign_committee_cold_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming resign_committee_cold is a previously created resign_committee_cold object
+ *
+ * size_t ref_count = cardano_resign_committee_cold_cert_refcount(resign_committee_cold);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_resign_committee_cold_cert_refcount(const cardano_resign_committee_cold_cert_t* resign_committee_cold);
+
+/**
+ * \brief Sets the last error message for a given cardano_resign_committee_cold_cert_t object.
+ *
+ * Records an error message in the resign_committee_cold's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] resign_committee_cold A pointer to the \ref cardano_resign_committee_cold_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the resign_committee_cold's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_resign_committee_cold_cert_set_last_error(
+  cardano_resign_committee_cold_cert_t* resign_committee_cold,
+  const char*                           message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific resign_committee_cold.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_resign_committee_cold_cert_set_last_error for the given
+ * resign_committee_cold. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] resign_committee_cold A pointer to the \ref cardano_resign_committee_cold_cert_t instance whose last error
+ *                   message is to be retrieved. If the resign_committee_cold is NULL, the function
+ *                   returns a generic error message indicating the null resign_committee_cold.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified resign_committee_cold. If the resign_committee_cold is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_resign_committee_cold_cert_set_last_error for the same resign_committee_cold, or until
+ *       the resign_committee_cold is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_resign_committee_cold_cert_get_last_error(
+  const cardano_resign_committee_cold_cert_t* resign_committee_cold);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_resign_committee_cold_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_resign_committee_cold_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_resign_committee_cold_cert_deep_clone(const cardano_resign_committee_cold_cert_t* source, cardano_resign_committee_cold_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // RESIGN_COMMITTEE_COLD_CERT_H
diff --git a/vendor/include/cardano/certs/stake_delegation_cert.h b/vendor/include/cardano/certs/stake_delegation_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/stake_delegation_cert.h
@@ -0,0 +1,496 @@
+/**
+ * \file stake_delegation_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef STAKE_DELEGATION_CERT_H
+#define STAKE_DELEGATION_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used when a stakeholder wants to delegate their stake to a
+ * specific stake pool. It includes the stake pool id to which the stake is delegated.
+ */
+typedef struct cardano_stake_delegation_cert_t cardano_stake_delegation_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new stake delegation certificate.
+ *
+ * This function allocates and initializes a new \ref cardano_stake_delegation_cert_t object that represents
+ * a stake delegation from a given credential to a specified staking pool.
+ *
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the staker's credential.
+ * \param[in] pool_key_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the hash of the pool's
+ *                          public key to which the stake is being delegated.
+ * \param[out] stake_delegation On successful execution, this will point to a newly created \ref cardano_stake_delegation_cert_t
+ *                              object. The caller is responsible for releasing this resource using \ref cardano_stake_delegation_cert_unref
+ *                              when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the stake delegation
+ *         certificate was successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ * cardano_blake2b_hash_t* pool_key_hash = ...; // Assume pool_key_hash is already initialized
+ * cardano_stake_delegation_cert_t* stake_delegation = NULL;
+ *
+ * cardano_error_t result = cardano_stake_delegation_cert_new(credential, pool_key_hash, &stake_delegation);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The stake delegation certificate can now be used for delegation operations
+ *   // Remember to free the certificate when done
+ *   cardano_stake_delegation_cert_unref(&stake_delegation);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake delegation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_credential_unref(&credential); // Cleanup the credential
+ * cardano_blake2b_hash_unref(&pool_key_hash); // Cleanup the pool key hash
+ * \endcode
+ *
+ * \note This function increments the reference count of the credential and pool key hash objects passed to it.
+ *       It is the caller's responsibility to manage the lifecycle of both the certificate and the input objects,
+ *       ensuring that each is released when no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_delegation_cert_new(
+  cardano_credential_t*             credential,
+  cardano_blake2b_hash_t*           pool_key_hash,
+  cardano_stake_delegation_cert_t** stake_delegation);
+
+/**
+ * \brief Creates a \ref cardano_stake_delegation_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_stake_delegation_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a stake_delegation_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] stake_delegation_cert A pointer to a pointer of \ref cardano_stake_delegation_cert_t that will be set to the address
+ *                        of the newly created stake_delegation_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_stake_delegation_cert_t object by calling
+ *       \ref cardano_stake_delegation_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_stake_delegation_cert_t* stake_delegation_cert = NULL;
+ *
+ * cardano_error_t result = cardano_stake_delegation_cert_from_cbor(reader, &stake_delegation_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the stake_delegation_cert
+ *
+ *   // Once done, ensure to clean up and release the stake_delegation_cert
+ *   cardano_stake_delegation_cert_unref(&stake_delegation_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode stake_delegation_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_delegation_cert_t** stake_delegation_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_stake_delegation_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] stake_delegation_cert A constant pointer to the \ref cardano_stake_delegation_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p stake_delegation_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_delegation_cert_t* stake_delegation_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_stake_delegation_cert_to_cbor(stake_delegation_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_stake_delegation_cert_unref(&stake_delegation_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_stake_delegation_cert_to_cbor(
+  const cardano_stake_delegation_cert_t* stake_delegation_cert,
+  cardano_cbor_writer_t*                 writer);
+
+/**
+ * \brief Serializes a stake delegation certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "credential", "pool_keyhash".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_stake_delegation_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p cert or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_delegation_cert_to_cip116_json(
+  const cardano_stake_delegation_cert_t* cert,
+  cardano_json_writer_t*                 writer);
+
+/**
+ * \brief Retrieves the credential from a stake delegation certificate.
+ *
+ * This function fetches the credential associated with a given \ref cardano_stake_delegation_cert_t object.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_delegation_cert_t object from which the
+ *                        credential is to be retrieved.
+ *
+ * \return A pointer to the \ref cardano_credential_t object containing the staker's credential. If the certificate is NULL
+ *         or does not contain a valid credential, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_credential_t* credential = cardano_stake_delegation_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the retrieved credential
+ *   // No need to unref the returned credential, as it is managed by the certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve credential from stake delegation certificate.\n");
+ * }
+ * \endcode
+ *
+ * \note This function increments the reference count of the credential passed to it.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_stake_delegation_cert_get_credential(cardano_stake_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the credential for a stake delegation certificate.
+ *
+ * This function assigns a new credential to a given \ref cardano_stake_delegation_cert_t object.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_stake_delegation_cert_t object to which the credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the staker's credential.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the credential was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_stake_delegation_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Credential successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the credential.\n");
+ * }
+ *
+ * \endcode
+ *
+ * \note This function increments the reference count of the credential. The caller is responsible for maintaining
+ *       the original credential and releasing its reference appropriately. The certificate will maintain its own
+ *       reference to the credential once set.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_delegation_cert_set_credential(cardano_stake_delegation_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the pool key hash from a stake delegation certificate.
+ *
+ * This function extracts the pool key hash from the specified \ref cardano_stake_delegation_cert_t object.
+ * The pool key hash uniquely identifies the staking pool to which the stake rights are delegated.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_delegation_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_blake2b_hash_t object containing the pool key hash. If the certificate is NULL or
+ *         if the pool key hash is not set, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_blake2b_hash_t* pool_key_hash = cardano_stake_delegation_cert_get_pool_key_hash(certificate);
+ *
+ * if (pool_key_hash != NULL)
+ * {
+ *   // Process the pool key hash
+ *   cardano_blake2b_hash_unref(&pool_key_hash);
+ * }
+ * \endcode
+ *
+ * \note Since this function returns a reference, it must be unreferenced by the caller to prevent memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_stake_delegation_cert_get_pool_key_hash(cardano_stake_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the pool key hash for a stake delegation certificate.
+ *
+ * This function assigns a new pool key hash to a given \ref cardano_stake_delegation_cert_t object.
+ * The pool key hash uniquely identifies the staking pool to which the stake rights are delegated.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_stake_delegation_cert_t object to which the pool key hash will be set.
+ * \param[in] hash A constant pointer to an initialized \ref cardano_blake2b_hash_t object representing the new pool key hash.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool key hash was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_blake2b_hash_t* pool_key_hash = ...; // Assume pool_key_hash is already initialized
+ *
+ * cardano_error_t result = cardano_stake_delegation_cert_set_pool_key_hash(certificate, pool_key_hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The pool key hash is now set for the stake delegation certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to set the pool key hash.\n");
+ * }
+ * \endcode
+ *
+ * \note This function takes a reference of the pool key hash; therefore, the caller must ensure
+ *       that the hash remains valid and manage its lifecycle appropriately. The certificate
+ *       will internally manage its own reference to the hash.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_delegation_cert_set_pool_key_hash(cardano_stake_delegation_cert_t* certificate, cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Decrements the reference count of a cardano_stake_delegation_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_stake_delegation_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the stake_delegation_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] stake_delegation_cert A pointer to the pointer of the stake_delegation_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_delegation_cert_t* stake_delegation_cert = cardano_stake_delegation_cert_new(major, minor);
+ *
+ * // Perform operations with the stake_delegation_cert...
+ *
+ * cardano_stake_delegation_cert_unref(&stake_delegation_cert);
+ * // At this point, stake_delegation_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_stake_delegation_cert_unref, the pointer to the \ref cardano_stake_delegation_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_stake_delegation_cert_unref(cardano_stake_delegation_cert_t** stake_delegation_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_stake_delegation_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_stake_delegation_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_stake_delegation_cert_unref.
+ *
+ * \param stake_delegation_cert A pointer to the cardano_stake_delegation_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_delegation_cert is a previously created stake_delegation_cert object
+ *
+ * cardano_stake_delegation_cert_ref(stake_delegation_cert);
+ *
+ * // Now stake_delegation_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_stake_delegation_cert_ref there is a corresponding
+ * call to \ref cardano_stake_delegation_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_stake_delegation_cert_ref(cardano_stake_delegation_cert_t* stake_delegation_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_stake_delegation_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_stake_delegation_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_stake_delegation_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param stake_delegation_cert A pointer to the cardano_stake_delegation_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_stake_delegation_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_stake_delegation_cert_ref call is matched with a
+ * \ref cardano_stake_delegation_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_delegation_cert is a previously created stake_delegation_cert object
+ *
+ * size_t ref_count = cardano_stake_delegation_cert_refcount(stake_delegation_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_stake_delegation_cert_refcount(const cardano_stake_delegation_cert_t* stake_delegation_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_stake_delegation_cert_t object.
+ *
+ * Records an error message in the stake_delegation_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] stake_delegation_cert A pointer to the \ref cardano_stake_delegation_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the stake_delegation_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_stake_delegation_cert_set_last_error(
+  cardano_stake_delegation_cert_t* stake_delegation_cert,
+  const char*                      message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific stake_delegation_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_stake_delegation_cert_set_last_error for the given
+ * stake_delegation_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] stake_delegation_cert A pointer to the \ref cardano_stake_delegation_cert_t instance whose last error
+ *                   message is to be retrieved. If the stake_delegation_cert is NULL, the function
+ *                   returns a generic error message indicating the null stake_delegation_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified stake_delegation_cert. If the stake_delegation_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_stake_delegation_cert_set_last_error for the same stake_delegation_cert, or until
+ *       the stake_delegation_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_stake_delegation_cert_get_last_error(
+  const cardano_stake_delegation_cert_t* stake_delegation_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_stake_delegation_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_stake_delegation_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_stake_delegation_cert_deep_clone(const cardano_stake_delegation_cert_t* source, cardano_stake_delegation_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // STAKE_DELEGATION_CERT_H
diff --git a/vendor/include/cardano/certs/stake_deregistration_cert.h b/vendor/include/cardano/certs/stake_deregistration_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/stake_deregistration_cert.h
@@ -0,0 +1,420 @@
+/**
+ * \file stake_deregistration_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef STAKE_DEREGISTRATION_CERT_H
+#define STAKE_DEREGISTRATION_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used when a stakeholder no longer wants to participate in
+ * staking. It revokes the stake registration and the associated stake is no
+ * longer counted when calculating stake pool rewards.
+ */
+typedef struct cardano_stake_deregistration_cert_t cardano_stake_deregistration_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new stake deregistration certificate.
+ *
+ * This function allocates and initializes a new \ref cardano_stake_deregistration_cert_t object.
+ * Stake deregistration certificates are used to deregister a staking credential from the Cardano network.
+ *
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object that represents
+ *                       the staking credential to be deregistered.
+ * \param[out] stake_deregistration On successful execution, this will point to a newly created
+ *                                  \ref cardano_stake_deregistration_cert_t object. The caller is responsible
+ *                                  for releasing this resource using \ref cardano_stake_deregistration_cert_unref
+ *                                  when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate
+ *         was successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any input pointers are NULL).
+ *
+ * \note This function increments the reference count of the credential passed to it.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...;  // Assume credential is already initialized
+ * cardano_stake_deregistration_cert_t* stake_deregistration = NULL;
+ * cardano_error_t result = cardano_stake_deregistration_cert_new(credential, &stake_deregistration);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The stake deregistration certificate can now be used for deregistering the stake
+ *   // Remember to free the stake_deregistration when done
+ *   cardano_stake_deregistration_cert_unref(&stake_deregistration);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake deregistration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_deregistration_cert_new(
+  cardano_credential_t*                 credential,
+  cardano_stake_deregistration_cert_t** stake_deregistration);
+
+/**
+ * \brief Creates a \ref cardano_stake_deregistration_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_stake_deregistration_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a stake_deregistration.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] stake_deregistration A pointer to a pointer of \ref cardano_stake_deregistration_cert_t that will be set to the address
+ *                        of the newly created stake_deregistration object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_stake_deregistration_cert_t object by calling
+ *       \ref cardano_stake_deregistration_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_stake_deregistration_cert_t* stake_deregistration = NULL;
+ *
+ * cardano_error_t result = cardano_stake_deregistration_cert_from_cbor(reader, &stake_deregistration);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the stake_deregistration
+ *
+ *   // Once done, ensure to clean up and release the stake_deregistration
+ *   cardano_stake_deregistration_cert_unref(&stake_deregistration);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode stake_deregistration: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_deregistration_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_deregistration_cert_t** stake_deregistration);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_stake_deregistration_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] stake_deregistration A constant pointer to the \ref cardano_stake_deregistration_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p stake_deregistration or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_deregistration_cert_t* stake_deregistration = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_stake_deregistration_cert_to_cbor(stake_deregistration, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_stake_deregistration_cert_unref(&stake_deregistration);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_stake_deregistration_cert_to_cbor(
+  const cardano_stake_deregistration_cert_t* stake_deregistration,
+  cardano_cbor_writer_t*                     writer);
+
+/**
+ * \brief Serializes a stake deregistration certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "credential".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_stake_deregistration_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cert or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_stake_deregistration_cert_to_cip116_json(
+  const cardano_stake_deregistration_cert_t* cert,
+  cardano_json_writer_t*                     writer);
+
+/**
+ * \brief Retrieves the credential associated with a stake deregistration certificate.
+ *
+ * This function extracts the credential from the specified \ref cardano_stake_deregistration_cert_t object.
+ * The credential represents the staking identifier that was intended to be deregistered from the Cardano network.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_deregistration_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_credential_t object containing the credential. If the certificate is NULL,
+ *         this function returns NULL. The returned credential object has its reference count increased and it is
+ *         the caller's responsibility to release this reference using \ref cardano_credential_unref when it is
+ *         no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_deregistration_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_credential_t* credential = cardano_stake_deregistration_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_stake_deregistration_cert_get_credential(cardano_stake_deregistration_cert_t* certificate);
+
+/**
+ * \brief Sets the credential for a stake deregistration certificate.
+ *
+ * This function assigns a new credential to a given \ref cardano_stake_deregistration_cert_t object. The credential
+ * represents the staking identifier that is intended to be deregistered from the Cardano network.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_stake_deregistration_cert_t object to which the credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the new credential.
+ *                       This function increments the reference count of the credential, and it will be managed by the
+ *                       certificate object thereafter.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the credential
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_deregistration_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_stake_deregistration_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The credential is now set for the stake deregistration certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to set the credential.\n");
+ * }
+ *
+ * // Remember to manage the lifecycle of the objects properly
+ * cardano_credential_unref(&credential);
+ * cardano_stake_deregistration_cert_unref(&certificate);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_deregistration_cert_set_credential(cardano_stake_deregistration_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Decrements the reference count of a cardano_stake_deregistration_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_stake_deregistration_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the stake_deregistration is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] stake_deregistration A pointer to the pointer of the stake_deregistration object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_deregistration_cert_t* stake_deregistration = cardano_stake_deregistration_cert_new(major, minor);
+ *
+ * // Perform operations with the stake_deregistration...
+ *
+ * cardano_stake_deregistration_cert_unref(&stake_deregistration);
+ * // At this point, stake_deregistration is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_stake_deregistration_cert_unref, the pointer to the \ref cardano_stake_deregistration_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_stake_deregistration_cert_unref(cardano_stake_deregistration_cert_t** stake_deregistration);
+
+/**
+ * \brief Increases the reference count of the cardano_stake_deregistration_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_stake_deregistration_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_stake_deregistration_cert_unref.
+ *
+ * \param stake_deregistration A pointer to the cardano_stake_deregistration_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_deregistration is a previously created stake_deregistration object
+ *
+ * cardano_stake_deregistration_cert_ref(stake_deregistration);
+ *
+ * // Now stake_deregistration can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_stake_deregistration_cert_ref there is a corresponding
+ * call to \ref cardano_stake_deregistration_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_stake_deregistration_cert_ref(cardano_stake_deregistration_cert_t* stake_deregistration);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_stake_deregistration_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_stake_deregistration_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_stake_deregistration_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param stake_deregistration A pointer to the cardano_stake_deregistration_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_stake_deregistration_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_stake_deregistration_cert_ref call is matched with a
+ * \ref cardano_stake_deregistration_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_deregistration is a previously created stake_deregistration object
+ *
+ * size_t ref_count = cardano_stake_deregistration_cert_refcount(stake_deregistration);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_stake_deregistration_cert_refcount(const cardano_stake_deregistration_cert_t* stake_deregistration);
+
+/**
+ * \brief Sets the last error message for a given cardano_stake_deregistration_cert_t object.
+ *
+ * Records an error message in the stake_deregistration's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] stake_deregistration A pointer to the \ref cardano_stake_deregistration_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the stake_deregistration's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_stake_deregistration_cert_set_last_error(
+  cardano_stake_deregistration_cert_t* stake_deregistration,
+  const char*                          message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific stake_deregistration.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_stake_deregistration_cert_set_last_error for the given
+ * stake_deregistration. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] stake_deregistration A pointer to the \ref cardano_stake_deregistration_cert_t instance whose last error
+ *                   message is to be retrieved. If the stake_deregistration is NULL, the function
+ *                   returns a generic error message indicating the null stake_deregistration.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified stake_deregistration. If the stake_deregistration is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_stake_deregistration_cert_set_last_error for the same stake_deregistration, or until
+ *       the stake_deregistration is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_stake_deregistration_cert_get_last_error(
+  const cardano_stake_deregistration_cert_t* stake_deregistration);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_stake_deregistration_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_stake_deregistration_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_stake_deregistration_cert_deep_clone(const cardano_stake_deregistration_cert_t* source, cardano_stake_deregistration_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // STAKE_DEREGISTRATION_CERT_H
diff --git a/vendor/include/cardano/certs/stake_registration_cert.h b/vendor/include/cardano/certs/stake_registration_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/stake_registration_cert.h
@@ -0,0 +1,422 @@
+/**
+ * \file stake_registration_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef STAKE_REGISTRATION_CERT_H
+#define STAKE_REGISTRATION_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used when an individual wants to register as a stakeholder.
+ * It allows the holder to participate in the stake process by delegating their
+ * stake or creating a stake pool.
+ */
+typedef struct cardano_stake_registration_cert_t cardano_stake_registration_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new stake registration certificate.
+ *
+ * This function allocates and initializes a new \ref cardano_stake_registration_cert_t object.
+ * Stake registration certificates are used to register a staking credential from the Cardano network.
+ *
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object that represents
+ *                       the staking credential to be registered.
+ * \param[out] stake_registration On successful execution, this will point to a newly created
+ *                                  \ref cardano_stake_registration_cert_t object. The caller is responsible
+ *                                  for releasing this resource using \ref cardano_stake_registration_cert_unref
+ *                                  when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate
+ *         was successfully created, or an error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any input pointers are NULL).
+ *
+ * \note This function increments the reference count of the credential passed to it.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...;  // Assume credential is already initialized
+ * cardano_stake_registration_cert_t* stake_registration = NULL;
+ * cardano_error_t result = cardano_stake_registration_cert_new(credential, &stake_registration);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The stake registration certificate can now be used for registering the stake
+ *   // Remember to free the stake_registration when done
+ *   cardano_stake_registration_cert_unref(&stake_registration);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake registration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_cert_new(
+  cardano_credential_t*               credential,
+  cardano_stake_registration_cert_t** stake_registration);
+
+/**
+ * \brief Creates a \ref cardano_stake_registration_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_stake_registration_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a stake_registration.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] stake_registration A pointer to a pointer of \ref cardano_stake_registration_cert_t that will be set to the address
+ *                        of the newly created stake_registration object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_stake_registration_cert_t object by calling
+ *       \ref cardano_stake_registration_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_stake_registration_cert_t* stake_registration = NULL;
+ *
+ * cardano_error_t result = cardano_stake_registration_cert_from_cbor(reader, &stake_registration);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the stake_registration
+ *
+ *   // Once done, ensure to clean up and release the stake_registration
+ *   cardano_stake_registration_cert_unref(&stake_registration);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode stake_registration: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_registration_cert_t** stake_registration);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_stake_registration_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] stake_registration A constant pointer to the \ref cardano_stake_registration_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p stake_registration or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_registration_cert_t* stake_registration = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_stake_registration_cert_to_cbor(stake_registration, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_stake_registration_cert_unref(&stake_registration);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_stake_registration_cert_to_cbor(
+  const cardano_stake_registration_cert_t* stake_registration,
+  cardano_cbor_writer_t*                   writer);
+
+/**
+ * \brief Serializes a stake registration certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", then "credential".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_stake_registration_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ *         CARDANO_ERROR_POINTER_IS_NULL  If \p cert or \p writer is NULL.
+ *         CARDANO_ERROR_ENCODING         If the certificate is malformed (e.g., missing credential).
+ *         Other                          Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_cert_to_cip116_json(
+  const cardano_stake_registration_cert_t* cert,
+  cardano_json_writer_t*                   writer);
+
+/**
+ * \brief Retrieves the credential associated with a stake registration certificate.
+ *
+ * This function extracts the credential from the specified \ref cardano_stake_registration_cert_t object.
+ * The credential represents the staking identifier that was intended to be registered from the Cardano network.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_registration_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_credential_t object containing the credential. If the certificate is NULL,
+ *         this function returns NULL. The returned credential object has its reference count increased and it is
+ *         the caller's responsibility to release this reference using \ref cardano_credential_unref when it is
+ *         no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_registration_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_credential_t* credential = cardano_stake_registration_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_stake_registration_cert_get_credential(cardano_stake_registration_cert_t* certificate);
+
+/**
+ * \brief Sets the credential for a stake registration certificate.
+ *
+ * This function assigns a new credential to a given \ref cardano_stake_registration_cert_t object. The credential
+ * represents the staking identifier that is intended to be registered from the Cardano network.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_stake_registration_cert_t object to which the credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the new credential.
+ *                       This function increments the reference count of the credential, and it will be managed by the
+ *                       certificate object thereafter.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the credential
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_registration_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_stake_registration_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The credential is now set for the stake registration certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to set the credential.\n");
+ * }
+ *
+ * // Remember to manage the lifecycle of the objects properly
+ * cardano_credential_unref(&credential);
+ * cardano_stake_registration_cert_unref(&certificate);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_cert_set_credential(cardano_stake_registration_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Decrements the reference count of a cardano_stake_registration_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_stake_registration_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the stake_registration is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] stake_registration A pointer to the pointer of the stake_registration object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_registration_cert_t* stake_registration = cardano_stake_registration_cert_new(major, minor);
+ *
+ * // Perform operations with the stake_registration...
+ *
+ * cardano_stake_registration_cert_unref(&stake_registration);
+ * // At this point, stake_registration is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_stake_registration_cert_unref, the pointer to the \ref cardano_stake_registration_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_stake_registration_cert_unref(cardano_stake_registration_cert_t** stake_registration);
+
+/**
+ * \brief Increases the reference count of the cardano_stake_registration_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_stake_registration_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_stake_registration_cert_unref.
+ *
+ * \param stake_registration A pointer to the cardano_stake_registration_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_registration is a previously created stake_registration object
+ *
+ * cardano_stake_registration_cert_ref(stake_registration);
+ *
+ * // Now stake_registration can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_stake_registration_cert_ref there is a corresponding
+ * call to \ref cardano_stake_registration_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_stake_registration_cert_ref(cardano_stake_registration_cert_t* stake_registration);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_stake_registration_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_stake_registration_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_stake_registration_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param stake_registration A pointer to the cardano_stake_registration_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_stake_registration_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_stake_registration_cert_ref call is matched with a
+ * \ref cardano_stake_registration_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_registration is a previously created stake_registration object
+ *
+ * size_t ref_count = cardano_stake_registration_cert_refcount(stake_registration);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_stake_registration_cert_refcount(const cardano_stake_registration_cert_t* stake_registration);
+
+/**
+ * \brief Sets the last error message for a given cardano_stake_registration_cert_t object.
+ *
+ * Records an error message in the stake_registration's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] stake_registration A pointer to the \ref cardano_stake_registration_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the stake_registration's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_stake_registration_cert_set_last_error(
+  cardano_stake_registration_cert_t* stake_registration,
+  const char*                        message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific stake_registration.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_stake_registration_cert_set_last_error for the given
+ * stake_registration. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] stake_registration A pointer to the \ref cardano_stake_registration_cert_t instance whose last error
+ *                   message is to be retrieved. If the stake_registration is NULL, the function
+ *                   returns a generic error message indicating the null stake_registration.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified stake_registration. If the stake_registration is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_stake_registration_cert_set_last_error for the same stake_registration, or until
+ *       the stake_registration is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_stake_registration_cert_get_last_error(
+  const cardano_stake_registration_cert_t* stake_registration);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_stake_registration_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_stake_registration_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_cert_deep_clone(const cardano_stake_registration_cert_t* source, cardano_stake_registration_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // STAKE_REGISTRATION_CERT_H
diff --git a/vendor/include/cardano/certs/stake_registration_delegation_cert.h b/vendor/include/cardano/certs/stake_registration_delegation_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/stake_registration_delegation_cert.h
@@ -0,0 +1,540 @@
+/**
+ * \file stake_registration_delegation_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef STAKE_REGISTRATION_DELEGATION_CERT_H
+#define STAKE_REGISTRATION_DELEGATION_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate Register the stake key and delegate with a single certificate to a stake pool.
+ */
+typedef struct cardano_stake_registration_delegation_cert_t cardano_stake_registration_delegation_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new stake registration and delegation certificate.
+ *
+ * This function allocates and initializes a \ref cardano_stake_registration_delegation_cert_t object, which represents
+ * a certificate that both registers a new staking credential and delegates it to a specified staking pool.
+ *
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the stake credential to be registered.
+ * \param[in] pool_key_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the pool's key hash to which the stake will be delegated.
+ * \param[in] deposit The amount of ADA deposited for registering the stake, required as per network protocol rules.
+ * \param[out] stake_registration_delegation On successful initialization, this will point to a newly created \ref cardano_stake_registration_delegation_cert_t object.
+ *                                            The caller is responsible for managing the lifecycle of this object, including releasing it when no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was successfully created, or an error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ * cardano_blake2b_hash_t* pool_key_hash = ...; // Assume pool_key_hash is initialized
+ * uint64_t deposit = 2000000; // Example deposit amount
+ *
+ * cardano_stake_registration_delegation_cert_t* certificate = NULL;
+ * cardano_error_t result = cardano_stake_registration_delegation_cert_new(credential, pool_key_hash, deposit, &certificate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate is now ready to use
+ *   // Once done, ensure to clean up and release the certificate
+ *   cardano_stake_registration_delegation_cert_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake registration and delegation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_delegation_cert_new(
+  cardano_credential_t*                          credential,
+  cardano_blake2b_hash_t*                        pool_key_hash,
+  uint64_t                                       deposit,
+  cardano_stake_registration_delegation_cert_t** stake_registration_delegation);
+
+/**
+ * \brief Creates a \ref cardano_stake_registration_delegation_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_stake_registration_delegation_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a stake_registration.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] stake_registration A pointer to a pointer of \ref cardano_stake_registration_delegation_cert_t that will be set to the address
+ *                        of the newly created stake_registration object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_stake_registration_delegation_cert_t object by calling
+ *       \ref cardano_stake_registration_delegation_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_stake_registration_delegation_cert_t* stake_registration = NULL;
+ *
+ * cardano_error_t result = cardano_stake_registration_delegation_cert_from_cbor(reader, &stake_registration);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the stake_registration
+ *
+ *   // Once done, ensure to clean up and release the stake_registration
+ *   cardano_stake_registration_delegation_cert_unref(&stake_registration);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode stake_registration: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_registration_delegation_cert_t** stake_registration);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_stake_registration_delegation_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] stake_registration A constant pointer to the \ref cardano_stake_registration_delegation_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p stake_registration or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_registration_delegation_cert_t* stake_registration = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_stake_registration_delegation_cert_to_cbor(stake_registration, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_stake_registration_delegation_cert_unref(&stake_registration);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_stake_registration_delegation_cert_to_cbor(
+  const cardano_stake_registration_delegation_cert_t* stake_registration,
+  cardano_cbor_writer_t*                              writer);
+
+/**
+ * \brief Serializes a stake registration and delegation certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "credential", "pool_keyhash", "coin".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_stake_registration_delegation_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cert or \p writer is NULL.
+ * CARDANO_ERROR_ENCODING        If the certificate is malformed or serialization fails.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_delegation_cert_to_cip116_json(
+  const cardano_stake_registration_delegation_cert_t* cert,
+  cardano_json_writer_t*                              writer);
+
+/**
+ * \brief Retrieves the stake credential from a stake registration and delegation certificate.
+ *
+ * This function extracts the stake credential from a given \ref cardano_stake_registration_delegation_cert_t object.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_registration_delegation_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_credential_t object containing the stake credential. If the certificate is NULL,
+ *         this function returns NULL. The returned credential is reference counted and must be unreferenced by the caller
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_credential_t* credential = cardano_stake_registration_delegation_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the credential.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_stake_registration_delegation_cert_get_credential(cardano_stake_registration_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the stake credential for a stake registration and delegation certificate.
+ *
+ * This function assigns a stake credential to a given \ref cardano_stake_registration_delegation_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_stake_registration_delegation_cert_t object which will
+ *                        receive the new stake credential.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object containing the stake credential to be
+ *                       set. This function increases the reference count of the credential, so it remains managed and must
+ *                       be properly unreferenced after it is no longer needed by the caller.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the stake credential
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_stake_registration_delegation_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Stake credential set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the stake credential.\n");
+ * }
+ *
+ * // Both objects should be unreferenced when no longer needed
+ * cardano_credential_unref(&credential);
+ * cardano_stake_registration_delegation_cert_unref(&certificate);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_delegation_cert_set_credential(cardano_stake_registration_delegation_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the pool key hash from a stake registration and delegation certificate.
+ *
+ * This function extracts the pool key hash from the specified \ref cardano_stake_registration_delegation_cert_t object.
+ * The pool key hash identifies the staking pool to which the stake rights are being delegated.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_registration_delegation_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_blake2b_hash_t object containing the pool key hash. If the certificate is NULL,
+ *         or if the pool key hash has not been set, this function returns NULL. The returned hash is a new reference and
+ *         must be managed by the caller. It must be unreferenced when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_blake2b_hash_t* pool_key_hash = cardano_stake_registration_delegation_cert_get_pool_key_hash(certificate);
+ *
+ * if (pool_key_hash != NULL)
+ * {
+ *   // Process the pool key hash
+ *   cardano_blake2b_hash_unref(&pool_key_hash);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_stake_registration_delegation_cert_get_pool_key_hash(cardano_stake_registration_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the pool key hash for a stake registration and delegation certificate.
+ *
+ * This function assigns a pool key hash to the specified \ref cardano_stake_registration_delegation_cert_t object.
+ * The pool key hash identifies the staking pool to which the stake rights are being delegated.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_stake_registration_delegation_cert_t object to which the pool key hash will be set.
+ * \param[in] hash A constant pointer to an initialized \ref cardano_blake2b_hash_t object representing the pool key hash.
+ *                  The pool parameters object will take a reference to this hash, so it must remain valid as long as it is in use by the certificate.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the pool key hash was successfully set,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_blake2b_hash_t* hash = ...; // Assume hash is already initialized
+ *
+ * cardano_error_t result = cardano_stake_registration_delegation_cert_set_pool_key_hash(certificate, hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The pool key hash has been set successfully
+ * }
+ * else
+ * {
+ *   printf("Failed to set the pool key hash.\n");
+ * }
+ * \endcode
+ *
+ * \note This function increments the reference count of the hash passed to it, as the certificate will maintain a reference to it.
+ *       The caller must manage their own reference to the hash and release it when it is no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_delegation_cert_set_pool_key_hash(cardano_stake_registration_delegation_cert_t* certificate, cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Retrieves the deposit amount from a stake registration and delegation certificate.
+ *
+ * This function extracts the deposit amount from the specified \ref cardano_stake_registration_delegation_cert_t object.
+ * The deposit is required when registering stake rights and delegating them to a staking pool, as specified by the protocol parameters.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_registration_delegation_cert_t object.
+ *
+ * \return The deposit amount in lovelaces. If the certificate is NULL, returns 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t deposit = cardano_stake_registration_delegation_cert_get_deposit(certificate);
+ * printf("Deposit amount: %llu lovelaces\n", deposit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_stake_registration_delegation_cert_get_deposit(const cardano_stake_registration_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the deposit amount for a stake registration and delegation certificate.
+ *
+ * This function assigns a new deposit amount to a given \ref cardano_stake_registration_delegation_cert_t object.
+ * The deposit is a required amount of ADA that must be locked when registering stake rights and delegating them to a staking pool,
+ * according to the protocol parameters.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_stake_registration_delegation_cert_t object to which the deposit will be set.
+ * \param[in] deposit The deposit amount in lovelaces to be set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the deposit amount was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input certificate pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t deposit = 2000000; // Deposit of 2 ADA
+ *
+ * cardano_error_t result = cardano_stake_registration_delegation_cert_set_deposit(certificate, deposit);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Deposit amount set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the deposit amount.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_delegation_cert_set_deposit(cardano_stake_registration_delegation_cert_t* certificate, uint64_t deposit);
+
+/**
+ * \brief Decrements the reference count of a cardano_stake_registration_delegation_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_stake_registration_delegation_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the stake_registration is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] stake_registration A pointer to the pointer of the stake_registration object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_registration_delegation_cert_t* stake_registration = cardano_stake_registration_delegation_cert_new(major, minor);
+ *
+ * // Perform operations with the stake_registration...
+ *
+ * cardano_stake_registration_delegation_cert_unref(&stake_registration);
+ * // At this point, stake_registration is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_stake_registration_delegation_cert_unref, the pointer to the \ref cardano_stake_registration_delegation_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_stake_registration_delegation_cert_unref(cardano_stake_registration_delegation_cert_t** stake_registration);
+
+/**
+ * \brief Increases the reference count of the cardano_stake_registration_delegation_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_stake_registration_delegation_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_stake_registration_delegation_cert_unref.
+ *
+ * \param stake_registration A pointer to the cardano_stake_registration_delegation_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_registration is a previously created stake_registration object
+ *
+ * cardano_stake_registration_delegation_cert_ref(stake_registration);
+ *
+ * // Now stake_registration can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_stake_registration_delegation_cert_ref there is a corresponding
+ * call to \ref cardano_stake_registration_delegation_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_stake_registration_delegation_cert_ref(cardano_stake_registration_delegation_cert_t* stake_registration);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_stake_registration_delegation_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_stake_registration_delegation_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_stake_registration_delegation_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param stake_registration A pointer to the cardano_stake_registration_delegation_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_stake_registration_delegation_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_stake_registration_delegation_cert_ref call is matched with a
+ * \ref cardano_stake_registration_delegation_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_registration is a previously created stake_registration object
+ *
+ * size_t ref_count = cardano_stake_registration_delegation_cert_refcount(stake_registration);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_stake_registration_delegation_cert_refcount(const cardano_stake_registration_delegation_cert_t* stake_registration);
+
+/**
+ * \brief Sets the last error message for a given cardano_stake_registration_delegation_cert_t object.
+ *
+ * Records an error message in the stake_registration's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] stake_registration A pointer to the \ref cardano_stake_registration_delegation_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the stake_registration's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_stake_registration_delegation_cert_set_last_error(
+  cardano_stake_registration_delegation_cert_t* stake_registration,
+  const char*                                   message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific stake_registration.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_stake_registration_delegation_cert_set_last_error for the given
+ * stake_registration. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] stake_registration A pointer to the \ref cardano_stake_registration_delegation_cert_t instance whose last error
+ *                   message is to be retrieved. If the stake_registration is NULL, the function
+ *                   returns a generic error message indicating the null stake_registration.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified stake_registration. If the stake_registration is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_stake_registration_delegation_cert_set_last_error for the same stake_registration, or until
+ *       the stake_registration is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_stake_registration_delegation_cert_get_last_error(
+  const cardano_stake_registration_delegation_cert_t* stake_registration);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_stake_registration_delegation_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_stake_registration_delegation_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_stake_registration_delegation_cert_deep_clone(const cardano_stake_registration_delegation_cert_t* source, cardano_stake_registration_delegation_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // STAKE_REGISTRATION_DELEGATION_CERT_H
diff --git a/vendor/include/cardano/certs/stake_vote_delegation_cert.h b/vendor/include/cardano/certs/stake_vote_delegation_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/stake_vote_delegation_cert.h
@@ -0,0 +1,575 @@
+/**
+ * \file stake_vote_delegation_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef STAKE_VOTE_DELEGATION_CERT_H
+#define STAKE_VOTE_DELEGATION_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/drep.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used when an individual wants to delegate their voting
+ * rights to any other DRep and simultaneously wants to delegate their stake to a
+ * specific stake pool.
+ */
+typedef struct cardano_stake_vote_delegation_cert_t cardano_stake_vote_delegation_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new stake vote delegation certificate.
+ *
+ * This function allocates and initializes a new \ref cardano_stake_vote_delegation_cert_t object. It represents a certificate
+ * where a stakeholder delegates their voting rights along with their staking activity to a pool and a drep.
+ *
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the stakeholder's credential.
+ * \param[in] pool_key_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the pool's key hash to which the stake is delegated.
+ * \param[in] drep A pointer to an initialized \ref cardano_drep_t object representing the drep to which the voting rights are delegated.
+ * \param[out] stake_vote_delegation On successful initialization, this will point to a newly created \ref cardano_stake_vote_delegation_cert_t object.
+ *                                            The caller is responsible for managing the lifecycle of this object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ * cardano_blake2b_hash_t* pool_key_hash = ...; // Assume pool_key_hash is initialized
+ * cardano_drep_t* drep = ...; // Assume drep is initialized
+ * cardano_stake_vote_delegation_cert_t* certificate = NULL;
+ *
+ * cardano_error_t result = cardano_stake_vote_delegation_cert_new(credential, pool_key_hash, drep, &certificate);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The certificate can now be used in voting and staking operations
+ *   // Remember to free the certificate when done
+ *   cardano_stake_vote_delegation_cert_unref(&certificate);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake vote delegation certificate: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources
+ * cardano_credential_unref(&credential);
+ * cardano_blake2b_hash_unref(&pool_key_hash);
+ * cardano_drep_unref(&drep);
+ * \endcode
+ *
+ * \note This function increases the reference count of all input objects. The caller is responsible for releasing their references when they are no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_delegation_cert_new(
+  cardano_credential_t*                  credential,
+  cardano_blake2b_hash_t*                pool_key_hash,
+  cardano_drep_t*                        drep,
+  cardano_stake_vote_delegation_cert_t** stake_vote_delegation);
+
+/**
+ * \brief Creates a \ref cardano_stake_vote_delegation_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_stake_vote_delegation_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a stake_registration.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] stake_registration A pointer to a pointer of \ref cardano_stake_vote_delegation_cert_t that will be set to the address
+ *                        of the newly created stake_registration object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_stake_vote_delegation_cert_t object by calling
+ *       \ref cardano_stake_vote_delegation_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_stake_vote_delegation_cert_t* stake_registration = NULL;
+ *
+ * cardano_error_t result = cardano_stake_vote_delegation_cert_from_cbor(reader, &stake_registration);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the stake_registration
+ *
+ *   // Once done, ensure to clean up and release the stake_registration
+ *   cardano_stake_vote_delegation_cert_unref(&stake_registration);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode stake_registration: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_vote_delegation_cert_t** stake_registration);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_stake_vote_delegation_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] stake_registration A constant pointer to the \ref cardano_stake_vote_delegation_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p stake_registration or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_delegation_cert_t* stake_registration = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_stake_vote_delegation_cert_to_cbor(stake_registration, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_stake_vote_delegation_cert_unref(&stake_registration);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_stake_vote_delegation_cert_to_cbor(
+  const cardano_stake_vote_delegation_cert_t* stake_registration,
+  cardano_cbor_writer_t*                      writer);
+
+/**
+ * \brief Serializes a stake vote delegation certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "credential", "pool_keyhash", "drep".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_stake_vote_delegation_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p cert or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_delegation_cert_to_cip116_json(
+  const cardano_stake_vote_delegation_cert_t* cert,
+  cardano_json_writer_t*                      writer);
+
+/**
+ * \brief Retrieves the credential from a stake vote delegation certificate.
+ *
+ * This function extracts the credential from the specified \ref cardano_stake_vote_delegation_cert_t object. The credential
+ * identifies the stakeholder whose voting rights are being delegated.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_vote_delegation_cert_t object from which the credential will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_credential_t object containing the credential. If the certificate is NULL or
+ *         if the credential is not set, this function returns NULL. This returned object is a new reference and must be
+ *         unreferenced by the caller when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_vote_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = cardano_stake_vote_delegation_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the credential
+ *   cardano_credential_unref(&credential); // When done, release the credential
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve credential.\n");
+ * }
+ * \endcode
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned credential, including releasing it
+ *       when it is no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_stake_vote_delegation_cert_get_credential(cardano_stake_vote_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the credential for a stake vote delegation certificate.
+ *
+ * This function assigns a new credential to a given \ref cardano_stake_vote_delegation_cert_t object.
+ * The credential specifies the stakeholder whose voting rights are being delegated.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_stake_vote_delegation_cert_t object to which the credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the new credential. This function
+ *                       increments the reference count of the credential, so it remains managed by the caller.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the credential was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_stake_vote_delegation_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The credential is now set for the certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to set the credential.\n");
+ * }
+ *
+ * // Both certificate and credential should be unreferenced when no longer needed
+ * cardano_credential_unref(&credential);
+ * cardano_stake_vote_delegation_cert_unref(&certificate);
+ * \endcode
+ *
+ * \note This function takes a reference to the provided credential object. The caller must ensure
+ *       that the credential remains valid for as long as it is associated with the certificate and
+ *       is responsible for releasing its own reference when it is no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_delegation_cert_set_credential(cardano_stake_vote_delegation_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the pool key hash from a stake vote delegation certificate.
+ *
+ * This function extracts the pool key hash from the specified \ref cardano_stake_vote_delegation_cert_t object.
+ * The pool key hash identifies the stake pool to which the voting rights are delegated.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_vote_delegation_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_blake2b_hash_t object containing the pool key hash. If the certificate is NULL or
+ *         if the pool key hash is not set, this function returns NULL. The returned object is a new reference and must be
+ *         unreferenced by the caller when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_vote_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_blake2b_hash_t* pool_key_hash = cardano_stake_vote_delegation_cert_get_pool_key_hash(certificate);
+ *
+ * if (pool_key_hash != NULL)
+ * {
+ *   // Process the pool key hash
+ *   // Display or use the hash as needed
+ *   cardano_blake2b_hash_unref(&pool_key_hash);
+ * }
+ * \endcode
+ *
+ * \note This function returns a new reference to the pool key hash. It is the responsibility of the caller to manage
+ *       this reference and ensure that it is unreferenced when no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_stake_vote_delegation_cert_get_pool_key_hash(cardano_stake_vote_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the pool key hash for a stake vote delegation certificate.
+ *
+ * This function updates the pool key hash in the specified \ref cardano_stake_vote_delegation_cert_t object.
+ * The pool key hash identifies the stake pool to which the voting rights are to be delegated.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_stake_vote_delegation_cert_t object to which the pool key hash will be set.
+ * \param[in] hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the pool key hash.
+ *                 The function increases the reference count of the hash object; it is the responsibility of the caller
+ *                 to manage the lifecycle of their own reference to the hash.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool key hash was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_blake2b_hash_t* pool_key_hash = ...; // Assume pool_key_hash is already initialized
+ *
+ * cardano_error_t result = cardano_stake_vote_delegation_cert_set_pool_key_hash(certificate, pool_key_hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool key hash set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the pool key hash.\n");
+ * }
+ *
+ * // Remember to unreference the hash if it's no longer used elsewhere in your application
+ * cardano_blake2b_hash_unref(&pool_key_hash);
+ * \endcode
+ *
+ * \note This function increments the reference count of the hash object. It is important for the caller
+ *       to manage the reference correctly to avoid memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_delegation_cert_set_pool_key_hash(cardano_stake_vote_delegation_cert_t* certificate, cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Retrieves the DREP from a stake vote delegation certificate.
+ *
+ * This function extracts the DREP associated with the specified \ref cardano_stake_vote_delegation_cert_t object.
+ * The DREP object represents the delegated representative to which voting rights are assigned.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_vote_delegation_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_drep_t object containing the DREP information. If the certificate is NULL or
+ *         if the DREP is not set, this function returns NULL. The returned DREP object is a new reference and must be
+ *         managed by the caller, who is responsible for releasing it using \ref cardano_drep_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_vote_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_drep_t* drep = cardano_stake_vote_delegation_cert_get_drep(certificate);
+ *
+ * if (drep != NULL)
+ * {
+ *   // Process the DREP information
+ *   cardano_drep_unref(&drep);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_drep_t* cardano_stake_vote_delegation_cert_get_drep(cardano_stake_vote_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the DREP for a stake vote delegation certificate.
+ *
+ * This function assigns a new DREP to the specified \ref cardano_stake_vote_delegation_cert_t object.
+ * The DREP object represents the delegated representative to which voting rights are being assigned.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_stake_vote_delegation_cert_t object where the DREP will be set.
+ * \param[in] drep A pointer to an initialized \ref cardano_drep_t object to be assigned to the certificate.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the DREP was successfully set,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note This function increments the reference count of the \p drep object, so it remains managed by both the caller and the certificate.
+ *       It is the caller's responsibility to unreference their own copy of \p drep when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_drep_t* drep = ...; // Assume drep is already initialized
+ *
+ * cardano_error_t result = cardano_stake_vote_delegation_cert_set_drep(certificate, drep);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The drep is now set for the certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to set the drep.\n");
+ * }
+ *
+ * cardano_drep_unref(&drep); // Cleanup the drep reference owned by the caller
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_delegation_cert_set_drep(cardano_stake_vote_delegation_cert_t* certificate, cardano_drep_t* drep);
+
+/**
+ * \brief Decrements the reference count of a cardano_stake_vote_delegation_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_stake_vote_delegation_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the stake_registration is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] stake_registration A pointer to the pointer of the stake_registration object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_delegation_cert_t* stake_registration = cardano_stake_vote_delegation_cert_new(major, minor);
+ *
+ * // Perform operations with the stake_registration...
+ *
+ * cardano_stake_vote_delegation_cert_unref(&stake_registration);
+ * // At this point, stake_registration is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_stake_vote_delegation_cert_unref, the pointer to the \ref cardano_stake_vote_delegation_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_stake_vote_delegation_cert_unref(cardano_stake_vote_delegation_cert_t** stake_registration);
+
+/**
+ * \brief Increases the reference count of the cardano_stake_vote_delegation_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_stake_vote_delegation_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_stake_vote_delegation_cert_unref.
+ *
+ * \param stake_registration A pointer to the cardano_stake_vote_delegation_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_registration is a previously created stake_registration object
+ *
+ * cardano_stake_vote_delegation_cert_ref(stake_registration);
+ *
+ * // Now stake_registration can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_stake_vote_delegation_cert_ref there is a corresponding
+ * call to \ref cardano_stake_vote_delegation_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_stake_vote_delegation_cert_ref(cardano_stake_vote_delegation_cert_t* stake_registration);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_stake_vote_delegation_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_stake_vote_delegation_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_stake_vote_delegation_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param stake_registration A pointer to the cardano_stake_vote_delegation_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_stake_vote_delegation_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_stake_vote_delegation_cert_ref call is matched with a
+ * \ref cardano_stake_vote_delegation_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_registration is a previously created stake_registration object
+ *
+ * size_t ref_count = cardano_stake_vote_delegation_cert_refcount(stake_registration);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_stake_vote_delegation_cert_refcount(const cardano_stake_vote_delegation_cert_t* stake_registration);
+
+/**
+ * \brief Sets the last error message for a given cardano_stake_vote_delegation_cert_t object.
+ *
+ * Records an error message in the stake_registration's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] stake_registration A pointer to the \ref cardano_stake_vote_delegation_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the stake_registration's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_stake_vote_delegation_cert_set_last_error(
+  cardano_stake_vote_delegation_cert_t* stake_registration,
+  const char*                           message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific stake_registration.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_stake_vote_delegation_cert_set_last_error for the given
+ * stake_registration. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] stake_registration A pointer to the \ref cardano_stake_vote_delegation_cert_t instance whose last error
+ *                   message is to be retrieved. If the stake_registration is NULL, the function
+ *                   returns a generic error message indicating the null stake_registration.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified stake_registration. If the stake_registration is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_stake_vote_delegation_cert_set_last_error for the same stake_registration, or until
+ *       the stake_registration is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_stake_vote_delegation_cert_get_last_error(
+  const cardano_stake_vote_delegation_cert_t* stake_registration);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_stake_vote_delegation_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_stake_vote_delegation_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_delegation_cert_deep_clone(const cardano_stake_vote_delegation_cert_t* source, cardano_stake_vote_delegation_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // STAKE_VOTE_DELEGATION_CERT_H
diff --git a/vendor/include/cardano/certs/stake_vote_registration_delegation_cert.h b/vendor/include/cardano/certs/stake_vote_registration_delegation_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/stake_vote_registration_delegation_cert.h
@@ -0,0 +1,627 @@
+/**
+ * \file stake_vote_registration_delegation_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef STAKE_VOTE_REGISTRATION_DELEGATION_CERT_H
+#define STAKE_VOTE_REGISTRATION_DELEGATION_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/drep.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used when an individual wants to register its stake key,
+ * delegate their voting rights to any other DRep and simultaneously wants to delegate
+ * their stake to a specific stake pool.
+ */
+typedef struct cardano_stake_vote_registration_delegation_cert_t cardano_stake_vote_registration_delegation_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new stake vote registration delegation certificate.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_stake_vote_registration_delegation_cert_t.
+ * This certificate combines stake registration with a delegation of voting rights to a delegated representative (DREP)
+ * and a specific staking pool, setting the groundwork for participation in governance and staking rewards.
+ *
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the stake credential.
+ * \param[in] deposit The deposit amount required for registration, which is specified by network protocol parameters.
+ * \param[in] drep A pointer to an initialized \ref cardano_drep_t object representing the delegated representative.
+ * \param[in] pool_key_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the pool's key hash.
+ * \param[out] vote_registration_delegation On successful execution, this will point to a newly created
+ *                                          \ref cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate
+ *         was successfully created, or an appropriate error code indicating the reason for failure
+ *         (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...; // Assume credential is initialized
+ * uint64_t deposit = ...; // Deposit required for registration
+ * cardano_drep_t* drep = ...; // Assume drep is initialized
+ * cardano_blake2b_hash_t* pool_key_hash = ...; // Assume pool key hash is initialized
+ * cardano_stake_vote_registration_delegation_cert_t* vote_registration_delegation = NULL;
+ *
+ * cardano_error_t result = cardano_stake_vote_registration_delegation_cert_new(
+ *     credential, deposit, drep, pool_key_hash, &vote_registration_delegation);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the vote registration delegation certificate
+ *   // Remember to free the certificate when done
+ *   cardano_stake_vote_registration_delegation_cert_unref(&vote_registration_delegation);
+ * }
+ * else
+ * {
+ *   printf("Failed to create stake vote registration delegation certificate: %s\n",
+ *          cardano_error_to_string(result));
+ * }
+ * \endcode
+ *
+ * \note This function increments the reference count for the credential, drep, and pool_key_hash objects.
+ *       It is the responsibility of the caller to manage these references and release them when they are no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_registration_delegation_cert_new(
+  cardano_credential_t*                               credential,
+  uint64_t                                            deposit,
+  cardano_drep_t*                                     drep,
+  cardano_blake2b_hash_t*                             pool_key_hash,
+  cardano_stake_vote_registration_delegation_cert_t** vote_registration_delegation);
+
+/**
+ * \brief Creates a \ref cardano_stake_vote_registration_delegation_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_stake_vote_registration_delegation_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a stake_registration.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] stake_registration A pointer to a pointer of \ref cardano_stake_vote_registration_delegation_cert_t that will be set to the address
+ *                        of the newly created stake_registration object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_stake_vote_registration_delegation_cert_t object by calling
+ *       \ref cardano_stake_vote_registration_delegation_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_stake_vote_registration_delegation_cert_t* stake_registration = NULL;
+ *
+ * cardano_error_t result = cardano_stake_vote_registration_delegation_cert_from_cbor(reader, &stake_registration);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the stake_registration
+ *
+ *   // Once done, ensure to clean up and release the stake_registration
+ *   cardano_stake_vote_registration_delegation_cert_unref(&stake_registration);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode stake_registration: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_registration_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_vote_registration_delegation_cert_t** stake_registration);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_stake_vote_registration_delegation_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] stake_registration A constant pointer to the \ref cardano_stake_vote_registration_delegation_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p stake_registration or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_registration_delegation_cert_t* stake_registration = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_stake_vote_registration_delegation_cert_to_cbor(stake_registration, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_stake_vote_registration_delegation_cert_unref(&stake_registration);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_stake_vote_registration_delegation_cert_to_cbor(
+  const cardano_stake_vote_registration_delegation_cert_t* stake_registration,
+  cardano_cbor_writer_t*                                   writer);
+
+/**
+ * \brief Serializes a stake vote registration delegation certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "credential", "pool_keyhash", "drep", "coin".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_stake_vote_registration_delegation_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p cert or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_registration_delegation_cert_to_cip116_json(
+  const cardano_stake_vote_registration_delegation_cert_t* cert,
+  cardano_json_writer_t*                                   writer);
+
+/**
+ * \brief Retrieves the stake credential from a stake vote registration delegation certificate.
+ *
+ * This function extracts the stake credential from a given \ref cardano_stake_vote_registration_delegation_cert_t object.
+ * The credential identifies the stakeholder in the context of the Cardano network.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * \return A pointer to a \ref cardano_credential_t object containing the stake credential. If the input certificate is NULL,
+ *         or if the credential is not set, this function returns NULL.
+ *
+ * \note The returned \ref cardano_credential_t object is a new reference and must be managed by the caller.
+ *       It should be released using \ref cardano_credential_unref when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = cardano_stake_vote_registration_delegation_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the credential
+ *   // Remember to release the credential reference when done
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve credential or certificate is not initialized properly.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_stake_vote_registration_delegation_cert_get_credential(cardano_stake_vote_registration_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the stake credential for a stake vote registration delegation certificate.
+ *
+ * This function assigns a stake credential to a given \ref cardano_stake_vote_registration_delegation_cert_t object.
+ * The credential identifies the stakeholder in the context of the Cardano network.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_stake_vote_registration_delegation_cert_t object
+ *                            where the stake credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the stake credential.
+ *                       This function increments the reference count of the credential, and the caller remains responsible
+ *                       for releasing their own reference.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the stake credential
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_stake_vote_registration_delegation_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Credential successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the credential: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup performed elsewhere for credential
+ * \endcode
+ *
+ * \note After setting, the certificate holds its own reference to the credential. The caller
+ *       must manage and release its own references to the credential object.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_registration_delegation_cert_set_credential(cardano_stake_vote_registration_delegation_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the pool key hash from a stake vote registration delegation certificate.
+ *
+ * This function extracts the pool key hash from the specified \ref cardano_stake_vote_registration_delegation_cert_t object.
+ * The pool key hash is used to identify the stake pool to which the delegation is directed in the Cardano network.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_blake2b_hash_t object containing the pool key hash. If the certificate is NULL or
+ *         if the pool key hash is not set, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_blake2b_hash_t* pool_key_hash = cardano_stake_vote_registration_delegation_cert_get_pool_key_hash(certificate);
+ *
+ * if (pool_key_hash != NULL)
+ * {
+ *   // Process the pool key hash
+ *   cardano_blake2b_hash_unref(&pool_key_hash); // Clean up the reference when done
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_stake_vote_registration_delegation_cert_get_pool_key_hash(cardano_stake_vote_registration_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the pool key hash for a stake vote registration delegation certificate.
+ *
+ * This function assigns a pool key hash to the specified \ref cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_stake_vote_registration_delegation_cert_t object where the pool key hash will be set.
+ * \param[in] hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the pool key hash. This function increments the reference
+ *                 count of the hash, and the caller is responsible for releasing their reference to the hash object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the pool key hash
+ *         was successfully set, or an appropriate error code indicating the reason for failure, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_blake2b_hash_t* hash = ...; // Assume hash is already initialized
+ *
+ * cardano_error_t result = cardano_stake_vote_registration_delegation_cert_set_pool_key_hash(certificate, hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool key hash set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the pool key hash.\n");
+ * }
+ *
+ * // Cleanup
+ * cardano_blake2b_hash_unref(&pool_key_hash); // Clean up the reference when done
+ * \endcode
+ *
+ * \note After setting, the certificate holds its own reference to the hash. The caller
+ *       must manage and release its own references to the hash object.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_registration_delegation_cert_set_pool_key_hash(cardano_stake_vote_registration_delegation_cert_t* certificate, cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Retrieves the DRep associated with a stake vote registration delegation certificate.
+ *
+ * This function extracts the DRep from the specified \ref cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * \return A pointer to a new \ref cardano_drep_t object containing the DRep. The caller is responsible
+ *         for managing the lifecycle of this returned DRep object, including releasing it using \ref cardano_drep_unref
+ *         when it is no longer needed. If the certificate is NULL or if the DRep is not set, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_stake_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_drep_t* drep = cardano_stake_vote_registration_delegation_cert_get_drep(certificate);
+ *
+ * if (drep != NULL)
+ * {
+ *   // Process the DRep
+ *   // Remember to free the DRep when done
+ *   cardano_drep_unref(&drep);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_drep_t* cardano_stake_vote_registration_delegation_cert_get_drep(cardano_stake_vote_registration_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the DRep for a stake vote registration delegation certificate.
+ *
+ * This function assigns a DRep to the specified \ref cardano_stake_vote_registration_delegation_cert_t object.
+ * The DRep is essential for representing delegate participation in the governance process within the Cardano network.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_stake_vote_registration_delegation_cert_t object which will receive the DRep.
+ * \param[in] drep A pointer to an initialized \ref cardano_drep_t object to be set on the certificate. This function increments the reference
+ *                 count of the DRep, and the caller is still responsible for releasing their reference to the DRep object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the DRep was successfully set,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_drep_t* drep = ...; // Assume drep is already initialized
+ *
+ * cardano_error_t result = cardano_stake_vote_registration_delegation_cert_set_drep(certificate, drep);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The DRep is now set for the certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to set the DRep.\n");
+ * }
+ *
+ * // Both certificate and drep need their references managed appropriately
+ * cardano_drep_unref(&drep);
+ * \endcode
+ *
+ * \note This function increments the reference count of the drep argument, the caller must manage their own reference to it.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_registration_delegation_cert_set_drep(cardano_stake_vote_registration_delegation_cert_t* certificate, cardano_drep_t* drep);
+
+/**
+ * \brief Retrieves the deposit amount from a stake vote registration delegation certificate.
+ *
+ * This function fetches the deposit amount that has been set on a \ref cardano_stake_vote_registration_delegation_cert_t object.
+ * The deposit is a fixed amount required as part of the registration process, acting as a security measure within the Cardano network.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * \return The deposit amount set on the certificate. If the certificate is NULL, the function returns 0,
+ *         which should be checked against possible error returns in real scenarios.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ *
+ * uint64_t deposit = cardano_stake_vote_registration_delegation_cert_get_deposit(certificate);
+ * printf("Deposit amount: %llu ADA\n", deposit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_stake_vote_registration_delegation_cert_get_deposit(const cardano_stake_vote_registration_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the deposit amount on a stake vote registration delegation certificate.
+ *
+ * This function updates the deposit amount for a \ref cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_stake_vote_registration_delegation_cert_t object on which
+ *                            the deposit amount will be set.
+ * \param[in] deposit The deposit amount to be set on the certificate. This amount should align with the protocol's current requirements.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the deposit amount
+ *         was successfully updated, or an appropriate error code indicating the reason for failure, such as
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if the certificate pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t deposit = 1000000; // 1 ADA, example deposit amount
+ *
+ * cardano_error_t result = cardano_stake_vote_registration_delegation_cert_set_deposit(certificate, deposit);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Deposit amount updated successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set deposit amount.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_registration_delegation_cert_set_deposit(cardano_stake_vote_registration_delegation_cert_t* certificate, uint64_t deposit);
+
+/**
+ * \brief Decrements the reference count of a cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_stake_vote_registration_delegation_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the stake_registration is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] stake_registration A pointer to the pointer of the stake_registration object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_stake_vote_registration_delegation_cert_t* stake_registration = cardano_stake_vote_registration_delegation_cert_new(major, minor);
+ *
+ * // Perform operations with the stake_registration...
+ *
+ * cardano_stake_vote_registration_delegation_cert_unref(&stake_registration);
+ * // At this point, stake_registration is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_stake_vote_registration_delegation_cert_unref, the pointer to the \ref cardano_stake_vote_registration_delegation_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_stake_vote_registration_delegation_cert_unref(cardano_stake_vote_registration_delegation_cert_t** stake_registration);
+
+/**
+ * \brief Increases the reference count of the cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_stake_vote_registration_delegation_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_stake_vote_registration_delegation_cert_unref.
+ *
+ * \param stake_registration A pointer to the cardano_stake_vote_registration_delegation_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_registration is a previously created stake_registration object
+ *
+ * cardano_stake_vote_registration_delegation_cert_ref(stake_registration);
+ *
+ * // Now stake_registration can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_stake_vote_registration_delegation_cert_ref there is a corresponding
+ * call to \ref cardano_stake_vote_registration_delegation_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_stake_vote_registration_delegation_cert_ref(cardano_stake_vote_registration_delegation_cert_t* stake_registration);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_stake_vote_registration_delegation_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_stake_vote_registration_delegation_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param stake_registration A pointer to the cardano_stake_vote_registration_delegation_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_stake_vote_registration_delegation_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_stake_vote_registration_delegation_cert_ref call is matched with a
+ * \ref cardano_stake_vote_registration_delegation_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming stake_registration is a previously created stake_registration object
+ *
+ * size_t ref_count = cardano_stake_vote_registration_delegation_cert_refcount(stake_registration);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_stake_vote_registration_delegation_cert_refcount(const cardano_stake_vote_registration_delegation_cert_t* stake_registration);
+
+/**
+ * \brief Sets the last error message for a given cardano_stake_vote_registration_delegation_cert_t object.
+ *
+ * Records an error message in the stake_registration's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] stake_registration A pointer to the \ref cardano_stake_vote_registration_delegation_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the stake_registration's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_stake_vote_registration_delegation_cert_set_last_error(
+  cardano_stake_vote_registration_delegation_cert_t* stake_registration,
+  const char*                                        message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific stake_registration.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_stake_vote_registration_delegation_cert_set_last_error for the given
+ * stake_registration. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] stake_registration A pointer to the \ref cardano_stake_vote_registration_delegation_cert_t instance whose last error
+ *                   message is to be retrieved. If the stake_registration is NULL, the function
+ *                   returns a generic error message indicating the null stake_registration.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified stake_registration. If the stake_registration is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_stake_vote_registration_delegation_cert_set_last_error for the same stake_registration, or until
+ *       the stake_registration is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_stake_vote_registration_delegation_cert_get_last_error(
+  const cardano_stake_vote_registration_delegation_cert_t* stake_registration);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_stake_vote_registration_delegation_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_stake_vote_registration_delegation_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_stake_vote_registration_delegation_cert_deep_clone(const cardano_stake_vote_registration_delegation_cert_t* source, cardano_stake_vote_registration_delegation_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // STAKE_VOTE_REGISTRATION_DELEGATION_CERT_H
diff --git a/vendor/include/cardano/certs/unregister_drep_cert.h b/vendor/include/cardano/certs/unregister_drep_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/unregister_drep_cert.h
@@ -0,0 +1,482 @@
+/**
+ * \file unregister_drep_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef UNREGISTER_DREP_CERT_H
+#define UNREGISTER_DREP_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate unregister an individual as a DRep.
+ *
+ * Note that a DRep is retired immediately upon the chain accepting a retirement certificate, and
+ * the deposit is returned as part of the transaction that submits the retirement certificate
+ * (the same way that stake credential registration deposits are returned).
+ */
+typedef struct cardano_unregister_drep_cert_t cardano_unregister_drep_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new unregistration certificate for a DRep in the Cardano blockchain.
+ *
+ * This function allocates and initializes a new \ref cardano_unregister_drep_cert_t object, which is used
+ * to unregister a DRep. The certificate includes the stake credential associated with the DRep and
+ * a deposit amount that might be refunded upon successful unregistration.
+ *
+ * \param[in] credential A pointer to a \ref cardano_credential_t object representing the stake credential
+ *                       of the DRep. This credential must have been previously registered.
+ * \param[in] deposit The deposit amount that was originally paid during the registration of the DRep.
+ *                    This deposit may be refunded upon successful unregistration.
+ * \param[out] unregister_drep On successful execution, this will point to a newly created
+ *                             \ref cardano_unregister_drep_cert_t object. The caller is responsible for
+ *                             managing the lifecycle of this object, which includes freeing it when it's
+ *                             no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         unregistration certificate was successfully created, or an appropriate error code indicating
+ *         the failure reason (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if any input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ * uint64_t deposit = 1000000; // Example deposit amount
+ *
+ * cardano_unregister_drep_cert_t* unregister_cert = NULL;
+ * cardano_error_t result = cardano_unregister_drep_cert_new(credential, deposit, &unregister_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The unregistration certificate can now be used to unregister the DRep
+ *   // Remember to free the unregister_cert when done
+ *   cardano_unregister_drep_cert_unref(&unregister_cert);
+ * }
+ * else
+ * {
+ *   printf("Failed to create DRep unregistration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unregister_drep_cert_new(
+  cardano_credential_t*            credential,
+  uint64_t                         deposit,
+  cardano_unregister_drep_cert_t** unregister_drep);
+
+/**
+ * \brief Creates a \ref cardano_unregister_drep_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_unregister_drep_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a unregister_drep_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] unregister_drep_cert A pointer to a pointer of \ref cardano_unregister_drep_cert_t that will be set to the address
+ *                        of the newly created unregister_drep_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_unregister_drep_cert_t object by calling
+ *       \ref cardano_unregister_drep_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_unregister_drep_cert_t* unregister_drep_cert = NULL;
+ *
+ * cardano_error_t result = cardano_unregister_drep_cert_from_cbor(reader, &unregister_drep_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the unregister_drep_cert
+ *
+ *   // Once done, ensure to clean up and release the unregister_drep_cert
+ *   cardano_unregister_drep_cert_unref(&unregister_drep_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode unregister_drep_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unregister_drep_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_unregister_drep_cert_t** unregister_drep_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_unregister_drep_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] unregister_drep_cert A constant pointer to the \ref cardano_unregister_drep_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p unregister_drep_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unregister_drep_cert_t* unregister_drep_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_unregister_drep_cert_to_cbor(unregister_drep_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_unregister_drep_cert_unref(&unregister_drep_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_unregister_drep_cert_to_cbor(
+  const cardano_unregister_drep_cert_t* unregister_drep_cert,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes an unregister DRep certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "drep_credential", "coin".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_unregister_drep_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cert or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unregister_drep_cert_to_cip116_json(
+  const cardano_unregister_drep_cert_t* cert,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Retrieves the stake credential associated with a DRep unregistration certificate.
+ *
+ * This function extracts the stake credential from a given \ref cardano_unregister_drep_cert_t object.
+ * The credential is used to identify the DRep that is being unregistered.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_unregister_drep_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_credential_t object containing the stake credential. If the
+ *         certificate is NULL or if the credential is not set, this function returns NULL. This returned
+ *         object is a new reference and must be released with \ref cardano_credential_unref by the caller when
+ *         it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_unregister_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_credential_t* credential = cardano_unregister_drep_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_unregister_drep_cert_get_credential(cardano_unregister_drep_cert_t* certificate);
+
+/**
+ * \brief Sets the stake credential for a DRep unregistration certificate.
+ *
+ * This function assigns a new stake credential to a specified \ref cardano_unregister_drep_cert_t object.
+ * The credential is crucial for identifying the DRep that is to be unregistered.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_unregister_drep_cert_t object.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object. This function increments
+ *                       the reference count of the credential, and it will be decremented when the certificate
+ *                       no longer uses it or when the certificate is freed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         credential was successfully set, or an appropriate error code indicating the failure reason, such as
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unregister_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_unregister_drep_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Credential set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the credential.\n");
+ * }
+ *
+ * // Cleanup resources as necessary
+ * cardano_credential_unref(&credential); // If no longer needed elsewhere
+ * cardano_unregister_drep_cert_unref(&certificate); // After use
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unregister_drep_cert_set_credential(cardano_unregister_drep_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the deposit amount from an unregistration DRep certificate.
+ *
+ * This function gets the deposit amount that was associated with the DRep unregistration. This amount
+ * represents the funds that were originally locked during the registration and are now subject to refund
+ * upon successful unregistration.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_unregister_drep_cert_t object.
+ *
+ * \return The deposit amount as a uint64_t. Returns 0 if the certificate pointer is NULL or if no deposit
+ *         was recorded.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_unregister_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t deposit = cardano_unregister_drep_cert_get_deposit(certificate);
+ * printf("Deposit amount: %llu ADA\n", deposit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_unregister_drep_cert_get_deposit(const cardano_unregister_drep_cert_t* certificate);
+
+/**
+ * \brief Sets the deposit amount for an unregistration DRep certificate.
+ *
+ * This function sets the deposit amount in the specified \ref cardano_unregister_drep_cert_t object.
+ * The deposit is the amount of funds that will be locked until the unregistration process is completed.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_unregister_drep_cert_t object.
+ * \param[in] deposit The deposit amount to be set, expressed in lovelace (1 ADA = 1,000,000 lovelace).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the deposit was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the certificate pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unregister_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t deposit = 1500000; // 1.5 ADA in lovelace
+ *
+ * cardano_error_t result = cardano_unregister_drep_cert_set_deposit(certificate, deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Deposit set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set deposit: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unregister_drep_cert_set_deposit(cardano_unregister_drep_cert_t* certificate, uint64_t deposit);
+
+/**
+ * \brief Decrements the reference count of a cardano_unregister_drep_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_unregister_drep_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the unregister_drep_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] unregister_drep_cert A pointer to the pointer of the unregister_drep_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unregister_drep_cert_t* unregister_drep_cert = cardano_unregister_drep_cert_new(major, minor);
+ *
+ * // Perform operations with the unregister_drep_cert...
+ *
+ * cardano_unregister_drep_cert_unref(&unregister_drep_cert);
+ * // At this point, unregister_drep_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_unregister_drep_cert_unref, the pointer to the \ref cardano_unregister_drep_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_unregister_drep_cert_unref(cardano_unregister_drep_cert_t** unregister_drep_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_unregister_drep_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_unregister_drep_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_unregister_drep_cert_unref.
+ *
+ * \param unregister_drep_cert A pointer to the cardano_unregister_drep_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming unregister_drep_cert is a previously created unregister_drep_cert object
+ *
+ * cardano_unregister_drep_cert_ref(unregister_drep_cert);
+ *
+ * // Now unregister_drep_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_unregister_drep_cert_ref there is a corresponding
+ * call to \ref cardano_unregister_drep_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_unregister_drep_cert_ref(cardano_unregister_drep_cert_t* unregister_drep_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_unregister_drep_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_unregister_drep_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_unregister_drep_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param unregister_drep_cert A pointer to the cardano_unregister_drep_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_unregister_drep_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_unregister_drep_cert_ref call is matched with a
+ * \ref cardano_unregister_drep_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming unregister_drep_cert is a previously created unregister_drep_cert object
+ *
+ * size_t ref_count = cardano_unregister_drep_cert_refcount(unregister_drep_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_unregister_drep_cert_refcount(const cardano_unregister_drep_cert_t* unregister_drep_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_unregister_drep_cert_t object.
+ *
+ * Records an error message in the unregister_drep_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] unregister_drep_cert A pointer to the \ref cardano_unregister_drep_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the unregister_drep_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_unregister_drep_cert_set_last_error(
+  cardano_unregister_drep_cert_t* unregister_drep_cert,
+  const char*                     message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific unregister_drep_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_unregister_drep_cert_set_last_error for the given
+ * unregister_drep_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] unregister_drep_cert A pointer to the \ref cardano_unregister_drep_cert_t instance whose last error
+ *                   message is to be retrieved. If the unregister_drep_cert is NULL, the function
+ *                   returns a generic error message indicating the null unregister_drep_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified unregister_drep_cert. If the unregister_drep_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_unregister_drep_cert_set_last_error for the same unregister_drep_cert, or until
+ *       the unregister_drep_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_unregister_drep_cert_get_last_error(
+  const cardano_unregister_drep_cert_t* unregister_drep_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_unregister_drep_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_unregister_drep_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_unregister_drep_cert_deep_clone(const cardano_unregister_drep_cert_t* source, cardano_unregister_drep_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // UNREGISTER_DREP_CERT_H
diff --git a/vendor/include/cardano/certs/unregistration_cert.h b/vendor/include/cardano/certs/unregistration_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/unregistration_cert.h
@@ -0,0 +1,482 @@
+/**
+ * \file unregistration_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef UNREGISTRATION_CERT_H
+#define UNREGISTRATION_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used when a stakeholder no longer wants to participate in
+ * staking. It revokes the stake Unregistration and the associated stake is no
+ * longer counted when calculating stake pool rewards.
+ *
+ * Deposit must match the expected deposit amount specified by `ppKeyDepositL` in
+ * the protocol parameters.
+ *
+ * \remark Replaces the deprecated \c cardano_stake_registration_cert_t after Conway era.
+ */
+typedef struct cardano_unregistration_cert_t cardano_unregistration_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new unregistration certificate.
+ *
+ * This function allocates and initializes a new unregistration certificate. The certificate is used to unregister a stake key,
+ * removing it from the blockchain and reclaiming any deposits associated with it.
+ *
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the stake credential.
+ * \param[in] deposit The amount of deposit to be refunded upon successful unregistration, expressed in lovelace (1 ADA = 1,000,000 lovelace).
+ * \param[out] unregistration On successful execution, this will point to a newly created \ref cardano_unregistration_cert_t object.
+ *                             The caller is responsible for managing the lifecycle of this object and must release it using
+ *                             \ref cardano_unregistration_cert_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was
+ *         successfully created, or an appropriate error code indicating the reason for failure (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ * uint64_t deposit = 2000000; // 2 ADA in lovelace
+ * cardano_unregistration_cert_t* unregistration = NULL;
+ *
+ * cardano_error_t result = cardano_unregistration_cert_new(credential, deposit, &unregistration);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The unregistration certificate can now be used for blockchain transactions
+ *   // Remember to free the unregistration certificate when done
+ *   cardano_unregistration_cert_unref(&unregistration);
+ * }
+ * else
+ * {
+ *   printf("Failed to create unregistration certificate: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unregistration_cert_new(
+  cardano_credential_t*           credential,
+  uint64_t                        deposit,
+  cardano_unregistration_cert_t** unregistration);
+
+/**
+ * \brief Creates a \ref cardano_unregistration_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_unregistration_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a unregistration_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] unregistration_cert A pointer to a pointer of \ref cardano_unregistration_cert_t that will be set to the address
+ *                        of the newly created unregistration_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_unregistration_cert_t object by calling
+ *       \ref cardano_unregistration_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_unregistration_cert_t* unregistration_cert = NULL;
+ *
+ * cardano_error_t result = cardano_unregistration_cert_from_cbor(reader, &unregistration_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the unregistration_cert
+ *
+ *   // Once done, ensure to clean up and release the unregistration_cert
+ *   cardano_unregistration_cert_unref(&unregistration_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode unregistration_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unregistration_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_unregistration_cert_t** unregistration_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_unregistration_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] unregistration_cert A constant pointer to the \ref cardano_unregistration_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p unregistration_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unregistration_cert_t* unregistration_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_unregistration_cert_to_cbor(unregistration_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_unregistration_cert_unref(&unregistration_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_unregistration_cert_to_cbor(
+  const cardano_unregistration_cert_t* unregistration_cert,
+  cardano_cbor_writer_t*               writer);
+
+/**
+ * \brief Serializes an unregistration certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "credential", "coin".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_unregistration_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cert or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unregistration_cert_to_cip116_json(
+  const cardano_unregistration_cert_t* cert,
+  cardano_json_writer_t*               writer);
+
+/**
+ * \brief Retrieves the credential associated with an unregistration certificate.
+ *
+ * This function fetches the credential from a given \ref cardano_unregistration_cert_t object. The credential indicates
+ * the stake key being unregistered.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_unregistration_cert_t object.
+ *
+ * \return A pointer to the \ref cardano_credential_t object representing the stake credential. If the input certificate
+ *         pointer is NULL or the certificate does not contain a credential, this function returns NULL.
+ *         Note that the returned credential is a new reference and must be released using \ref cardano_credential_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_unregistration_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = cardano_unregistration_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   printf("No credential found or invalid certificate.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_unregistration_cert_get_credential(cardano_unregistration_cert_t* certificate);
+
+/**
+ * \brief Sets the credential for an unregistration certificate.
+ *
+ * This function assigns a new stake credential to a \ref cardano_unregistration_cert_t object.
+ * The credential specifies the stake key to be unregistered.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_unregistration_cert_t object to which the credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the stake credential to be unregistered.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the credential
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note This function increases the reference count of the credential object; therefore, the caller retain ownership of their respective references.
+ *       It is the caller's responsibility to release their reference to the credential when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unregistration_cert_t* unregistration_cert = ...; // Assume unregistration_cert is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is initialized
+ *
+ * cardano_error_t result = cardano_unregistration_cert_set_credential(unregistration_cert, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The credential is now set for the unregistration_cert
+ * }
+ * else
+ * {
+ *   printf("Failed to set the credential.\n");
+ * }
+ *
+ * // Clean up resources
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unregistration_cert_set_credential(cardano_unregistration_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the deposit amount from an unregistration certificate.
+ *
+ * This function retrieves the deposit amount that was associated with the unregistration certificate
+ * at the time of its creation.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_unregistration_cert_t object.
+ *
+ * \return The deposit amount in lovelaces. If the certificate is NULL, the function will return 0, which should be
+ *         handled appropriately by the caller to distinguish from a genuine deposit of 0 lovelaces.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_unregistration_cert_t* unregistration_cert = ...; // Assume unregistration_cert is already initialized
+ *
+ * uint64_t deposit = cardano_unregistration_cert_get_deposit(unregistration_cert);
+ * printf("Deposit for unregistration: %llu lovelaces\n", deposit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_unregistration_cert_get_deposit(const cardano_unregistration_cert_t* certificate);
+
+/**
+ * \brief Sets the deposit amount for an unregistration certificate.
+ *
+ * This function sets the deposit amount required for unregistration of a stake credential.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_unregistration_cert_t object to which the deposit amount will be set.
+ * \param[in] deposit The deposit amount in lovelaces to set for the unregistration.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the deposit amount was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input certificate pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unregistration_cert_t* unregistration_cert = ...; // Assume unregistration_cert is already initialized
+ * uint64_t deposit = 2000000;
+ *
+ * cardano_error_t result = cardano_unregistration_cert_set_deposit(unregistration_cert, deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Deposit set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set deposit.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unregistration_cert_set_deposit(cardano_unregistration_cert_t* certificate, uint64_t deposit);
+
+/**
+ * \brief Decrements the reference count of a cardano_unregistration_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_unregistration_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the unregistration_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] unregistration_cert A pointer to the pointer of the unregistration_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unregistration_cert_t* unregistration_cert = cardano_unregistration_cert_new(major, minor);
+ *
+ * // Perform operations with the unregistration_cert...
+ *
+ * cardano_unregistration_cert_unref(&unregistration_cert);
+ * // At this point, unregistration_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_unregistration_cert_unref, the pointer to the \ref cardano_unregistration_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_unregistration_cert_unref(cardano_unregistration_cert_t** unregistration_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_unregistration_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_unregistration_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_unregistration_cert_unref.
+ *
+ * \param unregistration_cert A pointer to the cardano_unregistration_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming unregistration_cert is a previously created unregistration_cert object
+ *
+ * cardano_unregistration_cert_ref(unregistration_cert);
+ *
+ * // Now unregistration_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_unregistration_cert_ref there is a corresponding
+ * call to \ref cardano_unregistration_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_unregistration_cert_ref(cardano_unregistration_cert_t* unregistration_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_unregistration_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_unregistration_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_unregistration_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param unregistration_cert A pointer to the cardano_unregistration_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_unregistration_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_unregistration_cert_ref call is matched with a
+ * \ref cardano_unregistration_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming unregistration_cert is a previously created unregistration_cert object
+ *
+ * size_t ref_count = cardano_unregistration_cert_refcount(unregistration_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_unregistration_cert_refcount(const cardano_unregistration_cert_t* unregistration_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_unregistration_cert_t object.
+ *
+ * Records an error message in the unregistration_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] unregistration_cert A pointer to the \ref cardano_unregistration_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the unregistration_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_unregistration_cert_set_last_error(
+  cardano_unregistration_cert_t* unregistration_cert,
+  const char*                    message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific unregistration_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_unregistration_cert_set_last_error for the given
+ * unregistration_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] unregistration_cert A pointer to the \ref cardano_unregistration_cert_t instance whose last error
+ *                   message is to be retrieved. If the unregistration_cert is NULL, the function
+ *                   returns a generic error message indicating the null unregistration_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified unregistration_cert. If the unregistration_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_unregistration_cert_set_last_error for the same unregistration_cert, or until
+ *       the unregistration_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_unregistration_cert_get_last_error(
+  const cardano_unregistration_cert_t* unregistration_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_unregistration_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_unregistration_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_unregistration_cert_deep_clone(const cardano_unregistration_cert_t* source, cardano_unregistration_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // UNREGISTRATION_CERT_H
diff --git a/vendor/include/cardano/certs/update_drep_cert.h b/vendor/include/cardano/certs/update_drep_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/update_drep_cert.h
@@ -0,0 +1,468 @@
+/**
+ * \file update_drep_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef UPDATE_DREP_CERT_H
+#define UPDATE_DREP_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/anchor.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Updates the DRep anchored metadata.
+ */
+typedef struct cardano_update_drep_cert_t cardano_update_drep_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new update drep certificate.
+ *
+ * This function allocates and initializes a new update drep certificate, which is used to propose updates to the drep.
+ *
+ * \param[in] credential A pointer to an initialized cardano_credential_t object representing the credential.
+ * \param[in] anchor A pointer to an initialized cardano_anchor_t object that specifies the context or the anchor point for this update.
+ * \param[out] update_drep_cert A pointer to a pointer where the newly created cardano_update_drep_cert_t object will be stored.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the certificate was successfully created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...; // Assume initialized
+ * cardano_anchor_t* anchor = ...; // Assume initialized
+ * cardano_update_drep_cert_t* update_drep_cert = NULL;
+ * cardano_error_t result = cardano_update_drep_cert_new(credential, anchor, &update_drep_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the update_drep_cert
+ *   // Free resources when done
+ *   cardano_update_drep_cert_unref(&update_drep_cert);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_drep_cert_new(
+  cardano_credential_t*        credential,
+  cardano_anchor_t*            anchor,
+  cardano_update_drep_cert_t** update_drep_cert);
+
+/**
+ * \brief Creates a \ref cardano_update_drep_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_update_drep_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a update_drep_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] update_drep_cert A pointer to a pointer of \ref cardano_update_drep_cert_t that will be set to the address
+ *                        of the newly created update_drep_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_update_drep_cert_t object by calling
+ *       \ref cardano_update_drep_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_update_drep_cert_t* update_drep_cert = NULL;
+ *
+ * cardano_error_t result = cardano_update_drep_cert_from_cbor(reader, &update_drep_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the update_drep_cert
+ *
+ *   // Once done, ensure to clean up and release the update_drep_cert
+ *   cardano_update_drep_cert_unref(&update_drep_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode update_drep_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_drep_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_update_drep_cert_t** update_drep_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_update_drep_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] update_drep_cert A constant pointer to the \ref cardano_update_drep_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p update_drep_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_drep_cert_t* update_drep_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_update_drep_cert_to_cbor(update_drep_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_update_drep_cert_unref(&update_drep_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_update_drep_cert_to_cbor(
+  const cardano_update_drep_cert_t* update_drep_cert,
+  cardano_cbor_writer_t*            writer);
+
+/**
+ * \brief Serializes an update DRep certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "drep_credential", "anchor".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_update_drep_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cert or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_drep_cert_to_cip116_json(const cardano_update_drep_cert_t* cert, cardano_json_writer_t* writer);
+
+/**
+ * \brief Sets the drep credential in the certificate.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_update_drep_cert_t object to which the credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the credential.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the credential was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_update_drep_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The credential is now set for the certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to set the credential.\n");
+ * }
+ * // Both objects need to be managed and eventually unreferenced by the caller
+ * cardano_credential_unref(&credential);
+ * cardano_update_drep_cert_unref(&certificate);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_drep_cert_set_credential(cardano_update_drep_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Gets the credential from an update DRep certificate.
+ *
+ * This function retrieves the credential from a given update DRep certificate. The caller is responsible for
+ * unreferencing the credential object after use.
+ *
+ * \param[in] certificate A pointer to an initialized cardano_update_drep_cert_t object representing the update DRep certificate.
+ *
+ * \return A pointer to the retrieved cardano_credential_t object. This will be a new reference.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_drep_cert_t* certificate = ...; // Assume initialized
+ * cardano_credential_t* credential = cardano_update_drep_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Use the credential
+ *
+ *   // When done, release the credential
+ *   cardano_credential_unref(credential);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t*
+cardano_update_drep_cert_get_credential(cardano_update_drep_cert_t* certificate);
+
+/**
+ * \brief Retrieves the anchor associated with the certificate.
+ *
+ * This function returns the anchor used in a \ref cardano_update_drep_cert_t object.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_update_drep_cert_t object.
+ *
+ * \return A pointer to a \ref cardano_anchor_t object representing the anchor. If the certificate is NULL or does not have an anchor set,
+ *         this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_update_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * const cardano_anchor_t* anchor = cardano_update_drep_cert_get_anchor(certificate);
+ *
+ * if (anchor != NULL)
+ * {
+ *   // Process the anchor information
+ * }
+ * else
+ * {
+ *   printf("No anchor is set for this certificate.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_anchor_t* cardano_update_drep_cert_get_anchor(cardano_update_drep_cert_t* certificate);
+
+/**
+ * \brief Sets the anchor for the certificate.
+ *
+ * This function assigns a new anchor to a given \ref cardano_update_drep_cert_t object.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_update_drep_cert_t object to which the anchor will be set.
+ * \param[in] anchor A pointer to an initialized \ref cardano_anchor_t object representing the new anchor. This function
+ *                    increases the reference count on the anchor, and the certificate will maintain its own reference
+ *                    to the anchor.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the anchor
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_drep_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_anchor_t* new_anchor = ...; // Assume new_anchor is already initialized
+ *
+ * cardano_error_t result = cardano_update_drep_cert_set_anchor(certificate, new_anchor);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Anchor set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the anchor.\n");
+ * }
+ *
+ * // Both certificate and new_anchor need their own unref calls when no longer needed
+ * \endcode
+ *
+ * \note This function increments the reference count of the anchor object passed to it. It is the caller's responsibility
+ *       to manage the lifecycle of both the certificate and the anchor.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_drep_cert_set_anchor(cardano_update_drep_cert_t* certificate, cardano_anchor_t* anchor);
+
+/**
+ * \brief Decrements the reference count of a cardano_update_drep_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_update_drep_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the update_drep_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] update_drep_cert A pointer to the pointer of the update_drep_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_drep_cert_t* update_drep_cert = cardano_update_drep_cert_new(major, minor);
+ *
+ * // Perform operations with the update_drep_cert...
+ *
+ * cardano_update_drep_cert_unref(&update_drep_cert);
+ * // At this point, update_drep_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_update_drep_cert_unref, the pointer to the \ref cardano_update_drep_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_update_drep_cert_unref(cardano_update_drep_cert_t** update_drep_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_update_drep_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_update_drep_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_update_drep_cert_unref.
+ *
+ * \param update_drep_cert A pointer to the cardano_update_drep_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming update_drep_cert is a previously created update_drep_cert object
+ *
+ * cardano_update_drep_cert_ref(update_drep_cert);
+ *
+ * // Now update_drep_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_update_drep_cert_ref there is a corresponding
+ * call to \ref cardano_update_drep_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_update_drep_cert_ref(cardano_update_drep_cert_t* update_drep_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_update_drep_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_update_drep_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_update_drep_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param update_drep_cert A pointer to the cardano_update_drep_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_update_drep_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_update_drep_cert_ref call is matched with a
+ * \ref cardano_update_drep_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming update_drep_cert is a previously created update_drep_cert object
+ *
+ * size_t ref_count = cardano_update_drep_cert_refcount(update_drep_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_update_drep_cert_refcount(const cardano_update_drep_cert_t* update_drep_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_update_drep_cert_t object.
+ *
+ * Records an error message in the update_drep_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] update_drep_cert A pointer to the \ref cardano_update_drep_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the update_drep_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_update_drep_cert_set_last_error(
+  cardano_update_drep_cert_t* update_drep_cert,
+  const char*                 message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific update_drep_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_update_drep_cert_set_last_error for the given
+ * update_drep_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] update_drep_cert A pointer to the \ref cardano_update_drep_cert_t instance whose last error
+ *                   message is to be retrieved. If the update_drep_cert is NULL, the function
+ *                   returns a generic error message indicating the null update_drep_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified update_drep_cert. If the update_drep_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_update_drep_cert_set_last_error for the same update_drep_cert, or until
+ *       the update_drep_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_update_drep_cert_get_last_error(
+  const cardano_update_drep_cert_t* update_drep_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_update_drep_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_update_drep_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_update_drep_cert_deep_clone(const cardano_update_drep_cert_t* source, cardano_update_drep_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // UPDATE_DREP_CERT_H
diff --git a/vendor/include/cardano/certs/vote_delegation_cert.h b/vendor/include/cardano/certs/vote_delegation_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/vote_delegation_cert.h
@@ -0,0 +1,481 @@
+/**
+ * \file vote_delegation_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VOTE_DELEGATION_CERT_H
+#define VOTE_DELEGATION_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/drep.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate is used when an individual wants to delegate their voting rights to any other DRep.
+ */
+typedef struct cardano_vote_delegation_cert_t cardano_vote_delegation_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new vote delegation certificate.
+ *
+ * This function allocates and initializes a new vote delegation certificate, which is used to delegate the voting power
+ * of a stakeholder to a drep.
+ *
+ * \param[in] credential A pointer to an initialized cardano_credential_t object representing the stakeholder's credential.
+ * \param[in] drep A pointer to an initialized cardano_drep_t object representing the delegation representative.
+ * \param[out] vote_delegation A pointer to a pointer where the newly created cardano_vote_delegation_cert_t object will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was successfully created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...; // Assume initialized
+ * cardano_drep_t* drep = ...; // Assume initialized
+ * cardano_vote_delegation_cert_t* vote_delegation = NULL;
+ * cardano_error_t result = cardano_vote_delegation_cert_new(credential, drep, &vote_delegation);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     // Use the vote_delegation
+ *     // Free resources when done
+ *     cardano_vote_delegation_cert_unref(&vote_delegation);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vote_delegation_cert_new(
+  cardano_credential_t*            credential,
+  cardano_drep_t*                  drep,
+  cardano_vote_delegation_cert_t** vote_delegation);
+
+/**
+ * \brief Creates a \ref cardano_vote_delegation_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_vote_delegation_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a vote_delegation_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] vote_delegation_cert A pointer to a pointer of \ref cardano_vote_delegation_cert_t that will be set to the address
+ *                        of the newly created vote_delegation_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_vote_delegation_cert_t object by calling
+ *       \ref cardano_vote_delegation_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_vote_delegation_cert_t* vote_delegation_cert = NULL;
+ *
+ * cardano_error_t result = cardano_vote_delegation_cert_from_cbor(reader, &vote_delegation_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the vote_delegation_cert
+ *
+ *   // Once done, ensure to clean up and release the vote_delegation_cert
+ *   cardano_vote_delegation_cert_unref(&vote_delegation_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode vote_delegation_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vote_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_vote_delegation_cert_t** vote_delegation_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_vote_delegation_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] vote_delegation_cert A constant pointer to the \ref cardano_vote_delegation_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p vote_delegation_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_delegation_cert_t* vote_delegation_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_vote_delegation_cert_to_cbor(vote_delegation_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_vote_delegation_cert_unref(&vote_delegation_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vote_delegation_cert_to_cbor(
+  const cardano_vote_delegation_cert_t* vote_delegation_cert,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes a vote delegation certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "credential", "drep".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_vote_delegation_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cert or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vote_delegation_cert_to_cip116_json(
+  const cardano_vote_delegation_cert_t* cert,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Retrieves the stake credential from a vote delegation certificate.
+ *
+ * This function extracts the stake credential from a given \ref cardano_vote_delegation_cert_t object.
+ * The credential identifies the stakeholder in the context of the Cardano network.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_vote_delegation_cert_t object.
+ *
+ * \return A pointer to a \ref cardano_credential_t object containing the stake credential. If the input certificate is NULL,
+ *         or if the credential is not set, this function returns NULL.
+ *
+ * \note The returned \ref cardano_credential_t object is a new reference and must be managed by the caller.
+ *       It should be released using \ref cardano_credential_unref when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_vote_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = cardano_vote_delegation_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the credential
+ *   // Remember to release the credential reference when done
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve credential or certificate is not initialized properly.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_vote_delegation_cert_get_credential(cardano_vote_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the stake credential for a vote delegation certificate.
+ *
+ * This function assigns a stake credential to a given \ref cardano_vote_delegation_cert_t object.
+ * The credential identifies the stakeholder in the context of the Cardano network.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_vote_delegation_cert_t object
+ *                            where the stake credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the stake credential.
+ *                       This function increments the reference count of the credential, and the caller remains responsible
+ *                       for releasing their own reference.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the stake credential
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_vote_delegation_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Credential successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the credential: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * \endcode
+ *
+ * \note After setting, the certificate holds its own reference to the credential. The caller
+ *       must manage and release its own references to the credential object.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vote_delegation_cert_set_credential(cardano_vote_delegation_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the DRep associated with a vote delegation certificate.
+ *
+ * This function extracts the DRep from the specified \ref cardano_vote_delegation_cert_t object.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_vote_delegation_cert_t object.
+ *
+ * \return A pointer to a new \ref cardano_drep_t object containing the DRep. The caller is responsible
+ *         for managing the lifecycle of this returned DRep object, including releasing it using \ref cardano_drep_unref
+ *         when it is no longer needed. If the certificate is NULL or if the DRep is not set, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_vote_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_drep_t* drep = cardano_vote_delegation_cert_get_drep(certificate);
+ *
+ * if (drep != NULL)
+ * {
+ *   // Process the DRep
+ *   // Remember to free the DRep when done
+ *   cardano_drep_unref(&drep);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_drep_t* cardano_vote_delegation_cert_get_drep(cardano_vote_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the DRep for a vote delegation certificate.
+ *
+ * This function assigns a DRep to the specified \ref cardano_vote_delegation_cert_t object.
+ * The DRep is essential for representing delegate participation in the governance process within the Cardano network.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_vote_delegation_cert_t object which will receive the DRep.
+ * \param[in] drep A pointer to an initialized \ref cardano_drep_t object to be set on the certificate. This function increments the reference
+ *                 count of the DRep, and the caller is still responsible for releasing their reference to the DRep object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the DRep was successfully set,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_drep_t* drep = ...; // Assume drep is already initialized
+ *
+ * cardano_error_t result = cardano_vote_delegation_cert_set_drep(certificate, drep);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The DRep is now set for the certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to set the DRep.\n");
+ * }
+ *
+ * // Both certificate and drep need their references managed appropriately
+ * cardano_drep_unref(&drep);
+ * \endcode
+ *
+ * \note This function increments the reference count of the drep argument, the caller must manage their own reference to it.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vote_delegation_cert_set_drep(cardano_vote_delegation_cert_t* certificate, cardano_drep_t* drep);
+
+/**
+ * \brief Decrements the reference count of a cardano_vote_delegation_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_vote_delegation_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the vote_delegation_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] vote_delegation_cert A pointer to the pointer of the vote_delegation_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_delegation_cert_t* vote_delegation_cert = cardano_vote_delegation_cert_new(major, minor);
+ *
+ * // Perform operations with the vote_delegation_cert...
+ *
+ * cardano_vote_delegation_cert_unref(&vote_delegation_cert);
+ * // At this point, vote_delegation_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_vote_delegation_cert_unref, the pointer to the \ref cardano_vote_delegation_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_vote_delegation_cert_unref(cardano_vote_delegation_cert_t** vote_delegation_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_vote_delegation_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_vote_delegation_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_vote_delegation_cert_unref.
+ *
+ * \param vote_delegation_cert A pointer to the cardano_vote_delegation_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming vote_delegation_cert is a previously created vote_delegation_cert object
+ *
+ * cardano_vote_delegation_cert_ref(vote_delegation_cert);
+ *
+ * // Now vote_delegation_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_vote_delegation_cert_ref there is a corresponding
+ * call to \ref cardano_vote_delegation_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_vote_delegation_cert_ref(cardano_vote_delegation_cert_t* vote_delegation_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_vote_delegation_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_vote_delegation_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_vote_delegation_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param vote_delegation_cert A pointer to the cardano_vote_delegation_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_vote_delegation_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_vote_delegation_cert_ref call is matched with a
+ * \ref cardano_vote_delegation_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming vote_delegation_cert is a previously created vote_delegation_cert object
+ *
+ * size_t ref_count = cardano_vote_delegation_cert_refcount(vote_delegation_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_vote_delegation_cert_refcount(const cardano_vote_delegation_cert_t* vote_delegation_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_vote_delegation_cert_t object.
+ *
+ * Records an error message in the vote_delegation_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] vote_delegation_cert A pointer to the \ref cardano_vote_delegation_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the vote_delegation_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_vote_delegation_cert_set_last_error(
+  cardano_vote_delegation_cert_t* vote_delegation_cert,
+  const char*                     message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific vote_delegation_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_vote_delegation_cert_set_last_error for the given
+ * vote_delegation_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] vote_delegation_cert A pointer to the \ref cardano_vote_delegation_cert_t instance whose last error
+ *                   message is to be retrieved. If the vote_delegation_cert is NULL, the function
+ *                   returns a generic error message indicating the null vote_delegation_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified vote_delegation_cert. If the vote_delegation_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_vote_delegation_cert_set_last_error for the same vote_delegation_cert, or until
+ *       the vote_delegation_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_vote_delegation_cert_get_last_error(
+  const cardano_vote_delegation_cert_t* vote_delegation_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_vote_delegation_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_vote_delegation_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_vote_delegation_cert_deep_clone(const cardano_vote_delegation_cert_t* source, cardano_vote_delegation_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // VOTE_DELEGATION_CERT_H
diff --git a/vendor/include/cardano/certs/vote_registration_delegation_cert.h b/vendor/include/cardano/certs/vote_registration_delegation_cert.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/certs/vote_registration_delegation_cert.h
@@ -0,0 +1,540 @@
+/**
+ * \file vote_registration_delegation_cert.h
+ *
+ * \author angel.castillo
+ * \date   Jul 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VOTE_REGISTRATION_DELEGATION_CERT_H
+#define VOTE_REGISTRATION_DELEGATION_CERT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/drep.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This certificate Register the stake key and delegate with a single certificate to a DRep.
+ */
+typedef struct cardano_vote_registration_delegation_cert_t cardano_vote_registration_delegation_cert_t;
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t cardano_certificate_t;
+
+/**
+ * \brief Creates a new vote registration delegation certificate.
+ *
+ * This function allocates and initializes a new vote registration delegation certificate, which combines stake registration
+ * with a delegation of voting power to a drep.
+ *
+ * \param[in] credential A pointer to an initialized cardano_credential_t object representing the stakeholder's credential.
+ * \param[in] deposit The deposit amount required for the registration, which must be specified according to protocol parameters.
+ * \param[in] drep A pointer to an initialized cardano_drep_t object representing the delegation representative.
+ * \param[out] vote_registration_delegation A pointer to a pointer where the newly created cardano_vote_registration_delegation_cert_t object will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate was successfully created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...; // Assume initialized
+ * uint64_t deposit = 500000; // Specified deposit amount
+ * cardano_drep_t* drep = ...; // Assume initialized
+ * cardano_vote_registration_delegation_cert_t* vote_registration_delegation = NULL;
+ * cardano_error_t result = cardano_vote_registration_delegation_cert_new(credential, deposit, drep, &vote_registration_delegation);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     // Use the vote_registration_delegation
+ *     // Free resources when done
+ *     cardano_vote_registration_delegation_cert_unref(&vote_registration_delegation);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vote_registration_delegation_cert_new(
+  cardano_credential_t*                         credential,
+  uint64_t                                      deposit,
+  cardano_drep_t*                               drep,
+  cardano_vote_registration_delegation_cert_t** vote_registration_delegation);
+
+/**
+ * \brief Creates a \ref cardano_vote_registration_delegation_cert_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_vote_registration_delegation_cert_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a vote_registration_delegation_cert.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] vote_registration_delegation_cert A pointer to a pointer of \ref cardano_vote_registration_delegation_cert_t that will be set to the address
+ *                        of the newly created vote_registration_delegation_cert object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_vote_registration_delegation_cert_t object by calling
+ *       \ref cardano_vote_registration_delegation_cert_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert = NULL;
+ *
+ * cardano_error_t result = cardano_vote_registration_delegation_cert_from_cbor(reader, &vote_registration_delegation_cert);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the vote_registration_delegation_cert
+ *
+ *   // Once done, ensure to clean up and release the vote_registration_delegation_cert
+ *   cardano_vote_registration_delegation_cert_unref(&vote_registration_delegation_cert);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode vote_registration_delegation_cert: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vote_registration_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_vote_registration_delegation_cert_t** vote_registration_delegation_cert);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_vote_registration_delegation_cert_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] vote_registration_delegation_cert A constant pointer to the \ref cardano_vote_registration_delegation_cert_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p vote_registration_delegation_cert or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_vote_registration_delegation_cert_to_cbor(vote_registration_delegation_cert, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_vote_registration_delegation_cert_unref(&vote_registration_delegation_cert);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vote_registration_delegation_cert_to_cbor(
+  const cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert,
+  cardano_cbor_writer_t*                             writer);
+
+/**
+ * \brief Serializes a vote registration delegation certificate to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "credential", "drep", "coin".
+ *
+ * \param[in]  cert    Pointer to a valid \ref cardano_vote_registration_delegation_cert_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cert or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vote_registration_delegation_cert_to_cip116_json(
+  const cardano_vote_registration_delegation_cert_t* cert,
+  cardano_json_writer_t*                             writer);
+
+/**
+ * \brief Retrieves the stake credential from a vote registration delegation certificate.
+ *
+ * This function extracts the stake credential from a given \ref cardano_vote_registration_delegation_cert_t object.
+ * The credential identifies the stakeholder in the context of the Cardano network.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_vote_registration_delegation_cert_t object.
+ *
+ * \return A pointer to a \ref cardano_credential_t object containing the stake credential. If the input certificate is NULL,
+ *         or if the credential is not set, this function returns NULL.
+ *
+ * \note The returned \ref cardano_credential_t object is a new reference and must be managed by the caller.
+ *       It should be released using \ref cardano_credential_unref when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = cardano_vote_registration_delegation_cert_get_credential(certificate);
+ *
+ * if (credential != NULL)
+ * {
+ *   // Process the credential
+ *   // Remember to release the credential reference when done
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve credential or certificate is not initialized properly.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_vote_registration_delegation_cert_get_credential(cardano_vote_registration_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the stake credential for a vote registration delegation certificate.
+ *
+ * This function assigns a stake credential to a given \ref cardano_vote_registration_delegation_cert_t object.
+ * The credential identifies the stakeholder in the context of the Cardano network.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_vote_registration_delegation_cert_t object
+ *                            where the stake credential will be set.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the stake credential.
+ *                       This function increments the reference count of the credential, and the caller remains responsible
+ *                       for releasing their own reference.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the stake credential
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ *
+ * cardano_error_t result = cardano_vote_registration_delegation_cert_set_credential(certificate, credential);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Credential successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the credential: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup performed elsewhere for credential
+ * \endcode
+ *
+ * \note After setting, the certificate holds its own reference to the credential. The caller
+ *       must manage and release its own references to the credential object.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vote_registration_delegation_cert_set_credential(cardano_vote_registration_delegation_cert_t* certificate, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the DRep associated with a vote registration delegation certificate.
+ *
+ * This function extracts the DRep from the specified \ref cardano_vote_registration_delegation_cert_t object.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_vote_registration_delegation_cert_t object.
+ *
+ * \return A pointer to a new \ref cardano_drep_t object containing the DRep. The caller is responsible
+ *         for managing the lifecycle of this returned DRep object, including releasing it using \ref cardano_drep_unref
+ *         when it is no longer needed. If the certificate is NULL or if the DRep is not set, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_drep_t* drep = cardano_vote_registration_delegation_cert_get_drep(certificate);
+ *
+ * if (drep != NULL)
+ * {
+ *   // Process the DRep
+ *   // Remember to free the DRep when done
+ *   cardano_drep_unref(&drep);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_drep_t* cardano_vote_registration_delegation_cert_get_drep(cardano_vote_registration_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the DRep for a vote registration delegation certificate.
+ *
+ * This function assigns a DRep to the specified \ref cardano_vote_registration_delegation_cert_t object.
+ * The DRep is essential for representing delegate participation in the governance process within the Cardano network.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_vote_registration_delegation_cert_t object which will receive the DRep.
+ * \param[in] drep A pointer to an initialized \ref cardano_drep_t object to be set on the certificate. This function increments the reference
+ *                 count of the DRep, and the caller is still responsible for releasing their reference to the DRep object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the DRep was successfully set,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * cardano_drep_t* drep = ...; // Assume drep is already initialized
+ *
+ * cardano_error_t result = cardano_vote_registration_delegation_cert_set_drep(certificate, drep);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The DRep is now set for the certificate
+ * }
+ * else
+ * {
+ *   printf("Failed to set the DRep.\n");
+ * }
+ *
+ * // Both certificate and drep need their references managed appropriately
+ * cardano_drep_unref(&drep);
+ * \endcode
+ *
+ * \note This function increments the reference count of the drep argument, the caller must manage their own reference to it.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vote_registration_delegation_cert_set_drep(cardano_vote_registration_delegation_cert_t* certificate, cardano_drep_t* drep);
+
+/**
+ * \brief Retrieves the deposit amount from a vote registration delegation certificate.
+ *
+ * This function fetches the deposit amount that has been set on a \ref cardano_vote_registration_delegation_cert_t object.
+ * The deposit is a fixed amount required as part of the registration process, acting as a security measure within the Cardano network.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_vote_registration_delegation_cert_t object.
+ *
+ * \return The deposit amount set on the certificate. If the certificate is NULL, the function returns 0,
+ *         which should be checked against possible error returns in real scenarios.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ *
+ * uint64_t deposit = cardano_vote_registration_delegation_cert_get_deposit(certificate);
+ * printf("Deposit amount: %llu ADA\n", deposit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_vote_registration_delegation_cert_get_deposit(const cardano_vote_registration_delegation_cert_t* certificate);
+
+/**
+ * \brief Sets the deposit amount on a vote registration delegation certificate.
+ *
+ * This function updates the deposit amount for a \ref cardano_vote_registration_delegation_cert_t object.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_vote_registration_delegation_cert_t object on which
+ *                            the deposit amount will be set.
+ * \param[in] deposit The deposit amount to be set on the certificate. This amount should align with the protocol's current requirements.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the deposit amount
+ *         was successfully updated, or an appropriate error code indicating the reason for failure, such as
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if the certificate pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_registration_delegation_cert_t* certificate = ...; // Assume certificate is already initialized
+ * uint64_t deposit = 1000000; // 1 ADA, example deposit amount
+ *
+ * cardano_error_t result = cardano_vote_registration_delegation_cert_set_deposit(certificate, deposit);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Deposit amount updated successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set deposit amount.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vote_registration_delegation_cert_set_deposit(cardano_vote_registration_delegation_cert_t* certificate, uint64_t deposit);
+
+/**
+ * \brief Decrements the reference count of a cardano_vote_registration_delegation_cert_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_vote_registration_delegation_cert_t object
+ * by decreasing its reference count. When the reference count reaches zero, the vote_registration_delegation_cert is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] vote_registration_delegation_cert A pointer to the pointer of the vote_registration_delegation_cert object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert = cardano_vote_registration_delegation_cert_new(major, minor);
+ *
+ * // Perform operations with the vote_registration_delegation_cert...
+ *
+ * cardano_vote_registration_delegation_cert_unref(&vote_registration_delegation_cert);
+ * // At this point, vote_registration_delegation_cert is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_vote_registration_delegation_cert_unref, the pointer to the \ref cardano_vote_registration_delegation_cert_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_vote_registration_delegation_cert_unref(cardano_vote_registration_delegation_cert_t** vote_registration_delegation_cert);
+
+/**
+ * \brief Increases the reference count of the cardano_vote_registration_delegation_cert_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_vote_registration_delegation_cert_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_vote_registration_delegation_cert_unref.
+ *
+ * \param vote_registration_delegation_cert A pointer to the cardano_vote_registration_delegation_cert_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming vote_registration_delegation_cert is a previously created vote_registration_delegation_cert object
+ *
+ * cardano_vote_registration_delegation_cert_ref(vote_registration_delegation_cert);
+ *
+ * // Now vote_registration_delegation_cert can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_vote_registration_delegation_cert_ref there is a corresponding
+ * call to \ref cardano_vote_registration_delegation_cert_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_vote_registration_delegation_cert_ref(cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_vote_registration_delegation_cert_t object.
+ *
+ * This function returns the number of active references to an cardano_vote_registration_delegation_cert_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_vote_registration_delegation_cert_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param vote_registration_delegation_cert A pointer to the cardano_vote_registration_delegation_cert_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_vote_registration_delegation_cert_t object. If the object
+ * is properly managed (i.e., every \ref cardano_vote_registration_delegation_cert_ref call is matched with a
+ * \ref cardano_vote_registration_delegation_cert_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming vote_registration_delegation_cert is a previously created vote_registration_delegation_cert object
+ *
+ * size_t ref_count = cardano_vote_registration_delegation_cert_refcount(vote_registration_delegation_cert);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_vote_registration_delegation_cert_refcount(const cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert);
+
+/**
+ * \brief Sets the last error message for a given cardano_vote_registration_delegation_cert_t object.
+ *
+ * Records an error message in the vote_registration_delegation_cert's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] vote_registration_delegation_cert A pointer to the \ref cardano_vote_registration_delegation_cert_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the vote_registration_delegation_cert's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_vote_registration_delegation_cert_set_last_error(
+  cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert,
+  const char*                                  message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific vote_registration_delegation_cert.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_vote_registration_delegation_cert_set_last_error for the given
+ * vote_registration_delegation_cert. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] vote_registration_delegation_cert A pointer to the \ref cardano_vote_registration_delegation_cert_t instance whose last error
+ *                   message is to be retrieved. If the vote_registration_delegation_cert is NULL, the function
+ *                   returns a generic error message indicating the null vote_registration_delegation_cert.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified vote_registration_delegation_cert. If the vote_registration_delegation_cert is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_vote_registration_delegation_cert_set_last_error for the same vote_registration_delegation_cert, or until
+ *       the vote_registration_delegation_cert is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_vote_registration_delegation_cert_get_last_error(
+  const cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_vote_registration_delegation_cert_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_vote_registration_delegation_cert_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_vote_registration_delegation_cert_deep_clone(const cardano_vote_registration_delegation_cert_t* source, cardano_vote_registration_delegation_cert_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // VOTE_REGISTRATION_DELEGATION_CERT_H
diff --git a/vendor/include/cardano/common/anchor.h b/vendor/include/cardano/common/anchor.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/anchor.h
@@ -0,0 +1,753 @@
+/**
+ * \file anchor.h
+ *
+ * \author angel.castillo
+ * \date   Mar 03, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ANCHOR_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ANCHOR_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief An anchor is a pair of:
+ *
+ * - a URL to a JSON payload of metadata.
+ * - a hash of the contents of the metadata URL.
+ *
+ * The on-chain rules will not check either the URL or the hash. Client applications should,
+ * however, perform the usual sanity checks when fetching content from the provided URL.
+ */
+typedef struct cardano_anchor_t cardano_anchor_t;
+
+/**
+ * \brief Creates and initializes a new instance of an anchor.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_anchor_t,
+ * using the provided URL and associated hash. It returns an error code to indicate the
+ * success or failure of the operation.
+ *
+ * \param[in] url A pointer to a character array containing the URL associated with the anchor.
+ * \param[in] url_size The size of the URL character array in bytes.
+ * \param[in] hash A pointer to \ref cardano_blake2b_hash_t representing the hash associated
+ *            with this anchor. The hash must be properly initialized before being
+ *            passed to this function.
+ * \param[out] anchor On successful initialization, this will point to a newly created
+ *            \ref cardano_anchor_t object. This object represents a "strong reference"
+ *            to the anchor, meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the anchor is no longer needed, the caller must release it
+ *            by calling \ref cardano_anchor_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the anchor was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* url = "https://example.com/anchor";
+ * size_t url_size = strlen(url);
+ * cardano_blake2b_hash_t* hash = ...;  // Assume hash is initialized here
+ * cardano_anchor_t* anchor = NULL;
+ *
+ * // Attempt to create a new anchor
+ * cardano_error_t result = cardano_anchor_new(url, url_size, hash, &anchor);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the anchor
+ *
+ *   // Once done, ensure to clean up and release the anchor
+ *   cardano_anchor_unref(&anchor);
+ * }
+ *
+ * cardano_blake2b_hash_unref(&hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_anchor_new(
+  const char*                   url,
+  size_t                        url_size,
+  const cardano_blake2b_hash_t* hash,
+  cardano_anchor_t**            anchor);
+
+/**
+ * \brief Creates an anchor from a hexadecimal hash string.
+ *
+ * This function constructs a \ref cardano_anchor_t object by interpreting the provided
+ * hexadecimal string as a hash value. It returns an error code indicating the success
+ * or failure of the operation.
+ *
+ * \param[in] url A pointer to a character array containing the URL associated with the anchor.
+ * \param[in] url_size The size of the URL string in bytes.
+ * \param[in] hex A pointer to a character array containing the hexadecimal representation of the hash.
+ * \param[in] hex_size The size of the hexadecimal string in bytes.
+ * \param[out] anchor On successful initialization, this will point to a newly created
+ *             \ref cardano_anchor_t object. This object represents a "strong reference"
+ *             to the anchor, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the anchor is no longer needed, the caller must release it
+ *             by calling \ref cardano_anchor_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the anchor was successfully created, or an appropriate error code
+ *         indicating the reason for failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* url = "https://example.com";
+ * size_t url_size = strlen(url);
+ * const char* hash_hex = "abcdef1234567890abcdef1234567890abcdef12...";
+ * size_t hex_size = strlen(hash_hex);
+ * cardano_anchor_t* anchor = NULL;
+ *
+ * // Attempt to create a new anchor from a hexadecimal hash
+ * cardano_error_t result = cardano_anchor_from_hash_hex(url, url_size, hash_hex, hex_size, &anchor);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the anchor
+ *
+ *   // Once done, ensure to clean up and release the anchor
+ *   cardano_anchor_unref(&anchor);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_anchor_from_hash_hex(
+  const char*        url,
+  size_t             url_size,
+  const char*        hex,
+  size_t             hex_size,
+  cardano_anchor_t** anchor);
+
+/**
+ * \brief Creates an anchor from a byte array representing a hash.
+ *
+ * This function constructs a \ref cardano_anchor_t object by using the provided
+ * byte array as a hash value and associating it with a specified URL. It returns an error
+ * code indicating the success or failure of the operation.
+ *
+ * \param[in] url A pointer to the character array containing the URL associated with the anchor.
+ * \param[in] url_size The size of the URL string in bytes.
+ * \param[in] data A pointer to the byte array containing the hash data.
+ * \param[in] data_size The size of the byte array in bytes.
+ * \param[out] anchor On successful initialization, this pointer is set to the newly created
+ *                    \ref cardano_anchor_t object. This object represents a "strong reference"
+ *                    to the anchor, meaning that it is fully initialized and ready for use.
+ *                    The caller is responsible for managing the lifecycle of this object,
+ *                    specifically, once the anchor is no longer needed, the caller must release it
+ *                    by calling \ref cardano_anchor_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the anchor was successfully created, or an appropriate error code
+ *         indicating the reason for failure.
+ *
+ * \note This function assumes that the byte array and URL are correctly formatted and valid.
+ *       Malformed or incorrect input may lead to errors or undefined behavior.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* url = "https://example.com";
+ * size_t url_size = strlen(url);
+ * const byte_t hash_data[] = { 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef ... };
+ * size_t data_size = sizeof(hash_data);
+ * cardano_anchor_t* anchor = NULL;
+ *
+ * // Attempt to create a new anchor from byte array hash
+ * cardano_error_t result = cardano_anchor_from_hash_bytes(url, url_size, hash_data, data_size, &anchor);
+ *
+ * if (result == CARDANO_SUCCESS && anchor)
+ * {
+ *   // Use the anchor
+ *
+ *   // Once done, ensure to clean up and release the anchor
+ *   cardano_anchor_unref(&anchor);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_anchor_from_hash_bytes(
+  const char*        url,
+  size_t             url_size,
+  const byte_t*      data,
+  size_t             data_size,
+  cardano_anchor_t** anchor);
+
+/**
+ * \brief Creates a anchor from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_anchor_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a anchor.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded anchor data.
+ * \param[out] anchor A pointer to a pointer of \ref cardano_anchor_t that will be set to the address
+ *                        of the newly created anchor object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the anchor was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_anchor_t object by calling
+ *       \ref cardano_anchor_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_anchor_t* anchor = NULL;
+ *
+ * cardano_error_t result = cardano_anchor_from_cbor(reader, &anchor);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the anchor
+ *
+ *   // Once done, ensure to clean up and release the anchor
+ *   cardano_anchor_unref(&anchor);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode anchor: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_anchor_from_cbor(cardano_cbor_reader_t* reader, cardano_anchor_t** anchor);
+
+/**
+ * \brief Serializes a anchor into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_anchor_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] anchor A constant pointer to the \ref cardano_anchor_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p anchor or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* anchor = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_anchor_to_cbor(anchor, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_anchor_unref(&anchor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_anchor_to_cbor(
+  const cardano_anchor_t* anchor,
+  cardano_cbor_writer_t*  writer);
+
+/**
+ * \brief Serializes an anchor to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "url", "data_hash".
+ *
+ * \param[in]  anchor  Pointer to a valid \ref cardano_anchor_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p anchor or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_anchor_to_cip116_json(
+  const cardano_anchor_t* anchor,
+  cardano_json_writer_t*  writer);
+
+/**
+ * \brief Retrieves the hash associated with a anchor.
+ *
+ * This function provides access to the hash part of a \ref cardano_anchor_t object.
+ * It returns a new reference to a \ref cardano_blake2b_hash_t object representing the hash.
+ * This allows the hash to be used independently of the original anchor object. The
+ * reference count of the hash object is increased by one, making it the caller's responsibility
+ * to release it by calling \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * \param anchor A constant pointer to the \ref cardano_anchor_t object from which
+ *                   the hash is to be retrieved.
+ *
+ * \return A pointer to a new \ref cardano_blake2b_hash_t object containing the hash.
+ *         If the input anchor is NULL, returns NULL. The caller is responsible for
+ *         managing the lifecycle of this object, including releasing it with
+ *         \ref cardano_blake2b_hash_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* original_anchor = cardano_anchor_new(...);
+ * cardano_blake2b_hash_t* hash_anchor = cardano_anchor_get_hash(original_anchor);
+ *
+ * if (hash_anchor)
+ * {
+ *   // Use the hash anchor
+ *
+ *   // Once done, ensure to clean up and release the hash anchor
+ *   cardano_blake2b_hash_unref(&hash_anchor);
+ * }
+ * // Release the original anchor after use
+ * cardano_anchor_unref(&original_anchor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_anchor_get_hash(const cardano_anchor_t* anchor);
+
+/**
+ * \brief Retrieves the size of the hash bytes stored in the anchor.
+ *
+ * This function computes the size of the hash bytes stored within a \ref cardano_anchor_t object.
+ * It is particularly useful for determining the buffer size needed to store the hash bytes when
+ * retrieving them via \ref cardano_anchor_get_hash_bytes.
+ *
+ * \param[in] anchor A constant pointer to the \ref cardano_anchor_t object from which
+ *                       the size of the hash bytes is to be retrieved.
+ *
+ * \return The size of the hash bytes. If the anchor is NULL the function returns zero.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* anchor = cardano_anchor_new(...);
+ * size_t hash_size = cardano_anchor_get_hash_bytes_size(anchor);
+ *
+ * if (hash_size > 0)
+ * {
+ *   byte_t* hash_bytes = malloc(hash_size);
+ *   if (hash_bytes)
+ *   {
+ *     // Proceed to get the hash bytes
+ *   }
+ * }
+ * cardano_anchor_unref(&anchor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_anchor_get_hash_bytes_size(const cardano_anchor_t* anchor);
+
+/**
+ * \brief Retrieves the byte array representation of the hash from a anchor.
+ *
+ * This function accesses the byte representation of the hash associated with a given
+ * \ref cardano_anchor_t object. It provides a direct pointer to the internal byte array
+ * representing the hash, which should not be modified or freed by the caller.
+ *
+ * \param anchor A constant pointer to the \ref cardano_anchor_t object from which
+ *                   the hash bytes are to be retrieved.
+ *
+ * \return A pointer to a constant byte array containing the hash data. If the input anchor
+ *         is NULL, returns NULL. The data remains valid as long as the anchor object is not
+ *         freed or modified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* anchor = cardano_anchor_new(...);
+ * const byte_t* hash_bytes = cardano_anchor_get_hash_bytes(anchor);
+ *
+ * if (hash_bytes)
+ * {
+ *   // Use the hash bytes for operations like comparison or display
+ * }
+ *
+ * // Clean up the anchor object once done
+ * cardano_anchor_unref(&anchor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_anchor_get_hash_bytes(const cardano_anchor_t* anchor);
+
+/**
+ * \brief Retrieves the size needed for the hexadecimal string representation of the anchor's hash.
+ *
+ * This function calculates the size required to store the hexadecimal string representation of the hash
+ * associated with a \ref cardano_anchor_t object. This size includes the space needed for the null-terminator.
+ *
+ * \param[in] anchor A constant pointer to the \ref cardano_anchor_t object whose hash size is to be determined.
+ *
+ * \return The size in bytes required to store the hexadecimal representation of the hash, including the null terminator.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* anchor = cardano_anchor_new(...);
+ * size_t hex_size = cardano_anchor_get_hash_hex_size(anchor);
+ * char* hex_string = malloc(hex_size);
+ *
+ * if (hex_string)
+ * {
+ *   // Now use hex_string to get the hash or do other operations
+ *   free(hex_string);
+ * }
+ *
+ * cardano_anchor_unref(&anchor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_anchor_get_hash_hex_size(const cardano_anchor_t* anchor);
+
+/**
+ * \brief Retrieves the hexadecimal string representation of the hash from a anchor.
+ *
+ * This function provides access to the hexadecimal (hex) string representation of the hash
+ * associated with a given \ref cardano_anchor_t object. It returns a direct pointer to the
+ * internal hex string which should not be modified or freed by the caller.
+ *
+ * \param anchor A constant pointer to the \ref cardano_anchor_t object from which
+ *                   the hex string of the hash is to be retrieved. The object must not be NULL.
+ *
+ * \return A pointer to a constant character array containing the hex representation of the hash.
+ *         If the input anchor is NULL, returns NULL. The data remains valid as long as the
+ *         anchor object is not freed or modified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* anchor = cardano_anchor_new(...);
+ * const char* hash_hex = cardano_anchor_get_hash_hex(anchor);
+ *
+ * if (hash_hex)
+ * {
+ *   // Use the hash hex for operations like logging, display, or comparison
+ * }
+ *
+ * // Clean up the anchor object once done
+ * cardano_anchor_unref(&anchor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_anchor_get_hash_hex(const cardano_anchor_t* anchor);
+
+/**
+ * \brief Retrieves the size of the URL string stored in the anchor.
+ *
+ * This function calculates the size of the URL string, including the null terminator,
+ * associated with the provided \ref cardano_anchor_t object. This size is necessary
+ * to allocate a buffer large enough to store the URL string.
+ *
+ * \param[in] anchor A constant pointer to the \ref cardano_anchor_t object from which
+ *                   the URL size is to be retrieved.
+ *
+ * \return The size in bytes of the URL string including the null terminator. If the anchor
+ *         is NULL or if there is no URL assigned, returns 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* anchor = ...; // Assume this is initialized
+ * size_t url_size = cardano_anchor_get_url_size(anchor);
+ *
+ * if (url_size > 0)
+ * {
+ *   char* url = malloc(url_size); // Allocate space for the URL
+ *   if (url)
+ *   {
+ *     // Further operations such as fetching the URL can be performed here
+ *     free(url);
+ *   }
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t
+cardano_anchor_get_url_size(const cardano_anchor_t* anchor);
+
+/**
+ * \brief Retrieves the URL from an anchor.
+ *
+ * This function returns the URL associated with a \ref cardano_anchor_t object. The URL is returned
+ * as a pointer to a null-terminated string. This pointer points to internal memory managed by the
+ * anchor object, and therefore should not be modified or freed by the caller.
+ *
+ * \param[in] anchor A constant pointer to the \ref cardano_anchor_t object from which
+ *                   the URL is to be retrieved.
+ *
+ * \return A constant pointer to a null-terminated string containing the URL. If the anchor is NULL
+ *         or if the anchor does not have a URL, returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* anchor = ...; // Assume this is initialized
+ * const char* url = cardano_anchor_get_url(anchor);
+ *
+ * if (url)
+ * {
+ *   printf("Anchor URL: %s\n", url);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve URL from anchor\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char*
+cardano_anchor_get_url(const cardano_anchor_t* anchor);
+
+/**
+ * \brief Sets the URL for an anchor.
+ *
+ * This function assigns a new URL to an existing \ref cardano_anchor_t object. The URL is specified as a character
+ * array and its size. The function copies the URL into the anchor object.
+ *
+ * \param[in,out] anchor A pointer to the \ref cardano_anchor_t object whose URL is to be set.
+ * \param[in] url A pointer to a character array containing the new URL to be set for the anchor.
+ * \param[in] url_size The size of the URL character array in bytes, excluding any null-terminator.
+ *
+ * \return \ref CARDANO_SUCCESS if the URL was successfully set. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         inputs are NULL, \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE if the URL size exceeds internal limits, or
+ *         other error codes as appropriate for other failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* anchor = ...;
+ * const char* url = "https://example.com/new-anchor-url";
+ * size_t url_size = strlen(url);
+ *
+ * cardano_error_t result = cardano_anchor_set_url(anchor, url, url_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     // URL is successfully updated
+ * }
+ *
+ * cardano_anchor_unref(&anchor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_anchor_set_url(cardano_anchor_t* anchor, const char* url, size_t url_size);
+
+/**
+ * \brief Sets the hash for a anchor.
+ *
+ * This function assigns a new hash to an existing \ref cardano_anchor_t object. The hash
+ * represents the identifying data for the anchor.The function copies the provided hash into
+ * the anchor, so the original hash object may be modified or freed after this operation without
+ * affecting the anchor's hash.
+ *
+ * \param[in,out] anchor A pointer to the \ref cardano_anchor_t object whose hash is to be set.
+ *                           This object must have been previously created and not yet freed.
+ * \param[in] hash A pointer to a \ref cardano_blake2b_hash_t object containing the new hash to be set.
+ *                 This parameter must not be NULL.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the hash was successfully set. If the \p anchor or \p hash is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* anchor = ...;
+ * cardano_blake2b_hash_t* new_hash = cardano_blake2b_compute_hash(...);
+ *
+ * cardano_error_t result = cardano_anchor_set_hash(anchor, new_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     // The hash was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_anchor_unref(&anchor);
+ * cardano_blake2b_hash_unref(&new_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_anchor_set_hash(cardano_anchor_t* anchor, const cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Decrements the reference count of a anchor object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_anchor_t object
+ * by decreasing its reference count. When the reference count reaches zero, the anchor is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] anchor A pointer to the pointer of the anchor object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* anchor = cardano_anchor_new();
+ *
+ * // Perform operations with the anchor...
+ *
+ * cardano_anchor_unref(&anchor);
+ * // At this point, anchor is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_anchor_unref, the pointer to the \ref cardano_anchor_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_anchor_unref(cardano_anchor_t** anchor);
+
+/**
+ * \brief Increases the reference count of the cardano_anchor_t object.
+ *
+ * This function is used to manually increment the reference count of a anchor
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_anchor_unref.
+ *
+ * \param anchor A pointer to the anchor object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming anchor is a previously created anchor object
+ *
+ * cardano_anchor_ref(anchor);
+ *
+ * // Now anchor can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_anchor_ref there is a corresponding
+ * call to \ref cardano_anchor_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_anchor_ref(cardano_anchor_t* anchor);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_anchor_t object.
+ *
+ * This function returns the number of active references to a anchor object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_anchor_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param anchor A pointer to the anchor object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified anchor object. If the object
+ * is properly managed (i.e., every \ref cardano_anchor_ref call is matched with a
+ * \ref cardano_anchor_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming anchor is a previously created anchor object
+ *
+ * size_t ref_count = cardano_anchor_refcount(anchor);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_anchor_refcount(const cardano_anchor_t* anchor);
+
+/**
+ * \brief Sets the last error message for a given anchor object.
+ *
+ * Records an error message in the anchor's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the anchor's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_anchor_set_last_error(cardano_anchor_t* anchor, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific anchor.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_anchor_set_last_error for the given
+ * anchor. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t instance whose last error
+ *                   message is to be retrieved. If the anchor is NULL, the function
+ *                   returns a generic error message indicating the null anchor.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified anchor. If the anchor is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_anchor_set_last_error for the same anchor, or until
+ *       the anchor is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_anchor_get_last_error(const cardano_anchor_t* anchor);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_anchor_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_anchor_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_anchor_deep_clone(const cardano_anchor_t* source, cardano_anchor_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ANCHOR_H
diff --git a/vendor/include/cardano/common/bigint.h b/vendor/include/cardano/common/bigint.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/bigint.h
@@ -0,0 +1,2001 @@
+/**
+ * \file bigint.h
+ *
+ * \author luisd.bianchi
+ * \date   Jun 05, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BIGINT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BIGINT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/byte_order.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a large numeric value.
+ *
+ * The \ref cardano_bigint_t type is used for representing numeric values that are too large to be
+ * represented by the standard numeric primitive types, such as int64_t or uint64_t.
+ */
+typedef struct cardano_bigint_t cardano_bigint_t;
+
+/**
+ * \brief Creates a copy of the given bigint object.
+ *
+ * This function duplicates the provided \ref cardano_bigint_t object.
+ *
+ * \param[in] bigint A constant pointer to the original \ref cardano_bigint_t object.
+ * \param[out] clone A pointer to a pointer that will be set to the address of the newly created \ref cardano_bigint_t copy.
+ *
+ * \return \ref CARDANO_SUCCESS if the copy was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = ...; // Assume this is initialized
+ * cardano_bigint_t* clone = NULL;
+ * cardano_error_t result = cardano_bigint_from(original, &clone);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the clone
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&clone);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bigint_clone(const cardano_bigint_t* bigint, cardano_bigint_t** clone);
+
+/**
+ * \brief Creates a bigint from a string representation.
+ *
+ * This function initializes a \ref cardano_bigint_t object from the given string.
+ *
+ * \param[in] string A pointer to the string containing the representation of the bigint.
+ * \param[in] size The maximum number of bytes to read. Parsing stops at the first null
+ * character within this span, if present. A span without a null terminator is also accepted.
+ * \param[in] base The base of the string representation (e.g., 10 for decimal, 16 for hexadecimal).
+ * \param[out] bigint A pointer to a pointer that will be set to the address of the newly created \ref cardano_bigint_t object.
+ *
+ * \return \ref CARDANO_SUCCESS if the bigint was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* str = "1234567892356760";
+ * cardano_bigint_t* bigint = NULL;
+ * cardano_error_t result = cardano_bigint_from_string(str, strlen(str), 10, &bigint);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bigint
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bigint_from_string(const char* string, size_t size, int32_t base, cardano_bigint_t** bigint);
+
+/**
+ * \brief Calculates the size of the string representation of the bigint.
+ *
+ * This function calculates the size of the string needed to represent the given \ref cardano_bigint_t object
+ * in the specified base. The size includes space for the null terminator.
+ *
+ * \param[in] bigint A pointer to the \ref cardano_bigint_t object.
+ * \param[in] base The base to use for the string representation (e.g., 10 for decimal, 16 for hexadecimal).
+ *
+ * \return The size of the string representation, including the null terminator.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = NULL;
+ * cardano_error_t result = cardano_bigint_from_string("1234567892356760", 16, &bigint);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   size_t str_size = cardano_bigint_get_string_size(bigint, 16);
+ *   char* str = (char*)malloc(str_size);
+ *
+ *   if (str != NULL)
+ *   {
+ *     result = cardano_bigint_to_string(bigint, str, str_size);
+ *
+ *     if (result == CARDANO_SUCCESS)
+ *     {
+ *       printf("Bigint string: %s\n", str);
+ *     }
+ *
+ *     free(str);
+ *   }
+ *
+ *   cardano_bigint_unref(&bigint);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t
+cardano_bigint_get_string_size(const cardano_bigint_t* bigint, int32_t base);
+
+/**
+ * \brief Creates a bigint from an integer value.
+ *
+ * This function initializes a \ref cardano_bigint_t object from the given integer value.
+ *
+ * \param[in] value The integer value to convert to a bigint.
+ * \param[out] bigint A pointer to a pointer that will be set to the address of the newly created \ref cardano_bigint_t object.
+ *
+ * \return \ref CARDANO_SUCCESS if the bigint was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * int64_t value = 12345;
+ * cardano_bigint_t* bigint = NULL;
+ * cardano_error_t result = cardano_bigint_from_int(value, &bigint);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bigint
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bigint_from_int(int64_t value, cardano_bigint_t** bigint);
+
+/**
+ * \brief Creates a bigint from an unsigned integer value.
+ *
+ * This function initializes a \ref cardano_bigint_t object from the given unsigned integer value.
+ *
+ * \param[in] value The unsigned integer value to convert to a bigint.
+ * \param[out] bigint A pointer to a pointer that will be set to the address of the newly created \ref cardano_bigint_t object.
+ *
+ * \return \ref CARDANO_SUCCESS if the bigint was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t value = 12345;
+ * cardano_bigint_t* bigint = NULL;
+ *
+ * cardano_error_t result = cardano_bigint_from_unsigned_int(value, &bigint);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bigint
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bigint_from_unsigned_int(uint64_t value, cardano_bigint_t** bigint);
+
+/**
+ * \brief Creates a bigint from a byte array.
+ *
+ * This function initializes a \ref cardano_bigint_t object from the given byte array.
+ * The function also allows specifying the byte order of the input data (big-endian or little-endian).
+ *
+ * \param[in] data A pointer to the byte array containing the representation of the bigint.
+ * \param[in] size The size of the byte array.
+ * \param[in] byte_order An enum value indicating the byte order of the input data.
+ *                       Use \ref CARDANO_BYTE_ORDER_BIG_ENDIAN for big-endian and \ref CARDANO_BYTE_ORDER_LITTLE_ENDIAN for little-endian.
+ * \param[out] bigint A pointer to a pointer that will be set to the address of the newly created \ref cardano_bigint_t object.
+ *
+ * \return \ref CARDANO_SUCCESS if the bigint was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * byte_t bytes[] = { 0x01, 0x02, 0x03 };
+ * cardano_bigint_t* bigint = NULL;
+ * cardano_byte_order_t byte_order = CARDANO_BYTE_ORDER_LITTLE_ENDIAN;
+ *
+ * cardano_error_t result = cardano_bigint_from_bytes(bytes, sizeof(bytes), byte_order, &bigint);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bigint
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bigint_from_bytes(
+  const byte_t*        data,
+  size_t               size,
+  cardano_byte_order_t byte_order,
+  cardano_bigint_t**   bigint);
+
+/**
+ * \brief Converts a bigint to its string representation.
+ *
+ * This function converts a \ref cardano_bigint_t object to a string.
+ *
+ * \param[in] bigint A constant pointer to the \ref cardano_bigint_t object.
+ * \param[out] string A pointer to the buffer where the string representation will be stored.
+ * \param[in] size The size of the buffer.
+ * \param[in] base The numerical base for the string representation. Valid values are from 2 to 36.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code indicating the failure reason.
+ *
+ * \note It is recommended to use \ref cardano_bigint_get_string_size to get the actual size of the string needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = ...; // Assume this is initialized with a value
+ * size_t str_size = cardano_bigint_get_string_size(bigint, 10);
+ * char* buffer = (char*)malloc(str_size);
+ *
+ * cardano_error_t result = cardano_bigint_to_string(bigint, buffer, str_size, 10);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("BigInt as string: %s\n", buffer);
+ * }
+ *
+ * // Clean up
+ * free(buffer);
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bigint_to_string(
+  const cardano_bigint_t* bigint,
+  char*                   string,
+  size_t                  size,
+  int32_t                 base);
+
+/**
+ * \brief Converts a bigint to an integer value.
+ *
+ * This function converts a \ref cardano_bigint_t object to an integer value.
+ *
+ * \param[in] bigint A constant pointer to the \ref cardano_bigint_t object.
+ *
+ * \return The integer value, reduced modulo 2^64 and interpreted as a signed 64-bit
+ * two's-complement value. Returns zero if \p bigint is NULL. Values in the int64_t
+ * range, including INT64_MIN, are returned exactly.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = ...; // Assume this is initialized
+ * int64_t value = cardano_bigint_to_int(bigint);
+ *
+ * // Use the integer value
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT int64_t
+cardano_bigint_to_int(const cardano_bigint_t* bigint);
+
+/**
+ * \brief Converts a bigint to an unsigned integer value.
+ *
+ * This function converts a \ref cardano_bigint_t object to an unsigned integer value.
+ *
+ * \param[in] bigint A constant pointer to the \ref cardano_bigint_t object.
+ *
+ * \return The unsigned integer representation of the \ref cardano_bigint_t object. Only the
+ *         low 64 bits of the magnitude are kept when the value does not fit in an uint64_t.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = ...; // Assume this is initialized
+ * uint64_t value = cardano_bigint_to_unsigned_int(bigint);
+ *
+ * // Use the unsigned integer value
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t
+cardano_bigint_to_unsigned_int(const cardano_bigint_t* bigint);
+
+/**
+ * \brief Gets the size of the byte array needed to represent a bigint.
+ *
+ * This function calculates the size of the byte array required to represent the given \ref cardano_bigint_t object.
+ *
+ * \param[in] bigint A constant pointer to the \ref cardano_bigint_t object.
+ *
+ * \return The size of the byte array needed to represent the bigint.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = ...; // Assume this is initialized
+ * size_t byte_size = cardano_bigint_get_bytes_size(bigint);
+ *
+ * // Use the byte size value
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bigint_get_bytes_size(const cardano_bigint_t* bigint);
+
+/**
+ * \brief Converts a bigint to its byte array representation.
+ *
+ * This function exports the absolute magnitude as an unsigned byte array. Zero is
+ * encoded as one zero byte in either byte order.
+ *
+ * \param[in] bigint A constant pointer to the \ref cardano_bigint_t object.
+ * \param[in] byte_order The byte order for the byte array (big-endian or little-endian).
+ * \param[out] data A pointer to the buffer where the byte array will be stored.
+ * \param[in] size The size of the buffer.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code indicating the failure reason.
+ *
+ * \note It is recommended to use \ref cardano_bigint_get_bytes_size to get the exact size of the byte array needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = ...; // Assume this is initialized with a value
+ * size_t byte_size = cardano_bigint_get_bytes_size(bigint);
+ * byte_t* buffer = (byte_t*)malloc(byte_size);
+ *
+ * cardano_error_t result = cardano_bigint_to_bytes(bigint, CARDANO_BYTE_ORDER_LITTLE_ENDIAN, buffer, byte_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the byte array representation
+ * }
+ *
+ * // Clean up
+ * free(buffer);
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bigint_to_bytes(
+  const cardano_bigint_t* bigint,
+  cardano_byte_order_t    byte_order,
+  byte_t*                 data,
+  size_t                  size);
+
+/**
+ * \brief Adds two bigint objects.
+ *
+ * This function performs addition of two \ref cardano_bigint_t objects and stores the result in a third bigint.
+ *
+ * \param[in] lhs A constant pointer to the first operand.
+ * \param[in] rhs A constant pointer to the second operand.
+ * \param[out] result A pointer to the pre-initialized \ref cardano_bigint_t object where the result will be stored.
+ *                    This is not a factory method; \p result must be pre-initialized and cannot be NULL.
+ *
+ * \remark If any of the pointers (\p lhs, \p rhs, or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* lhs_str = "123456789012345678901234567890";
+ * const char* rhs_str = "987654321098765432109876543210";
+ *
+ * cardano_bigint_t* lhs = NULL;
+ * cardano_bigint_t* rhs = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t lhs_result = cardano_bigint_from_string(lhs_str, strlen(lhs_str), 10, &lhs);
+ * cardano_error_t rhs_result = cardano_bigint_from_string(rhs_str, strlen(rhs_str), 10, &rhs);
+ * cardano_error_t res_result = cardano_bigint_from_int(0, &result); // Initialize result with 0
+ *
+ * if (lhs_result == CARDANO_SUCCESS && rhs_result == CARDANO_SUCCESS && res_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_add(lhs, rhs, result);
+ *
+ *   size_t result_size = cardano_bigint_get_string_size(result, 10);
+ *   char* result_str = (char*)malloc(result_size);
+ *
+ *   cardano_error_t str_result = cardano_bigint_to_string(result, result_str, result_size, 10);
+ *
+ *   if (str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Result of addition: %s\n", result_str); // Should print "1111111110111111111011111111100"
+ *   }
+ *
+ *   free(result_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_add(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Subtracts one bigint object from another.
+ *
+ * This function performs subtraction of two \ref cardano_bigint_t objects and stores the result in a third bigint.
+ *
+ * \param[in] lhs A constant pointer to the minuend.
+ * \param[in] rhs A constant pointer to the subtrahend.
+ * \param[out] result A pointer to the pre-initialized \ref cardano_bigint_t object where the result will be stored.
+ *                    This is not a factory method; \p result must be pre-initialized and cannot be NULL.
+ *
+ * \remark If any of the pointers (\p lhs, \p rhs, or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* lhs_str = "987654321098765432109876543210";
+ * const char* rhs_str = "123456789012345678901234567890";
+ *
+ * cardano_bigint_t* lhs = NULL;
+ * cardano_bigint_t* rhs = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t lhs_result = cardano_bigint_from_string(lhs_str, strlen(lhs_str), 10, &lhs);
+ * cardano_error_t rhs_result = cardano_bigint_from_string(rhs_str, strlen(rhs_str), 10, &rhs);
+ * cardano_error_t res_result = cardano_bigint_from_int(0, &result); // Initialize result with 0
+ *
+ * if (lhs_result == CARDANO_SUCCESS && rhs_result == CARDANO_SUCCESS && res_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_subtract(lhs, rhs, result);
+ *
+ *   size_t result_size = cardano_bigint_get_string_size(result, 10);
+ *   char* result_str = (char*)malloc(result_size);
+ *
+ *   cardano_error_t str_result = cardano_bigint_to_string(result, result_str, result_size, 10);
+ *
+ *   if (str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Result of subtraction: %s\n", result_str); // Should print "864197532086419753208641975320"
+ *   }
+ *
+ *   free(result_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_subtract(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Multiplies two bigint objects.
+ *
+ * This function performs multiplication of two \ref cardano_bigint_t objects and stores the result in a third bigint.
+ *
+ * \param[in] lhs A constant pointer to the first operand.
+ * \param[in] rhs A constant pointer to the second operand.
+ * \param[out] result A pointer to the pre-initialized \ref cardano_bigint_t object where the result will be stored.
+ *                    This is not a factory method; \p result must be pre-initialized and cannot be NULL.
+ *
+ * \remark If any of the pointers (\p lhs, \p rhs, or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* lhs_str = "123456789";
+ * const char* rhs_str = "987654321";
+ *
+ * cardano_bigint_t* lhs = NULL;
+ * cardano_bigint_t* rhs = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t lhs_result = cardano_bigint_from_string(lhs_str, strlen(lhs_str), 10, &lhs);
+ * cardano_error_t rhs_result = cardano_bigint_from_string(rhs_str, strlen(rhs_str), 10, &rhs);
+ * cardano_error_t res_result = cardano_bigint_from_int(0, &result); // Initialize result with 0
+ *
+ * if (lhs_result == CARDANO_SUCCESS && rhs_result == CARDANO_SUCCESS && res_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_multiply(lhs, rhs, result);
+ *
+ *   size_t result_size = cardano_bigint_get_string_size(result, 10);
+ *   char* result_str = (char*)malloc(result_size);
+ *
+ *   cardano_error_t str_result = cardano_bigint_to_string(result, result_str, result_size, 10);
+ *
+ *   if (str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Result of multiplication: %s\n", result_str); // Should print "121932631112635269"
+ *   }
+ *
+ *   free(result_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_multiply(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Divides one bigint object by another.
+ *
+ * This function performs division of two \ref cardano_bigint_t objects and stores the result in a third bigint.
+ *
+ * \param[in] dividend A constant pointer to the dividend.
+ * \param[in] divisor A constant pointer to the divisor.
+ * \param[out] result A pointer to the pre-initialized \ref cardano_bigint_t object where the result will be stored.
+ *                    This is not a factory method; \p result must be pre-initialized and cannot be NULL.
+ *
+ * \remark If any of the pointers (\p dividend, \p divisor, or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* dividend_str = "987654321";
+ * const char* divisor_str = "123456789";
+ *
+ * cardano_bigint_t* dividend = NULL;
+ * cardano_bigint_t* divisor = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t div_result = cardano_bigint_from_string(dividend_str, strlen(dividend_str), 10, &dividend);
+ * cardano_error_t divs_result = cardano_bigint_from_string(divisor_str, strlen(divisor_str), 10, &divisor);
+ * cardano_error_t res_result = cardano_bigint_from_int(0, &result); // Initialize result with 0
+ *
+ * if (div_result == CARDANO_SUCCESS && divs_result == CARDANO_SUCCESS && res_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_divide(dividend, divisor, result);
+ *
+ *   size_t result_size = cardano_bigint_get_string_size(result, 10);
+ *   char* result_str = (char*)malloc(result_size);
+ *
+ *   cardano_error_t str_result = cardano_bigint_to_string(result, result_str, result_size, 10);
+ *
+ *   if (str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Result of division: %s\n", result_str); // Should print "8"
+ *   }
+ *
+ *   free(result_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&dividend);
+ * cardano_bigint_unref(&divisor);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_divide(
+  const cardano_bigint_t* dividend,
+  const cardano_bigint_t* divisor,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Divides one bigint object by another and computes the remainder.
+ *
+ * This function performs division of two \ref cardano_bigint_t objects and stores the quotient in one bigint and the remainder in another bigint.
+ *
+ * \param[in] dividend A constant pointer to the dividend.
+ * \param[in] divisor A constant pointer to the divisor.
+ * \param[out] quotient A pointer to the pre-initialized \ref cardano_bigint_t object where the quotient will be stored.
+ *                      This is not a factory method; \p quotient must be pre-initialized and cannot be NULL.
+ * \param[out] reminder A pointer to the pre-initialized \ref cardano_bigint_t object where the remainder will be stored.
+ *                      This is not a factory method; \p reminder must be pre-initialized and cannot be NULL.
+ *
+ * \remark If any of the pointers (\p dividend, \p divisor, \p quotient, or \p reminder) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* dividend_str = "987654321";
+ * const char* divisor_str = "123456789";
+ *
+ * cardano_bigint_t* dividend = NULL;
+ * cardano_bigint_t* divisor = NULL;
+ * cardano_bigint_t* quotient = NULL;
+ * cardano_bigint_t* reminder = NULL;
+ *
+ * cardano_error_t div_result = cardano_bigint_from_string(dividend_str, strlen(dividend_str), 10, &dividend);
+ * cardano_error_t divs_result = cardano_bigint_from_string(divisor_str, strlen(divisor_str), 10, &divisor);
+ * cardano_error_t quo_result = cardano_bigint_from_int(0, &quotient); // Initialize quotient with 0
+ * cardano_error_t rem_result = cardano_bigint_from_int(0, &reminder); // Initialize reminder with 0
+ *
+ * if (div_result == CARDANO_SUCCESS && divs_result == CARDANO_SUCCESS && quo_result == CARDANO_SUCCESS && rem_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_divide_and_reminder(dividend, divisor, quotient, reminder);
+ *
+ *   size_t quotient_size = cardano_bigint_get_string_size(quotient, 10);
+ *   char* quotient_str = (char*)malloc(quotient_size);
+ *
+ *   cardano_error_t quo_str_result = cardano_bigint_to_string(quotient, quotient_str, quotient_size, 10);
+ *
+ *   size_t reminder_size = cardano_bigint_get_string_size(reminder, 10);
+ *   char* reminder_str = (char*)malloc(reminder_size);
+ *
+ *   cardano_error_t rem_str_result = cardano_bigint_to_string(reminder, reminder_str, reminder_size, 10);
+ *
+ *   if (quo_str_result == CARDANO_SUCCESS && rem_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Quotient: %s\n", quotient_str); // Should print "8"
+ *     printf("Reminder: %s\n", reminder_str); // Should print "9"
+ *   }
+ *
+ *   free(quotient_str);
+ *   free(reminder_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&dividend);
+ * cardano_bigint_unref(&divisor);
+ * cardano_bigint_unref(&quotient);
+ * cardano_bigint_unref(&reminder);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_divide_and_reminder(
+  const cardano_bigint_t* dividend,
+  const cardano_bigint_t* divisor,
+  cardano_bigint_t*       quotient,
+  cardano_bigint_t*       reminder);
+
+/**
+ * \brief Computes the remainder of dividing one bigint object by another.
+ *
+ * This function performs modulo operation on two \ref cardano_bigint_t objects and stores the remainder in a third bigint.
+ *
+ * \param[in] dividend A constant pointer to the dividend.
+ * \param[in] divisor A constant pointer to the divisor.
+ * \param[out] reminder A pointer to the pre-initialized \ref cardano_bigint_t object where the remainder will be stored.
+ *                      This is not a factory method; \p reminder must be pre-initialized and cannot be NULL.
+ *
+ * \remark If any of the pointers (\p dividend, \p divisor, or \p reminder) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* dividend_str = "987654321";
+ * const char* divisor_str = "123456789";
+ *
+ * cardano_bigint_t* dividend = NULL;
+ * cardano_bigint_t* divisor = NULL;
+ * cardano_bigint_t* reminder = NULL;
+ *
+ * cardano_error_t div_result = cardano_bigint_from_string(dividend_str, strlen(dividend_str), 10, &dividend);
+ * cardano_error_t divs_result = cardano_bigint_from_string(divisor_str, strlen(divisor_str), 10, &divisor);
+ * cardano_error_t rem_result = cardano_bigint_from_int(0, &reminder); // Initialize reminder with 0
+ *
+ * if (div_result == CARDANO_SUCCESS && divs_result == CARDANO_SUCCESS && rem_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_reminder(dividend, divisor, reminder);
+ *
+ *   size_t reminder_size = cardano_bigint_get_string_size(reminder, 10);
+ *   char* reminder_str = (char*)malloc(reminder_size);
+ *
+ *   cardano_error_t rem_str_result = cardano_bigint_to_string(reminder, reminder_str, reminder_size, 10);
+ *
+ *   if (rem_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Reminder: %s\n", reminder_str); // Should print "9"
+ *   }
+ *
+ *   free(reminder_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&dividend);
+ * cardano_bigint_unref(&divisor);
+ * cardano_bigint_unref(&reminder);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_reminder(
+  const cardano_bigint_t* dividend,
+  const cardano_bigint_t* divisor,
+  cardano_bigint_t*       reminder);
+
+/**
+ * \brief Computes the absolute value of a bigint.
+ *
+ * This function computes the absolute value of the given \ref cardano_bigint_t object and stores the result in another bigint.
+ *
+ * \param[in] bignum A constant pointer to the bigint object.
+ * \param[out] result A pointer to the pre-initialized \ref cardano_bigint_t object where the result will be stored.
+ *                    This is not a factory method; \p result must be pre-initialized and cannot be NULL.
+ *
+ * \remark If any of the pointers (\p bignum or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* bignum_str = "-123456789";
+ *
+ * cardano_bigint_t* bignum = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t bignum_result = cardano_bigint_from_string(bignum_str, strlen(bignum_str), 10, &bignum);
+ * cardano_error_t abs_result = cardano_bigint_from_int(0, &result); // Initialize result with 0
+ *
+ * if (bignum_result == CARDANO_SUCCESS && abs_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_abs(bignum, result);
+ *
+ *   size_t abs_size = cardano_bigint_get_string_size(result, 10);
+ *   char* abs_str = (char*)malloc(abs_size);
+ *
+ *   cardano_error_t abs_str_result = cardano_bigint_to_string(result, abs_str, abs_size, 10);
+ *
+ *   if (abs_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Absolute value: %s\n", abs_str); // Should print "123456789"
+ *   }
+ *
+ *   free(abs_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bignum);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_abs(const cardano_bigint_t* bignum, cardano_bigint_t* result);
+
+/**
+ * \brief Computes the greatest common divisor (GCD) of two bigints.
+ *
+ * This function computes the GCD of the given \ref cardano_bigint_t objects and stores the result in another bigint.
+ *
+ * \param[in] lhs A constant pointer to the first bigint object.
+ * \param[in] rhs A constant pointer to the second bigint object.
+ * \param[out] result A pointer to the pre-initialized \ref cardano_bigint_t object where the result will be stored.
+ *                    This is not a factory method; \p result must be pre-initialized and cannot be NULL.
+ *
+ * \remark If any of the pointers (\p lhs, \p rhs, or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* lhs_str = "48";
+ * const char* rhs_str = "18";
+ *
+ * cardano_bigint_t* lhs = NULL;
+ * cardano_bigint_t* rhs = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t lhs_result = cardano_bigint_from_string(lhs_str, strlen(lhs_str), 10, &lhs);
+ * cardano_error_t rhs_result = cardano_bigint_from_string(rhs_str, strlen(rhs_str), 10, &rhs);
+ * cardano_error_t gcd_result = cardano_bigint_from_int(0, &result); // Initialize result with 0
+ *
+ * if (lhs_result == CARDANO_SUCCESS && rhs_result == CARDANO_SUCCESS && gcd_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_gcd(lhs, rhs, result);
+ *
+ *   size_t gcd_size = cardano_bigint_get_string_size(result, 10);
+ *   char* gcd_str = (char*)malloc(gcd_size);
+ *
+ *   cardano_error_t gcd_str_result = cardano_bigint_to_string(result, gcd_str, gcd_size, 10);
+ *
+ *   if (gcd_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("GCD: %s\n", gcd_str); // Should print "6"
+ *   }
+ *
+ *   free(gcd_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_gcd(const cardano_bigint_t* lhs, const cardano_bigint_t* rhs, cardano_bigint_t* result);
+
+/**
+ * \brief Negates a bigint.
+ *
+ * This function computes the negation of the given \ref cardano_bigint_t object and stores the result in another bigint.
+ *
+ * \param[in] bignum A constant pointer to the bigint object.
+ * \param[out] result A pointer to the pre-initialized \ref cardano_bigint_t object where the result will be stored.
+ *                    This is not a factory method; \p result must be pre-initialized and cannot be NULL.
+ *
+ * \remark If any of the pointers (\p bignum or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* bignum_str = "12";
+ *
+ * cardano_bigint_t* bignum = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t bignum_result = cardano_bigint_from_string(bignum_str, strlen(bignum_str), 10, &bignum);
+ * cardano_error_t negate_result = cardano_bigint_from_int(0, &result); // Initialize result with 0
+ *
+ * if (bignum_result == CARDANO_SUCCESS && negate_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_negate(bignum, result);
+ *
+ *   size_t neg_size = cardano_bigint_get_string_size(result, 10);
+ *   char* neg_str = (char*)malloc(neg_size);
+ *
+ *   cardano_error_t neg_str_result = cardano_bigint_to_string(result, neg_str, neg_size, 10);
+ *
+ *   if (neg_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Negated value: %s\n", neg_str); // Should print "-12"
+ *   }
+ *
+ *   free(neg_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bignum);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_negate(const cardano_bigint_t* bignum, cardano_bigint_t* result);
+
+/**
+ * \brief Computes the signum function of a bigint.
+ *
+ * This function returns the signum of the given \ref cardano_bigint_t object. The signum function returns:
+ * -1 if the bigint is negative,
+ *  0 if the bigint is zero,
+ *  1 if the bigint is positive.
+ *
+ * \param[in] bignum A constant pointer to the bigint object.
+ *
+ * \return The signum of the bigint as an \c int32_t.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bignum = ...; // Assume this is initialized
+ * int32_t sign = cardano_bigint_signum(bignum);
+ * // Use the sign
+ * // Clean up
+ * cardano_bigint_unref(&bignum);
+ * \endcode
+ */
+CARDANO_EXPORT
+int32_t cardano_bigint_signum(const cardano_bigint_t* bignum);
+
+/**
+ * \brief Computes the remainder of dividing one bigint object by another.
+ *
+ * This function performs the modulo operation on two \ref cardano_bigint_t objects and stores the result in a third bigint.
+ *
+ * \param[in] lhs A constant pointer to the dividend.
+ * \param[in] rhs A constant pointer to the divisor.
+ * \param[out] result A pointer to the bigint object where the result will be stored.
+ *
+ * \remark If any of the pointers (\p lhs, \p rhs, or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the big integers
+ * int64_t lhs_value = 10;
+ * int64_t rhs_value = 3;
+ *
+ * cardano_bigint_t* lhs = NULL;
+ * cardano_bigint_t* rhs = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t lhs_result = cardano_bigint_from_int(lhs_value, &lhs);
+ * cardano_error_t rhs_result = cardano_bigint_from_int(rhs_value, &rhs);
+ * cardano_error_t mod_result = cardano_bigint_from_int(0, &result); // Initialize result with 0
+ *
+ * if (lhs_result == CARDANO_SUCCESS && rhs_result == CARDANO_SUCCESS && mod_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_mod(lhs, rhs, result);
+ *
+ *   size_t res_size = cardano_bigint_get_string_size(result, 10);
+ *   char* res_str = (char*)malloc(res_size);
+ *
+ *   cardano_error_t res_str_result = cardano_bigint_to_string(result, res_str, res_size, 10);
+ *
+ *   if (res_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Modulo result: %s\n", res_str); // Should print "1" for 10 % 3
+ *   }
+ *
+ *   free(res_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_mod(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Computes the result of raising a bigint to the power of another bigint modulo a third bigint.
+ *
+ * This function computes the modular exponentiation of two \ref cardano_bigint_t objects and stores the result in a third bigint.
+ *
+ * \param[in] base A constant pointer to the base bigint.
+ * \param[in] exponent A constant pointer to the exponent bigint.
+ * \param[in] modulus A constant pointer to the modulus bigint.
+ * \param[out] result A pointer to the bigint object where the result will be stored.
+ *
+ * \remark If any of the pointers (\p base, \p exponent, \p modulus, or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the big integers
+ * int64_t base_value = 4;
+ * int64_t exponent_value = 13;
+ * int64_t modulus_value = 497;
+ *
+ * cardano_bigint_t* base = NULL;
+ * cardano_bigint_t* exponent = NULL;
+ * cardano_bigint_t* modulus = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t base_result = cardano_bigint_from_int(base_value, &base);
+ * cardano_error_t exponent_result = cardano_bigint_from_int(exponent_value, &exponent);
+ * cardano_error_t modulus_result = cardano_bigint_from_int(modulus_value, &modulus);
+ * cardano_error_t result_result = cardano_bigint_from_int(0, &result); // Initialize result with 0
+ *
+ * if (base_result == CARDANO_SUCCESS && exponent_result == CARDANO_SUCCESS &&
+ *     modulus_result == CARDANO_SUCCESS && result_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_mod_pow(base, exponent, modulus, result);
+ *
+ *   size_t res_size = cardano_bigint_get_string_size(result, 10);
+ *   char* res_str = (char*)malloc(res_size);
+ *
+ *   cardano_error_t res_str_result = cardano_bigint_to_string(result, res_str, res_size, 10);
+ *
+ *   if (res_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Modular exponentiation result: %s\n", res_str); // Should print "445" for 4^13 % 497
+ *   }
+ *
+ *   free(res_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&base);
+ * cardano_bigint_unref(&exponent);
+ * cardano_bigint_unref(&modulus);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_mod_pow(
+  const cardano_bigint_t* base,
+  const cardano_bigint_t* exponent,
+  const cardano_bigint_t* modulus,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Computes the modular multiplicative inverse of a bigint.
+ *
+ * This function computes the modular multiplicative inverse of a \ref cardano_bigint_t object and stores the result in another bigint.
+ *
+ * \param[in] bignum A constant pointer to the bigint whose modular inverse is to be computed.
+ * \param[in] modulus A constant pointer to the modulus bigint.
+ * \param[out] result A pointer to the bigint object where the result will be stored.
+ *
+ * \remark If any of the pointers (\p bignum, \p modulus, or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the big integers
+ * int64_t bignum_value = 3;
+ * int64_t modulus_value = 11;
+ *
+ * cardano_bigint_t* bignum = NULL;
+ * cardano_bigint_t* modulus = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t bignum_result = cardano_bigint_from_int(bignum_value, &bignum);
+ * cardano_error_t modulus_result = cardano_bigint_from_int(modulus_value, &modulus);
+ * cardano_error_t result_result = cardano_bigint_from_int(0, &result); // Initialize result with 0
+ *
+ * if (bignum_result == CARDANO_SUCCESS && modulus_result == CARDANO_SUCCESS && result_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_mod_inverse(bignum, modulus, result);
+ *
+ *   size_t res_size = cardano_bigint_get_string_size(result, 10);
+ *   char* res_str = (char*)malloc(res_size);
+ *
+ *   cardano_error_t res_str_result = cardano_bigint_to_string(result, res_str, res_size, 10);
+ *
+ *   if (res_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Modular inverse result: %s\n", res_str); // Should print "4" for 3^-1 % 11
+ *   }
+ *
+ *   free(res_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bignum);
+ * cardano_bigint_unref(&modulus);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_mod_inverse(
+  const cardano_bigint_t* bignum,
+  const cardano_bigint_t* modulus,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Performs bitwise AND operation on two bigint objects.
+ *
+ * This function performs bitwise AND of two \ref cardano_bigint_t objects and stores the result in a third bigint.
+ *
+ * \param[in] lhs A constant pointer to the first operand.
+ * \param[in] rhs A constant pointer to the second operand.
+ * \param[out] result A pointer to the bigint object where the result will be stored.
+ *
+ * \remark If any of the pointers (\p lhs, \p rhs, or \p result) is NULL, the operation has no effect. The \p result pointer must be pre-initialized and cannot be NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the big integers
+ * const char* lhs_str = "101010"; // Binary: 101010
+ * const char* rhs_str = "110011"; // Binary: 110011
+ *
+ * cardano_bigint_t* lhs = NULL;
+ * cardano_bigint_t* rhs = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t lhs_result = cardano_bigint_from_string(lhs_str, strlen(lhs_str), 2, &lhs);
+ * cardano_error_t rhs_result = cardano_bigint_from_string(rhs_str, strlen(rhs_str), 2, &rhs);
+ * cardano_error_t res_result = cardano_bigint_from_string("0", 1, 2, &result); // Initialize result with 0
+ *
+ * if (lhs_result == CARDANO_SUCCESS && rhs_result == CARDANO_SUCCESS && res_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_and(lhs, rhs, result);
+ *
+ *   size_t res_size = cardano_bigint_get_string_size(result, 2);
+ *   char* res_str = (char*)malloc(res_size);
+ *
+ *   cardano_error_t res_str_result = cardano_bigint_to_string(result, res_str, res_size, 2);
+ *
+ *   if (res_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Bitwise AND result: %s\n", res_str); // Should print "100010" for 101010 & 110011
+ *   }
+ *
+ *   free(res_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_and(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Performs bitwise OR operation on two bigint objects.
+ *
+ * This function performs bitwise OR of two \ref cardano_bigint_t objects and stores the result in a third bigint.
+ *
+ * \param[in] lhs A constant pointer to the first operand.
+ * \param[in] rhs A constant pointer to the second operand.
+ * \param[out] result A pointer to the bigint object where the result will be stored.
+ *
+ * \remark If any of the pointers (\p lhs, \p rhs, or \p result) is NULL, the operation has no effect. The \p result pointer must be pre-initialized and cannot be NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the big integers
+ * const char* lhs_str = "101010"; // Binary: 101010
+ * const char* rhs_str = "110011"; // Binary: 110011
+ *
+ * cardano_bigint_t* lhs = NULL;
+ * cardano_bigint_t* rhs = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t lhs_result = cardano_bigint_from_string(lhs_str, strlen(lhs_str), 2, &lhs);
+ * cardano_error_t rhs_result = cardano_bigint_from_string(rhs_str, strlen(rhs_str), 2, &rhs);
+ * cardano_error_t res_result = cardano_bigint_from_string("0", 1, 2, &result); // Initialize result with 0
+ *
+ * if (lhs_result == CARDANO_SUCCESS && rhs_result == CARDANO_SUCCESS && res_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_or(lhs, rhs, result);
+ *
+ *   size_t res_size = cardano_bigint_get_string_size(result, 2);
+ *   char* res_str = (char*)malloc(res_size);
+ *
+ *   cardano_error_t res_str_result = cardano_bigint_to_string(result, res_str, res_size, 2);
+ *
+ *   if (res_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Bitwise OR result: %s\n", res_str); // Should print "111011" for 101010 | 110011
+ *   }
+ *
+ *   free(res_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_or(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Performs bitwise XOR operation on two bigint objects.
+ *
+ * This function performs bitwise XOR of two \ref cardano_bigint_t objects and stores the result in a third bigint.
+ *
+ * \param[in] lhs A constant pointer to the first operand.
+ * \param[in] rhs A constant pointer to the second operand.
+ * \param[out] result A pointer to the bigint object where the result will be stored.
+ *
+ * \remark If any of the pointers (\p lhs, \p rhs, or \p result) is NULL, the operation has no effect. The \p result pointer must be pre-initialized and cannot be NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the big integers
+ * const char* lhs_str = "101010"; // Binary: 101010
+ * const char* rhs_str = "110011"; // Binary: 110011
+ *
+ * cardano_bigint_t* lhs = NULL;
+ * cardano_bigint_t* rhs = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t lhs_result = cardano_bigint_from_string(lhs_str, strlen(lhs_str), 2, &lhs);
+ * cardano_error_t rhs_result = cardano_bigint_from_string(rhs_str, strlen(rhs_str), 2, &rhs);
+ * cardano_error_t res_result = cardano_bigint_from_string("0", 1, 2, &result); // Initialize result with 0
+ *
+ * if (lhs_result == CARDANO_SUCCESS && rhs_result == CARDANO_SUCCESS && res_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_xor(lhs, rhs, result);
+ *
+ *   size_t res_size = cardano_bigint_get_string_size(result, 2);
+ *   char* res_str = (char*)malloc(res_size);
+ *
+ *   cardano_error_t res_str_result = cardano_bigint_to_string(result, res_str, res_size, 2);
+ *
+ *   if (res_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Bitwise XOR result: %s\n", res_str); // Should print "011001" for 101010 ^ 110011
+ *   }
+ *
+ *   free(res_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_xor(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Performs bitwise NOT operation on a bigint object.
+ *
+ * This function performs bitwise NOT of a \ref cardano_bigint_t object and stores the result in another bigint.
+ *
+ * \param[in] bigint A constant pointer to the operand.
+ * \param[out] result A pointer to the bigint object where the result will be stored.
+ *
+ * \remark If any of the pointers (\p bigint or \p result) is NULL, the operation has no effect. The \p result pointer must be pre-initialized and cannot be NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the big integers
+ * const char* bigint_str = "101010"; // Binary: 101010
+ *
+ * cardano_bigint_t* bigint = NULL;
+ * cardano_bigint_t* result = NULL;
+ *
+ * cardano_error_t bigint_result = cardano_bigint_from_string(bigint_str, strlen(bigint_str), 2, &bigint);
+ * cardano_error_t res_result = cardano_bigint_from_string("0", 1, 2, &result); // Initialize result with 0
+ *
+ * if (bigint_result == CARDANO_SUCCESS && res_result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_not(bigint, result);
+ *
+ *   size_t res_size = cardano_bigint_get_string_size(result, 2);
+ *   char* res_str = (char*)malloc(res_size);
+ *
+ *   cardano_error_t res_str_result = cardano_bigint_to_string(result, res_str, res_size, 2);
+ *
+ *   if (res_str_result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Bitwise NOT result: %s\n", res_str); // Example result depends on the bit length
+ *   }
+ *
+ *   free(res_str);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_not(
+  const cardano_bigint_t* bigint,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Tests whether a specific bit is set in a bigint object.
+ *
+ * This function checks whether the bit at the specified position in a \ref cardano_bigint_t object is set.
+ *
+ * \param[in] bigint A constant pointer to the bigint object to be tested.
+ * \param[in] n The index of the bit to be tested (0-based).
+ *
+ * \return \c true if the bit at the specified position is set, \c false otherwise.
+ *
+ * \remark If the \p bigint pointer is NULL, the operation has no effect and returns \c false.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the bigint
+ * const char* bigint_str = "101010"; // Binary: 101010 (42 in decimal)
+ *
+ * cardano_bigint_t* bigint = NULL;
+ * cardano_error_t result = cardano_bigint_from_string(bigint_str, strlen(bigint_str), 2, &bigint);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   uint32_t bit_index = 1;
+ *   bool is_set = cardano_bigint_test_bit(bigint, bit_index);
+ *
+ *   if (is_set)
+ *   {
+ *     // The bit at index 1 is set
+ *     printf("Bit at index %u is set.\n", bit_index);
+ *   }
+ *   else
+ *   {
+ *     // The bit at index 1 is not set
+ *     printf("Bit at index %u is not set.\n", bit_index);
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_bigint_test_bit(
+  const cardano_bigint_t* bigint,
+  uint32_t                n);
+
+/**
+ * \brief Sets a specific bit in a bigint object.
+ *
+ * This function sets the bit at the specified position in a \ref cardano_bigint_t object.
+ *
+ * \param[in,out] bigint A pointer to the bigint object in which the bit will be set.
+ * \param[in] n The index of the bit to be set (0-based).
+ *
+ * \remark If the \p bigint pointer is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the bigint
+ * const char* bigint_str = "101010"; // Binary: 101010 (42 in decimal)
+ *
+ * cardano_bigint_t* bigint = NULL;
+ * cardano_error_t result = cardano_bigint_from_string(bigint_str, strlen(bigint_str), 2, &bigint);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   uint32_t bit_index = 5;
+ *   cardano_bigint_set_bit(bigint, bit_index);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_set_bit(
+  cardano_bigint_t* bigint,
+  uint32_t          n);
+
+/**
+ * \brief Clears a specific bit in a bigint object.
+ *
+ * This function clears the bit at the specified position in a \ref cardano_bigint_t object.
+ *
+ * \param[in,out] bigint A pointer to the bigint object in which the bit will be cleared.
+ * \param[in] n The index of the bit to be cleared (0-based).
+ *
+ * \remark If the \p bigint pointer is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the bigint
+ * const char* bigint_str = "111111"; // Binary: 111111 (63 in decimal)
+ *
+ * cardano_bigint_t* bigint = NULL;
+ * cardano_error_t result = cardano_bigint_from_string(bigint_str, strlen(bigint_str), 2, &bigint);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   uint32_t bit_index = 5;
+ *   cardano_bigint_clear_bit(bigint, bit_index);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_clear_bit(
+  cardano_bigint_t* bigint,
+  uint32_t          n);
+
+/**
+ * \brief Flips a specific bit in a bigint object.
+ *
+ * This function toggles the bit at the specified position in a \ref cardano_bigint_t object.
+ * If the bit is 1, it will be changed to 0. If the bit is 0, it will be changed to 1.
+ *
+ * \param[in,out] bigint A pointer to the bigint object in which the bit will be flipped.
+ * \param[in] n The index of the bit to be flipped (0-based).
+ *
+ * \remark If the \p bigint pointer is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the bigint
+ * const char* bigint_str = "101010"; // Binary: 101010 (42 in decimal)
+ *
+ * cardano_bigint_t* bigint = NULL;
+ * cardano_error_t result = cardano_bigint_from_string(bigint_str, strlen(bigint_str), 2, &bigint);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   uint32_t bit_index = 1;
+ *   cardano_bigint_flip_bit(bigint, bit_index);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_flip_bit(
+  cardano_bigint_t* bigint,
+  uint32_t          n);
+
+/**
+ * \brief Returns the number of bits in the two's complement representation of this BigInteger that differ from its sign bit.
+ *
+ * This function computes the number of bits in the two's complement representation of the given \ref cardano_bigint_t object that differ from its sign bit.
+ *
+ * \param[in] bigint A constant pointer to the bigint object.
+ *
+ * \return The number of bits that differ from the sign bit.
+ *
+ * \remark If the \p bigint pointer is NULL, the function returns 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = ...; // Assume this is initialized
+ *
+ * size_t bit_count = cardano_bigint_bit_count(bigint);
+ * printf("The number of bits that differ from the sign bit is: %zu\n", bit_count);
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t
+cardano_bigint_bit_count(const cardano_bigint_t* bigint);
+
+/**
+ * \brief Returns the number of bits required to represent the bigint in a minimal two's-complement form.
+ *
+ * This function calculates the bit length required to represent the integer stored in a \ref cardano_bigint_t object in its minimal two's-complement form.
+ * This count includes the necessary bits for the absolute value of the number and the sign bit.
+ *
+ * \param[in] bigint A constant pointer to the bigint object.
+ *
+ * \return The number of bits required to represent the bigint in two's-complement form, effectively equal to the actual bit length of the integer as stored.
+ * If the bigint pointer is NULL, the function returns 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = ...; // Assume this is initialized
+ *
+ * size_t bit_length = cardano_bigint_bit_length(bigint);
+ * printf("The bit length of the bigint is: %zu\n", bit_length);
+ *
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t
+cardano_bigint_bit_length(const cardano_bigint_t* bigint);
+
+/**
+ * \brief Computes the minimum of two bigint objects.
+ *
+ * This function compares two \ref cardano_bigint_t objects and stores the smaller value in a third bigint object.
+ *
+ * \param[in] lhs A constant pointer to the first operand.
+ * \param[in] rhs A constant pointer to the second operand.
+ * \param[out] result A pointer to the bigint object where the minimum value will be stored.
+ *
+ * \remark If any of the pointers (\p lhs, \p rhs, or \p result) is NULL, the operation has no effect.
+ *
+ * \return \c true if the minimum value was successfully computed and stored in \p result, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* lhs = ...; // Assume these are initialized
+ * cardano_bigint_t* rhs = ...;
+ * cardano_bigint_t* result = ...;
+ *
+ * cardano_bigint_min(lhs, rhs, result);
+ *
+ * // Use the result
+ *
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_min(
+  cardano_bigint_t* lhs,
+  cardano_bigint_t* rhs,
+  cardano_bigint_t* result);
+
+/**
+ * \brief Computes the maximum of two bigint objects.
+ *
+ * This function compares two \ref cardano_bigint_t objects and stores the larger value in a third bigint object.
+ *
+ * \param[in] lhs A constant pointer to the first operand.
+ * \param[in] rhs A constant pointer to the second operand.
+ * \param[out] result A pointer to the bigint object where the maximum value will be stored.
+ *
+ * \remark If any of the pointers (\p lhs, \p rhs, or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* lhs = ...; // Assume these are initialized
+ * cardano_bigint_t* rhs = ...;
+ * cardano_bigint_t* result ...;
+ *
+ * cardano_bigint_max(lhs, rhs, result);
+ * // Use the result
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * cardano_bigint_unref(&result);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_max(
+  cardano_bigint_t* lhs,
+  cardano_bigint_t* rhs,
+  cardano_bigint_t* result);
+
+/**
+ * \brief Performs left bitwise shift on a bigint object.
+ *
+ * This function shifts a \ref cardano_bigint_t object left by the specified number of bits and stores the result in another bigint.
+ *
+ * \param[in] n A constant pointer to the bigint to be shifted.
+ * \param[in] bits The number of bits to shift.
+ * \param[out] result A pointer to the bigint object where the result will be stored.
+ *
+ * \remark If any of the pointers (\p n or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the bigint from a binary string
+ * const char* bigint_str = "1010"; // Binary: 1010 (10 in decimal)
+ * cardano_bigint_t* n = NULL;
+ * cardano_error_t result = cardano_bigint_from_string(bigint_str, strlen(bigint_str), 2, &n);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_t* result_bigint = cardano_bigint_new();
+ *   uint32_t bits = 2;
+ *
+ *   cardano_bigint_shift_left(n, bits, result_bigint);
+ *
+ *   // Convert the result to a string for display
+ *   size_t size = cardano_bigint_get_string_size(result_bigint, 2);
+ *   char* buffer = (char*)malloc(size);
+ *   cardano_bigint_to_string(result_bigint, buffer, size, 2);
+ *
+ *   printf("Result: %s\n", buffer); // Should print: 101000
+ *
+ *   // Clean up
+ *   free(buffer);
+ *   cardano_bigint_unref(&result_bigint);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&n);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_shift_left(
+  const cardano_bigint_t* n,
+  uint32_t                bits,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Performs right bitwise shift on a bigint object.
+ *
+ * This function shifts a \ref cardano_bigint_t object right by the specified number of bits and stores the result in another bigint.
+ *
+ * \param[in] n A constant pointer to the bigint to be shifted.
+ * \param[in] bits The number of bits to shift.
+ * \param[out] result A pointer to the bigint object where the result will be stored.
+ *
+ * \remark If any of the pointers (\p n or \p result) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Initialize the bigint from a binary string
+ * const char* bigint_str = "1010"; // Binary: 1010 (10 in decimal)
+ * cardano_bigint_t* n = NULL;
+ * cardano_error_t result = cardano_bigint_from_string(bigint_str, strlen(bigint_str), 2, &n);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   cardano_bigint_t* result_bigint = cardano_bigint_new();
+ *   uint32_t bits = 2;
+ *
+ *   cardano_bigint_shift_right(n, bits, result_bigint);
+ *
+ *   // Convert the result to a string for display
+ *   size_t size = cardano_bigint_get_string_size(result_bigint, 2);
+ *   char* buffer = (char*)malloc(size);
+ *   cardano_bigint_to_string(result_bigint, buffer, size, 2);
+ *
+ *   printf("Result: %s\n", buffer); // Should print: 10
+ *
+ *   // Clean up
+ *   free(buffer);
+ *   cardano_bigint_unref(&result_bigint);
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&n);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_shift_right(
+  const cardano_bigint_t* n,
+  uint32_t                bits,
+  cardano_bigint_t*       result);
+
+/**
+ * \brief Checks if two bigint objects are equal.
+ *
+ * This function compares two \ref cardano_bigint_t objects to determine if they are equal.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_bigint_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_bigint_t object to be compared.
+ *
+ * \return \c true if the two bigints are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* lhs = ...; // Assume these are initialized
+ * cardano_bigint_t* rhs = ...;
+ * bool are_equal = cardano_bigint_equals(lhs, rhs);
+ *
+ * if (are_equal)
+ * {
+ *   // The two bigints are equal
+ * }
+ *
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_bigint_equals(const cardano_bigint_t* lhs, const cardano_bigint_t* rhs);
+
+/**
+ * \brief Compares two bigint objects.
+ *
+ * This function compares two \ref cardano_bigint_t objects.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_bigint_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_bigint_t object to be compared.
+ *
+ * \return An integer less than, equal to, or greater than zero if \p lhs is found to be less than,
+ * equal to, or greater than \p rhs, respectively.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* lhs = ...; // Assume these are initialized
+ * cardano_bigint_t* rhs = ...;
+ * int32 comparison = cardano_bigint_compare(lhs, rhs);
+ *
+ * if (comparison < 0)
+ * {
+ *   // lhs is less than rhs
+ * }
+ * else if (comparison > 0)
+ * {
+ *   // lhs is greater than rhs
+ * }
+ * else
+ * {
+ *   // lhs is equal to rhs
+ * }
+ * // Clean up
+ * cardano_bigint_unref(&lhs);
+ * cardano_bigint_unref(&rhs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT int32_t cardano_bigint_compare(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs);
+
+/**
+ * \brief Checks if a bigint is zero.
+ *
+ * This function checks if a \ref cardano_bigint_t object is zero.
+ *
+ * \param[in] n A constant pointer to the \ref cardano_bigint_t object to be checked.
+ *
+ * \return 1 if the bigint is zero, 0 otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* n = ...; // Assume this is initialized
+ * bool is_zero = cardano_bigint_is_zero(n);
+ * if (is_zero)
+ * {
+ *   // n is zero
+ * }
+ * else
+ * {
+ *   // n is not zero
+ * }
+ * // Clean up
+ * cardano_bigint_unref(&n);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_bigint_is_zero(const cardano_bigint_t* n);
+
+/**
+ * \brief Increments a bigint.
+ *
+ * This function increments a \ref cardano_bigint_t object by one.
+ *
+ * \param[in,out] n A pointer to the \ref cardano_bigint_t object to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* n = ...; // Assume this is initialized
+ * cardano_bigint_increment(n);
+ * // n is now incremented
+ * // Clean up
+ * cardano_bigint_unref(&n);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_increment(cardano_bigint_t* n);
+
+/**
+ * \brief Decrements a bigint.
+ *
+ * This function decrements a \ref cardano_bigint_t object by one.
+ *
+ * \param[in,out] n A pointer to the \ref cardano_bigint_t object to be decremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* n = ...; // Assume this is initialized
+ * cardano_bigint_decrement(n);
+ * // n is now decremented
+ * // Clean up
+ * cardano_bigint_unref(&n);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_decrement(cardano_bigint_t* n);
+
+/**
+ * \brief Raises a bigint to a nonnegative integer power.
+ *
+ * \param[in] base A constant pointer to the base.
+ * \param[in] exponent The exponent, using the full uint64_t range on every platform.
+ * \param[out] result An initialized bigint that receives the power. May be the same
+ * object as \p base.
+ *
+ * \remark An exponent of zero yields one, including when the base is zero. If
+ * \p base or \p result is NULL, the operation has no effect. The result must fit
+ * in available memory; large powers can require substantial memory and time.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* base = NULL;
+ * cardano_bigint_t* power = NULL;
+ *
+ * if ((cardano_bigint_from_int(2, &base) == CARDANO_SUCCESS) &&
+ *     (cardano_bigint_from_int(0, &power) == CARDANO_SUCCESS))
+ * {
+ *   cardano_bigint_pow(base, 3, power);
+ *   int64_t value = cardano_bigint_to_int(power); // 8
+ * }
+ *
+ * cardano_bigint_unref(&power);
+ * cardano_bigint_unref(&base);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_pow(const cardano_bigint_t* base, uint64_t exponent, cardano_bigint_t* result);
+
+/**
+ * \brief Assigns one bigint to another.
+ *
+ * This function copies the value of one \ref cardano_bigint_t object to another.
+ *
+ * \param[in] source A constant pointer to the source bigint object.
+ * \param[out] destination A pointer to the destination bigint object.
+ *
+ * \remark If any of the pointers (\p source or \p destination) is NULL, the operation has no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* src = ...; // Assume these are initialized
+ * cardano_bigint_t* dst = ...;
+ * cardano_bigint_assign(src, dst);
+ * // dst now has the same value as src
+ * // Clean up
+ * cardano_bigint_unref(&src);
+ * cardano_bigint_unref(&dst);
+ * \endcode
+ */
+CARDANO_EXPORT
+void cardano_bigint_assign(
+  const cardano_bigint_t* destination,
+  cardano_bigint_t*       source);
+
+/**
+ * \brief Decrements the reference count of a bigint object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_bigint_t object
+ * by decreasing its reference count. When the reference count reaches zero, the bigint is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] bigint A pointer to the pointer of the bigint object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = cardano_bigint_new();
+ *
+ * // Perform operations with the bigint...
+ *
+ * cardano_bigint_unref(&bigint);
+ * // At this point, bigint is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_bigint_unref, the pointer to the \ref cardano_bigint_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_bigint_unref(cardano_bigint_t** bigint);
+
+/**
+ * \brief Increases the reference count of the cardano_bigint_t object.
+ *
+ * This function is used to manually increment the reference count of a bigint
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_bigint_unref.
+ *
+ * \param bigint A pointer to the bigint object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming bigint is a previously created bigint object
+ *
+ * cardano_bigint_ref(bigint);
+ *
+ * // Now bigint can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_bigint_ref there is a corresponding
+ * call to \ref cardano_bigint_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_bigint_ref(cardano_bigint_t* bigint);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_bigint_t object.
+ *
+ * This function returns the number of active references to a bigint object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_bigint_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param bigint A pointer to the bigint object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified bigint object. If the object
+ * is properly managed (i.e., every \ref cardano_bigint_ref call is matched with a
+ * \ref cardano_bigint_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming bigint is a previously created bigint object
+ *
+ * size_t ref_count = cardano_bigint_refcount(bigint);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bigint_refcount(const cardano_bigint_t* bigint);
+
+/**
+ * \brief Sets the last error message for a given bigint object.
+ *
+ * Records an error message in the bigint's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] bigint A pointer to the \ref cardano_bigint_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the bigint's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = ...; // Assume this is initialized
+ * cardano_bigint_set_last_error(bigint, "Error message");
+ * // Later, retrieve the error
+ * const char* error = cardano_bigint_get_last_error(bigint);
+ * printf("Error: %s\n", error);
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_bigint_set_last_error(cardano_bigint_t* bigint, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific bigint.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_bigint_set_last_error for the given
+ * bigint. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] bigint A pointer to the \ref cardano_bigint_t instance whose last error
+ *                   message is to be retrieved. If the bigint is NULL, the function
+ *                   returns a generic error message indicating the null bigint.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified bigint. If the bigint is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_bigint_set_last_error for the same bigint, or until
+ *       the bigint is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bigint_t* bigint = ...; // Assume this is initialized
+ * const char* error = cardano_bigint_get_last_error(bigint);
+ * printf("Error: %s\n", error);
+ * // Clean up
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_bigint_get_last_error(const cardano_bigint_t* bigint);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_bigint_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_bigint_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_bigint_deep_clone(const cardano_bigint_t* source, cardano_bigint_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BIGINT_H
diff --git a/vendor/include/cardano/common/byte_order.h b/vendor/include/cardano/common/byte_order.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/byte_order.h
@@ -0,0 +1,59 @@
+/**
+ * \file byte_order.h
+ *
+ * \author luisd.bianchi
+ * \date   Jun 07, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BYTE_ORDER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BYTE_ORDER_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumerates the possible byte order types for endianness interpretation.
+ *
+ * This enumeration is used to specify the byte order of data being processed,
+ * particularly when bytes need to be interpreted as numeric values. It supports
+ * specifying little-endian and big-endian byte orders.
+ */
+typedef enum
+{
+  /**
+   * \brief Little-endian byte order. In this byte_order, the least significant byte (LSB)
+   * is placed at the smallest address, and the most significant byte (MSB) is placed
+   * at the largest address. This is the standard byte order used in x86 processors.
+   */
+  CARDANO_BYTE_ORDER_LITTLE_ENDIAN = 0,
+
+  /**
+   * \brief Big-endian byte order. In this byte_order, the most significant byte (MSB) is
+   * placed at the smallest address, and the least significant byte (LSB) is placed
+   * at the largest address. This is commonly used in network protocols (network byte order).
+   */
+  CARDANO_BYTE_ORDER_BIG_ENDIAN = 1
+} cardano_byte_order_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BYTE_ORDER_H
diff --git a/vendor/include/cardano/common/credential.h b/vendor/include/cardano/common/credential.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/credential.h
@@ -0,0 +1,788 @@
+/**
+ * \file credential.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CREDENTIAL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CREDENTIAL_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential_type.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a credential used in the Cardano blockchain, which can be either a key hash or a script hash.
+ */
+typedef struct cardano_credential_t cardano_credential_t;
+
+/**
+ * \brief Creates and initializes a new instance of a credential.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_credential_t,
+ * using the provided hash and credential type. It returns an error code to indicate success
+ * or failure of the operation.
+ *
+ * \param[in] hash A pointer to \ref cardano_blake2b_hash_t representing the hash associated
+ *             with this credential. The hash must be properly initialized before being
+ *             passed to this function.
+ * \param[in] type The type of credential, as defined in \ref cardano_credential_type_t,
+ *             either a key hash or a script hash.
+ * \param[out] credential On successful initialization, this will point to a newly created
+ *             \ref cardano_credential_t object. This object represents a "strong reference"
+ *             to the credential, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the credential is no longer needed, the caller must release it
+ *             by calling \ref cardano_credential_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the credential was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* hash = { ... };  // Assume hash is initialized here
+ * cardano_credential_t* credential = NULL;
+ *
+ * // Attempt to create a new credential
+ * cardano_error_t result = cardano_credential_new(hash, CARDANO_CREDENTIAL_TYPE_KEY_HASH, &credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ *
+ * cardano_blake2b_hash_unref(&hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_credential_new(
+  const cardano_blake2b_hash_t* hash,
+  cardano_credential_type_t     type,
+  cardano_credential_t**        credential);
+
+/**
+ * \brief Creates a credential from a hexadecimal hash string.
+ *
+ * This function constructs a \ref cardano_credential_t object by interpreting the provided
+ * hexadecimal string as a hash value and associating it with a specified credential type. It
+ * returns an error code indicating the success or failure of the operation.
+ *
+ * \param[in] hex A pointer to a character array containing the hexadecimal representation of the hash.
+ * \param[in] hex_size The size of the hexadecimal string in bytes.
+ * \param[in] type The type of credential, as defined in \ref cardano_credential_type_t,
+ *                 which determines how the hash is to be treated (e.g., as a key hash or a script hash).
+ * \param[out] credential On successful initialization, this will point to a newly created
+ *                 \ref cardano_credential_t object. This object represents a "strong reference"
+ *                 to the credential, meaning that it is fully initialized and ready for use.
+ *                 The caller is responsible for managing the lifecycle of this object,
+ *                 specifically, once the credential is no longer needed, the caller must release it
+ *                 by calling \ref cardano_credential_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the credential was successfully created, or an appropriate error code
+ *         indicating the reason for failure.
+ *
+ * \note The function assumes that the hexadecimal string is valid and correctly formatted.
+ *       Malformed input may lead to incorrect or undefined behavior.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* hash_hex = "abcdef1234567890abcdef1234567890abcdef12....";
+ * size_t hex_size = strlen(hash_hex);
+ * cardano_credential_t* credential = NULL;
+ *
+ * // Attempt to create a new credential from a hexadecimal hash
+ * cardano_error_t result = cardano_credential_from_hash_hex(hash_hex, hex_size, CARDANO_CREDENTIAL_TYPE_KEY_HASH, &credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_credential_from_hash_hex(
+  const char*               hex,
+  size_t                    hex_size,
+  cardano_credential_type_t type,
+  cardano_credential_t**    credential);
+
+/**
+ * \brief Creates a credential from a byte array representing a hash.
+ *
+ * This function constructs a \ref cardano_credential_t object by using the provided
+ * byte array as a hash value and associating it with a specified credential type. It
+ * returns an error code indicating the success or failure of the operation.
+ *
+ * \param[in] data A pointer to the byte array containing the hash data.
+ * \param[in] data_size The size of the byte array in bytes.
+ * \param[in] type The type of credential, as defined in \ref cardano_credential_type_t,
+ *                 which determines how the hash is to be treated (e.g., as a key hash or a script hash).
+ * \param[out] credential On successful initialization, this will point to a newly created
+ *                 \ref cardano_credential_t object. This object represents a "strong reference"
+ *                 to the credential, meaning that it is fully initialized and ready for use.
+ *                 The caller is responsible for managing the lifecycle of this object,
+ *                 specifically, once the credential is no longer needed, the caller must release it
+ *                 by calling \ref cardano_credential_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the credential was successfully created, or an appropriate error code
+ *         indicating the reason for failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t hash_data[] = { 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef ... };
+ * size_t data_size = sizeof(hash_data);
+ * cardano_credential_t* credential = NULL;
+ *
+ * // Attempt to create a new credential from byte array hash
+ * cardano_error_t result = cardano_credential_from_hash_bytes(hash_data, data_size, CARDANO_CREDENTIAL_TYPE_KEY_HASH, &credential);
+ *
+ * if (result == CARDANO_SUCCESS && credential)
+ * {
+ *   // Use the credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_credential_from_hash_bytes(
+  const byte_t*             data,
+  size_t                    data_size,
+  cardano_credential_type_t type,
+  cardano_credential_t**    credential);
+
+/**
+ * \brief Creates a credential from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_credential_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a credential.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded credential data.
+ * \param[out] credential A pointer to a pointer of \ref cardano_credential_t that will be set to the address
+ *                        of the newly created credential object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the credential was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_credential_t object by calling
+ *       \ref cardano_credential_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_credential_t* credential = NULL;
+ *
+ * cardano_error_t result = cardano_credential_from_cbor(reader, &credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode credential: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_credential_from_cbor(cardano_cbor_reader_t* reader, cardano_credential_t** credential);
+
+/**
+ * \brief Serializes a credential into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_credential_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] credential A constant pointer to the \ref cardano_credential_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p credential or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_credential_to_cbor(credential, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_credential_to_cbor(
+  const cardano_credential_t* credential,
+  cardano_cbor_writer_t*      writer);
+
+/**
+ * \brief Serializes a credential to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ *
+ * \param[in]  credential  Pointer to a valid \ref cardano_credential_t.
+ * \param[in]  writer      Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ *         CARDANO_ERROR_POINTER_IS_NULL  If \p credential or \p writer is NULL.
+ *         CARDANO_ERROR_ENCODING         If the credential is malformed (e.g., missing hash).
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_credential_to_cip116_json(
+  const cardano_credential_t* credential,
+  cardano_json_writer_t*      writer);
+
+/**
+ * \brief Retrieves the hash associated with a credential.
+ *
+ * This function provides access to the hash part of a \ref cardano_credential_t object.
+ * It returns a new reference to a \ref cardano_blake2b_hash_t object representing the hash.
+ * This allows the hash to be used independently of the original credential object. The
+ * reference count of the hash object is increased by one, making it the caller's responsibility
+ * to release it by calling \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * \param credential A constant pointer to the \ref cardano_credential_t object from which
+ *                   the hash is to be retrieved.
+ *
+ * \return A pointer to a new \ref cardano_blake2b_hash_t object containing the hash.
+ *         If the input credential is NULL, returns NULL. The caller is responsible for
+ *         managing the lifecycle of this object, including releasing it with
+ *         \ref cardano_blake2b_hash_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* original_credential = cardano_credential_new(...);
+ * cardano_blake2b_hash_t* hash_credential = cardano_credential_get_hash(original_credential);
+ *
+ * if (hash_credential)
+ * {
+ *   // Use the hash credential
+ *
+ *   // Once done, ensure to clean up and release the hash credential
+ *   cardano_blake2b_hash_unref(&hash_credential);
+ * }
+ * // Release the original credential after use
+ * cardano_credential_unref(&original_credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_credential_get_hash(const cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the size of the hash bytes stored in the credential.
+ *
+ * This function computes the size of the hash bytes stored within a \ref cardano_credential_t object.
+ * It is particularly useful for determining the buffer size needed to store the hash bytes when
+ * retrieving them via \ref cardano_credential_get_hash_bytes.
+ *
+ * \param[in] credential A constant pointer to the \ref cardano_credential_t object from which
+ *                       the size of the hash bytes is to be retrieved.
+ *
+ * \return The size of the hash bytes. If the credential is NULL the function returns zero.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = cardano_credential_new(...);
+ * size_t hash_size = cardano_credential_get_hash_bytes_size(credential);
+ *
+ * if (hash_size > 0)
+ * {
+ *   byte_t* hash_bytes = malloc(hash_size);
+ *   if (hash_bytes)
+ *   {
+ *     // Proceed to get the hash bytes
+ *   }
+ * }
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_credential_get_hash_bytes_size(const cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the byte array representation of the hash from a credential.
+ *
+ * This function accesses the byte representation of the hash associated with a given
+ * \ref cardano_credential_t object. It provides a direct pointer to the internal byte array
+ * representing the hash, which should not be modified or freed by the caller.
+ *
+ * \param credential A constant pointer to the \ref cardano_credential_t object from which
+ *                   the hash bytes are to be retrieved.
+ *
+ * \return A pointer to a constant byte array containing the hash data. If the input credential
+ *         is NULL, returns NULL. The data remains valid as long as the credential object is not
+ *         freed or modified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = cardano_credential_new(...);
+ * const byte_t* hash_bytes = cardano_credential_get_hash_bytes(credential);
+ *
+ * if (hash_bytes)
+ * {
+ *   // Use the hash bytes for operations like comparison or display
+ * }
+ *
+ * // Clean up the credential object once done
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_credential_get_hash_bytes(const cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the size needed for the hexadecimal string representation of the credential's hash.
+ *
+ * This function calculates the size required to store the hexadecimal string representation of the hash
+ * associated with a \ref cardano_credential_t object. This size includes the space needed for the null-terminator.
+ *
+ * \param[in] credential A constant pointer to the \ref cardano_credential_t object whose hash size is to be determined.
+ *
+ * \return The size in bytes required to store the hexadecimal representation of the hash, including the null terminator.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = cardano_credential_new(...);
+ * size_t hex_size = cardano_credential_get_hash_hex_size(credential);
+ * char* hex_string = malloc(hex_size);
+ *
+ * if (hex_string)
+ * {
+ *   // Now use hex_string to get the hash or do other operations
+ *   free(hex_string);
+ * }
+ *
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_credential_get_hash_hex_size(const cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the hexadecimal string representation of the hash from a credential.
+ *
+ * This function provides access to the hexadecimal (hex) string representation of the hash
+ * associated with a given \ref cardano_credential_t object. It returns a direct pointer to the
+ * internal hex string which should not be modified or freed by the caller.
+ *
+ * \param credential A constant pointer to the \ref cardano_credential_t object from which
+ *                   the hex string of the hash is to be retrieved. The object must not be NULL.
+ *
+ * \return A pointer to a constant character array containing the hex representation of the hash.
+ *         If the input credential is NULL, returns NULL. The data remains valid as long as the
+ *         credential object is not freed or modified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = cardano_credential_new(...);
+ * const char* hash_hex = cardano_credential_get_hash_hex(credential);
+ *
+ * if (hash_hex)
+ * {
+ *   // Use the hash hex for operations like logging, display, or comparison
+ * }
+ *
+ * // Clean up the credential object once done
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_credential_get_hash_hex(const cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the type of the credential.
+ *
+ * This function retrieves the type of a given \ref cardano_credential_t object and stores it in the provided
+ * output parameter. The credential type is defined in the \ref cardano_credential_type_t enumeration, which
+ * specifies whether the credential is a key hash or a script hash.
+ *
+ * \param[in] credential A constant pointer to the \ref cardano_credential_t object from which
+ *                       the type is to be retrieved. The object must not be NULL.
+ * \param[out] type Pointer to a variable where the credential type will be stored. This variable will
+ *                  be set to the value from the \ref cardano_credential_type_t enumeration.
+ *
+ * \return CARDANO_SUCCESS if the type was successfully retrieved, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = cardano_credential_new(...);
+ * cardano_credential_type_t type;
+ * cardano_error_t result = cardano_credential_get_type(credential, &type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (type == CARDANO_CREDENTIAL_TYPE_KEY_HASH)
+ *   {
+ *     // Handle key hash type credential
+ *   }
+ *   else if (type == CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH)
+ *   {
+ *     // Handle script hash type credential
+ *   }
+ * }
+ *
+ * // Clean up the credential object once done
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_credential_get_type(const cardano_credential_t* credential, cardano_credential_type_t* type);
+
+/**
+ * \brief Sets the type of the credential.
+ *
+ * This function assigns a new type to an existing \ref cardano_credential_t object. The type is specified
+ * by the \ref cardano_credential_type_t enumeration, which indicates whether the credential is derived from
+ * a public key hash or a script hash.
+ *
+ * \param[in,out] credential A pointer to the \ref cardano_credential_t object whose type is to be set.
+ * \param[in] type The new type of the credential, as defined in the \ref cardano_credential_type_t enumeration.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the type was successfully set. Returns \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p credential pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = cardano_credential_new(...);
+ * cardano_error_t result = cardano_credential_set_type(credential, CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Credential type updated successfully
+ * }
+ *
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_credential_set_type(cardano_credential_t* credential, cardano_credential_type_t type);
+
+/**
+ * \brief Sets the hash for a credential.
+ *
+ * This function assigns a new hash to an existing \ref cardano_credential_t object. The hash
+ * represents the identifying data for the credential.The function copies the provided hash into
+ * the credential, so the original hash object may be modified or freed after this operation without
+ * affecting the credential's hash.
+ *
+ * \param[in,out] credential A pointer to the \ref cardano_credential_t object whose hash is to be set.
+ *                           This object must have been previously created and not yet freed.
+ * \param[in] hash A pointer to a \ref cardano_blake2b_hash_t object containing the new hash to be set.
+ *                 This parameter must not be NULL.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the hash was successfully set. If the \p credential or \p hash is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...;
+ * cardano_blake2b_hash_t* new_hash = cardano_blake2b_compute_hash(...);
+ *
+ * cardano_error_t result = cardano_credential_set_hash(credential, new_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     // The hash was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_credential_unref(&credential);
+ * cardano_blake2b_hash_unref(&new_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_credential_set_hash(cardano_credential_t* credential, const cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Compares two credential objects for equality.
+ *
+ * This function compares two credential objects to determine if they are equal.
+ *
+ * \param[in] lhs Pointer to the first credential object.
+ * \param[in] rhs Pointer to the second credential object.
+ *
+ * \return \c true if the credential objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential1 = NULL;
+ * cardano_credential_t* credential2 = NULL;
+ *
+ * // Assume credential1 and credential2 are initialized properly
+ *
+ * bool are_equal = cardano_credential_equals(credential1, credential2);
+ *
+ * if (are_equal)
+ * {
+ *   printf("The credential objects are equal.\n");
+ * }
+ * else
+ * {
+ *   printf("The credential objects are not equal.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_credential_unref(&credential1);
+ * cardano_credential_unref(&credential2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_credential_equals(
+  const cardano_credential_t* lhs,
+  const cardano_credential_t* rhs);
+
+/**
+ * \brief Compares two credential objects.
+ *
+ * This function compares two credential objects and returns an integer indicating
+ * their relative order.
+ *
+ * \param[in] lhs Pointer to the first credential object.
+ * \param[in] rhs Pointer to the second credential object.
+ *
+ * \return A negative value if lhs is less than rhs, zero if they are equal, and a positive value if lhs is greater than rhs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential1 = NULL;
+ * cardano_credential_t* credential2 = NULL;
+ *
+ * // Assume credential1 and credential2 are initialized properly
+ *
+ * int32_t comparison = cardano_credential_compare(credential1, credential2);
+ * if (comparison < 0)
+ * {
+ *   printf("credential1 is less than credential2.\n");
+ * }
+ * else if (comparison == 0)
+ * {
+ *   printf("credential1 is equal to credential2.\n");
+ * }
+ * else
+ * {
+ *   printf("credential1 is greater than credential2.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_credential_unref(&credential1);
+ * cardano_credential_unref(&credential2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT int32_t cardano_credential_compare(
+  const cardano_credential_t* lhs,
+  const cardano_credential_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a credential object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_credential_t object
+ * by decreasing its reference count. When the reference count reaches zero, the credential is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] credential A pointer to the pointer of the credential object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = cardano_credential_new();
+ *
+ * // Perform operations with the credential...
+ *
+ * cardano_credential_unref(&credential);
+ * // At this point, credential is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_credential_unref, the pointer to the \ref cardano_credential_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_credential_unref(cardano_credential_t** credential);
+
+/**
+ * \brief Increases the reference count of the cardano_credential_t object.
+ *
+ * This function is used to manually increment the reference count of a credential
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_credential_unref.
+ *
+ * \param credential A pointer to the credential object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming credential is a previously created credential object
+ *
+ * cardano_credential_ref(credential);
+ *
+ * // Now credential can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_credential_ref there is a corresponding
+ * call to \ref cardano_credential_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_credential_ref(cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_credential_t object.
+ *
+ * This function returns the number of active references to a credential object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_credential_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param credential A pointer to the credential object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified credential object. If the object
+ * is properly managed (i.e., every \ref cardano_credential_ref call is matched with a
+ * \ref cardano_credential_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming credential is a previously created credential object
+ *
+ * size_t ref_count = cardano_credential_refcount(credential);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_credential_refcount(const cardano_credential_t* credential);
+
+/**
+ * \brief Sets the last error message for a given credential object.
+ *
+ * Records an error message in the credential's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] credential A pointer to the \ref cardano_credential_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the credential's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_credential_set_last_error(cardano_credential_t* credential, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific credential.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_credential_set_last_error for the given
+ * credential. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] credential A pointer to the \ref cardano_credential_t instance whose last error
+ *                   message is to be retrieved. If the credential is NULL, the function
+ *                   returns a generic error message indicating the null credential.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified credential. If the credential is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_credential_set_last_error for the same credential, or until
+ *       the credential is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_credential_get_last_error(const cardano_credential_t* credential);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_credential_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_credential_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_credential_deep_clone(const cardano_credential_t* source, cardano_credential_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CREDENTIAL_H
diff --git a/vendor/include/cardano/common/credential_type.h b/vendor/include/cardano/common/credential_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/credential_type.h
@@ -0,0 +1,49 @@
+/**
+ * \file credential_type.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CREDENTIAL_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CREDENTIAL_TYPE_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumerates the types of credentials.
+ */
+typedef enum
+{
+  /** Credential is a hash of a public key.
+   */
+  CARDANO_CREDENTIAL_TYPE_KEY_HASH = 0,
+
+  /** Credential is a hash of a script.
+   */
+  CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH = 1
+} cardano_credential_type_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CREDENTIAL_TYPE_H
diff --git a/vendor/include/cardano/common/datum.h b/vendor/include/cardano/common/datum.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/datum.h
@@ -0,0 +1,801 @@
+/**
+ * \file datum.h
+ *
+ * \author luisd.bianchi
+ * \date   May 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_DATUM_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_DATUM_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/datum_type.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a piece of data attached to a UTxO that a Plutus script can read when the
+ *        UTxO is being spent. Essentially, the Datum acts as a state for that UTxO, allowing
+ *        Plutus scripts to perform more complex logic based on this stored state.
+ */
+typedef struct cardano_datum_t cardano_datum_t;
+
+/**
+ * \brief Creates and initializes a new instance of a datum.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_datum_t,
+ * using the provided hash. It returns an error code to indicate success
+ * or failure of the operation.
+ *
+ * \param[in] hash A pointer to \ref cardano_blake2b_hash_t representing the hash associated
+ *             with this datum. The hash must be properly initialized before being
+ *             passed to this function.
+ * \param[out] datum On successful initialization, this will point to a newly created
+ *             \ref cardano_datum_t object. This object represents a "strong reference"
+ *             to the datum, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the datum is no longer needed, the caller must release it
+ *             by calling \ref cardano_datum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the datum was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* hash = { ... };  // Assume hash is initialized here
+ * cardano_datum_t* datum = NULL;
+ *
+ * // Attempt to create a new datum
+ * cardano_error_t result = cardano_datum_new_data_hash(hash, &datum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the datum
+ *
+ *   // Once done, ensure to clean up and release the datum
+ *   cardano_datum_unref(&datum);
+ * }
+ *
+ * cardano_blake2b_hash_unref(&hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_datum_new_data_hash(
+  const cardano_blake2b_hash_t* hash,
+  cardano_datum_t**             datum);
+
+/**
+ * \brief Creates a datum from a hexadecimal hash string.
+ *
+ * This function constructs a \ref cardano_datum_t object by interpreting the provided
+ * hexadecimal string as a hash value. It returns an error code indicating the success or failure of the operation.
+ *
+ * \param[in] hex A pointer to a character array containing the hexadecimal representation of the hash.
+ * \param[in] hex_size The size of the hexadecimal string in bytes.
+ * \param[out] datum On successful initialization, this will point to a newly created
+ *                 \ref cardano_datum_t object. This object represents a "strong reference"
+ *                 to the datum, meaning that it is fully initialized and ready for use.
+ *                 The caller is responsible for managing the lifecycle of this object,
+ *                 specifically, once the datum is no longer needed, the caller must release it
+ *                 by calling \ref cardano_datum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the datum was successfully created, or an appropriate error code
+ *         indicating the reason for failure.
+ *
+ * \note The function assumes that the hexadecimal string is valid and correctly formatted.
+ *       Malformed input may lead to incorrect or undefined behavior.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* hash_hex = "abcdef1234567890abcdef1234567890abcdef12....";
+ * size_t hex_size = strlen(hash_hex);
+ * cardano_datum_t* datum = NULL;
+ *
+ * // Attempt to create a new datum from a hexadecimal hash
+ * cardano_error_t result = cardano_datum_new_data_hash_hex(hash_hex, hex_size, &datum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the datum
+ *
+ *   // Once done, ensure to clean up and release the datum
+ *   cardano_datum_unref(&datum);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_datum_new_data_hash_hex(
+  const char*       hex,
+  size_t            hex_size,
+  cardano_datum_t** datum);
+
+/**
+ * \brief Creates a datum from a byte array representing a hash.
+ *
+ * This function constructs a \ref cardano_datum_t object by using the provided
+ * byte array as a hash value. It returns an error code indicating the success or failure of the operation.
+ *
+ * \param[in] data A pointer to the byte array containing the hash data.
+ * \param[in] data_size The size of the byte array in bytes.
+ * \param[out] datum On successful initialization, this will point to a newly created
+ *                 \ref cardano_datum_t object. This object represents a "strong reference"
+ *                 to the datum, meaning that it is fully initialized and ready for use.
+ *                 The caller is responsible for managing the lifecycle of this object,
+ *                 specifically, once the datum is no longer needed, the caller must release it
+ *                 by calling \ref cardano_datum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the datum was successfully created, or an appropriate error code
+ *         indicating the reason for failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t hash_data[] = { 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef ... };
+ * size_t data_size = sizeof(hash_data);
+ * cardano_datum_t* datum = NULL;
+ *
+ * // Attempt to create a new datum from byte array hash
+ * cardano_error_t result = cardano_datum_new_data_hash_bytes(hash_data, data_size, &datum);
+ *
+ * if (result == CARDANO_SUCCESS && datum)
+ * {
+ *   // Use the datum
+ *
+ *   // Once done, ensure to clean up and release the datum
+ *   cardano_datum_unref(&datum);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_datum_new_data_hash_bytes(
+  const byte_t*     data,
+  size_t            data_size,
+  cardano_datum_t** datum);
+
+/**
+ * \brief Creates a datum from inline data.
+ *
+ * This function constructs a \ref cardano_datum_t object using the provided
+ * \ref cardano_plutus_data_t object. It returns an error code indicating the success or failure of the operation.
+ *
+ * \param[in] data A pointer to the \ref cardano_plutus_data_t object representing the inline data.
+ * \param[out] datum On successful initialization, this will point to a newly created
+ *                 \ref cardano_datum_t object. This object represents a "strong reference"
+ *                 to the datum, meaning that it is fully initialized and ready for use.
+ *                 The caller is responsible for managing the lifecycle of this object,
+ *                 specifically, once the datum is no longer needed, the caller must release it
+ *                 by calling \ref cardano_datum_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the datum was successfully created, or an appropriate error code
+ *         indicating the reason for failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_t* data = ...;  // Assume data is initialized here
+ * cardano_datum_t* datum = NULL;
+ *
+ * // Attempt to create a new datum from inline data
+ * cardano_error_t result = cardano_datum_new_inline_data(data, &datum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the datum
+ *
+ *   // Once done, ensure to clean up and release the datum
+ *   cardano_datum_unref(&datum);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_datum_new_inline_data(
+  cardano_plutus_data_t* data,
+  cardano_datum_t**      datum);
+
+/**
+ * \brief Creates a datum from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_datum_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a datum.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded datum data.
+ * \param[out] datum A pointer to a pointer of \ref cardano_datum_t that will be set to the address
+ *                        of the newly created datum object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the datum was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_datum_t object by calling
+ *       \ref cardano_datum_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_datum_t* datum = NULL;
+ *
+ * cardano_error_t result = cardano_datum_from_cbor(reader, &datum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the datum
+ *
+ *   // Once done, ensure to clean up and release the datum
+ *   cardano_datum_unref(&datum);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode datum: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_datum_from_cbor(cardano_cbor_reader_t* reader, cardano_datum_t** datum);
+
+/**
+ * \brief Serializes a datum into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_datum_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] datum A constant pointer to the \ref cardano_datum_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p datum or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_datum_t* datum = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_datum_to_cbor(datum, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_datum_unref(&datum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_datum_to_cbor(
+  const cardano_datum_t* datum,
+  cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Serializes a datum to CIP-116 JSON.
+ *
+ * This function serializes the datum object, which can be either inline
+ * Plutus data or a datum hash, according to the schema.
+ *
+ * Schema (Inline):
+ * { "tag": "datum", "value": { ...PlutusData... } }
+ *
+ * Schema (Hash):
+ * { "tag": "datum_hash", "value": "<hex_hash>" }
+ *
+ * \param[in]  datum   Pointer to a valid \ref cardano_datum_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p datum or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_datum_to_cip116_json(
+  const cardano_datum_t* datum,
+  cardano_json_writer_t* writer);
+
+/**
+ * \brief Retrieves the inline data associated with a datum.
+ *
+ * This function provides access to the inline data part of a \ref cardano_datum_t object.
+ * It returns a pointer to a \ref cardano_plutus_data_t object representing the inline data.
+ * The caller is responsible for managing the lifecycle of this object, including releasing it with
+ * \ref cardano_plutus_data_unref when it is no longer needed.
+ *
+ * \param datum A constant pointer to the \ref cardano_datum_t object from which
+ *              the inline data is to be retrieved.
+ *
+ * \return A pointer to a \ref cardano_plutus_data_t object containing the inline data.
+ *         If the input datum is NULL, returns NULL. The caller is responsible for
+ *         managing the lifecycle of this object, including releasing it with
+ *         \ref cardano_plutus_data_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_datum_t* datum = ...;
+ * cardano_plutus_data_t* data = cardano_datum_get_inline_data(datum);
+ *
+ * if (data)
+ * {
+ *   // Use the inline data
+ *
+ *   // Once done, ensure to clean up and release the inline data
+ *   cardano_plutus_data_unref(&data);
+ * }
+ *
+ * // Clean up the datum object once done
+ * cardano_datum_unref(&datum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_plutus_data_t* cardano_datum_get_inline_data(cardano_datum_t* datum);
+
+/**
+ * \brief Retrieves the hash associated with a datum.
+ *
+ * This function provides access to the hash part of a \ref cardano_datum_t object.
+ * It returns a new reference to a \ref cardano_blake2b_hash_t object representing the hash.
+ * This allows the hash to be used independently of the original datum object. The
+ * reference count of the hash object is increased by one, making it the caller's responsibility
+ * to release it by calling \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * For a datum of type \ref CARDANO_DATUM_TYPE_INLINE_DATA the hash is the datum hash of its plutus data: the
+ * blake2b-256 hash of the CBOR encoding of the data, computed from the data on every call. Plutus data decoded
+ * from CBOR is hashed over the bytes it was decoded from (until its CBOR cache is cleared), so the hash matches
+ * the one the ledger computes.
+ *
+ * \param datum A constant pointer to the \ref cardano_datum_t object from which
+ *                   the hash is to be retrieved.
+ *
+ * \return A pointer to a new \ref cardano_blake2b_hash_t object containing the hash.
+ *         If the input datum is NULL or the hash cannot be computed or allocated, returns NULL.
+ *         The caller is responsible for managing the lifecycle of this object,
+ *         including releasing it with \ref cardano_blake2b_hash_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_datum_t* original_datum = cardano_datum_new(...);
+ * cardano_blake2b_hash_t* hash_datum = cardano_datum_get_data_hash(original_datum);
+ *
+ * if (hash_datum)
+ * {
+ *   // Use the hash datum
+ *
+ *   // Once done, ensure to clean up and release the hash datum
+ *   cardano_blake2b_hash_unref(&hash_datum);
+ * }
+ * // Release the original datum after use
+ * cardano_datum_unref(&original_datum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_datum_get_data_hash(const cardano_datum_t* datum);
+
+/**
+ * \brief Retrieves the size of the hash bytes stored in the datum.
+ *
+ * This function computes the size of the hash bytes stored within a \ref cardano_datum_t object.
+ * It is particularly useful for determining the buffer size needed to store the hash bytes when
+ * retrieving them via \ref cardano_datum_get_data_hash_bytes.
+ *
+ * \param[in] datum A constant pointer to the \ref cardano_datum_t object from which
+ *                       the size of the hash bytes is to be retrieved.
+ *
+ * \return The size of the hash bytes. If the datum is NULL, the function returns zero.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_datum_t* datum = cardano_datum_new(...);
+ * size_t hash_size = cardano_datum_get_data_hash_bytes_size(datum);
+ *
+ * if (hash_size > 0)
+ * {
+ *   byte_t* hash_bytes = malloc(hash_size);
+ *   if (hash_bytes)
+ *   {
+ *     // Proceed to get the hash bytes
+ *   }
+ * }
+ * cardano_datum_unref(&datum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_datum_get_data_hash_bytes_size(const cardano_datum_t* datum);
+
+/**
+ * \brief Retrieves the byte array representation of the hash from a datum.
+ *
+ * This function accesses the byte representation of the hash associated with a given
+ * \ref cardano_datum_t object. It provides a direct pointer to the internal byte array
+ * representing the hash, which should not be modified or freed by the caller.
+ *
+ * For a datum of type \ref CARDANO_DATUM_TYPE_INLINE_DATA the hash is the datum hash of its plutus data, as
+ * reported by \ref cardano_datum_get_data_hash. It is computed from the data on every call and stored in the
+ * datum, despite the const parameter, so the returned bytes are only valid until the next call to
+ * \ref cardano_datum_get_data_hash_bytes or \ref cardano_datum_get_data_hash_hex on the same datum. These two
+ * functions must not be called concurrently on the same datum.
+ *
+ * \param datum A constant pointer to the \ref cardano_datum_t object from which
+ *                   the hash bytes are to be retrieved.
+ *
+ * \return A pointer to a constant byte array containing the hash data. If the input datum
+ *         is NULL, or the hash of an inline datum cannot be computed, returns NULL. For a datum created from a
+ *         hash, the data remains valid as long as the datum is not freed or modified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_datum_t* datum = cardano_datum_new(...);
+ * const byte_t* hash_bytes = cardano_datum_get_data_hash_bytes(datum);
+ *
+ * if (hash_bytes)
+ * {
+ *   // Use the hash bytes for operations like comparison or display
+ * }
+ *
+ * // Clean up the datum object once done
+ * cardano_datum_unref(&datum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_datum_get_data_hash_bytes(const cardano_datum_t* datum);
+
+/**
+ * \brief Retrieves the size needed for the hexadecimal string representation of the datum's hash.
+ *
+ * This function calculates the size required to store the hexadecimal string representation of the hash
+ * associated with a \ref cardano_datum_t object. This size includes the space needed for the null-terminator.
+ *
+ * \param[in] datum A constant pointer to the \ref cardano_datum_t object whose hash size is to be determined.
+ *
+ * \return The size in bytes required to store the hexadecimal representation of the hash, including the null terminator.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_datum_t* datum = cardano_datum_new(...);
+ * size_t hex_size = cardano_datum_get_data_hash_hex_size(datum);
+ * char* hex_string = malloc(hex_size);
+ *
+ * if (hex_string)
+ * {
+ *   // Now use hex_string to get the hash or do other operations
+ *   free(hex_string);
+ * }
+ *
+ * cardano_datum_unref(&datum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_datum_get_data_hash_hex_size(const cardano_datum_t* datum);
+
+/**
+ * \brief Retrieves the hexadecimal string representation of the hash from a datum.
+ *
+ * This function provides access to the hexadecimal (hex) string representation of the hash
+ * associated with a given \ref cardano_datum_t object. It returns a direct pointer to the
+ * internal hex string which should not be modified or freed by the caller.
+ *
+ * For a datum of type \ref CARDANO_DATUM_TYPE_INLINE_DATA the hash is the datum hash of its plutus data, as
+ * reported by \ref cardano_datum_get_data_hash. It is computed from the data on every call and stored in the
+ * datum, despite the const parameter, so the returned string is only valid until the next call to
+ * \ref cardano_datum_get_data_hash_bytes or \ref cardano_datum_get_data_hash_hex on the same datum. These two
+ * functions must not be called concurrently on the same datum.
+ *
+ * \param datum A constant pointer to the \ref cardano_datum_t object from which
+ *                   the hex string of the hash is to be retrieved. The object must not be NULL.
+ *
+ * \return A pointer to a constant character array containing the hex representation of the hash.
+ *         If the input datum is NULL, or the hash of an inline datum cannot be computed, returns NULL. For a datum
+ *         created from a hash, the data remains valid as long as the datum is not freed or modified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_datum_t* datum = cardano_datum_new(...);
+ * const char* hash_hex = cardano_datum_get_data_hash_hex(datum);
+ *
+ * if (hash_hex)
+ * {
+ *   // Use the hash hex for operations like logging, display, or comparison
+ * }
+ *
+ * // Clean up the datum object once done
+ * cardano_datum_unref(&datum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_datum_get_data_hash_hex(const cardano_datum_t* datum);
+
+/**
+ * \brief Retrieves the type of the datum.
+ *
+ * This function retrieves the type of a given \ref cardano_datum_t object and stores it in the provided
+ * output parameter. The datum type is defined in the \ref cardano_datum_type_t enumeration.
+ *
+ * \param[in] datum A constant pointer to the \ref cardano_datum_t object from which
+ *                       the type is to be retrieved. The object must not be NULL.
+ * \param[out] type Pointer to a variable where the datum type will be stored. This variable will
+ *                  be set to the value from the \ref cardano_datum_type_t enumeration.
+ *
+ * \return CARDANO_SUCCESS if the type was successfully retrieved, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_datum_t* datum = cardano_datum_new(...);
+ * cardano_datum_type_t type;
+ * cardano_error_t result = cardano_datum_get_type(datum, &type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the type
+ * }
+ *
+ * // Clean up the datum object once done
+ * cardano_datum_unref(&datum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_datum_get_type(const cardano_datum_t* datum, cardano_datum_type_t* type);
+
+/**
+ * \brief Sets the hash for a datum.
+ *
+ * This function assigns a new hash to an existing \ref cardano_datum_t object. The hash
+ * represents the identifying data for the datum. The function copies the provided hash into
+ * the datum, so the original hash object may be modified or freed after this operation without
+ * affecting the datum's hash.
+ *
+ * An inline datum always reports the hash of its data, so a hash set on it is not reported by the hash getters.
+ *
+ * \param[in,out] datum A pointer to the \ref cardano_datum_t object whose hash is to be set.
+ *                           This object must have been previously created and not yet freed.
+ * \param[in] hash A pointer to a \ref cardano_blake2b_hash_t object containing the new hash to be set.
+ *                 This parameter must not be NULL.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the hash was successfully set. If the \p datum or \p hash is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_datum_t* datum = ...;
+ * cardano_blake2b_hash_t* new_hash = cardano_blake2b_compute_hash(...);
+ *
+ * cardano_error_t result = cardano_datum_set_data_hash(datum, new_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     // The hash was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_datum_unref(&datum);
+ * cardano_blake2b_hash_unref(&new_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_datum_set_data_hash(cardano_datum_t* datum, const cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Compares two datum objects for equality.
+ *
+ * This function compares two datum objects to determine if they are equal.
+ *
+ * \param[in] lhs Pointer to the first datum object.
+ * \param[in] rhs Pointer to the second datum object.
+ *
+ * \return \c true if the datum objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_datum_t* datum1 = NULL;
+ * cardano_datum_t* datum2 = NULL;
+ *
+ * // Assume datum1 and datum2 are initialized properly
+ *
+ * bool are_equal = cardano_datum_equals(datum1, datum2);
+ *
+ * if (are_equal)
+ * {
+ *   printf("The datum objects are equal.\n");
+ * }
+ * else
+ * {
+ *   printf("The datum objects are not equal.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_datum_unref(&datum1);
+ * cardano_datum_unref(&datum2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_datum_equals(const cardano_datum_t* lhs, const cardano_datum_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a datum object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_datum_t object
+ * by decreasing its reference count. When the reference count reaches zero, the datum is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] datum A pointer to the pointer of the datum object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_datum_t* datum = cardano_datum_new();
+ *
+ * // Perform operations with the datum...
+ *
+ * cardano_datum_unref(&datum);
+ * // At this point, datum is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_datum_unref, the pointer to the \ref cardano_datum_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_datum_unref(cardano_datum_t** datum);
+
+/**
+ * \brief Increases the reference count of the cardano_datum_t object.
+ *
+ * This function is used to manually increment the reference count of a datum
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_datum_unref.
+ *
+ * \param datum A pointer to the datum object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming datum is a previously created datum object
+ *
+ * cardano_datum_ref(datum);
+ *
+ * // Now datum can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_datum_ref there is a corresponding
+ * call to \ref cardano_datum_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_datum_ref(cardano_datum_t* datum);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_datum_t object.
+ *
+ * This function returns the number of active references to a datum object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_datum_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param datum A pointer to the datum object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified datum object. If the object
+ * is properly managed (i.e., every \ref cardano_datum_ref call is matched with a
+ * \ref cardano_datum_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming datum is a previously created datum object
+ *
+ * size_t ref_count = cardano_datum_refcount(datum);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_datum_refcount(const cardano_datum_t* datum);
+
+/**
+ * \brief Sets the last error message for a given datum object.
+ *
+ * Records an error message in the datum's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] datum A pointer to the \ref cardano_datum_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the datum's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_datum_set_last_error(cardano_datum_t* datum, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific datum.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_datum_set_last_error for the given
+ * datum. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] datum A pointer to the \ref cardano_datum_t instance whose last error
+ *                   message is to be retrieved. If the datum is NULL, the function
+ *                   returns a generic error message indicating the null datum.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified datum. If the datum is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_datum_set_last_error for the same datum, or until
+ *       the datum is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_datum_get_last_error(const cardano_datum_t* datum);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_datum_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_datum_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_datum_deep_clone(const cardano_datum_t* source, cardano_datum_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_DATUM_H
diff --git a/vendor/include/cardano/common/datum_type.h b/vendor/include/cardano/common/datum_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/datum_type.h
@@ -0,0 +1,57 @@
+/**
+ * \file datum_type.h
+ *
+ * \author luisd.bianchi
+ * \date   May 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_DATUM_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_DATUM_TYPE_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents different ways of associating a Datum with a UTxO in a transaction.
+ */
+typedef enum
+{
+  /**
+   * \brief Instead of including the full Datum directly within the transaction, it's possible to
+   * include just a hash of the Datum. This is the DatumHash. By referencing the Datum
+   * by its hash, the transaction can be more compact, especially if the Datum itself is large.
+   * However, when using a DatumHash, the actual Datum value it represents must be provided
+   * in the transaction witness set to ensure that users and validators can verify and use it.
+   */
+  CARDANO_DATUM_TYPE_DATA_HASH = 0,
+
+  /**
+   * \brief This represents the actual Datum value being included directly
+   * within the transaction output. So, the Datum is "inlined" in the transaction
+   * data itself.
+   */
+  CARDANO_DATUM_TYPE_INLINE_DATA = 1
+} cardano_datum_type_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_DATUM_TYPE_H
diff --git a/vendor/include/cardano/common/drep.h b/vendor/include/cardano/common/drep.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/drep.h
@@ -0,0 +1,650 @@
+/**
+ * \file drep.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_DREP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_DREP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/drep_type.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief In Voltaire, existing stake credentials will be able to delegate their stake to DReps
+ * for voting purposes, in addition to the current delegation to stake pools for block production.
+ *
+ * Just as the number of blocks that a pool mint depends on the total stake, the amount of decision-making
+ * power will depend on the number of coins delegated to a DRep.
+ *
+ * Registered DReps are identified by a credential that can be either:
+ *
+ * - A verification key (Ed25519)
+ * - A native or Plutus script
+ */
+typedef struct cardano_drep_t cardano_drep_t;
+
+/**
+ * \brief Creates and initializes a new instance of a drep.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_drep_t,
+ * using the provided type and credential. It returns an error code to indicate the
+ * success or failure of the operation.
+ *
+ * \param[in] type The type of the drep, represented by \ref cardano_drep_type_t.
+ * \param[in] credential A pointer to \ref cardano_credential_t representing the credential
+ *                       associated with this drep. The credential must be properly initialized
+ *                       before being passed to this function. Must be NULL if \p type is
+ *                       \ref CARDANO_DREP_TYPE_ABSTAIN or \ref CARDANO_DREP_TYPE_NO_CONFIDENCE.
+ * \param[out] drep On successful initialization, this will point to a newly created
+ *                  \ref cardano_drep_t object. This object represents a "strong reference"
+ *                  to the drep, meaning that it is fully initialized and ready for use.
+ *                  The caller is responsible for managing the lifecycle of this object.
+ *                  Specifically, once the drep is no longer needed, the caller must release it
+ *                  by calling \ref cardano_drep_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the drep was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_type_t type = ...;  // Assume type is initialized here
+ * cardano_credential_t* credential = ...;  // Assume credential is initialized here
+ * cardano_drep_t* drep = NULL;
+ *
+ * // Attempt to create a new drep
+ * cardano_error_t result = cardano_drep_new(type, credential, &drep);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the drep
+ *
+ *   // Once done, ensure to clean up and release the drep
+ *   cardano_drep_unref(&drep);
+ * }
+ *
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_drep_new(
+  cardano_drep_type_t   type,
+  cardano_credential_t* credential,
+  cardano_drep_t**      drep);
+
+/**
+ * \brief Converts a Bech32-encoded string representation of a DRep (Delegated Representative)
+ *        into a `cardano_drep_t` object.
+ *
+ * The input string can follow one of two formats:
+ *
+ * 1. CIP-105 Format (DEPRECATED):
+ *    - This format represents the key hash directly as a Bech32-encoded string.
+ *
+ * 2. CIP-129 Format:
+ *    - This format introduces a header byte to encode additional metadata about the governance key type and credential type.
+ *    - The binary structure is as follows:
+ *
+ *      Header Byte Structure:
+ *      - The header byte consists of two parts:
+ *        - Bits [7;4]: Key type (t t t t)
+ *          - Defines the type of governance key being used.
+ *          - Possible key types:
+ *            - 0000 (CC Hot): Constitutional Committee Hot Key
+ *            - 0001 (CC Cold): Constitutional Committee Cold Key
+ *            - 0010 (DRep): Delegated Representative Key
+ *        - Bits [3;0]: Credential type (c c c c)
+ *          - Refers to the type of credential associated with the governance key.
+ *          - Reserved values ensure no conflicts with Cardano address network tags:
+ *            - 0010 (Key Hash): Key hash credential
+ *            - 0011 (Script Hash): Script hash credential
+ *
+ * \param[in]  bech32_string   Pointer to the Bech32-encoded string.
+ * \param[in]  string_length   Length of the input string.
+ * \param[out] drep            Pointer to the output cardano_drep_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the drep was successfully created, \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *         if memory for the decoding buffers or the drep could not be allocated, or an
+ *         appropriate error code indicating the failure reason.
+ *
+ * \note The caller is responsible for freeing the memory associated with the returned
+ *       cardano_drep_t object using `cardano_drep_unref`.
+ *
+ * \code{.c}
+ * const char* drep_bech32 = "drep1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";
+ * size_t drep_length = strlen(drep_bech32);
+ * cardano_drep_t* drep = NULL;
+ *
+ * cardano_error_t result = cardano_drep_from_string(drep_bech32, drep_length, &drep);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DRep object successfully created.\n");
+ *   // Use the drep object...
+ *   cardano_drep_unref(drep);
+ * }
+ * else
+ * {
+ *   printf("Failed to parse DRep string: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_drep_from_string(
+  const char*      bech32_string,
+  size_t           string_length,
+  cardano_drep_t** drep);
+
+/**
+ * \brief Creates a drep from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_drep_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a drep.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded drep data.
+ * \param[out] drep A pointer to a pointer of \ref cardano_drep_t that will be set to the address
+ *                        of the newly created drep object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the drep was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_drep_t object by calling
+ *       \ref cardano_drep_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_drep_t* drep = NULL;
+ *
+ * cardano_error_t result = cardano_drep_from_cbor(reader, &drep);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the drep
+ *
+ *   // Once done, ensure to clean up and release the drep
+ *   cardano_drep_unref(&drep);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode drep: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_drep_from_cbor(cardano_cbor_reader_t* reader, cardano_drep_t** drep);
+
+/**
+ * \brief Serializes a drep into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_drep_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] drep A constant pointer to the \ref cardano_drep_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p drep or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_t* drep = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_drep_to_cbor(drep, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_drep_unref(&drep);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_to_cbor(
+  const cardano_drep_t*  drep,
+  cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Serializes a DRep to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ *
+ * Schema:
+ * - Key Hash: { "tag": "pubkey_hash", "value": "<hex>" }
+ * - Script Hash: { "tag": "script_hash", "value": "<hex>" }
+ * - Always Abstain: { "tag": "always_abstain" }
+ * - Always No Confidence: { "tag": "always_no_confidence" }
+ *
+ * \param[in]  drep    Pointer to a valid \ref cardano_drep_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p drep or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_to_cip116_json(
+  const cardano_drep_t*  drep,
+  cardano_json_writer_t* writer);
+
+/**
+ * \brief Retrieves the size needed for the string representation (CIP-129) of a Cardano DRep.
+ *
+ * This function calculates the size of the buffer required to hold the string representation
+ * of a \ref cardano_drep_t object, including the null terminator. This size is necessary
+ * to ensure that the buffer allocated for converting the DRep to a string is sufficient.
+ *
+ * \param[in] drep A constant pointer to the \ref cardano_drep_t object for which the string
+ *                 size is being calculated. The object must not be NULL.
+ *
+ * \return The size in bytes needed to store the string representation of the DRep, including
+ *         the null terminator. If the input \p DRep is NULL, the behavior is undefined.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_t* drep = cardano_drep_new(...);
+ * size_t required_size = cardano_drep_get_string_size(drep);
+ *
+ * char* drep_str = (char*)malloc(required_size);
+ *
+ * if (drep_str)
+ * {
+ *   cardano_error_t result = cardano_drep_to_string(drep, drep_str, required_size);
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("DRep: %s\n", drep_str);
+ *   }
+ *   free(drep_str);
+ * }
+ *
+ * // Clean up the drep object once done
+ * cardano_drep_unref(&drep);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_drep_get_string_size(const cardano_drep_t* drep);
+
+/**
+ * \brief Converts a Cardano DRep into its string representation (CIP-129).
+ *
+ * This function serializes the given \ref cardano_drep_t object into a string format.
+ * The string is written to a user-provided buffer, and the size of this buffer must be
+ * adequate to hold the entire string, including the null terminator. The required size
+ * can be determined by calling \ref cardano_drep_get_string_size.
+ *
+ * \param[in] drep A constant pointer to the \ref cardano_drep_t object that is to be converted to a string.
+ *                 The object must not be NULL.
+ * \param[out] data A pointer to the buffer where the string representation of the drep will be written.
+ * \param[in] size The size of the buffer pointed to by \p data. This size should be at least as large as the value
+ *                 returned by \ref cardano_drep_get_string_size to ensure successful serialization.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the conversion is successful. If the buffer is too small, returns
+ *         \ref CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE. If the \p drep or \p data is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_t* drep = cardano_drep_new(...);
+ * size_t required_size = cardano_drep_get_string_size(drep);
+ * char* drep_str = (char*)malloc(required_size);
+ *
+ * if (drep_str)
+ * {
+ *   cardano_error_t result = cardano_drep_to_string(drep, drep_str, required_size);
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Address: %s\n", drep_str);
+ *   }
+ *
+ *   free(drep_str);
+ * }
+ *
+ * // Clean up the drep object once done
+ * cardano_drep_unref(&drep);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_to_string(
+  const cardano_drep_t* drep,
+  char*                 data,
+  size_t                size);
+
+/**
+ * \brief Retrieves the credential associated with a drep.
+ *
+ * This function retrieves the credential associated with the given \ref cardano_drep_t object.
+ * The retrieved credential is returned via the \p credential output parameter.
+ *
+ * \param[in] drep A pointer to the \ref cardano_drep_t object from which to retrieve the credential.
+ * \param[out] credential A pointer to a pointer that will be set to the address of the retrieved
+ *                        \ref cardano_credential_t object. The caller is responsible for managing
+ *                        the lifecycle of this credential. Specifically, once the credential is no
+ *                        longer needed, the caller must release it by calling \ref cardano_credential_unref.
+ *                        Will be NULL if the \p drep is of type \ref CARDANO_DREP_TYPE_ABSTAIN or
+ *                        \ref CARDANO_DREP_TYPE_NO_CONFIDENCE.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the credential was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_t* drep = ...;  // Assume drep is initialized here
+ * cardano_credential_t* credential = NULL;
+ *
+ * // Retrieve the credential
+ * cardano_error_t result = cardano_drep_get_credential(drep, &credential);
+ *
+ * if (result == CARDANO_SUCCESS && credential != NULL)
+ * {
+ *   // Use the credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ *
+ * cardano_drep_unref(&drep);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_get_credential(cardano_drep_t* drep, cardano_credential_t** credential);
+
+/**
+ * \brief Sets the credential associated with a drep.
+ *
+ * This function sets the credential for the given \ref cardano_drep_t object.
+ *
+ * \param[in,out] drep A pointer to the \ref cardano_drep_t object for which to set the credential.
+ * \param[in] credential A pointer to the \ref cardano_credential_t object to be associated with the drep.
+ *                       The \p credential must be properly initialized before being passed to this function.
+ *                       For \ref CARDANO_DREP_TYPE_ABSTAIN and \ref CARDANO_DREP_TYPE_NO_CONFIDENCE, this parameter
+ *                       must be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the credential was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_t* drep = ...;  // Assume drep is initialized here
+ * cardano_credential_t* credential = ...;  // Assume credential is initialized here
+ *
+ * // Set the credential
+ * cardano_error_t result = cardano_drep_set_credential(drep, credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Credential was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_drep_unref(&drep);
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_drep_set_credential(cardano_drep_t* drep, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the type of a drep.
+ *
+ * This function gets the type of the given \ref cardano_drep_t object.
+ *
+ * \param[in] drep A constant pointer to the \ref cardano_drep_t object.
+ * \param[out] type A pointer to a \ref cardano_drep_type_t variable where the type will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the type was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_t* drep = ...;  // Assume drep is initialized here
+ * cardano_drep_type_t type;
+ *
+ * // Get the drep type
+ * cardano_error_t result = cardano_drep_get_type(drep, &type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The type was successfully retrieved
+ * }
+ *
+ * // Clean up
+ * cardano_drep_unref(&drep);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_drep_get_type(const cardano_drep_t* drep, cardano_drep_type_t* type);
+
+/**
+ * \brief Sets the type of a drep.
+ *
+ * This function sets the type of the given \ref cardano_drep_t object.
+ *
+ * \param[in,out] drep A pointer to the \ref cardano_drep_t object whose type is to be set.
+ * \param[in] type The \ref cardano_drep_type_t value to set for the drep.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the type was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * \remark If the type is set to \ref CARDANO_DREP_TYPE_ABSTAIN or \ref CARDANO_DREP_TYPE_NO_CONFIDENCE,
+ *         the credential must be NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_t* drep = ...;  // Assume drep is initialized here
+ * cardano_drep_type_t type = CARDANO_DREP_TYPE_KEY_HASH;
+ *
+ * // Set the drep type
+ * cardano_error_t result = cardano_drep_set_type(drep, type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The type was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_drep_unref(&drep);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_drep_set_type(cardano_drep_t* drep, cardano_drep_type_t type);
+
+/**
+ * \brief Decrements the reference count of a drep object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_drep_t object
+ * by decreasing its reference count. When the reference count reaches zero, the drep is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] drep A pointer to the pointer of the drep object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_t* drep = cardano_drep_new();
+ *
+ * // Perform operations with the drep...
+ *
+ * cardano_drep_unref(&drep);
+ * // At this point, drep is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_drep_unref, the pointer to the \ref cardano_drep_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_drep_unref(cardano_drep_t** drep);
+
+/**
+ * \brief Increases the reference count of the cardano_drep_t object.
+ *
+ * This function is used to manually increment the reference count of a drep
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_drep_unref.
+ *
+ * \param drep A pointer to the drep object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming drep is a previously created drep object
+ *
+ * cardano_drep_ref(drep);
+ *
+ * // Now drep can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_drep_ref there is a corresponding
+ * call to \ref cardano_drep_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_drep_ref(cardano_drep_t* drep);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_drep_t object.
+ *
+ * This function returns the number of active references to a drep object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_drep_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param drep A pointer to the drep object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified drep object. If the object
+ * is properly managed (i.e., every \ref cardano_drep_ref call is matched with a
+ * \ref cardano_drep_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming drep is a previously created drep object
+ *
+ * size_t ref_count = cardano_drep_refcount(drep);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_drep_refcount(const cardano_drep_t* drep);
+
+/**
+ * \brief Sets the last error message for a given drep object.
+ *
+ * Records an error message in the drep's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] drep A pointer to the \ref cardano_drep_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the drep's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_drep_set_last_error(cardano_drep_t* drep, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific drep.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_drep_set_last_error for the given
+ * drep. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] drep A pointer to the \ref cardano_drep_t instance whose last error
+ *                   message is to be retrieved. If the drep is NULL, the function
+ *                   returns a generic error message indicating the null drep.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified drep. If the drep is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_drep_set_last_error for the same drep, or until
+ *       the drep is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_drep_get_last_error(const cardano_drep_t* drep);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_drep_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_drep_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_drep_deep_clone(const cardano_drep_t* source, cardano_drep_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_DREP_H
diff --git a/vendor/include/cardano/common/drep_type.h b/vendor/include/cardano/common/drep_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/drep_type.h
@@ -0,0 +1,77 @@
+/**
+ * \file drep_type.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_DREP_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_DREP_TYPE_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief In order to participate in governance, a stake credential must be delegated to a DRep.
+ * Ada holders will generally delegate their voting rights to a registered DRep that will
+ * vote on their behalf.
+ *
+ * In addition, two pre-defined DRep options are available: `Abstain` and `No Confidence`.
+ */
+typedef enum
+{
+  /**
+   * \brief A DRep identified by a stake key hash.
+   */
+  CARDANO_DREP_TYPE_KEY_HASH = 0,
+
+  /**
+   * \brief A DRep identified by a script hash.
+   */
+  CARDANO_DREP_TYPE_SCRIPT_HASH = 1,
+
+  /**
+   * \brief If an Ada holder delegates to Abstain, then their stake is actively marked as not
+   * participating in governance.
+   *
+   * The effect of delegating to Abstain on chain is that the delegated stake will not be
+   * considered to be a part of the active voting stake. However, the stake will be considered
+   * to be registered for the purpose of the incentives that are described in
+   * the following link:
+   *
+   * \par
+   * [Incentives for Ada holders to delegate voting stake](https://github.com/cardano-foundation/CIPs/blob/master/CIP-1694/README.md#incentives-for-ada-holders-to-delegate-voting-stake).
+   */
+  CARDANO_DREP_TYPE_ABSTAIN = 2,
+
+  /**
+   * \brief If an Ada holder delegates to No Confidence, then their stake is counted as a Yes vote on
+   * every No Confidence action and a No vote on every other action. The delegated stake will
+   * be considered part of the active voting stake. It also serves as a directly auditable
+   * measure of the confidence of Ada holders in the constitutional committee.
+   */
+  CARDANO_DREP_TYPE_NO_CONFIDENCE = 3,
+} cardano_drep_type_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_DREP_TYPE_H
diff --git a/vendor/include/cardano/common/ex_units.h b/vendor/include/cardano/common/ex_units.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/ex_units.h
@@ -0,0 +1,534 @@
+/**
+ * \file ex_units.h
+ *
+ * \author angel.castillo
+ * \date   Mar 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_EX_UNITS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_EX_UNITS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represent a measure of computational resources, specifically, how much memory
+ * and CPU a Plutus script will use when executed. It's an essential component to
+ * estimate the cost of running a Plutus script on the Cardano blockchain.
+ *
+ * The two resources measured by ExUnits are memory and CPU. When a Plutus script
+ * is executed, it consumes both these resources. The ExUnits system quantifies
+ * this consumption, helping to ensure that scripts don't overrun the system and
+ * that they terminate in a reasonable amount of time.
+ */
+typedef struct cardano_ex_units_t cardano_ex_units_t;
+
+/**
+ * \brief Creates and initializes a new instance of \ref cardano_ex_units_t.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_ex_units_t.
+ * Execution units (ExUnits) are a measure of  the computational resources required.
+ *
+ * \param[in] memory The amount of memory (in units) that the script is expected to consume.
+ * \param[in] cpu_steps The number of CPU steps that the script is expected to consume.
+ * \param[out] ex_units On successful initialization, this will point to a newly created
+ *            \ref cardano_ex_units_t object. This object represents a "strong reference"
+ *            to the ex_units, meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the execution units are no longer needed, the caller must release them
+ *            by calling \ref cardano_ex_units_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the execution units were successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_units_t* ex_units = NULL;
+ * uint64_t memory = 1024; // 1024 units of memory
+ * uint64_t cpu_steps = 500; // 500 CPU steps
+ *
+ * // Attempt to create a new execution units object
+ * cardano_error_t result = cardano_ex_units_new(memory, cpu_steps, &ex_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the ex_units
+ *
+ *   // Once done, ensure to clean up and release the ex_units
+ *   cardano_ex_units_unref(&ex_units);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_ex_units_new(
+  uint64_t             memory,
+  uint64_t             cpu_steps,
+  cardano_ex_units_t** ex_units);
+
+/**
+ * \brief Creates a \ref cardano_ex_units_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_ex_units_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a ex_units.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] ex_units A pointer to a pointer of \ref cardano_ex_units_t that will be set to the address
+ *                        of the newly created ex_units object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the execution units were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_ex_units_t object by calling
+ *       \ref cardano_ex_units_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_ex_units_t* ex_units = NULL;
+ *
+ * cardano_error_t result = cardano_ex_units_from_cbor(reader, &ex_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the ex_units
+ *
+ *   // Once done, ensure to clean up and release the ex_units
+ *   cardano_ex_units_unref(&ex_units);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode ex_units: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_ex_units_from_cbor(cardano_cbor_reader_t* reader, cardano_ex_units_t** ex_units);
+
+/**
+ * \brief Serializes execution units into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_ex_units_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] ex_units A constant pointer to the \ref cardano_ex_units_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p ex_units or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_units_t* ex_units = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_ex_units_to_cbor(ex_units, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_ex_units_unref(&ex_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_units_to_cbor(
+  const cardano_ex_units_t* ex_units,
+  cardano_cbor_writer_t*    writer);
+
+/**
+ * \brief Serializes execution units to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "mem", "steps".
+ * Both values are encoded as strings to ensure precision for 64-bit integers in JSON.
+ *
+ * \param[in]  ex_units  Pointer to a valid \ref cardano_ex_units_t.
+ * \param[in]  writer    Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p ex_units or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_units_to_cip116_json(
+  const cardano_ex_units_t* ex_units,
+  cardano_json_writer_t*    writer);
+
+/**
+ * \brief Retrieves the memory component of the execution units.
+ *
+ * \param[in] ex_units A constant pointer to the \ref cardano_ex_units_t object from which
+ *                     the memory is to be retrieved.
+ *
+ * \return The amount of memory.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_units_t* ex_units = ...; // Assume ex_units is initialized and contains memory and cpu_steps
+ * uint64_t memory_allocated = cardano_ex_units_get_memory(ex_units);
+ * printf("Memory: %llu units\n", memory_allocated);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_ex_units_get_memory(
+  const cardano_ex_units_t* ex_units);
+
+/**
+ * \brief Retrieves the memory budget of an \ref cardano_ex_units_t object.
+ *
+ * \param[in]  ex_units  A pointer to an initialised \ref cardano_ex_units_t object.
+ *                       Must not be \c NULL.
+ * \param[out] memory    A pointer to a 64-bit unsigned integer that will receive the
+ *                       memory count on success. Must not be \c NULL.
+ *
+ * \return A \ref cardano_error_t value:
+ *   - \ref CARDANO_SUCCESS               – The call succeeded and *steps now contains the memory budget.
+ *   - \ref CARDANO_ERROR_POINTER_IS_NULL – \p ex_units or \p memory was \c NULL.
+ *   - Any other error code propagated from the underlying implementation.
+ *
+ * \note If the function fails, a descriptive message can be obtained by calling \ref cardano_ex_units_get_last_error on the \p ex_units object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_units_t* ex_units = // previously initialised;
+ * uint64_t memory = 0;
+ *
+ * cardano_error_t rc = cardano_ex_units_get_memory_ex(ex_units, &memory);
+ *
+ * if (rc == CARDANO_SUCCESS)
+ * {
+ *   printf("Memory steps allocated: %llu\n", (unsigned long long)memory);
+ * }
+ * else
+ * {
+ *   printf("Failed to read memory steps: %s\n", cardano_ex_units_get_last_error(ex_units));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_units_get_memory_ex(
+  const cardano_ex_units_t* ex_units,
+  uint64_t*                 memory);
+
+/**
+ * \brief Sets the memory amount for the execution units.
+ *
+ * This function sets the memory units in the \ref cardano_ex_units_t object.
+ *
+ * \param[in,out] ex_units A pointer to the \ref cardano_ex_units_t object whose memory amount
+ *                         is to be set. This object must be previously initialized.
+ * \param[in] memory The memory amount to be set for the execution units.
+ *
+ * \return \ref CARDANO_SUCCESS if the memory was successfully set; otherwise, an appropriate
+ *         error code is returned indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_units_t* ex_units = cardano_ex_units_new(1024, 1000); // Assume ex_units is initialized with default values
+ * cardano_error_t result = cardano_ex_units_set_memory(ex_units, 2048); // Update memory to 2048 bytes
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Memory value updated successfully
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_units_set_memory(
+  cardano_ex_units_t* ex_units,
+  uint64_t            memory);
+
+/**
+ * \brief Retrieves the CPU steps allocated to an cardano_ex_units_t object.
+ *
+ * This function retrieves the amount of CPU steps that have been allocated to a \ref cardano_ex_units_t object,
+ * representing the computational resources allowed for executing a script.
+ *
+ * \param[in] ex_units A constant pointer to the \ref cardano_ex_units_t object from which
+ *                     the CPU steps are to be retrieved.
+ *
+ * \return The amount of CPU steps allocated to the cardano_ex_units_t object. If the ex_units is NULL,
+ *        the function returns 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_units_t* ex_units = ...; // Assume this is initialized
+ * uint64_t cpu_steps = cardano_ex_units_get_cpu_steps(ex_units);
+ * printf("CPU steps allocated: %llu\n", (unsigned long long)cpu_steps);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_ex_units_get_cpu_steps(const cardano_ex_units_t* ex_units);
+
+/**
+ * \brief Retrieves the CPU-step budget of an \ref cardano_ex_units_t object.
+ *
+ * \param[in]  ex_units  A pointer to an initialised \ref cardano_ex_units_t object.
+ *                       Must not be \c NULL.
+ * \param[out] steps     A pointer to a 64-bit unsigned integer that will receive the
+ *                       CPU-step count on success. Must not be \c NULL.
+ *
+ * \return A \ref cardano_error_t value:
+ *   - \ref CARDANO_SUCCESS               – The call succeeded and *steps now contains the CPU budget.
+ *   - \ref CARDANO_ERROR_POINTER_IS_NULL – \p ex_units or \p steps was \c NULL.
+ *   - Any other error code propagated from the underlying implementation.
+ *
+ * \note If the function fails, a descriptive message can be obtained by calling \ref cardano_ex_units_get_last_error on the \p ex_units object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_units_t* ex_units = // previously initialised;
+ * uint64_t cpu_steps = 0;
+ *
+ * cardano_error_t rc = cardano_ex_units_get_cpu_steps_ex(ex_units, &cpu_steps);
+ *
+ * if (rc == CARDANO_SUCCESS)
+ * {
+ *   printf("CPU steps allocated: %llu\n", (unsigned long long)cpu_steps);
+ * }
+ * else
+ * {
+ *   printf("Failed to read CPU steps: %s\n", cardano_ex_units_get_last_error(ex_units));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_units_get_cpu_steps_ex(
+  const cardano_ex_units_t* ex_units,
+  uint64_t*                 steps);
+
+/**
+ * \brief Sets the CPU steps for the specified execution units object.
+ *
+ * This function sets the number of CPU steps that the execution units object will represent.
+ *
+ * \param[in,out] ex_units A pointer to the \ref cardano_ex_units_t object whose CPU steps are to be set.
+ * \param[in] cpu_steps The number of CPU steps to set for the execution units.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the CPU steps were successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note It is important to ensure that the \p ex_units object has been properly initialized before
+ *       calling this function. If \p ex_units is NULL, the function will return \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_units_t* ex_units = ...; // Assume ex_units is already created and initialized
+ * uint64_t cpu_steps = 5000; // Example CPU steps
+ *
+ * cardano_error_t result = cardano_ex_units_set_cpu_steps(ex_units, cpu_steps);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // CPU steps are now set to 5000
+ *   // Proceed with using the ex_units object
+ * }
+ * else
+ * {
+ *   // Handle the error
+ *   fprintf(stderr, "Failed to set CPU steps: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_units_set_cpu_steps(
+  cardano_ex_units_t* ex_units,
+  uint64_t            cpu_steps);
+
+/**
+ * \brief Decrements the reference count of a cardano_ex_units_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_ex_units_t object
+ * by decreasing its reference count. When the reference count reaches zero, the ex_units is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] ex_units A pointer to the pointer of the ex_units object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_units_t* ex_units = cardano_ex_units_new(mem, cpu_steps);
+ *
+ * // Perform operations with the ex_units...
+ *
+ * cardano_ex_units_unref(&ex_units);
+ * // At this point, ex_units is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_ex_units_unref, the pointer to the \ref cardano_ex_units_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_ex_units_unref(cardano_ex_units_t** ex_units);
+
+/**
+ * \brief Increases the reference count of the cardano_ex_units_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_ex_units_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_ex_units_unref.
+ *
+ * \param ex_units A pointer to the cardano_ex_units_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming ex_units is a previously created ex_units object
+ *
+ * cardano_ex_units_ref(ex_units);
+ *
+ * // Now ex_units can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_ex_units_ref there is a corresponding
+ * call to \ref cardano_ex_units_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_ex_units_ref(cardano_ex_units_t* ex_units);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_ex_units_t object.
+ *
+ * This function returns the number of active references to an cardano_ex_units_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_ex_units_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param ex_units A pointer to the cardano_ex_units_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_ex_units_t object. If the object
+ * is properly managed (i.e., every \ref cardano_ex_units_ref call is matched with a
+ * \ref cardano_ex_units_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming ex_units is a previously created ex_units object
+ *
+ * size_t ref_count = cardano_ex_units_refcount(ex_units);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ex_units_refcount(const cardano_ex_units_t* ex_units);
+
+/**
+ * \brief Sets the last error message for a given cardano_ex_units_t object.
+ *
+ * Records an error message in the ex_units's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] ex_units A pointer to the \ref cardano_ex_units_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the ex_units's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_ex_units_set_last_error(cardano_ex_units_t* ex_units, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific ex_units.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_ex_units_set_last_error for the given
+ * ex_units. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] ex_units A pointer to the \ref cardano_ex_units_t instance whose last error
+ *                   message is to be retrieved. If the ex_units is NULL, the function
+ *                   returns a generic error message indicating the null ex_units.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified ex_units. If the ex_units is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_ex_units_set_last_error for the same ex_units, or until
+ *       the ex_units is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_ex_units_get_last_error(const cardano_ex_units_t* ex_units);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_ex_units_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_ex_units_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_ex_units_deep_clone(const cardano_ex_units_t* source, cardano_ex_units_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_EX_UNITS_H
diff --git a/vendor/include/cardano/common/governance_action_id.h b/vendor/include/cardano/common/governance_action_id.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/governance_action_id.h
@@ -0,0 +1,897 @@
+/**
+ * \file governance_action_id.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_ACTION_ID_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_ACTION_ID_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Each governance action that is accepted on the chain will be assigned a unique
+ * identifier, consisting of the transaction hash that created it and the index within
+ * the transaction body that points to it.
+ */
+typedef struct cardano_governance_action_id_t cardano_governance_action_id_t;
+
+/**
+ * \brief Creates and initializes a new instance of a governance action id.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_governance_action_id_t,
+ * using the provided transaction hash and index. It returns an error code to indicate success
+ * or failure of the operation.
+ *
+ * \param[in] transaction_hash A pointer to \ref cardano_blake2b_hash_t representing the transaction hash associated
+ *             with this governance action id. The hash must be properly initialized before being
+ *             passed to this function.
+ * \param[in] index The index within the transaction body that points this governance action.
+ * \param[out] governance_action_id On successful initialization, this will point to a newly created
+ *             \ref cardano_governance_action_id_t object. This object represents a "strong reference"
+ *             to the governance_action_id, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the governance_action_id is no longer needed, the caller must release it
+ *             by calling \ref cardano_governance_action_id_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the governance_action_id was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* hash = { ... };  // Assume hash is initialized here
+ * cardano_governance_action_id_t* governance_action_id = NULL;
+ *
+ * // Attempt to create a new governance_action_id
+ * cardano_error_t result = cardano_governance_action_id_new(hash, 1, &governance_action_id);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the governance_action_id
+ *
+ *   // Once done, ensure to clean up and release the governance_action_id
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ *
+ * cardano_blake2b_hash_unref(&hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_new(
+  const cardano_blake2b_hash_t*    transaction_hash,
+  uint64_t                         index,
+  cardano_governance_action_id_t** governance_action_id);
+
+/**
+ * \brief Parses a Bech32-encoded governance action ID and initializes a corresponding governance action ID object.
+ *
+ * This function takes a Bech32-encoded string representation of a governance action ID, as specified in CIP-129,
+ * and creates a \ref cardano_governance_action_id_t object.
+ *
+ * For example:
+ * - Bech32-encoded input: `gov_action1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpzklpgpf`
+ * - Resulting governance action ID: Transaction ID (`0000000000000000000000000000000000000000000000000000000000000000`),
+ *   Index (`11`).
+ *
+ * \param[in] data A pointer to the Bech32-encoded string. This parameter must not be NULL.
+ * \param[in] size The size of the Bech32-encoded string in bytes.
+ * \param[out] action_id A pointer to a \ref cardano_governance_action_id_t pointer. On successful parsing, this pointer
+ *             will point to a newly created governance action ID object. The caller is responsible for managing the
+ *             lifecycle of this object and must release it using \ref cardano_governance_action_id_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the parsing was successful and the governance action ID object was created.
+ *         Returns an appropriate error code otherwise:
+ *         - \ref CARDANO_ERROR_POINTER_IS_NULL if any input pointer is NULL.
+ *         - \ref CARDANO_ERROR_INVALID_ADDRESS_FORMAT if the input string is not a valid Bech32-encoded governance action ID.
+ *         - \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if memory for the decoding buffers could not be allocated.
+ *         - \ref CARDANO_ERROR_DECODING if the Bech32 string cannot be decoded, including allocation failures inside the
+ *           Bech32 decoder itself.
+ *
+ * Usage Example
+ * \code{.c}
+ * const char* bech32_string = "gov_action1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpzklpgpf";
+ * cardano_governance_action_id_t* action_id = NULL;
+ *
+ * cardano_error_t result = cardano_governance_action_id_from_bech32(bech32_string, strlen(bech32_string), &action_id);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Governance Action ID successfully parsed.\n");
+ *   // Use the action_id as needed
+ *
+ *   // Free the governance action ID object when done
+ *   cardano_governance_action_id_unref(&action_id);
+ * }
+ * else
+ * {
+ *   printf("Failed to parse governance action ID from Bech32: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_from_bech32(
+  const char*                      data,
+  size_t                           size,
+  cardano_governance_action_id_t** action_id);
+
+/**
+ * \brief Creates a governance action id from a hexadecimal transaction hash string.
+ *
+ * This function constructs a \ref cardano_governance_action_id_t object by interpreting the provided
+ * hexadecimal string as a hash value and associating it with a specified index. It
+ * returns an error code indicating the success or failure of the operation.
+ *
+ * \param[in] hex A pointer to a character array containing the hexadecimal representation of the transaction hash.
+ * \param[in] hex_size The size of the hexadecimal string in bytes.
+ * \param[in] index The index within the transaction body that points this governance action.
+ * \param[out] governance_action_id On successful initialization, this will point to a newly created
+ *                 \ref cardano_governance_action_id_t object. This object represents a "strong reference"
+ *                 to the governance_action_id, meaning that it is fully initialized and ready for use.
+ *                 The caller is responsible for managing the lifecycle of this object,
+ *                 specifically, once the governance_action_id is no longer needed, the caller must release it
+ *                 by calling \ref cardano_governance_action_id_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the governance_action_id was successfully created, or an appropriate error code
+ *         indicating the reason for failure.
+ *
+ * \note The function assumes that the hexadecimal string is valid and correctly formatted.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* hash_hex = "abcdef1234567890abcdef1234567890abcdef12....";
+ * size_t hex_size = strlen(hash_hex);
+ * cardano_governance_action_id_t* governance_action_id = NULL;
+ *
+ * // Attempt to create a new governance_action_id from a hexadecimal hash
+ * cardano_error_t result = cardano_governance_action_id_from_hash_hex(hash_hex, hex_size, 1, &governance_action_id);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the governance_action_id
+ *
+ *   // Once done, ensure to clean up and release the governance_action_id
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_from_hash_hex(
+  const char*                      hex,
+  size_t                           hex_size,
+  uint64_t                         index,
+  cardano_governance_action_id_t** governance_action_id);
+
+/**
+ * \brief Creates a governance action id from a byte array representing a transaction hash.
+ *
+ * This function constructs a \ref cardano_governance_action_id_t object by using the provided
+ * byte array as a hash value and associating it with a specified index. It returns an error
+ * code indicating the success or failure of the operation.
+ *
+ * \param[in] data A pointer to the byte array containing the hash data.
+ * \param[in] data_size The size of the byte array in bytes.
+ * \param[in] index The index within the transaction body that points this governance action.
+ * \param[out] governance_action_id On successful initialization, this will point to a newly created
+ *                 \ref cardano_governance_action_id_t object. This object represents a "strong reference"
+ *                 to the governance_action_id, meaning that it is fully initialized and ready for use.
+ *                 The caller is responsible for managing the lifecycle of this object,
+ *                 specifically, once the governance_action_id is no longer needed, the caller must release it
+ *                 by calling \ref cardano_governance_action_id_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the governance_action_id was successfully created, or an appropriate error code
+ *         indicating the reason for failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t hash_data[] = { 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef ... };
+ * size_t data_size = sizeof(hash_data);
+ * cardano_governance_action_id_t* governance_action_id = NULL;
+ *
+ * // Attempt to create a new governance_action_id from byte array hash
+ * cardano_error_t result = cardano_governance_action_id_from_hash_bytes(hash_data, data_size, 1, &governance_action_id);
+ *
+ * if (result == CARDANO_SUCCESS && governance_action_id)
+ * {
+ *   // Use the governance_action_id
+ *
+ *   // Once done, ensure to clean up and release the governance_action_id
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_from_hash_bytes(
+  const byte_t*                    data,
+  size_t                           data_size,
+  uint64_t                         index,
+  cardano_governance_action_id_t** governance_action_id);
+
+/**
+ * \brief Creates a governance_action_id from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_governance_action_id_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a governance action id.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded governance action id data.
+ * \param[out] governance_action_id A pointer to a pointer of \ref cardano_governance_action_id_t that will be set to the address
+ *                        of the newly created governance action id object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the governance_action_id was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_governance_action_id_t object by calling
+ *       \ref cardano_governance_action_id_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_governance_action_id_t* governance_action_id = NULL;
+ *
+ * cardano_error_t result = cardano_governance_action_id_from_cbor(reader, &governance_action_id);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the governance_action_id
+ *
+ *   // Once done, ensure to clean up and release the governance_action_id
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode governance_action_id: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_from_cbor(cardano_cbor_reader_t* reader, cardano_governance_action_id_t** governance_action_id);
+
+/**
+ * \brief Serializes a governance action id into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_governance_action_id_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] governance_action_id A constant pointer to the \ref cardano_governance_action_id_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p governance_action_id or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* governance_action_id = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_governance_action_id_to_cbor(governance_action_id, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_governance_action_id_to_cbor(
+  const cardano_governance_action_id_t* governance_action_id,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes a governance action ID to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "transaction_id", "gov_action_index".
+ *
+ * \param[in]  action_id Pointer to a valid \ref cardano_governance_action_id_t.
+ * \param[in]  writer    Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p action_id or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_to_cip116_json(
+  const cardano_governance_action_id_t* action_id,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Computes the required buffer size for a CIP-29 compliant Bech32 representation of a governance action ID.
+ *
+ * This function calculates the minimum buffer size, including null termination, needed to store the Bech32 string representation
+ * of a governance action ID. The Bech32 representation combines a transaction ID (32 bytes) and an index (1 byte) into a single
+ * string with the prefix `gov_action`.
+ *
+ * \param[in] governance_action_id A pointer to an initialized \ref cardano_governance_action_id_t object representing the
+ *                                 governance action ID. This parameter must not be NULL.
+ *
+ * \return The required buffer size in bytes, including space for the null-terminator.
+ *
+ * Usage Example
+ * \code{.c}
+ * cardano_governance_action_id_t* gov_action_id = ...; // Assume initialized
+ * size_t required_size = cardano_governance_action_id_get_bech32_size(gov_action_id);
+ *
+ * char* bech32_str = (char*)malloc(required_size);
+ *
+ * if (bech32_str != NULL)
+ * {
+ *   // Use the buffer for encoding the governance action ID into Bech32 format
+ *   free(bech32_str);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t
+cardano_governance_action_id_get_bech32_size(
+  const cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Converts a governance action ID to its CIP-29 compliant Bech32 representation.
+ *
+ * This function encodes a governance action ID, which combines a transaction ID (32 bytes) and an index (1 byte), into its
+ * Bech32 string representation. The resulting Bech32 string uses the prefix `gov_action` as defined in CIP-29 and is stored
+ * in the provided buffer.
+ *
+ * \param[in] governance_action_id A pointer to an initialized \ref cardano_governance_action_id_t object representing the
+ *                                 governance action ID to be converted. This parameter must not be NULL.
+ * \param[out] data A pointer to the buffer where the resulting Bech32 string will be stored. The buffer must have sufficient
+ *                  size, as determined by \ref cardano_governance_action_id_get_bech32_size.
+ * \param[in] size The size of the provided buffer in bytes, including space for the null-terminator.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful and the Bech32 string is stored in `data`. Returns an appropriate error code if the operation fails.
+ *
+ * Usage Example
+ * \code{.c}
+ * cardano_governance_action_id_t* gov_action_id = ...; // Assume initialized
+ * size_t required_size = cardano_governance_action_id_get_bech32_size(gov_action_id);
+ *
+ * char* bech32_str = (char*)malloc(required_size);
+ *
+ * if (bech32_str != NULL)
+ * {
+ *   cardano_error_t result = cardano_governance_action_id_to_bech32(gov_action_id, bech32_str, required_size);
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Governance Action Bech32: %s\n", bech32_str);
+ *   }
+ *   else
+ *   {
+ *     printf("Error converting governance action ID to Bech32: %s\n", cardano_error_to_string(result));
+ *   }
+ *   free(bech32_str);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_to_bech32(
+  const cardano_governance_action_id_t* governance_action_id,
+  char*                                 data,
+  size_t                                size);
+
+/**
+ * \brief Retrieves the Bech32 string representation of a governance action ID.
+ *
+ * This function returns the Bech32-encoded string representation of a governance action ID as specified in CIP-0129.
+ * The governance action ID is derived from the transaction ID and index, and the Bech32 encoding includes the appropriate
+ * prefix (`"gov_action"`) followed by the encoded ID.
+ *
+ * For example:
+ * - Transaction ID: `0000000000000000000000000000000000000000000000000000000000000000`
+ * - Index: `11`
+ * - Bech32-encoded governance action ID: `gov_action1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpzklpgpf`
+ *
+ * \param[in] governance_action_id A pointer to an initialized \ref cardano_governance_action_id_t object representing the governance action ID.
+ *                                 This parameter must not be NULL.
+ *
+ * \return A constant pointer to a null-terminated string containing the Bech32-encoded governance action ID.
+ *         The returned string is managed internally by the library and must not be modified or freed by the caller.
+ *         Returns `NULL` if the input pointer is invalid.
+ *
+ * ### Usage Example
+ * \code{.c}
+ * const cardano_governance_action_id_t* gov_action_id = ...; // Assume initialized
+ * const char* bech32_string = cardano_governance_action_id_get_string(gov_action_id);
+ *
+ * if (bech32_string != NULL)
+ * {
+ *   printf("Governance Action ID (Bech32): %s\n", bech32_string);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve governance action ID in Bech32 format.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char*
+cardano_governance_action_id_get_string(
+  const cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the transaction hash associated with a governance action id.
+ *
+ * This function provides access to the hash part of a \ref cardano_governance_action_id_t object.
+ * It returns a new reference to a \ref cardano_blake2b_hash_t object representing the hash.
+ * This allows the hash to be used independently of the original governance_action_id object. The
+ * reference count of the hash object is increased by one, making it the caller's responsibility
+ * to release it by calling \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * \param governance_action_id A constant pointer to the \ref cardano_governance_action_id_t object from which
+ *                   the hash is to be retrieved.
+ *
+ * \return A pointer to a new \ref cardano_blake2b_hash_t object containing the hash.
+ *         If the input governance_action_id is NULL, returns NULL. The caller is responsible for
+ *         managing the lifecycle of this object, including releasing it with
+ *         \ref cardano_blake2b_hash_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* original_governance_action_id = cardano_governance_action_id_new(...);
+ * cardano_blake2b_hash_t* hash_governance_action_id = cardano_governance_action_id_get_hash(original_governance_action_id);
+ *
+ * if (hash_governance_action_id)
+ * {
+ *   // Use the hash governance_action_id
+ *
+ *   // Once done, ensure to clean up and release the hash governance_action_id
+ *   cardano_blake2b_hash_unref(&hash_governance_action_id);
+ * }
+ *
+ * // Release the original governance_action_id after use
+ * cardano_governance_action_id_unref(&original_governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_governance_action_id_get_hash(const cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the size of the hash bytes stored in the governance action id.
+ *
+ * This function computes the size of the hash bytes stored within a \ref cardano_governance_action_id_t object.
+ * It is particularly useful for determining the buffer size needed to store the hash bytes when
+ * retrieving them via \ref cardano_governance_action_id_get_hash_bytes.
+ *
+ * \param[in] governance_action_id A constant pointer to the \ref cardano_governance_action_id_t object from which
+ *                       the size of the hash bytes is to be retrieved.
+ *
+ * \return The size of the hash bytes. If the governance_action_id is NULL the function returns zero.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...);
+ * size_t hash_size = cardano_governance_action_id_get_hash_bytes_size(governance_action_id);
+ *
+ * if (hash_size > 0)
+ * {
+ *   byte_t* hash_bytes = malloc(hash_size);
+ *
+ *   if (hash_bytes)
+ *   {
+ *     // Proceed to get the hash bytes
+ *   }
+ * }
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_governance_action_id_get_hash_bytes_size(const cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the byte array representation of the transaction hash from a governance action id.
+ *
+ * This function accesses the byte representation of the hash associated with a given
+ * \ref cardano_governance_action_id_t object. It provides a direct pointer to the internal byte array
+ * representing the hash, which should not be modified or freed by the caller.
+ *
+ * \param governance_action_id A constant pointer to the \ref cardano_governance_action_id_t object from which
+ *                   the hash bytes are to be retrieved.
+ *
+ * \return A pointer to a constant byte array containing the hash data. If the input governance_action_id
+ *         is NULL, returns NULL. The data remains valid as long as the governance_action_id object is not
+ *         freed or modified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...);
+ * const byte_t* hash_bytes = cardano_governance_action_id_get_hash_bytes(governance_action_id);
+ *
+ * if (hash_bytes)
+ * {
+ *   // Use the hash bytes for operations like comparison or display
+ * }
+ *
+ * // Clean up the governance_action_id object once done
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_governance_action_id_get_hash_bytes(const cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the size needed for the hexadecimal string representation of the governance_action_id's hash.
+ *
+ * This function calculates the size required to store the hexadecimal string representation of the hash
+ * associated with a \ref cardano_governance_action_id_t object. This size includes the space needed for the null-terminator.
+ *
+ * \param[in] governance_action_id A constant pointer to the \ref cardano_governance_action_id_t object whose hash size is to be determined.
+ *
+ * \return The size in bytes required to store the hexadecimal representation of the hash, including the null terminator.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...);
+ * size_t hex_size = cardano_governance_action_id_get_hash_hex_size(governance_action_id);
+ * char* hex_string = malloc(hex_size);
+ *
+ * if (hex_string)
+ * {
+ *   // Now use hex_string to get the hash or do other operations
+ *   free(hex_string);
+ * }
+ *
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_governance_action_id_get_hash_hex_size(const cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the hexadecimal string representation of the hash from a governance action id.
+ *
+ * This function provides access to the hexadecimal (hex) string representation of the hash
+ * associated with a given \ref cardano_governance_action_id_t object. It returns a direct pointer to the
+ * internal hex string which should not be modified or freed by the caller.
+ *
+ * \param governance_action_id A constant pointer to the \ref cardano_governance_action_id_t object from which
+ *                   the hex string of the hash is to be retrieved. The object must not be NULL.
+ *
+ * \return A pointer to a constant character array containing the hex representation of the hash.
+ *         If the input governance_action_id is NULL, returns NULL. The data remains valid as long as the
+ *         governance_action_id object is not freed or modified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...);
+ * const char* hash_hex = cardano_governance_action_id_get_hash_hex(governance_action_id);
+ *
+ * if (hash_hex)
+ * {
+ *   // Use the hash hex for operations like logging, display, or comparison
+ * }
+ *
+ * // Clean up the governance_action_id object once done
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_governance_action_id_get_hash_hex(const cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the index of the governance action id.
+ *
+ * This function retrieves the index of a given \ref cardano_governance_action_id_t object and stores it in the provided
+ * output parameter.
+ *
+ * \param[in] governance_action_id A constant pointer to the \ref cardano_governance_action_id_t object from which
+ *                                 the index is to be retrieved. The object must not be NULL.
+ * \param[out] index Pointer to a variable where the governance action id index will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the index was successfully retrieved, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...);
+ * uint64_t index = 0;
+ * cardano_error_t result = cardano_governance_action_id_get_index(governance_action_id, &index);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *  // Handle governance action id index
+ * }
+ *
+ * // Clean up the governance_action_id object once done
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_get_index(const cardano_governance_action_id_t* governance_action_id, uint64_t* index);
+
+/**
+ * \brief Sets the index of the governance action id.
+ *
+ * This function assigns a new index to an existing \ref cardano_governance_action_id_t object.
+ *
+ * \param[in,out] governance_action_id A pointer to the \ref cardano_governance_action_id_t object whose index is to be set.
+ * \param[in] index The new index of the governance action id.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the type was successfully set. Returns \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p governance_action_id pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...);
+ * cardano_error_t result = cardano_governance_action_id_set_index(governance_action_id, 1);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // governance_action_id index updated successfully
+ * }
+ *
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_set_index(cardano_governance_action_id_t* governance_action_id, uint64_t index);
+
+/**
+ * \brief Sets the hash for a governance action id.
+ *
+ * This function assigns a new hash to an existing \ref cardano_governance_action_id_t object. The function copies the
+ * provided hash into the governance_action_id, so the original hash object may be modified or freed after this operation without
+ * affecting the governance_action_id's hash.
+ *
+ * \param[in,out] governance_action_id A pointer to the \ref cardano_governance_action_id_t object whose hash is to be set.
+ *                           This object must have been previously created and not yet freed.
+ * \param[in] hash A pointer to a \ref cardano_blake2b_hash_t object containing the new hash to be set.
+ *                 This parameter must not be NULL.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the hash was successfully set. If the \p governance_action_id or \p hash is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* governance_action_id = ...;
+ * cardano_blake2b_hash_t* new_hash = cardano_blake2b_compute_hash(...);
+ *
+ * cardano_error_t result = cardano_governance_action_id_set_hash(governance_action_id, new_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The hash was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * cardano_blake2b_hash_unref(&new_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_set_hash(cardano_governance_action_id_t* governance_action_id, const cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Checks if two governance_action_id objects are equal.
+ *
+ * This function compares two \ref cardano_governance_action_id_t objects for equality.
+ * It checks if the contents of the two governance_action_id objects are identical.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_governance_action_id_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_governance_action_id_t object to be compared.
+ *
+ * \return \c true if the two governance_action_id objects are equal (have the same contents), \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* governance_action_id1 = ...;
+ * cardano_governance_action_id_t* governance_action_id2 = ...;
+ *
+ * if (cardano_governance_action_id_equals(governance_action_id1, governance_action_id2))
+ * {
+ *   printf("governance_action_id1 is equal to governance_action_id2\n");
+ * }
+ * else
+ * {
+ *   printf("governance_action_id1 is not equal to governance_action_id2\n");
+ * }
+ *
+ * // Clean up the governance_action_id objects once done
+ * cardano_governance_action_id_unref(&governance_action_id1);
+ * cardano_governance_action_id_unref(&governance_action_id2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_governance_action_id_equals(const cardano_governance_action_id_t* lhs, const cardano_governance_action_id_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a governance_action_id object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_governance_action_id_t object
+ * by decreasing its reference count. When the reference count reaches zero, the governance_action_id is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] governance_action_id A pointer to the pointer of the governance_action_id object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new();
+ *
+ * // Perform operations with the governance action id...
+ *
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * // At this point, governance_action_id is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_governance_action_id_unref, the pointer to the \ref cardano_governance_action_id_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_governance_action_id_unref(cardano_governance_action_id_t** governance_action_id);
+
+/**
+ * \brief Increases the reference count of the cardano_governance_action_id_t object.
+ *
+ * This function is used to manually increment the reference count of a governance_action_id
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_governance_action_id_unref.
+ *
+ * \param governance_action_id A pointer to the governance_action_id object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming governance_action_id is a previously created governance_action_id object
+ *
+ * cardano_governance_action_id_ref(governance_action_id);
+ *
+ * // Now governance_action_id can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_governance_action_id_ref there is a corresponding
+ * call to \ref cardano_governance_action_id_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_governance_action_id_ref(cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_governance_action_id_t object.
+ *
+ * This function returns the number of active references to a governance_action_id object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_governance_action_id_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param governance_action_id A pointer to the governance_action_id object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified governance_action_id object. If the object
+ * is properly managed (i.e., every \ref cardano_governance_action_id_ref call is matched with a
+ * \ref cardano_governance_action_id_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming governance_action_id is a previously created governance_action_id object
+ *
+ * size_t ref_count = cardano_governance_action_id_refcount(governance_action_id);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_governance_action_id_refcount(const cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Sets the last error message for a given governance_action_id object.
+ *
+ * Records an error message in the governance_action_id's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] governance_action_id A pointer to the \ref cardano_governance_action_id_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the governance_action_id's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_governance_action_id_set_last_error(cardano_governance_action_id_t* governance_action_id, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific governance action id.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_governance_action_id_set_last_error for the given
+ * governance action id. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] governance_action_id A pointer to the \ref cardano_governance_action_id_t instance whose last error
+ *                   message is to be retrieved. If the governance_action_id is NULL, the function
+ *                   returns a generic error message indicating the null governance action id.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified governance action id. If the governance_action_id is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_governance_action_id_set_last_error for the same governance_action_id, or until
+ *       the governance_action_id is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_governance_action_id_get_last_error(const cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_governance_action_id_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_governance_action_id_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_deep_clone(const cardano_governance_action_id_t* source, cardano_governance_action_id_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_ACTION_ID_H
diff --git a/vendor/include/cardano/common/governance_key_type.h b/vendor/include/cardano/common/governance_key_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/governance_key_type.h
@@ -0,0 +1,56 @@
+/**
+ * \file governance_key_type.h
+ *
+ * \author angel.castillo
+ * \date   Nov 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_KEY_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_KEY_TYPE_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumerates the types of governance keys.
+ */
+typedef enum
+{
+  /**
+   * \brief CIP-1852’s constitutional committee hot verification signing key
+   */
+  CARDANO_GOVERNANCE_KEY_TYPE_CC_HOT = 0,
+
+  /**
+   * \brief Constitutional committee cold verification key hash (cold credential).
+   */
+  CARDANO_GOVERNANCE_KEY_TYPE_CC_COLD = 1,
+
+  /**
+   * \brief Constitutional committee hot verification key hash (hot credential).
+   */
+  CARDANO_GOVERNANCE_KEY_TYPE_DREP = 2
+} cardano_governance_key_type_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_KEY_TYPE_H
diff --git a/vendor/include/cardano/common/guard_set.h b/vendor/include/cardano/common/guard_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/guard_set.h
@@ -0,0 +1,515 @@
+/**
+ * \file guard_set.h
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_GUARD_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_GUARD_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents the set of credentials that must authorize a transaction (the guards
+ * transaction body field).
+ *
+ * Guards generalize the required signers field: in addition to key hash credentials, a guard
+ * can be a script hash credential whose script must be executed to authorize the transaction.
+ *
+ * On the wire this set has two forms: a set of bare key hashes (the historical required
+ * signers encoding) and an ordered set of credentials. The set preserves insertion order and
+ * rejects duplicates, since redeemers for script hash guards are indexed by the position of
+ * the credential within this set.
+ */
+typedef struct cardano_guard_set_t cardano_guard_set_t;
+
+/**
+ * \brief Serializes this Dijkstra value using CIP-116 JSON conventions.
+ *
+ * Encodes an array in insertion order. Each member uses its own CIP-116-style JSON representation.
+ *
+ * \param[in] value Value to serialize. Must not be NULL.
+ * \param[in] writer JSON writer that receives the encoded value. Must not be NULL.
+ *
+ * \return CARDANO_SUCCESS on success, CARDANO_ERROR_POINTER_IS_NULL for a NULL argument,
+ *         or the error returned by a child serializer.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_guard_set_to_cip116_json(const cardano_guard_set_t* value, cardano_json_writer_t* writer);
+
+/**
+ * \brief Creates and initializes a new instance of a guard_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_guard_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] guard_set On successful initialization, this will point to a newly created
+ *             \ref cardano_guard_set_t object. This object represents a "strong reference"
+ *             to the guard_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the guard_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_guard_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the guard_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_guard_set_t* guard_set = NULL;
+ *
+ * // Attempt to create a new guard_set
+ * cardano_error_t result = cardano_guard_set_new(&guard_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the guard_set
+ *
+ *   // Once done, ensure to clean up and release the guard_set
+ *   cardano_guard_set_unref(&guard_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_guard_set_new(cardano_guard_set_t** guard_set);
+
+/**
+ * \brief Creates a guard set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_guard_set_t object.
+ * The set accepts both wire forms, with or without the set tag (258): a set of bare 28 byte key hashes (each is wrapped as a
+ * key hash credential) and an ordered set of credentials. The form is determined by the first element of the set; mixing
+ * both forms within one set is a decoding error, as is an empty set or a duplicated element.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded guard set data.
+ * \param[out] guard_set A pointer to a pointer of \ref cardano_guard_set_t that will be set to the address
+ *                        of the newly created guard_set object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the guard_set was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_guard_set_t object by calling
+ *       \ref cardano_guard_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_guard_set_t* guard_set = NULL;
+ *
+ * cardano_error_t result = cardano_guard_set_from_cbor(reader, &guard_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the guard_set
+ *
+ *   // Once done, ensure to clean up and release the guard_set
+ *   cardano_guard_set_unref(&guard_set);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode guard_set: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_guard_set_from_cbor(cardano_cbor_reader_t* reader, cardano_guard_set_t** guard_set);
+
+/**
+ * \brief Serializes a guard set into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_guard_set_t object using a \ref cardano_cbor_writer_t.
+ * The wire form is chosen by content: if every member is a key hash credential, the set is emitted as a set
+ * of bare key hashes (the historical required signers encoding); if at least one member is a script hash
+ * credential, the set is emitted as an ordered set of credentials.
+ *
+ * \param[in] guard_set A constant pointer to the \ref cardano_guard_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p guard_set or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_guard_set_t* guard_set = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_guard_set_to_cbor(guard_set, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_guard_set_unref(&guard_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_guard_set_to_cbor(
+  const cardano_guard_set_t* guard_set,
+  cardano_cbor_writer_t*     writer);
+
+/**
+ * \brief Retrieves the length of a guard set.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_guard_set_t object.
+ *
+ * \param[in] guard_set A constant pointer to the \ref cardano_guard_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the guard_set. Return 0 if the guard_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_guard_set_t* guard_set = NULL;
+ * cardano_error_t result = cardano_guard_set_new(&guard_set);
+ *
+ * // Populate guard_set with elements
+ *
+ * size_t length = cardano_guard_set_get_length(guard_set);
+ * printf("Length of the guard_set: %zu\n", length);
+ *
+ * // Clean up the guard_set object once done
+ * cardano_guard_set_unref(&guard_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_guard_set_get_length(const cardano_guard_set_t* guard_set);
+
+/**
+ * \brief Retrieves an element from a guard set by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_guard_set_t object
+ * and stores it in the output parameter. Elements keep the order in which they were decoded or added.
+ *
+ * \param[in] guard_set A constant pointer to the \ref cardano_guard_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the guard set. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_credential_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_credential_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_guard_set_t* guard_set = NULL;
+ * cardano_error_t result = cardano_guard_set_new(&guard_set);
+ *
+ * // Populate guard_set with elements
+ *
+ * cardano_credential_t* element = NULL;
+ * result = cardano_guard_set_get(guard_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_credential_unref(&element);
+ * }
+ *
+ * // Clean up the guard_set object once done
+ * cardano_guard_set_unref(&guard_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_guard_set_get(const cardano_guard_set_t* guard_set, size_t index, cardano_credential_t** element);
+
+/**
+ * \brief Adds an element to a guard set.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_guard_set_t object.
+ * Insertion order is preserved, since redeemers for script hash guards are indexed by the position of
+ * the credential within this set. Duplicated elements are rejected.
+ *
+ * \param[in] guard_set A constant pointer to the \ref cardano_guard_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_credential_t object that is to be added to the guard_set.
+ *                    The element will be referenced by the guard_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the guard_set,
+ *         \ref CARDANO_ERROR_DUPLICATED_KEY if the element is already present in the set, or an
+ *         appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_guard_set_t* guard_set = NULL;
+ * cardano_error_t result = cardano_guard_set_new(&guard_set);
+ *
+ * // Create and initialize a new credential element
+ * cardano_credential_t* element = { ... };
+ *
+ * // Add the element to the guard_set
+ * result = cardano_guard_set_add(guard_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the guard_set object once done
+ * cardano_guard_set_unref(&guard_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_guard_set_add(cardano_guard_set_t* guard_set, cardano_credential_t* element);
+
+/**
+ * \brief Determines if the guard set uses tags in its encoding.
+ *
+ * This function checks whether the given \ref cardano_guard_set_t object
+ * uses the Conway era encoding for sets, which are collections identified by a tag.
+ *
+ * \param[in] guard_set A pointer to an initialized \ref cardano_guard_set_t object.
+ *
+ * \return A boolean value:
+ *         - \c true if the guard set uses the Conway era encoding for sets (tagged sets).
+ *         - \c false if the guard set uses the older encoding (arrays without tags).
+ *
+ * \note This function helps in determining the serialization format of the guard set,
+ *       which may be necessary for compatibility with other transaction encoders/decoders.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_guard_set_t* guard_set = ...; // Assume guard_set is already initialized
+ * bool is_tagged_set = cardano_guard_set_is_tagged(guard_set);
+ *
+ * if (is_tagged_set)
+ * {
+ *   printf("The guard set uses Conway era tag for sets.\n");
+ * }
+ * else
+ * {
+ *   printf("The guard set uses pre-Conway era encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_guard_set_is_tagged(const cardano_guard_set_t* guard_set);
+
+/**
+ * \brief Enables or disables tagged encoding (Conway era feature) for the guard set.
+ *
+ * This function sets whether the specified \ref cardano_guard_set_t object should use tagged encoding
+ * (introduced in the Conway era) when serializing the set in CBOR. If \p use_tag is set to \c true, the set will be
+ * encoded using tagged sets. Otherwise, it will use the older array-based encoding method.
+ *
+ * \param[in,out] guard_set A pointer to an initialized \ref cardano_guard_set_t object.
+ * \param[in] use_tag A boolean value that determines whether to use tagged encoding (\c true) or legacy array encoding (\c false).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_guard_set_t* guard_set = ...; // Assume guard_set is already initialized
+ * cardano_error_t result = cardano_guard_set_set_use_tag(guard_set, true);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The guard set is now set to use tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set tagged encoding: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_guard_set_set_use_tag(cardano_guard_set_t* guard_set, bool use_tag);
+
+/**
+ * \brief Decrements the reference count of a guard_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_guard_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the guard_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] guard_set A pointer to the pointer of the guard_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_guard_set_t* guard_set = NULL;
+ * cardano_error_t result = cardano_guard_set_new(&guard_set);
+ *
+ * // Perform operations with the guard_set...
+ *
+ * cardano_guard_set_unref(&guard_set);
+ * // At this point, guard_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_guard_set_unref, the pointer to the \ref cardano_guard_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_guard_set_unref(cardano_guard_set_t** guard_set);
+
+/**
+ * \brief Increases the reference count of the cardano_guard_set_t object.
+ *
+ * This function is used to manually increment the reference count of a guard_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_guard_set_unref.
+ *
+ * \param guard_set A pointer to the guard_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming guard_set is a previously created guard_set object
+ *
+ * cardano_guard_set_ref(guard_set);
+ *
+ * // Now guard_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_guard_set_ref there is a corresponding
+ * call to \ref cardano_guard_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_guard_set_ref(cardano_guard_set_t* guard_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_guard_set_t object.
+ *
+ * This function returns the number of active references to a guard_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_guard_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param guard_set A pointer to the guard_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified guard_set object. If the object
+ * is properly managed (i.e., every \ref cardano_guard_set_ref call is matched with a
+ * \ref cardano_guard_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming guard_set is a previously created guard_set object
+ *
+ * size_t ref_count = cardano_guard_set_refcount(guard_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_guard_set_refcount(const cardano_guard_set_t* guard_set);
+
+/**
+ * \brief Sets the last error message for a given guard_set object.
+ *
+ * Records an error message in the guard_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] guard_set A pointer to the \ref cardano_guard_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the guard_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_guard_set_set_last_error(cardano_guard_set_t* guard_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific guard_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_guard_set_set_last_error for the given
+ * guard_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] guard_set A pointer to the \ref cardano_guard_set_t instance whose last error
+ *                   message is to be retrieved. If the guard_set is NULL, the function
+ *                   returns a generic error message indicating the null guard_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified guard_set. If the guard_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_guard_set_set_last_error for the same guard_set, or until
+ *       the guard_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_guard_set_get_last_error(const cardano_guard_set_t* guard_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_guard_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_guard_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_guard_set_deep_clone(const cardano_guard_set_t* source, cardano_guard_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_GUARD_SET_H
diff --git a/vendor/include/cardano/common/network_id.h b/vendor/include/cardano/common/network_id.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/network_id.h
@@ -0,0 +1,53 @@
+/**
+ * \file network_id.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_NETWORK_ID_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_NETWORK_ID_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Defines the network identifiers used within the Cardano ecosystem.
+ *
+ * This enumeration is used to specify the network for which a Cardano transaction or operation is intended.
+ */
+typedef enum
+{
+  /**
+   * \brief Represents the test network (testnet).
+   */
+  CARDANO_NETWORK_ID_TEST_NET = 0,
+
+  /**
+   * \brief Represents the main network (mainnet).
+   */
+  CARDANO_NETWORK_ID_MAIN_NET = 1
+} cardano_network_id_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_NETWORK_ID_H
diff --git a/vendor/include/cardano/common/network_magic.h b/vendor/include/cardano/common/network_magic.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/network_magic.h
@@ -0,0 +1,92 @@
+/**
+ * \file network_magic.h
+ *
+ * \author angel.castillo
+ * \date   Sep 28, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_NETWORK_MAGIC_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_NETWORK_MAGIC_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumerates the available Cardano network environments.
+ *
+ * This enumeration defines the different network environments that can be used
+ * with the Cardano provider.
+ */
+typedef enum
+{
+  /**
+   * \brief The Pre-Production test network.
+   *
+   * The Pre-Production network is a Cardano testnet used for testing features
+   * before they are deployed to the Mainnet. It closely mirrors the Mainnet
+   * environment, providing a final testing ground for applications.
+   */
+  CARDANO_NETWORK_MAGIC_PREPROD = 1,
+
+  /**
+   * \brief The Preview test network.
+   *
+   * The Preview network is a Cardano testnet used for testing upcoming features
+   * before they are released to the Pre-Production network. It allows developers
+   * to experiment with new functionalities in a controlled environment.
+   */
+  CARDANO_NETWORK_MAGIC_PREVIEW = 2,
+
+  /**
+   * \brief The SanchoNet test network.
+   *
+   * SanchoNet is the testnet for rolling out governance features for the Cardano blockchain,
+   * aligning with the comprehensive CIP-1694 specifications.
+   */
+  CARDANO_NETWORK_MAGIC_SANCHONET = 4,
+
+  /**
+   * \brief The Mainnet network.
+   *
+   * The Mainnet is the live Cardano network where real transactions occur.
+   * Applications interacting with the Mainnet are dealing with actual ADA and
+   * other assets. Caution should be exercised to ensure correctness and security.
+   */
+  CARDANO_NETWORK_MAGIC_MAINNET = 764824073,
+} cardano_network_magic_t;
+
+/**
+ * \brief Converts network magics to their human readable form.
+ *
+ * \param[in] magic The network magic to get the string representation for.
+ * \return Human readable form of the given network magic.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_network_magic_to_string(cardano_network_magic_t magic);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_NETWORK_MAGIC_H
diff --git a/vendor/include/cardano/common/protocol_version.h b/vendor/include/cardano/common/protocol_version.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/protocol_version.h
@@ -0,0 +1,464 @@
+/**
+ * \file protocol_version.h
+ *
+ * \author angel.castillo
+ * \date   Mar 07, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PROTOCOL_VERSION_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PROTOCOL_VERSION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The protocol can be thought of as the set of rules that nodes in the network agree to follow,
+ *  and this versioning system helps nodes to keep track of which set of rules they are adhering to and also
+ *  allows for the decentralized updating of the protocol parameters without requiring a hard fork.
+ */
+typedef struct cardano_protocol_version_t cardano_protocol_version_t;
+
+/**
+ * \brief Creates and initializes a new instance of the Protocol Version.
+ *
+ * This function allocates and initializes a new instance of the Protocol Version,
+ * representing a version of the Cardano protocol.
+ *
+ * \param[in] major The major version number, indicating significant alterations to the protocol
+ *                  that are not backward compatible. Nodes would need to upgrade to continue
+ *                  participating in the network.
+ * \param[in] minor The minor version number, reflecting backward-compatible changes.
+ * \param[out] protocol_version On successful initialization, this will point to a newly created
+ *            Protocol Version object. This object represents a "strong reference",
+ *            meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the Protocol Version is no longer needed, the caller must release it
+ *            by calling \ref cardano_protocol_version_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Protocol Version was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_version_t* protocol_version = NULL;
+ * uint64_t major = 1; // Major version 1
+ * uint64_t minor = 0; // Minor version 0
+ *
+ * // Attempt to create a new Protocol Version object
+ * cardano_error_t result = cardano_protocol_version_new(major, minor, &protocol_version);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the protocol_version
+ *
+ *   // Once done, ensure to clean up and release the protocol_version
+ *   cardano_protocol_version_unref(&protocol_version);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_protocol_version_new(
+  uint64_t                     major,
+  uint64_t                     minor,
+  cardano_protocol_version_t** protocol_version);
+
+/**
+ * \brief Creates a \ref cardano_protocol_version_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_protocol_version_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a protocol_version.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] protocol_version A pointer to a pointer of \ref cardano_protocol_version_t that will be set to the address
+ *                        of the newly created protocol_version object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the protocol version were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark The minor version is bounded to the uint32 range (0 to 4294967295); the function returns
+ *         \ref CARDANO_ERROR_INVALID_CBOR_VALUE for larger values.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_protocol_version_t object by calling
+ *       \ref cardano_protocol_version_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_protocol_version_t* protocol_version = NULL;
+ *
+ * cardano_error_t result = cardano_protocol_version_from_cbor(reader, &protocol_version);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the protocol_version
+ *
+ *   // Once done, ensure to clean up and release the protocol_version
+ *   cardano_protocol_version_unref(&protocol_version);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode protocol_version: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_protocol_version_from_cbor(cardano_cbor_reader_t* reader, cardano_protocol_version_t** protocol_version);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_protocol_version_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] protocol_version A constant pointer to the \ref cardano_protocol_version_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p protocol_version or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_version_t* protocol_version = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_protocol_version_to_cbor(protocol_version, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_protocol_version_unref(&protocol_version);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_version_to_cbor(
+  const cardano_protocol_version_t* protocol_version,
+  cardano_cbor_writer_t*            writer);
+
+/**
+ * \brief Serializes a protocol version to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "major", "minor".
+ *
+ * \param[in]  version Pointer to a valid \ref cardano_protocol_version_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p version or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_protocol_version_to_cip116_json(
+  const cardano_protocol_version_t* version,
+  cardano_json_writer_t*            writer);
+
+/**
+ * \brief Retrieves the major version number of the Protocol Version.
+ *
+ * This function returns the major version number of the Protocol Version,
+ *
+ * \param[in] protocol_version Pointer to the Protocol Version object.
+ *
+ * \return The major version number of the Protocol Version.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_version_t* protocol_version = NULL;
+ * // Assume protocol_version is initialized properly
+ *
+ * uint64_t major_version = cardano_protocol_version_get_major(protocol_version);
+ * printf("Major Version: %lu\n", major_version);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_version_get_major(
+  const cardano_protocol_version_t* protocol_version);
+
+/**
+ * \brief Sets the major version number of the Protocol Version.
+ *
+ * This function sets the major version number of the Protocol Version,
+ *
+ * \param[in] protocol_version Pointer to the Protocol Version object.
+ * \param[in] major The major version number to set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the major version number was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_version_t* protocol_version = NULL;
+ * // Assume protocol_version is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_version_set_major(protocol_version, 2);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Major version set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set major version: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_version_set_major(
+  cardano_protocol_version_t* protocol_version,
+  uint64_t                    major);
+
+/**
+ * \brief Retrieves the minor version number of the Protocol Version.
+ *
+ * This function returns the minor version number of the Protocol Version.
+ *
+ * \param[in] protocol_version Pointer to the Protocol Version object.
+ *
+ * \return The minor version number of the Protocol Version.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_version_t* protocol_version = NULL;
+ * // Assume protocol_version is initialized properly
+ *
+ * uint64_t minor_version = cardano_protocol_version_get_minor(protocol_version);
+ * printf("Minor Version: %lu\n", minor_version);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_version_get_minor(const cardano_protocol_version_t* protocol_version);
+
+/**
+ * \brief Sets the minor version number of the Protocol Version.
+ *
+ * This function sets the minor version number of the Protocol Version.
+ *
+ * \param[in] protocol_version Pointer to the Protocol Version object.
+ * \param[in] minor The minor version number to set. It must be in the uint32 range (0 to 4294967295).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the minor version number was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p minor is greater than the maximum uint32 value, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_version_t* protocol_version = NULL;
+ * // Assume protocol_version is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_version_set_minor(protocol_version, 1);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minor version set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set minor version: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_version_set_minor(
+  cardano_protocol_version_t* protocol_version,
+  uint64_t                    minor);
+
+/**
+ * \brief Decrements the reference count of a cardano_protocol_version_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_protocol_version_t object
+ * by decreasing its reference count. When the reference count reaches zero, the protocol_version is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] protocol_version A pointer to the pointer of the protocol_version object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_version_t* protocol_version = cardano_protocol_version_new(major, minor);
+ *
+ * // Perform operations with the protocol_version...
+ *
+ * cardano_protocol_version_unref(&protocol_version);
+ * // At this point, protocol_version is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_protocol_version_unref, the pointer to the \ref cardano_protocol_version_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_protocol_version_unref(cardano_protocol_version_t** protocol_version);
+
+/**
+ * \brief Increases the reference count of the cardano_protocol_version_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_protocol_version_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_protocol_version_unref.
+ *
+ * \param protocol_version A pointer to the cardano_protocol_version_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming protocol_version is a previously created protocol_version object
+ *
+ * cardano_protocol_version_ref(protocol_version);
+ *
+ * // Now protocol_version can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_protocol_version_ref there is a corresponding
+ * call to \ref cardano_protocol_version_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_protocol_version_ref(cardano_protocol_version_t* protocol_version);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_protocol_version_t object.
+ *
+ * This function returns the number of active references to an cardano_protocol_version_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_protocol_version_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param protocol_version A pointer to the cardano_protocol_version_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_protocol_version_t object. If the object
+ * is properly managed (i.e., every \ref cardano_protocol_version_ref call is matched with a
+ * \ref cardano_protocol_version_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming protocol_version is a previously created protocol_version object
+ *
+ * size_t ref_count = cardano_protocol_version_refcount(protocol_version);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_protocol_version_refcount(const cardano_protocol_version_t* protocol_version);
+
+/**
+ * \brief Sets the last error message for a given cardano_protocol_version_t object.
+ *
+ * Records an error message in the protocol_version's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] protocol_version A pointer to the \ref cardano_protocol_version_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the protocol_version's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_protocol_version_set_last_error(
+  cardano_protocol_version_t* protocol_version,
+  const char*                 message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific protocol_version.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_protocol_version_set_last_error for the given
+ * protocol_version. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] protocol_version A pointer to the \ref cardano_protocol_version_t instance whose last error
+ *                   message is to be retrieved. If the protocol_version is NULL, the function
+ *                   returns a generic error message indicating the null protocol_version.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified protocol_version. If the protocol_version is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_protocol_version_set_last_error for the same protocol_version, or until
+ *       the protocol_version is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_protocol_version_get_last_error(
+  const cardano_protocol_version_t* protocol_version);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_protocol_version_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_protocol_version_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_protocol_version_deep_clone(const cardano_protocol_version_t* source, cardano_protocol_version_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PROTOCOL_VERSION_H
diff --git a/vendor/include/cardano/common/reward_address_list.h b/vendor/include/cardano/common/reward_address_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/reward_address_list.h
@@ -0,0 +1,336 @@
+/**
+ * \file reward_address_list.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_REWARD_ADDRESS_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_REWARD_ADDRESS_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a reward address in the Cardano blockchain ecosystem.
+ *
+ * A reward address is a cryptographic hash of the public stake key of the address. Reward account addresses are used
+ * to distribute rewards for participating in the proof-of-stake protocol (either directly or via delegation).
+ */
+typedef struct cardano_reward_address_t cardano_reward_address_t;
+
+/**
+ * \brief Represents a list of reward address.
+ */
+typedef struct cardano_reward_address_list_t cardano_reward_address_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a reward_address_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_reward_address_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] reward_address_list On successful initialization, this will point to a newly created
+ *             \ref cardano_reward_address_list_t object. This object represents a "strong reference"
+ *             to the reward_address_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the reward_address_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_reward_address_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the reward_address_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_list_t* reward_address_list = NULL;
+ *
+ * // Attempt to create a new reward_address_list
+ * cardano_error_t result = cardano_reward_address_list_new(&reward_address_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the reward_address_list
+ *
+ *   // Once done, ensure to clean up and release the reward_address_list
+ *   cardano_reward_address_list_unref(&reward_address_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_reward_address_list_new(cardano_reward_address_list_t** reward_address_list);
+
+/**
+ * \brief Retrieves the length of a reward address list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_reward_address_list_t object.
+ *
+ * \param[in] reward_address_list A constant pointer to the \ref cardano_reward_address_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the reward_address_list. Return 0 if the reward_address_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_list_t* reward_address_list = cardano_reward_address_list_new();
+ *
+ * // Populate reward_address_list with elements
+ *
+ * size_t length = cardano_reward_address_list_get_length(reward_address_list);
+ * printf("Length of the reward_address_list: %zu\n", length);
+ *
+ * // Clean up the reward_address_list object once done
+ * cardano_reward_address_list_unref(&reward_address_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_reward_address_list_get_length(const cardano_reward_address_list_t* reward_address_list);
+
+/**
+ * \brief Retrieves an element from a reward address list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_reward_address_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] reward_address_list A constant pointer to the \ref cardano_reward_address_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the reward address list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_reward_address_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_reward_address_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_list_t* reward_address_list = cardano_reward_address_list_new();
+ *
+ * // Populate reward_address_list with elements
+ *
+ * cardano_reward_address_t* element = NULL;
+ * cardano_error_t result = cardano_reward_address_list_get(reward_address_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_reward_address_unref(&element);
+ * }
+ *
+ * // Clean up the reward_address_list object once done
+ * cardano_reward_address_list_unref(&reward_address_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_reward_address_list_get(const cardano_reward_address_list_t* reward_address_list, size_t index, cardano_reward_address_t** element);
+
+/**
+ * \brief Adds an element to a reward address list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_reward_address_list_t object.
+ *
+ * \param[in] reward_address_list A constant pointer to the \ref cardano_reward_address_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_reward_address_t object that is to be added to the reward_address_list.
+ *                    The element will be referenced by the reward_address_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the reward_address_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_list_t* reward_address_list = cardano_reward_address_list_new();
+ *
+ * // Create and initialize a new reward address element
+ * cardano_reward_address_t* element = { ... };
+ *
+ * // Add the element to the reward_address_list
+ * cardano_error_t result = cardano_reward_address_list_add(reward_address_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the reward_address_list object once done
+ * cardano_reward_address_list_unref(&reward_address_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_reward_address_list_add(cardano_reward_address_list_t* reward_address_list, cardano_reward_address_t* element);
+
+/**
+ * \brief Decrements the reference count of a reward_address_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_reward_address_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the reward_address_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] reward_address_list A pointer to the pointer of the reward_address_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_reward_address_list_t* reward_address_list = cardano_reward_address_list_new();
+ *
+ * // Perform operations with the reward_address_list...
+ *
+ * cardano_reward_address_list_unref(&reward_address_list);
+ * // At this point, reward_address_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_reward_address_list_unref, the pointer to the \ref cardano_reward_address_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_reward_address_list_unref(cardano_reward_address_list_t** reward_address_list);
+
+/**
+ * \brief Increases the reference count of the cardano_reward_address_list_t object.
+ *
+ * This function is used to manually increment the reference count of a reward_address_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_reward_address_list_unref.
+ *
+ * \param reward_address_list A pointer to the reward_address_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming reward_address_list is a previously created reward_address_list object
+ *
+ * cardano_reward_address_list_ref(reward_address_list);
+ *
+ * // Now reward_address_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_reward_address_list_ref there is a corresponding
+ * call to \ref cardano_reward_address_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_reward_address_list_ref(cardano_reward_address_list_t* reward_address_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_reward_address_list_t object.
+ *
+ * This function returns the number of active references to a reward_address_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_reward_address_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param reward_address_list A pointer to the reward_address_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified reward_address_list object. If the object
+ * is properly managed (i.e., every \ref cardano_reward_address_list_ref call is matched with a
+ * \ref cardano_reward_address_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming reward_address_list is a previously created reward_address_list object
+ *
+ * size_t ref_count = cardano_reward_address_list_refcount(reward_address_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_reward_address_list_refcount(const cardano_reward_address_list_t* reward_address_list);
+
+/**
+ * \brief Sets the last error message for a given reward_address_list object.
+ *
+ * Records an error message in the reward_address_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] reward_address_list A pointer to the \ref cardano_reward_address_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the reward_address_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_reward_address_list_set_last_error(cardano_reward_address_list_t* reward_address_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific reward_address_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_reward_address_list_set_last_error for the given
+ * reward_address_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] reward_address_list A pointer to the \ref cardano_reward_address_list_t instance whose last error
+ *                   message is to be retrieved. If the reward_address_list is NULL, the function
+ *                   returns a generic error message indicating the null reward_address_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified reward_address_list. If the reward_address_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_reward_address_list_set_last_error for the same reward_address_list, or until
+ *       the reward_address_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_reward_address_list_get_last_error(const cardano_reward_address_list_t* reward_address_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_reward_address_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_reward_address_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_reward_address_list_deep_clone(const cardano_reward_address_list_t* source, cardano_reward_address_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_REWARD_ADDRESS_LIST_H
diff --git a/vendor/include/cardano/common/unit_interval.h b/vendor/include/cardano/common/unit_interval.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/unit_interval.h
@@ -0,0 +1,529 @@
+/**
+ * \file unit_interval.h
+ *
+ * \author angel.castillo
+ * \date   Mar 07, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UNIT_INTERVAL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UNIT_INTERVAL_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a rational number as a ratio of two integers.
+ *
+ * Unit intervals are serialized as Rational Numbers (Tag 30).
+ * Rational numbers are numbers that can be expressed as a ratio of two integers:
+ * a numerator, written as the top part of a fraction, and the denominator,
+ * the bottom part. The value of a rational number is the numerator divided by the denominator.
+ */
+typedef struct cardano_unit_interval_t cardano_unit_interval_t;
+
+/**
+ * \brief Creates and initializes a new instance of a unit interval.
+ *
+ * This function allocates and initializes a new instance of a unit interval,
+ * representing a rational number where the numerator and denominator are both
+ * unsigned 64-bit integers. Unit intervals are serialized as Rational Numbers (Tag 30).
+ * Rational numbers are numbers that can be expressed as a ratio of two integers:
+ * a numerator, usually written as the top part of a fraction, and the denominator,
+ * the bottom part. The value of a rational number is the numerator divided by the denominator.
+ *
+ * \param[in] numerator The numerator of the unit interval.
+ * \param[in] denominator The denominator of the unit interval.
+ * \param[out] unit_interval On successful initialization, this will point to a newly created
+ *            unit interval object. This object represents a "strong reference",
+ *            meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the unit interval is no longer needed, the caller must release it
+ *            by calling \ref cardano_unit_interval_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the unit interval was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unit_interval_t* unit_interval = NULL;
+ * uint64_t numerator = 3;
+ * uint64_t denominator = 4;
+ *
+ * // Attempt to create a new unit interval object
+ * cardano_error_t result = cardano_unit_interval_new(numerator, denominator, &unit_interval);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the unit_interval
+ *
+ *   // Once done, ensure to clean up and release the unit_interval
+ *   cardano_unit_interval_unref(&unit_interval);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unit_interval_new(
+  uint64_t                  numerator,
+  uint64_t                  denominator,
+  cardano_unit_interval_t** unit_interval);
+
+/**
+ * \brief Creates and initializes a new instance of a unit interval from a floating-point value.
+ *
+ * This function creates a new instance of a unit interval from a floating-point value,
+ * representing a rational number. The floating-point value is converted into a fraction
+ * where the numerator and denominator are both unsigned 64-bit integers.
+ *
+ * \param[in] value The floating-point value from which to create the unit interval.
+ * \param[out] unit_interval On successful initialization, this will point to a newly created
+ *            unit interval object. This object represents a "strong reference",
+ *            meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the unit interval is no longer needed, the caller must release it
+ *            by calling \ref cardano_unit_interval_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the unit interval was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unit_interval_t* unit_interval = NULL;
+ * double value = 0.25; // Example floating-point value
+ *
+ * // Attempt to create a new unit interval object from the floating-point value
+ * cardano_error_t result = cardano_unit_interval_from_double(value, &unit_interval);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the unit_interval
+ *
+ *   // Once done, ensure to clean up and release the unit_interval
+ *   cardano_unit_interval_unref(&unit_interval);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unit_interval_from_double(double value, cardano_unit_interval_t** unit_interval);
+
+/**
+ * \brief Creates a \ref cardano_unit_interval_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_unit_interval_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a unit_interval.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] unit_interval A pointer to a pointer of \ref cardano_unit_interval_t that will be set to the address
+ *                        of the newly created unit_interval object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_unit_interval_t object by calling
+ *       \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_unit_interval_t* unit_interval = NULL;
+ *
+ * cardano_error_t result = cardano_unit_interval_from_cbor(reader, &unit_interval);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the unit_interval
+ *
+ *   // Once done, ensure to clean up and release the unit_interval
+ *   cardano_unit_interval_unref(&unit_interval);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode unit_interval: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unit_interval_from_cbor(cardano_cbor_reader_t* reader, cardano_unit_interval_t** unit_interval);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_unit_interval_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] unit_interval A constant pointer to the \ref cardano_unit_interval_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p unit_interval or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unit_interval_t* unit_interval = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_unit_interval_to_cbor(unit_interval, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_unit_interval_unref(&unit_interval);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_unit_interval_to_cbor(
+  const cardano_unit_interval_t* unit_interval,
+  cardano_cbor_writer_t*         writer);
+
+/**
+ * \brief Serializes a unit interval to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "numerator", "denominator".
+ * Both values are encoded as strings to ensure precision for 64-bit integers in JSON.
+ *
+ * \param[in]  interval Pointer to a valid \ref cardano_unit_interval_t.
+ * \param[in]  writer   Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p interval or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_unit_interval_to_cip116_json(
+  const cardano_unit_interval_t* interval,
+  cardano_json_writer_t*         writer);
+
+/**
+ * \brief Retrieves the numerator of the Unit Interval.
+ *
+ * This function returns the numerator of the Unit Interval,
+ *
+ * \param[in] unit_interval Pointer to the Unit Interval object.
+ *
+ * \return The numerator of the Unit Interval.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unit_interval_t* unit_interval = NULL;
+ * // Assume unit_interval is initialized properly
+ *
+ * uint64_t numerator_version = cardano_unit_interval_get_numerator(unit_interval);
+ * printf("Major Version: %lu\n", numerator_version);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_unit_interval_get_numerator(
+  const cardano_unit_interval_t* unit_interval);
+
+/**
+ * \brief Sets the numerator of the Unit Interval.
+ *
+ * This function sets the numerator of the Unit Interval,
+ *
+ * \param[in] unit_interval Pointer to the Unit Interval object.
+ * \param[in] numerator The numerator to set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the numerator was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unit_interval_t* unit_interval = NULL;
+ * // Assume unit_interval is initialized properly
+ *
+ * cardano_error_t result = cardano_unit_interval_set_numerator(unit_interval, 2);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Major version set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set numerator version: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_unit_interval_set_numerator(
+  cardano_unit_interval_t* unit_interval,
+  uint64_t                 numerator);
+
+/**
+ * \brief Retrieves the denominator of the Unit Interval.
+ *
+ * This function returns the denominator of the Unit Interval.
+ *
+ * \param[in] unit_interval Pointer to the Unit Interval object.
+ *
+ * \return The denominator of the Unit Interval.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unit_interval_t* unit_interval = NULL;
+ * // Assume unit_interval is initialized properly
+ *
+ * uint64_t denominator_version = cardano_unit_interval_get_denominator(unit_interval);
+ * printf("Minor Version: %lu\n", denominator_version);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_unit_interval_get_denominator(const cardano_unit_interval_t* unit_interval);
+
+/**
+ * \brief Converts a unit interval to a double-precision floating-point value.
+ *
+ * This function converts a unit interval, representing a rational number, to a
+ * double-precision floating-point value. The rational number is converted into
+ * a floating-point representation, providing a decimal approximation of the value.
+ *
+ * \param[in] unit_interval Pointer to the unit interval object to be converted.
+ *
+ * \return The double-precision floating-point value representing the unit interval.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unit_interval_t* unit_interval = NULL;
+ * // Assume unit_interval is initialized properly
+ *
+ * double result = cardano_unit_interval_to_double(unit_interval);
+ * printf("Result: %f\n", result);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT double cardano_unit_interval_to_double(const cardano_unit_interval_t* unit_interval);
+
+/**
+ * \brief Sets the denominator of the Unit Interval.
+ *
+ * This function sets the denominator of the Unit Interval.
+ *
+ * \param[in] unit_interval Pointer to the Unit Interval object.
+ * \param[in] denominator The denominator to set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the denominator was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unit_interval_t* unit_interval = NULL;
+ * // Assume unit_interval is initialized properly
+ *
+ * cardano_error_t result = cardano_unit_interval_set_denominator(unit_interval, 1);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minor version set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set denominator version: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_unit_interval_set_denominator(
+  cardano_unit_interval_t* unit_interval,
+  uint64_t                 denominator);
+
+/**
+ * \brief Decrements the reference count of a cardano_unit_interval_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_unit_interval_t object
+ * by decreasing its reference count. When the reference count reaches zero, the unit_interval is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] unit_interval A pointer to the pointer of the unit_interval object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unit_interval_t* unit_interval = cardano_unit_interval_new(numerator, denominator);
+ *
+ * // Perform operations with the unit_interval...
+ *
+ * cardano_unit_interval_unref(&unit_interval);
+ * // At this point, unit_interval is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_unit_interval_unref, the pointer to the \ref cardano_unit_interval_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_unit_interval_unref(cardano_unit_interval_t** unit_interval);
+
+/**
+ * \brief Increases the reference count of the cardano_unit_interval_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_unit_interval_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_unit_interval_unref.
+ *
+ * \param unit_interval A pointer to the cardano_unit_interval_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming unit_interval is a previously created unit_interval object
+ *
+ * cardano_unit_interval_ref(unit_interval);
+ *
+ * // Now unit_interval can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_unit_interval_ref there is a corresponding
+ * call to \ref cardano_unit_interval_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_unit_interval_ref(cardano_unit_interval_t* unit_interval);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_unit_interval_t object.
+ *
+ * This function returns the number of active references to an cardano_unit_interval_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_unit_interval_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param unit_interval A pointer to the cardano_unit_interval_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_unit_interval_t object. If the object
+ * is properly managed (i.e., every \ref cardano_unit_interval_ref call is matched with a
+ * \ref cardano_unit_interval_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming unit_interval is a previously created unit_interval object
+ *
+ * size_t ref_count = cardano_unit_interval_refcount(unit_interval);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_unit_interval_refcount(const cardano_unit_interval_t* unit_interval);
+
+/**
+ * \brief Sets the last error message for a given cardano_unit_interval_t object.
+ *
+ * Records an error message in the unit_interval's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] unit_interval A pointer to the \ref cardano_unit_interval_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the unit_interval's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_unit_interval_set_last_error(
+  cardano_unit_interval_t* unit_interval,
+  const char*              message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific unit_interval.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_unit_interval_set_last_error for the given
+ * unit_interval. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] unit_interval A pointer to the \ref cardano_unit_interval_t instance whose last error
+ *                   message is to be retrieved. If the unit_interval is NULL, the function
+ *                   returns a generic error message indicating the null unit_interval.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified unit_interval. If the unit_interval is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_unit_interval_set_last_error for the same unit_interval, or until
+ *       the unit_interval is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_unit_interval_get_last_error(
+  const cardano_unit_interval_t* unit_interval);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_unit_interval_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_unit_interval_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_unit_interval_deep_clone(const cardano_unit_interval_t* source, cardano_unit_interval_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_UNIT_INTERVAL_H
diff --git a/vendor/include/cardano/common/utxo.h b/vendor/include/cardano/common/utxo.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/utxo.h
@@ -0,0 +1,558 @@
+/**
+ * \file utxo.h
+ *
+ * \author angel.castillo
+ * \date   Sep 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UTXO_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UTXO_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/transaction_body/transaction_input.h>
+#include <cardano/transaction_body/transaction_output.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a unspent output (UTxO).
+ */
+typedef struct cardano_utxo_t cardano_utxo_t;
+
+/**
+ * \brief Creates a new UTXO (Unspent Transaction Output) object.
+ *
+ * This function creates and initializes a new \ref cardano_utxo_t object by associating a
+ * transaction input with its corresponding transaction output. UTXOs represent unspent
+ * outputs from previous transactions that can be used as inputs in new transactions.
+ *
+ * \param[in] input A pointer to an initialized \ref cardano_transaction_input_t object,
+ *                  representing the transaction input. This parameter must not be NULL.
+ * \param[in] output A pointer to an initialized \ref cardano_transaction_output_t object,
+ *                   representing the corresponding transaction output. This parameter must not be NULL.
+ * \param[out] utxo A double pointer to a \ref cardano_utxo_t object. On successful creation,
+ *                  this will point to the newly created UTXO object. The caller is responsible
+ *                  for managing the lifecycle of this object and must release it by calling
+ *                  \ref cardano_utxo_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the UTXO was successfully created. If either \p input, \p output, or \p utxo is NULL,
+ *         returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \note A UTXO links a specific input to its corresponding output, representing spendable value
+ *       in the Cardano blockchain. The newly created UTXO object must be properly freed by the
+ *       caller using \ref cardano_utxo_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_t* input = ...;  // Assume input is initialized
+ * cardano_transaction_output_t* output = ...;  // Assume output is initialized
+ * cardano_utxo_t* utxo = NULL;
+ *
+ * cardano_error_t result = cardano_utxo_new(input, output, &utxo);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // UTXO successfully created, use utxo as needed
+ *
+ *   // Clean up when done
+ *   cardano_utxo_unref(&utxo);
+ * }
+ * else
+ * {
+ *   printf("Failed to create UTXO: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up input and output when no longer needed
+ * cardano_transaction_input_unref(&input);
+ * cardano_transaction_output_unref(&output);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_utxo_new(
+  cardano_transaction_input_t*  input,
+  cardano_transaction_output_t* output,
+  cardano_utxo_t**              utxo);
+
+/**
+ * \brief Creates a \ref cardano_utxo_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_utxo_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a utxo.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] utxo A pointer to a pointer of \ref cardano_utxo_t that will be set to the address
+ *                        of the newly created utxo object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the utxo were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_utxo_t object by calling
+ *       \ref cardano_utxo_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_utxo_t* utxo = NULL;
+ *
+ * cardano_error_t result = cardano_utxo_from_cbor(reader, &utxo);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the utxo
+ *
+ *   // Once done, ensure to clean up and release the utxo
+ *   cardano_utxo_unref(&utxo);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode utxo: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_utxo_from_cbor(cardano_cbor_reader_t* reader, cardano_utxo_t** utxo);
+
+/**
+ * \brief Serializes utxo into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_utxo_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] utxo A constant pointer to the \ref cardano_utxo_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p utxo or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_t* utxo = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_utxo_to_cbor(utxo, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_utxo_unref(&utxo);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_utxo_to_cbor(
+  const cardano_utxo_t*  utxo,
+  cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Serializes a transaction unspent output (UTXO) to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "input", "output".
+ *
+ * \param[in]  utxo    Pointer to a valid \ref cardano_utxo_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p utxo or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_utxo_to_cip116_json(
+  const cardano_utxo_t*  utxo,
+  cardano_json_writer_t* writer);
+
+/**
+ * \brief Retrieves the transaction input from a UTXO.
+ *
+ * This function fetches the transaction input associated with a given \ref cardano_utxo_t object.
+ * The transaction input represents the source of the UTXO, which can be used as an input in a new transaction.
+ *
+ * \param[in] utxo A pointer to an initialized \ref cardano_utxo_t object. This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_transaction_input_t object representing the transaction input of the UTXO.
+ *         The returned object is a new reference, and the caller is responsible for managing its lifecycle.
+ *         Specifically, the caller must release the object by calling \ref cardano_transaction_input_unref
+ *         when it is no longer needed. If the \p utxo is NULL, the function returns NULL.
+ *
+ * \note The transaction input refers to the previous transaction from which the UTXO originates,
+ *       representing a spendable output.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_t* utxo = ...; // Assume utxo is already initialized
+ * cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+ *
+ * if (input != NULL)
+ * {
+ *   // Use the transaction input as needed
+ *
+ *   // Clean up when done
+ *   cardano_transaction_input_unref(&input);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the transaction input.\n");
+ * }
+ *
+ * // Clean up the utxo when no longer needed
+ * cardano_utxo_unref(&utxo);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_input_t* cardano_utxo_get_input(cardano_utxo_t* utxo);
+
+/**
+ * \brief Sets the transaction input for a UTXO.
+ *
+ * This function assigns a transaction input to the specified \ref cardano_utxo_t object. The transaction input
+ * represents the source of the UTXO, which can be used as an input in a new transaction.
+ *
+ * \param[in,out] utxo A pointer to an initialized \ref cardano_utxo_t object where the input will be set.
+ *                     This parameter must not be NULL.
+ * \param[in] input A pointer to an initialized \ref cardano_transaction_input_t object representing the input
+ *                  to be associated with the UTXO. This parameter must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the transaction input was successfully set. If either \p utxo or \p input is NULL, returns
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \note This function increases the reference count of the \p input object, meaning the caller retains
+ *       ownership of the input and must release it by calling \ref cardano_transaction_input_unref
+ *       when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_t* utxo = ...; // Assume utxo is initialized
+ * cardano_transaction_input_t* input = ...; // Assume input is initialized
+ *
+ * cardano_error_t result = cardano_utxo_set_input(utxo, input);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Transaction input successfully set for the UTXO.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set transaction input: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources
+ * cardano_transaction_input_unref(&input);
+ * cardano_utxo_unref(&utxo);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_utxo_set_input(cardano_utxo_t* utxo, cardano_transaction_input_t* input);
+
+/**
+ * \brief Retrieves the transaction output from a UTXO.
+ *
+ * This function fetches the transaction output associated with a given \ref cardano_utxo_t object.
+ * The transaction output represents the destination of the UTXO, indicating the amount of value and recipient.
+ *
+ * \param[in] utxo A pointer to an initialized \ref cardano_utxo_t object. This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_transaction_output_t object representing the transaction output of the UTXO.
+ *         The returned object is a new reference, and the caller is responsible for managing its lifecycle.
+ *         Specifically, the caller must release the object by calling \ref cardano_transaction_output_unref
+ *         when it is no longer needed. If the \p utxo is NULL, the function returns NULL.
+ *
+ * \note The transaction output refers to the recipient and the amount of value in the UTXO, representing spendable value.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_t* utxo = ...; // Assume utxo is already initialized
+ * cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+ *
+ * if (output != NULL)
+ * {
+ *   // Use the transaction output as needed
+ *
+ *   // Clean up when done
+ *   cardano_transaction_output_unref(&output);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the transaction output.\n");
+ * }
+ *
+ * // Clean up the utxo when no longer needed
+ * cardano_utxo_unref(&utxo);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_output_t* cardano_utxo_get_output(cardano_utxo_t* utxo);
+
+/**
+ * \brief Sets the transaction output for a UTXO.
+ *
+ * This function assigns a transaction output to the specified \ref cardano_utxo_t object.
+ * The transaction output represents the destination of the UTXO, including the amount of value
+ * and the recipient's address.
+ *
+ * \param[in,out] utxo A pointer to an initialized \ref cardano_utxo_t object where the output will be set.
+ *                     This parameter must not be NULL.
+ * \param[in] output A pointer to an initialized \ref cardano_transaction_output_t object representing the output
+ *                   to be associated with the UTXO. This parameter must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the transaction output was successfully set. If either \p utxo or \p output is NULL,
+ *         returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \note This function increases the reference count of the \p output object, meaning the caller retains
+ *       ownership of the output and must release it by calling \ref cardano_transaction_output_unref
+ *       when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_t* utxo = ...; // Assume utxo is initialized
+ * cardano_transaction_output_t* output = ...; // Assume output is initialized
+ *
+ * cardano_error_t result = cardano_utxo_set_output(utxo, output);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Transaction output successfully set for the UTXO.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set transaction output: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources
+ * cardano_transaction_output_unref(&output);
+ * cardano_utxo_unref(&utxo);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_utxo_set_output(cardano_utxo_t* utxo, cardano_transaction_output_t* output);
+
+/**
+ * \brief Compares two UTxO objects for equality.
+ *
+ * This function compares two UTxO objects to determine if they are equal.
+ *
+ * \param[in] lhs Pointer to the first UTxO object.
+ * \param[in] rhs Pointer to the second UTxO object.
+ *
+ * \return \c true if the utxo objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_t* utxo1 = NULL;
+ * cardano_utxo_t* utxo2 = NULL;
+ *
+ * // Assume utxo1 and utxo2 are initialized properly
+ *
+ * bool are_equal = cardano_utxo_equals(utxo1, utxo2);
+ *
+ * if (are_equal)
+ * {
+ *   printf("The utxo objects are equal.\n");
+ * }
+ * else
+ * {
+ *   printf("The utxo objects are not equal.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_utxo_unref(&utxo1);
+ * cardano_utxo_unref(&utxo2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_utxo_equals(const cardano_utxo_t* lhs, const cardano_utxo_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a cardano_utxo_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_utxo_t object
+ * by decreasing its reference count. When the reference count reaches zero, the utxo is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] utxo A pointer to the pointer of the utxo object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_t* utxo = cardano_utxo_new(major, minor);
+ *
+ * // Perform operations with the utxo...
+ *
+ * cardano_utxo_unref(&utxo);
+ * // At this point, utxo is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_utxo_unref, the pointer to the \ref cardano_utxo_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_utxo_unref(cardano_utxo_t** utxo);
+
+/**
+ * \brief Increases the reference count of the cardano_utxo_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_utxo_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_utxo_unref.
+ *
+ * \param utxo A pointer to the cardano_utxo_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming utxo is a previously created utxo object
+ *
+ * cardano_utxo_ref(utxo);
+ *
+ * // Now utxo can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_utxo_ref there is a corresponding
+ * call to \ref cardano_utxo_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_utxo_ref(cardano_utxo_t* utxo);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_utxo_t object.
+ *
+ * This function returns the number of active references to an cardano_utxo_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_utxo_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param utxo A pointer to the cardano_utxo_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_utxo_t object. If the object
+ * is properly managed (i.e., every \ref cardano_utxo_ref call is matched with a
+ * \ref cardano_utxo_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming utxo is a previously created utxo object
+ *
+ * size_t ref_count = cardano_utxo_refcount(utxo);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_utxo_refcount(const cardano_utxo_t* utxo);
+
+/**
+ * \brief Sets the last error message for a given cardano_utxo_t object.
+ *
+ * Records an error message in the utxo's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] utxo A pointer to the \ref cardano_utxo_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the utxo's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_utxo_set_last_error(
+  cardano_utxo_t* utxo,
+  const char*     message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific utxo.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_utxo_set_last_error for the given
+ * utxo. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] utxo A pointer to the \ref cardano_utxo_t instance whose last error
+ *                   message is to be retrieved. If the utxo is NULL, the function
+ *                   returns a generic error message indicating the null utxo.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified utxo. If the utxo is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_utxo_set_last_error for the same utxo, or until
+ *       the utxo is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_utxo_get_last_error(
+  const cardano_utxo_t* utxo);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_utxo_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_utxo_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_utxo_deep_clone(const cardano_utxo_t* source, cardano_utxo_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_UTXO_H
diff --git a/vendor/include/cardano/common/utxo_list.h b/vendor/include/cardano/common/utxo_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/utxo_list.h
@@ -0,0 +1,543 @@
+/**
+ * \file utxo_list.h
+ *
+ * \author angel.castillo
+ * \date   Sep 25, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UTXO_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UTXO_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a unspent output (UTxO).
+ */
+typedef struct cardano_utxo_t cardano_utxo_t;
+
+/**
+ * \brief Represents a list of UTxO.
+ */
+typedef struct cardano_utxo_list_t cardano_utxo_list_t;
+
+/**
+ * \brief Function pointer type that compares two utxos and returns a value
+ * indicating whether one utxo is less than, equal to, or greater than the other.
+ *
+ * \param[in] lhs The left-hand side utxo to compare.
+ * \param[in] rhs The right-hand side utxo to compare.
+ * \param[in] context An optional context pointer that will be passed to the comparison function.
+ *
+ * \return A negative value if `lhs` is less than `rhs`, 0 if `lhs` is equal to `rhs`, or a positive
+ * value if `lhs` is greater than `rhs`.
+ */
+typedef int (*cardano_utxo_list_compare_item_t)(cardano_utxo_t* lhs, cardano_utxo_t* rhs, void* context);
+
+/**
+ * \brief Defines a function pointer for evaluating whether a specific utxo meets a defined set of criteria.
+ *
+ * This typedef defines a function pointer type that represents a predicate function. A predicate function
+ * takes an utxo of type `cardano_utxo_t` and an optional context as parameters and evaluates whether
+ * the utxo meets a specific set of criteria.
+ *
+ * \param[in] item The utxo to be evaluated against the predicate's criteria.
+ * \param[in] context An optional context providing additional data or parameters for the predicate evaluation.
+ *
+ * \return Returns \c true if the `item` satisfies the predicate's conditions, \c false otherwise.
+ */
+typedef bool (*cardano_utxo_list_unary_predicate_t)(cardano_utxo_t* item, const void* context);
+
+/**
+ * \brief Creates and initializes a new instance of a utxo_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_utxo_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] utxo_list On successful initialization, this will point to a newly created
+ *             \ref cardano_utxo_list_t object. This object represents a "strong reference"
+ *             to the utxo_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the utxo_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_utxo_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the utxo_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* utxo_list = NULL;
+ *
+ * // Attempt to create a new utxo_list
+ * cardano_error_t result = cardano_utxo_list_new(&utxo_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the utxo_list
+ *
+ *   // Once done, ensure to clean up and release the utxo_list
+ *   cardano_utxo_list_unref(&utxo_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_utxo_list_new(cardano_utxo_list_t** utxo_list);
+
+/**
+ * \brief Retrieves the length of a UTxO list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_utxo_list_t object.
+ *
+ * \param[in] utxo_list A constant pointer to the \ref cardano_utxo_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the utxo_list. Return 0 if the utxo_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* utxo_list = cardano_utxo_list_new();
+ *
+ * // Populate utxo_list with elements
+ *
+ * size_t length = cardano_utxo_list_get_length(utxo_list);
+ * printf("Length of the utxo_list: %zu\n", length);
+ *
+ * // Clean up the utxo_list object once done
+ * cardano_utxo_list_unref(&utxo_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_utxo_list_get_length(const cardano_utxo_list_t* utxo_list);
+
+/**
+ * \brief Retrieves an element from a UTxO list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_utxo_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] utxo_list A constant pointer to the \ref cardano_utxo_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the UTxO list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_utxo_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_utxo_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* utxo_list = cardano_utxo_list_new();
+ *
+ * // Populate utxo_list with elements
+ *
+ * cardano_utxo_t* element = NULL;
+ * cardano_error_t result = cardano_utxo_list_get(utxo_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_utxo_unref(&element);
+ * }
+ *
+ * // Clean up the utxo_list object once done
+ * cardano_utxo_list_unref(&utxo_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_utxo_list_get(const cardano_utxo_list_t* utxo_list, size_t index, cardano_utxo_t** element);
+
+/**
+ * \brief Adds an element to a UTxO list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_utxo_list_t object.
+ *
+ * \param[in] utxo_list A constant pointer to the \ref cardano_utxo_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_utxo_t object that is to be added to the utxo_list.
+ *                    The element will be referenced by the utxo_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the utxo_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* utxo_list = cardano_utxo_list_new();
+ *
+ * // Create and initialize a new UTxO element
+ * cardano_utxo_t* element = { ... };
+ *
+ * // Add the element to the utxo_list
+ * cardano_error_t result = cardano_utxo_list_add(utxo_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the utxo_list object once done
+ * cardano_utxo_list_unref(&utxo_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_utxo_list_add(cardano_utxo_list_t* utxo_list, cardano_utxo_t* element);
+
+/**
+ * \brief Removes a specific UTXO from a UTXO list.
+ *
+ * The `cardano_utxo_list_remove` function allows you to remove a specified UTXO from a \ref cardano_utxo_list_t object.
+ *
+ * \param[in,out] utxo_list A pointer to the \ref cardano_utxo_list_t from which the specified UTXO will be removed.
+ * \param[in] element A pointer to the \ref cardano_utxo_t object representing the UTXO to be removed.
+ *
+ * \return \ref CARDANO_SUCCESS if the UTXO was successfully removed from the list, or an appropriate error code if
+ *         the UTXO could not be found or removed.
+ *
+ * \note This function does not modify the original UTXO object referenced by `element`, only removes it from the list.
+ *
+ * \note The caller is responsible for managing the memory of both `utxo_list` and `element`, ensuring that
+ *       unreferenced UTXOs are properly deallocated to avoid memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* utxo_list = ...;  // List of UTXOs
+ * cardano_utxo_t* utxo_to_remove = ...;  // UTXO element to be removed
+ *
+ * cardano_error_t result = cardano_utxo_list_remove(utxo_list, utxo_to_remove);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // UTXO was successfully removed from the list
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_utxo_list_remove(cardano_utxo_list_t* utxo_list, cardano_utxo_t* element);
+
+/**
+ * Clears the contents of the specified utxo_list.
+ *
+ * This function removes all elements from the utxo_list, leaving it empty.
+ *
+ * \param[in,out] utxo_list The utxo_list to clear.
+ */
+CARDANO_EXPORT void cardano_utxo_list_clear(cardano_utxo_list_t* utxo_list);
+
+/**
+ * Sorts the elements of the utxo_list according to the provided comparison function.
+ *
+ * The comparison function should return a negative value if the first argument is less
+ * than the second, zero if they are equal, and a positive value if the first is greater
+ * than the second.
+ *
+ * \param[in,out] utxo_list The utxo_list to sort.
+ * \param[in] compare The comparison function used to determine the order of the elements.
+ *                    The function must not modify the elements.
+ * \param[in] context An optional context pointer that will be passed to the comparison function.
+ */
+CARDANO_EXPORT void cardano_utxo_list_sort(cardano_utxo_list_t* utxo_list, cardano_utxo_list_compare_item_t compare, void* context);
+
+/**
+ * Searches for an element in the utxo_list that satisfies a predicate.
+ *
+ * Iterates over the utxo_list elements and returns the first element for which
+ * the predicate returns true. If no such element is found, returns NULL.
+ *
+ * \param[in] utxo_list The utxo_list to search in.
+ * \param[in] predicate The unary predicate function used to evaluate each element.
+ *                      The function should return true for the target element
+ *                      and false otherwise.
+ * \param[in] context An optional context pointer that will be passed to the predicate function.
+ * \return A pointer to the first element satisfying the predicate, or NULL if
+ *         no such element is found.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT
+cardano_utxo_t* cardano_utxo_list_find(const cardano_utxo_list_t* utxo_list, cardano_utxo_list_unary_predicate_t predicate, const void* context);
+
+/**
+ * Creates and returns a new utxo_list containing only the elements that satisfy the given predicate.
+ *
+ * This function iterates over each element of the input utxo_list and applies the predicate function to it.
+ * Elements for which the predicate returns true are included in the new utxo_list. The original utxo_list remains
+ * unchanged. The caller is responsible for managing the unreferencing of the returned utxo_list to avoid memory leaks.
+ *
+ * \param[in] utxo_list The source utxo_list to filter.
+ * \param[in] predicate The unary predicate function used to test each element. Elements that
+ *                      satisfy the predicate (i.e., for which the predicate returns true) are
+ *                      included in the new utxo_list.
+ * \param[in] context An optional context pointer that will be passed to the predicate function.
+ * \return A new utxo_list containing only elements that satisfy the predicate. Returns NULL if
+ *         the operation fails due to memory allocation errors. The caller is responsible for unreferencing
+ *         the returned utxo_list.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT
+cardano_utxo_list_t* cardano_utxo_list_filter(const cardano_utxo_list_t* utxo_list, cardano_utxo_list_unary_predicate_t predicate, const void* context);
+
+/**
+ * \brief Concatenates two utxo_lists into a new one.
+ *
+ * Creates a new utxo_list containing the combined data of the provided utxo_lists.
+ *
+ * \param[in] lhs   The first utxo_list.
+ * \param[in] rhs  The second utxo_list.
+ *
+ * \return A new utxo_list containing the concatenated data or NULL on memory allocation failure.
+ * The caller assumes ownership of the returned utxo_list and must manage its lifecycle,
+ * ensuring it is dereferenced when no longer in use.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_utxo_list_t* cardano_utxo_list_concat(const cardano_utxo_list_t* lhs, const cardano_utxo_list_t* rhs);
+
+/**
+ * \brief Slices a utxo_list.
+ *
+ * Extracts a portion of the utxo_list between the given indices.
+ *
+ * \param[in] utxo_list  Source utxo_list.
+ * \param[in] start  Start index of the slice (inclusive).
+ * \param[in] end    End index of the slice (exclusive).
+ *
+ * \return A new utxo_list containing the slice or NULL for invalid input or memory allocation failure.
+ * The caller assumes ownership of the returned utxo_list and must manage its lifecycle,
+ * ensuring it is dereferenced when no longer in use.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_utxo_list_t* cardano_utxo_list_slice(const cardano_utxo_list_t* utxo_list, size_t start, size_t end);
+
+/**
+ * \brief Removes elements from the utxo_list starting at a given index.
+ *
+ * This function removes `delete_count` elements from `utxo_list` starting at index `start`.
+ *
+ * \param[in,out] utxo_list The utxo_list to modify.
+ * \param[in] start The index at which to start removing elements. Supports negative indices.
+ * \param[in] delete_count The number of elements to remove from the utxo_list starting at `start`.
+ *                         If `delete_count` exceeds the number of elements from `start` to the end,
+ *                         it will be adjusted to remove till the end.
+ *
+ * \return A new utxo_list containing the removed elements. Returns `NULL` on error.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_utxo_list_t* cardano_utxo_list_erase(
+  cardano_utxo_list_t* utxo_list,
+  int64_t              start,
+  size_t               delete_count);
+
+/**
+ * \brief Creates a shallow clone of a UTXO list.
+ *
+ * This function creates a new \ref cardano_utxo_list_t object that is a shallow copy of the provided
+ * UTXO list. The cloned list contains references to the same UTXO elements as the original list.
+ * The UTXO elements themselves are not duplicated; instead, their reference counts are incremented.
+ * This means both the original list and the cloned list share the same UTXO elements.
+ *
+ * \param[in] utxo_list The UTXO list to be cloned. Must not be \c NULL.
+ *
+ * \return A pointer to the new \ref cardano_utxo_list_t object containing the same elements as \p utxo_list.
+ * Returns \c NULL if \p utxo_list is \c NULL or if memory allocation fails.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* original_list = cardano_utxo_list_new();
+ *
+ * // Populate original_list with UTXO elements...
+ *
+ * cardano_utxo_list_t* cloned_list = cardano_utxo_list_clone(original_list);
+ * if (cloned_list == NULL)
+ * {
+ *     // Handle error (e.g., memory allocation failure)
+ * }
+ *
+ * // Use cloned_list as needed...
+ *
+ * // When done, release both lists
+ * cardano_utxo_list_unref(&cloned_list);
+ * cardano_utxo_list_unref(&original_list);
+ * \endcode
+ *
+ * \note The cloned list and the original list share the same UTXO elements. Modifications to the UTXO elements
+ *       will be visible in both lists. Ensure that this behavior is acceptable in your use case.
+ *
+ * \see cardano_utxo_list_unref()
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_utxo_list_t* cardano_utxo_list_clone(cardano_utxo_list_t* utxo_list);
+
+/**
+ * \brief Decrements the reference count of a utxo_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_utxo_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the utxo_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] utxo_list A pointer to the pointer of the utxo_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* utxo_list = cardano_utxo_list_new();
+ *
+ * // Perform operations with the utxo_list...
+ *
+ * cardano_utxo_list_unref(&utxo_list);
+ * // At this point, utxo_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_utxo_list_unref, the pointer to the \ref cardano_utxo_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_utxo_list_unref(cardano_utxo_list_t** utxo_list);
+
+/**
+ * \brief Increases the reference count of the cardano_utxo_list_t object.
+ *
+ * This function is used to manually increment the reference count of a utxo_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_utxo_list_unref.
+ *
+ * \param utxo_list A pointer to the utxo_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming utxo_list is a previously created utxo_list object
+ *
+ * cardano_utxo_list_ref(utxo_list);
+ *
+ * // Now utxo_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_utxo_list_ref there is a corresponding
+ * call to \ref cardano_utxo_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_utxo_list_ref(cardano_utxo_list_t* utxo_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_utxo_list_t object.
+ *
+ * This function returns the number of active references to a utxo_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_utxo_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param utxo_list A pointer to the utxo_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified utxo_list object. If the object
+ * is properly managed (i.e., every \ref cardano_utxo_list_ref call is matched with a
+ * \ref cardano_utxo_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming utxo_list is a previously created utxo_list object
+ *
+ * size_t ref_count = cardano_utxo_list_refcount(utxo_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_utxo_list_refcount(const cardano_utxo_list_t* utxo_list);
+
+/**
+ * \brief Sets the last error message for a given utxo_list object.
+ *
+ * Records an error message in the utxo_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] utxo_list A pointer to the \ref cardano_utxo_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the utxo_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_utxo_list_set_last_error(cardano_utxo_list_t* utxo_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific utxo_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_utxo_list_set_last_error for the given
+ * utxo_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] utxo_list A pointer to the \ref cardano_utxo_list_t instance whose last error
+ *                   message is to be retrieved. If the utxo_list is NULL, the function
+ *                   returns a generic error message indicating the null utxo_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified utxo_list. If the utxo_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_utxo_list_set_last_error for the same utxo_list, or until
+ *       the utxo_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_utxo_list_get_last_error(const cardano_utxo_list_t* utxo_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_utxo_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_utxo_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_utxo_list_deep_clone(const cardano_utxo_list_t* source, cardano_utxo_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_UTXO_LIST_H
diff --git a/vendor/include/cardano/common/withdrawal_map.h b/vendor/include/cardano/common/withdrawal_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/common/withdrawal_map.h
@@ -0,0 +1,672 @@
+/**
+ * \file withdrawal_map.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_WITHDRAWAL_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_WITHDRAWAL_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/reward_address_list.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of reward address to lovelace amount.
+ */
+typedef struct cardano_withdrawal_map_t cardano_withdrawal_map_t;
+
+/**
+ * \brief Creates and initializes a new instance of a withdrawal map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_withdrawal_map_t,
+ * representing a map structure. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] withdrawal_map A pointer to a pointer to a \ref cardano_withdrawal_map_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_withdrawal_map_t
+ *                        object. This object represents a "strong reference" to the withdrawal_map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the withdrawal_map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_withdrawal_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the withdrawal_map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_withdrawal_map_t* withdrawal_map = NULL;
+ *
+ * // Attempt to create a new withdrawal_map
+ * cardano_error_t result = cardano_withdrawal_map_new(&withdrawal_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the withdrawal_map
+ *
+ *   // Once done, ensure to clean up and release the withdrawal_map
+ *   cardano_withdrawal_map_unref(&withdrawal_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_withdrawal_map_new(cardano_withdrawal_map_t** withdrawal_map);
+
+/**
+ * \brief Creates a withdrawal map from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_withdrawal_map_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a withdrawal_map.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded withdrawal_map data.
+ * \param[out] withdrawal_map A pointer to a pointer of \ref cardano_withdrawal_map_t that will be set to the address
+ *                        of the newly created withdrawal_map object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the withdrawal_map was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_withdrawal_map_t object by calling
+ *       \ref cardano_withdrawal_map_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_withdrawal_map_t* withdrawal_map = NULL;
+ *
+ * cardano_error_t result = cardano_withdrawal_map_from_cbor(reader, &withdrawal_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the withdrawal_map
+ *
+ *   // Once done, ensure to clean up and release the withdrawal_map
+ *   cardano_withdrawal_map_unref(&withdrawal_map);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode withdrawal_map: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_withdrawal_map_from_cbor(cardano_cbor_reader_t* reader, cardano_withdrawal_map_t** withdrawal_map);
+
+/**
+ * \brief Serializes a withdrawal map into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_withdrawal_map_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] withdrawal_map A constant pointer to the \ref cardano_withdrawal_map_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p withdrawal_map or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_withdrawal_map_t* withdrawal_map = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_withdrawal_map_to_cbor(withdrawal_map, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_withdrawal_map_unref(&withdrawal_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_withdrawal_map_to_cbor(
+  const cardano_withdrawal_map_t* withdrawal_map,
+  cardano_cbor_writer_t*          writer);
+
+/**
+ * \brief Serializes a withdrawal map to a CIP-116 JSON array.
+ *
+ * This function serializes a map of [RewardAddress -> Coin] into
+ * a JSON array of key-value objects:
+ * [ { "key": "<reward_addr_bech32>", "value": "<uint64_string>" }, ... ]
+ *
+ * \param[in]  map     Pointer to a valid \ref cardano_withdrawal_map_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p map or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED  If memory allocation fails.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_withdrawal_map_to_cip116_json(
+  const cardano_withdrawal_map_t* map,
+  cardano_json_writer_t*          writer);
+
+/**
+ * \brief Retrieves the length of the withdrawal_map.
+ *
+ * This function returns the number of key-value pairs contained in the specified withdrawal_map.
+ *
+ * \param[in] withdrawal_map A constant pointer to the \ref cardano_withdrawal_map_t object for which
+ *                       the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the withdrawal_map. Returns 0 if the withdrawal_map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_withdrawal_map_t* withdrawal_map = cardano_withdrawal_map_new();
+ *
+ * // Populate the withdrawal_map with key-value pairs
+ *
+ * size_t length = cardano_withdrawal_map_get_length(withdrawal_map);
+ * printf("The length of the withdrawal_map is: %zu\n", length);
+ *
+ * cardano_withdrawal_map_unref(&withdrawal_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_withdrawal_map_get_length(const cardano_withdrawal_map_t* withdrawal_map);
+
+/**
+ * \brief Retrieves the value associated with a given key in the withdrawal map.
+ *
+ * This function retrieves the value associated with the specified key in the provided withdrawal map.
+ * It returns the value through the output parameter `element`. If the key is not found in the withdrawal map,
+ * the output parameter `element` will be set to NULL.
+ *
+ * \param[in] withdrawal_map A constant pointer to the \ref cardano_withdrawal_map_t object from which
+ *                       the value is to be retrieved.
+ * \param[in] key The key whose associated value is to be retrieved from the withdrawal_map.
+ * \param[out] element A pointer to a variable where the retrieved value will be stored. If the key
+ *                     is found in the withdrawal map, this variable will be set to the associated value.
+ *                     If the key is not found, this variable will be set to NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value associated with the key was successfully retrieved, or
+ *         an appropriate error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_withdrawal_map_t* withdrawal_map = cardano_withdrawal_map_new();
+ *
+ * // Populate the withdrawal_map with key-value pairs
+ *
+ * cardano_reward_address_t* key = ...; // Create a reward_address object representing the key
+ * uint64_t value = 0;
+ * cardano_error_t result = cardano_withdrawal_map_get(withdrawal_map, key, &value);
+ *
+ * if (result == CARDANO_SUCCESS && value != NULL)
+ * {
+ *   // Use the retrieved value
+ *   // ...
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_reward_address_unref(&key); // Clean up the key resource
+ * cardano_withdrawal_map_unref(&withdrawal_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_withdrawal_map_get(cardano_withdrawal_map_t* withdrawal_map, cardano_reward_address_t* key, uint64_t* element);
+
+/**
+ * \brief Inserts a key-value pair into the withdrawal map.
+ *
+ * This function inserts the specified key-value pair into the provided withdrawal map.
+ *
+ * \param[in] withdrawal_map A constant pointer to the \ref cardano_withdrawal_map_t object where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The key to be inserted into the withdrawal map. The caller is responsible for managing
+ *                the lifecycle of the key object.
+ * \param[in] value The value to be associated with the key and inserted into the withdrawal_map.
+ *                  The caller is responsible for managing the lifecycle of the value object.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_withdrawal_map_t* withdrawal_map = cardano_withdrawal_map_new();
+ *
+ * // Create key and value objects
+ * cardano_reward_address_t* key = ...;
+ * uint64_t value = 0;
+ *
+ * // Insert the key-value pair into the withdrawal_map
+ * cardano_error_t result = cardano_withdrawal_map_insert(withdrawal_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value objects
+ * cardano_reward_address_unref(&key);
+ *
+ * cardano_withdrawal_map_unref(&withdrawal_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_withdrawal_map_insert(cardano_withdrawal_map_t* withdrawal_map, cardano_reward_address_t* key, uint64_t value);
+
+/**
+ * \brief Inserts a withdrawal entry into the withdrawal map using a reward address.
+ *
+ * This function inserts a withdrawal entry into the specified \ref cardano_withdrawal_map_t object. The withdrawal is associated
+ * with a reward address and specifies the amount to be withdrawn in lovelace.
+ *
+ * \param[in, out] withdrawal_map A pointer to the \ref cardano_withdrawal_map_t object where the withdrawal entry will be inserted.
+ * \param[in] reward_address A pointer to a string representing the Bech32-encoded reward address. This parameter must not be NULL.
+ * \param[in] reward_address_size The length of the reward address string in bytes.
+ * \param[in] value The amount of ADA (in lovelace) to withdraw from the reward address.
+ *
+ * \return \ref CARDANO_SUCCESS if the withdrawal entry was successfully inserted into the map, or an appropriate error code
+ * indicating the type of failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_withdrawal_map_t* withdrawal_map = ...; // Assume initialized
+ * const char* reward_address = "stake1u..."; // Bech32-encoded reward address
+ * uint64_t withdrawal_value = 1000000; // 1 ADA in lovelace
+ *
+ * cardano_error_t result = cardano_withdrawal_map_insert_ex(withdrawal_map, reward_address, strlen(reward_address), withdrawal_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Withdrawal entry successfully added
+ * }
+ * else
+ * {
+ *   printf("Failed to insert withdrawal entry: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup when done
+ * cardano_withdrawal_map_unref(&withdrawal_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_withdrawal_map_insert_ex(
+  cardano_withdrawal_map_t* withdrawal_map,
+  const char*               reward_address,
+  size_t                    reward_address_size,
+  uint64_t                  value);
+
+/**
+ * \brief Retrieves the keys from the withdrawal map.
+ *
+ * This function retrieves all the keys from the provided withdrawal map and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_reward_address_list_t when it is no longer needed.
+ *
+ * \param[in] withdrawal_map A constant pointer to the \ref cardano_withdrawal_map_t object from which
+ *                       the keys are to be retrieved.
+ * \param[out] keys A pointer to a variable where the retrieved keys will be stored as a list.
+ *                  If successful, this variable will be set to point to the list of keys.
+ *                  The caller is responsible for managing the lifecycle of this list.
+ *                  It must be released by calling \ref cardano_reward_address_list_t when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the keys were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_withdrawal_map_t* withdrawal_map = cardano_withdrawal_map_new();
+ *
+ * // Populate the withdrawal_map with key-value pairs
+ *
+ * cardano_reward_address_list_t* keys = NULL;
+ * cardano_error_t result = cardano_withdrawal_map_get_keys(withdrawal_map, &keys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of keys
+ *   // Keys must also be freed if retrieved from the list
+ *
+ *   // Once done, ensure to clean up and release the keys list
+ *   cardano_reward_address_list_unref(&keys);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_withdrawal_map_unref(&withdrawal_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_withdrawal_map_get_keys(cardano_withdrawal_map_t* withdrawal_map, cardano_reward_address_list_t** keys);
+
+/**
+ * \brief Retrieves the reward address at a specific index from the withdrawal map.
+ *
+ * This function retrieves the reward address at the specified index from the withdrawal map.
+ *
+ * \param[in] withdrawal_map Pointer to the withdrawal map object.
+ * \param[in] index The index of the reward address to retrieve.
+ * \param[out] reward_address On successful retrieval, this will point to the reward address
+ *                            at the specified index. The caller is responsible for managing the lifecycle
+ *                            of this object. Specifically, once the reward address is no longer needed,
+ *                            the caller must release it by calling \ref cardano_reward_address_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reward address was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_withdrawal_map_t* withdrawal_map = NULL;
+ * cardano_reward_address_t* reward_address = NULL;
+ * size_t index = 0; // Index of the key hash to retrieve
+ *
+ * // Assume withdrawal_map is initialized properly
+ *
+ * cardano_error_t result = cardano_withdrawal_map_get_key_at(withdrawal_map, index, &reward_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the reward_address
+ *
+ *   // Once done, ensure to clean up and release the reward_address
+ *   cardano_reward_address_unref(&reward_address);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_withdrawal_map_get_key_at(
+  const cardano_withdrawal_map_t* withdrawal_map,
+  size_t                          index,
+  cardano_reward_address_t**      reward_address);
+
+/**
+ * \brief Retrieves the withdrawal amount at a specific index from the withdrawal map.
+ *
+ * This function retrieves the withdrawal amount at the specified index from the withdrawal map.
+ *
+ * \param[in] withdrawal_map Pointer to the withdrawal map object.
+ * \param[in] index The index of the withdrawal amount to retrieve.
+ * \param[out] amount On successful retrieval, this will point to the withdrawal amount
+ *                    at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the withdrawal amount was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_withdrawal_map_t* withdrawal_map = NULL;
+ * uint64_t amount = 0;
+ * size_t index = 0; // Index of the withdrawal amount to retrieve
+ *
+ * // Assume withdrawal_map is initialized properly
+ *
+ * cardano_error_t result = cardano_withdrawal_map_get_value_at(withdrawal_map, index, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the amount
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_withdrawal_map_get_value_at(
+  const cardano_withdrawal_map_t* withdrawal_map,
+  size_t                          index,
+  uint64_t*                       amount);
+
+/**
+ * \brief Retrieves the reward address and withdrawal amount at the specified index.
+ *
+ * This function retrieves the reward address and withdrawal amount from the proposed withdrawal amounts
+ * at the specified index.
+ *
+ * \param[in]  withdrawal_map    Pointer to the proposed withdrawal amounts object.
+ * \param[in]  index             The index at which to retrieve the key-value pair.
+ * \param[out] reward_address On successful retrieval, this will point to the reward address at the specified index.
+ *                            The caller is responsible for managing the lifecycle of this object and should release it using
+ *                            \ref cardano_reward_address_unref when it is no longer needed.
+ * \param[out] amount On successful retrieval, this will point to the withdrawal amount at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_withdrawal_map_t* withdrawal_map = NULL;
+ * // Assume withdrawal_map is initialized properly
+ *
+ * size_t index = 0;
+ * cardano_reward_address_t* reward_address = NULL;
+ * uint64_t amount = 0;
+ *
+ * cardano_error_t result = cardano_withdrawal_map_get_key_value_at(withdrawal_map, index, &reward_address, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (reward_address != NULL && amount != NULL)
+ *   {
+ *     // Use the reward address and withdrawal amount
+ *   }
+ *   else
+ *   {
+ *     printf("Key-value pair not set at index %zu.\n", index);
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_withdrawal_map_unref(&withdrawal_map);
+ * cardano_reward_address_unref(&reward_address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_withdrawal_map_get_key_value_at(
+  const cardano_withdrawal_map_t* withdrawal_map,
+  size_t                          index,
+  cardano_reward_address_t**      reward_address,
+  uint64_t*                       amount);
+
+/**
+ * \brief Decrements the reference count of a withdrawal_map object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_withdrawal_map_t object
+ * by decreasing its reference count. When the reference count reaches zero, the withdrawal_map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] withdrawal_map A pointer to the pointer of the withdrawal_map object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_withdrawal_map_t* withdrawal_map = cardano_withdrawal_map_new();
+ *
+ * // Perform operations with the withdrawal_map...
+ *
+ * cardano_withdrawal_map_unref(&withdrawal_map);
+ * // At this point, withdrawal_map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_withdrawal_map_unref, the pointer to the \ref cardano_withdrawal_map_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_withdrawal_map_unref(cardano_withdrawal_map_t** withdrawal_map);
+
+/**
+ * \brief Increases the reference count of the cardano_withdrawal_map_t object.
+ *
+ * This function is used to manually increment the reference count of a withdrawal_map
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_withdrawal_map_unref.
+ *
+ * \param withdrawal_map A pointer to the withdrawal_map object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming withdrawal_map is a previously created withdrawal_map object
+ *
+ * cardano_withdrawal_map_ref(withdrawal_map);
+ *
+ * // Now withdrawal_map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_withdrawal_map_ref there is a corresponding
+ * call to \ref cardano_withdrawal_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_withdrawal_map_ref(cardano_withdrawal_map_t* withdrawal_map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_withdrawal_map_t object.
+ *
+ * This function returns the number of active references to a withdrawal_map object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_withdrawal_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param withdrawal_map A pointer to the withdrawal_map object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified withdrawal_map object. If the object
+ * is properly managed (i.e., every \ref cardano_withdrawal_map_ref call is matched with a
+ * \ref cardano_withdrawal_map_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming withdrawal_map is a previously created withdrawal_map object
+ *
+ * size_t ref_count = cardano_withdrawal_map_refcount(withdrawal_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_withdrawal_map_refcount(const cardano_withdrawal_map_t* withdrawal_map);
+
+/**
+ * \brief Sets the last error message for a given withdrawal_map object.
+ *
+ * Records an error message in the withdrawal_map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] withdrawal_map A pointer to the \ref cardano_withdrawal_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the withdrawal_map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_withdrawal_map_set_last_error(cardano_withdrawal_map_t* withdrawal_map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific withdrawal_map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_withdrawal_map_set_last_error for the given
+ * withdrawal_map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] withdrawal_map A pointer to the \ref cardano_withdrawal_map_t instance whose last error
+ *                   message is to be retrieved. If the withdrawal_map is NULL, the function
+ *                   returns a generic error message indicating the null withdrawal_map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified withdrawal_map. If the withdrawal_map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_withdrawal_map_set_last_error for the same withdrawal_map, or until
+ *       the withdrawal_map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_withdrawal_map_get_last_error(const cardano_withdrawal_map_t* withdrawal_map);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_withdrawal_map_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_withdrawal_map_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_withdrawal_map_deep_clone(const cardano_withdrawal_map_t* source, cardano_withdrawal_map_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_WITHDRAWAL_MAP_H
diff --git a/vendor/include/cardano/crypto/bip32_private_key.h b/vendor/include/cardano/crypto/bip32_private_key.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/crypto/bip32_private_key.h
@@ -0,0 +1,627 @@
+/**
+ * \file bip32_private_key.h
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BIP32_PRIVATE_KEY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BIP32_PRIVATE_KEY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/bip32_public_key.h>
+#include <cardano/crypto/ed25519_private_key.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a BIP32 hierarchical deterministic (HD) private key.
+ *
+ * This structure encapsulates a private key following the BIP32 standard, which can be used for
+ * generating a deterministic series of private keys from a single master seed. BIP32 private keys
+ * allow for the structured management of cryptocurrency wallets through a tree-like hierarchy of
+ * key derivation paths. This enables a single seed to give rise to a practically unlimited number
+ * of child keys, each of which can be used independently.
+ */
+typedef struct cardano_bip32_private_key_t cardano_bip32_private_key_t;
+
+/**
+ * \brief Creates a BIP32 private key object from a raw byte array.
+ *
+ * This function takes an array of bytes representing a BIP32 private key and constructs
+ * a new `cardano_bip32_private_key_t` object.
+ *
+ * \param[in] key_bytes A pointer to the byte array containing the binary representation of the BIP32 private key.
+ * \param[in] key_length The length of the byte array pointed to by `key`.
+ * \param[out] key A pointer to a pointer that will be set to point to the newly created `cardano_bip32_private_key_t` object.
+ *            The caller is responsible for freeing this object using the appropriate API function to prevent memory leaks.
+ *
+ * \return A \c cardano_error_t indicating the result of the operation. On success, the function
+ *         returns \ref CARDANO_SUCCESS, and the `key` parameter is updated to point to the newly created
+ *         private key object. On failure, a non-zero error code is returned, and the value pointed to by
+ *         `key` is set to `NULL`, indicating that the private key object was not successfully created.
+ *
+ * Example Usage:
+ * \code
+ * const byte_t raw_key[] = { ... }; // Byte array containing the BIP32 private key
+ * size_t raw_key_length = sizeof(raw_key);
+ * cardano_bip32_private_key_t* bip32_key = NULL;
+ *
+ * cardano_error_t result = cardano_bip32_private_key_from_bytes(raw_key, raw_key_length, &bip32_key);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The `bip32_key` can now be used for operations like address generation
+ * }
+ *
+ * // Remember to free the BIP32 private key object when done
+ * cardano_bip32_private_key_unref(&bip32_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_private_key_from_bytes(
+  const byte_t*                 key_bytes,
+  size_t                        key_length,
+  cardano_bip32_private_key_t** key);
+
+/**
+ * \brief Generates a BIP32 private key from BIP39 entropy.
+ *
+ * This function creates a BIP32 hierarchical deterministic (HD) private key using
+ * the provided BIP39 entropy. The entropy typically comes from a mnemonic seed phrase,
+ * which is converted into a binary format. Additionally, a password can be supplied for
+ * use in the key generation process, adding an extra layer of security. The resulting
+ * BIP32 private key can be used to derive wallet addresses and other private keys within
+ * a hierarchical structure.
+ *
+ * \param[in] password A pointer to the byte array containing the password or passphrase.
+ *                 This can be an empty string if no password is used.
+ * \param[in] password_length The length of the password in bytes.
+ * \param[in] entropy A pointer to the byte array containing the entropy derived from a BIP39 mnemonic.
+ * \param[in] entropy_length The length of the entropy in bytes.
+ * \param[out] key A pointer to a pointer that will be set to point to the newly created
+ *            `cardano_bip32_private_key_t` object. It is the responsibility of the caller
+ *            to manage the lifecycle of this object, including its deallocation, to
+ *            prevent memory leaks.
+ *
+ * \return cardano_error_t Returns \ref CARDANO_SUCCESS if the BIP32 private key was successfully
+ *         created. On failure, a non-zero error code is returned, indicating an issue with
+ *         the inputs or an internal error in the key generation process. If the function
+ *         fails, the value pointed to by `key` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * const byte_t password[] = "optional password";
+ * size_t password_length = sizeof(password);
+ * const byte_t entropy[] = { ... }; // Entropy derived from a BIP39 mnemonic
+ * size_t entropy_length = sizeof(entropy);
+ * cardano_bip32_private_key_t* bip32_key = NULL;
+ *
+ * cardano_error_t error = cardano_bip32_private_key_from_bip39_entropy(password, password_length, entropy, entropy_length, &bip32_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *     // The `bip32_key` can now be used
+ * }
+ *
+ * // Clean up
+ * cardano_bip32_private_key_unref(&bip32_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_private_key_from_bip39_entropy(
+  const byte_t*                 password,
+  size_t                        password_length,
+  const byte_t*                 entropy,
+  size_t                        entropy_length,
+  cardano_bip32_private_key_t** key);
+
+/**
+ * \brief Creates a BIP32 private key object from a hexadecimal string.
+ *
+ * This function parses a hexadecimal string representing a BIP32 private key and constructs
+ * a `cardano_bip32_private_key_t` object from it.
+ *
+ * \param[in] hex A pointer to the null-terminated string containing the hexadecimal representation
+ *            of the BIP32 private key.
+ * \param[in] hex_len The length of the hexadecimal string, excluding the null terminator.
+ * \param[out] key A pointer to a pointer to `cardano_bip32_private_key_t` where the address of
+ *            the newly created private key object will be stored. It is the caller's responsibility
+ *            to manage the lifecycle of the created object, including its deallocation through
+ *            the appropriate API function to prevent memory leaks.
+ *
+ * \return A \c cardano_error_t indicating the result of the operation. On success, the function
+ *         returns \ref CARDANO_SUCCESS, and the `key` parameter is updated to point to the newly created
+ *         private key object. On failure, a non-zero error code is returned, and the value pointed to by
+ *         `key` is set to `NULL`, indicating that the private key object was not successfully created.
+ *
+ * Example Usage:
+ * \code
+ * const char* hex_key = "a1b2c3d4..."; // Hexadecimal string of the private key
+ * size_t hex_key_len = strlen(hex_key);
+ * cardano_bip32_private_key_t* private_key = NULL;
+ *
+ * cardano_error_t error = cardano_bip32_private_key_from_hex(hex_key, hex_key_len, &private_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `private_key` can now be used for cryptographic operations
+ * }
+ *
+ * // Clean up
+ * cardano_bip32_private_key_unref(&private_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_private_key_from_hex(
+  const char*                   hex,
+  size_t                        hex_len,
+  cardano_bip32_private_key_t** key);
+
+/**
+ * \brief Decrements the reference count of a BIP32 private key object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_bip32_private_key_t object
+ * by decreasing its reference count. When the reference count reaches zero, the BIP32 private key is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] private_key A pointer to the pointer of the BIP32 private key object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bip32_private_key_t* key = cardano_bip32_private_key_new();
+ *
+ * // Perform operations with the key...
+ *
+ * cardano_bip32_private_key_unref(&key);
+ * // At this point, key is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_bip32_private_key_unref, the pointer to the \ref cardano_bip32_private_key_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_bip32_private_key_unref(cardano_bip32_private_key_t** private_key);
+
+/**
+ * \brief Increases the reference count of the cardano_bip32_private_key_t object.
+ *
+ * This function is used to manually increment the reference count of a BIP32 private key
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_bip32_private_key_unref.
+ *
+ * \param[in] private_key A pointer to the BIP32 private key object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming key is a previously created BIP32 private key object
+ *
+ * cardano_bip32_private_key_ref(key);
+ *
+ * // Now key can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_bip32_private_key_ref there is a corresponding
+ * call to \ref cardano_bip32_private_key_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_bip32_private_key_ref(cardano_bip32_private_key_t* private_key);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_bip32_private_key_t object.
+ *
+ * This function returns the number of active references to a BIP32 private key object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_bip32_private_key_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param[in] private_key A pointer to the BIP32 private key object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified BIP32 private key object. If the object
+ * is properly managed (i.e., every \ref cardano_bip32_private_key_ref call is matched with a
+ * \ref cardano_bip32_private_key_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming key is a previously created BIP32 private key object
+ *
+ * size_t ref_count = cardano_bip32_private_key_refcount(key);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bip32_private_key_refcount(const cardano_bip32_private_key_t* private_key);
+
+/**
+ * \brief Derives a child BIP32 private key from a parent BIP32 private key using a specified derivation path.
+ *
+ * This function takes a BIP32 private key and an array of indices representing the derivation path
+ * to produce a child private key. The derivation path allows for a structured hierarchy of keys,
+ * enabling the generation of multiple keys from a single seed, in accordance with the BIP32
+ * specification.
+ *
+ * \param[in] private_key A pointer to the initial `cardano_bip32_private_key_t` from which
+ *                        the derivation process starts. This key acts as the root of the
+ *                        derivation path.
+ * \param[in] indices An array of uint32_t values representing the derivation path. Each value
+ *                    specifies an index at which a child key should be derived from the current key
+ *                    in the path. Hardened keys are indicated by indices >= 2^31.
+ * \param[in] indices_count The number of indices in the `indices` array, indicating the depth of
+ *                          the derivation path.
+ * \param[out] derived_private_key A pointer to a pointer to `cardano_bip32_private_key_t` that will be updated
+ *                         to point to the newly derived private key object. The caller is responsible
+ *                         for managing the lifecycle of this object, including its deallocation, to
+ *                         prevent memory leaks.
+ *
+ * \return cardano_error_t Returns \ref CARDANO_SUCCESS if the child private key was successfully derived.
+ *         On failure, a non-zero error code is returned, indicating an issue with the inputs,
+ *         the inability to derive a key at the specified path, or an internal error during the
+ *         derivation process. If the function fails, the value pointed to by `derived_private_key` is
+ *         set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * uint32_t derivation_path[] = { ... };
+ * size_t path_length = sizeof(derivation_path) / sizeof(uint32_t);
+ * cardano_bip32_private_key_t* parent_key = ...; // Assume parent_key is previously initialized
+ * cardano_bip32_private_key_t* child_key = NULL;
+ *
+ * cardano_error_t error = cardano_bip32_private_key_derive(parent_key, derivation_path, path_length, &child_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `child_key` can now be used for transactions, address generation, etc.
+ * }
+ *
+ * // Clean up
+ * cardano_bip32_private_key_unref(&child_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_private_key_derive(
+  const cardano_bip32_private_key_t* private_key,
+  const uint32_t*                    indices,
+  size_t                             indices_count,
+  cardano_bip32_private_key_t**      derived_private_key);
+
+/**
+ * \brief Converts a BIP32 private key to an Ed25519 private key.
+ *
+ * This function allows for the conversion of a private key from the BIP32 hierarchical
+ * deterministic wallet format to an Ed25519 private key format.
+ *
+ * \param[in] private_key A pointer to the `cardano_bip32_private_key_t` object representing the
+ *                   BIP32 private key to be converted.
+ * \param[out] ed25519_private_key A pointer to a pointer to `cardano_ed25519_private_key_t` that
+ *                           will be updated to point to the newly created Ed25519 private key
+ *                           object. The caller is responsible for managing the lifecycle of
+ *                           this object, including its deallocation, to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns an error code indicating the outcome of the operation.
+ *         On success, the function returns \ref CARDANO_SUCCESS, and `ed25519_private_key` is
+ *         updated to point to the new Ed25519 private key object. On failure, a non-zero
+ *         error code is returned, and the value pointed to by `ed25519_private_key` is set
+ *         to `NULL`, indicating that the conversion was unsuccessful.
+ *
+ * Example Usage:
+ * \code
+ * cardano_bip32_private_key_t* bip32_private_key = ...; // Assume this is initialized
+ * cardano_ed25519_private_key_t* ed25519_private_key = NULL;
+ *
+ * cardano_error_t error = cardano_bip32_private_key_to_ed25519_key(bip32_private_key, &ed25519_private_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // `ed25519_private_key` can now be used for cryptographic operations requiring Ed25519 keys
+ * }
+ *
+ * // Remember to free the Ed25519 private key object when done
+ * cardano_ed25519_private_key_unref(&ed25519_private_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_private_key_to_ed25519_key(
+  const cardano_bip32_private_key_t* private_key,
+  cardano_ed25519_private_key_t**    ed25519_private_key);
+
+/**
+ * \brief Extracts the public key from a BIP32 private key.
+ *
+ * This function derives the corresponding public key from a given BIP32 private key.
+ * The derived public key is essential for various operations within the Cardano ecosystem,
+ * such as generating wallet addresses or verifying signatures, where the private key itself
+ * must remain secret. The public key is derived without compromising the private key.
+ *
+ * \param[in] private_key A pointer to the `cardano_bip32_private_key_t` object from which
+ *                    the public key is to be derived. This private key must have been
+ *                    properly initialized and represent a valid BIP32 private key.
+ * \param[out] ed25519_public_key A pointer to a pointer to `cardano_bip32_public_key_t` that will
+ *                           be updated to point to the newly created public key object. It is
+ *                           the caller's responsibility to manage the lifecycle of this object,
+ *                           including its deallocation, to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns \ref CARDANO_SUCCESS if the public key was successfully derived
+ *         from the private key. On failure, a non-zero error code is returned, indicating
+ *         an issue with the input private key or an internal error in the public key derivation
+ *         process. If the function fails, the value pointed to by `ed25519_public_key` is set
+ *         to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * cardano_bip32_private_key_t* bip32_private_key = ...; // Previously initialized BIP32 private key
+ * cardano_bip32_public_key_t* bip32_public_key = NULL;
+ *
+ * cardano_error_t error = cardano_bip32_private_key_get_public_key(bip32_private_key, &bip32_public_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `bip32_public_key` can now be used for address generation, transaction verification, etc.
+ * }
+ *
+ * // Clean up
+ * cardano_bip32_public_key_unref(&bip32_public_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_private_key_get_public_key(
+  const cardano_bip32_private_key_t* private_key,
+  cardano_bip32_public_key_t**       ed25519_public_key);
+
+/**
+ * \brief Retrieves the size in bytes of a BIP32 private key.
+ *
+ * This function calculates and returns the size of the given BIP32 private key object
+ * when represented as a byte array.
+ *
+ * \param[in] private_key A pointer to the `cardano_bip32_private_key_t` object whose byte size
+ *                   is to be determined.
+ *
+ * \return The size of the BIP32 private key in bytes. If the provided `private_key` is invalid
+ *         or NULL, the function will return 0.
+ *
+ * Example Usage:
+ * \code
+ * cardano_bip32_private_key_t* bip32_private_key = ...; // Previously created or loaded BIP32 private key
+ * size_t key_size = cardano_bip32_private_key_get_bytes_size(bip32_private_key);
+ *
+ * // Use key_size to allocate memory for the key's byte representation
+ * byte_t* key_bytes = (byte_t*)malloc(key_size);
+ * // Ensure to check for malloc failure and handle `key_bytes` appropriately
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bip32_private_key_get_bytes_size(const cardano_bip32_private_key_t* private_key);
+
+/**
+ * \brief Retrieves a direct pointer to the internal data of a BIP32 private key object.
+ *
+ * This function provides access to the internal storage of the BIP32 private key object, allowing for read-only operations on its contents.
+ * It is intended for situations where direct access to the data is necessary for performance or interoperability reasons.
+ *
+ * \warning The returned pointer provides raw, direct access to the BIP32 private key object's internal data. It must not be used to modify
+ * the buffer contents outside the API's control, nor should it be deallocated using free or similar memory management functions.
+ * The lifecycle of the data pointed to by the returned pointer is managed by the BIP32 private key object's reference counting mechanism; therefore,
+ * the data remains valid as long as the BIP32 private key object exists and has not been deallocated.
+ *
+ * \param[in] bip32_private_key The BIP32 private key instance from which to retrieve the internal data pointer. The BIP32 private key must have been previously
+ * created and not yet deallocated.
+ *
+ * \return Returns a pointer to the internal data of the BIP32 private key. If the BIP32 private key instance is invalid,
+ * returns NULL. The returned pointer provides direct access to the BIP32 private key's contents and must be used in accordance with the
+ * warning above to avoid unintended consequences.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_bip32_private_key_get_data(const cardano_bip32_private_key_t* bip32_private_key);
+
+/**
+ * \brief Serializes a BIP32 private key into a provided byte array.
+ *
+ * Converts the given BIP32 private key object into its byte representation and stores it
+ * in the provided buffer.
+ *
+ * \param[in] private_key A pointer to the `cardano_bip32_private_key_t` object representing the
+ *                        BIP32 private key to be serialized.
+ * \param[out] out_key_bytes A pointer to the buffer where the byte representation of the private key will
+ *                           be stored. The buffer must be pre-allocated by the caller and have a size
+ *                           sufficient to hold the entire serialized private key.
+ * \param[in] out_key_length The size of the buffer pointed to by `key`, indicating the maximum
+ *                           number of bytes that can be written into the buffer. To ensure
+ *                           successful serialization, this size should be at least as large as
+ *                           the size returned by `cardano_bip32_private_key_get_bytes_size` for
+ *                           the given `private_key`.
+ *
+ * \return cardano_error_t Returns \ref CARDANO_SUCCESS if the private key was successfully
+ *         serialized into the byte array. If the function fails, it returns a non-zero
+ *         error code. Possible failure reasons include invalid input parameters (such as
+ *         a NULL `private_key`), a `key` buffer that is too small (`key_length` insufficient),
+ *         or other internal errors encountered during the serialization process.
+ *
+ * Example Usage:
+ * \code
+ * // Assuming 'bip32_private_key' is a previously initialized BIP32 private key
+ * const size_t required_size = cardano_bip32_private_key_get_bytes_size(bip32_private_key);
+ * byte_t* buffer = malloc(required_size);
+ *
+ * if (buffer != NULL)
+ * {
+ *   cardano_error_t result = cardano_bip32_private_key_to_bytes(bip32_private_key, buffer, required_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // The buffer now contains the serialized private key
+ *   }
+ *
+ *   free(buffer);
+ * }
+ * else
+ * {
+ *   // Handle memory allocation failure
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_private_key_to_bytes(
+  const cardano_bip32_private_key_t* private_key,
+  byte_t*                            out_key_bytes,
+  size_t                             out_key_length);
+
+/**
+ * \brief Determines the required buffer size for the hexadecimal representation of a BIP32 private key.
+ *
+ * This function calculates the length of the string that would be required to store the
+ * hexadecimal representation of a given BIP32 private key, including the null-terminator.
+ *
+ * \param[in] private_key A pointer to the `cardano_bip32_private_key_t` object whose hexadecimal
+ *                   size is being queried.
+ *
+ * \return The size of the buffer (in bytes) needed to store the hexadecimal string representation
+ *         of the BIP32 private key, including space for the null-terminator. If the provided
+ *         `private_key` is invalid or NULL, the function will return 0.
+ *
+ * Example Usage:
+ * \code
+ * // Assuming 'bip32_private_key' is a previously initialized BIP32 private key
+ * size_t hex_size = cardano_bip32_private_key_get_hex_size(bip32_private_key);
+ *
+ *  char* hex_buffer = (char*)malloc(hex_size);
+ *
+ *  if (hex_buffer != NULL)
+ *  {
+ *    // Buffer is ready for use with cardano_bip32_private_key_to_hex
+ *  }
+ *
+ *  // Remember to free the allocated buffer
+ *  free(hex_buffer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bip32_private_key_get_hex_size(const cardano_bip32_private_key_t* private_key);
+
+/**
+ * \brief Serializes a BIP32 private key into its hexadecimal string representation.
+ *
+ * Converts the given BIP32 private key object into a hexadecimal string and stores it
+ * in the provided buffer. The caller is responsible for ensuring that the buffer is sufficiently
+ * large to hold the entire  hexadecimal string, including the null terminator. The required size
+ * can be determined by calling \ref cardano_bip32_private_key_get_hex_size.
+ *
+ * \param[in] private_key A pointer to the `cardano_bip32_private_key_t` object representing the
+ *                   BIP32 private key to be converted to hexadecimal format.
+ * \param[out] hex_key A pointer to the buffer where the hexadecimal string representation of the
+ *                private key will be stored. The buffer must be pre-allocated and should be
+ *                large enough to hold the hexadecimal string plus a null terminator.
+ * \param[in] key_length The length of the buffer pointed to by `hex_key`, indicating the maximum
+ *                   number of characters (bytes) that can be written into the buffer,
+ *                   including space for the null terminator.
+ *
+ * \return cardano_error_t Returns \ref CARDANO_SUCCESS if the private key was successfully
+ *         serialized into the hexadecimal format and stored in the provided buffer.
+ *         If the function fails, it returns a non-zero error code. Failure can occur
+ *         for several reasons, including but not limited to an invalid `private_key`,
+ *         an insufficiently sized buffer (`key_length` too small), or other internal errors
+ *         encountered during the serialization process.
+ *
+ * Example Usage:
+ * \code
+ * cardano_bip32_private_key_t* bip32_private_key = ...; // Previously initialized BIP32 private key
+ * size_t hex_size = cardano_bip32_private_key_get_hex_size(bip32_private_key);
+ * char* hex_buffer = (char*)malloc(hex_size);
+ *
+ * char* hex_buffer = (char*)malloc(hex_size);
+ *
+ * if (cardano_blake2b_hash_to_hex(bip32_private_key, hex_buffer, hex_size) == CARDANO_SUCCESS)
+ * {
+ *    // hex_buffer now contains the hexadecimal representation of the key
+ * }
+ *
+ * free(hex_buffer); // Always ensure to free allocated memory
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_private_key_to_hex(
+  const cardano_bip32_private_key_t* private_key,
+  char*                              hex_key,
+  size_t                             key_length);
+
+/**
+ * \brief Hardens a given BIP32 index.
+ *
+ * This function converts a given index into its hardened form according to BIP32 specifications.
+ * In BIP32, an index is hardened by adding 2^31 to it, which sets the highest bit of a 32-bit integer.
+ * Hardened indices prevent the derivation of child private keys from parent public keys.
+ *
+ * Hardening ensures that even if an attacker gains access to a child private key and the parent public
+ * key, they cannot derive the parent private key or any sibling private keys.
+ *
+ * \param[in] index The index to be hardened. This index should be within the range of valid BIP32 indices
+ *                 (0 through 2^31 - 1) for non-hardened indices. Indices outside this range may already
+ *                 be considered hardened.
+ *
+ * \return The hardened index, which is the input index with 2^31 added to it. If the input index is already
+ *         hardened (i.e., it has the highest bit set), the function returns the input index unchanged.
+ *
+ * Example Usage:
+ * \code
+ * uint32_t index = 44; // Example index for a BIP32 derivation path
+ * uint32_t hardened_index = cardano_bip32_harden(index);
+ * // hardenedIndex now equals 44 + 2^31, indicating it's a hardened index
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint32_t cardano_bip32_harden(uint32_t index);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_bip32_private_key_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_bip32_private_key_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_bip32_private_key_deep_clone(const cardano_bip32_private_key_t* source, cardano_bip32_private_key_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BIP32_PRIVATE_KEY_H
diff --git a/vendor/include/cardano/crypto/bip32_public_key.h b/vendor/include/cardano/crypto/bip32_public_key.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/crypto/bip32_public_key.h
@@ -0,0 +1,541 @@
+/**
+ * \file bip32_public_key.h
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BIP32_PUBLIC_KEY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BIP32_PUBLIC_KEY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/ed25519_public_key.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a BIP32 public key.
+ *
+ * This structure encapsulates a public key according to the BIP32 standard, which
+ * is utilized in hierarchical deterministic (HD) wallets.
+ */
+typedef struct cardano_bip32_public_key_t cardano_bip32_public_key_t;
+
+/**
+ * \brief Creates a BIP32 public key object from a raw byte array.
+ *
+ * This function takes an array of bytes representing a BIP32 public key and constructs
+ * a new `cardano_bip32_public_key_t` object.
+ *
+ * \param[in] key_bytes A pointer to the byte array containing the binary representation of the BIP32 public key.
+ * \param[in] key_length The length of the byte array pointed to by `key`.
+ * \param[out] key A pointer to a pointer that will be set to point to the newly created `cardano_bip32_public_key_t` object.
+ *            The caller is responsible for freeing this object using the appropriate API function to prevent memory leaks.
+ *
+ * \return A `cardano_error_t` indicating the result of the operation. On success, the function
+ *         returns `CARDANO_SUCCESS`, and the `key` parameter is updated to point to the newly created
+ *         public key object. On failure, a non-zero error code is returned, and the value pointed to by
+ *         `key` is set to `NULL`, indicating that the public key object was not successfully created.
+ *
+ * Example Usage:
+ * \code
+ * const byte_t raw_key[] = { ... }; // Byte array containing the BIP32 public key
+ * size_t raw_key_length = sizeof(raw_key);
+ * cardano_bip32_public_key_t* bip32_key = NULL;
+ *
+ * cardano_error_t result = cardano_bip32_public_key_from_bytes(raw_key, raw_key_length, &bip32_key);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The `bip32_key` can now be used for operations like address generation
+ * }
+ *
+ * // Remember to free the BIP32 public key object when done
+ * cardano_bip32_public_key_unref(&bip32_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_public_key_from_bytes(
+  const byte_t*                key_bytes,
+  size_t                       key_length,
+  cardano_bip32_public_key_t** key);
+
+/**
+ * \brief Creates a BIP32 public key object from a hexadecimal string.
+ *
+ * This function parses a hexadecimal string representing a BIP32 public key and constructs
+ * a `cardano_bip32_public_key_t` object from it.
+ *
+ * \param[in] hex A pointer to the null-terminated string containing the hexadecimal representation
+ *            of the BIP32 public key.
+ * \param[in] hex_length The length of the hexadecimal string, excluding the null terminator.
+ * \param[out] key A pointer to a pointer to `cardano_bip32_public_key_t` where the address of
+ *            the newly created public key object will be stored. It is the caller's responsibility
+ *            to manage the lifecycle of the created object, including its deallocation through
+ *            the appropriate API function to prevent memory leaks.
+ *
+ * \return A `cardano_error_t` indicating the result of the operation. On success, the function
+ *         returns `CARDANO_SUCCESS`, and the `key` parameter is updated to point to the newly created
+ *         public key object. On failure, a non-zero error code is returned, and the value pointed to by
+ *         `key` is set to `NULL`, indicating that the public key object was not successfully created.
+ *
+ * Example Usage:
+ * \code
+ * const char* hex_key = "a1b2c3d4..."; // Hexadecimal string of the public key
+ * size_t hex_key_len = strlen(hex_key);
+ * cardano_bip32_public_key_t* public_key = NULL;
+ *
+ * cardano_error_t error = cardano_bip32_public_key_from_hex(hex_key, hex_key_len, &public_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `public_key` can now be used for cryptographic operations
+ * }
+ *
+ * // Clean up
+ * cardano_bip32_public_key_unref(&public_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_public_key_from_hex(
+  const char*                  hex,
+  size_t                       hex_length,
+  cardano_bip32_public_key_t** key);
+
+/**
+ * \brief Decrements the reference count of a BIP32 public key object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_bip32_public_key_t object
+ * by decreasing its reference count. When the reference count reaches zero, the BIP32 public key is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] public_key A pointer to the pointer of the BIP32 public key object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bip32_public_key_t* key = cardano_bip32_public_key_from_bytes(...);
+ *
+ * // Perform operations with the key...
+ *
+ * cardano_bip32_public_key_unref(&key);
+ * // At this point, key is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_bip32_public_key_unref, the pointer to the \ref cardano_bip32_public_key_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_bip32_public_key_unref(cardano_bip32_public_key_t** public_key);
+
+/**
+ * \brief Increases the reference count of the cardano_bip32_public_key_t object.
+ *
+ * This function is used to manually increment the reference count of a BIP32 public key
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_bip32_public_key_unref.
+ *
+ * \param public_key A pointer to the BIP32 public key object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming key is a previously created BIP32 public key object
+ *
+ * cardano_bip32_public_key_ref(key);
+ *
+ * // Now key can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_bip32_public_key_ref there is a corresponding
+ * call to \ref cardano_bip32_public_key_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_bip32_public_key_ref(cardano_bip32_public_key_t* public_key);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_bip32_public_key_t object.
+ *
+ * This function returns the number of active references to a BIP32 public key object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_bip32_public_key_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param public_key A pointer to the BIP32 public key object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified BIP32 public key object. If the object
+ * is properly managed (i.e., every \ref cardano_bip32_public_key_ref call is matched with a
+ * \ref cardano_bip32_public_key_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming key is a previously created BIP32 public key object
+ *
+ * size_t ref_count = cardano_bip32_public_key_refcount(key);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bip32_public_key_refcount(const cardano_bip32_public_key_t* public_key);
+
+/**
+ * \brief Derives a BIP32 public key based on a sequence of indices.
+ *
+ * This function takes an existing BIP32 public key and derives a new public key
+ * by following a path specified by an array of indices. This path derivation
+ * adheres to the BIP32 specification for hierarchical deterministic wallets.
+ *
+ * \param[in] bip32_public_key A pointer to the initial `cardano_bip32_public_key_t` from which
+ *                             the derivation process starts. This key acts as the root of the
+ *                             derivation path.
+ * \param[in] indices An array of uint32_t values representing the derivation path. Each
+ *                    value in the array specifies an index in the hierarchy where the
+ *                    child key should be derived from the current key.
+ * \param[in] indices_count The number of indices in the `indices` array, representing
+ *                          the depth of the derivation path.
+ * \param[out] derived_bip32_public_key A pointer to a pointer to `cardano_bip32_public_key_t` that will
+ *                                      be updated to point to the newly derived public key object.
+ *                                      The caller is responsible for freeing this object using the
+ *                                      appropriate API function to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns an error code indicating the result of the operation.
+ *         On success, the function returns `CARDANO_SUCCESS`, and `public_key` is set to
+ *         point to the newly derived public key object. On failure, a non-zero error code
+ *         is returned, and the value pointed to by `public_key` is set to `NULL`, indicating
+ *         that the derivation failed and no new key was generated.
+ *
+ * Example Usage:
+ * \code
+ * uint32_t indices[] = { 44, 1815, 0, 0, 0 }; // Example BIP44 derivation path
+ * size_t indices_count = sizeof(indices) / sizeof(uint32_t);
+ * cardano_bip32_public_key_t* initial_public_key = ...; // Obtain or generate the initial BIP32 public key
+ * cardano_bip32_public_key_t* derived_public_key = NULL;
+ *
+ * cardano_error_t error = cardano_bip32_public_key_derive(initial_public_key, indices, indices_count, &derived_public_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `derived_public_key` can now be used for further operations, such as
+ *   // generating addresses or verifying transactions.
+ * }
+ *
+ * // Clean up
+ * cardano_bip32_public_key_unref(&derived_public_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_public_key_derive(
+  const cardano_bip32_public_key_t* bip32_public_key,
+  const uint32_t*                   indices,
+  size_t                            indices_count,
+  cardano_bip32_public_key_t**      derived_bip32_public_key);
+
+/**
+ * \brief Converts a BIP32 public key to an Ed25519 public key.
+ *
+ * This function allows for the conversion of a public key from the BIP32 hierarchical
+ * deterministic wallet format to an Ed25519 public key format.
+ *
+ * \param[in] public_key A pointer to the `cardano_bip32_public_key_t` object representing the
+ *                   BIP32 public key to be converted.
+ * \param[out] ed25519_public_key A pointer to a pointer to `cardano_ed25519_public_key_t` that
+ *                           will be updated to point to the newly created Ed25519 public key
+ *                           object. The caller is responsible for managing the lifecycle of
+ *                           this object, including its deallocation, to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns an error code indicating the outcome of the operation.
+ *         On success, the function returns `CARDANO_SUCCESS`, and `ed25519_public_key` is
+ *         updated to point to the new Ed25519 public key object. On failure, a non-zero
+ *         error code is returned, and the value pointed to by `ed25519_public_key` is set
+ *         to `NULL`, indicating that the conversion was unsuccessful.
+ *
+ * Example Usage:
+ * \code
+ * cardano_bip32_public_key_t* bip32_public_key = ...; // Assume this is initialized
+ * cardano_ed25519_public_key_t* ed25519_public_key = NULL;
+ *
+ * cardano_error_t error = cardano_bip32_public_key_to_ed25519_key(bip32_public_key, &ed25519_public_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // `ed25519_public_key` can now be used for cryptographic operations requiring Ed25519 keys
+ * }
+ *
+ * // Remember to free the Ed25519 public key object when done
+ * cardano_ed25519_public_key_unref(&ed25519_public_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_public_key_to_ed25519_key(
+  const cardano_bip32_public_key_t* public_key,
+  cardano_ed25519_public_key_t**    ed25519_public_key);
+
+/**
+ * \brief Retrieves the size in bytes of a BIP32 public key.
+ *
+ * This function calculates and returns the size of the given BIP32 public key object
+ * when represented as a byte array.
+ *
+ * \param[in] public_key A pointer to the `cardano_bip32_public_key_t` object whose byte size
+ *                   is to be determined.
+ *
+ * \return The size of the BIP32 public key in bytes. If the provided `public_key` is invalid
+ *         or NULL, the function will return 0.
+ *
+ * Example Usage:
+ * \code
+ * cardano_bip32_public_key_t* bip32_public_key = ...; // Previously created or loaded BIP32 public key
+ * size_t key_size = cardano_bip32_public_key_get_bytes_size(bip32_public_key);
+ *
+ * // Use key_size to allocate memory for the key's byte representation
+ * byte_t* key_bytes = (byte_t*)malloc(key_size);
+ * // Ensure to check for malloc failure and handle `key_bytes` appropriately
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bip32_public_key_get_bytes_size(const cardano_bip32_public_key_t* public_key);
+
+/**
+ * \brief Retrieves a direct pointer to the internal data of a BIP32 public key object.
+ *
+ * This function provides access to the internal storage of the BIP32 public key object, allowing for read-only operations on its contents.
+ * It is intended for situations where direct access to the data is necessary for performance or interoperability reasons.
+ *
+ * \warning The returned pointer provides raw, direct access to the BIP32 public key object's internal data. It must not be used to modify
+ * the buffer contents outside the API's control, nor should it be deallocated using free or similar memory management functions.
+ * The lifecycle of the data pointed to by the returned pointer is managed by the BIP32 public key object's reference counting mechanism; therefore,
+ * the data remains valid as long as the BIP32 public key object exists and has not been deallocated.
+ *
+ * \param[in] bip32_public_key The BIP32 public key instance from which to retrieve the internal data pointer. The BIP32 public key must have been previously
+ * created and not yet deallocated.
+ *
+ * \return Returns a pointer to the internal data of the BIP32 public key. If the BIP32 public key instance is invalid,
+ * returns NULL. The returned pointer provides direct access to the BIP32 public key's contents and must be used in accordance with the
+ * warning above to avoid unintended consequences.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_bip32_public_key_get_data(const cardano_bip32_public_key_t* bip32_public_key);
+
+/**
+ * \brief Serializes a BIP32 public key into a provided byte array.
+ *
+ * Converts the given BIP32 public key object into its byte representation and stores it
+ * in the provided buffer.
+ *
+ * \param[in] public_key A pointer to the `cardano_bip32_public_key_t` object representing the
+ *                       BIP32 public key to be serialized.
+ * \param[out] out_key_bytes A pointer to the buffer where the byte representation of the public key will
+ *                           be stored. The buffer must be pre-allocated by the caller and have a size
+ *                           sufficient to hold the entire serialized public key.
+ * \param[in] out_key_length The size of the buffer pointed to by `key`, indicating the maximum
+ *                           number of bytes that can be written into the buffer. To ensure
+ *                           successful serialization, this size should be at least as large as
+ *                           the size returned by `cardano_bip32_public_key_get_bytes_size` for
+ *                           the given `public_key`.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the public key was successfully
+ *         serialized into the byte array. If the function fails, it returns a non-zero
+ *         error code. Possible failure reasons include invalid input parameters (such as
+ *         a NULL `public_key`), a `key` buffer that is too small (`key_length` insufficient),
+ *         or other internal errors encountered during the serialization process.
+ *
+ * Example Usage:
+ * \code
+ * // Assuming 'bip32_public_key' is a previously initialized BIP32 public key
+ * const size_t required_size = cardano_bip32_public_key_get_bytes_size(bip32_public_key);
+ * byte_t* buffer = malloc(required_size);
+ *
+ * if (buffer != NULL)
+ * {
+ *   cardano_error_t result = cardano_bip32_public_key_to_bytes(bip32_public_key, buffer, required_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // The buffer now contains the serialized public key
+ *   }
+ *
+ *   free(buffer);
+ * }
+ * else
+ * {
+ *   // Handle memory allocation failure
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_public_key_to_bytes(
+  const cardano_bip32_public_key_t* public_key,
+  byte_t*                           out_key_bytes,
+  size_t                            out_key_length);
+
+/**
+ * \brief Determines the required buffer size for the hexadecimal representation of a BIP32 public key.
+ *
+ * This function calculates the length of the string that would be required to store the
+ * hexadecimal representation of a given BIP32 public key, including the null-terminator.
+ *
+ * \param[in] public_key A pointer to the `cardano_bip32_public_key_t` object whose hexadecimal
+ *                   size is being queried.
+ *
+ * \return The size of the buffer (in bytes) needed to store the hexadecimal string representation
+ *         of the BIP32 public key, including space for the null-terminator. If the provided
+ *         `public_key` is invalid or NULL, the function will return 0.
+ *
+ * Example Usage:
+ * \code
+ * // Assuming 'bip32_public_key' is a previously initialized BIP32 public key
+ * size_t hex_size = cardano_bip32_public_key_get_hex_size(bip32_public_key);
+ *
+ *  char* hex_buffer = (char*)malloc(hex_size);
+ *
+ *  if (hex_buffer != NULL)
+ *  {
+ *    // Buffer is ready for use with cardano_bip32_public_key_to_hex
+ *  }
+ *
+ *  // Remember to free the allocated buffer
+ *  free(hex_buffer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bip32_public_key_get_hex_size(const cardano_bip32_public_key_t* public_key);
+
+/**
+ * \brief Serializes a BIP32 public key into its hexadecimal string representation.
+ *
+ * Converts the given BIP32 public key object into a hexadecimal string and stores it
+ * in the provided buffer. The caller is responsible for ensuring that the buffer is sufficiently
+ * large to hold the entire  hexadecimal string, including the null terminator. The required size
+ * can be determined by calling \ref cardano_bip32_public_key_get_hex_size.
+ *
+ * \param[in] public_key A pointer to the `cardano_bip32_public_key_t` object representing the
+ *                   BIP32 public key to be converted to hexadecimal format.
+ * \param[out] hex_key A pointer to the buffer where the hexadecimal string representation of the
+ *                public key will be stored. The buffer must be pre-allocated and should be
+ *                large enough to hold the hexadecimal string plus a null terminator.
+ * \param[in] key_length The length of the buffer pointed to by `hex_key`, indicating the maximum
+ *                   number of characters (bytes) that can be written into the buffer,
+ *                   including space for the null terminator.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the public key was successfully
+ *         serialized into the hexadecimal format and stored in the provided buffer.
+ *         If the function fails, it returns a non-zero error code. Failure can occur
+ *         for several reasons, including but not limited to an invalid `public_key`,
+ *         an insufficiently sized buffer (`key_length` too small), or other internal errors
+ *         encountered during the serialization process.
+ *
+ * Example Usage:
+ * \code
+ * cardano_bip32_public_key_t* bip32_public_key = ...; // Previously initialized BIP32 public key
+ * size_t hex_size = cardano_bip32_public_key_get_hex_size(bip32_public_key);
+ * char* hex_buffer = (char*)malloc(hex_size);
+ *
+ * char* hex_buffer = (char*)malloc(hex_size);
+ *
+ * if (cardano_blake2b_hash_to_hex(bip32_public_key, hex_buffer, hex_size) == CARDANO_SUCCESS)
+ * {
+ *  // hex_buffer now contains the hexadecimal representation of the key
+ * }
+ *
+ * free(hex_buffer); // Always ensure to free allocated memory
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_public_key_to_hex(
+  const cardano_bip32_public_key_t* public_key,
+  char*                             hex_key,
+  size_t                            key_length);
+
+/**
+ * \brief Converts a BIP32 public key into an Ed25519 key hash.
+ *
+ * This function takes a BIP32 public key and computes its hash using the BLAKE2b
+ * hashing algorithm.
+ *
+ * \param[in] public_key A pointer to the `cardano_bip32_public_key_t` object representing
+ *                   the BIP32 public key to be hashed.
+ * \param[out] hash A pointer to a pointer that will be set to point to the newly created
+ *             `cardano_blake2b_hash_t` object, containing the hash of the BIP32
+ *             public key. It is the responsibility of the caller to manage the lifecycle
+ *             of this object, including its deallocation, to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the hash was successfully created
+ *         from the BIP32 public key. On failure, a non-zero error code is returned,
+ *         indicating an issue such as an invalid public key or failure in the hashing
+ *         process. If the function fails, the value pointed to by `hash` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * cardano_bip32_public_key_t* bip32_public_key = ...; // Assume the BIP32 public key is initialized
+ * cardano_blake2b_hash_t* hash = NULL;
+ *
+ * cardano_error_t error = cardano_bip32_public_key_to_hash(bip32_public_key, &hash);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `hash` can now be used for further cryptographic operations
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_key_hash_unref(&hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bip32_public_key_to_hash(
+  const cardano_bip32_public_key_t* public_key,
+  cardano_blake2b_hash_t**          hash);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_bip32_public_key_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_bip32_public_key_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_bip32_public_key_deep_clone(const cardano_bip32_public_key_t* source, cardano_bip32_public_key_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BIP32_PUBLIC_KEY_H
diff --git a/vendor/include/cardano/crypto/blake2b_hash.h b/vendor/include/cardano/crypto/blake2b_hash.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/crypto/blake2b_hash.h
@@ -0,0 +1,618 @@
+/**
+ * \file blake2b_hash.h
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BLAKE2B_HASH_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BLAKE2B_HASH_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a BLAKE2b hash.
+ *
+ * This structure encapsulates the result of a BLAKE2b hashing operation, abstracting
+ * the underlying hash data. It is used throughout the Cardano system in various contexts,
+ * such as transaction identification, address generation, and cryptographic verification.
+ */
+typedef struct cardano_blake2b_hash_t cardano_blake2b_hash_t;
+
+/**
+ * \brief Computes a BLAKE2b hash for the given data.
+ *
+ * This function calculates the BLAKE2b hash of the specified input data and returns
+ * the hash result as a newly allocated `cardano_blake2b_hash_t` instance.
+ *
+ * \param[in] data A pointer to the byte array containing the input data to hash.
+ * \param[in] data_length The length of the input data array in bytes.
+ * \param[in] hash_length The desired length of the resulting hash in bytes. Valid
+ * values depend on the specific BLAKE2b variant being used (e.g., 28 for BLAKE2b-224,
+ * 32 for BLAKE2b-256, 64 for BLAKE2b-512).
+ * \param[out] hash A pointer to a pointer to `cardano_blake2b_hash_t` that will be
+ * allocated and set to point to the newly created hash object on successful
+ * completion of the function.
+ *
+ * \return \ref cardano_error_t indicating the success or failure of the hash computation.
+ * Returns `CARDANO_SUCCESS` on success, or an error code signifying the type of
+ * failure encountered during the hash computation.
+ *
+ * Example Usage:
+ * \code
+ * byte_t data[] = { ... };
+ * size_t data_length = sizeof(data);
+ * cardano_blake2b_hash_t* hash = NULL;
+ * cardano_error_t result = cardano_blake2b_compute_hash(data, data_length, CARDANO_BLAKE2B_HASH_SIZE_256, &hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the hash
+ *   ...
+ *   cardano_blake2b_hash_unref(&hash);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_compute_hash(
+  const byte_t*            data,
+  size_t                   data_length,
+  size_t                   hash_length,
+  cardano_blake2b_hash_t** hash);
+
+/**
+ * \brief Creates a BLAKE2b hash object from raw byte data.
+ *
+ * This function takes a buffer of hash bytes and constructs a new BLAKE2b hash object.
+ *
+ * \param[in] data Pointer to the raw byte data of the hash.
+ * \param[in] data_length The length of the data in bytes.
+ * \param[out] hash A pointer to a pointer to `cardano_blake2b_hash_t` where the address of
+ *             the newly created hash object will be stored. The caller is responsible
+ *             for managing the lifecycle of the created hash object, including its
+ *             proper deallocation through the corresponding unreference or destruction
+ *             function to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ *         On success, the function returns \ref CARDANO_SUCCESS and `hash` is set to point
+ *         to the newly created hash object. On failure, a non-zero error code is
+ *         returned and the value pointed to by `hash` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * byte_t data[] = { ... };
+ * size_t data_length = sizeof(data) / sizeof(byte_t);
+ * cardano_blake2b_hash_t* hash = NULL;
+ *
+ * cardano_error_t error = cardano_blake2b_hash_from_bytes(data, data_length, &hash);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Use the hash object for further operations
+ * }
+ *
+ * // Clean up
+ * cardano_blake2b_hash_unref(hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_from_bytes(
+  const byte_t*            data,
+  size_t                   data_length,
+  cardano_blake2b_hash_t** hash);
+
+/**
+ * \brief Creates a BLAKE2b hash object from hexadecimal string data.
+ *
+ * This function takes a hexadecimal string representing hash data and constructs
+ * a new BLAKE2b hash object. The function is designed to parse the hexadecimal
+ * string input and convert it into the corresponding binary representation before
+ * creating the hash object.
+ *
+ * \param[in] hex Pointer to the hexadecimal string to be converted into a hash object.
+ * \param[in] hex_length The length of the hexadecimal string in characters.
+ * \param[out] hash A pointer to a pointer to `cardano_blake2b_hash_t` where the address of
+ *             the newly created hash object will be stored. The caller is responsible
+ *             for managing the lifecycle of the created hash object, including its
+ *             proper deallocation through the corresponding unreference or destruction
+ *             function to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ *         On success, the function returns \ref CARDANO_SUCCESS, and `hash` is set to
+ *         point to the newly created hash object. On failure, a non-zero error code is
+ *         returned, and the value pointed to by `hash` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * const char* hex_data = "abc123..."; // Hexadecimal representation of the data
+ * size_t hex_length = strlen(hex_data);
+ * cardano_blake2b_hash_t* hash = NULL;
+ *
+ * cardano_error_t error = cardano_blake2b_hash_from_hex(hex_data, hex_length, &hash);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The hash object can now be used for further operations
+ * }
+ *
+ * // Clean up
+ * cardano_blake2b_hash_unref(hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_from_hex(
+  const char*              hex,
+  size_t                   hex_length,
+  cardano_blake2b_hash_t** hash);
+
+/**
+ * \brief Creates a \ref cardano_blake2b_hash_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_blake2b_hash_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a blake2b_hash.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] blake2b_hash A pointer to a pointer of \ref cardano_blake2b_hash_t that will be set to the address
+ *                        of the newly created blake2b_hash object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_blake2b_hash_t object by calling
+ *       \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_blake2b_hash_t* blake2b_hash = NULL;
+ *
+ * cardano_error_t result = cardano_blake2b_hash_from_cbor(reader, &blake2b_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the blake2b_hash
+ *
+ *   // Once done, ensure to clean up and release the blake2b_hash
+ *   cardano_blake2b_hash_unref(&blake2b_hash);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode blake2b_hash: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_blake2b_hash_from_cbor(cardano_cbor_reader_t* reader, cardano_blake2b_hash_t** blake2b_hash);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_blake2b_hash_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] blake2b_hash A constant pointer to the \ref cardano_blake2b_hash_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p blake2b_hash or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* blake2b_hash = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_blake2b_hash_to_cbor(blake2b_hash, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_blake2b_hash_unref(&blake2b_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_to_cbor(
+  const cardano_blake2b_hash_t* blake2b_hash,
+  cardano_cbor_writer_t*        writer);
+
+/**
+ * \brief Serializes a BLAKE2b hash to CIP-116 JSON.
+ *
+ * Writes the hash as exactly one JSON string of lowercase hex characters to \p writer:
+ *
+ * \code{.json}
+ * "0000000000000000000000000000000000000000000000000000000000000000"
+ * \endcode
+ *
+ * \param[in]     blake2b_hash  The hash to serialize. Must not be NULL.
+ * \param[in,out] writer        A valid JSON writer positioned where a value is expected. Must not be NULL.
+ *
+ * \return CARDANO_SUCCESS on success; an appropriate error code otherwise.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_blake2b_hash_to_cip116_json(const cardano_blake2b_hash_t* blake2b_hash, cardano_json_writer_t* writer);
+
+/**
+ * \brief Compares two Blake2b hash objects for equality.
+ *
+ * This function compares two Blake2b hash objects to determine if they are equal.
+ *
+ * \param[in] lhs Pointer to the first Blake2b hash object.
+ * \param[in] rhs Pointer to the second Blake2b hash object.
+ *
+ * \return \c true if the hash objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* hash1 = NULL;
+ * cardano_blake2b_hash_t* hash2 = NULL;
+ *
+ * // Assume hash1 and hash2 are initialized properly
+ *
+ * bool are_equal = cardano_blake2b_hash_equals(hash1, hash2);
+ *
+ * if (are_equal)
+ * {
+ *   printf("The hash objects are equal.\n");
+ * }
+ * else
+ * {
+ *   printf("The hash objects are not equal.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_blake2b_hash_unref(&hash1);
+ * cardano_blake2b_hash_unref(&hash2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_blake2b_hash_equals(
+  const cardano_blake2b_hash_t* lhs,
+  const cardano_blake2b_hash_t* rhs);
+
+/**
+ * \brief Compares two Blake2b hash objects.
+ *
+ * This function compares two Blake2b hash objects and returns an integer indicating
+ * their relative order.
+ *
+ * \param[in] lhs Pointer to the first Blake2b hash object.
+ * \param[in] rhs Pointer to the second Blake2b hash object.
+ *
+ * \return A negative value if lhs is less than rhs, zero if they are equal, and a positive value if lhs is greater than rhs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* hash1 = NULL;
+ * cardano_blake2b_hash_t* hash2 = NULL;
+ *
+ * // Assume hash1 and hash2 are initialized properly
+ *
+ * int32_t comparison = cardano_blake2b_hash_compare(hash1, hash2);
+ * if (comparison < 0)
+ * {
+ *   printf("hash1 is less than hash2.\n");
+ * }
+ * else if (comparison == 0)
+ * {
+ *   printf("hash1 is equal to hash2.\n");
+ * }
+ * else
+ * {
+ *   printf("hash1 is greater than hash2.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_blake2b_hash_unref(&hash1);
+ * cardano_blake2b_hash_unref(&hash2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT int32_t cardano_blake2b_hash_compare(
+  const cardano_blake2b_hash_t* lhs,
+  const cardano_blake2b_hash_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a BLAKE2b hash object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_blake2b_hash_t object
+ * by decreasing its reference count. When the reference count reaches zero, the BLAKE2b hash is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] hash A pointer to the pointer of the BLAKE2b hash object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_error_t result = cardano_blake2b_compute_hash(data, data_length, CARDANO_BLAKE2B_HASH_SIZE_256, &hash);
+ *
+ * // Perform operations with the hash...
+ *
+ * cardano_blake2b_hash_unref(&hash);
+ * // At this point, hash is NULL and cannot be used.
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_blake2b_hash_unref(cardano_blake2b_hash_t** hash);
+
+/**
+ * \brief Increases the reference count of the cardano_blake2b_hash_t object.
+ *
+ * This function is used to manually increment the reference count of a BLAKE2b hash
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_blake2b_hash_unref.
+ *
+ * \param[in,out] hash A pointer to the BLAKE2b hash object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming hash is a previously created BLAKE2b hash object
+ *
+ * cardano_blake2b_hash_ref(hash);
+ *
+ * // Now hash can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_blake2b_hash_ref there is a corresponding
+ * call to \ref cardano_blake2b_hash_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_blake2b_hash_ref(cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_blake2b_hash_t object.
+ *
+ * This function returns the number of active references to a BLAKE2b hash object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_blake2b_hash_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param[in,out] hash A pointer to the BLAKE2b hash object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified BLAKE2b hash object. If the object
+ * is properly managed (i.e., every \ref cardano_blake2b_hash_ref call is matched with a
+ * \ref cardano_blake2b_hash_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming hash is a previously created BLAKE2b hash object
+ *
+ * size_t ref_count = cardano_blake2b_hash_refcount(hash);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_blake2b_hash_refcount(const cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Retrieves a direct pointer to the internal data of a blake2b hash object.
+ *
+ * This function provides access to the internal storage of the blake2b hash object, allowing for read-only operations on its contents.
+ * It is intended for situations where direct access to the data is necessary for performance or interoperability reasons.
+ *
+ * \warning The returned pointer provides raw, direct access to the blake2b hash object's internal data. It must not be used to modify
+ * the buffer contents outside the API's control, nor should it be deallocated using free or similar memory management functions.
+ * The lifecycle of the data pointed to by the returned pointer is managed by the blake2b hash object's reference counting mechanism; therefore,
+ * the data remains valid as long as the blake2b hash object exists and has not been deallocated.
+ *
+ * \param[in] blake2b_hash The blake2b hash instance from which to retrieve the internal data pointer. The blake2b hash must have been previously
+ * created and not yet deallocated.
+ *
+ * \return Returns a pointer to the internal data of the blake2b hash. If the blake2b hash instance is invalid,
+ * returns NULL. The returned pointer provides direct access to the blake2b hash's contents and must be used in accordance with the
+ * warning above to avoid unintended consequences.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_blake2b_hash_get_data(const cardano_blake2b_hash_t* blake2b_hash);
+
+/**
+ * \brief Retrieves the size of the BLAKE2b hash object in bytes.
+ *
+ * \param[in] blake2b_hash A pointer to the `cardano_blake2b_hash_t` object whose size is to be retrieved.
+ *
+ * \return The size of the BLAKE2b hash object in bytes. If the provided hash object
+ *         is invalid or NULL, the function will return 0.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_blake2b_hash_get_bytes_size(const cardano_blake2b_hash_t* blake2b_hash);
+
+/**
+ * \brief Converts a BLAKE2b hash object into a raw byte array representation.
+ *
+ * This function exports the contents of a given BLAKE2b hash object into a user-provided
+ * byte array.
+ *
+ * \param[in] blake2b_hash A pointer to the `cardano_blake2b_hash_t` object to be exported.
+ * \param[out] hash A pointer to a byte array where the hash bytes will be stored. This array
+ *             must be pre-allocated by the caller and be large enough to hold the entire
+ *             hash value.
+ * \param[in] hash_length The length of the `hash` array in bytes. This must be equal to or
+ *                 larger than the size of the hash object to avoid buffer overflow.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ *         On success, the function returns \ref CARDANO_SUCCESS and the `hash` array
+ *         contains the byte representation of the hash object. On failure, a non-zero
+ *         error code is returned. Possible failure reasons include invalid input parameters
+ *         or a mismatch between `hash_length` and the actual size of the hash object.
+ *
+ * Example Usage:
+ * \code
+ * cardano_blake2b_hash_t* hash_obj = ...; // Assume hash_obj is previously created and valid
+ * const size_t hash_size = cardano_blake2b_hash_get_bytes_size(hash_obj);
+ * byte_t* hash_bytes = malloc(hash_size); // Allocate enough space for the hash
+ *
+ * if (hash_bytes != NULL)
+ * {
+ *   cardano_error_t error = cardano_blake2b_hash_to_bytes(hash_obj, hash_bytes, hash_size);
+ *
+ *   if (error == CARDANO_SUCCESS)
+ *   {
+ *     // The hash_bytes array now contains the hash object's bytes
+ *   }
+ *
+ *   // Remember to free the allocated memory when done
+ *   free(hash_bytes);
+ * }
+ * \endcode
+ *
+ * Note: It is the caller's responsibility to ensure that the `hash` array is correctly
+ *       allocated and to free any allocated resources when no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_to_bytes(
+  const cardano_blake2b_hash_t* blake2b_hash,
+  byte_t*                       hash,
+  size_t                        hash_length);
+
+/**
+ * \brief Retrieves the size of the hexadecimal representation of a BLAKE2b hash object.
+ *
+ * This function calculates the length of the string that would represent the BLAKE2b
+ * hash object in hexadecimal form. This is useful for allocating the correct amount of
+ * memory to store the hexadecimal representation of the hash.
+ *
+ * \param[in] blake2b_hash A pointer to the `cardano_blake2b_hash_t` object whose hexadecimal
+ *                     size is to be retrieved.
+ *
+ * \return The size of the buffer needed to store the hexadecimal representation of the hash
+ *         object, including the terminating null byte. If the provided hash object is invalid
+ *         or NULL, the function will return 0.
+ *
+ * Example Usage:
+ * \code
+ * cardano_blake2b_hash_t* hash_obj = ...; // Assume hash_obj is previously created
+ * size_t hex_size = cardano_blake2b_hash_get_hex_size(hash_obj);
+ * char* hex_buffer = (char*)malloc(hex_size);
+ *
+ * if (cardano_blake2b_hash_to_hex(hash_obj, hex_buffer, hex_size) == CARDANO_SUCCESS)
+ * {
+ *   // hex_buffer now contains the hexadecimal representation of the hash
+ * }
+ *
+ * free(hex_buffer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_blake2b_hash_get_hex_size(const cardano_blake2b_hash_t* blake2b_hash);
+
+/**
+ * \brief Converts a BLAKE2b hash object into its hexadecimal string representation.
+ *
+ * This function exports the hexadecimal string representation of the provided
+ * BLAKE2b hash object into a user-supplied buffer.
+ *
+ * \param[in] blake2b_hash A pointer to the `cardano_blake2b_hash_t` object to be converted.
+ * \param[out] hex_hash A pointer to the buffer where the hexadecimal string representation
+ *                 of the hash will be stored. The buffer must be large enough to hold
+ *                 the hexadecimal representation of the hash, including the terminating
+ *                 null byte.
+ * \param[in] hash_length The size of the buffer pointed to by `hex_hash`. This value should be
+ *                 at least twice the size of the hash object in bytes plus one for the
+ *                 terminating null byte, to accommodate the hexadecimal representation.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ *         On success, the function returns \ref CARDANO_SUCCESS, and the buffer pointed to
+ *         by `hex_hash` is filled with the hexadecimal representation of the hash object.
+ *         On failure, a non-zero error code is returned, which could indicate an invalid
+ *         hash object, insufficient buffer size, or other errors.
+ *
+ * Example Usage:
+ * \code
+ * cardano_blake2b_hash_t* hash_obj = ...; // Assume hash_obj is previously created
+ * size_t hex_size = cardano_blake2b_hash_get_hex_size(hash_obj);
+ * byte_t* hex_buffer = (byte_t*)malloc(hex_size);
+ *
+ * if (cardano_blake2b_hash_to_hex(hash_obj, hex_buffer, hex_size) == CARDANO_SUCCESS)
+ * {
+ *  // hex_buffer now contains the hexadecimal representation of the hash
+ * }
+ *
+ * free(hex_buffer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_to_hex(
+  const cardano_blake2b_hash_t* blake2b_hash,
+  char*                         hex_hash,
+  size_t                        hash_length);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_blake2b_hash_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_blake2b_hash_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_blake2b_hash_deep_clone(const cardano_blake2b_hash_t* source, cardano_blake2b_hash_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BLAKE2B_HASH_H
diff --git a/vendor/include/cardano/crypto/blake2b_hash_set.h b/vendor/include/cardano/crypto/blake2b_hash_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/crypto/blake2b_hash_set.h
@@ -0,0 +1,447 @@
+/**
+ * \file blake2b_hash_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BLAKE2B_HASH_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BLAKE2B_HASH_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a BLAKE2b hash.
+ *
+ * This structure encapsulates the result of a BLAKE2b hashing operation, abstracting
+ * the underlying hash data. It is used throughout the Cardano system in various contexts,
+ * such as transaction identification, address generation, and cryptographic verification.
+ */
+typedef struct cardano_blake2b_hash_t cardano_blake2b_hash_t;
+
+/**
+ * \brief Represents a set of blake2b_hashs.
+ */
+typedef struct cardano_blake2b_hash_set_t cardano_blake2b_hash_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a blake2b_hash_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_blake2b_hash_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] blake2b_hash_set On successful initialization, this will point to a newly created
+ *             \ref cardano_blake2b_hash_set_t object. This object represents a "strong reference"
+ *             to the blake2b_hash_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the blake2b_hash_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_blake2b_hash_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the blake2b_hash_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_set_t* blake2b_hash_set = NULL;
+ *
+ * // Attempt to create a new blake2b_hash_set
+ * cardano_error_t result = cardano_blake2b_hash_set_new(&blake2b_hash_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the blake2b_hash_set
+ *
+ *   // Once done, ensure to clean up and release the blake2b_hash_set
+ *   cardano_blake2b_hash_set_unref(&blake2b_hash_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_blake2b_hash_set_new(cardano_blake2b_hash_set_t** blake2b_hash_set);
+
+/**
+ * \brief Creates a blake2b_hash set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_blake2b_hash_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a blake2b_hash.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded blake2b_hash data.
+ * \param[out] blake2b_hashs A pointer to a pointer of \ref cardano_blake2b_hash_set_t that will be set to the address
+ *                        of the newly created blake2b_hash object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the blake2b_hash was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_blake2b_hash_set_t object by calling
+ *       \ref cardano_blake2b_hash_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_blake2b_hash_set_t* blake2b_hash = NULL;
+ *
+ * cardano_error_t result = cardano_blake2b_hash_set_from_cbor(reader, &blake2b_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the blake2b_hash
+ *
+ *   // Once done, ensure to clean up and release the blake2b_hash
+ *   cardano_blake2b_hash_set_unref(&blake2b_hash);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode blake2b_hash: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_blake2b_hash_set_from_cbor(cardano_cbor_reader_t* reader, cardano_blake2b_hash_set_t** blake2b_hashs);
+
+/**
+ * \brief Serializes a blake2b_hash into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_blake2b_hash_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] blake2b_hashs A constant pointer to the \ref cardano_blake2b_hash_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p blake2b_hash or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_set_t* blake2b_hash = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_blake2b_hash_set_to_cbor(blake2b_hash, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_blake2b_hash_set_unref(&blake2b_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_set_to_cbor(
+  const cardano_blake2b_hash_set_t* blake2b_hashs,
+  cardano_cbor_writer_t*            writer);
+
+/**
+ * \brief Serializes a set of BLAKE2b-256 hashes to CIP-116 JSON.
+ *
+ * Writes exactly one JSON array of lowercase hex strings (each 64 hex chars):
+ *
+ * \code{.json}
+ * [
+ *   "0000000000000000000000000000000000000000000000000000000000000000",
+ *   "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ * ]
+ * \endcode
+ *
+ * An empty set produces \code{.json}[]\endcode.
+ *
+ * \param[in]     hashes  A valid set of hashes to serialize. Must not be NULL.
+ * \param[in,out] json    A valid JSON writer positioned where a value is expected. Must not be NULL.
+ *
+ * \return CARDANO_SUCCESS on success; an appropriate error code otherwise.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_blake2b_hash_set_to_cip116_json(const cardano_blake2b_hash_set_t* hashes, cardano_json_writer_t* json);
+
+/**
+ * \brief Retrieves the length of a blake2b_hash list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_blake2b_hash_set_t object.
+ *
+ * \param[in] blake2b_hash_set A constant pointer to the \ref cardano_blake2b_hash_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the blake2b_hash_set. Return 0 if the blake2b_hash_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_set_t* blake2b_hash_set = cardano_blake2b_hash_set_new();
+ *
+ * // Populate blake2b_hash_set with elements
+ *
+ * size_t length = cardano_blake2b_hash_set_get_length(blake2b_hash_set);
+ * printf("Length of the blake2b_hash_set: %zu\n", length);
+ *
+ * // Clean up the blake2b_hash_set object once done
+ * cardano_blake2b_hash_set_unref(&blake2b_hash_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_blake2b_hash_set_get_length(const cardano_blake2b_hash_set_t* blake2b_hash_set);
+
+/**
+ * \brief Retrieves an element from a blake2b_hash list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_blake2b_hash_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] blake2b_hash_set A constant pointer to the \ref cardano_blake2b_hash_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the blake2b_hash list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_blake2b_hash_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_set_t* blake2b_hash_set = cardano_blake2b_hash_set_new();
+ *
+ * // Populate blake2b_hash_set with elements
+ *
+ * cardano_blake2b_hash_t* element = NULL;
+ * cardano_error_t result = cardano_blake2b_hash_set_get(blake2b_hash_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_blake2b_hash_unref(&element);
+ * }
+ *
+ * // Clean up the blake2b_hash_set object once done
+ * cardano_blake2b_hash_set_unref(&blake2b_hash_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_set_get(const cardano_blake2b_hash_set_t* blake2b_hash_set, size_t index, cardano_blake2b_hash_t** element);
+
+/**
+ * \brief Adds an element to a blake2b_hash list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_blake2b_hash_set_t object.
+ *
+ * \param[in] blake2b_hash_set A constant pointer to the \ref cardano_blake2b_hash_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_blake2b_hash_t object that is to be added to the blake2b_hash_set.
+ *                    The element will be referenced by the blake2b_hash_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the blake2b_hash_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_set_t* blake2b_hash_set = cardano_blake2b_hash_set_new();
+ *
+ * // Create and initialize a new blake2b_hash element
+ * cardano_blake2b_hash_t* element = { ... };
+ *
+ * // Add the element to the blake2b_hash_set
+ * cardano_error_t result = cardano_blake2b_hash_set_add(blake2b_hash_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the blake2b_hash_set object once done
+ * cardano_blake2b_hash_set_unref(&blake2b_hash_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_set_add(cardano_blake2b_hash_set_t* blake2b_hash_set, cardano_blake2b_hash_t* element);
+
+/**
+ * \brief Decrements the reference count of a blake2b_hash_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_blake2b_hash_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the blake2b_hash_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] blake2b_hash_set A pointer to the pointer of the blake2b_hash_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_set_t* blake2b_hash_set = cardano_blake2b_hash_set_new();
+ *
+ * // Perform operations with the blake2b_hash_set...
+ *
+ * cardano_blake2b_hash_set_unref(&blake2b_hash_set);
+ * // At this point, blake2b_hash_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_blake2b_hash_set_unref, the pointer to the \ref cardano_blake2b_hash_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_blake2b_hash_set_unref(cardano_blake2b_hash_set_t** blake2b_hash_set);
+
+/**
+ * \brief Increases the reference count of the cardano_blake2b_hash_set_t object.
+ *
+ * This function is used to manually increment the reference count of a blake2b_hash_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_blake2b_hash_set_unref.
+ *
+ * \param blake2b_hash_set A pointer to the blake2b_hash_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming blake2b_hash_set is a previously created blake2b_hash_set object
+ *
+ * cardano_blake2b_hash_set_ref(blake2b_hash_set);
+ *
+ * // Now blake2b_hash_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_blake2b_hash_set_ref there is a corresponding
+ * call to \ref cardano_blake2b_hash_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_blake2b_hash_set_ref(cardano_blake2b_hash_set_t* blake2b_hash_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_blake2b_hash_set_t object.
+ *
+ * This function returns the number of active references to a blake2b_hash_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_blake2b_hash_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param blake2b_hash_set A pointer to the blake2b_hash_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified blake2b_hash_set object. If the object
+ * is properly managed (i.e., every \ref cardano_blake2b_hash_set_ref call is matched with a
+ * \ref cardano_blake2b_hash_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming blake2b_hash_set is a previously created blake2b_hash_set object
+ *
+ * size_t ref_count = cardano_blake2b_hash_set_refcount(blake2b_hash_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_blake2b_hash_set_refcount(const cardano_blake2b_hash_set_t* blake2b_hash_set);
+
+/**
+ * \brief Sets the last error message for a given blake2b_hash_set object.
+ *
+ * Records an error message in the blake2b_hash_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] blake2b_hash_set A pointer to the \ref cardano_blake2b_hash_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the blake2b_hash_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_blake2b_hash_set_set_last_error(cardano_blake2b_hash_set_t* blake2b_hash_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific blake2b_hash_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_blake2b_hash_set_set_last_error for the given
+ * blake2b_hash_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] blake2b_hash_set A pointer to the \ref cardano_blake2b_hash_set_t instance whose last error
+ *                   message is to be retrieved. If the blake2b_hash_set is NULL, the function
+ *                   returns a generic error message indicating the null blake2b_hash_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified blake2b_hash_set. If the blake2b_hash_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_blake2b_hash_set_set_last_error for the same blake2b_hash_set, or until
+ *       the blake2b_hash_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_blake2b_hash_set_get_last_error(const cardano_blake2b_hash_set_t* blake2b_hash_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_blake2b_hash_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_blake2b_hash_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_blake2b_hash_set_deep_clone(const cardano_blake2b_hash_set_t* source, cardano_blake2b_hash_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BLAKE2B_HASH_SET_H
diff --git a/vendor/include/cardano/crypto/blake2b_hash_size.h b/vendor/include/cardano/crypto/blake2b_hash_size.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/crypto/blake2b_hash_size.h
@@ -0,0 +1,74 @@
+/**
+ * \file blake2b_hash_size.h
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BLAKE2B_HASH_SIZE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BLAKE2B_HASH_SIZE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \enum cardano_blake2b_hash_size_t
+ * \brief Represents the types of BLAKE2b hash functions distinguished by their output bit length.
+ * These hash types are utilized in various contexts throughout Cardano, including but not limited
+ * to verification keys, multi-signature scripts, and key derivation processes.
+ */
+typedef enum
+{
+  /**
+   * \brief BLAKE2b-224 (hash28)
+   *
+   * Produces a 224-bit output. Primarily used for hashing verification keys and
+   * multi-signature scripts.
+   */
+  CARDANO_BLAKE2B_HASH_SIZE_224 = 28,
+
+  /**
+   * \brief BLAKE2b-256 (hash32)
+   *
+   * Produces a 256-bit output. This is the standard BLAKE2b hash variant used
+   * across most of Cardano for a variety of purposes, including transaction
+   * IDs, address hashing, and more.
+   */
+  CARDANO_BLAKE2B_HASH_SIZE_256 = 32,
+
+  /**
+   * \brief BLAKE2b-512 (hash64)
+   *
+   * Produces a 512-bit output. Used specifically for key derivation functions
+   * within Cardano.
+   */
+  CARDANO_BLAKE2B_HASH_SIZE_512 = 64
+} cardano_blake2b_hash_size_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BLAKE2B_HASH_SIZE_H
diff --git a/vendor/include/cardano/crypto/crc32.h b/vendor/include/cardano/crypto/crc32.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/crypto/crc32.h
@@ -0,0 +1,68 @@
+/**
+ * \file crc32.h
+ *
+ * \author angel.castillo
+ * \date   Mar 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_CRC32_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_CRC32_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Computes the CRC32 checksum for the given data.
+ *
+ * This function calculates a 32-bit cyclic redundancy check (CRC32) checksum, used to detect
+ * accidental changes to raw data. CRC32 checksums are a common method for ensuring the integrity
+ * of data by producing a short, fixed-size checksum based on the input data.
+ *
+ * \param[in] data A pointer to the data block for which the CRC32 checksum is to be computed.
+ * \param[in] size The size of the data block in bytes.
+ *
+ * \return Returns a 32-bit unsigned integer representing the CRC32 checksum of the provided data.
+ *
+ * \note This function does not modify the input data. If the data pointer is NULL or size is zero,
+ * the function should return 0 as the checksum, which must be handled by the caller.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* sample_data = "Hello, world!";
+ * size_t data_size = strlen(sample_data);
+ *
+ * uint32_t checksum = cardano_checksum_crc32(sample_data, data_size);
+ *
+ * printf("CRC32 Checksum: %u\n", checksum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint32_t cardano_checksum_crc32(const byte_t* data, size_t size);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_CRC32_H
diff --git a/vendor/include/cardano/crypto/ed25519_private_key.h b/vendor/include/cardano/crypto/ed25519_private_key.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/crypto/ed25519_private_key.h
@@ -0,0 +1,593 @@
+/**
+ * \file ed25519_private_key.h
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ED25519_PRIVATE_KEY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ED25519_PRIVATE_KEY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/ed25519_public_key.h>
+#include <cardano/crypto/ed25519_signature.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents an Ed25519 private key within the Cardano ecosystem.
+ *
+ * The `cardano_ed25519_private_key_t` structure provides an abstraction over the raw
+ * private key data, facilitating secure handling, storage, and usage in various cryptographic
+ * functions. It enables the signing of messages, which can then be verified by others using
+ * the corresponding public key, without exposing the private key itself.
+ */
+typedef struct cardano_ed25519_private_key_t cardano_ed25519_private_key_t;
+
+/**
+ * \brief Creates an Ed25519 private key object from a raw byte array.
+ *
+ * This function constructs an Ed25519 private key from a provided array of bytes, assuming
+ * the bytes represent a "normal" Ed25519 private key. "Normal" in this context refers to a
+ * key derived directly from a seed, requiring 32 bytes of data.
+ *
+ * \param[in] key_bytes A pointer to the byte array containing the binary representation of
+ *            the Ed25519 private key.
+ * \param[in] key_length The length of the byte array pointed to by `key_bytes`. For a
+ *            "normal" Ed25519 private key, this should be 32 bytes.
+ * \param[out] private_key A pointer to a pointer that will be updated to point to the newly
+ *            created `cardano_ed25519_private_key_t` object. The caller is responsible for
+ *            managing the lifecycle of this object.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the private key was successfully created
+ *         from the byte array. On failure, a non-zero error code is returned, indicating an issue
+ *         with the input parameters or an internal error in the key creation process. If the function
+ *         fails, the value pointed to by `private_key` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * const byte_t raw_private_key[] = { ... }; // Byte array with the binary representation of the private key seed
+ * size_t key_length = sizeof(raw_private_key);
+ * cardano_ed25519_private_key_t* ed25519_key = NULL;
+ *
+ * cardano_error_t error = cardano_ed25519_private_key_from_normal_bytes(raw_private_key, key_length, &ed25519_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `ed25519_key` is now ready for cryptographic operations, such as signing messages.
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_private_key_unref(&ed25519_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_private_key_from_normal_bytes(
+  const byte_t*                   key_bytes,
+  size_t                          key_length,
+  cardano_ed25519_private_key_t** private_key);
+
+/**
+ * \brief Creates an extended Ed25519 private key object from a raw byte array of an extended key.
+ *
+ * This function constructs an extended Ed25519 private key from a provided array of bytes,
+ * allowing the construction of a private key that includes both the private scalar and additional
+ * information used for signing.
+ *
+ * \param[in] hex A pointer to the byte array containing the binary representation of the extended
+ *            Ed25519 private key. The array should include both the 32-byte private scalar
+ *            and the 32-byte chain code or initialization vector, totaling 64 bytes.
+ * \param[in] key_length The length of the byte array pointed to by `hex`. For an extended Ed25519
+ *            private key, this should be 64 bytes to include both components of the extended key.
+ * \param[out] private_key A pointer to a pointer that will be updated to point to the newly created
+ *            `cardano_ed25519_private_key_t` object. The caller is responsible for managing
+ *            the lifecycle of this object, including its deallocation, to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the private key was successfully created
+ *         from the byte array. On failure, a non-zero error code is returned, indicating an issue
+ *         with the input parameters or an internal error in the key creation process. If the function
+ *         fails, the value pointed to by `private_key` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * const byte_t raw_extended_key[] = { ... }; // Byte array with the binary representation of the extended private key
+ * size_t key_length = sizeof(raw_extended_key);
+ * cardano_ed25519_private_key_t* ed25519_key = NULL;
+ *
+ * cardano_error_t error = cardano_ed25519_private_key_from_extended_bytes(raw_extended_key, key_length, &ed25519_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `ed25519_key` is now ready for cryptographic operations, including advanced signing mechanisms.
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_private_key_unref(&ed25519_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_private_key_from_extended_bytes(
+  const byte_t*                   hex,
+  size_t                          key_length,
+  cardano_ed25519_private_key_t** private_key);
+
+/**
+ * \brief Generates an Ed25519 private key from a hexadecimal string.
+ *
+ * This function converts a hexadecimal string into a binary format and then creates an Ed25519
+ * private key from the resultant bytes.
+ *
+ * \param[in] hex A pointer to the null-terminated hexadecimal string representing the seed bytes
+ *            for the private key. The string should only contain valid hexadecimal characters.
+ * \param[in] hex_length The length of the hexadecimal string, not including the null terminator.
+ *            This length should be exactly twice the size of the expected binary key (64 characters
+ *            for a 32-byte key).
+ * \param[out] key A pointer to a pointer that will be updated to point to the newly created
+ *            `cardano_ed25519_private_key_t` object. The caller is responsible for managing
+ *            the lifecycle of this object.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the private key was successfully created
+ *         from the hexadecimal string. On failure, returns a non-zero error code indicating
+ *         issues such as an invalid hexadecimal string format, incorrect length, or internal
+ *         errors in processing the hexadecimal data. If the function fails, the value pointed
+ *         to by `key` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * const char* hex_seed = "4fe5b2...";
+ * size_t hex_length = strlen(hex_seed);
+ * cardano_ed25519_private_key_t* private_key = NULL;
+ *
+ * cardano_error_t error = cardano_ed25519_private_key_from_normal_hex(hex_seed, hex_length, &private_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `private_key` is now ready for cryptographic operations, such as signing.
+ * }
+ * else
+ * {
+ *   // Handle error: invalid input, memory allocation failure, etc.
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_private_key_unref(&private_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_private_key_from_normal_hex(
+  const char*                     hex,
+  size_t                          hex_length,
+  cardano_ed25519_private_key_t** key);
+
+/**
+ * \brief Generates an extended Ed25519 private key from a hexadecimal string.
+ *
+ * This function creates an extended Ed25519 private key from a provided hexadecimal string,
+ * which should represent the full 64 bytes of the extended private key.
+ *
+ * \param[in] hex A pointer to the null-terminated hexadecimal string representing the bytes
+ *            of the extended Ed25519 private key. This string should include both parts
+ *            of the extended key, resulting in a hexadecimal string of 128 characters.
+ * \param[in] hex_length The length of the hexadecimal string, not including the null terminator.
+ *            For an extended Ed25519 private key, this length should be exactly 128 characters
+ *            to correctly represent the 64 bytes of key data.
+ * \param[out] key A pointer to a pointer that will be updated to point to the newly created
+ *            `cardano_ed25519_private_key_t` object. The caller is responsible for the lifecycle
+ *            management of this object, including its secure deallocation, to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the private key is successfully created
+ *         from the hexadecimal string. On failure, returns a non-zero error code indicating
+ *         an issue with the input parameters, such as an incorrect length or invalid hexadecimal data.
+ *         If the function fails, the value pointed to by `key` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * const char* hex = "4a2e...fe3b"; // 128-character hexadecimal string representing the extended private key
+ * cardano_ed25519_private_key_t* private_key = NULL;
+ *
+ * cardano_error_t error = cardano_ed25519_private_key_from_extended_hex(hex, strlen(hex), &private_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `private_key` is now initialized and can be used for cryptographic operations.
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_private_key_unref(&private_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_private_key_from_extended_hex(
+  const char*                     hex,
+  size_t                          hex_length,
+  cardano_ed25519_private_key_t** key);
+
+/**
+ * \brief Decrements the reference count of a Ed25519 private key object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_ed25519_private_key_t object
+ * by decreasing its reference count. When the reference count reaches zero, the Ed25519 private key is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] private_key A pointer to the pointer of the Ed25519 private key object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ed25519_private_key_t* key = cardano_ed25519_private_key_new();
+ *
+ * // Perform operations with the key...
+ *
+ * cardano_ed25519_private_key_unref(&key);
+ * // At this point, key is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_ed25519_private_key_unref, the pointer to the \ref cardano_ed25519_private_key_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_ed25519_private_key_unref(cardano_ed25519_private_key_t** private_key);
+
+/**
+ * \brief Increases the reference count of the cardano_ed25519_private_key_t object.
+ *
+ * This function is used to manually increment the reference count of a Ed25519 private key
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_ed25519_private_key_unref.
+ *
+ * \param[in,out] private_key A pointer to the Ed25519 private key object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming key is a previously created Ed25519 private key object
+ *
+ * cardano_ed25519_private_key_ref(key);
+ *
+ * // Now key can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_ed25519_private_key_ref there is a corresponding
+ * call to \ref cardano_ed25519_private_key_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_ed25519_private_key_ref(cardano_ed25519_private_key_t* private_key);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_ed25519_private_key_t object.
+ *
+ * This function returns the number of active references to a Ed25519 private key object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_ed25519_private_key_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param[in] private_key A pointer to the Ed25519 private key object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified Ed25519 private key object. If the object
+ * is properly managed (i.e., every \ref cardano_ed25519_private_key_ref call is matched with a
+ * \ref cardano_ed25519_private_key_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming key is a previously created Ed25519 private key object
+ *
+ * size_t ref_count = cardano_ed25519_private_key_refcount(key);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ed25519_private_key_refcount(const cardano_ed25519_private_key_t* private_key);
+
+/**
+ * \brief Signs a message using an Ed25519 private key.
+ *
+ * This function creates a digital signature for a specified message using the provided
+ * Ed25519 private key. Digital signatures are used to verify the authenticity and integrity
+ * of messages, ensuring that the message has not been altered in transit and was signed by
+ * the holder of the corresponding private key.
+ *
+ * \param[in] private_key A pointer to the `cardano_ed25519_private_key_t` object representing
+ *                    the Ed25519 private key used for signing the message.
+ * \param[in] message A pointer to the byte array containing the message data to be signed.
+ * \param[in] message_length The length of the message in bytes.
+ * \param[out] signature A pointer to a pointer that will be updated to point to the newly created
+ *                  `cardano_ed25519_signature_t` object containing the signature of the message.
+ *                  The caller is responsible for managing the lifecycle of this object, including
+ *                  its deallocation, to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the signature was successfully created.
+ *         On failure, a non-zero error code is returned, indicating an issue with the input
+ *         parameters or an internal error during the signing process. If the function fails,
+ *         the value pointed to by `signature` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * cardano_ed25519_private_key_t* private_key = ...; // Assume private_key is initialized
+ * byte_t message[] = "Message to sign";
+ * size_t message_length = sizeof(message) - 1; // Exclude null terminator for raw data signing
+ * cardano_ed25519_signature_t* signature = NULL;
+ *
+ * cardano_error_t error = cardano_ed25519_private_key_sign(private_key, message, message_length, &signature);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `signature` can now be used for verification or other cryptographic operations
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_signature_unref(&signature);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_private_key_sign(const cardano_ed25519_private_key_t* private_key, const byte_t* message, size_t message_length, cardano_ed25519_signature_t** signature);
+
+/**
+ * \brief Extracts the public key from a Ed25519 private key.
+ *
+ * This function derives the corresponding public key from a given Ed25519 private key.
+ * The derived public key is essential for various operations within the Cardano ecosystem,
+ * such as generating wallet addresses or verifying signatures, where the private key itself
+ * must remain secret. The public key is derived without compromising the private key.
+ *
+ * \param[in] private_key A pointer to the `cardano_ed25519_private_key_t` object from which
+ *                    the public key is to be derived. This private key must have been
+ *                    properly initialized and represent a valid Ed25519 private key.
+ * \param[out] ed25519_public_key A pointer to a pointer to `cardano_ed25519_public_key_t` that will
+ *                           be updated to point to the newly created public key object. It is
+ *                           the caller's responsibility to manage the lifecycle of this object,
+ *                           including its deallocation, to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the public key was successfully derived
+ *         from the private key. On failure, a non-zero error code is returned, indicating
+ *         an issue with the input private key or an internal error in the public key derivation
+ *         process. If the function fails, the value pointed to by `ed25519_public_key` is set
+ *         to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * cardano_ed25519_private_key_t* ed25519_private_key = ...; // Previously initialized Ed25519 private key
+ * cardano_ed25519_public_key_t* ed25519_public_key = NULL;
+ *
+ * cardano_error_t error = cardano_ed25519_private_key_get_public_key(ed25519_private_key, &ed25519_public_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `ed25519_public_key` can now be used for address generation, transaction verification, etc.
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_public_key_unref(&ed25519_public_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_private_key_get_public_key(const cardano_ed25519_private_key_t* private_key, cardano_ed25519_public_key_t** ed25519_public_key);
+
+/**
+ * \brief Retrieves the size in bytes of a Ed25519 private key.
+ *
+ * This function calculates and returns the size of the given Ed25519 private key object
+ * when represented as a byte array.
+ *
+ * \param[in] private_key A pointer to the `cardano_ed25519_private_key_t` object whose byte size
+ *                   is to be determined.
+ *
+ * \return The size of the Ed25519 private key in bytes. If the provided `private_key` is invalid
+ *         or NULL, the function will return 0.
+ *
+ * Example Usage:
+ * \code
+ * cardano_ed25519_private_key_t* ed25519_private_key = ...; // Previously created or loaded Ed25519 private key
+ * size_t key_size = cardano_ed25519_private_key_get_bytes_size(ed25519_private_key);
+ *
+ * // Use key_size to allocate memory for the key's byte representation
+ * byte_t* key_bytes = (byte_t*)malloc(key_size);
+ * // Ensure to check for malloc failure and handle `key_bytes` appropriately
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ed25519_private_key_get_bytes_size(const cardano_ed25519_private_key_t* private_key);
+
+/**
+ * \brief Retrieves a direct pointer to the internal data of a Ed25519 private key object.
+ *
+ * This function provides access to the internal storage of the Ed25519 private key object, allowing for read-only operations on its contents.
+ * It is intended for situations where direct access to the data is necessary for performance or interoperability reasons.
+ *
+ * \warning The returned pointer provides raw, direct access to the Ed25519 private key object's internal data. It must not be used to modify
+ * the buffer contents outside the API's control, nor should it be deallocated using free or similar memory management functions.
+ * The lifecycle of the data pointed to by the returned pointer is managed by the Ed25519 private key object's reference counting mechanism; therefore,
+ * the data remains valid as long as the Ed25519 private key object exists and has not been deallocated.
+ *
+ * \param[in] ed25519_private_key The Ed25519 private key instance from which to retrieve the internal data pointer. The Ed25519 private key must have been previously
+ * created and not yet deallocated.
+ *
+ * \return Returns a pointer to the internal data of the Ed25519 private key. If the Ed25519 private key instance is invalid,
+ * returns NULL. The returned pointer provides direct access to the Ed25519 private key's contents and must be used in accordance with the
+ * warning above to avoid unintended consequences.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_ed25519_private_key_get_data(const cardano_ed25519_private_key_t* ed25519_private_key);
+
+/**
+ * \brief Serializes a Ed25519 private key into a provided byte array.
+ *
+ * Converts the given Ed25519 private key object into its byte representation and stores it
+ * in the provided buffer.
+ *
+ * \param[in] private_key A pointer to the `cardano_ed25519_private_key_t` object representing the
+ *                        Ed25519 private key to be serialized.
+ * \param[out] out_key_bytes A pointer to the buffer where the byte representation of the private key will
+ *                           be stored. The buffer must be pre-allocated by the caller and have a size
+ *                           sufficient to hold the entire serialized private key.
+ * \param[in] out_key_length The size of the buffer pointed to by `key`, indicating the maximum
+ *                           number of bytes that can be written into the buffer. To ensure
+ *                           successful serialization, this size should be at least as large as
+ *                           the size returned by `cardano_ed25519_private_key_get_bytes_size` for
+ *                           the given `private_key`.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the private key was successfully
+ *         serialized into the byte array. If the function fails, it returns a non-zero
+ *         error code. Possible failure reasons include invalid input parameters (such as
+ *         a NULL `private_key`), a `key` buffer that is too small (`key_length` insufficient),
+ *         or other internal errors encountered during the serialization process.
+ *
+ * Example Usage:
+ * \code
+ * // Assuming 'ed25519_private_key' is a previously initialized Ed25519 private key
+ * const size_t required_size = cardano_ed25519_private_key_get_bytes_size(ed25519_private_key);
+ * byte_t* buffer = malloc(required_size);
+ *
+ * if (buffer != NULL)
+ * {
+ *   cardano_error_t result = cardano_ed25519_private_key_to_bytes(ed25519_private_key, buffer, required_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // The buffer now contains the serialized private key
+ *   }
+ *
+ *   free(buffer);
+ * }
+ * else
+ * {
+ *   // Handle memory allocation failure
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_private_key_to_bytes(
+  const cardano_ed25519_private_key_t* private_key,
+  byte_t*                              out_key_bytes,
+  size_t                               out_key_length);
+
+/**
+ * \brief Determines the required buffer size for the hexadecimal representation of a Ed25519 private key.
+ *
+ * This function calculates the length of the string that would be required to store the
+ * hexadecimal representation of a given Ed25519 private key, including the null-terminator.
+ *
+ * \param[in] private_key A pointer to the `cardano_ed25519_private_key_t` object whose hexadecimal
+ *                   size is being queried.
+ *
+ * \return The size of the buffer (in bytes) needed to store the hexadecimal string representation
+ *         of the Ed25519 private key, including space for the null-terminator. If the provided
+ *         `private_key` is invalid or NULL, the function will return 0.
+ *
+ * Example Usage:
+ * \code
+ * // Assuming 'ed25519_private_key' is a previously initialized Ed25519 private key
+ * size_t hex_size = cardano_ed25519_private_key_get_hex_size(ed25519_private_key);
+ *
+ *  char* hex_buffer = (char*)malloc(hex_size);
+ *
+ *  if (hex_buffer != NULL)
+ *  {
+ *    // Buffer is ready for use with cardano_ed25519_private_key_to_hex
+ *  }
+ *
+ *  // Remember to free the allocated buffer
+ *  free(hex_buffer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ed25519_private_key_get_hex_size(const cardano_ed25519_private_key_t* private_key);
+
+/**
+ * \brief Serializes a Ed25519 private key into its hexadecimal string representation.
+ *
+ * Converts the given Ed25519 private key object into a hexadecimal string and stores it
+ * in the provided buffer. The caller is responsible for ensuring that the buffer is sufficiently
+ * large to hold the entire  hexadecimal string, including the null terminator. The required size
+ * can be determined by calling \ref cardano_ed25519_private_key_get_hex_size.
+ *
+ * \param[in] private_key A pointer to the `cardano_ed25519_private_key_t` object representing the
+ *                   Ed25519 private key to be converted to hexadecimal format.
+ * \param[out] hex_key A pointer to the buffer where the hexadecimal string representation of the
+ *                private key will be stored. The buffer must be pre-allocated and should be
+ *                large enough to hold the hexadecimal string plus a null terminator.
+ * \param[in] key_length The length of the buffer pointed to by `hex_key`, indicating the maximum
+ *                   number of characters (bytes) that can be written into the buffer,
+ *                   including space for the null terminator.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the private key was successfully
+ *         serialized into the hexadecimal format and stored in the provided buffer.
+ *         If the function fails, it returns a non-zero error code. Failure can occur
+ *         for several reasons, including but not limited to an invalid `private_key`,
+ *         an insufficiently sized buffer (`key_length` too small), or other internal errors
+ *         encountered during the serialization process.
+ *
+ * Example Usage:
+ * \code
+ * cardano_ed25519_private_key_t* ed25519_private_key = ...; // Previously initialized Ed25519 private key
+ * size_t hex_size = cardano_ed25519_private_key_get_hex_size(ed25519_private_key);
+ * char* hex_buffer = (char*)malloc(hex_size);
+ *
+ * char* hex_buffer = (char*)malloc(hex_size);
+ *
+ * if (cardano_blake2b_hash_to_hex(ed25519_private_key, hex_buffer, hex_size) == CARDANO_SUCCESS)
+ * {
+ *  // hex_buffer now contains the hexadecimal representation of the key
+ * }
+ *
+ * free(hex_buffer); // Always ensure to free allocated memory
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_private_key_to_hex(
+  const cardano_ed25519_private_key_t* private_key,
+  char*                                hex_key,
+  size_t                               key_length);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_ed25519_private_key_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_ed25519_private_key_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_ed25519_private_key_deep_clone(const cardano_ed25519_private_key_t* source, cardano_ed25519_private_key_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ED25519_PRIVATE_KEY_H
diff --git a/vendor/include/cardano/crypto/ed25519_public_key.h b/vendor/include/cardano/crypto/ed25519_public_key.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/crypto/ed25519_public_key.h
@@ -0,0 +1,495 @@
+/**
+ * \file ed25519_public_key.h
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ED25519_PUBLIC_KEY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ED25519_PUBLIC_KEY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/ed25519_signature.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents an Ed25519 public key within the Cardano ecosystem.
+ *
+ * The structure provides an abstraction over the raw public key data. It is used in
+ * conjunction with corresponding private keys (`cardano_ed25519_private_key_t`) for
+ * digital signing and verification.
+ */
+typedef struct cardano_ed25519_public_key_t cardano_ed25519_public_key_t;
+
+/**
+ * \brief Creates a Ed25519 public key object from a raw byte array.
+ *
+ * This function takes an array of bytes representing a Ed25519 public key and constructs
+ * a new `cardano_ed25519_public_key_t` object.
+ *
+ * \param[in] key_bytes A pointer to the byte array containing the binary representation of the Ed25519 public key.
+ * \param[in] key_length The length of the byte array pointed to by `key`.
+ * \param[out] key A pointer to a pointer that will be set to point to the newly created `cardano_Ed25519_public_key_t` object.
+ *            The caller is responsible for freeing this object using the appropriate API function to prevent memory leaks.
+ *
+ * \return A `cardano_error_t` indicating the result of the operation. On success, the function
+ *         returns `CARDANO_SUCCESS`, and the `key` parameter is updated to point to the newly created
+ *         public key object. On failure, a non-zero error code is returned, and the value pointed to by
+ *         `key` is set to `NULL`, indicating that the public key object was not successfully created.
+ *
+ * Example Usage:
+ * \code
+ * const byte_t raw_key[] = { ... }; // Byte array containing the Ed25519 public key
+ * size_t raw_key_length = sizeof(raw_key);
+ * cardano_ed25519_public_key_t* ed25519_key = NULL;
+ *
+ * cardano_error_t result = cardano_ed25519_public_key_from_bytes(raw_key, raw_key_length, &ed25519_key);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The `ed25519_key` can now be used for operations like address generation
+ * }
+ *
+ * // Remember to free the ed25519 public key object when done
+ * cardano_ed25519_public_key_unref(&ed25519_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_public_key_from_bytes(
+  const byte_t*                  key_bytes,
+  size_t                         key_length,
+  cardano_ed25519_public_key_t** key);
+
+/**
+ * \brief Creates a Ed25519 public key object from a hexadecimal string.
+ *
+ * This function parses a hexadecimal string representing a Ed25519 public key and constructs
+ * a `cardano_ed25519_public_key_t` object from it.
+ *
+ * \param[in] hex A pointer to the null-terminated string containing the hexadecimal representation
+ *            of the Ed25519 public key.
+ * \param[in] hex_length The length of the hexadecimal string, excluding the null terminator.
+ * \param[out] key A pointer to a pointer to `cardano_ed25519_public_key_t` where the address of
+ *            the newly created public key object will be stored. It is the caller's responsibility
+ *            to manage the lifecycle of the created object, including its deallocation through
+ *            the appropriate API function to prevent memory leaks.
+ *
+ * \return A `cardano_error_t` indicating the result of the operation. On success, the function
+ *         returns `CARDANO_SUCCESS`, and the `key` parameter is updated to point to the newly created
+ *         public key object. On failure, a non-zero error code is returned, and the value pointed to by
+ *         `key` is set to `NULL`, indicating that the public key object was not successfully created.
+ *
+ * Example Usage:
+ * \code
+ * const char* hex_key = "a1b2c3d4..."; // Hexadecimal string of the public key
+ * size_t hex_key_len = strlen(hex_key);
+ * cardano_ed25519_public_key_t* public_key = NULL;
+ *
+ * cardano_error_t error = cardano_ed25519_public_key_from_hex(hex_key, hex_key_len, &public_key);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `public_key` can now be used for cryptographic operations
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_public_key_unref(&public_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_public_key_from_hex(
+  const char*                    hex,
+  size_t                         hex_length,
+  cardano_ed25519_public_key_t** key);
+
+/**
+ * \brief Decrements the reference count of a Ed25519 public key object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_ed25519_public_key_t object
+ * by decreasing its reference count. When the reference count reaches zero, the Ed25519 public key is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] public_key A pointer to the pointer of the Ed25519 public key object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ed25519_public_key_t* key = cardano_ed25519_public_key_new();
+ *
+ * // Perform operations with the key...
+ *
+ * cardano_ed25519_public_key_unref(&key);
+ * // At this point, key is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_ed25519_public_key_unref, the pointer to the \ref cardano_ed25519_public_key_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_ed25519_public_key_unref(cardano_ed25519_public_key_t** public_key);
+
+/**
+ * \brief Increases the reference count of the cardano_ed25519_public_key_t object.
+ *
+ * This function is used to manually increment the reference count of a Ed25519 public key
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_ed25519_public_key_unref.
+ *
+ * \param[in,out] public_key A pointer to the Ed25519 public key object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming key is a previously created Ed25519 public key object
+ *
+ * cardano_ed25519_public_key_ref(key);
+ *
+ * // Now key can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_ed25519_public_key_ref there is a corresponding
+ * call to \ref cardano_ed25519_public_key_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_ed25519_public_key_ref(cardano_ed25519_public_key_t* public_key);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_ed25519_public_key_t object.
+ *
+ * This function returns the number of active references to a Ed25519 public key object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_ed25519_public_key_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param[in] public_key A pointer to the Ed25519 public key object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified Ed25519 public key object. If the object
+ * is properly managed (i.e., every \ref cardano_ed25519_public_key_ref call is matched with a
+ * \ref cardano_ed25519_public_key_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming key is a previously created Ed25519 public key object
+ *
+ * size_t ref_count = cardano_ed25519_public_key_refcount(key);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ed25519_public_key_refcount(const cardano_ed25519_public_key_t* public_key);
+
+/**
+ * \brief Verifies a signature against a message using an Ed25519 public key.
+ *
+ * This function checks if the given signature is valid for the specified message
+ * using the provided Ed25519 public key.
+ *
+ * \param[in] public_key A pointer to the `cardano_ed25519_public_key_t` object representing
+ *                   the Ed25519 public key to be used for verification.
+ * \param[in] signature A pointer to the `cardano_ed25519_signature_t` object representing
+ *                  the signature to verify.
+ * \param[in] message A pointer to the byte array containing the message data that was
+ *                supposedly signed.
+ * \param[in] message_len The length of the message in bytes.
+ *
+ * \return Returns `true` if the signature is valid and matches the message and public key;
+ *         otherwise, it returns `false`, indicating that the verification failed, which
+ *         could be due to the message being altered, the signature being invalid, or the
+ *         public key not matching the private key used to sign the message.
+ *
+ * Example Usage:
+ * \code
+ * cardano_ed25519_public_key_t* public_key = ...; // Assume public_key is previously initialized
+ * cardano_ed25519_signature_t* signature = ...; // Assume signature is previously initialized
+ * byte_t message[] = "Hello, world!";
+ * size_t message_len = sizeof(message) - 1; // Exclude null terminator
+ *
+ * bool is_verified = cardano_ed25519_public_verify(public_key, signature, message, message_len);
+ *
+ * if (is_verified)
+ * {
+ *   printf("Signature is valid.\n");
+ * }
+ * else
+ * {
+ *   printf("Signature verification failed.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_ed25519_public_verify(
+  const cardano_ed25519_public_key_t* public_key,
+  const cardano_ed25519_signature_t*  signature,
+  const byte_t*                       message,
+  size_t                              message_len);
+
+/**
+ * \brief Retrieves a direct pointer to the internal data of a Ed25519 public key object.
+ *
+ * This function provides access to the internal storage of the Ed25519 public key object, allowing for read-only operations on its contents.
+ * It is intended for situations where direct access to the data is necessary for performance or interoperability reasons.
+ *
+ * \warning The returned pointer provides raw, direct access to the Ed25519 public key object's internal data. It must not be used to modify
+ * the buffer contents outside the API's control, nor should it be deallocated using free or similar memory management functions.
+ * The lifecycle of the data pointed to by the returned pointer is managed by the Ed25519 public key object's reference counting mechanism; therefore,
+ * the data remains valid as long as the Ed25519 public key object exists and has not been deallocated.
+ *
+ * \param[in] ed25519_public_key The Ed25519 public key instance from which to retrieve the internal data pointer. The Ed25519 public key must have been previously
+ * created and not yet deallocated.
+ *
+ * \return Returns a pointer to the internal data of the Ed25519 public key. If the Ed25519 public key instance is invalid,
+ * returns NULL. The returned pointer provides direct access to the Ed25519 public key's contents and must be used in accordance with the
+ * warning above to avoid unintended consequences.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_ed25519_public_key_get_data(const cardano_ed25519_public_key_t* ed25519_public_key);
+
+/**
+ * \brief Retrieves the size in bytes of a Ed25519 public key.
+ *
+ * This function calculates and returns the size of the given Ed25519 public key object
+ * when represented as a byte array.
+ *
+ * \param[in] public_key A pointer to the `cardano_ed25519_public_key_t` object whose byte size
+ *                   is to be determined.
+ *
+ * \return The size of the Ed25519 public key in bytes. If the provided `public_key` is invalid
+ *         or NULL, the function will return 0.
+ *
+ * Example Usage:
+ * \code
+ * cardano_ed25519_public_key_t* ed25519_public_key = ...; // Previously created or loaded Ed25519 public key
+ * size_t key_size = cardano_ed25519_public_key_get_bytes_size(ed25519_public_key);
+ *
+ * // Use key_size to allocate memory for the key's byte representation
+ * byte_t* key_bytes = (byte_t*)malloc(key_size);
+ * // Ensure to check for malloc failure and handle `key_bytes` appropriately
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ed25519_public_key_get_bytes_size(const cardano_ed25519_public_key_t* public_key);
+
+/**
+ * \brief Serializes a Ed25519 public key into a provided byte array.
+ *
+ * Converts the given Ed25519 public key object into its byte representation and stores it
+ * in the provided buffer.
+ *
+ * \param[in] public_key A pointer to the `cardano_ed25519_public_key_t` object representing the
+ *                       Ed25519 public key to be serialized.
+ * \param[out] out_key_bytes A pointer to the buffer where the byte representation of the public key will
+ *                           be stored. The buffer must be pre-allocated by the caller and have a size
+ *                           sufficient to hold the entire serialized public key.
+ * \param[in] out_key_length The size of the buffer pointed to by `key`, indicating the maximum
+ *                   number of bytes that can be written into the buffer. To ensure
+ *                   successful serialization, this size should be at least as large as
+ *                   the size returned by `cardano_ed25519_public_key_get_bytes_size` for
+ *                   the given `public_key`.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the public key was successfully
+ *         serialized into the byte array. If the function fails, it returns a non-zero
+ *         error code. Possible failure reasons include invalid input parameters (such as
+ *         a NULL `public_key`), a `key` buffer that is too small (`key_length` insufficient),
+ *         or other internal errors encountered during the serialization process.
+ *
+ * Example Usage:
+ * \code
+ * // Assuming 'ed25519_public_key' is a previously initialized Ed25519 public key
+ * const size_t required_size = cardano_ed25519_public_key_get_bytes_size(ed25519_public_key);
+ * byte_t* buffer = malloc(required_size);
+ *
+ * if (buffer != NULL)
+ * {
+ *   cardano_error_t result = cardano_ed25519_public_key_to_bytes(ed25519_public_key, buffer, required_size);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // The buffer now contains the serialized public key
+ *   }
+ *
+ *   free(buffer);
+ * }
+ * else
+ * {
+ *   // Handle memory allocation failure
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_public_key_to_bytes(
+  const cardano_ed25519_public_key_t* public_key,
+  byte_t*                             out_key_bytes,
+  size_t                              out_key_length);
+
+/**
+ * \brief Determines the required buffer size for the hexadecimal representation of a Ed25519 public key.
+ *
+ * This function calculates the length of the string that would be required to store the
+ * hexadecimal representation of a given Ed25519 public key, including the null-terminator.
+ *
+ * \param[in] public_key A pointer to the `cardano_ed25519_public_key_t` object whose hexadecimal
+ *                   size is being queried.
+ *
+ * \return The size of the buffer (in bytes) needed to store the hexadecimal string representation
+ *         of the Ed25519 public key, including space for the null-terminator. If the provided
+ *         `public_key` is invalid or NULL, the function will return 0.
+ *
+ * Example Usage:
+ * \code
+ * // Assuming 'ed25519_public_key' is a previously initialized Ed25519 public key
+ * size_t hex_size = cardano_ed25519_public_key_get_hex_size(ed25519_public_key);
+ *
+ *  char* hex_buffer = (char*)malloc(hex_size);
+ *
+ *  if (hex_buffer != NULL)
+ *  {
+ *    // Buffer is ready for use with cardano_ed25519_public_key_to_hex
+ *  }
+ *
+ *  // Remember to free the allocated buffer
+ *  free(hex_buffer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ed25519_public_key_get_hex_size(const cardano_ed25519_public_key_t* public_key);
+
+/**
+ * \brief Serializes a Ed25519 public key into its hexadecimal string representation.
+ *
+ * Converts the given Ed25519 public key object into a hexadecimal string and stores it
+ * in the provided buffer. The caller is responsible for ensuring that the buffer is sufficiently
+ * large to hold the entire  hexadecimal string, including the null terminator. The required size
+ * can be determined by calling \ref cardano_ed25519_public_key_get_hex_size.
+ *
+ * \param[in] public_key A pointer to the `cardano_ed25519_public_key_t` object representing the
+ *                   Ed25519 public key to be converted to hexadecimal format.
+ * \param[out] hex_key A pointer to the buffer where the hexadecimal string representation of the
+ *                public key will be stored. The buffer must be pre-allocated and should be
+ *                large enough to hold the hexadecimal string plus a null terminator.
+ * \param[in] key_length The length of the buffer pointed to by `hex_key`, indicating the maximum
+ *                   number of characters (bytes) that can be written into the buffer,
+ *                   including space for the null terminator.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the public key was successfully
+ *         serialized into the hexadecimal format and stored in the provided buffer.
+ *         If the function fails, it returns a non-zero error code. Failure can occur
+ *         for several reasons, including but not limited to an invalid `public_key`,
+ *         an insufficiently sized buffer (`key_length` too small), or other internal errors
+ *         encountered during the serialization process.
+ *
+ * Example Usage:
+ * \code
+ * cardano_ed25519_public_key_t* ed25519_public_key = ...; // Previously initialized Ed25519 public key
+ * size_t hex_size = cardano_ed25519_public_key_get_hex_size(ed25519_public_key);
+ * char* hex_buffer = (char*)malloc(hex_size);
+ *
+ * char* hex_buffer = (char*)malloc(hex_size);
+ *
+ * if (cardano_blake2b_hash_to_hex(ed25519_public_key, hex_buffer, hex_size) == CARDANO_SUCCESS)
+ * {
+ *  // hex_buffer now contains the hexadecimal representation of the key
+ * }
+ *
+ * free(hex_buffer); // Always ensure to free allocated memory
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_public_key_to_hex(
+  const cardano_ed25519_public_key_t* public_key,
+  char*                               hex_key,
+  size_t                              key_length);
+
+/**
+ * \brief Converts a Ed25519 public key into an Ed25519 key hash.
+ *
+ * This function takes a Ed25519 public key and computes its hash using the BLAKE2b
+ * hashing algorithm.
+ *
+ * \param[in] public_key A pointer to the `cardano_ed25519_public_key_t` object representing
+ *                   the Ed25519 public key to be hashed.
+ * \param[out] hash A pointer to a pointer that will be set to point to the newly created
+ *             `cardano_blake2b_hash_t` object, containing the hash of the Ed25519
+ *             public key. It is the responsibility of the caller to manage the lifecycle
+ *             of this object, including its deallocation, to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the hash was successfully created
+ *         from the ed25519 public key. On failure, a non-zero error code is returned,
+ *         indicating an issue such as an invalid public key or failure in the hashing
+ *         process. If the function fails, the value pointed to by `hash` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * cardano_ed25519_public_key_t* ed25519_public_key = ...; // Assume the Ed25519 public key is initialized
+ * cardano_blake2b_hash_t* hash = NULL;
+ *
+ * cardano_error_t error = cardano_ed25519_public_key_to_hash(ed25519_public_key, &hash);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The `hash` can now be used for further cryptographic operations
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_key_hash_unref(&hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_public_key_to_hash(
+  const cardano_ed25519_public_key_t* public_key,
+  cardano_blake2b_hash_t**            hash);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_ed25519_public_key_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_ed25519_public_key_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_ed25519_public_key_deep_clone(const cardano_ed25519_public_key_t* source, cardano_ed25519_public_key_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ED25519_PUBLIC_KEY_H
diff --git a/vendor/include/cardano/crypto/ed25519_signature.h b/vendor/include/cardano/crypto/ed25519_signature.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/crypto/ed25519_signature.h
@@ -0,0 +1,380 @@
+/**
+ * \file ed25519_signature.h
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ED25519_SIGNATURE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ED25519_SIGNATURE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents an Ed25519 signature.
+ */
+typedef struct cardano_ed25519_signature_t cardano_ed25519_signature_t;
+
+/**
+ * \brief Creates a Ed25519 signature object from raw byte data.
+ *
+ * This function takes a buffer of signature bytes and constructs a new Ed25519 signature object.
+ *
+ * \param[in] data Pointer to the raw byte data of the signature.
+ * \param[in] data_length The length of the data in bytes.
+ * \param[out] signature A pointer to a pointer to `cardano_ed25519_signature_t` where the address of
+ *             the newly created signature object will be stored. The caller is responsible
+ *             for managing the lifecycle of the created signature object, including its
+ *             proper deallocation through the corresponding unreference function to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ *         On success, the function returns \ref CARDANO_SUCCESS and `signature` is set to point
+ *         to the newly created signature object. On failure, a non-zero error code is
+ *         returned and the value pointed to by `signature` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * byte_t data[] = { ... };
+ * size_t data_length = sizeof(data);
+ * cardano_ed25519_signature_t* signature = NULL;
+ *
+ * cardano_error_t error = cardano_ed25519_signature_from_bytes(data, data_length, &signature);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // Use the signature object for further operations
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_signature_unref(signature);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_signature_from_bytes(
+  const byte_t*                 data,
+  size_t                        data_length,
+  cardano_ed25519_signature_t** signature);
+
+/**
+ * \brief Creates a Ed25519 signature object from hexadecimal string data.
+ *
+ * This function takes a hexadecimal string representing signature data and constructs
+ * a new Ed25519 signature object. The function is designed to parse the hexadecimal
+ * string input and convert it into the corresponding binary representation before
+ * creating the signature object.
+ *
+ * \param[in] hex Pointer to the hexadecimal string to be converted into a signature object.
+ * \param[in] hex_length The length of the hexadecimal string in characters.
+ * \param[out] signature A pointer to a pointer to `cardano_ed25519_signature_t` where the address of
+ *             the newly created signature object will be stored. The caller is responsible
+ *             for managing the lifecycle of the created signature object, including its
+ *             proper deallocation through the corresponding unreference function to prevent memory leaks.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ *         On success, the function returns \ref CARDANO_SUCCESS, and `signature` is set to
+ *         point to the newly created signature object. On failure, a non-zero error code is
+ *         returned, and the value pointed to by `signature` is set to `NULL`.
+ *
+ * Example Usage:
+ * \code
+ * const char* hex_data = "abc123..."; // Hexadecimal representation of the data
+ * size_t hex_length = strlen(hex_data);
+ * cardano_ed25519_signature_t* signature = NULL;
+ *
+ * cardano_error_t error = cardano_ed25519_signature_from_hex(hex_data, hex_length, &signature);
+ *
+ * if (error == CARDANO_SUCCESS)
+ * {
+ *   // The signature object can now be used for further operations
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_signature_unref(signature);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_signature_from_hex(
+  const char*                   hex,
+  size_t                        hex_length,
+  cardano_ed25519_signature_t** signature);
+
+/**
+ * \brief Decrements the reference count of a Ed25519 signature object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_ed25519_signature_t object
+ * by decreasing its reference count. When the reference count reaches zero, the Ed25519 signature is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] signature A pointer to the pointer of the Ed25519 signature object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_error_t result = cardano_ed25519_signature_from_bytes(data, data_length, &signature);
+ *
+ * // Perform operations with the signature...
+ *
+ * cardano_ed25519_signature_unref(&signature);
+ * // At this point, signature is NULL and cannot be used.
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_ed25519_signature_unref(cardano_ed25519_signature_t** signature);
+
+/**
+ * \brief Increases the reference count of the cardano_ed25519_signature_t object.
+ *
+ * This function is used to manually increment the reference count of a Ed25519 signature
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_ed25519_signature_unref.
+ *
+ * \param[in,out] signature A pointer to the Ed25519 signature object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming signature is a previously created Ed25519 signature object
+ *
+ * cardano_ed25519_signature_ref(signature);
+ *
+ * // Now signature can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_ed25519_signature_ref there is a corresponding
+ * call to \ref cardano_ed25519_signature_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_ed25519_signature_ref(cardano_ed25519_signature_t* signature);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_ed25519_signature_t object.
+ *
+ * This function returns the number of active references to a Ed25519 signature object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_ed25519_signature_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param[in,out] signature A pointer to the Ed25519 signature object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified Ed25519 signature object. If the object
+ * is properly managed (i.e., every \ref cardano_ed25519_signature_ref call is matched with a
+ * \ref cardano_ed25519_signature_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming signature is a previously created Ed25519 signature object
+ *
+ * size_t ref_count = cardano_ed25519_signature_refcount(signature);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ed25519_signature_refcount(const cardano_ed25519_signature_t* signature);
+
+/**
+ * \brief Retrieves a direct pointer to the internal data of a Ed25519 signature object.
+ *
+ * This function provides access to the internal storage of the Ed25519 signature object, allowing for read-only operations on its contents.
+ * It is intended for situations where direct access to the data is necessary for performance or interoperability reasons.
+ *
+ * \warning The returned pointer provides raw, direct access to the Ed25519 signature object's internal data. It must not be used to modify
+ * the buffer contents outside the API's control, nor should it be deallocated using free or similar memory management functions.
+ * The lifecycle of the data pointed to by the returned pointer is managed by the Ed25519 signature object's reference counting mechanism; therefore,
+ * the data remains valid as long as the Ed25519 signature object exists and has not been deallocated.
+ *
+ * \param[in] ed25519_signature The Ed25519 signature instance from which to retrieve the internal data pointer. The Ed25519 signature must have been previously
+ * created and not yet deallocated.
+ *
+ * \return Returns a pointer to the internal data of the Ed25519 signature. If the Ed25519 signature instance is invalid,
+ * returns NULL. The returned pointer provides direct access to the Ed25519 signature's contents and must be used in accordance with the
+ * warning above to avoid unintended consequences.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_ed25519_signature_get_data(const cardano_ed25519_signature_t* ed25519_signature);
+
+/**
+ * \brief Retrieves the size of the Ed25519 signature object in bytes.
+ *
+ * \param[in] ed25519_signature A pointer to the `cardano_ed25519_signature_t` object whose size is to be retrieved.
+ *
+ * \return The size of the Ed25519 signature object in bytes. If the provided signature object
+ *         is invalid or NULL, the function will return 0.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ed25519_signature_get_bytes_size(const cardano_ed25519_signature_t* ed25519_signature);
+
+/**
+ * \brief Converts a Ed25519 signature object into a raw byte array representation.
+ *
+ * This function exports the contents of a given Ed25519 signature object into a user-provided
+ * byte array.
+ *
+ * \param[in] ed25519_signature A pointer to the `cardano_ed25519_signature_t` object to be exported.
+ * \param[out] signature A pointer to a byte array where the signature bytes will be stored. This array
+ *             must be pre-allocated by the caller and be large enough to hold the entire
+ *             signature value.
+ * \param[in] signature_length The length of the `signature` array in bytes. This must be equal to or
+ *                             larger than the size of the signature object to avoid buffer overflow.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ *         On success, the function returns \ref CARDANO_SUCCESS and the `signature` array
+ *         contains the byte representation of the signature object. On failure, a non-zero
+ *         error code is returned. Possible failure reasons include invalid input parameters
+ *         or a mismatch between `signature_length` and the actual size of the signature object.
+ *
+ * Example Usage:
+ * \code
+ * cardano_ed25519_signature_t* signature_obj = ...; // Assume signature_obj is previously created and valid
+ * const size_t signature_size = cardano_ed25519_signature_get_bytes_size(signature_obj);
+ * byte_t* signature_bytes = malloc(signature_size); // Allocate enough space for the signature
+ *
+ * if (signature_bytes != NULL)
+ * {
+ *   cardano_error_t error = cardano_ed25519_signature_to_bytes(signature_obj, signature_bytes, signature_size);
+ *
+ *   if (error == CARDANO_SUCCESS)
+ *   {
+ *     // The signature_bytes array now contains the signature object's bytes
+ *   }
+ *
+ *   // Remember to free the allocated memory when done
+ *   free(signature_bytes);
+ * }
+ * \endcode
+ *
+ * Note: It is the caller's responsibility to ensure that the `signature` array is correctly
+ *       allocated and to free any allocated resources when no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_signature_to_bytes(
+  const cardano_ed25519_signature_t* ed25519_signature,
+  byte_t*                            signature,
+  size_t                             signature_length);
+
+/**
+ * \brief Retrieves the size of the hexadecimal representation of a Ed25519 signature object.
+ *
+ * This function calculates the length of the string that would represent the BLAKE2b
+ * signature object in hexadecimal form. This is useful for allocating the correct amount of
+ * memory to store the hexadecimal representation of the signature.
+ *
+ * \param[in] ed25519_signature A pointer to the `cardano_ed25519_signature_t` object whose hexadecimal
+ *                     size is to be retrieved.
+ *
+ * \return The size of the buffer needed to store the hexadecimal representation of the signature
+ *         object, including the terminating null byte. If the provided signature object is invalid
+ *         or NULL, the function will return 0.
+ *
+ * Example Usage:
+ * \code
+ * cardano_ed25519_signature_t* signature_obj = ...; // Assume signature_obj is previously created
+ * size_t hex_size = cardano_ed25519_signature_get_hex_size(signature_obj);
+ * char* hex_buffer = (char*)malloc(hex_size);
+ *
+ * if (cardano_ed25519_signature_to_hex(signature_obj, hex_buffer, hex_size) == CARDANO_SUCCESS)
+ * {
+ *   // hex_buffer now contains the hexadecimal representation of the signature
+ * }
+ *
+ * free(hex_buffer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ed25519_signature_get_hex_size(const cardano_ed25519_signature_t* ed25519_signature);
+
+/**
+ * \brief Converts a Ed25519 signature object into its hexadecimal string representation.
+ *
+ * This function exports the hexadecimal string representation of the provided
+ * Ed25519 signature object into a user-supplied buffer.
+ *
+ * \param[in] ed25519_signature A pointer to the `cardano_ed25519_signature_t` object to be converted.
+ * \param[out] hex_signature A pointer to the buffer where the hexadecimal string representation
+ *                 of the signature will be stored. The buffer must be large enough to hold
+ *                 the hexadecimal representation of the signature, including the terminating
+ *                 null byte.
+ * \param[in] signature_len The size of the buffer pointed to by `hex_signature`. This value should be
+ *                 at least twice the size of the signature object in bytes plus one for the
+ *                 terminating null byte, to accommodate the hexadecimal representation.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ *         On success, the function returns \ref CARDANO_SUCCESS, and the buffer pointed to
+ *         by `hex_signature` is filled with the hexadecimal representation of the signature object.
+ *         On failure, a non-zero error code is returned, which could indicate an invalid
+ *         signature object, insufficient buffer size, or other errors.
+ *
+ * Example Usage:
+ * \code
+ * cardano_ed25519_signature_t* signature_obj = ...; // Assume signature_obj is previously created
+ * size_t hex_size = cardano_ed25519_signature_get_hex_size(signature_obj);
+ * byte_t* hex_buffer = (byte_t*)malloc(hex_size);
+ *
+ * if (cardano_ed25519_signature_to_hex(signature_obj, hex_buffer, hex_size) == CARDANO_SUCCESS)
+ * {
+ *  // hex_buffer now contains the hexadecimal representation of the signature
+ * }
+ *
+ * free(hex_buffer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ed25519_signature_to_hex(
+  const cardano_ed25519_signature_t* ed25519_signature,
+  char*                              hex_signature,
+  size_t                             signature_len);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_ed25519_signature_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_ed25519_signature_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_ed25519_signature_deep_clone(const cardano_ed25519_signature_t* source, cardano_ed25519_signature_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ED25519_SIGNATURE_H
diff --git a/vendor/include/cardano/crypto/emip3.h b/vendor/include/cardano/crypto/emip3.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/crypto/emip3.h
@@ -0,0 +1,190 @@
+/**
+ * \file emip3.h
+ *
+ * \author angel.castillo
+ * \date   Oct 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_EMIP3_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_EMIP3_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Encrypts data using the EMIP-003 standard encryption format with password-based key derivation.
+ *
+ * The `cardano_crypto_emip3_encrypt` function securely encrypts the provided \p data using a passphrase,
+ * following the encryption scheme outlined in [EMIP-003](https://github.com/Emurgo/EmIPs/blob/master/specs/emip-003.md).
+ * This method is particularly suitable for encrypting sensitive data, such as cryptographic keys,
+ * before storing them on disk.
+ *
+ * \section encryption_methodology Encryption Methodology
+ *
+ * 1. **Password-Based Key Derivation (PBKDF2):**
+ *    - Uses HMAC-SHA512 [RFC 6234] as the Pseudo-Random Function (PRF) for the derivation process.
+ *    - A randomly generated 32-byte salt is applied.
+ *    - Iterates 19,162 times (as defined in EMIP-003) to strengthen the key derivation process against brute-force attacks.
+ *    - The derived key size is 32 bytes.
+ *
+ * 2. **ChaCha20Poly1305 Encryption:**
+ *    - Encrypts the data using ChaCha20 [RFC 8439] with the derived key.
+ *    - A randomly-initialized 12-byte nonce is used for the encryption process.
+ *    - Poly1305 ensures authenticity and integrity of the encrypted data, providing AEAD (Authenticated Encryption with Associated Data).
+ *    - An empty AAD (Additional Authenticated Data) is used.
+ *    - The output includes the MAC (Message Authentication Code) for data verification.
+ *
+ * 3. **Output Format:**
+ *    - The resulting encrypted data is concatenated as follows:
+ *      - The 32-byte salt.
+ *      - The 12-byte nonce.
+ *      - The 16-byte MAC.
+ *      - The encrypted data.
+ *
+ * \param[in] data The raw data to be encrypted. Must be non-NULL, including when data_length is zero.
+ * \param[in] data_length The length of the raw data. Lengths exceeding the ChaCha20-Poly1305 IETF limit or overflowing the envelope size are rejected.
+ * \param[in] passphrase The user-provided passphrase used for deriving the encryption key. May be NULL when passphrase_length is zero.
+ * \param[in] passphrase_length The length of the passphrase.
+ * \param[out] encrypted_data A pointer to a buffer where the resulting encrypted byte array will be stored. Set to NULL on failure.
+ *             The caller is responsible for managing this buffer and securely wiping it after use.
+ *
+ * \return `cardano_error_t` An error code indicating success or failure.
+ *
+ * \note The derived key is securely wiped after use. The caller owns the input data and passphrase and must wipe them after use.
+ *
+ * \see [EMIP-003](https://github.com/Emurgo/EmIPs/blob/master/specs/emip-003.md) for full specification details.
+ *
+ * Example:
+ * \code
+ * // Encrypt sensitive data using a passphrase
+ * const byte_t* data = (const byte_t*)"My secret data";
+ * const size_t data_len = strlen((const char*)data);
+ * const byte_t* passphrase = (const byte_t*)"MyStrongPassphrase";
+ * const size_t passphrase_len = strlen((const char*)passphrase);
+ * cardano_buffer_t* encrypted_data = NULL;
+ *
+ * // Encrypt the data
+ * cardano_error_t result = cardano_crypto_emip3_encrypt(data, data_len, passphrase, passphrase_len, &encrypted_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Encryption successful! Encrypted data length: %zu\n", encrypted_data->size);
+ *
+ *   cardano_buffer_unref(encrypted_data);
+ * }
+ * else
+ * {
+ *   printf("Encryption failed!\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_crypto_emip3_encrypt(
+  const byte_t*      data,
+  size_t             data_length,
+  const byte_t*      passphrase,
+  size_t             passphrase_length,
+  cardano_buffer_t** encrypted_data);
+
+/**
+ * \brief Decrypts data that was encrypted using the EMIP-003 standard encryption format.
+ *
+ * The `cardano_crypto_emip3_decrypt` function securely decrypts the provided \p encrypted_data using a passphrase,
+ * following the decryption scheme outlined in [EMIP-003](https://github.com/Emurgo/EmIPs/blob/master/specs/emip-003.md).
+ * This function expects data that was encrypted using the `cardano_crypto_emip3_encrypt` function and will return
+ * the original data in its raw form.
+ *
+ * \section decryption_methodology Decryption Methodology
+ *
+ * 1. **Password-Based Key Derivation (PBKDF2):**
+ *    - The decryption process regenerates the key using PBKDF2, with the same parameters that were used during encryption.
+ *    - HMAC-SHA512 is used as the Pseudo-Random Function (PRF) for key derivation, and the salt is extracted from the
+ *      provided \p encrypted_data.
+ *    - 19,162 iterations are used to produce a 32-byte key.
+ *
+ * 2. **ChaCha20Poly1305 Decryption:**
+ *    - The derived key is used to decrypt the data, which is extracted from the \p encrypted_data.
+ *    - The 12-byte nonce and the 16-byte MAC are also extracted from the encrypted data.
+ *    - ChaCha20Poly1305 is then used to decrypt and authenticate the data, ensuring both confidentiality and integrity.
+ *
+ * 3. **Output Format:**
+ *    - The decrypted data is returned as a buffer, with the size of the original data before encryption.
+ *
+ * \param[in] encrypted_data The encrypted data to be decrypted.
+ * \param[in] encrypted_data_length The length of the encrypted data.
+ * \param[in] passphrase The user-provided passphrase used for deriving the decryption key. May be NULL when passphrase_length is zero.
+ * \param[in] passphrase_length The length of the passphrase.
+ * \param[out] data A pointer to a buffer where the resulting decrypted byte array will be stored. Set to NULL on failure.
+ *             The caller is responsible for managing this buffer and securely wiping it after use.
+ *
+ * \return `cardano_error_t` An error code indicating success or failure.
+ *
+ * \note It is important to securely wipe sensitive data from memory after its use. Before calling `cardano_buffer_unref`
+ * to free the \p data, you must call `cardano_buffer_memzero` to ensure that the sensitive information is properly
+ * erased from memory, reducing the risk of exposing private data.
+ *
+ * \see [EMIP-003](https://github.com/Emurgo/EmIPs/blob/master/specs/emip-003.md) for full specification details.
+ *
+ * Example:
+ * \code
+ *
+ * const byte_t*     encrypted_data     = ...; // Encrypted data from the encryption function
+ * const size_t      encrypted_data_len = ...; // Length of the encrypted data
+ * const byte_t*     passphrase         = (const byte_t*)"MyStrongPassphrase";
+ * const size_t      passphrase_len     = strlen((const char*)passphrase);
+ * cardano_buffer_t* decrypted_data     = NULL;
+ *
+ * // Decrypt the data
+ * cardano_error_t result = cardano_crypto_emip3_decrypt(encrypted_data, encrypted_data_len, passphrase, passphrase_len, &decrypted_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the decrypted data
+ *   ...
+ *   // Securely wipe sensitive data from memory before freeing the buffer
+ *   cardano_buffer_memzero(decrypted_data);
+ *   cardano_buffer_unref(decrypted_data);
+ * }
+ * else
+ * {
+ *   // Handle decryption failure
+ *   printf("Decryption failed!\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_crypto_emip3_decrypt(
+  const byte_t*      encrypted_data,
+  size_t             encrypted_data_length,
+  const byte_t*      passphrase,
+  size_t             passphrase_length,
+  cardano_buffer_t** data);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_EMIP3_H
diff --git a/vendor/include/cardano/crypto/pbkdf2.h b/vendor/include/cardano/crypto/pbkdf2.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/crypto/pbkdf2.h
@@ -0,0 +1,71 @@
+/**
+ * \file pbkdf2.h
+ *
+ * \author angel.castillo
+ * \date   Mar 02, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_PBKDF2_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_PBKDF2_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Performs key derivation using the PBKDF2 algorithm with HMAC-SHA512.
+ *
+ * PBKDF2 (Password-Based Key Derivation Function 2) is a key derivation function that has a sliding computational cost,
+ * aimed to reduce vulnerabilities to brute force attacks. It applies a pseudorandom function, such as HMAC-SHA512,
+ * to the input password along with a salt value and repeats the process multiple times to produce a derived key.
+ * The iterations parameter controls the number of times the pseudorandom function is applied, which increases
+ * the computational cost and the time required to compute the derived key, thereby enhancing security.
+ *
+ * \param[in] password The input password from which the key is derived.
+ * \param[in] password_length The length of the password.
+ * \param[in] salt A cryptographic salt.
+ * \param[in] salt_length The length of the salt.
+ * \param[in] iterations The number of iterations specifies how many times the pseudorandom function is applied and must be positive.
+ * \param[out] derived_key The buffer where the derived key will be stored.
+ * \param[in] derived_key_length The desired length of the derived key, at most 64 * UINT32_MAX bytes.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation: \ref CARDANO_SUCCESS on success,
+ *         or an appropriate error code indicating the failure reason. Refer to \ref cardano_error_t documentation
+ *         for details on possible error codes.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_crypto_pbkdf2_hmac_sha512(
+  const byte_t* password,
+  size_t        password_length,
+  const byte_t* salt,
+  size_t        salt_length,
+  uint32_t      iterations,
+  byte_t*       derived_key,
+  size_t        derived_key_length);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_PBKDF2_H
diff --git a/vendor/include/cardano/encoding/base58.h b/vendor/include/cardano/encoding/base58.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/encoding/base58.h
@@ -0,0 +1,226 @@
+/**
+ * \file base58.h
+ *
+ * \author angel.castillo
+ * \date   Apr 01, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BASE58_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BASE58_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Calculates a buffer capacity for a Base58-encoded string.
+ *
+ * This function computes an upper bound for the encoded string capacity. This is
+ * useful for allocating the correct amount of memory for the encoded string.
+ *
+ * \param[in] data Pointer to the input data to be encoded.
+ * \param[in] data_length Length of the input data in bytes.
+ *
+ * \return An upper bound for the encoded string capacity, including the null terminator; zero for null input or size overflow.
+ *
+ * To calculate the required buffer size for a Base58-encoded string:
+ * \code{.c}
+ * const byte_t* data = ...; // Your data here
+ * size_t data_length = ...; // Length of your data
+ *
+ * // Calculate the length of the encoded Base58 string
+ * size_t encoded_length = cardano_encoding_base58_get_encoded_length(data, data_length);
+ *
+ * // Allocate memory for the encoded string
+ * char* encoded_string = (char*)malloc(encoded_length);
+ *
+ * if (encoded_string != NULL)
+ * {
+ *   // Proceed with encoding...
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_encoding_base58_get_encoded_length(const byte_t* data, size_t data_length);
+
+/**
+ * \brief Encodes data into a Base58-encoded string.
+ *
+ * This function encodes binary data into a Base58-encoded string. The encoded
+ * string includes a null terminator at the end.
+ *
+ * \param[in] data Pointer to the input data to be encoded.
+ * \param[in] data_length Length of the input data in bytes.
+ * \param[out] output Pointer to the output buffer for the encoded string.
+ * \param[in] output_length Length of the output buffer in bytes.
+ *
+ * \return \ref CARDANO_SUCCESS if the encoding was successful, or an appropriate error code otherwise.
+ *
+ * \note The output buffer should be large enough to hold the encoded string and the null terminator.
+ *       Use \c cardano_encoding_base58_get_encoded_length to calculate a sufficient buffer size.
+ *
+ * Example usage:
+ * \code{.c}
+ * // Data to encode
+ * const byte_t data[] = {0x01, 0x02, 0x03, 0x04, 0x05};
+ * size_t data_length = sizeof(data);
+ *
+ * // Calculate required buffer size
+ * size_t encoded_length = cardano_encoding_base58_get_encoded_length(data, data_length);
+ *
+ * // Allocate buffer for encoded string
+ * char* encoded_string = (char*)malloc(encoded_length);
+ *
+ * if (encoded_string == NULL)
+ * {
+ *   // Handle memory allocation error
+ * }
+ *
+ * // Encode data to Base58
+ * cardano_error_t result = cardano_encoding_base58_encode(data, data_length, encoded_string, encoded_length);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Base58 Encoded: %s\n", encoded_string);
+ * }
+ * else
+ * {
+ *   // Handle encoding error
+ * }
+ *
+ * // Free allocated buffer
+ * free(encoded_string);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_encoding_base58_encode(const byte_t* data, size_t data_length, char* output, size_t output_length);
+
+/**
+ * \brief Calculates the length of the data decoded from a Base58 string.
+ *
+ * This function computes the length of the data decoded from a Base58-encoded string. It is useful for allocating
+ * the correct amount of memory for the decoded data. The function accounts for the variable length nature of Base58
+ * encoding and provides the exact length of the decoded binary data
+ *
+ * \param[in] data Pointer to the Base58-encoded string to be decoded.
+ * \param[in] data_length Length of the Base58-encoded string in bytes.
+ *
+ * \return The length of the decoded data in bytes. This length does not include any potential null terminator as the output
+ *         is expected to be binary data. If the input string is invalid or an error occurs during the computation, the function
+ *         returns 0.
+ *
+ * Example usage:
+ * \code{.c}
+ * // Base58-encoded string
+ * const char* encoded_string = "3mJr7AoUCHxNqd";
+ * size_t encoded_length = strlen(encoded_string);
+ *
+ * // Calculate required buffer size for decoded data
+ * size_t decoded_length = cardano_encoding_base58_get_decoded_length(encoded_string, encoded_length);
+ *
+ * // Allocate buffer for decoded data
+ * byte_t* decoded_data = (byte_t*)malloc(decoded_length);
+ *
+ * if (decoded_data == NULL)
+ * {
+ *   // Handle memory allocation error
+ * }
+ *
+ * // Proceed with decoding (assuming a function cardano_encoding_base58_decode exists)
+ * cardano_error_t result = cardano_encoding_base58_decode(encoded_string, encoded_length, decoded_data, decoded_length);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use decoded data
+ * }
+ * else
+ * {
+ *   // Handle decoding error
+ * }
+ *
+ * // Free allocated buffer for decoded data
+ * free(decoded_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_encoding_base58_get_decoded_length(const char* data, size_t data_length);
+
+/**
+ * \brief Decodes a Base58-encoded string into binary data.
+ *
+ * This function decodes a Base58-encoded string, converting it back into its original binary data form.
+ *
+ * \param[in] input Pointer to the Base58-encoded string that needs to be decoded.
+ * \param[in] input_length Length of the Base58-encoded string, in bytes. This should be the exact length of the input string,
+ *                         excluding any null terminator if present.
+ * \param[out] data Pointer to the buffer where the decoded binary data will be stored. It is the caller's responsibility to ensure
+ *                  that the buffer is sufficiently large to hold the decoded data.
+ * \param[in] data_length The size of the buffer pointed to by `data`, in bytes. This should be computed in advance to be large enough
+ *                        to hold the expected decoded binary data.
+ *
+ * \return \ref CARDANO_SUCCESS if the decoding was successful. Otherwise, an appropriate error code is returned indicating the failure reason.
+ *
+ * \note The data buffer should be large enough to hold the decoded binary data. The function `cardano_encoding_base58_get_decoded_length`
+ *       can be used to calculate the required buffer size based on the length of the Base58-encoded string.
+ *
+ * Example usage:
+ * \code{.c}
+ * // Example Base58-encoded string
+ * const char* encoded_string = "3mJr7AoUCHxNqd";
+ * size_t encoded_length = strlen(encoded_string);
+ *
+ * // Calculate required buffer size for decoded data
+ * size_t decoded_length = cardano_encoding_base58_get_decoded_length((const byte_t*)encoded_string, encoded_length);
+ *
+ * // Allocate buffer for decoded data
+ * byte_t* decoded_data = (byte_t*)malloc(decoded_length);
+ * if (!decoded_data)
+ * {
+ *   // Handle memory allocation failure
+ * }
+ *
+ * // Perform the decoding
+ * cardano_error_t result = cardano_encoding_base58_decode(encoded_string, encoded_length, decoded_data, decoded_length);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the decoded data
+ * }
+ * else
+ * {
+ *   // Handle decoding error
+ * }
+ *
+ * // Clean up
+ * free(decoded_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_encoding_base58_decode(const char* input, size_t input_length, byte_t* data, size_t data_length);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BASE58_H
diff --git a/vendor/include/cardano/encoding/bech32.h b/vendor/include/cardano/encoding/bech32.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/encoding/bech32.h
@@ -0,0 +1,239 @@
+/**
+ * \file bech32.h
+ *
+ * \author angel.castillo
+ * \date   Apr 01, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BECH32_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BECH32_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Calculates the length of a Bech32-encoded string.
+ *
+ * This function computes the length of a string after it has been encoded using Bech32 encoding. The length includes the
+ * human-readable part (HRP), the data part, and the separator.
+ *
+ * \param[in] hrp Pointer to the human-readable part (HRP) of the Bech32-encoded data.
+ * \param[in] hrp_length The length of the HRP in bytes.
+ * \param[in] data Pointer to the binary data that will be encoded in the data part of the Bech32 string.
+ * \param[in] data_length The length of the binary data in bytes.
+ *
+ * \return The length of the Bech32-encoded string including the null terminator. This value can be used to allocate
+ *         an appropriately sized buffer for the encoded string.
+ *
+ * Example usage:
+ * \code{.c}
+ * // Define the human-readable part and the data to be encoded
+ * const char* hrp = "addr";
+ * size_t hrp_length = strlen(hrp);
+ * byte_t data[] = {0x01, 0x02, 0x03, 0x04};
+ * size_t data_length = sizeof(data);
+ *
+ * // Calculate the required buffer size for the Bech32-encoded string
+ * size_t encoded_length = cardano_encoding_bech32_get_encoded_length(hrp, hrp_length, data, data_length);
+ *
+ * // Allocate the buffer for the Bech32-encoded string
+ * char* encoded_string = (char*)malloc(encoded_length);
+ * if (!encoded_string)
+ * {
+ *   // Handle memory allocation failure
+ * }
+ *
+ * // Now you can proceed to encode the data into Bech32 using the allocated buffer
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_encoding_bech32_get_encoded_length(
+  const char*   hrp,
+  size_t        hrp_length,
+  const byte_t* data,
+  size_t        data_length);
+
+/**
+ * \brief Encodes data into a Bech32-encoded string.
+ *
+ * This function encodes binary data, along with a human-readable part (HRP), into a Bech32-encoded string.
+ *
+ * \param[in] hrp Pointer to the human-readable part (HRP) that conveys contextual information about the encoded data.
+ * \param[in] hrp_length The length of the HRP in bytes.
+ * \param[in] data Pointer to the binary data to be encoded.
+ * \param[in] data_length The length of the binary data in bytes.
+ * \param[out] output Pointer to the buffer where the Bech32-encoded string will be written. The buffer must be
+ *             large enough to hold the encoded string and the null terminator.
+ * \param[in] output_length The size of the output buffer in bytes.
+ *
+ * \return \ref CARDANO_SUCCESS if the encoding was successful, or an appropriate error code otherwise.
+ *
+ * \note The function requires that the `output` buffer is pre-allocated and its length (`output_length`) is
+ *       sufficient to hold the entire Bech32-encoded string including the null terminator. To determine the
+ *       necessary buffer size in advance, use the `cardano_encoding_bech32_get_encoded_length` function.
+ *
+ * Example usage:
+ * \code{.c}
+ * // Define the human-readable part (HRP) and the data to be encoded
+ * const char* hrp = "bc";
+ * byte_t data[] = {0x01, 0x02, 0x03, 0x04};
+ * size_t data_length = sizeof(data);
+ *
+ * // Calculate the required buffer size for the Bech32-encoded string
+ * size_t encoded_length = cardano_encoding_bech32_get_encoded_length(hrp, strlen(hrp), data, data_length);
+ *
+ * // Allocate the buffer for the Bech32-encoded string
+ * char* encoded_string = (char*)malloc(encoded_length);
+ * if (!encoded_string)
+ * {
+ *   // Handle memory allocation failure
+ * }
+ *
+ * // Encode the data into Bech32
+ * cardano_error_t result = cardano_encoding_bech32_encode(hrp, strlen(hrp), data, data_length, encoded_string, encoded_length);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Bech32 Encoded: %s\n", encoded_string);
+ * }
+ * else
+ * {
+ *   // Handle encoding failure
+ * }
+ *
+ * // Clean up
+ * free(encoded_string);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_encoding_bech32_encode(
+  const char*   hrp,
+  size_t        hrp_length,
+  const byte_t* data,
+  size_t        data_length,
+  char*         output,
+  size_t        output_length);
+
+/**
+ * \brief Calculates the length of the data decoded from a Bech32 string.
+ *
+ * This function computes the length of the data that will be obtained after decoding a Bech32-encoded string.
+ * It also provides the length of the human-readable part (HRP) present in the Bech32 string (including the null terminator).
+ *
+ * \param[in] data Pointer to the Bech32-encoded data from which the lengths are to be calculated.
+ * \param[in] data_length The length of the Bech32-encoded data in bytes.
+ * \param[out] hrp_length Pointer to the size_t variable where the length of the HRP will be stored.
+ *             The value is set to the length of the HRP found in the Bech32-encoded string.
+ *
+ * \return The length of the decoded data in bytes. This does not include the length of the HRP.
+ *
+ * \note The function does not decode the data itself; it merely calculates the length of the decoded data
+ *       and the HRP based on the Bech32-encoded string. To decode the actual data, use the
+ *       `cardano_encoding_bech32_decode` function.
+ *
+ * Example usage:
+ * \code{.c}
+ * // Bech32 encoded string
+ * const char* encoded_str = "addr_1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4";
+ * size_t encoded_str_length = strlen(encoded_str);
+ *
+ * // Calculate the lengths of the decoded data and the HRP
+ * size_t hrp_length = 0;
+ * size_t decoded_data_length = cardano_encoding_bech32_get_decoded_length(encoded_str, encoded_str_length, &hrp_length);
+ *
+ * // Now you can allocate memory for the decoded data and the HRP accordingly
+ * byte_t* decoded_data = (byte_t*)malloc(decoded_data_length);
+ * char* hrp = (char*)malloc(hrp_length);
+ *
+ * if (!decoded_data || !hrp)
+ * {
+ *   // Handle memory allocation failure
+ * }
+ *
+ * // Proceed to decode the Bech32 string
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_encoding_bech32_get_decoded_length(
+  const char* data,
+  size_t      data_length,
+  size_t*     hrp_length);
+
+/**
+ * \brief Decodes a Bech32-encoded string into its original data and human-readable part (HRP).
+ *
+ * This function takes a Bech32-encoded string as input and decodes it back into the original binary data along with
+ * its human-readable part (HRP). The function requires pre-allocated buffers for both the HRP and the decoded data.
+ *
+ * \param[in] input The Bech32-encoded string to be decoded.
+ * \param[in] input_length The length of the Bech32-encoded string.
+ * \param[out] hrp Pre-allocated buffer where the decoded human-readable part (HRP) will be stored.
+ * \param[in] hrp_length The size of the pre-allocated HRP buffer. It must be large enough to store the HRP including the null terminator.
+ * \param[out] data Pre-allocated buffer where the decoded binary data will be stored.
+ * \param[in,out] data_length On input, specifies the size of the pre-allocated data buffer. On output, it is updated to reflect the actual length
+ *                            of the decoded data.
+ *
+ * \return \ref CARDANO_SUCCESS if the decoding is successful, otherwise an error code indicating the failure reason.
+ *
+ * \note The function will modify the `data_length` parameter to indicate the actual length of the decoded data. Ensure that the
+ * buffers for `hrp` and `data` are large enough to store the decoded information. Use `cardano_encoding_bech32_get_decoded_length`
+ * to calculate the required buffer sizes.
+ *
+ * Example usage:
+ * \code{.c}
+ * const char* encoded_str = "addr_1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4";
+ * size_t input_length = strlen(encoded_str);
+ * char hrp[10]; // Assume you know the HRP length or have calculated it
+ * byte_t data[32]; // Pre-allocated buffer for decoded data
+ * size_t data_length = sizeof(data);
+ *
+ * cardano_error_t result = cardano_encoding_bech32_decode(encoded_str, input_length, hrp, sizeof(hrp), data, &data_length);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Decoded successfully
+ *   printf("HRP: %s\n", hrp);
+ *   // Use the decoded data as needed
+ * }
+ * else
+ * {
+ *   // Handle decoding error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_encoding_bech32_decode(
+  const char* input,
+  size_t      input_length,
+  char*       hrp,
+  size_t      hrp_length,
+  byte_t*     data,
+  size_t      data_length);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BECH32_H
diff --git a/vendor/include/cardano/error.h b/vendor/include/cardano/error.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/error.h
@@ -0,0 +1,401 @@
+/**
+ * \file error.h
+ *
+ * \author angel.castillo
+ * \date   Sep 09, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ERROR_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ERROR_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Cardano C library error codes.
+ */
+typedef enum
+{
+  /**
+   * \brief Successful operation.
+   */
+  CARDANO_SUCCESS = 0,
+
+  /**
+   * \brief Generic error.
+   */
+  CARDANO_ERROR_GENERIC = 1,
+
+  /**
+   * \brief Insufficient buffer size.
+   */
+  CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE = 2,
+
+  /**
+   * \brief Operation over a null pointer.
+   */
+  CARDANO_ERROR_POINTER_IS_NULL = 3,
+
+  /**
+   * \brief Memory could not be allocated.
+   */
+  CARDANO_ERROR_MEMORY_ALLOCATION_FAILED = 4,
+
+  /**
+   * \brief Out of bounds memory read.
+   */
+  CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ = 5,
+
+  /**
+   * \brief Out of bounds memory write.
+   */
+  CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_WRITE = 6,
+
+  /**
+   * \brief Invalid argument.
+   */
+  CARDANO_ERROR_INVALID_ARGUMENT = 7,
+
+  /**
+   * \brief Invalid URL.
+   */
+  CARDANO_ERROR_INVALID_URL = 8,
+
+  /**
+   * \brief Element not found.
+   */
+  CARDANO_ERROR_ELEMENT_NOT_FOUND = 9,
+
+  /**
+   * \brief Encoding failure.
+   */
+  CARDANO_ERROR_ENCODING = 10,
+
+  /**
+   * \brief Decoding failure.
+   */
+  CARDANO_ERROR_DECODING = 11,
+
+  /**
+   * \brief Invalid checksum.
+   */
+  CARDANO_ERROR_CHECKSUM_MISMATCH = 12,
+
+  /**
+   * \brief Invalid JSON.
+   */
+  CARDANO_ERROR_INVALID_JSON = 13,
+
+  /**
+   * \brief Size overflow.
+   */
+  CARDANO_ERROR_INTEGER_OVERFLOW = 14,
+
+  /**
+   * \brief Size underflow.
+   */
+  CARDANO_ERROR_INTEGER_UNDERFLOW = 15,
+
+  /**
+   * \brief Conversion error.
+   */
+  CARDANO_ERROR_CONVERSION_FAILED = 16,
+
+  /**
+   * \brief Index out of bounds.
+   */
+  CARDANO_ERROR_INDEX_OUT_OF_BOUNDS = 17,
+
+  /**
+   * \brief Invalid certificate type.
+   */
+  CARDANO_ERROR_INVALID_CERTIFICATE_TYPE = 18,
+
+  /**
+   * \brief The operation is not implemented.
+   */
+  CARDANO_ERROR_NOT_IMPLEMENTED = 19,
+
+  /**
+   * \brief The passphrase is invalid.
+   */
+  CARDANO_ERROR_INVALID_PASSPHRASE = 20,
+
+  /**
+   * \brief The state of the object is illegal.
+   */
+  CARDANO_ERROR_ILLEGAL_STATE = 21,
+
+  /**
+   * \brief The element is already present.
+   */
+  CARDANO_ERROR_DUPLICATED_KEY = 22,
+
+  /**
+   * \brief The JSON type is unexpected.
+   */
+  CARDANO_ERROR_JSON_TYPE_MISMATCH = 23,
+
+  /* Serialization errors */
+
+  /**
+   * \brief The serialization or deserialization process resulted in a loss of precision.
+   */
+  CARDANO_ERROR_LOSS_OF_PRECISION = 100,
+
+  /**
+   * \brief The magic number is invalid.
+   */
+  CARDANO_ERROR_INVALID_MAGIC = 101,
+
+  /**
+   * \brief The checksum is invalid.
+   */
+  CARDANO_ERROR_INVALID_CHECKSUM = 102,
+
+  /* Crypto errors */
+
+  /**
+   * \brief The hash size is invalid.
+   */
+  CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE = 200,
+
+  /**
+   * \brief The Ed25519 signature size is invalid.
+   */
+  CARDANO_ERROR_INVALID_ED25519_SIGNATURE_SIZE = 201,
+
+  /**
+   * \brief The Ed25519 public key size is invalid.
+   */
+  CARDANO_ERROR_INVALID_ED25519_PUBLIC_KEY_SIZE = 202,
+
+  /**
+   * \brief The Ed25519 private key size is invalid.
+   */
+  CARDANO_ERROR_INVALID_ED25519_PRIVATE_KEY_SIZE = 203,
+
+  /**
+   * \brief The BIP32 public key size is invalid.
+   */
+  CARDANO_ERROR_INVALID_BIP32_PUBLIC_KEY_SIZE = 204,
+
+  /**
+   * \brief The BIP32 private key size is invalid.
+   */
+  CARDANO_ERROR_INVALID_BIP32_PRIVATE_KEY_SIZE = 205,
+
+  /**
+   * \brief The BIP32 derivation index is invalid.
+   */
+  CARDANO_ERROR_INVALID_BIP32_DERIVATION_INDEX = 206,
+
+  /* CBOR errors */
+
+  /**
+   * \brief The CBOR type is unexpected.
+   */
+  CARDANO_ERROR_UNEXPECTED_CBOR_TYPE = 300,
+
+  /**
+   * \brief The CBOR value is of the right type, but the value is invalid (I.E out of range).
+   */
+  CARDANO_ERROR_INVALID_CBOR_VALUE = 301,
+
+  /**
+   * \brief The CBOR array size is invalid.
+   */
+  CARDANO_ERROR_INVALID_CBOR_ARRAY_SIZE = 302,
+
+  /**
+   * \brief The CBOR map size is invalid.
+   */
+  CARDANO_ERROR_INVALID_CBOR_MAP_SIZE = 303,
+
+  /**
+   * \brief The CBOR map key is duplicated.
+   */
+  CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY = 304,
+
+  /**
+   * \brief The CBOR map key is invalid.
+   */
+  CARDANO_ERROR_INVALID_CBOR_MAP_KEY = 305,
+
+  // Address errors
+
+  /**
+   * \brief The address type is invalid.
+   */
+  CARDANO_ERROR_INVALID_ADDRESS_TYPE = 400,
+
+  /**
+   * \brief The address format is invalid.
+   */
+  CARDANO_ERROR_INVALID_ADDRESS_FORMAT = 401,
+
+  // Credential errors
+
+  /**
+   * \brief The credential type is invalid.
+   */
+  CARDANO_ERROR_INVALID_CREDENTIAL_TYPE = 500,
+
+  // Plutus errors
+
+  /**
+   * \brief The Plutus data conversion is invalid.
+   */
+  CARDANO_ERROR_INVALID_PLUTUS_DATA_CONVERSION = 600,
+
+  /**
+   * \brief The Plutus datum type is invalid.
+   */
+  CARDANO_ERROR_INVALID_DATUM_TYPE = 601,
+
+  // Script errors
+
+  /**
+   * \brief The script language is invalid.
+   */
+  CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE = 700,
+
+  /**
+   * \brief The native script type is invalid.
+   */
+  CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE = 701,
+
+  /**
+   * \brief The Plutus cost model is invalid.
+   */
+  CARDANO_ERROR_INVALID_PLUTUS_COST_MODEL = 702,
+
+  // Proposal procedure errors
+
+  /**
+   * \brief The governance action type is invalid.
+   */
+  CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE = 800,
+
+  // Auxiliary data errors
+
+  /**
+   * \brief The metadatum conversion is invalid.
+   */
+  CARDANO_ERROR_INVALID_METADATUM_CONVERSION = 900,
+
+  /**
+   * \brief The metadatum text string size.
+   */
+  CARDANO_ERROR_INVALID_METADATUM_TEXT_STRING_SIZE = 901,
+
+  /**
+   * \brief The metadatum bounded bytes size.
+   */
+  CARDANO_ERROR_INVALID_METADATUM_BOUNDED_BYTES_SIZE = 902,
+
+  // HTTP
+
+  /**
+   * \brief The HTTP request is invalid.
+   */
+  CARDANO_ERROR_INVALID_HTTP_REQUEST = 1000,
+
+  // Coin Selection
+
+  /**
+   * \brief Total value of the entries within the initial UTxO set (the amount of money available)
+   * is less than the the total value of all entries in the requested output set (the amount of money required).
+   */
+  CARDANO_ERROR_BALANCE_INSUFFICIENT = 1100,
+
+  /**
+   * \brief The number of entries in the initial UTxO set is smaller than the number of entries in the requested output set,
+   * for algorithms that impose the restriction that a single UTxO entry can only be used to pay for at most one output.
+   */
+  CARDANO_ERROR_UTXO_NOT_FRAGMENTED_ENOUGH = 1101,
+
+  /**
+   * \brief The algorithm depletes all entries from the initial UTxO set
+   * before it is able to pay for all outputs in the requested output set.
+   * This can happen even if the total value of entries within the initial UTxO set
+   * is greater than the total value of all entries in the requested output set,
+   * due to various restrictions that coin selection algorithms impose on themselves when selecting UTxO entries.
+   */
+  CARDANO_ERROR_UTXO_FULLY_DEPLETED = 1102,
+
+  /**
+   * \brief Another input must be selected by the algorithm in order to continue making progress,
+   * but doing so will increase the size of the resulting selection beyond an acceptable limit,
+   * specified by the maximum input count parameter.
+   */
+  CARDANO_ERROR_MAXIMUM_INPUT_COUNT_EXCEEDED = 1103,
+
+  /**
+   * \brief The sub transactions of a transaction do not balance between themselves. A top level transaction
+   * that needs a PlutusV1, PlutusV2 or PlutusV3 script, whatever source provides it, must conserve value by itself,
+   * so the net imbalance of its sub transactions must be zero and can not be absorbed by top level inputs or change.
+   */
+  CARDANO_ERROR_UNBALANCED_SUB_TRANSACTIONS = 1104,
+
+  /**
+   * \brief The top level transaction of a batch carries a witness datum that the ledger does not allow once its sub
+   * transactions are removed. A top level transaction that needs a PlutusV1, PlutusV2 or PlutusV3 script has its datums
+   * checked with its sub transactions removed, so each of its witness datums must be needed by a spent input locked by
+   * a Plutus script among the scripts of the batch, or match a datum hash of its own outputs or of the outputs behind
+   * its own reference inputs.
+   */
+  CARDANO_ERROR_NOT_ALLOWED_SUPPLEMENTAL_DATUMS = 1105,
+
+  /**
+   * \brief A script purpose of the transaction, or of one of its sub transactions, needs a Plutus script but carries no
+   * redeemer for it.
+   * Spending an input locked by a Plutus script, minting under a Plutus policy, withdrawing from a reward account
+   * controlled by a Plutus script, or carrying a certificate, a vote, a proposal or a guard that a Plutus script must
+   * authorize requires a redeemer with the tag and index of that purpose.
+   */
+  CARDANO_ERROR_MISSING_REDEEMER = 1106,
+
+  // TX Evaluation Failures
+
+  /**
+   * \brief The transaction script evaluation failed.
+   */
+  CARDANO_ERROR_SCRIPT_EVALUATION_FAILURE = 1200,
+} cardano_error_t;
+
+/**
+ * \brief Converts error codes to their human readable form.
+ *
+ * \param[in] error The error code to get the string representation for.
+ * \return Human readable form of the given error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_error_to_string(cardano_error_t error);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ERROR_H
diff --git a/vendor/include/cardano/export.h b/vendor/include/cardano/export.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/export.h
@@ -0,0 +1,55 @@
+/**
+ * \file export.h
+ *
+ * \author angel.castillo
+ * \date   Sep 09, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_EXPORT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_EXPORT_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifndef CARDANO_EXPORT
+#if defined(__EMSCRIPTEN__)
+#include <emscripten.h>
+#define CARDANO_EXPORT EMSCRIPTEN_KEEPALIVE extern
+#elif defined(_MSC_VER) && defined(CARDANO_C_DLL)
+#define CARDANO_EXPORT __declspec(dllexport) extern
+#else
+#define CARDANO_EXPORT extern
+#endif
+#endif
+#ifdef __GNUC__
+#define CARDANO_NODISCARD __attribute__((warn_unused_result))
+#elif defined(_MSC_VER)
+#define CARDANO_NODISCARD
+#else
+#define CARDANO_NODISCARD
+#endif
+
+#define CARDANO_UNUSED(x) (void)(x)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_EXPORT_H */
diff --git a/vendor/include/cardano/json/json_context.h b/vendor/include/cardano/json/json_context.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/json/json_context.h
@@ -0,0 +1,64 @@
+/**
+ * \file json_context.h
+ *
+ * \author angel.castillo
+ * \date   Dec 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_JSON_CONTEXT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_JSON_CONTEXT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enum representing the current context of the JSON writer.
+ *
+ * This enum defines the possible states of the JSON writer, indicating
+ * whether it is at the root level, inside an object, or inside an array.
+ */
+typedef enum
+{
+  /**
+   * \brief The writer is at the root level (no context set).
+   */
+  CARDANO_JSON_CONTEXT_ROOT = 0,
+
+  /**
+   * \brief The writer is inside an object context.
+   */
+  CARDANO_JSON_CONTEXT_OBJECT = 1,
+
+  /**
+   * \brief The writer is inside an array context.
+   */
+  CARDANO_JSON_CONTEXT_ARRAY = 2
+
+} cardano_json_context_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_JSON_CONTEXT_H
diff --git a/vendor/include/cardano/json/json_format.h b/vendor/include/cardano/json/json_format.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/json/json_format.h
@@ -0,0 +1,60 @@
+/**
+ * \file json_format.h
+ *
+ * \author angel.castillo
+ * \date   Dec 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_JSON_FORMAT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_JSON_FORMAT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enum representing the format of the JSON output.
+ *
+ * This enum defines the possible formats for the JSON output, indicating
+ * whether it should be compact (no extra spaces or line breaks) or pretty
+ * (extra spaces and line breaks for readability).
+ */
+typedef enum
+{
+  /**
+   * \brief Compact JSON format (no extra spaces or line breaks).
+   */
+  CARDANO_JSON_FORMAT_COMPACT,
+
+  /**
+   * \brief Pretty JSON format (extra spaces and line breaks for readability).
+   */
+  CARDANO_JSON_FORMAT_PRETTY
+
+} cardano_json_format_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_JSON_FORMAT_H
diff --git a/vendor/include/cardano/json/json_object.h b/vendor/include/cardano/json/json_object.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/json/json_object.h
@@ -0,0 +1,1395 @@
+/**
+ * \file json_object.h
+ *
+ * \author angel.castillo
+ * \date   Dec 07, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_format.h>
+#include <cardano/json/json_object_type.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \struct cardano_json_object_t
+ *
+ * \brief Represents a parsed JSON object, array, or value.
+ *
+ * This opaque structure serves as the primary data type for interacting with JSON data in the library.
+ * It can represent any valid JSON value, including objects, arrays, strings, numbers, booleans, or null.
+ *
+ * Parsed values are immutable. Cached string serialization mutates internal state and requires
+ * external synchronization when the same object is accessed concurrently.
+ */
+typedef struct cardano_json_object_t cardano_json_object_t;
+
+/**
+ * \brief Parses a JSON string into a \ref cardano_json_object_t.
+ *
+ * This function takes a JSON string and parses it into a \ref cardano_json_object_t representation.
+ * The returned object can be used to query the parsed JSON data.
+ *
+ * \param[in] json A pointer to the JSON string to parse. The string does not need to be null-terminated
+ *                 as its length is specified by \p size. This parameter must not be NULL.
+ * \param[in] size The length of the JSON string, in bytes.
+ *
+ * \return A pointer to the parsed \ref cardano_json_object_t if the parsing is successful, or \c NULL if
+ *         the input is invalid, the JSON string is malformed, or there is insufficient memory to complete the operation.
+ *
+ * \note The returned \ref cardano_json_object_t has an initial reference count of 1. The caller is responsible
+ *       for releasing the object by calling \ref cardano_json_object_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* json_data = "{\"name\":\"Alice\",\"age\":30,\"active\":true}";
+ * cardano_json_object_t* json_object = cardano_json_object_parse(json_data, strlen(json_data));
+ *
+ * if (json_object != NULL)
+ * {
+ *   // Query the JSON object (e.g., get the number of keys)
+ *   size_t size = cardano_json_object_get_property_count(json_object);
+ *   printf("Number of keys: %zu\n", size);
+ *
+ *   // Always release the JSON object when done
+ *   cardano_json_object_unref(&json_object);
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_json_object_t* cardano_json_object_parse(const char* json, size_t size);
+
+/**
+ * \brief Parses one complete JSON value and reports syntax or allocation failures.
+ *
+ * Number tokens retain their exact decimal representation. Numeric getters return
+ * an error when conversion cannot represent the value in the requested type.
+ *
+ * \param[in] json Input bytes; need not be null-terminated. Must not be NULL.
+ * \param[in] size Number of input bytes.
+ * \param[out] result Receives one owned reference on success, or NULL on failure. Must not be NULL.
+ * \return CARDANO_SUCCESS, CARDANO_ERROR_POINTER_IS_NULL, CARDANO_ERROR_INVALID_JSON,
+ * or CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_json_object_parse_ex(const char* json, size_t size, cardano_json_object_t** result);
+
+/**
+ * \brief Serializes a JSON object into a JSON string.
+ *
+ * This function takes a JSON object and converts it into its JSON string representation.
+ * The resulting string is valid JSON and encoded in UTF-8. The caller must ensure the
+ * JSON object is valid and properly initialized before calling this function.
+ *
+ * \param[in] json_object A pointer to the JSON object to be serialized. Must not be NULL.
+ * \param[in] format The format to use when serializing the JSON object.
+ * \param[out] length A pointer to a size_t variable where the length of the resulting JSON
+ *                    string will be stored (excluding the null terminator). Must not be NULL.
+ *
+ * \return A pointer to a null-terminated UTF-8 JSON string representing the serialized object.
+ *         This points to an internal buffer and must not be modified or freed by the caller. The
+ *         string is valid until the JSON object is released or successfully serialized in another format.
+ *
+ * \note If the function returns NULL, the value of \p length is undefined.
+ *
+ * \code{.c}
+ * cardano_json_object_t* obj = ...
+ * size_t length = 0;
+ *
+ * const char* json_string = cardano_json_object_to_json_string(obj, CARDANO_JSON_FORMAT_COMPACT, &length);
+ *
+ * if (json_string != NULL)
+ * {
+ *   printf("JSON: %s\n", json_string);
+ *   printf("Length: %zu\n", length);
+ * }
+ * else
+ * {
+ *   printf("Failed to serialize JSON object.\n");
+ * }
+ *
+ * cardano_json_object_unref(&obj);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_json_object_to_json_string(
+  cardano_json_object_t* json_object,
+  cardano_json_format_t  format,
+  size_t*                length);
+
+/**
+ * \brief Retrieves the type of a JSON object.
+ *
+ * This function determines the type of the specified \ref cardano_json_object_t. The type
+ * indicates whether the object represents a JSON object, array, string, number, boolean, or null.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t whose type is to be determined.
+ *                        This parameter must not be NULL.
+ *
+ * \return A value of type \ref cardano_json_object_type_t representing the type of the JSON object.
+ *         If \p json_object is NULL, the function returns \c CARDANO_JSON_OBJECT_TYPE_NULL.
+ *
+ * The possible return values are:
+ * - \c CARDANO_JSON_OBJECT_TYPE_OBJECT: The JSON object represents a key-value structure.
+ * - \c CARDANO_JSON_OBJECT_TYPE_ARRAY: The JSON object represents an array of elements.
+ * - \c CARDANO_JSON_OBJECT_TYPE_STRING: The JSON object represents a string.
+ * - \c CARDANO_JSON_OBJECT_TYPE_NUMBER: The JSON object represents a numeric value.
+ * - \c CARDANO_JSON_OBJECT_TYPE_BOOLEAN: The JSON object represents a boolean value (true or false).
+ * - \c CARDANO_JSON_OBJECT_TYPE_NULL: The JSON object is null or the parameter is invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"key\":\"value\"}", 15);
+ * if (json_object != NULL)
+ * {
+ *   cardano_json_object_type_t type = cardano_json_object_get_type(json_object);
+ *
+ *   switch (type)
+ *   {
+ *     case CARDANO_JSON_OBJECT_TYPE_OBJECT:
+ *       printf("The JSON object is an object.\n");
+ *       break;
+ *     case CARDANO_JSON_OBJECT_TYPE_ARRAY:
+ *       printf("The JSON object is an array.\n");
+ *       break;
+ *     case CARDANO_JSON_OBJECT_TYPE_STRING:
+ *       printf("The JSON object is a string.\n");
+ *       break;
+ *     case CARDANO_JSON_OBJECT_TYPE_NUMBER:
+ *       printf("The JSON object is a number.\n");
+ *       break;
+ *     case CARDANO_JSON_OBJECT_TYPE_BOOLEAN:
+ *       printf("The JSON object is a boolean.\n");
+ *       break;
+ *     case CARDANO_JSON_OBJECT_TYPE_NULL:
+ *     default:
+ *       printf("The JSON object is null or invalid.\n");
+ *       break;
+ *    }
+ *   // Always release the JSON object when done
+ *   cardano_json_object_unref(&json_object);
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ *
+ * \see cardano_json_object_parse
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_json_object_type_t cardano_json_object_get_type(
+  const cardano_json_object_t* json_object);
+
+/**
+ * \brief Checks if a JSON object contains a specific property.
+ *
+ * This function determines whether a JSON object contains a property with the specified key.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON object and must not be NULL.
+ * \param[in] key A pointer to the key string to check. The key does not need to be null-terminated, as its length
+ *                is specified by \p size. This parameter must not be NULL.
+ * \param[in] size The length of the key string, in bytes.
+ *
+ * \return \c true if the JSON object contains the specified property; \c false otherwise.
+ *
+ * \note This function is only valid for JSON objects. If the \p json_object is not of type
+ *       \ref CARDANO_JSON_OBJECT_TYPE_OBJECT, the function will return \c false.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"name\":\"Alice\",\"age\":30}", 29);
+ *
+ * if (json_object != NULL)
+ * {
+ *   bool has_name = cardano_json_object_has_property(json_object, "name", 4);
+ *   bool has_age = cardano_json_object_has_property(json_object, "age", 3);
+ *   bool has_active = cardano_json_object_has_property(json_object, "active", 6);
+ *
+ *   printf("Has 'name': %s\n", has_name ? "true" : "false");
+ *   printf("Has 'age': %s\n", has_age ? "true" : "false");
+ *   printf("Has 'active': %s\n", has_active ? "true" : "false");
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_json_object_has_property(
+  const cardano_json_object_t* json_object,
+  const char*                  key,
+  size_t                       size);
+
+/**
+ * \brief Retrieves the number of properties in a JSON object.
+ *
+ * This function returns the number of key-value pairs (properties) in the specified JSON object.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON object and must not be NULL.
+ *
+ * \return The number of properties in the JSON object, or \c 0 if the \p json_object is not
+ *         of type \ref CARDANO_JSON_OBJECT_TYPE_OBJECT or is \c NULL.
+ *
+ * \note This function is only valid for JSON objects. If the \p json_object is not of type
+ *       \ref CARDANO_JSON_OBJECT_TYPE_OBJECT, the function will return \c 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"name\":\"Alice\",\"age\":30}", 29);
+ *
+ * if (json_object != NULL)
+ * {
+ *   size_t property_count = cardano_json_object_get_property_count(json_object);
+ *   printf("Number of properties: %zu\n", property_count);
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_json_object_get_property_count(
+  const cardano_json_object_t* json_object);
+
+/**
+ * \brief Retrieves the key at a specific position in a JSON object.
+ *
+ * This function provides access to the key at a specified index within a JSON object.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON object and must not be NULL.
+ * \param[in] index The zero-based index of the key to retrieve. The index must be less than
+ *                  the number of properties in the JSON object, as determined by
+ *                  \ref cardano_json_object_get_property_count.
+ * \param[out] key_length A reference to a size_t variable where the length of the key will be stored.
+ *                        Does not include the null terminator.
+ *
+ * \return A pointer to the null-terminated key string if the index is valid, or \c NULL if the index is out of range,
+ *         the \p json_object is not of type \ref CARDANO_JSON_OBJECT_TYPE_OBJECT, or any parameter is invalid.
+ *
+ * \note The returned key remains valid as long as the \p json_object is not deallocated. The caller must
+ *       not attempt to modify or free the returned key.
+ *
+ * \note This function is only valid for JSON objects. If the \p json_object is not of type
+ *       \ref CARDANO_JSON_OBJECT_TYPE_OBJECT, the function will return \c NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"name\":\"Alice\",\"age\":30}", 29);
+ *
+ * if (json_object != NULL)
+ * {
+ *   size_t property_count = cardano_json_object_get_property_count(json_object);
+ *   printf("Number of properties: %zu\n", property_count);
+ *
+ *   for (size_t i = 0; i < property_count; ++i)
+ *   {
+ *     size_t key_length = 0;
+ *     const char* key = cardano_json_object_get_key_at(json_object, i, &key_length);
+ *
+ *     if (key != NULL)
+ *     {
+ *       printf("Key %zu: %.*s\n", i, (int)key_length, key);
+ *     }
+ *     else
+ *     {
+ *       printf("Failed to retrieve key at index %zu\n", i);
+ *     }
+ *   }
+ *
+ *  cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_json_object_get_key_at(
+  const cardano_json_object_t* json_object,
+  size_t                       index,
+  size_t*                      key_length);
+
+/**
+ * \brief Retrieves the value at a specific position in a JSON object.
+ *
+ * This function provides access to the value associated with a specific index within a JSON object.
+ * The index corresponds to the order of key-value pairs in the JSON object. The returned value has
+ * its reference count incremented, so it must be explicitly released when no longer needed by calling
+ * \ref cardano_json_object_unref.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON object and must not be NULL.
+ * \param[in] index The zero-based index of the value to retrieve. The index must be less than
+ *                  the number of properties in the JSON object, as determined by
+ *                  \ref cardano_json_object_get_property_count.
+ *
+ * \return A new reference to a \ref cardano_json_object_t representing the value at the specified index,
+ *         or \c NULL if the index is out of range, the \p json_object is not of type
+ *         \ref CARDANO_JSON_OBJECT_TYPE_OBJECT, or any parameter is invalid.
+ *
+ * \note This function increments the reference count of the returned \ref cardano_json_object_t.
+ *       The caller is responsible for managing the lifecycle of the returned object. To release
+ *       the object, call \ref cardano_json_object_unref.
+ *
+ * \note This function is only valid for JSON objects. If the \p json_object is not of type
+ *       \ref CARDANO_JSON_OBJECT_TYPE_OBJECT, the function will return \c NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"name\":\"Alice\",\"age\":30}", 29);
+ *
+ * if (json_object != NULL)
+ * {
+ *   size_t property_count = cardano_json_object_get_property_count(json_object);
+ *   printf("Number of properties: %zu\n", property_count);
+ *
+ *   for (size_t i = 0; i < property_count; ++i)
+ *   {
+ *     size_t key_length = 0;
+ *     const char* key = cardano_json_object_get_key_at(json_object, i, key_length);
+ *     cardano_json_object_t* value = cardano_json_object_get_value_at(json_object, i);
+ *
+ *     if (key != NULL && value != NULL)
+ *     {
+ *       printf("Key %zu: %.*s\n", i, (int)key_length, key);
+ *       cardano_json_object_type_t type = cardano_json_object_get_type(value);
+ *
+ *       // Process the value
+ *       cardano_json_object_unref(&value); // Release the value when done
+ *      }
+ *      else
+ *      {
+ *        printf("Failed to retrieve key or value at index %zu\n", i);
+ *     }
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_json_object_t* cardano_json_object_get_value_at(
+  const cardano_json_object_t* json_object,
+  size_t                       index);
+
+/**
+ * \brief Retrieves the value at a specific index in a JSON object without incrementing the reference count.
+ *
+ * This function provides access to the value associated with a specific index within a JSON object.
+ * It is an extended version of \ref cardano_json_object_get_value_at that does not increment the
+ * reference count of the returned object. This is useful in scenarios where the caller does not need
+ * to take ownership of the returned value.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON object and must not be \c NULL.
+ * \param[in] index The zero-based index of the value to retrieve. The index must be less than the
+ *                  number of properties in the JSON object, as determined by \ref cardano_json_object_get_property_count.
+ *
+ * \return A pointer to the \ref cardano_json_object_t representing the value at the specified index,
+ *         or \c NULL if the index is out of range, the \p json_object is not of type
+ *         \ref CARDANO_JSON_OBJECT_TYPE_OBJECT, or any parameter is invalid.
+ *
+ * \note Unlike \ref cardano_json_object_get_value_at, this function does not increment the reference
+ *       count of the returned object. The caller must ensure the lifetime of the \p json_object is valid
+ *       while the returned value is in use.
+ *
+ * \warning Do not modify or release the returned value directly unless you first increment its reference
+ *          count using \ref cardano_json_object_ref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"name\":\"Alice\",\"age\":30}", 29);
+ *
+ * if (json_object != NULL)
+ * {
+ *   size_t property_count = cardano_json_object_get_property_count(json_object);
+ *   printf("Number of properties: %zu\n", property_count);
+ *
+ *   for (size_t i = 0; i < property_count; ++i)
+ *   {
+ *     cardano_json_object_t* value = cardano_json_object_get_value_at_ex(json_object, i);
+ *
+ *     if (value != NULL)
+ *     {
+ *       cardano_json_object_type_t type = cardano_json_object_get_type(value);
+ *
+ *       // Process the value without taking ownership
+ *       switch (type)
+ *       {
+ *         case CARDANO_JSON_OBJECT_TYPE_STRING:
+ *           printf("Property %zu is a string: %s\n", i, cardano_json_object_get_string(value, NULL));
+ *           break;
+ *         case CARDANO_JSON_OBJECT_TYPE_NUMBER:
+ *           printf("Property %zu is a number.\n", i);
+ *           break;
+ *         default:
+ *           printf("Property %zu has an unknown type.\n", i);
+ *           break;
+ *       }
+ *     }
+ *     else
+ *     {
+ *       printf("Failed to retrieve property value at index %zu.\n", i);
+ *     }
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_json_object_t* cardano_json_object_get_value_at_ex(
+  const cardano_json_object_t* json_object,
+  size_t                       index);
+
+/**
+ * \brief Retrieves the value associated with a specified key in a JSON object.
+ *
+ * This function allows you to access the value of a property in a JSON object by specifying its key.
+ * The returned value has its reference count incremented, so it must be explicitly released
+ * when no longer needed by calling \ref cardano_json_object_unref.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON object and must not be NULL.
+ * \param[in] key A pointer to the key string to look up. The key does not need to be null-terminated,
+ *                as its length is specified by \p size. This parameter must not be NULL.
+ * \param[in] size The length of the key string, in bytes.
+ * \param[out] value A pointer to a \ref cardano_json_object_t pointer where the value associated with
+ *                   the key will be stored. The retrieved value has its reference count incremented.
+ *                   The caller is responsible for releasing the value when it is no longer needed.
+ *
+ * \return \c true if the key was found and \p value was successfully populated, or \c false otherwise.
+ *
+ * \note This function is only valid for JSON objects. If the \p json_object is not of type
+ *       \ref CARDANO_JSON_OBJECT_TYPE_OBJECT, the function will return \c false and \p value will remain unmodified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"name\":\"Alice\",\"age\":30}", 29);
+ *
+ * if (json_object != NULL)
+ * {
+ *   cardano_json_object_t* value = NULL;
+ *
+ *   if (cardano_json_object_get(json_object, "name", 4, &value))
+ *   {
+ *     cardano_json_object_type_t type = cardano_json_object_get_type(value);
+ *
+ *     if (type == CARDANO_JSON_OBJECT_TYPE_STRING)
+ *     {
+ *       const char* name = cardano_json_object_get_string(value, NULL);
+ *       printf("Name: %s\n", name);
+ *     }
+ *
+ *     // Release the value when done
+ *     cardano_json_object_unref(&value);
+ *   }
+ *   else
+ *   {
+ *     printf("Key 'name' not found.\n");
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_json_object_get(
+  const cardano_json_object_t* json_object,
+  const char*                  key,
+  size_t                       size,
+  cardano_json_object_t**      value);
+
+/**
+ * \brief Retrieves the value associated with a specified key in a JSON object without incrementing the reference count.
+ *
+ * This function allows access to the value of a property in a JSON object by specifying its key.
+ * It is an extended version of \ref cardano_json_object_get that does not increment the reference count
+ * of the returned value. This is useful in scenarios where the caller does not need to take ownership
+ * of the returned object.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON object and must not be \c NULL.
+ * \param[in] key A pointer to the key string to look up. The key does not need to be null-terminated,
+ *                as its length is specified by \p size. This parameter must not be \c NULL.
+ * \param[in] size The length of the key string, in bytes.
+ * \param[out] value A pointer to a \ref cardano_json_object_t pointer where the value associated with
+ *                   the key will be stored. The returned value does not have its reference count incremented.
+ *
+ * \return \c true if the key was found and \p value was successfully populated; otherwise, \c false.
+ *         On failure, \p value is set to \c NULL.
+ *
+ * \note Unlike \ref cardano_json_object_get, this function does not increment the reference count
+ *       of the returned object. The caller must ensure the lifetime of the \p json_object is valid
+ *       while the returned value is in use.
+ *
+ * \warning Do not modify or release the returned value directly unless you first increment its reference
+ *          count using \ref cardano_json_object_ref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"name\":\"Alice\",\"age\":30}", 29);
+ *
+ * if (json_object != NULL)
+ * {
+ *   cardano_json_object_t* value = NULL;
+ *
+ *   if (cardano_json_object_get_ex(json_object, "name", 4, &value))
+ *   {
+ *     cardano_json_object_type_t type = cardano_json_object_get_type(value);
+ *
+ *     if (type == CARDANO_JSON_OBJECT_TYPE_STRING)
+ *     {
+ *       const char* name = cardano_json_object_get_string(value, NULL);
+ *       printf("Name: %s\n", name);
+ *     }
+ *     else
+ *     {
+ *       printf("The 'name' property is not a string.\n");
+ *     }
+ *   }
+ *   else
+ *   {
+ *     printf("Key 'name' not found.\n");
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_json_object_get_ex(
+  const cardano_json_object_t* json_object,
+  const char*                  key,
+  size_t                       size,
+  cardano_json_object_t**      value);
+
+/**
+ * \brief Retrieves the number of elements in a JSON array.
+ *
+ * This function returns the length (number of elements) of a JSON array.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t representing a JSON array.
+ *                        This parameter must not be NULL and must represent a JSON array.
+ *
+ * \return The number of elements in the JSON array. Returns 0 if the \p json_object is NULL,
+ *         or if it is not of type \ref CARDANO_JSON_OBJECT_TYPE_ARRAY.
+ *
+ * \note This function is only valid for JSON arrays. If the \p json_object is not of type
+ *       \ref CARDANO_JSON_OBJECT_TYPE_ARRAY, the function will return 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("[1, 2, 3, 4]", 9);
+ *
+ * if (json_object != NULL)
+ * {
+ *   size_t length = cardano_json_object_array_get_length(json_object);
+ *   printf("Array length: %zu\n", length);
+ *
+ *   for (size_t i = 0; i < length; ++i)
+ *   {
+ *     cardano_json_object_t* element = cardano_json_object_array_get_element_at(json_object, i);
+ *     if (element != NULL)
+ *     {
+ *       double value = cardano_json_object_get_number(element);
+ *       printf("Element %zu: %f\n", i, value);
+ *       cardano_json_object_unref(&element); // Release the element when done
+ *     }
+ *     else
+ *     {
+ *       printf("Failed to retrieve element at index %zu\n", i);
+ *     }
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_json_object_array_get_length(
+  const cardano_json_object_t* json_object);
+
+/**
+ * \brief Retrieves the value at a specified index in a JSON array.
+ *
+ * This function provides access to the value at a specific position within a JSON array.
+ * The returned value has its reference count incremented, so it must be explicitly released
+ * when no longer needed by calling \ref cardano_json_object_unref.
+ *
+ * \param[in] json_array A pointer to the \ref cardano_json_object_t to query.
+ *                       This parameter must represent a JSON array and must not be NULL.
+ * \param[in] index The zero-based index of the value to retrieve. The index must be less than
+ *                  the number of elements in the JSON array, as determined by
+ *                  \ref cardano_json_object_array_get_length.
+ *
+ * \return A new reference to a \ref cardano_json_object_t representing the value at the specified index,
+ *         or \c NULL if the index is out of range, the \p json_array is not of type
+ *         \ref CARDANO_JSON_OBJECT_TYPE_ARRAY, or any parameter is invalid.
+ *
+ * \note This function increments the reference count of the returned \ref cardano_json_object_t.
+ *       The caller is responsible for managing the lifecycle of the returned object. To release
+ *       the object, call \ref cardano_json_object_unref.
+ *
+ * \note This function is only valid for JSON arrays. If the \p json_array is not of type
+ *       \ref CARDANO_JSON_OBJECT_TYPE_ARRAY, the function will return \c NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_array = cardano_json_object_parse("[\"Alice\", 30, true]", 19);
+ *
+ * if (json_array != NULL)
+ * {
+ *   size_t array_length = cardano_json_object_array_get_length(json_array);
+ *   printf("Array length: %zu\n", array_length);
+ *
+ *   for (size_t i = 0; i < array_length; ++i)
+ *   {
+ *     cardano_json_object_t* element = cardano_json_object_array_get(json_array, i);
+ *
+ *     if (element != NULL)
+ *     {
+ *       cardano_json_object_type_t type = cardano_json_object_get_type(element);
+ *
+ *       switch (type)
+ *       {
+ *         case CARDANO_JSON_OBJECT_TYPE_STRING:
+ *           printf("Element %zu is a string: %s\n", i, cardano_json_object_get_string(element, NULL));
+ *           break;
+ *         case CARDANO_JSON_OBJECT_TYPE_NUMBER:
+ *           printf("Element %zu is a number.\n", i);
+ *           break;
+ *         case CARDANO_JSON_OBJECT_TYPE_BOOL:
+ *           printf("Element %zu is a boolean.\n", i);
+ *           break;
+ *         default:
+ *           printf("Element %zu is of unknown type.\n", i);
+ *           break;
+ *       }
+ *
+ *       // Release the element when done
+ *       cardano_json_object_unref(&element);
+ *     }
+ *     else
+ *     {
+ *       printf("Failed to retrieve element at index %zu\n", i);
+ *     }
+ *   }
+ *
+ *   cardano_json_object_unref(&json_array); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON array.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_json_object_t* cardano_json_object_array_get(
+  const cardano_json_object_t* json_array,
+  size_t                       index);
+
+/**
+ * \brief Retrieves the value at a specified index in a JSON array without incrementing the reference count.
+ *
+ * This function provides access to the value at a specific position within a JSON array.
+ * It is an extended version of \ref cardano_json_object_array_get that does not increment the
+ * reference count of the returned value. This is useful in scenarios where ownership of the
+ * returned object is not required.
+ *
+ * \param[in] json_array A pointer to the \ref cardano_json_object_t representing a JSON array.
+ *                       This parameter must not be \c NULL and must represent a JSON array.
+ * \param[in] index The zero-based index of the value to retrieve. The index must be less than
+ *                  the number of elements in the JSON array, as determined by
+ *                  \ref cardano_json_object_array_get_length.
+ *
+ * \return A pointer to the \ref cardano_json_object_t representing the value at the specified index,
+ *         or \c NULL if:
+ *         - The \p index is out of range.
+ *         - The \p json_array is not of type \ref CARDANO_JSON_OBJECT_TYPE_ARRAY.
+ *         - The \p json_array is \c NULL.
+ *
+ * \note Unlike \ref cardano_json_object_array_get, this function does not increment the reference count
+ *       of the returned object. The caller must ensure the lifetime of the returned object is valid for
+ *       the duration of its usage.
+ *
+ * \warning Avoid modifying or releasing the returned object directly. If you need to take ownership
+ *          of the returned object, use \ref cardano_json_object_ref to increment its reference count.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_array = cardano_json_object_parse("[\"Alice\", 30, true]", 19);
+ *
+ * if (json_array != NULL)
+ * {
+ *   size_t array_length = cardano_json_object_array_get_length(json_array);
+ *   printf("Array length: %zu\n", array_length);
+ *
+ *   for (size_t i = 0; i < array_length; ++i)
+ *   {
+ *     cardano_json_object_t* element = cardano_json_object_array_get_ex(json_array, i);
+ *
+ *     if (element != NULL)
+ *     {
+ *       cardano_json_object_type_t type = cardano_json_object_get_type(element);
+ *
+ *       switch (type)
+ *       {
+ *         case CARDANO_JSON_OBJECT_TYPE_STRING:
+ *           printf("Element %zu is a string: %s\n", i, cardano_json_object_get_string(element, NULL));
+ *           break;
+ *         case CARDANO_JSON_OBJECT_TYPE_NUMBER:
+ *           printf("Element %zu is a number.\n", i);
+ *           break;
+ *         case CARDANO_JSON_OBJECT_TYPE_BOOLEAN:
+ *           printf("Element %zu is a boolean.\n", i);
+ *           break;
+ *         default:
+ *           printf("Element %zu is of unknown type.\n", i);
+ *           break;
+ *       }
+ *     }
+ *     else
+ *     {
+ *       printf("Failed to retrieve element at index %zu\n", i);
+ *     }
+ *   }
+ *
+ *   cardano_json_object_unref(&json_array); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON array.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_json_object_t* cardano_json_object_array_get_ex(
+  const cardano_json_object_t* json_array,
+  size_t                       index);
+
+/**
+ * \brief Retrieves the string value from a JSON object.
+ *
+ * This function provides access to the string value of a JSON object. The caller can retrieve the
+ * string along with its length. The returned string points to internal storage and must not be
+ * modified or freed by the caller.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON string and must not be NULL.
+ * \param[out] string_length A reference to a \c size_t variable where the length of the string will
+ *                           be stored. If the parameter is NULL, the length will not be returned.
+ *
+ * \return A pointer to the string value, or \c NULL if the \p json_object is not of type
+ *         \ref CARDANO_JSON_OBJECT_TYPE_STRING or any parameter is invalid.
+ *
+ * \note The returned string is a pointer to the internal storage of the JSON object. The caller must
+ *       not modify or free this string. If the JSON object is released or modified, the pointer may
+ *       become invalid.
+ *
+ * \note This function is only valid for JSON objects of type \ref CARDANO_JSON_OBJECT_TYPE_STRING. If the
+ *       \p json_object is of a different type, the function will return \c NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"name\":\"Alice\"}", 16);
+ *
+ * if (json_object != NULL)
+ * {
+ *   cardano_json_object_t* name_value = NULL;
+ *
+ *   if (cardano_json_object_get(json_object, "name", 4, &name_value))
+ *   {
+ *     size_t string_length = 0;
+ *     const char* name = cardano_json_object_get_string(name_value, &string_length);
+ *
+ *     if (name != NULL)
+ *     {
+ *       printf("Name: %.*s\n", (int)string_length, name);
+ *     }
+ *     else
+ *     {
+ *       printf("The 'name' property is not a string.\n");
+ *     }
+ *
+ *     cardano_json_object_unref(&name_value); // Release the reference
+ *   }
+ *   else
+ *   {
+ *     printf("Key 'name' not found.\n");
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_json_object_get_string(
+  const cardano_json_object_t* json_object,
+  size_t*                      string_length);
+
+/**
+ * \brief Determines if a JSON object represents a negative number.
+ *
+ * This function checks whether the given \ref cardano_json_object_t represents a numeric value
+ * that is negative. A negative number is defined as any numeric value less than zero,
+ * regardless of whether it is an integer or a real number.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query. This parameter must represent
+ *                        a JSON number and must not be \c NULL.
+ *
+ * \return \c true if the JSON object represents a negative number; otherwise, \c false. If the \p json_object
+ *         is \c NULL, or if the JSON object is not a number, the function will return \c false.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"temperature\": -15.5, \"count\": 42}", 38);
+ *
+ * if (json_object != NULL)
+ * {
+ *   cardano_json_object_t* value = NULL;
+ *
+ *   if (cardano_json_object_get(json_object, "temperature", 11, &value))
+ *   {
+ *     bool is_negative = cardano_json_object_get_is_negative_number(value);
+ *     printf("\"temperature\" is negative: %s\n", is_negative ? "true" : "false");
+ *
+ *     cardano_json_object_unref(&value);
+ *   }
+ *
+ *   if (cardano_json_object_get(json_object, "count", 5, &value))
+ *   {
+ *     bool is_negative = cardano_json_object_get_is_negative_number(value);
+ *     printf("\"count\" is negative: %s\n", is_negative ? "true" : "false");
+ *
+ *     cardano_json_object_unref(&value);
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_json_object_get_is_negative_number(const cardano_json_object_t* json_object);
+
+/**
+ * \brief Determines if a JSON object represents a real (floating-point) number.
+ *
+ * This function checks whether the given \ref cardano_json_object_t represents a real number. A real number
+ * in JSON is a numeric value that includes a fractional part (e.g., `3.14`, `-0.01`).
+ *
+ * This function is specifically designed to distinguish between integral and real numbers within the JSON
+ * context. While JSON itself does not have distinct types for integers and floating-point numbers, this
+ * function interprets numbers with a fractional component or numbers expressed in scientific notation
+ * as real numbers.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query. This parameter must represent
+ *                        a JSON number and must not be \c NULL.
+ *
+ * \return \c true if the JSON object represents a real number; otherwise, \c false. If the \p json_object
+ *         is \c NULL, the function will also return \c false.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"pi\": 3.14159, \"count\": 42}", 29);
+ *
+ * if (json_object != NULL)
+ * {
+ *   cardano_json_object_t* value = NULL;
+ *
+ *   if (cardano_json_object_get(json_object, "pi", 2, &value))
+ *   {
+ *     bool is_real = cardano_json_object_get_is_real_number(value);
+ *     printf("\"pi\" is a real number: %s\n", is_real ? "true" : "false");
+ *
+ *     cardano_json_object_unref(&value);
+ *   }
+ *
+ *   if (cardano_json_object_get(json_object, "count", 5, &value))
+ *   {
+ *     bool is_real = cardano_json_object_get_is_real_number(value);
+ *     printf("\"count\" is a real number: %s\n", is_real ? "true" : "false");
+ *
+ *     cardano_json_object_unref(&value);
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_json_object_get_is_real_number(const cardano_json_object_t* json_object);
+
+/**
+ * \brief Retrieves an unsigned integer value from a JSON object.
+ *
+ * This function provides access to the unsigned integer value of a JSON object. It ensures
+ * that the value is a valid unsigned integer and retrieves it into the specified output parameter.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON number and must not be NULL.
+ * \param[out] value A pointer to a \c uint64_t variable where the unsigned integer value will
+ *                   be stored. This parameter must not be NULL.
+ *
+ * \return A status code indicating the result of the operation. If the operation is successful,
+ *        the function returns \ref CARDANO_SUCCESS.
+ *
+ * \note This function is only valid for JSON objects of type \ref CARDANO_JSON_OBJECT_TYPE_NUMBER.
+ *       If the \p json_object is of a different type the function will return \ref CARDANO_ERROR_JSON_TYPE_MISMATCH.
+ *
+ * \warning If the value exceeds the range of a \c uint64_t or is not a valid number, the function
+ *          will return an appropriate error code, and \p value will remain unmodified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"age\":30}", 10);
+ *
+ * if (json_object != NULL)
+ * {
+ *   cardano_json_object_t* age_value = NULL;
+ *
+ *   if (cardano_json_object_get(json_object, "age", 3, &age_value))
+ *   {
+ *     uint64_t age = 0;
+ *     cardano_error_t result = cardano_json_object_get_uint(age_value, &age);
+ *
+ *     if (result == CARDANO_SUCCESS)
+ *     {
+ *       printf("Age: %llu\n", (unsigned long long)age);
+ *     }
+ *     else
+ *     {
+ *       printf("Failed to retrieve 'age' as an unsigned integer. Error: %d\n", result);
+ *     }
+ *
+ *     cardano_json_object_unref(&age_value); // Release the reference
+ *   }
+ *   else
+ *   {
+ *     printf("Key 'age' not found.\n");
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_json_object_get_uint(
+  const cardano_json_object_t* json_object,
+  uint64_t*                    value);
+
+/**
+ * \brief Retrieves a signed integer value from a JSON object.
+ *
+ * This function provides access to the signed integer value of a JSON object. It ensures
+ * that the value is a valid signed integer and retrieves it into the specified output parameter.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON number and must not be NULL.
+ * \param[out] value A pointer to an \c int64_t variable where the signed integer value will
+ *                   be stored. This parameter must not be NULL.
+ *
+ * \return A status code indicating the result of the operation. If the operation is successful,
+ *       the function returns \ref CARDANO_SUCCESS.
+ *
+ * \note This function is only valid for JSON objects of type \ref CARDANO_JSON_OBJECT_TYPE_NUMBER.
+ *       If the \p json_object is of a different type, the function will return
+ *       \ref CARDANO_ERROR_JSON_TYPE_MISMATCH.
+ *
+ * \warning If the value exceeds the range of an \c int64_t or is not a valid number, the function
+ *          will return an appropriate error code, and \p value will remain unmodified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"age\":-25}", 12);
+ *
+ * if (json_object != NULL)
+ * {
+ *   cardano_json_object_t* age_value = NULL;
+ *
+ *   if (cardano_json_object_get(json_object, "age", 3, &age_value))
+ *   {
+ *     int64_t age = 0;
+ *     cardano_error_t result = cardano_json_object_get_signed_int(age_value, &age);
+ *
+ *     if (result == CARDANO_SUCCESS)
+ *     {
+ *       printf("Age: %lld\n", (long long)age);
+ *     }
+ *     else
+ *     {
+ *       printf("Failed to retrieve 'age' as a signed integer. Error: %d\n", result);
+ *     }
+ *
+ *     cardano_json_object_unref(&age_value); // Release the reference
+ *   }
+ *   else
+ *   {
+ *     printf("Key 'age' not found.\n");
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_json_object_get_signed_int(
+  const cardano_json_object_t* json_object,
+  int64_t*                     value);
+
+/**
+ * \brief Retrieves a double-precision floating-point value from a JSON object.
+ *
+ * This function provides access to the double value of a JSON object. It ensures
+ * that the value is a valid number and retrieves it into the specified output parameter.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON number and must not be NULL.
+ * \param[out] value A pointer to a \c double variable where the floating-point value will
+ *                   be stored. This parameter must not be NULL.
+ *
+ * \return A status code indicating the result of the operation. If the operation is successful,
+ *       the function returns \ref CARDANO_SUCCESS.
+ *
+ * \note This function is only valid for JSON objects of type \ref CARDANO_JSON_OBJECT_TYPE_NUMBER.
+ *       If the \p json_object is of a different type, the function will return
+ *       \ref CARDANO_ERROR_JSON_TYPE_MISMATCH.
+ *
+ * \warning If the value is not a valid floating-point number or cannot be represented as a \c double,
+ *          the function will return an appropriate error code, and \p value will remain unmodified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"height\":5.75}", 17);
+ *
+ * if (json_object != NULL)
+ * {
+ *   cardano_json_object_t* height_value = NULL;
+ *
+ *   if (cardano_json_object_get(json_object, "height", 6, &height_value))
+ *   {
+ *     double height = 0.0;
+ *     cardano_error_t result = cardano_json_object_get_double(height_value, &height);
+ *
+ *     if (result == CARDANO_SUCCESS)
+ *     {
+ *       printf("Height: %f\n", height);
+ *     }
+ *     else
+ *     {
+ *       printf("Failed to retrieve 'height' as a double. Error: %d\n", result);
+ *     }
+ *
+ *     cardano_json_object_unref(&height_value); // Release the reference
+ *   }
+ *   else
+ *   {
+ *     printf("Key 'height' not found.\n");
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_json_object_get_double(
+  const cardano_json_object_t* json_object,
+  double*                      value);
+
+/**
+ * \brief Retrieves a boolean value from a JSON object.
+ *
+ * This function provides access to the boolean value of a JSON object. It ensures
+ * that the value is a valid boolean and retrieves it into the specified output parameter.
+ *
+ * \param[in] json_object A pointer to the \ref cardano_json_object_t to query.
+ *                        This parameter must represent a JSON boolean and must not be NULL.
+ * \param[out] value A pointer to a \c bool variable where the boolean value will
+ *                   be stored. This parameter must not be NULL.
+ *
+ * \return A status code indicating the result of the operation. If the operation is successful,
+ *      the function returns \ref CARDANO_SUCCESS.
+ *
+ * \note This function is only valid for JSON objects of type \ref CARDANO_JSON_OBJECT_TYPE_BOOLEAN.
+ *       If the \p json_object is of a different type, the function will return
+ *       \ref CARDANO_ERROR_JSON_TYPE_MISMATCH.
+ *
+ * \warning If the value is not a valid boolean, the function will return an appropriate
+ *          error code, and \p value will remain unmodified.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* json_object = cardano_json_object_parse("{\"active\":true}", 15);
+ *
+ * if (json_object != NULL)
+ * {
+ *   cardano_json_object_t* active_value = NULL;
+ *
+ *   if (cardano_json_object_get(json_object, "active", 6, &active_value))
+ *   {
+ *     bool is_active = false;
+ *     cardano_error_t result = cardano_json_object_get_boolean(active_value, &is_active);
+ *
+ *     if (result == CARDANO_SUCCESS)
+ *     {
+ *       printf("Active: %s\n", is_active ? "true" : "false");
+ *     }
+ *     else
+ *     {
+ *       printf("Failed to retrieve 'active' as a boolean. Error: %d\n", result);
+ *     }
+ *
+ *     cardano_json_object_unref(&active_value); // Release the reference
+ *   }
+ *   else
+ *   {
+ *     printf("Key 'active' not found.\n");
+ *   }
+ *
+ *   cardano_json_object_unref(&json_object); // Clean up
+ * }
+ * else
+ * {
+ *   printf("Failed to parse JSON data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_json_object_get_boolean(
+  const cardano_json_object_t* json_object,
+  bool*                        value);
+
+/**
+ * \brief Decrements the reference count of a JSON object object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_json_object_t object
+ * by decreasing its reference count. When the reference count reaches zero, the JSON object is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] json_object A pointer to the pointer of the JSON object object. This double
+ *             indirection allows the function to set the caller's pointer to
+ *             NULL, avoiding dangling pointer issues after the object has been
+ *             freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_object_t* object = cardano_json_object_new();
+ *
+ * // Perform operations with the object...
+ *
+ * cardano_json_object_unref(&object);
+ * // At this point, object is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_json_object_unref, the pointer to the \ref cardano_json_object_t object
+ *    will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_json_object_unref(cardano_json_object_t** json_object);
+
+/**
+ * \brief Increases the reference count of the cardano_json_object_t object.
+ *
+ * This function is used to manually increment the reference count of a JSON object
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_json_object_unref.
+ *
+ * \param json_object A pointer to the JSON object object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming object is a previously created JSON object object
+ *
+ * cardano_json_object_ref(object);
+ *
+ * // Now object can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_json_object_ref there is a corresponding
+ * call to \ref cardano_json_object_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_json_object_ref(cardano_json_object_t* json_object);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_json_object_t object.
+ *
+ * This function returns the number of active references to a JSON object object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_json_object_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param json_object A pointer to the JSON object object whose reference count is queried.
+ *        The object must not be NULL.
+ *
+ * \return The number of active references to the specified JSON object object. If the object
+ * is properly managed (i.e., every \ref cardano_json_object_ref call is matched with a
+ * \ref cardano_json_object_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming object is a previously created JSON object object
+ *
+ * size_t ref_count = cardano_json_object_refcount(object);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_json_object_refcount(const cardano_json_object_t* json_object);
+
+/**
+ * \brief Sets the last error message for a given JSON object object.
+ *
+ * Records an error message in the JSON object's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] object A pointer to the \ref cardano_json_object_t instance whose last error message is
+ *          to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the object's
+ *        last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_json_object_set_last_error(cardano_json_object_t* object, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific object.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_json_object_set_last_error for the given
+ * object. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] object A pointer to the \ref cardano_json_object_t instance whose last error
+ *          message is to be retrieved. If the object is NULL, the function
+ *          returns a generic error message indicating the null object.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *      message for the specified object. If the object is NULL, "Object is NULL."
+ *      is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *    must not be modified by the caller. The string remains valid until the
+ *    next call to \ref cardano_json_object_set_last_error for the same object, or until
+ *    the object is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_json_object_get_last_error(const cardano_json_object_t* object);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_json_object_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_json_object_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_json_object_deep_clone(const cardano_json_object_t* source, cardano_json_object_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_H
diff --git a/vendor/include/cardano/json/json_object_type.h b/vendor/include/cardano/json/json_object_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/json/json_object_type.h
@@ -0,0 +1,77 @@
+/**
+ * \file json_object_type.h
+ *
+ * \author angel.castillo
+ * \date   Dec 07, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_TYPE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumerates the possible types of a JSON object.
+ *
+ * This enumeration defines the various types a JSON object can represent.
+ */
+typedef enum
+{
+  /**
+   * \brief Represents a JSON object (key-value pairs).
+   */
+  CARDANO_JSON_OBJECT_TYPE_OBJECT,
+
+  /**
+   * \brief Represents a JSON array (ordered list).
+   */
+  CARDANO_JSON_OBJECT_TYPE_ARRAY,
+
+  /**
+   * \brief Represents a JSON string.
+   */
+  CARDANO_JSON_OBJECT_TYPE_STRING,
+
+  /**
+   * \brief Represents a JSON number (integer or floating-point).
+   */
+  CARDANO_JSON_OBJECT_TYPE_NUMBER,
+
+  /**
+   * \brief Represents a JSON boolean (`true` or `false`).
+   */
+  CARDANO_JSON_OBJECT_TYPE_BOOLEAN,
+
+  /**
+   * \brief Represents a JSON null value.
+   */
+  CARDANO_JSON_OBJECT_TYPE_NULL
+} cardano_json_object_type_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_TYPE_H
diff --git a/vendor/include/cardano/json/json_writer.h b/vendor/include/cardano/json/json_writer.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/json/json_writer.h
@@ -0,0 +1,1695 @@
+/**
+ * \file json_writer.h
+ *
+ * \author angel.castillo
+ * \date   Dec 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_JSON_WRITER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_JSON_WRITER_H
+
+/* INCLUDES ******************************************************************/
+
+#include "json_object.h"
+#include <cardano/buffer.h>
+#include <cardano/common/bigint.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_context.h>
+#include <cardano/json/json_format.h>
+#include <cardano/json/json_object.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Provides a API for forward-only, non-cached writing of UTF-8 encoded JSON text.
+ */
+typedef struct cardano_json_writer_t cardano_json_writer_t;
+
+/**
+ * \brief Creates a new JSON writer instance.
+ *
+ * This function initializes a new instance of a \ref cardano_json_writer_t, which
+ * can be used to encode data into JSON format. The created writer manages its
+ * internal state and ensures that the generated JSON is syntactically valid.
+ *
+ * The JSON writer can be used to encode JSON incrementally by invoking various
+ * write functions to add properties, values, and nested structures.
+ *
+ * \param[in] format The format of the JSON output (compact or pretty).
+ *
+ * \return A pointer to a newly allocated \ref cardano_json_writer_t instance.
+ *      Returns \c NULL if the creation fails due to insufficient memory or
+ *      other initialization errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ * if (writer == NULL)
+ * {
+ *   printf("Failed to create a JSON writer.\n");
+ *   return EXIT_FAILURE;
+ * }
+ *
+ * // Use the writer to encode JSON data...
+ *
+ * cardano_json_writer_unref(&writer); // Release resources when done
+ * \endcode
+ *
+ * \note The caller is responsible for managing the memory of the returned
+ *    JSON writer instance. Use \ref cardano_json_writer_unref to release
+ *    resources when the writer is no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_json_writer_t* cardano_json_writer_new(cardano_json_format_t format);
+
+/**
+ * \brief Writes a property name to the JSON output.
+ *
+ * This function writes the name of a JSON property to the output, preparing it
+ * for the subsequent value. Property names used within JSON objects
+ * must be followed by a value-writing function to form a valid key-value pair.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ * \param[in] name A pointer to the property name string. The string does not
+ *        need to be null-terminated, as its length is specified separately.
+ * \param[in] name_size The size of the property name string in bytes.
+ *
+ * \pre The JSON writer must currently be in an object context. Calling this function
+ *   outside an object context will result in an error.
+ * \pre The `name` string must not contain invalid JSON characters such as control characters.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ * cardano_json_writer_write_start_object(writer);
+ * cardano_json_writer_write_property_name(writer, "name", 4); // Property: "name"
+ * cardano_json_writer_write_string(writer, "John Doe", 8);    // Value: "John Doe"
+ * cardano_json_writer_write_end_object(writer);
+ *
+ * ...
+ *
+ * cardano_json_writer_unref(&writer); // Release resources
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_property_name(
+  cardano_json_writer_t* writer,
+  const char*            name,
+  size_t                 name_size);
+
+/**
+ * \brief Writes a boolean value to the JSON output.
+ *
+ * This function writes a boolean value (`true` or `false`) as a JSON value.
+ * The value is represented in JSON's boolean format, ensuring compatibility
+ * with all JSON parsers.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *                   This must be a valid, non-NULL JSON writer.
+ * \param[in] value The boolean value to be written. Passing `true` writes the
+ *                  JSON literal `true`, and passing `false` writes the JSON
+ *                  literal `false`.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *      (e.g., after a property name in an object or as an element in an array).
+ *      Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *       calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *       Once an error occurs, the writer enters an error state, and subsequent calls
+ *       to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object
+ *  cardano_json_writer_write_start_object(writer);                  // Start object: {
+ *  cardano_json_writer_write_property_name(writer, "isEnabled", 9); // Property: "isEnabled"
+ *  cardano_json_writer_write_bool(writer, true);                    // Value: true
+ *  cardano_json_writer_write_end_object(writer);                    // End object: }
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128] = { 0 };
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    printf("Error: %s\n", cardano_json_writer_get_last_error(writer));
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "isEnabled": true
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_bool(
+  cardano_json_writer_t* writer,
+  bool                   value);
+
+/**
+ * \brief Writes a JSON `null` value to the output.
+ *
+ * This function writes the literal `null` value to the JSON output.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *   (e.g., after a property name in an object or as an element in an array).
+ *   Calling this function in an invalid context will result in error.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_json_writer_write_start_object(writer);
+ *  cardano_json_writer_write_property_name(writer, "name", 4);
+ *  cardano_json_writer_write_null(writer); // Write "name": null
+ *  cardano_json_writer_write_end_object(writer);
+ *
+ *  char buffer[128];
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    printf("Error: %s\n", cardano_json_writer_get_last_error(writer));
+ *    cardano_json_writer_unref(&writer);
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //  "name": null
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_null(
+  cardano_json_writer_t* writer);
+
+/**
+ * \brief Writes a big integer value to the JSON output.
+ *
+ * This function writes a big integer (\ref cardano_bigint_t) as a JSON value. The
+ * value is encoded as a JSON string to ensure compatibility with JSON parsers
+ * that may not natively support extremely large integer values.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ * \param[in] bigint A pointer to the \ref cardano_bigint_t instance representing
+ *          the big integer to be written.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *   (e.g., after a property name in an object or as an element in an array).
+ *   Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note The big integer is serialized as a JSON string (e.g., `"123456789123456789"`) to
+ *    preserve its precision and avoid loss of information due to JSON's numeric limitations.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  // Create a big integer value
+ *  cardano_bigint_t* bigint = cardano_bigint_from_string("123456789123456789");
+ *
+ *  if (bigint == NULL)
+ *  {
+ *    printf("Failed to create big integer.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_json_writer_write_start_object(writer);
+ *  cardano_json_writer_write_property_name(writer, "bigNumber", 9); // Property: "bigNumber"
+ *  cardano_json_writer_write_bigint(writer, bigint);   // Value: "123456789123456789"
+ *  cardano_json_writer_write_end_object(writer);
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128];
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_bigint_unref(&bigint);
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    cardano_bigint_unref(&bigint);
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "bigNumber": "123456789123456789"
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_bigint_unref(&bigint);
+ *  cardano_json_writer_unref(&writer);
+ * }
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_bigint(
+  cardano_json_writer_t*  writer,
+  const cardano_bigint_t* bigint);
+
+/**
+ * \brief Begins a JSON array in the output.
+ *
+ * This function writes the opening bracket (`[`) of a JSON array. After calling this
+ * function, subsequent calls to writer functions can add elements to the array.
+ * The array must be closed with \ref cardano_json_writer_write_end_array to produce
+ * a valid JSON structure.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *   (e.g., after a property name in an object or as an element in another array).
+ *   Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_json_writer_write_start_object(writer);       // Start object: {
+ *  cardano_json_writer_write_property_name(writer, "numbers", 7); // Property: "numbers"
+ *  cardano_json_writer_write_start_array(writer);        // Start array: [
+ *  cardano_json_writer_write_uint(writer, 1);         // Add element: 1
+ *  cardano_json_writer_write_uint(writer, 2);         // Add element: 2
+ *  cardano_json_writer_write_uint(writer, 3);         // Add element: 3
+ *  cardano_json_writer_write_end_array(writer);          // End array: ]
+ *  cardano_json_writer_write_end_object(writer);         // End object: }
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128];
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    printf("Error: %s\n", cardano_json_writer_get_last_error(writer));
+ *
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //  "numbers": [1, 2, 3]
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * }
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_start_array(
+  cardano_json_writer_t* writer);
+
+/**
+ * \brief Ends a JSON array in the output.
+ *
+ * This function writes the closing bracket (`]`) of a JSON array, marking the end
+ * of the array structure. It must be preceded by a corresponding call to
+ * \ref cardano_json_writer_write_start_array.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ *
+ * \pre The JSON writer must currently be in an array context. Calling this function
+ *   outside an array context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *   printf("Failed to create JSON writer.\n");
+ *   return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object containing an array
+ *  cardano_json_writer_write_start_object(writer);      // Start object: {
+ *  cardano_json_writer_write_property_name(writer, "items", 5);  // Property: "items"
+ *  cardano_json_writer_write_start_array(writer);       // Start array: [
+ *  cardano_json_writer_write_string(writer, "item1", 5);      // Add element: "item1"
+ *  cardano_json_writer_write_string(writer, "item2", 5);      // Add element: "item2"
+ *  cardano_json_writer_write_end_array(writer);         // End array: ]
+ *  cardano_json_writer_write_end_object(writer);        // End object: }
+ *
+ *  char buffer[128];
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *   printf("Buffer size is too small for the JSON output.\n");
+ *   cardano_json_writer_unref(&writer);
+ *   return -1;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return -1;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "items": ["item1", "item2"]
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_end_array(cardano_json_writer_t* writer);
+
+/**
+ * \brief Begins a JSON object in the output.
+ *
+ * This function writes the opening curly brace (`{`) of a JSON object. After calling
+ * this function, subsequent calls to writer functions can add properties (key-value pairs)
+ * to the object. The object must be closed with \ref cardano_json_writer_write_end_object
+ * to produce a valid JSON structure.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *   (e.g., after a property name in another object or as an element in an array).
+ *   Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object
+ *  cardano_json_writer_write_start_object(writer);       // Start object: {
+ *  cardano_json_writer_write_property_name(writer, "name", 4); // Property: "name"
+ *  cardano_json_writer_write_string(writer, "John Doe", 8);    // Value: "John Doe"
+ *  cardano_json_writer_write_property_name(writer, "age", 3);  // Property: "age"
+ *  cardano_json_writer_write_uint(writer, 30);        // Value: 30
+ *  cardano_json_writer_write_end_object(writer);      // End object: }
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128];
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    printf("Error: %s\n", cardano_json_writer_get_last_error(writer));
+ *
+ *    cardano_json_writer_unref(&writer);
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "name": "John Doe",
+ *  //   "age": 30
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_start_object(
+  cardano_json_writer_t* writer);
+
+/**
+ * \brief Ends a JSON object in the output.
+ *
+ * This function writes the closing curly brace (`}`) of a JSON object, marking the
+ * end of the object structure. It must be preceded by a corresponding call to
+ * \ref cardano_json_writer_write_start_object.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ *
+ * \pre The JSON writer must currently be in an object context. Calling this function
+ *   outside an object context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object
+ *  cardano_json_writer_write_start_object(writer);       // Start object: {
+ *  cardano_json_writer_write_property_name(writer, "name", 4); // Property: "name"
+ *  cardano_json_writer_write_string(writer, "Alice", 5);    // Value: "Alice"
+ *  cardano_json_writer_write_property_name(writer, "age", 3);  // Property: "age"
+ *  cardano_json_writer_write_uint(writer, 25);        // Value: 25
+ *  cardano_json_writer_write_end_object(writer);      // End object: }
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128] = { 0 };
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    printf("Error: %s\n", cardano_json_writer_get_last_error(writer));
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "name": "Alice",
+ *  //   "age": 25
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_end_object(cardano_json_writer_t* writer);
+
+/**
+ * \brief Writes a raw JSON value directly to the output.
+ *
+ * This function writes a raw JSON value to the output. The provided data must be
+ * a syntactically valid JSON value (e.g., a number, a string, a boolean, or a null).
+ * The JSON writer does not perform validation on the raw data; it assumes the caller
+ * has ensured the correctness of the value.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ * \param[in] data A pointer to the raw JSON value as a string. The string does not
+ *        need to be null-terminated, as its length is specified separately.
+ * \param[in] size The size of the raw JSON value in bytes.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *   (e.g., after a property name in an object or as an element in an array).
+ *   Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * \warning The caller is responsible for ensuring the raw value is a valid JSON value.
+ *    Invalid data may result in syntactically incorrect JSON output.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *  printf("Failed to create JSON writer.\n");
+ *  return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object
+ *  cardano_json_writer_write_start_object(writer);       // Start object: {
+ *  cardano_json_writer_write_property_name(writer, "rawData", 7); // Property: "rawData"
+ *  cardano_json_writer_write_raw_value(writer, "[1, 2, 3]", 9);   // Write raw value: [1, 2, 3]
+ *  cardano_json_writer_write_end_object(writer);         // End object: }
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128] = { 0 };
+ *
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *    return -1;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    cardano_json_writer_unref(&writer);
+ *    return -1;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //  "rawData": [1, 2, 3]
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_raw_value(
+  cardano_json_writer_t* writer,
+  const char*            data,
+  size_t                 size);
+
+/**
+ * \brief Writes a JSON object to the writer.
+ *
+ * This function serializes the contents of the provided \ref cardano_json_object_t
+ * and writes it to the output stream managed by the writer.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ * \param[in] object A pointer to the \ref cardano_json_object_t to be written.
+ */
+CARDANO_EXPORT void cardano_json_writer_write_object(
+  cardano_json_writer_t* writer,
+  cardano_json_object_t* object);
+
+/**
+ * \brief Writes an unsigned integer value to the JSON output.
+ *
+ * This function writes an unsigned integer (\c uint64_t) as a JSON value.
+ * The value is written in its numeric representation, which is valid for all
+ * JSON parsers.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ * \param[in] value The unsigned integer value to be written.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *   (e.g., after a property name in an object or as an element in an array).
+ *   Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object
+ *  cardano_json_writer_write_start_object(writer);        // Start object
+ *  cardano_json_writer_write_property_name(writer, "count", 5); // Property: "count"
+ *  cardano_json_writer_write_uint(writer, 123456);        // Value: 123456
+ *  cardano_json_writer_write_end_object(writer);       // End object
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128] = { 0 };
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "count": 123456
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_uint(
+  cardano_json_writer_t* writer,
+  uint64_t               value);
+
+/**
+ * \brief Writes an unsigned integer value to the JSON output.
+ *
+ * This function writes an unsigned integer (\c uint64_t) as a JSON string value.
+ * The value is written in its numeric representation as a string.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ * \param[in] value The unsigned integer value to be written.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *   (e.g., after a property name in an object or as an element in an array).
+ *   Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object
+ *  cardano_json_writer_write_start_object(writer);        // Start object
+ *  cardano_json_writer_write_property_name(writer, "count", 5); // Property: "count"
+ *  cardano_json_writer_write_uint(writer, 123456);        // Value: "123456"
+ *  cardano_json_writer_write_end_object(writer);       // End object
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128] = { 0 };
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "count": "123456"
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_uint_as_string(
+  cardano_json_writer_t* writer,
+  uint64_t               value);
+
+/**
+ * \brief Writes an signed integer value to the JSON output.
+ *
+ * This function writes an signed integer (\c int64_t) as a JSON value.
+ * The value is written in its numeric representation, which is valid for all
+ * JSON parsers.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ * \param[in] value The signed integer value to be written.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *   (e.g., after a property name in an object or as an element in an array).
+ *   Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object
+ *  cardano_json_writer_write_start_object(writer);        // Start object
+ *  cardano_json_writer_write_property_name(writer, "count", 5); // Property: "count"
+ *  cardano_json_writer_write_signed_int(writer, -123456);    // Value: -123456
+ *  cardano_json_writer_write_end_object(writer);       // End object
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128] = { 0 };
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "count": -123456
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_signed_int(
+  cardano_json_writer_t* writer,
+  int64_t                value);
+
+/**
+ * \brief Writes an signed integer value to the JSON output.
+ *
+ * This function writes an signed integer (\c int64_t) as a JSON string value.
+ * The value is written in its numeric representation as a string.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ * \param[in] value The signed integer value to be written.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *   (e.g., after a property name in an object or as an element in an array).
+ *   Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object
+ *  cardano_json_writer_write_start_object(writer);        // Start object
+ *  cardano_json_writer_write_property_name(writer, "count", 5); // Property: "count"
+ *  cardano_json_writer_write_signed_int_as_string(writer, -123456);    // Value: "-123456"
+ *  cardano_json_writer_write_end_object(writer);       // End object
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128] = { 0 };
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "count": "-123456"
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_signed_int_as_string(
+  cardano_json_writer_t* writer,
+  int64_t                value);
+
+/**
+ * \brief Writes a double-precision floating-point value to the JSON output.
+ *
+ * This function writes a double-precision floating-point number (\c double) as a JSON value.
+ * The value is written in its numeric representation, conforming to JSON's number format.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ * \param[in] value The double value to be written.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *   (e.g., after a property name in an object or as an element in an array).
+ *   Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object
+ *  cardano_json_writer_write_start_object(writer);           // Start object: {
+ *  cardano_json_writer_write_property_name(writer, "pi", 2); // Property: "pi"
+ *  cardano_json_writer_write_double(writer, 3.14159265359);  // Value: 3.14159265359
+ *  cardano_json_writer_write_property_name(writer, "e", 1);  // Property: "e"
+ *  cardano_json_writer_write_double(writer, 2.71828182845);  // Value: 2.71828182845
+ *  cardano_json_writer_write_end_object(writer);             // End object: }
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128] = { 0 };
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    printf("Error: %s\n", cardano_json_writer_get_last_error(writer));
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "pi": 3.14159265359,
+ *  //   "e": 2.71828182845
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_double(
+  cardano_json_writer_t* writer,
+  double                 value);
+
+/**
+ * \brief Writes a double-precision floating-point value to the JSON output.
+ *
+ * This function writes a double-precision floating-point number (\c double) as a string JSON value.
+ * The value is written in its numeric representation as a string.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *          This must be a valid, non-NULL JSON writer.
+ * \param[in] value The double value to be written.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *   (e.g., after a property name in an object or as an element in an array).
+ *   Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *    calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *    Once an error occurs, the writer enters an error state, and subsequent calls
+ *    to writer functions will have no effect.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object
+ *  cardano_json_writer_write_start_object(writer);           // Start object: {
+ *  cardano_json_writer_write_property_name(writer, "pi", 2); // Property: "pi"
+ *  cardano_json_writer_write_double_as_string(writer, "3.14159265359");  // Value: 3.14159265359
+ *  cardano_json_writer_write_property_name(writer, "e", 1);  // Property: "e"
+ *  cardano_json_writer_write_double_as_string(writer, "2.71828182845");  // Value: 2.71828182845
+ *  cardano_json_writer_write_end_object(writer);             // End object: }
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128] = { 0 };
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *    printf("Buffer size is too small for the JSON output.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    printf("Error: %s\n", cardano_json_writer_get_last_error(writer));
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "pi": "3.14159265359",
+ *  //   "e": "2.71828182845"
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_double_as_string(
+  cardano_json_writer_t* writer,
+  double                 value);
+
+/**
+ * \brief Writes the contents of a buffer as a JSON string (hex encoded).
+ *
+ * This function converts the binary data from the \ref cardano_buffer_t into its
+ * hexadecimal string representation and writes it to the JSON output enclosed in quotes.
+ *
+ * \note If memory allocation for the hex string fails or the buffer-to-hex
+ * conversion fails, this function will set the \p writer's last error
+ * and return without writing to the JSON stream.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ * \param[in] value  The \ref cardano_buffer_t containing the binary data to be written.
+ */
+CARDANO_EXPORT void
+cardano_json_writer_write_buffer_as_hex(
+  cardano_json_writer_t*  writer,
+  const cardano_buffer_t* value);
+
+/**
+ * \brief Writes a raw byte array as a JSON string (hex encoded).
+ *
+ * \note If the \p bytes pointer is NULL, \p bytes_size is 0, or memory allocation
+ * for the temporary buffer fails, this function will set the \p writer's last error
+ * and return without writing to the JSON stream.
+ *
+ * \param[in] writer     A pointer to the \ref cardano_json_writer_t instance.
+ * \param[in] bytes      A pointer to the raw byte array to be written.
+ * \param[in] bytes_size The number of bytes in the \p bytes array.
+ */
+CARDANO_EXPORT void
+cardano_json_writer_write_bytes_as_hex(
+  cardano_json_writer_t* writer,
+  const byte_t*          bytes,
+  size_t                 bytes_size);
+
+/**
+ * \brief Writes a raw byte array as a quoted Bech32 string to the JSON output.
+ *
+ * This function is a utility helper that converts a raw byte payload (hash or address data)
+ * into a Bech32 string using the specified Human-Readable Part (HRP) and writes the result
+ * as a JSON string literal (enclosed in quotes).
+ *
+ * \param[in] writer     A pointer to the \ref cardano_json_writer_t instance.
+ * \param[in] hrp        The Human-Readable Part (HRP/prefix) for the Bech32 encoding (e.g., "stake1", "pool1").
+ * \param[in] hrp_length The length of the HRP string.
+ * \param[in] bytes      The raw byte array (data payload) to be encoded.
+ * \param[in] bytes_size The size of the raw byte array.
+ */
+CARDANO_EXPORT void
+cardano_json_writer_write_bytes_as_bech32(
+  cardano_json_writer_t* writer,
+  const char*            hrp,
+  size_t                 hrp_length,
+  const byte_t*          bytes,
+  size_t                 bytes_size);
+
+/**
+ * \brief Writes a raw byte array as a quoted Bech32 string to the JSON output.
+ *
+ * This function is a utility helper that converts a raw byte payload (hash or address data)
+ * into a Bech32 string using the specified Human-Readable Part (HRP) and writes the result
+ * as a JSON string literal (enclosed in quotes).
+ *
+ * \param[in] writer     A pointer to the \ref cardano_json_writer_t instance.
+ * \param[in] hrp        The Human-Readable Part (HRP/prefix) for the Bech32 encoding (e.g., "stake1", "pool1").
+ * \param[in] hrp_length The length of the HRP string.
+ * \param[in] value      The \ref cardano_buffer_t containing the binary data to be written.
+ */
+CARDANO_EXPORT void
+cardano_json_writer_write_buffer_as_bech32(
+  cardano_json_writer_t*  writer,
+  const char*             hrp,
+  size_t                  hrp_length,
+  const cardano_buffer_t* value);
+
+/**
+ * \brief Writes a string value to the JSON output.
+ *
+ * This function writes a string value to the JSON output. The string will be enclosed
+ * in double quotes and any necessary escaping for special characters (e.g., quotes, backslashes)
+ * will be handled automatically by the writer.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *                   This must be a valid, non-NULL JSON writer.
+ * \param[in] value A pointer to the string to be written. The string does not need
+ *                  to be null-terminated, as its length is specified separately.
+ * \param[in] value_size The size of the string in bytes.
+ *
+ * \pre The JSON writer must currently be in a valid context for writing a value
+ *      (e.g., after a property name in an object or as an element in an array).
+ *      Calling this function in an invalid context will result in deferred error reporting.
+ *
+ * \note If an error occurs during this function, the error is deferred until the user
+ *       calls \ref cardano_json_writer_encode or \ref cardano_json_writer_encode_in_buffer.
+ *       Once an error occurs, the writer enters an error state, and subsequent calls
+ *       to writer functions will have no effect.
+ *
+ * \note The writer will handle UTF-8 encoded strings. It is the caller's responsibility
+ *       to ensure that the input string is valid UTF-8.
+ *
+ * Usage Example:
+ * \code{.c}
+ *  // Create a new JSON writer
+ *  cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ *  if (writer == NULL)
+ *  {
+ *    printf("Failed to create JSON writer.\n");
+ *    printf("Error: %s\n", cardano_json_writer_get_last_error(writer));
+
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  // Start writing a JSON object
+ *  cardano_json_writer_write_start_object(writer);                // Start object: {
+ *  cardano_json_writer_write_property_name(writer, "message", 7); // Property: "message"
+ *  cardano_json_writer_write_string(writer, "Hello, World!", 13); // Value: "Hello, World!"
+ *  cardano_json_writer_write_end_object(writer);                  // End object: }
+ *
+ *  // Encode and print the resulting JSON
+ *  char buffer[128] = { 0 };
+ *  size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ *  if (encoded_size > sizeof(buffer))
+ *  {
+ *   printf("Buffer size is too small for the JSON output.\n");
+ *   printf("Error: %s\n", cardano_json_writer_get_last_error(writer));
+ *
+ *   cardano_json_writer_unref(&writer);
+ *
+ *   return EXIT_FAILURE;
+ *  }
+ *
+ *  cardano_error_t result = cardano_json_writer_encode(writer, (byte_t*)buffer, sizeof(buffer));
+ *
+ *  if (result != CARDANO_SUCCESS)
+ *  {
+ *    printf("Failed to encode JSON.\n");
+ *    cardano_json_writer_unref(&writer);
+ *
+ *    return EXIT_FAILURE;
+ *  }
+ *
+ *  printf("%s\n", buffer);
+ *
+ *  // Example output:
+ *  // {
+ *  //   "message": "Hello, World!"
+ *  // }
+ *
+ *  // Clean up
+ *  cardano_json_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_json_writer_write_string(
+  cardano_json_writer_t* writer,
+  const char*            value,
+  size_t                 value_size);
+
+/**
+ * \brief Gets the current context of the JSON writer.
+ *
+ * This function retrieves the current context of the JSON writer, indicating whether
+ * the writer is in a root state (brand new with no written output), inside an object,
+ * or inside an array. This information can be used by objects or arrays that write
+ * themselves to determine whether to initialize the root object or continue writing
+ * within an existing context.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance.
+ *                   This must be a valid, non-NULL JSON writer.
+ *
+ * \return A \ref cardano_json_context_t value representing the current context:
+ *         - \c CARDANO_JSON_CONTEXT_ROOT: The writer is in the root state (no context set, no output started).
+ *         - \c CARDANO_JSON_CONTEXT_OBJECT: The writer is inside an object.
+ *         - \c CARDANO_JSON_CONTEXT_ARRAY: The writer is inside an array.
+ *
+ * \note If the writer is in an error state or is NULL, the function returns \c CARDANO_JSON_CONTEXT_ROOT.
+ *
+ * Usage Example:
+ * \code{.c}
+ *
+ *  cardano_json_context_t context = cardano_json_writer_get_context(writer);
+ *
+ *  if (context == CARDANO_JSON_CONTEXT_ROOT)
+ *  {
+ *    cardano_json_writer_write_start_object(writer);
+ *  }
+ *
+ *  cardano_json_writer_write_property_name(writer, "key", 3);
+ *  cardano_json_writer_write_string(writer, "value", 5);
+ *
+ *  if (context == CARDANO_JSON_CONTEXT_ROOT)
+ *  {
+ *    // Close the root object if we opened it
+ *    cardano_json_writer_write_end_object(writer);
+ *  }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_json_context_t cardano_json_writer_get_context(cardano_json_writer_t* writer);
+
+/**
+ * \brief Calculates the required buffer size for the encoded data.
+ *
+ * This function determines the size of the buffer needed to store the  data encoded by the writer.
+ * It is intended to be used before calling `cardano_json_writer_encode` to allocate a buffer of appropriate size.
+ *
+ * \param[in] writer The source writer whose encoded data size is being calculated.
+ *
+ * \return The size of the buffer required to store the writer's encoded data. Returns 0 if the writer is NULL
+ * or contains no data.
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ * // Assume writer has been used to encode some JSON data here
+ *
+ * size_t required_size = cardano_json_writer_get_encoded_size(writer);
+ *
+ * // Now required_size can be used to allocate a buffer of appropriate size
+ * byte_t* data = (byte_t*)malloc(required_size);
+ *
+ * if (byte_t != NULL)
+ * {
+ *   if (cardano_json_writer_encode(writer, data, required_size) == CARDANO_SUCCESS)
+ *   {
+ *     // Operate on the encoded data
+ *   }
+ *
+ *   free(data); // Free the allocated string after use
+ * }
+ *
+ * cardano_json_writer_unref(&writer); // Properly dispose of the writer after use
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_json_writer_get_encoded_size(cardano_json_writer_t* writer);
+
+/**
+ * \brief Encodes data from the writer's context into JSON format and outputs it to a provided buffer.
+ *
+ * This function encodes data prepared in the writer's internal context into JSON format and writes it into an output
+ * buffer specified by the caller.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t structure representing the context and state for the JSON encoding
+ *          operation.
+ * \param[in] data A pointer to a byte array where the encoded data will be written. The function will fill this buffer with
+ *        the JSON-encoded data.
+ * \param[in] size The size of the data byte array, indicating how much space is available for writing the encoded data.
+ *
+ * \return A cardano_error_t indicating the outcome of the operation. Returns CARDANO_SUCCESS if the data is successfully
+ *      encoded into JSON format and stored in the provided buffer. If the operation fails, an error code is returned indicating
+ *      the specific reason for failure. Detailed information on possible error codes and their meanings can be found in the
+ *      cardano_error_t documentation.
+ *
+ * \code{.c}
+ * cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ * byte_t buffer[256]; // Pre-allocated buffer with sufficient space for the encoded data
+ *
+ * cardano_error_t result = cardano_json_writer_encode(writer, buffer, sizeof(buffer));
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Encoded JSON data successfully. Bytes written: %zu\n", sizeof(buffer));
+ * }
+ * else
+ * {
+ *   printf("Failed to encode JSON data. Error code: %d\n", result);
+ * }
+ *
+ * cardano_json_writer_unref(&writer); // Properly dispose of the writer after use
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_json_writer_encode(
+  cardano_json_writer_t* writer,
+  char*                  data,
+  size_t                 size);
+
+/**
+ * \brief Encodes data from the writer's context into JSON format and outputs it into a new buffer.
+ *
+ * This function encodes data prepared in the writer's internal context into JSON format and writes it into a
+ * buffer. The function will create a new buffer instance to store the encoded data.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t structure representing the context and state for the JSON encoding
+ *          operation.
+ * \param[out] buffer A pointer to a \ref cardano_buffer_t object where the encoded data will be stored. The function will allocate
+ *        and fill this buffer with the JSON-encoded data. It is best to initialize this pointer as NULL. The caller is
+ *        responsible for managing the lifecycle of the buffer, specifically releasing it by calling \ref cardano_buffer_unref
+ *        when it is no longer needed.
+ *
+ * \return A cardano_error_t indicating the outcome of the operation. Returns CARDANO_SUCCESS if the data is successfully
+ *      encoded into JSON format and stored in the provided buffer. If the operation fails, an error code is returned indicating
+ *      the specific reason for failure. Detailed information on possible error codes and their meanings can be found in the
+ *      cardano_error_t documentation.
+ *
+ * \code{.c}
+ * cardano_json_writer_t* writer = cardano_json_writer_new();
+ * cardano_buffer_t* buffer = NULL; // Buffer will be allocated by the function
+ *
+ * cardano_error_t result = cardano_json_writer_encode_in_buffer(writer, &buffer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Encoded JSON data successfully. Bytes written: %zu\n", cardano_buffer_get_size(buffer));
+ * }
+ * else
+ * {
+ *   printf("Failed to encode JSON data. Error code: %d\n", result);
+ * }
+ *
+ * cardano_buffer_unref(&buffer); // Properly dispose of the buffer after use
+ * cardano_json_writer_unref(&writer); // Properly dispose of the writer after use
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_json_writer_encode_in_buffer(
+  cardano_json_writer_t* writer,
+  cardano_buffer_t**     buffer);
+
+/**
+ * \brief Resets the writer, clearing all written data.
+ *
+ * This function resets the internal state of the JSON writer, effectively removing any data that has been written to it.
+ * This is useful for reusing a writer instance without needing to create a new one, especially when working with
+ * sequences of data encoding tasks.
+ *
+ * \param[in] writer The JSON writer instance to reset.
+ *
+ * \return A cardano_error_t indicating the outcome of the operation. CARDANO_SUCCESS is returned if the writer is
+ *      successfully reset. If the operation fails, an error code is returned that indicates the specific reason for
+ *      failure. For detailed information on possible error codes and their meanings, consult the cardano_error_t
+ *      documentation.
+ *
+ * \code{.c}
+ * cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ * // Write some data to the writer here
+ *
+ * cardano_error_t reset_result = cardano_json_writer_reset(writer);
+ *
+ * if (reset_result == CARDANO_SUCCESS)
+ * {
+ *  printf("Writer reset successfully.\n");
+ * }
+ * else
+ * {
+ *  printf("Failed to reset writer. Error code: %d\n", reset_result);
+ * }
+ * // The writer can now be reused for new data without creating a new instance
+ *
+ * cardano_json_writer_unref(&writer); // Clean up when done using the writer
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_json_writer_reset(cardano_json_writer_t* writer);
+
+/**
+ * \brief Decrements the reference count of a JSON writer object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_json_writer_t object
+ * by decreasing its reference count. When the reference count reaches zero, the JSON writer is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] json_writer A pointer to the pointer of the JSON writer object. This double
+ *             indirection allows the function to set the caller's pointer to
+ *             NULL, avoiding dangling pointer issues after the object has been
+ *             freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_json_writer_t* writer = cardano_json_writer_new();
+ *
+ * // Perform operations with the writer...
+ *
+ * cardano_json_writer_unref(&writer);
+ * // At this point, writer is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_json_writer_unref, the pointer to the \ref cardano_json_writer_t object
+ *    will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_json_writer_unref(cardano_json_writer_t** json_writer);
+
+/**
+ * \brief Increases the reference count of the cardano_json_writer_t object.
+ *
+ * This function is used to manually increment the reference count of a JSON writer
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_json_writer_unref.
+ *
+ * \param json_writer A pointer to the JSON writer object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming writer is a previously created JSON writer object
+ *
+ * cardano_json_writer_ref(writer);
+ *
+ * // Now writer can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_json_writer_ref there is a corresponding
+ * call to \ref cardano_json_writer_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_json_writer_ref(cardano_json_writer_t* json_writer);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_json_writer_t object.
+ *
+ * This function returns the number of active references to a JSON writer object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_json_writer_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param json_writer A pointer to the JSON writer object whose reference count is queried.
+ *        The object must not be NULL.
+ *
+ * \return The number of active references to the specified JSON writer object. If the object
+ * is properly managed (i.e., every \ref cardano_json_writer_ref call is matched with a
+ * \ref cardano_json_writer_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming writer is a previously created JSON writer object
+ *
+ * size_t ref_count = cardano_json_writer_refcount(writer);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_json_writer_refcount(const cardano_json_writer_t* json_writer);
+
+/**
+ * \brief Sets the last error message for a given JSON writer object.
+ *
+ * Records an error message in the JSON writer's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance whose last error message is
+ *          to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the writer's
+ *        last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_json_writer_set_last_error(cardano_json_writer_t* writer, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific writer.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_json_writer_set_last_error for the given
+ * writer. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] writer A pointer to the \ref cardano_json_writer_t instance whose last error
+ *          message is to be retrieved. If the writer is NULL, the function
+ *          returns a generic error message indicating the null writer.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *      message for the specified writer. If the writer is NULL, "Object is NULL."
+ *      is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *    must not be modified by the caller. The string remains valid until the
+ *    next call to \ref cardano_json_writer_set_last_error for the same writer, or until
+ *    the writer is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_json_writer_get_last_error(const cardano_json_writer_t* writer);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_json_writer_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_json_writer_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_json_writer_deep_clone(const cardano_json_writer_t* source, cardano_json_writer_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_JSON_WRITER_H
diff --git a/vendor/include/cardano/key_handlers/account_derivation_path.h b/vendor/include/cardano/key_handlers/account_derivation_path.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/key_handlers/account_derivation_path.h
@@ -0,0 +1,75 @@
+/**
+ * \file account_derivation_path.h
+ *
+ * \author angel.castillo
+ * \date   Oct 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ACCOUNT_DERIVATION_PATH_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ACCOUNT_DERIVATION_PATH_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief BIP44 account derivation path.
+ */
+typedef struct cardano_account_derivation_path_t
+{
+    /**
+     * \brief Purpose is a constant set to either 1852' (standard wallets) or 1854' (multisig wallets).
+     *
+     * Hardened derivation is used at this level.
+     */
+    uint64_t purpose;
+
+    /**
+     * \brief One master node (seed) can be used for unlimited number of independent cryptocoins such as Bitcoin, Litecoin or Namecoin.
+     * However, sharing the same space for various cryptocoins has some disadvantages.
+     *
+     * This level creates a separate subtree for every cryptocoin, avoiding reusing addresses across cryptocoins and improving privacy issues.
+     *
+     * Coin type is a constant, set for each cryptocoin. Cryptocoin developers may ask for registering unused number for their project.
+     *
+     * \remark The coin value for Cardano is 1815 (Ada Lovelace year of birth).
+     *
+     * Hardened derivation is used at this level.
+     */
+    uint64_t coin_type;
+
+    /**
+     * \brief Accounts are numbered from index 0 in sequentially increasing manner.
+     *
+     * This number is used as a child index in BIP32 derivation.
+     *
+     * Hardened derivation is used at this level.
+     */
+    uint64_t account;
+} cardano_account_derivation_path_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ACCOUNT_DERIVATION_PATH_H
diff --git a/vendor/include/cardano/key_handlers/cip_1852_constants.h b/vendor/include/cardano/key_handlers/cip_1852_constants.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/key_handlers/cip_1852_constants.h
@@ -0,0 +1,87 @@
+/**
+ * \file cip_1852_constants.h
+ *
+ * \author angel.castillo
+ * \date   Oct 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CIP_1852_CONSTANTS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CIP_1852_CONSTANTS_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* COIN TYPE *****************************************************************/
+
+/**
+ * \brief The coin_type value for Cardano is 1815 (Ada Lovelace year of birth).
+ */
+#define CARDANO_CIP_1852_COIN_TYPE (1815U)
+
+/* PURPOSE *******************************************************************/
+
+/**
+ * \brief To associate standard wallet key derivation purpose.
+ */
+#define CARDANO_CIP_1852_PURPOSE_STANDARD (1852U)
+
+/**
+ * \brief To associate multi-signature keys to a wallet, CIP-1854 reserves
+ * purpose=1854' to distinguish multisig wallets from standard wallets.
+ */
+#define CARDANO_CIP_1852_PURPOSE_MULTI_SIG (1854U)
+
+/* ROLES *********************************************************************/
+
+/**
+ * \brief External chain role.
+ */
+#define CARDANO_CIP_1852_ROLE_EXTERNAL (0U)
+
+/**
+ * \brief Internal chain role.
+ */
+#define CARDANO_CIP_1852_ROLE_INTERNAL (1U)
+
+/**
+ * \brief Staking Key role.
+ */
+#define CARDANO_CIP_1852_ROLE_STAKING (2U)
+
+/**
+ * \brief DRep Key (CIP-0105) role.
+ */
+#define CARDANO_CIP_1852_ROLE_DREP (3U)
+
+/**
+ * \brief Constitutional Committee Cold Key (CIP-0105) role.
+ */
+#define CARDANO_CIP_1852_ROLE_CC_COLD (4U)
+
+/**
+ * \brief Constitutional Committee Hot Key (CIP-0105) role.
+ */
+#define CARDANO_CIP_1852_ROLE_CC_HOT (5U)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CIP_1852_CONSTANTS_H
diff --git a/vendor/include/cardano/key_handlers/derivation_path.h b/vendor/include/cardano/key_handlers/derivation_path.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/key_handlers/derivation_path.h
@@ -0,0 +1,97 @@
+/**
+ * \file derivation_path.h
+ *
+ * \author angel.castillo
+ * \date   Oct 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_DERIVATION_PATH_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_DERIVATION_PATH_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Cardano extends the BIP44 by adding new chains used for different purposes.
+ * It defines 5 levels in BIP32 path: m / purpose' / coin_type' / account' / role / index.
+ */
+typedef struct cardano_derivation_path_t
+{
+    /**
+     * \brief Purpose is a constant set to either 1852' (standard wallets) or 1854' (multisig wallets).
+     *
+     * Hardened derivation is used at this level.
+     */
+    uint64_t purpose;
+
+    /**
+     * \brief One master node (seed) can be used for unlimited number of independent cryptocoins such as Bitcoin, Litecoin or Namecoin.
+     * However, sharing the same space for various cryptocoins has some disadvantages.
+     *
+     * This level creates a separate subtree for every cryptocoin, avoiding reusing addresses across cryptocoins and improving privacy issues.
+     *
+     * Coin type is a constant, set for each cryptocoin. Cryptocoin developers may ask for registering unused number for their project.
+     *
+     * \remark The coin value for Cardano is 1815 (Ada Lovelace year of birth).
+     *
+     * Hardened derivation is used at this level.
+     */
+    uint64_t coin_type;
+
+    /**
+     * \brief Accounts are numbered from index 0 in sequentially increasing manner.
+     *
+     * This number is used as a child index in BIP32 derivation.
+     *
+     * Hardened derivation is used at this level.
+     */
+    uint64_t account;
+
+    /**
+     * \brief The role as of Conway era can be one of the followings:
+     *
+     * - External chain (0): Same as defined in BIP44.
+     * - Internal chain (1): Same as defined in BIP44.
+     * - Staking Key (2): See CIP-0011.
+     * - DRep Key (3): See CIP-0105.
+     * - Constitutional Committee Cold Key (4): See CIP-0105.
+     * - Constitutional Committee Hot Key (5): See CIP-0105.
+     *
+     * Non-hardened derivation is used at this level.
+     */
+    uint64_t role;
+
+    /**
+     * \brief The index is the last part of the derivation path.
+     *
+     * Non-hardened derivation is used at this level.
+     */
+    uint64_t index;
+} cardano_derivation_path_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_DERIVATION_PATH_H
diff --git a/vendor/include/cardano/key_handlers/secure_key_handler.h b/vendor/include/cardano/key_handlers/secure_key_handler.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/key_handlers/secure_key_handler.h
@@ -0,0 +1,450 @@
+/**
+ * \file secure_key_handler.h
+ *
+ * \author angel.castillo
+ * \date   Oct 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SECURE_KEY_HANDLER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SECURE_KEY_HANDLER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+#include <cardano/key_handlers/account_derivation_path.h>
+#include <cardano/key_handlers/secure_key_handler_impl.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Opaque type definition for the secure key handler.
+ *
+ * `cardano_secure_key_handler_t` is an opaque structure representing a secure key handler. This handler abstracts the management of
+ * cryptographic key operations for both BIP32 (HD) and Ed25519 key types, ensuring that sensitive key material is managed securely.
+ * The internal details of this structure are hidden from users of the API, who interact with it through
+ * the provided API functions.
+ */
+typedef struct cardano_secure_key_handler_t cardano_secure_key_handler_t;
+
+/**
+ * \brief Creates a new `cardano_secure_key_handler_t` object using the provided implementation.
+ *
+ * This function initializes a new \ref cardano_secure_key_handler_t object by wrapping the given
+ * \ref cardano_secure_key_handler_impl_t implementation. The newly created secure_key_handler object manages
+ * the lifecycle of the underlying implementation and provides an interface for interacting
+ * with cryptographic keys securely.
+ *
+ * \param[in]  impl     The secure_key_handler implementation containing function pointers and context.
+ * \param[out] secure_key_handler A pointer to store the address of the newly created secure_key_handler object.
+ *                      This should be a valid pointer to a \ref cardano_secure_key_handler_t* variable.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume 'impl' is a valid cardano_secure_key_handler_impl_t initialized elsewhere.
+ * cardano_secure_key_handler_t* secure_key_handler = NULL;
+ * cardano_error_t result = cardano_secure_key_handler_new(impl, &secure_key_handler);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the secure_key_handler
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // When done with the secure_key_handler
+ * cardano_secure_key_handler_unref(&secure_key_handler);
+ * \endcode
+ *
+ * \note After successfully creating a \ref cardano_secure_key_handler_t object, you are responsible for
+ *       managing its lifecycle. Ensure that you call \ref cardano_secure_key_handler_unref when the
+ *       secure_key_handler is no longer needed to release resources and prevent memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_secure_key_handler_new(cardano_secure_key_handler_impl_t impl, cardano_secure_key_handler_t** secure_key_handler);
+
+/**
+ * \brief Retrieves the name of the secure_key_handler implementation.
+ *
+ * This function returns a constant string representing the name of the secure_key_handler implementation.
+ * The name can be used for logging, debugging, or informational purposes to identify which
+ * secure_key_handler implementation is being used.
+ *
+ * \param[in] secure_key_handler Pointer to the \ref cardano_secure_key_handler_t object.
+ *
+ * \returns A constant character pointer to the secure_key_handler's name string.
+ *          The returned string is owned by the secure_key_handler and must not be modified or freed by the caller.
+ *          If the \p secure_key_handler is NULL or invalid, the function may return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* secure_key_handler_name = cardano_secure_key_handler_get_name(secure_key_handler);
+ *
+ * if (secure_key_handler_name)
+ * {
+ *   printf("Using secure_key_handler: %s\n", secure_key_handler_name);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve secure_key_handler name.\n");
+ * }
+ * \endcode
+ *
+ * \note The returned string remains valid as long as the \ref cardano_secure_key_handler_t object is valid.
+ *       Do not attempt to modify or free the returned string.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_secure_key_handler_get_name(const cardano_secure_key_handler_t* secure_key_handler);
+
+/**
+ * \brief Signs a transaction using BIP32 Hierarchical Deterministic (HD) keys.
+ *
+ * This function uses the `cardano_secure_key_handler_t` to securely manage the cryptographic key operations needed to
+ * sign a transaction using BIP32 (HD) keys. It derives the necessary private keys based on the provided `derivation_paths`
+ * and signs the transaction `tx`, generating a set of verification key witnesses (`vkey_witness_set`).
+ *
+ * \param[in] secure_key_handler A pointer to the secure key handler managing the cryptographic key operations.
+ * \param[in] tx The transaction object to be signed.
+ * \param[in] derivation_paths An array of BIP32 derivation paths used to derive the private keys for signing the transaction.
+ * \param[in] num_paths The number of derivation paths provided in the `derivation_paths` array.
+ * \param[out] vkey_witness_set A pointer to the verification key witness set that will be populated with the generated signatures.
+ *                         This set will contain the signatures and associated verification keys required for the transaction.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during signing.
+ *
+ * \note The caller is responsible for managing and releasing the `vkey_witness_set` to avoid memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_secure_key_handler_bip32_sign_transaction(
+  cardano_secure_key_handler_t*    secure_key_handler,
+  cardano_transaction_t*           tx,
+  const cardano_derivation_path_t* derivation_paths,
+  size_t                           num_paths,
+  cardano_vkey_witness_set_t**     vkey_witness_set);
+
+/**
+ * \brief Signs a sub transaction using BIP32 Hierarchical Deterministic (HD) keys.
+ *
+ * This function uses the `cardano_secure_key_handler_t` to securely manage the cryptographic key operations needed to
+ * sign a sub transaction using BIP32 (HD) keys. It derives the necessary private keys based on the provided `derivation_paths`
+ * and signs the id of the sub transaction `sub_tx` (the hash of its body), generating a set of verification key
+ * witnesses (`vkey_witness_set`).
+ *
+ * The sub transaction is not modified. The witnesses can be attached to it with \ref cardano_sub_transaction_apply_vkey_witnesses,
+ * which never changes the body nor the id of the sub transaction.
+ *
+ * \param[in] secure_key_handler A pointer to the secure key handler managing the cryptographic key operations.
+ * \param[in] sub_tx The sub transaction object to be signed.
+ * \param[in] derivation_paths An array of BIP32 derivation paths used to derive the private keys for signing the sub transaction.
+ * \param[in] num_paths The number of derivation paths provided in the `derivation_paths` array.
+ * \param[out] vkey_witness_set A pointer to the verification key witness set that will be populated with the generated signatures.
+ *                         This set will contain the signatures and associated verification keys required for the sub transaction.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during signing. If the secure key handler
+ *          implementation does not support signing sub transactions, \ref CARDANO_ERROR_NOT_IMPLEMENTED is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t*     vkey_witness_set = NULL;
+ * const cardano_derivation_path_t path             = { CARDANO_CIP_1852_PURPOSE_STANDARD, CARDANO_CIP_1852_COIN_TYPE, 0U, 0U, 0U };
+ *
+ * cardano_error_t result = cardano_secure_key_handler_bip32_sign_sub_transaction(secure_key_handler, sub_tx, &path, 1, &vkey_witness_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   result = cardano_sub_transaction_apply_vkey_witnesses(sub_tx, vkey_witness_set);
+ * }
+ *
+ * cardano_vkey_witness_set_unref(&vkey_witness_set);
+ * \endcode
+ *
+ * \note The caller is responsible for managing and releasing the `vkey_witness_set` to avoid memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_secure_key_handler_bip32_sign_sub_transaction(
+  cardano_secure_key_handler_t*    secure_key_handler,
+  cardano_sub_transaction_t*       sub_tx,
+  const cardano_derivation_path_t* derivation_paths,
+  size_t                           num_paths,
+  cardano_vkey_witness_set_t**     vkey_witness_set);
+
+/**
+ * \brief Retrieves the extended BIP32 account public key for a given derivation path.
+ *
+ * This function securely derives and retrieves the extended BIP32 account public key for the `cardano_secure_key_handler_t`. The extended
+ * BIP32 public key includes both the Ed25519 public key and chain code, enabling further key derivations within the BIP32 standard.
+ *
+ * \param[in] secure_key_handler A pointer to the secure key handler managing the cryptographic key operations.
+ * \param[in] derivation_path The BIP32 derivation path used to derive the extended account public key.
+ * \param[out] bip32_public_key A pointer to the extended BIP32 public key that will be retrieved and returned.
+ *                         The caller must manage the lifecycle of the returned `bip32_public_key` and release it when done.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during key retrieval.
+ *
+ * \note The caller is responsible for managing the lifecycle of the `bip32_public_key` object, ensuring it is properly released
+ *       to avoid memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_secure_key_handler_bip32_get_extended_account_public_key(
+  cardano_secure_key_handler_t*     secure_key_handler,
+  cardano_account_derivation_path_t derivation_path,
+  cardano_bip32_public_key_t**      bip32_public_key);
+
+/**
+ * \brief Signs a transaction using Ed25519 keys.
+ *
+ * This function securely signs the provided `tx` (transaction) using the Ed25519 keys managed by the `cardano_secure_key_handler_t`.
+ * The resulting witness set, containing the verification keys and signatures, is returned in the `vkey_witness_set`.
+ *
+ * \param[in] secure_key_handler A pointer to the secure key handler managing the Ed25519 cryptographic operations.
+ * \param[in] tx The transaction object to be signed.
+ * \param[out] vkey_witness_set A pointer to the verification key witness set that will be populated with the generated signatures.
+ *                         The caller must manage the lifecycle of the `vkey_witness_set` to avoid memory leaks.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during signing.
+ *
+ * \note This function does not support BIP32 hierarchical deterministic keys. It is intended for use with Ed25519 keys only.
+ * \note The caller is responsible for managing the lifecycle of the `vkey_witness_set` to ensure proper memory management.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_secure_key_handler_ed25519_sign_transaction(
+  cardano_secure_key_handler_t* secure_key_handler,
+  cardano_transaction_t*        tx,
+  cardano_vkey_witness_set_t**  vkey_witness_set);
+
+/**
+ * \brief Signs a sub transaction using Ed25519 keys.
+ *
+ * This function securely signs the id of the provided `sub_tx` (the hash of the sub transaction body) using the Ed25519 keys
+ * managed by the `cardano_secure_key_handler_t`. The resulting witness set, containing the verification keys and signatures,
+ * is returned in the `vkey_witness_set`.
+ *
+ * The sub transaction is not modified. The witnesses can be attached to it with \ref cardano_sub_transaction_apply_vkey_witnesses,
+ * which never changes the body nor the id of the sub transaction.
+ *
+ * \param[in] secure_key_handler A pointer to the secure key handler managing the Ed25519 cryptographic operations.
+ * \param[in] sub_tx The sub transaction object to be signed.
+ * \param[out] vkey_witness_set A pointer to the verification key witness set that will be populated with the generated signatures.
+ *                         The caller must manage the lifecycle of the `vkey_witness_set` to avoid memory leaks.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during signing. If the secure key handler
+ *          implementation does not support signing sub transactions, \ref CARDANO_ERROR_NOT_IMPLEMENTED is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t* vkey_witness_set = NULL;
+ *
+ * cardano_error_t result = cardano_secure_key_handler_ed25519_sign_sub_transaction(secure_key_handler, sub_tx, &vkey_witness_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   result = cardano_sub_transaction_apply_vkey_witnesses(sub_tx, vkey_witness_set);
+ * }
+ *
+ * cardano_vkey_witness_set_unref(&vkey_witness_set);
+ * \endcode
+ *
+ * \note This function does not support BIP32 hierarchical deterministic keys. It is intended for use with Ed25519 keys only.
+ * \note The caller is responsible for managing the lifecycle of the `vkey_witness_set` to ensure proper memory management.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_secure_key_handler_ed25519_sign_sub_transaction(
+  cardano_secure_key_handler_t* secure_key_handler,
+  cardano_sub_transaction_t*    sub_tx,
+  cardano_vkey_witness_set_t**  vkey_witness_set);
+
+/**
+ * \brief Retrieves the public key associated with the Ed25519 key.
+ *
+ * This function securely retrieves the Ed25519 public key from the `cardano_secure_key_handler_t`. The resulting public key
+ * is returned in the `public_key` parameter.
+ *
+ * \param[in] secure_key_handler A pointer to the secure key handler managing the Ed25519 cryptographic operations.
+ * \param[out] public_key A pointer to the location where the Ed25519 public key will be stored. The caller is responsible for managing
+ *                   the lifecycle of this object and must release it appropriately to avoid memory leaks.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during the retrieval.
+ *
+ * \note This function only handles Ed25519 public keys and does not support BIP32 keys.
+ * \note The caller is responsible for managing the lifecycle of the `public_key` to ensure proper memory management.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_secure_key_handler_ed25519_get_public_key(
+  cardano_secure_key_handler_t*  secure_key_handler,
+  cardano_ed25519_public_key_t** public_key);
+
+/**
+ * \brief Decrements the reference count of a cardano_secure_key_handler_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_secure_key_handler_t object
+ * by decreasing its reference count. When the reference count reaches zero, the secure_key_handler is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] secure_key_handler A pointer to the pointer of the secure_key_handler object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_secure_key_handler_t* secure_key_handler = cardano_secure_key_handler_new(major, minor);
+ *
+ * // Perform operations with the secure_key_handler...
+ *
+ * cardano_secure_key_handler_unref(&secure_key_handler);
+ * // At this point, secure_key_handler is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_secure_key_handler_unref, the pointer to the \ref cardano_secure_key_handler_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_secure_key_handler_unref(cardano_secure_key_handler_t** secure_key_handler);
+
+/**
+ * \brief Increases the reference count of the cardano_secure_key_handler_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_secure_key_handler_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_secure_key_handler_unref.
+ *
+ * \param secure_key_handler A pointer to the cardano_secure_key_handler_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming secure_key_handler is a previously created secure_key_handler object
+ *
+ * cardano_secure_key_handler_ref(secure_key_handler);
+ *
+ * // Now secure_key_handler can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_secure_key_handler_ref there is a corresponding
+ * call to \ref cardano_secure_key_handler_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_secure_key_handler_ref(cardano_secure_key_handler_t* secure_key_handler);
+
+/**
+ * \brief Serializes the state of a secure key handler.
+ *
+ * The `cardano_secure_key_handler_serialize` function serializes the internal state or key material associated
+ * with a secure key handler into a buffer. This allows the key handler to be stored or transferred in a secure, serialized format.
+ *
+ * This function is expected to:
+ * - Serialize the current state of the secure key handler into the provided `serialized_data` buffer.
+ *
+ * \param secure_key_handler A pointer to the secure key handler that manages cryptographic operations.
+ * \param serialized_data A pointer to the buffer that will be populated with the serialized state of the key handler.
+ *                        This buffer must be managed and freed by the caller to prevent memory leaks.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during serialization.
+ *
+ * \note The caller is responsible for releasing the serialized buffer after use to avoid memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_secure_key_handler_serialize(
+  cardano_secure_key_handler_t* secure_key_handler,
+  cardano_buffer_t**            serialized_data);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_secure_key_handler_t object.
+ *
+ * This function returns the number of active references to an cardano_secure_key_handler_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_secure_key_handler_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param secure_key_handler A pointer to the cardano_secure_key_handler_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_secure_key_handler_t object. If the object
+ * is properly managed (i.e., every \ref cardano_secure_key_handler_ref call is matched with a
+ * \ref cardano_secure_key_handler_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming secure_key_handler is a previously created secure_key_handler object
+ *
+ * size_t ref_count = cardano_secure_key_handler_refcount(secure_key_handler);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_secure_key_handler_refcount(const cardano_secure_key_handler_t* secure_key_handler);
+
+/**
+ * \brief Sets the last error message for a given cardano_secure_key_handler_t object.
+ *
+ * Records an error message in the secure_key_handler's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] secure_key_handler A pointer to the \ref cardano_secure_key_handler_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the secure_key_handler's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_secure_key_handler_set_last_error(
+  cardano_secure_key_handler_t* secure_key_handler,
+  const char*                   message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific secure_key_handler.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_secure_key_handler_set_last_error for the given
+ * secure_key_handler. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] secure_key_handler A pointer to the \ref cardano_secure_key_handler_t instance whose last error
+ *                   message is to be retrieved. If the secure_key_handler is NULL, the function
+ *                   returns a generic error message indicating the null secure_key_handler.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified secure_key_handler. If the secure_key_handler is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_secure_key_handler_set_last_error for the same secure_key_handler, or until
+ *       the secure_key_handler is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_secure_key_handler_get_last_error(const cardano_secure_key_handler_t* secure_key_handler);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SECURE_KEY_HANDLER_H
diff --git a/vendor/include/cardano/key_handlers/secure_key_handler_impl.h b/vendor/include/cardano/key_handlers/secure_key_handler_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/key_handlers/secure_key_handler_impl.h
@@ -0,0 +1,394 @@
+/**
+ * \file secure_key_handler_impl.h
+ *
+ * \author angel.castillo
+ * \date   Oct 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SECURE_KEY_HANDLER_IMPL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SECURE_KEY_HANDLER_IMPL_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/bip32_public_key.h>
+#include <cardano/crypto/ed25519_public_key.h>
+#include <cardano/key_handlers/account_derivation_path.h>
+#include <cardano/key_handlers/derivation_path.h>
+#include <cardano/key_handlers/secure_key_handler_type.h>
+#include <cardano/object.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/witness_set/vkey_witness_set.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* FORWARD DECLARATIONS *******************************************************/
+
+/**
+ * \brief Secure Key Handler Implementation for managing cryptographic key operations.
+ *
+ * The `cardano_secure_key_handler_impl_t` structure provides a collection of callbacks responsible for securely managing cryptographic key operations.
+ *
+ * Secure key handlers must ensure that:
+ *
+ * - Keys are securely stored, either on disk or in memory, in encrypted form.
+ * - Keys are decrypted only when needed to perform operations (e.g., signing or deriving new keys),
+ *   and immediately after, sensitive key material is wiped from memory.
+ * - Memory management and cleanup are handled to reduce the risk of security vulnerabilities, sensitive data must not remain in memory after use.
+ * - For hardware wallets, cryptographic operations are delegated to the hardware.
+ *
+ * The handler supports both cryptographic operations for BIP32 (HD) keys and raw Ed25519 keys (which do not support key derivation).
+ *
+ * \see cardano_secure_key_handler_t for the public interface.
+ */
+typedef struct cardano_secure_key_handler_impl_t cardano_secure_key_handler_impl_t;
+
+/* CALLBACKS *****************************************************************/
+
+/**
+ * \brief Callback function type for signing a transaction using BIP32 Hierarchical Deterministic (HD) keys.
+ *
+ * The `cardano_bip32_sign_transaction_func_t` typedef defines the signature for a callback function responsible for
+ * signing a transaction using BIP32 (HD) keys within the context of the secure key handler implementation.
+ *
+ * This function is expected to:
+ * - Use the provided `secure_key_handler_impl` to securely handle the cryptographic key operations required for signing.
+ * - Derive the appropriate private keys based on the provided `derivation_paths` and sign the `tx` (transaction).
+ * - Generate a set of `vkey_witness_set` containing the necessary verification keys and signatures, representing
+ *   the transaction witnesses.
+ *
+ * \param secure_key_handler_impl A pointer to the secure key handler implementation that manages cryptographic operations.
+ * \param tx The transaction object to be signed.
+ * \param derivation_paths An array of BIP32 derivation paths used to derive the private keys for signing the transaction.
+ * \param num_paths The number of derivation paths provided in the `derivation_paths` array.
+ * \param vkey_witness_set A pointer to the verification key witness set that will be populated with the generated signatures.
+ *                         This set will contain the signatures and associated verification keys required for the transaction.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during signing.
+ *
+ * \note The `vkey_witness_set` must be properly managed and released by the caller to avoid memory leaks.
+ */
+typedef cardano_error_t (*cardano_bip32_sign_transaction_func_t)(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_transaction_t*             tx,
+  const cardano_derivation_path_t*   derivation_paths,
+  size_t                             num_paths,
+  cardano_vkey_witness_set_t**       vkey_witness_set);
+
+/**
+ * \brief Callback function type for signing a sub transaction using BIP32 Hierarchical Deterministic (HD) keys.
+ *
+ * The `cardano_bip32_sign_sub_transaction_func_t` typedef defines the signature for a callback function responsible for
+ * signing a sub transaction using BIP32 (HD) keys within the context of the secure key handler implementation.
+ *
+ * A party of a batch of nested transactions signs the id of its sub transaction (the hash of the sub transaction body),
+ * exactly as a transaction signature is over the transaction id.
+ *
+ * This function is expected to:
+ * - Use the provided `secure_key_handler_impl` to securely handle the cryptographic key operations required for signing.
+ * - Derive the appropriate private keys based on the provided `derivation_paths` and sign the id of the `sub_tx` (sub transaction).
+ * - Generate a set of `vkey_witness_set` containing the necessary verification keys and signatures, representing
+ *   the sub transaction witnesses.
+ *
+ * \param secure_key_handler_impl A pointer to the secure key handler implementation that manages cryptographic operations.
+ * \param sub_tx The sub transaction object to be signed.
+ * \param derivation_paths An array of BIP32 derivation paths used to derive the private keys for signing the sub transaction.
+ * \param num_paths The number of derivation paths provided in the `derivation_paths` array.
+ * \param vkey_witness_set A pointer to the verification key witness set that will be populated with the generated signatures.
+ *                         This set will contain the signatures and associated verification keys required for the sub transaction.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during signing.
+ *
+ * \note The `vkey_witness_set` must be properly managed and released by the caller to avoid memory leaks.
+ */
+typedef cardano_error_t (*cardano_bip32_sign_sub_transaction_func_t)(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_sub_transaction_t*         sub_tx,
+  const cardano_derivation_path_t*   derivation_paths,
+  size_t                             num_paths,
+  cardano_vkey_witness_set_t**       vkey_witness_set);
+
+/**
+ * \brief Callback function type for retrieving a BIP32 extended account public key.
+ *
+ * The `cardano_bip32_get_extended_account_public_key_func_t` typedef defines the signature for a callback function that is
+ * responsible for deriving and retrieving a BIP32 (Hierarchical Deterministic) extended account public key. This key includes both the
+ * public key and the associated chain code, as required by BIP32.
+ *
+ * This function is expected to:
+ * - Use the provided `secure_key_handler_impl` to securely handle the cryptographic key operations for deriving the extended
+ *   account public key based on the provided `derivation_path`.
+ * - Return the BIP32 extended account public key, which includes both the public key and the chain code.
+ *
+ * \param secure_key_handler_impl A pointer to the secure key handler implementation responsible for key management and operations.
+ * \param account_derivation_path The BIP32 derivation path used to derive the extended account public key.
+ * \param bip32_public_key A pointer to the location where the extended account public key (including chain code) will be stored.
+ *                         The caller is responsible for managing the lifecycle of this object, ensuring proper cleanup after use.
+ *
+ * \returns `cardano_error_t` indicating success or providing details on any errors encountered during the process.
+ *
+ * \note The `bip32_public_key` object must be managed and released by the caller to avoid memory leaks.
+ */
+typedef cardano_error_t (*cardano_bip32_get_extended_account_public_key_func_t)(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_account_derivation_path_t  account_derivation_path,
+  cardano_bip32_public_key_t**       bip32_public_key);
+
+/**
+ * \brief Callback function type for signing a transaction using an Ed25519 key.
+ *
+ * The `cardano_ed25519_sign_transaction_func_t` typedef defines the signature for a callback function that is responsible
+ * for signing a given transaction using an Ed25519 private key. This function interacts with the secure key handler
+ * implementation to ensure the private key is securely accessed and used for signing.
+ *
+ * This function is expected to:
+ * - Use the provided `secure_key_handler_impl` to handle the Ed25519 key operations required to sign the transaction.
+ * - Sign the given transaction (`tx`) and produce a `vkey_witness_set` containing the verification key and signature.
+ *
+ * \param secure_key_handler_impl A pointer to the secure key handler implementation responsible for key management and signing operations.
+ * \param tx A pointer to the transaction that needs to be signed.
+ * \param vkey_witness_set A pointer to the location where the signature and verification key set will be stored after signing.
+ *                         The caller is responsible for managing the lifecycle of this object, ensuring proper cleanup after use.
+ *
+ * \returns `cardano_error_t` indicating success or providing details on any errors encountered during the process.
+ *
+ * \note The signing process is done securely, ensuring the private key is not exposed beyond the scope of the cryptographic operation.
+ * The caller must manage and release the `vkey_witness_set` object to avoid memory leaks.
+ */
+typedef cardano_error_t (*cardano_ed25519_sign_transaction_func_t)(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_transaction_t*             tx,
+  cardano_vkey_witness_set_t**       vkey_witness_set);
+
+/**
+ * \brief Callback function type for signing a sub transaction using an Ed25519 key.
+ *
+ * The `cardano_ed25519_sign_sub_transaction_func_t` typedef defines the signature for a callback function that is responsible
+ * for signing a given sub transaction using an Ed25519 private key. This function interacts with the secure key handler
+ * implementation to ensure the private key is securely accessed and used for signing.
+ *
+ * A party of a batch of nested transactions signs the id of its sub transaction (the hash of the sub transaction body),
+ * exactly as a transaction signature is over the transaction id.
+ *
+ * This function is expected to:
+ * - Use the provided `secure_key_handler_impl` to handle the Ed25519 key operations required to sign the sub transaction.
+ * - Sign the id of the given sub transaction (`sub_tx`) and produce a `vkey_witness_set` containing the verification key and signature.
+ *
+ * \param secure_key_handler_impl A pointer to the secure key handler implementation responsible for key management and signing operations.
+ * \param sub_tx A pointer to the sub transaction that needs to be signed.
+ * \param vkey_witness_set A pointer to the location where the signature and verification key set will be stored after signing.
+ *                         The caller is responsible for managing the lifecycle of this object, ensuring proper cleanup after use.
+ *
+ * \returns `cardano_error_t` indicating success or providing details on any errors encountered during the process.
+ *
+ * \note The signing process is done securely, ensuring the private key is not exposed beyond the scope of the cryptographic operation.
+ * The caller must manage and release the `vkey_witness_set` object to avoid memory leaks.
+ */
+typedef cardano_error_t (*cardano_ed25519_sign_sub_transaction_func_t)(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_sub_transaction_t*         sub_tx,
+  cardano_vkey_witness_set_t**       vkey_witness_set);
+
+/**
+ * \brief Callback function type for retrieving an Ed25519 public key.
+ *
+ * The `cardano_ed25519_get_public_key_func_t` typedef defines the signature for a callback function responsible for
+ * securely retrieving the public key associated with an Ed25519 private key from the secure key handler implementation.
+ *
+ * This function is expected to:
+ * - Use the provided `secure_key_handler_impl` to access and retrieve the associated Ed25519 public key.
+ * - Store the public key in the location pointed to by the `public_key` parameter.
+ *
+ * \param secure_key_handler_impl A pointer to the secure key handler implementation responsible for managing cryptographic key operations.
+ * \param public_key A pointer to the location where the Ed25519 public key will be stored.
+ *                   The caller is responsible for managing the lifecycle of the returned public key, ensuring proper cleanup after use.
+ *
+ * \returns `cardano_error_t` indicating success or providing details on any errors encountered during the process.
+ *
+ * \note This operation ensures that only the public key is retrieved, with no exposure of the private key. The caller must
+ * manage and release the `public_key` object appropriately to avoid memory leaks.
+ */
+typedef cardano_error_t (*cardano_ed25519_get_public_key_func_t)(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_ed25519_public_key_t**     public_key);
+
+/**
+ * \brief Callback function type for serializing a secure key handler.
+ *
+ * The `cardano_serialize_secure_key_handler_func_t` typedef defines the signature for a callback function responsible for
+ * serializing the state associated with a secure key handler implementation into a buffer.
+ *
+ * This function is expected to:
+ * - Use the provided `secure_key_handler_impl` to access the internal state or key material.
+ * - Serialize the key handler data into a `cardano_buffer_t` that can be stored or transmitted.
+ * - The serialized data must not contain any sensitive information, such as private keys, unless encrypted.
+ *
+ * \param secure_key_handler_impl A pointer to the secure key handler implementation that manages cryptographic operations.
+ * \param serialized_data A pointer to a `cardano_buffer_t` that will be populated with the serialized data.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during serialization.
+ *
+ * \note The `serialized_data` must be properly managed and released by the caller to avoid memory leaks.
+ */
+typedef cardano_error_t (*cardano_serialize_secure_key_handler_func_t)(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_buffer_t**                 serialized_data);
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Secure Key Handler Implementation structure.
+ *
+ * The `cardano_secure_key_handler_impl_t` structure defines the interface for implementing secure key management
+ * functionalities. This structure contains function pointers (callbacks) for cryptographic operations, providing a way
+ * to securely manage and perform cryptographic actions using both BIP32 Hierarchical Deterministic (HD) keys and Ed25519 keys.
+ *
+ * Implementers are responsible for providing the specific functionality of these cryptographic operations through
+ * the defined function pointers. These operations include signing transactions and sub transactions, retrieving
+ * public keys, and performing key derivation.
+ *
+ * This structure does not directly implement any cryptographic logic but instead serves as a collection of callbacks
+ * to be defined by the implementers based on their secure key handling strategy.
+ *
+ * It supports the following key operations:
+ * - BIP32 key handling, including signing and public key retrieval with support for hierarchical derivation.
+ * - Ed25519 key operations for signing and retrieving public keys, though Ed25519 keys do not support derivation.
+ *
+ * \note The secure key handler's responsibility is to ensure that sensitive key material is only decrypted for the
+ * brief period required to perform the cryptographic operation, after which it is immediately wiped from memory.
+ *
+ * \see cardano_secure_key_handler_t for the public interface that interacts with this structure.
+ */
+typedef struct cardano_secure_key_handler_impl_t
+{
+    /**
+     * \brief Name of the key handler implementation.
+     */
+    char name[256];
+
+    /**
+     * \brief Error message buffer for provider-specific error messages.
+     */
+    char error_message[1024];
+
+    /**
+     * \brief Opaque pointer to the implementation-specific context.
+     *
+     * This pointer holds the state or context required by the provider implementation.
+     * Users should not access or modify this directly.
+     */
+    cardano_object_t* context;
+
+    /**
+     * \brief Type of secure key handler.
+     *
+     * The two types supported are:
+     * - `CARDANO_SECURE_KEY_HANDLER_TYPE_ED25519`:
+     *   This typ of handler manages Ed25519 keys, which do not support hierarchical key derivation (BIP32). Any operations on Ed25519
+     *   keys must use the `secure_key_handler_ed25519_*` family of functions.
+     *
+     * - `CARDANO_SECURE_KEY_HANDLER_TYPE_BIP32`:
+     *   This type of handler manages BIP32 keys, which support hierarchical deterministic (HD) key derivation, allowing the generation
+     *   of multiple keys from a master key. Operations on BIP32 keys must use the `secure_key_handler_bip32_*` family of functions.
+     *
+     * \see cardano_secure_key_handler_type_t for the enumeration of secure key handler types.
+     */
+    cardano_secure_key_handler_type_t type;
+
+    /**
+     * \brief Callback function to sign a transaction using BIP32 keys.
+     *
+     * \note
+     * This function is only applicable to key handlers of type `CARDANO_SECURE_KEY_HANDLER_TYPE_BIP32`. For other key types,
+     * this field should not be used.
+     *
+     * \see cardano_bip32_sign_transaction_func_t for more details on the function signature.
+     */
+    cardano_bip32_sign_transaction_func_t bip32_sign_transaction;
+
+    /**
+     * \brief Callback function to sign a sub transaction using BIP32 keys.
+     *
+     * \note
+     * This function is only applicable to key handlers of type `CARDANO_SECURE_KEY_HANDLER_TYPE_BIP32`. For other key types,
+     * this field should not be used. Implementations that do not support sub transactions must set this field to `NULL`.
+     *
+     * \see cardano_bip32_sign_sub_transaction_func_t for more details on the function signature.
+     */
+    cardano_bip32_sign_sub_transaction_func_t bip32_sign_sub_transaction;
+
+    /**
+     * \brief Callback function to retrieve a BIP32 extended account public key.
+     *
+     * \note
+     * This function is only applicable to key handlers of type `CARDANO_SECURE_KEY_HANDLER_TYPE_BIP32`. For other key types,
+     * this field should not be used.
+     *
+     * \see cardano_bip32_get_extended_account_public_key_func_t for more details on the function signature.
+     */
+    cardano_bip32_get_extended_account_public_key_func_t bip32_get_extended_account_public_key;
+
+    /**
+     * \brief Callback function to sign a transaction using an Ed25519 key.
+     *
+     * \note
+     * This function is only applicable to key handlers of type `CARDANO_SECURE_KEY_HANDLER_TYPE_ED25519`. For other key types,
+     * this field should not be used.
+     *
+     * \see cardano_ed25519_sign_transaction_func_t for more details on the function signature.
+     */
+    cardano_ed25519_sign_transaction_func_t ed25519_sign_transaction;
+
+    /**
+     * \brief Callback function to sign a sub transaction using an Ed25519 key.
+     *
+     * \note
+     * This function is only applicable to key handlers of type `CARDANO_SECURE_KEY_HANDLER_TYPE_ED25519`. For other key types,
+     * this field should not be used. Implementations that do not support sub transactions must set this field to `NULL`.
+     *
+     * \see cardano_ed25519_sign_sub_transaction_func_t for more details on the function signature.
+     */
+    cardano_ed25519_sign_sub_transaction_func_t ed25519_sign_sub_transaction;
+
+    /**
+     * \brief Callback function to retrieve an Ed25519 public key.
+     *
+     * \note
+     * This function is only applicable to key handlers of type `CARDANO_SECURE_KEY_HANDLER_TYPE_ED25519
+     * For other key types, this field should not be used.
+     *
+     * \see cardano_ed25519_get_public_key_func_t for more details on the function signature.
+     */
+    cardano_ed25519_get_public_key_func_t ed25519_get_public_key;
+
+    /**
+     * \brief Callback function to serialize the secure key handler implementation.
+     *
+     * \see cardano_serialize_secure_key_handler_func_t for more details on the function signature.
+     */
+    cardano_serialize_secure_key_handler_func_t serialize;
+} cardano_secure_key_handler_impl_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SECURE_KEY_HANDLER_IMPL_H
diff --git a/vendor/include/cardano/key_handlers/secure_key_handler_type.h b/vendor/include/cardano/key_handlers/secure_key_handler_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/key_handlers/secure_key_handler_type.h
@@ -0,0 +1,57 @@
+/**
+ * \file secure_key_handler_type.h
+ *
+ * \author angel.castillo
+ * \date   Oct 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SECURE_KEY_HANDLER_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SECURE_KEY_HANDLER_TYPE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Secure key handler type.
+ */
+typedef enum
+{
+  /**
+   * \brief Ed25519 key handler. This key handler doesnt support BIP32 derivation scheme and must use
+   * the secure_key_handler_ed25519_* family of functions.
+   */
+  CARDANO_SECURE_KEY_HANDLER_TYPE_ED25519,
+
+  /**
+   * \brief BIP32 key handler. This key handler supports the BIP32 derivation scheme and must use
+   * the secure_key_handler_bip32_* family of functions.
+   */
+  CARDANO_SECURE_KEY_HANDLER_TYPE_BIP32,
+} cardano_secure_key_handler_type_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SECURE_KEY_HANDLER_TYPE_H
diff --git a/vendor/include/cardano/key_handlers/software_secure_key_handler.h b/vendor/include/cardano/key_handlers/software_secure_key_handler.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/key_handlers/software_secure_key_handler.h
@@ -0,0 +1,215 @@
+/**
+ * \file software_secure_key_handler.h
+ *
+ * \author angel.castillo
+ * \date   Oct 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SOFTWARE_SECURE_KEY_HANDLER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SOFTWARE_SECURE_KEY_HANDLER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/ed25519_private_key.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/key_handlers/secure_key_handler.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Callback function type for securely retrieving a passphrase.
+ *
+ * The `cardano_get_passphrase_func_t` typedef defines the signature for a callback function responsible
+ * for retrieving a passphrase, which must be stored in the provided buffer. The buffer must be large
+ * enough to hold the entire passphrase.
+ *
+ * This function is expected to:
+ * - Retrieve the passphrase securely and write it into the provided `buffer`.
+ * - Ensure that the passphrase length does not exceed the `buffer_len` provided, and if it does
+ *   return an error.
+ *
+ * \param buffer A pointer to the buffer where the passphrase will be written.
+ * \param buffer_len The maximum length of the `buffer` to hold the passphrase.
+ *
+ * \returns The number of passphrase bytes written, excluding any null terminator. Return a nonpositive value on failure.
+ *          The returned length must not exceed `buffer_len`; software key handlers reject empty passphrases and lengths
+ *          greater than their 128-byte passphrase buffer.
+ *
+ * \note The software key handler ensures that the passphrase is securely erased from memory immediately after it is no
+ * longer needed. The memory is wiped using measures that prevent the passphrase from lingering in memory or being retained in
+ * registers, caches, or other hardware components that could expose it. These precautions include:
+ * - Ensuring that the passphrase is overwritten completely, even in cases where compiler optimizations might
+ *   otherwise skip the memory clearing.
+ * - Preventing sensitive data from being inadvertently copied or cached in temporary memory locations.
+ * - Guaranteeing that even if the program crashes, the sensitive data will not be left exposed in memory.
+ *
+ * Implementers of this callback must take equivalent precautions, ensuring that any sensitive data used
+ * within the callback, such as temporary buffers, is securely erased after use to protect against
+ * potential memory inspection or side-channel attacks.
+ */
+typedef int32_t (*cardano_get_passphrase_func_t)(byte_t* buffer, size_t buffer_len);
+
+/**
+ * \brief Creates a new software-based secure key handler with encrypted entropy.
+ *
+ * The `cardano_software_secure_key_handler_new` function initializes a software-based secure key handler
+ * for managing cryptographic key operations, using provided entropy bytes and a passphrase for encryption.
+ * This key handler ensures the secure management and encryption of sensitive cryptographic material.
+ *
+ * Upon creation, the handler immediately encrypts the provided entropy bytes using the given passphrase.
+ * All intermediary sensitive data used in the process, such as unencrypted entropy and passphrase,
+ * is securely wiped from memory once the encryption process is complete.
+ *
+ * This secure key handler will:
+ * - Encrypt the entropy bytes with the provided passphrase for secure storage.
+ * - Use the `get_passphrase` callback to retrieve the passphrase when needed for decrypting the entropy
+ *   during cryptographic operations.
+ * - Ensure that any decrypted entropy is wiped from memory immediately after use, employing secure
+ *   memory clearing measures that prevent sensitive data from lingering in memory.
+ *
+ * \param entropy_bytes A pointer to a buffer containing entropy bytes used to generate cryptographic key material.
+ *                      This entropy should be high-quality and random.
+ * \param entropy_bytes_len The length of the `entropy_bytes` buffer.
+ * \param get_passphrase A callback function used to securely retrieve the passphrase during cryptographic operations.
+ * \param passphrase A pointer to the buffer containing the passphrase, which will be used to encrypt the entropy.
+ * \param passphrase_len The length of the `passphrase` buffer.
+ * \param secure_key_handler A pointer to the resulting secure key handler. This handler manages cryptographic operations
+ *                           such as signing and key derivation.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during initialization.
+ *
+ * \note This function securely wipes all intermediary sensitive data from memory, once they have been used for encryption.
+ * The caller must also ensure that both the passphrase and entropy bytes are securely erased from memory after
+ * calling this function.
+ *
+ * \note The `get_passphrase` callback is invoked every time the key material is required. The seed is decrypted only
+ * for the short period needed to perform the cryptographic operation, after which it is securely wiped from memory.
+ *
+ * \see cardano_secure_key_handler_t for the public interface to interact with this handler.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_software_secure_key_handler_new(
+  const byte_t*                  entropy_bytes,
+  size_t                         entropy_bytes_len,
+  const byte_t*                  passphrase,
+  size_t                         passphrase_len,
+  cardano_get_passphrase_func_t  get_passphrase,
+  cardano_secure_key_handler_t** secure_key_handler);
+
+/**
+ * \brief Creates a new software secure key handler for an Ed25519 private key.
+ *
+ * The `cardano_software_secure_key_handler_ed25519_new` function initializes a secure key handler to manage
+ * cryptographic operations using a pre-derived Ed25519 private key. Unlike BIP32-based handlers, this function
+ * is specifically designed for handling Ed25519 keys and does not support hierarchical key derivation (BIP32).
+ *
+ * The handler encrypts the provided Ed25519 private key with the given passphrase immediately upon creation and
+ * stores the encrypted bytes. The private key and passphrase are borrowed for this call and are not modified.
+ *
+ * The function does not retain a reference to `ed25519_private_key` or take ownership of it. The caller remains
+ * responsible for its lifecycle and may release it with `cardano_ed25519_private_key_unref` after this call.
+ * The private key's memory is wiped when its reference count reaches 0. The caller is also responsible for
+ * securely erasing the supplied passphrase when it is no longer needed.
+ *
+ * The `get_passphrase` callback is invoked every time the private key needs to be decrypted for cryptographic
+ * operations such as signing. Once decrypted, the key is used for a short period, and it is securely erased from memory
+ * after the operation is complete.
+ *
+ * \param[in] ed25519_private_key A borrowed pointer to the private key to encrypt; ownership remains with the caller.
+ * \param[in] passphrase A pointer to the passphrase used for encrypting the private key.
+ * \param[in] passphrase_len The length of the passphrase in bytes.
+ * \param[in] get_passphrase A callback function for retrieving the passphrase when needed to decrypt the private key.
+ * \param[out] secure_key_handler A pointer to the secure key handler that will be created.
+ *
+ * \returns `cardano_error_t` indicating success or failure of the operation.
+ *
+ * \note The private key is encrypted upon creation and only decrypted when necessary.
+ * The caller must ensure that the passphrase and private key are securely erased from memory after passing them
+ * to this function. The caller must also manage the lifecycle of the `ed25519_private_key` object and call
+ * `cardano_ed25519_private_key_unref` when it is no longer needed. The key handler will manage the memory securely,
+ * wiping out any sensitive data after use.
+ *
+ * Example:
+ * \code
+ * cardano_ed25519_private_key_t* ed25519_private_key = ...; // Pre-derived Ed25519 private key
+ * const byte_t* passphrase = ...;                           // Passphrase to encrypt the key
+ * cardano_secure_key_handler_t* secure_handler = NULL;
+ *
+ * cardano_software_secure_key_handler_ed25519_new(
+ *     ed25519_private_key,
+ *     passphrase,
+ *     passphrase_len,
+ *     get_passphrase_callback,
+ *     &secure_handler);
+ *
+ * // When finished, the caller should release the private key reference.
+ * cardano_ed25519_private_key_unref(ed25519_private_key);
+ * \endcode
+ *
+ * \see cardano_software_secure_key_handler_new for BIP32-based key handler creation.
+ * \see cardano_ed25519_private_key_unref for safely managing the memory of Ed25519 private keys.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_software_secure_key_handler_ed25519_new(
+  cardano_ed25519_private_key_t* ed25519_private_key,
+  const byte_t*                  passphrase,
+  size_t                         passphrase_len,
+  cardano_get_passphrase_func_t  get_passphrase,
+  cardano_secure_key_handler_t** secure_key_handler);
+
+/**
+ * \brief Deserializes a previously serialized software-based secure key handler.
+ *
+ * The `cardano_software_secure_key_handler_deserialize` function initializes a secure key handler from
+ * serialized data. The serialized data is expected to be created using the \ref cardano_secure_key_handler_serialize function of a secure
+ * software key handler.
+ *
+ * \param serialized_data A pointer to the buffer containing the serialized representation of the secure key handler.
+ *                        This data should have been generated using the \ref cardano_secure_key_handler_serialize function of a secure software key handler.
+ * \param serialized_data_len The length of the `serialized_data` buffer.
+ * \param get_passphrase A callback function that will be used to securely retrieve the passphrase when sensitive data
+ *                       must be decrypted.
+ * \param secure_key_handler A pointer to the resulting secure key handler, which can now be used for cryptographic
+ *                           operations such as signing and key derivation. The key handler will only decrypt sensitive
+ *                           data when needed, invoking the `get_passphrase` callback at those times.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during deserialization.
+ *
+ * \note The key handler will not decrypt any sensitive data during the deserialization process. The sensitive key
+ * material will remain encrypted, and the `get_passphrase` callback will be invoked to retrieve the passphrase
+ * only when needed to decrypt secrets for specific cryptographic operations.
+ *
+ * \see cardano_secure_key_handler_t for the public interface to interact with this handler.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_software_secure_key_handler_deserialize(
+  const byte_t*                  serialized_data,
+  size_t                         serialized_data_len,
+  cardano_get_passphrase_func_t  get_passphrase,
+  cardano_secure_key_handler_t** secure_key_handler);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SOFTWARE_SECURE_KEY_HANDLER_H
diff --git a/vendor/include/cardano/message_signing/cip8.h b/vendor/include/cardano/message_signing/cip8.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/message_signing/cip8.h
@@ -0,0 +1,171 @@
+/**
+ * \file cip8.h
+ *
+ * \author angel.castillo
+ * \date   Nov 21, 2025
+ *
+ * Copyright 2025 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CIP8_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CIP8_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/buffer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/ed25519_private_key.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Signs arbitrary data using CIP-8 / COSE and binds the signature to a Cardano address.
+ *
+ * This function creates a COSE_Sign1 and COSE_Key structure compatible with CIP-8 and the
+ * CIP-30 `signData` API. The message is signed directly (no pre-hashing), with the CIP-8
+ * "hashed" flag set to false and an empty external_aad.
+ *
+ * The protected headers include:
+ *   - alg     : EdDSA (-8)
+ *   - address : raw bytes of \p address
+ *
+ * The resulting \p cose_sign1_out and \p cose_key_out buffers contain CBOR-encoded COSE
+ * structures.
+ *
+ * \param[in]  message         Pointer to the message bytes to sign.
+ * \param[in]  message_size    Size of \p message in bytes.
+ * \param[in]  address         Cardano address to bind the signature to. Must not be NULL. If you need to bind
+ *                             the signature to a key hash instead, use \ref cardano_cip8_sign_ex.
+ * \param[in]  signing_key     Ed25519 private key used to produce the signature. Must not be NULL.
+ * \param[out] cose_sign1_out  On success, receives a newly allocated buffer containing the
+ *                             CBOR-encoded COSE_Sign1 structure.
+ * \param[out] cose_key_out    On success, receives a newly allocated buffer containing the
+ *                             CBOR-encoded COSE_Key structure corresponding to \p signing_key.
+ *
+ * \returns \ref CARDANO_SUCCESS on success, or an error code on failure.
+ *
+ * \post On success, the caller owns \p cose_sign1_out and \p cose_key_out and must release them
+ *       with cardano_buffer_unref().
+ *
+ * \code{.c}
+ * const byte_t message[] = "Hello, Cardano!";
+ * cardano_address_t* address = // previously constructed
+ * cardano_ed25519_private_key_t* sk = // derived key;
+ *
+ * cardano_buffer_t* cose_sign1 = NULL;
+ * cardano_buffer_t* cose_key   = NULL;
+ *
+ * cardano_error_t result = cardano_cip8_sign(
+ *   message,
+ *   sizeof(message) - 1,
+ *   address,
+ *   sk,
+ *   &cose_sign1,
+ *   &cose_key);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // handle error...
+ * }
+ *
+ * cardano_buffer_unref(&cose_sign1);
+ * cardano_buffer_unref(&cose_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cip8_sign(
+  const byte_t*                        message,
+  size_t                               message_size,
+  const cardano_address_t*             address,
+  const cardano_ed25519_private_key_t* signing_key,
+  cardano_buffer_t**                   cose_sign1_out,
+  cardano_buffer_t**                   cose_key_out);
+
+/**
+ * \brief Signs arbitrary data using CIP-8 / COSE and binds the signature to a key hash.
+ *
+ * This function creates a COSE_Sign1 and COSE_Key structure compatible with CIP-8 and the
+ * CIP-30 `signData` API, binding the signature to a key hash rather than a full Cardano
+ * address. The message is signed directly (no pre-hashing), with the CIP-8 "hashed" flag
+ * set to false and an empty external_aad.
+ *
+ * The protected headers include:
+ *   - alg     : EdDSA (-8)
+ *   - keyHash : raw bytes of \p key_hash
+ *
+ * The resulting \p cose_sign1_out and \p cose_key_out buffers contain CBOR-encoded COSE
+ * structures.
+ *
+ * \param[in]  message         Pointer to the message bytes to sign.
+ * \param[in]  message_size    Size of \p message in bytes.
+ * \param[in]  key_hash        Key hash to bind the signature to (typically a Blake2b-224
+ *                             hash of a public key). Must not be NULL.
+ * \param[in]  signing_key     Ed25519 private key used to produce the signature. Must not be NULL.
+ * \param[out] cose_sign1_out  On success, receives a newly allocated buffer containing the
+ *                             CBOR-encoded COSE_Sign1 structure.
+ * \param[out] cose_key_out    On success, receives a newly allocated buffer containing the
+ *                             CBOR-encoded COSE_Key structure corresponding to \p signing_key.
+ *
+ * \returns \ref CARDANO_SUCCESS on success, or an error code on failure.
+ *
+ * \post On success, the caller owns \p cose_sign1_out and \p cose_key_out and must release them
+ *       with cardano_buffer_unref().
+ *
+ * \code{.c}
+ * const byte_t message[] = "Hello, dRep!";
+ * cardano_blake2b_hash_t* key_hash = // previously computed key hash;
+ * cardano_ed25519_private_key_t* sk = // derived key;
+ *
+ * cardano_buffer_t* cose_sign1 = NULL;
+ * cardano_buffer_t* cose_key   = NULL;
+ *
+ * cardano_error_t result = cardano_cip8_sign_ex(
+ *   message,
+ *   sizeof(message) - 1,
+ *   key_hash,
+ *   sk,
+ *   &cose_sign1,
+ *   &cose_key);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // handle error...
+ * }
+ *
+ * cardano_buffer_unref(&cose_sign1);
+ * cardano_buffer_unref(&cose_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cip8_sign_ex(
+  const byte_t*                        message,
+  size_t                               message_size,
+  const cardano_blake2b_hash_t*        key_hash,
+  const cardano_ed25519_private_key_t* signing_key,
+  cardano_buffer_t**                   cose_sign1_out,
+  cardano_buffer_t**                   cose_key_out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CIP8_H
diff --git a/vendor/include/cardano/object.h b/vendor/include/cardano/object.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/object.h
@@ -0,0 +1,143 @@
+/**
+ * \file object.h
+ *
+ * \author luisd.bianchi
+ * \date   Mar 03, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_OBJECT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_OBJECT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief A pointer to a function that deallocates a Cardano object.
+ *
+ * This typedef defines the signature for deallocator functions used within the Cardano library.
+ * Deallocator functions are responsible for freeing the resources associated with a Cardano object.
+ * The function pointed to by this typedef is expected to handle the deallocation of both the object's
+ * specific resources (if any) and the object itself.
+ *
+ * @param[in] data A pointer to the object to be deallocated. While the parameter is of type `void*` to
+ * allow for generic handling of different object types, it is intended that the actual object passed
+ * to the deallocator function will be a specific type derived from the base `cardano_object_t` structure.
+ * Implementations of the deallocator function should cast `data` to the appropriate specific type
+ * as needed to correctly free its resources.
+ */
+typedef void (*cardano_object_deallocator_t)(void* data);
+
+/**
+ * \brief Base object type.
+ *
+ * All objects in the library are derived from this type.
+ */
+typedef struct cardano_object_t
+{
+    size_t                       ref_count;
+    cardano_object_deallocator_t deallocator;
+    char                         last_error[1024];
+} cardano_object_t;
+
+/**
+ * \brief Decrements the object's reference count.
+ *
+ * If the reference count reaches zero, the object memory is deallocated.
+ *
+ * \param[in] object Pointer to the object whose reference count is to be decremented.
+ */
+CARDANO_EXPORT void cardano_object_unref(cardano_object_t** object);
+
+/**
+ * \brief Increments the object's reference count.
+ *
+ * Ensures that the object remains allocated until the last reference is released.
+ *
+ * \param[in] object object whose reference count is to be incremented.
+ */
+CARDANO_EXPORT void cardano_object_ref(cardano_object_t* object);
+
+/**
+ * \brief Retrieves the object's current reference count.
+ *
+ * \warning Does not account for transitive references.
+ *
+ * \param[in] object Target object.
+ * \return Current reference count of the object.
+ */
+CARDANO_EXPORT size_t cardano_object_refcount(const cardano_object_t* object);
+
+/**
+ * \brief Sets the last error message for a given object.
+ *
+ * This function records an error message in the object's last_error buffer,
+ * overwriting any previous message. The message is truncated if it exceeds
+ * the buffer size. This function is typically used to store descriptive
+ * error information that can be retrieved later with
+ * cardano_object_get_last_error.
+ *
+ * \param[in,out] object A pointer to the cardano_object_t instance whose last error
+ *               message is to be set. If the object is NULL, the function
+ *               has no effect.
+ * \param[in] message A null-terminated string containing the error message to be
+ *                recorded. If the message is NULL, the object's last_error
+ *                will be set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters due to the fixed size
+ *       of the last_error buffer (1024 characters), including the null
+ *       terminator. Messages longer than this limit will be truncated.
+ */
+CARDANO_EXPORT void cardano_object_set_last_error(cardano_object_t* object, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific object.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_object_set_last_error for the given
+ * object. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in,out] object A pointer to the \ref cardano_object_t instance whose last error
+ *               message is to be retrieved. If the object is \c NULL, the function
+ *               returns a generic error message indicating the null object.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified object. If the object is \c NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_object_set_last_error for the same object, or until
+ *       the object is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_object_get_last_error(const cardano_object_t* object);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_OBJECT_H
diff --git a/vendor/include/cardano/plutus_data/constr_plutus_data.h b/vendor/include/cardano/plutus_data/constr_plutus_data.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/plutus_data/constr_plutus_data.h
@@ -0,0 +1,626 @@
+/**
+ * \file constr_plutus_data.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CONSTR_PLUTUS_DATA_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CONSTR_PLUTUS_DATA_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a list of plutus data.
+ */
+typedef struct cardano_plutus_list_t cardano_plutus_list_t;
+
+/**
+ * \brief The main datatype `Constr` represents the nth constructor
+ * along with its arguments.
+ *
+ * Remark: We don't directly serialize the alternative in the tag,
+ * instead the scheme is:
+ *
+ * - Alternatives 0-6 -> tags 121-127, followed by the arguments in a list.
+ * - Alternatives 7-127 -> tags 1280-1400, followed by the arguments in a list.
+ * - Any alternatives, including those that don't fit in the above -> tag 102 followed by a list containing
+ * an unsigned integer for the actual alternative, and then the arguments in a (nested!) list.
+ */
+typedef struct cardano_constr_plutus_data_t cardano_constr_plutus_data_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus data constructor.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_constr_plutus_data_t,
+ * using the provided Constr alternative number and list of arguments as a PlutusList. It returns an error code
+ * to indicate success or failure of the operation.
+ *
+ * \param[in] alternative The Constr alternative number, representing the nth constructor
+ *             of a 'Sum Type'.
+ * \param[in] data A pointer to a \ref cardano_plutus_list_t object representing the list of arguments
+ *             of the 'Sum Type' as a 'PlutusList'.
+ * \param[out] constr_plutus_data On successful initialization, this will point to a newly created
+ *             \ref cardano_constr_plutus_data_t object. This object represents a "strong reference"
+ *             to the constr_plutus_data, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the constr_plutus_data is no longer needed, the caller must release it
+ *             by calling \ref cardano_constr_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the constr_plutus_data was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t alternative = 1; // Example alternative number
+ * cardano_plutus_list_t* data = { ... }; // Assume data is initialized here
+ * cardano_constr_plutus_data_t* constr_plutus_data = NULL;
+ *
+ * // Attempt to create a new constr_plutus_data
+ * cardano_error_t result = cardano_constr_plutus_data_new(alternative, data, &constr_plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the constr_plutus_data
+ *
+ *   // Once done, ensure to clean up and release the constr_plutus_data
+ *   cardano_constr_plutus_data_unref(&constr_plutus_data);
+ * }
+ *
+ * cardano_plutus_list_unref(&data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_constr_plutus_data_new(
+  uint64_t                       alternative,
+  cardano_plutus_list_t*         data,
+  cardano_constr_plutus_data_t** constr_plutus_data);
+
+/**
+ * \brief Creates a \ref cardano_cbor_reader_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_constr_plutus_data_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a constr_plutus_data.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded constr_plutus_data data.
+ * \param[out] constr_plutus_data A pointer to a pointer of \ref cardano_constr_plutus_data_t that will be set to the address
+ *                        of the newly created constr_plutus_data object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the constr_plutus_data was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the data and invalidate any existing signatures.
+ *         To prevent this, when a plutus data object is created using \ref cardano_constr_plutus_data_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_constr_plutus_data_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_constr_plutus_data_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_constr_plutus_data_t object by calling
+ *       \ref cardano_constr_plutus_data_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_constr_plutus_data_t* constr_plutus_data = NULL;
+ *
+ * cardano_error_t result = cardano_constr_plutus_data_from_cbor(reader, &constr_plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the constr_plutus_data
+ *
+ *   // Once done, ensure to clean up and release the constr_plutus_data
+ *   cardano_constr_plutus_data_unref(&constr_plutus_data);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode constr_plutus_data: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_constr_plutus_data_from_cbor(cardano_cbor_reader_t* reader, cardano_constr_plutus_data_t** constr_plutus_data);
+
+/**
+ * \brief Serializes a Plutus constructor data object to CIP-116 JSON.
+ *
+ * This function serializes the Plutus constructor data structure, including its
+ * tag, alternative, and data list.
+ *
+ * \param[in]  constr_data Pointer to a valid \ref cardano_constr_plutus_data_t.
+ * \param[in]  writer      Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p constr_data or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_constr_plutus_data_to_cip116_json(
+  const cardano_constr_plutus_data_t* constr_data,
+  cardano_json_writer_t*              writer);
+
+/**
+ * \brief Serializes a \ref cardano_cbor_reader_t into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_constr_plutus_data_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] constr_plutus_data A constant pointer to the \ref cardano_constr_plutus_data_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p constr_plutus_data or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the data and invalidate any existing signatures.
+ *         To prevent this, when a plutus data object is created using \ref cardano_constr_plutus_data_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_constr_plutus_data_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_constr_plutus_data_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constr_plutus_data_t* constr_plutus_data = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_constr_plutus_data_to_cbor(constr_plutus_data, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_constr_plutus_data_unref(&constr_plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_constr_plutus_data_to_cbor(
+  const cardano_constr_plutus_data_t* constr_plutus_data,
+  cardano_cbor_writer_t*              writer);
+
+/**
+ * \brief Retrieves the data associated with a \ref cardano_cbor_reader_t.
+ *
+ * This function provides access to the data part of a \ref cardano_constr_plutus_data_t object.
+ * It returns a new reference to a \ref cardano_plutus_list_t object representing the data.
+ * This allows the data to be used independently of the original \ref cardano_cbor_reader_t object. The
+ * reference count of the data object is increased by one, making it the caller's responsibility
+ * to release it by calling \ref cardano_plutus_list_unref when it is no longer needed.
+ *
+ * \param[in] constr_plutus_data A constant pointer to the \ref cardano_constr_plutus_data_t object from which
+ *                   the data is to be retrieved.
+ * \param[out] data A pointer to store the reference to the \ref cardano_plutus_list_t object containing the data.
+ *                  If the input constr_plutus_data is NULL, returns NULL. The caller is responsible for
+ *                  managing the lifecycle of this object, including releasing it with
+ *                  \ref cardano_plutus_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the data was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constr_plutus_data_t* original_constr_plutus_data = cardano_constr_plutus_data_new(...);
+ * cardano_plutus_list_t* data_constr_plutus_data = NULL;
+ *
+ * // Attempt to retrieve the data associated with the constr_plutus_data
+ * cardano_error_t result = cardano_constr_plutus_data_get_data(original_constr_plutus_data, &data_constr_plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the data_constr_plutus_data
+ *
+ *   // Once done, ensure to clean up and release the data_constr_plutus_data
+ *   cardano_plutus_list_unref(&data_constr_plutus_data);
+ * }
+ *
+ * // Release the original constr_plutus_data after use
+ * cardano_constr_plutus_data_unref(&original_constr_plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_constr_plutus_data_get_data(cardano_constr_plutus_data_t* constr_plutus_data, cardano_plutus_list_t** data);
+
+/**
+ * \brief Sets the data associated with a \ref cardano_constr_plutus_data_t.
+ *
+ * This function sets the data part of a \ref cardano_constr_plutus_data_t object to the provided
+ * \ref cardano_plutus_list_t object. It replaces any existing data associated with the \ref cardano_constr_plutus_data_t.
+ * The reference count of the provided data object is increased by one, making it the caller's responsibility
+ * to release it when it is no longer needed.
+ *
+ * \param[in] constr_plutus_data A constant pointer to the \ref cardano_constr_plutus_data_t object to which
+ *                   the data is to be set.
+ * \param[in] data A pointer to the \ref cardano_plutus_list_t object containing the new data to be set.
+ *
+ * \return \ref CARDANO_SUCCESS if the data was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constr_plutus_data_t* original_constr_plutus_data = cardano_constr_plutus_data_new(...);
+ * cardano_plutus_list_t* new_data = { ... }; // Assume new_data is initialized here
+ *
+ * // Attempt to set the new data associated with the constr_plutus_data
+ * cardano_error_t result = cardano_constr_plutus_data_set_data(original_constr_plutus_data, new_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Data successfully set
+ *   printf("Data set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Failed to set data: %s.\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Release the original constr_plutus_data after use
+ * cardano_constr_plutus_data_unref(&original_constr_plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_constr_plutus_data_set_data(cardano_constr_plutus_data_t* constr_plutus_data, cardano_plutus_list_t* data);
+
+/**
+ * \brief Retrieves the alternative of the \ref cardano_constr_plutus_data_t.
+ *
+ * This function retrieves the alternative of a given \ref cardano_constr_plutus_data_t object and stores it in the provided
+ * output parameter. The alternative represents the nth constructor of a 'Sum Type'.
+ *
+ * \param[in] constr_plutus_data A constant pointer to the \ref cardano_constr_plutus_data_t object from which
+ *                       the alternative is to be retrieved. The object must not be NULL.
+ * \param[out] alternative Pointer to a variable where the alternative will be stored.
+ *                         This variable will be set to the alternative number.
+ *
+ * \return \ref CARDANO_SUCCESS if the alternative was successfully retrieved, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constr_plutus_data_t* constr_plutus_data = cardano_constr_plutus_data_new(...);
+ * uint64_t alternative;
+ * cardano_error_t result = cardano_constr_plutus_data_get_alternative(constr_plutus_data, &alternative);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the alternative number
+ *   printf("Alternative number: %llu\n", (unsigned long long)alternative);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Failed to retrieve alternative: %s.\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the constr_plutus_data object once done
+ * cardano_constr_plutus_data_unref(&constr_plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_constr_plutus_data_get_alternative(const cardano_constr_plutus_data_t* constr_plutus_data, uint64_t* alternative);
+
+/**
+ * \brief Sets the alternative of the \ref cardano_constr_plutus_data_t.
+ *
+ * This function sets the alternative of a given \ref cardano_constr_plutus_data_t object to the provided
+ * alternative number.
+ *
+ * \param[in] constr_plutus_data A constant pointer to the \ref cardano_constr_plutus_data_t object to which
+ *                               the alternative is to be set.
+ * \param[in] alternative The alternative number to set.
+ *
+ * \return \ref CARDANO_SUCCESS if the alternative was successfully set, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constr_plutus_data_t* constr_plutus_data = cardano_constr_plutus_data_new(...);
+ * uint64_t new_alternative = 2; // Example alternative number
+ *
+ * cardano_error_t result = cardano_constr_plutus_data_set_alternative(constr_plutus_data, new_alternative);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Alternative successfully set
+ *   printf("Alternative set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Failed to set alternative: %s.\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the constr_plutus_data object once done
+ * cardano_constr_plutus_data_unref(&constr_plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_constr_plutus_data_set_alternative(cardano_constr_plutus_data_t* constr_plutus_data, uint64_t alternative);
+
+/**
+ * \brief Checks whether two \ref cardano_constr_plutus_data_t objects are equal.
+ *
+ * This function compares two \ref cardano_constr_plutus_data_t objects, \p lhs and \p rhs,
+ * to determine if they represent the same data. It returns true if the contents of the two objects
+ * are equal, and false otherwise.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_constr_plutus_data_t object to compare.
+ * \param[in] rhs A constant pointer to the second \ref cardano_constr_plutus_data_t object to compare.
+ *
+ * \return True if the contents of the two constr_plutus_data objects are equal, false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constr_plutus_data_t* data1 = cardano_constr_plutus_data_new(...);
+ * cardano_constr_plutus_data_t* data2 = cardano_constr_plutus_data_new(...);
+ *
+ * bool are_equal = cardano_constr_plutus_equals(data1, data2);
+ *
+ * if (are_equal)
+ * {
+ *   // The two constr_plutus_data objects are equal
+ *   printf("The two constr_plutus_data objects are equal.\n");
+ * }
+ * else
+ * {
+ *   // The two constr_plutus_data objects are not equal
+ *   printf("The two constr_plutus_data objects are not equal.\n");
+ * }
+ *
+ * // Release the constr_plutus_data objects after use
+ * cardano_constr_plutus_data_unref(&data1);
+ * cardano_constr_plutus_data_unref(&data2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_constr_plutus_equals(const cardano_constr_plutus_data_t* lhs, const cardano_constr_plutus_data_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a constr plutus data.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_constr_plutus_data_t object.
+ * It is useful when you have modified the constr_plutus_data after it was created from CBOR using
+ * \ref cardano_constr_plutus_data_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the constr_plutus_data, rather than using the original cached CBOR.
+ *
+ * \param[in,out] constr_plutus_data A pointer to an initialized \ref cardano_constr_plutus_data_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the constr plutus data when
+ *          serialized, which can alter the constr plutus data and invalidate any existing signatures.
+ *          Use this function with caution, especially if the transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume constr_plutus_data was created using cardano_constr_plutus_data_from_cbor
+ * cardano_constr_plutus_data_t* constr_plutus_data = ...;
+ *
+ * // Modify the constr_plutus_data as needed
+ * // For example, change the fee
+
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to set new fee: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated constr_plutus_data
+ * cardano_constr_plutus_data_clear_cbor_cache(constr_plutus_data);
+ *
+ * // Serialize the constr_plutus_data to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_constr_plutus_data_to_cbor(constr_plutus_data, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_constr_plutus_data_unref(&constr_plutus_data);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_constr_plutus_data_clear_cbor_cache(cardano_constr_plutus_data_t* constr_plutus_data);
+
+/**
+ * \brief Decrements the reference count of a \ref cardano_constr_plutus_data_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_constr_plutus_data_t object
+ * by decreasing its reference count. When the reference count reaches zero, the constr_plutus_data is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] constr_plutus_data A pointer to the pointer of the constr_plutus_data object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constr_plutus_data_t* constr_plutus_data = ...; // Assume constr_plutus_data is initialized here
+ *
+ * // Perform operations with the constr_plutus_data...
+ *
+ * cardano_constr_plutus_data_unref(&constr_plutus_data);
+ * // At this point, constr_plutus_data is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_constr_plutus_data_unref, the pointer to the \ref cardano_constr_plutus_data_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_constr_plutus_data_unref(cardano_constr_plutus_data_t** constr_plutus_data);
+
+/**
+ * \brief Increases the reference count of the \ref cardano_constr_plutus_data_t object.
+ *
+ * This function is used to manually increment the reference count of a \ref cardano_constr_plutus_data_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_constr_plutus_data_unref.
+ *
+ * \param constr_plutus_data A pointer to the constr_plutus_data object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming constr_plutus_data is a previously created constr_plutus_data object
+ *
+ * cardano_constr_plutus_data_ref(constr_plutus_data);
+ *
+ * // Now constr_plutus_data can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_constr_plutus_data_ref there is a corresponding
+ * call to \ref cardano_constr_plutus_data_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_constr_plutus_data_ref(cardano_constr_plutus_data_t* constr_plutus_data);
+
+/**
+ * \brief Retrieves the current reference count of the \ref cardano_constr_plutus_data_t object.
+ *
+ * This function returns the number of active references to a \ref cardano_constr_plutus_data_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_constr_plutus_data_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param constr_plutus_data A pointer to the constr_plutus_data object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified constr_plutus_data object. If the object
+ * is properly managed (i.e., every \ref cardano_constr_plutus_data_ref call is matched with a
+ * \ref cardano_constr_plutus_data_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming constr_plutus_data is a previously created constr_plutus_data object
+ *
+ * size_t ref_count = cardano_constr_plutus_data_refcount(constr_plutus_data);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_constr_plutus_data_refcount(const cardano_constr_plutus_data_t* constr_plutus_data);
+
+/**
+ * \brief Sets the last error message for a given \ref cardano_constr_plutus_data_t object.
+ *
+ * Records an error message in the constr_plutus_data's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] constr_plutus_data A pointer to the \ref cardano_constr_plutus_data_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the constr_plutus_data's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_constr_plutus_data_set_last_error(cardano_constr_plutus_data_t* constr_plutus_data, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific \ref cardano_constr_plutus_data_t.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_constr_plutus_data_set_last_error for the given
+ * \ref cardano_constr_plutus_data_t. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] constr_plutus_data A pointer to the \ref cardano_constr_plutus_data_t instance whose last error
+ *                   message is to be retrieved. If the constr_plutus_data is NULL, the function
+ *                   returns a generic error message indicating the null constr_plutus_data.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified constr_plutus_data. If the constr_plutus_data is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_constr_plutus_data_set_last_error for the same constr_plutus_data, or until
+ *       the constr_plutus_data is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_constr_plutus_data_get_last_error(const cardano_constr_plutus_data_t* constr_plutus_data);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_constr_plutus_data_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_constr_plutus_data_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_constr_plutus_data_deep_clone(const cardano_constr_plutus_data_t* source, cardano_constr_plutus_data_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CONSTR_PLUTUS_DATA_H
diff --git a/vendor/include/cardano/plutus_data/plutus_data.h b/vendor/include/cardano/plutus_data/plutus_data.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/plutus_data/plutus_data.h
@@ -0,0 +1,1080 @@
+/**
+ * \file plutus_data.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_DATA_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_DATA_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/bigint.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/plutus_data/plutus_data_kind.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The main datatype `Constr` represents the nth constructor
+ * along with its arguments.
+ **/
+typedef struct cardano_constr_plutus_data_t cardano_constr_plutus_data_t;
+
+/**
+ * \brief Represents a map of plutus data.
+ */
+typedef struct cardano_plutus_map_t cardano_plutus_map_t;
+
+/**
+ * \brief Represents a list of plutus data.
+ */
+typedef struct cardano_plutus_list_t cardano_plutus_list_t;
+
+/**
+ * \brief A type corresponding to the Plutus Core Data datatype.
+ *
+ * The point of this type is to be opaque as to ensure that it is only used in ways
+ * that plutus scripts can handle.
+ *
+ * Use this type to build any data structures that you want to be representable on-chain.
+ */
+typedef struct cardano_plutus_data_t cardano_plutus_data_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_data from a constr_plutus_data.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_data_t object
+ * from a given \ref cardano_constr_plutus_data_t object. It essentially converts a constr_plutus_data
+ * into a plutus_data. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] constr A constant pointer to the \ref cardano_constr_plutus_data_t object from which
+ *                   the plutus_data will be created. The object must not be NULL.
+ * \param[out] plutus_data On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_data_t object. This object represents a "strong reference"
+ *             to the plutus_data, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_data is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_data was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constr_plutus_data_t* constr_plutus_data = cardano_constr_plutus_data_new(...);
+ * cardano_plutus_data_t* plutus_data = NULL;
+ *
+ * // Attempt to create a new plutus_data from a constr_plutus_data
+ * cardano_error_t result = cardano_plutus_data_new_constr(constr_plutus_data, &plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_data
+ *
+ *   // Once done, ensure to clean up and release the plutus_data
+ *   cardano_plutus_data_unref(&plutus_data);
+ * }
+ *
+ * // Clean up the constr_plutus_data object once done
+ * cardano_constr_plutus_data_unref(&constr_plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_new_constr(
+  cardano_constr_plutus_data_t* constr,
+  cardano_plutus_data_t**       plutus_data);
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_data from a plutus_map.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_data_t object
+ * from a given \ref cardano_plutus_map_t object. It essentially converts a plutus map
+ * into a plutus data. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] map A pointer to the \ref cardano_plutus_map_t object from which
+ *                the plutus data will be created.
+ * \param[out] plutus_data On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_data_t object. This object represents a "strong reference"
+ *             to the plutus data, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_data is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_data was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_map_t* map = cardano_plutus_map_new(...);
+ * cardano_plutus_data_t* plutus_data = NULL;
+ *
+ * // Attempt to create a new plutus_data from a plutus_map
+ * cardano_error_t result = cardano_plutus_data_new_map(map, &plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_data
+ *
+ *   // Once done, ensure to clean up and release the plutus_data
+ *   cardano_plutus_data_unref(&plutus_data);
+ * }
+ *
+ * // Clean up the plutus_map object once done
+ * cardano_plutus_map_unref(&map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_new_map(
+  cardano_plutus_map_t*   map,
+  cardano_plutus_data_t** plutus_data);
+
+/**
+ * \brief Creates and initializes a new instance of a plutus data from a plutus list.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_data_t object
+ * from a given \ref cardano_plutus_list_t object. It essentially converts a plutus list
+ * into a plutus data. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] list A pointer to the \ref cardano_plutus_list_t object from which
+ *                 the plutus data will be created. The object must not be NULL.
+ * \param[out] plutus_data On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_data_t object. This object represents a "strong reference"
+ *             to the plutus_data, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_data is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_data was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_list_t* list = cardano_plutus_list_new(...);
+ * cardano_plutus_data_t* plutus_data = NULL;
+ *
+ * // Attempt to create a new plutus_data from a plutus_list
+ * cardano_error_t result = cardano_plutus_data_new_list(list, &plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_data
+ *
+ *   // Once done, ensure to clean up and release the plutus_data
+ *   cardano_plutus_data_unref(&plutus_data);
+ * }
+ *
+ * // Clean up the plutus_list object once done
+ * cardano_plutus_list_unref(&list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_new_list(
+  cardano_plutus_list_t*  list,
+  cardano_plutus_data_t** plutus_data);
+
+/**
+ * \brief Creates and initializes a new instance of plutus data from a bigint object.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_data_t object
+ * from a given bigint object.
+ *
+ * \param[in] bigint A constant pointer to the \ref cardano_bigint_t object from which the plutus_data will be created.
+ * \param[out] plutus_data On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_data_t object. This object represents a "strong reference"
+ *             to the plutus data, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus data is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus data was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume bigint is already initialized and set to a value
+ * cardano_bigint_t* bigint = ...;
+ * cardano_plutus_data_t* plutus_data = NULL;
+ *
+ * // Attempt to create a new plutus_data from a bigint
+ * cardano_error_t result = cardano_plutus_data_new_integer(bigint, &plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_data
+ *
+ *   // Once done, ensure to clean up and release the plutus_data
+ *   cardano_plutus_data_unref(&plutus_data);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_new_integer(
+  const cardano_bigint_t* bigint,
+  cardano_plutus_data_t** plutus_data);
+
+/**
+ * \brief Creates and initializes a new instance of plutus data from an integer value.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_data_t object
+ * from a given `int64_t` integer. It converts an integer into a plutus data object, suitable
+ * for transactions and other blockchain-related operations. It returns an error code to indicate
+ * the success or failure of the operation.
+ *
+ * \param[in] integer The `int64_t` integer value from which the plutus_data will be created.
+ * \param[out] plutus_data On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_data_t object. This object represents a "strong reference"
+ *             to the plutus data, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus data is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus data was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * int64_t integer_value = 42; // Example integer value
+ * cardano_plutus_data_t* plutus_data = NULL;
+ *
+ * // Attempt to create a new plutus_data from an integer value
+ * cardano_error_t result = cardano_plutus_data_new_integer_from_int(integer_value, &plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_data
+ *
+ *   // Once done, ensure to clean up and release the plutus_data
+ *   cardano_plutus_data_unref(&plutus_data);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_new_integer_from_int(
+  int64_t                 integer,
+  cardano_plutus_data_t** plutus_data);
+
+/**
+ * \brief Creates and initializes a new instance of plutus data from an unsigned integer value.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_data_t object
+ * from a given `uint64_t` integer.
+ *
+ * \param[in] integer The `uint64_t` integer value from which the plutus_data will be created.
+ * \param[out] plutus_data On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_data_t object. This object represents a "strong reference"
+ *             to the plutus data, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus data is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus data was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t integer_value = 18446744073709551615u; // Example unsigned integer value
+ * cardano_plutus_data_t* plutus_data = NULL;
+ *
+ * // Attempt to create a new plutus_data from an unsigned integer value
+ * cardano_error_t result = cardano_plutus_data_new_integer_from_uint(integer_value, &plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_data
+ *
+ *   // Once done, ensure to clean up and release the plutus_data
+ *   cardano_plutus_data_unref(&plutus_data);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_new_integer_from_uint(
+  uint64_t                integer,
+  cardano_plutus_data_t** plutus_data);
+
+/**
+ * \brief Creates and initializes a new instance of Plutus data from a string representation of an integer in a specified base.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_data_t object from a given string
+ * representing an integer, interpreted according to the specified base (e.g., 10 for decimal, 16 for hexadecimal).
+ *
+ * \param[in] string A pointer to the character string containing the numeric representation of the integer.
+ * \param[in] size The number of characters in the string, excluding the null terminator.
+ * \param[in] base The numerical base in which the string representation is expressed. Valid values are between 2 and 36.
+ * \param[out] plutus_data On successful initialization, this will point to a newly created
+ *                         \ref cardano_plutus_data_t object. This object represents a "strong reference"
+ *                         to the plutus data, meaning that it is fully initialized and ready for use.
+ *                         The caller is responsible for managing the lifecycle of this object.
+ *                         Specifically, once the plutus data is no longer needed, the caller must release it
+ *                         by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus data was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* integer_str = "12345678901234567890"; // Example large integer value in string form
+ * cardano_plutus_data_t* plutus_data = NULL;
+ * int32_t base = 10; // Decimal base
+ *
+ * // Attempt to create a new plutus_data from a string representation of an integer in decimal
+ * cardano_error_t result = cardano_plutus_data_new_integer_from_string(integer_str, strlen(integer_str), base, &plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_data
+ *
+ *   // Once done, ensure to clean up and release the plutus_data
+ *   cardano_plutus_data_unref(&plutus_data);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_new_integer_from_string(
+  const char*             string,
+  size_t                  size,
+  int32_t                 base,
+  cardano_plutus_data_t** plutus_data);
+
+/**
+ * \brief Creates and initializes a new instance of a plutus data from a byte array.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_data_t object
+ * from a given byte array. It essentially converts a byte array into a plutus data.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] bytes A pointer to the byte array from which the plutus_data will be created.
+ *                  The byte array must not be NULL.
+ * \param[in] size The size of the byte array.
+ * \param[out] plutus_data On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_data_t object. This object represents a "strong reference"
+ *             to the plutus data, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus data is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus data was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t bytes[] = {0x01, 0x02, 0x03, 0x04}; // Example byte array
+ * size_t size = sizeof(bytes) / sizeof(byte_t); // Calculate the size of the byte array
+ * cardano_plutus_data_t* plutus_data = NULL;
+ *
+ * // Attempt to create a new plutus data from a byte array
+ * cardano_error_t result = cardano_plutus_data_new_bytes(bytes, size, &plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus data
+ *
+ *   // Once done, ensure to clean up and release the plutus data
+ *   cardano_plutus_data_unref(&plutus_data);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_new_bytes(
+  const byte_t*           bytes,
+  size_t                  size,
+  cardano_plutus_data_t** plutus_data);
+
+/**
+ * \brief Creates and initializes a new instance of a plutus data from a hexadecimal string.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_data_t object
+ * from a given hexadecimal string. It essentially converts a hexadecimal string into a plutus data,
+ * treating each pair of characters as a byte. It returns an error code to indicate the success or
+ * failure of the operation.
+ *
+ * \param[in] hex A pointer to the hexadecimal string from which the plutus data will be created.
+ *                The hexadecimal string must not be NULL.
+ * \param[in] size The size of the hexadecimal string.
+ * \param[out] plutus_data On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_data_t object. This object represents a "strong reference"
+ *             to the plutus data, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus data is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus data was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* hex_string = "0123456789abcdef"; // Example hexadecimal string
+ * size_t size = strlen(hex_string); // Calculate the size of the string
+ * cardano_plutus_data_t* plutus_data = NULL;
+ *
+ * // Attempt to create a new plutus data from a hexadecimal string
+ * cardano_error_t result = cardano_plutus_data_new_bytes_from_hex(hex_string, size, &plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus data
+ *
+ *   // Once done, ensure to clean up and release the plutus data
+ *   cardano_plutus_data_unref(&plutus_data);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_new_bytes_from_hex(
+  const char*             hex,
+  size_t                  size,
+  cardano_plutus_data_t** plutus_data);
+
+/**
+ * \brief Creates a plutus_data from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_data_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_data.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_data data.
+ * \param[out] plutus_data A pointer to a pointer of \ref cardano_plutus_data_t that will be set to the address
+ *                        of the newly created plutus_data object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_data was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the data and invalidate any existing signatures.
+ *         To prevent this, when a plutus data object is created using \ref cardano_plutus_data_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_plutus_data_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_plutus_data_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_data_t object by calling
+ *       \ref cardano_plutus_data_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_data_t* plutus_data = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_data_from_cbor(reader, &plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_data
+ *
+ *   // Once done, ensure to clean up and release the plutus_data
+ *   cardano_plutus_data_unref(&plutus_data);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_data: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_data_t** plutus_data);
+
+/**
+ * \brief Serializes a plutus_data into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_data_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_data A constant pointer to the \ref cardano_plutus_data_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_data or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the data and invalidate any existing signatures.
+ *         To prevent this, when a plutus data object is created using \ref cardano_plutus_data_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_plutus_data_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_plutus_data_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_t* plutus_data = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_data_to_cbor(plutus_data, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_data_unref(&plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_to_cbor(
+  const cardano_plutus_data_t* plutus_data,
+  cardano_cbor_writer_t*       writer);
+
+/**
+ * \brief Serializes a Plutus data object to CIP-116 JSON.
+ *
+ * This function recursively serializes the Plutus data structure according to the
+ * schema definitions (constr, map, list, integer, bytes).
+ *
+ * \param[in]  data    Pointer to a valid \ref cardano_plutus_data_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p data or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * CARDANO_ERROR_INVALID_ARGUMENT         If the data type is unknown.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_to_cip116_json(
+  const cardano_plutus_data_t* data,
+  cardano_json_writer_t*       writer);
+
+/**
+ * \brief Retrieves the kind of the plutus_data.
+ *
+ * This function retrieves the kind of a given \ref cardano_plutus_data_t object and stores it in the provided
+ * output parameter. The plutus data kind is defined in the \ref cardano_plutus_data_kind_t enumeration, which
+ * specifies whether the plutus data represents an integer, byte array, or other types.
+ *
+ * \param[in] plutus_data A constant pointer to the \ref cardano_plutus_data_t object from which
+ *                        the kind is to be retrieved. The object must not be NULL.
+ * \param[out] kind Pointer to a variable where the plutus_data kind will be stored. This variable will
+ *                  be set to the value from the \ref cardano_plutus_data_kind_t enumeration.
+ *
+ * \return \ref CARDANO_SUCCESS if the kind was successfully retrieved, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_t* plutus_data = cardano_plutus_data_new_bytes_from_hex(...);
+ * cardano_plutus_data_kind_t kind;
+ * cardano_error_t result = cardano_plutus_data_get_kind(plutus_data, &kind);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (kind == CARDANO_PLUTUS_DATA_KIND_INTEGER)
+ *   {
+ *     // Handle integer type plutus_data
+ *   }
+ *   else if (kind == CARDANO_PLUTUS_DATA_KIND_BYTES)
+ *   {
+ *     // Handle byte array type plutus_data
+ *   }
+ *   // Add more cases as needed for other kinds
+ * }
+ *
+ * // Clean up the plutus_data object once done
+ * cardano_plutus_data_unref(&plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_get_kind(
+  const cardano_plutus_data_t* plutus_data,
+  cardano_plutus_data_kind_t*  kind);
+
+/**
+ * \brief Converts a plutus data object to a constr plutus data object.
+ *
+ * This function converts a \ref cardano_plutus_data_t object to a \ref cardano_constr_plutus_data_t object.
+ * It essentially creates a constr_plutus_data object from the given plutus_data, allowing the conversion
+ * between different types of plutus data. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] plutus_data A constant pointer to the \ref cardano_plutus_data_t object to be converted.
+ * \param[out] constr On successful conversion, this will point to a newly created
+ *                    \ref cardano_constr_plutus_data_t object. This object represents a "strong reference"
+ *                    to the constr_plutus_data, meaning that it is fully initialized and ready for use.
+ *                    The caller is responsible for managing the lifecycle of this object.
+ *                    Specifically, once the constr_plutus_data is no longer needed, the caller must release it
+ *                    by calling \ref cardano_constr_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_t* plutus_data = ...; // Assume plutus_data is a valid constr plutus data object
+ * cardano_constr_plutus_data_t* constr = NULL;
+ * cardano_error_t result = cardano_plutus_data_to_constr(plutus_data, &constr);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the constr_plutus_data
+ *
+ *   // Once done, ensure to clean up and release the constr_plutus_data
+ *   cardano_constr_plutus_data_unref(&constr);
+ * }
+ *
+ * // Clean up the plutus_data object once done
+ * cardano_plutus_data_unref(&plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_to_constr(
+  cardano_plutus_data_t*         plutus_data,
+  cardano_constr_plutus_data_t** constr);
+
+/**
+ * \brief Converts a plutus data object to a plutus map object.
+ *
+ * This function converts a \ref cardano_plutus_data_t object to a \ref cardano_plutus_map_t object.
+ * It essentially creates a plutus map object from the given plutus data, allowing the conversion
+ * between different types of plutus data. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] plutus_data A constant pointer to the \ref cardano_plutus_data_t object to be converted.
+ *                        The object must not be NULL.
+ * \param[out] map On successful conversion, this will point to a newly created
+ *                 \ref cardano_plutus_map_t object. This object represents a "strong reference"
+ *                 to the plutus_map, meaning that it is fully initialized and ready for use.
+ *                 The caller is responsible for managing the lifecycle of this object.
+ *                 Specifically, once the plutus_map is no longer needed, the caller must release it
+ *                 by calling \ref cardano_plutus_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_t* plutus_data = ...; // Assume plutus_data is a valid plutus map object
+ * cardano_plutus_map_t* map = NULL;
+ * cardano_error_t result = cardano_plutus_data_to_map(plutus_data, &map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_map
+ *
+ *   // Once done, ensure to clean up and release the plutus_map
+ *   cardano_plutus_map_unref(&map);
+ * }
+ *
+ * // Clean up the plutus_data object once done
+ * cardano_plutus_data_unref(&plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_to_map(
+  cardano_plutus_data_t* plutus_data,
+  cardano_plutus_map_t** map);
+
+/**
+ * \brief Converts a plutus data object to a plutus list object.
+ *
+ * This function converts a \ref cardano_plutus_data_t object to a \ref cardano_plutus_list_t object.
+ * It essentially creates a plutus list object from the given plutus data, allowing the conversion
+ * between different types of plutus data. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] plutus_data A constant pointer to the \ref cardano_plutus_data_t object to be converted.
+ * \param[out] list On successful conversion, this will point to a newly created
+ *                  \ref cardano_plutus_list_t object. This object represents a "strong reference"
+ *                  to the plutus_list, meaning that it is fully initialized and ready for use.
+ *                  The caller is responsible for managing the lifecycle of this object.
+ *                  Specifically, once the plutus_list is no longer needed, the caller must release it
+ *                  by calling \ref cardano_plutus_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_t* plutus_data = ...; // Assume plutus_data is a valid plutus list object
+ * cardano_plutus_list_t* list = NULL;
+ * cardano_error_t result = cardano_plutus_data_to_list(plutus_data, &list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_list
+ *
+ *   // Once done, ensure to clean up and release the plutus_list
+ *   cardano_plutus_list_unref(&list);
+ * }
+ *
+ * // Clean up the plutus_data object once done
+ * cardano_plutus_data_unref(&plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_to_list(
+  cardano_plutus_data_t*  plutus_data,
+  cardano_plutus_list_t** list);
+
+/**
+ * \brief Converts a plutus data object to a bigint object.
+ *
+ * This function converts a \ref cardano_plutus_data_t object to a \ref cardano_bigint_t object.
+ *
+ * \param[in] plutus_data A constant pointer to the \ref cardano_plutus_data_t object to be converted.
+ * \param[out] integer On successful conversion, this will point to a newly created \ref cardano_bigint_t object
+ *                     representing the extracted integer value. The caller is responsible for managing the memory
+ *                     of this object, including releasing it when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_t* plutus_data = cardano_plutus_data_new_integer_from_string("987456321478523698745");
+ * cardano_bigint_t* bigint = NULL;
+ * cardano_error_t result = cardano_plutus_data_to_integer(plutus_data, &bigint);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bigint object
+ *   const size_t size = cardano_bigint_get_string_size(bigint, 10);
+ *   char* buffer = (char*)malloc(size);
+ *
+ *   if (cardano_bigint_to_string(bigint, buffer, size, 10) == CARDANO_SUCCESS)
+ *   {
+ *     printf("Extracted bigint value: %s\n", buffer);
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_plutus_data_unref(&plutus_data);
+ * cardano_bigint_unref(&bigint);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_to_integer(
+  const cardano_plutus_data_t* plutus_data,
+  cardano_bigint_t**           integer);
+
+/**
+ * \brief Converts a plutus data object to bounded bytes.
+ *
+ * This function converts a \ref cardano_plutus_data_t object to bounded bytes.
+ * It extracts the bytes from the given plutus data, allowing the conversion
+ * between different types of plutus data. The resulting bytes are stored in a bounded bytes buffer.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] plutus_data A constant pointer to the \ref cardano_plutus_data_t object to be converted.
+ * \param[out] bounded_bytes On successful conversion, this will point to a newly created
+ *                           \ref cardano_buffer_t object containing the extracted bytes.
+ *                           This object represents a "strong reference" to the bounded bytes,
+ *                           meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the bounded bytes are no longer needed, the caller must release it
+ *                           by calling \ref cardano_buffer_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_t* plutus_data = cardano_plutus_data_new_bytes_from_hex("DEADBEEF", 8);
+ * cardano_buffer_t* bounded_bytes = NULL;
+ * cardano_error_t result = cardano_plutus_data_to_bounded_bytes(plutus_data, &bounded_bytes);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bounded bytes
+ *   printf("Extracted bounded bytes: ");
+ *
+ *   for (size_t i = 0; i < cardano_buffer_get_size(bounded_bytes); ++i)
+ *   {
+ *     printf("%02X ", cardano_buffer_get_data(bounded_bytes)[i]);
+ *   }
+ *
+ *   printf("\n");
+ *
+ *   // Once done, ensure to clean up and release the bounded bytes
+ *   cardano_buffer_unref(&bounded_bytes);
+ * }
+ *
+ * // Clean up the plutus_data object once done
+ * cardano_plutus_data_unref(&plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_to_bounded_bytes(
+  cardano_plutus_data_t* plutus_data,
+  cardano_buffer_t**     bounded_bytes);
+
+/**
+ * \brief Checks if two plutus_data objects are equal.
+ *
+ * This function compares two \ref cardano_plutus_data_t objects for equality.
+ * It checks if the contents of the two plutus_data objects are identical.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_plutus_data_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_plutus_data_t object to be compared.
+ *
+ * \return \c true if the two plutus_data objects are equal (have the same contents), \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_t* plutus_data1 = cardano_plutus_data_new_bytes_from_hex("DEADBEEF", 8);
+ * cardano_plutus_data_t* plutus_data2 = cardano_plutus_data_new_bytes_from_hex("DEADBEEF", 8);
+ *
+ * if (cardano_plutus_data_equals(plutus_data1, plutus_data2))
+ * {
+ *   printf("plutus_data1 is equal to plutus_data2\n");
+ * }
+ * else
+ * {
+ *   printf("plutus_data1 is not equal to plutus_data2\n");
+ * }
+ *
+ * // Clean up the plutus_data objects once done
+ * cardano_plutus_data_unref(&plutus_data1);
+ * cardano_plutus_data_unref(&plutus_data2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_data_equals(const cardano_plutus_data_t* lhs, const cardano_plutus_data_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a plutus data.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_plutus_data_t object.
+ * It is useful when you have modified the plutus_data after it was created from CBOR using
+ * \ref cardano_plutus_data_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the plutus_data, rather than using the original cached CBOR.
+ *
+ * \param[in,out] plutus_data A pointer to an initialized \ref cardano_plutus_data_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the plutus data when
+ *          serialized, which can alter the plutus data and invalidate any existing signatures.
+ *          Use this function with caution, especially if the transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume plutus_data was created using cardano_plutus_data_from_cbor
+ * cardano_plutus_data_t* plutus_data = ...;
+ *
+ * // Modify the plutus_data as needed
+ * // For example, change the fee
+
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to set new fee: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated plutus_data
+ * cardano_plutus_data_clear_cbor_cache(plutus_data);
+ *
+ * // Serialize the plutus_data to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_plutus_data_to_cbor(plutus_data, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_plutus_data_unref(&plutus_data);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_plutus_data_clear_cbor_cache(cardano_plutus_data_t* plutus_data);
+
+/**
+ * \brief Decrements the reference count of a plutus_data object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_data_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_data is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_data A pointer to the pointer of the plutus_data object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_t* plutus_data = cardano_plutus_data_new();
+ *
+ * // Perform operations with the plutus_data...
+ *
+ * cardano_plutus_data_unref(&plutus_data);
+ * // At this point, plutus_data is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_data_unref, the pointer to the \ref cardano_plutus_data_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_data_unref(cardano_plutus_data_t** plutus_data);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_data_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_data
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_data_unref.
+ *
+ * \param plutus_data A pointer to the plutus_data object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_data is a previously created plutus_data object
+ *
+ * cardano_plutus_data_ref(plutus_data);
+ *
+ * // Now plutus_data can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_data_ref there is a corresponding
+ * call to \ref cardano_plutus_data_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_data_ref(cardano_plutus_data_t* plutus_data);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_data_t object.
+ *
+ * This function returns the number of active references to a plutus_data object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_data_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_data A pointer to the plutus_data object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_data object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_data_ref call is matched with a
+ * \ref cardano_plutus_data_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_data is a previously created plutus_data object
+ *
+ * size_t ref_count = cardano_plutus_data_refcount(plutus_data);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_data_refcount(const cardano_plutus_data_t* plutus_data);
+
+/**
+ * \brief Sets the last error message for a given plutus_data object.
+ *
+ * Records an error message in the plutus_data's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_data A pointer to the \ref cardano_plutus_data_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_data's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_data_set_last_error(cardano_plutus_data_t* plutus_data, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_data.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_data_set_last_error for the given
+ * plutus_data. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_data A pointer to the \ref cardano_plutus_data_t instance whose last error
+ *                   message is to be retrieved. If the plutus_data is NULL, the function
+ *                   returns a generic error message indicating the null plutus_data.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_data. If the plutus_data is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_data_set_last_error for the same plutus_data, or until
+ *       the plutus_data is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_data_get_last_error(const cardano_plutus_data_t* plutus_data);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_data_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_data_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_deep_clone(const cardano_plutus_data_t* source, cardano_plutus_data_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_DATA_H
diff --git a/vendor/include/cardano/plutus_data/plutus_data_kind.h b/vendor/include/cardano/plutus_data/plutus_data_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/plutus_data/plutus_data_kind.h
@@ -0,0 +1,73 @@
+/**
+ * \file plutus_data_kind.h
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_DATA_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_DATA_KIND_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \enum cardano_plutus_data_kind_t
+ * \brief The plutus data type kind.
+ */
+typedef enum
+{
+  /**
+   * \brief Represents a specific constructor of a 'Sum Type' along with its arguments.
+   */
+  CARDANO_PLUTUS_DATA_KIND_CONSTR,
+
+  /**
+   * \brief A map of PlutusData as both key and values.
+   */
+  CARDANO_PLUTUS_DATA_KIND_MAP,
+
+  /**
+   * \brief A list of PlutusData.
+   */
+  CARDANO_PLUTUS_DATA_KIND_LIST,
+
+  /**
+   * \brief An integer.
+   */
+  CARDANO_PLUTUS_DATA_KIND_INTEGER,
+
+  /**
+   * \brief Bounded bytes.
+   */
+  CARDANO_PLUTUS_DATA_KIND_BYTES
+
+} cardano_plutus_data_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_DATA_KIND_H
diff --git a/vendor/include/cardano/plutus_data/plutus_list.h b/vendor/include/cardano/plutus_data/plutus_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/plutus_data/plutus_list.h
@@ -0,0 +1,536 @@
+/**
+ * \file plutus_list.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A type corresponding to the Plutus Core Data datatype.
+ */
+typedef struct cardano_plutus_data_t cardano_plutus_data_t;
+
+/**
+ * \brief Represents a list of plutus data.
+ */
+typedef struct cardano_plutus_list_t cardano_plutus_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_plutus_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] plutus_list On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_list_t object. This object represents a "strong reference"
+ *             to the plutus_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_list_t* plutus_list = NULL;
+ *
+ * // Attempt to create a new plutus_list
+ * cardano_error_t result = cardano_plutus_list_new(&plutus_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_list
+ *
+ *   // Once done, ensure to clean up and release the plutus_list
+ *   cardano_plutus_list_unref(&plutus_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_list_new(cardano_plutus_list_t** plutus_list);
+
+/**
+ * \brief Creates a plutus_list from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_list_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_list.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_list data.
+ * \param[out] plutus_list A pointer to a pointer of \ref cardano_plutus_list_t that will be set to the address
+ *                        of the newly created plutus_list object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_list was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the data and invalidate any existing signatures.
+ *         To prevent this, when a plutus data object is created using \ref cardano_plutus_list_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_plutus_list_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_plutus_list_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_list_t object by calling
+ *       \ref cardano_plutus_list_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_list_t* plutus_list = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_list_from_cbor(reader, &plutus_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_list
+ *
+ *   // Once done, ensure to clean up and release the plutus_list
+ *   cardano_plutus_list_unref(&plutus_list);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_list: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_list_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_list_t** plutus_list);
+
+/**
+ * \brief Serializes a plutus_list into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_list_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_list A constant pointer to the \ref cardano_plutus_list_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_list or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the data and invalidate any existing signatures.
+ *         To prevent this, when a plutus data object is created using \ref cardano_plutus_list_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_plutus_list_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_plutus_list_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_list_t* plutus_list = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_list_to_cbor(plutus_list, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_list_unref(&plutus_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_list_to_cbor(
+  const cardano_plutus_list_t* plutus_list,
+  cardano_cbor_writer_t*       writer);
+
+/**
+ * \brief Serializes a Plutus list to a CIP-116 JSON array.
+ *
+ * This function recursively serializes the elements of the Plutus list as a JSON array.
+ * Each element in the list is serialized as a PlutusData object.
+ *
+ * \param[in]  list    Pointer to a valid \ref cardano_plutus_list_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p list or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_list_to_cip116_json(
+  const cardano_plutus_list_t* list,
+  cardano_json_writer_t*       writer);
+
+/**
+ * \brief Retrieves the length of a plutus list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_plutus_list_t object.
+ *
+ * \param[in] plutus_list A constant pointer to the \ref cardano_plutus_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the plutus_list. Return 0 if the plutus_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_list_t* plutus_list = cardano_plutus_list_new();
+ *
+ * // Populate plutus_list with elements
+ *
+ * size_t length = cardano_plutus_list_get_length(plutus_list);
+ * printf("Length of the plutus_list: %zu\n", length);
+ *
+ * // Clean up the plutus_list object once done
+ * cardano_plutus_list_unref(&plutus_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_list_get_length(const cardano_plutus_list_t* plutus_list);
+
+/**
+ * \brief Retrieves an element from a plutus list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_plutus_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] plutus_list A constant pointer to the \ref cardano_plutus_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the plutus list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_plutus_data_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_plutus_data_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_list_t* plutus_list = cardano_plutus_list_new();
+ *
+ * // Populate plutus_list with elements
+ *
+ * cardano_plutus_data_t* element = NULL;
+ * cardano_error_t result = cardano_plutus_list_get(plutus_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_plutus_data_unref(&element);
+ * }
+ *
+ * // Clean up the plutus_list object once done
+ * cardano_plutus_list_unref(&plutus_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_list_get(const cardano_plutus_list_t* plutus_list, size_t index, cardano_plutus_data_t** element);
+
+/**
+ * \brief Adds an element to a plutus list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_plutus_list_t object.
+ *
+ * \param[in] plutus_list A constant pointer to the \ref cardano_plutus_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_plutus_data_t object that is to be added to the plutus_list.
+ *                    The element will be referenced by the plutus_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the plutus_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_list_t* plutus_list = cardano_plutus_list_new();
+ *
+ * // Create and initialize a new plutus_data element
+ * cardano_plutus_data_t* element = { ... };
+ *
+ * // Add the element to the plutus_list
+ * cardano_error_t result = cardano_plutus_list_add(plutus_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the plutus_list object once done
+ * cardano_plutus_list_unref(&plutus_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_list_add(cardano_plutus_list_t* plutus_list, cardano_plutus_data_t* element);
+
+/**
+ * \brief Checks if two plutus lists are equal.
+ *
+ * This function compares two \ref cardano_plutus_list_t objects to determine if they are equal. Two plutus lists
+ * are considered equal if they have the same number of elements and each corresponding pair of elements
+ * is equal according to the \ref cardano_plutus_data_equals function.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_plutus_list_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_plutus_list_t object to be compared.
+ *
+ * \return \c true if the two plutus_lists are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_list_t* list1 = { ... };  // Assume list1 is initialized here
+ * cardano_plutus_list_t* list2 = { ... };  // Assume list2 is initialized here
+ *
+ * if (cardano_plutus_list_equals(list1, list2))
+ * {
+ *   // The two plutus_lists are equal
+ * }
+ * else
+ * {
+ *   // The two plutus_lists are not equal
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_list_equals(const cardano_plutus_list_t* lhs, const cardano_plutus_list_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a plutus list.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_plutus_list_t object.
+ * It is useful when you have modified the plutus list after it was created from CBOR using
+ * \ref cardano_plutus_list_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the plutus list, rather than using the original cached CBOR.
+ *
+ * \param[in,out] plutus_list A pointer to an initialized \ref cardano_plutus_list_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the plutus list when
+ *          serialized, which can alter the plutus list and invalidate any existing signatures.
+ *          Use this function with caution, especially if the transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume plutus_list was created using cardano_plutus_list_from_cbor
+ * cardano_plutus_list_t* plutus_list = ...;
+ *
+ * // Modify the plutus_list as needed
+ * // For example, change the fee
+
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to set new fee: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated plutus_list
+ * cardano_plutus_list_clear_cbor_cache(plutus_list);
+ *
+ * // Serialize the plutus_list to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_plutus_list_to_cbor(plutus_list, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_plutus_list_unref(&plutus_list);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_plutus_list_clear_cbor_cache(cardano_plutus_list_t* plutus_list);
+
+/**
+ * \brief Decrements the reference count of a plutus_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_list A pointer to the pointer of the plutus_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_list_t* plutus_list = cardano_plutus_list_new();
+ *
+ * // Perform operations with the plutus_list...
+ *
+ * cardano_plutus_list_unref(&plutus_list);
+ * // At this point, plutus_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_list_unref, the pointer to the \ref cardano_plutus_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_list_unref(cardano_plutus_list_t** plutus_list);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_list_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_list_unref.
+ *
+ * \param plutus_list A pointer to the plutus_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_list is a previously created plutus_list object
+ *
+ * cardano_plutus_list_ref(plutus_list);
+ *
+ * // Now plutus_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_list_ref there is a corresponding
+ * call to \ref cardano_plutus_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_list_ref(cardano_plutus_list_t* plutus_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_list_t object.
+ *
+ * This function returns the number of active references to a plutus_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_list A pointer to the plutus_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_list object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_list_ref call is matched with a
+ * \ref cardano_plutus_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_list is a previously created plutus_list object
+ *
+ * size_t ref_count = cardano_plutus_list_refcount(plutus_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_list_refcount(const cardano_plutus_list_t* plutus_list);
+
+/**
+ * \brief Sets the last error message for a given plutus_list object.
+ *
+ * Records an error message in the plutus_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_list A pointer to the \ref cardano_plutus_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_list_set_last_error(cardano_plutus_list_t* plutus_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_list_set_last_error for the given
+ * plutus_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_list A pointer to the \ref cardano_plutus_list_t instance whose last error
+ *                   message is to be retrieved. If the plutus_list is NULL, the function
+ *                   returns a generic error message indicating the null plutus_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_list. If the plutus_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_list_set_last_error for the same plutus_list, or until
+ *       the plutus_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_list_get_last_error(const cardano_plutus_list_t* plutus_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_list_deep_clone(const cardano_plutus_list_t* source, cardano_plutus_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_LIST_H
diff --git a/vendor/include/cardano/plutus_data/plutus_map.h b/vendor/include/cardano/plutus_data/plutus_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/plutus_data/plutus_map.h
@@ -0,0 +1,643 @@
+/**
+ * \file plutus_map.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of plutus data.
+ */
+typedef struct cardano_plutus_map_t cardano_plutus_map_t;
+
+/**
+ * \brief A type corresponding to the Plutus Core Data datatype.
+ */
+typedef struct cardano_plutus_data_t cardano_plutus_data_t;
+
+/**
+ * \brief Represents a list of plutus data.
+ */
+typedef struct cardano_plutus_list_t cardano_plutus_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_plutus_map_t,
+ * representing a map structure in the Plutus smart contract language. It returns an error code
+ * to indicate the success or failure of the operation.
+ *
+ * \param[out] plutus_map A pointer to a pointer to a \ref cardano_plutus_map_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_plutus_map_t
+ *                        object. This object represents a "strong reference" to the plutus_map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the plutus_map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_plutus_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_map_t* plutus_map = NULL;
+ *
+ * // Attempt to create a new plutus_map
+ * cardano_error_t result = cardano_plutus_map_new(&plutus_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_map
+ *
+ *   // Once done, ensure to clean up and release the plutus_map
+ *   cardano_plutus_map_unref(&plutus_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_map_new(cardano_plutus_map_t** plutus_map);
+
+/**
+ * \brief Creates a plutus map from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_map_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_map.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_map data.
+ * \param[out] plutus_map A pointer to a pointer of \ref cardano_plutus_map_t that will be set to the address
+ *                        of the newly created plutus_map object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_map was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the data and invalidate any existing signatures.
+ *         To prevent this, when a plutus data object is created using \ref cardano_plutus_map_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_plutus_map_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_plutus_map_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_map_t object by calling
+ *       \ref cardano_plutus_map_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_map_t* plutus_map = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_map_from_cbor(reader, &plutus_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_map
+ *
+ *   // Once done, ensure to clean up and release the plutus_map
+ *   cardano_plutus_map_unref(&plutus_map);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_map: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_map_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_map_t** plutus_map);
+
+/**
+ * \brief Serializes a plutus map into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_map_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_map A constant pointer to the \ref cardano_plutus_map_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_map or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the data and invalidate any existing signatures.
+ *         To prevent this, when a plutus data object is created using \ref cardano_plutus_map_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_plutus_map_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_plutus_map_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_map_t* plutus_map = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_map_to_cbor(plutus_map, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_map_unref(&plutus_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_map_to_cbor(
+  const cardano_plutus_map_t* plutus_map,
+  cardano_cbor_writer_t*      writer);
+
+/**
+ * \brief Serializes the contents of a Plutus map to a CIP-116 JSON array.
+ *
+ * This function recursively serializes the key-value pairs of the Plutus map
+ * into a JSON array of objects, where each object has a "key" and a "value" field.
+ *
+ * \param[in]  map     Pointer to a valid \ref cardano_plutus_map_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p map or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_map_to_cip116_json(
+  const cardano_plutus_map_t* map,
+  cardano_json_writer_t*      writer);
+
+/**
+ * \brief Retrieves the length of the plutus_map.
+ *
+ * This function returns the number of key-value pairs contained in the specified plutus_map.
+ *
+ * \param[in] plutus_map A constant pointer to the \ref cardano_plutus_map_t object for which
+ *                       the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the plutus_map. Returns 0 if the plutus_map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_map_t* plutus_map = cardano_plutus_map_new();
+ *
+ * // Populate the plutus_map with key-value pairs
+ *
+ * size_t length = cardano_plutus_map_get_length(plutus_map);
+ * printf("The length of the plutus_map is: %zu\n", length);
+ *
+ * cardano_plutus_map_unref(&plutus_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_map_get_length(const cardano_plutus_map_t* plutus_map);
+
+/**
+ * \brief Retrieves the value associated with a given key in the plutus map.
+ *
+ * This function retrieves the value associated with the specified key in the provided plutus map.
+ * It returns the value through the output parameter `element`. If the key is not found in the plutus map,
+ * the output parameter `element` will be set to NULL.
+ *
+ * \param[in] plutus_map A constant pointer to the \ref cardano_plutus_map_t object from which
+ *                       the value is to be retrieved.
+ * \param[in] key The key whose associated value is to be retrieved from the plutus_map.
+ * \param[out] element A pointer to a variable where the retrieved value will be stored. If the key
+ *                     is found in the plutus map, this variable will be set to the associated value.
+ *                     If the key is not found, this variable will be set to NULL. The caller is
+ *                     responsible for releasing the value by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the value associated with the key was successfully retrieved, or
+ *         an appropriate error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_map_t* plutus_map = cardano_plutus_map_new();
+ *
+ * // Populate the plutus_map with key-value pairs
+ *
+ * cardano_plutus_data_t* key = ...; // Create a plutus_data object representing the key
+ * cardano_plutus_data_t* value = NULL;
+ * cardano_error_t result = cardano_plutus_map_get(plutus_map, key, &value);
+ *
+ * if (result == CARDANO_SUCCESS && value != NULL)
+ * {
+ *   // Use the retrieved value
+ *   // ...
+ *   cardano_plutus_data_unref(&value); // Clean up the value resource
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_plutus_data_unref(&key); // Clean up the key resource
+ * cardano_plutus_map_unref(&plutus_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_map_get(cardano_plutus_map_t* plutus_map, cardano_plutus_data_t* key, cardano_plutus_data_t** element);
+
+/**
+ * \brief Inserts a key-value pair into the plutus map.
+ *
+ * This function inserts the specified key-value pair into the provided plutus map.
+ *
+ * \param[in] plutus_map A constant pointer to the \ref cardano_plutus_map_t object where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The key to be inserted into the plutus map. The caller is responsible for managing
+ *                the lifecycle of the key object.
+ * \param[in] value The value to be associated with the key and inserted into the plutus_map.
+ *                  The caller is responsible for managing the lifecycle of the value object.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_map_t* plutus_map = cardano_plutus_map_new();
+ *
+ * // Create key and value objects
+ * cardano_plutus_data_t* key = ...; // Create a plutus_data object representing the key
+ * cardano_plutus_data_t* value = ...; // Create a plutus_data object representing the value
+ *
+ * // Insert the key-value pair into the plutus_map
+ * cardano_error_t result = cardano_plutus_map_insert(plutus_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value objects
+ * cardano_plutus_data_unref(&key);
+ * cardano_plutus_data_unref(&value);
+ *
+ * cardano_plutus_map_unref(&plutus_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_map_insert(cardano_plutus_map_t* plutus_map, cardano_plutus_data_t* key, cardano_plutus_data_t* value);
+
+/**
+ * \brief Retrieves the keys from the plutus map.
+ *
+ * This function retrieves all the keys from the provided plutus map and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_plutus_list_unref when it is no longer needed.
+ *
+ * \param[in] plutus_map A constant pointer to the \ref cardano_plutus_map_t object from which
+ *                       the keys are to be retrieved.
+ * \param[out] keys A pointer to a variable where the retrieved keys will be stored as a list.
+ *                  If successful, this variable will be set to point to the list of keys.
+ *                  The caller is responsible for managing the lifecycle of this list.
+ *                  It must be released by calling \ref cardano_plutus_list_unref when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the keys were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_map_t* plutus_map = cardano_plutus_map_new();
+ *
+ * // Populate the plutus_map with key-value pairs
+ *
+ * cardano_plutus_list_t* keys = NULL;
+ * cardano_error_t result = cardano_plutus_map_get_keys(plutus_map, &keys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of keys
+ *   // Keys must also be freed if retrieved from the list
+ *
+ *   // Once done, ensure to clean up and release the keys list
+ *   cardano_plutus_list_unref(&keys);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_plutus_map_unref(&plutus_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_map_get_keys(cardano_plutus_map_t* plutus_map, cardano_plutus_list_t** keys);
+
+/**
+ * \brief Retrieves the values from the plutus map.
+ *
+ * This function retrieves all the values from the provided plutus map and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_plutus_list_unref when it is no longer needed.
+ *
+ * \param[in] plutus_map A constant pointer to the \ref cardano_plutus_map_t object from which
+ *                       the values are to be retrieved.
+ * \param[out] values A pointer to a variable where the retrieved values will be stored as a list.
+ *                    If successful, this variable will be set to point to the list of values.
+ *                    The caller is responsible for managing the lifecycle of this list.
+ *                    It must be released by calling \ref cardano_plutus_list_unref when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the values were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_map_t* plutus_map = cardano_plutus_map_new();
+ *
+ * // Populate the plutus_map with key-value pairs
+ *
+ * cardano_plutus_list_t* values = NULL;
+ * cardano_error_t result = cardano_plutus_map_get_values(plutus_map, &values);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of values
+ *
+ *   // Once done, ensure to clean up and release the values list
+ *   // Values must also be freed if retrieved from the list
+ *   cardano_plutus_list_unref(&values);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_plutus_map_unref(&plutus_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_map_get_values(cardano_plutus_map_t* plutus_map, cardano_plutus_list_t** values);
+
+/**
+ * \brief Checks if two plutus maps are equal.
+ *
+ * This function compares two plutus maps for equality. Two plutus maps are considered equal if they
+ * have the same keys and associated values.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_plutus_map_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_plutus_map_t object to be compared.
+ *
+ * \return \c true if the two plutus maps are equal, otherwise \c false.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_map_t* map1 = ...; // Populate the first plutus map
+ * cardano_plutus_map_t* map2 = ...; // Populate the second plutus map
+ *
+ * if (cardano_plutus_map_equals(map1, map2))
+ * {
+ *   // The two plutus maps are equal
+ * }
+ * else
+ * {
+ *   // The two plutus maps are not equal
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_map_equals(const cardano_plutus_map_t* lhs, const cardano_plutus_map_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a plutus map.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_plutus_map_t object.
+ * It is useful when you have modified the plutus map after it was created from CBOR using
+ * \ref cardano_plutus_map_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the plutus map, rather than using the original cached CBOR.
+ *
+ * \param[in,out] plutus_map A pointer to an initialized \ref cardano_plutus_map_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the plutus map when
+ *          serialized, which can alter the plutus map and invalidate any existing signatures.
+ *          Use this function with caution, especially if the transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume plutus_map was created using cardano_plutus_map_from_cbor
+ * cardano_plutus_map_t* plutus_map = ...;
+ *
+ * // Modify the plutus_map as needed
+ * // For example, change the fee
+
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to set new fee: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated plutus_map
+ * cardano_plutus_map_clear_cbor_cache(plutus_map);
+ *
+ * // Serialize the plutus_map to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_plutus_map_to_cbor(plutus_map, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_plutus_map_unref(&plutus_map);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_plutus_map_clear_cbor_cache(cardano_plutus_map_t* plutus_map);
+
+/**
+ * \brief Decrements the reference count of a plutus_map object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_map_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_map A pointer to the pointer of the plutus_map object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_map_t* plutus_map = cardano_plutus_map_new();
+ *
+ * // Perform operations with the plutus_map...
+ *
+ * cardano_plutus_map_unref(&plutus_map);
+ * // At this point, plutus_map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_map_unref, the pointer to the \ref cardano_plutus_map_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_map_unref(cardano_plutus_map_t** plutus_map);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_map_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_map
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_map_unref.
+ *
+ * \param plutus_map A pointer to the plutus_map object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_map is a previously created plutus_map object
+ *
+ * cardano_plutus_map_ref(plutus_map);
+ *
+ * // Now plutus_map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_map_ref there is a corresponding
+ * call to \ref cardano_plutus_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_map_ref(cardano_plutus_map_t* plutus_map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_map_t object.
+ *
+ * This function returns the number of active references to a plutus_map object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_map A pointer to the plutus_map object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_map object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_map_ref call is matched with a
+ * \ref cardano_plutus_map_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_map is a previously created plutus_map object
+ *
+ * size_t ref_count = cardano_plutus_map_refcount(plutus_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_map_refcount(const cardano_plutus_map_t* plutus_map);
+
+/**
+ * \brief Sets the last error message for a given plutus_map object.
+ *
+ * Records an error message in the plutus_map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_map A pointer to the \ref cardano_plutus_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_map_set_last_error(cardano_plutus_map_t* plutus_map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_map_set_last_error for the given
+ * plutus_map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_map A pointer to the \ref cardano_plutus_map_t instance whose last error
+ *                   message is to be retrieved. If the plutus_map is NULL, the function
+ *                   returns a generic error message indicating the null plutus_map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_map. If the plutus_map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_map_set_last_error for the same plutus_map, or until
+ *       the plutus_map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_map_get_last_error(const cardano_plutus_map_t* plutus_map);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_map_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_map_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_map_deep_clone(const cardano_plutus_map_t* source, cardano_plutus_map_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_MAP_H
diff --git a/vendor/include/cardano/pool_params/bls_key.h b/vendor/include/cardano/pool_params/bls_key.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/bls_key.h
@@ -0,0 +1,513 @@
+/**
+ * \file bls_key.h
+ *
+ * \author angel.castillo
+ * \date   Sep 05, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BLS_KEY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BLS_KEY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A stake pool BLS key.
+ *
+ * A stake pool may register a BLS12-381 public key so that it can take part in Leios voting.
+ * The key is registered together with a proof of possession, a signature that proves the pool
+ * operator controls the matching private key. The public key is 96 bytes long and the proof
+ * of possession is 48 bytes long.
+ */
+typedef struct cardano_bls_key_t cardano_bls_key_t;
+
+/**
+ * \brief Creates and initializes a new instance of a BLS key.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_bls_key_t from the raw
+ * bytes of the public key and its proof of possession.
+ *
+ * \param[in] public_key A pointer to a byte array containing the 96 bytes of the BLS public key.
+ * \param[in] public_key_size The size of the public key byte array, which must be exactly 96 bytes.
+ * \param[in] possession_proof A pointer to a byte array containing the 48 bytes of the proof of possession.
+ * \param[in] possession_proof_size The size of the proof of possession byte array, which must be exactly 48 bytes.
+ * \param[out] bls_key On successful initialization, this will point to the newly created
+ *             \ref cardano_bls_key_t object. The object represents a "strong reference"
+ *             to the BLS key, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the BLS key is no longer needed, the caller must
+ *             release it by calling \ref cardano_bls_key_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the BLS key was successfully created, \ref CARDANO_ERROR_INVALID_ARGUMENT if either byte
+ *         array has the wrong size, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t public_key[96] = { ... };
+ * const byte_t possession_proof[48] = { ... };
+ * cardano_bls_key_t* bls_key = NULL;
+ *
+ * cardano_error_t result = cardano_bls_key_new(public_key, sizeof(public_key), possession_proof, sizeof(possession_proof), &bls_key);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bls_key
+ *
+ *   // Once done, ensure to clean up and release the bls_key
+ *   cardano_bls_key_unref(&bls_key);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bls_key_new(
+  const byte_t*       public_key,
+  size_t              public_key_size,
+  const byte_t*       possession_proof,
+  size_t              possession_proof_size,
+  cardano_bls_key_t** bls_key);
+
+/**
+ * \brief Creates and initializes a new instance of a BLS key from hexadecimal strings.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_bls_key_t from the
+ * hexadecimal representation of the public key and its proof of possession.
+ *
+ * \param[in] public_key_hex A pointer to a character array containing the hexadecimal representation
+ *                           of the 96 byte BLS public key.
+ * \param[in] public_key_hex_size The length of the public key hexadecimal string, which must be exactly 192 characters.
+ * \param[in] possession_proof_hex A pointer to a character array containing the hexadecimal representation
+ *                                 of the 48 byte proof of possession.
+ * \param[in] possession_proof_hex_size The length of the proof of possession hexadecimal string, which must be
+ *                                      exactly 96 characters.
+ * \param[out] bls_key On successful initialization, this will point to the newly created
+ *             \ref cardano_bls_key_t object. The object represents a "strong reference"
+ *             to the BLS key, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the BLS key is no longer needed, the caller must
+ *             release it by calling \ref cardano_bls_key_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the BLS key was successfully created, \ref CARDANO_ERROR_INVALID_ARGUMENT if either string
+ *         has the wrong length or is not valid hexadecimal, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* public_key_hex = "...";       // 192 hexadecimal characters
+ * const char* possession_proof_hex = "..."; // 96 hexadecimal characters
+ * cardano_bls_key_t* bls_key = NULL;
+ *
+ * cardano_error_t result = cardano_bls_key_new_from_hex(
+ *   public_key_hex,
+ *   strlen(public_key_hex),
+ *   possession_proof_hex,
+ *   strlen(possession_proof_hex),
+ *   &bls_key);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bls_key
+ *
+ *   // Once done, ensure to clean up and release the bls_key
+ *   cardano_bls_key_unref(&bls_key);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bls_key_new_from_hex(
+  const char*         public_key_hex,
+  size_t              public_key_hex_size,
+  const char*         possession_proof_hex,
+  size_t              possession_proof_hex_size,
+  cardano_bls_key_t** bls_key);
+
+/**
+ * \brief Creates a \ref cardano_bls_key_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_bls_key_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a BLS key,
+ * an array of two byte strings holding the public key and the proof of possession.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] bls_key A pointer to a pointer of \ref cardano_bls_key_t that will be set to the address
+ *                     of the newly created BLS key object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_bls_key_t object by calling
+ *       \ref cardano_bls_key_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_bls_key_t* bls_key = NULL;
+ *
+ * cardano_error_t result = cardano_bls_key_from_cbor(reader, &bls_key);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bls_key
+ *
+ *   // Once done, ensure to clean up and release the bls_key
+ *   cardano_bls_key_unref(&bls_key);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode bls_key: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bls_key_from_cbor(cardano_cbor_reader_t* reader, cardano_bls_key_t** bls_key);
+
+/**
+ * \brief Serializes a BLS key into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_bls_key_t object using a \ref cardano_cbor_writer_t.
+ * The key is written as an array of two byte strings holding the public key and the proof of possession.
+ *
+ * \param[in] bls_key A constant pointer to the \ref cardano_bls_key_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p bls_key or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bls_key_t* bls_key = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_bls_key_to_cbor(bls_key, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_bls_key_unref(&bls_key);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bls_key_to_cbor(
+  const cardano_bls_key_t* bls_key,
+  cardano_cbor_writer_t*   writer);
+
+/**
+ * \brief Serializes a BLS key to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "public_key", "possession_proof". Both values are
+ * written as lowercase hexadecimal strings.
+ *
+ * \param[in]  bls_key Pointer to a valid \ref cardano_bls_key_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p bls_key or \p writer is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bls_key_to_cip116_json(
+  const cardano_bls_key_t* bls_key,
+  cardano_json_writer_t*   writer);
+
+/**
+ * \brief Retrieves the size of the BLS public key.
+ *
+ * This function returns the size of the byte array holding the BLS public key. Since BLS
+ * public keys always have the same length, this function will consistently return 96.
+ *
+ * \param[in] bls_key A constant pointer to an initialized \ref cardano_bls_key_t object.
+ *
+ * \return The size in bytes of the public key, which is always 96. Returns 0 if the input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bls_key_t* bls_key = ...; // Assume bls_key is already initialized
+ * size_t public_key_size = cardano_bls_key_get_public_key_size(bls_key);
+ * printf("Size of the public key: %zu bytes\n", public_key_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bls_key_get_public_key_size(const cardano_bls_key_t* bls_key);
+
+/**
+ * \brief Retrieves a pointer to the bytes of the BLS public key.
+ *
+ * This function provides access to the raw bytes of the public key stored within a
+ * \ref cardano_bls_key_t object. The returned pointer points to an internal data structure
+ * of the BLS key object and must not be modified or freed by the caller. The data remains valid
+ * as long as the BLS key object exists and has not been deallocated.
+ *
+ * \param[in] bls_key A constant pointer to an initialized \ref cardano_bls_key_t object.
+ *
+ * \return A constant pointer to the 96 bytes of the public key. Returns NULL if the input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bls_key_t* bls_key = ...; // Assume bls_key is already initialized
+ * const byte_t* public_key = cardano_bls_key_get_public_key_bytes(bls_key);
+ * size_t public_key_size = cardano_bls_key_get_public_key_size(bls_key);
+ *
+ * if (public_key != NULL)
+ * {
+ *   // Use the public key bytes
+ * }
+ * \endcode
+ *
+ * \note This function does not transfer ownership of the byte array to the caller. The returned
+ *       pointer must not be freed or modified, and it should be used only while the BLS key object
+ *       is valid.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_bls_key_get_public_key_bytes(const cardano_bls_key_t* bls_key);
+
+/**
+ * \brief Retrieves the size of the BLS proof of possession.
+ *
+ * This function returns the size of the byte array holding the proof of possession. Since BLS
+ * proofs of possession always have the same length, this function will consistently return 48.
+ *
+ * \param[in] bls_key A constant pointer to an initialized \ref cardano_bls_key_t object.
+ *
+ * \return The size in bytes of the proof of possession, which is always 48. Returns 0 if the input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bls_key_t* bls_key = ...; // Assume bls_key is already initialized
+ * size_t possession_proof_size = cardano_bls_key_get_possession_proof_size(bls_key);
+ * printf("Size of the proof of possession: %zu bytes\n", possession_proof_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bls_key_get_possession_proof_size(const cardano_bls_key_t* bls_key);
+
+/**
+ * \brief Retrieves a pointer to the bytes of the BLS proof of possession.
+ *
+ * This function provides access to the raw bytes of the proof of possession stored within a
+ * \ref cardano_bls_key_t object. The returned pointer points to an internal data structure
+ * of the BLS key object and must not be modified or freed by the caller. The data remains valid
+ * as long as the BLS key object exists and has not been deallocated.
+ *
+ * \param[in] bls_key A constant pointer to an initialized \ref cardano_bls_key_t object.
+ *
+ * \return A constant pointer to the 48 bytes of the proof of possession. Returns NULL if the input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bls_key_t* bls_key = ...; // Assume bls_key is already initialized
+ * const byte_t* possession_proof = cardano_bls_key_get_possession_proof_bytes(bls_key);
+ * size_t possession_proof_size = cardano_bls_key_get_possession_proof_size(bls_key);
+ *
+ * if (possession_proof != NULL)
+ * {
+ *   // Use the proof of possession bytes
+ * }
+ * \endcode
+ *
+ * \note This function does not transfer ownership of the byte array to the caller. The returned
+ *       pointer must not be freed or modified, and it should be used only while the BLS key object
+ *       is valid.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_bls_key_get_possession_proof_bytes(const cardano_bls_key_t* bls_key);
+
+/**
+ * \brief Decrements the reference count of a cardano_bls_key_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_bls_key_t object
+ * by decreasing its reference count. When the reference count reaches zero, the BLS key is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] bls_key A pointer to the pointer of the BLS key object. This double
+ *                        indirection allows the function to set the caller's pointer to
+ *                        NULL, avoiding dangling pointer issues after the object has been
+ *                        freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bls_key_t* bls_key = ...; // Assume bls_key is already initialized
+ *
+ * // Perform operations with the bls_key...
+ *
+ * cardano_bls_key_unref(&bls_key);
+ * // At this point, bls_key is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_bls_key_unref, the pointer to the \ref cardano_bls_key_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_bls_key_unref(cardano_bls_key_t** bls_key);
+
+/**
+ * \brief Increases the reference count of the cardano_bls_key_t object.
+ *
+ * This function is used to manually increment the reference count of a cardano_bls_key_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_bls_key_unref.
+ *
+ * \param bls_key A pointer to the cardano_bls_key_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming bls_key is a previously created BLS key object
+ *
+ * cardano_bls_key_ref(bls_key);
+ *
+ * // Now bls_key can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_bls_key_ref there is a corresponding
+ * call to \ref cardano_bls_key_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_bls_key_ref(cardano_bls_key_t* bls_key);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_bls_key_t object.
+ *
+ * This function returns the number of active references to a cardano_bls_key_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_bls_key_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param bls_key A pointer to the cardano_bls_key_t object whose reference count is queried.
+ *                The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_bls_key_t object. If the object
+ * is properly managed (i.e., every \ref cardano_bls_key_ref call is matched with a
+ * \ref cardano_bls_key_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming bls_key is a previously created BLS key object
+ *
+ * size_t ref_count = cardano_bls_key_refcount(bls_key);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bls_key_refcount(const cardano_bls_key_t* bls_key);
+
+/**
+ * \brief Sets the last error message for a given cardano_bls_key_t object.
+ *
+ * Records an error message in the BLS key's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] bls_key A pointer to the \ref cardano_bls_key_t instance whose last error message is
+ *                    to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the BLS key's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_bls_key_set_last_error(
+  cardano_bls_key_t* bls_key,
+  const char*        message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific BLS key.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_bls_key_set_last_error for the given
+ * BLS key. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] bls_key A pointer to the \ref cardano_bls_key_t instance whose last error
+ *                    message is to be retrieved. If the BLS key is NULL, the function
+ *                    returns a generic error message indicating the null BLS key.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified BLS key. If the BLS key is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_bls_key_set_last_error for the same BLS key, or until
+ *       the BLS key is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_bls_key_get_last_error(
+  const cardano_bls_key_t* bls_key);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_bls_key_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_bls_key_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_bls_key_deep_clone(const cardano_bls_key_t* source, cardano_bls_key_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BLS_KEY_H
diff --git a/vendor/include/cardano/pool_params/ipv4.h b/vendor/include/cardano/pool_params/ipv4.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/ipv4.h
@@ -0,0 +1,490 @@
+/**
+ * \file ipv4.h
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_IPV4_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_IPV4_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents an IPv4 address.
+ *
+ * Each instance of `cardano_ipv4_t` holds a single IPv4 address in network byte order (big endian).
+ */
+typedef struct cardano_ipv4_t cardano_ipv4_t;
+
+/**
+ * \brief Creates and initializes a new instance of an IPv4 address.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_ipv4_t.
+ * The IPv4 address is created from a byte array representing the address in network
+ * byte order (big endian).
+ *
+ * \param[in] data A pointer to a byte array containing the 4 bytes of the IPv4 address.
+ * \param[in] size The size of the byte array, which should be exactly 4 bytes.
+ * \param[out] ipv4 On successful initialization, this will point to the newly created
+ *            \ref cardano_ipv4_t object. The object represents a "strong reference"
+ *            to the IPv4 address, meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the IPv4 address is no longer needed, the caller must
+ *            release it by calling \ref cardano_ipv4_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the IPv4 address was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv4_t* ipv4 = NULL;
+ * byte_t data[] = {192, 168, 1, 1}; // Example IPv4 address
+ * size_t size = sizeof(data);
+ *
+ * // Attempt to create a new IPv4 object
+ * cardano_error_t result = cardano_ipv4_new(data, size, &ipv4);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the ipv4
+ *   // Once done, ensure to clean up and release the ipv4
+ *   cardano_ipv4_unref(&ipv4);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_ipv4_new(const byte_t* data, size_t size, cardano_ipv4_t** ipv4);
+
+/**
+ * \brief Initializes a new IPv4 address from a string representation.
+ *
+ * This function allocates and initializes a \ref cardano_ipv4_t object from a string
+ * that represents an IPv4 address in dotted-decimal notation (e.g., "192.168.1.1").
+ * The function parses the string and converts it into a numerical IP address.
+ *
+ * The function reads exactly \p size characters; no null terminator is required.
+ * Signs, whitespace, embedded nulls, and trailing characters within that range are rejected.
+ * Each of the four decimal components contains one to three digits and has a value from 0 to 255.
+ *
+ * \param[in] string A pointer to a character array containing the IPv4 address in
+ *                   dotted-decimal notation.
+ * \param[in] size The length of the string, which should be a valid length for an IPv4
+ *                 address in dotted-decimal format.
+ * \param[out] ipv4 On successful parsing and initialization, this will point to the newly
+ *                  created \ref cardano_ipv4_t object. The object represents a "strong reference"
+ *                  to the IPv4 address, meaning that it is fully initialized and ready for use.
+ *                  The caller is responsible for managing the lifecycle of this object.
+ *                  Specifically, once the IPv4 address is no longer needed, the caller must
+ *                  release it by calling \ref cardano_ipv4_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the IPv4 address was successfully parsed and created, or an appropriate error code
+ *         indicating the failure reason, such as invalid format or out of memory errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* ip_string = "192.168.1.1";
+ * cardano_ipv4_t* ipv4 = NULL;
+ * cardano_error_t result = cardano_ipv4_from_string(ip_string, strlen(ip_string), &ipv4);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the ipv4
+ *
+ *   // Once done, ensure to clean up and release the ipv4
+ *   cardano_ipv4_unref(&ipv4);
+ * }
+ * else
+ * {
+ *   printf("Failed to create IPv4 address: %s\n", ip_string);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_ipv4_from_string(const char* string, size_t size, cardano_ipv4_t** ipv4);
+
+/**
+ * \brief Creates a \ref cardano_ipv4_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_ipv4_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a ipv4.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] ipv4 A pointer to a pointer of \ref cardano_ipv4_t that will be set to the address
+ *                        of the newly created ipv4 object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_ipv4_t object by calling
+ *       \ref cardano_ipv4_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_ipv4_t* ipv4 = NULL;
+ *
+ * cardano_error_t result = cardano_ipv4_from_cbor(reader, &ipv4);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the ipv4
+ *
+ *   // Once done, ensure to clean up and release the ipv4
+ *   cardano_ipv4_unref(&ipv4);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode ipv4: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_ipv4_from_cbor(cardano_cbor_reader_t* reader, cardano_ipv4_t** ipv4);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_ipv4_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] ipv4 A constant pointer to the \ref cardano_ipv4_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p ipv4 or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv4_t* ipv4 = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_ipv4_to_cbor(ipv4, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_ipv4_unref(&ipv4);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ipv4_to_cbor(
+  const cardano_ipv4_t*  ipv4,
+  cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Retrieves the size of the byte array representation of an IPv4 address.
+ *
+ * This function returns the size of the byte array that would be needed to store
+ * the binary representation of an IPv4 address. Since IPv4 addresses always
+ * consist of four octets, this function will consistently return a size of 4 bytes.
+ *
+ * \param[in] ipv4 A constant pointer to an initialized \ref cardano_ipv4_t object.
+ *
+ * \return The size in bytes of the byte array needed to represent the IPv4 address,
+ *         which is always 4 bytes for standard IPv4 addresses.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv4_t* ipv4 = ...; // Assume ipv4 is already initialized
+ * size_t ipv4_size = cardano_ipv4_get_bytes_size(ipv4);
+ * printf("Size of the IPv4 byte array: %zu bytes\n", ipv4_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ipv4_get_bytes_size(const cardano_ipv4_t* ipv4);
+
+/**
+ * \brief Retrieves a pointer to the byte array representation of an IPv4 address.
+ *
+ * This function provides access to the raw byte data that represents an IPv4 address
+ * within a \ref cardano_ipv4_t object. The returned pointer points to an internal data structure
+ * of the IPv4 object and must not be modified or freed by the caller. The data remains valid
+ * as long as the IPv4 object exists and has not been deallocated.
+ *
+ * \param[in] ipv4 A constant pointer to an initialized \ref cardano_ipv4_t object.
+ *
+ * \return A constant pointer to the byte array representing the IPv4 address. The array consists
+ *         of 4 bytes corresponding to the IPv4 address in network byte order. Returns NULL if the
+ *         input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv4_t* ipv4 = ...; // Assume ipv4 is already initialized
+ * const byte_t* ipv4_bytes = cardano_ipv4_get_bytes(ipv4);
+ *
+ * if (ipv4_bytes)
+ * {
+ *     printf("IPv4 Address: %u.%u.%u.%u\n", ipv4_bytes[0], ipv4_bytes[1], ipv4_bytes[2], ipv4_bytes[3]);
+ * }
+ * else
+ * {
+ *     printf("Invalid IPv4 object provided.\n");
+ * }
+ * \endcode
+ *
+ * \note This function does not transfer ownership of the byte array to the caller. The returned
+ *       pointer must not be freed or modified, and it should be used only while the ipv4 object
+ *       is valid.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_ipv4_get_bytes(const cardano_ipv4_t* ipv4);
+
+/**
+ * \brief Retrieves the size necessary to store the string representation of an IPv4 address.
+ *
+ * This function calculates the length of the string required to represent the IPv4 address
+ * contained within a \ref cardano_ipv4_t object, including the null terminator. This size
+ * is useful when allocating a buffer to store the string representation of the IPv4 address.
+ *
+ * \param[in] ipv4 A constant pointer to an initialized \ref cardano_ipv4_t object.
+ *
+ * \return The size in bytes required to store the IPv4 address as a null-terminated string.
+ *         If the input pointer is NULL, returns 0, indicating an error or uninitialized IPv4 object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv4_t* ipv4 = ...; // Assume ipv4 is already initialized
+ * size_t ipv4_size = cardano_ipv4_get_string_size(ipv4);
+ * printf("Size of the IPv4 string: %zu chars\n", ipv4_size);
+ * \endcode
+ *
+ * \note This function returns 0 if the ipv4 pointer is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ipv4_get_string_size(const cardano_ipv4_t* ipv4);
+
+/**
+ * \brief Retrieves the string representation of an IPv4 address.
+ *
+ * This function provides access to the string representation of the IPv4 address contained
+ * within a \ref cardano_ipv4_t object. The string is formatted in the standard dot-decimal
+ * notation used for IPv4 addresses (e.g., "192.168.1.1").
+ *
+ * \param[in] ipv4 A constant pointer to an initialized \ref cardano_ipv4_t object.
+ *
+ * \return A constant pointer to a null-terminated string representing the IPv4 address.
+ *         If the input pointer is NULL, returns NULL to indicate an error or uninitialized IPv4 object.
+ *         The caller should not attempt to modify or free the returned string, as it points to
+ *         internal memory managed by the \ref cardano_ipv4_t object. The memory for the string
+ *         will be freed when the \ref cardano_ipv4_t object is destroyed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv4_t* ipv4 = ...; // Assume ipv4 is already initialized
+ * const char* ipv4_string = cardano_ipv4_get_string(ipv4);
+ *
+ * if (ipv4_string != NULL)
+ * {
+ *   printf("IPv4 Address: %s\n", ipv4_string);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve IPv4 string representation.\n");
+ * }
+ * \endcode
+ *
+ * \note This function returns NULL if the ipv4 pointer is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_ipv4_get_string(const cardano_ipv4_t* ipv4);
+
+/**
+ * \brief Decrements the reference count of a cardano_ipv4_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_ipv4_t object
+ * by decreasing its reference count. When the reference count reaches zero, the ipv4 is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] ipv4 A pointer to the pointer of the ipv4 object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv4_t* ipv4 = cardano_ipv4_new(major, minor);
+ *
+ * // Perform operations with the ipv4...
+ *
+ * cardano_ipv4_unref(&ipv4);
+ * // At this point, ipv4 is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_ipv4_unref, the pointer to the \ref cardano_ipv4_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_ipv4_unref(cardano_ipv4_t** ipv4);
+
+/**
+ * \brief Increases the reference count of the cardano_ipv4_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_ipv4_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_ipv4_unref.
+ *
+ * \param ipv4 A pointer to the cardano_ipv4_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming ipv4 is a previously created ipv4 object
+ *
+ * cardano_ipv4_ref(ipv4);
+ *
+ * // Now ipv4 can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_ipv4_ref there is a corresponding
+ * call to \ref cardano_ipv4_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_ipv4_ref(cardano_ipv4_t* ipv4);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_ipv4_t object.
+ *
+ * This function returns the number of active references to an cardano_ipv4_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_ipv4_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param ipv4 A pointer to the cardano_ipv4_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_ipv4_t object. If the object
+ * is properly managed (i.e., every \ref cardano_ipv4_ref call is matched with a
+ * \ref cardano_ipv4_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming ipv4 is a previously created ipv4 object
+ *
+ * size_t ref_count = cardano_ipv4_refcount(ipv4);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ipv4_refcount(const cardano_ipv4_t* ipv4);
+
+/**
+ * \brief Sets the last error message for a given cardano_ipv4_t object.
+ *
+ * Records an error message in the ipv4's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] ipv4 A pointer to the \ref cardano_ipv4_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the ipv4's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_ipv4_set_last_error(
+  cardano_ipv4_t* ipv4,
+  const char*     message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific ipv4.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_ipv4_set_last_error for the given
+ * ipv4. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] ipv4 A pointer to the \ref cardano_ipv4_t instance whose last error
+ *                   message is to be retrieved. If the ipv4 is NULL, the function
+ *                   returns a generic error message indicating the null ipv4.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified ipv4. If the ipv4 is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_ipv4_set_last_error for the same ipv4, or until
+ *       the ipv4 is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_ipv4_get_last_error(
+  const cardano_ipv4_t* ipv4);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_ipv4_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_ipv4_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_ipv4_deep_clone(const cardano_ipv4_t* source, cardano_ipv4_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_IPV4_H
diff --git a/vendor/include/cardano/pool_params/ipv6.h b/vendor/include/cardano/pool_params/ipv6.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/ipv6.h
@@ -0,0 +1,493 @@
+/**
+ * \file ipv6.h
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_IPV6_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_IPV6_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents an IPv6 address.
+ *
+ * Each instance of `cardano_ipv6_t` holds a single IPv6 address in network byte order (big endian).
+ */
+typedef struct cardano_ipv6_t cardano_ipv6_t;
+
+/**
+ * \brief Creates and initializes a new instance of an IPv6 address.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_ipv6_t.
+ * The IPv6 address is created from a byte array representing the address in network
+ * byte order (big endian).
+ *
+ * \param[in] data A pointer to a byte array containing the 16 bytes of the IPv6 address.
+ * \param[in] size The size of the byte array, which should be exactly 16 bytes.
+ * \param[out] ipv6 On successful initialization, this will point to the newly created
+ *            \ref cardano_ipv6_t object. The object represents a "strong reference"
+ *            to the IPv6 address, meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the IPv6 address is no longer needed, the caller must
+ *            release it by calling \ref cardano_ipv6_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the IPv6 address was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv6_t* ipv6 = NULL;
+ * byte_t data[] = {0x20, 0x01, 0x0d, 0xb8, 0x85, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x2e, 0x03, 0x70, 0x73, 0x34}; // Example IPv6 address
+ * size_t size = sizeof(data);
+ *
+ * // Attempt to create a new IPv6 object
+ * cardano_error_t result = cardano_ipv6_new(data, size, &ipv6);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the ipv6
+ *   // Once done, ensure to clean up and release the ipv6
+ *   cardano_ipv6_unref(&ipv6);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_ipv6_new(const byte_t* data, size_t size, cardano_ipv6_t** ipv6);
+
+/**
+ * \brief Initializes a new IPv6 address from a string representation.
+ *
+ * This function allocates and initializes a \ref cardano_ipv6_t object from a string
+ * that represents an IPv6 address in colon-separated hexadecimal notation (e.g., "2001:0db8:85a3:0000:0000:8a2e:0370:7334").
+ * The function parses the string and converts it into a numerical IP address.
+ *
+ * The function reads exactly \p size characters; no null terminator is required.
+ * Signs, whitespace, embedded nulls, and trailing characters within that range are rejected.
+ * The address must contain eight groups of four hexadecimal digits separated by colons (39 characters).
+ *
+ * \note This implementation does not support converting or representing IPv6 addresses in their canonical form.
+ *       Addresses are stored and handled as they are provided without normalization to canonical form.
+ *
+ * \param[in] string A pointer to a character array containing the IPv6 address in
+ *                   colon-separated hexadecimal notation.
+ * \param[in] size The length of the string, which should be a valid length for an IPv6
+ *                 address in this format.
+ * \param[out] ipv6 On successful parsing and initialization, this will point to the newly
+ *                  created \ref cardano_ipv6_t object. The object represents a "strong reference"
+ *                  to the IPv6 address, meaning that it is fully initialized and ready for use.
+ *                  The caller is responsible for managing the lifecycle of this object.
+ *                  Specifically, once the IPv6 address is no longer needed, the caller must
+ *                  release it by calling \ref cardano_ipv6_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the IPv6 address was successfully parsed and created, or an appropriate error code
+ *         indicating the failure reason, such as invalid format or out of memory errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* ip_string = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"; // Example IPv6 address
+ * cardano_ipv6_t* ipv6 = NULL;
+ * cardano_error_t result = cardano_ipv6_from_string(ip_string, strlen(ip_string), &ipv6);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the ipv6
+ *
+ *   // Once done, ensure to clean up and release the ipv6
+ *   cardano_ipv6_unref(&ipv6);
+ * }
+ * else
+ * {
+ *   printf("Failed to create IPv6 address: %s\n", ip_string);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_ipv6_from_string(const char* string, size_t size, cardano_ipv6_t** ipv6);
+
+/**
+ * \brief Creates a \ref cardano_ipv6_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_ipv6_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a ipv6.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] ipv6 A pointer to a pointer of \ref cardano_ipv6_t that will be set to the address
+ *                        of the newly created ipv6 object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_ipv6_t object by calling
+ *       \ref cardano_ipv6_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_ipv6_t* ipv6 = NULL;
+ *
+ * cardano_error_t result = cardano_ipv6_from_cbor(reader, &ipv6);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the ipv6
+ *
+ *   // Once done, ensure to clean up and release the ipv6
+ *   cardano_ipv6_unref(&ipv6);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode ipv6: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_ipv6_from_cbor(cardano_cbor_reader_t* reader, cardano_ipv6_t** ipv6);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_ipv6_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] ipv6 A constant pointer to the \ref cardano_ipv6_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p ipv6 or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv6_t* ipv6 = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_ipv6_to_cbor(ipv6, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_ipv6_unref(&ipv6);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ipv6_to_cbor(
+  const cardano_ipv6_t*  ipv6,
+  cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Retrieves the size of the byte array representation of an IPv6 address.
+ *
+ * This function returns the size of the byte array that would be needed to store
+ * the binary representation of an IPv6 address. Since IPv6 addresses always
+ * consist of sixteen bytes (128 bits), this function will consistently return a size of 16 bytes.
+ *
+ * \param[in] ipv6 A constant pointer to an initialized \ref cardano_ipv6_t object.
+ *
+ * \return The size in bytes of the byte array needed to represent the IPv6 address,
+ *         which is always 16 bytes for standard IPv6 addresses.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv6_t* ipv6 = ...; // Assume ipv6 is already initialized
+ * size_t ipv6_size = cardano_ipv6_get_bytes_size(ipv6);
+ * printf("Size of the IPv6 byte array: %zu bytes\n", ipv6_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ipv6_get_bytes_size(const cardano_ipv6_t* ipv6);
+
+/**
+ * \brief Retrieves a pointer to the byte array representation of an IPv6 address.
+ *
+ * This function provides access to the raw byte data that represents an IPv6 address
+ * within a \ref cardano_ipv6_t object. The returned pointer points to an internal data structure
+ * of the IPv6 object and must not be modified or freed by the caller. The data remains valid
+ * as long as the IPv6 object exists and has not been deallocated.
+ *
+ * \param[in] ipv6 A constant pointer to an initialized \ref cardano_ipv6_t object.
+ *
+ * \return A constant pointer to the byte array representing the IPv6 address. The array consists
+ *         of 6 bytes corresponding to the IPv6 address in network byte order. Returns NULL if the
+ *         input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv6_t* ipv6 = ...; // Assume ipv6 is already initialized
+ * const byte_t* ipv6_bytes = cardano_ipv6_get_bytes(ipv6);
+ *
+ * if (ipv6_bytes)
+ * {
+ *     printf("IPv6 Address: %u.%u.%u.%u\n", ipv6_bytes[0], ipv6_bytes[1], ipv6_bytes[2], ipv6_bytes[3]);
+ * }
+ * else
+ * {
+ *     printf("Invalid IPv6 object provided.\n");
+ * }
+ * \endcode
+ *
+ * \note This function does not transfer ownership of the byte array to the caller. The returned
+ *       pointer must not be freed or modified, and it should be used only while the ipv6 object
+ *       is valid.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const byte_t* cardano_ipv6_get_bytes(const cardano_ipv6_t* ipv6);
+
+/**
+ * \brief Retrieves the size necessary to store the string representation of an IPv6 address.
+ *
+ * This function calculates the length of the string required to represent the IPv6 address
+ * contained within a \ref cardano_ipv6_t object, including the null terminator. This size
+ * is useful when allocating a buffer to store the string representation of the IPv6 address.
+ *
+ * \param[in] ipv6 A constant pointer to an initialized \ref cardano_ipv6_t object.
+ *
+ * \return The size in bytes required to store the IPv6 address as a null-terminated string.
+ *         If the input pointer is NULL, returns 0, indicating an error or uninitialized IPv6 object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv6_t* ipv6 = ...; // Assume ipv6 is already initialized
+ * size_t ipv6_size = cardano_ipv6_get_string_size(ipv6);
+ * printf("Size of the IPv6 string: %zu chars\n", ipv6_size);
+ * \endcode
+ *
+ * \note This function returns 0 if the ipv6 pointer is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ipv6_get_string_size(const cardano_ipv6_t* ipv6);
+
+/**
+ * \brief Retrieves the string representation of an IPv6 address.
+ *
+ * This function provides access to the string representation of the IPv6 address contained
+ * within a \ref cardano_ipv6_t object. The string is formatted in the standard colon-separated
+ * notation used for IPv6 addresses (e.g., "2001:0db8:85a3:0000:0000:8a2e:0370:7334").
+ *
+ * \param[in] ipv6 A constant pointer to an initialized \ref cardano_ipv6_t object.
+ *
+ * \return A constant pointer to a null-terminated string representing the IPv6 address.
+ *         If the input pointer is NULL, returns NULL to indicate an error or uninitialized IPv6 object.
+ *         The caller should not attempt to modify or free the returned string, as it points to
+ *         internal memory managed by the \ref cardano_ipv6_t object. The memory for the string
+ *         will be freed when the \ref cardano_ipv6_t object is destroyed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv6_t* ipv6 = ...; // Assume ipv6 is already initialized
+ * const char* ipv6_string = cardano_ipv6_get_string(ipv6);
+ *
+ * if (ipv6_string != NULL)
+ * {
+ *   printf("IPv6 Address: %s\n", ipv6_string);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve IPv6 string representation.\n");
+ * }
+ * \endcode
+ *
+ * \note This function returns NULL if the ipv6 pointer is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_ipv6_get_string(const cardano_ipv6_t* ipv6);
+
+/**
+ * \brief Decrements the reference count of a cardano_ipv6_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_ipv6_t object
+ * by decreasing its reference count. When the reference count reaches zero, the ipv6 is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] ipv6 A pointer to the pointer of the ipv6 object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ipv6_t* ipv6 = cardano_ipv6_new(major, minor);
+ *
+ * // Perform operations with the ipv6...
+ *
+ * cardano_ipv6_unref(&ipv6);
+ * // At this point, ipv6 is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_ipv6_unref, the pointer to the \ref cardano_ipv6_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_ipv6_unref(cardano_ipv6_t** ipv6);
+
+/**
+ * \brief Increases the reference count of the cardano_ipv6_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_ipv6_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_ipv6_unref.
+ *
+ * \param ipv6 A pointer to the cardano_ipv6_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming ipv6 is a previously created ipv6 object
+ *
+ * cardano_ipv6_ref(ipv6);
+ *
+ * // Now ipv6 can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_ipv6_ref there is a corresponding
+ * call to \ref cardano_ipv6_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_ipv6_ref(cardano_ipv6_t* ipv6);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_ipv6_t object.
+ *
+ * This function returns the number of active references to an cardano_ipv6_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_ipv6_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param ipv6 A pointer to the cardano_ipv6_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_ipv6_t object. If the object
+ * is properly managed (i.e., every \ref cardano_ipv6_ref call is matched with a
+ * \ref cardano_ipv6_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming ipv6 is a previously created ipv6 object
+ *
+ * size_t ref_count = cardano_ipv6_refcount(ipv6);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ipv6_refcount(const cardano_ipv6_t* ipv6);
+
+/**
+ * \brief Sets the last error message for a given cardano_ipv6_t object.
+ *
+ * Records an error message in the ipv6's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] ipv6 A pointer to the \ref cardano_ipv6_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the ipv6's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_ipv6_set_last_error(
+  cardano_ipv6_t* ipv6,
+  const char*     message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific ipv6.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_ipv6_set_last_error for the given
+ * ipv6. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] ipv6 A pointer to the \ref cardano_ipv6_t instance whose last error
+ *                   message is to be retrieved. If the ipv6 is NULL, the function
+ *                   returns a generic error message indicating the null ipv6.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified ipv6. If the ipv6 is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_ipv6_set_last_error for the same ipv6, or until
+ *       the ipv6 is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_ipv6_get_last_error(
+  const cardano_ipv6_t* ipv6);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_ipv6_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_ipv6_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_ipv6_deep_clone(const cardano_ipv6_t* source, cardano_ipv6_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_IPV6_H
diff --git a/vendor/include/cardano/pool_params/multi_host_name_relay.h b/vendor/include/cardano/pool_params/multi_host_name_relay.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/multi_host_name_relay.h
@@ -0,0 +1,451 @@
+/**
+ * \file multi_host_name_relay.h
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_MULTI_HOST_NAME_RELAY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_MULTI_HOST_NAME_RELAY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This relay points to a multi host name via a DNS (A SRV DNS record) name.
+ */
+typedef struct cardano_multi_host_name_relay_t cardano_multi_host_name_relay_t;
+
+/**
+ * \brief Creates and initializes a new \ref cardano_multi_host_name_relay_t object.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_multi_host_name_relay_t,
+ * which represents a multi-host name relay in the Cardano network. A multi-host name relay
+ * provide a DNS name that resolves to multiple IP addresses, facilitating load balancing and
+ * failover for stake pool relays.
+ *
+ * \param[in] dns A pointer to a character array containing the DNS name for the multi-host relay.
+ * \param[in] str_size The length of the DNS string.
+ * \param[out] multi_host_name_relay On successful initialization, this will point to the newly created
+ *            \ref cardano_multi_host_name_relay_t object. This object represents a "strong reference"
+ *            to the multi-host name relay, meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the multi-host name relay is no longer needed, the caller must
+ *            release it by calling \ref cardano_multi_host_name_relay_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the multi-host name relay was successfully created, or an appropriate error code
+ *         indicating the failure reason, such as invalid DNS name format or out of memory errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* dns_name = "relay1.example.com";
+ * cardano_multi_host_name_relay_t* relay = NULL;
+ * cardano_error_t result = cardano_multi_host_name_relay_new(dns_name, strlen(dns_name), &relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the multi-host name relay
+ *
+ *   // Once done, ensure to clean up and release the relay
+ *   cardano_multi_host_name_relay_unref(&relay);
+ * }
+ * else
+ * {
+ *   printf("Failed to create multi-host name relay: %s\n", dns_name);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_multi_host_name_relay_new(
+  const char*                       dns,
+  size_t                            str_size,
+  cardano_multi_host_name_relay_t** multi_host_name_relay);
+
+/**
+ * \brief Creates a \ref cardano_multi_host_name_relay_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_multi_host_name_relay_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a multi_host_name_relay.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] multi_host_name_relay A pointer to a pointer of \ref cardano_multi_host_name_relay_t that will be set to the address
+ *                        of the newly created multi_host_name_relay object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_multi_host_name_relay_t object by calling
+ *       \ref cardano_multi_host_name_relay_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_multi_host_name_relay_t* multi_host_name_relay = NULL;
+ *
+ * cardano_error_t result = cardano_multi_host_name_relay_from_cbor(reader, &multi_host_name_relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the multi_host_name_relay
+ *
+ *   // Once done, ensure to clean up and release the multi_host_name_relay
+ *   cardano_multi_host_name_relay_unref(&multi_host_name_relay);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode multi_host_name_relay: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_multi_host_name_relay_from_cbor(cardano_cbor_reader_t* reader, cardano_multi_host_name_relay_t** multi_host_name_relay);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_multi_host_name_relay_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] multi_host_name_relay A constant pointer to the \ref cardano_multi_host_name_relay_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p multi_host_name_relay or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_host_name_relay_t* multi_host_name_relay = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_multi_host_name_relay_to_cbor(multi_host_name_relay, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_multi_host_name_relay_unref(&multi_host_name_relay);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_host_name_relay_to_cbor(
+  const cardano_multi_host_name_relay_t* multi_host_name_relay,
+  cardano_cbor_writer_t*                 writer);
+
+/**
+ * \brief Serializes a multi-host name relay to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "dns_name".
+ *
+ * \param[in]  relay   Pointer to a valid \ref cardano_multi_host_name_relay_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p relay or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_multi_host_name_relay_to_cip116_json(
+  const cardano_multi_host_name_relay_t* relay,
+  cardano_json_writer_t*                 writer);
+
+/**
+ * \brief Retrieves the size of the DNS name string of a \c cardano_multi_host_name_relay_t object.
+ *
+ * This function returns the size in bytes of the DNS name string stored within a
+ * \ref cardano_multi_host_name_relay_t object. This size includes the null-terminating character
+ * for the string, thus providing the actual length of the DNS name plus one.
+ *
+ * \param[in] multi_host_name_relay A constant pointer to an initialized \ref cardano_multi_host_name_relay_t object.
+ *
+ * \return The size in bytes of the DNS name string, including the null terminator.
+ *         If the input pointer is NULL, returns 0 to indicate an error or uninitialized relay object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_host_name_relay_t* relay = ...; // Assume relay is already initialized
+ * size_t dns_size = cardano_multi_host_name_relay_get_dns_size(relay);
+ * printf("Size of the DNS name string: %zu bytes\n", dns_size);
+ * \endcode
+ *
+ * \note This function returns 0 if the \p multi_host_name_relay pointer is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_multi_host_name_relay_get_dns_size(
+  const cardano_multi_host_name_relay_t* multi_host_name_relay);
+
+/**
+ * \brief Retrieves the DNS name string from a \c cardano_multi_host_name_relay_t object.
+ *
+ * This function provides access to the DNS name string contained within a \ref cardano_multi_host_name_relay_t object.
+ * The string represents the domain name used for DNS-based relay discovery and connection in the Cardano network.
+ *
+ * \param[in] multi_host_name_relay A constant pointer to an initialized \ref cardano_multi_host_name_relay_t object.
+ *
+ * \return A constant pointer to a null-terminated string representing the DNS name.
+ *         If the input pointer is NULL, returns NULL to indicate an error or uninitialized relay object.
+ *         The returned string points to internal memory within the \c cardano_multi_host_name_relay_t object and must not be modified
+ *         or freed by the caller. The memory will remain valid as long as the \c cardano_multi_host_name_relay_t object is not
+ *         destroyed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_host_name_relay_t* relay = ...; // Assume relay is already initialized
+ * const char* dns_name = cardano_multi_host_name_relay_get_dns(relay);
+ *
+ * if (dns_name != NULL)
+ * {
+ *   printf("DNS Name: %s\n", dns_name);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve DNS name.\n");
+ * }
+ * \endcode
+ *
+ * \note This function returns NULL if the \p multi_host_name_relay pointer is NULL, indicating either an error or
+ *       an uninitialized state.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_multi_host_name_relay_get_dns(
+  const cardano_multi_host_name_relay_t* multi_host_name_relay);
+
+/**
+ * \brief Sets the DNS name for a \c cardano_multi_host_name_relay_t object.
+ *
+ * This function updates the DNS name in a \ref cardano_multi_host_name_relay_t object with the provided DNS name string.
+ * The DNS name is used for DNS-based relay discovery and connection in the Cardano network. The function ensures the
+ * new DNS name is properly stored within the relay object, replacing any previous value.
+ *
+ * \param[in] dns A constant pointer to a character array containing the new DNS name in null-terminated string format.
+ * \param[in] dns_size The size of the DNS name string, excluding the null terminator.
+ * \param[out] multi_host_name_relay A pointer to an initialized \ref cardano_multi_host_name_relay_t object which will
+ *                                   receive the updated DNS name.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the DNS name
+ *         was successfully updated, or an appropriate error code indicating the failure reason, such as invalid format,
+ *         null pointers, or out of memory errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_host_name_relay_t* relay = ...; // Assume relay is already initialized
+ * const char* new_dns = "new.example.com";
+ * size_t dns_size = strlen(new_dns);
+ * cardano_error_t result = cardano_multi_host_name_relay_set_dns(new_dns, dns_size, relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DNS name updated successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to update DNS name.\n");
+ * }
+ * \endcode
+ *
+ * \note This function does not take ownership of the dns string; the caller must ensure it remains valid for the duration
+ *       of the call and manages its memory appropriately.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_multi_host_name_relay_set_dns(
+  const char*                      dns,
+  size_t                           dns_size,
+  cardano_multi_host_name_relay_t* multi_host_name_relay);
+
+/**
+ * \brief Decrements the reference count of a cardano_multi_host_name_relay_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_multi_host_name_relay_t object
+ * by decreasing its reference count. When the reference count reaches zero, the multi_host_name_relay is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] multi_host_name_relay A pointer to the pointer of the multi_host_name_relay object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_host_name_relay_t* multi_host_name_relay = cardano_multi_host_name_relay_new(major, minor);
+ *
+ * // Perform operations with the multi_host_name_relay...
+ *
+ * cardano_multi_host_name_relay_unref(&multi_host_name_relay);
+ * // At this point, multi_host_name_relay is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_multi_host_name_relay_unref, the pointer to the \ref cardano_multi_host_name_relay_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_multi_host_name_relay_unref(cardano_multi_host_name_relay_t** multi_host_name_relay);
+
+/**
+ * \brief Increases the reference count of the cardano_multi_host_name_relay_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_multi_host_name_relay_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_multi_host_name_relay_unref.
+ *
+ * \param multi_host_name_relay A pointer to the cardano_multi_host_name_relay_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming multi_host_name_relay is a previously created multi_host_name_relay object
+ *
+ * cardano_multi_host_name_relay_ref(multi_host_name_relay);
+ *
+ * // Now multi_host_name_relay can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_multi_host_name_relay_ref there is a corresponding
+ * call to \ref cardano_multi_host_name_relay_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_multi_host_name_relay_ref(cardano_multi_host_name_relay_t* multi_host_name_relay);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_multi_host_name_relay_t object.
+ *
+ * This function returns the number of active references to an cardano_multi_host_name_relay_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_multi_host_name_relay_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param multi_host_name_relay A pointer to the cardano_multi_host_name_relay_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_multi_host_name_relay_t object. If the object
+ * is properly managed (i.e., every \ref cardano_multi_host_name_relay_ref call is matched with a
+ * \ref cardano_multi_host_name_relay_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming multi_host_name_relay is a previously created multi_host_name_relay object
+ *
+ * size_t ref_count = cardano_multi_host_name_relay_refcount(multi_host_name_relay);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_multi_host_name_relay_refcount(const cardano_multi_host_name_relay_t* multi_host_name_relay);
+
+/**
+ * \brief Sets the last error message for a given cardano_multi_host_name_relay_t object.
+ *
+ * Records an error message in the multi_host_name_relay's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] multi_host_name_relay A pointer to the \ref cardano_multi_host_name_relay_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the multi_host_name_relay's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_multi_host_name_relay_set_last_error(
+  cardano_multi_host_name_relay_t* multi_host_name_relay,
+  const char*                      message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific multi_host_name_relay.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_multi_host_name_relay_set_last_error for the given
+ * multi_host_name_relay. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] multi_host_name_relay A pointer to the \ref cardano_multi_host_name_relay_t instance whose last error
+ *                   message is to be retrieved. If the multi_host_name_relay is NULL, the function
+ *                   returns a generic error message indicating the null multi_host_name_relay.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified multi_host_name_relay. If the multi_host_name_relay is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_multi_host_name_relay_set_last_error for the same multi_host_name_relay, or until
+ *       the multi_host_name_relay is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_multi_host_name_relay_get_last_error(
+  const cardano_multi_host_name_relay_t* multi_host_name_relay);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_multi_host_name_relay_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_multi_host_name_relay_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_multi_host_name_relay_deep_clone(const cardano_multi_host_name_relay_t* source, cardano_multi_host_name_relay_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_MULTI_HOST_NAME_RELAY_H
diff --git a/vendor/include/cardano/pool_params/pool_metadata.h b/vendor/include/cardano/pool_params/pool_metadata.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/pool_metadata.h
@@ -0,0 +1,592 @@
+/**
+ * \file pool_metadata.h
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_POOL_METADATA_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_POOL_METADATA_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The pool registration certificate can include a way to locate pool metadata. This includes the hash of
+ * the metadata. This is not the metadata itself but a unique identifier that corresponds to the metadata.
+ * The hash function ensures that even a small change in the metadata leads to a completely different hash,
+ * securing the authenticity of the data.
+ *
+ * Along with the hash of the metadata, the URL where the actual metadata file (in JSON format)
+ * is hosted is also included in the certificate. The combination of the URL and the hash allows wallets
+ * and other services to download the metadata file and verify it against the hash.
+ */
+typedef struct cardano_pool_metadata_t cardano_pool_metadata_t;
+
+/**
+ * \brief Creates and initializes a new pool metadata object.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_pool_metadata_t.
+ * The pool metadata includes information such as a URL to the pool's metadata file and its associated hash.
+ *
+ * \param[in] url A constant pointer to a character array containing the URL where the pool metadata is hosted.
+ * \param[in] url_length The length of the URL character array.
+ * \param[in] hash A pointer to a \ref cardano_blake2b_hash_t object representing the BLAKE2b hash of the metadata file.
+ *                 This hash is used to verify the integrity of the metadata once fetched.
+ * \param[out] pool_metadata On successful initialization, this will point to the newly created
+ *             \ref cardano_pool_metadata_t object. The object represents a "strong reference"
+ *             to the pool metadata, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the pool metadata is no longer needed, the caller must
+ *             release it by calling \ref cardano_pool_metadata_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool metadata was successfully created, or an appropriate error code
+ *         indicating the failure reason, such as invalid URL format, null pointers, or out of memory errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* url = "https://example.com/poolmetadata.json";
+ * size_t url_length = strlen(url);
+ * cardano_blake2b_hash_t* hash = ...;  // Assume hash is initialized here
+ * cardano_pool_metadata_t* pool_metadata = NULL;
+ *
+ * cardano_error_t result = cardano_pool_metadata_new(url, url_length, hash, &pool_metadata);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pool metadata
+ *
+ *   // Once done, ensure to clean up and release the pool metadata
+ *   cardano_pool_metadata_unref(&pool_metadata);
+ * }
+ * else
+ * {
+ *   printf("Failed to create pool metadata: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_metadata_new(
+  const char*               url,
+  size_t                    url_length,
+  cardano_blake2b_hash_t*   hash,
+  cardano_pool_metadata_t** pool_metadata);
+
+/**
+ * \brief Initializes pool metadata from a URL and a hexadecimal hash string.
+ *
+ * This function creates a pool metadata object based on the provided URL and a BLAKE2b hash of the metadata
+ * content, given as a hexadecimal string. This approach is useful when the hash of the metadata is known in
+ * a string format, allowing for easy verification of metadata integrity after retrieval.
+ *
+ * \param[in] url A pointer to a character array containing the URL where the pool metadata is hosted.
+ * \param[in] url_size The length of the URL character array.
+ * \param[in] hash A pointer to a character array containing the hexadecimal representation of the BLAKE2b hash
+ *                 of the pool metadata. This hash is used to ensure the integrity of the downloaded metadata.
+ * \param[in] hash_size The length of the hash character array.
+ * \param[out] pool_metadata On successful initialization, this will point to the newly created
+ *             \ref cardano_pool_metadata_t object. This object represents a "strong reference"
+ *             to the pool metadata, fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically releasing it by calling \ref cardano_pool_metadata_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool metadata was successfully created, or an appropriate error code
+ *         indicating the failure reason, such as invalid URL or hash format, null pointers, or memory allocation issues.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* url = "https://example.com/poolmetadata.json";
+ * size_t url_size = strlen(url);
+ * const char* hash_hex = "abc123...";  // Example BLAKE2b hash in hexadecimal
+ * size_t hash_size = strlen(hash_hex);
+ * cardano_pool_metadata_t* pool_metadata = NULL;
+ *
+ * cardano_error_t result = cardano_pool_metadata_from_hash_hex(url, url_size, hash_hex, hash_size, &pool_metadata);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pool metadata
+ *
+ *   // Once done, ensure to clean up and release the pool metadata
+ *   cardano_pool_metadata_unref(&pool_metadata);
+ * }
+ * else
+ * {
+ *   printf("Failed to create pool metadata: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_metadata_from_hash_hex(
+  const char*               url,
+  size_t                    url_size,
+  const char*               hash,
+  size_t                    hash_size,
+  cardano_pool_metadata_t** pool_metadata);
+
+/**
+ * \brief Creates a \ref cardano_pool_metadata_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_pool_metadata_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a pool_metadata.
+ *
+ * The ledger stores the metadata hash as an arbitrary byte string, so a hash of any length is accepted, including an
+ * empty one. An empty hash is kept as a hash of zero bytes and is encoded back as an empty byte string.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] pool_metadata A pointer to a pointer of \ref cardano_pool_metadata_t that will be set to the address
+ *                        of the newly created pool_metadata object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_pool_metadata_t object by calling
+ *       \ref cardano_pool_metadata_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_pool_metadata_t* pool_metadata = NULL;
+ *
+ * cardano_error_t result = cardano_pool_metadata_from_cbor(reader, &pool_metadata);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pool_metadata
+ *
+ *   // Once done, ensure to clean up and release the pool_metadata
+ *   cardano_pool_metadata_unref(&pool_metadata);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode pool_metadata: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_metadata_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_metadata_t** pool_metadata);
+
+/**
+ * \brief Serializes a pool_metadata into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_pool_metadata_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] pool_metadata A constant pointer to the \ref cardano_pool_metadata_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p pool_metadata or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_metadata_t* pool_metadata = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_pool_metadata_to_cbor(pool_metadata, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_pool_metadata_unref(&pool_metadata);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_metadata_to_cbor(
+  const cardano_pool_metadata_t* pool_metadata,
+  cardano_cbor_writer_t*         writer);
+
+/**
+ * \brief Serializes pool metadata to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "url", "hash".
+ *
+ * \param[in]  metadata Pointer to a valid \ref cardano_pool_metadata_t.
+ * \param[in]  writer   Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p metadata or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails for hash conversion.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_metadata_to_cip116_json(
+  const cardano_pool_metadata_t* metadata,
+  cardano_json_writer_t*         writer);
+
+/**
+ * \brief Retrieves the size of the URL string stored in the pool metadata object.
+ *
+ * This function returns the length of the URL string contained within a \ref cardano_pool_metadata_t object.
+ * This length does not include the null terminator of the string. This function is useful for determining
+ * the buffer size needed to store or manipulate the URL string outside of the pool metadata object.
+ *
+ * \param[in] pool_metadata A constant pointer to an initialized \ref cardano_pool_metadata_t object.
+ *
+ * \return The size of the URL string in bytes, excluding the null terminator. If the input pointer
+ *         is NULL, returns 0 to indicate an error or uninitialized pool metadata object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_metadata_t* pool_metadata = ...; // Assume pool_metadata is already initialized
+ * size_t url_size = cardano_pool_metadata_get_url_size(pool_metadata);
+ * printf("URL size: %zu bytes\n", url_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_pool_metadata_get_url_size(
+  const cardano_pool_metadata_t* pool_metadata);
+
+/**
+ * \brief Retrieves the URL string from a pool metadata object.
+ *
+ * This function provides access to the URL string stored within a \ref cardano_pool_metadata_t object.
+ * The URL is associated with the metadata of a Cardano stake pool and is used for various network operations
+ * and identity verifications. The returned string is null-terminated.
+ *
+ * \param[in] pool_metadata A constant pointer to an initialized \ref cardano_pool_metadata_t object.
+ *
+ * \return A constant pointer to a null-terminated string representing the URL of the pool metadata.
+ *         If the input pointer is NULL, or if the pool metadata object is uninitialized, returns NULL.
+ *         The caller should not attempt to modify or free the returned string, as it points to internal memory
+ *         managed by the \ref cardano_pool_metadata_t object. The memory for the string will be freed when
+ *         the \ref cardano_pool_metadata_t object is destroyed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_metadata_t* pool_metadata = ...; // Assume pool_metadata is already initialized
+ * const char* url = cardano_pool_metadata_get_url(pool_metadata);
+ *
+ * if (url != NULL)
+ * {
+ *   printf("Pool URL: %s\n", url);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve URL from pool metadata.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_pool_metadata_get_url(
+  const cardano_pool_metadata_t* pool_metadata);
+
+/**
+ * \brief Sets the URL string in a pool metadata object.
+ *
+ * This function updates the URL string stored within a \ref cardano_pool_metadata_t object. The URL is associated with
+ * the metadata of a Cardano stake pool and is used for various network operations and identity verifications. This function
+ * copies the URL from the provided string to the pool metadata object.
+ *
+ * \param[in] url A pointer to a character array containing the new URL to be set in the pool metadata.
+ * \param[in] url_size The size of the URL character array, including the null terminator.
+ * \param[in,out] pool_metadata A pointer to an initialized \ref cardano_pool_metadata_t object which will be updated.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the URL was
+ *         successfully updated, or an appropriate error code indicating the failure reason, such as invalid parameters
+ *         or out of memory errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* new_url = "https://newpoolmetadata.com";
+ * cardano_pool_metadata_t* pool_metadata = ...; // Assume pool_metadata is already initialized
+ * cardano_error_t result = cardano_pool_metadata_set_url(new_url, strlen(new_url) + 1, pool_metadata);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool URL updated successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to update pool URL.\n");
+ * }
+ * \endcode
+ *
+ * \note This function does not take ownership of the `url` parameter but copies its content. The caller is responsible
+ *       for managing the memory of `url`. Ensure that the `pool_metadata` object is not NULL and properly initialized
+ *       before calling this function.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_metadata_set_url(
+  const char*              url,
+  size_t                   url_size,
+  cardano_pool_metadata_t* pool_metadata);
+
+/**
+ * \brief Retrieves the Blake2b hash from a pool metadata object.
+ *
+ * This function provides access to the Blake2b hash stored within a
+ * \ref cardano_pool_metadata_t object.
+ *
+ * The hash of pool metadata decoded from CBOR may be empty, in which case \ref cardano_blake2b_hash_get_bytes_size
+ * reports zero bytes and its hexadecimal form is an empty string.
+ *
+ * \param[in] pool_metadata A pointer to an initialized \ref cardano_pool_metadata_t object.
+ * \param[out] hash On successful retrieval, this will point to a newly created
+ *                  \ref cardano_blake2b_hash_t object containing the hash. The caller is responsible
+ *                  for managing the lifecycle of this object, and must release it by calling
+ *                  \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the hash was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_metadata_t* pool_metadata = ...; // Assume pool_metadata is already initialized
+ * cardano_blake2b_hash_t* hash = NULL;
+ * cardano_error_t result = cardano_pool_metadata_get_hash(pool_metadata, &hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the hash
+ *
+ *   // Once done, ensure to clean up and release the hash
+ *   cardano_blake2b_hash_unref(&hash);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve hash from pool metadata.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_metadata_get_hash(
+  cardano_pool_metadata_t* pool_metadata,
+  cardano_blake2b_hash_t** hash);
+
+/**
+ * \brief Sets the Blake2b hash for a pool metadata object.
+ *
+ * This function sets the Blake2b hash within a \ref cardano_pool_metadata_t object.
+ *
+ * \param[in] pool_metadata A pointer to an initialized \ref cardano_pool_metadata_t object.
+ * \param[in] hash A pointer to an initialized \ref cardano_blake2b_hash_t object containing
+ *                 the hash to be set. The caller is responsible for managing the lifecycle
+ *                 of the hash object, and must ensure that it remains valid for the duration
+ *                 of the operation. The function does not take ownership of the hash object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the hash was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_metadata_t* pool_metadata = ...; // Assume pool_metadata is already initialized
+ * cardano_blake2b_hash_t* hash = ...; // Assume hash is already initialized
+ * cardano_error_t result = cardano_pool_metadata_set_hash(pool_metadata, hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Hash was successfully set
+ * }
+ * else
+ * {
+ *   printf("Failed to set hash for pool metadata.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_metadata_set_hash(
+  cardano_pool_metadata_t* pool_metadata,
+  cardano_blake2b_hash_t*  hash);
+
+/**
+ * \brief Decrements the reference count of a cardano_pool_metadata_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_pool_metadata_t object
+ * by decreasing its reference count. When the reference count reaches zero, the pool_metadata is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] pool_metadata A pointer to the pointer of the pool_metadata object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_metadata_t* pool_metadata = cardano_pool_metadata_new(major, minor);
+ *
+ * // Perform operations with the pool_metadata...
+ *
+ * cardano_pool_metadata_unref(&pool_metadata);
+ * // At this point, pool_metadata is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_pool_metadata_unref, the pointer to the \ref cardano_pool_metadata_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_pool_metadata_unref(cardano_pool_metadata_t** pool_metadata);
+
+/**
+ * \brief Increases the reference count of the cardano_pool_metadata_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_pool_metadata_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_pool_metadata_unref.
+ *
+ * \param pool_metadata A pointer to the cardano_pool_metadata_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_metadata is a previously created pool_metadata object
+ *
+ * cardano_pool_metadata_ref(pool_metadata);
+ *
+ * // Now pool_metadata can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_pool_metadata_ref there is a corresponding
+ * call to \ref cardano_pool_metadata_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_pool_metadata_ref(cardano_pool_metadata_t* pool_metadata);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_pool_metadata_t object.
+ *
+ * This function returns the number of active references to an cardano_pool_metadata_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_pool_metadata_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param pool_metadata A pointer to the cardano_pool_metadata_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_pool_metadata_t object. If the object
+ * is properly managed (i.e., every \ref cardano_pool_metadata_ref call is matched with a
+ * \ref cardano_pool_metadata_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_metadata is a previously created pool_metadata object
+ *
+ * size_t ref_count = cardano_pool_metadata_refcount(pool_metadata);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_pool_metadata_refcount(const cardano_pool_metadata_t* pool_metadata);
+
+/**
+ * \brief Sets the last error message for a given cardano_pool_metadata_t object.
+ *
+ * Records an error message in the pool_metadata's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] pool_metadata A pointer to the \ref cardano_pool_metadata_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the pool_metadata's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_pool_metadata_set_last_error(
+  cardano_pool_metadata_t* pool_metadata,
+  const char*              message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific pool_metadata.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_pool_metadata_set_last_error for the given
+ * pool_metadata. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] pool_metadata A pointer to the \ref cardano_pool_metadata_t instance whose last error
+ *                   message is to be retrieved. If the pool_metadata is NULL, the function
+ *                   returns a generic error message indicating the null pool_metadata.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified pool_metadata. If the pool_metadata is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_pool_metadata_set_last_error for the same pool_metadata, or until
+ *       the pool_metadata is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_pool_metadata_get_last_error(
+  const cardano_pool_metadata_t* pool_metadata);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_pool_metadata_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_pool_metadata_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_pool_metadata_deep_clone(const cardano_pool_metadata_t* source, cardano_pool_metadata_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_POOL_METADATA_H
diff --git a/vendor/include/cardano/pool_params/pool_owners.h b/vendor/include/cardano/pool_params/pool_owners.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/pool_owners.h
@@ -0,0 +1,435 @@
+/**
+ * \file pool_owners.h
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_POOL_OWNERS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_POOL_OWNERS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a set of pool owners.
+ */
+typedef struct cardano_pool_owners_t cardano_pool_owners_t;
+
+/**
+ * \brief Creates and initializes a new instance of a pool_owners.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_pool_owners_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] pool_owners On successful initialization, this will point to a newly created
+ *             \ref cardano_pool_owners_t object. This object represents a "strong reference"
+ *             to the pool_owners, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the pool_owners is no longer needed, the caller must release it
+ *             by calling \ref cardano_pool_owners_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the pool_owners was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_owners_t* pool_owners = NULL;
+ *
+ * // Attempt to create a new pool_owners
+ * cardano_error_t result = cardano_pool_owners_new(&pool_owners);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pool_owners
+ *
+ *   // Once done, ensure to clean up and release the pool_owners
+ *   cardano_pool_owners_unref(&pool_owners);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_owners_new(cardano_pool_owners_t** pool_owners);
+
+/**
+ * \brief Creates a pool_owners from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_pool_owners_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a pool_owners.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded pool_owners data.
+ * \param[out] pool_owners A pointer to a pointer of \ref cardano_pool_owners_t that will be set to the address
+ *                        of the newly created pool_owners object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool_owners was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_pool_owners_t object by calling
+ *       \ref cardano_pool_owners_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_pool_owners_t* pool_owners = NULL;
+ *
+ * cardano_error_t result = cardano_pool_owners_from_cbor(reader, &pool_owners);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pool_owners
+ *
+ *   // Once done, ensure to clean up and release the pool_owners
+ *   cardano_pool_owners_unref(&pool_owners);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode pool_owners: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_owners_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_owners_t** pool_owners);
+
+/**
+ * \brief Serializes a pool_owners into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_pool_owners_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] pool_owners A constant pointer to the \ref cardano_pool_owners_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p pool_owners or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_owners_t* pool_owners = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_pool_owners_to_cbor(pool_owners, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_pool_owners_unref(&pool_owners);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_owners_to_cbor(
+  const cardano_pool_owners_t* pool_owners,
+  cardano_cbor_writer_t*       writer);
+
+/**
+ * \brief Serializes a list of pool owners to CIP-116 JSON.
+ *
+ * The function writes a JSON array of strings, where each string is the
+ * hexadecimal representation of the pool owner's public key hash.
+ *
+ * \param[in]  owners  Pointer to a valid \ref cardano_pool_owners_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p owners or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED  If memory allocation fails during string conversion.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_owners_to_cip116_json(
+  const cardano_pool_owners_t* owners,
+  cardano_json_writer_t*       writer);
+
+/**
+ * \brief Retrieves the length of a owners set.
+ *
+ * This function retrieves the number of owners in the provided \ref cardano_pool_owners_t object.
+ *
+ * \param[in] pool_owners A constant pointer to the \ref cardano_pool_owners_t object whose length is to be retrieved.
+ *
+ * \return The number of owners in the pool_owners. Return 0 if the pool_owners is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_owners_t* pool_owners = cardano_pool_owners_new();
+ *
+ * // Populate pool_owners with owners
+ *
+ * size_t length = cardano_pool_owners_get_length(pool_owners);
+ * printf("Length of the pool_owners: %zu\n", length);
+ *
+ * // Clean up the pool_owners object once done
+ * cardano_pool_owners_unref(&pool_owners);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_pool_owners_get_length(const cardano_pool_owners_t* pool_owners);
+
+/**
+ * \brief Retrieves an owner from an owner set by index.
+ *
+ * This function retrieves the owner at the specified index from the provided \ref cardano_pool_owners_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] pool_owners A constant pointer to the \ref cardano_pool_owners_t object from which
+ *                        the owner is to be retrieved.
+ * \param[in] index The index of the owner to retrieve from the owner set. Indexing starts at 0.
+ * \param[out] owner Pointer to a variable where the retrieved owner will be stored.
+ *                     This variable will point to the retrieved \ref cardano_blake2b_hash_t object.
+ *                     The caller is responsible for managing the lifecycle of the owner by calling
+ *                     \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the owner was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_owners_t* pool_owners = cardano_pool_owners_new();
+ *
+ * // Populate pool_owners with owners
+ *
+ * cardano_blake2b_hash_t* owner = NULL;
+ * cardano_error_t result = cardano_pool_owners_get(pool_owners, 2, &owner);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved owner
+ *   // Remember to unreference the owner once done if it's no longer needed
+ *   cardano_blake2b_hash_unref(&owner);
+ * }
+ *
+ * // Clean up the pool_owners object once done
+ * cardano_pool_owners_unref(&pool_owners);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_owners_get(const cardano_pool_owners_t* pool_owners, size_t index, cardano_blake2b_hash_t** owner);
+
+/**
+ * \brief Adds an owner to a owner set.
+ *
+ * This function adds the specified owner to the provided \ref cardano_pool_owners_t object.
+ *
+ * \param[in] pool_owners A constant pointer to the \ref cardano_pool_owners_t object to which
+ *                        the owner is to be added.
+ * \param[in] owner Pointer to the \ref cardano_blake2b_hash_t object that is to be added to the pool_owners.
+ *                    The owner will be referenced by the pool_owners after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the owner was successfully added to the pool_owners, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_owners_t* pool_owners = cardano_pool_owners_new();
+ *
+ * // Create and initialize a new plutus_data owner
+ * cardano_blake2b_hash_t* owner = { ... };
+ *
+ * // Add the owner to the pool_owners
+ * cardano_error_t result = cardano_pool_owners_add(pool_owners, owner);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the pool_owners object once done
+ * cardano_pool_owners_unref(&pool_owners);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_owners_add(cardano_pool_owners_t* pool_owners, cardano_blake2b_hash_t* owner);
+
+/**
+ * \brief Decrements the reference count of a pool_owners object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_pool_owners_t object
+ * by decreasing its reference count. When the reference count reaches zero, the pool_owners is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] pool_owners A pointer to the pointer of the pool_owners object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_owners_t* pool_owners = cardano_pool_owners_new();
+ *
+ * // Perform operations with the pool_owners...
+ *
+ * cardano_pool_owners_unref(&pool_owners);
+ * // At this point, pool_owners is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_pool_owners_unref, the pointer to the \ref cardano_pool_owners_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_pool_owners_unref(cardano_pool_owners_t** pool_owners);
+
+/**
+ * \brief Increases the reference count of the cardano_pool_owners_t object.
+ *
+ * This function is used to manually increment the reference count of a pool_owners
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_pool_owners_unref.
+ *
+ * \param pool_owners A pointer to the pool_owners object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_owners is a previously created pool_owners object
+ *
+ * cardano_pool_owners_ref(pool_owners);
+ *
+ * // Now pool_owners can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_pool_owners_ref there is a corresponding
+ * call to \ref cardano_pool_owners_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_pool_owners_ref(cardano_pool_owners_t* pool_owners);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_pool_owners_t object.
+ *
+ * This function returns the number of active references to a pool_owners object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_pool_owners_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param pool_owners A pointer to the pool_owners object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified pool_owners object. If the object
+ * is properly managed (i.e., every \ref cardano_pool_owners_ref call is matched with a
+ * \ref cardano_pool_owners_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_owners is a previously created pool_owners object
+ *
+ * size_t ref_count = cardano_pool_owners_refcount(pool_owners);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_pool_owners_refcount(const cardano_pool_owners_t* pool_owners);
+
+/**
+ * \brief Sets the last error message for a given pool_owners object.
+ *
+ * Records an error message in the pool_owners's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] pool_owners A pointer to the \ref cardano_pool_owners_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the pool_owners's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_pool_owners_set_last_error(cardano_pool_owners_t* pool_owners, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific pool_owners.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_pool_owners_set_last_error for the given
+ * pool_owners. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] pool_owners A pointer to the \ref cardano_pool_owners_t instance whose last error
+ *                   message is to be retrieved. If the pool_owners is NULL, the function
+ *                   returns a generic error message indicating the null pool_owners.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified pool_owners. If the pool_owners is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_pool_owners_set_last_error for the same pool_owners, or until
+ *       the pool_owners is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_pool_owners_get_last_error(const cardano_pool_owners_t* pool_owners);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_pool_owners_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_pool_owners_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_pool_owners_deep_clone(const cardano_pool_owners_t* source, cardano_pool_owners_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_POOL_OWNERS_H
diff --git a/vendor/include/cardano/pool_params/pool_params.h b/vendor/include/cardano/pool_params/pool_params.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/pool_params.h
@@ -0,0 +1,1192 @@
+/**
+ * \file pool_params.h
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_POOL_PARAMS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_POOL_PARAMS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/pool_params/bls_key.h>
+#include <cardano/pool_params/pool_metadata.h>
+#include <cardano/pool_params/pool_owners.h>
+#include <cardano/pool_params/relays.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Stake pool update certificate parameters.
+ *
+ * When a stake pool operator wants to change the parameters of their pool, they
+ * must submit a pool update certificate with these parameters.
+ */
+typedef struct cardano_pool_params_t cardano_pool_params_t;
+
+/**
+ * \brief Creates and initializes a new instance of pool parameters.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_pool_params_t,
+ * which represents the parameters of a staking pool in the Cardano blockchain.
+ *
+ * \param[in] operator_key_hash A pointer to an initialized \ref cardano_blake2b_hash_t object
+ *                              representing the operator's key hash.
+ * \param[in] vrf_vk_hash A pointer to an initialized \ref cardano_blake2b_hash_t object containing the VRF (Verifiable Random Function)
+ *                        verification key hash.
+ * \param[in] pledge The amount of ADA pledged to the pool by the operator.
+ * \param[in] cost The operational cost of the pool.
+ * \param[in] margin A pointer to an initialized \ref cardano_unit_interval_t object representing the margin.
+ * \param[in] reward_account A pointer to an initialized \ref cardano_reward_address_t object representing the reward account.
+ * \param[in] owners A pointer to an initialized \ref cardano_pool_owners_t object containing the pool owners.
+ * \param[in] relays A pointer to an initialized \ref cardano_relays_t object containing the pool relays.
+ * \param[in] metadata A pointer to an initialized \ref cardano_pool_metadata_t object containing the pool metadata.
+ * \param[out] pool_params On successful initialization, this will point to a newly created \ref cardano_pool_params_t object.
+ *                         The caller is responsible for managing the lifecycle of this object. Specifically, once the pool parameters
+ *                         are no longer needed, the caller must release it by calling \ref cardano_pool_params_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool parameters were successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * \note This function takes references from all input objects. The caller is responsible for managing
+ *       the lifecycle of these objects and must call the appropriate unref functions to release them
+ *       when they are no longer needed.
+ *
+ * \note The pool parameters are created without a BLS key. Use \ref cardano_pool_params_set_bls_key to
+ *       attach one when the pool takes part in Leios voting.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* operator_key_hash = ...; // Assume operator_key_hash is initialized
+ * cardano_blake2b_hash_t* vrf_vk_hash = ...; // Assume vrf_vk_hash is initialized
+ * uint64_t pledge = 1000000;
+ * uint64_t cost = 340000000;
+ * cardano_unit_interval_t* margin = ...; // Assume margin is initialized
+ * cardano_reward_address_t* reward_account = ...; // Assume reward_account is initialized
+ * cardano_pool_owners_t* owners = ...; // Assume owners is initialized
+ * cardano_relays_t* relays = ...; // Assume relays is initialized
+ * cardano_pool_metadata_t* metadata = ...; // Assume metadata is initialized
+ * cardano_pool_params_t* pool_params = NULL;
+ *
+ * // Attempt to create a new pool parameters object
+ * cardano_error_t result = cardano_pool_params_new(operator_key_hash, vrf_vk_hash, pledge, cost, margin, reward_account, owners, relays, metadata, &pool_params);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pool_params
+ *
+ *   // Once done, ensure to clean up and release the pool_params
+ *   cardano_pool_params_unref(&pool_params);
+ * }
+ *
+ * // Ensure to clean up and release all other objects
+ * cardano_blake2b_hash_unref(&operator_key_hash);
+ * cardano_blake2b_hash_unref(&vrf_vk_hash);
+ * cardano_unit_interval_unref(&margin);
+ * cardano_reward_address_unref(&reward_account);
+ * cardano_pool_owners_unref(&owners);
+ * cardano_relays_unref(&relays);
+ * cardano_pool_metadata_unref(&metadata);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_params_new(
+  cardano_blake2b_hash_t*   operator_key_hash,
+  cardano_blake2b_hash_t*   vrf_vk_hash,
+  uint64_t                  pledge,
+  uint64_t                  cost,
+  cardano_unit_interval_t*  margin,
+  cardano_reward_address_t* reward_account,
+  cardano_pool_owners_t*    owners,
+  cardano_relays_t*         relays,
+  cardano_pool_metadata_t*  metadata,
+  cardano_pool_params_t**   pool_params);
+
+/**
+ * \brief Creates a \ref cardano_pool_params_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_pool_params_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a pool_params.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] pool_params A pointer to a pointer of \ref cardano_pool_params_t that will be set to the address
+ *                        of the newly created pool_params object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_pool_params_t object by calling
+ *       \ref cardano_pool_params_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_pool_params_t* pool_params = NULL;
+ *
+ * cardano_error_t result = cardano_pool_params_from_cbor(reader, &pool_params);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pool_params
+ *
+ *   // Once done, ensure to clean up and release the pool_params
+ *   cardano_pool_params_unref(&pool_params);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode pool_params: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_params_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_params_t** pool_params);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_pool_params_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] pool_params A constant pointer to the \ref cardano_pool_params_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p pool_params or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_pool_params_to_cbor(pool_params, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_pool_params_unref(&pool_params);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_to_cbor(
+  const cardano_pool_params_t* pool_params,
+  cardano_cbor_writer_t*       writer);
+
+/**
+ * \brief Serializes pool parameters to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ *
+ * \param[in]  params  Pointer to a valid \ref cardano_pool_params_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p params or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED  If memory allocation fails.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_params_to_cip116_json(
+  const cardano_pool_params_t* params,
+  cardano_json_writer_t*       writer);
+
+/**
+ * \brief Retrieves the operator's key hash from the pool parameters.
+ *
+ * This function provides access to the operator's key hash stored within the pool parameters.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object from which the key hash is retrieved.
+ * \param[out] operator_key_hash On successful retrieval, this will point to an initialized \ref cardano_blake2b_hash_t object
+ *                               that represents the operator's key hash. The caller gains a reference to this object and is responsible
+ *                               for managing its lifecycle, which includes releasing it by calling \ref cardano_blake2b_hash_unref
+ *                               when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the operator's key hash was successfully retrieved, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input pool_params or output operator_key_hash is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_blake2b_hash_t* operator_key_hash = NULL;
+ *
+ * cardano_error_t result = cardano_pool_params_get_operator_key_hash(pool_params, &operator_key_hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the operator_key_hash
+ *
+ *   // Once done, ensure to clean up and release the operator_key_hash
+ *   cardano_blake2b_hash_unref(&operator_key_hash);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the operator's key hash.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_get_operator_key_hash(
+  cardano_pool_params_t*   pool_params,
+  cardano_blake2b_hash_t** operator_key_hash);
+
+/**
+ * \brief Sets the operator's key hash for the pool parameters.
+ *
+ * This function assigns a new operator's key hash to a given \ref cardano_pool_params_t object.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object to which the key hash will be set.
+ * \param[in] operator_key_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the operator's key hash.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the operator's key hash was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note This function increments the reference count of the operator_key_hash. It is the caller's responsibility to manage
+ *       its own reference and ensure that it calls \ref cardano_blake2b_hash_unref when the hash is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_blake2b_hash_t* operator_key_hash = ...; // Assume operator_key_hash is already initialized and referenced
+ *
+ * cardano_error_t result = cardano_pool_params_set_operator_key_hash(pool_params, operator_key_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The operator_key_hash is now set for the pool_params
+ *   // Remember to unref operator_key_hash when it's no longer needed
+ * }
+ * else
+ * {
+ *   printf("Failed to set the operator's key hash.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_set_operator_key_hash(
+  cardano_pool_params_t*  pool_params,
+  cardano_blake2b_hash_t* operator_key_hash);
+
+/**
+ * \brief Retrieves the VRF verification key hash from the pool parameters.
+ *
+ * This function gets the VRF verification key hash associated with a \ref cardano_pool_params_t object.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object from which the VRF key hash will be retrieved.
+ * \param[out] vrf_vk_hash On successful retrieval, this will point to the \ref cardano_blake2b_hash_t object containing the VRF key hash.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the VRF key hash was successfully retrieved,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input pointer is NULL or the
+ *         vrf_vk_hash pointer could not be set.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_blake2b_hash_t* vrf_vk_hash = NULL;
+ *
+ * cardano_error_t result = cardano_pool_params_get_vrf_vk_hash(pool_params, &vrf_vk_hash);
+ * if (result == CARDANO_SUCCESS && vrf_vk_hash != NULL)
+ * {
+ *   // Use the vrf_vk_hash
+ *   // Remember to unref the vrf_vk_hash when it's no longer needed
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the VRF key hash.\n");
+ * }
+ * \endcode
+ *
+ * \note This function increments the reference count of the returned vrf_vk_hash to ensure the caller has a valid reference.
+ *       It is the caller's responsibility to decrement this count when the hash is no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_get_vrf_vk_hash(
+  cardano_pool_params_t*   pool_params,
+  cardano_blake2b_hash_t** vrf_vk_hash);
+
+/**
+ * \brief Sets the VRF verification key hash for the pool parameters.
+ *
+ * This function assigns a new VRF verification key hash to a given \ref cardano_pool_params_t object.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object to which the VRF key hash will be set.
+ * \param[in] vrf_vk_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the VRF verification key hash.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the VRF key hash was successfully set,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_blake2b_hash_t* vrf_vk_hash = ...; // Assume vrf_vk_hash is already initialized
+ *
+ * cardano_error_t result = cardano_pool_params_set_vrf_vk_hash(pool_params, vrf_vk_hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The vrf_vk_hash is now set for the pool_params
+ * }
+ * else
+ * {
+ *   printf("Failed to set the VRF key hash.\n");
+ * }
+ * \endcode
+ *
+ * \note This function takes a reference to the vrf_vk_hash provided. The caller is responsible for managing their reference and must ensure
+ *       that it is decremented when no longer needed. The pool parameters object will hold its own reference.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_set_vrf_vk_hash(
+  cardano_pool_params_t*  pool_params,
+  cardano_blake2b_hash_t* vrf_vk_hash);
+
+/**
+ * \brief Checks whether the pool parameters carry a BLS key.
+ *
+ * This function reports whether a BLS key has been attached to a \ref cardano_pool_params_t object,
+ * without taking a reference to it. Pools that do not take part in Leios voting carry no key.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object.
+ *
+ * \return \c true if the pool parameters carry a BLS key, \c false if they carry none or if \p pool_params is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ *
+ * if (cardano_pool_params_has_bls_key(pool_params))
+ * {
+ *   printf("The pool registers a BLS key.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_pool_params_has_bls_key(const cardano_pool_params_t* pool_params);
+
+/**
+ * \brief Retrieves the BLS key from the pool parameters.
+ *
+ * This function gets the BLS key associated with a \ref cardano_pool_params_t object. The BLS key is
+ * optional; pools that do not take part in Leios voting carry no key.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object from which the BLS key will be retrieved.
+ * \param[out] bls_key On successful retrieval, this will point to the \ref cardano_bls_key_t object containing the BLS key,
+ *                     or to NULL when the pool parameters carry no BLS key.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the BLS key was successfully
+ *         retrieved (or is absent), or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_bls_key_t* bls_key = NULL;
+ *
+ * cardano_error_t result = cardano_pool_params_get_bls_key(pool_params, &bls_key);
+ * if (result == CARDANO_SUCCESS && bls_key != NULL)
+ * {
+ *   // Use the bls_key
+ *
+ *   // Once done, ensure to clean up and release the bls_key
+ *   cardano_bls_key_unref(&bls_key);
+ * }
+ * else
+ * {
+ *   printf("The pool parameters carry no BLS key.\n");
+ * }
+ * \endcode
+ *
+ * \note This function increments the reference count of the returned bls_key to ensure the caller has a valid reference.
+ *       It is the caller's responsibility to decrement this count when the key is no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_get_bls_key(
+  cardano_pool_params_t* pool_params,
+  cardano_bls_key_t**    bls_key);
+
+/**
+ * \brief Sets the BLS key for the pool parameters.
+ *
+ * This function assigns a BLS key to a given \ref cardano_pool_params_t object. If the pool parameters
+ * already have a BLS key assigned, it is replaced by the new one. Passing NULL removes the key, so the
+ * pool parameters serialize again in the form without a BLS key.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object to which the BLS key will be set.
+ * \param[in] bls_key A pointer to an initialized \ref cardano_bls_key_t object representing the BLS key, or NULL to clear it.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the BLS key was successfully set,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if pool_params is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_bls_key_t* bls_key = ...; // Assume bls_key is already initialized
+ *
+ * cardano_error_t result = cardano_pool_params_set_bls_key(pool_params, bls_key);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The bls_key is now set for the pool_params
+ * }
+ * else
+ * {
+ *   printf("Failed to set the BLS key.\n");
+ * }
+ *
+ * // The caller must continue to manage the lifecycle of bls_key
+ * cardano_bls_key_unref(&bls_key);
+ * \endcode
+ *
+ * \note This function takes a reference to the bls_key provided. The caller is responsible for managing their reference and must ensure
+ *       that it is decremented when no longer needed. The pool parameters object will hold its own reference.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_set_bls_key(
+  cardano_pool_params_t* pool_params,
+  cardano_bls_key_t*     bls_key);
+
+/**
+ * \brief Retrieves the pledge amount from the pool parameters.
+ *
+ * This function retrieves the pledge amount set for a staking pool, which is the amount of ADA pledged
+ * by the pool operator to their own pool.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object from which the pledge amount is to be retrieved.
+ * \param[out] pledge Pointer to a uint64_t where the pledge amount will be stored upon successful retrieval.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the pledge amount was successfully retrieved,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * uint64_t pledge;
+ *
+ * cardano_error_t result = cardano_pool_params_get_pledge(pool_params, &pledge);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pledge amount: %llu ADA\n", pledge);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the pledge amount.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_get_pledge(
+  cardano_pool_params_t* pool_params,
+  uint64_t*              pledge);
+
+/**
+ * \brief Sets the pledge amount for the pool parameters.
+ *
+ * This function assigns a new pledge amount to a staking pool. The pledge is the amount of ADA that the pool operator
+ * commits to keeping staked in their pool.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object to which the pledge amount will be set.
+ * \param[in] pledge The new pledge amount in lovelaces (1 ADA = 1,000,000 lovelaces).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the pledge amount
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * uint64_t new_pledge = 1500000000; // New pledge amount of 1,500 ADA
+ *
+ * cardano_error_t result = cardano_pool_params_set_pledge(pool_params, new_pledge);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pledge amount successfully updated.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to update the pledge amount.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_set_pledge(
+  cardano_pool_params_t* pool_params,
+  uint64_t               pledge);
+
+/**
+ * \brief Retrieves the operational cost of the pool from the pool parameters.
+ *
+ * This function fetches the operational cost set for a staking pool. The operational cost is a fixed amount of ADA
+ * that the pool deducts from the total rewards before distributing the rest among the stakers. This cost covers the
+ * expenses incurred by the pool operators for maintaining the pool.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object from which the cost will be retrieved.
+ * \param[out] cost Pointer to a variable where the operational cost will be stored upon successful retrieval.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the cost was
+ *         successfully retrieved, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * uint64_t cost;
+ *
+ * cardano_error_t result = cardano_pool_params_get_cost(pool_params, &cost);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Operational cost of the pool: %llu lovelaces.\n", cost);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the operational cost.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_get_cost(
+  cardano_pool_params_t* pool_params,
+  uint64_t*              cost);
+
+/**
+ * \brief Sets the operational cost of the pool in the pool parameters.
+ *
+ * This function assigns a new operational cost to a staking pool. The operational cost is a fixed amount of ADA
+ * that the pool deducts from the total rewards before distributing the rest among the stakers. This fee is meant to cover
+ * the pool operator's expenses in running the pool.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object to which the new cost will be set.
+ * \param[in] cost The new operational cost in lovelaces to be set for the pool.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the cost was
+ *         successfully updated, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * uint64_t new_cost = 350000000; // 350 ADA expressed in lovelaces
+ *
+ * cardano_error_t result = cardano_pool_params_set_cost(pool_params, new_cost);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Operational cost updated to: %llu lovelaces.\n", new_cost);
+ * }
+ * else
+ * {
+ *   printf("Failed to update the operational cost.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_set_cost(
+  cardano_pool_params_t* pool_params,
+  uint64_t               cost);
+
+/**
+ * \brief Retrieves the margin from the pool parameters.
+ *
+ * This function fetches the margin setting from a staking pool's parameters. The margin represents the percentage
+ * of total rewards that the pool operator takes as a fee before distributing the remaining rewards among the delegators.
+ * It is expressed as a unit interval, ranging from 0 to 1, where 0 represents 0% and 1 represents 100%.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object from which the margin will be retrieved.
+ * \param[out] margin A pointer to a pointer that will be set to point to the margin of the pool. This object is reference counted
+ *                    and a new reference is obtained before it is returned to the caller. The caller is responsible for releasing
+ *                    this reference when it is no longer needed by calling \ref cardano_unit_interval_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the margin was
+ *         successfully retrieved, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_unit_interval_t* margin = NULL;
+ *
+ * cardano_error_t result = cardano_pool_params_get_margin(pool_params, &margin);
+ * if (result == CARDANO_SUCCESS && margin != NULL)
+ * {
+ *   printf("Pool margin: %f\n", cardano_unit_interval_to_double(margin));
+ *   // When done using the margin
+ *   cardano_unit_interval_unref(&margin);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the pool margin.\n");
+ * }
+ * \endcode
+ *
+ * \note It is the caller's responsibility to release the margin object by calling \ref cardano_unit_interval_unref
+ *       to prevent memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_get_margin(
+  cardano_pool_params_t*    pool_params,
+  cardano_unit_interval_t** margin);
+
+/**
+ * \brief Sets the margin for the pool parameters.
+ *
+ * This function assigns a new margin to a given \ref cardano_pool_params_t object.
+ * The margin represents the percentage of total rewards that the pool operator takes
+ * as a fee before distributing the remaining rewards among the delegators.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object to which the margin will be set.
+ * \param[in] margin A pointer to an initialized \ref cardano_unit_interval_t object representing the new margin value.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the margin
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_unit_interval_t* margin = ...; // Assume margin is already initialized
+ *
+ * cardano_error_t result = cardano_pool_params_set_margin(pool_params, margin);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The margin has been successfully set for the pool_params
+ * }
+ * else
+ * {
+ *   printf("Failed to set the pool margin.\n");
+ * }
+ *
+ * // Continue to manage the margin reference as needed, including releasing it when no longer required
+ * cardano_unit_interval_unref(&margin);
+ * \endcode
+ *
+ * \note This function takes a new reference to the margin object for use by the pool_params object.
+ *       The caller must continue to manage their own reference to the margin object.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_set_margin(
+  cardano_pool_params_t*   pool_params,
+  cardano_unit_interval_t* margin);
+
+/**
+ * \brief Retrieves the reward account associated with the pool parameters.
+ *
+ * This function provides access to the reward account associated with a given \ref cardano_pool_params_t object.
+ * The reward account is where the pool's rewards are deposited before distribution.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object from which to retrieve the reward account.
+ * \param[out] reward_account On successful return, this will point to an initialized \ref cardano_reward_address_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the reward account
+ *         was successfully retrieved, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_reward_address_t* reward_account = NULL;
+ *
+ * cardano_error_t result = cardano_pool_params_get_reward_account(pool_params, &reward_account);
+ * if (result == CARDANO_SUCCESS && reward_account != NULL)
+ * {
+ *   // Use the reward_account
+ *
+ *   // Once done, ensure to clean up and release the reward_account
+ *   cardano_reward_address_unref(&reward_account);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the reward account.\n");
+ * }
+ * \endcode
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned reward_account object.
+ *       Ensure to call \ref cardano_reward_address_unref to release the reference when it is no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_get_reward_account(
+  cardano_pool_params_t*     pool_params,
+  cardano_reward_address_t** reward_account);
+
+/**
+ * \brief Sets the reward account for the pool parameters.
+ *
+ * This function assigns a new reward account to a given \ref cardano_pool_params_t object.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object to which the reward account will be set.
+ * \param[in] reward_account A pointer to an initialized \ref cardano_reward_address_t object representing the reward account.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reward account was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_reward_address_t* reward_account = ...; // Assume reward_account is already initialized
+ *
+ * cardano_error_t result = cardano_pool_params_set_reward_account(pool_params, reward_account);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The reward_account is now set for the pool_params
+ * }
+ * else
+ * {
+ *   printf("Failed to set the reward account.\n");
+ * }
+ *
+ * // The caller must continue to manage the lifecycle of reward_account
+ * cardano_reward_address_unref(&reward_account);
+ * \endcode
+ *
+ * \note After setting, the pool_params object holds a reference to the reward_account. It is important for the caller
+ *       to manage their reference to the reward_account object appropriately, including calling \ref cardano_reward_address_unref
+ *       when it is no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_set_reward_account(
+  cardano_pool_params_t*    pool_params,
+  cardano_reward_address_t* reward_account);
+
+/**
+ * \brief Retrieves the owners of a staking pool.
+ *
+ * This function accesses the list of owners from a \ref cardano_pool_params_t object.
+ * The function increments the reference count for the owners object before returning it,
+ * ensuring that the returned reference is valid for the caller to use.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object from which the owners will be retrieved.
+ * \param[out] owners On successful retrieval, this will point to a \ref cardano_pool_owners_t object that lists the owners of the pool.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the owners were successfully retrieved, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_pool_owners_t* owners = NULL;
+ *
+ * cardano_error_t result = cardano_pool_params_get_owners(pool_params, &owners);
+ * if (result == CARDANO_SUCCESS && owners != NULL)
+ * {
+ *   // Use the owners
+ *   // Once done, ensure to clean up and release the owners
+ *   cardano_pool_owners_unref(&owners);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve pool owners.\n");
+ * }
+ * \endcode
+ *
+ * \note The caller is responsible for releasing the retrieved owners object by calling \ref cardano_pool_owners_unref.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_get_owners(
+  cardano_pool_params_t*  pool_params,
+  cardano_pool_owners_t** owners);
+
+/**
+ * \brief Sets the owners of a staking pool.
+ *
+ * This function assigns a new list of owners to a \ref cardano_pool_params_t object.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object to which the owners will be set.
+ * \param[in] owners A pointer to an initialized \ref cardano_pool_owners_t object representing the new owners of the pool.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the owners were successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_pool_owners_t* new_owners = ...;  // Assume new_owners is already initialized
+ *
+ * cardano_error_t result = cardano_pool_params_set_owners(pool_params, new_owners);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The new owners have been set for the pool_params
+ * }
+ * else
+ * {
+ *   printf("Failed to set the pool owners.\n");
+ * }
+ *
+ * // Once done, ensure to clean up and release the owners
+ * cardano_pool_owners_unref(&new_owners);
+ * \endcode
+ *
+ * \note The caller is responsible for releasing the owners object by calling \ref cardano_pool_owners_unref.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_set_owners(
+  cardano_pool_params_t* pool_params,
+  cardano_pool_owners_t* owners);
+
+/**
+ * \brief Retrieves the relays associated with a staking pool.
+ *
+ * This function gets the current list of relays set for a \ref cardano_pool_params_t object. It provides a pointer to the
+ * \ref cardano_relays_t object containing the relays.
+ *
+ * \param[in] pool_params A constant pointer to an initialized \ref cardano_pool_params_t object from which the relays will be retrieved.
+ * \param[out] relays On successful execution, this will point to an initialized \ref cardano_relays_t object representing the pool's relays.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the relays were successfully retrieved, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_relays_t* relays = NULL;
+ *
+ * cardano_error_t result = cardano_pool_params_get_relays(pool_params, &relays);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the relays
+ *
+ *   // Once done, ensure to clean up and release the relays
+ *   cardano_relays_unref(&relays);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the pool relays.\n");
+ * }
+ * \endcode
+ *
+ * \note The function increments the reference count of the returned relays object to ensure its validity. The caller must manage
+ *       the lifecycle of the returned object by calling \ref cardano_relays_unref when it is no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_get_relays(
+  cardano_pool_params_t* pool_params,
+  cardano_relays_t**     relays);
+
+/**
+ * \brief Sets the relays for a staking pool.
+ *
+ * This function assigns a new set of relays to a \ref cardano_pool_params_t object.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object to which the relays will be set.
+ * \param[in] relays A pointer to an initialized \ref cardano_relays_t object representing the new set of relays for the pool.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the relays were successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note The function increments the reference count of the relays object. The caller must manage
+ *       the lifecycle of its object by calling \ref cardano_relays_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_relays_t* relays = ...; // Assume relays is already initialized
+ *
+ * cardano_error_t result = cardano_pool_params_set_relays(pool_params, relays);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The relays are now set for the pool_params
+ * }
+ * else
+ * {
+ *   printf("Failed to set the pool relays.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_set_relays(
+  cardano_pool_params_t* pool_params,
+  cardano_relays_t*      relays);
+
+/**
+ * \brief Retrieves the metadata for a staking pool.
+ *
+ * This function obtains the metadata associated with a \ref cardano_pool_params_t object.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object from which to retrieve the metadata.
+ * \param[out] metadata On successful return, this will point to an initialized \ref cardano_pool_metadata_t object representing the pool's metadata.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the metadata was successfully retrieved, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned metadata object and must call
+ *       \ref cardano_pool_metadata_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_pool_metadata_t* metadata = NULL;
+ *
+ * cardano_error_t result = cardano_pool_params_get_metadata(pool_params, &metadata);
+ * if (result == CARDANO_SUCCESS && metadata != NULL)
+ * {
+ *   // Use the metadata
+ *   // Once done, ensure to clean up and release the metadata
+ *   cardano_pool_metadata_unref(&metadata);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the pool metadata.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_get_metadata(
+  cardano_pool_params_t*    pool_params,
+  cardano_pool_metadata_t** metadata);
+
+/**
+ * \brief Sets the metadata for a staking pool.
+ *
+ * This function assigns a metadata object to a \ref cardano_pool_params_t object. If the pool parameters
+ * already have a metadata object assigned, it is replaced by the new one.
+ *
+ * \param[in] pool_params A pointer to an initialized \ref cardano_pool_params_t object to which the metadata will be set.
+ * \param[in] metadata A pointer to an initialized \ref cardano_pool_metadata_t object representing the pool's metadata.
+ *                      This function increments the reference count of the metadata object, ensuring it remains valid for the duration
+ *                      of its association with the pool parameters.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the metadata was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note It is the responsibility of the caller to manage the lifecycle of the metadata object passed to this function.
+ *       The pool_params object will hold its own reference to the metadata object, so the caller must still unref their
+ *       own reference when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = ...; // Assume pool_params is already initialized
+ * cardano_pool_metadata_t* metadata = ...; // Assume metadata is initialized
+ *
+ * cardano_error_t result = cardano_pool_params_set_metadata(pool_params, metadata);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The metadata is now set for the pool_params
+ * }
+ * else
+ * {
+ *   printf("Failed to set the pool metadata.\n");
+ * }
+ *
+ * // Remember to unref your own reference to the metadata if it is no longer needed
+ * cardano_pool_metadata_unref(&metadata);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_params_set_metadata(
+  cardano_pool_params_t*   pool_params,
+  cardano_pool_metadata_t* metadata);
+
+/**
+ * \brief Decrements the reference count of a cardano_pool_params_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_pool_params_t object
+ * by decreasing its reference count. When the reference count reaches zero, the pool_params is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] pool_params A pointer to the pointer of the pool_params object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_params_t* pool_params = cardano_pool_params_new(major, minor);
+ *
+ * // Perform operations with the pool_params...
+ *
+ * cardano_pool_params_unref(&pool_params);
+ * // At this point, pool_params is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_pool_params_unref, the pointer to the \ref cardano_pool_params_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_pool_params_unref(cardano_pool_params_t** pool_params);
+
+/**
+ * \brief Increases the reference count of the cardano_pool_params_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_pool_params_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_pool_params_unref.
+ *
+ * \param pool_params A pointer to the cardano_pool_params_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_params is a previously created pool_params object
+ *
+ * cardano_pool_params_ref(pool_params);
+ *
+ * // Now pool_params can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_pool_params_ref there is a corresponding
+ * call to \ref cardano_pool_params_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_pool_params_ref(cardano_pool_params_t* pool_params);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_pool_params_t object.
+ *
+ * This function returns the number of active references to an cardano_pool_params_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_pool_params_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param pool_params A pointer to the cardano_pool_params_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_pool_params_t object. If the object
+ * is properly managed (i.e., every \ref cardano_pool_params_ref call is matched with a
+ * \ref cardano_pool_params_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_params is a previously created pool_params object
+ *
+ * size_t ref_count = cardano_pool_params_refcount(pool_params);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_pool_params_refcount(const cardano_pool_params_t* pool_params);
+
+/**
+ * \brief Sets the last error message for a given cardano_pool_params_t object.
+ *
+ * Records an error message in the pool_params's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] pool_params A pointer to the \ref cardano_pool_params_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the pool_params's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_pool_params_set_last_error(
+  cardano_pool_params_t* pool_params,
+  const char*            message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific pool_params.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_pool_params_set_last_error for the given
+ * pool_params. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] pool_params A pointer to the \ref cardano_pool_params_t instance whose last error
+ *                   message is to be retrieved. If the pool_params is NULL, the function
+ *                   returns a generic error message indicating the null pool_params.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified pool_params. If the pool_params is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_pool_params_set_last_error for the same pool_params, or until
+ *       the pool_params is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_pool_params_get_last_error(
+  const cardano_pool_params_t* pool_params);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_pool_params_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_pool_params_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_pool_params_deep_clone(const cardano_pool_params_t* source, cardano_pool_params_t** clone);
+
+/**
+ * \brief Applies the Dijkstra pool-owner witness exemption, ignoring only the BLS key.
+ * \param[in] proposed The proposed pool parameters.
+ * \param[in] latest The latest registered parameters: pending parameters when present, otherwise active
+ * parameters. NULL means new or unknown pool and conservatively requires owners. Must describe the same
+ * pool to qualify for the exemption. Unchanged registrations and unretirement also qualify.
+ * \param[out] required Whether owners must witness the registration. The operator is always required.
+ * \return Success, a null argument error, or a comparison/allocation error.
+ * \note Only use the exemption from protocol version 12. Owner order and equivalent rational margins
+ * do not affect equality. This function neither verifies chain state nor changes either parameter object.
+ */
+CARDANO_EXPORT cardano_error_t cardano_pool_params_requires_owner_witnesses(
+  const cardano_pool_params_t* proposed,
+  const cardano_pool_params_t* latest,
+  bool*                        required);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_POOL_PARAMS_H
diff --git a/vendor/include/cardano/pool_params/relay.h b/vendor/include/cardano/pool_params/relay.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/relay.h
@@ -0,0 +1,636 @@
+/**
+ * \file relay.h
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_RELAY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_RELAY_H
+
+/* INCLUDES ******************************************************************/
+
+#include "relay_type.h"
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A relay is a type of node that acts as intermediaries between core nodes
+ * (which produce blocks) and the wider internet. They help in passing along
+ * transactions and blocks, ensuring that data is propagated throughout the
+ * network.
+ */
+typedef struct cardano_relay_t cardano_relay_t;
+
+/**
+ * \brief This relay points to a multi host name via a DNS (A SRV DNS record) name.
+ */
+typedef struct cardano_multi_host_name_relay_t cardano_multi_host_name_relay_t;
+
+/**
+ * \brief This relay points to a single host via its ipv4/ipv6 address and a given port.
+ */
+typedef struct cardano_single_host_addr_relay_t cardano_single_host_addr_relay_t;
+
+/**
+ * \brief This relay points to a single host via a DNS (pointing to an A or AAAA DNS record) name and a given port.
+ */
+typedef struct cardano_single_host_name_relay_t cardano_single_host_name_relay_t;
+
+/**
+ * \brief Creates a new relay object that points to a single host address.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_relay_t,
+ * which is configured to point to a single host via its IP address and a specified port.
+ * This type of relay is used for direct, single-host communication in the Cardano network.
+ *
+ * \param[in] single_host_addr_relay A pointer to an initialized \ref cardano_single_host_addr_relay_t object
+ *                                   that specifies the IP address and port of the host.
+ * \param[out] relay On successful initialization, this will point to the newly created
+ *                   \ref cardano_relay_t object. This object represents a "strong reference"
+ *                   to the relay, meaning that it is fully initialized and ready for use.
+ *                   The caller is responsible for managing the lifecycle of this object.
+ *                   Specifically, once the relay is no longer needed, the caller must release it
+ *                   by calling \ref cardano_relay_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the relay was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_addr_relay_t* single_host_addr_relay = ...; // Assume single_host_addr_relay is initialized
+ * cardano_relay_t* relay = NULL;
+ *
+ * cardano_error_t result = cardano_relay_new_single_host_addr(single_host_addr_relay, &relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the relay
+ *
+ *   // Once done, ensure to clean up and release the relay
+ *   cardano_relay_unref(&relay);
+ * }
+ *
+ * cardano_single_host_addr_relay_unref(&single_host_addr_relay);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_relay_new_single_host_addr(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  cardano_relay_t**                 relay);
+
+/**
+ * \brief Creates a new relay object that points to a single host name.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_relay_t,
+ * configured to point to a single host via its DNS name and a specified port.
+ * This relay is useful for Cardano network communication where DNS resolution
+ * is preferred over direct IP address connections.
+ *
+ * \param[in] single_host_name A pointer to an initialized \ref cardano_single_host_name_relay_t object
+ *                             that specifies the DNS name and port of the host.
+ * \param[out] relay On successful initialization, this will point to the newly created
+ *                   \ref cardano_relay_t object. This object represents a "strong reference"
+ *                   to the relay, indicating that it is fully initialized and ready for use.
+ *                   The caller is responsible for managing the lifecycle of this object.
+ *                   Specifically, once the relay is no longer needed, the caller must release it
+ *                   by calling \ref cardano_relay_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the relay was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_name_relay_t* single_host_name = ...; // Assume single_host_name is initialized
+ * cardano_relay_t* relay = NULL;
+ *
+ * cardano_error_t result = cardano_relay_new_single_host_name(single_host_name, &relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the relay
+ *
+ *   // Once done, ensure to clean up and release the relay
+ *   cardano_relay_unref(&relay);
+ * }
+ *
+ * cardano_single_host_name_relay_unref(&single_host_name);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_relay_new_single_host_name(
+  cardano_single_host_name_relay_t* single_host_name,
+  cardano_relay_t**                 relay);
+
+/**
+ * \brief Creates a new relay object that points to multiple host names.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_relay_t,
+ * configured to point to multiple hosts via a DNS SRV record. This type of relay
+ * allows for the resolution of multiple addresses and is useful in environments where
+ * high availability and load balancing are required.
+ *
+ * \param[in] multi_host_name_relay A pointer to an initialized \ref cardano_multi_host_name_relay_t object
+ *                                  that specifies the DNS SRV record.
+ * \param[out] relay On successful initialization, this will point to the newly created
+ *                   \ref cardano_relay_t object. This object represents a "strong reference"
+ *                   to the relay, indicating that it is fully initialized and ready for use.
+ *                   The caller is responsible for managing the lifecycle of this object.
+ *                   Specifically, once the relay is no longer needed, the caller must release it
+ *                   by calling \ref cardano_relay_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the relay was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_multi_host_name_relay_t* multi_host_name_relay = ...; // Assume multi_host_name_relay is initialized
+ * cardano_relay_t* relay = NULL;
+ *
+ * cardano_error_t result = cardano_relay_new_multi_host_name(multi_host_name_relay, &relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the relay
+ *
+ *   // Once done, ensure to clean up and release the relay
+ *   cardano_relay_unref(&relay);
+ * }
+ *
+ * cardano_multi_host_name_relay_unref(&multi_host_name_relay);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_relay_new_multi_host_name(
+  cardano_multi_host_name_relay_t* multi_host_name_relay,
+  cardano_relay_t**                relay);
+
+/**
+ * \brief Creates a \ref cardano_relay_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_relay_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a relay.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] relay A pointer to a pointer of \ref cardano_relay_t that will be set to the address
+ *                        of the newly created relay object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_relay_t object by calling
+ *       \ref cardano_relay_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_relay_t* relay = NULL;
+ *
+ * cardano_error_t result = cardano_relay_from_cbor(reader, &relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the relay
+ *
+ *   // Once done, ensure to clean up and release the relay
+ *   cardano_relay_unref(&relay);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode relay: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_relay_from_cbor(cardano_cbor_reader_t* reader, cardano_relay_t** relay);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_relay_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] relay A constant pointer to the \ref cardano_relay_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p relay or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_relay_t* relay = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_relay_to_cbor(relay, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_relay_unref(&relay);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_relay_to_cbor(
+  const cardano_relay_t* relay,
+  cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Serializes a relay to CIP-116 JSON.
+ *
+ * This function detects the specific type of the relay (single host address,
+ * single host name, or multi host name) and serializes it accordingly.
+ *
+ * \param[in]  relay   Pointer to a valid \ref cardano_relay_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p relay or \p writer is NULL.
+ * CARDANO_ERROR_INVALID_ARGUMENT If the relay type is unknown.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_relay_to_cip116_json(
+  const cardano_relay_t* relay,
+  cardano_json_writer_t* writer);
+
+/**
+ * \brief Retrieves the type of a relay.
+ *
+ * This function provides the type of a \ref cardano_relay_t object, which indicates
+ * the specific configuration of the relay (e.g., single host address, single host name,
+ * or multi host name).
+ *
+ * \param[in] relay A constant pointer to an initialized \ref cardano_relay_t object.
+ * \param[out] type A pointer to a \ref cardano_relay_type_t variable where the type of the relay
+ *                  will be stored upon successful execution.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the type was successfully retrieved, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_relay_t* relay = ...; // Assume relay is already initialized
+ * cardano_relay_type_t type;
+ *
+ * cardano_error_t result = cardano_relay_type(relay, &type);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process depending on the type
+ *   switch (type) {
+ *     case CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS:
+ *       // Handle single host address relay
+ *       break;
+ *     case CARDANO_RELAY_TYPE_SINGLE_HOST_NAME:
+ *       // Handle single host name relay
+ *       break;
+ *     case CARDANO_RELAY_TYPE_MULTI_HOST_NAME:
+ *       // Handle multi host name relay
+ *       break;
+ *   }
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve relay type.\n");
+ * }
+ *
+ * cardano_relay_unref(&relay);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_relay_get_type(
+  const cardano_relay_t* relay,
+  cardano_relay_type_t*  type);
+
+/**
+ * \brief Converts a relay to a single host address relay if possible and provides a new reference.
+ *
+ * This function attempts to convert a generic \ref cardano_relay_t object to a more specific
+ * \ref cardano_single_host_addr_relay_t object. This operation will only succeed if the relay
+ * is of the single host address type. On success, it returns a new reference to the single
+ * host address relay, which must be managed separately from the original relay.
+ *
+ * \param[in] relay A pointer to an initialized \ref cardano_relay_t object.
+ * \param[out] single_host_addr A pointer to a pointer of \ref cardano_single_host_addr_relay_t which will point
+ *                              to the single host address relay representation if the conversion is successful.
+ *                              This parameter is set only if the operation succeeds and will hold a new reference.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the relay was successfully converted, or an appropriate error code indicating the failure reason.
+ *         Common failure reasons include incorrect relay type or NULL pointer inputs.
+ *
+ * \note The caller is responsible for managing the lifecycle of both the original and the newly converted
+ *       relay objects. Both must be released with appropriate unref calls when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_relay_t* relay = ...; // Assume relay is already initialized
+ * cardano_single_host_addr_relay_t* single_host_addr;
+ *
+ * cardano_error_t result = cardano_relay_to_single_host_addr(relay, &single_host_addr);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the single_host_addr
+ *   // When done, release the newly created single_host_addr
+ *   cardano_single_host_addr_relay_unref(single_host_addr);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert relay to single host address.\n");
+ * }
+ * // Original relay must also be unref when it is no longer needed
+ * cardano_relay_unref(&relay);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_relay_to_single_host_addr(
+  cardano_relay_t*                   relay,
+  cardano_single_host_addr_relay_t** single_host_addr);
+
+/**
+ * \brief Converts a relay to a single host name relay if possible and provides a new reference.
+ *
+ * This function attempts to convert a generic \ref cardano_relay_t object to a more specific
+ * \ref cardano_single_host_name_relay_t object. This operation will only succeed if the relay
+ * is of the single host name type. On success, it returns a new reference to the single
+ * host name relay, which must be managed separately from the original relay.
+ *
+ * \param[in] relay A pointer to an initialized \ref cardano_relay_t object.
+ * \param[out] single_host_name A pointer to a pointer of \ref cardano_single_host_name_relay_t which will point
+ *                              to the single host name relay representation if the conversion is successful.
+ *                              This parameter is set only if the operation succeeds and will hold a new reference.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the relay was successfully converted, or an appropriate error code indicating the failure reason.
+ *         Common failure reasons include incorrect relay type or NULL pointer inputs.
+ *
+ * \note The caller is responsible for managing the lifecycle of both the original and the newly converted
+ *       relay objects. Both must be released with appropriate unref calls when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_relay_t* relay = ...; // Assume relay is already initialized
+ * cardano_single_host_name_relay_t* single_host_name;
+ *
+ * cardano_error_t result = cardano_relay_to_single_host_name(relay, &single_host_name);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the single_host_name
+ *   // When done, release the newly created single_host_name
+ *   cardano_single_host_name_relay_unref(single_host_name);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert relay to single host name.\n");
+ * }
+ * // Original relay must also be unref when it is no longer needed
+ * cardano_relay_unref(&relay);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_relay_to_single_host_name(
+  cardano_relay_t*                   relay,
+  cardano_single_host_name_relay_t** single_host_name);
+
+/**
+ * \brief Converts a relay to a multi host name relay if possible and provides a new reference.
+ *
+ * This function attempts to convert a generic \ref cardano_relay_t object to a more specific
+ * \ref cardano_multi_host_name_relay_t object. This operation will only succeed if the relay
+ * is of the multi host name type. On success, it returns a new reference to the multi
+ * host name relay, which must be managed separately from the original relay.
+ *
+ * \param[in] relay A pointer to an initialized \ref cardano_relay_t object.
+ * \param[out] multi_host_name A pointer to a pointer of \ref cardano_multi_host_name_relay_t which will point
+ *                             to the multi host name relay representation if the conversion is successful.
+ *                             This parameter is set only if the operation succeeds and will hold a new reference.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the relay was successfully converted, or an appropriate error code indicating the failure reason.
+ *         Common failure reasons include incorrect relay type or NULL pointer inputs.
+ *
+ * \note The caller is responsible for managing the lifecycle of both the original and the newly converted
+ *       relay objects. Both must be released with appropriate unref calls when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_relay_t* relay = ...; // Assume relay is already initialized
+ * cardano_multi_host_name_relay_t* multi_host_name;
+ *
+ * cardano_error_t result = cardano_relay_to_multi_host_name(relay, &multi_host_name);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the multi_host_name
+ *   // When done, release the newly created multi_host_name
+ *   cardano_multi_host_name_relay_unref(multi_host_name);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert relay to multi host name.\n");
+ * }
+ * // Original relay must also be unref when it is no longer needed
+ * cardano_relay_unref(&relay);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_relay_to_multi_host_name(
+  cardano_relay_t*                  relay,
+  cardano_multi_host_name_relay_t** multi_host_name);
+
+/**
+ * \brief Decrements the reference count of a cardano_relay_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_relay_t object
+ * by decreasing its reference count. When the reference count reaches zero, the relay is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] relay A pointer to the pointer of the relay object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_relay_t* relay = cardano_relay_new(major, minor);
+ *
+ * // Perform operations with the relay...
+ *
+ * cardano_relay_unref(&relay);
+ * // At this point, relay is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_relay_unref, the pointer to the \ref cardano_relay_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_relay_unref(cardano_relay_t** relay);
+
+/**
+ * \brief Increases the reference count of the cardano_relay_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_relay_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_relay_unref.
+ *
+ * \param relay A pointer to the cardano_relay_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming relay is a previously created relay object
+ *
+ * cardano_relay_ref(relay);
+ *
+ * // Now relay can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_relay_ref there is a corresponding
+ * call to \ref cardano_relay_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_relay_ref(cardano_relay_t* relay);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_relay_t object.
+ *
+ * This function returns the number of active references to an cardano_relay_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_relay_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param relay A pointer to the cardano_relay_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_relay_t object. If the object
+ * is properly managed (i.e., every \ref cardano_relay_ref call is matched with a
+ * \ref cardano_relay_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming relay is a previously created relay object
+ *
+ * size_t ref_count = cardano_relay_refcount(relay);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_relay_refcount(const cardano_relay_t* relay);
+
+/**
+ * \brief Sets the last error message for a given cardano_relay_t object.
+ *
+ * Records an error message in the relay's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] relay A pointer to the \ref cardano_relay_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the relay's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_relay_set_last_error(
+  cardano_relay_t* relay,
+  const char*      message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific relay.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_relay_set_last_error for the given
+ * relay. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] relay A pointer to the \ref cardano_relay_t instance whose last error
+ *                   message is to be retrieved. If the relay is NULL, the function
+ *                   returns a generic error message indicating the null relay.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified relay. If the relay is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_relay_set_last_error for the same relay, or until
+ *       the relay is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_relay_get_last_error(
+  const cardano_relay_t* relay);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_relay_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_relay_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_relay_deep_clone(const cardano_relay_t* source, cardano_relay_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_RELAY_H
diff --git a/vendor/include/cardano/pool_params/relay_type.h b/vendor/include/cardano/pool_params/relay_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/relay_type.h
@@ -0,0 +1,75 @@
+/**
+ * \file relay_type.h
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_RELAY_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_RELAY_TYPE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumerates the types of relays used in the Cardano network.
+ *
+ * This enumeration defines the different types of relay nodes that can be configured in the Cardano network.
+ * Each type represents a different method of connecting to the network.
+ */
+typedef enum
+{
+  /**
+   * \brief Relay connects to a single host using an IP address and a port number. This is the most direct way of specifying
+   * a relay and does not depend on DNS resolution.
+   */
+  CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS = 0,
+
+  /**
+   * \brief Relay connects using a DNS name and a port number. This type allows the relay's IP address to be resolved
+   * dynamically, which can provide resilience in environments where IP addresses may change.
+   */
+  CARDANO_RELAY_TYPE_SINGLE_HOST_NAME = 1,
+
+  /**
+   * \brief Relay uses a multi-host name via a DNS SRV record to resolve multiple potential IP addresses and ports.
+   * This type is used for more complex network setups where load balancing across multiple servers is required.
+   */
+  CARDANO_RELAY_TYPE_MULTI_HOST_NAME = 2
+} cardano_relay_type_t;
+
+/**
+ * \brief Converts relay types to their human readable form.
+ *
+ * \param[in] type The relay type to get the string representation for.
+ * \return Human readable form of the given relay type.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_relay_type_to_string(cardano_relay_type_t type);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_RELAY_TYPE_H
diff --git a/vendor/include/cardano/pool_params/relays.h b/vendor/include/cardano/pool_params/relays.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/relays.h
@@ -0,0 +1,433 @@
+/**
+ * \file relays.h
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_RELAYS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_RELAYS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/pool_params/relay.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a set of pool relays.
+ */
+typedef struct cardano_relays_t cardano_relays_t;
+
+/**
+ * \brief Creates and initializes a new instance of a relays.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_relays_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] relays On successful initialization, this will point to a newly created
+ *             \ref cardano_relays_t object. This object represents a "strong reference"
+ *             to the relays, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the relays is no longer needed, the caller must release it
+ *             by calling \ref cardano_relays_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the relays was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_relays_t* relays = NULL;
+ *
+ * // Attempt to create a new relays
+ * cardano_error_t result = cardano_relays_new(&relays);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the relays
+ *
+ *   // Once done, ensure to clean up and release the relays
+ *   cardano_relays_unref(&relays);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_relays_new(cardano_relays_t** relays);
+
+/**
+ * \brief Creates a relays from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_relays_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a relays.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded relays data.
+ * \param[out] relays A pointer to a pointer of \ref cardano_relays_t that will be set to the address
+ *                        of the newly created relays object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the relays was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_relays_t object by calling
+ *       \ref cardano_relays_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_relays_t* relays = NULL;
+ *
+ * cardano_error_t result = cardano_relays_from_cbor(reader, &relays);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the relays
+ *
+ *   // Once done, ensure to clean up and release the relays
+ *   cardano_relays_unref(&relays);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode relays: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_relays_from_cbor(cardano_cbor_reader_t* reader, cardano_relays_t** relays);
+
+/**
+ * \brief Serializes a relays into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_relays_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] relays A constant pointer to the \ref cardano_relays_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p relays or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_relays_t* relays = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_relays_to_cbor(relays, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_relays_unref(&relays);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_relays_to_cbor(
+  const cardano_relays_t* relays,
+  cardano_cbor_writer_t*  writer);
+
+/**
+ * \brief Serializes a list of relays to CIP-116 JSON.
+ *
+ * The function writes a JSON array containing the serialized relays.
+ *
+ * \param[in]  relays  Pointer to a valid \ref cardano_relays_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p relays or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_relays_to_cip116_json(
+  const cardano_relays_t* relays,
+  cardano_json_writer_t*  writer);
+
+/**
+ * \brief Retrieves the length of a relays set.
+ *
+ * This function retrieves the number of relays in the provided \ref cardano_relays_t object.
+ *
+ * \param[in] relays A constant pointer to the \ref cardano_relays_t object whose length is to be retrieved.
+ *
+ * \return The number of relays in the relays. Return 0 if the relays is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_relays_t* relays = cardano_relays_new();
+ *
+ * // Populate relays with relays
+ *
+ * size_t length = cardano_relays_get_length(relays);
+ * printf("Length of the relays: %zu\n", length);
+ *
+ * // Clean up the relays object once done
+ * cardano_relays_unref(&relays);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_relays_get_length(const cardano_relays_t* relays);
+
+/**
+ * \brief Retrieves an relay from an relay set by index.
+ *
+ * This function retrieves the relay at the specified index from the provided \ref cardano_relays_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] relays A constant pointer to the \ref cardano_relays_t object from which
+ *                        the relay is to be retrieved.
+ * \param[in] index The index of the relay to retrieve from the relay set. Indexing starts at 0.
+ * \param[out] relay Pointer to a variable where the retrieved relay will be stored.
+ *                     This variable will point to the retrieved \ref cardano_relay_t object.
+ *                     The caller is responsible for managing the lifecycle of the relay by calling
+ *                     \ref cardano_relay_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the relay was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_relays_t* relays = cardano_relays_new();
+ *
+ * // Populate relays with relays
+ *
+ * cardano_relay_t* relay = NULL;
+ * cardano_error_t result = cardano_relays_get(relays, 2, &relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved relay
+ *   // Remember to unreference the relay once done if it's no longer needed
+ *   cardano_relay_unref(&relay);
+ * }
+ *
+ * // Clean up the relays object once done
+ * cardano_relays_unref(&relays);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_relays_get(const cardano_relays_t* relays, size_t index, cardano_relay_t** relay);
+
+/**
+ * \brief Adds an relay to a relay list.
+ *
+ * This function adds the specified relay to the provided \ref cardano_relays_t object.
+ *
+ * \param[in] relays A constant pointer to the \ref cardano_relays_t object to which
+ *                        the relay is to be added.
+ * \param[in] relay Pointer to the \ref cardano_relay_t object that is to be added to the relays.
+ *                    The relay will be referenced by the relays after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the relay was successfully added to the relays, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_relays_t* relays = cardano_relays_new();
+ *
+ * // Create and initialize a new plutus_data relay
+ * cardano_relay_t* relay = { ... };
+ *
+ * // Add the relay to the relays
+ * cardano_error_t result = cardano_relays_add(relays, relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the relays object once done
+ * cardano_relays_unref(&relays);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_relays_add(cardano_relays_t* relays, cardano_relay_t* relay);
+
+/**
+ * \brief Decrements the reference count of a relays object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_relays_t object
+ * by decreasing its reference count. When the reference count reaches zero, the relays is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] relays A pointer to the pointer of the relays object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_relays_t* relays = cardano_relays_new();
+ *
+ * // Perform operations with the relays...
+ *
+ * cardano_relays_unref(&relays);
+ * // At this point, relays is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_relays_unref, the pointer to the \ref cardano_relays_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_relays_unref(cardano_relays_t** relays);
+
+/**
+ * \brief Increases the reference count of the cardano_relays_t object.
+ *
+ * This function is used to manually increment the reference count of a relays
+ * object, indicating that another part of the code has taken relayship of it. This
+ * ensures the object remains allocated and valid until all relays have released their
+ * reference by calling \ref cardano_relays_unref.
+ *
+ * \param relays A pointer to the relays object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming relays is a previously created relays object
+ *
+ * cardano_relays_ref(relays);
+ *
+ * // Now relays can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_relays_ref there is a corresponding
+ * call to \ref cardano_relays_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_relays_ref(cardano_relays_t* relays);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_relays_t object.
+ *
+ * This function returns the number of active references to a relays object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_relays_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param relays A pointer to the relays object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified relays object. If the object
+ * is properly managed (i.e., every \ref cardano_relays_ref call is matched with a
+ * \ref cardano_relays_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming relays is a previously created relays object
+ *
+ * size_t ref_count = cardano_relays_refcount(relays);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_relays_refcount(const cardano_relays_t* relays);
+
+/**
+ * \brief Sets the last error message for a given relays object.
+ *
+ * Records an error message in the relays's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] relays A pointer to the \ref cardano_relays_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the relays's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_relays_set_last_error(cardano_relays_t* relays, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific relays.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_relays_set_last_error for the given
+ * relays. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] relays A pointer to the \ref cardano_relays_t instance whose last error
+ *                   message is to be retrieved. If the relays is NULL, the function
+ *                   returns a generic error message indicating the null relays.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified relays. If the relays is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_relays_set_last_error for the same relays, or until
+ *       the relays is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_relays_get_last_error(const cardano_relays_t* relays);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_relays_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_relays_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_relays_deep_clone(const cardano_relays_t* source, cardano_relays_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_RELAYS_H
diff --git a/vendor/include/cardano/pool_params/single_host_addr_relay.h b/vendor/include/cardano/pool_params/single_host_addr_relay.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/single_host_addr_relay.h
@@ -0,0 +1,604 @@
+/**
+ * \file single_host_addr_relay.h
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SINGLE_HOST_ADDR_RELAY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SINGLE_HOST_ADDR_RELAY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/pool_params/ipv4.h>
+#include <cardano/pool_params/ipv6.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This relay points to a single host via its ipv4/ipv6 address and a given port.
+ */
+typedef struct cardano_single_host_addr_relay_t cardano_single_host_addr_relay_t;
+
+/**
+ * \brief Creates and initializes a new instance of a single host address relay.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_single_host_addr_relay_t.
+ * It allows for the creation of a relay that points to a single host, which can be specified by
+ * either an IPv4 or IPv6 address, or both. The port can also be specified, though it is optional.
+ *
+ * \param[in] port A pointer to the port number on which the host is listening. If NULL, no port
+ *                 is set, and it should be handled accordingly by the consuming function.
+ * \param[in] ipv4 A pointer to an initialized \ref cardano_ipv4_t object representing the host's IPv4 address.
+ *                 If NULL, the IPv4 address is not set for the relay.
+ * \param[in] ipv6 A pointer to an initialized \ref cardano_ipv6_t object representing the host's IPv6 address.
+ *                 If NULL, the IPv6 address is not set for the relay.
+ * \param[out] single_host_addr_relay On successful initialization, this pointer will point to the newly created
+ *                                    \ref cardano_single_host_addr_relay_t object. This object represents a "strong reference"
+ *                                    to the relay, meaning it is fully initialized and ready for use.
+ *                                    The caller is responsible for managing the lifecycle of this object.
+ *                                    Specifically, once the relay is no longer needed, the caller must release it
+ *                                    by calling \ref cardano_single_host_addr_relay_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the single host address relay was successfully created, or an appropriate error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the single_host_addr_relay pointer
+ *         is NULL or other input validation errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint16_t port_number = 8080;
+ * cardano_ipv4_t* ipv4_address = ...; // Assume ipv4_address is already initialized
+ * cardano_ipv6_t* ipv6_address = ...; // Assume ipv6_address is already initialized
+ * cardano_single_host_addr_relay_t* relay = NULL;
+ *
+ * cardano_error_t result = cardano_single_host_addr_relay_new(&port_number, ipv4_address, ipv6_address, &relay);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the relay
+ *
+ *   // Once done, ensure to clean up and release the relay
+ *   cardano_single_host_addr_relay_unref(&relay);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the single host address relay.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_single_host_addr_relay_new(
+  const uint16_t*                    port,
+  cardano_ipv4_t*                    ipv4,
+  cardano_ipv6_t*                    ipv6,
+  cardano_single_host_addr_relay_t** single_host_addr_relay);
+
+/**
+ * \brief Creates a \ref cardano_single_host_addr_relay_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_single_host_addr_relay_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a single_host_addr_relay.
+ *
+ * A present port must be in the range 0 through 65535; larger CBOR integers are rejected.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] single_host_addr_relay A pointer to a pointer of \ref cardano_single_host_addr_relay_t that will be set to the address
+ *                        of the newly created single_host_addr_relay object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_single_host_addr_relay_t object by calling
+ *       \ref cardano_single_host_addr_relay_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_single_host_addr_relay_t* single_host_addr_relay = NULL;
+ *
+ * cardano_error_t result = cardano_single_host_addr_relay_from_cbor(reader, &single_host_addr_relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the single_host_addr_relay
+ *
+ *   // Once done, ensure to clean up and release the single_host_addr_relay
+ *   cardano_single_host_addr_relay_unref(&single_host_addr_relay);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode single_host_addr_relay: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_single_host_addr_relay_from_cbor(cardano_cbor_reader_t* reader, cardano_single_host_addr_relay_t** single_host_addr_relay);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_single_host_addr_relay_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] single_host_addr_relay A constant pointer to the \ref cardano_single_host_addr_relay_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p single_host_addr_relay or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_addr_relay_t* single_host_addr_relay = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_single_host_addr_relay_to_cbor(single_host_addr_relay, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_single_host_addr_relay_unref(&single_host_addr_relay);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_single_host_addr_relay_to_cbor(
+  const cardano_single_host_addr_relay_t* single_host_addr_relay,
+  cardano_cbor_writer_t*                  writer);
+
+/**
+ * \brief Serializes a single host address relay to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "port", "ipv4", "ipv6".
+ *
+ * \param[in]  relay   Pointer to a valid \ref cardano_single_host_addr_relay_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p relay or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_single_host_addr_relay_to_cip116_json(
+  const cardano_single_host_addr_relay_t* relay,
+  cardano_json_writer_t*                  writer);
+
+/**
+ * \brief Retrieves the port number for a single host address relay.
+ *
+ * This function retrieves the port number from a given \ref cardano_single_host_addr_relay_t object.
+ *
+ * \param[in] relay A constant pointer to an initialized \ref cardano_single_host_addr_relay_t object.
+ *
+ * \return A constant pointer to the port number of the relay. If the relay does not have a port set,
+ *         the function returns NULL. The returned pointer points to the internal state of the relay
+ *         object and should not be freed or modified by the caller.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the port number was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * single_host_addr_relay* relay = ...; // Assume relay is already initialized
+ * const uint16_t* port = cardano_single_host_addr_relay_get_port(relay);
+ *
+ * if (port != NULL)
+ * {
+ *   printf("Relay port: %lu\n", *port);
+ * }
+ * else
+ * {
+ *   printf("No port is set for this relay.\n");
+ * }
+ * \endcode
+ *
+ * \note The returned pointer points to the internal state of the relay object and should not be freed or modified by the caller.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint16_t* cardano_single_host_addr_relay_get_port(
+  const cardano_single_host_addr_relay_t* relay);
+
+/**
+ * \brief Sets the port number for a single host address relay.
+ *
+ * This function assigns a port number to a \ref cardano_single_host_addr_relay_t object. If the port
+ * pointer is NULL, the function will remove any existing port number, effectively unsetting it.
+ *
+ * \param[in] single_host_addr_relay A pointer to an initialized \ref cardano_single_host_addr_relay_t object.
+ * \param[in] port A pointer to a uint64_t that contains the new port number to be set. If the pointer is NULL,
+ *                 the port number is unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the port number was successfully set or unset. Returns an error code such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the single_host_addr_relay pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_addr_relay_t* relay = ...; // Assume relay is already initialized
+ * uint16_t new_port = 8080;
+ *
+ * cardano_error_t result = cardano_single_host_addr_relay_set_port(relay, &new_port);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Port number set to %lu.\n", new_port);
+ * }
+ * else
+ * {
+ *   printf("Failed to set the port number.\n");
+ * }
+ *
+ * // To unset the port number
+ * result = cardano_single_host_addr_relay_set_port(relay, NULL);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Port number has been unset.\n");
+ * }
+ * \endcode
+ *
+ * \note Passing a NULL for the port parameter will unset the port number for the relay.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_single_host_addr_relay_set_port(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  const uint16_t*                   port);
+
+/**
+ * \brief Retrieves the IPv4 address from a single host address relay.
+ *
+ * This function fetches the IPv4 address associated with a given \ref cardano_single_host_addr_relay_t object.
+ * The function returns a new reference to the IPv4 object, which must be managed by the caller.
+ *
+ * \param[in] single_host_addr_relay A constant pointer to an initialized \ref cardano_single_host_addr_relay_t object.
+ * \param[out] ipv4 On successful retrieval, this will point to the IPv4 address associated with the relay.
+ *                  The function increments the reference count on the IPv4 object before returning it,
+ *                  and the caller is responsible for releasing this reference when it is no longer needed
+ *                  by calling \ref cardano_ipv4_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the IPv4 address was successfully retrieved, or an error code such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_single_host_addr_relay_t* relay = ...; // Assume relay is already initialized
+ * cardano_ipv4_t* ipv4 = NULL;
+ *
+ * cardano_error_t result = cardano_single_host_addr_relay_get_ipv4(relay, &ipv4);
+ * if (result == CARDANO_SUCCESS && ipv4 != NULL)
+ * {
+ *   printf("IPv4 Address retrieved.\n");
+ *   // Use the ipv4 address
+ *
+ *   // Once done, ensure to clean up and release the ipv4 reference
+ *   cardano_ipv4_unref(&ipv4);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve IPv4 address or address not set.\n");
+ * }
+ * \endcode
+ *
+ * \note If the relay does not have an IPv4 address set, the output parameter ipv4 will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_single_host_addr_relay_get_ipv4(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  cardano_ipv4_t**                  ipv4);
+
+/**
+ * \brief Sets the IPv4 address for a single host address relay.
+ *
+ * This function assigns an IPv4 address to a \ref cardano_single_host_addr_relay_t object.
+ * If the relay already has an IPv4 address assigned, it will be replaced by the new one provided.
+ *
+ * \param[in,out] single_host_addr_relay A pointer to an initialized \ref cardano_single_host_addr_relay_t object to which the IPv4 address will be set.
+ * \param[in] ipv4 A pointer to an initialized \ref cardano_ipv4_t object representing the IPv4 address to be set. This function increases the reference count on the IPv4 object, and it is the caller's responsibility to manage the lifecycle of the passed ipv4 object, including releasing its reference when no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the IPv4 address was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input pointer to the relay or IPv4 address is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_addr_relay_t* relay = ...; // Assume relay is already initialized
+ * cardano_ipv4_t* ipv4 = ...; // Assume ipv4 is already initialized
+ *
+ * cardano_error_t result = cardano_single_host_addr_relay_set_ipv4(relay, ipv4);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("IPv4 Address successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set IPv4 address.\n");
+ * }
+ *
+ * // Ensure to manage the lifecycle of ipv4 if not used elsewhere
+ * cardano_ipv4_unref(&ipv4);
+ * \endcode
+ *
+ * \note This function increments the reference count of the ipv4 object passed. The caller must unreference
+ * the ipv4 object when it is no longer needed to prevent memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_single_host_addr_relay_set_ipv4(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  cardano_ipv4_t*                   ipv4);
+
+/**
+ * \brief Retrieves the IPv6 address from a single host address relay.
+ *
+ * This function fetches the IPv6 address associated with a given \ref cardano_single_host_addr_relay_t object.
+ * The function returns a new reference to the IPv6 object, which must be managed by the caller.
+ *
+ * \param[in] single_host_addr_relay A constant pointer to an initialized \ref cardano_single_host_addr_relay_t object.
+ * \param[out] ipv6 On successful retrieval, this will point to the IPv6 address associated with the relay.
+ *                  The function increments the reference count on the IPv6 object before returning it,
+ *                  and the caller is responsible for releasing this reference when it is no longer needed
+ *                  by calling \ref cardano_ipv6_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the IPv6 address was successfully retrieved, or an error code such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_single_host_addr_relay_t* relay = ...; // Assume relay is already initialized
+ * cardano_ipv6_t* ipv6 = NULL;
+ *
+ * cardano_error_t result = cardano_single_host_addr_relay_get_ipv6(relay, &ipv6);
+ * if (result == CARDANO_SUCCESS && ipv6 != NULL)
+ * {
+ *   printf("IPv6 Address retrieved.\n");
+ *   // Use the ipv6 address
+ *
+ *   // Once done, ensure to clean up and release the ipv6 reference
+ *   cardano_ipv6_unref(&ipv6);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve IPv6 address or address not set.\n");
+ * }
+ * \endcode
+ *
+ * \note If the relay does not have an IPv6 address set, the output parameter ipv6 will be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_single_host_addr_relay_get_ipv6(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  cardano_ipv6_t**                  ipv6);
+
+/**
+ * \brief Sets the IPv6 address for a single host address relay.
+ *
+ * This function assigns an IPv6 address to a \ref cardano_single_host_addr_relay_t object.
+ * If the relay already has an IPv6 address assigned, it will be replaced by the new one provided.
+ *
+ * \param[in,out] single_host_addr_relay A pointer to an initialized \ref cardano_single_host_addr_relay_t object to which the IPv6 address will be set.
+ * \param[in] ipv6 A pointer to an initialized \ref cardano_ipv6_t object representing the IPv6 address to be set. This function increases the reference count on the IPv6 object, and it is the caller's responsibility to manage the lifecycle of the passed ipv6 object, including releasing its reference when no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the IPv6 address was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input pointer to the relay or IPv6 address is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_addr_relay_t* relay = ...; // Assume relay is already initialized
+ * cardano_ipv6_t* ipv6 = ...; // Assume ipv6 is already initialized
+ *
+ * cardano_error_t result = cardano_single_host_addr_relay_set_ipv6(relay, ipv6);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("IPv6 Address successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set IPv6 address.\n");
+ * }
+ *
+ * // Ensure to manage the lifecycle of ipv6 if not used elsewhere
+ * cardano_ipv6_unref(&ipv6);
+ * \endcode
+ *
+ * \note This function increments the reference count of the ipv6 object passed. The caller must unreference
+ * the ipv6 object when it is no longer needed to prevent memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_single_host_addr_relay_set_ipv6(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  cardano_ipv6_t*                   ipv6);
+
+/**
+ * \brief Decrements the reference count of a cardano_single_host_addr_relay_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_single_host_addr_relay_t object
+ * by decreasing its reference count. When the reference count reaches zero, the single_host_addr_relay is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] single_host_addr_relay A pointer to the pointer of the single_host_addr_relay object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_addr_relay_t* single_host_addr_relay = cardano_single_host_addr_relay_new(major, minor);
+ *
+ * // Perform operations with the single_host_addr_relay...
+ *
+ * cardano_single_host_addr_relay_unref(&single_host_addr_relay);
+ * // At this point, single_host_addr_relay is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_single_host_addr_relay_unref, the pointer to the \ref cardano_single_host_addr_relay_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_single_host_addr_relay_unref(cardano_single_host_addr_relay_t** single_host_addr_relay);
+
+/**
+ * \brief Increases the reference count of the cardano_single_host_addr_relay_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_single_host_addr_relay_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_single_host_addr_relay_unref.
+ *
+ * \param single_host_addr_relay A pointer to the cardano_single_host_addr_relay_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming single_host_addr_relay is a previously created single_host_addr_relay object
+ *
+ * cardano_single_host_addr_relay_ref(single_host_addr_relay);
+ *
+ * // Now single_host_addr_relay can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_single_host_addr_relay_ref there is a corresponding
+ * call to \ref cardano_single_host_addr_relay_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_single_host_addr_relay_ref(cardano_single_host_addr_relay_t* single_host_addr_relay);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_single_host_addr_relay_t object.
+ *
+ * This function returns the number of active references to an cardano_single_host_addr_relay_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_single_host_addr_relay_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param single_host_addr_relay A pointer to the cardano_single_host_addr_relay_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_single_host_addr_relay_t object. If the object
+ * is properly managed (i.e., every \ref cardano_single_host_addr_relay_ref call is matched with a
+ * \ref cardano_single_host_addr_relay_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming single_host_addr_relay is a previously created single_host_addr_relay object
+ *
+ * size_t ref_count = cardano_single_host_addr_relay_refcount(single_host_addr_relay);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_single_host_addr_relay_refcount(const cardano_single_host_addr_relay_t* single_host_addr_relay);
+
+/**
+ * \brief Sets the last error message for a given cardano_single_host_addr_relay_t object.
+ *
+ * Records an error message in the single_host_addr_relay's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] single_host_addr_relay A pointer to the \ref cardano_single_host_addr_relay_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the single_host_addr_relay's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_single_host_addr_relay_set_last_error(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  const char*                       message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific single_host_addr_relay.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_single_host_addr_relay_set_last_error for the given
+ * single_host_addr_relay. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] single_host_addr_relay A pointer to the \ref cardano_single_host_addr_relay_t instance whose last error
+ *                   message is to be retrieved. If the single_host_addr_relay is NULL, the function
+ *                   returns a generic error message indicating the null single_host_addr_relay.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified single_host_addr_relay. If the single_host_addr_relay is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_single_host_addr_relay_set_last_error for the same single_host_addr_relay, or until
+ *       the single_host_addr_relay is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_single_host_addr_relay_get_last_error(
+  const cardano_single_host_addr_relay_t* single_host_addr_relay);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_single_host_addr_relay_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_single_host_addr_relay_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_single_host_addr_relay_deep_clone(const cardano_single_host_addr_relay_t* source, cardano_single_host_addr_relay_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SINGLE_HOST_ADDR_RELAY_H
diff --git a/vendor/include/cardano/pool_params/single_host_name_relay.h b/vendor/include/cardano/pool_params/single_host_name_relay.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/pool_params/single_host_name_relay.h
@@ -0,0 +1,523 @@
+/**
+ * \file single_host_name_relay.h
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SINGLE_HOST_NAME_RELAY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SINGLE_HOST_NAME_RELAY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief This relay points to a single host via a DNS (pointing to an A or AAAA DNS record) name and a given port.
+ */
+typedef struct cardano_single_host_name_relay_t cardano_single_host_name_relay_t;
+
+/**
+ * \brief Creates and initializes a new instance of a single host name relay.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_single_host_name_relay_t,
+ * representing a relay that points to a single host via its DNS name and an optional port number.
+ *
+ * \param[in] port A pointer to the port number for the relay. This can be NULL if the port is not specified.
+ * \param[in] dns A pointer to a character array containing the DNS name of the host.
+ * \param[in] str_size The length of the DNS name string, excluding the null terminator.
+ * \param[out] single_host_name_relay On successful initialization, this will point to the newly created
+ *                                    \ref cardano_single_host_name_relay_t object. The caller is responsible
+ *                                    for managing the lifecycle of this object. Specifically, once the relay
+ *                                    is no longer needed, the caller must release it by calling \ref cardano_single_host_name_relay_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the relay was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* dns_name = "relay.example.com";
+ * size_t dns_size = strlen(dns_name);
+ * uint16_t port = 3001;
+ * cardano_single_host_name_relay_t* relay = NULL;
+ *
+ * // Attempt to create a new single host name relay
+ * cardano_error_t result = cardano_single_host_name_relay_new(&port, dns_name, dns_size, &relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the relay
+ *
+ *   // Once done, ensure to clean up and release the relay
+ *   cardano_single_host_name_relay_unref(&relay);
+ * }
+ * else
+ * {
+ *   printf("Failed to create single host name relay.\n");
+ * }
+ * \endcode
+ *
+ * \note If the port is not specified, the \p port parameter can be set to NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_single_host_name_relay_new(
+  const uint16_t*                    port,
+  const char*                        dns,
+  size_t                             str_size,
+  cardano_single_host_name_relay_t** single_host_name_relay);
+
+/**
+ * \brief Creates a \ref cardano_single_host_name_relay_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_single_host_name_relay_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a single_host_name_relay.
+ *
+ * A present port must be in the range 0 through 65535; larger CBOR integers are rejected.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] single_host_name_relay A pointer to a pointer of \ref cardano_single_host_name_relay_t that will be set to the address
+ *                        of the newly created single_host_name_relay object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_single_host_name_relay_t object by calling
+ *       \ref cardano_single_host_name_relay_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_single_host_name_relay_t* single_host_name_relay = NULL;
+ *
+ * cardano_error_t result = cardano_single_host_name_relay_from_cbor(reader, &single_host_name_relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the single_host_name_relay
+ *
+ *   // Once done, ensure to clean up and release the single_host_name_relay
+ *   cardano_single_host_name_relay_unref(&single_host_name_relay);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode single_host_name_relay: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_single_host_name_relay_from_cbor(cardano_cbor_reader_t* reader, cardano_single_host_name_relay_t** single_host_name_relay);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_single_host_name_relay_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] single_host_name_relay A constant pointer to the \ref cardano_single_host_name_relay_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p single_host_name_relay or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_name_relay_t* single_host_name_relay = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_single_host_name_relay_to_cbor(single_host_name_relay, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_single_host_name_relay_unref(&single_host_name_relay);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_single_host_name_relay_to_cbor(
+  const cardano_single_host_name_relay_t* single_host_name_relay,
+  cardano_cbor_writer_t*                  writer);
+
+/**
+ * \brief Serializes a single host name relay to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "port", "dns_name".
+ *
+ * \param[in]  relay   Pointer to a valid \ref cardano_single_host_name_relay_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p relay or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_single_host_name_relay_to_cip116_json(
+  const cardano_single_host_name_relay_t* relay,
+  cardano_json_writer_t*                  writer);
+
+/**
+ * \brief Retrieves the port number for a single host name relay.
+ *
+ * This function retrieves the port number from a given \ref cardano_single_host_name_relay_t object.
+ *
+ * \param[in] relay A constant pointer to an initialized \ref cardano_single_host_name_relay_t object.
+ *
+ * \return A constant pointer to the port number of the relay. If the relay does not have a port set,
+ *         the function returns NULL. The returned pointer points to the internal state of the relay
+ *         object and should not be freed or modified by the caller.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the port number was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_name_relay_t* relay = ...; // Assume relay is already initialized
+ * const uint16_t* port = cardano_single_host_name_relay_get_port(relay);
+ *
+ * if (port != NULL)
+ * {
+ *   printf("Relay port: %lu\n", *port);
+ * }
+ * else
+ * {
+ *   printf("No port is set for this relay.\n");
+ * }
+ * \endcode
+ *
+ * \note The returned pointer points to the internal state of the relay object and should not be freed or modified by the caller.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint16_t* cardano_single_host_name_relay_get_port(
+  const cardano_single_host_name_relay_t* relay);
+
+/**
+ * \brief Sets the port number for a single host name relay.
+ *
+ * This function sets the port number for a given \ref cardano_single_host_name_relay_t object.
+ *
+ * \param[in] relay A pointer to an initialized \ref cardano_single_host_name_relay_t object.
+ * \param[in] port A pointer to the port number to be set for the relay. If \p port is NULL, the port will be unset for the relay.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the port number was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_name_relay_t* relay = ...; // Assume relay is already initialized
+ * uint16_t port = 8080;
+ *
+ * cardano_error_t result = cardano_single_host_name_relay_set_port(relay, &port);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Port number set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the port number.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_single_host_name_relay_set_port(
+  cardano_single_host_name_relay_t* relay,
+  const uint16_t*                   port);
+
+/**
+ * \brief Retrieves the size of the DNS name string of a \c cardano_single_host_name_relay_t object.
+ *
+ * This function returns the size in bytes of the DNS name string stored within a
+ * \ref cardano_single_host_name_relay_t object. This size includes the null-terminating character
+ * for the string, thus providing the actual length of the DNS name plus one.
+ *
+ * \param[in] single_host_name_relay A constant pointer to an initialized \ref cardano_single_host_name_relay_t object.
+ *
+ * \return The size in bytes of the DNS name string, including the null terminator.
+ *         If the input pointer is NULL, returns 0 to indicate an error or uninitialized relay object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_name_relay_t* relay = ...; // Assume relay is already initialized
+ * size_t dns_size = cardano_single_host_name_relay_get_dns_size(relay);
+ * printf("Size of the DNS name string: %zu bytes\n", dns_size);
+ * \endcode
+ *
+ * \note This function returns 0 if the \p single_host_name_relay pointer is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_single_host_name_relay_get_dns_size(
+  const cardano_single_host_name_relay_t* single_host_name_relay);
+
+/**
+ * \brief Retrieves the DNS name string from a \c cardano_single_host_name_relay_t object.
+ *
+ * This function provides access to the DNS name string contained within a \ref cardano_single_host_name_relay_t object.
+ * The string represents the domain name used for DNS-based relay discovery and connection in the Cardano network.
+ *
+ * \param[in] single_host_name_relay A constant pointer to an initialized \ref cardano_single_host_name_relay_t object.
+ *
+ * \return A constant pointer to a null-terminated string representing the DNS name.
+ *         If the input pointer is NULL, returns NULL to indicate an error or uninitialized relay object.
+ *         The returned string points to internal memory within the \c cardano_single_host_name_relay_t object and must not be modified
+ *         or freed by the caller. The memory will remain valid as long as the \c cardano_single_host_name_relay_t object is not
+ *         destroyed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_name_relay_t* relay = ...; // Assume relay is already initialized
+ * const char* dns_name = cardano_single_host_name_relay_get_dns(relay);
+ *
+ * if (dns_name != NULL)
+ * {
+ *   printf("DNS Name: %s\n", dns_name);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve DNS name.\n");
+ * }
+ * \endcode
+ *
+ * \note This function returns NULL if the \p single_host_name_relay pointer is NULL, indicating either an error or
+ *       an uninitialized state.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_single_host_name_relay_get_dns(
+  const cardano_single_host_name_relay_t* single_host_name_relay);
+
+/**
+ * \brief Sets the DNS name for a \c cardano_single_host_name_relay_t object.
+ *
+ * This function updates the DNS name in a \ref cardano_single_host_name_relay_t object with the provided DNS name string.
+ * The DNS name is used for DNS-based relay discovery and connection in the Cardano network. The function ensures the
+ * new DNS name is properly stored within the relay object, replacing any previous value.
+ *
+ * \param[in] dns A constant pointer to a character array containing the new DNS name in null-terminated string format.
+ * \param[in] dns_size The size of the DNS name string, excluding the null terminator.
+ * \param[out] single_host_name_relay A pointer to an initialized \ref cardano_single_host_name_relay_t object which will
+ *                                    receive the updated DNS name.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the DNS name
+ *         was successfully updated, or an appropriate error code indicating the failure reason, such as invalid format,
+ *         null pointers, or out of memory errors.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_name_relay_t* relay = ...; // Assume relay is already initialized
+ * const char* new_dns = "new.example.com";
+ * size_t dns_size = strlen(new_dns);
+ * cardano_error_t result = cardano_single_host_name_relay_set_dns(new_dns, dns_size, relay);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DNS name updated successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to update DNS name.\n");
+ * }
+ * \endcode
+ *
+ * \note This function does not take ownership of the dns string; the caller must ensure it remains valid for the duration
+ *       of the call and manages its memory appropriately.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_single_host_name_relay_set_dns(
+  const char*                       dns,
+  size_t                            dns_size,
+  cardano_single_host_name_relay_t* single_host_name_relay);
+
+/**
+ * \brief Decrements the reference count of a cardano_single_host_name_relay_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_single_host_name_relay_t object
+ * by decreasing its reference count. When the reference count reaches zero, the single_host_name_relay is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] single_host_name_relay A pointer to the pointer of the single_host_name_relay object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_single_host_name_relay_t* single_host_name_relay = cardano_single_host_name_relay_new(major, minor);
+ *
+ * // Perform operations with the single_host_name_relay...
+ *
+ * cardano_single_host_name_relay_unref(&single_host_name_relay);
+ * // At this point, single_host_name_relay is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_single_host_name_relay_unref, the pointer to the \ref cardano_single_host_name_relay_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_single_host_name_relay_unref(cardano_single_host_name_relay_t** single_host_name_relay);
+
+/**
+ * \brief Increases the reference count of the cardano_single_host_name_relay_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_single_host_name_relay_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_single_host_name_relay_unref.
+ *
+ * \param single_host_name_relay A pointer to the cardano_single_host_name_relay_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming single_host_name_relay is a previously created single_host_name_relay object
+ *
+ * cardano_single_host_name_relay_ref(single_host_name_relay);
+ *
+ * // Now single_host_name_relay can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_single_host_name_relay_ref there is a corresponding
+ * call to \ref cardano_single_host_name_relay_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_single_host_name_relay_ref(cardano_single_host_name_relay_t* single_host_name_relay);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_single_host_name_relay_t object.
+ *
+ * This function returns the number of active references to an cardano_single_host_name_relay_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_single_host_name_relay_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param single_host_name_relay A pointer to the cardano_single_host_name_relay_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_single_host_name_relay_t object. If the object
+ * is properly managed (i.e., every \ref cardano_single_host_name_relay_ref call is matched with a
+ * \ref cardano_single_host_name_relay_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming single_host_name_relay is a previously created single_host_name_relay object
+ *
+ * size_t ref_count = cardano_single_host_name_relay_refcount(single_host_name_relay);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_single_host_name_relay_refcount(const cardano_single_host_name_relay_t* single_host_name_relay);
+
+/**
+ * \brief Sets the last error message for a given cardano_single_host_name_relay_t object.
+ *
+ * Records an error message in the single_host_name_relay's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] single_host_name_relay A pointer to the \ref cardano_single_host_name_relay_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the single_host_name_relay's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_single_host_name_relay_set_last_error(
+  cardano_single_host_name_relay_t* single_host_name_relay,
+  const char*                       message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific single_host_name_relay.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_single_host_name_relay_set_last_error for the given
+ * single_host_name_relay. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] single_host_name_relay A pointer to the \ref cardano_single_host_name_relay_t instance whose last error
+ *                   message is to be retrieved. If the single_host_name_relay is NULL, the function
+ *                   returns a generic error message indicating the null single_host_name_relay.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified single_host_name_relay. If the single_host_name_relay is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_single_host_name_relay_set_last_error for the same single_host_name_relay, or until
+ *       the single_host_name_relay is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_single_host_name_relay_get_last_error(
+  const cardano_single_host_name_relay_t* single_host_name_relay);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_single_host_name_relay_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_single_host_name_relay_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_single_host_name_relay_deep_clone(const cardano_single_host_name_relay_t* source, cardano_single_host_name_relay_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SINGLE_HOST_NAME_RELAY_H
diff --git a/vendor/include/cardano/proposal_procedures/committee.h b/vendor/include/cardano/proposal_procedures/committee.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/committee.h
@@ -0,0 +1,654 @@
+/**
+ * \file committee.h
+ *
+ * \author angel.castillo
+ * \date   Aug 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMMITTEE_H
+#define COMMITTEE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/proposal_procedures/credential_set.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The constitutional committee represents a set of individuals or entities (each associated with a pair of Ed25519 credentials)
+ * that are collectively responsible for ensuring that the Constitution is respected.
+ *
+ * Though it cannot be enforced on-chain, the constitutional committee is only supposed to vote on the constitutionality
+ * of governance actions (which should thus ensure the long-term sustainability of the blockchain) and should be replaced
+ * (via the no confidence action) if they overstep this boundary.
+ */
+typedef struct cardano_committee_t cardano_committee_t;
+
+/**
+ * \brief Creates and initializes a new instance of a constitutional committee.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_committee_t object,
+ * which represents a constitutional committee responsible for overseeing the constitutionality of governance actions.
+ * The function requires a quorum threshold, represented as a \ref cardano_unit_interval_t object, defining the minimum
+ * percentage of committee members that must participate in a vote for it to be valid.
+ *
+ * \param[in] quorum_threshold A pointer to a \ref cardano_unit_interval_t object specifying the minimum percentage of committee members
+ *            required to participate in a vote for it to be valid.
+ * \param[out] committee On successful initialization, this will point to a newly created
+ *             \ref cardano_committee_t object. This object represents a "strong reference"
+ *             to the committee, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the committee is no longer needed, the caller must release it
+ *             by calling \ref cardano_committee_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the committee was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_unit_interval_t* quorum_threshold = ...; // Assume quorum_threshold is already initialized
+ * cardano_committee_t* committee = NULL;
+ * cardano_error_t result = cardano_committee_new(&quorum_threshold, &committee);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the committee
+ *   // Free resources when done
+ *   cardano_committee_unref(&committee);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the committee: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_committee_new(
+  cardano_unit_interval_t* quorum_threshold,
+  cardano_committee_t**    committee);
+
+/**
+ * \brief Creates a \ref cardano_committee_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_committee_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a committee.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] committee A pointer to a pointer of \ref cardano_committee_t that will be set to the address
+ *                        of the newly created committee object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_committee_t object by calling
+ *       \ref cardano_committee_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_committee_t* committee = NULL;
+ *
+ * cardano_error_t result = cardano_committee_from_cbor(reader, &committee);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the committee
+ *
+ *   // Once done, ensure to clean up and release the committee
+ *   cardano_committee_unref(&committee);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode committee: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_committee_from_cbor(cardano_cbor_reader_t* reader, cardano_committee_t** committee);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_committee_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] committee A constant pointer to the \ref cardano_committee_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p committee or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_t* committee = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_committee_to_cbor(committee, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_committee_unref(&committee);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_committee_to_cbor(
+  const cardano_committee_t* committee,
+  cardano_cbor_writer_t*     writer);
+
+/**
+ * \brief Sets the quorum threshold in the committee.
+ *
+ * This function updates the quorum threshold of a \ref cardano_committee_t object.
+ * The quorum threshold is a \ref cardano_unit_interval_t object representing the minimum percentage of committee
+ * members that must participate for a vote to be valid.
+ *
+ * \param[in,out] committee A pointer to an initialized \ref cardano_committee_t object to which the quorum threshold will be set.
+ * \param[in] quorum_threshold A pointer to an initialized \ref cardano_unit_interval_t object representing the new quorum threshold.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the quorum threshold was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_t* committee = ...; // Assume committee is already initialized
+ * cardano_unit_interval_t quorum_threshold = { .numerator = 60, .denominator = 100 }; // 60% quorum
+ *
+ * cardano_error_t result = cardano_committee_set_quorum_threshold(committee, &quorum_threshold);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The quorum threshold is now set for the committee
+ * }
+ * else
+ * {
+ *   printf("Failed to set the quorum threshold.\n");
+ * }
+ * // The committee needs to be managed and eventually unreferenced by the caller
+ * cardano_committee_unref(&committee);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_committee_set_quorum_threshold(cardano_committee_t* committee, cardano_unit_interval_t* quorum_threshold);
+
+/**
+ * \brief Gets the quorum threshold from a committee.
+ *
+ * This function retrieves the quorum threshold from a given \ref cardano_committee_t object. The quorum threshold
+ * is represented as a \ref cardano_unit_interval_t object which details the minimum percentage of committee members
+ * required to validate a vote.
+ *
+ * \param[in] committee A pointer to an initialized \ref cardano_committee_t object from which the quorum threshold is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_unit_interval_t object representing the quorum threshold.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_unit_interval_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_t* committee = ...; // Assume initialized
+ * cardano_unit_interval_t* quorum_threshold = cardano_committee_get_quorum_threshold(committee);
+ *
+ * if (quorum_threshold != NULL)
+ * {
+ *   printf("Quorum Threshold: %u/%u\n", quorum_threshold->numerator, quorum_threshold->denominator);
+ *   // Use the quorum threshold data
+ *
+ *   // Once done, ensure to clean up and release the quorum threshold
+ *   cardano_unit_interval_unref(&quorum_threshold);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t*
+cardano_committee_get_quorum_threshold(cardano_committee_t* committee);
+
+/**
+ * \brief Retrieves a set of credentials for all members of a committee.
+ *
+ * This function fetches all member credentials from a given \ref cardano_committee_t object.
+ * It returns a set of credentials, each representing a committee member. The function allocates memory
+ * for a \ref cardano_credential_set_t object, and the caller is responsible for releasing this resource
+ * using \ref cardano_credential_set_unref when it is no longer needed.
+ *
+ * \param[in] committee A pointer to an initialized \ref cardano_committee_t object.
+ * \param[out] credentials On successful execution, this will point to a newly created \ref cardano_credential_set_t object
+ *                         containing the credentials of all committee members. If the committee has no members,
+ *                         the returned list will be empty but not NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the list was
+ *         successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_t* committee = ...; // Assume committee is already initialized
+ * cardano_credential_set_t* credentials = NULL;
+ *
+ * cardano_error_t result = cardano_committee_members_keys(committee, &credentials);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the set of credentials
+ *   // ...
+ *
+ *   // Once done, ensure to clean up and release the list
+ *   cardano_credential_set_unref(&credentials);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve committee members' credentials: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_committee_members_keys(cardano_committee_t* committee, cardano_credential_set_t** credentials);
+
+/**
+ * \brief Adds a member to a committee.
+ *
+ * This function adds a new member to the specified \ref cardano_committee_t object using a given \ref cardano_credential_t object and epoch.
+ * The function assumes ownership of the credential reference passed to it, which means that the caller should not unreference the credential
+ * after calling this function unless it retains another reference for its own use.
+ *
+ * \param[in,out] committee A pointer to an initialized \ref cardano_committee_t object to which the member will be added.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the member's credential.
+ *                       This function increments the reference count of the credential, ensuring it remains valid for the duration
+ *                       of its association with the committee.
+ * \param[in] epoch The epoch number from which the member's participation in the committee becomes effective.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the member was
+ *         successfully added, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_t* committee = ...; // Assume committee is already initialized
+ * cardano_credential_t* credential = ...; // Assume credential is already initialized
+ * uint64_t epoch = 250; // Example epoch number
+ *
+ * cardano_error_t result = cardano_committee_add_member(committee, credential, epoch);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The member has been successfully added to the committee
+ * }
+ * else
+ * {
+ *   printf("Failed to add member to the committee: %s\n", cardano_error_to_string(result));
+ * }
+ * // Clean up resources, if no longer used elsewhere
+ * cardano_credential_unref(&credential);
+ * cardano_committee_unref(&committee);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_committee_add_member(cardano_committee_t* committee, cardano_credential_t* credential, uint64_t epoch);
+
+/**
+ * \brief Retrieves the epoch at which the term of a specific committee member will end.
+ *
+ * This function fetches the epoch number indicating when a committee member's term will end based on their credential.
+ * It searches the committee's records for the specified \ref cardano_credential_t object and returns the associated epoch.
+ * If the credential is not found, or if the member has no specified end term, the function returns 0.
+ *
+ * \param[in] committee A pointer to an initialized \ref cardano_committee_t object containing the committee data.
+ * \param[in] credential A constant pointer to an initialized \ref cardano_credential_t object representing the committee member's credential.
+ *
+ * \return The epoch number at which the committee member's term will end, or 0 if the member's credential is not found or no end term is set.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_t* committee = ...; // Assume committee is already initialized
+ * const cardano_credential_t* credential = ...; // Assume credential represents a committee member
+ *
+ * uint64_t ending_epoch = cardano_committee_get_member_epoch(committee, credential);
+ * if (ending_epoch > 0)
+ * {
+ *   printf("Member's term will end at epoch: %llu\n", ending_epoch);
+ * }
+ * else
+ * {
+ *   printf("Credential not found or no end term set for the committee member.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t
+cardano_committee_get_member_epoch(cardano_committee_t* committee, cardano_credential_t* credential);
+
+/**
+ * \brief Retrieves the credential at a specific index from the committee.
+ *
+ * This function retrieves the credential at the specified index from the committee.
+ *
+ * \param[in] committee Pointer to the committee object.
+ * \param[in] index The index of the credential to retrieve.
+ * \param[out] credential On successful retrieval, this will point to the credential
+ *                        at the specified index. The caller is responsible for managing the lifecycle
+ *                        of this object. Specifically, once the credential is no longer needed,
+ *                        the caller must release it by calling \ref cardano_credential_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the credential was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_t* committee = NULL;
+ * cardano_credential_t* credential = NULL;
+ * size_t index = 0; // Index of the credential to retrieve
+ *
+ * // Assume committee is initialized properly
+ *
+ * cardano_error_t result = cardano_committee_get_key_at(committee, index, &credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_committee_get_key_at(
+  const cardano_committee_t* committee,
+  size_t                     index,
+  cardano_credential_t**     credential);
+
+/**
+ * \brief Retrieves the committee member epoch at a specific index from the committee.
+ *
+ * This function retrieves the committee member epoch at the specified index from the committee.
+ *
+ * \param[in] committee Pointer to the committee object.
+ * \param[in] index The index of the committee member epoch to retrieve.
+ * \param[out] epoch On successful retrieval, this will point to the committee member epoch
+ *                    at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the committee member epoch was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_t* committee = NULL;
+ * uint64_t epoch = 0;
+ * size_t index = 0; // Index of the committee member epoch to retrieve
+ *
+ * // Assume committee is initialized properly
+ *
+ * cardano_error_t result = cardano_committee_get_value_at(committee, index, &epoch);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the epoch
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_committee_get_value_at(
+  const cardano_committee_t* committee,
+  size_t                     index,
+  uint64_t*                  epoch);
+
+/**
+ * \brief Retrieves the credential and committee member epoch at the specified index.
+ *
+ * This function retrieves the credential and committee member epoch from the proposed committee member epochs
+ * at the specified index.
+ *
+ * \param[in]  committee    Pointer to the proposed committee member epochs object.
+ * \param[in]  index             The index at which to retrieve the key-value pair.
+ * \param[out] credential On successful retrieval, this will point to the credential at the specified index.
+ *                            The caller is responsible for managing the lifecycle of this object and should release it using
+ *                            \ref cardano_credential_unref when it is no longer needed.
+ * \param[out] epoch On successful retrieval, this will point to the committee member epoch at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_t* committee = NULL;
+ * // Assume committee is initialized properly
+ *
+ * size_t index = 0;
+ * cardano_credential_t* credential = NULL;
+ * uint64_t epoch = 0;
+ *
+ * cardano_error_t result = cardano_committee_get_key_value_at(committee, index, &credential, &epoch);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (credential != NULL && epoch != NULL)
+ *   {
+ *     // Use the credential and committee member epoch
+ *   }
+ *   else
+ *   {
+ *     printf("Key-value pair not set at index %zu.\n", index);
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_committee_unref(&committee);
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_committee_get_key_value_at(
+  const cardano_committee_t* committee,
+  size_t                     index,
+  cardano_credential_t**     credential,
+  uint64_t*                  epoch);
+
+/**
+ * \brief Decrements the reference count of a cardano_committee_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_committee_t object
+ * by decreasing its reference count. When the reference count reaches zero, the committee is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] committee A pointer to the pointer of the committee object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_t* committee = cardano_committee_new(major, minor);
+ *
+ * // Perform operations with the committee...
+ *
+ * cardano_committee_unref(&committee);
+ * // At this point, committee is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_committee_unref, the pointer to the \ref cardano_committee_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_committee_unref(cardano_committee_t** committee);
+
+/**
+ * \brief Increases the reference count of the cardano_committee_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_committee_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_committee_unref.
+ *
+ * \param committee A pointer to the cardano_committee_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming committee is a previously created committee object
+ *
+ * cardano_committee_ref(committee);
+ *
+ * // Now committee can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_committee_ref there is a corresponding
+ * call to \ref cardano_committee_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_committee_ref(cardano_committee_t* committee);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_committee_t object.
+ *
+ * This function returns the number of active references to an cardano_committee_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_committee_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param committee A pointer to the cardano_committee_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_committee_t object. If the object
+ * is properly managed (i.e., every \ref cardano_committee_ref call is matched with a
+ * \ref cardano_committee_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming committee is a previously created committee object
+ *
+ * size_t ref_count = cardano_committee_refcount(committee);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_committee_refcount(const cardano_committee_t* committee);
+
+/**
+ * \brief Sets the last error message for a given cardano_committee_t object.
+ *
+ * Records an error message in the committee's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] committee A pointer to the \ref cardano_committee_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the committee's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_committee_set_last_error(
+  cardano_committee_t* committee,
+  const char*          message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific committee.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_committee_set_last_error for the given
+ * committee. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] committee A pointer to the \ref cardano_committee_t instance whose last error
+ *                   message is to be retrieved. If the committee is NULL, the function
+ *                   returns a generic error message indicating the null committee.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified committee. If the committee is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_committee_set_last_error for the same committee, or until
+ *       the committee is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_committee_get_last_error(
+  const cardano_committee_t* committee);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_committee_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_committee_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_committee_deep_clone(const cardano_committee_t* source, cardano_committee_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // COMMITTEE_H
diff --git a/vendor/include/cardano/proposal_procedures/committee_members_map.h b/vendor/include/cardano/proposal_procedures/committee_members_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/committee_members_map.h
@@ -0,0 +1,628 @@
+/**
+ * \file committee_members_map.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_COMMITTEE_MEMBERS_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_COMMITTEE_MEMBERS_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/proposal_procedures/credential_set.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of committee members to epoch.
+ */
+typedef struct cardano_committee_members_map_t cardano_committee_members_map_t;
+
+/**
+ * \brief Creates and initializes a new instance of a committee members map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_committee_members_map_t,
+ * representing a map structure. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] committee_members_map A pointer to a pointer to a \ref cardano_committee_members_map_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_committee_members_map_t
+ *                        object. This object represents a "strong reference" to the committee_members_map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the committee_members_map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_committee_members_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the committee_members_map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_members_map_t* committee_members_map = NULL;
+ *
+ * // Attempt to create a new committee_members_map
+ * cardano_error_t result = cardano_committee_members_map_new(&committee_members_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the committee_members_map
+ *
+ *   // Once done, ensure to clean up and release the committee_members_map
+ *   cardano_committee_members_map_unref(&committee_members_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_committee_members_map_new(cardano_committee_members_map_t** committee_members_map);
+
+/**
+ * \brief Creates a committee_members set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_committee_members_map_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a committee_members.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded committee_members data.
+ * \param[out] committee_members A pointer to a pointer of \ref cardano_committee_members_map_t that will be set to the address
+ *                        of the newly created committee_members object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the committee_members was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_committee_members_map_t object by calling
+ *       \ref cardano_committee_members_map_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_committee_members_map_t* committee_members = NULL;
+ *
+ * cardano_error_t result = cardano_committee_members_map_from_cbor(reader, &committee_members);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the committee_members
+ *
+ *   // Once done, ensure to clean up and release the committee_members
+ *   cardano_committee_members_map_unref(&committee_members);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode committee_members: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_committee_members_map_from_cbor(cardano_cbor_reader_t* reader, cardano_committee_members_map_t** committee_members);
+
+/**
+ * \brief Serializes a committee_members into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_committee_members_map_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] committee_members A constant pointer to the \ref cardano_committee_members_map_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p committee_members or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_members_map_t* committee_members = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_committee_members_map_to_cbor(committee_members, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_committee_members_map_unref(&committee_members);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_committee_members_map_to_cbor(
+  const cardano_committee_members_map_t* committee_members,
+  cardano_cbor_writer_t*                 writer);
+
+/**
+ * \brief Serializes a committee members map to a CIP-116 JSON array.
+ *
+ * This function serializes a map of [Credential -> Epoch] into
+ * a JSON array of key-value objects:
+ * [ { "key": { ...Credential... }, "value": "<uint64_string>" }, ... ]
+ *
+ * \param[in]  map     Pointer to a valid \ref cardano_committee_members_map_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p map or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_committee_members_map_to_cip116_json(
+  const cardano_committee_members_map_t* map,
+  cardano_json_writer_t*                 writer);
+
+/**
+ * \brief Retrieves the length of the committee_members_map.
+ *
+ * This function returns the number of key-value pairs contained in the specified committee_members_map.
+ *
+ * \param[in] committee_members_map A constant pointer to the \ref cardano_committee_members_map_t object for which
+ *                       the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the committee_members_map. Returns 0 if the committee_members_map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_members_map_t* committee_members_map = cardano_committee_members_map_new();
+ *
+ * // Populate the committee_members_map with key-value pairs
+ *
+ * size_t length = cardano_committee_members_map_get_length(committee_members_map);
+ * printf("The length of the committee_members_map is: %zu\n", length);
+ *
+ * cardano_committee_members_map_unref(&committee_members_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_committee_members_map_get_length(const cardano_committee_members_map_t* committee_members_map);
+
+/**
+ * \brief Retrieves the value associated with a given key in the committee members map.
+ *
+ * This function retrieves the value associated with the specified key in the provided committee members map.
+ * It returns the value through the output parameter `element`. If the key is not found in the committee members map,
+ * the output parameter `element` will be set to NULL.
+ *
+ * \param[in] committee_members_map A constant pointer to the \ref cardano_committee_members_map_t object from which
+ *                       the value is to be retrieved.
+ * \param[in] key The key whose associated value is to be retrieved from the committee_members_map.
+ * \param[out] element A pointer to a variable where the retrieved value will be stored. If the key
+ *                     is found in the committee members map, this variable will be set to the associated value.
+ *                     If the key is not found, this variable will be set to NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value associated with the key was successfully retrieved, or
+ *         an appropriate error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_members_map_t* committee_members_map = cardano_committee_members_map_new();
+ *
+ * // Populate the committee_members_map with key-value pairs
+ *
+ * cardano_credential_t* key = ...; // Create a credential object representing the key
+ * uint64_t value = 0;
+ * cardano_error_t result = cardano_committee_members_map_get(committee_members_map, key, &value);
+ *
+ * if (result == CARDANO_SUCCESS && value != NULL)
+ * {
+ *   // Use the retrieved value
+ *   // ...
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_credential_unref(&key); // Clean up the key resource
+ * cardano_committee_members_map_unref(&committee_members_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_committee_members_map_get(cardano_committee_members_map_t* committee_members_map, cardano_credential_t* key, uint64_t* element);
+
+/**
+ * \brief Inserts a key-value pair into the committee members map.
+ *
+ * This function inserts the specified key-value pair into the provided committee members map.
+ *
+ * \param[in] committee_members_map A constant pointer to the \ref cardano_committee_members_map_t object where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The key to be inserted into the committee members map. The caller is responsible for managing
+ *                the lifecycle of the key object.
+ * \param[in] value The value to be associated with the key and inserted into the committee_members_map.
+ *                  The caller is responsible for managing the lifecycle of the value object.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_members_map_t* committee_members_map = cardano_committee_members_map_new();
+ *
+ * // Create key and value objects
+ * cardano_credential_t* key = ...;
+ * uint64_t value = 0;
+ *
+ * // Insert the key-value pair into the committee_members_map
+ * cardano_error_t result = cardano_committee_members_map_insert(committee_members_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value objects
+ * cardano_credential_unref(&key);
+ *
+ * cardano_committee_members_map_unref(&committee_members_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_committee_members_map_insert(cardano_committee_members_map_t* committee_members_map, cardano_credential_t* key, uint64_t value);
+
+/**
+ * \brief Retrieves the keys from the committee members map.
+ *
+ * This function retrieves all the keys from the provided committee members map and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_credential_set_t when it is no longer needed.
+ *
+ * \param[in] committee_members_map A constant pointer to the \ref cardano_committee_members_map_t object from which
+ *                       the keys are to be retrieved.
+ * \param[out] keys A pointer to a variable where the retrieved keys will be stored as a list.
+ *                  If successful, this variable will be set to point to the list of keys.
+ *                  The caller is responsible for managing the lifecycle of this list.
+ *                  It must be released by calling \ref cardano_credential_set_t when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the keys were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_members_map_t* committee_members_map = cardano_committee_members_map_new();
+ *
+ * // Populate the committee_members_map with key-value pairs
+ *
+ * cardano_credential_set_t* keys = NULL;
+ * cardano_error_t result = cardano_committee_members_map_get_keys(committee_members_map, &keys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of keys
+ *   // Keys must also be freed if retrieved from the list
+ *
+ *   // Once done, ensure to clean up and release the keys list
+ *   cardano_credential_list_unref(&keys);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_committee_members_map_unref(&committee_members_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_committee_members_map_get_keys(cardano_committee_members_map_t* committee_members_map, cardano_credential_set_t** keys);
+
+/**
+ * \brief Retrieves the credential at a specific index from the committee_members map.
+ *
+ * This function retrieves the credential at the specified index from the committee members map.
+ *
+ * \param[in] committee_members_map Pointer to the committee members map object.
+ * \param[in] index The index of the credential to retrieve.
+ * \param[out] credential On successful retrieval, this will point to the credential
+ *                            at the specified index. The caller is responsible for managing the lifecycle
+ *                            of this object. Specifically, once the credential is no longer needed,
+ *                            the caller must release it by calling \ref cardano_credential_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the credential was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_members_map_t* committee_members_map = NULL;
+ * cardano_credential_t* credential = NULL;
+ * size_t index = 0; // Index of the credential to retrieve
+ *
+ * // Assume committee_members_map is initialized properly
+ *
+ * cardano_error_t result = cardano_committee_members_map_get_key_at(committee_members_map, index, &credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_committee_members_map_get_key_at(
+  const cardano_committee_members_map_t* committee_members_map,
+  size_t                                 index,
+  cardano_credential_t**                 credential);
+
+/**
+ * \brief Retrieves the committee member epoch at a specific index from the committee members map.
+ *
+ * This function retrieves the committee member epoch at the specified index from the committee_members map.
+ *
+ * \param[in] committee_members_map Pointer to the committee members map object.
+ * \param[in] index The index of the committee member epoch to retrieve.
+ * \param[out] epoch On successful retrieval, this will point to the committee member epoch
+ *                    at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the committee member epoch was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_members_map_t* committee_members_map = NULL;
+ * uint64_t epoch = 0;
+ * size_t index = 0; // Index of the committee member epoch to retrieve
+ *
+ * // Assume committee_members_map is initialized properly
+ *
+ * cardano_error_t result = cardano_committee_members_map_get_value_at(committee_members_map, index, &epoch);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the epoch
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_committee_members_map_get_value_at(
+  const cardano_committee_members_map_t* committee_members_map,
+  size_t                                 index,
+  uint64_t*                              epoch);
+
+/**
+ * \brief Retrieves the credential and committee member epoch at the specified index.
+ *
+ * This function retrieves the credential and committee member epoch from the proposed committee member epochs
+ * at the specified index.
+ *
+ * \param[in]  committee_members_map    Pointer to the proposed committee member epochs object.
+ * \param[in]  index             The index at which to retrieve the key-value pair.
+ * \param[out] credential On successful retrieval, this will point to the credential at the specified index.
+ *                            The caller is responsible for managing the lifecycle of this object and should release it using
+ *                            \ref cardano_credential_unref when it is no longer needed.
+ * \param[out] epoch On successful retrieval, this will point to the committee member epoch at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_members_map_t* committee_members_map = NULL;
+ * // Assume committee_members_map is initialized properly
+ *
+ * size_t index = 0;
+ * cardano_credential_t* credential = NULL;
+ * uint64_t epoch = 0;
+ *
+ * cardano_error_t result = cardano_committee_members_map_get_key_value_at(committee_members_map, index, &credential, &epoch);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (credential != NULL && epoch != NULL)
+ *   {
+ *     // Use the credential and committee member epoch
+ *   }
+ *   else
+ *   {
+ *     printf("Key-value pair not set at index %zu.\n", index);
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_committee_members_map_unref(&committee_members_map);
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_committee_members_map_get_key_value_at(
+  const cardano_committee_members_map_t* committee_members_map,
+  size_t                                 index,
+  cardano_credential_t**                 credential,
+  uint64_t*                              epoch);
+
+/**
+ * \brief Decrements the reference count of a committee_members_map object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_committee_members_map_t object
+ * by decreasing its reference count. When the reference count reaches zero, the committee_members_map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] committee_members_map A pointer to the pointer of the committee_members_map object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_committee_members_map_t* committee_members_map = cardano_committee_members_map_new();
+ *
+ * // Perform operations with the committee_members_map...
+ *
+ * cardano_committee_members_map_unref(&committee_members_map);
+ * // At this point, committee_members_map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_committee_members_map_unref, the pointer to the \ref cardano_committee_members_map_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_committee_members_map_unref(cardano_committee_members_map_t** committee_members_map);
+
+/**
+ * \brief Increases the reference count of the cardano_committee_members_map_t object.
+ *
+ * This function is used to manually increment the reference count of a committee_members_map
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_committee_members_map_unref.
+ *
+ * \param committee_members_map A pointer to the committee_members_map object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming committee_members_map is a previously created committee_members_map object
+ *
+ * cardano_committee_members_map_ref(committee_members_map);
+ *
+ * // Now committee_members_map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_committee_members_map_ref there is a corresponding
+ * call to \ref cardano_committee_members_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_committee_members_map_ref(cardano_committee_members_map_t* committee_members_map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_committee_members_map_t object.
+ *
+ * This function returns the number of active references to a committee_members_map object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_committee_members_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param committee_members_map A pointer to the committee_members_map object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified committee_members_map object. If the object
+ * is properly managed (i.e., every \ref cardano_committee_members_map_ref call is matched with a
+ * \ref cardano_committee_members_map_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming committee_members_map is a previously created committee_members_map object
+ *
+ * size_t ref_count = cardano_committee_members_map_refcount(committee_members_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_committee_members_map_refcount(const cardano_committee_members_map_t* committee_members_map);
+
+/**
+ * \brief Sets the last error message for a given committee_members_map object.
+ *
+ * Records an error message in the committee_members_map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] committee_members_map A pointer to the \ref cardano_committee_members_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the committee_members_map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_committee_members_map_set_last_error(cardano_committee_members_map_t* committee_members_map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific committee_members_map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_committee_members_map_set_last_error for the given
+ * committee_members_map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] committee_members_map A pointer to the \ref cardano_committee_members_map_t instance whose last error
+ *                   message is to be retrieved. If the committee_members_map is NULL, the function
+ *                   returns a generic error message indicating the null committee_members_map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified committee_members_map. If the committee_members_map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_committee_members_map_set_last_error for the same committee_members_map, or until
+ *       the committee_members_map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_committee_members_map_get_last_error(const cardano_committee_members_map_t* committee_members_map);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_committee_members_map_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_committee_members_map_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_committee_members_map_deep_clone(const cardano_committee_members_map_t* source, cardano_committee_members_map_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_COMMITTEE_MEMBERS_MAP_H
diff --git a/vendor/include/cardano/proposal_procedures/constitution.h b/vendor/include/cardano/proposal_procedures/constitution.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/constitution.h
@@ -0,0 +1,499 @@
+/**
+ * \file constitution.h
+ *
+ * \author angel.castillo
+ * \date   Aug 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CONSTITUTION_H
+#define CONSTITUTION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/anchor.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Cardano Constitution is a text document that defines Cardano's shared values and guiding principles.
+ * At this stage, the Constitution is an informational document that unambiguously captures the core values
+ * of Cardano and acts to ensure its long-term sustainability. At a later stage, we can imagine the Constitution
+ * perhaps evolving into a smart-contract based set of rules that drives the entire governance framework.
+ *
+ * For now, however, the Constitution will remain an off-chain document whose hash digest value will be recorded
+ * on-chain.
+ */
+typedef struct cardano_constitution_t cardano_constitution_t;
+
+/**
+ * \brief Creates and initializes a new instance of the Cardano Constitution.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_constitution_t object,
+ * which represents the Cardano Constitution, a guiding document that defines Cardano's shared values and principles.
+ * It ensures the long-term sustainability of the Cardano ecosystem by capturing these core values in a form
+ * that is potentially verifiable on-chain through its hash.
+ *
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object that links to the off-chain content of the constitution.
+ * \param[in] script_hash An optional pointer to a \ref cardano_blake2b_hash_t object representing the hash of the constitution's script.
+ *                        This parameter can be NULL if no hash is to be associated.
+ * \param[out] constitution On successful initialization, this will point to a newly created
+ *             \ref cardano_constitution_t object. This object represents a "strong reference"
+ *             to the constitution, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the constitution is no longer needed, the caller must release it
+ *             by calling \ref cardano_constitution_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the constitution was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Assume anchor is already initialized
+ * cardano_blake2b_hash_t* script_hash = cardano_blake2b_hash_new(...); // Optionally initialized
+ * cardano_constitution_t* constitution = NULL;
+ * cardano_error_t result = cardano_constitution_new(anchor, script_hash, &constitution);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the constitution
+ *   // Free resources when done
+ *   cardano_constitution_unref(&constitution);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the constitution: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup the anchor and optionally the script hash
+ * cardano_anchor_unref(&anchor);
+ *
+ * if (script_hash)
+ * {
+ *   cardano_blake2b_hash_unref(&script_hash);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_constitution_new(
+  cardano_anchor_t*        anchor,
+  cardano_blake2b_hash_t*  script_hash,
+  cardano_constitution_t** constitution);
+
+/**
+ * \brief Creates a \ref cardano_constitution_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_constitution_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a constitution.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] constitution A pointer to a pointer of \ref cardano_constitution_t that will be set to the address
+ *                        of the newly created constitution object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_constitution_t object by calling
+ *       \ref cardano_constitution_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_constitution_t* constitution = NULL;
+ *
+ * cardano_error_t result = cardano_constitution_from_cbor(reader, &constitution);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the constitution
+ *
+ *   // Once done, ensure to clean up and release the constitution
+ *   cardano_constitution_unref(&constitution);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode constitution: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_constitution_from_cbor(cardano_cbor_reader_t* reader, cardano_constitution_t** constitution);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_constitution_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] constitution A constant pointer to the \ref cardano_constitution_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p constitution or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constitution_t* constitution = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_constitution_to_cbor(constitution, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_constitution_unref(&constitution);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_constitution_to_cbor(
+  const cardano_constitution_t* constitution,
+  cardano_cbor_writer_t*        writer);
+
+/**
+ * \brief Serializes a constitution object to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "anchor", then "script_hash" (if present).
+ *
+ * \param[in]  constitution Pointer to a valid \ref cardano_constitution_t.
+ * \param[in]  writer       Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p constitution or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_constitution_to_cip116_json(
+  const cardano_constitution_t* constitution,
+  cardano_json_writer_t*        writer);
+
+/**
+ * \brief Sets the anchor in the constitution.
+ *
+ * This function updates the anchor of a \ref cardano_constitution_t object. The anchor is used to link to the off-chain content of the constitution.
+ *
+ * \param[in,out] constitution A pointer to an initialized \ref cardano_constitution_t object to which the anchor will be set.
+ * \param[in] anchor A pointer to an initialized \ref cardano_anchor_t object representing the new anchor.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the anchor was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constitution_t* constitution = ...; // Assume constitution is already initialized
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Assume anchor is already initialized
+ *
+ * cardano_error_t result = cardano_constitution_set_anchor(constitution, anchor);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The anchor is now set for the constitution
+ * }
+ * else
+ * {
+ *   printf("Failed to set the anchor.\n");
+ * }
+ * // Clean up the constitution and anchor after use
+ * cardano_constitution_unref(&constitution);
+ * cardano_anchor_unref(&anchor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_constitution_set_anchor(cardano_constitution_t* constitution, cardano_anchor_t* anchor);
+
+/**
+ * \brief Gets the anchor from a constitution.
+ *
+ * This function retrieves the anchor from a given \ref cardano_constitution_t object. The anchor links to the off-chain content of the constitution.
+ *
+ * \param[in] constitution A pointer to an initialized \ref cardano_constitution_t object from which the anchor is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_anchor_t object representing the anchor. This will be a new reference,
+ *         and the caller is responsible for releasing it with \ref cardano_anchor_unref when it is no longer needed.
+ *         If the constitution does not have an anchor set, NULL is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constitution_t* constitution = ...; // Assume initialized
+ * cardano_anchor_t* anchor = cardano_constitution_get_anchor(constitution);
+ *
+ * if (anchor != NULL)
+ * {
+ *   // Use the anchor
+ *
+ *   // Once done, ensure to clean up and release the anchor
+ *   cardano_anchor_unref(&anchor);
+ * }
+ * else
+ * {
+ *   printf("ERROR: No anchor set for this constitution.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_anchor_t*
+cardano_constitution_get_anchor(cardano_constitution_t* constitution);
+
+/**
+ * \brief Sets the script hash in the constitution.
+ *
+ * This function updates the script hash of a \ref cardano_constitution_t object.
+ * The script hash is a \ref cardano_blake2b_hash_t object representing the hash of the off-chain constitution content.
+ *
+ * \param[in,out] constitution A pointer to an initialized \ref cardano_constitution_t object to which the script hash will be set.
+ * \param[in] script_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the new script hash. This parameter
+ *            can be NULL if the script hash is to be unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the script hash was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         constitution pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constitution_t* constitution = ...; // Assume constitution is already initialized
+ * cardano_blake2b_hash_t* script_hash = cardano_blake2b_hash_new(...); // Assume script_hash is initialized
+ *
+ * cardano_error_t result = cardano_constitution_set_script_hash(constitution, script_hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The script hash is now set for the constitution
+ * }
+ * else
+ * {
+ *   printf("Failed to set the script hash.\n");
+ * }
+ *
+ * // Free resources when done
+ * cardano_blake2b_hash_unref(script_hash);
+ * cardano_constitution_unref(&constitution);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_constitution_set_script_hash(cardano_constitution_t* constitution, cardano_blake2b_hash_t* script_hash);
+
+/**
+ * \brief Retrieves the script hash from a constitution.
+ *
+ * This function retrieves the script hash from a given \ref cardano_constitution_t object. The script hash
+ * is represented as a \ref cardano_blake2b_hash_t object.
+ *
+ * \param[in] constitution A pointer to an initialized \ref cardano_constitution_t object from which the script hash is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_blake2b_hash_t object representing the script hash.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_blake2b_hash_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constitution_t* constitution = ...; // Assume initialized
+ * cardano_blake2b_hash_t* script_hash = cardano_constitution_get_script_hash(constitution);
+ *
+ * if (script_hash != NULL)
+ * {
+ *   printf("Script Hash: %s\n", cardano_blake2b_hash_to_string(script_hash));
+ *   // Use the script hash data
+ *
+ *   // Once done, ensure to clean up and release the script hash
+ *   cardano_blake2b_hash_unref(&script_hash);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t*
+cardano_constitution_get_script_hash(cardano_constitution_t* constitution);
+
+/**
+ * \brief Decrements the reference count of a cardano_constitution_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_constitution_t object
+ * by decreasing its reference count. When the reference count reaches zero, the constitution is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] constitution A pointer to the pointer of the constitution object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constitution_t* constitution = cardano_constitution_new(major, minor);
+ *
+ * // Perform operations with the constitution...
+ *
+ * cardano_constitution_unref(&constitution);
+ * // At this point, constitution is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_constitution_unref, the pointer to the \ref cardano_constitution_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_constitution_unref(cardano_constitution_t** constitution);
+
+/**
+ * \brief Increases the reference count of the cardano_constitution_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_constitution_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_constitution_unref.
+ *
+ * \param constitution A pointer to the cardano_constitution_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming constitution is a previously created constitution object
+ *
+ * cardano_constitution_ref(constitution);
+ *
+ * // Now constitution can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_constitution_ref there is a corresponding
+ * call to \ref cardano_constitution_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_constitution_ref(cardano_constitution_t* constitution);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_constitution_t object.
+ *
+ * This function returns the number of active references to an cardano_constitution_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_constitution_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param constitution A pointer to the cardano_constitution_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_constitution_t object. If the object
+ * is properly managed (i.e., every \ref cardano_constitution_ref call is matched with a
+ * \ref cardano_constitution_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming constitution is a previously created constitution object
+ *
+ * size_t ref_count = cardano_constitution_refcount(constitution);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_constitution_refcount(const cardano_constitution_t* constitution);
+
+/**
+ * \brief Sets the last error message for a given cardano_constitution_t object.
+ *
+ * Records an error message in the constitution's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] constitution A pointer to the \ref cardano_constitution_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the constitution's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_constitution_set_last_error(
+  cardano_constitution_t* constitution,
+  const char*             message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific constitution.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_constitution_set_last_error for the given
+ * constitution. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] constitution A pointer to the \ref cardano_constitution_t instance whose last error
+ *                   message is to be retrieved. If the constitution is NULL, the function
+ *                   returns a generic error message indicating the null constitution.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified constitution. If the constitution is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_constitution_set_last_error for the same constitution, or until
+ *       the constitution is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_constitution_get_last_error(
+  const cardano_constitution_t* constitution);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_constitution_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_constitution_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_constitution_deep_clone(const cardano_constitution_t* source, cardano_constitution_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // CONSTITUTION_H
diff --git a/vendor/include/cardano/proposal_procedures/credential_set.h b/vendor/include/cardano/proposal_procedures/credential_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/credential_set.h
@@ -0,0 +1,438 @@
+/**
+ * \file credential_set.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CREDENTIAL_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CREDENTIAL_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a credential used in the Cardano blockchain, which can be either a key hash or a script hash.
+ */
+typedef struct cardano_credential_t cardano_credential_t;
+
+/**
+ * \brief Represents a set of credentials.
+ */
+typedef struct cardano_credential_set_t cardano_credential_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a credential_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_credential_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] credential_set On successful initialization, this will point to a newly created
+ *             \ref cardano_credential_set_t object. This object represents a "strong reference"
+ *             to the credential_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the credential_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_credential_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the credential_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_set_t* credential_set = NULL;
+ *
+ * // Attempt to create a new credential_set
+ * cardano_error_t result = cardano_credential_set_new(&credential_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the credential_set
+ *
+ *   // Once done, ensure to clean up and release the credential_set
+ *   cardano_credential_set_unref(&credential_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_credential_set_new(cardano_credential_set_t** credential_set);
+
+/**
+ * \brief Creates a credential set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_credential_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a credential.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded credential data.
+ * \param[out] credentials A pointer to a pointer of \ref cardano_credential_set_t that will be set to the address
+ *                        of the newly created credential object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the credential was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_credential_set_t object by calling
+ *       \ref cardano_credential_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_credential_set_t* credential = NULL;
+ *
+ * cardano_error_t result = cardano_credential_set_from_cbor(reader, &credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_set_unref(&credential);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode credential: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_credential_set_from_cbor(cardano_cbor_reader_t* reader, cardano_credential_set_t** credentials);
+
+/**
+ * \brief Serializes a credential into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_credential_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] credentials A constant pointer to the \ref cardano_credential_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p credential or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_set_t* credential = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_credential_set_to_cbor(credential, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_credential_set_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_credential_set_to_cbor(
+  const cardano_credential_set_t* credentials,
+  cardano_cbor_writer_t*          writer);
+
+/**
+ * \brief Serializes a set of credentials to a CIP-116 JSON array.
+ *
+ * This function iterates over the set and serializes each \ref cardano_credential_t
+ * into a JSON array.
+ *
+ * \param[in]  set     Pointer to a valid \ref cardano_credential_set_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p set or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_credential_set_to_cip116_json(
+  const cardano_credential_set_t* set,
+  cardano_json_writer_t*          writer);
+
+/**
+ * \brief Retrieves the length of a credential list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_credential_set_t object.
+ *
+ * \param[in] credential_set A constant pointer to the \ref cardano_credential_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the credential_set. Return 0 if the credential_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_set_t* credential_set = cardano_credential_set_new();
+ *
+ * // Populate credential_set with elements
+ *
+ * size_t length = cardano_credential_set_get_length(credential_set);
+ * printf("Length of the credential_set: %zu\n", length);
+ *
+ * // Clean up the credential_set object once done
+ * cardano_credential_set_unref(&credential_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_credential_set_get_length(const cardano_credential_set_t* credential_set);
+
+/**
+ * \brief Retrieves an element from a credential list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_credential_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] credential_set A constant pointer to the \ref cardano_credential_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the credential list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_credential_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_credential_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_set_t* credential_set = cardano_credential_set_new();
+ *
+ * // Populate credential_set with elements
+ *
+ * cardano_credential_t* element = NULL;
+ * cardano_error_t result = cardano_credential_set_get(credential_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_credential_unref(&element);
+ * }
+ *
+ * // Clean up the credential_set object once done
+ * cardano_credential_set_unref(&credential_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_credential_set_get(const cardano_credential_set_t* credential_set, size_t index, cardano_credential_t** element);
+
+/**
+ * \brief Adds an element to a credential list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_credential_set_t object.
+ *
+ * \param[in] credential_set A constant pointer to the \ref cardano_credential_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_credential_t object that is to be added to the credential_set.
+ *                    The element will be referenced by the credential_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the credential_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_set_t* credential_set = cardano_credential_set_new();
+ *
+ * // Create and initialize a new credential element
+ * cardano_credential_t* element = { ... };
+ *
+ * // Add the element to the credential_set
+ * cardano_error_t result = cardano_credential_set_add(credential_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the credential_set object once done
+ * cardano_credential_set_unref(&credential_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_credential_set_add(cardano_credential_set_t* credential_set, cardano_credential_t* element);
+
+/**
+ * \brief Decrements the reference count of a credential_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_credential_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the credential_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] credential_set A pointer to the pointer of the credential_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_set_t* credential_set = cardano_credential_set_new();
+ *
+ * // Perform operations with the credential_set...
+ *
+ * cardano_credential_set_unref(&credential_set);
+ * // At this point, credential_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_credential_set_unref, the pointer to the \ref cardano_credential_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_credential_set_unref(cardano_credential_set_t** credential_set);
+
+/**
+ * \brief Increases the reference count of the cardano_credential_set_t object.
+ *
+ * This function is used to manually increment the reference count of a credential_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_credential_set_unref.
+ *
+ * \param credential_set A pointer to the credential_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming credential_set is a previously created credential_set object
+ *
+ * cardano_credential_set_ref(credential_set);
+ *
+ * // Now credential_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_credential_set_ref there is a corresponding
+ * call to \ref cardano_credential_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_credential_set_ref(cardano_credential_set_t* credential_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_credential_set_t object.
+ *
+ * This function returns the number of active references to a credential_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_credential_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param credential_set A pointer to the credential_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified credential_set object. If the object
+ * is properly managed (i.e., every \ref cardano_credential_set_ref call is matched with a
+ * \ref cardano_credential_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming credential_set is a previously created credential_set object
+ *
+ * size_t ref_count = cardano_credential_set_refcount(credential_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_credential_set_refcount(const cardano_credential_set_t* credential_set);
+
+/**
+ * \brief Sets the last error message for a given credential_set object.
+ *
+ * Records an error message in the credential_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] credential_set A pointer to the \ref cardano_credential_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the credential_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_credential_set_set_last_error(cardano_credential_set_t* credential_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific credential_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_credential_set_set_last_error for the given
+ * credential_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] credential_set A pointer to the \ref cardano_credential_set_t instance whose last error
+ *                   message is to be retrieved. If the credential_set is NULL, the function
+ *                   returns a generic error message indicating the null credential_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified credential_set. If the credential_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_credential_set_set_last_error for the same credential_set, or until
+ *       the credential_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_credential_set_get_last_error(const cardano_credential_set_t* credential_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_credential_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_credential_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_credential_set_deep_clone(const cardano_credential_set_t* source, cardano_credential_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CREDENTIAL_SET_H
diff --git a/vendor/include/cardano/proposal_procedures/governance_action_type.h b/vendor/include/cardano/proposal_procedures/governance_action_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/governance_action_type.h
@@ -0,0 +1,91 @@
+/**
+ * \file governance_action_type.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_ACTION_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_ACTION_TYPE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents the different types of governance actions within the Cardano blockchain ecosystem.
+ */
+typedef enum
+{
+  /**
+   * \brief Updates one or more updatable protocol parameters, excluding changes to major protocol versions (i.e., "hard forks").
+   **/
+  CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE = 0,
+
+  /**
+   * \brief Initiates a non-backwards compatible upgrade of the network. This action necessitates a preceding software update.
+   **/
+  CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION = 1,
+
+  /**
+   * \brief Withdraws funds from the treasury.
+   **/
+  CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS = 2,
+
+  /**
+   * \brief Propose a state of no-confidence in the current constitutional committee.
+   * Allows Ada holders to challenge the authority granted to the existing committee.
+   */
+  CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE = 3,
+
+  /**
+   * \brief Modifies the composition of the constitutional committee, its signature threshold, or its terms of operation.
+   **/
+  CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE = 4,
+
+  /**
+   * \brief Changes or amendments the Constitution.
+   * */
+  CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION = 5,
+
+  /**
+   * \brief Represents an action that has no direct effect on the blockchain,
+   * but serves as an on-chain record or informative notice.
+   */
+  CARDANO_GOVERNANCE_ACTION_TYPE_INFO = 6
+} cardano_governance_action_type_t;
+
+/**
+ * \brief Converts governance action types to their human readable form.
+ *
+ * \param[in] type The governance action type to get the string representation for.
+ * \return Human readable form of the given governance action type.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_governance_action_type_to_string(cardano_governance_action_type_t type);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_ACTION_TYPE_H
diff --git a/vendor/include/cardano/proposal_procedures/hard_fork_initiation_action.h b/vendor/include/cardano/proposal_procedures/hard_fork_initiation_action.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/hard_fork_initiation_action.h
@@ -0,0 +1,518 @@
+/**
+ * \file hard_fork_initiation_action.h
+ *
+ * \author angel.castillo
+ * \date   Aug 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HARD_FORK_INITIATION_ACTION_H
+#define HARD_FORK_INITIATION_ACTION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/governance_action_id.h>
+#include <cardano/common/protocol_version.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents the initiation action for a hard fork in the Cardano network.
+ */
+typedef struct cardano_hard_fork_initiation_action_t cardano_hard_fork_initiation_action_t;
+
+/**
+ * \brief Creates and initializes a new instance of the Hard Fork Initiation Action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_hard_fork_initiation_action_t object,
+ * which represents an action to initiate a hard fork in the Cardano network. The action is defined by specifying
+ * a protocol version and an optional governance action identifier.
+ *
+ * The action requires a governance action ID to reference the most recent enacted action of the
+ * same type. You can retrieve this information from the gov-state query:
+ *
+ * \code{.sh}
+ * cardano-cli conway query gov-state | jq .nextRatifyState.nextEnactState.prevGovActionIds
+ * \endcode
+ *
+ * Example output:
+ * \code{.json}
+ * {
+ *   "Committee": {
+ *     "govActionIx": 0,
+ *     "txId": "6bff8515060c08e9cae4d4e203a4d8b2e876848aae8c4e896acda7202d3ac679"
+ *   },
+ *   "Constitution": null,
+ *   "HardFork": null,
+ *   "PParamUpdate": {
+ *     "govActionIx": 0,
+ *     "txId": "7e199d036f1e8d725ea8aba30c5f8d0d2ab9dbd45c7f54e7d85c92c022673f0f"
+ *   }
+ * }
+ * \endcode
+ *
+ * \param[in] version A pointer to a \ref cardano_protocol_version_t object representing the protocol version for the hard fork.
+ * \param[in] governance_action_id An optional pointer to a \ref cardano_governance_action_id_t object representing the unique identifier
+ *                                 for the last enacted governance action of the same type. This parameter can be NULL if no governance action of this type is enacted.
+ * \param[out] hard_fork_initiation_action On successful initialization, this will point to a newly created
+ *             \ref cardano_hard_fork_initiation_action_t object. This object represents a "strong reference"
+ *             to the hard fork initiation action, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the hard fork initiation action was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_version_t* version = cardano_protocol_version_new(...); // Assume version is already initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...);
+ * cardano_hard_fork_initiation_action_t* hard_fork_initiation_action = NULL;
+ * cardano_error_t result = cardano_hard_fork_initiation_action_new(version, governance_action_id, &hard_fork_initiation_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the hard fork initiation action
+ *   // Free resources when done
+ *   cardano_hard_fork_initiation_action_unref(&hard_fork_initiation_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the hard fork initiation action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_protocol_version_unref(&version);
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_hard_fork_initiation_action_new(
+  cardano_protocol_version_t*             version,
+  cardano_governance_action_id_t*         governance_action_id,
+  cardano_hard_fork_initiation_action_t** hard_fork_initiation_action);
+
+/**
+ * \brief Creates a \ref cardano_hard_fork_initiation_action_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_hard_fork_initiation_action_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a hard_fork_initiation_action.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] hard_fork_initiation_action A pointer to a pointer of \ref cardano_hard_fork_initiation_action_t that will be set to the address
+ *                        of the newly created hard_fork_initiation_action object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_hard_fork_initiation_action_t object by calling
+ *       \ref cardano_hard_fork_initiation_action_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_hard_fork_initiation_action_t* hard_fork_initiation_action = NULL;
+ *
+ * cardano_error_t result = cardano_hard_fork_initiation_action_from_cbor(reader, &hard_fork_initiation_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the hard_fork_initiation_action
+ *
+ *   // Once done, ensure to clean up and release the hard_fork_initiation_action
+ *   cardano_hard_fork_initiation_action_unref(&hard_fork_initiation_action);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode hard_fork_initiation_action: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_hard_fork_initiation_action_from_cbor(cardano_cbor_reader_t* reader, cardano_hard_fork_initiation_action_t** hard_fork_initiation_action);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_hard_fork_initiation_action_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] hard_fork_initiation_action A constant pointer to the \ref cardano_hard_fork_initiation_action_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p hard_fork_initiation_action or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_hard_fork_initiation_action_t* hard_fork_initiation_action = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_hard_fork_initiation_action_to_cbor(hard_fork_initiation_action, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_hard_fork_initiation_action_unref(&hard_fork_initiation_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_hard_fork_initiation_action_to_cbor(
+  const cardano_hard_fork_initiation_action_t* hard_fork_initiation_action,
+  cardano_cbor_writer_t*                       writer);
+
+/**
+ * \brief Serializes a hard fork initiation action to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "gov_action_id" (if present), "protocol_version".
+ *
+ * \param[in]  action  Pointer to a valid \ref cardano_hard_fork_initiation_action_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p action or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_hard_fork_initiation_action_to_cip116_json(
+  const cardano_hard_fork_initiation_action_t* action,
+  cardano_json_writer_t*                       writer);
+
+/**
+ * \brief Sets the protocol version in the hard fork initiation action.
+ *
+ * This function updates the protocol version of a \ref cardano_hard_fork_initiation_action_t object.
+ * The protocol version specifies the new set of rules that will become active after the hard fork.
+ *
+ * \param[in,out] hard_fork_initiation_action A pointer to an initialized \ref cardano_hard_fork_initiation_action_t object to which the protocol version will be set.
+ * \param[in] protocol_version A pointer to an initialized \ref cardano_protocol_version_t object representing the new protocol version.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the protocol version was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_hard_fork_initiation_action_t* hard_fork_initiation_action = ...; // Assume hard_fork_initiation_action is already initialized
+ * cardano_protocol_version_t* protocol_version = cardano_protocol_version_new(...); // Assume protocol_version is already initialized
+ *
+ * cardano_error_t result = cardano_hard_fork_initiation_action_set_protocol_version(hard_fork_initiation_action, protocol_version);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The protocol version is now set for the hard fork initiation action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the protocol version.\n");
+ * }
+ * // Clean up the hard_fork_initiation_action and protocol_version after use
+ * cardano_hard_fork_initiation_action_unref(&hard_fork_initiation_action);
+ * cardano_protocol_version_unref(&protocol_version);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_hard_fork_initiation_action_set_protocol_version(cardano_hard_fork_initiation_action_t* hard_fork_initiation_action, cardano_protocol_version_t* protocol_version);
+
+/**
+ * \brief Gets the protocol version from a hard_fork_initiation_action.
+ *
+ * This function retrieves the protocol version from a given \ref cardano_hard_fork_initiation_action_t object.
+ * The protocol version specifies the set of rules that will govern the network following the hard fork.
+ *
+ * \param[in] hard_fork_initiation_action A pointer to an initialized \ref cardano_hard_fork_initiation_action_t object from which the protocol version is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_protocol_version_t object representing the protocol version.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_protocol_version_unref when it is no longer needed.
+ *         If the hard_fork_initiation_action does not have a protocol version set, NULL is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_hard_fork_initiation_action_t* hard_fork_initiation_action = ...; // Assume initialized
+ * cardano_protocol_version_t* protocol_version = cardano_hard_fork_initiation_action_get_protocol_version(hard_fork_initiation_action);
+ *
+ * if (protocol_version != NULL)
+ * {
+ *   // Use the protocol version
+ *
+ *   // Once done, ensure to clean up and release the protocol version
+ *   cardano_protocol_version_unref(&protocol_version);
+ * }
+ * else
+ * {
+ *   printf("ERROR: No protocol version set for this hard fork initiation action.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_protocol_version_t*
+cardano_hard_fork_initiation_action_get_protocol_version(cardano_hard_fork_initiation_action_t* hard_fork_initiation_action);
+
+/**
+ * \brief Sets the governance action ID in the hard fork initiation action.
+ *
+ * This function updates the governance action ID of a \ref cardano_hard_fork_initiation_action_t object. The governance action ID
+ * represents the unique identifier for the most recently enacted governance action associated with a hard fork.
+ *
+ * \param[in,out] hard_fork_initiation_action A pointer to an initialized \ref cardano_hard_fork_initiation_action_t object to which
+ *                                            the governance action ID will be set.
+ * \param[in] governance_action_id A pointer to an initialized \ref cardano_governance_action_id_t object representing the last enacted action of the same type. This parameter
+ *            can be NULL if the governance action ID is to be unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the governance action ID was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         hard_fork_initiation_action pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_hard_fork_initiation_action_t* hard_fork_initiation_action = ...; // Assume hard_fork_initiation_action is already initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...); // Optionally initialized
+ *
+ * cardano_error_t result = cardano_hard_fork_initiation_action_set_governance_action_id(hard_fork_initiation_action, governance_action_id);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The governance action ID is now set for the hard_fork_initiation_action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the governance action ID.\n");
+ * }
+ *
+ * // Cleanup the hard_fork_initiation_action and optionally the governance action ID
+ * cardano_hard_fork_initiation_action_unref(&hard_fork_initiation_action);
+ *
+ * if (governance_action_id)
+ * {
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ *
+ * \note This function maintains governance continuity by referencing the latest governance action ID of the same type,
+ *       allowing only one active action at a time for each governance type.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_hard_fork_initiation_action_set_governance_action_id(cardano_hard_fork_initiation_action_t* hard_fork_initiation_action, cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the governance action ID from a hard fork initiation action.
+ *
+ * This function retrieves the governance action ID from a given \ref cardano_hard_fork_initiation_action_t object. The governance
+ * action ID references the most recent action of the same type.
+ *
+ * \param[in] hard_fork_initiation_action A pointer to an initialized \ref cardano_hard_fork_initiation_action_t object from
+ *                                        which the governance action ID is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_governance_action_id_t object representing the governance action ID.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_governance_action_id_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_hard_fork_initiation_action_t* hard_fork_initiation_action = ...; // Assume initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_hard_fork_initiation_action_get_governance_action_id(hard_fork_initiation_action);
+ *
+ * if (governance_action_id != NULL)
+ * {
+ *   printf("Governance Action ID: %u\n", cardano_governance_action_id_to_uint(governance_action_id));
+ *   // Use the governance action ID
+ *
+ *   // Once done, ensure to clean up and release the governance action ID
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_governance_action_id_t*
+cardano_hard_fork_initiation_action_get_governance_action_id(cardano_hard_fork_initiation_action_t* hard_fork_initiation_action);
+
+/**
+ * \brief Decrements the reference count of a cardano_hard_fork_initiation_action_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_hard_fork_initiation_action_t object
+ * by decreasing its reference count. When the reference count reaches zero, the hard_fork_initiation_action is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] hard_fork_initiation_action A pointer to the pointer of the hard_fork_initiation_action object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_hard_fork_initiation_action_t* hard_fork_initiation_action = cardano_hard_fork_initiation_action_new(major, minor);
+ *
+ * // Perform operations with the hard_fork_initiation_action...
+ *
+ * cardano_hard_fork_initiation_action_unref(&hard_fork_initiation_action);
+ * // At this point, hard_fork_initiation_action is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_hard_fork_initiation_action_unref, the pointer to the \ref cardano_hard_fork_initiation_action_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_hard_fork_initiation_action_unref(cardano_hard_fork_initiation_action_t** hard_fork_initiation_action);
+
+/**
+ * \brief Increases the reference count of the cardano_hard_fork_initiation_action_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_hard_fork_initiation_action_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_hard_fork_initiation_action_unref.
+ *
+ * \param hard_fork_initiation_action A pointer to the cardano_hard_fork_initiation_action_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming hard_fork_initiation_action is a previously created hard_fork_initiation_action object
+ *
+ * cardano_hard_fork_initiation_action_ref(hard_fork_initiation_action);
+ *
+ * // Now hard_fork_initiation_action can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_hard_fork_initiation_action_ref there is a corresponding
+ * call to \ref cardano_hard_fork_initiation_action_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_hard_fork_initiation_action_ref(cardano_hard_fork_initiation_action_t* hard_fork_initiation_action);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_hard_fork_initiation_action_t object.
+ *
+ * This function returns the number of active references to an cardano_hard_fork_initiation_action_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_hard_fork_initiation_action_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param hard_fork_initiation_action A pointer to the cardano_hard_fork_initiation_action_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_hard_fork_initiation_action_t object. If the object
+ * is properly managed (i.e., every \ref cardano_hard_fork_initiation_action_ref call is matched with a
+ * \ref cardano_hard_fork_initiation_action_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming hard_fork_initiation_action is a previously created hard_fork_initiation_action object
+ *
+ * size_t ref_count = cardano_hard_fork_initiation_action_refcount(hard_fork_initiation_action);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_hard_fork_initiation_action_refcount(const cardano_hard_fork_initiation_action_t* hard_fork_initiation_action);
+
+/**
+ * \brief Sets the last error message for a given cardano_hard_fork_initiation_action_t object.
+ *
+ * Records an error message in the hard_fork_initiation_action's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] hard_fork_initiation_action A pointer to the \ref cardano_hard_fork_initiation_action_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the hard_fork_initiation_action's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_hard_fork_initiation_action_set_last_error(
+  cardano_hard_fork_initiation_action_t* hard_fork_initiation_action,
+  const char*                            message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific hard_fork_initiation_action.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_hard_fork_initiation_action_set_last_error for the given
+ * hard_fork_initiation_action. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] hard_fork_initiation_action A pointer to the \ref cardano_hard_fork_initiation_action_t instance whose last error
+ *                   message is to be retrieved. If the hard_fork_initiation_action is NULL, the function
+ *                   returns a generic error message indicating the null hard_fork_initiation_action.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified hard_fork_initiation_action. If the hard_fork_initiation_action is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_hard_fork_initiation_action_set_last_error for the same hard_fork_initiation_action, or until
+ *       the hard_fork_initiation_action is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_hard_fork_initiation_action_get_last_error(
+  const cardano_hard_fork_initiation_action_t* hard_fork_initiation_action);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_hard_fork_initiation_action_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_hard_fork_initiation_action_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_hard_fork_initiation_action_deep_clone(const cardano_hard_fork_initiation_action_t* source, cardano_hard_fork_initiation_action_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // HARD_FORK_INITIATION_ACTION_H
diff --git a/vendor/include/cardano/proposal_procedures/info_action.h b/vendor/include/cardano/proposal_procedures/info_action.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/info_action.h
@@ -0,0 +1,338 @@
+/**
+ * \file info_action.h
+ *
+ * \author angel.castillo
+ * \date   Aug 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INFO_ACTION_H
+#define INFO_ACTION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents an action that has no direct effect on the blockchain,
+ * but serves as an on-chain record or informative notice.
+ */
+typedef struct cardano_info_action_t cardano_info_action_t;
+
+/**
+ * \brief Creates and initializes a new instance of an Info Action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_info_action_t object,
+ * which represents an informative action within the Cardano network. This type of action serves as an on-chain
+ * record or notice without directly affecting the blockchain's state.
+ *
+ * \param[out] info_action On successful initialization, this will point to a newly created
+ *             \ref cardano_info_action_t object. This object represents a "strong reference"
+ *             to the info action, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the info action is no longer needed, the caller must release it
+ *             by calling \ref cardano_info_action_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the info action was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_info_action_t* info_action = NULL;
+ * cardano_error_t result = cardano_info_action_new(&info_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the info action as an on-chain notice
+ *   // Free resources when done
+ *   cardano_info_action_unref(&info_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the info action: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_info_action_new(cardano_info_action_t** info_action);
+
+/**
+ * \brief Creates a \ref cardano_info_action_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_info_action_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a info_action.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] info_action A pointer to a pointer of \ref cardano_info_action_t that will be set to the address
+ *                        of the newly created info_action object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_info_action_t object by calling
+ *       \ref cardano_info_action_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_info_action_t* info_action = NULL;
+ *
+ * cardano_error_t result = cardano_info_action_from_cbor(reader, &info_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the info_action
+ *
+ *   // Once done, ensure to clean up and release the info_action
+ *   cardano_info_action_unref(&info_action);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode info_action: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_info_action_from_cbor(cardano_cbor_reader_t* reader, cardano_info_action_t** info_action);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_info_action_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] info_action A constant pointer to the \ref cardano_info_action_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p info_action or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_info_action_t* info_action = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_info_action_to_cbor(info_action, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_info_action_unref(&info_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_info_action_to_cbor(
+  const cardano_info_action_t* info_action,
+  cardano_cbor_writer_t*       writer);
+
+/**
+ * \brief Serializes an info action to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Key written: "tag".
+ *
+ * \param[in]  action  Pointer to a valid \ref cardano_info_action_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p action or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_info_action_to_cip116_json(
+  const cardano_info_action_t* action,
+  cardano_json_writer_t*       writer);
+
+/**
+ * \brief Decrements the reference count of a cardano_info_action_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_info_action_t object
+ * by decreasing its reference count. When the reference count reaches zero, the info_action is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] info_action A pointer to the pointer of the info_action object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_info_action_t* info_action = cardano_info_action_new(major, minor);
+ *
+ * // Perform operations with the info_action...
+ *
+ * cardano_info_action_unref(&info_action);
+ * // At this point, info_action is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_info_action_unref, the pointer to the \ref cardano_info_action_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_info_action_unref(cardano_info_action_t** info_action);
+
+/**
+ * \brief Increases the reference count of the cardano_info_action_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_info_action_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_info_action_unref.
+ *
+ * \param info_action A pointer to the cardano_info_action_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming info_action is a previously created info_action object
+ *
+ * cardano_info_action_ref(info_action);
+ *
+ * // Now info_action can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_info_action_ref there is a corresponding
+ * call to \ref cardano_info_action_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_info_action_ref(cardano_info_action_t* info_action);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_info_action_t object.
+ *
+ * This function returns the number of active references to an cardano_info_action_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_info_action_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param info_action A pointer to the cardano_info_action_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_info_action_t object. If the object
+ * is properly managed (i.e., every \ref cardano_info_action_ref call is matched with a
+ * \ref cardano_info_action_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming info_action is a previously created info_action object
+ *
+ * size_t ref_count = cardano_info_action_refcount(info_action);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_info_action_refcount(const cardano_info_action_t* info_action);
+
+/**
+ * \brief Sets the last error message for a given cardano_info_action_t object.
+ *
+ * Records an error message in the info_action's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] info_action A pointer to the \ref cardano_info_action_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the info_action's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_info_action_set_last_error(
+  cardano_info_action_t* info_action,
+  const char*            message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific info_action.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_info_action_set_last_error for the given
+ * info_action. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] info_action A pointer to the \ref cardano_info_action_t instance whose last error
+ *                   message is to be retrieved. If the info_action is NULL, the function
+ *                   returns a generic error message indicating the null info_action.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified info_action. If the info_action is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_info_action_set_last_error for the same info_action, or until
+ *       the info_action is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_info_action_get_last_error(
+  const cardano_info_action_t* info_action);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_info_action_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_info_action_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_info_action_deep_clone(const cardano_info_action_t* source, cardano_info_action_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // INFO_ACTION_H
diff --git a/vendor/include/cardano/proposal_procedures/new_constitution_action.h b/vendor/include/cardano/proposal_procedures/new_constitution_action.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/new_constitution_action.h
@@ -0,0 +1,512 @@
+/**
+ * \file new_constitution_action.h
+ *
+ * \author angel.castillo
+ * \date   Aug 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEW_CONSTITUTION_ACTION_H
+#define NEW_CONSTITUTION_ACTION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/governance_action_id.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/proposal_procedures/constitution.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Changes or amendments the Constitution.
+ */
+typedef struct cardano_new_constitution_action_t cardano_new_constitution_action_t;
+
+/**
+ * \brief Creates and initializes a new instance of the New Constitution Action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_new_constitution_action_t object,
+ * representing an action to propose a new Constitution or amend the existing one in the Cardano network.
+ *
+ * The action requires a governance action ID to reference the most recent enacted action of the
+ * same type. You can retrieve this information from the gov-state query:
+ *
+ * \code{.sh}
+ * cardano-cli conway query gov-state | jq .nextRatifyState.nextEnactState.prevGovActionIds
+ * \endcode
+ *
+ * Example output:
+ * \code{.json}
+ * {
+ *   "Committee": {
+ *     "govActionIx": 0,
+ *     "txId": "6bff8515060c08e9cae4d4e203a4d8b2e876848aae8c4e896acda7202d3ac679"
+ *   },
+ *   "Constitution": null,
+ *   "HardFork": null,
+ *   "PParamUpdate": {
+ *     "govActionIx": 0,
+ *     "txId": "7e199d036f1e8d725ea8aba30c5f8d0d2ab9dbd45c7f54e7d85c92c022673f0f"
+ *   }
+ * }
+ * \endcode
+ *
+ * \param[in] constitution A pointer to an initialized \ref cardano_constitution_t object defining the content of the new or amended Constitution.
+ * \param[in] governance_action_id An optional pointer to a \ref cardano_governance_action_id_t object representing the unique identifier of
+ *                                 the last enacted action of the same type. This parameter can be NULL if no governance action of this type is enacted.
+ * \param[out] new_constitution_action On successful creation, this will point to a newly created
+ *             \ref cardano_new_constitution_action_t object. This object is fully initialized, and the caller is responsible for
+ *             managing its lifecycle. To release the object when it is no longer needed, call \ref cardano_new_constitution_action_unref.
+ *
+ * \return \c cardano_error_t indicating the result of the operation. Returns \c CARDANO_SUCCESS if the new constitution action
+ *         was successfully created, or an appropriate error code on failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_constitution_t* constitution = cardano_constitution_new(...); // Assume constitution is already initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...);
+ * cardano_new_constitution_action_t* new_constitution_action = NULL;
+ * cardano_error_t result = cardano_new_constitution_action_new(constitution, governance_action_id, &new_constitution_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the new constitution action
+ *   // Free resources when done
+ *   cardano_new_constitution_action_unref(&new_constitution_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the new constitution action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_constitution_unref(&constitution);
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_new_constitution_action_new(
+  cardano_constitution_t*             constitution,
+  cardano_governance_action_id_t*     governance_action_id,
+  cardano_new_constitution_action_t** new_constitution_action);
+
+/**
+ * \brief Creates a \ref cardano_new_constitution_action_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_new_constitution_action_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a new_constitution_action.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] new_constitution_action A pointer to a pointer of \ref cardano_new_constitution_action_t that will be set to the address
+ *                        of the newly created new_constitution_action object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_new_constitution_action_t object by calling
+ *       \ref cardano_new_constitution_action_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_new_constitution_action_t* new_constitution_action = NULL;
+ *
+ * cardano_error_t result = cardano_new_constitution_action_from_cbor(reader, &new_constitution_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the new_constitution_action
+ *
+ *   // Once done, ensure to clean up and release the new_constitution_action
+ *   cardano_new_constitution_action_unref(&new_constitution_action);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode new_constitution_action: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_new_constitution_action_from_cbor(cardano_cbor_reader_t* reader, cardano_new_constitution_action_t** new_constitution_action);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_new_constitution_action_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] new_constitution_action A constant pointer to the \ref cardano_new_constitution_action_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p new_constitution_action or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_new_constitution_action_t* new_constitution_action = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_new_constitution_action_to_cbor(new_constitution_action, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_new_constitution_action_unref(&new_constitution_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_new_constitution_action_to_cbor(
+  const cardano_new_constitution_action_t* new_constitution_action,
+  cardano_cbor_writer_t*                   writer);
+
+/**
+ * \brief Serializes a new constitution action to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "gov_action_id" (if present), "constitution".
+ *
+ * \param[in]  action  Pointer to a valid \ref cardano_new_constitution_action_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p action or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_new_constitution_action_to_cip116_json(
+  const cardano_new_constitution_action_t* action,
+  cardano_json_writer_t*                   writer);
+
+/**
+ * \brief Sets the constitution in the new constitution action.
+ *
+ * This function updates the constitution of a \ref cardano_new_constitution_action_t object.
+ * The constitution specifies the set of rules and principles that define the governance and operation of the Cardano network.
+ *
+ * \param[in,out] new_constitution_action A pointer to an initialized \ref cardano_new_constitution_action_t object to which the constitution will be set.
+ * \param[in] constitution A pointer to an initialized \ref cardano_constitution_t object representing the new constitution.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the constitution was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_new_constitution_action_t* new_constitution_action = ...; // Assume new_constitution_action is already initialized
+ * cardano_constitution_t* constitution = cardano_constitution_new(...); // Assume constitution is already initialized
+ *
+ * cardano_error_t result = cardano_new_constitution_action_set_constitution(new_constitution_action, constitution);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The constitution is now set for the new constitution action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the constitution.\n");
+ * }
+ * // Clean up the new_constitution_action and constitution after use
+ * cardano_new_constitution_action_unref(&new_constitution_action);
+ * cardano_constitution_unref(&constitution);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_new_constitution_action_set_constitution(cardano_new_constitution_action_t* new_constitution_action, cardano_constitution_t* constitution);
+
+/**
+ * \brief Gets the constitution from a new_constitution_action.
+ *
+ * This function retrieves the constitution from a given \ref cardano_new_constitution_action_t object.
+ * The constitution represents the set of rules and principles that define the governance and operation of the Cardano network.
+ *
+ * \param[in] new_constitution_action A pointer to an initialized \ref cardano_new_constitution_action_t object from which the constitution is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_constitution_t object representing the constitution.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_constitution_unref when it is no longer needed.
+ *         If the new_constitution_action does not have a constitution set, NULL is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_new_constitution_action_t* new_constitution_action = ...; // Assume initialized
+ * cardano_constitution_t* constitution = cardano_new_constitution_action_get_constitution(new_constitution_action);
+ *
+ * if (constitution != NULL)
+ * {
+ *   // Use the constitution
+ *
+ *   // Once done, ensure to clean up and release the constitution
+ *   cardano_constitution_unref(&constitution);
+ * }
+ * else
+ * {
+ *   printf("ERROR: No constitution set for this new constitution action.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_constitution_t*
+cardano_new_constitution_action_get_constitution(cardano_new_constitution_action_t* new_constitution_action);
+
+/**
+ * \brief Sets the governance action ID in the new_constitution_action.
+ *
+ * This function updates the governance action ID of a \ref cardano_new_constitution_action_t object. This ID is
+ * required to reference the last enacted action of the same type to ensure continuity and compliance with Cardano's
+ * governance protocol.
+ *
+ * \param[in,out] new_constitution_action A pointer to an initialized \ref cardano_new_constitution_action_t object where
+ *                                        the governance action ID will be set.
+ * \param[in] governance_action_id A pointer to an initialized \ref cardano_governance_action_id_t object representing the last enacted action of the same type. This parameter
+ *            can be NULL if the governance action ID is to be unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the governance action ID was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         new_constitution_action pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_new_constitution_action_t* new_constitution_action = ...; // Assume new_constitution_action is already initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...); // Optionally initialized
+ *
+ * cardano_error_t result = cardano_new_constitution_action_set_governance_action_id(new_constitution_action, governance_action_id);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The governance action ID is now set for the new_constitution_action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the governance action ID.\n");
+ * }
+ *
+ * // Cleanup the new_constitution_action and optionally the governance action ID
+ * cardano_new_constitution_action_unref(&new_constitution_action);
+ *
+ * if (governance_action_id)
+ * {
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_new_constitution_action_set_governance_action_id(cardano_new_constitution_action_t* new_constitution_action, cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the governance action ID from a new_constitution_action.
+ *
+ * This function retrieves the governance action ID from a given \ref cardano_new_constitution_action_t object.
+ *
+ * \param[in] new_constitution_action A pointer to an initialized \ref cardano_new_constitution_action_t object from which the governance action ID is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_governance_action_id_t object representing the governance action ID.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_governance_action_id_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_new_constitution_action_t* new_constitution_action = ...; // Assume initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_new_constitution_action_get_governance_action_id(new_constitution_action);
+ *
+ * if (governance_action_id != NULL)
+ * {
+ *   printf("Governance Action ID: %u\n", cardano_governance_action_id_to_uint(governance_action_id));
+ *   // Use the governance action ID
+ *
+ *   // Once done, ensure to clean up and release the governance action ID
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_governance_action_id_t*
+cardano_new_constitution_action_get_governance_action_id(cardano_new_constitution_action_t* new_constitution_action);
+
+/**
+ * \brief Decrements the reference count of a cardano_new_constitution_action_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_new_constitution_action_t object
+ * by decreasing its reference count. When the reference count reaches zero, the new_constitution_action is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] new_constitution_action A pointer to the pointer of the new_constitution_action object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_new_constitution_action_t* new_constitution_action = cardano_new_constitution_action_new(major, minor);
+ *
+ * // Perform operations with the new_constitution_action...
+ *
+ * cardano_new_constitution_action_unref(&new_constitution_action);
+ * // At this point, new_constitution_action is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_new_constitution_action_unref, the pointer to the \ref cardano_new_constitution_action_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_new_constitution_action_unref(cardano_new_constitution_action_t** new_constitution_action);
+
+/**
+ * \brief Increases the reference count of the cardano_new_constitution_action_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_new_constitution_action_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_new_constitution_action_unref.
+ *
+ * \param new_constitution_action A pointer to the cardano_new_constitution_action_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming new_constitution_action is a previously created new_constitution_action object
+ *
+ * cardano_new_constitution_action_ref(new_constitution_action);
+ *
+ * // Now new_constitution_action can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_new_constitution_action_ref there is a corresponding
+ * call to \ref cardano_new_constitution_action_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_new_constitution_action_ref(cardano_new_constitution_action_t* new_constitution_action);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_new_constitution_action_t object.
+ *
+ * This function returns the number of active references to an cardano_new_constitution_action_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_new_constitution_action_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param new_constitution_action A pointer to the cardano_new_constitution_action_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_new_constitution_action_t object. If the object
+ * is properly managed (i.e., every \ref cardano_new_constitution_action_ref call is matched with a
+ * \ref cardano_new_constitution_action_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming new_constitution_action is a previously created new_constitution_action object
+ *
+ * size_t ref_count = cardano_new_constitution_action_refcount(new_constitution_action);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_new_constitution_action_refcount(const cardano_new_constitution_action_t* new_constitution_action);
+
+/**
+ * \brief Sets the last error message for a given cardano_new_constitution_action_t object.
+ *
+ * Records an error message in the new_constitution_action's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] new_constitution_action A pointer to the \ref cardano_new_constitution_action_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the new_constitution_action's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_new_constitution_action_set_last_error(
+  cardano_new_constitution_action_t* new_constitution_action,
+  const char*                        message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific new_constitution_action.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_new_constitution_action_set_last_error for the given
+ * new_constitution_action. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] new_constitution_action A pointer to the \ref cardano_new_constitution_action_t instance whose last error
+ *                   message is to be retrieved. If the new_constitution_action is NULL, the function
+ *                   returns a generic error message indicating the null new_constitution_action.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified new_constitution_action. If the new_constitution_action is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_new_constitution_action_set_last_error for the same new_constitution_action, or until
+ *       the new_constitution_action is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_new_constitution_action_get_last_error(
+  const cardano_new_constitution_action_t* new_constitution_action);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_new_constitution_action_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_new_constitution_action_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_new_constitution_action_deep_clone(const cardano_new_constitution_action_t* source, cardano_new_constitution_action_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // NEW_CONSTITUTION_ACTION_H
diff --git a/vendor/include/cardano/proposal_procedures/no_confidence_action.h b/vendor/include/cardano/proposal_procedures/no_confidence_action.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/no_confidence_action.h
@@ -0,0 +1,442 @@
+/**
+ * \file no_confidence_action.h
+ *
+ * \author angel.castillo
+ * \date   Aug 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NO_CONFIDENCE_ACTION_H
+#define NO_CONFIDENCE_ACTION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/governance_action_id.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/proposal_procedures/constitution.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Propose a state of no-confidence in the current constitutional committee.
+ * Allows Ada holders to challenge the authority granted to the existing committee.
+ */
+typedef struct cardano_no_confidence_action_t cardano_no_confidence_action_t;
+
+/**
+ * \brief Creates and initializes a new instance of the No Confidence Action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_no_confidence_action_t object,
+ * which represents an action to propose a state of no-confidence in the current constitutional committee within the Cardano network.
+ * This action allows Ada holders to challenge the authority of the committee, potentially leading to its reconstitution.
+ *
+ * The action requires a governance action ID to reference the most recent enacted action of the
+ * same type. You can retrieve this information from the gov-state query:
+ *
+ * \code{.sh}
+ * cardano-cli conway query gov-state | jq .nextRatifyState.nextEnactState.prevGovActionIds
+ * \endcode
+ *
+ * Example output:
+ * \code{.json}
+ * {
+ *   "Committee": {
+ *     "govActionIx": 0,
+ *     "txId": "6bff8515060c08e9cae4d4e203a4d8b2e876848aae8c4e896acda7202d3ac679"
+ *   },
+ *   "Constitution": null,
+ *   "HardFork": null,
+ *   "PParamUpdate": {
+ *     "govActionIx": 0,
+ *     "txId": "7e199d036f1e8d725ea8aba30c5f8d0d2ab9dbd45c7f54e7d85c92c022673f0f"
+ *   }
+ * }
+ * \endcode
+ *
+ * \param[in] governance_action_id An optional pointer to a \ref cardano_governance_action_id_t object representing the last enacted
+ *                                 action of the same type. This parameter can be NULL if no governance action of this type has been enacted.
+ * \param[out] no_confidence_action On successful initialization, this will point to a newly created
+ *             \ref cardano_no_confidence_action_t object. This object represents a "strong reference"
+ *             to the no-confidence action, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the no-confidence action is no longer needed, the caller must release it
+ *             by calling \ref cardano_no_confidence_action_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the no-confidence action was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...); // Optionally initialized
+ * cardano_no_confidence_action_t* no_confidence_action = NULL;
+ * cardano_error_t result = cardano_no_confidence_action_new(governance_action_id, &no_confidence_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the no-confidence action
+ *   // Free resources when done
+ *   cardano_no_confidence_action_unref(&no_confidence_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the no-confidence action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_no_confidence_action_new(
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_no_confidence_action_t** no_confidence_action);
+
+/**
+ * \brief Creates a \ref cardano_no_confidence_action_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_no_confidence_action_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a no_confidence_action.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] no_confidence_action A pointer to a pointer of \ref cardano_no_confidence_action_t that will be set to the address
+ *                        of the newly created no_confidence_action object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_no_confidence_action_t object by calling
+ *       \ref cardano_no_confidence_action_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_no_confidence_action_t* no_confidence_action = NULL;
+ *
+ * cardano_error_t result = cardano_no_confidence_action_from_cbor(reader, &no_confidence_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the no_confidence_action
+ *
+ *   // Once done, ensure to clean up and release the no_confidence_action
+ *   cardano_no_confidence_action_unref(&no_confidence_action);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode no_confidence_action: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_no_confidence_action_from_cbor(cardano_cbor_reader_t* reader, cardano_no_confidence_action_t** no_confidence_action);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_no_confidence_action_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] no_confidence_action A constant pointer to the \ref cardano_no_confidence_action_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p no_confidence_action or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_no_confidence_action_t* no_confidence_action = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_no_confidence_action_to_cbor(no_confidence_action, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_no_confidence_action_unref(&no_confidence_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_no_confidence_action_to_cbor(
+  const cardano_no_confidence_action_t* no_confidence_action,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes a no confidence action to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "gov_action_id" (if present).
+ *
+ * \param[in]  action  Pointer to a valid \ref cardano_no_confidence_action_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p action or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_no_confidence_action_to_cip116_json(
+  const cardano_no_confidence_action_t* action,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Sets the governance action ID in the no_confidence_action.
+ *
+ * This function updates the governance action ID of a \ref cardano_no_confidence_action_t object.
+ * The governance action ID is a \ref cardano_governance_action_id_t object representing the unique identifier for the last enacted action of the same type.
+ *
+ * \param[in,out] no_confidence_action A pointer to an initialized \ref cardano_no_confidence_action_t object to which the governance action ID will be set.
+ * \param[in] governance_action_id A pointer to an initialized \ref cardano_governance_action_id_t object representing the last enacted action of the same type. This parameter
+ *            can be NULL if the governance action ID is to be unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the governance action ID was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         no_confidence_action pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_no_confidence_action_t* no_confidence_action = ...; // Assume no_confidence_action is already initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...); // Optionally initialized
+ *
+ * cardano_error_t result = cardano_no_confidence_action_set_governance_action_id(no_confidence_action, governance_action_id);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The governance action ID is now set for the no_confidence_action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the governance action ID.\n");
+ * }
+ *
+ * // Cleanup the no_confidence_action and optionally the governance action ID
+ * cardano_no_confidence_action_unref(&no_confidence_action);
+ *
+ * if (governance_action_id)
+ * {
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_no_confidence_action_set_governance_action_id(cardano_no_confidence_action_t* no_confidence_action, cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the governance action ID from a no_confidence_action.
+ *
+ * This function retrieves the governance action ID from a given \ref cardano_no_confidence_action_t object. The governance action ID
+ * is represented as a \ref cardano_governance_action_id_t object.
+ *
+ * \param[in] no_confidence_action A pointer to an initialized \ref cardano_no_confidence_action_t object from which the governance action ID is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_governance_action_id_t object representing the governance action ID.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_governance_action_id_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_no_confidence_action_t* no_confidence_action = ...; // Assume initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_no_confidence_action_get_governance_action_id(no_confidence_action);
+ *
+ * if (governance_action_id != NULL)
+ * {
+ *   printf("Governance Action ID: %u\n", cardano_governance_action_id_to_uint(governance_action_id));
+ *   // Use the governance action ID
+ *
+ *   // Once done, ensure to clean up and release the governance action ID
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_governance_action_id_t*
+cardano_no_confidence_action_get_governance_action_id(cardano_no_confidence_action_t* no_confidence_action);
+
+/**
+ * \brief Decrements the reference count of a cardano_no_confidence_action_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_no_confidence_action_t object
+ * by decreasing its reference count. When the reference count reaches zero, the no_confidence_action is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] no_confidence_action A pointer to the pointer of the no_confidence_action object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_no_confidence_action_t* no_confidence_action = cardano_no_confidence_action_new(major, minor);
+ *
+ * // Perform operations with the no_confidence_action...
+ *
+ * cardano_no_confidence_action_unref(&no_confidence_action);
+ * // At this point, no_confidence_action is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_no_confidence_action_unref, the pointer to the \ref cardano_no_confidence_action_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_no_confidence_action_unref(cardano_no_confidence_action_t** no_confidence_action);
+
+/**
+ * \brief Increases the reference count of the cardano_no_confidence_action_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_no_confidence_action_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_no_confidence_action_unref.
+ *
+ * \param no_confidence_action A pointer to the cardano_no_confidence_action_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming no_confidence_action is a previously created no_confidence_action object
+ *
+ * cardano_no_confidence_action_ref(no_confidence_action);
+ *
+ * // Now no_confidence_action can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_no_confidence_action_ref there is a corresponding
+ * call to \ref cardano_no_confidence_action_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_no_confidence_action_ref(cardano_no_confidence_action_t* no_confidence_action);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_no_confidence_action_t object.
+ *
+ * This function returns the number of active references to an cardano_no_confidence_action_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_no_confidence_action_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param no_confidence_action A pointer to the cardano_no_confidence_action_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_no_confidence_action_t object. If the object
+ * is properly managed (i.e., every \ref cardano_no_confidence_action_ref call is matched with a
+ * \ref cardano_no_confidence_action_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming no_confidence_action is a previously created no_confidence_action object
+ *
+ * size_t ref_count = cardano_no_confidence_action_refcount(no_confidence_action);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_no_confidence_action_refcount(const cardano_no_confidence_action_t* no_confidence_action);
+
+/**
+ * \brief Sets the last error message for a given cardano_no_confidence_action_t object.
+ *
+ * Records an error message in the no_confidence_action's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] no_confidence_action A pointer to the \ref cardano_no_confidence_action_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the no_confidence_action's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_no_confidence_action_set_last_error(
+  cardano_no_confidence_action_t* no_confidence_action,
+  const char*                     message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific no_confidence_action.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_no_confidence_action_set_last_error for the given
+ * no_confidence_action. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] no_confidence_action A pointer to the \ref cardano_no_confidence_action_t instance whose last error
+ *                   message is to be retrieved. If the no_confidence_action is NULL, the function
+ *                   returns a generic error message indicating the null no_confidence_action.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified no_confidence_action. If the no_confidence_action is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_no_confidence_action_set_last_error for the same no_confidence_action, or until
+ *       the no_confidence_action is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_no_confidence_action_get_last_error(
+  const cardano_no_confidence_action_t* no_confidence_action);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_no_confidence_action_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_no_confidence_action_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_no_confidence_action_deep_clone(const cardano_no_confidence_action_t* source, cardano_no_confidence_action_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // NO_CONFIDENCE_ACTION_H
diff --git a/vendor/include/cardano/proposal_procedures/parameter_change_action.h b/vendor/include/cardano/proposal_procedures/parameter_change_action.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/parameter_change_action.h
@@ -0,0 +1,630 @@
+/**
+ * \file parameter_change_action.h
+ *
+ * \author angel.castillo
+ * \date   Aug 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PARAMETER_CHANGE_ACTION_H
+#define PARAMETER_CHANGE_ACTION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/governance_action_id.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/proposal_procedures/constitution.h>
+#include <cardano/protocol_params/protocol_param_update.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Updates one or more updatable protocol parameters, excluding changes to major protocol versions (i.e., "hard forks").
+ */
+typedef struct cardano_parameter_change_action_t cardano_parameter_change_action_t;
+
+/**
+ * \brief Creates and initializes a new instance of the Parameter Change Action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_parameter_change_action_t object,
+ * which represents an action to update one or more updatable protocol parameters within the Cardano network.
+ * These updates exclude major protocol version changes, which are managed through different actions.
+ *
+ * **Governance Action ID:**
+ * The action requires a governance action ID to reference the most recent enacted action of the
+ * same type. This is necessary to prevent unintended conflicts between governance actions of the same type.
+ * You can retrieve this information from the governance state query:
+ *
+ * \code{.sh}
+ * cardano-cli conway query gov-state | jq .nextRatifyState.nextEnactState.prevGovActionIds
+ * \endcode
+ *
+ * Example output:
+ * \code{.json}
+ * {
+ *   "Committee": {
+ *     "govActionIx": 0,
+ *     "txId": "6bff8515060c08e9cae4d4e203a4d8b2e876848aae8c4e896acda7202d3ac679"
+ *   },
+ *   "Constitution": null,
+ *   "HardFork": null,
+ *   "PParamUpdate": {
+ *     "govActionIx": 0,
+ *     "txId": "7e199d036f1e8d725ea8aba30c5f8d0d2ab9dbd45c7f54e7d85c92c022673f0f"
+ *   }
+ * }
+ * \endcode
+ *
+ * **Guardrails Script Hash:**
+ * The `policy_hash` parameter represents the hash of the guardrails script (also known as the governance action policy script).
+ * The guardrails script is a Plutus script that acts as a safeguard by imposing additional constraints on certain types
+ * of governance actions, such as protocol parameter updates and treasury withdrawals. When proposing a protocol parameter update, you must
+ * provide the guardrails script hash to reference it. This ensures that the proposal is validated against the guardrails script during the transaction processing.
+ *
+ * You can obtain the guardrails script hash using the `cardano-cli`:
+ * \code{.sh}
+ * cardano-cli hash script --script-file guardrails-script.plutus
+ * \endcode
+ *
+ * Example output:
+ * \code{.sh}
+ * fa24fb305126805cf2164c161d852a0e7330cf988f1fe558cf7d4a64
+ * \endcode
+ *
+ * \param[in] protocol_param_update A pointer to a \ref cardano_protocol_param_update_t object representing the protocol parameter updates.
+ *                                  This object should include the parameters you wish to update.
+ * \param[in] governance_action_id An optional pointer to a \ref cardano_governance_action_id_t object representing the last enacted governance
+ *                                 action of the same type (Protocol Parameter Update). This parameter can be `NULL` if no governance action of this type has been enacted.
+ * \param[in] policy_hash An optional pointer to a \ref cardano_blake2b_hash_t object representing the hash of the guardrails script.
+ * \param[out] parameter_change_action On successful initialization, this will point to a newly created
+ *             \ref cardano_parameter_change_action_t object. This object represents a "strong reference"
+ *             to the parameter change action, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object;
+ *             specifically, once the parameter change action is no longer needed, the caller must release it
+ *             by calling \ref cardano_parameter_change_action_unref.
+ *
+ * **Return Value:**
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the parameter change action was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * **Usage Example:**
+ * \code{.c}
+ * // Initialize the protocol parameter updates
+ * cardano_protocol_param_update_t* protocol_param_update = cardano_protocol_param_update_new();
+ * // Set the parameters you wish to update, for example:
+ * cardano_protocol_param_update_set_key_deposit(protocol_param_update, 1000000);
+ *
+ * // Retrieve the last enacted governance action ID (if any)
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(0, "7e199d036f1e8d725ea8aba30c5f8d0d2ab9dbd45c7f54e7d85c92c022673f0f");
+ *
+ * // Obtain the guardrails script hash (if required)
+ * cardano_blake2b_hash_t* policy_hash = cardano_blake2b_hash_from_hex("fa24fb305126805cf2164c161d852a0e7330cf988f1fe558cf7d4a64");
+ *
+ * cardano_parameter_change_action_t* parameter_change_action = NULL;
+ * cardano_error_t result = cardano_parameter_change_action_new(
+ *   protocol_param_update,
+ *   governance_action_id,
+ *   policy_hash,
+ *   &parameter_change_action);
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * cardano_blake2b_hash_unref(&policy_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_parameter_change_action_new(
+  cardano_protocol_param_update_t*    protocol_param_update,
+  cardano_governance_action_id_t*     governance_action_id,
+  cardano_blake2b_hash_t*             policy_hash,
+  cardano_parameter_change_action_t** parameter_change_action);
+
+/**
+ * \brief Creates a \ref cardano_parameter_change_action_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_parameter_change_action_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a parameter_change_action.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] parameter_change_action A pointer to a pointer of \ref cardano_parameter_change_action_t that will be set to the address
+ *                        of the newly created parameter_change_action object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_parameter_change_action_t object by calling
+ *       \ref cardano_parameter_change_action_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_parameter_change_action_t* parameter_change_action = NULL;
+ *
+ * cardano_error_t result = cardano_parameter_change_action_from_cbor(reader, &parameter_change_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the parameter_change_action
+ *
+ *   // Once done, ensure to clean up and release the parameter_change_action
+ *   cardano_parameter_change_action_unref(&parameter_change_action);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode parameter_change_action: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_parameter_change_action_from_cbor(cardano_cbor_reader_t* reader, cardano_parameter_change_action_t** parameter_change_action);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_parameter_change_action_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] parameter_change_action A constant pointer to the \ref cardano_parameter_change_action_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p parameter_change_action or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_parameter_change_action_t* parameter_change_action = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_parameter_change_action_to_cbor(parameter_change_action, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_parameter_change_action_unref(&parameter_change_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_parameter_change_action_to_cbor(
+  const cardano_parameter_change_action_t* parameter_change_action,
+  cardano_cbor_writer_t*                   writer);
+
+/**
+ * \brief Serializes a parameter change action to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "gov_action_id", "protocol_param_update", "policy_hash".
+ *
+ * \param[in]  action  Pointer to a valid \ref cardano_parameter_change_action_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p action or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_parameter_change_action_to_cip116_json(
+  const cardano_parameter_change_action_t* action,
+  cardano_json_writer_t*                   writer);
+
+/**
+ * \brief Sets the protocol parameter update in the parameter change action.
+ *
+ * This function updates the protocol parameter update section of a \ref cardano_parameter_change_action_t object.
+ * The protocol parameter update is a \ref cardano_protocol_param_update_t object representing the set of changes to the protocol parameters.
+ *
+ * \param[in,out] parameter_change_action A pointer to an initialized \ref cardano_parameter_change_action_t object to which the protocol parameter update will be set.
+ * \param[in] protocol_param_update A pointer to an initialized \ref cardano_protocol_param_update_t object representing the new protocol parameter updates.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the protocol parameter update was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         parameter_change_action pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_parameter_change_action_t* parameter_change_action = ...; // Assume parameter_change_action is already initialized
+ * cardano_protocol_param_update_t* protocol_param_update = cardano_protocol_param_update_new(...); // Assume protocol_param_update is already initialized
+ *
+ * cardano_error_t result = cardano_parameter_change_action_set_protocol_param_update(parameter_change_action, protocol_param_update);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The protocol parameter updates are now set for the parameter_change_action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the protocol parameter updates.\n");
+ * }
+ *
+ * // Cleanup the parameter_change_action and protocol_param_update after use
+ * cardano_parameter_change_action_unref(&parameter_change_action);
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_parameter_change_action_set_protocol_param_update(cardano_parameter_change_action_t* parameter_change_action, cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Retrieves the protocol parameter updates from a parameter_change_action.
+ *
+ * This function retrieves the protocol parameter updates from a given \ref cardano_parameter_change_action_t object. The protocol parameter updates
+ * are represented as a \ref cardano_protocol_param_update_t object.
+ *
+ * \param[in] parameter_change_action A pointer to an initialized \ref cardano_parameter_change_action_t object from which the protocol parameter updates are retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_protocol_param_update_t object representing the protocol parameter updates.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_protocol_param_update_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_parameter_change_action_t* parameter_change_action = ...; // Assume initialized
+ * cardano_protocol_param_update_t* protocol_param_update = cardano_parameter_change_action_get_protocol_param_update(parameter_change_action);
+ *
+ * if (protocol_param_update != NULL)
+ * {
+ *   // Use the protocol parameter updates
+ *
+ *   // Once done, ensure to clean up and release the protocol parameter updates
+ *   cardano_protocol_param_update_unref(&protocol_param_update);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_protocol_param_update_t*
+cardano_parameter_change_action_get_protocol_param_update(cardano_parameter_change_action_t* parameter_change_action);
+
+/**
+ * \brief Sets the guardrails script hash in the parameter change action.
+ *
+ * This function updates the guardrails script hash (also known as the policy hash) of a
+ * \ref cardano_parameter_change_action_t object. The guardrails script is an optional Plutus script that
+ * imposes additional constraints on certain types of governance actions, such as protocol parameter updates
+ * and treasury withdrawals. By setting the guardrails script hash, you reference this script in your
+ * parameter change action, ensuring that the proposal adheres to the constraints defined by the script.
+ *
+ * \param[in,out] parameter_change_action A pointer to an initialized \ref cardano_parameter_change_action_t object
+ *                                        to which the guardrails script hash will be set.
+ * \param[in] policy_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the new
+ *                        guardrails script hash. This parameter can be `NULL` if you wish to unset any previously
+ *                        set guardrails script hash.
+ *
+ * **Return Value:**
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the guardrails
+ *         script hash was successfully set, or an appropriate error code indicating the failure reason, such as
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if the `parameter_change_action` pointer is `NULL`.
+ *
+ * **Usage Example:**
+ * \code{.c}
+ * // Assume parameter_change_action is already initialized
+ * cardano_parameter_change_action_t* parameter_change_action = ...;
+ *
+ * // Obtain the guardrails script hash
+ * cardano_blake2b_hash_t* policy_hash = cardano_blake2b_hash_from_hex("fa24fb305126805cf2164c161d852a0e7330cf988f1fe558cf7d4a64");
+ *
+ * // Set the guardrails script hash in the parameter change action
+ * cardano_error_t result = cardano_parameter_change_action_set_policy_hash(parameter_change_action, policy_hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The guardrails script hash is now set for the parameter_change_action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the guardrails script hash: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up after use
+ * cardano_parameter_change_action_unref(&parameter_change_action);
+ * cardano_blake2b_hash_unref(&policy_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_parameter_change_action_set_policy_hash(cardano_parameter_change_action_t* parameter_change_action, cardano_blake2b_hash_t* policy_hash);
+
+/**
+ * \brief Retrieves the guardrails script hash from a parameter change action.
+ *
+ * This function retrieves the guardrails script hash (also known as the policy hash) from a given
+ * \ref cardano_parameter_change_action_t object. The guardrails script is an optional Plutus script that
+ * imposes additional constraints on certain types of governance actions, such as protocol parameter updates
+ * and treasury withdrawals. By obtaining the guardrails script hash, you can verify whether the parameter
+ * change action references a guardrails script, which may be required for the transaction to be valid.
+ *
+ * \param[in] parameter_change_action A pointer to an initialized \ref cardano_parameter_change_action_t object from which the guardrails script hash is retrieved.
+ *
+ * **Return Value:**
+ * \return A pointer to the retrieved \ref cardano_blake2b_hash_t object representing the guardrails script hash.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_blake2b_hash_unref
+ *         when it is no longer needed. If the `parameter_change_action` does not have a guardrails script hash set, `NULL` is returned.
+ *
+ * **Usage Example:**
+ * \code{.c}
+ * cardano_parameter_change_action_t* parameter_change_action = ...; // Assume initialized
+ * cardano_blake2b_hash_t* guardrails_hash = cardano_parameter_change_action_get_policy_hash(parameter_change_action);
+ *
+ * if (guardrails_hash != NULL)
+ * {
+ *   char* hash_str = cardano_blake2b_hash_to_string(guardrails_hash);
+ *   printf("Guardrails Script Hash: %s\n", hash_str);
+ *   // Use the guardrails script hash as needed
+ *
+ *   // Clean up
+ *   cardano_blake2b_hash_unref(&guardrails_hash);
+ *   free(hash_str);
+ * }
+ * else
+ * {
+ *   printf("No guardrails script hash set for this parameter change action.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t*
+cardano_parameter_change_action_get_policy_hash(cardano_parameter_change_action_t* parameter_change_action);
+
+/**
+ * \brief Sets the governance action ID in the parameter_change_action.
+ *
+ * This function updates the governance action ID of a \ref cardano_parameter_change_action_t object.
+ * The governance action ID is a \ref cardano_governance_action_id_t object representing the last enacted action of the same type.
+ *
+ * \param[in,out] parameter_change_action A pointer to an initialized \ref cardano_parameter_change_action_t object to which the governance action ID will be set.
+ * \param[in] governance_action_id A pointer to an initialized \ref cardano_governance_action_id_t object representing the last enacted action of the same type. This parameter
+ *            can be NULL if the governance action ID is to be unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the governance action ID was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         parameter_change_action pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_parameter_change_action_t* parameter_change_action = ...; // Assume parameter_change_action is already initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...); // Optionally initialized
+ *
+ * cardano_error_t result = cardano_parameter_change_action_set_governance_action_id(parameter_change_action, governance_action_id);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The governance action ID is now set for the parameter_change_action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the governance action ID.\n");
+ * }
+ *
+ * // Cleanup the parameter_change_action and optionally the governance action ID
+ * cardano_parameter_change_action_unref(&parameter_change_action);
+ *
+ * if (governance_action_id)
+ * {
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_parameter_change_action_set_governance_action_id(cardano_parameter_change_action_t* parameter_change_action, cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the governance action ID from a parameter_change_action.
+ *
+ * This function retrieves the governance action ID from a given \ref cardano_parameter_change_action_t object. The governance action ID
+ * is represented as a \ref cardano_governance_action_id_t object.
+ *
+ * \param[in] parameter_change_action A pointer to an initialized \ref cardano_parameter_change_action_t object from which the governance action ID is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_governance_action_id_t object representing the governance action ID.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_governance_action_id_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_parameter_change_action_t* parameter_change_action = ...; // Assume initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_parameter_change_action_get_governance_action_id(parameter_change_action);
+ *
+ * if (governance_action_id != NULL)
+ * {
+ *   printf("Governance Action ID: %u\n", cardano_governance_action_id_to_uint(governance_action_id));
+ *   // Use the governance action ID
+ *
+ *   // Once done, ensure to clean up and release the governance action ID
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_governance_action_id_t*
+cardano_parameter_change_action_get_governance_action_id(cardano_parameter_change_action_t* parameter_change_action);
+
+/**
+ * \brief Decrements the reference count of a cardano_parameter_change_action_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_parameter_change_action_t object
+ * by decreasing its reference count. When the reference count reaches zero, the parameter_change_action is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] parameter_change_action A pointer to the pointer of the parameter_change_action object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_parameter_change_action_t* parameter_change_action = cardano_parameter_change_action_new(major, minor);
+ *
+ * // Perform operations with the parameter_change_action...
+ *
+ * cardano_parameter_change_action_unref(&parameter_change_action);
+ * // At this point, parameter_change_action is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_parameter_change_action_unref, the pointer to the \ref cardano_parameter_change_action_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_parameter_change_action_unref(cardano_parameter_change_action_t** parameter_change_action);
+
+/**
+ * \brief Increases the reference count of the cardano_parameter_change_action_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_parameter_change_action_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_parameter_change_action_unref.
+ *
+ * \param parameter_change_action A pointer to the cardano_parameter_change_action_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming parameter_change_action is a previously created parameter_change_action object
+ *
+ * cardano_parameter_change_action_ref(parameter_change_action);
+ *
+ * // Now parameter_change_action can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_parameter_change_action_ref there is a corresponding
+ * call to \ref cardano_parameter_change_action_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_parameter_change_action_ref(cardano_parameter_change_action_t* parameter_change_action);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_parameter_change_action_t object.
+ *
+ * This function returns the number of active references to an cardano_parameter_change_action_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_parameter_change_action_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param parameter_change_action A pointer to the cardano_parameter_change_action_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_parameter_change_action_t object. If the object
+ * is properly managed (i.e., every \ref cardano_parameter_change_action_ref call is matched with a
+ * \ref cardano_parameter_change_action_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming parameter_change_action is a previously created parameter_change_action object
+ *
+ * size_t ref_count = cardano_parameter_change_action_refcount(parameter_change_action);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_parameter_change_action_refcount(const cardano_parameter_change_action_t* parameter_change_action);
+
+/**
+ * \brief Sets the last error message for a given cardano_parameter_change_action_t object.
+ *
+ * Records an error message in the parameter_change_action's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] parameter_change_action A pointer to the \ref cardano_parameter_change_action_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the parameter_change_action's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_parameter_change_action_set_last_error(
+  cardano_parameter_change_action_t* parameter_change_action,
+  const char*                        message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific parameter_change_action.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_parameter_change_action_set_last_error for the given
+ * parameter_change_action. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] parameter_change_action A pointer to the \ref cardano_parameter_change_action_t instance whose last error
+ *                   message is to be retrieved. If the parameter_change_action is NULL, the function
+ *                   returns a generic error message indicating the null parameter_change_action.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified parameter_change_action. If the parameter_change_action is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_parameter_change_action_set_last_error for the same parameter_change_action, or until
+ *       the parameter_change_action is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_parameter_change_action_get_last_error(
+  const cardano_parameter_change_action_t* parameter_change_action);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_parameter_change_action_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_parameter_change_action_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_parameter_change_action_deep_clone(const cardano_parameter_change_action_t* source, cardano_parameter_change_action_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // PARAMETER_CHANGE_ACTION_H
diff --git a/vendor/include/cardano/proposal_procedures/proposal_procedure.h b/vendor/include/cardano/proposal_procedures/proposal_procedure.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/proposal_procedure.h
@@ -0,0 +1,1251 @@
+/**
+ * \file proposal_procedure.h
+ *
+ * \author angel.castillo
+ * \date   Aug 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PROPOSAL_PROCEDURE_H
+#define PROPOSAL_PROCEDURE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/anchor.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/proposal_procedures/governance_action_type.h>
+#include <cardano/proposal_procedures/update_committee_action.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Governance proposal procedure for the Cardano blockchain, it supports various types of governance actions.
+ */
+typedef struct cardano_proposal_procedure_t cardano_proposal_procedure_t;
+
+/**
+ * \brief Updates one or more updatable protocol parameters, excluding changes to major protocol versions (i.e., "hard forks").
+ */
+typedef struct cardano_parameter_change_action_t cardano_parameter_change_action_t;
+
+/**
+ * \brief Represents the initiation action for a hard fork in the Cardano network.
+ */
+typedef struct cardano_hard_fork_initiation_action_t cardano_hard_fork_initiation_action_t;
+
+/**
+ * \brief Withdraws funds from the treasury.
+ */
+typedef struct cardano_treasury_withdrawals_action_t cardano_treasury_withdrawals_action_t;
+
+/**
+ * \brief Propose a state of no-confidence in the current constitutional committee.
+ * Allows Ada holders to challenge the authority granted to the existing committee.
+ */
+typedef struct cardano_no_confidence_action_t cardano_no_confidence_action_t;
+
+/**
+ * \brief Modifies the composition of the constitutional committee, its signature threshold, or its terms of operation.
+ */
+typedef struct cardano_update_committee_action_t cardano_update_committee_action_t;
+
+/**
+ * \brief Changes or amendments the Constitution.
+ */
+typedef struct cardano_new_constitution_action_t cardano_new_constitution_action_t;
+
+/**
+ * \brief Represents an action that has no direct effect on the blockchain,
+ * but serves as an on-chain record or informative notice.
+ */
+typedef struct cardano_info_action_t cardano_info_action_t;
+
+/**
+ * \brief Creates a new proposal procedure for a parameter change action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_proposal_procedure_t object,
+ * which is designed to propose changes to the protocol parameters within the Cardano network.
+ *
+ * \param[in] deposit The deposit required to submit the proposal.
+ * \param[in] reward_address A pointer to a \ref cardano_reward_address_t object associated.
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object representing additional information related to the proposal, can be NULL if not applicable.
+ * \param[in] parameter_change_action A pointer to an initialized \ref cardano_parameter_change_action_t object detailing the proposed changes to protocol parameters.
+ * \param[out] proposal On successful initialization, this will point to a newly created \ref cardano_proposal_procedure_t object.
+ *             This object represents a "strong reference" to the proposal procedure, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the proposal procedure is no longer needed, the caller must release it
+ *             by calling \ref cardano_proposal_procedure_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the proposal procedure was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t deposit = 1000000; // Example deposit amount
+ * cardano_reward_address_t* reward_address = cardano_reward_address_new(...); // Assume initialized
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Optionally initialized
+ * cardano_parameter_change_action_t* parameter_change_action = cardano_parameter_change_action_new(...); // Assume initialized
+ * cardano_proposal_procedure_t* proposal = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_new_parameter_change_action(deposit, reward_address, anchor, parameter_change_action, &proposal);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposal procedure
+ *   // Free resources when done
+ *   cardano_proposal_procedure_unref(&proposal);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the proposal procedure: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources used for setup
+ * cardano_reward_address_unref(&reward_address);
+ * cardano_anchor_unref(&anchor);
+ * cardano_parameter_change_action_unref(&parameter_change_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_new_parameter_change_action(
+  uint64_t                           deposit,
+  cardano_reward_address_t*          reward_address,
+  cardano_anchor_t*                  anchor,
+  cardano_parameter_change_action_t* parameter_change_action,
+  cardano_proposal_procedure_t**     proposal);
+
+/**
+ * \brief Creates a new proposal procedure for a hard fork initiation action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_proposal_procedure_t object.
+ *
+ * \param[in] deposit The deposit required to submit the proposal.
+ * \param[in] reward_address A pointer to a \ref cardano_reward_address_t object associated.
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object representing additional information related to the proposal, can be NULL if not applicable.
+ * \param[in] hard_fork_initiation_action A pointer to an initialized \ref cardano_hard_fork_initiation_action_t object detailing the proposed hard fork.
+ * \param[out] proposal On successful initialization, this will point to a newly created \ref cardano_proposal_procedure_t object.
+ *             This object represents a "strong reference" to the proposal procedure, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the proposal procedure is no longer needed, the caller must release it
+ *             by calling \ref cardano_proposal_procedure_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the proposal procedure was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t deposit = 1000000; // Example deposit amount
+ * cardano_reward_address_t* reward_address = cardano_reward_address_new(...); // Assume reward address is already initialized
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Optionally initialized
+ * cardano_hard_fork_initiation_action_t* hard_fork_initiation_action = cardano_hard_fork_initiation_action_new(...); // Assume initialized
+ * cardano_proposal_procedure_t* proposal = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_new_hard_fork_initiation_action(deposit, reward_address, anchor, hard_fork_initiation_action, &proposal);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposal procedure for hard fork initiation
+ *   // Free resources when done
+ *   cardano_proposal_procedure_unref(&proposal);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the hard fork initiation proposal: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources used for setup
+ * cardano_reward_address_unref(&reward_address);
+ * cardano_anchor_unref(&anchor);
+ * cardano_hard_fork_initiation_action_unref(&hard_fork_initiation_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_new_hard_fork_initiation_action(
+  uint64_t                               deposit,
+  cardano_reward_address_t*              reward_address,
+  cardano_anchor_t*                      anchor,
+  cardano_hard_fork_initiation_action_t* hard_fork_initiation_action,
+  cardano_proposal_procedure_t**         proposal);
+
+/**
+ * \brief Creates a new proposal procedure for a treasury withdrawals action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_proposal_procedure_t object.
+ *
+ * \param[in] deposit The deposit required to submit the proposal.
+ * \param[in] reward_address A pointer to a \ref cardano_reward_address_t object associated.
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object representing additional information related to the proposal, can be NULL if not applicable.
+ * \param[in] treasury_withdrawals_action A pointer to an initialized \ref cardano_treasury_withdrawals_action_t object detailing the proposed hard fork.
+ * \param[out] proposal On successful initialization, this will point to a newly created \ref cardano_proposal_procedure_t object.
+ *             This object represents a "strong reference" to the proposal procedure, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the proposal procedure is no longer needed, the caller must release it
+ *             by calling \ref cardano_proposal_procedure_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the proposal procedure was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t deposit = 1000000; // Example deposit amount
+ * cardano_reward_address_t* reward_address = cardano_reward_address_new(...); // Assume reward address is already initialized
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Optionally initialized
+ * cardano_treasury_withdrawals_action_t* treasury_withdrawals_action = cardano_treasury_withdrawals_action_new(...); // Assume initialized
+ * cardano_proposal_procedure_t* proposal = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_new_treasury_withdrawals_action(deposit, reward_address, anchor, treasury_withdrawals_action, &proposal);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposal procedure for treasury withdrawals
+ *   // Free resources when done
+ *   cardano_proposal_procedure_unref(&proposal);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the treasury withdrawals proposal: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources used for setup
+ * cardano_reward_address_unref(&reward_address);
+ * cardano_anchor_unref(&anchor);
+ * cardano_treasury_withdrawals_action_unref(&treasury_withdrawals_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_new_treasury_withdrawals_action(
+  uint64_t                               deposit,
+  cardano_reward_address_t*              reward_address,
+  cardano_anchor_t*                      anchor,
+  cardano_treasury_withdrawals_action_t* treasury_withdrawals_action,
+  cardano_proposal_procedure_t**         proposal);
+
+/**
+ * \brief Creates a new proposal procedure for a no confidence action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_proposal_procedure_t object.
+ *
+ * \param[in] deposit The deposit required to submit the proposal.
+ * \param[in] reward_address A pointer to a \ref cardano_reward_address_t object associated.
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object representing additional information related to the proposal, can be NULL if not applicable.
+ * \param[in] no_confidence_action A pointer to an initialized \ref cardano_no_confidence_action_t object detailing the proposed hard fork.
+ * \param[out] proposal On successful initialization, this will point to a newly created \ref cardano_proposal_procedure_t object.
+ *             This object represents a "strong reference" to the proposal procedure, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the proposal procedure is no longer needed, the caller must release it
+ *             by calling \ref cardano_proposal_procedure_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the proposal procedure was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t deposit = 1000000; // Example deposit amount
+ * cardano_reward_address_t* reward_address = cardano_reward_address_new(...); // Assume reward address is already initialized
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Optionally initialized
+ * cardano_no_confidence_action_t* no_confidence_action = cardano_no_confidence_action_new(...); // Assume initialized
+ * cardano_proposal_procedure_t* proposal = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_new_no_confidence_action(deposit, reward_address, anchor, no_confidence_action, &proposal);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposal procedure for no confidence
+ *   // Free resources when done
+ *   cardano_proposal_procedure_unref(&proposal);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the no confidence proposal: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources used for setup
+ * cardano_reward_address_unref(&reward_address);
+ * cardano_anchor_unref(&anchor);
+ * cardano_no_confidence_action_unref(&no_confidence_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_new_no_confidence_action(
+  uint64_t                        deposit,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_no_confidence_action_t* no_confidence_action,
+  cardano_proposal_procedure_t**  proposal);
+
+/**
+ * \brief Creates a new proposal procedure for a update committee action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_proposal_procedure_t object.
+ *
+ * \param[in] deposit The deposit required to submit the proposal.
+ * \param[in] reward_address A pointer to a \ref cardano_reward_address_t object associated.
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object representing additional information related to the proposal, can be NULL if not applicable.
+ * \param[in] update_committee_action A pointer to an initialized \ref cardano_update_committee_action_t object detailing the proposed hard fork.
+ * \param[out] proposal On successful initialization, this will point to a newly created \ref cardano_proposal_procedure_t object.
+ *             This object represents a "strong reference" to the proposal procedure, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the proposal procedure is no longer needed, the caller must release it
+ *             by calling \ref cardano_proposal_procedure_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the proposal procedure was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t deposit = 1000000; // Example deposit amount
+ * cardano_reward_address_t* reward_address = cardano_reward_address_new(...); // Assume reward address is already initialized
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Optionally initialized
+ * cardano_update_committee_action_t* update_committee_action = cardano_update_committee_action_new(...); // Assume initialized
+ * cardano_proposal_procedure_t* proposal = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_new_update_committee_action(deposit, reward_address, anchor, update_committee_action, &proposal);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposal procedure for update committee
+ *   // Free resources when done
+ *   cardano_proposal_procedure_unref(&proposal);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the update committee proposal: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources used for setup
+ * cardano_reward_address_unref(&reward_address);
+ * cardano_anchor_unref(&anchor);
+ * cardano_update_committee_action_unref(&update_committee_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_new_update_committee_action(
+  uint64_t                           deposit,
+  cardano_reward_address_t*          reward_address,
+  cardano_anchor_t*                  anchor,
+  cardano_update_committee_action_t* update_committee_action,
+  cardano_proposal_procedure_t**     proposal);
+
+/**
+ * \brief Creates a new proposal procedure for a new constitution action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_proposal_procedure_t object.
+ *
+ * \param[in] deposit The deposit required to submit the proposal.
+ * \param[in] reward_address A pointer to a \ref cardano_reward_address_t object associated.
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object representing additional information related to the proposal, can be NULL if not applicable.
+ * \param[in] new_constitution_action A pointer to an initialized \ref cardano_new_constitution_action_t object detailing the proposed hard fork.
+ * \param[out] proposal On successful initialization, this will point to a newly created \ref cardano_proposal_procedure_t object.
+ *             This object represents a "strong reference" to the proposal procedure, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the proposal procedure is no longer needed, the caller must release it
+ *             by calling \ref cardano_proposal_procedure_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the proposal procedure was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t deposit = 1000000; // Example deposit amount
+ * cardano_reward_address_t* reward_address = cardano_reward_address_new(...); // Assume reward address is already initialized
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Optionally initialized
+ * cardano_new_constitution_action_t* new_constitution_action = cardano_new_constitution_action_new(...); // Assume initialized
+ * cardano_proposal_procedure_t* proposal = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_new_new_constitution_action(deposit, reward_address, anchor, new_constitution_action, &proposal);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposal procedure for new constitution
+ *   // Free resources when done
+ *   cardano_proposal_procedure_unref(&proposal);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the new constitution proposal: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources used for setup
+ * cardano_reward_address_unref(&reward_address);
+ * cardano_anchor_unref(&anchor);
+ * cardano_new_constitution_action_unref(&new_constitution_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_new_constitution_action(
+  uint64_t                           deposit,
+  cardano_reward_address_t*          reward_address,
+  cardano_anchor_t*                  anchor,
+  cardano_new_constitution_action_t* new_constitution_action,
+  cardano_proposal_procedure_t**     proposal);
+
+/**
+ * \brief Creates a new proposal procedure for a info action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_proposal_procedure_t object.
+ *
+ * \param[in] deposit The deposit required to submit the proposal.
+ * \param[in] reward_address A pointer to a \ref cardano_reward_address_t object associated.
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object representing additional information related to the proposal, can be NULL if not applicable.
+ * \param[in] info_action A pointer to an initialized \ref cardano_info_action_t object detailing the proposed hard fork.
+ * \param[out] proposal On successful initialization, this will point to a newly created \ref cardano_proposal_procedure_t object.
+ *             This object represents a "strong reference" to the proposal procedure, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the proposal procedure is no longer needed, the caller must release it
+ *             by calling \ref cardano_proposal_procedure_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the proposal procedure was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t deposit = 1000000; // Example deposit amount
+ * cardano_reward_address_t* reward_address = cardano_reward_address_new(...); // Assume reward address is already initialized
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Optionally initialized
+ * cardano_info_action_t* info_action = cardano_info_action_new(...); // Assume initialized
+ * cardano_proposal_procedure_t* proposal = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_new_info_action(deposit, reward_address, anchor, info_action, &proposal);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposal procedure for info
+ *   // Free resources when done
+ *   cardano_proposal_procedure_unref(&proposal);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the info proposal: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources used for setup
+ * cardano_reward_address_unref(&reward_address);
+ * cardano_anchor_unref(&anchor);
+ * cardano_info_action_unref(&info_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_new_info_action(
+  uint64_t                       deposit,
+  cardano_reward_address_t*      reward_address,
+  cardano_anchor_t*              anchor,
+  cardano_info_action_t*         info_action,
+  cardano_proposal_procedure_t** proposal);
+
+/**
+ * \brief Creates a \ref cardano_proposal_procedure_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_proposal_procedure_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a auth_committee_hot.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] auth_committee_hot A pointer to a pointer of \ref cardano_proposal_procedure_t that will be set to the address
+ *                        of the newly created auth_committee_hot object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_proposal_procedure_t object by calling
+ *       \ref cardano_proposal_procedure_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_proposal_procedure_t* auth_committee_hot = NULL;
+ *
+ * cardano_error_t result = cardano_proposal_procedure_from_cbor(reader, &auth_committee_hot);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the auth_committee_hot
+ *
+ *   // Once done, ensure to clean up and release the auth_committee_hot
+ *   cardano_proposal_procedure_unref(&auth_committee_hot);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode auth_committee_hot: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_from_cbor(cardano_cbor_reader_t* reader, cardano_proposal_procedure_t** auth_committee_hot);
+
+/**
+ * \brief Serializes the proposal_procedure into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_proposal_procedure_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] auth_committee_hot A constant pointer to the \ref cardano_proposal_procedure_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p auth_committee_hot or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* auth_committee_hot = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_proposal_procedure_to_cbor(auth_committee_hot, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_proposal_procedure_unref(&auth_committee_hot);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposal_procedure_to_cbor(
+  const cardano_proposal_procedure_t* auth_committee_hot,
+  cardano_cbor_writer_t*              writer);
+
+/**
+ * \brief Serializes a proposal procedure to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "deposit", "reward_account", "gov_action", "anchor".
+ *
+ * \param[in]  procedure Pointer to a valid \ref cardano_proposal_procedure_t.
+ * \param[in]  writer    Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p procedure or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposal_procedure_to_cip116_json(
+  const cardano_proposal_procedure_t* procedure,
+  cardano_json_writer_t*              writer);
+
+/**
+ * \brief Retrieves the type of governance action associated with a proposal procedure.
+ *
+ * This function extracts the type of governance action, represented by a \ref cardano_governance_action_id_t object,
+ * from a given \ref cardano_proposal_procedure_t object.
+ *
+ * \param[in] proposal A constant pointer to the \ref cardano_proposal_procedure_t object from which
+ *                     the action type is to be retrieved. The object must not be NULL.
+ * \param[out] type Pointer to a variable where the action type will be stored. This variable will
+ *                   be set to the value from the \ref cardano_governance_action_id_t enumeration.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the action type was
+ *         successfully retrieved, or an appropriate error code if the input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal = cardano_proposal_procedure_new(...);
+ * cardano_governance_action_id_t type;
+ * cardano_error_t result = cardano_proposal_procedure_get_action_type(proposal, &type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Action Type: %d\n", type);
+ *   // Handle the action type accordingly
+ * }
+ *
+ * // Clean up the proposal object once done
+ * cardano_proposal_procedure_unref(&proposal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_get_action_type(const cardano_proposal_procedure_t* proposal, cardano_governance_action_type_t* type);
+
+/**
+ * \brief Converts a proposal procedure into a parameter change action if applicable.
+ *
+ * This function attempts to convert a given \ref cardano_proposal_procedure_t object into a \ref cardano_parameter_change_action_t object.
+ * This is applicable only if the proposal procedure encapsulates a parameter change action.
+ *
+ * \param[in] proposal A pointer to the \ref cardano_proposal_procedure_t object that potentially contains a parameter change action.
+ * \param[out] parameter_change_action On successful conversion, this will point to a newly created
+ *             \ref cardano_parameter_change_action_t object representing the parameter change action.
+ *             The caller is responsible for managing the lifecycle of this object, including releasing it
+ *             by calling \ref cardano_parameter_change_action_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was
+ *         successful, or an appropriate error code if the proposal does not contain a parameter change action or if any other
+ *         error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal = cardano_proposal_procedure_new(...);
+ * cardano_parameter_change_action_t* parameter_change_action = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_to_parameter_change_action(proposal, &parameter_change_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully retrieved the parameter change action
+ *   // Use the parameter_change_action as needed
+ *
+ *   // Clean up the parameter change action when done
+ *   cardano_parameter_change_action_unref(&parameter_change_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert to parameter change action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the proposal object after use
+ * cardano_proposal_procedure_unref(&proposal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_to_parameter_change_action(
+  cardano_proposal_procedure_t*       proposal,
+  cardano_parameter_change_action_t** parameter_change_action);
+
+/**
+ * \brief Converts a proposal procedure into a hard fork initiation action if applicable.
+ *
+ * This function attempts to convert a given \ref cardano_proposal_procedure_t object into a \ref cardano_hard_fork_initiation_action_t object.
+ * This is applicable only if the proposal procedure encapsulates a hard fork initiation action.
+ *
+ * \param[in] proposal A pointer to the \ref cardano_proposal_procedure_t object that potentially contains a hard fork initiation action.
+ * \param[out] hard_fork_initiation_action On successful conversion, this will point to a newly created
+ *             \ref cardano_hard_fork_initiation_action_t object representing the hard fork initiation action.
+ *             The caller is responsible for managing the lifecycle of this object, including releasing it
+ *             by calling \ref cardano_hard_fork_initiation_action_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was
+ *         successful, or an appropriate error code if the proposal does not contain a hard fork initiation action or if any other
+ *         error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal = cardano_proposal_procedure_new(...);
+ * cardano_hard_fork_initiation_action_t* hard_fork_initiation_action = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_to_hard_fork_initiation_action(proposal, &hard_fork_initiation_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully retrieved the hard fork initiation action
+ *   // Use the hard_fork_initiation_action as needed
+ *
+ *   // Clean up the hard fork initiation action when done
+ *   cardano_hard_fork_initiation_action_unref(&hard_fork_initiation_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert to hard fork initiation action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the proposal object after use
+ * cardano_proposal_procedure_unref(&proposal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_to_hard_fork_initiation_action(
+  cardano_proposal_procedure_t*           proposal,
+  cardano_hard_fork_initiation_action_t** hard_fork_initiation_action);
+
+/**
+ * \brief Converts a proposal procedure into a treasury withdrawals action if applicable.
+ *
+ * This function attempts to convert a given \ref cardano_proposal_procedure_t object into a \ref cardano_treasury_withdrawals_action_t object.
+ * This is applicable only if the proposal procedure encapsulates a treasury withdrawals action.
+ *
+ * \param[in] proposal A pointer to the \ref cardano_proposal_procedure_t object that potentially contains a treasury withdrawals action.
+ * \param[out] treasury_withdrawals_action On successful conversion, this will point to a newly created
+ *             \ref cardano_treasury_withdrawals_action_t object representing the treasury withdrawals action.
+ *             The caller is responsible for managing the lifecycle of this object, including releasing it
+ *             by calling \ref cardano_treasury_withdrawals_action_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was
+ *         successful, or an appropriate error code if the proposal does not contain a treasury withdrawals action or if any other
+ *         error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal = cardano_proposal_procedure_new(...);
+ * cardano_treasury_withdrawals_action_t* treasury_withdrawals_action = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_to_treasury_withdrawals_action(proposal, &treasury_withdrawals_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully retrieved the treasury withdrawals action
+ *   // Use the treasury_withdrawals_action as needed
+ *
+ *   // Clean up the treasury withdrawals action when done
+ *   cardano_treasury_withdrawals_action_unref(&treasury_withdrawals_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert to treasury withdrawals action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the proposal object after use
+ * cardano_proposal_procedure_unref(&proposal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_to_treasury_withdrawals_action(
+  cardano_proposal_procedure_t*           proposal,
+  cardano_treasury_withdrawals_action_t** treasury_withdrawals_action);
+
+/**
+ * \brief Converts a proposal procedure into a no confidence action if applicable.
+ *
+ * This function attempts to convert a given \ref cardano_proposal_procedure_t object into a \ref cardano_no_confidence_action_t object.
+ * This is applicable only if the proposal procedure encapsulates a no confidence action.
+ *
+ * \param[in] proposal A pointer to the \ref cardano_proposal_procedure_t object that potentially contains a no confidence action.
+ * \param[out] no_confidence_action On successful conversion, this will point to a newly created
+ *             \ref cardano_no_confidence_action_t object representing the no confidence action.
+ *             The caller is responsible for managing the lifecycle of this object, including releasing it
+ *             by calling \ref cardano_no_confidence_action_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was
+ *         successful, or an appropriate error code if the proposal does not contain a no confidence action or if any other
+ *         error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal = cardano_proposal_procedure_new(...);
+ * cardano_no_confidence_action_t* no_confidence_action = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_to_no_confidence_action(proposal, &no_confidence_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully retrieved the no confidence action
+ *   // Use the no_confidence_action as needed
+ *
+ *   // Clean up the no confidence action when done
+ *   cardano_no_confidence_action_unref(&no_confidence_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert to no confidence action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the proposal object after use
+ * cardano_proposal_procedure_unref(&proposal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_to_no_confidence_action(
+  cardano_proposal_procedure_t*    proposal,
+  cardano_no_confidence_action_t** no_confidence_action);
+
+/**
+ * \brief Converts a proposal procedure into an update committee action if applicable.
+ *
+ * This function attempts to convert a given \ref cardano_proposal_procedure_t object into a \ref cardano_update_committee_action_t object.
+ * This is applicable only if the proposal procedure encapsulates an update committee action.
+ *
+ * \param[in] proposal A pointer to the \ref cardano_proposal_procedure_t object that potentially contains an update committee action.
+ * \param[out] update_committee_action On successful conversion, this will point to a newly created
+ *             \ref cardano_update_committee_action_t object representing the update committee action.
+ *             The caller is responsible for managing the lifecycle of this object, including releasing it
+ *             by calling \ref cardano_update_committee_action_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was
+ *         successful, or an appropriate error code if the proposal does not contain an update committee action or if any other
+ *         error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal = cardano_proposal_procedure_new(...);
+ * cardano_update_committee_action_t* update_committee_action = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_to_update_committee_action(proposal, &update_committee_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully retrieved the update committee action
+ *   // Use the update_committee_action as needed
+ *
+ *   // Clean up the update committee action when done
+ *   cardano_update_committee_action_unref(&update_committee_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert to update committee action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the proposal object after use
+ * cardano_proposal_procedure_unref(&proposal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_to_update_committee_action(
+  cardano_proposal_procedure_t*       proposal,
+  cardano_update_committee_action_t** update_committee_action);
+
+/**
+ * \brief Converts a proposal procedure into a new constitution action if applicable.
+ *
+ * This function attempts to convert a given \ref cardano_proposal_procedure_t object into a \ref cardano_new_constitution_action_t object.
+ * This is applicable only if the proposal procedure encapsulates a new constitution action.
+ *
+ * \param[in] proposal A pointer to the \ref cardano_proposal_procedure_t object that potentially contains a new constitution action.
+ * \param[out] constitution_action On successful conversion, this will point to a newly created
+ *             \ref cardano_new_constitution_action_t object representing the new constitution action.
+ *             The caller is responsible for managing the lifecycle of this object, including releasing it
+ *             by calling \ref cardano_new_constitution_action_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was
+ *         successful, or an appropriate error code if the proposal does not contain a new constitution action or if any other
+ *         error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal = cardano_proposal_procedure_new(...);
+ * cardano_new_constitution_action_t* constitution_action = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_to_constitution_action(proposal, &constitution_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully retrieved the new constitution action
+ *   // Use the constitution_action as needed
+ *
+ *   // Clean up the new constitution action when done
+ *   cardano_new_constitution_action_unref(&constitution_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert to new constitution action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the proposal object after use
+ * cardano_proposal_procedure_unref(&proposal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_to_constitution_action(
+  cardano_proposal_procedure_t*       proposal,
+  cardano_new_constitution_action_t** constitution_action);
+
+/**
+ * \brief Converts a proposal procedure into an info action if applicable.
+ *
+ * This function attempts to convert a given \ref cardano_proposal_procedure_t object into a \ref cardano_info_action_t object.
+ * This is applicable only if the proposal procedure encapsulates an info action, which is intended for recording informative
+ * notices on the blockchain without directly affecting its operational state.
+ *
+ * \param[in] proposal A pointer to the \ref cardano_proposal_procedure_t object that potentially contains an info action.
+ * \param[out] info_action On successful conversion, this will point to a newly created
+ *             \ref cardano_info_action_t object representing the info action. The caller is responsible for managing the lifecycle
+ *             of this object, including releasing it by calling \ref cardano_info_action_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the conversion was
+ *         successful, or an appropriate error code if the proposal does not contain an info action or if any other
+ *         error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal = cardano_proposal_procedure_new(...);
+ * cardano_info_action_t* info_action = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_to_info_action(proposal, &info_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully retrieved the info action
+ *   // Use the info_action as needed
+ *
+ *   // Clean up the info action when done
+ *   cardano_info_action_unref(&info_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert to info action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the proposal object after use
+ * cardano_proposal_procedure_unref(&proposal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_to_info_action(
+  cardano_proposal_procedure_t* proposal,
+  cardano_info_action_t**       info_action);
+
+/**
+ * \brief Sets the anchor in the proposal procedure.
+ *
+ * This function updates the anchor of a \ref cardano_proposal_procedure_t object. The anchor is used to link to the off-chain content of the proposal_procedure.
+ *
+ * \param[in,out] proposal_procedure A pointer to an initialized \ref cardano_proposal_procedure_t object to which the anchor will be set.
+ * \param[in] anchor A pointer to an initialized \ref cardano_anchor_t object representing the new anchor.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the anchor was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal_procedure = ...; // Assume proposal_procedure is already initialized
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Assume anchor is already initialized
+ *
+ * cardano_error_t result = cardano_proposal_procedure_set_anchor(proposal_procedure, anchor);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The anchor is now set for the proposal_procedure
+ * }
+ * else
+ * {
+ *   printf("Failed to set the anchor.\n");
+ * }
+ * // Clean up the proposal_procedure and anchor after use
+ * cardano_proposal_procedure_unref(&proposal_procedure);
+ * cardano_anchor_unref(&anchor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_set_anchor(cardano_proposal_procedure_t* proposal_procedure, cardano_anchor_t* anchor);
+
+/**
+ * \brief Gets the anchor from a proposal_procedure.
+ *
+ * This function retrieves the anchor from a given \ref cardano_proposal_procedure_t object. The anchor links to the off-chain content of the proposal_procedure.
+ *
+ * \param[in] proposal_procedure A pointer to an initialized \ref cardano_proposal_procedure_t object from which the anchor is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_anchor_t object representing the anchor. This will be a new reference,
+ *         and the caller is responsible for releasing it with \ref cardano_anchor_unref when it is no longer needed.
+ *         If the proposal_procedure does not have an anchor set, NULL is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal_procedure = ...; // Assume initialized
+ * cardano_anchor_t* anchor = cardano_proposal_procedure_get_anchor(proposal_procedure);
+ *
+ * if (anchor != NULL)
+ * {
+ *   // Use the anchor
+ *
+ *   // Once done, ensure to clean up and release the anchor
+ *   cardano_anchor_unref(&anchor);
+ * }
+ * else
+ * {
+ *   printf("ERROR: No anchor set for this proposal_procedure.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_anchor_t*
+cardano_proposal_procedure_get_anchor(cardano_proposal_procedure_t* proposal_procedure);
+
+/**
+ * \brief Sets the reward address in the proposal procedure.
+ *
+ * This function updates the reward_address of a \ref cardano_proposal_procedure_t object.
+ *
+ * \param[in,out] proposal_procedure A pointer to an initialized \ref cardano_proposal_procedure_t object to which the reward address will be set.
+ * \param[in] reward_address A pointer to an initialized \ref cardano_reward_address_t object representing the new reward address.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the reward_address was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal_procedure = ...; // Assume proposal_procedure is already initialized
+ * cardano_reward_address_t* reward_address = cardano_reward_address_new(...); // Assume reward_address is already initialized
+ *
+ * cardano_error_t result = cardano_proposal_procedure_set_reward_address(proposal_procedure, reward_address);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The reward_address is now set for the proposal_procedure
+ * }
+ * else
+ * {
+ *   printf("Failed to set the reward_address.\n");
+ * }
+ * // Clean up the proposal_procedure and reward_address after use
+ * cardano_proposal_procedure_unref(&proposal_procedure);
+ * cardano_reward_address_unref(&reward_address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_set_reward_address(cardano_proposal_procedure_t* proposal_procedure, cardano_reward_address_t* reward_address);
+
+/**
+ * \brief Gets the reward address from a proposal_procedure.
+ *
+ * This function retrieves the reward address from a given \ref cardano_proposal_procedure_t object.
+ *
+ * \param[in] proposal_procedure A pointer to an initialized \ref cardano_proposal_procedure_t object from which the reward_address is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_reward_address_t object representing the reward address. This will be a new reference,
+ *         and the caller is responsible for releasing it with \ref cardano_reward_address_unref when it is no longer needed.
+ *         If the proposal_procedure does not have an reward_address set, NULL is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal_procedure = ...; // Assume initialized
+ * cardano_reward_address_t* reward_address = cardano_proposal_procedure_get_reward_address(proposal_procedure);
+ *
+ * if (reward_address != NULL)
+ * {
+ *   // Use the reward_address
+ *
+ *   // Once done, ensure to clean up and release the reward_address
+ *   cardano_reward_address_unref(&reward_address);
+ * }
+ * else
+ * {
+ *   printf("ERROR: No reward_address set for this proposal_procedure.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_reward_address_t*
+cardano_proposal_procedure_get_reward_address(cardano_proposal_procedure_t* proposal_procedure);
+
+/**
+ * \brief Retrieves the deposit amount from an proposal procedure.
+ *
+ * This function retrieves the deposit amount that was associated with the proposal procedure.
+ *
+ * \param[in] certificate A constant pointer to an initialized \ref cardano_proposal_procedure_t object.
+ *
+ * \return The deposit amount in lovelaces. If the proposal procedure is NULL, the function will return 0, which should be
+ *         handled appropriately by the caller to distinguish from a genuine deposit of 0 lovelaces.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_proposal_procedure_t* proposal_procedure = ...; // Assume proposal_procedure is already initialized
+ *
+ * uint64_t deposit = cardano_proposal_procedure_get_deposit(proposal_procedure);
+ * printf("Deposit for unregistration: %llu lovelaces\n", deposit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_proposal_procedure_get_deposit(const cardano_proposal_procedure_t* certificate);
+
+/**
+ * \brief Sets the deposit amount for an proposal procedure.
+ *
+ * This function sets the deposit amount required for unregistration of a stake credential.
+ *
+ * \param[in,out] certificate A pointer to an initialized \ref cardano_proposal_procedure_t object to which the deposit amount will be set.
+ * \param[in] deposit The deposit amount in lovelaces to set for the unregistration.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the deposit amount was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input certificate pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* proposal_procedure = ...; // Assume proposal_procedure is already initialized
+ * uint64_t deposit = 2000000;
+ *
+ * cardano_error_t result = cardano_proposal_procedure_set_deposit(proposal_procedure, deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Deposit set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set deposit.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_set_deposit(cardano_proposal_procedure_t* certificate, uint64_t deposit);
+
+/**
+ * \brief Decrements the reference count of a cardano_proposal_procedure_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_proposal_procedure_t object
+ * by decreasing its reference count. When the reference count reaches zero, the auth_committee_hot is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] auth_committee_hot A pointer to the pointer of the auth_committee_hot object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_t* auth_committee_hot = cardano_proposal_procedure_new(major, minor);
+ *
+ * // Perform operations with the auth_committee_hot...
+ *
+ * cardano_proposal_procedure_unref(&auth_committee_hot);
+ * // At this point, auth_committee_hot is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_proposal_procedure_unref, the pointer to the \ref cardano_proposal_procedure_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_proposal_procedure_unref(cardano_proposal_procedure_t** auth_committee_hot);
+
+/**
+ * \brief Increases the reference count of the cardano_proposal_procedure_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_proposal_procedure_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_proposal_procedure_unref.
+ *
+ * \param auth_committee_hot A pointer to the cardano_proposal_procedure_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming auth_committee_hot is a previously created auth_committee_hot object
+ *
+ * cardano_proposal_procedure_ref(auth_committee_hot);
+ *
+ * // Now auth_committee_hot can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_proposal_procedure_ref there is a corresponding
+ * call to \ref cardano_proposal_procedure_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_proposal_procedure_ref(cardano_proposal_procedure_t* auth_committee_hot);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_proposal_procedure_t object.
+ *
+ * This function returns the number of active references to an cardano_proposal_procedure_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_proposal_procedure_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param auth_committee_hot A pointer to the cardano_proposal_procedure_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_proposal_procedure_t object. If the object
+ * is properly managed (i.e., every \ref cardano_proposal_procedure_ref call is matched with a
+ * \ref cardano_proposal_procedure_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming auth_committee_hot is a previously created auth_committee_hot object
+ *
+ * size_t ref_count = cardano_proposal_procedure_refcount(auth_committee_hot);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_proposal_procedure_refcount(const cardano_proposal_procedure_t* auth_committee_hot);
+
+/**
+ * \brief Sets the last error message for a given cardano_proposal_procedure_t object.
+ *
+ * Records an error message in the auth_committee_hot's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] auth_committee_hot A pointer to the \ref cardano_proposal_procedure_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the auth_committee_hot's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_proposal_procedure_set_last_error(
+  cardano_proposal_procedure_t* auth_committee_hot,
+  const char*                   message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific auth_committee_hot.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_proposal_procedure_set_last_error for the given
+ * auth_committee_hot. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] auth_committee_hot A pointer to the \ref cardano_proposal_procedure_t instance whose last error
+ *                   message is to be retrieved. If the auth_committee_hot is NULL, the function
+ *                   returns a generic error message indicating the null auth_committee_hot.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified auth_committee_hot. If the auth_committee_hot is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_proposal_procedure_set_last_error for the same auth_committee_hot, or until
+ *       the auth_committee_hot is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_proposal_procedure_get_last_error(
+  const cardano_proposal_procedure_t* auth_committee_hot);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_proposal_procedure_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_proposal_procedure_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_deep_clone(const cardano_proposal_procedure_t* source, cardano_proposal_procedure_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // PROPOSAL_PROCEDURE_H
diff --git a/vendor/include/cardano/proposal_procedures/proposal_procedure_set.h b/vendor/include/cardano/proposal_procedures/proposal_procedure_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/proposal_procedure_set.h
@@ -0,0 +1,438 @@
+/**
+ * \file proposal_procedure_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PROPOSAL_PROCEDURE_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PROPOSAL_PROCEDURE_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/proposal_procedures/proposal_procedure.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Governance proposal procedure for the Cardano blockchain, it supports various types of governance actions.
+ */
+typedef struct cardano_proposal_procedure_t cardano_proposal_procedure_t;
+
+/**
+ * \brief Represents a set of proposal procedures.
+ */
+typedef struct cardano_proposal_procedure_set_t cardano_proposal_procedure_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a proposal_procedure_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_proposal_procedure_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] proposal_procedure_set On successful initialization, this will point to a newly created
+ *             \ref cardano_proposal_procedure_set_t object. This object represents a "strong reference"
+ *             to the proposal_procedure_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the proposal_procedure_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_proposal_procedure_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal_procedure_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_set_t* proposal_procedure_set = NULL;
+ *
+ * // Attempt to create a new proposal_procedure_set
+ * cardano_error_t result = cardano_proposal_procedure_set_new(&proposal_procedure_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposal_procedure_set
+ *
+ *   // Once done, ensure to clean up and release the proposal_procedure_set
+ *   cardano_proposal_procedure_set_unref(&proposal_procedure_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_set_new(cardano_proposal_procedure_set_t** proposal_procedure_set);
+
+/**
+ * \brief Creates a proposal_procedure set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_proposal_procedure_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a proposal_procedure.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded proposal_procedure data.
+ * \param[out] proposal_procedures A pointer to a pointer of \ref cardano_proposal_procedure_set_t that will be set to the address
+ *                        of the newly created proposal_procedure object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the proposal_procedure was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_proposal_procedure_set_t object by calling
+ *       \ref cardano_proposal_procedure_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_proposal_procedure_set_t* proposal_procedure = NULL;
+ *
+ * cardano_error_t result = cardano_proposal_procedure_set_from_cbor(reader, &proposal_procedure);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposal_procedure
+ *
+ *   // Once done, ensure to clean up and release the proposal_procedure
+ *   cardano_proposal_procedure_set_unref(&proposal_procedure);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode proposal_procedure: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_set_from_cbor(cardano_cbor_reader_t* reader, cardano_proposal_procedure_set_t** proposal_procedures);
+
+/**
+ * \brief Serializes a proposal_procedure into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_proposal_procedure_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] proposal_procedures A constant pointer to the \ref cardano_proposal_procedure_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p proposal_procedure or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_set_t* proposal_procedure = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_proposal_procedure_set_to_cbor(proposal_procedure, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_proposal_procedure_set_unref(&proposal_procedure);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposal_procedure_set_to_cbor(
+  const cardano_proposal_procedure_set_t* proposal_procedures,
+  cardano_cbor_writer_t*                  writer);
+
+/**
+ * \brief Serializes a set of proposal procedures to a CIP-116 JSON array.
+ *
+ * This function iterates over the set and serializes each \ref cardano_proposal_procedure_t
+ * into a JSON array.
+ *
+ * \param[in]  procedures Pointer to a valid \ref cardano_proposal_procedure_set_t.
+ * \param[in]  writer     Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p procedures or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposal_procedure_set_to_cip116_json(
+  const cardano_proposal_procedure_set_t* procedures,
+  cardano_json_writer_t*                  writer);
+
+/**
+ * \brief Retrieves the length of a proposal_procedure list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_proposal_procedure_set_t object.
+ *
+ * \param[in] proposal_procedure_set A constant pointer to the \ref cardano_proposal_procedure_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the proposal_procedure_set. Return 0 if the proposal_procedure_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_set_t* proposal_procedure_set = cardano_proposal_procedure_set_new();
+ *
+ * // Populate proposal_procedure_set with elements
+ *
+ * size_t length = cardano_proposal_procedure_set_get_length(proposal_procedure_set);
+ * printf("Length of the proposal_procedure_set: %zu\n", length);
+ *
+ * // Clean up the proposal_procedure_set object once done
+ * cardano_proposal_procedure_set_unref(&proposal_procedure_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_proposal_procedure_set_get_length(const cardano_proposal_procedure_set_t* proposal_procedure_set);
+
+/**
+ * \brief Retrieves an element from a proposal_procedure list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_proposal_procedure_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] proposal_procedure_set A constant pointer to the \ref cardano_proposal_procedure_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the proposal_procedure list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_proposal_procedure_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_proposal_procedure_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_set_t* proposal_procedure_set = cardano_proposal_procedure_set_new();
+ *
+ * // Populate proposal_procedure_set with elements
+ *
+ * cardano_proposal_procedure_t* element = NULL;
+ * cardano_error_t result = cardano_proposal_procedure_set_get(proposal_procedure_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_proposal_procedure_unref(&element);
+ * }
+ *
+ * // Clean up the proposal_procedure_set object once done
+ * cardano_proposal_procedure_set_unref(&proposal_procedure_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposal_procedure_set_get(const cardano_proposal_procedure_set_t* proposal_procedure_set, size_t index, cardano_proposal_procedure_t** element);
+
+/**
+ * \brief Adds an element to a proposal_procedure list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_proposal_procedure_set_t object.
+ *
+ * \param[in] proposal_procedure_set A constant pointer to the \ref cardano_proposal_procedure_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_proposal_procedure_t object that is to be added to the proposal_procedure_set.
+ *                    The element will be referenced by the proposal_procedure_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the proposal_procedure_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_set_t* proposal_procedure_set = cardano_proposal_procedure_set_new();
+ *
+ * // Create and initialize a new proposal_procedure element
+ * cardano_proposal_procedure_t* element = { ... };
+ *
+ * // Add the element to the proposal_procedure_set
+ * cardano_error_t result = cardano_proposal_procedure_set_add(proposal_procedure_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the proposal_procedure_set object once done
+ * cardano_proposal_procedure_set_unref(&proposal_procedure_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposal_procedure_set_add(cardano_proposal_procedure_set_t* proposal_procedure_set, cardano_proposal_procedure_t* element);
+
+/**
+ * \brief Decrements the reference count of a proposal_procedure_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_proposal_procedure_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the proposal_procedure_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] proposal_procedure_set A pointer to the pointer of the proposal_procedure_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposal_procedure_set_t* proposal_procedure_set = cardano_proposal_procedure_set_new();
+ *
+ * // Perform operations with the proposal_procedure_set...
+ *
+ * cardano_proposal_procedure_set_unref(&proposal_procedure_set);
+ * // At this point, proposal_procedure_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_proposal_procedure_set_unref, the pointer to the \ref cardano_proposal_procedure_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_proposal_procedure_set_unref(cardano_proposal_procedure_set_t** proposal_procedure_set);
+
+/**
+ * \brief Increases the reference count of the cardano_proposal_procedure_set_t object.
+ *
+ * This function is used to manually increment the reference count of a proposal_procedure_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_proposal_procedure_set_unref.
+ *
+ * \param proposal_procedure_set A pointer to the proposal_procedure_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming proposal_procedure_set is a previously created proposal_procedure_set object
+ *
+ * cardano_proposal_procedure_set_ref(proposal_procedure_set);
+ *
+ * // Now proposal_procedure_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_proposal_procedure_set_ref there is a corresponding
+ * call to \ref cardano_proposal_procedure_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_proposal_procedure_set_ref(cardano_proposal_procedure_set_t* proposal_procedure_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_proposal_procedure_set_t object.
+ *
+ * This function returns the number of active references to a proposal_procedure_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_proposal_procedure_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param proposal_procedure_set A pointer to the proposal_procedure_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified proposal_procedure_set object. If the object
+ * is properly managed (i.e., every \ref cardano_proposal_procedure_set_ref call is matched with a
+ * \ref cardano_proposal_procedure_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming proposal_procedure_set is a previously created proposal_procedure_set object
+ *
+ * size_t ref_count = cardano_proposal_procedure_set_refcount(proposal_procedure_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_proposal_procedure_set_refcount(const cardano_proposal_procedure_set_t* proposal_procedure_set);
+
+/**
+ * \brief Sets the last error message for a given proposal_procedure_set object.
+ *
+ * Records an error message in the proposal_procedure_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] proposal_procedure_set A pointer to the \ref cardano_proposal_procedure_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the proposal_procedure_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_proposal_procedure_set_set_last_error(cardano_proposal_procedure_set_t* proposal_procedure_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific proposal_procedure_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_proposal_procedure_set_set_last_error for the given
+ * proposal_procedure_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] proposal_procedure_set A pointer to the \ref cardano_proposal_procedure_set_t instance whose last error
+ *                   message is to be retrieved. If the proposal_procedure_set is NULL, the function
+ *                   returns a generic error message indicating the null proposal_procedure_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified proposal_procedure_set. If the proposal_procedure_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_proposal_procedure_set_set_last_error for the same proposal_procedure_set, or until
+ *       the proposal_procedure_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_proposal_procedure_set_get_last_error(const cardano_proposal_procedure_set_t* proposal_procedure_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_proposal_procedure_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_proposal_procedure_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_proposal_procedure_set_deep_clone(const cardano_proposal_procedure_set_t* source, cardano_proposal_procedure_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PROPOSAL_PROCEDURE_SET_H
diff --git a/vendor/include/cardano/proposal_procedures/treasury_withdrawals_action.h b/vendor/include/cardano/proposal_procedures/treasury_withdrawals_action.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/treasury_withdrawals_action.h
@@ -0,0 +1,525 @@
+/**
+ * \file treasury_withdrawals_action.h
+ *
+ * \author angel.castillo
+ * \date   Aug 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TREASURY_WITHDRAWALS_ACTION_H
+#define TREASURY_WITHDRAWALS_ACTION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Withdraws funds from the treasury.
+ */
+typedef struct cardano_treasury_withdrawals_action_t cardano_treasury_withdrawals_action_t;
+
+/**
+ * \brief Creates and initializes a new instance of the Treasury Withdrawals Action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_treasury_withdrawals_action_t object,
+ * which represents an action to withdraw funds from the Cardano treasury.
+ *
+ * **Guardrails Script Hash:**
+ * The `policy_hash` parameter represents the hash of the guardrails script (also known as the governance action policy script).
+ * The guardrails script is Plutus script that acts as a safeguard by imposing additional constraints on certain types
+ * of governance actions, such as protocol parameter updates and treasury withdrawals. When proposing a treasury withdrawal,
+ * you must provide its hash to reference it. This ensures that the proposal is validated against the guardrails script during the transaction processing.
+ *
+ * You can obtain the guardrails script hash using the `cardano-cli`:
+ * \code{.sh}
+ * cardano-cli hash script --script-file guardrails-script.plutus
+ * \endcode
+ *
+ * Example output:
+ * \code{.sh}
+ * fa24fb305126805cf2164c161d852a0e7330cf988f1fe558cf7d4a64
+ * \endcode
+ *
+ * \param[in] withdrawals A pointer to a \ref cardano_withdrawal_map_t object representing the set of withdrawals.
+ *                        Each withdrawal consists of a reward address and the amount to withdraw.
+ * \param[in] policy_hash An optional pointer to a \ref cardano_blake2b_hash_t object representing the hash of the guardrails script.
+ * \param[out] treasury_withdrawals_action On successful initialization, this will point to a newly created
+ *             \ref cardano_treasury_withdrawals_action_t object. This object represents a "strong reference"
+ *             to the treasury withdrawals action, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the treasury withdrawals action is no longer needed, the caller must release it
+ *             by calling \ref cardano_treasury_withdrawals_action_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the treasury withdrawals action was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * **Usage Example:**
+ * \code{.c}
+ * // Initialize the withdrawals map
+ * cardano_withdrawal_map_t* withdrawals = cardano_withdrawal_map_new();
+ * // Add a withdrawal to the map
+ * cardano_reward_address_t* reward_address = cardano_reward_address_from_bech32("stake1u9...");
+ * cardano_withdrawal_map_add(withdrawals, reward_address, 50000000000); // Withdraw 500 ADA
+ *
+ * // Obtain the guardrails script hash (if required)
+ * cardano_blake2b_hash_t* policy_hash = cardano_blake2b_hash_from_hex("fa24fb305126805cf2164c161d852a0e7330cf988f1fe558cf7d4a64");
+ *
+ * cardano_treasury_withdrawals_action_t* treasury_withdrawals_action = NULL;
+ * cardano_error_t result = cardano_treasury_withdrawals_action_new(withdrawals, policy_hash, &treasury_withdrawals_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the treasury withdrawals action
+ *   // For example, add it to the transaction builder
+ *   cardano_tx_builder_add_treasury_withdrawals_action(tx_builder, treasury_withdrawals_action);
+ *
+ *   // Free resources when done
+ *   cardano_treasury_withdrawals_action_unref(&treasury_withdrawals_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the treasury withdrawals action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup
+ * cardano_withdrawal_map_unref(&withdrawals);
+ * cardano_reward_address_unref(&reward_address);
+ * cardano_blake2b_hash_unref(&policy_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_treasury_withdrawals_action_new(
+  cardano_withdrawal_map_t*               withdrawals,
+  cardano_blake2b_hash_t*                 policy_hash,
+  cardano_treasury_withdrawals_action_t** treasury_withdrawals_action);
+
+/**
+ * \brief Creates a \ref cardano_treasury_withdrawals_action_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_treasury_withdrawals_action_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a treasury_withdrawals_action.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] treasury_withdrawals_action A pointer to a pointer of \ref cardano_treasury_withdrawals_action_t that will be set to the address
+ *                        of the newly created treasury_withdrawals_action object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_treasury_withdrawals_action_t object by calling
+ *       \ref cardano_treasury_withdrawals_action_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_treasury_withdrawals_action_t* treasury_withdrawals_action = NULL;
+ *
+ * cardano_error_t result = cardano_treasury_withdrawals_action_from_cbor(reader, &treasury_withdrawals_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the treasury_withdrawals_action
+ *
+ *   // Once done, ensure to clean up and release the treasury_withdrawals_action
+ *   cardano_treasury_withdrawals_action_unref(&treasury_withdrawals_action);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode treasury_withdrawals_action: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_treasury_withdrawals_action_from_cbor(cardano_cbor_reader_t* reader, cardano_treasury_withdrawals_action_t** treasury_withdrawals_action);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_treasury_withdrawals_action_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] treasury_withdrawals_action A constant pointer to the \ref cardano_treasury_withdrawals_action_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p treasury_withdrawals_action or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_treasury_withdrawals_action_t* treasury_withdrawals_action = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_treasury_withdrawals_action_to_cbor(treasury_withdrawals_action, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_treasury_withdrawals_action_unref(&treasury_withdrawals_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_treasury_withdrawals_action_to_cbor(
+  const cardano_treasury_withdrawals_action_t* treasury_withdrawals_action,
+  cardano_cbor_writer_t*                       writer);
+
+/**
+ * \brief Serializes a treasury withdrawals action to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "rewards", "policy_hash" (if present).
+ *
+ * \param[in]  action  Pointer to a valid \ref cardano_treasury_withdrawals_action_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p action or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_treasury_withdrawals_action_to_cip116_json(
+  const cardano_treasury_withdrawals_action_t* action,
+  cardano_json_writer_t*                       writer);
+
+/**
+ * \brief Sets the withdrawals in the treasury withdrawals action.
+ *
+ * This function updates the withdrawals section of a \ref cardano_treasury_withdrawals_action_t object.
+ * The withdrawals are represented by a \ref cardano_withdrawal_map_t object that details the specific withdrawals to be made from the treasury.
+ *
+ * \param[in,out] treasury_withdrawals_action A pointer to an initialized \ref cardano_treasury_withdrawals_action_t object to which the withdrawals will be set.
+ * \param[in] withdrawals A pointer to an initialized \ref cardano_withdrawal_map_t object representing the new withdrawals.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the withdrawals were
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         treasury_withdrawals_action pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_treasury_withdrawals_action_t* treasury_withdrawals_action = ...; // Assume treasury_withdrawals_action is already initialized
+ * cardano_withdrawal_map_t* withdrawals = cardano_withdrawal_map_new(...); // Assume withdrawals is already initialized
+ *
+ * cardano_error_t result = cardano_treasury_withdrawals_action_set_withdrawals(treasury_withdrawals_action, withdrawals);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The withdrawals are now set for the treasury withdrawals action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the withdrawals.\n");
+ * }
+ *
+ * // Cleanup the treasury_withdrawals_action and withdrawals after use
+ * cardano_treasury_withdrawals_action_unref(&treasury_withdrawals_action);
+ * cardano_withdrawal_map_unref(&withdrawals);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_treasury_withdrawals_action_set_withdrawals(cardano_treasury_withdrawals_action_t* treasury_withdrawals_action, cardano_withdrawal_map_t* withdrawals);
+
+/**
+ * \brief Retrieves the withdrawals from a treasury_withdrawals_action.
+ *
+ * This function retrieves the withdrawals from a given \ref cardano_treasury_withdrawals_action_t object. The withdrawals
+ * are represented as a \ref cardano_withdrawal_map_t object, detailing the specific withdrawals planned from the treasury.
+ *
+ * \param[in] treasury_withdrawals_action A pointer to an initialized \ref cardano_treasury_withdrawals_action_t object from which the withdrawals are retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_withdrawal_map_t object representing the withdrawals.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_withdrawal_map_unref
+ *         when it is no longer needed. If no withdrawals are set, NULL may be returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_treasury_withdrawals_action_t* treasury_withdrawals_action = ...; // Assume initialized
+ * cardano_withdrawal_map_t* withdrawals = cardano_treasury_withdrawals_action_get_withdrawals(treasury_withdrawals_action);
+ *
+ * if (withdrawals != NULL)
+ * {
+ *   // Process the withdrawals
+ *
+ *   // Once done, ensure to clean up and release the withdrawals
+ *   cardano_withdrawal_map_unref(&withdrawals);
+ * }
+ * else
+ * {
+ *   printf("ERROR: No withdrawals set for this treasury withdrawals action.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_withdrawal_map_t*
+cardano_treasury_withdrawals_action_get_withdrawals(cardano_treasury_withdrawals_action_t* treasury_withdrawals_action);
+
+/**
+ * \brief Sets the policy hash in the treasury_withdrawals_action.
+ *
+ * This function updates the policy hash of a \ref cardano_treasury_withdrawals_action_t object.
+ * The policy hash is a \ref cardano_blake2b_hash_t object that can optionally be set to modify the identification of the policy.
+ * This parameter can be NULL if the policy hash is to be unset, effectively removing any previously set policy hash.
+ *
+ * \param[in,out] treasury_withdrawals_action A pointer to an initialized \ref cardano_treasury_withdrawals_action_t object to which the policy hash will be set.
+ * \param[in] policy_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the new policy hash. This parameter can be NULL if the policy hash is to be unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the policy hash was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_treasury_withdrawals_action_t* treasury_withdrawals_action = ...; // Assume treasury_withdrawals_action is already initialized
+ * cardano_blake2b_hash_t* policy_hash = cardano_blake2b_hash_new(...); // Optionally initialized
+ *
+ * cardano_error_t result = cardano_treasury_withdrawals_action_set_policy_hash(treasury_withdrawals_action, policy_hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The policy hash is now set for the treasury_withdrawals_action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the policy hash.\n");
+ * }
+ *
+ * // Clean up the treasury_withdrawals_action and optionally the policy hash after use
+ * cardano_treasury_withdrawals_action_unref(&treasury_withdrawals_action);
+ *
+ * if (policy_hash)
+ * {
+ *   cardano_blake2b_hash_unref(&policy_hash);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_treasury_withdrawals_action_set_policy_hash(cardano_treasury_withdrawals_action_t* treasury_withdrawals_action, cardano_blake2b_hash_t* policy_hash);
+
+/**
+ * \brief Retrieves the policy hash from a treasury_withdrawals_action.
+ *
+ * This function retrieves the policy hash from a given \ref cardano_treasury_withdrawals_action_t object. The policy hash
+ * is represented as a \ref cardano_blake2b_hash_t object.
+ *
+ * \param[in] treasury_withdrawals_action A pointer to an initialized \ref cardano_treasury_withdrawals_action_t object from which the policy hash is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_blake2b_hash_t object representing the policy hash.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_blake2b_hash_unref
+ *         when it is no longer needed. If the treasury_withdrawals_action does not have a policy hash set, NULL is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_treasury_withdrawals_action_t* treasury_withdrawals_action = ...; // Assume initialized
+ * cardano_blake2b_hash_t* policy_hash = cardano_treasury_withdrawals_action_get_policy_hash(treasury_withdrawals_action);
+ *
+ * if (policy_hash != NULL)
+ * {
+ *   printf("Policy Hash: %s\n", cardano_blake2b_hash_to_string(policy_hash));
+ *   // Use the policy hash
+ *
+ *   // Once done, ensure to clean up and release the policy hash
+ *   cardano_blake2b_hash_unref(&policy_hash);
+ * }
+ * else
+ * {
+ *   printf("No policy hash set for this parameter change action.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t*
+cardano_treasury_withdrawals_action_get_policy_hash(cardano_treasury_withdrawals_action_t* treasury_withdrawals_action);
+
+/**
+ * \brief Decrements the reference count of a cardano_treasury_withdrawals_action_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_treasury_withdrawals_action_t object
+ * by decreasing its reference count. When the reference count reaches zero, the treasury_withdrawals_action is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] treasury_withdrawals_action A pointer to the pointer of the treasury_withdrawals_action object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_treasury_withdrawals_action_t* treasury_withdrawals_action = cardano_treasury_withdrawals_action_new(major, minor);
+ *
+ * // Perform operations with the treasury_withdrawals_action...
+ *
+ * cardano_treasury_withdrawals_action_unref(&treasury_withdrawals_action);
+ * // At this point, treasury_withdrawals_action is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_treasury_withdrawals_action_unref, the pointer to the \ref cardano_treasury_withdrawals_action_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_treasury_withdrawals_action_unref(cardano_treasury_withdrawals_action_t** treasury_withdrawals_action);
+
+/**
+ * \brief Increases the reference count of the cardano_treasury_withdrawals_action_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_treasury_withdrawals_action_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_treasury_withdrawals_action_unref.
+ *
+ * \param treasury_withdrawals_action A pointer to the cardano_treasury_withdrawals_action_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming treasury_withdrawals_action is a previously created treasury_withdrawals_action object
+ *
+ * cardano_treasury_withdrawals_action_ref(treasury_withdrawals_action);
+ *
+ * // Now treasury_withdrawals_action can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_treasury_withdrawals_action_ref there is a corresponding
+ * call to \ref cardano_treasury_withdrawals_action_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_treasury_withdrawals_action_ref(cardano_treasury_withdrawals_action_t* treasury_withdrawals_action);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_treasury_withdrawals_action_t object.
+ *
+ * This function returns the number of active references to an cardano_treasury_withdrawals_action_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_treasury_withdrawals_action_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param treasury_withdrawals_action A pointer to the cardano_treasury_withdrawals_action_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_treasury_withdrawals_action_t object. If the object
+ * is properly managed (i.e., every \ref cardano_treasury_withdrawals_action_ref call is matched with a
+ * \ref cardano_treasury_withdrawals_action_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming treasury_withdrawals_action is a previously created treasury_withdrawals_action object
+ *
+ * size_t ref_count = cardano_treasury_withdrawals_action_refcount(treasury_withdrawals_action);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_treasury_withdrawals_action_refcount(const cardano_treasury_withdrawals_action_t* treasury_withdrawals_action);
+
+/**
+ * \brief Sets the last error message for a given cardano_treasury_withdrawals_action_t object.
+ *
+ * Records an error message in the treasury_withdrawals_action's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] treasury_withdrawals_action A pointer to the \ref cardano_treasury_withdrawals_action_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the treasury_withdrawals_action's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_treasury_withdrawals_action_set_last_error(
+  cardano_treasury_withdrawals_action_t* treasury_withdrawals_action,
+  const char*                            message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific treasury_withdrawals_action.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_treasury_withdrawals_action_set_last_error for the given
+ * treasury_withdrawals_action. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] treasury_withdrawals_action A pointer to the \ref cardano_treasury_withdrawals_action_t instance whose last error
+ *                   message is to be retrieved. If the treasury_withdrawals_action is NULL, the function
+ *                   returns a generic error message indicating the null treasury_withdrawals_action.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified treasury_withdrawals_action. If the treasury_withdrawals_action is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_treasury_withdrawals_action_set_last_error for the same treasury_withdrawals_action, or until
+ *       the treasury_withdrawals_action is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_treasury_withdrawals_action_get_last_error(
+  const cardano_treasury_withdrawals_action_t* treasury_withdrawals_action);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_treasury_withdrawals_action_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_treasury_withdrawals_action_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_treasury_withdrawals_action_deep_clone(const cardano_treasury_withdrawals_action_t* source, cardano_treasury_withdrawals_action_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // TREASURY_WITHDRAWALS_ACTION_H
diff --git a/vendor/include/cardano/proposal_procedures/update_committee_action.h b/vendor/include/cardano/proposal_procedures/update_committee_action.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/proposal_procedures/update_committee_action.h
@@ -0,0 +1,678 @@
+/**
+ * \file update_committee_action.h
+ *
+ * \author angel.castillo
+ * \date   Aug 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef UPDATE_COMMITTEE_ACTION_H
+#define UPDATE_COMMITTEE_ACTION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/governance_action_id.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/proposal_procedures/committee_members_map.h>
+#include <cardano/proposal_procedures/credential_set.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Modifies the composition of the constitutional committee, its signature threshold, or its terms of operation.
+ */
+typedef struct cardano_update_committee_action_t cardano_update_committee_action_t;
+
+/**
+ * \brief Creates and initializes a new instance of the Update Committee Action.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_update_committee_action_t object,
+ * which represents an action to update the constitutional committee within the Cardano network. This action includes
+ * specifying members to be added and removed, as well as updating the quorum threshold.
+ *
+ * The action requires a governance action ID to reference the most recent enacted action of the
+ * same type. You can retrieve this information from the gov-state query:
+ *
+ * \code{.sh}
+ * cardano-cli conway query gov-state | jq .nextRatifyState.nextEnactState.prevGovActionIds
+ * \endcode
+ *
+ * Example output:
+ * \code{.json}
+ * {
+ *   "Committee": {
+ *     "govActionIx": 0,
+ *     "txId": "6bff8515060c08e9cae4d4e203a4d8b2e876848aae8c4e896acda7202d3ac679"
+ *   },
+ *   "Constitution": null,
+ *   "HardFork": null,
+ *   "PParamUpdate": {
+ *     "govActionIx": 0,
+ *     "txId": "7e199d036f1e8d725ea8aba30c5f8d0d2ab9dbd45c7f54e7d85c92c022673f0f"
+ *   }
+ * }
+ * \endcode
+ *
+ * \param[in] members_to_be_removed A pointer to a \ref cardano_credential_set_t object representing the committee members to be removed.
+ * \param[in] members_to_be_added A pointer to a \ref cardano_committee_members_map_t object representing the committee members to be added.
+ * \param[in] new_quorum A pointer to a \ref cardano_unit_interval_t object representing the new quorum threshold for the committee.
+ * \param[in] governance_action_id An optional pointer to a \ref cardano_governance_action_id_t object representing the last enacted action
+ *                                 of the same type. It can be NULL if no governance action of this type has been enacted.
+ * \param[out] update_committee_action On successful initialization, this will point to a newly created
+ *             \ref cardano_update_committee_action_t object. This object represents a "strong reference"
+ *             to the update committee action, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object;
+ *             specifically, once the update committee action is no longer needed, the caller must release it
+ *             by calling \ref cardano_update_committee_action_unref.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the update committee action was
+ *         successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_set_t* members_to_be_removed = cardano_credential_set_new(...); // Assume initialized
+ * cardano_committee_members_map_t* members_to_be_added = cardano_committee_members_map_new(...); // Assume initialized
+ * cardano_unit_interval_t* new_quorum = cardano_unit_interval_new(...); // Assume initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...); // Optionally initialized
+ * cardano_update_committee_action_t* update_committee_action = NULL;
+ * cardano_error_t result = cardano_update_committee_action_new(members_to_be_removed, members_to_be_added, new_quorum, governance_action_id, &update_committee_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the update committee action
+ *   // Free resources when done
+ *   cardano_update_committee_action_unref(&update_committee_action);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the update committee action: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup the inputs
+ * cardano_credential_set_unref(&members_to_be_removed);
+ * cardano_committee_members_map_unref(&members_to_be_added);
+ * cardano_unit_interval_unref(&new_quorum);
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_committee_action_new(
+  cardano_credential_set_t*           members_to_be_removed,
+  cardano_committee_members_map_t*    members_to_be_added,
+  cardano_unit_interval_t*            new_quorum,
+  cardano_governance_action_id_t*     governance_action_id,
+  cardano_update_committee_action_t** update_committee_action);
+
+/**
+ * \brief Creates a \ref cardano_update_committee_action_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_update_committee_action_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a update_committee_action.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] update_committee_action A pointer to a pointer of \ref cardano_update_committee_action_t that will be set to the address
+ *                        of the newly created update_committee_action object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_update_committee_action_t object by calling
+ *       \ref cardano_update_committee_action_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_update_committee_action_t* update_committee_action = NULL;
+ *
+ * cardano_error_t result = cardano_update_committee_action_from_cbor(reader, &update_committee_action);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the update_committee_action
+ *
+ *   // Once done, ensure to clean up and release the update_committee_action
+ *   cardano_update_committee_action_unref(&update_committee_action);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode update_committee_action: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_committee_action_from_cbor(cardano_cbor_reader_t* reader, cardano_update_committee_action_t** update_committee_action);
+
+/**
+ * \brief Serializes the certificate into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_update_committee_action_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] update_committee_action A constant pointer to the \ref cardano_update_committee_action_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p update_committee_action or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_committee_action_t* update_committee_action = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_update_committee_action_to_cbor(update_committee_action, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_update_committee_action_unref(&update_committee_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_update_committee_action_to_cbor(
+  const cardano_update_committee_action_t* update_committee_action,
+  cardano_cbor_writer_t*                   writer);
+
+/**
+ * \brief Serializes an update committee action to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in order: "tag", "gov_action_id" (if present),
+ * "members_to_remove", "committee", "signature_threshold".
+ *
+ * \param[in]  action  Pointer to a valid \ref cardano_update_committee_action_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p action or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_update_committee_action_to_cip116_json(
+  const cardano_update_committee_action_t* action,
+  cardano_json_writer_t*                   writer);
+
+/**
+ * \brief Sets the members to be removed in the update committee action.
+ *
+ * This function updates the list of members to be removed from a constitutional committee within a \ref cardano_update_committee_action_t object.
+ * It takes a set of credentials identifying the members that are no longer part of the committee.
+ *
+ * \param[in,out] update_committee_action A pointer to an initialized \ref cardano_update_committee_action_t object to which the members to be removed will be set.
+ * \param[in] members_to_be_removed A pointer to an initialized \ref cardano_credential_set_t object representing the committee members to be removed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the members to be removed were
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         update_committee_action pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_committee_action_t* update_committee_action = ...; // Assume update_committee_action is already initialized
+ * cardano_credential_set_t* members_to_be_removed = cardano_credential_set_new(...); // Assume members_to_be_removed is initialized
+ *
+ * cardano_error_t result = cardano_update_committee_action_set_members_to_be_removed(update_committee_action, members_to_be_removed);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The members to be removed are now set for the update committee action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the members to be removed.\n");
+ * }
+ *
+ * // Cleanup the update_committee_action and members_to_be_removed after use
+ * cardano_update_committee_action_unref(&update_committee_action);
+ * cardano_credential_set_unref(&members_to_be_removed);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_committee_action_set_members_to_be_removed(cardano_update_committee_action_t* update_committee_action, cardano_credential_set_t* members_to_be_removed);
+
+/**
+ * \brief Retrieves the set of members to be removed from the update committee action.
+ *
+ * This function retrieves the set of members to be removed from a given \ref cardano_update_committee_action_t object.
+ * The members to be removed are represented as a \ref cardano_credential_set_t object.
+ *
+ * \param[in] update_committee_action A pointer to an initialized \ref cardano_update_committee_action_t object from which the members to be removed are retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_credential_set_t object representing the members to be removed.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_credential_set_unref
+ *         when it is no longer needed. If the update_committee_action does not have members set to be removed, NULL is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_committee_action_t* update_committee_action = ...; // Assume initialized
+ * cardano_credential_set_t* members_to_be_removed = cardano_update_committee_action_get_members_to_be_removed(update_committee_action);
+ *
+ * if (members_to_be_removed != NULL)
+ * {
+ *   // Process the members to be removed
+ *   // Display, modify, or use the credentials in some way
+ *
+ *   // Once done, ensure to clean up and release the members to be removed
+ *   cardano_credential_set_unref(&members_to_be_removed);
+ * }
+ * else
+ * {
+ *   printf("ERROR: No members to be removed are set for this update committee action.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_set_t*
+cardano_update_committee_action_get_members_to_be_removed(cardano_update_committee_action_t* update_committee_action);
+
+/**
+ * \brief Sets the members to be added in the update committee action.
+ *
+ * This function updates the set of members to be added to a \ref cardano_update_committee_action_t object.
+ * The members to be added are represented as a \ref cardano_committee_members_map_t object.
+ *
+ * \param[in,out] update_committee_action A pointer to an initialized \ref cardano_update_committee_action_t object to which the members to be added will be set.
+ * \param[in] members_to_be_added A pointer to an initialized \ref cardano_committee_members_map_t object representing the new members to be added. This parameter
+ *            can be NULL if the members to be added are to be unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the members were
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         update_committee_action pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_committee_action_t* update_committee_action = ...; // Assume update_committee_action is already initialized
+ * cardano_committee_members_map_t* members_to_be_added = cardano_committee_members_map_new(...); // Assume members_to_be_added is initialized
+ *
+ * cardano_error_t result = cardano_update_committee_action_set_members_to_be_added(update_committee_action, members_to_be_added);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The new members are now set for the update committee action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the new members.\n");
+ * }
+ *
+ * // Cleanup the update_committee_action and members_to_be_added after use
+ * cardano_update_committee_action_unref(&update_committee_action);
+ * if (members_to_be_added)
+ * {
+ *   cardano_committee_members_map_unref(&members_to_be_added);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_committee_action_set_members_to_be_added(cardano_update_committee_action_t* update_committee_action, cardano_committee_members_map_t* members_to_be_added);
+
+/**
+ * \brief Retrieves the members to be added from an update committee action.
+ *
+ * This function retrieves the set of members to be added from a given \ref cardano_update_committee_action_t object.
+ * The members to be added are represented as a \ref cardano_committee_members_map_t object.
+ *
+ * \param[in] update_committee_action A pointer to an initialized \ref cardano_update_committee_action_t object from which the members to be added are retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_committee_members_map_t object representing the members to be added.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_committee_members_map_unref
+ *         when it is no longer needed. If the update_committee_action does not have members to be added set, NULL is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_committee_action_t* update_committee_action = ...; // Assume initialized
+ * cardano_committee_members_map_t* members_to_be_added = cardano_update_committee_action_get_members_to_be_added(update_committee_action);
+ *
+ * if (members_to_be_added != NULL)
+ * {
+ *   // Use the members to be added
+ *
+ *   // Once done, ensure to clean up and release the members to be added
+ *   cardano_committee_members_map_unref(&members_to_be_added);
+ * }
+ * else
+ * {
+ *   printf("No members to be added are set for this update committee action.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_committee_members_map_t*
+cardano_update_committee_action_get_members_to_be_added(cardano_update_committee_action_t* update_committee_action);
+
+/**
+ * \brief Sets the quorum in an update committee action.
+ *
+ * This function updates the quorum of a \ref cardano_update_committee_action_t object.
+ * The quorum is represented as a \ref cardano_unit_interval_t object, which specifies the minimum percentage of committee
+ * members that must participate for a vote to be valid.
+ *
+ * \param[in,out] update_committee_action A pointer to an initialized \ref cardano_update_committee_action_t object to which the quorum will be set.
+ * \param[in] quorum A pointer to an initialized \ref cardano_unit_interval_t object representing the new quorum threshold.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the quorum was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the
+ *         input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_committee_action_t* update_committee_action = ...; // Assume update_committee_action is already initialized
+ * cardano_unit_interval_t* quorum = cardano_unit_interval_new(...); // Assume quorum is already initialized
+ *
+ * cardano_error_t result = cardano_update_committee_action_set_quorum(update_committee_action, quorum);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The quorum is now set for the update committee action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the quorum.\n");
+ * }
+ *
+ * // Cleanup the update_committee_action and quorum after use
+ * cardano_unit_interval_unref(&quorum);
+ * cardano_update_committee_action_unref(&update_committee_action);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_committee_action_set_quorum(cardano_update_committee_action_t* update_committee_action, cardano_unit_interval_t* quorum);
+
+/**
+ * \brief Retrieves the quorum from an update committee action.
+ *
+ * This function fetches the quorum threshold set within a \ref cardano_update_committee_action_t object.
+ * The quorum is represented as a \ref cardano_unit_interval_t object, detailing the minimum percentage of committee
+ * members required for a vote to be valid.
+ *
+ * \param[in] update_committee_action A pointer to an initialized \ref cardano_update_committee_action_t object from which the quorum is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_unit_interval_t object representing the quorum threshold.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_unit_interval_unref
+ *         when it is no longer needed. If the update_committee_action does not have a quorum set, NULL is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_committee_action_t* update_committee_action = ...; // Assume initialized
+ * cardano_unit_interval_t* quorum = cardano_update_committee_action_get_quorum(update_committee_action);
+ *
+ * if (quorum != NULL)
+ * {
+ *   printf("Quorum Threshold: %u/%u\n", quorum->numerator, quorum->denominator);
+ *   // Use the quorum threshold
+ *
+ *   // Once done, ensure to clean up and release the quorum threshold
+ *   cardano_unit_interval_unref(&quorum);
+ * }
+ * else
+ * {
+ *   printf("No quorum threshold set for this update committee action.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t*
+cardano_update_committee_action_get_quorum(cardano_update_committee_action_t* update_committee_action);
+
+/**
+ * \brief Sets the governance action ID in the update_committee_action.
+ *
+ * This function updates the governance action ID of a \ref cardano_update_committee_action_t object.
+ * The governance action ID is a \ref cardano_governance_action_id_t object representing the last enacted action of the same type.
+ *
+ * \param[in,out] update_committee_action A pointer to an initialized \ref cardano_update_committee_action_t object to which the governance action ID will be set.
+ * \param[in] governance_action_id A pointer to an initialized \ref cardano_governance_action_id_t object representing the last enacted action of the same type. This parameter
+ *            can be NULL if the governance action ID is to be unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the governance action ID was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         update_committee_action pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_committee_action_t* update_committee_action = ...; // Assume update_committee_action is already initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...); // Optionally initialized
+ *
+ * cardano_error_t result = cardano_update_committee_action_set_governance_action_id(update_committee_action, governance_action_id);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The governance action ID is now set for the update_committee_action
+ * }
+ * else
+ * {
+ *   printf("Failed to set the governance action ID.\n");
+ * }
+ *
+ * // Cleanup the update_committee_action and optionally the governance action ID
+ * cardano_update_committee_action_unref(&update_committee_action);
+ *
+ * if (governance_action_id)
+ * {
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_committee_action_set_governance_action_id(cardano_update_committee_action_t* update_committee_action, cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves the governance action ID from a update_committee_action.
+ *
+ * This function retrieves the governance action ID from a given \ref cardano_update_committee_action_t object. The governance action ID
+ * is represented as a \ref cardano_governance_action_id_t object.
+ *
+ * \param[in] update_committee_action A pointer to an initialized \ref cardano_update_committee_action_t object from which the governance action ID is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_governance_action_id_t object representing the governance action ID.
+ *         This will be a new reference, and the caller is responsible for releasing it with \ref cardano_governance_action_id_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_committee_action_t* update_committee_action = ...; // Assume initialized
+ * cardano_governance_action_id_t* governance_action_id = cardano_update_committee_action_get_governance_action_id(update_committee_action);
+ *
+ * if (governance_action_id != NULL)
+ * {
+ *   printf("Governance Action ID: %u\n", cardano_governance_action_id_to_uint(governance_action_id));
+ *   // Use the governance action ID
+ *
+ *   // Once done, ensure to clean up and release the governance action ID
+ *   cardano_governance_action_id_unref(&governance_action_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_governance_action_id_t*
+cardano_update_committee_action_get_governance_action_id(cardano_update_committee_action_t* update_committee_action);
+
+/**
+ * \brief Decrements the reference count of a cardano_update_committee_action_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_update_committee_action_t object
+ * by decreasing its reference count. When the reference count reaches zero, the update_committee_action is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] update_committee_action A pointer to the pointer of the update_committee_action object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_committee_action_t* update_committee_action = cardano_update_committee_action_new(major, minor);
+ *
+ * // Perform operations with the update_committee_action...
+ *
+ * cardano_update_committee_action_unref(&update_committee_action);
+ * // At this point, update_committee_action is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_update_committee_action_unref, the pointer to the \ref cardano_update_committee_action_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_update_committee_action_unref(cardano_update_committee_action_t** update_committee_action);
+
+/**
+ * \brief Increases the reference count of the cardano_update_committee_action_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_update_committee_action_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_update_committee_action_unref.
+ *
+ * \param update_committee_action A pointer to the cardano_update_committee_action_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming update_committee_action is a previously created update_committee_action object
+ *
+ * cardano_update_committee_action_ref(update_committee_action);
+ *
+ * // Now update_committee_action can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_update_committee_action_ref there is a corresponding
+ * call to \ref cardano_update_committee_action_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_update_committee_action_ref(cardano_update_committee_action_t* update_committee_action);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_update_committee_action_t object.
+ *
+ * This function returns the number of active references to an cardano_update_committee_action_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_update_committee_action_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param update_committee_action A pointer to the cardano_update_committee_action_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_update_committee_action_t object. If the object
+ * is properly managed (i.e., every \ref cardano_update_committee_action_ref call is matched with a
+ * \ref cardano_update_committee_action_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming update_committee_action is a previously created update_committee_action object
+ *
+ * size_t ref_count = cardano_update_committee_action_refcount(update_committee_action);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_update_committee_action_refcount(const cardano_update_committee_action_t* update_committee_action);
+
+/**
+ * \brief Sets the last error message for a given cardano_update_committee_action_t object.
+ *
+ * Records an error message in the update_committee_action's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] update_committee_action A pointer to the \ref cardano_update_committee_action_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the update_committee_action's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_update_committee_action_set_last_error(
+  cardano_update_committee_action_t* update_committee_action,
+  const char*                        message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific update_committee_action.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_update_committee_action_set_last_error for the given
+ * update_committee_action. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] update_committee_action A pointer to the \ref cardano_update_committee_action_t instance whose last error
+ *                   message is to be retrieved. If the update_committee_action is NULL, the function
+ *                   returns a generic error message indicating the null update_committee_action.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified update_committee_action. If the update_committee_action is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_update_committee_action_set_last_error for the same update_committee_action, or until
+ *       the update_committee_action is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_update_committee_action_get_last_error(
+  const cardano_update_committee_action_t* update_committee_action);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_update_committee_action_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_update_committee_action_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_update_committee_action_deep_clone(const cardano_update_committee_action_t* source, cardano_update_committee_action_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // UPDATE_COMMITTEE_ACTION_H
diff --git a/vendor/include/cardano/protocol_params/cost_model.h b/vendor/include/cardano/protocol_params/cost_model.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/protocol_params/cost_model.h
@@ -0,0 +1,559 @@
+/**
+ * \file cost_model.h
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_COST_MODEL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_COST_MODEL_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/scripts/plutus_scripts/plutus_language_version.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The execution of plutus scripts consumes resources. To make sure that these
+ * scripts don't run indefinitely or consume excessive resources (which would be
+ * harmful to the network), Cardano introduces the concept of "cost models".
+ *
+ * Cost models are in place to provide predictable pricing for script execution.
+ *
+ * It's a way to gauge how much resource (in terms of computational steps or memory)
+ * a script would use.
+ */
+typedef struct cardano_cost_model_t cardano_cost_model_t;
+
+/**
+ * \brief Creates and initializes a new instance of the Cost Model for a specific Plutus language version.
+ *
+ * This function allocates and initializes a new instance of the Cost Model based on the specified Plutus language version,
+ * which is used to predict and control the computational cost of executing Plutus scripts on the Cardano blockchain.
+ *
+ * \param[in] language The Plutus language version for which the cost model is being created. It must be one of
+ *                     the versions of \ref cardano_plutus_language_version_t.
+ * \param[in] cost_array An array of integers representing the cost associated with each operation in the Plutus script.
+ * \param[in] costs_size The size of the cost_array, indicating the number of operations covered by the cost model.
+ * \param[out] cost_model On successful initialization, this will point to a newly created
+ *                        \ref cardano_cost_model_t object. This object represents a "strong reference",
+ *                        meaning that it is fully initialized and ready for use.
+ *                        The caller is responsible for managing the lifecycle of this object.
+ *                        Specifically, once the Cost Model is no longer needed, the caller must release it
+ *                        by calling \ref cardano_cost_model_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Cost Model was successfully created, \ref CARDANO_ERROR_INVALID_PLUTUS_COST_MODEL if the
+ *         language is not a known Plutus language version or there are more than 2048 costs, or an appropriate
+ *         error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cost_model_t* cost_model = NULL;
+ * cardano_plutus_language_version_t language = CARDANO_PLUTUS_LANGUAGE_VERSION_V1;
+ * int64_t cost_array[] = { 1, 2, 3 ... }; // Example costs for operations
+ * size_t costs_size = sizeof(cost_array) / sizeof(cost_array[0]);
+ *
+ * cardano_error_t result = cardano_cost_model_new(language, cost_array, costs_size, &cost_model);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the cost_model
+ *
+ *   // Once done, ensure to clean up and release the cost_model
+ *   cardano_cost_model_unref(&cost_model);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_cost_model_new(
+  cardano_plutus_language_version_t language,
+  const int64_t*                    cost_array,
+  size_t                            costs_size,
+  cardano_cost_model_t**            cost_model);
+
+/**
+ * \brief Creates a \ref cardano_cost_model_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_cost_model_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a cost_model.
+ *
+ * The language id may be any value from 0 to 255, as the ledger accepts cost models for languages it does not know yet.
+ * A cost model for an unknown language keeps its language id and costs, and encodes back unchanged; its language id
+ * can be read with \ref cardano_cost_model_get_language_id.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] cost_model A pointer to a pointer of \ref cardano_cost_model_t that will be set to the address
+ *                        of the newly created cost_model object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Cost Model were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_cost_model_t object by calling
+ *       \ref cardano_cost_model_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_cost_model_t* cost_model = NULL;
+ *
+ * cardano_error_t result = cardano_cost_model_from_cbor(reader, &cost_model);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the cost_model
+ *
+ *   // Once done, ensure to clean up and release the cost_model
+ *   cardano_cost_model_unref(&cost_model);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode cost_model: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_cost_model_from_cbor(cardano_cbor_reader_t* reader, cardano_cost_model_t** cost_model);
+
+/**
+ * \brief Serializes Cost Model into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_cost_model_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] cost_model A constant pointer to the \ref cardano_cost_model_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p cost_model or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cost_model_t* cost_model = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_cost_model_to_cbor(cost_model, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_cost_model_unref(&cost_model);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cost_model_to_cbor(
+  const cardano_cost_model_t* cost_model,
+  cardano_cbor_writer_t*      writer);
+
+/**
+ * \brief Serializes a cost model to CIP-116 JSON.
+ *
+ * The function writes a JSON array containing the cost model parameters.
+ * Each parameter is written as a string representation of the integer value.
+ *
+ * \param[in]  cost_model Pointer to a valid \ref cardano_cost_model_t.
+ * \param[in]  writer     Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p cost_model or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_cost_model_to_cip116_json(
+  const cardano_cost_model_t* cost_model,
+  cardano_json_writer_t*      writer);
+
+/**
+ * \brief Sets the cost for a specific operation in the Cost Model.
+ *
+ * This function updates the Cost Model with the cost for a specific operation. It modifies the
+ * cost associated with an operation in the array of costs maintained by the Cost Model object.
+ *
+ * \param[in] cost_model Pointer to the Cost Model object.
+ * \param[in] operation The index of the operation for which the cost is to be set.
+ * \param[in] cost The cost value to be set for the specified operation.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the cost was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cost_model_t* cost_model = NULL;
+ * // Assume cost_model is initialized properly
+ *
+ * size_t operation = 5;  // Example operation index
+ * int64_t cost = 100;    // Example cost for the operation
+ * cardano_error_t result = cardano_cost_model_set_cost(cost_model, operation, cost);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     printf("Cost for operation %zu set successfully.\n", operation);
+ * }
+ * else
+ * {
+ *     printf("Failed to set cost for operation %zu.\n", operation);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cost_model_set_cost(
+  cardano_cost_model_t* cost_model,
+  size_t                operation,
+  int64_t               cost);
+
+/**
+ * \brief Retrieves the cost associated with a specific operation in the Cost Model.
+ *
+ * This function fetches the cost of a specific operation as defined in the Cost Model.
+ * The cost is stored in the variable pointed to by the `cost` parameter.
+ *
+ * \param[in] cost_model Pointer to the Cost Model object.
+ * \param[in] operation The index of the operation whose cost is to be retrieved.
+ * \param[out] cost Pointer to an integer where the cost of the operation will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the cost was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cost_model_t* cost_model = NULL;
+ * // Assume cost_model is initialized properly
+ *
+ * size_t operation = 5;  // Example operation index
+ * int64_t cost;          // Variable to store the retrieved cost
+ * cardano_error_t result = cardano_cost_model_get_cost(cost_model, operation, &cost);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     printf("Cost for operation %zu is %ld.\n", operation, cost);
+ * }
+ * else
+ * {
+ *     printf("Failed to retrieve cost for operation %zu.\n", operation);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cost_model_get_cost(const cardano_cost_model_t* cost_model, size_t operation, int64_t* cost);
+
+/**
+ * \brief Retrieves the size of the costs array in the Cost Model.
+ *
+ * This function returns the number of operations and their associated costs stored in the Cost Model,
+ * effectively indicating the number of different operational costs the model covers.
+ *
+ * \param[in] cost_model Pointer to the Cost Model object.
+ *
+ * \return The number of entries in the cost model's costs array, representing the total number of operations
+ *         for which costs are defined.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cost_model_t* cost_model = NULL;
+ * // Assume cost_model is initialized properly
+ *
+ * size_t costs_size = cardano_cost_model_get_costs_size(cost_model);
+ * printf("The cost model contains costs for %zu operations.\n", costs_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_cost_model_get_costs_size(const cardano_cost_model_t* cost_model);
+
+/**
+ * \brief Retrieves a pointer to the costs array in the Cost Model.
+ *
+ * This function provides direct read-only access to the internal array representing the costs of operations
+ * within the Cost Model. This array contains the computational costs associated with various operations as
+ * defined by the Plutus script execution environment.
+ *
+ * \param[in] cost_model Pointer to the Cost Model object.
+ *
+ * \return A constant pointer to the first element of the internal costs array. The size of this array can
+ *         be determined using \ref cardano_cost_model_get_costs_size function.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cost_model_t* cost_model = NULL;
+ * // Assume cost_model is initialized properly
+ *
+ * const int64_t* costs = cardano_cost_model_get_costs(cost_model);
+ * size_t size = cardano_cost_model_get_costs_size(cost_model);
+ *
+ * for (size_t i = 0; i < size; ++i)
+ * {
+ *   printf("Cost of operation %zu: %ld\n", i, costs[i]);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const int64_t* cardano_cost_model_get_costs(const cardano_cost_model_t* cost_model);
+
+/**
+ * \brief Retrieves the Plutus language version of the Cost Model.
+ *
+ * This function returns the Plutus language version used by the Cost Model. The Plutus language version
+ * determines the set of operations and their associated costs specific to a version of the Cardano protocol
+ * for executing Plutus scripts.
+ *
+ * \param[in]  cost_model Pointer to the Cost Model object.
+ * \param[out] language   Pointer to a variable where the language version will be stored upon successful return.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the language version was successfully retrieved, \ref CARDANO_ERROR_INVALID_PLUTUS_COST_MODEL if the
+ *         cost model is for a language id that is not a known Plutus language version, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cost_model_t* cost_model = NULL;
+ * cardano_plutus_language_version_t language;
+ *
+ * // Assume cost_model is initialized properly
+ * cardano_error_t result = cardano_cost_model_get_language(cost_model, &language);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Plutus Language Version: %d\n", language);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve language version.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cost_model_get_language(
+  const cardano_cost_model_t*        cost_model,
+  cardano_plutus_language_version_t* language);
+
+/**
+ * \brief Retrieves the raw language id of the Cost Model.
+ *
+ * The language id is the key of the cost model in the cost models map. Ids 0 to 3 are the Plutus language versions
+ * of \ref cardano_plutus_language_version_t; any other id up to 255 is a language this library does not know yet,
+ * which the ledger accepts in cost models.
+ *
+ * \param[in]  cost_model  Pointer to the Cost Model object.
+ * \param[out] language_id Pointer to a variable where the language id will be stored upon successful return.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the language id was successfully retrieved, or \ref CARDANO_ERROR_POINTER_IS_NULL if any of
+ *         the given pointers is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cost_model_t* cost_model = NULL;
+ * uint8_t language_id = 0U;
+ *
+ * // Assume cost_model is initialized properly
+ * cardano_error_t result = cardano_cost_model_get_language_id(cost_model, &language_id);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Language id: %u\n", language_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_cost_model_get_language_id(
+  const cardano_cost_model_t* cost_model,
+  uint8_t*                    language_id);
+
+/**
+ * \brief Decrements the reference count of a cardano_cost_model_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_cost_model_t object
+ * by decreasing its reference count. When the reference count reaches zero, the cost_model is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] cost_model A pointer to the pointer of the cost_model object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cost_model_t* cost_model = cardano_cost_model_new(major, minor);
+ *
+ * // Perform operations with the cost_model...
+ *
+ * cardano_cost_model_unref(&cost_model);
+ * // At this point, cost_model is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_cost_model_unref, the pointer to the \ref cardano_cost_model_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_cost_model_unref(cardano_cost_model_t** cost_model);
+
+/**
+ * \brief Increases the reference count of the cardano_cost_model_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_cost_model_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_cost_model_unref.
+ *
+ * \param cost_model A pointer to the cardano_cost_model_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming cost_model is a previously created cost_model object
+ *
+ * cardano_cost_model_ref(cost_model);
+ *
+ * // Now cost_model can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_cost_model_ref there is a corresponding
+ * call to \ref cardano_cost_model_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_cost_model_ref(cardano_cost_model_t* cost_model);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_cost_model_t object.
+ *
+ * This function returns the number of active references to an cardano_cost_model_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_cost_model_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param cost_model A pointer to the cardano_cost_model_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_cost_model_t object. If the object
+ * is properly managed (i.e., every \ref cardano_cost_model_ref call is matched with a
+ * \ref cardano_cost_model_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming cost_model is a previously created cost_model object
+ *
+ * size_t ref_count = cardano_cost_model_refcount(cost_model);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_cost_model_refcount(const cardano_cost_model_t* cost_model);
+
+/**
+ * \brief Sets the last error message for a given cardano_cost_model_t object.
+ *
+ * Records an error message in the cost_model's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] cost_model A pointer to the \ref cardano_cost_model_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the cost_model's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_cost_model_set_last_error(
+  cardano_cost_model_t* cost_model,
+  const char*           message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific cost_model.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_cost_model_set_last_error for the given
+ * cost_model. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] cost_model A pointer to the \ref cardano_cost_model_t instance whose last error
+ *                   message is to be retrieved. If the cost_model is NULL, the function
+ *                   returns a generic error message indicating the null cost_model.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified cost_model. If the cost_model is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_cost_model_set_last_error for the same cost_model, or until
+ *       the cost_model is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_cost_model_get_last_error(
+  const cardano_cost_model_t* cost_model);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_cost_model_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_cost_model_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_cost_model_deep_clone(const cardano_cost_model_t* source, cardano_cost_model_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_COST_MODEL_H
diff --git a/vendor/include/cardano/protocol_params/costmdls.h b/vendor/include/cardano/protocol_params/costmdls.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/protocol_params/costmdls.h
@@ -0,0 +1,547 @@
+/**
+ * \file costmdls.h
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_COSTMDLS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_COSTMDLS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/protocol_params/cost_model.h>
+#include <cardano/scripts/plutus_scripts/plutus_language_version.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The execution of plutus scripts consumes resources. To make sure that these
+ * scripts don't run indefinitely or consume excessive resources (which would be
+ * harmful to the network), Cardano introduces the concept of "cost models".
+ *
+ * Cost models are in place to provide predictable pricing for script execution.
+ *
+ * It's a way to gauge how much resource (in terms of computational steps or memory)
+ * a script would use.
+ */
+typedef struct cardano_costmdls_t cardano_costmdls_t;
+
+/**
+ * \brief Initializes a new instance of the \ref cardano_costmdls_t type.
+ *
+ * This function allocates and initializes a new instance of the \ref cardano_costmdls_t type,
+ * which holds a map of Plutus language versions to their respective Cost Models.
+ *
+ * \param[out] costmdls On successful initialization, this will point to a newly created
+ *            \ref cardano_costmdls_t object. This object represents a "strong reference",
+ *            meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the \ref cardano_costmdls_t is no longer needed, the caller must release it
+ *            by calling \ref cardano_costmdls_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the \ref cardano_costmdls_t was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_costmdls_t* costmdls = NULL;
+ *
+ * // Attempt to create a new cardano_costmdls_t object
+ * cardano_error_t result = cardano_costmdls_new(&costmdls);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the costmdls
+ *
+ *   // Once done, ensure to clean up and release the costmdls
+ *   cardano_costmdls_unref(&costmdls);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_costmdls_new(cardano_costmdls_t** costmdls);
+
+/**
+ * \brief Creates a \ref cardano_costmdls_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_costmdls_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a costmdls.
+ *
+ * The map may hold cost models for any language id from 0 to 255, as the ledger accepts cost models for languages it
+ * does not know yet. Cost models for unknown languages are kept and encoded back by \ref cardano_costmdls_to_cbor, but
+ * they are never part of the language views. If the map holds the same language id more than once, the last entry wins.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] costmdls A pointer to a pointer of \ref cardano_costmdls_t that will be set to the address
+ *                        of the newly created costmdls object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Cost Model were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_costmdls_t object by calling
+ *       \ref cardano_costmdls_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_costmdls_t* costmdls = NULL;
+ *
+ * cardano_error_t result = cardano_costmdls_from_cbor(reader, &costmdls);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the costmdls
+ *
+ *   // Once done, ensure to clean up and release the costmdls
+ *   cardano_costmdls_unref(&costmdls);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode costmdls: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_costmdls_from_cbor(cardano_cbor_reader_t* reader, cardano_costmdls_t** costmdls);
+
+/**
+ * \brief Serializes Cost Model into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_costmdls_t object using a \ref cardano_cbor_writer_t.
+ * The cost models are written in ascending order of their language id, including the cost models of
+ * languages this library does not know yet.
+ *
+ * \param[in] costmdls A constant pointer to the \ref cardano_costmdls_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p costmdls or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_costmdls_t* costmdls = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_costmdls_to_cbor(costmdls, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_costmdls_unref(&costmdls);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_costmdls_to_cbor(
+  const cardano_costmdls_t* costmdls,
+  cardano_cbor_writer_t*    writer);
+
+/**
+ * \brief Serializes a collection of cost models to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are: "plutus_v1", "plutus_v2", "plutus_v3", "plutus_v4". Cost models of languages this library does
+ * not know yet have no CIP-116 representation and are not written.
+ *
+ * \param[in]  costmdls Pointer to a valid \ref cardano_costmdls_t.
+ * \param[in]  writer   Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p costmdls or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_costmdls_to_cip116_json(
+  const cardano_costmdls_t* costmdls,
+  cardano_json_writer_t*    writer);
+
+/**
+ * \brief Inserts a new Cost Model into the Costmdls map.
+ *
+ * This function inserts a new Cost Model into the Costmdls map. Each Cost Model is associated with a specific
+ * version of the Plutus language and contains the computational cost parameters used for script execution.
+ * The Cost Model is stored under its language id (see \ref cardano_cost_model_get_language_id), replacing any
+ * Cost Model already stored for that id; cost models of languages this library does not know yet are accepted.
+ *
+ * \param[in] costmdls Pointer to the Costmdls object.
+ * \param[in] cost_model Pointer to the Cost Model object to be inserted.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Cost Model was successfully inserted, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_costmdls_t* costmdls = NULL;
+ * cardano_cost_model_t* cost_model = NULL;
+ * // Assume costmdls and cost_model are initialized properly
+ *
+ * cardano_error_t result = cardano_costmdls_insert(costmdls, cost_model);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Cost Model inserted successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to insert Cost Model.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_costmdls_insert(
+  cardano_costmdls_t*   costmdls,
+  cardano_cost_model_t* cost_model);
+
+/**
+ * \brief Retrieves a specific Cost Model from the Costmdls map based on the Plutus language version.
+ *
+ * This function retrieves a Cost Model corresponding to a specific version of the Plutus language from
+ * the Costmdls map. It provides access to the computational cost parameters that are used for script execution
+ * for the specified language version.
+ *
+ * \param[in] costmdls Pointer to the Costmdls object from which the Cost Model is to be retrieved.
+ * \param[in] language The Plutus language version for which the Cost Model is required.
+ * \param[out] cost_model On successful retrieval, this will point to the Cost Model object associated with
+ *             the specified language version. The object represents a "strong reference" to the Cost Model,
+ *             meaning that it remains valid until the caller releases it using \ref cardano_cost_model_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Cost Model was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason (e.g., if no model exists for the specified language version).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_costmdls_t* costmdls = NULL;
+ * cardano_cost_model_t* cost_model = NULL;
+ * // Assume costmdls is initialized properly
+ *
+ * cardano_error_t result = cardano_costmdls_get(costmdls, CARDANO_PLUTUS_LANGUAGE_VERSION_V1, &cost_model);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the cost_model for computations
+ *   // Remember to release the cost_model after use
+ *   cardano_cost_model_unref(&cost_model);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve Cost Model for Plutus V1.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_costmdls_get(
+  cardano_costmdls_t*               costmdls,
+  cardano_plutus_language_version_t language,
+  cardano_cost_model_t**            cost_model);
+
+/**
+ * \brief Retrieves the Cost Model stored for a raw language id from the Costmdls map.
+ *
+ * Unlike \ref cardano_costmdls_get, this function also reaches the cost models of languages this library does not
+ * know yet (any language id from 4 to 255), which the ledger accepts in cost models. Ids 0 to 3 are the Plutus
+ * language versions of \ref cardano_plutus_language_version_t.
+ *
+ * \param[in] costmdls Pointer to the Costmdls object from which the Cost Model is to be retrieved.
+ * \param[in] language_id The language id for which the Cost Model is required.
+ * \param[out] cost_model On successful retrieval, this will point to the Cost Model object stored for the
+ *             language id, or to NULL if there is none. A non NULL object is a "strong reference" to the Cost Model,
+ *             meaning that it remains valid until the caller releases it using \ref cardano_cost_model_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the lookup was performed, or \ref CARDANO_ERROR_POINTER_IS_NULL if any of the given pointers is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_costmdls_t* costmdls = NULL;
+ * cardano_cost_model_t* cost_model = NULL;
+ * // Assume costmdls is initialized properly
+ *
+ * cardano_error_t result = cardano_costmdls_get_by_language_id(costmdls, 4U, &cost_model);
+ *
+ * if ((result == CARDANO_SUCCESS) && (cost_model != NULL))
+ * {
+ *   // Use the cost_model
+ *   // Remember to release the cost_model after use
+ *   cardano_cost_model_unref(&cost_model);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_costmdls_get_by_language_id(
+  cardano_costmdls_t*    costmdls,
+  uint8_t                language_id,
+  cardano_cost_model_t** cost_model);
+
+/**
+ * \brief Checks if a Cost Model for a specific Plutus language version exists in the Costmdls map.
+ *
+ * This function determines whether there is a Cost Model associated with a specific version of the
+ * Plutus language in the provided Costmdls map. It's useful for validating the presence of cost
+ * models before attempting to retrieve or use them in computations.
+ *
+ * \param[in] costmdls Pointer to the Costmdls object to be checked.
+ * \param[in] language The Plutus language version to check for.
+ *
+ * \return \c true if a Cost Model for the specified language version exists in the Costmdls map,
+ *         \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_costmdls_t* costmdls = NULL;
+ * // Assume costmdls is initialized properly
+ *
+ * bool exists = cardano_costmdls_has(costmdls, CARDANO_PLUTUS_V1);
+ *
+ * if (exists)
+ * {
+ *   printf("Cost Model for Plutus V1 exists.\n");
+ * }
+ * else
+ * {
+ *   printf("Cost Model for Plutus V1 does not exist.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_costmdls_has(
+  const cardano_costmdls_t*         costmdls,
+  cardano_plutus_language_version_t language);
+
+/**
+ * \brief Retrieves the language views encoding from the Costmdls object.
+ *
+ * This function encodes the costs models following the CDDL specification, necessary
+ * for computing the script data hash of a transaction. It encodes the costs associated
+ * with each Plutus language version in the Costmdls map in the appropriate CBOR format,
+ * following the rules defined for each version. Cost models of languages this library does not
+ * know yet are left out, as no script can use them.
+ *
+ * \param[in] costmdls Pointer to the Costmdls object whose language views are to be encoded.
+ * \param[out] language_views On successful encoding, this will point to a buffer containing
+ *                            the encoded language views. The caller is responsible for managing
+ *                            the lifecycle of this buffer, which includes releasing it
+ *                            using \ref cardano_buffer_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the language views were successfully encoded, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_costmdls_t* costmdls = NULL;
+ * // Assume costmdls is initialized and contains cost models for various language versions
+ * cardano_buffer_t* language_views = NULL;
+ *
+ * cardano_error_t result = cardano_costmdls_get_language_views_encoding(costmdls, &language_views);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the language_views buffer
+ *
+ *   // Once done, ensure to clean up and release the language_views
+ *   cardano_buffer_unref(&language_views);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_costmdls_get_language_views_encoding(
+  const cardano_costmdls_t* costmdls,
+  cardano_buffer_t**        language_views);
+
+/**
+ * \brief Decrements the reference count of a cardano_costmdls_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_costmdls_t object
+ * by decreasing its reference count. When the reference count reaches zero, the costmdls is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] costmdls A pointer to the pointer of the costmdls object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_costmdls_t* costmdls = cardano_costmdls_new(major, minor);
+ *
+ * // Perform operations with the costmdls...
+ *
+ * cardano_costmdls_unref(&costmdls);
+ * // At this point, costmdls is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_costmdls_unref, the pointer to the \ref cardano_costmdls_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_costmdls_unref(cardano_costmdls_t** costmdls);
+
+/**
+ * \brief Increases the reference count of the cardano_costmdls_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_costmdls_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_costmdls_unref.
+ *
+ * \param costmdls A pointer to the cardano_costmdls_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming costmdls is a previously created costmdls object
+ *
+ * cardano_costmdls_ref(costmdls);
+ *
+ * // Now costmdls can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_costmdls_ref there is a corresponding
+ * call to \ref cardano_costmdls_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_costmdls_ref(cardano_costmdls_t* costmdls);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_costmdls_t object.
+ *
+ * This function returns the number of active references to an cardano_costmdls_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_costmdls_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param costmdls A pointer to the cardano_costmdls_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_costmdls_t object. If the object
+ * is properly managed (i.e., every \ref cardano_costmdls_ref call is matched with a
+ * \ref cardano_costmdls_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming costmdls is a previously created costmdls object
+ *
+ * size_t ref_count = cardano_costmdls_refcount(costmdls);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_costmdls_refcount(const cardano_costmdls_t* costmdls);
+
+/**
+ * \brief Sets the last error message for a given cardano_costmdls_t object.
+ *
+ * Records an error message in the costmdls's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] costmdls A pointer to the \ref cardano_costmdls_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the costmdls's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_costmdls_set_last_error(
+  cardano_costmdls_t* costmdls,
+  const char*         message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific costmdls.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_costmdls_set_last_error for the given
+ * costmdls. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] costmdls A pointer to the \ref cardano_costmdls_t instance whose last error
+ *                   message is to be retrieved. If the costmdls is NULL, the function
+ *                   returns a generic error message indicating the null costmdls.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified costmdls. If the costmdls is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_costmdls_set_last_error for the same costmdls, or until
+ *       the costmdls is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_costmdls_get_last_error(
+  const cardano_costmdls_t* costmdls);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_costmdls_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_costmdls_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_costmdls_deep_clone(const cardano_costmdls_t* source, cardano_costmdls_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_COSTMDLS_H
diff --git a/vendor/include/cardano/protocol_params/drep_voting_thresholds.h b/vendor/include/cardano/protocol_params/drep_voting_thresholds.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/protocol_params/drep_voting_thresholds.h
@@ -0,0 +1,1191 @@
+/**
+ * \file drep_voting_thresholds.h
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_DREP_VOTING_THRESHOLDS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_DREP_VOTING_THRESHOLDS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Governance actions are ratified through on-chain voting. Different
+ * kinds of governance actions have different ratification requirements. One of those
+ * requirements is the approval of the action by DReps. These thresholds specify
+ * the percentage of the total active voting stake that must be meet by the DReps who vote Yes
+ * for the approval to be successful.
+ */
+typedef struct cardano_drep_voting_thresholds_t cardano_drep_voting_thresholds_t;
+
+/**
+ * \brief Creates and initializes a new instance of the DRep Voting Thresholds.
+ *
+ * This function allocates and initializes a new instance of the DRep Voting Thresholds,
+ * representing various quorum thresholds required for different governance actions.
+ *
+ * \param[in] motion_no_confidence The quorum threshold (percentage of the total active voting stake) that
+ *                                 needs to be met for a Motion of no-confidence to be enacted.
+ * \param[in] committee_normal The quorum threshold (percentage of the total active voting stake) that
+ *                             needs to be met for a new committee to be elected if the constitutional committee
+ *                             is in a state of confidence.
+ * \param[in] committee_no_confidence The quorum threshold (percentage of the total active voting stake) that
+ *                                    needs to be met for a new committee to be elected if the constitutional committee
+ *                                    is in a state of no-confidence.
+ * \param[in] update_constitution The quorum threshold (percentage of the total active voting stake) that
+ *                                needs to be met for a modification to the Constitution to be enacted.
+ * \param[in] hard_fork_initiation The quorum threshold (percentage of the total active voting stake) that
+ *                                 needs to be met to trigger a non-backwards compatible upgrade of the network
+ *                                 (requires a prior software upgrade).
+ * \param[in] pp_network_group The quorum threshold (percentage of the total active voting stake) that
+ *                             needs to be met to update the protocol parameters in the network group.
+ * \param[in] pp_economic_group The quorum threshold (percentage of the total active voting stake) that
+ *                              needs to be met to update the protocol parameters in the economic group.
+ * \param[in] pp_technical_group The quorum threshold (percentage of the total active voting stake) that
+ *                               needs to be met to update the protocol parameters in the technical group.
+ * \param[in] pp_governance_group The quorum threshold (percentage of the total active voting stake) that
+ *                                needs to be met to update the protocol parameters in the governance group.
+ * \param[in] treasury_withdrawal The quorum threshold (percentage of the total active voting stake) that
+ *                                needs to be met to withdraw from the treasury.
+ * \param[out] drep_voting_thresholds On successful initialization, this will point to a newly created
+ *                                    DRep Voting Thresholds object. This object represents a "strong reference",
+ *                                    meaning that it is fully initialized and ready for use.
+ *                                    The caller is responsible for managing the lifecycle of this object.
+ *                                    Specifically, once the DRep Voting Thresholds is no longer needed, the caller
+ *                                    must release it by calling \ref cardano_drep_voting_thresholds_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the DRep Voting Thresholds was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ * cardano_unit_interval_t* motion_no_confidence = NULL;
+ * cardano_unit_interval_t* committee_normal = NULL;
+ * cardano_unit_interval_t* committee_no_confidence = NULL;
+ * cardano_unit_interval_t* update_constitution = NULL;
+ * cardano_unit_interval_t* hard_fork_initiation = NULL;
+ * cardano_unit_interval_t* pp_network_group = NULL;
+ * cardano_unit_interval_t* pp_economic_group = NULL;
+ * cardano_unit_interval_t* pp_technical_group = NULL;
+ * cardano_unit_interval_t* pp_governance_group = NULL;
+ * cardano_unit_interval_t* treasury_withdrawal = NULL;
+ *
+ * // Assume the unit intervals are initialized properly
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_new(
+ *     motion_no_confidence,
+ *     committee_normal,
+ *     committee_no_confidence,
+ *     update_constitution,
+ *     hard_fork_initiation,
+ *     pp_network_group,
+ *     pp_economic_group,
+ *     pp_technical_group,
+ *     pp_governance_group,
+ *     treasury_withdrawal,
+ *     &drep_voting_thresholds);
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&motion_no_confidence);
+ * cardano_unit_interval_unref(&committee_normal);
+ * cardano_unit_interval_unref(&committee_no_confidence);
+ * cardano_unit_interval_unref(&update_constitution);
+ * cardano_unit_interval_unref(&hard_fork_initiation);
+ * cardano_unit_interval_unref(&pp_network_group);
+ * cardano_unit_interval_unref(&pp_economic_group);
+ * cardano_unit_interval_unref(&pp_technical_group);
+ * cardano_unit_interval_unref(&pp_governance_group);
+ * cardano_unit_interval_unref(&treasury_withdrawal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_drep_voting_thresholds_new(
+  cardano_unit_interval_t*           motion_no_confidence,
+  cardano_unit_interval_t*           committee_normal,
+  cardano_unit_interval_t*           committee_no_confidence,
+  cardano_unit_interval_t*           update_constitution,
+  cardano_unit_interval_t*           hard_fork_initiation,
+  cardano_unit_interval_t*           pp_network_group,
+  cardano_unit_interval_t*           pp_economic_group,
+  cardano_unit_interval_t*           pp_technical_group,
+  cardano_unit_interval_t*           pp_governance_group,
+  cardano_unit_interval_t*           treasury_withdrawal,
+  cardano_drep_voting_thresholds_t** drep_voting_thresholds);
+
+/**
+ * \brief Creates a \ref cardano_drep_voting_thresholds_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_drep_voting_thresholds_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a drep_voting_thresholds.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] drep_voting_thresholds A pointer to a pointer of \ref cardano_drep_voting_thresholds_t that will be set to the address
+ *                        of the newly created drep_voting_thresholds object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_drep_voting_thresholds_t object by calling
+ *       \ref cardano_drep_voting_thresholds_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_from_cbor(reader, &drep_voting_thresholds);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the drep_voting_thresholds
+ *
+ *   // Once done, ensure to clean up and release the drep_voting_thresholds
+ *   cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode drep_voting_thresholds: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_drep_voting_thresholds_from_cbor(cardano_cbor_reader_t* reader, cardano_drep_voting_thresholds_t** drep_voting_thresholds);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_drep_voting_thresholds_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] drep_voting_thresholds A constant pointer to the \ref cardano_drep_voting_thresholds_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p drep_voting_thresholds or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_drep_voting_thresholds_to_cbor(drep_voting_thresholds, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_to_cbor(
+  const cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_cbor_writer_t*                  writer);
+
+/**
+ * \brief Serializes DRep voting thresholds to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ *
+ * \param[in]  thresholds  Pointer to a valid \ref cardano_drep_voting_thresholds_t.
+ * \param[in]  writer      Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p thresholds or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_drep_voting_thresholds_to_cip116_json(
+  const cardano_drep_voting_thresholds_t* thresholds,
+  cardano_json_writer_t*                  writer);
+
+/**
+ * \brief Retrieves the quorum threshold for a motion of no-confidence.
+ *
+ * This function returns the quorum threshold necessary for a motion of no-confidence to be enacted, which is expressed
+ * as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[out] motion_no_confidence On successful retrieval, this will point to the quorum threshold
+ *                                  for a motion of no-confidence.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ * // Assume drep_voting_thresholds is initialized properly
+ * cardano_unit_interval_t* motion_no_confidence = NULL;
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_get_motion_no_confidence(drep_voting_thresholds, &motion_no_confidence);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Motion No Confidence Threshold: %f\n", cardano_unit_interval_to_double(motion_no_confidence));
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&motion_no_confidence);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_get_motion_no_confidence(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         motion_no_confidence);
+
+/**
+ * \brief Retrieves the quorum threshold for electing a new committee under normal conditions.
+ *
+ * This function returns the quorum threshold required for electing a new committee when the constitutional committee
+ * is in a state of confidence. The threshold is expressed as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[out] committee_normal On successful retrieval, this will point to the quorum threshold
+ *                              for electing a new committee under normal conditions.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ * // Assume drep_voting_thresholds is initialized properly
+ * cardano_unit_interval_t* committee_normal = NULL;
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_get_committee_normal(drep_voting_thresholds, &committee_normal);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Committee Normal Threshold: %f\n",cardano_unit_interval_to_double(committee_normal));
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&committee_normal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_get_committee_normal(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         committee_normal);
+
+/**
+ * \brief Retrieves the quorum threshold for electing a new committee under no-confidence conditions.
+ *
+ * This function returns the quorum threshold required for electing a new committee when the constitutional committee
+ * is in a state of no-confidence. The threshold is expressed as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[out] committee_no_confidence On successful retrieval, this will point to the quorum threshold
+ *                                     for electing a new committee under no-confidence conditions.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ * // Assume drep_voting_thresholds is initialized properly
+ * cardano_unit_interval_t* committee_no_confidence = NULL;
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_get_committee_no_confidence(drep_voting_thresholds, &committee_no_confidence);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Committee No-Confidence Threshold: %f\n", cardano_unit_interval_to_double(committee_no_confidence));
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&committee_no_confidence);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_get_committee_no_confidence(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         committee_no_confidence);
+
+/**
+ * \brief Retrieves the quorum threshold for constitutional updates.
+ *
+ * This function returns the quorum threshold required to enact modifications to the Constitution. The threshold
+ * is expressed as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[out] update_constitution On successful retrieval, this will point to the unit interval representing
+ *                                 the quorum threshold for constitutional updates.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ * // Assume drep_voting_thresholds is initialized properly
+ * cardano_unit_interval_t* update_constitution = NULL;
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_get_update_constitution(drep_voting_thresholds, &update_constitution);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Constitutional Update Threshold: %f\n", cardano_unit_interval_to_double(update_constitution));
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&update_constitution);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_get_update_constitution(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         update_constitution);
+
+/**
+ * \brief Retrieves the quorum threshold required for initiating a hard fork.
+ *
+ * This function returns the quorum threshold necessary to initiate a non-backwards compatible upgrade of the network.
+ * The threshold is expressed as a percentage of the total active voting stake and requires prior software upgrades.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[out] hard_fork_initiation On successful retrieval, this will point to the unit interval representing
+ *                                  the quorum threshold for initiating a hard fork.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ * // Assume drep_voting_thresholds is initialized properly
+ * cardano_unit_interval_t* hard_fork_initiation = NULL;
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_get_hard_fork_initiation(drep_voting_thresholds, &hard_fork_initiation);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Hard Fork Initiation Threshold: %f\n", cardano_unit_interval_to_double(hard_fork_initiation));
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&hard_fork_initiation);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_get_hard_fork_initiation(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         hard_fork_initiation);
+
+/**
+ * \brief Retrieves the quorum threshold for updating protocol parameters in the network group.
+ *
+ * This function returns the quorum threshold required for updates to the protocol parameters that affect the network group.
+ * The threshold is defined as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[out] pp_network_group On successful retrieval, this will point to the unit interval representing
+ *                              the quorum threshold for updating protocol parameters in the network group.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ * // Assume drep_voting_thresholds is initialized properly
+ * cardano_unit_interval_t* pp_network_group = NULL;
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_get_pp_network_group(drep_voting_thresholds, &pp_network_group);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Network Group Update Threshold: %f\n", cardano_unit_interval_to_double(pp_network_group));
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&pp_network_group);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_get_pp_network_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         pp_network_group);
+
+/**
+ * \brief Retrieves the quorum threshold for updating protocol parameters in the economic group.
+ *
+ * This function returns the quorum threshold required for updates to the protocol parameters that affect the economic group.
+ * The threshold is defined as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[out] pp_economic_group On successful retrieval, this will point to the unit interval representing
+ *                               the quorum threshold for updating protocol parameters in the economic group.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ * // Assume drep_voting_thresholds is initialized properly
+ * cardano_unit_interval_t* pp_economic_group = NULL;
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_get_pp_economic_group(drep_voting_thresholds, &pp_economic_group);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Economic Group Update Threshold: %f\n", cardano_unit_interval_to_double(pp_economic_group));
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&pp_economic_group);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_get_pp_economic_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         pp_economic_group);
+
+/**
+ * \brief Retrieves the quorum threshold for updating protocol parameters in the technical group.
+ *
+ * This function returns the quorum threshold required for updates to the protocol parameters that affect the technical group.
+ * The threshold is defined as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[out] pp_technical_group On successful retrieval, this will point to the unit interval representing
+ *                                the quorum threshold for updating protocol parameters in the technical group.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ * // Assume drep_voting_thresholds is initialized properly
+ * cardano_unit_interval_t* pp_technical_group = NULL;
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_get_pp_technical_group(drep_voting_thresholds, &pp_technical_group);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Technical Group Update Threshold: %f\n", cardano_unit_interval_to_double(pp_technical_group));
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&pp_technical_group);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_get_pp_technical_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         pp_technical_group);
+
+/**
+ * \brief Retrieves the quorum threshold for updating protocol parameters in the governance group.
+ *
+ * This function returns the quorum threshold required for updates to the protocol parameters that affect the governance group.
+ * The threshold is defined as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[out] pp_governance_group On successful retrieval, this will point to the unit interval representing
+ *                                 the quorum threshold for updating protocol parameters in the governance group.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ * // Assume drep_voting_thresholds is initialized properly
+ * cardano_unit_interval_t* pp_governance_group = NULL;
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_get_pp_governance_group(drep_voting_thresholds, &pp_governance_group);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Governance Group Update Threshold: %f\n", cardano_unit_interval_to_double(pp_governance_group));
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&pp_governance_group);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_get_pp_governance_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         pp_governance_group);
+
+/**
+ * \brief Retrieves the quorum threshold for withdrawing from the treasury.
+ *
+ * This function returns the quorum threshold required for treasury withdrawals. The threshold is defined as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[out] treasury_withdrawal On successful retrieval, this will point to the unit interval representing
+ *                                 the quorum threshold for treasury withdrawals.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ * // Assume drep_voting_thresholds is initialized properly
+ * cardano_unit_interval_t* treasury_withdrawal = NULL;
+ *
+ * cardano_error_t result = cardano_drep_voting_thresholds_get_treasury_withdrawal(drep_voting_thresholds, &treasury_withdrawal);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Treasury Withdrawal Threshold: %f\n", cardano_unit_interval_to_double(treasury_withdrawal));
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&treasury_withdrawal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_get_treasury_withdrawal(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         treasury_withdrawal);
+
+/**
+ * \brief Sets the quorum threshold for a Motion of No Confidence.
+ *
+ * This function sets the quorum threshold required for a Motion of No Confidence to be enacted. The threshold is defined as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[in] motion_no_confidence Pointer to the unit interval representing the quorum threshold for a Motion of No Confidence.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = ...;
+ * cardano_unit_interval_t* motion_no_confidence = NULL;
+ *
+ * // Example threshold
+ * double threshold_value = 0.75;
+ * cardano_error_t init_result = cardano_unit_interval_from_double(threshold_value, &motion_no_confidence);
+ *
+ * if (init_result == CARDANO_SUCCESS && motion_no_confidence != NULL)
+ * {
+ *   // Assume drep_voting_thresholds is initialized properly
+ *   cardano_error_t result = cardano_drep_voting_thresholds_set_motion_no_confidence(drep_voting_thresholds, motion_no_confidence);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Motion No Confidence Threshold set successfully.\n");
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&motion_no_confidence);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_set_motion_no_confidence(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          motion_no_confidence);
+
+/**
+ * \brief Sets the quorum threshold for a new committee to be elected if the constitutional committee is in a state of confidence.
+ *
+ * This function sets the quorum threshold required for a new committee to be elected under normal conditions. The threshold is defined as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[in] committee_normal Pointer to the unit interval representing the quorum threshold for normal committee elections.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = ...;
+ * cardano_unit_interval_t* committee_normal = NULL;
+ *
+ * // Example threshold
+ * double threshold_value = 0.60; // 60% quorum required
+ * cardano_error_t init_result = cardano_unit_interval_from_double(threshold_value, &committee_normal);
+ *
+ * if (init_result == CARDANO_SUCCESS && committee_normal != NULL)
+ * {
+ *   // Assume drep_voting_thresholds is initialized properly
+ *   cardano_error_t result = cardano_drep_voting_thresholds_set_committee_normal(drep_voting_thresholds, committee_normal);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Committee Normal Threshold set successfully.\n");
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&committee_normal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_set_committee_normal(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          committee_normal);
+
+/**
+ * \brief Sets the quorum threshold for a new committee to be elected if the constitutional committee is in a state of no-confidence.
+ *
+ * This function sets the quorum threshold required for a new committee to be elected under no-confidence conditions. The threshold is defined as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[in] committee_no_confidence Pointer to the unit interval representing the quorum threshold for no-confidence committee elections.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = ...;
+ * cardano_unit_interval_t* committee_no_confidence = NULL;
+ *
+ * // Example threshold
+ * double threshold_value = 0.75; // 75% quorum required
+ * cardano_error_t init_result = cardano_unit_interval_from_double(threshold_value, &committee_no_confidence);
+ *
+ * if (init_result == CARDANO_SUCCESS && committee_no_confidence != NULL)
+ * {
+ *   // Assume drep_voting_thresholds is initialized properly
+ *   cardano_error_t result = cardano_drep_voting_thresholds_set_committee_no_confidence(drep_voting_thresholds, committee_no_confidence);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Committee No Confidence Threshold set successfully.\n");
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&committee_no_confidence);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_set_committee_no_confidence(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          committee_no_confidence);
+
+/**
+ * \brief Sets the quorum threshold for enacting modifications to the Constitution.
+ *
+ * This function sets the quorum threshold required for enacting modifications to the Constitution. The threshold is defined as a percentage of the total active voting stake.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[in] update_constitution Pointer to the unit interval representing the quorum threshold for constitutional updates.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = ...;
+ * cardano_unit_interval_t* update_constitution = NULL;
+ *
+ * // Example threshold
+ * double threshold_value = 0.60; // 60% quorum required
+ * cardano_error_t init_result = cardano_unit_interval_from_double(threshold_value, &update_constitution);
+ *
+ * if (init_result == CARDANO_SUCCESS && update_constitution != NULL)
+ * {
+ *   // Assume drep_voting_thresholds is initialized properly
+ *   cardano_error_t result = cardano_drep_voting_thresholds_set_update_constitution(drep_voting_thresholds, update_constitution);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Update Constitution Threshold set successfully.\n");
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&update_constitution);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_set_update_constitution(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          update_constitution);
+
+/**
+ * \brief Sets the quorum threshold for initiating a hard fork.
+ *
+ * This function sets the quorum threshold required for initiating a hard fork of the network. The threshold is defined as a percentage of the total active voting stake that must be met to trigger a non-backwards compatible upgrade of the network.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[in] hard_fork_initiation Pointer to the unit interval representing the quorum threshold for hard fork initiation.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = ...;
+ * cardano_unit_interval_t* hard_fork_initiation = NULL;
+ *
+ * // Example threshold
+ * double threshold_value = 0.75; // 75% quorum required
+ * cardano_error_t init_result = cardano_unit_interval_from_double(threshold_value, &hard_fork_initiation);
+ *
+ * if (init_result == CARDANO_SUCCESS && hard_fork_initiation != NULL)
+ * {
+ *   // Assume drep_voting_thresholds is initialized properly
+ *   cardano_error_t result = cardano_drep_voting_thresholds_set_hard_fork_initiation(drep_voting_thresholds, hard_fork_initiation);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Hard Fork Initiation Threshold set successfully.\n");
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&hard_fork_initiation);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_set_hard_fork_initiation(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          hard_fork_initiation);
+
+/**
+ * \brief Sets the quorum threshold for updating protocol parameters in the network group.
+ *
+ * This function sets the quorum threshold required for updating protocol parameters within the network group. The threshold is defined as a percentage of the total active voting stake that must be met to enact changes.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[in] pp_network_group Pointer to the unit interval representing the quorum threshold for updates in the network group.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = ...;
+ * cardano_unit_interval_t* pp_network_group = NULL;
+ *
+ * // Example threshold
+ * double threshold_value = 0.60; // 60% quorum required
+ * cardano_error_t init_result = cardano_unit_interval_from_double(threshold_value, &pp_network_group);
+ *
+ * if (init_result == CARDANO_SUCCESS && pp_network_group != NULL)
+ * {
+ *   // Assume drep_voting_thresholds is initialized properly
+ *   cardano_error_t result = cardano_drep_voting_thresholds_set_pp_network_group(drep_voting_thresholds, pp_network_group);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Network Group Update Threshold set successfully.\n");
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&pp_network_group);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_set_pp_network_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          pp_network_group);
+
+/**
+ * \brief Sets the quorum threshold for updating protocol parameters in the economic group.
+ *
+ * This function sets the quorum threshold required for updating protocol parameters within the economic group. The threshold is defined as a percentage of the total active voting stake that must be met to enact changes.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[in] pp_economic_group Pointer to the unit interval representing the quorum threshold for updates in the economic group.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = ...;
+ * cardano_unit_interval_t* pp_economic_group = NULL;
+ *
+ * // Example threshold
+ * double threshold_value = 0.55; // 55% quorum required
+ * cardano_error_t init_result = cardano_unit_interval_from_double(threshold_value, &pp_economic_group);
+ *
+ * if (init_result == CARDANO_SUCCESS && pp_economic_group != NULL)
+ * {
+ *   // Assume drep_voting_thresholds is initialized properly
+ *   cardano_error_t result = cardano_drep_voting_thresholds_set_pp_economic_group(drep_voting_thresholds, pp_economic_group);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Economic Group Update Threshold set successfully.\n");
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&pp_economic_group);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_set_pp_economic_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          pp_economic_group);
+
+/**
+ * \brief Sets the quorum threshold for updating protocol parameters in the technical group.
+ *
+ * This function sets the quorum threshold required for updating protocol parameters within the technical group. The threshold is defined as a percentage of the total active voting stake that must be met to enact changes.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[in] pp_technical_group Pointer to the unit interval representing the quorum threshold for updates in the technical group.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = ...;
+ * cardano_unit_interval_t* pp_technical_group = NULL;
+ *
+ * // Example threshold
+ * double threshold_value = 0.60; // 60% quorum required
+ * cardano_error_t init_result = cardano_unit_interval_from_double(threshold_value, &pp_technical_group);
+ *
+ * if (init_result == CARDANO_SUCCESS && pp_technical_group != NULL)
+ * {
+ *   // Assume drep_voting_thresholds is initialized properly
+ *   cardano_error_t result = cardano_drep_voting_thresholds_set_pp_technical_group(drep_voting_thresholds, pp_technical_group);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Technical Group Update Threshold set successfully.\n");
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&pp_technical_group);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_set_pp_technical_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          pp_technical_group);
+
+/**
+ * \brief Sets the quorum threshold for updating protocol parameters in the governance group.
+ *
+ * This function sets the quorum threshold required for updating protocol parameters within the governance group. The threshold is defined as a percentage of the total active voting stake that must be met to enact changes.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[in] pp_governance_group Pointer to the unit interval representing the quorum threshold for updates in the governance group.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = ...;
+ * cardano_unit_interval_t* pp_governance_group = NULL;
+ *
+ * // Example threshold
+ * double threshold_value = 0.75; // 75% quorum required
+ * cardano_error_t init_result = cardano_unit_interval_from_double(threshold_value, &pp_governance_group);
+ *
+ * if (init_result == CARDANO_SUCCESS && pp_governance_group != NULL)
+ * {
+ *   // Assume drep_voting_thresholds is initialized properly
+ *   cardano_error_t result = cardano_drep_voting_thresholds_set_pp_governance_group(drep_voting_thresholds, pp_governance_group);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Governance Group Update Threshold set successfully.\n");
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&pp_governance_group);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_set_pp_governance_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          pp_governance_group);
+
+/**
+ * \brief Sets the quorum threshold for treasury withdrawals.
+ *
+ * This function sets the quorum threshold required for treasury withdrawals. The threshold is defined as a percentage of the total active voting stake that must be met to approve a withdrawal from the treasury.
+ *
+ * \param[in] drep_voting_thresholds Pointer to the \ref cardano_drep_voting_thresholds_t object.
+ * \param[in] treasury_withdrawal Pointer to the unit interval representing the quorum threshold for treasury withdrawals.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = ...;
+ * cardano_unit_interval_t* treasury_withdrawal = NULL;
+ *
+ * // Example threshold
+ * double threshold_value = 0.60; // 60% quorum required
+ * cardano_error_t init_result = cardano_unit_interval_from_double(threshold_value, &treasury_withdrawal);
+ *
+ * if (init_result == CARDANO_SUCCESS && treasury_withdrawal != NULL)
+ * {
+ *   // Assume drep_voting_thresholds is initialized properly
+ *   cardano_error_t result = cardano_drep_voting_thresholds_set_treasury_withdrawal(drep_voting_thresholds, treasury_withdrawal);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("Treasury Withdrawal Threshold set successfully.\n");
+ *   }
+ * }
+ *
+ * // Clean up
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * cardano_unit_interval_unref(&treasury_withdrawal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_drep_voting_thresholds_set_treasury_withdrawal(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          treasury_withdrawal);
+
+/**
+ * \brief Decrements the reference count of a cardano_drep_voting_thresholds_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_drep_voting_thresholds_t object
+ * by decreasing its reference count. When the reference count reaches zero, the drep_voting_thresholds is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] drep_voting_thresholds A pointer to the pointer of the drep_voting_thresholds object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = cardano_drep_voting_thresholds_new(major, minor);
+ *
+ * // Perform operations with the drep_voting_thresholds...
+ *
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * // At this point, drep_voting_thresholds is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_drep_voting_thresholds_unref, the pointer to the \ref cardano_drep_voting_thresholds_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_drep_voting_thresholds_unref(cardano_drep_voting_thresholds_t** drep_voting_thresholds);
+
+/**
+ * \brief Increases the reference count of the cardano_drep_voting_thresholds_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_drep_voting_thresholds_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_drep_voting_thresholds_unref.
+ *
+ * \param drep_voting_thresholds A pointer to the cardano_drep_voting_thresholds_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming drep_voting_thresholds is a previously created drep_voting_thresholds object
+ *
+ * cardano_drep_voting_thresholds_ref(drep_voting_thresholds);
+ *
+ * // Now drep_voting_thresholds can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_drep_voting_thresholds_ref there is a corresponding
+ * call to \ref cardano_drep_voting_thresholds_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_drep_voting_thresholds_ref(cardano_drep_voting_thresholds_t* drep_voting_thresholds);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_drep_voting_thresholds_t object.
+ *
+ * This function returns the number of active references to an cardano_drep_voting_thresholds_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_drep_voting_thresholds_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param drep_voting_thresholds A pointer to the cardano_drep_voting_thresholds_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_drep_voting_thresholds_t object. If the object
+ * is properly managed (i.e., every \ref cardano_drep_voting_thresholds_ref call is matched with a
+ * \ref cardano_drep_voting_thresholds_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming drep_voting_thresholds is a previously created drep_voting_thresholds object
+ *
+ * size_t ref_count = cardano_drep_voting_thresholds_refcount(drep_voting_thresholds);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_drep_voting_thresholds_refcount(const cardano_drep_voting_thresholds_t* drep_voting_thresholds);
+
+/**
+ * \brief Sets the last error message for a given cardano_drep_voting_thresholds_t object.
+ *
+ * Records an error message in the drep_voting_thresholds's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] drep_voting_thresholds A pointer to the \ref cardano_drep_voting_thresholds_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the drep_voting_thresholds's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_drep_voting_thresholds_set_last_error(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  const char*                       message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific drep_voting_thresholds.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_drep_voting_thresholds_set_last_error for the given
+ * drep_voting_thresholds. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] drep_voting_thresholds A pointer to the \ref cardano_drep_voting_thresholds_t instance whose last error
+ *                   message is to be retrieved. If the drep_voting_thresholds is NULL, the function
+ *                   returns a generic error message indicating the null drep_voting_thresholds.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified drep_voting_thresholds. If the drep_voting_thresholds is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_drep_voting_thresholds_set_last_error for the same drep_voting_thresholds, or until
+ *       the drep_voting_thresholds is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_drep_voting_thresholds_get_last_error(
+  const cardano_drep_voting_thresholds_t* drep_voting_thresholds);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_drep_voting_thresholds_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_drep_voting_thresholds_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_drep_voting_thresholds_deep_clone(const cardano_drep_voting_thresholds_t* source, cardano_drep_voting_thresholds_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_DREP_VOTING_THRESHOLDS_H
diff --git a/vendor/include/cardano/protocol_params/ex_unit_prices.h b/vendor/include/cardano/protocol_params/ex_unit_prices.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/protocol_params/ex_unit_prices.h
@@ -0,0 +1,510 @@
+/**
+ * \file ex_unit_prices.h
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_EX_UNIT_PRICES_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_EX_UNIT_PRICES_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Specifies the cost (in Lovelace) of these ExUnits. In essence, they set the
+ * "price" for the computational resources used by a smart contract.
+ */
+typedef struct cardano_ex_unit_prices_t cardano_ex_unit_prices_t;
+
+/**
+ * \brief Creates and initializes a new instance of the execution unit prices.
+ *
+ * This function allocates and initializes a new instance of the execution unit prices,
+ * representing the cost of computational resources used by a smart contract.
+ *
+ * \param[in] memory_prices The price for memory consumption as a unit interval.
+ * \param[in] steps_prices The price for CPU steps as a unit interval.
+ * \param[out] ex_unit_prices On successful initialization, this will point to a newly created
+ *            execution unit prices object. This object represents a "strong reference",
+ *            meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the execution unit prices is no longer needed, the caller must release it
+ *            by calling \ref cardano_ex_unit_prices_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the execution unit prices was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_unit_prices_t* ex_unit_prices = NULL;
+ * cardano_unit_interval_t* memory_prices = NULL;
+ * cardano_unit_interval_t* steps_prices = NULL;
+ * cardano_error_t result = CARDANO_SUCCESS;
+ *
+ * // Initialize the unit intervals for memory and steps prices
+ * result = cardano_unit_interval_from_double(0.003, &memory_prices);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle error
+ * }
+ *
+ * result = cardano_unit_interval_from_double(0.007, &steps_prices);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle error
+ * }
+ *
+ * // Attempt to create a new execution unit prices object
+ * result = cardano_ex_unit_prices_new(memory_prices, steps_prices, &ex_unit_prices);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the ex_unit_prices
+ *
+ *   // Once done, ensure to clean up and release the ex_unit_prices
+ *   cardano_ex_unit_prices_unref(&ex_unit_prices);
+ * }
+ *
+ * // Clean up
+ * cardano_unit_interval_unref(&memory_prices);
+ * cardano_unit_interval_unref(&steps_prices);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_ex_unit_prices_new(
+  cardano_unit_interval_t*   memory_prices,
+  cardano_unit_interval_t*   steps_prices,
+  cardano_ex_unit_prices_t** ex_unit_prices);
+
+/**
+ * \brief Creates a \ref cardano_ex_unit_prices_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_ex_unit_prices_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a ex_unit_prices.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] ex_unit_prices A pointer to a pointer of \ref cardano_ex_unit_prices_t that will be set to the address
+ *                        of the newly created ex_unit_prices object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_ex_unit_prices_t object by calling
+ *       \ref cardano_ex_unit_prices_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_ex_unit_prices_t* ex_unit_prices = NULL;
+ *
+ * cardano_error_t result = cardano_ex_unit_prices_from_cbor(reader, &ex_unit_prices);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the ex_unit_prices
+ *
+ *   // Once done, ensure to clean up and release the ex_unit_prices
+ *   cardano_ex_unit_prices_unref(&ex_unit_prices);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode ex_unit_prices: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_ex_unit_prices_from_cbor(cardano_cbor_reader_t* reader, cardano_ex_unit_prices_t** ex_unit_prices);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_ex_unit_prices_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] ex_unit_prices A constant pointer to the \ref cardano_ex_unit_prices_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p ex_unit_prices or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_unit_prices_t* ex_unit_prices = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_ex_unit_prices_to_cbor(ex_unit_prices, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_ex_unit_prices_unref(&ex_unit_prices);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_unit_prices_to_cbor(
+  const cardano_ex_unit_prices_t* ex_unit_prices,
+  cardano_cbor_writer_t*          writer);
+
+/**
+ * \brief Serializes execution unit prices to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "mem_price", "step_price".
+ *
+ * \param[in]  prices  Pointer to a valid \ref cardano_ex_unit_prices_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p prices or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_unit_prices_to_cip116_json(
+  const cardano_ex_unit_prices_t* prices,
+  cardano_json_writer_t*          writer);
+
+/**
+ * \brief Retrieves the memory price from the execution unit prices.
+ *
+ * This function returns the memory price from the execution unit prices object.
+ *
+ * \param[in] ex_unit_prices Pointer to the execution unit prices object.
+ * \param[out] memory_prices On successful retrieval, this will point to the memory price
+ *                           as a unit interval.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the memory price was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_unit_prices_t* ex_unit_prices = ...;
+ * cardano_unit_interval_t* memory_prices = NULL;
+ *
+ * // Assume ex_unit_prices is initialized properly
+ * cardano_error_t result = cardano_ex_unit_prices_get_memory_prices(ex_unit_prices, &memory_prices);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the memory_prices
+ *   // Clean up
+ *   cardano_unit_interval_unref(&memory_prices);
+ * }
+ *
+ * cardano_ex_unit_prices_unref(&ex_unit_prices);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_unit_prices_get_memory_prices(
+  cardano_ex_unit_prices_t* ex_unit_prices,
+  cardano_unit_interval_t** memory_prices);
+
+/**
+ * \brief Retrieves the steps price from the execution unit prices.
+ *
+ * This function returns the steps price from the execution unit prices object.
+ *
+ * \param[in] ex_unit_prices Pointer to the execution unit prices object.
+ * \param[out] steps_prices On successful retrieval, this will point to the steps price
+ *                          as a unit interval.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the steps price was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_unit_prices_t* ex_unit_prices = NULL;
+ * cardano_unit_interval_t* steps_prices = NULL;
+ *
+ * // Assume ex_unit_prices is initialized properly
+ *
+ * cardano_error_t result = cardano_ex_unit_prices_get_steps_prices(ex_unit_prices, &steps_prices);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the steps_prices
+ *   // Clean up
+ *   cardano_unit_interval_unref(&steps_prices);
+ * }
+ *
+ * cardano_ex_unit_prices_unref(&ex_unit_prices);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_unit_prices_get_steps_prices(
+  cardano_ex_unit_prices_t* ex_unit_prices,
+  cardano_unit_interval_t** steps_prices);
+
+/**
+ * \brief Sets the memory price in the execution unit prices.
+ *
+ * This function sets the memory price in the execution unit prices object.
+ *
+ * \param[in] ex_unit_prices Pointer to the execution unit prices object.
+ * \param[in] memory_prices Pointer to the unit interval representing the memory price.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the memory price was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_unit_prices_t* ex_unit_prices = NULL;
+ * cardano_unit_interval_t* memory_prices = NULL;
+ *
+ * // Assume ex_unit_prices and memory_prices are initialized properly
+ *
+ * cardano_error_t result = cardano_ex_unit_prices_set_memory_prices(ex_unit_prices, memory_prices);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Memory price was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_ex_unit_prices_unref(&ex_unit_prices);
+ * cardano_unit_interval_unref(&memory_prices);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_unit_prices_set_memory_prices(
+  cardano_ex_unit_prices_t* ex_unit_prices,
+  cardano_unit_interval_t*  memory_prices);
+
+/**
+ * \brief Sets the steps price in the execution unit prices.
+ *
+ * This function sets the steps price in the execution unit prices object.
+ *
+ * \param[in] ex_unit_prices Pointer to the execution unit prices object.
+ * \param[in] steps_prices Pointer to the unit interval representing the steps price.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the steps price was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_unit_prices_t* ex_unit_prices = NULL;
+ * cardano_unit_interval_t* steps_prices = NULL;
+ *
+ * // Assume ex_unit_prices and steps_prices are initialized properly
+ *
+ * cardano_error_t result = cardano_ex_unit_prices_set_steps_prices(ex_unit_prices, steps_prices);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Steps price was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_ex_unit_prices_unref(&ex_unit_prices);
+ * cardano_unit_interval_unref(&steps_prices);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_ex_unit_prices_set_steps_prices(
+  cardano_ex_unit_prices_t* ex_unit_prices,
+  cardano_unit_interval_t*  steps_prices);
+
+/**
+ * \brief Decrements the reference count of a cardano_ex_unit_prices_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_ex_unit_prices_t object
+ * by decreasing its reference count. When the reference count reaches zero, the ex_unit_prices is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] ex_unit_prices A pointer to the pointer of the ex_unit_prices object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ex_unit_prices_t* ex_unit_prices = cardano_ex_unit_prices_new(major, minor);
+ *
+ * // Perform operations with the ex_unit_prices...
+ *
+ * cardano_ex_unit_prices_unref(&ex_unit_prices);
+ * // At this point, ex_unit_prices is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_ex_unit_prices_unref, the pointer to the \ref cardano_ex_unit_prices_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_ex_unit_prices_unref(cardano_ex_unit_prices_t** ex_unit_prices);
+
+/**
+ * \brief Increases the reference count of the cardano_ex_unit_prices_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_ex_unit_prices_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_ex_unit_prices_unref.
+ *
+ * \param ex_unit_prices A pointer to the cardano_ex_unit_prices_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming ex_unit_prices is a previously created ex_unit_prices object
+ *
+ * cardano_ex_unit_prices_ref(ex_unit_prices);
+ *
+ * // Now ex_unit_prices can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_ex_unit_prices_ref there is a corresponding
+ * call to \ref cardano_ex_unit_prices_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_ex_unit_prices_ref(cardano_ex_unit_prices_t* ex_unit_prices);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_ex_unit_prices_t object.
+ *
+ * This function returns the number of active references to an cardano_ex_unit_prices_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_ex_unit_prices_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param ex_unit_prices A pointer to the cardano_ex_unit_prices_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_ex_unit_prices_t object. If the object
+ * is properly managed (i.e., every \ref cardano_ex_unit_prices_ref call is matched with a
+ * \ref cardano_ex_unit_prices_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming ex_unit_prices is a previously created ex_unit_prices object
+ *
+ * size_t ref_count = cardano_ex_unit_prices_refcount(ex_unit_prices);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_ex_unit_prices_refcount(const cardano_ex_unit_prices_t* ex_unit_prices);
+
+/**
+ * \brief Sets the last error message for a given cardano_ex_unit_prices_t object.
+ *
+ * Records an error message in the ex_unit_prices's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] ex_unit_prices A pointer to the \ref cardano_ex_unit_prices_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the ex_unit_prices's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_ex_unit_prices_set_last_error(
+  cardano_ex_unit_prices_t* ex_unit_prices,
+  const char*               message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific ex_unit_prices.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_ex_unit_prices_set_last_error for the given
+ * ex_unit_prices. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] ex_unit_prices A pointer to the \ref cardano_ex_unit_prices_t instance whose last error
+ *                   message is to be retrieved. If the ex_unit_prices is NULL, the function
+ *                   returns a generic error message indicating the null ex_unit_prices.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified ex_unit_prices. If the ex_unit_prices is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_ex_unit_prices_set_last_error for the same ex_unit_prices, or until
+ *       the ex_unit_prices is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_ex_unit_prices_get_last_error(
+  const cardano_ex_unit_prices_t* ex_unit_prices);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_ex_unit_prices_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_ex_unit_prices_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_ex_unit_prices_deep_clone(const cardano_ex_unit_prices_t* source, cardano_ex_unit_prices_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_EX_UNIT_PRICES_H
diff --git a/vendor/include/cardano/protocol_params/pool_voting_thresholds.h b/vendor/include/cardano/protocol_params/pool_voting_thresholds.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/protocol_params/pool_voting_thresholds.h
@@ -0,0 +1,740 @@
+/**
+ * \file pool_voting_thresholds.h
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_POOL_VOTING_THRESHOLDS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_POOL_VOTING_THRESHOLDS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Governance actions are ratified through on-chain voting. Different
+ * kinds of governance actions have different ratification requirements. One of those
+ * requirements is the approval of the action by SPOs. These thresholds specify
+ * the percentage of the stake held by all stake pools that must be meet by the SPOs who
+ * vote Yes for the approval to be successful.
+ */
+typedef struct cardano_pool_voting_thresholds_t cardano_pool_voting_thresholds_t;
+
+/**
+ * \brief Creates and initializes a new instance of the pool voting thresholds.
+ *
+ * This function allocates and initializes a new instance of the pool voting thresholds,
+ * representing various quorum thresholds for different governance actions in the Cardano protocol.
+ *
+ * \param[in] motion_no_confidence Quorum threshold for a Motion of no-confidence.
+ * \param[in] committee_normal Quorum threshold for electing a new committee when the current committee is in a state of confidence.
+ * \param[in] committee_no_confidence Quorum threshold for electing a new committee when the current committee is in a state of no-confidence.
+ * \param[in] hard_fork_initiation Quorum threshold for initiating a non-backwards compatible upgrade of the network.
+ * \param[in] security_relevant_param Quorum threshold for changing security-relevant parameters.
+ * \param[out] pool_voting_thresholds On successful initialization, this will point to a newly created
+ *                                    pool voting thresholds object. This object represents a "strong reference",
+ *                                    meaning that it is fully initialized and ready for use.
+ *                                    The caller is responsible for managing the lifecycle of this object.
+ *                                    Specifically, once the pool voting thresholds object is no longer needed,
+ *                                    the caller must release it by calling \ref cardano_pool_voting_thresholds_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool voting thresholds object was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ * cardano_unit_interval_t* motion_no_confidence = NULL;
+ * cardano_unit_interval_t* committee_normal = NULL;
+ * cardano_unit_interval_t* committee_no_confidence = NULL;
+ * cardano_unit_interval_t* hard_fork_initiation = NULL;
+ * cardano_unit_interval_t* security_relevant_param = NULL;
+ *
+ * // Initialize the unit intervals
+ * cardano_unit_interval_from_double(0.5, &motion_no_confidence);
+ * cardano_unit_interval_from_double(0.6, &committee_normal);
+ * cardano_unit_interval_from_double(0.7, &committee_no_confidence);
+ * cardano_unit_interval_from_double(0.8, &hard_fork_initiation);
+ * cardano_unit_interval_from_double(0.9, &security_relevant_param);
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_new(
+ *   motion_no_confidence,
+ *   committee_normal,
+ *   committee_no_confidence,
+ *   hard_fork_initiation,
+ *   security_relevant_param,
+ *   &pool_voting_thresholds
+ * );
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pool_voting_thresholds
+ * }
+ *
+ * // Clean up
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * cardano_unit_interval_unref(&motion_no_confidence);
+ * cardano_unit_interval_unref(&committee_normal);
+ * cardano_unit_interval_unref(&committee_no_confidence);
+ * cardano_unit_interval_unref(&hard_fork_initiation);
+ * cardano_unit_interval_unref(&security_relevant_param);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_voting_thresholds_new(
+  cardano_unit_interval_t*           motion_no_confidence,
+  cardano_unit_interval_t*           committee_normal,
+  cardano_unit_interval_t*           committee_no_confidence,
+  cardano_unit_interval_t*           hard_fork_initiation,
+  cardano_unit_interval_t*           security_relevant_param,
+  cardano_pool_voting_thresholds_t** pool_voting_thresholds);
+
+/**
+ * \brief Creates a \ref cardano_pool_voting_thresholds_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_pool_voting_thresholds_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a pool_voting_thresholds.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] pool_voting_thresholds A pointer to a pointer of \ref cardano_pool_voting_thresholds_t that will be set to the address
+ *                        of the newly created pool_voting_thresholds object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_pool_voting_thresholds_t object by calling
+ *       \ref cardano_pool_voting_thresholds_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_from_cbor(reader, &pool_voting_thresholds);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the pool_voting_thresholds
+ *
+ *   // Once done, ensure to clean up and release the pool_voting_thresholds
+ *   cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode pool_voting_thresholds: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_voting_thresholds_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_voting_thresholds_t** pool_voting_thresholds);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_pool_voting_thresholds_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] pool_voting_thresholds A constant pointer to the \ref cardano_pool_voting_thresholds_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p pool_voting_thresholds or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_pool_voting_thresholds_to_cbor(pool_voting_thresholds, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_voting_thresholds_to_cbor(
+  const cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_cbor_writer_t*                  writer);
+
+/**
+ * \brief Serializes pool voting thresholds to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ *
+ * \param[in]  thresholds  Pointer to a valid \ref cardano_pool_voting_thresholds_t.
+ * \param[in]  writer      Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p thresholds or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_pool_voting_thresholds_to_cip116_json(
+  const cardano_pool_voting_thresholds_t* thresholds,
+  cardano_json_writer_t*                  writer);
+
+/**
+ * \brief Retrieves the motion no-confidence threshold from the pool voting thresholds.
+ *
+ * This function returns the motion no-confidence threshold from the pool voting thresholds object.
+ *
+ * \param[in] pool_voting_thresholds Pointer to the pool voting thresholds object.
+ * \param[out] motion_no_confidence On successful retrieval, this will point to the motion no-confidence threshold
+ *                                  as a \ref cardano_unit_interval_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the motion no-confidence threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ * cardano_unit_interval_t* motion_no_confidence = NULL;
+ *
+ * // Assume pool_voting_thresholds is initialized properly
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_get_motion_no_confidence(pool_voting_thresholds, &motion_no_confidence);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the motion_no_confidence
+ * }
+ *
+ * // Clean up
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * cardano_unit_interval_unref(&motion_no_confidence);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_voting_thresholds_get_motion_no_confidence(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t**         motion_no_confidence);
+
+/**
+ * \brief Retrieves the committee normal threshold from the pool voting thresholds.
+ *
+ * This function returns the committee normal threshold from the pool voting thresholds object.
+ *
+ * \param[in] pool_voting_thresholds Pointer to the pool voting thresholds object.
+ * \param[out] committee_normal On successful retrieval, this will point to the committee normal threshold
+ *                              as a \ref cardano_unit_interval_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the committee normal threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ * cardano_unit_interval_t* committee_normal = NULL;
+ *
+ * // Assume pool_voting_thresholds is initialized properly
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_get_committee_normal(pool_voting_thresholds, &committee_normal);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the committee_normal
+ * }
+ *
+ * // Clean up
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * cardano_unit_interval_unref(&committee_normal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_voting_thresholds_get_committee_normal(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t**         committee_normal);
+
+/**
+ * \brief Retrieves the committee no confidence threshold from the pool voting thresholds.
+ *
+ * This function returns the committee no confidence threshold from the pool voting thresholds object.
+ *
+ * \param[in] pool_voting_thresholds Pointer to the pool voting thresholds object.
+ * \param[out] committee_no_confidence On successful retrieval, this will point to the committee no confidence threshold
+ *                                     as a \ref cardano_unit_interval_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the committee no confidence threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ * cardano_unit_interval_t* committee_no_confidence = NULL;
+ *
+ * // Assume pool_voting_thresholds is initialized properly
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_get_committee_no_confidence(pool_voting_thresholds, &committee_no_confidence);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the committee_no_confidence
+ * }
+ *
+ * // Clean up
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * cardano_unit_interval_unref(&committee_no_confidence);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_voting_thresholds_get_committee_no_confidence(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t**         committee_no_confidence);
+
+/**
+ * \brief Retrieves the hard fork initiation threshold from the pool voting thresholds.
+ *
+ * This function returns the hard fork initiation threshold from the pool voting thresholds object.
+ *
+ * \param[in] pool_voting_thresholds Pointer to the pool voting thresholds object.
+ * \param[out] hard_fork_initiation On successful retrieval, this will point to the hard fork initiation threshold
+ *                                  as a \ref cardano_unit_interval_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the hard fork initiation threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ * cardano_unit_interval_t* hard_fork_initiation = NULL;
+ *
+ * // Assume pool_voting_thresholds is initialized properly
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_get_hard_fork_initiation(pool_voting_thresholds, &hard_fork_initiation);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the hard_fork_initiation
+ * }
+ *
+ * // Clean up
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * cardano_unit_interval_unref(&hard_fork_initiation);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_voting_thresholds_get_hard_fork_initiation(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t**         hard_fork_initiation);
+
+/**
+ * \brief Retrieves the security relevant parameter threshold from the pool voting thresholds.
+ *
+ * This function returns the security relevant parameter threshold from the pool voting thresholds object.
+ *
+ * \param[in] pool_voting_thresholds Pointer to the pool voting thresholds object.
+ * \param[out] security_relevant_param On successful retrieval, this will point to the security relevant parameter threshold
+ *                                  as a \ref cardano_unit_interval_t object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the security relevant parameter threshold was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ * cardano_unit_interval_t* security_relevant_param = NULL;
+ *
+ * // Assume pool_voting_thresholds is initialized properly
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_get_security_relevant_param(pool_voting_thresholds, &security_relevant_param);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the security_relevant_param
+ * }
+ *
+ * // Clean up
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * cardano_unit_interval_unref(&security_relevant_param);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_voting_thresholds_get_security_relevant_param(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t**         security_relevant_param);
+
+/**
+ * \brief Sets the motion no-confidence threshold in the pool voting thresholds.
+ *
+ * This function sets the motion no-confidence threshold in the pool voting thresholds object.
+ *
+ * \param[in] pool_voting_thresholds Pointer to the pool voting thresholds object.
+ * \param[in] motion_no_confidence Pointer to the \ref cardano_unit_interval_t object representing the motion no-confidence threshold.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the motion no-confidence threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ * cardano_unit_interval_t* motion_no_confidence = NULL;
+ *
+ * // Assume pool_voting_thresholds and motion_no_confidence are initialized properly
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_set_motion_no_confidence(pool_voting_thresholds, motion_no_confidence);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The motion no-confidence threshold was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * cardano_unit_interval_unref(&motion_no_confidence);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_voting_thresholds_set_motion_no_confidence(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t*          motion_no_confidence);
+
+/**
+ * \brief Sets the committee normal threshold in the pool voting thresholds.
+ *
+ * This function sets the committee normal threshold in the pool voting thresholds object.
+ *
+ * \param[in] pool_voting_thresholds Pointer to the pool voting thresholds object.
+ * \param[in] committee_normal Pointer to the \ref cardano_unit_interval_t object representing the committee normal threshold.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the committee normal threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ * cardano_unit_interval_t* committee_normal = NULL;
+ *
+ * // Assume pool_voting_thresholds and committee_normal are initialized properly
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_set_committee_normal(pool_voting_thresholds, committee_normal);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The committee normal threshold was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * cardano_unit_interval_unref(&committee_normal);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_voting_thresholds_set_committee_normal(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t*          committee_normal);
+
+/**
+ * \brief Sets the committee no-confidence threshold in the pool voting thresholds.
+ *
+ * This function sets the committee no-confidence threshold in the pool voting thresholds object.
+ *
+ * \param[in] pool_voting_thresholds Pointer to the pool voting thresholds object.
+ * \param[in] committee_no_confidence Pointer to the \ref cardano_unit_interval_t object representing the committee no-confidence threshold.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the committee no-confidence threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ * cardano_unit_interval_t* committee_no_confidence = NULL;
+ *
+ * // Assume pool_voting_thresholds and committee_no_confidence are initialized properly
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_set_committee_no_confidence(pool_voting_thresholds, committee_no_confidence);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The committee no-confidence threshold was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * cardano_unit_interval_unref(&committee_no_confidence);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_voting_thresholds_set_committee_no_confidence(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t*          committee_no_confidence);
+
+/**
+ * \brief Sets the hard fork initiation threshold in the pool voting thresholds.
+ *
+ * This function sets the hard fork initiation threshold in the pool voting thresholds object.
+ *
+ * \param[in] pool_voting_thresholds Pointer to the pool voting thresholds object.
+ * \param[in] hard_fork_initiation Pointer to the \ref cardano_unit_interval_t object representing the hard fork initiation threshold.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the hard fork initiation threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ * cardano_unit_interval_t* hard_fork_initiation = NULL;
+ *
+ * // Assume pool_voting_thresholds and hard_fork_initiation are initialized properly
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_set_hard_fork_initiation(pool_voting_thresholds, hard_fork_initiation);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The hard fork initiation threshold was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * cardano_unit_interval_unref(&hard_fork_initiation);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_voting_thresholds_set_hard_fork_initiation(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t*          hard_fork_initiation);
+
+/**
+ * \brief Sets the security relevant param threshold in the pool voting thresholds.
+ *
+ * This function sets the security relevant param threshold in the pool voting thresholds object.
+ *
+ * \param[in] pool_voting_thresholds Pointer to the pool voting thresholds object.
+ * \param[in] security_relevant_param Pointer to the \ref cardano_unit_interval_t object representing the security relevant param threshold.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the security relevant param threshold was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ * cardano_unit_interval_t* security_relevant_param = NULL;
+ *
+ * // Assume pool_voting_thresholds and hard_fork_initiation are initialized properly
+ *
+ * cardano_error_t result = cardano_pool_voting_thresholds_set_security_relevant_param(pool_voting_thresholds, security_relevant_param);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The security relevant param threshold was successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * cardano_unit_interval_unref(&security_relevant_param);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_pool_voting_thresholds_set_security_relevant_param(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t*          security_relevant_param);
+
+/**
+ * \brief Decrements the reference count of a cardano_pool_voting_thresholds_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_pool_voting_thresholds_t object
+ * by decreasing its reference count. When the reference count reaches zero, the pool_voting_thresholds is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] pool_voting_thresholds A pointer to the pointer of the pool_voting_thresholds object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = cardano_pool_voting_thresholds_new(major, minor);
+ *
+ * // Perform operations with the pool_voting_thresholds...
+ *
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * // At this point, pool_voting_thresholds is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_pool_voting_thresholds_unref, the pointer to the \ref cardano_pool_voting_thresholds_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_pool_voting_thresholds_unref(cardano_pool_voting_thresholds_t** pool_voting_thresholds);
+
+/**
+ * \brief Increases the reference count of the cardano_pool_voting_thresholds_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_pool_voting_thresholds_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_pool_voting_thresholds_unref.
+ *
+ * \param pool_voting_thresholds A pointer to the cardano_pool_voting_thresholds_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_voting_thresholds is a previously created pool_voting_thresholds object
+ *
+ * cardano_pool_voting_thresholds_ref(pool_voting_thresholds);
+ *
+ * // Now pool_voting_thresholds can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_pool_voting_thresholds_ref there is a corresponding
+ * call to \ref cardano_pool_voting_thresholds_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_pool_voting_thresholds_ref(cardano_pool_voting_thresholds_t* pool_voting_thresholds);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_pool_voting_thresholds_t object.
+ *
+ * This function returns the number of active references to an cardano_pool_voting_thresholds_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_pool_voting_thresholds_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param pool_voting_thresholds A pointer to the cardano_pool_voting_thresholds_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_pool_voting_thresholds_t object. If the object
+ * is properly managed (i.e., every \ref cardano_pool_voting_thresholds_ref call is matched with a
+ * \ref cardano_pool_voting_thresholds_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming pool_voting_thresholds is a previously created pool_voting_thresholds object
+ *
+ * size_t ref_count = cardano_pool_voting_thresholds_refcount(pool_voting_thresholds);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_pool_voting_thresholds_refcount(const cardano_pool_voting_thresholds_t* pool_voting_thresholds);
+
+/**
+ * \brief Sets the last error message for a given cardano_pool_voting_thresholds_t object.
+ *
+ * Records an error message in the pool_voting_thresholds's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] pool_voting_thresholds A pointer to the \ref cardano_pool_voting_thresholds_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the pool_voting_thresholds's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_pool_voting_thresholds_set_last_error(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  const char*                       message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific pool_voting_thresholds.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_pool_voting_thresholds_set_last_error for the given
+ * pool_voting_thresholds. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] pool_voting_thresholds A pointer to the \ref cardano_pool_voting_thresholds_t instance whose last error
+ *                   message is to be retrieved. If the pool_voting_thresholds is NULL, the function
+ *                   returns a generic error message indicating the null pool_voting_thresholds.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified pool_voting_thresholds. If the pool_voting_thresholds is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_pool_voting_thresholds_set_last_error for the same pool_voting_thresholds, or until
+ *       the pool_voting_thresholds is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_pool_voting_thresholds_get_last_error(
+  const cardano_pool_voting_thresholds_t* pool_voting_thresholds);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_pool_voting_thresholds_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_pool_voting_thresholds_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_pool_voting_thresholds_deep_clone(const cardano_pool_voting_thresholds_t* source, cardano_pool_voting_thresholds_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_POOL_VOTING_THRESHOLDS_H
diff --git a/vendor/include/cardano/protocol_params/proposed_param_updates.h b/vendor/include/cardano/protocol_params/proposed_param_updates.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/protocol_params/proposed_param_updates.h
@@ -0,0 +1,600 @@
+/**
+ * \file proposed_param_updates.h
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PROPOSED_PARAM_UPDATES_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PROPOSED_PARAM_UPDATES_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/protocol_params/protocol_param_update.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief In the Cardano network, stakeholders can propose changes to the protocol parameters. These proposals are then
+ * collected into a set which represents the ProposedProtocolParameterUpdates.
+ *
+ * This proposed protocol parameter updates are represented as a map of genesis delegate key hash to parameters updates. So in principles,
+ * each genesis delegate can propose a different update.
+ */
+typedef struct cardano_proposed_param_updates_t cardano_proposed_param_updates_t;
+
+/**
+ * \brief Creates and initializes a new instance of the proposed protocol parameter updates.
+ *
+ * This function allocates and initializes a new instance of the proposed protocol parameter updates,
+ * representing a set of proposed changes to the Cardano protocol parameters.
+ *
+ * \param[out] proposed_param_updates On successful initialization, this will point to a newly created
+ *            proposed protocol parameter updates object. This object represents a "strong reference",
+ *            meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the proposed protocol parameter updates object is no longer needed,
+ *            the caller must release it by calling \ref cardano_proposed_param_updates_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the proposed protocol parameter updates object was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposed_param_updates_t* proposed_param_updates = NULL;
+ *
+ * // Attempt to create a new proposed protocol parameter updates object
+ * cardano_error_t result = cardano_proposed_param_updates_new(&proposed_param_updates);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposed_param_updates
+ *
+ *   // Once done, ensure to clean up and release the proposed_param_updates
+ *   cardano_proposed_param_updates_unref(&proposed_param_updates);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposed_param_updates_new(cardano_proposed_param_updates_t** proposed_param_updates);
+
+/**
+ * \brief Creates a \ref cardano_proposed_param_updates_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_proposed_param_updates_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a proposed_param_updates.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] proposed_param_updates A pointer to a pointer of \ref cardano_proposed_param_updates_t that will be set to the address
+ *                        of the newly created proposed_param_updates object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_proposed_param_updates_t object by calling
+ *       \ref cardano_proposed_param_updates_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_proposed_param_updates_t* proposed_param_updates = NULL;
+ *
+ * cardano_error_t result = cardano_proposed_param_updates_from_cbor(reader, &proposed_param_updates);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposed_param_updates
+ *
+ *   // Once done, ensure to clean up and release the proposed_param_updates
+ *   cardano_proposed_param_updates_unref(&proposed_param_updates);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode proposed_param_updates: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_proposed_param_updates_from_cbor(cardano_cbor_reader_t* reader, cardano_proposed_param_updates_t** proposed_param_updates);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_proposed_param_updates_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] proposed_param_updates A constant pointer to the \ref cardano_proposed_param_updates_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p proposed_param_updates or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposed_param_updates_t* proposed_param_updates = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_proposed_param_updates_to_cbor(proposed_param_updates, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_proposed_param_updates_unref(&proposed_param_updates);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposed_param_updates_to_cbor(
+  const cardano_proposed_param_updates_t* proposed_param_updates,
+  cardano_cbor_writer_t*                  writer);
+
+/**
+ * \brief Serializes proposed parameter updates to CIP-116 JSON.
+ *
+ * The function writes a JSON object where keys are the hexadecimal representation
+ * of the genesis hash, and values are the protocol parameter update objects.
+ *
+ * \param[in]  updates Pointer to a valid \ref cardano_proposed_param_updates_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p updates or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposed_param_updates_to_cip116_json(
+  const cardano_proposed_param_updates_t* updates,
+  cardano_json_writer_t*                  writer);
+
+/**
+ * \brief Retrieves the number of proposed parameter updates.
+ *
+ * This function returns the number of proposed parameter updates in the
+ * proposed protocol parameter updates object.
+ *
+ * \param[in] proposed_param_updates Pointer to the proposed protocol parameter updates object.
+ *
+ * \return The number of proposed parameter updates in the map.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposed_param_updates_t* proposed_param_updates = NULL;
+ *
+ * // Assume proposed_param_updates is initialized properly
+ *
+ * size_t size = cardano_proposed_param_updates_get_size(proposed_param_updates);
+ * printf("Number of proposed parameter updates: %zu\n", size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_proposed_param_updates_get_size(const cardano_proposed_param_updates_t* proposed_param_updates);
+
+/**
+ * \brief Inserts a new Protocol Parameter Update into the proposed protocol parameter updates.
+ *
+ * This function inserts a new protocol parameter update into the proposed protocol parameter updates map.
+ *
+ * \param[in] proposed_param_updates Pointer to the proposed protocol parameter updates object.
+ * \param[in] genesis_delegate_key_hash Pointer to the key hash of the genesis delegate proposing the update.
+ * \param[in] protocol_param_update Pointer to the protocol parameter update being proposed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Protocol Parameter Update was successfully inserted, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposed_param_updates_t* proposed_param_updates = NULL;
+ * cardano_blake2b_hash_t* genesis_delegate_key_hash = NULL;
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * // Assume proposed_param_updates, genesis_delegate_key_hash, and protocol_param_update are initialized properly
+ *
+ * cardano_error_t result = cardano_proposed_param_updates_insert(proposed_param_updates, genesis_delegate_key_hash, protocol_param_update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The protocol parameter update was successfully inserted
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposed_param_updates_insert(
+  cardano_proposed_param_updates_t* proposed_param_updates,
+  cardano_blake2b_hash_t*           genesis_delegate_key_hash,
+  cardano_protocol_param_update_t*  protocol_param_update);
+
+/**
+ * \brief Retrieves a Protocol Parameter Update from the proposed protocol parameter updates.
+ *
+ * This function retrieves a protocol parameter update from the proposed protocol parameter updates map.
+ *
+ * \param[in] proposed_param_updates Pointer to the proposed protocol parameter updates object.
+ * \param[in] genesis_delegate_key_hash Pointer to the key hash of the genesis delegate proposing the update.
+ * \param[out] protocol_param_update On successful retrieval, this will point to the protocol parameter update
+ *                                   associated with the given genesis delegate key hash. The caller is responsible
+ *                                   for managing the lifecycle of this object. Specifically, once the protocol parameter update
+ *                                   is no longer needed, the caller must release it by calling \ref cardano_protocol_param_update_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Protocol Parameter Update was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposed_param_updates_t* proposed_param_updates = NULL;
+ * cardano_blake2b_hash_t* genesis_delegate_key_hash = NULL;
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * // Assume proposed_param_updates and genesis_delegate_key_hash are initialized properly
+ *
+ * cardano_error_t result = cardano_proposed_param_updates_get(proposed_param_updates, genesis_delegate_key_hash, &protocol_param_update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the protocol_param_update
+ *
+ *   // Once done, ensure to clean up and release the protocol_param_update
+ *   cardano_protocol_param_update_unref(&protocol_param_update);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposed_param_updates_get(
+  const cardano_proposed_param_updates_t* proposed_param_updates,
+  cardano_blake2b_hash_t*                 genesis_delegate_key_hash,
+  cardano_protocol_param_update_t**       protocol_param_update);
+
+/**
+ * \brief Retrieves the genesis delegate key hash at a specific index from the proposed protocol parameter updates.
+ *
+ * This function retrieves the genesis delegate key hash at the specified index from the proposed protocol parameter updates map.
+ *
+ * \param[in] proposed_param_updates Pointer to the proposed protocol parameter updates object.
+ * \param[in] index The index of the genesis delegate key hash to retrieve.
+ * \param[out] genesis_delegate_key_hash On successful retrieval, this will point to the genesis delegate key hash
+ *                                       at the specified index. The caller is responsible for managing the lifecycle
+ *                                       of this object. Specifically, once the genesis delegate key hash is no longer needed,
+ *                                       the caller must release it by calling \ref cardano_blake2b_hash_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the genesis delegate key hash was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposed_param_updates_t* proposed_param_updates = NULL;
+ * cardano_blake2b_hash_t* genesis_delegate_key_hash = NULL;
+ * size_t index = 0; // Index of the key hash to retrieve
+ *
+ * // Assume proposed_param_updates is initialized properly
+ *
+ * cardano_error_t result = cardano_proposed_param_updates_get_key_at(proposed_param_updates, index, &genesis_delegate_key_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the genesis_delegate_key_hash
+ *
+ *   // Once done, ensure to clean up and release the genesis_delegate_key_hash
+ *   cardano_blake2b_hash_unref(&genesis_delegate_key_hash);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposed_param_updates_get_key_at(
+  const cardano_proposed_param_updates_t* proposed_param_updates,
+  size_t                                  index,
+  cardano_blake2b_hash_t**                genesis_delegate_key_hash);
+
+/**
+ * \brief Retrieves the protocol parameter update at a specific index from the proposed protocol parameter updates.
+ *
+ * This function retrieves the protocol parameter update at the specified index from the proposed protocol parameter updates map.
+ *
+ * \param[in] proposed_param_updates Pointer to the proposed protocol parameter updates object.
+ * \param[in] index The index of the protocol parameter update to retrieve.
+ * \param[out] protocol_param_update On successful retrieval, this will point to the protocol parameter update
+ *                                   at the specified index. The caller is responsible for managing the lifecycle
+ *                                   of this object. Specifically, once the protocol parameter update is no longer needed,
+ *                                   the caller must release it by calling \ref cardano_protocol_param_update_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the protocol parameter update was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposed_param_updates_t* proposed_param_updates = NULL;
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * size_t index = 0; // Index of the parameter update to retrieve
+ *
+ * // Assume proposed_param_updates is initialized properly
+ *
+ * cardano_error_t result = cardano_proposed_param_updates_get_value_at(proposed_param_updates, index, &protocol_param_update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the protocol_param_update
+ *
+ *   // Once done, ensure to clean up and release the protocol_param_update
+ *   cardano_protocol_param_update_unref(&protocol_param_update);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposed_param_updates_get_value_at(
+  const cardano_proposed_param_updates_t* proposed_param_updates,
+  size_t                                  index,
+  cardano_protocol_param_update_t**       protocol_param_update);
+
+/**
+ * \brief Retrieves the genesis delegate key hash and protocol parameter update at the specified index.
+ *
+ * This function retrieves the genesis delegate key hash and protocol parameter update from the proposed parameter updates
+ * at the specified index.
+ *
+ * \param[in]  proposed_param_updates    Pointer to the proposed parameter updates object.
+ * \param[in]  index                     The index at which to retrieve the key-value pair.
+ * \param[out] genesis_delegate_key_hash On successful retrieval, this will point to the genesis delegate key hash at the specified index.
+ *                                       The caller is responsible for managing the lifecycle of this object and should release it using
+ *                                       \ref cardano_blake2b_hash_unref when it is no longer needed.
+ * \param[out] protocol_param_update     On successful retrieval, this will point to the protocol parameter update at the specified index.
+ *                                       The caller is responsible for managing the lifecycle of this object and should release it using
+ *                                       \ref cardano_protocol_param_update_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposed_param_updates_t* proposed_param_updates = NULL;
+ * // Assume proposed_param_updates is initialized properly
+ *
+ * size_t index = 0;
+ * cardano_blake2b_hash_t* genesis_delegate_key_hash = NULL;
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * cardano_error_t result = cardano_proposed_param_updates_get_key_value_at(proposed_param_updates, index, &genesis_delegate_key_hash, &protocol_param_update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (genesis_delegate_key_hash != NULL && protocol_param_update != NULL)
+ *   {
+ *     // Use the genesis delegate key hash and protocol parameter update
+ *   }
+ *   else
+ *   {
+ *     printf("Key-value pair not set at index %zu.\n", index);
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_proposed_param_updates_unref(&proposed_param_updates);
+ * cardano_blake2b_hash_unref(&genesis_delegate_key_hash);
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_proposed_param_updates_get_key_value_at(
+  const cardano_proposed_param_updates_t* proposed_param_updates,
+  size_t                                  index,
+  cardano_blake2b_hash_t**                genesis_delegate_key_hash,
+  cardano_protocol_param_update_t**       protocol_param_update);
+
+/**
+ * \brief Decrements the reference count of a cardano_proposed_param_updates_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_proposed_param_updates_t object
+ * by decreasing its reference count. When the reference count reaches zero, the proposed_param_updates is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] proposed_param_updates A pointer to the pointer of the proposed_param_updates object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_proposed_param_updates_t* proposed_param_updates = cardano_proposed_param_updates_new(major, minor);
+ *
+ * // Perform operations with the proposed_param_updates...
+ *
+ * cardano_proposed_param_updates_unref(&proposed_param_updates);
+ * // At this point, proposed_param_updates is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_proposed_param_updates_unref, the pointer to the \ref cardano_proposed_param_updates_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_proposed_param_updates_unref(cardano_proposed_param_updates_t** proposed_param_updates);
+
+/**
+ * \brief Increases the reference count of the cardano_proposed_param_updates_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_proposed_param_updates_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_proposed_param_updates_unref.
+ *
+ * \param proposed_param_updates A pointer to the cardano_proposed_param_updates_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming proposed_param_updates is a previously created proposed_param_updates object
+ *
+ * cardano_proposed_param_updates_ref(proposed_param_updates);
+ *
+ * // Now proposed_param_updates can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_proposed_param_updates_ref there is a corresponding
+ * call to \ref cardano_proposed_param_updates_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_proposed_param_updates_ref(cardano_proposed_param_updates_t* proposed_param_updates);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_proposed_param_updates_t object.
+ *
+ * This function returns the number of active references to an cardano_proposed_param_updates_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_proposed_param_updates_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param proposed_param_updates A pointer to the cardano_proposed_param_updates_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_proposed_param_updates_t object. If the object
+ * is properly managed (i.e., every \ref cardano_proposed_param_updates_ref call is matched with a
+ * \ref cardano_proposed_param_updates_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming proposed_param_updates is a previously created proposed_param_updates object
+ *
+ * size_t ref_count = cardano_proposed_param_updates_refcount(proposed_param_updates);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_proposed_param_updates_refcount(const cardano_proposed_param_updates_t* proposed_param_updates);
+
+/**
+ * \brief Sets the last error message for a given cardano_proposed_param_updates_t object.
+ *
+ * Records an error message in the proposed_param_updates's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] proposed_param_updates A pointer to the \ref cardano_proposed_param_updates_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the proposed_param_updates's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_proposed_param_updates_set_last_error(
+  cardano_proposed_param_updates_t* proposed_param_updates,
+  const char*                       message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific proposed_param_updates.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_proposed_param_updates_set_last_error for the given
+ * proposed_param_updates. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] proposed_param_updates A pointer to the \ref cardano_proposed_param_updates_t instance whose last error
+ *                   message is to be retrieved. If the proposed_param_updates is NULL, the function
+ *                   returns a generic error message indicating the null proposed_param_updates.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified proposed_param_updates. If the proposed_param_updates is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_proposed_param_updates_set_last_error for the same proposed_param_updates, or until
+ *       the proposed_param_updates is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_proposed_param_updates_get_last_error(
+  const cardano_proposed_param_updates_t* proposed_param_updates);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_proposed_param_updates_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_proposed_param_updates_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_proposed_param_updates_deep_clone(const cardano_proposed_param_updates_t* source, cardano_proposed_param_updates_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PROPOSED_PARAM_UPDATES_H
diff --git a/vendor/include/cardano/protocol_params/protocol_param_update.h b/vendor/include/cardano/protocol_params/protocol_param_update.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/protocol_params/protocol_param_update.h
@@ -0,0 +1,5540 @@
+/**
+ * \file protocol_param_update.h
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PROTOCOL_PARAM_UPDATE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PROTOCOL_PARAM_UPDATE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/ex_units.h>
+#include <cardano/common/protocol_version.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/protocol_params/costmdls.h>
+#include <cardano/protocol_params/drep_voting_thresholds.h>
+#include <cardano/protocol_params/ex_unit_prices.h>
+#include <cardano/protocol_params/pool_voting_thresholds.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The ProtocolParamUpdate structure in Cardano is used to propose changes to
+ * the protocol parameters of the blockchain. Protocol parameters govern various
+ * aspects of the Cardano network.
+ */
+typedef struct cardano_protocol_param_update_t cardano_protocol_param_update_t;
+
+/**
+ * \brief Creates and initializes a new instance of the protocol parameter update.
+ *
+ * This function allocates and initializes a new instance of the protocol parameter update,
+ * representing a set of updates to the Cardano protocol parameters.
+ *
+ * \param[out] protocol_param_update On successful initialization, this will point to a newly created
+ *            protocol parameter update object. This object represents a "strong reference",
+ *            meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the protocol parameter update is no longer needed, the caller must release it
+ *            by calling \ref cardano_protocol_param_update_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the protocol parameter update was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * // Attempt to create a new protocol parameter update object
+ * cardano_error_t result = cardano_protocol_param_update_new(&protocol_param_update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the protocol_param_update
+ *
+ *   // Once done, ensure to clean up and release the protocol_param_update
+ *   cardano_protocol_param_update_unref(&protocol_param_update);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_protocol_param_update_new(cardano_protocol_param_update_t** protocol_param_update);
+
+/**
+ * \brief Creates a \ref cardano_protocol_param_update_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_protocol_param_update_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a protocol_param_update.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] protocol_param_update A pointer to a pointer of \ref cardano_protocol_param_update_t that will be set to the address
+ *                        of the newly created protocol_param_update object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_protocol_param_update_t object by calling
+ *       \ref cardano_protocol_param_update_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * cardano_error_t result = cardano_protocol_param_update_from_cbor(reader, &protocol_param_update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the protocol_param_update
+ *
+ *   // Once done, ensure to clean up and release the protocol_param_update
+ *   cardano_protocol_param_update_unref(&protocol_param_update);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode protocol_param_update: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_protocol_param_update_from_cbor(cardano_cbor_reader_t* reader, cardano_protocol_param_update_t** protocol_param_update);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_protocol_param_update_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] protocol_param_update A constant pointer to the \ref cardano_protocol_param_update_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p protocol_param_update or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_protocol_param_update_to_cbor(protocol_param_update, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_to_cbor(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  cardano_cbor_writer_t*                 writer);
+
+/**
+ * \brief An opaque Plutus-data value (forward declaration).
+ */
+typedef struct cardano_plutus_data_t cardano_plutus_data_t;
+
+/**
+ * \brief Encodes a protocol-parameter update as Plutus data (the V3 ChangedParameters value).
+ *
+ * Produces the \c Map of parameter-id to value that the ledger embeds in a V3
+ * \c ParameterChange governance action's \c ChangedParameters field, matching the
+ * ledger's \c ToPlutusData (PParamsUpdate) instance: each set parameter is keyed
+ * by its integer id (the CBOR update key) and encoded by type — scalars as
+ * integers, rationals as gcd-reduced \c [num, den] lists, ex-units as
+ * \c [mem, steps], ex-unit prices as a pair of rationals, the pool/DRep voting
+ * thresholds as rational lists, and the cost models as a map of language id to a
+ * list of cost integers.
+ *
+ * \param[in] protocol_param_update The update to encode. Must not be NULL.
+ * \param[out] plutus_data On success, the newly allocated Plutus-data map. The
+ *             caller owns it and releases it with \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p protocol_param_update or \p plutus_data is NULL, or a propagated error.
+ */
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_to_plutus_data(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_plutus_data_t**          plutus_data);
+
+/**
+ * \brief Serializes a protocol parameter update to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * It checks each optional field; if a field is set in the update object, it is written to the JSON.
+ *
+ * \param[in]  update  Pointer to a valid \ref cardano_protocol_param_update_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p update or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_to_cip116_json(
+  const cardano_protocol_param_update_t* update,
+  cardano_json_writer_t*                 writer);
+
+/**
+ * \brief Retrieves the minimum fee A parameter from the protocol parameter update.
+ *
+ * This function returns the minimum fee A parameter from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] min_fee_a Pointer to where the minimum fee A value will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the minimum fee A was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if the
+ *         parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t min_fee_a;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_min_fee_a(protocol_param_update, &min_fee_a);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Min Fee A: %lu\n", min_fee_a);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Min Fee A is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving Min Fee A: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_min_fee_a(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              min_fee_a);
+
+/**
+ * \brief Retrieves the minimum fee B parameter from the protocol parameter update.
+ *
+ * This function returns the minimum fee B parameter from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] min_fee_b Pointer to where the minimum fee B value will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the minimum fee B was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if the
+ *         parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t min_fee_b;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_min_fee_b(protocol_param_update, &min_fee_b);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Min Fee B: %lu\n", min_fee_b);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Min Fee B is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving Min Fee B: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_min_fee_b(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              min_fee_b);
+
+/**
+ * \brief Retrieves the maximum block body size parameter from the protocol parameter update.
+ *
+ * This function returns the maximum block body size parameter from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_block_body_size Pointer to where the maximum block body size value will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum block body size was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_block_body_size;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_block_body_size(protocol_param_update, &max_block_body_size);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max Block Body Size: %lu\n", max_block_body_size);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Max Block Body Size is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving Max Block Body Size: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_block_body_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_block_body_size);
+
+/**
+ * \brief Retrieves the maximum transaction size parameter from the protocol parameter update.
+ *
+ * This function returns the maximum transaction size parameter from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_tx_size Pointer to where the maximum transaction size value will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum transaction size was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_tx_size;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_tx_size(protocol_param_update, &max_tx_size);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max Transaction Size: %lu\n", max_tx_size);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Max Transaction Size is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving Max Transaction Size: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_tx_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_tx_size);
+
+/**
+ * \brief Retrieves the maximum block header size parameter from the protocol parameter update.
+ *
+ * This function returns the maximum block header size parameter from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_block_header_size Pointer to where the maximum block header size value will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum block header size was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_block_header_size;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_block_header_size(protocol_param_update, &max_block_header_size);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max Block Header Size: %lu\n", max_block_header_size);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Max Block Header Size is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving Max Block Header Size: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_block_header_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_block_header_size);
+
+/**
+ * \brief Retrieves the key deposit parameter from the protocol parameter update.
+ *
+ * This function returns the key deposit parameter from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] key_deposit           Pointer to where the key deposit value will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key deposit was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t key_deposit;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_key_deposit(protocol_param_update, &key_deposit);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Key Deposit: %lu\n", key_deposit);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Key Deposit is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving Key Deposit: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_key_deposit(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              key_deposit);
+
+/**
+ * \brief Retrieves the pool deposit parameter from the protocol parameter update.
+ *
+ * This function returns the pool deposit parameter from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] pool_deposit          Pointer to where the pool deposit value will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool deposit was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t pool_deposit;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_pool_deposit(protocol_param_update, &pool_deposit);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool Deposit: %lu\n", pool_deposit);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Pool Deposit is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving Pool Deposit: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_pool_deposit(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              pool_deposit);
+
+/**
+ * \brief Retrieves the max epoch parameter from the protocol parameter update.
+ *
+ * This function returns the max epoch parameter from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_epoch             Pointer to where the max epoch value will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the max epoch was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_epoch;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_epoch(protocol_param_update, &max_epoch);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max Epoch: %lu\n", max_epoch);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Max Epoch is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving Max Epoch: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_epoch(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_epoch);
+
+/**
+ * \brief Retrieves the desired number of stake pools (nOpt) from the protocol parameter update.
+ *
+ * This function returns the desired number of stake pools (nOpt) from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] n_opt                 Pointer to where the desired number of stake pools will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the desired number of stake pools was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t n_opt;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_n_opt(protocol_param_update, &n_opt);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Desired number of stake pools (nOpt): %lu\n", n_opt);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Desired number of stake pools (nOpt) is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving desired number of stake pools (nOpt): %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_n_opt(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              n_opt);
+
+/**
+ * \brief Retrieves the pool pledge influence (a0) setting from the protocol parameter update.
+ *
+ * This function returns the pool pledge influence (a0) from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update   Pointer to the protocol parameter update object.
+ * \param[out] pool_pledge_influence   Pointer to where the pool pledge influence value will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool pledge influence was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* pool_pledge_influence = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_pool_pledge_influence(protocol_param_update, &pool_pledge_influence);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool pledge influence: %f\n", unit_interval_to_float(pool_pledge_influence));
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Pool pledge influence is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving pool pledge influence: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_pool_pledge_influence(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        pool_pledge_influence);
+
+/**
+ * \brief Retrieves the expansion rate setting from the protocol parameter update.
+ *
+ * This function returns the expansion rate from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] expansion_rate Pointer to where the expansion rate value will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the expansion rate was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* expansion_rate = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_expansion_rate(protocol_param_update, &expansion_rate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Expansion rate: %f\n", unit_interval_to_float(expansion_rate));
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Expansion rate is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving expansion rate: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_expansion_rate(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        expansion_rate);
+
+/**
+ * \brief Retrieves the treasury growth rate setting from the protocol parameter update.
+ *
+ * This function returns the treasury growth rate from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] treasury_growth_rate Pointer to where the treasury growth rate value will be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the treasury growth rate was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* treasury_growth_rate = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_treasury_growth_rate(protocol_param_update, &treasury_growth_rate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Treasury growth rate: %f\n", unit_interval_to_float(treasury_growth_rate));
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Treasury growth rate is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   printf("Error retrieving treasury growth rate: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_treasury_growth_rate(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        treasury_growth_rate);
+
+/**
+ * \brief Retrieves the decentralization parameter (d) from the protocol parameter update.
+ *
+ * This function retrieves the value of the decentralization parameter (d) from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] d                     On successful retrieval, this will point to the decentralization parameter (d).
+ *                                   If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the decentralization parameter was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* d = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_d(protocol_param_update, &d);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the decentralization parameter
+ *   printf("Decentralization parameter: %f\n", unit_interval_to_float(d));
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Decentralization parameter is not set.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get decentralization parameter: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_unit_interval_unref(&d);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_d(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        d);
+
+/**
+ * \brief Retrieves the extra entropy setting from the protocol parameter update.
+ *
+ * This function retrieves the extra entropy from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] extra_entropy Pointer to where the extra entropy value will be stored.
+ *                           If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the extra entropy was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_buffer_t* extra_entropy = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_extra_entropy(protocol_param_update, &extra_entropy);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the extra entropy
+ *   printf("Extra entropy retrieved.\n");
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Extra entropy is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get extra entropy: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_buffer_unref(&extra_entropy);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_extra_entropy(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_buffer_t**               extra_entropy);
+
+/**
+ * \brief Retrieves the protocol version from the protocol parameter update.
+ *
+ * This function retrieves the protocol version from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] protocol_version Pointer to where the protocol version will be stored.
+ *                              If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the protocol version was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_protocol_version_t* protocol_version = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_protocol_version(protocol_param_update, &protocol_version);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the protocol version
+ *   printf("Protocol version retrieved.\n");
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Protocol version is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get protocol version: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_protocol_version_unref(&protocol_version);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_protocol_version(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_protocol_version_t**     protocol_version);
+
+/**
+ * \brief Retrieves the minimum pool cost from the protocol parameter update.
+ *
+ * This function retrieves the minimum pool cost from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] min_pool_cost Pointer to where the minimum pool cost will be stored.
+ *                           If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the minimum pool cost was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t min_pool_cost = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_min_pool_cost(protocol_param_update, &min_pool_cost);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum pool cost retrieved: %lu.\n", min_pool_cost);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Minimum pool cost is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get minimum pool cost: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_min_pool_cost(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              min_pool_cost);
+
+/**
+ * \brief Retrieves the ADA cost per UTXO byte from the protocol parameter update.
+ *
+ * This function retrieves the ADA cost per UTXO byte from the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] ada_per_utxo_byte Pointer to where the ADA per UTXO byte will be stored.
+ *                               If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the ADA per UTXO byte was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t ada_per_utxo_byte = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_ada_per_utxo_byte(protocol_param_update, &ada_per_utxo_byte);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("ADA per UTXO byte retrieved: %lu.\n", ada_per_utxo_byte);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("ADA per UTXO byte is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get ADA per UTXO byte: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_ada_per_utxo_byte(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              ada_per_utxo_byte);
+
+/**
+ * \brief Retrieves the cost models from the protocol parameter update.
+ *
+ * This function retrieves the cost models from the protocol parameter update. The cost models are used
+ * to specify the computational cost of various operations within Plutus scripts.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] cost_models Pointer to where the cost models object will be stored.
+ *                         If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the cost models were successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_costmdls_t* cost_models = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_cost_models(protocol_param_update, &cost_models);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Cost models retrieved.\n");
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Cost models are not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get cost models: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_costmdls_unref(&cost_models);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_cost_models(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_costmdls_t**             cost_models);
+
+/**
+ * \brief Retrieves the execution costs from the protocol parameter update.
+ *
+ * This function returns the execution costs from the protocol parameter update. Execution costs
+ * define the price for computational resources used by smart contracts on the blockchain.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] execution_costs Pointer to where the execution costs object will be stored.
+ *                             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the execution costs were successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_ex_unit_prices_t* execution_costs = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_execution_costs(protocol_param_update, &execution_costs);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Execution costs retrieved.\n");
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Execution costs are not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get execution costs: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_ex_unit_prices_unref(&execution_costs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_execution_costs(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_unit_prices_t**       execution_costs);
+
+/**
+ * \brief Retrieves the maximum transaction execution units from the protocol parameter update.
+ *
+ * This function returns the maximum execution units that a transaction can consume. Execution units
+ * are measurements of the computational and memory resources used by transactions involving smart contracts.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_tx_ex_units Pointer to where the maximum transaction execution units object will be stored.
+ *                             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum transaction execution units were successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_ex_units_t* max_tx_ex_units = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_tx_ex_units(protocol_param_update, &max_tx_ex_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum transaction execution units retrieved.\n");
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Maximum transaction execution units are not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get maximum transaction execution units: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_ex_units_unref(&max_tx_ex_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_tx_ex_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t**             max_tx_ex_units);
+
+/**
+ * \brief Retrieves the maximum block execution units from the protocol parameter update.
+ *
+ * This function returns the maximum execution units that a block can consume. Execution units
+ * measure the computational and memory resources used by transactions involving smart contracts within a block.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_block_ex_units Pointer to where the maximum block execution units object will be stored.
+ *                                If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum block execution units were successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_ex_units_t* max_block_ex_units = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_block_ex_units(protocol_param_update, &max_block_ex_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum block execution units retrieved.\n");
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Maximum block execution units are not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get maximum block execution units: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_ex_units_unref(&max_block_ex_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_block_ex_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t**             max_block_ex_units);
+
+/**
+ * \brief Retrieves the maximum value size from the protocol parameter update.
+ *
+ * This function returns the maximum serialized length (in bytes) of a multi-asset value (token bundle)
+ * in a transaction output.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_value_size Pointer to where the maximum value size will be stored. If the parameter is not set,
+ *                            the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum value size was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_value_size = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_value_size(protocol_param_update, &max_value_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum value size retrieved: %lu bytes.\n", max_value_size);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Maximum value size is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get maximum value size: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_value_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_value_size);
+
+/**
+ * \brief Retrieves the collateral percentage from the protocol parameter update.
+ *
+ * This function returns the percentage of the total transaction fee that the collateral must (at minimum) cover.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] collateral_percentage Pointer to where the collateral percentage will be stored. If the parameter is not set,
+ *                                   the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the collateral percentage was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t collateral_percentage = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_collateral_percentage(protocol_param_update, &collateral_percentage);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Collateral percentage retrieved: %lu.\n", collateral_percentage);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Collateral percentage is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get collateral percentage: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_collateral_percentage(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              collateral_percentage);
+
+/**
+ * \brief Retrieves the maximum number of collateral inputs from the protocol parameter update.
+ *
+ * This function returns the limit on the total number of collateral inputs allowed in a transaction.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_collateral_inputs Pointer to where the maximum number of collateral inputs will be stored.
+ *                                   If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum number of collateral inputs was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_collateral_inputs = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_collateral_inputs(protocol_param_update, &max_collateral_inputs);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max collateral inputs retrieved: %lu.\n", max_collateral_inputs);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Max collateral inputs is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get max collateral inputs: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_collateral_inputs(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_collateral_inputs);
+
+/**
+ * \brief Retrieves the pool voting thresholds from the protocol parameter update.
+ *
+ * This function returns the thresholds for pool voting included in the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] pool_voting_thresholds Pointer to where the pool voting thresholds will be stored.
+ *                                    If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool voting thresholds were successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_pool_voting_thresholds(protocol_param_update, &pool_voting_thresholds);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool voting thresholds retrieved successfully.\n");
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Pool voting thresholds are not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get pool voting thresholds: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_pool_voting_thresholds(
+  cardano_protocol_param_update_t*   protocol_param_update,
+  cardano_pool_voting_thresholds_t** pool_voting_thresholds);
+
+/**
+ * \brief Retrieves the DRep voting thresholds from the protocol parameter update.
+ *
+ * This function returns the thresholds for DRep voting included in the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] drep_voting_thresholds Pointer to where the DRep voting thresholds will be stored.
+ *                                    If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the DRep voting thresholds were successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_drep_voting_thresholds(protocol_param_update, &drep_voting_thresholds);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DRep voting thresholds retrieved successfully.\n");
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("DRep voting thresholds are not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get DRep voting thresholds: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_drep_voting_thresholds(
+  cardano_protocol_param_update_t*   protocol_param_update,
+  cardano_drep_voting_thresholds_t** drep_voting_thresholds);
+
+/**
+ * \brief Retrieves the minimum committee size from the protocol parameter update.
+ *
+ * This function returns the minimum committee size included in the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] min_committee_size Pointer to where the minimum committee size will be stored.
+ *                                If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the minimum committee size was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t min_committee_size = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_min_committee_size(protocol_param_update, &min_committee_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum committee size retrieved successfully: %lu.\n", min_committee_size);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Minimum committee size is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get minimum committee size: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_min_committee_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              min_committee_size);
+
+/**
+ * \brief Retrieves the committee term limit from the protocol parameter update.
+ *
+ * This function returns the committee term limit included in the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] committee_term_limit Pointer to where the committee term limit will be stored.
+ *                                  If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the committee term limit was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t committee_term_limit = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_committee_term_limit(protocol_param_update, &committee_term_limit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Committee term limit retrieved successfully: %lu.\n", committee_term_limit);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Committee term limit is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get committee term limit: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_committee_term_limit(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              committee_term_limit);
+
+/**
+ * \brief Retrieves the governance action validity period from the protocol parameter update.
+ *
+ * This function returns the governance action validity period included in the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] governance_action_validity_period Pointer to where the governance action validity period will be stored.
+ *                                               If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the governance action validity period was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t governance_action_validity_period = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_governance_action_validity_period(protocol_param_update, &governance_action_validity_period);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Governance action validity period retrieved successfully: %lu.\n", governance_action_validity_period);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Governance action validity period is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get governance action validity period: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_governance_action_validity_period(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              governance_action_validity_period);
+
+/**
+ * \brief Retrieves the governance action deposit from the protocol parameter update.
+ *
+ * This function returns the governance action deposit included in the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] governance_action_deposit Pointer to where the governance action deposit will be stored.
+ *                                       If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the governance action deposit was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t governance_action_deposit = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_governance_action_deposit(protocol_param_update, &governance_action_deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Governance action deposit retrieved successfully: %lu.\n", governance_action_deposit);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Governance action deposit is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get governance action deposit: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_governance_action_deposit(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              governance_action_deposit);
+
+/**
+ * \brief Retrieves the DRep deposit from the protocol parameter update.
+ *
+ * This function returns the DRep deposit included in the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] drep_deposit Pointer to where the DRep deposit will be stored. If the parameter is not set,
+ *                          the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the DRep deposit was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t drep_deposit = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_drep_deposit(protocol_param_update, &drep_deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DRep deposit retrieved successfully: %lu.\n", drep_deposit);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("DRep deposit is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get DRep deposit: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_drep_deposit(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              drep_deposit);
+
+/**
+ * \brief Retrieves the DRep inactivity period from the protocol parameter update.
+ *
+ * This function returns the DRep inactivity period included in the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] drep_inactivity_period Pointer to where the DRep inactivity period will be stored. If the parameter is not set,
+ *                                    the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the DRep inactivity period was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t drep_inactivity_period = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_drep_inactivity_period(protocol_param_update, &drep_inactivity_period);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DRep inactivity period retrieved successfully: %lu.\n", drep_inactivity_period);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("DRep inactivity period is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get DRep inactivity period: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_drep_inactivity_period(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              drep_inactivity_period);
+
+/**
+ * \brief Retrieves the reference script cost per byte from the protocol parameter update.
+ *
+ * This function returns the reference script cost per byte included in the protocol parameter update.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] ref_script_cost_per_byte Pointer to where the reference script cost per byte will be stored.
+ *                                      If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reference script cost per byte was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* ref_script_cost_per_byte = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_ref_script_cost_per_byte(protocol_param_update, &ref_script_cost_per_byte);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Reference script cost per byte retrieved successfully: %f.\n", cardano_unit_interval_to_double(ref_script_cost_per_byte));
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Reference script cost per byte is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get reference script cost per byte: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_unit_interval_unref(&ref_script_cost_per_byte);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_ref_script_cost_per_byte(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        ref_script_cost_per_byte);
+
+/**
+ * \brief Retrieves the maximum total reference script size per block from the protocol parameter update.
+ *
+ * This function returns the maximum cumulative size, in bytes, of the reference scripts that
+ * a single block may use. On the wire this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_ref_script_size_per_block Pointer to where the maximum reference script size per block will be stored.
+ *                                           If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum reference script size per block was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_ref_script_size_per_block = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_ref_script_size_per_block(protocol_param_update, &max_ref_script_size_per_block);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max ref script size per block retrieved successfully: %lu.\n", max_ref_script_size_per_block);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Max ref script size per block is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get max ref script size per block: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_ref_script_size_per_block(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_ref_script_size_per_block);
+
+/**
+ * \brief Retrieves the maximum total reference script size per transaction from the protocol parameter update.
+ *
+ * This function returns the maximum cumulative size, in bytes, of the reference scripts that
+ * a single transaction may use. On the wire this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_ref_script_size_per_tx Pointer to where the maximum reference script size per transaction will be stored.
+ *                                        If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum reference script size per transaction was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_ref_script_size_per_tx = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_ref_script_size_per_tx(protocol_param_update, &max_ref_script_size_per_tx);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max ref script size per tx retrieved successfully: %lu.\n", max_ref_script_size_per_tx);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Max ref script size per tx is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get max ref script size per tx: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_ref_script_size_per_tx(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_ref_script_size_per_tx);
+
+/**
+ * \brief Retrieves the reference script cost stride from the protocol parameter update.
+ *
+ * This function returns the size step, in bytes, at which the reference script fee tier
+ * increases. On the wire this parameter is a positive 32-bit unsigned integer; zero is
+ * not a valid value.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] ref_script_cost_stride Pointer to where the reference script cost stride will be stored.
+ *                                    If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reference script cost stride was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t ref_script_cost_stride = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_ref_script_cost_stride(protocol_param_update, &ref_script_cost_stride);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Ref script cost stride retrieved successfully: %lu.\n", ref_script_cost_stride);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Ref script cost stride is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get ref script cost stride: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_ref_script_cost_stride(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              ref_script_cost_stride);
+
+/**
+ * \brief Retrieves the reference script cost multiplier from the protocol parameter update.
+ *
+ * This function returns the multiplier applied to the reference script fee at each cost stride.
+ * On the wire this parameter is a positive interval (a rational number); its value is expected
+ * to be greater than zero.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] ref_script_cost_multiplier Pointer to where the reference script cost multiplier will be stored.
+ *                                        If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reference script cost multiplier was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* ref_script_cost_multiplier = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_ref_script_cost_multiplier(protocol_param_update, &ref_script_cost_multiplier);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Ref script cost multiplier retrieved successfully: %f.\n", cardano_unit_interval_to_double(ref_script_cost_multiplier));
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Ref script cost multiplier is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get ref script cost multiplier: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_unit_interval_unref(&ref_script_cost_multiplier);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_ref_script_cost_multiplier(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        ref_script_cost_multiplier);
+
+/**
+ * \brief Retrieves the maximum pledge leverage from the protocol parameter update.
+ *
+ * This function returns the maximum pledge leverage of a stake pool (CIP-50): the largest ratio between
+ * a pool's total stake and its pledge that still earns full rewards. The parameter is nullable: an update
+ * can propose a bounded leverage (a nonnegative rational, which may be greater than one) or propose
+ * removing the bound altogether, encoded as CBOR null on the wire.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_pledge_leverage Pointer to where the maximum pledge leverage will be stored. When the
+ *             update proposes an unbounded leverage the function succeeds and stores NULL. If the parameter
+ *             is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum pledge leverage was successfully retrieved (bounded or unbounded), or
+ *         \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if the parameter is not set in the update. Other appropriate
+ *         error codes may indicate different failure reasons.
+ *
+ * \note When a bounded value is returned, the caller is responsible for releasing it by calling
+ *       \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* max_pledge_leverage = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_pledge_leverage(protocol_param_update, &max_pledge_leverage);
+ *
+ * if ((result == CARDANO_SUCCESS) && (max_pledge_leverage != NULL))
+ * {
+ *   printf("Max pledge leverage retrieved successfully: %f.\n", cardano_unit_interval_to_double(max_pledge_leverage));
+ * }
+ * else if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The update proposes an unbounded pledge leverage.\n");
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Max pledge leverage is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get max pledge leverage: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_unit_interval_unref(&max_pledge_leverage);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_pledge_leverage(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        max_pledge_leverage);
+
+/**
+ * \brief Checks whether the protocol parameter update proposes a change to the maximum pledge leverage.
+ *
+ * This function reports whether the update carries the maximum pledge leverage parameter, regardless of
+ * whether the proposed value is a bounded leverage or the unbounded (null) form.
+ *
+ * \param[in] protocol_param_update Pointer to the protocol parameter update object.
+ *
+ * \return \c true if the update proposes a maximum pledge leverage (bounded or unbounded), \c false if the
+ *         parameter is not part of the update or \p protocol_param_update is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * if (cardano_protocol_param_update_has_max_pledge_leverage(protocol_param_update))
+ * {
+ *   printf("The update proposes a change to the max pledge leverage.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_protocol_param_update_has_max_pledge_leverage(
+  const cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Retrieves the minimum pool margin from the protocol parameter update.
+ *
+ * This function returns the minimum margin that a stake pool may declare (CIP-23). On the wire this
+ * parameter is a unit interval (a rational number between zero and one).
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] min_pool_margin Pointer to where the minimum pool margin will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the minimum pool margin was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * \note The caller is responsible for releasing the returned \ref cardano_unit_interval_t object by
+ *       calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* min_pool_margin = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_min_pool_margin(protocol_param_update, &min_pool_margin);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum pool margin retrieved successfully: %f.\n", cardano_unit_interval_to_double(min_pool_margin));
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Minimum pool margin is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get minimum pool margin: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_unit_interval_unref(&min_pool_margin);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_min_pool_margin(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        min_pool_margin);
+
+/**
+ * \brief Retrieves the Leios announcement period length from the protocol parameter update.
+ *
+ * This function returns the length, in milliseconds, of the Leios announcement period (CIP-164). On the
+ * wire this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] leios_announcement_period_length Pointer to where the Leios announcement period length will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Leios announcement period length was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t leios_announcement_period_length = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_leios_announcement_period_length(protocol_param_update, &leios_announcement_period_length);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios announcement period length retrieved successfully: %lu.\n", leios_announcement_period_length);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Leios announcement period length is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get Leios announcement period length: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_leios_announcement_period_length(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              leios_announcement_period_length);
+
+/**
+ * \brief Retrieves the Leios vote period length from the protocol parameter update.
+ *
+ * This function returns the length, in milliseconds, of the Leios vote period (CIP-164). On the wire this
+ * parameter is a 32-bit unsigned integer.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] leios_vote_period_length Pointer to where the Leios vote period length will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Leios vote period length was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t leios_vote_period_length = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_leios_vote_period_length(protocol_param_update, &leios_vote_period_length);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios vote period length retrieved successfully: %lu.\n", leios_vote_period_length);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Leios vote period length is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get Leios vote period length: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_leios_vote_period_length(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              leios_vote_period_length);
+
+/**
+ * \brief Retrieves the Leios diffusion period length from the protocol parameter update.
+ *
+ * This function returns the length, in milliseconds, of the Leios diffusion period (CIP-164). On the wire
+ * this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] leios_diffusion_period_length Pointer to where the Leios diffusion period length will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Leios diffusion period length was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t leios_diffusion_period_length = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_leios_diffusion_period_length(protocol_param_update, &leios_diffusion_period_length);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios diffusion period length retrieved successfully: %lu.\n", leios_diffusion_period_length);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Leios diffusion period length is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get Leios diffusion period length: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_leios_diffusion_period_length(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              leios_diffusion_period_length);
+
+/**
+ * \brief Retrieves the Leios committee size from the protocol parameter update.
+ *
+ * This function returns the number of members of the Leios voting committee (CIP-164). On the wire this
+ * parameter is a 16-bit unsigned integer.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] leios_committee_size Pointer to where the Leios committee size will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Leios committee size was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t leios_committee_size = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_leios_committee_size(protocol_param_update, &leios_committee_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios committee size retrieved successfully: %lu.\n", leios_committee_size);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Leios committee size is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get Leios committee size: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_leios_committee_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              leios_committee_size);
+
+/**
+ * \brief Retrieves the Leios quorum stake threshold from the protocol parameter update.
+ *
+ * This function returns the fraction of the committee stake that a Leios vote needs to reach a quorum
+ * (CIP-164). On the wire this parameter is a unit interval (a rational number between zero and one).
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] leios_quorum_stake_threshold Pointer to where the Leios quorum stake threshold will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Leios quorum stake threshold was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * \note The caller is responsible for releasing the returned \ref cardano_unit_interval_t object by
+ *       calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* leios_quorum_stake_threshold = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_leios_quorum_stake_threshold(protocol_param_update, &leios_quorum_stake_threshold);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios quorum stake threshold retrieved successfully: %f.\n", cardano_unit_interval_to_double(leios_quorum_stake_threshold));
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Leios quorum stake threshold is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get Leios quorum stake threshold: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_unit_interval_unref(&leios_quorum_stake_threshold);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_leios_quorum_stake_threshold(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        leios_quorum_stake_threshold);
+
+/**
+ * \brief Retrieves the maximum endorser block references size from the protocol parameter update.
+ *
+ * This function returns the maximum total size, in bytes, of the references carried by a Leios endorser
+ * block. On the wire this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_endorser_block_references_size Pointer to where the maximum endorser block references size will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum endorser block references size was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_endorser_block_references_size = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_endorser_block_references_size(protocol_param_update, &max_endorser_block_references_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum endorser block references size retrieved successfully: %lu.\n", max_endorser_block_references_size);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Maximum endorser block references size is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get maximum endorser block references size: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_endorser_block_references_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_endorser_block_references_size);
+
+/**
+ * \brief Retrieves the maximum endorser block transactions size from the protocol parameter update.
+ *
+ * This function returns the maximum total size, in bytes, of the transactions referenced by a Leios
+ * endorser block. On the wire this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_endorser_block_txs_size Pointer to where the maximum endorser block transactions size will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum endorser block transactions size was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_endorser_block_txs_size = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_endorser_block_txs_size(protocol_param_update, &max_endorser_block_txs_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum endorser block transactions size retrieved successfully: %lu.\n", max_endorser_block_txs_size);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Maximum endorser block transactions size is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get maximum endorser block transactions size: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_endorser_block_txs_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_endorser_block_txs_size);
+
+/**
+ * \brief Retrieves the maximum endorser block execution units from the protocol parameter update.
+ *
+ * This function returns the maximum execution units that the scripts of a Leios endorser block can
+ * consume (CIP-164). Execution units are measurements of the computational and memory resources used
+ * by transactions involving smart contracts.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_endorser_block_execution_units Pointer to where the maximum endorser block execution units object will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum endorser block execution units were successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * \note The caller is responsible for releasing the returned \ref cardano_ex_units_t object by
+ *       calling \ref cardano_ex_units_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_ex_units_t* max_endorser_block_execution_units = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_endorser_block_execution_units(protocol_param_update, &max_endorser_block_execution_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum endorser block execution units retrieved.\n");
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Maximum endorser block execution units are not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get maximum endorser block execution units: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_ex_units_unref(&max_endorser_block_execution_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_endorser_block_execution_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t**             max_endorser_block_execution_units);
+
+/**
+ * \brief Retrieves the maximum reference script size per endorser block from the protocol parameter update.
+ *
+ * This function returns the maximum cumulative size, in bytes, of the reference scripts that a Leios
+ * endorser block may use. On the wire this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] max_ref_script_size_per_endorser_block Pointer to where the maximum reference script size per endorser block will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum reference script size per endorser block was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_ref_script_size_per_endorser_block = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_max_ref_script_size_per_endorser_block(protocol_param_update, &max_ref_script_size_per_endorser_block);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum reference script size per endorser block retrieved successfully: %lu.\n", max_ref_script_size_per_endorser_block);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Maximum reference script size per endorser block is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get maximum reference script size per endorser block: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_max_ref_script_size_per_endorser_block(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_ref_script_size_per_endorser_block);
+
+/**
+ * \brief Retrieves the Peras minimum candidate block age from the protocol parameter update.
+ *
+ * This function returns the minimum age, in slots, that a block must have to be eligible for voting in a Peras round. On the wire this parameter is a slot interval (a 32-bit unsigned integer).
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] peras_min_candidate_block_age Pointer to where the Peras minimum candidate block age will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras minimum candidate block age was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t peras_min_candidate_block_age = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_peras_min_candidate_block_age(protocol_param_update, &peras_min_candidate_block_age);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras minimum candidate block age retrieved successfully: %lu.\n", peras_min_candidate_block_age);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Peras minimum candidate block age is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get Peras minimum candidate block age: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_peras_min_candidate_block_age(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              peras_min_candidate_block_age);
+
+/**
+ * \brief Retrieves the Peras healing factor from the protocol parameter update.
+ *
+ * This function returns the healing time coefficient used to derive the length of a Peras cooldown period. On the wire this parameter is a positive interval (a rational number greater than zero).
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] peras_healing_factor Pointer to where the Peras healing factor will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras healing factor was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * \note The caller is responsible for releasing the returned \ref cardano_unit_interval_t object by
+ *       calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* peras_healing_factor = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_peras_healing_factor(protocol_param_update, &peras_healing_factor);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras healing factor retrieved successfully: %f.\n", cardano_unit_interval_to_double(peras_healing_factor));
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Peras healing factor is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get Peras healing factor: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_unit_interval_unref(&peras_healing_factor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_peras_healing_factor(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        peras_healing_factor);
+
+/**
+ * \brief Retrieves the Peras certificate boost from the protocol parameter update.
+ *
+ * This function returns the extra chain weight that a Peras certificate gives to the block it boosts. On the wire this parameter is a 16-bit unsigned integer.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] peras_cert_boost Pointer to where the Peras certificate boost will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras certificate boost was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t peras_cert_boost = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_peras_cert_boost(protocol_param_update, &peras_cert_boost);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras certificate boost retrieved successfully: %lu.\n", peras_cert_boost);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Peras certificate boost is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get Peras certificate boost: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_peras_cert_boost(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              peras_cert_boost);
+
+/**
+ * \brief Retrieves the Peras target committee size from the protocol parameter update.
+ *
+ * This function returns the target number of members of the Peras voting committee. On the wire this parameter is a 16-bit unsigned integer.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] peras_target_committee_size Pointer to where the Peras target committee size will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras target committee size was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t peras_target_committee_size = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_peras_target_committee_size(protocol_param_update, &peras_target_committee_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras target committee size retrieved successfully: %lu.\n", peras_target_committee_size);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Peras target committee size is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get Peras target committee size: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_peras_target_committee_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              peras_target_committee_size);
+
+/**
+ * \brief Retrieves the Peras bootstrap round from the protocol parameter update.
+ *
+ * This function returns the Peras round number used to manually bootstrap voting at a specific time. The parameter is nullable: an update can propose a round (on the wire
+ * a 32-bit unsigned integer) or propose having no bootstrap round at all, encoded as CBOR null on the wire. Use
+ * \ref cardano_protocol_param_update_is_peras_bootstrap_round_null to tell a proposal of no bootstrap round from an update that does
+ * not change the parameter.
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] peras_bootstrap_round Pointer to where the Peras bootstrap round will be stored. If the update does not propose a
+ *             round, either because the parameter is not set or because it proposes having no bootstrap round (null),
+ *             the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras bootstrap round was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if the
+ *         update does not propose a round. Other appropriate error codes may indicate different failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t peras_bootstrap_round = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_peras_bootstrap_round(protocol_param_update, &peras_bootstrap_round);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras bootstrap round retrieved successfully: %lu.\n", peras_bootstrap_round);
+ * }
+ * else if (cardano_protocol_param_update_is_peras_bootstrap_round_null(protocol_param_update))
+ * {
+ *   printf("The update proposes having no Peras bootstrap round.\n");
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Peras bootstrap round is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get Peras bootstrap round: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_peras_bootstrap_round(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              peras_bootstrap_round);
+
+/**
+ * \brief Checks whether the protocol parameter update proposes a change to the Peras bootstrap round.
+ *
+ * This function reports whether the update carries the Peras bootstrap round parameter, regardless of
+ * whether the proposed value is a round or the null form.
+ *
+ * \param[in] protocol_param_update Pointer to the protocol parameter update object.
+ *
+ * \return \c true if the update proposes a Peras bootstrap round (a round or null), \c false if the
+ *         parameter is not part of the update or \p protocol_param_update is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * if (cardano_protocol_param_update_has_peras_bootstrap_round(protocol_param_update))
+ * {
+ *   printf("The update proposes a change to the Peras bootstrap round.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_protocol_param_update_has_peras_bootstrap_round(
+  const cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Checks whether the protocol parameter update proposes having no Peras bootstrap round.
+ *
+ * This function reports whether the update carries the Peras bootstrap round parameter in its null form, encoded as CBOR
+ * null on the wire, which proposes removing the bootstrap round.
+ *
+ * \param[in] protocol_param_update Pointer to the protocol parameter update object.
+ *
+ * \return \c true if the update proposes having no Peras bootstrap round, \c false if it proposes a round, if the
+ *         parameter is not part of the update or if \p protocol_param_update is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * if (cardano_protocol_param_update_is_peras_bootstrap_round_null(protocol_param_update))
+ * {
+ *   printf("The update proposes having no Peras bootstrap round.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_protocol_param_update_is_peras_bootstrap_round_null(
+  const cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Retrieves the Peras quorum threshold safety margin from the protocol parameter update.
+ *
+ * This function returns the extra safety margin added on top of the 75% Peras quorum threshold baseline (the ledger requires it to be between 0 and 0.25, inclusive). On the wire this parameter is a unit interval (a rational number between zero and one).
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] peras_quorum_threshold_safety_margin Pointer to where the Peras quorum threshold safety margin will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras quorum threshold safety margin was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * \note The caller is responsible for releasing the returned \ref cardano_unit_interval_t object by
+ *       calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* peras_quorum_threshold_safety_margin = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_peras_quorum_threshold_safety_margin(protocol_param_update, &peras_quorum_threshold_safety_margin);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras quorum threshold safety margin retrieved successfully: %f.\n", cardano_unit_interval_to_double(peras_quorum_threshold_safety_margin));
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Peras quorum threshold safety margin is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get Peras quorum threshold safety margin: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_unit_interval_unref(&peras_quorum_threshold_safety_margin);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_peras_quorum_threshold_safety_margin(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        peras_quorum_threshold_safety_margin);
+
+/**
+ * \brief Retrieves the reference inputs cost per multi-asset byte from the protocol parameter update.
+ *
+ * This function returns the fee, in lovelace, charged for every multi-asset byte present in the values of the outputs a transaction references through its reference inputs. On the wire this parameter is a coin amount (an unsigned integer).
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] ref_inputs_cost_per_multi_asset_byte Pointer to where the reference inputs cost per multi-asset byte will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reference inputs cost per multi-asset byte was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t ref_inputs_cost_per_multi_asset_byte = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_ref_inputs_cost_per_multi_asset_byte(protocol_param_update, &ref_inputs_cost_per_multi_asset_byte);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Reference inputs cost per multi-asset byte retrieved successfully: %lu.\n", ref_inputs_cost_per_multi_asset_byte);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Reference inputs cost per multi-asset byte is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get reference inputs cost per multi-asset byte: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_ref_inputs_cost_per_multi_asset_byte(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              ref_inputs_cost_per_multi_asset_byte);
+
+/**
+ * \brief Retrieves the reference inputs cost per datum byte from the protocol parameter update.
+ *
+ * This function returns the fee, in lovelace, charged per byte of the datums attached to the outputs a transaction references through its reference inputs. On the wire this parameter is a coin amount (an unsigned integer).
+ *
+ * \param[in]  protocol_param_update Pointer to the protocol parameter update object.
+ * \param[out] ref_inputs_cost_per_datum_byte Pointer to where the reference inputs cost per datum byte will be stored.
+ *             If the parameter is not set, the function will return \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reference inputs cost per datum byte was successfully retrieved, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the parameter is not set in the update. Other appropriate error codes may indicate different
+ *         failure reasons.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t ref_inputs_cost_per_datum_byte = 0;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_get_ref_inputs_cost_per_datum_byte(protocol_param_update, &ref_inputs_cost_per_datum_byte);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Reference inputs cost per datum byte retrieved successfully: %lu.\n", ref_inputs_cost_per_datum_byte);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("Reference inputs cost per datum byte is not proposed for change.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get reference inputs cost per datum byte: %d\n", result);
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_ref_inputs_cost_per_datum_byte(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              ref_inputs_cost_per_datum_byte);
+
+/**
+ * \brief Sets the minimum fee A in the protocol parameter update.
+ *
+ * This function sets the minimum fee A value in the protocol parameter update.
+ * If NULL is passed for min_fee_a, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     min_fee_a Pointer to the value of minimum fee A to be set.
+ *               If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the minimum fee A was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_min_fee_a = 500;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_min_fee_a(protocol_param_update, &proposed_min_fee_a);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum fee A set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set minimum fee A.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_min_fee_a(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  min_fee_a);
+
+/**
+ * \brief Sets the minimum fee B in the protocol parameter update.
+ *
+ * This function sets the minimum fee B value in the protocol parameter update.
+ * If NULL is passed for min_fee_b, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     min_fee_b Pointer to the value of minimum fee B to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the minimum fee B was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_min_fee_b = 2;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_min_fee_b(protocol_param_update, &proposed_min_fee_b);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum fee B set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set minimum fee B.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_min_fee_b(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  min_fee_b);
+
+/**
+ * \brief Sets the maximum block body size in the protocol parameter update.
+ *
+ * This function sets the maximum block body size in the protocol parameter update.
+ * If NULL is passed for max_block_body_size, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_block_body_size Pointer to the value of maximum block body size to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum block body size was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_max_block_body_size = 1024000;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_block_body_size(protocol_param_update, &proposed_max_block_body_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum block body size set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set maximum block body size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_block_body_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_block_body_size);
+
+/**
+ * \brief Sets the maximum transaction size in the protocol parameter update.
+ *
+ * This function sets the maximum transaction size in the protocol parameter update.
+ * If NULL is passed for max_tx_size, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_tx_size Pointer to the value of maximum transaction size to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum transaction size was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_max_tx_size = 16384;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_tx_size(protocol_param_update, &proposed_max_tx_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum transaction size set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set maximum transaction size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_tx_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_tx_size);
+
+/**
+ * \brief Sets the maximum block header size in the protocol parameter update.
+ *
+ * This function sets the maximum block header size in the protocol parameter update.
+ * If NULL is passed for max_block_header_size, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_block_header_size Pointer to the value of maximum block header size to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum block header size was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_max_block_header_size = 1024;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_block_header_size(protocol_param_update, &proposed_max_block_header_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum block header size set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set maximum block header size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_block_header_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_block_header_size);
+
+/**
+ * \brief Sets the key deposit in the protocol parameter update.
+ *
+ * This function sets the key deposit in the protocol parameter update.
+ * If NULL is passed for key_deposit, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     key_deposit Pointer to the value of key deposit to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key deposit was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_key_deposit = 2000000; // Example value in lovelace
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_key_deposit(protocol_param_update, &proposed_key_deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Key deposit set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set key deposit.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_key_deposit(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  key_deposit);
+
+/**
+ * \brief Sets the pool deposit in the protocol parameter update.
+ *
+ * This function sets the pool deposit in the protocol parameter update.
+ * If NULL is passed for pool_deposit, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     pool_deposit Pointer to the value of pool deposit to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool deposit was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_pool_deposit = 5000000; // Example value in lovelace
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_pool_deposit(protocol_param_update, &proposed_pool_deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool deposit set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set pool deposit.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_pool_deposit(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  pool_deposit);
+
+/**
+ * \brief Sets the maximum epoch (number of epochs) for which a pool can be ranked in
+ * the non-myopic member rewards.
+
+ * This function sets the maximum epoch in the protocol parameter update.
+ * If NULL is passed for max_epoch, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_epoch Pointer to the value of maximum epoch to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum epoch was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_max_epoch = 250; // Example value
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_epoch(protocol_param_update, &proposed_max_epoch);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum epoch set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set maximum epoch.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_epoch(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_epoch);
+
+/**
+ * \brief Sets the desired number of stake pools. It's used in the rewards calculation
+ * to encourage a certain number of active stake pools.
+ *
+ * This function sets the desired number of stake pools (n_opt) in the protocol parameter update.
+ * If NULL is passed for n_opt, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     n_opt Pointer to the value of the desired number of stake pools to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the desired number of stake pools was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_n_opt = 150; // Example value
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_n_opt(protocol_param_update, &proposed_n_opt);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Desired number of stake pools set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set desired number of stake pools.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_n_opt(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  n_opt);
+
+/**
+ * \brief Sets the pool pledge influence in the protocol parameter update.
+ *
+ * This function sets the pool pledge influence (a0 parameter) in the protocol parameter update.
+ * This parameter determines how much influence a pool's pledge has on the pool's rewards. If NULL is passed
+ * for pool_pledge_influence, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     pool_pledge_influence Pointer to the pool pledge influence value to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool pledge influence was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* proposed_pool_pledge_influence = NULL; // Example pointer to a unit interval
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_pool_pledge_influence(protocol_param_update, proposed_pool_pledge_influence);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool pledge influence set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set pool pledge influence.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_pool_pledge_influence(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         pool_pledge_influence);
+
+/**
+ * \brief Sets the expansion rate in the protocol parameter update.
+ *
+ * This function sets the expansion rate in the protocol parameter update.
+ * The expansion rate determines the percentage of the remaining reserve that is
+ * used to fund rewards and treasury each epoch. If NULL is passed for expansion_rate,
+ * it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     expansion_rate Pointer to the expansion rate value to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the expansion rate was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* proposed_expansion_rate = NULL; // Example pointer to a unit interval
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_expansion_rate(protocol_param_update, proposed_expansion_rate);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Expansion rate set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set expansion rate.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_expansion_rate(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         expansion_rate);
+
+/**
+ * \brief Sets the treasury growth rate in the protocol parameter update.
+ *
+ * This function sets the treasury growth rate in the protocol parameter update.
+ * The treasury growth rate determines the percentage of the expansion taken from reserves
+ * that is allocated to the treasury each epoch. If NULL is passed for treasury_growth_rate,
+ * it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     treasury_growth_rate Pointer to the treasury growth rate value to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the treasury growth rate was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* proposed_treasury_growth_rate = NULL; // Example pointer to a unit interval
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_treasury_growth_rate(protocol_param_update, proposed_treasury_growth_rate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Treasury growth rate set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set treasury growth rate.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_treasury_growth_rate(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         treasury_growth_rate);
+
+/**
+ * \brief Sets the decentralization parameter 'd' in the protocol parameter update.
+ *
+ * This function sets the decentralization parameter 'd' in the protocol parameter update.
+ * The parameter 'd' ranges from 0 to 1, where 0 represents a fully decentralized network with all blocks produced by community stake pools,
+ * and 1 indicates a fully centralized scenario where all blocks are produced by a federated system. If NULL is passed for 'd',
+ * it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     d Pointer to the decentralization parameter value to be set.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the decentralization parameter was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* proposed_d = NULL; // Example pointer to a unit interval
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_d(protocol_param_update, proposed_d);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Decentralization parameter set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set decentralization parameter.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_d(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         d);
+
+/**
+ * \brief Sets the extra entropy in the protocol parameter update.
+ *
+ * This function sets the extra entropy used to seed the pseudo-random number generator for leader election
+ * in the protocol parameter update. If NULL is passed for extra_entropy, it indicates that the update should
+ * not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     extra_entropy Pointer to the buffer containing the extra entropy.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the extra entropy was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_buffer_t* proposed_extra_entropy = NULL; // Example pointer to an entropy buffer
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_extra_entropy(protocol_param_update, proposed_extra_entropy);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Extra entropy set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set extra entropy.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_extra_entropy(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_buffer_t*                extra_entropy);
+
+/**
+ * \brief Sets the protocol version in the protocol parameter update.
+ *
+ * This function sets the protocol version, which consists of major and minor version numbers, in the protocol parameter update.
+ * If NULL is passed for protocol_version, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     protocol_version Pointer to the protocol version structure.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the protocol version was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_protocol_version_t* proposed_protocol_version = NULL; // Example pointer to a protocol version structure
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_protocol_version(protocol_param_update, proposed_protocol_version);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Protocol version set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set protocol version.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_protocol_version(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_protocol_version_t*      protocol_version);
+
+/**
+ * \brief Sets the minimum pool cost in the protocol parameter update.
+ *
+ * This function sets the minimum pool cost, which determines the minimum operational cost that a stake pool can declare.
+ * The cost is specified in lovelaces. If NULL is passed for min_pool_cost, it indicates that the update should not propose
+ * a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     min_pool_cost Pointer to the minimum pool cost in lovelaces.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the minimum pool cost was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_min_pool_cost = 340000000;  // Example minimum pool cost in lovelaces
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_min_pool_cost(protocol_param_update, &proposed_min_pool_cost);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum pool cost set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set minimum pool cost.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_min_pool_cost(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  min_pool_cost);
+
+/**
+ * \brief Sets the ADA cost per UTXO byte in the protocol parameter update.
+ *
+ * This function sets the ADA cost per UTXO byte, which determines the amount of ADA charged per byte of UTXO
+ * in the transaction. The cost is specified in lovelaces. If NULL is passed for ada_per_utxo_byte, it indicates
+ * that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     ada_per_utxo_byte Pointer to the cost in lovelaces per UTXO byte.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the ADA cost per UTXO byte was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_ada_per_utxo_byte = 1;  // Example cost in lovelaces per byte
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_ada_per_utxo_byte(protocol_param_update, &proposed_ada_per_utxo_byte);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("ADA per UTXO byte cost set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set ADA per UTXO byte cost.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_ada_per_utxo_byte(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  ada_per_utxo_byte);
+
+/**
+ * \brief Sets the cost models for Plutus scripts in the protocol parameter update.
+ *
+ * This function sets the cost models associated with executing Plutus scripts. The cost models
+ * define the computational cost parameters for various script operations. If NULL is passed for cost_models,
+ * it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     cost_models Pointer to the cost models for Plutus scripts.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the cost models were successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_costmdls_t* proposed_cost_models = NULL;
+ *
+ * // Assume proposed_cost_models is initialized properly
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_cost_models(protocol_param_update, proposed_cost_models);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Cost models set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set cost models.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_cost_models(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_costmdls_t*              cost_models);
+
+/**
+ * \brief Sets the execution costs for Plutus scripts in the protocol parameter update.
+ *
+ * This function sets the execution costs associated with Plutus scripts, defining the
+ * resource pricing for script execution. If NULL is passed for execution_costs,
+ * it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     execution_costs Pointer to the execution costs for Plutus scripts.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the execution costs were successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_ex_unit_prices_t* proposed_execution_costs = NULL;
+ *
+ * // Assume proposed_execution_costs is initialized properly
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_execution_costs(protocol_param_update, proposed_execution_costs);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Execution costs set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set execution costs.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_ex_unit_prices_unref(&proposed_execution_costs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_execution_costs(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_unit_prices_t*        execution_costs);
+
+/**
+ * \brief Sets the maximum transaction execution units in the protocol parameter update.
+ *
+ * This function sets the maximum execution units that a transaction can consume.
+ * If NULL is passed for max_tx_ex_units, it indicates that the update should not
+ * propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_tx_ex_units Pointer to the maximum execution units for a transaction.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum transaction execution units were successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_ex_units_t* proposed_max_tx_ex_units = NULL;
+ *
+ * // Assume proposed_max_tx_ex_units is initialized properly
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_tx_ex_units(protocol_param_update, proposed_max_tx_ex_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum transaction execution units set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set maximum transaction execution units.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_ex_units_unref(&proposed_max_tx_ex_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_tx_ex_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t*              max_tx_ex_units);
+
+/**
+ * \brief Sets the maximum block execution units in the protocol parameter update.
+ *
+ * This function sets the maximum execution units that a block can consume.
+ * If NULL is passed for max_block_ex_units, it indicates that the update should not
+ * propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_block_ex_units Pointer to the maximum execution units for a block.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum block execution units were successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_ex_units_t* proposed_max_block_ex_units = NULL;
+ *
+ * // Assume proposed_max_block_ex_units is initialized properly
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_block_ex_units(protocol_param_update, proposed_max_block_ex_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum block execution units set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set maximum block execution units.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_ex_units_unref(&proposed_max_block_ex_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_block_ex_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t*              max_block_ex_units);
+
+/**
+ * \brief Sets the maximum value size in the protocol parameter update.
+ *
+ * This function sets the maximum serialized length (in bytes) of a multi-asset value (token bundle)
+ * in a transaction output. If NULL is passed for max_value_size, it indicates that the update should not
+ * propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_value_size Pointer to the maximum value size.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum value size was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_max_value_size = 5000;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_value_size(protocol_param_update, &proposed_max_value_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum value size set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set maximum value size.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_value_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_value_size);
+
+/**
+ * \brief Sets the collateral percentage in the protocol parameter update.
+ *
+ * This function sets the percentage of the total transaction fee that its collateral must (at minimum) cover.
+ * If NULL is passed for collateral_percentage, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     collateral_percentage Pointer to the collateral percentage.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the collateral percentage was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_collateral_percentage = 150;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_collateral_percentage(protocol_param_update, &proposed_collateral_percentage);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Collateral percentage set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set collateral percentage.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_collateral_percentage(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  collateral_percentage);
+
+/**
+ * \brief Sets the maximum number of collateral inputs in the protocol parameter update.
+ *
+ * This function sets the limit for the total number of collateral inputs allowed in a transaction.
+ * If NULL is passed for max_collateral_inputs, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_collateral_inputs Pointer to the maximum number of collateral inputs.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum number of collateral inputs was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t proposed_max_collateral_inputs = 10;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_collateral_inputs(protocol_param_update, &proposed_max_collateral_inputs);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max collateral inputs set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set max collateral inputs.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_collateral_inputs(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_collateral_inputs);
+
+/**
+ * \brief Sets the pool voting thresholds in the protocol parameter update.
+ *
+ * This function sets the SPO vote thresholds which must be met as a percentage of the stake held by all stake pools
+ * to enact the different governance actions that must be ratified by them.
+ * If NULL is passed for pool_voting_thresholds, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     pool_voting_thresholds Pointer to the pool voting thresholds.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the pool voting thresholds were successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_pool_voting_thresholds_t* pool_voting_thresholds = NULL;
+ *
+ * // Assume protocol_param_update and pool_voting_thresholds are initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_pool_voting_thresholds(protocol_param_update, pool_voting_thresholds);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool voting thresholds set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set pool voting thresholds.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_pool_voting_thresholds_unref(&pool_voting_thresholds);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_pool_voting_thresholds(
+  cardano_protocol_param_update_t*  protocol_param_update,
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds);
+
+/**
+ * \brief Sets the DRep voting thresholds in the protocol parameter update.
+ *
+ * This function sets the DRep vote thresholds that must be met as a percentage of active voting stake
+ * to enact the different governance actions that must be ratified by them.
+ * If NULL is passed for drep_voting_thresholds, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     drep_voting_thresholds Pointer to the DRep voting thresholds.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the DRep voting thresholds were successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = NULL;
+ *
+ * // Assume protocol_param_update and drep_voting_thresholds are initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_drep_voting_thresholds(protocol_param_update, drep_voting_thresholds);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DRep voting thresholds set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set DRep voting thresholds.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_drep_voting_thresholds(
+  cardano_protocol_param_update_t*  protocol_param_update,
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds);
+
+/**
+ * \brief Sets the minimum committee size in the protocol parameter update.
+ *
+ * This function sets the minimum size of the constitutional committee.
+ * If NULL is passed for min_committee_size, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     min_committee_size Pointer to the minimum committee size.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the minimum committee size was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t min_committee_size = 5;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_min_committee_size(protocol_param_update, &min_committee_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum committee size set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set minimum committee size.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_min_committee_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  min_committee_size);
+
+/**
+ * \brief Sets the committee term limit in the protocol parameter update.
+ *
+ * This function sets the term limit for the constitutional committee members.
+ * If NULL is passed for committee_term_limit, it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     committee_term_limit Pointer to the committee term limit.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the committee term limit was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t committee_term_limit = 10;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_committee_term_limit(protocol_param_update, &committee_term_limit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Committee term limit set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set committee term limit.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_committee_term_limit(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  committee_term_limit);
+
+/**
+ * \brief Sets the governance action validity period in the protocol parameter update.
+ *
+ * This function sets the validity period for governance actions. If NULL is passed for governance_action_validity_period,
+ * it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     governance_action_validity_period Pointer to the governance action validity period.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the governance action validity period was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t governance_action_validity_period = 20;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_governance_action_validity_period(protocol_param_update, &governance_action_validity_period);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Governance action validity period set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set governance action validity period.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_governance_action_validity_period(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  governance_action_validity_period);
+
+/**
+ * \brief Sets the governance action deposit in the protocol parameter update.
+ *
+ * This function sets the deposit amount required for a governance action. If NULL is passed for governance_action_deposit,
+ * it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     governance_action_deposit Pointer to the governance action deposit amount.
+ *              If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the governance action deposit was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t governance_action_deposit = 500000;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_governance_action_deposit(protocol_param_update, &governance_action_deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Governance action deposit set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set governance action deposit.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_governance_action_deposit(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  governance_action_deposit);
+
+/**
+ * \brief Sets the DRep deposit in the protocol parameter update.
+ *
+ * This function sets the deposit amount required for a DRep. If NULL is passed for drep_deposit,
+ * it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     drep_deposit Pointer to the DRep deposit amount. If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the DRep deposit was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t drep_deposit = 500000;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_drep_deposit(protocol_param_update, &drep_deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DRep deposit set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set DRep deposit.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_drep_deposit(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  drep_deposit);
+
+/**
+ * \brief Sets the DRep inactivity period in the protocol parameter update.
+ *
+ * This function sets the inactivity period for a DRep. If NULL is passed for drep_inactivity_period,
+ * it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     drep_inactivity_period Pointer to the DRep inactivity period. If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the DRep inactivity period was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t drep_inactivity_period = 10;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_drep_inactivity_period(protocol_param_update, &drep_inactivity_period);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DRep inactivity period set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set DRep inactivity period.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_drep_inactivity_period(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  drep_inactivity_period);
+
+/**
+ * \brief Sets the reference scripts cost per byte in the protocol parameter update.
+ *
+ * This function sets the reference scripts cost per byte. If NULL is passed for ref_script_cost_per_byte,
+ * it indicates that the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     ref_script_cost_per_byte Pointer to the reference scripts cost per bytes. If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reference scripts cost per bytes was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* ref_script_cost_per_byte = NULL;
+ *
+ * // Assume ref_script_cost_per_byte is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_ref_script_cost_per_byte(protocol_param_update, ref_script_cost_per_byte);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Reference scripts cost per bytes set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set reference scripts cost per bytes.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_ref_script_cost_per_byte(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         ref_script_cost_per_byte);
+
+/**
+ * \brief Sets the maximum total reference script size per block in the protocol parameter update.
+ *
+ * This function sets the maximum cumulative size, in bytes, of the reference scripts that a single
+ * block may use. If NULL is passed for max_ref_script_size_per_block, it indicates that the update
+ * should not propose a change for this parameter. On the wire this parameter is a 32-bit unsigned
+ * integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_ref_script_size_per_block Pointer to the maximum reference script size per block.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum reference script size per block was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_ref_script_size_per_block = 1048576;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_ref_script_size_per_block(protocol_param_update, &max_ref_script_size_per_block);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max ref script size per block set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set max ref script size per block.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_ref_script_size_per_block(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_ref_script_size_per_block);
+
+/**
+ * \brief Sets the maximum total reference script size per transaction in the protocol parameter update.
+ *
+ * This function sets the maximum cumulative size, in bytes, of the reference scripts that a single
+ * transaction may use. If NULL is passed for max_ref_script_size_per_tx, it indicates that the update
+ * should not propose a change for this parameter. On the wire this parameter is a 32-bit unsigned
+ * integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_ref_script_size_per_tx Pointer to the maximum reference script size per transaction.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum reference script size per transaction was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_ref_script_size_per_tx = 204800;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_ref_script_size_per_tx(protocol_param_update, &max_ref_script_size_per_tx);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max ref script size per tx set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set max ref script size per tx.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_ref_script_size_per_tx(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_ref_script_size_per_tx);
+
+/**
+ * \brief Sets the reference script cost stride in the protocol parameter update.
+ *
+ * This function sets the size step, in bytes, at which the reference script fee tier increases.
+ * If NULL is passed for ref_script_cost_stride, it indicates that the update should not propose
+ * a change for this parameter. On the wire this parameter is a positive 32-bit unsigned integer;
+ * zero and values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     ref_script_cost_stride Pointer to the reference script cost stride.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reference script cost stride was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value is zero or does not fit in a 32-bit unsigned integer, or an appropriate error
+ *         code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t ref_script_cost_stride = 25600;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_ref_script_cost_stride(protocol_param_update, &ref_script_cost_stride);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Ref script cost stride set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set ref script cost stride.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_ref_script_cost_stride(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  ref_script_cost_stride);
+
+/**
+ * \brief Sets the reference script cost multiplier in the protocol parameter update.
+ *
+ * This function sets the multiplier applied to the reference script fee at each cost stride.
+ * If NULL is passed for ref_script_cost_multiplier, it indicates that the update should not
+ * propose a change for this parameter. On the wire this parameter is a positive interval
+ * (a rational number); its value is expected to be greater than zero.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     ref_script_cost_multiplier Pointer to the reference script cost multiplier. If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reference script cost multiplier was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* ref_script_cost_multiplier = NULL;
+ *
+ * // Assume ref_script_cost_multiplier is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_ref_script_cost_multiplier(protocol_param_update, ref_script_cost_multiplier);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Ref script cost multiplier set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set ref script cost multiplier.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_ref_script_cost_multiplier(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         ref_script_cost_multiplier);
+
+/**
+ * \brief Sets a bounded maximum pledge leverage in the protocol parameter update.
+ *
+ * This function proposes a bounded maximum pledge leverage (CIP-50): the largest ratio between a pool's
+ * total stake and its pledge that still earns full rewards. The value is a nonnegative rational and may be
+ * greater than one. If NULL is passed for max_pledge_leverage, the parameter is removed from the update,
+ * exactly as \ref cardano_protocol_param_update_clear_max_pledge_leverage does. To propose removing the
+ * bound instead, use \ref cardano_protocol_param_update_set_max_pledge_leverage_unbounded.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_pledge_leverage Pointer to the maximum pledge leverage. If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum pledge leverage was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* max_pledge_leverage = NULL;
+ *
+ * // Assume max_pledge_leverage is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_pledge_leverage(protocol_param_update, max_pledge_leverage);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max pledge leverage set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set max pledge leverage.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_pledge_leverage(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         max_pledge_leverage);
+
+/**
+ * \brief Proposes an unbounded maximum pledge leverage in the protocol parameter update.
+ *
+ * This function marks the maximum pledge leverage as part of the update with the unbounded value, which
+ * proposes removing the pledge leverage bound (CIP-50). On the wire the parameter is encoded as CBOR null.
+ * Any bounded value previously set on the update is released.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the unbounded maximum pledge leverage was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_pledge_leverage_unbounded(protocol_param_update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The update now proposes an unbounded pledge leverage.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_pledge_leverage_unbounded(
+  cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Removes the maximum pledge leverage from the protocol parameter update.
+ *
+ * This function removes the maximum pledge leverage parameter from the update, whether it proposed a
+ * bounded or an unbounded value, so that the update no longer proposes a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the parameter was removed, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_clear_max_pledge_leverage(protocol_param_update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The update no longer proposes a max pledge leverage.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_clear_max_pledge_leverage(
+  cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Sets the minimum pool margin in the protocol parameter update.
+ *
+ * This function sets the minimum margin that a stake pool may declare (CIP-23). If NULL is passed for
+ * min_pool_margin, it indicates that the update should not propose a change for this parameter. On the
+ * wire this parameter is a unit interval (a rational number between zero and one).
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     min_pool_margin Pointer to the minimum pool margin. If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the minimum pool margin was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* min_pool_margin = NULL;
+ *
+ * // Assume min_pool_margin is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_min_pool_margin(protocol_param_update, min_pool_margin);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum pool margin set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set minimum pool margin.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_min_pool_margin(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         min_pool_margin);
+
+/**
+ * \brief Sets the Leios announcement period length in the protocol parameter update.
+ *
+ * This function sets the length, in milliseconds, of the Leios announcement period (CIP-164). If NULL is
+ * passed for leios_announcement_period_length, it indicates that the update should not propose a change
+ * for this parameter. On the wire this parameter is a 32-bit unsigned
+ * integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     leios_announcement_period_length Pointer to the Leios announcement period length.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Leios announcement period length was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t leios_announcement_period_length = 1000; // One second
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_leios_announcement_period_length(protocol_param_update, &leios_announcement_period_length);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios announcement period length set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set Leios announcement period length.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_leios_announcement_period_length(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  leios_announcement_period_length);
+
+/**
+ * \brief Sets the Leios vote period length in the protocol parameter update.
+ *
+ * This function sets the length, in milliseconds, of the Leios vote period (CIP-164). If NULL is passed
+ * for leios_vote_period_length, it indicates that the update should not propose a change for this
+ * parameter. On the wire this parameter is a 32-bit unsigned
+ * integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     leios_vote_period_length Pointer to the Leios vote period length.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Leios vote period length was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t leios_vote_period_length = 2000; // Two seconds
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_leios_vote_period_length(protocol_param_update, &leios_vote_period_length);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios vote period length set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set Leios vote period length.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_leios_vote_period_length(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  leios_vote_period_length);
+
+/**
+ * \brief Sets the Leios diffusion period length in the protocol parameter update.
+ *
+ * This function sets the length, in milliseconds, of the Leios diffusion period (CIP-164). If NULL is
+ * passed for leios_diffusion_period_length, it indicates that the update should not propose a change for
+ * this parameter. On the wire this parameter is a 32-bit unsigned
+ * integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     leios_diffusion_period_length Pointer to the Leios diffusion period length.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Leios diffusion period length was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t leios_diffusion_period_length = 3000; // Three seconds
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_leios_diffusion_period_length(protocol_param_update, &leios_diffusion_period_length);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios diffusion period length set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set Leios diffusion period length.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_leios_diffusion_period_length(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  leios_diffusion_period_length);
+
+/**
+ * \brief Sets the Leios committee size in the protocol parameter update.
+ *
+ * This function sets the number of members of the Leios voting committee (CIP-164). If NULL is passed for
+ * leios_committee_size, it indicates that the update should not propose a change for this parameter. On
+ * the wire this parameter is a 16-bit unsigned integer; values greater than \c UINT16_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     leios_committee_size Pointer to the Leios committee size.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Leios committee size was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 16-bit unsigned integer, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t leios_committee_size = 500; // 500 committee members
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_leios_committee_size(protocol_param_update, &leios_committee_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios committee size set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set Leios committee size.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_leios_committee_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  leios_committee_size);
+
+/**
+ * \brief Sets the Leios quorum stake threshold in the protocol parameter update.
+ *
+ * This function sets the fraction of the committee stake that a Leios vote needs to reach a quorum
+ * (CIP-164). If NULL is passed for leios_quorum_stake_threshold, it indicates that the update should not
+ * propose a change for this parameter. On the wire this parameter is a unit interval (a rational number
+ * between zero and one).
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     leios_quorum_stake_threshold Pointer to the Leios quorum stake threshold. If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Leios quorum stake threshold was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* leios_quorum_stake_threshold = NULL;
+ *
+ * // Assume leios_quorum_stake_threshold is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_leios_quorum_stake_threshold(protocol_param_update, leios_quorum_stake_threshold);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios quorum stake threshold set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set Leios quorum stake threshold.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_leios_quorum_stake_threshold(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         leios_quorum_stake_threshold);
+
+/**
+ * \brief Sets the maximum endorser block references size in the protocol parameter update.
+ *
+ * This function sets the maximum total size, in bytes, of the references carried by a Leios endorser
+ * block. If NULL is passed for max_endorser_block_references_size, it indicates that the update should not
+ * propose a change for this parameter. On the wire this parameter is a 32-bit unsigned
+ * integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_endorser_block_references_size Pointer to the maximum endorser block references size.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum endorser block references size was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_endorser_block_references_size = 65536; // 64 KiB of references
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_endorser_block_references_size(protocol_param_update, &max_endorser_block_references_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum endorser block references size set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set maximum endorser block references size.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_endorser_block_references_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_endorser_block_references_size);
+
+/**
+ * \brief Sets the maximum endorser block transactions size in the protocol parameter update.
+ *
+ * This function sets the maximum total size, in bytes, of the transactions referenced by a Leios endorser
+ * block. If NULL is passed for max_endorser_block_txs_size, it indicates that the update should not
+ * propose a change for this parameter. On the wire this parameter is a 32-bit unsigned
+ * integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_endorser_block_txs_size Pointer to the maximum endorser block transactions size.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum endorser block transactions size was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_endorser_block_txs_size = 100000; // 100 KB of transactions
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_endorser_block_txs_size(protocol_param_update, &max_endorser_block_txs_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum endorser block transactions size set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set maximum endorser block transactions size.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_endorser_block_txs_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_endorser_block_txs_size);
+
+/**
+ * \brief Sets the maximum endorser block execution units in the protocol parameter update.
+ *
+ * This function sets the maximum execution units that the scripts of a Leios endorser block can
+ * consume (CIP-164). If NULL is passed for max_endorser_block_execution_units, it indicates that
+ * the update should not propose a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_endorser_block_execution_units Pointer to the maximum execution units for an endorser block.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum endorser block execution units were successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_ex_units_t* max_endorser_block_execution_units = NULL;
+ *
+ * // Assume max_endorser_block_execution_units is initialized properly
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_endorser_block_execution_units(protocol_param_update, max_endorser_block_execution_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum endorser block execution units set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set maximum endorser block execution units.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * cardano_ex_units_unref(&max_endorser_block_execution_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_endorser_block_execution_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t*              max_endorser_block_execution_units);
+
+/**
+ * \brief Sets the maximum reference script size per endorser block in the protocol parameter update.
+ *
+ * This function sets the maximum cumulative size, in bytes, of the reference scripts that a Leios endorser
+ * block may use. If NULL is passed for max_ref_script_size_per_endorser_block, it indicates that the
+ * update should not propose a change for this parameter. On the wire this parameter is a 32-bit unsigned
+ * integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     max_ref_script_size_per_endorser_block Pointer to the maximum reference script size per endorser block.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the maximum reference script size per endorser block was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t max_ref_script_size_per_endorser_block = 204800; // 200 KiB of reference scripts
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_max_ref_script_size_per_endorser_block(protocol_param_update, &max_ref_script_size_per_endorser_block);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum reference script size per endorser block set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set maximum reference script size per endorser block.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_max_ref_script_size_per_endorser_block(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_ref_script_size_per_endorser_block);
+
+/**
+ * \brief Sets the Peras minimum candidate block age in the protocol parameter update.
+ *
+ * This function sets the minimum age, in slots, that a block must have to be eligible for voting in a Peras round. If NULL is passed for peras_min_candidate_block_age, it indicates that the update should not
+ * propose a change for this parameter. On the wire this parameter is a slot interval (a 32-bit unsigned integer); values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     peras_min_candidate_block_age Pointer to the Peras minimum candidate block age.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras minimum candidate block age was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t peras_min_candidate_block_age = 30; // 30 slots
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_peras_min_candidate_block_age(protocol_param_update, &peras_min_candidate_block_age);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras minimum candidate block age set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set Peras minimum candidate block age.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_peras_min_candidate_block_age(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  peras_min_candidate_block_age);
+
+/**
+ * \brief Sets the Peras healing factor in the protocol parameter update.
+ *
+ * This function sets the healing time coefficient used to derive the length of a Peras cooldown period. If NULL is passed for peras_healing_factor, it indicates that the update should
+ * not propose a change for this parameter. On the wire this parameter is a positive interval (a rational number greater than zero).
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     peras_healing_factor Pointer to the Peras healing factor. If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras healing factor was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* peras_healing_factor = NULL;
+ *
+ * // Assume peras_healing_factor is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_peras_healing_factor(protocol_param_update, peras_healing_factor);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras healing factor set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set Peras healing factor.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_peras_healing_factor(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         peras_healing_factor);
+
+/**
+ * \brief Sets the Peras certificate boost in the protocol parameter update.
+ *
+ * This function sets the extra chain weight that a Peras certificate gives to the block it boosts. If NULL is passed for peras_cert_boost, it indicates that the update should not
+ * propose a change for this parameter. On the wire this parameter is a 16-bit unsigned integer; values greater than \c UINT16_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     peras_cert_boost Pointer to the Peras certificate boost.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras certificate boost was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 16-bit unsigned integer, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t peras_cert_boost = 15; // Weight added to a certified block
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_peras_cert_boost(protocol_param_update, &peras_cert_boost);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras certificate boost set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set Peras certificate boost.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_peras_cert_boost(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  peras_cert_boost);
+
+/**
+ * \brief Sets the Peras target committee size in the protocol parameter update.
+ *
+ * This function sets the target number of members of the Peras voting committee. If NULL is passed for peras_target_committee_size, it indicates that the update should not
+ * propose a change for this parameter. On the wire this parameter is a 16-bit unsigned integer; values greater than \c UINT16_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     peras_target_committee_size Pointer to the Peras target committee size.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras target committee size was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 16-bit unsigned integer, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t peras_target_committee_size = 600; // 600 committee members
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_peras_target_committee_size(protocol_param_update, &peras_target_committee_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras target committee size set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set Peras target committee size.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_peras_target_committee_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  peras_target_committee_size);
+
+/**
+ * \brief Sets a Peras bootstrap round in the protocol parameter update.
+ *
+ * This function proposes the Peras round number used to manually bootstrap voting at a specific time. If NULL is passed for peras_bootstrap_round, the parameter is removed from the
+ * update, exactly as \ref cardano_protocol_param_update_clear_peras_bootstrap_round does. To propose having no
+ * bootstrap round instead, use \ref cardano_protocol_param_update_set_peras_bootstrap_round_null. On the wire a
+ * round is a 32-bit unsigned integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     peras_bootstrap_round Pointer to the Peras bootstrap round.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras bootstrap round was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code indicating
+ *         the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t peras_bootstrap_round = 7; // Bootstrap voting at round 7
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_peras_bootstrap_round(protocol_param_update, &peras_bootstrap_round);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras bootstrap round set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set Peras bootstrap round.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_peras_bootstrap_round(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  peras_bootstrap_round);
+
+/**
+ * \brief Proposes having no Peras bootstrap round in the protocol parameter update.
+ *
+ * This function marks the Peras bootstrap round as part of the update with the null value, which proposes
+ * that voting is not manually bootstrapped at any round. On the wire the parameter is encoded as CBOR null.
+ * Any round previously set on the update is released.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the null Peras bootstrap round was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_peras_bootstrap_round_null(protocol_param_update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The update now proposes having no Peras bootstrap round.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_peras_bootstrap_round_null(
+  cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Removes the Peras bootstrap round from the protocol parameter update.
+ *
+ * This function removes the Peras bootstrap round parameter from the update, whether it proposed a
+ * round or the null value, so that the update no longer proposes a change for this parameter.
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the parameter was removed, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_clear_peras_bootstrap_round(protocol_param_update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The update no longer proposes a Peras bootstrap round.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_clear_peras_bootstrap_round(
+  cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Sets the Peras quorum threshold safety margin in the protocol parameter update.
+ *
+ * This function sets the extra safety margin added on top of the 75% Peras quorum threshold baseline (the ledger requires it to be between 0 and 0.25, inclusive). If NULL is passed for peras_quorum_threshold_safety_margin, it indicates that the update should
+ * not propose a change for this parameter. On the wire this parameter is a unit interval (a rational number between zero and one).
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     peras_quorum_threshold_safety_margin Pointer to the Peras quorum threshold safety margin. If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Peras quorum threshold safety margin was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * cardano_unit_interval_t* peras_quorum_threshold_safety_margin = NULL;
+ *
+ * // Assume peras_quorum_threshold_safety_margin is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_peras_quorum_threshold_safety_margin(protocol_param_update, peras_quorum_threshold_safety_margin);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras quorum threshold safety margin set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set Peras quorum threshold safety margin.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_peras_quorum_threshold_safety_margin(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         peras_quorum_threshold_safety_margin);
+
+/**
+ * \brief Sets the reference inputs cost per multi-asset byte in the protocol parameter update.
+ *
+ * This function sets the fee, in lovelace, charged for every multi-asset byte present in the values of the outputs a transaction references through its reference inputs. If NULL is passed for ref_inputs_cost_per_multi_asset_byte, it indicates that the update should not
+ * propose a change for this parameter. On the wire this parameter is a coin amount (an unsigned integer).
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     ref_inputs_cost_per_multi_asset_byte Pointer to the reference inputs cost per multi-asset byte.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reference inputs cost per multi-asset byte was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t ref_inputs_cost_per_multi_asset_byte = 1000; // 1000 lovelace per multi-asset byte
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_ref_inputs_cost_per_multi_asset_byte(protocol_param_update, &ref_inputs_cost_per_multi_asset_byte);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Reference inputs cost per multi-asset byte set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set reference inputs cost per multi-asset byte.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_ref_inputs_cost_per_multi_asset_byte(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  ref_inputs_cost_per_multi_asset_byte);
+
+/**
+ * \brief Sets the reference inputs cost per datum byte in the protocol parameter update.
+ *
+ * This function sets the fee, in lovelace, charged per byte of the datums attached to the outputs a transaction references through its reference inputs. If NULL is passed for ref_inputs_cost_per_datum_byte, it indicates that the update should not
+ * propose a change for this parameter. On the wire this parameter is a coin amount (an unsigned integer).
+ *
+ * \param[in,out] protocol_param_update Pointer to the protocol parameter update object.
+ * \param[in]     ref_inputs_cost_per_datum_byte Pointer to the reference inputs cost per datum byte.
+ *                If NULL, it indicates no change is being proposed for this field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reference inputs cost per datum byte was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = NULL;
+ * uint64_t ref_inputs_cost_per_datum_byte = 44; // 44 lovelace per datum byte
+ *
+ * // Assume protocol_param_update is initialized properly
+ *
+ * cardano_error_t result = cardano_protocol_param_update_set_ref_inputs_cost_per_datum_byte(protocol_param_update, &ref_inputs_cost_per_datum_byte);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Reference inputs cost per datum byte set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to set reference inputs cost per datum byte.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_ref_inputs_cost_per_datum_byte(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  ref_inputs_cost_per_datum_byte);
+
+/**
+ * \brief Decrements the reference count of a cardano_protocol_param_update_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_protocol_param_update_t object
+ * by decreasing its reference count. When the reference count reaches zero, the protocol_param_update is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] protocol_param_update A pointer to the pointer of the protocol_param_update object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_param_update_t* protocol_param_update = cardano_protocol_param_update_new(major, minor);
+ *
+ * // Perform operations with the protocol_param_update...
+ *
+ * cardano_protocol_param_update_unref(&protocol_param_update);
+ * // At this point, protocol_param_update is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_protocol_param_update_unref, the pointer to the \ref cardano_protocol_param_update_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_protocol_param_update_unref(cardano_protocol_param_update_t** protocol_param_update);
+
+/**
+ * \brief Increases the reference count of the cardano_protocol_param_update_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_protocol_param_update_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_protocol_param_update_unref.
+ *
+ * \param protocol_param_update A pointer to the cardano_protocol_param_update_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming protocol_param_update is a previously created protocol_param_update object
+ *
+ * cardano_protocol_param_update_ref(protocol_param_update);
+ *
+ * // Now protocol_param_update can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_protocol_param_update_ref there is a corresponding
+ * call to \ref cardano_protocol_param_update_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_protocol_param_update_ref(cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_protocol_param_update_t object.
+ *
+ * This function returns the number of active references to an cardano_protocol_param_update_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_protocol_param_update_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param protocol_param_update A pointer to the cardano_protocol_param_update_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_protocol_param_update_t object. If the object
+ * is properly managed (i.e., every \ref cardano_protocol_param_update_ref call is matched with a
+ * \ref cardano_protocol_param_update_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming protocol_param_update is a previously created protocol_param_update object
+ *
+ * size_t ref_count = cardano_protocol_param_update_refcount(protocol_param_update);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_protocol_param_update_refcount(const cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Sets the last error message for a given cardano_protocol_param_update_t object.
+ *
+ * Records an error message in the protocol_param_update's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] protocol_param_update A pointer to the \ref cardano_protocol_param_update_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the protocol_param_update's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_protocol_param_update_set_last_error(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const char*                      message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific protocol_param_update.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_protocol_param_update_set_last_error for the given
+ * protocol_param_update. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] protocol_param_update A pointer to the \ref cardano_protocol_param_update_t instance whose last error
+ *                   message is to be retrieved. If the protocol_param_update is NULL, the function
+ *                   returns a generic error message indicating the null protocol_param_update.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified protocol_param_update. If the protocol_param_update is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_protocol_param_update_set_last_error for the same protocol_param_update, or until
+ *       the protocol_param_update is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_protocol_param_update_get_last_error(
+  const cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_protocol_param_update_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_protocol_param_update_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_protocol_param_update_deep_clone(const cardano_protocol_param_update_t* source, cardano_protocol_param_update_t** clone);
+
+/**
+ * \brief Compatibility alias for \ref cardano_protocol_param_update_get_ref_inputs_cost_per_multi_asset_byte.
+ * \deprecated Use the per-byte name; parameter 55 measures multi-asset byte overhead.
+ */
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_get_ref_inputs_cost_per_multi_asset_policy(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              ref_inputs_cost_per_multi_asset_policy);
+
+/**
+ * \brief Compatibility alias for \ref cardano_protocol_param_update_set_ref_inputs_cost_per_multi_asset_byte.
+ * \deprecated Use the per-byte name; parameter 55 measures multi-asset byte overhead.
+ */
+CARDANO_EXPORT cardano_error_t cardano_protocol_param_update_set_ref_inputs_cost_per_multi_asset_policy(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  ref_inputs_cost_per_multi_asset_policy);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PROTOCOL_PARAM_UPDATE_H
diff --git a/vendor/include/cardano/protocol_params/protocol_parameters.h b/vendor/include/cardano/protocol_params/protocol_parameters.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/protocol_params/protocol_parameters.h
@@ -0,0 +1,4413 @@
+/**
+ * \file protocol_parameters.h
+ *
+ * \author angel.castillo
+ * \date   Sep 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PROTOCOL_PARAMETERS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PROTOCOL_PARAMETERS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/ex_units.h>
+#include <cardano/common/protocol_version.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/protocol_params/costmdls.h>
+#include <cardano/protocol_params/drep_voting_thresholds.h>
+#include <cardano/protocol_params/ex_unit_prices.h>
+#include <cardano/protocol_params/pool_voting_thresholds.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Protocol parameters govern various aspects of the Cardano network.
+ */
+typedef struct cardano_protocol_parameters_t cardano_protocol_parameters_t;
+
+/**
+ * \brief Creates and initializes a new instance of the protocol parameters.
+ *
+ * This function allocates and initializes a new instance of the protocol parameters,
+ * representing a set of updates to the Cardano protocol parameters.
+ *
+ * \param[out] protocol_parameters On successful initialization, this will point to a newly created
+ *            protocol parameters object. This object represents a "strong reference",
+ *            meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the protocol parameters is no longer needed, the caller must release it
+ *            by calling \ref cardano_protocol_parameters_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the protocol parameters was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_parameters = NULL;
+ *
+ * // Attempt to create a new protocol parameters object
+ * cardano_error_t result = cardano_protocol_parameters_new(&protocol_parameters);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the protocol_parameters
+ *
+ *   // Once done, ensure to clean up and release the protocol_parameters
+ *   cardano_protocol_parameters_unref(&protocol_parameters);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_protocol_parameters_new(cardano_protocol_parameters_t** protocol_parameters);
+
+/**
+ * \brief Retrieves the linear minimum fee coefficient (a) from the protocol parameters.
+ *
+ * This function returns the value of the linear fee coefficient (a) from the given
+ * \ref cardano_protocol_parameters_t object. The minimum fee for a transaction is calculated
+ * using the formula:
+ *
+ * \code
+ *   min_fee = a * size_of_transaction + b
+ * \endcode
+ *
+ * where \c a is the linear fee coefficient and \c b is the constant fee coefficient.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The value of the linear fee coefficient (a). If the \p protocol_parameters pointer is NULL,
+ *         the function will return 0.
+ *
+ * \note The linear fee coefficient is part of the Cardano network protocol parameters and is used to
+ *       calculate the minimum required transaction fees.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t min_fee_a = cardano_protocol_parameters_get_min_fee_a(protocol_params);
+ *
+ * printf("Linear fee coefficient (a): %llu\n", min_fee_a);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_min_fee_a(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the constant minimum fee coefficient (b) from the protocol parameters.
+ *
+ * This function returns the value of the constant fee coefficient (b) from the given
+ * \ref cardano_protocol_parameters_t object. The minimum fee for a transaction is calculated
+ * using the formula:
+ *
+ * \code
+ *   min_fee = a * size_of_transaction + b
+ * \endcode
+ *
+ * where \c a is the linear fee coefficient and \c b is the constant fee coefficient.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The value of the constant fee coefficient (b). If the \p protocol_parameters pointer is NULL,
+ *         the function will return 0.
+ *
+ * \note The constant fee coefficient is part of the Cardano network protocol parameters and is used to
+ *       calculate the minimum required transaction fees.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t min_fee_b = cardano_protocol_parameters_get_min_fee_b(protocol_params);
+ *
+ * printf("Constant fee coefficient (b): %llu\n", min_fee_b);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_min_fee_b(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum block body size from the protocol parameters.
+ *
+ * This function returns the maximum size, in bytes, allowed for the body of a block in the
+ * Cardano blockchain, as specified in the given \ref cardano_protocol_parameters_t object.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The maximum block body size in bytes. If the \p protocol_parameters pointer is NULL,
+ *         the function will return 0.
+ *
+ * \note The block body size is a critical protocol parameter that limits the total size of all
+ *       transactions and other data included in a single block on the Cardano blockchain.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t max_block_body_size = cardano_protocol_parameters_get_max_block_body_size(protocol_params);
+ *
+ * printf("Maximum block body size: %llu bytes\n", max_block_body_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_max_block_body_size(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum transaction size from the protocol parameters.
+ *
+ * This function returns the maximum size, in bytes, allowed for a transaction in the
+ * Cardano blockchain, as specified in the given \ref cardano_protocol_parameters_t object.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The maximum transaction size in bytes. If the \p protocol_parameters pointer is NULL,
+ *         the function will return 0.
+ *
+ * \note The maximum transaction size is a protocol parameter that limits the total size
+ *       of a transaction, ensuring that it fits within a block.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t max_tx_size = cardano_protocol_parameters_get_max_tx_size(protocol_params);
+ *
+ * printf("Maximum transaction size: %llu bytes\n", max_tx_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_max_tx_size(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum block header size from the protocol parameters.
+ *
+ * This function returns the maximum size, in bytes, allowed for the header of a block in the
+ * Cardano blockchain, as specified in the given \ref cardano_protocol_parameters_t object.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The maximum block header size in bytes. If the \p protocol_parameters pointer is NULL,
+ *         the function will return 0.
+ *
+ * \note The block header contains essential metadata for the block, including the hash of the previous block,
+ *       and this limit ensures that the header does not exceed the specified size.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t max_block_header_size = cardano_protocol_parameters_get_max_block_header_size(protocol_params);
+ *
+ * printf("Maximum block header size: %llu bytes\n", max_block_header_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_max_block_header_size(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the key deposit value from the protocol parameters.
+ *
+ * This function returns the key deposit required for staking key registration, as specified
+ * in the given \ref cardano_protocol_parameters_t object. The key deposit is an amount of ADA
+ * required to register a staking key on the Cardano blockchain.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The key deposit amount in lovelaces (1 ADA = 1,000,000 lovelaces). If the \p protocol_parameters
+ *         pointer is NULL, the function will return 0.
+ *
+ * \note The key deposit is a refundable deposit required to participate in the staking process.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t key_deposit = cardano_protocol_parameters_get_key_deposit(protocol_params);
+ *
+ * printf("Key deposit: %llu lovelaces\n", key_deposit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_key_deposit(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the pool deposit value from the protocol parameters.
+ *
+ * This function returns the pool deposit required for registering a stake pool, as specified
+ * in the given \ref cardano_protocol_parameters_t object. The pool deposit is an amount of ADA
+ * required to register a stake pool on the Cardano blockchain.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The pool deposit amount in lovelaces (1 ADA = 1,000,000 lovelaces). If the \p protocol_parameters
+ *         pointer is NULL, the function will return 0.
+ *
+ * \note The pool deposit is a refundable deposit required for stake pool registration.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t pool_deposit = cardano_protocol_parameters_get_pool_deposit(protocol_params);
+ *
+ * printf("Pool deposit: %llu lovelaces\n", pool_deposit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_pool_deposit(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the max pool retirement epoch bounds.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The maximum epoch duration in slots. If the \p protocol_parameters pointer is NULL,
+ *         the function will return 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t max_epoch = cardano_protocol_parameters_get_max_epoch(protocol_params);
+ *
+ * printf("Maximum epoch duration: %llu slots\n", max_epoch);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_max_epoch(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the desired number of stake pools (n_opt) from the protocol parameters.
+ *
+ * This function returns the value of \c n_opt, which represents the optimal number of stake pools
+ * for the Cardano network, as specified in the given \ref cardano_protocol_parameters_t object.
+ * This parameter is used to calculate pool rewards and incentivize decentralization.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The optimal number of stake pools (\c n_opt). If the \p protocol_parameters pointer is NULL,
+ *         the function will return 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t n_opt = cardano_protocol_parameters_get_n_opt(protocol_params);
+ *
+ * printf("Optimal number of stake pools (n_opt): %llu\n", n_opt);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_n_opt(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the pool pledge influence factor from the protocol parameters.
+ *
+ * This function returns the pool pledge influence factor (represented as a unit interval) from the
+ * given \ref cardano_protocol_parameters_t object. The pool pledge influence factor determines how
+ * much a stake pool's pledge (the amount of ADA the pool operator commits) influences the pool's rewards.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_unit_interval_t object representing the pool pledge influence factor.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_unit_interval_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* pledge_influence = cardano_protocol_parameters_get_pool_pledge_influence(protocol_params);
+ *
+ * if (pledge_influence != NULL)
+ * {
+ *   // Use the pool pledge influence factor
+ *
+ *   // Clean up when done
+ *   cardano_unit_interval_unref(&pledge_influence);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the pool pledge influence factor.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t* cardano_protocol_parameters_get_pool_pledge_influence(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the monetary expansion rate from the protocol parameters.
+ *
+ * This function returns the expansion rate (represented as a unit interval) from the given
+ * \ref cardano_protocol_parameters_t object. The expansion rate determines how much of the
+ * remaining reserves are added to the total supply of ADA in each epoch.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_unit_interval_t object representing the expansion rate.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_unit_interval_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The expansion rate affects the rate at which ADA is gradually released from the reserves into circulation.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* expansion_rate = cardano_protocol_parameters_get_expansion_rate(protocol_params);
+ *
+ * if (expansion_rate != NULL)
+ * {
+ *   // Use the expansion rate as needed
+ *
+ *   // Clean up when done
+ *   cardano_unit_interval_unref(&expansion_rate);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the expansion rate.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t* cardano_protocol_parameters_get_expansion_rate(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the treasury growth rate from the protocol parameters.
+ *
+ * This function returns the treasury growth rate (represented as a unit interval) from the given
+ * \ref cardano_protocol_parameters_t object. The treasury growth rate determines the portion of the
+ * total monetary expansion that is allocated to the treasury, which is used to fund community-driven
+ * projects and developments.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_unit_interval_t object representing the treasury growth rate.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_unit_interval_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The treasury growth rate affects how much of the monetary expansion goes into the treasury versus
+ *       rewards for staking participants.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* treasury_growth_rate = cardano_protocol_parameters_get_treasury_growth_rate(protocol_params);
+ *
+ * if (treasury_growth_rate != NULL)
+ * {
+ *   // Use the treasury growth rate as needed
+ *
+ *   // Clean up when done
+ *   cardano_unit_interval_unref(&treasury_growth_rate);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the treasury growth rate.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t* cardano_protocol_parameters_get_treasury_growth_rate(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the decentralization parameter (d) from the protocol parameters.
+ *
+ * This function returns the decentralization parameter (represented as a unit interval) from the given
+ * \ref cardano_protocol_parameters_t object. The decentralization parameter controls the proportion
+ * of blocks produced by federated nodes (IOHK, Emurgo, CF) versus community stake pools. A value of 1
+ * means full centralization (all blocks produced by federated nodes), and a value of 0 means full decentralization.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_unit_interval_t object representing the decentralization parameter.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_unit_interval_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The decentralization parameter affects the rate at which block production shifts from federated nodes
+ *       to community-operated stake pools.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* d_param = cardano_protocol_parameters_get_d(protocol_params);
+ *
+ * if (d_param != NULL)
+ * {
+ *   // Use the decentralization parameter as needed
+ *
+ *   // Clean up when done
+ *   cardano_unit_interval_unref(&d_param);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the decentralization parameter.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t* cardano_protocol_parameters_get_d(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the extra entropy value from the protocol parameters.
+ *
+ * This function returns the extra entropy value from the given \ref cardano_protocol_parameters_t object.
+ * Extra entropy is an optional parameter that can be used to introduce additional randomness into
+ * the protocol's random number generation process.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_buffer_t object containing the extra entropy data.
+ *         If no extra entropy is set, or if the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_buffer_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_buffer_unref when it is no longer needed.
+ *
+ * \note Extra entropy is an optional protocol parameter that may be used for adding randomness to certain processes,
+ *       such as leader election, but it is not always set.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_buffer_t* extra_entropy = cardano_protocol_parameters_get_extra_entropy(protocol_params);
+ *
+ * if (extra_entropy != NULL)
+ * {
+ *   // Use the extra entropy data
+ *
+ *   // Clean up when done
+ *   cardano_buffer_unref(&extra_entropy);
+ * }
+ * else
+ * {
+ *   printf("No extra entropy is set in the protocol parameters.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_buffer_t* cardano_protocol_parameters_get_extra_entropy(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the protocol version from the protocol parameters.
+ *
+ * This function returns the protocol version from the given \ref cardano_protocol_parameters_t object.
+ * The protocol version is used to track updates to the Cardano protocol, which may include changes
+ * to consensus rules or transaction formats.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_protocol_version_t object representing the protocol version.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_protocol_version_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_protocol_version_unref when it is no longer needed.
+ *
+ * \note The protocol version reflects the version of the Cardano protocol in use, which can change
+ *       over time as improvements or updates are introduced through hard forks or other governance mechanisms.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_protocol_version_t* protocol_version = cardano_protocol_parameters_get_protocol_version(protocol_params);
+ *
+ * if (protocol_version != NULL)
+ * {
+ *   // Use the protocol version as needed
+ *
+ *   // Clean up when done
+ *   cardano_protocol_version_unref(&protocol_version);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the protocol version.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_protocol_version_t* cardano_protocol_parameters_get_protocol_version(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the minimum pool cost from the protocol parameters.
+ *
+ * This function returns the minimum pool cost from the given \ref cardano_protocol_parameters_t object.
+ * The minimum pool cost represents the minimum fixed fee that a stake pool operator must charge
+ * for delegators to participate in the pool.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The minimum pool cost in lovelaces (1 ADA = 1,000,000 lovelaces). If the \p protocol_parameters
+ *         pointer is NULL, the function returns 0.
+ *
+ * \note The minimum pool cost ensures that pool operators charge a base fee for providing services
+ *       and helps sustain the operation of smaller pools in the Cardano ecosystem.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t min_pool_cost = cardano_protocol_parameters_get_min_pool_cost(protocol_params);
+ *
+ * printf("Minimum pool cost: %llu lovelaces\n", min_pool_cost);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_min_pool_cost(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the ADA cost per UTXO byte from the protocol parameters.
+ *
+ * This function returns the cost, in lovelaces, required per byte of UTXO stored on the blockchain,
+ * as specified in the given \ref cardano_protocol_parameters_t object. This cost affects how much ADA
+ * is required to store UTXOs, incentivizing efficient use of the blockchain.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The cost in lovelaces per UTXO byte. If the \p protocol_parameters pointer is NULL,
+ *         the function will return 0.
+ *
+ * \note The cost per UTXO byte ensures that there is a fee associated with storing UTXOs on the
+ *       blockchain, helping to maintain the economic sustainability of the system.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t ada_per_utxo_byte = cardano_protocol_parameters_get_ada_per_utxo_byte(protocol_params);
+ *
+ * printf("ADA per UTXO byte: %llu lovelaces\n", ada_per_utxo_byte);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_ada_per_utxo_byte(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the cost models from the protocol parameters.
+ *
+ * This function returns the cost models used to calculate the execution costs for Plutus smart contracts,
+ * as specified in the given \ref cardano_protocol_parameters_t object. Each cost model defines the resource
+ * costs (such as CPU and memory) for executing various Plutus operations.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_costmdls_t object representing the cost models.
+ *         If the \p protocol_parameters pointer is NULL, the function will return NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_costmdls_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_costmdls_unref when it is no longer needed.
+ *
+ * \note The cost models are essential for calculating the fees for Plutus script execution based on the
+ *       resource usage specified by the smart contract.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_costmdls_t* cost_models = cardano_protocol_parameters_get_cost_models(protocol_params);
+ *
+ * if (cost_models != NULL)
+ * {
+ *   // Use the cost models as needed
+ *
+ *   // Clean up when done
+ *   cardano_costmdls_unref(&cost_models);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the cost models.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_costmdls_t* cardano_protocol_parameters_get_cost_models(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the execution unit prices from the protocol parameters.
+ *
+ * This function returns the execution unit prices for Plutus script execution from the given
+ * \ref cardano_protocol_parameters_t object. Execution unit prices define the cost of using
+ * resources such as CPU and memory during the execution of Plutus smart contracts.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_ex_unit_prices_t object representing the execution unit prices.
+ *         If the \p protocol_parameters pointer is NULL, the function will return NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_ex_unit_prices_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_ex_unit_prices_unref when it is no longer needed.
+ *
+ * \note The execution unit prices are essential for calculating transaction fees based on the resource
+ *       usage (CPU and memory) of Plutus smart contracts.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_ex_unit_prices_t* execution_costs = cardano_protocol_parameters_get_execution_costs(protocol_params);
+ *
+ * if (execution_costs != NULL)
+ * {
+ *   // Use the execution unit prices as needed
+ *
+ *   // Clean up when done
+ *   cardano_ex_unit_prices_unref(&execution_costs);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the execution unit prices.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_ex_unit_prices_t* cardano_protocol_parameters_get_execution_costs(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum execution units for a transaction from the protocol parameters.
+ *
+ * This function returns the maximum execution units (CPU and memory) allowed for a single transaction
+ * on the Cardano blockchain, as specified in the given \ref cardano_protocol_parameters_t object.
+ * These execution units are used to limit the computational resources consumed by Plutus scripts
+ * within a transaction.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_ex_units_t object representing the maximum execution units for a transaction.
+ *         If the \p protocol_parameters pointer is NULL, the function will return NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_ex_units_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_ex_units_unref when it is no longer needed.
+ *
+ * \note These limits ensure that a transaction does not consume excessive computational resources,
+ *       helping maintain the overall efficiency of the network.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_ex_units_t* max_tx_ex_units = cardano_protocol_parameters_get_max_tx_ex_units(protocol_params);
+ *
+ * if (max_tx_ex_units != NULL)
+ * {
+ *   // Use the maximum execution units as needed
+ *
+ *   // Clean up when done
+ *   cardano_ex_units_unref(&max_tx_ex_units);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the maximum transaction execution units.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_ex_units_t* cardano_protocol_parameters_get_max_tx_ex_units(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum execution units for a block from the protocol parameters.
+ *
+ * This function returns the maximum execution units (CPU and memory) allowed for a single block
+ * on the Cardano blockchain, as specified in the given \ref cardano_protocol_parameters_t object.
+ * These execution units are used to limit the computational resources consumed by Plutus scripts
+ * within all transactions in a block.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_ex_units_t object representing the maximum execution units for a block.
+ *         If the \p protocol_parameters pointer is NULL, the function will return NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_ex_units_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_ex_units_unref when it is no longer needed.
+ *
+ * \note These limits ensure that no single block can consume excessive computational resources,
+ *       maintaining network performance and security.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_ex_units_t* max_block_ex_units = cardano_protocol_parameters_get_max_block_ex_units(protocol_params);
+ *
+ * if (max_block_ex_units != NULL)
+ * {
+ *   // Use the maximum block execution units as needed
+ *
+ *   // Clean up when done
+ *   cardano_ex_units_unref(&max_block_ex_units);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the maximum block execution units.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_ex_units_t* cardano_protocol_parameters_get_max_block_ex_units(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum value size from the protocol parameters.
+ *
+ * This function returns the maximum size (in bytes) allowed for a transaction output's value
+ * in the Cardano blockchain, as specified in the given \ref cardano_protocol_parameters_t object.
+ * The value size includes the amount of ADA and any additional tokens in the transaction output.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The maximum value size in bytes. If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The maximum value size helps ensure that individual transaction outputs do not exceed
+ *       the size limits, maintaining efficiency and preventing potential abuse of network resources.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t max_value_size = cardano_protocol_parameters_get_max_value_size(protocol_params);
+ *
+ * printf("Maximum value size: %llu bytes\n", max_value_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_max_value_size(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the collateral percentage required for Plutus scripts from the protocol parameters.
+ *
+ * This function returns the percentage of the transaction fee that must be provided as collateral
+ * for Plutus script execution, as specified in the given \ref cardano_protocol_parameters_t object.
+ * Collateral is required to cover the costs if a Plutus script fails to execute.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The collateral percentage as an integer value. If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The collateral percentage determines how much ADA must be set aside to cover potential
+ *       costs associated with failed Plutus script execution. This amount is based on the total transaction fee.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t collateral_percentage = cardano_protocol_parameters_get_collateral_percentage(protocol_params);
+ *
+ * printf("Collateral percentage: %llu%%\n", collateral_percentage);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_collateral_percentage(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum number of collateral inputs allowed for a transaction from the protocol parameters.
+ *
+ * This function returns the maximum number of collateral inputs that can be included in a transaction
+ * on the Cardano blockchain, as specified in the given \ref cardano_protocol_parameters_t object.
+ * Collateral inputs are required to cover transaction costs in case of failed Plutus script execution.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The maximum number of collateral inputs allowed for a transaction.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The maximum number of collateral inputs ensures that transactions cannot include an excessive
+ *       number of collateral inputs, helping maintain network performance and preventing potential abuse.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t max_collateral_inputs = cardano_protocol_parameters_get_max_collateral_inputs(protocol_params);
+ *
+ * printf("Maximum collateral inputs: %llu\n", max_collateral_inputs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_max_collateral_inputs(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the pool voting thresholds from the protocol parameters.
+ *
+ * This function returns the voting thresholds for stake pools, as specified in the given
+ * \ref cardano_protocol_parameters_t object.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_pool_voting_thresholds_t object representing the pool voting thresholds.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_pool_voting_thresholds_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_pool_voting_thresholds_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_pool_voting_thresholds_t* voting_thresholds = cardano_protocol_parameters_get_pool_voting_thresholds(protocol_params);
+ *
+ * if (voting_thresholds != NULL)
+ * {
+ *   // Use the voting thresholds as needed
+ *
+ *   // Clean up when done
+ *   cardano_pool_voting_thresholds_unref(&voting_thresholds);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the pool voting thresholds.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_pool_voting_thresholds_t* cardano_protocol_parameters_get_pool_voting_thresholds(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the DRep voting thresholds from the protocol parameters.
+ *
+ * This function returns the voting thresholds for decentralized representatives (DReps) as specified
+ * in the given \ref cardano_protocol_parameters_t object.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_drep_voting_thresholds_t object representing the DRep voting thresholds.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_drep_voting_thresholds_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_drep_voting_thresholds_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_drep_voting_thresholds_t* drep_voting_thresholds = cardano_protocol_parameters_get_drep_voting_thresholds(protocol_params);
+ *
+ * if (drep_voting_thresholds != NULL)
+ * {
+ *   // Use the DRep voting thresholds as needed
+ *
+ *   // Clean up when done
+ *   cardano_drep_voting_thresholds_unref(&drep_voting_thresholds);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the DRep voting thresholds.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_drep_voting_thresholds_t* cardano_protocol_parameters_get_drep_voting_thresholds(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the minimum committee size from the protocol parameters.
+ *
+ * This function returns the minimum size of the governance committee as specified
+ * in the given \ref cardano_protocol_parameters_t object. The committee size is relevant
+ * for governance-related decisions on the Cardano blockchain.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The minimum committee size as a 64-bit unsigned integer.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The minimum committee size defines the number of members required to form a valid
+ *       governance committee for making decisions on protocol changes and other governance activities.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t min_committee_size = cardano_protocol_parameters_get_min_committee_size(protocol_params);
+ *
+ * printf("Minimum committee size: %llu\n", min_committee_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_min_committee_size(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the committee term limit from the protocol parameters.
+ *
+ * This function returns the maximum number of terms a committee member can serve, as specified
+ * in the given \ref cardano_protocol_parameters_t object. The term limit helps define governance
+ * rules for the rotation and tenure of committee members on the Cardano blockchain.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The committee term limit as a 64-bit unsigned integer.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The committee term limit defines how long a member can serve on the governance committee
+ *       before requiring rotation or re-election, contributing to governance stability.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t committee_term_limit = cardano_protocol_parameters_get_committee_term_limit(protocol_params);
+ *
+ * printf("Committee term limit: %llu terms\n", committee_term_limit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_committee_term_limit(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the governance action validity period from the protocol parameters.
+ *
+ * This function returns the validity period for governance actions, as specified
+ * in the given \ref cardano_protocol_parameters_t object. The validity period determines
+ * the length of time a governance action remains valid before expiring.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The governance action validity period as a 64-bit unsigned integer, representing the number of slots.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The governance action validity period ensures that governance proposals and actions
+ *       have a defined lifespan, ensuring timely decision-making and avoiding stale actions.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t validity_period = cardano_protocol_parameters_get_governance_action_validity_period(protocol_params);
+ *
+ * printf("Governance action validity period: %llu slots\n", validity_period);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_governance_action_validity_period(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the deposit required for submitting a governance action from the protocol parameters.
+ *
+ * This function returns the deposit amount required to submit a governance action, as specified
+ * in the given \ref cardano_protocol_parameters_t object. The deposit is required to discourage
+ * spam proposals and to ensure that proposers are committed to the action.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The deposit required for governance actions, in lovelaces (1 ADA = 1,000,000 lovelaces).
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The governance action deposit ensures that there is a cost associated with submitting proposals,
+ *       which helps maintain the quality and seriousness of governance actions.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t governance_deposit = cardano_protocol_parameters_get_governance_action_deposit(protocol_params);
+ *
+ * printf("Governance action deposit: %llu lovelaces\n", governance_deposit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_governance_action_deposit(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the deposit required for registering as a DRep (Decentralized Representative) from the protocol parameters.
+ *
+ * This function returns the deposit amount required to register as a DRep, as specified
+ * in the given \ref cardano_protocol_parameters_t object. The deposit is required to ensure
+ * that DRep candidates are committed to participating in governance.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The DRep registration deposit in lovelaces (1 ADA = 1,000,000 lovelaces).
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The DRep deposit ensures that registering as a Decentralized Representative
+ *       carries a cost, preventing spam registrations and ensuring that candidates are committed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t drep_deposit = cardano_protocol_parameters_get_drep_deposit(protocol_params);
+ *
+ * printf("DRep registration deposit: %llu lovelaces\n", drep_deposit);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_drep_deposit(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the DRep (Decentralized Representative) inactivity period from the protocol parameters.
+ *
+ * This function returns the inactivity period for a DRep, as specified in the given
+ * \ref cardano_protocol_parameters_t object. The inactivity period defines how long a DRep can remain inactive
+ * (i.e., without participating in governance actions) before they are considered inactive.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The DRep inactivity period as a 64-bit unsigned integer representing the number of slots.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The DRep inactivity period ensures that DReps remain active in governance decisions.
+ *       If a DRep does not participate in governance for this period, they may be removed or flagged as inactive.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t inactivity_period = cardano_protocol_parameters_get_drep_inactivity_period(protocol_params);
+ *
+ * printf("DRep inactivity period: %llu slots\n", inactivity_period);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_drep_inactivity_period(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the cost per byte for reference scripts from the protocol parameters.
+ *
+ * This function returns the cost per byte associated with storing a reference script, as specified
+ * in the given \ref cardano_protocol_parameters_t object. Reference scripts allow transactions
+ * to use Plutus scripts without including the full script in each transaction, optimizing storage and efficiency.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_unit_interval_t object representing the cost per byte for reference scripts.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_unit_interval_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The cost per byte is important for calculating the storage fees associated with storing reference scripts
+ *       on-chain, ensuring fair pricing for transactions that utilize reference scripts.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* script_cost = cardano_protocol_parameters_get_ref_script_cost_per_byte(protocol_params);
+ *
+ * if (script_cost != NULL)
+ * {
+ *   // Use the reference script cost per byte as needed
+ *
+ *   // Clean up when done
+ *   cardano_unit_interval_unref(&script_cost);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the reference script cost per byte.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t* cardano_protocol_parameters_get_ref_script_cost_per_byte(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum total reference script size per block from the protocol parameters.
+ *
+ * This function returns the maximum cumulative size, in bytes, of the reference scripts that a single
+ * block may use, as specified in the given \ref cardano_protocol_parameters_t object. On the wire this
+ * parameter is a 32-bit unsigned integer.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The maximum reference script size per block in bytes.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note This limit caps the total amount of reference script data a block may pull in, keeping block
+ *       validation costs bounded.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t max_ref_script_size_per_block = cardano_protocol_parameters_get_max_ref_script_size_per_block(protocol_params);
+ *
+ * printf("Max ref script size per block: %llu bytes\n", max_ref_script_size_per_block);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_max_ref_script_size_per_block(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum total reference script size per transaction from the protocol parameters.
+ *
+ * This function returns the maximum cumulative size, in bytes, of the reference scripts that a single
+ * transaction may use, as specified in the given \ref cardano_protocol_parameters_t object. On the wire
+ * this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The maximum reference script size per transaction in bytes.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note This limit caps the total amount of reference script data a transaction may pull in, keeping
+ *       transaction validation costs bounded.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t max_ref_script_size_per_tx = cardano_protocol_parameters_get_max_ref_script_size_per_tx(protocol_params);
+ *
+ * printf("Max ref script size per tx: %llu bytes\n", max_ref_script_size_per_tx);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_max_ref_script_size_per_tx(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the reference script cost stride from the protocol parameters.
+ *
+ * This function returns the size step, in bytes, at which the reference script fee tier increases,
+ * as specified in the given \ref cardano_protocol_parameters_t object. On the wire this parameter
+ * is a positive 32-bit unsigned integer; zero is not a valid value.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The reference script cost stride in bytes, or 0 if it is not set. A fresh parameter set does not
+ *         carry it, as the parameters of the eras before Dijkstra do not.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note Together with the reference script cost multiplier, the stride defines the tiered pricing of
+ *       reference script bytes: after each stride the per-byte price is scaled by the multiplier. The fee
+ *       functions that take the protocol parameters price with the Conway value, 25600 bytes, when the
+ *       stride is not set.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t ref_script_cost_stride = cardano_protocol_parameters_get_ref_script_cost_stride(protocol_params);
+ *
+ * printf("Ref script cost stride: %llu bytes\n", ref_script_cost_stride);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_ref_script_cost_stride(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the reference script cost multiplier from the protocol parameters.
+ *
+ * This function returns the multiplier applied to the reference script fee at each cost stride,
+ * as specified in the given \ref cardano_protocol_parameters_t object. On the wire this parameter
+ * is a positive interval (a rational number); its value is expected to be greater than zero.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_unit_interval_t object representing the reference script cost multiplier,
+ *         or NULL if it is not set. A fresh parameter set does not carry it, as the parameters of the eras before
+ *         Dijkstra do not. If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_unit_interval_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *       The fee functions that take the protocol parameters price with the Conway value, 6/5, when the multiplier
+ *       is not set.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* cost_multiplier = cardano_protocol_parameters_get_ref_script_cost_multiplier(protocol_params);
+ *
+ * if (cost_multiplier != NULL)
+ * {
+ *   // Use the reference script cost multiplier as needed
+ *
+ *   // Clean up when done
+ *   cardano_unit_interval_unref(&cost_multiplier);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the reference script cost multiplier.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t* cardano_protocol_parameters_get_ref_script_cost_multiplier(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum pledge leverage from the protocol parameters.
+ *
+ * This function returns the maximum pledge leverage (CIP-50), the largest ratio of delegated stake to
+ * pledge that a stake pool may reach before its rewards are capped, as specified in the given
+ * \ref cardano_protocol_parameters_t object. On the wire this parameter is a non-negative interval
+ * (a rational number, which may be greater than one) or nil when the leverage is unbounded.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_unit_interval_t object representing the maximum pledge leverage,
+ *         or NULL when the leverage is unbounded. A freshly created parameter set reports an unbounded
+ *         leverage, which is the state of every era before the parameter was introduced.
+ *         If the \p protocol_parameters pointer is NULL, the function also returns NULL.
+ *
+ * \note When the function returns a non-NULL pointer, the caller is responsible for managing the lifecycle of the
+ *       returned \ref cardano_unit_interval_t object. Specifically, the caller must release the object by calling
+ *       \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* max_pledge_leverage = cardano_protocol_parameters_get_max_pledge_leverage(protocol_params);
+ *
+ * if (max_pledge_leverage != NULL)
+ * {
+ *   // Use the maximum pledge leverage as needed
+ *
+ *   // Clean up when done
+ *   cardano_unit_interval_unref(&max_pledge_leverage);
+ * }
+ * else
+ * {
+ *   printf("The pledge leverage is unbounded.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t* cardano_protocol_parameters_get_max_pledge_leverage(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the minimum pool margin from the protocol parameters.
+ *
+ * This function returns the minimum pool margin (CIP-23), the smallest share of the rewards a stake pool
+ * may keep for itself, as specified in the given \ref cardano_protocol_parameters_t object. On the wire
+ * this parameter is a unit interval (a rational number between zero and one).
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_unit_interval_t object representing the minimum pool margin.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_unit_interval_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* min_pool_margin = cardano_protocol_parameters_get_min_pool_margin(protocol_params);
+ *
+ * if (min_pool_margin != NULL)
+ * {
+ *   // Use the minimum pool margin as needed
+ *
+ *   // Clean up when done
+ *   cardano_unit_interval_unref(&min_pool_margin);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the minimum pool margin.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t* cardano_protocol_parameters_get_min_pool_margin(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the Leios announcement period length from the protocol parameters.
+ *
+ * This function returns the length, in milliseconds, of the Leios announcement period, the window during
+ * which an endorser block is announced to the network before voting starts, as specified in the given
+ * \ref cardano_protocol_parameters_t object. On the wire this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The Leios announcement period length in milliseconds.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t announcement_period = cardano_protocol_parameters_get_leios_announcement_period_length(protocol_params);
+ *
+ * printf("Leios announcement period length: %llu\n", announcement_period);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_leios_announcement_period_length(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the Leios vote period length from the protocol parameters.
+ *
+ * This function returns the length, in milliseconds, of the Leios vote period, the window during which the
+ * committee casts votes on an endorser block, as specified in the given \ref cardano_protocol_parameters_t
+ * object. On the wire this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The Leios vote period length in milliseconds.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t vote_period = cardano_protocol_parameters_get_leios_vote_period_length(protocol_params);
+ *
+ * printf("Leios vote period length: %llu\n", vote_period);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_leios_vote_period_length(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the Leios diffusion period length from the protocol parameters.
+ *
+ * This function returns the length, in milliseconds, of the Leios diffusion period, the time allotted for
+ * an endorser block and its transactions to propagate through the network, as specified in the given
+ * \ref cardano_protocol_parameters_t object. On the wire this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The Leios diffusion period length in milliseconds.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t diffusion_period = cardano_protocol_parameters_get_leios_diffusion_period_length(protocol_params);
+ *
+ * printf("Leios diffusion period length: %llu\n", diffusion_period);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_leios_diffusion_period_length(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the Leios committee size from the protocol parameters.
+ *
+ * This function returns the number of top-stake pools seated in the Leios voting committee for the epoch,
+ * as specified in the given \ref cardano_protocol_parameters_t object. On the wire this parameter is a
+ * 16-bit unsigned integer.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The Leios committee size.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t committee_size = cardano_protocol_parameters_get_leios_committee_size(protocol_params);
+ *
+ * printf("Leios committee size: %llu\n", committee_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_leios_committee_size(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the Leios quorum stake threshold from the protocol parameters.
+ *
+ * This function returns the minimum fraction of the total active stake that the votes in a certificate
+ * must represent for an endorser block to be certified, as specified in the given
+ * \ref cardano_protocol_parameters_t object. On the wire this parameter is a unit interval (a rational
+ * number between zero and one).
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_unit_interval_t object representing the Leios quorum stake threshold.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_unit_interval_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* quorum = cardano_protocol_parameters_get_leios_quorum_stake_threshold(protocol_params);
+ *
+ * if (quorum != NULL)
+ * {
+ *   // Use the quorum stake threshold as needed
+ *
+ *   // Clean up when done
+ *   cardano_unit_interval_unref(&quorum);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the Leios quorum stake threshold.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t* cardano_protocol_parameters_get_leios_quorum_stake_threshold(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum endorser block references size from the protocol parameters.
+ *
+ * This function returns the maximum size, in bytes, of the list of transaction references (a transaction
+ * hash and a transaction size per entry) that an endorser block itself carries, as specified in the given
+ * \ref cardano_protocol_parameters_t object. Since an endorser block references its transactions instead
+ * of embedding them, this limit caps the size of the endorser block when many small transactions are
+ * referenced. On the wire this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The maximum endorser block references size in bytes.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t max_references_size = cardano_protocol_parameters_get_max_endorser_block_references_size(protocol_params);
+ *
+ * printf("Maximum endorser block references size: %llu\n", max_references_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_max_endorser_block_references_size(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum endorser block transactions size from the protocol parameters.
+ *
+ * This function returns the maximum total size, in bytes, of the transactions carried by a single endorser
+ * block, as specified in the given \ref cardano_protocol_parameters_t object. On the wire this parameter is
+ * a 32-bit unsigned integer.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The maximum endorser block transactions size in bytes.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t max_txs_size = cardano_protocol_parameters_get_max_endorser_block_txs_size(protocol_params);
+ *
+ * printf("Maximum endorser block transactions size: %llu\n", max_txs_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_max_endorser_block_txs_size(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum endorser block execution units from the protocol parameters.
+ *
+ * This function returns the maximum execution units (CPU and memory) that the Plutus scripts of a single
+ * endorser block may consume in total, as specified in the given \ref cardano_protocol_parameters_t object.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_ex_units_t object representing the maximum execution units for an endorser block.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_ex_units_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_ex_units_unref when it is no longer needed.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_ex_units_t* max_ex_units = cardano_protocol_parameters_get_max_endorser_block_execution_units(protocol_params);
+ *
+ * if (max_ex_units != NULL)
+ * {
+ *   // Use the maximum execution units as needed
+ *
+ *   // Clean up when done
+ *   cardano_ex_units_unref(&max_ex_units);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the maximum endorser block execution units.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_ex_units_t* cardano_protocol_parameters_get_max_endorser_block_execution_units(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the maximum reference script size per endorser block from the protocol parameters.
+ *
+ * This function returns the maximum cumulative size, in bytes, of the reference scripts that the
+ * transactions of a single endorser block may use, as specified in the given
+ * \ref cardano_protocol_parameters_t object. On the wire this parameter is a 32-bit unsigned integer.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The maximum reference script size per endorser block in bytes.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t max_ref_script_size = cardano_protocol_parameters_get_max_ref_script_size_per_endorser_block(protocol_params);
+ *
+ * printf("Maximum reference script size per endorser block: %llu\n", max_ref_script_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_max_ref_script_size_per_endorser_block(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the Peras minimum candidate block age from the protocol parameters.
+ *
+ * This function returns the minimum age, in slots, that a block must reach before it becomes eligible
+ * for voting in a Peras round, as specified in the given \ref cardano_protocol_parameters_t object.
+ * On the wire this parameter is a slot interval (a 32-bit unsigned integer).
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The Peras minimum candidate block age in slots.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t min_candidate_block_age = cardano_protocol_parameters_get_peras_min_candidate_block_age(protocol_params);
+ *
+ * printf("Peras minimum candidate block age: %llu\n", min_candidate_block_age);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_peras_min_candidate_block_age(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the Peras healing factor from the protocol parameters.
+ *
+ * This function returns the healing time coefficient used to derive the length of the Peras cooldown
+ * period, the time the protocol waits after a round without a quorum before voting resumes, as specified
+ * in the given \ref cardano_protocol_parameters_t object. On the wire this parameter is a positive interval
+ * (a rational number); its value is expected to be greater than zero.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_unit_interval_t object representing the Peras healing factor,
+ *         or NULL if it is not set. A fresh parameter set does not carry it, as the parameters of the eras before
+ *         Dijkstra do not. If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note When the function returns a non-NULL pointer, the caller is responsible for managing the lifecycle of the
+ *       returned \ref cardano_unit_interval_t object. Specifically, the caller must release the object by calling
+ *       \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* healing_factor = cardano_protocol_parameters_get_peras_healing_factor(protocol_params);
+ *
+ * if (healing_factor != NULL)
+ * {
+ *   // Use the Peras healing factor as needed
+ *
+ *   // Clean up when done
+ *   cardano_unit_interval_unref(&healing_factor);
+ * }
+ * else
+ * {
+ *   printf("The Peras healing factor is not set.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t* cardano_protocol_parameters_get_peras_healing_factor(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the Peras certificate boost from the protocol parameters.
+ *
+ * This function returns the extra chain weight that a Peras certificate gives to the block it boosts,
+ * as specified in the given \ref cardano_protocol_parameters_t object. On the wire this parameter is a
+ * 16-bit unsigned integer.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The Peras certificate boost.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t cert_boost = cardano_protocol_parameters_get_peras_cert_boost(protocol_params);
+ *
+ * printf("Peras certificate boost: %llu\n", cert_boost);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_peras_cert_boost(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the Peras target committee size from the protocol parameters.
+ *
+ * This function returns the target number of voters seated in the Peras voting committee, as specified
+ * in the given \ref cardano_protocol_parameters_t object. On the wire this parameter is a 16-bit unsigned
+ * integer.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The Peras target committee size.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t committee_size = cardano_protocol_parameters_get_peras_target_committee_size(protocol_params);
+ *
+ * printf("Peras target committee size: %llu\n", committee_size);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_peras_target_committee_size(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the Peras bootstrap round from the protocol parameters.
+ *
+ * This function returns the round number used to manually bootstrap Peras voting at a specific time, as
+ * specified in the given \ref cardano_protocol_parameters_t object. On the wire this parameter is a
+ * 32-bit unsigned integer or nil when no bootstrap round is scheduled.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to the Peras bootstrap round, or NULL when no bootstrap round is scheduled. A freshly
+ *         created parameter set reports no bootstrap round, which is the state of every era before the
+ *         parameter was introduced. If the \p protocol_parameters pointer is NULL, the function also returns NULL.
+ *
+ * \note The returned pointer refers to storage owned by the \ref cardano_protocol_parameters_t object. It must not
+ *       be freed, and it remains valid only until the bootstrap round is set again or the object is released.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * const uint64_t* bootstrap_round = cardano_protocol_parameters_get_peras_bootstrap_round(protocol_params);
+ *
+ * if (bootstrap_round != NULL)
+ * {
+ *   printf("Peras bootstrap round: %llu\n", *bootstrap_round);
+ * }
+ * else
+ * {
+ *   printf("No Peras bootstrap round is scheduled.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_protocol_parameters_get_peras_bootstrap_round(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the Peras quorum threshold safety margin from the protocol parameters.
+ *
+ * This function returns the extra safety margin added on top of the 75% baseline of the Peras quorum
+ * threshold, as specified in the given \ref cardano_protocol_parameters_t object. On the wire this
+ * parameter is a unit interval (a rational number between zero and one); the ledger expects it to be
+ * between 0 and 0.25, inclusive.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_unit_interval_t object representing the Peras quorum threshold safety margin.
+ *         If the \p protocol_parameters pointer is NULL, the function returns NULL.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned \ref cardano_unit_interval_t object.
+ *       Specifically, the caller must release the object by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* safety_margin = cardano_protocol_parameters_get_peras_quorum_threshold_safety_margin(protocol_params);
+ *
+ * if (safety_margin != NULL)
+ * {
+ *   // Use the quorum threshold safety margin as needed
+ *
+ *   // Clean up when done
+ *   cardano_unit_interval_unref(&safety_margin);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the Peras quorum threshold safety margin.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_unit_interval_t* cardano_protocol_parameters_get_peras_quorum_threshold_safety_margin(
+  cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the reference inputs cost per multi-asset byte from the protocol parameters.
+ *
+ * This function returns the fee, in lovelaces, charged for every multi-asset byte present in the values
+ * of the reference inputs of a transaction, as specified in the given \ref cardano_protocol_parameters_t
+ * object. On the wire this parameter is a coin amount.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The reference inputs cost per multi-asset byte in lovelaces.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note Reading large amounts of data from disk becomes a bottleneck once the ledger state is stored on
+ *       disk, so this fee acts as a monetary deterrent against it. The ledger does not charge it yet, and
+ *       the fee functions of this library do not take it into account.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t cost = cardano_protocol_parameters_get_ref_inputs_cost_per_multi_asset_byte(protocol_params);
+ *
+ * printf("Reference inputs cost per multi-asset byte: %llu lovelaces\n", cost);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_ref_inputs_cost_per_multi_asset_byte(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the reference inputs cost per datum byte from the protocol parameters.
+ *
+ * This function returns the fee, in lovelaces, charged per byte of the datums attached to the reference
+ * inputs of a transaction, as specified in the given \ref cardano_protocol_parameters_t object. On the wire
+ * this parameter is a coin amount per byte.
+ *
+ * \param[in] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                This parameter must not be NULL.
+ *
+ * \return The reference inputs cost per datum byte in lovelaces.
+ *         If the \p protocol_parameters pointer is NULL, the function returns 0.
+ *
+ * \note Reading large amounts of data from disk becomes a bottleneck once the ledger state is stored on
+ *       disk, so this fee acts as a monetary deterrent against it. The ledger does not charge it yet, and
+ *       the fee functions of this library do not take it into account.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t cost = cardano_protocol_parameters_get_ref_inputs_cost_per_datum_byte(protocol_params);
+ *
+ * printf("Reference inputs cost per datum byte: %llu lovelaces\n", cost);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_ref_inputs_cost_per_datum_byte(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Sets the minimum fee coefficient "A" in the protocol parameters.
+ *
+ * This function sets the minimum fee coefficient "A" in the given \ref cardano_protocol_parameters_t object.
+ * The "A" parameter is part of the fee calculation formula that determines the minimum fee for transactions.
+ * The formula is: fee = A * size + B, where "A" is the multiplier for the transaction size and "B" is the fixed constant.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] min_fee_a The new value for the minimum fee coefficient "A".
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the minimum fee coefficient "A" was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The minimum fee coefficient "A" is an important parameter in determining the cost of transactions,
+ *       ensuring that larger transactions pay a proportional fee based on their size.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_min_fee_a = 44; // New value for the fee coefficient "A"
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_min_fee_a(protocol_params, new_min_fee_a);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum fee coefficient 'A' set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set minimum fee coefficient 'A'.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_min_fee_a(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       min_fee_a);
+
+/**
+ * \brief Sets the minimum fee constant "B" in the protocol parameters.
+ *
+ * This function sets the minimum fee constant "B" in the given \ref cardano_protocol_parameters_t object.
+ * The "B" parameter is part of the fee calculation formula that determines the minimum fee for transactions.
+ * The formula is: fee = A * size + B, where "A" is the multiplier for the transaction size and "B" is the fixed constant.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] min_fee_b The new value for the minimum fee constant "B".
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the minimum fee constant "B" was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The minimum fee constant "B" ensures that every transaction pays a base fee, independent of its size.
+ *       This base fee prevents spam and ensures a minimum cost for processing any transaction.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_min_fee_b = 155381; // New value for the fee constant "B"
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_min_fee_b(protocol_params, new_min_fee_b);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum fee constant 'B' set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set minimum fee constant 'B'.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_min_fee_b(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       min_fee_b);
+
+/**
+ * \brief Sets the maximum block body size in the protocol parameters.
+ *
+ * This function sets the maximum allowable size (in bytes) for a block's body in the given
+ * \ref cardano_protocol_parameters_t object. The block body includes the actual transaction data
+ * and other relevant information within a block.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_block_body_size The new maximum block body size, in bytes.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum block body size was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The maximum block body size defines the upper limit on how large a block's body can be,
+ *       ensuring that blocks remain within a manageable size for network transmission and validation.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_max_block_body_size = 65536; // New value for the maximum block body size in bytes
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_block_body_size(protocol_params, new_max_block_body_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum block body size set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set maximum block body size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_block_body_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_block_body_size);
+
+/**
+ * \brief Sets the maximum transaction size in the protocol parameters.
+ *
+ * This function sets the maximum allowable size (in bytes) for a transaction in the given
+ * \ref cardano_protocol_parameters_t object. The transaction size includes all the data
+ * required to validate and execute the transaction on the Cardano blockchain.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_tx_size The new maximum transaction size, in bytes.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum transaction size was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The maximum transaction size ensures that individual transactions do not exceed a specified
+ *       size limit, which helps maintain network efficiency and prevents oversized transactions from
+ *       overloading the system.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_max_tx_size = 16384; // New value for the maximum transaction size in bytes
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_tx_size(protocol_params, new_max_tx_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum transaction size set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set maximum transaction size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_tx_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_tx_size);
+
+/**
+ * \brief Sets the maximum block header size in the protocol parameters.
+ *
+ * This function sets the maximum allowable size (in bytes) for a block's header in the given
+ * \ref cardano_protocol_parameters_t object. The block header contains essential information
+ * about the block, such as metadata, the previous block's hash, and other necessary validation data.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_block_header_size The new maximum block header size, in bytes.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum block header size was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The maximum block header size defines the upper limit on how large the header of a block can be,
+ *       ensuring that headers remain manageable for storage, validation, and transmission across the network.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_max_block_header_size = 1100; // New value for the maximum block header size in bytes
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_block_header_size(protocol_params, new_max_block_header_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum block header size set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set maximum block header size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_block_header_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_block_header_size);
+
+/**
+ * \brief Sets the key deposit value in the protocol parameters.
+ *
+ * This function sets the deposit amount required for registering a new stake key in the given
+ * \ref cardano_protocol_parameters_t object. The key deposit helps prevent spam registrations
+ * of stake keys by requiring users to deposit a certain amount of ADA when registering a new key.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] key_deposit The new key deposit value, in lovelaces (1 ADA = 1,000,000 lovelaces).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the key deposit value was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The key deposit helps secure the network by requiring a financial commitment for registering
+ *       a stake key, which is returned when the key is deregistered.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_key_deposit = 2000000; // New value for the key deposit (2 ADA in lovelaces)
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_key_deposit(protocol_params, new_key_deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Key deposit set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set key deposit.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_key_deposit(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       key_deposit);
+
+/**
+ * \brief Sets the pool deposit value in the protocol parameters.
+ *
+ * This function sets the deposit amount required for registering a new stake pool in the given
+ * \ref cardano_protocol_parameters_t object. The pool deposit helps ensure that pool operators
+ * are committed to maintaining their stake pool by requiring a financial commitment.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] pool_deposit The new pool deposit value, in lovelaces (1 ADA = 1,000,000 lovelaces).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the pool deposit value was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The pool deposit is returned to the pool operator when the pool is deregistered. It is designed
+ *       to prevent spam or low-effort stake pools from being created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_pool_deposit = 500000000; // New value for the pool deposit (500 ADA in lovelaces)
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_pool_deposit(protocol_params, new_pool_deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool deposit set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set pool deposit.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_pool_deposit(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       pool_deposit);
+
+/**
+ * \brief Sets the maximum epoch duration in the protocol parameters.
+ *
+ * This function sets the maximum number of epochs for which certain operations (such as stake key registrations or pool certificates)
+ * remain valid, as specified in the given \ref cardano_protocol_parameters_t object. The maximum epoch defines the lifespan
+ * of these operations within the blockchain.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_epoch The new maximum epoch value.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum epoch was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Setting a maximum epoch ensures that certain blockchain operations and commitments have a limited duration
+ *       and need to be re-registered or updated after the specified period.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_max_epoch = 21600; // New value for the maximum epoch
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_epoch(protocol_params, new_max_epoch);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum epoch set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set maximum epoch.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_epoch(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_epoch);
+
+/**
+ * \brief Sets the optimal number of stake pools (n_opt) in the protocol parameters.
+ *
+ * This function sets the optimal number of stake pools (n_opt) in the given \ref cardano_protocol_parameters_t object.
+ * The n_opt parameter is used to calculate rewards and incentivize the desired level of decentralization within the network.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] n_opt The new value for the optimal number of stake pools.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the optimal number of stake pools was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The n_opt value plays a key role in determining the distribution of staking rewards across pools
+ *       and is important for achieving the desired level of decentralization in the network.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_n_opt = 500; // New value for the optimal number of stake pools
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_n_opt(protocol_params, new_n_opt);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Optimal number of stake pools (n_opt) set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set optimal number of stake pools.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_n_opt(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       n_opt);
+
+/**
+ * \brief Sets the pool pledge influence (a0) in the protocol parameters.
+ *
+ * This function sets the pool pledge influence (a0) in the given \ref cardano_protocol_parameters_t object.
+ * The pool pledge influence determines how much a stake pool's pledge (the amount of ADA the pool operator commits)
+ * affects the rewards distribution. A higher pledge results in a higher ranking for the stake pool, which influences
+ * the rewards the pool receives.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] pool_pledge_influence A pointer to an initialized \ref cardano_unit_interval_t object representing the
+ *                                  new pool pledge influence. This value must be between 0 and 1 (inclusive).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the pool pledge influence was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_unit_interval_t object. The object must be
+ *       released by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The pool pledge influence is crucial in encouraging stake pool operators to commit more ADA to their pool,
+ *       helping to secure the network.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* new_pledge_influence = ...; // Assume new_pledge_influence is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_pool_pledge_influence(protocol_params, new_pledge_influence);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool pledge influence set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set pool pledge influence.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_unit_interval_unref(&new_pledge_influence);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_pool_pledge_influence(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       pool_pledge_influence);
+
+/**
+ * \brief Sets the expansion rate in the protocol parameters.
+ *
+ * This function sets the expansion rate in the given \ref cardano_protocol_parameters_t object.
+ * The expansion rate controls how much of the rewards are taken from reserves and added to the total rewards
+ * distributed to stakers. It is expressed as a unit interval between 0 and 1, where 1 means the entire reward comes from reserves.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] expansion_rate A pointer to an initialized \ref cardano_unit_interval_t object representing
+ *                           the new expansion rate. This value must be between 0 and 1 (inclusive).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the expansion rate was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_unit_interval_t object. The object must be
+ *       released by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The expansion rate defines the percentage of new ADA minted in each epoch and controls how quickly the total
+ *       supply of ADA increases over time.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* new_expansion_rate = ...; // Assume new_expansion_rate is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_expansion_rate(protocol_params, new_expansion_rate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Expansion rate set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set expansion rate.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_unit_interval_unref(&new_expansion_rate);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_expansion_rate(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       expansion_rate);
+
+/**
+ * \brief Sets the treasury growth rate in the protocol parameters.
+ *
+ * This function sets the treasury growth rate in the given \ref cardano_protocol_parameters_t object.
+ * The treasury growth rate determines the proportion of rewards that are allocated to the treasury,
+ * which funds governance and development activities. It is expressed as a unit interval between 0 and 1,
+ * where 1 means all rewards go to the treasury.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] treasury_growth_rate A pointer to an initialized \ref cardano_unit_interval_t object representing
+ *                                 the new treasury growth rate. This value must be between 0 and 1 (inclusive).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the treasury growth rate was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_unit_interval_t object. The object must be
+ *       released by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The treasury growth rate defines how much of the staking rewards are redirected to the treasury to fund
+ *       community-driven projects and governance.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* new_treasury_growth_rate = ...; // Assume new_treasury_growth_rate is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_treasury_growth_rate(protocol_params, new_treasury_growth_rate);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Treasury growth rate set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set treasury growth rate.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_unit_interval_unref(&new_treasury_growth_rate);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_treasury_growth_rate(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       treasury_growth_rate);
+
+/**
+ * \brief Sets the decentralization parameter (d) in the protocol parameters.
+ *
+ * This function sets the decentralization parameter (d) in the given \ref cardano_protocol_parameters_t object.
+ * The decentralization parameter controls the extent to which the network is decentralized. As the value of `d`
+ * approaches 0, the network becomes more decentralized, with more blocks being produced by the community rather than by centralized entities.
+ * The value is expressed as a unit interval between 0 and 1, where 1 indicates full centralization and 0 represents full decentralization.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] d A pointer to an initialized \ref cardano_unit_interval_t object representing the new decentralization parameter (d).
+ *              This value must be between 0 and 1 (inclusive).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the decentralization parameter was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_unit_interval_t object. The object must be
+ *       released by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The decentralization parameter (d) defines how decentralized the network is, influencing the control over block production.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* new_d = ...; // Assume new_d is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_d(protocol_params, new_d);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Decentralization parameter set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set decentralization parameter.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_unit_interval_unref(&new_d);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_d(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       d);
+
+/**
+ * \brief Sets the extra entropy value in the protocol parameters.
+ *
+ * This function sets the extra entropy in the given \ref cardano_protocol_parameters_t object.
+ * Extra entropy allows for additional randomness to be injected into the protocol, contributing to the randomness used
+ * in leader election and other protocol processes.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] extra_entropy A pointer to an initialized \ref cardano_buffer_t object representing the new extra entropy.
+ *                          This can be used to provide additional randomness for protocol operations. Passing NULL will unset the extra entropy.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the extra entropy was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_buffer_t object. The object must be
+ *       released by calling \ref cardano_buffer_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_buffer_t* new_extra_entropy = ...; // Assume new_extra_entropy is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_extra_entropy(protocol_params, new_extra_entropy);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Extra entropy set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set extra entropy.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_buffer_unref(&new_extra_entropy);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_extra_entropy(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_buffer_t*              extra_entropy);
+
+/**
+ * \brief Sets the protocol version in the protocol parameters.
+ *
+ * This function sets the protocol version in the given \ref cardano_protocol_parameters_t object.
+ * The protocol version indicates the current version of the Cardano protocol being used, and it can be updated as part of
+ * governance decisions and protocol upgrades.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] protocol_version A pointer to an initialized \ref cardano_protocol_version_t object representing
+ *                             the new protocol version.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the protocol version was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_protocol_version_t object. The object must be
+ *       released by calling \ref cardano_protocol_version_unref when it is no longer needed.
+ *
+ * \note The protocol version is critical to ensuring network consensus and smooth upgrades, allowing nodes to recognize and adapt
+ *       to changes in protocol rules.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_protocol_version_t* new_protocol_version = ...; // Assume new_protocol_version is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_protocol_version(protocol_params, new_protocol_version);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Protocol version set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set protocol version.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_protocol_version_unref(&new_protocol_version);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_protocol_version(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_protocol_version_t*    protocol_version);
+
+/**
+ * \brief Sets the minimum pool cost in the protocol parameters.
+ *
+ * This function sets the minimum pool cost in the given \ref cardano_protocol_parameters_t object.
+ * The minimum pool cost defines the least amount of ADA that a stake pool can charge as fees in order to cover its operational costs.
+ * This ensures that pool operators are incentivized to maintain their pools and remain competitive in the network.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] min_pool_cost The new minimum pool cost value, in lovelaces (1 ADA = 1,000,000 lovelaces).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the minimum pool cost was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Setting an appropriate minimum pool cost helps prevent spam or low-effort stake pools from undercharging
+ *       and destabilizing the network.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_min_pool_cost = 340000000; // New value for the minimum pool cost (340 ADA in lovelaces)
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_min_pool_cost(protocol_params, new_min_pool_cost);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum pool cost set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set minimum pool cost.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_min_pool_cost(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       min_pool_cost);
+
+/**
+ * \brief Sets the ADA per UTXO byte in the protocol parameters.
+ *
+ * This function sets the cost, in ADA, per byte of UTXO storage in the given \ref cardano_protocol_parameters_t object.
+ * The ADA per UTXO byte parameter defines how much ADA is required to store each byte of a UTXO (Unspent Transaction Output).
+ * This helps ensure that the blockchain remains efficient by incentivizing smaller UTXO sizes and discouraging excessive on-chain storage.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] ada_per_utxo_byte The new ADA per UTXO byte value, in lovelaces (1 ADA = 1,000,000 lovelaces).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the ADA per UTXO byte value was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note This value helps maintain efficient storage usage on the blockchain by charging for UTXO space.
+ *       A higher value may encourage smaller, more efficient transactions.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_ada_per_utxo_byte = 4310; // New value for ADA per UTXO byte (in lovelaces)
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_ada_per_utxo_byte(protocol_params, new_ada_per_utxo_byte);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("ADA per UTXO byte set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set ADA per UTXO byte.\n");
+ * }
+ * \endcode
+ */
+
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_ada_per_utxo_byte(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       ada_per_utxo_byte);
+
+/**
+ * \brief Sets the cost models in the protocol parameters.
+ *
+ * This function sets the cost models in the given \ref cardano_protocol_parameters_t object.
+ * Cost models define the computational costs associated with running Plutus scripts on the blockchain.
+ * Each cost model specifies how much computational resources (in terms of CPU and memory) different operations within
+ * a script will consume, and this is used to determine the fees that will be charged for executing those scripts.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] cost_models A pointer to an initialized \ref cardano_costmdls_t object representing the new cost models.
+ *                        These cost models will replace any previously set models in the protocol parameters.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the cost models were successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_costmdls_t object. The object must be
+ *       released by calling \ref cardano_costmdls_unref when it is no longer needed.
+ *
+ * \note Setting accurate cost models ensures that transaction fees fairly reflect the computational resources consumed by Plutus scripts.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_costmdls_t* new_cost_models = ...; // Assume new_cost_models is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_cost_models(protocol_params, new_cost_models);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Cost models set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set cost models.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_costmdls_unref(&new_cost_models);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_cost_models(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_costmdls_t*            cost_models);
+
+/**
+ * \brief Sets the execution costs in the protocol parameters.
+ *
+ * This function sets the execution costs (or ex-unit prices) in the given \ref cardano_protocol_parameters_t object.
+ * Execution costs define the fees for running Plutus smart contracts, represented as prices for each execution unit (ex-unit) of CPU and memory.
+ * These prices determine how much a transaction that includes Plutus scripts will need to pay for using computational resources on the blockchain.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] execution_costs A pointer to an initialized \ref cardano_ex_unit_prices_t object representing the new execution costs.
+ *                            These costs will replace any previously set execution costs in the protocol parameters.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the execution costs were successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_ex_unit_prices_t object. The object must be
+ *       released by calling \ref cardano_ex_unit_prices_unref when it is no longer needed.
+ *
+ * \note Setting appropriate execution costs helps ensure fair pricing for computational resources when running Plutus scripts.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_ex_unit_prices_t* new_execution_costs = ...; // Assume new_execution_costs is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_execution_costs(protocol_params, new_execution_costs);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Execution costs set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set execution costs.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_ex_unit_prices_unref(&new_execution_costs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_execution_costs(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_ex_unit_prices_t*      execution_costs);
+
+/**
+ * \brief Sets the maximum execution units per transaction in the protocol parameters.
+ *
+ * This function sets the maximum execution units that can be consumed by a single transaction in the given
+ * \ref cardano_protocol_parameters_t object. Execution units are the computational resources (e.g., CPU and memory)
+ * required to run Plutus scripts. By setting a limit on the maximum execution units per transaction, the protocol ensures
+ * that no transaction can monopolize blockchain resources.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_tx_ex_units A pointer to an initialized \ref cardano_ex_units_t object representing the maximum execution units for a transaction.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum transaction execution units were successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_ex_units_t object. The object must be
+ *       released by calling \ref cardano_ex_units_unref when it is no longer needed.
+ *
+ * \note This setting helps control resource usage and prevent excessive computational demand by any single transaction.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_ex_units_t* new_max_tx_ex_units = ...; // Assume new_max_tx_ex_units is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_tx_ex_units(protocol_params, new_max_tx_ex_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max transaction execution units set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set max transaction execution units.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_ex_units_unref(&new_max_tx_ex_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_tx_ex_units(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_ex_units_t*            max_tx_ex_units);
+
+/**
+ * \brief Sets the maximum execution units per block in the protocol parameters.
+ *
+ * This function sets the maximum execution units that can be consumed by all transactions in a single block,
+ * in the given \ref cardano_protocol_parameters_t object. Execution units represent computational resources
+ * (e.g., CPU and memory) required to run Plutus scripts. Setting a limit on the maximum execution units per block
+ * ensures that the blockchain remains performant and that no single block consumes excessive resources.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_block_ex_units A pointer to an initialized \ref cardano_ex_units_t object representing the maximum
+ *                               execution units allowed per block.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum block execution units were successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_ex_units_t object. The object must be
+ *       released by calling \ref cardano_ex_units_unref when it is no longer needed.
+ *
+ * \note Limiting execution units per block helps prevent any single block from consuming too much computational capacity,
+ *       ensuring that the blockchain remains balanced in its resource use.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_ex_units_t* new_max_block_ex_units = ...; // Assume new_max_block_ex_units is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_block_ex_units(protocol_params, new_max_block_ex_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max block execution units set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set max block execution units.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_ex_units_unref(&new_max_block_ex_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_block_ex_units(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_ex_units_t*            max_block_ex_units);
+
+/**
+ * \brief Sets the maximum size of a value in the protocol parameters.
+ *
+ * This function sets the maximum size, in bytes, of a value (such as assets or tokens) that can be included in a transaction output
+ * in the given \ref cardano_protocol_parameters_t object. Limiting the size of values helps prevent excessive data from being stored
+ * in a single transaction, promoting efficiency and scalability on the blockchain.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_value_size The new maximum size of a value, in bytes. This is an `int64_t` type.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum value size was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Setting a reasonable maximum value size ensures that no single transaction carries excessive data, helping the network
+ *       process transactions efficiently.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * int64_t new_max_value_size = 4000; // Set the maximum value size to 4000 bytes
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_value_size(protocol_params, new_max_value_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max value size set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set max value size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_value_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  int64_t                        max_value_size);
+
+/**
+ * \brief Sets the collateral percentage required for Plutus script transactions in the protocol parameters.
+ *
+ * This function sets the percentage of the transaction fee that must be provided as collateral in case the execution of
+ * a Plutus script fails. The collateral is used to cover the fees for the failed transaction, and setting a required percentage
+ * helps ensure the network remains secure and compensated for failed script executions.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] collateral_percentage The new collateral percentage, as a uint64_t. This percentage is relative to the transaction fees.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the collateral percentage was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Setting an appropriate collateral percentage ensures that script failures are adequately compensated without affecting
+ *       the network's integrity or transaction throughput.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_collateral_percentage = 150; // Set the collateral percentage to 150%
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_collateral_percentage(protocol_params, new_collateral_percentage);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Collateral percentage set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set collateral percentage.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_collateral_percentage(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       collateral_percentage);
+
+/**
+ * \brief Sets the maximum number of collateral inputs allowed in a Plutus script transaction.
+ *
+ * This function sets the maximum number of collateral inputs that can be provided in a single transaction involving Plutus scripts.
+ * Collateral inputs are required when executing Plutus scripts to cover potential costs in case the script fails.
+ * By limiting the number of collateral inputs, the protocol ensures that transactions remain efficient and do not consume excessive resources.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_collateral_inputs The new maximum number of collateral inputs allowed in a transaction.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum collateral inputs were successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Setting a maximum number of collateral inputs ensures that transactions using Plutus scripts remain within acceptable resource limits.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_max_collateral_inputs = 3; // Set the maximum collateral inputs to 3
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_collateral_inputs(protocol_params, new_max_collateral_inputs);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max collateral inputs set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set max collateral inputs.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_collateral_inputs(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_collateral_inputs);
+
+/**
+ * \brief Sets the pool voting thresholds in the protocol parameters.
+ *
+ * This function sets the pool voting thresholds in the given \ref cardano_protocol_parameters_t object.
+ * Pool voting thresholds define the minimum stake pool support required for certain governance actions, ensuring that
+ * changes to the protocol or other governance decisions have sufficient backing from stake pools before being accepted.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] pool_voting_thresholds A pointer to an initialized \ref cardano_pool_voting_thresholds_t object representing the new pool voting thresholds.
+ *                                   This value will replace any existing pool voting thresholds in the protocol parameters.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the pool voting thresholds were successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_pool_voting_thresholds_t object. The object must be
+ *       released by calling \ref cardano_pool_voting_thresholds_unref when it is no longer needed.
+ *
+ * \note Setting proper voting thresholds ensures that governance actions are backed by sufficient stake, maintaining the security and fairness of the system.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_pool_voting_thresholds_t* new_pool_voting_thresholds = ...; // Assume new_pool_voting_thresholds is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_pool_voting_thresholds(protocol_params, new_pool_voting_thresholds);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Pool voting thresholds set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set pool voting thresholds.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_pool_voting_thresholds_unref(&new_pool_voting_thresholds);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_pool_voting_thresholds(
+  cardano_protocol_parameters_t*    protocol_parameters,
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds);
+
+/**
+ * \brief Sets the DRep voting thresholds in the protocol parameters.
+ *
+ * This function sets the decentralized representative (DRep) voting thresholds in the given \ref cardano_protocol_parameters_t object.
+ * DRep voting thresholds define the minimum level of support required from decentralized representatives for specific governance actions
+ * to be accepted. These thresholds ensure that governance decisions are made with sufficient backing from the DReps.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] drep_voting_thresholds A pointer to an initialized \ref cardano_drep_voting_thresholds_t object representing the new DRep voting thresholds.
+ *                                   This value will replace any existing DRep voting thresholds in the protocol parameters.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the DRep voting thresholds were successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_drep_voting_thresholds_t object. The object must be
+ *       released by calling \ref cardano_drep_voting_thresholds_unref when it is no longer needed.
+ *
+ * \note Setting appropriate DRep voting thresholds ensures that governance decisions are backed by sufficient support from decentralized representatives,
+ *       promoting the fairness and security of the governance process.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_drep_voting_thresholds_t* new_drep_voting_thresholds = ...; // Assume new_drep_voting_thresholds is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_drep_voting_thresholds(protocol_params, new_drep_voting_thresholds);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DRep voting thresholds set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set DRep voting thresholds.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_drep_voting_thresholds_unref(&new_drep_voting_thresholds);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_drep_voting_thresholds(
+  cardano_protocol_parameters_t*    protocol_parameters,
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds);
+
+/**
+ * \brief Sets the minimum committee size in the protocol parameters.
+ *
+ * This function sets the minimum number of members required in a committee for governance actions in the
+ * \ref cardano_protocol_parameters_t object. Committees are responsible for making important governance decisions,
+ * and defining a minimum size ensures that decisions are made with enough participants, promoting fairness and representation.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] min_committee_size The minimum number of members required in a governance committee.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the minimum committee size was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Setting a minimum committee size ensures that governance decisions are made with sufficient representation,
+ *       preventing decisions from being made by too small a group.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_min_committee_size = 5; // Set the minimum committee size to 5 members
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_min_committee_size(protocol_params, new_min_committee_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Minimum committee size set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set minimum committee size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_min_committee_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       min_committee_size);
+
+/**
+ * \brief Sets the committee term limit in the protocol parameters.
+ *
+ * This function sets the maximum term limit for committee members in the given \ref cardano_protocol_parameters_t object.
+ * The term limit defines how long a committee member can serve before they are required to step down or be re-elected.
+ * Setting a term limit helps ensure regular turnover and prevents stagnation in governance roles.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] committee_term_limit The maximum term limit, in epochs, for a committee member.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the committee term limit was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Setting a term limit ensures that committee members serve for a limited period, encouraging fresh perspectives in governance.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_term_limit = 10; // Set the term limit to 10 epochs
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_committee_term_limit(protocol_params, new_term_limit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Committee term limit set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set committee term limit.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_committee_term_limit(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       committee_term_limit);
+
+/**
+ * \brief Sets the governance action validity period in the protocol parameters.
+ *
+ * This function sets the validity period for governance actions in the given \ref cardano_protocol_parameters_t object.
+ * The governance action validity period specifies the number of epochs during which a governance action is considered valid.
+ * After this period, the action will expire if not executed. This ensures that governance actions are timely and relevant.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] governance_action_validity_period The validity period, in epochs, for a governance action.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the governance action validity period was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Setting a reasonable validity period ensures that governance actions are handled in a timely manner, preventing outdated decisions.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_validity_period = 5; // Set the governance action validity period to 5 epochs
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_governance_action_validity_period(protocol_params, new_validity_period);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Governance action validity period set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set governance action validity period.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_governance_action_validity_period(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       governance_action_validity_period);
+
+/**
+ * \brief Sets the governance action deposit amount in the protocol parameters.
+ *
+ * This function sets the deposit required for submitting a governance action in the given \ref cardano_protocol_parameters_t object.
+ * The deposit serves as collateral to discourage spam submissions and ensure only serious proposals are submitted for governance consideration.
+ * If the governance action is successful, the deposit may be refunded; otherwise, it can be forfeited.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] governance_action_deposit The deposit amount, in lovelaces, required to submit a governance action.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the governance action deposit was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Setting an appropriate deposit amount discourages frivolous or spam submissions while promoting meaningful governance participation.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_deposit_amount = 5000000; // Set the governance action deposit to 5 ADA (5,000,000 lovelaces)
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_governance_action_deposit(protocol_params, new_deposit_amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Governance action deposit set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set governance action deposit.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_governance_action_deposit(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       governance_action_deposit);
+
+/**
+ * \brief Sets the DRep deposit amount in the protocol parameters.
+ *
+ * This function sets the deposit required for registering a decentralized representative (DRep) in the given \ref cardano_protocol_parameters_t object.
+ * The DRep deposit is a collateral mechanism to ensure that only serious participants register as decentralized representatives,
+ * contributing to the governance process. If the registration is successful, the deposit may be refunded; otherwise, it may be forfeited.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] drep_deposit The deposit amount, in lovelaces, required to register as a decentralized representative (DRep).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the DRep deposit was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Setting a reasonable DRep deposit ensures that only serious candidates participate in governance, helping maintain the integrity of the system.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_drep_deposit = 2000000; // Set the DRep deposit to 2 ADA (2,000,000 lovelaces)
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_drep_deposit(protocol_params, new_drep_deposit);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DRep deposit set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set DRep deposit.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_drep_deposit(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       drep_deposit);
+
+/**
+ * \brief Sets the DRep inactivity period in the protocol parameters.
+ *
+ * This function sets the inactivity period for decentralized representatives (DReps) in the given \ref cardano_protocol_parameters_t object.
+ * The inactivity period defines the number of epochs a DRep can remain inactive (i.e., not participate in governance votes)
+ * before their registration is considered invalid or they are required to take action to remain active.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] drep_inactivity_period The maximum number of epochs a DRep can remain inactive before their registration is affected.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the DRep inactivity period was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Setting a reasonable inactivity period ensures that DReps actively participate in governance processes, maintaining the health of the system.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_inactivity_period = 100; // Set the DRep inactivity period to 100 epochs
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_drep_inactivity_period(protocol_params, new_inactivity_period);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("DRep inactivity period set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set DRep inactivity period.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_drep_inactivity_period(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       drep_inactivity_period);
+
+/**
+ * \brief Sets the reference script cost per byte in the protocol parameters.
+ *
+ * This function sets the cost per byte for storing reference scripts in the given \ref cardano_protocol_parameters_t object.
+ * Reference scripts are stored on-chain, and this parameter determines the cost associated with each byte of a reference script,
+ * ensuring that resources are properly accounted for in transaction fees.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] ref_script_cost_per_byte A pointer to an initialized \ref cardano_unit_interval_t object representing the cost per byte of reference scripts.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the reference script cost per byte was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_unit_interval_t object. The object must be
+ *       released by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* ref_script_cost = ...; // Assume ref_script_cost is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_ref_script_cost_per_byte(protocol_params, ref_script_cost);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Reference script cost per byte set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set reference script cost per byte.\n");
+ * }
+ *
+ * // Clean up the ref_script_cost when no longer needed
+ * cardano_unit_interval_unref(&ref_script_cost);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_ref_script_cost_per_byte(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       ref_script_cost_per_byte);
+
+/**
+ * \brief Sets the maximum total reference script size per block in the protocol parameters.
+ *
+ * This function sets the maximum cumulative size, in bytes, of the reference scripts that a single block
+ * may use in the given \ref cardano_protocol_parameters_t object. On the wire this parameter is a 32-bit
+ * unsigned integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_ref_script_size_per_block The new maximum reference script size per block in bytes.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum reference script size per block was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_max_size = 1048576; // 1 MiB of reference scripts per block
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_ref_script_size_per_block(protocol_params, new_max_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max ref script size per block set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set max ref script size per block.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_ref_script_size_per_block(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_ref_script_size_per_block);
+
+/**
+ * \brief Sets the maximum total reference script size per transaction in the protocol parameters.
+ *
+ * This function sets the maximum cumulative size, in bytes, of the reference scripts that a single
+ * transaction may use in the given \ref cardano_protocol_parameters_t object. On the wire this parameter
+ * is a 32-bit unsigned integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_ref_script_size_per_tx The new maximum reference script size per transaction in bytes.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum reference script size per transaction was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_max_size = 204800; // 200 KiB of reference scripts per transaction
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_ref_script_size_per_tx(protocol_params, new_max_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max ref script size per tx set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set max ref script size per tx.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_ref_script_size_per_tx(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_ref_script_size_per_tx);
+
+/**
+ * \brief Sets the reference script cost stride in the protocol parameters.
+ *
+ * This function sets the size step, in bytes, at which the reference script fee tier increases in the
+ * given \ref cardano_protocol_parameters_t object. On the wire this parameter is a positive 32-bit
+ * unsigned integer; zero and values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] ref_script_cost_stride The new reference script cost stride in bytes. Must be greater than zero.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the reference script cost stride was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT if the
+ *         value is zero or does not fit in a 32-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_stride = 25600; // Fee tier grows every 25600 bytes
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_ref_script_cost_stride(protocol_params, new_stride);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Ref script cost stride set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set ref script cost stride.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_ref_script_cost_stride(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       ref_script_cost_stride);
+
+/**
+ * \brief Sets the reference script cost multiplier in the protocol parameters.
+ *
+ * This function sets the multiplier applied to the reference script fee at each cost stride in the
+ * given \ref cardano_protocol_parameters_t object. On the wire this parameter is a positive interval
+ * (a rational number); its value is expected to be greater than zero.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] ref_script_cost_multiplier A pointer to an initialized \ref cardano_unit_interval_t object representing the reference script cost multiplier,
+ *                                       or NULL to clear it.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the reference script cost multiplier was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_unit_interval_t object. The object must be
+ *       released by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* cost_multiplier = ...; // Assume cost_multiplier is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_ref_script_cost_multiplier(protocol_params, cost_multiplier);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Ref script cost multiplier set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set ref script cost multiplier.\n");
+ * }
+ *
+ * // Clean up the cost_multiplier when no longer needed
+ * cardano_unit_interval_unref(&cost_multiplier);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_ref_script_cost_multiplier(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       ref_script_cost_multiplier);
+
+/**
+ * \brief Sets the maximum pledge leverage in the protocol parameters.
+ *
+ * This function sets the maximum pledge leverage (CIP-50), the largest ratio of delegated stake to
+ * pledge that a stake pool may reach before its rewards are capped, in the given
+ * \ref cardano_protocol_parameters_t object. On the wire this parameter is a non-negative interval
+ * (a rational number, which may be greater than one) or nil when the leverage is unbounded.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_pledge_leverage A pointer to an initialized \ref cardano_unit_interval_t object representing the
+ *                                maximum pledge leverage, or NULL to mark the leverage as unbounded. Passing NULL
+ *                                releases any previously set value.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum pledge leverage was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_unit_interval_t object. The object must be
+ *       released by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* max_pledge_leverage = ...; // Assume max_pledge_leverage is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_pledge_leverage(protocol_params, max_pledge_leverage);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max pledge leverage set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set max pledge leverage.\n");
+ * }
+ *
+ * // Clean up the max_pledge_leverage when no longer needed
+ * cardano_unit_interval_unref(&max_pledge_leverage);
+ *
+ * // Mark the leverage as unbounded again
+ * result = cardano_protocol_parameters_set_max_pledge_leverage(protocol_params, NULL);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_pledge_leverage(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       max_pledge_leverage);
+
+/**
+ * \brief Sets the minimum pool margin in the protocol parameters.
+ *
+ * This function sets the minimum pool margin (CIP-23), the smallest share of the rewards a stake pool
+ * may keep for itself, in the given \ref cardano_protocol_parameters_t object. On the wire this
+ * parameter is a unit interval (a rational number between zero and one).
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] min_pool_margin A pointer to an initialized \ref cardano_unit_interval_t object representing the minimum pool margin.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the minimum pool margin was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_unit_interval_t object. The object must be
+ *       released by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* min_pool_margin = ...; // Assume min_pool_margin is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_min_pool_margin(protocol_params, min_pool_margin);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Min pool margin set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set min pool margin.\n");
+ * }
+ *
+ * // Clean up the min_pool_margin when no longer needed
+ * cardano_unit_interval_unref(&min_pool_margin);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_min_pool_margin(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       min_pool_margin);
+
+/**
+ * \brief Sets the Leios announcement period length in the protocol parameters.
+ *
+ * This function sets the length, in milliseconds, of the Leios announcement period, the window during which
+ * an endorser block is announced to the network before voting starts in the given
+ * \ref cardano_protocol_parameters_t object. On the wire this parameter is a 32-bit unsigned integer;
+ * values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] leios_announcement_period_length The new Leios announcement period length.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the Leios announcement period length was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 5000; // A five second announcement period
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_leios_announcement_period_length(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios announcement period length set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Leios announcement period length.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_leios_announcement_period_length(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       leios_announcement_period_length);
+
+/**
+ * \brief Sets the Leios vote period length in the protocol parameters.
+ *
+ * This function sets the length, in milliseconds, of the Leios vote period, the window during which the
+ * committee casts votes on an endorser block in the given \ref cardano_protocol_parameters_t object. On the
+ * wire this parameter is a 32-bit unsigned integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] leios_vote_period_length The new Leios vote period length.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the Leios vote period length was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 5000; // A five second vote period
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_leios_vote_period_length(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios vote period length set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Leios vote period length.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_leios_vote_period_length(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       leios_vote_period_length);
+
+/**
+ * \brief Sets the Leios diffusion period length in the protocol parameters.
+ *
+ * This function sets the length, in milliseconds, of the Leios diffusion period, the time allotted for an
+ * endorser block and its transactions to propagate through the network in the given
+ * \ref cardano_protocol_parameters_t object. On the wire this parameter is a 32-bit unsigned integer;
+ * values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] leios_diffusion_period_length The new Leios diffusion period length.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the Leios diffusion period length was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 10000; // A ten second diffusion period
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_leios_diffusion_period_length(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios diffusion period length set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Leios diffusion period length.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_leios_diffusion_period_length(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       leios_diffusion_period_length);
+
+/**
+ * \brief Sets the Leios committee size in the protocol parameters.
+ *
+ * This function sets the number of top-stake pools seated in the Leios voting committee for the epoch in
+ * the given \ref cardano_protocol_parameters_t object. On the wire this parameter is a 16-bit unsigned
+ * integer; values greater than \c UINT16_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] leios_committee_size The new Leios committee size.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the Leios committee size was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 16-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 500; // A committee of five hundred pools
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_leios_committee_size(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios committee size set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Leios committee size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_leios_committee_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       leios_committee_size);
+
+/**
+ * \brief Sets the Leios quorum stake threshold in the protocol parameters.
+ *
+ * This function sets the minimum fraction of the total active stake that the votes in a certificate must
+ * represent for an endorser block to be certified in the given \ref cardano_protocol_parameters_t object.
+ * On the wire this parameter is a unit interval (a rational number between zero and one).
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] leios_quorum_stake_threshold A pointer to an initialized \ref cardano_unit_interval_t object representing the quorum stake threshold.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the Leios quorum stake threshold was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_unit_interval_t object. The object must be
+ *       released by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* quorum = ...; // Assume quorum is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_leios_quorum_stake_threshold(protocol_params, quorum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Leios quorum stake threshold set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Leios quorum stake threshold.\n");
+ * }
+ *
+ * // Clean up the quorum when no longer needed
+ * cardano_unit_interval_unref(&quorum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_leios_quorum_stake_threshold(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       leios_quorum_stake_threshold);
+
+/**
+ * \brief Sets the maximum endorser block references size in the protocol parameters.
+ *
+ * This function sets the maximum size, in bytes, of the list of transaction references (a transaction hash
+ * and a transaction size per entry) that an endorser block itself carries in the given
+ * \ref cardano_protocol_parameters_t object. Since an endorser block references its transactions instead
+ * of embedding them, this limit caps the size of the endorser block when many small transactions are
+ * referenced. On the wire this parameter is a 32-bit unsigned integer; values greater than \c UINT32_MAX
+ * are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_endorser_block_references_size The new maximum endorser block references size.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum endorser block references size was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 1048576; // 1 MiB of references per endorser block
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_endorser_block_references_size(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum endorser block references size set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set maximum endorser block references size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_endorser_block_references_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_endorser_block_references_size);
+
+/**
+ * \brief Sets the maximum endorser block transactions size in the protocol parameters.
+ *
+ * This function sets the maximum total size, in bytes, of the transactions carried by a single endorser
+ * block in the given \ref cardano_protocol_parameters_t object. On the wire this parameter is a 32-bit
+ * unsigned integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_endorser_block_txs_size The new maximum endorser block transactions size.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum endorser block transactions size was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 4194304; // 4 MiB of transactions per endorser block
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_endorser_block_txs_size(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum endorser block transactions size set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set maximum endorser block transactions size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_endorser_block_txs_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_endorser_block_txs_size);
+
+/**
+ * \brief Sets the maximum endorser block execution units in the protocol parameters.
+ *
+ * This function sets the maximum execution units (CPU and memory) that the Plutus scripts of a single
+ * endorser block may consume in total in the given \ref cardano_protocol_parameters_t object.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_endorser_block_execution_units A pointer to an initialized \ref cardano_ex_units_t object
+ *                                                representing the maximum execution units for an endorser
+ *                                                block.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum endorser block execution units were successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_ex_units_t object. The object must be
+ *       released by calling \ref cardano_ex_units_unref when it is no longer needed.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_ex_units_t* max_ex_units = ...; // Assume max_ex_units is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_endorser_block_execution_units(protocol_params, max_ex_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Max endorser block execution units set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set max endorser block execution units.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_ex_units_unref(&max_ex_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_endorser_block_execution_units(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_ex_units_t*            max_endorser_block_execution_units);
+
+/**
+ * \brief Sets the maximum reference script size per endorser block in the protocol parameters.
+ *
+ * This function sets the maximum cumulative size, in bytes, of the reference scripts that the transactions
+ * of a single endorser block may use in the given \ref cardano_protocol_parameters_t object. On the wire
+ * this parameter is a 32-bit unsigned integer; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] max_ref_script_size_per_endorser_block The new maximum reference script size per endorser block.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the maximum reference script size per endorser block was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * \note The Leios parameters (CIP-164) configure the endorser block pipeline that carries transactions
+ *       beyond the capacity of the ranking blocks alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 1048576; // 1 MiB of reference scripts per endorser block
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_max_ref_script_size_per_endorser_block(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Maximum reference script size per endorser block set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set maximum reference script size per endorser block.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_max_ref_script_size_per_endorser_block(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_ref_script_size_per_endorser_block);
+
+/**
+ * \brief Sets the Peras minimum candidate block age in the protocol parameters.
+ *
+ * This function sets the minimum age, in slots, that a block must reach before it becomes eligible for
+ * voting in a Peras round in the given \ref cardano_protocol_parameters_t object. On the wire this parameter
+ * is a slot interval (a 32-bit unsigned integer); values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] peras_min_candidate_block_age The new Peras minimum candidate block age, in slots.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the Peras minimum candidate block age was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 30; // Blocks become candidates thirty slots after they are forged
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_peras_min_candidate_block_age(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras minimum candidate block age set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Peras minimum candidate block age.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_peras_min_candidate_block_age(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       peras_min_candidate_block_age);
+
+/**
+ * \brief Sets the Peras healing factor in the protocol parameters.
+ *
+ * This function sets the healing time coefficient used to derive the length of the Peras cooldown period
+ * in the given \ref cardano_protocol_parameters_t object. On the wire this parameter is a positive interval
+ * (a rational number); its value is expected to be greater than zero.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] peras_healing_factor A pointer to an initialized \ref cardano_unit_interval_t object representing the Peras healing factor,
+ *                                 or NULL to clear it.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the Peras healing factor was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_unit_interval_t object. The object must be
+ *       released by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* healing_factor = ...; // Assume healing_factor is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_peras_healing_factor(protocol_params, healing_factor);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras healing factor set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Peras healing factor.\n");
+ * }
+ *
+ * // Clean up the healing_factor when no longer needed
+ * cardano_unit_interval_unref(&healing_factor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_peras_healing_factor(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       peras_healing_factor);
+
+/**
+ * \brief Sets the Peras certificate boost in the protocol parameters.
+ *
+ * This function sets the extra chain weight that a Peras certificate gives to the block it boosts in the
+ * given \ref cardano_protocol_parameters_t object. On the wire this parameter is a 16-bit unsigned integer;
+ * values greater than \c UINT16_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] peras_cert_boost The new Peras certificate boost.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the Peras certificate boost was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 16-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 15; // A certificate adds the weight of fifteen blocks
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_peras_cert_boost(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras certificate boost set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Peras certificate boost.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_peras_cert_boost(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       peras_cert_boost);
+
+/**
+ * \brief Sets the Peras target committee size in the protocol parameters.
+ *
+ * This function sets the target number of voters seated in the Peras voting committee in the given
+ * \ref cardano_protocol_parameters_t object. On the wire this parameter is a 16-bit unsigned integer;
+ * values greater than \c UINT16_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] peras_target_committee_size The new Peras target committee size.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the Peras target committee size was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 16-bit unsigned integer, or an appropriate error code if an error occurred.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 500; // A committee of five hundred voters
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_peras_target_committee_size(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras target committee size set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Peras target committee size.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_peras_target_committee_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       peras_target_committee_size);
+
+/**
+ * \brief Sets the Peras bootstrap round in the protocol parameters.
+ *
+ * This function sets the round number used to manually bootstrap Peras voting at a specific time in the
+ * given \ref cardano_protocol_parameters_t object. On the wire this parameter is a 32-bit unsigned integer
+ * or nil when no bootstrap round is scheduled; values greater than \c UINT32_MAX are rejected.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] peras_bootstrap_round A pointer to the new Peras bootstrap round, or NULL to mark that no
+ *                                  bootstrap round is scheduled. The value is copied, so the pointer does not
+ *                                  need to outlive the call.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the Peras bootstrap round was successfully set, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if the value does not fit in a 32-bit unsigned integer, or an appropriate error code if an error occurred.
+ *         When the value is rejected, the previous bootstrap round is kept.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t bootstrap_round = 1200;
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_peras_bootstrap_round(protocol_params, &bootstrap_round);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras bootstrap round set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Peras bootstrap round.\n");
+ * }
+ *
+ * // Mark that no bootstrap round is scheduled
+ * result = cardano_protocol_parameters_set_peras_bootstrap_round(protocol_params, NULL);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_peras_bootstrap_round(
+  cardano_protocol_parameters_t* protocol_parameters,
+  const uint64_t*                peras_bootstrap_round);
+
+/**
+ * \brief Sets the Peras quorum threshold safety margin in the protocol parameters.
+ *
+ * This function sets the extra safety margin added on top of the 75% baseline of the Peras quorum threshold
+ * in the given \ref cardano_protocol_parameters_t object. On the wire this parameter is a unit interval
+ * (a rational number between zero and one); the ledger expects it to be between 0 and 0.25, inclusive.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] peras_quorum_threshold_safety_margin A pointer to an initialized \ref cardano_unit_interval_t object representing
+ *                                                 the quorum threshold safety margin.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the Peras quorum threshold safety margin was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of the \ref cardano_unit_interval_t object. The object must be
+ *       released by calling \ref cardano_unit_interval_unref when it is no longer needed.
+ *
+ * \note The Peras parameters configure the voting protocol that certifies recent blocks and boosts the
+ *       weight of the chains carrying them, giving faster settlement than the Praos chain growth alone.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * cardano_unit_interval_t* safety_margin = ...; // Assume safety_margin is initialized
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_peras_quorum_threshold_safety_margin(protocol_params, safety_margin);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Peras quorum threshold safety margin set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Peras quorum threshold safety margin.\n");
+ * }
+ *
+ * // Clean up the safety_margin when no longer needed
+ * cardano_unit_interval_unref(&safety_margin);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_peras_quorum_threshold_safety_margin(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       peras_quorum_threshold_safety_margin);
+
+/**
+ * \brief Sets the reference inputs cost per multi-asset byte in the protocol parameters.
+ *
+ * This function sets the fee, in lovelaces, charged for every multi-asset byte present in the values of
+ * the reference inputs of a transaction in the given \ref cardano_protocol_parameters_t object. On the wire
+ * this parameter is a coin amount.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] ref_inputs_cost_per_multi_asset_byte The new reference inputs cost per multi-asset byte, in lovelaces.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the reference inputs cost per multi-asset byte was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Reading large amounts of data from disk becomes a bottleneck once the ledger state is stored on
+ *       disk, so this fee acts as a monetary deterrent against it. The ledger does not charge it yet, and
+ *       the fee functions of this library do not take it into account.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 1000; // 1000 lovelaces per multi-asset byte
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_ref_inputs_cost_per_multi_asset_byte(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Reference inputs cost per multi-asset byte set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set reference inputs cost per multi-asset byte.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_ref_inputs_cost_per_multi_asset_byte(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       ref_inputs_cost_per_multi_asset_byte);
+
+/**
+ * \brief Sets the reference inputs cost per datum byte in the protocol parameters.
+ *
+ * This function sets the fee, in lovelaces, charged per byte of the datums attached to the reference inputs
+ * of a transaction in the given \ref cardano_protocol_parameters_t object. On the wire this parameter is a
+ * coin amount per byte.
+ *
+ * \param[in,out] protocol_parameters A pointer to an initialized \ref cardano_protocol_parameters_t object.
+ *                                    This parameter must not be NULL.
+ * \param[in] ref_inputs_cost_per_datum_byte The new reference inputs cost per datum byte, in lovelaces.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the reference inputs cost per datum byte was successfully set, or an appropriate error code if an error occurred.
+ *
+ * \note Reading large amounts of data from disk becomes a bottleneck once the ledger state is stored on
+ *       disk, so this fee acts as a monetary deterrent against it. The ledger does not charge it yet, and
+ *       the fee functions of this library do not take it into account.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...; // Assume protocol_params is initialized
+ * uint64_t new_value = 10; // 10 lovelaces per datum byte
+ *
+ * cardano_error_t result = cardano_protocol_parameters_set_ref_inputs_cost_per_datum_byte(protocol_params, new_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Reference inputs cost per datum byte set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set reference inputs cost per datum byte.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_ref_inputs_cost_per_datum_byte(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       ref_inputs_cost_per_datum_byte);
+
+/**
+ * \brief Decrements the reference count of a cardano_protocol_parameters_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_protocol_parameters_t object
+ * by decreasing its reference count. When the reference count reaches zero, the protocol_parameters is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] protocol_parameters A pointer to the pointer of the protocol_parameters object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_parameters = cardano_protocol_parameters_new(major, minor);
+ *
+ * // Perform operations with the protocol_parameters...
+ *
+ * cardano_protocol_parameters_unref(&protocol_parameters);
+ * // At this point, protocol_parameters is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_protocol_parameters_unref, the pointer to the \ref cardano_protocol_parameters_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_protocol_parameters_unref(cardano_protocol_parameters_t** protocol_parameters);
+
+/**
+ * \brief Increases the reference count of the cardano_protocol_parameters_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_protocol_parameters_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_protocol_parameters_unref.
+ *
+ * \param protocol_parameters A pointer to the cardano_protocol_parameters_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming protocol_parameters is a previously created protocol_parameters object
+ *
+ * cardano_protocol_parameters_ref(protocol_parameters);
+ *
+ * // Now protocol_parameters can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_protocol_parameters_ref there is a corresponding
+ * call to \ref cardano_protocol_parameters_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_protocol_parameters_ref(cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_protocol_parameters_t object.
+ *
+ * This function returns the number of active references to an cardano_protocol_parameters_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_protocol_parameters_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param protocol_parameters A pointer to the cardano_protocol_parameters_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_protocol_parameters_t object. If the object
+ * is properly managed (i.e., every \ref cardano_protocol_parameters_ref call is matched with a
+ * \ref cardano_protocol_parameters_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming protocol_parameters is a previously created protocol_parameters object
+ *
+ * size_t ref_count = cardano_protocol_parameters_refcount(protocol_parameters);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_protocol_parameters_refcount(const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Sets the last error message for a given cardano_protocol_parameters_t object.
+ *
+ * Records an error message in the protocol_parameters's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] protocol_parameters A pointer to the \ref cardano_protocol_parameters_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the protocol_parameters's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_protocol_parameters_set_last_error(
+  cardano_protocol_parameters_t* protocol_parameters,
+  const char*                    message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific protocol_parameters.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_protocol_parameters_set_last_error for the given
+ * protocol_parameters. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] protocol_parameters A pointer to the \ref cardano_protocol_parameters_t instance whose last error
+ *                   message is to be retrieved. If the protocol_parameters is NULL, the function
+ *                   returns a generic error message indicating the null protocol_parameters.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified protocol_parameters. If the protocol_parameters is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_protocol_parameters_set_last_error for the same protocol_parameters, or until
+ *       the protocol_parameters is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_protocol_parameters_get_last_error(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_protocol_parameters_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_protocol_parameters_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_protocol_parameters_deep_clone(const cardano_protocol_parameters_t* source, cardano_protocol_parameters_t** clone);
+
+/**
+ * \brief Compatibility alias for \ref cardano_protocol_parameters_get_ref_inputs_cost_per_multi_asset_byte.
+ * \deprecated Use the per-byte name; parameter 55 measures multi-asset byte overhead.
+ */
+CARDANO_EXPORT uint64_t cardano_protocol_parameters_get_ref_inputs_cost_per_multi_asset_policy(
+  const cardano_protocol_parameters_t* protocol_parameters);
+
+/**
+ * \brief Compatibility alias for \ref cardano_protocol_parameters_set_ref_inputs_cost_per_multi_asset_byte.
+ * \deprecated Use the per-byte name; parameter 55 measures multi-asset byte overhead.
+ */
+CARDANO_EXPORT cardano_error_t cardano_protocol_parameters_set_ref_inputs_cost_per_multi_asset_policy(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       ref_inputs_cost_per_multi_asset_policy);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PROTOCOL_PARAMETERS_H
diff --git a/vendor/include/cardano/protocol_params/update.h b/vendor/include/cardano/protocol_params/update.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/protocol_params/update.h
@@ -0,0 +1,484 @@
+/**
+ * \file update.h
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPDATE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPDATE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/protocol_params/proposed_param_updates.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief When stakeholders wish to propose changes to the system's parameters, they submit an update proposal.
+ * Such proposals are then voted on by the community. If approved, the protocol parameters are adjusted
+ * accordingly in the specified epoch.
+ */
+typedef struct cardano_update_t cardano_update_t;
+
+/**
+ * \brief Creates and initializes a new instance of the update.
+ *
+ * This function allocates and initializes a new instance of the update,
+ * representing an update proposal for the Cardano protocol.
+ *
+ * \param[in] epoch The epoch number in which the proposal will come into effect if accepted.
+ * \param[in] updates A pointer to the proposed protocol parameter updates.
+ * \param[out] update On successful initialization, this will point to a newly created
+ *            update object. This object represents a "strong reference",
+ *            meaning that it is fully initialized and ready for use.
+ *            The caller is responsible for managing the lifecycle of this object.
+ *            Specifically, once the update is no longer needed, the caller must release it
+ *            by calling \ref cardano_update_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the update was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_t* update = NULL;
+ * uint64_t epoch = 123; // Example epoch number
+ * cardano_proposed_param_updates_t* proposed_updates = NULL;
+ *
+ * // Initialize proposed_updates properly before using
+ *
+ * // Attempt to create a new update object
+ * cardano_error_t result = cardano_update_new(epoch, proposed_updates, &update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the update
+ *
+ *   // Once done, ensure to clean up and release the update
+ *   cardano_update_unref(&update);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_new(
+  uint64_t                          epoch,
+  cardano_proposed_param_updates_t* updates,
+  cardano_update_t**                update);
+
+/**
+ * \brief Creates a \ref cardano_update_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_update_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a update.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] update A pointer to a pointer of \ref cardano_update_t that will be set to the address
+ *                        of the newly created update object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the object was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_update_t object by calling
+ *       \ref cardano_update_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_update_t* update = NULL;
+ *
+ * cardano_error_t result = cardano_update_from_cbor(reader, &update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the update
+ *
+ *   // Once done, ensure to clean up and release the update
+ *   cardano_update_unref(&update);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode update: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_update_from_cbor(cardano_cbor_reader_t* reader, cardano_update_t** update);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_update_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] update A constant pointer to the \ref cardano_update_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p update or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_t* update = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_update_to_cbor(update, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_update_unref(&update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_update_to_cbor(
+  const cardano_update_t* update,
+  cardano_cbor_writer_t*  writer);
+
+/**
+ * \brief Serializes an update to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "epoch", "proposed_protocol_parameter_updates".
+ *
+ * \param[in]  update  Pointer to a valid \ref cardano_update_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p update or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_update_to_cip116_json(
+  const cardano_update_t* update,
+  cardano_json_writer_t*  writer);
+
+/**
+ * \brief Retrieves the epoch number from the update.
+ *
+ * This function returns the epoch number in which the proposal will come into effect if accepted.
+ *
+ * \param[in] update Pointer to the update object.
+ * \param[out] epoch On successful retrieval, this will point to the epoch number.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the epoch number was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_t* update = NULL;
+ * uint64_t epoch = 0;
+ *
+ * // Assume update is initialized properly
+ *
+ * cardano_error_t result = cardano_update_get_epoch(update, &epoch);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Epoch: %lu\n", epoch);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_update_get_epoch(
+  const cardano_update_t* update,
+  uint64_t*               epoch);
+
+/**
+ * \brief Retrieves the proposed parameters from the update.
+ *
+ * This function returns the proposed protocol parameter updates from the update object.
+ *
+ * \param[in] update Pointer to the update object.
+ * \param[out] proposed_parameters On successful retrieval, this will point to the proposed protocol parameter updates.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the proposed parameters were successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_t* update = NULL;
+ * cardano_proposed_param_updates_t* proposed_parameters = NULL;
+ *
+ * // Assume update is initialized properly
+ *
+ * cardano_error_t result = cardano_update_get_proposed_parameters(update, &proposed_parameters);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the proposed_parameters
+ *
+ *   // Once done, ensure to clean up and release the proposed_parameters
+ *   cardano_proposed_param_updates_unref(&proposed_parameters);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_update_get_proposed_parameters(
+  const cardano_update_t*            update,
+  cardano_proposed_param_updates_t** proposed_parameters);
+
+/**
+ * \brief Sets the epoch in the update object.
+ *
+ * This function sets the epoch in the given update object, specifying when the proposed
+ * protocol parameter updates will take effect if accepted.
+ *
+ * \param[in] update Pointer to the update object.
+ * \param[in] epoch The epoch number to set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the epoch was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_t* update = NULL;
+ * uint64_t epoch = 300; // Example epoch number
+ *
+ * // Assume update is initialized properly
+ *
+ * cardano_error_t result = cardano_update_set_epoch(update, epoch);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The epoch has been successfully set
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_update_set_epoch(
+  cardano_update_t* update,
+  uint64_t          epoch);
+
+/**
+ * \brief Sets the proposed protocol parameters in the update object.
+ *
+ * This function sets the proposed protocol parameter updates in the given update object.
+ * These parameters will take effect in the specified epoch if the proposal is accepted.
+ *
+ * \param[in] update Pointer to the update object.
+ * \param[in] proposed_parameters Pointer to the proposed protocol parameter updates to set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the proposed parameters were successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_t* update = NULL;
+ * cardano_proposed_param_updates_t* proposed_parameters = NULL;
+ *
+ * // Assume update and proposed_parameters are initialized properly
+ *
+ * cardano_error_t result = cardano_update_set_proposed_parameters(update, proposed_parameters);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The proposed parameters have been successfully set
+ * }
+ *
+ * // Clean up
+ * cardano_update_unref(&update);
+ * cardano_proposed_param_updates_unref(&proposed_parameters);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_update_set_proposed_parameters(
+  cardano_update_t*                 update,
+  cardano_proposed_param_updates_t* proposed_parameters);
+
+/**
+ * \brief Decrements the reference count of a cardano_update_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_update_t object
+ * by decreasing its reference count. When the reference count reaches zero, the update is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] update A pointer to the pointer of the update object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_update_t* update = cardano_update_new(major, minor);
+ *
+ * // Perform operations with the update...
+ *
+ * cardano_update_unref(&update);
+ * // At this point, update is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_update_unref, the pointer to the \ref cardano_update_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_update_unref(cardano_update_t** update);
+
+/**
+ * \brief Increases the reference count of the cardano_update_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_update_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_update_unref.
+ *
+ * \param update A pointer to the cardano_update_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming update is a previously created update object
+ *
+ * cardano_update_ref(update);
+ *
+ * // Now update can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_update_ref there is a corresponding
+ * call to \ref cardano_update_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_update_ref(cardano_update_t* update);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_update_t object.
+ *
+ * This function returns the number of active references to an cardano_update_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_update_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param update A pointer to the cardano_update_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_update_t object. If the object
+ * is properly managed (i.e., every \ref cardano_update_ref call is matched with a
+ * \ref cardano_update_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming update is a previously created update object
+ *
+ * size_t ref_count = cardano_update_refcount(update);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_update_refcount(const cardano_update_t* update);
+
+/**
+ * \brief Sets the last error message for a given cardano_update_t object.
+ *
+ * Records an error message in the update's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] update A pointer to the \ref cardano_update_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the update's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_update_set_last_error(
+  cardano_update_t* update,
+  const char*       message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific update.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_update_set_last_error for the given
+ * update. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] update A pointer to the \ref cardano_update_t instance whose last error
+ *                   message is to be retrieved. If the update is NULL, the function
+ *                   returns a generic error message indicating the null update.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified update. If the update is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_update_set_last_error for the same update, or until
+ *       the update is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_update_get_last_error(
+  const cardano_update_t* update);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_update_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_update_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_update_deep_clone(const cardano_update_t* source, cardano_update_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_UPDATE_H
diff --git a/vendor/include/cardano/providers/provider.h b/vendor/include/cardano/providers/provider.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/providers/provider.h
@@ -0,0 +1,741 @@
+/**
+ * \file provider.h
+ *
+ * \author angel.castillo
+ * \date   Sep 27, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PROVIDER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PROVIDER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+#include <cardano/providers/provider_impl.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Opaque structure representing a Cardano blockchain data provider instance.
+ *
+ * This structure serves as a handle to a Cardano provider, encapsulating the necessary context and
+ * state required to interact with the Cardano blockchain.
+ */
+typedef struct cardano_provider_t cardano_provider_t;
+
+/**
+ * \brief Creates a new `cardano_provider_t` object using the provided implementation.
+ *
+ * This function initializes a new \ref cardano_provider_t object by wrapping the given
+ * \ref cardano_provider_impl_t implementation. The newly created provider object manages
+ * the lifecycle of the underlying implementation and provides an interface for interacting
+ * with the Cardano blockchain functionalities.
+ *
+ * \param[in]  impl     The provider implementation containing function pointers and context.
+ * \param[out] provider A pointer to store the address of the newly created provider object.
+ *                      This should be a valid pointer to a \ref cardano_provider_t* variable.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume 'impl' is a valid cardano_provider_impl_t initialized elsewhere.
+ * cardano_provider_t* provider = NULL;
+ * cardano_error_t result = cardano_provider_new(impl, &provider);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the provider
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // When done with the provider
+ * cardano_provider_unref(&provider);
+ * \endcode
+ *
+ * \note After successfully creating a \ref cardano_provider_t object, you are responsible for
+ *       managing its lifecycle. Ensure that you call \ref cardano_provider_unref when the
+ *       provider is no longer needed to release resources and prevent memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_provider_new(cardano_provider_impl_t impl, cardano_provider_t** provider);
+
+/**
+ * \brief Retrieves the name of the provider implementation.
+ *
+ * This function returns a constant string representing the name of the provider implementation.
+ * The name can be used for logging, debugging, or informational purposes to identify which
+ * provider implementation is being used.
+ *
+ * \param[in] provider Pointer to the \ref cardano_provider_t object.
+ *
+ * \returns A constant character pointer to the provider's name string.
+ *          The returned string is owned by the provider and must not be modified or freed by the caller.
+ *          If the \p provider is NULL or invalid, the function may return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* provider_name = cardano_provider_get_name(provider);
+ *
+ * if (provider_name)
+ * {
+ *   printf("Using provider: %s\n", provider_name);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve provider name.\n");
+ * }
+ * \endcode
+ *
+ * \note The returned string remains valid as long as the \ref cardano_provider_t object is valid.
+ *       Do not attempt to modify or free the returned string.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_provider_get_name(const cardano_provider_t* provider);
+
+/**
+ * \brief Retrieves the network magic associated with a provider.
+ *
+ * This function returns the network magic value for the specified Cardano provider (`cardano_provider_t`).
+ *
+ * \param[in] provider A constant pointer to the \ref cardano_provider_t instance from which to retrieve the network magic.
+ *
+ * \returns The network magic value (\ref cardano_network_magic_t) associated with the provider.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_provider_t* provider = ...;  // Initialized provider
+ * cardano_network_magic_t network_magic = cardano_provider_get_network_magic(provider);
+ *
+ * printf("Network magic: %u\n", network_magic);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_network_magic_t
+cardano_provider_get_network_magic(const cardano_provider_t* provider);
+
+/**
+ * \brief Retrieves the current protocol parameters from the Cardano blockchain.
+ *
+ * This function obtains the protocol parameters using the specified provider instance.
+ * The protocol parameters include important configuration details of the Cardano network,
+ * such as parameters to compute fees, maximum block sizes, and other protocol-related settings.
+ *
+ * \param[in]  provider   Pointer to the \ref cardano_provider_t instance.
+ *                        Must not be `NULL`.
+ * \param[out] parameters Pointer to a location where the function will store a pointer
+ *                        to the retrieved \ref cardano_protocol_parameters_t structure.
+ *                        This parameter must not be `NULL`. On success, the caller is
+ *                        responsible for freeing the returned \ref cardano_protocol_parameters_t
+ *                        object using the \ref cardano_protocol_parameters_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - \ref CARDANO_SUCCESS on success.
+ *          - An appropriate error code on failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* parameters = NULL;
+ * cardano_error_t result = cardano_provider_get_parameters(provider, &parameters);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the parameters
+ *   // ...
+ *   // When done, free the parameters
+ *   cardano_protocol_parameters_unref(parameters);
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_provider_unref(&provider);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_provider_get_parameters(cardano_provider_t* provider, cardano_protocol_parameters_t** parameters);
+
+/**
+ * \brief Retrieves unspent transaction outputs (UTXOs) for a given address.
+ *
+ * This function obtains a list of unspent transaction outputs (UTXOs) associated with the specified
+ * address using the provided Cardano provider instance. UTXOs represent funds that can be used as
+ * inputs in new transactions. Retrieving UTXOs is essential for constructing transactions and
+ * managing balances.
+ *
+ * \param[in]  provider  Pointer to the \ref cardano_provider_t instance.
+ *                       Must not be `NULL`.
+ * \param[in]  address   Pointer to a \ref cardano_address_t representing the address for which
+ *                       to retrieve unspent outputs. Must not be `NULL`.
+ * \param[out] utxo_list Pointer to a location where the function will store a pointer to the
+ *                       retrieved \ref cardano_utxo_list_t structure. Must not be `NULL`. On success,
+ *                       the caller is responsible for freeing the returned \ref cardano_utxo_list_t
+ *                       object using the \ref cardano_utxo_list_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - \ref CARDANO_SUCCESS on success.
+ *          - An appropriate error code on failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* utxo_list = NULL;
+ * cardano_error_t result = cardano_provider_get_unspent_outputs(provider, address, &utxo_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Iterate over the UTXOs
+ *   size_t utxo_count = cardano_utxo_list_length(utxo_list);
+ *
+ *   for (size_t i = 0U; i < utxo_count; ++i)
+ *   {
+ *     // Process the UTXOs
+ *     // ...
+ *   }
+ *   // When done, free the UTXO list
+ *   cardano_utxo_list_unref(utxo_list);
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_provider_unref(&provider);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_provider_get_unspent_outputs(
+  cardano_provider_t*   provider,
+  cardano_address_t*    address,
+  cardano_utxo_list_t** utxo_list);
+
+/**
+ * \brief Retrieves the staking rewards for a given address.
+ *
+ * This function obtains the current available staking rewards associated with the specified address.
+ * It uses the provided Cardano provider instance to access blockchain data and retrieve
+ * the reward balance for the address. Staking rewards are accumulated for addresses that
+ * delegate their stake to a stake pool.
+ *
+ * \param[in]  provider Pointer to the \ref cardano_provider_t instance.
+ *                      Must not be `NULL`.
+ * \param[in]  address  Pointer to a \ref cardano_address_t representing the address
+ *                      for which to retrieve staking rewards. Must not be `NULL`.
+ * \param[out] rewards  Pointer to a `uint64_t` variable where the function will store
+ *                      the amount of rewards (in Lovelace). Must not be `NULL`.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - Other error codes for provider-specific failures.
+ *
+ * Example:
+ * \code{.c}
+ * uint64_t rewards = 0;
+ *
+ * cardano_error_t result = cardano_provider_get_rewards_available(provider, address, &rewards)
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the rewards value
+ *   printf("Rewards: %ul Lovelace\n", rewards);
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_provider_unref(&provider);
+ *
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_provider_get_rewards_available(cardano_provider_t* provider, cardano_reward_address_t* address, uint64_t* rewards);
+
+/**
+ * \brief Retrieves unspent transaction outputs (UTXOs) for a given address that contain a specific asset.
+ *
+ * This function obtains a list of unspent transaction outputs (UTXOs) associated with the specified
+ * address that contain the specified asset. It uses the provided Cardano provider instance to access
+ * the blockchain data. UTXOs represent funds that can be used as inputs in new transactions.
+ *
+ * \param[in]  provider  Pointer to the \ref cardano_provider_t instance.
+ *                       Must not be `NULL`.
+ * \param[in]  address   Pointer to a \ref cardano_address_t representing the address for which
+ *                       to retrieve unspent outputs. Must not be `NULL`.
+ * \param[in]  asset_id  Pointer to a \ref cardano_asset_id_t representing the asset identifier
+ *                       used to filter the UTXOs. Must not be `NULL`.
+ * \param[out] utxo_list Pointer to a location where the function will store a pointer to the
+ *                       retrieved \ref cardano_utxo_list_t structure containing UTXOs that include
+ *                       the specified asset. Must not be `NULL`. On success, the caller is responsible
+ *                       for freeing the returned \ref cardano_utxo_list_t object using the \ref cardano_utxo_list_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - \ref CARDANO_SUCCESS on success.
+ *          - Other error codes for provider-specific failures.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* utxo_list = NULL;
+ * cardano_error_t result = cardano_provider_get_unspent_outputs_with_asset(provider, address, asset_id, &utxo_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Iterate over the UTXOs
+ *   size_t utxo_count = cardano_utxo_list_length(utxo_list);
+ *
+ *   for (size_t i = 0U; i < utxo_count; ++i)
+ *   {
+ *     // Process the UTXO
+ *     // ...
+ *   }
+ *
+ *   // When done, free the UTXO list
+ *   cardano_utxo_list_unref(utxo_list);
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_provider_unref(&provider);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_provider_get_unspent_outputs_with_asset(
+  cardano_provider_t*   provider,
+  cardano_address_t*    address,
+  cardano_asset_id_t*   asset_id,
+  cardano_utxo_list_t** utxo_list);
+
+/**
+ * \brief Retrieves an unspent transaction output (UTXO) containing a specific Non-Fungible Token (NFT).
+ *
+ * This function obtains a UTXO that contains the specified NFT (Non-Fungible Token) identified by the given asset ID.
+ * It uses the provided Cardano provider instance to access the blockchain data.
+ *
+ * \param[in]  provider Pointer to the \ref cardano_provider_t instance.
+ *                      Must not be `NULL`.
+ * \param[in]  asset_id Pointer to a \ref cardano_asset_id_t representing the asset identifier of the NFT.
+ *                      Must not be `NULL`.
+ * \param[out] utxo     Pointer to a location where the function will store a pointer to the retrieved
+ *                      \ref cardano_utxo_t structure containing the NFT. Must not be `NULL`.
+ *                      On success, the caller is responsible for freeing the returned \ref cardano_utxo_t
+ *                      object using the \ref cardano_utxo_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - \ref CARDANO_SUCCESS on success.
+ *          - Other error codes for provider-specific failures.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_t* utxo = NULL;
+ * cardano_error_t result = cardano_provider_get_unspent_output_by_nft(provider, asset_id, &utxo);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the UTXO containing the NFT
+ *   // ...
+ *   // When done, free the UTXO
+ *   cardano_utxo_unref(utxo);
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_provider_unref(&provider);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_provider_get_unspent_output_by_nft(
+  cardano_provider_t* provider,
+  cardano_asset_id_t* asset_id,
+  cardano_utxo_t**    utxo);
+
+/**
+ * \brief Resolves unspent transaction outputs (UTXOs) for given transaction inputs.
+ *
+ * This function obtains the unspent transaction outputs (UTXOs) corresponding to the specified
+ * set of transaction inputs. It uses the provided Cardano provider instance to access the blockchain
+ * data.
+ *
+ * \param[in]  provider  Pointer to the \ref cardano_provider_t instance.
+ *                       Must not be `NULL`.
+ * \param[in]  tx_ins    Pointer to a \ref cardano_transaction_input_set_t containing the set of
+ *                       transaction inputs to resolve. Must not be `NULL`.
+ * \param[out] utxo_list Pointer to a location where the function will store a pointer to the
+ *                       retrieved \ref cardano_utxo_list_t structure containing the resolved UTXOs.
+ *                       Must not be `NULL`. On success, the caller is responsible for freeing the
+ *                       returned \ref cardano_utxo_list_t object using the \ref cardano_utxo_list_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - Other error codes for provider-specific failures.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* utxo_list = NULL;
+ * cardano_error_t result = cardano_provider_resolve_unspent_outputs(provider, tx_ins, &utxo_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Iterate over the resolved UTXOs
+ *   size_t utxo_count = cardano_utxo_list_length(utxo_list);
+ *
+ *   for (size_t i = 0; i < utxo_count; ++i)
+ *   {
+ *     // Process the UTXO
+ *     // ...
+ *   }
+ *
+ *   // When done, free the UTXO list
+ *   cardano_utxo_list_unref(utxo_list);
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_provider_unref(&provider);
+ * \endcode
+ */
+CARDANO_EXPORT cardano_error_t cardano_provider_resolve_unspent_outputs(
+  cardano_provider_t*              provider,
+  cardano_transaction_input_set_t* tx_ins,
+  cardano_utxo_list_t**            utxo_list);
+
+/**
+ * \brief Resolves a Plutus datum from its hash.
+ *
+ * This function retrieves the Plutus datum associated with the given datum hash.
+ * It uses the provided Cardano provider instance to access the blockchain data.
+ *
+ * \param[in]  provider    Pointer to the \ref cardano_provider_t instance.
+ *                         Must not be `NULL`.
+ * \param[in]  datum_hash  Pointer to a \ref cardano_blake2b_hash_t representing the hash
+ *                         of the datum to resolve. Must not be `NULL`.
+ * \param[out] datum       Pointer to a location where the function will store a pointer
+ *                         to the retrieved \ref cardano_plutus_data_t structure containing
+ *                         the datum. Must not be `NULL`. On success, the caller is responsible
+ *                         for freeing the returned \ref cardano_plutus_data_t object using
+ *                         the \ref cardano_plutus_data_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - Other error codes for provider-specific failures.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_t* datum = NULL;
+ * cardano_error_t result = cardano_provider_resolve_datum(provider, datum_hash, &datum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved datum
+ *   // ...
+ *   // When done, free the datum
+ *   cardano_plutus_data_unref(datum);
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_provider_unref(&provider);
+ * \endcode
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_provider_resolve_datum(cardano_provider_t* provider, cardano_blake2b_hash_t* datum_hash, cardano_plutus_data_t** datum);
+
+/**
+ * \brief Confirms the inclusion of a transaction in the blockchain within a specified timeout period.
+ *
+ * This function waits for the specified transaction to be confirmed (i.e., included in a block)
+ * within a given timeout period. It uses the provided Cardano provider instance to monitor
+ * the blockchain for the transaction's confirmation.
+ *
+ * \param[in] provider    Pointer to the \ref cardano_provider_t instance.
+ *                        Must not be `NULL`.
+ * \param[in] tx_id       Pointer to a \ref cardano_blake2b_hash_t representing the transaction ID
+ *                        to confirm. Must not be `NULL`.
+ * \param[in] timeout_ms  Timeout in milliseconds to wait for the transaction confirmation.
+ *                        If the transaction is not confirmed within this period, the function will return
+ *                        an appropriate error code.
+ *  \param[out] confirmed  Pointer to a boolean variable where the function will store the confirmation status.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *
+ * Usage Example:
+ * \code{.c}
+ * bool confirmed = false;
+ * cardano_error_t result = cardano_provider_confirm_transaction(provider, tx_id, 60000, &confirmed); // Wait up to 60 seconds
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Check if the transaction is confirmed
+ *   // Proceed with dependent operations
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_provider_unref(&provider);
+ * \endcode
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_provider_confirm_transaction(
+  cardano_provider_t*     provider,
+  cardano_blake2b_hash_t* tx_id,
+  uint64_t                timeout_ms,
+  bool*                   confirmed);
+
+/**
+ * \brief Submits a transaction to the Cardano blockchain network.
+ *
+ * This function submits the given transaction to the Cardano network for processing.
+ * Upon successful submission, it returns the transaction ID (hash) of the submitted transaction.
+ * The transaction ID can be used to track the transaction's status and confirmation.
+ *
+ * \param[in]  provider Pointer to the \ref cardano_provider_t instance.
+ *                      Must not be `NULL`.
+ * \param[in]  tx       Pointer to the \ref cardano_transaction_t representing the transaction to submit.
+ *                      Must not be `NULL`.
+ * \param[out] tx_id    Pointer to a location where the function will store a pointer to the
+ *                      newly allocated \ref cardano_blake2b_hash_t representing the transaction ID.
+ *                      Must not be `NULL`. On success, the caller is responsible for freeing the
+ *                      returned \ref cardano_blake2b_hash_t object using the appropriate deallocation function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - Other error codes for provider-specific failures.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* tx_id = NULL;
+ * cardano_error_t result = cardano_provider_submit_transaction(provider, tx, &tx_id);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Transaction submitted successfully
+ *   // Use tx_id to track the transaction
+ *   // ...
+ *   // When done, free the transaction ID
+ *   cardano_blake2b_hash_unref(tx_id);
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_provider_unref(&provider);
+ * \endcode
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_provider_submit_transaction(
+  cardano_provider_t*      provider,
+  cardano_transaction_t*   tx,
+  cardano_blake2b_hash_t** tx_id);
+
+/**
+ * \brief Evaluates a transaction to estimate the required execution units for Plutus scripts.
+ *
+ * This function evaluates the given transaction to determine the execution units (e.g., memory and CPU usage)
+ * required by any Plutus scripts involved in the transaction. The evaluation considers any additional UTXOs
+ * and redeemers provided.
+ *
+ * \param[in]  provider         Pointer to the \ref cardano_provider_t instance.
+ *                              Must not be `NULL`.
+ * \param[in]  tx               Pointer to the \ref cardano_transaction_t representing the transaction to evaluate.
+ *                              Must not be `NULL`.
+ * \param[in]  additional_utxos Pointer to a \ref cardano_utxo_list_t containing additional UTXOs required
+ *                              for evaluation. Can be `NULL` if not needed.
+ * \param[out] redeemers        Pointer to a location where the function will store a pointer to the
+ *                              \ref cardano_redeemer_list_t containing updated redeemers with estimated
+ *                              execution units. Must not be `NULL`. On success, the caller is responsible
+ *                              for freeing the returned \ref cardano_redeemer_list_t object using the
+ *                              \ref cardano_redeemer_list_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - Other error codes for provider-specific failures.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_list_t* redeemers = NULL;
+ *
+ * cardano_error_t result = cardano_provider_evaluate_transaction(provider, tx, additional_utxos, &redeemers);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the updated redeemers with estimated execution units
+ *   // ...
+ *   // When done, free the redeemers list
+ *   cardano_redeemer_list_unref(redeemers);
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_provider_unref(&provider);
+ * \endcode
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_provider_evaluate_transaction(
+  cardano_provider_t*       provider,
+  cardano_transaction_t*    tx,
+  cardano_utxo_list_t*      additional_utxos,
+  cardano_redeemer_list_t** redeemers);
+
+/**
+ * \brief Decrements the reference count of a cardano_provider_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_provider_t object
+ * by decreasing its reference count. When the reference count reaches zero, the provider is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] provider A pointer to the pointer of the provider object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_provider_t* provider = cardano_provider_new(major, minor);
+ *
+ * // Perform operations with the provider...
+ *
+ * cardano_provider_unref(&provider);
+ * // At this point, provider is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_provider_unref, the pointer to the \ref cardano_provider_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_provider_unref(cardano_provider_t** provider);
+
+/**
+ * \brief Increases the reference count of the cardano_provider_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_provider_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_provider_unref.
+ *
+ * \param provider A pointer to the cardano_provider_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming provider is a previously created provider object
+ *
+ * cardano_provider_ref(provider);
+ *
+ * // Now provider can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_provider_ref there is a corresponding
+ * call to \ref cardano_provider_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_provider_ref(cardano_provider_t* provider);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_provider_t object.
+ *
+ * This function returns the number of active references to an cardano_provider_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_provider_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param provider A pointer to the cardano_provider_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_provider_t object. If the object
+ * is properly managed (i.e., every \ref cardano_provider_ref call is matched with a
+ * \ref cardano_provider_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming provider is a previously created provider object
+ *
+ * size_t ref_count = cardano_provider_refcount(provider);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_provider_refcount(const cardano_provider_t* provider);
+
+/**
+ * \brief Sets the last error message for a given cardano_provider_t object.
+ *
+ * Records an error message in the provider's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] provider A pointer to the \ref cardano_provider_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the provider's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_provider_set_last_error(
+  cardano_provider_t* provider,
+  const char*         message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific provider.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_provider_set_last_error for the given
+ * provider. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] provider A pointer to the \ref cardano_provider_t instance whose last error
+ *                   message is to be retrieved. If the provider is NULL, the function
+ *                   returns a generic error message indicating the null provider.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified provider. If the provider is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_provider_set_last_error for the same provider, or until
+ *       the provider is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_provider_get_last_error(const cardano_provider_t* provider);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PROVIDER_H
diff --git a/vendor/include/cardano/providers/provider_impl.h b/vendor/include/cardano/providers/provider_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/providers/provider_impl.h
@@ -0,0 +1,333 @@
+/**
+ * \file provider_impl.h
+ *
+ * \author angel.castillo
+ * \date   Sep 27, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PROVIDER_IMPL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PROVIDER_IMPL_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/assets/asset_id.h>
+#include <cardano/common/network_magic.h>
+#include <cardano/common/utxo.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/protocol_params/protocol_parameters.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+#include <cardano/witness_set/redeemer_list.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* FORWARD DECLARATIONS *******************************************************/
+
+/**
+ * \brief Opaque structure representing the implementation details of a Cardano blockchain data provider.
+ *
+ * This structure encapsulates the internal state and implementation details of a Cardano blockchain data provider.
+ *
+ * \note Users should interact with Cardano providers through the provided \ref cardano_provider_t API functions and should
+ *       not attempt to manipulate this structure directly.
+ */
+typedef struct cardano_provider_impl_t cardano_provider_impl_t;
+
+/* CALLBACKS *****************************************************************/
+
+/**
+ * \brief Function pointer type for retrieving protocol parameters.
+ *
+ * This function retrieves the protocol parameters using the given provider implementation.
+ *
+ * \param[in]  provider_impl Pointer to the provider implementation instance.
+ * \param[out] parameters    Pointer to store the retrieved protocol parameters.
+ * \return Error code indicating success or failure of the operation.
+ */
+typedef cardano_error_t (*cardano_get_parameters_func_t)(
+  cardano_provider_impl_t*        provider_impl,
+  cardano_protocol_parameters_t** parameters);
+
+/**
+ * \brief Function pointer type for retrieving unspent outputs for an address.
+ *
+ * Retrieves a list of unspent transaction outputs (UTXOs) associated with the specified address.
+ *
+ * \param[in]  provider_impl Pointer to the provider implementation instance.
+ * \param[in]  address       Address for which to retrieve unspent outputs.
+ * \param[out] utxo_list     Pointer to store the list of unspent outputs.
+ * \return Error code indicating success or failure of the operation.
+ */
+typedef cardano_error_t (*cardano_get_unspent_outputs_func_t)(
+  cardano_provider_impl_t* provider_impl,
+  cardano_address_t*       address,
+  cardano_utxo_list_t**    utxo_list);
+
+/**
+ * \brief Function pointer type for retrieving staking rewards for an address.
+ *
+ * This function retrieves the current staking rewards associated with the specified address.
+ * It uses the provided provider implementation instance to access blockchain data and
+ * obtain the reward balance for the address. Staking rewards are accumulated for addresses
+ * that delegate their stake to a stake pool.
+ *
+ * \param[in]  provider_impl Pointer to the provider implementation instance.
+ *                           Must not be `NULL`.
+ * \param[in]  address       Pointer to a \ref cardano_address_t representing the address
+ *                           for which to retrieve staking rewards. Must not be `NULL`.
+ * \param[out] rewards       Pointer to a `uint64_t` variable where the function will store
+ *                           the amount of rewards (in Lovelace). Must not be `NULL`.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - Other error codes for provider-specific failures.
+ */
+typedef cardano_error_t (*cardano_get_rewards_balance_func_t)(
+  cardano_provider_impl_t*  provider_impl,
+  cardano_reward_address_t* address,
+  uint64_t*                 rewards);
+
+/**
+ * \brief Function pointer type for retrieving unspent outputs for an address and specific asset.
+ *
+ * Retrieves a list of unspent transaction outputs (UTXOs) associated with the specified address
+ * that contain the specified asset.
+ *
+ * \param[in]  provider_impl Pointer to the provider implementation instance.
+ * \param[in]  address       Address for which to retrieve unspent outputs.
+ * \param[in]  asset_id      Asset identifier to filter UTXOs.
+ * \param[out] utxo_list     Pointer to store the list of unspent outputs containing the asset.
+ * \return Error code indicating success or failure of the operation.
+ */
+typedef cardano_error_t (*cardano_get_unspent_outputs_with_asset_func_t)(
+  cardano_provider_impl_t* provider_impl,
+  cardano_address_t*       address,
+  cardano_asset_id_t*      asset_id,
+  cardano_utxo_list_t**    utxo_list);
+
+/**
+ * \brief Function pointer type for retrieving an unspent output containing a specific NFT.
+ *
+ * Retrieves an unspent transaction output (UTXO) that contains the specified NFT (Non-Fungible Token).
+ *
+ * \param[in]  provider_impl Pointer to the provider implementation instance.
+ * \param[in]  asset_id      Asset identifier of the NFT.
+ * \param[out] utxo          Pointer to store the retrieved unspent output containing the NFT.
+ * \return Error code indicating success or failure of the operation.
+ */
+typedef cardano_error_t (*cardano_get_unspent_output_by_nft_func_t)(
+  cardano_provider_impl_t* provider_impl,
+  cardano_asset_id_t*      asset_id,
+  cardano_utxo_t**         utxo);
+
+/**
+ * \brief Function pointer type for resolving unspent outputs for given transaction inputs.
+ *
+ * Resolves a list of unspent transaction outputs (UTXOs) corresponding to the provided transaction inputs.
+ *
+ * \param[in]  provider_impl Pointer to the provider implementation instance.
+ * \param[in]  tx_ins        Set of transaction inputs to resolve.
+ * \param[out] utxo_list     Pointer to store the list of resolved unspent outputs.
+ * \return Error code indicating success or failure of the operation.
+ */
+typedef cardano_error_t (*cardano_resolve_unspent_outputs_func_t)(
+  cardano_provider_impl_t*         provider_impl,
+  cardano_transaction_input_set_t* tx_ins,
+  cardano_utxo_list_t**            utxo_list);
+
+/**
+ * \brief Function pointer type for resolving a datum from its hash.
+ *
+ * Retrieves the Plutus datum associated with the given datum hash.
+ *
+ * \param[in]  provider_impl Pointer to the provider implementation instance.
+ * \param[in]  datum_hash    Hash of the datum to resolve.
+ * \param[out] datum         Pointer to store the retrieved Plutus datum.
+ * \return Error code indicating success or failure of the operation.
+ */
+typedef cardano_error_t (*cardano_resolve_datum_func_t)(
+  cardano_provider_impl_t* provider_impl,
+  cardano_blake2b_hash_t*  datum_hash,
+  cardano_plutus_data_t**  datum);
+
+/**
+ * \brief Function pointer type for confirming a transaction's inclusion in the blockchain.
+ *
+ * Waits for the specified transaction to be confirmed within a given timeout period.
+ *
+ * \param[in] provider_impl Pointer to the provider implementation instance.
+ * \param[in] tx_id         Transaction ID to confirm.
+ * \param[in] timeout_ms    Timeout in milliseconds to wait for confirmation.
+ * \param[out] confirmed    Pointer to store the confirmation status of the transaction.
+ *
+ * \return Error code indicating success or failure of the operation.
+ */
+typedef cardano_error_t (*cardano_confirm_transaction_func_t)(
+  cardano_provider_impl_t* provider_impl,
+  cardano_blake2b_hash_t*  tx_id,
+  uint64_t                 timeout_ms,
+  bool*                    confirmed);
+
+/**
+ * \brief Function pointer type for submitting a transaction to the blockchain.
+ *
+ * Submits the given transaction to the network and returns its transaction ID.
+ *
+ * \param[in]  provider_impl Pointer to the provider implementation instance.
+ * \param[in]  tx            Transaction to submit.
+ * \param[out] tx_id         Pointer to store the transaction ID after submission.
+ * \return Error code indicating success or failure of the operation.
+ */
+typedef cardano_error_t (*cardano_submit_transaction_func_t)(
+  cardano_provider_impl_t* provider_impl,
+  cardano_transaction_t*   tx,
+  cardano_blake2b_hash_t** tx_id);
+
+/**
+ * \brief Function pointer type for evaluating a transaction's execution units.
+ *
+ * Evaluates the execution units required by the transaction, considering any additional UTXOs and redeemers.
+ *
+ * \param[in] provider_impl    Pointer to the provider implementation instance.
+ * \param[in] tx               Transaction to evaluate.
+ * \param[in] additional_utxos Additional UTXOs required for evaluation (optional).
+ * \param[in] redeemers        Redeemers to be evaluated with the transaction.
+ * \return Error code indicating success or failure of the operation.
+ */
+typedef cardano_error_t (*cardano_evaluate_transaction_func_t)(
+  cardano_provider_impl_t*  provider_impl,
+  cardano_transaction_t*    tx,
+  cardano_utxo_list_t*      additional_utxos,
+  cardano_redeemer_list_t** redeemers);
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Implementation of the Cardano provider interface.
+ *
+ * This structure contains the context and function pointers required to interact with
+ * the Cardano blockchain. It serves as the implementation of the provider interface,
+ * encapsulating the necessary state and behaviors.
+ */
+typedef struct cardano_provider_impl_t
+{
+    /**
+     * \brief Name of the provider implementation.
+     */
+    char name[256];
+
+    /**
+     * \brief Error message buffer for provider-specific error messages.
+     */
+    char error_message[1024];
+
+    /**
+     * \brief Cardano network magic number this provider is connected to.
+     */
+    cardano_network_magic_t network_magic;
+
+    /**
+     * \brief Opaque pointer to the implementation-specific context.
+     *
+     * This pointer holds the state or context required by the provider implementation.
+     * Users should not access or modify this directly.
+     */
+    cardano_object_t* context;
+
+    /**
+     * \brief Function to retrieve protocol parameters.
+     *
+     * \see cardano_get_parameters_func_t
+     */
+    cardano_get_parameters_func_t get_parameters;
+
+    /**
+     * \brief Function to retrieve unspent outputs for an address.
+     *
+     * \see cardano_get_unspent_outputs_func_t
+     */
+    cardano_get_unspent_outputs_func_t get_unspent_outputs;
+
+    /**
+     * \brief Function to retrieve rewards for an address.
+     *
+     * \see cardano_get_rewards_balance_func_t
+     */
+    cardano_get_rewards_balance_func_t get_rewards_balance;
+
+    /**
+     * \brief Function to retrieve unspent outputs for an address and asset.
+     *
+     * \see cardano_get_unspent_outputs_with_asset_func_t
+     */
+    cardano_get_unspent_outputs_with_asset_func_t get_unspent_outputs_with_asset;
+
+    /**
+     * \brief Function to retrieve an unspent output for a given NFT.
+     *
+     * \see cardano_get_unspent_output_by_nft_func_t
+     */
+    cardano_get_unspent_output_by_nft_func_t get_unspent_output_by_nft;
+
+    /**
+     * \brief Function to resolve unspent outputs for transaction inputs.
+     *
+     * \see cardano_resolve_unspent_outputs_func_t
+     */
+    cardano_resolve_unspent_outputs_func_t resolve_unspent_outputs;
+
+    /**
+     * \brief Function to resolve a datum for a given datum hash.
+     *
+     * \see cardano_resolve_datum_func_t
+     */
+    cardano_resolve_datum_func_t resolve_datum;
+
+    /**
+     * \brief Function to await transaction confirmation.
+     *
+     * \see cardano_confirm_transaction_func_t
+     */
+    cardano_confirm_transaction_func_t await_transaction_confirmation;
+
+    /**
+     * \brief Function to submit a transaction to the blockchain.
+     *
+     * \see cardano_submit_transaction_func_t
+     */
+    cardano_submit_transaction_func_t post_transaction_to_chain;
+
+    /**
+     * \brief Function to evaluate a transaction.
+     *
+     * \see cardano_evaluate_transaction_func_t
+     */
+    cardano_evaluate_transaction_func_t evaluate_transaction;
+} cardano_provider_impl_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PROVIDER_IMPL_H
diff --git a/vendor/include/cardano/scripts/native_scripts/native_script.h b/vendor/include/cardano/scripts/native_scripts/native_script.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/native_scripts/native_script.h
@@ -0,0 +1,1194 @@
+/**
+ * \file native_script.h
+ *
+ * \author angel.castillo
+ * \date   May 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/scripts/native_scripts/native_script_type.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_t cardano_native_script_t;
+
+/**
+ * \brief This script evaluates to true if all the sub-scripts evaluate to true.
+ *
+ * If the list of sub-scripts is empty, this script evaluates to true.
+ */
+typedef struct cardano_script_all_t cardano_script_all_t;
+
+/**
+ * \brief This script evaluates to true if any the sub-scripts evaluate to true. That is, if one
+ * or more evaluate to true.
+ *
+ * If the list of sub-scripts is empty, this script evaluates to false.
+ */
+typedef struct cardano_script_any_t cardano_script_any_t;
+
+/**
+ * \brief This script evaluates to true if at least M (required field) of the sub-scripts evaluate to true.
+ */
+typedef struct cardano_script_n_of_k_t cardano_script_n_of_k_t;
+
+/**
+ * \brief This script evaluates to true if the transaction also includes a valid key witness
+ * where the witness verification key hashes to the given hash.
+ *
+ * In other words, this checks that the transaction is signed by a particular key, identified by its verification
+ * key hash.
+ */
+typedef struct cardano_script_pubkey_t cardano_script_pubkey_t;
+
+/**
+ * \brief This script evaluates to true if the upper bound of the transaction validity interval is a
+ * slot number Y, and X <= Y.
+ *
+ * This condition guarantees that the actual slot number in which the transaction is included is
+ * (strictly) less than slot number X.
+ */
+typedef struct cardano_script_invalid_after_t cardano_script_invalid_after_t;
+
+/**
+ * \brief This script evaluates to true if the lower bound of the transaction validity interval is a
+ * slot number Y, and Y >= X.
+ *
+ * This condition guarantees that the actual slot number in which the transaction is included
+ * is greater than or equal to slot number X.
+ */
+typedef struct cardano_script_invalid_before_t cardano_script_invalid_before_t;
+
+/**
+ * \brief This script evaluates to true if the given credential is present in the
+ * transaction guards.
+ *
+ * In other words, this checks that the transaction was authorized by a particular guard,
+ * identified by its key hash or script hash credential.
+ */
+typedef struct cardano_script_require_guard_t cardano_script_require_guard_t;
+
+/**
+ * \brief Creates and initializes a new instance of a \ref cardano_native_script_t from a script_all.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_native_script_t object
+ * from a given \ref cardano_script_all_t object. It essentially converts a script_all
+ * into a native_script. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] script_all A constant pointer to the \ref cardano_script_all_t object from which
+ *                       the native_script will be created. The object must not be NULL.
+ * \param[out] native_script On successful initialization, this will point to a newly created
+ *                           \ref cardano_native_script_t object. This object represents a "strong reference"
+ *                           to the native_script, meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the native_script is no longer needed, the caller must release it
+ *                           by calling \ref cardano_native_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the native_script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_all_t* script_all = cardano_script_all_new(...);
+ * cardano_native_script_t* native_script = NULL;
+ *
+ * // Attempt to create a new native_script from a script_all
+ * cardano_error_t result = cardano_native_script_new_all(script_all, &native_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script
+ *
+ *   // Once done, ensure to clean up and release the native_script
+ *   cardano_native_script_unref(&native_script);
+ * }
+ *
+ * // Clean up the script_all object once done
+ * cardano_script_all_unref(&script_all);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_new_all(
+  cardano_script_all_t*     script_all,
+  cardano_native_script_t** native_script);
+
+/**
+ * \brief Creates and initializes a new instance of a native_script from a script_any.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_native_script_t object
+ * from a given \ref cardano_script_any_t object. It essentially converts a script_any
+ * into a native_script. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] script_any A constant pointer to the \ref cardano_script_any_t object from which
+ *                       the native_script will be created. The object must not be NULL.
+ * \param[out] native_script On successful initialization, this will point to a newly created
+ *                           \ref cardano_native_script_t object. This object represents a "strong reference"
+ *                           to the native_script, meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the native_script is no longer needed, the caller must release it
+ *                           by calling \ref cardano_native_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the native_script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_any_t* script_any = cardano_script_any_new(...);
+ * cardano_native_script_t* native_script = NULL;
+ *
+ * // Attempt to create a new native_script from a script_any
+ * cardano_error_t result = cardano_native_script_new_any(script_any, &native_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script
+ *
+ *   // Once done, ensure to clean up and release the native_script
+ *   cardano_native_script_unref(&native_script);
+ * }
+ *
+ * // Clean up the script_any object once done
+ * cardano_script_any_unref(&script_any);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_new_any(
+  cardano_script_any_t*     script_any,
+  cardano_native_script_t** native_script);
+
+/**
+ * \brief Creates and initializes a new instance of a native_script from a script_n_of_k.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_native_script_t object
+ * from a given \ref cardano_script_n_of_k_t object. It essentially converts a script_n_of_k
+ * into a native_script. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] script_n_of_k A constant pointer to the \ref cardano_script_n_of_k_t object from which
+ *                        the native_script will be created. The object must not be NULL.
+ * \param[out] native_script On successful initialization, this will point to a newly created
+ *                           \ref cardano_native_script_t object. This object represents a "strong reference"
+ *                           to the native_script, meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the native_script is no longer needed, the caller must release it
+ *                           by calling \ref cardano_native_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the native_script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_n_of_k_t* script_n_of_k = cardano_script_n_of_k_new(...);
+ * cardano_native_script_t* native_script = NULL;
+ *
+ * // Attempt to create a new native_script from a script_n_of_k
+ * cardano_error_t result = cardano_native_script_new_n_of_k(script_n_of_k, &native_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script
+ *
+ *   // Once done, ensure to clean up and release the native_script
+ *   cardano_native_script_unref(&native_script);
+ * }
+ *
+ * // Clean up the script_n_of_k object once done
+ * cardano_script_n_of_k_unref(&script_n_of_k);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_new_n_of_k(
+  cardano_script_n_of_k_t*  script_n_of_k,
+  cardano_native_script_t** native_script);
+
+/**
+ * \brief Creates and initializes a new instance of a native_script from a script_pubkey.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_native_script_t object
+ * from a given \ref cardano_script_pubkey_t object. It essentially converts a script_pubkey
+ * into a native_script. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] script_pubkey A constant pointer to the \ref cardano_script_pubkey_t object from which
+ *                             the native_script will be created. The object must not be NULL.
+ * \param[out] native_script On successful initialization, this will point to a newly created
+ *                           \ref cardano_native_script_t object. This object represents a "strong reference"
+ *                           to the native_script, meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the native_script is no longer needed, the caller must release it
+ *                           by calling \ref cardano_native_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the native_script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_pubkey_t* script_pubkey = cardano_script_pubkey_new(...);
+ * cardano_native_script_t* native_script = NULL;
+ *
+ * // Attempt to create a new native_script from a script_pubkey
+ * cardano_error_t result = cardano_native_script_new_pubkey(script_pubkey, &native_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script
+ *
+ *   // Once done, ensure to clean up and release the native_script
+ *   cardano_native_script_unref(&native_script);
+ * }
+ *
+ * // Clean up the script_pubkey object once done
+ * cardano_script_pubkey_unref(&script_pubkey);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_new_pubkey(
+  cardano_script_pubkey_t*  script_pubkey,
+  cardano_native_script_t** native_script);
+
+/**
+ * \brief Creates and initializes a new instance of a native_script from a script_invalid_after.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_native_script_t object
+ * from a given \ref cardano_script_invalid_after_t object. It essentially converts a script_invalid_after
+ * into a native_script. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] invalid_after A constant pointer to the \ref cardano_script_invalid_after_t object from which
+ *                        the native_script will be created. The object must not be NULL.
+ * \param[out] native_script On successful initialization, this will point to a newly created
+ *                           \ref cardano_native_script_t object. This object represents a "strong reference"
+ *                           to the native_script, meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the native_script is no longer needed, the caller must release it
+ *                           by calling \ref cardano_native_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the native_script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_invalid_after_t* invalid_after = cardano_script_invalid_after_new(...);
+ * cardano_native_script_t* native_script = NULL;
+ *
+ * // Attempt to create a new native_script from a script_invalid_after
+ * cardano_error_t result = cardano_native_script_new_invalid_after(invalid_after, &native_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script
+ *
+ *   // Once done, ensure to clean up and release the native_script
+ *   cardano_native_script_unref(&native_script);
+ * }
+ *
+ * // Clean up the invalid_after object once done
+ * cardano_script_invalid_after_unref(&invalid_after);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_new_invalid_after(
+  cardano_script_invalid_after_t* invalid_after,
+  cardano_native_script_t**       native_script);
+
+/**
+ * \brief Creates and initializes a new instance of a native_script from a script_invalid_before.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_native_script_t object
+ * from a given \ref cardano_script_invalid_before_t object. It essentially converts a script_invalid_before
+ * into a native_script. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] invalid_before A constant pointer to the \ref cardano_script_invalid_before_t object from which
+ *                       the native_script will be created. The object must not be NULL.
+ * \param[out] native_script On successful initialization, this will point to a newly created
+ *                           \ref cardano_native_script_t object. This object represents a "strong reference"
+ *                           to the native_script, meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the native_script is no longer needed, the caller must release it
+ *                           by calling \ref cardano_native_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the native_script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_invalid_before_t* invalid_before = cardano_script_invalid_before_new(...);
+ * cardano_native_script_t* native_script = NULL;
+ *
+ * // Attempt to create a new native_script from a script_invalid_before
+ * cardano_error_t result = cardano_native_script_new_invalid_before(invalid_before, &native_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script
+ *
+ *   // Once done, ensure to clean up and release the native_script
+ *   cardano_native_script_unref(&native_script);
+ * }
+ *
+ * // Clean up the invalid_before object once done
+ * cardano_script_invalid_before_unref(&invalid_before);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_new_invalid_before(
+  cardano_script_invalid_before_t* invalid_before,
+  cardano_native_script_t**        native_script);
+
+/**
+ * \brief Creates and initializes a new instance of a native_script from a script_require_guard.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_native_script_t object
+ * from a given \ref cardano_script_require_guard_t object. It essentially converts a script_require_guard
+ * into a native_script. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] require_guard A constant pointer to the \ref cardano_script_require_guard_t object from which
+ *                          the native_script will be created. The object must not be NULL.
+ * \param[out] native_script On successful initialization, this will point to a newly created
+ *                           \ref cardano_native_script_t object. This object represents a "strong reference"
+ *                           to the native_script, meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the native_script is no longer needed, the caller must release it
+ *                           by calling \ref cardano_native_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the native_script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_require_guard_t* require_guard = cardano_script_require_guard_new(...);
+ * cardano_native_script_t* native_script = NULL;
+ *
+ * // Attempt to create a new native_script from a script_require_guard
+ * cardano_error_t result = cardano_native_script_new_require_guard(require_guard, &native_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script
+ *
+ *   // Once done, ensure to clean up and release the native_script
+ *   cardano_native_script_unref(&native_script);
+ * }
+ *
+ * // Clean up the require_guard object once done
+ * cardano_script_require_guard_unref(&require_guard);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_new_require_guard(
+  cardano_script_require_guard_t* require_guard,
+  cardano_native_script_t**       native_script);
+
+/**
+ * \brief Creates a native_script from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_native_script_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a native_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded native_script data.
+ * \param[out] native_script A pointer to a pointer of \ref cardano_native_script_t that will be set to the address
+ *                           of the newly created native_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the native_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a native_script object is created using \ref cardano_native_script_from_cbor, the script it wraps
+ *         (and every sub-script of it) caches its original CBOR representation internally. When \ref cardano_native_script_to_cbor
+ *         is called, it will output the cached CBOR. If the cached CBOR representation is not needed, the client can call
+ *         \ref cardano_native_script_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_native_script_t object by calling
+ *       \ref cardano_native_script_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_native_script_t* native_script = NULL;
+ *
+ * cardano_error_t result = cardano_native_script_from_cbor(reader, &native_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script
+ *
+ *   // Once done, ensure to clean up and release the native_script
+ *   cardano_native_script_unref(&native_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode native_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_from_cbor(cardano_cbor_reader_t* reader, cardano_native_script_t** native_script);
+
+/**
+ * \brief Serializes a native_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_native_script_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] native_script A constant pointer to the \ref cardano_native_script_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p native_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a native_script object is created using \ref cardano_native_script_from_cbor, the script it wraps
+ *         (and every sub-script of it) caches its original CBOR representation internally. When \ref cardano_native_script_to_cbor
+ *         is called, it will output the cached CBOR. If the cached CBOR representation is not needed, the client can call
+ *         \ref cardano_native_script_clear_cbor_cache after the object has been created.
+ *
+ * \note A native_script keeps no CBOR of its own, it writes the script it wraps. A setter called on the script returned by
+ *       \ref cardano_native_script_to_all or its siblings discards the cache of that script, so the change is serialized here.
+ *       A change made deeper in the tree, to a sub-script of an all, any or n of k script, is not; see
+ *       \ref cardano_script_all_to_cbor for the rule and call \ref cardano_native_script_clear_cbor_cache after such a change.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_native_script_to_cbor(native_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_native_script_unref(&native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_to_cbor(
+  const cardano_native_script_t* native_script,
+  cardano_cbor_writer_t*         writer);
+
+/**
+ * \brief Serializes a single native script to a CIP-116 JSON object.
+ *
+ * This function writes the JSON representation of a single native script into
+ * \p writer as a JSON object (it emits the opening and closing braces).
+ * The exact shape depends on the script tag:
+ *
+ * Notes:
+ * - The function can be called at the root, as a property value, or as an element of an array.
+ * - For nested variants (\c "all", \c "any", \c "n_of_k"), each child script is serialized
+ *   using this same function recursively.
+ *
+ * \param[in]     script A pointer to the script to serialize (single native script).
+ *                       \note Despite the parameter name, this is a single script,
+ *                       not a list.
+ * \param[in,out] writer A valid JSON writer positioned where a value is expected.
+ *
+ * \retval CARDANO_SUCCESS               The script was serialized successfully.
+ * \retval CARDANO_ERROR_POINTER_IS_NULL \p native_script_list or \p writer is \c NULL.
+ * \retval CARDANO_ERROR_ENCODING        A nested script failed to serialize or the writer
+ *                                       reported an encoding error.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_to_cip116_json(
+  const cardano_native_script_t* script,
+  cardano_json_writer_t*         writer);
+
+/**
+ * \brief Creates a native_script from a JSON string.
+ *
+ * This function parses JSON data using a provided JSON string and constructs a \ref cardano_native_script_t object.
+ * It assumes that the JSON data corresponds to the structure expected for a native_script.
+ *
+ * \param[in] json A pointer to a character array containing the JSON-encoded native_script data.
+ * \param[in] json_size The size of the JSON data in bytes.
+ * \param[out] native_script A pointer to a pointer of \ref cardano_native_script_t that will be set to the address
+ *                           of the newly created native_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the native_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* json_data = "{...}"; // Assume this contains valid JSON-encoded native_script data
+ * size_t data_size = strlen(json_data);
+ * cardano_native_script_t* native_script = NULL;
+ *
+ * cardano_error_t result = cardano_native_script_from_json(json_data, data_size, &native_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script
+ *
+ *   // Once done, ensure to clean up and release the native_script
+ *   cardano_native_script_unref(&native_script);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to decode native_script: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_from_json(const char* json, size_t json_size, cardano_native_script_t** native_script);
+
+/**
+ * \brief Retrieves the type of the native_script.
+ *
+ * This function retrieves the type of a given \ref cardano_native_script_t object and stores it in the provided
+ * output parameter. The native script type is defined in the \ref cardano_native_script_type_t enumeration.
+ *
+ * \param[in] native_script A constant pointer to the \ref cardano_native_script_t object from which
+ *                          the type is to be retrieved. The object must not be NULL.
+ * \param[out] type Pointer to a variable where the native_script type will be stored. This variable will
+ *                  be set to the value from the \ref cardano_native_script_type_t enumeration.
+ *
+ * \return \ref CARDANO_SUCCESS if the type was successfully retrieved, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script = cardano_native_script_new_pubkey(...);
+ * cardano_native_script_type_t type;
+ * cardano_error_t result = cardano_native_script_get_type(native_script, &type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (type == CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY)
+ *   {
+ *     // Handle require signature type native_script
+ *   }
+ *   else if (type == CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF)
+ *   {
+ *     // Handle require all of type native_script
+ *   }
+ *   // Add more cases as needed for other types
+ * }
+ *
+ * // Clean up the native_script object once done
+ * cardano_native_script_unref(&native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_get_type(
+  const cardano_native_script_t* native_script,
+  cardano_native_script_type_t*  type);
+
+/**
+ * \brief Converts a native_script object to a script_all object.
+ *
+ * This function converts a \ref cardano_native_script_t object to a \ref cardano_script_all_t object.
+ * It essentially creates a script_all object from the given native_script, allowing the conversion
+ * between different types of native scripts. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] native_script A constant pointer to the \ref cardano_native_script_t object to be converted.
+ * \param[out] script_all On successful conversion, this will point to a newly created
+ *                        \ref cardano_script_all_t object. This object represents a "strong reference"
+ *                        to the script_all, meaning that it is fully initialized and ready for use.
+ *                        The caller is responsible for managing the lifecycle of this object.
+ *                        Specifically, once the script_all is no longer needed, the caller must release it
+ *                        by calling \ref cardano_script_all_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script = ...; // Assume native_script is a valid native script object
+ * cardano_script_all_t* script_all = NULL;
+ * cardano_error_t result = cardano_native_script_to_all(native_script, &script_all);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_all
+ *
+ *   // Once done, ensure to clean up and release the script_all
+ *   cardano_script_all_unref(&script_all);
+ * }
+ *
+ * // Clean up the native_script object once done
+ * cardano_native_script_unref(&native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_to_all(
+  cardano_native_script_t* native_script,
+  cardano_script_all_t**   script_all);
+
+/**
+ * \brief Converts a native_script object to a script_any object.
+ *
+ * This function converts a \ref cardano_native_script_t object to a \ref cardano_script_any_t object.
+ * It essentially creates a script_any object from the given native_script, allowing the conversion
+ * between different types of native scripts. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] native_script A constant pointer to the \ref cardano_native_script_t object to be converted.
+ * \param[out] script_any On successful conversion, this will point to a newly created
+ *                        \ref cardano_script_any_t object. This object represents a "strong reference"
+ *                        to the script_any, meaning that it is fully initialized and ready for use.
+ *                        The caller is responsible for managing the lifecycle of this object.
+ *                        Specifically, once the script_any is no longer needed, the caller must release it
+ *                        by calling \ref cardano_script_any_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script = ...; // Assume native_script is a valid native script object
+ * cardano_script_any_t* script_any = NULL;
+ * cardano_error_t result = cardano_native_script_to_any(native_script, &script_any);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_any
+ *
+ *   // Once done, ensure to clean up and release the script_any
+ *   cardano_script_any_unref(&script_any);
+ * }
+ *
+ * // Clean up the native_script object once done
+ * cardano_native_script_unref(&native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_to_any(
+  cardano_native_script_t* native_script,
+  cardano_script_any_t**   script_any);
+
+/**
+ * \brief Converts a native_script object to a script_n_of_k object.
+ *
+ * This function converts a \ref cardano_native_script_t object to a \ref cardano_script_n_of_k_t object.
+ * It essentially creates a script_n_of_k object from the given native_script, allowing the conversion
+ * between different types of native scripts. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] native_script A constant pointer to the \ref cardano_native_script_t object to be converted.
+ * \param[out] script_n_of_k On successful conversion, this will point to a newly created
+ *                         \ref cardano_script_n_of_k_t object. This object represents a "strong reference"
+ *                         to the script_n_of_k, meaning that it is fully initialized and ready for use.
+ *                         The caller is responsible for managing the lifecycle of this object.
+ *                         Specifically, once the script_n_of_k is no longer needed, the caller must release it
+ *                         by calling \ref cardano_script_n_of_k_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script = ...; // Assume native_script is a valid native script object
+ * cardano_script_n_of_k_t* script_n_of_k = NULL;
+ * cardano_error_t result = cardano_native_script_to_n_of_k(native_script, &script_n_of_k);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_n_of_k
+ *
+ *   // Once done, ensure to clean up and release the script_n_of_k
+ *   cardano_script_n_of_k_unref(&script_n_of_k);
+ * }
+ *
+ * // Clean up the native_script object once done
+ * cardano_native_script_unref(&native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_to_n_of_k(
+  cardano_native_script_t*  native_script,
+  cardano_script_n_of_k_t** script_n_of_k);
+
+/**
+ * \brief Converts a native_script object to a script_pubkey object.
+ *
+ * This function converts a \ref cardano_native_script_t object to a \ref cardano_script_pubkey_t object.
+ * It essentially creates a script_pubkey object from the given native_script, allowing the conversion
+ * between different types of native scripts. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] native_script A constant pointer to the \ref cardano_native_script_t object to be converted.
+ * \param[out] script_pubkey On successful conversion, this will point to a newly created
+ *                                  \ref cardano_script_pubkey_t object. This object represents a "strong reference"
+ *                                  to the script_pubkey, meaning that it is fully initialized and ready for use.
+ *                                  The caller is responsible for managing the lifecycle of this object.
+ *                                  Specifically, once the script_pubkey is no longer needed, the caller must release it
+ *                                  by calling \ref cardano_script_pubkey_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script = ...; // Assume native_script is a valid native script object
+ * cardano_script_pubkey_t* script_pubkey = NULL;
+ * cardano_error_t result = cardano_native_script_to_pubkey(native_script, &script_pubkey);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_pubkey
+ *
+ *   // Once done, ensure to clean up and release the script_pubkey
+ *   cardano_script_pubkey_unref(&script_pubkey);
+ * }
+ *
+ * // Clean up the native_script object once done
+ * cardano_native_script_unref(&native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_to_pubkey(
+  cardano_native_script_t*  native_script,
+  cardano_script_pubkey_t** script_pubkey);
+
+/**
+ * \brief Converts a native_script object to a script_invalid_after object.
+ *
+ * This function converts a \ref cardano_native_script_t object to a \ref cardano_script_invalid_after_t object.
+ * It essentially creates a script_invalid_after object from the given native_script, allowing the conversion
+ * between different types of native scripts. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] native_script A constant pointer to the \ref cardano_native_script_t object to be converted.
+ * \param[out] invalid_after On successful conversion, this will point to a newly created
+ *                         \ref cardano_script_invalid_after_t object. This object represents a "strong reference"
+ *                         to the invalid_after, meaning that it is fully initialized and ready for use.
+ *                         The caller is responsible for managing the lifecycle of this object.
+ *                         Specifically, once the invalid_after is no longer needed, the caller must release it
+ *                         by calling \ref cardano_script_invalid_after_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script = ...; // Assume native_script is a valid native script object
+ * cardano_script_invalid_after_t* invalid_after = NULL;
+ * cardano_error_t result = cardano_native_script_to_invalid_after(native_script, &invalid_after);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the invalid_after
+ *
+ *   // Once done, ensure to clean up and release the invalid_after
+ *   cardano_script_invalid_after_unref(&invalid_after);
+ * }
+ *
+ * // Clean up the native_script object once done
+ * cardano_native_script_unref(&native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_to_invalid_after(
+  cardano_native_script_t*         native_script,
+  cardano_script_invalid_after_t** invalid_after);
+
+/**
+ * \brief Converts a native_script object to a script_invalid_before object.
+ *
+ * This function converts a \ref cardano_native_script_t object to a \ref cardano_script_invalid_before_t object.
+ * It essentially creates a script_invalid_before object from the given native_script, allowing the conversion
+ * between different types of native scripts. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] native_script A constant pointer to the \ref cardano_native_script_t object to be converted.
+ * \param[out] invalid_before On successful conversion, this will point to a newly created
+ *                        \ref cardano_script_invalid_before_t object. This object represents a "strong reference"
+ *                        to the invalid_before, meaning that it is fully initialized and ready for use.
+ *                        The caller is responsible for managing the lifecycle of this object.
+ *                        Specifically, once the invalid_before is no longer needed, the caller must release it
+ *                        by calling \ref cardano_script_invalid_before_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script = ...; // Assume native_script is a valid native script object
+ * cardano_script_invalid_before_t* invalid_before = NULL;
+ * cardano_error_t result = cardano_native_script_to_invalid_before(native_script, &invalid_before);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the invalid_before
+ *
+ *   // Once done, ensure to clean up and release the invalid_before
+ *   cardano_script_invalid_before_unref(&invalid_before);
+ * }
+ *
+ * // Clean up the native_script object once done
+ * cardano_native_script_unref(&native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_to_invalid_before(
+  cardano_native_script_t*          native_script,
+  cardano_script_invalid_before_t** invalid_before);
+
+/**
+ * \brief Converts a native_script object to a script_require_guard object.
+ *
+ * This function converts a \ref cardano_native_script_t object to a \ref cardano_script_require_guard_t object.
+ * It essentially creates a script_require_guard object from the given native_script, allowing the conversion
+ * between different types of native scripts. It returns an error code to indicate the success or failure of
+ * the operation.
+ *
+ * \param[in] native_script A constant pointer to the \ref cardano_native_script_t object to be converted.
+ * \param[out] require_guard On successful conversion, this will point to a newly created
+ *                        \ref cardano_script_require_guard_t object. This object represents a "strong reference"
+ *                        to the require_guard, meaning that it is fully initialized and ready for use.
+ *                        The caller is responsible for managing the lifecycle of this object.
+ *                        Specifically, once the require_guard is no longer needed, the caller must release it
+ *                        by calling \ref cardano_script_require_guard_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script = ...; // Assume native_script is a valid native script object
+ * cardano_script_require_guard_t* require_guard = NULL;
+ * cardano_error_t result = cardano_native_script_to_require_guard(native_script, &require_guard);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the require_guard
+ *
+ *   // Once done, ensure to clean up and release the require_guard
+ *   cardano_script_require_guard_unref(&require_guard);
+ * }
+ *
+ * // Clean up the native_script object once done
+ * cardano_native_script_unref(&native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_to_require_guard(
+  cardano_native_script_t*         native_script,
+  cardano_script_require_guard_t** require_guard);
+
+/**
+ * \brief Retrieves the hash associated with a native_script.
+ *
+ * This computes and returns the hash of a \ref cardano_native_script_t object.
+ * It returns a new reference to a \ref cardano_blake2b_hash_t object representing the hash.
+ *
+ * \param native_script A constant pointer to the \ref cardano_native_script_t object from which
+ *                      the hash is to be retrieved.
+ *
+ * \return A pointer to a new \ref cardano_blake2b_hash_t object containing the hash.
+ *         If the input native_script is NULL, returns NULL. The caller is responsible for
+ *         managing the lifecycle of this object, including releasing it with
+ *         \ref cardano_blake2b_hash_unref.
+ *
+ * \note The hash is computed over the bytes that \ref cardano_native_script_to_cbor outputs. For a script created with
+ *       \ref cardano_native_script_from_cbor these are the bytes it was decoded from, so the hash matches the hash of the
+ *       script on chain even when the script was stored with a non minimal encoding.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* original_native_script = cardano_native_script_new(...);
+ * cardano_blake2b_hash_t* hash_native_script = cardano_native_script_get_hash(original_native_script);
+ *
+ * if (hash_native_script)
+ * {
+ *   // Use the hash native_script
+ *
+ *   // Once done, ensure to clean up and release the hash native_script
+ *   cardano_blake2b_hash_unref(&hash_native_script);
+ * }
+ * // Release the original native_script after use
+ * cardano_native_script_unref(&original_native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_native_script_get_hash(
+  const cardano_native_script_t* native_script);
+
+/**
+ * \brief Checks if two native_script objects are equal.
+ *
+ * This function compares two \ref cardano_native_script_t objects for equality.
+ * It checks if the contents of the two native_script objects are identical.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_native_script_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_native_script_t object to be compared.
+ *
+ * \return \c true if the two native_script objects are equal (have the same contents), \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script1 = cardano_native_script_new(...);
+ * cardano_native_script_t* native_script2 = cardano_native_script_new(...);
+ *
+ * if (cardano_native_script_equals(native_script1, native_script2))
+ * {
+ *   printf("native_script1 is equal to native_script2\n");
+ * }
+ * else
+ * {
+ *   printf("native_script1 is not equal to native_script2\n");
+ * }
+ *
+ * // Clean up the native_script objects once done
+ * cardano_native_script_unref(&native_script1);
+ * cardano_native_script_unref(&native_script2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_native_script_equals(
+  const cardano_native_script_t* lhs,
+  const cardano_native_script_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a native_script.
+ *
+ * This function removes the internally cached CBOR data from the script wrapped by a \ref cardano_native_script_t object
+ * and from every sub-script of it. It is useful when you have modified the native_script after it was created from CBOR using
+ * \ref cardano_native_script_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the native_script, rather than using the original cached CBOR.
+ *
+ * \param[in,out] native_script A pointer to an initialized \ref cardano_native_script_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the script when
+ *          serialized, which changes its hash, and with it the policy id, the address or the credential derived from it.
+ *          Use this function with caution, especially if the script is already on chain or if preserving
+ *          the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume native_script was created using cardano_native_script_from_cbor
+ * cardano_native_script_t* native_script = ...;
+ *
+ * // Clear the CBOR cache so that serialization encodes the script from its fields
+ * cardano_native_script_clear_cbor_cache(native_script);
+ *
+ * cardano_blake2b_hash_t* hash = cardano_native_script_get_hash(native_script);
+ *
+ * if (hash != NULL)
+ * {
+ *   // The hash of the script in the encoding this library produces
+ * }
+ *
+ * // Clean up resources
+ * cardano_blake2b_hash_unref(&hash);
+ * cardano_native_script_unref(&native_script);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_native_script_clear_cbor_cache(cardano_native_script_t* native_script);
+
+/**
+ * \brief Decrements the reference count of a native_script object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_native_script_t object
+ * by decreasing its reference count. When the reference count reaches zero, the native_script is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] native_script A pointer to the pointer of the native_script object. This double
+ *                              indirection allows the function to set the caller's pointer to
+ *                              NULL, avoiding dangling pointer issues after the object has been
+ *                              freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script = cardano_native_script_new();
+ *
+ * // Perform operations with the native_script...
+ *
+ * cardano_native_script_unref(&native_script);
+ * // At this point, native_script is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_native_script_unref, the pointer to the \ref cardano_native_script_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_native_script_unref(cardano_native_script_t** native_script);
+
+/**
+ * \brief Increases the reference count of the cardano_native_script_t object.
+ *
+ * This function is used to manually increment the reference count of a native_script
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_native_script_unref.
+ *
+ * \param native_script A pointer to the native_script object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming native_script is a previously created native_script object
+ *
+ * cardano_native_script_ref(native_script);
+ *
+ * // Now native_script can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_native_script_ref there is a corresponding
+ * call to \ref cardano_native_script_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_native_script_ref(cardano_native_script_t* native_script);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_native_script_t object.
+ *
+ * This function returns the number of active references to a native_script object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_native_script_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param native_script A pointer to the native_script object whose reference count is queried.
+ *                      The object must not be NULL.
+ *
+ * \return The number of active references to the specified native_script object. If the object
+ * is properly managed (i.e., every \ref cardano_native_script_ref call is matched with a
+ * \ref cardano_native_script_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming native_script is a previously created native_script object
+ *
+ * size_t ref_count = cardano_native_script_refcount(native_script);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_native_script_refcount(const cardano_native_script_t* native_script);
+
+/**
+ * \brief Sets the last error message for a given native_script object.
+ *
+ * Records an error message in the native_script's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] native_script A pointer to the \ref cardano_native_script_t instance whose last error message is
+ *                          to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the native_script's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ *       fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_native_script_set_last_error(
+  cardano_native_script_t* native_script,
+  const char*              message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific native_script.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_native_script_set_last_error for the given
+ * native_script. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] native_script A pointer to the \ref cardano_native_script_t instance whose last error
+ *                          message is to be retrieved. If the native_script is NULL, the function
+ *                          returns a generic error message indicating the null native_script.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified native_script. If the native_script is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_native_script_set_last_error for the same native_script, or until
+ *       the native_script is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_native_script_get_last_error(
+  const cardano_native_script_t* native_script);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_native_script_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_native_script_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_deep_clone(const cardano_native_script_t* source, cardano_native_script_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_H
diff --git a/vendor/include/cardano/scripts/native_scripts/native_script_list.h b/vendor/include/cardano/scripts/native_scripts/native_script_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/native_scripts/native_script_list.h
@@ -0,0 +1,570 @@
+/**
+ * \file native_script_list.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_t cardano_native_script_t;
+
+/**
+ * \brief Represents a list of native script.
+ */
+typedef struct cardano_native_script_list_t cardano_native_script_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a native_script_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_native_script_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] native_script_list On successful initialization, this will point to a newly created
+ *             \ref cardano_native_script_list_t object. This object represents a "strong reference"
+ *             to the native_script_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the native_script_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_native_script_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the native_script_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_script_list = NULL;
+ *
+ * // Attempt to create a new native_script_list
+ * cardano_error_t result = cardano_native_script_list_new(&native_script_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script_list
+ *
+ *   // Once done, ensure to clean up and release the native_script_list
+ *   cardano_native_script_list_unref(&native_script_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_list_new(cardano_native_script_list_t** native_script_list);
+
+/**
+ * \brief Creates a native_script_list from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_native_script_list_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a native_script_list.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded native_script_list data.
+ * \param[out] native_script_list A pointer to a pointer of \ref cardano_native_script_list_t that will be set to the address
+ *                        of the newly created native_script_list object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the native_script_list was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_native_script_list_t object by calling
+ *       \ref cardano_native_script_list_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_native_script_list_t* native_script_list = NULL;
+ *
+ * cardano_error_t result = cardano_native_script_list_from_cbor(reader, &native_script_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script_list
+ *
+ *   // Once done, ensure to clean up and release the native_script_list
+ *   cardano_native_script_list_unref(&native_script_list);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode native_script_list: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_list_from_cbor(cardano_cbor_reader_t* reader, cardano_native_script_list_t** native_script_list);
+
+/**
+ * \brief Serializes a native_script_list into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_native_script_list_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] native_script_list A constant pointer to the \ref cardano_native_script_list_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p native_script_list or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark Every native script of the list that was decoded from CBOR is written with the bytes it was decoded from,
+ *         see \ref cardano_native_script_to_cbor. Call \ref cardano_native_script_list_clear_cbor_cache to encode them from their fields.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_script_list = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_native_script_list_to_cbor(native_script_list, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_native_script_list_unref(&native_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_list_to_cbor(
+  const cardano_native_script_list_t* native_script_list,
+  cardano_cbor_writer_t*              writer);
+
+/**
+ * \brief Serializes a list of native scripts to a CIP-116 JSON array.
+ *
+ * This function writes the JSON representation of \p native_script_list into
+ * \p writer as a JSON array. Each element in the array is one native script
+ * encoded in its CIP-116 form (e.g., \c "pubkey", \c "all", \c "any",
+ * \c "n_of_k", \c "timelock_start", \c "timelock_expiry").
+ *
+ * The function emits the full array delimiters (it writes the opening \c '['
+ * and the closing \c ']'). It can be called at the root, as an array element,
+ * or as the value of a property in an enclosing object.
+ *
+ * - The array preserves the order of scripts as stored in \p native_script_list.
+ * - Each script element is serialized using its own CIP-116 serializer with
+ *   deterministic key order for that element type.
+ *
+ * \param[in]     native_script_list  A valid pointer to a \ref cardano_native_script_list_t.
+ * \param[in,out] writer              A valid JSON writer positioned where a value is expected.
+ *
+ * \return CARDANO_SUCCESS               The list was serialized successfully.
+ * \return CARDANO_ERROR_POINTER_IS_NULL \p native_script_list or \p writer is \c NULL.
+ * \return CARDANO_ERROR_ENCODING        A contained script failed to serialize or the writer
+ *                                       reported an encoding error.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_list_to_cip116_json(
+  const cardano_native_script_list_t* native_script_list,
+  cardano_json_writer_t*              writer);
+
+/**
+ * \brief Creates a native_script_list from a JSON string.
+ *
+ * This function parses JSON data using a provided JSON string and constructs a \ref cardano_native_script_list_t object.
+ * It assumes that the JSON data corresponds to the structure expected for a native_script_list.
+ *
+ * \param[in] json A pointer to a null-terminated string containing the JSON-encoded native_script_list data. This string
+ *                 must not be NULL.
+ * \param[in] json_size The size of the JSON string, excluding the null terminator.
+ * \param[out] native_script_list A pointer to a pointer of \ref cardano_native_script_list_t that will be set to the address
+ *                                of the newly created native_script_list object upon successful decoding. The caller is responsible
+ *                                for managing the lifecycle of this object by calling \ref cardano_native_script_list_unref when it
+ *                                is no longer needed.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the native_script_list was successfully created, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* json_string = "{\"scripts\": [{\"type\": \"sig\", \"keyHash\": \"...\"}, ...]}"; // Example JSON string
+ * size_t json_size = strlen(json_string); // Calculate the size of the JSON string
+ * cardano_native_script_list_t* native_script_list = NULL;
+ *
+ * // Attempt to create a new native_script_list from a JSON string
+ * cardano_error_t result = cardano_native_script_list_from_json(json_string, json_size, &native_script_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script_list
+ *
+ *   // Once done, ensure to clean up and release the native_script_list
+ *   cardano_native_script_list_unref(&native_script_list);
+ * }
+ * else
+ * {
+ *   printf("Failed to create native_script_list from JSON. Error code: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_list_from_json(
+  const char*                    json,
+  size_t                         json_size,
+  cardano_native_script_list_t** native_script_list);
+
+/**
+ * \brief Retrieves the length of a plutus list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_native_script_list_t object.
+ *
+ * \param[in] native_script_list A constant pointer to the \ref cardano_native_script_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the native_script_list. Return 0 if the native_script_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_script_list = cardano_native_script_list_new();
+ *
+ * // Populate native_script_list with elements
+ *
+ * size_t length = cardano_native_script_list_get_length(native_script_list);
+ * printf("Length of the native_script_list: %zu\n", length);
+ *
+ * // Clean up the native_script_list object once done
+ * cardano_native_script_list_unref(&native_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_native_script_list_get_length(const cardano_native_script_list_t* native_script_list);
+
+/**
+ * \brief Retrieves an element from a plutus list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_native_script_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] native_script_list A constant pointer to the \ref cardano_native_script_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the plutus list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_native_script_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_native_script_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_script_list = cardano_native_script_list_new();
+ *
+ * // Populate native_script_list with elements
+ *
+ * cardano_native_script_t* element = NULL;
+ * cardano_error_t result = cardano_native_script_list_get(native_script_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_native_script_unref(&element);
+ * }
+ *
+ * // Clean up the native_script_list object once done
+ * cardano_native_script_list_unref(&native_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_list_get(const cardano_native_script_list_t* native_script_list, size_t index, cardano_native_script_t** element);
+
+/**
+ * \brief Adds an element to a plutus list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_native_script_list_t object.
+ *
+ * \param[in] native_script_list A constant pointer to the \ref cardano_native_script_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_native_script_t object that is to be added to the native_script_list.
+ *                    The element will be referenced by the native_script_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the native_script_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_script_list = cardano_native_script_list_new();
+ *
+ * // Create and initialize a new native_script element
+ * cardano_native_script_t* element = { ... };
+ *
+ * // Add the element to the native_script_list
+ * cardano_error_t result = cardano_native_script_list_add(native_script_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the native_script_list object once done
+ * cardano_native_script_list_unref(&native_script_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_list_add(cardano_native_script_list_t* native_script_list, cardano_native_script_t* element);
+
+/**
+ * \brief Checks if two native script lists are equal.
+ *
+ * This function compares two \ref cardano_native_script_t objects to determine if they are equal. Two native scripts
+ * are considered equal if they have the same number of elements and each corresponding pair of elements
+ * is equal according to the \ref cardano_plutus_data_equals function.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_native_script_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_native_script_t object to be compared.
+ *
+ * \return \c true if the two native_scripts are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* list1 = { ... };  // Assume list1 is initialized here
+ * cardano_native_script_t* list2 = { ... };  // Assume list2 is initialized here
+ *
+ * if (cardano_native_script_equals(list1, list2))
+ * {
+ *   // The two native_scripts are equal
+ * }
+ * else
+ * {
+ *   // The two native_scripts are not equal
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_native_script_list_equals(const cardano_native_script_list_t* lhs, const cardano_native_script_list_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from every native script in a list.
+ *
+ * This function calls \ref cardano_native_script_clear_cbor_cache on every \ref cardano_native_script_t of the list, so that
+ * the next serialization of the list encodes each script from its fields rather than using the original cached CBOR.
+ * The list itself keeps no CBOR of its own.
+ *
+ * \param[in,out] native_script_list A pointer to an initialized \ref cardano_native_script_list_t object
+ *                         whose native scripts will have their CBOR cache cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the scripts when
+ *          serialized, which changes their hashes, and with them the policy ids, the addresses or the credentials derived from them.
+ *          Use this function with caution, especially if the scripts are already on chain or if preserving
+ *          the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume native_script_list was created using cardano_native_script_list_from_cbor
+ * cardano_native_script_list_t* native_script_list = ...;
+ *
+ * // Clear the CBOR cache of every script so that serialization encodes them from their fields
+ * cardano_native_script_list_clear_cbor_cache(native_script_list);
+ *
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * cardano_error_t result = cardano_native_script_list_to_cbor(native_script_list, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_native_script_list_unref(&native_script_list);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_native_script_list_clear_cbor_cache(cardano_native_script_list_t* native_script_list);
+
+/**
+ * \brief Decrements the reference count of a native_script_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_native_script_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the native_script_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] native_script_list A pointer to the pointer of the native_script_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_script_list = cardano_native_script_list_new();
+ *
+ * // Perform operations with the native_script_list...
+ *
+ * cardano_native_script_list_unref(&native_script_list);
+ * // At this point, native_script_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_native_script_list_unref, the pointer to the \ref cardano_native_script_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_native_script_list_unref(cardano_native_script_list_t** native_script_list);
+
+/**
+ * \brief Increases the reference count of the cardano_native_script_list_t object.
+ *
+ * This function is used to manually increment the reference count of a native_script_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_native_script_list_unref.
+ *
+ * \param native_script_list A pointer to the native_script_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming native_script_list is a previously created native_script_list object
+ *
+ * cardano_native_script_list_ref(native_script_list);
+ *
+ * // Now native_script_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_native_script_list_ref there is a corresponding
+ * call to \ref cardano_native_script_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_native_script_list_ref(cardano_native_script_list_t* native_script_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_native_script_list_t object.
+ *
+ * This function returns the number of active references to a native_script_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_native_script_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param native_script_list A pointer to the native_script_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified native_script_list object. If the object
+ * is properly managed (i.e., every \ref cardano_native_script_list_ref call is matched with a
+ * \ref cardano_native_script_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming native_script_list is a previously created native_script_list object
+ *
+ * size_t ref_count = cardano_native_script_list_refcount(native_script_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_native_script_list_refcount(const cardano_native_script_list_t* native_script_list);
+
+/**
+ * \brief Sets the last error message for a given native_script_list object.
+ *
+ * Records an error message in the native_script_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] native_script_list A pointer to the \ref cardano_native_script_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the native_script_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_native_script_list_set_last_error(cardano_native_script_list_t* native_script_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific native_script_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_native_script_list_set_last_error for the given
+ * native_script_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] native_script_list A pointer to the \ref cardano_native_script_list_t instance whose last error
+ *                   message is to be retrieved. If the native_script_list is NULL, the function
+ *                   returns a generic error message indicating the null native_script_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified native_script_list. If the native_script_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_native_script_list_set_last_error for the same native_script_list, or until
+ *       the native_script_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_native_script_list_get_last_error(const cardano_native_script_list_t* native_script_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_native_script_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_native_script_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_list_deep_clone(const cardano_native_script_list_t* source, cardano_native_script_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_LIST_H
diff --git a/vendor/include/cardano/scripts/native_scripts/native_script_type.h b/vendor/include/cardano/scripts/native_scripts/native_script_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/native_scripts/native_script_type.h
@@ -0,0 +1,92 @@
+/**
+ * \file native_script_type.h
+ *
+ * \author angel.castillo
+ * \date   May 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY TYPE, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_TYPE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \enum cardano_native_script_type_t
+ * \brief The native script type.
+ *
+ * This enumeration defines the types of native scripts that can be used in Cardano.
+ */
+typedef enum
+{
+  /**
+   * \brief The script requires a specific signature.
+   */
+  CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY = 0,
+
+  /**
+   * \brief The script requires all sub-scripts to evaluate to true.
+   */
+  CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF = 1,
+
+  /**
+   * \brief The script requires any one of the sub-scripts to evaluate to true.
+   */
+  CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ANY_OF = 2,
+
+  /**
+   * \brief The script requires at least N of the sub-scripts to evaluate to true.
+   */
+  CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_N_OF_K = 3,
+
+  /**
+   * \brief The script requires that the current slot is greater than or equal to a specified start time.
+   */
+  CARDANO_NATIVE_SCRIPT_TYPE_INVALID_BEFORE = 4,
+
+  /**
+   * \brief The script requires that the current slot is less than a specified expiry time.
+   */
+  CARDANO_NATIVE_SCRIPT_TYPE_INVALID_AFTER = 5,
+
+  /**
+   * \brief The script requires that a specific credential is present in the transaction guards.
+   */
+  CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD = 6
+} cardano_native_script_type_t;
+
+/**
+ * \brief Converts native script types to their human readable form.
+ *
+ * \param[in] type The native script type to get the string representation for.
+ * \return Human readable form of the given native script type.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_native_script_type_to_string(cardano_native_script_type_t type);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_TYPE_H
diff --git a/vendor/include/cardano/scripts/native_scripts/script_all.h b/vendor/include/cardano/scripts/native_scripts/script_all.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/native_scripts/script_all.h
@@ -0,0 +1,624 @@
+/**
+ * \file script_all.h
+ *
+ * \author angel.castillo
+ * \date   May 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_ALL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_ALL_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_t cardano_native_script_t;
+
+/**
+ * \brief This script evaluates to true if all the sub-scripts evaluate to true.
+ *
+ * If the list of sub-scripts is empty, this script evaluates to true.
+ */
+typedef struct cardano_script_all_t cardano_script_all_t;
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_list_t cardano_native_script_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a script_all.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_script_all_t
+ * with a provided list of native scripts. It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[in] native_scripts A pointer to a \ref cardano_native_script_list_t containing the list of native scripts.
+ * \param[out] script_all On successful initialization, this will point to a newly created
+ *             \ref cardano_script_all_t object. This object represents a "strong reference"
+ *             to the script_all, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script_all is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_all_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_all was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_scripts = ...; // Assume this is initialized
+ * cardano_script_all_t* script_all = NULL;
+ *
+ * // Attempt to create a new script_all
+ * cardano_error_t result = cardano_script_all_new(native_scripts, &script_all);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_all
+ *
+ *   // Once done, ensure to clean up and release the script_all
+ *   cardano_script_all_unref(&script_all);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_all_new(cardano_native_script_list_t* native_scripts, cardano_script_all_t** script_all);
+
+/**
+ * \brief Creates a script_all from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_script_all_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a script_all.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded script_all data.
+ * \param[out] script_all A pointer to a pointer of \ref cardano_script_all_t that will be set to the address
+ *                        of the newly created script_all object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_all was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_all object is created using \ref cardano_script_all_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_all_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_all_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_script_all_t object by calling
+ *       \ref cardano_script_all_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_script_all_t* script_all = NULL;
+ *
+ * cardano_error_t result = cardano_script_all_from_cbor(reader, &script_all);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_all
+ *
+ *   // Once done, ensure to clean up and release the script_all
+ *   cardano_script_all_unref(&script_all);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode script_all: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_all_from_cbor(cardano_cbor_reader_t* reader, cardano_script_all_t** script_all);
+
+/**
+ * \brief Serializes a script_all into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_script_all_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] script_all A constant pointer to the \ref cardano_script_all_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p script_all or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_all object is created using \ref cardano_script_all_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_all_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_all_clear_cbor_cache after the object has been created.
+ *
+ * \warning The sub-scripts keep the CBOR they were decoded with, and this object keeps its own. A change made to a sub-script,
+ *          or to the list returned by \ref cardano_script_all_get_scripts, after this object was decoded with
+ *          \ref cardano_script_all_from_cbor cannot discard the CBOR cached by this object, so \ref cardano_script_all_to_cbor would
+ *          still output the original bytes. Call \ref cardano_script_all_clear_cbor_cache after such a change so that it is serialized.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_all_t* script_all = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_script_all_to_cbor(script_all, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_script_all_unref(&script_all);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_all_to_cbor(
+  const cardano_script_all_t* script_all,
+  cardano_cbor_writer_t*      writer);
+
+/**
+ * \brief Serializes a native \c all script to CIP-116 JSON.
+ *
+ * This function writes the JSON representation of a native script of kind
+ * "all" into \p writer following the CIP-116.
+ *
+ * The function emits a complete JSON object (it writes the opening and
+ * closing braces). It can be called at the root, as an array element, or
+ * as the value of a property in an enclosing object.
+ *
+ * For determinism, fields are written in the order: \c "tag" then \c "scripts".
+ *
+ * \param[in]     script_all A valid pointer to an \ref cardano_script_all_t.
+ * \param[in,out] writer     A valid JSON writer positioned where a value is expected.
+ *
+ * \return CARDANO_SUCCESS               The script was serialized successfully.
+ * \return CARDANO_ERROR_POINTER_IS_NULL \p script_all or \p writer is \c NULL.
+ * \return CARDANO_ERROR_ENCODING        A nested script failed to serialize or the writer
+ *                                       reported an encoding error.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_all_to_cip116_json(
+  const cardano_script_all_t* script_all,
+  cardano_json_writer_t*      writer);
+
+/**
+ * \brief Creates a script_all from a JSON string.
+ *
+ * This function parses JSON data using a provided JSON string and constructs a \ref cardano_script_all_t object.
+ * It assumes that the JSON data corresponds to the structure expected for a script_all.
+ *
+ * \param[in] json A pointer to a null-terminated string containing the JSON-encoded script_all data. This string
+ *                 must not be NULL.
+ * \param[in] json_size The size of the JSON string, excluding the null terminator.
+ * \param[out] native_script A pointer to a pointer of \ref cardano_script_all_t that will be set to the address
+ *                        of the newly created script_all object upon successful decoding. The caller is responsible
+ *                        for managing the lifecycle of this object by calling \ref cardano_script_all_unref when it
+ *                        is no longer needed.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_all was successfully created, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* json_string = "{\"type\": \"all\", \"scripts\": [...]}"; // Example JSON string
+ * size_t json_size = strlen(json_string); // Calculate the size of the JSON string
+ * cardano_script_all_t* script_all = NULL;
+ *
+ * // Attempt to create a new script_all from a JSON string
+ * cardano_error_t result = cardano_script_all_from_json(json_string, json_size, &script_all);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_all
+ *
+ *   // Once done, ensure to clean up and release the script_all
+ *   cardano_script_all_unref(&script_all);
+ * }
+ * else
+ * {
+ *   printf("Failed to create script_all from JSON. Error code: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_all_from_json(const char* json, size_t json_size, cardano_script_all_t** native_script);
+
+/**
+ * \brief Retrieves the length of the script list in a script_all object.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_script_all_t script list.
+ *
+ * \param[in] script_all A constant pointer to the \ref cardano_script_all_t object whose scripts list length is to be retrieved.
+ *
+ * \return The number of scripts in the script_all. Returns 0 if the script_all is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_scripts = ...; // Assume this is initialized and populated
+ * cardano_script_all_t* script_all = NULL;
+ * cardano_script_all_new(native_scripts, &script_all);
+ *
+ * size_t length = cardano_script_all_get_length(script_all);
+ * printf("Length of the script_all scripts: %zu\n", length);
+ *
+ * // Clean up the script_all object once done
+ * cardano_script_all_unref(&script_all);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_all_get_length(const cardano_script_all_t* script_all);
+
+/**
+ * \brief Retrieves the list of native scripts associated with a \ref cardano_script_all_t.
+ *
+ * This function provides access to the list of native scripts in a \ref cardano_script_all_t object.
+ * It returns a reference to a \ref cardano_native_script_list_t object representing the scripts.
+ * This allows the scripts to be used independently of the original \ref cardano_script_all_t object. The
+ * reference count of the list object is increased by one, making it the caller's responsibility
+ * to release it by calling \ref cardano_native_script_list_unref when it is no longer needed.
+ *
+ * \param[in] script_all A constant pointer to the \ref cardano_script_all_t object from which
+ *                       the list of native scripts is to be retrieved.
+ * \param[out] list A pointer to store the reference to the \ref cardano_native_script_list_t object containing the scripts.
+ *                  If the input script_all is NULL, returns NULL. The caller is responsible for
+ *                  managing the lifecycle of this object, including releasing it with
+ *                  \ref cardano_native_script_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the list of scripts was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * \warning The sub-scripts keep the CBOR they were decoded with, and this object keeps its own. A change made to a sub-script,
+ *          or to the list returned by \ref cardano_script_all_get_scripts, after this object was decoded with
+ *          \ref cardano_script_all_from_cbor cannot discard the CBOR cached by this object, so \ref cardano_script_all_to_cbor would
+ *          still output the original bytes. Call \ref cardano_script_all_clear_cbor_cache after such a change so that it is serialized.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_all_t* script_all = cardano_script_all_new(...);
+ * cardano_native_script_list_t* list_scripts = NULL;
+ *
+ * // Attempt to retrieve the list of native scripts associated with script_all
+ * cardano_error_t result = cardano_script_all_get_scripts(script_all, &list_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list_scripts
+ *
+ *   // Once done, ensure to clean up and release the list_scripts
+ *   cardano_native_script_list_unref(&list_scripts);
+ * }
+ *
+ * // Release the script_all object after use
+ * cardano_script_all_unref(&script_all);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_all_get_scripts(
+  cardano_script_all_t*          script_all,
+  cardano_native_script_list_t** list);
+
+/**
+ * \brief Sets the list of native scripts associated with a \ref cardano_script_all_t.
+ *
+ * This function sets the list of native scripts for a \ref cardano_script_all_t object to the provided
+ * \ref cardano_native_script_list_t object. It replaces any existing scripts associated with the \ref cardano_script_all_t.
+ * The reference count of the provided list object is increased by one, making it the caller's responsibility
+ * to release it when it is no longer needed.
+ *
+ * \param[in] script_all A pointer to the \ref cardano_script_all_t object to which
+ *                       the list of native scripts is to be set.
+ * \param[in] list A pointer to the \ref cardano_native_script_list_t object containing the new scripts to be set.
+ *
+ * \return \ref CARDANO_SUCCESS if the scripts were successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * \note A successful call discards the CBOR that the object cached when it was decoded with \ref cardano_script_all_from_cbor,
+ *       so the next call to \ref cardano_script_all_to_cbor encodes the script from its fields.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_all_t* script_all = cardano_script_all_new(...);
+ * cardano_native_script_list_t* new_list = ...; // Assume new_list is initialized here
+ *
+ * // Attempt to set the new list of scripts associated with the script_all
+ * cardano_error_t result = cardano_script_all_set_scripts(script_all, new_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Scripts successfully set
+ *   printf("Scripts set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Failed to set scripts: %s.\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Release the script_all object after use
+ * cardano_script_all_unref(&script_all);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_all_set_scripts(
+  cardano_script_all_t*         script_all,
+  cardano_native_script_list_t* list);
+
+/**
+ * \brief Checks if two script_all objects are equal.
+ *
+ * This function compares two \ref cardano_script_all_t objects to determine if they are equal. Two script_all
+ * objects are considered equal if they have the same number of elements and each corresponding pair of elements
+ * is equal according to the \ref cardano_native_script_equals function.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_script_all_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_script_all_t object to be compared.
+ *
+ * \return \c true if the two script_all objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_all_t* script1 = ...;  // Assume script1 is initialized here
+ * cardano_script_all_t* script2 = ...;  // Assume script2 is initialized here
+ *
+ * if (cardano_script_all_equals(script1, script2))
+ * {
+ *   // The two script_all objects are equal
+ * }
+ * else
+ * {
+ *   // The two script_all objects are not equal
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_script_all_equals(const cardano_script_all_t* lhs, const cardano_script_all_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a script_all.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_script_all_t object.
+ * It is useful when you have modified the script_all after it was created from CBOR using
+ * \ref cardano_script_all_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the script_all, rather than using the original cached CBOR.
+ * The cached CBOR of every sub-script in the list of the script_all is cleared as well, so the whole script is encoded from
+ * its fields.
+ *
+ * \param[in,out] script_all A pointer to an initialized \ref cardano_script_all_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the script when
+ *          serialized, which changes its hash, and with it the policy id, the address or the credential derived from it.
+ *          Use this function with caution, especially if the script is already on chain or if preserving
+ *          the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume script_all was created using cardano_script_all_from_cbor
+ * cardano_script_all_t* script_all = ...;
+ * cardano_native_script_t* new_script = ...;
+ * cardano_native_script_list_t* scripts = NULL;
+ *
+ * cardano_error_t result = cardano_script_all_get_scripts(script_all, &scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Modify the list of sub-scripts, this does not reach the cache of the script_all
+ *   result = cardano_native_script_list_add(scripts, new_script);
+ *   cardano_native_script_list_unref(&scripts);
+ * }
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated script_all
+ * cardano_script_all_clear_cbor_cache(script_all);
+ *
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_script_all_to_cbor(script_all, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_script_all_unref(&script_all);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_script_all_clear_cbor_cache(cardano_script_all_t* script_all);
+
+/**
+ * \brief Decrements the reference count of a script_all object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_script_all_t object
+ * by decreasing its reference count. When the reference count reaches zero, the script_all is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] script_all A pointer to the pointer of the script_all object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_all_t* script_all = ...; // Assume script_all is initialized here
+ *
+ * // Perform operations with the script_all...
+ *
+ * cardano_script_all_unref(&script_all);
+ * // At this point, script_all is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_script_all_unref, the pointer to the \ref cardano_script_all_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_script_all_unref(cardano_script_all_t** script_all);
+
+/**
+ * \brief Increases the reference count of the cardano_script_all_t object.
+ *
+ * This function is used to manually increment the reference count of a script_all
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_script_all_unref.
+ *
+ * \param script_all A pointer to the script_all object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_all is a previously created script_all object
+ *
+ * cardano_script_all_ref(script_all);
+ *
+ * // Now script_all can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_script_all_ref there is a corresponding
+ * call to \ref cardano_script_all_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_script_all_ref(cardano_script_all_t* script_all);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_script_all_t object.
+ *
+ * This function returns the number of active references to a script_all object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_script_all_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param script_all A pointer to the script_all object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified script_all object. If the object
+ * is properly managed (i.e., every \ref cardano_script_all_ref call is matched with a
+ * \ref cardano_script_all_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_all is a previously created script_all object
+ *
+ * size_t ref_count = cardano_script_all_refcount(script_all);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_all_refcount(const cardano_script_all_t* script_all);
+
+/**
+ * \brief Sets the last error message for a given script_all object.
+ *
+ * Records an error message in the script_all's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] script_all A pointer to the \ref cardano_script_all_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the script_all's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_script_all_set_last_error(cardano_script_all_t* script_all, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific script_all.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_script_all_set_last_error for the given
+ * script_all. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] script_all A pointer to the \ref cardano_script_all_t instance whose last error
+ *                   message is to be retrieved. If the script_all is NULL, the function
+ *                   returns a generic error message indicating the null script_all.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified script_all. If the script_all is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_script_all_set_last_error for the same script_all, or until
+ *       the script_all is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_script_all_get_last_error(const cardano_script_all_t* script_all);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_script_all_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_script_all_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_script_all_deep_clone(const cardano_script_all_t* source, cardano_script_all_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_ALL_H
diff --git a/vendor/include/cardano/scripts/native_scripts/script_any.h b/vendor/include/cardano/scripts/native_scripts/script_any.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/native_scripts/script_any.h
@@ -0,0 +1,623 @@
+/**
+ * \file script_any.h
+ *
+ * \author angel.castillo
+ * \date   May 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_ANY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_ANY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_t cardano_native_script_t;
+
+/**
+ * \brief This script evaluates to true if any the sub-scripts evaluate to true.
+ *
+ * If the list of sub-scripts is empty, this script evaluates to true.
+ */
+typedef struct cardano_script_any_t cardano_script_any_t;
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_list_t cardano_native_script_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a script_any.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_script_any_t
+ * with a provided list of native scripts. It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[in] native_scripts A pointer to a \ref cardano_native_script_list_t containing the list of native scripts.
+ * \param[out] script_any On successful initialization, this will point to a newly created
+ *             \ref cardano_script_any_t object. This object represents a "strong reference"
+ *             to the script_any, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script_any is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_any_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_any was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_scripts = ...; // Assume this is initialized
+ * cardano_script_any_t* script_any = NULL;
+ *
+ * // Attempt to create a new script_any
+ * cardano_error_t result = cardano_script_any_new(native_scripts, &script_any);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_any
+ *
+ *   // Once done, ensure to clean up and release the script_any
+ *   cardano_script_any_unref(&script_any);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_any_new(cardano_native_script_list_t* native_scripts, cardano_script_any_t** script_any);
+
+/**
+ * \brief Creates a script_any from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_script_any_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a script_any.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded script_any data.
+ * \param[out] script_any A pointer to a pointer of \ref cardano_script_any_t that will be set to the address
+ *                        of the newly created script_any object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_any was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_any object is created using \ref cardano_script_any_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_any_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_any_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_script_any_t object by calling
+ *       \ref cardano_script_any_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_script_any_t* script_any = NULL;
+ *
+ * cardano_error_t result = cardano_script_any_from_cbor(reader, &script_any);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_any
+ *
+ *   // Once done, ensure to clean up and release the script_any
+ *   cardano_script_any_unref(&script_any);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode script_any: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_any_from_cbor(cardano_cbor_reader_t* reader, cardano_script_any_t** script_any);
+
+/**
+ * \brief Serializes a script_any into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_script_any_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] script_any A constant pointer to the \ref cardano_script_any_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p script_any or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_any object is created using \ref cardano_script_any_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_any_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_any_clear_cbor_cache after the object has been created.
+ *
+ * \warning The sub-scripts keep the CBOR they were decoded with, and this object keeps its own. A change made to a sub-script,
+ *          or to the list returned by \ref cardano_script_any_get_scripts, after this object was decoded with
+ *          \ref cardano_script_any_from_cbor cannot discard the CBOR cached by this object, so \ref cardano_script_any_to_cbor would
+ *          still output the original bytes. Call \ref cardano_script_any_clear_cbor_cache after such a change so that it is serialized.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_any_t* script_any = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_script_any_to_cbor(script_any, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_script_any_unref(&script_any);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_any_to_cbor(
+  const cardano_script_any_t* script_any,
+  cardano_cbor_writer_t*      writer);
+
+/**
+ * \brief Serializes a native \c any script to CIP-116 JSON.
+ *
+ * This function writes the JSON representation of a native script of kind
+ * "any" into \p writer following the CIP-116.
+ *
+ * The function emits a complete JSON object (it writes the opening and
+ * closing braces). It can be called at the root, as an array element, or
+ * as the value of a property in an enclosing object.
+ *
+ * For determinism, fields are written in the order: \c "tag" then \c "scripts".
+ *
+ * \param[in]     script_any A valid pointer to an \ref cardano_script_any_t.
+ * \param[in,out] writer     A valid JSON writer positioned where a value is expected.
+ *
+ * \return CARDANO_SUCCESS               The script was serialized successfully.
+ * \return CARDANO_ERROR_POINTER_IS_NULL \p script_any or \p writer is \c NULL.
+ * \return CARDANO_ERROR_ENCODING        A nested script failed to serialize or the writer
+ *                                       reported an encoding error.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_any_to_cip116_json(
+  const cardano_script_any_t* script_any,
+  cardano_json_writer_t*      writer);
+
+/**
+ * \brief Creates a script_any from a JSON string.
+ *
+ * This function parses JSON data using a provided JSON string and constructs a \ref cardano_script_any_t object.
+ * It assumes that the JSON data corresponds to the structure expected for a script_any.
+ *
+ * \param[in] json A pointer to a null-terminated string containing the JSON-encoded script_any data. This string
+ *                 must not be NULL.
+ * \param[in] json_size The size of the JSON string, excluding the null terminator.
+ * \param[out] native_script A pointer to a pointer of \ref cardano_script_any_t that will be set to the address
+ *                        of the newly created script_any object upon successful decoding. The caller is responsible
+ *                        for managing the lifecycle of this object by calling \ref cardano_script_any_unref when it
+ *                        is no longer needed.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_any was successfully created, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* json_string = "{\"type\": \"any\", \"scripts\": [...]}"; // Example JSON string
+ * size_t json_size = strlen(json_string); // Calculate the size of the JSON string
+ * cardano_script_any_t* script_any = NULL;
+ *
+ * // Attempt to create a new script_any from a JSON string
+ * cardano_error_t result = cardano_script_any_from_json(json_string, json_size, &script_any);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_any
+ *
+ *   // Once done, ensure to clean up and release the script_any
+ *   cardano_script_any_unref(&script_any);
+ * }
+ * else
+ * {
+ *   printf("Failed to create script_any from JSON. Error code: %d\n", result);
+ * }
+ * \endcode
+ */
+cardano_error_t
+cardano_script_any_from_json(const char* json, size_t json_size, cardano_script_any_t** native_script);
+
+/**
+ * \brief Retrieves the length of the script list in a script_any object.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_script_any_t script list.
+ *
+ * \param[in] script_any A constant pointer to the \ref cardano_script_any_t object whose scripts list length is to be retrieved.
+ *
+ * \return The number of scripts in the script_any. Returns 0 if the script_any is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_scripts = ...; // Assume this is initialized and populated
+ * cardano_script_any_t* script_any = NULL;
+ * cardano_script_any_new(native_scripts, &script_any);
+ *
+ * size_t length = cardano_script_any_get_length(script_any);
+ * printf("Length of the script_any scripts: %zu\n", length);
+ *
+ * // Clean up the script_any object once done
+ * cardano_script_any_unref(&script_any);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_any_get_length(const cardano_script_any_t* script_any);
+
+/**
+ * \brief Retrieves the list of native scripts associated with a \ref cardano_script_any_t.
+ *
+ * This function provides access to the list of native scripts in a \ref cardano_script_any_t object.
+ * It returns a reference to a \ref cardano_native_script_list_t object representing the scripts.
+ * This allows the scripts to be used independently of the original \ref cardano_script_any_t object. The
+ * reference count of the list object is increased by one, making it the caller's responsibility
+ * to release it by calling \ref cardano_native_script_list_unref when it is no longer needed.
+ *
+ * \param[in] script_any A constant pointer to the \ref cardano_script_any_t object from which
+ *                       the list of native scripts is to be retrieved.
+ * \param[out] list A pointer to store the reference to the \ref cardano_native_script_list_t object containing the scripts.
+ *                  If the input script_any is NULL, returns NULL. The caller is responsible for
+ *                  managing the lifecycle of this object, including releasing it with
+ *                  \ref cardano_native_script_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the list of scripts was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * \warning The sub-scripts keep the CBOR they were decoded with, and this object keeps its own. A change made to a sub-script,
+ *          or to the list returned by \ref cardano_script_any_get_scripts, after this object was decoded with
+ *          \ref cardano_script_any_from_cbor cannot discard the CBOR cached by this object, so \ref cardano_script_any_to_cbor would
+ *          still output the original bytes. Call \ref cardano_script_any_clear_cbor_cache after such a change so that it is serialized.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_any_t* script_any = cardano_script_any_new(...);
+ * cardano_native_script_list_t* list_scripts = NULL;
+ *
+ * // Attempt to retrieve the list of native scripts associated with script_any
+ * cardano_error_t result = cardano_script_any_get_scripts(script_any, &list_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list_scripts
+ *
+ *   // Once done, ensure to clean up and release the list_scripts
+ *   cardano_native_script_list_unref(&list_scripts);
+ * }
+ *
+ * // Release the script_any object after use
+ * cardano_script_any_unref(&script_any);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_any_get_scripts(
+  cardano_script_any_t*          script_any,
+  cardano_native_script_list_t** list);
+
+/**
+ * \brief Sets the list of native scripts associated with a \ref cardano_script_any_t.
+ *
+ * This function sets the list of native scripts for a \ref cardano_script_any_t object to the provided
+ * \ref cardano_native_script_list_t object. It replaces any existing scripts associated with the \ref cardano_script_any_t.
+ * The reference count of the provided list object is increased by one, making it the caller's responsibility
+ * to release it when it is no longer needed.
+ *
+ * \param[in] script_any A pointer to the \ref cardano_script_any_t object to which
+ *                       the list of native scripts is to be set.
+ * \param[in] list A pointer to the \ref cardano_native_script_list_t object containing the new scripts to be set.
+ *
+ * \return \ref CARDANO_SUCCESS if the scripts were successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * \note A successful call discards the CBOR that the object cached when it was decoded with \ref cardano_script_any_from_cbor,
+ *       so the next call to \ref cardano_script_any_to_cbor encodes the script from its fields.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_any_t* script_any = cardano_script_any_new(...);
+ * cardano_native_script_list_t* new_list = ...; // Assume new_list is initialized here
+ *
+ * // Attempt to set the new list of scripts associated with the script_any
+ * cardano_error_t result = cardano_script_any_set_scripts(script_any, new_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Scripts successfully set
+ *   printf("Scripts set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Failed to set scripts: %s.\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Release the script_any object after use
+ * cardano_script_any_unref(&script_any);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_any_set_scripts(
+  cardano_script_any_t*         script_any,
+  cardano_native_script_list_t* list);
+
+/**
+ * \brief Checks if two script_any objects are equal.
+ *
+ * This function compares two \ref cardano_script_any_t objects to determine if they are equal. Two script_any
+ * objects are considered equal if they have the same number of elements and each corresponding pair of elements
+ * is equal according to the \ref cardano_native_script_equals function.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_script_any_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_script_any_t object to be compared.
+ *
+ * \return \c true if the two script_any objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_any_t* script1 = ...;  // Assume script1 is initialized here
+ * cardano_script_any_t* script2 = ...;  // Assume script2 is initialized here
+ *
+ * if (cardano_script_any_equals(script1, script2))
+ * {
+ *   // The two script_any objects are equal
+ * }
+ * else
+ * {
+ *   // The two script_any objects are not equal
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_script_any_equals(const cardano_script_any_t* lhs, const cardano_script_any_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a script_any.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_script_any_t object.
+ * It is useful when you have modified the script_any after it was created from CBOR using
+ * \ref cardano_script_any_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the script_any, rather than using the original cached CBOR.
+ * The cached CBOR of every sub-script in the list of the script_any is cleared as well, so the whole script is encoded from
+ * its fields.
+ *
+ * \param[in,out] script_any A pointer to an initialized \ref cardano_script_any_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the script when
+ *          serialized, which changes its hash, and with it the policy id, the address or the credential derived from it.
+ *          Use this function with caution, especially if the script is already on chain or if preserving
+ *          the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume script_any was created using cardano_script_any_from_cbor
+ * cardano_script_any_t* script_any = ...;
+ * cardano_native_script_t* new_script = ...;
+ * cardano_native_script_list_t* scripts = NULL;
+ *
+ * cardano_error_t result = cardano_script_any_get_scripts(script_any, &scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Modify the list of sub-scripts, this does not reach the cache of the script_any
+ *   result = cardano_native_script_list_add(scripts, new_script);
+ *   cardano_native_script_list_unref(&scripts);
+ * }
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated script_any
+ * cardano_script_any_clear_cbor_cache(script_any);
+ *
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_script_any_to_cbor(script_any, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_script_any_unref(&script_any);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_script_any_clear_cbor_cache(cardano_script_any_t* script_any);
+
+/**
+ * \brief Decrements the reference count of a script_any object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_script_any_t object
+ * by decreasing its reference count. When the reference count reaches zero, the script_any is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] script_any A pointer to the pointer of the script_any object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_any_t* script_any = ...; // Assume script_any is initialized here
+ *
+ * // Perform operations with the script_any...
+ *
+ * cardano_script_any_unref(&script_any);
+ * // At this point, script_any is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_script_any_unref, the pointer to the \ref cardano_script_any_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_script_any_unref(cardano_script_any_t** script_any);
+
+/**
+ * \brief Increases the reference count of the cardano_script_any_t object.
+ *
+ * This function is used to manually increment the reference count of a script_any
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until any owners have released their
+ * reference by calling \ref cardano_script_any_unref.
+ *
+ * \param script_any A pointer to the script_any object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_any is a previously created script_any object
+ *
+ * cardano_script_any_ref(script_any);
+ *
+ * // Now script_any can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_script_any_ref there is a corresponding
+ * call to \ref cardano_script_any_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_script_any_ref(cardano_script_any_t* script_any);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_script_any_t object.
+ *
+ * This function returns the number of active references to a script_any object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_script_any_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param script_any A pointer to the script_any object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified script_any object. If the object
+ * is properly managed (i.e., every \ref cardano_script_any_ref call is matched with a
+ * \ref cardano_script_any_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_any is a previously created script_any object
+ *
+ * size_t ref_count = cardano_script_any_refcount(script_any);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_any_refcount(const cardano_script_any_t* script_any);
+
+/**
+ * \brief Sets the last error message for a given script_any object.
+ *
+ * Records an error message in the script_any's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] script_any A pointer to the \ref cardano_script_any_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the script_any's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_script_any_set_last_error(cardano_script_any_t* script_any, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific script_any.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_script_any_set_last_error for the given
+ * script_any. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] script_any A pointer to the \ref cardano_script_any_t instance whose last error
+ *                   message is to be retrieved. If the script_any is NULL, the function
+ *                   returns a generic error message indicating the null script_any.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified script_any. If the script_any is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_script_any_set_last_error for the same script_any, or until
+ *       the script_any is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_script_any_get_last_error(const cardano_script_any_t* script_any);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_script_any_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_script_any_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_script_any_deep_clone(const cardano_script_any_t* source, cardano_script_any_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_ANY_H
diff --git a/vendor/include/cardano/scripts/native_scripts/script_invalid_after.h b/vendor/include/cardano/scripts/native_scripts/script_invalid_after.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/native_scripts/script_invalid_after.h
@@ -0,0 +1,572 @@
+/**
+ * \file script_invalid_after.h
+ *
+ * \author angel.castillo
+ * \date   May 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF N_OF KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_INVALID_AFTER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_INVALID_AFTER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_t cardano_native_script_t;
+
+/**
+ * \brief This script evaluates to true if the upper bound of the transaction validity interval is a
+ * slot number Y, and X <= Y.
+ *
+ * This condition guarantees that the actual slot number in which the transaction is included is
+ * (strictly) less than slot number X.
+ */
+typedef struct cardano_script_invalid_after_t cardano_script_invalid_after_t;
+
+/**
+ * \brief Creates and initializes a new instance of a script_invalid_after.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_script_invalid_after_t
+ * with a provided slot number. It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[in] slot The slot number representing the upper bound of the transaction validity interval.
+ * \param[out] script_invalid_after On successful initialization, this will point to a newly created
+ *             \ref cardano_script_invalid_after_t object. This object represents a "strong reference"
+ *             to the script_invalid_after, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script_invalid_after is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_invalid_after_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_invalid_after was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t slot = 1000;
+ * cardano_script_invalid_after_t* script_invalid_after = NULL;
+ *
+ * // Attempt to create a new script_invalid_after
+ * cardano_error_t result = cardano_script_invalid_after_new(slot, &script_invalid_after);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_invalid_after
+ *
+ *   // Once done, ensure to clean up and release the script_invalid_after
+ *   cardano_script_invalid_after_unref(&script_invalid_after);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_invalid_after_new(uint64_t slot, cardano_script_invalid_after_t** script_invalid_after);
+
+/**
+ * \brief Creates a script_invalid_after from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_script_invalid_after_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a script_invalid_after.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded script_invalid_after data.
+ * \param[out] script_invalid_after A pointer to a pointer of \ref cardano_script_invalid_after_t that will be set to the address
+ *                        of the newly created script_invalid_after object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_invalid_after was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_invalid_after object is created using \ref cardano_script_invalid_after_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_invalid_after_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_invalid_after_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_script_invalid_after_t object by calling
+ *       \ref cardano_script_invalid_after_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_script_invalid_after_t* script_invalid_after = NULL;
+ *
+ * cardano_error_t result = cardano_script_invalid_after_from_cbor(reader, &script_invalid_after);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_invalid_after
+ *
+ *   // Once done, ensure to clean up and release the script_invalid_after
+ *   cardano_script_invalid_after_unref(&script_invalid_after);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode script_invalid_after: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_invalid_after_from_cbor(cardano_cbor_reader_t* reader, cardano_script_invalid_after_t** script_invalid_after);
+
+/**
+ * \brief Serializes a script_invalid_after into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_script_invalid_after_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] script_invalid_after A constant pointer to the \ref cardano_script_invalid_after_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p script_invalid_after or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_invalid_after object is created using \ref cardano_script_invalid_after_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_invalid_after_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_invalid_after_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_invalid_after_t* script_invalid_after = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_script_invalid_after_to_cbor(script_invalid_after, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_script_invalid_after_unref(&script_invalid_after);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_invalid_after_to_cbor(
+  const cardano_script_invalid_after_t* script_invalid_after,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes a native script "timelock_expiry" to CIP-116 JSON.
+ *
+ * Writes a single JSON object representing a timelock that is invalid after a
+ * given slot. The function emits the surrounding braces `{}` and the object
+ * contains the fields shown below.
+ *
+ * JSON shape:
+ * \code{.json}
+ * {
+ *   "tag":  "timelock_expiry",
+ *   "slot": "<uint>"
+ * }
+ * \endcode
+ *
+ * \param[in]  script_invalid_after A valid pointer to the timelock object to serialize.
+ * \param[in]  writer               A valid JSON writer positioned where a value is expected.
+ *
+ * \return \c CARDANO_SUCCESS on success; \c CARDANO_ERROR_POINTER_IS_NULL if
+ * either parameter is \c NULL.
+ *
+ * \note Keys are emitted in a stable order: first \c "tag", then \c "slot".
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_invalid_after_to_cip116_json(
+  const cardano_script_invalid_after_t* script_invalid_after,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Creates a script_invalid_after from a JSON string.
+ *
+ * This function parses JSON data using a provided JSON string and constructs a \ref cardano_script_invalid_after_t object.
+ * It assumes that the JSON data corresponds to the structure expected for a script_invalid_after.
+ *
+ * \param[in] json A pointer to a null-terminated string containing the JSON-encoded script_invalid_after data. This string
+ *                 must not be NULL.
+ * \param[in] json_size The size of the JSON string, excluding the null terminator.
+ * \param[out] native_script A pointer to a pointer of \ref cardano_script_invalid_after_t that will be set to the address
+ *                           of the newly created script_invalid_after object upon successful decoding. The caller is responsible
+ *                           for managing the lifecycle of this object by calling \ref cardano_script_invalid_after_unref when it
+ *                           is no longer needed.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_invalid_after was successfully created, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* json_string = "{\"type\": \"before\", \"slot\": 1000}"; // Example JSON string
+ * size_t json_size = strlen(json_string); // Calculate the size of the JSON string
+ * cardano_script_invalid_after_t* script_invalid_after = NULL;
+ *
+ * // Attempt to create a new script_invalid_after from a JSON string
+ * cardano_error_t result = cardano_script_invalid_after_from_json(json_string, json_size, &script_invalid_after);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_invalid_after
+ *
+ *   // Once done, ensure to clean up and release the script_invalid_after
+ *   cardano_script_invalid_after_unref(&script_invalid_after);
+ * }
+ * else
+ * {
+ *   printf("Failed to create script_invalid_after from JSON. Error code: %d\n", result);
+ * }
+ * \endcode
+ */
+cardano_error_t
+cardano_script_invalid_after_from_json(const char* json, size_t json_size, cardano_script_invalid_after_t** native_script);
+
+/**
+ * \brief Retrieves the slot number from a script_invalid_after object.
+ *
+ * This function retrieves the slot number from the provided \ref cardano_script_invalid_after_t object and stores it in the provided
+ * output parameter.
+ *
+ * \param[in] script_invalid_after A constant pointer to the \ref cardano_script_invalid_after_t object from which
+ *                                 the slot number is to be retrieved. The object must not be NULL.
+ * \param[out] slot Pointer to a variable where the slot number will be stored.
+ *                  This variable will be set to the retrieved slot number.
+ *
+ * \return \ref CARDANO_SUCCESS if the slot number was successfully retrieved, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_invalid_after_t* script_invalid_after = ...; // Assume script_invalid_after is initialized
+ * uint64_t slot;
+ * cardano_error_t result = cardano_script_invalid_after_get_slot(script_invalid_after, &slot);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the slot number
+ *   printf("Slot number: %llu\n", (unsigned long long)slot);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Failed to retrieve slot number: %s.\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the script_invalid_after object once done
+ * cardano_script_invalid_after_unref(&script_invalid_after);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_invalid_after_get_slot(const cardano_script_invalid_after_t* script_invalid_after, uint64_t* slot);
+
+/**
+ * \brief Sets the slot number for a script_invalid_after object.
+ *
+ * This function sets the slot number for the provided \ref cardano_script_invalid_after_t object.
+ *
+ * \param[in] script_invalid_after A pointer to the \ref cardano_script_invalid_after_t object for which
+ *                                 the slot number is to be set.
+ * \param[in] slot The slot number to set.
+ *
+ * \return \ref CARDANO_SUCCESS if the slot number was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * \note A successful call discards the CBOR that the object cached when it was decoded with \ref cardano_script_invalid_after_from_cbor,
+ *       so the next call to \ref cardano_script_invalid_after_to_cbor encodes the script from its fields.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_invalid_after_t* script_invalid_after = ...; // Assume script_invalid_after is initialized
+ * uint64_t slot = 1000;
+ *
+ * // Set the slot number for the script_invalid_after
+ * cardano_error_t result = cardano_script_invalid_after_set_slot(script_invalid_after, slot);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Slot number set successfully
+ * }
+ *
+ * // Clean up the script_invalid_after object once done
+ * cardano_script_invalid_after_unref(&script_invalid_after);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_invalid_after_set_slot(cardano_script_invalid_after_t* script_invalid_after, uint64_t slot);
+
+/**
+ * \brief Checks if two script_invalid_after objects are equal.
+ *
+ * This function compares two \ref cardano_script_invalid_after_t objects to determine if they are equal.
+ * Two script_invalid_after objects are considered equal if they have the same slot number.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_script_invalid_after_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_script_invalid_after_t object to be compared.
+ *
+ * \return \c true if the two script_invalid_after objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t slot1 = 1000;
+ * uint64_t slot2 = 1000;
+ * cardano_script_invalid_after_t* script_invalid_after1 = NULL;
+ * cardano_script_invalid_after_t* script_invalid_after2 = NULL;
+ *
+ * cardano_script_invalid_after_new(slot1, &script_invalid_after1);
+ * cardano_script_invalid_after_new(slot2, &script_invalid_after2);
+ *
+ * if (cardano_script_invalid_after_equals(script_invalid_after1, script_invalid_after2))
+ * {
+ *   // The two script_invalid_after objects are equal
+ * }
+ * else
+ * {
+ *   // The two script_invalid_after objects are not equal
+ * }
+ *
+ * // Clean up the script_invalid_after objects once done
+ * cardano_script_invalid_after_unref(&script_invalid_after1);
+ * cardano_script_invalid_after_unref(&script_invalid_after2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_script_invalid_after_equals(const cardano_script_invalid_after_t* lhs, const cardano_script_invalid_after_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a script_invalid_after.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_script_invalid_after_t object.
+ * It is useful when you have modified the script_invalid_after after it was created from CBOR using
+ * \ref cardano_script_invalid_after_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the script_invalid_after, rather than using the original cached CBOR.
+ *
+ * \param[in,out] script_invalid_after A pointer to an initialized \ref cardano_script_invalid_after_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the script when
+ *          serialized, which changes its hash, and with it the policy id, the address or the credential derived from it.
+ *          Use this function with caution, especially if the script is already on chain or if preserving
+ *          the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume script_invalid_after was created using cardano_script_invalid_after_from_cbor
+ * cardano_script_invalid_after_t* script_invalid_after = ...;
+ *
+ * // Clear the CBOR cache so that serialization encodes the script from its fields
+ * cardano_script_invalid_after_clear_cbor_cache(script_invalid_after);
+ *
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * cardano_error_t result = cardano_script_invalid_after_to_cbor(script_invalid_after, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_script_invalid_after_unref(&script_invalid_after);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_script_invalid_after_clear_cbor_cache(cardano_script_invalid_after_t* script_invalid_after);
+
+/**
+ * \brief Decrements the reference count of a script_invalid_after object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_script_invalid_after_t object
+ * by decreasing its reference count. When the reference count reaches zero, the script_invalid_after is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] script_invalid_after A pointer to the pointer of the script_invalid_after object. This double
+ *                            indirection n_ofows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_invalid_after_t* script_invalid_after = cardano_script_invalid_after_new();
+ *
+ * // Perform operations with the script_invalid_after...
+ *
+ * cardano_script_invalid_after_unref(&script_invalid_after);
+ * // At this point, script_invalid_after is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_script_invalid_after_unref, the pointer to the \ref cardano_script_invalid_after_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_script_invalid_after_unref(cardano_script_invalid_after_t** script_invalid_after);
+
+/**
+ * \brief Increases the reference count of the cardano_script_invalid_after_t object.
+ *
+ * This function is used to manun_ofy increment the reference count of a script_invalid_after
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains n_ofocated and valid until n_of owners have released their
+ * reference by calling \ref cardano_script_invalid_after_unref.
+ *
+ * \param script_invalid_after A pointer to the script_invalid_after object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_invalid_after is a previously created script_invalid_after object
+ *
+ * cardano_script_invalid_after_ref(script_invalid_after);
+ *
+ * // Now script_invalid_after can be safely used elsewhere without worrying about premature den_ofocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_script_invalid_after_ref there is a corresponding
+ * call to \ref cardano_script_invalid_after_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_script_invalid_after_ref(cardano_script_invalid_after_t* script_invalid_after);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_script_invalid_after_t object.
+ *
+ * This function returns the number of active references to a script_invalid_after object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_script_invalid_after_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param script_invalid_after A pointer to the script_invalid_after object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified script_invalid_after object. If the object
+ * is properly managed (i.e., every \ref cardano_script_invalid_after_ref call is matched with a
+ * \ref cardano_script_invalid_after_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_invalid_after is a previously created script_invalid_after object
+ *
+ * size_t ref_count = cardano_script_invalid_after_refcount(script_invalid_after);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_invalid_after_refcount(const cardano_script_invalid_after_t* script_invalid_after);
+
+/**
+ * \brief Sets the last error message for a given script_invalid_after object.
+ *
+ * Records an error message in the script_invalid_after's last_error buffer, overwriting n_of existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] script_invalid_after A pointer to the \ref cardano_script_invalid_after_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the script_invalid_after's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_script_invalid_after_set_last_error(cardano_script_invalid_after_t* script_invalid_after, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific script_invalid_after.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_script_invalid_after_set_last_error for the given
+ * script_invalid_after. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] script_invalid_after A pointer to the \ref cardano_script_invalid_after_t instance whose last error
+ *                   message is to be retrieved. If the script_invalid_after is NULL, the function
+ *                   returns a generic error message indicating the null script_invalid_after.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified script_invalid_after. If the script_invalid_after is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_script_invalid_after_set_last_error for the same script_invalid_after, or until
+ *       the script_invalid_after is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_script_invalid_after_get_last_error(const cardano_script_invalid_after_t* script_invalid_after);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_script_invalid_after_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_script_invalid_after_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_script_invalid_after_deep_clone(const cardano_script_invalid_after_t* source, cardano_script_invalid_after_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_INVALID_AFTER_H
diff --git a/vendor/include/cardano/scripts/native_scripts/script_invalid_before.h b/vendor/include/cardano/scripts/native_scripts/script_invalid_before.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/native_scripts/script_invalid_before.h
@@ -0,0 +1,572 @@
+/**
+ * \file script_invalid_before.h
+ *
+ * \author angel.castillo
+ * \date   May 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF N_OF KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_INVALID_BEFORE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_INVALID_BEFORE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_t cardano_native_script_t;
+
+/**
+ * \brief This script evaluates to true if the lower bound of the transaction validity interval is a
+ * slot number Y, and Y >= X.
+ *
+ * This condition guarantees that the actual slot number in which the transaction is included
+ * is greater than or equal to slot number X.
+ */
+typedef struct cardano_script_invalid_before_t cardano_script_invalid_before_t;
+
+/**
+ * \brief Creates and initializes a new instance of a script_invalid_before.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_script_invalid_before_t
+ * with a provided slot number. It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[in] slot The slot number representing the upper bound of the transaction validity interval.
+ * \param[out] script_invalid_before On successful initialization, this will point to a newly created
+ *             \ref cardano_script_invalid_before_t object. This object represents a "strong reference"
+ *             to the script_invalid_before, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script_invalid_before is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_invalid_before_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_invalid_before was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t slot = 1000;
+ * cardano_script_invalid_before_t* script_invalid_before = NULL;
+ *
+ * // Attempt to create a new script_invalid_before
+ * cardano_error_t result = cardano_script_invalid_before_new(slot, &script_invalid_before);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_invalid_before
+ *
+ *   // Once done, ensure to clean up and release the script_invalid_before
+ *   cardano_script_invalid_before_unref(&script_invalid_before);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_invalid_before_new(uint64_t slot, cardano_script_invalid_before_t** script_invalid_before);
+
+/**
+ * \brief Creates a script_invalid_before from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_script_invalid_before_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a script_invalid_before.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded script_invalid_before data.
+ * \param[out] script_invalid_before A pointer to a pointer of \ref cardano_script_invalid_before_t that will be set to the address
+ *                        of the newly created script_invalid_before object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_invalid_before was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_invalid_before object is created using \ref cardano_script_invalid_before_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_invalid_before_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_invalid_before_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_script_invalid_before_t object by calling
+ *       \ref cardano_script_invalid_before_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_script_invalid_before_t* script_invalid_before = NULL;
+ *
+ * cardano_error_t result = cardano_script_invalid_before_from_cbor(reader, &script_invalid_before);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_invalid_before
+ *
+ *   // Once done, ensure to clean up and release the script_invalid_before
+ *   cardano_script_invalid_before_unref(&script_invalid_before);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode script_invalid_before: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_invalid_before_from_cbor(cardano_cbor_reader_t* reader, cardano_script_invalid_before_t** script_invalid_before);
+
+/**
+ * \brief Serializes a script_invalid_before into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_script_invalid_before_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] script_invalid_before A constant pointer to the \ref cardano_script_invalid_before_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p script_invalid_before or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_invalid_before object is created using \ref cardano_script_invalid_before_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_invalid_before_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_invalid_before_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_invalid_before_t* script_invalid_before = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_script_invalid_before_to_cbor(script_invalid_before, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_script_invalid_before_unref(&script_invalid_before);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_invalid_before_to_cbor(
+  const cardano_script_invalid_before_t* script_invalid_before,
+  cardano_cbor_writer_t*                 writer);
+
+/**
+ * \brief Serializes a native script "timelock_start" to CIP-116 JSON.
+ *
+ * Writes a single JSON object representing a timelock that is invalid before a
+ * given slot. The function emits the surrounding braces `{}` and the object
+ * contains the fields shown below.
+ *
+ * JSON shape:
+ * \code{.json}
+ * {
+ *   "tag":  "timelock_start",
+ *   "slot": "<uint>"
+ * }
+ * \endcode
+ *
+ * \param[in]  script_invalid_before A valid pointer to the timelock object to serialize.
+ * \param[in]  writer               A valid JSON writer positioned where a value is expected.
+ *
+ * \return \c CARDANO_SUCCESS on success; \c CARDANO_ERROR_POINTER_IS_NULL if
+ * either parameter is \c NULL.
+ *
+ * \note Keys are emitted in a stable order: first \c "tag", then \c "slot".
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_invalid_before_to_cip116_json(
+  const cardano_script_invalid_before_t* script_invalid_before,
+  cardano_json_writer_t*                 writer);
+
+/**
+ * \brief Creates a script_invalid_before from a JSON string.
+ *
+ * This function parses JSON data using a provided JSON string and constructs a \ref cardano_script_invalid_before_t object.
+ * It assumes that the JSON data corresponds to the structure expected for a script_invalid_before.
+ *
+ * \param[in] json A pointer to a null-terminated string containing the JSON-encoded script_invalid_before data. This string
+ *                 must not be NULL.
+ * \param[in] json_size The size of the JSON string, excluding the null terminator.
+ * \param[out] native_script A pointer to a pointer of \ref cardano_script_invalid_before_t that will be set to the address
+ *                                   of the newly created script_invalid_before object upon successful decoding. The caller is responsible
+ *                                   for managing the lifecycle of this object by calling \ref cardano_script_invalid_before_unref when it
+ *                                   is no longer needed.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_invalid_before was successfully created, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* json_string = "{\"type\": \"after\", \"slot\": 500}"; // Example JSON string
+ * size_t json_size = strlen(json_string); // Calculate the size of the JSON string
+ * cardano_script_invalid_before_t* script_invalid_before = NULL;
+ *
+ * // Attempt to create a new script_invalid_before from a JSON string
+ * cardano_error_t result = cardano_script_invalid_before_from_json(json_string, json_size, &script_invalid_before);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_invalid_before
+ *
+ *   // Once done, ensure to clean up and release the script_invalid_before
+ *   cardano_script_invalid_before_unref(&script_invalid_before);
+ * }
+ * else
+ * {
+ *   printf("Failed to create script_invalid_before from JSON. Error code: %d\n", result);
+ * }
+ * \endcode
+ */
+cardano_error_t
+cardano_script_invalid_before_from_json(const char* json, size_t json_size, cardano_script_invalid_before_t** native_script);
+
+/**
+ * \brief Retrieves the slot number from a script_invalid_before object.
+ *
+ * This function retrieves the slot number from the provided \ref cardano_script_invalid_before_t object and stores it in the provided
+ * output parameter.
+ *
+ * \param[in] script_invalid_before A constant pointer to the \ref cardano_script_invalid_before_t object from which
+ *                                 the slot number is to be retrieved. The object must not be NULL.
+ * \param[out] slot Pointer to a variable where the slot number will be stored.
+ *                  This variable will be set to the retrieved slot number.
+ *
+ * \return \ref CARDANO_SUCCESS if the slot number was successfully retrieved, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_invalid_before_t* script_invalid_before = ...; // Assume script_invalid_before is initialized
+ * uint64_t slot;
+ * cardano_error_t result = cardano_script_invalid_before_get_slot(script_invalid_before, &slot);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the slot number
+ *   printf("Slot number: %llu\n", (unsigned long long)slot);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Failed to retrieve slot number: %s.\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the script_invalid_before object once done
+ * cardano_script_invalid_before_unref(&script_invalid_before);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_invalid_before_get_slot(const cardano_script_invalid_before_t* script_invalid_before, uint64_t* slot);
+
+/**
+ * \brief Sets the slot number for a script_invalid_before object.
+ *
+ * This function sets the slot number for the provided \ref cardano_script_invalid_before_t object.
+ *
+ * \param[in] script_invalid_before A pointer to the \ref cardano_script_invalid_before_t object for which
+ *                                 the slot number is to be set.
+ * \param[in] slot The slot number to set.
+ *
+ * \return \ref CARDANO_SUCCESS if the slot number was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * \note A successful call discards the CBOR that the object cached when it was decoded with \ref cardano_script_invalid_before_from_cbor,
+ *       so the next call to \ref cardano_script_invalid_before_to_cbor encodes the script from its fields.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_invalid_before_t* script_invalid_before = ...; // Assume script_invalid_before is initialized
+ * uint64_t slot = 1000;
+ *
+ * // Set the slot number for the script_invalid_before
+ * cardano_error_t result = cardano_script_invalid_before_set_slot(script_invalid_before, slot);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Slot number set successfully
+ * }
+ *
+ * // Clean up the script_invalid_before object once done
+ * cardano_script_invalid_before_unref(&script_invalid_before);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_invalid_before_set_slot(cardano_script_invalid_before_t* script_invalid_before, uint64_t slot);
+
+/**
+ * \brief Checks if two script_invalid_before objects are equal.
+ *
+ * This function compares two \ref cardano_script_invalid_before_t objects to determine if they are equal.
+ * Two script_invalid_before objects are considered equal if they have the same slot number.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_script_invalid_before_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_script_invalid_before_t object to be compared.
+ *
+ * \return \c true if the two script_invalid_before objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t slot1 = 1000;
+ * uint64_t slot2 = 1000;
+ * cardano_script_invalid_before_t* script_invalid_before1 = NULL;
+ * cardano_script_invalid_before_t* script_invalid_before2 = NULL;
+ *
+ * cardano_script_invalid_before_new(slot1, &script_invalid_before1);
+ * cardano_script_invalid_before_new(slot2, &script_invalid_before2);
+ *
+ * if (cardano_script_invalid_before_equals(script_invalid_before1, script_invalid_before2))
+ * {
+ *   // The two script_invalid_before objects are equal
+ * }
+ * else
+ * {
+ *   // The two script_invalid_before objects are not equal
+ * }
+ *
+ * // Clean up the script_invalid_before objects once done
+ * cardano_script_invalid_before_unref(&script_invalid_before1);
+ * cardano_script_invalid_before_unref(&script_invalid_before2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_script_invalid_before_equals(const cardano_script_invalid_before_t* lhs, const cardano_script_invalid_before_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a script_invalid_before.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_script_invalid_before_t object.
+ * It is useful when you have modified the script_invalid_before after it was created from CBOR using
+ * \ref cardano_script_invalid_before_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the script_invalid_before, rather than using the original cached CBOR.
+ *
+ * \param[in,out] script_invalid_before A pointer to an initialized \ref cardano_script_invalid_before_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the script when
+ *          serialized, which changes its hash, and with it the policy id, the address or the credential derived from it.
+ *          Use this function with caution, especially if the script is already on chain or if preserving
+ *          the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume script_invalid_before was created using cardano_script_invalid_before_from_cbor
+ * cardano_script_invalid_before_t* script_invalid_before = ...;
+ *
+ * // Clear the CBOR cache so that serialization encodes the script from its fields
+ * cardano_script_invalid_before_clear_cbor_cache(script_invalid_before);
+ *
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * cardano_error_t result = cardano_script_invalid_before_to_cbor(script_invalid_before, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_script_invalid_before_unref(&script_invalid_before);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_script_invalid_before_clear_cbor_cache(cardano_script_invalid_before_t* script_invalid_before);
+
+/**
+ * \brief Decrements the reference count of a script_invalid_before object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_script_invalid_before_t object
+ * by decreasing its reference count. When the reference count reaches zero, the script_invalid_before is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] script_invalid_before A pointer to the pointer of the script_invalid_before object. This double
+ *                            indirection n_ofows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_invalid_before_t* script_invalid_before = cardano_script_invalid_before_new();
+ *
+ * // Perform operations with the script_invalid_before...
+ *
+ * cardano_script_invalid_before_unref(&script_invalid_before);
+ * // At this point, script_invalid_before is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_script_invalid_before_unref, the pointer to the \ref cardano_script_invalid_before_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_script_invalid_before_unref(cardano_script_invalid_before_t** script_invalid_before);
+
+/**
+ * \brief Increases the reference count of the cardano_script_invalid_before_t object.
+ *
+ * This function is used to manun_ofy increment the reference count of a script_invalid_before
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains n_ofocated and valid until n_of owners have released their
+ * reference by calling \ref cardano_script_invalid_before_unref.
+ *
+ * \param script_invalid_before A pointer to the script_invalid_before object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_invalid_before is a previously created script_invalid_before object
+ *
+ * cardano_script_invalid_before_ref(script_invalid_before);
+ *
+ * // Now script_invalid_before can be safely used elsewhere without worrying about premature den_ofocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_script_invalid_before_ref there is a corresponding
+ * call to \ref cardano_script_invalid_before_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_script_invalid_before_ref(cardano_script_invalid_before_t* script_invalid_before);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_script_invalid_before_t object.
+ *
+ * This function returns the number of active references to a script_invalid_before object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_script_invalid_before_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param script_invalid_before A pointer to the script_invalid_before object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified script_invalid_before object. If the object
+ * is properly managed (i.e., every \ref cardano_script_invalid_before_ref call is matched with a
+ * \ref cardano_script_invalid_before_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_invalid_before is a previously created script_invalid_before object
+ *
+ * size_t ref_count = cardano_script_invalid_before_refcount(script_invalid_before);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_invalid_before_refcount(const cardano_script_invalid_before_t* script_invalid_before);
+
+/**
+ * \brief Sets the last error message for a given script_invalid_before object.
+ *
+ * Records an error message in the script_invalid_before's last_error buffer, overwriting n_of existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] script_invalid_before A pointer to the \ref cardano_script_invalid_before_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the script_invalid_before's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_script_invalid_before_set_last_error(cardano_script_invalid_before_t* script_invalid_before, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific script_invalid_before.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_script_invalid_before_set_last_error for the given
+ * script_invalid_before. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] script_invalid_before A pointer to the \ref cardano_script_invalid_before_t instance whose last error
+ *                   message is to be retrieved. If the script_invalid_before is NULL, the function
+ *                   returns a generic error message indicating the null script_invalid_before.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified script_invalid_before. If the script_invalid_before is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_script_invalid_before_set_last_error for the same script_invalid_before, or until
+ *       the script_invalid_before is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_script_invalid_before_get_last_error(const cardano_script_invalid_before_t* script_invalid_before);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_script_invalid_before_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_script_invalid_before_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_script_invalid_before_deep_clone(const cardano_script_invalid_before_t* source, cardano_script_invalid_before_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_INVALID_BEFORE_H
diff --git a/vendor/include/cardano/scripts/native_scripts/script_n_of_k.h b/vendor/include/cardano/scripts/native_scripts/script_n_of_k.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/native_scripts/script_n_of_k.h
@@ -0,0 +1,696 @@
+/**
+ * \file script_n_of_k.h
+ *
+ * \author angel.castillo
+ * \date   May 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF N_OF KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_N_OF_K_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_N_OF_K_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_t cardano_native_script_t;
+
+/**
+ * \brief This script evaluates to true if at least M (required field) of the sub-scripts evaluate to true.
+ */
+typedef struct cardano_script_n_of_k_t cardano_script_n_of_k_t;
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_list_t cardano_native_script_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a script_n_of_k.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_script_n_of_k_t
+ * with a provided list of native scripts and the required number of sub-scripts that must evaluate to true.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[in] native_scripts A pointer to a \ref cardano_native_script_list_t containing the list of native scripts.
+ * \param[in] required The number of sub-scripts that must evaluate to true for this script_n_of_k to evaluate to true.
+ * \param[out] script_n_of_k On successful initialization, this will point to a newly created
+ *             \ref cardano_script_n_of_k_t object. This object represents a "strong reference"
+ *             to the script_n_of_k, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script_n_of_k is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_n_of_k_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_n_of_k was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_scripts = ...; // Assume this is initialized
+ * size_t required = 2; // Number of sub-scripts that must evaluate to true
+ * cardano_script_n_of_k_t* script_n_of_k = NULL;
+ *
+ * // Attempt to create a new script_n_of_k
+ * cardano_error_t result = cardano_script_n_of_k_new(native_scripts, required, &script_n_of_k);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_n_of_k
+ *
+ *   // Once done, ensure to clean up and release the script_n_of_k
+ *   cardano_script_n_of_k_unref(&script_n_of_k);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_n_of_k_new(cardano_native_script_list_t* native_scripts, size_t required, cardano_script_n_of_k_t** script_n_of_k);
+
+/**
+ * \brief Creates a script_n_of_k from a CBOR reader.
+ *
+ * Thresholds greater than SIZE_MAX return \ref CARDANO_ERROR_INTEGER_OVERFLOW.
+ * The supported threshold range follows the platform's size_t width.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_script_n_of_k_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a script_n_of_k.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded script_n_of_k data.
+ * \param[out] script_n_of_k A pointer to a pointer of \ref cardano_script_n_of_k_t that will be set to the address
+ *                        of the newly created script_n_of_k object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_n_of_k was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_n_of_k object is created using \ref cardano_script_n_of_k_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_n_of_k_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_n_of_k_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_script_n_of_k_t object by calling
+ *       \ref cardano_script_n_of_k_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_script_n_of_k_t* script_n_of_k = NULL;
+ *
+ * cardano_error_t result = cardano_script_n_of_k_from_cbor(reader, &script_n_of_k);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_n_of_k
+ *
+ *   // Once done, ensure to clean up and release the script_n_of_k
+ *   cardano_script_n_of_k_unref(&script_n_of_k);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode script_n_of_k: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_n_of_k_from_cbor(cardano_cbor_reader_t* reader, cardano_script_n_of_k_t** script_n_of_k);
+
+/**
+ * \brief Serializes a script_n_of_k into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_script_n_of_k_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] script_n_of_k A constant pointer to the \ref cardano_script_n_of_k_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p script_n_of_k or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_n_of_k object is created using \ref cardano_script_n_of_k_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_n_of_k_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_n_of_k_clear_cbor_cache after the object has been created.
+ *
+ * \warning The sub-scripts keep the CBOR they were decoded with, and this object keeps its own. A change made to a sub-script,
+ *          or to the list returned by \ref cardano_script_n_of_k_get_scripts, after this object was decoded with
+ *          \ref cardano_script_n_of_k_from_cbor cannot discard the CBOR cached by this object, so \ref cardano_script_n_of_k_to_cbor would
+ *          still output the original bytes. Call \ref cardano_script_n_of_k_clear_cbor_cache after such a change so that it is serialized.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_n_of_k_t* script_n_of_k = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_script_n_of_k_to_cbor(script_n_of_k, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_script_n_of_k_unref(&script_n_of_k);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_n_of_k_to_cbor(
+  const cardano_script_n_of_k_t* script_n_of_k,
+  cardano_cbor_writer_t*         writer);
+
+/**
+ * \brief Serializes a native \c n_of_k script to CIP-116 JSON.
+ *
+ * This function writes the JSON representation of a native script of kind
+ * "n-of-k" into \p writer following the CIP-116.
+ *
+ * The function emits a complete JSON object (it writes the opening and
+ * closing braces). It can be called at the root, as an array element, or
+ * as the value of a property in an enclosing object.
+ *
+ * For determinism, fields are written in the order: \c "tag", \c "scripts",
+ * then \c "n".
+ *
+ * \param[in]     script_n_of_k A valid pointer to an \ref cardano_script_n_of_k_t.
+ * \param[in,out] writer        A valid JSON writer positioned where a value is expected.
+ *
+ * \return CARDANO_SUCCESS               The script was serialized successfully.
+ * \return CARDANO_ERROR_POINTER_IS_NULL \p script_n_of_k or \p writer is \c NULL.
+ * \return CARDANO_ERROR_ENCODING        A nested script failed to serialize or the writer
+ *                                       reported an encoding error.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_n_of_k_to_cip116_json(
+  const cardano_script_n_of_k_t* script_n_of_k,
+  cardano_json_writer_t*         writer);
+
+/**
+ * \brief Creates a script_n_of_k from a JSON string.
+ *
+ * Thresholds greater than SIZE_MAX return \ref CARDANO_ERROR_INTEGER_OVERFLOW.
+ * The supported threshold range follows the platform's size_t width.
+ *
+ * This function parses JSON data using a provided JSON string and constructs a \ref cardano_script_n_of_k_t object.
+ * It assumes that the JSON data corresponds to the structure expected for a script_n_of_k.
+ *
+ * \param[in] json A pointer to a null-terminated string containing the JSON-encoded script_n_of_k data. This string
+ *                 must not be NULL.
+ * \param[in] json_size The size of the JSON string, excluding the null terminator.
+ * \param[out] native_script A pointer to a pointer of \ref cardano_script_n_of_k_t that will be set to the address
+ *                           of the newly created script_n_of_k object upon successful decoding. The caller is responsible
+ *                           for managing the lifecycle of this object by calling \ref cardano_script_n_of_k_unref when it
+ *                           is no longer needed.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_n_of_k was successfully created, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* json_string = "{\"type\": \"atLeast\", \"required\": 2, \"scripts\": [...]}"; // Example JSON string
+ * size_t json_size = strlen(json_string); // Calculate the size of the JSON string
+ * cardano_script_n_of_k_t* script_n_of_k = NULL;
+ *
+ * // Attempt to create a new script_n_of_k from a JSON string
+ * cardano_error_t result = cardano_script_n_of_k_from_json(json_string, json_size, &script_n_of_k);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_n_of_k
+ *
+ *   // Once done, ensure to clean up and release the script_n_of_k
+ *   cardano_script_n_of_k_unref(&script_n_of_k);
+ * }
+ * else
+ * {
+ *   printf("Failed to create script_n_of_k from JSON. Error code: %d\n", result);
+ * }
+ * \endcode
+ */
+cardano_error_t
+cardano_script_n_of_k_from_json(const char* json, size_t json_size, cardano_script_n_of_k_t** native_script);
+
+/**
+ * \brief Retrieves the length of the script list in a script_n_of_k object.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_script_n_of_k_t script list.
+ *
+ * \param[in] script_n_of_k A constant pointer to the \ref cardano_script_n_of_k_t object whose scripts list length is to be retrieved.
+ *
+ * \return The number of scripts in the script_n_of_k. Returns 0 if the script_n_of_k is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_list_t* native_scripts = ...; // Assume this is initialized and populated
+ * cardano_script_n_of_k_t* script_n_of_k = NULL;
+ * cardano_script_n_of_k_new(native_scripts, &script_n_of_k);
+ *
+ * size_t length = cardano_script_n_of_k_get_length(script_n_of_k);
+ * printf("Length of the script_n_of_k scripts: %zu\n", length);
+ *
+ * // Clean up the script_n_of_k object once done
+ * cardano_script_n_of_k_unref(&script_n_of_k);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_n_of_k_get_length(const cardano_script_n_of_k_t* script_n_of_k);
+
+/**
+ * \brief Retrieves the required number of sub-scripts that must evaluate to true for a script_n_of_k.
+ *
+ * This function retrieves the number of sub-scripts that must evaluate to true for the provided \ref cardano_script_n_of_k_t
+ * object to evaluate to true.
+ *
+ * \param[in] script_n_of_k A constant pointer to the \ref cardano_script_n_of_k_t object whose required count is to be retrieved.
+ *                          The object must not be NULL.
+ *
+ * \return The number of sub-scripts that must evaluate to true for this script_n_of_k to evaluate to true.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_n_of_k_t* script_n_of_k = ...; // Assume this is initialized
+ *
+ * // Retrieve the required number of sub-scripts
+ * size_t required = cardano_script_n_of_k_get_required(script_n_of_k);
+ * printf("Number of required sub-scripts: %zu\n", required);
+ *
+ * // Clean up the script_n_of_k object once done
+ * cardano_script_n_of_k_unref(&script_n_of_k);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_n_of_k_get_required(const cardano_script_n_of_k_t* script_n_of_k);
+
+/**
+ * \brief Sets the required number of sub-scripts that must evaluate to true for a script_n_of_k.
+ *
+ * This function sets the number of sub-scripts that must evaluate to true for the provided \ref cardano_script_n_of_k_t
+ * object to evaluate to true.
+ *
+ * \param[in] script_n_of_k A pointer to the \ref cardano_script_n_of_k_t object whose required count is to be set.
+ * \param[in] required The number of sub-scripts that must evaluate to true.
+ *
+ * \return \ref CARDANO_SUCCESS if the required number was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * \note A successful call discards the CBOR that the object cached when it was decoded with \ref cardano_script_n_of_k_from_cbor,
+ *       so the next call to \ref cardano_script_n_of_k_to_cbor encodes the script from its fields.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_n_of_k_t* script_n_of_k = ...; // Assume this is initialized
+ * size_t required = 3;
+ *
+ * // Set the required number of sub-scripts
+ * cardano_error_t result = cardano_script_n_of_k_set_required(script_n_of_k, required);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Successfully set the required number of sub-scripts to %zu\n", required);
+ * }
+ * else
+ * {
+ *   printf("Failed to set the required number of sub-scripts. Error code: %d\n", result);
+ * }
+ *
+ * // Clean up the script_n_of_k object once done
+ * cardano_script_n_of_k_unref(&script_n_of_k);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_n_of_k_set_required(cardano_script_n_of_k_t* script_n_of_k, size_t required);
+
+/**
+ * \brief Retrieves the list of native scripts associated with a \ref cardano_script_n_of_k_t.
+ *
+ * This function provides access to the list of native scripts in a \ref cardano_script_n_of_k_t object.
+ * It returns a reference to a \ref cardano_native_script_list_t object representing the scripts.
+ * This allows the scripts to be used independently of the original \ref cardano_script_n_of_k_t object. The
+ * reference count of the list object is increased by one, making it the caller's responsibility
+ * to release it by calling \ref cardano_native_script_list_unref when it is no longer needed.
+ *
+ * \param[in] script_n_of_k A constant pointer to the \ref cardano_script_n_of_k_t object from which
+ *                       the list of native scripts is to be retrieved.
+ * \param[out] list A pointer to store the reference to the \ref cardano_native_script_list_t object containing the scripts.
+ *                  If the input script_n_of_k is NULL, returns NULL. The caller is responsible for
+ *                  managing the lifecycle of this object, including releasing it with
+ *                  \ref cardano_native_script_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the list of scripts was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * \warning The sub-scripts keep the CBOR they were decoded with, and this object keeps its own. A change made to a sub-script,
+ *          or to the list returned by \ref cardano_script_n_of_k_get_scripts, after this object was decoded with
+ *          \ref cardano_script_n_of_k_from_cbor cannot discard the CBOR cached by this object, so \ref cardano_script_n_of_k_to_cbor would
+ *          still output the original bytes. Call \ref cardano_script_n_of_k_clear_cbor_cache after such a change so that it is serialized.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_n_of_k_t* script_n_of_k = cardano_script_n_of_k_new(...);
+ * cardano_native_script_list_t* list_scripts = NULL;
+ *
+ * // Attempt to retrieve the list of native scripts associated with script_n_of_k
+ * cardano_error_t result = cardano_script_n_of_k_get_scripts(script_n_of_k, &list_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list_scripts
+ *
+ *   // Once done, ensure to clean up and release the list_scripts
+ *   cardano_native_script_list_unref(&list_scripts);
+ * }
+ *
+ * // Release the script_n_of_k object after use
+ * cardano_script_n_of_k_unref(&script_n_of_k);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_n_of_k_get_scripts(
+  cardano_script_n_of_k_t*       script_n_of_k,
+  cardano_native_script_list_t** list);
+
+/**
+ * \brief Sets the list of native scripts associated with a \ref cardano_script_n_of_k_t.
+ *
+ * This function sets the list of native scripts for a \ref cardano_script_n_of_k_t object to the provided
+ * \ref cardano_native_script_list_t object. It replaces n_of existing scripts associated with the \ref cardano_script_n_of_k_t.
+ * The reference count of the provided list object is increased by one, making it the caller's responsibility
+ * to release it when it is no longer needed.
+ *
+ * \param[in] script_n_of_k A pointer to the \ref cardano_script_n_of_k_t object to which
+ *                       the list of native scripts is to be set.
+ * \param[in] list A pointer to the \ref cardano_native_script_list_t object containing the new scripts to be set.
+ *
+ * \return \ref CARDANO_SUCCESS if the scripts were successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * \note A successful call discards the CBOR that the object cached when it was decoded with \ref cardano_script_n_of_k_from_cbor,
+ *       so the next call to \ref cardano_script_n_of_k_to_cbor encodes the script from its fields.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_n_of_k_t* script_n_of_k = cardano_script_n_of_k_new(...);
+ * cardano_native_script_list_t* new_list = ...; // Assume new_list is initialized here
+ *
+ * // Attempt to set the new list of scripts associated with the script_n_of_k
+ * cardano_error_t result = cardano_script_n_of_k_set_scripts(script_n_of_k, new_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Scripts successfully set
+ *   printf("Scripts set successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Failed to set scripts: %s.\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Release the script_n_of_k object after use
+ * cardano_script_n_of_k_unref(&script_n_of_k);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_n_of_k_set_scripts(
+  cardano_script_n_of_k_t*      script_n_of_k,
+  cardano_native_script_list_t* list);
+
+/**
+ * \brief Checks if two script_n_of_k objects are equal.
+ *
+ * This function compares two \ref cardano_script_n_of_k_t objects to determine if they are equal. Two script_n_of_k
+ * objects are considered equal if they have the same number of elements and each corresponding pair of elements
+ * is equal according to the \ref cardano_native_script_equals function.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_script_n_of_k_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_script_n_of_k_t object to be compared.
+ *
+ * \return \c true if the two script_n_of_k objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_n_of_k_t* script1 = ...;  // Assume script1 is initialized here
+ * cardano_script_n_of_k_t* script2 = ...;  // Assume script2 is initialized here
+ *
+ * if (cardano_script_n_of_k_equals(script1, script2))
+ * {
+ *   // The two script_n_of_k objects are equal
+ * }
+ * else
+ * {
+ *   // The two script_n_of_k objects are not equal
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_script_n_of_k_equals(const cardano_script_n_of_k_t* lhs, const cardano_script_n_of_k_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a script_n_of_k.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_script_n_of_k_t object.
+ * It is useful when you have modified the script_n_of_k after it was created from CBOR using
+ * \ref cardano_script_n_of_k_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the script_n_of_k, rather than using the original cached CBOR.
+ * The cached CBOR of every sub-script in the list of the script_n_of_k is cleared as well, so the whole script is encoded from
+ * its fields.
+ *
+ * \param[in,out] script_n_of_k A pointer to an initialized \ref cardano_script_n_of_k_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the script when
+ *          serialized, which changes its hash, and with it the policy id, the address or the credential derived from it.
+ *          Use this function with caution, especially if the script is already on chain or if preserving
+ *          the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume script_n_of_k was created using cardano_script_n_of_k_from_cbor
+ * cardano_script_n_of_k_t* script_n_of_k = ...;
+ * cardano_native_script_t* new_script = ...;
+ * cardano_native_script_list_t* scripts = NULL;
+ *
+ * cardano_error_t result = cardano_script_n_of_k_get_scripts(script_n_of_k, &scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Modify the list of sub-scripts, this does not reach the cache of the script_n_of_k
+ *   result = cardano_native_script_list_add(scripts, new_script);
+ *   cardano_native_script_list_unref(&scripts);
+ * }
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated script_n_of_k
+ * cardano_script_n_of_k_clear_cbor_cache(script_n_of_k);
+ *
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_script_n_of_k_to_cbor(script_n_of_k, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_script_n_of_k_unref(&script_n_of_k);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_script_n_of_k_clear_cbor_cache(cardano_script_n_of_k_t* script_n_of_k);
+
+/**
+ * \brief Decrements the reference count of a script_n_of_k object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_script_n_of_k_t object
+ * by decreasing its reference count. When the reference count reaches zero, the script_n_of_k is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] script_n_of_k A pointer to the pointer of the script_n_of_k object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_n_of_k_t* script_n_of_k = ...; // Assume script_n_of_k is initialized here
+ *
+ * // Perform operations with the script_n_of_k...
+ *
+ * cardano_script_n_of_k_unref(&script_n_of_k);
+ * // At this point, script_n_of_k is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_script_n_of_k_unref, the pointer to the \ref cardano_script_n_of_k_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_script_n_of_k_unref(cardano_script_n_of_k_t** script_n_of_k);
+
+/**
+ * \brief Increases the reference count of the cardano_script_n_of_k_t object.
+ *
+ * This function is used to manually increment the reference count of a script_n_of_k
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until n_of owners have released their
+ * reference by calling \ref cardano_script_n_of_k_unref.
+ *
+ * \param script_n_of_k A pointer to the script_n_of_k object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_n_of_k is a previously created script_n_of_k object
+ *
+ * cardano_script_n_of_k_ref(script_n_of_k);
+ *
+ * // Now script_n_of_k can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_script_n_of_k_ref there is a corresponding
+ * call to \ref cardano_script_n_of_k_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_script_n_of_k_ref(cardano_script_n_of_k_t* script_n_of_k);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_script_n_of_k_t object.
+ *
+ * This function returns the number of active references to a script_n_of_k object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_script_n_of_k_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param script_n_of_k A pointer to the script_n_of_k object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified script_n_of_k object. If the object
+ * is properly managed (i.e., every \ref cardano_script_n_of_k_ref call is matched with a
+ * \ref cardano_script_n_of_k_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_n_of_k is a previously created script_n_of_k object
+ *
+ * size_t ref_count = cardano_script_n_of_k_refcount(script_n_of_k);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_n_of_k_refcount(const cardano_script_n_of_k_t* script_n_of_k);
+
+/**
+ * \brief Sets the last error message for a given script_n_of_k object.
+ *
+ * Records an error message in the script_n_of_k's last_error buffer, overwriting n_of existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] script_n_of_k A pointer to the \ref cardano_script_n_of_k_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the script_n_of_k's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_script_n_of_k_set_last_error(cardano_script_n_of_k_t* script_n_of_k, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific script_n_of_k.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_script_n_of_k_set_last_error for the given
+ * script_n_of_k. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] script_n_of_k A pointer to the \ref cardano_script_n_of_k_t instance whose last error
+ *                   message is to be retrieved. If the script_n_of_k is NULL, the function
+ *                   returns a generic error message indicating the null script_n_of_k.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified script_n_of_k. If the script_n_of_k is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_script_n_of_k_set_last_error for the same script_n_of_k, or until
+ *       the script_n_of_k is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_script_n_of_k_get_last_error(const cardano_script_n_of_k_t* script_n_of_k);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_script_n_of_k_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_script_n_of_k_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_script_n_of_k_deep_clone(const cardano_script_n_of_k_t* source, cardano_script_n_of_k_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_N_OF_K_H
diff --git a/vendor/include/cardano/scripts/native_scripts/script_pubkey.h b/vendor/include/cardano/scripts/native_scripts/script_pubkey.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/native_scripts/script_pubkey.h
@@ -0,0 +1,574 @@
+/**
+ * \file script_pubkey.h
+ *
+ * \author angel.castillo
+ * \date   May 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_PUBKEY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_PUBKEY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_t cardano_native_script_t;
+
+/**
+ * \brief This script evaluates to true if the transaction also includes a valid key witness
+ * where the witness verification key hashes to the given hash.
+ *
+ * In other words, this checks that the transaction is signed by a particular key, identified by its verification
+ * key hash.
+ */
+typedef struct cardano_script_pubkey_t cardano_script_pubkey_t;
+
+/**
+ * \brief Creates and initializes a new instance of a script_pubkey.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_script_pubkey_t
+ * with a provided key hash. It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[in] key_hash A constant pointer to the \ref cardano_blake2b_hash_t object representing the key hash.
+ * \param[out] script_pubkey On successful initialization, this will point to a newly created
+ *             \ref cardano_script_pubkey_t object. This object represents a "strong reference"
+ *             to the script_pubkey, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script_pubkey is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_pubkey_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_pubkey was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* key_hash = ...; // Assume key_hash is initialized here
+ * cardano_script_pubkey_t* script_pubkey = NULL;
+ *
+ * // Attempt to create a new script_pubkey
+ * cardano_error_t result = cardano_script_pubkey_new(key_hash, &script_pubkey);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_pubkey
+ *
+ *   // Once done, ensure to clean up and release the script_pubkey
+ *   cardano_script_pubkey_unref(&script_pubkey);
+ * }
+ *
+ * cardano_blake2b_hash_unref(&key_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_pubkey_new(cardano_blake2b_hash_t* key_hash, cardano_script_pubkey_t** script_pubkey);
+
+/**
+ * \brief Creates a script_pubkey from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_script_pubkey_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a script_pubkey.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded script_pubkey data.
+ * \param[out] script_pubkey A pointer to a pointer of \ref cardano_script_pubkey_t that will be set to the address
+ *                        of the newly created script_pubkey object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_pubkey was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_pubkey object is created using \ref cardano_script_pubkey_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_pubkey_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_pubkey_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_script_pubkey_t object by calling
+ *       \ref cardano_script_pubkey_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_script_pubkey_t* script_pubkey = NULL;
+ *
+ * cardano_error_t result = cardano_script_pubkey_from_cbor(reader, &script_pubkey);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_pubkey
+ *
+ *   // Once done, ensure to clean up and release the script_pubkey
+ *   cardano_script_pubkey_unref(&script_pubkey);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode script_pubkey: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_pubkey_from_cbor(cardano_cbor_reader_t* reader, cardano_script_pubkey_t** script_pubkey);
+
+/**
+ * \brief Serializes a script_pubkey into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_script_pubkey_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] script_pubkey A constant pointer to the \ref cardano_script_pubkey_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p script_pubkey or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_pubkey object is created using \ref cardano_script_pubkey_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_pubkey_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_pubkey_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_pubkey_t* script_pubkey = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_script_pubkey_to_cbor(script_pubkey, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_script_pubkey_unref(&script_pubkey);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_pubkey_to_cbor(
+  const cardano_script_pubkey_t* script_pubkey,
+  cardano_cbor_writer_t*         writer);
+
+/**
+ * \brief Serializes a script public key (pubkey) to CIP-116 JSON.
+ *
+ * The script public key is emitted as a JSON object with the following shape:
+ *
+ * \code{.json}
+ * {
+ *   "tag": "pubkey",
+ *   "pubkey": "<28-byte-blake2b-hex>"
+ * }
+ * \endcode
+ *
+ * \param[in]     script_pubkey A valid pointer to the script public key to serialize.
+ * \param[in,out] writer        A valid JSON writer, positioned where a value is expected.
+ *
+ * \retval CARDANO_SUCCESS               On success.
+ * \retval CARDANO_ERROR_POINTER_IS_NULL If \p script_pubkey or \p writer is NULL.
+ * \retval <propagated error>            If underlying operations (e.g., writing JSON,
+ *                                       converting the key hash to hex) fail.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_pubkey_to_cip116_json(
+  const cardano_script_pubkey_t* script_pubkey,
+  cardano_json_writer_t*         writer);
+
+/**
+ * \brief Creates a script_pubkey from a JSON string.
+ *
+ * This function parses JSON data using a provided JSON string and constructs a \ref cardano_script_pubkey_t object.
+ * It assumes that the JSON data corresponds to the structure expected for a script_pubkey.
+ *
+ * \param[in] json A pointer to a null-terminated string containing the JSON-encoded script_pubkey data. This string
+ *                 must not be NULL.
+ * \param[in] json_size The size of the JSON string, excluding the null terminator.
+ * \param[out] native_script A pointer to a pointer of \ref cardano_script_pubkey_t that will be set to the address
+ *                           of the newly created script_pubkey object upon successful decoding. The caller is responsible
+ *                           for managing the lifecycle of this object by calling \ref cardano_script_pubkey_unref when it
+ *                           is no longer needed.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_pubkey was successfully created, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* json_string = "{\"type\": \"sig\", \"keyHash\": \"...\"}"; // Example JSON string
+ * size_t json_size = strlen(json_string); // Calculate the size of the JSON string
+ * cardano_script_pubkey_t* script_pubkey = NULL;
+ *
+ * // Attempt to create a new script_pubkey from a JSON string
+ * cardano_error_t result = cardano_script_pubkey_from_json(json_string, json_size, &script_pubkey);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_pubkey
+ *
+ *   // Once done, ensure to clean up and release the script_pubkey
+ *   cardano_script_pubkey_unref(&script_pubkey);
+ * }
+ * else
+ * {
+ *   printf("Failed to create script_pubkey from JSON. Error code: %d\n", result);
+ * }
+ * \endcode
+ */
+cardano_error_t
+cardano_script_pubkey_from_json(const char* json, size_t json_size, cardano_script_pubkey_t** native_script);
+
+/**
+ * \brief Retrieves the key hash associated with a script_pubkey.
+ *
+ * This function retrieves the key hash from the provided \ref cardano_script_pubkey_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] script_pubkey A constant pointer to the \ref cardano_script_pubkey_t object from which
+ *                          the key hash is to be retrieved.
+ * \param[out] key_hash Pointer to a variable where the retrieved key hash will be stored.
+ *                      This variable will point to the retrieved \ref cardano_blake2b_hash_t object.
+ *                      The caller is responsible for managing the lifecycle of the key hash by calling
+ *                      \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the key hash was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* script_pubkey = ...; // Assume script_pubkey is initialized
+ *
+ * cardano_blake2b_hash_t* retrieved_key_hash = NULL;
+ * cardano_error_t result = cardano_script_pubkey_get_key_hash(script_pubkey, &retrieved_key_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved key hash
+ *   // Remember to unreference the key hash once done if it's no longer needed
+ *   cardano_blake2b_hash_unref(&retrieved_key_hash);
+ * }
+ *
+ * // Clean up the script_pubkey object once done
+ * cardano_script_pubkey_unref(&script_pubkey);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_pubkey_get_key_hash(cardano_script_pubkey_t* script_pubkey, cardano_blake2b_hash_t** key_hash);
+
+/**
+ * \brief Sets the key hash for a script_pubkey.
+ *
+ * This function sets the key hash for the provided \ref cardano_script_pubkey_t object.
+ *
+ * \param[in] script_pubkey A pointer to the \ref cardano_script_pubkey_t object to which
+ *                          the key hash is to be set.
+ * \param[in] key_hash A pointer to the \ref cardano_blake2b_hash_t object that is to be set as the key hash for the script_pubkey.
+ *                     The key hash will be referenced by the script_pubkey after setting.
+ *
+ * \return \ref CARDANO_SUCCESS if the key hash was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * \note A successful call discards the CBOR that the object cached when it was decoded with \ref cardano_script_pubkey_from_cbor,
+ *       so the next call to \ref cardano_script_pubkey_to_cbor encodes the script from its fields.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_pubkey_t* script_pubkey = ...; // Assume script_pubkey is initialized
+ * cardano_blake2b_hash_t* key_hash = ...; // Assume key_hash is initialized
+ *
+ * // Set the key hash for the script_pubkey
+ * cardano_error_t result = cardano_script_pubkey_set_key_hash(script_pubkey, key_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Key hash set successfully
+ * }
+ *
+ * // Clean up both the script_pubkey and key_hash object once done
+ * cardano_script_pubkey_unref(&script_pubkey);
+ * cardano_blake2b_hash_unref(&key_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_pubkey_set_key_hash(cardano_script_pubkey_t* script_pubkey, cardano_blake2b_hash_t* key_hash);
+
+/**
+ * \brief Checks if two script_pubkey objects are equal.
+ *
+ * This function compares two \ref cardano_script_pubkey_t objects to determine if they are equal. Two script_pubkey
+ * objects are considered equal if their key hashes are equal.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_script_pubkey_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_script_pubkey_t object to be compared.
+ *
+ * \return \c true if the two script_pubkey objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_t* key_hash1 = ...; // Assume key_hash1 is initialized here
+ * cardano_blake2b_hash_t* key_hash2 = ...; // Assume key_hash2 is initialized here
+ *
+ * cardano_script_pubkey_t* script_pubkey1 = NULL;
+ * cardano_script_pubkey_t* script_pubkey2 = NULL;
+ *
+ * cardano_script_pubkey_new(key_hash1, &script_pubkey1);
+ * cardano_script_pubkey_new(key_hash2, &script_pubkey2);
+ *
+ * if (cardano_script_pubkey_equals(script_pubkey1, script_pubkey2))
+ * {
+ *   // The two script_pubkeys are equal
+ * }
+ * else
+ * {
+ *   // The two script_pubkeys are not equal
+ * }
+ *
+ * // Clean up the objects once done
+ * cardano_script_pubkey_unref(&script_pubkey1);
+ * cardano_script_pubkey_unref(&script_pubkey2);
+ * cardano_blake2b_hash_unref(&key_hash1);
+ * cardano_blake2b_hash_unref(&key_hash2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_script_pubkey_equals(const cardano_script_pubkey_t* lhs, const cardano_script_pubkey_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a script_pubkey.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_script_pubkey_t object.
+ * It is useful when you have modified the script_pubkey after it was created from CBOR using
+ * \ref cardano_script_pubkey_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the script_pubkey, rather than using the original cached CBOR.
+ *
+ * \param[in,out] script_pubkey A pointer to an initialized \ref cardano_script_pubkey_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the script when
+ *          serialized, which changes its hash, and with it the policy id, the address or the credential derived from it.
+ *          Use this function with caution, especially if the script is already on chain or if preserving
+ *          the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume script_pubkey was created using cardano_script_pubkey_from_cbor
+ * cardano_script_pubkey_t* script_pubkey = ...;
+ *
+ * // Clear the CBOR cache so that serialization encodes the script from its fields
+ * cardano_script_pubkey_clear_cbor_cache(script_pubkey);
+ *
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * cardano_error_t result = cardano_script_pubkey_to_cbor(script_pubkey, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_script_pubkey_unref(&script_pubkey);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_script_pubkey_clear_cbor_cache(cardano_script_pubkey_t* script_pubkey);
+
+/**
+ * \brief Decrements the reference count of a script_pubkey object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_script_pubkey_t object
+ * by decreasing its reference count. When the reference count reaches zero, the script_pubkey is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] script_pubkey A pointer to the pointer of the script_pubkey object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_pubkey_t* script_pubkey = cardano_script_pubkey_new();
+ *
+ * // Perform operations with the script_pubkey...
+ *
+ * cardano_script_pubkey_unref(&script_pubkey);
+ * // At this point, script_pubkey is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_script_pubkey_unref, the pointer to the \ref cardano_script_pubkey_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_script_pubkey_unref(cardano_script_pubkey_t** script_pubkey);
+
+/**
+ * \brief Increases the reference count of the cardano_script_pubkey_t object.
+ *
+ * This function is used to manually increment the reference count of a script_pubkey
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_script_pubkey_unref.
+ *
+ * \param script_pubkey A pointer to the script_pubkey object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_pubkey is a previously created script_pubkey object
+ *
+ * cardano_script_pubkey_ref(script_pubkey);
+ *
+ * // Now script_pubkey can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_script_pubkey_ref there is a corresponding
+ * call to \ref cardano_script_pubkey_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_script_pubkey_ref(cardano_script_pubkey_t* script_pubkey);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_script_pubkey_t object.
+ *
+ * This function returns the number of active references to a script_pubkey object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_script_pubkey_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param script_pubkey A pointer to the script_pubkey object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified script_pubkey object. If the object
+ * is properly managed (i.e., every \ref cardano_script_pubkey_ref call is matched with a
+ * \ref cardano_script_pubkey_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_pubkey is a previously created script_pubkey object
+ *
+ * size_t ref_count = cardano_script_pubkey_refcount(script_pubkey);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_pubkey_refcount(const cardano_script_pubkey_t* script_pubkey);
+
+/**
+ * \brief Sets the last error message for a given script_pubkey object.
+ *
+ * Records an error message in the script_pubkey's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] script_pubkey A pointer to the \ref cardano_script_pubkey_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the script_pubkey's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_script_pubkey_set_last_error(cardano_script_pubkey_t* script_pubkey, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific script_pubkey.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_script_pubkey_set_last_error for the given
+ * script_pubkey. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] script_pubkey A pointer to the \ref cardano_script_pubkey_t instance whose last error
+ *                   message is to be retrieved. If the script_pubkey is NULL, the function
+ *                   returns a generic error message indicating the null script_pubkey.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified script_pubkey. If the script_pubkey is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_script_pubkey_set_last_error for the same script_pubkey, or until
+ *       the script_pubkey is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_script_pubkey_get_last_error(const cardano_script_pubkey_t* script_pubkey);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_script_pubkey_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_script_pubkey_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_script_pubkey_deep_clone(const cardano_script_pubkey_t* source, cardano_script_pubkey_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_PUBKEY_H
diff --git a/vendor/include/cardano/scripts/native_scripts/script_require_guard.h b/vendor/include/cardano/scripts/native_scripts/script_require_guard.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/native_scripts/script_require_guard.h
@@ -0,0 +1,584 @@
+/**
+ * \file script_require_guard.h
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_REQUIRE_GUARD_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_REQUIRE_GUARD_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_t cardano_native_script_t;
+
+/**
+ * \brief This script evaluates to true if the given credential is present in the
+ * transaction guards.
+ *
+ * In other words, this checks that the transaction was authorized by a particular guard,
+ * identified by its key hash or script hash credential.
+ */
+typedef struct cardano_script_require_guard_t cardano_script_require_guard_t;
+
+/**
+ * \brief Creates and initializes a new instance of a script_require_guard.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_script_require_guard_t
+ * with a provided credential. It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[in] credential A constant pointer to the \ref cardano_credential_t object representing the guard credential.
+ * \param[out] script_require_guard On successful initialization, this will point to a newly created
+ *             \ref cardano_script_require_guard_t object. This object represents a "strong reference"
+ *             to the script_require_guard, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script_require_guard is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_require_guard_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_require_guard was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = ...; // Assume credential is initialized here
+ * cardano_script_require_guard_t* script_require_guard = NULL;
+ *
+ * // Attempt to create a new script_require_guard
+ * cardano_error_t result = cardano_script_require_guard_new(credential, &script_require_guard);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_require_guard
+ *
+ *   // Once done, ensure to clean up and release the script_require_guard
+ *   cardano_script_require_guard_unref(&script_require_guard);
+ * }
+ *
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_require_guard_new(cardano_credential_t* credential, cardano_script_require_guard_t** script_require_guard);
+
+/**
+ * \brief Creates a script_require_guard from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_script_require_guard_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a script_require_guard.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded script_require_guard data.
+ * \param[out] script_require_guard A pointer to a pointer of \ref cardano_script_require_guard_t that will be set to the address
+ *                        of the newly created script_require_guard object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_require_guard was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_require_guard object is created using \ref cardano_script_require_guard_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_require_guard_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_require_guard_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_script_require_guard_t object by calling
+ *       \ref cardano_script_require_guard_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_script_require_guard_t* script_require_guard = NULL;
+ *
+ * cardano_error_t result = cardano_script_require_guard_from_cbor(reader, &script_require_guard);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_require_guard
+ *
+ *   // Once done, ensure to clean up and release the script_require_guard
+ *   cardano_script_require_guard_unref(&script_require_guard);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode script_require_guard: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_require_guard_from_cbor(cardano_cbor_reader_t* reader, cardano_script_require_guard_t** script_require_guard);
+
+/**
+ * \brief Serializes a script_require_guard into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_script_require_guard_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] script_require_guard A constant pointer to the \ref cardano_script_require_guard_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p script_require_guard or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, and the hash and the size of a native script are computed over the bytes
+ *         it was encoded with, so encoding a decoded script again with other bytes would change its hash and its size.
+ *         To prevent this, when a script_require_guard object is created using \ref cardano_script_require_guard_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_script_require_guard_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_script_require_guard_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_require_guard_t* script_require_guard = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_script_require_guard_to_cbor(script_require_guard, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_script_require_guard_unref(&script_require_guard);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_require_guard_to_cbor(
+  const cardano_script_require_guard_t* script_require_guard,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes a script require guard to CIP-116 JSON.
+ *
+ * The script require guard is emitted as a JSON object with the following shape:
+ *
+ * \code{.json}
+ * {
+ *   "tag": "require_guard",
+ *   "credential": {
+ *     "tag": "pubkey_hash",
+ *     "value": "<28-byte-blake2b-hex>"
+ *   }
+ * }
+ * \endcode
+ *
+ * \param[in]     script_require_guard A valid pointer to the script require guard to serialize.
+ * \param[in,out] writer               A valid JSON writer, positioned where a value is expected.
+ *
+ * \retval CARDANO_SUCCESS               On success.
+ * \retval CARDANO_ERROR_POINTER_IS_NULL If \p script_require_guard or \p writer is NULL.
+ * \retval <propagated error>            If underlying operations (e.g., writing JSON,
+ *                                       converting the credential to hex) fail.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_require_guard_to_cip116_json(
+  const cardano_script_require_guard_t* script_require_guard,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Creates a script_require_guard from a JSON string.
+ *
+ * This function parses JSON data using a provided JSON string and constructs a \ref cardano_script_require_guard_t object.
+ * It assumes that the JSON data corresponds to the structure expected for a script_require_guard. The guard credential
+ * is given either as a "keyHash" or a "scriptHash" field.
+ *
+ * \param[in] json A pointer to a null-terminated string containing the JSON-encoded script_require_guard data. This string
+ *                 must not be NULL.
+ * \param[in] json_size The size of the JSON string, excluding the null terminator.
+ * \param[out] native_script A pointer to a pointer of \ref cardano_script_require_guard_t that will be set to the address
+ *                           of the newly created script_require_guard object upon successful decoding. The caller is responsible
+ *                           for managing the lifecycle of this object by calling \ref cardano_script_require_guard_unref when it
+ *                           is no longer needed.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script_require_guard was successfully created, or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* json_string = "{\"type\": \"guard\", \"keyHash\": \"...\"}"; // Example JSON string
+ * size_t json_size = strlen(json_string); // Calculate the size of the JSON string
+ * cardano_script_require_guard_t* script_require_guard = NULL;
+ *
+ * // Attempt to create a new script_require_guard from a JSON string
+ * cardano_error_t result = cardano_script_require_guard_from_json(json_string, json_size, &script_require_guard);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script_require_guard
+ *
+ *   // Once done, ensure to clean up and release the script_require_guard
+ *   cardano_script_require_guard_unref(&script_require_guard);
+ * }
+ * else
+ * {
+ *   printf("Failed to create script_require_guard from JSON. Error code: %d\n", result);
+ * }
+ * \endcode
+ */
+cardano_error_t
+cardano_script_require_guard_from_json(const char* json, size_t json_size, cardano_script_require_guard_t** native_script);
+
+/**
+ * \brief Retrieves the credential associated with a script_require_guard.
+ *
+ * This function retrieves the credential from the provided \ref cardano_script_require_guard_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] script_require_guard A constant pointer to the \ref cardano_script_require_guard_t object from which
+ *                                 the credential is to be retrieved.
+ * \param[out] credential Pointer to a variable where the retrieved credential will be stored.
+ *                        This variable will point to the retrieved \ref cardano_credential_t object.
+ *                        The caller is responsible for managing the lifecycle of the credential by calling
+ *                        \ref cardano_credential_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the credential was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * \warning A change made to the returned credential after this object was decoded with
+ *          \ref cardano_script_require_guard_from_cbor cannot discard the CBOR cached by this object, so
+ *          \ref cardano_script_require_guard_to_cbor would still output the original bytes. Call
+ *          \ref cardano_script_require_guard_clear_cbor_cache after such a change so that it is serialized,
+ *          or set the changed credential with \ref cardano_script_require_guard_set_credential.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_require_guard_t* script_require_guard = ...; // Assume script_require_guard is initialized
+ *
+ * cardano_credential_t* retrieved_credential = NULL;
+ * cardano_error_t result = cardano_script_require_guard_get_credential(script_require_guard, &retrieved_credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved credential
+ *   // Remember to unreference the credential once done if it's no longer needed
+ *   cardano_credential_unref(&retrieved_credential);
+ * }
+ *
+ * // Clean up the script_require_guard object once done
+ * cardano_script_require_guard_unref(&script_require_guard);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_require_guard_get_credential(cardano_script_require_guard_t* script_require_guard, cardano_credential_t** credential);
+
+/**
+ * \brief Sets the credential for a script_require_guard.
+ *
+ * This function sets the credential for the provided \ref cardano_script_require_guard_t object.
+ *
+ * \param[in] script_require_guard A pointer to the \ref cardano_script_require_guard_t object to which
+ *                                 the credential is to be set.
+ * \param[in] credential A pointer to the \ref cardano_credential_t object that is to be set as the credential for the script_require_guard.
+ *                       The credential will be referenced by the script_require_guard after setting.
+ *
+ * \return \ref CARDANO_SUCCESS if the credential was successfully set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * \note A successful call discards the CBOR that the object cached when it was decoded with \ref cardano_script_require_guard_from_cbor,
+ *       so the next call to \ref cardano_script_require_guard_to_cbor encodes the script from its fields.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_require_guard_t* script_require_guard = ...; // Assume script_require_guard is initialized
+ * cardano_credential_t* credential = ...; // Assume credential is initialized
+ *
+ * // Set the credential for the script_require_guard
+ * cardano_error_t result = cardano_script_require_guard_set_credential(script_require_guard, credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Credential set successfully
+ * }
+ *
+ * // Clean up both the script_require_guard and credential object once done
+ * cardano_script_require_guard_unref(&script_require_guard);
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_require_guard_set_credential(cardano_script_require_guard_t* script_require_guard, cardano_credential_t* credential);
+
+/**
+ * \brief Checks if two script_require_guard objects are equal.
+ *
+ * This function compares two \ref cardano_script_require_guard_t objects to determine if they are equal. Two script_require_guard
+ * objects are considered equal if their credentials are equal.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_script_require_guard_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_script_require_guard_t object to be compared.
+ *
+ * \return \c true if the two script_require_guard objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential1 = ...; // Assume credential1 is initialized here
+ * cardano_credential_t* credential2 = ...; // Assume credential2 is initialized here
+ *
+ * cardano_script_require_guard_t* script_require_guard1 = NULL;
+ * cardano_script_require_guard_t* script_require_guard2 = NULL;
+ *
+ * cardano_script_require_guard_new(credential1, &script_require_guard1);
+ * cardano_script_require_guard_new(credential2, &script_require_guard2);
+ *
+ * if (cardano_script_require_guard_equals(script_require_guard1, script_require_guard2))
+ * {
+ *   // The two script_require_guards are equal
+ * }
+ * else
+ * {
+ *   // The two script_require_guards are not equal
+ * }
+ *
+ * // Clean up the objects once done
+ * cardano_script_require_guard_unref(&script_require_guard1);
+ * cardano_script_require_guard_unref(&script_require_guard2);
+ * cardano_credential_unref(&credential1);
+ * cardano_credential_unref(&credential2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_script_require_guard_equals(const cardano_script_require_guard_t* lhs, const cardano_script_require_guard_t* rhs);
+
+/**
+ * \brief Clears the cached CBOR representation from a script_require_guard.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_script_require_guard_t object.
+ * It is useful when you have modified the script_require_guard after it was created from CBOR using
+ * \ref cardano_script_require_guard_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the script_require_guard, rather than using the original cached CBOR.
+ *
+ * \param[in,out] script_require_guard A pointer to an initialized \ref cardano_script_require_guard_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the script when
+ *          serialized, which changes its hash, and with it the policy id, the address or the credential derived from it.
+ *          Use this function with caution, especially if the script is already on chain or if preserving
+ *          the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume script_require_guard was created using cardano_script_require_guard_from_cbor
+ * cardano_script_require_guard_t* script_require_guard = ...;
+ *
+ * // Clear the CBOR cache so that serialization encodes the script from its fields
+ * cardano_script_require_guard_clear_cbor_cache(script_require_guard);
+ *
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * cardano_error_t result = cardano_script_require_guard_to_cbor(script_require_guard, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_script_require_guard_unref(&script_require_guard);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_script_require_guard_clear_cbor_cache(cardano_script_require_guard_t* script_require_guard);
+
+/**
+ * \brief Decrements the reference count of a script_require_guard object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_script_require_guard_t object
+ * by decreasing its reference count. When the reference count reaches zero, the script_require_guard is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] script_require_guard A pointer to the pointer of the script_require_guard object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_require_guard_t* script_require_guard = cardano_script_require_guard_new();
+ *
+ * // Perform operations with the script_require_guard...
+ *
+ * cardano_script_require_guard_unref(&script_require_guard);
+ * // At this point, script_require_guard is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_script_require_guard_unref, the pointer to the \ref cardano_script_require_guard_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_script_require_guard_unref(cardano_script_require_guard_t** script_require_guard);
+
+/**
+ * \brief Increases the reference count of the cardano_script_require_guard_t object.
+ *
+ * This function is used to manually increment the reference count of a script_require_guard
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_script_require_guard_unref.
+ *
+ * \param script_require_guard A pointer to the script_require_guard object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_require_guard is a previously created script_require_guard object
+ *
+ * cardano_script_require_guard_ref(script_require_guard);
+ *
+ * // Now script_require_guard can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_script_require_guard_ref there is a corresponding
+ * call to \ref cardano_script_require_guard_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_script_require_guard_ref(cardano_script_require_guard_t* script_require_guard);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_script_require_guard_t object.
+ *
+ * This function returns the number of active references to a script_require_guard object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_script_require_guard_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param script_require_guard A pointer to the script_require_guard object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified script_require_guard object. If the object
+ * is properly managed (i.e., every \ref cardano_script_require_guard_ref call is matched with a
+ * \ref cardano_script_require_guard_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script_require_guard is a previously created script_require_guard object
+ *
+ * size_t ref_count = cardano_script_require_guard_refcount(script_require_guard);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_require_guard_refcount(const cardano_script_require_guard_t* script_require_guard);
+
+/**
+ * \brief Sets the last error message for a given script_require_guard object.
+ *
+ * Records an error message in the script_require_guard's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] script_require_guard A pointer to the \ref cardano_script_require_guard_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the script_require_guard's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_script_require_guard_set_last_error(cardano_script_require_guard_t* script_require_guard, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific script_require_guard.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_script_require_guard_set_last_error for the given
+ * script_require_guard. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] script_require_guard A pointer to the \ref cardano_script_require_guard_t instance whose last error
+ *                   message is to be retrieved. If the script_require_guard is NULL, the function
+ *                   returns a generic error message indicating the null script_require_guard.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified script_require_guard. If the script_require_guard is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_script_require_guard_set_last_error for the same script_require_guard, or until
+ *       the script_require_guard is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_script_require_guard_get_last_error(const cardano_script_require_guard_t* script_require_guard);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_script_require_guard_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_script_require_guard_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_script_require_guard_deep_clone(const cardano_script_require_guard_t* source, cardano_script_require_guard_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_REQUIRE_GUARD_H
diff --git a/vendor/include/cardano/scripts/plutus_scripts/plutus_language_version.h b/vendor/include/cardano/scripts/plutus_scripts/plutus_language_version.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/plutus_scripts/plutus_language_version.h
@@ -0,0 +1,91 @@
+/**
+ * \file plutus_language_version.h
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_LANGUAGE_VERSION_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_LANGUAGE_VERSION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Cardano ledger tags scripts with a language that determines what the ledger will do with the script.
+ *
+ * In most cases this language will be very similar to the ones that came before, we refer to these as
+ * 'Plutus language versions'. However, from the ledger's perspective they are entirely unrelated and there
+ * is generally no requirement that they be similar or compatible in any way.
+ */
+typedef enum
+{
+  /**
+   * \brief V1 was the initial version of Plutus, introduced in the Alonzo hard fork.
+   */
+  CARDANO_PLUTUS_LANGUAGE_VERSION_V1 = 0,
+
+  /**
+   * \brief V2 was introduced in the Vasil hard fork.
+   *
+   * The main changes in V2 of Plutus were to the interface to scripts. The ScriptContext was extended
+   * to include the following information:
+   *
+   *  - The full "redeemers" structure, which contains all the redeemers used in the transaction
+   *  - Reference inputs in the transaction (proposed in CIP-31)
+   *  - Inline datums in the transaction (proposed in CIP-32)
+   *  - Reference scripts in the transaction (proposed in CIP-33)
+   */
+  CARDANO_PLUTUS_LANGUAGE_VERSION_V2 = 1,
+
+  /**
+   * \brief V3 was introduced in the Conway hard fork.
+   *
+   * The main changes in V3 of Plutus were to the interface to scripts. The ScriptContext was extended
+   * to include the following information:
+   *
+   *  - A Map with all the votes that were included in the transaction.
+   *  - A list with Proposals that will be turned into GovernanceActions, that everyone can vote on
+   *  - Optional amount for the current treasury. If included it will be checked to be equal the current amount in the treasury.
+   *  - Optional amount for donating to the current treasury. If included, specified amount will go into the treasury.
+   */
+  CARDANO_PLUTUS_LANGUAGE_VERSION_V3 = 2,
+
+  /**
+   * \brief V4 was introduced in the Dijkstra hard fork.
+   *
+   * V4 scripts run from protocol version 12, priced by the V4 cost model of the
+   * protocol parameters. They witness the purposes of the top level transaction,
+   * including guards, and they are the only Plutus scripts that run inside a sub
+   * transaction.
+   */
+  CARDANO_PLUTUS_LANGUAGE_VERSION_V4 = 3,
+
+} cardano_plutus_language_version_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_LANGUAGE_VERSION_H
diff --git a/vendor/include/cardano/scripts/plutus_scripts/plutus_v1_script.h b/vendor/include/cardano/scripts/plutus_scripts/plutus_v1_script.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/plutus_scripts/plutus_v1_script.h
@@ -0,0 +1,540 @@
+/**
+ * \file plutus_v1_script.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V1_SCRIPT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V1_SCRIPT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V1 was the initial version of Plutus, introduced in the Alonzo hard fork.
+ */
+typedef struct cardano_plutus_v1_script_t cardano_plutus_v1_script_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus script from a byte array.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_v1_script_t object
+ * from a given byte array. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] bytes A pointer to the byte array from which the plutus_v1_script will be created.
+ * \param[in] size The size of the byte array.
+ * \param[out] plutus_v1_script On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v1_script_t object. This object represents a "strong reference"
+ *             to the plutus script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus script is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v1_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t bytes[] = {0x01, 0x02, 0x03, 0x04 ... }; // Example byte array
+ * size_t size = sizeof(bytes); // Calculate the size of the byte array
+ * cardano_plutus_v1_script_t* plutus_v1_script = NULL;
+ *
+ * // Attempt to create a new plutus script from a byte array
+ * cardano_error_t result = cardano_plutus_v1_script_new_bytes(bytes, size, &plutus_v1_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus script
+ *
+ *   // Once done, ensure to clean up and release the plutus script
+ *   cardano_plutus_v1_script_unref(&plutus_v1_script);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_new_bytes(
+  const byte_t*                bytes,
+  size_t                       size,
+  cardano_plutus_v1_script_t** plutus_v1_script);
+
+/**
+ * \brief Creates and initializes a new instance of a plutus script from a hexadecimal string.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_v1_script_t object
+ * from a given hexadecimal string. It returns an error code to indicate the success or
+ * failure of the operation.
+ *
+ * \param[in] hex A pointer to the hexadecimal string from which the plutus script will be created.
+ * \param[in] size The size of the hexadecimal string.
+ * \param[out] plutus_v1_script On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v1_script_t object. This object represents a "strong reference"
+ *             to the plutus script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus script is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v1_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* hex_string = "0123456789abcdef..."; // Example hexadecimal string
+ * size_t size = strlen(hex_string); // Calculate the size of the string
+ * cardano_plutus_v1_script_t* plutus_v1_script = NULL;
+ *
+ * // Attempt to create a new plutus script from a hexadecimal string
+ * cardano_error_t result = cardano_plutus_v1_script_new_bytes_from_hex(hex_string, size, &plutus_v1_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus script
+ *
+ *   // Once done, ensure to clean up and release the plutus script
+ *   cardano_plutus_v1_script_unref(&plutus_v1_script);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_new_bytes_from_hex(
+  const char*                  hex,
+  size_t                       size,
+  cardano_plutus_v1_script_t** plutus_v1_script);
+
+/**
+ * \brief Creates a plutus_v1_script from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v1_script_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v1_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v1_script data.
+ * \param[out] plutus_v1_script A pointer to a pointer of \ref cardano_plutus_v1_script_t that will be set to the address
+ *                        of the newly created plutus_v1_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v1_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v1_script_t object by calling
+ *       \ref cardano_plutus_v1_script_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v1_script_t* plutus_v1_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v1_script_from_cbor(reader, &plutus_v1_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v1_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v1_script
+ *   cardano_plutus_v1_script_unref(&plutus_v1_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v1_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v1_script_t** plutus_v1_script);
+
+/**
+ * \brief Serializes a plutus_v1_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v1_script_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v1_script A constant pointer to the \ref cardano_plutus_v1_script_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v1_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_t* plutus_v1_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v1_script_to_cbor(plutus_v1_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v1_script_unref(&plutus_v1_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v1_script_to_cbor(
+  const cardano_plutus_v1_script_t* plutus_v1_script,
+  cardano_cbor_writer_t*            writer);
+
+/**
+ * \brief Serializes a Plutus v1 script into a CIP-116 JSON object.
+ *
+ * Writes a single JSON object representing the script:
+ * \code{.json}
+ * {
+ *   "language": "plutus_v1",
+ *   "bytes": "<hex-lowercase>"
+ * }
+ * \endcode
+ *
+ * The function emits both the opening and closing braces. It may be called at the
+ * JSON root or anywhere a value is expected (e.g., as an array element or after a
+ * property name).
+ *
+ * \param[in]     plutus_v1_script  A valid pointer to the script to serialize.
+ * \param[in,out] writer            A valid JSON writer positioned where a value can be written.
+ *
+ * \return
+ * - \c CARDANO_SUCCESS on success.
+ * - \c CARDANO_ERROR_POINTER_IS_NULL if \p plutus_v1_script or \p writer is \c NULL.
+ * - \c CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a temporary buffer cannot be allocated.
+ * - An error propagated from the writer if it is already in an error state (see
+ *   \ref cardano_json_writer_get_last_error).
+ *
+ * \code{.c}
+ * cardano_json_writer_t* w = cardano_json_writer_new(CARDANO_JSON_FORMAT_COMPACT);
+ * cardano_error_t rc = cardano_plutus_v1_script_to_cip116_json(script, w);
+ *
+ * if (rc == CARDANO_SUCCESS)
+ * {
+ *   cardano_buffer_t* out = NULL;
+ *   rc = cardano_json_writer_encode_in_buffer(w, &out);
+ *   // Use 'out' ...
+ *   cardano_buffer_unref(&out);
+ * }
+ *
+ * cardano_json_writer_unref(&w);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_to_cip116_json(
+  const cardano_plutus_v1_script_t* plutus_v1_script,
+  cardano_json_writer_t*            writer);
+
+/**
+ * \brief Gets the raw bytes of a compiled Plutus v1 script. If you need "cborBytes" for cardano-cli use \ref cardano_plutus_v1_script_to_cbor instead.
+ *
+ * This function converts a \ref cardano_plutus_v1_script_t object to its raw byte representation.
+ * The resulting bytes are stored in a \ref cardano_buffer_t object.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] plutus_v1_script A constant pointer to the \ref cardano_plutus_v1_script_t object to be converted.
+ * \param[out] compiled_script On successful conversion, this will point to a newly created
+ *                           \ref cardano_buffer_t object containing the extracted bytes.
+ *                           This object represents a "strong reference" to the compiled_script bytes,
+ *                           meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the bounded bytes are no longer needed, the caller must release it
+ *                           by calling \ref cardano_buffer_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_t* plutus_v1_script = ...; // Assume plutus_v1_script is initialized
+ * cardano_buffer_t* compiled_script = NULL;
+ * cardano_error_t result = cardano_plutus_v1_script_to_raw_bytes(plutus_v1_script, &compiled_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bounded bytes
+ *   printf("Extracted bounded bytes: ");
+ *
+ *   for (size_t i = 0; i < cardano_buffer_get_size(compiled_script); ++i)
+ *   {
+ *     printf("%02X ", cardano_buffer_get_data(compiled_script)[i]);
+ *   }
+ *
+ *   printf("\n");
+ *
+ *   // Once done, ensure to clean up and release the bounded bytes
+ *   cardano_buffer_unref(&compiled_script);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to extract bounded bytes: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the plutus_v1_script object once done
+ * cardano_plutus_v1_script_unref(&plutus_v1_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v1_script_to_raw_bytes(
+  cardano_plutus_v1_script_t* plutus_v1_script,
+  cardano_buffer_t**          compiled_script);
+
+/**
+ * \brief Retrieves the hash associated with a plutus_v1_script.
+ *
+ * This function computes the hash of a \ref cardano_plutus_v1_script_t object.
+ * It returns a new reference to a \ref cardano_blake2b_hash_t object representing the hash.
+ * It the caller's responsibility to release it by calling \ref cardano_blake2b_hash_unref when
+ * it is no longer needed.
+ *
+ * \param plutus_v1_script A constant pointer to the \ref cardano_plutus_v1_script_t object from which
+ *                   the hash is to be retrieved.
+ *
+ * \return A pointer to a new \ref cardano_blake2b_hash_t object containing the hash.
+ *         If the input plutus_v1_script is NULL, returns NULL. The caller is responsible for
+ *         managing the lifecycle of this object, including releasing it with
+ *         \ref cardano_blake2b_hash_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_t* original_plutus_v1_script = cardano_plutus_v1_script_new(...);
+ * cardano_blake2b_hash_t* hash_plutus_v1_script = cardano_plutus_v1_script_get_hash(original_plutus_v1_script);
+ *
+ * if (hash_plutus_v1_script)
+ * {
+ *   // Use the hash plutus_v1_script
+ *
+ *   // Once done, ensure to clean up and release the hash plutus_v1_script
+ *   cardano_blake2b_hash_unref(&hash_plutus_v1_script);
+ * }
+ * // Release the original plutus_v1_script after use
+ * cardano_plutus_v1_script_unref(&original_plutus_v1_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_plutus_v1_script_get_hash(const cardano_plutus_v1_script_t* plutus_v1_script);
+
+/**
+ * \brief Checks if two Plutus v1 script objects are equal.
+ *
+ * This function compares two \ref cardano_plutus_v1_script_t objects to determine if they are equal.
+ * Two Plutus v1 scripts are considered equal if they have the same content.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_plutus_v1_script_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_plutus_v1_script_t object to be compared.
+ *
+ * \return \c true if the two Plutus v1 scripts are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_t* script1 = ...;  // Assume script1 is initialized here
+ * cardano_plutus_v1_script_t* script2 = ...;  // Assume script2 is initialized here
+ *
+ * if (cardano_plutus_v1_script_equals(script1, script2))
+ * {
+ *   // The two Plutus v1 scripts are equal
+ * }
+ * else
+ * {
+ *   // The two Plutus v1 scripts are not equal
+ * }
+ *
+ * // Clean up the script objects once done
+ * cardano_plutus_v1_script_unref(&script1);
+ * cardano_plutus_v1_script_unref(&script2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_v1_script_equals(const cardano_plutus_v1_script_t* lhs, const cardano_plutus_v1_script_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a plutus_v1_script object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v1_script_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v1_script is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v1_script A pointer to the pointer of the plutus_v1_script object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_t* plutus_v1_script = cardano_plutus_v1_script_new();
+ *
+ * // Perform operations with the plutus_v1_script...
+ *
+ * cardano_plutus_v1_script_unref(&plutus_v1_script);
+ * // At this point, plutus_v1_script is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v1_script_unref, the pointer to the \ref cardano_plutus_v1_script_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v1_script_unref(cardano_plutus_v1_script_t** plutus_v1_script);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v1_script_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v1_script
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v1_script_unref.
+ *
+ * \param plutus_v1_script A pointer to the plutus_v1_script object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v1_script is a previously created plutus_v1_script object
+ *
+ * cardano_plutus_v1_script_ref(plutus_v1_script);
+ *
+ * // Now plutus_v1_script can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v1_script_ref there is a corresponding
+ * call to \ref cardano_plutus_v1_script_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v1_script_ref(cardano_plutus_v1_script_t* plutus_v1_script);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v1_script_t object.
+ *
+ * This function returns the number of active references to a plutus_v1_script object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v1_script_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v1_script A pointer to the plutus_v1_script object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v1_script object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v1_script_ref call is matched with a
+ * \ref cardano_plutus_v1_script_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v1_script is a previously created plutus_v1_script object
+ *
+ * size_t ref_count = cardano_plutus_v1_script_refcount(plutus_v1_script);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v1_script_refcount(const cardano_plutus_v1_script_t* plutus_v1_script);
+
+/**
+ * \brief Sets the last error message for a given plutus_v1_script object.
+ *
+ * Records an error message in the plutus_v1_script's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v1_script A pointer to the \ref cardano_plutus_v1_script_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v1_script's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v1_script_set_last_error(cardano_plutus_v1_script_t* plutus_v1_script, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v1_script.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v1_script_set_last_error for the given
+ * plutus_v1_script. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v1_script A pointer to the \ref cardano_plutus_v1_script_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v1_script is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v1_script.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v1_script. If the plutus_v1_script is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v1_script_set_last_error for the same plutus_v1_script, or until
+ *       the plutus_v1_script is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v1_script_get_last_error(const cardano_plutus_v1_script_t* plutus_v1_script);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v1_script_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v1_script_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_deep_clone(const cardano_plutus_v1_script_t* source, cardano_plutus_v1_script_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V1_SCRIPT_H
diff --git a/vendor/include/cardano/scripts/plutus_scripts/plutus_v2_script.h b/vendor/include/cardano/scripts/plutus_scripts/plutus_v2_script.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/plutus_scripts/plutus_v2_script.h
@@ -0,0 +1,548 @@
+/**
+ * \file plutus_v2_script.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V2_SCRIPT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V2_SCRIPT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V2 was introduced in the Vasil hard fork.
+ *
+ * The main changes in V2 of Plutus were to the interface to scripts. The ScriptContext was extended
+ * to include the following information:
+ *
+ *  - The full “redeemers” structure, which contains all the redeemers used in the transaction
+ *  - Reference inputs in the transaction (proposed in CIP-31)
+ *  - Inline datums in the transaction (proposed in CIP-32)
+ *  - Reference scripts in the transaction (proposed in CIP-33)
+ */
+typedef struct cardano_plutus_v2_script_t cardano_plutus_v2_script_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus script from a byte array.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_v2_script_t object
+ * from a given byte array. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] bytes A pointer to the byte array from which the plutus_v2_script will be created.
+ * \param[in] size The size of the byte array.
+ * \param[out] plutus_v2_script On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v2_script_t object. This object represents a "strong reference"
+ *             to the plutus script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus script is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v2_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t bytes[] = {0x01, 0x02, 0x03, 0x04 ... }; // Example byte array
+ * size_t size = sizeof(bytes); // Calculate the size of the byte array
+ * cardano_plutus_v2_script_t* plutus_v2_script = NULL;
+ *
+ * // Attempt to create a new plutus script from a byte array
+ * cardano_error_t result = cardano_plutus_v2_script_new_bytes(bytes, size, &plutus_v2_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus script
+ *
+ *   // Once done, ensure to clean up and release the plutus script
+ *   cardano_plutus_v2_script_unref(&plutus_v2_script);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_new_bytes(
+  const byte_t*                bytes,
+  size_t                       size,
+  cardano_plutus_v2_script_t** plutus_v2_script);
+
+/**
+ * \brief Creates and initializes a new instance of a plutus script from a hexadecimal string.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_v2_script_t object
+ * from a given hexadecimal string. It returns an error code to indicate the success or
+ * failure of the operation.
+ *
+ * \param[in] hex A pointer to the hexadecimal string from which the plutus script will be created.
+ * \param[in] size The size of the hexadecimal string.
+ * \param[out] plutus_v2_script On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v2_script_t object. This object represents a "strong reference"
+ *             to the plutus script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus script is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v2_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* hex_string = "0123456789abcdef..."; // Example hexadecimal string
+ * size_t size = strlen(hex_string); // Calculate the size of the string
+ * cardano_plutus_v2_script_t* plutus_v2_script = NULL;
+ *
+ * // Attempt to create a new plutus script from a hexadecimal string
+ * cardano_error_t result = cardano_plutus_v2_script_new_bytes_from_hex(hex_string, size, &plutus_v2_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus script
+ *
+ *   // Once done, ensure to clean up and release the plutus script
+ *   cardano_plutus_v2_script_unref(&plutus_v2_script);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_new_bytes_from_hex(
+  const char*                  hex,
+  size_t                       size,
+  cardano_plutus_v2_script_t** plutus_v2_script);
+
+/**
+ * \brief Creates a plutus_v2_script from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v2_script_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v2_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v2_script data.
+ * \param[out] plutus_v2_script A pointer to a pointer of \ref cardano_plutus_v2_script_t that will be set to the address
+ *                        of the newly created plutus_v2_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v2_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v2_script_t object by calling
+ *       \ref cardano_plutus_v2_script_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v2_script_t* plutus_v2_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v2_script_from_cbor(reader, &plutus_v2_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v2_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v2_script
+ *   cardano_plutus_v2_script_unref(&plutus_v2_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v2_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v2_script_t** plutus_v2_script);
+
+/**
+ * \brief Serializes a plutus_v2_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v2_script_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v2_script A constant pointer to the \ref cardano_plutus_v2_script_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v2_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_t* plutus_v2_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v2_script_to_cbor(plutus_v2_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v2_script_unref(&plutus_v2_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v2_script_to_cbor(
+  const cardano_plutus_v2_script_t* plutus_v2_script,
+  cardano_cbor_writer_t*            writer);
+
+/**
+ * \brief Serializes a Plutus v2 script into a CIP-116 JSON object.
+ *
+ * Writes a single JSON object representing the script:
+ * \code{.json}
+ * {
+ *   "language": "plutus_v2",
+ *   "bytes": "<hex-lowercase>"
+ * }
+ * \endcode
+ *
+ * The function emits both the opening and closing braces. It may be called at the
+ * JSON root or anywhere a value is expected (e.g., as an array element or after a
+ * property name).
+ *
+ * \param[in]     plutus_v2_script  A valid pointer to the script to serialize.
+ * \param[in,out] writer            A valid JSON writer positioned where a value can be written.
+ *
+ * \return
+ * - \c CARDANO_SUCCESS on success.
+ * - \c CARDANO_ERROR_POINTER_IS_NULL if \p plutus_v2_script or \p writer is \c NULL.
+ * - \c CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a temporary buffer cannot be allocated.
+ * - An error propagated from the writer if it is already in an error state (see
+ *   \ref cardano_json_writer_get_last_error).
+ *
+ * \code{.c}
+ * cardano_json_writer_t* w = cardano_json_writer_new(CARDANO_JSON_FORMAT_COMPACT);
+ * cardano_error_t rc = cardano_plutus_v2_script_to_cip116_json(script, w);
+ *
+ * if (rc == CARDANO_SUCCESS)
+ * {
+ *   cardano_buffer_t* out = NULL;
+ *   rc = cardano_json_writer_encode_in_buffer(w, &out);
+ *   // Use 'out' ...
+ *   cardano_buffer_unref(&out);
+ * }
+ *
+ * cardano_json_writer_unref(&w);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_to_cip116_json(
+  const cardano_plutus_v2_script_t* plutus_v2_script,
+  cardano_json_writer_t*            writer);
+
+/**
+ * \brief Gets the raw bytes of a compiled Plutus v2 script. If you need "cborBytes" for cardano-cli use \ref cardano_plutus_v2_script_to_cbor instead.
+ *
+ * This function converts a \ref cardano_plutus_v2_script_t object to its raw byte representation.
+ * The resulting bytes are stored in a \ref cardano_buffer_t object.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] plutus_v2_script A constant pointer to the \ref cardano_plutus_v2_script_t object to be converted.
+ * \param[out] compiled_script On successful conversion, this will point to a newly created
+ *                           \ref cardano_buffer_t object containing the extracted bytes.
+ *                           This object represents a "strong reference" to the compiled_script bytes,
+ *                           meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the bounded bytes are no longer needed, the caller must release it
+ *                           by calling \ref cardano_buffer_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_t* plutus_v2_script = ...; // Assume plutus_v2_script is initialized
+ * cardano_buffer_t* compiled_script = NULL;
+ * cardano_error_t result = cardano_plutus_v2_script_to_raw_bytes(plutus_v2_script, &compiled_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bounded bytes
+ *   printf("Extracted bounded bytes: ");
+ *
+ *   for (size_t i = 0; i < cardano_buffer_get_size(compiled_script); ++i)
+ *   {
+ *     printf("%02X ", cardano_buffer_get_data(compiled_script)[i]);
+ *   }
+ *
+ *   printf("\n");
+ *
+ *   // Once done, ensure to clean up and release the bounded bytes
+ *   cardano_buffer_unref(&compiled_script);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to extract bounded bytes: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the plutus_v2_script object once done
+ * cardano_plutus_v2_script_unref(&plutus_v2_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v2_script_to_raw_bytes(
+  cardano_plutus_v2_script_t* plutus_v2_script,
+  cardano_buffer_t**          compiled_script);
+
+/**
+ * \brief Retrieves the hash associated with a plutus_v2_script.
+ *
+ * This function computes the hash of a \ref cardano_plutus_v2_script_t object.
+ * It returns a new reference to a \ref cardano_blake2b_hash_t object representing the hash.
+ * It the caller's responsibility to release it by calling \ref cardano_blake2b_hash_unref when
+ * it is no longer needed.
+ *
+ * \param plutus_v2_script A constant pointer to the \ref cardano_plutus_v2_script_t object from which
+ *                   the hash is to be retrieved.
+ *
+ * \return A pointer to a new \ref cardano_blake2b_hash_t object containing the hash.
+ *         If the input plutus_v2_script is NULL, returns NULL. The caller is responsible for
+ *         managing the lifecycle of this object, including releasing it with
+ *         \ref cardano_blake2b_hash_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_t* original_plutus_v2_script = cardano_plutus_v2_script_new(...);
+ * cardano_blake2b_hash_t* hash_plutus_v2_script = cardano_plutus_v2_script_get_hash(original_plutus_v2_script);
+ *
+ * if (hash_plutus_v2_script)
+ * {
+ *   // Use the hash plutus_v2_script
+ *
+ *   // Once done, ensure to clean up and release the hash plutus_v2_script
+ *   cardano_blake2b_hash_unref(&hash_plutus_v2_script);
+ * }
+ * // Release the original plutus_v2_script after use
+ * cardano_plutus_v2_script_unref(&original_plutus_v2_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_plutus_v2_script_get_hash(const cardano_plutus_v2_script_t* plutus_v2_script);
+
+/**
+ * \brief Checks if two Plutus v2 script objects are equal.
+ *
+ * This function compares two \ref cardano_plutus_v2_script_t objects to determine if they are equal.
+ * Two Plutus v2 scripts are considered equal if they have the same content.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_plutus_v2_script_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_plutus_v2_script_t object to be compared.
+ *
+ * \return \c true if the two Plutus v2 scripts are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_t* script1 = ...;  // Assume script1 is initialized here
+ * cardano_plutus_v2_script_t* script2 = ...;  // Assume script2 is initialized here
+ *
+ * if (cardano_plutus_v2_script_equals(script1, script2))
+ * {
+ *   // The two Plutus v2 scripts are equal
+ * }
+ * else
+ * {
+ *   // The two Plutus v2 scripts are not equal
+ * }
+ *
+ * // Clean up the script objects once done
+ * cardano_plutus_v2_script_unref(&script1);
+ * cardano_plutus_v2_script_unref(&script2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_v2_script_equals(const cardano_plutus_v2_script_t* lhs, const cardano_plutus_v2_script_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a plutus_v2_script object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v2_script_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v2_script is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v2_script A pointer to the pointer of the plutus_v2_script object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_t* plutus_v2_script = cardano_plutus_v2_script_new();
+ *
+ * // Perform operations with the plutus_v2_script...
+ *
+ * cardano_plutus_v2_script_unref(&plutus_v2_script);
+ * // At this point, plutus_v2_script is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v2_script_unref, the pointer to the \ref cardano_plutus_v2_script_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v2_script_unref(cardano_plutus_v2_script_t** plutus_v2_script);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v2_script_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v2_script
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v2_script_unref.
+ *
+ * \param plutus_v2_script A pointer to the plutus_v2_script object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v2_script is a previously created plutus_v2_script object
+ *
+ * cardano_plutus_v2_script_ref(plutus_v2_script);
+ *
+ * // Now plutus_v2_script can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v2_script_ref there is a corresponding
+ * call to \ref cardano_plutus_v2_script_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v2_script_ref(cardano_plutus_v2_script_t* plutus_v2_script);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v2_script_t object.
+ *
+ * This function returns the number of active references to a plutus_v2_script object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v2_script_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v2_script A pointer to the plutus_v2_script object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v2_script object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v2_script_ref call is matched with a
+ * \ref cardano_plutus_v2_script_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v2_script is a previously created plutus_v2_script object
+ *
+ * size_t ref_count = cardano_plutus_v2_script_refcount(plutus_v2_script);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v2_script_refcount(const cardano_plutus_v2_script_t* plutus_v2_script);
+
+/**
+ * \brief Sets the last error message for a given plutus_v2_script object.
+ *
+ * Records an error message in the plutus_v2_script's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v2_script A pointer to the \ref cardano_plutus_v2_script_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v2_script's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v2_script_set_last_error(cardano_plutus_v2_script_t* plutus_v2_script, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v2_script.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v2_script_set_last_error for the given
+ * plutus_v2_script. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v2_script A pointer to the \ref cardano_plutus_v2_script_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v2_script is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v2_script.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v2_script. If the plutus_v2_script is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v2_script_set_last_error for the same plutus_v2_script, or until
+ *       the plutus_v2_script is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v2_script_get_last_error(const cardano_plutus_v2_script_t* plutus_v2_script);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v2_script_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v2_script_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_deep_clone(const cardano_plutus_v2_script_t* source, cardano_plutus_v2_script_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V2_SCRIPT_H
diff --git a/vendor/include/cardano/scripts/plutus_scripts/plutus_v3_script.h b/vendor/include/cardano/scripts/plutus_scripts/plutus_v3_script.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/plutus_scripts/plutus_v3_script.h
@@ -0,0 +1,548 @@
+/**
+ * \file plutus_v3_script.h
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V3_SCRIPT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V3_SCRIPT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V3 was introduced in the Conway hard fork.
+ *
+ * The main changes in V3 of Plutus were to the interface to scripts. The ScriptContext was extended
+ * to include the following information:
+ *
+ *  - A Map with all the votes that were included in the transaction.
+ *  - A list with Proposals that will be turned into GovernanceActions, that everyone can vote on
+ *  - Optional amount for the current treasury. If included it will be checked to be equal the current amount in the treasury.
+ *  - Optional amount for donating to the current treasury. If included, specified amount will go into the treasury.
+ */
+typedef struct cardano_plutus_v3_script_t cardano_plutus_v3_script_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus script from a byte array.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_v3_script_t object
+ * from a given byte array. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] bytes A pointer to the byte array from which the plutus_v3_script will be created.
+ * \param[in] size The size of the byte array.
+ * \param[out] plutus_v3_script On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v3_script_t object. This object represents a "strong reference"
+ *             to the plutus script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus script is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v3_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t bytes[] = {0x01, 0x02, 0x03, 0x04 ... }; // Example byte array
+ * size_t size = sizeof(bytes); // Calculate the size of the byte array
+ * cardano_plutus_v3_script_t* plutus_v3_script = NULL;
+ *
+ * // Attempt to create a new plutus script from a byte array
+ * cardano_error_t result = cardano_plutus_v3_script_new_bytes(bytes, size, &plutus_v3_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus script
+ *
+ *   // Once done, ensure to clean up and release the plutus script
+ *   cardano_plutus_v3_script_unref(&plutus_v3_script);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_new_bytes(
+  const byte_t*                bytes,
+  size_t                       size,
+  cardano_plutus_v3_script_t** plutus_v3_script);
+
+/**
+ * \brief Creates and initializes a new instance of a plutus script from a hexadecimal string.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_v3_script_t object
+ * from a given hexadecimal string. It returns an error code to indicate the success or
+ * failure of the operation.
+ *
+ * \param[in] hex A pointer to the hexadecimal string from which the plutus script will be created.
+ * \param[in] size The size of the hexadecimal string.
+ * \param[out] plutus_v3_script On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v3_script_t object. This object represents a "strong reference"
+ *             to the plutus script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus script is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v3_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* hex_string = "0123456789abcdef..."; // Example hexadecimal string
+ * size_t size = strlen(hex_string); // Calculate the size of the string
+ * cardano_plutus_v3_script_t* plutus_v3_script = NULL;
+ *
+ * // Attempt to create a new plutus script from a hexadecimal string
+ * cardano_error_t result = cardano_plutus_v3_script_new_bytes_from_hex(hex_string, size, &plutus_v3_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus script
+ *
+ *   // Once done, ensure to clean up and release the plutus script
+ *   cardano_plutus_v3_script_unref(&plutus_v3_script);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_new_bytes_from_hex(
+  const char*                  hex,
+  size_t                       size,
+  cardano_plutus_v3_script_t** plutus_v3_script);
+
+/**
+ * \brief Creates a plutus_v3_script from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v3_script_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v3_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v3_script data.
+ * \param[out] plutus_v3_script A pointer to a pointer of \ref cardano_plutus_v3_script_t that will be set to the address
+ *                        of the newly created plutus_v3_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v3_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v3_script_t object by calling
+ *       \ref cardano_plutus_v3_script_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v3_script_t* plutus_v3_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v3_script_from_cbor(reader, &plutus_v3_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v3_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v3_script
+ *   cardano_plutus_v3_script_unref(&plutus_v3_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v3_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v3_script_t** plutus_v3_script);
+
+/**
+ * \brief Serializes a plutus_v3_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v3_script_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v3_script A constant pointer to the \ref cardano_plutus_v3_script_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v3_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_t* plutus_v3_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v3_script_to_cbor(plutus_v3_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v3_script_unref(&plutus_v3_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v3_script_to_cbor(
+  const cardano_plutus_v3_script_t* plutus_v3_script,
+  cardano_cbor_writer_t*            writer);
+
+/**
+ * \brief Serializes a Plutus v2 script into a CIP-116 JSON object.
+ *
+ * Writes a single JSON object representing the script:
+ * \code{.json}
+ * {
+ *   "language": "plutus_v2",
+ *   "bytes": "<hex-lowercase>"
+ * }
+ * \endcode
+ *
+ * The function emits both the opening and closing braces. It may be called at the
+ * JSON root or anywhere a value is expected (e.g., as an array element or after a
+ * property name).
+ *
+ * \param[in]     plutus_v3_script  A valid pointer to the script to serialize.
+ * \param[in,out] writer            A valid JSON writer positioned where a value can be written.
+ *
+ * \return
+ * - \c CARDANO_SUCCESS on success.
+ * - \c CARDANO_ERROR_POINTER_IS_NULL if \p plutus_v3_script or \p writer is \c NULL.
+ * - \c CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a temporary buffer cannot be allocated.
+ * - An error propagated from the writer if it is already in an error state (see
+ *   \ref cardano_json_writer_get_last_error).
+ *
+ * \code{.c}
+ * cardano_json_writer_t* w = cardano_json_writer_new(CARDANO_JSON_FORMAT_COMPACT);
+ * cardano_error_t rc = cardano_plutus_v3_script_to_cip116_json(script, w);
+ *
+ * if (rc == CARDANO_SUCCESS)
+ * {
+ *   cardano_buffer_t* out = NULL;
+ *   rc = cardano_json_writer_encode_in_buffer(w, &out);
+ *   // Use 'out' ...
+ *   cardano_buffer_unref(&out);
+ * }
+ *
+ * cardano_json_writer_unref(&w);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_to_cip116_json(
+  const cardano_plutus_v3_script_t* plutus_v3_script,
+  cardano_json_writer_t*            writer);
+
+/**
+ * \brief Gets the raw bytes of a compiled Plutus v3 script. If you need "cborBytes" for cardano-cli use \ref cardano_plutus_v3_script_to_cbor instead.
+ *
+ * This function converts a \ref cardano_plutus_v3_script_t object to its raw byte representation.
+ * The resulting bytes are stored in a \ref cardano_buffer_t object.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] plutus_v3_script A constant pointer to the \ref cardano_plutus_v3_script_t object to be converted.
+ * \param[out] compiled_script On successful conversion, this will point to a newly created
+ *                           \ref cardano_buffer_t object containing the extracted bytes.
+ *                           This object represents a "strong reference" to the compiled_script bytes,
+ *                           meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the bounded bytes are no longer needed, the caller must release it
+ *                           by calling \ref cardano_buffer_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_t* plutus_v3_script = ...; // Assume plutus_v3_script is initialized
+ * cardano_buffer_t* compiled_script = NULL;
+ * cardano_error_t result = cardano_plutus_v3_script_to_raw_bytes(plutus_v3_script, &compiled_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bounded bytes
+ *   printf("Extracted bounded bytes: ");
+ *
+ *   for (size_t i = 0; i < cardano_buffer_get_size(compiled_script); ++i)
+ *   {
+ *     printf("%02X ", cardano_buffer_get_data(compiled_script)[i]);
+ *   }
+ *
+ *   printf("\n");
+ *
+ *   // Once done, ensure to clean up and release the bounded bytes
+ *   cardano_buffer_unref(&compiled_script);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to extract bounded bytes: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the plutus_v3_script object once done
+ * cardano_plutus_v3_script_unref(&plutus_v3_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v3_script_to_raw_bytes(
+  cardano_plutus_v3_script_t* plutus_v3_script,
+  cardano_buffer_t**          compiled_script);
+
+/**
+ * \brief Retrieves the hash associated with a plutus_v3_script.
+ *
+ * This function computes the hash of a \ref cardano_plutus_v3_script_t object.
+ * It returns a new reference to a \ref cardano_blake2b_hash_t object representing the hash.
+ * It the caller's responsibility to release it by calling \ref cardano_blake2b_hash_unref when
+ * it is no longer needed.
+ *
+ * \param plutus_v3_script A constant pointer to the \ref cardano_plutus_v3_script_t object from which
+ *                   the hash is to be retrieved.
+ *
+ * \return A pointer to a new \ref cardano_blake2b_hash_t object containing the hash.
+ *         If the input plutus_v3_script is NULL, returns NULL. The caller is responsible for
+ *         managing the lifecycle of this object, including releasing it with
+ *         \ref cardano_blake2b_hash_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_t* original_plutus_v3_script = cardano_plutus_v3_script_new(...);
+ * cardano_blake2b_hash_t* hash_plutus_v3_script = cardano_plutus_v3_script_get_hash(original_plutus_v3_script);
+ *
+ * if (hash_plutus_v3_script)
+ * {
+ *   // Use the hash plutus_v3_script
+ *
+ *   // Once done, ensure to clean up and release the hash plutus_v3_script
+ *   cardano_blake2b_hash_unref(&hash_plutus_v3_script);
+ * }
+ * // Release the original plutus_v3_script after use
+ * cardano_plutus_v3_script_unref(&original_plutus_v3_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_plutus_v3_script_get_hash(const cardano_plutus_v3_script_t* plutus_v3_script);
+
+/**
+ * \brief Checks if two Plutus v3 script objects are equal.
+ *
+ * This function compares two \ref cardano_plutus_v3_script_t objects to determine if they are equal.
+ * Two Plutus v3 scripts are considered equal if they have the same content.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_plutus_v3_script_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_plutus_v3_script_t object to be compared.
+ *
+ * \return \c true if the two Plutus v3 scripts are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_t* script1 = ...;  // Assume script1 is initialized here
+ * cardano_plutus_v3_script_t* script2 = ...;  // Assume script2 is initialized here
+ *
+ * if (cardano_plutus_v3_script_equals(script1, script2))
+ * {
+ *   // The two Plutus v3 scripts are equal
+ * }
+ * else
+ * {
+ *   // The two Plutus v3 scripts are not equal
+ * }
+ *
+ * // Clean up the script objects once done
+ * cardano_plutus_v3_script_unref(&script1);
+ * cardano_plutus_v3_script_unref(&script2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_v3_script_equals(const cardano_plutus_v3_script_t* lhs, const cardano_plutus_v3_script_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a plutus_v3_script object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v3_script_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v3_script is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v3_script A pointer to the pointer of the plutus_v3_script object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_t* plutus_v3_script = cardano_plutus_v3_script_new();
+ *
+ * // Perform operations with the plutus_v3_script...
+ *
+ * cardano_plutus_v3_script_unref(&plutus_v3_script);
+ * // At this point, plutus_v3_script is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v3_script_unref, the pointer to the \ref cardano_plutus_v3_script_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v3_script_unref(cardano_plutus_v3_script_t** plutus_v3_script);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v3_script_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v3_script
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v3_script_unref.
+ *
+ * \param plutus_v3_script A pointer to the plutus_v3_script object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v3_script is a previously created plutus_v3_script object
+ *
+ * cardano_plutus_v3_script_ref(plutus_v3_script);
+ *
+ * // Now plutus_v3_script can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v3_script_ref there is a corresponding
+ * call to \ref cardano_plutus_v3_script_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v3_script_ref(cardano_plutus_v3_script_t* plutus_v3_script);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v3_script_t object.
+ *
+ * This function returns the number of active references to a plutus_v3_script object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v3_script_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v3_script A pointer to the plutus_v3_script object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v3_script object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v3_script_ref call is matched with a
+ * \ref cardano_plutus_v3_script_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v3_script is a previously created plutus_v3_script object
+ *
+ * size_t ref_count = cardano_plutus_v3_script_refcount(plutus_v3_script);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v3_script_refcount(const cardano_plutus_v3_script_t* plutus_v3_script);
+
+/**
+ * \brief Sets the last error message for a given plutus_v3_script object.
+ *
+ * Records an error message in the plutus_v3_script's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v3_script A pointer to the \ref cardano_plutus_v3_script_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v3_script's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v3_script_set_last_error(cardano_plutus_v3_script_t* plutus_v3_script, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v3_script.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v3_script_set_last_error for the given
+ * plutus_v3_script. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v3_script A pointer to the \ref cardano_plutus_v3_script_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v3_script is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v3_script.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v3_script. If the plutus_v3_script is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v3_script_set_last_error for the same plutus_v3_script, or until
+ *       the plutus_v3_script is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v3_script_get_last_error(const cardano_plutus_v3_script_t* plutus_v3_script);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v3_script_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v3_script_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_deep_clone(const cardano_plutus_v3_script_t* source, cardano_plutus_v3_script_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V3_SCRIPT_H
diff --git a/vendor/include/cardano/scripts/plutus_scripts/plutus_v4_script.h b/vendor/include/cardano/scripts/plutus_scripts/plutus_v4_script.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/plutus_scripts/plutus_v4_script.h
@@ -0,0 +1,545 @@
+/**
+ * \file plutus_v4_script.h
+ *
+ * \author angel.castillo
+ * \date   Jul 17, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V4_SCRIPT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V4_SCRIPT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V4 was introduced in the Dijkstra hard fork.
+ *
+ * V4 scripts run from protocol version 12. They can be serialized in transactions as witness set
+ * scripts, reference scripts or auxiliary data scripts, and they are the only Plutus scripts that
+ * run inside a sub transaction. A V4 script receives a single argument, the script context, and
+ * succeeds only when it returns the unit value.
+ */
+typedef struct cardano_plutus_v4_script_t cardano_plutus_v4_script_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus script from a byte array.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_v4_script_t object
+ * from a given byte array. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] bytes A pointer to the byte array from which the plutus_v4_script will be created.
+ * \param[in] size The size of the byte array.
+ * \param[out] plutus_v4_script On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v4_script_t object. This object represents a "strong reference"
+ *             to the plutus script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus script is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v4_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const byte_t bytes[] = {0x01, 0x02, 0x03, 0x04 ... }; // Example byte array
+ * size_t size = sizeof(bytes); // Calculate the size of the byte array
+ * cardano_plutus_v4_script_t* plutus_v4_script = NULL;
+ *
+ * // Attempt to create a new plutus script from a byte array
+ * cardano_error_t result = cardano_plutus_v4_script_new_bytes(bytes, size, &plutus_v4_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus script
+ *
+ *   // Once done, ensure to clean up and release the plutus script
+ *   cardano_plutus_v4_script_unref(&plutus_v4_script);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_new_bytes(
+  const byte_t*                bytes,
+  size_t                       size,
+  cardano_plutus_v4_script_t** plutus_v4_script);
+
+/**
+ * \brief Creates and initializes a new instance of a plutus script from a hexadecimal string.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_plutus_v4_script_t object
+ * from a given hexadecimal string. It returns an error code to indicate the success or
+ * failure of the operation.
+ *
+ * \param[in] hex A pointer to the hexadecimal string from which the plutus script will be created.
+ * \param[in] size The size of the hexadecimal string.
+ * \param[out] plutus_v4_script On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v4_script_t object. This object represents a "strong reference"
+ *             to the plutus script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus script is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v4_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* hex_string = "0123456789abcdef..."; // Example hexadecimal string
+ * size_t size = strlen(hex_string); // Calculate the size of the string
+ * cardano_plutus_v4_script_t* plutus_v4_script = NULL;
+ *
+ * // Attempt to create a new plutus script from a hexadecimal string
+ * cardano_error_t result = cardano_plutus_v4_script_new_bytes_from_hex(hex_string, size, &plutus_v4_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus script
+ *
+ *   // Once done, ensure to clean up and release the plutus script
+ *   cardano_plutus_v4_script_unref(&plutus_v4_script);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_new_bytes_from_hex(
+  const char*                  hex,
+  size_t                       size,
+  cardano_plutus_v4_script_t** plutus_v4_script);
+
+/**
+ * \brief Creates a plutus_v4_script from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v4_script_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v4_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v4_script data.
+ * \param[out] plutus_v4_script A pointer to a pointer of \ref cardano_plutus_v4_script_t that will be set to the address
+ *                        of the newly created plutus_v4_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v4_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v4_script_t object by calling
+ *       \ref cardano_plutus_v4_script_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v4_script_t* plutus_v4_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v4_script_from_cbor(reader, &plutus_v4_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v4_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v4_script
+ *   cardano_plutus_v4_script_unref(&plutus_v4_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v4_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v4_script_t** plutus_v4_script);
+
+/**
+ * \brief Serializes a plutus_v4_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v4_script_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v4_script A constant pointer to the \ref cardano_plutus_v4_script_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v4_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_t* plutus_v4_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v4_script_to_cbor(plutus_v4_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v4_script_unref(&plutus_v4_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v4_script_to_cbor(
+  const cardano_plutus_v4_script_t* plutus_v4_script,
+  cardano_cbor_writer_t*            writer);
+
+/**
+ * \brief Serializes a Plutus v4 script into a CIP-116 JSON object.
+ *
+ * Writes a single JSON object representing the script:
+ * \code{.json}
+ * {
+ *   "language": "plutus_v4",
+ *   "bytes": "<hex-lowercase>"
+ * }
+ * \endcode
+ *
+ * The function emits both the opening and closing braces. It may be called at the
+ * JSON root or anywhere a value is expected (e.g., as an array element or after a
+ * property name).
+ *
+ * \param[in]     plutus_v4_script  A valid pointer to the script to serialize.
+ * \param[in,out] writer            A valid JSON writer positioned where a value can be written.
+ *
+ * \return
+ * - \c CARDANO_SUCCESS on success.
+ * - \c CARDANO_ERROR_POINTER_IS_NULL if \p plutus_v4_script or \p writer is \c NULL.
+ * - \c CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a temporary buffer cannot be allocated.
+ * - An error propagated from the writer if it is already in an error state (see
+ *   \ref cardano_json_writer_get_last_error).
+ *
+ * \code{.c}
+ * cardano_json_writer_t* w = cardano_json_writer_new(CARDANO_JSON_FORMAT_COMPACT);
+ * cardano_error_t rc = cardano_plutus_v4_script_to_cip116_json(script, w);
+ *
+ * if (rc == CARDANO_SUCCESS)
+ * {
+ *   cardano_buffer_t* out = NULL;
+ *   rc = cardano_json_writer_encode_in_buffer(w, &out);
+ *   // Use 'out' ...
+ *   cardano_buffer_unref(&out);
+ * }
+ *
+ * cardano_json_writer_unref(&w);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_to_cip116_json(
+  const cardano_plutus_v4_script_t* plutus_v4_script,
+  cardano_json_writer_t*            writer);
+
+/**
+ * \brief Gets the raw bytes of a compiled Plutus v4 script. If you need "cborBytes" for cardano-cli use \ref cardano_plutus_v4_script_to_cbor instead.
+ *
+ * This function converts a \ref cardano_plutus_v4_script_t object to its raw byte representation.
+ * The resulting bytes are stored in a \ref cardano_buffer_t object.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] plutus_v4_script A constant pointer to the \ref cardano_plutus_v4_script_t object to be converted.
+ * \param[out] compiled_script On successful conversion, this will point to a newly created
+ *                           \ref cardano_buffer_t object containing the extracted bytes.
+ *                           This object represents a "strong reference" to the compiled_script bytes,
+ *                           meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the bounded bytes are no longer needed, the caller must release it
+ *                           by calling \ref cardano_buffer_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_t* plutus_v4_script = ...; // Assume plutus_v4_script is initialized
+ * cardano_buffer_t* compiled_script = NULL;
+ * cardano_error_t result = cardano_plutus_v4_script_to_raw_bytes(plutus_v4_script, &compiled_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bounded bytes
+ *   printf("Extracted bounded bytes: ");
+ *
+ *   for (size_t i = 0; i < cardano_buffer_get_size(compiled_script); ++i)
+ *   {
+ *     printf("%02X ", cardano_buffer_get_data(compiled_script)[i]);
+ *   }
+ *
+ *   printf("\n");
+ *
+ *   // Once done, ensure to clean up and release the bounded bytes
+ *   cardano_buffer_unref(&compiled_script);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to extract bounded bytes: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up the plutus_v4_script object once done
+ * cardano_plutus_v4_script_unref(&plutus_v4_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v4_script_to_raw_bytes(
+  cardano_plutus_v4_script_t* plutus_v4_script,
+  cardano_buffer_t**          compiled_script);
+
+/**
+ * \brief Retrieves the hash associated with a plutus_v4_script.
+ *
+ * This function computes the hash of a \ref cardano_plutus_v4_script_t object.
+ * It returns a new reference to a \ref cardano_blake2b_hash_t object representing the hash.
+ * It the caller's responsibility to release it by calling \ref cardano_blake2b_hash_unref when
+ * it is no longer needed.
+ *
+ * \param plutus_v4_script A constant pointer to the \ref cardano_plutus_v4_script_t object from which
+ *                   the hash is to be retrieved.
+ *
+ * \return A pointer to a new \ref cardano_blake2b_hash_t object containing the hash.
+ *         If the input plutus_v4_script is NULL, returns NULL. The caller is responsible for
+ *         managing the lifecycle of this object, including releasing it with
+ *         \ref cardano_blake2b_hash_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_t* original_plutus_v4_script = cardano_plutus_v4_script_new(...);
+ * cardano_blake2b_hash_t* hash_plutus_v4_script = cardano_plutus_v4_script_get_hash(original_plutus_v4_script);
+ *
+ * if (hash_plutus_v4_script)
+ * {
+ *   // Use the hash plutus_v4_script
+ *
+ *   // Once done, ensure to clean up and release the hash plutus_v4_script
+ *   cardano_blake2b_hash_unref(&hash_plutus_v4_script);
+ * }
+ * // Release the original plutus_v4_script after use
+ * cardano_plutus_v4_script_unref(&original_plutus_v4_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_plutus_v4_script_get_hash(const cardano_plutus_v4_script_t* plutus_v4_script);
+
+/**
+ * \brief Checks if two Plutus v4 script objects are equal.
+ *
+ * This function compares two \ref cardano_plutus_v4_script_t objects to determine if they are equal.
+ * Two Plutus v4 scripts are considered equal if they have the same content.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_plutus_v4_script_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_plutus_v4_script_t object to be compared.
+ *
+ * \return \c true if the two Plutus v4 scripts are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_t* script1 = ...;  // Assume script1 is initialized here
+ * cardano_plutus_v4_script_t* script2 = ...;  // Assume script2 is initialized here
+ *
+ * if (cardano_plutus_v4_script_equals(script1, script2))
+ * {
+ *   // The two Plutus v4 scripts are equal
+ * }
+ * else
+ * {
+ *   // The two Plutus v4 scripts are not equal
+ * }
+ *
+ * // Clean up the script objects once done
+ * cardano_plutus_v4_script_unref(&script1);
+ * cardano_plutus_v4_script_unref(&script2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_v4_script_equals(const cardano_plutus_v4_script_t* lhs, const cardano_plutus_v4_script_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a plutus_v4_script object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v4_script_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v4_script is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v4_script A pointer to the pointer of the plutus_v4_script object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_t* plutus_v4_script = cardano_plutus_v4_script_new();
+ *
+ * // Perform operations with the plutus_v4_script...
+ *
+ * cardano_plutus_v4_script_unref(&plutus_v4_script);
+ * // At this point, plutus_v4_script is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v4_script_unref, the pointer to the \ref cardano_plutus_v4_script_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v4_script_unref(cardano_plutus_v4_script_t** plutus_v4_script);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v4_script_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v4_script
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v4_script_unref.
+ *
+ * \param plutus_v4_script A pointer to the plutus_v4_script object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v4_script is a previously created plutus_v4_script object
+ *
+ * cardano_plutus_v4_script_ref(plutus_v4_script);
+ *
+ * // Now plutus_v4_script can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v4_script_ref there is a corresponding
+ * call to \ref cardano_plutus_v4_script_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v4_script_ref(cardano_plutus_v4_script_t* plutus_v4_script);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v4_script_t object.
+ *
+ * This function returns the number of active references to a plutus_v4_script object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v4_script_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v4_script A pointer to the plutus_v4_script object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v4_script object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v4_script_ref call is matched with a
+ * \ref cardano_plutus_v4_script_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v4_script is a previously created plutus_v4_script object
+ *
+ * size_t ref_count = cardano_plutus_v4_script_refcount(plutus_v4_script);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v4_script_refcount(const cardano_plutus_v4_script_t* plutus_v4_script);
+
+/**
+ * \brief Sets the last error message for a given plutus_v4_script object.
+ *
+ * Records an error message in the plutus_v4_script's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v4_script A pointer to the \ref cardano_plutus_v4_script_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v4_script's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v4_script_set_last_error(cardano_plutus_v4_script_t* plutus_v4_script, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v4_script.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v4_script_set_last_error for the given
+ * plutus_v4_script. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v4_script A pointer to the \ref cardano_plutus_v4_script_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v4_script is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v4_script.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v4_script. If the plutus_v4_script is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v4_script_set_last_error for the same plutus_v4_script, or until
+ *       the plutus_v4_script is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v4_script_get_last_error(const cardano_plutus_v4_script_t* plutus_v4_script);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v4_script_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v4_script_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_deep_clone(const cardano_plutus_v4_script_t* source, cardano_plutus_v4_script_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V4_SCRIPT_H
diff --git a/vendor/include/cardano/scripts/script.h b/vendor/include/cardano/scripts/script.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/script.h
@@ -0,0 +1,891 @@
+/**
+ * \file script.h
+ *
+ * \author angel.castillo
+ * \date   May 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/scripts/script_language.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Program that decides whether the transaction that spends the output is authorized to do so.
+ */
+typedef struct cardano_script_t cardano_script_t;
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ *
+ * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+ * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+ */
+typedef struct cardano_native_script_t cardano_native_script_t;
+
+/**
+ * \brief V1 was the initial version of Plutus, introduced in the Alonzo hard fork.
+ */
+typedef struct cardano_plutus_v1_script_t cardano_plutus_v1_script_t;
+
+/**
+ * \brief V2 was introduced in the Vasil hard fork.
+ *
+ * The main changes in V2 of Plutus were to the interface to scripts. The ScriptContext was extended
+ * to include the following information:
+ *
+ *  - The full "redeemers" structure, which contains all the redeemers used in the transaction
+ *  - Reference inputs in the transaction (proposed in CIP-31)
+ *  - Inline datums in the transaction (proposed in CIP-32)
+ *  - Reference scripts in the transaction (proposed in CIP-33)
+ */
+typedef struct cardano_plutus_v2_script_t cardano_plutus_v2_script_t;
+
+/**
+ * \brief V3 was introduced in the Conway hard fork.
+ *
+ * The main changes in V3 of Plutus were to the interface to scripts. The ScriptContext was extended
+ * to include the following information:
+ *
+ *  - A Map with all the votes that were included in the transaction.
+ *  - A list with Proposals that will be turned into GovernanceActions, that everyone can vote on
+ *  - Optional amount for the current treasury. If included it will be checked to be equal the current amount in the treasury.
+ *  - Optional amount for donating to the current treasury. If included, specified amount will go into the treasury.
+ */
+typedef struct cardano_plutus_v3_script_t cardano_plutus_v3_script_t;
+
+/**
+ * \brief V4 was introduced in the Dijkstra hard fork.
+ *
+ * V4 scripts run from protocol version 12. They can travel in transactions as witness
+ * set scripts, reference scripts or auxiliary data scripts, and they are the only Plutus
+ * scripts that run inside a sub transaction.
+ */
+typedef struct cardano_plutus_v4_script_t cardano_plutus_v4_script_t;
+
+/**
+ * \brief Creates and initializes a new instance of a script from a native_script.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_script_t object
+ * from a given \ref cardano_native_script_t object. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] native_script A constant pointer to the \ref cardano_native_script_t object from which
+ *                          the script will be created. The object must not be NULL.
+ * \param[out] script On successful initialization, this will point to a newly created
+ *             \ref cardano_script_t object. This object represents a "strong reference"
+ *             to the script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_t* native_script = cardano_native_script_new(...);
+ * cardano_script_t* script = NULL;
+ *
+ * // Attempt to create a new script from a native_script
+ * cardano_error_t result = cardano_script_new_native(native_script, &script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script
+ *
+ *   // Once done, ensure to clean up and release the script
+ *   cardano_script_unref(&script);
+ * }
+ *
+ * // Clean up the native_script object once done
+ * cardano_native_script_unref(&native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_new_native(
+  cardano_native_script_t* native_script,
+  cardano_script_t**       script);
+
+/**
+ * \brief Creates and initializes a new instance of a script from a Plutus V1 script.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_script_t object
+ * from a given \ref cardano_plutus_v1_script_t object. It returns an error code to indicate
+ * the success or failure of the operation.
+ *
+ * \param[in] plutus_v1_script A constant pointer to the \ref cardano_plutus_v1_script_t object from which
+ *                             the script will be created. The object must not be NULL.
+ * \param[out] script On successful initialization, this will point to a newly created
+ *             \ref cardano_script_t object. This object represents a "strong reference"
+ *             to the script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_t* plutus_v1_script = cardano_plutus_v1_script_new(...);
+ * cardano_script_t* script = NULL;
+ *
+ * // Attempt to create a new script from a Plutus V1 script
+ * cardano_error_t result = cardano_script_new_plutus_v1(plutus_v1_script, &script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script
+ *
+ *   // Once done, ensure to clean up and release the script
+ *   cardano_script_unref(&script);
+ * }
+ *
+ * // Clean up the plutus_v1_script object once done
+ * cardano_plutus_v1_script_unref(&plutus_v1_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_new_plutus_v1(
+  cardano_plutus_v1_script_t* plutus_v1_script,
+  cardano_script_t**          script);
+
+/**
+ * \brief Creates and initializes a new instance of a script from a Plutus V2 script.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_script_t object
+ * from a given \ref cardano_plutus_v2_script_t object. It returns an error code to indicate
+ * the success or failure of the operation.
+ *
+ * \param[in] plutus_v2_script A constant pointer to the \ref cardano_plutus_v2_script_t object from which
+ *                             the script will be created. The object must not be NULL.
+ * \param[out] script On successful initialization, this will point to a newly created
+ *             \ref cardano_script_t object. This object represents a "strong reference"
+ *             to the script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_t* plutus_v2_script = cardano_plutus_v2_script_new(...);
+ * cardano_script_t* script = NULL;
+ *
+ * // Attempt to create a new script from a Plutus V2 script
+ * cardano_error_t result = cardano_script_new_plutus_v2(plutus_v2_script, &script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script
+ *
+ *   // Once done, ensure to clean up and release the script
+ *   cardano_script_unref(&script);
+ * }
+ *
+ * // Clean up the plutus_v2_script object once done
+ * cardano_plutus_v2_script_unref(&plutus_v2_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_new_plutus_v2(
+  cardano_plutus_v2_script_t* plutus_v2_script,
+  cardano_script_t**          script);
+
+/**
+ * \brief Creates and initializes a new instance of a script from a Plutus V3 script.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_script_t object
+ * from a given \ref cardano_plutus_v3_script_t object. It returns an error code to indicate
+ * the success or failure of the operation.
+ *
+ * \param[in] plutus_v3_script A constant pointer to the \ref cardano_plutus_v3_script_t object from which
+ *                             the script will be created. The object must not be NULL.
+ * \param[out] script On successful initialization, this will point to a newly created
+ *             \ref cardano_script_t object. This object represents a "strong reference"
+ *             to the script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_t* plutus_v3_script = cardano_plutus_v3_script_new(...);
+ * cardano_script_t* script = NULL;
+ *
+ * // Attempt to create a new script from a Plutus V3 script
+ * cardano_error_t result = cardano_script_new_plutus_v3(plutus_v3_script, &script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script
+ *
+ *   // Once done, ensure to clean up and release the script
+ *   cardano_script_unref(&script);
+ * }
+ *
+ * // Clean up the plutus_v3_script object once done
+ * cardano_plutus_v3_script_unref(&plutus_v3_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_new_plutus_v3(
+  cardano_plutus_v3_script_t* plutus_v3_script,
+  cardano_script_t**          script);
+
+/**
+ * \brief Creates and initializes a new instance of a script from a Plutus V4 script.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_script_t object
+ * from a given \ref cardano_plutus_v4_script_t object. It returns an error code to indicate
+ * the success or failure of the operation.
+ *
+ * \param[in] plutus_v4_script A constant pointer to the \ref cardano_plutus_v4_script_t object from which
+ *                             the script will be created. The object must not be NULL.
+ * \param[out] script On successful initialization, this will point to a newly created
+ *             \ref cardano_script_t object. This object represents a "strong reference"
+ *             to the script, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the script is no longer needed, the caller must release it
+ *             by calling \ref cardano_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the script was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_t* plutus_v4_script = cardano_plutus_v4_script_new(...);
+ * cardano_script_t* script = NULL;
+ *
+ * // Attempt to create a new script from a Plutus V4 script
+ * cardano_error_t result = cardano_script_new_plutus_v4(plutus_v4_script, &script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script
+ *
+ *   // Once done, ensure to clean up and release the script
+ *   cardano_script_unref(&script);
+ * }
+ *
+ * // Clean up the plutus_v4_script object once done
+ * cardano_plutus_v4_script_unref(&plutus_v4_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_new_plutus_v4(
+  cardano_plutus_v4_script_t* plutus_v4_script,
+  cardano_script_t**          script);
+
+/**
+ * \brief Creates a script from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_script_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded script data.
+ * \param[out] script A pointer to a pointer of \ref cardano_script_t that will be set to the address
+ *                        of the newly created script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_script_t object by calling
+ *       \ref cardano_script_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_script_t* script = NULL;
+ *
+ * cardano_error_t result = cardano_script_from_cbor(reader, &script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the script
+ *
+ *   // Once done, ensure to clean up and release the script
+ *   cardano_script_unref(&script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_from_cbor(cardano_cbor_reader_t* reader, cardano_script_t** script);
+
+/**
+ * \brief Serializes a script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_script_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] script A constant pointer to the \ref cardano_script_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_t* script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_script_to_cbor(script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_script_unref(&script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_to_cbor(
+  const cardano_script_t* script,
+  cardano_cbor_writer_t*  writer);
+
+/**
+ * \brief Serializes a \ref cardano_script_t as a CIP-116 ScriptRef JSON object.
+ *
+ * This function writes a single JSON object.
+ *
+ * The inner \c value is produced by the corresponding serializer:
+ * - Native: \ref cardano_native_script_to_cip116_json
+ * - Plutus v1: \ref cardano_plutus_v1_script_to_cip116_json
+ * - Plutus v2: \ref cardano_plutus_v2_script_to_cip116_json
+ * - Plutus v3: \ref cardano_plutus_v3_script_to_cip116_json
+ * - Plutus v4: \ref cardano_plutus_v4_script_to_cip116_json
+ *
+ * Keys are emitted in the order: "tag", then "value".
+ *
+ * \param[in]  script A valid pointer to the script to serialize.
+ * \param[in,out] writer A valid JSON writer positioned where a value is expected.
+ *
+ * \return CARDANO_SUCCESS                       On success.
+ * \return CARDANO_ERROR_POINTER_IS_NULL         If \p script or \p writer is NULL.
+ * \return CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE If the script language is not supported.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_script_to_cip116_json(
+  const cardano_script_t* script,
+  cardano_json_writer_t*  writer);
+
+/**
+ * \brief Retrieves the language of the script.
+ *
+ * This function retrieves the language of a given \ref cardano_script_t object and stores it in the provided
+ * output parameter. The script language is defined in the \ref cardano_script_language_t enumeration.
+ *
+ * \param[in] script A constant pointer to the \ref cardano_script_t object from which
+ *                        the language is to be retrieved. The object must not be NULL.
+ * \param[out] language Pointer to a variable where the script language will be stored. This variable will
+ *                      be set to the value from the \ref cardano_script_language_t enumeration.
+ *
+ * \return \ref CARDANO_SUCCESS if the language was successfully retrieved, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_t* script = cardano_script_new_bytes_from_hex(...);
+ * cardano_script_language_t language;
+ * cardano_error_t result = cardano_script_get_language(script, &language);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (language == CARDANO_SCRIPT_LANGUAGE_NATIVE)
+ *   {
+ *     // Handle native script
+ *   }
+ *   else if (language == CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1)
+ *   {
+ *     // Handle Plutus V1 script
+ *   }
+ *   // Add more cases as needed for other languages
+ * }
+ *
+ * // Clean up the script object once done
+ * cardano_script_unref(&script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_get_language(
+  const cardano_script_t*    script,
+  cardano_script_language_t* language);
+
+/**
+ * \brief Converts a script object to a native script object.
+ *
+ * This function converts a \ref cardano_script_t object to a \ref cardano_native_script_t object.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] script A constant pointer to the \ref cardano_script_t object to be converted.
+ * \param[out] native_script On successful conversion, this will point to a newly created
+ *                           \ref cardano_native_script_t object. This object represents a "strong reference"
+ *                           to the native script, meaning that it is fully initialized and ready for use.
+ *                           The caller is responsible for managing the lifecycle of this object.
+ *                           Specifically, once the native script is no longer needed, the caller must release it
+ *                           by calling \ref cardano_native_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_t* script = ...; // Assume script is a valid script object
+ * cardano_native_script_t* native_script = NULL;
+ * cardano_error_t result = cardano_script_to_native(script, &native_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script
+ *
+ *   // Once done, ensure to clean up and release the native_script
+ *   cardano_native_script_unref(&native_script);
+ * }
+ *
+ * // Clean up the script object once done
+ * cardano_script_unref(&script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_to_native(
+  cardano_script_t*         script,
+  cardano_native_script_t** native_script);
+
+/**
+ * \brief Converts a script object to a Plutus V1 script object.
+ *
+ * This function converts a \ref cardano_script_t object to a \ref cardano_plutus_v1_script_t object.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] script A constant pointer to the \ref cardano_script_t object to be converted.
+ * \param[out] plutus_v1 On successful conversion, this will point to a newly created
+ *                       \ref cardano_plutus_v1_script_t object. This object represents a "strong reference"
+ *                       to the Plutus V1 script, meaning that it is fully initialized and ready for use.
+ *                       The caller is responsible for managing the lifecycle of this object.
+ *                       Specifically, once the Plutus V1 script is no longer needed, the caller must release it
+ *                       by calling \ref cardano_plutus_v1_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_t* script = ...; // Assume script is a valid script object
+ * cardano_plutus_v1_script_t* plutus_v1 = NULL;
+ * cardano_error_t result = cardano_script_to_plutus_v1(script, &plutus_v1);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the Plutus V1 script
+ *
+ *   // Once done, ensure to clean up and release the Plutus V1 script
+ *   cardano_plutus_v1_script_unref(&plutus_v1);
+ * }
+ *
+ * // Clean up the script object once done
+ * cardano_script_unref(&script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_to_plutus_v1(
+  cardano_script_t*            script,
+  cardano_plutus_v1_script_t** plutus_v1);
+
+/**
+ * \brief Converts a script object to a Plutus V2 script object.
+ *
+ * This function converts a \ref cardano_script_t object to a \ref cardano_plutus_v2_script_t object.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] script A constant pointer to the \ref cardano_script_t object to be converted.
+ * \param[out] plutus_v2 On successful conversion, this will point to a newly created
+ *                       \ref cardano_plutus_v2_script_t object. This object represents a "strong reference"
+ *                       to the Plutus V2 script, meaning that it is fully initialized and ready for use.
+ *                       The caller is responsible for managing the lifecycle of this object.
+ *                       Specifically, once the Plutus V2 script is no longer needed, the caller must release it
+ *                       by calling \ref cardano_plutus_v2_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_t* script = ...; // Assume script is a valid script object
+ * cardano_plutus_v2_script_t* plutus_v2 = NULL;
+ * cardano_error_t result = cardano_script_to_plutus_v2(script, &plutus_v2);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the Plutus V2 script
+ *
+ *   // Once done, ensure to clean up and release the Plutus V2 script
+ *   cardano_plutus_v2_script_unref(&plutus_v2);
+ * }
+ *
+ * // Clean up the script object once done
+ * cardano_script_unref(&script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_to_plutus_v2(
+  cardano_script_t*            script,
+  cardano_plutus_v2_script_t** plutus_v2);
+
+/**
+ * \brief Converts a script object to a Plutus V3 script object.
+ *
+ * This function converts a \ref cardano_script_t object to a \ref cardano_plutus_v3_script_t object.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] script A constant pointer to the \ref cardano_script_t object to be converted.
+ * \param[out] plutus_v3 On successful conversion, this will point to a newly created
+ *                       \ref cardano_plutus_v3_script_t object. This object represents a "strong reference"
+ *                       to the Plutus V3 script, meaning that it is fully initialized and ready for use.
+ *                       The caller is responsible for managing the lifecycle of this object.
+ *                       Specifically, once the Plutus V3 script is no longer needed, the caller must release it
+ *                       by calling \ref cardano_plutus_v3_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_t* script = ...; // Assume script is a valid script object
+ * cardano_plutus_v3_script_t* plutus_v3 = NULL;
+ * cardano_error_t result = cardano_script_to_plutus_v3(script, &plutus_v3);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the Plutus V3 script
+ *
+ *   // Once done, ensure to clean up and release the Plutus V3 script
+ *   cardano_plutus_v3_script_unref(&plutus_v3);
+ * }
+ *
+ * // Clean up the script object once done
+ * cardano_script_unref(&script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_to_plutus_v3(
+  cardano_script_t*            script,
+  cardano_plutus_v3_script_t** plutus_v3);
+
+/**
+ * \brief Converts a script object to a Plutus V4 script object.
+ *
+ * This function converts a \ref cardano_script_t object to a \ref cardano_plutus_v4_script_t object.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] script A constant pointer to the \ref cardano_script_t object to be converted.
+ * \param[out] plutus_v4 On successful conversion, this will point to a newly created
+ *                       \ref cardano_plutus_v4_script_t object. This object represents a "strong reference"
+ *                       to the Plutus V4 script, meaning that it is fully initialized and ready for use.
+ *                       The caller is responsible for managing the lifecycle of this object.
+ *                       Specifically, once the Plutus V4 script is no longer needed, the caller must release it
+ *                       by calling \ref cardano_plutus_v4_script_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the conversion was successful, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_t* script = ...; // Assume script is a valid script object
+ * cardano_plutus_v4_script_t* plutus_v4 = NULL;
+ * cardano_error_t result = cardano_script_to_plutus_v4(script, &plutus_v4);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the Plutus V4 script
+ *
+ *   // Once done, ensure to clean up and release the Plutus V4 script
+ *   cardano_plutus_v4_script_unref(&plutus_v4);
+ * }
+ *
+ * // Clean up the script object once done
+ * cardano_script_unref(&script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_script_to_plutus_v4(
+  cardano_script_t*            script,
+  cardano_plutus_v4_script_t** plutus_v4);
+
+/**
+ * \brief Retrieves the hash associated with a script.
+ *
+ * This function computes the hash of a \ref cardano_script_t object.
+ * It returns a new reference to a \ref cardano_blake2b_hash_t object representing the hash.
+ * It the caller's responsibility to release it by calling \ref cardano_blake2b_hash_unref when
+ * it is no longer needed.
+ *
+ * \param script A constant pointer to the \ref cardano_script_t object from which
+ *                   the hash is to be retrieved.
+ *
+ * \return A pointer to a new \ref cardano_blake2b_hash_t object containing the hash.
+ *         If the input script is NULL, returns NULL. The caller is responsible for
+ *         managing the lifecycle of this object, including releasing it with
+ *         \ref cardano_blake2b_hash_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_t* original_script = cardano_script_new(...);
+ * cardano_blake2b_hash_t* hash_script = cardano_script_get_hash(original_script);
+ *
+ * if (hash_script)
+ * {
+ *   // Use the hash script
+ *
+ *   // Once done, ensure to clean up and release the hash script
+ *   cardano_blake2b_hash_unref(&hash_script);
+ * }
+ * // Release the original script after use
+ * cardano_script_unref(&original_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_script_get_hash(const cardano_script_t* script);
+
+/**
+ * \brief Checks if two script objects are equal.
+ *
+ * This function compares two \ref cardano_script_t objects for equality.
+ * It checks if the contents of the two script objects are identical.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_script_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_script_t object to be compared.
+ *
+ * \return \c true if the two script objects are equal (have the same contents), \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_t* script1 = ...; // Assume script1 is initialized
+ * cardano_script_t* script2 = ...; // Assume script2 is initialized
+ *
+ * if (cardano_script_equals(script1, script2))
+ * {
+ *   printf("script1 is equal to script2\n");
+ * }
+ * else
+ * {
+ *   printf("script1 is not equal to script2\n");
+ * }
+ *
+ * // Clean up the script objects once done
+ * cardano_script_unref(&script1);
+ * cardano_script_unref(&script2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_script_equals(const cardano_script_t* lhs, const cardano_script_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a script object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_script_t object
+ * by decreasing its reference count. When the reference count reaches zero, the script is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] script A pointer to the pointer of the script object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_t* script = cardano_script_new();
+ *
+ * // Perform operations with the script...
+ *
+ * cardano_script_unref(&script);
+ * // At this point, script is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_script_unref, the pointer to the \ref cardano_script_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_script_unref(cardano_script_t** script);
+
+/**
+ * \brief Increases the reference count of the cardano_script_t object.
+ *
+ * This function is used to manually increment the reference count of a script
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_script_unref.
+ *
+ * \param script A pointer to the script object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script is a previously created script object
+ *
+ * cardano_script_ref(script);
+ *
+ * // Now script can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_script_ref there is a corresponding
+ * call to \ref cardano_script_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_script_ref(cardano_script_t* script);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_script_t object.
+ *
+ * This function returns the number of active references to a script object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_script_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param script A pointer to the script object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified script object. If the object
+ * is properly managed (i.e., every \ref cardano_script_ref call is matched with a
+ * \ref cardano_script_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming script is a previously created script object
+ *
+ * size_t ref_count = cardano_script_refcount(script);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_script_refcount(const cardano_script_t* script);
+
+/**
+ * \brief Sets the last error message for a given script object.
+ *
+ * Records an error message in the script's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] script A pointer to the \ref cardano_script_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the script's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_script_set_last_error(cardano_script_t* script, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific script.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_script_set_last_error for the given
+ * script. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] script A pointer to the \ref cardano_script_t instance whose last error
+ *                   message is to be retrieved. If the script is NULL, the function
+ *                   returns a generic error message indicating the null script.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified script. If the script is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_script_set_last_error for the same script, or until
+ *       the script is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_script_get_last_error(const cardano_script_t* script);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_script_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_script_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_script_deep_clone(const cardano_script_t* source, cardano_script_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_H
diff --git a/vendor/include/cardano/scripts/script_language.h b/vendor/include/cardano/scripts/script_language.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/scripts/script_language.h
@@ -0,0 +1,94 @@
+/**
+ * \file script_language.h
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_LANGUAGE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_LANGUAGE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Script language.
+ */
+typedef enum
+{
+  /**
+   * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+   *
+   * Note that it is recursive. There are no constraints on the nesting or size, except that imposed by the overall
+   * transaction size limit (given that the script must be included in the transaction in a script witnesses).
+   */
+  CARDANO_SCRIPT_LANGUAGE_NATIVE,
+
+  /**
+   * \brief V1 was the initial version of Plutus, introduced in the Alonzo hard fork.
+   */
+  CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1,
+
+  /**
+   * \brief V2 was introduced in the Vasil hard fork.
+   *
+   * The main changes in V2 of Plutus were to the interface to scripts. The ScriptContext was extended
+   * to include the following information:
+   *
+   *  - The full "redeemers" structure, which contains all the redeemers used in the transaction
+   *  - Reference inputs in the transaction (proposed in CIP-31)
+   *  - Inline datums in the transaction (proposed in CIP-32)
+   *  - Reference scripts in the transaction (proposed in CIP-33)
+   */
+  CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2,
+
+  /**
+   * \brief V3 was introduced in the Conway hard fork.
+   *
+   * The main changes in V3 of Plutus were to the interface to scripts. The ScriptContext was extended
+   * to include the following information:
+   *
+   *  - A Map with all the votes that were included in the transaction.
+   *  - A list with Proposals that will be turned into GovernanceActions, that everyone can vote on
+   *  - Optional amount for the current treasury. If included it will be checked to be equal the current amount in the treasury.
+   *  - Optional amount for donating to the current treasury. If included, specified amount will go into the treasury.
+   */
+  CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3,
+
+  /**
+   * \brief V4 was introduced in the Dijkstra hard fork.
+   *
+   * V4 scripts run from protocol version 12. They can travel in transactions as witness
+   * set scripts, reference scripts or auxiliary data scripts, and they are the only Plutus
+   * scripts that run inside a sub transaction.
+   */
+  CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4,
+
+} cardano_script_language_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_LANGUAGE_H
diff --git a/vendor/include/cardano/slot_config.h b/vendor/include/cardano/slot_config.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/slot_config.h
@@ -0,0 +1,86 @@
+/**
+ * \file slot_config.h
+ *
+ * \author angel.castillo
+ * \date   Dec 21, 2025
+ *
+ * Copyright 2025 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SLOT_CONFIG_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SLOT_CONFIG_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/network_magic.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Configuration structure for slot timing on the Cardano network.
+ *
+ * The `cardano_slot_config_t` structure encapsulates configuration parameters for
+ * converting between Unix time and slots in the Cardano network. This structure
+ * provides essential timing information to correctly interpret and compute slot numbers
+ * based on network-specific parameters.
+ */
+typedef struct cardano_slot_config_t
+{
+    /**
+     * \brief The start zero_time in milliseconds since the Unix epoch. This zero_time aligns with `zero_slot` and
+     * acts as a baseline for slot and epoch calculations.
+     */
+    uint64_t zero_time;
+
+    /**
+     * \brief The initial slot number corresponding to `zero_time`. It is the reference slot number that
+     * maps directly to `zero_time`, allowing accurate calculation of other slot numbers relative to
+     * this baseline.
+     */
+    uint64_t zero_slot;
+
+    /**
+     * \brief The duration of each slot in milliseconds. This value is crucial for slot_config-to-slot
+     * conversions, providing the length of slot_config between consecutive slots.
+     */
+    uint64_t slot_length;
+} cardano_slot_config_t;
+
+/**
+ * \brief Predefined slot configuration for the Cardano Mainnet.
+ */
+extern const cardano_slot_config_t CARDANO_MAINNET_SLOT_CONFIG;
+
+/**
+ * \brief Predefined slot configuration for the Cardano Preview network.
+ */
+extern const cardano_slot_config_t CARDANO_PREVIEW_SLOT_CONFIG;
+
+/**
+ * \brief Predefined slot configuration for the Cardano Preprod network.
+ */
+extern const cardano_slot_config_t CARDANO_PREPROD_SLOT_CONFIG;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SLOT_CONFIG_H
diff --git a/vendor/include/cardano/time.h b/vendor/include/cardano/time.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/time.h
@@ -0,0 +1,168 @@
+/**
+ * \file time.h
+ *
+ * \author angel.castillo
+ * \date   Nov 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TIMES_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TIMES_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/network_magic.h>
+#include <cardano/export.h>
+#include <cardano/slot_config.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Computes the Unix start time (in milliseconds) of a given slot.
+ *
+ * This function converts a slot number into the Unix timestamp (milliseconds)
+ * representing the exact beginning of that slot. The calculation is performed
+ * using the linear slot progression model defined by the supplied
+ * \ref cardano_slot_config_t structure, which specifies:
+ *
+ * - `zero_time`   — the Unix time (ms) corresponding to `zero_slot`
+ * - `zero_slot`   — the reference slot number
+ * - `slot_length` — duration of a single slot in milliseconds
+ *
+ * The formula used is:
+ * \code
+ * unix_time = config->zero_time
+ *           + (slot - config->zero_slot) * config->slot_length;
+ * \endcode
+ *
+ * \param[in] slot
+ *   The absolute slot number whose starting Unix time should be computed.
+ *
+ * \param[in] config
+ *   Pointer to a valid \ref cardano_slot_config_t providing slot timing rules.
+ *   Must not be `NULL`.
+ *
+ * \return
+ *   The Unix start time of the given slot, expressed in milliseconds since
+ *   the Unix epoch. If `config` is `NULL`, the returned value is unspecified.
+ *
+ * \note
+ *   This function assumes constant slot duration and does not model historical
+ *   hard-fork boundaries or era transitions where slot lengths changed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t
+slot_to_begin_unix_time(uint64_t slot, const cardano_slot_config_t* config);
+
+/**
+ * \brief Converts a Unix timestamp (in milliseconds) to the enclosing slot number.
+ *
+ * This function calculates the slot that *contains* the specified Unix time using
+ * the linear relation defined by \ref cardano_slot_config_t. The operation
+ * determines how many full slot intervals have elapsed since `zero_time`, and
+ * returns the slot at or immediately before the provided timestamp.
+ *
+ * The formula used is:
+ * \code
+ * slot = config->zero_slot
+ *      + (unix_time - config->zero_time) / config->slot_length;
+ * \endcode
+ *
+ * \param[in] unix_time
+ *   The Unix timestamp in milliseconds for which the corresponding slot should
+ *   be determined.
+ *
+ * \param[in] config
+ *   Pointer to a valid \ref cardano_slot_config_t supplying slot timing rules.
+ *   Must not be `NULL`.
+ *
+ * \return
+ *   The slot number that encloses the given timestamp. If `config` is `NULL`,
+ *   the returned value is unspecified.
+ *
+ * \note
+ *   This function uses truncation toward zero to determine the enclosing slot.
+ *   It assumes a fixed slot length and does not account for historical chain
+ *   eras with variable slot durations.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t
+unix_time_to_enclosing_slot(uint64_t unix_time, const cardano_slot_config_t* config);
+
+/**
+ * \brief Computes the Cardano network slot for a given Unix time.
+ *
+ * This function calculates the slot number on the Cardano network corresponding to a specified Unix timestamp.
+ * Since slot duration may vary across different networks and over time, this computation requires both the
+ * network magic and the Unix time.
+ *
+ * \param[in] magic     The network magic (\ref cardano_network_magic_t) identifying the specific Cardano network.
+ * \param[in] unix_time The Unix timestamp in seconds for which to compute the slot.
+ *
+ * \returns The computed slot number as a uint64_t, representing the slot at the specified Unix time.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_network_magic_t magic = CARDANO_NETWORK_MAGIC_MAINNET; // Obtain network magic
+ * uint64_t unix_time = 1700000000; // Example Unix timestamp
+ * uint64_t slot = cardano_compute_slot_from_unix_time(magic, unix_time);
+ *
+ * printf("Computed slot: %llu\n", (unsigned long long)slot);
+ * \endcode
+ *
+ * \note Slot duration and epoch boundaries may vary across networks and can change over time. This function
+ *       takes these network-specific configurations into account.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_compute_slot_from_unix_time(cardano_network_magic_t magic, uint64_t unix_time);
+
+/**
+ * \brief Computes the Unix time corresponding to a given Cardano network slot.
+ *
+ * This function calculates the Unix timestamp for a specified slot number on the Cardano network.
+ * Slot-to-time mapping depends on the network's specific slot duration and other time-related parameters
+ * that may vary across different Cardano networks and epochs.
+ *
+ * \param[in] magic The network magic (\ref cardano_network_magic_t) identifying the specific Cardano network.
+ * \param[in] slot  The slot number for which to compute the Unix time.
+ *
+ * \returns The computed Unix timestamp in seconds as a uint64_t, representing the time at the specified slot.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_network_magic_t magic = ...; // Obtain network magic
+ * uint64_t slot = 500000; // Example slot number
+ * uint64_t unix_time = cardano_compute_unix_time_from_slot(magic, slot);
+ *
+ * printf("Computed Unix time: %llu\n", (unsigned long long)unix_time);
+ * \endcode
+ *
+ * \note The conversion relies on the network's configuration, as different networks and epochs
+ *       may have varying slot durations, affecting the calculated Unix time.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_compute_unix_time_from_slot(cardano_network_magic_t magic, uint64_t slot);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TIMES_H
diff --git a/vendor/include/cardano/transaction/sub_transaction.h b/vendor/include/cardano/transaction/sub_transaction.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction/sub_transaction.h
@@ -0,0 +1,743 @@
+/**
+ * \file sub_transaction.h
+ *
+ * \author angel.castillo
+ * \date   Jul 17, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/auxiliary_data.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+#include <cardano/typedefs.h>
+#include <cardano/witness_set/witness_set.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A sub transaction is a transaction nested inside a top-level transaction.
+ *
+ * Sub transactions allow several parties to compose intents that are validated and applied
+ * atomically as part of a single top-level transaction. Each sub transaction carries its own
+ * body, its own witness set and, optionally, its own auxiliary data.
+ *
+ * On the wire a sub transaction is a three element array of the form
+ * [sub_transaction_body, transaction_witness_set, auxiliary_data / null]. Unlike the top-level
+ * mempool encoding, a sub transaction carries no validity flag, and absent auxiliary data is
+ * encoded as a CBOR null.
+ */
+typedef struct cardano_sub_transaction_t cardano_sub_transaction_t;
+
+/**
+ * \brief Serializes this Dijkstra value using CIP-116 JSON conventions.
+ *
+ * Encodes the body, witness set and optional auxiliary data, without an is_valid field.
+ *
+ * \param[in] tx Value to serialize. Must not be NULL.
+ * \param[in] writer JSON writer that receives the encoded value. Must not be NULL.
+ *
+ * \return CARDANO_SUCCESS on success, CARDANO_ERROR_POINTER_IS_NULL for a NULL argument,
+ *         or the error returned by a child serializer.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_to_cip116_json(const cardano_sub_transaction_t* tx, cardano_json_writer_t* writer);
+
+/**
+ * \brief Creates and initializes a new Cardano sub transaction.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_sub_transaction_t object,
+ * which represents a Cardano sub transaction consisting of a sub transaction body, witness set, and optional auxiliary data.
+ *
+ * \param[in] body A pointer to an initialized \ref cardano_sub_transaction_body_t object that represents the sub transaction body.
+ *                 This parameter is required and must not be NULL.
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object that contains the witness data for the sub transaction.
+ *                        This parameter is required and must not be NULL.
+ * \param[in] auxiliary_data An optional pointer to a \ref cardano_auxiliary_data_t object representing any auxiliary data associated
+ *                           with the sub transaction. This parameter can be NULL if no auxiliary data is provided.
+ * \param[out] sub_transaction On successful creation, this will point to a newly created \ref cardano_sub_transaction_t object. The caller is
+ *                             responsible for managing the lifecycle of this object. Specifically, once the sub transaction is no longer needed,
+ *                             the caller must release it by calling \ref cardano_sub_transaction_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the sub transaction was successfully created,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (body or witness_set) are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* body = ...; // Assume body is initialized
+ * cardano_witness_set_t* witness_set = ...; // Assume witness set is initialized
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Optional: can be NULL if no auxiliary data is present
+ * cardano_sub_transaction_t* sub_transaction = NULL;
+ *
+ * cardano_error_t result = cardano_sub_transaction_new(body, witness_set, auxiliary_data, &sub_transaction);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the sub transaction
+ *
+ *   // Once done, ensure to clean up and release the sub transaction
+ *   cardano_sub_transaction_unref(&sub_transaction);
+ * }
+ * else
+ * {
+ *   printf("Failed to create sub transaction: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_new(
+  cardano_sub_transaction_body_t* body,
+  cardano_witness_set_t*          witness_set,
+  cardano_auxiliary_data_t*       auxiliary_data,
+  cardano_sub_transaction_t**     sub_transaction);
+
+/**
+ * \brief Creates a \ref cardano_sub_transaction_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_sub_transaction_t object.
+ * The CBOR data must be a three element array of the form [sub_transaction_body, transaction_witness_set, auxiliary_data / null];
+ * arrays with any other number of elements are rejected.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] sub_transaction A pointer to a pointer of \ref cardano_sub_transaction_t that will be set to the address
+ *                             of the newly created sub transaction object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the sub transaction was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, transactions are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical transaction representation, meaning that if you decode a sub transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the sub transaction id and invalidate any existing signatures.
+ *         To prevent this, when a sub transaction object is created using \ref cardano_sub_transaction_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_sub_transaction_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_sub_transaction_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_sub_transaction_t object by calling
+ *       \ref cardano_sub_transaction_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_sub_transaction_t* sub_transaction = NULL;
+ *
+ * cardano_error_t result = cardano_sub_transaction_from_cbor(reader, &sub_transaction);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the sub transaction
+ *
+ *   // Once done, ensure to clean up and release the sub transaction
+ *   cardano_sub_transaction_unref(&sub_transaction);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode sub transaction: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_from_cbor(cardano_cbor_reader_t* reader, cardano_sub_transaction_t** sub_transaction);
+
+/**
+ * \brief Serializes a sub transaction into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_sub_transaction_t object using a \ref cardano_cbor_writer_t.
+ * The sub transaction is written as a three element array of the form
+ * [sub_transaction_body, transaction_witness_set, auxiliary_data / null]. If the sub transaction has no
+ * auxiliary data, a CBOR null is written in its place.
+ *
+ * \param[in] sub_transaction A constant pointer to the \ref cardano_sub_transaction_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p sub_transaction or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, transactions are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical transaction representation, meaning that if you decode a sub transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the sub transaction id and invalidate any existing signatures.
+ *         To prevent this, when a sub transaction object is created using \ref cardano_sub_transaction_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_sub_transaction_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_sub_transaction_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_sub_transaction_to_cbor(sub_transaction, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_sub_transaction_unref(&sub_transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_transaction_to_cbor(
+  const cardano_sub_transaction_t* sub_transaction,
+  cardano_cbor_writer_t*           writer);
+
+/**
+ * \brief Retrieves the sub transaction body from a sub transaction object.
+ *
+ * This function extracts the sub transaction body (\ref cardano_sub_transaction_body_t) from a given
+ * \ref cardano_sub_transaction_t object. The sub transaction body contains the essential elements of the
+ * sub transaction, such as inputs, outputs, and more.
+ *
+ * \param[in] sub_transaction A pointer to an initialized \ref cardano_sub_transaction_t object.
+ *
+ * \return A pointer to the \ref cardano_sub_transaction_body_t object representing the body of the sub transaction.
+ *         The returned body is a new reference, and the caller is responsible for managing its lifecycle.
+ *         Once the body is no longer needed, the caller must release it by calling \ref cardano_sub_transaction_body_unref.
+ *         If the input sub transaction pointer is NULL, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = ...; // Assume sub transaction is already initialized
+ * cardano_sub_transaction_body_t* body = cardano_sub_transaction_get_body(sub_transaction);
+ *
+ * if (body != NULL)
+ * {
+ *   // Use the sub transaction body
+ *
+ *   // Clean up the body reference when done
+ *   cardano_sub_transaction_body_unref(&body);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve sub transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_sub_transaction_body_t* cardano_sub_transaction_get_body(cardano_sub_transaction_t* sub_transaction);
+
+/**
+ * \brief Sets the sub transaction body for a sub transaction.
+ *
+ * This function allows replacing or setting the body for a given \ref cardano_sub_transaction_t object.
+ * The sub transaction body encapsulates inputs, outputs, and other transaction-level data.
+ *
+ * \param[in,out] sub_transaction A pointer to an initialized \ref cardano_sub_transaction_t object in which the body will be set.
+ * \param[in] body A pointer to an initialized \ref cardano_sub_transaction_body_t object representing the new sub transaction body.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the body was successfully set,
+ *         or an appropriate error code such as \ref CARDANO_ERROR_POINTER_IS_NULL if the sub transaction or body pointers are NULL.
+ *
+ * \note The reference count of the sub transaction body will be incremented by this function, so the caller retains ownership of
+ *       the body object and is responsible for releasing it when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = ...; // Assume sub transaction is already initialized
+ * cardano_sub_transaction_body_t* new_body = ...; // Assume new_body is already initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_set_body(sub_transaction, new_body);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Sub transaction body set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set sub transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_transaction_set_body(cardano_sub_transaction_t* sub_transaction, cardano_sub_transaction_body_t* body);
+
+/**
+ * \brief Retrieves the witness set associated with a sub transaction.
+ *
+ * This function returns the witness set from the given \ref cardano_sub_transaction_t object.
+ * The witness set contains cryptographic signatures, public keys, and other necessary
+ * information required to verify the sub transaction.
+ *
+ * \param[in] sub_transaction A pointer to an initialized \ref cardano_sub_transaction_t object.
+ *
+ * \return A pointer to a \ref cardano_witness_set_t object representing the witness set.
+ *         This function returns a new reference to the witness set, and the caller is
+ *         responsible for managing its lifecycle by calling \ref cardano_witness_set_unref
+ *         when it is no longer needed.
+ *
+ * \note The returned witness set is a "strong reference" and must be unref'd by the caller
+ *       once it's no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = ...; // Assume initialized
+ * cardano_witness_set_t* witness_set = cardano_sub_transaction_get_witness_set(sub_transaction);
+ *
+ * if (witness_set != NULL)
+ * {
+ *   // Use the witness set
+ *
+ *   // Cleanup the witness set once done
+ *   cardano_witness_set_unref(&witness_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_witness_set_t* cardano_sub_transaction_get_witness_set(cardano_sub_transaction_t* sub_transaction);
+
+/**
+ * \brief Sets the witness set for a sub transaction.
+ *
+ * This function assigns a witness set to the specified \ref cardano_sub_transaction_t object.
+ * A witness set contains the cryptographic signatures and other witness data needed to
+ * validate the sub transaction on the Cardano blockchain.
+ *
+ * \param[in,out] sub_transaction A pointer to an initialized \ref cardano_sub_transaction_t object
+ *                                to which the witness set will be added. This parameter must
+ *                                not be NULL.
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object
+ *                        representing the witness data. This parameter must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns
+ *         \ref CARDANO_SUCCESS if the witness set was successfully added to the sub transaction,
+ *         or an appropriate error code if any of the input pointers (sub_transaction or
+ *         witness_set) is NULL, such as \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \note This function increases the reference count of the \p witness_set object, meaning
+ *       the caller retains ownership of the witness set and must release it by calling
+ *       \ref cardano_witness_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = ...; // Assume sub transaction is already initialized
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_set_witness_set(sub_transaction, witness_set);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Witness set successfully added to the sub transaction.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set witness set: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up when no longer needed
+ * cardano_witness_set_unref(&witness_set);
+ * cardano_sub_transaction_unref(&sub_transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_transaction_set_witness_set(cardano_sub_transaction_t* sub_transaction, cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Retrieves the auxiliary data from a sub transaction.
+ *
+ * This function fetches the auxiliary data associated with a given \ref cardano_sub_transaction_t object.
+ *
+ * \param[in] sub_transaction A pointer to an initialized \ref cardano_sub_transaction_t object.
+ *                            This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_auxiliary_data_t object representing the auxiliary data in the sub transaction.
+ *         If the sub transaction does not contain auxiliary data, the function will return NULL.
+ *         The returned object is a new reference, and the caller is responsible for managing its lifecycle.
+ *         Specifically, the caller must release the object by calling \ref cardano_auxiliary_data_unref
+ *         when it is no longer needed.
+ *
+ * \note Auxiliary data is optional in a sub transaction and may not always be present.
+ *       Therefore, it is important to check the return value for NULL before dereferencing it.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = ...; // Assume sub transaction is already initialized
+ * cardano_auxiliary_data_t* aux_data = cardano_sub_transaction_get_auxiliary_data(sub_transaction);
+ *
+ * if (aux_data != NULL)
+ * {
+ *   // Process the auxiliary data
+ *   cardano_auxiliary_data_unref(&aux_data); // Clean up when done
+ * }
+ * else
+ * {
+ *   printf("No auxiliary data found in the sub transaction.\n");
+ * }
+ *
+ * // Clean up the sub transaction when no longer needed
+ * cardano_sub_transaction_unref(&sub_transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_auxiliary_data_t* cardano_sub_transaction_get_auxiliary_data(cardano_sub_transaction_t* sub_transaction);
+
+/**
+ * \brief Sets the auxiliary data for a sub transaction.
+ *
+ * This function assigns auxiliary data to the specified \ref cardano_sub_transaction_t object.
+ * Auxiliary data typically contains additional metadata associated with the sub transaction.
+ *
+ * \param[in,out] sub_transaction A pointer to an initialized \ref cardano_sub_transaction_t object
+ *                                where the auxiliary data will be set. This parameter must not be NULL.
+ * \param[in] auxiliary_data A pointer to an initialized \ref cardano_auxiliary_data_t object
+ *                           representing the auxiliary data to be included in the sub transaction.
+ *                           This parameter can be NULL to unset the auxiliary data in the sub transaction.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the auxiliary data was successfully set. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         the \p sub_transaction is NULL.
+ *
+ * \note This function increases the reference count of the \p auxiliary_data object. The caller retains
+ *       ownership of the auxiliary data and must release it by calling \ref cardano_auxiliary_data_unref
+ *       when it is no longer needed.
+ *
+ * \remark A sub transaction without auxiliary data is serialized with a CBOR null in place of the
+ *         auxiliary data element.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = ...; // Assume sub transaction is initialized
+ * cardano_auxiliary_data_t* aux_data = ...; // Assume auxiliary_data is initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_set_auxiliary_data(sub_transaction, aux_data);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Auxiliary data successfully set for the sub transaction.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set auxiliary data: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources
+ * cardano_auxiliary_data_unref(&aux_data);
+ * cardano_sub_transaction_unref(&sub_transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_transaction_set_auxiliary_data(cardano_sub_transaction_t* sub_transaction, cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Retrieves the sub transaction ID (hash) from a sub transaction.
+ *
+ * This function computes and returns the unique identifier (ID) for the specified \ref cardano_sub_transaction_t object.
+ * The sub transaction ID is the blake2b-256 hash of the sub transaction body, following the same convention as the
+ * top-level transaction ID.
+ *
+ * \param[in] sub_transaction A pointer to an initialized \ref cardano_sub_transaction_t object.
+ *                            This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_blake2b_hash_t object representing the sub transaction ID (hash).
+ *         The returned object is a new reference, and the caller is responsible for managing its lifecycle.
+ *         Specifically, the caller must release the object by calling \ref cardano_blake2b_hash_unref
+ *         when it is no longer needed. If the \p sub_transaction is NULL, the function returns NULL.
+ *
+ * \note The sub transaction ID is the primary reference used to identify and track a sub transaction within
+ *       its enclosing top-level transaction.
+ *
+ * \note The hash is computed on the first call and cached inside the sub transaction; subsequent calls return
+ *       a new reference to the cached hash. The cache is invalidated by \ref cardano_sub_transaction_set_body
+ *       and \ref cardano_sub_transaction_clear_cbor_cache.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = ...; // Assume sub transaction is already initialized
+ * cardano_blake2b_hash_t* sub_tx_id = cardano_sub_transaction_get_id(sub_transaction);
+ *
+ * if (sub_tx_id != NULL)
+ * {
+ *   // Use the sub transaction ID for reference or verification
+ *
+ *   // Clean up when done
+ *   cardano_blake2b_hash_unref(&sub_tx_id);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the sub transaction ID.\n");
+ * }
+ *
+ * // Clean up resources
+ * cardano_sub_transaction_unref(&sub_transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_sub_transaction_get_id(cardano_sub_transaction_t* sub_transaction);
+
+/**
+ * \brief Clears the cached CBOR representation from a sub transaction.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_sub_transaction_t object.
+ * It is useful when you have modified the sub transaction after it was created from CBOR using
+ * \ref cardano_sub_transaction_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the sub transaction, rather than using the original cached CBOR.
+ *
+ * \param[in,out] sub_transaction A pointer to an initialized \ref cardano_sub_transaction_t object
+ *                                from which the CBOR cache will be cleared.
+ *
+ * \note After calling this function, subsequent calls to \ref cardano_sub_transaction_to_cbor will
+ *       serialize the sub transaction using the standard encoding as defined in
+ *       [CIP-21](https://cips.cardano.org/cip/CIP-21), rather than reusing the original cached CBOR.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the sub transaction when
+ *          serialized, which can alter the sub transaction id and invalidate any existing signatures.
+ *          Use this function with caution, especially if the sub transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume sub_transaction was created using cardano_sub_transaction_from_cbor
+ * cardano_sub_transaction_t* sub_transaction = ...;
+ *
+ * // Modify the sub transaction as needed
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated sub transaction
+ * cardano_sub_transaction_clear_cbor_cache(sub_transaction);
+ *
+ * // Serialize the sub transaction to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * cardano_error_t result = cardano_sub_transaction_to_cbor(sub_transaction, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_sub_transaction_unref(&sub_transaction);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_transaction_clear_cbor_cache(cardano_sub_transaction_t* sub_transaction);
+
+/**
+ * \brief Applies verification key (vkey) witnesses to a sub transaction.
+ *
+ * This function attaches a set of vkey witnesses to the witness set of the given sub transaction. The party that
+ * authors a sub transaction signs its id (see \ref cardano_sub_transaction_get_id), which is the hash of the body
+ * alone. Applying witnesses never touches the body, so the id and the body bytes that were signed are preserved.
+ *
+ * \param[in,out] sub_transaction A pointer to the \ref cardano_sub_transaction_t structure representing the sub
+ *                                transaction to which the vkey witnesses will be applied.
+ * \param[in] new_vkeys A pointer to the \ref cardano_vkey_witness_set_t structure containing the set of vkey witnesses to
+ *                  be applied.
+ *
+ * \return \ref CARDANO_SUCCESS if the vkey witnesses were successfully applied to the sub transaction, or an appropriate
+ *         error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = ...; // Initialized sub transaction
+ * cardano_vkey_witness_set_t* vkey_witnesses = ...; // Initialized set of vkey witnesses
+ *
+ * cardano_error_t result = cardano_sub_transaction_apply_vkey_witnesses(sub_transaction, vkey_witnesses);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The vkey witnesses were successfully applied to the sub transaction
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_transaction_apply_vkey_witnesses(
+  cardano_sub_transaction_t*  sub_transaction,
+  cardano_vkey_witness_set_t* new_vkeys);
+
+/**
+ * \brief Decrements the reference count of a cardano_sub_transaction_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_sub_transaction_t object
+ * by decreasing its reference count. When the reference count reaches zero, the sub transaction is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] sub_transaction A pointer to the pointer of the sub transaction object. This double
+ *                                indirection allows the function to set the caller's pointer to
+ *                                NULL, avoiding dangling pointer issues after the object has been
+ *                                freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = ...; // Assume sub transaction is already initialized
+ *
+ * // Perform operations with the sub transaction...
+ *
+ * cardano_sub_transaction_unref(&sub_transaction);
+ * // At this point, sub_transaction is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_sub_transaction_unref, the pointer to the \ref cardano_sub_transaction_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_sub_transaction_unref(cardano_sub_transaction_t** sub_transaction);
+
+/**
+ * \brief Increases the reference count of the cardano_sub_transaction_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_sub_transaction_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_sub_transaction_unref.
+ *
+ * \param sub_transaction A pointer to the cardano_sub_transaction_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming sub_transaction is a previously created sub transaction object
+ *
+ * cardano_sub_transaction_ref(sub_transaction);
+ *
+ * // Now sub_transaction can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_sub_transaction_ref there is a corresponding
+ * call to \ref cardano_sub_transaction_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_sub_transaction_ref(cardano_sub_transaction_t* sub_transaction);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_sub_transaction_t object.
+ *
+ * This function returns the number of active references to an cardano_sub_transaction_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_sub_transaction_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param sub_transaction A pointer to the cardano_sub_transaction_t object whose reference count is queried.
+ *                        The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_sub_transaction_t object. If the object
+ * is properly managed (i.e., every \ref cardano_sub_transaction_ref call is matched with a
+ * \ref cardano_sub_transaction_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming sub_transaction is a previously created sub transaction object
+ *
+ * size_t ref_count = cardano_sub_transaction_refcount(sub_transaction);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_sub_transaction_refcount(const cardano_sub_transaction_t* sub_transaction);
+
+/**
+ * \brief Sets the last error message for a given cardano_sub_transaction_t object.
+ *
+ * Records an error message in the sub transaction's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] sub_transaction A pointer to the \ref cardano_sub_transaction_t instance whose last error message is
+ *                            to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the sub transaction's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_sub_transaction_set_last_error(
+  cardano_sub_transaction_t* sub_transaction,
+  const char*                message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific sub transaction.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_sub_transaction_set_last_error for the given
+ * sub transaction. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] sub_transaction A pointer to the \ref cardano_sub_transaction_t instance whose last error
+ *                            message is to be retrieved. If the sub transaction is NULL, the function
+ *                            returns a generic error message indicating the null sub transaction.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified sub transaction. If the sub transaction is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_sub_transaction_set_last_error for the same sub transaction, or until
+ *       the sub transaction is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_sub_transaction_get_last_error(
+  const cardano_sub_transaction_t* sub_transaction);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_sub_transaction_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_sub_transaction_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_deep_clone(const cardano_sub_transaction_t* source, cardano_sub_transaction_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_H
diff --git a/vendor/include/cardano/transaction/transaction.h b/vendor/include/cardano/transaction/transaction.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction/transaction.h
@@ -0,0 +1,1123 @@
+/**
+ * \file transaction.h
+ *
+ * \author angel.castillo
+ * \date   Sep 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/address/reward_address.h>
+#include <cardano/auxiliary_data/auxiliary_data.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/certs/certificate.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/pool_params/pool_params.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/typedefs.h>
+#include <cardano/voting_procedures/voter.h>
+#include <cardano/witness_set/witness_set.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A transaction is a record of value transfer between two or more addresses on the network. It represents a request
+ * to modify the state of the blockchain, by transferring a certain amount of ADA or a native asset from one address
+ * to another. Each transaction includes inputs and outputs, where the inputs represent the addresses that are sending
+ * ADA or the native asset, and the outputs represent the addresses that are receiving ADA or the native asset.
+ *
+ * To ensure the security and integrity of the Cardano blockchain, each transaction is cryptographically signed using
+ * the private key of the sender's address, which proves that the sender has authorized the transaction.
+ *
+ * Additionally, each transaction on the Cardano blockchain can also carry metadata, which can be used to include
+ * additional information about the transaction, such as a description or a reference to a specific product or service.
+ */
+typedef struct cardano_transaction_t cardano_transaction_t;
+
+/**
+ * \brief Represents a list of UTxO.
+ */
+typedef struct cardano_utxo_list_t cardano_utxo_list_t;
+
+/**
+ * \brief Creates and initializes a new Cardano transaction.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_transaction_t object,
+ * which represents a Cardano transaction consisting of a transaction body, witness set, and optional auxiliary data.
+ *
+ * \param[in] body A pointer to an initialized \ref cardano_transaction_body_t object that represents the transaction body.
+ *                 This parameter is required and must not be NULL.
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object that contains the witness data for the transaction.
+ *                        This parameter is required and must not be NULL.
+ * \param[in] auxiliary_data An optional pointer to a \ref cardano_auxiliary_data_t object representing any auxiliary data associated
+ *                           with the transaction. This parameter can be NULL if no auxiliary data is provided.
+ * \param[out] transaction On successful creation, this will point to a newly created \ref cardano_transaction_t object. The caller is
+ *                          responsible for managing the lifecycle of this object. Specifically, once the transaction is no longer needed,
+ *                          the caller must release it by calling \ref cardano_transaction_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the transaction was successfully created,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (body or witness_set) are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* body = ...; // Assume body is initialized
+ * cardano_witness_set_t* witness_set = ...; // Assume witness set is initialized
+ * cardano_auxiliary_data_t* auxiliary_data = ...; // Optional: can be NULL if no auxiliary data is present
+ * cardano_transaction_t* transaction = NULL;
+ *
+ * cardano_error_t result = cardano_transaction_new(body, witness_set, auxiliary_data, &transaction);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction
+ *
+ *   // Once done, ensure to clean up and release the transaction
+ *   cardano_transaction_unref(&transaction);
+ * }
+ * else
+ * {
+ *   printf("Failed to create transaction: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_new(
+  cardano_transaction_body_t* body,
+  cardano_witness_set_t*      witness_set,
+  cardano_auxiliary_data_t*   auxiliary_data,
+  cardano_transaction_t**     transaction);
+
+/**
+ * \brief Creates a \ref cardano_transaction_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_transaction_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a transaction.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] transaction A pointer to a pointer of \ref cardano_transaction_t that will be set to the address
+ *                        of the newly created transaction object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the transaction were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, transactions are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical transaction representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the transaction hash and invalidate any existing signatures.
+ *         To prevent this, when a transaction object is created using \ref cardano_transaction_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_transaction_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_transaction_clear_cbor_cache after the object has been created.
+ *
+ * \remark This function accepts three transaction frames:
+ *         - the 3-element tuple [body, witness_set, auxiliary_data / nil], which implies is_valid = true;
+ *         - the mempool/legacy 4-element frame [body, witness_set, is_valid, auxiliary_data / nil];
+ *         - the Dijkstra block 4-element frame [body, witness_set, auxiliary_data / nil, is_valid], in which the
+ *           block producer records whether the scripts of the transaction passed validation, so is_valid may be false.
+ *           This is the form in which Dijkstra transactions are stored on chain.
+ *
+ *         The two 4-element frames are told apart by the third element: auxiliary data is never a boolean, so a
+ *         boolean third element is the is_valid flag of the mempool/legacy frame, and any other third element is the
+ *         auxiliary data of the block frame, followed by the is_valid flag. Indefinite-length frames are accepted.
+ *
+ *         The decoded frame form is preserved, so \ref cardano_transaction_to_cbor re-encodes the transaction in the
+ *         same frame it was decoded from (always as a definite-length array). The 3-element form is only kept while
+ *         is_valid is true; if is_valid is set to false, \ref cardano_transaction_to_cbor promotes the transaction to
+ *         the mempool/legacy 4-element frame so the flag is not lost.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_transaction_t object by calling
+ *       \ref cardano_transaction_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_transaction_t* transaction = NULL;
+ *
+ * cardano_error_t result = cardano_transaction_from_cbor(reader, &transaction);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction
+ *
+ *   // Once done, ensure to clean up and release the transaction
+ *   cardano_transaction_unref(&transaction);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode transaction: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_t** transaction);
+
+/**
+ * \brief Serializes transaction into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_transaction_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] transaction A constant pointer to the \ref cardano_transaction_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p transaction or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, transactions are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical transaction representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the transaction hash and invalidate any existing signatures.
+ *         To prevent this, when a transaction object is created using \ref cardano_transaction_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_transaction_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_transaction_clear_cbor_cache after the object has been created.
+ *
+ * \remark Transactions created with \ref cardano_transaction_new are serialized as the mempool/legacy
+ *         4-element frame [body, witness_set, is_valid, auxiliary_data / nil]. Transactions decoded with
+ *         \ref cardano_transaction_from_cbor keep the frame form they were decoded from: a 3-element tuple
+ *         [body, witness_set, auxiliary_data / nil] re-encodes as a 3-element tuple, and a Dijkstra block frame
+ *         [body, witness_set, auxiliary_data / nil, is_valid] re-encodes with the is_valid flag after the auxiliary data.
+ *         The 3-element form is only kept while is_valid is true; a 3-element transaction whose is_valid flag is false
+ *         is serialized as the mempool/legacy 4-element frame so the flag is preserved.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_transaction_to_cbor(transaction, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_transaction_unref(&transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_to_cbor(
+  const cardano_transaction_t* transaction,
+  cardano_cbor_writer_t*       writer);
+
+/**
+ * \brief Serializes a transaction to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "body", "is_valid", "witness_set", "auxiliary_data" (if present).
+ *
+ * \param[in]  tx      Pointer to a valid \ref cardano_transaction_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS               On success.
+ * \return CARDANO_ERROR_POINTER_IS_NULL If \p tx or \p writer is NULL.
+ * \return Other                         Any error propagated from nested serialization calls.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_to_cip116_json(
+  const cardano_transaction_t* tx,
+  cardano_json_writer_t*       writer);
+
+/**
+ * \brief Retrieves the transaction body from a transaction object.
+ *
+ * This function extracts the transaction body (\ref cardano_transaction_body_t) from a given
+ * \ref cardano_transaction_t object. The transaction body contains the essential elements of the
+ * transaction, such as inputs, outputs, fees, and more.
+ *
+ * \param[in] transaction A pointer to an initialized \ref cardano_transaction_t object.
+ *
+ * \return A pointer to the \ref cardano_transaction_body_t object representing the body of the transaction.
+ *         The returned body is a new reference, and the caller is responsible for managing its lifecycle.
+ *         Once the body is no longer needed, the caller must release it by calling \ref cardano_transaction_body_unref.
+ *         If the input transaction pointer is NULL, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...; // Assume transaction is already initialized
+ * cardano_transaction_body_t* body = cardano_transaction_get_body(transaction);
+ *
+ * if (body != NULL)
+ * {
+ *   // Use the transaction body
+ *
+ *   // Clean up the body reference when done
+ *   cardano_transaction_body_unref(&body);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_body_t* cardano_transaction_get_body(cardano_transaction_t* transaction);
+
+/**
+ * \brief Sets the transaction body for a transaction.
+ *
+ * This function allows replacing or setting the transaction body for a given \ref cardano_transaction_t object.
+ * The transaction body encapsulates inputs, outputs, fees, and other transaction-level data.
+ *
+ * \param[in,out] transaction A pointer to an initialized \ref cardano_transaction_t object in which the body will be set.
+ * \param[in] body A pointer to an initialized \ref cardano_transaction_body_t object representing the new transaction body.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the body was successfully set,
+ *         or an appropriate error code such as \ref CARDANO_ERROR_POINTER_IS_NULL if the transaction or body pointers are NULL.
+ *
+ * \note The reference count of the transaction body will be incremented by this function, so the caller retains ownership of
+ *       the body object and is responsible for releasing it when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...; // Assume transaction is already initialized
+ * cardano_transaction_body_t* new_body = ...; // Assume new_body is already initialized
+ *
+ * cardano_error_t result = cardano_transaction_set_body(transaction, new_body);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Transaction body set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_set_body(cardano_transaction_t* transaction, cardano_transaction_body_t* body);
+
+/**
+ * \brief Retrieves the witness set associated with a transaction.
+ *
+ * This function returns the witness set from the given \ref cardano_transaction_t object.
+ * The witness set contains cryptographic signatures, public keys, and other necessary
+ * information required to verify the transaction.
+ *
+ * \param[in] transaction A pointer to an initialized \ref cardano_transaction_t object.
+ *
+ * \return A pointer to a \ref cardano_witness_set_t object representing the witness set.
+ *         This function returns a new reference to the witness set, and the caller is
+ *         responsible for managing its lifecycle by calling \ref cardano_witness_set_unref
+ *         when it is no longer needed.
+ *
+ * \note The returned witness set is a "strong reference" and must be unref'd by the caller
+ *       once it's no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...; // Assume initialized
+ * cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(transaction);
+ *
+ * if (witness_set != NULL)
+ * {
+ *   // Use the witness set
+ *
+ *   // Cleanup the witness set once done
+ *   cardano_witness_set_unref(&witness_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_witness_set_t* cardano_transaction_get_witness_set(cardano_transaction_t* transaction);
+
+/**
+ * \brief Sets the witness set for a transaction.
+ *
+ * This function assigns a witness set to the specified \ref cardano_transaction_t object.
+ * A witness set contains the cryptographic signatures and other witness data needed to
+ * validate the transaction on the Cardano blockchain.
+ *
+ * \param[in,out] transaction A pointer to an initialized \ref cardano_transaction_t object
+ *                            to which the witness set will be added. This parameter must
+ *                            not be NULL.
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object
+ *                        representing the witness data. This parameter must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns
+ *         \ref CARDANO_SUCCESS if the witness set was successfully added to the transaction,
+ *         or an appropriate error code if any of the input pointers (transaction or
+ *         witness_set) is NULL, such as \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \note This function increases the reference count of the \p witness_set object, meaning
+ *       the caller retains ownership of the witness set and must release it by calling
+ *       \ref cardano_witness_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...; // Assume transaction is already initialized
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ *
+ * cardano_error_t result = cardano_transaction_set_witness_set(transaction, witness_set);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Witness set successfully added to the transaction.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set witness set: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up when no longer needed
+ * cardano_witness_set_unref(&witness_set);
+ * cardano_transaction_unref(&transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_set_witness_set(cardano_transaction_t* transaction, cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Retrieves the auxiliary data from a transaction.
+ *
+ * This function fetches the auxiliary data associated with a given \ref cardano_transaction_t object.
+ *
+ * \param[in] transaction A pointer to an initialized \ref cardano_transaction_t object.
+ *                        This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_auxiliary_data_t object representing the auxiliary data in the transaction.
+ *         If the transaction does not contain auxiliary data, the function will return NULL.
+ *         The returned object is a new reference, and the caller is responsible for managing its lifecycle.
+ *         Specifically, the caller must release the object by calling \ref cardano_auxiliary_data_unref
+ *         when it is no longer needed.
+ *
+ * \note Auxiliary data is optional in a transaction and may not always be present.
+ *       Therefore, it is important to check the return value for NULL before dereferencing it.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...; // Assume transaction is already initialized
+ * cardano_auxiliary_data_t* aux_data = cardano_transaction_get_auxiliary_data(transaction);
+ *
+ * if (aux_data != NULL)
+ * {
+ *   // Process the auxiliary data
+ *   cardano_auxiliary_data_unref(&aux_data); // Clean up when done
+ * }
+ * else
+ * {
+ *   printf("No auxiliary data found in the transaction.\n");
+ * }
+ *
+ * // Clean up the transaction when no longer needed
+ * cardano_transaction_unref(&transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_auxiliary_data_t* cardano_transaction_get_auxiliary_data(cardano_transaction_t* transaction);
+
+/**
+ * \brief Sets the auxiliary data for a transaction.
+ *
+ * This function assigns auxiliary data to the specified \ref cardano_transaction_t object.
+ * Auxiliary data typically contains additional metadata or governance-related information,
+ * such as voting procedures or proposals.
+ *
+ * \param[in,out] transaction A pointer to an initialized \ref cardano_transaction_t object
+ *                            where the auxiliary data will be set. This parameter must not be NULL.
+ * \param[in] auxiliary_data A pointer to an initialized \ref cardano_auxiliary_data_t object
+ *                           representing the auxiliary data to be included in the transaction.
+ *                           This parameter can be NULL to unset the auxiliary data in the transaction.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the auxiliary data was successfully set. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if either
+ *         the \p transaction or \p auxiliary_data is NULL.
+ *
+ * \note This function increases the reference count of the \p auxiliary_data object. The caller retains
+ *       ownership of the auxiliary data and must release it by calling \ref cardano_auxiliary_data_unref
+ *       when it is no longer needed.
+ *
+ * \remark Auxiliary data is optional in Cardano transactions, but it can carry critical metadata
+ *         for on-chain governance, like voting and proposals.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...; // Assume transaction is initialized
+ * cardano_auxiliary_data_t* aux_data = ...; // Assume auxiliary_data is initialized
+ *
+ * cardano_error_t result = cardano_transaction_set_auxiliary_data(transaction, aux_data);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Auxiliary data successfully set for the transaction.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set auxiliary data: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources
+ * cardano_auxiliary_data_unref(&aux_data);
+ * cardano_transaction_unref(&transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_set_auxiliary_data(cardano_transaction_t* transaction, cardano_auxiliary_data_t* auxiliary_data);
+
+/**
+ * \brief Gets whether the transaction is expected to fail Plutus script validation.
+ *
+ * This function retrieves the validity flag of a \ref cardano_transaction_t object, indicating
+ * whether the transaction is expected to pass or fail Plutus script validation. A transaction
+ * with this flag set to \c false is expected to fail validation, but it can still be submitted
+ * to the blockchain.
+ *
+ * \param[in] transaction A pointer to an initialized \ref cardano_transaction_t object.
+ *                        This parameter must not be NULL.
+ *
+ * \return \c false if the transaction is expected to fail Plutus script validation; otherwise, \c true.
+ *
+ * \note Even if a transaction is expected to fail validation (i.e., the flag is \c false),
+ *       it can still be submitted to the blockchain. From protocol version 12 the ledger rejects
+ *       transactions with this flag set to \c false.
+ *
+ * \note Transactions decoded from the Dijkstra on-chain 3-element tuple carry no is_valid flag;
+ *       for those transactions this function returns \c true.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...; // Assume transaction is already initialized
+ * bool is_valid = cardano_transaction_get_is_valid(transaction);
+ *
+ * if (is_valid)
+ * {
+ *   printf("Transaction is expected to pass Plutus script validation.\n");
+ * }
+ * else
+ * {
+ *   printf("Transaction is expected to fail Plutus script validation.\n");
+ * }
+ *
+ * // Clean up resources
+ * cardano_transaction_unref(&transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_transaction_get_is_valid(cardano_transaction_t* transaction);
+
+/**
+ * \brief Sets whether the transaction is expected to pass or fail Plutus script validation.
+ *
+ * This function assigns a validity flag to the specified \ref cardano_transaction_t object,
+ * indicating whether the transaction is expected to pass or fail Plutus script validation.
+ * Even if this flag is set to \c false (indicating expected failure), the transaction can
+ * still be submitted to the blockchain.
+ *
+ * \param[in,out] transaction A pointer to an initialized \ref cardano_transaction_t object
+ *                            for which the validity flag will be set. This parameter must not be NULL.
+ * \param[in] is_valid A boolean flag indicating the transaction's expected validation status.
+ *                     If set to \c true, the transaction is expected to pass validation;
+ *                     if set to \c false, it is expected to fail validation.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the validity flag was successfully set, or \ref CARDANO_ERROR_POINTER_IS_NULL if the \p transaction
+ *         pointer is NULL.
+ *
+ * \note A transaction with the validity flag set to \c false (indicating expected failure) can still be
+ *       submitted to the blockchain.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...; // Assume transaction is initialized
+ * bool expected_to_pass = false; // Set the transaction to expected failure
+ *
+ * cardano_error_t result = cardano_transaction_set_is_valid(transaction, expected_to_pass);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Transaction validity flag successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set transaction validity: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources
+ * cardano_transaction_unref(&transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_set_is_valid(cardano_transaction_t* transaction, bool is_valid);
+
+/**
+ * \brief Retrieves the transaction ID (hash) from a transaction.
+ *
+ * This function computes and returns the unique identifier (ID) for the specified \ref cardano_transaction_t object.
+ * The transaction ID is the Blake2b hash of the transaction body and is used to reference the transaction
+ * within the Cardano blockchain.
+ *
+ * \param[in] transaction A pointer to an initialized \ref cardano_transaction_t object.
+ *                        This parameter must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_blake2b_hash_t object representing the transaction ID (hash).
+ *         The returned object is a new reference, and the caller is responsible for managing its lifecycle.
+ *         Specifically, the caller must release the object by calling \ref cardano_blake2b_hash_unref
+ *         when it is no longer needed. If the \p transaction is NULL, the function returns NULL.
+ *
+ * \note The transaction ID is the primary reference used in Cardano to identify and track transactions on the blockchain.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...; // Assume transaction is already initialized
+ * cardano_blake2b_hash_t* tx_id = cardano_transaction_get_id(transaction);
+ *
+ * if (tx_id != NULL)
+ * {
+ *   // Use the transaction ID for reference or verification
+ *
+ *   // Clean up when done
+ *   cardano_blake2b_hash_unref(&tx_id);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the transaction ID.\n");
+ * }
+ *
+ * // Clean up resources
+ * cardano_transaction_unref(&transaction);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_transaction_get_id(cardano_transaction_t* transaction);
+
+/**
+ * \brief Clears the cached CBOR representation from a transaction.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_transaction_t object.
+ * It is useful when you have modified the transaction after it was created from CBOR using
+ * \ref cardano_transaction_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the transaction, rather than using the original cached CBOR.
+ *
+ * \param[in,out] transaction A pointer to an initialized \ref cardano_transaction_t object
+ *                            from which the CBOR cache will be cleared.
+ *
+ * \note After calling this function, subsequent calls to \ref cardano_transaction_to_cbor will
+ *       serialize the transaction using the standard encoding as defined in
+ *       [CIP-21](https://cips.cardano.org/cip/CIP-21), rather than reusing the original cached CBOR.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the transaction when
+ *          serialized, which can alter the transaction hash and invalidate any existing signatures.
+ *          Use this function with caution, especially if the transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume transaction was created using cardano_transaction_from_cbor
+ * cardano_transaction_t* transaction = ...;
+ *
+ * // Modify the transaction as needed
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to set new fee: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated transaction
+ * cardano_transaction_clear_cbor_cache(transaction);
+ *
+ * // Serialize the transaction to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_transaction_to_cbor(transaction, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_transaction_unref(&transaction);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_transaction_clear_cbor_cache(cardano_transaction_t* transaction);
+
+/**
+ * \brief Applies verification key (vkey) witnesses to a transaction.
+ *
+ * This function attaches a set of vkey witnesses to the given transaction.
+ *
+ * \param[in,out] transaction A pointer to the \ref cardano_transaction_t structure representing the transaction to which
+ *                            the vkey witnesses will be applied.
+ * \param[in] new_vkeys A pointer to the \ref cardano_vkey_witness_set_t structure containing the set of vkey witnesses to
+ *                  be applied.
+ *
+ * \return \ref CARDANO_SUCCESS if the vkey witnesses were successfully applied to the transaction, or an appropriate
+ *         error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* tx = ...;                  // Initialized transaction
+ * cardano_vkey_witness_set_t* vkey_witnesses = ...; // Initialized set of vkey witnesses
+ *
+ * cardano_error_t result = cardano_transaction_apply_vkey_witnesses(tx, vkey_witnesses);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The vkey witnesses were successfully applied to the transaction
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_EXPORT cardano_error_t cardano_transaction_apply_vkey_witnesses(
+  cardano_transaction_t*      transaction,
+  cardano_vkey_witness_set_t* new_vkeys);
+
+/**
+ * \brief Checks if a transaction contains script data.
+ *
+ * This function examines a given \ref cardano_transaction_t object to determine whether it includes
+ * script data, such as redeemers or datums. Script data is required for transactions
+ * involving Plutus scripts on the Cardano blockchain.
+ *
+ * \param[in] transaction A pointer to an initialized \ref cardano_transaction_t object to be checked for script data.
+ *
+ * \return \c true if the transaction contains script data; otherwise, \c false.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...; // Assume transaction is already initialized
+ *
+ * bool has_script_data = cardano_transaction_has_script_data(transaction);
+ *
+ * if (has_script_data)
+ * {
+ *   printf("The transaction contains script data.\n");
+ * }
+ * else
+ * {
+ *   printf("The transaction does not contain script data.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool
+cardano_transaction_has_script_data(cardano_transaction_t* transaction);
+
+/**
+ * \brief Extracts the unique set of public key hashes (signers) required to sign a Cardano transaction.
+ *
+ * This function computes the unique set of signers for a given Cardano transaction by analyzing the transaction body
+ * and resolved inputs. This set is represented as a `cardano_blake2b_hash_set_t` containing the hashes of public keys
+ * that are required to authorize the transaction.
+ *
+ * \param[in] tx A pointer to an initialized \ref cardano_transaction_t object that represents the Cardano transaction
+ *               for which the unique signers are to be determined. This parameter is required and must not be NULL.
+ * \param[in] resolved_inputs A pointer to an initialized \ref cardano_utxo_list_t object containing the list of resolved UTXOs
+ *                            (inputs) referenced in the transaction. If this parameters is NULL, the function will ignore inputs
+ *                            and collateral inputs.
+ * \param[out] unique_signers On successful execution, this will point to a newly created \ref cardano_blake2b_hash_set_t object
+ *                            containing the unique public key hashes required to authorize the transaction. The caller is responsible
+ *                            for managing the lifecycle of this object. Specifically, the caller must release it by calling
+ *                            \ref cardano_blake2b_hash_set_unref once it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the unique signers were
+ *         successfully computed, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if required inputs (tx or resolved_inputs) are NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_get_unique_signers(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  cardano_blake2b_hash_set_t** unique_signers);
+
+/**
+ * \brief Finds the index of an input in the transaction's canonically ordered input set.
+ *
+ * Transaction inputs appear in the script context in canonical order (sorted lexicographically
+ * by transaction id and output index). This function returns the position that the given input
+ * occupies in that ordering, which is the index spend redeemers and validators use to reference it.
+ *
+ * \param[in]  transaction The transaction to inspect.
+ * \param[in]  id          The transaction id of the input's producing transaction.
+ * \param[in]  utxo_index  The output index of the input within its producing transaction.
+ * \param[out] index       The position of the input in the canonical input order.
+ *
+ * \return \ref CARDANO_SUCCESS if the input was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if the
+ *         transaction does not spend the given input, or an appropriate error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_find_input_index(
+  cardano_transaction_t*  transaction,
+  cardano_blake2b_hash_t* id,
+  uint64_t                utxo_index,
+  uint64_t*               index);
+
+/**
+ * \brief Finds the index of a reference input in the transaction's canonically ordered
+ * reference input set.
+ *
+ * \param[in]  transaction The transaction to inspect.
+ * \param[in]  id          The transaction id of the reference input's producing transaction.
+ * \param[in]  utxo_index  The output index of the reference input within its producing transaction.
+ * \param[out] index       The position of the reference input in the canonical ordering.
+ *
+ * \return \ref CARDANO_SUCCESS if the reference input was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the transaction does not reference the given input, or an appropriate error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_find_reference_input_index(
+  cardano_transaction_t*  transaction,
+  cardano_blake2b_hash_t* id,
+  uint64_t                utxo_index,
+  uint64_t*               index);
+
+/**
+ * \brief Finds the index of the first output paying at least the given amount of lovelace to the
+ * given address.
+ *
+ * Outputs are indexed in the order they appear in the transaction body, which is the order
+ * validators observe in the script context. This lookup can match balancer-generated change
+ * outputs, which are appended after the user-declared outputs.
+ *
+ * \param[in]  transaction  The transaction to inspect.
+ * \param[in]  address      The address the output must pay to.
+ * \param[in]  min_lovelace The minimum lovelace quantity the output must carry.
+ * \param[out] index        The position of the first matching output.
+ *
+ * \return \ref CARDANO_SUCCESS if a matching output was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if no output matches, or an appropriate error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_find_output_index(
+  cardano_transaction_t* transaction,
+  cardano_address_t*     address,
+  uint64_t               min_lovelace,
+  uint64_t*              index);
+
+/**
+ * \brief Finds the index of a policy in the transaction's canonically ordered mint map.
+ *
+ * \param[in]  transaction The transaction to inspect.
+ * \param[in]  policy_id   The policy id to look for.
+ * \param[out] index       The position of the policy in the canonical mint ordering.
+ *
+ * \return \ref CARDANO_SUCCESS if the policy was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if the
+ *         transaction does not mint or burn under the given policy, or an appropriate error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_find_mint_policy_index(
+  cardano_transaction_t*  transaction,
+  cardano_blake2b_hash_t* policy_id,
+  uint64_t*               index);
+
+/**
+ * \brief Finds the index of a withdrawal in the transaction's withdrawals in ledger order.
+ *
+ * The ledger orders reward accounts by network, test networks first, then script credentials
+ * before key credentials, then by credential hash. The index is the number of withdrawals that
+ * sort before the given one, which is the index reward redeemers and validators use to reference
+ * it. It can differ from the position in the withdrawal map, which puts key credentials first.
+ *
+ * \param[in]  transaction    The transaction to inspect.
+ * \param[in]  reward_address The reward address of the withdrawal.
+ * \param[out] index          The position of the withdrawal in ledger order.
+ *
+ * \return \ref CARDANO_SUCCESS if the withdrawal was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if
+ *         the transaction does not withdraw from the given reward address, or an appropriate error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_find_withdrawal_index(
+  cardano_transaction_t*    transaction,
+  cardano_reward_address_t* reward_address,
+  uint64_t*                 index);
+
+/**
+ * \brief Finds the index of a certificate in the transaction's certificate list.
+ *
+ * Certificates are indexed in the order they appear in the transaction body, which is the index
+ * certifying redeemers and validators use to reference them. Certificates are matched by their
+ * serialized representation, so any certificate object with the same contents matches.
+ *
+ * \param[in]  transaction The transaction to inspect.
+ * \param[in]  certificate The certificate to look for.
+ * \param[out] index       The position of the certificate in the certificate list.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the transaction does not carry the given certificate, or an appropriate error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_find_certificate_index(
+  cardano_transaction_t* transaction,
+  cardano_certificate_t* certificate,
+  uint64_t*              index);
+
+/**
+ * \brief Finds the index of a proposal in the transaction's proposal list.
+ *
+ * Proposals are indexed in the order they appear in the transaction body, which is the index
+ * proposing redeemers and validators use to reference them. Proposals are matched by their
+ * serialized representation, so any proposal object with the same contents matches.
+ *
+ * \param[in]  transaction The transaction to inspect.
+ * \param[in]  proposal The proposal to look for.
+ * \param[out] index       The position of the proposal in the proposal list.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the transaction does not carry the given proposal, or an appropriate error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_find_proposal_index(
+  cardano_transaction_t*        transaction,
+  cardano_proposal_procedure_t* proposal,
+  uint64_t*                     index);
+
+/**
+ * \brief Finds the index of a voter in the transaction's voting procedures in ledger order.
+ *
+ * The ledger orders voters by role, constitutional committee members first, then DReps, then
+ * stake pools, then script credentials before key credentials, then by credential hash. The index
+ * is the number of voters that sort before the given one, which is the index voting redeemers and
+ * validators use to reference its votes. It can differ from the position in the voting procedures
+ * map, which puts key credentials first.
+ *
+ * \param[in]  transaction The transaction to inspect.
+ * \param[in]  voter       The voter to look for.
+ * \param[out] index       The position of the voter in ledger order.
+ *
+ * \return \ref CARDANO_SUCCESS if the voter was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if the
+ *         transaction does not carry votes from the given voter, or an appropriate error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_find_vote_index(
+  cardano_transaction_t* transaction,
+  cardano_voter_t*       voter,
+  uint64_t*              index);
+
+/**
+ * \brief Finds the position of a redeemer in the transaction's canonically ordered redeemer list.
+ *
+ * Redeemers are ordered by tag first and purpose index second, which is the ordering validators
+ * observe in the script context. The purpose index is the redeemer's index within its tag (for
+ * example, the canonical input position for spend redeemers or the policy position for mint
+ * redeemers).
+ *
+ * \param[in]  transaction   The transaction to inspect.
+ * \param[in]  tag           The redeemer tag.
+ * \param[in]  purpose_index The redeemer's index within its tag.
+ * \param[out] index         The position of the redeemer in the canonical redeemer ordering.
+ *
+ * \return \ref CARDANO_SUCCESS if the redeemer was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if no
+ *         redeemer matches, or an appropriate error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_find_redeemer_index(
+  cardano_transaction_t* transaction,
+  cardano_redeemer_tag_t tag,
+  uint64_t               purpose_index,
+  uint64_t*              index);
+
+/**
+ * \brief Decrements the reference count of a cardano_transaction_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_transaction_t object
+ * by decreasing its reference count. When the reference count reaches zero, the transaction is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] transaction A pointer to the pointer of the transaction object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = cardano_transaction_new(major, minor);
+ *
+ * // Perform operations with the transaction...
+ *
+ * cardano_transaction_unref(&transaction);
+ * // At this point, transaction is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_transaction_unref, the pointer to the \ref cardano_transaction_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_transaction_unref(cardano_transaction_t** transaction);
+
+/**
+ * \brief Increases the reference count of the cardano_transaction_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_transaction_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_transaction_unref.
+ *
+ * \param transaction A pointer to the cardano_transaction_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction is a previously created transaction object
+ *
+ * cardano_transaction_ref(transaction);
+ *
+ * // Now transaction can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_transaction_ref there is a corresponding
+ * call to \ref cardano_transaction_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_transaction_ref(cardano_transaction_t* transaction);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_transaction_t object.
+ *
+ * This function returns the number of active references to an cardano_transaction_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_transaction_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param transaction A pointer to the cardano_transaction_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_transaction_t object. If the object
+ * is properly managed (i.e., every \ref cardano_transaction_ref call is matched with a
+ * \ref cardano_transaction_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction is a previously created transaction object
+ *
+ * size_t ref_count = cardano_transaction_refcount(transaction);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_transaction_refcount(const cardano_transaction_t* transaction);
+
+/**
+ * \brief Sets the last error message for a given cardano_transaction_t object.
+ *
+ * Records an error message in the transaction's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] transaction A pointer to the \ref cardano_transaction_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the transaction's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_transaction_set_last_error(
+  cardano_transaction_t* transaction,
+  const char*            message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific transaction.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_transaction_set_last_error for the given
+ * transaction. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] transaction A pointer to the \ref cardano_transaction_t instance whose last error
+ *                   message is to be retrieved. If the transaction is NULL, the function
+ *                   returns a generic error message indicating the null transaction.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified transaction. If the transaction is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_transaction_set_last_error for the same transaction, or until
+ *       the transaction is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_transaction_get_last_error(
+  const cardano_transaction_t* transaction);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_transaction_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_transaction_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_deep_clone(const cardano_transaction_t* source, cardano_transaction_t** clone);
+
+/**
+ * \brief Gets unique signers with the Dijkstra pool-owner witness exemption.
+ * \param[in] tx The transaction.
+ * \param[in] resolved_inputs Resolved spend and collateral inputs.
+ * \param[in] protocol_major The protocol major version; the exemption applies from 12.
+ * \param[in] pool_state Latest registered parameters for each known pool, using pending parameters
+ * when present, otherwise active parameters. Use at most one entry per pool. Unknown pools conservatively
+ * require owners. State must match the ledger state used to validate this transaction level.
+ * \param[in] pool_state_size Number of entries; pool_state may be NULL only when zero.
+ * \param[out] unique_signers The owned set of signers. Owners required by other purposes are retained.
+ * \return Success, a null argument error, or an allocation/access error.
+ * \note This affects witnesses only, not pool deposit accounting. The caller supplies trusted chain state.
+ */
+CARDANO_EXPORT cardano_error_t cardano_transaction_get_unique_signers_with_pool_state(
+  cardano_transaction_t*        tx,
+  cardano_utxo_list_t*          resolved_inputs,
+  uint64_t                      protocol_major,
+  cardano_pool_params_t* const* pool_state,
+  size_t                        pool_state_size,
+  cardano_blake2b_hash_set_t**  unique_signers);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_H
diff --git a/vendor/include/cardano/transaction_body/account_balance_interval.h b/vendor/include/cardano/transaction_body/account_balance_interval.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/account_balance_interval.h
@@ -0,0 +1,529 @@
+/**
+ * \file account_balance_interval.h
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ACCOUNT_BALANCE_INTERVAL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ACCOUNT_BALANCE_INTERVAL_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a constraint on an account balance expressed in lovelace.
+ *
+ * The interval takes one of two shapes. A range is encoded on the wire as a two element
+ * CBOR array where the first element is the inclusive lower bound and the second element
+ * is the exclusive upper bound. Either bound may be encoded as CBOR null to indicate that
+ * the range is unbounded on that side, but at least one bound must be present. An exact
+ * balance is encoded as a bare unsigned integer and requires the account balance to be
+ * exactly that amount.
+ */
+typedef struct cardano_account_balance_interval_t cardano_account_balance_interval_t;
+
+/**
+ * \brief Serializes this Dijkstra value using CIP-116 JSON conventions.
+ *
+ * Encodes a tagged exact value or range. Amounts use decimal strings; absent range bounds are null.
+ *
+ * \param[in] value Value to serialize. Must not be NULL.
+ * \param[in] writer JSON writer that receives the encoded value. Must not be NULL.
+ *
+ * \return CARDANO_SUCCESS on success, CARDANO_ERROR_POINTER_IS_NULL for a NULL argument,
+ *         or the error returned by a child serializer.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_account_balance_interval_to_cip116_json(const cardano_account_balance_interval_t* value, cardano_json_writer_t* writer);
+
+/**
+ * \brief Creates and initializes a new instance of an account balance interval.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_account_balance_interval_t,
+ * representing a half open interval of lovelace amounts. A bound is omitted by passing NULL for its
+ * argument; at least one bound must be provided.
+ *
+ * \param[in] inclusive_lower_bound A pointer to the inclusive lower bound in lovelace, or NULL if the
+ *                                  interval has no lower bound.
+ * \param[in] exclusive_upper_bound A pointer to the exclusive upper bound in lovelace, or NULL if the
+ *                                  interval has no upper bound.
+ * \param[out] account_balance_interval A pointer to a pointer to a \ref cardano_account_balance_interval_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_account_balance_interval_t
+ *                        object. This object represents a "strong reference" to the account_balance_interval,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the account_balance_interval is no longer
+ *                        needed, the caller must release it by calling \ref cardano_account_balance_interval_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the account_balance_interval was successfully created, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if both bounds are NULL, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_interval_t* account_balance_interval = NULL;
+ * const uint64_t inclusive_lower_bound = 100;
+ * const uint64_t exclusive_upper_bound = 5000;
+ *
+ * // Attempt to create a new account_balance_interval
+ * cardano_error_t result = cardano_account_balance_interval_new(&inclusive_lower_bound, &exclusive_upper_bound, &account_balance_interval);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the account_balance_interval
+ *
+ *   // Once done, ensure to clean up and release the account_balance_interval
+ *   cardano_account_balance_interval_unref(&account_balance_interval);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_account_balance_interval_new(
+  const uint64_t*                      inclusive_lower_bound,
+  const uint64_t*                      exclusive_upper_bound,
+  cardano_account_balance_interval_t** account_balance_interval);
+
+/**
+ * \brief Creates and initializes a new account balance interval in its exact form.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_account_balance_interval_t
+ * that requires the account balance to be exactly the given amount of lovelace. The exact form is a
+ * distinct shape from a range, so the resulting interval reports no lower or upper bound.
+ *
+ * \param[in] exact_balance The exact account balance in lovelace.
+ * \param[out] account_balance_interval A pointer to a pointer to a \ref cardano_account_balance_interval_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_account_balance_interval_t
+ *                        object. This object represents a "strong reference" to the account_balance_interval,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the account_balance_interval is no longer
+ *                        needed, the caller must release it by calling \ref cardano_account_balance_interval_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the account_balance_interval was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_interval_t* account_balance_interval = NULL;
+ *
+ * // Attempt to create a new account_balance_interval
+ * cardano_error_t result = cardano_account_balance_interval_new_exact(1000, &account_balance_interval);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the account_balance_interval
+ *
+ *   // Once done, ensure to clean up and release the account_balance_interval
+ *   cardano_account_balance_interval_unref(&account_balance_interval);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_account_balance_interval_new_exact(
+  uint64_t                             exact_balance,
+  cardano_account_balance_interval_t** account_balance_interval);
+
+/**
+ * \brief Creates an account balance interval from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_account_balance_interval_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for an account balance interval.
+ *
+ * A bare unsigned integer is decoded as an exact balance. Any other value must be a two element CBOR
+ * array. A bound encoded as CBOR null is decoded as an absent bound. Decoding fails with
+ * \ref CARDANO_ERROR_INVALID_ARGUMENT if both bounds are null.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded account balance interval data.
+ * \param[out] account_balance_interval A pointer to a pointer of \ref cardano_account_balance_interval_t that will be set to the address
+ *                        of the newly created account balance interval object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the account_balance_interval was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_account_balance_interval_t object by calling
+ *       \ref cardano_account_balance_interval_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_account_balance_interval_t* account_balance_interval = NULL;
+ *
+ * cardano_error_t result = cardano_account_balance_interval_from_cbor(reader, &account_balance_interval);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the account_balance_interval
+ *
+ *   // Once done, ensure to clean up and release the account_balance_interval
+ *   cardano_account_balance_interval_unref(&account_balance_interval);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode account_balance_interval: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_account_balance_interval_from_cbor(cardano_cbor_reader_t* reader, cardano_account_balance_interval_t** account_balance_interval);
+
+/**
+ * \brief Serializes an account balance interval into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_account_balance_interval_t object using a \ref cardano_cbor_writer_t.
+ * An exact balance is written as a bare unsigned integer. A range is written as a two element CBOR array;
+ * an absent bound is written as CBOR null.
+ *
+ * \param[in] account_balance_interval A constant pointer to the \ref cardano_account_balance_interval_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p account_balance_interval or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_interval_t* account_balance_interval = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_account_balance_interval_to_cbor(account_balance_interval, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_account_balance_interval_unref(&account_balance_interval);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_account_balance_interval_to_cbor(
+  const cardano_account_balance_interval_t* account_balance_interval,
+  cardano_cbor_writer_t*                    writer);
+
+/**
+ * \brief Retrieves the inclusive lower bound of the interval.
+ *
+ * This function returns a pointer to the inclusive lower bound of the given account balance
+ * interval, expressed in lovelace. The bound is optional; a NULL return value indicates that
+ * the interval has no lower bound. Exact intervals have no bounds and always return NULL.
+ *
+ * \param[in] account_balance_interval A constant pointer to the \ref cardano_account_balance_interval_t object from which
+ *                       the bound is to be retrieved.
+ *
+ * \return A pointer to the inclusive lower bound, or NULL if the interval has no lower bound or if
+ *         \p account_balance_interval is NULL. The returned pointer refers to internal storage of the
+ *         interval object and must not be modified or freed by the caller. It remains valid for the
+ *         lifetime of the interval object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_interval_t* account_balance_interval = ...;
+ *
+ * const uint64_t* inclusive_lower_bound = cardano_account_balance_interval_get_inclusive_lower_bound(account_balance_interval);
+ *
+ * if (inclusive_lower_bound != NULL)
+ * {
+ *   printf("Inclusive lower bound: %llu\n", (unsigned long long)*inclusive_lower_bound);
+ * }
+ * else
+ * {
+ *   printf("The interval has no lower bound.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_account_balance_interval_get_inclusive_lower_bound(
+  const cardano_account_balance_interval_t* account_balance_interval);
+
+/**
+ * \brief Retrieves the exclusive upper bound of the interval.
+ *
+ * This function returns a pointer to the exclusive upper bound of the given account balance
+ * interval, expressed in lovelace. The bound is optional; a NULL return value indicates that
+ * the interval has no upper bound. Exact intervals have no bounds and always return NULL.
+ *
+ * \param[in] account_balance_interval A constant pointer to the \ref cardano_account_balance_interval_t object from which
+ *                       the bound is to be retrieved.
+ *
+ * \return A pointer to the exclusive upper bound, or NULL if the interval has no upper bound or if
+ *         \p account_balance_interval is NULL. The returned pointer refers to internal storage of the
+ *         interval object and must not be modified or freed by the caller. It remains valid for the
+ *         lifetime of the interval object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_interval_t* account_balance_interval = ...;
+ *
+ * const uint64_t* exclusive_upper_bound = cardano_account_balance_interval_get_exclusive_upper_bound(account_balance_interval);
+ *
+ * if (exclusive_upper_bound != NULL)
+ * {
+ *   printf("Exclusive upper bound: %llu\n", (unsigned long long)*exclusive_upper_bound);
+ * }
+ * else
+ * {
+ *   printf("The interval has no upper bound.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_account_balance_interval_get_exclusive_upper_bound(
+  const cardano_account_balance_interval_t* account_balance_interval);
+
+/**
+ * \brief Retrieves the exact balance required by the interval.
+ *
+ * This function returns a pointer to the exact account balance required by the given interval,
+ * expressed in lovelace. A NULL return value indicates that the interval is a range rather than
+ * an exact balance.
+ *
+ * \param[in] account_balance_interval A constant pointer to the \ref cardano_account_balance_interval_t object from which
+ *                       the exact balance is to be retrieved.
+ *
+ * \return A pointer to the exact balance, or NULL if the interval is a range or if
+ *         \p account_balance_interval is NULL. The returned pointer refers to internal storage of the
+ *         interval object and must not be modified or freed by the caller. It remains valid for the
+ *         lifetime of the interval object.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_interval_t* account_balance_interval = ...;
+ *
+ * const uint64_t* exact_balance = cardano_account_balance_interval_get_exact_balance(account_balance_interval);
+ *
+ * if (exact_balance != NULL)
+ * {
+ *   printf("Exact balance: %llu\n", (unsigned long long)*exact_balance);
+ * }
+ * else
+ * {
+ *   printf("The interval is a range.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_account_balance_interval_get_exact_balance(
+  const cardano_account_balance_interval_t* account_balance_interval);
+
+/**
+ * \brief Checks whether the interval is an exact balance.
+ *
+ * This function checks whether the given \ref cardano_account_balance_interval_t object requires
+ * an exact account balance rather than a range of balances.
+ *
+ * \param[in] account_balance_interval A constant pointer to an initialized \ref cardano_account_balance_interval_t object.
+ *
+ * \return A boolean value:
+ *         - \c true if the interval is an exact balance.
+ *         - \c false if the interval is a range or if \p account_balance_interval is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_interval_t* account_balance_interval = ...;
+ *
+ * if (cardano_account_balance_interval_is_exact(account_balance_interval))
+ * {
+ *   printf("The interval requires an exact balance.\n");
+ * }
+ * else
+ * {
+ *   printf("The interval is a range.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_account_balance_interval_is_exact(const cardano_account_balance_interval_t* account_balance_interval);
+
+/**
+ * \brief Decrements the reference count of an account_balance_interval object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_account_balance_interval_t object
+ * by decreasing its reference count. When the reference count reaches zero, the account_balance_interval is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] account_balance_interval A pointer to the pointer of the account_balance_interval object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_interval_t* account_balance_interval = NULL;
+ * const uint64_t inclusive_lower_bound = 100;
+ *
+ * cardano_error_t result = cardano_account_balance_interval_new(&inclusive_lower_bound, NULL, &account_balance_interval);
+ *
+ * // Perform operations with the account_balance_interval...
+ *
+ * cardano_account_balance_interval_unref(&account_balance_interval);
+ * // At this point, account_balance_interval is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_account_balance_interval_unref, the pointer to the \ref cardano_account_balance_interval_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_account_balance_interval_unref(cardano_account_balance_interval_t** account_balance_interval);
+
+/**
+ * \brief Increases the reference count of the cardano_account_balance_interval_t object.
+ *
+ * This function is used to manually increment the reference count of an account_balance_interval
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_account_balance_interval_unref.
+ *
+ * \param account_balance_interval A pointer to the account_balance_interval object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming account_balance_interval is a previously created account_balance_interval object
+ *
+ * cardano_account_balance_interval_ref(account_balance_interval);
+ *
+ * // Now account_balance_interval can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_account_balance_interval_ref there is a corresponding
+ * call to \ref cardano_account_balance_interval_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_account_balance_interval_ref(cardano_account_balance_interval_t* account_balance_interval);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_account_balance_interval_t object.
+ *
+ * This function returns the number of active references to an account_balance_interval object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_account_balance_interval_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param account_balance_interval A pointer to the account_balance_interval object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified account_balance_interval object. If the object
+ * is properly managed (i.e., every \ref cardano_account_balance_interval_ref call is matched with a
+ * \ref cardano_account_balance_interval_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming account_balance_interval is a previously created account_balance_interval object
+ *
+ * size_t ref_count = cardano_account_balance_interval_refcount(account_balance_interval);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_account_balance_interval_refcount(const cardano_account_balance_interval_t* account_balance_interval);
+
+/**
+ * \brief Sets the last error message for a given account_balance_interval object.
+ *
+ * Records an error message in the account_balance_interval's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] account_balance_interval A pointer to the \ref cardano_account_balance_interval_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the account_balance_interval's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_account_balance_interval_set_last_error(cardano_account_balance_interval_t* account_balance_interval, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific account_balance_interval.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_account_balance_interval_set_last_error for the given
+ * account_balance_interval. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] account_balance_interval A pointer to the \ref cardano_account_balance_interval_t instance whose last error
+ *                   message is to be retrieved. If the account_balance_interval is NULL, the function
+ *                   returns a generic error message indicating the null account_balance_interval.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified account_balance_interval. If the account_balance_interval is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_account_balance_interval_set_last_error for the same account_balance_interval, or until
+ *       the account_balance_interval is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_account_balance_interval_get_last_error(const cardano_account_balance_interval_t* account_balance_interval);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_account_balance_interval_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_account_balance_interval_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_account_balance_interval_deep_clone(const cardano_account_balance_interval_t* source, cardano_account_balance_interval_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ACCOUNT_BALANCE_INTERVAL_H
diff --git a/vendor/include/cardano/transaction_body/account_balance_intervals_map.h b/vendor/include/cardano/transaction_body/account_balance_intervals_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/account_balance_intervals_map.h
@@ -0,0 +1,696 @@
+/**
+ * \file account_balance_intervals_map.h
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ACCOUNT_BALANCE_INTERVALS_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ACCOUNT_BALANCE_INTERVALS_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/reward_address_list.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/transaction_body/account_balance_interval.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of reward addresses to account balance intervals.
+ *
+ * A transaction body carries this map to state, for each reward account, the balance the
+ * account must satisfy. Each entry maps a reward address to an
+ * \ref cardano_account_balance_interval_t, which is either a half open range of lovelace
+ * amounts or an exact lovelace balance.
+ */
+typedef struct cardano_account_balance_intervals_map_t cardano_account_balance_intervals_map_t;
+
+/**
+ * \brief Serializes this Dijkstra value using CIP-116 JSON conventions.
+ *
+ * Encodes an array of key/value objects. Keys are Bech32 reward addresses; lovelace values use decimal strings.
+ *
+ * \param[in] value Value to serialize. Must not be NULL.
+ * \param[in] writer JSON writer that receives the encoded value. Must not be NULL.
+ *
+ * \return CARDANO_SUCCESS on success, CARDANO_ERROR_POINTER_IS_NULL for a NULL argument,
+ *         or the error returned by a child serializer.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_account_balance_intervals_map_to_cip116_json(const cardano_account_balance_intervals_map_t* value, cardano_json_writer_t* writer);
+
+/**
+ * \brief Creates and initializes a new instance of an account balance intervals map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_account_balance_intervals_map_t,
+ * representing a map structure. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] account_balance_intervals_map A pointer to a pointer to a \ref cardano_account_balance_intervals_map_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_account_balance_intervals_map_t
+ *                        object. This object represents a "strong reference" to the account_balance_intervals_map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the account_balance_intervals_map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_account_balance_intervals_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the account_balance_intervals_map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = NULL;
+ *
+ * // Attempt to create a new account_balance_intervals_map
+ * cardano_error_t result = cardano_account_balance_intervals_map_new(&account_balance_intervals_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the account_balance_intervals_map
+ *
+ *   // Once done, ensure to clean up and release the account_balance_intervals_map
+ *   cardano_account_balance_intervals_map_unref(&account_balance_intervals_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_account_balance_intervals_map_new(cardano_account_balance_intervals_map_t** account_balance_intervals_map);
+
+/**
+ * \brief Creates an account balance intervals map from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_account_balance_intervals_map_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for an account balance intervals map.
+ *
+ * Each key is read as a bytestring holding a serialized reward address. The map must not be empty on the wire;
+ * decoding an empty map fails with \ref CARDANO_ERROR_INVALID_CBOR_MAP_SIZE. A map that contains the same reward
+ * address more than once fails with \ref CARDANO_ERROR_DUPLICATED_KEY.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded account balance intervals map data.
+ * \param[out] account_balance_intervals_map A pointer to a pointer of \ref cardano_account_balance_intervals_map_t that will be set to the address
+ *                        of the newly created account balance intervals map object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the account_balance_intervals_map was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_account_balance_intervals_map_t object by calling
+ *       \ref cardano_account_balance_intervals_map_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = NULL;
+ *
+ * cardano_error_t result = cardano_account_balance_intervals_map_from_cbor(reader, &account_balance_intervals_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the account_balance_intervals_map
+ *
+ *   // Once done, ensure to clean up and release the account_balance_intervals_map
+ *   cardano_account_balance_intervals_map_unref(&account_balance_intervals_map);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode account_balance_intervals_map: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_account_balance_intervals_map_from_cbor(cardano_cbor_reader_t* reader, cardano_account_balance_intervals_map_t** account_balance_intervals_map);
+
+/**
+ * \brief Serializes an account balance intervals map into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_account_balance_intervals_map_t object using a \ref cardano_cbor_writer_t.
+ * Each key is written as a bytestring holding the serialized reward address. Entries are written sorted by the bytes of their reward addresses,
+ * the canonical CBOR key order.
+ *
+ * \param[in] account_balance_intervals_map A constant pointer to the \ref cardano_account_balance_intervals_map_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p account_balance_intervals_map or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_account_balance_intervals_map_to_cbor(account_balance_intervals_map, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_account_balance_intervals_map_unref(&account_balance_intervals_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_account_balance_intervals_map_to_cbor(
+  const cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  cardano_cbor_writer_t*                         writer);
+
+/**
+ * \brief Retrieves the length of the account_balance_intervals_map.
+ *
+ * This function returns the number of key-value pairs contained in the specified account_balance_intervals_map.
+ *
+ * \param[in] account_balance_intervals_map A constant pointer to the \ref cardano_account_balance_intervals_map_t object for which
+ *                       the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the account_balance_intervals_map. Returns 0 if the account_balance_intervals_map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = NULL;
+ * cardano_error_t result = cardano_account_balance_intervals_map_new(&account_balance_intervals_map);
+ *
+ * // Populate the account_balance_intervals_map with key-value pairs
+ *
+ * size_t length = cardano_account_balance_intervals_map_get_length(account_balance_intervals_map);
+ * printf("The length of the account_balance_intervals_map is: %zu\n", length);
+ *
+ * cardano_account_balance_intervals_map_unref(&account_balance_intervals_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_account_balance_intervals_map_get_length(const cardano_account_balance_intervals_map_t* account_balance_intervals_map);
+
+/**
+ * \brief Retrieves the interval associated with a given reward address in the account balance intervals map.
+ *
+ * This function retrieves the interval associated with the specified reward address in the provided account balance
+ * intervals map. It returns the interval through the output parameter `element`. If the reward address is not found
+ * in the map, the function returns \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \param[in] account_balance_intervals_map A constant pointer to the \ref cardano_account_balance_intervals_map_t object from which
+ *                       the interval is to be retrieved.
+ * \param[in] key The reward address whose associated interval is to be retrieved from the account_balance_intervals_map.
+ * \param[out] element A pointer to a variable where the retrieved interval will be stored. If the reward address
+ *                     is found, this variable will be set to the associated interval, and the caller must
+ *                     release it by calling \ref cardano_account_balance_interval_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the reward address was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if the
+ *         reward address is not present in the map, or an appropriate error code if the input parameters are invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = ...;
+ * cardano_reward_address_t* key = ...; // Create a reward address object representing the key
+ * cardano_account_balance_interval_t* interval = NULL;
+ *
+ * cardano_error_t result = cardano_account_balance_intervals_map_get(account_balance_intervals_map, key, &interval);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved interval
+ *   cardano_account_balance_interval_unref(&interval);
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_reward_address_unref(&key); // Clean up the key resource
+ * cardano_account_balance_intervals_map_unref(&account_balance_intervals_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_account_balance_intervals_map_get(
+  const cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  cardano_reward_address_t*                      key,
+  cardano_account_balance_interval_t**           element);
+
+/**
+ * \brief Inserts a key-value pair into the account balance intervals map.
+ *
+ * This function inserts the specified reward address and its interval into the provided account balance intervals map.
+ * The map keeps its entries sorted by the bytes of their reward addresses, so they are serialized in canonical
+ * CBOR key order whatever the order of insertion. Inserting a reward address that is already
+ * present in the map fails with \ref CARDANO_ERROR_DUPLICATED_KEY.
+ *
+ * \param[in] account_balance_intervals_map A constant pointer to the \ref cardano_account_balance_intervals_map_t object where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The reward address to be inserted into the account balance intervals map. The caller is responsible for managing
+ *                the lifecycle of the key object.
+ * \param[in] value The interval to be associated with the reward address. The caller is responsible for managing
+ *                  the lifecycle of the value object.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = NULL;
+ * cardano_error_t result = cardano_account_balance_intervals_map_new(&account_balance_intervals_map);
+ *
+ * // Create key and value objects
+ * cardano_reward_address_t* key = ...;
+ * cardano_account_balance_interval_t* value = ...;
+ *
+ * // Insert the key-value pair into the account_balance_intervals_map
+ * result = cardano_account_balance_intervals_map_insert(account_balance_intervals_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value objects
+ * cardano_reward_address_unref(&key);
+ * cardano_account_balance_interval_unref(&value);
+ *
+ * cardano_account_balance_intervals_map_unref(&account_balance_intervals_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_account_balance_intervals_map_insert(
+  cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  cardano_reward_address_t*                key,
+  cardano_account_balance_interval_t*      value);
+
+/**
+ * \brief Inserts an interval into the account balance intervals map using a Bech32-encoded reward address.
+ *
+ * This function inserts an interval into the specified \ref cardano_account_balance_intervals_map_t object. The interval
+ * is associated with the reward account identified by the given Bech32 string. Inserting a reward address that is
+ * already present in the map fails with \ref CARDANO_ERROR_DUPLICATED_KEY.
+ *
+ * \param[in, out] account_balance_intervals_map A pointer to the \ref cardano_account_balance_intervals_map_t object where the entry will be inserted.
+ * \param[in] reward_address A pointer to a string representing the Bech32-encoded reward address. This parameter must not be NULL.
+ * \param[in] reward_address_size The length of the reward address string in bytes.
+ * \param[in] value The interval to be associated with the reward address. The caller is responsible for managing
+ *                  the lifecycle of the value object.
+ *
+ * \return \ref CARDANO_SUCCESS if the entry was successfully inserted into the map, or an appropriate error code
+ * indicating the type of failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = ...; // Assume initialized
+ * const char* reward_address = "stake1u..."; // Bech32-encoded reward address
+ * cardano_account_balance_interval_t* value = ...;
+ *
+ * cardano_error_t result = cardano_account_balance_intervals_map_insert_ex(account_balance_intervals_map, reward_address, strlen(reward_address), value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Entry successfully added
+ * }
+ * else
+ * {
+ *   printf("Failed to insert entry: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup when done
+ * cardano_account_balance_interval_unref(&value);
+ * cardano_account_balance_intervals_map_unref(&account_balance_intervals_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_account_balance_intervals_map_insert_ex(
+  cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  const char*                              reward_address,
+  size_t                                   reward_address_size,
+  cardano_account_balance_interval_t*      value);
+
+/**
+ * \brief Retrieves the keys from the account balance intervals map.
+ *
+ * This function retrieves all the keys from the provided account balance intervals map and returns them as a list.
+ * The list follows the order of the map, sorted by reward address bytes. The caller is responsible for managing the lifecycle of the
+ * returned list by calling \ref cardano_reward_address_list_unref when it is no longer needed.
+ *
+ * \param[in] account_balance_intervals_map A pointer to the \ref cardano_account_balance_intervals_map_t object from which
+ *                       the keys are to be retrieved.
+ * \param[out] keys A pointer to a variable where the retrieved keys will be stored as a list.
+ *                  If successful, this variable will be set to point to the list of keys.
+ *                  The caller is responsible for managing the lifecycle of this list.
+ *                  It must be released by calling \ref cardano_reward_address_list_unref when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the keys were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = NULL;
+ * cardano_error_t result = cardano_account_balance_intervals_map_new(&account_balance_intervals_map);
+ *
+ * // Populate the account_balance_intervals_map with key-value pairs
+ *
+ * cardano_reward_address_list_t* keys = NULL;
+ * result = cardano_account_balance_intervals_map_get_keys(account_balance_intervals_map, &keys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of keys
+ *   // Keys must also be freed if retrieved from the list
+ *
+ *   // Once done, ensure to clean up and release the keys list
+ *   cardano_reward_address_list_unref(&keys);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_account_balance_intervals_map_unref(&account_balance_intervals_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_account_balance_intervals_map_get_keys(
+  cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  cardano_reward_address_list_t**          keys);
+
+/**
+ * \brief Retrieves the reward address at a specific index from the account balance intervals map.
+ *
+ * This function retrieves the reward address at the specified index from the account balance intervals map.
+ *
+ * \param[in] account_balance_intervals_map Pointer to the account balance intervals map object.
+ * \param[in] index The index of the reward address to retrieve.
+ * \param[out] reward_address On successful retrieval, this will point to the reward address
+ *                            at the specified index. The caller is responsible for managing the lifecycle
+ *                            of this object. Specifically, once the reward address is no longer needed,
+ *                            the caller must release it by calling \ref cardano_reward_address_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reward address was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = NULL;
+ * cardano_reward_address_t* reward_address = NULL;
+ * size_t index = 0; // Index of the reward address to retrieve
+ *
+ * // Assume account_balance_intervals_map is initialized properly
+ *
+ * cardano_error_t result = cardano_account_balance_intervals_map_get_key_at(account_balance_intervals_map, index, &reward_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the reward address
+ *
+ *   // Once done, ensure to clean up and release the reward address
+ *   cardano_reward_address_unref(&reward_address);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_account_balance_intervals_map_get_key_at(
+  const cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  size_t                                         index,
+  cardano_reward_address_t**                     reward_address);
+
+/**
+ * \brief Retrieves the interval at a specific index from the account balance intervals map.
+ *
+ * This function retrieves the interval at the specified index from the account balance intervals map.
+ *
+ * \param[in] account_balance_intervals_map Pointer to the account balance intervals map object.
+ * \param[in] index The index of the interval to retrieve.
+ * \param[out] interval On successful retrieval, this will point to the interval at the specified index.
+ *                      The caller is responsible for managing the lifecycle of this object and must
+ *                      release it by calling \ref cardano_account_balance_interval_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the interval was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = NULL;
+ * cardano_account_balance_interval_t* interval = NULL;
+ * size_t index = 0; // Index of the interval to retrieve
+ *
+ * // Assume account_balance_intervals_map is initialized properly
+ *
+ * cardano_error_t result = cardano_account_balance_intervals_map_get_value_at(account_balance_intervals_map, index, &interval);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the interval
+ *
+ *   // Once done, ensure to clean up and release the interval
+ *   cardano_account_balance_interval_unref(&interval);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_account_balance_intervals_map_get_value_at(
+  const cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  size_t                                         index,
+  cardano_account_balance_interval_t**           interval);
+
+/**
+ * \brief Retrieves the reward address and interval at the specified index.
+ *
+ * This function retrieves the reward address and its interval from the account balance intervals map
+ * at the specified index.
+ *
+ * \param[in]  account_balance_intervals_map    Pointer to the account balance intervals map object.
+ * \param[in]  index             The index at which to retrieve the key-value pair.
+ * \param[out] reward_address On successful retrieval, this will point to the reward address at the specified index.
+ *                            The caller is responsible for managing the lifecycle of this object and should release it using
+ *                            \ref cardano_reward_address_unref when it is no longer needed.
+ * \param[out] interval On successful retrieval, this will point to the interval at the specified index.
+ *                      The caller is responsible for managing the lifecycle of this object and must release
+ *                      it by calling \ref cardano_account_balance_interval_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = NULL;
+ * // Assume account_balance_intervals_map is initialized properly
+ *
+ * size_t index = 0;
+ * cardano_reward_address_t* reward_address = NULL;
+ * cardano_account_balance_interval_t* interval = NULL;
+ *
+ * cardano_error_t result = cardano_account_balance_intervals_map_get_key_value_at(account_balance_intervals_map, index, &reward_address, &interval);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the reward address and the interval
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_account_balance_intervals_map_unref(&account_balance_intervals_map);
+ * cardano_reward_address_unref(&reward_address);
+ * cardano_account_balance_interval_unref(&interval);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_account_balance_intervals_map_get_key_value_at(
+  const cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  size_t                                         index,
+  cardano_reward_address_t**                     reward_address,
+  cardano_account_balance_interval_t**           interval);
+
+/**
+ * \brief Decrements the reference count of an account_balance_intervals_map object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_account_balance_intervals_map_t object
+ * by decreasing its reference count. When the reference count reaches zero, the account_balance_intervals_map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] account_balance_intervals_map A pointer to the pointer of the account_balance_intervals_map object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_account_balance_intervals_map_t* account_balance_intervals_map = NULL;
+ * cardano_error_t result = cardano_account_balance_intervals_map_new(&account_balance_intervals_map);
+ *
+ * // Perform operations with the account_balance_intervals_map...
+ *
+ * cardano_account_balance_intervals_map_unref(&account_balance_intervals_map);
+ * // At this point, account_balance_intervals_map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_account_balance_intervals_map_unref, the pointer to the \ref cardano_account_balance_intervals_map_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_account_balance_intervals_map_unref(cardano_account_balance_intervals_map_t** account_balance_intervals_map);
+
+/**
+ * \brief Increases the reference count of the cardano_account_balance_intervals_map_t object.
+ *
+ * This function is used to manually increment the reference count of an account_balance_intervals_map
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_account_balance_intervals_map_unref.
+ *
+ * \param account_balance_intervals_map A pointer to the account_balance_intervals_map object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming account_balance_intervals_map is a previously created account_balance_intervals_map object
+ *
+ * cardano_account_balance_intervals_map_ref(account_balance_intervals_map);
+ *
+ * // Now account_balance_intervals_map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_account_balance_intervals_map_ref there is a corresponding
+ * call to \ref cardano_account_balance_intervals_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_account_balance_intervals_map_ref(cardano_account_balance_intervals_map_t* account_balance_intervals_map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_account_balance_intervals_map_t object.
+ *
+ * This function returns the number of active references to an account_balance_intervals_map object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_account_balance_intervals_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param account_balance_intervals_map A pointer to the account_balance_intervals_map object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified account_balance_intervals_map object. If the object
+ * is properly managed (i.e., every \ref cardano_account_balance_intervals_map_ref call is matched with a
+ * \ref cardano_account_balance_intervals_map_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming account_balance_intervals_map is a previously created account_balance_intervals_map object
+ *
+ * size_t ref_count = cardano_account_balance_intervals_map_refcount(account_balance_intervals_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_account_balance_intervals_map_refcount(const cardano_account_balance_intervals_map_t* account_balance_intervals_map);
+
+/**
+ * \brief Sets the last error message for a given account_balance_intervals_map object.
+ *
+ * Records an error message in the account_balance_intervals_map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] account_balance_intervals_map A pointer to the \ref cardano_account_balance_intervals_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the account_balance_intervals_map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_account_balance_intervals_map_set_last_error(cardano_account_balance_intervals_map_t* account_balance_intervals_map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific account_balance_intervals_map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_account_balance_intervals_map_set_last_error for the given
+ * account_balance_intervals_map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] account_balance_intervals_map A pointer to the \ref cardano_account_balance_intervals_map_t instance whose last error
+ *                   message is to be retrieved. If the account_balance_intervals_map is NULL, the function
+ *                   returns a generic error message indicating the null account_balance_intervals_map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified account_balance_intervals_map. If the account_balance_intervals_map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_account_balance_intervals_map_set_last_error for the same account_balance_intervals_map, or until
+ *       the account_balance_intervals_map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_account_balance_intervals_map_get_last_error(const cardano_account_balance_intervals_map_t* account_balance_intervals_map);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_account_balance_intervals_map_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_account_balance_intervals_map_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_account_balance_intervals_map_deep_clone(const cardano_account_balance_intervals_map_t* source, cardano_account_balance_intervals_map_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ACCOUNT_BALANCE_INTERVALS_MAP_H
diff --git a/vendor/include/cardano/transaction_body/direct_deposit_map.h b/vendor/include/cardano/transaction_body/direct_deposit_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/direct_deposit_map.h
@@ -0,0 +1,679 @@
+/**
+ * \file direct_deposit_map.h
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_DIRECT_DEPOSIT_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_DIRECT_DEPOSIT_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/reward_address_list.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of reward address to lovelace amount.
+ *
+ * A transaction body uses this map to credit reward accounts directly with lovelace,
+ * without creating a UTxO output. Each entry maps a reward address to the amount of
+ * lovelace deposited into that account.
+ */
+typedef struct cardano_direct_deposit_map_t cardano_direct_deposit_map_t;
+
+/**
+ * \brief Serializes this Dijkstra value using CIP-116 JSON conventions.
+ *
+ * Encodes an array of key/value objects. Keys are Bech32 reward addresses; lovelace values use decimal strings.
+ *
+ * \param[in] value Value to serialize. Must not be NULL.
+ * \param[in] writer JSON writer that receives the encoded value. Must not be NULL.
+ *
+ * \return CARDANO_SUCCESS on success, CARDANO_ERROR_POINTER_IS_NULL for a NULL argument,
+ *         or the error returned by a child serializer.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_direct_deposit_map_to_cip116_json(const cardano_direct_deposit_map_t* value, cardano_json_writer_t* writer);
+
+/**
+ * \brief Creates and initializes a new instance of a direct deposit map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_direct_deposit_map_t,
+ * representing a map structure. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] direct_deposit_map A pointer to a pointer to a \ref cardano_direct_deposit_map_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_direct_deposit_map_t
+ *                        object. This object represents a "strong reference" to the direct_deposit_map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the direct_deposit_map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_direct_deposit_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the direct_deposit_map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_direct_deposit_map_t* direct_deposit_map = NULL;
+ *
+ * // Attempt to create a new direct_deposit_map
+ * cardano_error_t result = cardano_direct_deposit_map_new(&direct_deposit_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the direct_deposit_map
+ *
+ *   // Once done, ensure to clean up and release the direct_deposit_map
+ *   cardano_direct_deposit_map_unref(&direct_deposit_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_direct_deposit_map_new(cardano_direct_deposit_map_t** direct_deposit_map);
+
+/**
+ * \brief Creates a direct deposit map from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_direct_deposit_map_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a direct deposit map.
+ *
+ * The map must not be empty on the wire; decoding an empty map fails with
+ * \ref CARDANO_ERROR_INVALID_CBOR_MAP_SIZE. A map that contains the same reward address
+ * more than once fails with \ref CARDANO_ERROR_DUPLICATED_KEY.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded direct deposit map data.
+ * \param[out] direct_deposit_map A pointer to a pointer of \ref cardano_direct_deposit_map_t that will be set to the address
+ *                        of the newly created direct deposit map object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the direct_deposit_map was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_direct_deposit_map_t object by calling
+ *       \ref cardano_direct_deposit_map_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_direct_deposit_map_t* direct_deposit_map = NULL;
+ *
+ * cardano_error_t result = cardano_direct_deposit_map_from_cbor(reader, &direct_deposit_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the direct_deposit_map
+ *
+ *   // Once done, ensure to clean up and release the direct_deposit_map
+ *   cardano_direct_deposit_map_unref(&direct_deposit_map);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode direct_deposit_map: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_direct_deposit_map_from_cbor(cardano_cbor_reader_t* reader, cardano_direct_deposit_map_t** direct_deposit_map);
+
+/**
+ * \brief Serializes a direct deposit map into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_direct_deposit_map_t object using a \ref cardano_cbor_writer_t.
+ * Entries are written sorted by the bytes of their reward addresses, the canonical CBOR key order.
+ *
+ * \param[in] direct_deposit_map A constant pointer to the \ref cardano_direct_deposit_map_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p direct_deposit_map or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_direct_deposit_map_t* direct_deposit_map = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_direct_deposit_map_to_cbor(direct_deposit_map, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_direct_deposit_map_unref(&direct_deposit_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_direct_deposit_map_to_cbor(
+  const cardano_direct_deposit_map_t* direct_deposit_map,
+  cardano_cbor_writer_t*              writer);
+
+/**
+ * \brief Retrieves the length of the direct_deposit_map.
+ *
+ * This function returns the number of key-value pairs contained in the specified direct_deposit_map.
+ *
+ * \param[in] direct_deposit_map A constant pointer to the \ref cardano_direct_deposit_map_t object for which
+ *                       the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the direct_deposit_map. Returns 0 if the direct_deposit_map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_direct_deposit_map_t* direct_deposit_map = NULL;
+ * cardano_error_t result = cardano_direct_deposit_map_new(&direct_deposit_map);
+ *
+ * // Populate the direct_deposit_map with key-value pairs
+ *
+ * size_t length = cardano_direct_deposit_map_get_length(direct_deposit_map);
+ * printf("The length of the direct_deposit_map is: %zu\n", length);
+ *
+ * cardano_direct_deposit_map_unref(&direct_deposit_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_direct_deposit_map_get_length(const cardano_direct_deposit_map_t* direct_deposit_map);
+
+/**
+ * \brief Retrieves the deposit amount associated with a given reward address in the direct deposit map.
+ *
+ * This function retrieves the lovelace amount associated with the specified reward address in the provided
+ * direct deposit map. It returns the amount through the output parameter `element`. If the reward address
+ * is not found in the map, the function returns \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \param[in] direct_deposit_map A constant pointer to the \ref cardano_direct_deposit_map_t object from which
+ *                       the deposit amount is to be retrieved.
+ * \param[in] key The reward address whose associated deposit amount is to be retrieved from the direct_deposit_map.
+ * \param[out] element A pointer to a variable where the retrieved deposit amount will be stored. If the reward
+ *                     address is found in the direct_deposit_map, this variable will be set to the associated amount.
+ *
+ * \return \ref CARDANO_SUCCESS if the deposit amount was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if the
+ *         reward address is not present in the map, or an appropriate error code if the input parameters are invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_direct_deposit_map_t* direct_deposit_map = ...;
+ * cardano_reward_address_t* key = ...; // Create a reward address object representing the key
+ * uint64_t amount = 0;
+ *
+ * cardano_error_t result = cardano_direct_deposit_map_get(direct_deposit_map, key, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved amount
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_reward_address_unref(&key); // Clean up the key resource
+ * cardano_direct_deposit_map_unref(&direct_deposit_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_direct_deposit_map_get(
+  const cardano_direct_deposit_map_t* direct_deposit_map,
+  cardano_reward_address_t*           key,
+  uint64_t*                           element);
+
+/**
+ * \brief Inserts a key-value pair into the direct deposit map.
+ *
+ * This function inserts the specified reward address and deposit amount into the provided direct deposit map.
+ * The map keeps its entries sorted by the bytes of their reward addresses, so they are serialized in canonical
+ * CBOR key order whatever the order of insertion. Inserting a reward address that is already
+ * present in the map fails with \ref CARDANO_ERROR_DUPLICATED_KEY.
+ *
+ * \param[in] direct_deposit_map A constant pointer to the \ref cardano_direct_deposit_map_t object where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The reward address to be inserted into the direct deposit map. The caller is responsible for managing
+ *                the lifecycle of the key object.
+ * \param[in] value The amount of lovelace to deposit into the reward account.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_direct_deposit_map_t* direct_deposit_map = NULL;
+ * cardano_error_t result = cardano_direct_deposit_map_new(&direct_deposit_map);
+ *
+ * // Create the key object
+ * cardano_reward_address_t* key = ...;
+ * const uint64_t value = 1000000;
+ *
+ * // Insert the key-value pair into the direct_deposit_map
+ * result = cardano_direct_deposit_map_insert(direct_deposit_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up the key object
+ * cardano_reward_address_unref(&key);
+ *
+ * cardano_direct_deposit_map_unref(&direct_deposit_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_direct_deposit_map_insert(
+  cardano_direct_deposit_map_t* direct_deposit_map,
+  cardano_reward_address_t*     key,
+  uint64_t                      value);
+
+/**
+ * \brief Inserts a direct deposit entry into the direct deposit map using a reward address.
+ *
+ * This function inserts a direct deposit entry into the specified \ref cardano_direct_deposit_map_t object. The deposit is
+ * associated with a reward address and specifies the amount of lovelace credited to that account.
+ *
+ * \param[in, out] direct_deposit_map A pointer to the \ref cardano_direct_deposit_map_t object where the deposit entry will be inserted.
+ * \param[in] reward_address A pointer to a string representing the Bech32-encoded reward address. This parameter must not be NULL.
+ * \param[in] reward_address_size The length of the reward address string in bytes.
+ * \param[in] value The amount of ADA (in lovelace) to deposit into the reward account.
+ *
+ * \return \ref CARDANO_SUCCESS if the deposit entry was successfully inserted into the map, or an appropriate error code
+ * indicating the type of failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_direct_deposit_map_t* direct_deposit_map = ...; // Assume initialized
+ * const char* reward_address = "stake1u..."; // Bech32-encoded reward address
+ * uint64_t deposit_value = 1000000; // 1 ADA in lovelace
+ *
+ * cardano_error_t result = cardano_direct_deposit_map_insert_ex(direct_deposit_map, reward_address, strlen(reward_address), deposit_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Deposit entry successfully added
+ * }
+ * else
+ * {
+ *   printf("Failed to insert deposit entry: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup when done
+ * cardano_direct_deposit_map_unref(&direct_deposit_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_direct_deposit_map_insert_ex(
+  cardano_direct_deposit_map_t* direct_deposit_map,
+  const char*                   reward_address,
+  size_t                        reward_address_size,
+  uint64_t                      value);
+
+/**
+ * \brief Retrieves the keys from the direct deposit map.
+ *
+ * This function retrieves all the keys from the provided direct deposit map and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_reward_address_list_unref when it is no longer needed.
+ *
+ * \param[in] direct_deposit_map A constant pointer to the \ref cardano_direct_deposit_map_t object from which
+ *                       the keys are to be retrieved.
+ * \param[out] keys A pointer to a variable where the retrieved keys will be stored as a list.
+ *                  If successful, this variable will be set to point to the list of keys.
+ *                  The caller is responsible for managing the lifecycle of this list.
+ *                  It must be released by calling \ref cardano_reward_address_list_unref when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the keys were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_direct_deposit_map_t* direct_deposit_map = NULL;
+ * cardano_error_t result = cardano_direct_deposit_map_new(&direct_deposit_map);
+ *
+ * // Populate the direct_deposit_map with key-value pairs
+ *
+ * cardano_reward_address_list_t* keys = NULL;
+ * result = cardano_direct_deposit_map_get_keys(direct_deposit_map, &keys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of keys
+ *   // Keys must also be freed if retrieved from the list
+ *
+ *   // Once done, ensure to clean up and release the keys list
+ *   cardano_reward_address_list_unref(&keys);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_direct_deposit_map_unref(&direct_deposit_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_direct_deposit_map_get_keys(
+  cardano_direct_deposit_map_t*   direct_deposit_map,
+  cardano_reward_address_list_t** keys);
+
+/**
+ * \brief Retrieves the reward address at a specific index from the direct deposit map.
+ *
+ * This function retrieves the reward address at the specified index from the direct deposit map.
+ *
+ * \param[in] direct_deposit_map Pointer to the direct deposit map object.
+ * \param[in] index The index of the reward address to retrieve.
+ * \param[out] reward_address On successful retrieval, this will point to the reward address
+ *                            at the specified index. The caller is responsible for managing the lifecycle
+ *                            of this object. Specifically, once the reward address is no longer needed,
+ *                            the caller must release it by calling \ref cardano_reward_address_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the reward address was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_direct_deposit_map_t* direct_deposit_map = NULL;
+ * cardano_reward_address_t* reward_address = NULL;
+ * size_t index = 0; // Index of the reward address to retrieve
+ *
+ * // Assume direct_deposit_map is initialized properly
+ *
+ * cardano_error_t result = cardano_direct_deposit_map_get_key_at(direct_deposit_map, index, &reward_address);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the reward address
+ *
+ *   // Once done, ensure to clean up and release the reward address
+ *   cardano_reward_address_unref(&reward_address);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_direct_deposit_map_get_key_at(
+  const cardano_direct_deposit_map_t* direct_deposit_map,
+  size_t                              index,
+  cardano_reward_address_t**          reward_address);
+
+/**
+ * \brief Retrieves the deposit amount at a specific index from the direct deposit map.
+ *
+ * This function retrieves the lovelace amount at the specified index from the direct deposit map.
+ *
+ * \param[in] direct_deposit_map Pointer to the direct deposit map object.
+ * \param[in] index The index of the deposit amount to retrieve.
+ * \param[out] amount On successful retrieval, this will point to the deposit amount
+ *                    at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the deposit amount was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_direct_deposit_map_t* direct_deposit_map = NULL;
+ * uint64_t amount = 0;
+ * size_t index = 0; // Index of the deposit amount to retrieve
+ *
+ * // Assume direct_deposit_map is initialized properly
+ *
+ * cardano_error_t result = cardano_direct_deposit_map_get_value_at(direct_deposit_map, index, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the deposit amount
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_direct_deposit_map_get_value_at(
+  const cardano_direct_deposit_map_t* direct_deposit_map,
+  size_t                              index,
+  uint64_t*                           amount);
+
+/**
+ * \brief Retrieves the reward address and deposit amount at the specified index.
+ *
+ * This function retrieves the reward address and its associated lovelace amount from the direct deposit map
+ * at the specified index.
+ *
+ * \param[in]  direct_deposit_map    Pointer to the direct deposit map object.
+ * \param[in]  index             The index at which to retrieve the key-value pair.
+ * \param[out] reward_address On successful retrieval, this will point to the reward address at the specified index.
+ *                            The caller is responsible for managing the lifecycle of this object and should release it using
+ *                            \ref cardano_reward_address_unref when it is no longer needed.
+ * \param[out] amount On successful retrieval, this will point to the deposit amount at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_direct_deposit_map_t* direct_deposit_map = NULL;
+ * // Assume direct_deposit_map is initialized properly
+ *
+ * size_t index = 0;
+ * cardano_reward_address_t* reward_address = NULL;
+ * uint64_t amount = 0;
+ *
+ * cardano_error_t result = cardano_direct_deposit_map_get_key_value_at(direct_deposit_map, index, &reward_address, &amount);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the reward address and the amount
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_direct_deposit_map_unref(&direct_deposit_map);
+ * cardano_reward_address_unref(&reward_address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_direct_deposit_map_get_key_value_at(
+  const cardano_direct_deposit_map_t* direct_deposit_map,
+  size_t                              index,
+  cardano_reward_address_t**          reward_address,
+  uint64_t*                           amount);
+
+/**
+ * \brief Decrements the reference count of a direct_deposit_map object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_direct_deposit_map_t object
+ * by decreasing its reference count. When the reference count reaches zero, the direct_deposit_map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] direct_deposit_map A pointer to the pointer of the direct_deposit_map object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_direct_deposit_map_t* direct_deposit_map = NULL;
+ * cardano_error_t result = cardano_direct_deposit_map_new(&direct_deposit_map);
+ *
+ * // Perform operations with the direct_deposit_map...
+ *
+ * cardano_direct_deposit_map_unref(&direct_deposit_map);
+ * // At this point, direct_deposit_map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_direct_deposit_map_unref, the pointer to the \ref cardano_direct_deposit_map_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_direct_deposit_map_unref(cardano_direct_deposit_map_t** direct_deposit_map);
+
+/**
+ * \brief Increases the reference count of the cardano_direct_deposit_map_t object.
+ *
+ * This function is used to manually increment the reference count of a direct_deposit_map
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_direct_deposit_map_unref.
+ *
+ * \param direct_deposit_map A pointer to the direct_deposit_map object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming direct_deposit_map is a previously created direct_deposit_map object
+ *
+ * cardano_direct_deposit_map_ref(direct_deposit_map);
+ *
+ * // Now direct_deposit_map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_direct_deposit_map_ref there is a corresponding
+ * call to \ref cardano_direct_deposit_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_direct_deposit_map_ref(cardano_direct_deposit_map_t* direct_deposit_map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_direct_deposit_map_t object.
+ *
+ * This function returns the number of active references to a direct_deposit_map object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_direct_deposit_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param direct_deposit_map A pointer to the direct_deposit_map object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified direct_deposit_map object. If the object
+ * is properly managed (i.e., every \ref cardano_direct_deposit_map_ref call is matched with a
+ * \ref cardano_direct_deposit_map_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming direct_deposit_map is a previously created direct_deposit_map object
+ *
+ * size_t ref_count = cardano_direct_deposit_map_refcount(direct_deposit_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_direct_deposit_map_refcount(const cardano_direct_deposit_map_t* direct_deposit_map);
+
+/**
+ * \brief Sets the last error message for a given direct_deposit_map object.
+ *
+ * Records an error message in the direct_deposit_map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] direct_deposit_map A pointer to the \ref cardano_direct_deposit_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the direct_deposit_map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_direct_deposit_map_set_last_error(cardano_direct_deposit_map_t* direct_deposit_map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific direct_deposit_map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_direct_deposit_map_set_last_error for the given
+ * direct_deposit_map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] direct_deposit_map A pointer to the \ref cardano_direct_deposit_map_t instance whose last error
+ *                   message is to be retrieved. If the direct_deposit_map is NULL, the function
+ *                   returns a generic error message indicating the null direct_deposit_map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified direct_deposit_map. If the direct_deposit_map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_direct_deposit_map_set_last_error for the same direct_deposit_map, or until
+ *       the direct_deposit_map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_direct_deposit_map_get_last_error(const cardano_direct_deposit_map_t* direct_deposit_map);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_direct_deposit_map_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_direct_deposit_map_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_direct_deposit_map_deep_clone(const cardano_direct_deposit_map_t* source, cardano_direct_deposit_map_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_DIRECT_DEPOSIT_MAP_H
diff --git a/vendor/include/cardano/transaction_body/required_guards_map.h b/vendor/include/cardano/transaction_body/required_guards_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/required_guards_map.h
@@ -0,0 +1,659 @@
+/**
+ * \file required_guards_map.h
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_REQUIRED_GUARDS_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_REQUIRED_GUARDS_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/proposal_procedures/credential_set.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of credentials to an optional plutus datum.
+ *
+ * A sub transaction uses this map to restrict which top-level guards must be present;
+ * a top-level transaction body may also carry it as a self assertion. Each entry maps
+ * a credential to either a plutus datum or to no datum at all (encoded as CBOR null
+ * on the wire).
+ */
+typedef struct cardano_required_guards_map_t cardano_required_guards_map_t;
+
+/**
+ * \brief Serializes this Dijkstra value using CIP-116 JSON conventions.
+ *
+ * Encodes an array of key/value objects. Keys are credentials; values are Plutus data or null.
+ *
+ * \param[in] value Value to serialize. Must not be NULL.
+ * \param[in] writer JSON writer that receives the encoded value. Must not be NULL.
+ *
+ * \return CARDANO_SUCCESS on success, CARDANO_ERROR_POINTER_IS_NULL for a NULL argument,
+ *         or the error returned by a child serializer.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_required_guards_map_to_cip116_json(const cardano_required_guards_map_t* value, cardano_json_writer_t* writer);
+
+/**
+ * \brief Creates and initializes a new instance of a required guards map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_required_guards_map_t,
+ * representing a map structure. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] required_guards_map A pointer to a pointer to a \ref cardano_required_guards_map_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_required_guards_map_t
+ *                        object. This object represents a "strong reference" to the required_guards_map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the required_guards_map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_required_guards_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the required_guards_map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_required_guards_map_t* required_guards_map = NULL;
+ *
+ * // Attempt to create a new required_guards_map
+ * cardano_error_t result = cardano_required_guards_map_new(&required_guards_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the required_guards_map
+ *
+ *   // Once done, ensure to clean up and release the required_guards_map
+ *   cardano_required_guards_map_unref(&required_guards_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_required_guards_map_new(cardano_required_guards_map_t** required_guards_map);
+
+/**
+ * \brief Creates a required guards map from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_required_guards_map_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a required guards map.
+ *
+ * The map must not be empty on the wire; decoding an empty map fails with
+ * \ref CARDANO_ERROR_INVALID_CBOR_MAP_SIZE. An entry whose value is CBOR null is decoded
+ * as a credential without a datum.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded required guards map data.
+ * \param[out] required_guards_map A pointer to a pointer of \ref cardano_required_guards_map_t that will be set to the address
+ *                        of the newly created required guards map object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the required_guards_map was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_required_guards_map_t object by calling
+ *       \ref cardano_required_guards_map_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_required_guards_map_t* required_guards_map = NULL;
+ *
+ * cardano_error_t result = cardano_required_guards_map_from_cbor(reader, &required_guards_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the required_guards_map
+ *
+ *   // Once done, ensure to clean up and release the required_guards_map
+ *   cardano_required_guards_map_unref(&required_guards_map);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode required_guards_map: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_required_guards_map_from_cbor(cardano_cbor_reader_t* reader, cardano_required_guards_map_t** required_guards_map);
+
+/**
+ * \brief Serializes a required guards map into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_required_guards_map_t object using a \ref cardano_cbor_writer_t.
+ * Entries are written sorted by the CBOR encoding of their credentials, the canonical CBOR key order. An entry without a datum is written with a CBOR null value.
+ *
+ * \param[in] required_guards_map A constant pointer to the \ref cardano_required_guards_map_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p required_guards_map or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_required_guards_map_t* required_guards_map = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_required_guards_map_to_cbor(required_guards_map, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_required_guards_map_unref(&required_guards_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_required_guards_map_to_cbor(
+  const cardano_required_guards_map_t* required_guards_map,
+  cardano_cbor_writer_t*               writer);
+
+/**
+ * \brief Retrieves the length of the required_guards_map.
+ *
+ * This function returns the number of key-value pairs contained in the specified required_guards_map.
+ *
+ * \param[in] required_guards_map A constant pointer to the \ref cardano_required_guards_map_t object for which
+ *                       the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the required_guards_map. Returns 0 if the required_guards_map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_required_guards_map_t* required_guards_map = NULL;
+ * cardano_error_t result = cardano_required_guards_map_new(&required_guards_map);
+ *
+ * // Populate the required_guards_map with key-value pairs
+ *
+ * size_t length = cardano_required_guards_map_get_length(required_guards_map);
+ * printf("The length of the required_guards_map is: %zu\n", length);
+ *
+ * cardano_required_guards_map_unref(&required_guards_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_required_guards_map_get_length(const cardano_required_guards_map_t* required_guards_map);
+
+/**
+ * \brief Retrieves the datum associated with a given credential in the required guards map.
+ *
+ * This function retrieves the datum associated with the specified credential in the provided required guards map.
+ * It returns the datum through the output parameter `element`. Entries without a datum yield NULL through
+ * `element` while still returning \ref CARDANO_SUCCESS. If the credential is not found in the map, the
+ * function returns \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * \param[in] required_guards_map A constant pointer to the \ref cardano_required_guards_map_t object from which
+ *                       the datum is to be retrieved.
+ * \param[in] key The credential whose associated datum is to be retrieved from the required_guards_map.
+ * \param[out] element A pointer to a variable where the retrieved datum will be stored. If the credential
+ *                     is found and has a datum, this variable will be set to the associated datum, and the
+ *                     caller must release it by calling \ref cardano_plutus_data_unref. If the credential
+ *                     is found but has no datum, this variable will be set to NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the credential was found, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if the
+ *         credential is not present in the map, or an appropriate error code if the input parameters are invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_required_guards_map_t* required_guards_map = ...;
+ * cardano_credential_t* key = ...; // Create a credential object representing the key
+ * cardano_plutus_data_t* datum = NULL;
+ *
+ * cardano_error_t result = cardano_required_guards_map_get(required_guards_map, key, &datum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (datum != NULL)
+ *   {
+ *     // Use the retrieved datum
+ *     cardano_plutus_data_unref(&datum);
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_credential_unref(&key); // Clean up the key resource
+ * cardano_required_guards_map_unref(&required_guards_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_required_guards_map_get(
+  const cardano_required_guards_map_t* required_guards_map,
+  cardano_credential_t*                key,
+  cardano_plutus_data_t**              element);
+
+/**
+ * \brief Inserts a key-value pair into the required guards map.
+ *
+ * This function inserts the specified credential and its optional datum into the provided required guards map.
+ * The map keeps its entries sorted by the CBOR encoding of their credentials (by credential type, then hash bytes),
+ * so they are serialized in canonical CBOR key order whatever the order of insertion. Inserting a credential that is already
+ * present in the map fails with \ref CARDANO_ERROR_DUPLICATED_KEY.
+ *
+ * \param[in] required_guards_map A constant pointer to the \ref cardano_required_guards_map_t object where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The credential to be inserted into the required guards map. The caller is responsible for managing
+ *                the lifecycle of the key object.
+ * \param[in] value The datum to be associated with the credential, or NULL if the entry has no datum.
+ *                  The caller is responsible for managing the lifecycle of the value object.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_required_guards_map_t* required_guards_map = NULL;
+ * cardano_error_t result = cardano_required_guards_map_new(&required_guards_map);
+ *
+ * // Create key and value objects
+ * cardano_credential_t* key = ...;
+ * cardano_plutus_data_t* value = ...; // May be NULL for an entry without a datum
+ *
+ * // Insert the key-value pair into the required_guards_map
+ * result = cardano_required_guards_map_insert(required_guards_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value objects
+ * cardano_credential_unref(&key);
+ * cardano_plutus_data_unref(&value);
+ *
+ * cardano_required_guards_map_unref(&required_guards_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_required_guards_map_insert(
+  cardano_required_guards_map_t* required_guards_map,
+  cardano_credential_t*          key,
+  cardano_plutus_data_t*         value);
+
+/**
+ * \brief Retrieves the keys from the required guards map.
+ *
+ * This function retrieves all the keys from the provided required guards map and returns them as a set.
+ * The caller is responsible for managing the lifecycle of the returned set by calling
+ * \ref cardano_credential_set_unref when it is no longer needed.
+ *
+ * \note The returned set is canonically ordered (by credential type, then hash bytes), the same order
+ *       as the index based accessors.
+ *
+ * \param[in] required_guards_map A pointer to the \ref cardano_required_guards_map_t object from which
+ *                       the keys are to be retrieved.
+ * \param[out] keys A pointer to a variable where the retrieved keys will be stored as a set.
+ *                  If successful, this variable will be set to point to the set of keys.
+ *                  The caller is responsible for managing the lifecycle of this set.
+ *                  It must be released by calling \ref cardano_credential_set_unref when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the keys were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_required_guards_map_t* required_guards_map = NULL;
+ * cardano_error_t result = cardano_required_guards_map_new(&required_guards_map);
+ *
+ * // Populate the required_guards_map with key-value pairs
+ *
+ * cardano_credential_set_t* keys = NULL;
+ * result = cardano_required_guards_map_get_keys(required_guards_map, &keys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the set of keys
+ *   // Keys must also be freed if retrieved from the set
+ *
+ *   // Once done, ensure to clean up and release the keys set
+ *   cardano_credential_set_unref(&keys);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_required_guards_map_unref(&required_guards_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_required_guards_map_get_keys(
+  cardano_required_guards_map_t* required_guards_map,
+  cardano_credential_set_t**     keys);
+
+/**
+ * \brief Retrieves the credential at a specific index from the required guards map.
+ *
+ * This function retrieves the credential at the specified index from the required guards map.
+ *
+ * \param[in] required_guards_map Pointer to the required guards map object.
+ * \param[in] index The index of the credential to retrieve.
+ * \param[out] credential On successful retrieval, this will point to the credential
+ *                            at the specified index. The caller is responsible for managing the lifecycle
+ *                            of this object. Specifically, once the credential is no longer needed,
+ *                            the caller must release it by calling \ref cardano_credential_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the credential was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_required_guards_map_t* required_guards_map = NULL;
+ * cardano_credential_t* credential = NULL;
+ * size_t index = 0; // Index of the credential to retrieve
+ *
+ * // Assume required_guards_map is initialized properly
+ *
+ * cardano_error_t result = cardano_required_guards_map_get_key_at(required_guards_map, index, &credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_required_guards_map_get_key_at(
+  const cardano_required_guards_map_t* required_guards_map,
+  size_t                               index,
+  cardano_credential_t**               credential);
+
+/**
+ * \brief Retrieves the datum at a specific index from the required guards map.
+ *
+ * This function retrieves the datum at the specified index from the required guards map.
+ * Entries without a datum yield NULL through the output parameter.
+ *
+ * \param[in] required_guards_map Pointer to the required guards map object.
+ * \param[in] index The index of the datum to retrieve.
+ * \param[out] datum On successful retrieval, this will point to the datum at the specified index,
+ *                   or be set to NULL if the entry has no datum. When a datum is returned, the caller
+ *                   is responsible for managing its lifecycle and must release it by calling
+ *                   \ref cardano_plutus_data_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the datum was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_required_guards_map_t* required_guards_map = NULL;
+ * cardano_plutus_data_t* datum = NULL;
+ * size_t index = 0; // Index of the datum to retrieve
+ *
+ * // Assume required_guards_map is initialized properly
+ *
+ * cardano_error_t result = cardano_required_guards_map_get_value_at(required_guards_map, index, &datum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (datum != NULL)
+ *   {
+ *     // Use the datum
+ *     cardano_plutus_data_unref(&datum);
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_required_guards_map_get_value_at(
+  const cardano_required_guards_map_t* required_guards_map,
+  size_t                               index,
+  cardano_plutus_data_t**              datum);
+
+/**
+ * \brief Retrieves the credential and datum at the specified index.
+ *
+ * This function retrieves the credential and its optional datum from the required guards map
+ * at the specified index.
+ *
+ * \param[in]  required_guards_map    Pointer to the required guards map object.
+ * \param[in]  index             The index at which to retrieve the key-value pair.
+ * \param[out] credential On successful retrieval, this will point to the credential at the specified index.
+ *                            The caller is responsible for managing the lifecycle of this object and should release it using
+ *                            \ref cardano_credential_unref when it is no longer needed.
+ * \param[out] datum On successful retrieval, this will point to the datum at the specified index, or be set
+ *                   to NULL if the entry has no datum. When a datum is returned, the caller is responsible for
+ *                   managing its lifecycle and must release it by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_required_guards_map_t* required_guards_map = NULL;
+ * // Assume required_guards_map is initialized properly
+ *
+ * size_t index = 0;
+ * cardano_credential_t* credential = NULL;
+ * cardano_plutus_data_t* datum = NULL;
+ *
+ * cardano_error_t result = cardano_required_guards_map_get_key_value_at(required_guards_map, index, &credential, &datum);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the credential and the datum (the datum is NULL for entries without one)
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_required_guards_map_unref(&required_guards_map);
+ * cardano_credential_unref(&credential);
+ * cardano_plutus_data_unref(&datum);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_required_guards_map_get_key_value_at(
+  const cardano_required_guards_map_t* required_guards_map,
+  size_t                               index,
+  cardano_credential_t**               credential,
+  cardano_plutus_data_t**              datum);
+
+/**
+ * \brief Decrements the reference count of a required_guards_map object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_required_guards_map_t object
+ * by decreasing its reference count. When the reference count reaches zero, the required_guards_map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] required_guards_map A pointer to the pointer of the required_guards_map object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_required_guards_map_t* required_guards_map = NULL;
+ * cardano_error_t result = cardano_required_guards_map_new(&required_guards_map);
+ *
+ * // Perform operations with the required_guards_map...
+ *
+ * cardano_required_guards_map_unref(&required_guards_map);
+ * // At this point, required_guards_map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_required_guards_map_unref, the pointer to the \ref cardano_required_guards_map_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_required_guards_map_unref(cardano_required_guards_map_t** required_guards_map);
+
+/**
+ * \brief Increases the reference count of the cardano_required_guards_map_t object.
+ *
+ * This function is used to manually increment the reference count of a required_guards_map
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_required_guards_map_unref.
+ *
+ * \param required_guards_map A pointer to the required_guards_map object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming required_guards_map is a previously created required_guards_map object
+ *
+ * cardano_required_guards_map_ref(required_guards_map);
+ *
+ * // Now required_guards_map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_required_guards_map_ref there is a corresponding
+ * call to \ref cardano_required_guards_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_required_guards_map_ref(cardano_required_guards_map_t* required_guards_map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_required_guards_map_t object.
+ *
+ * This function returns the number of active references to a required_guards_map object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_required_guards_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param required_guards_map A pointer to the required_guards_map object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified required_guards_map object. If the object
+ * is properly managed (i.e., every \ref cardano_required_guards_map_ref call is matched with a
+ * \ref cardano_required_guards_map_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming required_guards_map is a previously created required_guards_map object
+ *
+ * size_t ref_count = cardano_required_guards_map_refcount(required_guards_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_required_guards_map_refcount(const cardano_required_guards_map_t* required_guards_map);
+
+/**
+ * \brief Sets the last error message for a given required_guards_map object.
+ *
+ * Records an error message in the required_guards_map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] required_guards_map A pointer to the \ref cardano_required_guards_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the required_guards_map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_required_guards_map_set_last_error(cardano_required_guards_map_t* required_guards_map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific required_guards_map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_required_guards_map_set_last_error for the given
+ * required_guards_map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] required_guards_map A pointer to the \ref cardano_required_guards_map_t instance whose last error
+ *                   message is to be retrieved. If the required_guards_map is NULL, the function
+ *                   returns a generic error message indicating the null required_guards_map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified required_guards_map. If the required_guards_map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_required_guards_map_set_last_error for the same required_guards_map, or until
+ *       the required_guards_map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_required_guards_map_get_last_error(const cardano_required_guards_map_t* required_guards_map);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_required_guards_map_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_required_guards_map_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_required_guards_map_deep_clone(const cardano_required_guards_map_t* source, cardano_required_guards_map_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_REQUIRED_GUARDS_MAP_H
diff --git a/vendor/include/cardano/transaction_body/sub_transaction_body.h b/vendor/include/cardano/transaction_body/sub_transaction_body.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/sub_transaction_body.h
@@ -0,0 +1,1601 @@
+/**
+ * \file sub_transaction_body.h
+ *
+ * \author angel.castillo
+ * \date   Jul 17, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_BODY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_BODY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/multi_asset.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/certs/certificate_set.h>
+#include <cardano/common/guard_set.h>
+#include <cardano/common/network_id.h>
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/proposal_procedures/proposal_procedure_set.h>
+#include <cardano/transaction_body/account_balance_intervals_map.h>
+#include <cardano/transaction_body/direct_deposit_map.h>
+#include <cardano/transaction_body/required_guards_map.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+#include <cardano/typedefs.h>
+#include <cardano/voting_procedures/voting_procedures.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The sub transaction body encapsulates the core details of a sub transaction.
+ *
+ * A sub transaction is a transaction nested inside a top-level transaction. Its body
+ * mirrors the top-level transaction body but carries no fee (the top-level transaction
+ * pays for the whole batch), no collateral fields and no further nesting. In addition
+ * to the shared fields, a sub transaction body may declare guards, required top-level
+ * guards, direct deposits and account balance intervals.
+ */
+typedef struct cardano_sub_transaction_body_t cardano_sub_transaction_body_t;
+
+/**
+ * \brief Serializes this Dijkstra value using CIP-116 JSON conventions.
+ *
+ * Encodes all sub-transaction fields. No fee, collateral, nested batch or validity flag is added.
+ *
+ * \param[in] transaction_body Value to serialize. Must not be NULL.
+ * \param[in] writer JSON writer that receives the encoded value. Must not be NULL.
+ *
+ * \return CARDANO_SUCCESS on success, CARDANO_ERROR_POINTER_IS_NULL for a NULL argument,
+ *         or the error returned by a child serializer.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_to_cip116_json(const cardano_sub_transaction_body_t* transaction_body, cardano_json_writer_t* writer);
+
+/**
+ * \brief Creates and initializes a new instance of a Cardano sub transaction body.
+ *
+ * This function allocates and initializes a new \ref cardano_sub_transaction_body_t object.
+ *
+ * \param[in] inputs A pointer to an initialized \ref cardano_transaction_input_set_t object
+ *                   representing the set of transaction inputs. This parameter must not be NULL.
+ * \param[in] outputs A pointer to an initialized \ref cardano_transaction_output_list_t object
+ *                    representing the list of transaction outputs. This parameter must not be NULL.
+ * \param[in] ttl An optional pointer to a uint64_t representing the time-to-live (TTL) parameter, specified as a slot number.
+ *                The sub transaction will be invalid if not included in a block by the time this slot is reached.
+ *                If no TTL is required, this pointer can be set to NULL.
+ * \param[out] sub_transaction_body On successful initialization, this will point to a newly created
+ *             \ref cardano_sub_transaction_body_t object. This object represents a "strong reference"
+ *             to the sub transaction body, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object. Specifically,
+ *             once the sub transaction body is no longer needed, the caller must release it by calling
+ *             \ref cardano_sub_transaction_body_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the sub transaction body was successfully created, or an appropriate error code indicating
+ *         the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the required input pointers (inputs, outputs) are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_set_t* inputs = ...;  // Assume inputs are initialized
+ * cardano_transaction_output_list_t* outputs = ...;  // Assume outputs are initialized
+ * uint64_t ttl_value = 100000;  // Optional TTL for the sub transaction
+ * cardano_sub_transaction_body_t* sub_transaction_body = NULL;
+ *
+ * // Pass the TTL as a pointer
+ * cardano_error_t result = cardano_sub_transaction_body_new(inputs, outputs, &ttl_value, &sub_transaction_body);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the sub transaction body
+ *
+ *   // Free resources when done
+ *   cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the sub transaction body: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // If no TTL is required, set the ttl pointer to NULL
+ * cardano_error_t no_ttl_result = cardano_sub_transaction_body_new(inputs, outputs, NULL, &sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_new(
+  cardano_transaction_input_set_t*   inputs,
+  cardano_transaction_output_list_t* outputs,
+  const uint64_t*                    ttl,
+  cardano_sub_transaction_body_t**   sub_transaction_body);
+
+/**
+ * \brief Creates a \ref cardano_sub_transaction_body_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_sub_transaction_body_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a sub transaction body.
+ *
+ * The map keys admitted at the sub transaction level are 0 (inputs), 1 (outputs), 3 (ttl), 4 (certificates),
+ * 5 (withdrawals), 7 (auxiliary data hash), 8 (validity interval start), 9 (mint), 11 (script data hash),
+ * 14 (guards), 15 (network id), 18 (reference inputs), 19 (voting procedures), 20 (proposal procedures),
+ * 21 (current treasury value), 22 (donation), 24 (required top level guards), 25 (direct deposits) and
+ * 26 (account balance intervals). Keys 0 and 1 are required; decoding fails with \ref CARDANO_ERROR_DECODING
+ * if either is absent. Any other key, including the top-level-only keys 2 (fee), 13 (collateral),
+ * 16 (collateral return), 17 (total collateral) and 23 (sub transactions), is rejected with
+ * \ref CARDANO_ERROR_INVALID_CBOR_MAP_KEY.
+ *
+ * The wire format requires the certificates (key 4), withdrawals (key 5) and mint (key 9) collections to be
+ * non-empty; this decoder enforces that constraint, whereas \ref cardano_transaction_body_from_cbor accepts
+ * empty collections at those keys for backward compatibility with historical top-level encodings. The donation
+ * (key 22) is a positive coin on the wire, but a zero value is accepted on decode, mirroring
+ * \ref cardano_transaction_body_from_cbor.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] sub_transaction_body A pointer to a pointer of \ref cardano_sub_transaction_body_t that will be set to the address
+ *                        of the newly created sub transaction body object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the sub transaction body was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, transactions are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical transaction representation, meaning that if you decode a sub transaction body from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the sub transaction id and invalidate any existing signatures.
+ *         To prevent this, when a sub transaction body object is created using \ref cardano_sub_transaction_body_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_sub_transaction_body_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_sub_transaction_body_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_sub_transaction_body_t object by calling
+ *       \ref cardano_sub_transaction_body_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_sub_transaction_body_t* sub_transaction_body = NULL;
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_from_cbor(reader, &sub_transaction_body);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the sub_transaction_body
+ *
+ *   // Once done, ensure to clean up and release the sub_transaction_body
+ *   cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode sub_transaction_body: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_from_cbor(cardano_cbor_reader_t* reader, cardano_sub_transaction_body_t** sub_transaction_body);
+
+/**
+ * \brief Serializes a sub transaction body into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_sub_transaction_body_t object using a \ref cardano_cbor_writer_t.
+ * If the sub transaction body was created by \ref cardano_sub_transaction_body_from_cbor, the function will use the cached CBOR representation
+ * to maintain the original encoding. This avoids potential differences in CBOR encoding which could invalidate signatures.
+ * If no cached CBOR is available, the function will serialize the sub transaction body as a map whose keys are
+ * emitted in ascending numeric order.
+ *
+ * \param[in] sub_transaction_body A constant pointer to the \ref cardano_sub_transaction_body_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p sub_transaction_body or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark If the sub transaction body object was created by \ref cardano_sub_transaction_body_from_cbor, the original CBOR encoding
+ *         will be cached and reused by this function to prevent round-trip encoding issues that can change the sub transaction id
+ *         and invalidate signatures. If the cached CBOR is not available or has been cleared, the function will serialize the
+ *         sub transaction body with its map keys in ascending numeric order.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_sub_transaction_body_to_cbor(sub_transaction_body, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_transaction_body_to_cbor(
+  const cardano_sub_transaction_body_t* sub_transaction_body,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Retrieves the set of transaction inputs from a sub transaction body.
+ *
+ * This function returns the set of transaction inputs associated with a given \ref cardano_sub_transaction_body_t object.
+ * These inputs represent the UTXOs (Unspent Transaction Outputs) being spent by the sub transaction.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_transaction_input_set_t object representing the set of transaction inputs.
+ *         The returned object is a new reference, and the caller is responsible for managing its lifecycle.
+ *         Specifically, the caller must release it by calling \ref cardano_transaction_input_set_unref when it is no longer needed.
+ *         If the \p sub_transaction_body is NULL, the function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is already initialized
+ * cardano_transaction_input_set_t* inputs = cardano_sub_transaction_body_get_inputs(sub_transaction_body);
+ *
+ * if (inputs != NULL)
+ * {
+ *   // Process the inputs
+ *   cardano_transaction_input_set_unref(&inputs); // Ensure to release the inputs when done
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_input_set_t* cardano_sub_transaction_body_get_inputs(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the transaction inputs for a sub transaction body.
+ *
+ * This function assigns a set of transaction inputs to a \ref cardano_sub_transaction_body_t object. The inputs represent
+ * the UTXOs (Unspent Transaction Outputs) that will be spent by the sub transaction.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] inputs A pointer to an initialized \ref cardano_transaction_input_set_t object representing the inputs to be set.
+ *                   This parameter must not be NULL.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the inputs were successfully set.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if either the \p sub_transaction_body or \p inputs is NULL.
+ *
+ * \note This function increases the reference count of the \p inputs object; the caller retains ownership of the inputs
+ *       and must release their reference to the inputs when no longer needed by calling \ref cardano_transaction_input_set_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_transaction_input_set_t* inputs = ...; // Assume inputs is initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_inputs(sub_transaction_body, inputs);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to set transaction inputs: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources when no longer needed
+ * cardano_transaction_input_set_unref(&inputs);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_inputs(cardano_sub_transaction_body_t* sub_transaction_body, cardano_transaction_input_set_t* inputs);
+
+/**
+ * \brief Retrieves the list of outputs from a sub transaction body.
+ *
+ * This function returns the list of outputs associated with a given \ref cardano_sub_transaction_body_t object. The outputs represent
+ * the recipients and amounts being transferred as part of the sub transaction.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_transaction_output_list_t object representing the list of transaction outputs. If the
+ *         \p sub_transaction_body is NULL, this function returns NULL.
+ *         The caller is responsible for managing the lifecycle of the returned list by calling
+ *         \ref cardano_transaction_output_list_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_transaction_output_list_t* outputs = cardano_sub_transaction_body_get_outputs(sub_transaction_body);
+ *
+ * if (outputs != NULL)
+ * {
+ *   // Use the outputs list
+ *   cardano_transaction_output_list_unref(&outputs);
+ * }
+ *
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_output_list_t* cardano_sub_transaction_body_get_outputs(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the list of outputs for a sub transaction body.
+ *
+ * This function assigns a new list of outputs to the specified \ref cardano_sub_transaction_body_t object. The outputs represent
+ * the recipients and amounts that are being transferred in the sub transaction.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object where the outputs will be set.
+ * \param[in] outputs A pointer to an initialized \ref cardano_transaction_output_list_t object representing the list of transaction outputs.
+ *                    This value must not be NULL, and it will replace any existing outputs in the \p sub_transaction_body.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the outputs were
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * \note This function increases the reference count of the \p outputs object, so the caller retains ownership of their respective references.
+ *       It is the caller's responsibility to release their reference to the outputs when they are no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is already initialized
+ * cardano_transaction_output_list_t* outputs = ...; // Assume outputs are initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_outputs(sub_transaction_body, outputs);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to set transaction outputs.\n");
+ * }
+ *
+ * // Clean up resources when no longer needed
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * cardano_transaction_output_list_unref(&outputs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_outputs(cardano_sub_transaction_body_t* sub_transaction_body, cardano_transaction_output_list_t* outputs);
+
+/**
+ * \brief Retrieves the "invalid after" value from the sub transaction body.
+ *
+ * This function fetches the "invalid after" field from a \ref cardano_sub_transaction_body_t object, representing
+ * the slot number after which the sub transaction is considered invalid. This field is optional, and the function
+ * will return a pointer to a `uint64_t` if the field is set, or `NULL` if it is not.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \c uint64_t representing the "invalid after" slot number if set. If this field is not set,
+ *         the function will return `NULL`. The returned pointer is managed internally and must not be freed by the caller.
+ *         The caller can use the pointer to read the value but not modify or free it.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume initialized
+ * const uint64_t* invalid_after = cardano_sub_transaction_body_get_invalid_after(sub_transaction_body);
+ *
+ * if (invalid_after != NULL)
+ * {
+ *   printf("Sub transaction is invalid after slot: %llu\n", *invalid_after);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_sub_transaction_body_get_invalid_after(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the "invalid after" field in the sub transaction body.
+ *
+ * This function assigns a value to the "invalid after" field of a \ref cardano_sub_transaction_body_t object, specifying
+ * the slot number after which the sub transaction becomes invalid. The "invalid after" field is optional, and passing a
+ * `NULL` pointer will unset the value, effectively removing the "invalid after" field from the sub transaction.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object where the field will be set.
+ * \param[in] slot A constant pointer to a \c uint64_t representing the "invalid after" slot number. If `NULL`, this will unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the field was successfully set or unset,
+ *         or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume initialized
+ * uint64_t slot = 123456; // Slot number
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_invalid_after(sub_transaction_body, &slot);
+ *
+ * // To unset the invalid after field:
+ * result = cardano_sub_transaction_body_set_invalid_after(sub_transaction_body, NULL);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_invalid_after(cardano_sub_transaction_body_t* sub_transaction_body, const uint64_t* slot);
+
+/**
+ * \brief Retrieves the set of certificates associated with the sub transaction body.
+ *
+ * This function returns the certificates from a \ref cardano_sub_transaction_body_t object, if they are present.
+ * Certificates in Cardano are used for various purposes, such as stake delegation and pool registration.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_certificate_set_t object representing the set of certificates. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_certificate_set_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no certificates, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_certificate_set_t* certificates = cardano_sub_transaction_body_get_certificates(sub_transaction_body);
+ *
+ * if (certificates != NULL)
+ * {
+ *   // Use the certificates
+ *   cardano_certificate_set_unref(&certificates);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_certificate_set_t* cardano_sub_transaction_body_get_certificates(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the certificates for a sub transaction body.
+ *
+ * This function assigns a set of certificates to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the certificates, removing them from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] certificates A pointer to an initialized \ref cardano_certificate_set_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificates were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p certificates object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_certificate_set_t* certificates = ...; // Assume certificates are initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_certificates(sub_transaction_body, certificates);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_certificate_set_unref(&certificates);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_certificates(cardano_sub_transaction_body_t* sub_transaction_body, cardano_certificate_set_t* certificates);
+
+/**
+ * \brief Retrieves the withdrawals map from the sub transaction body.
+ *
+ * This function returns the withdrawals from a \ref cardano_sub_transaction_body_t object, if they are present.
+ * Withdrawals map reward accounts to the amount of lovelace being withdrawn from them.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_withdrawal_map_t object representing the withdrawals. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_withdrawal_map_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no withdrawals, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_withdrawal_map_t* withdrawals = cardano_sub_transaction_body_get_withdrawals(sub_transaction_body);
+ *
+ * if (withdrawals != NULL)
+ * {
+ *   // Use the withdrawals
+ *   cardano_withdrawal_map_unref(&withdrawals);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_withdrawal_map_t* cardano_sub_transaction_body_get_withdrawals(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the withdrawals for a sub transaction body.
+ *
+ * This function assigns a withdrawal map to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the withdrawals, removing them from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] withdrawals A pointer to an initialized \ref cardano_withdrawal_map_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the withdrawals were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p withdrawals object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_withdrawal_map_t* withdrawals = ...; // Assume withdrawals are initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_withdrawals(sub_transaction_body, withdrawals);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_withdrawal_map_unref(&withdrawals);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_withdrawals(cardano_sub_transaction_body_t* sub_transaction_body, cardano_withdrawal_map_t* withdrawals);
+
+/**
+ * \brief Retrieves the auxiliary data hash from the sub transaction body.
+ *
+ * This function returns the auxiliary data hash from a \ref cardano_sub_transaction_body_t object, if it is present.
+ * The auxiliary data hash commits the sub transaction to its auxiliary data (metadata and auxiliary scripts).
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_blake2b_hash_t object representing the auxiliary data hash. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_blake2b_hash_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no auxiliary data hash, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_blake2b_hash_t* aux_data_hash = cardano_sub_transaction_body_get_aux_data_hash(sub_transaction_body);
+ *
+ * if (aux_data_hash != NULL)
+ * {
+ *   // Use the auxiliary data hash
+ *   cardano_blake2b_hash_unref(&aux_data_hash);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_sub_transaction_body_get_aux_data_hash(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the auxiliary data hash for a sub transaction body.
+ *
+ * This function assigns an auxiliary data hash to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the auxiliary data hash, removing it from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] aux_data_hash A pointer to an initialized \ref cardano_blake2b_hash_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the auxiliary data hash was
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p aux_data_hash object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_blake2b_hash_t* aux_data_hash = ...; // Assume aux_data_hash is initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_aux_data_hash(sub_transaction_body, aux_data_hash);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_blake2b_hash_unref(&aux_data_hash);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_aux_data_hash(cardano_sub_transaction_body_t* sub_transaction_body, cardano_blake2b_hash_t* aux_data_hash);
+
+/**
+ * \brief Retrieves the "invalid before" value from the sub transaction body.
+ *
+ * This function fetches the "invalid before" field from a \ref cardano_sub_transaction_body_t object, representing
+ * the slot number before which the sub transaction is considered invalid. This field is optional, and the function
+ * will return a pointer to a `uint64_t` if the field is set, or `NULL` if it is not.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \c uint64_t representing the "invalid before" slot number if set. If this field is not set,
+ *         the function will return `NULL`. The returned pointer is managed internally and must not be freed by the caller.
+ *         The caller can use the pointer to read the value but not modify or free it.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume initialized
+ * const uint64_t* invalid_before = cardano_sub_transaction_body_get_invalid_before(sub_transaction_body);
+ *
+ * if (invalid_before != NULL)
+ * {
+ *   printf("Sub transaction is invalid before slot: %llu\n", *invalid_before);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_sub_transaction_body_get_invalid_before(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the "invalid before" field in the sub transaction body.
+ *
+ * This function assigns a value to the "invalid before" field of a \ref cardano_sub_transaction_body_t object, specifying
+ * the slot number before which the sub transaction is invalid. The "invalid before" field is optional, and passing a
+ * `NULL` pointer will unset the value, effectively removing the "invalid before" field from the sub transaction.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object where the field will be set.
+ * \param[in] slot A constant pointer to a \c uint64_t representing the "invalid before" slot number. If `NULL`, this will unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the field was successfully set or unset,
+ *         or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume initialized
+ * uint64_t slot = 100; // Slot number
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_invalid_before(sub_transaction_body, &slot);
+ *
+ * // To unset the invalid before field:
+ * result = cardano_sub_transaction_body_set_invalid_before(sub_transaction_body, NULL);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_invalid_before(cardano_sub_transaction_body_t* sub_transaction_body, const uint64_t* slot);
+
+/**
+ * \brief Retrieves the mint field from the sub transaction body.
+ *
+ * This function returns the multi asset mint field from a \ref cardano_sub_transaction_body_t object, if it is present.
+ * The mint field describes the native assets being minted (positive amounts) or burned (negative amounts) by the sub transaction.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_multi_asset_t object representing the mint field. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_multi_asset_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no mint field, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_multi_asset_t* mint = cardano_sub_transaction_body_get_mint(sub_transaction_body);
+ *
+ * if (mint != NULL)
+ * {
+ *   // Use the mint field
+ *   cardano_multi_asset_unref(&mint);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_multi_asset_t* cardano_sub_transaction_body_get_mint(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the mint field for a sub transaction body.
+ *
+ * This function assigns a multi asset mint field to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the mint field, removing it from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] mint A pointer to an initialized \ref cardano_multi_asset_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the mint field was
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p mint object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_multi_asset_t* mint = ...; // Assume mint is initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_mint(sub_transaction_body, mint);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_multi_asset_unref(&mint);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_mint(cardano_sub_transaction_body_t* sub_transaction_body, cardano_multi_asset_t* mint);
+
+/**
+ * \brief Retrieves the script data hash from the sub transaction body.
+ *
+ * This function returns the script data hash from a \ref cardano_sub_transaction_body_t object, if it is present.
+ * The script data hash commits the sub transaction to its redeemers, datums and the cost models in force.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_blake2b_hash_t object representing the script data hash. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_blake2b_hash_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no script data hash, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_blake2b_hash_t* script_data_hash = cardano_sub_transaction_body_get_script_data_hash(sub_transaction_body);
+ *
+ * if (script_data_hash != NULL)
+ * {
+ *   // Use the script data hash
+ *   cardano_blake2b_hash_unref(&script_data_hash);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_sub_transaction_body_get_script_data_hash(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the script data hash for a sub transaction body.
+ *
+ * This function assigns a script data hash to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the script data hash, removing it from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] script_data_hash A pointer to an initialized \ref cardano_blake2b_hash_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the script data hash was
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p script_data_hash object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_blake2b_hash_t* script_data_hash = ...; // Assume script_data_hash is initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_script_data_hash(sub_transaction_body, script_data_hash);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_blake2b_hash_unref(&script_data_hash);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_script_data_hash(cardano_sub_transaction_body_t* sub_transaction_body, cardano_blake2b_hash_t* script_data_hash);
+
+/**
+ * \brief Retrieves the guards from the sub transaction body.
+ *
+ * This function returns the guard set from a \ref cardano_sub_transaction_body_t object, if it is present.
+ * Guards are credentials that must authorize the sub transaction, either with a signature (key hash guards)
+ * or by running the corresponding script (script hash guards).
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_guard_set_t object representing the guards. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_guard_set_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no guards, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_guard_set_t* guards = cardano_sub_transaction_body_get_guards(sub_transaction_body);
+ *
+ * if (guards != NULL)
+ * {
+ *   // Use the guards
+ *   cardano_guard_set_unref(&guards);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_guard_set_t* cardano_sub_transaction_body_get_guards(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the guards for a sub transaction body.
+ *
+ * This function assigns a guard set to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the guards, removing them from the sub transaction body.
+ *
+ * An empty guard set is kept by the sub transaction body but is not encoded: key 14 is omitted, as the
+ * Dijkstra era rejects an explicitly empty set at that key.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] guards A pointer to an initialized \ref cardano_guard_set_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the guards were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p guards object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_guard_set_t* guards = ...; // Assume guards are initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_guards(sub_transaction_body, guards);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_guard_set_unref(&guards);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_guards(cardano_sub_transaction_body_t* sub_transaction_body, cardano_guard_set_t* guards);
+
+/**
+ * \brief Retrieves the network id from the sub transaction body.
+ *
+ * This function fetches the network id field from a \ref cardano_sub_transaction_body_t object, identifying the
+ * network (mainnet or testnet) the sub transaction is intended for. This field is optional, and the function
+ * will return a pointer to a \ref cardano_network_id_t if the field is set, or `NULL` if it is not.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_network_id_t representing the network id if set. If this field is not set,
+ *         the function will return `NULL`. The returned pointer is managed internally and must not be freed by the caller.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume initialized
+ * const cardano_network_id_t* network_id = cardano_sub_transaction_body_get_network_id(sub_transaction_body);
+ *
+ * if (network_id != NULL)
+ * {
+ *   printf("Network id: %d\n", *network_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const cardano_network_id_t* cardano_sub_transaction_body_get_network_id(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the network id for a sub transaction body.
+ *
+ * This function assigns a network id to a \ref cardano_sub_transaction_body_t object. The network id field is optional,
+ * and passing a `NULL` pointer will unset the value, effectively removing the network id from the sub transaction.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] network_id A constant pointer to a \ref cardano_network_id_t representing the network id. If `NULL`, this will unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the field was successfully set or unset,
+ *         or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume initialized
+ * cardano_network_id_t network_id = CARDANO_NETWORK_ID_MAIN_NET;
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_network_id(sub_transaction_body, &network_id);
+ *
+ * // To unset the network id field:
+ * result = cardano_sub_transaction_body_set_network_id(sub_transaction_body, NULL);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_network_id(cardano_sub_transaction_body_t* sub_transaction_body, const cardano_network_id_t* network_id);
+
+/**
+ * \brief Retrieves the set of reference inputs from a sub transaction body.
+ *
+ * This function returns the reference inputs associated with a given \ref cardano_sub_transaction_body_t object.
+ * Reference inputs are UTXOs that the sub transaction can read without spending them.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_transaction_input_set_t object representing the reference inputs. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_transaction_input_set_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no reference inputs, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_transaction_input_set_t* reference_inputs = cardano_sub_transaction_body_get_reference_inputs(sub_transaction_body);
+ *
+ * if (reference_inputs != NULL)
+ * {
+ *   // Use the reference inputs
+ *   cardano_transaction_input_set_unref(&reference_inputs);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_input_set_t* cardano_sub_transaction_body_get_reference_inputs(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the reference inputs for a sub transaction body.
+ *
+ * This function assigns a set of reference inputs to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the reference inputs, removing them from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] reference_inputs A pointer to an initialized \ref cardano_transaction_input_set_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the reference inputs were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p reference_inputs object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_transaction_input_set_t* reference_inputs = ...; // Assume reference_inputs is initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_reference_inputs(sub_transaction_body, reference_inputs);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_transaction_input_set_unref(&reference_inputs);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_reference_inputs(
+  cardano_sub_transaction_body_t*  sub_transaction_body,
+  cardano_transaction_input_set_t* reference_inputs);
+
+/**
+ * \brief Retrieves the voting procedures from the sub transaction body.
+ *
+ * This function returns the voting procedures from a \ref cardano_sub_transaction_body_t object, if they are present.
+ * Voting procedures record the votes cast by voters on governance actions.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_voting_procedures_t object representing the voting procedures. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_voting_procedures_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no voting procedures, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_voting_procedures_t* voting_procedures = cardano_sub_transaction_body_get_voting_procedures(sub_transaction_body);
+ *
+ * if (voting_procedures != NULL)
+ * {
+ *   // Use the voting procedures
+ *   cardano_voting_procedures_unref(&voting_procedures);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_voting_procedures_t* cardano_sub_transaction_body_get_voting_procedures(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the voting procedures for a sub transaction body.
+ *
+ * This function assigns voting procedures to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the voting procedures, removing them from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] voting_procedures A pointer to an initialized \ref cardano_voting_procedures_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the voting procedures were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p voting_procedures object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_voting_procedures_t* voting_procedures = ...; // Assume voting_procedures is initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_voting_procedures(sub_transaction_body, voting_procedures);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_voting_procedures_unref(&voting_procedures);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_voting_procedures(
+  cardano_sub_transaction_body_t* sub_transaction_body,
+  cardano_voting_procedures_t*    voting_procedures);
+
+/**
+ * \brief Retrieves the proposal procedures from the sub transaction body.
+ *
+ * This function returns the proposal procedures from a \ref cardano_sub_transaction_body_t object, if they are present.
+ * Proposal procedures submit governance actions for the community to vote on.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_proposal_procedure_set_t object representing the proposal procedures. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_proposal_procedure_set_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no proposal procedures, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_proposal_procedure_set_t* proposal_procedures = cardano_sub_transaction_body_get_proposal_procedures(sub_transaction_body);
+ *
+ * if (proposal_procedures != NULL)
+ * {
+ *   // Use the proposal procedures
+ *   cardano_proposal_procedure_set_unref(&proposal_procedures);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_proposal_procedure_set_t* cardano_sub_transaction_body_get_proposal_procedures(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the proposal procedures for a sub transaction body.
+ *
+ * This function assigns proposal procedures to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the proposal procedures, removing them from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] proposal_procedures A pointer to an initialized \ref cardano_proposal_procedure_set_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the proposal procedures were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p proposal_procedures object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_proposal_procedure_set_t* proposal_procedures = ...; // Assume proposal_procedures is initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_proposal_procedures(sub_transaction_body, proposal_procedures);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_proposal_procedure_set_unref(&proposal_procedures);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_proposal_procedures(
+  cardano_sub_transaction_body_t*   sub_transaction_body,
+  cardano_proposal_procedure_set_t* proposal_procedures);
+
+/**
+ * \brief Retrieves the current treasury value from the sub transaction body.
+ *
+ * This function fetches the current treasury value field from a \ref cardano_sub_transaction_body_t object, an
+ * assertion of the current amount of lovelace in the treasury. This field is optional, and the function will
+ * return a pointer to a `uint64_t` if the field is set, or `NULL` if it is not.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \c uint64_t representing the current treasury value if set. If this field is not set,
+ *         the function will return `NULL`. The returned pointer is managed internally and must not be freed by the caller.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume initialized
+ * const uint64_t* treasury_value = cardano_sub_transaction_body_get_treasury_value(sub_transaction_body);
+ *
+ * if (treasury_value != NULL)
+ * {
+ *   printf("Current treasury value: %llu lovelaces\n", *treasury_value);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_sub_transaction_body_get_treasury_value(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the current treasury value for a sub transaction body.
+ *
+ * This function assigns a current treasury value to a \ref cardano_sub_transaction_body_t object. The field is optional,
+ * and passing a `NULL` pointer will unset the value, removing it from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] treasury_value A constant pointer to a \c uint64_t representing the current treasury value in lovelaces.
+ *                           If `NULL`, this will unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the field was successfully set or unset,
+ *         or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume initialized
+ * uint64_t treasury_value = 2000;
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_treasury_value(sub_transaction_body, &treasury_value);
+ *
+ * // To unset the treasury value field:
+ * result = cardano_sub_transaction_body_set_treasury_value(sub_transaction_body, NULL);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_treasury_value(cardano_sub_transaction_body_t* sub_transaction_body, const uint64_t* treasury_value);
+
+/**
+ * \brief Retrieves the donation from the sub transaction body.
+ *
+ * This function fetches the donation field from a \ref cardano_sub_transaction_body_t object, the amount of
+ * lovelace donated to the treasury. This field is optional, and the function will return a pointer to a
+ * `uint64_t` if the field is set, or `NULL` if it is not.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \c uint64_t representing the donation if set. If this field is not set,
+ *         the function will return `NULL`. The returned pointer is managed internally and must not be freed by the caller.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume initialized
+ * const uint64_t* donation = cardano_sub_transaction_body_get_donation(sub_transaction_body);
+ *
+ * if (donation != NULL)
+ * {
+ *   printf("Donation: %llu lovelaces\n", *donation);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_sub_transaction_body_get_donation(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the donation for a sub transaction body.
+ *
+ * This function assigns a donation to a \ref cardano_sub_transaction_body_t object. On the wire the donation is a
+ * positive amount of lovelace donated to the treasury. The field is optional, and passing a `NULL` pointer will
+ * unset the value, removing it from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] donation A constant pointer to a \c uint64_t representing the donation in lovelaces. If `NULL`, this will unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the field was successfully set or unset,
+ *         or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume initialized
+ * uint64_t donation = 1000;
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_donation(sub_transaction_body, &donation);
+ *
+ * // To unset the donation field:
+ * result = cardano_sub_transaction_body_set_donation(sub_transaction_body, NULL);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_donation(cardano_sub_transaction_body_t* sub_transaction_body, const uint64_t* donation);
+
+/**
+ * \brief Retrieves the required top level guards from the sub transaction body.
+ *
+ * This function returns the required top level guards from a \ref cardano_sub_transaction_body_t object, if they are present.
+ * The map restricts which guards must be declared by the enclosing top-level transaction, each optionally paired with
+ * the datum the guard must be invoked with.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_required_guards_map_t object representing the required top level guards. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_required_guards_map_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no required top level guards, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_required_guards_map_t* required_guards = cardano_sub_transaction_body_get_required_top_level_guards(sub_transaction_body);
+ *
+ * if (required_guards != NULL)
+ * {
+ *   // Use the required top level guards
+ *   cardano_required_guards_map_unref(&required_guards);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_required_guards_map_t* cardano_sub_transaction_body_get_required_top_level_guards(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the required top level guards for a sub transaction body.
+ *
+ * This function assigns a required guards map to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the required top level guards, removing them from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] required_top_level_guards A pointer to an initialized \ref cardano_required_guards_map_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the required top level guards were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p required_top_level_guards object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_required_guards_map_t* required_guards = ...; // Assume required_guards is initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_required_top_level_guards(sub_transaction_body, required_guards);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_required_guards_map_unref(&required_guards);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_required_top_level_guards(
+  cardano_sub_transaction_body_t* sub_transaction_body,
+  cardano_required_guards_map_t*  required_top_level_guards);
+
+/**
+ * \brief Retrieves the direct deposits from the sub transaction body.
+ *
+ * This function returns the direct deposits from a \ref cardano_sub_transaction_body_t object, if they are present.
+ * Direct deposits map reward accounts to the amount of lovelace deposited directly into them.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_direct_deposit_map_t object representing the direct deposits. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_direct_deposit_map_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no direct deposits, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_direct_deposit_map_t* direct_deposits = cardano_sub_transaction_body_get_direct_deposits(sub_transaction_body);
+ *
+ * if (direct_deposits != NULL)
+ * {
+ *   // Use the direct deposits
+ *   cardano_direct_deposit_map_unref(&direct_deposits);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_direct_deposit_map_t* cardano_sub_transaction_body_get_direct_deposits(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the direct deposits for a sub transaction body.
+ *
+ * This function assigns a direct deposit map to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the direct deposits, removing them from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] direct_deposits A pointer to an initialized \ref cardano_direct_deposit_map_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the direct deposits were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p direct_deposits object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_direct_deposit_map_t* direct_deposits = ...; // Assume direct_deposits is initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_direct_deposits(sub_transaction_body, direct_deposits);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_direct_deposit_map_unref(&direct_deposits);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_direct_deposits(
+  cardano_sub_transaction_body_t* sub_transaction_body,
+  cardano_direct_deposit_map_t*   direct_deposits);
+
+/**
+ * \brief Retrieves the account balance intervals from the sub transaction body.
+ *
+ * This function returns the account balance intervals from a \ref cardano_sub_transaction_body_t object, if they are present.
+ * The map constrains, per reward account, the balance the account must satisfy for the sub transaction to be valid.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_account_balance_intervals_map_t object representing the account balance intervals. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_account_balance_intervals_map_unref
+ *         when it is no longer needed. If the \p sub_transaction_body is NULL or has no account balance intervals, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_account_balance_intervals_map_t* intervals = cardano_sub_transaction_body_get_account_balance_intervals(sub_transaction_body);
+ *
+ * if (intervals != NULL)
+ * {
+ *   // Use the account balance intervals
+ *   cardano_account_balance_intervals_map_unref(&intervals);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_account_balance_intervals_map_t* cardano_sub_transaction_body_get_account_balance_intervals(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the account balance intervals for a sub transaction body.
+ *
+ * This function assigns an account balance intervals map to a \ref cardano_sub_transaction_body_t object. Passing NULL
+ * unsets the account balance intervals, removing them from the sub transaction body.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object.
+ * \param[in] account_balance_intervals A pointer to an initialized \ref cardano_account_balance_intervals_map_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the account balance intervals were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p sub_transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p account_balance_intervals object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ * cardano_account_balance_intervals_map_t* intervals = ...; // Assume intervals is initialized
+ *
+ * cardano_error_t result = cardano_sub_transaction_body_set_account_balance_intervals(sub_transaction_body, intervals);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_account_balance_intervals_map_unref(&intervals);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_set_account_balance_intervals(
+  cardano_sub_transaction_body_t*          sub_transaction_body,
+  cardano_account_balance_intervals_map_t* account_balance_intervals);
+
+/**
+ * \brief Retrieves the hash of a sub transaction body.
+ *
+ * This function computes and returns the hash of the given \ref cardano_sub_transaction_body_t object. The hash is the
+ * blake2b-256 digest of the CBOR encoded body bytes and serves as the sub transaction id, following the same convention
+ * as the top-level transaction id.
+ *
+ * \param[in] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object. The object must be valid and not NULL.
+ *
+ * \return A pointer to a \ref cardano_blake2b_hash_t object representing the sub transaction body hash. The returned object is a new reference, and
+ *         the caller is responsible for releasing it by calling \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *         If the input is NULL, the function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is already initialized
+ * cardano_blake2b_hash_t* sub_tx_id = cardano_sub_transaction_body_get_hash(sub_transaction_body);
+ *
+ * if (sub_tx_id != NULL)
+ * {
+ *   // Use the sub transaction id for signing or verification
+ *
+ *   // Clean up when done
+ *   cardano_blake2b_hash_unref(&sub_tx_id);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_sub_transaction_body_get_hash(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Clears the cached CBOR representation from a sub transaction body.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_sub_transaction_body_t object.
+ * It is useful when you have modified the sub transaction body after it was created from CBOR using
+ * \ref cardano_sub_transaction_body_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the sub transaction body, rather than using the original cached CBOR.
+ *
+ * \param[in,out] sub_transaction_body A pointer to an initialized \ref cardano_sub_transaction_body_t object
+ *                                     from which the CBOR cache will be cleared.
+ *
+ * \note After calling this function, subsequent calls to \ref cardano_sub_transaction_body_to_cbor will
+ *       serialize the sub transaction body as a map whose keys are emitted in ascending numeric order,
+ *       rather than reusing the original cached CBOR.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the sub transaction body when
+ *          serialized, which can alter the sub transaction id and invalidate any existing signatures.
+ *          Use this function with caution, especially if the sub transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume sub_transaction_body was created using cardano_sub_transaction_body_from_cbor
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...;
+ *
+ * // Modify the sub transaction body as needed
+ * uint64_t slot = 200000;
+ * cardano_error_t result = cardano_sub_transaction_body_set_invalid_after(sub_transaction_body, &slot);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to set new TTL: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated sub transaction body
+ * cardano_sub_transaction_body_clear_cbor_cache(sub_transaction_body);
+ *
+ * // Serialize the sub transaction body to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_sub_transaction_body_to_cbor(sub_transaction_body, writer);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_transaction_body_clear_cbor_cache(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Decrements the reference count of a cardano_sub_transaction_body_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_sub_transaction_body_t object
+ * by decreasing its reference count. When the reference count reaches zero, the sub transaction body is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] sub_transaction_body A pointer to the pointer of the sub transaction body object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_body_t* sub_transaction_body = ...; // Assume sub_transaction_body is initialized
+ *
+ * // Perform operations with the sub_transaction_body...
+ *
+ * cardano_sub_transaction_body_unref(&sub_transaction_body);
+ * // At this point, sub_transaction_body is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_sub_transaction_body_unref, the pointer to the \ref cardano_sub_transaction_body_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_sub_transaction_body_unref(cardano_sub_transaction_body_t** sub_transaction_body);
+
+/**
+ * \brief Increases the reference count of the cardano_sub_transaction_body_t object.
+ *
+ * This function is used to manually increment the reference count of a sub transaction body
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_sub_transaction_body_unref.
+ *
+ * \param sub_transaction_body A pointer to the sub transaction body object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming sub_transaction_body is a previously created sub transaction body object
+ *
+ * cardano_sub_transaction_body_ref(sub_transaction_body);
+ *
+ * // Now sub_transaction_body can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_sub_transaction_body_ref there is a corresponding
+ * call to \ref cardano_sub_transaction_body_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_sub_transaction_body_ref(cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_sub_transaction_body_t object.
+ *
+ * This function returns the number of active references to a sub transaction body object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_sub_transaction_body_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param sub_transaction_body A pointer to the sub transaction body object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified sub transaction body object. If the object
+ * is properly managed (i.e., every \ref cardano_sub_transaction_body_ref call is matched with a
+ * \ref cardano_sub_transaction_body_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming sub_transaction_body is a previously created sub transaction body object
+ *
+ * size_t ref_count = cardano_sub_transaction_body_refcount(sub_transaction_body);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_sub_transaction_body_refcount(const cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Sets the last error message for a given sub transaction body object.
+ *
+ * Records an error message in the sub transaction body's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] sub_transaction_body A pointer to the \ref cardano_sub_transaction_body_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the sub transaction body's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_sub_transaction_body_set_last_error(cardano_sub_transaction_body_t* sub_transaction_body, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific sub transaction body.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_sub_transaction_body_set_last_error for the given
+ * sub transaction body. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] sub_transaction_body A pointer to the \ref cardano_sub_transaction_body_t instance whose last error
+ *                   message is to be retrieved. If the sub transaction body is NULL, the function
+ *                   returns a generic error message indicating the null sub transaction body.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified sub transaction body. If the sub transaction body is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_sub_transaction_body_set_last_error for the same sub transaction body, or until
+ *       the sub transaction body is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_sub_transaction_body_get_last_error(const cardano_sub_transaction_body_t* sub_transaction_body);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_sub_transaction_body_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_sub_transaction_body_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_body_deep_clone(const cardano_sub_transaction_body_t* source, cardano_sub_transaction_body_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_BODY_H
diff --git a/vendor/include/cardano/transaction_body/sub_transaction_set.h b/vendor/include/cardano/transaction_body/sub_transaction_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/sub_transaction_set.h
@@ -0,0 +1,561 @@
+/**
+ * \file sub_transaction_set.h
+ *
+ * \author angel.castillo
+ * \date   Jul 17, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents the set of sub transactions carried by a transaction body (the
+ * sub transactions transaction body field).
+ *
+ * Sub transactions let several parties compose intents that are validated and applied atomically
+ * as part of a single top-level transaction.
+ *
+ * On the wire this field is a non-empty array of sub transactions, optionally wrapped in CBOR
+ * tag 258. The ledger models the field as an ordered map keyed by sub transaction id, but the ids
+ * are never serialized; each id is derived by hashing the sub transaction body (blake2b-256).
+ * The set preserves insertion order and rejects two sub transactions with the same id.
+ */
+typedef struct cardano_sub_transaction_set_t cardano_sub_transaction_set_t;
+
+/**
+ * \brief Serializes this Dijkstra value using CIP-116 JSON conventions.
+ *
+ * Encodes an array in insertion order. Each member uses its own CIP-116-style JSON representation.
+ *
+ * \param[in] value Value to serialize. Must not be NULL.
+ * \param[in] writer JSON writer that receives the encoded value. Must not be NULL.
+ *
+ * \return CARDANO_SUCCESS on success, CARDANO_ERROR_POINTER_IS_NULL for a NULL argument,
+ *         or the error returned by a child serializer.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_set_to_cip116_json(const cardano_sub_transaction_set_t* value, cardano_json_writer_t* writer);
+
+/**
+ * \brief Creates and initializes a new instance of a sub_transaction_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_sub_transaction_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] sub_transaction_set On successful initialization, this will point to a newly created
+ *             \ref cardano_sub_transaction_set_t object. This object represents a "strong reference"
+ *             to the sub_transaction_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the sub_transaction_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_sub_transaction_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the sub_transaction_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_set_t* sub_transaction_set = NULL;
+ *
+ * // Attempt to create a new sub_transaction_set
+ * cardano_error_t result = cardano_sub_transaction_set_new(&sub_transaction_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the sub_transaction_set
+ *
+ *   // Once done, ensure to clean up and release the sub_transaction_set
+ *   cardano_sub_transaction_set_unref(&sub_transaction_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_set_new(cardano_sub_transaction_set_t** sub_transaction_set);
+
+/**
+ * \brief Creates a sub transaction set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_sub_transaction_set_t object.
+ * The set accepts both wire forms, with or without the set tag (258): an array of sub transactions. An empty set is a decoding error,
+ * as are two sub transactions with the same id (the blake2b-256 hash of the sub transaction body).
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded sub transaction set data.
+ * \param[out] sub_transaction_set A pointer to a pointer of \ref cardano_sub_transaction_set_t that will be set to the address
+ *                        of the newly created sub_transaction_set object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the sub_transaction_set was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_sub_transaction_set_t object by calling
+ *       \ref cardano_sub_transaction_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_sub_transaction_set_t* sub_transaction_set = NULL;
+ *
+ * cardano_error_t result = cardano_sub_transaction_set_from_cbor(reader, &sub_transaction_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the sub_transaction_set
+ *
+ *   // Once done, ensure to clean up and release the sub_transaction_set
+ *   cardano_sub_transaction_set_unref(&sub_transaction_set);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode sub_transaction_set: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_set_from_cbor(cardano_cbor_reader_t* reader, cardano_sub_transaction_set_t** sub_transaction_set);
+
+/**
+ * \brief Serializes a sub transaction set into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_sub_transaction_set_t object using a \ref cardano_cbor_writer_t.
+ * The set is written as an array of sub transactions in insertion order. The array is wrapped in CBOR tag 258
+ * unless the set was decoded from an untagged array, in which case the untagged form is preserved so that the
+ * set round-trips byte-exactly.
+ *
+ * \param[in] sub_transaction_set A constant pointer to the \ref cardano_sub_transaction_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p sub_transaction_set or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_set_t* sub_transaction_set = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_sub_transaction_set_to_cbor(sub_transaction_set, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_sub_transaction_set_unref(&sub_transaction_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_transaction_set_to_cbor(
+  const cardano_sub_transaction_set_t* sub_transaction_set,
+  cardano_cbor_writer_t*               writer);
+
+/**
+ * \brief Retrieves the length of a sub transaction set.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_sub_transaction_set_t object.
+ *
+ * \param[in] sub_transaction_set A constant pointer to the \ref cardano_sub_transaction_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the sub_transaction_set. Return 0 if the sub_transaction_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_set_t* sub_transaction_set = NULL;
+ * cardano_error_t result = cardano_sub_transaction_set_new(&sub_transaction_set);
+ *
+ * // Populate sub_transaction_set with elements
+ *
+ * size_t length = cardano_sub_transaction_set_get_length(sub_transaction_set);
+ * printf("Length of the sub_transaction_set: %zu\n", length);
+ *
+ * // Clean up the sub_transaction_set object once done
+ * cardano_sub_transaction_set_unref(&sub_transaction_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_sub_transaction_set_get_length(const cardano_sub_transaction_set_t* sub_transaction_set);
+
+/**
+ * \brief Retrieves an element from a sub transaction set by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_sub_transaction_set_t object
+ * and stores it in the output parameter. Elements keep the order in which they were decoded or added.
+ *
+ * \param[in] sub_transaction_set A constant pointer to the \ref cardano_sub_transaction_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the sub transaction set. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_sub_transaction_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_sub_transaction_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_set_t* sub_transaction_set = NULL;
+ * cardano_error_t result = cardano_sub_transaction_set_new(&sub_transaction_set);
+ *
+ * // Populate sub_transaction_set with elements
+ *
+ * cardano_sub_transaction_t* element = NULL;
+ * result = cardano_sub_transaction_set_get(sub_transaction_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_sub_transaction_unref(&element);
+ * }
+ *
+ * // Clean up the sub_transaction_set object once done
+ * cardano_sub_transaction_set_unref(&sub_transaction_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_transaction_set_get(const cardano_sub_transaction_set_t* sub_transaction_set, size_t index, cardano_sub_transaction_t** element);
+
+/**
+ * \brief Adds an element to a sub transaction set.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_sub_transaction_set_t object.
+ * Insertion order is preserved. Two sub transactions with the same id (the blake2b-256 hash of the sub
+ * transaction body) are rejected.
+ *
+ * \param[in] sub_transaction_set A constant pointer to the \ref cardano_sub_transaction_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_sub_transaction_t object that is to be added to the sub_transaction_set.
+ *                    The element will be referenced by the sub_transaction_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the sub_transaction_set,
+ *         \ref CARDANO_ERROR_DUPLICATED_KEY if a sub transaction with the same id is already present in the set,
+ *         or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_set_t* sub_transaction_set = NULL;
+ * cardano_error_t result = cardano_sub_transaction_set_new(&sub_transaction_set);
+ *
+ * // Create and initialize a new sub transaction element
+ * cardano_sub_transaction_t* element = { ... };
+ *
+ * // Add the element to the sub_transaction_set
+ * result = cardano_sub_transaction_set_add(sub_transaction_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the sub_transaction_set object once done
+ * cardano_sub_transaction_set_unref(&sub_transaction_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_transaction_set_add(cardano_sub_transaction_set_t* sub_transaction_set, cardano_sub_transaction_t* element);
+
+/**
+ * \brief Finds a sub transaction in the set by its id.
+ *
+ * This function searches the provided \ref cardano_sub_transaction_set_t object for the sub transaction whose
+ * id (the blake2b-256 hash of the sub transaction body) equals the given hash. The ids are never part of the
+ * wire encoding; they are derived from the sub transaction bodies.
+ *
+ * \param[in] sub_transaction_set A constant pointer to the \ref cardano_sub_transaction_set_t object to be searched.
+ * \param[in] id A constant pointer to the \ref cardano_blake2b_hash_t object with the sub transaction id to look up.
+ * \param[out] element Pointer to a variable where the found element will be stored.
+ *                     This variable will point to the found \ref cardano_sub_transaction_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_sub_transaction_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if a sub transaction with the given id was found,
+ *         \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if no sub transaction in the set has the given id,
+ *         or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_set_t* sub_transaction_set = ...; // Assume sub_transaction_set is already initialized
+ * cardano_blake2b_hash_t* id = ...; // Assume id is already initialized
+ *
+ * cardano_sub_transaction_t* element = NULL;
+ * cardano_error_t result = cardano_sub_transaction_set_find_by_id(sub_transaction_set, id, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the found sub transaction
+ *   cardano_sub_transaction_unref(&element);
+ * }
+ * else if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+ * {
+ *   printf("No sub transaction with the given id.\n");
+ * }
+ *
+ * // Clean up the sub_transaction_set object once done
+ * cardano_sub_transaction_set_unref(&sub_transaction_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_transaction_set_find_by_id(
+  const cardano_sub_transaction_set_t* sub_transaction_set,
+  const cardano_blake2b_hash_t*        id,
+  cardano_sub_transaction_t**          element);
+
+/**
+ * \brief Determines if the sub transaction set uses tags in its encoding.
+ *
+ * This function checks whether the given \ref cardano_sub_transaction_set_t object
+ * uses the Conway era encoding for sets, which are collections identified by a tag.
+ *
+ * \param[in] sub_transaction_set A pointer to an initialized \ref cardano_sub_transaction_set_t object.
+ *
+ * \return A boolean value:
+ *         - \c true if the sub transaction set uses the Conway era encoding for sets (tagged sets).
+ *         - \c false if the sub transaction set uses the older encoding (arrays without tags).
+ *
+ * \note This function helps in determining the serialization format of the sub transaction set,
+ *       which may be necessary for compatibility with other transaction encoders/decoders.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_set_t* sub_transaction_set = ...; // Assume sub_transaction_set is already initialized
+ * bool is_tagged_set = cardano_sub_transaction_set_is_tagged(sub_transaction_set);
+ *
+ * if (is_tagged_set)
+ * {
+ *   printf("The sub transaction set uses Conway era tag for sets.\n");
+ * }
+ * else
+ * {
+ *   printf("The sub transaction set uses pre-Conway era encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_sub_transaction_set_is_tagged(const cardano_sub_transaction_set_t* sub_transaction_set);
+
+/**
+ * \brief Enables or disables tagged encoding (Conway era feature) for the sub transaction set.
+ *
+ * This function sets whether the specified \ref cardano_sub_transaction_set_t object should use tagged encoding
+ * (introduced in the Conway era) when serializing the set in CBOR. If \p use_tag is set to \c true, the set will be
+ * encoded using tagged sets. Otherwise, it will use the older array-based encoding method.
+ *
+ * \param[in,out] sub_transaction_set A pointer to an initialized \ref cardano_sub_transaction_set_t object.
+ * \param[in] use_tag A boolean value that determines whether to use tagged encoding (\c true) or legacy array encoding (\c false).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_set_t* sub_transaction_set = ...; // Assume sub_transaction_set is already initialized
+ * cardano_error_t result = cardano_sub_transaction_set_set_use_tag(sub_transaction_set, true);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The sub transaction set is now set to use tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set tagged encoding: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_transaction_set_set_use_tag(cardano_sub_transaction_set_t* sub_transaction_set, bool use_tag);
+
+/**
+ * \brief Decrements the reference count of a sub_transaction_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_sub_transaction_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the sub_transaction_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] sub_transaction_set A pointer to the pointer of the sub_transaction_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_set_t* sub_transaction_set = NULL;
+ * cardano_error_t result = cardano_sub_transaction_set_new(&sub_transaction_set);
+ *
+ * // Perform operations with the sub_transaction_set...
+ *
+ * cardano_sub_transaction_set_unref(&sub_transaction_set);
+ * // At this point, sub_transaction_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_sub_transaction_set_unref, the pointer to the \ref cardano_sub_transaction_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_sub_transaction_set_unref(cardano_sub_transaction_set_t** sub_transaction_set);
+
+/**
+ * \brief Increases the reference count of the cardano_sub_transaction_set_t object.
+ *
+ * This function is used to manually increment the reference count of a sub_transaction_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_sub_transaction_set_unref.
+ *
+ * \param sub_transaction_set A pointer to the sub_transaction_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming sub_transaction_set is a previously created sub_transaction_set object
+ *
+ * cardano_sub_transaction_set_ref(sub_transaction_set);
+ *
+ * // Now sub_transaction_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_sub_transaction_set_ref there is a corresponding
+ * call to \ref cardano_sub_transaction_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_sub_transaction_set_ref(cardano_sub_transaction_set_t* sub_transaction_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_sub_transaction_set_t object.
+ *
+ * This function returns the number of active references to a sub_transaction_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_sub_transaction_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param sub_transaction_set A pointer to the sub_transaction_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified sub_transaction_set object. If the object
+ * is properly managed (i.e., every \ref cardano_sub_transaction_set_ref call is matched with a
+ * \ref cardano_sub_transaction_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming sub_transaction_set is a previously created sub_transaction_set object
+ *
+ * size_t ref_count = cardano_sub_transaction_set_refcount(sub_transaction_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_sub_transaction_set_refcount(const cardano_sub_transaction_set_t* sub_transaction_set);
+
+/**
+ * \brief Sets the last error message for a given sub_transaction_set object.
+ *
+ * Records an error message in the sub_transaction_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] sub_transaction_set A pointer to the \ref cardano_sub_transaction_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the sub_transaction_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_sub_transaction_set_set_last_error(cardano_sub_transaction_set_t* sub_transaction_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific sub_transaction_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_sub_transaction_set_set_last_error for the given
+ * sub_transaction_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] sub_transaction_set A pointer to the \ref cardano_sub_transaction_set_t instance whose last error
+ *                   message is to be retrieved. If the sub_transaction_set is NULL, the function
+ *                   returns a generic error message indicating the null sub_transaction_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified sub_transaction_set. If the sub_transaction_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_sub_transaction_set_set_last_error for the same sub_transaction_set, or until
+ *       the sub_transaction_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_sub_transaction_set_get_last_error(const cardano_sub_transaction_set_t* sub_transaction_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_sub_transaction_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_sub_transaction_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_sub_transaction_set_deep_clone(const cardano_sub_transaction_set_t* source, cardano_sub_transaction_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_SET_H
diff --git a/vendor/include/cardano/transaction_body/transaction_body.h b/vendor/include/cardano/transaction_body/transaction_body.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/transaction_body.h
@@ -0,0 +1,2463 @@
+/**
+ * \file transaction_body.h
+ *
+ * \author angel.castillo
+ * \date   Sep 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BODY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BODY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/multi_asset.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/certs/certificate_set.h>
+#include <cardano/common/guard_set.h>
+#include <cardano/common/network_id.h>
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/blake2b_hash_set.h>
+#include <cardano/error.h>
+#include <cardano/proposal_procedures/proposal_procedure_set.h>
+#include <cardano/protocol_params/update.h>
+#include <cardano/transaction_body/account_balance_intervals_map.h>
+#include <cardano/transaction_body/direct_deposit_map.h>
+#include <cardano/transaction_body/required_guards_map.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+#include <cardano/transaction_body/transaction_input.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+#include <cardano/transaction_body/transaction_output.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+#include <cardano/typedefs.h>
+#include <cardano/voting_procedures/voting_procedures.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The transaction body encapsulates the core details of a transaction.
+ */
+typedef struct cardano_transaction_body_t cardano_transaction_body_t;
+
+/**
+ * \brief Creates and initializes a new instance of a Cardano transaction body.
+ *
+ * This function allocates and initializes a new \ref cardano_transaction_body_t object.
+ *
+ * \param[in] inputs A pointer to an initialized \ref cardano_transaction_input_set_t object
+ *                   representing the set of transaction inputs. This parameter must not be NULL.
+ * \param[in] outputs A pointer to an initialized \ref cardano_transaction_output_list_t object
+ *                    representing the list of transaction outputs. This parameter must not be NULL.
+ * \param[in] fee The transaction fee, specified in lovelaces (1 ADA = 1,000,000 lovelaces).
+ * \param[in] ttl An optional pointer to a uint64_t representing the time-to-live (TTL) parameter, specified as a slot number.
+ *                The transaction will be invalid if not included in a block by the time this slot is reached.
+ *                If no TTL is required, this pointer can be set to NULL.
+ * \param[out] transaction_body On successful initialization, this will point to a newly created
+ *             \ref cardano_transaction_body_t object. This object represents a "strong reference"
+ *             to the transaction body, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object. Specifically,
+ *             once the transaction body is no longer needed, the caller must release it by calling
+ *             \ref cardano_transaction_body_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the transaction body was successfully created, or an appropriate error code indicating
+ *         the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the required input pointers (inputs, outputs) are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_set_t* inputs = ...;  // Assume inputs are initialized
+ * cardano_transaction_output_list_t* outputs = ...;  // Assume outputs are initialized
+ * uint64_t fee = 200000;  // 0.2 ADA transaction fee
+ * uint64_t ttl_value = 100000;  // Optional TTL for the transaction
+ * cardano_transaction_body_t* transaction_body = NULL;
+ *
+ * // Pass the TTL as a pointer
+ * cardano_error_t result = cardano_transaction_body_new(inputs, outputs, fee, &ttl_value, &transaction_body);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction body
+ *
+ *   // Free resources when done
+ *   cardano_transaction_body_unref(&transaction_body);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the transaction body: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // If no TTL is required, set the ttl pointer to NULL
+ * cardano_error_t no_ttl_result = cardano_transaction_body_new(inputs, outputs, fee, NULL, &transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_new(
+  cardano_transaction_input_set_t*   inputs,
+  cardano_transaction_output_list_t* outputs,
+  uint64_t                           fee,
+  const uint64_t*                    ttl,
+  cardano_transaction_body_t**       transaction_body);
+
+/**
+ * \brief Creates a \ref cardano_transaction_body_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_transaction_body_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a transaction body.
+ *
+ * Keys 0 (inputs), 1 (outputs) and 2 (fee) are required; decoding fails with \ref CARDANO_ERROR_DECODING if any of
+ * them is absent. An empty outputs list under key 1 is accepted.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] transaction_body A pointer to a pointer of \ref cardano_transaction_body_t that will be set to the address
+ *                        of the newly created transaction body object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the transaction body was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, transactions are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical transaction representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the transaction body hash and invalidate any existing signatures.
+ *         To prevent this, when a transaction body object is created using \ref cardano_transaction_body_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_transaction_body_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_transaction_body_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_transaction_body_t object by calling
+ *       \ref cardano_transaction_body_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_transaction_body_t* transaction_body = NULL;
+ *
+ * cardano_error_t result = cardano_transaction_body_from_cbor(reader, &transaction_body);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction_body
+ *
+ *   // Once done, ensure to clean up and release the transaction_body
+ *   cardano_transaction_body_unref(&transaction_body);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode transaction_body: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_body_t** transaction_body);
+
+/**
+ * \brief Serializes a transaction body into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_transaction_body_t object using a \ref cardano_cbor_writer_t.
+ * If the transaction body was created by \ref cardano_transaction_body_from_cbor, the function will use the cached CBOR representation
+ * to maintain the original encoding. This avoids potential differences in CBOR encoding which could invalidate signatures.
+ * If no cached CBOR is available, the function will serialize the transaction following the Cardano serialization format as outlined in
+ * [CIP-21](https://cips.cardano.org/cip/CIP-21).
+ *
+ * \param[in] transaction_body A constant pointer to the \ref cardano_transaction_body_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p transaction_body or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark If the transaction body object was created by \ref cardano_transaction_body_from_cbor, the original CBOR encoding
+ *         will be cached and reused by this function to prevent round-trip encoding issues that can change the transaction body hash
+ *         and invalidate signatures. If the cached CBOR is not available or has been cleared, the function will serialize the transaction
+ *         body in accordance with [CIP-21](https://cips.cardano.org/cip/CIP-21).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_transaction_body_to_cbor(transaction_body, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_body_to_cbor(
+  const cardano_transaction_body_t* transaction_body,
+  cardano_cbor_writer_t*            writer);
+
+/**
+ * \brief Serializes a transaction body to CIP-116 JSON format.
+ *
+ * This function takes a Cardano transaction body structure and converts all its
+ * components (inputs, outputs, fees, optional fields like collateral, mint, and governance data)
+ * into a single JSON object using CIP-116 conventions and the Dijkstra guard representation.
+ *
+ * The \c guards field lists every guard as a credential tagged pubkey_hash or script_hash.
+ * It is omitted when the guards set is absent or empty. This representation is used for both
+ * Conway key-only guards and Dijkstra guards; the legacy required_signers JSON field is not emitted.
+ *
+ * Dijkstra fields include sub_transactions, required_top_level_guards, direct_deposits,
+ * account_balance_intervals and starting_account_balance_intervals. Nested transactions retain
+ * their own witnesses and auxiliary data. Maps use arrays of key/value objects and lovelace
+ * amounts use decimal strings. Balance intervals use tagged exact/range objects with null
+ * bounds when unbounded.
+ *
+ * \param[in]  body    Pointer to the valid \ref cardano_transaction_body_t object to be serialized.
+ * \param[in]  writer  Pointer to the active \ref cardano_json_writer_t instance where the JSON output will be written.
+ *
+ * \return CARDANO_SUCCESS                        On successful serialization.
+ * \return CARDANO_ERROR_POINTER_IS_NULL          If \p body or \p writer is NULL.
+ * \return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation for internal hex strings fails.
+ * \return Other                                  Any error propagated from recursive serialization calls (e.g., \ref cardano_transaction_input_set_to_cip116_json).
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_body_to_cip116_json(
+  const cardano_transaction_body_t* body,
+  cardano_json_writer_t*            writer);
+
+/**
+ * \brief Retrieves the set of transaction inputs from a transaction body.
+ *
+ * This function returns the set of transaction inputs associated with a given \ref cardano_transaction_body_t object.
+ * These inputs represent the UTXOs (Unspent Transaction Outputs) being used as inputs in the transaction.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_transaction_input_set_t object representing the set of transaction inputs.
+ *         The returned object is a new reference, and the caller is responsible for managing its lifecycle.
+ *         Specifically, the caller must release it by calling \ref cardano_transaction_input_set_unref when it is no longer needed.
+ *         If the \p transaction_body is NULL, the function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_transaction_input_set_t* inputs = cardano_transaction_body_get_inputs(transaction_body);
+ *
+ * if (inputs != NULL)
+ * {
+ *   // Process the inputs
+ *   cardano_transaction_input_set_unref(&inputs); // Ensure to release the inputs when done
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve transaction inputs or transaction body is NULL.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_input_set_t* cardano_transaction_body_get_inputs(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the transaction inputs for a transaction body.
+ *
+ * This function assigns a set of transaction inputs to a \ref cardano_transaction_body_t object. The inputs represent
+ * the UTXOs (Unspent Transaction Outputs) that will be used as inputs for the transaction.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ * \param[in] inputs A pointer to an initialized \ref cardano_transaction_input_set_t object representing the inputs to be set.
+ *                   This parameter must not be NULL.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the inputs were successfully set.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if either the \p transaction_body or \p inputs is NULL.
+ *
+ * \note This function increases the reference count of the \p inputs object; the caller retains ownership of the inputs
+ *       and must release their reference to the inputs when no longer needed by calling \ref cardano_transaction_input_set_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_transaction_input_set_t* inputs = ...; // Assume inputs is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_inputs(transaction_body, inputs);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Transaction inputs successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set transaction inputs: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources when no longer needed
+ * cardano_transaction_input_set_unref(&inputs);
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_inputs(cardano_transaction_body_t* transaction_body, cardano_transaction_input_set_t* inputs);
+
+/**
+ * \brief Retrieves the list of outputs from a transaction body.
+ *
+ * This function returns the list of outputs associated with a given \ref cardano_transaction_body_t object. The outputs represent
+ * the recipients and amounts being transferred as part of the transaction.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_transaction_output_list_t object representing the list of transaction outputs. If the
+ *         \p transaction_body is NULL or there are no outputs, this function returns NULL.
+ *         The caller is responsible for managing the lifecycle of the returned list by calling
+ *         \ref cardano_transaction_output_list_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(transaction_body);
+ *
+ * if (outputs != NULL)
+ * {
+ *   // Use the outputs list
+ *   // Clean up resources when no longer needed
+ *   cardano_transaction_output_list_unref(&outputs);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve transaction outputs or no outputs exist.\n");
+ * }
+ *
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_output_list_t* cardano_transaction_body_get_outputs(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the list of outputs for a transaction body.
+ *
+ * This function assigns a new list of outputs to the specified \ref cardano_transaction_body_t object. The outputs represent
+ * the recipients and amounts that are being transferred in the transaction.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object where the outputs will be set.
+ * \param[in] outputs A pointer to an initialized \ref cardano_transaction_output_list_t object representing the list of transaction outputs.
+ *                    This value must not be NULL, and it will replace any existing outputs in the \p transaction_body.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the outputs were
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * \note This function increases the reference count of the \p outputs object, so the caller retains ownership of their respective references.
+ *       It is the caller's responsibility to release their reference to the outputs when they are no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_transaction_output_list_t* outputs = ...; // Assume outputs are initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_outputs(transaction_body, outputs);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Transaction outputs successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set transaction outputs.\n");
+ * }
+ *
+ * // Clean up resources when no longer needed
+ * cardano_transaction_body_unref(&transaction_body);
+ * cardano_transaction_output_list_unref(&outputs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_outputs(cardano_transaction_body_t* transaction_body, cardano_transaction_output_list_t* outputs);
+
+/**
+ * \brief Retrieves the fee associated with the transaction body.
+ *
+ * This function returns the fee specified in the \ref cardano_transaction_body_t object. The fee represents
+ * the amount of lovelace (Cardano's native cryptocurrency) required to process the transaction.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *                             This value must not be NULL.
+ *
+ * \return The fee amount in lovelaces. If the \p transaction_body pointer is NULL, the function will return 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * uint64_t fee = cardano_transaction_body_get_fee(transaction_body);
+ *
+ * if (fee > 0)
+ * {
+ *   printf("Transaction fee: %llu lovelaces\n", fee);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve transaction fee.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_transaction_body_get_fee(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the fee for the transaction body.
+ *
+ * This function assigns a fee to the \ref cardano_transaction_body_t object. The fee represents the amount of lovelace
+ * (Cardano's native cryptocurrency) required to process the transaction.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object where the fee will be set.
+ * \param[in] fee The fee amount in lovelaces to be assigned to the transaction.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the fee
+ *         was successfully set, or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         \p transaction_body pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * uint64_t fee = 200000; // Setting a fee of 200,000 lovelaces
+ *
+ * cardano_error_t result = cardano_transaction_body_set_fee(transaction_body, fee);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Transaction fee set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set transaction fee: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_fee(cardano_transaction_body_t* transaction_body, uint64_t fee);
+
+/**
+ * \brief Retrieves the "invalid after" value from the transaction body.
+ *
+ * This function fetches the "invalid after" field from a \ref cardano_transaction_body_t object, representing
+ * the slot number after which the transaction is considered invalid. This field is optional, and the function
+ * will return a pointer to a `uint64_t` if the field is set, or `NULL` if it is not.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \c uint64_t representing the "invalid after" slot number if set. If this field is not set,
+ *         the function will return `NULL`. The returned pointer is managed internally and must not be freed by the caller.
+ *         The caller can use the pointer to read the value but not modify or free it.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume initialized
+ * const uint64_t* invalid_after = cardano_transaction_body_get_invalid_after(transaction_body);
+ *
+ * if (invalid_after != NULL)
+ * {
+ *   printf("Transaction is invalid after slot: %llu\n", *invalid_after);
+ * }
+ * else
+ * {
+ *   printf("No invalid_after field is set for this transaction.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_transaction_body_get_invalid_after(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the "invalid after" field in the transaction body.
+ *
+ * This function assigns a value to the "invalid after" field of a \ref cardano_transaction_body_t object, specifying
+ * the slot number after which the transaction becomes invalid. The "invalid after" field is optional, and passing a
+ * `NULL` pointer will unset the value, effectively removing the "invalid after" field from the transaction.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object where the field will be set.
+ * \param[in] epoch A constant pointer to a \c uint64_t representing the "invalid after" slot number. If `NULL`, this will unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the field was successfully set or unset,
+ *         or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if \p transaction_body is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume initialized
+ * uint64_t epoch = 123456; // Slot number
+ *
+ * cardano_error_t result = cardano_transaction_body_set_invalid_after(transaction_body, &epoch);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Invalid after field set to slot: %llu\n", epoch);
+ * }
+ * else
+ * {
+ *   printf("Failed to set invalid after: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // To unset the invalid after field:
+ * result = cardano_transaction_body_set_invalid_after(transaction_body, NULL);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_invalid_after(cardano_transaction_body_t* transaction_body, const uint64_t* epoch);
+
+/**
+ * \brief Retrieves the set of certificates associated with the transaction body.
+ *
+ * This function returns the certificates from a \ref cardano_transaction_body_t object, if they are present.
+ * Certificates in Cardano are used for various purposes, such as stake delegation and pool registration.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_certificate_set_t object representing the set of certificates. If the transaction body
+ *         does not contain any certificates, the function returns `NULL`. If a valid certificate set is returned, it is a new
+ *         reference, and the caller is responsible for managing its lifecycle. The caller must release the certificate set
+ *         using \ref cardano_certificate_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_certificate_set_t* certificates = cardano_transaction_body_get_certificates(transaction_body);
+ *
+ * if (certificates != NULL)
+ * {
+ *   // Process the certificates
+ *
+ *   // Once done, ensure to clean up and release the certificate set
+ *   cardano_certificate_set_unref(&certificates);
+ * }
+ * else
+ * {
+ *   printf("No certificates present in the transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_certificate_set_t* cardano_transaction_body_get_certificates(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the certificates for the transaction body.
+ *
+ * This function assigns a set of certificates to a \ref cardano_transaction_body_t object. Certificates in Cardano are used
+ * for various purposes such as stake delegation, pool registration, and other governance actions.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ * \param[in] certificates A pointer to an initialized \ref cardano_certificate_set_t object representing the certificates to
+ *                         be assigned to the transaction body. The certificates must be properly initialized and cannot be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificates were
+ *         successfully set, or an appropriate error code such as \ref CARDANO_ERROR_POINTER_IS_NULL if either \p transaction_body or
+ *         \p certificates is NULL.
+ *
+ * \note The function increases the reference count of the \p certificates object. The caller retains ownership of the certificate
+ *       set and is responsible for releasing it when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume initialized
+ * cardano_certificate_set_t* certificates = ...; // Assume certificates are initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_certificates(transaction_body, certificates);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Certificates were successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set certificates: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up certificates and transaction_body when done
+ * cardano_certificate_set_unref(&certificates);
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_certificates(cardano_transaction_body_t* transaction_body, cardano_certificate_set_t* certificates);
+
+/**
+ * \brief Retrieves the withdrawals from a transaction body.
+ *
+ * This function fetches the withdrawals specified in the given \ref cardano_transaction_body_t object.
+ * Withdrawals allow the transaction to withdraw rewards from staking addresses.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_withdrawal_map_t object representing the withdrawals in the transaction body.
+ *         If the transaction body does not contain any withdrawals, the function returns NULL.
+ *         The returned \ref cardano_withdrawal_map_t object is a new reference, and the caller is responsible
+ *         for managing its lifecycle by calling \ref cardano_withdrawal_map_unref when it is no longer needed.
+ *
+ * \note If the returned value is NULL, it indicates that there are no withdrawals set in the transaction body.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_withdrawal_map_t* withdrawals = cardano_transaction_body_get_withdrawals(transaction_body);
+ *
+ * if (withdrawals != NULL)
+ * {
+ *   // Process the withdrawals
+ *
+ *   // Once done, ensure to release the withdrawals
+ *   cardano_withdrawal_map_unref(&withdrawals);
+ * }
+ * else
+ * {
+ *   printf("No withdrawals present in the transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_withdrawal_map_t* cardano_transaction_body_get_withdrawals(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets or unsets the withdrawals in the transaction body.
+ *
+ * This function assigns a map of withdrawals to a \ref cardano_transaction_body_t object. Withdrawals in Cardano represent
+ * the withdrawal of rewards from a stake address.
+ *
+ * If \p withdrawals is NULL, this function will unset any previously assigned withdrawals from the transaction body.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ * \param[in] withdrawals A pointer to an initialized \ref cardano_withdrawal_map_t object representing the withdrawals to
+ *                        be assigned to the transaction body, or NULL to unset any previously set withdrawals.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the withdrawals were
+ *         successfully set or unset, or an appropriate error code such as \ref CARDANO_ERROR_POINTER_IS_NULL if \p transaction_body is NULL.
+ *
+ * \note If \p withdrawals is non-NULL, the function increases the reference count of the \p withdrawals object. The caller retains
+ *       ownership of the withdrawal map and is responsible for releasing it when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume initialized
+ * cardano_withdrawal_map_t* withdrawals = ...; // Assume withdrawals are initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_withdrawals(transaction_body, withdrawals);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Withdrawals were successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set withdrawals: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Unset the withdrawals by passing NULL
+ * result = cardano_transaction_body_set_withdrawals(transaction_body, NULL);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Withdrawals were successfully unset.\n");
+ * }
+ *
+ * // Clean up withdrawals and transaction_body when done
+ * cardano_withdrawal_map_unref(&withdrawals);
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_withdrawals(cardano_transaction_body_t* transaction_body, cardano_withdrawal_map_t* withdrawals);
+
+/**
+ * \brief Retrieves the update field from a transaction body.
+ *
+ * This function fetches the update information, if any, from a given \ref cardano_transaction_body_t object.
+ * Updates are used in Cardano transactions to propose changes to the protocol parameters.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_update_t object representing the update field of the transaction body.
+ *         If the update field is not set, the function returns NULL. If a valid \ref cardano_update_t object
+ *         is returned, it is a new reference, and the caller is responsible for managing its lifecycle.
+ *         The returned \ref cardano_update_t object must be released by calling \ref cardano_update_unref when
+ *         it is no longer needed.
+ *
+ * \note The returned pointer may be NULL if no update is set in the transaction body.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_update_t* update = cardano_transaction_body_get_update(transaction_body);
+ *
+ * if (update != NULL)
+ * {
+ *   // Use the update object
+ *
+ *   // Clean up when done
+ *   cardano_update_unref(&update);
+ * }
+ * else
+ * {
+ *   printf("No update is set in this transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_update_t* cardano_transaction_body_get_update(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the update field in a transaction body.
+ *
+ * This function assigns an update to a \ref cardano_transaction_body_t object. Updates in a Cardano transaction
+ * can include protocol parameter changes.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object where the update will be set.
+ * \param[in] update A pointer to an initialized \ref cardano_update_t object representing the update to be added to the transaction body.
+ *                   This parameter can be NULL, in which case the update field will be unset (cleared).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the update was
+ *         successfully set, or an appropriate error code if an error occurred (e.g., \ref CARDANO_ERROR_POINTER_IS_NULL if the transaction body pointer is NULL).
+ *
+ * \note If a valid update object is provided, its reference count will be incremented. The caller retains ownership of their
+ *       reference to the update object and is responsible for managing its lifecycle (e.g., by calling \ref cardano_update_unref
+ *       when the update is no longer needed).
+ * \note If `update` is NULL, the current update field in the transaction body will be removed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_update_t* update = cardano_update_new(...); // Assume update is already initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_update(transaction_body, update);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Update successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the update: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up when done
+ * cardano_update_unref(&update);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_update(cardano_transaction_body_t* transaction_body, cardano_update_t* update);
+
+/**
+ * \brief Retrieves the auxiliary data hash from a transaction body.
+ *
+ * This function fetches the auxiliary data hash associated with the given \ref cardano_transaction_body_t object.
+ * The auxiliary data hash represents the hash of additional metadata included with the transaction.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object from which the auxiliary data hash will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_blake2b_hash_t object representing the auxiliary data hash. If the auxiliary data hash is not set, or if the input is NULL,
+ *         this function returns NULL. The returned object is a new reference, and the caller is responsible for releasing it by calling \ref cardano_blake2b_hash_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_blake2b_hash_t* aux_data_hash = cardano_transaction_body_get_aux_data_hash(transaction_body);
+ *
+ * if (aux_data_hash != NULL)
+ * {
+ *   // Process the auxiliary data hash
+ *   cardano_blake2b_hash_unref(&aux_data_hash); // Clean up when done
+ * }
+ * else
+ * {
+ *   printf("No auxiliary data hash found or transaction_body is NULL.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_transaction_body_get_aux_data_hash(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the auxiliary data hash for a transaction body.
+ *
+ * This function assigns a new auxiliary data hash to the given \ref cardano_transaction_body_t object. The auxiliary data hash
+ * is used to reference additional metadata that may be included with the transaction.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object to which the auxiliary data hash will be set.
+ * \param[in] aux_data_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the auxiliary data hash to set.
+ *                          This parameter can be NULL to unset or clear the auxiliary data hash.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the auxiliary data hash was successfully set,
+ *         or an appropriate error code, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the \p transaction_body pointer is NULL.
+ *
+ * \note If a valid auxiliary data hash object is provided, its reference count will be incremented. The caller retains ownership of their
+ *       reference to the update object and is responsible for managing its lifecycle (e.g., by calling \ref cardano_blake2b_hash_unref
+ *       when the auxiliary data hash is no longer needed).
+ * \note If \p aux_data_hash is set to NULL, it will clear the current auxiliary data hash in the transaction body, if any.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_blake2b_hash_t* aux_data_hash = cardano_blake2b_hash_new(...); // Assume aux_data_hash is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_aux_data_hash(transaction_body, aux_data_hash);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Auxiliary data hash successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set auxiliary data hash.\n");
+ * }
+ *
+ * // Optionally clean up the aux_data_hash when no longer needed
+ * cardano_blake2b_hash_unref(&aux_data_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_aux_data_hash(cardano_transaction_body_t* transaction_body, cardano_blake2b_hash_t* aux_data_hash);
+
+/**
+ * \brief Retrieves the "invalid before" field from a transaction body.
+ *
+ * This function retrieves the "invalid before" field from a given \ref cardano_transaction_body_t object.
+ * The "invalid before" field specifies the earliest slot in which the transaction is valid. If this field
+ * is not set, the function will return NULL.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \c uint64_t representing the "invalid before" field. If the field is set, it returns a pointer
+ *         to the value. If the field is not set, the function returns NULL.
+ *         The returned pointer points to internally managed memory and must not be freed or modified by the caller.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * const uint64_t* invalid_before = cardano_transaction_body_get_invalid_before(transaction_body);
+ *
+ * if (invalid_before != NULL)
+ * {
+ *   printf("Transaction invalid before slot: %llu\n", *invalid_before);
+ * }
+ * else
+ * {
+ *   printf("Invalid before field not set.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_transaction_body_get_invalid_before(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the "invalid before" field in a transaction body.
+ *
+ * This function sets the "invalid before" field in a given \ref cardano_transaction_body_t object.
+ * The "invalid before" field specifies the earliest slot in which the transaction is valid.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ * \param[in] epoch A pointer to a \c uint64_t representing the "invalid before" field. This specifies
+ *                  the earliest slot at which the transaction is valid. If this parameter is NULL, the "invalid before" field
+ *                  will be unset (i.e., removed from the transaction body).
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         "invalid before" field was successfully set or unset, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the transaction body pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * uint64_t invalid_before_slot = 500000; // Set the transaction to be valid after slot 500000
+ *
+ * cardano_error_t result = cardano_transaction_body_set_invalid_before(transaction_body, &invalid_before_slot);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Successfully set the invalid before field.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the invalid before field.\n");
+ * }
+ * \endcode
+ *
+ * // Unsetting the invalid before field:
+ * \code{.c}
+ * result = cardano_transaction_body_set_invalid_before(transaction_body, NULL);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Successfully unset the invalid before field.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to unset the invalid before field.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_invalid_before(cardano_transaction_body_t* transaction_body, const uint64_t* epoch);
+
+/**
+ * \brief Retrieves the mint field from a transaction body.
+ *
+ * This function retrieves the minting assets contained in the mint field of the given \ref cardano_transaction_body_t object.
+ * The mint field specifies the assets to be minted or burned in the transaction.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a newly created \ref cardano_multi_asset_t object representing the minting/burning assets.
+ *         If the mint field is not set, this function will return NULL.
+ *         The caller is responsible for managing the lifecycle of the returned object, and must release it by calling \ref cardano_multi_asset_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_multi_asset_t* mint_assets = cardano_transaction_body_get_mint(transaction_body);
+ *
+ * if (mint_assets != NULL)
+ * {
+ *   // Use the mint assets
+ *
+ *   // Once done, release the mint assets
+ *   cardano_multi_asset_unref(&mint_assets);
+ * }
+ * else
+ * {
+ *   printf("No mint field set in this transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_multi_asset_t* cardano_transaction_body_get_mint(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the mint field for a transaction body.
+ *
+ * This function assigns the minting assets to the mint field of the specified \ref cardano_transaction_body_t object.
+ * The mint field specifies the assets to be minted or burned in the transaction.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object to which the mint field will be set.
+ * \param[in] mint A pointer to an initialized \ref cardano_multi_asset_t object representing the assets to be minted or burned.
+ *                 This parameter can be NULL if the mint field should be unset (i.e., no assets to mint or burn).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the mint field
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the transaction_body pointer is NULL.
+ *
+ * \note This function increases the reference count of the mint object, if provided. The caller retains ownership of the provided
+ *       mint object and must release it when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_multi_asset_t* mint_assets = ...; // Assume mint_assets is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_mint(transaction_body, mint_assets);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Mint field set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set mint field: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources when no longer needed
+ * cardano_multi_asset_unref(&mint_assets);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_mint(cardano_transaction_body_t* transaction_body, cardano_multi_asset_t* mint);
+
+/**
+ * \brief Retrieves the script data hash from a transaction body.
+ *
+ * This function extracts the script data hash from a given \ref cardano_transaction_body_t object.
+ * The script data hash is used in Cardano's Plutus transactions to ensure the integrity of script data (datums and redeemers).
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *                             This pointer must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_blake2b_hash_t object representing the script data hash.
+ *         If the script data hash is not set for the transaction body, the function returns NULL.
+ *         The returned script data hash is a new reference, and the caller is responsible for releasing it
+ *         with \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *
+ * \note It is important to call \ref cardano_transaction_body_get_script_data_hash only after ensuring the transaction
+ *       body contains a script data hash. If the transaction body does not have this field set, the function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_blake2b_hash_t* script_data_hash = cardano_transaction_body_get_script_data_hash(transaction_body);
+ *
+ * if (script_data_hash != NULL)
+ * {
+ *   // Process the script data hash
+ *   cardano_blake2b_hash_unref(&script_data_hash);
+ * }
+ * else
+ * {
+ *   printf("No script data hash set for this transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_transaction_body_get_script_data_hash(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the script data hash for a transaction body.
+ *
+ * This function assigns a script data hash to a given \ref cardano_transaction_body_t object. The script data hash
+ * is used in Cardano's Plutus transactions to ensure the integrity of the script data (datums and redeemers).
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object to which the script data hash will be set.
+ * \param[in] script_data_hash A pointer to an initialized \ref cardano_blake2b_hash_t object representing the new script data hash.
+ *                             This parameter can be NULL if the script data hash is to be unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the script data hash
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the transaction_body pointer is NULL.
+ *
+ * \note If a script data hash was previously set, this function will replace it with the new value.
+ *       If the script data hash is no longer needed, passing a NULL pointer will unset it.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_blake2b_hash_t* script_data_hash = ...; // Assume script_data_hash is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_script_data_hash(transaction_body, script_data_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The script data hash was successfully set for the transaction body
+ * }
+ * else
+ * {
+ *   printf("Failed to set the script data hash.\n");
+ * }
+ *
+ * // Cleanup resources if necessary
+ * cardano_blake2b_hash_unref(&script_data_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_script_data_hash(cardano_transaction_body_t* transaction_body, cardano_blake2b_hash_t* script_data_hash);
+
+/**
+ * \brief Retrieves the collateral inputs from a transaction body.
+ *
+ * This function extracts the set of collateral inputs from a given \ref cardano_transaction_body_t object.
+ * Collateral inputs are used in Plutus transactions to cover the fees if script execution fails.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_transaction_input_set_t object representing the collateral inputs of the transaction.
+ *         If the collateral inputs are not set, this function returns NULL.
+ *         The returned set is a new reference, and the caller is responsible for releasing it with \ref cardano_transaction_input_set_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_transaction_input_set_t* collateral_inputs = cardano_transaction_body_get_collateral(transaction_body);
+ *
+ * if (collateral_inputs != NULL)
+ * {
+ *   // Use the collateral inputs
+ *   cardano_transaction_input_set_unref(&collateral_inputs);
+ * }
+ * else
+ * {
+ *   printf("No collateral inputs set for this transaction.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_input_set_t* cardano_transaction_body_get_collateral(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the collateral inputs for a transaction body.
+ *
+ * This function assigns a set of collateral inputs to a \ref cardano_transaction_body_t object.
+ * Collateral inputs are used in Plutus transactions to cover fees in case script execution fails.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object to which the collateral inputs will be set.
+ * \param[in] collateral A pointer to an initialized \ref cardano_transaction_input_set_t object representing the collateral inputs.
+ *                       This parameter can be NULL to unset the collateral inputs.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the collateral inputs were successfully set,
+ *         or an appropriate error code such as \ref CARDANO_ERROR_POINTER_IS_NULL if the transaction_body pointer is NULL.
+ *
+ * \note If the collateral is set, the reference count of the \p collateral object will be incremented. The caller retains ownership of their references
+ *       and is responsible for releasing their reference when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_transaction_input_set_t* collateral_inputs = ...; // Assume collateral_inputs is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_collateral(transaction_body, collateral_inputs);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Collateral inputs successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set collateral inputs: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up collateral_inputs if needed
+ * cardano_transaction_input_set_unref(&collateral_inputs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_collateral(cardano_transaction_body_t* transaction_body, cardano_transaction_input_set_t* collateral);
+
+/**
+ * \brief Retrieves the set of required signers for a transaction body.
+ *
+ * This function fetches the set of required signers from the given \ref cardano_transaction_body_t object.
+ * Required signers are represented as hashes of public keys and are needed to authorize the transaction.
+ *
+ * The returned set is the legacy view over the guards of the transaction body: it contains the key hash
+ * members of the guards, mirroring how the ledger derives the required signer hashes. Script hash guards
+ * are not part of this view; use \ref cardano_transaction_body_get_guards to access the full credential set.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_blake2b_hash_set_t object representing the set of required signers. If no guards are set,
+ *         this function returns NULL. If a set of required signers is returned, it is a new reference, and the caller is responsible for releasing
+ *         it by calling \ref cardano_blake2b_hash_set_unref when no longer needed.
+ *
+ * \note If the returned value is NULL, it means there are no required signers for this transaction body.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_blake2b_hash_set_t* required_signers = cardano_transaction_body_get_required_signers(transaction_body);
+ *
+ * if (required_signers != NULL)
+ * {
+ *   // Use the required_signers set
+ *   // Ensure to release the required_signers set once done
+ *   cardano_blake2b_hash_set_unref(&required_signers);
+ * }
+ * else
+ * {
+ *   printf("No required signers are set for this transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_set_t* cardano_transaction_body_get_required_signers(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the required signers for a transaction body.
+ *
+ * This function assigns a set of required signers to the given \ref cardano_transaction_body_t object.
+ * Required signers are represented as hashes of public keys and are necessary to authorize the transaction.
+ *
+ * The set is stored as guards: each hash becomes a key hash credential, replacing any guards previously
+ * held by the transaction body. Guard sets whose members are all key hashes serialize with the legacy
+ * required signers wire format, so transaction bodies produced through this function encode exactly as
+ * they did in earlier eras.
+ *
+ * An empty set is kept by the body but is not encoded: key 14 is omitted, as the Conway and Dijkstra eras
+ * reject an explicitly empty set at that key.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object to which the required signers will be set.
+ * \param[in] required_signers A pointer to a \ref cardano_blake2b_hash_set_t object representing the set of required signers. This parameter can be NULL
+ *                             to unset the required signers.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the required signers were
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the
+ *         transaction_body pointer is NULL.
+ *
+ * \note If the required signers are no longer needed or need to be cleared, passing a NULL value for the `required_signers` parameter will unset the field.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_blake2b_hash_set_t* required_signers = ...; // Assume required_signers is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_required_signers(transaction_body, required_signers);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Required signers successfully set for the transaction body
+ * }
+ * else
+ * {
+ *   printf("Failed to set required signers.\n");
+ * }
+ *
+ * // Clean up the required signers if necessary
+ * cardano_blake2b_hash_set_unref(&required_signers);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_required_signers(cardano_transaction_body_t* transaction_body, cardano_blake2b_hash_set_t* required_signers);
+
+/**
+ * \brief Retrieves the guards from the transaction body.
+ *
+ * This function returns the guard set from a \ref cardano_transaction_body_t object, if it is present.
+ * Guards are credentials that must authorize the transaction, either with a signature (key hash guards)
+ * or by running the corresponding script (script hash guards). A guard set whose members are all key
+ * hashes is the credential view of the legacy required signers field.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_guard_set_t object representing the guards. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_guard_set_unref
+ *         when it is no longer needed. If the \p transaction_body is NULL or has no guards, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_guard_set_t* guards = cardano_transaction_body_get_guards(transaction_body);
+ *
+ * if (guards != NULL)
+ * {
+ *   // Use the guards
+ *   cardano_guard_set_unref(&guards);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_guard_set_t* cardano_transaction_body_get_guards(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the guards for a transaction body.
+ *
+ * This function assigns a guard set to a \ref cardano_transaction_body_t object. Passing NULL
+ * unsets the guards, removing them from the transaction body.
+ *
+ * An empty guard set is kept by the body but is not encoded: key 14 is omitted, as the Conway and Dijkstra
+ * eras reject an explicitly empty set at that key.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ * \param[in] guards A pointer to an initialized \ref cardano_guard_set_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the guards were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p guards object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_guard_set_t* guards = ...; // Assume guards are initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_guards(transaction_body, guards);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_guard_set_unref(&guards);
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_guards(cardano_transaction_body_t* transaction_body, cardano_guard_set_t* guards);
+
+/**
+ * \brief Retrieves the network ID from a transaction body.
+ *
+ * This function extracts the network ID from a given \ref cardano_transaction_body_t object, which identifies the Cardano network
+ * (mainnet or testnet) where the transaction will be valid. The network ID is optional and may not always be present in the transaction.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A constant pointer to a \ref cardano_network_id_t object representing the network ID, or NULL if the network ID is not set in the transaction body.
+ *         The returned pointer must not be modified or freed by the caller. If the input is NULL, the function returns NULL.
+ *
+ * \note If the network ID is present, it is internally managed by the transaction body object and does not need to be explicitly released by the caller.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * const cardano_network_id_t* network_id = cardano_transaction_body_get_network_id(transaction_body);
+ *
+ * if (network_id != NULL)
+ * {
+ *   // Process the network ID
+ *   printf("Transaction network ID: %u\n", *network_id);
+ * }
+ * else
+ * {
+ *   printf("No network ID is set for this transaction.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const cardano_network_id_t* cardano_transaction_body_get_network_id(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the network ID for a transaction body.
+ *
+ * This function assigns a network ID to a given \ref cardano_transaction_body_t object. The network ID specifies which Cardano network
+ * (mainnet or testnet) the transaction is intended for. The network ID is optional and can be set to NULL if the network ID is to be unset.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object to which the network ID will be set.
+ * \param[in] network_id A constant pointer to a \ref cardano_network_id_t object representing the network ID. This parameter can be NULL
+ *                       if the network ID is to be unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the network ID was successfully set,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the transaction_body pointer is NULL.
+ *
+ * \note If \p network_id is set to NULL, it will unset any previously set network ID in the transaction body.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_network_id_t network_id = CARDANO_NETWORK_ID_MAIN_NET; // Example network ID for mainnet
+ *
+ * cardano_error_t result = cardano_transaction_body_set_network_id(transaction_body, &network_id);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Network ID set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set network ID: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_network_id(cardano_transaction_body_t* transaction_body, const cardano_network_id_t* network_id);
+
+/**
+ * \brief Retrieves the collateral return output from a transaction body.
+ *
+ * This function fetches the collateral return output from a given \ref cardano_transaction_body_t object.
+ * The collateral return is an optional field that specifies the output to which excess collateral is returned
+ * in case the collateral provided in the transaction exceeds what is needed.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_transaction_output_t object representing the collateral return output.
+ *         If the collateral return output is not set, this function will return NULL. If a valid output is returned,
+ *         the caller is responsible for managing the returned object and must release it using
+ *         \ref cardano_transaction_output_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_transaction_output_t* collateral_return = cardano_transaction_body_get_collateral_return(transaction_body);
+ *
+ * if (collateral_return != NULL)
+ * {
+ *   // Use the collateral return output
+ *   cardano_transaction_output_unref(&collateral_return);
+ * }
+ * else
+ * {
+ *   printf("No collateral return output is set.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_output_t* cardano_transaction_body_get_collateral_return(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the collateral return output in the transaction body.
+ *
+ * This function assigns a new collateral return output to a \ref cardano_transaction_body_t object.
+ * The collateral return output specifies where any excess collateral provided by the transaction will be returned,
+ * if the collateral exceeds what is needed.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object
+ *                                 to which the collateral return output will be set.
+ * \param[in] output A pointer to an initialized \ref cardano_transaction_output_t object representing
+ *                   the collateral return output. This parameter can be NULL to unset the collateral return.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         collateral return output was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the \p transaction_body pointer is NULL.
+ *
+ * \note This function increases the reference count of the output object. It is the caller's responsibility to
+ *       manage the lifetime of their references, including calling \ref cardano_transaction_output_unref
+ *       when the output is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_transaction_output_t* collateral_return_output = ...; // Assume collateral_return_output is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_collateral_return(transaction_body, collateral_return_output);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Collateral return output successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set collateral return output.\n");
+ * }
+ *
+ * // Clean up references
+ * cardano_transaction_output_unref(&collateral_return_output);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_collateral_return(cardano_transaction_body_t* transaction_body, cardano_transaction_output_t* output);
+
+/**
+ * \brief Retrieves the total collateral from the transaction body.
+ *
+ * This function fetches the total collateral value specified in the transaction body. The total collateral represents
+ * the amount of ADA (in lovelaces) that the transaction is providing as collateral.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A constant pointer to a \c uint64_t that contains the total collateral in lovelaces.
+ *         If the total collateral is not set, the function will return NULL.
+ *         The memory of the returned \c uint64_t is managed internally and must not be freed by the caller.
+ *
+ * \note This function follows the same convention as other getters of this type—returning \c NULL if the field is not set.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ *
+ * const uint64_t* total_collateral = cardano_transaction_body_get_total_collateral(transaction_body);
+ *
+ * if (total_collateral != NULL)
+ * {
+ *   printf("Total collateral: %llu lovelaces\n", *total_collateral);
+ * }
+ * else
+ * {
+ *   printf("Total collateral is not set for this transaction.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_transaction_body_get_total_collateral(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the total collateral for a transaction body.
+ *
+ * This function sets the total collateral amount (in lovelaces) for the transaction body.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object to which the total collateral will be set.
+ * \param[in] total_collateral A constant pointer to a \c uint64_t representing the total collateral value in lovelaces.
+ *                             If set to \c NULL, the total collateral will be unset.
+ *
+ * \return A \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the total collateral
+ *         was successfully set, or an appropriate error code if the input pointers are NULL or if another failure occurs.
+ *
+ * \note If the \c total_collateral is \c NULL, this will unset the total collateral in the transaction body.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * uint64_t total_collateral_value = 5000000; // 5 ADA in lovelaces
+ *
+ * cardano_error_t result = cardano_transaction_body_set_total_collateral(transaction_body, &total_collateral_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Total collateral set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set total collateral.\n");
+ * }
+ *
+ * // Unset the total collateral
+ * result = cardano_transaction_body_set_total_collateral(transaction_body, NULL);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Total collateral unset successfully.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_total_collateral(cardano_transaction_body_t* transaction_body, const uint64_t* total_collateral);
+
+/**
+ * \brief Retrieves the reference inputs from a transaction body.
+ *
+ * This function fetches the reference inputs from a given \ref cardano_transaction_body_t object.
+ * Reference inputs allow scripts to use outputs without consuming them, enabling transaction builders
+ * to reference the necessary data (e.g., Plutus scripts) without spending the UTxO.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_transaction_input_set_t object representing the set of reference inputs.
+ *         The returned reference input set is a new reference, and the caller is responsible for releasing it
+ *         with \ref cardano_transaction_input_set_unref when it is no longer needed. If there are no reference inputs or
+ *         if the transaction body does not contain reference inputs, the function returns \c NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_transaction_input_set_t* reference_inputs = cardano_transaction_body_get_reference_inputs(transaction_body);
+ *
+ * if (reference_inputs != NULL)
+ * {
+ *   // Process the reference inputs
+ *   cardano_transaction_input_set_unref(&reference_inputs); // Free the reference inputs after use
+ * }
+ * else
+ * {
+ *   printf("No reference inputs found or transaction body is invalid.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_transaction_input_set_t* cardano_transaction_body_get_reference_inputs(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the reference inputs in a transaction body.
+ *
+ * This function assigns a set of reference inputs to a given \ref cardano_transaction_body_t object.
+ * Reference inputs allow scripts to access outputs without consuming them, enabling transaction
+ * builders to use specific UTxOs for reference purposes, such as providing Plutus scripts access
+ * to necessary data.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object
+ *                                 where the reference inputs will be set.
+ * \param[in] reference_inputs A pointer to an initialized \ref cardano_transaction_input_set_t object
+ *                             representing the set of reference inputs to assign to the transaction body.
+ *                             This parameter can be NULL if no reference inputs are to be set, effectively
+ *                             clearing the reference inputs from the transaction body.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         reference inputs were successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if the \p transaction_body pointer is NULL.
+ *
+ * \note If \p reference_inputs is NULL, any previously set reference inputs in the transaction body will be cleared.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_transaction_input_set_t* reference_inputs = ...; // Assume reference_inputs is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_reference_inputs(transaction_body, reference_inputs);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Reference inputs set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set reference inputs.\n");
+ * }
+ *
+ * // Cleanup if necessary (only if reference_inputs was dynamically allocated elsewhere)
+ * cardano_transaction_input_set_unref(&reference_inputs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_reference_inputs(cardano_transaction_body_t* transaction_body, cardano_transaction_input_set_t* reference_inputs);
+
+/**
+ * \brief Retrieves the voting procedures associated with a transaction body.
+ *
+ * This function fetches the voting procedures from a given \ref cardano_transaction_body_t object.
+ * Voting procedures represent governance-related actions that may be included in the transaction,
+ * such as votes on proposals or governance actions.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object
+ *                             from which the voting procedures will be retrieved.
+ *
+ * \return A pointer to a \ref cardano_voting_procedures_t object representing the voting procedures
+ *         included in the transaction body. If the transaction body does not have voting procedures set,
+ *         this function returns NULL. The returned object is a new reference, and the caller is responsible
+ *         for releasing it with \ref cardano_voting_procedures_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_voting_procedures_t* voting_procedures = cardano_transaction_body_get_voting_procedures(transaction_body);
+ *
+ * if (voting_procedures != NULL)
+ * {
+ *   // Process the voting procedures
+ *
+ *   // Ensure to clean up and release the voting_procedures when done
+ *   cardano_voting_procedures_unref(&voting_procedures);
+ * }
+ * else
+ * {
+ *   printf("No voting procedures found in this transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_voting_procedures_t* cardano_transaction_body_get_voting_procedures(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the voting procedures for a transaction body.
+ *
+ * This function assigns a \ref cardano_voting_procedures_t object to a given \ref cardano_transaction_body_t object.
+ * Voting procedures represent governance-related actions, such as votes on proposals or governance actions, that
+ * may be included in the transaction body.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object to which the voting procedures will be set.
+ * \param[in] voting_procedures A pointer to an initialized \ref cardano_voting_procedures_t object representing the voting procedures.
+ *                              This parameter can be set to NULL to remove the voting procedures from the transaction body.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the voting procedures
+ *         were successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the transaction body pointer is NULL.
+ *
+ * \note The function increases the reference count of the \p voting_procedures object, and the caller retains ownership of their references.
+ *       It is the caller's responsibility to release their reference to \p voting_procedures when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_voting_procedures_t* voting_procedures = ...; // Assume voting_procedures is already initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_voting_procedures(transaction_body, voting_procedures);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The voting procedures have been successfully set for the transaction body
+ * }
+ * else
+ * {
+ *   printf("Failed to set the voting procedures.\n");
+ * }
+ *
+ * // Clean up if necessary
+ * cardano_voting_procedures_unref(&voting_procedures);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_voting_procedures(cardano_transaction_body_t* transaction_body, cardano_voting_procedures_t* voting_procedures);
+
+/**
+ * \brief Retrieves the proposal procedure set from a transaction body.
+ *
+ * This function extracts the \ref cardano_proposal_procedure_set_t object from the given \ref cardano_transaction_body_t object.
+ * The proposal procedure set represents the set of governance proposals or actions included in the transaction body.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object from which the proposal procedure set is retrieved.
+ *
+ * \return A pointer to the retrieved \ref cardano_proposal_procedure_set_t object, or NULL if no proposal procedure set is present.
+ *         The caller is responsible for managing the returned object, and must call \ref cardano_proposal_procedure_set_unref
+ *         to release it when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_proposal_procedure_set_t* proposal_procedure_set = cardano_transaction_body_get_proposal_procedures(transaction_body);
+ *
+ * if (proposal_procedure_set != NULL)
+ * {
+ *   // Use the proposal procedure set
+ *
+ *   // Once done, ensure to clean up and release the proposal_procedure_set
+ *   cardano_proposal_procedure_set_unref(&proposal_procedure_set);
+ * }
+ * else
+ * {
+ *   printf("No proposal procedure set present in the transaction body.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_proposal_procedure_set_t* cardano_transaction_body_get_proposal_procedures(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the proposal procedure set for a transaction body.
+ *
+ * This function assigns a \ref cardano_proposal_procedure_set_t object to the given \ref cardano_transaction_body_t object.
+ * The proposal procedure set represents a collection of governance proposals or actions that are to be included in the transaction body.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object to which the proposal procedure set will be assigned.
+ * \param[in] proposal_procedures A pointer to a \ref cardano_proposal_procedure_set_t object representing the new proposal procedure set.
+ *                                This parameter can be NULL to unset the proposal procedures from the transaction body.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the proposal procedure set was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p transaction_body pointer is NULL.
+ *
+ * \note The function increases the reference count of the \p proposal_procedures object, so the caller retains ownership
+ *       and is still responsible for managing its lifecycle. To remove the proposal procedures, pass \p proposal_procedures as NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_proposal_procedure_set_t* proposal_procedures = ...; // Assume proposal_procedures is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_proposal_procedure(transaction_body, proposal_procedures);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The proposal procedures have been set for the transaction body
+ * }
+ * else
+ * {
+ *   printf("Failed to set the proposal procedures: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up proposal_procedures if it's no longer needed
+ * cardano_proposal_procedure_set_unref(&proposal_procedures);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_proposal_procedure(cardano_transaction_body_t* transaction_body, cardano_proposal_procedure_set_t* proposal_procedures);
+
+/**
+ * \brief Retrieves the treasury value from a transaction body.
+ *
+ * This function returns a pointer to the treasury value (in ADA, represented in lovelaces) associated with a \ref cardano_transaction_body_t object.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \c uint64_t representing the treasury value in lovelaces. The pointer will be NULL if the treasury value is not set in this transaction.
+ *         The memory of the returned value is managed internally by the \ref cardano_transaction_body_t object and must not be freed by the caller.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * const uint64_t* treasury_value = cardano_transaction_body_get_treasury_value(transaction_body);
+ *
+ * if (treasury_value != NULL)
+ * {
+ *   printf("Treasury Value: %llu lovelaces\n", *treasury_value);
+ * }
+ * else
+ * {
+ *   printf("No treasury value set for this transaction.\n");
+ * }
+ * \endcode
+ *
+ * \note Since the returned pointer can be NULL if the treasury value is not set, callers should always check for NULL before dereferencing it.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_transaction_body_get_treasury_value(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the treasury value in a transaction body.
+ *
+ * This function sets the treasury value (in ADA, represented in lovelaces) in a \ref cardano_transaction_body_t object.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object in which to set the treasury value.
+ * \param[in] treasury_value A pointer to a \c uint64_t representing the treasury value in lovelaces. This parameter can be NULL to unset the treasury value.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the treasury value was successfully set,
+ *         or an appropriate error code if the operation failed, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the \p transaction_body pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * uint64_t treasury_value = 1000000; // 1 ADA in lovelaces
+ *
+ * cardano_error_t result = cardano_transaction_body_set_treasury_value(transaction_body, &treasury_value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Treasury value set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set treasury value: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ *
+ * \note Passing NULL for \p treasury_value will unset the treasury value in the transaction body.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_treasury_value(cardano_transaction_body_t* transaction_body, const uint64_t* treasury_value);
+
+/**
+ * \brief Retrieves the donation value from a transaction body.
+ *
+ * This function returns the donation value (in ADA, represented in lovelaces) from a \ref cardano_transaction_body_t object.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object from which to retrieve the donation value.
+ *
+ * \return A pointer to a \c uint64_t representing the donation value in lovelaces. If the donation value is not set, this function returns NULL.
+ *         The memory for the returned \c uint64_t is managed internally by the transaction body object and must not be freed by the caller.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * const uint64_t* donation_value = cardano_transaction_body_get_donation(transaction_body);
+ *
+ * if (donation_value != NULL)
+ * {
+ *   printf("Donation value: %llu lovelaces\n", *donation_value);
+ * }
+ * else
+ * {
+ *   printf("No donation value set.\n");
+ * }
+ * \endcode
+ *
+ * \note The returned pointer must not be freed by the caller. If no donation value is set, this function returns NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const uint64_t* cardano_transaction_body_get_donation(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the donation value in a transaction body.
+ *
+ * This function assigns a donation value to a \ref cardano_transaction_body_t object.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object to which the donation value will be set.
+ * \param[in] donation A pointer to a \c uint64_t representing the donation value in lovelaces. This parameter can be NULL to unset
+ *                     the donation value.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the donation value was successfully set,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the transaction_body pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * uint64_t donation_value = 5000000; // 5 ADA in lovelaces
+ *
+ * cardano_error_t result = cardano_transaction_body_set_donation(transaction_body, &donation_value);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Donation value set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the donation value: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ *
+ * \note If the \p donation parameter is set to NULL, it will unset any previously set donation value in the transaction body.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_donation(cardano_transaction_body_t* transaction_body, const uint64_t* donation);
+
+/**
+ * \brief Retrieves the sub transactions from the transaction body.
+ *
+ * This function returns the sub transaction set from a \ref cardano_transaction_body_t object, if it is present.
+ * Sub transactions are complete transactions nested inside the top-level transaction that are validated
+ * atomically together with it.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_sub_transaction_set_t object representing the sub transactions. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_sub_transaction_set_unref
+ *         when it is no longer needed. If the \p transaction_body is NULL or has no sub transactions, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_sub_transaction_set_t* sub_transactions = cardano_transaction_body_get_sub_transactions(transaction_body);
+ *
+ * if (sub_transactions != NULL)
+ * {
+ *   // Use the sub transactions
+ *   cardano_sub_transaction_set_unref(&sub_transactions);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_sub_transaction_set_t* cardano_transaction_body_get_sub_transactions(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the sub transactions for a transaction body.
+ *
+ * This function assigns a sub transaction set to a \ref cardano_transaction_body_t object. Passing NULL
+ * unsets the sub transactions, removing them from the transaction body.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ * \param[in] sub_transactions A pointer to an initialized \ref cardano_sub_transaction_set_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the sub transactions were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p sub_transactions object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_sub_transaction_set_t* sub_transactions = ...; // Assume sub_transactions is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_sub_transactions(transaction_body, sub_transactions);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_sub_transaction_set_unref(&sub_transactions);
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_sub_transactions(
+  cardano_transaction_body_t*    transaction_body,
+  cardano_sub_transaction_set_t* sub_transactions);
+
+/**
+ * \brief Retrieves the required top level guards from the transaction body.
+ *
+ * This function returns the required top level guards from a \ref cardano_transaction_body_t object, if they are present.
+ * The map restricts which guards must be declared by the top-level transaction, each optionally paired with
+ * the datum the guard must be invoked with. At the top level the field is a self assertion: its credentials
+ * are expected to be a subset of the guards of the same body, although that is a ledger rule and is not
+ * enforced during serialization.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_required_guards_map_t object representing the required top level guards. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_required_guards_map_unref
+ *         when it is no longer needed. If the \p transaction_body is NULL or has no required top level guards, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_required_guards_map_t* required_guards = cardano_transaction_body_get_required_top_level_guards(transaction_body);
+ *
+ * if (required_guards != NULL)
+ * {
+ *   // Use the required top level guards
+ *   cardano_required_guards_map_unref(&required_guards);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_required_guards_map_t* cardano_transaction_body_get_required_top_level_guards(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the required top level guards for a transaction body.
+ *
+ * This function assigns a required guards map to a \ref cardano_transaction_body_t object. Passing NULL
+ * unsets the required top level guards, removing them from the transaction body.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ * \param[in] required_top_level_guards A pointer to an initialized \ref cardano_required_guards_map_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the required top level guards were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p required_top_level_guards object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_required_guards_map_t* required_guards = ...; // Assume required_guards is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_required_top_level_guards(transaction_body, required_guards);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_required_guards_map_unref(&required_guards);
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_required_top_level_guards(
+  cardano_transaction_body_t*    transaction_body,
+  cardano_required_guards_map_t* required_top_level_guards);
+
+/**
+ * \brief Retrieves the direct deposits from the transaction body.
+ *
+ * This function returns the direct deposits from a \ref cardano_transaction_body_t object, if they are present.
+ * Direct deposits map reward accounts to the amount of lovelace deposited directly into them.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_direct_deposit_map_t object representing the direct deposits. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_direct_deposit_map_unref
+ *         when it is no longer needed. If the \p transaction_body is NULL or has no direct deposits, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_direct_deposit_map_t* direct_deposits = cardano_transaction_body_get_direct_deposits(transaction_body);
+ *
+ * if (direct_deposits != NULL)
+ * {
+ *   // Use the direct deposits
+ *   cardano_direct_deposit_map_unref(&direct_deposits);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_direct_deposit_map_t* cardano_transaction_body_get_direct_deposits(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the direct deposits for a transaction body.
+ *
+ * This function assigns a direct deposit map to a \ref cardano_transaction_body_t object. Passing NULL
+ * unsets the direct deposits, removing them from the transaction body.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ * \param[in] direct_deposits A pointer to an initialized \ref cardano_direct_deposit_map_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the direct deposits were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p direct_deposits object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_direct_deposit_map_t* direct_deposits = ...; // Assume direct_deposits is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_direct_deposits(transaction_body, direct_deposits);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_direct_deposit_map_unref(&direct_deposits);
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_direct_deposits(
+  cardano_transaction_body_t*   transaction_body,
+  cardano_direct_deposit_map_t* direct_deposits);
+
+/**
+ * \brief Retrieves the account balance intervals from the transaction body.
+ *
+ * This function returns the account balance intervals from a \ref cardano_transaction_body_t object, if they are present.
+ * The map constrains, per reward account, the balance the account must satisfy for the transaction to be valid.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_account_balance_intervals_map_t object representing the account balance intervals. The returned object
+ *         is a new reference, and the caller is responsible for releasing it by calling \ref cardano_account_balance_intervals_map_unref
+ *         when it is no longer needed. If the \p transaction_body is NULL or has no account balance intervals, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_account_balance_intervals_map_t* intervals = cardano_transaction_body_get_account_balance_intervals(transaction_body);
+ *
+ * if (intervals != NULL)
+ * {
+ *   // Use the account balance intervals
+ *   cardano_account_balance_intervals_map_unref(&intervals);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_account_balance_intervals_map_t* cardano_transaction_body_get_account_balance_intervals(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the account balance intervals for a transaction body.
+ *
+ * This function assigns an account balance intervals map to a \ref cardano_transaction_body_t object. Passing NULL
+ * unsets the account balance intervals, removing them from the transaction body.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ * \param[in] account_balance_intervals A pointer to an initialized \ref cardano_account_balance_intervals_map_t object, or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the account balance intervals were
+ *         successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p account_balance_intervals object when it is not NULL; the caller retains
+ *       ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_account_balance_intervals_map_t* intervals = ...; // Assume intervals is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_account_balance_intervals(transaction_body, intervals);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_account_balance_intervals_map_unref(&intervals);
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_account_balance_intervals(
+  cardano_transaction_body_t*              transaction_body,
+  cardano_account_balance_intervals_map_t* account_balance_intervals);
+
+/**
+ * \brief Retrieves the starting account balance intervals from the transaction body.
+ *
+ * This function returns the starting account balance intervals from a \ref cardano_transaction_body_t object, if they
+ * are present. The map constrains, per reward account, the balance the account must have had before the batch
+ * started, whereas the account balance intervals constrain the balance at the point the transaction is applied,
+ * after earlier sub transactions ran. Only top level transaction bodies carry this field.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A pointer to a \ref cardano_account_balance_intervals_map_t object representing the starting account balance
+ *         intervals. The returned object is a new reference, and the caller is responsible for releasing it by calling
+ *         \ref cardano_account_balance_intervals_map_unref when it is no longer needed. If the \p transaction_body is NULL
+ *         or has no starting account balance intervals, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_account_balance_intervals_map_t* intervals = cardano_transaction_body_get_starting_account_balance_intervals(transaction_body);
+ *
+ * if (intervals != NULL)
+ * {
+ *   // Use the starting account balance intervals
+ *   cardano_account_balance_intervals_map_unref(&intervals);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_account_balance_intervals_map_t* cardano_transaction_body_get_starting_account_balance_intervals(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the starting account balance intervals for a transaction body.
+ *
+ * This function assigns a starting account balance intervals map to a \ref cardano_transaction_body_t object. Passing NULL
+ * unsets the starting account balance intervals, removing them from the transaction body.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ * \param[in] starting_account_balance_intervals A pointer to an initialized \ref cardano_account_balance_intervals_map_t object,
+ *                                               or NULL to unset the field.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the starting account
+ *         balance intervals were successfully set or unset, or \ref CARDANO_ERROR_POINTER_IS_NULL if \p transaction_body is NULL.
+ *
+ * \note This function increases the reference count of the \p starting_account_balance_intervals object when it is not NULL;
+ *       the caller retains ownership of their reference and must release it when no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is initialized
+ * cardano_account_balance_intervals_map_t* intervals = ...; // Assume intervals is initialized
+ *
+ * cardano_error_t result = cardano_transaction_body_set_starting_account_balance_intervals(transaction_body, intervals);
+ *
+ * // Clean up resources when no longer needed
+ * cardano_account_balance_intervals_map_unref(&intervals);
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_set_starting_account_balance_intervals(
+  cardano_transaction_body_t*              transaction_body,
+  cardano_account_balance_intervals_map_t* starting_account_balance_intervals);
+
+/**
+ * \brief Retrieves the hash of a transaction body.
+ *
+ * This function computes and returns the hash of the given \ref cardano_transaction_body_t object. The hash is a unique identifier for the transaction body,
+ * which can be used to reference the transaction in other parts of the blockchain.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object. The object must be valid and not NULL.
+ *
+ * \return A pointer to a \ref cardano_blake2b_hash_t object representing the transaction body hash. The returned object is a new reference, and
+ *         the caller is responsible for releasing it by calling \ref cardano_blake2b_hash_unref when it is no longer needed.
+ *         If the input is NULL, the function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * cardano_blake2b_hash_t* tx_body_hash = cardano_transaction_body_get_hash(transaction_body);
+ *
+ * if (tx_body_hash != NULL)
+ * {
+ *   // Use the transaction body hash for signing or verification
+ *
+ *   // Clean up when done
+ *   cardano_blake2b_hash_unref(&tx_body_hash);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the transaction body hash.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_transaction_body_get_hash(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Determines if the transaction body uses tagged sets in its encoding.
+ *
+ * This function checks whether the given \ref cardano_transaction_body_t object
+ * uses the new Conway era encoding for sets, which are collections identified by a tag.
+ * In the Conway era, certain collections within the transaction body are encoded as tagged sets,
+ * whereas in previous eras, these collections were encoded as arrays without the tag.
+ *
+ * \param[in] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object.
+ *
+ * \return A boolean value:
+ *         - \c true if the transaction body uses the Conway era encoding for sets (tagged sets).
+ *         - \c false if the transaction body uses the older encoding (arrays without tags).
+ *
+ * \note This function helps in determining the serialization format of the transaction body,
+ *       which may be necessary for compatibility with other transaction encoders/decoders.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = ...; // Assume transaction_body is already initialized
+ * bool has_tagged_sets = cardano_transaction_body_has_tagged_sets(transaction_body);
+ *
+ * if (has_tagged_sets)
+ * {
+ *   printf("The transaction body uses Conway era tagged sets.\n");
+ * }
+ * else
+ * {
+ *   printf("The transaction body uses pre-Conway era encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_transaction_body_has_tagged_sets(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Clears the cached CBOR representation from a transaction body.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_transaction_body_t object.
+ * It is useful when you have modified the transaction body after it was created from CBOR using
+ * \ref cardano_transaction_body_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the transaction body, rather than using the original cached CBOR.
+ *
+ * \param[in,out] transaction_body A pointer to an initialized \ref cardano_transaction_body_t object
+ *                                 from which the CBOR cache will be cleared.
+ *
+ * \note After calling this function, subsequent calls to \ref cardano_transaction_body_to_cbor will
+ *       serialize the transaction body using the standard encoding as defined in
+ *       [CIP-21](https://cips.cardano.org/cip/CIP-21), rather than reusing the original cached CBOR.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the transaction body when
+ *          serialized, which can alter the transaction body hash and invalidate any existing signatures.
+ *          Use this function with caution, especially if the transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume transaction_body was created using cardano_transaction_body_from_cbor
+ * cardano_transaction_body_t* transaction_body = ...;
+ *
+ * // Modify the transaction body as needed
+ * // For example, change the fee
+ * uint64_t new_fee = 500000;
+ * cardano_error_t result = cardano_transaction_body_set_fee(transaction_body, new_fee);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   printf("Failed to set new fee: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated transaction body
+ * cardano_transaction_body_clear_cbor_cache(transaction_body);
+ *
+ * // Serialize the transaction body to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_transaction_body_to_cbor(transaction_body, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_transaction_body_unref(&transaction_body);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_transaction_body_clear_cbor_cache(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Decrements the reference count of a cardano_transaction_body_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_transaction_body_t object
+ * by decreasing its reference count. When the reference count reaches zero, the transaction_body is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] transaction_body A pointer to the pointer of the transaction_body object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_body_t* transaction_body = cardano_transaction_body_new(major, minor);
+ *
+ * // Perform operations with the transaction_body...
+ *
+ * cardano_transaction_body_unref(&transaction_body);
+ * // At this point, transaction_body is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_transaction_body_unref, the pointer to the \ref cardano_transaction_body_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_transaction_body_unref(cardano_transaction_body_t** transaction_body);
+
+/**
+ * \brief Increases the reference count of the cardano_transaction_body_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_transaction_body_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_transaction_body_unref.
+ *
+ * \param transaction_body A pointer to the cardano_transaction_body_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_body is a previously created transaction_body object
+ *
+ * cardano_transaction_body_ref(transaction_body);
+ *
+ * // Now transaction_body can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_transaction_body_ref there is a corresponding
+ * call to \ref cardano_transaction_body_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_transaction_body_ref(cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_transaction_body_t object.
+ *
+ * This function returns the number of active references to an cardano_transaction_body_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_transaction_body_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param transaction_body A pointer to the cardano_transaction_body_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_transaction_body_t object. If the object
+ * is properly managed (i.e., every \ref cardano_transaction_body_ref call is matched with a
+ * \ref cardano_transaction_body_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_body is a previously created transaction_body object
+ *
+ * size_t ref_count = cardano_transaction_body_refcount(transaction_body);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_transaction_body_refcount(const cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Sets the last error message for a given cardano_transaction_body_t object.
+ *
+ * Records an error message in the transaction_body's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] transaction_body A pointer to the \ref cardano_transaction_body_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the transaction_body's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_transaction_body_set_last_error(
+  cardano_transaction_body_t* transaction_body,
+  const char*                 message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific transaction_body.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_transaction_body_set_last_error for the given
+ * transaction_body. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] transaction_body A pointer to the \ref cardano_transaction_body_t instance whose last error
+ *                   message is to be retrieved. If the transaction_body is NULL, the function
+ *                   returns a generic error message indicating the null transaction_body.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified transaction_body. If the transaction_body is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_transaction_body_set_last_error for the same transaction_body, or until
+ *       the transaction_body is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_transaction_body_get_last_error(
+  const cardano_transaction_body_t* transaction_body);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_transaction_body_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_transaction_body_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_body_deep_clone(const cardano_transaction_body_t* source, cardano_transaction_body_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BODY_H
diff --git a/vendor/include/cardano/transaction_body/transaction_input.h b/vendor/include/cardano/transaction_body/transaction_input.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/transaction_input.h
@@ -0,0 +1,606 @@
+/**
+ * \file transaction_input.h
+ *
+ * \author angel.castillo
+ * \date   Sep 05, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_INPUT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_INPUT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a reference to an unspent transaction output (UTxO) from a previous
+ * transaction, which the current transaction intends to spend.
+ */
+typedef struct cardano_transaction_input_t cardano_transaction_input_t;
+
+/**
+ * \brief Creates and initializes a new instance of the Transaction Input.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_transaction_input_t object,
+ * representing an input in a Cardano transaction. Each transaction input is a reference to an unspent transaction output (UTxO)
+ * from a previous transaction, which the current transaction intends to spend.
+ *
+ * \param[in] id A pointer to a \ref cardano_blake2b_hash_t object representing the transaction ID of the UTxO.
+ * \param[in] index The output index within the transaction identified by the ID, specifying which output from the given transaction is being spent.
+ * \param[out] transaction_input On successful initialization, this will point to a newly created \ref cardano_transaction_input_t object.
+ *             This object represents a "strong reference," meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object,
+ *             specifically, once the Transaction Input is no longer needed, the caller must release it
+ *             by calling \ref cardano_transaction_input_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Transaction Input was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t index = 0; // Index of the UTxO to be spent
+ * cardano_blake2b_hash_t* id = cardano_blake2b_hash_new(...); // Assume id is already initialized
+ * cardano_transaction_input_t* transaction_input = NULL;
+ *
+ * // Attempt to create a new Transaction Input object
+ * cardano_error_t result = cardano_transaction_input_new(id, index, &transaction_input);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction_input
+ *
+ *   // Once done, ensure to clean up and release the transaction_input
+ *   cardano_transaction_input_unref(&transaction_input);
+ * }
+ *
+ * // Cleanup the id after use
+ * cardano_blake2b_hash_unref(&id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_input_new(
+  cardano_blake2b_hash_t*       id,
+  uint64_t                      index,
+  cardano_transaction_input_t** transaction_input);
+
+/**
+ * \brief Creates and initializes a new instance of the Transaction Input from a hexadecimal string.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_transaction_input_t object
+ * by decoding a hexadecimal string that represents the transaction ID. The function takes an input index
+ * indicating which output from the specified transaction ID is being referenced to be spent.
+ *
+ * \param[in] id_hex A pointer to a character array containing the hexadecimal representation of the transaction ID.
+ * \param[in] id_hex_size The size of the hexadecimal string (number of characters).
+ * \param[in] index The output index within the transaction identified by the ID, specifying which output from the
+ *                  given transaction is intended to be spent.
+ * \param[out] transaction_input On successful initialization, this will point to a newly created \ref cardano_transaction_input_t object.
+ *              This object represents a "strong reference," meaning that it is fully initialized and ready for use.
+ *              The caller is responsible for managing the lifecycle of this object,
+ *              specifically, once the Transaction Input is no longer needed, the caller must release it
+ *              by calling \ref cardano_transaction_input_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Transaction Input was successfully created from the hexadecimal string, or an appropriate error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* id_hex = "abc123..."; // Transaction ID in hexadecimal
+ * size_t id_hex_size = strlen(id_hex);
+ * uint64_t index = 0; // Index of the UTxO to be spent
+ * cardano_transaction_input_t* transaction_input = NULL;
+ *
+ * // Attempt to create a new Transaction Input object from a hexadecimal string
+ * cardano_error_t result = cardano_transaction_input_from_hex(id_hex, id_hex_size, index, &transaction_input);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction_input
+ *
+ *   // Once done, ensure to clean up and release the transaction_input
+ *   cardano_transaction_input_unref(&transaction_input);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the transaction input: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_input_from_hex(
+  const char*                   id_hex,
+  size_t                        id_hex_size,
+  uint64_t                      index,
+  cardano_transaction_input_t** transaction_input);
+
+/**
+ * \brief Creates a \ref cardano_transaction_input_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_transaction_input_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a transaction_input.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] transaction_input A pointer to a pointer of \ref cardano_transaction_input_t that will be set to the address
+ *                        of the newly created transaction_input object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the transaction input were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_transaction_input_t object by calling
+ *       \ref cardano_transaction_input_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_transaction_input_t* transaction_input = NULL;
+ *
+ * cardano_error_t result = cardano_transaction_input_from_cbor(reader, &transaction_input);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction_input
+ *
+ *   // Once done, ensure to clean up and release the transaction_input
+ *   cardano_transaction_input_unref(&transaction_input);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode transaction_input: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_input_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_input_t** transaction_input);
+
+/**
+ * \brief Serializes transaction input into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_transaction_input_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] transaction_input A constant pointer to the \ref cardano_transaction_input_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p transaction_input or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_t* transaction_input = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_transaction_input_to_cbor(transaction_input, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_transaction_input_unref(&transaction_input);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_input_to_cbor(
+  const cardano_transaction_input_t* transaction_input,
+  cardano_cbor_writer_t*             writer);
+
+/**
+ * \brief Serializes a cardano_transaction_input_t as a CIP-116 JSON object.
+ *
+ * Writes exactly one JSON object to \p json (including the opening/closing braces):
+ *
+ * \code{.json}
+ * {
+ *   "transaction_id": "<64-hex-bytes>",
+ *   "index": 0
+ * }
+ * \endcode
+ *
+ * \param[in]     input  A valid cardano_transaction_input_t to serialize. Must not be NULL.
+ * \param[in,out] json   A valid JSON writer positioned where a value is expected. Must not be NULL.
+ *
+ * \return CARDANO_SUCCESS on success; an appropriate error code otherwise.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_input_to_cip116_json(const cardano_transaction_input_t* input, cardano_json_writer_t* json);
+
+/**
+ * \brief Retrieves the transaction ID associated with a transaction input.
+ *
+ * This function fetches the transaction ID from a given \ref cardano_transaction_input_t object. The transaction ID uniquely identifies
+ * the transaction that contains the output being referenced as an input in another transaction.
+ *
+ * \param[in] input A pointer to an initialized \ref cardano_transaction_input_t object.
+ *
+ * \return A pointer to the \ref cardano_blake2b_hash_t object representing the transaction ID. If the input pointer is NULL, this function returns NULL.
+ *         Note that the returned transaction ID is a new reference and must be released using \ref cardano_blake2b_hash_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_t* input = ...; // Assume input is already initialized
+ * cardano_blake2b_hash_t* transaction_id = cardano_transaction_input_get_id(input);
+ *
+ * if (transaction_id != NULL)
+ * {
+ *   // Process the transaction ID
+ *   cardano_blake2b_hash_unref(&transaction_id);
+ * }
+ * else
+ * {
+ *   printf("Invalid transaction input or uninitialized input.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_blake2b_hash_t* cardano_transaction_input_get_id(cardano_transaction_input_t* input);
+
+/**
+ * \brief Sets the transaction ID for a transaction input.
+ *
+ * This function assigns a new transaction ID to a \ref cardano_transaction_input_t object.
+ * The transaction ID uniquely identifies the transaction where the output, now used as an input, was originally created.
+ *
+ * \param[in,out] input A pointer to an initialized \ref cardano_transaction_input_t object to which the transaction ID will be set.
+ * \param[in] id A pointer to an initialized \ref cardano_blake2b_hash_t object representing the transaction ID.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the transaction ID
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note This function increases the reference count of the transaction ID object; therefore, the caller retains ownership of their respective references.
+ *       It is the caller's responsibility to release their reference to the transaction ID when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_t* input = ...; // Assume input is already initialized
+ * cardano_blake2b_hash_t* transaction_id = ...; // Assume transaction_id is initialized
+ *
+ * cardano_error_t result = cardano_transaction_input_set_id(input, transaction_id);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The transaction ID is now set for the input
+ * }
+ * else
+ * {
+ *   printf("Failed to set the transaction ID.\n");
+ * }
+ *
+ * // Clean up resources
+ * cardano_blake2b_hash_unref(&transaction_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_input_set_id(cardano_transaction_input_t* input, cardano_blake2b_hash_t* id);
+
+/**
+ * \brief Retrieves the index of the output used as an input from a previous transaction.
+ *
+ * This function fetches the index of the output in the transaction that is referenced by the transaction input.
+ * The index specifies which output from the referenced transaction is being used as an input in the current transaction.
+ *
+ * \param[in] transaction_input A constant pointer to an initialized \ref cardano_transaction_input_t object.
+ *
+ * \return The index of the output from the referenced transaction. If the input is NULL, the function will return 0.
+ *         It is important for the caller to ensure the input is not NULL before calling this function to distinguish
+ *         from a genuine index of 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_transaction_input_t* transaction_input = ...; // Assume transaction_input is already initialized
+ *
+ * uint64_t index = cardano_transaction_input_get_index(transaction_input);
+ * printf("Index of the used output: %llu\n", index);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_transaction_input_get_index(const cardano_transaction_input_t* transaction_input);
+
+/**
+ * \brief Sets the index of an output in the referenced transaction for use as an input in a new transaction.
+ *
+ * This function assigns an index to a \ref cardano_transaction_input_t object, specifying which output from a previously referenced transaction
+ * is to be used as an input. The index corresponds to the position of the output within the transaction.
+ *
+ * \param[in,out] transaction_input A pointer to an initialized \ref cardano_transaction_input_t object to which the index will be set.
+ * \param[in] index The index of the output in the previous transaction that is to be used as an input.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the index was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the transaction_input pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_t* transaction_input = ...; // Assume transaction_input is already initialized
+ * uint64_t index = 0; // Index of the output in the previous transaction
+ *
+ * cardano_error_t result = cardano_transaction_input_set_index(transaction_input, index);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Index set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the index.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_input_set_index(cardano_transaction_input_t* transaction_input, uint64_t index);
+
+/**
+ * \brief Compares two transaction input objects for equality.
+ *
+ * This function compares two transaction input objects to determine if they are equal.
+ *
+ * \param[in] lhs Pointer to the first transaction input object.
+ * \param[in] rhs Pointer to the second transaction input object.
+ *
+ * \return \c true if the transaction_input objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_t* transaction_input1 = NULL;
+ * cardano_transaction_input_t* transaction_input2 = NULL;
+ *
+ * // Assume transaction_input1 and transaction_input2 are initialized properly
+ *
+ * bool are_equal = cardano_transaction_input_equals(transaction_input1, transaction_input2);
+ *
+ * if (are_equal)
+ * {
+ *   printf("The transaction_input objects are equal.\n");
+ * }
+ * else
+ * {
+ *   printf("The transaction_input objects are not equal.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_transaction_input_unref(&transaction_input1);
+ * cardano_transaction_input_unref(&transaction_input2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_transaction_input_equals(const cardano_transaction_input_t* lhs, const cardano_transaction_input_t* rhs);
+
+/**
+ * \brief Compares two transaction input objects.
+ *
+ * This function compares two transaction input objects using their ids and index and returns an integer indicating
+ * their relative order.
+ *
+ * \param[in] lhs Pointer to the first transaction input object.
+ * \param[in] rhs Pointer to the second transaction input object.
+ *
+ * \return A negative value if lhs is less than rhs, zero if they are equal, and a positive value if lhs is greater than rhs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_t* input1 = NULL;
+ * cardano_transaction_input_t* input2 = NULL;
+ *
+ * // Assume input1 and input2 are initialized properly
+ *
+ * int32_t comparison = cardano_transaction_input_compare(input1, input2);
+ * if (comparison < 0)
+ * {
+ *   printf("input1 is less than input2.\n");
+ * }
+ * else if (comparison == 0)
+ * {
+ *   printf("input1 is equal to input2.\n");
+ * }
+ * else
+ * {
+ *   printf("input1 is greater than input2.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_transaction_input_unref(&input1);
+ * cardano_transaction_input_unref(&input2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT int32_t cardano_transaction_input_compare(
+  const cardano_transaction_input_t* lhs,
+  const cardano_transaction_input_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a cardano_transaction_input_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_transaction_input_t object
+ * by decreasing its reference count. When the reference count reaches zero, the transaction_input is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] transaction_input A pointer to the pointer of the transaction_input object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_t* transaction_input = cardano_transaction_input_new(major, minor);
+ *
+ * // Perform operations with the transaction_input...
+ *
+ * cardano_transaction_input_unref(&transaction_input);
+ * // At this point, transaction_input is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_transaction_input_unref, the pointer to the \ref cardano_transaction_input_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_transaction_input_unref(cardano_transaction_input_t** transaction_input);
+
+/**
+ * \brief Increases the reference count of the cardano_transaction_input_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_transaction_input_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_transaction_input_unref.
+ *
+ * \param transaction_input A pointer to the cardano_transaction_input_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_input is a previously created transaction_input object
+ *
+ * cardano_transaction_input_ref(transaction_input);
+ *
+ * // Now transaction_input can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_transaction_input_ref there is a corresponding
+ * call to \ref cardano_transaction_input_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_transaction_input_ref(cardano_transaction_input_t* transaction_input);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_transaction_input_t object.
+ *
+ * This function returns the number of active references to an cardano_transaction_input_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_transaction_input_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param transaction_input A pointer to the cardano_transaction_input_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_transaction_input_t object. If the object
+ * is properly managed (i.e., every \ref cardano_transaction_input_ref call is matched with a
+ * \ref cardano_transaction_input_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_input is a previously created transaction_input object
+ *
+ * size_t ref_count = cardano_transaction_input_refcount(transaction_input);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_transaction_input_refcount(const cardano_transaction_input_t* transaction_input);
+
+/**
+ * \brief Sets the last error message for a given cardano_transaction_input_t object.
+ *
+ * Records an error message in the transaction_input's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] transaction_input A pointer to the \ref cardano_transaction_input_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the transaction_input's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_transaction_input_set_last_error(
+  cardano_transaction_input_t* transaction_input,
+  const char*                  message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific transaction_input.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_transaction_input_set_last_error for the given
+ * transaction_input. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] transaction_input A pointer to the \ref cardano_transaction_input_t instance whose last error
+ *                   message is to be retrieved. If the transaction_input is NULL, the function
+ *                   returns a generic error message indicating the null transaction_input.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified transaction_input. If the transaction_input is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_transaction_input_set_last_error for the same transaction_input, or until
+ *       the transaction_input is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_transaction_input_get_last_error(
+  const cardano_transaction_input_t* transaction_input);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_transaction_input_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_transaction_input_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_input_deep_clone(const cardano_transaction_input_t* source, cardano_transaction_input_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_INPUT_H
diff --git a/vendor/include/cardano/transaction_body/transaction_input_set.h b/vendor/include/cardano/transaction_body/transaction_input_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/transaction_input_set.h
@@ -0,0 +1,472 @@
+/**
+ * \file transaction_input_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 05, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_INPUT_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_INPUT_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/transaction_body/transaction_input.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a reference to an unspent transaction output (UTxO) from a previous
+ * transaction, which the current transaction intends to spend.
+ */
+typedef struct cardano_transaction_input_t cardano_transaction_input_t;
+
+/**
+ * \brief Represents a set of transaction_inputs.
+ */
+typedef struct cardano_transaction_input_set_t cardano_transaction_input_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a transaction_input_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_transaction_input_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] transaction_input_set On successful initialization, this will point to a newly created
+ *             \ref cardano_transaction_input_set_t object. This object represents a "strong reference"
+ *             to the transaction_input_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the transaction_input_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_transaction_input_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction_input_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_set_t* transaction_input_set = NULL;
+ *
+ * // Attempt to create a new transaction_input_set
+ * cardano_error_t result = cardano_transaction_input_set_new(&transaction_input_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction_input_set
+ *
+ *   // Once done, ensure to clean up and release the transaction_input_set
+ *   cardano_transaction_input_set_unref(&transaction_input_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_input_set_new(cardano_transaction_input_set_t** transaction_input_set);
+
+/**
+ * \brief Creates a transaction_input set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_transaction_input_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a transaction_input.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded transaction_input data.
+ * \param[out] transaction_inputs A pointer to a pointer of \ref cardano_transaction_input_set_t that will be set to the address
+ *                        of the newly created transaction_input object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the transaction_input was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_transaction_input_set_t object by calling
+ *       \ref cardano_transaction_input_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_transaction_input_set_t* transaction_input = NULL;
+ *
+ * cardano_error_t result = cardano_transaction_input_set_from_cbor(reader, &transaction_input);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction_input
+ *
+ *   // Once done, ensure to clean up and release the transaction_input
+ *   cardano_transaction_input_set_unref(&transaction_input);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode transaction_input: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_input_set_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_input_set_t** transaction_inputs);
+
+/**
+ * \brief Serializes a transaction_input into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_transaction_input_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] transaction_inputs A constant pointer to the \ref cardano_transaction_input_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p transaction_input or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_set_t* transaction_input = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_transaction_input_set_to_cbor(transaction_input, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_transaction_input_set_unref(&transaction_input);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_input_set_to_cbor(
+  const cardano_transaction_input_set_t* transaction_inputs,
+  cardano_cbor_writer_t*                 writer);
+
+/**
+ * \brief Serializes a set of transaction inputs to a CIP-116 JSON array.
+ *
+ * This function iterates over the set and serializes each \ref cardano_transaction_input_t
+ * into a JSON array.
+ *
+ * \param[in]  set     Pointer to a valid \ref cardano_transaction_input_set_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p set or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_input_set_to_cip116_json(
+  const cardano_transaction_input_set_t* set,
+  cardano_json_writer_t*                 writer);
+
+/**
+ * \brief Retrieves the length of a transaction_input list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_transaction_input_set_t object.
+ *
+ * \param[in] transaction_input_set A constant pointer to the \ref cardano_transaction_input_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the transaction_input_set. Return 0 if the transaction_input_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_set_t* transaction_input_set = cardano_transaction_input_set_new();
+ *
+ * // Populate transaction_input_set with elements
+ *
+ * size_t length = cardano_transaction_input_set_get_length(transaction_input_set);
+ * printf("Length of the transaction_input_set: %zu\n", length);
+ *
+ * // Clean up the transaction_input_set object once done
+ * cardano_transaction_input_set_unref(&transaction_input_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_transaction_input_set_get_length(const cardano_transaction_input_set_t* transaction_input_set);
+
+/**
+ * \brief Retrieves an element from a transaction_input list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_transaction_input_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] transaction_input_set A constant pointer to the \ref cardano_transaction_input_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the transaction_input list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_transaction_input_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_transaction_input_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_set_t* transaction_input_set = cardano_transaction_input_set_new();
+ *
+ * // Populate transaction_input_set with elements
+ *
+ * cardano_transaction_input_t* element = NULL;
+ * cardano_error_t result = cardano_transaction_input_set_get(transaction_input_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_transaction_input_unref(&element);
+ * }
+ *
+ * // Clean up the transaction_input_set object once done
+ * cardano_transaction_input_set_unref(&transaction_input_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_input_set_get(const cardano_transaction_input_set_t* transaction_input_set, size_t index, cardano_transaction_input_t** element);
+
+/**
+ * \brief Adds an element to a transaction_input list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_transaction_input_set_t object.
+ *
+ * \param[in] transaction_input_set A constant pointer to the \ref cardano_transaction_input_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_transaction_input_t object that is to be added to the transaction_input_set.
+ *                    The element will be referenced by the transaction_input_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the transaction_input_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_set_t* transaction_input_set = cardano_transaction_input_set_new();
+ *
+ * // Create and initialize a new transaction_input element
+ * cardano_transaction_input_t* element = { ... };
+ *
+ * // Add the element to the transaction_input_set
+ * cardano_error_t result = cardano_transaction_input_set_add(transaction_input_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the transaction_input_set object once done
+ * cardano_transaction_input_set_unref(&transaction_input_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_input_set_add(cardano_transaction_input_set_t* transaction_input_set, cardano_transaction_input_t* element);
+
+/**
+ * \brief Determines if the transaction input set uses tags in its encoding.
+ *
+ * This function checks whether the given \ref cardano_transaction_input_set_t object
+ * uses the new Conway era encoding for sets, which are collections identified by a tag.
+ *
+ * \param[in] transaction_input_set A pointer to an initialized \ref cardano_transaction_input_set_t object.
+ *
+ * \return A boolean value:
+ *         - \c true if the transaction input set uses the Conway era encoding for sets (tagged sets).
+ *         - \c false if the transaction input set uses the older encoding (arrays without tags).
+ *
+ * \note This function helps in determining the serialization format of the transaction input set,
+ *       which may be necessary for compatibility with other transaction encoders/decoders.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_set_t* transaction_input_set = ...; // Assume transaction_input_set is already initialized
+ * bool is_tagged_set = cardano_transaction_input_set_is_tagged(transaction_input_set);
+ *
+ * if (is_tagged_set)
+ * {
+ *   printf("The transaction input set uses Conway era tag for sets.\n");
+ * }
+ * else
+ * {
+ *   printf("The transaction input set uses pre-Conway era encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_transaction_input_set_is_tagged(cardano_transaction_input_set_t* transaction_input_set);
+
+/**
+ * \brief Decrements the reference count of a transaction_input_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_transaction_input_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the transaction_input_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] transaction_input_set A pointer to the pointer of the transaction_input_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_input_set_t* transaction_input_set = cardano_transaction_input_set_new();
+ *
+ * // Perform operations with the transaction_input_set...
+ *
+ * cardano_transaction_input_set_unref(&transaction_input_set);
+ * // At this point, transaction_input_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_transaction_input_set_unref, the pointer to the \ref cardano_transaction_input_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_transaction_input_set_unref(cardano_transaction_input_set_t** transaction_input_set);
+
+/**
+ * \brief Increases the reference count of the cardano_transaction_input_set_t object.
+ *
+ * This function is used to manually increment the reference count of a transaction_input_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_transaction_input_set_unref.
+ *
+ * \param transaction_input_set A pointer to the transaction_input_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_input_set is a previously created transaction_input_set object
+ *
+ * cardano_transaction_input_set_ref(transaction_input_set);
+ *
+ * // Now transaction_input_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_transaction_input_set_ref there is a corresponding
+ * call to \ref cardano_transaction_input_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_transaction_input_set_ref(cardano_transaction_input_set_t* transaction_input_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_transaction_input_set_t object.
+ *
+ * This function returns the number of active references to a transaction_input_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_transaction_input_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param transaction_input_set A pointer to the transaction_input_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified transaction_input_set object. If the object
+ * is properly managed (i.e., every \ref cardano_transaction_input_set_ref call is matched with a
+ * \ref cardano_transaction_input_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_input_set is a previously created transaction_input_set object
+ *
+ * size_t ref_count = cardano_transaction_input_set_refcount(transaction_input_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_transaction_input_set_refcount(const cardano_transaction_input_set_t* transaction_input_set);
+
+/**
+ * \brief Sets the last error message for a given transaction_input_set object.
+ *
+ * Records an error message in the transaction_input_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] transaction_input_set A pointer to the \ref cardano_transaction_input_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the transaction_input_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_transaction_input_set_set_last_error(cardano_transaction_input_set_t* transaction_input_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific transaction_input_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_transaction_input_set_set_last_error for the given
+ * transaction_input_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] transaction_input_set A pointer to the \ref cardano_transaction_input_set_t instance whose last error
+ *                   message is to be retrieved. If the transaction_input_set is NULL, the function
+ *                   returns a generic error message indicating the null transaction_input_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified transaction_input_set. If the transaction_input_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_transaction_input_set_set_last_error for the same transaction_input_set, or until
+ *       the transaction_input_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_transaction_input_set_get_last_error(const cardano_transaction_input_set_t* transaction_input_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_transaction_input_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_transaction_input_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_input_set_deep_clone(const cardano_transaction_input_set_t* source, cardano_transaction_input_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_INPUT_SET_H
diff --git a/vendor/include/cardano/transaction_body/transaction_output.h b/vendor/include/cardano/transaction_body/transaction_output.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/transaction_output.h
@@ -0,0 +1,676 @@
+/**
+ * \file transaction_output.h
+ *
+ * \author angel.castillo
+ * \date   Sep 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_OUTPUT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_OUTPUT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/datum.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/scripts/script.h>
+#include <cardano/transaction_body/value.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A transaction output object includes the address which represents a public key
+ * hash or a script hash that can unlock the output, and the funds that are held
+ * inside.
+ */
+typedef struct cardano_transaction_output_t cardano_transaction_output_t;
+
+/**
+ * \brief Creates and initializes a new instance of a transaction output.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_transaction_output_t object,
+ * which represents an output of a transaction in the Cardano network.
+ *
+ * \param[in] address A pointer to a \ref cardano_address_t object representing the recipient's address.
+ * \param[in] amount The amount of ADA in lovelaces that the output will hold.
+ * \param[out] transaction_output On successful initialization, this will point to a newly created
+ *             \ref cardano_transaction_output_t object. This object represents a "strong reference",
+ *             meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the transaction output is no longer needed, the caller must release it
+ *             by calling \ref cardano_transaction_output_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the transaction output was successfully created, or an appropriate error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the input address pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_address_t* address = ...; // Assume address is already initialized
+ * uint64_t amount = 1000000; // 1 ADA in lovelaces
+ *
+ * cardano_transaction_output_t* transaction_output = NULL;
+ * cardano_error_t result = cardano_transaction_output_new(address, amount, &transaction_output);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction output
+ *   // Free resources when done
+ *   cardano_transaction_output_unref(&transaction_output);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the transaction output: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_address_unref(&address); // Cleanup the address object
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_output_new(
+  cardano_address_t*             address,
+  uint64_t                       amount,
+  cardano_transaction_output_t** transaction_output);
+
+/**
+ * \brief Creates a \ref cardano_transaction_output_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_transaction_output_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a transaction_output.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] transaction_output A pointer to a pointer of \ref cardano_transaction_output_t that will be set to the address
+ *                        of the newly created transaction_output object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the transaction output were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_transaction_output_t object by calling
+ *       \ref cardano_transaction_output_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_transaction_output_t* transaction_output = NULL;
+ *
+ * cardano_error_t result = cardano_transaction_output_from_cbor(reader, &transaction_output);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction_output
+ *
+ *   // Once done, ensure to clean up and release the transaction_output
+ *   cardano_transaction_output_unref(&transaction_output);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode transaction_output: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_output_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_output_t** transaction_output);
+
+/**
+ * \brief Serializes transaction output into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_transaction_output_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] transaction_output A constant pointer to the \ref cardano_transaction_output_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p transaction_output or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* transaction_output = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_transaction_output_to_cbor(transaction_output, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_transaction_output_unref(&transaction_output);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_output_to_cbor(
+  const cardano_transaction_output_t* transaction_output,
+  cardano_cbor_writer_t*              writer);
+
+/**
+ * \brief Serializes a transaction output to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "address", "amount", "plutus_data" (if present),
+ * "script_ref" (if present).
+ *
+ * \param[in]  output  Pointer to a valid \ref cardano_transaction_output_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p output or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_output_to_cip116_json(
+  const cardano_transaction_output_t* output,
+  cardano_json_writer_t*              writer);
+
+/**
+ * \brief Retrieves the address associated with a transaction output.
+ *
+ * This function fetches the address from a given \ref cardano_transaction_output_t object. The address indicates
+ * the recipient of the funds specified in the output of a transaction.
+ *
+ * \param[in] output A pointer to an initialized \ref cardano_transaction_output_t object.
+ *
+ * \return A pointer to the \ref cardano_address_t object representing the address. If the output pointer is NULL, this function returns NULL.
+ *         Note that the returned address is a new reference and must be released using \ref cardano_address_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* output = ...; // Assume output is already initialized
+ * cardano_address_t* address = cardano_transaction_output_get_address(output);
+ *
+ * if (address != NULL)
+ * {
+ *   // Process the address
+ *   cardano_address_unref(&address);  // Release the address when done
+ * }
+ * else
+ * {
+ *   printf("Invalid transaction output or uninitialized output.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_address_t* cardano_transaction_output_get_address(cardano_transaction_output_t* output);
+
+/**
+ * \brief Sets the address for a transaction output.
+ *
+ * This function assigns a new address to a \ref cardano_transaction_output_t object.
+ * The address is where the output, holding certain funds or assets, is intended to be sent.
+ *
+ * \param[in,out] output A pointer to an initialized \ref cardano_transaction_output_t object to which the address will be set.
+ * \param[in] address A pointer to an initialized \ref cardano_address_t object representing the address.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the address
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note This function increases the reference count of the address object; therefore, the caller retains ownership of their respective references.
+ *       It is the caller's responsibility to release their reference to the address when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* output = ...; // Assume output is already initialized
+ * cardano_address_t* address = ...; // Assume address is initialized
+ *
+ * cardano_error_t result = cardano_transaction_output_set_address(output, address);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The address is now set for the output
+ * }
+ * else
+ * {
+ *   printf("Failed to set the address.\n");
+ * }
+ *
+ * // Clean up resources
+ * cardano_address_unref(&address);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_output_set_address(cardano_transaction_output_t* output, cardano_address_t* address);
+
+/**
+ * \brief Retrieves the value held by a transaction output.
+ *
+ * This function fetches the value contained in the transaction output.
+ *
+ * \param[in] output A constant pointer to an initialized \ref cardano_transaction_output_t object.
+ *
+ * \return The value contained in the transaction output. If the output pointer is NULL, the function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_transaction_output_t* output = ...; // Assume output is already initialized
+ *
+ * cardano_value_t* value = cardano_transaction_output_get_value(output);
+ *
+ * if (value != NULL)
+ * {
+ *    // Process the value
+ *    cardano_value_unref(&amount); // Release the value when done
+ *  }
+ *  else
+ *  {
+ *    printf("Invalid transaction output or uninitialized output.\n");
+ *  }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_value_t* cardano_transaction_output_get_value(cardano_transaction_output_t* output);
+
+/**
+ * \brief Sets the value for a transaction output.
+ *
+ * This function assigns a specified value to a \ref cardano_transaction_output_t object.
+ *
+ * \param[in,out] output A pointer to an initialized \ref cardano_transaction_output_t object to which the amount will be set.
+ * \param[in] value The value to set for the transaction output.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the amount was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the output pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* output = ...; // Assume output is already initialized
+ * cardano_value_t* value = {...};
+ *
+ * cardano_error_t result = cardano_transaction_output_set_amount(output, value);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Amount set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the amount.\n");
+ * }
+ *
+ * // Release the value when done
+ * cardano_value_unref(&value);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_output_set_value(cardano_transaction_output_t* output, cardano_value_t* value);
+
+/**
+ * \brief Retrieves the datum associated with a transaction output.
+ *
+ * This function fetches the datum from a given \ref cardano_transaction_output_t object. A datum is optional state data
+ * associated with a transaction output that can be utilized by Plutus scripts to dictate transaction validity based on
+ * script logic. This function is used primarily in the context of transactions involving smart contracts on the Cardano network.
+ *
+ * \param[in] output A pointer to an initialized \ref cardano_transaction_output_t object from which the datum is retrieved.
+ *
+ * \return A pointer to the \ref cardano_datum_t object representing the datum, or NULL if no datum is associated with the transaction output.
+ *         Note that the returned datum is a new reference and must be released using \ref cardano_datum_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* output = ...; // Assume output is already initialized
+ * cardano_datum_t* datum = cardano_transaction_output_get_datum(output);
+ *
+ * if (datum != NULL)
+ * {
+ *   // Process the datum
+ *   cardano_datum_unref(&datum);
+ * }
+ * else
+ * {
+ *   printf("No datum associated with this output.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_datum_t* cardano_transaction_output_get_datum(cardano_transaction_output_t* output);
+
+/**
+ * \brief Sets the datum for a transaction output.
+ *
+ * This function assigns a datum to a \ref cardano_transaction_output_t object. A datum is a piece of state data
+ * that can be used by Plutus scripts to influence the behavior of smart contracts on the Cardano network.
+ * The datum is optional and can be set to NULL to indicate that no datum is associated with the transaction output.
+ *
+ * \param[in,out] output A pointer to an initialized \ref cardano_transaction_output_t object to which the datum will be set.
+ * \param[in] datum A pointer to an initialized \ref cardano_datum_t object representing the datum to be associated with the output.
+ *                  This parameter can be NULL if the datum is to be removed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the datum was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the output pointer is NULL.
+ *
+ * \note This function increases the reference count of the datum object; therefore, the caller retains ownership of their respective references.
+ *       It is the caller's responsibility to release their reference to the datum when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* output = ...; // Assume output is already initialized
+ * cardano_datum_t* datum = cardano_datum_new(...); // Assume datum is initialized, or NULL to unset
+ *
+ * cardano_error_t result = cardano_transaction_output_set_datum(output, datum);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Datum set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the datum.\n");
+ * }
+ *
+ * // If datum is not NULL, release it after setting
+ * if (datum)
+ * {
+ *   cardano_datum_unref(&datum);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_output_set_datum(cardano_transaction_output_t* output, cardano_datum_t* datum);
+
+/**
+ * \brief Retrieves the script reference from a transaction output.
+ *
+ * This function fetches the script reference from a specified \ref cardano_transaction_output_t object.
+ * A script reference is a mechanism in Cardano that allows transactions to refer to scripts included in other outputs.
+ * By using script references, a transaction can fulfill script execution requirements without directly including the script,
+ * thereby reducing transaction size and simplifying script management.
+ *
+ * \param[in] output A pointer to an initialized \ref cardano_transaction_output_t object from which the script reference is to be retrieved.
+ *
+ * \return A pointer to the \ref cardano_script_t object representing the script reference. If the output does not contain a script reference,
+ *         this function returns NULL. Note that the returned script reference is a new reference and must be released using
+ *         \ref cardano_script_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* output = ...; // Assume output is already initialized
+ * cardano_script_t* script_ref = cardano_transaction_output_get_script_ref(output);
+ *
+ * if (script_ref != NULL)
+ * {
+ *   // Process the script reference
+ *   cardano_script_unref(&script_ref);
+ * }
+ * else
+ * {
+ *   printf("No script reference found in this output.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_script_t* cardano_transaction_output_get_script_ref(cardano_transaction_output_t* output);
+
+/**
+ * \brief Compares two transaction output objects for equality.
+ *
+ * This function compares two transaction output objects to determine if they are equal.
+ *
+ * \param[in] lhs Pointer to the first transaction output object.
+ * \param[in] rhs Pointer to the second transaction output object.
+ *
+ * \return \c true if the transaction_output objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* transaction_output1 = NULL;
+ * cardano_transaction_output_t* transaction_output2 = NULL;
+ *
+ * // Assume transaction_output1 and transaction_output2 are initialized properly
+ *
+ * bool are_equal = cardano_transaction_output_equals(transaction_output1, transaction_output2);
+ *
+ * if (are_equal)
+ * {
+ *   printf("The transaction_output objects are equal.\n");
+ * }
+ * else
+ * {
+ *   printf("The transaction_output objects are not equal.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_transaction_output_unref(&transaction_output1);
+ * cardano_transaction_output_unref(&transaction_output2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_transaction_output_equals(const cardano_transaction_output_t* lhs, const cardano_transaction_output_t* rhs);
+
+/**
+ * \brief Sets the script reference for a transaction output.
+ *
+ * This function assigns a script reference to a specified \ref cardano_transaction_output_t object.
+ * A script reference allows a transaction output to indirectly satisfy script execution requirements by referencing
+ * a script present in another output. This capability can lead to more efficient transaction sizes and simplified
+ * script management by reusing existing scripts.
+ *
+ * \param[in,out] output A pointer to an initialized \ref cardano_transaction_output_t object to which the script reference will be set.
+ * \param[in] script_ref A pointer to an initialized \ref cardano_script_t object representing the script reference. This parameter
+ *                       can be NULL if the intention is to remove an existing script reference from the output.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the script reference
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the output pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* output = ...; // Assume output is already initialized
+ * cardano_script_t* script_ref = ...; // Assume script_ref is initialized or NULL to remove the reference
+ *
+ * cardano_error_t result = cardano_transaction_output_set_script_ref(output, script_ref);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Script reference set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the script reference.\n");
+ * }
+ *
+ * // Note: Cleanup the script reference if it was newly created and is no longer needed
+ * if (script_ref)
+ * {
+ *   cardano_script_unref(&script_ref);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_output_set_script_ref(cardano_transaction_output_t* output, cardano_script_t* script_ref);
+
+/**
+ * \brief Decrements the reference count of a cardano_transaction_output_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_transaction_output_t object
+ * by decreasing its reference count. When the reference count reaches zero, the transaction_output is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] transaction_output A pointer to the pointer of the transaction_output object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* transaction_output = cardano_transaction_output_new(major, minor);
+ *
+ * // Perform operations with the transaction_output...
+ *
+ * cardano_transaction_output_unref(&transaction_output);
+ * // At this point, transaction_output is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_transaction_output_unref, the pointer to the \ref cardano_transaction_output_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_transaction_output_unref(cardano_transaction_output_t** transaction_output);
+
+/**
+ * \brief Increases the reference count of the cardano_transaction_output_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_transaction_output_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_transaction_output_unref.
+ *
+ * \param transaction_output A pointer to the cardano_transaction_output_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_output is a previously created transaction_output object
+ *
+ * cardano_transaction_output_ref(transaction_output);
+ *
+ * // Now transaction_output can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_transaction_output_ref there is a corresponding
+ * call to \ref cardano_transaction_output_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_transaction_output_ref(cardano_transaction_output_t* transaction_output);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_transaction_output_t object.
+ *
+ * This function returns the number of active references to an cardano_transaction_output_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_transaction_output_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param transaction_output A pointer to the cardano_transaction_output_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_transaction_output_t object. If the object
+ * is properly managed (i.e., every \ref cardano_transaction_output_ref call is matched with a
+ * \ref cardano_transaction_output_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_output is a previously created transaction_output object
+ *
+ * size_t ref_count = cardano_transaction_output_refcount(transaction_output);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_transaction_output_refcount(const cardano_transaction_output_t* transaction_output);
+
+/**
+ * \brief Sets the last error message for a given cardano_transaction_output_t object.
+ *
+ * Records an error message in the transaction_output's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] transaction_output A pointer to the \ref cardano_transaction_output_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the transaction_output's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_transaction_output_set_last_error(
+  cardano_transaction_output_t* transaction_output,
+  const char*                   message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific transaction_output.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_transaction_output_set_last_error for the given
+ * transaction_output. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] transaction_output A pointer to the \ref cardano_transaction_output_t instance whose last error
+ *                   message is to be retrieved. If the transaction_output is NULL, the function
+ *                   returns a generic error message indicating the null transaction_output.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified transaction_output. If the transaction_output is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_transaction_output_set_last_error for the same transaction_output, or until
+ *       the transaction_output is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_transaction_output_get_last_error(
+  const cardano_transaction_output_t* transaction_output);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_transaction_output_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_transaction_output_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_output_deep_clone(const cardano_transaction_output_t* source, cardano_transaction_output_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_OUTPUT_H
diff --git a/vendor/include/cardano/transaction_body/transaction_output_list.h b/vendor/include/cardano/transaction_body/transaction_output_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/transaction_output_list.h
@@ -0,0 +1,439 @@
+/**
+ * \file transaction_output_list.h
+ *
+ * \author angel.castillo
+ * \date   Sep 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_OUTPUT_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_OUTPUT_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A transaction output object includes the address which represents a public key
+ * hash or a script hash that can unlock the output, and the funds that are held
+ * inside.
+ */
+typedef struct cardano_transaction_output_t cardano_transaction_output_t;
+
+/**
+ * \brief Represents a list of transaction outputs.
+ */
+typedef struct cardano_transaction_output_list_t cardano_transaction_output_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a transaction_output_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_transaction_output_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] transaction_output_list On successful initialization, this will point to a newly created
+ *             \ref cardano_transaction_output_list_t object. This object represents a "strong reference"
+ *             to the transaction_output_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the transaction_output_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_transaction_output_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction_output_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_list_t* transaction_output_list = NULL;
+ *
+ * // Attempt to create a new transaction_output_list
+ * cardano_error_t result = cardano_transaction_output_list_new(&transaction_output_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction_output_list
+ *
+ *   // Once done, ensure to clean up and release the transaction_output_list
+ *   cardano_transaction_output_list_unref(&transaction_output_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_output_list_new(cardano_transaction_output_list_t** transaction_output_list);
+
+/**
+ * \brief Creates a transaction output list from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_transaction_output_list_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a transaction_output.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded transaction_output data.
+ * \param[out] transaction_outputs A pointer to a pointer of \ref cardano_transaction_output_list_t that will be set to the address
+ *                        of the newly created transaction_output object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the transaction_output was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_transaction_output_list_t object by calling
+ *       \ref cardano_transaction_output_list_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_transaction_output_list_t* transaction_output = NULL;
+ *
+ * cardano_error_t result = cardano_transaction_output_list_from_cbor(reader, &transaction_output);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the transaction_output
+ *
+ *   // Once done, ensure to clean up and release the transaction_output
+ *   cardano_transaction_output_list_unref(&transaction_output);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode transaction_output: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_output_list_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_output_list_t** transaction_outputs);
+
+/**
+ * \brief Serializes a transaction_output into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_transaction_output_list_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] transaction_outputs A constant pointer to the \ref cardano_transaction_output_list_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p transaction_output or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_list_t* transaction_output = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_transaction_output_list_to_cbor(transaction_output, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_transaction_output_list_unref(&transaction_output);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_output_list_to_cbor(
+  const cardano_transaction_output_list_t* transaction_outputs,
+  cardano_cbor_writer_t*                   writer);
+
+/**
+ * \brief Serializes a list of transaction outputs to a CIP-116 JSON array.
+ *
+ * This function iterates over the list and serializes each \ref cardano_transaction_output_t
+ * into a JSON array.
+ *
+ * \param[in]  list    Pointer to a valid \ref cardano_transaction_output_list_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p list or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_output_list_to_cip116_json(
+  const cardano_transaction_output_list_t* list,
+  cardano_json_writer_t*                   writer);
+
+/**
+ * \brief Retrieves the length of a transaction output list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_transaction_output_list_t object.
+ *
+ * \param[in] transaction_output_list A constant pointer to the \ref cardano_transaction_output_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the transaction_output_list. Return 0 if the transaction_output_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_list_t* transaction_output_list = cardano_transaction_output_list_new();
+ *
+ * // Populate transaction_output_list with elements
+ *
+ * size_t length = cardano_transaction_output_list_get_length(transaction_output_list);
+ * printf("Length of the transaction_output_list: %zu\n", length);
+ *
+ * // Clean up the transaction_output_list object once done
+ * cardano_transaction_output_list_unref(&transaction_output_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_transaction_output_list_get_length(const cardano_transaction_output_list_t* transaction_output_list);
+
+/**
+ * \brief Retrieves an element from a transaction output list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_transaction_output_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] transaction_output_list A constant pointer to the \ref cardano_transaction_output_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the transaction output list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_transaction_output_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_transaction_output_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_list_t* transaction_output_list = cardano_transaction_output_list_new();
+ *
+ * // Populate transaction_output_list with elements
+ *
+ * cardano_transaction_output_t* element = NULL;
+ * cardano_error_t result = cardano_transaction_output_list_get(transaction_output_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_transaction_output_unref(&element);
+ * }
+ *
+ * // Clean up the transaction_output_list object once done
+ * cardano_transaction_output_list_unref(&transaction_output_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_output_list_get(const cardano_transaction_output_list_t* transaction_output_list, size_t index, cardano_transaction_output_t** element);
+
+/**
+ * \brief Adds an element to a transaction output list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_transaction_output_list_t object.
+ *
+ * \param[in] transaction_output_list A constant pointer to the \ref cardano_transaction_output_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_transaction_output_t object that is to be added to the transaction_output_list.
+ *                    The element will be referenced by the transaction_output_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the transaction_output_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_list_t* transaction_output_list = cardano_transaction_output_list_new();
+ *
+ * // Create and initialize a new transaction output element
+ * cardano_transaction_output_t* element = { ... };
+ *
+ * // Add the element to the transaction_output_list
+ * cardano_error_t result = cardano_transaction_output_list_add(transaction_output_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the transaction_output_list object once done
+ * cardano_transaction_output_list_unref(&transaction_output_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_transaction_output_list_add(cardano_transaction_output_list_t* transaction_output_list, cardano_transaction_output_t* element);
+
+/**
+ * \brief Decrements the reference count of a transaction_output_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_transaction_output_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the transaction_output_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] transaction_output_list A pointer to the pointer of the transaction_output_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_list_t* transaction_output_list = cardano_transaction_output_list_new();
+ *
+ * // Perform operations with the transaction_output_list...
+ *
+ * cardano_transaction_output_list_unref(&transaction_output_list);
+ * // At this point, transaction_output_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_transaction_output_list_unref, the pointer to the \ref cardano_transaction_output_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_transaction_output_list_unref(cardano_transaction_output_list_t** transaction_output_list);
+
+/**
+ * \brief Increases the reference count of the cardano_transaction_output_list_t object.
+ *
+ * This function is used to manually increment the reference count of a transaction_output_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_transaction_output_list_unref.
+ *
+ * \param transaction_output_list A pointer to the transaction_output_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_output_list is a previously created transaction_output_list object
+ *
+ * cardano_transaction_output_list_ref(transaction_output_list);
+ *
+ * // Now transaction_output_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_transaction_output_list_ref there is a corresponding
+ * call to \ref cardano_transaction_output_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_transaction_output_list_ref(cardano_transaction_output_list_t* transaction_output_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_transaction_output_list_t object.
+ *
+ * This function returns the number of active references to a transaction_output_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_transaction_output_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param transaction_output_list A pointer to the transaction_output_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified transaction_output_list object. If the object
+ * is properly managed (i.e., every \ref cardano_transaction_output_list_ref call is matched with a
+ * \ref cardano_transaction_output_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_output_list is a previously created transaction_output_list object
+ *
+ * size_t ref_count = cardano_transaction_output_list_refcount(transaction_output_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_transaction_output_list_refcount(const cardano_transaction_output_list_t* transaction_output_list);
+
+/**
+ * \brief Sets the last error message for a given transaction_output_list object.
+ *
+ * Records an error message in the transaction_output_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] transaction_output_list A pointer to the \ref cardano_transaction_output_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the transaction_output_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_transaction_output_list_set_last_error(cardano_transaction_output_list_t* transaction_output_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific transaction_output_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_transaction_output_list_set_last_error for the given
+ * transaction_output_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] transaction_output_list A pointer to the \ref cardano_transaction_output_list_t instance whose last error
+ *                   message is to be retrieved. If the transaction_output_list is NULL, the function
+ *                   returns a generic error message indicating the null transaction_output_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified transaction_output_list. If the transaction_output_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_transaction_output_list_set_last_error for the same transaction_output_list, or until
+ *       the transaction_output_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_transaction_output_list_get_last_error(const cardano_transaction_output_list_t* transaction_output_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_transaction_output_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_transaction_output_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_transaction_output_list_deep_clone(const cardano_transaction_output_list_t* source, cardano_transaction_output_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_OUTPUT_LIST_H
diff --git a/vendor/include/cardano/transaction_body/value.h b/vendor/include/cardano/transaction_body/value.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_body/value.h
@@ -0,0 +1,1263 @@
+/**
+ * \file value.h
+ *
+ * \author angel.castillo
+ * \date   Sep 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VALUE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VALUE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id_map.h>
+#include <cardano/assets/multi_asset.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A Value object encapsulates the quantity of assets of different types,
+ * including ADA (Cardano's native cryptocurrency) expressed in lovelace,
+ * where 1 ADA = 1,000,000 lovelace, and other native tokens. Each key in the
+ * tokens object is a unique identifier for an asset, and the corresponding
+ * value is the quantity of that asset.
+ */
+typedef struct cardano_value_t cardano_value_t;
+
+/**
+ * \brief Creates and initializes a new instance of the Cardano Value object.
+ *
+ * This function allocates and initializes a new instance of the \ref cardano_value_t object,
+ * which encapsulates the quantity of ADA (in lovelaces) and other native tokens as part of a transaction.
+ * Each asset in the multi-asset structure is indexed by a unique policy ID and asset name.
+ *
+ * \param[in] coin The quantity of ADA expressed in lovelaces, where 1 ADA = 1,000,000 lovelace.
+ * \param[in] assets A pointer to a \ref cardano_multi_asset_t object representing the other native tokens associated with the value.
+ *                   This parameter can be NULL if there are no additional native tokens to associate.
+ * \param[out] value On successful initialization, this will point to a newly created \ref cardano_value_t object.
+ *                   This object represents a "strong reference", meaning that it is fully initialized and ready for use.
+ *                   The caller is responsible for managing the lifecycle of this object.
+ *                   Specifically, once the Value is no longer needed, the caller must release it
+ *                   by calling \ref cardano_value_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the Value was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * int64_t coin = 1000000; // Equivalent to 1 ADA
+ * cardano_multi_asset_t* assets = cardano_multi_asset_new(...); // Assume assets are already initialized
+ * cardano_value_t* value = NULL;
+ *
+ * // Attempt to create a new Cardano Value object
+ * cardano_error_t result = cardano_value_new(coin, assets, &value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the value
+ *
+ *   // Once done, ensure to clean up and release the value
+ *   cardano_value_unref(&value);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the value object: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_multi_asset_unref(&assets); // Cleanup the multi-asset object
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_value_new(
+  int64_t                coin,
+  cardano_multi_asset_t* assets,
+  cardano_value_t**      value);
+
+/**
+ * \brief Creates a new `cardano_value_t` object initialized to zero.
+ *
+ * The `cardano_value_new_zero` function allocates and returns a new `cardano_value_t` object
+ * that represents a value initialized to zero for both ADA and any associated assets.
+ *
+ * \return A pointer to the newly created `cardano_value_t` object with zeroed values, or `NULL`
+ * if memory allocation fails.
+ *
+ * \note The caller is responsible for managing the memory of the returned `cardano_value_t` object
+ * and must call `cardano_value_unref` to properly release it when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = cardano_value_new_zero();
+ *
+ * if (value != NULL)
+ * {
+ *   // Successfully created a new zeroed value
+ *   // Use the `value` as needed
+ *
+ *   // Release the value object when done
+ *   cardano_value_unref(&value);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_value_t*
+cardano_value_new_zero(void);
+
+/**
+ * \brief Creates a new value instance from a specified amount of Lovelace.
+ *
+ * This function initializes a new `cardano_value_t` instance with a specific amount of Lovelace, allowing the caller
+ * to create a value that represents only ADA (without any multi-asset components).
+ *
+ * \param[in] lovelace The amount of Lovelace (smallest unit of ADA) to set for the new value instance.
+ *
+ * \returns A pointer to a newly created \ref cardano_value_t instance containing the specified amount of Lovelace,
+ *          or `NULL` if memory allocation fails.
+ *
+ * Usage Example:
+ * \code{.c}
+ * int64_t lovelace_amount = 1000000; // 1 ADA in Lovelace
+ * cardano_value_t* value = cardano_value_new_from_coin(lovelace_amount);
+ *
+ * if (value != NULL)
+ * {
+ *     // Successfully created a value instance with 1 ADA
+ * }
+ *
+ * cardano_value_unref(&value);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_value_t*
+cardano_value_new_from_coin(int64_t lovelace);
+
+/**
+ * \brief Creates a \ref cardano_value_t from an asset map.
+ *
+ * This function creates a \ref cardano_value_t object from a given asset map (\ref cardano_asset_id_map_t).
+ * The resulting value represents the sum of the assets contained in the map, where each entry in the map is
+ * an asset ID and its corresponding quantity.
+ *
+ * \param[in] asset_map A pointer to an initialized \ref cardano_asset_id_map_t object containing the assets.
+ *                      This parameter must not be NULL.
+ * \param[out] value On successful creation, this will point to the newly created \ref cardano_value_t object.
+ *                   The caller is responsible for managing the lifecycle of the object and must call
+ *                   \ref cardano_value_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if
+ *         the value was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note The caller is responsible for managing the lifecycle of both the \ref cardano_value_t object and the \ref cardano_asset_id_map_t.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_asset_id_map_t* asset_map = ...; // Assume asset_map is initialized
+ * cardano_value_t* value = NULL;
+ *
+ * cardano_error_t result = cardano_value_from_asset_map(asset_map, &value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Value successfully created from asset map.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to create value from asset map.\n");
+ * }
+ *
+ * // Clean up when done
+ * cardano_asset_id_map_unref(&asset_map);
+ * cardano_value_unref(&value);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_value_from_asset_map(
+  cardano_asset_id_map_t* asset_map,
+  cardano_value_t**       value);
+
+/**
+ * \brief Creates a \ref cardano_value_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_value_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a value.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] value A pointer to a pointer of \ref cardano_value_t that will be set to the address
+ *                        of the newly created value object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the value were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_value_t object by calling
+ *       \ref cardano_value_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_value_t* value = NULL;
+ *
+ * cardano_error_t result = cardano_value_from_cbor(reader, &value);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the value
+ *
+ *   // Once done, ensure to clean up and release the value
+ *   cardano_value_unref(&value);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode value: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_value_from_cbor(cardano_cbor_reader_t* reader, cardano_value_t** value);
+
+/**
+ * \brief Serializes value into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_value_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] value A constant pointer to the \ref cardano_value_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p value or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark A value without assets encodes as a plain coin unsigned integer. A multi asset map is never
+ *         encoded empty; policies whose inner asset name maps are empty are not encoded either.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_value_to_cbor(value, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_value_unref(&value);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_value_to_cbor(
+  const cardano_value_t* value,
+  cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Serializes a value object to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "coin", then "assets" (if present).
+ *
+ * \param[in]  value   Pointer to a valid \ref cardano_value_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p value or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_value_to_cip116_json(
+  const cardano_value_t* value,
+  cardano_json_writer_t* writer);
+
+/**
+ * \brief Retrieves the multi-asset object associated with a value.
+ *
+ * This function fetches the multi-asset structure from a given \ref cardano_value_t object. The multi-asset structure contains
+ * various native tokens included in the value.
+ *
+ * \param[in] value A pointer to an initialized \ref cardano_value_t object.
+ *
+ * \return A pointer to the \ref cardano_multi_asset_t object representing the collection of native tokens. If the value pointer is NULL or does not contain any multi-assets, this function returns NULL.
+ *         Note that the returned multi-asset object is a new reference and must be released using \ref cardano_multi_asset_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = ...; // Assume value is already initialized
+ * cardano_multi_asset_t* multi_asset = cardano_value_get_multi_asset(value);
+ *
+ * if (multi_asset != NULL)
+ * {
+ *   // Process the multi-asset
+ *   // Once done, ensure to clean up and release the multi_asset
+ *   cardano_multi_asset_unref(&multi_asset);
+ * }
+ * else
+ * {
+ *   printf("No multi-asset associated with this value or uninitialized value.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_multi_asset_t* cardano_value_get_multi_asset(cardano_value_t* value);
+
+/**
+ * \brief Sets the multi-asset component for a Cardano value object.
+ *
+ * This function assigns a new multi-asset collection to a \ref cardano_value_t object.
+ * The multi-asset structure encapsulates various native tokens to be associated with the value.
+ *
+ * \param[in,out] value A pointer to an initialized \ref cardano_value_t object to which the multi-asset collection will be set.
+ * \param[in] assets A pointer to an initialized \ref cardano_multi_asset_t object representing the collection of native tokens.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the multi-asset
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note This function increases the reference count of the multi-asset object; therefore, the caller retains ownership of their respective references.
+ *       It is the caller's responsibility to release their reference to the multi-asset when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = ...; // Assume value is already initialized
+ * cardano_multi_asset_t* assets = ...; // Assume assets is initialized
+ *
+ * cardano_error_t result = cardano_value_set_multi_asset(value, assets);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The multi-asset is now set for the value
+ * }
+ * else
+ * {
+ *   printf("Failed to set the multi-asset.\n");
+ * }
+ *
+ * // Clean up resources
+ * cardano_multi_asset_unref(&assets);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_value_set_multi_asset(cardano_value_t* value, cardano_multi_asset_t* assets);
+
+/**
+ * \brief Retrieves the coin amount (in lovelaces) from a Cardano value object.
+ *
+ * This function fetches the ADA amount, expressed in lovelaces, from a given \ref cardano_value_t object.
+ * One ADA equals 1,000,000 lovelaces. This function is used to retrieve the amount of ADA, excluding any
+ * native tokens that might be part of the value.
+ *
+ * \param[in] value A constant pointer to an initialized \ref cardano_value_t object.
+ *
+ * \return The amount of ADA in lovelaces contained in the value object. If the input is NULL, the function
+ *         will return 0, which should be handled appropriately by the caller to distinguish from a genuine
+ *         coin value of 0 lovelaces.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_value_t* value = ...; // Assume value is already initialized
+ *
+ * int64_t coin = cardano_value_get_coin(value);
+ * printf("Coin amount: %llu lovelaces\n", coin);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT int64_t cardano_value_get_coin(const cardano_value_t* value);
+
+/**
+ * \brief Sets the coin amount (in lovelaces) for a Cardano value object.
+ *
+ * This function assigns a coin amount, expressed in lovelaces, to a \ref cardano_value_t object. One ADA equals 1,000,000 lovelaces.
+ * This amount specifies the quantity of ADA, excluding any native tokens, that will be set in the value object.
+ *
+ * \param[in,out] value A pointer to an initialized \ref cardano_value_t object to which the coin amount will be set.
+ * \param[in] coin The amount of ADA in lovelaces to set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the coin amount was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the value pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = ...; // Assume value is already initialized
+ * int64_t coin = 1000000; // Set 1 ADA
+ *
+ * cardano_error_t result = cardano_value_set_coin(value, coin);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Coin amount set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the coin amount.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_value_set_coin(cardano_value_t* value, int64_t coin);
+
+/**
+ * \brief Adds a specified coin amount to a Cardano value object.
+ *
+ * This function increments the coin amount (expressed in lovelaces) in a \ref cardano_value_t object by a specified value.
+ * The addition is performed in place, modifying the existing value object.
+ *
+ * \param[in,out] value A pointer to an initialized \ref cardano_value_t object whose coin amount will be increased.
+ *                      The pointer must not be NULL.
+ * \param[in] coin The amount of coin (in lovelaces) to add to the value object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the coin amount was
+ *         successfully added, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the value pointer is NULL, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if the addition results in an overflow.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = ...; // Assume value is already initialized
+ * int64_t coin_to_add = 500000; // Add 0.5 ADA (since 1 ADA = 1,000,000 lovelaces)
+ *
+ * cardano_error_t result = cardano_value_add_coin(value, coin_to_add);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Coin amount added successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to add the coin amount: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ *
+ * \note Be cautious of potential overflow when adding large coin amounts. The function will return \ref CARDANO_ERROR_INTEGER_OVERFLOW
+ *       if the new coin amount exceeds the maximum value representable by a 64-bit unsigned integer.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_value_add_coin(cardano_value_t* value, int64_t coin);
+
+/**
+ * \brief Subtracts a specified coin amount from a Cardano value object.
+ *
+ * This function decrements the coin amount (expressed in lovelaces) in a \ref cardano_value_t object by a specified value.
+ * The subtraction is performed in place, modifying the existing value object.
+ *
+ * \param[in,out] value A pointer to an initialized \ref cardano_value_t object whose coin amount will be decreased.
+ *                      The pointer must not be NULL.
+ * \param[in] coin The amount of coin (in lovelaces) to subtract from the value object.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the coin amount was
+ *         successfully subtracted, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the value pointer is NULL, or \ref CARDANO_ERROR_INTEGER_UNDERFLOW if the subtraction results in a negative coin amount.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = ...; // Assume value is already initialized
+ * int64_t coin_to_subtract = 500000; // Subtract 0.5 ADA (since 1 ADA = 1,000,000 lovelaces)
+ *
+ * cardano_error_t result = cardano_value_subtract_coin(value, coin_to_subtract);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Coin amount subtracted successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to subtract the coin amount: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ *
+ * \note Be cautious of potential underflow when subtracting coin amounts. The function will return \ref CARDANO_ERROR_INTEGER_UNDERFLOW
+ *       if the subtraction results in a negative coin amount, as coin amounts cannot be negative.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_value_subtract_coin(cardano_value_t* value, int64_t coin);
+
+/**
+ * \brief Adds a specified multi-asset collection to a Cardano value object.
+ *
+ * This function increments the multi-asset component in a \ref cardano_value_t object by adding the quantities
+ * of assets from a given \ref cardano_multi_asset_t object. The addition is performed in place, modifying the
+ * existing value object. If an asset exists in both the value and the multi-asset being added, their quantities
+ * are summed. Assets present only in the multi-asset being added are included in the value.
+ *
+ * \param[in,out] value A pointer to an initialized \ref cardano_value_t object whose multi-asset component will be increased.
+ *                      The pointer must not be NULL.
+ * \param[in] multi_asset A pointer to an initialized \ref cardano_multi_asset_t object containing the assets to add to the value.
+ *                        The pointer must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the multi-asset
+ *         was successfully added, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * \note The function handles the reference counting for the multi-asset components appropriately. The caller retains
+ *       ownership of the provided \p multi_asset and is responsible for releasing it when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = ...; // Assume value is already initialized
+ * cardano_multi_asset_t* multi_asset_to_add = ...; // Assume multi_asset_to_add is initialized
+ *
+ * cardano_error_t result = cardano_value_add_multi_asset(value, multi_asset_to_add);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Multi-asset added successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to add multi-asset: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources if needed
+ * cardano_multi_asset_unref(&multi_asset_to_add);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_value_add_multi_asset(cardano_value_t* value, cardano_multi_asset_t* multi_asset);
+
+/**
+ * \brief Subtracts a specified multi-asset collection from a Cardano value object.
+ *
+ * This function decrements the multi-asset component in a \ref cardano_value_t object by subtracting the quantities
+ * of assets from a given \ref cardano_multi_asset_t object. The subtraction is performed in place, modifying the
+ * existing value object.
+ *
+ * \param[in,out] value A pointer to an initialized \ref cardano_value_t object whose multi-asset component will be decreased.
+ *                      The pointer must not be NULL.
+ * \param[in] multi_asset A pointer to an initialized \ref cardano_multi_asset_t object containing the assets to subtract from the value.
+ *                        The pointer must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the multi-asset
+ *         was successfully subtracted, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if any of the input pointers are NULL.
+ *
+ * \note The function handles the reference counting for the multi-asset components appropriately. The caller retains
+ *       ownership of the provided \p multi_asset and is responsible for releasing it when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = ...; // Assume value is already initialized with some assets
+ * cardano_multi_asset_t* multi_asset_to_subtract = ...; // Assume multi_asset_to_subtract is initialized
+ *
+ * cardano_error_t result = cardano_value_subtract_multi_asset(value, multi_asset_to_subtract);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Multi-asset subtracted successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to subtract multi-asset: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Cleanup resources if needed
+ * cardano_multi_asset_unref(&multi_asset_to_subtract);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_value_subtract_multi_asset(cardano_value_t* value, cardano_multi_asset_t* multi_asset);
+
+/**
+ * \brief Adds an asset to the specified value instance.
+ *
+ * This function adds a specific asset (identified by a policy ID and asset name) and quantity to an existing
+ * `cardano_value_t` instance. This enables multi-asset representation within the value.
+ *
+ * \param[in,out] value       A pointer to the \ref cardano_value_t instance to which the asset will be added.
+ *                            Must be a valid instance.
+ * \param[in]     policy_id   The policy ID (as a \ref cardano_blake2b_hash_t) identifying the asset's issuance policy.
+ * \param[in]     asset_name  The name of the asset within the policy (as a \ref cardano_asset_name_t).
+ * \param[in]     quantity    The amount of the asset to add. Positive values increase, negative values decrease
+ *                            the asset quantity within the value instance.
+ *
+ * \returns \ref CARDANO_SUCCESS if the asset was successfully added to the value, or an error code if the operation fails.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = cardano_value_new_zero();
+ * cardano_blake2b_hash_t* policy_id = ...;  // Initialized policy ID for the asset
+ * cardano_asset_name_t* asset_name = ...;   // Initialized asset name
+ * int64_t quantity = 500;                   // Quantity of the asset to add
+ *
+ * cardano_error_t result = cardano_value_add_asset(value, policy_id, asset_name, quantity);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     // Asset added successfully
+ * }
+ *
+ * // Clean up resources
+ * cardano_value_unref(&value);
+ * cardano_blake2b_hash_unref(&policy_id);
+ * cardano_asset_name_unref(&asset_name);
+ * \endcode
+ *
+ * \note The caller is responsible for ensuring that `policy_id` and `asset_name` are valid. Any memory allocated for
+ *       these inputs should be freed appropriately when they are no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_value_add_asset(
+  cardano_value_t*        value,
+  cardano_blake2b_hash_t* policy_id,
+  cardano_asset_name_t*   asset_name,
+  int64_t                 quantity);
+
+/**
+ * \brief Adds an asset to the specified value instance using hex-encoded identifiers.
+ *
+ * This function allows you to add a specific asset (identified by a hex-encoded policy ID and asset name)
+ * and quantity to an existing `cardano_value_t` instance. This enables multi-asset representation within the value.
+ *
+ * \param[in,out] value              A pointer to the \ref cardano_value_t instance to which the asset will be added.
+ *                                   Must be a valid instance.
+ * \param[in]     policy_id_hex      A hex-encoded string representing the policy ID that uniquely identifies the asset's issuance policy.
+ * \param[in]     policy_id_hex_len  The length of the hex-encoded policy ID string.
+ * \param[in]     asset_name_hex     A hex-encoded string representing the asset's name within the policy.
+ * \param[in]     asset_name_hex_len The length of the hex-encoded asset name string.
+ * \param[in]     quantity           The amount of the asset to add. Positive values increase, negative values decrease
+ *                                   the asset quantity within the value instance.
+ *
+ * \returns \ref CARDANO_SUCCESS if the asset was successfully added to the value, or an error code indicating failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = cardano_value_new_zero();
+ * const char* policy_id_hex = "a0b1c2...";  // Hex string of the policy ID
+ * size_t policy_id_hex_len = strlen(policy_id_hex);
+ * const char* asset_name_hex = "abcd1234...";  // Hex string of the asset name
+ * size_t asset_name_hex_len = strlen(asset_name_hex);
+ * int64_t quantity = 500;  // Quantity of the asset to add
+ *
+ * cardano_error_t result = cardano_value_add_asset_ex(value, policy_id_hex, policy_id_hex_len, asset_name_hex, asset_name_hex_len, quantity);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     // Asset added successfully
+ * }
+ *
+ * // Clean up resources
+ * cardano_value_unref(&value);
+ * \endcode
+ *
+ * \note This function interprets `policy_id_hex` and `asset_name_hex` as hex-encoded strings, which are converted internally.
+ *       It is the caller's responsibility to ensure these strings are correctly formatted and freed if they are dynamically allocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_value_add_asset_ex(
+  cardano_value_t* value,
+  const char*      policy_id_hex,
+  size_t           policy_id_hex_len,
+  const char*      asset_name_hex,
+  size_t           asset_name_hex_len,
+  int64_t          quantity);
+
+/**
+ * \brief Adds an asset to the specified value instance using an asset ID.
+ *
+ * This function allows you to add a specific asset, identified by its `cardano_asset_id_t`, and a quantity to
+ * an existing `cardano_value_t` instance. This enables the representation of multi-assets within a single value.
+ *
+ * \param[in,out] value     A pointer to the \ref cardano_value_t instance to which the asset will be added.
+ *                          Must be a valid instance.
+ * \param[in]     asset_id  A pointer to a \ref cardano_asset_id_t representing the unique identifier of the asset,
+ *                          including its policy ID and asset name.
+ * \param[in]     quantity  The quantity of the asset to add. Positive values increase, and negative values decrease
+ *                          the asset quantity within the value instance.
+ *
+ * \returns \ref CARDANO_SUCCESS if the asset was successfully added to the value, or an error code indicating failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = cardano_value_new_zero();
+ * cardano_asset_id_t* asset_id = ...;  // Initialized asset ID
+ * int64_t quantity = 500;  // Quantity of the asset to add
+ *
+ * cardano_error_t result = cardano_value_add_asset_with_id(value, asset_id, quantity);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Asset added successfully
+ * }
+ *
+ * // Clean up resources
+ * cardano_asset_id_unref(&asset_id);
+ * cardano_value_unref(&value);
+ * \endcode
+ *
+ * \note The caller must ensure the `cardano_asset_id_t` provided is valid. Proper memory management of the `cardano_value_t`
+ *       instance is required, and it should be freed using `cardano_value_unref` when no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_value_add_asset_with_id(
+  cardano_value_t*    value,
+  cardano_asset_id_t* asset_id,
+  int64_t             quantity);
+
+/**
+ * \brief Adds an asset to the specified value instance using a hexadecimal asset ID.
+ *
+ * This function allows you to add a specific asset, identified by its asset ID in hexadecimal form,
+ * and a quantity to an existing `cardano_value_t` instance. It enables representing multi-assets within a single value.
+ *
+ * \param[in,out] value          A pointer to the \ref cardano_value_t instance to which the asset will be added.
+ *                               Must be a valid instance.
+ * \param[in]     asset_id_hex   A pointer to a hexadecimal string representing the asset ID, which includes
+ *                               the policy ID and asset name in hex format.
+ * \param[in]     asset_id_hex_len The length of the hexadecimal string for the asset ID.
+ * \param[in]     quantity       The quantity of the asset to add. Positive values increase and negative values decrease
+ *                               the asset quantity within the value instance.
+ *
+ * \returns \ref CARDANO_SUCCESS if the asset was successfully added to the value, or an error code indicating failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = cardano_value_new_zero();
+ * const char* asset_id_hex = "abcdef1234567890";  // Example asset ID in hexadecimal
+ * size_t asset_id_hex_len = strlen(asset_id_hex);
+ * int64_t quantity = 500;  // Quantity of the asset to add
+ *
+ * cardano_error_t result = cardano_value_add_asset_with_id_ex(value, asset_id_hex, asset_id_hex_len, quantity);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     // Asset added successfully
+ * }
+ *
+ * // Clean up resources
+ * cardano_value_unref(&value);
+ * \endcode
+ *
+ * \note The caller must ensure the `asset_id_hex` is a valid hexadecimal representation of the asset ID. Proper memory management
+ *       of the `cardano_value_t` instance is required, and it should be freed using `cardano_value_unref` when no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_value_add_asset_with_id_ex(
+  cardano_value_t* value,
+  const char*      asset_id_hex,
+  size_t           asset_id_hex_len,
+  int64_t          quantity);
+
+/**
+ * \brief Combines two Cardano value objects by adding their coin amounts and multi-asset components.
+ *
+ * This function adds the contents of two \ref cardano_value_t objects, summing their coin amounts (in lovelaces)
+ * and combining their multi-asset collections. The addition is performed element-wise for both the coin amounts
+ * and the assets within their multi-asset components. If an asset exists in both values, their quantities are summed. Assets
+ * present only in one of the values are included in the result as is.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_value_t object.
+ *                This value represents the left-hand side operand in the addition.
+ *                The pointer must not be NULL.
+ * \param[in] rhs A constant pointer to the second \ref cardano_value_t object.
+ *                This value represents the right-hand side operand in the addition.
+ *                The pointer must not be NULL.
+ * \param[out] result On successful execution, this will point to a newly created \ref cardano_value_t object
+ *             that represents the combined result of both input values.
+ *             The result is dynamically allocated and must be freed by the caller using \ref cardano_value_unref
+ *             when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         Returns \ref CARDANO_SUCCESS if the values were successfully added,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *         or \ref CARDANO_ERROR_INTEGER_OVERFLOW if the addition results in an overflow for the coin amount.
+ *
+ * \note This function handles internal reference counting for the multi-asset components appropriately.
+ *       The caller retains ownership of the provided \p lhs and \p rhs and is responsible for releasing them
+ *       when they are no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_value_t* lhs = ...; // Assume lhs is already initialized
+ * const cardano_value_t* rhs = ...; // Assume rhs is also initialized
+ * cardano_value_t* result = NULL;
+ *
+ * cardano_error_t add_result = cardano_value_add(lhs, rhs, &result);
+ *
+ * if (add_result == CARDANO_SUCCESS)
+ * {
+ *   // The values have been successfully added
+ *   // Use the result as needed
+ *
+ *   // When done, release the result
+ *   cardano_value_unref(&result);
+ * }
+ * else
+ * {
+ *   printf("Failed to add values: %s\n", cardano_error_to_string(add_result));
+ * }
+ *
+ * // Cleanup resources
+ * cardano_value_unref(&lhs);
+ * cardano_value_unref(&rhs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_value_add(cardano_value_t* lhs, cardano_value_t* rhs, cardano_value_t** result);
+
+/**
+ * \brief Subtracts one Cardano value from another, resulting in a new value.
+ *
+ * This function subtracts the contents of the second \ref cardano_value_t object (rhs) from the first \ref cardano_value_t object (lhs),
+ * producing a new \ref cardano_value_t object as the result. The subtraction is performed element-wise for both the coin amounts and the assets within their multi-asset components.
+ *
+ * \param[in] lhs A constant pointer to the \ref cardano_value_t object to subtract from.
+ *                This value represents the left-hand side operand in the subtraction.
+ *                The pointer must not be NULL.
+ * \param[in] rhs A constant pointer to the \ref cardano_value_t object to subtract.
+ *                This value represents the right-hand side operand in the subtraction.
+ *                The pointer must not be NULL.
+ * \param[out] result On successful execution, this will point to a newly created \ref cardano_value_t object
+ *             that represents the result of the subtraction.
+ *             The result is dynamically allocated and must be freed by the caller using \ref cardano_value_unref
+ *             when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         Returns \ref CARDANO_SUCCESS if the values were successfully subtracted,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL,
+ *         or \ref CARDANO_ERROR_INTEGER_UNDERFLOW if the subtraction results in a negative coin amount.
+ *
+ * \note This function handles internal reference counting for the multi-asset components appropriately.
+ *       The caller retains ownership of the provided \p lhs and \p rhs and is responsible for releasing them
+ *       when they are no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_value_t* lhs = ...; // Assume lhs is already initialized
+ * const cardano_value_t* rhs = ...; // Assume rhs is also initialized
+ * cardano_value_t* result = NULL;
+ *
+ * cardano_error_t subtract_result = cardano_value_subtract(lhs, rhs, &result);
+ * if (subtract_result == CARDANO_SUCCESS)
+ * {
+ *   // The values have been successfully subtracted
+ *   // Use the result as needed
+ *
+ *   // When done, release the result
+ *   cardano_value_unref(&result);
+ * }
+ * else
+ * {
+ *   printf("Failed to subtract values: %s\n", cardano_error_to_string(subtract_result));
+ * }
+ *
+ * // Cleanup resources
+ * cardano_value_unref(&lhs);
+ * cardano_value_unref(&rhs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_value_subtract(cardano_value_t* lhs, cardano_value_t* rhs, cardano_value_t** result);
+
+/**
+ * \brief Retrieves the list of intersecting assets between two Cardano value objects.
+ *
+ * This function calculates the assets that are present in both the left-hand side (lhs) and
+ * right-hand side (rhs) \ref cardano_value_t objects. The intersection refers to assets that exist in both value sets.
+ *
+ * \param[in] lhs A pointer to the first \ref cardano_value_t object, representing the left-hand side value.
+ *                This value must not be NULL and should be initialized.
+ * \param[in] rhs A pointer to the second \ref cardano_value_t object, representing the right-hand side value.
+ *                This value must not be NULL and should be initialized.
+ * \param[out] result On successful execution, this will point to a newly created \ref cardano_asset_id_list_t object
+ *             containing the intersecting assets between the two value objects. If there are no intersecting assets,
+ *             the list will be empty. If any input is NULL, the function will return an error and the result will remain uninitialized.
+ *             The caller is responsible for managing the lifecycle of the resulting list, specifically releasing it
+ *             by calling \ref cardano_asset_id_list_unref when it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* lhs = ...; // Assume lhs is initialized with some assets
+ * cardano_value_t* rhs = ...; // Assume rhs is initialized with some assets
+ * cardano_asset_id_list_t* intersecting_assets = NULL;
+ *
+ * cardano_error_t result = cardano_value_get_intersection(lhs, rhs, &intersecting_assets);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the list of intersecting assets
+ *   for (size_t i = 0; i < cardano_asset_id_list_get_length(intersecting_assets); ++i)
+ *   {
+ *     cardano_asset_id_t* asset_id = NULL;
+ *     cardano_asset_id_list_get(intersecting_assets, i, &asset_id);
+ *     // Use the asset_id
+ *     cardano_asset_id_unref(&asset_id);
+ *   }
+ *
+ *   // Ensure to release the list of intersecting assets when done
+ *   cardano_asset_id_list_unref(&intersecting_assets);
+ * }
+ * else
+ * {
+ *   printf("Failed to calculate intersection: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_value_get_intersection(cardano_value_t* lhs, cardano_value_t* rhs, cardano_asset_id_list_t** result);
+
+/**
+ * \brief Retrieves the count of intersecting assets between two Cardano value objects.
+ *
+ * This function calculates the number of assets that are present in both the left-hand side (lhs) and
+ * right-hand side (rhs) \ref cardano_value_t objects. The intersection refers to assets that exist in both value sets.
+ *
+ * \param[in] lhs A pointer to the first \ref cardano_value_t object, representing the left-hand side value.
+ *                This value must not be NULL and should be initialized.
+ * \param[in] rhs A pointer to the second \ref cardano_value_t object, representing the right-hand side value.
+ *                This value must not be NULL and should be initialized.
+ * \param[out] result On successful execution, this will point to a uint64_t that contains the number of intersecting assets
+ *             between the two value objects. The result is set to 0 if there are no intersecting assets or if any input is NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* lhs = ...; // Assume lhs is initialized with some assets
+ * cardano_value_t* rhs = ...; // Assume rhs is initialized with some assets
+ * uint64_t intersection_count = 0;
+ *
+ * cardano_error_t result = cardano_value_get_intersection_count(lhs, rhs, &intersection_count);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Number of intersecting assets: %llu\n", intersection_count);
+ * }
+ * else
+ * {
+ *   printf("Failed to calculate intersection: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_value_get_intersection_count(cardano_value_t* lhs, cardano_value_t* rhs, uint64_t* result);
+
+/**
+ * \brief Converts a Cardano value into a flat asset ID map.
+ *
+ * This function converts a \ref cardano_value_t object, which contains multi-asset values, into a
+ * \ref cardano_asset_id_map_t. In this conversion, the policy ID and asset name from the multi-asset structure
+ * are combined into a single key in the resulting asset ID map.
+ *
+ * If the \ref cardano_value_t object contains a coin value (Lovelace) greater than 0, it will also be included
+ * in the asset map with the key representing the native Cardano currency (Lovelace).
+ *
+ * \param[in] value A pointer to an initialized \ref cardano_value_t object containing the multi-assets to be flattened into the map.
+ *                  This value must not be NULL and should be initialized.
+ *
+ * \return A pointer to a newly created \ref cardano_asset_id_map_t object representing the flat map of asset IDs
+ *         to their corresponding quantities. The map is dynamically allocated, and the caller is responsible for managing
+ *         its lifecycle, specifically releasing it by calling \ref cardano_asset_id_map_unref when it is no longer needed.
+ *         If the input value is NULL or an error occurs, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = ...; // Assume value is already initialized with assets
+ * cardano_asset_id_map_t* asset_map = cardano_value_as_assets_map(value);
+ *
+ * if (asset_map != NULL)
+ * {
+ *   // Process the flat asset ID map
+ *   // Release the map once done
+ *   cardano_asset_id_map_unref(&asset_map);
+ * }
+ * else
+ * {
+ *   printf("Failed to convert the value to an asset ID map.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_asset_id_map_t* cardano_value_as_assets_map(cardano_value_t* value);
+
+/**
+ * \brief Retrieves the count of unique assets in a Cardano value.
+ *
+ * This function calculates the number of unique assets contained within a \ref cardano_value_t object, including
+ * the native ADA (Lovelace) if the coin value is greater than 0.
+ *
+ * \param[in] value A pointer to an initialized \ref cardano_value_t object from which the asset count is retrieved.
+ *                  This value must not be NULL and should be properly initialized.
+ *
+ * \return The total count of unique assets within the value as an unsigned 64-bit integer. If the value contains ADA (Lovelace) with a coin value
+ *         greater than 0, it will be counted as one asset. If the input pointer is NULL or an error occurs, the function returns 0.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_value_t* value = ...; // Assume value is already initialized with assets
+ * uint64_t asset_count = cardano_value_get_asset_count(value);
+ *
+ * if (asset_count > 0)
+ * {
+ *   printf("The value contains %llu unique assets.\n", asset_count);
+ * }
+ * else
+ * {
+ *   printf("No assets found or an error occurred.\n");
+ * }
+ * \endcode
+ *
+ * \note If the \ref cardano_value_t object has a coin value (Lovelace) greater than 0, it will be counted as an asset
+ *       in the total asset count.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_value_get_asset_count(const cardano_value_t* value);
+
+/**
+ * \brief Checks whether the given Cardano value is zero.
+ *
+ * This function evaluates whether the provided \ref cardano_value_t object represents zero value.
+ * It checks if both the coin amount (in lovelace) and any associated multi-assets are zero.
+ *
+ * \param[in] value A constant pointer to an initialized \ref cardano_value_t object to be checked.
+ *
+ * \return A boolean value indicating whether the \ref cardano_value_t object represents zero:
+ *         - \c true if the value is zero (both coin and assets are zero),
+ *         - \c false if either the coin amount or any of the assets are non-zero.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_value_t* value = ...; // Assume value is already initialized
+ * bool is_zero = cardano_value_is_zero(value);
+ *
+ * if (is_zero)
+ * {
+ *   printf("The value is zero.\n");
+ * }
+ * else
+ * {
+ *   printf("The value is not zero.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_value_is_zero(const cardano_value_t* value);
+
+/**
+ * \brief Compares two value objects for equality.
+ *
+ * This function compares two value objects to determine if they are equal.
+ *
+ * \param[in] lhs Pointer to the first value object.
+ * \param[in] rhs Pointer to the second value object.
+ *
+ * \return \c true if the value objects are equal, \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value1 = NULL;
+ * cardano_value_t* value2 = NULL;
+ *
+ * // Assume value1 and value2 are initialized properly
+ *
+ * bool are_equal = cardano_value_equals(value1, value2);
+ *
+ * if (are_equal)
+ * {
+ *   printf("The value objects are equal.\n");
+ * }
+ * else
+ * {
+ *   printf("The value objects are not equal.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_value_unref(&value1);
+ * cardano_value_unref(&value2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_value_equals(const cardano_value_t* lhs, const cardano_value_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a cardano_value_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_value_t object
+ * by decreasing its reference count. When the reference count reaches zero, the value is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] value A pointer to the pointer of the value object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_value_t* value = cardano_value_new(major, minor);
+ *
+ * // Perform operations with the value...
+ *
+ * cardano_value_unref(&value);
+ * // At this point, value is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_value_unref, the pointer to the \ref cardano_value_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_value_unref(cardano_value_t** value);
+
+/**
+ * \brief Increases the reference count of the cardano_value_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_value_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_value_unref.
+ *
+ * \param value A pointer to the cardano_value_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming value is a previously created value object
+ *
+ * cardano_value_ref(value);
+ *
+ * // Now value can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_value_ref there is a corresponding
+ * call to \ref cardano_value_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_value_ref(cardano_value_t* value);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_value_t object.
+ *
+ * This function returns the number of active references to an cardano_value_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_value_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param value A pointer to the cardano_value_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_value_t object. If the object
+ * is properly managed (i.e., every \ref cardano_value_ref call is matched with a
+ * \ref cardano_value_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming value is a previously created value object
+ *
+ * size_t ref_count = cardano_value_refcount(value);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_value_refcount(const cardano_value_t* value);
+
+/**
+ * \brief Sets the last error message for a given cardano_value_t object.
+ *
+ * Records an error message in the value's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] value A pointer to the \ref cardano_value_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the value's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_value_set_last_error(
+  cardano_value_t* value,
+  const char*      message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific value.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_value_set_last_error for the given
+ * value. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] value A pointer to the \ref cardano_value_t instance whose last error
+ *                   message is to be retrieved. If the value is NULL, the function
+ *                   returns a generic error message indicating the null value.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified value. If the value is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_value_set_last_error for the same value, or until
+ *       the value is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_value_get_last_error(const cardano_value_t* value);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_value_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_value_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_value_deep_clone(const cardano_value_t* source, cardano_value_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VALUE_H
diff --git a/vendor/include/cardano/transaction_builder/balancing/deferred_redeemer_list.h b/vendor/include/cardano/transaction_builder/balancing/deferred_redeemer_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/balancing/deferred_redeemer_list.h
@@ -0,0 +1,170 @@
+/**
+ * \file deferred_redeemer_list.h
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_DEFERRED_REDEEMER_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_DEFERRED_REDEEMER_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/typedefs.h>
+#include <cardano/witness_set/redeemer.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Produces the redeemer payload for a script purpose from the balanced draft transaction.
+ *
+ * Deferred redeemer callbacks are the mechanism for building redeemers that depend on the final
+ * canonical layout of the transaction (input indices, change outputs, the fee), which only exists
+ * after balancing. See \ref cardano_tx_builder_add_input_with_deferred_redeemer.
+ *
+ * The callback receives the balanced draft transaction (canonical input order, outputs including
+ * change, fee) and the final selected inputs as fully resolved UTXOs in canonical order. The
+ * \ref cardano_transaction_find_input_index family of functions can be used to look up canonical
+ * positions.
+ *
+ * \warning Callbacks are invoked on EVERY balancing iteration and MUST be pure, deterministic
+ * functions of their arguments: no captured mutable state, no side effects, no randomness. A
+ * callback that violates this contract can prevent the balancing loop from converging.
+ *
+ * When used with the sub transaction builder, the callback runs once, when the sub transaction is
+ * built, with a draft transaction carrying the body of the sub transaction and its inputs in sorted
+ * order, so the indices it computes are local to the sub transaction body.
+ *
+ * \param[in]  user_context    The opaque pointer given at registration time.
+ * \param[in]  draft_tx        The balanced draft transaction. Borrowed; must not be modified.
+ * \param[in]  resolved_inputs The final selected inputs as resolved UTXOs. Borrowed.
+ * \param[out] redeemer        The produced redeemer payload. The caller takes ownership.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code (which aborts balancing).
+ */
+typedef cardano_error_t (*cardano_deferred_redeemer_fn_t)(
+  void*                   user_context,
+  cardano_transaction_t*  draft_tx,
+  cardano_utxo_list_t*    resolved_inputs,
+  cardano_plutus_data_t** redeemer);
+
+/**
+ * \brief A list of pending deferred redeemers: witness-set redeemer objects paired with the
+ * callback that produces their payload once the final transaction layout is known.
+ */
+typedef struct cardano_deferred_redeemer_list_t cardano_deferred_redeemer_list_t;
+
+/**
+ * \brief Creates a new empty deferred redeemer list.
+ *
+ * \param[out] list A pointer to store the address of the newly created list.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_deferred_redeemer_list_new(cardano_deferred_redeemer_list_t** list);
+
+/**
+ * \brief Registers a deferred redeemer.
+ *
+ * The list takes a reference on the redeemer object. Because the transaction builder shares the
+ * same redeemer object between the witness set and its bookkeeping maps, resolving the deferred
+ * payload updates the witness set in place.
+ *
+ * \param[in] list         The list to add to.
+ * \param[in] redeemer     The witness-set redeemer object whose payload is produced by the callback.
+ * \param[in] callback     The callback producing the payload. See \ref cardano_deferred_redeemer_fn_t.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL. The caller
+ *                         must keep it valid until the transaction is built.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_deferred_redeemer_list_add(
+  cardano_deferred_redeemer_list_t* list,
+  cardano_redeemer_t*               redeemer,
+  cardano_deferred_redeemer_fn_t    callback,
+  void*                             user_context);
+
+/**
+ * \brief Returns the number of registered deferred redeemers.
+ *
+ * \param[in] list The list to inspect.
+ *
+ * \return The number of entries, or zero if the list is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_deferred_redeemer_list_get_length(const cardano_deferred_redeemer_list_t* list);
+
+/**
+ * \brief Resolves every deferred redeemer against a balanced draft transaction.
+ *
+ * Invokes each registered callback with the draft transaction and the resolved inputs, and
+ * replaces the corresponding redeemer's payload with the produced plutus data. This is called
+ * by \ref cardano_balance_transaction on every balancing iteration, after the canonical input
+ * order and the change outputs are final and before evaluation and fee computation.
+ *
+ * \param[in] list            The list of deferred redeemers. Can be NULL (no-op).
+ * \param[in] draft_tx        The balanced draft transaction.
+ * \param[in] resolved_inputs The final selected inputs as resolved UTXOs.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or the first error returned by a callback.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_deferred_redeemer_list_resolve(
+  cardano_deferred_redeemer_list_t* list,
+  cardano_transaction_t*            draft_tx,
+  cardano_utxo_list_t*              resolved_inputs);
+
+/**
+ * \brief Increments the reference count of the deferred redeemer list.
+ *
+ * \param[in] list The list whose reference count to increment.
+ */
+CARDANO_EXPORT void cardano_deferred_redeemer_list_ref(cardano_deferred_redeemer_list_t* list);
+
+/**
+ * \brief Decrements the reference count of the deferred redeemer list; frees it when it reaches zero.
+ *
+ * \param[in,out] list A pointer to the list pointer. Set to NULL.
+ */
+CARDANO_EXPORT void cardano_deferred_redeemer_list_unref(cardano_deferred_redeemer_list_t** list);
+
+/**
+ * \brief Returns the current reference count of the deferred redeemer list.
+ *
+ * \param[in] list The list to inspect.
+ *
+ * \return The reference count, or zero if the list is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_deferred_redeemer_list_refcount(const cardano_deferred_redeemer_list_t* list);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_DEFERRED_REDEEMER_LIST_H
diff --git a/vendor/include/cardano/transaction_builder/balancing/implicit_coin.h b/vendor/include/cardano/transaction_builder/balancing/implicit_coin.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/balancing/implicit_coin.h
@@ -0,0 +1,148 @@
+/**
+ * \file implicit_coin.h
+ *
+ * \author angel.castillo
+ * \date   Nov 02, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_IMPLICIT_COIN_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_IMPLICIT_COIN_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/protocol_params/protocol_parameters.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/typedefs.h>
+
+/* STRUCTURES *****************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents the implicit coin values in a transaction.
+ */
+typedef struct cardano_implicit_coin_t
+{
+    /**
+     * \brief The reward withdrawals in the transaction.
+     */
+    uint64_t withdrawals;
+
+    /**
+     * \brief The deposits paid by the certificates and the proposal procedures.
+     */
+    uint64_t deposits;
+
+    /**
+     * \brief The deposits returned by the stake credential and DRep unregistration certificates.
+     */
+    uint64_t reclaim_deposits;
+} cardano_implicit_coin_t;
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Computes the implicit coin balance for a transaction.
+ *
+ * The `cardano_compute_implicit_coin` function calculates the implicit coin balance for a given transaction.
+ *
+ * Deposits and refunds follow the ledger rules for the certificates of the body:
+ * - A pool registration pays the pool deposit of the protocol parameters, once per pool: a later registration of the
+ *   same pool, identified by its operator key hash, in the same body updates the pool parameters and pays nothing.
+ * - A pool retirement reclaims nothing. The ledger returns the pool deposit to the reward account of the pool at the
+ *   epoch boundary where the pool retires, not in the retiring transaction.
+ *
+ * This function does not know which pools are already registered on chain, so a registration that updates the
+ * parameters of an already registered pool is charged the pool deposit, which the ledger does not charge, and a
+ * transaction balanced with it does not conserve value for the ledger. The caller must account for that deposit.
+ *
+ * \param[in] tx A pointer to the \ref cardano_transaction_t object representing the transaction.
+ * \param[in] protocol_params A pointer to \ref cardano_protocol_parameters_t containing the protocol parameters necessary for accurate computation.
+ * \param[out] implicit_coin A pointer to \ref cardano_implicit_coin_t where the computed implicit coin balance will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the implicit coin balance was successfully computed, \ref CARDANO_ERROR_INTEGER_OVERFLOW if the
+ *         withdrawals, the deposits or the reclaimed deposits add up to more than UINT64_MAX, or an appropriate error code
+ *         indicating failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = ...;             // Transaction object
+ * cardano_protocol_parameters_t* protocol_params = ...; // Protocol parameters
+ * cardano_implicit_coin_t implicit_coin = { 0 };
+ *
+ * cardano_error_t result = cardano_compute_implicit_coin(transaction, protocol_params, &implicit_coin);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The implicit coin balance was successfully computed and stored in `implicit_coin`
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_compute_implicit_coin(
+  cardano_transaction_t*         tx,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_implicit_coin_t*       implicit_coin);
+
+/**
+ * \brief Computes the implicit coin balance for a sub transaction.
+ *
+ * The `cardano_compute_sub_transaction_implicit_coin` function calculates the implicit coin balance of a CIP-118 sub transaction
+ * from the withdrawals, certificates and proposal procedures of its body, applying the same rules as \ref cardano_compute_implicit_coin
+ * does for a top level transaction. The pool deposits are charged per body: a pool registered by another body of the
+ * batch is treated like a pool that is not registered yet. The ledger charges the pool deposit once per pool across a
+ * whole CIP-118 batch, and \ref cardano_compute_transaction_batch_imbalance counts it that way.
+ *
+ * \param[in] sub_tx A pointer to the \ref cardano_sub_transaction_t object representing the sub transaction.
+ * \param[in] protocol_params A pointer to \ref cardano_protocol_parameters_t containing the protocol parameters necessary for accurate computation.
+ * \param[out] implicit_coin A pointer to \ref cardano_implicit_coin_t where the computed implicit coin balance will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the implicit coin balance was successfully computed, \ref CARDANO_ERROR_INTEGER_OVERFLOW if the
+ *         withdrawals, the deposits or the reclaimed deposits add up to more than UINT64_MAX, or an appropriate error code
+ *         indicating failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = ...;     // Sub transaction object
+ * cardano_protocol_parameters_t* protocol_params = ...; // Protocol parameters
+ * cardano_implicit_coin_t implicit_coin = { 0 };
+ *
+ * cardano_error_t result = cardano_compute_sub_transaction_implicit_coin(sub_transaction, protocol_params, &implicit_coin);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The implicit coin balance was successfully computed and stored in `implicit_coin`
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_compute_sub_transaction_implicit_coin(
+  cardano_sub_transaction_t*     sub_tx,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_implicit_coin_t*       implicit_coin);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_IMPLICIT_COIN_H
diff --git a/vendor/include/cardano/transaction_builder/balancing/input_to_redeemer_map.h b/vendor/include/cardano/transaction_builder/balancing/input_to_redeemer_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/balancing/input_to_redeemer_map.h
@@ -0,0 +1,496 @@
+/**
+ * \file input_to_redeemer_map.h
+ *
+ * \author angel.castillo
+ * \date   Nov 11, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_INPUT_TO_REDEEMER_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_INPUT_TO_REDEEMER_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+#include <cardano/transaction_body/transaction_input.h>
+#include <cardano/witness_set/redeemer.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of input to redeemers.
+ */
+typedef struct cardano_input_to_redeemer_map_t cardano_input_to_redeemer_map_t;
+
+/**
+ * \brief Creates and initializes a new instance of a map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_input_to_redeemer_map_t,
+ * representing a map structure. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] map A pointer to a pointer to a \ref cardano_input_to_redeemer_map_t input. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_input_to_redeemer_map_t
+ *                        input. This input represents a "strong reference" to the map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this input. Specifically, once the map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_input_to_redeemer_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_input_to_redeemer_map_t* map = NULL;
+ *
+ * // Attempt to create a new map
+ * cardano_error_t result = cardano_input_to_redeemer_map_new(&input_to_redeemer_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the map
+ *
+ *   // Once done, ensure to clean up and release the map
+ *   cardano_input_to_redeemer_map_unref(&input_to_redeemer_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_input_to_redeemer_map_new(cardano_input_to_redeemer_map_t** map);
+
+/**
+ * \brief Retrieves the length of the map.
+ *
+ * This function returns the number of key-value pairs contained in the specified map.
+ *
+ * \param[in] map A constant pointer to the \ref cardano_input_to_redeemer_map_t input for which
+ *                the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the map. Returns 0 if the map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_input_to_redeemer_map_t* map = cardano_input_to_redeemer_map_new();
+ *
+ * // Populate the map with key-value pairs
+ *
+ * size_t length = cardano_input_to_redeemer_map_get_length(input_to_redeemer_map);
+ * printf("The length of the map is: %zu\n", length);
+ *
+ * cardano_input_to_redeemer_map_unref(&input_to_redeemer_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_input_to_redeemer_map_get_length(const cardano_input_to_redeemer_map_t* map);
+
+/**
+ * \brief Retrieves the value associated with a given key in the map.
+ *
+ * This function retrieves the value associated with the specified key in the provided map.
+ * It returns the value through the output parameter `element`. If the key is not found in the map,
+ * the output parameter `element` will be set to NULL.
+ *
+ * \param[in] map A constant pointer to the \ref cardano_input_to_redeemer_map_t input from which
+ *                       the value is to be retrieved.
+ * \param[in] key The key whose associated value is to be retrieved from the map.
+ * \param[out] element A pointer to a variable where the retrieved value will be stored. If the key
+ *                     is found in the map, this variable will be set to the associated value.
+ *                     If the key is not found, this variable will be set to NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value associated with the key was successfully retrieved, or
+ *         an appropriate error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_input_to_redeemer_map_t* map = cardano_input_to_redeemer_map_new();
+ *
+ * // Populate the map with key-value pairs
+ *
+ * cardano_transaction_input_t* key = ...; // Create a input representing the key
+ * cardano_redeemer_t* value = NULL;
+ * cardano_error_t result = cardano_input_to_redeemer_map_get(input_to_redeemer_map, key, &value);
+ *
+ * if (result == CARDANO_SUCCESS && value != NULL)
+ * {
+ *   // Use the retrieved value
+ *   // ...
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_transaction_input_unref(&key); // Clean up the key resource
+ * cardano_input_to_redeemer_map_unref(&input_to_redeemer_map);
+ * cardano_redeemer_unref(&value); // Clean up the value resource
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_input_to_redeemer_map_get(cardano_input_to_redeemer_map_t* map, const cardano_transaction_input_t* key, cardano_redeemer_t** element);
+
+/**
+ * \brief Inserts a key-value pair into the map.
+ *
+ * This function inserts the specified key-value pair into the provided map.
+ *
+ * \param[in] map A constant pointer to the \ref cardano_input_to_redeemer_map_t input where
+ *                the key-value pair is to be inserted.
+ * \param[in] key The key to be inserted into the map. The caller is responsible for managing
+ *                the lifecycle of the key input.
+ * \param[in] value The value to be associated with the key and inserted into the map.
+ *                  The caller is responsible for managing the lifecycle of the value input.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_input_to_redeemer_map_t* map = cardano_input_to_redeemer_map_new();
+ *
+ * // Create key and value input
+ * cardano_transaction_input_t* key = ...;
+ * cardano_redeemer_t* value = ...;
+ *
+ * // Insert the key-value pair into the map
+ * cardano_error_t result = cardano_input_to_redeemer_map_insert(input_to_redeemer_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value input
+ * cardano_transaction_input_unref(&key);
+ *
+ * cardano_input_to_redeemer_map_unref(&input_to_redeemer_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_input_to_redeemer_map_insert(cardano_input_to_redeemer_map_t* map, cardano_transaction_input_t* key, cardano_redeemer_t* value);
+
+/**
+ * \brief Retrieves the input at a specific index from the map.
+ *
+ * This function retrieves the input at the specified index from the map.
+ *
+ * \param[in] map Pointer to the map input.
+ * \param[in] index The index of the input to retrieve.
+ * \param[out] input On successful retrieval, this will point to the input
+ *                    at the specified index. The caller is responsible for managing the lifecycle
+ *                    of this input. Specifically, once the input is no longer needed,
+ *                    the caller must release it by calling \ref cardano_transaction_input_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the input was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_input_to_redeemer_map_t* map = NULL;
+ * cardano_transaction_input_t* input = NULL;
+ * size_t index = 0; // Index of the key hash to retrieve
+ *
+ * // Assume map is initialized properly
+ *
+ * cardano_error_t result = cardano_input_to_redeemer_map_get_key_at(input_to_redeemer_map, index, &input);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the input
+ *
+ *   // Once done, ensure to clean up and release the input
+ *   cardano_transaction_input_unref(&input);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_input_to_redeemer_map_get_key_at(
+  const cardano_input_to_redeemer_map_t* map,
+  size_t                                 index,
+  cardano_transaction_input_t**          input);
+
+/**
+ * \brief Retrieves the redeemer at a specific index from the map.
+ *
+ * This function retrieves the redeemer at the specified index from the map.
+ *
+ * \param[in] map Pointer to the map input.
+ * \param[in] index The index of the redeemer to retrieve.
+ * \param[out] redeemer On successful retrieval, this will point to the redeemer
+ *                    at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the redeemer was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_input_to_redeemer_map_t* map = NULL;
+ * cardano_redeemer_t* redeemer = 0;
+ * size_t index = 0; // Index of the redeemer to retrieve
+ *
+ * // Assume map is initialized properly
+ *
+ * cardano_error_t result = cardano_input_to_redeemer_map_get_value_at(input_to_redeemer_map, index, &redeemer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the redeemer
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ *
+ * cardano_redeemer_unref(&redeemer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_input_to_redeemer_map_get_value_at(
+  const cardano_input_to_redeemer_map_t* map,
+  size_t                                 index,
+  cardano_redeemer_t**                   redeemer);
+
+/**
+ * \brief Retrieves the input and redeemer at the specified index.
+ *
+ * This function retrieves the input and redeemer from the proposed redeemers
+ * at the specified index.
+ *
+ * \param[in]  map    Pointer to the proposed redeemers input.
+ * \param[in]  index             The index at which to retrieve the key-value pair.
+ * \param[out] input On successful retrieval, this will point to the input at the specified index.
+ *                            The caller is responsible for managing the lifecycle of this input and should release it using
+ *                            \ref cardano_transaction_input_unref when it is no longer needed.
+ * \param[out] redeemer On successful retrieval, this will point to the redeemer at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_input_to_redeemer_map_t* map = NULL;
+ * // Assume map is initialized properly
+ *
+ * size_t index = 0;
+ * cardano_transaction_input_t* input = NULL;
+ * cardano_redeemer_t* redeemer = 0;
+ *
+ * cardano_error_t result = cardano_input_to_redeemer_map_get_key_value_at(input_to_redeemer_map, index, &input, &redeemer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (input != NULL && redeemer != NULL)
+ *   {
+ *     // Use the input and redeemer
+ *   }
+ *   else
+ *   {
+ *     printf("Key-value pair not set at index %zu.\n", index);
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_input_to_redeemer_map_unref(&input_to_redeemer_map);
+ * cardano_transaction_input_unref(&input);
+ * cardano_redeemer_unref(&redeemer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_input_to_redeemer_map_get_key_value_at(
+  const cardano_input_to_redeemer_map_t* map,
+  size_t                                 index,
+  cardano_transaction_input_t**          input,
+  cardano_redeemer_t**                   redeemer);
+
+/**
+ * \brief Finds a redeemer that matches the given input reference. If it finds it, it updates its index. Otherwise
+ * it does nothing.
+ *
+ * \param map The map to search for the input.
+ * \param input The input key that will be used to search for the redeemer.
+ * \param index The new index to assign to the redeemer.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS.
+ */
+CARDANO_NODISCARD
+cardano_error_t cardano_input_to_redeemer_map_update_redeemer_index(
+  cardano_input_to_redeemer_map_t* map,
+  cardano_transaction_input_t*     input,
+  uint64_t                         index);
+
+/**
+ * \brief Decrements the reference count of a map input.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_input_to_redeemer_map_t input
+ * by decreasing its reference count. When the reference count reaches zero, the map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] map A pointer to the pointer of the map input. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the input has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_input_to_redeemer_map_t* map = cardano_input_to_redeemer_map_new();
+ *
+ * // Perform operations with the map...
+ *
+ * cardano_input_to_redeemer_map_unref(&input_to_redeemer_map);
+ * // At this point, map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_input_to_redeemer_map_unref, the pointer to the \ref cardano_input_to_redeemer_map_t input
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_input_to_redeemer_map_unref(cardano_input_to_redeemer_map_t** map);
+
+/**
+ * \brief Increases the reference count of the cardano_input_to_redeemer_map_t input.
+ *
+ * This function is used to manually increment the reference count of a map
+ * input, indicating that another part of the code has taken ownership of it. This
+ * ensures the input remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_input_to_redeemer_map_unref.
+ *
+ * \param map A pointer to the map input whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming map is a previously created map input
+ *
+ * cardano_input_to_redeemer_map_ref(input_to_redeemer_map);
+ *
+ * // Now map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_input_to_redeemer_map_ref there is a corresponding
+ * call to \ref cardano_input_to_redeemer_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_input_to_redeemer_map_ref(cardano_input_to_redeemer_map_t* map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_input_to_redeemer_map_t input.
+ *
+ * This function returns the number of active references to a map input. It's useful
+ * for debugging purposes or managing the lifecycle of the input in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an input holds a reference to another input, rather than directly to the
+ * cardano_input_to_redeemer_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param map A pointer to the map input whose reference count is queried.
+ *                    The input must not be NULL.
+ *
+ * \return The number of active references to the specified map input. If the input
+ * is properly managed (i.e., every \ref cardano_input_to_redeemer_map_ref call is matched with a
+ * \ref cardano_input_to_redeemer_map_unref call), this count should reach zero right before the input
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming map is a previously created map input
+ *
+ * size_t ref_count = cardano_input_to_redeemer_map_refcount(input_to_redeemer_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_input_to_redeemer_map_refcount(const cardano_input_to_redeemer_map_t* map);
+
+/**
+ * \brief Sets the last error message for a given map input.
+ *
+ * Records an error message in the map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] map A pointer to the \ref cardano_input_to_redeemer_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_input_to_redeemer_map_set_last_error(cardano_input_to_redeemer_map_t* map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_input_to_redeemer_map_set_last_error for the given
+ * map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] map A pointer to the \ref cardano_input_to_redeemer_map_t instance whose last error
+ *                   message is to be retrieved. If the map is NULL, the function
+ *                   returns a generic error message indicating the null map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified map. If the map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the input and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_input_to_redeemer_map_set_last_error for the same map, or until
+ *       the map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_input_to_redeemer_map_get_last_error(const cardano_input_to_redeemer_map_t* map);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_input_to_redeemer_map_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_input_to_redeemer_map_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_input_to_redeemer_map_deep_clone(const cardano_input_to_redeemer_map_t* source, cardano_input_to_redeemer_map_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_INPUT_TO_REDEEMER_MAP_H
diff --git a/vendor/include/cardano/transaction_builder/balancing/transaction_balancing.h b/vendor/include/cardano/transaction_builder/balancing/transaction_balancing.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/balancing/transaction_balancing.h
@@ -0,0 +1,459 @@
+/**
+ * \file transaction_balancing.h
+ *
+ * \author angel.castillo
+ * \date   Nov 01, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BALANCING_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BALANCING_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/protocol_params/protocol_parameters.h>
+#include <cardano/providers/provider.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/transaction_body/value.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+#include <cardano/transaction_builder/balancing/input_to_redeemer_map.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+
+#include <cardano/export.h>
+#include <cardano/transaction_builder/evaluation/tx_evaluator.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Balances a Cardano transaction by adding necessary inputs, calculating change, and adjusting collateral.
+ *
+ * This function balances an unbalanced transaction (`unbalanced_tx`) by:
+ * - Adding additional inputs if the transaction does not meet the required balance.
+ * - Computing the cost of script execution.
+ * - Calculating the change output to ensure the transaction has the correct total ADA and assets.
+ * - Adding collateral inputs if a redeemer exists in the transaction or in any of the sub transactions it carries.
+ *
+ * When the transaction carries CIP-118 sub transactions the ledger checks value conservation over the whole batch, so
+ * the net imbalance of the sub transactions (see \ref cardano_compute_sub_transaction_imbalance) is part of the value
+ * that coin selection must cover: a net deficit is funded by additional top level inputs and a net surplus ends up in
+ * the change outputs, and the result is verified with the whole batch check of \ref cardano_is_transaction_balanced.
+ * A pool registered by several bodies of the batch pays the pool deposit once, as in
+ * \ref cardano_compute_transaction_batch_imbalance.
+ *
+ * The resolved UTXOs of the sub transactions, the ones they spend and optionally the ones they reference, are given in
+ * \p available_utxo, next to the UTXOs the top level transaction may spend. The role of each UTXO is taken from the
+ * bodies of the sub transactions: a UTXO that a sub transaction spends or references is never selected as a top level
+ * input. An input of a sub transaction is looked up in \p available_utxo first, then in \p reference_inputs and then in
+ * \p pre_selected_utxo, since a UTXO may be shared between the top level transaction and a sub transaction. Every input
+ * spent by a sub transaction must be resolved, while the reference inputs of the sub transactions that are not resolved
+ * are skipped.
+ *
+ * A top level transaction that needs a PlutusV1, PlutusV2 or PlutusV3 script must also conserve value by itself, with
+ * the sub transactions removed. As the ledger does, the decision follows the scripts that run, not the scripts that are
+ * present: a script is needed when the transaction spends an input it locks, mints under its policy, withdraws from a
+ * reward account it controls, carries a certificate it must authorize, votes with it as the voter, carries a parameter
+ * change or treasury withdrawals proposal it guards as the guardrails script or lists it among its guards, and its
+ * language is taken from whatever source provides it, pooled over the whole batch: the witness sets of the transaction
+ * and of its sub transactions, or a reference script of a resolved reference input, of a pre selected input or of an
+ * input chosen by coin selection of the transaction, or of an input or a reference input of a sub transaction. A
+ * reference input of a sub transaction that none of \p available_utxo, \p reference_inputs and \p pre_selected_utxo
+ * resolves is not seen. A script that is only present and that the transaction does not need never triggers this rule,
+ * and a needed native or PlutusV4 script does not either. The check is made on every balancing iteration, with the
+ * inputs of that iteration. When the rule applies the sub transactions must balance between themselves, otherwise the
+ * function fails with \ref CARDANO_ERROR_UNBALANCED_SUB_TRANSACTIONS and the fix is to add a balancing sub
+ * transaction, since top level change can not absorb the imbalance. In that mode the witness datums of the top level
+ * transaction are also checked with the sub transactions removed: each of them must be needed by an input the
+ * transaction spends, pre selected or coin selected, that is locked by a Plutus script among the pooled scripts, or
+ * match the datum hash of one of its outputs or of the output behind one of \p reference_inputs, otherwise the
+ * function fails with \ref CARDANO_ERROR_NOT_ALLOWED_SUPPLEMENTAL_DATUMS.
+ *
+ * The fee always includes the reference scripts the ledger charges for, whatever their language and whether or not the
+ * transaction has redeemers: every reference script found on the UTXOs of \p reference_inputs and on the UTXOs the
+ * transaction spends, pre selected or coin selected. A UTXO that is both referenced and spent is priced once, while the same
+ * script sitting on two different UTXOs is priced twice. The size of each script is the one reported by
+ * \ref cardano_get_serialized_script_size, which is the size the ledger prices.
+ *
+ * The top level transaction also pays the fee and posts the collateral of the whole batch. The fee covers the size of the
+ * sub transactions, the execution units of the redeemers of every sub transaction and the reference scripts of the sub
+ * transactions: the ones on the UTXOs each sub transaction spends and the ones on its resolved reference inputs. A UTXO that
+ * a sub transaction both references and spends is priced once, while a UTXO referenced by several sub transactions is priced
+ * once per sub transaction, as the ledger counts it when it prices the reference scripts of a batch. Collateral is added when a redeemer exists in the transaction or in any of its sub transactions, and it is sized from
+ * the fee of the top level transaction. The execution units the redeemers of the sub transactions declare are taken as
+ * final, since they are signed by the party that built each sub transaction. When the top level transaction carries
+ * redeemers, the resolved UTXOs of the sub transactions are handed to the transaction evaluator together with the ones
+ * of the top level transaction, so that it can run the scripts of every level, as the ledger does; a sub transaction
+ * script that fails then makes balancing fail with the error of the evaluator.
+ *
+ * \param[in, out] unbalanced_tx              A pointer to the transaction that needs balancing.
+ * \param[in]      foreign_signature_count    The number of expected extra signatures, not specified in the transaction.
+ * \param[in]      protocol_params            A pointer to the protocol parameters required for fee calculation and balancing.
+ * \param[in]      reference_inputs           A list of resolved reference inputs of the top level transaction that have already been included in the
+ *                                            transaction. The reference scripts they carry are priced in the fee. An input of a sub transaction that
+ *                                            is not found in \p available_utxo is also looked up in this list.
+ * \param[in]      pre_selected_utxo          A list of UTXOs that must be included in the transaction inputs. They must be disjoint from the inputs
+ *                                            spent by the sub transactions the transaction carries. An overlap is rejected. The reference scripts
+ *                                            they carry are priced in the fee. A reference input of a sub transaction that is not found in
+ *                                            \p available_utxo or in \p reference_inputs is also looked up in this list.
+ * \param[in]      input_to_redeemer_map      A map of inputs to redeemers. This map associates specific references of inputs to redeemers in the witness set. Balancing the transaction can add
+ *                                            additional inputs and this can make inputs change positions in the input set. Redeemers must be updated to point to the correct input.
+ *                                            If you provide redeemers for any pre-selected input, you must specify this association in this map.
+ * \param[in]      available_utxo             A list of available UTXOs to select from, if additional inputs are needed. The reference scripts
+ *                                            carried by the ones that end up selected are priced in the fee. When the transaction carries sub
+ *                                            transactions, the UTXOs they spend must be resolvable from this list or from \p reference_inputs, and
+ *                                            supplying them in this list is the recommended way. This list may also hold the UTXOs they reference.
+ *                                            The UTXOs a sub transaction spends or references are never selected, the value of the spent ones takes
+ *                                            part in the value conservation of the batch and the reference scripts they carry are priced in the fee.
+ *                                            The scripts of the UTXOs used only by sub transactions take no part in script evaluation or in the
+ *                                            validation mode of the top level transaction.
+ * \param[in]      coin_selector              A pointer to the coin selector used for choosing appropriate UTXOs.
+ * \param[in]      change_address             The address where any remaining balance (change) will be sent.
+ * \param[in]      available_collateral_utxo  A list of available UTXOs to select from as collateral if a redeemer exists in the transaction or in any of its sub transactions.
+ *                                            Collateral is required exactly when such a redeemer exists. This list can be NULL or empty only when
+ *                                            collateral is not required, otherwise the function fails with \ref CARDANO_ERROR_BALANCE_INSUFFICIENT.
+ *                                            The UTXOs a sub transaction spends or references are never used as collateral, even when the batcher is
+ *                                            also a party of the batch and offers them here. When every UTXO of this list is used by a sub transaction
+ *                                            and collateral is required, the function also fails with \ref CARDANO_ERROR_BALANCE_INSUFFICIENT.
+ * \param[in]      collateral_change_address  The address where any remaining collateral change will be sent, if applicable.
+ * \param[in]      evaluator                  A transaction evaluator instance for determining the execution cost of scripts.
+ * \param[in]      deferred_redeemers         An optional list of deferred redeemers to resolve on every balancing iteration, once the canonical
+ *                                            input order, change outputs and fee of the draft transaction are known. Each entry's callback produces
+ *                                            the redeemer payload from the balanced draft. Can be NULL if the transaction has no deferred redeemers.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction was balanced successfully, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if an input spent
+ *         by a sub transaction is not resolved, \ref CARDANO_ERROR_DUPLICATED_KEY if a pre selected UTXO is also spent by a sub transaction,
+ *         \ref CARDANO_ERROR_UNBALANCED_SUB_TRANSACTIONS if the top level transaction needs a PlutusV1, PlutusV2 or PlutusV3 script and
+ *         its sub transactions do not balance between themselves, \ref CARDANO_ERROR_NOT_ALLOWED_SUPPLEMENTAL_DATUMS if the top level
+ *         transaction needs a PlutusV1, PlutusV2 or PlutusV3 script and carries a witness datum that the ledger
+ *         does not allow once its sub transactions are removed,
+ *         \ref CARDANO_ERROR_BALANCE_INSUFFICIENT if collateral is required and
+ *         no collateral UTXO is available, \ref CARDANO_ERROR_INTEGER_OVERFLOW if the withdrawals, deposits or reclaimed deposits add up
+ *         to more than UINT64_MAX or the direct deposits, the produced coin or the consumed coin exceed INT64_MAX, or an appropriate
+ *         error code indicating the type of failure.
+ *
+ * \note This function assumes that the `unbalanced_tx` is a valid but incomplete transaction, missing necessary inputs to meet the target balance.
+ *       After calling this function, the `unbalanced_tx` will be updated with additional inputs, collateral, and, if necessary, a change output.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* tx = ...;                               // Unbalanced transaction
+ * size_t foreign_signature_count = 2;                            // Example number of signatures
+ * cardano_protocol_parameters_t* params = ...;                   // Protocol parameters
+ * cardano_utxo_list_t* ref_inputs = ...;                         // Resolved reference inputs
+ * cardano_utxo_list_t* preselected = ...;                        // Pre-selected UTXOs
+ * cardano_input_to_redeemer_map_t* input_to_redeemer_map = ...;  // Input to redeemer map
+ * cardano_utxo_list_t* available = ...;                          // Available UTXOs, including the UTXOs of the sub transactions
+ * cardano_coin_selector_t* selector = ...;                       // Coin selector instance
+ * cardano_address_t* change_addr = ...;                          // Change address
+ * cardano_utxo_list_t* collateral_utxo = ...;                    // Available collateral UTXOs
+ * cardano_address_t* collateral_change_addr = ...;               // Collateral change address
+ * cardano_tx_evaluator_t* eval = ...;                            // Evaluator instance
+ *
+ * cardano_error_t result = cardano_balance_transaction(tx, foreign_signature_count, params, ref_inputs, preselected, input_to_redeemer_map, available, selector, change_addr, collateral_utxo, collateral_change_addr, eval, NULL);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Transaction was balanced successfully
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_balance_transaction(
+  cardano_transaction_t*            unbalanced_tx,
+  size_t                            foreign_signature_count,
+  cardano_protocol_parameters_t*    protocol_params,
+  cardano_utxo_list_t*              reference_inputs,
+  cardano_utxo_list_t*              pre_selected_utxo,
+  cardano_input_to_redeemer_map_t*  input_to_redeemer_map,
+  cardano_utxo_list_t*              available_utxo,
+  cardano_coin_selector_t*          coin_selector,
+  cardano_address_t*                change_address,
+  cardano_utxo_list_t*              available_collateral_utxo,
+  cardano_address_t*                collateral_change_address,
+  cardano_tx_evaluator_t*           evaluator,
+  cardano_deferred_redeemer_list_t* deferred_redeemers);
+
+/**
+ * \brief Checks whether a Cardano transaction is balanced.
+ *
+ * This function verifies if the specified transaction (`tx`) meets the balance requirements as per Cardano protocol rules.
+ * It considers the total inputs, outputs, fees, and execution costs to determine if the transaction is balanced.
+ *
+ * Value conservation covers the whole CIP-118 batch: when the transaction carries sub transactions, the value they
+ * consume and produce is accounted together with the top level body, so the transaction is balanced when its
+ * \ref cardano_compute_transaction_batch_imbalance is zero. A transaction without sub transactions is balanced when its
+ * own body is.
+ *
+ * \param[in]  tx               A pointer to the transaction to be checked.
+ * \param[in]  resolved_inputs  A list of UTXOs that have been selected and are expected to cover the transaction's outputs and fees.
+ *                              It must resolve the inputs of the transaction and of every sub transaction it carries.
+ * \param[in]  protocol_params  Protocol parameters needed for fee calculation, including min-fee coefficients and other constraints.
+ * \param[out] is_balanced      A pointer to a boolean that will hold the result. Set to `true` if the transaction is balanced, or `false` otherwise.
+ *
+ * \return \ref CARDANO_SUCCESS if the balance check was performed successfully, \ref CARDANO_ERROR_INTEGER_OVERFLOW if the withdrawals,
+ *         deposits or reclaimed deposits of the transaction or of one of its sub transactions add up to more than UINT64_MAX or their
+ *         direct deposits, produced coin or consumed coin exceed INT64_MAX, or an appropriate error code indicating the type of failure.
+ *
+ * \note This function provides a quick way to verify that a transaction includes enough inputs to cover its outputs and all associated fees.
+ *       It does not modify the transaction but provides a binary check on its balance state.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* tx = ...;                // Transaction to check
+ * cardano_utxo_list_t* resolved_inputs = ...;     // List of resolved input UTXOs
+ * cardano_protocol_parameters_t* params = ...;    // Protocol parameters
+ * bool is_balanced = false;
+ *
+ * cardano_error_t result = cardano_is_transaction_balanced(tx, resolved_inputs, params, &is_balanced);
+ *
+ * if (result == CARDANO_SUCCESS && is_balanced)
+ * {
+ *   // Transaction is balanced
+ * }
+ * else
+ * {
+ *   // Transaction is not balanced, or an error occurred
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_is_transaction_balanced(
+  cardano_transaction_t*         tx,
+  cardano_utxo_list_t*           resolved_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  bool*                          is_balanced);
+
+/**
+ * \brief Computes the imbalance of a Cardano transaction.
+ *
+ * The imbalance is the value the transaction consumes minus the value it produces. Consumed value is the sum of the
+ * resolved input values, the reward withdrawals, the deposit refunds and the minted assets; produced value is the sum
+ * of the outputs, the fee, the deposits, the treasury donation, the direct deposits and the burned assets. The deposits
+ * and deposit refunds are the ones \ref cardano_compute_implicit_coin reports for the body.
+ *
+ * The imbalance covers the top level body only and ignores the sub transactions the transaction carries (body key 23).
+ * The figure the ledger checks for a CIP-118 batch is \ref cardano_compute_transaction_batch_imbalance, which is also
+ * what \ref cardano_is_transaction_balanced uses.
+ *
+ * For a transaction without sub transactions, a zero imbalance means the transaction is balanced. A positive coin or
+ * asset amount means the transaction consumes more than it produces (a surplus that a change output or another
+ * transaction in a CIP-118 batch must absorb), while a negative amount means it produces more than it consumes (a
+ * deficit that other transactions in the batch must fund).
+ *
+ * The returned value is independent of the transaction and of the resolved inputs: it owns its multi asset, so it may
+ * be modified freely (for example with \ref cardano_value_add_asset) without altering the mint field of the body or
+ * the value of any resolved UTXO.
+ *
+ * \param[in]  tx               A pointer to the transaction whose imbalance is computed.
+ * \param[in]  resolved_inputs  A list of UTXOs resolving every input of the transaction.
+ * \param[in]  protocol_params  Protocol parameters supplying the deposit amounts of the Shelley era certificates.
+ * \param[out] imbalance        On success, a pointer to a newly created \ref cardano_value_t holding the imbalance.
+ *                              The caller must release it with \ref cardano_value_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the imbalance was computed, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if an input has no
+ *         resolved UTXO, \ref CARDANO_ERROR_INTEGER_OVERFLOW if the withdrawals, deposits or reclaimed deposits add up to more
+ *         than UINT64_MAX or the direct deposits, the produced coin or the consumed coin exceed INT64_MAX, or an appropriate
+ *         error code indicating the type of failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* tx = ...;                // Transaction to inspect
+ * cardano_utxo_list_t* resolved_inputs = ...;     // List of resolved input UTXOs
+ * cardano_protocol_parameters_t* params = ...;    // Protocol parameters
+ * cardano_value_t* imbalance = NULL;
+ *
+ * cardano_error_t result = cardano_compute_transaction_imbalance(tx, resolved_inputs, params, &imbalance);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (cardano_value_get_coin(imbalance) > 0)
+ *   {
+ *     // The transaction consumes more lovelace than it produces
+ *   }
+ *
+ *   cardano_value_unref(&imbalance);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_compute_transaction_imbalance(
+  cardano_transaction_t*         tx,
+  cardano_utxo_list_t*           resolved_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_value_t**              imbalance);
+
+/**
+ * \brief Computes the imbalance of a CIP-118 sub transaction.
+ *
+ * A sub transaction is an intent: it is deliberately unbalanced and its imbalance is what a batcher matches against the
+ * other transactions of the batch. The imbalance is the value the sub transaction consumes minus the value it produces,
+ * with the same terms and the same sign convention as \ref cardano_compute_transaction_imbalance, except that a sub
+ * transaction body carries no fee.
+ *
+ * The returned value is independent of the sub transaction and of the resolved inputs: it owns its multi asset, so a
+ * batcher may modify it freely (for example with \ref cardano_value_add_asset) without altering the mint field of the
+ * sub transaction body or the value of any resolved UTXO.
+ *
+ * \param[in]  sub_tx           A pointer to the sub transaction whose imbalance is computed.
+ * \param[in]  resolved_inputs  A list of UTXOs resolving every input of the sub transaction.
+ * \param[in]  protocol_params  Protocol parameters supplying the deposit amounts of the Shelley era certificates.
+ * \param[out] imbalance        On success, a pointer to a newly created \ref cardano_value_t holding the imbalance.
+ *                              The caller must release it with \ref cardano_value_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the imbalance was computed, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if an input has no
+ *         resolved UTXO, \ref CARDANO_ERROR_INTEGER_OVERFLOW if the withdrawals, deposits or reclaimed deposits add up to more
+ *         than UINT64_MAX or the direct deposits, the produced coin or the consumed coin exceed INT64_MAX, or an appropriate
+ *         error code indicating the type of failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_tx = ...;        // Sub transaction to inspect
+ * cardano_utxo_list_t* resolved_inputs = ...;     // List of resolved input UTXOs
+ * cardano_protocol_parameters_t* params = ...;    // Protocol parameters
+ * cardano_value_t* imbalance = NULL;
+ *
+ * cardano_error_t result = cardano_compute_sub_transaction_imbalance(sub_tx, resolved_inputs, params, &imbalance);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Match the imbalance against the rest of the batch
+ *   cardano_value_unref(&imbalance);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_compute_sub_transaction_imbalance(
+  cardano_sub_transaction_t*     sub_tx,
+  cardano_utxo_list_t*           resolved_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_value_t**              imbalance);
+
+/**
+ * \brief Computes the imbalance of a whole CIP-118 batch.
+ *
+ * The ledger checks value conservation over the whole batch: the value consumed and produced by the top level
+ * transaction body and by every sub transaction it carries is summed in a single check. This function returns the
+ * imbalance of the top level body (see \ref cardano_compute_transaction_imbalance) plus the imbalance of each sub
+ * transaction (see \ref cardano_compute_sub_transaction_imbalance), coin and multi assets included, with the same sign
+ * convention: a positive amount is value the batch still has left over, a negative amount is value the batch still
+ * needs, and a zero imbalance means the batch is balanced.
+ *
+ * The figure is not a plain sum of the imbalances of the bodies for pool deposits: as the ledger does, a pool pays the
+ * pool deposit once across the whole batch, even when the top level body and its sub transactions, or several sub
+ * transactions, register it, so the pool deposit is given back once for every additional body that registers the same
+ * pool. A pool that is already registered on chain is still charged, as in \ref cardano_compute_implicit_coin.
+ *
+ * For a transaction that carries no sub transactions the result equals \ref cardano_compute_transaction_imbalance.
+ *
+ * The returned value is independent of the transaction, of its sub transactions and of the resolved inputs: it may be
+ * modified freely (for example with \ref cardano_value_add_asset) without altering any of them.
+ *
+ * \param[in]  tx               A pointer to the top level transaction whose batch imbalance is computed.
+ * \param[in]  resolved_inputs  A list of UTXOs resolving every input of the top level transaction body and of every sub
+ *                              transaction it carries.
+ * \param[in]  protocol_params  Protocol parameters supplying the deposit amounts of the Shelley era certificates.
+ * \param[out] imbalance        On success, a pointer to a newly created \ref cardano_value_t holding the imbalance.
+ *                              The caller must release it with \ref cardano_value_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the imbalance was computed, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if an input of the
+ *         top level body or of a sub transaction has no resolved UTXO, \ref CARDANO_ERROR_INTEGER_OVERFLOW if the withdrawals,
+ *         deposits or reclaimed deposits of the top level body or of a sub transaction add up to more than UINT64_MAX or
+ *         their direct deposits, produced coin or consumed coin exceed INT64_MAX, or an appropriate error code indicating
+ *         the type of failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* tx = ...;                // Top level transaction carrying the sub transactions
+ * cardano_utxo_list_t* resolved_inputs = ...;     // Resolved input UTXOs of the top level body and the sub transactions
+ * cardano_protocol_parameters_t* params = ...;    // Protocol parameters
+ * cardano_value_t* imbalance = NULL;
+ *
+ * cardano_error_t result = cardano_compute_transaction_batch_imbalance(tx, resolved_inputs, params, &imbalance);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (cardano_value_get_coin(imbalance) < 0)
+ *   {
+ *     // The batch still needs lovelace that the top level transaction must fund
+ *   }
+ *
+ *   cardano_value_unref(&imbalance);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_compute_transaction_batch_imbalance(
+  cardano_transaction_t*         tx,
+  cardano_utxo_list_t*           resolved_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_value_t**              imbalance);
+
+/**
+ * \brief Balances a transaction using known pool state for Dijkstra witness fees.
+ *
+ * All arguments and behavior are as in \ref cardano_balance_transaction, with the additional
+ * pool_state and pool_state_size arguments described in \ref cardano_transaction_get_unique_signers_with_pool_state.
+ * Unknown pools retain the conservative owner witness estimate. Pool deposits are unchanged.
+ * \return Success or the corresponding balancing, state-validation or allocation error.
+ * \param[in] unbalanced_tx The transaction to balance.
+ * \param[in] foreign_signature_count Additional signatures to price.
+ * \param[in] protocol_params Protocol parameters including the era version.
+ * \param[in] reference_inputs Resolved reference inputs.
+ * \param[in] pre_selected_utxo Preselected spend inputs.
+ * \param[in] input_to_redeemer_map Spend redeemers by input.
+ * \param[in] available_utxo Available spend inputs.
+ * \param[in] coin_selector Coin selector.
+ * \param[in] change_address Change address.
+ * \param[in] available_collateral_utxo Available collateral inputs.
+ * \param[in] collateral_change_address Collateral return address.
+ * \param[in] evaluator Script evaluator.
+ * \param[in] deferred_redeemers Deferred redeemer callbacks.
+ * \param[in] pool_state Known latest registered pool parameters, pending preferred over active.
+ * \param[in] pool_state_size Number of distinct pool entries.
+ */
+CARDANO_EXPORT cardano_error_t cardano_balance_transaction_with_pool_state(
+  cardano_transaction_t*            unbalanced_tx,
+  size_t                            foreign_signature_count,
+  cardano_protocol_parameters_t*    protocol_params,
+  cardano_utxo_list_t*              reference_inputs,
+  cardano_utxo_list_t*              pre_selected_utxo,
+  cardano_input_to_redeemer_map_t*  input_to_redeemer_map,
+  cardano_utxo_list_t*              available_utxo,
+  cardano_coin_selector_t*          coin_selector,
+  cardano_address_t*                change_address,
+  cardano_utxo_list_t*              available_collateral_utxo,
+  cardano_address_t*                collateral_change_address,
+  cardano_tx_evaluator_t*           evaluator,
+  cardano_deferred_redeemer_list_t* deferred_redeemers,
+  cardano_pool_params_t* const*     pool_state,
+  size_t                            pool_state_size);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BALANCING_H
diff --git a/vendor/include/cardano/transaction_builder/coin_selection/coin_selection_request.h b/vendor/include/cardano/transaction_builder/coin_selection/coin_selection_request.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/coin_selection/coin_selection_request.h
@@ -0,0 +1,93 @@
+/**
+ * \file coin_selection_request.h
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTION_REQUEST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTION_REQUEST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/protocol_params/protocol_parameters.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+#include <cardano/transaction_body/value.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Describes all inputs to a coin selection.
+ *
+ * All pointers are borrowed: they must remain valid for the duration of the
+ * \ref cardano_coin_selector_select call, and the selector does not take ownership of them.
+ *
+ * Zero-initialize the structure (<code>= { 0 }</code>) so that unset optional fields default safely.
+ * Fields added in future versions will be appended to the end of the structure, with a zero value
+ * meaning "default behavior".
+ */
+typedef struct cardano_coin_selection_request_t
+{
+    /**
+     * \brief Optional. A set of pre-selected UTXOs that must be included in the final selection.
+     */
+    cardano_utxo_list_t* pre_selected_utxo;
+
+    /**
+     * \brief Required. The list of available UTXOs from which the coin selection will be made.
+     */
+    cardano_utxo_list_t* available_utxo;
+
+    /**
+     * \brief Required. The target value to be covered by the selection. This value is authoritative
+     * for all balance arithmetic: the selection must uphold
+     * <code>sum(selection) = target + sum(change_outputs)</code>.
+     */
+    cardano_value_t* target;
+
+    /**
+     * \brief Optional. The user-specified outputs the target was derived from.
+     *
+     * Selectors may use this list as a shape and weight hint when generating change outputs
+     * (for example, to mimic the distribution of user payments). Selectors must not rely on it
+     * for balance arithmetic; the target is authoritative.
+     */
+    cardano_transaction_output_list_t* outputs_to_cover;
+
+    /**
+     * \brief Required. The address to which change outputs will be sent.
+     */
+    cardano_address_t* change_address;
+
+    /**
+     * \brief Required. The protocol parameters, used to ensure change outputs are min-ADA compliant.
+     */
+    cardano_protocol_parameters_t* protocol_params;
+
+} cardano_coin_selection_request_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTION_REQUEST_H
diff --git a/vendor/include/cardano/transaction_builder/coin_selection/coin_selection_strategy.h b/vendor/include/cardano/transaction_builder/coin_selection/coin_selection_strategy.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/coin_selection/coin_selection_strategy.h
@@ -0,0 +1,66 @@
+/**
+ * \file coin_selection_strategy.h
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTION_STRATEGY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTION_STRATEGY_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Indicates how much of each asset the random improve selector attempts to select,
+ * relative to the minimum amount necessary to cover the target.
+ *
+ * The optimal strategy attempts to select around twice the minimum possible amount of each
+ * asset, making it possible to generate change outputs that are roughly the same sizes and
+ * shapes as the user-specified outputs. This is the recommended default: it helps a wallet's
+ * UTXO distribution evolve over time to resemble the distribution of the payments it makes.
+ *
+ * The minimal strategy selects just enough of each asset to meet the minimum amount, producing
+ * selections with fewer inputs (and therefore smaller, cheaper transactions) at the cost of
+ * change outputs that are much smaller than the user-specified outputs.
+ *
+ * \note Because the selector upholds an exact local balance and acquires additional ada
+ * whenever change construction requires it, a selection that fails with the optimal strategy
+ * will also fail with the minimal strategy; no automatic fallback between strategies is
+ * performed.
+ */
+typedef enum cardano_selection_strategy_t
+{
+  /**
+   * \brief Selects just enough of each asset to meet the minimum amount.
+   */
+  CARDANO_SELECTION_STRATEGY_MINIMAL = 0,
+
+  /**
+   * \brief Attempts to select around twice the minimum amount of each asset.
+   */
+  CARDANO_SELECTION_STRATEGY_OPTIMAL = 1
+} cardano_selection_strategy_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTION_STRATEGY_H
diff --git a/vendor/include/cardano/transaction_builder/coin_selection/coin_selector.h b/vendor/include/cardano/transaction_builder/coin_selection/coin_selector.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/coin_selection/coin_selector.h
@@ -0,0 +1,373 @@
+/**
+ * \file coin_selector.h
+ *
+ * \author angel.castillo
+ * \date   Oct 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTOR_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTOR_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+#include <cardano/transaction_builder/coin_selection/coin_selector_impl.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Coin Selector Interface for Cardano.
+ *
+ * The `cardano_coin_selector_t` structure provides an interface for performing coin selection operations.
+ * The purpose of this structure is to enable efficient and optimized selection of UTXOs (Unspent Transaction Outputs)
+ * that can fulfill a specific transaction's required value while minimizing the transaction size and fees.
+ *
+ * Coin selection is a process where inputs are chosen to cover a target value,
+ * while potentially minimizing dust (small UTXOs), reducing the change size, or optimizing for other factors.
+ * The strategy and algorithm used in the coin selection can be customized and configured to suit various
+ * transaction requirements.
+ *
+ * This structure includes the necessary context and configuration for selecting UTXOs from a pool of
+ * available outputs, along with additional functionality such as filtering and prioritizing UTXOs.
+ *
+ * Coin selection algorithms implemented within this structure might include:
+ * - Largest First: Selecting the largest UTXOs first to reduce the number of inputs.
+ * - Random Improve: A method where random UTXOs are selected with a focus on minimizing dust.
+ * - Custom strategies, as defined by implementers.
+ *
+ * \remark The caller must manage the life of the \c selected_utxo, \c remaining_utxo and \c change_outputs lists
+ * by calling \ref cardano_utxo_list_unref and \ref cardano_transaction_output_list_unref when they are no longer needed.
+ *
+ * \see CIP-0002: https://cips.cardano.org/cip/CIP-0002
+ *
+ * Example usage:
+ * \code{.c}
+ * cardano_coin_selector_t* coin_selector = ...;          // Initialize the coin selector
+ * cardano_utxo_list_t* available_utxo = ...;             // Available UTXOs
+ * cardano_value_t* target_value = ...;                   // The target value to cover
+ * cardano_address_t* change_address = ...;               // Address for change outputs
+ * cardano_protocol_parameters_t* protocol_params = ...;  // Protocol parameters
+ * cardano_utxo_list_t* selected_utxo = NULL;
+ * cardano_utxo_list_t* remaining_utxo = NULL;
+ * cardano_transaction_output_list_t* change_outputs = NULL;
+ *
+ * cardano_coin_selection_request_t request = { 0 };
+ *
+ * request.available_utxo  = available_utxo;
+ * request.target          = target_value;
+ * request.change_address  = change_address;
+ * request.protocol_params = protocol_params;
+ *
+ * cardano_error_t result = cardano_coin_selector_select(
+ *     coin_selector,
+ *     &request,
+ *     &selected_utxo,
+ *     &remaining_utxo,
+ *     &change_outputs);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Coin selection succeeded
+ * }
+ *
+ * // Free the selected, remaining and change output lists when done
+ * cardano_utxo_list_unref(&selected_utxo);
+ * cardano_utxo_list_unref(&remaining_utxo);
+ * cardano_transaction_output_list_unref(&change_outputs);
+ * \endcode
+ */
+typedef struct cardano_coin_selector_t cardano_coin_selector_t;
+
+/**
+ * \brief Creates a new `cardano_coin_selector_t` object using the provided implementation.
+ *
+ * This function initializes a new \ref cardano_coin_selector_t object by wrapping the given
+ * \ref cardano_coin_selector_impl_t implementation. The newly created coin_selector object manages
+ * the lifecycle of the underlying implementation and provides an interface for interacting
+ * with the Cardano blockchain functionalities.
+ *
+ * \param[in]  impl     The coin_selector implementation containing function pointers and context.
+ * \param[out] coin_selector A pointer to store the address of the newly created coin_selector object.
+ *                      This should be a valid pointer to a \ref cardano_coin_selector_t* variable.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume 'impl' is a valid cardano_coin_selector_impl_t initialized elsewhere.
+ * cardano_coin_selector_t* coin_selector = NULL;
+ * cardano_error_t result = cardano_coin_selector_new(impl, &coin_selector);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the coin_selector
+ * }
+ * else
+ * {
+ *   printf("Error: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // When done with the coin_selector
+ * cardano_coin_selector_unref(&coin_selector);
+ * \endcode
+ *
+ * \note After successfully creating a \ref cardano_coin_selector_t object, you are responsible for
+ *       managing its lifecycle. Ensure that you call \ref cardano_coin_selector_unref when the
+ *       coin_selector is no longer needed to release resources and prevent memory leaks.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_coin_selector_new(cardano_coin_selector_impl_t impl, cardano_coin_selector_t** coin_selector);
+
+/**
+ * \brief Retrieves the name of the coin_selector implementation.
+ *
+ * This function returns a constant string representing the name of the coin_selector implementation.
+ * The name can be used for logging, debugging, or informational purposes to identify which
+ * coin_selector implementation is being used.
+ *
+ * \param[in] coin_selector Pointer to the \ref cardano_coin_selector_t object.
+ *
+ * \returns A constant character pointer to the coin_selector's name string.
+ *          The returned string is owned by the coin_selector and must not be modified or freed by the caller.
+ *          If the \p coin_selector is NULL or invalid, the function may return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* coin_selector_name = cardano_coin_selector_get_name(coin_selector);
+ *
+ * if (coin_selector_name)
+ * {
+ *   printf("Using coin_selector: %s\n", coin_selector_name);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve coin_selector name.\n");
+ * }
+ * \endcode
+ *
+ * \note The returned string remains valid as long as the \ref cardano_coin_selector_t object is valid.
+ *       Do not attempt to modify or free the returned string.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_coin_selector_get_name(const cardano_coin_selector_t* coin_selector);
+
+/**
+ * \brief Selects UTXOs to satisfy the target value using a coin selection strategy.
+ *
+ * This function performs coin selection using the provided \ref cardano_coin_selector_t object, selecting UTXOs from the
+ * available UTXO set to meet the target value described by the given request. It returns the selected UTXOs, any
+ * remaining UTXOs that were not chosen, and the change outputs produced by the selection in separate output parameters.
+ *
+ * The selection is locally balanced. It upholds the invariant:
+ *
+ * \code
+ * sum(selection) = target + sum(change_outputs)
+ * \endcode
+ *
+ * Every change output is guaranteed to be min-ADA compliant as per the protocol parameters. To uphold this guarantee,
+ * the selector may consume more UTXOs from the available pool than strictly required to cover the target value.
+ *
+ * The selector does not attempt fee calculation or global transaction balancing; those remain the responsibility
+ * of the balancer (see \ref cardano_balance_transaction).
+ *
+ * \param[in] coin_selector A pointer to the \ref cardano_coin_selector_t object, which defines the coin selection strategy.
+ * \param[in] request The selection request describing all inputs to the selection. See
+ *                    \ref cardano_coin_selection_request_t. The request and its required fields must not be NULL;
+ *                    all pointers in the request are borrowed for the duration of the call.
+ * \param[out] selection A pointer to a UTXO list where the selected UTXOs will be stored.
+ *                       The caller is responsible for releasing the memory of this list when done.
+ * \param[out] remaining_utxo A pointer to a UTXO list where the remaining, unselected UTXOs will be stored.
+ *                            The caller is responsible for releasing the memory of this list when done.
+ * \param[out] change_outputs A pointer to a transaction output list where the change outputs will be stored. The list
+ *                            may be empty if the selection matches the target exactly.
+ *                            The caller is responsible for releasing the memory of this list when done.
+ *
+ * \return \ref CARDANO_SUCCESS if the coin selection succeeded, or an appropriate error code indicating failure.
+ *
+ * \note `selection`, `remaining_utxo` and `change_outputs` must be properly freed by the caller after use.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_coin_selection_request_t request = { 0 };
+ *
+ * request.available_utxo  = available_utxo;    // List of available UTXOs
+ * request.target          = target_value;      // Target value in lovelace or multi-asset format
+ * request.change_address  = change_address;    // Address for change outputs
+ * request.protocol_params = protocol_params;   // Protocol parameters
+ *
+ * cardano_utxo_list_t* selected_utxo = NULL;
+ * cardano_utxo_list_t* remaining_utxo = NULL;
+ * cardano_transaction_output_list_t* change_outputs = NULL;
+ *
+ * cardano_error_t result = cardano_coin_selector_select(
+ *     coin_selector, &request, &selected_utxo, &remaining_utxo, &change_outputs);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully selected UTXOs
+ * }
+ *
+ * // Clean up lists after use
+ * cardano_utxo_list_unref(&selected_utxo);
+ * cardano_utxo_list_unref(&remaining_utxo);
+ * cardano_transaction_output_list_unref(&change_outputs);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_coin_selector_select(
+  cardano_coin_selector_t*                coin_selector,
+  const cardano_coin_selection_request_t* request,
+  cardano_utxo_list_t**                   selection,
+  cardano_utxo_list_t**                   remaining_utxo,
+  cardano_transaction_output_list_t**     change_outputs);
+
+/**
+ * \brief Decrements the reference count of a cardano_coin_selector_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_coin_selector_t object
+ * by decreasing its reference count. When the reference count reaches zero, the coin_selector is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] coin_selector A pointer to the pointer of the coin_selector object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_coin_selector_t* coin_selector = cardano_coin_selector_new(major, minor);
+ *
+ * // Perform operations with the coin_selector...
+ *
+ * cardano_coin_selector_unref(&coin_selector);
+ * // At this point, coin_selector is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_coin_selector_unref, the pointer to the \ref cardano_coin_selector_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_coin_selector_unref(cardano_coin_selector_t** coin_selector);
+
+/**
+ * \brief Increases the reference count of the cardano_coin_selector_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_coin_selector_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_coin_selector_unref.
+ *
+ * \param coin_selector A pointer to the cardano_coin_selector_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming coin_selector is a previously created coin_selector object
+ *
+ * cardano_coin_selector_ref(coin_selector);
+ *
+ * // Now coin_selector can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_coin_selector_ref there is a corresponding
+ * call to \ref cardano_coin_selector_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_coin_selector_ref(cardano_coin_selector_t* coin_selector);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_coin_selector_t object.
+ *
+ * This function returns the number of active references to an cardano_coin_selector_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_coin_selector_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param coin_selector A pointer to the cardano_coin_selector_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_coin_selector_t object. If the object
+ * is properly managed (i.e., every \ref cardano_coin_selector_ref call is matched with a
+ * \ref cardano_coin_selector_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming coin_selector is a previously created coin_selector object
+ *
+ * size_t ref_count = cardano_coin_selector_refcount(coin_selector);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_coin_selector_refcount(const cardano_coin_selector_t* coin_selector);
+
+/**
+ * \brief Sets the last error message for a given cardano_coin_selector_t object.
+ *
+ * Records an error message in the coin_selector's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] coin_selector A pointer to the \ref cardano_coin_selector_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the coin_selector's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_coin_selector_set_last_error(
+  cardano_coin_selector_t* coin_selector,
+  const char*              message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific coin_selector.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_coin_selector_set_last_error for the given
+ * coin_selector. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] coin_selector A pointer to the \ref cardano_coin_selector_t instance whose last error
+ *                   message is to be retrieved. If the coin_selector is NULL, the function
+ *                   returns a generic error message indicating the null coin_selector.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified coin_selector. If the coin_selector is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_coin_selector_set_last_error for the same coin_selector, or until
+ *       the coin_selector is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_coin_selector_get_last_error(const cardano_coin_selector_t* coin_selector);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTOR_H
diff --git a/vendor/include/cardano/transaction_builder/coin_selection/coin_selector_impl.h b/vendor/include/cardano/transaction_builder/coin_selection/coin_selector_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/coin_selection/coin_selector_impl.h
@@ -0,0 +1,136 @@
+/**
+ * \file coin_selector_impl.h
+ *
+ * \author angel.castillo
+ * \date   Oct 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTOR_IMPL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTOR_IMPL_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/protocol_params/protocol_parameters.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+#include <cardano/transaction_body/value.h>
+#include <cardano/transaction_builder/coin_selection/coin_selection_request.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* FORWARD DECLARATIONS *******************************************************/
+
+/**
+ * \brief Opaque structure representing the coin selection implementation.
+ *
+ * The `cardano_coin_selector_impl_t` is an opaque structure that implements coin selection logic.
+ * It abstracts away the internal details of coin selection.
+ */
+typedef struct cardano_coin_selector_impl_t cardano_coin_selector_impl_t;
+
+/* CALLBACKS *****************************************************************/
+
+/**
+ * \brief Callback function type for performing coin selection.
+ *
+ * The `cardano_coin_select_func_t` typedef defines the signature for a callback function responsible
+ * for selecting a set of UTXOs (Unspent Transaction Outputs) from an available list to meet a specific target value,
+ * and for producing the change outputs that return any excess value to the change address.
+ *
+ * This function is expected to:
+ * - Use the request's `available_utxo` list and optionally its `pre_selected_utxo` list to select UTXOs
+ *   that meet the required `target` value.
+ * - Store the selected UTXOs in the `selection` list, ensuring the selection covers the target value.
+ * - Store any remaining UTXOs that were not selected in the `remaining_utxo` list.
+ * - Produce one or more change outputs in the `change_outputs` list such that the selection is locally balanced:
+ *   sum(selection) = target + sum(change_outputs).
+ * - Ensure every change output is min-ADA compliant as per the protocol parameters (selecting additional UTXOs
+ *   from the available pool if necessary to top up the change).
+ *
+ * The selector must not attempt fee calculation or global transaction balancing; those remain the
+ * responsibility of the balancer.
+ *
+ * \param[in] coin_selector A pointer to the \ref cardano_coin_selector_impl_t object implementing the coin selection strategy.
+ * \param[in] request The selection request. See \ref cardano_coin_selection_request_t. The wrapper guarantees
+ *                    that the request pointer and its required fields are not NULL.
+ * \param[out] selection A pointer to the list of UTXOs that were selected to meet the target value.
+ * \param[out] remaining_utxo A pointer to the list of UTXOs that were not selected and remain available for future transactions.
+ * \param[out] change_outputs A pointer to the list of change outputs produced by the selection. The list may be empty
+ *                            if the selection matches the target exactly.
+ *
+ * \return \ref CARDANO_SUCCESS if the coin selection was successful and UTXOs were selected to meet the target, or an appropriate error code indicating failure.
+ *
+ * \note The caller is responsible for managing the memory of the `selection`, `remaining_utxo` and `change_outputs` lists,
+ *       ensuring they are properly freed when no longer needed.
+ */
+typedef cardano_error_t (*cardano_coin_select_func_t)(
+  cardano_coin_selector_impl_t*           coin_selector,
+  const cardano_coin_selection_request_t* request,
+  cardano_utxo_list_t**                   selection,
+  cardano_utxo_list_t**                   remaining_utxo,
+  cardano_transaction_output_list_t**     change_outputs);
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Opaque structure representing the coin selection implementation.
+ *
+ * The `cardano_coin_selector_impl_t` is an opaque structure that implements coin selection logic.
+ * It abstracts away the internal details of coin selection.
+ */
+typedef struct cardano_coin_selector_impl_t
+{
+    /**
+     * \brief Name of the coin selector implementation.
+     */
+    char name[256];
+
+    /**
+     * \brief Error message buffer for coin selector specific error messages.
+     */
+    char error_message[1024];
+
+    /**
+     * \brief Opaque pointer to the implementation-specific context.
+     *
+     * This pointer holds the state or context required by the coin selector implementation.
+     * Users should not access or modify this directly.
+     */
+    cardano_object_t* context;
+
+    /**
+     * \brief Function to select UTXOs to meet a target value.
+     *
+     * \see cardano_coin_select_func_t
+     */
+    cardano_coin_select_func_t select;
+
+} cardano_coin_selector_impl_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_COIN_SELECTOR_IMPL_H
diff --git a/vendor/include/cardano/transaction_builder/coin_selection/large_first_coin_selector.h b/vendor/include/cardano/transaction_builder/coin_selection/large_first_coin_selector.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/coin_selection/large_first_coin_selector.h
@@ -0,0 +1,61 @@
+/**
+ * \file large_first_coin_selector.h
+ *
+ * \author angel.castillo
+ * \date   Oct 16, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_LARGE_FIRST_COIN_SELECTOR_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_LARGE_FIRST_COIN_SELECTOR_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Creates a new coin selector using the "large first" strategy.
+ *
+ * The `cardano_large_first_coin_selector_new` function initializes a new coin selector object that implements
+ * the "large first" strategy. In this strategy, UTXOs (Unspent Transaction Outputs) with larger amounts of assets
+ * are selected first to satisfy the target amount. This strategy can be more efficient for reducing the number
+ * of UTXOs involved in transactions, but may result in lower UTXO fragmentation.
+ *
+ * \param[out] coin_selector A pointer to the coin selector object that will be created and returned by this function.
+ *
+ * \return \ref CARDANO_SUCCESS if the coin selector was successfully created, or an appropriate error code indicating failure.
+ *
+ * \note The caller is responsible for managing the memory of the created `coin_selector` object, and must ensure
+ *       it is properly freed when no longer needed using the appropriate deallocation function.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_large_first_coin_selector_new(
+  cardano_coin_selector_t** coin_selector);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_LARGE_FIRST_COIN_SELECTOR_H
diff --git a/vendor/include/cardano/transaction_builder/coin_selection/random_improve_coin_selector.h b/vendor/include/cardano/transaction_builder/coin_selection/random_improve_coin_selector.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/coin_selection/random_improve_coin_selector.h
@@ -0,0 +1,146 @@
+/**
+ * \file random_improve_coin_selector.h
+ *
+ * \author angel.castillo
+ * \date   Jul 02, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_COIN_SELECTOR_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_COIN_SELECTOR_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+#include <cardano/transaction_builder/coin_selection/coin_selection_strategy.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Creates a new Round-Robin Random-Improve coin selector.
+ *
+ * This selector is a port of the multi-asset coin selection algorithm used by cardano-wallet
+ * (Round-Robin Random-Improve, a generalization of CIP-2 Random-Improve). It works in two phases:
+ *
+ * 1. Selection: one sub-selector per required asset (plus one for ada, which runs last) is processed
+ *    in round-robin order. On each turn a sub-selector picks a single UTXO at random, preferring UTXOs
+ *    that contain only its asset, then UTXOs that pair its asset with one other, then any UTXO containing
+ *    the asset. While a sub-selector's minimum is not yet covered, any selection is accepted; once covered,
+ *    additional selections are accepted only while they move the selected quantity closer to twice the
+ *    minimum. This headroom is what allows change outputs to resemble the user's payments.
+ *
+ * 2. Change generation: one change output is created per user-specified output (see the `outputs_to_cover`
+ *    parameter of \ref cardano_coin_selector_select). The excess of each user-specified asset is partitioned
+ *    across the change outputs in proportion to the user's output quantities; assets that were selected
+ *    incidentally are distributed in a way that preserves the granularity of the selected inputs. Every
+ *    change output is min-ADA compliant; if the selected ada is insufficient to build the change outputs,
+ *    additional ada-only UTXOs are selected at random until change can be constructed.
+ *
+ * Compared to largest-first selection, this algorithm keeps the wallet's UTXO distribution healthy over
+ * time (improving transaction parallelism and privacy) at the cost of potentially selecting more inputs.
+ *
+ * \param[out] coin_selector A pointer to store the address of the newly created coin selector object.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *
+ * \note The selector is seeded from a cryptographically secure entropy source. Use
+ *       \ref cardano_random_improve_coin_selector_new_with_seed for deterministic behavior.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_coin_selector_t* coin_selector = NULL;
+ * cardano_error_t result = cardano_random_improve_coin_selector_new(&coin_selector);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   cardano_tx_builder_set_coin_selector(tx_builder, coin_selector);
+ * }
+ *
+ * cardano_coin_selector_unref(&coin_selector);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_random_improve_coin_selector_new(cardano_coin_selector_t** coin_selector);
+
+/**
+ * \brief Creates a new Round-Robin Random-Improve coin selector with a deterministic seed.
+ *
+ * Behaves exactly like \ref cardano_random_improve_coin_selector_new, but the internal random number
+ * generator is seeded with the given value, making the selection fully deterministic and reproducible.
+ * This is primarily useful for testing.
+ *
+ * \param[in]  seed          The seed for the internal random number generator.
+ * \param[out] coin_selector A pointer to store the address of the newly created coin selector object.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_coin_selector_t* coin_selector = NULL;
+ * cardano_error_t result = cardano_random_improve_coin_selector_new_with_seed(42, &coin_selector);
+ *
+ * // ... use the selector; selections are reproducible for the same seed and inputs ...
+ *
+ * cardano_coin_selector_unref(&coin_selector);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_random_improve_coin_selector_new_with_seed(
+  uint64_t                  seed,
+  cardano_coin_selector_t** coin_selector);
+
+/**
+ * \brief Creates a new Round-Robin Random-Improve coin selector with a deterministic seed and
+ * an explicit selection strategy.
+ *
+ * Behaves like \ref cardano_random_improve_coin_selector_new_with_seed, but additionally allows
+ * the selection strategy to be chosen. See \ref cardano_selection_strategy_t.
+ *
+ * \param[in]  seed          The seed for the internal random number generator.
+ * \param[in]  strategy      The selection strategy to use.
+ * \param[out] coin_selector A pointer to store the address of the newly created coin selector object.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_coin_selector_t* coin_selector = NULL;
+ * cardano_error_t result = cardano_random_improve_coin_selector_new_with_options(
+ *   42, CARDANO_SELECTION_STRATEGY_MINIMAL, &coin_selector);
+ *
+ * // ... the selector now selects just enough of each asset to cover the target ...
+ *
+ * cardano_coin_selector_unref(&coin_selector);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_random_improve_coin_selector_new_with_options(
+  uint64_t                     seed,
+  cardano_selection_strategy_t strategy,
+  cardano_coin_selector_t**    coin_selector);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_COIN_SELECTOR_H
diff --git a/vendor/include/cardano/transaction_builder/evaluation/native_tx_evaluator.h b/vendor/include/cardano/transaction_builder/evaluation/native_tx_evaluator.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/evaluation/native_tx_evaluator.h
@@ -0,0 +1,216 @@
+/**
+ * \file native_tx_evaluator.h
+ *
+ * \author angel.castillo
+ * \date   Jun 20, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BUILDER_EVALUATION_NATIVE_TX_EVALUATOR_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BUILDER_EVALUATION_NATIVE_TX_EVALUATOR_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/protocol_params/costmdls.h>
+#include <cardano/slot_config.h>
+#include <cardano/transaction_builder/evaluation/tx_evaluator.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Creates a native phase-2 transaction evaluator backed by the in-process UPLC VM.
+ *
+ * The native evaluator is the phase-2 driver: for every redeemer in a transaction
+ * it resolves the script and (for spends) the datum, builds the version-appropriate
+ * Plutus \c ScriptContext, applies the arguments, evaluates the program on the
+ * CEK machine, and writes the consumed execution units back into the redeemer it
+ * returns. It plugs into the existing \ref cardano_tx_evaluator_t interface
+ * through a \ref cardano_tx_evaluator_impl_t, so callers use it exactly as they
+ * would the provider-backed evaluator.
+ *
+ * A Dijkstra transaction runs scripts at two levels: the top-level transaction
+ * and each of its sub-transactions, every level with its own redeemers. Like the
+ * ledger, the evaluator runs the redeemers of every level together: a script
+ * that fails at any level fails the evaluation. The redeemers this evaluator
+ * returns are those of the top-level transaction; use
+ * \ref cardano_tx_evaluator_new_native_sub_transaction for the redeemers of a
+ * sub-transaction. Plutus V4 scripts are evaluated with the V4 \c ScriptContext
+ * of the level they run at, guarding redeemers resolve to the guard at their
+ * index in the guard set of their level (key-hash guards count towards the
+ * index), and a script needed by any level can be provided by the witness set of
+ * any level or by a reference script.
+ *
+ * The \ref cardano_tx_evaluator_evaluate signature carries no slot config, cost
+ * models or protocol version, so this constructor binds them once: the slot
+ * config converts validity slots to POSIX time for the \c ScriptContext, the cost
+ * models and protocol major version select the builtin semantics variant per
+ * script. The evaluator copies \p slot_config and takes a reference on
+ * \p cost_models; both stay owned by the evaluator for its lifetime.
+ *
+ * \remark For each script the driver builds the structured cost model from the
+ *         \p cost_models entry matching the script's language version and threads
+ *         it, together with the selected builtin semantics variant, into the CEK
+ *         machine's budget accounting. The returned execution units therefore
+ *         reflect the supplied ledger cost model exactly: the machine charges
+ *         every step and builtin against those coefficients. When \p cost_models
+ *         carries no entry for a version, the per-version default coefficients for
+ *         the protocol version are used instead.
+ *
+ * \remark Each script is deserialised the way the ledger does at the protocol
+ *         version: its language and every builtin it names must be available
+ *         there. Every script of every level is deserialised before any of them
+ *         runs, so a script that cannot be deserialised makes
+ *         \ref cardano_tx_evaluator_evaluate return \ref CARDANO_ERROR_DECODING
+ *         even when another script would fail phase-2 validation. A script whose
+ *         Plutus Core version is not available at the protocol version, a script
+ *         with a free variable, a script that runs and fails, or a Plutus V3 or
+ *         V4 script that does not return unit, returns
+ *         \ref CARDANO_ERROR_SCRIPT_EVALUATION_FAILURE. A sub-transaction
+ *         redeemer that runs a Plutus V1, V2 or V3 script returns
+ *         \ref CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE, since those languages only
+ *         run at the top level. Below protocol version 12 the free variable check,
+ *         like the ledger's, does not look inside \c constr and \c case terms; from
+ *         12 on it covers the whole script.
+ *
+ * \remark A redeemer whose index points past the items of its purpose in its
+ *         transaction level (for example past the end of the guard set) returns
+ *         \ref CARDANO_ERROR_INDEX_OUT_OF_BOUNDS, and a redeemer whose item is not
+ *         authorised by a script (for example a key-hash guard) returns
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT. Like the ledger, a Plutus V1, V2 or
+ *         V3 script cannot run in a transaction that carries direct deposits,
+ *         account balance intervals, required top-level guards or a script-hash
+ *         guard, since its \c ScriptContext cannot represent them; such a
+ *         transaction returns \ref CARDANO_ERROR_INVALID_ARGUMENT, as does a
+ *         Plutus V1 or V2 script in a transaction with votes, proposals, a
+ *         current treasury value or a treasury donation.
+ *
+ * \param[in] slot_config The slot/time parameters used to convert the transaction
+ *            validity interval to POSIX time. Must not be NULL.
+ * \param[in] cost_models The ledger cost models keyed by Plutus language version.
+ *            May be NULL, in which case the evaluator uses the per-version default
+ *            semantics for the protocol version.
+ * \param[in] protocol_major The protocol major version selecting the builtin
+ *            semantics variant and the language, builtin and Plutus Core
+ *            versions each script may use.
+ * \param[out] tx_evaluator On success, set to the newly created evaluator. The
+ *             caller owns it and releases it with \ref cardano_tx_evaluator_unref.
+ *             Left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p slot_config or \p tx_evaluator is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the evaluator context
+ *         cannot be allocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_evaluator_t* evaluator = NULL;
+ * cardano_error_t         result    = cardano_tx_evaluator_new_native(
+ *   &CARDANO_MAINNET_SLOT_CONFIG, cost_models, 10U, &evaluator);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   cardano_redeemer_list_t* redeemers = NULL;
+ *   result = cardano_tx_evaluator_evaluate(evaluator, tx, additional_utxos, &redeemers);
+ *   // ... inspect redeemers' ex-units ...
+ *   cardano_redeemer_list_unref(&redeemers);
+ *   cardano_tx_evaluator_unref(&evaluator);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_tx_evaluator_new_native(
+  const cardano_slot_config_t* slot_config,
+  cardano_costmdls_t*          cost_models,
+  uint64_t                     protocol_major,
+  cardano_tx_evaluator_t**     tx_evaluator);
+
+/**
+ * \brief Creates a native phase-2 evaluator that returns the redeemers of a sub-transaction.
+ *
+ * Behaves like \ref cardano_tx_evaluator_new_native and evaluates the whole
+ * transaction the same way, the top level and every sub-transaction together,
+ * but the redeemer list \ref cardano_tx_evaluator_evaluate returns holds the
+ * redeemers of the sub-transaction at position \p sub_tx_index of the top-level
+ * transaction body, in the order of that sub-transaction's witness set, each
+ * carrying its computed execution units. Together with the evaluator returned by
+ * \ref cardano_tx_evaluator_new_native, this maps the execution units back to
+ * every redeemer at every level.
+ *
+ * Evaluating a transaction that has no sub-transaction at \p sub_tx_index
+ * returns \ref CARDANO_ERROR_INDEX_OUT_OF_BOUNDS.
+ *
+ * \param[in] slot_config The slot/time parameters used to convert the validity
+ *            intervals to POSIX time. Must not be NULL.
+ * \param[in] cost_models The ledger cost models keyed by Plutus language version.
+ *            May be NULL, in which case the evaluator uses the per-version default
+ *            semantics for the protocol version.
+ * \param[in] protocol_major The protocol major version selecting the builtin
+ *            semantics variant and the language, builtin and Plutus Core
+ *            versions each script may use.
+ * \param[in] sub_tx_index The position of the sub-transaction in the body of the
+ *            evaluated transaction.
+ * \param[out] tx_evaluator On success, set to the newly created evaluator. The
+ *             caller owns it and releases it with \ref cardano_tx_evaluator_unref.
+ *             Left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p slot_config or \p tx_evaluator is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the evaluator context
+ *         cannot be allocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_evaluator_t* evaluator = NULL;
+ * cardano_error_t         result    = cardano_tx_evaluator_new_native_sub_transaction(
+ *   &slot_config, cost_models, 12U, 0U, &evaluator);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   cardano_redeemer_list_t* redeemers = NULL;
+ *   result = cardano_tx_evaluator_evaluate(evaluator, tx, resolved_utxos, &redeemers);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     printf("The first sub transaction has %zu redeemers.\n", cardano_redeemer_list_get_length(redeemers));
+ *   }
+ *
+ *   cardano_redeemer_list_unref(&redeemers);
+ *   cardano_tx_evaluator_unref(&evaluator);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_tx_evaluator_new_native_sub_transaction(
+  const cardano_slot_config_t* slot_config,
+  cardano_costmdls_t*          cost_models,
+  uint64_t                     protocol_major,
+  uint64_t                     sub_tx_index,
+  cardano_tx_evaluator_t**     tx_evaluator);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BUILDER_EVALUATION_NATIVE_TX_EVALUATOR_H */
diff --git a/vendor/include/cardano/transaction_builder/evaluation/provider_tx_evaluator.h b/vendor/include/cardano/transaction_builder/evaluation/provider_tx_evaluator.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/evaluation/provider_tx_evaluator.h
@@ -0,0 +1,76 @@
+/**
+ * \file provider_tx_evaluator.h
+ *
+ * \author angel.castillo
+ * \date   Nov 05, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PROVIDER_TX_EVALUATOR_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PROVIDER_TX_EVALUATOR_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/providers/provider.h>
+#include <cardano/transaction_builder/evaluation/tx_evaluator.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Creates a transaction evaluator from a provider.
+ *
+ * This function initializes a new transaction evaluator (`tx_evaluator`) using the specified blockchain data provider, allowing
+ * transactions to be evaluated based on the provider’s configuration and resources.
+ *
+ * \param[in] provider A pointer to the \ref cardano_provider_t instance that will be used to configure the transaction evaluator.
+ * \param[out] tx_evaluator A double pointer to a \ref cardano_tx_evaluator_t instance, which will be populated with
+ *                          the newly created transaction evaluator.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction evaluator was successfully created, or an appropriate error code indicating failure.
+ *
+ * \note The caller is responsible for releasing the allocated memory of `tx_evaluator` by calling the appropriate release function.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_evaluator_t* tx_evaluator = NULL;
+ * cardano_error_t result = cardano_tx_evaluator_from_provider(provider, &tx_evaluator);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The transaction evaluator was successfully created and is ready for use
+ * }
+ *
+ * // Release the evaluator when it is no longer needed
+ * cardano_tx_evaluator_unref(&tx_evaluator);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_tx_evaluator_from_provider(
+  cardano_provider_t*      provider,
+  cardano_tx_evaluator_t** tx_evaluator);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PROVIDER_TX_EVALUATOR_H
diff --git a/vendor/include/cardano/transaction_builder/evaluation/tx_evaluator.h b/vendor/include/cardano/transaction_builder/evaluation/tx_evaluator.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/evaluation/tx_evaluator.h
@@ -0,0 +1,274 @@
+/**
+ * \file tx_evaluator.h
+ *
+ * \author angel.castillo
+ * \date   Nov 05, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TX_EVALUATOR_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TX_EVALUATOR_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+#include <cardano/transaction_builder/evaluation/tx_evaluator_impl.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Opaque structure for a transaction evaluator.
+ *
+ * The `cardano_tx_evaluator_t` structure serves as the public-facing handle for managing
+ * the transaction evaluation process within the Cardano framework.
+ */
+typedef struct cardano_tx_evaluator_t cardano_tx_evaluator_t;
+
+/**
+ * \brief Creates a new transaction evaluator instance.
+ *
+ * This function initializes a new `cardano_tx_evaluator_t` instance using the provided implementation.
+ * The `tx_evaluator` parameter will be set to point to the newly created evaluator, which can then
+ * be used for evaluating transactions' execution units, considering additional UTXOs and redeemers.
+ *
+ * \param[in] impl A `cardano_tx_evaluator_impl_t` implementation that defines the specific evaluation strategy and operations.
+ * \param[out] tx_evaluator A double pointer to the `cardano_tx_evaluator_t` instance, which will be allocated and set by this function.
+ *
+ * \return \ref CARDANO_SUCCESS if the evaluator was successfully created, or an appropriate error code if the operation failed.
+ *
+ * \note The caller is responsible for releasing the created `tx_evaluator` instance by using the appropriate unref function when done.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_evaluator_t* evaluator = NULL;
+ * cardano_tx_evaluator_impl_t impl = ...; // Assume this is set up with a valid implementation.
+ * cardano_error_t result = cardano_tx_evaluator_new(impl, &evaluator);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     // Evaluator successfully created, ready for use
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_tx_evaluator_new(cardano_tx_evaluator_impl_t impl, cardano_tx_evaluator_t** tx_evaluator);
+
+/**
+ * \brief Retrieves the name of the tx_evaluator implementation.
+ *
+ * This function returns a constant string representing the name of the tx_evaluator implementation.
+ * The name can be used for logging, debugging, or informational purposes to identify which
+ * tx_evaluator implementation is being used.
+ *
+ * \param[in] tx_evaluator Pointer to the \ref cardano_tx_evaluator_t object.
+ *
+ * \returns A constant character pointer to the tx_evaluator's name string.
+ *          The returned string is owned by the tx_evaluator and must not be modified or freed by the caller.
+ *          If the \p tx_evaluator is NULL or invalid, the function may return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const char* tx_evaluator_name = cardano_tx_evaluator_get_name(tx_evaluator);
+ *
+ * if (tx_evaluator_name)
+ * {
+ *   printf("Using tx_evaluator: %s\n", tx_evaluator_name);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve tx_evaluator name.\n");
+ * }
+ * \endcode
+ *
+ * \note The returned string remains valid as long as the \ref cardano_tx_evaluator_t object is valid.
+ *       Do not attempt to modify or free the returned string.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_tx_evaluator_get_name(const cardano_tx_evaluator_t* tx_evaluator);
+
+/**
+ * \brief Evaluates the execution units required for a transaction.
+ *
+ * This function calculates the execution units needed for a given transaction (`tx`) by using the provided `tx_evaluator`.
+ * Evaluation considers any additional UTXOs required for the transaction and assigns appropriate redeemers based on the evaluation.
+ *
+ * \param[in] tx_evaluator A pointer to the \ref cardano_tx_evaluator_t instance used to evaluate the transaction.
+ * \param[in] tx A pointer to the \ref cardano_transaction_t object representing the transaction to evaluate.
+ * \param[in] additional_utxos An optional list of additional UTXOs that may be needed for transaction evaluation.
+ * \param[out] redeemers A double pointer to a \ref cardano_redeemer_list_t, which will be populated with the evaluated redeemers
+ *                       that specify the execution units needed for the transaction.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction was successfully evaluated, or an appropriate error code indicating failure.
+ *
+ * \note The caller is responsible for managing and releasing memory for the redeemers list once it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_list_t* redeemers = NULL;
+ * cardano_error_t result = cardano_tx_evaluator_evaluate(tx_evaluator, tx, additional_utxos, &redeemers);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Redeemers were successfully evaluated and are now available in the redeemers list
+ * }
+ *
+ * // Clean up when done
+ * cardano_redeemer_list_unref(&redeemers);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_tx_evaluator_evaluate(
+  cardano_tx_evaluator_t*   tx_evaluator,
+  cardano_transaction_t*    tx,
+  cardano_utxo_list_t*      additional_utxos,
+  cardano_redeemer_list_t** redeemers);
+
+/**
+ * \brief Decrements the reference count of a cardano_tx_evaluator_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_tx_evaluator_t object
+ * by decreasing its reference count. When the reference count reaches zero, the tx_evaluator is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] tx_evaluator A pointer to the pointer of the tx_evaluator object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_evaluator_t* tx_evaluator = cardano_tx_evaluator_new(major, minor);
+ *
+ * // Perform operations with the tx_evaluator...
+ *
+ * cardano_tx_evaluator_unref(&tx_evaluator);
+ * // At this point, tx_evaluator is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_tx_evaluator_unref, the pointer to the \ref cardano_tx_evaluator_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_tx_evaluator_unref(cardano_tx_evaluator_t** tx_evaluator);
+
+/**
+ * \brief Increases the reference count of the cardano_tx_evaluator_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_tx_evaluator_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_tx_evaluator_unref.
+ *
+ * \param tx_evaluator A pointer to the cardano_tx_evaluator_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming tx_evaluator is a previously created tx_evaluator object
+ *
+ * cardano_tx_evaluator_ref(tx_evaluator);
+ *
+ * // Now tx_evaluator can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_tx_evaluator_ref there is a corresponding
+ * call to \ref cardano_tx_evaluator_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_tx_evaluator_ref(cardano_tx_evaluator_t* tx_evaluator);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_tx_evaluator_t object.
+ *
+ * This function returns the number of active references to an cardano_tx_evaluator_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_tx_evaluator_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param tx_evaluator A pointer to the cardano_tx_evaluator_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_tx_evaluator_t object. If the object
+ * is properly managed (i.e., every \ref cardano_tx_evaluator_ref call is matched with a
+ * \ref cardano_tx_evaluator_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming tx_evaluator is a previously created tx_evaluator object
+ *
+ * size_t ref_count = cardano_tx_evaluator_refcount(tx_evaluator);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_tx_evaluator_refcount(const cardano_tx_evaluator_t* tx_evaluator);
+
+/**
+ * \brief Sets the last error message for a given cardano_tx_evaluator_t object.
+ *
+ * Records an error message in the tx_evaluator's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] tx_evaluator A pointer to the \ref cardano_tx_evaluator_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the tx_evaluator's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_tx_evaluator_set_last_error(
+  cardano_tx_evaluator_t* tx_evaluator,
+  const char*             message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific tx_evaluator.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_tx_evaluator_set_last_error for the given
+ * tx_evaluator. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] tx_evaluator A pointer to the \ref cardano_tx_evaluator_t instance whose last error
+ *                   message is to be retrieved. If the tx_evaluator is NULL, the function
+ *                   returns a generic error message indicating the null tx_evaluator.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified tx_evaluator. If the tx_evaluator is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_tx_evaluator_set_last_error for the same tx_evaluator, or until
+ *       the tx_evaluator is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_tx_evaluator_get_last_error(const cardano_tx_evaluator_t* tx_evaluator);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TX_EVALUATOR_H
diff --git a/vendor/include/cardano/transaction_builder/evaluation/tx_evaluator_impl.h b/vendor/include/cardano/transaction_builder/evaluation/tx_evaluator_impl.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/evaluation/tx_evaluator_impl.h
@@ -0,0 +1,111 @@
+/**
+ * \file tx_evaluator_impl.h
+ *
+ * \author angel.castillo
+ * \date   Nov 05, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TX_EVALUATOR_IMPL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TX_EVALUATOR_IMPL_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/witness_set/redeemer_list.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* FORWARD DECLARATIONS *******************************************************/
+
+/**
+ * \brief Opaque structure for a transaction evaluator implementation.
+ *
+ * The `cardano_tx_evaluator_impl_t` structure represents an opaque implementation of
+ * a transaction evaluator within the Cardano framework. This implementation is intended
+ * to encapsulate the logic needed to evaluate transactions.
+ */
+typedef struct cardano_tx_evaluator_impl_t cardano_tx_evaluator_impl_t;
+
+/* CALLBACKS *****************************************************************/
+
+/**
+ * \brief Function pointer type for evaluating a transaction's execution units.
+ *
+ * Evaluates the execution units required by the transaction, considering any additional UTXOs and redeemers.
+ *
+ * \param[in] tx_evaluator_impl Pointer to the tx evaluator implementation instance.
+ * \param[in] tx               Transaction to evaluate.
+ * \param[in] additional_utxos Additional UTXOs required for evaluation (optional).
+ * \param[in] redeemers        Redeemers to be evaluated with the transaction.
+ * \return Error code indicating success or failure of the operation.
+ */
+typedef cardano_error_t (*cardano_tx_evaluate_func_t)(
+  cardano_tx_evaluator_impl_t* tx_evaluator_impl,
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         additional_utxos,
+  cardano_redeemer_list_t**    redeemers);
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Opaque structure for a transaction evaluator implementation.
+ *
+ * The `cardano_tx_evaluator_impl_t` structure is an internal, opaque structure
+ * used to encapsulate the implementation details of a transaction evaluator in the
+ * Cardano framework.
+ */
+typedef struct cardano_tx_evaluator_impl_t
+{
+    /**
+     * \brief Name of the tx evaluator implementation.
+     */
+    char name[256];
+
+    /**
+     * \brief Error message buffer for tx evaluator specific error messages.
+     */
+    char error_message[1024];
+
+    /**
+     * \brief Opaque pointer to the implementation-specific context.
+     *
+     * This pointer holds the state or context required by the tx evaluator implementation.
+     * Users should not access or modify this directly.
+     */
+    cardano_object_t* context;
+
+    /**
+     * \brief Function to evaluate a transaction.
+     *
+     * \see cardano_tx_evaluate_func_t
+     */
+    cardano_tx_evaluate_func_t evaluate;
+
+} cardano_tx_evaluator_impl_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TX_EVALUATOR_IMPL_H
diff --git a/vendor/include/cardano/transaction_builder/fee.h b/vendor/include/cardano/transaction_builder/fee.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/fee.h
@@ -0,0 +1,549 @@
+/**
+ * \file fee.h
+ *
+ * \author angel.castillo
+ * \date   Oct 13, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_FEE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_FEE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/protocol_params/protocol_parameters.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/witness_set/redeemer.h>
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Computes the minimum transaction fee.
+ *
+ * This function computes the minimum required transaction fee for the provided transaction, based on
+ * the resolved inputs and protocol parameters. The calculated fee considers factors such as the transaction
+ * size, execution units consumed by plutus scripts and size of included reference scripts.
+ *
+ * Reference scripts are always priced, whatever their language and whether or not the transaction has redeemers: the
+ * ledger charges for every reference script found on the outputs behind the reference inputs and the spend inputs of a
+ * transaction, even if the script never runs. \p resolved_ref_inputs must therefore resolve both kinds of inputs.
+ * They are priced with the reference script cost per byte, stride and multiplier of \p protocol_params, as
+ * \ref cardano_compute_script_ref_fee_with_params documents: a stride or a multiplier that is not set, as in the
+ * parameters of the eras before Dijkstra, takes its Conway value.
+ *
+ * A transaction that carries sub transactions pays the fee of the whole batch. The size of the sub transactions is part
+ * of the size of the transaction, and the execution units of the redeemers of every sub transaction are added to the ones
+ * of the transaction. The reference scripts of the sub transactions are included if the resolved UTXOs of their reference
+ * inputs and spend inputs are given in \p resolved_ref_inputs, as the ledger prices the reference scripts of the whole
+ * batch.
+ *
+ * The fee is the one the ledger requires: the size part is computed as \ref cardano_compute_min_fee_without_scripts
+ * documents, without the is valid flag, and the script part as \ref cardano_compute_min_script_fee documents, in exact
+ * arithmetic. The witness set is sized as it is, so to get the fee of the signed transaction, pass the transaction with
+ * its signatures.
+ *
+ * \param[in] transaction The pointer to the \ref cardano_transaction_t object representing the transaction.
+ * \param[in] resolved_ref_inputs A pointer to the \ref cardano_utxo_list_t containing every resolved UTXO whose reference script is priced: the ones behind
+ *                                the reference inputs and the spend inputs of the transaction and of its sub transactions. Every entry is priced, so a UTXO
+ *                                that a body both references and spends must be listed once, and a UTXO used by several bodies once per body.
+ * \param[in] protocol_params The pointer to the \ref cardano_protocol_parameters_t structure that contains protocol-related parameters for fee calculation.
+ * \param[out] fee A pointer to a uint64_t that will hold the computed transaction fee upon success.
+ *
+ * \return \ref CARDANO_SUCCESS if the fee was successfully computed, \ref CARDANO_ERROR_INVALID_ARGUMENT if the transaction
+ *         has execution units to price and the price of the memory units or of the CPU steps has a zero denominator,
+ *         \ref CARDANO_ERROR_INTEGER_OVERFLOW if the fee does not fit in 64 bits, or an appropriate error code indicating
+ *         failure.
+ *
+ * \note The transaction size and the execution unit requirements for Plutus scripts influence the final fee.
+ *       Ensure that the resolved UTXOs match the reference inputs and the spend inputs specified in the transaction to compute accurate fees.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* tx = ...;
+ * cardano_utxo_list_t* resolved_ref_inputs = ...;
+ * cardano_protocol_parameters_t* protocol_params = ...;
+ * uint64_t computed_fee = 0;
+ *
+ * cardano_error_t result = cardano_compute_transaction_fee(
+ *   tx,
+ *   resolved_ref_inputs,
+ *   protocol_params,
+ *   &computed_fee);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully computed the fee
+ *   // computed_fee contains the result
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_compute_transaction_fee(
+  cardano_transaction_t*         transaction,
+  cardano_utxo_list_t*           resolved_ref_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  uint64_t*                      fee);
+
+/**
+ * \brief Computes the minimum ADA required for a transaction output.
+ *
+ * This function calculates the minimum amount of ADA (in lovelace) that must be present in a UTXO, based on its size
+ * and the `coins_per_utxo_byte` parameter from the protocol. The size of the UTXO is determined by the provided
+ * transaction output object, and the protocol parameter `coins_per_utxo_byte` specifies the cost per byte for UTXOs.
+ *
+ * \param[in] output The pointer to the \ref cardano_transaction_output_t object representing the transaction output for which the minimum ADA is being calculated.
+ * \param[in] coins_per_utxo_byte The protocol parameter specifying the cost in lovelace per byte of the UTXO.
+ * \param[out] lovelace_required A pointer to a uint64_t that will hold the calculated minimum amount of ADA (in lovelace) required for the UTXO.
+ *
+ * \return \ref CARDANO_SUCCESS if the minimum ADA was successfully computed, or an appropriate error code indicating failure.
+ *
+ * \note The minimum ADA ensures that the UTXO is valid and meets protocol requirements. It accounts for factors such as
+ *       the size of the UTXO, including assets, scripts, and other elements within the output.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* output = ...;
+ * uint64_t coins_per_utxo_byte = 4310;  // Example value from protocol parameters
+ * uint64_t min_ada = 0;
+ *
+ * cardano_error_t result = cardano_compute_min_ada_required(output, coins_per_utxo_byte, &min_ada);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully computed the minimum ADA required for the UTXO
+ *   // min_ada now holds the result
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_compute_min_ada_required(
+  cardano_transaction_output_t* output,
+  uint64_t                      coins_per_utxo_byte,
+  uint64_t*                     lovelace_required);
+
+/**
+ * \brief Computes the script part of the minimum fee of a transaction: execution units and reference scripts.
+ *
+ * This function calculates the script part of the minimum fee of a transaction. The fee is based on:
+ * - The execution units required by the scripts.
+ * - The prices of execution units.
+ * - The size of the reference scripts and the cost per reference script byte.
+ *
+ * The execution units are the total of the whole batch: the redeemers of the witness set of the transaction plus the
+ * redeemers of the witness set of every sub transaction it carries, since the transaction that carries the sub
+ * transactions pays for their script execution. A transaction without sub transactions only accounts for its own redeemers.
+ *
+ * Reference scripts are always priced, whatever their language: when the batch has no redeemers the execution unit part of
+ * the fee is zero and the computed fee is the reference script fee alone. The reference scripts of the sub transactions
+ * resolved in \p resolved_reference_inputs are included, as the ledger prices the reference scripts of the whole batch.
+ *
+ * The execution units are priced as the ledger prices them: the fee is the ceiling of the exact price of the memory
+ * units plus the exact price of the CPU steps, computed from the numerators and the denominators of the prices in
+ * integer arithmetic, so a fee whose exact value is an integer is never rounded up. A transaction without memory units
+ * and CPU steps pays no execution units fee, whatever the prices are.
+ *
+ * The reference scripts are priced as \ref cardano_compute_script_ref_fee prices them, with the Conway values of the
+ * reference script cost stride and multiplier. \ref cardano_compute_transaction_fee prices them with the stride and the
+ * multiplier of its protocol parameters instead.
+ *
+ * \param[in] tx The pointer to the \ref cardano_transaction_t object representing the transaction for which the script fee is being calculated.
+ * \param[in] prices The pointer to the \ref cardano_ex_unit_prices_t object containing the prices for execution units (memory and steps).
+ * \param[in] resolved_reference_inputs A pointer to the \ref cardano_utxo_list_t object holding every resolved UTXO whose reference script is priced: the ones
+ *                                      behind the reference inputs and the spend inputs of the transaction and of its sub transactions. Every entry
+ *                                      is priced, so a UTXO that a body both references and spends must be listed once, and a UTXO used by several
+ *                                      bodies once per body.
+ * \param[in] coins_per_ref_script_byte The pointer to the \ref cardano_unit_interval_t object representing the cost per byte of reference scripts.
+ * \param[out] min_fee A pointer to a uint64_t where the calculated minimum fee for the transaction will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the minimum script fee was successfully computed, \ref CARDANO_ERROR_INVALID_ARGUMENT if the
+ *         transaction has execution units to price and the price of the memory units or of the CPU steps has a zero
+ *         denominator, \ref CARDANO_ERROR_INTEGER_OVERFLOW if the fee does not fit in 64 bits, or an appropriate error code
+ *         indicating failure.
+ *
+ * \note The calculated fee accounts for the execution requirements of all the Plutus scripts included and for the size of every reference script listed in
+ *       \p resolved_reference_inputs, measured as \ref cardano_get_serialized_script_size documents.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* tx = ...;  // The transaction object
+ * cardano_ex_unit_prices_t* prices = ...;  // Prices for execution units
+ * cardano_utxo_list_t* resolved_reference_inputs = ...;  // List of resolved UTXOs
+ * cardano_unit_interval_t* coins_per_ref_script_byte = ...;  // Cost per byte for reference scripts
+ * uint64_t min_fee = 0;
+ *
+ * cardano_error_t result = cardano_compute_min_script_fee(tx, prices, resolved_reference_inputs, coins_per_ref_script_byte, &min_fee);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully computed the minimum fee for the transaction
+ *   // min_fee now holds the calculated value
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_compute_min_script_fee(
+  cardano_transaction_t*    tx,
+  cardano_ex_unit_prices_t* prices,
+  cardano_utxo_list_t*      resolved_reference_inputs,
+  cardano_unit_interval_t*  coins_per_ref_script_byte,
+  uint64_t*                 min_fee);
+
+/**
+ * \brief Computes the minimum fee required for a transaction without considering script costs.
+ *
+ * This function calculates the minimum transaction fee based on the serialized size of the transaction
+ * and the protocol parameters for fee calculation. The fee is computed as:
+ *
+ * \f$ \text{min_fee} = \text{min_fee_constant} + (\text{min_fee_coefficient} \times \text{tx_size}) \f$
+ *
+ * where `tx_size` is the size of the transaction in bytes, measured as the ledger measures it for the fee: the size of
+ * a three element array of the body, the witness set and the auxiliary data (or null when the transaction has none).
+ * The is valid flag that the four element frame carries is not part of that size, so for such a transaction the size
+ * is one byte lower than the one \ref cardano_get_serialized_transaction_size returns.
+ *
+ * \param[in] tx A pointer to the \ref cardano_transaction_t object representing the transaction.
+ * \param[in] min_fee_constant The constant fee factor (A) from the protocol parameters.
+ * \param[in] min_fee_coefficient The fee-per-byte coefficient (B) from the protocol parameters.
+ * \param[out] min_fee A pointer to a uint64_t where the computed minimum fee will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the minimum fee was successfully computed, \ref CARDANO_ERROR_INTEGER_OVERFLOW if the fee
+ *         does not fit in 64 bits, or an appropriate error code indicating failure.
+ *
+ * \note This function only computes the base fee without considering any costs related to scripts or smart contract execution.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* tx = ...;  // The transaction to calculate the fee for
+ * uint64_t min_fee_constant = 155381;  // Example value from protocol parameters
+ * uint64_t min_fee_coefficient = 44;   // Example value from protocol parameters
+ * uint64_t min_fee = 0;
+ *
+ * cardano_error_t result = cardano_compute_min_fee_without_scripts(tx, min_fee_constant, min_fee_coefficient, &min_fee);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully computed the minimum fee
+ *   // min_fee now holds the calculated fee
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_compute_min_fee_without_scripts(
+  cardano_transaction_t* tx,
+  uint64_t               min_fee_constant,
+  uint64_t               min_fee_coefficient,
+  uint64_t*              min_fee);
+
+/**
+ * \brief Computes the script reference fee for transaction inputs.
+ *
+ * This function calculates the fee component that is contributed by reference scripts on the inputs of a transaction.
+ * The fee is computed based on the size of the reference scripts and the protocol parameter `coins_per_ref_script_byte`.
+ * The total size is priced in tiers of 25600 bytes, the last one possibly partial, and every tier costs 1.2 times as much
+ * per byte as the previous one. As the ledger does, the prices are exact fractions: the price of every tier is added
+ * exactly and the fee is the floor of the total, taken once, so no tier is rounded on its own. The tier size and the
+ * multiplier are the Conway values of the reference script cost stride and multiplier protocol parameters. To price
+ * with the stride and the multiplier of a parameter set, as the Dijkstra ledger does, use
+ * \ref cardano_compute_script_ref_fee_with_params.
+ *
+ * The fee is exact when the denominator of the price in lowest terms times 5 to the power of the number of tiers minus
+ * one fits in 64 bits, and the integer parts of the prices of the tiers and the fee fit too. A price with a very large
+ * denominator, such as one built with \ref cardano_unit_interval_from_double, or a very large price can break that
+ * condition; the fee is then a conservative upper bound of the exact fee, which never falls below it and, for prices up
+ * to about 50 lovelace per byte, is within a lovelace of it.
+ *
+ * The ledger charges for every reference script found on the outputs behind the reference inputs and the spend inputs of a
+ * transaction, whatever the language of the script (native scripts included) and whether or not the script runs. The size
+ * of each script is the one reported by \ref cardano_get_serialized_script_size, which is the size the ledger prices.
+ *
+ * The total size is not distinct: every entry of the list is counted, so a reference script that appears in several entries
+ * is priced once per entry. The ledger takes the inputs of a body as a set, so a UTXO that a body both references and
+ * spends must be listed once. Counting every entry matches how the ledger measures the reference script size of a batch, where
+ * a UTXO referenced by the transaction and by one of its sub transactions counts twice. The ledger prices the total of the
+ * whole batch with a single application of the tiered model, so the UTXOs of the sub transactions must be in the same list.
+ *
+ * \param[in] resolved_reference_inputs A pointer to the \ref cardano_utxo_list_t object holding every resolved UTXO whose reference script is priced: the
+ *                            ones behind the reference inputs and the spend inputs of the transaction. Entries without a reference script add nothing.
+ * \param[in] coins_per_ref_script_byte The fee cost per byte of reference script data, as defined by the protocol parameters.
+ * \param[out] script_ref_fee A pointer to a uint64_t where the computed reference script fee will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the reference script fee was successfully computed, \ref CARDANO_ERROR_INVALID_ARGUMENT if there
+ *         are reference scripts to price and \p coins_per_ref_script_byte has a zero denominator, \ref CARDANO_ERROR_INTEGER_OVERFLOW
+ *         if the fee, or the upper bound computed in its place, does not fit in 64 bits, or another appropriate error code
+ *         indicating failure. On failure \p script_ref_fee is set to zero.
+ *
+ * \note This function helps determine the additional cost of including reference scripts in a transaction's inputs based on the
+ *       protocol's fee model.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* resolved_ref_inputs = ...;  // Resolved UTXO inputs, potentially containing reference scripts
+ * cardano_unit_interval_t* coins_per_ref_script_byte = ...;  // Protocol parameter for fee per byte of reference script
+ * uint64_t script_ref_fee = 0;
+ *
+ * cardano_error_t result = cardano_compute_script_ref_fee(resolved_ref_inputs, coins_per_ref_script_byte, &script_ref_fee);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully computed the script reference fee
+ *   // script_ref_fee now holds the calculated fee value
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_compute_script_ref_fee(
+  cardano_utxo_list_t*     resolved_reference_inputs,
+  cardano_unit_interval_t* coins_per_ref_script_byte,
+  uint64_t*                script_ref_fee);
+
+/**
+ * \brief Computes the script reference fee for transaction inputs with the reference script pricing of a set of
+ * protocol parameters.
+ *
+ * This function prices the reference scripts of \p resolved_reference_inputs as \ref cardano_compute_script_ref_fee
+ * does, with the tiered model of the ledger, but takes the price of a byte, the size of a tier and the multiplier from
+ * \p protocol_params: the reference script cost per byte, the reference script cost stride and the reference script
+ * cost multiplier. The ledger of Dijkstra reads the stride and the multiplier from its protocol parameters, while the
+ * earlier eras use the fixed values of 25600 bytes and 6/5, which is what \ref cardano_compute_script_ref_fee uses.
+ *
+ * A stride of 0 or a multiplier that is not set means the parameter set does not carry it, as the parameters of the eras
+ * before Dijkstra do not, and the Conway value is used in its place. When neither is set, the fee is the one
+ * \ref cardano_compute_script_ref_fee computes. The multiplier is priced as the exact fraction it holds: the ledger
+ * requires it to be positive, and a multiplier below 1 lowers the price of every further tier. A multiplier with a zero
+ * numerator, which the ledger never produces, is not rejected and makes every tier after the first free.
+ *
+ * The fee is exact when the denominator of the price in lowest terms times the denominator of the multiplier in lowest
+ * terms to the power of the number of tiers minus one fits in 64 bits, and the integer parts of the prices of the tiers
+ * and the fee fit too. A price or a multiplier with a large denominator, such as one built with
+ * \ref cardano_unit_interval_from_double, many tiers or a very large price can break that condition; the fee is then a
+ * conservative upper bound of the exact fee, which never falls below it. The excess is a tiny fraction of the fee,
+ * usually a few lovelace at most, when the denominators are small, and grows with them, up to about a thousandth of
+ * the fee for a multiplier denominator around 10^15, as \ref cardano_unit_interval_from_double produces. With
+ * denominators close to 2^64 the bound can be several times the exact fee.
+ *
+ * Every entry of the list is counted, as \ref cardano_compute_script_ref_fee documents, and the size of each script is
+ * the one reported by \ref cardano_get_serialized_script_size.
+ *
+ * \param[in] resolved_reference_inputs A pointer to the \ref cardano_utxo_list_t object holding every resolved UTXO whose reference script is priced: the
+ *                            ones behind the reference inputs and the spend inputs of the transaction. Entries without a reference script add nothing.
+ * \param[in] protocol_params The pointer to the \ref cardano_protocol_parameters_t object that holds the reference script cost per byte, stride and multiplier.
+ * \param[out] script_ref_fee A pointer to a uint64_t where the computed reference script fee will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the reference script fee was successfully computed, \ref CARDANO_ERROR_POINTER_IS_NULL if an
+ *         argument is NULL or \p protocol_params has no reference script cost per byte, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         there are reference scripts to price and the cost per byte or the multiplier has a zero denominator,
+ *         \ref CARDANO_ERROR_INTEGER_OVERFLOW if the fee, or the upper bound computed in its place, does not fit in 64 bits, or
+ *         another appropriate error code indicating failure. On failure after the arguments are checked, \p script_ref_fee is
+ *         set to zero.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_utxo_list_t* resolved_ref_inputs = ...;  // Resolved UTXO inputs, potentially containing reference scripts
+ * cardano_protocol_parameters_t* protocol_params = ...;  // Protocol parameters of the current era
+ * uint64_t script_ref_fee = 0;
+ *
+ * cardano_error_t result = cardano_compute_script_ref_fee_with_params(resolved_ref_inputs, protocol_params, &script_ref_fee);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully computed the script reference fee
+ *   // script_ref_fee now holds the calculated fee value
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_compute_script_ref_fee_with_params(
+  cardano_utxo_list_t*           resolved_reference_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  uint64_t*                      script_ref_fee);
+
+/**
+ * \brief Computes the total execution units (exUnits) from a list of redeemers.
+ *
+ * This function aggregates the total execution units consumed by all redeemers in the provided \ref cardano_redeemer_list_t.
+ * Execution units are a critical metric used in Plutus script evaluation, where both memory and CPU units are factored.
+ *
+ * \param[in] redeemers A pointer to the \ref cardano_redeemer_list_t object representing the list of redeemers.
+ * \param[out] total A pointer to a \ref cardano_ex_units_t object where the total execution units will be stored.
+ *                   This will contain the sum of the memory and CPU units from all redeemers.
+ *
+ * \return \ref CARDANO_SUCCESS if the total execution units were successfully computed, or an appropriate error code
+ *         indicating failure.
+ *
+ * \note The `total` object must be managed by the caller. After use, it should be properly de-referenced
+ *       with \ref cardano_ex_units_unref to avoid memory leaks.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_list_t* redeemers = ...;  // Redeemer list for the transaction
+ * cardano_ex_units_t* total_ex_units = NULL;
+ *
+ * cardano_error_t result = cardano_get_total_ex_units_in_redeemers(redeemers, &total_ex_units);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Successfully computed the total execution units for the redeemers
+ *   // total_ex_units now holds the summed execution units
+ * }
+ *
+ * // Clean up after use
+ * cardano_ex_units_unref(total_ex_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_get_total_ex_units_in_redeemers(cardano_redeemer_list_t* redeemers, cardano_ex_units_t** total);
+
+/**
+ * \brief Computes the serialized size of a given amount of lovelace.
+ *
+ * This function calculates the size in bytes required to serialize a given amount of lovelace.
+ *
+ * \param[in] lovelace The amount of lovelace to calculate the serialized size for.
+ * \param[out] size_in_bytes A pointer to a \c size_t where the size of the serialized lovelace in bytes will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the size was successfully computed, or an appropriate error code indicating failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * uint64_t lovelace = 1000000;  // Example amount of 1 ADA
+ * size_t size_in_bytes = 0;
+ *
+ * cardano_error_t result = cardano_get_serialized_coin_size(lovelace, &size_in_bytes);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The size_in_bytes now holds the serialized size of the lovelace amount
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_get_serialized_coin_size(uint64_t lovelace, size_t* size_in_bytes);
+
+/**
+ * \brief Computes the serialized size of a given transaction output.
+ *
+ * This function calculates the size in bytes required to serialize a given transaction output.
+ *
+ * \param[in] output A pointer to the \ref cardano_transaction_output_t object for which the serialized size is to be calculated.
+ * \param[out] size_in_bytes A pointer to a \c size_t where the size of the serialized output in bytes will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the size was successfully computed, or an appropriate error code indicating failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_output_t* output = { ... };  // Assume this is initialized
+ * size_t size_in_bytes = 0;
+ *
+ * cardano_error_t result = cardano_get_serialized_output_size(output, &size_in_bytes);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The size_in_bytes now holds the serialized size of the output
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_get_serialized_output_size(cardano_transaction_output_t* output, size_t* size_in_bytes);
+
+/**
+ * \brief Computes the serialized size of a given script, the size the ledger prices for a reference script.
+ *
+ * This function calculates the size in bytes of the serialized script alone, without the two element array that holds the
+ * language tag followed by the script in a script reference: for a Plutus script, the bytes of the script, the ones its
+ * byte string holds, without the header of the byte string; for a native script, the bytes of its CBOR. A native script
+ * decoded from CBOR is measured with the bytes it was decoded from, so a script stored on chain with a longer, non minimal
+ * encoding (for example a slot written as an 8 byte integer) is measured with those bytes, as the ledger measures it.
+ *
+ * This is the size the ledger prices for a reference script, and the one \ref cardano_compute_script_ref_fee prices. The
+ * encoding of the script with its language tag, as a script reference carries it, is the one \ref cardano_script_to_cbor
+ * writes, which is 2 bytes larger for a native script and 3 to 7 bytes larger for a Plutus script.
+ *
+ * \param[in] script A pointer to the \ref cardano_script_t object for which the serialized size is to be calculated.
+ * \param[out] size_in_bytes A pointer to a \c size_t where the size of the serialized script in bytes will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the size was successfully computed, or an appropriate error code indicating failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_script_t* script = { ... };  // Assume this is initialized
+ * size_t size_in_bytes = 0;
+ *
+ * cardano_error_t result = cardano_get_serialized_script_size(script, &size_in_bytes);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The size_in_bytes now holds the serialized size of the script
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_get_serialized_script_size(cardano_script_t* script, size_t* size_in_bytes);
+
+/**
+ * \brief Computes the serialized size of a given transaction.
+ *
+ * This function calculates the size in bytes required to serialize a given transaction, with the is valid flag when
+ * the transaction is serialized in the four element frame. The ledger measures the size of a transaction for its fee
+ * without that flag, as \ref cardano_compute_min_fee_without_scripts does.
+ *
+ * \param[in] transaction A pointer to the \ref cardano_transaction_t object for which the serialized size is to be calculated.
+ * \param[out] size_in_bytes A pointer to a \c size_t where the size of the serialized transaction in bytes will be stored.
+ *
+ * \return \ref CARDANO_SUCCESS if the size was successfully computed, or an appropriate error code indicating failure.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = { ... };  // Assume this is initialized
+ * size_t size_in_bytes = 0;
+ *
+ * cardano_error_t result = cardano_get_serialized_transaction_size(transaction, &size_in_bytes);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The size_in_bytes now holds the serialized size of the transaction
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_get_serialized_transaction_size(cardano_transaction_t* transaction, size_t* size_in_bytes);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_FEE_H
diff --git a/vendor/include/cardano/transaction_builder/script_data_hash.h b/vendor/include/cardano/transaction_builder/script_data_hash.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/script_data_hash.h
@@ -0,0 +1,102 @@
+/**
+ * \file script_data_hash.h
+ *
+ * \author angel.castillo
+ * \date   Nov 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_DATA_HASH_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_DATA_HASH_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/protocol_params/costmdls.h>
+#include <cardano/witness_set/plutus_data_set.h>
+#include <cardano/witness_set/redeemer_list.h>
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Computes the hash of script data in a transaction, including redeemers, datums, and cost models.
+ *
+ * This function processes arrays of redeemers and datums, along with specified cost models, to compute a
+ * 32-byte hash that represents the script data for a transaction. The data is encoded in CBOR
+ * (Concise Binary Object Representation) format and hashed using the Blake2b hashing algorithm.
+ *
+ * When the transaction carries datums but no redeemers, the hash is computed from an empty redeemers map,
+ * the datums and an empty language views map. No Plutus script is executed in that case, so the cost models
+ * are not used and may be empty.
+ *
+ * When there are redeemers, the hash is computed from the redeemers, the datums (if any) and the language views
+ * encoded from the given cost models. If the cost models are empty, the language views are an empty map.
+ *
+ * When there are neither redeemers nor datums, no hash is computed and `data_hash` is set to NULL.
+ *
+ * \param[in] costmdls A pointer to \ref cardano_costmdls_t representing the cost models for script execution.
+ *                     It must not be NULL, but it may be empty.
+ * \param[in] redeemers A pointer to \ref cardano_redeemer_list_t containing the transaction's redeemers.
+ *                      This parameter can be NULL or empty.
+ * \param[in] datums A pointer to \ref cardano_plutus_data_set_t representing the datums included in the transaction.
+ *                   This parameter can be NULL or empty.
+ * \param[out] data_hash On successful computation, this will point to a \ref cardano_blake2b_hash_t containing
+ *                       the computed 32-byte hash for the script data, or NULL when no hash is computed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         script data hash was successfully computed or no hash was needed, or an appropriate error code if a
+ *         failure occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_costmdls_t* costmdls = ...;      // Initialized cost models
+ * cardano_redeemer_list_t* redeemers = ...; // List of redeemers
+ * cardano_plutus_data_set_t* datums = ...;  // Set of datums
+ * cardano_blake2b_hash_t* data_hash = NULL;
+ *
+ * cardano_error_t result = cardano_compute_script_data_hash(costmdls, redeemers, datums, &data_hash);
+ *
+ * if (result == CARDANO_SUCCESS && data_hash != NULL)
+ * {
+ *   // Successfully computed the hash of the script data
+ * }
+ * else
+ * {
+ *   printf("Failed to compute the script data hash.\n");
+ * }
+ *
+ * cardano_blake2b_hash_unref(&data_hash);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_compute_script_data_hash(
+  cardano_costmdls_t*        costmdls,
+  cardano_redeemer_list_t*   redeemers,
+  cardano_plutus_data_set_t* datums,
+  cardano_blake2b_hash_t**   data_hash);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SCRIPT_DATA_HASH_H
diff --git a/vendor/include/cardano/transaction_builder/sub_transaction_builder.h b/vendor/include/cardano/transaction_builder/sub_transaction_builder.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/sub_transaction_builder.h
@@ -0,0 +1,2855 @@
+/**
+ * \file sub_transaction_builder.h
+ *
+ * \author angel.castillo
+ * \date   Sep 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_BUILDER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_BUILDER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/address/reward_address.h>
+#include <cardano/assets/asset_id.h>
+#include <cardano/assets/asset_name.h>
+#include <cardano/auxiliary_data/metadatum.h>
+#include <cardano/certs/certificate.h>
+#include <cardano/common/anchor.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/drep.h>
+#include <cardano/common/governance_action_id.h>
+#include <cardano/common/network_id.h>
+#include <cardano/common/protocol_version.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/common/utxo.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/proposal_procedures/committee_members_map.h>
+#include <cardano/proposal_procedures/constitution.h>
+#include <cardano/proposal_procedures/credential_set.h>
+#include <cardano/proposal_procedures/proposal_procedure.h>
+#include <cardano/protocol_params/protocol_param_update.h>
+#include <cardano/protocol_params/protocol_parameters.h>
+#include <cardano/scripts/script.h>
+#include <cardano/slot_config.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction_body/account_balance_interval.h>
+#include <cardano/transaction_body/transaction_output.h>
+#include <cardano/transaction_body/value.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+#include <cardano/typedefs.h>
+#include <cardano/voting_procedures/voter.h>
+#include <cardano/voting_procedures/voting_procedure.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief High-Level Sub Transaction Builder for Cardano Blockchain.
+ *
+ * The `cardano_sub_tx_builder_t` type is the interface a party of a CIP-118 batch uses to construct its
+ * sub transaction programmatically. A sub transaction is an intent: independent parties each build and sign
+ * one, and a batcher aggregates the finished sub transactions into a top level transaction that pays the fee
+ * and posts the collateral for the whole batch. The ledger checks value conservation over the whole batch, not
+ * over each sub transaction.
+ *
+ * **Key Features:**
+ * - **Modular Design**: Incrementally add inputs, outputs, minting operations, metadata, native and PlutusV4 scripts,
+ *   guards, direct deposits, account balance intervals, withdrawals, certificates, votes and governance
+ *   proposals.
+ * - **Never Balances**: The builder does not select inputs, does not add change outputs and does not compute
+ *   fees. The sub transaction carries exactly the inputs and outputs that were added, and its imbalance (see
+ *   \ref cardano_compute_sub_transaction_imbalance) is the intent the batcher matches against the rest of
+ *   the batch.
+ * - **Sub Transaction Fields Only**: Fees, collateral and starting account balance intervals only exist on a
+ *   top level transaction, so this builder has no functions for them.
+ * - **Native Scripts, PlutusV4 Scripts and Key Witnesses**: PlutusV1, PlutusV2 and PlutusV3 scripts can not run inside a
+ *   sub transaction and are rejected. PlutusV4 scripts are accepted: an input locked by a PlutusV4 script can be spent, a
+ *   PlutusV4 policy can mint, a PlutusV4 script account can withdraw, a PlutusV4 script credential can publish
+ *   certificates or vote, a PlutusV4 guardrails script can validate parameter change and treasury withdrawals proposals,
+ *   and a script hash guard can be satisfied, each with a redeemer. The builder computes the execution units of those
+ *   redeemers with the native evaluator when the sub transaction is built, before the parties sign it. A redeemer can
+ *   also be produced by a callback when the sub transaction is built, so that it can carry indices that are local to the
+ *   body of the sub transaction.
+ */
+typedef struct cardano_sub_tx_builder_t cardano_sub_tx_builder_t;
+
+/**
+ * \brief Creates a new sub transaction builder instance.
+ *
+ * This function initializes a new sub transaction builder (`cardano_sub_tx_builder_t`)
+ * using the supplied protocol parameters and slot configuration. The builder
+ * enables incremental construction of a CIP-118 sub transaction.
+ *
+ * The slot configuration provides time/slot conversion rules needed for
+ * unix time to slot conversions.
+ *
+ * \param[in] params
+ *   A pointer to a \ref cardano_protocol_parameters_t structure containing the
+ *   protocol parameters used to configure the sub transaction builder.
+ *   Must not be `NULL`.
+ *
+ * \param[in] slot_config
+ *   A pointer to the \ref cardano_slot_config_t structure that defines the
+ *   slot/time translation rules for the current network. Must not be `NULL`. Constants for every public network can be found at `cardano/slot_config.h`:
+ *   \ref CARDANO_MAINNET_SLOT_CONFIG
+ *   \ref CARDANO_PREVIEW_SLOT_CONFIG
+ *   \ref CARDANO_PREPROD_SLOT_CONFIG
+ *
+ * \returns
+ *   A pointer to a newly created \ref cardano_sub_tx_builder_t instance configured
+ *   with the given protocol parameters and slot configuration, or `NULL` if
+ *   memory allocation fails or if any argument is invalid.
+ *
+ * \par Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...;            // Initialized protocol parameters
+ * cardano_slot_config_t slot_config = CARDANO_PREVIEW_SLOT_CONFIG; // Constants for slot config for every public network can be found at cardano/slot_config.h
+ *
+ * cardano_sub_tx_builder_t* sub_tx_builder =
+ *     cardano_sub_tx_builder_new(protocol_params, &slot_config);
+ *
+ * if (sub_tx_builder != NULL)
+ * {
+ *   // Proceed with constructing the sub transaction
+ * }
+ *
+ * cardano_sub_tx_builder_unref(&sub_tx_builder);
+ * \endcode
+ *
+ * \note
+ * The caller is responsible for releasing the `cardano_sub_tx_builder_t` instance
+ * using \ref cardano_sub_tx_builder_unref once it is no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_sub_tx_builder_t* cardano_sub_tx_builder_new(
+  cardano_protocol_parameters_t* params,
+  const cardano_slot_config_t*   slot_config);
+
+/**
+ * \brief Sets the network ID for the sub transaction builder.
+ *
+ * This function configures the sub transaction builder (`cardano_sub_tx_builder_t`) with a specific network ID.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance for which the network ID is being set.
+ * \param[in] network_id The network ID to assign to the sub transaction. This ID specifies the target network
+ *                       (e.g., mainnet, testnet) for which the sub transaction is intended.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_network_id_t network_id = CARDANO_NETWORK_ID_MAIN_NET;  // Set the network ID to mainnet
+ * cardano_sub_tx_builder_set_network_id(sub_tx_builder, network_id);
+ * \endcode
+ *
+ * \note This function only sets the network ID within the builder and does not perform any validation until
+ *       \ref cardano_sub_tx_builder_build is called, which will report any related errors at that time.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_set_network_id(cardano_sub_tx_builder_t* builder, cardano_network_id_t network_id);
+
+/**
+ * \brief Sets the donation amount for the sub transaction builder.
+ *
+ * This function sets the donation amount. A donation contributes a specific amount to the treasury and is
+ * value produced by the sub transaction.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance where the donation will be set.
+ * \param[in] donation The donation amount, specified in lovelace.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...; // Initialized sub transaction builder
+ * uint64_t donation = 1000000;                   // 1 ADA donation in lovelace
+ *
+ * cardano_sub_tx_builder_set_donation(sub_tx_builder, donation);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_set_donation(cardano_sub_tx_builder_t* builder, uint64_t donation);
+
+/**
+ * \brief Sets the expiration slot for a sub transaction, beyond which it is no longer valid.
+ *
+ * This function specifies the slot number after which the sub transaction will be considered invalid. Setting this
+ * value lets an intent expire if no batcher includes it in a block before the specified slot.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance being configured.
+ * \param[in] slot The slot number after which the sub transaction will be marked as invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * uint64_t expiration_slot = 5000000;  // Slot after which the sub transaction becomes invalid
+ * cardano_sub_tx_builder_set_invalid_after(sub_tx_builder, expiration_slot);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_set_invalid_after(cardano_sub_tx_builder_t* builder, uint64_t slot);
+
+/**
+ * \brief Sets the expiration time for a sub transaction based on Unix time (in seconds).
+ *
+ * This function configures the validity of the sub transaction based on a specified Unix timestamp, marking it
+ * as invalid if it is not included in a block before this time. The Unix timestamp is expressed in seconds since
+ * the epoch (January 1, 1970, UTC). This setting is useful for intents that need to expire at a specific
+ * real-world time.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance being configured.
+ * \param[in] unix_time The Unix timestamp (in seconds) at which the sub transaction expires.
+ *
+ * Usage Example:
+ * \code{.c}
+ * #include <time.h>
+ *
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;   // Initialized sub transaction builder
+ * time_t current_time = time(NULL);                 // Get current Unix time in seconds
+ * uint64_t expiration_time = current_time + 2 * 60 * 60;  // Set expiration to 2 hours from now
+ *
+ * cardano_sub_tx_builder_set_invalid_after_ex(sub_tx_builder, expiration_time);
+ * \endcode
+ *
+ * \note If any errors occur while setting the expiration, they will not be immediately reported. Instead, they will
+ *       be deferred and can be checked when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_set_invalid_after_ex(cardano_sub_tx_builder_t* builder, uint64_t unix_time);
+
+/**
+ * \brief Sets the minimum valid slot for a sub transaction.
+ *
+ * This function configures the earliest slot at which the sub transaction will be considered valid. Sub transactions
+ * created with this setting will not be valid for inclusion in a block until the specified slot.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance being configured.
+ * \param[in] slot The minimum slot number at which the sub transaction is valid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;   // Initialized sub transaction builder
+ * uint64_t min_valid_slot = 123456;                 // Example slot number
+ * cardano_sub_tx_builder_set_invalid_before(sub_tx_builder, min_valid_slot);
+ * \endcode
+ *
+ * \note Any errors arising from setting this parameter will be reported when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_set_invalid_before(cardano_sub_tx_builder_t* builder, uint64_t slot);
+
+/**
+ * \brief Sets the minimum valid time (Unix timestamp) for a sub transaction.
+ *
+ * This function configures the earliest time, in Unix timestamp format (seconds since Epoch),
+ * at which the sub transaction will be considered valid. Sub transactions created with this setting will
+ * not be valid for inclusion in a block until the specified timestamp.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance being configured.
+ * \param[in] unix_time The minimum Unix timestamp (in seconds) at which the sub transaction is valid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;   // Initialized sub transaction builder
+ * uint64_t min_valid_time = 7200 + time(NULL);      // Set to 2 hours from now
+ * cardano_sub_tx_builder_set_invalid_before_ex(sub_tx_builder, min_valid_time);
+ * \endcode
+ *
+ * \note Any errors resulting from setting this parameter will be reported when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_set_invalid_before_ex(cardano_sub_tx_builder_t* builder, uint64_t unix_time);
+
+/**
+ * \brief Adds an input to the sub transaction.
+ *
+ * This function appends a specified UTXO as an input to the sub transaction being built. The builder never selects
+ * inputs by itself, so the sub transaction spends exactly the UTXOs added through this function. An input locked by
+ * a key or by a native script is spent without a redeemer. An input locked by a PlutusV4 script is spent with a
+ * redeemer, and optionally with its datum when the UTXO only carries the datum hash. Provide the script with
+ * `cardano_sub_tx_builder_add_script` or through a reference input.
+ *
+ * The redeemer points to the position of the input in the inputs of the sub transaction, which are sorted, so its
+ * index is set when the sub transaction is built. The builder then evaluates the script with the native evaluator and
+ * writes the execution units into the redeemer. An input set cannot hold the same input twice, so a UTXO whose input
+ * (transaction id and index) was already added as an input is rejected.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance in which to add the input.
+ * \param[in] utxo A pointer to the \ref cardano_utxo_t structure representing the resolved UTXO to be used as an input.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ * \param[in] datum A pointer to the \ref cardano_plutus_data_t structure representing the datum for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_utxo_t* input_utxo = ...;                // UTXO to add as an input
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the input
+ * cardano_plutus_data_t* datum = ...;              // Optional datum for the input
+ *
+ * cardano_sub_tx_builder_add_input(sub_tx_builder, input_utxo, redeemer, datum);
+ * \endcode
+ *
+ * \note Any errors resulting from adding this input will be deferred and reported when `cardano_sub_tx_builder_build` is called.
+ *       An input that was already added as an input makes `cardano_sub_tx_builder_build` return
+ *       \ref CARDANO_ERROR_DUPLICATED_KEY. An input locked by a PlutusV1, PlutusV2 or PlutusV3 script can not be spent
+ *       inside a sub transaction and makes `cardano_sub_tx_builder_build` return \ref CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_input(
+  cardano_sub_tx_builder_t* builder,
+  cardano_utxo_t*           utxo,
+  cardano_plutus_data_t*    redeemer,
+  cardano_plutus_data_t*    datum);
+
+/**
+ * \brief Adds an input locked by a PlutusV4 script whose redeemer payload is produced by a deferred callback.
+ *
+ * Behaves like \ref cardano_sub_tx_builder_add_input, but instead of a literal redeemer the caller provides a callback
+ * that builds the payload once the layout of the sub transaction is final. This is the mechanism for redeemers that
+ * carry indices of elements of the script context (see \ref cardano_deferred_redeemer_fn_t and the
+ * \ref cardano_transaction_find_input_index family).
+ *
+ * The callback is invoked when `cardano_sub_tx_builder_build` is called, after the index of every spend redeemer is
+ * set and before the scripts are evaluated, so the produced payload is evaluated and covered by the script data hash.
+ * It receives a transaction whose body holds the sorted inputs, the outputs and every other field of the sub
+ * transaction body, with a zero fee, together with the UTXOs spent by the sub transaction in that same sorted order.
+ * Every index the callback computes is therefore local to the body of the sub transaction, the body that is signed.
+ *
+ * The callback must be a pure function of its arguments. The caller must keep `user_context` valid until the sub
+ * transaction is built.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance in which to add the input.
+ * \param[in] utxo A pointer to the \ref cardano_utxo_t structure representing the resolved UTXO to be used as an input.
+ * \param[in] callback The \ref cardano_deferred_redeemer_fn_t callback producing the redeemer payload.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ * \param[in] datum A pointer to the \ref cardano_plutus_data_t structure representing the datum for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;      // Initialized sub transaction builder
+ * cardano_utxo_t* input_utxo = ...;                    // UTXO locked by a PlutusV4 script
+ * cardano_deferred_redeemer_fn_t callback = ...;       // Builds the redeemer from the sub transaction body
+ *
+ * cardano_sub_tx_builder_add_input_with_deferred_redeemer(sub_tx_builder, input_utxo, callback, input_utxo, NULL);
+ * \endcode
+ *
+ * \note Any errors resulting from adding this input will be deferred and reported when `cardano_sub_tx_builder_build` is called.
+ *       A callback that fails makes `cardano_sub_tx_builder_build` return the error of the callback, and a callback
+ *       that produces no payload makes it return \ref CARDANO_ERROR_POINTER_IS_NULL.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_input_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*      builder,
+  cardano_utxo_t*                utxo,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  cardano_plutus_data_t*         datum);
+
+/**
+ * \brief Adds a reference input to the sub transaction.
+ *
+ * This function appends a specified UTXO as a reference input to the sub transaction being built.
+ * Reference inputs give access to the data and the reference script of a UTXO without consuming it. A reference input
+ * set cannot hold the same input twice, so a UTXO whose input (transaction id and index) was already added as a
+ * reference input is rejected.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance in which to add the reference input.
+ * \param[in] utxo A pointer to the \ref cardano_utxo_t structure representing the UTXO to be used as a reference input.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_utxo_t* reference_utxo = ...;            // UTXO to add as a reference input
+ * cardano_sub_tx_builder_add_reference_input(sub_tx_builder, reference_utxo);
+ * \endcode
+ *
+ * \note Any errors resulting from adding this input will be reported when `cardano_sub_tx_builder_build` is called. A
+ *       reference input added twice makes `cardano_sub_tx_builder_build` return \ref CARDANO_ERROR_DUPLICATED_KEY.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_reference_input(cardano_sub_tx_builder_t* builder, cardano_utxo_t* utxo);
+
+/**
+ * \brief Adds an output to the sub transaction.
+ *
+ * This function appends a specified transaction output to the sub transaction being built.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance to which the output will be added.
+ * \param[in] output A pointer to the \ref cardano_transaction_output_t structure representing the transaction output to be added.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;    // Initialized sub transaction builder
+ * cardano_transaction_output_t* tx_output = ...;     // Transaction output to add
+ *
+ * cardano_sub_tx_builder_add_output(sub_tx_builder, tx_output);
+ * \endcode
+ *
+ * \note Any errors related to adding this output will be deferred and reported when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_output(
+  cardano_sub_tx_builder_t*     builder,
+  cardano_transaction_output_t* output);
+
+/**
+ * \brief Sends a specified amount of lovelace to a given address.
+ *
+ * This function adds a transaction output to the builder, targeting a specific address and setting the amount of lovelace to be sent.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance to which the output will be added.
+ * \param[in] address A pointer to the \ref cardano_address_t structure representing the recipient address.
+ * \param[in] amount The amount of lovelace to send to the specified address.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;    // Initialized sub transaction builder
+ * cardano_address_t* recipient_address = ...;        // Recipient address
+ * uint64_t lovelace_amount = 1000000;                // Amount of lovelace to send (e.g., 1 ADA)
+ *
+ * cardano_sub_tx_builder_send_lovelace(sub_tx_builder, recipient_address, lovelace_amount);
+ * \endcode
+ *
+ * \note Any errors related to sending lovelace will be deferred and reported when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_send_lovelace(
+  cardano_sub_tx_builder_t* builder,
+  cardano_address_t*        address,
+  uint64_t                  amount);
+
+/**
+ * \brief Sends a specified amount of lovelace to a given address in string format.
+ *
+ * This function adds a transaction output to the builder, targeting a specific address in string format and setting the amount of lovelace to be sent.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance to which the output will be added.
+ * \param[in] address A pointer to a character array containing the recipient address in string format.
+ * \param[in] address_size The size of the address string.
+ * \param[in] amount The amount of lovelace to send to the specified address.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* recipient_address = "addr1...";      // Recipient address in string format
+ * size_t address_size = strlen(recipient_address); // Size of the address string
+ * uint64_t lovelace_amount = 1000000;              // Amount of lovelace to send (e.g., 1 ADA)
+ *
+ * cardano_sub_tx_builder_send_lovelace_ex(sub_tx_builder, recipient_address, address_size, lovelace_amount);
+ * \endcode
+ *
+ * \note Errors, such as an invalid address, will be deferred and reported when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_send_lovelace_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               address,
+  size_t                    address_size,
+  uint64_t                  amount);
+
+/**
+ * \brief Sends a specified value (which may include ADA and other assets) to a given address.
+ *
+ * This function adds a transaction output to the builder, specifying an address and a complex value that can include multiple assets in addition to ADA.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance to which the output will be added.
+ * \param[in] address A pointer to a \ref cardano_address_t object representing the recipient address.
+ * \param[in] value A pointer to a \ref cardano_value_t object containing the ADA and any additional assets to send.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_address_t* recipient_address = ...;      // Address to send to
+ * cardano_value_t* transfer_value = ...;           // Value to transfer (e.g., ADA and assets)
+ *
+ * cardano_sub_tx_builder_send_value(sub_tx_builder, recipient_address, transfer_value);
+ * \endcode
+ *
+ * \note Errors, such as invalid assets, will be deferred and reported when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_send_value(
+  cardano_sub_tx_builder_t* builder,
+  cardano_address_t*        address,
+  cardano_value_t*          value);
+
+/**
+ * \brief Sends a specified value (which may include ADA and other assets) to a given address
+ * provided as raw string.
+ *
+ * This function adds a transaction output to the builder, specifying an address in
+ * character array format along with a complex value that may include multiple assets.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance to which the output will be added.
+ * \param[in] address A character array containing the recipient's address in bech32 or hex format.
+ * \param[in] address_size The length of the address character array.
+ * \param[in] value A pointer to a \ref cardano_value_t object containing the ADA and any additional assets to send.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* recipient_address = "addr1...";      // Bech32 address
+ * size_t address_size = strlen(recipient_address);
+ * cardano_value_t* transfer_value = ...;           // Value to transfer (e.g., ADA and assets)
+ *
+ * cardano_sub_tx_builder_send_value_ex(sub_tx_builder, recipient_address, address_size, transfer_value);
+ * \endcode
+ *
+ * \note Errors, such as an invalid address or invalid assets, will be deferred and reported when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_send_value_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               address,
+  size_t                    address_size,
+  cardano_value_t*          value);
+
+/**
+ * \brief Locks a specified amount of lovelace at a script address.
+ *
+ * This function adds a transaction output to the sub transaction that sends lovelace to a script address.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance to which the locked output will be added.
+ * \param[in] script_address A pointer to the \ref cardano_address_t representing the script address where the lovelace will be locked.
+ * \param[in] amount The amount of lovelace to be locked at the script address.
+ * \param[in] datum A pointer to the \ref cardano_datum_t object containing the data to lock with the transaction.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...; // Initialized sub transaction builder
+ * cardano_address_t* script_addr = ...;           // Script address
+ * uint64_t lovelace_amount = 5000000;             // Amount of lovelace to lock
+ * cardano_datum_t* datum = ...;                   // Datum associated with the script
+ *
+ * cardano_sub_tx_builder_lock_lovelace(sub_tx_builder, script_addr, lovelace_amount, datum);
+ * \endcode
+ *
+ * \note Errors such as an invalid amount or address will be reported when `cardano_sub_tx_builder_build` is called.
+ *       A datum hash only commits to the datum, so provide the datum itself with `cardano_sub_tx_builder_add_datum` to
+ *       include it in the witness set of the sub transaction.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_lock_lovelace(
+  cardano_sub_tx_builder_t* builder,
+  cardano_address_t*        script_address,
+  uint64_t                  amount,
+  cardano_datum_t*          datum);
+
+/**
+ * \brief Locks a specified amount of lovelace at a script address using an address in raw byte format.
+ *
+ * This function adds a transaction output to the sub transaction, sending lovelace to a script address.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance where the locked output will be added.
+ * \param[in] script_address A pointer to a raw byte array containing the script address where the lovelace will be locked.
+ * \param[in] script_address_size The size, in bytes, of the script address.
+ * \param[in] amount The amount of lovelace to be locked at the specified script address.
+ * \param[in] datum A pointer to the \ref cardano_datum_t object containing the datum for the script output.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...; // Initialized sub transaction builder
+ * const char* script_addr_bytes = ...;            // Raw bytes of script address
+ * size_t script_addr_size = ...;                  // Size of the address in bytes
+ * uint64_t lovelace_amount = 5000000;             // Amount of lovelace to lock
+ * cardano_datum_t* datum = ...;                   // Datum associated with the script
+ *
+ * cardano_sub_tx_builder_lock_lovelace_ex(sub_tx_builder, script_addr_bytes, script_addr_size, lovelace_amount, datum);
+ * \endcode
+ *
+ * \note Errors such as an invalid amount or address will be deferred until `cardano_sub_tx_builder_build` is called.
+ *       A datum hash only commits to the datum, so provide the datum itself with `cardano_sub_tx_builder_add_datum` to
+ *       include it in the witness set of the sub transaction.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_lock_lovelace_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               script_address,
+  size_t                    script_address_size,
+  uint64_t                  amount,
+  cardano_datum_t*          datum);
+
+/**
+ * \brief Locks a specified value (including ADA and multi-asset tokens) at a script address.
+ *
+ * This function adds a transaction output to the sub transaction, sending a specified value to a script address.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance where the locked output will be added.
+ * \param[in] script_address A pointer to the \ref cardano_address_t object representing the script address where the value will be locked.
+ * \param[in] value A pointer to the \ref cardano_value_t object representing the amount and type of value (ADA or tokens) to be locked at the script address.
+ * \param[in] datum A pointer to the \ref cardano_datum_t object containing the datum for the script output.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...; // Initialized sub transaction builder
+ * cardano_address_t* script_addr = ...;           // Script address to lock value at
+ * cardano_value_t* value = ...;                   // Value including ADA and/or tokens
+ * cardano_datum_t* datum = ...;                   // Datum associated with the script
+ *
+ * cardano_sub_tx_builder_lock_value(sub_tx_builder, script_addr, value, datum);
+ * \endcode
+ *
+ * \note Errors such as invalid address or value will be deferred until `cardano_sub_tx_builder_build` is called.
+ *       A datum hash only commits to the datum, so provide the datum itself with `cardano_sub_tx_builder_add_datum` to
+ *       include it in the witness set of the sub transaction.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_lock_value(
+  cardano_sub_tx_builder_t* builder,
+  cardano_address_t*        script_address,
+  cardano_value_t*          value,
+  cardano_datum_t*          datum);
+
+/**
+ * \brief Locks a specified value (including ADA and multi-asset tokens) at a script address using a raw address string.
+ *
+ * This function adds a transaction output to the sub transaction, sending a specified value to a script address represented by a raw address string.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance where the locked output will be added.
+ * \param[in] script_address A pointer to a character array containing the raw script address string where the value will be locked.
+ * \param[in] script_address_size The size of the `script_address` string in bytes.
+ * \param[in] value A pointer to the \ref cardano_value_t object representing the amount and type of value (ADA or tokens) to be locked at the script address.
+ * \param[in] datum A pointer to the \ref cardano_datum_t object containing the datum for the script output.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...; // Initialized sub transaction builder
+ * const char* script_addr_str = "addr_test1...";  // Raw address string for the script address
+ * size_t script_addr_size = strlen(script_addr_str);
+ * cardano_value_t* value = ...;                   // Value including ADA and/or tokens
+ * cardano_datum_t* datum = ...;                   // Datum associated with the script (optional)
+ *
+ * cardano_sub_tx_builder_lock_value_ex(sub_tx_builder, script_addr_str, script_addr_size, value, datum);
+ * \endcode
+ *
+ * \note Errors such as invalid address or value will be deferred until `cardano_sub_tx_builder_build` is called.
+ *       A datum hash only commits to the datum, so provide the datum itself with `cardano_sub_tx_builder_add_datum` to
+ *       include it in the witness set of the sub transaction.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_lock_value_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               script_address,
+  size_t                    script_address_size,
+  cardano_value_t*          value,
+  cardano_datum_t*          datum);
+
+/**
+ * \brief Sets metadata for a sub transaction builder with a specified tag.
+ *
+ * This function attaches metadata to the sub transaction being built, associating it with a specific metadata tag. Metadata can include additional information for the sub transaction, often used to encode arbitrary data on-chain.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance where the metadata will be added.
+ * \param[in] tag A unique identifier for the metadata, typically a 64-bit unsigned integer.
+ * \param[in] metadata A pointer to the \ref cardano_metadatum_t object containing the metadata to be added.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * uint64_t metadata_tag = 12345;                   // Example metadata tag
+ * cardano_metadatum_t* metadata = ...;             // Initialized metadata object
+ *
+ * cardano_sub_tx_builder_set_metadata(sub_tx_builder, metadata_tag, metadata);
+ * \endcode
+ *
+ * \note This function only stores a reference to the metadata. Errors, such as invalid metadata format, will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_set_metadata(
+  cardano_sub_tx_builder_t* builder,
+  uint64_t                  tag,
+  cardano_metadatum_t*      metadata);
+
+/**
+ * \brief Sets metadata for a sub transaction builder from a JSON string with a specified tag.
+ *
+ * This function allows adding metadata to the sub transaction by parsing a JSON string representation of the metadata. The metadata is associated with a specified tag, allowing for organized and accessible on-chain data.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance where the metadata will be added.
+ * \param[in] tag A unique identifier for the metadata, typically a 64-bit unsigned integer.
+ * \param[in] metadata_json A pointer to a JSON string representing the metadata content.
+ * \param[in] json_size The length of the `metadata_json` string.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * uint64_t metadata_tag = 12345;                   // Example metadata tag
+ * const char* metadata_json = "{ \"name\": \"some_name\" }";  // Metadata JSON as string
+ * size_t json_size = strlen(metadata_json);
+ *
+ * cardano_sub_tx_builder_set_metadata_ex(sub_tx_builder, metadata_tag, metadata_json, json_size);
+ * \endcode
+ *
+ * \note This function will parse the JSON string to convert it into metadata. Errors, such as invalid JSON format, will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_set_metadata_ex(
+  cardano_sub_tx_builder_t* builder,
+  uint64_t                  tag,
+  const char*               metadata_json,
+  size_t                    json_size);
+
+/**
+ * \brief Adds a token minting operation to the sub transaction builder.
+ *
+ * This function allows the user to specify a token minting operation within a sub transaction, including
+ * the policy ID, asset name and amount. This enables minting (positive amount) or burning (negative amount) of
+ * tokens. A native script policy takes no redeemer. A PlutusV4 policy is run with the redeemer, which is evaluated
+ * natively when the sub transaction is built.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance for building the sub transaction.
+ * \param[in] policy_id A pointer to a \ref cardano_blake2b_hash_t representing the unique minting policy ID.
+ * \param[in] name A pointer to a \ref cardano_asset_name_t defining the name of the asset being minted or burned.
+ * \param[in] amount The number of tokens to mint or burn; positive values indicate minting, and negative values indicate burning.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_blake2b_hash_t* policy_id = ...;         // Policy ID for the token
+ * cardano_asset_name_t* asset_name = ...;          // Asset name for the token
+ * int64_t mint_amount = 100;                       // Amount to mint
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_mint_token(sub_tx_builder, policy_id, asset_name, mint_amount, redeemer);
+ * \endcode
+ *
+ * \note Errors related to this operation will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_mint_token(
+  cardano_sub_tx_builder_t* builder,
+  cardano_blake2b_hash_t*   policy_id,
+  cardano_asset_name_t*     name,
+  int64_t                   amount,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Adds a token minting operation whose redeemer payload is produced by a deferred callback.
+ *
+ * Behaves like \ref cardano_sub_tx_builder_mint_token, but the redeemer payload of the PlutusV4 policy is built by the
+ * callback from the body of the sub transaction when it is built. See
+ * \ref cardano_sub_tx_builder_add_input_with_deferred_redeemer.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance for building the sub transaction.
+ * \param[in] policy_id A pointer to a \ref cardano_blake2b_hash_t representing the unique minting policy ID.
+ * \param[in] name A pointer to a \ref cardano_asset_name_t defining the name of the asset being minted or burned.
+ * \param[in] amount The number of tokens to mint or burn; positive values indicate minting, and negative values indicate burning.
+ * \param[in] callback The \ref cardano_deferred_redeemer_fn_t callback producing the redeemer payload.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_blake2b_hash_t* policy_id = ...;         // Hash of the PlutusV4 policy
+ * cardano_asset_name_t* asset_name = ...;          // Asset name for the token
+ * cardano_deferred_redeemer_fn_t callback = ...;   // Builds the redeemer from the sub transaction body
+ *
+ * cardano_sub_tx_builder_mint_token_with_deferred_redeemer(sub_tx_builder, policy_id, asset_name, 100, callback, NULL);
+ * \endcode
+ *
+ * \note Errors related to this operation will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_mint_token_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*      builder,
+  cardano_blake2b_hash_t*        policy_id,
+  cardano_asset_name_t*          name,
+  int64_t                        amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context);
+
+/**
+ * \brief Adds a token minting operation to the sub transaction builder using policy ID and asset name in hexadecimal format.
+ *
+ * This function allows the sub transaction builder to mint or burn tokens associated with a specific policy ID and asset name.
+ * A native script policy takes no redeemer. A PlutusV4 policy is run with the redeemer, which is evaluated natively
+ * when the sub transaction is built.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for sub transaction construction.
+ * \param[in] policy_id_hex A string in hexadecimal format representing the policy ID of the token to mint or burn.
+ * \param[in] policy_id_size The size of the `policy_id_hex` string.
+ * \param[in] name_hex A string in hexadecimal format representing the asset name within the policy ID.
+ * \param[in] name_size The size of the `name_hex` string.
+ * \param[in] amount The amount of tokens to mint (positive) or burn (negative).
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* policy_id_hex = "abcdef123456";      // Example policy ID in hexadecimal format
+ * size_t policy_id_size = strlen(policy_id_hex);   // Size of policy ID
+ * const char* name_hex = "74657374";               // Asset name in hexadecimal ("test" in hex)
+ * size_t name_size = strlen(name_hex);             // Size of asset name
+ * int64_t mint_amount = 100;                       // Amount to mint (positive for minting, negative for burning)
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_mint_token_ex(sub_tx_builder, policy_id_hex, policy_id_size, name_hex, name_size, mint_amount, redeemer);
+ * \endcode
+ *
+ * \note Any errors related to this operation will only be reported when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_mint_token_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               policy_id_hex,
+  size_t                    policy_id_size,
+  const char*               name_hex,
+  size_t                    name_size,
+  int64_t                   amount,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Adds a token minting operation to the sub transaction builder using a predefined asset ID.
+ *
+ * This function allows minting or burning of tokens within a sub transaction by specifying an asset ID along with the amount.
+ * A native script policy takes no redeemer. A PlutusV4 policy is run with the redeemer, which is evaluated natively
+ * when the sub transaction is built.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used to build the sub transaction.
+ * \param[in] asset_id A pointer to a \ref cardano_asset_id_t structure representing the asset to mint or burn.
+ * \param[in] amount The amount of tokens to mint (positive) or burn (negative).
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_asset_id_t* asset_id = ...;              // Predefined asset ID for the token
+ * int64_t mint_amount = 50;                        // Amount to mint (positive for minting, negative for burning)
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_mint_token_with_id(sub_tx_builder, asset_id, mint_amount, redeemer);
+ * \endcode
+ *
+ * \note Any errors related to this operation are deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_mint_token_with_id(
+  cardano_sub_tx_builder_t* builder,
+  cardano_asset_id_t*       asset_id,
+  int64_t                   amount,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Adds a token minting operation to the sub transaction builder using an asset ID in hexadecimal format.
+ *
+ * This function enables minting or burning tokens for a specific asset identified by its unique `asset_id` in hexadecimal format.
+ * A native script policy takes no redeemer. A PlutusV4 policy is run with the redeemer, which is evaluated natively
+ * when the sub transaction is built.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for sub transaction construction.
+ * \param[in] asset_id_hex A string in hexadecimal format representing the unique asset ID.
+ * \param[in] hex_size The size of the `asset_id_hex` string.
+ * \param[in] amount The amount of tokens to mint (positive) or burn (negative).
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* asset_id_hex = "abcdef1234567890";   // Example asset ID in hexadecimal format
+ * size_t hex_size = strlen(asset_id_hex);          // Size of asset ID
+ * int64_t mint_amount = 100;                       // Amount to mint (positive for minting, negative for burning)
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_mint_token_with_id_ex(sub_tx_builder, asset_id_hex, hex_size, mint_amount, redeemer);
+ * \endcode
+ *
+ * \note Any errors will only be reported when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_mint_token_with_id_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               asset_id_hex,
+  size_t                    hex_size,
+  int64_t                   amount,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Adds a script to the sub transaction builder.
+ *
+ * This function allows the addition of a native or PlutusV4 script (`cardano_script_t`) to the witness set of the sub
+ * transaction. Native scripts define the conditions under which outputs can be unlocked and tokens can be minted,
+ * and a PlutusV4 script can run for any purpose of the sub transaction that takes a redeemer: spending an input,
+ * minting, withdrawing, certifying, voting or satisfying a script hash guard added with
+ * `cardano_sub_tx_builder_add_guard_with_redeemer`. PlutusV1, PlutusV2 and PlutusV3 scripts can not run inside a sub
+ * transaction, so adding one of them is reported as an error.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction details.
+ * \param[in] script A pointer to the \ref cardano_script_t structure representing the native or PlutusV4 script to
+ *                   be added.
+ *
+ * \note Errors related to adding an invalid or incompatible script will be deferred and reported only when `cardano_sub_tx_builder_build` is called.
+ *       A PlutusV1, PlutusV2 or PlutusV3 script is reported as \ref CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_script_t* script = ...;                  // A native script for the sub transaction
+ *
+ * cardano_sub_tx_builder_add_script(sub_tx_builder, script);
+ *
+ * // Additional sub transaction setup...
+ *
+ * cardano_error_t result = cardano_sub_tx_builder_build(sub_tx_builder, &sub_transaction);
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   const char* error_msg = cardano_sub_tx_builder_get_last_error(sub_tx_builder);
+ *   printf("Failed to build sub transaction with script: %s\n", error_msg);
+ * }
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_script(
+  cardano_sub_tx_builder_t* builder,
+  cardano_script_t*         script);
+
+/**
+ * \brief Adds a signer to the sub transaction being built.
+ *
+ * This function registers a specific signer for the sub transaction by providing their public key hash, so the sub
+ * transaction must carry a witness for that key. A required signer is a key hash guard: this function produces the
+ * same sub transaction as `cardano_sub_tx_builder_add_guard` with a key hash credential of the same hash. Adding a
+ * signer that is already present leaves the sub transaction unchanged.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for sub transaction construction.
+ * \param[in] pub_key_hash A pointer to the \ref cardano_blake2b_hash_t structure representing the public
+ *                         key hash of the signer to be added.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_blake2b_hash_t* signer_hash = ...;       // Public key hash for the signer
+ *
+ * cardano_sub_tx_builder_add_signer(sub_tx_builder, signer_hash);
+ * \endcode
+ *
+ * \note Errors related to adding signers are deferred and will only be reported when
+ *       `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_signer(
+  cardano_sub_tx_builder_t* builder,
+  cardano_blake2b_hash_t*   pub_key_hash);
+
+/**
+ * \brief Adds a signer to the sub transaction by specifying their public key hash in hexadecimal format.
+ *
+ * This function registers a signer by accepting their public key hash as a hexadecimal string. See
+ * `cardano_sub_tx_builder_add_signer` for how a signer relates to a key hash guard.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for sub transaction construction.
+ * \param[in] pub_key_hash A string representing the public key hash in hexadecimal format.
+ * \param[in] hash_size The size of the `pub_key_hash` string.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* pub_key_hash = "966e394a544f242081e41d1965137b1bb412ac230d40ed5407821c37";
+ * size_t hash_size = strlen(pub_key_hash);
+ *
+ * cardano_sub_tx_builder_add_signer_ex(sub_tx_builder, pub_key_hash, hash_size);
+ * \endcode
+ *
+ * \note Errors associated with adding a signer are deferred and will only be reported when
+ *       `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_signer_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               pub_key_hash,
+  size_t                    hash_size);
+
+/**
+ * \brief Adds a guard to the sub transaction being built.
+ *
+ * This function registers a guard credential for the sub transaction. Guards generalize required signers: a key hash
+ * guard is exactly a required signer, so the sub transaction must carry a witness for that key, while a script hash
+ * guard requires the ledger to run the script as a validity condition. Adding a guard that is already present leaves
+ * the sub transaction unchanged.
+ *
+ * The builder does not resolve or attach the script behind a script hash guard. Provide the script with
+ * `cardano_sub_tx_builder_add_script` or through a reference input. A script hash guard added with this function
+ * has no redeemer; use `cardano_sub_tx_builder_add_guard_with_redeemer` to add it together with the guarding
+ * redeemer that satisfies it. A guard whose script is a Plutus script provided to the sub transaction makes
+ * `cardano_sub_tx_builder_build` return \ref CARDANO_ERROR_MISSING_REDEEMER when it has no redeemer.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for sub transaction construction.
+ * \param[in] guard A pointer to the \ref cardano_credential_t structure representing the guard to be added.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_credential_t* guard = ...;               // Key hash or script hash credential
+ *
+ * cardano_sub_tx_builder_add_guard(sub_tx_builder, guard);
+ * \endcode
+ *
+ * \note Errors related to adding guards are deferred and will only be reported when
+ *       `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_guard(
+  cardano_sub_tx_builder_t* builder,
+  cardano_credential_t*     guard);
+
+/**
+ * \brief Adds a guard to the sub transaction by specifying the credential hash in hexadecimal format.
+ *
+ * This function registers a guard by accepting the hash of its credential as a hexadecimal string together with
+ * the credential type. See `cardano_sub_tx_builder_add_guard` for the difference between key hash and script hash
+ * guards.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for sub transaction construction.
+ * \param[in] hash_hex A string representing the credential hash in hexadecimal format.
+ * \param[in] hash_hex_size The size of the `hash_hex` string.
+ * \param[in] type The type of the credential, either \ref CARDANO_CREDENTIAL_TYPE_KEY_HASH or
+ *                 \ref CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* key_hash = "966e394a544f242081e41d1965137b1bb412ac230d40ed5407821c37";
+ * size_t hash_size = strlen(key_hash);
+ *
+ * cardano_sub_tx_builder_add_guard_ex(sub_tx_builder, key_hash, hash_size, CARDANO_CREDENTIAL_TYPE_KEY_HASH);
+ * \endcode
+ *
+ * \note Errors associated with adding a guard are deferred and will only be reported when
+ *       `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_guard_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               hash_hex,
+  size_t                    hash_hex_size,
+  cardano_credential_type_t type);
+
+/**
+ * \brief Adds a script hash guard to the sub transaction together with the guarding redeemer that satisfies it.
+ *
+ * This function registers \p guard like `cardano_sub_tx_builder_add_guard` and attaches a redeemer with the guarding
+ * purpose whose payload is \p redeemer. The ledger runs the guard script with that redeemer as a validity condition
+ * of the sub transaction. The redeemer points to the position of the guard in the guards of the sub transaction,
+ * which keep the order in which they were added, counting key hash guards and the signers added with
+ * `cardano_sub_tx_builder_add_signer`. A guard that is already present keeps its position.
+ *
+ * The guard script must be a PlutusV4 script, the only Plutus language that runs inside a sub transaction. Provide
+ * it with `cardano_sub_tx_builder_add_script` or through a reference input. When the sub transaction is built, the
+ * builder evaluates its redeemers with the native evaluator, using the cost models and the protocol version of the
+ * protocol parameters and resolving the inputs with the UTXOs added to the builder, writes the execution units into
+ * the redeemers and sets the script data hash, so the parties sign the final sub transaction. The sub transaction is
+ * evaluated at position 0 of a batch that holds nothing else. Its script context carries its position in the batch,
+ * so a script whose path or cost depends on that position may need different execution units in the final batch.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for sub transaction construction.
+ * \param[in] guard A pointer to the script hash \ref cardano_credential_t to add as a guard.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t handed to the guard script as its redeemer.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;
+ * cardano_credential_t*     guard          = ...;
+ * cardano_script_t*         script         = ...;
+ * cardano_plutus_data_t*    redeemer       = ...;
+ *
+ * cardano_sub_tx_builder_add_script(sub_tx_builder, script);
+ * cardano_sub_tx_builder_add_guard_with_redeemer(sub_tx_builder, guard, redeemer);
+ * \endcode
+ *
+ * \note Errors are deferred and will only be reported when `cardano_sub_tx_builder_build` is called. A key hash
+ *       guard makes `cardano_sub_tx_builder_build` return \ref CARDANO_ERROR_INVALID_ARGUMENT, since only a script
+ *       is satisfied by a redeemer, and a guard that already has a redeemer makes it return
+ *       \ref CARDANO_ERROR_DUPLICATED_KEY. A guard script that fails makes it return
+ *       \ref CARDANO_ERROR_SCRIPT_EVALUATION_FAILURE.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_guard_with_redeemer(
+  cardano_sub_tx_builder_t* builder,
+  cardano_credential_t*     guard,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Adds a datum to the sub transaction builder for use in script-locked UTXOs.
+ *
+ * This function registers a Plutus datum with the sub transaction builder. When the sub transaction is built, the
+ * datum is included in the plutus data of its witness set and is covered by its script data hash.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for constructing the sub transaction.
+ * \param[in] datum A pointer to a \ref cardano_plutus_data_t object representing the datum to be included.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_plutus_data_t* datum = ...;              // Initialized Plutus datum
+ *
+ * cardano_sub_tx_builder_add_datum(sub_tx_builder, datum);
+ * \endcode
+ *
+ * \note Errors related to adding a datum are deferred and will be reported when `cardano_sub_tx_builder_build` is called.
+ *       The caller must ensure that the `datum` remains valid until the sub transaction is built.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_datum(
+  cardano_sub_tx_builder_t* builder,
+  cardano_plutus_data_t*    datum);
+
+/**
+ * \brief Requires a guard from the top level transaction that carries the sub transaction.
+ *
+ * A sub transaction can constrain the batch it takes part in: every credential it requires must be listed among the
+ * guards of the top level transaction, otherwise the whole batch is invalid. Each required guard may carry a datum
+ * that is handed to the guard script of the top level transaction, which lets the sub transaction pass its own
+ * terms to that script. Requiring a credential that is already present replaces its datum.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for sub transaction construction.
+ * \param[in] credential A pointer to the \ref cardano_credential_t the top level transaction must be guarded by.
+ * \param[in] datum A pointer to the \ref cardano_plutus_data_t handed to the guard (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_credential_t* batcher_guard = ...;       // Credential the top level transaction must be guarded by
+ * cardano_plutus_data_t* terms = ...;              // Optional datum for the guard
+ *
+ * cardano_sub_tx_builder_require_top_level_guard(sub_tx_builder, batcher_guard, terms);
+ * \endcode
+ *
+ * \note Errors related to requiring a top level guard are deferred and will only be reported when
+ *       `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_require_top_level_guard(
+  cardano_sub_tx_builder_t* builder,
+  cardano_credential_t*     credential,
+  cardano_plutus_data_t*    datum);
+
+/**
+ * \brief Requires a guard from the top level transaction by specifying the credential hash in hexadecimal format.
+ *
+ * This function behaves like `cardano_sub_tx_builder_require_top_level_guard` but accepts the hash of the credential
+ * as a hexadecimal string together with the credential type.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for sub transaction construction.
+ * \param[in] hash_hex A string representing the credential hash in hexadecimal format.
+ * \param[in] hash_hex_size The size of the `hash_hex` string.
+ * \param[in] type The type of the credential, either \ref CARDANO_CREDENTIAL_TYPE_KEY_HASH or
+ *                 \ref CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH.
+ * \param[in] datum A pointer to the \ref cardano_plutus_data_t handed to the guard (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* script_hash = "966e394a544f242081e41d1965137b1bb412ac230d40ed5407821c37";
+ * size_t hash_size = strlen(script_hash);
+ *
+ * cardano_sub_tx_builder_require_top_level_guard_ex(sub_tx_builder, script_hash, hash_size, CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH, NULL);
+ * \endcode
+ *
+ * \note Errors related to requiring a top level guard are deferred and will only be reported when
+ *       `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_require_top_level_guard_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               hash_hex,
+  size_t                    hash_hex_size,
+  cardano_credential_type_t type,
+  cardano_plutus_data_t*    datum);
+
+/**
+ * \brief Adds a direct deposit to the sub transaction being built.
+ *
+ * A direct deposit pays lovelace straight into a reward account without creating a UTxO. The deposited amount is
+ * value produced by the sub transaction, so it is part of the imbalance the batch has to cover. Adding a direct
+ * deposit for a reward account that already has one accumulates both amounts.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for constructing the sub transaction.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t representing the reward account that
+ *                           receives the deposit.
+ * \param[in] amount The amount of lovelace to deposit. It must be greater than zero and at most INT64_MAX, the
+ *                   largest amount the balancer can represent.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;   // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;   // Initialized reward address
+ *
+ * cardano_sub_tx_builder_add_direct_deposit(sub_tx_builder, reward_address, 2000000);
+ * \endcode
+ *
+ * \note Errors related to adding a direct deposit, including an amount or an accumulated amount above INT64_MAX,
+ *       are deferred and will only be reported when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_direct_deposit(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* reward_address,
+  uint64_t                  amount);
+
+/**
+ * \brief Adds a direct deposit to the sub transaction using a string reward address.
+ *
+ * This function behaves like `cardano_sub_tx_builder_add_direct_deposit` but accepts the reward account as a Bech32
+ * string.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for constructing the sub transaction.
+ * \param[in] reward_address A string representing the reward account that receives the deposit.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] amount The amount of lovelace to deposit. It must be greater than zero and at most INT64_MAX, the
+ *                   largest amount the balancer can represent.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* reward_addr = "stake1u9...";         // Reward address in string format
+ * size_t address_size = strlen(reward_addr);       // Length of the reward address string
+ *
+ * cardano_sub_tx_builder_add_direct_deposit_ex(sub_tx_builder, reward_addr, address_size, 2000000);
+ * \endcode
+ *
+ * \note Errors related to adding a direct deposit are deferred and will only be reported when
+ *       `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_direct_deposit_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  uint64_t                  amount);
+
+/**
+ * \brief Adds an account balance interval to the sub transaction being built.
+ *
+ * An account balance interval makes the sub transaction valid only while the balance of the reward account sits
+ * inside the interval at the point the sub transaction is applied. An interval is either bounded (inclusive lower
+ * bound, exclusive upper bound, either of which may be absent) or an exact balance. Adding an interval for a
+ * reward account that already has one replaces the previous interval.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for constructing the sub transaction.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t representing the reward account the
+ *                           interval constrains.
+ * \param[in] interval A pointer to the \ref cardano_account_balance_interval_t the account balance must sit in.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;   // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;   // Initialized reward address
+ * cardano_account_balance_interval_t* interval = NULL;
+ * const uint64_t lower_bound = 1000000;
+ *
+ * if (cardano_account_balance_interval_new(&lower_bound, NULL, &interval) == CARDANO_SUCCESS)
+ * {
+ *   cardano_sub_tx_builder_add_account_balance_interval(sub_tx_builder, reward_address, interval);
+ *   cardano_account_balance_interval_unref(&interval);
+ * }
+ * \endcode
+ *
+ * \note Errors related to adding an interval are deferred and will only be reported when
+ *       `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_account_balance_interval(
+  cardano_sub_tx_builder_t*           builder,
+  cardano_reward_address_t*           reward_address,
+  cardano_account_balance_interval_t* interval);
+
+/**
+ * \brief Adds an account balance interval to the sub transaction using a string reward address.
+ *
+ * This function behaves like `cardano_sub_tx_builder_add_account_balance_interval` but accepts the reward account
+ * as a Bech32 string.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for constructing the sub transaction.
+ * \param[in] reward_address A string representing the reward account the interval constrains.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] interval A pointer to the \ref cardano_account_balance_interval_t the account balance must sit in.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;           // Initialized sub transaction builder
+ * cardano_account_balance_interval_t* interval = ...;       // Initialized interval
+ * const char* reward_addr = "stake1u9...";                  // Reward address in string format
+ * size_t address_size = strlen(reward_addr);                // Length of the reward address string
+ *
+ * cardano_sub_tx_builder_add_account_balance_interval_ex(sub_tx_builder, reward_addr, address_size, interval);
+ * \endcode
+ *
+ * \note Errors related to adding an interval are deferred and will only be reported when
+ *       `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_account_balance_interval_ex(
+  cardano_sub_tx_builder_t*           builder,
+  const char*                         reward_address,
+  size_t                              address_size,
+  cardano_account_balance_interval_t* interval);
+
+/**
+ * \brief Withdraws rewards from a specified reward account in the sub transaction builder.
+ *
+ * This function adds a withdrawal from the specified reward account to the sub transaction. The withdrawn amount
+ * is value consumed by the sub transaction, so it is part of the imbalance the batch has to match.
+ *
+ * A sub transaction can withdraw part of the balance of an account: the ledger only requires that the withdrawals
+ * of an account, added over the top level transaction and every sub transaction of the batch, do not exceed the
+ * balance the account had before the batch. The rule that a withdrawal must drain the account exactly only
+ * applies to the withdrawals of a top level transaction that needs a PlutusV1, PlutusV2 or PlutusV3 script.
+ *
+ * The account must also be registered before the batch, so the ledger rejects a batch whose sub transaction
+ * withdraws from an account the batch registers, even one funded by a direct deposit of the batch, or from an
+ * account an earlier sub transaction of the batch unregisters. The builder has no view of account state, so it
+ * does not check this.
+ *
+ * An account controlled by a key or by a native script is withdrawn from without a redeemer. An account controlled by
+ * a PlutusV4 script needs a redeemer, evaluated natively when the sub transaction is built, and its script provided
+ * with `cardano_sub_tx_builder_add_script` or through a reference input.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for constructing the sub transaction.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t representing the reward account address
+ *                    from which rewards should be withdrawn.
+ * \param[in] amount  The amount of rewards to withdraw from the account, in lovelace.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;   // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;   // Initialized reward address
+ * cardano_plutus_data_t* redeemer = ...;            // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_withdraw_rewards(sub_tx_builder, reward_address, 2532145, redeemer);
+ * \endcode
+ *
+ * \note Errors related to reward withdrawal will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_withdraw_rewards(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* address,
+  int64_t                   amount,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Withdraws rewards with a redeemer payload produced by a deferred callback.
+ *
+ * Behaves like \ref cardano_sub_tx_builder_withdraw_rewards, but the redeemer payload of the PlutusV4 script account
+ * is built by the callback from the body of the sub transaction when it is built. See
+ * \ref cardano_sub_tx_builder_add_input_with_deferred_redeemer.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for constructing the sub transaction.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t representing the reward account address
+ *                    from which rewards should be withdrawn.
+ * \param[in] amount  The amount of rewards to withdraw from the account, in lovelace.
+ * \param[in] callback The \ref cardano_deferred_redeemer_fn_t callback producing the redeemer payload.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;   // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;   // Reward address of a PlutusV4 script account
+ * cardano_deferred_redeemer_fn_t callback = ...;    // Builds the redeemer from the sub transaction body
+ *
+ * cardano_sub_tx_builder_withdraw_rewards_with_deferred_redeemer(sub_tx_builder, reward_address, 2532145, callback, NULL);
+ * \endcode
+ *
+ * \note Errors related to reward withdrawal will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_withdraw_rewards_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*      builder,
+  cardano_reward_address_t*      address,
+  int64_t                        amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context);
+
+/**
+ * \brief Withdraws rewards from a specified reward account using a string address in the sub transaction builder.
+ *
+ * This function behaves like `cardano_sub_tx_builder_withdraw_rewards` but accepts the reward account as a Bech32
+ * string. The same rules apply, including that the account must be registered before the batch, which the builder
+ * does not check.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for constructing the sub transaction.
+ * \param[in] reward_address A string representing the reward account address from which rewards are to be withdrawn.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] amount  The amount of rewards to withdraw from the account, in lovelace.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* reward_addr = "stake1u9...";         // Reward address in string format
+ * size_t address_size = strlen(reward_addr);       // Length of the reward address string
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_withdraw_rewards_ex(sub_tx_builder, reward_addr, address_size, 966584122, redeemer);
+ * \endcode
+ *
+ * \note Errors related to reward withdrawal will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_withdraw_rewards_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  int64_t                   amount,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Registers a staking reward address.
+ *
+ * This function adds a staking reward address to be registered in the sub transaction, allowing the specified
+ * reward account to start receiving staking rewards. The key deposit of the registration is value produced by the
+ * sub transaction, so it is part of the imbalance the batch has to cover.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance used for constructing the sub transaction.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t representing the reward account to be registered.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_addr = ...;     // Reward address to register
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_register_reward_address(sub_tx_builder, reward_addr, redeemer);
+ * \endcode
+ *
+ * \note Any errors related to reward address registration will be reported when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_register_reward_address(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Registers a staking reward address using a Bech32 address string.
+ *
+ * This function behaves like `cardano_sub_tx_builder_register_reward_address` but accepts the reward account as a
+ * Bech32 string.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction construction.
+ * \param[in] reward_address A pointer to a bech32 string representing the reward address.
+ * \param[in] address_size The size of the `reward_address` string.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* reward_address = "stake1uxxx...";
+ * size_t address_size = strlen(reward_address);
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_register_reward_address_ex(sub_tx_builder, reward_address, address_size, redeemer);
+ * \endcode
+ *
+ * \note Errors related to the reward address registration will be reported only when `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_register_reward_address_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Deregisters a staking reward address.
+ *
+ * This function deregisters the reward address, effectively preventing it from receiving future staking rewards.
+ * The key deposit the deregistration gives back is value consumed by the sub transaction, so it is part of the
+ * imbalance the batch has to match.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t structure representing the reward address to deregister.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;  // Reward address to be deregistered
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_deregister_reward_address(sub_tx_builder, reward_address, redeemer);
+ * \endcode
+ *
+ * \note Errors related to the deregistration process are deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_deregister_reward_address(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Deregisters a staking reward address using a Bech32 address string.
+ *
+ * This function behaves like `cardano_sub_tx_builder_deregister_reward_address` but accepts the reward account as a
+ * Bech32 string.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] reward_address A pointer to a bech32 string containing the reward address to be deregistered.
+ * \param[in] address_size The length of the reward address string.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* reward_address = "stake1uxxx...";    // Reward address in string format
+ * size_t address_size = strlen(reward_address);
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_deregister_reward_address_ex(sub_tx_builder, reward_address, address_size, redeemer);
+ * \endcode
+ *
+ * \note Errors related to the deregistration process are deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_deregister_reward_address_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Delegates stake from a specified staking reward address to a staking pool.
+ *
+ * This function delegates stake from a specified staking reward address to a staking pool,
+ * identified by its unique pool ID.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t representing the staking reward address to delegate.
+ * \param[in] pool_id A pointer to the \ref cardano_blake2b_hash_t representing the hash ID of the pool to delegate to.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;  // Reward address for staking
+ * cardano_blake2b_hash_t* pool_id = ...;           // Pool ID to delegate stake to
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_delegate_stake(sub_tx_builder, reward_address, pool_id, redeemer);
+ * \endcode
+ *
+ * \note Any errors associated with this delegation action will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_delegate_stake(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* address,
+  cardano_blake2b_hash_t*   pool_id,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Delegates stake from a specified staking reward address to a staking pool using string identifiers.
+ *
+ * This function behaves like `cardano_sub_tx_builder_delegate_stake` but accepts the reward address and the pool ID
+ * as Bech32 strings.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] reward_address A bech32 string representing the staking reward address for delegation.
+ * \param[in] address_size The size of the `reward_address` string.
+ * \param[in] pool_id A bech32 string representing the pool ID to which stake is delegated.
+ * \param[in] pool_id_size The size of the `pool_id` string.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* reward_address = "stake1u9...";
+ * size_t reward_address_size = strlen(reward_address);
+ * const char* pool_id = "pool1xy...";
+ * size_t pool_id_size = strlen(pool_id);
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_delegate_stake_ex(sub_tx_builder, reward_address, reward_address_size, pool_id, pool_id_size, redeemer);
+ * \endcode
+ *
+ * \note Errors related to this action will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_delegate_stake_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  const char*               pool_id,
+  size_t                    pool_id_size,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Adds a voting power delegation to a DRep for governance purposes.
+ *
+ * This function enables delegating voting power from a specified reward address to a DRep.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t representing the staking reward address that is delegating voting power.
+ * \param[in] drep A pointer to the \ref cardano_drep_t structure that identifies the decentralized representative receiving the delegated voting power.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;  // Reward address delegating voting power
+ * cardano_drep_t* drep = ...;                      // DRep receiving the delegated voting power
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_delegate_voting_power(sub_tx_builder, reward_address, drep, redeemer);
+ * \endcode
+ *
+ * \note Errors associated with this delegation will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_delegate_voting_power(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* address,
+  cardano_drep_t*           drep,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Delegates voting power to a DRep using string identifiers.
+ *
+ * This function behaves like `cardano_sub_tx_builder_delegate_voting_power` but accepts the reward address and the
+ * DRep ID as strings. The DRep ID can be provided in either CIP-105 or CIP-129 format.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] reward_address A string representing the staking reward address for the account delegating voting power.
+ * \param[in] address_size The length of the `reward_address` string.
+ * \param[in] drep_id A string representing the ID of the decentralized representative (DRep) receiving the voting power.
+ *                     The DRep ID can be in CIP-105 or CIP-129 format.
+ * \param[in] drep_id_size The length of the `drep_id` string.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* reward_address = "stake1u9...";      // Reward address delegating voting power
+ * size_t address_size = strlen(reward_address);
+ * const char* drep_id = "drep1q...";               // DRep ID in CIP-129 format
+ * size_t drep_id_size = strlen(drep_id);
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_delegate_voting_power_ex(sub_tx_builder, reward_address, address_size, drep_id, drep_id_size, redeemer);
+ * \endcode
+ *
+ * \note The DRep ID must conform to either CIP-105 or CIP-129 format.
+ *       Errors related to this delegation will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_delegate_voting_power_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  const char*               drep_id,
+  size_t                    drep_id_size,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Registers a DRep in the sub transaction.
+ *
+ * This function registers a DRep with an optional anchor in the sub transaction being constructed. The DRep deposit
+ * of the registration is value produced by the sub transaction, so it is part of the imbalance the batch has to
+ * cover.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] drep A pointer to the \ref cardano_drep_t instance representing the decentralized representative to be registered.
+ * \param[in] anchor An optional pointer to a \ref cardano_anchor_t instance pointing to the metadata of the DRep.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_drep_t* drep = ...;                      // DRep to register
+ * cardano_anchor_t* anchor = ...;                  // Optional governance anchor
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_register_drep(sub_tx_builder, drep, anchor, redeemer);
+ * \endcode
+ *
+ * \note Errors related to this registration will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_register_drep(
+  cardano_sub_tx_builder_t* builder,
+  cardano_drep_t*           drep,
+  cardano_anchor_t*         anchor,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Registers a DRep by ID in the sub transaction.
+ *
+ * This function behaves like `cardano_sub_tx_builder_register_drep` but accepts the DRep ID and the anchor as
+ * strings. The DRep ID must be provided in either CIP-105 or CIP-129 bech32 format.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] drep_id A pointer to a character array containing the DRep ID in bech32 format (either CIP-105 or CIP-129).
+ * \param[in] drep_id_size The size of the `drep_id` string.
+ * \param[in] metadata_url The URL pointing to the DRep metadata file.
+ * \param[in] metadata_url_size The size of the `metadata_url` string.
+ * \param[in] metadata_hash_hex The hash of the DRep metadata file in hexadecimal format.
+ * \param[in] metadata_hash_hex_size The size of the `metadata_hash_hex` string.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* drep_id = "drep1q...";
+ * size_t drep_id_size = strlen(drep_id);
+ * const char* metadata_url = "https://example.com/drep_metadata.json";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash_hex = "abcdef123456...";  // Hex-encoded hash of metadata file
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex);
+ * cardano_plutus_data_t* redeemer = ...;              // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_register_drep_ex(
+ *   sub_tx_builder,
+ *   drep_id,
+ *   drep_id_size,
+ *   metadata_url,
+ *   metadata_url_size,
+ *   metadata_hash_hex,
+ *   metadata_hash_hex_size);
+ * \endcode
+ *
+ * \note The `drep_id` must be in bech32 format as specified by either CIP-105 or CIP-129, which differ in their internal binary encoding.
+ *       Errors related to this registration will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_register_drep_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               drep_id,
+  size_t                    drep_id_size,
+  const char*               metadata_url,
+  size_t                    metadata_url_size,
+  const char*               metadata_hash_hex,
+  size_t                    metadata_hash_hex_size,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Updates an existing DRep in the sub transaction.
+ *
+ * This function allows updating a DRep in the sub transaction with a specified DRep object, optionally providing a
+ * new anchor.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] drep A pointer to the \ref cardano_drep_t instance representing the DRep to be updated.
+ * \param[in] anchor An optional pointer to a \ref cardano_anchor_t instance pointing to the metadata of the DRep.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_drep_t* drep = ...;                      // DRep object to update
+ * cardano_anchor_t* anchor = ...;                  // Optional anchor
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_update_drep(sub_tx_builder, drep, anchor, redeemer);
+ * \endcode
+ *
+ * \note Any errors related to updating the DRep will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_update_drep(
+  cardano_sub_tx_builder_t* builder,
+  cardano_drep_t*           drep,
+  cardano_anchor_t*         anchor,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Updates an existing DRep in the sub transaction by ID.
+ *
+ * This function behaves like `cardano_sub_tx_builder_update_drep` but accepts the DRep ID and the anchor as strings.
+ * The DRep ID must be provided in either CIP-105 or CIP-129 bech32 format.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] drep_id A pointer to a character array containing the DRep ID in bech32 format (either CIP-105 or CIP-129).
+ * \param[in] drep_id_size The size of the `drep_id` string.
+ * \param[in] metadata_url The URL pointing to the DRep metadata file.
+ * \param[in] metadata_url_size The size of the `metadata_url` string.
+ * \param[in] metadata_hash_hex The hash of the DRep metadata file in hexadecimal format.
+ * \param[in] metadata_hash_hex_size The size of the `metadata_hash_hex` string.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* drep_id = "drep1q...";
+ * size_t drep_id_size = strlen(drep_id);
+ * const char* metadata_url = "https://example.com/drep_metadata.json";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash_hex = "abcdef123456...";  // Hex-encoded hash of metadata file
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex);
+ * cardano_plutus_data_t* redeemer = ...;              // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_update_drep_ex(
+ *   sub_tx_builder,
+ *   drep_id,
+ *   drep_id_size,
+ *   metadata_url,
+ *   metadata_url_size,
+ *   metadata_hash_hex,
+ *   metadata_hash_hex_size);
+ * \endcode
+ *
+ * \note The `drep_id` must be in bech32 format as specified by either CIP-105 or CIP-129, which differ in their internal binary encoding.
+ *       Errors associated with updating the DRep will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_update_drep_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               drep_id,
+  size_t                    drep_id_size,
+  const char*               metadata_url,
+  size_t                    metadata_url_size,
+  const char*               metadata_hash_hex,
+  size_t                    metadata_hash_hex_size,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Deregisters an existing DRep.
+ *
+ * This function deregisters a DRep. The DRep deposit the deregistration gives back is value consumed by the sub
+ * transaction, so it is part of the imbalance the batch has to match.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] drep A pointer to the \ref cardano_drep_t instance representing the DRep to deregister.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_drep_t* drep = ...;                      // DRep to deregister
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_deregister_drep(sub_tx_builder, drep, redeemer);
+ * \endcode
+ *
+ * \note Errors related to deregistering the DRep will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_deregister_drep(
+  cardano_sub_tx_builder_t* builder,
+  cardano_drep_t*           drep,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Deregisters an existing DRep by ID.
+ *
+ * This function behaves like `cardano_sub_tx_builder_deregister_drep` but accepts the DRep ID as a string. The DRep
+ * ID must conform to either CIP-105 or CIP-129 standards.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] drep_id A pointer to a character array containing the DRep ID in bech32 format (either CIP-105 or CIP-129).
+ * \param[in] drep_id_size The size of the `drep_id` string.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* drep_id = "drep1q...";               // DRep ID in CIP-105 format
+ * size_t drep_id_size = strlen(drep_id);
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_deregister_drep_ex(sub_tx_builder, drep_id, drep_id_size, redeemer);
+ * \endcode
+ *
+ * \note The `drep_id` must be in bech32 format as specified by either CIP-105 or CIP-129, which differ in their internal binary encoding.
+ *       Errors related to deregistering the DRep will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_deregister_drep_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               drep_id,
+  size_t                    drep_id_size,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Registers a vote for a specified governance action within the sub transaction.
+ *
+ * This function allows a voter to submit their vote for a given governance action. A voter identified by a key or by
+ * a native script needs no redeemer. A voter identified by a PlutusV4 script needs a redeemer, evaluated natively
+ * when the sub transaction is built.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] voter A pointer to a \ref cardano_voter_t structure representing the voter participating in the governance action.
+ * \param[in] action_id A pointer to a \ref cardano_governance_action_id_t identifying the governance action being voted on.
+ * \param[in] vote A pointer to a \ref cardano_voting_procedure_t defining the voting procedure and choice.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;       // Initialized sub transaction builder
+ * cardano_voter_t* voter = ...;                         // Voter information
+ * cardano_governance_action_id_t* action_id = ...;      // Governance action ID
+ * cardano_voting_procedure_t* vote = ...;               // Voting procedure with choice
+ * cardano_plutus_data_t* redeemer = ...;                // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_vote(sub_tx_builder, voter, action_id, vote, redeemer);
+ * \endcode
+ *
+ * \note Errors related to the voting operation will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_vote(
+  cardano_sub_tx_builder_t*       builder,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_plutus_data_t*          redeemer);
+
+/**
+ * \brief Casts a vote whose redeemer payload is produced by a deferred callback.
+ *
+ * Behaves like \ref cardano_sub_tx_builder_vote, but the redeemer payload of the PlutusV4 script voter is built by the
+ * callback from the body of the sub transaction when it is built. See
+ * \ref cardano_sub_tx_builder_add_input_with_deferred_redeemer. The \ref cardano_transaction_find_vote_index function
+ * can be used to look up the position of the voter in ledger voter order, which is the voting redeemer index, from
+ * inside the callback.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] voter A pointer to a \ref cardano_voter_t structure representing the voter participating in the governance action.
+ * \param[in] action_id A pointer to a \ref cardano_governance_action_id_t identifying the governance action being voted on.
+ * \param[in] vote A pointer to a \ref cardano_voting_procedure_t defining the voting procedure and choice.
+ * \param[in] callback The \ref cardano_deferred_redeemer_fn_t callback producing the redeemer payload.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;       // Initialized sub transaction builder
+ * cardano_voter_t* voter = ...;                         // Voter identified by a PlutusV4 script
+ * cardano_governance_action_id_t* action_id = ...;      // Governance action ID
+ * cardano_voting_procedure_t* vote = ...;               // Voting procedure with choice
+ * cardano_deferred_redeemer_fn_t callback = ...;        // Builds the redeemer from the sub transaction body
+ *
+ * cardano_sub_tx_builder_vote_with_deferred_redeemer(sub_tx_builder, voter, action_id, vote, callback, NULL);
+ * \endcode
+ *
+ * \note Errors related to the voting operation will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_vote_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*       builder,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_deferred_redeemer_fn_t  callback,
+  void*                           user_context);
+
+/**
+ * \brief Adds a certificate to the sub transaction.
+ *
+ * This function adds a specified certificate to the sub transaction being constructed. Certificates are used to perform
+ * various actions on the blockchain, such as staking, delegating, or registering/deregistering entities. A
+ * certificate whose credential is a key or a native script needs no redeemer. One whose credential is a PlutusV4
+ * script needs a redeemer, evaluated natively when the sub transaction is built.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] certificate A pointer to a \ref cardano_certificate_t structure representing the certificate to add.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the PlutusV4 script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_certificate_t* certificate = ...;        // Certificate to add
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer for the PlutusV4 script
+ *
+ * cardano_sub_tx_builder_add_certificate(sub_tx_builder, certificate, redeemer);
+ * \endcode
+ *
+ * \note Errors related to the certificate addition will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_certificate(
+  cardano_sub_tx_builder_t* builder,
+  cardano_certificate_t*    certificate,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Adds a certificate whose redeemer payload is produced by a deferred callback.
+ *
+ * Behaves like \ref cardano_sub_tx_builder_add_certificate, but the redeemer payload of the PlutusV4 script credential
+ * is built by the callback from the body of the sub transaction when it is built. See
+ * \ref cardano_sub_tx_builder_add_input_with_deferred_redeemer. The \ref cardano_transaction_find_certificate_index
+ * function can be used to look up the position of the certificate from inside the callback.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance managing the sub transaction.
+ * \param[in] certificate A pointer to a \ref cardano_certificate_t structure representing the certificate to add.
+ * \param[in] callback The \ref cardano_deferred_redeemer_fn_t callback producing the redeemer payload.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_certificate_t* certificate = ...;        // Certificate of a PlutusV4 script credential
+ * cardano_deferred_redeemer_fn_t callback = ...;   // Builds the redeemer from the sub transaction body
+ *
+ * cardano_sub_tx_builder_add_certificate_with_deferred_redeemer(sub_tx_builder, certificate, callback, NULL);
+ * \endcode
+ *
+ * \note Errors related to the certificate addition will be deferred until `cardano_sub_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_certificate_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*      builder,
+  cardano_certificate_t*         certificate,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context);
+
+/**
+ * \brief Adds a complete proposal procedure with an optional proposing redeemer.
+ *
+ * The proposal deposit must match the configured governance action deposit. Proposals retain
+ * insertion order; a proposal with identical serialized contents is rejected as a duplicate.
+ * A non-NULL redeemer requires a parameter change or treasury withdrawal with a policy hash.
+ * NULL adds no redeemer, including for proposals with a policy hash. The builder retains
+ * references to the proposal and redeemer. Errors are deferred until build.
+ *
+ * \param[in,out] builder The builder. NULL is a no-op.
+ * \param[in] proposal The proposal procedure. Must not be NULL.
+ * \param[in] redeemer The proposing payload, or NULL.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_proposal(
+  cardano_sub_tx_builder_t*     builder,
+  cardano_proposal_procedure_t* proposal,
+  cardano_plutus_data_t*        redeemer);
+
+/**
+ * \brief Adds a proposal whose proposing payload is produced by a deferred callback.
+ *
+ * The same proposal and deposit rules as \ref cardano_sub_tx_builder_add_proposal apply.
+ * The callback follows \ref cardano_deferred_redeemer_fn_t. Use
+ * \ref cardano_transaction_find_proposal_index on the draft transaction to obtain the
+ * proposal's proposing index. For sub transactions this index is local to that body.
+ * The caller must keep user_context valid until build completes.
+ *
+ * \param[in,out] builder The builder. NULL is a no-op.
+ * \param[in] proposal The proposal procedure with a policy hash. Must not be NULL.
+ * \param[in] callback The callback producing the payload. Must not be NULL.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_add_proposal_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*      builder,
+  cardano_proposal_procedure_t*  proposal,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context);
+
+/**
+ * \brief Proposes a parameter change within a sub transaction.
+ *
+ * This function adds a parameter change proposal to the sub transaction being built. The proposal specifies
+ * updates to protocol parameters, a governance action ID, and other metadata associated with the proposal. The
+ * governance action deposit of the proposal is value produced by the sub transaction, so it is part of the
+ * imbalance the batch has to cover.
+ *
+ * The proposal is validated by the guardrails script, so it carries a proposing redeemer at the index of the
+ * proposal. The index is local to the body of the sub transaction and the execution units are computed with the
+ * native evaluator when \ref cardano_sub_tx_builder_build is called.
+ *
+ * This convenience function uses Plutus unit (`d87980`) as the proposing redeemer.
+ * Use \ref cardano_sub_tx_builder_add_proposal for a custom redeemer, or
+ * \ref cardano_sub_tx_builder_add_proposal_with_deferred_redeemer to compute it after balancing.
+ *
+ * \param[in, out] builder A pointer to the \ref cardano_sub_tx_builder_t instance used to build the sub transaction.
+ * \param[in] reward_address A pointer to a \ref cardano_reward_address_t where the deposit will be refunded.
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object representing the anchor for the proposal. This parameter must not be NULL.
+ * \param[in] protocol_param_update A pointer to a \ref cardano_protocol_param_update_t object containing the protocol parameter updates.
+ *                                  This parameter must not be NULL.
+ * \param[in] governance_action_id A pointer to a \ref cardano_governance_action_id_t object referencing the most recent enacted action of the same type.
+ *                                 This parameter can be NULL if no proposals of this type have been enacted on the network.
+ * \param[in] policy_hash A pointer to a \ref cardano_blake2b_hash_t object representing the guardrails script hash (also known as the governance action policy script).
+ *                        This parameter must not be NULL.
+ *
+ * \note The guardrails script must be a PlutusV4 script, and it must be added to the sub transaction with
+ *       \ref cardano_sub_tx_builder_add_script or be available through a reference input. A PlutusV1, PlutusV2 or PlutusV3
+ *       guardrails script can not run inside a sub transaction, so \ref cardano_sub_tx_builder_build returns
+ *       `CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE` in that case.
+ *
+ * \note Any errors encountered during the addition of the parameter change proposal will be deferred until
+ *       \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;         // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;         // Reward address for deposit refund
+ * cardano_anchor_t* anchor = ...;                         // Anchor metadata for the proposal
+ * cardano_protocol_param_update_t* param_update = ...;    // Protocol parameter updates
+ * cardano_governance_action_id_t* gov_action_id = ...;    // Optional governance action ID
+ * cardano_blake2b_hash_t* policy_hash = ...;              // Guardrails script hash
+ *
+ * cardano_sub_tx_builder_propose_parameter_change(sub_tx_builder, reward_address, anchor, param_update, gov_action_id, policy_hash);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_parameter_change(
+  cardano_sub_tx_builder_t*        builder,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_blake2b_hash_t*          policy_hash);
+
+/**
+ * \brief Proposes a parameter change within a sub transaction using extended parameters.
+ *
+ * This function behaves like `cardano_sub_tx_builder_propose_parameter_change` but accepts the reward address, the
+ * anchor, the governance action ID and the guardrails script hash as strings.
+ *
+ * This convenience function uses Plutus unit (`d87980`) as the proposing redeemer.
+ * Use \ref cardano_sub_tx_builder_add_proposal for a custom redeemer, or
+ * \ref cardano_sub_tx_builder_add_proposal_with_deferred_redeemer to compute it after balancing.
+ *
+ * \param[in, out] builder A pointer to the \ref cardano_sub_tx_builder_t instance used to build the sub transaction.
+ * \param[in] reward_address A string representation of the reward address where the deposit will be refunded.
+ * \param[in] reward_address_size The size (in bytes) of the `reward_address` string.
+ * \param[in] metadata_url A string containing the URL pointing to additional metadata for the proposal.
+ * \param[in] metadata_url_size The size (in bytes) of the `metadata_url` string.
+ * \param[in] metadata_hash_hex A hexadecimal string representing the hash of the metadata contents.
+ * \param[in] metadata_hash_hex_size The size (in bytes) of the `metadata_hash_hex` string.
+ * \param[in] gov_action_id A CIP-0129 bech32 string representing the governance action ID that references the most recent enacted action of the same type.
+ * \param[in] gov_action_id_size The size (in bytes) of the `gov_action_id` string.
+ * \param[in] policy_hash_hash_hex A hexadecimal string representing the guardrails script hash (also known as the governance action policy script).
+ * \param[in] policy_hash_hash_hex_size The size (in bytes) of the `policy_hash_hash_hex` string.
+ * \param[in] protocol_param_update A pointer to a \ref cardano_protocol_param_update_t object containing the protocol parameter updates.
+ *                                  This parameter must not be NULL.
+ *
+ * \note The guardrails script must be a PlutusV4 script, otherwise \ref cardano_sub_tx_builder_build returns
+ *       `CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE`.
+ *
+ * \note Any errors encountered during the addition of the parameter change proposal will be deferred until
+ *       \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;      // Initialized sub transaction builder
+ * const char* reward_address = "stake1u9hwrj...";      // Reward address in Bech32
+ * const char* metadata_url = "https://example.com/metadata.json";
+ * const char* metadata_hash = "d2a4f89b...";           // Metadata hash in hexadecimal
+ * const char* gov_action_id = "gov_action1...";        // Governance action ID in CIP-129 format
+ * const char* policy_hash = "f4a6b3e...";              // Guardrails script hash in hexadecimal
+ * cardano_protocol_param_update_t* param_update = ...; // Protocol parameter updates
+ *
+ * cardano_sub_tx_builder_propose_parameter_change_ex(
+ *   sub_tx_builder,
+ *   reward_address, strlen(reward_address),
+ *   metadata_url, strlen(metadata_url),
+ *   metadata_hash, strlen(metadata_hash),
+ *   gov_action_id, strlen(gov_action_id),
+ *   policy_hash, strlen(policy_hash),
+ *   param_update);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_parameter_change_ex(
+  cardano_sub_tx_builder_t*        builder,
+  const char*                      reward_address,
+  size_t                           reward_address_size,
+  const char*                      metadata_url,
+  size_t                           metadata_url_size,
+  const char*                      metadata_hash_hex,
+  size_t                           metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  size_t                           gov_action_id_size,
+  const char*                      policy_hash_hash_hex,
+  size_t                           policy_hash_hash_hex_size,
+  cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Proposes a hard fork within a sub transaction.
+ *
+ * This function adds a proposal to initiate a hard fork in the Cardano network to the sub transaction being built. The hard fork proposal
+ * specifies the target protocol version and other required parameters. An optional governance action ID can be provided to reference
+ * the most recent enacted hard fork action of the same type. The governance action deposit of the proposal is value produced by the
+ * sub transaction, so it is part of the imbalance the batch has to cover.
+ *
+ * \param[in, out] builder A pointer to the \ref cardano_sub_tx_builder_t instance used to build the sub transaction.
+ * \param[in] reward_address A pointer to a \ref cardano_reward_address_t object where the deposit will be refunded.
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object containing additional metadata related to the proposal.
+ * \param[in] version A pointer to a \ref cardano_protocol_version_t object specifying the target protocol version for the hard fork.
+ * \param[in] governance_action_id An optional pointer to a \ref cardano_governance_action_id_t object referencing the most recent
+ *                                 enacted governance action of the same type. This can be NULL if no such action has been enacted.
+ *
+ * \note Errors encountered during the addition of the hard fork proposal will be deferred until \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;         // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;         // Reward address for deposit refund
+ * cardano_anchor_t* anchor = ...;                         // Anchor metadata for the proposal
+ * cardano_protocol_version_t* version = ...;              // Target protocol version
+ * cardano_governance_action_id_t* gov_action_id = ...;    // Optional governance action ID
+ *
+ * cardano_sub_tx_builder_propose_hardfork(sub_tx_builder, reward_address, anchor, version, gov_action_id);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_hardfork(
+  cardano_sub_tx_builder_t*       builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_protocol_version_t*     version,
+  cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Proposes a hard fork within a sub transaction (extended version).
+ *
+ * This function behaves like `cardano_sub_tx_builder_propose_hardfork` but accepts the reward address, the anchor and the
+ * governance action ID as strings, and the target protocol version as numbers.
+ *
+ * \param[in, out] builder A pointer to the \ref cardano_sub_tx_builder_t instance used to build the sub transaction.
+ * \param[in] reward_address A pointer to the reward address string where the deposit will be refunded.
+ *                           This must be a valid Bech32-encoded reward address.
+ * \param[in] reward_address_size The size of the reward address string in bytes.
+ * \param[in] metadata_url A pointer to the URL string containing metadata about the hard fork proposal.
+ * \param[in] metadata_url_size The size of the metadata URL string in bytes.
+ * \param[in] metadata_hash_hex A pointer to the hexadecimal string representing the hash of the metadata file.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] gov_action_id A CIP-0129 bech32 string representing the governance action ID that references the most recent enacted action of the same type.
+ * \param[in] gov_action_id_size The size (in bytes) of the `gov_action_id` string.
+ * \param[in] minor_protocol_version The minor protocol version for the proposed hard fork.
+ * \param[in] major_protocol_version The major protocol version for the proposed hard fork.
+ *
+ * \note Errors encountered during the addition of the hard fork proposal will be deferred until \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* reward_address = "stake1u...";
+ * size_t reward_address_size = strlen(reward_address);
+ * const char* metadata_url = "https://example.com/metadata.json";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash = "abcdef1234567890...";
+ * size_t metadata_hash_size = strlen(metadata_hash);
+ * const char* gov_action_id = "gov_action1...";
+ * size_t gov_action_id_size = strlen(gov_action_id);
+ *
+ * cardano_sub_tx_builder_propose_hardfork_ex(
+ *   sub_tx_builder,
+ *   reward_address,
+ *   reward_address_size,
+ *   metadata_url,
+ *   metadata_url_size,
+ *   metadata_hash,
+ *   metadata_hash_size,
+ *   gov_action_id,
+ *   gov_action_id_size,
+ *   0,
+ *   12);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_hardfork_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    reward_address_size,
+  const char*               metadata_url,
+  size_t                    metadata_url_size,
+  const char*               metadata_hash_hex,
+  size_t                    metadata_hash_hex_size,
+  const char*               gov_action_id,
+  size_t                    gov_action_id_size,
+  uint64_t                  minor_protocol_version,
+  uint64_t                  major_protocol_version);
+
+/**
+ * \brief Proposes treasury withdrawals within a sub transaction.
+ *
+ * This function prepares a proposal to withdraw funds from the treasury. The governance action deposit of the
+ * proposal is value produced by the sub transaction, so it is part of the imbalance the batch has to cover.
+ *
+ * The proposal is validated by the guardrails script, so it carries a proposing redeemer at the index of the
+ * proposal. The index is local to the body of the sub transaction and the execution units are computed with the
+ * native evaluator when \ref cardano_sub_tx_builder_build is called.
+ *
+ * This convenience function uses Plutus unit (`d87980`) as the proposing redeemer.
+ * Use \ref cardano_sub_tx_builder_add_proposal for a custom redeemer, or
+ * \ref cardano_sub_tx_builder_add_proposal_with_deferred_redeemer to compute it after balancing.
+ *
+ * \param[in,out] builder        A pointer to an initialized \ref cardano_sub_tx_builder_t object used to build the sub transaction.
+ * \param[in]     reward_address A pointer to a \ref cardano_reward_address_t object representing the address that will receive the deposit refund.
+ * \param[in]     anchor         A pointer to an initialized \ref cardano_anchor_t object containing metadata about the proposal.
+ * \param[in]     withdrawals    A pointer to a \ref cardano_withdrawal_map_t object defining the requested treasury withdrawals.
+ * \param[in]     policy_hash    A pointer to a \ref cardano_blake2b_hash_t object representing the guardrails script hash.
+ *                               This parameter must not be NULL.
+ *
+ * \note The guardrails script must be a PlutusV4 script, and it must be added to the sub transaction with
+ *       \ref cardano_sub_tx_builder_add_script or be available through a reference input. A PlutusV1, PlutusV2 or PlutusV3
+ *       guardrails script can not run inside a sub transaction, so \ref cardano_sub_tx_builder_build returns
+ *       `CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE` in that case.
+ *
+ * \note Any errors encountered during the addition of the treasury withdrawals proposal will be deferred until
+ *       \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;   // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;   // Reward address for deposit refund
+ * cardano_anchor_t* anchor = ...;                   // Metadata for the proposal
+ * cardano_withdrawal_map_t* withdrawals = ...;      // Treasury withdrawals
+ * cardano_blake2b_hash_t* policy_hash = ...;        // Guardrails script hash
+ *
+ * cardano_sub_tx_builder_propose_treasury_withdrawals(sub_tx_builder, reward_address, anchor, withdrawals, policy_hash);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_treasury_withdrawals(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor,
+  cardano_withdrawal_map_t* withdrawals,
+  cardano_blake2b_hash_t*   policy_hash);
+
+/**
+ * \brief Proposes treasury withdrawals within a sub transaction using extended parameters.
+ *
+ * This function behaves like `cardano_sub_tx_builder_propose_treasury_withdrawals` but accepts the reward address, the
+ * anchor and the guardrails script hash as strings.
+ *
+ * This convenience function uses Plutus unit (`d87980`) as the proposing redeemer.
+ * Use \ref cardano_sub_tx_builder_add_proposal for a custom redeemer, or
+ * \ref cardano_sub_tx_builder_add_proposal_with_deferred_redeemer to compute it after balancing.
+ *
+ * \param[in,out] builder                   A pointer to an initialized \ref cardano_sub_tx_builder_t object used to build the sub transaction.
+ * \param[in]     reward_address            A pointer to the reward address string for receiving the deposit refund. Must be a valid Bech32 address.
+ * \param[in]     reward_address_size       The size of the reward address string.
+ * \param[in]     metadata_url              A pointer to the metadata URL string providing additional proposal context.
+ * \param[in]     metadata_url_size         The size of the metadata URL string.
+ * \param[in]     metadata_hash_hex         A pointer to the hexadecimal string representation of the metadata hash.
+ * \param[in]     metadata_hash_hex_size    The size of the metadata hash string.
+ * \param[in]     policy_hash_hash_hex      A pointer to the hexadecimal string representation of the guardrails script hash.
+ * \param[in]     policy_hash_hash_hex_size The size of the guardrails script hash string.
+ * \param[in]     withdrawals               A pointer to a \ref cardano_withdrawal_map_t object defining the requested treasury withdrawals.
+ *
+ * \note The guardrails script must be a PlutusV4 script, otherwise \ref cardano_sub_tx_builder_build returns
+ *       `CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE`.
+ *
+ * \note Any errors encountered during the addition of the treasury withdrawals proposal will be deferred until
+ *       \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;   // Initialized sub transaction builder
+ * const char* reward_address = "stake1u9v8lkxklxyz123";
+ * const char* metadata_url = "https://example.com/metadata";
+ * const char* metadata_hash = "abc123";             // Metadata hash in hex
+ * const char* policy_hash = "def456";               // Guardrails script hash in hex
+ * cardano_withdrawal_map_t* withdrawals = ...;      // Treasury withdrawals
+ *
+ * cardano_sub_tx_builder_propose_treasury_withdrawals_ex(
+ *   sub_tx_builder, reward_address, strlen(reward_address),
+ *   metadata_url, strlen(metadata_url), metadata_hash, strlen(metadata_hash),
+ *   policy_hash, strlen(policy_hash), withdrawals);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_treasury_withdrawals_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    reward_address_size,
+  const char*               metadata_url,
+  size_t                    metadata_url_size,
+  const char*               metadata_hash_hex,
+  size_t                    metadata_hash_hex_size,
+  const char*               policy_hash_hash_hex,
+  size_t                    policy_hash_hash_hex_size,
+  cardano_withdrawal_map_t* withdrawals);
+
+/**
+ * \brief Proposes a no-confidence governance action within a sub transaction.
+ *
+ * This function prepares a proposal for a no-confidence action against the current constitutional committee.
+ * If enacted, it signals the community's lack of confidence in the committee, potentially leading to its reconstitution.
+ * The governance action deposit of the proposal is value produced by the sub transaction, so it is part of the imbalance
+ * the batch has to cover.
+ *
+ * \param[in,out] builder                 A pointer to an initialized \ref cardano_sub_tx_builder_t object used to build the sub transaction.
+ * \param[in]     reward_address          A pointer to a \ref cardano_reward_address_t object. This address will receive the deposit refund after the governance action completes.
+ * \param[in]     anchor                  A pointer to a \ref cardano_anchor_t object providing additional context or metadata for the governance action.
+ * \param[in]     governance_action_id    An optional pointer to a \ref cardano_governance_action_id_t object. This represents the unique identifier
+ *                                         for the most recently enacted action of the same type. This parameter can be NULL if no previous actions of this type exist.
+ *
+ * \note Any errors encountered during the addition of the no-confidence proposal will be deferred until
+ *       \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;      // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;      // Reward address for deposit refund
+ * cardano_anchor_t* anchor = ...;                      // Anchor metadata for the proposal
+ * cardano_governance_action_id_t* action_id = ...;     // Optional governance action ID
+ *
+ * cardano_sub_tx_builder_propose_no_confidence(sub_tx_builder, reward_address, anchor, action_id);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_no_confidence(
+  cardano_sub_tx_builder_t*       builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Proposes a no-confidence governance action using extended parameters.
+ *
+ * This function behaves like `cardano_sub_tx_builder_propose_no_confidence` but accepts the reward address, the anchor
+ * and the governance action ID as strings.
+ *
+ * \param[in,out] builder            A pointer to an initialized \ref cardano_sub_tx_builder_t object used to build the sub transaction.
+ * \param[in] reward_address         A pointer to a string containing the Bech32-encoded reward address. This address will receive the deposit refund
+ *                                   after the governance action completes.
+ * \param[in] reward_address_size    The size of the reward address string in bytes.
+ * \param[in] metadata_url           A pointer to a string containing the metadata URL for additional context regarding the proposal.
+ * \param[in] metadata_url_size      The size of the metadata URL string in bytes.
+ * \param[in] metadata_hash_hex      A pointer to a string containing the hexadecimal representation of the metadata hash.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] gov_action_id          A CIP-0129 bech32 string representing the governance action ID that references the most recent enacted action of the same type.
+ * \param[in] gov_action_id_size     The size (in bytes) of the `gov_action_id` string.
+ *
+ * \note Any errors encountered during the addition of the no-confidence proposal will be deferred until
+ *       \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;      // Initialized sub transaction builder
+ * const char* reward_address = "stake1u9...";
+ * size_t reward_address_size = strlen(reward_address);
+ * const char* metadata_url = "https://example.com";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash_hex = "a1b2c3...";
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex);
+ * const char* gov_action_id = "gov_action1...";
+ * size_t gov_action_id_size = strlen(gov_action_id);
+ *
+ * cardano_sub_tx_builder_propose_no_confidence_ex(sub_tx_builder, reward_address, reward_address_size,
+ *                                                 metadata_url, metadata_url_size, metadata_hash_hex,
+ *                                                 metadata_hash_hex_size, gov_action_id,
+ *                                                 gov_action_id_size);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_no_confidence_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    reward_address_size,
+  const char*               metadata_url,
+  size_t                    metadata_url_size,
+  const char*               metadata_hash_hex,
+  size_t                    metadata_hash_hex_size,
+  const char*               gov_action_id,
+  size_t                    gov_action_id_size);
+
+/**
+ * \brief Proposes an update to the Cardano constitutional committee.
+ *
+ * This function prepares a governance action to update the Cardano constitutional committee. The proposal specifies:
+ * - Committee members to be added.
+ * - Committee members to be removed.
+ * - The new quorum threshold for the committee.
+ *
+ * The governance action deposit of the proposal is value produced by the sub transaction, so it is part of the imbalance
+ * the batch has to cover.
+ *
+ * \param[in,out] builder                A pointer to an initialized \ref cardano_sub_tx_builder_t object used to build the sub transaction.
+ * \param[in]     reward_address         A pointer to a \ref cardano_reward_address_t object representing the reward address that will receive the deposit refund.
+ * \param[in]     anchor                 A pointer to a \ref cardano_anchor_t object representing the anchor for this governance action.
+ * \param[in]     governance_action_id   An optional pointer to a \ref cardano_governance_action_id_t object representing the most recently enacted governance action
+ *                                        of the same type. Can be NULL if no such prior action exists.
+ * \param[in]     members_to_be_removed  A pointer to a \ref cardano_credential_set_t object specifying the committee members to be removed.
+ * \param[in]     members_to_be_added    A pointer to a \ref cardano_committee_members_map_t object specifying the committee members to be added.
+ * \param[in]     new_quorum             A pointer to a \ref cardano_unit_interval_t object specifying the new quorum threshold for the committee.
+ *
+ * \note Any errors encountered during the addition of the update committee proposal will be deferred until
+ *       \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;         // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;         // Reward address to receive refund
+ * cardano_anchor_t* anchor = ...;                         // Governance action anchor
+ * cardano_governance_action_id_t* gov_action_id = ...;    // Most recently enacted action ID
+ * cardano_credential_set_t* members_to_remove = ...;      // Members to be removed
+ * cardano_committee_members_map_t* members_to_add = ...;  // Members to be added
+ * cardano_unit_interval_t* new_quorum = ...;              // New quorum threshold
+ *
+ * cardano_sub_tx_builder_propose_update_committee(sub_tx_builder, reward_address, anchor,
+ *                                                 gov_action_id, members_to_remove,
+ *                                                 members_to_add, new_quorum);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_update_committee(
+  cardano_sub_tx_builder_t*        builder,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  cardano_unit_interval_t*         new_quorum);
+
+/**
+ * \brief Proposes an update to the Cardano constitutional committee with extended parameters.
+ *
+ * This function behaves like `cardano_sub_tx_builder_propose_update_committee` but accepts the reward address, the anchor
+ * and the governance action ID as strings, and the new quorum threshold as a number.
+ *
+ * \param[in,out] builder                A pointer to an initialized \ref cardano_sub_tx_builder_t object used to build the sub transaction.
+ * \param[in]     reward_address         A pointer to a string containing the reward address (in Bech32 format) that will receive the deposit refund.
+ * \param[in]     reward_address_size    The size of the `reward_address` string.
+ * \param[in]     metadata_url           A pointer to a string containing the URL for the governance action metadata.
+ * \param[in]     metadata_url_size      The size of the `metadata_url` string.
+ * \param[in]     metadata_hash_hex      A pointer to a string containing the hex-encoded hash of the metadata file.
+ * \param[in]     metadata_hash_hex_size The size of the `metadata_hash_hex` string.
+ * \param[in]     gov_action_id          A CIP-0129 bech32 string representing the governance action ID that references the most recent enacted action of the same type.
+ * \param[in]     gov_action_id_size     The size (in bytes) of the `gov_action_id` string.
+ * \param[in]     members_to_be_removed  A pointer to a \ref cardano_credential_set_t object specifying the committee members to be removed.
+ * \param[in]     members_to_be_added    A pointer to a \ref cardano_committee_members_map_t object specifying the committee members to be added.
+ * \param[in]     new_quorum             The new quorum threshold for the committee.
+ *
+ * \note Any errors encountered during the addition of the update committee proposal will be deferred until
+ *       \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;         // Initialized sub transaction builder
+ * const char* reward_address = "stake1u9...";
+ * size_t reward_address_size = strlen(reward_address);
+ * const char* metadata_url = "https://example.com/proposal.json";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash_hex = "abc123...";
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex);
+ * const char* gov_action_id = "gov_action1...";
+ * size_t gov_action_id_size = strlen(gov_action_id);
+ * cardano_credential_set_t* members_to_remove = ...;      // Members to be removed
+ * cardano_committee_members_map_t* members_to_add = ...;  // Members to be added
+ *
+ * cardano_sub_tx_builder_propose_update_committee_ex(sub_tx_builder,
+ *                                                    reward_address, reward_address_size,
+ *                                                    metadata_url, metadata_url_size,
+ *                                                    metadata_hash_hex, metadata_hash_hex_size,
+ *                                                    gov_action_id, gov_action_id_size,
+ *                                                    members_to_remove,
+ *                                                    members_to_add,
+ *                                                    0.3);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_update_committee_ex(
+  cardano_sub_tx_builder_t*        builder,
+  const char*                      reward_address,
+  size_t                           reward_address_size,
+  const char*                      metadata_url,
+  size_t                           metadata_url_size,
+  const char*                      metadata_hash_hex,
+  size_t                           metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  size_t                           gov_action_id_size,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  double                           new_quorum);
+
+/**
+ * \brief Proposes a new constitution for the Cardano network.
+ *
+ * This function creates a governance action to propose a new constitution. The governance action deposit of the
+ * proposal is value produced by the sub transaction, so it is part of the imbalance the batch has to cover.
+ *
+ * \param[in,out] builder                A pointer to an initialized \ref cardano_sub_tx_builder_t object used to build the sub transaction.
+ * \param[in]     reward_address         A pointer to a \ref cardano_reward_address_t object representing the address that will receive the deposit refund.
+ * \param[in]     anchor                 A pointer to a \ref cardano_anchor_t object containing the anchor metadata for the proposal.
+ * \param[in]     governance_action_id   An optional pointer to a \ref cardano_governance_action_id_t object representing the governance action ID of the most
+ *                                        recently enacted action of the same type. This parameter can be NULL if no prior action exists.
+ * \param[in]     constitution           A pointer to a \ref cardano_constitution_t object containing the new constitution's details.
+ *
+ * \note Any errors encountered during the addition of the new constitution proposal will be deferred until \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;       // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;       // Reward address to refund deposit
+ * cardano_anchor_t* anchor = ...;                       // Anchor metadata
+ * cardano_governance_action_id_t* gov_action_id = ...;  // Optional governance action ID
+ * cardano_constitution_t* constitution = ...;           // Constitution details
+ *
+ * cardano_sub_tx_builder_propose_new_constitution(sub_tx_builder, reward_address, anchor, gov_action_id, constitution);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_new_constitution(
+  cardano_sub_tx_builder_t*       builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id,
+  cardano_constitution_t*         constitution);
+
+/**
+ * \brief Proposes a new constitution for the Cardano network using extended parameters.
+ *
+ * This function behaves like `cardano_sub_tx_builder_propose_new_constitution` but accepts the reward address, the
+ * anchor and the governance action ID as strings.
+ *
+ * \param[in,out] builder                A pointer to an initialized \ref cardano_sub_tx_builder_t object used to build the sub transaction.
+ * \param[in]     reward_address         A pointer to the reward address as a string. The address will receive the deposit refund.
+ * \param[in]     reward_address_size    The size of the reward address string in bytes.
+ * \param[in]     metadata_url           A pointer to a string containing the URL for additional proposal metadata.
+ * \param[in]     metadata_url_size      The size of the metadata URL string in bytes.
+ * \param[in]     metadata_hash_hex      A pointer to a hexadecimal string representing the hash of the metadata file.
+ * \param[in]     metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in]     gov_action_id          A CIP-0129 bech32 string representing the governance action ID that references the most recent enacted action of the same type.
+ * \param[in]     gov_action_id_size     The size (in bytes) of the `gov_action_id` string.
+ * \param[in]     constitution           A pointer to a \ref cardano_constitution_t object containing the new constitution's details.
+ *
+ * \note Any errors encountered during the addition of the new constitution proposal will be deferred until \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;      // Initialized sub transaction builder
+ * const char* reward_address = "stake1u9...";
+ * size_t reward_address_size = strlen(reward_address);
+ * const char* metadata_url = "https://example.com";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash_hex = "abc123...";
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex);
+ * const char* gov_action_id = "gov_action1...";
+ * size_t gov_action_id_size = strlen(gov_action_id);
+ * cardano_constitution_t* constitution = ...;          // Constitution details
+ *
+ * cardano_sub_tx_builder_propose_new_constitution_ex(
+ *   sub_tx_builder, reward_address, reward_address_size,
+ *   metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size,
+ *   gov_action_id, gov_action_id_size, constitution);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_new_constitution_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    reward_address_size,
+  const char*               metadata_url,
+  size_t                    metadata_url_size,
+  const char*               metadata_hash_hex,
+  size_t                    metadata_hash_hex_size,
+  const char*               gov_action_id,
+  size_t                    gov_action_id_size,
+  cardano_constitution_t*   constitution);
+
+/**
+ * \brief Proposes an informational governance action for the Cardano network.
+ *
+ * This function creates a governance action proposal to share information with the network. The governance action
+ * deposit of the proposal is value produced by the sub transaction, so it is part of the imbalance the batch has to
+ * cover.
+ *
+ * \param[in,out] builder        A pointer to an initialized \ref cardano_sub_tx_builder_t object used to build the sub transaction.
+ * \param[in]     reward_address A pointer to the reward address where the deposit refund will be sent if the proposal is enacted or discarded.
+ * \param[in]     anchor         A pointer to a \ref cardano_anchor_t object containing metadata such as URLs and hashes to link to external information.
+ *
+ * \note Any errors encountered during the addition of the informational proposal will be deferred until \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * cardano_reward_address_t* reward_address = ...;  // Reward address for deposit refund
+ * cardano_anchor_t* anchor = ...;                  // Anchor metadata for the proposal
+ *
+ * cardano_sub_tx_builder_propose_info(sub_tx_builder, reward_address, anchor);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_info(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor);
+
+/**
+ * \brief Proposes an informational governance action for the Cardano network using extended parameters.
+ *
+ * This function behaves like `cardano_sub_tx_builder_propose_info` but accepts the reward address and the anchor as
+ * strings.
+ *
+ * \param[in,out] builder                A pointer to an initialized \ref cardano_sub_tx_builder_t object used to build the sub transaction.
+ * \param[in]     reward_address         A pointer to the reward address in string format where the deposit refund will be sent if the proposal is enacted or discarded.
+ * \param[in]     reward_address_size    The size of the reward address string in bytes.
+ * \param[in]     metadata_url           A pointer to a string containing the URL for the proposal metadata.
+ * \param[in]     metadata_url_size      The size of the metadata URL string in bytes.
+ * \param[in]     metadata_hash_hex      A pointer to a string containing the hexadecimal hash of the metadata.
+ * \param[in]     metadata_hash_hex_size The size of the metadata hash string in bytes.
+ *
+ * \note Any errors encountered during the addition of the informational proposal will be deferred until \ref cardano_sub_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_tx_builder = ...;  // Initialized sub transaction builder
+ * const char* reward_address = "stake1u9...";
+ * size_t reward_address_size = strlen(reward_address);
+ * const char* metadata_url = "https://example.com/proposal-metadata";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash_hex = "abcdef123456...";
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex);
+ *
+ * cardano_sub_tx_builder_propose_info_ex(
+ *   sub_tx_builder, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_propose_info_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    reward_address_size,
+  const char*               metadata_url,
+  size_t                    metadata_url_size,
+  const char*               metadata_hash_hex,
+  size_t                    metadata_hash_hex_size);
+
+/**
+ * \brief Builds the sub transaction from the current state of the sub transaction builder.
+ *
+ * This function finalizes the sub transaction by aggregating all previously added inputs, outputs, minting
+ * operations and other data. The sub transaction is not balanced: it spends exactly the inputs and produces exactly
+ * the outputs that were added, and the difference is the intent a batcher matches against the rest of the batch.
+ * If any of the previous operations failed, this function reports the first error that was recorded.
+ *
+ * When the sub transaction carries redeemers, this function sets the index of every spend redeemer to the position of
+ * its input in the sorted inputs, resolves the deferred redeemers against the body of the sub transaction, evaluates
+ * the redeemers natively against the UTXOs added as inputs and reference inputs, writes the computed execution units
+ * into the redeemers and sets the script data hash of the sub transaction. The indices of the mint, withdrawal,
+ * certificate, vote, proposal and guard redeemers are local to the sub transaction body. Building fails with
+ * \ref CARDANO_ERROR_ELEMENT_NOT_FOUND when no Plutus script with the hash of a guard, of the payment credential of a
+ * spent input, of a minting policy, of a withdrawing account, of a certificate credential, of a voter or of the
+ * guardrails of a parameter change or treasury withdrawals proposal is added with
+ * `cardano_sub_tx_builder_add_script` or carried as a reference script by one of those UTXOs, with
+ * \ref CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE when that script is a PlutusV1, PlutusV2 or PlutusV3 script, with
+ * \ref CARDANO_ERROR_DECODING when a script cannot be deserialized, and with
+ * \ref CARDANO_ERROR_SCRIPT_EVALUATION_FAILURE when a script fails phase-2 validation. The message of the failure is
+ * available through \ref cardano_sub_tx_builder_get_last_error.
+ *
+ * An input locked by a datum hash whose datum was not provided to `cardano_sub_tx_builder_add_input` or to
+ * `cardano_sub_tx_builder_add_input_with_deferred_redeemer` makes this function fail with
+ * \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ *
+ * A deferred redeemer callback that fails makes this function fail with the error of the callback, and one that
+ * produces no payload makes it fail with \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Every script purpose of the sub transaction whose script resolves to a Plutus script, among the scripts added with
+ * `cardano_sub_tx_builder_add_script` and the reference scripts of the UTXOs added as inputs and reference inputs,
+ * must have a redeemer: spending an input locked by the script, minting under its policy, withdrawing from a reward
+ * account it controls, carrying a certificate it must authorize, voting with it as the voter, carrying a proposal it
+ * guards as the guardrails script or listing it among the guards. A purpose without its redeemer makes this function
+ * fail with \ref CARDANO_ERROR_MISSING_REDEEMER before any script is evaluated, and the last error names the purpose,
+ * its redeemer index and the script hash. A purpose whose script is a native script needs no redeemer, and a purpose
+ * whose script is not provided is not reported.
+ *
+ * \param[in] builder A pointer to the \ref cardano_sub_tx_builder_t instance that manages the sub transaction details.
+ * \param[out] sub_transaction A pointer to a \ref cardano_sub_transaction_t pointer where the created sub transaction
+ *                             will be stored upon success.
+ *
+ * \returns \ref CARDANO_SUCCESS if the sub transaction was successfully built, or an appropriate error code if issues were detected.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_transaction_t* sub_transaction = NULL;
+ * cardano_sub_tx_builder_t* sub_tx_builder   = ...; // Initialized sub transaction builder
+ *
+ * cardano_sub_tx_builder_add_input(sub_tx_builder, utxo, NULL, NULL);           // Offer the value of a UTXO
+ * cardano_sub_tx_builder_send_lovelace_ex(sub_tx_builder, "add...", size, 50000); // Ask for an output in return
+ * cardano_sub_tx_builder_set_invalid_after(sub_tx_builder, 1000);               // Set the sub transaction validity
+ *
+ * cardano_error_t result = cardano_sub_tx_builder_build(sub_tx_builder, &sub_transaction);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   const char* error_msg = cardano_sub_tx_builder_get_last_error(sub_tx_builder);
+ *   printf("Failed to build sub transaction: %s\n", error_msg);
+ * }
+ * else
+ * {
+ *   // Sub transaction successfully built; sign it and hand it to a batcher
+ *   // ...
+ *   cardano_sub_transaction_unref(&sub_transaction);
+ * }
+ *
+ * cardano_sub_tx_builder_unref(&sub_tx_builder);
+ * \endcode
+ *
+ * \note All errors related to missing or invalid data will be reported upon calling this function. A builder can
+ *       build a single sub transaction, further calls report \ref CARDANO_ERROR_ILLEGAL_STATE.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_sub_tx_builder_build(
+  cardano_sub_tx_builder_t*   builder,
+  cardano_sub_transaction_t** sub_transaction);
+
+/**
+ * \brief Decrements the reference count of a cardano_sub_tx_builder_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_sub_tx_builder_t object
+ * by decreasing its reference count. When the reference count reaches zero, the sub_transaction_builder is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] sub_transaction_builder A pointer to the pointer of the sub_transaction_builder object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_sub_tx_builder_t* sub_transaction_builder = cardano_sub_tx_builder_new(params, &slot_config);
+ *
+ * // Perform operations with the sub_transaction_builder...
+ *
+ * cardano_sub_tx_builder_unref(&sub_transaction_builder);
+ * // At this point, sub_transaction_builder is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_sub_tx_builder_unref, the pointer to the \ref cardano_sub_tx_builder_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_unref(cardano_sub_tx_builder_t** sub_transaction_builder);
+
+/**
+ * \brief Increases the reference count of the cardano_sub_tx_builder_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_sub_tx_builder_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_sub_tx_builder_unref.
+ *
+ * \param sub_transaction_builder A pointer to the cardano_sub_tx_builder_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming sub_transaction_builder is a previously created sub_transaction_builder object
+ *
+ * cardano_sub_tx_builder_ref(sub_transaction_builder);
+ *
+ * // Now sub_transaction_builder can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_sub_tx_builder_ref there is a corresponding
+ * call to \ref cardano_sub_tx_builder_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_ref(cardano_sub_tx_builder_t* sub_transaction_builder);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_sub_tx_builder_t object.
+ *
+ * This function returns the number of active references to an cardano_sub_tx_builder_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_sub_tx_builder_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param sub_transaction_builder A pointer to the cardano_sub_tx_builder_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_sub_tx_builder_t object. If the object
+ * is properly managed (i.e., every \ref cardano_sub_tx_builder_ref call is matched with a
+ * \ref cardano_sub_tx_builder_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming sub_transaction_builder is a previously created sub_transaction_builder object
+ *
+ * size_t ref_count = cardano_sub_tx_builder_refcount(sub_transaction_builder);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_sub_tx_builder_refcount(const cardano_sub_tx_builder_t* sub_transaction_builder);
+
+/**
+ * \brief Sets the last error message for a given cardano_sub_tx_builder_t object.
+ *
+ * Records an error message in the sub_transaction_builder's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] sub_transaction_builder A pointer to the \ref cardano_sub_tx_builder_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the sub_transaction_builder's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_sub_tx_builder_set_last_error(
+  cardano_sub_tx_builder_t* sub_transaction_builder,
+  const char*               message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific sub_transaction_builder.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_sub_tx_builder_set_last_error for the given
+ * sub_transaction_builder. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] sub_transaction_builder A pointer to the \ref cardano_sub_tx_builder_t instance whose last error
+ *                   message is to be retrieved. If the sub_transaction_builder is NULL, the function
+ *                   returns a generic error message indicating the null sub_transaction_builder.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified sub_transaction_builder. If the sub_transaction_builder is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_sub_tx_builder_set_last_error for the same sub_transaction_builder, or until
+ *       the sub_transaction_builder is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_sub_tx_builder_get_last_error(
+  const cardano_sub_tx_builder_t* sub_transaction_builder);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SUB_TRANSACTION_BUILDER_H
diff --git a/vendor/include/cardano/transaction_builder/transaction_builder.h b/vendor/include/cardano/transaction_builder/transaction_builder.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/transaction_builder/transaction_builder.h
@@ -0,0 +1,3172 @@
+/**
+ * \file transaction_builder.h
+ *
+ * \author angel.castillo
+ * \date   Nov 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BUILDER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BUILDER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/credential.h>
+#include <cardano/common/drep.h>
+#include <cardano/error.h>
+#include <cardano/proposal_procedures/constitution.h>
+#include <cardano/proposal_procedures/proposal_procedure.h>
+#include <cardano/providers/provider.h>
+#include <cardano/slot_config.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction_body/account_balance_interval.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+#include <cardano/transaction_builder/evaluation/tx_evaluator.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief High-Level Transaction Builder for Cardano Blockchain.
+ *
+ * The `cardano_tx_builder_t` type serves as a comprehensive interface for constructing
+ * Cardano transactions programmatically encapsulating the complexities of transaction assembly,
+ * balancing, and validation.
+ *
+ * **Key Features:**
+ * - **Modular Design**: Incrementally add inputs, outputs, certificates, metadata, and scripts,
+ *   enabling flexible transaction construction.
+ * - **Automatic Fee Calculation and Balancing**: Automatically calculates fees and ensures the
+ *   transaction is balanced according to Cardano's protocol parameters.
+ * - **Support for Advanced Constructs**: Facilitates multi-asset transactions, Plutus smart
+ *   contracts, token minting/burning, and governance actions.
+ * - **Extensibility**: Allows for custom coin selection strategies.
+ */
+typedef struct cardano_tx_builder_t cardano_tx_builder_t;
+
+/**
+ * \brief Creates a new transaction builder instance.
+ *
+ * This function initializes a new transaction builder (`cardano_tx_builder_t`)
+ * using the supplied protocol parameters and slot configuration. The builder
+ * enables incremental, rule-safe construction of a transaction, including input
+ * selection, output balancing, fee calculation, and script evaluation - based on
+ * the specified protocol settings.
+ *
+ * The protocol parameters determine limits and constants such as:
+ * - Minimum fees (`minFeeA`, `minFeeB`)
+ * - Execution unit prices and limits
+ * - Maximum transaction size
+ * - UTxO cost per byte
+ * - Cost models for script evaluation
+ *
+ * The slot configuration provides time/slot conversion rules needed for
+ * unix time to slot conversions.
+ *
+ * \param[in] params
+ *   A pointer to a \ref cardano_protocol_parameters_t structure containing the
+ *   protocol parameters used to configure the transaction builder.
+ *   Must not be `NULL`.
+ *
+ * \param[in] slot_config
+ *   A pointer to the \ref cardano_slot_config_t structure that defines the
+ *   slot/time translation rules for the current network. Must not be `NULL`. Constants for every public network can be found at `cardano/slot_config.h`:
+ *   \ref CARDANO_MAINNET_SLOT_CONFIG
+ *   \ref CARDANO_PREVIEW_SLOT_CONFIG
+ *   \ref CARDANO_PREPROD_SLOT_CONFIG
+ *
+ * \returns
+ *   A pointer to a newly created \ref cardano_tx_builder_t instance configured
+ *   with the given protocol parameters and slot configuration, or `NULL` if
+ *   memory allocation fails or if any argument is invalid.
+ *
+ * \par Usage Example:
+ * \code{.c}
+ * cardano_protocol_parameters_t* protocol_params = ...;            // Initialized protocol parameters
+ * cardano_slot_config_t slot_config = CARDANO_PREVIEW_SLOT_CONFIG; // Constants for slot config for every public network can be found at cardano/slot_config.h
+ *
+ * cardano_tx_builder_t* tx_builder =
+ *     cardano_tx_builder_new(protocol_params, &slot_config);
+ *
+ * if (tx_builder != NULL)
+ * {
+ *   // Proceed with constructing the transaction
+ * }
+ *
+ * cardano_tx_builder_unref(&tx_builder);
+ * \endcode
+ *
+ * \note
+ * The caller is responsible for releasing the `cardano_tx_builder_t` instance
+ * using \ref cardano_tx_builder_unref once it is no longer needed.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_tx_builder_t* cardano_tx_builder_new(
+  cardano_protocol_parameters_t* params,
+  const cardano_slot_config_t*   slot_config);
+
+/**
+ * \brief Sets the coin selector for the transaction builder.
+ *
+ * This function assigns a specific coin selection strategy to the transaction builder. The coin
+ * selector determines how UTXOs are selected to cover the transaction's required value. Any errors
+ * related to coin selection configuration or validation are deferred and will be reported only when
+ * \ref cardano_tx_builder_build is called.
+ *
+ * If this function is not called, the default coin selector (the Round-Robin Random-Improve selector) will be used.
+ *
+ * \param[in] builder      A pointer to the \ref cardano_tx_builder_t instance where the coin selector
+ *                         is to be set.
+ * \param[in] coin_selector A pointer to the \ref cardano_coin_selector_t structure that specifies the
+ *                          coin selection strategy.
+ *
+ * \note Errors arising from coin selector configuration or compatibility will be deferred until the
+ *       transaction is finalized with \ref cardano_tx_builder_build. This deferred error handling
+ *       allows for smoother configuration and incremental transaction building.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_coin_selector_t* coin_selector = ...;  // Initialized coin selector
+ * cardano_tx_builder_set_coin_selector(tx_builder, coin_selector);
+ *
+ * ...
+ *
+ * cardano_error_t result = cardano_tx_builder_build(tx_builder);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   const char* error_msg = cardano_tx_builder_get_last_error(tx_builder);
+ *   printf("Failed to build transaction: %s\n", error_msg);
+ * }
+ *
+ *  cardano_tx_builder_unref(&tx_builder);
+ * \endcode
+ *
+ * \sa cardano_tx_builder_build
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_coin_selector(
+  cardano_tx_builder_t*    builder,
+  cardano_coin_selector_t* coin_selector);
+
+/**
+ * \brief Sets the transaction evaluator for a transaction builder.
+ *
+ * This function assigns a transaction evaluator to the specified transaction builder. The evaluator will be used
+ * to compute the execution units required for evaluating transactions. It enables users to incorporate custom
+ * evaluation logic during transaction creation.
+ *
+ * If this function is not called, the default evaluator (provider tx evaluator) will be used.
+ *
+ * Note: This function defers error reporting until the transaction is built using \ref cardano_tx_builder_build.
+ * If an issue arises during evaluator setup, it will be reported at that stage.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance to which the evaluator will be set.
+ * \param[in] tx_evaluator A pointer to the \ref cardano_tx_evaluator_t instance that will serve as the transaction evaluator.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_tx_evaluator_t* tx_evaluator = ...;  // Initialized transaction evaluator
+ * cardano_tx_builder_set_tx_evaluator(tx_builder, tx_evaluator);
+ *
+ * ...
+ *
+ * cardano_error_t result = cardano_tx_builder_build(tx_builder);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   const char* error_msg = cardano_tx_builder_get_last_error(tx_builder);
+ *   printf("Failed to build transaction: %s\n", error_msg);
+ * }
+ *
+ * cardano_tx_builder_unref(&tx_builder);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_tx_evaluator(
+  cardano_tx_builder_t*   builder,
+  cardano_tx_evaluator_t* tx_evaluator);
+
+/**
+ * \brief Sets the network ID for the transaction builder.
+ *
+ * This function configures the transaction builder (`cardano_tx_builder_t`) with a specific network ID.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance for which the network ID is being set.
+ * \param[in] network_id The network ID to assign to the transaction builder. This ID specifies the target network
+ *                       (e.g., mainnet, testnet) for which the transaction is intended.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialize or obtain a transaction builder
+ * cardano_network_id_t network_id = CARDANO_MAINNET;  // Set the network ID to mainnet
+ * cardano_tx_builder_set_network_id(tx_builder, network_id);
+ * \endcode
+ *
+ * \note This function only sets the network ID within the builder and does not perform any validation until
+ *       \ref cardano_tx_builder_build is called, which will report any related errors at that time.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_network_id(cardano_tx_builder_t* builder, cardano_network_id_t network_id);
+
+/**
+ * \brief Sets the change address for the transaction builder.
+ *
+ * This function specifies the address to which any remaining balance (after covering transaction outputs
+ * and fees) will be sent. The address is stored within the transaction builder (`cardano_tx_builder_t`)
+ * and applied during the final transaction construction.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance for which the change address is being set.
+ * \param[in] change_address A pointer to the \ref cardano_address_t object representing the change address.
+ *                           Ownership of this address is not transferred; it must remain valid for the duration
+ *                           of the transaction builder's usage.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_address_t* change_addr = ...;    // The change address to be set
+ * cardano_tx_builder_set_change_address(tx_builder, change_addr);
+ * \endcode
+ *
+ * \note This function only assigns the change address to the builder; any validation related to the address
+ *       will be deferred until \ref cardano_tx_builder_build is called, at which point related errors may be reported.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_change_address(cardano_tx_builder_t* builder, cardano_address_t* change_address);
+
+/**
+ * \brief Sets the change address for the transaction builder using a raw address string.
+ *
+ * This function allows specifying the change address directly as a raw string.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance for which the change address is being set.
+ * \param[in] change_address A pointer to a character array containing the raw change address in encoded form.
+ * \param[in] address_size The size of the change address array.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * const char* raw_change_address = "addr1q...";  // Raw encoded change address
+ * size_t address_size = strlen(raw_change_address);
+ * cardano_tx_builder_set_change_address_ex(tx_builder, raw_change_address, address_size);
+ * \endcode
+ *
+ * \note This function only assigns the change address to the builder. Any errors related to the validity of
+ *       the address are deferred until \ref cardano_tx_builder_build is called, where issues may be reported.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_change_address_ex(cardano_tx_builder_t* builder, const char* change_address, size_t address_size);
+
+/**
+ * \brief Sets the collateral change address for the transaction builder.
+ *
+ * This function assigns a collateral change address to the transaction builder (`cardano_tx_builder_t`),
+ * specifying where any remaining balance from collateral inputs will be sent.
+ * Collateral is used in transactions that contain scripts, acting as a safeguard in case script validation fails.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance for which the collateral change address is being set.
+ * \param[in] collateral_change_address A pointer to the \ref cardano_address_t object representing the collateral change address.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_address_t* collateral_address = ...;  // Prepared collateral change address
+ * cardano_tx_builder_set_collateral_change_address(tx_builder, collateral_address);
+ * \endcode
+ *
+ * \note This function only sets the collateral change address; any issues or validation errors with the address are deferred until
+ *       \ref cardano_tx_builder_build is called, at which point an error may be reported if necessary.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_collateral_change_address(cardano_tx_builder_t* builder, cardano_address_t* collateral_change_address);
+
+/**
+ * \brief Sets the collateral change address for the transaction builder using a raw address string.
+ *
+ * This function allows setting the collateral change address as a raw byte string in the transaction builder
+ * (`cardano_tx_builder_t`). The collateral change address specifies where any remaining balance from collateral inputs
+ * will be sent, used as a safeguard in script-validated transactions.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance for which the collateral change address is being set.
+ * \param[in] collateral_change_address A constant pointer to the raw byte string representing the collateral change address.
+ * \param[in] address_size The size (in bytes) of the `collateral_change_address` string.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * const char* collateral_address_str = "...";  // Raw collateral change address as a string
+ * size_t address_len = strlen(collateral_address_str);
+ * cardano_tx_builder_set_collateral_change_address_ex(tx_builder, collateral_address_str, address_len);
+ * \endcode
+ *
+ * \note This function only assigns the provided address string to the builder; any validation errors
+ *       related to the address will be deferred until \ref cardano_tx_builder_build is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_collateral_change_address_ex(cardano_tx_builder_t* builder, const char* collateral_change_address, size_t address_size);
+
+/**
+ * \brief Sets the minimum transaction fee for the transaction builder.
+ *
+ * This function allows setting a minimum transaction fee for a transaction being constructed with the
+ * specified transaction builder (`cardano_tx_builder_t`).
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance where the minimum fee will be set.
+ * \param[in] minimum_fee The minimum fee amount, specified in lovelace.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * uint64_t min_fee = 1000000;  // Minimum fee in lovelace
+ * cardano_tx_builder_set_minimum_fee(tx_builder, min_fee);
+ * \endcode
+ *
+ * \note Setting this fee does not validate its sufficiency for the transaction; validation will occur when
+ *       \ref cardano_tx_builder_build is called, where an error will be reported if the fee is inadequate.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_minimum_fee(cardano_tx_builder_t* builder, uint64_t minimum_fee);
+
+/**
+ * \brief Sets the donation amount for the transaction builder.
+ *
+ * This function sets the donation amount. Donations are a Conway-era
+ * feature that contributes a specific amount to the treasury.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance where the donation will be set.
+ * \param[in] donation The donation amount, specified in lovelace.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...; // Initialized transaction builder
+ * uint64_t donation = 1000000;         // 1 ADA donation in lovelace
+ *
+ * cardano_tx_builder_set_donation(tx_builder, donation);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_donation(cardano_tx_builder_t* builder, uint64_t donation);
+
+/**
+ * \brief Sets the current treasury value asserted by the transaction, in lovelace.
+ *
+ * Zero is retained as an explicit value. Errors are deferred until build.
+ *
+ * \param[in,out] builder The transaction builder. NULL is a no-op.
+ * \param[in] current_treasury_value The current treasury amount, in lovelace.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_current_treasury_value(
+  cardano_tx_builder_t* builder,
+  uint64_t              current_treasury_value);
+
+/**
+ * \brief Sets the available UTXOs for coin selection in transaction balancing.
+ *
+ * This function assigns a list of available UTXOs (`cardano_utxo_list_t`) to the transaction builder.
+ * These UTXOs will be utilized during the coin selection process to meet the transaction's balance requirements.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance that will use the specified UTXOs.
+ * \param[in] utxos A pointer to the \ref cardano_utxo_list_t containing the UTXOs available for selection.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_utxo_list_t* utxos = ...;        // List of available UTXOs
+ * cardano_tx_builder_set_utxos(tx_builder, utxos);
+ * \endcode
+ *
+ * \note This function only sets the UTXOs for potential selection; the actual coin selection will occur
+ *       when \ref cardano_tx_builder_build is called, allowing the transaction builder to balance the transaction.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_utxos(cardano_tx_builder_t* builder, cardano_utxo_list_t* utxos);
+
+/**
+ * \brief Sets the UTXO list for collateral when scripts are included in the transaction.
+ *
+ * This function assigns a specific list of UTXOs (`cardano_utxo_list_t`) for use as collateral if the transaction
+ * involves script execution. The builder asks for collateral when the transaction or any of the sub transactions it
+ * carries has redeemers. In that case building fails with
+ * \ref CARDANO_ERROR_POINTER_IS_NULL if this list is not set, and with \ref CARDANO_ERROR_BALANCE_INSUFFICIENT if it
+ * is empty.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance that will utilize the specified UTXOs for collateral.
+ * \param[in] utxos A pointer to the \ref cardano_utxo_list_t containing the UTXOs designated for collateral.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_utxo_list_t* collateral_utxos = ...;  // UTXOs designated for collateral
+ * cardano_tx_builder_set_collateral_utxos(tx_builder, collateral_utxos);
+ * \endcode
+ *
+ * \note Only necessary if the transaction or one of its sub transactions has redeemers. The collateral
+ *       change address must also be set with \ref cardano_tx_builder_set_collateral_change_address in that case.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_collateral_utxos(cardano_tx_builder_t* builder, cardano_utxo_list_t* utxos);
+
+/**
+ * \brief Sets the expiration slot for a transaction, beyond which it is no longer valid.
+ *
+ * This function specifies the slot number after which the transaction will be considered invalid. Setting this
+ * value helps enforce transaction timeouts, allowing the transaction to expire if not included in a block before
+ * the specified slot.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance being configured.
+ * \param[in] slot The slot number after which the transaction will be marked as invalid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * uint64_t expiration_slot = 5000000;  // Slot after which the transaction becomes invalid
+ * cardano_tx_builder_set_invalid_after(tx_builder, expiration_slot);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_invalid_after(cardano_tx_builder_t* builder, uint64_t slot);
+
+/**
+ * \brief Sets the expiration time for a transaction based on Unix time (in seconds).
+ *
+ * This function configures the transaction's validity based on a specified Unix timestamp, marking the transaction
+ * as invalid if it is not included in a block before this time. The Unix timestamp is expressed in seconds since
+ * the epoch (January 1, 1970, UTC). This setting is useful for transactions that need to expire at a specific
+ * real-world time.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance being configured.
+ * \param[in] unix_time The Unix timestamp (in seconds) at which the transaction expires.
+ *
+ * Usage Example:
+ * \code{.c}
+ * #include <time.h>
+ *
+ * cardano_tx_builder_t* tx_builder = ...;   // Initialized transaction builder
+ * time_t current_time = time(NULL);         // Get current Unix time in seconds
+ * uint64_t expiration_time = current_time + 2 * 60 * 60;  // Set expiration to 2 hours from now
+ *
+ * cardano_tx_builder_set_invalid_after_ex(tx_builder, expiration_time);
+ * \endcode
+ *
+ * \note If any errors occur while setting the expiration, they will not be immediately reported. Instead, they will
+ *       be deferred and can be checked when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_invalid_after_ex(cardano_tx_builder_t* builder, uint64_t unix_time);
+
+/**
+ * \brief Sets the minimum valid slot for a transaction.
+ *
+ * This function configures the earliest slot at which the transaction will be considered valid. Transactions
+ * created with this setting will not be valid for inclusion in a block until the specified slot.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance being configured.
+ * \param[in] slot The minimum slot number at which the transaction is valid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;   // Initialized transaction builder
+ * uint64_t min_valid_slot = 123456;         // Example slot number
+ * cardano_tx_builder_set_invalid_before(tx_builder, min_valid_slot);
+ * \endcode
+ *
+ * \note Any errors arising from setting this parameter will be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_invalid_before(cardano_tx_builder_t* builder, uint64_t slot);
+
+/**
+ * \brief Sets the minimum valid time (Unix timestamp) for a transaction.
+ *
+ * This function configures the earliest time, in Unix timestamp format (seconds since Epoch),
+ * at which the transaction will be considered valid. Transactions created with this setting will
+ * not be valid for inclusion in a block until the specified timestamp.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance being configured.
+ * \param[in] unix_time The minimum Unix timestamp (in seconds) at which the transaction is valid.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;   // Initialized transaction builder
+ * uint64_t min_valid_time = 7200 + time(NULL);  // Set to 2 hours from now
+ * cardano_tx_builder_set_invalid_before_ex(tx_builder, min_valid_time);
+ * \endcode
+ *
+ * \note Any errors resulting from setting this parameter will be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_invalid_before_ex(cardano_tx_builder_t* builder, uint64_t unix_time);
+
+/**
+ * \brief Adds a reference input to the transaction.
+ *
+ * This function appends a specified UTXO as a reference input to the transaction being built.
+ * Reference inputs are utilized by Plutus scripts to access additional data without consuming the UTXO in the transaction.
+ * A reference input set cannot hold the same input twice, so a UTXO whose input (transaction id and index) was already
+ * added as a reference input is rejected.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance in which to add the reference input.
+ * \param[in] utxo A pointer to the \ref cardano_utxo_t structure representing the UTXO to be used as a reference input.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_utxo_t* reference_utxo = ...;    // UTXO to add as a reference input
+ * cardano_tx_builder_add_reference_input(tx_builder, reference_utxo);
+ * \endcode
+ *
+ * \note Any errors resulting from adding this input will be reported when `cardano_tx_builder_build` is called. A
+ *       reference input added twice makes `cardano_tx_builder_build` return \ref CARDANO_ERROR_DUPLICATED_KEY.
+ *
+ * \note Under protocol versions 9 and 10 the ledger rejects a transaction that spends and references the same UTXO.
+ *       When the major protocol version of the protocol parameters of the builder is 9 or 10, coin selection never
+ *       picks a UTXO added as a reference input, and a UTXO added both with `cardano_tx_builder_add_input` and as a
+ *       reference input makes `cardano_tx_builder_build` return \ref CARDANO_ERROR_DUPLICATED_KEY. Other protocol
+ *       versions allow the overlap, so coin selection may spend a UTXO that is also referenced.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_reference_input(cardano_tx_builder_t* builder, cardano_utxo_t* utxo);
+
+/**
+ * \brief Sends a specified amount of lovelace to a given address.
+ *
+ * This function adds a transaction output to the builder, targeting a specific address and setting the amount of lovelace to be sent.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance to which the output will be added.
+ * \param[in] address A pointer to the \ref cardano_address_t structure representing the recipient address.
+ * \param[in] amount The amount of lovelace to send to the specified address.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;            // Initialized transaction builder
+ * cardano_address_t* recipient_address = ...;         // Recipient address
+ * uint64_t lovelace_amount = 1000000;                // Amount of lovelace to send (e.g., 1 ADA)
+ *
+ * cardano_tx_builder_send_lovelace(tx_builder, recipient_address, lovelace_amount);
+ * \endcode
+ *
+ * \note Any errors related to sending lovelace, such as balance requirements or transaction limits, will be deferred and reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_send_lovelace(
+  cardano_tx_builder_t* builder,
+  cardano_address_t*    address,
+  uint64_t              amount);
+
+/**
+ * \brief Sends a specified amount of lovelace to a given address in string format.
+ *
+ * This function adds a transaction output to the builder, targeting a specific address in string format and setting the amount of lovelace to be sent.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance to which the output will be added.
+ * \param[in] address A pointer to a character array containing the recipient address in string format.
+ * \param[in] address_size The size of the address string.
+ * \param[in] amount The amount of lovelace to send to the specified address.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;         // Initialized transaction builder
+ * const char* recipient_address = "addr1...";      // Recipient address in string format
+ * size_t address_size = strlen(recipient_address); // Size of the address string
+ * uint64_t lovelace_amount = 1000000;             // Amount of lovelace to send (e.g., 1 ADA)
+ *
+ * cardano_tx_builder_send_lovelace_ex(tx_builder, recipient_address, address_size, lovelace_amount);
+ * \endcode
+ *
+ * \note Errors, such as insufficient balance or invalid address, will be deferred and reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_send_lovelace_ex(
+  cardano_tx_builder_t* builder,
+  const char*           address,
+  size_t                address_size,
+  uint64_t              amount);
+
+/**
+ * \brief Sends a specified value (which may include ADA and other assets) to a given address.
+ *
+ * This function adds a transaction output to the builder, specifying an address and a complex value that can include multiple assets in addition to ADA.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance to which the output will be added.
+ * \param[in] address A pointer to a \ref cardano_address_t object representing the recipient address.
+ * \param[in] value A pointer to a \ref cardano_value_t object containing the ADA and any additional assets to send.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_address_t* recipient_address = ...;  // Address to send to
+ * cardano_value_t* transfer_value = ...;  // Value to transfer (e.g., ADA and assets)
+ *
+ * cardano_tx_builder_send_value(tx_builder, recipient_address, transfer_value);
+ * \endcode
+ *
+ * \note Errors, such as insufficient balance or invalid assets, will be deferred and reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_send_value(
+  cardano_tx_builder_t* builder,
+  cardano_address_t*    address,
+  cardano_value_t*      value);
+
+/**
+ * \brief Sends a specified value (which may include ADA and other assets) to a given address
+ * provided as raw string.
+ *
+ * This function adds a transaction output to the builder, specifying an address in
+ * character array format along with a complex value that may include multiple assets.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance to which the output will be added.
+ * \param[in] address A character array containing the recipient's address in bech32 or hex format.
+ * \param[in] address_size The length of the address character array.
+ * \param[in] value A pointer to a \ref cardano_value_t object containing the ADA and any additional assets to send.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * const char* recipient_address = "addr1...";  // Bech32 address
+ * size_t address_size = strlen(recipient_address);
+ * cardano_value_t* transfer_value = ...;  // Value to transfer (e.g., ADA and assets)
+ *
+ * cardano_tx_builder_send_value_ex(tx_builder, recipient_address, address_size, transfer_value);
+ * \endcode
+ *
+ * \note Errors, such as insufficient balance or invalid assets, will be deferred and reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_send_value_ex(
+  cardano_tx_builder_t* builder,
+  const char*           address,
+  size_t                address_size,
+  cardano_value_t*      value);
+
+/**
+ * \brief Locks a specified amount of lovelace at a script address.
+ *
+ * This function adds a transaction output to the builder that sends lovelace to a script address.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance to which the locked output will be added.
+ * \param[in] script_address A pointer to the \ref cardano_address_t representing the script address where the lovelace will be locked.
+ * \param[in] amount The amount of lovelace to be locked at the script address.
+ * \param[in] datum A pointer to the \ref cardano_datum_t object containing the data to lock with the transaction.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;         // Initialized transaction builder
+ * cardano_address_t* script_addr = ...;           // Script address
+ * uint64_t lovelace_amount = 5000000;             // Amount of lovelace to lock
+ * cardano_datum_t* datum = ...;                   // Datum associated with the script
+ *
+ * cardano_tx_builder_lock_lovelace(tx_builder, script_addr, lovelace_amount, datum);
+ * \endcode
+ *
+ * \note Errors such as an invalid amount or address will be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_lock_lovelace(
+  cardano_tx_builder_t* builder,
+  cardano_address_t*    script_address,
+  uint64_t              amount,
+  cardano_datum_t*      datum);
+
+/**
+ * \brief Locks a specified amount of lovelace at a script address using an address in raw byte format.
+ *
+ * This function adds a transaction output to the builder, sending lovelace to a script address.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance where the locked output will be added.
+ * \param[in] script_address A pointer to a raw byte array containing the script address where the lovelace will be locked.
+ * \param[in] script_address_size The size, in bytes, of the script address.
+ * \param[in] amount The amount of lovelace to be locked at the specified script address.
+ * \param[in] datum A pointer to the \ref cardano_datum_t object containing the datum for the script output.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;           // Initialized transaction builder
+ * const char* script_addr_bytes = ...;              // Raw bytes of script address
+ * size_t script_addr_size = ...;                    // Size of the address in bytes
+ * uint64_t lovelace_amount = 5000000;               // Amount of lovelace to lock
+ * cardano_datum_t* datum = ...;                     // Datum associated with the script
+ *
+ * cardano_tx_builder_lock_lovelace_ex(tx_builder, script_addr_bytes, script_addr_size, lovelace_amount, datum);
+ * \endcode
+ *
+ * \note Errors such as an invalid amount or address will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_lock_lovelace_ex(
+  cardano_tx_builder_t* builder,
+  const char*           script_address,
+  size_t                script_address_size,
+  uint64_t              amount,
+  cardano_datum_t*      datum);
+
+/**
+ * \brief Locks a specified value (including ADA and multi-asset tokens) at a script address.
+ *
+ * This function adds a transaction output to the builder, sending a specified value to a script address.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance where the locked output will be added.
+ * \param[in] script_address A pointer to the \ref cardano_address_t object representing the script address where the value will be locked.
+ * \param[in] value A pointer to the \ref cardano_value_t object representing the amount and type of value (ADA or tokens) to be locked at the script address.
+ * \param[in] datum A pointer to the \ref cardano_datum_t object containing the datum for the script output.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;       // Initialized transaction builder
+ * cardano_address_t* script_addr = ...;         // Script address to lock value at
+ * cardano_value_t* value = ...;                 // Value including ADA and/or tokens
+ * cardano_datum_t* datum = ...;                 // Datum associated with the script
+ *
+ * cardano_tx_builder_lock_value(tx_builder, script_addr, value, datum);
+ * \endcode
+ *
+ * \note Errors such as invalid address or value will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_lock_value(
+  cardano_tx_builder_t* builder,
+  cardano_address_t*    script_address,
+  cardano_value_t*      value,
+  cardano_datum_t*      datum);
+
+/**
+ * \brief Locks a specified value (including ADA and multi-asset tokens) at a script address using a raw address string.
+ *
+ * This function adds a transaction output to the builder, sending a specified value to a script address represented by a raw address string.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance where the locked output will be added.
+ * \param[in] script_address A pointer to a character array containing the raw script address string where the value will be locked.
+ * \param[in] script_address_size The size of the `script_address` string in bytes.
+ * \param[in] value A pointer to the \ref cardano_value_t object representing the amount and type of value (ADA or tokens) to be locked at the script address.
+ * \param[in] datum A pointer to the \ref cardano_datum_t object containing the datum for the script output.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;       // Initialized transaction builder
+ * const char* script_addr_str = "addr_test1..."; // Raw address string for the script address
+ * size_t script_addr_size = strlen(script_addr_str);
+ * cardano_value_t* value = ...;                 // Value including ADA and/or tokens
+ * cardano_datum_t* datum = ...;                 // Datum associated with the script (optional)
+ *
+ * cardano_tx_builder_lock_value_ex(tx_builder, script_addr_str, script_addr_size, value, datum);
+ * \endcode
+ *
+ * \note Errors such as invalid address or value will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_lock_value_ex(
+  cardano_tx_builder_t* builder,
+  const char*           script_address,
+  size_t                script_address_size,
+  cardano_value_t*      value,
+  cardano_datum_t*      datum);
+
+/**
+ * \brief Adds an input to the transaction.
+ *
+ * This function appends a specified UTXO as an input to the transaction being built. Optionally,
+ * it allows attaching a redeemer and datum if the input is associated with a Plutus script. An input that is
+ * already spent by a sub transaction added with `cardano_tx_builder_add_sub_transaction` is rejected. An input set
+ * cannot hold the same input twice, so a UTXO whose input (transaction id and index) was already added as an input,
+ * either through this function or through `cardano_tx_builder_add_input_with_deferred_redeemer`, is rejected as well.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance in which to add the input.
+ * \param[in] utxo A pointer to the \ref cardano_utxo_t structure representing the UTXO to be used as an input.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t structure representing the redeemer for the Plutus script (optional; can be NULL).
+ * \param[in] datum A pointer to the \ref cardano_plutus_data_t structure representing the datum for the Plutus script (optional; can be NULL).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_utxo_t* input_utxo = ...;        // UTXO to add as an input
+ * cardano_plutus_data_t* redeemer = ...;   // Optional redeemer for the input
+ * cardano_plutus_data_t* datum = ...;      // Optional datum for the input
+ *
+ * cardano_tx_builder_add_input(tx_builder, input_utxo, redeemer, datum);
+ * \endcode
+ *
+ * \note Any errors resulting from adding this input will be deferred and reported when `cardano_tx_builder_build` is called.
+ *       An input that is already spent by a sub transaction or that was already added as an input makes
+ *       `cardano_tx_builder_build` return \ref CARDANO_ERROR_DUPLICATED_KEY.
+ *
+ * \note Under protocol versions 9 and 10 a UTXO that is also added as a reference input makes `cardano_tx_builder_build` return \ref CARDANO_ERROR_DUPLICATED_KEY.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_input(
+  cardano_tx_builder_t*  builder,
+  cardano_utxo_t*        utxo,
+  cardano_plutus_data_t* redeemer,
+  cardano_plutus_data_t* datum);
+
+/**
+ * \brief Adds a script input whose redeemer payload is produced by a deferred callback.
+ *
+ * Behaves like \ref cardano_tx_builder_add_input, but instead of a literal redeemer the caller
+ * provides a callback that builds the payload from the balanced draft transaction, once the
+ * final canonical input order, the change outputs and the fee are known. This is the mechanism
+ * for redeemers that carry indices of elements of the script context (see
+ * \ref cardano_deferred_redeemer_fn_t and the \ref cardano_transaction_find_input_index family).
+ *
+ * The callback is invoked on every balancing iteration and must be a pure function of its
+ * arguments. The caller must keep `user_context` valid until the transaction is built.
+ *
+ * \param[in] builder      The transaction builder.
+ * \param[in] utxo         The UTXO to spend.
+ * \param[in] callback     The callback producing the redeemer payload.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ * \param[in] datum        The datum of the UTXO, or NULL when the output holds an inline datum.
+ *
+ * \note Under protocol versions 9 and 10 a UTXO that is also added as a reference input makes `cardano_tx_builder_build` return \ref CARDANO_ERROR_DUPLICATED_KEY.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_input_with_deferred_redeemer(
+  cardano_tx_builder_t*          builder,
+  cardano_utxo_t*                utxo,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  cardano_plutus_data_t*         datum);
+
+/**
+ * \brief Adds an output to the transaction.
+ *
+ * This function appends a specified transaction output to the transaction being built.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance to which the output will be added.
+ * \param[in] output A pointer to the \ref cardano_transaction_output_t structure representing the transaction output to be added.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;            // Initialized transaction builder
+ * cardano_transaction_output_t* tx_output = ...;     // Transaction output to add
+ *
+ * cardano_tx_builder_add_output(tx_builder, tx_output);
+ * \endcode
+ *
+ * \note Any errors related to adding this output, such as exceeding balance requirements, will be deferred and reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_output(
+  cardano_tx_builder_t*         builder,
+  cardano_transaction_output_t* output);
+
+/**
+ * \brief Sets metadata for a transaction builder with a specified tag.
+ *
+ * This function attaches metadata to a transaction being built, associating it with a specific metadata tag. Metadata can include additional information for the transaction, often used to encode arbitrary data on-chain.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance where the metadata will be added.
+ * \param[in] tag A unique identifier for the metadata, typically a 64-bit unsigned integer.
+ * \param[in] metadata A pointer to the \ref cardano_metadatum_t object containing the metadata to be added.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;       // Initialized transaction builder
+ * uint64_t metadata_tag = 12345;                // Example metadata tag
+ * cardano_metadatum_t* metadata = ...;          // Initialized metadata object
+ *
+ * cardano_tx_builder_set_metadata(tx_builder, metadata_tag, metadata);
+ * \endcode
+ *
+ * \note This function only stores a reference to the metadata. Errors, such as invalid metadata format, will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_metadata(
+  cardano_tx_builder_t* builder,
+  uint64_t              tag,
+  cardano_metadatum_t*  metadata);
+
+/**
+ * \brief Sets metadata for a transaction builder from a JSON string with a specified tag.
+ *
+ * This function allows adding metadata to the transaction by parsing a JSON string representation of the metadata. The metadata is associated with a specified tag, allowing for organized and accessible on-chain data.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance where the metadata will be added.
+ * \param[in] tag A unique identifier for the metadata, typically a 64-bit unsigned integer.
+ * \param[in] metadata_json A pointer to a JSON string representing the metadata content.
+ * \param[in] json_size The length of the `metadata_json` string.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;   // Initialized transaction builder
+ * uint64_t metadata_tag = 12345;            // Example metadata tag
+ * const char* metadata_json = "{ \"name\": \"some_name\" }";  // Metadata JSON as string
+ * size_t json_size = strlen(metadata_json);
+ *
+ * cardano_tx_builder_set_metadata_ex(tx_builder, metadata_tag, metadata_json, json_size);
+ * \endcode
+ *
+ * \note This function will parse the JSON string to convert it into metadata. Errors, such as invalid JSON format, will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_metadata_ex(
+  cardano_tx_builder_t* builder,
+  uint64_t              tag,
+  const char*           metadata_json,
+  size_t                json_size);
+
+/**
+ * \brief Adds a token minting operation to the transaction builder.
+ *
+ * This function allows the user to specify a token minting operation within a transaction, including
+ * the policy ID, asset name, amount, and an optional redeemer for Plutus scripts.
+ * This enables minting (positive amount) or burning (negative amount) of tokens.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance for building the transaction.
+ * \param[in] policy_id A pointer to a \ref cardano_blake2b_hash_t representing the unique minting policy ID.
+ * \param[in] name A pointer to a \ref cardano_asset_name_t defining the name of the asset being minted or burned.
+ * \param[in] amount The number of tokens to mint or burn; positive values indicate minting, and negative values indicate burning.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t structure, representing a redeemer if a Plutus script is used. Can be `NULL` if no redeemer is required.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;    // Initialized transaction builder
+ * cardano_blake2b_hash_t* policy_id = ...;   // Policy ID for the token
+ * cardano_asset_name_t* asset_name = ...;    // Asset name for the token
+ * int64_t mint_amount = 100;                 // Amount to mint
+ * cardano_plutus_data_t* redeemer = ...;     // Optional redeemer for Plutus scripts
+ *
+ * cardano_tx_builder_mint_token(tx_builder, policy_id, asset_name, mint_amount, redeemer);
+ * \endcode
+ *
+ * \note Errors related to this operation will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_mint_token(
+  cardano_tx_builder_t*   builder,
+  cardano_blake2b_hash_t* policy_id,
+  cardano_asset_name_t*   name,
+  int64_t                 amount,
+  cardano_plutus_data_t*  redeemer);
+
+/**
+ * \brief Adds a token minting operation whose redeemer payload is produced by a deferred callback.
+ *
+ * Behaves like \ref cardano_tx_builder_mint_token, but the redeemer payload is built by the
+ * callback from the balanced draft transaction. See \ref cardano_tx_builder_add_input_with_deferred_redeemer.
+ *
+ * \param[in] builder      The transaction builder.
+ * \param[in] policy_id    The policy id of the token.
+ * \param[in] name         The asset name of the token.
+ * \param[in] amount       The amount to mint (positive) or burn (negative).
+ * \param[in] callback     The callback producing the redeemer payload.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ */
+CARDANO_EXPORT void cardano_tx_builder_mint_token_with_deferred_redeemer(
+  cardano_tx_builder_t*          builder,
+  cardano_blake2b_hash_t*        policy_id,
+  cardano_asset_name_t*          name,
+  int64_t                        amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context);
+
+/**
+ * \brief Adds a token minting operation to the transaction builder using policy ID and asset name in hexadecimal format.
+ *
+ * This function allows the transaction builder to mint or burn tokens associated with a specific policy ID and asset name.
+ * The minting or burning amount and an optional redeemer for Plutus scripts are specified.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for transaction construction.
+ * \param[in] policy_id_hex A string in hexadecimal format representing the policy ID of the token to mint or burn.
+ * \param[in] policy_id_size The size of the `policy_id_hex` string.
+ * \param[in] name_hex A string in hexadecimal format representing the asset name within the policy ID.
+ * \param[in] name_size The size of the `name_hex` string.
+ * \param[in] amount The amount of tokens to mint (positive) or burn (negative).
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t structure, representing a redeemer if a Plutus script is involved. Set to `NULL` if not required.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;     // Initialized transaction builder
+ * const char* policy_id_hex = "abcdef123456"; // Example policy ID in hexadecimal format
+ * size_t policy_id_size = strlen(policy_id_hex); // Size of policy ID
+ * const char* name_hex = "74657374";          // Asset name in hexadecimal ("test" in hex)
+ * size_t name_size = strlen(name_hex);        // Size of asset name
+ * int64_t mint_amount = 100;                  // Amount to mint (positive for minting, negative for burning)
+ * cardano_plutus_data_t* redeemer = ...;      // Optional redeemer for Plutus script
+ *
+ * cardano_tx_builder_mint_token_ex(tx_builder, policy_id_hex, policy_id_size, name_hex, name_size, mint_amount, redeemer);
+ * \endcode
+ *
+ * \note Any errors related to minting policies or Plutus script requirements will only be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_mint_token_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            policy_id_hex,
+  size_t                 policy_id_size,
+  const char*            name_hex,
+  size_t                 name_size,
+  int64_t                amount,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Adds a token minting operation to the transaction builder using a predefined asset ID.
+ *
+ * This function allows minting or burning of tokens within a transaction by specifying an asset ID, along with the amount and an optional redeemer for Plutus scripts.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used to build the transaction.
+ * \param[in] asset_id A pointer to a \ref cardano_asset_id_t structure representing the asset to mint or burn.
+ * \param[in] amount The amount of tokens to mint (positive) or burn (negative).
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t structure, representing a redeemer if a Plutus script is involved. Set to `NULL` if not required.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;   // Initialized transaction builder
+ * cardano_asset_id_t* asset_id = ...;       // Predefined asset ID for the token
+ * int64_t mint_amount = 50;                 // Amount to mint (positive for minting, negative for burning)
+ * cardano_plutus_data_t* redeemer = ...;    // Optional Plutus script redeemer
+ *
+ * cardano_tx_builder_mint_token_with_id(tx_builder, asset_id, mint_amount, redeemer);
+ * \endcode
+ *
+ * \note Any errors related to this operation are deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_mint_token_with_id(
+  cardano_tx_builder_t*  builder,
+  cardano_asset_id_t*    asset_id,
+  int64_t                amount,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Adds a token minting operation to the transaction builder using an asset ID in hexadecimal format.
+ *
+ * This function enables minting or burning tokens for a specific asset identified by its unique `asset_id` in hexadecimal format.
+ * The minting or burning amount, along with an optional redeemer for Plutus scripts, is specified.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for transaction construction.
+ * \param[in] asset_id_hex A string in hexadecimal format representing the unique asset ID.
+ * \param[in] hex_size The size of the `asset_id_hex` string.
+ * \param[in] amount The amount of tokens to mint (positive) or burn (negative).
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t structure, representing a redeemer if a Plutus script is involved. Set to `NULL` if not required.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;       // Initialized transaction builder
+ * const char* asset_id_hex = "abcdef1234567890"; // Example asset ID in hexadecimal format
+ * size_t hex_size = strlen(asset_id_hex);        // Size of asset ID
+ * int64_t mint_amount = 100;                     // Amount to mint (positive for minting, negative for burning)
+ * cardano_plutus_data_t* redeemer = ...;         // Optional redeemer for Plutus script
+ *
+ * cardano_tx_builder_mint_token_with_id_ex(tx_builder, asset_id_hex, hex_size, mint_amount, redeemer);
+ * \endcode
+ *
+ * \note Any errors will only be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_mint_token_with_id_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            asset_id_hex,
+  size_t                 hex_size,
+  int64_t                amount,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Pads the transaction signer count for fee calculation purposes.
+ *
+ * This function pads the expected signature count in the transaction builder. It allows the
+ * transaction to calculate the fee considering additional signers.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for transaction construction.
+ * \param[in] count The number of expected signers to pad, affecting fee calculation.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * size_t extra_signers = 2;                // Additional signers to pad for fee calculation
+ *
+ * cardano_tx_builder_pad_signer_count(tx_builder, extra_signers);
+ * \endcode
+ *
+ * \note This function influences only the fee estimation and does not modify the actual required signers for
+ *       the transaction. Errors related to setting the signer count are deferred and will only be reported
+ *       when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_pad_signer_count(cardano_tx_builder_t* builder, size_t count);
+
+/**
+ * \brief Adds a signer to the transaction being built.
+ *
+ * This function registers a specific signer for the transaction by providing their public key hash.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for transaction construction.
+ * \param[in] pub_key_hash A pointer to the \ref cardano_blake2b_hash_t structure representing the public
+ *                         key hash of the signer to be added.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_blake2b_hash_t* signer_hash = ...;  // Public key hash for the signer
+ *
+ * cardano_tx_builder_add_signer(tx_builder, signer_hash);
+ * \endcode
+ *
+ * \note Errors related to adding signers are deferred and will only be reported when `cardano_tx_builder_build`
+ *       is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_signer(
+  cardano_tx_builder_t*   builder,
+  cardano_blake2b_hash_t* pub_key_hash);
+
+/**
+ * \brief Adds a signer to the transaction by specifying their public key hash in hexadecimal format.
+ *
+ * This function registers a signer by accepting their public key hash as a hexadecimal string.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for transaction construction.
+ * \param[in] pub_key_hash A string representing the public key hash in hexadecimal format.
+ * \param[in] hash_size The size of the `pub_key_hash` string.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * const char* pub_key_hash = "aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899";
+ * size_t hash_size = strlen(pub_key_hash);
+ *
+ * cardano_tx_builder_add_signer_ex(tx_builder, pub_key_hash, hash_size);
+ * \endcode
+ *
+ * \note Errors associated with adding a signer are deferred and will only be reported when `cardano_tx_builder_build`
+ *       is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_signer_ex(
+  cardano_tx_builder_t* builder,
+  const char*           pub_key_hash,
+  size_t                hash_size);
+
+/**
+ * \brief Adds a guard to the transaction being built.
+ *
+ * This function registers a guard credential for the transaction. Guards generalize required signers: a key hash
+ * guard is exactly a required signer, so the transaction must carry a witness for that key, while a script hash
+ * guard requires the ledger to run the script with the guarding redeemer purpose as a validity condition. Adding a
+ * key hash guard produces the same transaction as `cardano_tx_builder_add_signer`. Adding a guard that is already
+ * present leaves the transaction unchanged.
+ *
+ * The builder does not resolve or attach the script behind a script hash guard. Provide the script with
+ * `cardano_tx_builder_add_script` or through a reference input. A script hash guard added with this function has
+ * no redeemer; use `cardano_tx_builder_add_guard_with_redeemer` to add it together with the guarding redeemer
+ * that satisfies it. A guard whose script is a Plutus script provided to the batch makes `cardano_tx_builder_build`
+ * return \ref CARDANO_ERROR_MISSING_REDEEMER when it has no redeemer.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for transaction construction.
+ * \param[in] guard A pointer to the \ref cardano_credential_t structure representing the guard to be added.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_credential_t* guard = ...;       // Key hash or script hash credential
+ *
+ * cardano_tx_builder_add_guard(tx_builder, guard);
+ * \endcode
+ *
+ * \note Required signers are encoded as a set of key hashes while every guard is a key hash. As soon as a script
+ *       hash guard is added, the field switches to the credential wire form, which is only valid from the Dijkstra
+ *       era onwards. Errors related to adding guards are deferred and will only be reported when
+ *       `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_guard(
+  cardano_tx_builder_t* builder,
+  cardano_credential_t* guard);
+
+/**
+ * \brief Adds a guard to the transaction by specifying the credential hash in hexadecimal format.
+ *
+ * This function registers a guard by accepting the hash of its credential as a hexadecimal string together with
+ * the credential type. See `cardano_tx_builder_add_guard` for the difference between key hash and script hash
+ * guards.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for transaction construction.
+ * \param[in] hash_hex A string representing the credential hash in hexadecimal format.
+ * \param[in] hash_hex_size The size of the `hash_hex` string.
+ * \param[in] type The type of the credential, either \ref CARDANO_CREDENTIAL_TYPE_KEY_HASH or
+ *                 \ref CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * const char* script_hash = "966e394a544f242081e41d1965137b1bb412ac230d40ed5407821c37";
+ * size_t hash_size = strlen(script_hash);
+ *
+ * cardano_tx_builder_add_guard_ex(tx_builder, script_hash, hash_size, CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH);
+ * \endcode
+ *
+ * \note Adding a script hash guard switches the required signers field to the credential wire form, which is only
+ *       valid from the Dijkstra era onwards. Errors associated with adding a guard are deferred and will only be
+ *       reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_guard_ex(
+  cardano_tx_builder_t*     builder,
+  const char*               hash_hex,
+  size_t                    hash_hex_size,
+  cardano_credential_type_t type);
+
+/**
+ * \brief Adds a script hash guard to the transaction together with the guarding redeemer that satisfies it.
+ *
+ * This function registers \p guard like `cardano_tx_builder_add_guard` and attaches a redeemer with the guarding
+ * purpose whose payload is \p redeemer. The ledger runs the guard script with that redeemer as a validity condition
+ * of the transaction, and the execution units of the redeemer are computed when the transaction is built. The
+ * redeemer points to the position of the guard in the guards of the transaction, which keep the order in which they
+ * were added, counting key hash guards and the signers added with `cardano_tx_builder_add_signer`. A guard that is
+ * already present keeps its position.
+ *
+ * The builder does not resolve or attach the guard script. Provide it with `cardano_tx_builder_add_script` or
+ * through a reference input. A guard script running in a top level transaction is a PlutusV4 script, which sees the
+ * whole batch, the transaction and all its sub transactions.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for transaction construction.
+ * \param[in] guard A pointer to the script hash \ref cardano_credential_t to add as a guard.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t handed to the guard script as its redeemer.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t*  tx_builder = ...;
+ * cardano_credential_t*  guard      = ...;
+ * cardano_script_t*      script     = ...;
+ * cardano_plutus_data_t* redeemer   = ...;
+ *
+ * cardano_tx_builder_add_script(tx_builder, script);
+ * cardano_tx_builder_add_guard_with_redeemer(tx_builder, guard, redeemer);
+ * \endcode
+ *
+ * \note Errors are deferred and will only be reported when `cardano_tx_builder_build` is called. A key hash guard
+ *       makes `cardano_tx_builder_build` return \ref CARDANO_ERROR_INVALID_ARGUMENT, since only a script is
+ *       satisfied by a redeemer, and a guard that already has a redeemer makes it return
+ *       \ref CARDANO_ERROR_DUPLICATED_KEY.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_guard_with_redeemer(
+  cardano_tx_builder_t*  builder,
+  cardano_credential_t*  guard,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Adds a datum to the transaction builder for use in script-locked UTXOs.
+ *
+ * This function registers a Plutus datum with the transaction builder, which can then be referenced by outputs
+ * that are locked by Plutus scripts.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for constructing the transaction.
+ * \param[in] datum A pointer to a \ref cardano_plutus_data_t object representing the datum to be included.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_plutus_data_t* datum = ...;      // Initialized Plutus datum
+ *
+ * cardano_tx_builder_add_datum(tx_builder, datum);
+ * \endcode
+ *
+ * \note Errors related to adding a datum are deferred and will be reported when `cardano_tx_builder_build` is called.
+ *       The caller must ensure that the `datum` remains valid until the transaction is built.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_datum(
+  cardano_tx_builder_t*  builder,
+  cardano_plutus_data_t* datum);
+
+/**
+ * \brief Withdraws rewards from a specified reward account in the transaction builder.
+ *
+ * This function instructs the transaction builder to withdraw the available rewards for the specified
+ * reward account. It uses the associated \ref cardano_provider_t to fetch the available reward balance
+ * for the given account address and adds the withdrawal to the transaction.
+ *
+ * Up to the Conway era a withdrawal must drain the account, so the amount must be the full available reward balance.
+ * From the Dijkstra era partial withdrawals are valid: the ledger only requires that the withdrawals of an account,
+ * added over the top level transaction and every sub transaction of the batch, do not exceed the balance the account
+ * had before the batch. The exception is a top level transaction that needs a PlutusV1, PlutusV2 or PlutusV3 script,
+ * whatever source provides it, whose withdrawals must still drain the account exactly.
+ *
+ * In a batch the account must also be registered before the batch, so the ledger rejects a batch that withdraws from
+ * an account the batch registers, even one funded by a direct deposit of the batch, or from an account a sub
+ * transaction of the batch unregisters. The builder has no view of account state, so it does not check this.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for constructing the transaction.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t representing the reward account address
+ *                    from which rewards should be withdrawn.
+ * \param[in] amount  The amount of rewards to withdraw from the account, in lovelace. See the description for when it
+ *                    must be the full available reward balance.
+ * \param[in] redeemer An optional pointer to \ref cardano_plutus_data_t that serves as the redeemer for
+ *                     script-locked withdrawals, if applicable.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;           // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...;    // Initialized reward address
+ * cardano_plutus_data_t* redeemer = ...;            // Optional redeemer data
+ *
+ * cardano_tx_builder_withdraw_rewards(tx_builder, reward_address, 2532145, redeemer);
+ * \endcode
+ *
+ * \note Errors related to reward withdrawal will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_withdraw_rewards(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* address,
+  int64_t                   amount,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Withdraws rewards with a redeemer payload produced by a deferred callback.
+ *
+ * Behaves like \ref cardano_tx_builder_withdraw_rewards, but the redeemer payload is built by the
+ * callback from the balanced draft transaction. See \ref cardano_tx_builder_add_input_with_deferred_redeemer.
+ *
+ * \param[in] builder      The transaction builder.
+ * \param[in] address      The reward address to withdraw from.
+ * \param[in] amount       The amount to withdraw.
+ * \param[in] callback     The callback producing the redeemer payload.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ */
+CARDANO_EXPORT void cardano_tx_builder_withdraw_rewards_with_deferred_redeemer(
+  cardano_tx_builder_t*          builder,
+  cardano_reward_address_t*      address,
+  int64_t                        amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context);
+
+/**
+ * \brief Withdraws rewards from a specified reward account using a string address in the transaction builder.
+ *
+ * This function instructs the transaction builder to withdraw available rewards from the specified reward account,
+ * using a string format for the reward address. It uses the associated \ref cardano_provider_t to fetch the available
+ * reward balance for the given address and includes the withdrawal in the transaction.
+ *
+ * The amount follows the same rules as in \ref cardano_tx_builder_withdraw_rewards. It must be the full available
+ * reward balance up to the Conway era and whenever the transaction needs a PlutusV1, PlutusV2 or PlutusV3 script, and
+ * it may be a part of the balance otherwise from the Dijkstra era. In a batch the account must also be registered
+ * before the batch, which the builder does not check.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for constructing the transaction.
+ * \param[in] reward_address A string representing the reward account address from which rewards are to be withdrawn.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] amount  The amount of rewards to withdraw from the account, in lovelace.
+ * \param[in] redeemer An optional pointer to \ref cardano_plutus_data_t that acts as the redeemer for
+ *                     script-locked withdrawals, if applicable.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;          // Initialized transaction builder
+ * const char* reward_addr = "stake1u9...";         // Reward address in string format
+ * size_t address_size = strlen(reward_addr);       // Length of the reward address string
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer data
+ *
+ * cardano_tx_builder_withdraw_rewards_ex(tx_builder, reward_addr, address_size, 966584122, redeemer);
+ * \endcode
+ *
+ * \note Errors related to reward withdrawal will be deferred until `cardano_tx_builder_build` is called.
+ *       Ensure the reward address and redeemer remain valid until the transaction is built.
+ */
+CARDANO_EXPORT void cardano_tx_builder_withdraw_rewards_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            reward_address,
+  size_t                 address_size,
+  int64_t                amount,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Adds a direct deposit to the transaction being built.
+ *
+ * A direct deposit pays lovelace straight into a reward account without creating a UTxO. The deposited amount is
+ * value produced by the transaction, so the builder funds it from the selected inputs together with the outputs
+ * and the fee. Adding a direct deposit for a reward account that already has one accumulates both amounts.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for constructing the transaction.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t representing the reward account that
+ *                           receives the deposit.
+ * \param[in] amount The amount of lovelace to deposit. It must be greater than zero and at most INT64_MAX, the
+ *                   largest amount the balancer can represent.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;           // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...;   // Initialized reward address
+ *
+ * cardano_tx_builder_add_direct_deposit(tx_builder, reward_address, 2000000);
+ * \endcode
+ *
+ * \note Direct deposits are only valid from the Dijkstra era onwards. Errors related to adding a direct deposit,
+ *       including an amount or an accumulated amount above INT64_MAX, are deferred and will only be reported when
+ *       `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_direct_deposit(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* reward_address,
+  uint64_t                  amount);
+
+/**
+ * \brief Adds a direct deposit to the transaction using a string reward address.
+ *
+ * This function behaves like `cardano_tx_builder_add_direct_deposit` but accepts the reward account as a Bech32
+ * string.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for constructing the transaction.
+ * \param[in] reward_address A string representing the reward account that receives the deposit.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] amount The amount of lovelace to deposit. It must be greater than zero and at most INT64_MAX, the
+ *                   largest amount the balancer can represent.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;          // Initialized transaction builder
+ * const char* reward_addr = "stake1u9...";         // Reward address in string format
+ * size_t address_size = strlen(reward_addr);       // Length of the reward address string
+ *
+ * cardano_tx_builder_add_direct_deposit_ex(tx_builder, reward_addr, address_size, 2000000);
+ * \endcode
+ *
+ * \note Direct deposits are only valid from the Dijkstra era onwards. Errors related to adding a direct deposit
+ *       are deferred and will only be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_direct_deposit_ex(
+  cardano_tx_builder_t* builder,
+  const char*           reward_address,
+  size_t                address_size,
+  uint64_t              amount);
+
+/**
+ * \brief Adds an account balance interval to the transaction being built.
+ *
+ * An account balance interval makes the transaction valid only while the balance of the reward account sits
+ * inside the interval at the point the transaction is applied. An interval is either bounded (inclusive lower
+ * bound, exclusive upper bound, either of which may be absent) or an exact balance. Adding an interval for a
+ * reward account that already has one replaces the previous interval.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for constructing the transaction.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t representing the reward account the
+ *                           interval constrains.
+ * \param[in] interval A pointer to the \ref cardano_account_balance_interval_t the account balance must sit in.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;           // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...;   // Initialized reward address
+ * cardano_account_balance_interval_t* interval = NULL;
+ * const uint64_t lower_bound = 1000000;
+ *
+ * if (cardano_account_balance_interval_new(&lower_bound, NULL, &interval) == CARDANO_SUCCESS)
+ * {
+ *   cardano_tx_builder_add_account_balance_interval(tx_builder, reward_address, interval);
+ *   cardano_account_balance_interval_unref(&interval);
+ * }
+ * \endcode
+ *
+ * \note Account balance intervals are only valid from the Dijkstra era onwards. Errors related to adding an
+ *       interval are deferred and will only be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_account_balance_interval(
+  cardano_tx_builder_t*               builder,
+  cardano_reward_address_t*           reward_address,
+  cardano_account_balance_interval_t* interval);
+
+/**
+ * \brief Adds an account balance interval to the transaction using a string reward address.
+ *
+ * This function behaves like `cardano_tx_builder_add_account_balance_interval` but accepts the reward account
+ * as a Bech32 string.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for constructing the transaction.
+ * \param[in] reward_address A string representing the reward account the interval constrains.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] interval A pointer to the \ref cardano_account_balance_interval_t the account balance must sit in.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;                   // Initialized transaction builder
+ * cardano_account_balance_interval_t* interval = ...;       // Initialized interval
+ * const char* reward_addr = "stake1u9...";                  // Reward address in string format
+ * size_t address_size = strlen(reward_addr);                // Length of the reward address string
+ *
+ * cardano_tx_builder_add_account_balance_interval_ex(tx_builder, reward_addr, address_size, interval);
+ * \endcode
+ *
+ * \note Account balance intervals are only valid from the Dijkstra era onwards. Errors related to adding an
+ *       interval are deferred and will only be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_account_balance_interval_ex(
+  cardano_tx_builder_t*               builder,
+  const char*                         reward_address,
+  size_t                              address_size,
+  cardano_account_balance_interval_t* interval);
+
+/**
+ * \brief Adds a starting account balance interval to the transaction being built.
+ *
+ * A starting account balance interval makes the transaction valid only while the balance the reward account had
+ * before any sub transaction of the transaction was applied sits inside the interval, while
+ * `cardano_tx_builder_add_account_balance_interval` constrains the balance at the point the transaction itself is
+ * applied. Adding an interval for a reward account that already has one replaces the previous interval.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for constructing the transaction.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t representing the reward account the
+ *                           interval constrains.
+ * \param[in] interval A pointer to the \ref cardano_account_balance_interval_t the starting account balance must
+ *                     sit in.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;           // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...;   // Initialized reward address
+ * cardano_account_balance_interval_t* interval = NULL;
+ *
+ * if (cardano_account_balance_interval_new_exact(5000000, &interval) == CARDANO_SUCCESS)
+ * {
+ *   cardano_tx_builder_add_starting_account_balance_interval(tx_builder, reward_address, interval);
+ *   cardano_account_balance_interval_unref(&interval);
+ * }
+ * \endcode
+ *
+ * \note Starting account balance intervals are only valid from the Dijkstra era onwards. Errors related to adding
+ *       an interval are deferred and will only be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_starting_account_balance_interval(
+  cardano_tx_builder_t*               builder,
+  cardano_reward_address_t*           reward_address,
+  cardano_account_balance_interval_t* interval);
+
+/**
+ * \brief Adds a starting account balance interval to the transaction using a string reward address.
+ *
+ * This function behaves like `cardano_tx_builder_add_starting_account_balance_interval` but accepts the reward
+ * account as a Bech32 string.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for constructing the transaction.
+ * \param[in] reward_address A string representing the reward account the interval constrains.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] interval A pointer to the \ref cardano_account_balance_interval_t the starting account balance must
+ *                     sit in.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;                   // Initialized transaction builder
+ * cardano_account_balance_interval_t* interval = ...;       // Initialized interval
+ * const char* reward_addr = "stake1u9...";                  // Reward address in string format
+ * size_t address_size = strlen(reward_addr);                // Length of the reward address string
+ *
+ * cardano_tx_builder_add_starting_account_balance_interval_ex(tx_builder, reward_addr, address_size, interval);
+ * \endcode
+ *
+ * \note Starting account balance intervals are only valid from the Dijkstra era onwards. Errors related to adding
+ *       an interval are deferred and will only be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_starting_account_balance_interval_ex(
+  cardano_tx_builder_t*               builder,
+  const char*                         reward_address,
+  size_t                              address_size,
+  cardano_account_balance_interval_t* interval);
+
+/**
+ * \brief Adds a finished sub transaction to the transaction being built.
+ *
+ * A sub transaction is an intent that an independent party builds and signs. The transaction that carries it
+ * pays the fee and posts the collateral for the whole batch, and the ledger checks value conservation over the
+ * transaction together with all its sub transactions. The sub transaction is treated as opaque: the builder keeps
+ * a reference to it and never modifies it, so its original bytes, its id and its signatures are preserved.
+ *
+ * The inputs spent by a batch must be disjoint and the ids of its sub transactions unique. The sub transaction is
+ * rejected when it was already added, when it spends an input that is also spent by another sub transaction or
+ * by an input added with `cardano_tx_builder_add_input`, or when one of its spend inputs is not resolved by
+ * \p resolved_utxos. Likewise, `cardano_tx_builder_add_input` rejects an input that is already spent by a sub
+ * transaction.
+ *
+ * `cardano_tx_builder_build` balances the whole batch: a net deficit of the sub transactions is funded by the inputs
+ * selected for the transaction, a net surplus is returned in its change outputs, and the UTXOs that the sub
+ * transactions spend or reference are never selected as inputs of the transaction, even when they are also among the
+ * UTXOs set with `cardano_tx_builder_set_utxos`, as happens when the batcher is a party of the batch too. When the
+ * transaction needs a PlutusV1, PlutusV2 or PlutusV3 script it must also conserve value by itself, so the sub
+ * transactions must balance between themselves; otherwise building fails with
+ * \ref CARDANO_ERROR_UNBALANCED_SUB_TRANSACTIONS and the fix is to add a balancing sub transaction. A script is needed
+ * when the transaction spends an input it locks, mints under its policy, withdraws from a reward account it controls,
+ * carries a certificate it must authorize, votes with it as the voter, carries a parameter change or treasury
+ * withdrawals proposal it guards as the guardrails script or lists it among its guards. Its language is taken from
+ * whatever source provides it, pooled over the whole batch: the witness sets of the transaction and of its sub
+ * transactions, and the reference scripts of the reference inputs and of the inputs of the transaction, including the
+ * inputs chosen by coin selection, and of the inputs and reference inputs of its sub transactions. From protocol
+ * version 12, reference scripts in newly created outputs at either level and in collateral return are also provided.
+ * A reference input
+ * of a sub transaction that neither the resolved UTXOs given to `cardano_tx_builder_add_sub_transaction` nor the
+ * available UTXOs, reference inputs or inputs of the transaction resolve is not seen. A script that is only present
+ * and that the transaction does not need does not trigger this rule.
+ *
+ * In that same legacy mode the ledger checks the witness datums of the transaction with its sub transactions removed:
+ * each datum the transaction carries must be needed by a spent input locked by a Plutus script among the pooled
+ * scripts, or match the datum hash of one of its own outputs or of the output behind one of its own reference inputs.
+ * A datum whose hash only an output or a reference input of a sub transaction carries makes building fail with
+ * \ref CARDANO_ERROR_NOT_ALLOWED_SUPPLEMENTAL_DATUMS, and the fix is to leave that datum to the sub transaction, or to
+ * drop it from the transaction, since an output that carries a datum hash does not need the datum in the witness set.
+ * Whatever the mode, the datums needed by the inputs a level spends must be in the witness set of that same level,
+ * while the scripts of every level are shared by the whole batch.
+ *
+ * The fee of the transaction pays for the whole batch: the size of the sub transactions, the execution units of their
+ * redeemers and their reference scripts, the ones carried by the UTXOs they spend and the ones of their resolved
+ * reference inputs, counted once per sub transaction that references them, as the ledger does when it measures the
+ * reference script size of a batch, while a UTXO that a sub transaction both references and spends is counted once for
+ * that sub transaction. When a sub transaction carries redeemers the
+ * transaction posts the collateral, even if it runs no script itself, so the collateral change address and the
+ * collateral UTXOs must be set before building, and building fails with \ref CARDANO_ERROR_BALANCE_INSUFFICIENT when the
+ * collateral UTXOs are empty. The UTXOs that the sub transactions spend or reference are never used
+ * as collateral, even when they are also among the UTXOs set with `cardano_tx_builder_set_collateral_utxos`, and
+ * building fails with \ref CARDANO_ERROR_BALANCE_INSUFFICIENT when every collateral UTXO is used by a sub transaction.
+ * The execution units the redeemers of a sub transaction declare are taken as final, since they are signed by the
+ * party that built it. When the transaction itself carries redeemers, the transaction evaluator runs the scripts of
+ * the sub transactions together with the ones of the transaction, as the ledger does, so a sub transaction script
+ * that fails makes building fail with \ref CARDANO_ERROR_SCRIPT_EVALUATION_FAILURE.
+ *
+ * A sub transaction can require guards from the transaction that carries it, and the batch is only valid when every
+ * one of those credentials is among the guards of the transaction. The batcher must add each of them with
+ * `cardano_tx_builder_add_guard` or `cardano_tx_builder_add_guard_ex`, before or after adding the sub transaction. The
+ * builder never adds them by itself, since a key hash guard is also a required signer, and building fails with
+ * \ref CARDANO_ERROR_ELEMENT_NOT_FOUND when one is missing.
+ *
+ * Building also fails with \ref CARDANO_ERROR_MISSING_REDEEMER when a purpose of a sub transaction needs a Plutus
+ * script provided anywhere in the batch and the sub transaction carries no redeemer for it.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for constructing the transaction.
+ * \param[in] sub_transaction A pointer to the \ref cardano_sub_transaction_t to add to the transaction.
+ * \param[in] resolved_utxos A pointer to the \ref cardano_utxo_list_t with the UTXOs behind the inputs of the sub
+ *                           transaction. It must resolve every input the sub transaction spends, since their value
+ *                           takes part in the value conservation of the batch and the reference scripts they carry
+ *                           are priced in the fee. It may also resolve its reference inputs, which carry the
+ *                           reference scripts the fee accounts for; a reference input that is not resolved here is
+ *                           skipped, unless the same UTXO is among the available UTXOs, the reference inputs or the
+ *                           inputs of the transaction at build time, in which case its reference script is priced.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;            // Initialized transaction builder
+ * cardano_sub_transaction_t* sub_transaction = ...;  // Sub transaction received from another party
+ * cardano_utxo_list_t* resolved_utxos = ...;         // UTXOs spent and referenced by the sub transaction
+ *
+ * cardano_tx_builder_add_sub_transaction(tx_builder, sub_transaction, resolved_utxos);
+ * \endcode
+ *
+ * \note Sub transactions are only valid from the Dijkstra era onwards. Errors related to adding a sub transaction
+ *       are deferred and will only be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_sub_transaction(
+  cardano_tx_builder_t*      builder,
+  cardano_sub_transaction_t* sub_transaction,
+  cardano_utxo_list_t*       resolved_utxos);
+
+/**
+ * \brief Registers a staking reward address.
+ *
+ * This function adds a staking reward address to be registered in the transaction, allowing the specified
+ * reward account to start receiving staking rewards.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance used for constructing the transaction.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t representing the reward account to be registered.
+ * \param[in] redeemer An optional pointer to \ref cardano_plutus_data_t, which provides the redeemer data if the
+ *                     registration is script-locked.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;          // Initialized transaction builder
+ * cardano_reward_address_t* reward_addr = ...;     // Reward address to register
+ * cardano_plutus_data_t* redeemer = ...;           // Optional redeemer data for script-locked registration
+ *
+ * cardano_tx_builder_register_reward_address(tx_builder, reward_addr, redeemer);
+ * \endcode
+ *
+ * \note Any errors related to reward address registration will be reported when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_register_reward_address(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Registers a staking reward address using a hexadecimal address string.
+ *
+ * This function registers a staking reward address in the transaction builder, allowing
+ * the specified reward account, provided as a hexadecimal string, to receive staking rewards.
+ * The transaction builder leverages the \ref cardano_provider_t to validate this process.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction construction.
+ * \param[in] reward_address A pointer to a bech32 string representing the reward address.
+ * \param[in] address_size The size of the `reward_address` string.
+ * \param[in] redeemer An optional pointer to \ref cardano_plutus_data_t, used if the registration requires
+ *                     redeemer data for script-locked transactions.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;       // Initialized transaction builder
+ * const char* reward_address = "stake1uxxx...";
+ * size_t address_size = strlen(reward_address);
+ * cardano_plutus_data_t* redeemer = ...;        // Optional redeemer data for script-locked registration
+ *
+ * cardano_tx_builder_register_reward_address_ex(tx_builder, reward_address, address_size, redeemer);
+ * \endcode
+ *
+ * \note Errors related to the reward address registration will be reported only when `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_register_reward_address_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            reward_address,
+  size_t                 address_size,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Deregisters a staking reward address.
+ *
+ * This function deregisters the reward address, effectively preventing it from receiving future staking rewards. a \ref cardano_plutus_data_t redeemer can be provided for
+ * script-locked accounts.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t structure representing the reward address to deregister.
+ * \param[in] redeemer An optional pointer to \ref cardano_plutus_data_t for providing redeemer data if required for deregistration.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...; // Reward address to be deregistered
+ * cardano_plutus_data_t* redeemer = ...;  // Optional redeemer data for script-locked deregistration
+ *
+ * cardano_tx_builder_deregister_reward_address(tx_builder, reward_address, redeemer);
+ * \endcode
+ *
+ * \note Errors related to the deregistration process are deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_deregister_reward_address(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Deregisters a staking reward address.
+ *
+ * This function deregisters the reward address, preventing future staking rewards from being sent to
+ * the specified reward account. It accepts the reward address in a raw string format along with the
+ * length of the address. Optionally, a \ref cardano_plutus_data_t redeemer can be provided for
+ * script-locked accounts.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] reward_address A pointer to a raw string containing the reward address to be deregistered.
+ * \param[in] address_size The length of the reward address string.
+ * \param[in] redeemer An optional pointer to \ref cardano_plutus_data_t for providing redeemer data if required for deregistration.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * const char* reward_address = "stake1uxxx...";  // Reward address in raw string format
+ * size_t address_size = strlen(reward_address);
+ * cardano_plutus_data_t* redeemer = ...;  // Optional redeemer data for script-locked deregistration
+ *
+ * cardano_tx_builder_deregister_reward_address_ex(tx_builder, reward_address, address_size, redeemer);
+ * \endcode
+ *
+ * \note Errors related to the deregistration process are deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_deregister_reward_address_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            reward_address,
+  size_t                 address_size,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Delegates stake from a specified staking reward address to a staking pool.
+ *
+ * This function delegates stake from a specified staking reward address to a staking pool,
+ * identified by its unique pool ID.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t representing the staking reward address to delegate.
+ * \param[in] pool_id A pointer to the \ref cardano_blake2b_hash_t representing the hash ID of the pool to delegate to.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t for providing redeemer data if required for script-locked accounts.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...;  // Reward address for staking
+ * cardano_blake2b_hash_t* pool_id = ...;  // Pool ID to delegate stake to
+ * cardano_plutus_data_t* redeemer = ...;  // Optional redeemer for script-locked delegation
+ *
+ * cardano_tx_builder_delegate_stake(tx_builder, reward_address, pool_id, redeemer);
+ * \endcode
+ *
+ * \note Any errors associated with this delegation action will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_delegate_stake(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* address,
+  cardano_blake2b_hash_t*   pool_id,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Delegates stake from a specified staking reward address to a staking pool.
+ *
+ * This function allows for delegating stake from a specified staking reward address to a staking pool,
+ * using hex-encoded strings for the reward address and pool ID. The delegation request will be added to
+ * the transaction managed by the builder instance.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] reward_address A bech32 string representing the staking reward address for delegation.
+ * \param[in] address_size The size of the `reward_address` string.
+ * \param[in] pool_id A bech32 string representing the pool ID to which stake is delegated.
+ * \param[in] pool_id_size The size of the `pool_id` string.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t for providing redeemer data if required for script-locked accounts.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * const char* reward_address = "stake1u9...";
+ * size_t reward_address_size = strlen(reward_address);
+ * const char* pool_id = "pool1xy...";
+ * size_t pool_id_size = strlen(pool_id);
+ * cardano_plutus_data_t* redeemer = ...;  // Optional redeemer for script-locked delegation
+ *
+ * cardano_tx_builder_delegate_stake_ex(tx_builder, reward_address, reward_address_size, pool_id, pool_id_size, redeemer);
+ * \endcode
+ *
+ * \note Errors related to this action will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_delegate_stake_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            reward_address,
+  size_t                 address_size,
+  const char*            pool_id,
+  size_t                 pool_id_size,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Adds a voting power delegation to a DRep for governance purposes.
+ *
+ * This function enables delegating voting power from a specified reward address to DRep.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t representing the staking reward address that is delegating voting power.
+ * \param[in] drep A pointer to the \ref cardano_drep_t structure that identifies the decentralized representative receiving the delegated voting power.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t for providing redeemer data, useful for script-locked accounts.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...;  // Reward address delegating voting power
+ * cardano_drep_t* drep = ...;  // DRep receiving the delegated voting power
+ * cardano_plutus_data_t* redeemer = ...;  // Optional redeemer data
+ *
+ * cardano_tx_builder_delegate_voting_power(tx_builder, reward_address, drep, redeemer);
+ * \endcode
+ *
+ * \note Errors associated with this delegation will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_delegate_voting_power(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* address,
+  cardano_drep_t*           drep,
+  cardano_plutus_data_t*    redeemer);
+
+/**
+ * \brief Delegates voting power to a DRep using raw data.
+ *
+ * This function enables the delegation of voting power from a specified reward address to a DRep using string-based identifiers.
+ * The DRep ID can be provided in either CIP-105 or CIP-129 format.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] reward_address A string representing the staking reward address for the account delegating voting power.
+ * \param[in] address_size The length of the `reward_address` string.
+ * \param[in] drep_id A string representing the ID of the decentralized representative (DRep) receiving the voting power.
+ *                     The DRep ID can be in CIP-105 or CIP-129 format.
+ * \param[in] drep_id_size The length of the `drep_id` string.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t for providing redeemer data, useful for script-locked accounts.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * const char* reward_address = "stake1u9...";  // Reward address delegating voting power
+ * size_t address_size = strlen(reward_address);
+ * const char* drep_id = "drep1q...";  // DRep ID in CIP-129 format
+ * size_t drep_id_size = strlen(drep_id);
+ * cardano_plutus_data_t* redeemer = ...;  // Optional redeemer data
+ *
+ * // Alternatively, using CIP-105 format
+ * // const char* drep_id = "drep...";  // DRep ID in CIP-105 format
+ * // size_t drep_id_size = strlen(drep_id);
+ *
+ * cardano_tx_builder_delegate_voting_power_ex(tx_builder, reward_address, address_size, drep_id, drep_id_size, redeemer);
+ * \endcode
+ *
+ * \note The DRep ID must conform to either CIP-105 or CIP-129 format.
+ *       Errors related to this delegation will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_delegate_voting_power_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            reward_address,
+  size_t                 address_size,
+  const char*            drep_id,
+  size_t                 drep_id_size,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Registers a DRep in the transaction.
+ *
+ * This function registers a DRep with an optional anchor and redeemer in the transaction being constructed.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] drep A pointer to the \ref cardano_drep_t instance representing the decentralized representative to be registered.
+ * \param[in] anchor An optional pointer to a \ref cardano_anchor_t instance providing an anchor for governance (e.g., delegation details).
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t instance for providing redeemer data, which may be required for
+ *                     script-locked DReps.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_drep_t* drep = ...;              // DRep to register
+ * cardano_anchor_t* anchor = ...;          // Optional governance anchor
+ * cardano_plutus_data_t* redeemer = ...;   // Optional redeemer data
+ *
+ * cardano_tx_builder_register_drep(tx_builder, drep, anchor, redeemer);
+ * \endcode
+ *
+ * \note Errors related to this registration will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_register_drep(
+  cardano_tx_builder_t*  builder,
+  cardano_drep_t*        drep,
+  cardano_anchor_t*      anchor,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Registers a DRep by ID in the transaction.
+ *
+ * This function registers a DRep in the transaction using a specified DRep ID. The DRep ID must be provided in either
+ * CIP-105 or CIP-129 bech32 format. An optional redeemer data can be included for script-locked DReps.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] drep_id A pointer to a character array containing the DRep ID in bech32 format (either CIP-105 or CIP-129).
+ * \param[in] drep_id_size The size of the `drep_id` string.
+ * \param[in] metadata_url The URL pointing to the DRep metadata file.
+ * \param[in] metadata_url_size The size of the `metadata_url` string.
+ * \param[in] metadata_hash_hex The hash of the DRep metadata file in hexadecimal format.
+ * \param[in] metadata_hash_hex_size The size of the `metadata_hash_hex` string.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t instance for providing redeemer data, which may be required for
+ *                     script-locked DReps.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Using CIP-105 format (bech32-encoded DRep ID with specific prefix)
+ * cardano_tx_builder_t* tx_builder = ...;    // Initialized transaction builder
+ * const char* drep_id = "drep1q...";
+ * size_t drep_id_size = strlen(drep_id);
+ * const char* metadata_url = "https://example.com/drep_metadata.json";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash_hex = "abcdef123456...";  // Hex-encoded hash of metadata file
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex);
+ * cardano_plutus_data_t* redeemer = ...;     // Optional redeemer data
+ *
+ * cardano_tx_builder_register_drep_ex(
+ *   tx_builder,
+ *   drep_id,
+ *   drep_id_size,
+ *   metadata_url,
+ *   metadata_url_size,
+ *   metadata_hash_hex,
+ *   metadata_hash_hex_size,
+ *   redeemer);
+ * \endcode
+ *
+ * \note The `drep_id` must be in bech32 format as specified by either CIP-105 or CIP-129, which differ in their internal binary encoding.
+ *       Ensure that the correct format is used according to the DRep's identification scheme.
+ *       Errors related to this registration will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_register_drep_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            drep_id,
+  size_t                 drep_id_size,
+  const char*            metadata_url,
+  size_t                 metadata_url_size,
+  const char*            metadata_hash_hex,
+  size_t                 metadata_hash_hex_size,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Updates an existing DRep in the transaction.
+ *
+ * This function allows updating a DRep in the transaction with a specified DRep object, optionally providing a
+ * governance anchor and redeemer data for script DReps.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] drep A pointer to the \ref cardano_drep_t instance representing the DRep to be updated.
+ * \param[in] anchor An optional pointer to a \ref cardano_anchor_t instance, providing governance anchor details associated with the DRep.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t instance for providing redeemer data, which may be required for
+ *                     script-locked DReps.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;    // Initialized transaction builder
+ * cardano_drep_t* drep = ...;                // DRep object to update
+ * cardano_anchor_t* anchor = ...;            // Optional anchor
+ * cardano_plutus_data_t* redeemer = ...;     // Optional redeemer data
+ *
+ * cardano_tx_builder_update_drep(tx_builder, drep, anchor, redeemer);
+ * \endcode
+ *
+ * \note Any errors related to updating the DRep will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_update_drep(
+  cardano_tx_builder_t*  builder,
+  cardano_drep_t*        drep,
+  cardano_anchor_t*      anchor,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Updates an existing DRep in the transaction by ID.
+ *
+ * This function updates a DRep in the transaction using a specified DRep ID. The DRep ID must be provided in bech32 format,
+ * conforming to either CIP-105 or CIP-129 standards. Optionally, you can provide a redeemer for script-locked DReps.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] drep_id A pointer to a character array containing the DRep ID in bech32 format (either CIP-105 or CIP-129).
+ * \param[in] drep_id_size The size of the `drep_id` string.
+ * \param[in] metadata_url The URL pointing to the DRep metadata file.
+ * \param[in] metadata_url_size The size of the `metadata_url` string.
+ * \param[in] metadata_hash_hex The hash of the DRep metadata file in hexadecimal format.
+ * \param[in] metadata_hash_hex_size The size of the `metadata_hash_hex` string.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t instance for providing redeemer data, which may be required
+ *                     for script-locked DReps.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Using CIP-105 format (bech32-encoded DRep ID with specific prefix)
+ * cardano_tx_builder_t* tx_builder = ...;    // Initialized transaction builder
+ * const char* drep_id = "drep1q...";
+ * size_t drep_id_size = strlen(drep_id);
+ * const char* metadata_url = "https://example.com/drep_metadata.json";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash_hex = "abcdef123456...";  // Hex-encoded hash of metadata file
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex);
+ * cardano_plutus_data_t* redeemer = ...;     // Optional redeemer data
+ *
+ * cardano_tx_builder_update_drep_ex(
+ *   tx_builder,
+ *   drep_id,
+ *   drep_id_size,
+ *   metadata_url,
+ *   metadata_url_size,
+ *   metadata_hash_hex,
+ *   metadata_hash_hex_size,
+ *   redeemer);
+ * \endcode
+ *
+ * \note The `drep_id` must be in bech32 format as specified by either CIP-105 or CIP-129, which differ in their internal binary encoding.
+ *       Ensure that the correct format is used according to the DRep's identification scheme.
+ *       Errors associated with updating the DRep will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_update_drep_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            drep_id,
+  size_t                 drep_id_size,
+  const char*            metadata_url,
+  size_t                 metadata_url_size,
+  const char*            metadata_hash_hex,
+  size_t                 metadata_hash_hex_size,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Deregisters an existing DRep.
+ *
+ * This function registers a DRep. A redeemer can be specified for additional validation if
+ * the DRep is a script.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] drep A pointer to the \ref cardano_drep_t instance representing the DRep to deregister.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t instance for providing redeemer data, which may be required for
+ *                     script-locked DReps.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;    // Initialized transaction builder
+ * cardano_drep_t* drep = ...;                // DRep to deregister
+ * cardano_plutus_data_t* redeemer = ...;     // Optional redeemer data
+ *
+ * cardano_tx_builder_deregister_drep(tx_builder, drep, redeemer);
+ * \endcode
+ *
+ * \note Errors related to deregistering the DRep will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_deregister_drep(
+  cardano_tx_builder_t*  builder,
+  cardano_drep_t*        drep,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Deregisters an existing DRep.
+ *
+ * This function deregisters a DRep identified by its ID in bech32 format. The DRep ID must conform to either
+ * CIP-105 or CIP-129 standards.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] drep_id A pointer to a character array containing the DRep ID in bech32 format (either CIP-105 or CIP-129).
+ * \param[in] drep_id_size The size of the `drep_id` string.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t instance for providing redeemer data,
+ *                     which may be required for script-locked DReps.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Using CIP-105 format (bech32-encoded DRep ID)
+ * cardano_tx_builder_t* tx_builder = ...;   // Initialized transaction builder
+ * const char* drep_id = "drep1q...";        // DRep ID in CIP-105 format
+ * size_t drep_id_size = strlen(drep_id);
+ * cardano_plutus_data_t* redeemer = ...;    // Optional redeemer data
+ *
+ * cardano_tx_builder_deregister_drep_ex(tx_builder, drep_id, drep_id_size, redeemer);
+ * \endcode
+ *
+ * \note The `drep_id` must be in bech32 format as specified by either CIP-105 or CIP-129, which differ in their internal binary encoding.
+ *       Ensure that the correct format is used according to the DRep's identification scheme.
+ *       Errors related to deregistering the DRep will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_deregister_drep_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            drep_id,
+  size_t                 drep_id_size,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Registers a vote for a specified governance action within the transaction.
+ *
+ * This function allows a voter to submit their vote for a given governance action. The vote, represented by
+ * `cardano_voting_procedure_t`, and an optional redeemer for script voters.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] voter A pointer to a \ref cardano_voter_t structure representing the voter participating in the governance action.
+ * \param[in] action_id A pointer to a \ref cardano_governance_action_id_t identifying the governance action being voted on.
+ * \param[in] vote A pointer to a \ref cardano_voting_procedure_t defining the voting procedure and choice.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t instance for providing redeemer data, required if the voting action is locked by a script.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;   // Initialized transaction builder
+ * cardano_voter_t* voter = ...;             // Voter information
+ * cardano_governance_action_id_t* action_id = ...; // Governance action ID
+ * cardano_voting_procedure_t* vote = ...;   // Voting procedure with choice
+ * cardano_plutus_data_t* redeemer = ...;    // Optional redeemer data
+ *
+ * cardano_tx_builder_vote(tx_builder, voter, action_id, vote, redeemer);
+ * \endcode
+ *
+ * \note Errors related to the voting operation will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_vote(
+  cardano_tx_builder_t*           builder,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_plutus_data_t*          redeemer);
+
+/**
+ * \brief Casts a vote whose redeemer payload is produced by a deferred callback.
+ *
+ * Behaves like \ref cardano_tx_builder_vote, but the redeemer payload is built by the given
+ * callback from the balanced draft transaction. See \ref cardano_tx_builder_add_input_with_deferred_redeemer.
+ * The \ref cardano_transaction_find_vote_index function can be used to look up the voter's
+ * position in ledger voter order, which is the voting redeemer index, from inside the callback.
+ *
+ * \param[in] builder      The transaction builder.
+ * \param[in] voter        The voter casting the vote.
+ * \param[in] action_id    The governance action being voted on.
+ * \param[in] vote         The voting procedure with the vote choice.
+ * \param[in] callback     The callback producing the redeemer payload.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ */
+CARDANO_EXPORT void cardano_tx_builder_vote_with_deferred_redeemer(
+  cardano_tx_builder_t*           builder,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_deferred_redeemer_fn_t  callback,
+  void*                           user_context);
+
+/**
+ * \brief Adds a certificate to the transaction.
+ *
+ * This function adds a specified certificate to the transaction being constructed. Certificates are used to perform
+ * various actions on the blockchain, such as staking, delegating, or registering/deregistering entities.
+ * An optional redeemer may be provided if the certificate requires validation by a script.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction.
+ * \param[in] certificate A pointer to a \ref cardano_certificate_t structure representing the certificate to add.
+ * \param[in] redeemer An optional pointer to a \ref cardano_plutus_data_t instance containing redeemer data, required if the certificate is locked by a script.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;        // Initialized transaction builder
+ * cardano_certificate_t* certificate = ...;      // Certificate to add
+ * cardano_plutus_data_t* redeemer = ...;         // Optional redeemer data
+ *
+ * cardano_tx_builder_add_certificate(tx_builder, certificate, redeemer);
+ * \endcode
+ *
+ * A pool registration certificate needs the signatures of the pool operator and of every pool owner, and a pool
+ * retirement certificate the signature of the pool operator; the fee covers their witnesses. From Dijkstra,
+ * \ref cardano_tx_builder_set_pool_state enables the owner exemption for unchanged or BLS-only updates. When balancing, a pool
+ * registration is charged the pool deposit unless the same pool is registered earlier in the same transaction or batch,
+ * in which case it only updates the pool parameters, and a pool retirement reclaims nothing, as the ledger returns the
+ * pool deposit at the epoch boundary where the pool retires. The builder does not know which pools are already
+ * registered on chain, so a registration that updates the parameters of an already registered pool is still charged
+ * the pool deposit, which the ledger does not charge, and the caller must account for that deposit.
+ *
+ * \note Errors related to the certificate addition will be deferred until `cardano_tx_builder_build` is called.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_certificate(
+  cardano_tx_builder_t*  builder,
+  cardano_certificate_t* certificate,
+  cardano_plutus_data_t* redeemer);
+
+/**
+ * \brief Adds a certificate whose redeemer payload is produced by a deferred callback.
+ *
+ * Behaves like \ref cardano_tx_builder_add_certificate, but the redeemer payload is built by the
+ * given callback from the balanced draft transaction. See \ref cardano_tx_builder_add_input_with_deferred_redeemer.
+ * The \ref cardano_transaction_find_certificate_index function can be used to look up the
+ * certificate's position from inside the callback.
+ *
+ * This single entry point covers every script-locked certificate type: build the certificate with
+ * the appropriate constructor (stake registration, delegation, DRep operations, committee
+ * operations, etc.) and add it here instead of through the convenience functions.
+ *
+ * \param[in] builder      The transaction builder.
+ * \param[in] certificate  The certificate to add.
+ * \param[in] callback     The callback producing the redeemer payload.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_certificate_with_deferred_redeemer(
+  cardano_tx_builder_t*          builder,
+  cardano_certificate_t*         certificate,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context);
+
+/**
+ * \brief Adds a script to the transaction builder.
+ *
+ * This function allows the addition of a script (`cardano_script_t`) to the transaction builder. Scripts can be used for defining
+ * specific conditions under which transaction outputs can be unlocked.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance managing the transaction details.
+ * \param[in] script A pointer to the \ref cardano_script_t structure representing the script to be added to the transaction.
+ *
+ * \note Errors related to adding an invalid or incompatible script will be deferred and reported only when `cardano_tx_builder_build` is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* tx_builder = ...;  // Initialized transaction builder
+ * cardano_script_t* script = ...;          // A script for the transaction
+ *
+ * cardano_tx_builder_add_script(tx_builder, script);
+ *
+ * // Additional transaction setup...
+ *
+ * cardano_error_t result = cardano_tx_builder_build(tx_builder, &transaction);
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   const char* error_msg = cardano_tx_builder_get_last_error(tx_builder);
+ *   printf("Failed to build transaction with script: %s\n", error_msg);
+ * }
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_script(
+  cardano_tx_builder_t* builder,
+  cardano_script_t*     script);
+
+/**
+ * \brief Adds a complete proposal procedure with an optional proposing redeemer.
+ *
+ * The proposal deposit must match the configured governance action deposit. Proposals retain
+ * insertion order; a proposal with identical serialized contents is rejected as a duplicate.
+ * A non-NULL redeemer requires a parameter change or treasury withdrawal with a policy hash.
+ * NULL adds no redeemer, including for proposals with a policy hash. The builder retains
+ * references to the proposal and redeemer. Errors are deferred until build.
+ *
+ * \param[in,out] builder The builder. NULL is a no-op.
+ * \param[in] proposal The proposal procedure. Must not be NULL.
+ * \param[in] redeemer The proposing payload, or NULL.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_proposal(
+  cardano_tx_builder_t*         builder,
+  cardano_proposal_procedure_t* proposal,
+  cardano_plutus_data_t*        redeemer);
+
+/**
+ * \brief Adds a proposal whose proposing payload is produced by a deferred callback.
+ *
+ * The same proposal and deposit rules as \ref cardano_tx_builder_add_proposal apply.
+ * The callback follows \ref cardano_deferred_redeemer_fn_t. Use
+ * \ref cardano_transaction_find_proposal_index on the draft transaction to obtain the
+ * proposal's proposing index. For sub transactions this index is local to that body.
+ * The caller must keep user_context valid until build completes.
+ *
+ * \param[in,out] builder The builder. NULL is a no-op.
+ * \param[in] proposal The proposal procedure with a policy hash. Must not be NULL.
+ * \param[in] callback The callback producing the payload. Must not be NULL.
+ * \param[in] user_context An opaque pointer forwarded to the callback. Can be NULL.
+ */
+CARDANO_EXPORT void cardano_tx_builder_add_proposal_with_deferred_redeemer(
+  cardano_tx_builder_t*          builder,
+  cardano_proposal_procedure_t*  proposal,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context);
+
+/**
+ * \brief Proposes a parameter change within a Cardano transaction.
+ *
+ * This function adds a parameter change proposal to the transaction being built. The proposal specifies
+ * updates to protocol parameters, a governance action ID, and other metadata associated with the proposal.
+ *
+ * This convenience function uses Plutus unit (`d87980`) as the proposing redeemer.
+ * Use \ref cardano_tx_builder_add_proposal for a custom redeemer, or
+ * \ref cardano_tx_builder_add_proposal_with_deferred_redeemer to compute it after balancing.
+ *
+ * \param[in, out] builder A pointer to the \ref cardano_tx_builder_t instance used to build the transaction.
+ * \param[in] reward_address A pointer to a \ref cardano_reward_address_t where the deposit will be refunded.
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object representing the anchor for the proposal. This parameter must not be NULL.
+ * \param[in] protocol_param_update A pointer to a \ref cardano_protocol_param_update_t object containing the protocol parameter updates.
+ *                                  This parameter must not be NULL.
+ * \param[in] governance_action_id A pointer to a \ref cardano_governance_action_id_t object referencing the most recent enacted action of the same type.
+ *                                 This parameter can be NULL if no proposals of this type have been enacted on the network.
+ * \param[in] policy_hash A pointer to a \ref cardano_blake2b_hash_t object representing the guardrails script hash (also known as the governance action policy script).
+ *                        This parameter is required for certain types of proposals to ensure compliance with governance guardrails.
+ *
+ * \note The `governance_action_id` is used to reference the most recent enacted governance action of the same type. If no such
+ *       action has been enacted on the network, this parameter can be NULL. The `policy_hash` represents the hash of the guardrails script,
+ *       which imposes additional constraints on governance actions such as protocol parameter updates.
+ *
+ * \note Any errors encountered during the addition of the parameter change proposal will be deferred until
+ *       \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = cardano_tx_builder_new(...); // Assume builder is initialized
+ * cardano_reward_address_t* reward_address = ...; // Assume initialized
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Assume initialized
+ * cardano_protocol_param_update_t* param_update = cardano_protocol_param_update_new(...); // Assume initialized
+ * cardano_governance_action_id_t* action_id = cardano_governance_action_id_new(...); // Optionally initialized
+ * cardano_blake2b_hash_t* policy_hash = cardano_blake2b_hash_new(...); // Assume initialized
+ *
+ * cardano_tx_builder_propose_parameter_change(builder, reward_address, anchor, param_update, action_id, policy_hash);
+ *
+ * // Cleanup when done
+ * cardano_reward_address_unref(&reward_address);
+ * cardano_anchor_unref(&anchor);
+ * cardano_protocol_param_update_unref(&param_update);
+ * if (action_id)
+ * {
+ *   cardano_governance_action_id_unref(&action_id);
+ * }
+ * cardano_blake2b_hash_unref(&policy_hash);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_parameter_change(
+  cardano_tx_builder_t*            builder,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_blake2b_hash_t*          policy_hash);
+
+/**
+ * \brief Proposes a parameter change within a Cardano transaction (extended version).
+ *
+ * This function allows the inclusion of a parameter change proposal into the transaction being built, using string representations for key parameters
+ * such as reward addresses, metadata, governance action IDs, and policy hashes.
+ *
+ * This convenience function uses Plutus unit (`d87980`) as the proposing redeemer.
+ * Use \ref cardano_tx_builder_add_proposal for a custom redeemer, or
+ * \ref cardano_tx_builder_add_proposal_with_deferred_redeemer to compute it after balancing.
+ *
+ * \param[in, out] builder A pointer to the \ref cardano_tx_builder_t instance used to build the transaction.
+ * \param[in] reward_address A string representation of the reward address where the deposit will be refunded.
+ * \param[in] reward_address_size The size (in bytes) of the `reward_address` string.
+ * \param[in] metadata_url A string containing the URL pointing to additional metadata for the proposal. This can be NULL if not applicable.
+ * \param[in] metadata_url_size The size (in bytes) of the `metadata_url` string.
+ * \param[in] metadata_hash_hex A hexadecimal string representing the hash of the metadata contents.
+ * \param[in] metadata_hash_hex_size The size (in bytes) of the `metadata_hash_hex` string.
+ * \param[in] gov_action_id A CIP-0129 bech32 string representing the governance action ID that references the most recent enacted action of the same type.
+ * \param[in] gov_action_id_size The size (in bytes) of the `gov_action_id` string.
+ * \param[in] policy_hash_hash_hex A hexadecimal string representing the guardrails script hash (also known as the governance action policy script).
+ * \param[in] policy_hash_hash_hex_size The size (in bytes) of the `policy_hash_hash_hex` string.
+ * \param[in] protocol_param_update A pointer to a \ref cardano_protocol_param_update_t object containing the protocol parameter updates.
+ *                                  This parameter must not be NULL.
+ *
+ * \note The `gov_action_id` references the most recent enacted governance action of the same type. If no such action has been enacted,
+ *       this parameter can be NULL. The `policy_hash_hash_hex` represents the hash of the guardrails script, which imposes additional constraints
+ *       on certain governance actions such as protocol parameter updates.
+ *
+ * \note Errors encountered during the addition of the parameter change proposal will be deferred until \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = cardano_tx_builder_new(...); // Assume builder is initialized
+ * const char* reward_address = "stake1u9hwrj..."; // Reward address in Bech32
+ * const char* metadata_url = "https://example.com/metadata.json"; // Metadata URL
+ * const char* metadata_hash = "d2a4f89b..."; // Metadata hash in hexadecimal
+ * const char* gov_action_id = "gov_action1..."; // Governance action ID in CIP-129 format
+ * const char* policy_hash = "f4a6b3e..."; // Policy hash in hexadecimal
+ * cardano_protocol_param_update_t* param_update = cardano_protocol_param_update_new(...); // Assume initialized
+ *
+ * cardano_tx_builder_propose_parameter_change_ex(builder,
+ *                                                reward_address, strlen(reward_address),
+ *                                                metadata_url, strlen(metadata_url),
+ *                                                metadata_hash, strlen(metadata_hash),
+ *                                                gov_action_id, strlen(gov_action_id),
+ *                                                policy_hash, strlen(policy_hash),
+ *                                                param_update);
+ *
+ * // Cleanup when done
+ * cardano_protocol_param_update_unref(&param_update);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_parameter_change_ex(
+  cardano_tx_builder_t*            builder,
+  const char*                      reward_address,
+  size_t                           reward_address_size,
+  const char*                      metadata_url,
+  size_t                           metadata_url_size,
+  const char*                      metadata_hash_hex,
+  size_t                           metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  size_t                           gov_action_id_size,
+  const char*                      policy_hash_hash_hex,
+  size_t                           policy_hash_hash_hex_size,
+  cardano_protocol_param_update_t* protocol_param_update);
+
+/**
+ * \brief Proposes a hard fork within a Cardano transaction.
+ *
+ * This function adds a proposal to initiate a hard fork in the Cardano network to the transaction being built. The hard fork proposal
+ * specifies the target protocol version and other required parameters. An optional governance action ID can be provided to reference
+ * the most recent enacted hard fork action of the same type.
+ *
+ * \param[in, out] builder A pointer to the \ref cardano_tx_builder_t instance used to build the transaction.
+ * \param[in] reward_address A pointer to a \ref cardano_reward_address_t object where the deposit will be refunded if the proposal is accepted.
+ * \param[in] anchor A pointer to a \ref cardano_anchor_t object containing additional metadata related to the proposal.
+ * \param[in] version A pointer to a \ref cardano_protocol_version_t object specifying the target protocol version for the hard fork.
+ * \param[in] governance_action_id An optional pointer to a \ref cardano_governance_action_id_t object referencing the most recent
+ *                                 enacted governance action of the same type. This can be NULL if no such action has been enacted.
+ *
+ * \note The `governance_action_id` parameter is required to reference the last enacted hard fork action. If no hard fork proposals
+ *       have been enacted yet, this parameter can be NULL.
+ *
+ * \note Errors encountered during the addition of the hard fork proposal will be deferred until \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = cardano_tx_builder_new(...); // Assume builder is initialized
+ * cardano_reward_address_t* reward_address = cardano_reward_address_new(...); // Assume initialized
+ * cardano_anchor_t* anchor = cardano_anchor_new(...); // Assume initialized
+ * cardano_protocol_version_t* version = cardano_protocol_version_new(8, 0); // Example protocol version
+ * cardano_governance_action_id_t* gov_action_id = cardano_governance_action_id_new(...); // Optional, assume initialized
+ *
+ * cardano_tx_builder_propose_hardfork(builder, reward_address, anchor, version, gov_action_id);
+ *
+ * // Cleanup resources when done
+ * cardano_reward_address_unref(&reward_address);
+ * cardano_anchor_unref(&anchor);
+ * cardano_protocol_version_unref(&version);
+ * cardano_governance_action_id_unref(&gov_action_id);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_hardfork(
+  cardano_tx_builder_t*           builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_protocol_version_t*     version,
+  cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Proposes a hard fork within a Cardano transaction (extended version).
+ *
+ * This function adds a proposal to initiate a hard fork in the Cardano network to the transaction being built. The hard fork proposal
+ * specifies the target protocol version, metadata details, and other required parameters. The proposal includes a governance action ID
+ * to reference the most recent enacted action of the same type.
+ *
+ * \param[in, out] builder A pointer to the \ref cardano_tx_builder_t instance used to build the transaction.
+ * \param[in] reward_address A pointer to the reward address string where the deposit will be refunded if the proposal is accepted.
+ *                           This must be a valid Bech32-encoded reward address.
+ * \param[in] reward_address_size The size of the reward address string in bytes.
+ * \param[in] metadata_url A pointer to the URL string containing metadata about the hard fork proposal.
+ * \param[in] metadata_url_size The size of the metadata URL string in bytes.
+ * \param[in] metadata_hash_hex A pointer to the hexadecimal string representing the hash of the metadata file.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] gov_action_id A CIP-0129 bech32 string representing the governance action ID that references the most recent enacted action of the same type.
+ * \param[in] gov_action_id_size The size (in bytes) of the `gov_action_id` string.
+ * \param[in] minor_protocol_version The minor protocol version for the proposed hard fork.
+ * \param[in] major_protocol_version The major protocol version for the proposed hard fork.
+ *
+ * \note The `gov_action_id` parameters reference the most recent enacted governance action of the same type.
+ *
+ * \note Errors encountered during the addition of the hard fork proposal will be deferred until \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = cardano_tx_builder_new(...); // Assume builder is initialized
+ * const char* reward_address = "stake1u..."; // Example reward address
+ * size_t reward_address_size = strlen(reward_address);
+ * const char* metadata_url = "https://example.com/metadata.json";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash = "abcdef1234567890..."; // Example metadata hash
+ * size_t metadata_hash_size = strlen(metadata_hash);
+ * const char* gov_action_id = "gov_action1..."; // Example governance action ID
+ * size_t gov_action_id_size = strlen(gov_action_id);
+ * uint64_t minor_version = 1; // Example minor protocol version
+ * uint64_t major_version = 8; // Example major protocol version
+ *
+ * cardano_tx_builder_propose_hardfork_ex(
+ *   builder,
+ *   reward_address,
+ *   reward_address_size,
+ *   metadata_url,
+ *   metadata_url_size,
+ *   metadata_hash,
+ *   metadata_hash_size,
+ *   gov_action_id,
+ *   gov_action_id_size,
+ *   minor_version,
+ *   major_version
+ * );
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_hardfork_ex(
+  cardano_tx_builder_t* builder,
+  const char*           reward_address,
+  size_t                reward_address_size,
+  const char*           metadata_url,
+  size_t                metadata_url_size,
+  const char*           metadata_hash_hex,
+  size_t                metadata_hash_hex_size,
+  const char*           gov_action_id,
+  size_t                gov_action_id_size,
+  uint64_t              minor_protocol_version,
+  uint64_t              major_protocol_version);
+
+/**
+ * \brief Proposes treasury withdrawals as a governance action within the Cardano network.
+ *
+ * This function prepares a proposal to withdraw funds from the treasury.
+ *
+ * This convenience function uses Plutus unit (`d87980`) as the proposing redeemer.
+ * Use \ref cardano_tx_builder_add_proposal for a custom redeemer, or
+ * \ref cardano_tx_builder_add_proposal_with_deferred_redeemer to compute it after balancing.
+ *
+ * \param[in,out] builder       A pointer to an initialized \ref cardano_tx_builder_t object used to build the transaction.
+ * \param[in]     reward_address A pointer to a \ref cardano_reward_address_t object representing the address that will receive the deposit refund.
+ * \param[in]     anchor        A pointer to an initialized \ref cardano_anchor_t object containing metadata about the proposal.
+ * \param[in]     withdrawals   A pointer to a \ref cardano_withdrawal_map_t object defining the requested treasury withdrawals.
+ * \param[in]     policy_hash   A pointer to a \ref cardano_blake2b_hash_t object representing the guardrails script hash.
+ *
+ * \note The `policy_hash` parameter represents the hash of the guardrails script, a Plutus script that imposes constraints
+ *       on treasury withdrawals and other governance actions. If no policy constraints apply, this parameter can be NULL.
+ *
+ * \note Any errors encountered during the addition of the treasury withdrawals proposal will be deferred until
+ *       \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = ...;  // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...; // Reward address for deposit refund
+ * cardano_anchor_t* anchor = cardano_anchor_new("metadata_url", metadata_hash);  // Metadata for the proposal
+ * cardano_withdrawal_map_t* withdrawals = ...; // Treasury withdrawals
+ * cardano_blake2b_hash_t* policy_hash = ...;   // Guardrails script hash
+ *
+ * cardano_tx_builder_propose_treasury_withdrawals(builder, reward_address, anchor, withdrawals, policy_hash);
+ * \endcode
+ *
+ * \note Ensure the `withdrawals` object is populated with valid treasury withdrawal requests before calling this function.
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_treasury_withdrawals(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor,
+  cardano_withdrawal_map_t* withdrawals,
+  cardano_blake2b_hash_t*   policy_hash);
+
+/**
+ * \brief Proposes treasury withdrawals as a governance action within the Cardano network, using string-based parameters.
+ *
+ * This function prepares a proposal for withdrawing funds from the treasury.
+ *
+ * This convenience function uses Plutus unit (`d87980`) as the proposing redeemer.
+ * Use \ref cardano_tx_builder_add_proposal for a custom redeemer, or
+ * \ref cardano_tx_builder_add_proposal_with_deferred_redeemer to compute it after balancing.
+ *
+ * \param[in,out] builder                 A pointer to an initialized \ref cardano_tx_builder_t object used to build the transaction.
+ * \param[in]     reward_address          A pointer to the reward address string for receiving the deposit refund. Must be a valid Bech32 address.
+ * \param[in]     reward_address_size     The size of the reward address string.
+ * \param[in]     metadata_url            A pointer to the metadata URL string providing additional proposal context.
+ * \param[in]     metadata_url_size       The size of the metadata URL string.
+ * \param[in]     metadata_hash_hex       A pointer to the hexadecimal string representation of the metadata hash.
+ * \param[in]     metadata_hash_hex_size  The size of the metadata hash string.
+ * \param[in]     policy_hash_hash_hex    A pointer to the hexadecimal string representation of the guardrails script hash.
+ * \param[in]     policy_hash_hash_hex_size The size of the guardrails script hash string.
+ * \param[in]     withdrawals             A pointer to a \ref cardano_withdrawal_map_t object defining the requested treasury withdrawals.
+ *
+ * \note The `policy_hash_hash_hex` parameter represents the guardrails script hash. This Plutus script imposes additional constraints
+ *       on treasury withdrawals and other governance actions. If no policy constraints apply, this parameter can be NULL.
+ *
+ * \note Any errors encountered during the addition of the treasury withdrawals proposal will be deferred until
+ *       \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = ...;  // Initialized transaction builder
+ * const char* reward_address = "stake1u9v8lkxklxyz123";  // Example reward address
+ * const char* metadata_url = "https://example.com/metadata";  // Metadata URL
+ * const char* metadata_hash = "abc123";  // Metadata hash in hex
+ * const char* policy_hash = "def456";    // Guardrails script hash in hex
+ * cardano_withdrawal_map_t* withdrawals = ...; // Treasury withdrawals
+ *
+ * cardano_tx_builder_propose_treasury_withdrawals_ex(
+ *   builder, reward_address, strlen(reward_address),
+ *   metadata_url, strlen(metadata_url), metadata_hash, strlen(metadata_hash),
+ *   policy_hash, strlen(policy_hash), withdrawals);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_treasury_withdrawals_ex(
+  cardano_tx_builder_t*     builder,
+  const char*               reward_address,
+  size_t                    reward_address_size,
+  const char*               metadata_url,
+  size_t                    metadata_url_size,
+  const char*               metadata_hash_hex,
+  size_t                    metadata_hash_hex_size,
+  const char*               policy_hash_hash_hex,
+  size_t                    policy_hash_hash_hex_size,
+  cardano_withdrawal_map_t* withdrawals);
+
+/**
+ * \brief Proposes a no-confidence governance action within the Cardano network.
+ *
+ * This function prepares a proposal for a no-confidence action against the current constitutional committee.
+ * If enacted, it signals the community's lack of confidence in the committee, potentially leading to its reconstitution.
+ *
+ * \param[in,out] builder                 A pointer to an initialized \ref cardano_tx_builder_t object used to build the transaction.
+ * \param[in]     reward_address          A pointer to a \ref cardano_reward_address_t object. This address will receive the deposit refund after the governance action completes.
+ * \param[in]     anchor                  A pointer to a \ref cardano_anchor_t object providing additional context or metadata for the governance action.
+ * \param[in]     governance_action_id    An optional pointer to a \ref cardano_governance_action_id_t object. This represents the unique identifier
+ *                                         for the most recently enacted no-confidence action of the same type. This parameter can be NULL if no previous actions of this type exist.
+ *
+ * \note The `governance_action_id` parameter ensures that the proposal references the latest enacted governance action of the same type, as required by the Cardano protocol.
+ *
+ * \note Any errors encountered during the addition of the no-confidence proposal will be deferred until
+ *       \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = ...;                // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...;     // Example reward address
+ * cardano_anchor_t* anchor = ...;                     // Example anchor object
+ * cardano_governance_action_id_t* action_id = ...;    // Example governance action ID (optional)
+ *
+ * cardano_tx_builder_propose_no_confidence(builder, reward_address, anchor, action_id);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_no_confidence(
+  cardano_tx_builder_t*           builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Proposes a no-confidence governance action using extended parameters.
+ *
+ * This function prepares a proposal for a no-confidence action against the current constitutional committee within the Cardano network.
+ *
+ * \param[in,out] builder                A pointer to an initialized \ref cardano_tx_builder_t object used to build the transaction.
+ * \param[in]     reward_address         A pointer to a string containing the Bech32-encoded reward address. This address will receive the deposit refund
+ *                                        after the governance action completes.
+ * \param[in] reward_address_size    The size of the reward address string in bytes.
+ * \param[in] metadata_url           A pointer to a string containing the metadata URL for additional context regarding the proposal.
+ * \param[in] metadata_url_size      The size of the metadata URL string in bytes.
+ * \param[in] metadata_hash_hex      A pointer to a string containing the hexadecimal representation of the metadata hash.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] gov_action_id A CIP-0129 bech32 string representing the governance action ID that references the most recent enacted action of the same type.
+ * \param[in] gov_action_id_size The size (in bytes) of the `gov_action_id` string.
+ *
+ * \note The `gov_action_id` ensure that the proposal references the latest enacted governance action of the same type,
+ *       as required by the Cardano protocol. These can be omitted (set to NULL or 0) if no prior actions of this type exist.
+ *
+ * \note Any errors encountered during the addition of the no-confidence proposal will be deferred until
+ *       \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = ...;                // Initialized transaction builder
+ * const char* reward_address = "stake1u9...";         // Example reward address
+ * size_t reward_address_size = strlen(reward_address);
+ * const char* metadata_url = "https://example.com";   // Example metadata URL
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash_hex = "a1b2c3...";        // Example metadata hash (hex-encoded)
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex);
+ * const char* gov_action_id = "gov_action1...";      // Example governance action ID (hex-encoded)
+ * size_t gov_action_id_size = strlen(gov_action_id);
+ *
+ * cardano_tx_builder_propose_no_confidence_ex(builder, reward_address, reward_address_size,
+ *                                             metadata_url, metadata_url_size, metadata_hash_hex,
+ *                                             metadata_hash_hex_size, gov_action_id,
+ *                                             gov_action_id_size);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_no_confidence_ex(
+  cardano_tx_builder_t* builder,
+  const char*           reward_address,
+  size_t                reward_address_size,
+  const char*           metadata_url,
+  size_t                metadata_url_size,
+  const char*           metadata_hash_hex,
+  size_t                metadata_hash_hex_size,
+  const char*           gov_action_id,
+  size_t                gov_action_id_size);
+
+/**
+ * \brief Proposes an update to the Cardano constitutional committee.
+ *
+ * This function prepares a governance action to update the Cardano constitutional committee. The proposal specifies:
+ * - Committee members to be added.
+ * - Committee members to be removed.
+ * - The new quorum threshold for the committee.
+ *
+ * \param[in,out] builder                A pointer to an initialized \ref cardano_tx_builder_t object used to build the transaction.
+ * \param[in]     reward_address         A pointer to a \ref cardano_reward_address_t object representing the reward address that will receive the deposit refund.
+ * \param[in]     anchor                 A pointer to a \ref cardano_anchor_t object representing the anchor for this governance action.
+ * \param[in]     governance_action_id   An optional pointer to a \ref cardano_governance_action_id_t object representing the most recently enacted governance action
+ *                                        of the same type. Can be NULL if no such prior action exists.
+ * \param[in]     members_to_be_removed  A pointer to a \ref cardano_credential_set_t object specifying the committee members to be removed.
+ * \param[in]     members_to_be_added    A pointer to a \ref cardano_committee_members_map_t object specifying the committee members to be added.
+ * \param[in]     new_quorum             A pointer to a \ref cardano_unit_interval_t object specifying the new quorum threshold for the committee.
+ *
+ * \note If a prior governance action of the same type exists, the `governance_action_id` parameter must reference it.
+ *
+ * \note Any errors encountered during the addition of the update to the Cardano constitutional committee proposal will be deferred until
+ *       \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = ...;                // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...;     // Reward address to receive refund
+ * cardano_anchor_t* anchor = ...;                     // Governance action anchor
+ * cardano_governance_action_id_t* gov_action_id = ...;// Most recently enacted action ID
+ * cardano_credential_set_t* members_to_remove = ...;  // Members to be removed
+ * cardano_committee_members_map_t* members_to_add = ...; // Members to be added
+ * cardano_unit_interval_t* new_quorum = ...;          // New quorum threshold
+ *
+ * cardano_tx_builder_propose_update_committee(builder, reward_address, anchor,
+ *                                             gov_action_id, members_to_remove,
+ *                                             members_to_add, new_quorum);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_update_committee(
+  cardano_tx_builder_t*            builder,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  cardano_unit_interval_t*         new_quorum);
+
+/**
+ * \brief Proposes an update to the Cardano constitutional committee with extended parameters.
+ *
+ * This function creates a governance action to update the Cardano constitutional committee.
+ *
+ * \param[in,out] builder                A pointer to an initialized \ref cardano_tx_builder_t object used to build the transaction.
+ * \param[in]     reward_address         A pointer to a string containing the reward address (in Bech32 format) that will receive the deposit refund.
+ * \param[in]     reward_address_size    The size of the `reward_address` string.
+ * \param[in]     metadata_url           A pointer to a string containing the URL for the governance action metadata.
+ * \param[in]     metadata_url_size      The size of the `metadata_url` string.
+ * \param[in]     metadata_hash_hex      A pointer to a string containing the hex-encoded hash of the metadata file.
+ * \param[in]     metadata_hash_hex_size The size of the `metadata_hash_hex` string.
+ * \param[in]     gov_action_id          A CIP-0129 bech32 string representing the governance action ID that references the most recent enacted action of the same type.
+ * \param[in]     gov_action_id_size     The size (in bytes) of the `gov_action_id` string.
+ * \param[in]     members_to_be_removed  A pointer to a \ref cardano_credential_set_t object specifying the committee members to be removed.
+ * \param[in]     members_to_be_added    A pointer to a \ref cardano_committee_members_map_t object specifying the committee members to be added.
+ * \param[in]     new_quorum             The new quorum threshold for the committee.
+ *
+ * \note Any errors encountered during the addition of the update to the Cardano constitutional committee proposal will be deferred until
+ *       \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = ...;                // Initialized transaction builder
+ * const char* reward_address = "addr1...";            // Bech32 reward address
+ * size_t reward_address_size = strlen(reward_address);
+ * const char* metadata_url = "https://example.com/proposal.json";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash_hex = "abc123...";        // Hex-encoded hash of metadata file
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex);
+ * const char* gov_action_id = "gov_action1...";      // Optional governance action ID
+ * size_t gov_action_id_size = strlen(gov_action_id);
+ * cardano_credential_set_t* members_to_remove = ...;  // Members to be removed
+ * cardano_committee_members_map_t* members_to_add = ...; // Members to be added
+ *
+ * cardano_tx_builder_propose_update_committee_ex(builder,
+ *                                                reward_address, reward_address_size,
+ *                                                metadata_url, metadata_url_size,
+ *                                                metadata_hash_hex, metadata_hash_hex_size,
+ *                                                gov_action1, gov_action1_size,
+ *                                                members_to_remove,
+ *                                                members_to_add,
+ *                                                0.3);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_update_committee_ex(
+  cardano_tx_builder_t*            builder,
+  const char*                      reward_address,
+  size_t                           reward_address_size,
+  const char*                      metadata_url,
+  size_t                           metadata_url_size,
+  const char*                      metadata_hash_hex,
+  size_t                           metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  size_t                           gov_action_id_size,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  double                           new_quorum);
+
+/**
+ * \brief Proposes a new constitution for the Cardano network.
+ *
+ * This function creates a governance action to propose a new constitution.
+ *
+ * \param[in,out] builder                A pointer to an initialized \ref cardano_tx_builder_t object used to build the transaction.
+ * \param[in]     reward_address         A pointer to a \ref cardano_reward_address_t object representing the address that will receive the deposit refund.
+ * \param[in]     anchor                 A pointer to a \ref cardano_anchor_t object containing the anchor metadata for the proposal.
+ * \param[in]     governance_action_id   An optional pointer to a \ref cardano_governance_action_id_t object representing the governance action ID of the most
+ *                                        recently enacted action of the same type. This parameter can be NULL if no prior action exists.
+ * \param[in]     constitution           A pointer to a \ref cardano_constitution_t object containing the new constitution's details.
+ *
+ * \note The `governance_action_id` parameter ensures compliance with the protocol's requirement of referencing the most recently enacted action of the same type.
+ *       If no such prior action exists, this parameter can be omitted (set to NULL).
+ *
+ * \note Any errors encountered during the addition of the new constitution proposal will be deferred until \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = ...;                  // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...;       // Reward address to refund deposit
+ * cardano_anchor_t* anchor = ...;                       // Anchor metadata
+ * cardano_governance_action_id_t* gov_action_id = ...;  // Optional governance action ID
+ * cardano_constitution_t* constitution = ...;           // Constitution details
+ *
+ * cardano_tx_builder_propose_new_constitution(builder, reward_address, anchor, gov_action_id, constitution);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_new_constitution(
+  cardano_tx_builder_t*           builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id,
+  cardano_constitution_t*         constitution);
+
+/**
+ * \brief Proposes a new constitution for the Cardano network.
+ *
+ * This function allows creating a governance action to propose a new constitution while providing additional metadata
+ * (e.g., URL and hash).
+ *
+ * \param[in,out] builder              A pointer to an initialized \ref cardano_tx_builder_t object used to build the transaction.
+ * \param[in]     reward_address       A pointer to the reward address as a string. The address will receive the deposit refund.
+ * \param[in]     reward_address_size  The size of the reward address string in bytes.
+ * \param[in]     metadata_url         A pointer to a string containing the URL for additional proposal metadata.
+ * \param[in]     metadata_url_size    The size of the metadata URL string in bytes.
+ * \param[in]     metadata_hash_hex    A pointer to a hexadecimal string representing the hash of the metadata file.
+ * \param[in]     metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in]     gov_action_id          A CIP-0129 bech32 string representing the governance action ID that references the most recent enacted action of the same type.
+ * \param[in]     gov_action_id_size     The size (in bytes) of the `gov_action_id` string.
+ * \param[in]     constitution         A pointer to a \ref cardano_constitution_t object containing the new constitution's details.
+ *
+ * \note Any errors encountered during the addition of the new constitution proposal will be deferred until \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = ...;                 // Initialized transaction builder
+ * const char* reward_address = "addr1...";             // Reward address string
+ * size_t reward_address_size = strlen(reward_address); // Size of the reward address string
+ * const char* metadata_url = "https://example.com";    // Metadata URL string
+ * size_t metadata_url_size = strlen(metadata_url);     // Size of the metadata URL string
+ * const char* metadata_hash_hex = "abc123...";         // Metadata hash in hexadecimal
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex); // Size of the metadata hash string
+ * const char* gov_action_id = "gov_action1...";       // Governance action ID in hexadecimal
+ * size_t gov_action_id_size = strlen(gov_action_id); // Size of the governance action ID string
+ * cardano_constitution_t* constitution = ...;          // Constitution details
+ *
+ * cardano_tx_builder_propose_new_constitution_ex(
+ *   builder, reward_address, reward_address_size,
+ *   metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size,
+ *   gov_action_id, gov_action_id_size, constitution);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_new_constitution_ex(
+  cardano_tx_builder_t*   builder,
+  const char*             reward_address,
+  size_t                  reward_address_size,
+  const char*             metadata_url,
+  size_t                  metadata_url_size,
+  const char*             metadata_hash_hex,
+  size_t                  metadata_hash_hex_size,
+  const char*             gov_action_id,
+  size_t                  gov_action_id_size,
+  cardano_constitution_t* constitution);
+
+/**
+ * \brief Proposes an informational governance action for the Cardano network.
+ *
+ * This function creates a governance action proposal to share information with the network.
+ *
+ * \param[in,out] builder        A pointer to an initialized \ref cardano_tx_builder_t object used to build the transaction.
+ * \param[in]     reward_address A pointer to the reward address where the deposit refund will be sent if the proposal is enacted or discarded.
+ * \param[in]     anchor         A pointer to a \ref cardano_anchor_t object containing metadata such as URLs and hashes to link to external information.
+ *
+ * \note Any errors encountered during the addition of the informational proposal will be deferred until \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = ...;            // Initialized transaction builder
+ * cardano_reward_address_t* reward_address = ...; // Reward address for deposit refund
+ * cardano_anchor_t* anchor = ...;                 // Anchor metadata for the proposal
+ *
+ * cardano_tx_builder_propose_info(builder, reward_address, anchor);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_info(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor);
+
+/**
+ * \brief Proposes an informational governance action for the Cardano network.
+ *
+ * This function creates a governance action proposal to share information with the network.
+ *
+ * \param[in,out] builder              A pointer to an initialized \ref cardano_tx_builder_t object used to build the transaction.
+ * \param[in]     reward_address       A pointer to the reward address in string format where the deposit refund will be sent if the proposal is enacted or discarded.
+ * \param[in]     reward_address_size  The size of the reward address string in bytes.
+ * \param[in]     metadata_url         A pointer to a string containing the URL for the proposal metadata. This parameter is optional and can be NULL if no URL is provided.
+ * \param[in]     metadata_url_size    The size of the metadata URL string in bytes. Set to 0 if no URL is provided.
+ * \param[in]     metadata_hash_hex    A pointer to a string containing the hexadecimal hash of the metadata. This parameter is optional and can be NULL if no hash is provided.
+ * \param[in]     metadata_hash_hex_size The size of the metadata hash string in bytes. Set to 0 if no hash is provided.
+ *
+ * \note Any errors encountered during the addition of the informational proposal will be deferred until \ref cardano_tx_builder_build is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* builder = ...;   // Initialized transaction builder
+ * const char* reward_address = "addr1..."; // Reward address as a string
+ * size_t reward_address_size = strlen(reward_address);
+ * const char* metadata_url = "https://example.com/proposal-metadata";
+ * size_t metadata_url_size = strlen(metadata_url);
+ * const char* metadata_hash_hex = "abcdef123456...";
+ * size_t metadata_hash_hex_size = strlen(metadata_hash_hex);
+ *
+ * cardano_tx_builder_propose_info_ex(
+ *     builder, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_tx_builder_propose_info_ex(
+  cardano_tx_builder_t* builder,
+  const char*           reward_address,
+  size_t                reward_address_size,
+  const char*           metadata_url,
+  size_t                metadata_url_size,
+  const char*           metadata_hash_hex,
+  size_t                metadata_hash_hex_size);
+
+/**
+ * \brief Builds the transaction from the current state of the transaction builder.
+ *
+ * This function finalizes the transaction by aggregating all previously added inputs, outputs, certificates, and other data.
+ * If any required data is missing or incorrect, this function will report the errors encountered during the build process.
+ * When the transaction or one of its sub transactions has redeemers, the collateral change address and a non empty list of collateral UTXOs must be set, see
+ * \ref cardano_tx_builder_set_collateral_utxos.
+ * See \ref cardano_tx_builder_add_sub_transaction for the failures that are specific to a transaction that carries
+ * sub transactions, such as a missing required top level guard, sub transactions that do not balance or collateral
+ * UTXOs that are all used by the sub transactions.
+ * The ledger does not allow a UTXO to be both spent and referenced under protocol versions 9 and 10, so when the major
+ * protocol version of the protocol parameters is 9 or 10, coin selection never picks a UTXO added as a reference input,
+ * and a UTXO added both with \ref cardano_tx_builder_add_input and as a reference input makes this function return
+ * \ref CARDANO_ERROR_DUPLICATED_KEY. Other protocol versions, and protocol parameters whose major protocol version is 0,
+ * allow the overlap.
+ * Like the ledger, every script purpose of the balanced transaction whose script resolves to a PlutusV1, PlutusV2,
+ * PlutusV3 or PlutusV4 script must have a redeemer: spending an input locked by the script, minting under its policy,
+ * withdrawing from a reward account it controls, carrying a certificate it must authorize, voting with it as the voter,
+ * carrying a proposal it guards as the guardrails script or listing it among the guards. The scripts are looked up
+ * among the ones provided to the whole batch: the scripts added with \ref cardano_tx_builder_add_script, the scripts
+ * of the witness sets of the sub transactions and the reference scripts of the reference inputs, the spent inputs and
+ * the UTXOs the sub transactions spend or reference. From protocol version 12, this includes reference scripts in
+ * newly created outputs at both levels and in collateral return. A purpose without its redeemer makes this function return
+ * \ref CARDANO_ERROR_MISSING_REDEEMER, and the last error names the purpose, its redeemer index and the script hash.
+ * The script purposes of every sub transaction of the batch are checked the same way: the purposes of the body of the
+ * sub transaction, whose spend indices count its own sorted inputs, must have a redeemer in its own witness set
+ * whenever their script resolves to a Plutus script provided to the whole batch, even when only the transaction or
+ * another sub transaction provides it. For a sub transaction the last error also names its id and its zero based
+ * index in the batch. A purpose whose script is a native script needs no redeemer, and a purpose whose script is not
+ * provided is not reported.
+ *
+ * \param[in] builder A pointer to the \ref cardano_tx_builder_t instance that manages the transaction details.
+ * \param[out] transaction A pointer to a \ref cardano_transaction_t pointer where the created transaction will be stored upon success.
+ *
+ * \returns \ref CARDANO_SUCCESS if the transaction was successfully built, or an appropriate error code if issues were detected.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_transaction_t* transaction = NULL;
+ * cardano_tx_builder_t* tx_builder   = ...; // Initialized transaction builder
+ *
+ * cardano_tx_builder_withdraw_rewards_ex(tx_builder, "stake...", size, NULL);                      // Withdraw rewards
+ * cardano_tx_builder_send_lovelace_ex(tx_builder, "add...", size, 50000);                          // Add inputs, outputs, and other transaction details
+ * cardano_tx_builder_set_invalid_after(tx_builder, 1000);                                          // Set the transaction validity
+ * cardano_tx_builder_mint_token_ex(tx_builder, "00ff...", policy_size, "ff09...", name_size, 100); // Mint tokens
+ *
+ * cardano_error_t result = cardano_tx_builder_build(tx_builder, &transaction);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   const char* error_msg = cardano_tx_builder_get_last_error(tx_builder);
+ *   printf("Failed to build transaction: %s\n", error_msg);
+ * }
+ * else
+ * {
+ *   // Transaction successfully built; proceed with processing
+ *   // ...
+ *   cardano_transaction_unref(&transaction);
+ * }
+ *
+ * cardano_tx_builder_unref(&tx_builder);
+ * \endcode
+ *
+ * \note All errors related to missing or invalid data will be reported upon calling this function.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_tx_builder_build(
+  cardano_tx_builder_t*   builder,
+  cardano_transaction_t** transaction);
+
+/**
+ * \brief Decrements the reference count of a cardano_tx_builder_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_tx_builder_t object
+ * by decreasing its reference count. When the reference count reaches zero, the transaction_builder is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] transaction_builder A pointer to the pointer of the transaction_builder object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_tx_builder_t* transaction_builder = cardano_tx_builder_new(major, minor);
+ *
+ * // Perform operations with the transaction_builder...
+ *
+ * cardano_tx_builder_unref(&transaction_builder);
+ * // At this point, transaction_builder is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_tx_builder_unref, the pointer to the \ref cardano_tx_builder_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_tx_builder_unref(cardano_tx_builder_t** transaction_builder);
+
+/**
+ * \brief Increases the reference count of the cardano_tx_builder_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_tx_builder_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_tx_builder_unref.
+ *
+ * \param transaction_builder A pointer to the cardano_tx_builder_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_builder is a previously created transaction_builder object
+ *
+ * cardano_tx_builder_ref(transaction_builder);
+ *
+ * // Now transaction_builder can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_tx_builder_ref there is a corresponding
+ * call to \ref cardano_tx_builder_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_tx_builder_ref(cardano_tx_builder_t* transaction_builder);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_tx_builder_t object.
+ *
+ * This function returns the number of active references to an cardano_tx_builder_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_tx_builder_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param transaction_builder A pointer to the cardano_tx_builder_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_tx_builder_t object. If the object
+ * is properly managed (i.e., every \ref cardano_tx_builder_ref call is matched with a
+ * \ref cardano_tx_builder_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming transaction_builder is a previously created transaction_builder object
+ *
+ * size_t ref_count = cardano_tx_builder_refcount(transaction_builder);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_tx_builder_refcount(const cardano_tx_builder_t* transaction_builder);
+
+/**
+ * \brief Sets the last error message for a given cardano_tx_builder_t object.
+ *
+ * Records an error message in the transaction_builder's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] transaction_builder A pointer to the \ref cardano_tx_builder_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the transaction_builder's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_tx_builder_set_last_error(
+  cardano_tx_builder_t* transaction_builder,
+  const char*           message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific transaction_builder.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_tx_builder_set_last_error for the given
+ * transaction_builder. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] transaction_builder A pointer to the \ref cardano_tx_builder_t instance whose last error
+ *                   message is to be retrieved. If the transaction_builder is NULL, the function
+ *                   returns a generic error message indicating the null transaction_builder.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified transaction_builder. If the transaction_builder is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_tx_builder_set_last_error for the same transaction_builder, or until
+ *       the transaction_builder is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_tx_builder_get_last_error(
+  const cardano_tx_builder_t* transaction_builder);
+
+/**
+ * \brief Sets known latest pool parameters for Dijkstra witness fee estimation.
+ * \param[in] builder The transaction builder.
+ * \param[in] pool_state Latest registered parameters, pending preferred over active, one entry per pool.
+ * See \ref cardano_transaction_get_unique_signers_with_pool_state for state requirements.
+ * \param[in] pool_state_size Number of entries. NULL with zero clears the snapshot.
+ * \return Success, a null argument error, or an allocation/clone error. On failure the old snapshot remains.
+ * \note Takes deep copies. This changes witness estimates only; it does not change pool deposit accounting.
+ */
+CARDANO_EXPORT cardano_error_t cardano_tx_builder_set_pool_state(
+  cardano_tx_builder_t*         builder,
+  cardano_pool_params_t* const* pool_state,
+  size_t                        pool_state_size);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_TRANSACTION_BUILDER_H
diff --git a/vendor/include/cardano/typedefs.h b/vendor/include/cardano/typedefs.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/typedefs.h
@@ -0,0 +1,45 @@
+/**
+ * \file typedefs.h
+ *
+ * \author angel.castillo
+ * \date   Sep 09, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_TYPEDEFS_H_
+#define BIGLUP_LABS_INCLUDE_CARDANO_TYPEDEFS_H_
+
+/* INCLUDES ******************************************************************/
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+/* DEFINES ******************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* -E> compliant MC3R1.D4.6 2 Type byte_t shall be used everywhere where a pointer to bytes is needed to follow Strict Aliasing Rule */
+// More on the topic can be found here: https://gist.github.com/jibsen/da6be27cde4d526ee564
+typedef unsigned char byte_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* CARDANO_TYPEDEFS_H_ */
diff --git a/vendor/include/cardano/uplc/uplc_apply_params.h b/vendor/include/cardano/uplc/uplc_apply_params.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/uplc/uplc_apply_params.h
@@ -0,0 +1,87 @@
+/**
+ * \file uplc_apply_params.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_UPLC_EVALUATOR_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_UPLC_EVALUATOR_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/plutus_data/plutus_list.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Applies a list of Plutus-data parameters to a compiled Plutus script.
+ *
+ * Decodes the CBOR-wrapped, flat-encoded script in \p script_bytes into a
+ * program, applies each parameter in \p params in order (\c params[0] first, so
+ * it becomes the innermost argument), and re-encodes the result to the ledger
+ * witness-set form: the new flat program wrapped in a single CBOR bytestring.
+ *
+ * The decode peels exactly one CBOR layer, and the output is single-CBOR-wrapped,
+ * so a canonical input round-trips byte-for-byte. A non-canonical input
+ * re-encodes to the canonical form, but the resulting program is structurally
+ * equal to applying the parameters to the decoded input.
+ *
+ * The decoding and re-encoding run inside an internal arena that is freed before
+ * this returns on every path. The result \p out_script is allocated outside that
+ * arena and outlives it.
+ *
+ * \param[in] params The parameters to apply, a list of plutus-data values, or
+ *            NULL to apply no parameters. An empty or NULL list re-encodes the
+ *            script unchanged (up to canonicalization).
+ * \param[in] script_bytes The compiled script bytes, CBOR-wrapped flat. May be
+ *            NULL only when \p script_size is 0, which is rejected as a malformed
+ *            script.
+ * \param[in] script_size The number of bytes in \p script_bytes.
+ * \param[out] out_script On success, set to a newly allocated buffer holding the
+ *             CBOR-wrapped flat bytes of the parameterized script. The caller owns
+ *             it and releases it with \ref cardano_buffer_unref. Left untouched on
+ *             failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p out_script is NULL or \p script_bytes is NULL while \p script_size is
+ *         non-zero, \ref CARDANO_ERROR_DECODING if the script bytes are not a
+ *         valid CBOR-wrapped flat program, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena or an output
+ *         buffer cannot be allocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_uplc_apply_params_to_script(
+  const cardano_plutus_list_t* params,
+  const byte_t*                script_bytes,
+  size_t                       script_size,
+  cardano_buffer_t**           out_script);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_UPLC_EVALUATOR_H */
diff --git a/vendor/include/cardano/voting_procedures/governance_action_id_list.h b/vendor/include/cardano/voting_procedures/governance_action_id_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/voting_procedures/governance_action_id_list.h
@@ -0,0 +1,336 @@
+/**
+ * \file governance_action_id_list.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_ACTION_ID_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_ACTION_ID_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Each governance action that is accepted on the chain will be assigned a unique
+ * identifier, consisting of the transaction hash that created it and the index within
+ * the transaction body that points to it.
+ */
+typedef struct cardano_governance_action_id_t cardano_governance_action_id_t;
+
+/**
+ * \brief Represents a list of governance action id.
+ */
+typedef struct cardano_governance_action_id_list_t cardano_governance_action_id_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a governance_action_id_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_governance_action_id_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] governance_action_id_list On successful initialization, this will point to a newly created
+ *             \ref cardano_governance_action_id_list_t object. This object represents a "strong reference"
+ *             to the governance_action_id_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the governance_action_id_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_governance_action_id_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the governance_action_id_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_list_t* governance_action_id_list = NULL;
+ *
+ * // Attempt to create a new governance_action_id_list
+ * cardano_error_t result = cardano_governance_action_id_list_new(&governance_action_id_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the governance_action_id_list
+ *
+ *   // Once done, ensure to clean up and release the governance_action_id_list
+ *   cardano_governance_action_id_list_unref(&governance_action_id_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_list_new(cardano_governance_action_id_list_t** governance_action_id_list);
+
+/**
+ * \brief Retrieves the length of a governance action id list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_governance_action_id_list_t object.
+ *
+ * \param[in] governance_action_id_list A constant pointer to the \ref cardano_governance_action_id_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the governance_action_id_list. Return 0 if the governance_action_id_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_list_t* governance_action_id_list = cardano_governance_action_id_list_new();
+ *
+ * // Populate governance_action_id_list with elements
+ *
+ * size_t length = cardano_governance_action_id_list_get_length(governance_action_id_list);
+ * printf("Length of the governance_action_id_list: %zu\n", length);
+ *
+ * // Clean up the governance_action_id_list object once done
+ * cardano_governance_action_id_list_unref(&governance_action_id_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_governance_action_id_list_get_length(const cardano_governance_action_id_list_t* governance_action_id_list);
+
+/**
+ * \brief Retrieves an element from a governance action id list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_governance_action_id_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] governance_action_id_list A constant pointer to the \ref cardano_governance_action_id_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the governance action id list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_governance_action_id_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_governance_action_id_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_list_t* governance_action_id_list = cardano_governance_action_id_list_new();
+ *
+ * // Populate governance_action_id_list with elements
+ *
+ * cardano_governance_action_id_t* element = NULL;
+ * cardano_error_t result = cardano_governance_action_id_list_get(governance_action_id_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_governance_action_id_unref(&element);
+ * }
+ *
+ * // Clean up the governance_action_id_list object once done
+ * cardano_governance_action_id_list_unref(&governance_action_id_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_governance_action_id_list_get(const cardano_governance_action_id_list_t* governance_action_id_list, size_t index, cardano_governance_action_id_t** element);
+
+/**
+ * \brief Adds an element to a governance action id list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_governance_action_id_list_t object.
+ *
+ * \param[in] governance_action_id_list A constant pointer to the \ref cardano_governance_action_id_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_governance_action_id_t object that is to be added to the governance_action_id_list.
+ *                    The element will be referenced by the governance_action_id_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the governance_action_id_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_list_t* governance_action_id_list = cardano_governance_action_id_list_new();
+ *
+ * // Create and initialize a new governance_action_id element
+ * cardano_governance_action_id_t* element = { ... };
+ *
+ * // Add the element to the governance_action_id_list
+ * cardano_error_t result = cardano_governance_action_id_list_add(governance_action_id_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the governance_action_id_list object once done
+ * cardano_governance_action_id_list_unref(&governance_action_id_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_governance_action_id_list_add(cardano_governance_action_id_list_t* governance_action_id_list, cardano_governance_action_id_t* element);
+
+/**
+ * \brief Decrements the reference count of a governance_action_id_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_governance_action_id_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the governance_action_id_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] governance_action_id_list A pointer to the pointer of the governance_action_id_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_governance_action_id_list_t* governance_action_id_list = cardano_governance_action_id_list_new();
+ *
+ * // Perform operations with the governance_action_id_list...
+ *
+ * cardano_governance_action_id_list_unref(&governance_action_id_list);
+ * // At this point, governance_action_id_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_governance_action_id_list_unref, the pointer to the \ref cardano_governance_action_id_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_governance_action_id_list_unref(cardano_governance_action_id_list_t** governance_action_id_list);
+
+/**
+ * \brief Increases the reference count of the cardano_governance_action_id_list_t object.
+ *
+ * This function is used to manually increment the reference count of a governance_action_id_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_governance_action_id_list_unref.
+ *
+ * \param governance_action_id_list A pointer to the governance_action_id_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming governance_action_id_list is a previously created governance_action_id_list object
+ *
+ * cardano_governance_action_id_list_ref(governance_action_id_list);
+ *
+ * // Now governance_action_id_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_governance_action_id_list_ref there is a corresponding
+ * call to \ref cardano_governance_action_id_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_governance_action_id_list_ref(cardano_governance_action_id_list_t* governance_action_id_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_governance_action_id_list_t object.
+ *
+ * This function returns the number of active references to a governance_action_id_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_governance_action_id_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param governance_action_id_list A pointer to the governance_action_id_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified governance_action_id_list object. If the object
+ * is properly managed (i.e., every \ref cardano_governance_action_id_list_ref call is matched with a
+ * \ref cardano_governance_action_id_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming governance_action_id_list is a previously created governance_action_id_list object
+ *
+ * size_t ref_count = cardano_governance_action_id_list_refcount(governance_action_id_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_governance_action_id_list_refcount(const cardano_governance_action_id_list_t* governance_action_id_list);
+
+/**
+ * \brief Sets the last error message for a given governance_action_id_list object.
+ *
+ * Records an error message in the governance_action_id_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] governance_action_id_list A pointer to the \ref cardano_governance_action_id_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the governance_action_id_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_governance_action_id_list_set_last_error(cardano_governance_action_id_list_t* governance_action_id_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific governance_action_id_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_governance_action_id_list_set_last_error for the given
+ * governance_action_id_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] governance_action_id_list A pointer to the \ref cardano_governance_action_id_list_t instance whose last error
+ *                   message is to be retrieved. If the governance_action_id_list is NULL, the function
+ *                   returns a generic error message indicating the null governance_action_id_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified governance_action_id_list. If the governance_action_id_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_governance_action_id_list_set_last_error for the same governance_action_id_list, or until
+ *       the governance_action_id_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_governance_action_id_list_get_last_error(const cardano_governance_action_id_list_t* governance_action_id_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_governance_action_id_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_governance_action_id_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_governance_action_id_list_deep_clone(const cardano_governance_action_id_list_t* source, cardano_governance_action_id_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_GOVERNANCE_ACTION_ID_LIST_H
diff --git a/vendor/include/cardano/voting_procedures/vote.h b/vendor/include/cardano/voting_procedures/vote.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/voting_procedures/vote.h
@@ -0,0 +1,75 @@
+/**
+ * \file vote.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VOTE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VOTE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS *************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumeration representing possible voting choices in a Cardano voting procedure.
+ */
+typedef enum
+{
+  /**
+   * \brief Represents a "No" vote.
+   *
+   * This value indicates that the voter is against the proposal being voted on.
+   */
+  CARDANO_VOTE_NO = 0,
+
+  /**
+   * \brief Represents a "Yes" vote.
+   *
+   * This value indicates that the voter supports the proposal being voted on.
+   */
+  CARDANO_VOTE_YES = 1,
+
+  /**
+   * \brief Represents an "Abstain" vote.
+   *
+   * This value is chosen when the voter decides to abstain, neither supporting nor opposing the proposal.
+   */
+  CARDANO_VOTE_ABSTAIN = 2,
+} cardano_vote_t;
+
+/**
+ * \brief Converts voter types to their human readable form.
+ *
+ * \param[in] type The voter type to get the string representation for.
+ * \return Human readable form of the given voter type.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_vote_to_string(cardano_vote_t type);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VOTE_H
diff --git a/vendor/include/cardano/voting_procedures/voter.h b/vendor/include/cardano/voting_procedures/voter.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/voting_procedures/voter.h
@@ -0,0 +1,581 @@
+/**
+ * \file voter.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VOTER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VOTER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+#include <cardano/voting_procedures/voter_type.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A voter is any participant with an eligible role who either has a direct stake or has delegated their stake,
+ * and they exercise their rights by casting votes on governance actions. The weight or influence of their vote
+ * is determined by the amount of their active stake or the stake that's been delegated to them.
+ *
+ * Various roles in the Cardano ecosystem can participate in voting. This includes constitutional committee members,
+ * DReps (Delegation Representatives), and SPOs (Stake Pool Operators).
+ */
+typedef struct cardano_voter_t cardano_voter_t;
+
+/**
+ * \brief Creates and initializes a new instance of a voter.
+ *
+ * This function creates and initializes a new instance of a \ref cardano_voter_t object based on the specified voter type and credentials.
+ * It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[in] voter_type The type of the voter to create.
+ * \param[in] credential A pointer to the \ref cardano_credential_t object containing the credentials of the voter. The object must not be NULL.
+ * \param[out] voter On successful initialization, this will point to a newly created
+ *             \ref cardano_voter_t object. This object represents a "strong reference"
+ *             to the voter, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the voter is no longer needed, the caller must release it
+ *             by calling \ref cardano_voter_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the voter was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_credential_t* credential = cardano_credential_new(...);
+ * cardano_voter_t* voter = NULL;
+ *
+ * // Attempt to create a new voter
+ * cardano_error_t result = cardano_voter_new(CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_KEY_HASH, credential, &voter);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the voter
+ *
+ *   // Once done, ensure to clean up and release the voter
+ *   cardano_voter_unref(&voter);
+ * }
+ *
+ * // Clean up the credential object once done
+ * cardano_credential_unref(&credential);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_voter_new(
+  cardano_voter_type_t  voter_type,
+  cardano_credential_t* credential,
+  cardano_voter_t**     voter);
+
+/**
+ * \brief Creates a voter from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_voter_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a voter.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded voter data.
+ * \param[out] voter A pointer to a pointer of \ref cardano_voter_t that will be set to the address
+ *                        of the newly created voter object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the voter was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_voter_t object by calling
+ *       \ref cardano_voter_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_voter_t* voter = NULL;
+ *
+ * cardano_error_t result = cardano_voter_from_cbor(reader, &voter);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the voter
+ *
+ *   // Once done, ensure to clean up and release the voter
+ *   cardano_voter_unref(&voter);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode voter: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_voter_from_cbor(cardano_cbor_reader_t* reader, cardano_voter_t** voter);
+
+/**
+ * \brief Serializes a voter into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_voter_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] voter A constant pointer to the \ref cardano_voter_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p voter or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_t* voter = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_voter_to_cbor(voter, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_voter_unref(&voter);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voter_to_cbor(
+  const cardano_voter_t* voter,
+  cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Serializes a voter object to CIP-116 JSON based on the provided schema.
+ *
+ * This function serializes the voter object according to its type:
+ * - CC: { "tag": "cc_credential", "credential": { ... } }
+ * - DRep: { "tag": "drep_credential", "credential": { ... } }
+ * - SPO: { "tag": "spo_keyhash", "pubkey_hash": "<hex_hash>" }
+ *
+ * \param[in]  voter   Pointer to a valid \ref cardano_voter_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS        On success.
+ * CARDANO_ERROR_POINTER_IS_NULL  If \p voter or \p writer is NULL.
+ * CARDANO_ERROR_INVALID_ARGUMENT If the voter type is unknown.
+ * Other                          Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voter_to_cip116_json(
+  const cardano_voter_t* voter,
+  cardano_json_writer_t* writer);
+
+/**
+ * \brief Sets the type for a voter.
+ *
+ * This function assigns a type to the specified \ref cardano_voter_t object.
+ *
+ * \param[in,out] voter A pointer to the \ref cardano_voter_t object for which the type is to be set.
+ * \param[in] type The voter type to set, as defined by \ref cardano_voter_type_t.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the voter type was successfully set, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_t* voter = cardano_voter_new(...);
+ * cardano_voter_type_t voter_type = CARDANO_VOTER_TYPE_DREP_KEY_HASH;
+ *
+ * cardano_error_t result = cardano_voter_set_type(voter, voter_type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The voter type has been set successfully
+ * }
+ * else
+ * {
+ *   printf("Failed to set the voter type.\n");
+ * }
+ *
+ * // Clean up the voter object once done
+ * cardano_voter_unref(&voter);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voter_set_type(
+  cardano_voter_t*     voter,
+  cardano_voter_type_t type);
+
+/**
+ * \brief Retrieves the type of the voter.
+ *
+ * This function retrieves the type of a given \ref cardano_voter_t object and stores it in the provided
+ * output parameter. The voter type is defined in the \ref cardano_voter_type_t enumeration.
+ *
+ * \param[in] voter A constant pointer to the \ref cardano_voter_t object from which
+ *                        the type is to be retrieved. The object must not be NULL.
+ * \param[out] type Pointer to a variable where the voter type will be stored. This variable will
+ *                      be set to the value from the \ref cardano_voter_type_t enumeration.
+ *
+ * \return \ref CARDANO_SUCCESS if the type was successfully retrieved, or an appropriate error code if the
+ *         input is NULL or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_t* voter = cardano_voter_new(...);
+ * cardano_voter_type_t type;
+ * cardano_error_t result = cardano_voter_get_type(voter, &type);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   switch(type)
+ *   {
+ *     case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_KEY_HASH:
+ *       printf("Voter is a constitutional committee member identified by key hash.\n");
+ *       break;
+ *     case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_SCRIPT_HASH:
+ *       printf("Voter is a constitutional committee member identified by script hash.\n");
+ *       break;
+ *     case CARDANO_VOTER_TYPE_DREP_KEY_HASH:
+ *       printf("Voter is a DRep identified by key hash.\n");
+ *       break;
+ *     case CARDANO_VOTER_TYPE_DREP_SCRIPT_HASH:
+ *       printf("Voter is a DRep identified by script hash.\n");
+ *       break;
+ *     case CARDANO_VOTER_TYPE_STAKE_POOL_KEY_HASH:
+ *       printf("Voter is a Stake Pool Operator identified by key hash.\n");
+ *       break;
+ *   }
+ * }
+ *
+ * // Clean up the voter object once done
+ * cardano_voter_unref(&voter);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voter_get_type(
+  const cardano_voter_t* voter,
+  cardano_voter_type_t*  type);
+
+/**
+ * \brief Retrieves the credential associated with a voter.
+ *
+ * This function returns the credential of a \ref cardano_voter_t object.
+ * It returns a new reference to a \ref cardano_credential_t object representing the voter's credential.
+ * It is the caller's responsibility to release it by calling \ref cardano_credential_unref when
+ * it is no longer needed.
+ *
+ * \param[in] voter A constant pointer to the \ref cardano_voter_t object from which
+ *                   the credential is to be retrieved.
+ *
+ * \return A pointer to a new \ref cardano_credential_t object containing the voter's credential.
+ *         If the input voter is NULL, returns NULL. The caller is responsible for
+ *         managing the lifecycle of this object, including releasing it with
+ *         \ref cardano_credential_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_t* original_voter = cardano_voter_new(...);
+ * cardano_credential_t* credential = cardano_voter_get_credential(original_voter);
+ *
+ * if (credential)
+ * {
+ *   // Use the credential
+ *
+ *   // Once done, ensure to clean up and release the credential
+ *   cardano_credential_unref(&credential);
+ * }
+ * // Release the original voter after use
+ * cardano_voter_unref(&original_voter);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_credential_t* cardano_voter_get_credential(cardano_voter_t* voter);
+
+/**
+ * \brief Sets the credential for a voter.
+ *
+ * This function associates a credential with a \ref cardano_voter_t object. The function increases the reference
+ * count of the credential, meaning the original credential must still be managed by the caller.
+ *
+ * \param[in] voter A pointer to the \ref cardano_voter_t object to which the credential will be set.
+ * \param[in] credential A pointer to the \ref cardano_credential_t object that will be associated with the voter.
+ *
+ * \return \ref CARDANO_SUCCESS if the credential was successfully set, or an appropriate error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_t* voter = cardano_voter_new(...);
+ * cardano_credential_t* credential = cardano_credential_new(...);
+ *
+ * cardano_error_t result = cardano_voter_set_credential(voter, credential);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Credential has been successfully set to the voter
+ * }
+ *
+ * // Clean up
+ * cardano_credential_unref(&credential);  // Decrease the reference since it was created separately
+ * cardano_voter_unref(&voter);            // Release the voter after use
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voter_set_credential(cardano_voter_t* voter, cardano_credential_t* credential);
+
+/**
+ * \brief Checks if two voter objects are equal.
+ *
+ * This function compares two \ref cardano_voter_t objects for equality.
+ * It checks if the contents of the two voter objects are identical.
+ *
+ * \param[in] lhs A constant pointer to the first \ref cardano_voter_t object to be compared.
+ * \param[in] rhs A constant pointer to the second \ref cardano_voter_t object to be compared.
+ *
+ * \return \c true if the two voter objects are equal (have the same contents), \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_t* voter1 = ...; // Assume voter1 is initialized
+ * cardano_voter_t* voter2 = ...; // Assume voter2 is initialized
+ *
+ * if (cardano_voter_equals(voter1, voter2))
+ * {
+ *   printf("voter1 is equal to voter2\n");
+ * }
+ * else
+ * {
+ *   printf("voter1 is not equal to voter2\n");
+ * }
+ *
+ * // Clean up the voter objects once done
+ * cardano_voter_unref(&voter1);
+ * cardano_voter_unref(&voter2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_voter_equals(const cardano_voter_t* lhs, const cardano_voter_t* rhs);
+
+/**
+ * \brief Compares two voter objects.
+ *
+ * This function compares two voter objects and returns an integer indicating
+ * their relative order.
+ *
+ * \param[in] lhs Pointer to the first voter object.
+ * \param[in] rhs Pointer to the second voter object.
+ *
+ * \return A negative value if lhs is less than rhs, zero if they are equal, and a positive value if lhs is greater than rhs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_t* voter1 = NULL;
+ * cardano_voter_t* voter2 = NULL;
+ *
+ * // Assume voter1 and voter2 are initialized properly
+ *
+ * int32_t comparison = cardano_voter_compare(voter1, voter2);
+ * if (comparison < 0)
+ * {
+ *   printf("voter1 is less than voter2.\n");
+ * }
+ * else if (comparison == 0)
+ * {
+ *   printf("voter1 is equal to voter2.\n");
+ * }
+ * else
+ * {
+ *   printf("voter1 is greater than voter2.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_voter_unref(&voter1);
+ * cardano_voter_unref(&voter2);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT int32_t cardano_voter_compare(
+  const cardano_voter_t* lhs,
+  const cardano_voter_t* rhs);
+
+/**
+ * \brief Decrements the reference count of a voter object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_voter_t object
+ * by decreasing its reference count. When the reference count reaches zero, the voter is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] voter A pointer to the pointer of the voter object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_t* voter = cardano_voter_new();
+ *
+ * // Perform operations with the voter...
+ *
+ * cardano_voter_unref(&voter);
+ * // At this point, voter is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_voter_unref, the pointer to the \ref cardano_voter_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_voter_unref(cardano_voter_t** voter);
+
+/**
+ * \brief Increases the reference count of the cardano_voter_t object.
+ *
+ * This function is used to manually increment the reference count of a voter
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_voter_unref.
+ *
+ * \param voter A pointer to the voter object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voter is a previously created voter object
+ *
+ * cardano_voter_ref(voter);
+ *
+ * // Now voter can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_voter_ref there is a corresponding
+ * call to \ref cardano_voter_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_voter_ref(cardano_voter_t* voter);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_voter_t object.
+ *
+ * This function returns the number of active references to a voter object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_voter_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param voter A pointer to the voter object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified voter object. If the object
+ * is properly managed (i.e., every \ref cardano_voter_ref call is matched with a
+ * \ref cardano_voter_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voter is a previously created voter object
+ *
+ * size_t ref_count = cardano_voter_refcount(voter);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_voter_refcount(const cardano_voter_t* voter);
+
+/**
+ * \brief Sets the last error message for a given voter object.
+ *
+ * Records an error message in the voter's last_error buffer, overwriting any existing message.
+ * This is useful for storing devoterive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] voter A pointer to the \ref cardano_voter_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the voter's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_voter_set_last_error(cardano_voter_t* voter, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific voter.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_voter_set_last_error for the given
+ * voter. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] voter A pointer to the \ref cardano_voter_t instance whose last error
+ *                   message is to be retrieved. If the voter is NULL, the function
+ *                   returns a generic error message indicating the null voter.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified voter. If the voter is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_voter_set_last_error for the same voter, or until
+ *       the voter is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_voter_get_last_error(const cardano_voter_t* voter);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_voter_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_voter_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_voter_deep_clone(const cardano_voter_t* source, cardano_voter_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VOTER_H
diff --git a/vendor/include/cardano/voting_procedures/voter_list.h b/vendor/include/cardano/voting_procedures/voter_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/voting_procedures/voter_list.h
@@ -0,0 +1,335 @@
+/**
+ * \file voter_list.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VOTER_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VOTER_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A voter is any participant with an eligible role who either has a direct stake or has delegated their stake,
+ * and they exercise their rights by casting votes on governance actions. The weight or influence of their vote
+ * is determined by the amount of their active stake or the stake that's been delegated to them.
+ *
+ * Various roles in the Cardano ecosystem can participate in voting. This includes constitutional committee members,
+ * DReps (Delegation Representatives), and SPOs (Stake Pool Operators).
+ */
+typedef struct cardano_voter_t cardano_voter_t;
+
+/**
+ * \brief Represents a list of voter.
+ */
+typedef struct cardano_voter_list_t cardano_voter_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a voter_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_voter_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] voter_list On successful initialization, this will point to a newly created
+ *             \ref cardano_voter_list_t object. This object represents a "strong reference"
+ *             to the voter_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the voter_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_voter_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the voter_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_list_t* voter_list = NULL;
+ *
+ * // Attempt to create a new voter_list
+ * cardano_error_t result = cardano_voter_list_new(&voter_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the voter_list
+ *
+ *   // Once done, ensure to clean up and release the voter_list
+ *   cardano_voter_list_unref(&voter_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_voter_list_new(cardano_voter_list_t** voter_list);
+
+/**
+ * \brief Retrieves the length of a voter list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_voter_list_t object.
+ *
+ * \param[in] voter_list A constant pointer to the \ref cardano_voter_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the voter_list. Return 0 if the voter_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_list_t* voter_list = cardano_voter_list_new();
+ *
+ * // Populate voter_list with elements
+ *
+ * size_t length = cardano_voter_list_get_length(voter_list);
+ * printf("Length of the voter_list: %zu\n", length);
+ *
+ * // Clean up the voter_list object once done
+ * cardano_voter_list_unref(&voter_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_voter_list_get_length(const cardano_voter_list_t* voter_list);
+
+/**
+ * \brief Retrieves an element from a voter list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_voter_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] voter_list A constant pointer to the \ref cardano_voter_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the voter list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_voter_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_voter_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_list_t* voter_list = cardano_voter_list_new();
+ *
+ * // Populate voter_list with elements
+ *
+ * cardano_voter_t* element = NULL;
+ * cardano_error_t result = cardano_voter_list_get(voter_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_voter_unref(&element);
+ * }
+ *
+ * // Clean up the voter_list object once done
+ * cardano_voter_list_unref(&voter_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voter_list_get(const cardano_voter_list_t* voter_list, size_t index, cardano_voter_t** element);
+
+/**
+ * \brief Adds an element to a voter list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_voter_list_t object.
+ *
+ * \param[in] voter_list A constant pointer to the \ref cardano_voter_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_voter_t object that is to be added to the voter_list.
+ *                    The element will be referenced by the voter_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the voter_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_list_t* voter_list = cardano_voter_list_new();
+ *
+ * // Create and initialize a new voter element
+ * cardano_voter_t* element = { ... };
+ *
+ * // Add the element to the voter_list
+ * cardano_error_t result = cardano_voter_list_add(voter_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the voter_list object once done
+ * cardano_voter_list_unref(&voter_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voter_list_add(cardano_voter_list_t* voter_list, cardano_voter_t* element);
+
+/**
+ * \brief Decrements the reference count of a voter_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_voter_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the voter_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] voter_list A pointer to the pointer of the voter_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voter_list_t* voter_list = cardano_voter_list_new();
+ *
+ * // Perform operations with the voter_list...
+ *
+ * cardano_voter_list_unref(&voter_list);
+ * // At this point, voter_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_voter_list_unref, the pointer to the \ref cardano_voter_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_voter_list_unref(cardano_voter_list_t** voter_list);
+
+/**
+ * \brief Increases the reference count of the cardano_voter_list_t object.
+ *
+ * This function is used to manually increment the reference count of a voter_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_voter_list_unref.
+ *
+ * \param voter_list A pointer to the voter_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voter_list is a previously created voter_list object
+ *
+ * cardano_voter_list_ref(voter_list);
+ *
+ * // Now voter_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_voter_list_ref there is a corresponding
+ * call to \ref cardano_voter_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_voter_list_ref(cardano_voter_list_t* voter_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_voter_list_t object.
+ *
+ * This function returns the number of active references to a voter_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_voter_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param voter_list A pointer to the voter_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified voter_list object. If the object
+ * is properly managed (i.e., every \ref cardano_voter_list_ref call is matched with a
+ * \ref cardano_voter_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voter_list is a previously created voter_list object
+ *
+ * size_t ref_count = cardano_voter_list_refcount(voter_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_voter_list_refcount(const cardano_voter_list_t* voter_list);
+
+/**
+ * \brief Sets the last error message for a given voter_list object.
+ *
+ * Records an error message in the voter_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] voter_list A pointer to the \ref cardano_voter_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the voter_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_voter_list_set_last_error(cardano_voter_list_t* voter_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific voter_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_voter_list_set_last_error for the given
+ * voter_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] voter_list A pointer to the \ref cardano_voter_list_t instance whose last error
+ *                   message is to be retrieved. If the voter_list is NULL, the function
+ *                   returns a generic error message indicating the null voter_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified voter_list. If the voter_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_voter_list_set_last_error for the same voter_list, or until
+ *       the voter_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_voter_list_get_last_error(const cardano_voter_list_t* voter_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_voter_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_voter_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_voter_list_deep_clone(const cardano_voter_list_t* source, cardano_voter_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VOTER_LIST_H
diff --git a/vendor/include/cardano/voting_procedures/voter_type.h b/vendor/include/cardano/voting_procedures/voter_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/voting_procedures/voter_type.h
@@ -0,0 +1,79 @@
+/**
+ * \file voter_type.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VOTER_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VOTER_TYPE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+
+/* DECLARATIONS *************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Enumeration to represent different kinds of voters within the Cardano governance system.
+ */
+typedef enum
+{
+  /**
+   * \brief Represents a constitutional committee member identified by a key hash.
+   **/
+  CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_KEY_HASH = 0,
+
+  /**
+   * \brief Represents a constitutional committee member identified by a script hash.
+   **/
+  CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_SCRIPT_HASH = 1,
+
+  /**
+   * \brief Represents a DRep (Delegation Representative) identified by a key hash.
+   **/
+  CARDANO_VOTER_TYPE_DREP_KEY_HASH = 2,
+
+  /**
+   * \brief Represents a DRep (Delegation Representative) identified by a script hash.
+   **/
+  CARDANO_VOTER_TYPE_DREP_SCRIPT_HASH = 3,
+
+  /**
+   * \brief Represents a Stake Pool Operator (SPO) identified by a key hash.
+   **/
+  CARDANO_VOTER_TYPE_STAKE_POOL_KEY_HASH = 4
+} cardano_voter_type_t;
+
+/**
+ * \brief Converts voter types to their human readable form.
+ *
+ * \param[in] type The voter type to get the string representation for.
+ * \return Human readable form of the given voter type.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_voter_type_to_string(cardano_voter_type_t type);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VOTER_TYPE_H
diff --git a/vendor/include/cardano/voting_procedures/voting_procedure.h b/vendor/include/cardano/voting_procedures/voting_procedure.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/voting_procedures/voting_procedure.h
@@ -0,0 +1,482 @@
+/**
+ * \file voting_procedure.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/anchor.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/voting_procedures/vote.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A voting procedure is a pair of:
+ *
+ * - a vote.
+ * - an anchor, it links the vote to arbitrary off-chain JSON payload of metadata.
+ */
+typedef struct cardano_voting_procedure_t cardano_voting_procedure_t;
+
+/**
+ * \brief Creates and initializes a new voting procedure.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_voting_procedure_t object
+ * using the provided \ref cardano_voter_t and \ref cardano_anchor_t objects.
+ *
+ * \param[in] vote A pointer to the \ref cardano_voter_t object that represents the voter initiating the procedure.
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t object that defines the starting point or condition for the voting procedure.
+ * \param[out] voting_procedure On successful initialization, this will point to a newly created
+ *             \ref cardano_voting_procedure_t object. This object represents a "strong reference"
+ *             to the voting procedure, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the voting procedure is no longer needed, the caller must release it
+ *             by calling \ref cardano_voting_procedure_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the voting procedure was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vote_t vote = CARDANO_VOTE_YES;
+ * cardano_anchor_t* anchor = cardano_anchor_new(...);
+ * cardano_voting_procedure_t* voting_procedure = NULL;
+ *
+ * cardano_error_t result = cardano_voting_procedure_new(vote, anchor, &voting_procedure);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the voting procedure
+ *
+ *   // Once done, ensure to clean up and release the voting procedure
+ *   cardano_voting_procedure_unref(&voting_procedure);
+ * }
+ *
+ * // Clean up other resources
+ * cardano_anchor_unref(&anchor);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_voting_procedure_new(
+  cardano_vote_t               vote,
+  cardano_anchor_t*            anchor,
+  cardano_voting_procedure_t** voting_procedure);
+
+/**
+ * \brief Creates a voting_procedure from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_voting_procedure_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a voting_procedure.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded voting_procedure data.
+ * \param[out] voting_procedure A pointer to a pointer of \ref cardano_voting_procedure_t that will be set to the address
+ *                        of the newly created voting_procedure object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the voting_procedure was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_voting_procedure_t object by calling
+ *       \ref cardano_voting_procedure_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_voting_procedure_t* voting_procedure = NULL;
+ *
+ * cardano_error_t result = cardano_voting_procedure_from_cbor(reader, &voting_procedure);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the voting_procedure
+ *
+ *   // Once done, ensure to clean up and release the voting_procedure
+ *   cardano_voting_procedure_unref(&voting_procedure);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode voting_procedure: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_voting_procedure_from_cbor(cardano_cbor_reader_t* reader, cardano_voting_procedure_t** voting_procedure);
+
+/**
+ * \brief Serializes a voting_procedure into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_voting_procedure_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] voting_procedure A constant pointer to the \ref cardano_voting_procedure_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p voting_procedure or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_t* voting_procedure = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_voting_procedure_to_cbor(voting_procedure, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_voting_procedure_unref(&voting_procedure);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedure_to_cbor(
+  const cardano_voting_procedure_t* voting_procedure,
+  cardano_cbor_writer_t*            writer);
+
+/**
+ * \brief Serializes a voting procedure to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "vote", then "anchor" (if present).
+ *
+ * \param[in]  procedure Pointer to a valid \ref cardano_voting_procedure_t.
+ * \param[in]  writer    Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS        On success.
+ * CARDANO_ERROR_POINTER_IS_NULL  If \p procedure or \p writer is NULL.
+ * CARDANO_ERROR_INVALID_ARGUMENT If the vote type is invalid.
+ * Other                          Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_voting_procedure_to_cip116_json(
+  const cardano_voting_procedure_t* procedure,
+  cardano_json_writer_t*            writer);
+
+/**
+ * \brief Retrieves the vote type from a voting procedure.
+ *
+ * This function retrieves the vote type from the given \ref cardano_voting_procedure_t object.
+ * The vote type is represented by the \ref cardano_vote_t enumeration which includes options such as
+ * CARDANO_VOTE_NO, CARDANO_VOTE_YES, and CARDANO_VOTE_ABSTAIN.
+ *
+ * \param[in] voting_procedure A constant pointer to the \ref cardano_voting_procedure_t object
+ *                             from which the vote type is to be retrieved.
+ *
+ * \return The vote type as \ref cardano_vote_t. If the input is NULL, the behavior is undefined.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_t* voting_procedure = ...; // Assume voting_procedure is already initialized
+ * cardano_vote_t vote = cardano_voting_procedure_get_vote(voting_procedure);
+ *
+ * switch (vote) {
+ *     case CARDANO_VOTE_YES:
+ *         printf("The vote is YES.\n");
+ *         break;
+ *     case CARDANO_VOTE_NO:
+ *         printf("The vote is NO.\n");
+ *         break;
+ *     case CARDANO_VOTE_ABSTAIN:
+ *         printf("The vote is ABSTAIN.\n");
+ *         break;
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_vote_t cardano_voting_procedure_get_vote(const cardano_voting_procedure_t* voting_procedure);
+
+/**
+ * \brief Sets the vote type in a voting procedure.
+ *
+ * This function sets the vote type for the specified \ref cardano_voting_procedure_t object.
+ * The vote type is defined by the \ref cardano_vote_t enumeration, which includes options such as
+ * \ref CARDANO_VOTE_NO, \ref CARDANO_VOTE_YES, and \ref CARDANO_VOTE_ABSTAIN.
+ *
+ * \param[in,out] voting_procedure A pointer to the \ref cardano_voting_procedure_t object
+ *                                 in which the vote type will be set. This object must be previously
+ *                                 initialized and cannot be NULL.
+ * \param[in] vote The vote type as \ref cardano_vote_t to be set in the voting procedure.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the vote type was successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_t* voting_procedure = ...; // Assume voting_procedure is already initialized
+ * cardano_error_t result = cardano_voting_procedure_set_vote(voting_procedure, CARDANO_VOTE_YES);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Vote set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the vote.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedure_set_vote(cardano_voting_procedure_t* voting_procedure, cardano_vote_t vote);
+
+/**
+ * \brief Retrieves the anchor from a voting procedure.
+ *
+ * This function returns the anchor associated with a given \ref cardano_voting_procedure_t object.
+ * The anchor is an optional field and may not be set, in which case the function will return NULL.
+ *
+ * \param[in] voting_procedure A constant pointer to the \ref cardano_voting_procedure_t object
+ *                             from which the anchor is to be retrieved. This object must be previously
+ *                             initialized and cannot be NULL.
+ *
+ * \return A pointer to the \ref cardano_anchor_t object if it exists, otherwise NULL if the anchor
+ *         is not set or if the input voting_procedure is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_t* voting_procedure = ...; // Assume voting_procedure is already initialized
+ * cardano_anchor_t* anchor = cardano_voting_procedure_get_anchor(voting_procedure);
+ *
+ * if (anchor)
+ * {
+ *   printf("Anchor retrieved successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("No anchor is set for this voting procedure.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_anchor_t* cardano_voting_procedure_get_anchor(cardano_voting_procedure_t* voting_procedure);
+
+/**
+ * \brief Sets or unsets the anchor in a voting procedure.
+ *
+ * This function assigns an anchor to a \ref cardano_voting_procedure_t object. The anchor can be
+ * optionally unset by passing NULL as the anchor parameter.
+ *
+ * \param[in] voting_procedure A pointer to the \ref cardano_voting_procedure_t object to which
+ *                             the anchor will be set. This object must be previously initialized
+ *                             and cannot be NULL.
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t object representing the anchor to be
+ *                   set. If this parameter is NULL, the anchor in the voting procedure will be
+ *                   unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the anchor was successfully set or unset, or an appropriate error code indicating the
+ *         failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the voting_procedure pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_t* voting_procedure = ...; // Assume voting_procedure is already initialized
+ * cardano_anchor_t* anchor = ...; // Assume anchor is initialized or NULL to unset
+ *
+ * cardano_error_t result = cardano_voting_procedure_set_anchor(voting_procedure, anchor);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Anchor set/unset successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set/unset the anchor.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedure_set_anchor(cardano_voting_procedure_t* voting_procedure, cardano_anchor_t* anchor);
+
+/**
+ * \brief Decrements the reference count of a voting_procedure object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_voting_procedure_t object
+ * by decreasing its reference count. When the reference count reaches zero, the voting_procedure is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] voting_procedure A pointer to the pointer of the voting_procedure object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_t* voting_procedure = cardano_voting_procedure_new(...);
+ *
+ * // Perform operations with the voting_procedure...
+ *
+ * cardano_voting_procedure_unref(&voting_procedure);
+ * // At this point, voting_procedure is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_voting_procedure_unref, the pointer to the \ref cardano_voting_procedure_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_voting_procedure_unref(cardano_voting_procedure_t** voting_procedure);
+
+/**
+ * \brief Increases the reference count of the cardano_voting_procedure_t object.
+ *
+ * This function is used to manually increment the reference count of a voting_procedure
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_voting_procedure_unref.
+ *
+ * \param voting_procedure A pointer to the voting_procedure object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voting_procedure is a previously created voting_procedure object
+ *
+ * cardano_voting_procedure_ref(voting_procedure);
+ *
+ * // Now voting_procedure can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_voting_procedure_ref there is a corresponding
+ * call to \ref cardano_voting_procedure_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_voting_procedure_ref(cardano_voting_procedure_t* voting_procedure);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_voting_procedure_t object.
+ *
+ * This function returns the number of active references to a voting_procedure object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_voting_procedure_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param voting_procedure A pointer to the voting_procedure object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified voting_procedure object. If the object
+ * is properly managed (i.e., every \ref cardano_voting_procedure_ref call is matched with a
+ * \ref cardano_voting_procedure_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voting_procedure is a previously created voting_procedure object
+ *
+ * size_t ref_count = cardano_voting_procedure_refcount(voting_procedure);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_voting_procedure_refcount(const cardano_voting_procedure_t* voting_procedure);
+
+/**
+ * \brief Sets the last error message for a given voting_procedure object.
+ *
+ * Records an error message in the voting_procedure's last_error buffer, overwriting any existing message.
+ * This is useful for storing devoting_procedureive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] voting_procedure A pointer to the \ref cardano_voting_procedure_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the voting_procedure's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_voting_procedure_set_last_error(cardano_voting_procedure_t* voting_procedure, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific voting_procedure.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_voting_procedure_set_last_error for the given
+ * voting_procedure. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] voting_procedure A pointer to the \ref cardano_voting_procedure_t instance whose last error
+ *                   message is to be retrieved. If the voting_procedure is NULL, the function
+ *                   returns a generic error message indicating the null voting_procedure.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified voting_procedure. If the voting_procedure is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_voting_procedure_set_last_error for the same voting_procedure, or until
+ *       the voting_procedure is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_voting_procedure_get_last_error(const cardano_voting_procedure_t* voting_procedure);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_voting_procedure_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_voting_procedure_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_voting_procedure_deep_clone(const cardano_voting_procedure_t* source, cardano_voting_procedure_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURE_H
diff --git a/vendor/include/cardano/voting_procedures/voting_procedure_list.h b/vendor/include/cardano/voting_procedures/voting_procedure_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/voting_procedures/voting_procedure_list.h
@@ -0,0 +1,334 @@
+/**
+ * \file voting_procedure_list.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURE_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURE_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A voting procedure is a pair of:
+ *
+ * - a vote.
+ * - an anchor, it links the vote to arbitrary off-chain JSON payload of metadata.
+ */
+typedef struct cardano_voting_procedure_t cardano_voting_procedure_t;
+
+/**
+ * \brief Represents a list of voting procedure.
+ */
+typedef struct cardano_voting_procedure_list_t cardano_voting_procedure_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a voting_procedure_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_voting_procedure_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] voting_procedure_list On successful initialization, this will point to a newly created
+ *             \ref cardano_voting_procedure_list_t object. This object represents a "strong reference"
+ *             to the voting_procedure_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the voting_procedure_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_voting_procedure_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the voting_procedure_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_list_t* voting_procedure_list = NULL;
+ *
+ * // Attempt to create a new voting_procedure_list
+ * cardano_error_t result = cardano_voting_procedure_list_new(&voting_procedure_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the voting_procedure_list
+ *
+ *   // Once done, ensure to clean up and release the voting_procedure_list
+ *   cardano_voting_procedure_list_unref(&voting_procedure_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_voting_procedure_list_new(cardano_voting_procedure_list_t** voting_procedure_list);
+
+/**
+ * \brief Retrieves the length of a voting procedure list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_voting_procedure_list_t object.
+ *
+ * \param[in] voting_procedure_list A constant pointer to the \ref cardano_voting_procedure_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the voting_procedure_list. Return 0 if the voting_procedure_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_list_t* voting_procedure_list = cardano_voting_procedure_list_new();
+ *
+ * // Populate voting_procedure_list with elements
+ *
+ * size_t length = cardano_voting_procedure_list_get_length(voting_procedure_list);
+ * printf("Length of the voting_procedure_list: %zu\n", length);
+ *
+ * // Clean up the voting_procedure_list object once done
+ * cardano_voting_procedure_list_unref(&voting_procedure_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_voting_procedure_list_get_length(const cardano_voting_procedure_list_t* voting_procedure_list);
+
+/**
+ * \brief Retrieves an element from a voting procedure list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_voting_procedure_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] voting_procedure_list A constant pointer to the \ref cardano_voting_procedure_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the voting procedure list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_voting_procedure_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_voting_procedure_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_list_t* voting_procedure_list = cardano_voting_procedure_list_new();
+ *
+ * // Populate voting_procedure_list with elements
+ *
+ * cardano_voting_procedure_t* element = NULL;
+ * cardano_error_t result = cardano_voting_procedure_list_get(voting_procedure_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_voting_procedure_unref(&element);
+ * }
+ *
+ * // Clean up the voting_procedure_list object once done
+ * cardano_voting_procedure_list_unref(&voting_procedure_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedure_list_get(const cardano_voting_procedure_list_t* voting_procedure_list, size_t index, cardano_voting_procedure_t** element);
+
+/**
+ * \brief Adds an element to a voting procedure list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_voting_procedure_list_t object.
+ *
+ * \param[in] voting_procedure_list A constant pointer to the \ref cardano_voting_procedure_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_voting_procedure_t object that is to be added to the voting_procedure_list.
+ *                    The element will be referenced by the voting_procedure_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the voting_procedure_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_list_t* voting_procedure_list = cardano_voting_procedure_list_new();
+ *
+ * // Create and initialize a new voting_procedure element
+ * cardano_voting_procedure_t* element = { ... };
+ *
+ * // Add the element to the voting_procedure_list
+ * cardano_error_t result = cardano_voting_procedure_list_add(voting_procedure_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the voting_procedure_list object once done
+ * cardano_voting_procedure_list_unref(&voting_procedure_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedure_list_add(cardano_voting_procedure_list_t* voting_procedure_list, cardano_voting_procedure_t* element);
+
+/**
+ * \brief Decrements the reference count of a voting_procedure_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_voting_procedure_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the voting_procedure_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] voting_procedure_list A pointer to the pointer of the voting_procedure_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_list_t* voting_procedure_list = cardano_voting_procedure_list_new();
+ *
+ * // Perform operations with the voting_procedure_list...
+ *
+ * cardano_voting_procedure_list_unref(&voting_procedure_list);
+ * // At this point, voting_procedure_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_voting_procedure_list_unref, the pointer to the \ref cardano_voting_procedure_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_voting_procedure_list_unref(cardano_voting_procedure_list_t** voting_procedure_list);
+
+/**
+ * \brief Increases the reference count of the cardano_voting_procedure_list_t object.
+ *
+ * This function is used to manually increment the reference count of a voting_procedure_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_voting_procedure_list_unref.
+ *
+ * \param voting_procedure_list A pointer to the voting_procedure_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voting_procedure_list is a previously created voting_procedure_list object
+ *
+ * cardano_voting_procedure_list_ref(voting_procedure_list);
+ *
+ * // Now voting_procedure_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_voting_procedure_list_ref there is a corresponding
+ * call to \ref cardano_voting_procedure_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_voting_procedure_list_ref(cardano_voting_procedure_list_t* voting_procedure_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_voting_procedure_list_t object.
+ *
+ * This function returns the number of active references to a voting_procedure_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_voting_procedure_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param voting_procedure_list A pointer to the voting_procedure_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified voting_procedure_list object. If the object
+ * is properly managed (i.e., every \ref cardano_voting_procedure_list_ref call is matched with a
+ * \ref cardano_voting_procedure_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voting_procedure_list is a previously created voting_procedure_list object
+ *
+ * size_t ref_count = cardano_voting_procedure_list_refcount(voting_procedure_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_voting_procedure_list_refcount(const cardano_voting_procedure_list_t* voting_procedure_list);
+
+/**
+ * \brief Sets the last error message for a given voting_procedure_list object.
+ *
+ * Records an error message in the voting_procedure_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] voting_procedure_list A pointer to the \ref cardano_voting_procedure_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the voting_procedure_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_voting_procedure_list_set_last_error(cardano_voting_procedure_list_t* voting_procedure_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific voting_procedure_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_voting_procedure_list_set_last_error for the given
+ * voting_procedure_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] voting_procedure_list A pointer to the \ref cardano_voting_procedure_list_t instance whose last error
+ *                   message is to be retrieved. If the voting_procedure_list is NULL, the function
+ *                   returns a generic error message indicating the null voting_procedure_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified voting_procedure_list. If the voting_procedure_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_voting_procedure_list_set_last_error for the same voting_procedure_list, or until
+ *       the voting_procedure_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_voting_procedure_list_get_last_error(const cardano_voting_procedure_list_t* voting_procedure_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_voting_procedure_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_voting_procedure_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_voting_procedure_list_deep_clone(const cardano_voting_procedure_list_t* source, cardano_voting_procedure_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURE_LIST_H
diff --git a/vendor/include/cardano/voting_procedures/voting_procedures.h b/vendor/include/cardano/voting_procedures/voting_procedures.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/voting_procedures/voting_procedures.h
@@ -0,0 +1,537 @@
+/**
+ * \file voting_procedures.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURES_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURES_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/governance_action_id.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/voting_procedures/governance_action_id_list.h>
+#include <cardano/voting_procedures/voter.h>
+#include <cardano/voting_procedures/voter_list.h>
+#include <cardano/voting_procedures/voting_procedure.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A map of Voter + GovernanceActionId to VotingProcedure.
+ */
+typedef struct cardano_voting_procedures_t cardano_voting_procedures_t;
+
+/**
+ * \brief Creates and initializes a new instance of a map of Voter and GovernanceActionId to VotingProcedure.
+ *
+ * This function initializes a new \ref cardano_voting_procedures_t object, which maps voters and governance action
+ * identifiers to their respective voting procedures. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] voting_procedures On successful initialization, this pointer will be set to a newly created
+ *             \ref cardano_voting_procedures_t object. This object represents a "strong reference"
+ *             to the map of voting procedures, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the voting_procedures are no longer needed, the caller must release them
+ *             by calling \ref cardano_voting_procedures_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the map of voting procedures was successfully created, or an appropriate error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if the output pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedures_t* voting_procedures = NULL;
+ *
+ * // Attempt to create a new map of voting procedures
+ * cardano_error_t result = cardano_voting_procedures_new(&voting_procedures);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the voting_procedures map
+ *
+ *   // Once done, ensure to clean up and release the voting_procedures
+ *   cardano_voting_procedures_unref(&voting_procedures);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the voting procedures map: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_voting_procedures_new(cardano_voting_procedures_t** voting_procedures);
+
+/**
+ * \brief Creates a voting_procedures from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_voting_procedures_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a voting_procedures.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded voting_procedures data.
+ * \param[out] voting_procedures A pointer to a pointer of \ref cardano_voting_procedures_t that will be set to the address
+ *                        of the newly created voting_procedures object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the voting_procedures was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_voting_procedures_t object by calling
+ *       \ref cardano_voting_procedures_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_voting_procedures_t* voting_procedures = NULL;
+ *
+ * cardano_error_t result = cardano_voting_procedures_from_cbor(reader, &voting_procedures);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the voting_procedures
+ *
+ *   // Once done, ensure to clean up and release the voting_procedures
+ *   cardano_voting_procedures_unref(&voting_procedures);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode voting_procedures: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_voting_procedures_from_cbor(cardano_cbor_reader_t* reader, cardano_voting_procedures_t** voting_procedures);
+
+/**
+ * \brief Serializes a voting_procedures into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_voting_procedures_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] voting_procedures A constant pointer to the \ref cardano_voting_procedures_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p voting_procedures or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedures_t* voting_procedures = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_voting_procedures_to_cbor(voting_procedures, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_voting_procedures_unref(&voting_procedures);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedures_to_cbor(
+  const cardano_voting_procedures_t* voting_procedures,
+  cardano_cbor_writer_t*             writer);
+
+/**
+ * \brief Serializes voting procedures to a CIP-116 JSON array.
+ *
+ * This function serializes a map of [Voter -> [GovActionId -> VotingProcedure]]
+ * into a JSON array of key-value objects, as specified by the schema.
+ *
+ * \param[in]  procedures Pointer to a valid \ref cardano_voting_procedures_t.
+ * \param[in]  writer     Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p procedures or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedures_to_cip116_json(
+  const cardano_voting_procedures_t* procedures,
+  cardano_json_writer_t*             writer);
+
+/**
+ * \brief Inserts a voting procedure associated with a specific voter and governance action ID into the voting procedures map.
+ *
+ * This function inserts a new entry into the \ref cardano_voting_procedures_t map, linking a voter and a governance action ID
+ * to a specific voting procedure. Each component (voter, governance action ID, and voting procedure) is added as a reference,
+ * and the reference count for each is incremented to manage their lifecycles within the map.
+ *
+ * \param[in] voting_procedures A pointer to an initialized \ref cardano_voting_procedures_t object, representing the map
+ *                              where the new voting procedure entry will be inserted.
+ * \param[in] voter A pointer to an initialized \ref cardano_voter_t object representing the voter.
+ * \param[in] governance_action_id A pointer to an initialized \ref cardano_governance_action_id_t object representing the
+ *                                 governance action ID.
+ * \param[in] value A pointer to an initialized \ref cardano_voting_procedure_t object representing the voting procedure.
+ *
+ * \return \ref CARDANO_SUCCESS if the entry was successfully inserted, or an appropriate error code indicating the failure
+ *         reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if any input pointers are NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedures_t* voting_procedures = cardano_voting_procedures_new();
+ * cardano_voter_t* voter = cardano_voter_new(...);
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...);
+ * cardano_voting_procedure_t* voting_procedure = cardano_voting_procedure_new(...);
+ *
+ * cardano_error_t result = cardano_voting_procedures_insert(voting_procedures, voter, governance_action_id, voting_procedure);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Voting procedure inserted successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to insert voting procedure: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources
+ * cardano_voting_procedures_unref(&voting_procedures);
+ * cardano_voter_unref(&voter);
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * cardano_voting_procedure_unref(&voting_procedure);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedures_insert(cardano_voting_procedures_t* voting_procedures, cardano_voter_t* voter, cardano_governance_action_id_t* governance_action_id, cardano_voting_procedure_t* value);
+
+/**
+ * \brief Retrieves a voting procedure associated with a specific voter and governance action ID from the voting procedures map.
+ *
+ * This function retrieves the \ref cardano_voting_procedure_t object associated with a given voter and governance action ID
+ * from the \ref cardano_voting_procedures_t map. If the combination of voter and governance action ID is found in the map,
+ * a reference to the associated voting procedure is returned. The reference count of the returned object is incremented,
+ * and it is the caller's responsibility to release this reference when it is no longer needed.
+ *
+ * \param[in] voting_procedures A pointer to an initialized \ref cardano_voting_procedures_t object, representing the map
+ *                              from which the voting procedure is to be retrieved.
+ * \param[in] voter A pointer to an initialized \ref cardano_voter_t object representing the voter.
+ * \param[in] governance_action_id A pointer to an initialized \ref cardano_governance_action_id_t object representing the
+ *                                 governance action ID.
+ *
+ * \return A pointer to the \ref cardano_voting_procedure_t object if the entry is found in the map. Returns NULL if no such entry exists
+ *         or if any of the input parameters are NULL. The caller is responsible for managing the lifecycle of the returned object,
+ *         including releasing it with \ref cardano_voting_procedure_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedures_t* voting_procedures = cardano_voting_procedures_new();
+ * cardano_voter_t* voter = cardano_voter_new(...);
+ * cardano_governance_action_id_t* governance_action_id = cardano_governance_action_id_new(...);
+ *
+ * cardano_voting_procedure_t* voting_procedure = cardano_voting_procedures_get(voting_procedures, voter, governance_action_id);
+ * if (voting_procedure)
+ * {
+ *   // Process the voting procedure
+ *
+ *   // Once done, ensure to clean up and release the voting procedure
+ *   cardano_voting_procedure_unref(&voting_procedure);
+ * }
+ * else
+ * {
+ *   printf("No voting procedure found for the specified voter and governance action ID.\n");
+ * }
+ *
+ * // Release other resources
+ * cardano_voting_procedures_unref(&voting_procedures);
+ * cardano_voter_unref(&voter);
+ * cardano_governance_action_id_unref(&governance_action_id);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_voting_procedure_t* cardano_voting_procedures_get(cardano_voting_procedures_t* voting_procedures, cardano_voter_t* voter, cardano_governance_action_id_t* governance_action_id);
+
+/**
+ * \brief Retrieves a list of governance action IDs associated with a specific voter from the voting procedures map.
+ *
+ * This function extracts all governance action IDs associated with a given voter from a \ref cardano_voting_procedures_t map.
+ * The function returns a pointer to a \ref cardano_governance_action_id_list_t object containing the list of IDs.
+ * If the voter is found, the list will contain one or more governance action IDs; if the voter has no associated actions,
+ * the list will be empty. The caller is responsible for managing the lifecycle of the returned list object, including releasing it
+ * with \ref cardano_governance_action_id_list_unref when it is no longer needed.
+ *
+ * \param[in] voting_procedures A pointer to an initialized \ref cardano_voting_procedures_t object, representing the map
+ *                              from which the governance action IDs are to be retrieved.
+ * \param[in] voter A pointer to an initialized \ref cardano_voter_t object representing the voter.
+ * \param[out] governance_action_ids On successful retrieval, this will point to a newly created
+ *                                   \ref cardano_governance_action_id_list_t object containing the list of governance action IDs.
+ *                                   If no actions are associated with the voter, this will point to an empty list.
+ *
+ * \return A pointer to the \ref cardano_voting_procedure_t object associated with the voter if the voter is found in the map,
+ *         otherwise returns NULL. The caller is responsible for managing the lifecycle of the returned object and any associated list.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedures_t* voting_procedures = cardano_voting_procedures_new(...);
+ * cardano_voter_t* voter = cardano_voter_new(...);
+ * cardano_governance_action_id_list_t* governance_action_ids = NULL;
+ *
+ * cardano_voting_procedure_t* voting_procedure = cardano_voting_procedures_get_governance_ids_by_voter(
+ *     voting_procedures, voter, &governance_action_ids);
+ *
+ * if (voting_procedure)
+ * {
+ *   // Process each governance action ID in the list
+ *   for (size_t i = 0; i < cardano_governance_action_id_list_get_length(governance_action_ids); i++)
+ *   {
+ *     cardano_governance_action_id_t* action_id = cardano_governance_action_id_list_get(governance_action_ids, i);
+ *     // Use the action_id
+ *
+ *     cardano_governance_action_id_unref(&action_id);
+ *   }
+ *
+ *   // Once done, ensure to clean up and release the voting procedure
+ *   cardano_voting_procedure_unref(&voting_procedure);
+ * }
+ * else
+ * {
+ *   printf("No voting procedure found for the specified voter.\n");
+ * }
+ *
+ * // Release the list of governance action IDs
+ * cardano_governance_action_id_list_unref(&governance_action_ids);
+ *
+ * // Release other resources
+ * cardano_voting_procedures_unref(&voting_procedures);
+ * cardano_voter_unref(&voter);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedures_get_governance_ids_by_voter(cardano_voting_procedures_t* voting_procedures, cardano_voter_t* voter, cardano_governance_action_id_list_t** governance_action_ids);
+
+/**
+ * \brief Retrieves a list of voters from the voting procedures map.
+ *
+ * This function extracts all voters from a given \ref cardano_voting_procedures_t map and stores them in a newly created
+ * \ref cardano_voter_list_t object. The caller is responsible for managing the lifecycle of the returned list object,
+ * including releasing it with \ref cardano_voter_list_unref when it is no longer needed.
+ *
+ * \param[in] voting_procedures A pointer to an initialized \ref cardano_voting_procedures_t object, representing the map
+ *                              from which the voters are to be retrieved.
+ * \param[out] voters On successful retrieval, this parameter will point to a newly created \ref cardano_voter_list_t object containing
+ *                    the list of voters. If the map is empty, this will point to an empty list.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the list of voters
+ *         was successfully retrieved, or an appropriate error code if no voters are found or an error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedures_t* voting_procedures = ...;
+ * cardano_voter_list_t* voters = NULL;
+ *
+ * cardano_error_t result = cardano_voting_procedures_get_voters(voting_procedures, &voters);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process each voter in the list
+ *   for (size_t i = 0; i < cardano_voter_list_get_length(voters); ++i)
+ *   {
+ *     cardano_voter_t* voter = cardano_voter_list_get(voters, i);
+ *     // Use the voter
+ *
+ *     cardano_voter_unref(&voter);
+ *   }
+ * }
+ * else
+ * {
+ *   printf("No voters found or an error occurred.\n");
+ * }
+ *
+ * // Release the list of voters
+ * cardano_voter_list_unref(&voters);
+ *
+ * // Release other resources
+ * cardano_voting_procedures_unref(&voting_procedures);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedures_get_voters(cardano_voting_procedures_t* voting_procedures, cardano_voter_list_t** voters);
+
+/**
+ * \brief Decrements the reference count of a voting_procedures object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_voting_procedures_t object
+ * by decreasing its reference count. When the reference count reaches zero, the voting_procedures is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] voting_procedures A pointer to the pointer of the voting_procedures object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedures_t* voting_procedures = cardano_voting_procedures_new();
+ *
+ * // Perform operations with the voting_procedures...
+ *
+ * cardano_voting_procedures_unref(&voting_procedures);
+ * // At this point, voting_procedures is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_voting_procedures_unref, the pointer to the \ref cardano_voting_procedures_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_voting_procedures_unref(cardano_voting_procedures_t** voting_procedures);
+
+/**
+ * \brief Increases the reference count of the cardano_voting_procedures_t object.
+ *
+ * This function is used to manually increment the reference count of a voting_procedures
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_voting_procedures_unref.
+ *
+ * \param voting_procedures A pointer to the voting_procedures object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voting_procedures is a previously created voting_procedures object
+ *
+ * cardano_voting_procedures_ref(voting_procedures);
+ *
+ * // Now voting_procedures can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_voting_procedures_ref there is a corresponding
+ * call to \ref cardano_voting_procedures_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_voting_procedures_ref(cardano_voting_procedures_t* voting_procedures);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_voting_procedures_t object.
+ *
+ * This function returns the number of active references to a voting_procedures object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_voting_procedures_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param voting_procedures A pointer to the voting_procedures object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified voting_procedures object. If the object
+ * is properly managed (i.e., every \ref cardano_voting_procedures_ref call is matched with a
+ * \ref cardano_voting_procedures_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voting_procedures is a previously created voting_procedures object
+ *
+ * size_t ref_count = cardano_voting_procedures_refcount(voting_procedures);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_voting_procedures_refcount(const cardano_voting_procedures_t* voting_procedures);
+
+/**
+ * \brief Sets the last error message for a given voting_procedures object.
+ *
+ * Records an error message in the voting_procedures's last_error buffer, overwriting any existing message.
+ * This is useful for storing devoting_proceduresive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] voting_procedures A pointer to the \ref cardano_voting_procedures_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the voting_procedures's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_voting_procedures_set_last_error(cardano_voting_procedures_t* voting_procedures, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific voting_procedures.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_voting_procedures_set_last_error for the given
+ * voting_procedures. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] voting_procedures A pointer to the \ref cardano_voting_procedures_t instance whose last error
+ *                   message is to be retrieved. If the voting_procedures is NULL, the function
+ *                   returns a generic error message indicating the null voting_procedures.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified voting_procedures. If the voting_procedures is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_voting_procedures_set_last_error for the same voting_procedures, or until
+ *       the voting_procedures is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_voting_procedures_get_last_error(const cardano_voting_procedures_t* voting_procedures);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_voting_procedures_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_voting_procedures_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_voting_procedures_deep_clone(const cardano_voting_procedures_t* source, cardano_voting_procedures_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURES_H
diff --git a/vendor/include/cardano/witness_set/bootstrap_witness.h b/vendor/include/cardano/witness_set/bootstrap_witness.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/bootstrap_witness.h
@@ -0,0 +1,691 @@
+/**
+ * \file bootstrap_witness.h
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BOOTSTRAP_WITNESS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BOOTSTRAP_WITNESS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/ed25519_public_key.h>
+#include <cardano/crypto/ed25519_signature.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The bootstrap witness proves that the transaction has the authority to spend
+ * the value from the associated Byron-era input UTxOs.
+ *
+ * Cardano has transitioned away from this type of witness from Shelley and later eras, BootstrapWitnesses
+ * are currently deprecated.
+ */
+typedef struct cardano_bootstrap_witness_t cardano_bootstrap_witness_t;
+
+/**
+ * \brief Creates and initializes a new instance of a Bootstrap Witness.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_bootstrap_witness_t object,
+ * which is used in Cardano transactions to provide witness data Byron era addresses.
+ *
+ * \param[in] vkey A pointer to an initialized \ref cardano_ed25519_public_key_t object representing
+ *                 the public verification key (VKey). This key is used to verify the cryptographic signature.
+ * \param[in] signature A pointer to an initialized \ref cardano_ed25519_signature_t object containing
+ *                      the cryptographic signature. This signature is produced by signing the hash
+ *                      of the transaction body with the corresponding private key. The VKey is used to
+ *                      verify that the signature is valid and was made by the owner of the corresponding private key.
+ * \param[in] chain_code A pointer to a \ref cardano_buffer_t containing the chain code. This is used
+ *                       in Hierarchical Deterministic (HD) wallet address generation for the Byron era.
+ *                       The chain code ensures that addresses can be deterministically derived from a
+ *                       master key while maintaining security.
+ * \param[in] attributes A pointer to a \ref cardano_buffer_t object representing additional attributes
+ *                       used for network discrimination. These attributes are used in Byron-era addresses
+ *                       to include extra metadata.
+ * \param[out] bootstrap_witness On successful initialization, this will point to a newly created
+ *                               \ref cardano_bootstrap_witness_t object. This object represents a "strong reference"
+ *                               to the bootstrap witness, meaning that it is fully initialized and ready for use.
+ *                               The caller is responsible for managing the lifecycle of this object.
+ *                               Specifically, once the bootstrap witness is no longer needed, the caller
+ *                               must release it by calling \ref cardano_bootstrap_witness_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         bootstrap witness was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ed25519_public_key_t* vkey = ...; // Assume vkey is already initialized
+ * cardano_ed25519_signature_t* signature = ...; // Assume signature is already initialized
+ * cardano_buffer_t* chain_code = ...; // Assume chain code is initialized
+ * cardano_buffer_t* attributes = ...; // Assume attributes are initialized
+ * cardano_bootstrap_witness_t* bootstrap_witness = NULL;
+ *
+ * cardano_error_t result = cardano_bootstrap_witness_new(vkey, signature, chain_code, attributes, &bootstrap_witness);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bootstrap_witness
+ *   // Once done, ensure to clean up and release the bootstrap_witness
+ *   cardano_bootstrap_witness_unref(&bootstrap_witness);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the bootstrap witness.\n");
+ * }
+ *
+ * // Cleanup the other inputs
+ * cardano_ed25519_public_key_unref(&vkey);
+ * cardano_ed25519_signature_unref(&signature);
+ * cardano_buffer_unref(&chain_code);
+ * cardano_buffer_unref(&attributes);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bootstrap_witness_new(
+  cardano_ed25519_public_key_t* vkey,
+  cardano_ed25519_signature_t*  signature,
+  cardano_buffer_t*             chain_code,
+  cardano_buffer_t*             attributes,
+  cardano_bootstrap_witness_t** bootstrap_witness);
+
+/**
+ * \brief Creates a \ref cardano_bootstrap_witness_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_bootstrap_witness_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a bootstrap_witness.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] bootstrap_witness A pointer to a pointer of \ref cardano_bootstrap_witness_t that will be set to the address
+ *                        of the newly created bootstrap_witness object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the bootstrap witness were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark A chain code of any length, including an empty one, is accepted and kept as is. The ledger only requires a
+ *         32 byte chain code from protocol version 12 on, and earlier eras accept any length, so the length is not
+ *         enforced when decoding.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_bootstrap_witness_t object by calling
+ *       \ref cardano_bootstrap_witness_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_bootstrap_witness_t* bootstrap_witness = NULL;
+ *
+ * cardano_error_t result = cardano_bootstrap_witness_from_cbor(reader, &bootstrap_witness);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bootstrap_witness
+ *
+ *   // Once done, ensure to clean up and release the bootstrap_witness
+ *   cardano_bootstrap_witness_unref(&bootstrap_witness);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode bootstrap_witness: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bootstrap_witness_from_cbor(cardano_cbor_reader_t* reader, cardano_bootstrap_witness_t** bootstrap_witness);
+
+/**
+ * \brief Serializes bootstrap witness into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_bootstrap_witness_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] bootstrap_witness A constant pointer to the \ref cardano_bootstrap_witness_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p bootstrap_witness or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_t* bootstrap_witness = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_bootstrap_witness_to_cbor(bootstrap_witness, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_bootstrap_witness_unref(&bootstrap_witness);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bootstrap_witness_to_cbor(
+  const cardano_bootstrap_witness_t* bootstrap_witness,
+  cardano_cbor_writer_t*             writer);
+
+/**
+ * \brief Serializes a bootstrap witness to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "attributes", "chain_code", "signature", "vkey".
+ *
+ * \param[in]  witness Pointer to a valid \ref cardano_bootstrap_witness_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p witness or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bootstrap_witness_to_cip116_json(
+  const cardano_bootstrap_witness_t* witness,
+  cardano_json_writer_t*             writer);
+
+/**
+ * \brief Retrieves the verification key (VKey) from a Bootstrap Witness.
+ *
+ * This function returns the \ref cardano_ed25519_public_key_t object representing the public verification key
+ * (VKey) associated with a \ref cardano_bootstrap_witness_t object. The VKey is used to verify the cryptographic
+ * signature provided in the bootstrap witness.
+ *
+ * \param[in] bootstrap_witness A pointer to an initialized \ref cardano_bootstrap_witness_t object from
+ *                              which the verification key will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_ed25519_public_key_t object representing the verification key.
+ *         The caller is responsible for managing the lifecycle of the returned VKey. Specifically, the caller
+ *         must release it by calling \ref cardano_ed25519_public_key_unref when it is no longer needed.
+ *         If \p bootstrap_witness is NULL, the function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_t* bootstrap_witness = ...; // Assume bootstrap_witness is initialized
+ * cardano_ed25519_public_key_t* vkey = cardano_bootstrap_witness_get_vkey(bootstrap_witness);
+ *
+ * if (vkey != NULL)
+ * {
+ *   // Use the verification key
+ *   // Once done, ensure to clean up and release the vkey
+ *   cardano_ed25519_public_key_unref(&vkey);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the verification key.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_ed25519_public_key_t* cardano_bootstrap_witness_get_vkey(
+  cardano_bootstrap_witness_t* bootstrap_witness);
+
+/**
+ * \brief Sets the verification key (VKey) for a Bootstrap Witness.
+ *
+ * This function assigns a new \ref cardano_ed25519_public_key_t object as the verification key (VKey)
+ * for the given \ref cardano_bootstrap_witness_t object. The VKey is the public key that is used
+ * to verify the cryptographic signature in the bootstrap witness.
+ *
+ * \param[in,out] bootstrap_witness A pointer to an initialized \ref cardano_bootstrap_witness_t object
+ *                                  to which the verification key will be assigned.
+ * \param[in] vkey A pointer to an initialized \ref cardano_ed25519_public_key_t object representing the new
+ *                 verification key. The caller retains ownership of this object and must ensure its lifecycle
+ *                 is properly managed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the verification key
+ *         was successfully set, or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         either \p bootstrap_witness or \p vkey is NULL.
+ *
+ * \note The function does not take ownership of the \p vkey, meaning the caller is still responsible for freeing the
+ *       \ref cardano_ed25519_public_key_t object when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_t* bootstrap_witness = ...; // Assume bootstrap_witness is initialized
+ * cardano_ed25519_public_key_t* vkey = ...; // Assume vkey is initialized
+ *
+ * cardano_error_t result = cardano_bootstrap_witness_set_vkey(bootstrap_witness, vkey);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("VKey set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the VKey.\n");
+ * }
+ *
+ * // Cleanup resources for the VKey as it is still owned by the caller
+ * cardano_ed25519_public_key_unref(&vkey);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bootstrap_witness_set_vkey(
+  cardano_bootstrap_witness_t*  bootstrap_witness,
+  cardano_ed25519_public_key_t* vkey);
+
+/**
+ * \brief Retrieves the cryptographic signature from a Bootstrap Witness.
+ *
+ * This function retrieves the \ref cardano_ed25519_signature_t object from a given \ref cardano_bootstrap_witness_t object.
+ * The signature is produced by signing the hash of the transaction body using the corresponding private key (SKey),
+ * and it can be verified using the associated public key (VKey).
+ *
+ * \param[in] bootstrap_witness A pointer to an initialized \ref cardano_bootstrap_witness_t object from which
+ *                              the signature will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_ed25519_signature_t object representing the signature. The returned signature is
+ *         a new reference, and the caller is responsible for managing its lifecycle. Specifically, the caller must release
+ *         it using \ref cardano_ed25519_signature_unref when it is no longer needed. If \p bootstrap_witness is NULL, this
+ *         function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_t* bootstrap_witness = ...; // Assume bootstrap_witness is initialized
+ * cardano_ed25519_signature_t* signature = cardano_bootstrap_witness_get_signature(bootstrap_witness);
+ *
+ * if (signature != NULL)
+ * {
+ *   // Process the signature
+ *   cardano_ed25519_signature_unref(&signature); // Ensure to clean up the signature
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the signature.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_ed25519_signature_t* cardano_bootstrap_witness_get_signature(
+  cardano_bootstrap_witness_t* bootstrap_witness);
+
+/**
+ * \brief Sets the cryptographic signature for a Bootstrap Witness.
+ *
+ * This function assigns a new \ref cardano_ed25519_signature_t object to a given \ref cardano_bootstrap_witness_t object.
+ * The signature is produced by signing the hash of the transaction body using the corresponding private key (SKey),
+ * and it can be verified using the associated public key (VKey).
+ *
+ * \param[in,out] bootstrap_witness A pointer to an initialized \ref cardano_bootstrap_witness_t object to which
+ *                                  the signature will be assigned.
+ * \param[in] signature A pointer to an initialized \ref cardano_ed25519_signature_t object representing the signature.
+ *                      This parameter must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the signature
+ *         was successfully set. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if either \p bootstrap_witness or \p signature is NULL.
+ *
+ * \note This function increases the reference count of the \p signature object; therefore, the caller retains ownership
+ *       of their reference and must release their copy when it is no longer needed using \ref cardano_ed25519_signature_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_t* bootstrap_witness = ...; // Assume bootstrap_witness is initialized
+ * cardano_ed25519_signature_t* signature = ...; // Assume signature is initialized
+ *
+ * cardano_error_t result = cardano_bootstrap_witness_set_signature(bootstrap_witness, signature);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Signature successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the signature.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_signature_unref(&signature); // Caller still owns their reference to the signature
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bootstrap_witness_set_signature(
+  cardano_bootstrap_witness_t* bootstrap_witness,
+  cardano_ed25519_signature_t* signature);
+
+/**
+ * \brief Retrieves the chain code associated with a Bootstrap Witness.
+ *
+ * This function returns the chain code stored in a given \ref cardano_bootstrap_witness_t object.
+ * The chain code is used in the derivation of HD (Hierarchical Deterministic) wallet addresses in the Byron era.
+ *
+ * \param[in] bootstrap_witness A pointer to an initialized \ref cardano_bootstrap_witness_t object from which to retrieve the chain code.
+ *
+ * \return A pointer to a \ref cardano_buffer_t object containing the chain code bytes. The returned object is a new reference,
+ *         and the caller is responsible for managing its lifecycle. Specifically, the caller must release the chain code object
+ *         by calling \ref cardano_buffer_unref when it is no longer needed. Returns NULL if the \p bootstrap_witness is NULL or
+ *         if no chain code is associated with the witness.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_t* bootstrap_witness = ...; // Assume bootstrap_witness is initialized
+ * cardano_buffer_t* chain_code = cardano_bootstrap_witness_get_chain_code(bootstrap_witness);
+ *
+ * if (chain_code != NULL)
+ * {
+ *   // Use the chain code
+ *   // Ensure to release the chain code buffer once done
+ *   cardano_buffer_unref(&chain_code);
+ * }
+ * else
+ * {
+ *   printf("No chain code associated with the bootstrap witness or bootstrap_witness is NULL.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_buffer_t* cardano_bootstrap_witness_get_chain_code(
+  cardano_bootstrap_witness_t* bootstrap_witness);
+
+/**
+ * \brief Sets the chain code for a Bootstrap Witness.
+ *
+ * This function assigns a new chain code to the given \ref cardano_bootstrap_witness_t object.
+ * The chain code is used in the derivation of HD (Hierarchical Deterministic) wallet addresses in the Byron era.
+ *
+ * \param[in,out] bootstrap_witness A pointer to an initialized \ref cardano_bootstrap_witness_t object
+ *                                  to which the chain code will be set.
+ * \param[in] chain_code A pointer to an initialized \ref cardano_buffer_t object containing the new chain code bytes.
+ *                       This parameter must not be NULL. A chain code of any length, including an empty one, is accepted;
+ *                       the ledger only requires 32 bytes from protocol version 12 on.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the chain code
+ *         was successfully set, or \ref CARDANO_ERROR_POINTER_IS_NULL if any of the input pointers are NULL.
+ *
+ * \note This function increases the reference count of the \p chain_code object, so the caller retains ownership of
+ *       their respective references and must manage their lifecycles appropriately.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_t* bootstrap_witness = ...; // Assume initialized
+ * cardano_buffer_t* chain_code = cardano_buffer_new(...); // Assume chain code is initialized
+ *
+ * cardano_error_t result = cardano_bootstrap_witness_set_chain_code(bootstrap_witness, chain_code);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Chain code set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the chain code: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // The caller retains ownership of chain_code and should free it once no longer needed
+ * cardano_buffer_unref(&chain_code);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bootstrap_witness_set_chain_code(
+  cardano_bootstrap_witness_t* bootstrap_witness,
+  cardano_buffer_t*            chain_code);
+
+/**
+ * \brief Retrieves the attributes from a Bootstrap Witness.
+ *
+ * This function extracts the additional attributes used for network discrimination or other purposes
+ * from a \ref cardano_bootstrap_witness_t object. These attributes are specific to the Byron era and
+ * are stored as a byte array.
+ *
+ * \param[in] bootstrap_witness A pointer to an initialized \ref cardano_bootstrap_witness_t object from which to retrieve the attributes.
+ *
+ * \return A pointer to a \ref cardano_buffer_t object containing the attributes. The returned object is a new reference, and
+ *         the caller is responsible for managing its lifecycle. Specifically, the caller must release the buffer by calling
+ *         \ref cardano_buffer_unref when it is no longer needed.
+ *         If the \p bootstrap_witness is NULL or no attributes are set, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_t* bootstrap_witness = ...; // Assume initialized
+ * cardano_buffer_t* attributes = cardano_bootstrap_witness_get_attributes(bootstrap_witness);
+ *
+ * if (attributes != NULL)
+ * {
+ *   // Use the attributes
+ *   printf("Attributes size: %zu\n", cardano_buffer_get_size(attributes));
+ *
+ *   // Ensure to release the buffer once done
+ *   cardano_buffer_unref(&attributes);
+ * }
+ * else
+ * {
+ *   printf("No attributes found or bootstrap witness is NULL.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_buffer_t* cardano_bootstrap_witness_get_attributes(
+  cardano_bootstrap_witness_t* bootstrap_witness);
+
+/**
+ * \brief Sets the attributes for a Bootstrap Witness.
+ *
+ * This function assigns a new set of attributes to a \ref cardano_bootstrap_witness_t object. The attributes
+ * are used primarily for network discrimination or other purposes in the Byron era. The attributes are stored
+ * as a byte array.
+ *
+ * \param[in,out] bootstrap_witness A pointer to an initialized \ref cardano_bootstrap_witness_t object
+ *                                  where the attributes will be set.
+ * \param[in] attributes A pointer to an initialized \ref cardano_buffer_t object containing the attributes to set.
+ *                       The caller retains ownership of the buffer and must manage its lifecycle, including
+ *                       releasing it with \ref cardano_buffer_unref when it is no longer needed.
+ *                       This parameter can be NULL to clear the attributes.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the attributes
+ *         were successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p bootstrap_witness is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_t* bootstrap_witness = ...; // Assume initialized
+ * cardano_buffer_t* attributes = ...; // Assume initialized buffer containing attributes
+ *
+ * cardano_error_t result = cardano_bootstrap_witness_set_attributes(bootstrap_witness, attributes);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Attributes successfully set for bootstrap witness.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set attributes: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // The caller must manage the lifecycle of the attributes buffer separately.
+ * cardano_buffer_unref(&attributes);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bootstrap_witness_set_attributes(
+  cardano_bootstrap_witness_t* bootstrap_witness,
+  cardano_buffer_t*            attributes);
+
+/**
+ * \brief Decrements the reference count of a cardano_bootstrap_witness_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_bootstrap_witness_t object
+ * by decreasing its reference count. When the reference count reaches zero, the bootstrap_witness is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] bootstrap_witness A pointer to the pointer of the bootstrap_witness object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_t* bootstrap_witness = cardano_bootstrap_witness_new(major, minor);
+ *
+ * // Perform operations with the bootstrap_witness...
+ *
+ * cardano_bootstrap_witness_unref(&bootstrap_witness);
+ * // At this point, bootstrap_witness is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_bootstrap_witness_unref, the pointer to the \ref cardano_bootstrap_witness_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_bootstrap_witness_unref(cardano_bootstrap_witness_t** bootstrap_witness);
+
+/**
+ * \brief Increases the reference count of the cardano_bootstrap_witness_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_bootstrap_witness_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_bootstrap_witness_unref.
+ *
+ * \param bootstrap_witness A pointer to the cardano_bootstrap_witness_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming bootstrap_witness is a previously created bootstrap_witness object
+ *
+ * cardano_bootstrap_witness_ref(bootstrap_witness);
+ *
+ * // Now bootstrap_witness can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_bootstrap_witness_ref there is a corresponding
+ * call to \ref cardano_bootstrap_witness_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_bootstrap_witness_ref(cardano_bootstrap_witness_t* bootstrap_witness);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_bootstrap_witness_t object.
+ *
+ * This function returns the number of active references to an cardano_bootstrap_witness_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_bootstrap_witness_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param bootstrap_witness A pointer to the cardano_bootstrap_witness_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_bootstrap_witness_t object. If the object
+ * is properly managed (i.e., every \ref cardano_bootstrap_witness_ref call is matched with a
+ * \ref cardano_bootstrap_witness_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming bootstrap_witness is a previously created bootstrap_witness object
+ *
+ * size_t ref_count = cardano_bootstrap_witness_refcount(bootstrap_witness);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bootstrap_witness_refcount(const cardano_bootstrap_witness_t* bootstrap_witness);
+
+/**
+ * \brief Sets the last error message for a given cardano_bootstrap_witness_t object.
+ *
+ * Records an error message in the bootstrap_witness's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] bootstrap_witness A pointer to the \ref cardano_bootstrap_witness_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the bootstrap_witness's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_bootstrap_witness_set_last_error(
+  cardano_bootstrap_witness_t* bootstrap_witness,
+  const char*                  message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific bootstrap_witness.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_bootstrap_witness_set_last_error for the given
+ * bootstrap_witness. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] bootstrap_witness A pointer to the \ref cardano_bootstrap_witness_t instance whose last error
+ *                   message is to be retrieved. If the bootstrap_witness is NULL, the function
+ *                   returns a generic error message indicating the null bootstrap_witness.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified bootstrap_witness. If the bootstrap_witness is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_bootstrap_witness_set_last_error for the same bootstrap_witness, or until
+ *       the bootstrap_witness is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_bootstrap_witness_get_last_error(
+  const cardano_bootstrap_witness_t* bootstrap_witness);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_bootstrap_witness_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_bootstrap_witness_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_bootstrap_witness_deep_clone(const cardano_bootstrap_witness_t* source, cardano_bootstrap_witness_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BOOTSTRAP_WITNESS_H
diff --git a/vendor/include/cardano/witness_set/bootstrap_witness_set.h b/vendor/include/cardano/witness_set/bootstrap_witness_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/bootstrap_witness_set.h
@@ -0,0 +1,546 @@
+/**
+ * \file bootstrap_witness_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BOOTSTRAP_WITNESS_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BOOTSTRAP_WITNESS_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+#include <cardano/witness_set/bootstrap_witness.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a bootstrap_witness used in the Cardano blockchain, which can be either a key hash or a script hash.
+ */
+typedef struct cardano_bootstrap_witness_t cardano_bootstrap_witness_t;
+
+/**
+ * \brief Represents a set of bootstrap_witnesss.
+ */
+typedef struct cardano_bootstrap_witness_set_t cardano_bootstrap_witness_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a bootstrap_witness_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_bootstrap_witness_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] bootstrap_witness_set On successful initialization, this will point to a newly created
+ *             \ref cardano_bootstrap_witness_set_t object. This object represents a "strong reference"
+ *             to the bootstrap_witness_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the bootstrap_witness_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_bootstrap_witness_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the bootstrap_witness_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_set_t* bootstrap_witness_set = NULL;
+ *
+ * // Attempt to create a new bootstrap_witness_set
+ * cardano_error_t result = cardano_bootstrap_witness_set_new(&bootstrap_witness_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bootstrap_witness_set
+ *
+ *   // Once done, ensure to clean up and release the bootstrap_witness_set
+ *   cardano_bootstrap_witness_set_unref(&bootstrap_witness_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bootstrap_witness_set_new(cardano_bootstrap_witness_set_t** bootstrap_witness_set);
+
+/**
+ * \brief Creates a bootstrap_witness set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_bootstrap_witness_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a bootstrap_witness.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded bootstrap_witness data.
+ * \param[out] bootstrap_witnesss A pointer to a pointer of \ref cardano_bootstrap_witness_set_t that will be set to the address
+ *                        of the newly created bootstrap_witness object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the bootstrap_witness was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_bootstrap_witness_set_t object by calling
+ *       \ref cardano_bootstrap_witness_set_unref when it is no longer needed.
+ *
+ * \remark The set keeps every witness it is decoded with, including several witnesses for the same address root, and
+ *         encodes them all back so that the original CBOR is reproduced. Earlier protocol versions keep only the last
+ *         of them and protocol version 12 rejects them; call \ref cardano_bootstrap_witness_set_clear_cbor_cache to
+ *         encode one witness per address root.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_bootstrap_witness_set_t* bootstrap_witness = NULL;
+ *
+ * cardano_error_t result = cardano_bootstrap_witness_set_from_cbor(reader, &bootstrap_witness);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the bootstrap_witness
+ *
+ *   // Once done, ensure to clean up and release the bootstrap_witness
+ *   cardano_bootstrap_witness_set_unref(&bootstrap_witness);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode bootstrap_witness: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_bootstrap_witness_set_from_cbor(cardano_cbor_reader_t* reader, cardano_bootstrap_witness_set_t** bootstrap_witnesss);
+
+/**
+ * \brief Serializes a bootstrap_witness into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_bootstrap_witness_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] bootstrap_witnesss A constant pointer to the \ref cardano_bootstrap_witness_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p bootstrap_witness or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark The ledger identifies a bootstrap witness by its address root, the hash of its public key, chain code and
+ *         attributes, so two witnesses with the same public key, chain code and attributes are the same witness even
+ *         if their signatures differ. The ledger keeps only the last of them before protocol version 12 and rejects
+ *         them from protocol version 12, so only the last witness for each address root is written. A set decoded
+ *         from CBOR is the exception: it writes every witness it was decoded with until it is modified with
+ *         \ref cardano_bootstrap_witness_set_add or \ref cardano_bootstrap_witness_set_clear_cbor_cache is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_set_t* bootstrap_witness = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_bootstrap_witness_set_to_cbor(bootstrap_witness, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_bootstrap_witness_set_unref(&bootstrap_witness);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bootstrap_witness_set_to_cbor(
+  const cardano_bootstrap_witness_set_t* bootstrap_witnesss,
+  cardano_cbor_writer_t*                 writer);
+
+/**
+ * \brief Serializes a set of bootstrap witnesses to a CIP-116 JSON array.
+ *
+ * This function iterates over the set and serializes each \ref cardano_bootstrap_witness_t
+ * into a JSON array.
+ *
+ * \param[in]  witnesses Pointer to a valid \ref cardano_bootstrap_witness_set_t.
+ * \param[in]  writer    Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p witnesses or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bootstrap_witness_set_to_cip116_json(
+  const cardano_bootstrap_witness_set_t* witnesses,
+  cardano_json_writer_t*                 writer);
+
+/**
+ * \brief Retrieves the length of a bootstrap_witness list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_bootstrap_witness_set_t object.
+ *
+ * \param[in] bootstrap_witness_set A constant pointer to the \ref cardano_bootstrap_witness_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the bootstrap_witness_set. Return 0 if the bootstrap_witness_set is NULL.
+ *
+ * \note The length counts every element held by the set, including decoded witnesses for the same address root, of
+ *       which \ref cardano_bootstrap_witness_set_to_cbor may write only the last.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_set_t* bootstrap_witness_set = cardano_bootstrap_witness_set_new();
+ *
+ * // Populate bootstrap_witness_set with elements
+ *
+ * size_t length = cardano_bootstrap_witness_set_get_length(bootstrap_witness_set);
+ * printf("Length of the bootstrap_witness_set: %zu\n", length);
+ *
+ * // Clean up the bootstrap_witness_set object once done
+ * cardano_bootstrap_witness_set_unref(&bootstrap_witness_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bootstrap_witness_set_get_length(const cardano_bootstrap_witness_set_t* bootstrap_witness_set);
+
+/**
+ * \brief Retrieves an element from a bootstrap_witness list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_bootstrap_witness_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] bootstrap_witness_set A constant pointer to the \ref cardano_bootstrap_witness_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the bootstrap_witness list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_bootstrap_witness_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_bootstrap_witness_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_set_t* bootstrap_witness_set = cardano_bootstrap_witness_set_new();
+ *
+ * // Populate bootstrap_witness_set with elements
+ *
+ * cardano_bootstrap_witness_t* element = NULL;
+ * cardano_error_t result = cardano_bootstrap_witness_set_get(bootstrap_witness_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_bootstrap_witness_unref(&element);
+ * }
+ *
+ * // Clean up the bootstrap_witness_set object once done
+ * cardano_bootstrap_witness_set_unref(&bootstrap_witness_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bootstrap_witness_set_get(const cardano_bootstrap_witness_set_t* bootstrap_witness_set, size_t index, cardano_bootstrap_witness_t** element);
+
+/**
+ * \brief Adds an element to a bootstrap_witness list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_bootstrap_witness_set_t object.
+ * If elements with the same public key, chain code and attributes, and therefore the same address root, are already
+ * present in the set, the signature of each of them is replaced with the signature of the added element and no element
+ * is added, so the set holds one witness per address root.
+ *
+ * After this call the set is encoded with one witness per address root, even if it was decoded from CBOR with more.
+ *
+ * \param[in] bootstrap_witness_set A constant pointer to the \ref cardano_bootstrap_witness_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_bootstrap_witness_t object that is to be added to the bootstrap_witness_set.
+ *                    The element will be referenced by the bootstrap_witness_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the bootstrap_witness_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_set_t* bootstrap_witness_set = cardano_bootstrap_witness_set_new();
+ *
+ * // Create and initialize a new bootstrap_witness element
+ * cardano_bootstrap_witness_t* element = { ... };
+ *
+ * // Add the element to the bootstrap_witness_set
+ * cardano_error_t result = cardano_bootstrap_witness_set_add(bootstrap_witness_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the bootstrap_witness_set object once done
+ * cardano_bootstrap_witness_set_unref(&bootstrap_witness_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bootstrap_witness_set_add(cardano_bootstrap_witness_set_t* bootstrap_witness_set, cardano_bootstrap_witness_t* element);
+
+/**
+ * \brief Checks if the bootstrap witness set uses tagged encoding (Conway era feature).
+ *
+ * This function determines whether the specified \ref cardano_bootstrap_witness_set_t object uses tagged encoding for sets,
+ * introduced in the Conway era of the Cardano blockchain. Tagged sets are a new way of encoding sets in CBOR, which
+ * differs from the older array-based representation used in previous eras.
+ *
+ * \param[in] bootstrap_witness_set A pointer to an initialized \ref cardano_bootstrap_witness_set_t object.
+ *
+ * \return \c true if the bootstrap witness set uses tagged encoding for sets; \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ *
+ * bool uses_tag = cardano_bootstrap_witness_set_get_use_tag(witness_set);
+ * if (uses_tag)
+ * {
+ *   printf("The bootstrap witness set uses tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("The bootstrap witness set uses legacy array encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_bootstrap_witness_set_get_use_tag(const cardano_bootstrap_witness_set_t* bootstrap_witness_set);
+
+/**
+ * \brief Enables or disables tagged encoding (Conway era feature) for the bootstrap witness set.
+ *
+ * This function sets whether the specified \ref cardano_bootstrap_witness_set_t object should use tagged encoding
+ * (introduced in the Conway era) when serializing sets in CBOR. If \p use_tag is set to \c true, the set will be encoded
+ * using tagged sets. Otherwise, it will use the older array-based encoding method.
+ *
+ * \param[in,out] bootstrap_witness_set A pointer to an initialized \ref cardano_bootstrap_witness_set_t object.
+ * \param[in] use_tag A boolean value that determines whether to use tagged encoding (\c true) or legacy array encoding (\c false).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_error_t result = cardano_bootstrap_witness_set_set_use_tag(witness_set, true);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The bootstrap witness set is now set to use tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set tagged encoding: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_bootstrap_witness_set_set_use_tag(cardano_bootstrap_witness_set_t* bootstrap_witness_set, bool use_tag);
+
+/**
+ * \brief Clears the encoding details a bootstrap witness set keeps from the CBOR it was decoded from.
+ *
+ * A bootstrap witness set created with \ref cardano_bootstrap_witness_set_from_cbor encodes back with the same set tag
+ * form and every witness it was decoded with, including several witnesses for the same address root, so that the
+ * original CBOR is reproduced. This function drops those details: the set is then encoded with the set tag and only
+ * the last witness for each address root, which is the form the ledger accepts in every protocol version.
+ *
+ * \param[in,out] bootstrap_witness_set A pointer to an initialized \ref cardano_bootstrap_witness_set_t object. If NULL,
+ *                                      the function does nothing.
+ *
+ * \warning Clearing the encoding details may change the binary representation of the witness set when serialized,
+ *          which changes the bytes of a transaction that holds it. The transaction id is not affected.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_set_t* bootstrap_witness_set = ...; // Assume it was decoded from CBOR
+ *
+ * cardano_bootstrap_witness_set_clear_cbor_cache(bootstrap_witness_set);
+ *
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ * cardano_error_t result = cardano_bootstrap_witness_set_to_cbor(bootstrap_witness_set, writer);
+ *
+ * cardano_cbor_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_bootstrap_witness_set_clear_cbor_cache(cardano_bootstrap_witness_set_t* bootstrap_witness_set);
+
+/**
+ * \brief Decrements the reference count of a bootstrap_witness_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_bootstrap_witness_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the bootstrap_witness_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] bootstrap_witness_set A pointer to the pointer of the bootstrap_witness_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_bootstrap_witness_set_t* bootstrap_witness_set = cardano_bootstrap_witness_set_new();
+ *
+ * // Perform operations with the bootstrap_witness_set...
+ *
+ * cardano_bootstrap_witness_set_unref(&bootstrap_witness_set);
+ * // At this point, bootstrap_witness_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_bootstrap_witness_set_unref, the pointer to the \ref cardano_bootstrap_witness_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_bootstrap_witness_set_unref(cardano_bootstrap_witness_set_t** bootstrap_witness_set);
+
+/**
+ * \brief Increases the reference count of the cardano_bootstrap_witness_set_t object.
+ *
+ * This function is used to manually increment the reference count of a bootstrap_witness_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_bootstrap_witness_set_unref.
+ *
+ * \param bootstrap_witness_set A pointer to the bootstrap_witness_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming bootstrap_witness_set is a previously created bootstrap_witness_set object
+ *
+ * cardano_bootstrap_witness_set_ref(bootstrap_witness_set);
+ *
+ * // Now bootstrap_witness_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_bootstrap_witness_set_ref there is a corresponding
+ * call to \ref cardano_bootstrap_witness_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_bootstrap_witness_set_ref(cardano_bootstrap_witness_set_t* bootstrap_witness_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_bootstrap_witness_set_t object.
+ *
+ * This function returns the number of active references to a bootstrap_witness_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_bootstrap_witness_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param bootstrap_witness_set A pointer to the bootstrap_witness_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified bootstrap_witness_set object. If the object
+ * is properly managed (i.e., every \ref cardano_bootstrap_witness_set_ref call is matched with a
+ * \ref cardano_bootstrap_witness_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming bootstrap_witness_set is a previously created bootstrap_witness_set object
+ *
+ * size_t ref_count = cardano_bootstrap_witness_set_refcount(bootstrap_witness_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_bootstrap_witness_set_refcount(const cardano_bootstrap_witness_set_t* bootstrap_witness_set);
+
+/**
+ * \brief Sets the last error message for a given bootstrap_witness_set object.
+ *
+ * Records an error message in the bootstrap_witness_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] bootstrap_witness_set A pointer to the \ref cardano_bootstrap_witness_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the bootstrap_witness_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_bootstrap_witness_set_set_last_error(cardano_bootstrap_witness_set_t* bootstrap_witness_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific bootstrap_witness_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_bootstrap_witness_set_set_last_error for the given
+ * bootstrap_witness_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] bootstrap_witness_set A pointer to the \ref cardano_bootstrap_witness_set_t instance whose last error
+ *                   message is to be retrieved. If the bootstrap_witness_set is NULL, the function
+ *                   returns a generic error message indicating the null bootstrap_witness_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified bootstrap_witness_set. If the bootstrap_witness_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_bootstrap_witness_set_set_last_error for the same bootstrap_witness_set, or until
+ *       the bootstrap_witness_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_bootstrap_witness_set_get_last_error(const cardano_bootstrap_witness_set_t* bootstrap_witness_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_bootstrap_witness_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_bootstrap_witness_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_bootstrap_witness_set_deep_clone(const cardano_bootstrap_witness_set_t* source, cardano_bootstrap_witness_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BOOTSTRAP_WITNESS_SET_H
diff --git a/vendor/include/cardano/witness_set/native_script_set.h b/vendor/include/cardano/witness_set/native_script_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/native_script_set.h
@@ -0,0 +1,498 @@
+/**
+ * \file native_script_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/scripts/native_scripts/native_script.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ */
+typedef struct cardano_native_script_t cardano_native_script_t;
+
+/**
+ * \brief Represents a set of native_scripts.
+ */
+typedef struct cardano_native_script_set_t cardano_native_script_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a native_script_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_native_script_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] native_script_set On successful initialization, this will point to a newly created
+ *             \ref cardano_native_script_set_t object. This object represents a "strong reference"
+ *             to the native_script_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the native_script_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_native_script_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the native_script_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_set_t* native_script_set = NULL;
+ *
+ * // Attempt to create a new native_script_set
+ * cardano_error_t result = cardano_native_script_set_new(&native_script_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script_set
+ *
+ *   // Once done, ensure to clean up and release the native_script_set
+ *   cardano_native_script_set_unref(&native_script_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_set_new(cardano_native_script_set_t** native_script_set);
+
+/**
+ * \brief Creates a native_script set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_native_script_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a native_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded native_script data.
+ * \param[out] native_scripts A pointer to a pointer of \ref cardano_native_script_set_t that will be set to the address
+ *                        of the newly created native_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the native_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_native_script_set_t object by calling
+ *       \ref cardano_native_script_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_native_script_set_t* native_script = NULL;
+ *
+ * cardano_error_t result = cardano_native_script_set_from_cbor(reader, &native_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the native_script
+ *
+ *   // Once done, ensure to clean up and release the native_script
+ *   cardano_native_script_set_unref(&native_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode native_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_set_from_cbor(cardano_cbor_reader_t* reader, cardano_native_script_set_t** native_scripts);
+
+/**
+ * \brief Serializes a native_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_native_script_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] native_scripts A constant pointer to the \ref cardano_native_script_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p native_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_set_t* native_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_native_script_set_to_cbor(native_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_native_script_set_unref(&native_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_set_to_cbor(
+  const cardano_native_script_set_t* native_scripts,
+  cardano_cbor_writer_t*             writer);
+
+/**
+ * \brief Serializes a set of native scripts to a CIP-116 JSON array.
+ *
+ * This function iterates over the set and serializes each \ref cardano_native_script_t
+ * into a JSON array.
+ *
+ * \param[in]  scripts Pointer to a valid \ref cardano_native_script_set_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p scripts or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_set_to_cip116_json(
+  const cardano_native_script_set_t* scripts,
+  cardano_json_writer_t*             writer);
+
+/**
+ * \brief Retrieves the length of a native_script list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_native_script_set_t object.
+ *
+ * \param[in] native_script_set A constant pointer to the \ref cardano_native_script_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the native_script_set. Return 0 if the native_script_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_set_t* native_script_set = cardano_native_script_set_new();
+ *
+ * // Populate native_script_set with elements
+ *
+ * size_t length = cardano_native_script_set_get_length(native_script_set);
+ * printf("Length of the native_script_set: %zu\n", length);
+ *
+ * // Clean up the native_script_set object once done
+ * cardano_native_script_set_unref(&native_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_native_script_set_get_length(const cardano_native_script_set_t* native_script_set);
+
+/**
+ * \brief Retrieves an element from a native_script list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_native_script_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] native_script_set A constant pointer to the \ref cardano_native_script_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the native_script list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_native_script_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_native_script_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_set_t* native_script_set = cardano_native_script_set_new();
+ *
+ * // Populate native_script_set with elements
+ *
+ * cardano_native_script_t* element = NULL;
+ * cardano_error_t result = cardano_native_script_set_get(native_script_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_native_script_unref(&element);
+ * }
+ *
+ * // Clean up the native_script_set object once done
+ * cardano_native_script_set_unref(&native_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_set_get(const cardano_native_script_set_t* native_script_set, size_t index, cardano_native_script_t** element);
+
+/**
+ * \brief Adds an element to a native_script list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_native_script_set_t object.
+ *
+ * \param[in] native_script_set A constant pointer to the \ref cardano_native_script_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_native_script_t object that is to be added to the native_script_set.
+ *                    The element will be referenced by the native_script_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the native_script_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_set_t* native_script_set = cardano_native_script_set_new();
+ *
+ * // Create and initialize a new native_script element
+ * cardano_native_script_t* element = { ... };
+ *
+ * // Add the element to the native_script_set
+ * cardano_error_t result = cardano_native_script_set_add(native_script_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the native_script_set object once done
+ * cardano_native_script_set_unref(&native_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_set_add(cardano_native_script_set_t* native_script_set, cardano_native_script_t* element);
+
+/**
+ * \brief Checks if the native script set uses tagged encoding (Conway era feature).
+ *
+ * This function determines whether the specified \ref cardano_native_script_set_t object uses tagged encoding for sets,
+ * introduced in the Conway era of the Cardano blockchain. Tagged sets are a new way of encoding sets in CBOR, which
+ * differs from the older array-based representation used in previous eras.
+ *
+ * \param[in] native_script_set A pointer to an initialized \ref cardano_native_script_set_t object.
+ *
+ * \return \c true if the native script set uses tagged encoding for sets; \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_set_t* native_script_set = ...; // Assume native_script_set is already initialized
+ *
+ * bool uses_tag = cardano_native_script_set_get_use_tag(native_script_set);
+ * if (uses_tag)
+ * {
+ *   printf("The native script set uses tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("The native script set uses legacy array encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_native_script_set_get_use_tag(const cardano_native_script_set_t* native_script_set);
+
+/**
+ * \brief Enables or disables tagged encoding (Conway era feature) for the native script set.
+ *
+ * This function sets whether the specified \ref cardano_native_script_set_t object should use tagged encoding
+ * (introduced in the Conway era) when serializing sets in CBOR. If \p use_tag is set to \c true, the witness set will be encoded
+ * using tagged sets. Otherwise, it will use the older array-based encoding method.
+ *
+ * \param[in,out] native_script_set A pointer to an initialized \ref cardano_native_script_set_t object.
+ * \param[in] use_tag A boolean value that determines whether to use tagged encoding (\c true) or legacy array encoding (\c false).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_set_t* native_script_set = ...; // Assume native_script_set is already initialized
+ * cardano_error_t result = cardano_native_script_set_set_use_tag(native_script_set, true);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The native script set is now set to use tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set tagged encoding: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_native_script_set_set_use_tag(cardano_native_script_set_t* native_script_set, bool use_tag);
+
+/**
+ * \brief Decrements the reference count of a native_script_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_native_script_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the native_script_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] native_script_set A pointer to the pointer of the native_script_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_native_script_set_t* native_script_set = cardano_native_script_set_new();
+ *
+ * // Perform operations with the native_script_set...
+ *
+ * cardano_native_script_set_unref(&native_script_set);
+ * // At this point, native_script_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_native_script_set_unref, the pointer to the \ref cardano_native_script_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_native_script_set_unref(cardano_native_script_set_t** native_script_set);
+
+/**
+ * \brief Increases the reference count of the cardano_native_script_set_t object.
+ *
+ * This function is used to manually increment the reference count of a native_script_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_native_script_set_unref.
+ *
+ * \param native_script_set A pointer to the native_script_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming native_script_set is a previously created native_script_set object
+ *
+ * cardano_native_script_set_ref(native_script_set);
+ *
+ * // Now native_script_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_native_script_set_ref there is a corresponding
+ * call to \ref cardano_native_script_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_native_script_set_ref(cardano_native_script_set_t* native_script_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_native_script_set_t object.
+ *
+ * This function returns the number of active references to a native_script_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_native_script_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param native_script_set A pointer to the native_script_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified native_script_set object. If the object
+ * is properly managed (i.e., every \ref cardano_native_script_set_ref call is matched with a
+ * \ref cardano_native_script_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming native_script_set is a previously created native_script_set object
+ *
+ * size_t ref_count = cardano_native_script_set_refcount(native_script_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_native_script_set_refcount(const cardano_native_script_set_t* native_script_set);
+
+/**
+ * \brief Sets the last error message for a given native_script_set object.
+ *
+ * Records an error message in the native_script_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] native_script_set A pointer to the \ref cardano_native_script_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the native_script_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_native_script_set_set_last_error(cardano_native_script_set_t* native_script_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific native_script_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_native_script_set_set_last_error for the given
+ * native_script_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] native_script_set A pointer to the \ref cardano_native_script_set_t instance whose last error
+ *                   message is to be retrieved. If the native_script_set is NULL, the function
+ *                   returns a generic error message indicating the null native_script_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified native_script_set. If the native_script_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_native_script_set_set_last_error for the same native_script_set, or until
+ *       the native_script_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_native_script_set_get_last_error(const cardano_native_script_set_t* native_script_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_native_script_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_native_script_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_native_script_set_deep_clone(const cardano_native_script_set_t* source, cardano_native_script_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_NATIVE_SCRIPT_SET_H
diff --git a/vendor/include/cardano/witness_set/plutus_data_set.h b/vendor/include/cardano/witness_set/plutus_data_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/plutus_data_set.h
@@ -0,0 +1,565 @@
+/**
+ * \file plutus_data_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_DATA_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_DATA_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A type corresponding to the Plutus Core Data datatype.
+ *
+ * The point of this type is to be opaque as to ensure that it is only used in ways
+ * that plutus scripts can handle.
+ *
+ * Use this type to build any data structures that you want to be representable on-chain.
+ */
+typedef struct cardano_plutus_data_t cardano_plutus_data_t;
+
+/**
+ * \brief Represents a set of plutus_data.
+ */
+typedef struct cardano_plutus_data_set_t cardano_plutus_data_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_data_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_plutus_data_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] plutus_data_set On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_data_set_t object. This object represents a "strong reference"
+ *             to the plutus_data_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_data_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_data_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_data_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_set_t* plutus_data_set = NULL;
+ *
+ * // Attempt to create a new plutus_data_set
+ * cardano_error_t result = cardano_plutus_data_set_new(&plutus_data_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_data_set
+ *
+ *   // Once done, ensure to clean up and release the plutus_data_set
+ *   cardano_plutus_data_set_unref(&plutus_data_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_set_new(cardano_plutus_data_set_t** plutus_data_set);
+
+/**
+ * \brief Creates a plutus_data set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_data_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_data.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_data data.
+ * \param[out] plutus_data A pointer to a pointer of \ref cardano_plutus_data_set_t that will be set to the address
+ *                        of the newly created plutus_data object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_data was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the plutus data and invalidate any existing signatures.
+ *         To prevent this, when the plutus data set object is created using \ref cardano_plutus_data_set_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_plutus_data_set_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_plutus_data_set_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_data_set_t object by calling
+ *       \ref cardano_plutus_data_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_data_set_t* plutus_data = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_data_set_from_cbor(reader, &plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_data
+ *
+ *   // Once done, ensure to clean up and release the plutus_data
+ *   cardano_plutus_data_set_unref(&plutus_data);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_data: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_set_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_data_set_t** plutus_data);
+
+/**
+ * \brief Serializes a plutus_data into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_data_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_data A constant pointer to the \ref cardano_plutus_data_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_data or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the plutus data and invalidate any existing signatures.
+ *         To prevent this, when the plutus data set object is created using \ref cardano_plutus_data_set_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_plutus_data_set_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_plutus_data_set_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_set_t* plutus_data = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_data_set_to_cbor(plutus_data, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_data_set_unref(&plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_set_to_cbor(
+  const cardano_plutus_data_set_t* plutus_data,
+  cardano_cbor_writer_t*           writer);
+
+/**
+ * \brief Serializes a Plutus data set to a CIP-116 JSON array.
+ *
+ * This function recursively serializes the elements of the Plutus data set as a JSON array.
+ * Each element in the set is serialized as a PlutusData object.
+ *
+ * \param[in]  set     Pointer to a valid \ref cardano_plutus_data_set_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p set or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_set_to_cip116_json(
+  const cardano_plutus_data_set_t* set,
+  cardano_json_writer_t*           writer);
+
+/**
+ * \brief Retrieves the length of a plutus_data list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_plutus_data_set_t object.
+ *
+ * \param[in] plutus_data_set A constant pointer to the \ref cardano_plutus_data_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the plutus_data_set. Return 0 if the plutus_data_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_set_t* plutus_data_set = cardano_plutus_data_set_new();
+ *
+ * // Populate plutus_data_set with elements
+ *
+ * size_t length = cardano_plutus_data_set_get_length(plutus_data_set);
+ * printf("Length of the plutus_data_set: %zu\n", length);
+ *
+ * // Clean up the plutus_data_set object once done
+ * cardano_plutus_data_set_unref(&plutus_data_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_data_set_get_length(const cardano_plutus_data_set_t* plutus_data_set);
+
+/**
+ * \brief Retrieves an element from a plutus_data list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_plutus_data_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] plutus_data_set A constant pointer to the \ref cardano_plutus_data_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the plutus_data list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_plutus_data_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_plutus_data_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_set_t* plutus_data_set = cardano_plutus_data_set_new();
+ *
+ * // Populate plutus_data_set with elements
+ *
+ * cardano_plutus_data_t* element = NULL;
+ * cardano_error_t result = cardano_plutus_data_set_get(plutus_data_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_plutus_data_unref(&element);
+ * }
+ *
+ * // Clean up the plutus_data_set object once done
+ * cardano_plutus_data_set_unref(&plutus_data_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_set_get(const cardano_plutus_data_set_t* plutus_data_set, size_t index, cardano_plutus_data_t** element);
+
+/**
+ * \brief Adds an element to a plutus_data list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_plutus_data_set_t object.
+ *
+ * \param[in] plutus_data_set A constant pointer to the \ref cardano_plutus_data_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_plutus_data_t object that is to be added to the plutus_data_set.
+ *                    The element will be referenced by the plutus_data_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the plutus_data_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_set_t* plutus_data_set = cardano_plutus_data_set_new();
+ *
+ * // Create and initialize a new plutus_data element
+ * cardano_plutus_data_t* element = { ... };
+ *
+ * // Add the element to the plutus_data_set
+ * cardano_error_t result = cardano_plutus_data_set_add(plutus_data_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the plutus_data_set object once done
+ * cardano_plutus_data_set_unref(&plutus_data_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_set_add(cardano_plutus_data_set_t* plutus_data_set, cardano_plutus_data_t* element);
+
+/**
+ * \brief Checks if the plutus data set uses tagged encoding (Conway era feature).
+ *
+ * This function determines whether the specified \ref cardano_plutus_data_set_t object uses tagged encoding for sets,
+ * introduced in the Conway era of the Cardano blockchain. Tagged sets are a new way of encoding sets in CBOR, which
+ * differs from the older array-based representation used in previous eras.
+ *
+ * \param[in] plutus_data_set A pointer to an initialized \ref cardano_plutus_data_set_t object.
+ *
+ * \return \c true if the plutus data set uses tagged encoding for sets; \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_set_t* plutus_data_set = ...; // Assume plutus_data_set is already initialized
+ *
+ * bool uses_tag = cardano_plutus_data_set_get_use_tag(plutus_data_set);
+ * if (uses_tag)
+ * {
+ *   printf("The plutus data set uses tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("The plutus data set uses legacy array encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_data_set_get_use_tag(const cardano_plutus_data_set_t* plutus_data_set);
+
+/**
+ * \brief Enables or disables tagged encoding (Conway era feature) for the plutus data set.
+ *
+ * This function sets whether the specified \ref cardano_plutus_data_set_t object should use tagged encoding
+ * (introduced in the Conway era) when serializing sets in CBOR. If \p use_tag is set to \c true, the set will be encoded
+ * using tagged sets. Otherwise, it will use the older array-based encoding method.
+ *
+ * \param[in,out] plutus_data_set A pointer to an initialized \ref cardano_plutus_data_set_t object.
+ * \param[in] use_tag A boolean value that determines whether to use tagged encoding (\c true) or legacy array encoding (\c false).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_set_t* plutus_data_set = ...; // Assume plutus_data_set is already initialized
+ * cardano_error_t result = cardano_plutus_data_set_set_use_tag(plutus_data_set, true);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The plutus data set is now set to use tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set tagged encoding: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_data_set_set_use_tag(cardano_plutus_data_set_t* plutus_data_set, bool use_tag);
+
+/**
+ * \brief Clears the cached CBOR representation from a plutus data set.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_plutus_data_set_t object.
+ * It is useful when you have modified the plutus_data list after it was created from CBOR using
+ * \ref cardano_plutus_data_set_t and you want to ensure that the next serialization reflects
+ * the current state of the plutus_data list, rather than using the original cached CBOR.
+ *
+ * \param[in,out] plutus_data_set A pointer to an initialized \ref cardano_plutus_data_set_t object
+ *                                 from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the plutus_data list when
+ *          serialized, which can alter the plutus_data list and invalidate any existing signatures.
+ *          Use this function with caution, especially if the transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume plutus_data list was created using cardano_plutus_data_set_t
+ * cardano_plutus_data_set_t* plutus_data_set = ...;
+ *
+ * // Modify the plutus_data list as needed
+
+ * // Clear the CBOR cache to ensure serialization uses the updated plutus_data list
+ * cardano_plutus_data_set_clear_cbor_cache(plutus_data_set);
+ *
+ * // Serialize the plutus_data list to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_plutus_data_set_to_cbor(plutus_data_set, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_plutus_data_set_unref(&plutus_data list);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_plutus_data_set_clear_cbor_cache(cardano_plutus_data_set_t* plutus_data_set);
+
+/**
+ * \brief Decrements the reference count of a plutus_data_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_data_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_data_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_data_set A pointer to the pointer of the plutus_data_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_data_set_t* plutus_data_set = cardano_plutus_data_set_new();
+ *
+ * // Perform operations with the plutus_data_set...
+ *
+ * cardano_plutus_data_set_unref(&plutus_data_set);
+ * // At this point, plutus_data_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_data_set_unref, the pointer to the \ref cardano_plutus_data_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_data_set_unref(cardano_plutus_data_set_t** plutus_data_set);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_data_set_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_data_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_data_set_unref.
+ *
+ * \param plutus_data_set A pointer to the plutus_data_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_data_set is a previously created plutus_data_set object
+ *
+ * cardano_plutus_data_set_ref(plutus_data_set);
+ *
+ * // Now plutus_data_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_data_set_ref there is a corresponding
+ * call to \ref cardano_plutus_data_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_data_set_ref(cardano_plutus_data_set_t* plutus_data_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_data_set_t object.
+ *
+ * This function returns the number of active references to a plutus_data_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_data_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_data_set A pointer to the plutus_data_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_data_set object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_data_set_ref call is matched with a
+ * \ref cardano_plutus_data_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_data_set is a previously created plutus_data_set object
+ *
+ * size_t ref_count = cardano_plutus_data_set_refcount(plutus_data_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_data_set_refcount(const cardano_plutus_data_set_t* plutus_data_set);
+
+/**
+ * \brief Sets the last error message for a given plutus_data_set object.
+ *
+ * Records an error message in the plutus_data_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_data_set A pointer to the \ref cardano_plutus_data_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_data_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_data_set_set_last_error(cardano_plutus_data_set_t* plutus_data_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_data_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_data_set_set_last_error for the given
+ * plutus_data_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_data_set A pointer to the \ref cardano_plutus_data_set_t instance whose last error
+ *                   message is to be retrieved. If the plutus_data_set is NULL, the function
+ *                   returns a generic error message indicating the null plutus_data_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_data_set. If the plutus_data_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_data_set_set_last_error for the same plutus_data_set, or until
+ *       the plutus_data_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_data_set_get_last_error(const cardano_plutus_data_set_t* plutus_data_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_data_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_data_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_data_set_deep_clone(const cardano_plutus_data_set_t* source, cardano_plutus_data_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_DATA_SET_H
diff --git a/vendor/include/cardano/witness_set/plutus_v1_script_set.h b/vendor/include/cardano/witness_set/plutus_v1_script_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/plutus_v1_script_set.h
@@ -0,0 +1,521 @@
+/**
+ * \file plutus_v1_script_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V1_SCRIPT_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V1_SCRIPT_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/scripts/plutus_scripts/plutus_v1_script.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V1 was the initial version of Plutus, introduced in the Alonzo hard fork.
+ */
+typedef struct cardano_plutus_v1_script_t cardano_plutus_v1_script_t;
+
+/**
+ * \brief Represents a set of plutus_v1_scripts.
+ */
+typedef struct cardano_plutus_v1_script_set_t cardano_plutus_v1_script_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_v1_script_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_plutus_v1_script_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] plutus_v1_script_set On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v1_script_set_t object. This object represents a "strong reference"
+ *             to the plutus_v1_script_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_v1_script_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v1_script_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_v1_script_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_set_t* plutus_v1_script_set = NULL;
+ *
+ * // Attempt to create a new plutus_v1_script_set
+ * cardano_error_t result = cardano_plutus_v1_script_set_new(&plutus_v1_script_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v1_script_set
+ *
+ *   // Once done, ensure to clean up and release the plutus_v1_script_set
+ *   cardano_plutus_v1_script_set_unref(&plutus_v1_script_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_set_new(cardano_plutus_v1_script_set_t** plutus_v1_script_set);
+
+/**
+ * \brief Creates a plutus_v1_script set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v1_script_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v1_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v1_script data.
+ * \param[out] plutus_v1_scripts A pointer to a pointer of \ref cardano_plutus_v1_script_set_t that will be set to the address
+ *                        of the newly created plutus_v1_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v1_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v1_script_set_t object by calling
+ *       \ref cardano_plutus_v1_script_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v1_script_set_t* plutus_v1_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v1_script_set_from_cbor(reader, &plutus_v1_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v1_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v1_script
+ *   cardano_plutus_v1_script_set_unref(&plutus_v1_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v1_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_set_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v1_script_set_t** plutus_v1_scripts);
+
+/**
+ * \brief Serializes a plutus_v1_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v1_script_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v1_scripts A constant pointer to the \ref cardano_plutus_v1_script_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v1_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_set_t* plutus_v1_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v1_script_set_to_cbor(plutus_v1_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v1_script_set_unref(&plutus_v1_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v1_script_set_to_cbor(
+  const cardano_plutus_v1_script_set_t* plutus_v1_scripts,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes a set of Plutus v1 scripts to CIP-116 JSON.
+ *
+ * The set is emitted as a JSON array. Each element is an object with the shape:
+ *
+ * \code{.json}
+ * {
+ *   "language": "plutus_v1",
+ *   "bytes": "<hex-encoded-script>"
+ * }
+ * \endcode
+ *
+ * Example output for two scripts:
+ *
+ * \code{.json}
+ * [
+ *   {"language":"plutus_v1","bytes":"0001"},
+ *   {"language":"plutus_v1","bytes":"aabbcc"}
+ * ]
+ * \endcode
+ *
+ * If \p writer is currently at the root, this function writes the array and its elements.
+ * If \p writer is already inside an array or object value position, the array is written
+ * as that value.
+ *
+ * \param[in] plutus_v1_scripts  A valid pointer to a Plutus v1 script set.
+ * \param[in] writer             A valid JSON writer (in a context where a value is expected).
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * \return CARDANO_ERROR_POINTER_IS_NULL   If \p plutus_v1_scripts or \p writer is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_set_to_cip116_json(
+  const cardano_plutus_v1_script_set_t* plutus_v1_scripts,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Retrieves the length of a plutus_v1_script list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_plutus_v1_script_set_t object.
+ *
+ * \param[in] plutus_v1_script_set A constant pointer to the \ref cardano_plutus_v1_script_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the plutus_v1_script_set. Return 0 if the plutus_v1_script_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_set_t* plutus_v1_script_set = cardano_plutus_v1_script_set_new();
+ *
+ * // Populate plutus_v1_script_set with elements
+ *
+ * size_t length = cardano_plutus_v1_script_set_get_length(plutus_v1_script_set);
+ * printf("Length of the plutus_v1_script_set: %zu\n", length);
+ *
+ * // Clean up the plutus_v1_script_set object once done
+ * cardano_plutus_v1_script_set_unref(&plutus_v1_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v1_script_set_get_length(const cardano_plutus_v1_script_set_t* plutus_v1_script_set);
+
+/**
+ * \brief Retrieves an element from a plutus_v1_script list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_plutus_v1_script_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] plutus_v1_script_set A constant pointer to the \ref cardano_plutus_v1_script_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the plutus_v1_script list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_plutus_v1_script_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_plutus_v1_script_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_set_t* plutus_v1_script_set = cardano_plutus_v1_script_set_new();
+ *
+ * // Populate plutus_v1_script_set with elements
+ *
+ * cardano_plutus_v1_script_t* element = NULL;
+ * cardano_error_t result = cardano_plutus_v1_script_set_get(plutus_v1_script_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_plutus_v1_script_unref(&element);
+ * }
+ *
+ * // Clean up the plutus_v1_script_set object once done
+ * cardano_plutus_v1_script_set_unref(&plutus_v1_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v1_script_set_get(const cardano_plutus_v1_script_set_t* plutus_v1_script_set, size_t index, cardano_plutus_v1_script_t** element);
+
+/**
+ * \brief Adds an element to a plutus_v1_script list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_plutus_v1_script_set_t object.
+ *
+ * \param[in] plutus_v1_script_set A constant pointer to the \ref cardano_plutus_v1_script_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_plutus_v1_script_t object that is to be added to the plutus_v1_script_set.
+ *                    The element will be referenced by the plutus_v1_script_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the plutus_v1_script_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_set_t* plutus_v1_script_set = cardano_plutus_v1_script_set_new();
+ *
+ * // Create and initialize a new plutus_v1_script element
+ * cardano_plutus_v1_script_t* element = { ... };
+ *
+ * // Add the element to the plutus_v1_script_set
+ * cardano_error_t result = cardano_plutus_v1_script_set_add(plutus_v1_script_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the plutus_v1_script_set object once done
+ * cardano_plutus_v1_script_set_unref(&plutus_v1_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v1_script_set_add(cardano_plutus_v1_script_set_t* plutus_v1_script_set, cardano_plutus_v1_script_t* element);
+
+/**
+ * \brief Checks if the plutus v1 script set uses tagged encoding (Conway era feature).
+ *
+ * This function determines whether the specified \ref cardano_plutus_v1_script_set_t object uses tagged encoding for sets,
+ * introduced in the Conway era of the Cardano blockchain. Tagged sets are a new way of encoding sets in CBOR, which
+ * differs from the older array-based representation used in previous eras.
+ *
+ * \param[in] plutus_v1_script_set A pointer to an initialized \ref cardano_plutus_v1_script_set_t object.
+ *
+ * \return \c true if the plutus data set uses tagged encoding for sets; \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_set_t* plutus_v1_script_set = ...; // Assume plutus_v1_script_set is already initialized
+ *
+ * bool uses_tag = cardano_plutus_v1_script_set_get_use_tag(plutus_v1_script_set);
+ * if (uses_tag)
+ * {
+ *   printf("The plutus data set uses tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("The plutus data set uses legacy array encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_v1_script_set_get_use_tag(const cardano_plutus_v1_script_set_t* plutus_v1_script_set);
+
+/**
+ * \brief Enables or disables tagged encoding (Conway era feature) for the plutus v1 script set.
+ *
+ * This function sets whether the specified \ref cardano_plutus_v1_script_set_t object should use tagged encoding
+ * (introduced in the Conway era) when serializing sets in CBOR. If \p use_tag is set to \c true, the set will be encoded
+ * using tagged sets. Otherwise, it will use the older array-based encoding method.
+ *
+ * \param[in,out] plutus_v1_script_set A pointer to an initialized \ref cardano_plutus_v1_script_set_t object.
+ * \param[in] use_tag A boolean value that determines whether to use tagged encoding (\c true) or legacy array encoding (\c false).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_set_t* plutus_v1_script_set = ...; // Assume plutus_v1_script_set is already initialized
+ * cardano_error_t result = cardano_plutus_v1_script_set_set_use_tag(plutus_v1_script_set, true);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The plutus data set is now set to use tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set tagged encoding: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v1_script_set_set_use_tag(cardano_plutus_v1_script_set_t* plutus_v1_script_set, bool use_tag);
+
+/**
+ * \brief Decrements the reference count of a plutus_v1_script_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v1_script_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v1_script_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v1_script_set A pointer to the pointer of the plutus_v1_script_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v1_script_set_t* plutus_v1_script_set = cardano_plutus_v1_script_set_new();
+ *
+ * // Perform operations with the plutus_v1_script_set...
+ *
+ * cardano_plutus_v1_script_set_unref(&plutus_v1_script_set);
+ * // At this point, plutus_v1_script_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v1_script_set_unref, the pointer to the \ref cardano_plutus_v1_script_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v1_script_set_unref(cardano_plutus_v1_script_set_t** plutus_v1_script_set);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v1_script_set_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v1_script_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v1_script_set_unref.
+ *
+ * \param plutus_v1_script_set A pointer to the plutus_v1_script_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v1_script_set is a previously created plutus_v1_script_set object
+ *
+ * cardano_plutus_v1_script_set_ref(plutus_v1_script_set);
+ *
+ * // Now plutus_v1_script_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v1_script_set_ref there is a corresponding
+ * call to \ref cardano_plutus_v1_script_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v1_script_set_ref(cardano_plutus_v1_script_set_t* plutus_v1_script_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v1_script_set_t object.
+ *
+ * This function returns the number of active references to a plutus_v1_script_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v1_script_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v1_script_set A pointer to the plutus_v1_script_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v1_script_set object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v1_script_set_ref call is matched with a
+ * \ref cardano_plutus_v1_script_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v1_script_set is a previously created plutus_v1_script_set object
+ *
+ * size_t ref_count = cardano_plutus_v1_script_set_refcount(plutus_v1_script_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v1_script_set_refcount(const cardano_plutus_v1_script_set_t* plutus_v1_script_set);
+
+/**
+ * \brief Sets the last error message for a given plutus_v1_script_set object.
+ *
+ * Records an error message in the plutus_v1_script_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v1_script_set A pointer to the \ref cardano_plutus_v1_script_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v1_script_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v1_script_set_set_last_error(cardano_plutus_v1_script_set_t* plutus_v1_script_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v1_script_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v1_script_set_set_last_error for the given
+ * plutus_v1_script_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v1_script_set A pointer to the \ref cardano_plutus_v1_script_set_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v1_script_set is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v1_script_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v1_script_set. If the plutus_v1_script_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v1_script_set_set_last_error for the same plutus_v1_script_set, or until
+ *       the plutus_v1_script_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v1_script_set_get_last_error(const cardano_plutus_v1_script_set_t* plutus_v1_script_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v1_script_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v1_script_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v1_script_set_deep_clone(const cardano_plutus_v1_script_set_t* source, cardano_plutus_v1_script_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V1_SCRIPT_SET_H
diff --git a/vendor/include/cardano/witness_set/plutus_v2_script_set.h b/vendor/include/cardano/witness_set/plutus_v2_script_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/plutus_v2_script_set.h
@@ -0,0 +1,529 @@
+/**
+ * \file plutus_v2_script_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V2_SCRIPT_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V2_SCRIPT_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/scripts/plutus_scripts/plutus_v2_script.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V2 was introduced in the Vasil hard fork.
+ *
+ * The main changes in V2 of Plutus were to the interface to scripts. The ScriptContext was extended
+ * to include the following information:
+ *
+ *  - The full “redeemers” structure, which contains all the redeemers used in the transaction
+ *  - Reference inputs in the transaction (proposed in CIP-31)
+ *  - Inline datums in the transaction (proposed in CIP-32)
+ *  - Reference scripts in the transaction (proposed in CIP-33)
+ */
+typedef struct cardano_plutus_v2_script_t cardano_plutus_v2_script_t;
+
+/**
+ * \brief Represents a set of plutus_v2_scripts.
+ */
+typedef struct cardano_plutus_v2_script_set_t cardano_plutus_v2_script_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_v2_script_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_plutus_v2_script_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] plutus_v2_script_set On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v2_script_set_t object. This object represents a "strong reference"
+ *             to the plutus_v2_script_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_v2_script_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v2_script_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_v2_script_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_set_t* plutus_v2_script_set = NULL;
+ *
+ * // Attempt to create a new plutus_v2_script_set
+ * cardano_error_t result = cardano_plutus_v2_script_set_new(&plutus_v2_script_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v2_script_set
+ *
+ *   // Once done, ensure to clean up and release the plutus_v2_script_set
+ *   cardano_plutus_v2_script_set_unref(&plutus_v2_script_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_set_new(cardano_plutus_v2_script_set_t** plutus_v2_script_set);
+
+/**
+ * \brief Creates a plutus_v2_script set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v2_script_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v2_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v2_script data.
+ * \param[out] plutus_v2_scripts A pointer to a pointer of \ref cardano_plutus_v2_script_set_t that will be set to the address
+ *                        of the newly created plutus_v2_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v2_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v2_script_set_t object by calling
+ *       \ref cardano_plutus_v2_script_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v2_script_set_t* plutus_v2_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v2_script_set_from_cbor(reader, &plutus_v2_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v2_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v2_script
+ *   cardano_plutus_v2_script_set_unref(&plutus_v2_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v2_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_set_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v2_script_set_t** plutus_v2_scripts);
+
+/**
+ * \brief Serializes a plutus_v2_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v2_script_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v2_scripts A constant pointer to the \ref cardano_plutus_v2_script_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v2_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_set_t* plutus_v2_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v2_script_set_to_cbor(plutus_v2_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v2_script_set_unref(&plutus_v2_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v2_script_set_to_cbor(
+  const cardano_plutus_v2_script_set_t* plutus_v2_scripts,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes a set of Plutus v2 scripts to CIP-116 JSON.
+ *
+ * The set is emitted as a JSON array. Each element is an object with the shape:
+ *
+ * \code{.json}
+ * {
+ *   "language": "plutus_v2",
+ *   "bytes": "<hex-encoded-script>"
+ * }
+ * \endcode
+ *
+ * Example output for two scripts:
+ *
+ * \code{.json}
+ * [
+ *   {"language":"plutus_v2","bytes":"0001"},
+ *   {"language":"plutus_v2","bytes":"aabbcc"}
+ * ]
+ * \endcode
+ *
+ * If \p writer is currently at the root, this function writes the array and its elements.
+ * If \p writer is already inside an array or object value position, the array is written
+ * as that value.
+ *
+ * \param[in] plutus_v2_scripts  A valid pointer to a Plutus v2 script set.
+ * \param[in] writer             A valid JSON writer (in a context where a value is expected).
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * \return CARDANO_ERROR_POINTER_IS_NULL   If \p plutus_v2_scripts or \p writer is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_set_to_cip116_json(
+  const cardano_plutus_v2_script_set_t* plutus_v2_scripts,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Retrieves the length of a plutus_v2_script list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_plutus_v2_script_set_t object.
+ *
+ * \param[in] plutus_v2_script_set A constant pointer to the \ref cardano_plutus_v2_script_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the plutus_v2_script_set. Return 0 if the plutus_v2_script_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_set_t* plutus_v2_script_set = cardano_plutus_v2_script_set_new();
+ *
+ * // Populate plutus_v2_script_set with elements
+ *
+ * size_t length = cardano_plutus_v2_script_set_get_length(plutus_v2_script_set);
+ * printf("Length of the plutus_v2_script_set: %zu\n", length);
+ *
+ * // Clean up the plutus_v2_script_set object once done
+ * cardano_plutus_v2_script_set_unref(&plutus_v2_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v2_script_set_get_length(const cardano_plutus_v2_script_set_t* plutus_v2_script_set);
+
+/**
+ * \brief Retrieves an element from a plutus_v2_script list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_plutus_v2_script_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] plutus_v2_script_set A constant pointer to the \ref cardano_plutus_v2_script_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the plutus_v2_script list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_plutus_v2_script_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_plutus_v2_script_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_set_t* plutus_v2_script_set = cardano_plutus_v2_script_set_new();
+ *
+ * // Populate plutus_v2_script_set with elements
+ *
+ * cardano_plutus_v2_script_t* element = NULL;
+ * cardano_error_t result = cardano_plutus_v2_script_set_get(plutus_v2_script_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_plutus_v2_script_unref(&element);
+ * }
+ *
+ * // Clean up the plutus_v2_script_set object once done
+ * cardano_plutus_v2_script_set_unref(&plutus_v2_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v2_script_set_get(const cardano_plutus_v2_script_set_t* plutus_v2_script_set, size_t index, cardano_plutus_v2_script_t** element);
+
+/**
+ * \brief Adds an element to a plutus_v2_script list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_plutus_v2_script_set_t object.
+ *
+ * \param[in] plutus_v2_script_set A constant pointer to the \ref cardano_plutus_v2_script_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_plutus_v2_script_t object that is to be added to the plutus_v2_script_set.
+ *                    The element will be referenced by the plutus_v2_script_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the plutus_v2_script_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_set_t* plutus_v2_script_set = cardano_plutus_v2_script_set_new();
+ *
+ * // Create and initialize a new plutus_v2_script element
+ * cardano_plutus_v2_script_t* element = { ... };
+ *
+ * // Add the element to the plutus_v2_script_set
+ * cardano_error_t result = cardano_plutus_v2_script_set_add(plutus_v2_script_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the plutus_v2_script_set object once done
+ * cardano_plutus_v2_script_set_unref(&plutus_v2_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v2_script_set_add(cardano_plutus_v2_script_set_t* plutus_v2_script_set, cardano_plutus_v2_script_t* element);
+
+/**
+ * \brief Checks if the plutus v2 script set uses tagged encoding (Conway era feature).
+ *
+ * This function determines whether the specified \ref cardano_plutus_v2_script_set_t object uses tagged encoding for sets,
+ * introduced in the Conway era of the Cardano blockchain. Tagged sets are a new way of encoding sets in CBOR, which
+ * differs from the older array-based representation used in previous eras.
+ *
+ * \param[in] plutus_v2_script_set A pointer to an initialized \ref cardano_plutus_v2_script_set_t object.
+ *
+ * \return \c true if the plutus data set uses tagged encoding for sets; \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_set_t* plutus_v2_script_set = ...; // Assume plutus_v2_script_set is already initialized
+ *
+ * bool uses_tag = cardano_plutus_v2_script_set_get_use_tag(plutus_v2_script_set);
+ * if (uses_tag)
+ * {
+ *   printf("The plutus data set uses tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("The plutus data set uses legacy array encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_v2_script_set_get_use_tag(const cardano_plutus_v2_script_set_t* plutus_v2_script_set);
+
+/**
+ * \brief Enables or disables tagged encoding (Conway era feature) for the plutus v2 script set.
+ *
+ * This function sets whether the specified \ref cardano_plutus_v2_script_set_t object should use tagged encoding
+ * (introduced in the Conway era) when serializing sets in CBOR. If \p use_tag is set to \c true, the set will be encoded
+ * using tagged sets. Otherwise, it will use the older array-based encoding method.
+ *
+ * \param[in,out] plutus_v2_script_set A pointer to an initialized \ref cardano_plutus_v2_script_set_t object.
+ * \param[in] use_tag A boolean value that determines whether to use tagged encoding (\c true) or legacy array encoding (\c false).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_set_t* plutus_v2_script_set = ...; // Assume plutus_v2_script_set is already initialized
+ * cardano_error_t result = cardano_plutus_v2_script_set_set_use_tag(plutus_v2_script_set, true);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The plutus data set is now set to use tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set tagged encoding: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v2_script_set_set_use_tag(cardano_plutus_v2_script_set_t* plutus_v2_script_set, bool use_tag);
+
+/**
+ * \brief Decrements the reference count of a plutus_v2_script_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v2_script_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v2_script_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v2_script_set A pointer to the pointer of the plutus_v2_script_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v2_script_set_t* plutus_v2_script_set = cardano_plutus_v2_script_set_new();
+ *
+ * // Perform operations with the plutus_v2_script_set...
+ *
+ * cardano_plutus_v2_script_set_unref(&plutus_v2_script_set);
+ * // At this point, plutus_v2_script_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v2_script_set_unref, the pointer to the \ref cardano_plutus_v2_script_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v2_script_set_unref(cardano_plutus_v2_script_set_t** plutus_v2_script_set);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v2_script_set_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v2_script_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v2_script_set_unref.
+ *
+ * \param plutus_v2_script_set A pointer to the plutus_v2_script_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v2_script_set is a previously created plutus_v2_script_set object
+ *
+ * cardano_plutus_v2_script_set_ref(plutus_v2_script_set);
+ *
+ * // Now plutus_v2_script_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v2_script_set_ref there is a corresponding
+ * call to \ref cardano_plutus_v2_script_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v2_script_set_ref(cardano_plutus_v2_script_set_t* plutus_v2_script_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v2_script_set_t object.
+ *
+ * This function returns the number of active references to a plutus_v2_script_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v2_script_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v2_script_set A pointer to the plutus_v2_script_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v2_script_set object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v2_script_set_ref call is matched with a
+ * \ref cardano_plutus_v2_script_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v2_script_set is a previously created plutus_v2_script_set object
+ *
+ * size_t ref_count = cardano_plutus_v2_script_set_refcount(plutus_v2_script_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v2_script_set_refcount(const cardano_plutus_v2_script_set_t* plutus_v2_script_set);
+
+/**
+ * \brief Sets the last error message for a given plutus_v2_script_set object.
+ *
+ * Records an error message in the plutus_v2_script_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v2_script_set A pointer to the \ref cardano_plutus_v2_script_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v2_script_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 2023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v2_script_set_set_last_error(cardano_plutus_v2_script_set_t* plutus_v2_script_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v2_script_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v2_script_set_set_last_error for the given
+ * plutus_v2_script_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v2_script_set A pointer to the \ref cardano_plutus_v2_script_set_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v2_script_set is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v2_script_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v2_script_set. If the plutus_v2_script_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v2_script_set_set_last_error for the same plutus_v2_script_set, or until
+ *       the plutus_v2_script_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v2_script_set_get_last_error(const cardano_plutus_v2_script_set_t* plutus_v2_script_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v2_script_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v2_script_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v2_script_set_deep_clone(const cardano_plutus_v2_script_set_t* source, cardano_plutus_v2_script_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V2_SCRIPT_SET_H
diff --git a/vendor/include/cardano/witness_set/plutus_v3_script_set.h b/vendor/include/cardano/witness_set/plutus_v3_script_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/plutus_v3_script_set.h
@@ -0,0 +1,529 @@
+/**
+ * \file plutus_v3_script_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V3_SCRIPT_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V3_SCRIPT_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/scripts/plutus_scripts/plutus_v3_script.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V3 was introduced in the Conway hard fork.
+ *
+ * The main changes in V3 of Plutus were to the interface to scripts. The ScriptContext was extended
+ * to include the following information:
+ *
+ *  - A Map with all the votes that were included in the transaction.
+ *  - A list with Proposals that will be turned into GovernanceActions, that everyone can vote on
+ *  - Optional amount for the current treasury. If included it will be checked to be equal the current amount in the treasury.
+ *  - Optional amount for donating to the current treasury. If included, specified amount will go into the treasury.
+ */
+typedef struct cardano_plutus_v3_script_t cardano_plutus_v3_script_t;
+
+/**
+ * \brief Represents a set of plutus_v3_scripts.
+ */
+typedef struct cardano_plutus_v3_script_set_t cardano_plutus_v3_script_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_v3_script_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_plutus_v3_script_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] plutus_v3_script_set On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v3_script_set_t object. This object represents a "strong reference"
+ *             to the plutus_v3_script_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_v3_script_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v3_script_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_v3_script_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_set_t* plutus_v3_script_set = NULL;
+ *
+ * // Attempt to create a new plutus_v3_script_set
+ * cardano_error_t result = cardano_plutus_v3_script_set_new(&plutus_v3_script_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v3_script_set
+ *
+ *   // Once done, ensure to clean up and release the plutus_v3_script_set
+ *   cardano_plutus_v3_script_set_unref(&plutus_v3_script_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_set_new(cardano_plutus_v3_script_set_t** plutus_v3_script_set);
+
+/**
+ * \brief Creates a plutus_v3_script set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v3_script_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v3_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v3_script data.
+ * \param[out] plutus_v3_scripts A pointer to a pointer of \ref cardano_plutus_v3_script_set_t that will be set to the address
+ *                        of the newly created plutus_v3_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v3_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v3_script_set_t object by calling
+ *       \ref cardano_plutus_v3_script_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v3_script_set_t* plutus_v3_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v3_script_set_from_cbor(reader, &plutus_v3_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v3_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v3_script
+ *   cardano_plutus_v3_script_set_unref(&plutus_v3_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v3_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_set_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v3_script_set_t** plutus_v3_scripts);
+
+/**
+ * \brief Serializes a plutus_v3_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v3_script_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v3_scripts A constant pointer to the \ref cardano_plutus_v3_script_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v3_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_set_t* plutus_v3_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v3_script_set_to_cbor(plutus_v3_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v3_script_set_unref(&plutus_v3_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v3_script_set_to_cbor(
+  const cardano_plutus_v3_script_set_t* plutus_v3_scripts,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes a set of Plutus v3 scripts to CIP-116 JSON.
+ *
+ * The set is emitted as a JSON array. Each element is an object with the shape:
+ *
+ * \code{.json}
+ * {
+ *   "language": "plutus_v3",
+ *   "bytes": "<hex-encoded-script>"
+ * }
+ * \endcode
+ *
+ * Example output for two scripts:
+ *
+ * \code{.json}
+ * [
+ *   {"language":"plutus_v3","bytes":"0001"},
+ *   {"language":"plutus_v3","bytes":"aabbcc"}
+ * ]
+ * \endcode
+ *
+ * If \p writer is currently at the root, this function writes the array and its elements.
+ * If \p writer is already inside an array or object value position, the array is written
+ * as that value.
+ *
+ * \param[in] plutus_v3_scripts  A valid pointer to a Plutus v3 script set.
+ * \param[in] writer             A valid JSON writer (in a context where a value is expected).
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * \return CARDANO_ERROR_POINTER_IS_NULL   If \p plutus_v3_scripts or \p writer is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_set_to_cip116_json(
+  const cardano_plutus_v3_script_set_t* plutus_v3_scripts,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Retrieves the length of a plutus_v3_script list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_plutus_v3_script_set_t object.
+ *
+ * \param[in] plutus_v3_script_set A constant pointer to the \ref cardano_plutus_v3_script_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the plutus_v3_script_set. Return 0 if the plutus_v3_script_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_set_t* plutus_v3_script_set = cardano_plutus_v3_script_set_new();
+ *
+ * // Populate plutus_v3_script_set with elements
+ *
+ * size_t length = cardano_plutus_v3_script_set_get_length(plutus_v3_script_set);
+ * printf("Length of the plutus_v3_script_set: %zu\n", length);
+ *
+ * // Clean up the plutus_v3_script_set object once done
+ * cardano_plutus_v3_script_set_unref(&plutus_v3_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v3_script_set_get_length(const cardano_plutus_v3_script_set_t* plutus_v3_script_set);
+
+/**
+ * \brief Retrieves an element from a plutus_v3_script list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_plutus_v3_script_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] plutus_v3_script_set A constant pointer to the \ref cardano_plutus_v3_script_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the plutus_v3_script list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_plutus_v3_script_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_plutus_v3_script_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_set_t* plutus_v3_script_set = cardano_plutus_v3_script_set_new();
+ *
+ * // Populate plutus_v3_script_set with elements
+ *
+ * cardano_plutus_v3_script_t* element = NULL;
+ * cardano_error_t result = cardano_plutus_v3_script_set_get(plutus_v3_script_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_plutus_v3_script_unref(&element);
+ * }
+ *
+ * // Clean up the plutus_v3_script_set object once done
+ * cardano_plutus_v3_script_set_unref(&plutus_v3_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v3_script_set_get(const cardano_plutus_v3_script_set_t* plutus_v3_script_set, size_t index, cardano_plutus_v3_script_t** element);
+
+/**
+ * \brief Adds an element to a plutus_v3_script list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_plutus_v3_script_set_t object.
+ *
+ * \param[in] plutus_v3_script_set A constant pointer to the \ref cardano_plutus_v3_script_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_plutus_v3_script_t object that is to be added to the plutus_v3_script_set.
+ *                    The element will be referenced by the plutus_v3_script_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the plutus_v3_script_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_set_t* plutus_v3_script_set = cardano_plutus_v3_script_set_new();
+ *
+ * // Create and initialize a new plutus_v3_script element
+ * cardano_plutus_v3_script_t* element = { ... };
+ *
+ * // Add the element to the plutus_v3_script_set
+ * cardano_error_t result = cardano_plutus_v3_script_set_add(plutus_v3_script_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the plutus_v3_script_set object once done
+ * cardano_plutus_v3_script_set_unref(&plutus_v3_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v3_script_set_add(cardano_plutus_v3_script_set_t* plutus_v3_script_set, cardano_plutus_v3_script_t* element);
+
+/**
+ * \brief Checks if the plutus v3 script set uses tagged encoding (Conway era feature).
+ *
+ * This function determines whether the specified \ref cardano_plutus_v3_script_set_t object uses tagged encoding for sets,
+ * introduced in the Conway era of the Cardano blockchain. Tagged sets are a new way of encoding sets in CBOR, which
+ * differs from the older array-based representation used in previous eras.
+ *
+ * \param[in] plutus_v3_script_set A pointer to an initialized \ref cardano_plutus_v3_script_set_t object.
+ *
+ * \return \c true if the plutus data set uses tagged encoding for sets; \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_set_t* plutus_v3_script_set = ...; // Assume plutus_v3_script_set is already initialized
+ *
+ * bool uses_tag = cardano_plutus_v3_script_set_get_use_tag(plutus_v3_script_set);
+ * if (uses_tag)
+ * {
+ *   printf("The plutus data set uses tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("The plutus data set uses legacy array encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_v3_script_set_get_use_tag(const cardano_plutus_v3_script_set_t* plutus_v3_script_set);
+
+/**
+ * \brief Enables or disables tagged encoding (Conway era feature) for the plutus v3 script set.
+ *
+ * This function sets whether the specified \ref cardano_plutus_v3_script_set_t object should use tagged encoding
+ * (introduced in the Conway era) when serializing sets in CBOR. If \p use_tag is set to \c true, the set will be encoded
+ * using tagged sets. Otherwise, it will use the older array-based encoding method.
+ *
+ * \param[in,out] plutus_v3_script_set A pointer to an initialized \ref cardano_plutus_v3_script_set_t object.
+ * \param[in] use_tag A boolean value that determines whether to use tagged encoding (\c true) or legacy array encoding (\c false).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_set_t* plutus_v3_script_set = ...; // Assume plutus_v3_script_set is already initialized
+ * cardano_error_t result = cardano_plutus_v3_script_set_set_use_tag(plutus_v3_script_set, true);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The plutus data set is now set to use tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set tagged encoding: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v3_script_set_set_use_tag(cardano_plutus_v3_script_set_t* plutus_v3_script_set, bool use_tag);
+
+/**
+ * \brief Decrements the reference count of a plutus_v3_script_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v3_script_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v3_script_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v3_script_set A pointer to the pointer of the plutus_v3_script_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v3_script_set_t* plutus_v3_script_set = cardano_plutus_v3_script_set_new();
+ *
+ * // Perform operations with the plutus_v3_script_set...
+ *
+ * cardano_plutus_v3_script_set_unref(&plutus_v3_script_set);
+ * // At this point, plutus_v3_script_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v3_script_set_unref, the pointer to the \ref cardano_plutus_v3_script_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v3_script_set_unref(cardano_plutus_v3_script_set_t** plutus_v3_script_set);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v3_script_set_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v3_script_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v3_script_set_unref.
+ *
+ * \param plutus_v3_script_set A pointer to the plutus_v3_script_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v3_script_set is a previously created plutus_v3_script_set object
+ *
+ * cardano_plutus_v3_script_set_ref(plutus_v3_script_set);
+ *
+ * // Now plutus_v3_script_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v3_script_set_ref there is a corresponding
+ * call to \ref cardano_plutus_v3_script_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v3_script_set_ref(cardano_plutus_v3_script_set_t* plutus_v3_script_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v3_script_set_t object.
+ *
+ * This function returns the number of active references to a plutus_v3_script_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v3_script_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v3_script_set A pointer to the plutus_v3_script_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v3_script_set object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v3_script_set_ref call is matched with a
+ * \ref cardano_plutus_v3_script_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v3_script_set is a previously created plutus_v3_script_set object
+ *
+ * size_t ref_count = cardano_plutus_v3_script_set_refcount(plutus_v3_script_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v3_script_set_refcount(const cardano_plutus_v3_script_set_t* plutus_v3_script_set);
+
+/**
+ * \brief Sets the last error message for a given plutus_v3_script_set object.
+ *
+ * Records an error message in the plutus_v3_script_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v3_script_set A pointer to the \ref cardano_plutus_v3_script_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v3_script_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 3023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v3_script_set_set_last_error(cardano_plutus_v3_script_set_t* plutus_v3_script_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v3_script_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v3_script_set_set_last_error for the given
+ * plutus_v3_script_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v3_script_set A pointer to the \ref cardano_plutus_v3_script_set_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v3_script_set is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v3_script_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v3_script_set. If the plutus_v3_script_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v3_script_set_set_last_error for the same plutus_v3_script_set, or until
+ *       the plutus_v3_script_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v3_script_set_get_last_error(const cardano_plutus_v3_script_set_t* plutus_v3_script_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v3_script_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v3_script_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v3_script_set_deep_clone(const cardano_plutus_v3_script_set_t* source, cardano_plutus_v3_script_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V3_SCRIPT_SET_H
diff --git a/vendor/include/cardano/witness_set/plutus_v4_script_set.h b/vendor/include/cardano/witness_set/plutus_v4_script_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/plutus_v4_script_set.h
@@ -0,0 +1,525 @@
+/**
+ * \file plutus_v4_script_set.h
+ *
+ * \author angel.castillo
+ * \date   Oct 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V4_SCRIPT_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V4_SCRIPT_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/scripts/plutus_scripts/plutus_v4_script.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus' scripts are pieces of code that implement pure functions with True or False outputs. These functions take
+ * several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.
+ *
+ * V4 was introduced in the Dijkstra hard fork.
+ *
+ * V4 scripts run from protocol version 12. They can be serialized in transactions as witness set
+ * scripts, reference scripts or auxiliary data scripts, and they are the only Plutus scripts that
+ * run inside a sub transaction.
+ */
+typedef struct cardano_plutus_v4_script_t cardano_plutus_v4_script_t;
+
+/**
+ * \brief Represents a set of plutus_v4_scripts.
+ */
+typedef struct cardano_plutus_v4_script_set_t cardano_plutus_v4_script_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a plutus_v4_script_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_plutus_v4_script_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] plutus_v4_script_set On successful initialization, this will point to a newly created
+ *             \ref cardano_plutus_v4_script_set_t object. This object represents a "strong reference"
+ *             to the plutus_v4_script_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the plutus_v4_script_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_plutus_v4_script_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the plutus_v4_script_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_set_t* plutus_v4_script_set = NULL;
+ *
+ * // Attempt to create a new plutus_v4_script_set
+ * cardano_error_t result = cardano_plutus_v4_script_set_new(&plutus_v4_script_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v4_script_set
+ *
+ *   // Once done, ensure to clean up and release the plutus_v4_script_set
+ *   cardano_plutus_v4_script_set_unref(&plutus_v4_script_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_set_new(cardano_plutus_v4_script_set_t** plutus_v4_script_set);
+
+/**
+ * \brief Creates a plutus_v4_script set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_plutus_v4_script_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a plutus_v4_script.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded plutus_v4_script data.
+ * \param[out] plutus_v4_scripts A pointer to a pointer of \ref cardano_plutus_v4_script_set_t that will be set to the address
+ *                        of the newly created plutus_v4_script object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the plutus_v4_script was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_plutus_v4_script_set_t object by calling
+ *       \ref cardano_plutus_v4_script_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_plutus_v4_script_set_t* plutus_v4_script = NULL;
+ *
+ * cardano_error_t result = cardano_plutus_v4_script_set_from_cbor(reader, &plutus_v4_script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the plutus_v4_script
+ *
+ *   // Once done, ensure to clean up and release the plutus_v4_script
+ *   cardano_plutus_v4_script_set_unref(&plutus_v4_script);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode plutus_v4_script: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_set_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v4_script_set_t** plutus_v4_scripts);
+
+/**
+ * \brief Serializes a plutus_v4_script into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_plutus_v4_script_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] plutus_v4_scripts A constant pointer to the \ref cardano_plutus_v4_script_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p plutus_v4_script or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_set_t* plutus_v4_script = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_plutus_v4_script_set_to_cbor(plutus_v4_script, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_plutus_v4_script_set_unref(&plutus_v4_script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v4_script_set_to_cbor(
+  const cardano_plutus_v4_script_set_t* plutus_v4_scripts,
+  cardano_cbor_writer_t*                writer);
+
+/**
+ * \brief Serializes a set of Plutus v4 scripts to CIP-116 JSON.
+ *
+ * The set is emitted as a JSON array. Each element is an object with the shape:
+ *
+ * \code{.json}
+ * {
+ *   "language": "plutus_v4",
+ *   "bytes": "<hex-encoded-script>"
+ * }
+ * \endcode
+ *
+ * Example output for two scripts:
+ *
+ * \code{.json}
+ * [
+ *   {"language":"plutus_v4","bytes":"0001"},
+ *   {"language":"plutus_v4","bytes":"aabbcc"}
+ * ]
+ * \endcode
+ *
+ * If \p writer is currently at the root, this function writes the array and its elements.
+ * If \p writer is already inside an array or object value position, the array is written
+ * as that value.
+ *
+ * \param[in] plutus_v4_scripts  A valid pointer to a Plutus v4 script set.
+ * \param[in] writer             A valid JSON writer (in a context where a value is expected).
+ *
+ * \return CARDANO_SUCCESS                 On success.
+ * \return CARDANO_ERROR_POINTER_IS_NULL   If \p plutus_v4_scripts or \p writer is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_set_to_cip116_json(
+  const cardano_plutus_v4_script_set_t* plutus_v4_scripts,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Retrieves the length of a plutus_v4_script list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_plutus_v4_script_set_t object.
+ *
+ * \param[in] plutus_v4_script_set A constant pointer to the \ref cardano_plutus_v4_script_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the plutus_v4_script_set. Return 0 if the plutus_v4_script_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_set_t* plutus_v4_script_set = cardano_plutus_v4_script_set_new();
+ *
+ * // Populate plutus_v4_script_set with elements
+ *
+ * size_t length = cardano_plutus_v4_script_set_get_length(plutus_v4_script_set);
+ * printf("Length of the plutus_v4_script_set: %zu\n", length);
+ *
+ * // Clean up the plutus_v4_script_set object once done
+ * cardano_plutus_v4_script_set_unref(&plutus_v4_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v4_script_set_get_length(const cardano_plutus_v4_script_set_t* plutus_v4_script_set);
+
+/**
+ * \brief Retrieves an element from a plutus_v4_script list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_plutus_v4_script_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] plutus_v4_script_set A constant pointer to the \ref cardano_plutus_v4_script_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the plutus_v4_script list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_plutus_v4_script_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_plutus_v4_script_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_set_t* plutus_v4_script_set = cardano_plutus_v4_script_set_new();
+ *
+ * // Populate plutus_v4_script_set with elements
+ *
+ * cardano_plutus_v4_script_t* element = NULL;
+ * cardano_error_t result = cardano_plutus_v4_script_set_get(plutus_v4_script_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_plutus_v4_script_unref(&element);
+ * }
+ *
+ * // Clean up the plutus_v4_script_set object once done
+ * cardano_plutus_v4_script_set_unref(&plutus_v4_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v4_script_set_get(const cardano_plutus_v4_script_set_t* plutus_v4_script_set, size_t index, cardano_plutus_v4_script_t** element);
+
+/**
+ * \brief Adds an element to a plutus_v4_script list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_plutus_v4_script_set_t object.
+ *
+ * \param[in] plutus_v4_script_set A constant pointer to the \ref cardano_plutus_v4_script_set_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_plutus_v4_script_t object that is to be added to the plutus_v4_script_set.
+ *                    The element will be referenced by the plutus_v4_script_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the plutus_v4_script_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_set_t* plutus_v4_script_set = cardano_plutus_v4_script_set_new();
+ *
+ * // Create and initialize a new plutus_v4_script element
+ * cardano_plutus_v4_script_t* element = { ... };
+ *
+ * // Add the element to the plutus_v4_script_set
+ * cardano_error_t result = cardano_plutus_v4_script_set_add(plutus_v4_script_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the plutus_v4_script_set object once done
+ * cardano_plutus_v4_script_set_unref(&plutus_v4_script_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v4_script_set_add(cardano_plutus_v4_script_set_t* plutus_v4_script_set, cardano_plutus_v4_script_t* element);
+
+/**
+ * \brief Checks if the plutus v4 script set uses tagged encoding (Conway era feature).
+ *
+ * This function determines whether the specified \ref cardano_plutus_v4_script_set_t object uses tagged encoding for sets,
+ * introduced in the Conway era of the Cardano blockchain. Tagged sets are a new way of encoding sets in CBOR, which
+ * differs from the older array-based representation used in previous eras.
+ *
+ * \param[in] plutus_v4_script_set A pointer to an initialized \ref cardano_plutus_v4_script_set_t object.
+ *
+ * \return \c true if the plutus data set uses tagged encoding for sets; \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_set_t* plutus_v4_script_set = ...; // Assume plutus_v4_script_set is already initialized
+ *
+ * bool uses_tag = cardano_plutus_v4_script_set_get_use_tag(plutus_v4_script_set);
+ * if (uses_tag)
+ * {
+ *   printf("The plutus data set uses tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("The plutus data set uses legacy array encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_plutus_v4_script_set_get_use_tag(const cardano_plutus_v4_script_set_t* plutus_v4_script_set);
+
+/**
+ * \brief Enables or disables tagged encoding (Conway era feature) for the plutus v4 script set.
+ *
+ * This function sets whether the specified \ref cardano_plutus_v4_script_set_t object should use tagged encoding
+ * (introduced in the Conway era) when serializing sets in CBOR. If \p use_tag is set to \c true, the set will be encoded
+ * using tagged sets. Otherwise, it will use the older array-based encoding method.
+ *
+ * \param[in,out] plutus_v4_script_set A pointer to an initialized \ref cardano_plutus_v4_script_set_t object.
+ * \param[in] use_tag A boolean value that determines whether to use tagged encoding (\c true) or legacy array encoding (\c false).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_set_t* plutus_v4_script_set = ...; // Assume plutus_v4_script_set is already initialized
+ * cardano_error_t result = cardano_plutus_v4_script_set_set_use_tag(plutus_v4_script_set, true);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The plutus data set is now set to use tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set tagged encoding: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_plutus_v4_script_set_set_use_tag(cardano_plutus_v4_script_set_t* plutus_v4_script_set, bool use_tag);
+
+/**
+ * \brief Decrements the reference count of a plutus_v4_script_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_plutus_v4_script_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the plutus_v4_script_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] plutus_v4_script_set A pointer to the pointer of the plutus_v4_script_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_plutus_v4_script_set_t* plutus_v4_script_set = cardano_plutus_v4_script_set_new();
+ *
+ * // Perform operations with the plutus_v4_script_set...
+ *
+ * cardano_plutus_v4_script_set_unref(&plutus_v4_script_set);
+ * // At this point, plutus_v4_script_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_plutus_v4_script_set_unref, the pointer to the \ref cardano_plutus_v4_script_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_plutus_v4_script_set_unref(cardano_plutus_v4_script_set_t** plutus_v4_script_set);
+
+/**
+ * \brief Increases the reference count of the cardano_plutus_v4_script_set_t object.
+ *
+ * This function is used to manually increment the reference count of a plutus_v4_script_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_plutus_v4_script_set_unref.
+ *
+ * \param plutus_v4_script_set A pointer to the plutus_v4_script_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v4_script_set is a previously created plutus_v4_script_set object
+ *
+ * cardano_plutus_v4_script_set_ref(plutus_v4_script_set);
+ *
+ * // Now plutus_v4_script_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_plutus_v4_script_set_ref there is a corresponding
+ * call to \ref cardano_plutus_v4_script_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_plutus_v4_script_set_ref(cardano_plutus_v4_script_set_t* plutus_v4_script_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_plutus_v4_script_set_t object.
+ *
+ * This function returns the number of active references to a plutus_v4_script_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_plutus_v4_script_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param plutus_v4_script_set A pointer to the plutus_v4_script_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified plutus_v4_script_set object. If the object
+ * is properly managed (i.e., every \ref cardano_plutus_v4_script_set_ref call is matched with a
+ * \ref cardano_plutus_v4_script_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming plutus_v4_script_set is a previously created plutus_v4_script_set object
+ *
+ * size_t ref_count = cardano_plutus_v4_script_set_refcount(plutus_v4_script_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_plutus_v4_script_set_refcount(const cardano_plutus_v4_script_set_t* plutus_v4_script_set);
+
+/**
+ * \brief Sets the last error message for a given plutus_v4_script_set object.
+ *
+ * Records an error message in the plutus_v4_script_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] plutus_v4_script_set A pointer to the \ref cardano_plutus_v4_script_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the plutus_v4_script_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 3023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_plutus_v4_script_set_set_last_error(cardano_plutus_v4_script_set_t* plutus_v4_script_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific plutus_v4_script_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_plutus_v4_script_set_set_last_error for the given
+ * plutus_v4_script_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] plutus_v4_script_set A pointer to the \ref cardano_plutus_v4_script_set_t instance whose last error
+ *                   message is to be retrieved. If the plutus_v4_script_set is NULL, the function
+ *                   returns a generic error message indicating the null plutus_v4_script_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified plutus_v4_script_set. If the plutus_v4_script_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_plutus_v4_script_set_set_last_error for the same plutus_v4_script_set, or until
+ *       the plutus_v4_script_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_plutus_v4_script_set_get_last_error(const cardano_plutus_v4_script_set_t* plutus_v4_script_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_plutus_v4_script_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_plutus_v4_script_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_plutus_v4_script_set_deep_clone(const cardano_plutus_v4_script_set_t* source, cardano_plutus_v4_script_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_PLUTUS_V4_SCRIPT_SET_H
diff --git a/vendor/include/cardano/witness_set/redeemer.h b/vendor/include/cardano/witness_set/redeemer.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/redeemer.h
@@ -0,0 +1,675 @@
+/**
+ * \file redeemer.h
+ *
+ * \author angel.castillo
+ * \date   Sep 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_REDEEMER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_REDEEMER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/ex_units.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/typedefs.h>
+#include <cardano/witness_set/redeemer_tag.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * The Redeemer is an argument provided to a Plutus smart contract (script) when
+ * you are attempting to redeem a UTxO that's protected by that script.
+ */
+typedef struct cardano_redeemer_t cardano_redeemer_t;
+
+/**
+ * \brief Creates and initializes a new instance of a Redeemer.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_redeemer_t object,
+ * representing a redeemer in the Cardano protocol. A redeemer is used to provide data for script execution
+ * in transactions. The redeemer includes a tag, an index, data, and execution units (ex_units) required for script validation.
+ *
+ * \param[in] tag The \ref cardano_redeemer_tag_t representing the type of action (e.g., spending, minting, reward) that the redeemer is associated with.
+ * \param[in] index The index of the transaction input this redeemer is intended for. The transaction inputs are indexed in the map order by their transaction id.
+ *                  On the wire the index is encoded as a 32-bit unsigned integer, values greater than `UINT32_MAX` are rejected at serialization time.
+ * \param[in] data A pointer to a \ref cardano_plutus_data_t object containing the Plutus data associated with this redeemer. This data is required for script execution.
+ * \param[in] ex_units A pointer to a \ref cardano_ex_units_t object representing the execution units (computation and memory) allocated for this redeemer.
+ *                     This defines how much computational and memory resources are available for the script execution.
+ * \param[out] redeemer On successful initialization, this will point to a newly created \ref cardano_redeemer_t object.
+ *                      This object represents a "strong reference", meaning that it is fully initialized and ready for use.
+ *                      The caller is responsible for managing the lifecycle of this object. Specifically, once the redeemer is no longer needed,
+ *                      the caller must release it by calling \ref cardano_redeemer_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the redeemer was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * \note The caller is responsible for ensuring that both the \p data and \p ex_units parameters are valid and initialized before calling this function.
+ *       Additionally, the caller must manage the memory of these parameters.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_t* redeemer = NULL;
+ * cardano_plutus_data_t* data = ...;  // Assume data is initialized
+ * cardano_ex_units_t* ex_units = ...;  // Assume ex_units is initialized
+ * cardano_redeemer_tag_t tag = CARDANO_REDEEMER_TAG_SPENDING;  // Example tag
+ * uint64_t index = 0;  // Example index
+ *
+ * // Attempt to create a new Redeemer object
+ * cardano_error_t result = cardano_redeemer_new(tag, index, data, ex_units, &redeemer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the redeemer
+ *
+ *   // Once done, ensure to clean up and release the redeemer
+ *   cardano_redeemer_unref(&redeemer);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the redeemer: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up data and ex_units as necessary
+ * cardano_plutus_data_unref(&data);
+ * cardano_ex_units_unref(&ex_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_redeemer_new(
+  cardano_redeemer_tag_t tag,
+  uint64_t               index,
+  cardano_plutus_data_t* data,
+  cardano_ex_units_t*    ex_units,
+  cardano_redeemer_t**   redeemer);
+
+/**
+ * \brief Creates a \ref cardano_redeemer_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_redeemer_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a redeemer.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] redeemer A pointer to a pointer of \ref cardano_redeemer_t that will be set to the address
+ *                        of the newly created redeemer object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the protocol version were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the redeemer and invalidate any existing signatures.
+ *         To prevent this, when a redeemer object is created using \ref cardano_redeemer_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_redeemer_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_redeemer_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_redeemer_t object by calling
+ *       \ref cardano_redeemer_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_redeemer_t* redeemer = NULL;
+ *
+ * cardano_error_t result = cardano_redeemer_from_cbor(reader, &redeemer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the redeemer
+ *
+ *   // Once done, ensure to clean up and release the redeemer
+ *   cardano_redeemer_unref(&redeemer);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode redeemer: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_redeemer_from_cbor(cardano_cbor_reader_t* reader, cardano_redeemer_t** redeemer);
+
+/**
+ * \brief Serializes protocol version into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_redeemer_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] redeemer A constant pointer to the \ref cardano_redeemer_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p redeemer or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL. If the redeemer index is greater than `UINT32_MAX`,
+ *         returns \ref CARDANO_ERROR_INVALID_ARGUMENT, since the wire format encodes the index as a 32-bit unsigned integer.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the redeemer and invalidate any existing signatures.
+ *         To prevent this, when a redeemer object is created using \ref cardano_redeemer_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_redeemer_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_redeemer_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_t* redeemer = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_redeemer_to_cbor(redeemer, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_redeemer_unref(&redeemer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_to_cbor(
+  const cardano_redeemer_t* redeemer,
+  cardano_cbor_writer_t*    writer);
+
+/**
+ * \brief Serializes a redeemer to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "tag", "index", "data", "ex_units".
+ *
+ * \param[in]  redeemer Pointer to a valid \ref cardano_redeemer_t.
+ * \param[in]  writer   Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS        On success.
+ * CARDANO_ERROR_POINTER_IS_NULL  If \p redeemer or \p writer is NULL.
+ * CARDANO_ERROR_INVALID_ARGUMENT If the redeemer tag is invalid.
+ * Other                          Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_to_cip116_json(
+  const cardano_redeemer_t* redeemer,
+  cardano_json_writer_t*    writer);
+
+/**
+ * \brief Retrieves the tag associated with a redeemer.
+ *
+ * This function fetches the tag from a given \ref cardano_redeemer_t object. The tag specifies the type
+ * of action associated with the redeemer, such as spending, minting, or rewarding.
+ *
+ * \param[in] redeemer A constant pointer to an initialized \ref cardano_redeemer_t object.
+ *
+ * \return The \ref cardano_redeemer_tag_t indicating the type of action for the redeemer.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_redeemer_t* redeemer = ...;  // Assume redeemer is already initialized
+ * cardano_redeemer_tag_t tag = cardano_redeemer_get_tag(redeemer);
+ *
+ * if (tag == CARDANO_REDEEMER_TAG_SPENDING)
+ * {
+ *     printf("Redeemer tag: Spending\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_redeemer_tag_t cardano_redeemer_get_tag(const cardano_redeemer_t* redeemer);
+
+/**
+ * \brief Sets the tag for a redeemer.
+ *
+ * This function sets the tag of a given \ref cardano_redeemer_t object. The tag specifies the type of
+ * action associated with the redeemer, such as spending, minting, or rewarding.
+ *
+ * \param[in,out] redeemer A pointer to an initialized \ref cardano_redeemer_t object where the tag will be set.
+ * \param[in] tag A \ref cardano_redeemer_tag_t representing the new tag to be assigned to the redeemer.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the tag was
+ *         successfully set, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_t* redeemer = ...;  // Assume redeemer is already initialized
+ * cardano_error_t result = cardano_redeemer_set_tag(redeemer, CARDANO_REDEEMER_TAG_SPENDING);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *     printf("Redeemer tag set to Spending\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_set_tag(cardano_redeemer_t* redeemer, cardano_redeemer_tag_t tag);
+
+/**
+ * \brief Retrieves the index associated with a redeemer.
+ *
+ * This function fetches the index from a given \ref cardano_redeemer_t object. The index represents the position
+ * of the input or output in the transaction that the redeemer applies to.
+ *
+ * \param[in] redeemer A constant pointer to an initialized \ref cardano_redeemer_t object.
+ *
+ * \return A uint64_t representing the index of the redeemer.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_redeemer_t* redeemer = ...;  // Assume redeemer is already initialized
+ * uint64_t index = cardano_redeemer_get_index(redeemer);
+ * printf("Redeemer index: %llu\n", index);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT uint64_t cardano_redeemer_get_index(const cardano_redeemer_t* redeemer);
+
+/**
+ * \brief Sets the index for the given redeemer.
+ *
+ * This function assigns a new index to the specified \ref cardano_redeemer_t object. The index typically refers
+ * to the position of the redeemer within a list of redeemers in a Cardano transaction.
+ *
+ * \param[in,out] redeemer A pointer to an initialized \ref cardano_redeemer_t object to which the index will be set.
+ * \param[in] index The new index to be assigned to the redeemer. On the wire the index is encoded as a 32-bit unsigned
+ *                  integer, values greater than `UINT32_MAX` are rejected at serialization time.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the index was
+ *         successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p redeemer pointer is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_t* redeemer = ...; // Assume redeemer is initialized
+ * uint64_t new_index = 3; // New index to assign
+ *
+ * cardano_error_t result = cardano_redeemer_set_index(redeemer, new_index);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Index set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the index.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_set_index(cardano_redeemer_t* redeemer, uint64_t index);
+
+/**
+ * \brief Retrieves the Plutus data associated with a redeemer.
+ *
+ * This function returns the Plutus data stored in the specified \ref cardano_redeemer_t object. The Plutus data
+ * represents the input data provided to a Plutus script during transaction execution.
+ *
+ * \param[in] redeemer A constant pointer to an initialized \ref cardano_redeemer_t object.
+ *
+ * \return A pointer to the \ref cardano_plutus_data_t object representing the Plutus data.
+ *         The returned Plutus data is a new reference, and the caller is responsible for managing its lifecycle
+ *         by calling \ref cardano_plutus_data_unref when it is no longer needed. If the \p redeemer is NULL,
+ *         this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_redeemer_t* redeemer = ...; // Assume redeemer is initialized
+ * cardano_plutus_data_t* data = cardano_redeemer_get_data(redeemer);
+ *
+ * if (data != NULL)
+ * {
+ *   // Use the Plutus data
+ *   cardano_plutus_data_unref(&data); // Ensure to release the data once done
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve Plutus data or redeemer is NULL.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_plutus_data_t* cardano_redeemer_get_data(cardano_redeemer_t* redeemer);
+
+/**
+ * \brief Sets the Plutus data for a redeemer.
+ *
+ * This function assigns a new \ref cardano_plutus_data_t object to the specified \ref cardano_redeemer_t.
+ * The Plutus data represents the input provided to a Plutus script during transaction execution.
+ *
+ * \param[in,out] redeemer A pointer to an initialized \ref cardano_redeemer_t object.
+ * \param[in] data A pointer to an initialized \ref cardano_plutus_data_t object that contains the new Plutus data.
+ *                 This pointer can be NULL if the existing Plutus data is to be unset.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         Plutus data was successfully set, or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p redeemer is NULL.
+ *
+ * \note The function increases the reference count of the Plutus data object, so the caller retains ownership
+ *       of the \p data reference and must manage its lifecycle. If the Plutus data is no longer needed after assignment,
+ *       the caller should release their reference by calling \ref cardano_plutus_data_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_t* redeemer = ...; // Assume redeemer is already initialized
+ * cardano_plutus_data_t* data = ...;  // Assume Plutus data is initialized
+ *
+ * cardano_error_t result = cardano_redeemer_set_data(redeemer, data);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Plutus data was successfully set
+ * }
+ * else
+ * {
+ *   printf("Failed to set Plutus data: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_set_data(cardano_redeemer_t* redeemer, cardano_plutus_data_t* data);
+
+/**
+ * \brief Retrieves the execution units associated with a redeemer.
+ *
+ * This function retrieves the \ref cardano_ex_units_t object from the given \ref cardano_redeemer_t.
+ * The execution units (ExUnits) represent the computational cost required for the execution of the
+ * Plutus script associated with the redeemer, measured in terms of memory and CPU units.
+ *
+ * \param[in] redeemer A constant pointer to an initialized \ref cardano_redeemer_t object from which the ExUnits will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_ex_units_t object representing the execution units associated with the redeemer.
+ *         The returned ExUnits is a new reference, and the caller is responsible for managing the lifecycle of this object.
+ *         Specifically, the caller must release the ExUnits when it is no longer needed by calling \ref cardano_ex_units_unref.
+ *         If the \p redeemer is NULL, the function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * const cardano_redeemer_t* redeemer = ...; // Assume redeemer is already initialized
+ * cardano_ex_units_t* ex_units = cardano_redeemer_get_ex_units(redeemer);
+ *
+ * if (ex_units != NULL)
+ * {
+ *   // Use the execution units
+ *
+ *   // Ensure to clean up and release the ExUnits after use
+ *   cardano_ex_units_unref(&ex_units);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the execution units.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_ex_units_t* cardano_redeemer_get_ex_units(cardano_redeemer_t* redeemer);
+
+/**
+ * \brief Sets the execution units for a redeemer.
+ *
+ * This function assigns the specified \ref cardano_ex_units_t object to the given \ref cardano_redeemer_t.
+ * The execution units (ExUnits) represent the computational cost, in terms of memory and CPU, required
+ * for the execution of the Plutus script associated with the redeemer.
+ *
+ * \param[in,out] redeemer A pointer to an initialized \ref cardano_redeemer_t object to which the ExUnits will be set.
+ * \param[in] ex_units A pointer to an initialized \ref cardano_ex_units_t object representing the execution units to be assigned.
+ *                     This parameter must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the ExUnits
+ *         were successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if either the \p redeemer or \p ex_units pointers are NULL.
+ *
+ * \note This function increases the reference count of the \p ex_units object. The caller retains ownership of their respective
+ *       references and is responsible for releasing their reference to the \p ex_units when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_t* redeemer = ...; // Assume redeemer is already initialized
+ * cardano_ex_units_t* ex_units = cardano_ex_units_new(...); // Assume ex_units is already initialized
+ *
+ * cardano_error_t result = cardano_redeemer_set_ex_units(redeemer, ex_units);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The execution units have been set for the redeemer
+ * }
+ * else
+ * {
+ *   printf("Failed to set the execution units.\n");
+ * }
+ *
+ * // Cleanup ex_units if no longer needed
+ * cardano_ex_units_unref(&ex_units);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_set_ex_units(cardano_redeemer_t* redeemer, cardano_ex_units_t* ex_units);
+
+/**
+ * \brief Clears the cached CBOR representation from a redeemer.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_redeemer_t object.
+ * It is useful when you have modified the redeemer after it was created from CBOR using
+ * \ref cardano_redeemer_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the redeemer, rather than using the original cached CBOR.
+ *
+ * \param[in,out] redeemer A pointer to an initialized \ref cardano_redeemer_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the redeemer when
+ *          serialized, which can alter the redeemer and invalidate any existing signatures.
+ *          Use this function with caution, especially if the transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume redeemer was created using cardano_redeemer_from_cbor
+ * cardano_redeemer_t* redeemer = ...;
+ *
+ * // Modify the redeemer as needed
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated redeemer
+ * cardano_redeemer_clear_cbor_cache(redeemer);
+ *
+ * // Serialize the redeemer to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_redeemer_to_cbor(redeemer, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_redeemer_unref(&redeemer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_redeemer_clear_cbor_cache(cardano_redeemer_t* redeemer);
+
+/**
+ * \brief Decrements the reference count of a cardano_redeemer_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_redeemer_t object
+ * by decreasing its reference count. When the reference count reaches zero, the redeemer is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] redeemer A pointer to the pointer of the redeemer object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_t* redeemer = cardano_redeemer_new(major, minor);
+ *
+ * // Perform operations with the redeemer...
+ *
+ * cardano_redeemer_unref(&redeemer);
+ * // At this point, redeemer is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_redeemer_unref, the pointer to the \ref cardano_redeemer_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_redeemer_unref(cardano_redeemer_t** redeemer);
+
+/**
+ * \brief Increases the reference count of the cardano_redeemer_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_redeemer_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_redeemer_unref.
+ *
+ * \param redeemer A pointer to the cardano_redeemer_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming redeemer is a previously created redeemer object
+ *
+ * cardano_redeemer_ref(redeemer);
+ *
+ * // Now redeemer can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_redeemer_ref there is a corresponding
+ * call to \ref cardano_redeemer_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_redeemer_ref(cardano_redeemer_t* redeemer);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_redeemer_t object.
+ *
+ * This function returns the number of active references to an cardano_redeemer_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_redeemer_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param redeemer A pointer to the cardano_redeemer_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_redeemer_t object. If the object
+ * is properly managed (i.e., every \ref cardano_redeemer_ref call is matched with a
+ * \ref cardano_redeemer_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming redeemer is a previously created redeemer object
+ *
+ * size_t ref_count = cardano_redeemer_refcount(redeemer);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_redeemer_refcount(const cardano_redeemer_t* redeemer);
+
+/**
+ * \brief Sets the last error message for a given cardano_redeemer_t object.
+ *
+ * Records an error message in the redeemer's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] redeemer A pointer to the \ref cardano_redeemer_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the redeemer's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_redeemer_set_last_error(
+  cardano_redeemer_t* redeemer,
+  const char*         message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific redeemer.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_redeemer_set_last_error for the given
+ * redeemer. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] redeemer A pointer to the \ref cardano_redeemer_t instance whose last error
+ *                   message is to be retrieved. If the redeemer is NULL, the function
+ *                   returns a generic error message indicating the null redeemer.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified redeemer. If the redeemer is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_redeemer_set_last_error for the same redeemer, or until
+ *       the redeemer is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_redeemer_get_last_error(
+  const cardano_redeemer_t* redeemer);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_redeemer_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_redeemer_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_redeemer_deep_clone(const cardano_redeemer_t* source, cardano_redeemer_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_REDEEMER_H
diff --git a/vendor/include/cardano/witness_set/redeemer_list.h b/vendor/include/cardano/witness_set/redeemer_list.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/redeemer_list.h
@@ -0,0 +1,590 @@
+/**
+ * \file redeemer_list.h
+ *
+ * \author angel.castillo
+ * \date   Sep 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_REDEEMER_LIST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_REDEEMER_LIST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "redeemer_tag.h"
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * The Redeemer is an argument provided to a Plutus smart contract (script) when
+ * you are attempting to redeem a UTxO that's protected by that script.
+ */
+typedef struct cardano_redeemer_t cardano_redeemer_t;
+
+/**
+ * \brief Represents a list of redeemers.
+ */
+typedef struct cardano_redeemer_list_t cardano_redeemer_list_t;
+
+/**
+ * \brief Creates and initializes a new instance of a redeemer_list.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_redeemer_list_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] redeemer_list On successful initialization, this will point to a newly created
+ *             \ref cardano_redeemer_list_t object. This object represents a "strong reference"
+ *             to the redeemer_list, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the redeemer_list is no longer needed, the caller must release it
+ *             by calling \ref cardano_redeemer_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the redeemer_list was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_list_t* redeemer_list = NULL;
+ *
+ * // Attempt to create a new redeemer_list
+ * cardano_error_t result = cardano_redeemer_list_new(&redeemer_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the redeemer_list
+ *
+ *   // Once done, ensure to clean up and release the redeemer_list
+ *   cardano_redeemer_list_unref(&redeemer_list);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_redeemer_list_new(cardano_redeemer_list_t** redeemer_list);
+
+/**
+ * \brief Creates a redeemer list from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_redeemer_list_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a redeemer.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded redeemer data.
+ * \param[out] redeemers A pointer to a pointer of \ref cardano_redeemer_list_t that will be set to the address
+ *                        of the newly created redeemer object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the redeemer was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the redeemers and invalidate any existing signatures.
+ *         To prevent this, when the redeemers list object is created using \ref cardano_redeemer_list_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_redeemer_list_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_redeemer_list_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_redeemer_list_t object by calling
+ *       \ref cardano_redeemer_list_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_redeemer_list_t* redeemer = NULL;
+ *
+ * cardano_error_t result = cardano_redeemer_list_from_cbor(reader, &redeemer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the redeemer
+ *
+ *   // Once done, ensure to clean up and release the redeemer
+ *   cardano_redeemer_list_unref(&redeemer);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode redeemer: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_redeemer_list_from_cbor(cardano_cbor_reader_t* reader, cardano_redeemer_list_t** redeemers);
+
+/**
+ * \brief Serializes a list of redeemers to a CIP-116 JSON array.
+ *
+ * This function iterates over the list and serializes each \ref cardano_redeemer_t
+ * into a JSON array.
+ *
+ * \param[in]  list    Pointer to a valid \ref cardano_redeemer_list_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p list or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_list_to_cip116_json(
+  const cardano_redeemer_list_t* list,
+  cardano_json_writer_t*         writer);
+
+/**
+ * \brief Serializes a redeemer into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_redeemer_list_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] redeemers A constant pointer to the \ref cardano_redeemer_list_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p redeemer or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL. If any redeemer index is greater than `UINT32_MAX`,
+ *         returns \ref CARDANO_ERROR_INVALID_ARGUMENT, since the wire format encodes the index as a 32-bit unsigned integer.
+ *         If two redeemers share the same tag and index, returns \ref CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY, since each script
+ *         purpose has exactly one redeemer and the ledger rejects a redeemers map with duplicate keys from protocol version 12.
+ *         A list decoded from CBOR that still holds its cached CBOR is written verbatim and is not checked.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the redeemers and invalidate any existing signatures.
+ *         To prevent this, when the redeemers list object is created using \ref cardano_redeemer_list_from_cbor, it caches the original
+ *         CBOR representation internally. When \ref cardano_redeemer_list_to_cbor is called, it will output the cached CBOR.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_redeemer_list_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_list_t* redeemer = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_redeemer_list_to_cbor(redeemer, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_redeemer_list_unref(&redeemer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_list_to_cbor(
+  const cardano_redeemer_list_t* redeemers,
+  cardano_cbor_writer_t*         writer);
+
+/**
+ * \brief Retrieves the length of a redeemer list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_redeemer_list_t object.
+ *
+ * \param[in] redeemer_list A constant pointer to the \ref cardano_redeemer_list_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the redeemer_list. Return 0 if the redeemer_list is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_list_t* redeemer_list = cardano_redeemer_list_new();
+ *
+ * // Populate redeemer_list with elements
+ *
+ * size_t length = cardano_redeemer_list_get_length(redeemer_list);
+ * printf("Length of the redeemer_list: %zu\n", length);
+ *
+ * // Clean up the redeemer_list object once done
+ * cardano_redeemer_list_unref(&redeemer_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_redeemer_list_get_length(const cardano_redeemer_list_t* redeemer_list);
+
+/**
+ * \brief Retrieves an element from a redeemer list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_redeemer_list_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] redeemer_list A constant pointer to the \ref cardano_redeemer_list_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the redeemer list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_redeemer_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_redeemer_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_list_t* redeemer_list = cardano_redeemer_list_new();
+ *
+ * // Populate redeemer_list with elements
+ *
+ * cardano_redeemer_t* element = NULL;
+ * cardano_error_t result = cardano_redeemer_list_get(redeemer_list, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_redeemer_unref(&element);
+ * }
+ *
+ * // Clean up the redeemer_list object once done
+ * cardano_redeemer_list_unref(&redeemer_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_list_get(const cardano_redeemer_list_t* redeemer_list, size_t index, cardano_redeemer_t** element);
+
+/**
+ * \brief Adds an element to a redeemer list.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_redeemer_list_t object.
+ *
+ * \param[in] redeemer_list A constant pointer to the \ref cardano_redeemer_list_t object to which
+ *                        the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_redeemer_t object that is to be added to the redeemer_list.
+ *                    The element will be referenced by the redeemer_list after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the redeemer_list, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_list_t* redeemer_list = cardano_redeemer_list_new();
+ *
+ * // Create and initialize a new redeemer element
+ * cardano_redeemer_t* element = { ... };
+ *
+ * // Add the element to the redeemer_list
+ * cardano_error_t result = cardano_redeemer_list_add(redeemer_list, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the redeemer_list object once done
+ * cardano_redeemer_list_unref(&redeemer_list);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_list_add(cardano_redeemer_list_t* redeemer_list, cardano_redeemer_t* element);
+
+/**
+ * \brief Sets the execution units (memory and steps) for a specific redeemer in the redeemer list.
+ *
+ * This function sets the execution units (memory and steps) for a given redeemer identified by its tag and index within the \ref cardano_redeemer_list_t.
+ *
+ * \param[in,out] redeemer_list A pointer to an initialized \ref cardano_redeemer_list_t object where the execution units will be set.
+ *                              This parameter must not be NULL.
+ * \param[in] tag The \ref cardano_redeemer_tag_t representing the type of the redeemer (e.g., spending, minting).
+ * \param[in] index The index of the redeemer for which the execution units will be set.
+ * \param[in] mem The amount of memory required for the redeemer execution.
+ * \param[in] steps The number of steps required for the redeemer execution.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the execution units were successfully set,
+ *         or an appropriate error code indicating the failure reason (e.g., \ref CARDANO_ERROR_INDEX_OUT_OF_BOUNDS if the specified index is invalid).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_list_t* redeemer_list = ...; // Assume redeemer_list is initialized
+ * cardano_redeemer_tag_t tag = CARDANO_REDEEMER_TAG_SPEND;
+ * uint64_t index = 0;
+ * uint64_t mem = 5000;
+ * uint64_t steps = 10000;
+ *
+ * cardano_error_t result = cardano_redeemer_list_set_ex_units(redeemer_list, tag, index, mem, steps);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Execution units set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set execution units: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_list_set_ex_units(
+  cardano_redeemer_list_t* redeemer_list,
+  cardano_redeemer_tag_t   tag,
+  uint64_t                 index,
+  uint64_t                 mem,
+  uint64_t                 steps);
+
+/**
+ * \brief Deep clones a redeemer list.
+ *
+ * This function creates a deep copy of the specified \ref cardano_redeemer_list_t object. The cloned list contains copies of all the redeemers
+ * and their associated data, ensuring that modifications to the original list do not affect the cloned list and vice versa.
+ * Cloning a list built in code with two redeemers that share a tag and index fails with \ref CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY.
+ *
+ * \param[in] redeemer_list A pointer to an initialized \ref cardano_redeemer_list_t object that will be cloned.
+ *                          This parameter must not be NULL.
+ * \param[out] cloned_redeemer_list On success, this will point to a newly created \ref cardano_redeemer_list_t object that is a deep copy of the original list.
+ *                                  The caller is responsible for managing the lifecycle of the cloned list and must call \ref cardano_redeemer_list_unref to release it when no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the redeemer list was successfully cloned,
+ *         or an appropriate error code indicating the failure reason (e.g., \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if memory allocation fails,
+ *         or \ref CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY if two redeemers share a tag and index).
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_list_t* redeemer_list = ...; // Assume redeemer_list is initialized
+ * cardano_redeemer_list_t* cloned_redeemer_list = NULL;
+ *
+ * cardano_error_t result = cardano_redeemer_list_clone(redeemer_list, &cloned_redeemer_list);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Redeemer list successfully cloned.\n");
+ *   // Use the cloned list
+ *
+ *   // Free the cloned list when no longer needed
+ *   cardano_redeemer_list_unref(&cloned_redeemer_list);
+ * }
+ * else
+ * {
+ *   printf("Failed to clone redeemer list: %d\n", result);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_redeemer_list_clone(
+  cardano_redeemer_list_t*  redeemer_list,
+  cardano_redeemer_list_t** cloned_redeemer_list);
+
+/**
+ * \brief Clears the cached CBOR representation from a redeemer list.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_redeemer_list_t object.
+ * It is useful when you have modified the redeemer list after it was created from CBOR using
+ * \ref cardano_redeemer_list_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the redeemer list, rather than using the original cached CBOR.
+ *
+ * \param[in,out] redeemer_list A pointer to an initialized \ref cardano_redeemer_list_t object
+ *                                 from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the redeemer list when
+ *          serialized, which can alter the redeemer list and invalidate any existing signatures.
+ *          Use this function with caution, especially if the transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume redeemer list was created using cardano_redeemer_list_from_cbor
+ * cardano_redeemer_list_t* redeemer_list = ...;
+ *
+ * // Modify the redeemer list as needed
+
+ * // Clear the CBOR cache to ensure serialization uses the updated redeemer list
+ * cardano_redeemer_list_clear_cbor_cache(redeemer_list);
+ *
+ * // Serialize the redeemer list to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_redeemer_list_to_cbor(redeemer_list, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_redeemer_list_unref(&redeemer list);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_redeemer_list_clear_cbor_cache(cardano_redeemer_list_t* redeemer_list);
+
+/**
+ * \brief Decrements the reference count of a redeemer_list object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_redeemer_list_t object
+ * by decreasing its reference count. When the reference count reaches zero, the redeemer_list is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] redeemer_list A pointer to the pointer of the redeemer_list object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_redeemer_list_t* redeemer_list = cardano_redeemer_list_new();
+ *
+ * // Perform operations with the redeemer_list...
+ *
+ * cardano_redeemer_list_unref(&redeemer_list);
+ * // At this point, redeemer_list is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_redeemer_list_unref, the pointer to the \ref cardano_redeemer_list_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_redeemer_list_unref(cardano_redeemer_list_t** redeemer_list);
+
+/**
+ * \brief Increases the reference count of the cardano_redeemer_list_t object.
+ *
+ * This function is used to manually increment the reference count of a redeemer_list
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_redeemer_list_unref.
+ *
+ * \param redeemer_list A pointer to the redeemer_list object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming redeemer_list is a previously created redeemer_list object
+ *
+ * cardano_redeemer_list_ref(redeemer_list);
+ *
+ * // Now redeemer_list can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_redeemer_list_ref there is a corresponding
+ * call to \ref cardano_redeemer_list_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_redeemer_list_ref(cardano_redeemer_list_t* redeemer_list);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_redeemer_list_t object.
+ *
+ * This function returns the number of active references to a redeemer_list object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_redeemer_list_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param redeemer_list A pointer to the redeemer_list object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified redeemer_list object. If the object
+ * is properly managed (i.e., every \ref cardano_redeemer_list_ref call is matched with a
+ * \ref cardano_redeemer_list_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming redeemer_list is a previously created redeemer_list object
+ *
+ * size_t ref_count = cardano_redeemer_list_refcount(redeemer_list);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_redeemer_list_refcount(const cardano_redeemer_list_t* redeemer_list);
+
+/**
+ * \brief Sets the last error message for a given redeemer_list object.
+ *
+ * Records an error message in the redeemer_list's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] redeemer_list A pointer to the \ref cardano_redeemer_list_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the redeemer_list's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_redeemer_list_set_last_error(cardano_redeemer_list_t* redeemer_list, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific redeemer_list.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_redeemer_list_set_last_error for the given
+ * redeemer_list. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] redeemer_list A pointer to the \ref cardano_redeemer_list_t instance whose last error
+ *                   message is to be retrieved. If the redeemer_list is NULL, the function
+ *                   returns a generic error message indicating the null redeemer_list.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified redeemer_list. If the redeemer_list is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_redeemer_list_set_last_error for the same redeemer_list, or until
+ *       the redeemer_list is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_redeemer_list_get_last_error(const cardano_redeemer_list_t* redeemer_list);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_redeemer_list_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_redeemer_list_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_redeemer_list_deep_clone(const cardano_redeemer_list_t* source, cardano_redeemer_list_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_REDEEMER_LIST_H
diff --git a/vendor/include/cardano/witness_set/redeemer_tag.h b/vendor/include/cardano/witness_set/redeemer_tag.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/redeemer_tag.h
@@ -0,0 +1,136 @@
+/**
+ * \file redeemer_tag.h
+ *
+ * \author angel.castillo
+ * \date   Sep 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_REDEEMER_TAG_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_REDEEMER_TAG_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * The redeemer tags act as an enumeration to signify the purpose or context of the
+ * redeemer in a transaction. When a Plutus script is executed, the specific action
+ * type related to the redeemer can be identified using these tags, allowing the
+ * script to respond appropriately.
+ */
+typedef enum
+{
+  /**
+   * \brief Indicates the redeemer is associated with a `Spending` script.
+   *
+   * A spending script validates the spending of a UTXO. A UTXO can have either a public key address or a
+   * script address. To spend a UTXO with a script address, the script whose hash matches the script address
+   * must be included in the transaction (either directly, or as a reference script), and is executed to validate it.
+   */
+  CARDANO_REDEEMER_TAG_SPEND = 0,
+
+  /**
+   * \brief Indicates the redeemer is associated with a `Minting` script.
+   *
+   * Minting scripts, sometimes also referred to as minting policies, are used to approve or reject minting of new assets.
+   *
+   * In Cardano, we can uniquely identify an asset by its `CurrencySymbol` and `TokenName`. If a transaction attempts to
+   * mint some new assets, then for each unique `CurrencySymbol` in the new assets, the script whose hash matches the
+   * `CurrencySymbol` must be included in the transaction, and is executed to validate the minting of that `CurrencySymbol`.
+   */
+  CARDANO_REDEEMER_TAG_MINT = 1,
+
+  /**
+   * \brief Indicates the redeemer is associated with a `Certifying` script.
+   *
+   * A certifying script can validate a number of certificate-related transactions,
+   * such as: (1) registering a staking credential, and in doing so, creating a reward account
+   * associated with the staking credential; (2) de-registering a staking credential, and in doing so,
+   * terminating the reward account; (3) delegating a staking credential to a particular delegatee.
+   *
+   * In all these cases except registration, if the staking credential in question contains a script
+   * hash (as opposed to a public key hash), the script with that hash must be included in the transaction,
+   * and is executed to validate the action.
+   */
+  CARDANO_REDEEMER_TAG_CERTIFYING = 2,
+
+  /**
+   * \brief Indicates the redeemer is associated with a `Rewarding` script.
+   *
+   * As previously stated, a UTXO's address can be either a public key address or a script address.
+   * Both kinds of addresses can optionally have a staking credential. A UTXO may contain Ada, and the Ada
+   * it contains can be delegated to an SPO to earn staking rewards. Staking rewards are deposited into a
+   * reward account corresponding to the staking credential.
+   *
+   * A staking credential can contain either a public key hash or a script hash. To withdraw rewards from a
+   * reward account corresponding to a staking credential that contains a script hash, the script with that
+   * particular hash must be included in the transaction, and is executed to validate the withdrawal.
+   */
+  CARDANO_REDEEMER_TAG_REWARD = 3,
+
+  /**
+   * \brief Indicates the redeemer is associated with a `Voting` script.
+   *
+   * A voting script validates votes cast by a Delegated Representative (DRep) or a constitutional committee member (CCM)
+   * in a transaction. A DRep or a CCM can be associated with a script hash. If a transaction contains one or more votes
+   * from a DRep or a constitution committee member associated with a script hash, the script with that hash must be
+   * included in the transaction, and is executed to approve or reject the vote.
+   */
+  CARDANO_REDEEMER_TAG_VOTING = 4,
+
+  /**
+   * \brief Indicates the redeemer is associated with a `Proposing` script.
+   *
+   * A proposing script, also known as constitution script or guardrail script, validates
+   * two kinds of governance actions: \ref cardano_parameter_change_action_t and \ref cardano_treasury_withdrawals_action_t`.
+   *
+   * There is a key distinction between proposing scripts and other kinds of scripts: proposing scripts
+   * are not written by regular users. At any given point in time, there is exactly one active proposing script
+   * being used by the entire chain. This proposing script must be included in transactions that propose
+   * \ref cardano_parameter_change_action_t and \ref cardano_treasury_withdrawals_action_t`. The ledger enforces that no
+   * other proposing script is accepted.
+   *
+   * The proposing script is updated only when there is a change to the constitution, via the
+   * \ref cardano_new_constitution_action_t governance action.
+   *
+   * \note The proposing script decides whether the proposal of a governance action is allowed to go
+   * through, rather than whether the governance action will be enacted. After a proposal goes through, it
+   * will need to meet the appropriate criteria (such as gathering enough votes from constitution committee members,
+   * DReps and/or SPOs) in order to be enacted.
+   */
+  CARDANO_REDEEMER_TAG_PROPOSING = 5,
+
+  /**
+   * \brief Indicates the redeemer is associated with a `Guarding` script.
+   *
+   * The transaction guards field generalizes the required signers field: in addition to key hash
+   * credentials, it can contain script hash credentials. For every script hash guard, the script
+   * with that hash must be included in the transaction, and is executed to authorize it.
+   *
+   * The index of a guarding redeemer is the position of the script hash credential within the
+   * transaction guards set.
+   */
+  CARDANO_REDEEMER_TAG_GUARDING = 6,
+} cardano_redeemer_tag_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_REDEEMER_TAG_H
diff --git a/vendor/include/cardano/witness_set/vkey_witness.h b/vendor/include/cardano/witness_set/vkey_witness.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/vkey_witness.h
@@ -0,0 +1,550 @@
+/**
+ * \file vkey_witness.h
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VKEY_WITNESS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VKEY_WITNESS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/ed25519_public_key.h>
+#include <cardano/crypto/ed25519_signature.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief vkey Witness (Verification Key Witness) is a component of a transaction that
+ * provides cryptographic proof that proves that the creator of the transaction
+ * has access to the private keys controlling the UTxOs being spent.
+ */
+typedef struct cardano_vkey_witness_t cardano_vkey_witness_t;
+
+/**
+ * \brief Creates and initializes a new instance of a Vkey Witness.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_vkey_witness_t object.
+ *
+ * \param[in] vkey A pointer to an initialized \ref cardano_ed25519_public_key_t object representing
+ *                 the public verification key (VKey). This key is used to verify the cryptographic signature.
+ * \param[in] signature A pointer to an initialized \ref cardano_ed25519_signature_t object containing
+ *                      the cryptographic signature. This signature is produced by signing the hash
+ *                      of the transaction body with the corresponding private key. The VKey is used to
+ *                      verify that the signature is valid and was made by the owner of the corresponding private key.
+ * \param[out] vkey_witness On successful initialization, this will point to a newly created
+ *                          \ref cardano_vkey_witness_t object. This object represents a "strong reference"
+ *                          to the vkey witness, meaning that it is fully initialized and ready for use.
+ *                          The caller is responsible for managing the lifecycle of this object.
+ *                          Specifically, once the vkey witness is no longer needed, the caller
+ *                          must release it by calling \ref cardano_vkey_witness_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the
+ *         vkey witness was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_ed25519_public_key_t* vkey = ...; // Assume vkey is already initialized
+ * cardano_ed25519_signature_t* signature = ...; // Assume signature is already initialized
+ * cardano_vkey_witness_t* vkey_witness = NULL;
+ *
+ * cardano_error_t result = cardano_vkey_witness_new(vkey, signature, &vkey_witness);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the vkey_witness
+ *   // Once done, ensure to clean up and release the vkey_witness
+ *   cardano_vkey_witness_unref(&vkey_witness);
+ * }
+ * else
+ * {
+ *   printf("Failed to create the vkey witness.\n");
+ * }
+ *
+ * // Cleanup the other inputs
+ * cardano_ed25519_public_key_unref(&vkey);
+ * cardano_ed25519_signature_unref(&signature);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vkey_witness_new(
+  cardano_ed25519_public_key_t* vkey,
+  cardano_ed25519_signature_t*  signature,
+  cardano_vkey_witness_t**      vkey_witness);
+
+/**
+ * \brief Creates a \ref cardano_vkey_witness_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_vkey_witness_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a vkey_witness.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] vkey_witness A pointer to a pointer of \ref cardano_vkey_witness_t that will be set to the address
+ *                        of the newly created vkey_witness object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the vkey witness were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_vkey_witness_t object by calling
+ *       \ref cardano_vkey_witness_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_vkey_witness_t* vkey_witness = NULL;
+ *
+ * cardano_error_t result = cardano_vkey_witness_from_cbor(reader, &vkey_witness);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the vkey_witness
+ *
+ *   // Once done, ensure to clean up and release the vkey_witness
+ *   cardano_vkey_witness_unref(&vkey_witness);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode vkey_witness: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vkey_witness_from_cbor(cardano_cbor_reader_t* reader, cardano_vkey_witness_t** vkey_witness);
+
+/**
+ * \brief Serializes vkey witness into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_vkey_witness_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] vkey_witness A constant pointer to the \ref cardano_vkey_witness_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p vkey_witness or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_t* vkey_witness = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_vkey_witness_to_cbor(vkey_witness, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_vkey_witness_unref(&vkey_witness);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vkey_witness_to_cbor(
+  const cardano_vkey_witness_t* vkey_witness,
+  cardano_cbor_writer_t*        writer);
+
+/**
+ * \brief Serializes a VKey witness to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * Keys are written in the order: "vkey", "signature".
+ *
+ * \param[in]  witness Pointer to a valid \ref cardano_vkey_witness_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS                On success.
+ * CARDANO_ERROR_POINTER_IS_NULL          If \p witness or \p writer is NULL.
+ * CARDANO_ERROR_MEMORY_ALLOCATION_FAILED If memory allocation fails.
+ * Other                                  Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vkey_witness_to_cip116_json(
+  const cardano_vkey_witness_t* witness,
+  cardano_json_writer_t*        writer);
+
+/**
+ * \brief Checks if a vkey_witness contains a specific public key.
+ *
+ * This function checks if the provided \ref cardano_vkey_witness_t object contains the specified Ed25519 public key.
+ * It is useful for determining if a particular witness corresponds to a given public key.
+ *
+ * \param[in] vkey_witness A constant pointer to the \ref cardano_vkey_witness_t object to be checked.
+ * \param[in] vkey A constant pointer to the \ref cardano_ed25519_public_key_t object representing the public key to search for.
+ *
+ * \return `true` if the public key is found in the vkey_witness; otherwise, `false`.
+ *
+ * \note This function only compares the public key, and not the associated signature or any other witness data.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_t* vkey_witness = { ... };
+ * cardano_ed25519_public_key_t* public_key = { ... };
+ *
+ * // Check if the vkey_witness contains the specified public key
+ * bool has_key = cardano_vkey_witness_has_public_key(vkey_witness, public_key);
+ *
+ * if (has_key)
+ * {
+ *   // The vkey_witness contains the public key
+ * }
+ * else
+ * {
+ *   // The public key is not present in the vkey_witness
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool
+cardano_vkey_witness_has_public_key(const cardano_vkey_witness_t* vkey_witness, const cardano_ed25519_public_key_t* vkey);
+
+/**
+ * \brief Retrieves the verification key (VKey) from a Vkey Witness.
+ *
+ * This function returns the \ref cardano_ed25519_public_key_t object representing the public verification key
+ * (VKey) associated with a \ref cardano_vkey_witness_t object. The VKey is used to verify the cryptographic
+ * signature provided in the vkey witness.
+ *
+ * \param[in] vkey_witness A pointer to an initialized \ref cardano_vkey_witness_t object from
+ *                              which the verification key will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_ed25519_public_key_t object representing the verification key.
+ *         The caller is responsible for managing the lifecycle of the returned VKey. Specifically, the caller
+ *         must release it by calling \ref cardano_ed25519_public_key_unref when it is no longer needed.
+ *         If \p vkey_witness is NULL, the function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_t* vkey_witness = ...; // Assume vkey_witness is initialized
+ * cardano_ed25519_public_key_t* vkey = cardano_vkey_witness_get_vkey(vkey_witness);
+ *
+ * if (vkey != NULL)
+ * {
+ *   // Use the verification key
+ *   // Once done, ensure to clean up and release the vkey
+ *   cardano_ed25519_public_key_unref(&vkey);
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the verification key.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_ed25519_public_key_t* cardano_vkey_witness_get_vkey(
+  cardano_vkey_witness_t* vkey_witness);
+
+/**
+ * \brief Sets the verification key (VKey) for a Vkey Witness.
+ *
+ * This function assigns a new \ref cardano_ed25519_public_key_t object as the verification key (VKey)
+ * for the given \ref cardano_vkey_witness_t object. The VKey is the public key that is used
+ * to verify the cryptographic signature in the vkey witness.
+ *
+ * \param[in,out] vkey_witness A pointer to an initialized \ref cardano_vkey_witness_t object
+ *                             to which the verification key will be assigned.
+ * \param[in] vkey A pointer to an initialized \ref cardano_ed25519_public_key_t object representing the new
+ *                 verification key. The caller retains ownership of this object and must ensure its lifecycle
+ *                 is properly managed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the verification key
+ *         was successfully set, or an appropriate error code if an error occurred, such as \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         either \p vkey_witness or \p vkey is NULL.
+ *
+ * \note The function does not take ownership of the \p vkey, meaning the caller is still responsible for freeing the
+ *       \ref cardano_ed25519_public_key_t object when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_t* vkey_witness = ...; // Assume vkey_witness is initialized
+ * cardano_ed25519_public_key_t* vkey = ...; // Assume vkey is initialized
+ *
+ * cardano_error_t result = cardano_vkey_witness_set_vkey(vkey_witness, vkey);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("VKey set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the VKey.\n");
+ * }
+ *
+ * // Cleanup resources for the VKey as it is still owned by the caller
+ * cardano_ed25519_public_key_unref(&vkey);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vkey_witness_set_vkey(
+  cardano_vkey_witness_t*       vkey_witness,
+  cardano_ed25519_public_key_t* vkey);
+
+/**
+ * \brief Retrieves the cryptographic signature from a Vkey Witness.
+ *
+ * This function retrieves the \ref cardano_ed25519_signature_t object from a given \ref cardano_vkey_witness_t object.
+ * The signature is produced by signing the hash of the transaction body using the corresponding private key (SKey),
+ * and it can be verified using the associated public key (VKey).
+ *
+ * \param[in] vkey_witness A pointer to an initialized \ref cardano_vkey_witness_t object from which
+ *                              the signature will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_ed25519_signature_t object representing the signature. The returned signature is
+ *         a new reference, and the caller is responsible for managing its lifecycle. Specifically, the caller must release
+ *         it using \ref cardano_ed25519_signature_unref when it is no longer needed. If \p vkey_witness is NULL, this
+ *         function will return NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_t* vkey_witness = ...; // Assume vkey_witness is initialized
+ * cardano_ed25519_signature_t* signature = cardano_vkey_witness_get_signature(vkey_witness);
+ *
+ * if (signature != NULL)
+ * {
+ *   // Process the signature
+ *   cardano_ed25519_signature_unref(&signature); // Ensure to clean up the signature
+ * }
+ * else
+ * {
+ *   printf("Failed to retrieve the signature.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_ed25519_signature_t* cardano_vkey_witness_get_signature(
+  cardano_vkey_witness_t* vkey_witness);
+
+/**
+ * \brief Sets the cryptographic signature for a Vkey Witness.
+ *
+ * This function assigns a new \ref cardano_ed25519_signature_t object to a given \ref cardano_vkey_witness_t object.
+ * The signature is produced by signing the hash of the transaction body using the corresponding private key (SKey),
+ * and it can be verified using the associated public key (VKey).
+ *
+ * \param[in,out] vkey_witness A pointer to an initialized \ref cardano_vkey_witness_t object to which
+ *                                  the signature will be assigned.
+ * \param[in] signature A pointer to an initialized \ref cardano_ed25519_signature_t object representing the signature.
+ *                      This parameter must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the signature
+ *         was successfully set. Returns \ref CARDANO_ERROR_POINTER_IS_NULL if either \p vkey_witness or \p signature is NULL.
+ *
+ * \note This function increases the reference count of the \p signature object; therefore, the caller retains ownership
+ *       of their reference and must release their copy when it is no longer needed using \ref cardano_ed25519_signature_unref.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_t* vkey_witness = ...; // Assume vkey_witness is initialized
+ * cardano_ed25519_signature_t* signature = ...; // Assume signature is initialized
+ *
+ * cardano_error_t result = cardano_vkey_witness_set_signature(vkey_witness, signature);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Signature successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set the signature.\n");
+ * }
+ *
+ * // Clean up
+ * cardano_ed25519_signature_unref(&signature); // Caller still owns their reference to the signature
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vkey_witness_set_signature(
+  cardano_vkey_witness_t*      vkey_witness,
+  cardano_ed25519_signature_t* signature);
+
+/**
+ * \brief Decrements the reference count of a cardano_vkey_witness_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_vkey_witness_t object
+ * by decreasing its reference count. When the reference count reaches zero, the vkey_witness is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] vkey_witness A pointer to the pointer of the vkey_witness object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_t* vkey_witness = cardano_vkey_witness_new(major, minor);
+ *
+ * // Perform operations with the vkey_witness...
+ *
+ * cardano_vkey_witness_unref(&vkey_witness);
+ * // At this point, vkey_witness is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_vkey_witness_unref, the pointer to the \ref cardano_vkey_witness_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_vkey_witness_unref(cardano_vkey_witness_t** vkey_witness);
+
+/**
+ * \brief Increases the reference count of the cardano_vkey_witness_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_vkey_witness_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_vkey_witness_unref.
+ *
+ * \param vkey_witness A pointer to the cardano_vkey_witness_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming vkey_witness is a previously created vkey_witness object
+ *
+ * cardano_vkey_witness_ref(vkey_witness);
+ *
+ * // Now vkey_witness can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_vkey_witness_ref there is a corresponding
+ * call to \ref cardano_vkey_witness_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_vkey_witness_ref(cardano_vkey_witness_t* vkey_witness);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_vkey_witness_t object.
+ *
+ * This function returns the number of active references to an cardano_vkey_witness_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_vkey_witness_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param vkey_witness A pointer to the cardano_vkey_witness_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_vkey_witness_t object. If the object
+ * is properly managed (i.e., every \ref cardano_vkey_witness_ref call is matched with a
+ * \ref cardano_vkey_witness_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming vkey_witness is a previously created vkey_witness object
+ *
+ * size_t ref_count = cardano_vkey_witness_refcount(vkey_witness);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_vkey_witness_refcount(const cardano_vkey_witness_t* vkey_witness);
+
+/**
+ * \brief Sets the last error message for a given cardano_vkey_witness_t object.
+ *
+ * Records an error message in the vkey_witness's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] vkey_witness A pointer to the \ref cardano_vkey_witness_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the vkey_witness's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_vkey_witness_set_last_error(
+  cardano_vkey_witness_t* vkey_witness,
+  const char*             message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific vkey_witness.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_vkey_witness_set_last_error for the given
+ * vkey_witness. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] vkey_witness A pointer to the \ref cardano_vkey_witness_t instance whose last error
+ *                   message is to be retrieved. If the vkey_witness is NULL, the function
+ *                   returns a generic error message indicating the null vkey_witness.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified vkey_witness. If the vkey_witness is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_vkey_witness_set_last_error for the same vkey_witness, or until
+ *       the vkey_witness is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_vkey_witness_get_last_error(
+  const cardano_vkey_witness_t* vkey_witness);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_vkey_witness_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_vkey_witness_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_vkey_witness_deep_clone(const cardano_vkey_witness_t* source, cardano_vkey_witness_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VKEY_WITNESS_H
diff --git a/vendor/include/cardano/witness_set/vkey_witness_set.h b/vendor/include/cardano/witness_set/vkey_witness_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/vkey_witness_set.h
@@ -0,0 +1,582 @@
+/**
+ * \file vkey_witness_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VKEY_WITNESS_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VKEY_WITNESS_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+#include <cardano/witness_set/vkey_witness.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief vkey Witness (Verification Key Witness) is a component of a transaction that
+ * provides cryptographic proof that proves that the creator of the transaction
+ * has access to the private keys controlling the UTxOs being spent.
+ */
+typedef struct cardano_vkey_witness_t cardano_vkey_witness_t;
+
+/**
+ * \brief Represents a set of vkey_witnesss.
+ */
+typedef struct cardano_vkey_witness_set_t cardano_vkey_witness_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a vkey_witness_set.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_vkey_witness_set_t.
+ * It returns an error code to indicate success or failure of the operation.
+ *
+ * \param[out] vkey_witness_set On successful initialization, this will point to a newly created
+ *             \ref cardano_vkey_witness_set_t object. This object represents a "strong reference"
+ *             to the vkey_witness_set, meaning that it is fully initialized and ready for use.
+ *             The caller is responsible for managing the lifecycle of this object.
+ *             Specifically, once the vkey_witness_set is no longer needed, the caller must release it
+ *             by calling \ref cardano_vkey_witness_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the vkey_witness_set was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t* vkey_witness_set = NULL;
+ *
+ * // Attempt to create a new vkey_witness_set
+ * cardano_error_t result = cardano_vkey_witness_set_new(&vkey_witness_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the vkey_witness_set
+ *
+ *   // Once done, ensure to clean up and release the vkey_witness_set
+ *   cardano_vkey_witness_set_unref(&vkey_witness_set);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vkey_witness_set_new(cardano_vkey_witness_set_t** vkey_witness_set);
+
+/**
+ * \brief Creates a vkey_witness set from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_vkey_witness_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a vkey_witness.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded vkey_witness data.
+ * \param[out] vkey_witnesss A pointer to a pointer of \ref cardano_vkey_witness_set_t that will be set to the address
+ *                        of the newly created vkey_witness object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the vkey_witness was successfully created, or an appropriate error code if an error occurred.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_vkey_witness_set_t object by calling
+ *       \ref cardano_vkey_witness_set_unref when it is no longer needed.
+ *
+ * \remark The set keeps every witness it is decoded with, including a witness that appears more than once, and encodes
+ *         them all back so that the original CBOR is reproduced. Earlier protocol versions drop repeated witnesses and
+ *         protocol version 12 rejects them; call \ref cardano_vkey_witness_set_clear_cbor_cache to encode each witness
+ *         only once.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_vkey_witness_set_t* vkey_witness = NULL;
+ *
+ * cardano_error_t result = cardano_vkey_witness_set_from_cbor(reader, &vkey_witness);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the vkey_witness
+ *
+ *   // Once done, ensure to clean up and release the vkey_witness
+ *   cardano_vkey_witness_set_unref(&vkey_witness);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode vkey_witness: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_vkey_witness_set_from_cbor(cardano_cbor_reader_t* reader, cardano_vkey_witness_set_t** vkey_witnesss);
+
+/**
+ * \brief Serializes a vkey_witness into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_vkey_witness_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] vkey_witnesss A constant pointer to the \ref cardano_vkey_witness_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p vkey_witness or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark Two vkey witnesses are the same witness when they have the same public key and the same signature, as in
+ *         the ledger; witnesses with the same public key and different signatures are different witnesses. The ledger
+ *         drops a repeated witness before protocol version 12 and rejects it from protocol version 12, so a witness
+ *         that appears more than once is written only once, at the position of its last occurrence. A set decoded
+ *         from CBOR is the exception: it writes every witness it was decoded with until it is modified with
+ *         \ref cardano_vkey_witness_set_add or \ref cardano_vkey_witness_set_clear_cbor_cache is called.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t* vkey_witness = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_vkey_witness_set_to_cbor(vkey_witness, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_vkey_witness_set_unref(&vkey_witness);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vkey_witness_set_to_cbor(
+  const cardano_vkey_witness_set_t* vkey_witnesss,
+  cardano_cbor_writer_t*            writer);
+
+/**
+ * \brief Serializes a set of VKey witnesses to a CIP-116 JSON array.
+ *
+ * This function iterates over the set and serializes each \ref cardano_vkey_witness_t
+ * into a JSON array.
+ *
+ * \param[in]  witnesses Pointer to a valid \ref cardano_vkey_witness_set_t.
+ * \param[in]  writer    Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p witnesses or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vkey_witness_set_to_cip116_json(
+  const cardano_vkey_witness_set_t* witnesses,
+  cardano_json_writer_t*            writer);
+
+/**
+ * \brief Retrieves the length of a vkey_witness list.
+ *
+ * This function retrieves the number of elements in the provided \ref cardano_vkey_witness_set_t object.
+ *
+ * \param[in] vkey_witness_set A constant pointer to the \ref cardano_vkey_witness_set_t object whose length is to be retrieved.
+ *
+ * \return The number of elements in the vkey_witness_set. Return 0 if the vkey_witness_set is NULL.
+ *
+ * \note The length counts every element held by the set, including a witness decoded more than once, which
+ *       \ref cardano_vkey_witness_set_to_cbor may write only once.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t* vkey_witness_set = cardano_vkey_witness_set_new();
+ *
+ * // Populate vkey_witness_set with elements
+ *
+ * size_t length = cardano_vkey_witness_set_get_length(vkey_witness_set);
+ * printf("Length of the vkey_witness_set: %zu\n", length);
+ *
+ * // Clean up the vkey_witness_set object once done
+ * cardano_vkey_witness_set_unref(&vkey_witness_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_vkey_witness_set_get_length(const cardano_vkey_witness_set_t* vkey_witness_set);
+
+/**
+ * \brief Retrieves an element from a vkey_witness list by index.
+ *
+ * This function retrieves the element at the specified index from the provided \ref cardano_vkey_witness_set_t object
+ * and stores it in the output parameter.
+ *
+ * \param[in] vkey_witness_set A constant pointer to the \ref cardano_vkey_witness_set_t object from which
+ *                        the element is to be retrieved.
+ * \param[in] index The index of the element to retrieve from the vkey_witness list. Indexing starts at 0.
+ * \param[out] element Pointer to a variable where the retrieved element will be stored.
+ *                     This variable will point to the retrieved \ref cardano_vkey_witness_t object.
+ *                     The caller is responsible for managing the lifecycle of the element by calling
+ *                     \ref cardano_vkey_witness_unref when it is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t* vkey_witness_set = cardano_vkey_witness_set_new();
+ *
+ * // Populate vkey_witness_set with elements
+ *
+ * cardano_vkey_witness_t* element = NULL;
+ * cardano_error_t result = cardano_vkey_witness_set_get(vkey_witness_set, 2, &element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the retrieved element
+ *   // Remember to unreference the element once done if it's no longer needed
+ *   cardano_vkey_witness_unref(&element);
+ * }
+ *
+ * // Clean up the vkey_witness_set object once done
+ * cardano_vkey_witness_set_unref(&vkey_witness_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vkey_witness_set_get(const cardano_vkey_witness_set_t* vkey_witness_set, size_t index, cardano_vkey_witness_t** element);
+
+/**
+ * \brief Adds an element to a vkey_witness list, replacing existing signatures for duplicate public keys.
+ *
+ * This function adds the specified element to the end of the provided \ref cardano_vkey_witness_set_t object.
+ * If elements with the same public key are already present in the set, the signature of each of them is replaced
+ * with the new signature provided by the added \ref cardano_vkey_witness_t element and no element is added, so the set
+ * holds one witness per public key and signing a transaction again with the same key does not add a second witness.
+ *
+ * After this call the set is encoded without repeated witnesses, even if it was decoded from CBOR that repeats one.
+ *
+ * \param[in] vkey_witness_set A pointer to the \ref cardano_vkey_witness_set_t object to which
+ *                             the element is to be added.
+ * \param[in] element Pointer to the \ref cardano_vkey_witness_t object that is to be added to the vkey_witness_set.
+ *                    The element will be referenced by the vkey_witness_set after addition.
+ *
+ * \return \ref CARDANO_SUCCESS if the element was successfully added to the vkey_witness_set, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t* vkey_witness_set = cardano_vkey_witness_set_new();
+ *
+ * // Create and initialize a new vkey_witness element
+ * cardano_vkey_witness_t* element = { ... };
+ *
+ * // Add the element to the vkey_witness_set
+ * cardano_error_t result = cardano_vkey_witness_set_add(vkey_witness_set, element);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Element added successfully
+ * }
+ *
+ * // Clean up the vkey_witness_set object once done
+ * cardano_vkey_witness_set_unref(&vkey_witness_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vkey_witness_set_add(cardano_vkey_witness_set_t* vkey_witness_set, cardano_vkey_witness_t* element);
+
+/**
+ * \brief Merges new vkey_witnesses into an existing vkey_witness_set.
+ *
+ * This function applies the elements from the \c new_vkey_witnesses set into the \c vkey_witness_set.
+ * If a witness in the new set has the same public key as one already in the original set, the signature in the
+ * original witness will be replaced with the new signature from the \c new_vkey_witnesses set.
+ *
+ * \param[in] vkey_witness_set A pointer to the \ref cardano_vkey_witness_set_t object where new vkey_witnesses will be applied.
+ * \param[in] new_vkey_witnesses A pointer to the \ref cardano_vkey_witness_set_t object containing the new witnesses to apply.
+ *
+ * \return \ref CARDANO_SUCCESS if the merge was successful, or an appropriate error code indicating failure.
+ *
+ * \note This function ensures that any existing witness signatures for the same public key in the original set
+ * are replaced with new ones from the \c new_vkey_witnesses set.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t* original_witnesses = cardano_vkey_witness_set_new();
+ * cardano_vkey_witness_set_t* new_witnesses = cardano_vkey_witness_set_new();
+ *
+ * // Populate new_witnesses and original_witnesses
+ *
+ * // Apply the new witnesses to the original set
+ * cardano_error_t result = cardano_vkey_witness_set_apply(original_witnesses, new_witnesses);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // The new witnesses were successfully applied to the original set
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vkey_witness_set_apply(cardano_vkey_witness_set_t* vkey_witness_set, cardano_vkey_witness_set_t* new_vkey_witnesses);
+
+/**
+ * \brief Checks if the vkey witness set uses tagged encoding (Conway era feature).
+ *
+ * This function determines whether the specified \ref cardano_vkey_witness_set_t object uses tagged encoding for sets,
+ * introduced in the Conway era of the Cardano blockchain. Tagged sets are a new way of encoding sets in CBOR, which
+ * differs from the older array-based representation used in previous eras.
+ *
+ * \param[in] vkey_witness_set A pointer to an initialized \ref cardano_vkey_witness_set_t object.
+ *
+ * \return \c true if the vkey witness set uses tagged encoding for sets; \c false otherwise.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t* vkey_witness_set = ...; // Assume vkey_witness_set is already initialized
+ *
+ * bool uses_tag = cardano_vkey_witness_set_get_use_tag(vkey_witness_set);
+ * if (uses_tag)
+ * {
+ *   printf("The vkey witness set uses tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("The vkey witness set uses legacy array encoding.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_vkey_witness_set_get_use_tag(const cardano_vkey_witness_set_t* vkey_witness_set);
+
+/**
+ * \brief Enables or disables tagged encoding (Conway era feature) for the vkey witness set.
+ *
+ * This function sets whether the specified \ref cardano_vkey_witness_set_t object should use tagged encoding
+ * (introduced in the Conway era) when serializing sets in CBOR. If \p use_tag is set to \c true, the vkey witness set will be encoded
+ * using tagged sets. Otherwise, it will use the older array-based encoding method.
+ *
+ * \param[in,out] vkey_witness_set A pointer to an initialized \ref cardano_vkey_witness_set_t object.
+ * \param[in] use_tag A boolean value that determines whether to use tagged encoding (\c true) or legacy array encoding (\c false).
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the operation was successful,
+ *         or an appropriate error code if an error occurred.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t* vkey_witness = ...; // Assume vkey_witness is already initialized
+ * cardano_error_t result = cardano_vkey_witness_set_set_use_tag(vkey_witness, true);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("The vkey witness set is now set to use tagged encoding.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set tagged encoding: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_vkey_witness_set_set_use_tag(cardano_vkey_witness_set_t* vkey_witness_set, bool use_tag);
+
+/**
+ * \brief Clears the encoding details a vkey witness set keeps from the CBOR it was decoded from.
+ *
+ * A vkey witness set created with \ref cardano_vkey_witness_set_from_cbor encodes back with the same set tag form and
+ * every witness it was decoded with, including repeated ones, so that the original CBOR is reproduced. This function
+ * drops those details: the set is then encoded with the set tag and each witness only once, which is the form the
+ * ledger accepts in every protocol version.
+ *
+ * \param[in,out] vkey_witness_set A pointer to an initialized \ref cardano_vkey_witness_set_t object. If NULL, the
+ *                                 function does nothing.
+ *
+ * \warning Clearing the encoding details may change the binary representation of the witness set when serialized,
+ *          which changes the bytes of a transaction that holds it. The transaction id is not affected.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t* vkey_witness_set = ...; // Assume it was decoded from CBOR
+ *
+ * cardano_vkey_witness_set_clear_cbor_cache(vkey_witness_set);
+ *
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ * cardano_error_t result = cardano_vkey_witness_set_to_cbor(vkey_witness_set, writer);
+ *
+ * cardano_cbor_writer_unref(&writer);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_vkey_witness_set_clear_cbor_cache(cardano_vkey_witness_set_t* vkey_witness_set);
+
+/**
+ * \brief Decrements the reference count of a vkey_witness_set object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_vkey_witness_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the vkey_witness_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] vkey_witness_set A pointer to the pointer of the vkey_witness_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_vkey_witness_set_t* vkey_witness_set = cardano_vkey_witness_set_new();
+ *
+ * // Perform operations with the vkey_witness_set...
+ *
+ * cardano_vkey_witness_set_unref(&vkey_witness_set);
+ * // At this point, vkey_witness_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_vkey_witness_set_unref, the pointer to the \ref cardano_vkey_witness_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_vkey_witness_set_unref(cardano_vkey_witness_set_t** vkey_witness_set);
+
+/**
+ * \brief Increases the reference count of the cardano_vkey_witness_set_t object.
+ *
+ * This function is used to manually increment the reference count of a vkey_witness_set
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_vkey_witness_set_unref.
+ *
+ * \param vkey_witness_set A pointer to the vkey_witness_set object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming vkey_witness_set is a previously created vkey_witness_set object
+ *
+ * cardano_vkey_witness_set_ref(vkey_witness_set);
+ *
+ * // Now vkey_witness_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_vkey_witness_set_ref there is a corresponding
+ * call to \ref cardano_vkey_witness_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_vkey_witness_set_ref(cardano_vkey_witness_set_t* vkey_witness_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_vkey_witness_set_t object.
+ *
+ * This function returns the number of active references to a vkey_witness_set object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_vkey_witness_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param vkey_witness_set A pointer to the vkey_witness_set object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified vkey_witness_set object. If the object
+ * is properly managed (i.e., every \ref cardano_vkey_witness_set_ref call is matched with a
+ * \ref cardano_vkey_witness_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming vkey_witness_set is a previously created vkey_witness_set object
+ *
+ * size_t ref_count = cardano_vkey_witness_set_refcount(vkey_witness_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_vkey_witness_set_refcount(const cardano_vkey_witness_set_t* vkey_witness_set);
+
+/**
+ * \brief Sets the last error message for a given vkey_witness_set object.
+ *
+ * Records an error message in the vkey_witness_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] vkey_witness_set A pointer to the \ref cardano_vkey_witness_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the vkey_witness_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_vkey_witness_set_set_last_error(cardano_vkey_witness_set_t* vkey_witness_set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific vkey_witness_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_vkey_witness_set_set_last_error for the given
+ * vkey_witness_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] vkey_witness_set A pointer to the \ref cardano_vkey_witness_set_t instance whose last error
+ *                   message is to be retrieved. If the vkey_witness_set is NULL, the function
+ *                   returns a generic error message indicating the null vkey_witness_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified vkey_witness_set. If the vkey_witness_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_vkey_witness_set_set_last_error for the same vkey_witness_set, or until
+ *       the vkey_witness_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_vkey_witness_set_get_last_error(const cardano_vkey_witness_set_t* vkey_witness_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_vkey_witness_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_vkey_witness_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_vkey_witness_set_deep_clone(const cardano_vkey_witness_set_t* source, cardano_vkey_witness_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VKEY_WITNESS_SET_H
diff --git a/vendor/include/cardano/witness_set/witness_set.h b/vendor/include/cardano/witness_set/witness_set.h
new file mode 100644
--- /dev/null
+++ b/vendor/include/cardano/witness_set/witness_set.h
@@ -0,0 +1,1132 @@
+/**
+ * \file witness_set.h
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_WITNESS_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_WITNESS_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/scripts/script.h>
+#include <cardano/typedefs.h>
+#include <cardano/witness_set/bootstrap_witness_set.h>
+#include <cardano/witness_set/native_script_set.h>
+#include <cardano/witness_set/plutus_data_set.h>
+#include <cardano/witness_set/plutus_v1_script_set.h>
+#include <cardano/witness_set/plutus_v2_script_set.h>
+#include <cardano/witness_set/plutus_v3_script_set.h>
+#include <cardano/witness_set/plutus_v4_script_set.h>
+#include <cardano/witness_set/redeemer_list.h>
+#include <cardano/witness_set/vkey_witness_set.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A witness is a piece of information that allows you to efficiently verify the
+ * authenticity of the transaction (also known as proof).
+ *
+ * In Cardano, transactions have multiple types of authentication proofs, these can range
+ * from signatures for spending UTxOs, to scripts (with its arguments, datums and redeemers) for
+ * smart contract execution.
+ */
+typedef struct cardano_witness_set_t cardano_witness_set_t;
+
+/**
+ * \brief Creates and initializes a new instance of a transaction witness set.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_witness_set_t object,
+ * which is used to hold various witness data required to validate a transaction in the Cardano blockchain.
+ *
+ * \param[out] witness_set A pointer to a pointer of \ref cardano_witness_set_t.
+ *                                     On successful initialization, this will point to a newly created
+ *                                     transaction witness set object. The caller is responsible for managing
+ *                                     the lifecycle of this object by calling \ref cardano_witness_set_unref
+ *                                     when the witness set is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the witness set was successfully created, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = NULL;
+ * cardano_error_t result = cardano_witness_set_new(&witness_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the witness_set
+ *
+ *   // Once done, ensure to clean up and release the witness_set
+ *   cardano_witness_set_unref(&witness_set);
+ * }
+ * else
+ * {
+ *   printf("Failed to create transaction witness set: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_witness_set_new(cardano_witness_set_t** witness_set);
+
+/**
+ * \brief Creates a \ref cardano_witness_set_t from a CBOR reader.
+ *
+ * This function parses CBOR data using a provided \ref cardano_cbor_reader_t and constructs a \ref cardano_witness_set_t object.
+ * It assumes that the CBOR reader is set up correctly and that the CBOR data corresponds to the structure expected for a witness_set.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t that is ready to read the CBOR-encoded data.
+ * \param[out] witness_set A pointer to a pointer of \ref cardano_witness_set_t that will be set to the address
+ *                        of the newly created witness_set object upon successful decoding.
+ *
+ * \return A \ref cardano_error_t value indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the witness set were successfully created, or an appropriate error code if an error occurred.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the witness_set and could invalidate any existing signatures.
+ *         To prevent this, when a witness_set object is created using \ref cardano_witness_set_from_cbor, it caches the original
+ *         CBOR representation of datums and redeemers internally, and it also records the order in which the witness set map keys
+ *         were decoded. When \ref cardano_witness_set_to_cbor is called, it will output the cached CBOR and keep the decoded key order.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_witness_set_clear_cbor_cache after the object has been created.
+ *
+ * \note If the function fails, the last error can be retrieved by calling \ref cardano_cbor_reader_get_last_error with the reader.
+ *       The caller is responsible for freeing the created \ref cardano_witness_set_t object by calling
+ *       \ref cardano_witness_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cbor_data, data_size);
+ * cardano_witness_set_t* witness_set = NULL;
+ *
+ * cardano_error_t result = cardano_witness_set_from_cbor(reader, &witness_set);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the witness_set
+ *
+ *   // Once done, ensure to clean up and release the witness_set
+ *   cardano_witness_set_unref(&witness_set);
+ * }
+ * else
+ * {
+ *   const char* error = cardano_cbor_reader_get_last_error(reader);
+ *   printf("Failed to decode witness_set: %s\n", error);
+ * }
+ *
+ * cardano_cbor_reader_unref(&reader); // Cleanup the CBOR reader
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_witness_set_from_cbor(cardano_cbor_reader_t* reader, cardano_witness_set_t** witness_set);
+
+/**
+ * \brief Serializes witness set into CBOR format using a CBOR writer.
+ *
+ * This function serializes the given \ref cardano_witness_set_t object using a \ref cardano_cbor_writer_t.
+ *
+ * \param[in] witness_set A constant pointer to the \ref cardano_witness_set_t object that is to be serialized.
+ * \param[out] writer A pointer to a \ref cardano_cbor_writer_t where the CBOR serialized data will be written.
+ *                    The writer must already be initialized and ready to accept the data.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the serialization is successful. If the \p witness_set or \p writer
+ *         is NULL, returns \ref CARDANO_ERROR_POINTER_IS_NULL.
+ *
+ * \remark In Cardano, entities are encoded in CBOR, but CBOR allows multiple valid ways to encode the same data. The Cardano blockchain
+ *         does not enforce a canonical CBOR representation, meaning that if you decode a transaction from CBOR and then re-encode it,
+ *         the resulting encoding could be different. This would change the witness_set and could invalidate any existing signatures.
+ *         To prevent this, when a witness_set object is created using \ref cardano_witness_set_from_cbor, it caches the original
+ *         CBOR representation of datums and redeemers internally, and it also records the order in which the witness set map keys
+ *         were decoded. When \ref cardano_witness_set_to_cbor is called, it will output the cached CBOR and keep the decoded key order.
+ *         If the cached CBOR representation is not needed, the client can call \ref cardano_witness_set_clear_cbor_cache after the object has been created.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...;
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * if (writer)
+ * {
+ *   cardano_error_t result = cardano_witness_set_to_cbor(witness_set, writer);
+ *
+ *   if (result == CARDANO_SUCCESS)
+ *   {
+ *     // Use the writer's buffer containing the serialized data
+ *   }
+ *   else
+ *   {
+ *     const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *     printf("Serialization failed: %s\n", error_message);
+ *   }
+ *
+ *   cardano_cbor_writer_unref(&writer);
+ * }
+ *
+ * cardano_witness_set_unref(&witness_set);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_witness_set_to_cbor(
+  const cardano_witness_set_t* witness_set,
+  cardano_cbor_writer_t*       writer);
+
+/**
+ * \brief Serializes a transaction witness set to CIP-116 JSON.
+ *
+ * The function writes the full JSON object, including the surrounding braces.
+ * It checks for the existence of each witness type (vkeywitnesses, native_scripts,
+ * bootstraps, plutus_scripts, plutus_data, redeemers) and writes them if present and non-empty.
+ *
+ * \param[in]  witness_set Pointer to a valid \ref cardano_witness_set_t.
+ * \param[in]  writer      Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p witness_set or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_witness_set_to_cip116_json(
+  const cardano_witness_set_t* witness_set,
+  cardano_json_writer_t*       writer);
+
+/**
+ * \brief Retrieves the vkey (verification key) witness set from a witness set.
+ *
+ * This function extracts the set of vkey witnesses (public key and signature pairs) from a given
+ * \ref cardano_witness_set_t object. Vkey witnesses are used to validate that the transaction has
+ * been signed by the correct private keys corresponding to the public keys provided.
+ *
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object.
+ *
+ * \return A pointer to a \ref cardano_vkey_witness_set_t object containing the vkey witnesses.
+ *         If the witness set contains no vkey witnesses or the witness_set pointer is NULL,
+ *         this function will return NULL. The returned vkey witness set is a new reference,
+ *         and the caller is responsible for managing its lifecycle by calling
+ *         \ref cardano_vkey_witness_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_vkey_witness_set_t* vkeys = cardano_witness_set_get_vkeys(witness_set);
+ *
+ * if (vkeys != NULL)
+ * {
+ *   // Process the vkey witness set
+ *   cardano_vkey_witness_set_unref(&vkeys); // Clean up when done
+ * }
+ * else
+ * {
+ *   printf("No vkey witnesses found or witness set is NULL.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_vkey_witness_set_t* cardano_witness_set_get_vkeys(
+  cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Sets or removes the vkey (verification key) witness set in a witness set.
+ *
+ * This function assigns a set of vkey witnesses (public key and signature pairs) to a given
+ * \ref cardano_witness_set_t object. If \p vkeys is NULL, it will remove the vkey witnesses from
+ * the witness set, effectively clearing the vkey witnesses.
+ *
+ * \param[in,out] witness_set A pointer to an initialized \ref cardano_witness_set_t object where the vkey witnesses will be set.
+ * \param[in] vkeys A pointer to an initialized \ref cardano_vkey_witness_set_t object containing the vkey witnesses to set,
+ *                  or NULL to remove the vkey witnesses from the witness set.
+ *
+ * \return A \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the vkey witnesses
+ *         were successfully set or removed, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the witness_set pointer is NULL.
+ *
+ * \note This function increases the reference count of the `vkeys` object if it is not NULL. The caller retains ownership of their references,
+ *       and it is their responsibility to manage the lifecycle of both the `witness_set` and `vkeys`.
+ *       If `vkeys` is NULL, the function removes the vkey witnesses from the witness set.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_vkey_witness_set_t* vkeys = ...;  // Assume vkeys is already initialized
+ *
+ * cardano_error_t result = cardano_witness_set_set_vkeys(witness_set, vkeys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Successfully set or removed vkey witnesses.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set or remove vkey witnesses: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_witness_set_set_vkeys(
+  cardano_witness_set_t*      witness_set,
+  cardano_vkey_witness_set_t* vkeys);
+
+/**
+ * \brief Retrieves the bootstrap witness set from a witness set.
+ *
+ * This function fetches the bootstrap witness set from a given \ref cardano_witness_set_t object. Bootstrap witnesses are
+ * used in Cardano transactions that include inputs from the Byron era (the pre-Shelley era).
+ *
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object.
+ *
+ * \return A pointer to a \ref cardano_bootstrap_witness_set_t object representing the bootstrap witness set.
+ *         This is a new reference, and the caller is responsible for releasing it with \ref cardano_bootstrap_witness_set_unref
+ *         when it is no longer needed. If the witness set does not contain any bootstrap witnesses, this function returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_bootstrap_witness_set_t* bootstrap_witness_set = cardano_witness_set_get_bootstrap(witness_set);
+ *
+ * if (bootstrap_witness_set != NULL)
+ * {
+ *   // Use the bootstrap witness set
+ *
+ *   // Once done, ensure to clean up and release the bootstrap witness set
+ *   cardano_bootstrap_witness_set_unref(&bootstrap_witness_set);
+ * }
+ * else
+ * {
+ *   printf("No bootstrap witnesses found in the witness set.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_bootstrap_witness_set_t* cardano_witness_set_get_bootstrap(
+  cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Sets the bootstrap witness set in a witness set.
+ *
+ * This function assigns a bootstrap witness set to a given \ref cardano_witness_set_t object. Bootstrap witnesses are
+ * necessary for transactions that involve inputs from the Byron era (the pre-Shelley era).
+ *
+ * \param[in,out] witness_set A pointer to an initialized \ref cardano_witness_set_t object, to which the bootstrap witness set will be added or replaced.
+ * \param[in] bootstraps A pointer to an initialized \ref cardano_bootstrap_witness_set_t object representing the bootstrap witnesses to be set.
+ *                       This parameter can be \c NULL to remove the bootstrap witnesses from the witness set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the bootstrap witnesses
+ *         were successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the witness_set pointer is \c NULL.
+ *
+ * \note The function does not take ownership of the \p bootstraps object. The caller must ensure the lifecycle of the \p bootstraps object is properly managed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_bootstrap_witness_set_t* bootstraps = ...; // Assume bootstraps is already initialized
+ *
+ * cardano_error_t result = cardano_witness_set_set_bootstrap(witness_set, bootstraps);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Bootstrap witnesses successfully set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set bootstrap witnesses: %s\n", cardano_error_to_string(result));
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_witness_set_set_bootstrap(
+  cardano_witness_set_t*           witness_set,
+  cardano_bootstrap_witness_set_t* bootstraps);
+
+/**
+ * \brief Retrieves the native scripts from a witness set.
+ *
+ * This function extracts the native scripts associated with a given \ref cardano_witness_set_t object.
+ * Native scripts are used in Cardano to define spending conditions, and they can include multi-signature scripts,
+ * time-locks, and other types of scripts.
+ *
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object from which to retrieve the native scripts.
+ *
+ * \return A pointer to the \ref cardano_native_script_set_t object representing the native scripts in the witness set.
+ *         If the witness set does not contain any native scripts, or if the witness_set pointer is \c NULL, this function returns \c NULL.
+ *         The returned \c cardano_native_script_set_t is a new reference, and the caller is responsible for releasing it
+ *         with \ref cardano_native_script_set_unref when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_native_script_set_t* native_scripts = cardano_witness_set_get_native_scripts(witness_set);
+ *
+ * if (native_scripts != NULL)
+ * {
+ *   // Process the native scripts
+ *
+ *   // Clean up once done
+ *   cardano_native_script_set_unref(&native_scripts);
+ * }
+ * else
+ * {
+ *   printf("No native scripts found in the witness set.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_native_script_set_t* cardano_witness_set_get_native_scripts(
+  cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Sets the native scripts for a witness set.
+ *
+ * This function assigns a set of native scripts to a given \ref cardano_witness_set_t object.
+ * Native scripts are used to define spending conditions, including multi-signature scripts and time-locks.
+ *
+ * \param[in,out] witness_set A pointer to an initialized \ref cardano_witness_set_t object where the native scripts will be set.
+ * \param[in] native_scripts A pointer to a \ref cardano_native_script_set_t object representing the native scripts to be assigned.
+ *                           This can be \c NULL to remove any existing native scripts from the witness set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the native scripts were
+ *         successfully set, or an appropriate error code such as \ref CARDANO_ERROR_POINTER_IS_NULL if the witness_set is \c NULL.
+ *
+ * \note If \p native_scripts is \c NULL, any existing native scripts in the \p witness_set will be removed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_native_script_set_t* native_scripts = ...; // Assume native_scripts is initialized
+ *
+ * cardano_error_t result = cardano_witness_set_native_scripts(witness_set, native_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Native scripts have been successfully set
+ * }
+ * else
+ * {
+ *   printf("Failed to set native scripts: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Optionally, remove native scripts by passing NULL
+ * cardano_witness_set_native_scripts(witness_set, NULL);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_witness_set_set_native_scripts(
+  cardano_witness_set_t*       witness_set,
+  cardano_native_script_set_t* native_scripts);
+
+/**
+ * \brief Retrieves the Plutus V1 scripts from a witness set.
+ *
+ * This function fetches the set of Plutus V1 scripts, if any, associated with a given \ref cardano_witness_set_t object.
+ * Plutus scripts are smart contracts used in the Cardano blockchain, and the V1 scripts represent the first iteration of the Plutus language.
+ *
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object from which the Plutus V1 scripts will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_plutus_v1_script_set_t object representing the set of Plutus V1 scripts,
+ *         or \c NULL if no Plutus V1 scripts are present in the witness set.
+ *         The returned set is a new reference, and the caller is responsible for releasing it by calling \ref cardano_plutus_v1_script_set_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_plutus_v1_script_set_t* plutus_v1_scripts = cardano_witness_set_get_plutus_v1_scripts(witness_set);
+ *
+ * if (plutus_v1_scripts != NULL)
+ * {
+ *   // Process the Plutus V1 scripts
+ *
+ *   // Release the Plutus V1 scripts when done
+ *   cardano_plutus_v1_script_set_unref(&plutus_v1_scripts);
+ * }
+ * else
+ * {
+ *   printf("No Plutus V1 scripts found in the witness set.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_plutus_v1_script_set_t* cardano_witness_set_get_plutus_v1_scripts(
+  cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Sets the Plutus V1 scripts in a witness set.
+ *
+ * This function assigns a set of Plutus V1 scripts to the specified \ref cardano_witness_set_t object.
+ * If the Plutus scripts are set, they will be included in the witness set used for transaction validation.
+ *
+ * \param[in,out] witness_set A pointer to an initialized \ref cardano_witness_set_t object where the Plutus V1 scripts will be set.
+ * \param[in] plutus_scripts A pointer to an initialized \ref cardano_plutus_v1_script_set_t object representing the Plutus V1 scripts to be set.
+ *                           This parameter can be \c NULL to remove any existing Plutus V1 scripts from the witness set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the Plutus V1 scripts were
+ *         successfully set or removed, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_plutus_v1_script_set_t* plutus_scripts = ...; // Assume Plutus V1 scripts are initialized
+ *
+ * cardano_error_t result = cardano_witness_set_plutus_v1_scripts(witness_set, plutus_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Plutus V1 scripts set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Plutus V1 scripts.\n");
+ * }
+ *
+ * // You can also remove the Plutus V1 scripts by passing NULL:
+ * result = cardano_witness_set_plutus_v1_scripts(witness_set, NULL);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Plutus V1 scripts removed successfully.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_witness_set_set_plutus_v1_scripts(
+  cardano_witness_set_t*          witness_set,
+  cardano_plutus_v1_script_set_t* plutus_scripts);
+
+/**
+ * \brief Retrieves the Plutus V2 scripts from a witness set.
+ *
+ * This function fetches the set of Plutus V2 scripts, if any, associated with a given \ref cardano_witness_set_t object.
+ * Plutus scripts are smart contracts used in the Cardano blockchain, and the V2 scripts represent the first iteration of the Plutus language.
+ *
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object from which the Plutus V2 scripts will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_plutus_v2_script_set_t object representing the set of Plutus V2 scripts,
+ *         or \c NULL if no Plutus V2 scripts are present in the witness set.
+ *         The returned set is a new reference, and the caller is responsible for releasing it by calling \ref cardano_plutus_v2_script_set_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_plutus_v2_script_set_t* plutus_v2_scripts = cardano_witness_set_get_plutus_v2_scripts(witness_set);
+ *
+ * if (plutus_v2_scripts != NULL)
+ * {
+ *   // Process the Plutus V2 scripts
+ *
+ *   // Release the Plutus V2 scripts when done
+ *   cardano_plutus_v2_script_set_unref(&plutus_v2_scripts);
+ * }
+ * else
+ * {
+ *   printf("No Plutus V2 scripts found in the witness set.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_plutus_v2_script_set_t* cardano_witness_set_get_plutus_v2_scripts(
+  cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Sets the Plutus V2 scripts in a witness set.
+ *
+ * This function assigns a set of Plutus V2 scripts to the specified \ref cardano_witness_set_t object.
+ * If the Plutus scripts are set, they will be included in the witness set used for transaction validation.
+ *
+ * \param[in,out] witness_set A pointer to an initialized \ref cardano_witness_set_t object where the Plutus V2 scripts will be set.
+ * \param[in] plutus_scripts A pointer to an initialized \ref cardano_plutus_v2_script_set_t object representing the Plutus V2 scripts to be set.
+ *                           This parameter can be \c NULL to remove any existing Plutus V2 scripts from the witness set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the Plutus V2 scripts were
+ *         successfully set or removed, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_plutus_v2_script_set_t* plutus_scripts = ...; // Assume Plutus V2 scripts are initialized
+ *
+ * cardano_error_t result = cardano_witness_set_plutus_v2_scripts(witness_set, plutus_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Plutus V2 scripts set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Plutus V2 scripts.\n");
+ * }
+ *
+ * // You can also remove the Plutus V2 scripts by passing NULL:
+ * result = cardano_witness_set_plutus_v2_scripts(witness_set, NULL);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Plutus V2 scripts removed successfully.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_witness_set_set_plutus_v2_scripts(
+  cardano_witness_set_t*          witness_set,
+  cardano_plutus_v2_script_set_t* plutus_scripts);
+
+/**
+ * \brief Retrieves the Plutus V3 scripts from a witness set.
+ *
+ * This function fetches the set of Plutus V3 scripts, if any, associated with a given \ref cardano_witness_set_t object.
+ * Plutus scripts are smart contracts used in the Cardano blockchain, and the V3 scripts represent the first iteration of the Plutus language.
+ *
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object from which the Plutus V3 scripts will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_plutus_v3_script_set_t object representing the set of Plutus V3 scripts,
+ *         or \c NULL if no Plutus V3 scripts are present in the witness set.
+ *         The returned set is a new reference, and the caller is responsible for releasing it by calling \ref cardano_plutus_v3_script_set_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_plutus_v3_script_set_t* plutus_v3_scripts = cardano_witness_set_get_plutus_v3_scripts(witness_set);
+ *
+ * if (plutus_v3_scripts != NULL)
+ * {
+ *   // Process the Plutus V3 scripts
+ *
+ *   // Release the Plutus V3 scripts when done
+ *   cardano_plutus_v3_script_set_unref(&plutus_v3_scripts);
+ * }
+ * else
+ * {
+ *   printf("No Plutus V3 scripts found in the witness set.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_plutus_v3_script_set_t* cardano_witness_set_get_plutus_v3_scripts(
+  cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Sets the Plutus V3 scripts in a witness set.
+ *
+ * This function assigns a set of Plutus V3 scripts to the specified \ref cardano_witness_set_t object.
+ * If the Plutus scripts are set, they will be included in the witness set used for transaction validation.
+ *
+ * \param[in,out] witness_set A pointer to an initialized \ref cardano_witness_set_t object where the Plutus V3 scripts will be set.
+ * \param[in] plutus_scripts A pointer to an initialized \ref cardano_plutus_v3_script_set_t object representing the Plutus V3 scripts to be set.
+ *                           This parameter can be \c NULL to remove any existing Plutus V3 scripts from the witness set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the Plutus V3 scripts were
+ *         successfully set or removed, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_plutus_v3_script_set_t* plutus_scripts = ...; // Assume Plutus V3 scripts are initialized
+ *
+ * cardano_error_t result = cardano_witness_set_plutus_v3_scripts(witness_set, plutus_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Plutus V3 scripts set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Plutus V3 scripts.\n");
+ * }
+ *
+ * // You can also remove the Plutus V3 scripts by passing NULL:
+ * result = cardano_witness_set_plutus_v3_scripts(witness_set, NULL);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Plutus V3 scripts removed successfully.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_witness_set_set_plutus_v3_scripts(
+  cardano_witness_set_t*          witness_set,
+  cardano_plutus_v3_script_set_t* plutus_scripts);
+
+/**
+ * \brief Retrieves the Plutus V4 scripts from a witness set.
+ *
+ * This function fetches the set of Plutus V4 scripts, if any, associated with a given \ref cardano_witness_set_t object.
+ * Plutus V4 scripts are carried under key 8 of the witness set, which was introduced in the Dijkstra era.
+ *
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object from which the Plutus V4 scripts will be retrieved.
+ *
+ * \return A pointer to the \ref cardano_plutus_v4_script_set_t object representing the set of Plutus V4 scripts,
+ *         or \c NULL if no Plutus V4 scripts are present in the witness set.
+ *         The returned set is a new reference, and the caller is responsible for releasing it by calling \ref cardano_plutus_v4_script_set_unref
+ *         when it is no longer needed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_plutus_v4_script_set_t* plutus_v4_scripts = cardano_witness_set_get_plutus_v4_scripts(witness_set);
+ *
+ * if (plutus_v4_scripts != NULL)
+ * {
+ *   // Process the Plutus V4 scripts
+ *
+ *   // Release the Plutus V4 scripts when done
+ *   cardano_plutus_v4_script_set_unref(&plutus_v4_scripts);
+ * }
+ * else
+ * {
+ *   printf("No Plutus V4 scripts found in the witness set.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_plutus_v4_script_set_t* cardano_witness_set_get_plutus_v4_scripts(
+  cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Sets the Plutus V4 scripts in a witness set.
+ *
+ * This function assigns a set of Plutus V4 scripts to the specified \ref cardano_witness_set_t object.
+ * If the Plutus scripts are set, they will be included in the witness set used for transaction validation.
+ *
+ * \param[in,out] witness_set A pointer to an initialized \ref cardano_witness_set_t object where the Plutus V4 scripts will be set.
+ * \param[in] plutus_scripts A pointer to an initialized \ref cardano_plutus_v4_script_set_t object representing the Plutus V4 scripts to be set.
+ *                           This parameter can be \c NULL to remove any existing Plutus V4 scripts from the witness set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the Plutus V4 scripts were
+ *         successfully set or removed, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_plutus_v4_script_set_t* plutus_scripts = ...; // Assume Plutus V4 scripts are initialized
+ *
+ * cardano_error_t result = cardano_witness_set_plutus_v4_scripts(witness_set, plutus_scripts);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Plutus V4 scripts set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Plutus V4 scripts.\n");
+ * }
+ *
+ * // You can also remove the Plutus V4 scripts by passing NULL:
+ * result = cardano_witness_set_plutus_v4_scripts(witness_set, NULL);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Plutus V4 scripts removed successfully.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_witness_set_set_plutus_v4_scripts(
+  cardano_witness_set_t*          witness_set,
+  cardano_plutus_v4_script_set_t* plutus_scripts);
+
+/**
+ * \brief Retrieves the Plutus data from a witness set.
+ *
+ * This function retrieves the set of Plutus data associated with the specified \ref cardano_witness_set_t object.
+ * Plutus data is used in Plutus scripts to carry additional information during script execution.
+ *
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object from which the Plutus data is retrieved.
+ *
+ * \return A pointer to the \ref cardano_plutus_data_set_t object representing the Plutus data.
+ *         The returned pointer is a new reference, and the caller is responsible for managing its lifecycle by calling
+ *         \ref cardano_plutus_data_set_unref when it is no longer needed. If no Plutus data is set, this function returns \c NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_plutus_data_set_t* plutus_data = cardano_witness_set_get_plutus_data(witness_set);
+ *
+ * if (plutus_data != NULL)
+ * {
+ *   // Use the Plutus data
+ *
+ *   // Once done, ensure to clean up and release the Plutus data
+ *   cardano_plutus_data_set_unref(&plutus_data);
+ * }
+ * else
+ * {
+ *   printf("No Plutus data found in the witness set.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_plutus_data_set_t* cardano_witness_set_get_plutus_data(
+  cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Sets the Plutus data in a witness set.
+ *
+ * This function sets the Plutus data associated with the specified \ref cardano_witness_set_t object.
+ * Plutus data is used in Plutus scripts to carry additional information during script execution.
+ *
+ * \param[in,out] witness_set A pointer to an initialized \ref cardano_witness_set_t object where the Plutus data will be set.
+ * \param[in] plutus_data A pointer to an initialized \ref cardano_plutus_data_set_t object representing the Plutus data to be added.
+ *                        This parameter can be \c NULL to remove the Plutus data from the witness set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the Plutus data
+ *         was successfully set, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if the \p witness_set is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_plutus_data_set_t* plutus_data = ...; // Assume plutus_data is already initialized
+ *
+ * cardano_error_t result = cardano_witness_set_plutus_data(witness_set, plutus_data);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Plutus data set successfully in the witness set.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set Plutus data: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * // Clean up resources if necessary
+ * cardano_plutus_data_set_unref(&plutus_data);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_witness_set_set_plutus_data(
+  cardano_witness_set_t*     witness_set,
+  cardano_plutus_data_set_t* plutus_data);
+
+/**
+ * \brief Retrieves the list of redeemers from a witness set.
+ *
+ * This function fetches the redeemer list from the specified \ref cardano_witness_set_t object. Redeemers are used in Plutus scripts
+ * to provide the data necessary for validating script execution. A transaction can have multiple redeemers, each associated with a different Plutus script.
+ *
+ * \param[in] witness_set A pointer to an initialized \ref cardano_witness_set_t object.
+ *
+ * \return A pointer to the \ref cardano_redeemer_list_t object representing the list of redeemers. The caller is responsible for managing
+ *         the lifecycle of the returned list, including freeing it with \ref cardano_redeemer_list_unref when it is no longer needed.
+ *         If the witness set does not contain any redeemers, the function returns \c NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witness_set);
+ *
+ * if (redeemers != NULL)
+ * {
+ *   // Process the redeemers
+ *
+ *   // Ensure to release the redeemers once done
+ *   cardano_redeemer_list_unref(&redeemers);
+ * }
+ * else
+ * {
+ *   printf("No redeemers found in the witness set.\n");
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_redeemer_list_t* cardano_witness_set_get_redeemers(
+  cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Sets the list of redeemers in a witness set.
+ *
+ * This function assigns a list of redeemers to the specified \ref cardano_witness_set_t object. Redeemers are used
+ * in Plutus scripts to provide the necessary data for script validation. A transaction may have multiple redeemers
+ * associated with different Plutus scripts.
+ *
+ * \param[in,out] witness_set A pointer to an initialized \ref cardano_witness_set_t object.
+ * \param[in] redeemers A pointer to an initialized \ref cardano_redeemer_list_t object representing the list of redeemers.
+ *                      This can be set to \c NULL to remove the redeemers from the witness set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the redeemers
+ *         were successfully set, or an appropriate error code such as \ref CARDANO_ERROR_POINTER_IS_NULL if any required pointer is NULL.
+ *
+ * \note The caller retains ownership of the \p redeemers object. The function increases the reference count
+ *       for the provided redeemers. If \p redeemers is \c NULL, the redeemers field in the witness set will be cleared.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...; // Assume witness_set is already initialized
+ * cardano_redeemer_list_t* redeemers = ...; // Assume redeemers is already initialized
+ *
+ * cardano_error_t result = cardano_witness_set_redeemers(witness_set, redeemers);
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Redeemers set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to set redeemers.\n");
+ * }
+ *
+ * // If redeemers are no longer needed:
+ * cardano_redeemer_list_unref(&redeemers);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_witness_set_set_redeemers(
+  cardano_witness_set_t*   witness_set,
+  cardano_redeemer_list_t* redeemers);
+
+/**
+ * \brief Clears the cached CBOR representation from a witness_set.
+ *
+ * This function removes the internally cached CBOR data from a \ref cardano_witness_set_t object.
+ * It is useful when you have modified the witness_set after it was created from CBOR using
+ * \ref cardano_witness_set_from_cbor and you want to ensure that the next serialization reflects
+ * the current state of the witness_set, rather than using the original cached CBOR.
+ *
+ * \param[in,out] witness_set A pointer to an initialized \ref cardano_witness_set_t object
+ *                         from which the CBOR cache will be cleared.
+ *
+ * \warning Clearing the CBOR cache may change the binary representation of the witness_set when
+ *          serialized, which can alter the witness_set and invalidate any existing signatures.
+ *          Use this function with caution, especially if the transaction has already been signed or
+ *          if preserving the exact CBOR encoding is important for your application.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assume witness_set was created using cardano_witness_set_from_cbor
+ * cardano_witness_set_t* witness_set = ...;
+ *
+ * // Modify the witness_set as needed
+ *
+ * // Clear the CBOR cache to ensure serialization uses the updated witness_set
+ * cardano_witness_set_clear_cbor_cache(witness_set);
+ *
+ * // Serialize the witness_set to CBOR
+ * cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+ *
+ * result = cardano_witness_set_to_cbor(witness_set, writer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Process the CBOR data as needed
+ * }
+ * else
+ * {
+ *   const char* error_message = cardano_cbor_writer_get_last_error(writer);
+ *   printf("Serialization failed: %s\n", error_message);
+ * }
+ *
+ * // Clean up resources
+ * cardano_cbor_writer_unref(&writer);
+ * cardano_witness_set_unref(&witness_set);
+ * \endcode
+ */
+CARDANO_EXPORT void cardano_witness_set_clear_cbor_cache(cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Adds a script to the witness set of a transaction.
+ *
+ * This function incorporates a given script into the appropriate witness set within a transaction.
+ *
+ * \param[in,out] witness_set A pointer to the \ref cardano_witness_set_t to which the script will be added.
+ * \param[in]     script      A pointer to the \ref cardano_script_t to be added to the witness set.
+ *
+ * \return \ref CARDANO_SUCCESS if the script was successfully added, or an appropriate error code
+ *         indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if `witness_set`
+ *         or `script` is NULL, or \ref CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE if the script's language
+ *         is unsupported.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = ...;
+ * cardano_script_t* script = ...;
+ *
+ * cardano_error_t result = cardano_witness_add_script(witness_set, script);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   printf("Script added to witness set successfully.\n");
+ * }
+ * else
+ * {
+ *   printf("Failed to add script to witness set: %s\n", cardano_error_to_string(result));
+ * }
+ *
+ * cardano_witness_set_unref(&witness_set);
+ * cardano_script_unref(&script);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_witness_set_add_script(cardano_witness_set_t* witness_set, cardano_script_t* script);
+
+/**
+ * \brief Decrements the reference count of a cardano_witness_set_t object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_witness_set_t object
+ * by decreasing its reference count. When the reference count reaches zero, the witness_set is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] witness_set A pointer to the pointer of the witness_set object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_witness_set_t* witness_set = cardano_witness_set_new(major, minor);
+ *
+ * // Perform operations with the witness_set...
+ *
+ * cardano_witness_set_unref(&witness_set);
+ * // At this point, witness_set is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_witness_set_unref, the pointer to the \ref cardano_witness_set_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_witness_set_unref(cardano_witness_set_t** witness_set);
+
+/**
+ * \brief Increases the reference count of the cardano_witness_set_t object.
+ *
+ * This function is used to manually increment the reference count of an cardano_witness_set_t
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_witness_set_unref.
+ *
+ * \param witness_set A pointer to the cardano_witness_set_t object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming witness_set is a previously created witness_set object
+ *
+ * cardano_witness_set_ref(witness_set);
+ *
+ * // Now witness_set can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_witness_set_ref there is a corresponding
+ * call to \ref cardano_witness_set_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_witness_set_ref(cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_witness_set_t object.
+ *
+ * This function returns the number of active references to an cardano_witness_set_t object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_witness_set_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param witness_set A pointer to the cardano_witness_set_t object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified cardano_witness_set_t object. If the object
+ * is properly managed (i.e., every \ref cardano_witness_set_ref call is matched with a
+ * \ref cardano_witness_set_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming witness_set is a previously created witness_set object
+ *
+ * size_t ref_count = cardano_witness_set_refcount(witness_set);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_witness_set_refcount(const cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Sets the last error message for a given cardano_witness_set_t object.
+ *
+ * Records an error message in the witness_set's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] witness_set A pointer to the \ref cardano_witness_set_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the witness_set's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_witness_set_set_last_error(
+  cardano_witness_set_t* witness_set,
+  const char*            message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific witness_set.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_witness_set_set_last_error for the given
+ * witness_set. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] witness_set A pointer to the \ref cardano_witness_set_t instance whose last error
+ *                   message is to be retrieved. If the witness_set is NULL, the function
+ *                   returns a generic error message indicating the null witness_set.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified witness_set. If the witness_set is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_witness_set_set_last_error for the same witness_set, or until
+ *       the witness_set is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_witness_set_get_last_error(
+  const cardano_witness_set_t* witness_set);
+
+/**
+ * \brief Creates an independent deep copy of a \ref cardano_witness_set_t.
+ *
+ * Copies all owned children and preserves stored encoding and value state without
+ * serializing the object. Optional absent fields remain absent. The source is not
+ * modified and no mutable storage is shared with the result. Source graphs must
+ * be acyclic. The copy starts with one owned reference and an empty error message.
+ *
+ * \param[in] source The object to copy. Must not be \c NULL.
+ * \param[out] clone Receives the owned copy. Must not be \c NULL and must not
+ * overwrite an existing owned reference. Set to \c NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL
+ * for a null argument, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED when an
+ * allocation fails. Partial copies are released before returning an error.
+ *
+ * \note Release the result with \ref cardano_witness_set_unref.
+ */
+CARDANO_EXPORT cardano_error_t
+cardano_witness_set_deep_clone(const cardano_witness_set_t* source, cardano_witness_set_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_WITNESS_SET_H
diff --git a/vendor/src/address/address.c b/vendor/src/address/address.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/address.c
@@ -0,0 +1,733 @@
+/**
+ * \file address.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/address/address_type.h>
+#include <cardano/address/base_address.h>
+#include <cardano/address/byron_address.h>
+#include <cardano/address/enterprise_address.h>
+#include <cardano/address/pointer_address.h>
+#include <cardano/address/reward_address.h>
+#include <cardano/encoding/base58.h>
+#include <cardano/encoding/bech32.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+#include "./internals/addr_common.h"
+
+#include <string.h>
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_address_from_bytes(const byte_t* data, const size_t size, cardano_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const cardano_address_type_t type = (cardano_address_type_t)(data[0] >> 4);
+
+  switch (type)
+  {
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_KEY:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT:
+    {
+      cardano_base_address_t* base_address = NULL;
+      const cardano_error_t   result       = cardano_base_address_from_bytes(data, size, &base_address);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *address = _cardano_from_base_to_address(base_address);
+      return CARDANO_SUCCESS;
+    }
+    case CARDANO_ADDRESS_TYPE_BYRON:
+    {
+      cardano_byron_address_t* byron_address = NULL;
+      const cardano_error_t    result        = cardano_byron_address_from_bytes(data, size, &byron_address);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *address = _cardano_from_byron_to_address(byron_address);
+      return CARDANO_SUCCESS;
+    }
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_KEY:
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT:
+    {
+      cardano_enterprise_address_t* enterprise_address = NULL;
+      const cardano_error_t         result             = cardano_enterprise_address_from_bytes(data, size, &enterprise_address);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *address = _cardano_from_enterprise_to_address(enterprise_address);
+      return CARDANO_SUCCESS;
+    }
+    case CARDANO_ADDRESS_TYPE_REWARD_KEY:
+    case CARDANO_ADDRESS_TYPE_REWARD_SCRIPT:
+    {
+      cardano_reward_address_t* reward_address = NULL;
+      const cardano_error_t     result         = cardano_reward_address_from_bytes(data, size, &reward_address);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *address = _cardano_from_reward_to_address(reward_address);
+      return CARDANO_SUCCESS;
+    }
+    case CARDANO_ADDRESS_TYPE_POINTER_KEY:
+    case CARDANO_ADDRESS_TYPE_POINTER_SCRIPT:
+    {
+      cardano_pointer_address_t* pointer_address = NULL;
+      const cardano_error_t      result          = cardano_pointer_address_from_bytes(data, size, &pointer_address);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *address = _cardano_from_pointer_to_address(pointer_address);
+      return CARDANO_SUCCESS;
+    }
+    default:
+    {
+      return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+    }
+  }
+}
+
+size_t
+cardano_address_get_bytes_size(const cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return 0;
+  }
+
+  return address->address_data_size;
+}
+
+cardano_error_t
+cardano_address_to_bytes(const cardano_address_t* address, byte_t* data, const size_t size)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size < cardano_address_get_bytes_size(address))
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  cardano_safe_memcpy(data, size, address->address_data, address->address_data_size);
+
+  return CARDANO_SUCCESS;
+}
+
+const byte_t*
+cardano_address_get_bytes(const cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return NULL;
+  }
+
+  return address->address_data;
+}
+
+cardano_error_t
+cardano_address_from_string(const char* data, const size_t size, cardano_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (_cardano_has_valid_bech32_prefix(data, size))
+  {
+    size_t       hrp_size    = 0;
+    const size_t data_length = cardano_encoding_bech32_get_decoded_length(data, size, &hrp_size);
+
+    if ((hrp_size == 0U) || (data_length == 0U))
+    {
+      return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+    }
+
+    char* hrp = (char*)_cardano_malloc(hrp_size);
+
+    if (hrp == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    byte_t* decoded_data = (byte_t*)_cardano_malloc(data_length);
+
+    if (decoded_data == NULL)
+    {
+      _cardano_free(hrp);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    cardano_error_t result = cardano_encoding_bech32_decode(data, size, hrp, hrp_size, decoded_data, data_length);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      _cardano_free(hrp);
+      _cardano_free(decoded_data);
+
+      return result;
+    }
+
+    result = cardano_address_from_bytes(decoded_data, data_length, address);
+
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return result;
+  }
+
+  const size_t base58_data_length = cardano_encoding_base58_get_decoded_length(data, size);
+  byte_t*      decoded_data       = (byte_t*)_cardano_malloc(base58_data_length);
+
+  if (decoded_data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_encoding_base58_decode(data, size, decoded_data, base58_data_length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(decoded_data);
+
+    return result;
+  }
+
+  result = cardano_address_from_bytes(decoded_data, base58_data_length, address);
+
+  _cardano_free(decoded_data);
+
+  return result;
+}
+
+size_t
+cardano_address_get_string_size(const cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_safe_strlen(address->address_str, 1024) + 1U;
+}
+
+cardano_error_t
+cardano_address_to_string(const cardano_address_t* address, char* data, const size_t size)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  const size_t src_size = cardano_address_get_string_size(address);
+
+  if (size < cardano_address_get_string_size(address))
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  cardano_safe_memcpy(data, size, address->address_str, src_size);
+
+  return CARDANO_SUCCESS;
+}
+
+const char*
+cardano_address_get_string(const cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return NULL;
+  }
+
+  return address->address_str;
+}
+
+bool
+cardano_address_is_valid_bech32(const char* data, const size_t size)
+{
+  size_t       hrp_size    = 0;
+  const size_t data_length = cardano_encoding_bech32_get_decoded_length(data, size, &hrp_size);
+  char*        hrp         = (char*)_cardano_malloc(hrp_size);
+
+  if ((hrp_size == 0U) || (hrp == NULL))
+  {
+    _cardano_free(hrp);
+
+    return false;
+  }
+
+  byte_t* decoded_data = (byte_t*)_cardano_malloc(data_length);
+
+  if ((data_length == 0U) || (decoded_data == NULL))
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return false;
+  }
+
+  cardano_error_t result = cardano_encoding_bech32_decode(data, size, hrp, hrp_size, decoded_data, data_length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return false;
+  }
+
+  cardano_address_t* address = NULL;
+  result                     = cardano_address_from_bytes(decoded_data, data_length, &address);
+
+  _cardano_free(hrp);
+  _cardano_free(decoded_data);
+  cardano_address_unref(&address);
+
+  return result == CARDANO_SUCCESS;
+}
+
+bool
+cardano_address_is_valid_byron(const char* data, const size_t size)
+{
+  const size_t data_length  = cardano_encoding_base58_get_decoded_length(data, size);
+  byte_t*      decoded_data = (byte_t*)_cardano_malloc(data_length);
+
+  if (decoded_data == NULL)
+  {
+    return false;
+  }
+
+  cardano_error_t result = cardano_encoding_base58_decode(data, size, decoded_data, data_length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(decoded_data);
+
+    return false;
+  }
+
+  cardano_address_t* address = NULL;
+  result                     = cardano_address_from_bytes(decoded_data, data_length, &address);
+
+  cardano_address_unref(&address);
+  _cardano_free(decoded_data);
+
+  return result == CARDANO_SUCCESS;
+}
+
+bool
+cardano_address_is_valid(const char* data, const size_t size)
+{
+  if (data == NULL)
+  {
+    return false;
+  }
+
+  if (size == 0U)
+  {
+    return false;
+  }
+
+  if (_cardano_has_valid_bech32_prefix(data, size))
+  {
+    return cardano_address_is_valid_bech32(data, size);
+  }
+
+  return cardano_address_is_valid_byron(data, size);
+}
+
+cardano_error_t
+cardano_address_get_type(const cardano_address_t* address, cardano_address_type_t* type)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = address->type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_address_get_network_id(const cardano_address_t* address, cardano_network_id_t* network_id)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (network_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (address->type == CARDANO_ADDRESS_TYPE_BYRON)
+  {
+    if (address->byron_content == NULL)
+    {
+      return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+    }
+
+    if (address->byron_content->attributes.magic == -1)
+    {
+      *network_id = CARDANO_NETWORK_ID_MAIN_NET;
+      return CARDANO_SUCCESS;
+    }
+
+    *network_id = CARDANO_NETWORK_ID_TEST_NET;
+    return CARDANO_SUCCESS;
+  }
+
+  if (address->network_id == NULL)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  *network_id = *address->network_id;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_byron_address_t*
+cardano_address_to_byron_address(const cardano_address_t* address)
+{
+  cardano_byron_address_t* byron_address = NULL;
+  const cardano_error_t    result        = cardano_byron_address_from_address(address, &byron_address);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return byron_address;
+}
+
+cardano_reward_address_t*
+cardano_address_to_reward_address(const cardano_address_t* address)
+{
+  cardano_reward_address_t* reward_address = NULL;
+  const cardano_error_t     result         = cardano_reward_address_from_address(address, &reward_address);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return reward_address;
+}
+
+cardano_pointer_address_t*
+cardano_address_to_pointer_address(const cardano_address_t* address)
+{
+  cardano_pointer_address_t* pointer_address = NULL;
+  const cardano_error_t      result          = cardano_pointer_address_from_address(address, &pointer_address);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return pointer_address;
+}
+
+cardano_enterprise_address_t*
+cardano_address_to_enterprise_address(const cardano_address_t* address)
+{
+  cardano_enterprise_address_t* enterprise_address = NULL;
+  const cardano_error_t         result             = cardano_enterprise_address_from_address(address, &enterprise_address);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return enterprise_address;
+}
+
+cardano_base_address_t*
+cardano_address_to_base_address(const cardano_address_t* address)
+{
+  cardano_base_address_t* base_address = NULL;
+  const cardano_error_t   result       = cardano_base_address_from_address(address, &base_address);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return base_address;
+}
+
+bool
+cardano_address_equals(const cardano_address_t* lhs, const cardano_address_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return false;
+  }
+
+  if (lhs->address_data_size != rhs->address_data_size)
+  {
+    return false;
+  }
+
+  return memcmp(lhs->address_data, rhs->address_data, lhs->address_data_size) == 0;
+}
+
+void
+cardano_address_unref(cardano_address_t** address)
+{
+  if ((address == NULL) || (*address == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*address)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *address = NULL;
+    return;
+  }
+}
+
+void
+cardano_address_ref(cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&address->base);
+}
+
+size_t
+cardano_address_refcount(const cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&address->base);
+}
+
+void
+cardano_address_set_last_error(cardano_address_t* address, const char* message)
+{
+  cardano_object_set_last_error(&address->base, message);
+}
+
+const char*
+cardano_address_get_last_error(const cardano_address_t* address)
+{
+  return cardano_object_get_last_error(&address->base);
+}
+
+cardano_error_t
+cardano_address_deep_clone(const cardano_address_t* source, cardano_address_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_t* copy = _cardano_malloc(sizeof(cardano_address_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  CARDANO_UNUSED(memcpy(copy->address_str, source->address_str, sizeof(copy->address_str)));
+  CARDANO_UNUSED(memcpy(copy->address_data, source->address_data, sizeof(copy->address_data)));
+  copy->address_data_size  = source->address_data_size;
+  copy->network_id         = NULL;
+  copy->stake_pointer      = NULL;
+  copy->payment_credential = NULL;
+  copy->stake_credential   = NULL;
+  copy->byron_content      = NULL;
+
+  if (source->network_id != NULL)
+  {
+    const size_t size = sizeof(cardano_network_id_t);
+
+    copy->network_id = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->network_id == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->network_id, source->network_id, size));
+  }
+
+  if (source->stake_pointer != NULL)
+  {
+    const size_t size = sizeof(cardano_stake_pointer_t);
+
+    copy->stake_pointer = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->stake_pointer == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->stake_pointer, source->stake_pointer, size));
+  }
+
+  if (source->payment_credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->payment_credential, &copy->payment_credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->stake_credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->stake_credential, &copy->stake_credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->byron_content != NULL)
+  {
+    const size_t size = sizeof(cardano_byron_address_content_t);
+
+    copy->byron_content = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->byron_content == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->byron_content, source->byron_content, size));
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/address/base_address.c b/vendor/src/address/base_address.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/base_address.c
@@ -0,0 +1,416 @@
+/**
+ * \file base_address.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/address/base_address.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/encoding/bech32.h>
+#include <cardano/error.h>
+
+#include "../allocators.h"
+#include "./internals/addr_common.h"
+#include "./internals/base_addr_pack.h"
+
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t ADDRESS_HEADER_SIZE = 1;
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_base_address_from_credentials(
+  const cardano_network_id_t network_id,
+  cardano_credential_t*      payment,
+  cardano_credential_t*      stake,
+  cardano_base_address_t**   base_address)
+{
+  if (payment == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (base_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *base_address = NULL;
+
+  cardano_address_t* address = _cardano_malloc(sizeof(cardano_address_t));
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  address->base.ref_count     = 1;
+  address->base.last_error[0] = '\0';
+  address->base.deallocator   = _cardano_address_deallocate;
+
+  const cardano_error_t result = _cardano_get_base_address_type(payment, stake, &address->type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(address);
+    return result;
+  }
+
+  address->network_id = _cardano_malloc(sizeof(cardano_network_id_t));
+
+  if (address->network_id == NULL)
+  {
+    _cardano_free(address);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *address->network_id        = network_id;
+  address->payment_credential = payment;
+  address->stake_credential   = stake;
+  address->byron_content      = NULL;
+  address->stake_pointer      = NULL;
+  address->address_data_size  = ADDRESS_HEADER_SIZE + (2U * (size_t)CARDANO_BLAKE2B_HASH_SIZE_224);
+
+  _cardano_pack_base_address(address, address->address_data, sizeof(address->address_data));
+  cardano_credential_ref(payment);
+  cardano_credential_ref(stake);
+
+  const cardano_error_t encoding_result = _cardano_to_bech32_addr(
+    address->address_data,
+    address->address_data_size,
+    network_id,
+    address->type,
+    address->address_str,
+    1024);
+
+  if (encoding_result != CARDANO_SUCCESS)
+  {
+    _cardano_address_deallocate(address);
+    return encoding_result;
+  }
+
+  *base_address = _cardano_from_address_to_base(address);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_base_address_from_address(
+  const cardano_address_t* address,
+  cardano_base_address_t** base_address)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (base_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (
+    (address->type != CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_KEY) &&
+    (address->type != CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT) &&
+    (address->type != CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_SCRIPT) &&
+    (address->type != CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_TYPE;
+  }
+
+  cardano_address_t*    address_copy = NULL;
+  const cardano_error_t copy_result  = cardano_address_from_bytes(address->address_data, address->address_data_size, &address_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return copy_result;
+  }
+
+  *base_address = _cardano_from_address_to_base(address_copy);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_address_t*
+cardano_base_address_to_address(const cardano_base_address_t* base_address)
+{
+  if (base_address == NULL)
+  {
+    return NULL;
+  }
+
+  const cardano_address_t* address = _cardano_from_base_to_address_const(base_address);
+
+  cardano_address_t*    address_copy = NULL;
+  const cardano_error_t copy_result  = cardano_address_from_bytes(address->address_data, address->address_data_size, &address_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return address_copy;
+}
+
+cardano_credential_t*
+cardano_base_address_get_payment_credential(
+  cardano_base_address_t* base_address)
+{
+  if (base_address == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_address_t* address = _cardano_from_base_to_address(base_address);
+
+  cardano_credential_ref(address->payment_credential);
+
+  return address->payment_credential;
+}
+
+cardano_credential_t*
+cardano_base_address_get_stake_credential(
+  cardano_base_address_t* base_address)
+{
+  if (base_address == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_address_t* address = _cardano_from_base_to_address(base_address);
+
+  cardano_credential_ref(address->stake_credential);
+
+  return address->stake_credential;
+}
+
+cardano_error_t
+cardano_base_address_from_bytes(
+  const byte_t*            data,
+  const size_t             size,
+  cardano_base_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size < (ADDRESS_HEADER_SIZE + (2U * (size_t)CARDANO_BLAKE2B_HASH_SIZE_224)))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return _cardano_unpack_base_address(data, size, address);
+}
+
+size_t
+cardano_base_address_get_bytes_size(const cardano_base_address_t* address)
+{
+  return cardano_address_get_bytes_size(_cardano_from_base_to_address_const(address));
+}
+
+const byte_t*
+cardano_base_address_get_bytes(const cardano_base_address_t* address)
+{
+  return cardano_address_get_bytes(_cardano_from_base_to_address_const(address));
+}
+
+cardano_error_t
+cardano_base_address_to_bytes(
+  const cardano_base_address_t* address,
+  byte_t*                       data,
+  const size_t                  size)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size < (ADDRESS_HEADER_SIZE + (2U * (size_t)CARDANO_BLAKE2B_HASH_SIZE_224)))
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  return cardano_address_to_bytes(_cardano_from_base_to_address_const(address), data, size);
+}
+
+cardano_error_t
+cardano_base_address_from_bech32(
+  const char*              data,
+  const size_t             size,
+  cardano_base_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t       hrp_size  = 0;
+  const size_t data_size = cardano_encoding_bech32_get_decoded_length(data, size, &hrp_size);
+
+  if (data_size < (ADDRESS_HEADER_SIZE + (2U * (size_t)CARDANO_BLAKE2B_HASH_SIZE_224)))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  char* hrp = _cardano_malloc(hrp_size);
+
+  if (hrp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  byte_t* decoded_data = _cardano_malloc(data_size);
+
+  if (decoded_data == NULL)
+  {
+    _cardano_free(hrp);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t decode_result = cardano_encoding_bech32_decode(data, size, hrp, hrp_size, decoded_data, data_size);
+
+  if (decode_result != CARDANO_SUCCESS)
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return decode_result;
+  }
+
+  if (!_cardano_is_valid_payment_address_prefix(hrp, hrp_size))
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  const cardano_error_t unpack_result = _cardano_unpack_base_address(decoded_data, data_size, address);
+
+  _cardano_free(hrp);
+  _cardano_free(decoded_data);
+
+  return unpack_result;
+}
+
+size_t
+cardano_base_address_get_bech32_size(const cardano_base_address_t* address)
+{
+  return cardano_address_get_string_size(_cardano_from_base_to_address_const(address));
+}
+
+cardano_error_t
+cardano_base_address_to_bech32(
+  const cardano_base_address_t* address,
+  char*                         data,
+  const size_t                  size)
+{
+  return cardano_address_to_string(_cardano_from_base_to_address_const(address), data, size);
+}
+
+const char*
+cardano_base_address_get_string(const cardano_base_address_t* address)
+{
+  return cardano_address_get_string(_cardano_from_base_to_address_const(address));
+}
+
+cardano_error_t
+cardano_base_address_get_network_id(const cardano_base_address_t* address, cardano_network_id_t* network_id)
+{
+  return cardano_address_get_network_id(_cardano_from_base_to_address_const(address), network_id);
+}
+
+void
+cardano_base_address_unref(cardano_base_address_t** address)
+{
+  cardano_address_unref(_cardano_from_base_pointer_to_address_pointer(address));
+}
+
+void
+cardano_base_address_ref(cardano_base_address_t* address)
+{
+  cardano_address_ref(_cardano_from_base_to_address(address));
+}
+
+size_t
+cardano_base_address_refcount(const cardano_base_address_t* address)
+{
+  return cardano_address_refcount(_cardano_from_base_to_address_const(address));
+}
+
+void
+cardano_base_address_set_last_error(cardano_base_address_t* address, const char* message)
+{
+  cardano_address_set_last_error(_cardano_from_base_to_address(address), message);
+}
+
+const char*
+cardano_base_address_get_last_error(const cardano_base_address_t* address)
+{
+  return cardano_address_get_last_error(_cardano_from_base_to_address_const(address));
+}
+
+cardano_error_t
+cardano_base_address_deep_clone(const cardano_base_address_t* source, cardano_base_address_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone                       = NULL;
+  cardano_address_t*    copy   = NULL;
+  const cardano_error_t result = cardano_address_deep_clone((const cardano_address_t*)((const void*)source), &copy);
+
+  *clone = (cardano_base_address_t*)((void*)copy);
+
+  return result;
+}
diff --git a/vendor/src/address/byron_address.c b/vendor/src/address/byron_address.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/byron_address.c
@@ -0,0 +1,397 @@
+/**
+ * \file byron_address.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/address/byron_address.h>
+#include <cardano/encoding/base58.h>
+#include <cardano/error.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+#include "./internals/addr_common.h"
+#include "./internals/byron_addr_pack.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_byron_address_from_credentials(
+  cardano_blake2b_hash_t*                  root,
+  const cardano_byron_address_attributes_t attributes,
+  const cardano_byron_address_type_t       type,
+  cardano_byron_address_t**                byron_address)
+{
+  if (root == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (byron_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_t* address = _cardano_malloc(sizeof(cardano_address_t));
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  address->byron_content = _cardano_malloc(sizeof(cardano_byron_address_content_t));
+
+  if (address->byron_content == NULL)
+  {
+    _cardano_free(address);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  address->base.ref_count            = 1;
+  address->base.last_error[0]        = '\0';
+  address->base.deallocator          = _cardano_address_deallocate;
+  address->type                      = CARDANO_ADDRESS_TYPE_BYRON;
+  address->network_id                = NULL;
+  address->payment_credential        = NULL;
+  address->stake_credential          = NULL;
+  address->stake_pointer             = NULL;
+  address->address_data_size         = 0;
+  address->byron_content->attributes = attributes;
+  address->byron_content->type       = type;
+
+  cardano_safe_memcpy(
+    address->byron_content->root,
+    sizeof(address->byron_content->root),
+    cardano_blake2b_hash_get_data(root),
+    sizeof(address->byron_content->root));
+
+  const cardano_error_t packing_result = _cardano_pack_byron_address(address, address->address_data, sizeof(address->address_data), &address->address_data_size);
+
+  if (packing_result != CARDANO_SUCCESS)
+  {
+    _cardano_address_deallocate(address);
+    return packing_result;
+  }
+
+  const cardano_error_t encoding_result = cardano_encoding_base58_encode(address->address_data, address->address_data_size, address->address_str, sizeof(address->address_str));
+
+  if (encoding_result != CARDANO_SUCCESS)
+  {
+    _cardano_address_deallocate(address);
+    return encoding_result;
+  }
+
+  *byron_address = _cardano_from_address_to_byron(address);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_byron_address_from_address(
+  const cardano_address_t*  address,
+  cardano_byron_address_t** byron_address)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (byron_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (address->type != CARDANO_ADDRESS_TYPE_BYRON)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_TYPE;
+  }
+
+  cardano_address_t*    address_copy = NULL;
+  const cardano_error_t copy_result  = cardano_address_from_bytes(address->address_data, address->address_data_size, &address_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return copy_result;
+  }
+
+  *byron_address = _cardano_from_address_to_byron(address_copy);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_address_t*
+cardano_byron_address_to_address(const cardano_byron_address_t* byron_address)
+{
+  if (byron_address == NULL)
+  {
+    return NULL;
+  }
+
+  const cardano_address_t* address = _cardano_from_byron_to_address_const(byron_address);
+
+  cardano_address_t*    address_copy = NULL;
+  const cardano_error_t copy_result  = cardano_address_from_bytes(address->address_data, address->address_data_size, &address_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return address_copy;
+}
+
+cardano_error_t
+cardano_byron_address_get_attributes(
+  const cardano_byron_address_t*      address,
+  cardano_byron_address_attributes_t* attributes)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const cardano_address_t* addr = _cardano_from_byron_to_address_const(address);
+
+  assert(addr->type == CARDANO_ADDRESS_TYPE_BYRON);
+  assert(addr->byron_content != NULL);
+
+  *attributes = addr->byron_content->attributes;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_byron_address_get_type(
+  const cardano_byron_address_t* address,
+  cardano_byron_address_type_t*  type)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const cardano_address_t* addr = _cardano_from_byron_to_address_const(address);
+
+  assert(addr->type == CARDANO_ADDRESS_TYPE_BYRON);
+  assert(addr->byron_content != NULL);
+
+  *type = addr->byron_content->type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_byron_address_get_root(
+  const cardano_byron_address_t* address,
+  cardano_blake2b_hash_t**       root)
+{
+  if (address == NULL)
+  {
+    *root = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const cardano_address_t* addr = _cardano_from_byron_to_address_const(address);
+
+  assert(addr->type == CARDANO_ADDRESS_TYPE_BYRON);
+  assert(addr->byron_content != NULL);
+
+  const cardano_error_t error = cardano_blake2b_hash_from_bytes(addr->byron_content->root, sizeof(addr->byron_content->root), root);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    *root = NULL;
+    return error;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_byron_address_from_bytes(
+  const byte_t*             data,
+  size_t                    size,
+  cardano_byron_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return _cardano_unpack_byron_address(data, size, address);
+}
+
+size_t
+cardano_byron_address_get_bytes_size(const cardano_byron_address_t* address)
+{
+  return cardano_address_get_bytes_size(_cardano_from_byron_to_address_const(address));
+}
+
+const byte_t*
+cardano_byron_address_get_bytes(const cardano_byron_address_t* address)
+{
+  return cardano_address_get_bytes(_cardano_from_byron_to_address_const(address));
+}
+
+cardano_error_t
+cardano_byron_address_to_bytes(
+  const cardano_byron_address_t* address,
+  byte_t*                        data,
+  size_t                         size)
+{
+  return cardano_address_to_bytes(_cardano_from_byron_to_address_const(address), data, size);
+}
+
+cardano_error_t
+cardano_byron_address_from_base58(
+  const char*               data,
+  size_t                    size,
+  cardano_byron_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t data_size   = cardano_encoding_base58_get_decoded_length(data, size);
+  byte_t*      data_buffer = _cardano_malloc(data_size);
+
+  if (data_buffer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t unpack_result = cardano_encoding_base58_decode(data, size, data_buffer, data_size);
+
+  if (unpack_result != CARDANO_SUCCESS)
+  {
+    _cardano_free(data_buffer);
+    return unpack_result;
+  }
+
+  const cardano_error_t result = cardano_byron_address_from_bytes(data_buffer, data_size, address);
+
+  _cardano_free(data_buffer);
+
+  return result;
+}
+
+size_t
+cardano_byron_address_get_base58_size(const cardano_byron_address_t* address)
+{
+  return cardano_address_get_string_size(_cardano_from_byron_to_address_const(address));
+}
+
+cardano_error_t
+cardano_byron_address_to_base58(
+  const cardano_byron_address_t* address,
+  char*                          data,
+  size_t                         size)
+{
+  const char*  base58      = cardano_byron_address_get_string(address);
+  const size_t base58_size = cardano_byron_address_get_base58_size(address);
+
+  if (size < base58_size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  cardano_safe_memcpy(data, size, base58, base58_size);
+
+  return CARDANO_SUCCESS;
+}
+
+const char*
+cardano_byron_address_get_string(const cardano_byron_address_t* address)
+{
+  return cardano_address_get_string(_cardano_from_byron_to_address_const(address));
+}
+
+cardano_error_t
+cardano_byron_address_get_network_id(const cardano_byron_address_t* address, cardano_network_id_t* network_id)
+{
+  return cardano_address_get_network_id(_cardano_from_byron_to_address_const(address), network_id);
+}
+
+void
+cardano_byron_address_unref(cardano_byron_address_t** address)
+{
+  cardano_address_unref(_cardano_from_byron_pointer_to_address_pointer(address));
+}
+
+void
+cardano_byron_address_ref(cardano_byron_address_t* address)
+{
+  cardano_address_ref(_cardano_from_byron_to_address(address));
+}
+
+size_t
+cardano_byron_address_refcount(const cardano_byron_address_t* address)
+{
+  return cardano_address_refcount(_cardano_from_byron_to_address_const(address));
+}
+
+void
+cardano_byron_address_set_last_error(cardano_byron_address_t* address, const char* message)
+{
+  cardano_address_set_last_error(_cardano_from_byron_to_address(address), message);
+}
+
+const char*
+cardano_byron_address_get_last_error(const cardano_byron_address_t* address)
+{
+  return cardano_address_get_last_error(_cardano_from_byron_to_address_const(address));
+}
+
+cardano_error_t
+cardano_byron_address_deep_clone(const cardano_byron_address_t* source, cardano_byron_address_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone                       = NULL;
+  cardano_address_t*    copy   = NULL;
+  const cardano_error_t result = cardano_address_deep_clone((const cardano_address_t*)((const void*)source), &copy);
+
+  *clone = (cardano_byron_address_t*)((void*)copy);
+
+  return result;
+}
diff --git a/vendor/src/address/enterprise_address.c b/vendor/src/address/enterprise_address.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/enterprise_address.c
@@ -0,0 +1,380 @@
+/**
+ * \file enterprise_address.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/address/enterprise_address.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/encoding/bech32.h>
+#include <cardano/error.h>
+
+#include "../allocators.h"
+#include "./internals/addr_common.h"
+#include "./internals/enterprise_addr_pack.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t ADDRESS_HEADER_SIZE = 1;
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_enterprise_address_from_credentials(
+  const cardano_network_id_t     network_id,
+  cardano_credential_t*          payment,
+  cardano_enterprise_address_t** enterprise_address)
+{
+  if (payment == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (enterprise_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *enterprise_address = NULL;
+
+  cardano_address_t* address = _cardano_malloc(sizeof(cardano_address_t));
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  address->base.ref_count     = 1;
+  address->base.last_error[0] = '\0';
+  address->base.deallocator   = _cardano_address_deallocate;
+
+  cardano_credential_type_t credential_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+
+  const cardano_error_t get_type_result = cardano_credential_get_type(payment, &credential_type);
+  assert(get_type_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(get_type_result);
+
+  address->type =
+    (credential_type == CARDANO_CREDENTIAL_TYPE_KEY_HASH)
+    ? CARDANO_ADDRESS_TYPE_ENTERPRISE_KEY
+    : CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT;
+
+  address->network_id = _cardano_malloc(sizeof(cardano_network_id_t));
+
+  if (address->network_id == NULL)
+  {
+    _cardano_free(address);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *address->network_id        = network_id;
+  address->payment_credential = payment;
+  address->stake_credential   = NULL;
+  address->byron_content      = NULL;
+  address->stake_pointer      = NULL;
+  address->address_data_size  = ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224;
+
+  _cardano_pack_enterprise_address(address, address->address_data, sizeof(address->address_data));
+  cardano_credential_ref(payment);
+
+  const cardano_error_t encoding_result = _cardano_to_bech32_addr(
+    address->address_data,
+    address->address_data_size,
+    network_id,
+    address->type,
+    address->address_str,
+    1024);
+
+  if (encoding_result != CARDANO_SUCCESS)
+  {
+    _cardano_address_deallocate(address);
+    return encoding_result;
+  }
+
+  *enterprise_address = _cardano_from_address_to_enterprise(address);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_enterprise_address_from_address(
+  const cardano_address_t*       address,
+  cardano_enterprise_address_t** enterprise_address)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (enterprise_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (
+    (address->type != CARDANO_ADDRESS_TYPE_ENTERPRISE_KEY) &&
+    (address->type != CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_TYPE;
+  }
+
+  cardano_address_t*    address_copy = NULL;
+  const cardano_error_t copy_result  = cardano_address_from_bytes(address->address_data, address->address_data_size, &address_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return copy_result;
+  }
+
+  *enterprise_address = _cardano_from_address_to_enterprise(address_copy);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_address_t*
+cardano_enterprise_address_to_address(const cardano_enterprise_address_t* enterprise_address)
+{
+  if (enterprise_address == NULL)
+  {
+    return NULL;
+  }
+
+  const cardano_address_t* address = _cardano_from_enterprise_to_address_const(enterprise_address);
+
+  cardano_address_t*    address_copy = NULL;
+  const cardano_error_t copy_result  = cardano_address_from_bytes(address->address_data, address->address_data_size, &address_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return address_copy;
+}
+
+cardano_credential_t*
+cardano_enterprise_address_get_payment_credential(
+  cardano_enterprise_address_t* enterprise_address)
+{
+  if (enterprise_address == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_address_t* address = _cardano_from_enterprise_to_address(enterprise_address);
+
+  cardano_credential_ref(address->payment_credential);
+
+  return address->payment_credential;
+}
+
+cardano_error_t
+cardano_enterprise_address_from_bytes(
+  const byte_t*                  data,
+  const size_t                   size,
+  cardano_enterprise_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size < (ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return _cardano_unpack_enterprise_address(data, size, address);
+}
+
+size_t
+cardano_enterprise_address_get_bytes_size(const cardano_enterprise_address_t* address)
+{
+  return cardano_address_get_bytes_size(_cardano_from_enterprise_to_address_const(address));
+}
+
+const byte_t*
+cardano_enterprise_address_get_bytes(const cardano_enterprise_address_t* address)
+{
+  return cardano_address_get_bytes(_cardano_from_enterprise_to_address_const(address));
+}
+
+cardano_error_t
+cardano_enterprise_address_to_bytes(
+  const cardano_enterprise_address_t* address,
+  byte_t*                             data,
+  const size_t                        size)
+{
+  return cardano_address_to_bytes(_cardano_from_enterprise_to_address_const(address), data, size);
+}
+
+cardano_error_t
+cardano_enterprise_address_from_bech32(
+  const char*                    data,
+  const size_t                   size,
+  cardano_enterprise_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t       hrp_size  = 0;
+  const size_t data_size = cardano_encoding_bech32_get_decoded_length(data, size, &hrp_size);
+
+  if (data_size < (ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  char* hrp = _cardano_malloc(hrp_size);
+
+  if (hrp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  byte_t* decoded_data = _cardano_malloc(data_size);
+
+  if (decoded_data == NULL)
+  {
+    _cardano_free(hrp);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t decode_result = cardano_encoding_bech32_decode(data, size, hrp, hrp_size, decoded_data, data_size);
+
+  if (decode_result != CARDANO_SUCCESS)
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return decode_result;
+  }
+
+  if (!_cardano_is_valid_payment_address_prefix(hrp, hrp_size))
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  const cardano_error_t unpack_result = _cardano_unpack_enterprise_address(decoded_data, data_size, address);
+
+  _cardano_free(hrp);
+  _cardano_free(decoded_data);
+
+  return unpack_result;
+}
+
+size_t
+cardano_enterprise_address_get_bech32_size(const cardano_enterprise_address_t* address)
+{
+  return cardano_address_get_string_size(_cardano_from_enterprise_to_address_const(address));
+}
+
+cardano_error_t
+cardano_enterprise_address_to_bech32(
+  const cardano_enterprise_address_t* address,
+  char*                               data,
+  const size_t                        size)
+{
+  return cardano_address_to_string(_cardano_from_enterprise_to_address_const(address), data, size);
+}
+
+const char*
+cardano_enterprise_address_get_string(const cardano_enterprise_address_t* address)
+{
+  return cardano_address_get_string(_cardano_from_enterprise_to_address_const(address));
+}
+
+cardano_error_t
+cardano_enterprise_address_get_network_id(const cardano_enterprise_address_t* address, cardano_network_id_t* network_id)
+{
+  return cardano_address_get_network_id(_cardano_from_enterprise_to_address_const(address), network_id);
+}
+
+void
+cardano_enterprise_address_unref(cardano_enterprise_address_t** address)
+{
+  cardano_address_unref(_cardano_from_enterprise_pointer_to_address_pointer(address));
+}
+
+void
+cardano_enterprise_address_ref(cardano_enterprise_address_t* address)
+{
+  cardano_address_ref(_cardano_from_enterprise_to_address(address));
+}
+
+size_t
+cardano_enterprise_address_refcount(const cardano_enterprise_address_t* address)
+{
+  return cardano_address_refcount(_cardano_from_enterprise_to_address_const(address));
+}
+
+void
+cardano_enterprise_address_set_last_error(cardano_enterprise_address_t* address, const char* message)
+{
+  cardano_address_set_last_error(_cardano_from_enterprise_to_address(address), message);
+}
+
+const char*
+cardano_enterprise_address_get_last_error(const cardano_enterprise_address_t* address)
+{
+  return cardano_address_get_last_error(_cardano_from_enterprise_to_address_const(address));
+}
+
+cardano_error_t
+cardano_enterprise_address_deep_clone(const cardano_enterprise_address_t* source, cardano_enterprise_address_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone                       = NULL;
+  cardano_address_t*    copy   = NULL;
+  const cardano_error_t result = cardano_address_deep_clone((const cardano_address_t*)((const void*)source), &copy);
+
+  *clone = (cardano_enterprise_address_t*)((void*)copy);
+
+  return result;
+}
diff --git a/vendor/src/address/internals/addr_common.c b/vendor/src/address/internals/addr_common.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/addr_common.c
@@ -0,0 +1,408 @@
+/**
+ * \file addr_common.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/encoding/bech32.h>
+
+#include "../../allocators.h"
+#include "addr_common.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const char* BECH32_PREFIX_MAINNET       = "addr";
+static const char* BECH32_PREFIX_TESTNET       = "addr_test";
+static const char* BECH32_PREFIX_STAKE_MAINNET = "stake";
+static const char* BECH32_PREFIX_STAKE_TESTNET = "stake_test";
+
+static const size_t BECH32_PREFIX_LENGTH               = 4;
+static const size_t BECH32_PREFIX_STAKE_LENGTH         = 5;
+static const size_t BECH32_PREFIX_TESTNET_LENGTH       = 9;
+static const size_t BECH32_PREFIX_STAKE_TESTNET_LENGTH = 10;
+
+/* IMPLEMENTATION ************************************************************/
+
+const char*
+_cardano_get_bech32_prefix(const cardano_address_type_t type, const cardano_network_id_t network_id, size_t* size)
+{
+  const char* prefix = NULL;
+
+  switch (type)
+  {
+    case CARDANO_ADDRESS_TYPE_REWARD_KEY:
+    case CARDANO_ADDRESS_TYPE_REWARD_SCRIPT:
+      if (network_id == CARDANO_NETWORK_ID_MAIN_NET)
+      {
+        prefix = BECH32_PREFIX_STAKE_MAINNET;
+        *size  = BECH32_PREFIX_STAKE_LENGTH;
+      }
+      else
+      {
+        prefix = BECH32_PREFIX_STAKE_TESTNET;
+        *size  = BECH32_PREFIX_STAKE_TESTNET_LENGTH;
+      }
+      break;
+    case CARDANO_ADDRESS_TYPE_POINTER_KEY:
+    case CARDANO_ADDRESS_TYPE_POINTER_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_KEY:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_KEY:
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_BYRON:
+    default:
+      if (network_id == CARDANO_NETWORK_ID_MAIN_NET)
+      {
+        prefix = BECH32_PREFIX_MAINNET;
+        *size  = BECH32_PREFIX_LENGTH;
+      }
+      else
+      {
+        prefix = BECH32_PREFIX_TESTNET;
+        *size  = BECH32_PREFIX_TESTNET_LENGTH;
+      }
+      break;
+  }
+
+  return prefix;
+}
+
+bool
+_cardano_has_valid_bech32_prefix(const char* address, size_t length)
+{
+  assert(address != NULL);
+
+  return _cardano_is_valid_payment_address_prefix(address, length) ||
+    _cardano_is_valid_stake_address_prefix(address, length);
+}
+
+cardano_address_t*
+_cardano_from_base_to_address(cardano_base_address_t* base_address)
+{
+  return (cardano_address_t*)((void*)base_address);
+}
+
+cardano_address_t**
+_cardano_from_base_pointer_to_address_pointer(cardano_base_address_t** base_address)
+{
+  return (cardano_address_t**)((void**)base_address);
+}
+
+const cardano_address_t*
+_cardano_from_base_to_address_const(const cardano_base_address_t* base_address)
+{
+  return (const cardano_address_t*)((const void*)base_address);
+}
+
+cardano_base_address_t*
+_cardano_from_address_to_base(cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return NULL;
+  }
+
+  assert(
+    (address->type == CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_KEY) ||
+    (address->type == CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_SCRIPT) ||
+    (address->type == CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY) ||
+    (address->type == CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT));
+
+  return (cardano_base_address_t*)((void*)address);
+}
+
+cardano_address_t*
+_cardano_from_enterprise_to_address(cardano_enterprise_address_t* enterprise_address)
+{
+  return (cardano_address_t*)((void*)enterprise_address);
+}
+
+cardano_address_t**
+_cardano_from_enterprise_pointer_to_address_pointer(cardano_enterprise_address_t** enterprise_address)
+{
+  return (cardano_address_t**)((void**)enterprise_address);
+}
+
+const cardano_address_t*
+_cardano_from_enterprise_to_address_const(const cardano_enterprise_address_t* enterprise_address)
+{
+  return (const cardano_address_t*)((const void*)enterprise_address);
+}
+
+cardano_enterprise_address_t*
+_cardano_from_address_to_enterprise(cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return NULL;
+  }
+
+  assert(
+    (address->type == CARDANO_ADDRESS_TYPE_ENTERPRISE_KEY) ||
+    (address->type == CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT));
+
+  return (cardano_enterprise_address_t*)((void*)address);
+}
+
+cardano_address_t*
+_cardano_from_pointer_to_address(cardano_pointer_address_t* pointer_address)
+{
+  return (cardano_address_t*)((void*)pointer_address);
+}
+
+cardano_address_t**
+_cardano_from_pointer_pointer_to_address_pointer(cardano_pointer_address_t** pointer_address)
+{
+  return (cardano_address_t**)((void**)pointer_address);
+}
+
+const cardano_address_t*
+_cardano_from_pointer_to_address_const(const cardano_pointer_address_t* pointer_address)
+{
+  return (const cardano_address_t*)((const void*)pointer_address);
+}
+
+cardano_pointer_address_t*
+_cardano_from_address_to_pointer(cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return NULL;
+  }
+
+  assert(
+    (address->type == CARDANO_ADDRESS_TYPE_POINTER_KEY) ||
+    (address->type == CARDANO_ADDRESS_TYPE_POINTER_SCRIPT));
+
+  return (cardano_pointer_address_t*)((void*)address);
+}
+
+cardano_address_t*
+_cardano_from_reward_to_address(cardano_reward_address_t* reward_address)
+{
+  return (cardano_address_t*)((void*)reward_address);
+}
+
+cardano_address_t**
+_cardano_from_reward_pointer_to_address_pointer(cardano_reward_address_t** reward_address)
+{
+  return (cardano_address_t**)((void**)reward_address);
+}
+
+const cardano_address_t*
+_cardano_from_reward_to_address_const(const cardano_reward_address_t* reward_address)
+{
+  return (const cardano_address_t*)((const void*)reward_address);
+}
+
+cardano_reward_address_t*
+_cardano_from_address_to_reward(cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return NULL;
+  }
+
+  assert(
+    (address->type == CARDANO_ADDRESS_TYPE_REWARD_KEY) ||
+    (address->type == CARDANO_ADDRESS_TYPE_REWARD_SCRIPT));
+
+  return (cardano_reward_address_t*)((void*)address);
+}
+
+cardano_address_t*
+_cardano_from_byron_to_address(cardano_byron_address_t* byron_address)
+{
+  return (cardano_address_t*)((void*)byron_address);
+}
+
+cardano_address_t**
+_cardano_from_byron_pointer_to_address_pointer(cardano_byron_address_t** byron_address)
+{
+  return (cardano_address_t**)((void**)byron_address);
+}
+
+const cardano_address_t*
+_cardano_from_byron_to_address_const(const cardano_byron_address_t* byron_address)
+{
+  return (const cardano_address_t*)((const void*)byron_address);
+}
+
+cardano_byron_address_t*
+_cardano_from_address_to_byron(cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return NULL;
+  }
+
+  assert(address->type == CARDANO_ADDRESS_TYPE_BYRON);
+
+  return (cardano_byron_address_t*)((void*)address);
+}
+
+cardano_error_t
+_cardano_get_payment_credential_type(const cardano_address_type_t type, cardano_credential_type_t* credential_type)
+{
+  assert(credential_type != NULL);
+
+  switch (type)
+  {
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_KEY:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_POINTER_KEY:
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_KEY:
+    case CARDANO_ADDRESS_TYPE_REWARD_KEY:
+      *credential_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+      break;
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_POINTER_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_REWARD_SCRIPT:
+      *credential_type = CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH;
+      break;
+    case CARDANO_ADDRESS_TYPE_BYRON:
+    default:
+      return CARDANO_ERROR_INVALID_ADDRESS_TYPE;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_get_stake_credential_type(cardano_address_type_t type, cardano_credential_type_t* credential_type)
+{
+  assert(credential_type != NULL);
+
+  switch (type)
+  {
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_KEY:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY:
+      *credential_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+      break;
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT:
+      *credential_type = CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH;
+      break;
+    case CARDANO_ADDRESS_TYPE_POINTER_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_REWARD_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_POINTER_KEY:
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_KEY:
+    case CARDANO_ADDRESS_TYPE_REWARD_KEY:
+    case CARDANO_ADDRESS_TYPE_BYRON:
+    default:
+      return CARDANO_ERROR_INVALID_ADDRESS_TYPE;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+_cardano_is_valid_payment_address_prefix(const char* address, size_t length)
+{
+  if (address == NULL)
+  {
+    return false;
+  }
+
+  return ((length >= BECH32_PREFIX_LENGTH) && (strncmp(address, BECH32_PREFIX_MAINNET, BECH32_PREFIX_LENGTH) == 0)) ||
+    ((length >= BECH32_PREFIX_TESTNET_LENGTH) && (strncmp(address, BECH32_PREFIX_TESTNET, BECH32_PREFIX_TESTNET_LENGTH) == 0));
+}
+
+bool
+_cardano_is_valid_stake_address_prefix(const char* address, size_t length)
+{
+  if (address == NULL)
+  {
+    return false;
+  }
+
+  return ((length >= BECH32_PREFIX_STAKE_LENGTH) && (strncmp(address, BECH32_PREFIX_STAKE_MAINNET, BECH32_PREFIX_STAKE_LENGTH) == 0)) ||
+    ((length >= BECH32_PREFIX_STAKE_TESTNET_LENGTH) && (strncmp(address, BECH32_PREFIX_STAKE_TESTNET, BECH32_PREFIX_STAKE_TESTNET_LENGTH) == 0));
+}
+
+cardano_error_t
+_cardano_to_bech32_addr(
+  const byte_t*          data,
+  size_t                 data_size,
+  cardano_network_id_t   network_id,
+  cardano_address_type_t type,
+  char*                  address,
+  size_t                 address_size)
+{
+  assert(data != NULL);
+  assert(address != NULL);
+
+  size_t      hrp_size = 0U;
+  const char* hrp      = _cardano_get_bech32_prefix(type, network_id, &hrp_size);
+  size_t      size     = cardano_encoding_bech32_get_encoded_length(hrp, hrp_size, data, data_size);
+
+  if (size > address_size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  return cardano_encoding_bech32_encode(hrp, hrp_size, data, data_size, address, address_size);
+}
+
+void
+_cardano_address_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_address_t* address = (cardano_address_t*)object;
+
+  if (address->network_id != NULL)
+  {
+    _cardano_free(address->network_id);
+    address->network_id = NULL;
+  }
+
+  if (address->stake_pointer != NULL)
+  {
+    _cardano_free(address->stake_pointer);
+    address->stake_pointer = NULL;
+  }
+
+  if (address->payment_credential != NULL)
+  {
+    cardano_credential_unref(&address->payment_credential);
+  }
+
+  if (address->stake_credential != NULL)
+  {
+    cardano_credential_unref(&address->stake_credential);
+  }
+
+  if (address->byron_content != NULL)
+  {
+    _cardano_free(address->byron_content);
+    address->byron_content = NULL;
+  }
+
+  _cardano_free(address);
+}
diff --git a/vendor/src/address/internals/addr_common.h b/vendor/src/address/internals/addr_common.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/addr_common.h
@@ -0,0 +1,414 @@
+/**
+ * \file addr_common.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_INTERNALS_COMMON_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_INTERNALS_COMMON_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address_type.h>
+#include <cardano/address/base_address.h>
+#include <cardano/address/byron_address.h>
+#include <cardano/address/enterprise_address.h>
+#include <cardano/address/pointer_address.h>
+#include <cardano/address/reward_address.h>
+#include <cardano/address/stake_pointer.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/network_id.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/typedefs.h>
+
+#include "byron_address_content.h"
+
+/* STRUCTURES ***************************************************************/
+
+/**
+ * \brief Represents a Cardano address.
+ *
+ * This structure encapsulates all the necessary information for a Cardano address.
+ */
+typedef struct cardano_address_t
+{
+    cardano_object_t                 base;
+    cardano_address_type_t           type;
+    char                             address_str[1024];
+    byte_t                           address_data[128];
+    size_t                           address_data_size;
+    cardano_network_id_t*            network_id;
+    cardano_stake_pointer_t*         stake_pointer;
+    cardano_credential_t*            payment_credential;
+    cardano_credential_t*            stake_credential;
+    cardano_byron_address_content_t* byron_content;
+
+} cardano_address_t;
+
+/* FUNCTIONS ***************************************************************/
+
+/**
+ * \brief Retrieves the Bech32 prefix for a given address type and network ID.
+ *
+ * This function determines the appropriate Bech32 prefix for addresses based on their type
+ * and the network they belong to.
+ *
+ * \param[in] type The type of the address for which the Bech32 prefix is required.
+ * \param[in] network_id The network ID where the address is being used.
+ * \param[out] size The length of the Bech32 prefix string.
+ *
+ * \return A constant string representing the Bech32 prefix corresponding to the given address type
+ *         and network ID. If the combination of address type and network ID is not recognized,
+ *         the function returns NULL.
+ */
+const char* _cardano_get_bech32_prefix(cardano_address_type_t type, cardano_network_id_t network_id, size_t* size);
+
+/**
+ * \brief Checks whether the given string has a valid bech32 prefix.
+ *
+ * \param[in] address The string to be validated.
+ * \param[in] length The length of the address string not including the null terminator.
+ *
+ * \return Returns \c true if the address string has one of the valid bech32 prefixes, otherwise returns \c false.
+ */
+bool _cardano_has_valid_bech32_prefix(const char* address, size_t length);
+
+/**
+ * \brief Casts a cardano_base_address_t pointer to a cardano_address_t pointer.
+ *
+ * This function is used to cast a base address structure pointer to a more general address
+ * structure pointer. It allows for the use of base address specific data in functions or
+ * contexts where a general address structure is required. This casting is safe as long as
+ * the base address structure is correctly aligned and compatible with the general address
+ * structure.
+ *
+ * \param[in] base_address A pointer to the cardano_base_address_t structure that is to be cast.
+ *
+ * \return A pointer to the cardano_address_t structure derived from the provided base_address pointer.
+ *         If the input pointer is NULL, the function will return NULL.
+ */
+cardano_address_t* _cardano_from_base_to_address(cardano_base_address_t* base_address);
+
+/**
+ * \brief Converts a pointer to a cardano_base_address_t pointer into a pointer to a cardano_address_t pointer.
+ *
+ * \param[in] base_address A double pointer to the cardano_base_address_t structure that is to be converted.
+ *
+ * \return A double pointer to the cardano_address_t structure derived from the provided base_address double pointer.
+ *         If the input double pointer is NULL, the function will return NULL.
+ */
+cardano_address_t** _cardano_from_base_pointer_to_address_pointer(cardano_base_address_t** base_address);
+
+/**
+ * \brief Casts a constant pointer to cardano_base_address_t into a constant pointer to cardano_address_t.
+ *
+ * \param[in] base_address A constant pointer to the cardano_base_address_t structure to be converted.
+ *
+ * \return A constant pointer to a cardano_address_t structure, pointing to the same address data as the input.
+ *         If the input pointer is NULL, the function also returns NULL.
+ */
+const cardano_address_t* _cardano_from_base_to_address_const(const cardano_base_address_t* base_address);
+
+/**
+ * \brief Casts a pointer from the general cardano_address_t type to the more specific cardano_base_address_t type.
+ *
+ * \param[in] address A pointer to the cardano_address_t structure to be converted.
+ *
+ * \return A pointer to a cardano_base_address_t structure, which is a more specific type derived from the input
+ *         general address type. If the input pointer is NULL, or if the address type does not match the expected
+ *         base address type, the function returns NULL.
+ */
+cardano_base_address_t* _cardano_from_address_to_base(cardano_address_t* address);
+
+/**
+ * \brief Casts a pointer from the specific cardano_byron_address_t type to the general cardano_address_t type.
+ *
+ * \param[in] byron_address A pointer to the cardano_byron_address_t structure to be converted.
+ *
+ * \return A pointer to a cardano_address_t structure, representing the general address type that can be used
+ *         in broader Cardano-related operations. If the input pointer is NULL, the function returns NULL,
+ *         reflecting the inability to perform the conversion.
+ */
+cardano_address_t* _cardano_from_byron_to_address(cardano_byron_address_t* byron_address);
+
+/**
+ * \brief Converts a pointer to a pointer from the Byron-specific address type (cardano_byron_address_t)
+ * to the general address type (cardano_address_t) used across the Cardano platform.
+ *
+ * \param[in] byron_address A double pointer to the cardano_byron_address_t structure to be converted.
+ *
+ * \return A double pointer to a cardano_address_t structure. This allows for direct modification of the
+ *         underlying address pointer in higher-level functions. If the input double pointer is NULL,
+ *         or if it points to NULL, the function returns NULL to indicate that conversion cannot be performed.
+ */
+cardano_address_t** _cardano_from_byron_pointer_to_address_pointer(cardano_byron_address_t** byron_address);
+
+/**
+ * \brief Converts a constant pointer from a Byron-specific address type (cardano_byron_address_t)
+ * to a constant pointer of the general address type (cardano_address_t).
+ *
+ * \param[in] byron_address A constant pointer to the cardano_byron_address_t structure to be converted.
+ *
+ * \return A constant pointer to a cardano_address_t structure, allowing read-only access to the Byron address
+ *         in contexts that require a general address type. If the input pointer is NULL, the function returns NULL,
+ *         indicating that there is no address to convert.
+ */
+const cardano_address_t* _cardano_from_byron_to_address_const(const cardano_byron_address_t* byron_address);
+
+/**
+ * \brief Converts a pointer from a general Cardano address type (cardano_address_t)
+ * to a Byron-specific address type (cardano_byron_address_t).
+ *
+ * \param[in] address A pointer to the cardano_address_t structure to be converted.
+ *
+ * \return A pointer to a cardano_byron_address_t structure that represents the Byron address.
+ *         If the input pointer is NULL, or if the address does not conform to the Byron format,
+ *         the function returns NULL, indicating that the conversion could not be performed.
+ */
+cardano_byron_address_t* _cardano_from_address_to_byron(cardano_address_t* address);
+
+/**
+ * \brief Casts a cardano_enterprise_address_t pointer to a cardano_address_t pointer.
+ *
+ * This function is used to cast a enterprise address structure pointer to a more general address
+ * structure pointer. It allows for the use of enterprise address specific data in functions or
+ * contexts where a general address structure is required. This casting is safe as long as
+ * the enterprise address structure is correctly aligned and compatible with the general address
+ * structure.
+ *
+ * \param[in] enterprise_address A pointer to the cardano_enterprise_address_t structure that is to be cast.
+ *
+ * \return A pointer to the cardano_address_t structure derived from the provided enterprise_address pointer.
+ *         If the input pointer is NULL, the function will return NULL.
+ */
+cardano_address_t* _cardano_from_enterprise_to_address(cardano_enterprise_address_t* enterprise_address);
+
+/**
+ * \brief Converts a pointer to a cardano_enterprise_address_t pointer into a pointer to a cardano_address_t pointer.
+ *
+ * \param[in] enterprise_address A double pointer to the cardano_enterprise_address_t structure that is to be converted.
+ *
+ * \return A double pointer to the cardano_address_t structure derived from the provided enterprise_address double pointer.
+ *         If the input double pointer is NULL, the function will return NULL.
+ */
+cardano_address_t** _cardano_from_enterprise_pointer_to_address_pointer(cardano_enterprise_address_t** enterprise_address);
+
+/**
+ * \brief Casts a constant pointer to cardano_enterprise_address_t into a constant pointer to cardano_address_t.
+ *
+ * \param[in] enterprise_address A constant pointer to the cardano_enterprise_address_t structure to be converted.
+ *
+ * \return A constant pointer to a cardano_address_t structure, pointing to the same address data as the input.
+ *         If the input pointer is NULL, the function also returns NULL.
+ */
+const cardano_address_t* _cardano_from_enterprise_to_address_const(const cardano_enterprise_address_t* enterprise_address);
+
+/**
+ * \brief Casts a pointer from the general cardano_address_t type to the more specific cardano_enterprise_address_t type.
+ *
+ * \param[in] address A pointer to the cardano_address_t structure to be converted.
+ *
+ * \return A pointer to a cardano_enterprise_address_t structure, which is a more specific type derived from the input
+ *         general address type. If the input pointer is NULL, or if the address type does not match the expected
+ *         enterprise address type, the function returns NULL.
+ */
+cardano_enterprise_address_t* _cardano_from_address_to_enterprise(cardano_address_t* address);
+
+/**
+ * \brief Casts a cardano_pointer_address_t pointer to a cardano_address_t pointer.
+ *
+ * This function is used to cast a pointer address structure pointer to a more general address
+ * structure pointer. It allows for the use of pointer address specific data in functions or
+ * contexts where a general address structure is required. This casting is safe as long as
+ * the pointer address structure is correctly aligned and compatible with the general address
+ * structure.
+ *
+ * \param[in] pointer_address A pointer to the cardano_pointer_address_t structure that is to be cast.
+ *
+ * \return A pointer to the cardano_address_t structure derived from the provided pointer_address pointer.
+ *         If the input pointer is NULL, the function will return NULL.
+ */
+cardano_address_t* _cardano_from_pointer_to_address(cardano_pointer_address_t* pointer_address);
+
+/**
+ * \brief Converts a pointer to a cardano_pointer_address_t pointer into a pointer to a cardano_address_t pointer.
+ *
+ * \param[in] pointer_address A double pointer to the cardano_pointer_address_t structure that is to be converted.
+ *
+ * \return A double pointer to the cardano_address_t structure derived from the provided pointer_address double pointer.
+ *         If the input double pointer is NULL, the function will return NULL.
+ */
+cardano_address_t** _cardano_from_pointer_pointer_to_address_pointer(cardano_pointer_address_t** pointer_address);
+
+/**
+ * \brief Casts a constant pointer to cardano_pointer_address_t into a constant pointer to cardano_address_t.
+ *
+ * \param[in] pointer_address A constant pointer to the cardano_pointer_address_t structure to be converted.
+ *
+ * \return A constant pointer to a cardano_address_t structure, pointing to the same address data as the input.
+ *         If the input pointer is NULL, the function also returns NULL.
+ */
+const cardano_address_t* _cardano_from_pointer_to_address_const(const cardano_pointer_address_t* pointer_address);
+
+/**
+ * \brief Casts a pointer from the general cardano_address_t type to the more specific cardano_pointer_address_t type.
+ *
+ * \param[in] address A pointer to the cardano_address_t structure to be converted.
+ *
+ * \return A pointer to a cardano_pointer_address_t structure, which is a more specific type derived from the input
+ *         general address type. If the input pointer is NULL, or if the address type does not match the expected
+ *         pointer address type, the function returns NULL.
+ */
+cardano_pointer_address_t* _cardano_from_address_to_pointer(cardano_address_t* address);
+
+/**
+ * \brief Casts a cardano_reward_address_t pointer to a cardano_address_t pointer.
+ *
+ * This function is used to cast a reward address structure pointer to a more general address
+ * structure pointer. It allows for the use of reward address specific data in functions or
+ * contexts where a general address structure is required. This casting is safe as long as
+ * the reward address structure is correctly aligned and compatible with the general address
+ * structure.
+ *
+ * \param[in] reward_address A pointer to the cardano_reward_address_t structure that is to be cast.
+ *
+ * \return A pointer to the cardano_address_t structure derived from the provided reward_address pointer.
+ *         If the input pointer is NULL, the function will return NULL.
+ */
+cardano_address_t* _cardano_from_reward_to_address(cardano_reward_address_t* reward_address);
+
+/**
+ * \brief Converts a pointer to a cardano_reward_address_t pointer into a pointer to a cardano_address_t pointer.
+ *
+ * \param[in] reward_address A double pointer to the cardano_reward_address_t structure that is to be converted.
+ *
+ * \return A double pointer to the cardano_address_t structure derived from the provided reward_address double pointer.
+ *         If the input double pointer is NULL, the function will return NULL.
+ */
+cardano_address_t** _cardano_from_reward_pointer_to_address_pointer(cardano_reward_address_t** reward_address);
+
+/**
+ * \brief Casts a constant pointer to cardano_reward_address_t into a constant pointer to cardano_address_t.
+ *
+ * \param[in] reward_address A constant pointer to the cardano_reward_address_t structure to be converted.
+ *
+ * \return A constant pointer to a cardano_address_t structure, pointing to the same address data as the input.
+ *         If the input pointer is NULL, the function also returns NULL.
+ */
+const cardano_address_t* _cardano_from_reward_to_address_const(const cardano_reward_address_t* reward_address);
+
+/**
+ * \brief Casts a pointer from the general cardano_address_t type to the more specific cardano_reward_address_t type.
+ *
+ * \param[in] address A pointer to the cardano_address_t structure to be converted.
+ *
+ * \return A pointer to a cardano_reward_address_t structure, which is a more specific type derived from the input
+ *         general address type. If the input pointer is NULL, or if the address type does not match the expected
+ *         reward address type, the function returns NULL.
+ */
+cardano_reward_address_t* _cardano_from_address_to_reward(cardano_address_t* address);
+
+/**
+ * \brief Retrieves the payment credential type associated with a specific Cardano address type.
+ *
+ * This function is used to determine the type of payment credential (e.g., public key hash, script hash)
+ * associated with a particular Cardano address type.
+ *
+ * \param[in] type The Cardano address type for which the payment credential type is to be determined.
+ * \param[out] credential_type Pointer to a cardano_credential_type_t variable where the result will be stored.
+ *             This variable will hold the credential type corresponding to the specified address type after
+ *             successful execution of the function.
+ *
+ * \return A cardano_error_t \ref CARDANO_SUCCESS if the operation is successful and the credential type is
+ *                           correctly retrieved, or an error code indicating the reason for failure.
+ */
+cardano_error_t _cardano_get_payment_credential_type(cardano_address_type_t type, cardano_credential_type_t* credential_type);
+
+/**
+ * \brief Retrieves the stake credential type associated with a specific Cardano address type.
+ *
+ * This function determines the type of stake credential (e.g., public key hash, script hash)
+ * that corresponds to a particular Cardano address type.
+ *
+ * \param[in] type The Cardano address type for which the stake credential type is to be determined.
+ * \param[out] credential_type Pointer to a cardano_credential_type_t variable where the result will be stored.
+ *             This variable will hold the stake credential type corresponding to the specified address type after
+ *             successful execution of the function.
+ *
+ * \return A cardano_error_t \ref CARDANO_SUCCESS if the operation is successful and the credential type is
+ *                           correctly retrieved, or an error code indicating the reason for failure.
+ */
+cardano_error_t _cardano_get_stake_credential_type(cardano_address_type_t type, cardano_credential_type_t* credential_type);
+
+/**
+ * \brief Gets whether the given address has a valid payment address prefix.
+ *
+ * \param address The address to check the prefix for.
+ * \param length The length of the address without the null terminator.
+ *
+ * \return \c true if the prefix is valid; otherwise; \c false.
+ */
+bool _cardano_is_valid_payment_address_prefix(const char* address, size_t length);
+
+/**
+ * \brief Gets whether the given address has a valid stake address prefix.
+ *
+ * \param address The address to check the prefix for.
+ * \param length The length of the address without the null terminator.
+ *
+ * \return \c true if the prefix is valid; otherwise; \c false.
+ */
+bool _cardano_is_valid_stake_address_prefix(const char* address, size_t length);
+
+/**
+ * \brief Encodes the given address data into bech32.
+ *
+ * \param[in] data The address binary data.
+ * \param[in] data_size The size of the binary data.
+ * \param[in] network_id The network id.
+ * \param[in] type The address type.
+ * \param[out] address The buffer where to write the address data to.
+ * \param[in] address_size The size of the address buffer.
+ *
+ * \return CARDANO_SUCCESS or the encoding or allocation error.
+ */
+cardano_error_t _cardano_to_bech32_addr(
+  const byte_t*          data,
+  size_t                 data_size,
+  cardano_network_id_t   network_id,
+  cardano_address_type_t type,
+  char*                  address,
+  size_t                 address_size);
+
+/**
+ * \brief Deallocates a address object.
+ *
+ * This function is responsible for properly deallocating a address object (`cardano_address_t`)
+ * and its associated resources.
+ *
+ * \param[in] object A void pointer to the address object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_address_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the address
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+void _cardano_address_deallocate(void* object);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ADDRESS_INTERNALS_COMMON_H
diff --git a/vendor/src/address/internals/base_addr_pack.c b/vendor/src/address/internals/base_addr_pack.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/base_addr_pack.c
@@ -0,0 +1,173 @@
+/**
+ * \file base_addr_pack.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash_size.h>
+
+#include "addr_common.h"
+#include "base_addr_pack.h"
+
+#include "../../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t ADDRESS_HEADER_SIZE = 1;
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+_cardano_get_base_address_type(
+  const cardano_credential_t* payment_credential,
+  const cardano_credential_t* stake_credential,
+  cardano_address_type_t*     type)
+{
+  assert(payment_credential != NULL);
+  assert(stake_credential != NULL);
+  assert(type != NULL);
+
+  cardano_credential_type_t payment_type;
+  cardano_credential_type_t stake_type;
+
+  cardano_error_t get_type_result = cardano_credential_get_type(payment_credential, &payment_type);
+
+  assert(get_type_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(get_type_result);
+
+  get_type_result = cardano_credential_get_type(stake_credential, &stake_type);
+
+  assert(get_type_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(get_type_result);
+
+  if ((payment_type == CARDANO_CREDENTIAL_TYPE_KEY_HASH) && (stake_type == CARDANO_CREDENTIAL_TYPE_KEY_HASH))
+  {
+    *type = CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_KEY;
+  }
+
+  if ((payment_type == CARDANO_CREDENTIAL_TYPE_KEY_HASH) && (stake_type == CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH))
+  {
+    *type = CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_SCRIPT;
+  }
+
+  if ((payment_type == CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH) && (stake_type == CARDANO_CREDENTIAL_TYPE_KEY_HASH))
+  {
+    *type = CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY;
+  }
+
+  if ((payment_type == CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH) && (stake_type == CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH))
+  {
+    *type = CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_unpack_base_address(const byte_t* data, const size_t size, cardano_base_address_t** address)
+{
+  assert(data != NULL);
+  assert(address != NULL);
+
+  if (size < (size_t)ADDRESS_HEADER_SIZE + (2U * (size_t)CARDANO_BLAKE2B_HASH_SIZE_224))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  cardano_address_type_t type       = (cardano_address_type_t)(data[0] >> 4);
+  cardano_network_id_t   network_id = (cardano_network_id_t)(uint8_t)((uint8_t)data[0] & 0x0FU);
+
+  cardano_credential_type_t payment_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+  cardano_credential_type_t stake_type   = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+
+  cardano_error_t credential_type_result = _cardano_get_payment_credential_type(type, &payment_type);
+
+  assert(credential_type_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(credential_type_result);
+
+  credential_type_result = _cardano_get_stake_credential_type(type, &stake_type);
+
+  assert(credential_type_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(credential_type_result);
+
+  cardano_credential_t* payment_credential = NULL;
+  cardano_credential_t* stake_credential   = NULL;
+
+  cardano_error_t credential_result = cardano_credential_from_hash_bytes(
+    &data[ADDRESS_HEADER_SIZE],
+    CARDANO_BLAKE2B_HASH_SIZE_224,
+    payment_type,
+    &payment_credential);
+
+  if (credential_result != CARDANO_SUCCESS)
+  {
+    return credential_result;
+  }
+
+  credential_result = cardano_credential_from_hash_bytes(
+    &data[(size_t)CARDANO_BLAKE2B_HASH_SIZE_224 + ADDRESS_HEADER_SIZE],
+    CARDANO_BLAKE2B_HASH_SIZE_224,
+    stake_type,
+    &stake_credential);
+
+  if (credential_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&payment_credential);
+    return credential_result;
+  }
+
+  cardano_error_t base_address_result = cardano_base_address_from_credentials(
+    network_id,
+    payment_credential,
+    stake_credential,
+    address);
+
+  cardano_credential_unref(&payment_credential);
+  cardano_credential_unref(&stake_credential);
+
+  return base_address_result;
+}
+
+void
+_cardano_pack_base_address(const cardano_address_t* address, byte_t* data, const size_t size)
+{
+  assert(size >= (size_t)ADDRESS_HEADER_SIZE + (2U * (size_t)CARDANO_BLAKE2B_HASH_SIZE_224));
+  assert(address != NULL);
+  assert(data != NULL);
+
+  CARDANO_UNUSED(memset(data, 0, ADDRESS_HEADER_SIZE + (2U * (size_t)CARDANO_BLAKE2B_HASH_SIZE_224)));
+
+  data[0] = ((byte_t)address->type << 4U) | (byte_t)(*address->network_id);
+
+  cardano_safe_memcpy(
+    &data[ADDRESS_HEADER_SIZE],
+    size - ADDRESS_HEADER_SIZE,
+    cardano_credential_get_hash_bytes(address->payment_credential),
+    CARDANO_BLAKE2B_HASH_SIZE_224);
+
+  cardano_safe_memcpy(
+    &data[(size_t)CARDANO_BLAKE2B_HASH_SIZE_224 + ADDRESS_HEADER_SIZE],
+    size - ((size_t)CARDANO_BLAKE2B_HASH_SIZE_224 + ADDRESS_HEADER_SIZE),
+    cardano_credential_get_hash_bytes(address->stake_credential),
+    CARDANO_BLAKE2B_HASH_SIZE_224);
+}
diff --git a/vendor/src/address/internals/base_addr_pack.h b/vendor/src/address/internals/base_addr_pack.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/base_addr_pack.h
@@ -0,0 +1,89 @@
+/**
+ * \file base_addr_pack.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BASE_ADDRESS_PACK_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BASE_ADDRESS_PACK_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address_type.h>
+#include <cardano/address/base_address.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Packs a Cardano base address into a byte array.
+ *
+ * This function takes a Cardano base address and encodes it into a byte array format.
+ *
+ * \param[in] address Pointer to the Cardano base address structure to be packed.
+ * \param[out] data Pointer to the byte array where the packed address will be stored.
+ * \param[in] size Size of the byte array in bytes.
+ *
+ * \note This function assumes that the `data` buffer has enough space to hold the packed
+ *       address. The caller is responsible for ensuring that there is sufficient space
+ *       and for managing the memory of the `data` buffer.
+ */
+void
+_cardano_pack_base_address(const cardano_address_t* address, byte_t* data, size_t size);
+
+/**
+ * \brief Unpacks a byte array into a Cardano base address structure.
+ *
+ * This function takes a byte array containing the serialized form of a Cardano base address
+ * and decodes it into a Cardano base address structure.
+ *
+ * \param[in] data Pointer to the byte array containing the serialized Cardano base address.
+ * \param[in] size Size of the byte array in bytes.
+ * \param[out] address Double pointer to where the newly created Cardano base address structure will be stored.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the unpacking is successful. Returns an error code if
+ *         the unpacking fails due to invalid format, insufficient data provided, or memory allocation issues.
+ *
+ * \note The caller is responsible for managing the lifecycle of the created Cardano base address object.
+ *       This includes deallocating the address structure using the appropriate function when it is no longer needed.
+ */
+cardano_error_t
+_cardano_unpack_base_address(const byte_t* data, size_t size, cardano_base_address_t** address);
+
+/**
+ * \brief Determines the Cardano base address type based on payment and stake credentials.
+ *
+ * This function assesses the type of a Cardano base address by analyzing the characteristics
+ * of its payment and stake credentials.
+ *
+ * \param[in] payment_credential Pointer to the payment credential structure.
+ * \param[in] stake_credential Pointer to the stake credential structure.
+ * \param[out] type Pointer to a variable where the determined address type will be stored.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the address type is successfully determined.
+ *         Returns an error code if the function fails due to invalid input or other internal issues.
+ */
+cardano_error_t
+_cardano_get_base_address_type(
+  const cardano_credential_t* payment_credential,
+  const cardano_credential_t* stake_credential,
+  cardano_address_type_t*     type);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BASE_ADDRESS_PACK_H
diff --git a/vendor/src/address/internals/byron_addr_pack.c b/vendor/src/address/internals/byron_addr_pack.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/byron_addr_pack.c
@@ -0,0 +1,693 @@
+/**
+ * \file byron_addr_pack.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/crc32.h>
+
+#include "../../allocators.h"
+#include "addr_common.h"
+#include "byron_addr_pack.h"
+
+#include "../../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* IMPLEMENTATION ************************************************************/
+
+int64_t
+_cardano_byron_address_calculate_map_size(cardano_byron_address_attributes_t attributes)
+{
+  int64_t map_size = 0;
+
+  if (attributes.magic >= 0)
+  {
+    map_size++;
+  }
+
+  if (attributes.derivation_path_size > 0U)
+  {
+    map_size++;
+  }
+
+  return map_size;
+}
+
+cardano_error_t
+_cardano_byron_address_initialize(cardano_cbor_writer_t* writer, const cardano_address_t* address)
+{
+  assert(writer != NULL);
+  assert(address != NULL);
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 3);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, address->byron_content->root, sizeof(address->byron_content->root));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t map_size = _cardano_byron_address_calculate_map_size(address->byron_content->attributes);
+
+  return cardano_cbor_writer_write_start_map(writer, map_size);
+}
+
+cardano_error_t
+_cardano_byron_address_extract_cbor_data(cardano_cbor_writer_t* writer, byte_t** data, size_t* size)
+{
+  assert(writer != NULL);
+  assert(data != NULL);
+  assert(size != NULL);
+
+  *size = cardano_cbor_writer_get_encode_size(writer);
+  *data = (byte_t*)_cardano_malloc(*size);
+
+  if (*data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_cbor_writer_encode(writer, *data, *size);
+}
+
+cardano_error_t
+_cardano_byron_address_encode_magic(cardano_cbor_writer_t* writer, const cardano_address_t* address)
+{
+  assert(writer != NULL);
+  assert(address != NULL);
+
+  cardano_cbor_writer_t* magic_writer = cardano_cbor_writer_new();
+
+  if (magic_writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_uint(magic_writer, address->byron_content->attributes.magic);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&magic_writer);
+    return result;
+  }
+
+  size_t  magic_size;
+  byte_t* magic_data;
+  result = _cardano_byron_address_extract_cbor_data(magic_writer, &magic_data, &magic_size);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_writer_write_uint(writer, 2);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_cbor_writer_write_bytestring(writer, magic_data, magic_size);
+    }
+    _cardano_free(magic_data);
+  }
+
+  cardano_cbor_writer_unref(&magic_writer);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_byron_address_encode_derivation_path(cardano_cbor_writer_t* writer, const cardano_address_t* address)
+{
+  assert(writer != NULL);
+  assert(address != NULL);
+
+  cardano_cbor_writer_t* attributes_writer = cardano_cbor_writer_new();
+
+  if (attributes_writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_bytestring(
+    attributes_writer,
+    address->byron_content->attributes.derivation_path,
+    address->byron_content->attributes.derivation_path_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&attributes_writer);
+
+    return result;
+  }
+
+  size_t  attributes_size;
+  byte_t* attributes_data;
+  result = _cardano_byron_address_extract_cbor_data(attributes_writer, &attributes_data, &attributes_size);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_writer_write_uint(writer, 1);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_cbor_writer_write_bytestring(writer, attributes_data, attributes_size);
+    }
+    _cardano_free(attributes_data);
+  }
+
+  cardano_cbor_writer_unref(&attributes_writer);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_byron_address_encode_attributes(cardano_cbor_writer_t* writer, const cardano_address_t* address)
+{
+  assert(writer != NULL);
+  assert(address != NULL);
+
+  if (address->byron_content->attributes.derivation_path_size > 0U)
+  {
+    cardano_error_t result = _cardano_byron_address_encode_derivation_path(writer, address);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (address->byron_content->attributes.magic >= 0)
+  {
+    cardano_error_t result = _cardano_byron_address_encode_magic(writer, address);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return cardano_cbor_writer_write_uint(writer, address->byron_content->type);
+}
+
+cardano_error_t
+_cardano_byron_address_finalize_writer(cardano_cbor_writer_t* writer, byte_t** data, size_t* size)
+{
+  assert(writer != NULL);
+  assert(data != NULL);
+  assert(size != NULL);
+
+  *size = cardano_cbor_writer_get_encode_size(writer);
+  *data = (byte_t*)_cardano_malloc(*size);
+
+  if (*data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_cbor_writer_encode(writer, *data, *size);
+}
+
+cardano_error_t
+_cardano_byron_address_write_final_structure(
+  cardano_cbor_writer_t* writer,
+  const byte_t*          encoded_data,
+  size_t                 encoded_size,
+  uint32_t               crc)
+{
+  assert(writer != NULL);
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 2);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_tag(writer, CARDANO_ENCODED_CBOR_DATA_ITEM);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, encoded_data, encoded_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return cardano_cbor_writer_write_uint(writer, crc);
+}
+
+cardano_error_t
+_cardano_byron_address_finalize_encoding(cardano_cbor_writer_t* writer, byte_t** data, size_t* size)
+{
+  assert(writer != NULL);
+  assert(data != NULL);
+  assert(size != NULL);
+
+  size_t          encoded_size;
+  byte_t*         encoded_data;
+  cardano_error_t result = _cardano_byron_address_finalize_writer(writer, &encoded_data, &encoded_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  uint32_t crc = cardano_checksum_crc32(encoded_data, encoded_size);
+
+  result = cardano_cbor_writer_reset(writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(encoded_data);
+    return result;
+  }
+
+  result = _cardano_byron_address_write_final_structure(writer, encoded_data, encoded_size, crc);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = _cardano_byron_address_extract_cbor_data(writer, data, size);
+  }
+
+  _cardano_free(encoded_data);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_pack_byron_address(const cardano_address_t* address, byte_t* data, const size_t data_size, size_t* size)
+{
+  assert(address != NULL);
+  assert(data != NULL);
+  assert(size != NULL);
+  assert(address->byron_content != NULL);
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (!writer)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = _cardano_byron_address_initialize(writer, address);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = _cardano_byron_address_encode_attributes(writer, address);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  byte_t* result_data = NULL;
+  result              = _cardano_byron_address_finalize_encoding(writer, &result_data, size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  cardano_safe_memcpy(data, data_size, result_data, *size);
+
+  _cardano_free(result_data);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_byron_address_initialize_cbor_reader(const byte_t* data, size_t size, cardano_cbor_reader_t** reader)
+{
+  assert(data != NULL);
+  assert(reader != NULL);
+
+  *reader = cardano_cbor_reader_new(data, size);
+
+  if (*reader == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_byron_address_verify_cbor_structure(
+  cardano_cbor_reader_t* reader,
+  uint32_t*              crc_calculated,
+  uint64_t*              crc_expected,
+  cardano_buffer_t**     address_data_encoded)
+{
+  assert(reader != NULL);
+  assert(crc_calculated != NULL);
+  assert(crc_expected != NULL);
+  assert(address_data_encoded != NULL);
+
+  int64_t         array_size = 0;
+  cardano_error_t result     = cardano_cbor_reader_read_start_array(reader, &array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_tag_t tag;
+  result = cardano_cbor_reader_read_tag(reader, &tag);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_reader_read_bytestring(reader, address_data_encoded);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_reader_read_uint(reader, crc_expected);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(address_data_encoded);
+    *address_data_encoded = NULL;
+
+    return result;
+  }
+
+  *crc_calculated = cardano_checksum_crc32(
+    cardano_buffer_get_data(*address_data_encoded),
+    cardano_buffer_get_size(*address_data_encoded));
+
+  if (*crc_calculated != *crc_expected)
+  {
+    cardano_buffer_unref(address_data_encoded);
+    return CARDANO_ERROR_CHECKSUM_MISMATCH;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_byron_address_unpack_inner_cbor_content(
+  cardano_buffer_t*       address_data_encoded,
+  uint32_t                crc_calculated,
+  uint64_t                crc_expected,
+  cardano_cbor_reader_t** inner_reader)
+{
+  assert(address_data_encoded != NULL);
+  assert(inner_reader != NULL);
+
+  if (crc_calculated != crc_expected)
+  {
+    return CARDANO_ERROR_CHECKSUM_MISMATCH;
+  }
+
+  *inner_reader = cardano_cbor_reader_new(cardano_buffer_get_data(address_data_encoded), cardano_buffer_get_size(address_data_encoded));
+
+  if (!*inner_reader)
+  {
+    cardano_buffer_unref(&address_data_encoded);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_unref(&address_data_encoded);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_byron_address_process_derivation_path(
+  cardano_cbor_reader_t*              inner_reader,
+  cardano_byron_address_attributes_t* attributes)
+{
+  assert(inner_reader != NULL);
+  assert(attributes != NULL);
+
+  cardano_buffer_t* encoded_derivation_path = NULL;
+  cardano_error_t   result                  = cardano_cbor_reader_read_bytestring(inner_reader, &encoded_derivation_path);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_t* path_reader = cardano_cbor_reader_new(cardano_buffer_get_data(encoded_derivation_path), cardano_buffer_get_size(encoded_derivation_path));
+
+  if (!path_reader)
+  {
+    cardano_buffer_unref(&encoded_derivation_path);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* derivation_path = NULL;
+  result                            = cardano_cbor_reader_read_bytestring(path_reader, &derivation_path);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&encoded_derivation_path);
+    cardano_cbor_reader_unref(&path_reader);
+
+    return result;
+  }
+
+  attributes->derivation_path_size = cardano_buffer_get_size(derivation_path);
+
+  cardano_safe_memcpy(
+    attributes->derivation_path,
+    sizeof(attributes->derivation_path),
+    cardano_buffer_get_data(derivation_path),
+    attributes->derivation_path_size);
+
+  cardano_buffer_unref(&derivation_path);
+  cardano_buffer_unref(&encoded_derivation_path);
+  cardano_cbor_reader_unref(&path_reader);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_byron_address_process_magic(cardano_cbor_reader_t* inner_reader, cardano_byron_address_attributes_t* attributes)
+{
+  assert(inner_reader != NULL);
+  assert(attributes != NULL);
+
+  cardano_buffer_t* encoded_magic = NULL;
+  cardano_error_t   result        = cardano_cbor_reader_read_bytestring(inner_reader, &encoded_magic);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_t* magic_reader = cardano_cbor_reader_new(cardano_buffer_get_data(encoded_magic), cardano_buffer_get_size(encoded_magic));
+
+  if (!magic_reader)
+  {
+    cardano_buffer_unref(&encoded_magic);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  int64_t magic;
+  result = cardano_cbor_reader_read_int(magic_reader, &magic);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&encoded_magic);
+    cardano_cbor_reader_unref(&magic_reader);
+    return result;
+  }
+
+  attributes->magic = magic;
+
+  cardano_buffer_unref(&encoded_magic);
+  cardano_cbor_reader_unref(&magic_reader);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_byron_address_extract_address_components(cardano_cbor_reader_t* inner_reader, cardano_byron_address_t** address)
+{
+  assert(inner_reader != NULL);
+  assert(address != NULL);
+
+  int64_t         array_size = 0;
+  cardano_error_t result     = cardano_cbor_reader_read_start_array(inner_reader, &array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_buffer_t* root;
+  result = cardano_cbor_reader_read_bytestring(inner_reader, &root);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t map_size = 0;
+  result           = cardano_cbor_reader_read_start_map(inner_reader, &map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&root);
+    return result;
+  }
+
+  cardano_byron_address_attributes_t attributes = { 0 };
+  attributes.magic                              = -1;
+
+  while (map_size > 0)
+  {
+    int64_t key;
+    result = cardano_cbor_reader_read_int(inner_reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&root);
+      return result;
+    }
+
+    switch (key)
+    {
+      case 1:
+        result = _cardano_byron_address_process_derivation_path(inner_reader, &attributes);
+        break;
+      case 2:
+        result = _cardano_byron_address_process_magic(inner_reader, &attributes);
+        break;
+      default:
+        result = CARDANO_ERROR_DECODING;
+        break;
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&root);
+      return result;
+    }
+
+    --map_size;
+  }
+
+  result = cardano_cbor_reader_read_end_map(inner_reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&root);
+    return result;
+  }
+
+  int64_t byron_address_type;
+  result = cardano_cbor_reader_read_int(inner_reader, &byron_address_type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&root);
+    return result;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+  result                       = cardano_blake2b_hash_from_bytes(cardano_buffer_get_data(root), cardano_buffer_get_size(root), &hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&root);
+    cardano_blake2b_hash_unref(&hash);
+
+    return result;
+  }
+
+  result = cardano_byron_address_from_credentials(hash, attributes, byron_address_type, address);
+
+  cardano_buffer_unref(&root);
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_unpack_byron_address(const byte_t* data, const size_t size, cardano_byron_address_t** cardano_byron)
+{
+  assert(data != NULL);
+  assert(cardano_byron != NULL);
+
+  cardano_cbor_reader_t* reader;
+  cardano_error_t        result = _cardano_byron_address_initialize_cbor_reader(data, size, &reader);
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  uint32_t          crc_calculated;
+  uint64_t          crc_expected;
+  cardano_buffer_t* address_data_encoded = NULL;
+  result                                 = _cardano_byron_address_verify_cbor_structure(reader, &crc_calculated, &crc_expected, &address_data_encoded);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader);
+
+    return result;
+  }
+
+  cardano_cbor_reader_t* inner_reader;
+  result = _cardano_byron_address_unpack_inner_cbor_content(address_data_encoded, crc_calculated, crc_expected, &inner_reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader);
+    return result;
+  }
+
+  result = _cardano_byron_address_extract_address_components(inner_reader, cardano_byron);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader);
+    cardano_cbor_reader_unref(&inner_reader);
+
+    return result;
+  }
+
+  cardano_cbor_reader_unref(&reader);
+  cardano_cbor_reader_unref(&inner_reader);
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/address/internals/byron_addr_pack.h b/vendor/src/address/internals/byron_addr_pack.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/byron_addr_pack.h
@@ -0,0 +1,352 @@
+/**
+ * \file byron_addr_pack.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_PACK_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_PACK_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/byron_address.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Calculates the number of elements in the map of a Byron address based on its attributes.
+ *
+ * This function determines the size of the attributes map for a Byron address by checking the presence
+ * of non-default attributes. It considers attributes such as the derivation path and the network magic number.
+ * The size is used to construct the map in CBOR format during serialization of Byron addresses.
+ *
+ * \param[in] attributes The attributes of the Byron address to be examined.
+ *
+ * \return The calculated map size as an int64_t. If no attributes are present that require encoding, this function
+ *         returns zero, indicating an empty map.
+ */
+int64_t
+_cardano_byron_address_calculate_map_size(cardano_byron_address_attributes_t attributes);
+
+/**
+ * \brief Initializes a CBOR writer for serializing a Byron address.
+ *
+ * This function prepares a CBOR writer to serialize a Byron address by writing the necessary CBOR structure
+ * headers, including the start of an array and the address root. It sets up the writer to accept the detailed
+ * encoding of the address's attributes and type.
+ *
+ * \param[in,out] writer A pointer to a cardano_cbor_writer_t that will be used for writing the Byron address.
+ * \param[in] address A pointer to a cardano_address_t containing the Byron address data to be serialized.
+ *
+ * \return A cardano_error_t indicating the result of the operation. Returns CARDANO_SUCCESS on successful
+ *         initialization of the writer for the given Byron address. If an error occurs during the writing process,
+ *         an appropriate error code is returned.
+ */
+cardano_error_t
+_cardano_byron_address_initialize(cardano_cbor_writer_t* writer, const cardano_address_t* address);
+
+/**
+ * \brief Extracts the serialized CBOR data from a CBOR writer used to serialize a Byron address.
+ *
+ * \param[in] writer A pointer to the cardano_cbor_writer_t that has been used to serialize the Byron address.
+ * \param[out] data A pointer to a byte pointer where the address of the allocated memory holding the CBOR data
+ *                  will be stored. The caller is responsible for freeing this memory using an appropriate free
+ *                  function, such as _cardano_free, to avoid memory leaks.
+ * \param[out] size A pointer to a size_t variable where the size of the serialized data will be stored.
+ *
+ * \return A cardano_error_t indicating the result of the operation. Returns CARDANO_SUCCESS if the data
+ *         was successfully retrieved and stored in the provided memory. Returns an error code if there was
+ *         an issue with the extraction or memory allocation.
+ */
+cardano_error_t
+_cardano_byron_address_extract_cbor_data(cardano_cbor_writer_t* writer, byte_t** data, size_t* size);
+
+/**
+ * \brief Encodes the "magic" attribute of a Byron address into CBOR format.
+ *
+ * This function encodes the network magic attribute (if present) of a Byron address into the provided
+ * CBOR writer. The network magic is a numeric identifier used primarily in test networks to distinguish
+ * between different network environments. If the magic attribute is valid (i.e., non-negative), it is
+ * encoded; otherwise, it is ignored.
+ *
+ * \param[in] writer A pointer to the cardano_cbor_writer_t used for encoding the CBOR data.
+ * \param[in] address A pointer to the cardano_address_t containing the Byron address whose magic
+ *                    attribute is to be encoded.
+ *
+ * \return A cardano_error_t indicating the result of the operation. Returns CARDANO_SUCCESS if the magic
+ *         was successfully encoded, or an error code if there was an issue during the encoding process.
+ */
+cardano_error_t
+_cardano_byron_address_encode_magic(cardano_cbor_writer_t* writer, const cardano_address_t* address);
+
+/**
+ * \brief Encodes the derivation path attribute of a Byron address into CBOR format.
+ *
+ * This function is responsible for encoding the derivation path attribute of a Byron address into the
+ * provided CBOR writer.
+ *
+ * \param[in] writer A pointer to a cardano_cbor_writer_t that will be used for encoding the CBOR data.
+ * \param[in] address A pointer to the cardano_address_t containing the Byron address with the derivation
+ *                    path to be encoded.
+ *
+ * \return A cardano_error_t indicating the result of the operation. Returns CARDANO_SUCCESS if the derivation
+ *         path was successfully encoded, or an error code if there was an issue during the encoding process.
+ */
+cardano_error_t
+_cardano_byron_address_encode_derivation_path(cardano_cbor_writer_t* writer, const cardano_address_t* address);
+
+/**
+ * \brief Encodes the attributes of a Byron address into CBOR format using the provided CBOR writer.
+ *
+ * This function takes a Byron address and encodes its attributes, such as the derivation path and magic value,
+ * into a CBOR map. The function dynamically calculates the size of the map based on which attributes are
+ * present and valid within the address, encoding only those attributes that are necessary.
+ *
+ * \param[in] writer A pointer to a cardano_cbor_writer_t that will be used to encode the attributes into CBOR.
+ * \param[in] address A pointer to the cardano_address_t containing the Byron address attributes to be encoded.
+ *
+ * \return A cardano_error_t indicating the result of the operation. Returns CARDANO_SUCCESS if the attributes
+ *         were successfully encoded into CBOR format.
+ */
+cardano_error_t
+_cardano_byron_address_encode_attributes(cardano_cbor_writer_t* writer, const cardano_address_t* address);
+
+/**
+ * \brief Finalizes the CBOR writer and retrieves the encoded Byron address data.
+ *
+ * This function completes the CBOR encoding process for a Byron address by finalizing the CBOR writer.
+ * It retrieves the encoded data and the size of this data. The function ensures that all data encoded
+ * up to this point is properly compiled into a contiguous byte array which it returns via pointer
+ * parameters.
+ *
+ * \param[in] writer A pointer to a cardano_cbor_writer_t that has been used to encode a Byron address.
+ * \param[out] data A pointer to a byte array where the address of the encoded data will be stored.
+ *                  The caller is responsible for freeing this memory using _cardano_free.
+ * \param[out] size A pointer to a size_t variable where the size of the encoded data will be stored.
+ *
+ * \return A cardano_error_t indicating the result of the operation. Returns CARDANO_SUCCESS if the
+ *         data was successfully retrieved.
+ */
+cardano_error_t
+_cardano_byron_address_finalize_writer(cardano_cbor_writer_t* writer, byte_t** data, size_t* size);
+
+/**
+ * \brief Writes the final CBOR structure for a Byron address, including the encoded data and its checksum.
+ *
+ * This function writes the encoded Byron address data along with its checksum into a CBOR structure
+ * using a CBOR writer. The encoded data is wrapped in a CBOR array that includes a self-describe tag
+ * to indicate the format and a checksum to validate the integrity of the data upon decoding.
+ *
+ * \param[in] writer A pointer to a cardano_cbor_writer_t that is used to write the final CBOR structure.
+ * \param[in] encoded_data A pointer to the byte array containing the previously encoded Byron address data.
+ * \param[in] encoded_size The size of the encoded data in bytes.
+ * \param[in] crc The CRC32 checksum calculated for the encoded data, used for data integrity verification.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. Returns CARDANO_SUCCESS if
+ *         the final structure is written successfully.
+ */
+cardano_error_t
+_cardano_byron_address_write_final_structure(
+  cardano_cbor_writer_t* writer,
+  const byte_t*          encoded_data,
+  size_t                 encoded_size,
+  uint32_t               crc);
+
+/**
+ * \brief Finalizes the encoding of a Byron address by extracting the data written to a CBOR writer.
+ *
+ * This function finalizes the encoding process for a Byron address by retrieving the encoded data
+ * from a CBOR writer.
+ *
+ * \param[in] writer A pointer to a cardano_cbor_writer_t that has been used to encode a Byron address.
+ * \param[out] data A pointer to a byte pointer where the address of the newly allocated buffer containing
+ *                  the encoded data will be stored.
+ * \param[out] size A pointer to a size_t variable where the size of the encoded data will be stored.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. Returns CARDANO_SUCCESS
+ *         if the data is successfully retrieved and stored in the provided pointers.
+ */
+cardano_error_t
+_cardano_byron_address_finalize_encoding(cardano_cbor_writer_t* writer, byte_t** data, size_t* size);
+
+/**
+ * \brief Initializes a CBOR reader for parsing Byron address data from a given byte buffer.
+ *
+ * This function sets up a cardano_cbor_reader_t to parse Byron address data that has been
+ * encoded in CBOR format. It prepares the reader to parse data from a specified memory buffer
+ * containing the CBOR-encoded data.
+ *
+ * \param[in] data A pointer to the buffer containing the CBOR-encoded Byron address data.
+ * \param[in] size The size of the buffer in bytes.
+ * \param[out] reader A pointer to a pointer of cardano_cbor_reader_t where the initialized
+ *                    CBOR reader object will be stored.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. Returns CARDANO_SUCCESS
+ *         if the reader is successfully initialized.
+ */
+cardano_error_t
+_cardano_byron_address_initialize_cbor_reader(const byte_t* data, size_t size, cardano_cbor_reader_t** reader);
+
+/**
+ * \brief Verifies the structure of a CBOR-encoded Byron address and reads the encoded address data and expected CRC.
+ *
+ * This function reads from a cardano_cbor_reader_t initialized with Byron address data to verify the correct
+ * structure of the CBOR data according to expected formats.
+ *
+ * \param[in] reader A pointer to an initialized cardano_cbor_reader_t that is set to read the Byron address data.
+ * \param[out] crc_calculated A pointer to a uint32_t where the calculated CRC of the encoded data will be stored.
+ * \param[out] crc_expected A pointer to a uint64_t where the expected CRC value read from the CBOR data will be stored.
+ * \param[out] address_data_encoded A pointer to a pointer of cardano_buffer_t where the extracted address data
+ *                  will be stored. The data is stored as a dynamically allocated buffer that the caller must manage.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. Returns CARDANO_SUCCESS if the
+ *         structure is verified and the data is successfully read.
+ */
+cardano_error_t
+_cardano_byron_address_verify_cbor_structure(
+  cardano_cbor_reader_t* reader,
+  uint32_t*              crc_calculated,
+  uint64_t*              crc_expected,
+  cardano_buffer_t**     address_data_encoded);
+
+/**
+ * \brief Unpacks the inner CBOR content of a Byron address and initializes a CBOR reader for it.
+ *
+ * This function checks the CRC of the encoded Byron address data against the expected CRC to ensure data integrity.
+ * If the CRC matches, it initializes a new CBOR reader for the inner content of the address, allowing further
+ * decoding and analysis of the encoded data.
+ *
+ * \param[in] address_data_encoded A pointer to a cardano_buffer_t containing the CBOR-encoded Byron address data.
+ * \param[in] crc_calculated The CRC that was calculated from the encoded data.
+ * \param[in] crc_expected The expected CRC read from the CBOR data stream, used for verification.
+ * \param[out] inner_reader A pointer to a pointer of cardano_cbor_reader_t that will be initialized to read
+ *              from the address_data_encoded buffer.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. Returns CARDANO_SUCCESS if the
+ *         structure is verified and the data is successfully read.
+ */
+cardano_error_t
+_cardano_byron_address_unpack_inner_cbor_content(
+  cardano_buffer_t*       address_data_encoded,
+  uint32_t                crc_calculated,
+  uint64_t                crc_expected,
+  cardano_cbor_reader_t** inner_reader);
+
+/**
+ * \brief Processes the derivation path attribute from the inner CBOR content of a Byron address.
+ *
+ * This function reads the derivation path attribute encoded within the Byron address's CBOR content.
+ * It assumes that the CBOR reader is positioned at the correct point to read the derivation path.
+ * The function extracts the derivation path and stores it in the provided attributes structure.
+ *
+ * \param[in] inner_reader A pointer to a cardano_cbor_reader_t already set up to read the inner CBOR content.
+ * \param[out] attributes A pointer to a byron_address_attributes_t structure where the decoded derivation path
+ *                        will be stored. The function updates the derivation_path field of this structure.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. Returns CARDANO_SUCCESS if the
+ *         structure is verified and the data is successfully read.
+ */
+cardano_error_t
+_cardano_byron_address_process_derivation_path(
+  cardano_cbor_reader_t*              inner_reader,
+  cardano_byron_address_attributes_t* attributes);
+
+/**
+ * \brief Processes the network magic attribute from the inner CBOR content of a Byron address.
+ *
+ * This function is designed to extract and decode the network magic attribute encoded within the CBOR
+ * structure of a Byron address. It assumes that the CBOR reader is appropriately positioned to read
+ * this attribute directly.
+ *
+ * \param[in] inner_reader A pointer to a cardano_cbor_reader_t that is set to read the inner CBOR content
+ *                         of a Byron address. The reader should be positioned at the start of the network
+ *                         magic attribute.
+ * \param[out] attributes A pointer to a byron_address_attributes_t structure where the network magic
+ *                        will be stored upon successful extraction. The `magic` field of this structure
+ *                        is updated.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. Returns CARDANO_SUCCESS if the
+ *         structure is verified and the data is successfully read.
+ */
+cardano_error_t
+_cardano_byron_address_process_magic(
+  cardano_cbor_reader_t*              inner_reader,
+  cardano_byron_address_attributes_t* attributes);
+
+/**
+ * \brief Extracts address components from the CBOR content read from a Byron address.
+ *
+ * This function interprets the decoded CBOR content to extract essential components of a Byron address,
+ * including the address root, attributes, and the address type. It constructs a Byron address structure
+ * from the extracted data.
+ *
+ * \param[in] inner_reader A pointer to a cardano_cbor_reader_t that has been initialized and positioned
+ *                         to read the inner content of a Byron address CBOR stream.
+ * \param[out] address A pointer to a pointer of cardano_byron_address_t where the newly created Byron address
+ *                     structure will be stored upon successful extraction.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. Returns CARDANO_SUCCESS if the
+ *         structure is verified and the data is successfully read.
+ */
+cardano_error_t
+_cardano_byron_address_extract_address_components(
+  cardano_cbor_reader_t*    inner_reader,
+  cardano_byron_address_t** address);
+
+/**
+ * \brief Serializes a Byron address into a byte array using Concise Binary Object Representation (CBOR).
+ *
+ * This function takes a Byron address structure and serializes it into a CBOR format. The serialized data
+ * is then wrapped with a self-describe CBOR tag and appended with a CRC32 checksum for integrity verification.
+ *
+ * \param[in] address A pointer to the cardano_address_t structure that represents a Byron address to be serialized.
+ * \param[out] data A pointer to a byte array where the serialized data will be stored.
+ * \param[in,out] size A pointer to a size_t that initially contains the size of the array pointed to by data.
+ *                     After successful execution, it will contain the actual size of the serialized data.
+ * \param[in] data_size The size of the data array in bytes.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. Returns CARDANO_SUCCESS if the
+ *         structure is verified and the data is successfully read.
+ */
+cardano_error_t
+_cardano_pack_byron_address(const cardano_address_t* address, byte_t* data, size_t data_size, size_t* size);
+
+/**
+ * \brief Deserializes a byte array containing a serialized Byron address into a cardano_byron_address_t structure.
+ *
+ * This function takes a byte array containing a serialized Byron address in CBOR format, and deserializes it
+ * into a cardano_byron_address_t structure. It performs validation checks such as CRC32 checksum verification
+ * to ensure the integrity of the serialized data.
+ *
+ * \param[in] data A pointer to a byte array containing the serialized Byron address data in CBOR format.
+ * \param[in] size The size of the serialized data in bytes.
+ * \param[out] cardano_byron A pointer to a pointer to a cardano_byron_address_t structure, where the deserialized
+ *                            Byron address will be stored upon successful execution. The caller is responsible for
+ *                            freeing the memory allocated for this structure.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. Returns CARDANO_SUCCESS if the
+ *         structure is verified and the data is successfully read.
+ */
+cardano_error_t
+_cardano_unpack_byron_address(const byte_t* data, size_t size, cardano_byron_address_t** cardano_byron);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_PACK_H
diff --git a/vendor/src/address/internals/byron_address_content.h b/vendor/src/address/internals/byron_address_content.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/byron_address_content.h
@@ -0,0 +1,60 @@
+/**
+ * \file byron_address_content.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_CONTENT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_CONTENT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/byron_address_attributes.h>
+#include <cardano/address/byron_address_type.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * Byron address internal structure:
+ *
+ * ┌────────┬──────────────┬────────┐
+ * │  root  │  attributes  │  type  │
+ * └────────┴──────────────┴────────┘
+ *   ╎        ╎              ╎
+ *   ╎        ╎              ╰╌╌ PubKey
+ *   ╎        ╎              ╰╌╌ Script
+ *   ╎        ╎              ╰╌╌ Redeem
+ *   ╎        ╰╌╌ Derivation Path
+ *   ╎        ╰╌╌ Network Tag
+ *   ╎
+ *   ╎                   ┌────────┬─────────────────┬──────────────┐
+ *   ╰╌╌╌╌ double-hash ( │  type  │  spending data  │  attributes  │ )
+ *                       └────────┴─────────────────┴──────────────┘
+ *                                  ╎
+ *                                  ╰╌╌ Verification Key
+ *                                  ╰╌╌ Redemption Key
+ */
+typedef struct cardano_byron_address_content_t
+{
+    byte_t                             root[28];
+    cardano_byron_address_attributes_t attributes;
+    cardano_byron_address_type_t       type;
+} cardano_byron_address_content_t;
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BYRON_ADDRESS_CONTENT_H
diff --git a/vendor/src/address/internals/enterprise_addr_pack.c b/vendor/src/address/internals/enterprise_addr_pack.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/enterprise_addr_pack.c
@@ -0,0 +1,100 @@
+/**
+ * \file enterprise_addr_pack.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash_size.h>
+
+#include "addr_common.h"
+#include "enterprise_addr_pack.h"
+
+#include "../../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t ADDRESS_HEADER_SIZE = 1;
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+_cardano_unpack_enterprise_address(const byte_t* data, size_t size, cardano_enterprise_address_t** address)
+{
+  assert(data != NULL);
+  assert(address != NULL);
+
+  if (size < (size_t)((size_t)ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  cardano_address_type_t type       = (cardano_address_type_t)(data[0] >> 4);
+  cardano_network_id_t   network_id = (cardano_network_id_t)(uint8_t)((uint8_t)data[0] & 0x0FU);
+
+  cardano_credential_type_t payment_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+
+  cardano_error_t credential_type_result = _cardano_get_payment_credential_type(type, &payment_type);
+
+  assert(credential_type_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(credential_type_result);
+
+  cardano_credential_t* payment_credential = NULL;
+
+  cardano_error_t credential_result = cardano_credential_from_hash_bytes(
+    &data[ADDRESS_HEADER_SIZE],
+    CARDANO_BLAKE2B_HASH_SIZE_224,
+    payment_type,
+    &payment_credential);
+
+  if (credential_result != CARDANO_SUCCESS)
+  {
+    return credential_result;
+  }
+
+  cardano_error_t enterprise_address_result = cardano_enterprise_address_from_credentials(
+    network_id,
+    payment_credential,
+    address);
+
+  cardano_credential_unref(&payment_credential);
+
+  return enterprise_address_result;
+}
+
+void
+_cardano_pack_enterprise_address(const cardano_address_t* address, byte_t* data, const size_t size)
+{
+  assert(address != NULL);
+  assert(data != NULL);
+  assert(size >= (size_t)((size_t)ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224));
+
+  CARDANO_UNUSED(memset(data, 0, ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224));
+
+  data[0] = ((byte_t)address->type << 4U) | (byte_t)(*address->network_id);
+
+  cardano_safe_memcpy(
+    &data[ADDRESS_HEADER_SIZE],
+    size - ADDRESS_HEADER_SIZE,
+    cardano_credential_get_hash_bytes(address->payment_credential),
+    CARDANO_BLAKE2B_HASH_SIZE_224);
+}
diff --git a/vendor/src/address/internals/enterprise_addr_pack.h b/vendor/src/address/internals/enterprise_addr_pack.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/enterprise_addr_pack.h
@@ -0,0 +1,70 @@
+/**
+ * \file enterprise_addr_pack.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ENTERPRISE_ADDRESS_PACK_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ENTERPRISE_ADDRESS_PACK_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address_type.h>
+#include <cardano/address/enterprise_address.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Packs a Cardano enterprise address into a byte array.
+ *
+ * This function takes a Cardano enterprise address and encodes it into a byte array format.
+ *
+ * \param[in] address Pointer to the Cardano enterprise address structure to be packed.
+ * \param[out] data Pointer to the byte array where the packed address will be stored.
+ * \param[in] size Size of the data byte array in bytes.
+ *
+ * \note This function assumes that the `data` buffer has enough space to hold the packed
+ *       address. The caller is responsible for ensuring that there is sufficient space
+ *       and for managing the memory of the `data` buffer.
+ */
+void
+_cardano_pack_enterprise_address(const cardano_address_t* address, byte_t* data, size_t size);
+
+/**
+ * \brief Unpacks a byte array into a Cardano enterprise address structure.
+ *
+ * This function takes a byte array containing the serialized form of a Cardano enterprise address
+ * and decodes it into a Cardano enterprise address structure.
+ *
+ * \param[in] data Pointer to the byte array containing the serialized Cardano enterprise address.
+ * \param[in] size Size of the byte array in bytes.
+ * \param[out] address Double pointer to where the newly created Cardano enterprise address structure will be stored.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the unpacking is successful. Returns an error code if
+ *         the unpacking fails due to invalid format, insufficient data provided, or memory allocation issues.
+ *
+ * \note The caller is responsible for managing the lifecycle of the created Cardano enterprise address object.
+ *       This includes deallocating the address structure using the appropriate function when it is no longer needed.
+ */
+cardano_error_t
+_cardano_unpack_enterprise_address(const byte_t* data, size_t size, cardano_enterprise_address_t** address);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ENTERPRISE_ADDRESS_PACK_H
diff --git a/vendor/src/address/internals/pointer_addr_pack.c b/vendor/src/address/internals/pointer_addr_pack.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/pointer_addr_pack.c
@@ -0,0 +1,239 @@
+/**
+ * \file pointer_addr_pack.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/stake_pointer.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+
+#include "../../allocators.h"
+#include "addr_common.h"
+#include "pointer_addr_pack.h"
+
+#include "../../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t ADDRESS_HEADER_SIZE = 1;
+
+/* IMPLEMENTATION ************************************************************/
+
+size_t
+_cardano_pointer_address_variable_length_encode(uint32_t value, byte_t* buffer, size_t buffer_size)
+{
+  assert(buffer != NULL);
+  assert(buffer_size >= 10U);
+
+  size_t   output_size    = 0;
+  uint32_t remaining      = value;
+  byte_t   tmp_buffer[10] = { 0 };
+
+  tmp_buffer[output_size] = ((uint8_t)(remaining & 127U));
+  ++output_size;
+
+  while (remaining > 127U)
+  {
+    if (output_size >= buffer_size)
+    {
+      return 0;
+    }
+
+    remaining               >>= 7U;
+    tmp_buffer[output_size] = ((uint8_t)(remaining & 127U)) | 128U;
+
+    ++output_size;
+  }
+
+  for (size_t i = 0; i < output_size; ++i)
+  {
+    buffer[i] = tmp_buffer[output_size - i - 1U];
+  }
+
+  return output_size;
+}
+
+int64_t
+_cardano_pointer_address_variable_length_decode(const byte_t* array, size_t total_bytes, size_t size, size_t* bytes_read)
+{
+  assert(array != NULL);
+  assert(bytes_read != NULL);
+
+  uint32_t value = 0;
+  *bytes_read    = 0;
+  byte_t byte    = 0;
+
+  do
+  {
+    if (((*bytes_read) + total_bytes) >= size)
+    {
+      return -1;
+    }
+
+    byte  = array[*bytes_read];
+    value = (value << 7U) | (byte & 127U);
+
+    ++(*bytes_read);
+  }
+  while ((byte & 128U) > 0U);
+
+  return value;
+}
+
+cardano_error_t
+_cardano_unpack_pointer_address(const byte_t* data, const size_t size, cardano_pointer_address_t** address)
+{
+  assert(data != NULL);
+  assert(address != NULL);
+
+  if (size < (size_t)(((size_t)ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224 + 1U)))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  cardano_address_type_t type       = (cardano_address_type_t)(data[0] >> 4);
+  cardano_network_id_t   network_id = (cardano_network_id_t)(uint8_t)((uint8_t)data[0] & 0x0FU);
+
+  cardano_credential_type_t payment_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+
+  cardano_error_t credential_type_result = _cardano_get_payment_credential_type(type, &payment_type);
+
+  assert(credential_type_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(credential_type_result);
+
+  cardano_credential_t* payment_credential = NULL;
+
+  cardano_error_t credential_result = cardano_credential_from_hash_bytes(
+    &data[ADDRESS_HEADER_SIZE],
+    CARDANO_BLAKE2B_HASH_SIZE_224,
+    payment_type,
+    &payment_credential);
+
+  if (credential_result != CARDANO_SUCCESS)
+  {
+    return credential_result;
+  }
+
+  cardano_stake_pointer_t stake_pointer = { 0 };
+
+  size_t bytes_read  = 0;
+  size_t total_bytes = ADDRESS_HEADER_SIZE + (int64_t)CARDANO_BLAKE2B_HASH_SIZE_224;
+
+  const int64_t slot = _cardano_pointer_address_variable_length_decode(&data[total_bytes], total_bytes, size, &bytes_read);
+
+  if (slot < 0)
+  {
+    cardano_credential_unref(&payment_credential);
+
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  stake_pointer.slot = (size_t)slot;
+
+  total_bytes += bytes_read;
+  bytes_read  = 0;
+
+  const int64_t tx_index = _cardano_pointer_address_variable_length_decode(&data[total_bytes], total_bytes, size, &bytes_read);
+
+  if (tx_index < 0)
+  {
+    cardano_credential_unref(&payment_credential);
+
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  stake_pointer.tx_index = (size_t)tx_index;
+
+  total_bytes += bytes_read;
+  bytes_read  = 0;
+
+  const int64_t cert_index = _cardano_pointer_address_variable_length_decode(&data[total_bytes], total_bytes, size, &bytes_read);
+
+  if (cert_index < 0)
+  {
+    cardano_credential_unref(&payment_credential);
+
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  stake_pointer.cert_index = (size_t)cert_index;
+
+  cardano_error_t pointer_address_result = cardano_pointer_address_from_credentials(
+    network_id,
+    payment_credential,
+    stake_pointer,
+    address);
+
+  cardano_credential_unref(&payment_credential);
+
+  return pointer_address_result;
+}
+
+int64_t
+_cardano_pack_pointer_address(const cardano_address_t* address, byte_t* data, const size_t size)
+{
+  assert(address != NULL);
+  assert(data != NULL);
+
+  data[0] = ((byte_t)address->type << 4U) | (byte_t)(*address->network_id);
+
+  cardano_safe_memcpy(
+    &data[ADDRESS_HEADER_SIZE],
+    size - (size_t)ADDRESS_HEADER_SIZE,
+    cardano_credential_get_hash_bytes(address->payment_credential),
+    CARDANO_BLAKE2B_HASH_SIZE_224);
+
+  int64_t total_bytes   = (int64_t)(ADDRESS_HEADER_SIZE + (int64_t)CARDANO_BLAKE2B_HASH_SIZE_224);
+  size_t  bytes_written = 0;
+  byte_t  buffer[10]    = { 0 };
+
+  bytes_written = _cardano_pointer_address_variable_length_encode((uint32_t)address->stake_pointer->slot, buffer, 10);
+
+  cardano_safe_memcpy(
+    &data[total_bytes],
+    size - (size_t)total_bytes,
+    buffer,
+    bytes_written);
+
+  total_bytes += (int64_t)bytes_written;
+
+  bytes_written = _cardano_pointer_address_variable_length_encode((uint32_t)address->stake_pointer->tx_index, buffer, 10);
+
+  cardano_safe_memcpy(
+    &data[total_bytes],
+    size - (size_t)total_bytes,
+    buffer,
+    bytes_written);
+
+  total_bytes += (int64_t)bytes_written;
+
+  bytes_written = _cardano_pointer_address_variable_length_encode((uint32_t)address->stake_pointer->cert_index, buffer, 10);
+
+  cardano_safe_memcpy(
+    &data[total_bytes],
+    size - (size_t)total_bytes,
+    buffer,
+    bytes_written);
+
+  return (int64_t)total_bytes + (int64_t)bytes_written;
+}
diff --git a/vendor/src/address/internals/pointer_addr_pack.h b/vendor/src/address/internals/pointer_addr_pack.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/pointer_addr_pack.h
@@ -0,0 +1,117 @@
+/**
+ * \file pointer_addr_pack.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_pointer_ADDRESS_PACK_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_pointer_ADDRESS_PACK_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address_type.h>
+#include <cardano/address/pointer_address.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Encodes an unsigned 32-bit integer using variable-length encoding.
+ *
+ * This function implements variable-length encoding which optimizes space for smaller values.
+ * Each byte in the encoded output holds seven bits of the integer, with the eighth bit (most
+ * significant bit) used as a continuation flag. The continuation flag is set (1) to indicate
+ * that another byte follows or cleared (0) if it is the last byte of the sequence.
+ *
+ * \param value         The unsigned 32-bit integer to be encoded.
+ * \param buffer        A pointer to the buffer where the encoded bytes are to be stored.
+ * \param buffer_size   The size of the provided buffer, which must be at least 10 bytes to
+ *                      accommodate the maximum possible encoded size.
+ *
+ * \return The number of bytes used in the buffer to store the encoded integer, or 0 if an error occurred
+ *         (e.g., buffer size is insufficient).
+ */
+size_t
+_cardano_pointer_address_variable_length_encode(uint32_t value, byte_t* buffer, size_t buffer_size);
+
+/**
+ * \brief Decodes a value that was encoded using a variable-length encoding scheme.
+ *
+ * This function reads bytes from the input array, reconstructing the original unsigned integer.
+ * Each byte in the array contributes seven bits to the output value.
+ *
+ * The most significant bit of each byte acts as a continuation flag:
+ *
+ * if set (1), the function continues to read the next byte; if cleared (0), it
+ * indicates that this is the last byte of the encoded value. The function assumes the bytes are
+ * provided in little-endian order, with the least significant byte first.
+ *
+ * \param array Pointer to the byte array containing the encoded data. This pointer must not be NULL.
+ * \param size The total size of the input array. This should be at least the number of bytes that
+ *             the encoded value occupies.
+ * \param total_bytes The number of bytes read so far into the array.
+ * \param bytes_read Pointer to a size_t variable where the number of bytes read from the array will
+ *                   be stored. This parameter cannot be NULL and will be set even if the function
+ *                   returns an error, unless the error is due to a NULL pointer.
+ *
+ * \return Returns the decoded value or -1 if an error occurs.
+ */
+int64_t
+_cardano_pointer_address_variable_length_decode(const byte_t* array, size_t total_bytes, size_t size, size_t* bytes_read);
+
+/**
+ * \brief Packs a Cardano pointer address into a byte array.
+ *
+ * This function takes a Cardano pointer address and encodes it into a byte array format.
+ *
+ * \param[in] address Pointer to the Cardano pointer address structure to be packed.
+ * \param[out] data Pointer to the byte array where the packed address will be stored.
+ * \param[in] size Size of the data byte array in bytes.
+ *
+ * \note This function assumes that the `data` buffer has enough space to hold the packed
+ *       address. The caller is responsible for ensuring that there is sufficient space
+ *       and for managing the memory of the `data` buffer.
+ *
+ * \return Returns the number of bytes written to the `data` buffer. If an error occurs,
+ *        the return value will be less than zero.
+ */
+int64_t
+_cardano_pack_pointer_address(const cardano_address_t* address, byte_t* data, size_t size);
+
+/**
+ * \brief Unpacks a byte array into a Cardano pointer address structure.
+ *
+ * This function takes a byte array containing the serialized form of a Cardano pointer address
+ * and decodes it into a Cardano pointer address structure.
+ *
+ * \param[in] data Pointer to the byte array containing the serialized Cardano pointer address.
+ * \param[in] size Size of the byte array in bytes.
+ * \param[out] address Double pointer to where the newly created Cardano pointer address structure will be stored.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the unpacking is successful. Returns an error code if
+ *         the unpacking fails due to invalid format, insufficient data provided, or memory allocation issues.
+ *
+ * \note The caller is responsible for managing the lifecycle of the created Cardano pointer address object.
+ *       This includes deallocating the address structure using the appropriate function when it is no longer needed.
+ */
+cardano_error_t
+_cardano_unpack_pointer_address(const byte_t* data, size_t size, cardano_pointer_address_t** address);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_pointer_ADDRESS_PACK_H
diff --git a/vendor/src/address/internals/reward_addr_pack.c b/vendor/src/address/internals/reward_addr_pack.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/reward_addr_pack.c
@@ -0,0 +1,101 @@
+/**
+ * \file reward_addr_pack.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash_size.h>
+
+#include "addr_common.h"
+#include "reward_addr_pack.h"
+
+#include "../../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t ADDRESS_HEADER_SIZE = 1;
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+_cardano_unpack_reward_address(const byte_t* data, size_t size, cardano_reward_address_t** address)
+{
+  assert(data != NULL);
+  assert(address != NULL);
+
+  if (size < (ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  cardano_address_type_t type       = (cardano_address_type_t)(data[0] >> 4);
+  cardano_network_id_t   network_id = (cardano_network_id_t)(uint8_t)((uint8_t)data[0] & 0x0FU);
+
+  cardano_credential_type_t payment_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+
+  cardano_error_t credential_type_result = _cardano_get_payment_credential_type(type, &payment_type);
+
+  if (credential_type_result != CARDANO_SUCCESS)
+  {
+    return credential_type_result;
+  }
+
+  cardano_credential_t* payment_credential = NULL;
+
+  cardano_error_t credential_result = cardano_credential_from_hash_bytes(
+    &data[ADDRESS_HEADER_SIZE],
+    CARDANO_BLAKE2B_HASH_SIZE_224,
+    payment_type,
+    &payment_credential);
+
+  if (credential_result != CARDANO_SUCCESS)
+  {
+    return credential_result;
+  }
+
+  cardano_error_t reward_address_result = cardano_reward_address_from_credentials(
+    network_id,
+    payment_credential,
+    address);
+
+  cardano_credential_unref(&payment_credential);
+
+  return reward_address_result;
+}
+
+void
+_cardano_pack_reward_address(const cardano_address_t* address, byte_t* data, const size_t size)
+{
+  assert(address != NULL);
+  assert(data != NULL);
+
+  CARDANO_UNUSED(memset(data, 0, ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224));
+
+  data[0] = ((byte_t)address->type << 4U) | (byte_t)(*address->network_id);
+
+  cardano_safe_memcpy(
+    &data[ADDRESS_HEADER_SIZE],
+    size - ADDRESS_HEADER_SIZE,
+    cardano_credential_get_hash_bytes(address->payment_credential),
+    CARDANO_BLAKE2B_HASH_SIZE_224);
+}
diff --git a/vendor/src/address/internals/reward_addr_pack.h b/vendor/src/address/internals/reward_addr_pack.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/internals/reward_addr_pack.h
@@ -0,0 +1,70 @@
+/**
+ * \file reward_addr_pack.h
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_REWARD_ADDRESS_PACK_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_REWARD_ADDRESS_PACK_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address_type.h>
+#include <cardano/address/reward_address.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Packs a Cardano reward address into a byte array.
+ *
+ * This function takes a Cardano reward address and encodes it into a byte array format.
+ *
+ * \param[in] address reward to the Cardano reward address structure to be packed.
+ * \param[out] data reward to the byte array where the packed address will be stored.
+ * \param[in] size Size of the data byte array in bytes
+ *
+ * \note This function assumes that the `data` buffer has enough space to hold the packed
+ *       address. The caller is responsible for ensuring that there is sufficient space
+ *       and for managing the memory of the `data` buffer.
+ */
+void
+_cardano_pack_reward_address(const cardano_address_t* address, byte_t* data, size_t size);
+
+/**
+ * \brief Unpacks a byte array into a Cardano reward address structure.
+ *
+ * This function takes a byte array containing the serialized form of a Cardano reward address
+ * and decodes it into a Cardano reward address structure.
+ *
+ * \param[in] data reward to the byte array containing the serialized Cardano reward address.
+ * \param[in] size Size of the byte array in bytes.
+ * \param[out] address Double reward to where the newly created Cardano reward address structure will be stored.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the unpacking is successful. Returns an error code if
+ *         the unpacking fails due to invalid format, insufficient data provided, or memory allocation issues.
+ *
+ * \note The caller is responsible for managing the lifecycle of the created Cardano reward address object.
+ *       This includes deallocating the address structure using the appropriate function when it is no longer needed.
+ */
+cardano_error_t
+_cardano_unpack_reward_address(const byte_t* data, size_t size, cardano_reward_address_t** address);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_REWARD_ADDRESS_PACK_H
diff --git a/vendor/src/address/pointer_address.c b/vendor/src/address/pointer_address.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/pointer_address.c
@@ -0,0 +1,400 @@
+/**
+ * \file pointer_address.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/address/pointer_address.h>
+#include <cardano/encoding/bech32.h>
+#include <cardano/error.h>
+
+#include "../allocators.h"
+#include "./internals/addr_common.h"
+#include "./internals/pointer_addr_pack.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t ADDRESS_HEADER_SIZE = 1;
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_pointer_address_from_credentials(
+  const cardano_network_id_t    network_id,
+  cardano_credential_t*         payment,
+  const cardano_stake_pointer_t pointer,
+  cardano_pointer_address_t**   pointer_address)
+{
+  if (payment == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pointer_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *pointer_address = NULL;
+
+  cardano_address_t* address = _cardano_malloc(sizeof(cardano_address_t));
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  address->base.ref_count     = 1;
+  address->base.last_error[0] = '\0';
+  address->base.deallocator   = _cardano_address_deallocate;
+
+  cardano_credential_type_t credential_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+
+  const cardano_error_t get_type_result = cardano_credential_get_type(payment, &credential_type);
+  assert(get_type_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(get_type_result);
+
+  address->type =
+    (credential_type == CARDANO_CREDENTIAL_TYPE_KEY_HASH)
+    ? CARDANO_ADDRESS_TYPE_POINTER_KEY
+    : CARDANO_ADDRESS_TYPE_POINTER_SCRIPT;
+
+  address->network_id = _cardano_malloc(sizeof(cardano_network_id_t));
+
+  if (address->network_id == NULL)
+  {
+    _cardano_free(address);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  address->stake_pointer = _cardano_malloc(sizeof(cardano_stake_pointer_t));
+
+  if (address->stake_pointer == NULL)
+  {
+    _cardano_free(address->network_id);
+    _cardano_free(address);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *address->network_id        = network_id;
+  address->payment_credential = payment;
+  address->stake_credential   = NULL;
+  address->byron_content      = NULL;
+  *address->stake_pointer     = pointer;
+  address->address_data_size  = _cardano_pack_pointer_address(address, address->address_data, sizeof(address->address_data));
+
+  cardano_credential_ref(payment);
+
+  const cardano_error_t encoding_result = _cardano_to_bech32_addr(
+    address->address_data,
+    address->address_data_size,
+    network_id,
+    address->type,
+    address->address_str,
+    1024);
+
+  if (encoding_result != CARDANO_SUCCESS)
+  {
+    _cardano_address_deallocate(address);
+    return encoding_result;
+  }
+
+  *pointer_address = _cardano_from_address_to_pointer(address);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pointer_address_from_address(
+  const cardano_address_t*    address,
+  cardano_pointer_address_t** pointer_address)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pointer_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (
+    (address->type != CARDANO_ADDRESS_TYPE_POINTER_KEY) &&
+    (address->type != CARDANO_ADDRESS_TYPE_POINTER_SCRIPT))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_TYPE;
+  }
+
+  cardano_address_t*    address_copy = NULL;
+  const cardano_error_t copy_result  = cardano_address_from_bytes(address->address_data, address->address_data_size, &address_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return copy_result;
+  }
+
+  *pointer_address = _cardano_from_address_to_pointer(address_copy);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_address_t*
+cardano_pointer_address_to_address(const cardano_pointer_address_t* pointer_address)
+{
+  if (pointer_address == NULL)
+  {
+    return NULL;
+  }
+
+  const cardano_address_t* address = _cardano_from_pointer_to_address_const(pointer_address);
+
+  cardano_address_t*    address_copy = NULL;
+  const cardano_error_t copy_result  = cardano_address_from_bytes(address->address_data, address->address_data_size, &address_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return address_copy;
+}
+
+cardano_credential_t*
+cardano_pointer_address_get_payment_credential(
+  cardano_pointer_address_t* pointer_address)
+{
+  if (pointer_address == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_address_t* address = _cardano_from_pointer_to_address(pointer_address);
+
+  cardano_credential_ref(address->payment_credential);
+
+  return address->payment_credential;
+}
+
+cardano_error_t
+cardano_pointer_address_get_stake_pointer(const cardano_pointer_address_t* pointer_address, cardano_stake_pointer_t* stake_pointer)
+{
+  if (pointer_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const cardano_address_t* address = _cardano_from_pointer_to_address_const(pointer_address);
+
+  *stake_pointer = *address->stake_pointer;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pointer_address_from_bytes(
+  const byte_t*               data,
+  const size_t                size,
+  cardano_pointer_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return _cardano_unpack_pointer_address(data, size, address);
+}
+
+size_t
+cardano_pointer_address_get_bytes_size(const cardano_pointer_address_t* address)
+{
+  return cardano_address_get_bytes_size(_cardano_from_pointer_to_address_const(address));
+}
+
+const byte_t*
+cardano_pointer_address_get_bytes(const cardano_pointer_address_t* address)
+{
+  return cardano_address_get_bytes(_cardano_from_pointer_to_address_const(address));
+}
+
+cardano_error_t
+cardano_pointer_address_to_bytes(
+  const cardano_pointer_address_t* address,
+  byte_t*                          data,
+  const size_t                     size)
+{
+  return cardano_address_to_bytes(_cardano_from_pointer_to_address_const(address), data, size);
+}
+
+cardano_error_t
+cardano_pointer_address_from_bech32(
+  const char*                 data,
+  const size_t                size,
+  cardano_pointer_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t       hrp_size  = 0;
+  const size_t data_size = cardano_encoding_bech32_get_decoded_length(data, size, &hrp_size);
+
+  if ((hrp_size == 0U) || (data_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  char* hrp = _cardano_malloc(hrp_size);
+
+  if (hrp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  byte_t* decoded_data = _cardano_malloc(data_size);
+
+  if (decoded_data == NULL)
+  {
+    _cardano_free(hrp);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t decode_result = cardano_encoding_bech32_decode(data, size, hrp, hrp_size, decoded_data, data_size);
+
+  if (decode_result != CARDANO_SUCCESS)
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return decode_result;
+  }
+
+  if (!_cardano_is_valid_payment_address_prefix(hrp, hrp_size))
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  const cardano_error_t unpack_result = _cardano_unpack_pointer_address(decoded_data, data_size, address);
+
+  _cardano_free(hrp);
+  _cardano_free(decoded_data);
+
+  return unpack_result;
+}
+
+size_t
+cardano_pointer_address_get_bech32_size(const cardano_pointer_address_t* address)
+{
+  return cardano_address_get_string_size(_cardano_from_pointer_to_address_const(address));
+}
+
+cardano_error_t
+cardano_pointer_address_to_bech32(
+  const cardano_pointer_address_t* address,
+  char*                            data,
+  const size_t                     size)
+{
+  return cardano_address_to_string(_cardano_from_pointer_to_address_const(address), data, size);
+}
+
+const char*
+cardano_pointer_address_get_string(const cardano_pointer_address_t* address)
+{
+  return cardano_address_get_string(_cardano_from_pointer_to_address_const(address));
+}
+
+cardano_error_t
+cardano_pointer_address_get_network_id(const cardano_pointer_address_t* address, cardano_network_id_t* network_id)
+{
+  return cardano_address_get_network_id(_cardano_from_pointer_to_address_const(address), network_id);
+}
+
+void
+cardano_pointer_address_unref(cardano_pointer_address_t** address)
+{
+  cardano_address_unref(_cardano_from_pointer_pointer_to_address_pointer(address));
+}
+
+void
+cardano_pointer_address_ref(cardano_pointer_address_t* address)
+{
+  cardano_address_ref(_cardano_from_pointer_to_address(address));
+}
+
+size_t
+cardano_pointer_address_refcount(const cardano_pointer_address_t* address)
+{
+  return cardano_address_refcount(_cardano_from_pointer_to_address_const(address));
+}
+
+void
+cardano_pointer_address_set_last_error(cardano_pointer_address_t* address, const char* message)
+{
+  cardano_address_set_last_error(_cardano_from_pointer_to_address(address), message);
+}
+
+const char*
+cardano_pointer_address_get_last_error(const cardano_pointer_address_t* address)
+{
+  return cardano_address_get_last_error(_cardano_from_pointer_to_address_const(address));
+}
+
+cardano_error_t
+cardano_pointer_address_deep_clone(const cardano_pointer_address_t* source, cardano_pointer_address_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone                       = NULL;
+  cardano_address_t*    copy   = NULL;
+  const cardano_error_t result = cardano_address_deep_clone((const cardano_address_t*)((const void*)source), &copy);
+
+  *clone = (cardano_pointer_address_t*)((void*)copy);
+
+  return result;
+}
diff --git a/vendor/src/address/reward_address.c b/vendor/src/address/reward_address.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/address/reward_address.c
@@ -0,0 +1,379 @@
+/**
+ * \file reward_address.c
+ *
+ * \author angel.castillo
+ * \date   Apr 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/address/reward_address.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/encoding/bech32.h>
+#include <cardano/error.h>
+
+#include "../allocators.h"
+#include "./internals/addr_common.h"
+#include "./internals/reward_addr_pack.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t ADDRESS_HEADER_SIZE = 1;
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_reward_address_from_credentials(
+  const cardano_network_id_t network_id,
+  cardano_credential_t*      credential,
+  cardano_reward_address_t** reward_address)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *reward_address = NULL;
+
+  cardano_address_t* address = _cardano_malloc(sizeof(cardano_address_t));
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  address->base.ref_count     = 1;
+  address->base.last_error[0] = '\0';
+  address->base.deallocator   = _cardano_address_deallocate;
+
+  cardano_credential_type_t credential_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+
+  const cardano_error_t get_type_result = cardano_credential_get_type(credential, &credential_type);
+  assert(get_type_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(get_type_result);
+
+  address->type =
+    (credential_type == CARDANO_CREDENTIAL_TYPE_KEY_HASH)
+    ? CARDANO_ADDRESS_TYPE_REWARD_KEY
+    : CARDANO_ADDRESS_TYPE_REWARD_SCRIPT;
+
+  address->network_id = _cardano_malloc(sizeof(cardano_network_id_t));
+
+  if (address->network_id == NULL)
+  {
+    _cardano_free(address);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *address->network_id        = network_id;
+  address->payment_credential = credential;
+  address->stake_credential   = NULL;
+  address->byron_content      = NULL;
+  address->stake_pointer      = NULL;
+  address->address_data_size  = ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224;
+
+  _cardano_pack_reward_address(address, address->address_data, sizeof(address->address_data));
+  cardano_credential_ref(credential);
+
+  const cardano_error_t encoding_result = _cardano_to_bech32_addr(
+    address->address_data,
+    address->address_data_size,
+    network_id,
+    address->type,
+    address->address_str,
+    1024);
+
+  if (encoding_result != CARDANO_SUCCESS)
+  {
+    _cardano_address_deallocate(address);
+    return encoding_result;
+  }
+
+  *reward_address = _cardano_from_address_to_reward(address);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_reward_address_from_address(
+  const cardano_address_t*   address,
+  cardano_reward_address_t** reward_address)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (
+    (address->type != CARDANO_ADDRESS_TYPE_REWARD_KEY) &&
+    (address->type != CARDANO_ADDRESS_TYPE_REWARD_SCRIPT))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_TYPE;
+  }
+
+  cardano_address_t*    address_copy = NULL;
+  const cardano_error_t copy_result  = cardano_address_from_bytes(address->address_data, address->address_data_size, &address_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return copy_result;
+  }
+
+  *reward_address = _cardano_from_address_to_reward(address_copy);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_address_t*
+cardano_reward_address_to_address(const cardano_reward_address_t* reward_address)
+{
+  if (reward_address == NULL)
+  {
+    return NULL;
+  }
+
+  const cardano_address_t* address = _cardano_from_reward_to_address_const(reward_address);
+
+  cardano_address_t*    address_copy = NULL;
+  const cardano_error_t copy_result  = cardano_address_from_bytes(address->address_data, address->address_data_size, &address_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return address_copy;
+}
+
+cardano_credential_t*
+cardano_reward_address_get_credential(cardano_reward_address_t* reward_address)
+{
+  if (reward_address == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_address_t* address = _cardano_from_reward_to_address(reward_address);
+
+  cardano_credential_ref(address->payment_credential);
+
+  return address->payment_credential;
+}
+
+cardano_error_t
+cardano_reward_address_from_bytes(
+  const byte_t*              data,
+  const size_t               size,
+  cardano_reward_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size < (ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return _cardano_unpack_reward_address(data, size, address);
+}
+
+size_t
+cardano_reward_address_get_bytes_size(const cardano_reward_address_t* address)
+{
+  return cardano_address_get_bytes_size(_cardano_from_reward_to_address_const(address));
+}
+
+const byte_t*
+cardano_reward_address_get_bytes(const cardano_reward_address_t* address)
+{
+  return cardano_address_get_bytes(_cardano_from_reward_to_address_const(address));
+}
+
+cardano_error_t
+cardano_reward_address_to_bytes(
+  const cardano_reward_address_t* address,
+  byte_t*                         data,
+  const size_t                    size)
+{
+  return cardano_address_to_bytes(_cardano_from_reward_to_address_const(address), data, size);
+}
+
+cardano_error_t
+cardano_reward_address_from_bech32(
+  const char*                data,
+  const size_t               size,
+  cardano_reward_address_t** address)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t       hrp_size  = 0;
+  const size_t data_size = cardano_encoding_bech32_get_decoded_length(data, size, &hrp_size);
+
+  if (data_size < (ADDRESS_HEADER_SIZE + (size_t)CARDANO_BLAKE2B_HASH_SIZE_224))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  char* hrp = _cardano_malloc(hrp_size);
+
+  if (hrp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  byte_t* decoded_data = _cardano_malloc(data_size);
+
+  if (decoded_data == NULL)
+  {
+    _cardano_free(hrp);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t decode_result = cardano_encoding_bech32_decode(data, size, hrp, hrp_size, decoded_data, data_size);
+
+  if (decode_result != CARDANO_SUCCESS)
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return decode_result;
+  }
+
+  if (!_cardano_is_valid_stake_address_prefix(hrp, hrp_size))
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  const cardano_error_t unpack_result = _cardano_unpack_reward_address(decoded_data, data_size, address);
+
+  _cardano_free(hrp);
+  _cardano_free(decoded_data);
+
+  return unpack_result;
+}
+
+size_t
+cardano_reward_address_get_bech32_size(const cardano_reward_address_t* address)
+{
+  return cardano_address_get_string_size(_cardano_from_reward_to_address_const(address));
+}
+
+cardano_error_t
+cardano_reward_address_to_bech32(
+  const cardano_reward_address_t* address,
+  char*                           data,
+  const size_t                    size)
+{
+  return cardano_address_to_string(_cardano_from_reward_to_address_const(address), data, size);
+}
+
+const char*
+cardano_reward_address_get_string(const cardano_reward_address_t* address)
+{
+  return cardano_address_get_string(_cardano_from_reward_to_address_const(address));
+}
+
+cardano_error_t
+cardano_reward_address_get_network_id(const cardano_reward_address_t* address, cardano_network_id_t* network_id)
+{
+  return cardano_address_get_network_id(_cardano_from_reward_to_address_const(address), network_id);
+}
+
+void
+cardano_reward_address_unref(cardano_reward_address_t** address)
+{
+  cardano_address_unref(_cardano_from_reward_pointer_to_address_pointer(address));
+}
+
+void
+cardano_reward_address_ref(cardano_reward_address_t* address)
+{
+  cardano_address_ref(_cardano_from_reward_to_address(address));
+}
+
+size_t
+cardano_reward_address_refcount(const cardano_reward_address_t* address)
+{
+  return cardano_address_refcount(_cardano_from_reward_to_address_const(address));
+}
+
+void
+cardano_reward_address_set_last_error(cardano_reward_address_t* address, const char* message)
+{
+  cardano_address_set_last_error(_cardano_from_reward_to_address(address), message);
+}
+
+const char*
+cardano_reward_address_get_last_error(const cardano_reward_address_t* address)
+{
+  return cardano_address_get_last_error(_cardano_from_reward_to_address_const(address));
+}
+
+cardano_error_t
+cardano_reward_address_deep_clone(const cardano_reward_address_t* source, cardano_reward_address_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone                       = NULL;
+  cardano_address_t*    copy   = NULL;
+  const cardano_error_t result = cardano_address_deep_clone((const cardano_address_t*)((const void*)source), &copy);
+
+  *clone = (cardano_reward_address_t*)((void*)copy);
+
+  return result;
+}
diff --git a/vendor/src/allocators.c b/vendor/src/allocators.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/allocators.c
@@ -0,0 +1,58 @@
+/**
+ * \file allocators.c
+ *
+ * \author luisd.bianchi
+ * \date   Mar 11, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "allocators.h"
+
+#include <stdlib.h>
+
+/* DEFINITIONS ***************************************************************/
+
+static _cardano_malloc_t  s_cardano_malloc  = malloc;
+static _cardano_realloc_t s_cardano_realloc = realloc;
+static _cardano_free_t    s_cardano_free    = free;
+
+void*
+_cardano_malloc(size_t size)
+{
+  return s_cardano_malloc(size);
+}
+
+void*
+_cardano_realloc(void* ptr, size_t size)
+{
+  return s_cardano_realloc(ptr, size);
+}
+
+void
+_cardano_free(void* ptr)
+{
+  s_cardano_free(ptr);
+}
+
+void
+cardano_set_allocators(_cardano_malloc_t custom_malloc, _cardano_realloc_t custom_realloc, _cardano_free_t custom_free)
+{
+  s_cardano_malloc  = custom_malloc;
+  s_cardano_realloc = custom_realloc;
+  s_cardano_free    = custom_free;
+}
diff --git a/vendor/src/allocators.h b/vendor/src/allocators.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/allocators.h
@@ -0,0 +1,113 @@
+/**
+ * \file allocators.h
+ *
+ * \author luisd.bianchi
+ * \date   Mar 11, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ALLOCATORS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ALLOCATORS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Function pointer type for custom memory allocation.
+ *
+ * This typedef defines a custom function signature for memory allocation. Functions matching this
+ * signature can be used to replace the standard malloc function.
+ *
+ * \param size The size in bytes to allocate.
+ * \return A pointer to the allocated memory, or NULL if the allocation fails.
+ */
+typedef void* (*_cardano_malloc_t)(size_t size);
+
+/**
+ * \brief Function pointer type for custom memory reallocation.
+ *
+ * Defines a custom function signature for reallocating memory. Functions with this signature can be used
+ * to replace the standard realloc function.
+ *
+ * \param ptr Pointer to the previously allocated memory block.
+ * \param size The new size in bytes for the memory block.
+ * \return A pointer to the reallocated memory, or NULL if the reallocation fails.
+ */
+typedef void* (*_cardano_realloc_t)(void* ptr, size_t size);
+
+/**
+ * \brief Function pointer type for custom memory deallocation.
+ *
+ * Defines a custom function signature for freeing allocated memory. Functions that match this signature
+ * can replace the standard free function.
+ *
+ * \param ptr Pointer to the memory block to be freed.
+ */
+typedef void (*_cardano_free_t)(void* ptr);
+
+/**
+ * \brief Function used for custom memory allocation.
+ *
+ * User-defined function that allocates memory, following the _cardano_malloc_t signature.
+ */
+CARDANO_EXPORT void* _cardano_malloc(size_t size);
+
+/**
+ * \brief Pointer to a function used for custom memory reallocation.
+ *
+ * User-defined function for reallocating memory, conforming to the _cardano_realloc_t signature.
+ */
+CARDANO_EXPORT void* _cardano_realloc(void* ptr, size_t size);
+
+/**
+ * \brief Pointer to a function used for custom memory deallocation.
+ *
+ * User-defined function that frees allocated memory, according to the _cardano_free_t signature.
+ */
+CARDANO_EXPORT void _cardano_free(void* ptr);
+
+/**
+ * \brief Sets the memory management routines to use.
+ *
+ * By default, libcardano-c will use the standard library `malloc`, `realloc`, and `free`.
+ *
+ * \warning This function modifies the global state and should therefore be used with caution.
+ * Changing the memory handlers while allocated items exist will result in a `free`/`malloc` mismatch.
+ * This function is not thread-safe with respect to both itself and all other libcardano-c functions
+ * that work with the heap.
+ *
+ * \note The `realloc` implementation must correctly support `NULL` reallocation
+ * (see [realloc documentation](http://en.cppreference.com/w/c/memory/realloc)).
+ *
+ * \param custom_malloc  Function pointer to the custom malloc implementation.
+ * \param custom_realloc Function pointer to the custom realloc implementation.
+ * \param custom_free    Function pointer to the custom free implementation.
+ */
+CARDANO_EXPORT void cardano_set_allocators(_cardano_malloc_t custom_malloc, _cardano_realloc_t custom_realloc, _cardano_free_t custom_free);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ALLOCATORS_H
diff --git a/vendor/src/assets/asset_id.c b/vendor/src/assets/asset_id.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/assets/asset_id.c
@@ -0,0 +1,502 @@
+/**
+ * \file asset_id.c
+ *
+ * \author angel.castillo
+ * \date   Sept 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <sodium/core.h>
+#include <sodium/utils.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an asset identifier in the Cardano blockchain.
+ *
+ * The `cardano_asset_id_t` structure encapsulates the unique identification of a native asset on the Cardano blockchain.
+ * Each asset is uniquely identified by a combination of its policy ID and asset name.
+ */
+typedef struct cardano_asset_id_t
+{
+    cardano_object_t        base;
+    cardano_blake2b_hash_t* policy_id;
+    cardano_asset_name_t*   asset_name;
+    bool                    is_lovelace;
+    byte_t                  data[60];
+    size_t                  size;
+    char                    hex[121];
+    size_t                  hex_size;
+} cardano_asset_id_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a asset id object.
+ *
+ * This function is responsible for properly deallocating a asset id object (`cardano_asset_id_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the asset_id object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_asset_id_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the asset_id
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_asset_id_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_asset_id_t* asset_id = (cardano_asset_id_t*)object;
+
+  cardano_blake2b_hash_unref(&asset_id->policy_id);
+  cardano_asset_name_unref(&asset_id->asset_name);
+
+  _cardano_free(object);
+}
+
+/**
+ * \brief Converts a byte array to a hexadecimal string.
+ *
+ * @param data The data to be encoded in hexadecimal.
+ * @param data_size The size of the data to be encoded.
+ * @param hex_buffer The buffer where the hexadecimal string will be stored.
+ * @param hex_buffer_size The size of the buffer where the hexadecimal string will be stored.
+ *
+ * @return A `cardano_error_t` value indicating the result of the operation.
+ */
+static cardano_error_t
+to_hex_string(const byte_t* data, const size_t data_size, char* hex_buffer, const size_t hex_buffer_size)
+{
+  assert(data != NULL);
+  assert(hex_buffer != NULL);
+  assert(hex_buffer_size >= (data_size * 2U));
+  assert(data_size > 0U);
+
+  int init_result = sodium_init();
+
+  if (init_result == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  if (sodium_bin2hex(hex_buffer, hex_buffer_size, data, data_size) < 0)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_asset_id_new(cardano_blake2b_hash_t* policy_id, cardano_asset_name_t* asset_name, cardano_asset_id_t** asset_id)
+{
+  if (policy_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cardano_blake2b_hash_get_bytes_size(policy_id) != 28U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_asset_id_t* new_asset_id = _cardano_malloc(sizeof(cardano_asset_id_t));
+
+  if (new_asset_id == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  new_asset_id->base.deallocator   = cardano_asset_id_deallocate;
+  new_asset_id->base.last_error[0] = '\0';
+  new_asset_id->base.ref_count     = 1;
+
+  cardano_blake2b_hash_ref(policy_id);
+  cardano_asset_name_ref(asset_name);
+
+  new_asset_id->policy_id   = policy_id;
+  new_asset_id->asset_name  = asset_name;
+  new_asset_id->is_lovelace = false;
+  new_asset_id->size        = 0;
+  new_asset_id->hex_size    = 0;
+
+  CARDANO_UNUSED(memset(new_asset_id->data, 0, 60));
+  cardano_safe_memcpy(new_asset_id->data, 28, cardano_blake2b_hash_get_data(policy_id), 28);
+  cardano_safe_memcpy(&new_asset_id->data[28], 32U, cardano_asset_name_get_bytes(asset_name), cardano_asset_name_get_bytes_size(asset_name));
+  new_asset_id->size = cardano_blake2b_hash_get_bytes_size(policy_id) + cardano_asset_name_get_bytes_size(asset_name);
+
+  CARDANO_UNUSED(memset(new_asset_id->hex, 0, 121));
+
+  cardano_error_t to_hex_result = to_hex_string(new_asset_id->data, new_asset_id->size, new_asset_id->hex, 121);
+
+  if (to_hex_result != CARDANO_SUCCESS)
+  {
+    cardano_asset_id_unref(&new_asset_id);
+
+    return to_hex_result;
+  }
+
+  new_asset_id->hex_size = cardano_safe_strlen(new_asset_id->hex, 121);
+
+  *asset_id = new_asset_id;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_id_new_lovelace(cardano_asset_id_t** asset_id)
+{
+  if (asset_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_t* new_asset_id = _cardano_malloc(sizeof(cardano_asset_id_t));
+
+  if (new_asset_id == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  new_asset_id->base.deallocator   = cardano_asset_id_deallocate;
+  new_asset_id->base.last_error[0] = '\0';
+  new_asset_id->base.ref_count     = 1;
+  new_asset_id->policy_id          = NULL;
+  new_asset_id->asset_name         = NULL;
+  new_asset_id->is_lovelace        = true;
+
+  CARDANO_UNUSED(memset(new_asset_id->data, 0, 60));
+  new_asset_id->size = 0;
+
+  CARDANO_UNUSED(memset(new_asset_id->hex, 0, 121));
+  new_asset_id->hex_size = 0;
+
+  *asset_id = new_asset_id;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_id_from_bytes(
+  const byte_t*        data,
+  size_t               size,
+  cardano_asset_id_t** asset_id)
+{
+  if ((size > 0U) && (data == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size < 28U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (asset_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t* policy_id  = NULL;
+  cardano_asset_name_t*   asset_name = NULL;
+
+  cardano_error_t policy_id_result = cardano_blake2b_hash_from_bytes(data, 28U, &policy_id);
+
+  if (policy_id_result != CARDANO_SUCCESS)
+  {
+    return policy_id_result;
+  }
+
+  cardano_error_t asset_name_result = cardano_asset_name_from_bytes(&data[28], size - 28U, &asset_name);
+
+  if (asset_name_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&policy_id);
+
+    return asset_name_result;
+  }
+
+  cardano_error_t new_asset_id_result = cardano_asset_id_new(policy_id, asset_name, asset_id);
+
+  cardano_blake2b_hash_unref(&policy_id);
+  cardano_asset_name_unref(&asset_name);
+
+  if (new_asset_id_result != CARDANO_SUCCESS)
+  {
+    return new_asset_id_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_id_from_hex(
+  const char*          hex_string,
+  size_t               size,
+  cardano_asset_id_t** asset_id)
+{
+  if ((size > 0U) && (hex_string == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size < 56U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if ((size % 2U) != 0U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (asset_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  byte_t data[60] = { 0 };
+
+  int init_result = sodium_init();
+
+  if (init_result == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  if (sodium_hex2bin(data, 60, hex_string, size, NULL, NULL, NULL) < 0)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  return cardano_asset_id_from_bytes(data, size / 2U, asset_id);
+}
+
+const byte_t*
+cardano_asset_id_get_bytes(const cardano_asset_id_t* asset_id)
+{
+  if (asset_id == NULL)
+  {
+    return NULL;
+  }
+
+  return asset_id->data;
+}
+
+size_t
+cardano_asset_id_get_bytes_size(const cardano_asset_id_t* asset_id)
+{
+  if (asset_id == NULL)
+  {
+    return 0;
+  }
+
+  return asset_id->size;
+}
+
+const char*
+cardano_asset_id_get_hex(const cardano_asset_id_t* asset_id)
+{
+  if (asset_id == NULL)
+  {
+    return NULL;
+  }
+
+  return asset_id->hex;
+}
+
+size_t
+cardano_asset_id_get_hex_size(const cardano_asset_id_t* asset_id)
+{
+  if (asset_id == NULL)
+  {
+    return 0;
+  }
+
+  return asset_id->hex_size + 1U;
+}
+
+bool
+cardano_asset_id_is_lovelace(const cardano_asset_id_t* asset_id)
+{
+  if (asset_id == NULL)
+  {
+    return false;
+  }
+
+  return asset_id->is_lovelace;
+}
+
+cardano_blake2b_hash_t*
+cardano_asset_id_get_policy_id(cardano_asset_id_t* asset_id)
+{
+  if (asset_id == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(asset_id->policy_id);
+  return asset_id->policy_id;
+}
+
+cardano_asset_name_t*
+cardano_asset_id_get_asset_name(cardano_asset_id_t* asset_id)
+{
+  if (asset_id == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_asset_name_ref(asset_id->asset_name);
+  return asset_id->asset_name;
+}
+
+void
+cardano_asset_id_unref(cardano_asset_id_t** asset_id)
+{
+  if ((asset_id == NULL) || (*asset_id == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*asset_id)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *asset_id = NULL;
+    return;
+  }
+}
+
+void
+cardano_asset_id_ref(cardano_asset_id_t* asset_id)
+{
+  if (asset_id == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&asset_id->base);
+}
+
+size_t
+cardano_asset_id_refcount(const cardano_asset_id_t* asset_id)
+{
+  if (asset_id == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&asset_id->base);
+}
+
+void
+cardano_asset_id_set_last_error(cardano_asset_id_t* asset_id, const char* message)
+{
+  cardano_object_set_last_error(&asset_id->base, message);
+}
+
+const char*
+cardano_asset_id_get_last_error(const cardano_asset_id_t* asset_id)
+{
+  return cardano_object_get_last_error(&asset_id->base);
+}
+
+cardano_error_t
+cardano_asset_id_deep_clone(const cardano_asset_id_t* source, cardano_asset_id_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_t* copy = _cardano_malloc(sizeof(cardano_asset_id_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->policy_id          = NULL;
+  copy->asset_name         = NULL;
+  copy->is_lovelace        = source->is_lovelace;
+  CARDANO_UNUSED(memcpy(copy->data, source->data, sizeof(copy->data)));
+  copy->size = source->size;
+  CARDANO_UNUSED(memcpy(copy->hex, source->hex, sizeof(copy->hex)));
+  copy->hex_size = source->hex_size;
+
+  if (source->policy_id != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->policy_id, &copy->policy_id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->asset_name != NULL)
+  {
+    const cardano_error_t result = cardano_asset_name_deep_clone(source->asset_name, &copy->asset_name);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/assets/asset_id_list.c b/vendor/src/assets/asset_id_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/assets/asset_id_list.c
@@ -0,0 +1,278 @@
+/**
+ * \file asset_id_list.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license");
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/assets/asset_id_list.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano asset id list.
+ */
+typedef struct cardano_asset_id_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_asset_id_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a asset id object.
+ *
+ * This function is responsible for properly deallocating a asset id object (`cardano_asset_id_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the asset_id object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_asset_id_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the asset_id
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_asset_id_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_asset_id_list_t* list = (cardano_asset_id_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_asset_id_list_new(cardano_asset_id_list_t** asset_id)
+{
+  if (asset_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_list_t* list = _cardano_malloc(sizeof(cardano_asset_id_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_asset_id_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *asset_id = list;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_asset_id_list_get_length(const cardano_asset_id_list_t* asset_id_list)
+{
+  if (asset_id_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(asset_id_list->array);
+}
+
+cardano_error_t
+cardano_asset_id_list_get(
+  const cardano_asset_id_list_t* asset_id_list,
+  size_t                         index,
+  cardano_asset_id_t**           element)
+{
+  if (asset_id_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(asset_id_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_asset_id_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_id_list_add(cardano_asset_id_list_t* asset_id_list, cardano_asset_id_t* element)
+{
+  if (asset_id_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(asset_id_list->array);
+  const size_t new_size      = cardano_array_push(asset_id_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_asset_id_list_unref(cardano_asset_id_list_t** asset_id_list)
+{
+  if ((asset_id_list == NULL) || (*asset_id_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*asset_id_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *asset_id_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_asset_id_list_ref(cardano_asset_id_list_t* asset_id_list)
+{
+  if (asset_id_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&asset_id_list->base);
+}
+
+size_t
+cardano_asset_id_list_refcount(const cardano_asset_id_list_t* asset_id_list)
+{
+  if (asset_id_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&asset_id_list->base);
+}
+
+void
+cardano_asset_id_list_set_last_error(cardano_asset_id_list_t* asset_id_list, const char* message)
+{
+  cardano_object_set_last_error(&asset_id_list->base, message);
+}
+
+const char*
+cardano_asset_id_list_get_last_error(const cardano_asset_id_list_t* asset_id_list)
+{
+  return cardano_object_get_last_error(&asset_id_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_asset_id_t*   copy   = NULL;
+  const cardano_error_t result = cardano_asset_id_deep_clone((const cardano_asset_id_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_asset_id_list_deep_clone(const cardano_asset_id_list_t* source, cardano_asset_id_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_list_t* copy = _cardano_malloc(sizeof(cardano_asset_id_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/assets/asset_id_map.c b/vendor/src/assets/asset_id_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/assets/asset_id_map.c
@@ -0,0 +1,903 @@
+/**
+ * \file asset_id_map.c
+ *
+ * \author angel.castillo
+ * \date   May 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/assets/asset_id_list.h>
+#include <cardano/assets/asset_id_map.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a map of asset name to coin amount.
+ */
+typedef struct cardano_asset_id_map_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_asset_id_map_t;
+
+/**
+ * \brief Represents a Cardano asset name map key value pair.
+ */
+typedef struct cardano_asset_id_map_kvp_t
+{
+    cardano_object_t    base;
+    cardano_asset_id_t* key;
+    int64_t             value;
+} cardano_asset_id_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a asset_id map object.
+ *
+ * This function is responsible for properly deallocating a asset_id map object (`cardano_asset_id_map_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the asset_id_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_asset_id_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the asset_id_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_asset_id_map_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_asset_id_map_t* map = (cardano_asset_id_map_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a asset_id map key value pair object.
+ *
+ * This function is responsible for properly deallocating a asset_id map key value pair object (`cardano_asset_id_map_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the asset_id_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_asset_id_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the asset_id_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_asset_id_map_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_asset_id_map_kvp_t* map = (cardano_asset_id_map_kvp_t*)object;
+
+  cardano_asset_id_unref(&map->key);
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their asset_id.
+ *
+ * @param lhs Pointer to the first cardano_object_t object.
+ * @param rhs Pointer to the second cardano_object_t object.
+ *
+ * @return true if the addresses are equal, false otherwise.
+ */
+static bool
+asset_id_equals(const cardano_asset_id_t* lhs, const cardano_asset_id_t* rhs)
+{
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (cardano_asset_id_is_lovelace(lhs) && cardano_asset_id_is_lovelace(rhs))
+  {
+    return true;
+  }
+
+  if (cardano_asset_id_is_lovelace(lhs) || cardano_asset_id_is_lovelace(rhs))
+  {
+    return false;
+  }
+
+  const size_t lhs_size = cardano_asset_id_get_bytes_size(lhs);
+  const size_t rhs_size = cardano_asset_id_get_bytes_size(rhs);
+
+  if (lhs_size != rhs_size)
+  {
+    return false;
+  }
+
+  const uint8_t* lhs_bytes = cardano_asset_id_get_bytes(lhs);
+  const uint8_t* rhs_bytes = cardano_asset_id_get_bytes(rhs);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size) == 0;
+}
+
+/**
+ * \brief Compares two cardano_asset_id_map_kvp_t objects based on their asset_id.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused context parameter.
+ *
+ * \return A negative value if the address of lhs is less than the address of rhs, zero if they are equal,
+ *         and a positive value if the address of lhs is greater than the address of rhs.
+ */
+static int32_t
+compare_by_bytes(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_asset_id_map_kvp_t* lhs_kvp = (const cardano_asset_id_map_kvp_t*)((const void*)lhs);
+  const cardano_asset_id_map_kvp_t* rhs_kvp = (const cardano_asset_id_map_kvp_t*)((const void*)rhs);
+
+  const size_t lhs_size = cardano_asset_id_get_bytes_size(lhs_kvp->key);
+  const size_t rhs_size = cardano_asset_id_get_bytes_size(rhs_kvp->key);
+
+  if (lhs_size != rhs_size)
+  {
+    return (lhs_size < rhs_size) ? -1 : 1;
+  }
+
+  const uint8_t* lhs_bytes = cardano_asset_id_get_bytes(lhs_kvp->key);
+  const uint8_t* rhs_bytes = cardano_asset_id_get_bytes(rhs_kvp->key);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size);
+}
+
+/**
+ * \brief Predicate function that returns true if the value of the cardano_asset_id_map_kvp_t object is different than zero.
+ *
+ * @param element Pointer to the cardano_object_t object.
+ * @return true if the value of the cardano_asset_id_map_kvp_t object is different than zero, false otherwise.
+ */
+static bool
+different_than_zero(const cardano_object_t* element, const void* context)
+{
+  CARDANO_UNUSED(context);
+
+  const cardano_asset_id_map_kvp_t* kvp = (const cardano_asset_id_map_kvp_t*)((const void*)element);
+
+  if (kvp == NULL)
+  {
+    return false;
+  }
+
+  return kvp->value != 0;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_asset_id_map_new(cardano_asset_id_map_t** asset_id_map)
+{
+  if (asset_id_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_map_t* map = _cardano_malloc(sizeof(cardano_asset_id_map_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_asset_id_map_deallocate;
+
+  map->array = cardano_array_new(32);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *asset_id_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_asset_id_map_get_length(const cardano_asset_id_map_t* asset_id_map)
+{
+  if (asset_id_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(asset_id_map->array);
+}
+
+cardano_error_t
+cardano_asset_id_map_get(cardano_asset_id_map_t* asset_id_map, cardano_asset_id_t* key, int64_t* element)
+{
+  if (asset_id_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(asset_id_map->array); ++i)
+  {
+    cardano_object_t*           object = cardano_array_get(asset_id_map->array, i);
+    cardano_asset_id_map_kvp_t* kvp    = (cardano_asset_id_map_kvp_t*)((void*)object);
+
+    if (asset_id_equals(kvp->key, key))
+    {
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_asset_id_map_insert(
+  cardano_asset_id_map_t* asset_id_map,
+  cardano_asset_id_t*     key,
+  const int64_t           value)
+{
+  if (asset_id_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(asset_id_map->array); ++i)
+  {
+    cardano_object_t*           object = cardano_array_get(asset_id_map->array, i);
+    cardano_asset_id_map_kvp_t* kvp    = (cardano_asset_id_map_kvp_t*)((void*)object);
+
+    cardano_object_unref(&object);
+
+    if (asset_id_equals(kvp->key, key))
+    {
+      kvp->value = value;
+
+      return CARDANO_SUCCESS;
+    }
+  }
+
+  cardano_asset_id_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_asset_id_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_asset_id_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_asset_id_ref(key);
+
+  const size_t old_size = cardano_array_get_size(asset_id_map->array);
+  const size_t new_size = cardano_array_push(asset_id_map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_asset_id_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(asset_id_map->array, compare_by_bytes, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_id_map_get_keys(
+  cardano_asset_id_map_t*   asset_id_map,
+  cardano_asset_id_list_t** keys)
+{
+  if (asset_id_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_list_t* list = NULL;
+
+  cardano_error_t result = cardano_asset_id_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(asset_id_map->array); ++i)
+  {
+    cardano_object_t*           object = cardano_array_get(asset_id_map->array, i);
+    cardano_asset_id_map_kvp_t* kvp    = (cardano_asset_id_map_kvp_t*)((void*)object);
+
+    result = cardano_asset_id_list_add(list, kvp->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_id_map_get_key_at(
+  const cardano_asset_id_map_t* asset_id_map,
+  const size_t                  index,
+  cardano_asset_id_t**          asset_id)
+{
+  if (asset_id_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(asset_id_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*           object = cardano_array_get(asset_id_map->array, index);
+  cardano_asset_id_map_kvp_t* kvp    = (cardano_asset_id_map_kvp_t*)((void*)object);
+
+  cardano_asset_id_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *asset_id = kvp->key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_id_map_get_value_at(
+  const cardano_asset_id_map_t* asset_id_map,
+  const size_t                  index,
+  int64_t*                      amount)
+{
+  if (asset_id_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(asset_id_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*           object = cardano_array_get(asset_id_map->array, index);
+  cardano_asset_id_map_kvp_t* kvp    = (cardano_asset_id_map_kvp_t*)((void*)object);
+
+  cardano_object_unref(&object);
+
+  *amount = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_id_map_get_key_value_at(
+  const cardano_asset_id_map_t* asset_id_map,
+  const size_t                  index,
+  cardano_asset_id_t**          asset_id,
+  int64_t*                      amount)
+{
+  if (asset_id_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(asset_id_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*           object = cardano_array_get(asset_id_map->array, index);
+  cardano_asset_id_map_kvp_t* kvp    = (cardano_asset_id_map_kvp_t*)((void*)object);
+
+  cardano_asset_id_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *asset_id = kvp->key;
+  *amount   = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_id_map_add(
+  const cardano_asset_id_map_t* lhs,
+  const cardano_asset_id_map_t* rhs,
+  cardano_asset_id_map_t**      result)
+{
+  if (lhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (rhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_map_t* map = NULL;
+
+  cardano_error_t create_result = cardano_asset_id_map_new(&map);
+
+  if (create_result != CARDANO_SUCCESS)
+  {
+    return create_result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_object_t*           object = cardano_array_get(lhs->array, i);
+    cardano_asset_id_map_kvp_t* kvp    = (cardano_asset_id_map_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    cardano_error_t insert_result = cardano_asset_id_map_insert(map, kvp->key, kvp->value);
+
+    if (insert_result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_map_unref(&map);
+      return insert_result;
+    }
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(rhs->array); ++i)
+  {
+    cardano_object_t*           object = cardano_array_get(rhs->array, i);
+    cardano_asset_id_map_kvp_t* kvp    = (cardano_asset_id_map_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    int64_t value = 0;
+
+    cardano_error_t get_result = cardano_asset_id_map_get(map, kvp->key, &value);
+
+    if (get_result == CARDANO_SUCCESS)
+    {
+      value += kvp->value;
+
+      cardano_error_t insert_result = cardano_asset_id_map_insert(map, kvp->key, value);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_id_map_unref(&map);
+        return insert_result;
+      }
+    }
+    else
+    {
+      cardano_error_t insert_result = cardano_asset_id_map_insert(map, kvp->key, kvp->value);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_id_map_unref(&map);
+        return insert_result;
+      }
+    }
+  }
+
+  cardano_array_t* filtered = cardano_array_filter(map->array, different_than_zero, NULL);
+
+  if (filtered == NULL)
+  {
+    cardano_asset_id_map_unref(&map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_unref(&map->array);
+  map->array = filtered;
+
+  *result = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_id_map_subtract(
+  const cardano_asset_id_map_t* lhs,
+  const cardano_asset_id_map_t* rhs,
+  cardano_asset_id_map_t**      result)
+{
+  if (lhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (rhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_map_t* map = NULL;
+
+  cardano_error_t create_result = cardano_asset_id_map_new(&map);
+
+  if (create_result != CARDANO_SUCCESS)
+  {
+    return create_result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_object_t*           object = cardano_array_get(lhs->array, i);
+    cardano_asset_id_map_kvp_t* kvp    = (cardano_asset_id_map_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    cardano_error_t insert_result = cardano_asset_id_map_insert(map, kvp->key, kvp->value);
+
+    if (insert_result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_map_unref(&map);
+      return insert_result;
+    }
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(rhs->array); ++i)
+  {
+    cardano_object_t*           object = cardano_array_get(rhs->array, i);
+    cardano_asset_id_map_kvp_t* kvp    = (cardano_asset_id_map_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    int64_t value = 0;
+
+    cardano_error_t get_result = cardano_asset_id_map_get(map, kvp->key, &value);
+
+    if (get_result == CARDANO_SUCCESS)
+    {
+      value -= kvp->value;
+
+      cardano_error_t insert_result = cardano_asset_id_map_insert(map, kvp->key, value);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_id_map_unref(&map);
+        return insert_result;
+      }
+    }
+    else
+    {
+      cardano_error_t insert_result = cardano_asset_id_map_insert(map, kvp->key, -kvp->value);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_id_map_unref(&map);
+        return insert_result;
+      }
+    }
+  }
+
+  cardano_array_t* filtered = cardano_array_filter(map->array, different_than_zero, NULL);
+
+  if (filtered == NULL)
+  {
+    cardano_asset_id_map_unref(&map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_unref(&map->array);
+  map->array = filtered;
+
+  *result = map;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_asset_id_map_equals(const cardano_asset_id_map_t* lhs, const cardano_asset_id_map_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (cardano_array_get_size(lhs->array) != cardano_array_get_size(rhs->array))
+  {
+    return false;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_object_t*           lhs_object = cardano_array_get(lhs->array, i);
+    cardano_asset_id_map_kvp_t* lhs_kvp    = (cardano_asset_id_map_kvp_t*)((void*)lhs_object);
+    cardano_object_unref(&lhs_object);
+
+    if (lhs_kvp == NULL)
+    {
+      return false;
+    }
+
+    cardano_object_t*           rhs_object = cardano_array_get(rhs->array, i);
+    cardano_asset_id_map_kvp_t* rhs_kvp    = (cardano_asset_id_map_kvp_t*)((void*)rhs_object);
+    cardano_object_unref(&rhs_object);
+
+    if (rhs_kvp == NULL)
+    {
+      return false;
+    }
+
+    if (!asset_id_equals(lhs_kvp->key, rhs_kvp->key))
+    {
+      return false;
+    }
+
+    if (lhs_kvp->value != rhs_kvp->value)
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+void
+cardano_asset_id_map_unref(cardano_asset_id_map_t** asset_id_map)
+{
+  if ((asset_id_map == NULL) || (*asset_id_map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*asset_id_map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *asset_id_map = NULL;
+    return;
+  }
+}
+
+void
+cardano_asset_id_map_ref(cardano_asset_id_map_t* asset_id_map)
+{
+  if (asset_id_map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&asset_id_map->base);
+}
+
+size_t
+cardano_asset_id_map_refcount(const cardano_asset_id_map_t* asset_id_map)
+{
+  if (asset_id_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&asset_id_map->base);
+}
+
+void
+cardano_asset_id_map_set_last_error(cardano_asset_id_map_t* asset_id_map, const char* message)
+{
+  cardano_object_set_last_error(&asset_id_map->base, message);
+}
+
+const char*
+cardano_asset_id_map_get_last_error(const cardano_asset_id_map_t* asset_id_map)
+{
+  return cardano_object_get_last_error(&asset_id_map->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_asset_id_map_kvp_deep_clone(const cardano_asset_id_map_kvp_t* source, cardano_asset_id_map_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_map_kvp_t* copy = _cardano_malloc(sizeof(cardano_asset_id_map_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = source->value;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_asset_id_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_asset_id_map_kvp_t* copy   = NULL;
+  const cardano_error_t       result = cardano_asset_id_map_kvp_deep_clone((const cardano_asset_id_map_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_asset_id_map_deep_clone(const cardano_asset_id_map_t* source, cardano_asset_id_map_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_map_t* copy = _cardano_malloc(sizeof(cardano_asset_id_map_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/assets/asset_name.c b/vendor/src/assets/asset_name.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/assets/asset_name.c
@@ -0,0 +1,431 @@
+/**
+ * \file asset_name.c
+ *
+ * \author angel.castillo
+ * \date   Sept 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_name.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <sodium/core.h>
+#include <sodium/utils.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an asset name.
+ */
+typedef struct cardano_asset_name_t
+{
+    cardano_object_t base;
+    byte_t           data[32];
+    uint64_t         size;
+    char             hex[65];
+    uint64_t         hex_size;
+} cardano_asset_name_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a asset name object.
+ *
+ * This function is responsible for properly deallocating a asset name object (`cardano_asset_name_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the asset_name object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_asset_name_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the asset_name
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_asset_name_deallocate(void* object)
+{
+  assert(object != NULL);
+  _cardano_free(object);
+}
+
+/**
+ * \brief Converts a byte array to a hexadecimal string.
+ *
+ * @param data The data to be encoded in hexadecimal.
+ * @param data_size The size of the data to be encoded.
+ * @param hex_buffer The buffer where the hexadecimal string will be stored.
+ * @param hex_buffer_size The size of the buffer where the hexadecimal string will be stored.
+ *
+ * @return A `cardano_error_t` value indicating the result of the operation.
+ */
+static cardano_error_t
+to_hex_string(const byte_t* data, const size_t data_size, char* hex_buffer, const size_t hex_buffer_size)
+{
+  assert(hex_buffer != NULL);
+  assert(hex_buffer_size >= (data_size * 2U));
+
+  if ((data_size == 0U) || (data == NULL))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  int init_result = sodium_init();
+
+  if (init_result == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  if (sodium_bin2hex(hex_buffer, hex_buffer_size, data, data_size) < 0)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_asset_name_from_bytes(
+  const byte_t*          data,
+  size_t                 size,
+  cardano_asset_name_t** asset_name)
+{
+  if ((size > 0U) && (data == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size > 32U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (asset_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_t* new_asset_name = _cardano_malloc(sizeof(cardano_asset_name_t));
+
+  if (new_asset_name == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  new_asset_name->base.deallocator   = cardano_asset_name_deallocate;
+  new_asset_name->base.last_error[0] = '\0';
+  new_asset_name->base.ref_count     = 1;
+
+  CARDANO_UNUSED(memset(new_asset_name->data, 0, 32));
+  cardano_safe_memcpy(new_asset_name->data, 32, data, size);
+  new_asset_name->size = size;
+
+  CARDANO_UNUSED(memset(new_asset_name->hex, 0, 65));
+  cardano_error_t to_hex_result = to_hex_string(data, size, new_asset_name->hex, 65);
+
+  if (to_hex_result != CARDANO_SUCCESS)
+  {
+    _cardano_free(new_asset_name);
+
+    return to_hex_result;
+  }
+
+  new_asset_name->hex_size = size * 2U;
+  *asset_name              = new_asset_name;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_from_hex(
+  const char*            hex,
+  size_t                 size,
+  cardano_asset_name_t** asset_name)
+{
+  if ((size > 0U) && (hex == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (((size % 2U) != 0U) || (size > 64U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  byte_t data[32] = { 0 };
+
+  int init_result = sodium_init();
+
+  if (init_result == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  if (sodium_hex2bin(data, 32, hex, size, NULL, NULL, NULL) < 0)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  return cardano_asset_name_from_bytes(data, size / 2U, asset_name);
+}
+
+cardano_error_t
+cardano_asset_name_from_string(
+  const char*            string,
+  size_t                 size,
+  cardano_asset_name_t** asset_name)
+{
+  if (string == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_asset_name_from_bytes((const byte_t*)string, size, asset_name);
+}
+
+cardano_error_t
+cardano_asset_name_from_cbor(cardano_cbor_reader_t* reader, cardano_asset_name_t** asset_name)
+{
+  if (asset_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *asset_name = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* buffer          = NULL;
+  cardano_error_t   validate_result = cardano_cbor_reader_read_bytestring(reader, &buffer);
+
+  if (validate_result != CARDANO_SUCCESS)
+  {
+    *asset_name = NULL;
+    return validate_result;
+  }
+
+  cardano_error_t from_bytes_result = cardano_asset_name_from_bytes(cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer), asset_name);
+  cardano_buffer_unref(&buffer);
+
+  return from_bytes_result;
+}
+
+cardano_error_t
+cardano_asset_name_to_cbor(const cardano_asset_name_t* asset_name, cardano_cbor_writer_t* writer)
+{
+  if (asset_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_result = cardano_cbor_writer_write_bytestring(writer, asset_name->data, asset_name->size);
+
+  return write_result;
+}
+
+cardano_error_t
+cardano_asset_name_to_cip116_json(
+  const cardano_asset_name_t* asset_name,
+  cardano_json_writer_t*      writer)
+{
+  if ((asset_name == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_string(writer, asset_name->hex, asset_name->hex_size);
+
+  return CARDANO_SUCCESS;
+}
+
+const char*
+cardano_asset_name_get_string(const cardano_asset_name_t* asset_name)
+{
+  if (asset_name == NULL)
+  {
+    return NULL;
+  }
+
+  return (const char*)(asset_name)->data;
+}
+
+size_t
+cardano_asset_name_get_string_size(const cardano_asset_name_t* asset_name)
+{
+  if (asset_name == NULL)
+  {
+    return 0;
+  }
+
+  return asset_name->size + 1U;
+}
+
+const byte_t*
+cardano_asset_name_get_bytes(const cardano_asset_name_t* asset_name)
+{
+  if (asset_name == NULL)
+  {
+    return NULL;
+  }
+
+  return asset_name->data;
+}
+
+size_t
+cardano_asset_name_get_bytes_size(const cardano_asset_name_t* asset_name)
+{
+  if (asset_name == NULL)
+  {
+    return 0;
+  }
+
+  return asset_name->size;
+}
+
+const char*
+cardano_asset_name_get_hex(const cardano_asset_name_t* asset_name)
+{
+  if (asset_name == NULL)
+  {
+    return NULL;
+  }
+
+  return asset_name->hex;
+}
+
+size_t
+cardano_asset_name_get_hex_size(const cardano_asset_name_t* asset_name)
+{
+  if (asset_name == NULL)
+  {
+    return 0;
+  }
+
+  return asset_name->hex_size + 1U;
+}
+
+void
+cardano_asset_name_unref(cardano_asset_name_t** asset_name)
+{
+  if ((asset_name == NULL) || (*asset_name == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*asset_name)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *asset_name = NULL;
+    return;
+  }
+}
+
+void
+cardano_asset_name_ref(cardano_asset_name_t* asset_name)
+{
+  if (asset_name == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&asset_name->base);
+}
+
+size_t
+cardano_asset_name_refcount(const cardano_asset_name_t* asset_name)
+{
+  if (asset_name == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&asset_name->base);
+}
+
+void
+cardano_asset_name_set_last_error(cardano_asset_name_t* asset_name, const char* message)
+{
+  cardano_object_set_last_error(&asset_name->base, message);
+}
+
+const char*
+cardano_asset_name_get_last_error(const cardano_asset_name_t* asset_name)
+{
+  return cardano_object_get_last_error(&asset_name->base);
+}
+
+cardano_error_t
+cardano_asset_name_deep_clone(const cardano_asset_name_t* source, cardano_asset_name_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_t* copy = _cardano_malloc(sizeof(cardano_asset_name_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  CARDANO_UNUSED(memcpy(copy->data, source->data, sizeof(copy->data)));
+  copy->size = source->size;
+  CARDANO_UNUSED(memcpy(copy->hex, source->hex, sizeof(copy->hex)));
+  copy->hex_size = source->hex_size;
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/assets/asset_name_list.c b/vendor/src/assets/asset_name_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/assets/asset_name_list.c
@@ -0,0 +1,278 @@
+/**
+ * \file asset_name_list.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license");
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_name.h>
+#include <cardano/assets/asset_name_list.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano asset name list.
+ */
+typedef struct cardano_asset_name_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_asset_name_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a asset name object.
+ *
+ * This function is responsible for properly deallocating a asset name object (`cardano_asset_name_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the asset_name object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_asset_name_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the asset_name
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_asset_name_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_asset_name_list_t* list = (cardano_asset_name_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_asset_name_list_new(cardano_asset_name_list_t** asset_name)
+{
+  if (asset_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_list_t* list = _cardano_malloc(sizeof(cardano_asset_name_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_asset_name_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *asset_name = list;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_asset_name_list_get_length(const cardano_asset_name_list_t* asset_name_list)
+{
+  if (asset_name_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(asset_name_list->array);
+}
+
+cardano_error_t
+cardano_asset_name_list_get(
+  const cardano_asset_name_list_t* asset_name_list,
+  size_t                           index,
+  cardano_asset_name_t**           element)
+{
+  if (asset_name_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(asset_name_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_asset_name_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_list_add(cardano_asset_name_list_t* asset_name_list, cardano_asset_name_t* element)
+{
+  if (asset_name_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(asset_name_list->array);
+  const size_t new_size      = cardano_array_push(asset_name_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_asset_name_list_unref(cardano_asset_name_list_t** asset_name_list)
+{
+  if ((asset_name_list == NULL) || (*asset_name_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*asset_name_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *asset_name_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_asset_name_list_ref(cardano_asset_name_list_t* asset_name_list)
+{
+  if (asset_name_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&asset_name_list->base);
+}
+
+size_t
+cardano_asset_name_list_refcount(const cardano_asset_name_list_t* asset_name_list)
+{
+  if (asset_name_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&asset_name_list->base);
+}
+
+void
+cardano_asset_name_list_set_last_error(cardano_asset_name_list_t* asset_name_list, const char* message)
+{
+  cardano_object_set_last_error(&asset_name_list->base, message);
+}
+
+const char*
+cardano_asset_name_list_get_last_error(const cardano_asset_name_list_t* asset_name_list)
+{
+  return cardano_object_get_last_error(&asset_name_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_asset_name_t* copy   = NULL;
+  const cardano_error_t result = cardano_asset_name_deep_clone((const cardano_asset_name_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_asset_name_list_deep_clone(const cardano_asset_name_list_t* source, cardano_asset_name_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_list_t* copy = _cardano_malloc(sizeof(cardano_asset_name_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/assets/asset_name_map.c b/vendor/src/assets/asset_name_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/assets/asset_name_map.c
@@ -0,0 +1,1153 @@
+/**
+ * \file asset_name_map.c
+ *
+ * \author angel.castillo
+ * \date   May 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_name.h>
+#include <cardano/assets/asset_name_list.h>
+#include <cardano/assets/asset_name_map.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <src/string_safe.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a map of asset name to coin amount.
+ */
+typedef struct cardano_asset_name_map_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_asset_name_map_t;
+
+/**
+ * \brief Represents a Cardano asset name map key value pair.
+ */
+typedef struct cardano_asset_name_map_kvp_t
+{
+    cardano_object_t      base;
+    cardano_asset_name_t* key;
+    int64_t               value;
+} cardano_asset_name_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a asset_name map object.
+ *
+ * This function is responsible for properly deallocating a asset_name map object (`cardano_asset_name_map_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the asset_name_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_asset_name_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the asset_name_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_asset_name_map_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_asset_name_map_t* map = (cardano_asset_name_map_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a asset_name map key value pair object.
+ *
+ * This function is responsible for properly deallocating a asset_name map key value pair object (`cardano_asset_name_map_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the asset_name_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_asset_name_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the asset_name_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_asset_name_map_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_asset_name_map_kvp_t* map = (cardano_asset_name_map_kvp_t*)object;
+
+  cardano_asset_name_unref(&map->key);
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their asset_name.
+ *
+ * @param lhs Pointer to the first cardano_object_t object.
+ * @param rhs Pointer to the second cardano_object_t object.
+ *
+ * @return true if the addresses are equal, false otherwise.
+ */
+static bool
+asset_name_equals(const cardano_asset_name_t* lhs, const cardano_asset_name_t* rhs)
+{
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  const size_t lhs_size = cardano_asset_name_get_bytes_size(lhs);
+  const size_t rhs_size = cardano_asset_name_get_bytes_size(rhs);
+
+  if (lhs_size != rhs_size)
+  {
+    return false;
+  }
+
+  const uint8_t* lhs_bytes = cardano_asset_name_get_bytes(lhs);
+  const uint8_t* rhs_bytes = cardano_asset_name_get_bytes(rhs);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size) == 0;
+}
+
+/**
+ * \brief Compares two cardano_asset_name_map_kvp_t objects based on their asset_name.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context A pointer to the context object.
+ *
+ * \return A negative value if the address of lhs is less than the address of rhs, zero if they are equal,
+ *         and a positive value if the address of lhs is greater than the address of rhs.
+ */
+static int32_t
+compare_by_bytes(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_asset_name_map_kvp_t* lhs_kvp = (const cardano_asset_name_map_kvp_t*)((const void*)lhs);
+  const cardano_asset_name_map_kvp_t* rhs_kvp = (const cardano_asset_name_map_kvp_t*)((const void*)rhs);
+
+  const size_t lhs_size = cardano_asset_name_get_bytes_size(lhs_kvp->key);
+  const size_t rhs_size = cardano_asset_name_get_bytes_size(rhs_kvp->key);
+
+  if (lhs_size != rhs_size)
+  {
+    return (lhs_size < rhs_size) ? -1 : 1;
+  }
+
+  const uint8_t* lhs_bytes = cardano_asset_name_get_bytes(lhs_kvp->key);
+  const uint8_t* rhs_bytes = cardano_asset_name_get_bytes(rhs_kvp->key);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size);
+}
+
+/**
+ * \brief Predicate function that returns true if the value of the cardano_asset_name_map_kvp_t object is different than zero.
+ *
+ * @param element Pointer to the cardano_object_t object.
+ * @return true if the value of the cardano_asset_name_map_kvp_t object is different than zero, false otherwise.
+ */
+static bool
+different_than_zero(const cardano_object_t* element, const void* context)
+{
+  CARDANO_UNUSED(context);
+
+  const cardano_asset_name_map_kvp_t* kvp = (const cardano_asset_name_map_kvp_t*)((const void*)element);
+
+  if (kvp == NULL)
+  {
+    return false;
+  }
+
+  return kvp->value != 0;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_asset_name_map_new(cardano_asset_name_map_t** asset_name_map)
+{
+  if (asset_name_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_map_t* map = _cardano_malloc(sizeof(cardano_asset_name_map_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_asset_name_map_deallocate;
+
+  map->array = cardano_array_new(32);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *asset_name_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_map_from_cbor(cardano_cbor_reader_t* reader, cardano_asset_name_map_t** asset_name_map)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_name_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_map_t* map    = NULL;
+  cardano_error_t           result = cardano_asset_name_map_new(&map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_map(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_asset_name_map_unref(&map);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_name_map_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_asset_name_t* key   = NULL;
+    int64_t               value = 0;
+
+    cardano_error_t asset_name_result = cardano_asset_name_from_cbor(reader, &key);
+
+    if (asset_name_result != CARDANO_SUCCESS)
+    {
+      cardano_asset_name_map_unref(&map);
+      return asset_name_result;
+    }
+
+    result = cardano_cbor_reader_read_int(reader, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_name_unref(&key);
+      cardano_asset_name_map_unref(&map);
+      return result;
+    }
+
+    cardano_asset_name_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_asset_name_map_kvp_t));
+
+    if (kvp == NULL)
+    {
+      cardano_asset_name_unref(&key);
+      cardano_asset_name_map_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    kvp->base.ref_count     = 0;
+    kvp->base.last_error[0] = '\0';
+    kvp->base.deallocator   = cardano_asset_name_map_kvp_deallocate;
+    kvp->key                = key;
+    kvp->value              = value;
+
+    const size_t old_size = cardano_array_get_size(map->array);
+    const size_t new_size = cardano_array_push(map->array, (cardano_object_t*)((void*)kvp));
+
+    if (new_size != (old_size + 1U))
+    {
+      cardano_asset_name_map_kvp_deallocate(kvp);
+      cardano_asset_name_map_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  cardano_array_sort(map->array, compare_by_bytes, NULL);
+
+  result = cardano_cbor_validate_end_map("asset_name_map", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_asset_name_map_unref(&map);
+    return result;
+  }
+
+  *asset_name_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_map_to_cbor(const cardano_asset_name_map_t* asset_name_map, cardano_cbor_writer_t* writer)
+{
+  if (asset_name_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t map_size = cardano_array_get_size(asset_name_map->array);
+  result          = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(asset_name_map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(asset_name_map->array, i);
+    cardano_object_unref(&kvp);
+
+    if (kvp == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in asset_name map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_asset_name_map_kvp_t* kvp_data = (cardano_asset_name_map_kvp_t*)((void*)kvp);
+
+    cardano_error_t write_asset_name_result = cardano_cbor_writer_write_bytestring(writer, cardano_asset_name_get_bytes(kvp_data->key), cardano_asset_name_get_bytes_size(kvp_data->key));
+
+    if (write_asset_name_result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_signed_int(writer, kvp_data->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_map_to_cip116_json(
+  const cardano_asset_name_map_t* map,
+  cardano_json_writer_t*          writer)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  for (size_t i = 0; i < cardano_array_get_size(map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(map->array, i);
+    cardano_object_unref(&kvp);
+
+    if (kvp == NULL)
+    {
+      cardano_json_writer_set_last_error(writer, "Element in asset_name map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_asset_name_map_kvp_t* kvp_data = (cardano_asset_name_map_kvp_t*)((void*)kvp);
+
+    const size_t key_size              = cardano_asset_name_get_hex_size(kvp_data->key);
+    const char*  key                   = cardano_asset_name_get_hex(kvp_data->key);
+    const size_t key_size_without_null = cardano_safe_strlen(key, key_size);
+
+    cardano_json_writer_write_property_name(
+      writer,
+      key,
+      key_size_without_null);
+
+    cardano_json_writer_write_signed_int_as_string(writer, kvp_data->value);
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_map_to_cip116_json_ex(
+  const cardano_asset_name_map_t* map,
+  cardano_json_writer_t*          writer)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0; i < cardano_array_get_size(map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(map->array, i);
+    cardano_object_unref(&kvp);
+
+    if (kvp == NULL)
+    {
+      cardano_json_writer_set_last_error(writer, "Element in asset_name map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_asset_name_map_kvp_t* kvp_data = (cardano_asset_name_map_kvp_t*)((void*)kvp);
+
+    const byte_t* asset_name_data = cardano_asset_name_get_bytes(kvp_data->key);
+    const size_t  asset_name_size = cardano_asset_name_get_bytes_size(kvp_data->key);
+
+    cardano_json_writer_write_start_object(writer);
+    cardano_json_writer_write_property_name(writer, "asset_name", 10);
+    cardano_json_writer_write_bytes_as_hex(writer, asset_name_data, asset_name_size);
+    cardano_json_writer_write_property_name(writer, "amount", 6);
+    cardano_json_writer_write_signed_int_as_string(writer, kvp_data->value);
+    cardano_json_writer_write_end_object(writer);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_asset_name_map_get_length(const cardano_asset_name_map_t* asset_name_map)
+{
+  if (asset_name_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(asset_name_map->array);
+}
+
+cardano_error_t
+cardano_asset_name_map_get(cardano_asset_name_map_t* asset_name_map, cardano_asset_name_t* key, int64_t* element)
+{
+  if (asset_name_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(asset_name_map->array); ++i)
+  {
+    cardano_object_t*             object = cardano_array_get(asset_name_map->array, i);
+    cardano_asset_name_map_kvp_t* kvp    = (cardano_asset_name_map_kvp_t*)((void*)object);
+
+    if (asset_name_equals(kvp->key, key))
+    {
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_asset_name_map_insert(
+  cardano_asset_name_map_t* asset_name_map,
+  cardano_asset_name_t*     key,
+  const int64_t             value)
+{
+  if (asset_name_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(asset_name_map->array); ++i)
+  {
+    cardano_object_t*             object = cardano_array_get(asset_name_map->array, i);
+    cardano_asset_name_map_kvp_t* kvp    = (cardano_asset_name_map_kvp_t*)((void*)object);
+
+    cardano_object_unref(&object);
+
+    if (asset_name_equals(kvp->key, key))
+    {
+      kvp->value = value;
+
+      return CARDANO_SUCCESS;
+    }
+  }
+
+  cardano_asset_name_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_asset_name_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_asset_name_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_asset_name_ref(key);
+
+  const size_t old_size = cardano_array_get_size(asset_name_map->array);
+  const size_t new_size = cardano_array_push(asset_name_map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_asset_name_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(asset_name_map->array, compare_by_bytes, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_map_get_keys(
+  cardano_asset_name_map_t*   asset_name_map,
+  cardano_asset_name_list_t** keys)
+{
+  if (asset_name_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_list_t* list = NULL;
+
+  cardano_error_t result = cardano_asset_name_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(asset_name_map->array); ++i)
+  {
+    cardano_object_t*             object = cardano_array_get(asset_name_map->array, i);
+    cardano_asset_name_map_kvp_t* kvp    = (cardano_asset_name_map_kvp_t*)((void*)object);
+
+    result = cardano_asset_name_list_add(list, kvp->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_name_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_map_get_key_at(
+  const cardano_asset_name_map_t* asset_name_map,
+  const size_t                    index,
+  cardano_asset_name_t**          asset_name)
+{
+  if (asset_name_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(asset_name_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*             object = cardano_array_get(asset_name_map->array, index);
+  cardano_asset_name_map_kvp_t* kvp    = (cardano_asset_name_map_kvp_t*)((void*)object);
+
+  cardano_asset_name_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *asset_name = kvp->key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_map_get_value_at(
+  const cardano_asset_name_map_t* asset_name_map,
+  const size_t                    index,
+  int64_t*                        amount)
+{
+  if (asset_name_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(asset_name_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*             object = cardano_array_get(asset_name_map->array, index);
+  cardano_asset_name_map_kvp_t* kvp    = (cardano_asset_name_map_kvp_t*)((void*)object);
+
+  cardano_object_unref(&object);
+
+  *amount = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_map_get_key_value_at(
+  const cardano_asset_name_map_t* asset_name_map,
+  const size_t                    index,
+  cardano_asset_name_t**          asset_name,
+  int64_t*                        amount)
+{
+  if (asset_name_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(asset_name_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*             object = cardano_array_get(asset_name_map->array, index);
+  cardano_asset_name_map_kvp_t* kvp    = (cardano_asset_name_map_kvp_t*)((void*)object);
+
+  cardano_asset_name_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *asset_name = kvp->key;
+  *amount     = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_map_add(
+  const cardano_asset_name_map_t* lhs,
+  const cardano_asset_name_map_t* rhs,
+  cardano_asset_name_map_t**      result)
+{
+  if (lhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (rhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_map_t* map = NULL;
+
+  cardano_error_t create_result = cardano_asset_name_map_new(&map);
+
+  if (create_result != CARDANO_SUCCESS)
+  {
+    return create_result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_object_t*             object = cardano_array_get(lhs->array, i);
+    cardano_asset_name_map_kvp_t* kvp    = (cardano_asset_name_map_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    cardano_error_t insert_result = cardano_asset_name_map_insert(map, kvp->key, kvp->value);
+
+    if (insert_result != CARDANO_SUCCESS)
+    {
+      cardano_asset_name_map_unref(&map);
+      return insert_result;
+    }
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(rhs->array); ++i)
+  {
+    cardano_object_t*             object = cardano_array_get(rhs->array, i);
+    cardano_asset_name_map_kvp_t* kvp    = (cardano_asset_name_map_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    int64_t value = 0;
+
+    cardano_error_t get_result = cardano_asset_name_map_get(map, kvp->key, &value);
+
+    if (get_result == CARDANO_SUCCESS)
+    {
+      value += kvp->value;
+
+      cardano_error_t insert_result = cardano_asset_name_map_insert(map, kvp->key, value);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_name_map_unref(&map);
+        return insert_result;
+      }
+    }
+    else
+    {
+      cardano_error_t insert_result = cardano_asset_name_map_insert(map, kvp->key, kvp->value);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_name_map_unref(&map);
+        return insert_result;
+      }
+    }
+  }
+
+  cardano_array_t* filtered = cardano_array_filter(map->array, different_than_zero, NULL);
+
+  if (filtered == NULL)
+  {
+    cardano_asset_name_map_unref(&map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_unref(&map->array);
+  map->array = filtered;
+
+  *result = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_asset_name_map_subtract(
+  const cardano_asset_name_map_t* lhs,
+  const cardano_asset_name_map_t* rhs,
+  cardano_asset_name_map_t**      result)
+{
+  if (lhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (rhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_map_t* map = NULL;
+
+  cardano_error_t create_result = cardano_asset_name_map_new(&map);
+
+  if (create_result != CARDANO_SUCCESS)
+  {
+    return create_result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_object_t*             object = cardano_array_get(lhs->array, i);
+    cardano_asset_name_map_kvp_t* kvp    = (cardano_asset_name_map_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    cardano_error_t insert_result = cardano_asset_name_map_insert(map, kvp->key, kvp->value);
+
+    if (insert_result != CARDANO_SUCCESS)
+    {
+      cardano_asset_name_map_unref(&map);
+      return insert_result;
+    }
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(rhs->array); ++i)
+  {
+    cardano_object_t*             object = cardano_array_get(rhs->array, i);
+    cardano_asset_name_map_kvp_t* kvp    = (cardano_asset_name_map_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    int64_t value = 0;
+
+    cardano_error_t get_result = cardano_asset_name_map_get(map, kvp->key, &value);
+
+    if (get_result == CARDANO_SUCCESS)
+    {
+      value -= kvp->value;
+
+      cardano_error_t insert_result = cardano_asset_name_map_insert(map, kvp->key, value);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_name_map_unref(&map);
+        return insert_result;
+      }
+    }
+    else
+    {
+      cardano_error_t insert_result = cardano_asset_name_map_insert(map, kvp->key, -kvp->value);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_name_map_unref(&map);
+        return insert_result;
+      }
+    }
+  }
+
+  cardano_array_t* filtered = cardano_array_filter(map->array, different_than_zero, NULL);
+
+  if (filtered == NULL)
+  {
+    cardano_asset_name_map_unref(&map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_unref(&map->array);
+  map->array = filtered;
+
+  *result = map;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_asset_name_map_equals(const cardano_asset_name_map_t* lhs, const cardano_asset_name_map_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (cardano_array_get_size(lhs->array) != cardano_array_get_size(rhs->array))
+  {
+    return false;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_object_t*             lhs_object = cardano_array_get(lhs->array, i);
+    cardano_asset_name_map_kvp_t* lhs_kvp    = (cardano_asset_name_map_kvp_t*)((void*)lhs_object);
+    cardano_object_unref(&lhs_object);
+
+    if (lhs_kvp == NULL)
+    {
+      return false;
+    }
+
+    cardano_object_t*             rhs_object = cardano_array_get(rhs->array, i);
+    cardano_asset_name_map_kvp_t* rhs_kvp    = (cardano_asset_name_map_kvp_t*)((void*)rhs_object);
+    cardano_object_unref(&rhs_object);
+
+    if (rhs_kvp == NULL)
+    {
+      return false;
+    }
+
+    if (!asset_name_equals(lhs_kvp->key, rhs_kvp->key))
+    {
+      return false;
+    }
+
+    if (lhs_kvp->value != rhs_kvp->value)
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+void
+cardano_asset_name_map_unref(cardano_asset_name_map_t** asset_name_map)
+{
+  if ((asset_name_map == NULL) || (*asset_name_map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*asset_name_map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *asset_name_map = NULL;
+    return;
+  }
+}
+
+void
+cardano_asset_name_map_ref(cardano_asset_name_map_t* asset_name_map)
+{
+  if (asset_name_map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&asset_name_map->base);
+}
+
+size_t
+cardano_asset_name_map_refcount(const cardano_asset_name_map_t* asset_name_map)
+{
+  if (asset_name_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&asset_name_map->base);
+}
+
+void
+cardano_asset_name_map_set_last_error(cardano_asset_name_map_t* asset_name_map, const char* message)
+{
+  cardano_object_set_last_error(&asset_name_map->base, message);
+}
+
+const char*
+cardano_asset_name_map_get_last_error(const cardano_asset_name_map_t* asset_name_map)
+{
+  return cardano_object_get_last_error(&asset_name_map->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_asset_name_map_kvp_deep_clone(const cardano_asset_name_map_kvp_t* source, cardano_asset_name_map_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_map_kvp_t* copy = _cardano_malloc(sizeof(cardano_asset_name_map_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = source->value;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_asset_name_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_asset_name_map_kvp_t* copy   = NULL;
+  const cardano_error_t         result = cardano_asset_name_map_kvp_deep_clone((const cardano_asset_name_map_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_asset_name_map_deep_clone(const cardano_asset_name_map_t* source, cardano_asset_name_map_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_map_t* copy = _cardano_malloc(sizeof(cardano_asset_name_map_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/assets/multi_asset.c b/vendor/src/assets/multi_asset.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/assets/multi_asset.c
@@ -0,0 +1,1446 @@
+/**
+ * \file multi_asset.c
+ *
+ * \author angel.castillo
+ * \date   Sep 13, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_name_map.h>
+#include <cardano/assets/multi_asset.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <src/string_safe.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano multi asset key value pair.
+ */
+typedef struct cardano_multi_asset_kvp_t
+{
+    cardano_object_t          base;
+    cardano_blake2b_hash_t*   key;
+    cardano_asset_name_map_t* value;
+} cardano_multi_asset_kvp_t;
+
+/**
+ * \brief Represents a collection of assets in the Cardano blockchain.
+ */
+typedef struct cardano_multi_asset_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_multi_asset_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a multi_asset object.
+ *
+ * This function is responsible for properly deallocating a multi_asset object (`cardano_multi_asset_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the multi_asset object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_multi_asset_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the multi_asset
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_multi_asset_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_multi_asset_t* map = (cardano_multi_asset_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a multi asset map key value pair object.
+ *
+ * This function is responsible for properly deallocating a multi_asset map key value pair object (`cardano_multi_asset_map_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the multi_asset_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_multi_asset_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the multi_asset_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_multi_asset_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_multi_asset_kvp_t* map = (cardano_multi_asset_kvp_t*)object;
+
+  if (map->key != NULL)
+  {
+    cardano_blake2b_hash_unref(&map->key);
+  }
+
+  if (map->value != NULL)
+  {
+    cardano_asset_name_map_unref(&map->value);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their key hash value.
+ *
+ * This function casts the cardano_object_t objects to cardano_multi_asset_kvp_t
+ * and compares their key hashes using the cardano_blake2b_hash_compare function.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused context parameter.
+ *
+ * \return A negative value if the hash of lhs is less than the hash of rhs, zero if they are equal,
+ *         and a positive value if the hash of lhs is greater than the hash of rhs.
+ */
+static int32_t
+compare_by_hash(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_multi_asset_kvp_t* lhs_kvp = (const cardano_multi_asset_kvp_t*)((const void*)lhs);
+  const cardano_multi_asset_kvp_t* rhs_kvp = (const cardano_multi_asset_kvp_t*)((const void*)rhs);
+
+  return cardano_blake2b_hash_compare(lhs_kvp->key, rhs_kvp->key);
+}
+
+/**
+ * \brief Predicate function that returns true if the value of the cardano_multi_asset_kvp_t object is different than empty.
+ *
+ * @param element Pointer to the cardano_object_t object.
+ * @return true if the value of the cardano_multi_asset_kvp_t object is different than empty, false otherwise.
+ */
+static bool
+different_than_empty(const cardano_object_t* element, const void* context)
+{
+  CARDANO_UNUSED(context);
+
+  const cardano_multi_asset_kvp_t* kvp = (const cardano_multi_asset_kvp_t*)((const void*)element);
+
+  if (kvp == NULL)
+  {
+    return false;
+  }
+
+  return cardano_asset_name_map_get_length(kvp->value) > 0U;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_multi_asset_new(cardano_multi_asset_t** multi_asset)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_asset_t* map = _cardano_malloc(sizeof(cardano_multi_asset_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_multi_asset_deallocate;
+
+  map->array = cardano_array_new(128);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *multi_asset = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_multi_asset_from_cbor(cardano_cbor_reader_t* reader, cardano_multi_asset_t** multi_asset)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  int64_t         map_size          = 0;
+  cardano_error_t expect_map_result = cardano_cbor_reader_read_start_map(reader, &map_size);
+
+  CARDANO_UNUSED(map_size);
+
+  if (expect_map_result != CARDANO_SUCCESS)
+  {
+    return expect_map_result;
+  }
+
+  cardano_multi_asset_t* data       = NULL;
+  cardano_error_t        new_result = cardano_multi_asset_new(&data);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  cardano_error_t read_state = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_state != CARDANO_SUCCESS)
+  {
+    cardano_multi_asset_unref(&data);
+    return read_state;
+  }
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    read_state = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (read_state != CARDANO_SUCCESS)
+    {
+      cardano_multi_asset_unref(&data);
+      return read_state;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_blake2b_hash_t* script_hash = NULL;
+
+    cardano_error_t read_script_hash_result = cardano_blake2b_hash_from_cbor(reader, &script_hash);
+
+    if (read_script_hash_result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&script_hash);
+      cardano_multi_asset_unref(&data);
+
+      return read_script_hash_result;
+    }
+
+    cardano_asset_name_map_t* asset_name_map = NULL;
+
+    cardano_error_t read_asset_name_map_result = cardano_asset_name_map_from_cbor(reader, &asset_name_map);
+
+    if (read_asset_name_map_result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&script_hash);
+      cardano_asset_name_map_unref(&asset_name_map);
+      cardano_multi_asset_unref(&data);
+
+      return read_asset_name_map_result;
+    }
+
+    cardano_error_t insert_result = cardano_multi_asset_insert_assets(data, script_hash, asset_name_map);
+
+    if (insert_result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&script_hash);
+      cardano_asset_name_map_unref(&asset_name_map);
+      cardano_multi_asset_unref(&data);
+
+      return insert_result;
+    }
+
+    cardano_blake2b_hash_unref(&script_hash);
+    cardano_asset_name_map_unref(&asset_name_map);
+  }
+
+  cardano_array_sort(data->array, compare_by_hash, NULL);
+
+  *multi_asset = data;
+
+  return cardano_cbor_reader_read_end_map(reader);
+}
+
+cardano_error_t
+cardano_multi_asset_to_cbor(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_cbor_writer_t*       writer)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t size           = cardano_array_get_size(multi_asset->array);
+  size_t non_empty_size = 0U;
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_multi_asset_kvp_t* kvp = (cardano_multi_asset_kvp_t*)((void*)cardano_array_get(multi_asset->array, i));
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    if (cardano_asset_name_map_get_length(kvp->value) > 0U)
+    {
+      ++non_empty_size;
+    }
+  }
+
+  cardano_error_t write_map_result = cardano_cbor_writer_write_start_map(writer, (int64_t)non_empty_size);
+
+  if (write_map_result != CARDANO_SUCCESS)
+  {
+    return write_map_result;
+  }
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_multi_asset_kvp_t* kvp = (cardano_multi_asset_kvp_t*)((void*)cardano_array_get(multi_asset->array, i));
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    if (cardano_asset_name_map_get_length(kvp->value) == 0U)
+    {
+      continue;
+    }
+
+    cardano_error_t write_voter_result = cardano_blake2b_hash_to_cbor(kvp->key, writer);
+
+    if (write_voter_result != CARDANO_SUCCESS)
+    {
+      return write_voter_result;
+    }
+
+    cardano_error_t write_asset_name_map_result = cardano_asset_name_map_to_cbor(kvp->value, writer);
+
+    if (write_asset_name_map_result != CARDANO_SUCCESS)
+    {
+      return write_asset_name_map_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_multi_asset_to_cip116_json(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_json_writer_t*       writer)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t size = cardano_array_get_size(multi_asset->array);
+
+  cardano_json_writer_write_start_object(writer);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_multi_asset_kvp_t* kvp = (cardano_multi_asset_kvp_t*)((void*)cardano_array_get(multi_asset->array, i));
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    const size_t policy_id_hex_size = cardano_blake2b_hash_get_hex_size(kvp->key);
+    char*        policy_id_hex      = _cardano_malloc(policy_id_hex_size);
+
+    if (policy_id_hex == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    cardano_error_t result = cardano_blake2b_hash_to_hex(kvp->key, policy_id_hex, policy_id_hex_size);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      _cardano_free(policy_id_hex);
+      return result;
+    }
+
+    const size_t hex_size = cardano_safe_strlen(policy_id_hex, policy_id_hex_size);
+    cardano_json_writer_write_property_name(writer, policy_id_hex, hex_size);
+
+    _cardano_free(policy_id_hex);
+
+    result = cardano_asset_name_map_to_cip116_json(kvp->value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_multi_asset_to_cip116_json_ex(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_json_writer_t*       writer)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t size = cardano_array_get_size(multi_asset->array);
+
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_multi_asset_kvp_t* kvp = (cardano_multi_asset_kvp_t*)((void*)cardano_array_get(multi_asset->array, i));
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    cardano_json_writer_write_start_object(writer);
+    cardano_json_writer_write_property_name(writer, "script_hash", 11);
+    cardano_error_t result = cardano_blake2b_hash_to_cip116_json(kvp->key, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_json_writer_write_property_name(writer, "assets", 6);
+    result = cardano_asset_name_map_to_cip116_json(kvp->value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_json_writer_write_end_object(writer);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_multi_asset_get_policy_count(const cardano_multi_asset_t* multi_asset)
+{
+  if (multi_asset == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_array_get_size(multi_asset->array);
+}
+
+cardano_error_t
+cardano_multi_asset_insert_assets(
+  cardano_multi_asset_t*    multi_asset,
+  cardano_blake2b_hash_t*   policy_id,
+  cardano_asset_name_map_t* assets)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (policy_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (assets == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t size = cardano_array_get_size(multi_asset->array);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_multi_asset_kvp_t* kvp = (cardano_multi_asset_kvp_t*)((void*)cardano_array_get(multi_asset->array, i));
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    if (cardano_blake2b_hash_equals(kvp->key, policy_id))
+    {
+      cardano_asset_name_map_unref(&kvp->value);
+      cardano_asset_name_map_ref(assets);
+
+      kvp->value = assets;
+
+      return CARDANO_SUCCESS;
+    }
+  }
+
+  cardano_multi_asset_kvp_t* kvp = _cardano_malloc(sizeof(cardano_multi_asset_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_multi_asset_kvp_deallocate;
+  kvp->key                = policy_id;
+  kvp->value              = assets;
+
+  cardano_blake2b_hash_ref(policy_id);
+  cardano_asset_name_map_ref(assets);
+
+  const size_t old_size = cardano_array_get_size(multi_asset->array);
+  const size_t new_size = cardano_array_push(multi_asset->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_multi_asset_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(multi_asset->array, compare_by_hash, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_multi_asset_get_assets(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_blake2b_hash_t*      policy_id,
+  cardano_asset_name_map_t**   assets)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (policy_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (assets == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t size = cardano_array_get_size(multi_asset->array);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_multi_asset_kvp_t* kvp = (cardano_multi_asset_kvp_t*)((void*)cardano_array_get(multi_asset->array, i));
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    if (cardano_blake2b_hash_equals(kvp->key, policy_id))
+    {
+      cardano_asset_name_map_ref(kvp->value);
+      *assets = kvp->value;
+
+      return CARDANO_SUCCESS;
+    }
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_multi_asset_get(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_blake2b_hash_t*      policy_id,
+  cardano_asset_name_t*        asset,
+  int64_t*                     value)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (policy_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_map_t* assets = NULL;
+
+  cardano_error_t get_assets_result = cardano_multi_asset_get_assets(multi_asset, policy_id, &assets);
+
+  if (get_assets_result != CARDANO_SUCCESS)
+  {
+    return get_assets_result;
+  }
+
+  cardano_error_t get_result = cardano_asset_name_map_get(assets, asset, value);
+
+  cardano_asset_name_map_unref(&assets);
+
+  return get_result;
+}
+
+cardano_error_t
+cardano_multi_asset_get_with_id(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_asset_id_t*          id,
+  int64_t*                     value)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t* policy_id = cardano_asset_id_get_policy_id(id);
+  cardano_asset_name_t*   name      = cardano_asset_id_get_asset_name(id);
+
+  cardano_blake2b_hash_unref(&policy_id);
+  cardano_asset_name_unref(&name);
+
+  if ((policy_id == NULL) || (name == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_multi_asset_get(multi_asset, policy_id, name, value);
+}
+
+cardano_error_t
+cardano_multi_asset_set(
+  cardano_multi_asset_t*  multi_asset,
+  cardano_blake2b_hash_t* policy_id,
+  cardano_asset_name_t*   asset,
+  const int64_t           value)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (policy_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_name_map_t* assets = NULL;
+
+  cardano_error_t get_assets_result = cardano_multi_asset_get_assets(multi_asset, policy_id, &assets);
+
+  if ((get_assets_result != CARDANO_SUCCESS) && (get_assets_result != CARDANO_ERROR_ELEMENT_NOT_FOUND))
+  {
+    return get_assets_result;
+  }
+
+  if (get_assets_result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+  {
+    cardano_asset_name_map_t* new_assets = NULL;
+
+    cardano_error_t new_result = cardano_asset_name_map_new(&new_assets);
+
+    if (new_result != CARDANO_SUCCESS)
+    {
+      return new_result;
+    }
+
+    cardano_error_t insert_result = cardano_multi_asset_insert_assets(multi_asset, policy_id, new_assets);
+
+    if (insert_result != CARDANO_SUCCESS)
+    {
+      cardano_asset_name_map_unref(&new_assets);
+
+      return insert_result;
+    }
+
+    assets = new_assets;
+  }
+
+  cardano_error_t set_result = cardano_asset_name_map_insert(assets, asset, value);
+
+  cardano_asset_name_map_unref(&assets);
+
+  return set_result;
+}
+
+cardano_error_t
+cardano_multi_asset_get_keys(
+  const cardano_multi_asset_t* multi_asset,
+  cardano_policy_id_list_t**   keys)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_policy_id_list_t* list = NULL;
+
+  cardano_error_t new_result = cardano_policy_id_list_new(&list);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  size_t size = cardano_array_get_size(multi_asset->array);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_multi_asset_kvp_t* kvp = (cardano_multi_asset_kvp_t*)((void*)cardano_array_get(multi_asset->array, i));
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+    if (kvp == NULL)
+    {
+      cardano_policy_id_list_unref(&list);
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    cardano_error_t insert_result = cardano_policy_id_list_add(list, kvp->key);
+
+    if (insert_result != CARDANO_SUCCESS)
+    {
+      cardano_policy_id_list_unref(&list);
+      return insert_result;
+    }
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_multi_asset_add(
+  const cardano_multi_asset_t* lhs,
+  const cardano_multi_asset_t* rhs,
+  cardano_multi_asset_t**      result)
+{
+  if (lhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (rhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_asset_t* map = NULL;
+
+  cardano_error_t create_result = cardano_multi_asset_new(&map);
+
+  if (create_result != CARDANO_SUCCESS)
+  {
+    return create_result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_object_t*          object = cardano_array_get(lhs->array, i);
+    cardano_multi_asset_kvp_t* kvp    = (cardano_multi_asset_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    cardano_error_t insert_result = cardano_multi_asset_insert_assets(map, kvp->key, kvp->value);
+
+    if (insert_result != CARDANO_SUCCESS)
+    {
+      cardano_multi_asset_unref(&map);
+      return insert_result;
+    }
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(rhs->array); ++i)
+  {
+    cardano_object_t*          object = cardano_array_get(rhs->array, i);
+    cardano_multi_asset_kvp_t* kvp    = (cardano_multi_asset_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    cardano_asset_name_map_t* value      = NULL;
+    cardano_error_t           get_result = cardano_multi_asset_get_assets(map, kvp->key, &value);
+
+    if (get_result == CARDANO_SUCCESS)
+    {
+      cardano_asset_name_map_t* add_result = NULL;
+
+      cardano_error_t add_assets_result = cardano_asset_name_map_add(value, kvp->value, &add_result);
+
+      if (add_assets_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_name_map_unref(&value);
+        cardano_asset_name_map_unref(&add_result);
+        cardano_multi_asset_unref(&map);
+
+        return add_assets_result;
+      }
+
+      cardano_error_t insert_result = cardano_multi_asset_insert_assets(map, kvp->key, add_result);
+
+      cardano_asset_name_map_unref(&value);
+      cardano_asset_name_map_unref(&add_result);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_multi_asset_unref(&map);
+
+        return insert_result;
+      }
+    }
+    else
+    {
+      cardano_error_t insert_result = cardano_multi_asset_insert_assets(map, kvp->key, kvp->value);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_multi_asset_unref(&map);
+
+        return insert_result;
+      }
+    }
+  }
+
+  cardano_array_t* filtered = cardano_array_filter(map->array, different_than_empty, NULL);
+
+  if (filtered == NULL)
+  {
+    cardano_multi_asset_unref(&map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_unref(&map->array);
+  map->array = filtered;
+
+  *result = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_multi_asset_subtract(
+  const cardano_multi_asset_t* lhs,
+  const cardano_multi_asset_t* rhs,
+  cardano_multi_asset_t**      result)
+{
+  if (lhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (rhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_asset_t* map = NULL;
+
+  cardano_error_t create_result = cardano_multi_asset_new(&map);
+
+  if (create_result != CARDANO_SUCCESS)
+  {
+    return create_result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_object_t*          object = cardano_array_get(lhs->array, i);
+    cardano_multi_asset_kvp_t* kvp    = (cardano_multi_asset_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    cardano_error_t insert_result = cardano_multi_asset_insert_assets(map, kvp->key, kvp->value);
+
+    if (insert_result != CARDANO_SUCCESS)
+    {
+      cardano_multi_asset_unref(&map);
+
+      return insert_result;
+    }
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(rhs->array); ++i)
+  {
+    cardano_object_t*          object = cardano_array_get(rhs->array, i);
+    cardano_multi_asset_kvp_t* kvp    = (cardano_multi_asset_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    cardano_asset_name_map_t* value      = NULL;
+    cardano_error_t           get_result = cardano_multi_asset_get_assets(map, kvp->key, &value);
+
+    if (get_result == CARDANO_SUCCESS)
+    {
+      cardano_asset_name_map_t* subtract_result = NULL;
+
+      cardano_error_t subtract_assets_result = cardano_asset_name_map_subtract(value, kvp->value, &subtract_result);
+
+      if (subtract_assets_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_name_map_unref(&value);
+        cardano_asset_name_map_unref(&subtract_result);
+        cardano_multi_asset_unref(&map);
+
+        return subtract_assets_result;
+      }
+
+      cardano_error_t insert_result = cardano_multi_asset_insert_assets(map, kvp->key, subtract_result);
+
+      cardano_asset_name_map_unref(&value);
+      cardano_asset_name_map_unref(&subtract_result);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_multi_asset_unref(&map);
+
+        return insert_result;
+      }
+    }
+    else
+    {
+      cardano_asset_name_map_t* empty_map       = NULL;
+      cardano_asset_name_map_t* subtract_result = NULL;
+
+      cardano_error_t create_empty_result = cardano_asset_name_map_new(&empty_map);
+
+      if (create_empty_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_name_map_unref(&empty_map);
+        cardano_multi_asset_unref(&map);
+
+        return create_empty_result;
+      }
+
+      cardano_error_t subtract_assets_result = cardano_asset_name_map_subtract(empty_map, kvp->value, &subtract_result);
+
+      if (subtract_assets_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_name_map_unref(&empty_map);
+        cardano_asset_name_map_unref(&subtract_result);
+        cardano_multi_asset_unref(&map);
+
+        return subtract_assets_result;
+      }
+
+      cardano_error_t insert_result = cardano_multi_asset_insert_assets(map, kvp->key, subtract_result);
+
+      cardano_asset_name_map_unref(&empty_map);
+      cardano_asset_name_map_unref(&subtract_result);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_multi_asset_unref(&map);
+
+        return insert_result;
+      }
+    }
+  }
+
+  cardano_array_t* filtered = cardano_array_filter(map->array, different_than_empty, NULL);
+
+  if (filtered == NULL)
+  {
+    cardano_multi_asset_unref(&map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_unref(&map->array);
+  map->array = filtered;
+
+  *result = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_multi_asset_get_positive(
+  cardano_multi_asset_t*  multi_asset,
+  cardano_multi_asset_t** result)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_asset_t* map = NULL;
+
+  cardano_error_t create_result = cardano_multi_asset_new(&map);
+
+  if (create_result != CARDANO_SUCCESS)
+  {
+    return create_result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(multi_asset->array); ++i)
+  {
+    cardano_object_t*          object = cardano_array_get(multi_asset->array, i);
+    cardano_multi_asset_kvp_t* kvp    = (cardano_multi_asset_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    cardano_asset_name_map_t* value      = NULL;
+    cardano_error_t           get_result = cardano_multi_asset_get_assets(multi_asset, kvp->key, &value);
+
+    cardano_asset_name_map_unref(&value);
+
+    if (get_result != CARDANO_SUCCESS)
+    {
+      cardano_multi_asset_unref(&map);
+
+      return get_result;
+    }
+
+    const size_t asset_names_count = cardano_asset_name_map_get_length(value);
+
+    for (size_t j = 0; j < asset_names_count; ++j)
+    {
+      cardano_asset_name_t* asset_name  = NULL;
+      int64_t               asset_value = 0;
+
+      cardano_error_t get_asset_result = cardano_asset_name_map_get_key_value_at(value, j, &asset_name, &asset_value);
+      cardano_asset_name_unref(&asset_name);
+
+      if (get_asset_result != CARDANO_SUCCESS)
+      {
+        cardano_multi_asset_unref(&map);
+
+        return get_asset_result;
+      }
+
+      if (asset_value > 0)
+      {
+        cardano_error_t insert_result = cardano_multi_asset_set(map, kvp->key, asset_name, asset_value);
+
+        if (insert_result != CARDANO_SUCCESS)
+        {
+          cardano_multi_asset_unref(&map);
+
+          return insert_result;
+        }
+      }
+    }
+  }
+
+  *result = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_multi_asset_get_negative(
+  cardano_multi_asset_t*  multi_asset,
+  cardano_multi_asset_t** result)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_asset_t* map = NULL;
+
+  cardano_error_t create_result = cardano_multi_asset_new(&map);
+
+  if (create_result != CARDANO_SUCCESS)
+  {
+    return create_result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(multi_asset->array); ++i)
+  {
+    cardano_object_t*          object = cardano_array_get(multi_asset->array, i);
+    cardano_multi_asset_kvp_t* kvp    = (cardano_multi_asset_kvp_t*)((void*)object);
+    cardano_object_unref(&object);
+
+    cardano_asset_name_map_t* value      = NULL;
+    cardano_error_t           get_result = cardano_multi_asset_get_assets(multi_asset, kvp->key, &value);
+
+    cardano_asset_name_map_unref(&value);
+
+    if (get_result != CARDANO_SUCCESS)
+    {
+      cardano_multi_asset_unref(&map);
+
+      return get_result;
+    }
+
+    const size_t asset_names_count = cardano_asset_name_map_get_length(value);
+
+    for (size_t j = 0; j < asset_names_count; ++j)
+    {
+      cardano_asset_name_t* asset_name  = NULL;
+      int64_t               asset_value = 0;
+
+      cardano_error_t get_asset_result = cardano_asset_name_map_get_key_value_at(value, j, &asset_name, &asset_value);
+      cardano_asset_name_unref(&asset_name);
+
+      if (get_asset_result != CARDANO_SUCCESS)
+      {
+        cardano_multi_asset_unref(&map);
+
+        return get_asset_result;
+      }
+
+      if (asset_value < 0)
+      {
+        cardano_error_t insert_result = cardano_multi_asset_set(map, kvp->key, asset_name, asset_value);
+
+        if (insert_result != CARDANO_SUCCESS)
+        {
+          cardano_multi_asset_unref(&map);
+
+          return insert_result;
+        }
+      }
+    }
+  }
+
+  *result = map;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_multi_asset_equals(const cardano_multi_asset_t* lhs, const cardano_multi_asset_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (cardano_array_get_size(lhs->array) != cardano_array_get_size(rhs->array))
+  {
+    return false;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_object_t*          lhs_object = cardano_array_get(lhs->array, i);
+    cardano_multi_asset_kvp_t* lhs_kvp    = (cardano_multi_asset_kvp_t*)((void*)lhs_object);
+    cardano_object_unref(&lhs_object);
+
+    if (lhs_kvp == NULL)
+    {
+      return false;
+    }
+
+    cardano_object_t*          rhs_object = cardano_array_get(rhs->array, i);
+    cardano_multi_asset_kvp_t* rhs_kvp    = (cardano_multi_asset_kvp_t*)((void*)rhs_object);
+    cardano_object_unref(&rhs_object);
+
+    if (rhs_kvp == NULL)
+    {
+      return false;
+    }
+
+    if (!cardano_blake2b_hash_equals(lhs_kvp->key, rhs_kvp->key))
+    {
+      return false;
+    }
+
+    if (!cardano_asset_name_map_equals(lhs_kvp->value, rhs_kvp->value))
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+void
+cardano_multi_asset_unref(cardano_multi_asset_t** multi_asset)
+{
+  if ((multi_asset == NULL) || (*multi_asset == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*multi_asset)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *multi_asset = NULL;
+    return;
+  }
+}
+
+void
+cardano_multi_asset_ref(cardano_multi_asset_t* multi_asset)
+{
+  if (multi_asset == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&multi_asset->base);
+}
+
+size_t
+cardano_multi_asset_refcount(const cardano_multi_asset_t* multi_asset)
+{
+  if (multi_asset == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&multi_asset->base);
+}
+
+void
+cardano_multi_asset_set_last_error(cardano_multi_asset_t* multi_asset, const char* message)
+{
+  cardano_object_set_last_error(&multi_asset->base, message);
+}
+
+const char*
+cardano_multi_asset_get_last_error(const cardano_multi_asset_t* multi_asset)
+{
+  return cardano_object_get_last_error(&multi_asset->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_multi_asset_kvp_deep_clone(const cardano_multi_asset_kvp_t* source, cardano_multi_asset_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_asset_kvp_t* copy = _cardano_malloc(sizeof(cardano_multi_asset_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = NULL;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_asset_name_map_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_multi_asset_kvp_t* copy   = NULL;
+  const cardano_error_t      result = cardano_multi_asset_kvp_deep_clone((const cardano_multi_asset_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_multi_asset_deep_clone(const cardano_multi_asset_t* source, cardano_multi_asset_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_asset_t* copy = _cardano_malloc(sizeof(cardano_multi_asset_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/assets/policy_id_list.c b/vendor/src/assets/policy_id_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/assets/policy_id_list.c
@@ -0,0 +1,278 @@
+/**
+ * \file policy_id_list.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license");
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/policy_id_list.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano asset name list.
+ */
+typedef struct cardano_policy_id_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_policy_id_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a asset name object.
+ *
+ * This function is responsible for properly deallocating a asset name object (`cardano_blake2b_hash_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the policy_id object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_blake2b_hash_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the policy_id
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_policy_id_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_policy_id_list_t* list = (cardano_policy_id_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_policy_id_list_new(cardano_policy_id_list_t** policy_id)
+{
+  if (policy_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_policy_id_list_t* list = _cardano_malloc(sizeof(cardano_policy_id_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_policy_id_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *policy_id = list;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_policy_id_list_get_length(const cardano_policy_id_list_t* policy_id_list)
+{
+  if (policy_id_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(policy_id_list->array);
+}
+
+cardano_error_t
+cardano_policy_id_list_get(
+  const cardano_policy_id_list_t* policy_id_list,
+  size_t                          index,
+  cardano_blake2b_hash_t**        element)
+{
+  if (policy_id_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(policy_id_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_blake2b_hash_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_policy_id_list_add(cardano_policy_id_list_t* policy_id_list, cardano_blake2b_hash_t* element)
+{
+  if (policy_id_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(policy_id_list->array);
+  const size_t new_size      = cardano_array_push(policy_id_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_policy_id_list_unref(cardano_policy_id_list_t** policy_id_list)
+{
+  if ((policy_id_list == NULL) || (*policy_id_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*policy_id_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *policy_id_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_policy_id_list_ref(cardano_policy_id_list_t* policy_id_list)
+{
+  if (policy_id_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&policy_id_list->base);
+}
+
+size_t
+cardano_policy_id_list_refcount(const cardano_policy_id_list_t* policy_id_list)
+{
+  if (policy_id_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&policy_id_list->base);
+}
+
+void
+cardano_policy_id_list_set_last_error(cardano_policy_id_list_t* policy_id_list, const char* message)
+{
+  cardano_object_set_last_error(&policy_id_list->base, message);
+}
+
+const char*
+cardano_policy_id_list_get_last_error(const cardano_policy_id_list_t* policy_id_list)
+{
+  return cardano_object_get_last_error(&policy_id_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_blake2b_hash_t* copy   = NULL;
+  const cardano_error_t   result = cardano_blake2b_hash_deep_clone((const cardano_blake2b_hash_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_policy_id_list_deep_clone(const cardano_policy_id_list_t* source, cardano_policy_id_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_policy_id_list_t* copy = _cardano_malloc(sizeof(cardano_policy_id_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/auxiliary_data/auxiliary_data.c b/vendor/src/auxiliary_data/auxiliary_data.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/auxiliary_data/auxiliary_data.c
@@ -0,0 +1,1239 @@
+/**
+ * \file auxiliary_data.c
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/auxiliary_data.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+#include <cardano/scripts/plutus_scripts/plutus_v1_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v2_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v3_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v4_script.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Auxiliary Data encapsulate certain optional information that can be attached
+ * to a transaction. This data includes transaction metadata and scripts.
+ *
+ * The Auxiliary Data is hashed and referenced in the transaction body.
+ */
+typedef struct cardano_auxiliary_data_t
+{
+    cardano_object_t                 base;
+    cardano_transaction_metadata_t*  metadata;
+    cardano_native_script_list_t*    native_scripts;
+    cardano_plutus_v1_script_list_t* plutus_v1_scripts;
+    cardano_plutus_v2_script_list_t* plutus_v2_scripts;
+    cardano_plutus_v3_script_list_t* plutus_v3_scripts;
+    cardano_plutus_v4_script_list_t* plutus_v4_scripts;
+    cardano_buffer_t*                cbor_cache;
+} cardano_auxiliary_data_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a auxiliary_data object.
+ *
+ * This function is responsible for properly deallocating a auxiliary_data object (`cardano_auxiliary_data_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the auxiliary_data object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_auxiliary_data_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the auxiliary_data
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_auxiliary_data_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_auxiliary_data_t* auxiliary_data = (cardano_auxiliary_data_t*)object;
+
+  cardano_transaction_metadata_unref(&auxiliary_data->metadata);
+  cardano_native_script_list_unref(&auxiliary_data->native_scripts);
+  cardano_plutus_v1_script_list_unref(&auxiliary_data->plutus_v1_scripts);
+  cardano_plutus_v2_script_list_unref(&auxiliary_data->plutus_v2_scripts);
+  cardano_plutus_v3_script_list_unref(&auxiliary_data->plutus_v3_scripts);
+  cardano_plutus_v4_script_list_unref(&auxiliary_data->plutus_v4_scripts);
+  cardano_buffer_unref(&auxiliary_data->cbor_cache);
+
+  _cardano_free(object);
+}
+
+/**
+ * \brief Returns the size of the map that will be created when serializing the auxiliary data.
+ *
+ * \param auxiliary_data The auxiliary data object to be serialized.
+ *
+ * \return The size of the map that will be created when serializing the auxiliary data.
+ */
+static int64_t
+get_map_size(const cardano_auxiliary_data_t* auxiliary_data)
+{
+  int64_t map_size = 0;
+
+  if (auxiliary_data->metadata != NULL)
+  {
+    ++map_size;
+  }
+
+  if (auxiliary_data->native_scripts != NULL)
+  {
+    ++map_size;
+  }
+
+  if (auxiliary_data->plutus_v1_scripts != NULL)
+  {
+    ++map_size;
+  }
+
+  if (auxiliary_data->plutus_v2_scripts != NULL)
+  {
+    ++map_size;
+  }
+
+  if (auxiliary_data->plutus_v3_scripts != NULL)
+  {
+    ++map_size;
+  }
+
+  if (auxiliary_data->plutus_v4_scripts != NULL)
+  {
+    ++map_size;
+  }
+
+  return map_size;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_auxiliary_data_new(cardano_auxiliary_data_t** auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_auxiliary_data_t* new_auxiliary_data = (cardano_auxiliary_data_t*)_cardano_malloc(sizeof(cardano_auxiliary_data_t));
+
+  if (new_auxiliary_data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  new_auxiliary_data->base.ref_count     = 1;
+  new_auxiliary_data->base.last_error[0] = '\0';
+  new_auxiliary_data->base.deallocator   = cardano_auxiliary_data_deallocate;
+  new_auxiliary_data->metadata           = NULL;
+  new_auxiliary_data->native_scripts     = NULL;
+  new_auxiliary_data->plutus_v1_scripts  = NULL;
+  new_auxiliary_data->plutus_v2_scripts  = NULL;
+  new_auxiliary_data->plutus_v3_scripts  = NULL;
+  new_auxiliary_data->plutus_v4_scripts  = NULL;
+  new_auxiliary_data->cbor_cache         = NULL;
+
+  *auxiliary_data = new_auxiliary_data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_auxiliary_data_from_cbor(cardano_cbor_reader_t* reader, cardano_auxiliary_data_t** auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *auxiliary_data = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_auxiliary_data_t* new_auxiliary_data = NULL;
+
+  cardano_error_t create_aux_data_result = cardano_auxiliary_data_new(&new_auxiliary_data);
+
+  if (create_aux_data_result != CARDANO_SUCCESS)
+  {
+    *auxiliary_data = NULL;
+    return create_aux_data_result;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        copy_result = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_auxiliary_data_unref(&new_auxiliary_data);
+    *auxiliary_data = NULL;
+
+    return copy_result;
+  }
+
+  copy_result = cardano_cbor_reader_read_encoded_value(reader_copy, &new_auxiliary_data->cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_auxiliary_data_unref(&new_auxiliary_data);
+    *auxiliary_data = NULL;
+
+    return copy_result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    cardano_auxiliary_data_unref(&new_auxiliary_data);
+    *auxiliary_data = NULL;
+    return peek_result;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (state == CARDANO_CBOR_READER_STATE_START_MAP)
+  {
+    result = cardano_transaction_metadata_from_cbor(reader, &new_auxiliary_data->metadata);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_auxiliary_data_unref(&new_auxiliary_data);
+      *auxiliary_data = NULL;
+
+      return result;
+    }
+
+    *auxiliary_data = new_auxiliary_data;
+
+    return CARDANO_SUCCESS;
+  }
+  else if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    cardano_cbor_tag_t tag;
+
+    result = cardano_cbor_reader_read_tag(reader, &tag);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_auxiliary_data_unref(&new_auxiliary_data);
+      *auxiliary_data = NULL;
+
+      return result;
+    }
+
+    if ((size_t)tag != 259U)
+    {
+      cardano_auxiliary_data_unref(&new_auxiliary_data);
+      *auxiliary_data = NULL;
+
+      cardano_cbor_reader_set_last_error(reader, "Invalid tag value for auxiliary data. Expected 259.");
+
+      return CARDANO_ERROR_INVALID_CBOR_VALUE;
+    }
+
+    int64_t map_size = 0;
+    result           = cardano_cbor_reader_read_start_map(reader, &map_size);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_auxiliary_data_unref(&new_auxiliary_data);
+      *auxiliary_data = NULL;
+
+      return result;
+    }
+
+    bool seen[6] = { false, false, false, false, false, false };
+
+    state = CARDANO_CBOR_READER_STATE_START_MAP;
+
+    while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      result = cardano_cbor_reader_peek_state(reader, &state);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_auxiliary_data_unref(&new_auxiliary_data);
+        *auxiliary_data = NULL;
+
+        return result;
+      }
+
+      if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+      {
+        break;
+      }
+
+      uint64_t key = 0;
+      result       = cardano_cbor_reader_read_uint(reader, &key);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_auxiliary_data_unref(&new_auxiliary_data);
+        *auxiliary_data = NULL;
+
+        return result;
+      }
+
+      if (key < 6U)
+      {
+        if (seen[(size_t)key])
+        {
+          cardano_auxiliary_data_unref(&new_auxiliary_data);
+          *auxiliary_data = NULL;
+          cardano_cbor_reader_set_last_error(reader, "Duplicate key in auxiliary data.");
+
+          return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+        }
+
+        seen[(size_t)key] = true;
+      }
+
+      switch (key)
+      {
+        case 0:
+        {
+          result = cardano_transaction_metadata_from_cbor(reader, &new_auxiliary_data->metadata);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            cardano_auxiliary_data_unref(&new_auxiliary_data);
+            *auxiliary_data = NULL;
+
+            return result;
+          }
+
+          break;
+        }
+        case 1:
+        {
+          result = cardano_native_script_list_from_cbor(reader, &new_auxiliary_data->native_scripts);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            cardano_auxiliary_data_unref(&new_auxiliary_data);
+            *auxiliary_data = NULL;
+
+            return result;
+          }
+
+          break;
+        }
+        case 2:
+        {
+          result = cardano_plutus_v1_script_list_from_cbor(reader, &new_auxiliary_data->plutus_v1_scripts);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            cardano_auxiliary_data_unref(&new_auxiliary_data);
+            *auxiliary_data = NULL;
+
+            return result;
+          }
+
+          break;
+        }
+        case 3:
+        {
+          result = cardano_plutus_v2_script_list_from_cbor(reader, &new_auxiliary_data->plutus_v2_scripts);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            cardano_auxiliary_data_unref(&new_auxiliary_data);
+            *auxiliary_data = NULL;
+
+            return result;
+          }
+
+          break;
+        }
+        case 4:
+        {
+          result = cardano_plutus_v3_script_list_from_cbor(reader, &new_auxiliary_data->plutus_v3_scripts);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            cardano_auxiliary_data_unref(&new_auxiliary_data);
+            *auxiliary_data = NULL;
+
+            return result;
+          }
+
+          break;
+        }
+        case 5:
+        {
+          result = cardano_plutus_v4_script_list_from_cbor(reader, &new_auxiliary_data->plutus_v4_scripts);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            cardano_auxiliary_data_unref(&new_auxiliary_data);
+            *auxiliary_data = NULL;
+
+            return result;
+          }
+
+          break;
+        }
+        default:
+        {
+          cardano_auxiliary_data_unref(&new_auxiliary_data);
+          *auxiliary_data = NULL;
+
+          cardano_cbor_reader_set_last_error(reader, "Invalid key value for auxiliary data.");
+
+          return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+        }
+      }
+    }
+
+    result = cardano_cbor_validate_end_map("auxiliary_data", reader);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_auxiliary_data_unref(&new_auxiliary_data);
+      *auxiliary_data = NULL;
+
+      return result;
+    }
+  }
+  else
+  {
+    int64_t array_size = 0;
+
+    result = cardano_cbor_reader_read_start_array(reader, &array_size);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_auxiliary_data_unref(&new_auxiliary_data);
+      *auxiliary_data = NULL;
+
+      return result;
+    }
+
+    result = cardano_transaction_metadata_from_cbor(reader, &new_auxiliary_data->metadata);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_auxiliary_data_unref(&new_auxiliary_data);
+      *auxiliary_data = NULL;
+
+      return result;
+    }
+
+    if (array_size > 1)
+    {
+      result = cardano_native_script_list_from_cbor(reader, &new_auxiliary_data->native_scripts);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_auxiliary_data_unref(&new_auxiliary_data);
+        *auxiliary_data = NULL;
+
+        return result;
+      }
+    }
+
+    result = cardano_cbor_validate_end_array("auxiliary_data", reader);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_auxiliary_data_unref(&new_auxiliary_data);
+      *auxiliary_data = NULL;
+
+      return result;
+    }
+  }
+
+  *auxiliary_data = new_auxiliary_data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_auxiliary_data_to_cbor(
+  const cardano_auxiliary_data_t* auxiliary_data,
+  cardano_cbor_writer_t*          writer)
+{
+  if (auxiliary_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (auxiliary_data->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(auxiliary_data->cbor_cache), cardano_buffer_get_size(auxiliary_data->cbor_cache));
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_cbor_writer_write_tag(writer, 259);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t map_size = get_map_size(auxiliary_data);
+
+  result = cardano_cbor_writer_write_start_map(writer, map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (auxiliary_data->metadata != NULL)
+  {
+    result = cardano_cbor_writer_write_uint(writer, 0);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_transaction_metadata_to_cbor(auxiliary_data->metadata, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (auxiliary_data->native_scripts != NULL)
+  {
+    result = cardano_cbor_writer_write_uint(writer, 1);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_native_script_list_to_cbor(auxiliary_data->native_scripts, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (auxiliary_data->plutus_v1_scripts != NULL)
+  {
+    result = cardano_cbor_writer_write_uint(writer, 2);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_v1_script_list_to_cbor(auxiliary_data->plutus_v1_scripts, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (auxiliary_data->plutus_v2_scripts != NULL)
+  {
+    result = cardano_cbor_writer_write_uint(writer, 3);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_v2_script_list_to_cbor(auxiliary_data->plutus_v2_scripts, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (auxiliary_data->plutus_v3_scripts != NULL)
+  {
+    result = cardano_cbor_writer_write_uint(writer, 4);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_v3_script_list_to_cbor(auxiliary_data->plutus_v3_scripts, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (auxiliary_data->plutus_v4_scripts != NULL)
+  {
+    result = cardano_cbor_writer_write_uint(writer, 5);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_v4_script_list_to_cbor(auxiliary_data->plutus_v4_scripts, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_auxiliary_data_to_cip116_json(
+  const cardano_auxiliary_data_t* auxiliary_data,
+  cardano_json_writer_t*          writer)
+{
+  if ((auxiliary_data == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  const cardano_transaction_metadata_t* metadata = auxiliary_data->metadata;
+
+  if ((metadata != NULL) && (cardano_transaction_metadata_get_length(metadata) > 0U))
+  {
+    cardano_json_writer_write_property_name(writer, "metadata", 8);
+
+    cardano_error_t error = cardano_transaction_metadata_to_cip116_json(metadata, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  const cardano_native_script_list_t* native_list = auxiliary_data->native_scripts;
+
+  if ((native_list != NULL) && (cardano_native_script_list_get_length(native_list) > 0U))
+  {
+    cardano_json_writer_write_property_name(writer, "native_scripts", 14);
+
+    cardano_error_t error = cardano_native_script_list_to_cip116_json(native_list, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  const cardano_plutus_v1_script_list_t* v1_list = auxiliary_data->plutus_v1_scripts;
+  const cardano_plutus_v2_script_list_t* v2_list = auxiliary_data->plutus_v2_scripts;
+  const cardano_plutus_v3_script_list_t* v3_list = auxiliary_data->plutus_v3_scripts;
+  const cardano_plutus_v4_script_list_t* v4_list = auxiliary_data->plutus_v4_scripts;
+
+  const size_t v1_len = cardano_plutus_v1_script_list_get_length(v1_list);
+  const size_t v2_len = cardano_plutus_v2_script_list_get_length(v2_list);
+  const size_t v3_len = cardano_plutus_v3_script_list_get_length(v3_list);
+  const size_t v4_len = cardano_plutus_v4_script_list_get_length(v4_list);
+
+  const size_t total_plutus_scripts = v1_len + v2_len + v3_len + v4_len;
+
+  if (total_plutus_scripts > 0U)
+  {
+    cardano_json_writer_write_property_name(writer, "plutus_scripts", 14);
+    cardano_json_writer_write_start_array(writer);
+
+    for (size_t i = 0U; i < v1_len; ++i)
+    {
+      cardano_plutus_v1_script_t* script = NULL;
+      cardano_error_t             error  = cardano_plutus_v1_script_list_get(v1_list, i, &script);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      error = cardano_plutus_v1_script_to_cip116_json(script, writer);
+      cardano_plutus_v1_script_unref(&script);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+    }
+
+    for (size_t i = 0U; i < v2_len; ++i)
+    {
+      cardano_plutus_v2_script_t* script = NULL;
+      cardano_error_t             error  = cardano_plutus_v2_script_list_get(v2_list, i, &script);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      error = cardano_plutus_v2_script_to_cip116_json(script, writer);
+      cardano_plutus_v2_script_unref(&script);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+    }
+
+    for (size_t i = 0U; i < v3_len; ++i)
+    {
+      cardano_plutus_v3_script_t* script = NULL;
+      cardano_error_t             error  = cardano_plutus_v3_script_list_get(v3_list, i, &script);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      error = cardano_plutus_v3_script_to_cip116_json(script, writer);
+      cardano_plutus_v3_script_unref(&script);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+    }
+
+    for (size_t i = 0U; i < v4_len; ++i)
+    {
+      cardano_plutus_v4_script_t* script = NULL;
+      cardano_error_t             error  = cardano_plutus_v4_script_list_get(v4_list, i, &script);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      error = cardano_plutus_v4_script_to_cip116_json(script, writer);
+      cardano_plutus_v4_script_unref(&script);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+    }
+
+    cardano_json_writer_write_end_array(writer);
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_transaction_metadata_t*
+cardano_auxiliary_data_get_transaction_metadata(cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_metadata_ref(auxiliary_data->metadata);
+
+  return auxiliary_data->metadata;
+}
+
+cardano_error_t
+cardano_auxiliary_data_set_transaction_metadata(
+  cardano_auxiliary_data_t*       auxiliary_data,
+  cardano_transaction_metadata_t* metadata)
+{
+  if (auxiliary_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadata == NULL)
+  {
+    cardano_transaction_metadata_unref(&auxiliary_data->metadata);
+    auxiliary_data->metadata = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_transaction_metadata_unref(&auxiliary_data->metadata);
+  cardano_transaction_metadata_ref(metadata);
+
+  auxiliary_data->metadata = metadata;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_native_script_list_t*
+cardano_auxiliary_data_get_native_scripts(cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_native_script_list_ref(auxiliary_data->native_scripts);
+
+  return auxiliary_data->native_scripts;
+}
+
+cardano_error_t
+cardano_auxiliary_data_set_native_scripts(
+  cardano_auxiliary_data_t*     auxiliary_data,
+  cardano_native_script_list_t* scripts)
+{
+  if (auxiliary_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (scripts == NULL)
+  {
+    cardano_native_script_list_unref(&auxiliary_data->native_scripts);
+    auxiliary_data->native_scripts = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_native_script_list_unref(&auxiliary_data->native_scripts);
+  cardano_native_script_list_ref(scripts);
+
+  auxiliary_data->native_scripts = scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_plutus_v1_script_list_t*
+cardano_auxiliary_data_get_plutus_v1_scripts(cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_plutus_v1_script_list_ref(auxiliary_data->plutus_v1_scripts);
+
+  return auxiliary_data->plutus_v1_scripts;
+}
+
+cardano_error_t
+cardano_auxiliary_data_set_plutus_v1_scripts(
+  cardano_auxiliary_data_t*        auxiliary_data,
+  cardano_plutus_v1_script_list_t* scripts)
+{
+  if (auxiliary_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (scripts == NULL)
+  {
+    cardano_plutus_v1_script_list_unref(&auxiliary_data->plutus_v1_scripts);
+    auxiliary_data->plutus_v1_scripts = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_plutus_v1_script_list_unref(&auxiliary_data->plutus_v1_scripts);
+  cardano_plutus_v1_script_list_ref(scripts);
+
+  auxiliary_data->plutus_v1_scripts = scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_plutus_v2_script_list_t*
+cardano_auxiliary_data_get_plutus_v2_scripts(cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_plutus_v2_script_list_ref(auxiliary_data->plutus_v2_scripts);
+
+  return auxiliary_data->plutus_v2_scripts;
+}
+
+cardano_error_t
+cardano_auxiliary_data_set_plutus_v2_scripts(
+  cardano_auxiliary_data_t*        auxiliary_data,
+  cardano_plutus_v2_script_list_t* scripts)
+{
+  if (auxiliary_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (scripts == NULL)
+  {
+    cardano_plutus_v2_script_list_unref(&auxiliary_data->plutus_v2_scripts);
+    auxiliary_data->plutus_v2_scripts = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_plutus_v2_script_list_unref(&auxiliary_data->plutus_v2_scripts);
+  cardano_plutus_v2_script_list_ref(scripts);
+
+  auxiliary_data->plutus_v2_scripts = scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_plutus_v3_script_list_t*
+cardano_auxiliary_data_get_plutus_v3_scripts(cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_plutus_v3_script_list_ref(auxiliary_data->plutus_v3_scripts);
+
+  return auxiliary_data->plutus_v3_scripts;
+}
+
+cardano_error_t
+cardano_auxiliary_data_set_plutus_v3_scripts(
+  cardano_auxiliary_data_t*        auxiliary_data,
+  cardano_plutus_v3_script_list_t* scripts)
+{
+  if (auxiliary_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (scripts == NULL)
+  {
+    cardano_plutus_v3_script_list_unref(&auxiliary_data->plutus_v3_scripts);
+    auxiliary_data->plutus_v3_scripts = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_plutus_v3_script_list_unref(&auxiliary_data->plutus_v3_scripts);
+  cardano_plutus_v3_script_list_ref(scripts);
+
+  auxiliary_data->plutus_v3_scripts = scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_plutus_v4_script_list_t*
+cardano_auxiliary_data_get_plutus_v4_scripts(cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_plutus_v4_script_list_ref(auxiliary_data->plutus_v4_scripts);
+
+  return auxiliary_data->plutus_v4_scripts;
+}
+
+cardano_error_t
+cardano_auxiliary_data_set_plutus_v4_scripts(
+  cardano_auxiliary_data_t*        auxiliary_data,
+  cardano_plutus_v4_script_list_t* scripts)
+{
+  if (auxiliary_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (scripts == NULL)
+  {
+    cardano_plutus_v4_script_list_unref(&auxiliary_data->plutus_v4_scripts);
+    auxiliary_data->plutus_v4_scripts = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_plutus_v4_script_list_unref(&auxiliary_data->plutus_v4_scripts);
+  cardano_plutus_v4_script_list_ref(scripts);
+
+  auxiliary_data->plutus_v4_scripts = scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_auxiliary_data_get_hash(cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_error_t result = cardano_auxiliary_data_to_cbor(auxiliary_data, writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return NULL;
+  }
+
+  const size_t cbor_size = cardano_cbor_writer_get_encode_size(writer);
+  byte_t*      cbor_data = (byte_t*)_cardano_malloc(cbor_size);
+
+  if (cbor_data == NULL)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return NULL;
+  }
+
+  result = cardano_cbor_writer_encode(writer, cbor_data, cbor_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(cbor_data);
+    cardano_cbor_writer_unref(&writer);
+
+    return NULL;
+  }
+
+  cardano_cbor_writer_unref(&writer);
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  result = cardano_blake2b_compute_hash(cbor_data, cbor_size, CARDANO_BLAKE2B_HASH_SIZE_256, &hash);
+
+  _cardano_free(cbor_data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return hash;
+}
+
+void
+cardano_auxiliary_data_clear_cbor_cache(cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&auxiliary_data->cbor_cache);
+  auxiliary_data->cbor_cache = NULL;
+}
+
+void
+cardano_auxiliary_data_unref(cardano_auxiliary_data_t** auxiliary_data)
+{
+  if ((auxiliary_data == NULL) || (*auxiliary_data == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*auxiliary_data)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *auxiliary_data = NULL;
+    return;
+  }
+}
+
+void
+cardano_auxiliary_data_ref(cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&auxiliary_data->base);
+}
+
+size_t
+cardano_auxiliary_data_refcount(const cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (auxiliary_data == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&auxiliary_data->base);
+}
+
+void
+cardano_auxiliary_data_set_last_error(cardano_auxiliary_data_t* auxiliary_data, const char* message)
+{
+  cardano_object_set_last_error(&auxiliary_data->base, message);
+}
+
+const char*
+cardano_auxiliary_data_get_last_error(const cardano_auxiliary_data_t* auxiliary_data)
+{
+  return cardano_object_get_last_error(&auxiliary_data->base);
+}
+
+cardano_error_t
+cardano_auxiliary_data_deep_clone(const cardano_auxiliary_data_t* source, cardano_auxiliary_data_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_auxiliary_data_t* copy = _cardano_malloc(sizeof(cardano_auxiliary_data_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->metadata           = NULL;
+  copy->native_scripts     = NULL;
+  copy->plutus_v1_scripts  = NULL;
+  copy->plutus_v2_scripts  = NULL;
+  copy->plutus_v3_scripts  = NULL;
+  copy->plutus_v4_scripts  = NULL;
+  copy->cbor_cache         = NULL;
+
+  if (source->metadata != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_metadata_deep_clone(source->metadata, &copy->metadata);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->native_scripts != NULL)
+  {
+    const cardano_error_t result = cardano_native_script_list_deep_clone(source->native_scripts, &copy->native_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v1_scripts != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v1_script_list_deep_clone(source->plutus_v1_scripts, &copy->plutus_v1_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v2_scripts != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v2_script_list_deep_clone(source->plutus_v2_scripts, &copy->plutus_v2_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v3_scripts != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v3_script_list_deep_clone(source->plutus_v3_scripts, &copy->plutus_v3_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v4_scripts != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v4_script_list_deep_clone(source->plutus_v4_scripts, &copy->plutus_v4_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/auxiliary_data/metadatum.c b/vendor/src/auxiliary_data/metadatum.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/auxiliary_data/metadatum.c
@@ -0,0 +1,1755 @@
+/**
+ * \file metadatum.c
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/metadatum.h>
+#include <cardano/auxiliary_data/metadatum_kind.h>
+#include <cardano/auxiliary_data/metadatum_list.h>
+#include <cardano/auxiliary_data/metadatum_map.h>
+#include <cardano/buffer.h>
+#include <cardano/common/bigint.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <cardano/json/json_writer.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano metadatum.
+ */
+typedef struct cardano_metadatum_t
+{
+    cardano_object_t          base;
+    cardano_metadatum_map_t*  map;
+    cardano_metadatum_list_t* list;
+    cardano_bigint_t*         integer;
+    cardano_buffer_t*         bytes;
+    cardano_buffer_t*         text;
+    cardano_metadatum_kind_t  kind;
+} cardano_metadatum_t;
+
+/* STATIC FUNCTIONS FORWARD DECLARATIONS *************************************/
+
+/**
+ * \brief Converts a JSON object to a metadatum.
+ *
+ * \param[in] json_obj The JSON object to be converted.
+ * \param[out] metadatum The metadatum object to be created.
+ *
+ * \@return The result of the operation.
+ */
+static cardano_error_t convert_json_to_metadatum(cardano_json_object_t* json_obj, cardano_metadatum_t** metadatum);
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a metadatum object.
+ *
+ * This function is responsible for properly deallocating a metadatum object (`cardano_metadatum_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the metadatum object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_metadatum_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the metadatum
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_metadatum_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_metadatum_t* data = (cardano_metadatum_t*)object;
+
+  cardano_metadatum_map_unref(&data->map);
+  cardano_metadatum_list_unref(&data->list);
+  cardano_buffer_unref(&data->bytes);
+  cardano_buffer_unref(&data->text);
+  cardano_bigint_unref(&data->integer);
+
+  data->integer = NULL;
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new metadatum object.
+ *
+ * \return A pointer to the newly created metadatum object, or `NULL` if the operation failed.
+ */
+static cardano_metadatum_t*
+cardano_metadatum_new(void)
+{
+  cardano_metadatum_t* data = _cardano_malloc(sizeof(cardano_metadatum_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_metadatum_deallocate;
+
+  data->map     = NULL;
+  data->list    = NULL;
+  data->integer = NULL;
+  data->bytes   = NULL;
+  data->text    = NULL;
+  data->kind    = CARDANO_METADATUM_KIND_MAP;
+
+  return data;
+}
+
+/**
+ * \brief Handles the conversion from JSON array to metadatum.
+ *
+ * \param json_obj The JSON array to be converted.
+ * \param metadatum The metadatum object to be created.
+ *
+ * \return The result of the operation.
+ */
+static cardano_error_t
+handle_json_array(cardano_json_object_t* json_obj, cardano_metadatum_t** metadatum)
+{
+  assert(json_obj != NULL);
+  assert(metadatum != NULL);
+
+  cardano_metadatum_list_t* list  = NULL;
+  cardano_error_t           error = cardano_metadatum_list_new(&list);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  const size_t array_len = cardano_json_object_array_get_length(json_obj);
+
+  for (size_t i = 0U; i < array_len; ++i)
+  {
+    cardano_json_object_t* elem = cardano_json_object_array_get_ex(json_obj, i);
+
+    cardano_metadatum_t* elem_metadatum = NULL;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: Parsing the JSON object is a recursive operation. TODO: Create cardano_json_reader_t and cardano_json_writer_t to break the recursion.
+    error = convert_json_to_metadatum(elem, &elem_metadatum);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_unref(&elem_metadatum);
+      cardano_metadatum_list_unref(&list);
+
+      return error;
+    }
+
+    error = cardano_metadatum_list_add(list, elem_metadatum);
+    cardano_metadatum_unref(&elem_metadatum);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_unref(&elem_metadatum);
+      cardano_metadatum_list_unref(&list);
+
+      return error;
+    }
+  }
+
+  error = cardano_metadatum_new_list(list, metadatum);
+
+  cardano_metadatum_list_unref(&list);
+
+  return error;
+}
+
+/**
+ * \brief Handles the conversion from JSON object to metadatum.
+ *
+ * \param json_obj The JSON object to be converted.
+ * \param metadatum The metadatum object to be created.
+ *
+ * \return The result of the operation.
+ */
+static cardano_error_t
+handle_json_object(cardano_json_object_t* json_obj, cardano_metadatum_t** metadatum)
+{
+  assert(json_obj != NULL);
+  assert(metadatum != NULL);
+
+  cardano_metadatum_map_t* map   = NULL;
+  cardano_error_t          error = cardano_metadatum_map_new(&map);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  const size_t object_len = cardano_json_object_get_property_count(json_obj);
+
+  for (size_t i = 0U; i < object_len; ++i)
+  {
+    size_t                 key_size = 0U;
+    const char*            key      = cardano_json_object_get_key_at(json_obj, i, &key_size);
+    cardano_json_object_t* value    = cardano_json_object_get_value_at_ex(json_obj, i);
+
+    cardano_metadatum_t* metadatum_key   = NULL;
+    cardano_metadatum_t* metadatum_value = NULL;
+
+    error = cardano_metadatum_new_string(key, key_size, &metadatum_key);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_unref(&metadatum_key);
+      cardano_metadatum_map_unref(&map);
+
+      return error;
+    }
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: Parsing the JSON object is a recursive operation. TODO: Create cardano_json_reader_t and cardano_json_writer_t to break the recursion.
+    error = convert_json_to_metadatum(value, &metadatum_value);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_unref(&metadatum_key);
+      cardano_metadatum_unref(&metadatum_value);
+      cardano_metadatum_map_unref(&map);
+
+      return error;
+    }
+
+    error = cardano_metadatum_map_insert(map, metadatum_key, metadatum_value);
+    cardano_metadatum_unref(&metadatum_key);
+    cardano_metadatum_unref(&metadatum_value);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_map_unref(&map);
+
+      return error;
+    }
+  }
+
+  error = cardano_metadatum_new_map(map, metadatum);
+  cardano_metadatum_map_unref(&map);
+
+  return error;
+}
+
+/**
+ * \brief Converts a JSON object to a metadatum.
+ *
+ * \param[in] json_obj The JSON object to be converted.
+ * \param[out] metadatum The metadatum object to be created.
+ *
+ * \@return The result of the operation.
+ */
+static cardano_error_t
+convert_json_to_metadatum(cardano_json_object_t* json_obj, cardano_metadatum_t** metadatum)
+{
+  assert(json_obj != NULL);
+  assert(metadatum != NULL);
+
+  if (cardano_json_object_get_type(json_obj) == CARDANO_JSON_OBJECT_TYPE_OBJECT)
+  {
+    // cppcheck-suppress misra-c2012-17.2; Reason: Parsing the JSON object is a recursive operation. TODO: Create cardano_json_reader_t and cardano_json_writer_t to break the recursion.
+    return handle_json_object(json_obj, metadatum);
+  }
+  else if (cardano_json_object_get_type(json_obj) == CARDANO_JSON_OBJECT_TYPE_ARRAY)
+  {
+    // cppcheck-suppress misra-c2012-17.2; Reason: Parsing the JSON object is a recursive operation. TODO: Create cardano_json_reader_t and cardano_json_writer_t to break the recursion.
+    return handle_json_array(json_obj, metadatum);
+  }
+  else if (cardano_json_object_get_type(json_obj) == CARDANO_JSON_OBJECT_TYPE_STRING)
+  {
+    size_t      size = 0;
+    const char* str  = cardano_json_object_get_string(json_obj, &size);
+
+    cardano_error_t error = cardano_metadatum_new_string(str, size - 1U, metadatum);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+  else if ((cardano_json_object_get_type(json_obj) == CARDANO_JSON_OBJECT_TYPE_NUMBER) && (!cardano_json_object_get_is_real_number(json_obj)))
+  {
+    int64_t value = 0;
+
+    cardano_error_t res = cardano_json_object_get_signed_int(json_obj, &value);
+
+    if ((value == 0) || (res != CARDANO_SUCCESS))
+    {
+      uint64_t unsigned_value = 0U;
+
+      res = cardano_json_object_get_uint(json_obj, &unsigned_value);
+
+      if (res != CARDANO_SUCCESS)
+      {
+        return res;
+      }
+
+      return cardano_metadatum_new_integer_from_uint(unsigned_value, metadatum);
+    }
+
+    return cardano_metadatum_new_integer_from_int(value, metadatum);
+  }
+  else
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Converts a metadatum to a JSON object.
+ *
+ * \param metadatum The metadatum to be converted.
+ * \param writer The JSON writer to be used.
+ *
+ * \return The JSON object representing the metadatum.
+ */
+static cardano_error_t
+convert_metadatum_to_json_object(cardano_json_writer_t* writer, cardano_metadatum_t* metadatum)
+{
+  assert(metadatum != NULL);
+  assert(writer != NULL);
+
+  switch (metadatum->kind)
+  {
+    case CARDANO_METADATUM_KIND_INTEGER:
+    {
+      const size_t size = cardano_bigint_get_string_size(metadatum->integer, 10);
+      char*        text = (char*)_cardano_malloc(size);
+
+      if (text == NULL)
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+
+      cardano_error_t error = cardano_bigint_to_string(metadatum->integer, text, size, 10);
+
+      if (error == CARDANO_SUCCESS)
+      {
+        cardano_json_writer_write_raw_value(writer, text, size - 1U);
+      }
+
+      _cardano_free(text);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      break;
+    }
+    case CARDANO_METADATUM_KIND_TEXT:
+    {
+      cardano_json_writer_write_string(writer, (const char*)cardano_buffer_get_data(metadatum->text), cardano_buffer_get_size(metadatum->text));
+      break;
+    }
+    case CARDANO_METADATUM_KIND_LIST:
+    {
+      cardano_json_writer_write_start_array(writer);
+
+      for (size_t i = 0U; i < cardano_metadatum_list_get_length(metadatum->list); i++)
+      {
+        cardano_metadatum_t* meta_elem = NULL;
+
+        cardano_error_t error = cardano_metadatum_list_get(metadatum->list, i, &meta_elem);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+
+        cardano_metadatum_unref(&meta_elem);
+
+        // cppcheck-suppress misra-c2012-17.2; Reason: Parsing the JSON object is a recursive operation. TODO: Create cardano_json_reader_t and cardano_json_writer_t to break the recursion.
+        error = convert_metadatum_to_json_object(writer, meta_elem);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+      }
+
+      cardano_json_writer_write_end_array(writer);
+
+      break;
+    }
+    case CARDANO_METADATUM_KIND_MAP:
+    {
+      cardano_json_writer_write_start_object(writer);
+      cardano_metadatum_list_t* keys   = NULL;
+      cardano_metadatum_list_t* values = NULL;
+
+      cardano_error_t error = cardano_metadatum_map_get_keys(metadatum->map, &keys);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        cardano_metadatum_list_unref(&keys);
+        return error;
+      }
+
+      error = cardano_metadatum_map_get_values(metadatum->map, &values);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        cardano_metadatum_list_unref(&keys);
+        cardano_metadatum_list_unref(&values);
+
+        return error;
+      }
+
+      for (size_t i = 0U; i < cardano_metadatum_map_get_length(metadatum->map); i++)
+      {
+        cardano_metadatum_t* key   = NULL;
+        cardano_metadatum_t* value = NULL;
+
+        error = cardano_metadatum_list_get(keys, i, &key);
+        cardano_metadatum_unref(&key);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          cardano_metadatum_list_unref(&keys);
+          cardano_metadatum_list_unref(&values);
+
+          return error;
+        }
+
+        error = cardano_metadatum_list_get(values, i, &value);
+        cardano_metadatum_unref(&value);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          cardano_metadatum_list_unref(&keys);
+          cardano_metadatum_list_unref(&values);
+
+          return error;
+        }
+
+        cardano_metadatum_kind_t key_kind;
+
+        error = cardano_metadatum_get_kind(key, &key_kind);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          cardano_metadatum_list_unref(&keys);
+          cardano_metadatum_list_unref(&values);
+
+          return error;
+        }
+
+        if (key_kind != CARDANO_METADATUM_KIND_TEXT)
+        {
+          cardano_metadatum_set_last_error(metadatum, "JSON map keys must be strings.");
+
+          cardano_metadatum_list_unref(&keys);
+          cardano_metadatum_list_unref(&values);
+
+          return CARDANO_ERROR_INVALID_METADATUM_CONVERSION;
+        }
+
+        cardano_json_writer_write_property_name(
+          writer,
+          (const char*)((const void*)cardano_buffer_get_data(key->text)),
+          cardano_buffer_get_size(key->text));
+
+        // cppcheck-suppress misra-c2012-17.2; Reason: Parsing the JSON object is a recursive operation. TODO: Create cardano_json_reader_t and cardano_json_writer_t to break the recursion.
+        cardano_error_t res = convert_metadatum_to_json_object(writer, value);
+
+        if ((value == NULL) || (res != CARDANO_SUCCESS))
+        {
+          cardano_metadatum_list_unref(&keys);
+          cardano_metadatum_list_unref(&values);
+
+          return res;
+        }
+      }
+
+      cardano_metadatum_list_unref(&keys);
+      cardano_metadatum_list_unref(&values);
+
+      cardano_json_writer_write_end_object(writer);
+
+      break;
+    }
+    case CARDANO_METADATUM_KIND_BYTES:
+    {
+      cardano_metadatum_set_last_error(metadatum, "Metadatum of type 'bytes' cannot be converted to JSON.");
+      return CARDANO_ERROR_INVALID_METADATUM_CONVERSION;
+    }
+    default:
+    {
+      cardano_metadatum_set_last_error(metadatum, "Invalid metadatum kind.");
+      return CARDANO_ERROR_INVALID_METADATUM_CONVERSION;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_metadatum_new_map(
+  cardano_metadatum_map_t* map,
+  cardano_metadatum_t**    metadatum)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_t* data = cardano_metadatum_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_metadatum_map_ref(map);
+
+  data->map  = map;
+  data->kind = CARDANO_METADATUM_KIND_MAP;
+
+  *metadatum = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_new_list(
+  cardano_metadatum_list_t* list,
+  cardano_metadatum_t**     metadatum)
+{
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_t* data = cardano_metadatum_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_metadatum_list_ref(list);
+
+  data->list = list;
+  data->kind = CARDANO_METADATUM_KIND_LIST;
+
+  *metadatum = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_new_integer(
+  const cardano_bigint_t* bigint,
+  cardano_metadatum_t**   metadatum)
+{
+  if (bigint == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_t* data = cardano_metadatum_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_bigint_clone(bigint, &data->integer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_metadatum_deallocate(data);
+    return result;
+  }
+
+  data->kind = CARDANO_METADATUM_KIND_INTEGER;
+
+  *metadatum = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_new_integer_from_int(
+  const int64_t         integer,
+  cardano_metadatum_t** metadatum)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bigint_t* bigint = NULL;
+  cardano_error_t   result = cardano_bigint_from_int(integer, &bigint);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_metadatum_new_integer(bigint, metadatum);
+
+  cardano_bigint_unref(&bigint);
+
+  return result;
+}
+
+cardano_error_t
+cardano_metadatum_new_integer_from_uint(
+  const uint64_t        integer,
+  cardano_metadatum_t** metadatum)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bigint_t* bigint = NULL;
+  cardano_error_t   result = cardano_bigint_from_unsigned_int(integer, &bigint);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_metadatum_new_integer(bigint, metadatum);
+
+  cardano_bigint_unref(&bigint);
+
+  return result;
+}
+
+cardano_error_t
+cardano_metadatum_new_integer_from_string(
+  const char*           string,
+  size_t                size,
+  int32_t               base,
+  cardano_metadatum_t** metadatum)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (string == NULL)
+  {
+    *metadatum = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bigint_t* bigint = NULL;
+  cardano_error_t   result = cardano_bigint_from_string(string, size, base, &bigint);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_metadatum_new_integer(bigint, metadatum);
+
+  cardano_bigint_unref(&bigint);
+
+  return result;
+}
+
+cardano_error_t
+cardano_metadatum_new_bytes(
+  const byte_t*         bytes,
+  size_t                size,
+  cardano_metadatum_t** metadatum)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bytes == NULL)
+  {
+    *metadatum = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_t* data = cardano_metadatum_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = cardano_buffer_new_from(bytes, size);
+
+  if (buffer == NULL)
+  {
+    cardano_metadatum_deallocate(data);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->bytes = buffer;
+  data->kind  = CARDANO_METADATUM_KIND_BYTES;
+
+  *metadatum = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_new_bytes_from_hex(
+  const char*           hex,
+  size_t                size,
+  cardano_metadatum_t** metadatum)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex == NULL)
+  {
+    *metadatum = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_t* data = cardano_metadatum_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = cardano_buffer_from_hex(hex, size);
+
+  if (buffer == NULL)
+  {
+    cardano_metadatum_deallocate(data);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->bytes = buffer;
+  data->kind  = CARDANO_METADATUM_KIND_BYTES;
+
+  *metadatum = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_new_string(
+  const char*           string,
+  size_t                size,
+  cardano_metadatum_t** metadatum)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (string == NULL)
+  {
+    *metadatum = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_t* data = cardano_metadatum_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = cardano_buffer_new_from((const byte_t*)((const void*)string), size);
+
+  if (buffer == NULL)
+  {
+    cardano_metadatum_deallocate(data);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->text = buffer;
+  data->kind = CARDANO_METADATUM_KIND_TEXT;
+
+  *metadatum = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_from_cbor(cardano_cbor_reader_t* reader, cardano_metadatum_t** metadatum)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *metadatum = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_t* data = cardano_metadatum_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_metadatum_deallocate(data);
+    return result;
+  }
+
+  switch (state)
+  {
+    case CARDANO_CBOR_READER_STATE_TAG:
+    {
+      cardano_cbor_tag_t tag = 0;
+
+      result = cardano_cbor_reader_peek_tag(reader, &tag);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_metadatum_deallocate(data);
+        return result;
+      }
+
+      switch (tag)
+      {
+        case CARDANO_CBOR_TAG_UNSIGNED_BIG_NUM:
+        case CARDANO_CBOR_TAG_NEGATIVE_BIG_NUM:
+        {
+          result = cardano_cbor_reader_read_bigint(reader, &data->integer);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            cardano_metadatum_deallocate(data);
+            return result;
+          }
+
+          data->kind = CARDANO_METADATUM_KIND_INTEGER;
+
+          break;
+        }
+
+        default:
+        {
+          cardano_metadatum_deallocate(data);
+
+          cardano_cbor_reader_set_last_error(reader, "Invalid CBOR data item type for metadatum.");
+          return CARDANO_ERROR_DECODING;
+        }
+      }
+      break;
+    }
+    case CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER:
+    {
+      uint64_t integer = 0;
+
+      result = cardano_cbor_reader_read_uint(reader, &integer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_metadatum_deallocate(data);
+        return result;
+      }
+
+      result = cardano_bigint_from_unsigned_int(integer, &data->integer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_metadatum_deallocate(data);
+        return result;
+      }
+
+      data->kind = CARDANO_METADATUM_KIND_INTEGER;
+
+      break;
+    }
+    case CARDANO_CBOR_READER_STATE_NEGATIVE_INTEGER:
+    {
+      uint64_t argument = 0;
+
+      result = cardano_cbor_reader_read_negative_int(reader, &argument);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_metadatum_deallocate(data);
+        return result;
+      }
+
+      result = cardano_bigint_from_unsigned_int(argument, &data->integer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_metadatum_deallocate(data);
+        return result;
+      }
+
+      cardano_bigint_negate(data->integer, data->integer);
+      cardano_bigint_decrement(data->integer);
+
+      data->kind = CARDANO_METADATUM_KIND_INTEGER;
+
+      break;
+    }
+    case CARDANO_CBOR_READER_STATE_START_INDEFINITE_LENGTH_BYTESTRING:
+    case CARDANO_CBOR_READER_STATE_BYTESTRING:
+    {
+      cardano_buffer_t* bytes = NULL;
+
+      result = cardano_cbor_reader_read_bytestring(reader, &bytes);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_metadatum_deallocate(data);
+        return result;
+      }
+
+      data->bytes = bytes;
+      data->kind  = CARDANO_METADATUM_KIND_BYTES;
+
+      break;
+    }
+    case CARDANO_CBOR_READER_STATE_START_INDEFINITE_LENGTH_TEXTSTRING:
+    case CARDANO_CBOR_READER_STATE_TEXTSTRING:
+    {
+      cardano_buffer_t* bytes = NULL;
+
+      result = cardano_cbor_reader_read_textstring(reader, &bytes);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_metadatum_deallocate(data);
+        return result;
+      }
+
+      data->text = bytes;
+      data->kind = CARDANO_METADATUM_KIND_TEXT;
+
+      break;
+    }
+    case CARDANO_CBOR_READER_STATE_START_ARRAY:
+    {
+      cardano_metadatum_list_t* list = NULL;
+
+      result = cardano_metadatum_list_from_cbor(reader, &list);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_metadatum_deallocate(data);
+        return result;
+      }
+
+      data->list = list;
+      data->kind = CARDANO_METADATUM_KIND_LIST;
+
+      break;
+    }
+    case CARDANO_CBOR_READER_STATE_START_MAP:
+    {
+      cardano_metadatum_map_t* map = NULL;
+
+      result = cardano_metadatum_map_from_cbor(reader, &map);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_metadatum_deallocate(data);
+        return result;
+      }
+
+      data->map  = map;
+      data->kind = CARDANO_METADATUM_KIND_MAP;
+
+      break;
+    }
+    default:
+    {
+      cardano_metadatum_deallocate(data);
+
+      cardano_cbor_reader_set_last_error(reader, "Invalid CBOR data item type for metadatum.");
+      return CARDANO_ERROR_DECODING;
+    }
+  }
+
+  *metadatum = data;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_from_json(const char* json, size_t json_size, cardano_metadatum_t** metadatum)
+{
+  if ((json == NULL) || (metadatum == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (json_size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  *metadatum = NULL;
+
+  cardano_json_object_t* parsed_json = NULL;
+  cardano_error_t        error       = cardano_json_object_parse_ex(json, json_size, &parsed_json);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = convert_json_to_metadatum(parsed_json, metadatum);
+
+  cardano_json_object_unref(&parsed_json);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_metadatum_unref(metadatum);
+
+    return error;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_to_json(
+  cardano_metadatum_t* metadatum,
+  char*                json,
+  size_t               json_size)
+{
+  if ((metadatum == NULL) || (json == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_t* writer = cardano_json_writer_new(CARDANO_JSON_FORMAT_PRETTY);
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = convert_metadatum_to_json_object(writer, metadatum);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_json_writer_unref(&writer);
+    return result;
+  }
+
+  size_t required_size = cardano_json_writer_get_encoded_size(writer);
+
+  if (json_size < required_size)
+  {
+    cardano_json_writer_unref(&writer);
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  result = cardano_json_writer_encode(writer, json, json_size);
+
+  cardano_json_writer_unref(&writer);
+
+  return result;
+}
+
+size_t
+cardano_metadatum_get_json_size(cardano_metadatum_t* metadatum)
+{
+  if (metadatum == NULL)
+  {
+    return 0U;
+  }
+
+  cardano_json_writer_t* writer = cardano_json_writer_new(CARDANO_JSON_FORMAT_PRETTY);
+
+  if (writer == NULL)
+  {
+    return 0U;
+  }
+
+  cardano_error_t result = convert_metadatum_to_json_object(writer, metadatum);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_json_writer_unref(&writer);
+
+    return 0U;
+  }
+
+  const size_t size = cardano_json_writer_get_encoded_size(writer);
+
+  cardano_json_writer_unref(&writer);
+
+  return size;
+}
+
+cardano_error_t
+cardano_metadatum_to_cbor(const cardano_metadatum_t* metadatum, cardano_cbor_writer_t* writer)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (metadatum->kind)
+  {
+    case CARDANO_METADATUM_KIND_MAP:
+    {
+      result = cardano_metadatum_map_to_cbor(metadatum->map, writer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    case CARDANO_METADATUM_KIND_LIST:
+    {
+      result = cardano_metadatum_list_to_cbor(metadatum->list, writer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    case CARDANO_METADATUM_KIND_INTEGER:
+    {
+      const bool   is_negative = cardano_bigint_signum(metadatum->integer) < 0;
+      const size_t bit_length  = cardano_bigint_bit_length(metadatum->integer);
+
+      if (bit_length <= 64U)
+      {
+        const uint64_t absolute = cardano_bigint_to_unsigned_int(metadatum->integer);
+
+        if (is_negative)
+        {
+          result = cardano_cbor_writer_write_negative_int(writer, absolute - 1U);
+        }
+        else
+        {
+          result = cardano_cbor_writer_write_uint(writer, absolute);
+        }
+      }
+      else if (is_negative)
+      {
+        cardano_bigint_t* magnitude = NULL;
+
+        result = cardano_bigint_clone(metadatum->integer, &magnitude);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        cardano_bigint_negate(metadatum->integer, magnitude);
+        cardano_bigint_decrement(magnitude);
+
+        if (cardano_bigint_bit_length(magnitude) <= 64U)
+        {
+          result = cardano_cbor_writer_write_negative_int(writer, cardano_bigint_to_unsigned_int(magnitude));
+        }
+        else
+        {
+          result = cardano_cbor_writer_write_bigint(writer, metadatum->integer);
+        }
+
+        cardano_bigint_unref(&magnitude);
+      }
+      else
+      {
+        result = cardano_cbor_writer_write_bigint(writer, metadatum->integer);
+      }
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    case CARDANO_METADATUM_KIND_BYTES:
+    {
+      static const uint64_t max_byte_string_chunk_size = 64;
+
+      const size_t size = cardano_buffer_get_size(metadatum->bytes);
+
+      if (size > max_byte_string_chunk_size)
+      {
+        return CARDANO_ERROR_INVALID_METADATUM_BOUNDED_BYTES_SIZE;
+      }
+
+      result = cardano_cbor_writer_write_bytestring(writer, cardano_buffer_get_data(metadatum->bytes), size);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    case CARDANO_METADATUM_KIND_TEXT:
+    {
+      static const uint64_t max_text_string_chunk_size = 64;
+
+      const size_t size = cardano_buffer_get_size(metadatum->text);
+
+      if (size > max_text_string_chunk_size)
+      {
+        return CARDANO_ERROR_INVALID_METADATUM_TEXT_STRING_SIZE;
+      }
+
+      result = cardano_cbor_writer_write_textstring(writer, (const char*)((const void*)cardano_buffer_get_data(metadatum->text)), size);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+
+    default:
+    {
+      cardano_cbor_writer_set_last_error(writer, "Invalid metadatum kind");
+      return CARDANO_ERROR_ENCODING;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_to_cip116_json(
+  const cardano_metadatum_t* metadatum,
+  cardano_json_writer_t*     writer)
+{
+  if ((metadatum == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  switch (metadatum->kind)
+  {
+    case CARDANO_METADATUM_KIND_MAP:
+      return cardano_metadatum_map_to_cip116_json(metadatum->map, writer);
+    case CARDANO_METADATUM_KIND_LIST:
+      return cardano_metadatum_list_to_cip116_json(metadatum->list, writer);
+    case CARDANO_METADATUM_KIND_INTEGER:
+    {
+      cardano_json_writer_write_start_object(writer);
+
+      cardano_json_writer_write_property_name(writer, "tag", 3);
+      cardano_json_writer_write_string(writer, "int", 3);
+
+      cardano_json_writer_write_property_name(writer, "value", 5);
+      cardano_json_writer_write_bigint(writer, metadatum->integer);
+
+      cardano_json_writer_write_end_object(writer);
+      return CARDANO_SUCCESS;
+    }
+
+    case CARDANO_METADATUM_KIND_BYTES:
+    {
+      const size_t hex_size = cardano_buffer_get_hex_size(metadatum->bytes);
+      if (hex_size == 0U)
+      {
+        cardano_json_writer_write_start_object(writer);
+        cardano_json_writer_write_property_name(writer, "tag", 3);
+        cardano_json_writer_write_string(writer, "bytes", 5);
+        cardano_json_writer_write_property_name(writer, "value", 5);
+        cardano_json_writer_write_string(writer, "", 0);
+        cardano_json_writer_write_end_object(writer);
+
+        return CARDANO_SUCCESS;
+      }
+
+      char* hex = (char*)_cardano_malloc(hex_size);
+
+      if (hex == NULL)
+      {
+        cardano_json_writer_set_last_error(writer, "Out of memory while serializing metadatum bytes to hex.");
+        return CARDANO_ERROR_ENCODING;
+      }
+
+      const cardano_error_t to_hex = cardano_buffer_to_hex(metadatum->bytes, hex, hex_size);
+      if (to_hex != CARDANO_SUCCESS)
+      {
+        _cardano_free(hex);
+        cardano_json_writer_set_last_error(writer, "Failed to convert metadatum bytes to hex.");
+        return CARDANO_ERROR_ENCODING;
+      }
+
+      cardano_json_writer_write_start_object(writer);
+
+      cardano_json_writer_write_property_name(writer, "tag", 3);
+      cardano_json_writer_write_string(writer, "bytes", 5);
+
+      cardano_json_writer_write_property_name(writer, "value", 5);
+      cardano_json_writer_write_string(writer, hex, hex_size - 1U);
+
+      cardano_json_writer_write_end_object(writer);
+
+      _cardano_free(hex);
+      return CARDANO_SUCCESS;
+    }
+
+    case CARDANO_METADATUM_KIND_TEXT:
+    {
+      const size_t  size = cardano_buffer_get_size(metadatum->text);
+      const byte_t* data = cardano_buffer_get_data(metadatum->text);
+
+      cardano_json_writer_write_start_object(writer);
+
+      cardano_json_writer_write_property_name(writer, "tag", 3);
+      cardano_json_writer_write_string(writer, "string", 6);
+
+      cardano_json_writer_write_property_name(writer, "value", 5);
+      cardano_json_writer_write_string(writer, (const char*)(const void*)data, size);
+
+      cardano_json_writer_write_end_object(writer);
+      return CARDANO_SUCCESS;
+    }
+
+    default:
+      cardano_json_writer_set_last_error(writer, "Invalid metadatum kind.");
+      return CARDANO_ERROR_ENCODING;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_get_kind(
+  const cardano_metadatum_t* metadatum,
+  cardano_metadatum_kind_t*  kind)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (kind == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *kind = metadatum->kind;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_to_map(
+  cardano_metadatum_t*      metadatum,
+  cardano_metadatum_map_t** map)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum->kind != CARDANO_METADATUM_KIND_MAP)
+  {
+    return CARDANO_ERROR_INVALID_METADATUM_CONVERSION;
+  }
+
+  cardano_metadatum_map_ref(metadatum->map);
+  *map = metadatum->map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_to_list(
+  cardano_metadatum_t*       metadatum,
+  cardano_metadatum_list_t** list)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum->kind != CARDANO_METADATUM_KIND_LIST)
+  {
+    return CARDANO_ERROR_INVALID_METADATUM_CONVERSION;
+  }
+
+  cardano_metadatum_list_ref(metadatum->list);
+  *list = metadatum->list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_to_integer(
+  const cardano_metadatum_t* metadatum,
+  cardano_bigint_t**         integer)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (integer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum->kind != CARDANO_METADATUM_KIND_INTEGER)
+  {
+    return CARDANO_ERROR_INVALID_METADATUM_CONVERSION;
+  }
+
+  cardano_error_t error = cardano_bigint_clone(metadatum->integer, integer);
+
+  return error;
+}
+
+cardano_error_t
+cardano_metadatum_to_bounded_bytes(
+  cardano_metadatum_t* metadatum,
+  cardano_buffer_t**   bounded_bytes)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bounded_bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum->kind != CARDANO_METADATUM_KIND_BYTES)
+  {
+    return CARDANO_ERROR_INVALID_METADATUM_CONVERSION;
+  }
+
+  cardano_buffer_ref(metadatum->bytes);
+  *bounded_bytes = metadatum->bytes;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_metadatum_get_string_size(cardano_metadatum_t* metadatum)
+{
+  if (metadatum == NULL)
+  {
+    return 0;
+  }
+
+  if (metadatum->kind != CARDANO_METADATUM_KIND_TEXT)
+  {
+    return 0;
+  }
+
+  return cardano_buffer_get_size(metadatum->text) + 1U;
+}
+
+cardano_error_t
+cardano_metadatum_to_string(
+  cardano_metadatum_t* metadatum,
+  char*                buffer,
+  size_t               buffer_size)
+{
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum->kind != CARDANO_METADATUM_KIND_TEXT)
+  {
+    return CARDANO_ERROR_INVALID_METADATUM_CONVERSION;
+  }
+
+  size_t size = cardano_buffer_get_size(metadatum->text);
+
+  if ((size + 1U) > buffer_size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  cardano_safe_memcpy(buffer, size, cardano_buffer_get_data(metadatum->text), cardano_buffer_get_size(metadatum->text));
+
+  buffer[size] = '\0';
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_metadatum_equals(const cardano_metadatum_t* lhs, const cardano_metadatum_t* rhs)
+{
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs->kind != rhs->kind)
+  {
+    return false;
+  }
+
+  switch (lhs->kind)
+  {
+    case CARDANO_METADATUM_KIND_MAP:
+    {
+      return cardano_metadatum_map_equals(lhs->map, rhs->map);
+    }
+    case CARDANO_METADATUM_KIND_LIST:
+    {
+      return cardano_metadatum_list_equals(lhs->list, rhs->list);
+    }
+    case CARDANO_METADATUM_KIND_INTEGER:
+    {
+      return cardano_bigint_equals(lhs->integer, rhs->integer);
+    }
+    case CARDANO_METADATUM_KIND_BYTES:
+    {
+      return cardano_buffer_equals(lhs->bytes, rhs->bytes);
+    }
+    case CARDANO_METADATUM_KIND_TEXT:
+    {
+      return cardano_buffer_equals(lhs->text, rhs->text);
+    }
+
+    default:
+    {
+      return false;
+    }
+  }
+}
+
+void
+cardano_metadatum_unref(cardano_metadatum_t** metadatum)
+{
+  if ((metadatum == NULL) || (*metadatum == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*metadatum)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *metadatum = NULL;
+    return;
+  }
+}
+
+void
+cardano_metadatum_ref(cardano_metadatum_t* metadatum)
+{
+  if (metadatum == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&metadatum->base);
+}
+
+size_t
+cardano_metadatum_refcount(const cardano_metadatum_t* metadatum)
+{
+  if (metadatum == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&metadatum->base);
+}
+
+void
+cardano_metadatum_set_last_error(cardano_metadatum_t* metadatum, const char* message)
+{
+  cardano_object_set_last_error(&metadatum->base, message);
+}
+
+const char*
+cardano_metadatum_get_last_error(const cardano_metadatum_t* metadatum)
+{
+  return cardano_object_get_last_error(&metadatum->base);
+}
+
+cardano_error_t
+cardano_metadatum_deep_clone(const cardano_metadatum_t* source, cardano_metadatum_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_t* copy = _cardano_malloc(sizeof(cardano_metadatum_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->map                = NULL;
+  copy->list               = NULL;
+  copy->integer            = NULL;
+  copy->bytes              = NULL;
+  copy->text               = NULL;
+  copy->kind               = source->kind;
+
+  if (source->map != NULL)
+  {
+    const cardano_error_t result = cardano_metadatum_map_deep_clone(source->map, &copy->map);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->list != NULL)
+  {
+    const cardano_error_t result = cardano_metadatum_list_deep_clone(source->list, &copy->list);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->integer != NULL)
+  {
+    const cardano_error_t result = cardano_bigint_deep_clone(source->integer, &copy->integer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->bytes != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->bytes, &copy->bytes);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->text != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->text, &copy->text);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/auxiliary_data/metadatum_label_list.c b/vendor/src/auxiliary_data/metadatum_label_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/auxiliary_data/metadatum_label_list.c
@@ -0,0 +1,359 @@
+/**
+ * \file metadatum_label_list.c
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/metadatum_label_list.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano metadatum_label list.
+ */
+typedef struct cardano_metadatum_label_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_metadatum_label_list_t;
+
+/**
+ * \brief Represents a Cardano metadatum_label.
+ */
+typedef struct cardano_metadatum_label_t
+{
+    cardano_object_t base;
+    uint64_t         value;
+} cardano_metadatum_label_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a metadatum_label list object.
+ *
+ * This function is responsible for properly deallocating a metadatum_label list object (`cardano_metadatum_label_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the metadatum_label_list object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_metadatum_label_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the metadatum_label_list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_metadatum_label_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_metadatum_label_list_t* list = (cardano_metadatum_label_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their metadatum_label.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the address of lhs is less than the address of rhs, zero if they are equal,
+ *         and a positive value if the address of lhs is greater than the address of rhs.
+ */
+static int32_t
+compare_by_value(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_metadatum_label_t* lhs_label = (const cardano_metadatum_label_t*)((const void*)lhs);
+  const cardano_metadatum_label_t* rhs_label = (const cardano_metadatum_label_t*)((const void*)rhs);
+
+  return (lhs_label->value < rhs_label->value) ? -1 : 1;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_metadatum_label_list_new(cardano_metadatum_label_list_t** metadatum_label_list)
+{
+  if (metadatum_label_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_label_list_t* list = _cardano_malloc(sizeof(cardano_metadatum_label_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_metadatum_label_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *metadatum_label_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_metadatum_label_list_get_length(const cardano_metadatum_label_list_t* metadatum_label_list)
+{
+  if (metadatum_label_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(metadatum_label_list->array);
+}
+
+cardano_error_t
+cardano_metadatum_label_list_get(
+  const cardano_metadatum_label_list_t* metadatum_label_list,
+  size_t                                index,
+  uint64_t*                             element)
+{
+  if (metadatum_label_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(metadatum_label_list->array, index);
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_metadatum_label_t* elem = (cardano_metadatum_label_t*)((void*)object);
+
+  *element = elem->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_label_list_add(cardano_metadatum_label_list_t* metadatum_label_list, const uint64_t element)
+{
+  if (metadatum_label_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_label_t* metadatum_label = _cardano_malloc(sizeof(cardano_metadatum_label_t));
+
+  if (metadatum_label == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  metadatum_label->base.ref_count     = 0;
+  metadatum_label->base.last_error[0] = '\0';
+  metadatum_label->base.deallocator   = _cardano_free;
+  metadatum_label->value              = element;
+
+  const size_t original_size = cardano_array_get_size(metadatum_label_list->array);
+  const size_t new_size      = cardano_array_push(metadatum_label_list->array, (cardano_object_t*)((void*)metadatum_label));
+
+  if (new_size != (original_size + 1U))
+  {
+    _cardano_free(metadatum_label);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(metadatum_label_list->array, compare_by_value, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_metadatum_label_list_unref(cardano_metadatum_label_list_t** metadatum_label_list)
+{
+  if ((metadatum_label_list == NULL) || (*metadatum_label_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*metadatum_label_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *metadatum_label_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_metadatum_label_list_ref(cardano_metadatum_label_list_t* metadatum_label_list)
+{
+  if (metadatum_label_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&metadatum_label_list->base);
+}
+
+size_t
+cardano_metadatum_label_list_refcount(const cardano_metadatum_label_list_t* metadatum_label_list)
+{
+  if (metadatum_label_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&metadatum_label_list->base);
+}
+
+void
+cardano_metadatum_label_list_set_last_error(cardano_metadatum_label_list_t* metadatum_label_list, const char* message)
+{
+  cardano_object_set_last_error(&metadatum_label_list->base, message);
+}
+
+const char*
+cardano_metadatum_label_list_get_last_error(const cardano_metadatum_label_list_t* metadatum_label_list)
+{
+  return cardano_object_get_last_error(&metadatum_label_list->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_metadatum_label_deep_clone(const cardano_metadatum_label_t* source, cardano_metadatum_label_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_label_t* copy = _cardano_malloc(sizeof(cardano_metadatum_label_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->value              = source->value;
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_metadatum_label_t* copy   = NULL;
+  const cardano_error_t      result = cardano_metadatum_label_deep_clone((const cardano_metadatum_label_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_metadatum_label_list_deep_clone(const cardano_metadatum_label_list_t* source, cardano_metadatum_label_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_label_list_t* copy = _cardano_malloc(sizeof(cardano_metadatum_label_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/auxiliary_data/metadatum_list.c b/vendor/src/auxiliary_data/metadatum_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/auxiliary_data/metadatum_list.c
@@ -0,0 +1,515 @@
+/**
+ * \file metadatum_list.c
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/metadatum_list.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <cardano/auxiliary_data/metadatum.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano metadatum list.
+ */
+typedef struct cardano_metadatum_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             use_indefinite_encoding;
+} cardano_metadatum_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a metadatum list object.
+ *
+ * This function is responsible for properly deallocating a metadatum list object (`cardano_metadatum_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the metadatum_list object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_metadatum_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the metadatum_list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_metadatum_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_metadatum_list_t* list = (cardano_metadatum_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_metadatum_list_new(cardano_metadatum_list_t** metadatum_list)
+{
+  if (metadatum_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_list_t* list = _cardano_malloc(sizeof(cardano_metadatum_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count          = 1;
+  list->base.last_error[0]      = '\0';
+  list->base.deallocator        = cardano_metadatum_list_deallocate;
+  list->use_indefinite_encoding = false;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *metadatum_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_list_from_cbor(cardano_cbor_reader_t* reader, cardano_metadatum_list_t** metadatum_list)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_list_t* list   = NULL;
+  cardano_error_t           result = cardano_metadatum_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_metadatum_list_unref(&list);
+    return result;
+  }
+
+  list->use_indefinite_encoding = length < 0;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_list_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_metadatum_t* element = NULL;
+
+    result = cardano_metadatum_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_list_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_metadatum_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_metadatum_list_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("metadatum_list", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_metadatum_list_unref(&list);
+    return result;
+  }
+
+  *metadatum_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_list_to_cbor(const cardano_metadatum_list_t* metadatum_list, cardano_cbor_writer_t* writer)
+{
+  if (metadatum_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(metadatum_list->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (metadatum_list->use_indefinite_encoding)
+  {
+    result = cardano_cbor_writer_write_start_array(writer, -1);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    };
+  }
+  else
+  {
+    size_t array_size = cardano_array_get_size(metadatum_list->array);
+    result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(metadatum_list->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(metadatum_list->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in metadatum list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_metadatum_to_cbor((cardano_metadatum_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (metadatum_list->use_indefinite_encoding)
+  {
+    result = cardano_cbor_writer_write_end_array(writer);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_metadatum_list_to_cip116_json(
+  const cardano_metadatum_list_t* list,
+  cardano_json_writer_t*          writer)
+{
+  if ((list == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "list", 4);
+
+  cardano_json_writer_write_property_name(writer, "contents", 8);
+  cardano_json_writer_write_start_array(writer);
+
+  const size_t count = cardano_metadatum_list_get_length(list);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    cardano_metadatum_t* item = NULL;
+
+    cardano_error_t error = cardano_metadatum_list_get(list, i, &item);
+
+    if ((error != CARDANO_SUCCESS) || (item == NULL))
+    {
+      cardano_json_writer_set_last_error(writer, "Failed to retrieve metadatum from list.");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    error = cardano_metadatum_to_cip116_json(item, writer);
+
+    cardano_metadatum_unref(&item);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_metadatum_list_get_length(const cardano_metadatum_list_t* metadatum_list)
+{
+  if (metadatum_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(metadatum_list->array);
+}
+
+cardano_error_t
+cardano_metadatum_list_get(
+  const cardano_metadatum_list_t* metadatum_list,
+  size_t                          index,
+  cardano_metadatum_t**           element)
+{
+  if (metadatum_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(metadatum_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_metadatum_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_list_add(cardano_metadatum_list_t* metadatum_list, cardano_metadatum_t* element)
+{
+  if (metadatum_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(metadatum_list->array);
+  const size_t new_size      = cardano_array_push(metadatum_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_metadatum_list_equals(const cardano_metadatum_list_t* lhs, const cardano_metadatum_list_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  if (cardano_array_get_size(lhs->array) != cardano_array_get_size(rhs->array))
+  {
+    return false;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_metadatum_t* lhs_element = (cardano_metadatum_t*)((void*)cardano_array_get(lhs->array, i));
+    cardano_metadatum_t* rhs_element = (cardano_metadatum_t*)((void*)cardano_array_get(rhs->array, i));
+
+    cardano_metadatum_unref(&lhs_element);
+    cardano_metadatum_unref(&rhs_element);
+
+    if (!cardano_metadatum_equals(lhs_element, rhs_element))
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+void
+cardano_metadatum_list_unref(cardano_metadatum_list_t** metadatum_list)
+{
+  if ((metadatum_list == NULL) || (*metadatum_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*metadatum_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *metadatum_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_metadatum_list_ref(cardano_metadatum_list_t* metadatum_list)
+{
+  if (metadatum_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&metadatum_list->base);
+}
+
+size_t
+cardano_metadatum_list_refcount(const cardano_metadatum_list_t* metadatum_list)
+{
+  if (metadatum_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&metadatum_list->base);
+}
+
+void
+cardano_metadatum_list_set_last_error(cardano_metadatum_list_t* metadatum_list, const char* message)
+{
+  cardano_object_set_last_error(&metadatum_list->base, message);
+}
+
+const char*
+cardano_metadatum_list_get_last_error(const cardano_metadatum_list_t* metadatum_list)
+{
+  return cardano_object_get_last_error(&metadatum_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_metadatum_t*  copy   = NULL;
+  const cardano_error_t result = cardano_metadatum_deep_clone((const cardano_metadatum_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_metadatum_list_deep_clone(const cardano_metadatum_list_t* source, cardano_metadatum_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_list_t* copy = _cardano_malloc(sizeof(cardano_metadatum_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count          = 1U;
+  copy->base.deallocator        = source->base.deallocator;
+  copy->base.last_error[0]      = '\0';
+  copy->array                   = NULL;
+  copy->use_indefinite_encoding = source->use_indefinite_encoding;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/auxiliary_data/metadatum_map.c b/vendor/src/auxiliary_data/metadatum_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/auxiliary_data/metadatum_map.c
@@ -0,0 +1,851 @@
+/**
+ * \file metadatum_map.c
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/metadatum.h>
+#include <cardano/auxiliary_data/metadatum_list.h>
+#include <cardano/auxiliary_data/metadatum_map.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/set.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano metadatum map.
+ */
+typedef struct cardano_metadatum_map_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             use_indefinite_encoding;
+} cardano_metadatum_map_t;
+
+/**
+ * \brief Represents a Cardano metadatum map key value pair.
+ */
+typedef struct cardano_metadatum_map_kvp_t
+{
+    cardano_object_t     base;
+    cardano_metadatum_t* key;
+    cardano_metadatum_t* value;
+} cardano_metadatum_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a metadatum map object.
+ *
+ * This function is responsible for properly deallocating a metadatum map object (`cardano_metadatum_map_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the metadatum_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_metadatum_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the metadatum_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_metadatum_map_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_metadatum_map_t* map = (cardano_metadatum_map_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a metadatum map key value pair object.
+ *
+ * This function is responsible for properly deallocating a metadatum map key value pair object (`cardano_metadatum_map_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the metadatum_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_metadatum_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the metadatum_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_metadatum_map_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_metadatum_map_kvp_t* map = (cardano_metadatum_map_kvp_t*)object;
+
+  if (map->key != NULL)
+  {
+    cardano_metadatum_unref(&map->key);
+  }
+
+  if (map->value != NULL)
+  {
+    cardano_metadatum_unref(&map->value);
+  }
+
+  _cardano_free(map);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_metadatum_map_new(cardano_metadatum_map_t** metadatum_map)
+{
+  if (metadatum_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_map_t* map = _cardano_malloc(sizeof(cardano_metadatum_map_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count          = 1;
+  map->base.last_error[0]      = '\0';
+  map->base.deallocator        = cardano_metadatum_map_deallocate;
+  map->use_indefinite_encoding = false;
+
+  map->array = cardano_array_new(128);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *metadatum_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_map_from_cbor(cardano_cbor_reader_t* reader, cardano_metadatum_map_t** metadatum_map)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_map_t* map    = NULL;
+  cardano_error_t          result = cardano_metadatum_map_new(&map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_map(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_metadatum_map_unref(&map);
+    return result;
+  }
+
+  map->use_indefinite_encoding = length < 0;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_map_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_metadatum_t* key   = NULL;
+    cardano_metadatum_t* value = NULL;
+
+    result = cardano_metadatum_from_cbor(reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_map_unref(&map);
+      return result;
+    }
+
+    result = cardano_metadatum_from_cbor(reader, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_unref(&key);
+      cardano_metadatum_map_unref(&map);
+      return result;
+    }
+
+    cardano_metadatum_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_metadatum_map_kvp_t));
+
+    if (kvp == NULL)
+    {
+      cardano_metadatum_unref(&key);
+      cardano_metadatum_unref(&value);
+      cardano_metadatum_map_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    kvp->base.ref_count     = 0;
+    kvp->base.last_error[0] = '\0';
+    kvp->base.deallocator   = cardano_metadatum_map_kvp_deallocate;
+    kvp->key                = key;
+    kvp->value              = value;
+
+    const size_t old_size = cardano_array_get_size(map->array);
+    const size_t new_size = cardano_array_push(map->array, (cardano_object_t*)((void*)kvp));
+
+    if (new_size != (old_size + 1U))
+    {
+      cardano_metadatum_map_kvp_deallocate(kvp);
+      cardano_metadatum_map_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_map("metadatum_map", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_metadatum_map_unref(&map);
+    return result;
+  }
+
+  *metadatum_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_map_to_cbor(const cardano_metadatum_map_t* metadatum_map, cardano_cbor_writer_t* writer)
+{
+  if (metadatum_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (metadatum_map->use_indefinite_encoding)
+  {
+    result = cardano_cbor_writer_write_start_map(writer, -1);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    };
+  }
+  else
+  {
+    size_t map_size = cardano_array_get_size(metadatum_map->array);
+    result          = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(metadatum_map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(metadatum_map->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in metadatum map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_metadatum_map_kvp_t* kvp_data = (cardano_metadatum_map_kvp_t*)((void*)kvp);
+
+    result = cardano_metadatum_to_cbor(kvp_data->key, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    result = cardano_metadatum_to_cbor(kvp_data->value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    cardano_object_unref(&kvp);
+  }
+
+  if (metadatum_map->use_indefinite_encoding)
+  {
+    result = cardano_cbor_writer_write_end_map(writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_map_to_cip116_json(
+  const cardano_metadatum_map_t* map,
+  cardano_json_writer_t*         writer)
+{
+  if ((map == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "map", 3);
+
+  cardano_json_writer_write_property_name(writer, "contents", 8);
+  cardano_json_writer_write_start_array(writer);
+
+  const size_t n = cardano_array_get_size(map->array);
+
+  for (size_t i = 0; i < n; ++i)
+  {
+    cardano_object_t* obj = cardano_array_get(map->array, i);
+
+    if (obj == NULL)
+    {
+      return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+    }
+
+    cardano_metadatum_map_kvp_t* kvp = (cardano_metadatum_map_kvp_t*)((void*)obj);
+
+    cardano_json_writer_write_start_object(writer);
+
+    cardano_json_writer_write_property_name(writer, "key", 3);
+    cardano_error_t error = cardano_metadatum_to_cip116_json(kvp->key, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&obj);
+      return error;
+    }
+
+    cardano_json_writer_write_property_name(writer, "value", 5);
+    error = cardano_metadatum_to_cip116_json(kvp->value, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&obj);
+      return error;
+    }
+
+    cardano_json_writer_write_end_object(writer);
+    cardano_object_unref(&obj);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_metadatum_map_get_length(const cardano_metadatum_map_t* metadatum_map)
+{
+  if (metadatum_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(metadatum_map->array);
+}
+
+cardano_error_t
+cardano_metadatum_map_get(
+  cardano_metadatum_map_t* metadatum_map,
+  cardano_metadatum_t*     key,
+  cardano_metadatum_t**    element)
+{
+  if (metadatum_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(metadatum_map->array); ++i)
+  {
+    cardano_object_t*            object = cardano_array_get(metadatum_map->array, i);
+    cardano_metadatum_map_kvp_t* kvp    = (cardano_metadatum_map_kvp_t*)((void*)object);
+
+    if (cardano_metadatum_equals(kvp->key, key))
+    {
+      cardano_metadatum_ref(kvp->value);
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_metadatum_map_get_at(
+  cardano_metadatum_map_t* metadatum_map,
+  size_t                   index,
+  cardano_metadatum_t**    key,
+  cardano_metadatum_t**    element)
+{
+  if ((metadatum_map == NULL) || (key == NULL) || (element == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *key     = NULL;
+  *element = NULL;
+
+  const size_t size = cardano_array_get_size(metadatum_map->array);
+
+  if (index >= size)
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t* object = cardano_array_get(metadatum_map->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_metadatum_map_kvp_t* kvp = (cardano_metadatum_map_kvp_t*)((void*)object);
+
+  cardano_metadatum_ref(kvp->key);
+  cardano_metadatum_ref(kvp->value);
+
+  *key     = kvp->key;
+  *element = kvp->value;
+
+  cardano_object_unref(&object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_map_insert(
+  cardano_metadatum_map_t* metadatum_map,
+  cardano_metadatum_t*     key,
+  cardano_metadatum_t*     value)
+{
+  if (metadatum_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_metadatum_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_metadatum_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_metadatum_ref(key);
+  cardano_metadatum_ref(value);
+
+  const size_t old_size = cardano_array_get_size(metadatum_map->array);
+  const size_t new_size = cardano_array_push(metadatum_map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_metadatum_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_map_get_keys(
+  cardano_metadatum_map_t*   metadatum_map,
+  cardano_metadatum_list_t** keys)
+{
+  if (metadatum_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_list_t* list = NULL;
+
+  cardano_error_t result = cardano_metadatum_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(metadatum_map->array); ++i)
+  {
+    cardano_object_t*            object = cardano_array_get(metadatum_map->array, i);
+    cardano_metadatum_map_kvp_t* kvp    = (cardano_metadatum_map_kvp_t*)((void*)object);
+
+    result = cardano_metadatum_list_add(list, kvp->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_metadatum_map_get_values(
+  cardano_metadatum_map_t*   metadatum_map,
+  cardano_metadatum_list_t** values)
+{
+  if (metadatum_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (values == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_list_t* list = NULL;
+
+  cardano_error_t result = cardano_metadatum_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(metadatum_map->array); ++i)
+  {
+    cardano_object_t*            object = cardano_array_get(metadatum_map->array, i);
+    cardano_metadatum_map_kvp_t* kvp    = (cardano_metadatum_map_kvp_t*)((void*)object);
+
+    result = cardano_metadatum_list_add(list, kvp->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *values = list;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_metadatum_map_equals(const cardano_metadatum_map_t* lhs, const cardano_metadatum_map_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  if (cardano_array_get_size(lhs->array) != cardano_array_get_size(rhs->array))
+  {
+    return false;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_object_t* lhs_element = cardano_array_get(lhs->array, i);
+    cardano_object_t* rhs_element = cardano_array_get(rhs->array, i);
+
+    cardano_object_unref(&lhs_element);
+    cardano_object_unref(&rhs_element);
+
+    cardano_metadatum_map_kvp_t* lhs_element_data = (cardano_metadatum_map_kvp_t*)((void*)lhs_element);
+    cardano_metadatum_map_kvp_t* rhs_element_data = (cardano_metadatum_map_kvp_t*)((void*)rhs_element);
+
+    if (!cardano_metadatum_equals(lhs_element_data->key, rhs_element_data->key))
+    {
+      return false;
+    }
+
+    if (!cardano_metadatum_equals(lhs_element_data->value, rhs_element_data->value))
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+void
+cardano_metadatum_map_unref(cardano_metadatum_map_t** metadatum_map)
+{
+  if ((metadatum_map == NULL) || (*metadatum_map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*metadatum_map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *metadatum_map = NULL;
+    return;
+  }
+}
+
+void
+cardano_metadatum_map_ref(cardano_metadatum_map_t* metadatum_map)
+{
+  if (metadatum_map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&metadatum_map->base);
+}
+
+size_t
+cardano_metadatum_map_refcount(const cardano_metadatum_map_t* metadatum_map)
+{
+  if (metadatum_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&metadatum_map->base);
+}
+
+void
+cardano_metadatum_map_set_last_error(cardano_metadatum_map_t* metadatum_map, const char* message)
+{
+  cardano_object_set_last_error(&metadatum_map->base, message);
+}
+
+const char*
+cardano_metadatum_map_get_last_error(const cardano_metadatum_map_t* metadatum_map)
+{
+  return cardano_object_get_last_error(&metadatum_map->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_metadatum_map_kvp_deep_clone(const cardano_metadatum_map_kvp_t* source, cardano_metadatum_map_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_map_kvp_t* copy = _cardano_malloc(sizeof(cardano_metadatum_map_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = NULL;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_metadatum_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_metadatum_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_metadatum_map_kvp_t* copy   = NULL;
+  const cardano_error_t        result = cardano_metadatum_map_kvp_deep_clone((const cardano_metadatum_map_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_metadatum_map_deep_clone(const cardano_metadatum_map_t* source, cardano_metadatum_map_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_map_t* copy = _cardano_malloc(sizeof(cardano_metadatum_map_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count          = 1U;
+  copy->base.deallocator        = source->base.deallocator;
+  copy->base.last_error[0]      = '\0';
+  copy->array                   = NULL;
+  copy->use_indefinite_encoding = source->use_indefinite_encoding;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/auxiliary_data/plutus_v1_script_list.c b/vendor/src/auxiliary_data/plutus_v1_script_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/auxiliary_data/plutus_v1_script_list.c
@@ -0,0 +1,449 @@
+/**
+ * \file plutus_v1_script_list.c
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/plutus_v1_script_list.h>
+#include <cardano/object.h>
+#include <cardano/scripts/plutus_scripts/plutus_v1_script.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus script list.
+ */
+typedef struct cardano_plutus_v1_script_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_plutus_v1_script_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus script list object.
+ *
+ * This function is responsible for properly deallocating a plutus script list object (`cardano_plutus_v1_script_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the proposal procedure_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v1_script_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus script list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v1_script_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v1_script_list_t* list = (cardano_plutus_v1_script_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v1_script_list_new(cardano_plutus_v1_script_list_t** plutus_v1_script_list)
+{
+  if (plutus_v1_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v1_script_list_t* list = _cardano_malloc(sizeof(cardano_plutus_v1_script_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_plutus_v1_script_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *plutus_v1_script_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_list_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v1_script_list_t** plutus_v1_script_list)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v1_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v1_script_list_t* list   = NULL;
+  cardano_error_t                  result = cardano_plutus_v1_script_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  CARDANO_UNUSED(length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v1_script_list_unref(&list);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v1_script_list_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_plutus_v1_script_t* element = NULL;
+
+    result = cardano_plutus_v1_script_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v1_script_list_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_plutus_v1_script_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_plutus_v1_script_list_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("plutus_v1_script_list", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v1_script_list_unref(&list);
+    return result;
+  }
+
+  *plutus_v1_script_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_list_to_cbor(const cardano_plutus_v1_script_list_t* plutus_v1_script_list, cardano_cbor_writer_t* writer)
+{
+  if (plutus_v1_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(plutus_v1_script_list->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t array_size = cardano_array_get_size(plutus_v1_script_list->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_v1_script_list->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(plutus_v1_script_list->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in plutus_v1_script_list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_plutus_v1_script_to_cbor((cardano_plutus_v1_script_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_list_to_cip116_json(
+  const cardano_plutus_v1_script_list_t* plutus_v1_scripts,
+  cardano_json_writer_t*                 writer)
+{
+  if ((plutus_v1_scripts == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  const size_t count = cardano_plutus_v1_script_list_get_length(plutus_v1_scripts);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    cardano_plutus_v1_script_t* script = NULL;
+
+    cardano_error_t error = cardano_plutus_v1_script_list_get(plutus_v1_scripts, i, &script);
+
+    assert(error == CARDANO_SUCCESS);
+    CARDANO_UNUSED(error);
+
+    error = cardano_plutus_v1_script_to_cip116_json(script, writer);
+
+    cardano_plutus_v1_script_unref(&script);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_json_writer_write_end_array(writer);
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_plutus_v1_script_list_get_length(const cardano_plutus_v1_script_list_t* plutus_v1_script_list)
+{
+  if (plutus_v1_script_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(plutus_v1_script_list->array);
+}
+
+cardano_error_t
+cardano_plutus_v1_script_list_get(
+  const cardano_plutus_v1_script_list_t* plutus_v1_script_list,
+  size_t                                 index,
+  cardano_plutus_v1_script_t**           element)
+{
+  if (plutus_v1_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(plutus_v1_script_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_plutus_v1_script_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_list_add(cardano_plutus_v1_script_list_t* plutus_v1_script_list, cardano_plutus_v1_script_t* element)
+{
+  if (plutus_v1_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(plutus_v1_script_list->array);
+  const size_t new_size      = cardano_array_push(plutus_v1_script_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_plutus_v1_script_list_unref(cardano_plutus_v1_script_list_t** plutus_v1_script_list)
+{
+  if ((plutus_v1_script_list == NULL) || (*plutus_v1_script_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v1_script_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v1_script_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v1_script_list_ref(cardano_plutus_v1_script_list_t* plutus_v1_script_list)
+{
+  if (plutus_v1_script_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v1_script_list->base);
+}
+
+size_t
+cardano_plutus_v1_script_list_refcount(const cardano_plutus_v1_script_list_t* plutus_v1_script_list)
+{
+  if (plutus_v1_script_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v1_script_list->base);
+}
+
+void
+cardano_plutus_v1_script_list_set_last_error(cardano_plutus_v1_script_list_t* plutus_v1_script_list, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v1_script_list->base, message);
+}
+
+const char*
+cardano_plutus_v1_script_list_get_last_error(const cardano_plutus_v1_script_list_t* plutus_v1_script_list)
+{
+  return cardano_object_get_last_error(&plutus_v1_script_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_plutus_v1_script_t* copy   = NULL;
+  const cardano_error_t       result = cardano_plutus_v1_script_deep_clone((const cardano_plutus_v1_script_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_list_deep_clone(const cardano_plutus_v1_script_list_t* source, cardano_plutus_v1_script_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v1_script_list_t* copy = _cardano_malloc(sizeof(cardano_plutus_v1_script_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/auxiliary_data/plutus_v2_script_list.c b/vendor/src/auxiliary_data/plutus_v2_script_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/auxiliary_data/plutus_v2_script_list.c
@@ -0,0 +1,449 @@
+/**
+ * \file plutus_v2_script_list.c
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/plutus_v2_script_list.h>
+#include <cardano/object.h>
+#include <cardano/scripts/plutus_scripts/plutus_v2_script.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus script list.
+ */
+typedef struct cardano_plutus_v2_script_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_plutus_v2_script_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus script list object.
+ *
+ * This function is responsible for properly deallocating a plutus script list object (`cardano_plutus_v2_script_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the proposal procedure_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v2_script_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus script list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v2_script_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v2_script_list_t* list = (cardano_plutus_v2_script_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v2_script_list_new(cardano_plutus_v2_script_list_t** plutus_v2_script_list)
+{
+  if (plutus_v2_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v2_script_list_t* list = _cardano_malloc(sizeof(cardano_plutus_v2_script_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_plutus_v2_script_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *plutus_v2_script_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_list_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v2_script_list_t** plutus_v2_script_list)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v2_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v2_script_list_t* list   = NULL;
+  cardano_error_t                  result = cardano_plutus_v2_script_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  CARDANO_UNUSED(length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v2_script_list_unref(&list);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v2_script_list_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_plutus_v2_script_t* element = NULL;
+
+    result = cardano_plutus_v2_script_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v2_script_list_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_plutus_v2_script_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_plutus_v2_script_list_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("plutus_v2_script_list", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v2_script_list_unref(&list);
+    return result;
+  }
+
+  *plutus_v2_script_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_list_to_cbor(const cardano_plutus_v2_script_list_t* plutus_v2_script_list, cardano_cbor_writer_t* writer)
+{
+  if (plutus_v2_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(plutus_v2_script_list->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t array_size = cardano_array_get_size(plutus_v2_script_list->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_v2_script_list->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(plutus_v2_script_list->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in plutus_v2_script_list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_plutus_v2_script_to_cbor((cardano_plutus_v2_script_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_list_to_cip116_json(
+  const cardano_plutus_v2_script_list_t* plutus_v2_scripts,
+  cardano_json_writer_t*                 writer)
+{
+  if ((plutus_v2_scripts == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  const size_t count = cardano_plutus_v2_script_list_get_length(plutus_v2_scripts);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    cardano_plutus_v2_script_t* script = NULL;
+
+    cardano_error_t error = cardano_plutus_v2_script_list_get(plutus_v2_scripts, i, &script);
+
+    assert(error == CARDANO_SUCCESS);
+    CARDANO_UNUSED(error);
+
+    error = cardano_plutus_v2_script_to_cip116_json(script, writer);
+
+    cardano_plutus_v2_script_unref(&script);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_json_writer_write_end_array(writer);
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_plutus_v2_script_list_get_length(const cardano_plutus_v2_script_list_t* plutus_v2_script_list)
+{
+  if (plutus_v2_script_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(plutus_v2_script_list->array);
+}
+
+cardano_error_t
+cardano_plutus_v2_script_list_get(
+  const cardano_plutus_v2_script_list_t* plutus_v2_script_list,
+  size_t                                 index,
+  cardano_plutus_v2_script_t**           element)
+{
+  if (plutus_v2_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(plutus_v2_script_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_plutus_v2_script_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_list_add(cardano_plutus_v2_script_list_t* plutus_v2_script_list, cardano_plutus_v2_script_t* element)
+{
+  if (plutus_v2_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(plutus_v2_script_list->array);
+  const size_t new_size      = cardano_array_push(plutus_v2_script_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_plutus_v2_script_list_unref(cardano_plutus_v2_script_list_t** plutus_v2_script_list)
+{
+  if ((plutus_v2_script_list == NULL) || (*plutus_v2_script_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v2_script_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v2_script_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v2_script_list_ref(cardano_plutus_v2_script_list_t* plutus_v2_script_list)
+{
+  if (plutus_v2_script_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v2_script_list->base);
+}
+
+size_t
+cardano_plutus_v2_script_list_refcount(const cardano_plutus_v2_script_list_t* plutus_v2_script_list)
+{
+  if (plutus_v2_script_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v2_script_list->base);
+}
+
+void
+cardano_plutus_v2_script_list_set_last_error(cardano_plutus_v2_script_list_t* plutus_v2_script_list, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v2_script_list->base, message);
+}
+
+const char*
+cardano_plutus_v2_script_list_get_last_error(const cardano_plutus_v2_script_list_t* plutus_v2_script_list)
+{
+  return cardano_object_get_last_error(&plutus_v2_script_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_plutus_v2_script_t* copy   = NULL;
+  const cardano_error_t       result = cardano_plutus_v2_script_deep_clone((const cardano_plutus_v2_script_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_list_deep_clone(const cardano_plutus_v2_script_list_t* source, cardano_plutus_v2_script_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v2_script_list_t* copy = _cardano_malloc(sizeof(cardano_plutus_v2_script_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/auxiliary_data/plutus_v3_script_list.c b/vendor/src/auxiliary_data/plutus_v3_script_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/auxiliary_data/plutus_v3_script_list.c
@@ -0,0 +1,449 @@
+/**
+ * \file plutus_v3_script_list.c
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/plutus_v3_script_list.h>
+#include <cardano/object.h>
+#include <cardano/scripts/plutus_scripts/plutus_v3_script.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus script list.
+ */
+typedef struct cardano_plutus_v3_script_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_plutus_v3_script_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus script list object.
+ *
+ * This function is responsible for properly deallocating a plutus script list object (`cardano_plutus_v3_script_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the proposal procedure_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v3_script_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus script list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v3_script_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v3_script_list_t* list = (cardano_plutus_v3_script_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v3_script_list_new(cardano_plutus_v3_script_list_t** plutus_v3_script_list)
+{
+  if (plutus_v3_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v3_script_list_t* list = _cardano_malloc(sizeof(cardano_plutus_v3_script_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_plutus_v3_script_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *plutus_v3_script_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_list_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v3_script_list_t** plutus_v3_script_list)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v3_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v3_script_list_t* list   = NULL;
+  cardano_error_t                  result = cardano_plutus_v3_script_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  CARDANO_UNUSED(length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v3_script_list_unref(&list);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v3_script_list_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_plutus_v3_script_t* element = NULL;
+
+    result = cardano_plutus_v3_script_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v3_script_list_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_plutus_v3_script_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_plutus_v3_script_list_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("plutus_v3_script_list", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v3_script_list_unref(&list);
+    return result;
+  }
+
+  *plutus_v3_script_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_list_to_cbor(const cardano_plutus_v3_script_list_t* plutus_v3_script_list, cardano_cbor_writer_t* writer)
+{
+  if (plutus_v3_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(plutus_v3_script_list->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t array_size = cardano_array_get_size(plutus_v3_script_list->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_v3_script_list->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(plutus_v3_script_list->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in plutus_v3_script_list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_plutus_v3_script_to_cbor((cardano_plutus_v3_script_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_list_to_cip116_json(
+  const cardano_plutus_v3_script_list_t* plutus_v3_scripts,
+  cardano_json_writer_t*                 writer)
+{
+  if ((plutus_v3_scripts == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  const size_t count = cardano_plutus_v3_script_list_get_length(plutus_v3_scripts);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    cardano_plutus_v3_script_t* script = NULL;
+
+    cardano_error_t error = cardano_plutus_v3_script_list_get(plutus_v3_scripts, i, &script);
+
+    assert(error == CARDANO_SUCCESS);
+    CARDANO_UNUSED(error);
+
+    error = cardano_plutus_v3_script_to_cip116_json(script, writer);
+
+    cardano_plutus_v3_script_unref(&script);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_json_writer_write_end_array(writer);
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_plutus_v3_script_list_get_length(const cardano_plutus_v3_script_list_t* plutus_v3_script_list)
+{
+  if (plutus_v3_script_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(plutus_v3_script_list->array);
+}
+
+cardano_error_t
+cardano_plutus_v3_script_list_get(
+  const cardano_plutus_v3_script_list_t* plutus_v3_script_list,
+  size_t                                 index,
+  cardano_plutus_v3_script_t**           element)
+{
+  if (plutus_v3_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(plutus_v3_script_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_plutus_v3_script_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_list_add(cardano_plutus_v3_script_list_t* plutus_v3_script_list, cardano_plutus_v3_script_t* element)
+{
+  if (plutus_v3_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(plutus_v3_script_list->array);
+  const size_t new_size      = cardano_array_push(plutus_v3_script_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_plutus_v3_script_list_unref(cardano_plutus_v3_script_list_t** plutus_v3_script_list)
+{
+  if ((plutus_v3_script_list == NULL) || (*plutus_v3_script_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v3_script_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v3_script_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v3_script_list_ref(cardano_plutus_v3_script_list_t* plutus_v3_script_list)
+{
+  if (plutus_v3_script_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v3_script_list->base);
+}
+
+size_t
+cardano_plutus_v3_script_list_refcount(const cardano_plutus_v3_script_list_t* plutus_v3_script_list)
+{
+  if (plutus_v3_script_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v3_script_list->base);
+}
+
+void
+cardano_plutus_v3_script_list_set_last_error(cardano_plutus_v3_script_list_t* plutus_v3_script_list, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v3_script_list->base, message);
+}
+
+const char*
+cardano_plutus_v3_script_list_get_last_error(const cardano_plutus_v3_script_list_t* plutus_v3_script_list)
+{
+  return cardano_object_get_last_error(&plutus_v3_script_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_plutus_v3_script_t* copy   = NULL;
+  const cardano_error_t       result = cardano_plutus_v3_script_deep_clone((const cardano_plutus_v3_script_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_list_deep_clone(const cardano_plutus_v3_script_list_t* source, cardano_plutus_v3_script_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v3_script_list_t* copy = _cardano_malloc(sizeof(cardano_plutus_v3_script_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/auxiliary_data/plutus_v4_script_list.c b/vendor/src/auxiliary_data/plutus_v4_script_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/auxiliary_data/plutus_v4_script_list.c
@@ -0,0 +1,449 @@
+/**
+ * \file plutus_v4_script_list.c
+ *
+ * \author angel.castillo
+ * \date   Jul 17, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/plutus_v4_script_list.h>
+#include <cardano/object.h>
+#include <cardano/scripts/plutus_scripts/plutus_v4_script.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus script list.
+ */
+typedef struct cardano_plutus_v4_script_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_plutus_v4_script_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus script list object.
+ *
+ * This function is responsible for properly deallocating a plutus script list object (`cardano_plutus_v4_script_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the proposal procedure_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v4_script_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus script list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v4_script_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v4_script_list_t* list = (cardano_plutus_v4_script_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v4_script_list_new(cardano_plutus_v4_script_list_t** plutus_v4_script_list)
+{
+  if (plutus_v4_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v4_script_list_t* list = _cardano_malloc(sizeof(cardano_plutus_v4_script_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_plutus_v4_script_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *plutus_v4_script_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_list_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v4_script_list_t** plutus_v4_script_list)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v4_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v4_script_list_t* list   = NULL;
+  cardano_error_t                  result = cardano_plutus_v4_script_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  CARDANO_UNUSED(length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v4_script_list_unref(&list);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v4_script_list_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_plutus_v4_script_t* element = NULL;
+
+    result = cardano_plutus_v4_script_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v4_script_list_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_plutus_v4_script_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_plutus_v4_script_list_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("plutus_v4_script_list", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v4_script_list_unref(&list);
+    return result;
+  }
+
+  *plutus_v4_script_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_list_to_cbor(const cardano_plutus_v4_script_list_t* plutus_v4_script_list, cardano_cbor_writer_t* writer)
+{
+  if (plutus_v4_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(plutus_v4_script_list->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t array_size = cardano_array_get_size(plutus_v4_script_list->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_v4_script_list->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(plutus_v4_script_list->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in plutus_v4_script_list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_plutus_v4_script_to_cbor((cardano_plutus_v4_script_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_list_to_cip116_json(
+  const cardano_plutus_v4_script_list_t* plutus_v4_scripts,
+  cardano_json_writer_t*                 writer)
+{
+  if ((plutus_v4_scripts == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  const size_t count = cardano_plutus_v4_script_list_get_length(plutus_v4_scripts);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    cardano_plutus_v4_script_t* script = NULL;
+
+    cardano_error_t error = cardano_plutus_v4_script_list_get(plutus_v4_scripts, i, &script);
+
+    assert(error == CARDANO_SUCCESS);
+    CARDANO_UNUSED(error);
+
+    error = cardano_plutus_v4_script_to_cip116_json(script, writer);
+
+    cardano_plutus_v4_script_unref(&script);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_json_writer_write_end_array(writer);
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_plutus_v4_script_list_get_length(const cardano_plutus_v4_script_list_t* plutus_v4_script_list)
+{
+  if (plutus_v4_script_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(plutus_v4_script_list->array);
+}
+
+cardano_error_t
+cardano_plutus_v4_script_list_get(
+  const cardano_plutus_v4_script_list_t* plutus_v4_script_list,
+  size_t                                 index,
+  cardano_plutus_v4_script_t**           element)
+{
+  if (plutus_v4_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(plutus_v4_script_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_plutus_v4_script_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_list_add(cardano_plutus_v4_script_list_t* plutus_v4_script_list, cardano_plutus_v4_script_t* element)
+{
+  if (plutus_v4_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(plutus_v4_script_list->array);
+  const size_t new_size      = cardano_array_push(plutus_v4_script_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_plutus_v4_script_list_unref(cardano_plutus_v4_script_list_t** plutus_v4_script_list)
+{
+  if ((plutus_v4_script_list == NULL) || (*plutus_v4_script_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v4_script_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v4_script_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v4_script_list_ref(cardano_plutus_v4_script_list_t* plutus_v4_script_list)
+{
+  if (plutus_v4_script_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v4_script_list->base);
+}
+
+size_t
+cardano_plutus_v4_script_list_refcount(const cardano_plutus_v4_script_list_t* plutus_v4_script_list)
+{
+  if (plutus_v4_script_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v4_script_list->base);
+}
+
+void
+cardano_plutus_v4_script_list_set_last_error(cardano_plutus_v4_script_list_t* plutus_v4_script_list, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v4_script_list->base, message);
+}
+
+const char*
+cardano_plutus_v4_script_list_get_last_error(const cardano_plutus_v4_script_list_t* plutus_v4_script_list)
+{
+  return cardano_object_get_last_error(&plutus_v4_script_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_plutus_v4_script_t* copy   = NULL;
+  const cardano_error_t       result = cardano_plutus_v4_script_deep_clone((const cardano_plutus_v4_script_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_list_deep_clone(const cardano_plutus_v4_script_list_t* source, cardano_plutus_v4_script_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v4_script_list_t* copy = _cardano_malloc(sizeof(cardano_plutus_v4_script_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/auxiliary_data/transaction_metadata.c b/vendor/src/auxiliary_data/transaction_metadata.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/auxiliary_data/transaction_metadata.c
@@ -0,0 +1,785 @@
+/**
+ * \file transaction_metadata.c
+ *
+ * \author angel.castillo
+ * \date   Sep 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/auxiliary_data/metadatum.h>
+#include <cardano/auxiliary_data/metadatum_label_list.h>
+#include <cardano/auxiliary_data/transaction_metadata.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/set.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano transaction metadata map.
+ */
+typedef struct cardano_transaction_metadata_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_transaction_metadata_t;
+
+/**
+ * \brief Represents a Cardano transaction metadata map key value pair.
+ */
+typedef struct cardano_transaction_metadata_kvp_t
+{
+    cardano_object_t     base;
+    uint64_t             key;
+    cardano_metadatum_t* value;
+} cardano_transaction_metadata_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a transaction metadata map object.
+ *
+ * This function is responsible for properly deallocating a transaction metadata map object (`cardano_transaction_metadata_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the transaction_metadata object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_transaction_metadata_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the transaction_metadata
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_transaction_metadata_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_transaction_metadata_t* map = (cardano_transaction_metadata_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a transaction metadata map key value pair object.
+ *
+ * This function is responsible for properly deallocating a transaction metadata map key value pair object (`cardano_transaction_metadata_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the transaction_metadata object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_transaction_metadata_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the transaction_metadata
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_transaction_metadata_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_transaction_metadata_kvp_t* map = (cardano_transaction_metadata_kvp_t*)object;
+
+  cardano_metadatum_unref(&map->value);
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two cardano_transaction_metadata_kvp_t objects based on their reward_address.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the address of lhs is less than the address of rhs, zero if they are equal,
+ *         and a positive value if the address of lhs is greater than the address of rhs.
+ */
+static int32_t
+compare_by_value(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_transaction_metadata_kvp_t* lhs_kvp = (const cardano_transaction_metadata_kvp_t*)((const void*)lhs);
+  const cardano_transaction_metadata_kvp_t* rhs_kvp = (const cardano_transaction_metadata_kvp_t*)((const void*)rhs);
+
+  return (lhs_kvp->key < rhs_kvp->key) ? -1 : 1;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_transaction_metadata_new(cardano_transaction_metadata_t** transaction_metadata)
+{
+  if (transaction_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_metadata_t* map = _cardano_malloc(sizeof(cardano_transaction_metadata_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_transaction_metadata_deallocate;
+
+  map->array = cardano_array_new(32);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *transaction_metadata = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_metadata_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_metadata_t** transaction_metadata)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (transaction_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_metadata_t* map    = NULL;
+  cardano_error_t                 result = cardano_transaction_metadata_new(&map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_map(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_metadata_unref(&map);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_metadata_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    uint64_t             key   = 0;
+    cardano_metadatum_t* value = NULL;
+
+    result = cardano_cbor_reader_read_uint(reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_metadata_unref(&map);
+      return result;
+    }
+
+    result = cardano_metadatum_from_cbor(reader, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_metadata_unref(&map);
+      return result;
+    }
+
+    cardano_transaction_metadata_kvp_t* kvp = _cardano_malloc(sizeof(cardano_transaction_metadata_kvp_t));
+
+    if (kvp == NULL)
+    {
+      cardano_metadatum_unref(&value);
+      cardano_transaction_metadata_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    kvp->base.ref_count     = 0;
+    kvp->base.last_error[0] = '\0';
+    kvp->base.deallocator   = cardano_transaction_metadata_kvp_deallocate;
+    kvp->key                = key;
+    kvp->value              = value;
+
+    const size_t old_size = cardano_array_get_size(map->array);
+    const size_t new_size = cardano_array_push(map->array, (cardano_object_t*)((void*)kvp));
+
+    if (new_size != (old_size + 1U))
+    {
+      cardano_transaction_metadata_kvp_deallocate(kvp);
+      cardano_transaction_metadata_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    cardano_array_sort(map->array, compare_by_value, NULL);
+  }
+
+  result = cardano_cbor_validate_end_map("transaction_metadata", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_metadata_unref(&map);
+    return result;
+  }
+
+  *transaction_metadata = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_metadata_to_cbor(const cardano_transaction_metadata_t* transaction_metadata, cardano_cbor_writer_t* writer)
+{
+  if (transaction_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t map_size = cardano_array_get_size(transaction_metadata->array);
+  result          = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(transaction_metadata->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(transaction_metadata->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in transaction metadata map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_transaction_metadata_kvp_t* kvp_data = (cardano_transaction_metadata_kvp_t*)((void*)kvp);
+
+    result = cardano_cbor_writer_write_uint(writer, kvp_data->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    result = cardano_metadatum_to_cbor(kvp_data->value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    cardano_object_unref(&kvp);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_metadata_to_cip116_json(
+  const cardano_transaction_metadata_t* metadata,
+  cardano_json_writer_t*                writer)
+{
+  if ((metadata == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  const size_t count = cardano_transaction_metadata_get_length(metadata);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    uint64_t             label = 0U;
+    cardano_metadatum_t* value = NULL;
+
+    cardano_error_t error = cardano_transaction_metadata_get_key_value_at(metadata, i, &label, &value);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    cardano_json_writer_write_start_object(writer);
+
+    char key_buf[32] = { 0 };
+
+    const size_t string_size = cardano_safe_uint64_to_string(label, key_buf, sizeof(key_buf));
+    cardano_json_writer_write_property_name(writer, "key", 3);
+    cardano_json_writer_write_string(writer, key_buf, string_size);
+
+    cardano_json_writer_write_property_name(writer, "value", 5);
+    error = cardano_metadatum_to_cip116_json(value, writer);
+
+    cardano_metadatum_unref(&value);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    cardano_json_writer_write_end_object(writer);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_transaction_metadata_get_length(const cardano_transaction_metadata_t* transaction_metadata)
+{
+  if (transaction_metadata == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(transaction_metadata->array);
+}
+
+cardano_error_t
+cardano_transaction_metadata_get(
+  cardano_transaction_metadata_t* transaction_metadata,
+  const uint64_t                  key,
+  cardano_metadatum_t**           element)
+{
+  if (transaction_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(transaction_metadata->array); ++i)
+  {
+    cardano_object_t*                   object = cardano_array_get(transaction_metadata->array, i);
+    cardano_transaction_metadata_kvp_t* kvp    = (cardano_transaction_metadata_kvp_t*)((void*)object);
+
+    if (kvp->key == key)
+    {
+      cardano_metadatum_ref(kvp->value);
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_transaction_metadata_insert(
+  cardano_transaction_metadata_t* transaction_metadata,
+  const uint64_t                  key,
+  cardano_metadatum_t*            value)
+{
+  if (transaction_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_metadata_kvp_t* kvp = _cardano_malloc(sizeof(cardano_transaction_metadata_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_transaction_metadata_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_metadatum_ref(value);
+
+  const size_t old_size = cardano_array_get_size(transaction_metadata->array);
+  const size_t new_size = cardano_array_push(transaction_metadata->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_transaction_metadata_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(transaction_metadata->array, compare_by_value, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_metadata_get_keys(
+  cardano_transaction_metadata_t*  transaction_metadata,
+  cardano_metadatum_label_list_t** keys)
+{
+  if (transaction_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_label_list_t* list = NULL;
+
+  cardano_error_t result = cardano_metadatum_label_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(transaction_metadata->array); ++i)
+  {
+    cardano_object_t*                   object = cardano_array_get(transaction_metadata->array, i);
+    cardano_transaction_metadata_kvp_t* kvp    = (cardano_transaction_metadata_kvp_t*)((void*)object);
+
+    result = cardano_metadatum_label_list_add(list, kvp->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_metadatum_label_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_metadata_get_key_at(
+  const cardano_transaction_metadata_t* transaction_metadata,
+  const size_t                          index,
+  uint64_t*                             metadatum_label)
+{
+  if (transaction_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum_label == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(transaction_metadata->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                   object = cardano_array_get(transaction_metadata->array, index);
+  cardano_transaction_metadata_kvp_t* kvp    = (cardano_transaction_metadata_kvp_t*)((void*)object);
+
+  cardano_object_unref(&object);
+
+  *metadatum_label = kvp->key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_metadata_get_value_at(
+  const cardano_transaction_metadata_t* transaction_metadata,
+  size_t                                index,
+  cardano_metadatum_t**                 amount)
+{
+  if (transaction_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(transaction_metadata->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                   object = cardano_array_get(transaction_metadata->array, index);
+  cardano_transaction_metadata_kvp_t* kvp    = (cardano_transaction_metadata_kvp_t*)((void*)object);
+
+  cardano_object_unref(&object);
+
+  cardano_metadatum_ref(kvp->value);
+  *amount = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_metadata_get_key_value_at(
+  const cardano_transaction_metadata_t* transaction_metadata,
+  const size_t                          index,
+  uint64_t*                             metadatum_label,
+  cardano_metadatum_t**                 metadatum)
+{
+  if (transaction_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum_label == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadatum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(transaction_metadata->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                   object = cardano_array_get(transaction_metadata->array, index);
+  cardano_transaction_metadata_kvp_t* kvp    = (cardano_transaction_metadata_kvp_t*)((void*)object);
+
+  cardano_object_unref(&object);
+
+  cardano_metadatum_ref(kvp->value);
+
+  *metadatum_label = kvp->key;
+  *metadatum       = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_transaction_metadata_unref(cardano_transaction_metadata_t** transaction_metadata)
+{
+  if ((transaction_metadata == NULL) || (*transaction_metadata == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*transaction_metadata)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *transaction_metadata = NULL;
+    return;
+  }
+}
+
+void
+cardano_transaction_metadata_ref(cardano_transaction_metadata_t* transaction_metadata)
+{
+  if (transaction_metadata == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&transaction_metadata->base);
+}
+
+size_t
+cardano_transaction_metadata_refcount(const cardano_transaction_metadata_t* transaction_metadata)
+{
+  if (transaction_metadata == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&transaction_metadata->base);
+}
+
+void
+cardano_transaction_metadata_set_last_error(cardano_transaction_metadata_t* transaction_metadata, const char* message)
+{
+  cardano_object_set_last_error(&transaction_metadata->base, message);
+}
+
+const char*
+cardano_transaction_metadata_get_last_error(const cardano_transaction_metadata_t* transaction_metadata)
+{
+  return cardano_object_get_last_error(&transaction_metadata->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_transaction_metadata_kvp_deep_clone(const cardano_transaction_metadata_kvp_t* source, cardano_transaction_metadata_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_metadata_kvp_t* copy = _cardano_malloc(sizeof(cardano_transaction_metadata_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = source->key;
+  copy->value              = NULL;
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_metadatum_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_transaction_metadata_kvp_t* copy   = NULL;
+  const cardano_error_t               result = cardano_transaction_metadata_kvp_deep_clone((const cardano_transaction_metadata_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_transaction_metadata_deep_clone(const cardano_transaction_metadata_t* source, cardano_transaction_metadata_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_metadata_t* copy = _cardano_malloc(sizeof(cardano_transaction_metadata_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/bip39/bip39.c b/vendor/src/bip39/bip39.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/bip39/bip39.c
@@ -0,0 +1,192 @@
+/**
+ * \file bip39.c
+ *
+ * \author angel.castillo
+ * \date   Nov 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/bip39.h>
+
+#include "bip39_wordlist_en.h"
+
+#include "../string_safe.h"
+#include <assert.h>
+#include <sodium.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t BITS_PER_WORD = 11U;
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_bip39_entropy_to_mnemonic_words(
+  const byte_t* entropy,
+  const size_t  entropy_size,
+  const char**  words,
+  size_t*       word_count)
+{
+  if (!entropy || !words || !word_count)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((entropy_size != 16U) && (entropy_size != 20U) && (entropy_size != 24U) && (entropy_size != 28U) && (entropy_size != 32U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  size_t checksum_bits = (entropy_size * 8U) / 32U;
+  size_t total_bits    = (entropy_size * 8U) + checksum_bits;
+  *word_count          = total_bits / BITS_PER_WORD;
+
+  byte_t entropy_with_checksum[33] = { 0 };
+  cardano_safe_memcpy(entropy_with_checksum, sizeof(entropy_with_checksum), entropy, entropy_size);
+
+  byte_t hash[32] = { 0 };
+  CARDANO_UNUSED(crypto_hash_sha256(hash, entropy, entropy_size));
+
+  if (checksum_bits > 0U)
+  {
+    entropy_with_checksum[entropy_size] = hash[0];
+  }
+
+  byte_t bitstream[33] = { 0 };
+  cardano_safe_memcpy(bitstream, sizeof(bitstream), entropy_with_checksum, entropy_size + 1U);
+
+  for (size_t i = 0U; i < *word_count; ++i)
+  {
+    uint16_t index = 0U;
+
+    for (size_t j = 0U; j < BITS_PER_WORD; ++j)
+    {
+      size_t bit_index   = (i * BITS_PER_WORD) + j;
+      size_t byte_index  = bit_index / 8U;
+      size_t bit_in_byte = 7U - (bit_index % 8U);
+
+      if ((bitstream[byte_index] & (1U << bit_in_byte)) > 0U)
+      {
+        index |= (uint16_t)(1U << (BITS_PER_WORD - 1U - j));
+      }
+    }
+
+    assert(index < 2048U);
+    words[i] = BIP39_WORDLIST_EN[index];
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bip39_mnemonic_words_to_entropy(
+  const char** words,
+  const size_t word_count,
+  byte_t*      entropy,
+  const size_t entropy_buf_size,
+  size_t*      entropy_size)
+{
+  if (!words || !entropy || !entropy_size)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((word_count != 12U) && (word_count != 15U) && (word_count != 18U) && (word_count != 21U) && (word_count != 24U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  size_t checksum_bits = word_count / 3U;
+  size_t entropy_bits  = (word_count * BITS_PER_WORD) - checksum_bits;
+  size_t entropy_bytes = entropy_bits / 8U;
+
+  if (entropy_buf_size < entropy_bytes)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  size_t total_bits    = word_count * BITS_PER_WORD;
+  size_t bitstram_size = (total_bits + 7U) / 8U;
+  byte_t bitstream[34] = { 0 };
+
+  CARDANO_UNUSED(memset(bitstream, 0U, bitstram_size));
+
+  for (size_t i = 0U; i < word_count; i++)
+  {
+    int32_t index = -1;
+    for (int32_t j = 0; j < 2048; ++j)
+    {
+      if (strcmp(words[i], BIP39_WORDLIST_EN[j]) == 0)
+      {
+        index = j;
+        break;
+      }
+    }
+    if (index == -1)
+    {
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+
+    for (size_t k = 0U; k < BITS_PER_WORD; ++k)
+    {
+      size_t shift_amount = 10U - k;
+      size_t mask         = ((size_t)1) << shift_amount;
+
+      if (((uint32_t)index & (uint32_t)mask) != 0U)
+      {
+        size_t bit_index   = (i * BITS_PER_WORD) + k;
+        size_t byte_index  = bit_index / 8U;
+        byte_t bit_in_byte = (byte_t)(7U - (bit_index % 8U));
+
+        bitstream[byte_index] |= (1U << bit_in_byte);
+      }
+    }
+  }
+
+  cardano_safe_memcpy(entropy, entropy_buf_size, bitstream, entropy_bytes);
+
+  *entropy_size = entropy_bytes;
+
+  byte_t hash[32];
+  crypto_hash_sha256(hash, entropy, entropy_bytes);
+
+  byte_t calculated_checksum = hash[0] >> (8U - checksum_bits);
+
+  byte_t extracted_checksum = 0U;
+  size_t checksum_start_bit = entropy_bits;
+
+  for (size_t i = 0U; i < checksum_bits; i++)
+  {
+    size_t bit_index   = checksum_start_bit + i;
+    size_t byte_index  = bit_index / 8U;
+    size_t bit_in_byte = 7U - (bit_index % 8U);
+
+    if ((bitstream[byte_index] & (1U << bit_in_byte)) > 0U)
+    {
+      extracted_checksum |= (byte_t)(1U << (checksum_bits - 1U - i));
+    }
+  }
+
+  if (calculated_checksum != extracted_checksum)
+  {
+    return CARDANO_ERROR_INVALID_CHECKSUM;
+  }
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/bip39/bip39_wordlist_en.h b/vendor/src/bip39/bip39_wordlist_en.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/bip39/bip39_wordlist_en.h
@@ -0,0 +1,2081 @@
+/**
+ * \file bip39_wordlist_en.h
+ *
+ * \author angel.castillo
+ * \date   Nov 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BIP39_WORDLIST_EN_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BIP39_WORDLIST_EN_H
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief The English BIP-39 wordlist.
+ */
+static const char* BIP39_WORDLIST_EN[2048] = {
+  "abandon",
+  "ability",
+  "able",
+  "about",
+  "above",
+  "absent",
+  "absorb",
+  "abstract",
+  "absurd",
+  "abuse",
+  "access",
+  "accident",
+  "account",
+  "accuse",
+  "achieve",
+  "acid",
+  "acoustic",
+  "acquire",
+  "across",
+  "act",
+  "action",
+  "actor",
+  "actress",
+  "actual",
+  "adapt",
+  "add",
+  "addict",
+  "address",
+  "adjust",
+  "admit",
+  "adult",
+  "advance",
+  "advice",
+  "aerobic",
+  "affair",
+  "afford",
+  "afraid",
+  "again",
+  "age",
+  "agent",
+  "agree",
+  "ahead",
+  "aim",
+  "air",
+  "airport",
+  "aisle",
+  "alarm",
+  "album",
+  "alcohol",
+  "alert",
+  "alien",
+  "all",
+  "alley",
+  "allow",
+  "almost",
+  "alone",
+  "alpha",
+  "already",
+  "also",
+  "alter",
+  "always",
+  "amateur",
+  "amazing",
+  "among",
+  "amount",
+  "amused",
+  "analyst",
+  "anchor",
+  "ancient",
+  "anger",
+  "angle",
+  "angry",
+  "animal",
+  "ankle",
+  "announce",
+  "annual",
+  "another",
+  "answer",
+  "antenna",
+  "antique",
+  "anxiety",
+  "any",
+  "apart",
+  "apology",
+  "appear",
+  "apple",
+  "approve",
+  "april",
+  "arch",
+  "arctic",
+  "area",
+  "arena",
+  "argue",
+  "arm",
+  "armed",
+  "armor",
+  "army",
+  "around",
+  "arrange",
+  "arrest",
+  "arrive",
+  "arrow",
+  "art",
+  "artefact",
+  "artist",
+  "artwork",
+  "ask",
+  "aspect",
+  "assault",
+  "asset",
+  "assist",
+  "assume",
+  "asthma",
+  "athlete",
+  "atom",
+  "attack",
+  "attend",
+  "attitude",
+  "attract",
+  "auction",
+  "audit",
+  "august",
+  "aunt",
+  "author",
+  "auto",
+  "autumn",
+  "average",
+  "avocado",
+  "avoid",
+  "awake",
+  "aware",
+  "away",
+  "awesome",
+  "awful",
+  "awkward",
+  "axis",
+  "baby",
+  "bachelor",
+  "bacon",
+  "badge",
+  "bag",
+  "balance",
+  "balcony",
+  "ball",
+  "bamboo",
+  "banana",
+  "banner",
+  "bar",
+  "barely",
+  "bargain",
+  "barrel",
+  "base",
+  "basic",
+  "basket",
+  "battle",
+  "beach",
+  "bean",
+  "beauty",
+  "because",
+  "become",
+  "beef",
+  "before",
+  "begin",
+  "behave",
+  "behind",
+  "believe",
+  "below",
+  "belt",
+  "bench",
+  "benefit",
+  "best",
+  "betray",
+  "better",
+  "between",
+  "beyond",
+  "bicycle",
+  "bid",
+  "bike",
+  "bind",
+  "biology",
+  "bird",
+  "birth",
+  "bitter",
+  "black",
+  "blade",
+  "blame",
+  "blanket",
+  "blast",
+  "bleak",
+  "bless",
+  "blind",
+  "blood",
+  "blossom",
+  "blouse",
+  "blue",
+  "blur",
+  "blush",
+  "board",
+  "boat",
+  "body",
+  "boil",
+  "bomb",
+  "bone",
+  "bonus",
+  "book",
+  "boost",
+  "border",
+  "boring",
+  "borrow",
+  "boss",
+  "bottom",
+  "bounce",
+  "box",
+  "boy",
+  "bracket",
+  "brain",
+  "brand",
+  "brass",
+  "brave",
+  "bread",
+  "breeze",
+  "brick",
+  "bridge",
+  "brief",
+  "bright",
+  "bring",
+  "brisk",
+  "broccoli",
+  "broken",
+  "bronze",
+  "broom",
+  "brother",
+  "brown",
+  "brush",
+  "bubble",
+  "buddy",
+  "budget",
+  "buffalo",
+  "build",
+  "bulb",
+  "bulk",
+  "bullet",
+  "bundle",
+  "bunker",
+  "burden",
+  "burger",
+  "burst",
+  "bus",
+  "business",
+  "busy",
+  "butter",
+  "buyer",
+  "buzz",
+  "cabbage",
+  "cabin",
+  "cable",
+  "cactus",
+  "cage",
+  "cake",
+  "call",
+  "calm",
+  "camera",
+  "camp",
+  "can",
+  "canal",
+  "cancel",
+  "candy",
+  "cannon",
+  "canoe",
+  "canvas",
+  "canyon",
+  "capable",
+  "capital",
+  "captain",
+  "car",
+  "carbon",
+  "card",
+  "cargo",
+  "carpet",
+  "carry",
+  "cart",
+  "case",
+  "cash",
+  "casino",
+  "castle",
+  "casual",
+  "cat",
+  "catalog",
+  "catch",
+  "category",
+  "cattle",
+  "caught",
+  "cause",
+  "caution",
+  "cave",
+  "ceiling",
+  "celery",
+  "cement",
+  "census",
+  "century",
+  "cereal",
+  "certain",
+  "chair",
+  "chalk",
+  "champion",
+  "change",
+  "chaos",
+  "chapter",
+  "charge",
+  "chase",
+  "chat",
+  "cheap",
+  "check",
+  "cheese",
+  "chef",
+  "cherry",
+  "chest",
+  "chicken",
+  "chief",
+  "child",
+  "chimney",
+  "choice",
+  "choose",
+  "chronic",
+  "chuckle",
+  "chunk",
+  "churn",
+  "cigar",
+  "cinnamon",
+  "circle",
+  "citizen",
+  "city",
+  "civil",
+  "claim",
+  "clap",
+  "clarify",
+  "claw",
+  "clay",
+  "clean",
+  "clerk",
+  "clever",
+  "click",
+  "client",
+  "cliff",
+  "climb",
+  "clinic",
+  "clip",
+  "clock",
+  "clog",
+  "close",
+  "cloth",
+  "cloud",
+  "clown",
+  "club",
+  "clump",
+  "cluster",
+  "clutch",
+  "coach",
+  "coast",
+  "coconut",
+  "code",
+  "coffee",
+  "coil",
+  "coin",
+  "collect",
+  "color",
+  "column",
+  "combine",
+  "come",
+  "comfort",
+  "comic",
+  "common",
+  "company",
+  "concert",
+  "conduct",
+  "confirm",
+  "congress",
+  "connect",
+  "consider",
+  "control",
+  "convince",
+  "cook",
+  "cool",
+  "copper",
+  "copy",
+  "coral",
+  "core",
+  "corn",
+  "correct",
+  "cost",
+  "cotton",
+  "couch",
+  "country",
+  "couple",
+  "course",
+  "cousin",
+  "cover",
+  "coyote",
+  "crack",
+  "cradle",
+  "craft",
+  "cram",
+  "crane",
+  "crash",
+  "crater",
+  "crawl",
+  "crazy",
+  "cream",
+  "credit",
+  "creek",
+  "crew",
+  "cricket",
+  "crime",
+  "crisp",
+  "critic",
+  "crop",
+  "cross",
+  "crouch",
+  "crowd",
+  "crucial",
+  "cruel",
+  "cruise",
+  "crumble",
+  "crunch",
+  "crush",
+  "cry",
+  "crystal",
+  "cube",
+  "culture",
+  "cup",
+  "cupboard",
+  "curious",
+  "current",
+  "curtain",
+  "curve",
+  "cushion",
+  "custom",
+  "cute",
+  "cycle",
+  "dad",
+  "damage",
+  "damp",
+  "dance",
+  "danger",
+  "daring",
+  "dash",
+  "daughter",
+  "dawn",
+  "day",
+  "deal",
+  "debate",
+  "debris",
+  "decade",
+  "december",
+  "decide",
+  "decline",
+  "decorate",
+  "decrease",
+  "deer",
+  "defense",
+  "define",
+  "defy",
+  "degree",
+  "delay",
+  "deliver",
+  "demand",
+  "demise",
+  "denial",
+  "dentist",
+  "deny",
+  "depart",
+  "depend",
+  "deposit",
+  "depth",
+  "deputy",
+  "derive",
+  "describe",
+  "desert",
+  "design",
+  "desk",
+  "despair",
+  "destroy",
+  "detail",
+  "detect",
+  "develop",
+  "device",
+  "devote",
+  "diagram",
+  "dial",
+  "diamond",
+  "diary",
+  "dice",
+  "diesel",
+  "diet",
+  "differ",
+  "digital",
+  "dignity",
+  "dilemma",
+  "dinner",
+  "dinosaur",
+  "direct",
+  "dirt",
+  "disagree",
+  "discover",
+  "disease",
+  "dish",
+  "dismiss",
+  "disorder",
+  "display",
+  "distance",
+  "divert",
+  "divide",
+  "divorce",
+  "dizzy",
+  "doctor",
+  "document",
+  "dog",
+  "doll",
+  "dolphin",
+  "domain",
+  "donate",
+  "donkey",
+  "donor",
+  "door",
+  "dose",
+  "double",
+  "dove",
+  "draft",
+  "dragon",
+  "drama",
+  "drastic",
+  "draw",
+  "dream",
+  "dress",
+  "drift",
+  "drill",
+  "drink",
+  "drip",
+  "drive",
+  "drop",
+  "drum",
+  "dry",
+  "duck",
+  "dumb",
+  "dune",
+  "during",
+  "dust",
+  "dutch",
+  "duty",
+  "dwarf",
+  "dynamic",
+  "eager",
+  "eagle",
+  "early",
+  "earn",
+  "earth",
+  "easily",
+  "east",
+  "easy",
+  "echo",
+  "ecology",
+  "economy",
+  "edge",
+  "edit",
+  "educate",
+  "effort",
+  "egg",
+  "eight",
+  "either",
+  "elbow",
+  "elder",
+  "electric",
+  "elegant",
+  "element",
+  "elephant",
+  "elevator",
+  "elite",
+  "else",
+  "embark",
+  "embody",
+  "embrace",
+  "emerge",
+  "emotion",
+  "employ",
+  "empower",
+  "empty",
+  "enable",
+  "enact",
+  "end",
+  "endless",
+  "endorse",
+  "enemy",
+  "energy",
+  "enforce",
+  "engage",
+  "engine",
+  "enhance",
+  "enjoy",
+  "enlist",
+  "enough",
+  "enrich",
+  "enroll",
+  "ensure",
+  "enter",
+  "entire",
+  "entry",
+  "envelope",
+  "episode",
+  "equal",
+  "equip",
+  "era",
+  "erase",
+  "erode",
+  "erosion",
+  "error",
+  "erupt",
+  "escape",
+  "essay",
+  "essence",
+  "estate",
+  "eternal",
+  "ethics",
+  "evidence",
+  "evil",
+  "evoke",
+  "evolve",
+  "exact",
+  "example",
+  "excess",
+  "exchange",
+  "excite",
+  "exclude",
+  "excuse",
+  "execute",
+  "exercise",
+  "exhaust",
+  "exhibit",
+  "exile",
+  "exist",
+  "exit",
+  "exotic",
+  "expand",
+  "expect",
+  "expire",
+  "explain",
+  "expose",
+  "express",
+  "extend",
+  "extra",
+  "eye",
+  "eyebrow",
+  "fabric",
+  "face",
+  "faculty",
+  "fade",
+  "faint",
+  "faith",
+  "fall",
+  "false",
+  "fame",
+  "family",
+  "famous",
+  "fan",
+  "fancy",
+  "fantasy",
+  "farm",
+  "fashion",
+  "fat",
+  "fatal",
+  "father",
+  "fatigue",
+  "fault",
+  "favorite",
+  "feature",
+  "february",
+  "federal",
+  "fee",
+  "feed",
+  "feel",
+  "female",
+  "fence",
+  "festival",
+  "fetch",
+  "fever",
+  "few",
+  "fiber",
+  "fiction",
+  "field",
+  "figure",
+  "file",
+  "film",
+  "filter",
+  "final",
+  "find",
+  "fine",
+  "finger",
+  "finish",
+  "fire",
+  "firm",
+  "first",
+  "fiscal",
+  "fish",
+  "fit",
+  "fitness",
+  "fix",
+  "flag",
+  "flame",
+  "flash",
+  "flat",
+  "flavor",
+  "flee",
+  "flight",
+  "flip",
+  "float",
+  "flock",
+  "floor",
+  "flower",
+  "fluid",
+  "flush",
+  "fly",
+  "foam",
+  "focus",
+  "fog",
+  "foil",
+  "fold",
+  "follow",
+  "food",
+  "foot",
+  "force",
+  "forest",
+  "forget",
+  "fork",
+  "fortune",
+  "forum",
+  "forward",
+  "fossil",
+  "foster",
+  "found",
+  "fox",
+  "fragile",
+  "frame",
+  "frequent",
+  "fresh",
+  "friend",
+  "fringe",
+  "frog",
+  "front",
+  "frost",
+  "frown",
+  "frozen",
+  "fruit",
+  "fuel",
+  "fun",
+  "funny",
+  "furnace",
+  "fury",
+  "future",
+  "gadget",
+  "gain",
+  "galaxy",
+  "gallery",
+  "game",
+  "gap",
+  "garage",
+  "garbage",
+  "garden",
+  "garlic",
+  "garment",
+  "gas",
+  "gasp",
+  "gate",
+  "gather",
+  "gauge",
+  "gaze",
+  "general",
+  "genius",
+  "genre",
+  "gentle",
+  "genuine",
+  "gesture",
+  "ghost",
+  "giant",
+  "gift",
+  "giggle",
+  "ginger",
+  "giraffe",
+  "girl",
+  "give",
+  "glad",
+  "glance",
+  "glare",
+  "glass",
+  "glide",
+  "glimpse",
+  "globe",
+  "gloom",
+  "glory",
+  "glove",
+  "glow",
+  "glue",
+  "goat",
+  "goddess",
+  "gold",
+  "good",
+  "goose",
+  "gorilla",
+  "gospel",
+  "gossip",
+  "govern",
+  "gown",
+  "grab",
+  "grace",
+  "grain",
+  "grant",
+  "grape",
+  "grass",
+  "gravity",
+  "great",
+  "green",
+  "grid",
+  "grief",
+  "grit",
+  "grocery",
+  "group",
+  "grow",
+  "grunt",
+  "guard",
+  "guess",
+  "guide",
+  "guilt",
+  "guitar",
+  "gun",
+  "gym",
+  "habit",
+  "hair",
+  "half",
+  "hammer",
+  "hamster",
+  "hand",
+  "happy",
+  "harbor",
+  "hard",
+  "harsh",
+  "harvest",
+  "hat",
+  "have",
+  "hawk",
+  "hazard",
+  "head",
+  "health",
+  "heart",
+  "heavy",
+  "hedgehog",
+  "height",
+  "hello",
+  "helmet",
+  "help",
+  "hen",
+  "hero",
+  "hidden",
+  "high",
+  "hill",
+  "hint",
+  "hip",
+  "hire",
+  "history",
+  "hobby",
+  "hockey",
+  "hold",
+  "hole",
+  "holiday",
+  "hollow",
+  "home",
+  "honey",
+  "hood",
+  "hope",
+  "horn",
+  "horror",
+  "horse",
+  "hospital",
+  "host",
+  "hotel",
+  "hour",
+  "hover",
+  "hub",
+  "huge",
+  "human",
+  "humble",
+  "humor",
+  "hundred",
+  "hungry",
+  "hunt",
+  "hurdle",
+  "hurry",
+  "hurt",
+  "husband",
+  "hybrid",
+  "ice",
+  "icon",
+  "idea",
+  "identify",
+  "idle",
+  "ignore",
+  "ill",
+  "illegal",
+  "illness",
+  "image",
+  "imitate",
+  "immense",
+  "immune",
+  "impact",
+  "impose",
+  "improve",
+  "impulse",
+  "inch",
+  "include",
+  "income",
+  "increase",
+  "index",
+  "indicate",
+  "indoor",
+  "industry",
+  "infant",
+  "inflict",
+  "inform",
+  "inhale",
+  "inherit",
+  "initial",
+  "inject",
+  "injury",
+  "inmate",
+  "inner",
+  "innocent",
+  "input",
+  "inquiry",
+  "insane",
+  "insect",
+  "inside",
+  "inspire",
+  "install",
+  "intact",
+  "interest",
+  "into",
+  "invest",
+  "invite",
+  "involve",
+  "iron",
+  "island",
+  "isolate",
+  "issue",
+  "item",
+  "ivory",
+  "jacket",
+  "jaguar",
+  "jar",
+  "jazz",
+  "jealous",
+  "jeans",
+  "jelly",
+  "jewel",
+  "job",
+  "join",
+  "joke",
+  "journey",
+  "joy",
+  "judge",
+  "juice",
+  "jump",
+  "jungle",
+  "junior",
+  "junk",
+  "just",
+  "kangaroo",
+  "keen",
+  "keep",
+  "ketchup",
+  "key",
+  "kick",
+  "kid",
+  "kidney",
+  "kind",
+  "kingdom",
+  "kiss",
+  "kit",
+  "kitchen",
+  "kite",
+  "kitten",
+  "kiwi",
+  "knee",
+  "knife",
+  "knock",
+  "know",
+  "lab",
+  "label",
+  "labor",
+  "ladder",
+  "lady",
+  "lake",
+  "lamp",
+  "language",
+  "laptop",
+  "large",
+  "later",
+  "latin",
+  "laugh",
+  "laundry",
+  "lava",
+  "law",
+  "lawn",
+  "lawsuit",
+  "layer",
+  "lazy",
+  "leader",
+  "leaf",
+  "learn",
+  "leave",
+  "lecture",
+  "left",
+  "leg",
+  "legal",
+  "legend",
+  "leisure",
+  "lemon",
+  "lend",
+  "length",
+  "lens",
+  "leopard",
+  "lesson",
+  "letter",
+  "level",
+  "liar",
+  "liberty",
+  "library",
+  "license",
+  "life",
+  "lift",
+  "light",
+  "like",
+  "limb",
+  "limit",
+  "link",
+  "lion",
+  "liquid",
+  "list",
+  "little",
+  "live",
+  "lizard",
+  "load",
+  "loan",
+  "lobster",
+  "local",
+  "lock",
+  "logic",
+  "lonely",
+  "long",
+  "loop",
+  "lottery",
+  "loud",
+  "lounge",
+  "love",
+  "loyal",
+  "lucky",
+  "luggage",
+  "lumber",
+  "lunar",
+  "lunch",
+  "luxury",
+  "lyrics",
+  "machine",
+  "mad",
+  "magic",
+  "magnet",
+  "maid",
+  "mail",
+  "main",
+  "major",
+  "make",
+  "mammal",
+  "man",
+  "manage",
+  "mandate",
+  "mango",
+  "mansion",
+  "manual",
+  "maple",
+  "marble",
+  "march",
+  "margin",
+  "marine",
+  "market",
+  "marriage",
+  "mask",
+  "mass",
+  "master",
+  "match",
+  "material",
+  "math",
+  "matrix",
+  "matter",
+  "maximum",
+  "maze",
+  "meadow",
+  "mean",
+  "measure",
+  "meat",
+  "mechanic",
+  "medal",
+  "media",
+  "melody",
+  "melt",
+  "member",
+  "memory",
+  "mention",
+  "menu",
+  "mercy",
+  "merge",
+  "merit",
+  "merry",
+  "mesh",
+  "message",
+  "metal",
+  "method",
+  "middle",
+  "midnight",
+  "milk",
+  "million",
+  "mimic",
+  "mind",
+  "minimum",
+  "minor",
+  "minute",
+  "miracle",
+  "mirror",
+  "misery",
+  "miss",
+  "mistake",
+  "mix",
+  "mixed",
+  "mixture",
+  "mobile",
+  "model",
+  "modify",
+  "mom",
+  "moment",
+  "monitor",
+  "monkey",
+  "monster",
+  "month",
+  "moon",
+  "moral",
+  "more",
+  "morning",
+  "mosquito",
+  "mother",
+  "motion",
+  "motor",
+  "mountain",
+  "mouse",
+  "move",
+  "movie",
+  "much",
+  "muffin",
+  "mule",
+  "multiply",
+  "muscle",
+  "museum",
+  "mushroom",
+  "music",
+  "must",
+  "mutual",
+  "myself",
+  "mystery",
+  "myth",
+  "naive",
+  "name",
+  "napkin",
+  "narrow",
+  "nasty",
+  "nation",
+  "nature",
+  "near",
+  "neck",
+  "need",
+  "negative",
+  "neglect",
+  "neither",
+  "nephew",
+  "nerve",
+  "nest",
+  "net",
+  "network",
+  "neutral",
+  "never",
+  "news",
+  "next",
+  "nice",
+  "night",
+  "noble",
+  "noise",
+  "nominee",
+  "noodle",
+  "normal",
+  "north",
+  "nose",
+  "notable",
+  "note",
+  "nothing",
+  "notice",
+  "novel",
+  "now",
+  "nuclear",
+  "number",
+  "nurse",
+  "nut",
+  "oak",
+  "obey",
+  "object",
+  "oblige",
+  "obscure",
+  "observe",
+  "obtain",
+  "obvious",
+  "occur",
+  "ocean",
+  "october",
+  "odor",
+  "off",
+  "offer",
+  "office",
+  "often",
+  "oil",
+  "okay",
+  "old",
+  "olive",
+  "olympic",
+  "omit",
+  "once",
+  "one",
+  "onion",
+  "online",
+  "only",
+  "open",
+  "opera",
+  "opinion",
+  "oppose",
+  "option",
+  "orange",
+  "orbit",
+  "orchard",
+  "order",
+  "ordinary",
+  "organ",
+  "orient",
+  "original",
+  "orphan",
+  "ostrich",
+  "other",
+  "outdoor",
+  "outer",
+  "output",
+  "outside",
+  "oval",
+  "oven",
+  "over",
+  "own",
+  "owner",
+  "oxygen",
+  "oyster",
+  "ozone",
+  "pact",
+  "paddle",
+  "page",
+  "pair",
+  "palace",
+  "palm",
+  "panda",
+  "panel",
+  "panic",
+  "panther",
+  "paper",
+  "parade",
+  "parent",
+  "park",
+  "parrot",
+  "party",
+  "pass",
+  "patch",
+  "path",
+  "patient",
+  "patrol",
+  "pattern",
+  "pause",
+  "pave",
+  "payment",
+  "peace",
+  "peanut",
+  "pear",
+  "peasant",
+  "pelican",
+  "pen",
+  "penalty",
+  "pencil",
+  "people",
+  "pepper",
+  "perfect",
+  "permit",
+  "person",
+  "pet",
+  "phone",
+  "photo",
+  "phrase",
+  "physical",
+  "piano",
+  "picnic",
+  "picture",
+  "piece",
+  "pig",
+  "pigeon",
+  "pill",
+  "pilot",
+  "pink",
+  "pioneer",
+  "pipe",
+  "pistol",
+  "pitch",
+  "pizza",
+  "place",
+  "planet",
+  "plastic",
+  "plate",
+  "play",
+  "please",
+  "pledge",
+  "pluck",
+  "plug",
+  "plunge",
+  "poem",
+  "poet",
+  "point",
+  "polar",
+  "pole",
+  "police",
+  "pond",
+  "pony",
+  "pool",
+  "popular",
+  "portion",
+  "position",
+  "possible",
+  "post",
+  "potato",
+  "pottery",
+  "poverty",
+  "powder",
+  "power",
+  "practice",
+  "praise",
+  "predict",
+  "prefer",
+  "prepare",
+  "present",
+  "pretty",
+  "prevent",
+  "price",
+  "pride",
+  "primary",
+  "print",
+  "priority",
+  "prison",
+  "private",
+  "prize",
+  "problem",
+  "process",
+  "produce",
+  "profit",
+  "program",
+  "project",
+  "promote",
+  "proof",
+  "property",
+  "prosper",
+  "protect",
+  "proud",
+  "provide",
+  "public",
+  "pudding",
+  "pull",
+  "pulp",
+  "pulse",
+  "pumpkin",
+  "punch",
+  "pupil",
+  "puppy",
+  "purchase",
+  "purity",
+  "purpose",
+  "purse",
+  "push",
+  "put",
+  "puzzle",
+  "pyramid",
+  "quality",
+  "quantum",
+  "quarter",
+  "question",
+  "quick",
+  "quit",
+  "quiz",
+  "quote",
+  "rabbit",
+  "raccoon",
+  "race",
+  "rack",
+  "radar",
+  "radio",
+  "rail",
+  "rain",
+  "raise",
+  "rally",
+  "ramp",
+  "ranch",
+  "random",
+  "range",
+  "rapid",
+  "rare",
+  "rate",
+  "rather",
+  "raven",
+  "raw",
+  "razor",
+  "ready",
+  "real",
+  "reason",
+  "rebel",
+  "rebuild",
+  "recall",
+  "receive",
+  "recipe",
+  "record",
+  "recycle",
+  "reduce",
+  "reflect",
+  "reform",
+  "refuse",
+  "region",
+  "regret",
+  "regular",
+  "reject",
+  "relax",
+  "release",
+  "relief",
+  "rely",
+  "remain",
+  "remember",
+  "remind",
+  "remove",
+  "render",
+  "renew",
+  "rent",
+  "reopen",
+  "repair",
+  "repeat",
+  "replace",
+  "report",
+  "require",
+  "rescue",
+  "resemble",
+  "resist",
+  "resource",
+  "response",
+  "result",
+  "retire",
+  "retreat",
+  "return",
+  "reunion",
+  "reveal",
+  "review",
+  "reward",
+  "rhythm",
+  "rib",
+  "ribbon",
+  "rice",
+  "rich",
+  "ride",
+  "ridge",
+  "rifle",
+  "right",
+  "rigid",
+  "ring",
+  "riot",
+  "ripple",
+  "risk",
+  "ritual",
+  "rival",
+  "river",
+  "road",
+  "roast",
+  "robot",
+  "robust",
+  "rocket",
+  "romance",
+  "roof",
+  "rookie",
+  "room",
+  "rose",
+  "rotate",
+  "rough",
+  "round",
+  "route",
+  "royal",
+  "rubber",
+  "rude",
+  "rug",
+  "rule",
+  "run",
+  "runway",
+  "rural",
+  "sad",
+  "saddle",
+  "sadness",
+  "safe",
+  "sail",
+  "salad",
+  "salmon",
+  "salon",
+  "salt",
+  "salute",
+  "same",
+  "sample",
+  "sand",
+  "satisfy",
+  "satoshi",
+  "sauce",
+  "sausage",
+  "save",
+  "say",
+  "scale",
+  "scan",
+  "scare",
+  "scatter",
+  "scene",
+  "scheme",
+  "school",
+  "science",
+  "scissors",
+  "scorpion",
+  "scout",
+  "scrap",
+  "screen",
+  "script",
+  "scrub",
+  "sea",
+  "search",
+  "season",
+  "seat",
+  "second",
+  "secret",
+  "section",
+  "security",
+  "seed",
+  "seek",
+  "segment",
+  "select",
+  "sell",
+  "seminar",
+  "senior",
+  "sense",
+  "sentence",
+  "series",
+  "service",
+  "session",
+  "settle",
+  "setup",
+  "seven",
+  "shadow",
+  "shaft",
+  "shallow",
+  "share",
+  "shed",
+  "shell",
+  "sheriff",
+  "shield",
+  "shift",
+  "shine",
+  "ship",
+  "shiver",
+  "shock",
+  "shoe",
+  "shoot",
+  "shop",
+  "short",
+  "shoulder",
+  "shove",
+  "shrimp",
+  "shrug",
+  "shuffle",
+  "shy",
+  "sibling",
+  "sick",
+  "side",
+  "siege",
+  "sight",
+  "sign",
+  "silent",
+  "silk",
+  "silly",
+  "silver",
+  "similar",
+  "simple",
+  "since",
+  "sing",
+  "siren",
+  "sister",
+  "situate",
+  "six",
+  "size",
+  "skate",
+  "sketch",
+  "ski",
+  "skill",
+  "skin",
+  "skirt",
+  "skull",
+  "slab",
+  "slam",
+  "sleep",
+  "slender",
+  "slice",
+  "slide",
+  "slight",
+  "slim",
+  "slogan",
+  "slot",
+  "slow",
+  "slush",
+  "small",
+  "smart",
+  "smile",
+  "smoke",
+  "smooth",
+  "snack",
+  "snake",
+  "snap",
+  "sniff",
+  "snow",
+  "soap",
+  "soccer",
+  "social",
+  "sock",
+  "soda",
+  "soft",
+  "solar",
+  "soldier",
+  "solid",
+  "solution",
+  "solve",
+  "someone",
+  "song",
+  "soon",
+  "sorry",
+  "sort",
+  "soul",
+  "sound",
+  "soup",
+  "source",
+  "south",
+  "space",
+  "spare",
+  "spatial",
+  "spawn",
+  "speak",
+  "special",
+  "speed",
+  "spell",
+  "spend",
+  "sphere",
+  "spice",
+  "spider",
+  "spike",
+  "spin",
+  "spirit",
+  "split",
+  "spoil",
+  "sponsor",
+  "spoon",
+  "sport",
+  "spot",
+  "spray",
+  "spread",
+  "spring",
+  "spy",
+  "square",
+  "squeeze",
+  "squirrel",
+  "stable",
+  "stadium",
+  "staff",
+  "stage",
+  "stairs",
+  "stamp",
+  "stand",
+  "start",
+  "state",
+  "stay",
+  "steak",
+  "steel",
+  "stem",
+  "step",
+  "stereo",
+  "stick",
+  "still",
+  "sting",
+  "stock",
+  "stomach",
+  "stone",
+  "stool",
+  "story",
+  "stove",
+  "strategy",
+  "street",
+  "strike",
+  "strong",
+  "struggle",
+  "student",
+  "stuff",
+  "stumble",
+  "style",
+  "subject",
+  "submit",
+  "subway",
+  "success",
+  "such",
+  "sudden",
+  "suffer",
+  "sugar",
+  "suggest",
+  "suit",
+  "summer",
+  "sun",
+  "sunny",
+  "sunset",
+  "super",
+  "supply",
+  "supreme",
+  "sure",
+  "surface",
+  "surge",
+  "surprise",
+  "surround",
+  "survey",
+  "suspect",
+  "sustain",
+  "swallow",
+  "swamp",
+  "swap",
+  "swarm",
+  "swear",
+  "sweet",
+  "swift",
+  "swim",
+  "swing",
+  "switch",
+  "sword",
+  "symbol",
+  "symptom",
+  "syrup",
+  "system",
+  "table",
+  "tackle",
+  "tag",
+  "tail",
+  "talent",
+  "talk",
+  "tank",
+  "tape",
+  "target",
+  "task",
+  "taste",
+  "tattoo",
+  "taxi",
+  "teach",
+  "team",
+  "tell",
+  "ten",
+  "tenant",
+  "tennis",
+  "tent",
+  "term",
+  "test",
+  "text",
+  "thank",
+  "that",
+  "theme",
+  "then",
+  "theory",
+  "there",
+  "they",
+  "thing",
+  "this",
+  "thought",
+  "three",
+  "thrive",
+  "throw",
+  "thumb",
+  "thunder",
+  "ticket",
+  "tide",
+  "tiger",
+  "tilt",
+  "timber",
+  "time",
+  "tiny",
+  "tip",
+  "tired",
+  "tissue",
+  "title",
+  "toast",
+  "tobacco",
+  "today",
+  "toddler",
+  "toe",
+  "together",
+  "toilet",
+  "token",
+  "tomato",
+  "tomorrow",
+  "tone",
+  "tongue",
+  "tonight",
+  "tool",
+  "tooth",
+  "top",
+  "topic",
+  "topple",
+  "torch",
+  "tornado",
+  "tortoise",
+  "toss",
+  "total",
+  "tourist",
+  "toward",
+  "tower",
+  "town",
+  "toy",
+  "track",
+  "trade",
+  "traffic",
+  "tragic",
+  "train",
+  "transfer",
+  "trap",
+  "trash",
+  "travel",
+  "tray",
+  "treat",
+  "tree",
+  "trend",
+  "trial",
+  "tribe",
+  "trick",
+  "trigger",
+  "trim",
+  "trip",
+  "trophy",
+  "trouble",
+  "truck",
+  "true",
+  "truly",
+  "trumpet",
+  "trust",
+  "truth",
+  "try",
+  "tube",
+  "tuition",
+  "tumble",
+  "tuna",
+  "tunnel",
+  "turkey",
+  "turn",
+  "turtle",
+  "twelve",
+  "twenty",
+  "twice",
+  "twin",
+  "twist",
+  "two",
+  "type",
+  "typical",
+  "ugly",
+  "umbrella",
+  "unable",
+  "unaware",
+  "uncle",
+  "uncover",
+  "under",
+  "undo",
+  "unfair",
+  "unfold",
+  "unhappy",
+  "uniform",
+  "unique",
+  "unit",
+  "universe",
+  "unknown",
+  "unlock",
+  "until",
+  "unusual",
+  "unveil",
+  "update",
+  "upgrade",
+  "uphold",
+  "upon",
+  "upper",
+  "upset",
+  "urban",
+  "urge",
+  "usage",
+  "use",
+  "used",
+  "useful",
+  "useless",
+  "usual",
+  "utility",
+  "vacant",
+  "vacuum",
+  "vague",
+  "valid",
+  "valley",
+  "valve",
+  "van",
+  "vanish",
+  "vapor",
+  "various",
+  "vast",
+  "vault",
+  "vehicle",
+  "velvet",
+  "vendor",
+  "venture",
+  "venue",
+  "verb",
+  "verify",
+  "version",
+  "very",
+  "vessel",
+  "veteran",
+  "viable",
+  "vibrant",
+  "vicious",
+  "victory",
+  "video",
+  "view",
+  "village",
+  "vintage",
+  "violin",
+  "virtual",
+  "virus",
+  "visa",
+  "visit",
+  "visual",
+  "vital",
+  "vivid",
+  "vocal",
+  "voice",
+  "void",
+  "volcano",
+  "volume",
+  "vote",
+  "voyage",
+  "wage",
+  "wagon",
+  "wait",
+  "walk",
+  "wall",
+  "walnut",
+  "want",
+  "warfare",
+  "warm",
+  "warrior",
+  "wash",
+  "wasp",
+  "waste",
+  "water",
+  "wave",
+  "way",
+  "wealth",
+  "weapon",
+  "wear",
+  "weasel",
+  "weather",
+  "web",
+  "wedding",
+  "weekend",
+  "weird",
+  "welcome",
+  "west",
+  "wet",
+  "whale",
+  "what",
+  "wheat",
+  "wheel",
+  "when",
+  "where",
+  "whip",
+  "whisper",
+  "wide",
+  "width",
+  "wife",
+  "wild",
+  "will",
+  "win",
+  "window",
+  "wine",
+  "wing",
+  "wink",
+  "winner",
+  "winter",
+  "wire",
+  "wisdom",
+  "wise",
+  "wish",
+  "witness",
+  "wolf",
+  "woman",
+  "wonder",
+  "wood",
+  "wool",
+  "word",
+  "work",
+  "world",
+  "worry",
+  "worth",
+  "wrap",
+  "wreck",
+  "wrestle",
+  "wrist",
+  "write",
+  "wrong",
+  "yard",
+  "year",
+  "yellow",
+  "you",
+  "young",
+  "youth",
+  "zebra",
+  "zero",
+  "zone",
+  "zoo",
+};
+
+#endif
diff --git a/vendor/src/buffer/buffer.c b/vendor/src/buffer/buffer.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/buffer/buffer.c
@@ -0,0 +1,1672 @@
+/**
+ * \file buffer.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "../endian.h"
+
+#include <cardano/buffer.h>
+#include <cardano/export.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <math.h>
+#include <sodium.h>
+#include <string.h>
+
+#include "../config.h"
+
+/* STRUCTS *******************************************************************/
+
+/**
+ * \struct cardano_buffer_t
+ * \brief Represents a dynamically sized buffer for storing binary data.
+ *
+ * This structure is designed to manage a variable-sized sequence of bytes, providing mechanisms
+ * for dynamically resizing the buffer as necessary. It is built on top of \c cardano_object_t,
+ * inheriting reference counting and basic object management functionalities.
+ */
+typedef struct cardano_buffer_t
+{
+    cardano_object_t base;
+    byte_t*          data;
+    size_t           size;
+    size_t           head;
+    size_t           capacity;
+} cardano_buffer_t;
+
+/* STATIC FUNCTIONS ***********************************************************/
+
+/**
+ * \brief Grows the buffer if there is not enough capacity to hold the new data.
+ *
+ * \param[in] buffer The buffer to grow.
+ * \param[in] size_of_new_data The size of new data to be written into the buffer.
+ *
+ * \return A \c cardano_error_t indicating the result of the operation: \c CARDANO_SUCCESS on success,
+ *         or an appropriate error code indicating the failure reason. Refer to \c cardano_error_t documentation
+ *         for details on possible error codes.
+ */
+static cardano_error_t
+grow_buffer_if_needed(cardano_buffer_t* buffer, const size_t size_of_new_data)
+{
+  assert(buffer != NULL);
+
+  if ((buffer->size + size_of_new_data) >= buffer->capacity)
+  {
+    size_t  new_capacity = (size_t)ceil((float)((float)buffer->size + (float)size_of_new_data) * (float)LIB_CARDANO_C_COLLECTION_GROW_FACTOR);
+    byte_t* new_data     = (byte_t*)_cardano_realloc(buffer->data, new_capacity);
+
+    if (new_data == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    buffer->data     = new_data;
+    buffer->capacity = new_capacity;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Deallocates a buffer object.
+ *
+ * This function is responsible for properly deallocating a buffer object (`cardano_buffer_t`)
+ * and its associated resources.
+ *
+ * \param[in] object A void pointer to the buffer object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_buffer_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the buffer
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_buffer_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_buffer_t* buffer = (cardano_buffer_t*)object;
+
+  if (buffer->data != NULL)
+  {
+    _cardano_free(buffer->data);
+    buffer->data = NULL;
+  }
+
+  _cardano_free(buffer);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_buffer_t*
+cardano_buffer_new(const size_t capacity)
+{
+  cardano_buffer_t* buffer = (cardano_buffer_t*)_cardano_malloc(sizeof(cardano_buffer_t));
+
+  if (buffer == NULL)
+  {
+    return NULL;
+  }
+
+  buffer->data = (byte_t*)_cardano_malloc(capacity);
+
+  if (buffer->data == NULL)
+  {
+    _cardano_free(buffer);
+    return NULL;
+  }
+
+  buffer->size               = 0;
+  buffer->head               = 0;
+  buffer->capacity           = capacity;
+  buffer->base.ref_count     = 1;
+  buffer->base.last_error[0] = '\0';
+  buffer->base.deallocator   = cardano_buffer_deallocate;
+
+  return buffer;
+}
+
+cardano_buffer_t*
+cardano_buffer_new_from(const byte_t* array, const size_t size)
+{
+  if (array == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_buffer_t* buffer = (cardano_buffer_t*)_cardano_malloc(sizeof(cardano_buffer_t));
+
+  if (buffer == NULL)
+  {
+    return NULL;
+  }
+
+  buffer->data = (byte_t*)_cardano_malloc(size);
+
+  if (buffer->data == NULL)
+  {
+    _cardano_free(buffer);
+    return NULL;
+  }
+
+  cardano_safe_memcpy(buffer->data, size, array, size);
+
+  buffer->size               = size;
+  buffer->head               = 0;
+  buffer->capacity           = buffer->size;
+  buffer->base.ref_count     = 1;
+  buffer->base.last_error[0] = '\0';
+  buffer->base.deallocator   = cardano_buffer_deallocate;
+
+  return buffer;
+}
+
+cardano_buffer_t*
+cardano_buffer_concat(const cardano_buffer_t* lhs, const cardano_buffer_t* rhs)
+{
+  if (lhs == NULL)
+  {
+    return NULL;
+  }
+
+  if (rhs == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_buffer_t* buffer = (cardano_buffer_t*)_cardano_malloc(sizeof(cardano_buffer_t));
+
+  if (buffer == NULL)
+  {
+    return NULL;
+  }
+
+  buffer->data = (byte_t*)_cardano_malloc(lhs->size + rhs->size);
+
+  if (buffer->data == NULL)
+  {
+    _cardano_free(buffer);
+    return NULL;
+  }
+
+  cardano_safe_memcpy(buffer->data, lhs->size + rhs->size, lhs->data, lhs->size);
+  cardano_safe_memcpy(&buffer->data[lhs->size], rhs->size, rhs->data, rhs->size);
+
+  buffer->size               = lhs->size + rhs->size;
+  buffer->head               = 0;
+  buffer->capacity           = buffer->size;
+  buffer->base.ref_count     = 1;
+  buffer->base.last_error[0] = '\0';
+  buffer->base.deallocator   = cardano_buffer_deallocate;
+
+  return buffer;
+}
+
+cardano_buffer_t*
+cardano_buffer_slice(const cardano_buffer_t* buffer, size_t start, size_t end)
+{
+  if (buffer == NULL)
+  {
+    return NULL;
+  }
+
+  if (start > buffer->size)
+  {
+    return NULL;
+  }
+
+  if (end > buffer->size)
+  {
+    return NULL;
+  }
+
+  if (end < start)
+  {
+    return NULL;
+  }
+
+  size_t slice_size = end - start;
+
+  if (slice_size == 0U)
+  {
+    return cardano_buffer_new(1U);
+  }
+
+  byte_t* slice_data = (byte_t*)_cardano_malloc(slice_size);
+
+  if (slice_data == NULL)
+  {
+    return NULL;
+  }
+
+  assert(buffer->data != NULL);
+
+  cardano_safe_memcpy(slice_data, slice_size, &buffer->data[start], slice_size);
+
+  cardano_buffer_t* sliced_buffer = (cardano_buffer_t*)_cardano_malloc(sizeof(cardano_buffer_t));
+
+  if (sliced_buffer == NULL)
+  {
+    _cardano_free(slice_data);
+    return NULL;
+  }
+
+  sliced_buffer->data               = slice_data;
+  sliced_buffer->size               = slice_size;
+  sliced_buffer->head               = 0;
+  sliced_buffer->capacity           = sliced_buffer->size;
+  sliced_buffer->base.ref_count     = 1;
+  sliced_buffer->base.last_error[0] = '\0';
+  sliced_buffer->base.deallocator   = cardano_buffer_deallocate;
+
+  return sliced_buffer;
+}
+
+cardano_buffer_t*
+cardano_buffer_from_hex(const char* hex_string, const size_t size)
+{
+  if (hex_string == NULL)
+  {
+    return NULL;
+  }
+
+  if ((size % 2U) != 0U)
+  {
+    return NULL;
+  }
+
+  cardano_buffer_t* buffer = (cardano_buffer_t*)_cardano_malloc(sizeof(cardano_buffer_t));
+
+  if (buffer == NULL)
+  {
+    return NULL;
+  }
+
+  buffer->data               = (byte_t*)_cardano_malloc(size / 2U);
+  buffer->size               = size / 2U;
+  buffer->head               = 0;
+  buffer->capacity           = buffer->size;
+  buffer->base.ref_count     = 1;
+  buffer->base.last_error[0] = '\0';
+  buffer->base.deallocator   = cardano_buffer_deallocate;
+
+  if (buffer->data == NULL)
+  {
+    _cardano_free(buffer);
+    return NULL;
+  }
+
+  const char* end = NULL;
+
+  int init_result = sodium_init();
+
+  if (init_result == -1)
+  {
+    cardano_buffer_unref(&buffer);
+    return NULL;
+  }
+
+  int decode_result = sodium_hex2bin(buffer->data, size, hex_string, size, NULL, NULL, &end);
+
+  if (decode_result != 0)
+  {
+    cardano_buffer_unref(&buffer);
+    return NULL;
+  }
+
+  return buffer;
+}
+
+size_t
+cardano_buffer_get_hex_size(const cardano_buffer_t* buffer)
+{
+  static const size_t null_termination_size = 1;
+  static const size_t byte_size_in_hex      = 2;
+
+  if (buffer == NULL)
+  {
+    return 0;
+  }
+
+  return (buffer->size * byte_size_in_hex) + null_termination_size;
+}
+
+cardano_error_t
+cardano_buffer_to_hex(const cardano_buffer_t* buffer, char* dest, const size_t dest_size)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (dest == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t hex_string_size = cardano_buffer_get_hex_size(buffer);
+
+  if (dest_size < hex_string_size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  int init_result = sodium_init();
+
+  if (init_result == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  assert(buffer->data != NULL);
+
+  if (sodium_bin2hex(dest, dest_size, buffer->data, buffer->size) < 0)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_buffer_get_str_size(const cardano_buffer_t* buffer)
+{
+  static const size_t null_termination_size = 1;
+
+  if (buffer == NULL)
+  {
+    return 0;
+  }
+
+  return buffer->size + null_termination_size;
+}
+
+cardano_error_t
+cardano_buffer_to_str(const cardano_buffer_t* buffer, char* dest, const size_t dest_size)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (dest == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t string_size = cardano_buffer_get_str_size(buffer);
+
+  if (dest_size < string_size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  assert(buffer->data != NULL);
+
+  cardano_safe_memcpy(dest, dest_size, buffer->data, buffer->size);
+
+  dest[buffer->size] = '\0';
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_buffer_equals(const cardano_buffer_t* lhs, const cardano_buffer_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->size != rhs->size)
+  {
+    return false;
+  }
+
+  if (lhs->size == 0U)
+  {
+    return true;
+  }
+
+  assert(lhs->data != NULL);
+  assert(rhs->data != NULL);
+
+  return (memcmp(lhs->data, rhs->data, lhs->size) == 0);
+}
+
+int32_t
+cardano_buffer_compare(const cardano_buffer_t* lhs, const cardano_buffer_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return 0;
+  }
+
+  if (lhs == NULL)
+  {
+    return -1;
+  }
+
+  if (rhs == NULL)
+  {
+    return 1;
+  }
+
+  if (lhs->size < rhs->size)
+  {
+    return -1;
+  }
+
+  if (lhs->size > rhs->size)
+  {
+    return 1;
+  }
+
+  if (lhs->size == 0U)
+  {
+    return 0;
+  }
+
+  assert(lhs->data != NULL);
+  assert(rhs->data != NULL);
+
+  return memcmp(lhs->data, rhs->data, lhs->size);
+}
+
+void
+cardano_buffer_unref(cardano_buffer_t** buffer)
+{
+  if ((buffer == NULL) || (*buffer == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*buffer)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *buffer = NULL;
+    return;
+  }
+}
+
+void
+cardano_buffer_ref(cardano_buffer_t* buffer)
+{
+  if (buffer == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&buffer->base);
+}
+
+size_t
+cardano_buffer_refcount(const cardano_buffer_t* buffer)
+{
+  if (buffer == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&buffer->base);
+}
+
+byte_t*
+cardano_buffer_get_data(const cardano_buffer_t* buffer)
+{
+  if (buffer == NULL)
+  {
+    return NULL;
+  }
+
+  return buffer->data;
+}
+
+void
+cardano_buffer_memzero(cardano_buffer_t* buffer)
+{
+  if (buffer == NULL)
+  {
+    return;
+  }
+
+  if (buffer->data == NULL)
+  {
+    return;
+  }
+
+  sodium_memzero(buffer->data, buffer->size);
+}
+
+size_t
+cardano_buffer_get_size(const cardano_buffer_t* buffer)
+{
+  if (buffer == NULL)
+  {
+    return 0;
+  }
+
+  return buffer->size;
+}
+
+cardano_error_t
+cardano_buffer_copy_bytes(const cardano_buffer_t* buffer, byte_t* dest, const size_t dest_size)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (dest == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (dest_size == 0U)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_WRITE;
+  }
+
+  size_t data_length = cardano_buffer_get_size(buffer);
+
+  if (data_length > dest_size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_WRITE;
+  }
+
+  cardano_safe_memcpy(dest, dest_size, cardano_buffer_get_data(buffer), data_length);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_set_size(cardano_buffer_t* buffer, const size_t size)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size > buffer->capacity)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_WRITE;
+  }
+
+  buffer->size = size;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_buffer_get_capacity(const cardano_buffer_t* buffer)
+{
+  if (buffer == NULL)
+  {
+    return 0;
+  }
+
+  return buffer->capacity;
+}
+
+cardano_error_t
+cardano_buffer_seek(cardano_buffer_t* buffer, size_t position)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (position > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  buffer->head = position;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write(cardano_buffer_t* buffer, const byte_t* data, const size_t size)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, size);
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  cardano_safe_memcpy(&buffer->data[buffer->size], buffer->capacity - buffer->size, data, size);
+
+  buffer->size += size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read(cardano_buffer_t* buffer, byte_t* data, const size_t bytes_to_read)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((buffer->head + bytes_to_read) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_safe_memcpy(data, bytes_to_read, &buffer->data[buffer->head], bytes_to_read);
+
+  buffer->head += bytes_to_read;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_uint16_le(cardano_buffer_t* buffer, const uint16_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_uint16_le(value, buffer->data, sizeof(value), buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_uint32_le(cardano_buffer_t* buffer, const uint32_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_uint32_le(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_uint64_le(cardano_buffer_t* buffer, const uint64_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_uint64_le(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_int16_le(cardano_buffer_t* buffer, const int16_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_int16_le(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_int32_le(cardano_buffer_t* buffer, const int32_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_int32_le(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_int64_le(cardano_buffer_t* buffer, const int64_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_int64_le(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_float_le(cardano_buffer_t* buffer, const float value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_float_le(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_double_le(cardano_buffer_t* buffer, const double value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_double_le(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_uint16_be(cardano_buffer_t* buffer, const uint16_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_uint16_be(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_uint32_be(cardano_buffer_t* buffer, const uint32_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_uint32_be(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_uint64_be(cardano_buffer_t* buffer, const uint64_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_uint64_be(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_int16_be(cardano_buffer_t* buffer, const int16_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_int16_be(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_int32_be(cardano_buffer_t* buffer, const int32_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_int32_be(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_int64_be(cardano_buffer_t* buffer, const int64_t value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_int64_be(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_float_be(cardano_buffer_t* buffer, const float value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_float_be(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_write_double_be(cardano_buffer_t* buffer, const double value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t          type_size   = sizeof(value);
+  const cardano_error_t grow_result = grow_buffer_if_needed(buffer, sizeof(value));
+
+  if (grow_result != CARDANO_SUCCESS)
+  {
+    return grow_result;
+  }
+
+  const cardano_error_t write_result = cardano_write_double_be(value, buffer->data, buffer->capacity, buffer->size);
+
+  CARDANO_UNUSED(write_result);
+  assert(write_result == CARDANO_SUCCESS);
+
+  buffer->size += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_uint16_le(cardano_buffer_t* buffer, uint16_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(uint16_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_uint16_le(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_uint32_le(cardano_buffer_t* buffer, uint32_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(uint32_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_uint32_le(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_uint64_le(cardano_buffer_t* buffer, uint64_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(uint64_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_uint64_le(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_int16_le(cardano_buffer_t* buffer, int16_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(int16_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_int16_le(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_int32_le(cardano_buffer_t* buffer, int32_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(int32_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_int32_le(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_int64_le(cardano_buffer_t* buffer, int64_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(int64_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_int64_le(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_float_le(cardano_buffer_t* buffer, float* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(float);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_float_le(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_double_le(cardano_buffer_t* buffer, double* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(double);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_double_le(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_uint16_be(cardano_buffer_t* buffer, uint16_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(uint16_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_uint16_be(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_uint32_be(cardano_buffer_t* buffer, uint32_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(uint32_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_uint32_be(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_uint64_be(cardano_buffer_t* buffer, uint64_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(uint64_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_uint64_be(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_int16_be(cardano_buffer_t* buffer, int16_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(int16_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_int16_be(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_int32_be(cardano_buffer_t* buffer, int32_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(int32_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_int32_be(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_int64_be(cardano_buffer_t* buffer, int64_t* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(int64_t);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_int64_be(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_float_be(cardano_buffer_t* buffer, float* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(float);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_float_be(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_buffer_read_double_be(cardano_buffer_t* buffer, double* value)
+{
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t type_size = sizeof(double);
+
+  if ((buffer->head + type_size) > buffer->size)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_error_t result = cardano_read_double_be(value, buffer->data, buffer->size, buffer->head);
+
+  CARDANO_UNUSED(result);
+  assert(result == CARDANO_SUCCESS);
+
+  buffer->head += type_size;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_buffer_set_last_error(cardano_buffer_t* buffer, const char* message)
+{
+  cardano_object_set_last_error(&buffer->base, message);
+}
+
+const char*
+cardano_buffer_get_last_error(const cardano_buffer_t* buffer)
+{
+  return cardano_object_get_last_error(&buffer->base);
+}
+
+cardano_error_t
+cardano_buffer_deep_clone(const cardano_buffer_t* source, cardano_buffer_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* copy = _cardano_malloc(sizeof(cardano_buffer_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->data               = NULL;
+  copy->size               = source->size;
+  copy->head               = source->head;
+  copy->capacity           = source->capacity;
+
+  if (source->data != NULL)
+  {
+    const size_t size = source->capacity;
+
+    copy->data = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->data == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->data, source->data, source->size));
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/cardano.c b/vendor/src/cardano.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cardano.c
@@ -0,0 +1,47 @@
+/**
+ * \file cardano.c
+ *
+ * \author angel.castillo
+ * \date   Mar 13, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cardano.h>
+
+#include "./config.h"
+#include <sodium.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_get_lib_version(void)
+{
+  // cppcheck-suppress misra-c2012-7.4; Reason: Returning pointer to const literal; no modification possible.
+  return LIB_CARDANO_C_VERSION;
+}
+
+void
+cardano_memzero(void* const buffer, size_t size)
+{
+  if ((buffer == NULL) || (size == 0U))
+  {
+    return;
+  }
+
+  sodium_memzero(buffer, size);
+}
diff --git a/vendor/src/cbor/cbor_additional_info.h b/vendor/src/cbor/cbor_additional_info.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_additional_info.h
@@ -0,0 +1,86 @@
+/**
+ * \file cbor_additional_info.h
+ *
+ * \author angel.castillo
+ * \date   Sep 29, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_ADDITIONAL_INFO_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_ADDITIONAL_INFO_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents the 5-bit additional information included in a CBOR initial byte.
+ *
+ * The CBOR encoding format specifies an initial byte for each data item that includes both the major type
+ * and additional information. The additional information field is a 5-bit value that can indicate a variety
+ * of things depending on the context, such as the length of the data, special values like `false`, `true`,
+ * `null`, or the need for more bytes to represent the data length.
+ */
+typedef enum
+{
+  /**
+   * \brief Indicates the boolean value `false` (major type 7).
+   */
+  CARDANO_CBOR_ADDITIONAL_INFO_FALSE = 20,
+
+  /**
+   * \brief Indicates the boolean value `true` (major type 7).
+   */
+  CARDANO_CBOR_ADDITIONAL_INFO_TRUE = 21,
+
+  /**
+   * \brief Indicates the value `null` (major type 7).
+   */
+  CARDANO_CBOR_ADDITIONAL_INFO_NULL = 22,
+
+  /**
+   * \brief Indicates that the next byte contains the length of the data (major types 0-2, 4-5).
+   */
+  CARDANO_CBOR_ADDITIONAL_INFO_8BIT_DATA = 24,
+
+  /**
+   * \brief Indicates that the next 2 bytes contain the length of the data (major types 0-2, 4-5).
+   */
+  CARDANO_CBOR_ADDITIONAL_INFO_16BIT_DATA = 25,
+
+  /**
+   * \brief Indicates that the next 4 bytes contain the length of the data (major types 0-2, 4-5).
+   */
+  CARDANO_CBOR_ADDITIONAL_INFO_32BIT_DATA = 26,
+
+  /**
+   * \brief Indicates that the next 8 bytes contain the length of the data (major types 0-2, 4-5).
+   */
+  CARDANO_CBOR_ADDITIONAL_INFO_64BIT_DATA = 27,
+
+  /**
+   * \brief Indicates that the data item is of indefinite length (major types 2, 3, 4, 5).
+   */
+  CARDANO_CBOR_ADDITIONAL_INFO_INDEFINITE_LENGTH = 31
+} cardano_cbor_additional_info_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_ADDITIONAL_INFO_H
diff --git a/vendor/src/cbor/cbor_initial_byte.c b/vendor/src/cbor/cbor_initial_byte.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_initial_byte.c
@@ -0,0 +1,50 @@
+/**
+ * \file cbor_initial_byte.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "./cbor_initial_byte.h"
+
+#include <cardano/object.h>
+
+#include <stdlib.h>
+
+#include "../config.h"
+
+/* DEFINITIONS ****************************************************************/
+
+byte_t
+cardano_cbor_initial_byte_pack(const cardano_cbor_major_type_t major_type, const cardano_cbor_additional_info_t additional_info)
+{
+  return (byte_t)(((byte_t)major_type << 5) | (byte_t)additional_info);
+}
+
+cardano_cbor_major_type_t
+cardano_cbor_initial_byte_get_major_type(const byte_t initial_byte)
+{
+  return (cardano_cbor_major_type_t)(initial_byte >> 5);
+}
+
+cardano_cbor_additional_info_t
+cardano_cbor_initial_byte_get_additional_info(const byte_t initial_byte)
+{
+  return (cardano_cbor_additional_info_t)initial_byte & (cardano_cbor_additional_info_t)0x1F;
+}
diff --git a/vendor/src/cbor/cbor_initial_byte.h b/vendor/src/cbor/cbor_initial_byte.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_initial_byte.h
@@ -0,0 +1,89 @@
+/**
+ * \file cbor_initial_byte.h
+ *
+ * \author angel.castillo
+ * \date   Sep 29, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_INITIAL_BYTE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_INITIAL_BYTE_H
+
+/* INCLUDES ******************************************************************/
+
+#include "cbor_additional_info.h"
+#include <cardano/cbor/cbor_major_type.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Creates a new CBOR initial byte by packing the major type and additional information.
+ *
+ * Combines a CBOR major type and additional information into a single initial byte according to the
+ * CBOR encoding rules. This initial byte is used at the start of a CBOR encoded data item to indicate
+ * the type of the item and provide additional context about its size or value.
+ *
+ * \param[in] major_type Major type of the CBOR data item, indicating the broad category of the data
+ *                       (e.g., unsigned integer, byte string, array).
+ * \param[in] additional_info Additional information providing further details about the data item, such
+ *                            as its size or special values like `false`, `true`, `null`.
+ *
+ * \return The packed CBOR initial byte combining both the major type and additional information.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT byte_t cardano_cbor_initial_byte_pack(cardano_cbor_major_type_t major_type, cardano_cbor_additional_info_t additional_info);
+
+/**
+ * \brief Retrieves the major type from a CBOR initial byte.
+ *
+ * Extracts the major type from a given CBOR initial byte. The major type defines the high-level
+ * data type of a CBOR data item, such as unsigned integer, byte string, array, etc. This function
+ * parses the initial byte to identify and return the major type it represents.
+ *
+ * \param[in] initial_byte The CBOR initial byte from which to extract the major type.
+ *
+ * \return The extracted major type of the CBOR data item, as defined by the CBOR encoding specification.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_cbor_major_type_t cardano_cbor_initial_byte_get_major_type(byte_t initial_byte);
+
+/**
+ * \brief Retrieves the additional information from a CBOR initial byte.
+ *
+ * Extracts the additional information encoded within a CBOR initial byte. This information provides
+ * further details about the data item, such as the length of the content or special values like
+ * "undefined" or "null". It complements the major type to fully describe the nature of the CBOR data item.
+ *
+ * \param[in] initial_byte The CBOR initial byte from which to extract the additional information.
+ *
+ * \return The extracted additional information, as an enum value of type cardano_cbor_additional_info_t,
+ * indicating specific data characteristics or lengths as defined by the CBOR encoding specification.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_cbor_additional_info_t cardano_cbor_initial_byte_get_additional_info(byte_t initial_byte);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_INITIAL_BYTE_H
diff --git a/vendor/src/cbor/cbor_major_type.c b/vendor/src/cbor/cbor_major_type.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_major_type.c
@@ -0,0 +1,65 @@
+/**
+ * \file cbor_major_type.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_major_type.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_cbor_major_type_to_string(const cardano_cbor_major_type_t major_type)
+{
+  const char* message;
+
+  switch (major_type)
+  {
+    case CARDANO_CBOR_MAJOR_TYPE_UNSIGNED_INTEGER:
+      message = "Major Type: Unsigned Integer";
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_NEGATIVE_INTEGER:
+      message = "Major Type: Negative Integer";
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING:
+      message = "Major Type: Byte String";
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING:
+      message = "Major Type: UTF-8 String";
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_ARRAY:
+      message = "Major Type: Array";
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_MAP:
+      message = "Major Type: Map";
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_TAG:
+      message = "Major Type: Tag";
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_SIMPLE:
+      message = "Major Type: Simple";
+      break;
+    default:
+      message = "Major Type: Unknown";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/cbor/cbor_reader/cbor_reader.c b/vendor/src/cbor/cbor_reader/cbor_reader.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader/cbor_reader.c
@@ -0,0 +1,567 @@
+/**
+ * \file cbor_reader.c
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_reader_state.h>
+#include <cardano/cbor/cbor_simple_value.h>
+#include <cardano/object.h>
+#include <cardano/typedefs.h>
+
+#include "../../allocators.h"
+#include "../../collections/array.h"
+#include "cbor_reader_collections.h"
+#include "cbor_reader_core.h"
+#include "cbor_reader_numeric.h"
+#include "cbor_reader_simple_values.h"
+#include "cbor_reader_tags.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a CBOR reader object.
+ *
+ * This function is responsible for properly deallocating a CBOR reader object (`cardano_cbor_reader_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the CBOR reader object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_cbor_reader_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the CBOR reader
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_cbor_reader_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_cbor_reader_t* cbor_reader = (cardano_cbor_reader_t*)object;
+
+  if (cbor_reader->buffer != NULL)
+  {
+    cardano_buffer_unref(&cbor_reader->buffer);
+  }
+
+  if (cbor_reader->nested_items != NULL)
+  {
+    cardano_array_unref(&cbor_reader->nested_items);
+  }
+
+  _cardano_free(cbor_reader);
+}
+
+/**
+ * \brief Clones the nested items of a cardano_array_t object.
+ *
+ * This function creates a deep copy of the items in the source \ref cardano_array_t object,
+ * including their nested structures. The cloned items are stored in a new \ref cardano_array_t object.
+ *
+ * \param[in] src A constant pointer to the source \ref cardano_array_t object to be cloned.
+ *                This parameter must not be NULL.
+ * \param[out] clone A pointer to a pointer to a \ref cardano_array_t object where the cloned items will be stored.
+ *                   This parameter must not be NULL. On successful completion, this will point to a new array
+ *                   containing the cloned items.
+ *
+ * \return \ref CARDANO_SUCCESS if the items were successfully cloned and stored in the new array.
+ *         Returns \ref CARDANO_ERROR_POINTER_IS_NULL if either \p src or \p clone is NULL.
+ *         Returns \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if there was an error allocating memory for the cloned items.
+ */
+static cardano_error_t
+clone_nested_items(const cardano_array_t* src, cardano_array_t** clone)
+{
+  assert(src != NULL);
+  assert(clone != NULL);
+
+  const size_t array_capacity = cardano_array_get_capacity(src);
+  const size_t array_size     = cardano_array_get_size(src);
+
+  cardano_array_t* cloned_array = cardano_array_new(array_capacity);
+
+  if (cloned_array == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (size_t i = 0; i < array_size; ++i)
+  {
+    cardano_object_t* item = cardano_array_get(src, i);
+
+    assert(item != NULL);
+
+    cardano_object_unref(&item);
+
+    assert(item != NULL);
+
+    cbor_reader_stack_frame_t* frame        = (cbor_reader_stack_frame_t*)((void*)item);
+    cbor_reader_stack_frame_t* cloned_frame = (cbor_reader_stack_frame_t*)_cardano_malloc(sizeof(cbor_reader_stack_frame_t));
+
+    if (cloned_frame == NULL)
+    {
+      cardano_array_unref(&cloned_array);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    cloned_frame->base.ref_count     = 0;
+    cloned_frame->base.deallocator   = _cardano_free;
+    cloned_frame->base.last_error[0] = '\0';
+    cloned_frame->type               = frame->type;
+    cloned_frame->frame_offset       = frame->frame_offset;
+    cloned_frame->definite_length    = frame->definite_length;
+    cloned_frame->items_read         = frame->items_read;
+    cloned_frame->current_key_offset = frame->current_key_offset;
+
+    cardano_object_t* clone_item = (cardano_object_t*)((void*)cloned_frame);
+
+    const size_t current_size = cardano_array_get_size(cloned_array);
+    const size_t new_size     = cardano_array_push(cloned_array, clone_item);
+
+    if (new_size != (current_size + 1U))
+    {
+      _cardano_free(cloned_frame);
+      cardano_array_unref(&cloned_array);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *clone = cloned_array;
+
+  return CARDANO_SUCCESS;
+}
+
+/* DECLARATIONS **************************************************************/
+
+cardano_cbor_reader_t*
+cardano_cbor_reader_new(const byte_t* cbor_data, const size_t size)
+{
+  if (cbor_data == NULL)
+  {
+    return NULL;
+  }
+
+  if (size == 0U)
+  {
+    return NULL;
+  }
+
+  cardano_cbor_reader_t* obj = (cardano_cbor_reader_t*)_cardano_malloc(sizeof(cardano_cbor_reader_t));
+
+  if (obj == NULL)
+  {
+    return NULL;
+  }
+
+  obj->base.ref_count     = 1;
+  obj->base.deallocator   = cardano_cbor_reader_deallocate;
+  obj->base.last_error[0] = '\0';
+  obj->buffer             = cardano_buffer_new_from(cbor_data, size);
+
+  obj->offset                           = 0;
+  obj->nested_items                     = cardano_array_new(32);
+  obj->is_tag_context                   = false;
+  obj->cached_state                     = CARDANO_CBOR_READER_STATE_UNDEFINED;
+  obj->current_frame.type               = CARDANO_CBOR_MAJOR_TYPE_UNDEFINED;
+  obj->current_frame.current_key_offset = -1;
+  obj->current_frame.frame_offset       = 0;
+  obj->current_frame.items_read         = 0;
+  obj->current_frame.definite_length    = -1;
+
+  if ((obj->buffer == NULL) || (obj->nested_items == NULL))
+  {
+    cardano_array_unref(&obj->nested_items);
+    cardano_buffer_unref(&obj->buffer);
+    _cardano_free(obj);
+
+    return NULL;
+  }
+
+  return obj;
+}
+
+cardano_cbor_reader_t*
+cardano_cbor_reader_from_hex(const char* hex_string, const size_t size)
+{
+  if (hex_string == NULL)
+  {
+    return NULL;
+  }
+
+  if (size == 0U)
+  {
+    return NULL;
+  }
+
+  cardano_cbor_reader_t* obj = (cardano_cbor_reader_t*)_cardano_malloc(sizeof(cardano_cbor_reader_t));
+
+  if (obj == NULL)
+  {
+    return NULL;
+  }
+
+  obj->base.ref_count     = 1;
+  obj->base.deallocator   = cardano_cbor_reader_deallocate;
+  obj->base.last_error[0] = '\0';
+  obj->buffer             = cardano_buffer_from_hex(hex_string, size);
+
+  obj->offset                           = 0;
+  obj->nested_items                     = cardano_array_new(32);
+  obj->is_tag_context                   = false;
+  obj->cached_state                     = CARDANO_CBOR_READER_STATE_UNDEFINED;
+  obj->current_frame.type               = CARDANO_CBOR_MAJOR_TYPE_UNDEFINED;
+  obj->current_frame.current_key_offset = -1;
+  obj->current_frame.frame_offset       = 0;
+  obj->current_frame.items_read         = 0;
+  obj->current_frame.definite_length    = -1;
+
+  if ((obj->buffer == NULL) || (obj->nested_items == NULL))
+  {
+    cardano_array_unref(&obj->nested_items);
+    cardano_buffer_unref(&obj->buffer);
+    _cardano_free(obj);
+
+    return NULL;
+  }
+
+  return obj;
+}
+
+void
+cardano_cbor_reader_unref(cardano_cbor_reader_t** cbor_reader)
+{
+  if ((cbor_reader == NULL) || (*cbor_reader == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*cbor_reader)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *cbor_reader = NULL;
+    return;
+  }
+}
+
+void
+cardano_cbor_reader_ref(cardano_cbor_reader_t* cbor_reader)
+{
+  if (cbor_reader == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&cbor_reader->base);
+}
+
+size_t
+cardano_cbor_reader_refcount(const cardano_cbor_reader_t* cbor_reader)
+{
+  if (cbor_reader == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&cbor_reader->base);
+}
+
+cardano_error_t
+cardano_cbor_reader_peek_state(cardano_cbor_reader_t* reader, cardano_cbor_reader_state_t* state)
+{
+  return _cbor_reader_peek_state(reader, state);
+}
+
+cardano_error_t
+cardano_cbor_reader_get_bytes_remaining(cardano_cbor_reader_t* reader, size_t* bytes_remaining)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bytes_remaining == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *bytes_remaining = cardano_buffer_get_size(reader->buffer) - reader->offset;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_reader_get_remainder_bytes(cardano_cbor_reader_t* reader, cardano_buffer_t** remainder_bytes)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (remainder_bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* slice = cardano_buffer_slice(reader->buffer, reader->offset, cardano_buffer_get_size(reader->buffer));
+
+  if (slice == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *remainder_bytes = slice;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_reader_clone(cardano_cbor_reader_t* reader, cardano_cbor_reader_t** clone)
+{
+  return cardano_cbor_reader_deep_clone(reader, clone);
+}
+
+cardano_error_t
+cardano_cbor_reader_deep_clone(const cardano_cbor_reader_t* reader, cardano_cbor_reader_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* buffer = cardano_buffer_new_from(cardano_buffer_get_data(reader->buffer), cardano_buffer_get_size(reader->buffer));
+
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_cbor_reader_t* obj = (cardano_cbor_reader_t*)_cardano_malloc(sizeof(cardano_cbor_reader_t));
+
+  if (obj == NULL)
+  {
+    cardano_buffer_unref(&buffer);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  obj->base.ref_count     = 1;
+  obj->base.deallocator   = cardano_cbor_reader_deallocate;
+  obj->base.last_error[0] = '\0';
+
+  if (clone_nested_items(reader->nested_items, &obj->nested_items) != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&buffer);
+    _cardano_free(obj);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  obj->buffer                           = buffer;
+  obj->offset                           = reader->offset;
+  obj->is_tag_context                   = reader->is_tag_context;
+  obj->cached_state                     = reader->cached_state;
+  obj->current_frame.type               = reader->current_frame.type;
+  obj->current_frame.current_key_offset = reader->current_frame.current_key_offset;
+  obj->current_frame.frame_offset       = reader->current_frame.frame_offset;
+  obj->current_frame.items_read         = reader->current_frame.items_read;
+  obj->current_frame.definite_length    = reader->current_frame.definite_length;
+
+  assert(obj->nested_items != NULL);
+
+  *clone = obj;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_reader_skip_value(cardano_cbor_reader_t* reader)
+{
+  cardano_buffer_t* encoded_value = NULL;
+  cardano_error_t   result        = cardano_cbor_reader_read_encoded_value(reader, &encoded_value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_buffer_unref(&encoded_value);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_reader_read_encoded_value(cardano_cbor_reader_t* reader, cardano_buffer_t** encoded_value)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (encoded_value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t initial_offset = reader->offset;
+  size_t depth          = 0;
+
+  do
+  {
+    cardano_error_t result = _cbor_reader_skip_next_node(reader, &depth);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+  while (depth > 0U);
+
+  *encoded_value = cardano_buffer_slice(reader->buffer, initial_offset, reader->offset);
+
+  if (*encoded_value == NULL)
+  {
+    cardano_cbor_reader_set_last_error(reader, "Failed to allocate encoded value.");
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_reader_read_start_array(cardano_cbor_reader_t* reader, int64_t* size)
+{
+  return _cbor_reader_read_start_array(reader, size);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_end_array(cardano_cbor_reader_t* reader)
+{
+  return _cbor_reader_read_end_array(reader);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_int(cardano_cbor_reader_t* reader, int64_t* value)
+{
+  return _cbor_reader_read_int(reader, value);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_uint(cardano_cbor_reader_t* reader, uint64_t* value)
+{
+  return _cbor_reader_read_uint(reader, value);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_negative_int(cardano_cbor_reader_t* reader, uint64_t* argument)
+{
+  return _cbor_reader_read_negative_int(reader, argument);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_bigint(cardano_cbor_reader_t* reader, cardano_bigint_t** bigint)
+{
+  return _cardano_reader_read_bigint(reader, bigint);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_double(cardano_cbor_reader_t* reader, double* value)
+{
+  return _cbor_reader_read_double(reader, value);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_simple_value(cardano_cbor_reader_t* reader, cardano_cbor_simple_value_t* value)
+{
+  return _cbor_reader_read_simple_value(reader, value);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_start_map(cardano_cbor_reader_t* reader, int64_t* size)
+{
+  return _cbor_reader_read_start_map(reader, size);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_end_map(cardano_cbor_reader_t* reader)
+{
+  return _cbor_reader_read_end_map(reader);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_bool(cardano_cbor_reader_t* reader, bool* value)
+{
+  return _cbor_reader_read_boolean(reader, value);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_null(cardano_cbor_reader_t* reader)
+{
+  return _cbor_reader_read_null(reader);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_bytestring(cardano_cbor_reader_t* reader, cardano_buffer_t** byte_string)
+{
+  return _cbor_reader_read_string(reader, CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING, byte_string);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_textstring(cardano_cbor_reader_t* reader, cardano_buffer_t** text_string)
+{
+  return _cbor_reader_read_string(reader, CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING, text_string);
+}
+
+cardano_error_t
+cardano_cbor_reader_read_tag(cardano_cbor_reader_t* reader, cardano_cbor_tag_t* tag)
+{
+  return _cbor_reader_read_tag(reader, tag);
+}
+
+cardano_error_t
+cardano_cbor_reader_peek_tag(cardano_cbor_reader_t* reader, cardano_cbor_tag_t* tag)
+{
+  return _cbor_reader_peek_tag(reader, tag);
+}
+
+void
+cardano_cbor_reader_set_last_error(cardano_cbor_reader_t* reader, const char* message)
+{
+  cardano_object_set_last_error(&reader->base, message);
+}
+
+const char*
+cardano_cbor_reader_get_last_error(const cardano_cbor_reader_t* reader)
+{
+  return cardano_object_get_last_error(&reader->base);
+}
diff --git a/vendor/src/cbor/cbor_reader/cbor_reader_collections.c b/vendor/src/cbor/cbor_reader/cbor_reader_collections.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader/cbor_reader_collections.c
@@ -0,0 +1,599 @@
+/**
+ * \file cbor_reader_collections.c
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../cbor_initial_byte.h"
+#include "cbor_reader_collections.h"
+#include "cbor_reader_core.h"
+#include "cbor_reader_numeric.h"
+
+#include <assert.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const byte_t   CBOR_INITIAL_BYTE_INDEFINITE_LENGTH_BREAK = 255U;
+static const int64_t  INDEFINITE_LENGTH                         = -1;
+static const size_t   HEADER_BYTE_SIZE                          = 1;
+static const uint64_t KEY_VALUE_PAIR_SIZE                       = 2;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Validates that the next byte in the CBOR stream is the break byte (0xFF).
+ *
+ * This function checks if the next byte in the CBOR data stream, as represented by the
+ * reader, is the break byte (0xFF).
+ *
+ * \param[in] reader A pointer to an initialized cardano_cbor_reader_t structure representing
+ * the state of the CBOR stream.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. \ref CARDANO_SUCCESS
+ * is returned if the byte is validated. If the operation fails, an appropriate error code is returned to
+ * indicate the reason for failure.
+ */
+static cardano_error_t
+validate_next_break_byte(cardano_cbor_reader_t* reader)
+{
+  byte_t          initial_byte = 0;
+  cardano_error_t result       = _cbor_reader_peek_initial_byte(reader, CARDANO_CBOR_MAJOR_TYPE_UNDEFINED, &initial_byte);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (initial_byte != CBOR_INITIAL_BYTE_INDEFINITE_LENGTH_BREAK)
+  {
+    cardano_object_set_last_error(&reader->base, "Not at end of indefinite length data item.");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Peeks at the length of the next definite length CBOR data item, without advancing the buffer's read position.
+ *
+ * This function examines a buffer containing CBOR encoded data to determine the length of the next data item, assuming
+ * it has a definite length. The function does not consume the data; it merely calculates the length based on the
+ * initial byte and any additional bytes that encode the length.
+ *
+ * \param[in]  buffer        A pointer to an initialized cardano_buffer_t structure containing the CBOR data to be examined.
+ * \param[in]  initial_byte  The initial byte of the CBOR data item, which includes the major type and additional information
+ *                           that may encode the item's length.
+ * \param[out] length        A pointer to an int64_t variable where the determined length of the data item will be stored.
+ *                           If the data item is of indefinite length, this is set to a negative value.
+ * \param[out] bytes_read    A pointer to a size_t variable where the number of bytes used to encode the length will be
+ *                           stored. This includes the initial byte.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. \ref CARDANO_SUCCESS is returned if
+ * the length is successfully determined. If the operation fails, an appropriate error code is returned to
+ * indicate the reason for failure.
+ */
+static cardano_error_t
+peek_definite_length(cardano_buffer_t* buffer, const byte_t initial_byte, int64_t* length, size_t* bytes_read)
+{
+  assert(buffer != NULL);
+  assert(length != NULL);
+  assert(bytes_read != NULL);
+
+  uint64_t definite_length = 0;
+  size_t   read            = 0;
+
+  cardano_error_t result = _cbor_reader_decode_unsigned_integer(buffer, initial_byte, &definite_length, &read);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (definite_length > (uint64_t)INT64_MAX)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *length     = (int64_t)definite_length;
+  *bytes_read = read;
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+_cbor_reader_read_start_indefinite_length_string(cardano_cbor_reader_t* reader, const cardano_cbor_major_type_t type)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t remaining_bytes = cardano_buffer_get_size(reader->buffer);
+
+  if ((remaining_bytes - reader->offset) < HEADER_BYTE_SIZE)
+  {
+    cardano_object_set_last_error(&reader->base, "Not enough bytes to read indefinite length string.");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  byte_t          initial_byte = 0;
+  cardano_error_t result       = _cbor_reader_peek_initial_byte(reader, type, &initial_byte);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_additional_info_t info = cardano_cbor_initial_byte_get_additional_info(initial_byte);
+
+  if (info != CARDANO_CBOR_ADDITIONAL_INFO_INDEFINITE_LENGTH)
+  {
+    cardano_object_set_last_error(&reader->base, "Not indefinite length string.");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, HEADER_BYTE_SIZE);
+
+  assert(advance_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(advance_result);
+
+  cardano_error_t push_data_result = _cbor_reader_push_data_item(reader, type, INDEFINITE_LENGTH);
+
+  if (push_data_result != CARDANO_SUCCESS)
+  {
+    return push_data_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_end_indefinite_length_string(cardano_cbor_reader_t* reader, const cardano_cbor_major_type_t type)
+{
+  cardano_error_t result = validate_next_break_byte(reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_error_t pop_data_result = _cbor_reader_pop_data_item(reader, type);
+
+  if (pop_data_result != CARDANO_SUCCESS)
+  {
+    return pop_data_result;
+  }
+
+  _cbor_reader_advance_data_item_counters(reader);
+
+  cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, HEADER_BYTE_SIZE);
+
+  assert(advance_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(advance_result);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_indefinite_length_concatenated(cardano_cbor_reader_t* reader, cardano_buffer_t** buffer, size_t* encoding_length)
+{
+  static const size_t INITIAL_CONCAT_BUFFER_CAPACITY = 128;
+
+  assert(reader != NULL);
+  assert(buffer != NULL);
+  assert(encoding_length != NULL);
+
+  cardano_buffer_t* data   = NULL;
+  cardano_error_t   result = cardano_cbor_reader_get_remainder_bytes(reader, &data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&data);
+    return result;
+  }
+
+  cardano_buffer_t* concat = cardano_buffer_new(INITIAL_CONCAT_BUFFER_CAPACITY);
+
+  size_t       i    = HEADER_BYTE_SIZE;
+  const size_t size = cardano_buffer_get_size(data);
+
+  if ((concat == NULL) || (size <= HEADER_BYTE_SIZE))
+  {
+    cardano_buffer_unref(&data);
+    cardano_buffer_unref(&concat);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  byte_t initial_byte = cardano_buffer_get_data(data)[i];
+
+  while (initial_byte != CBOR_INITIAL_BYTE_INDEFINITE_LENGTH_BREAK)
+  {
+    int64_t chunk_length = 0;
+    size_t  bytes_read   = 0;
+
+    cardano_buffer_t* slice = cardano_buffer_slice(data, i, cardano_buffer_get_size(data));
+
+    if ((slice == NULL) || (cardano_buffer_get_size(slice) == 0U))
+    {
+      cardano_buffer_unref(&data);
+      cardano_buffer_unref(&concat);
+
+      return CARDANO_ERROR_DECODING;
+    }
+
+    cardano_error_t peek_definite_length_result = peek_definite_length(slice, initial_byte, &chunk_length, &bytes_read);
+
+    cardano_buffer_unref(&slice);
+
+    if (peek_definite_length_result != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&data);
+      cardano_buffer_unref(&concat);
+
+      return peek_definite_length_result;
+    }
+
+    size_t payload_size = bytes_read + (size_t)chunk_length;
+
+    cardano_buffer_t* chunk = cardano_buffer_slice(data, i + (payload_size - (size_t)chunk_length), i + payload_size);
+
+    if (chunk != NULL)
+    {
+      cardano_buffer_t* tmp = concat;
+      concat                = cardano_buffer_concat(tmp, chunk);
+
+      cardano_buffer_unref(&chunk);
+      cardano_buffer_unref(&tmp);
+    }
+
+    i += payload_size;
+
+    if (i >= size)
+    {
+      cardano_buffer_unref(&data);
+      cardano_buffer_unref(&concat);
+
+      return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+    }
+
+    initial_byte = cardano_buffer_get_data(data)[i];
+  }
+
+  *buffer = concat;
+
+  cardano_buffer_unref(&data);
+  *encoding_length = i + HEADER_BYTE_SIZE;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_start_array(cardano_cbor_reader_t* reader, int64_t* size)
+{
+  byte_t header;
+
+  cardano_error_t result = _cbor_reader_peek_initial_byte(reader, CARDANO_CBOR_MAJOR_TYPE_ARRAY, &header);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (cardano_cbor_initial_byte_get_additional_info(header) == CARDANO_CBOR_ADDITIONAL_INFO_INDEFINITE_LENGTH)
+  {
+    cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, HEADER_BYTE_SIZE);
+
+    assert(advance_result == CARDANO_SUCCESS);
+    CARDANO_UNUSED(advance_result);
+
+    cardano_error_t push_data_result = _cbor_reader_push_data_item(reader, CARDANO_CBOR_MAJOR_TYPE_ARRAY, INDEFINITE_LENGTH);
+
+    if (push_data_result != CARDANO_SUCCESS)
+    {
+      return push_data_result;
+    }
+
+    *size = INDEFINITE_LENGTH;
+    return CARDANO_SUCCESS;
+  }
+
+  int64_t length     = 0;
+  size_t  bytes_read = 0;
+
+  cardano_buffer_t* remaining_bytes  = NULL;
+  cardano_error_t   get_bytes_result = cardano_cbor_reader_get_remainder_bytes(reader, &remaining_bytes);
+
+  if (get_bytes_result != CARDANO_SUCCESS)
+  {
+    return get_bytes_result;
+  }
+
+  result = peek_definite_length(remaining_bytes, header, &length, &bytes_read);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_set_last_error(reader, "Failed to read length of definite array");
+    cardano_buffer_unref(&remaining_bytes);
+
+    return result;
+  }
+
+  cardano_buffer_unref(&remaining_bytes);
+
+  cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, bytes_read);
+
+  assert(advance_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(advance_result);
+
+  cardano_error_t push_data_result = _cbor_reader_push_data_item(reader, CARDANO_CBOR_MAJOR_TYPE_ARRAY, length);
+
+  if (push_data_result != CARDANO_SUCCESS)
+  {
+    return push_data_result;
+  }
+
+  *size = length;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_end_array(cardano_cbor_reader_t* reader)
+{
+  if (reader->current_frame.definite_length == INDEFINITE_LENGTH)
+  {
+    cardano_error_t result = validate_next_break_byte(reader);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_error_t pop_data_result = _cbor_reader_pop_data_item(reader, CARDANO_CBOR_MAJOR_TYPE_ARRAY);
+
+    if (pop_data_result != CARDANO_SUCCESS)
+    {
+      return pop_data_result;
+    }
+
+    _cbor_reader_advance_data_item_counters(reader);
+
+    cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, HEADER_BYTE_SIZE);
+
+    assert(advance_result == CARDANO_SUCCESS);
+    CARDANO_UNUSED(advance_result);
+  }
+  else
+  {
+    cardano_error_t pop_data_result = _cbor_reader_pop_data_item(reader, CARDANO_CBOR_MAJOR_TYPE_ARRAY);
+
+    if (pop_data_result != CARDANO_SUCCESS)
+    {
+      return pop_data_result;
+    }
+
+    _cbor_reader_advance_data_item_counters(reader);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_start_map(cardano_cbor_reader_t* reader, int64_t* size)
+{
+  byte_t header = 0;
+
+  cardano_error_t result = _cbor_reader_peek_initial_byte(reader, CARDANO_CBOR_MAJOR_TYPE_MAP, &header);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (cardano_cbor_initial_byte_get_additional_info(header) == CARDANO_CBOR_ADDITIONAL_INFO_INDEFINITE_LENGTH)
+  {
+    cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, HEADER_BYTE_SIZE);
+
+    assert(advance_result == CARDANO_SUCCESS);
+    CARDANO_UNUSED(advance_result);
+
+    cardano_error_t push_data_result = _cbor_reader_push_data_item(reader, CARDANO_CBOR_MAJOR_TYPE_MAP, INDEFINITE_LENGTH);
+
+    if (push_data_result != CARDANO_SUCCESS)
+    {
+      return push_data_result;
+    }
+
+    *size = INDEFINITE_LENGTH;
+    return CARDANO_SUCCESS;
+  }
+
+  int64_t length     = 0;
+  size_t  bytes_read = 0;
+
+  cardano_buffer_t* remaining_bytes  = NULL;
+  cardano_error_t   get_bytes_result = cardano_cbor_reader_get_remainder_bytes(reader, &remaining_bytes);
+
+  if (get_bytes_result != CARDANO_SUCCESS)
+  {
+    return get_bytes_result;
+  }
+
+  result = peek_definite_length(remaining_bytes, header, &length, &bytes_read);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&remaining_bytes);
+    return result;
+  }
+
+  cardano_buffer_unref(&remaining_bytes);
+
+  if ((KEY_VALUE_PAIR_SIZE * (size_t)length) > (cardano_buffer_get_size(reader->buffer) - reader->offset))
+  {
+    cardano_cbor_reader_set_last_error(reader, "Definite length exceeds buffer size");
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  assert(result == CARDANO_SUCCESS);
+
+  cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, bytes_read);
+
+  assert(advance_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(advance_result);
+
+  cardano_error_t push_data_result = _cbor_reader_push_data_item(reader, CARDANO_CBOR_MAJOR_TYPE_MAP, length * ((int64_t)KEY_VALUE_PAIR_SIZE));
+
+  if (push_data_result != CARDANO_SUCCESS)
+  {
+    return push_data_result;
+  }
+
+  *size = length;
+
+  reader->current_frame.current_key_offset = (int64_t)reader->offset;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_end_map(cardano_cbor_reader_t* reader)
+{
+  if (reader->current_frame.definite_length == INDEFINITE_LENGTH)
+  {
+    cardano_error_t result = validate_next_break_byte(reader);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if ((reader->current_frame.items_read % KEY_VALUE_PAIR_SIZE) != 0U)
+    {
+      cardano_cbor_reader_set_last_error(reader, "Key missing value");
+      return CARDANO_ERROR_DECODING;
+    }
+
+    cardano_error_t pop_data_result = _cbor_reader_pop_data_item(reader, CARDANO_CBOR_MAJOR_TYPE_MAP);
+
+    if (pop_data_result != CARDANO_SUCCESS)
+    {
+      return pop_data_result;
+    }
+
+    _cbor_reader_advance_data_item_counters(reader);
+    cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, HEADER_BYTE_SIZE);
+
+    assert(advance_result == CARDANO_SUCCESS);
+    CARDANO_UNUSED(advance_result);
+  }
+  else
+  {
+    cardano_error_t pop_data_result = _cbor_reader_pop_data_item(reader, CARDANO_CBOR_MAJOR_TYPE_MAP);
+
+    if (pop_data_result != CARDANO_SUCCESS)
+    {
+      return pop_data_result;
+    }
+
+    _cbor_reader_advance_data_item_counters(reader);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_string(cardano_cbor_reader_t* reader, const cardano_cbor_major_type_t type, cardano_buffer_t** byte_string)
+{
+  byte_t          header = 0;
+  cardano_error_t result = _cbor_reader_peek_initial_byte(reader, type, &header);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (cardano_cbor_initial_byte_get_additional_info(header) == CARDANO_CBOR_ADDITIONAL_INFO_INDEFINITE_LENGTH)
+  {
+    size_t          encoding_length    = 0;
+    cardano_error_t read_concat_result = _cbor_reader_read_indefinite_length_concatenated(reader, byte_string, &encoding_length);
+
+    if (read_concat_result != CARDANO_SUCCESS)
+    {
+      return read_concat_result;
+    }
+
+    cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, encoding_length);
+
+    assert(advance_result == CARDANO_SUCCESS);
+    CARDANO_UNUSED(advance_result);
+
+    _cbor_reader_advance_data_item_counters(reader);
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_buffer_t* buffer                 = NULL;
+  cardano_error_t   remainder_bytes_result = cardano_cbor_reader_get_remainder_bytes(reader, &buffer);
+
+  if (remainder_bytes_result != CARDANO_SUCCESS)
+  {
+    return remainder_bytes_result;
+  }
+
+  int64_t length = 0;
+
+  size_t bytes_read = 0;
+
+  result = peek_definite_length(buffer, header, &length, &bytes_read);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&buffer);
+    return result;
+  }
+
+  cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, bytes_read + (size_t)length);
+
+  if (advance_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&buffer);
+    return advance_result;
+  }
+
+  _cbor_reader_advance_data_item_counters(reader);
+
+  *byte_string = cardano_buffer_slice(buffer, bytes_read, bytes_read + (size_t)length);
+  cardano_buffer_unref(&buffer);
+
+  if (*byte_string == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/cbor/cbor_reader/cbor_reader_collections.h b/vendor/src/cbor/cbor_reader/cbor_reader_collections.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader/cbor_reader_collections.h
@@ -0,0 +1,186 @@
+/**
+ * \file cbor_reader_collections.h
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_COLLECTIONS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_COLLECTIONS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <stdint.h>
+
+#include "cbor_reader_core.h"
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief This function initiates the process of reading a CBOR string (text or byte string) that is encoded
+ * with indefinite length.
+ *
+ * It checks if the next item in the data stream corresponds to the start of an indefinite-length string of
+ * the specified major type.
+ *
+ * \param[in] reader A pointer to an initialized cardano_cbor_reader_t structure that represents the CBOR
+ *                   reader context.
+ * \param[in] type The major type of the string to read, which should be either \ref CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING
+ *                 or \ref CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING, indicating a byte string or a text string, respectively.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. \ref CARDANO_SUCCESS is
+ * returned if the start of an indefinite-length string of the specified type is successfully detected.
+ * If the operation fails, an appropriate error code is returned to indicate the reason for failure.
+ */
+cardano_error_t
+_cbor_reader_read_start_indefinite_length_string(cardano_cbor_reader_t* reader, cardano_cbor_major_type_t type);
+
+/**
+ * \brief This function concludes the process of reading a CBOR string (text or byte string) that is encoded with
+ * indefinite length.
+ *
+ * It verifies that the next item in the data stream corresponds to the "break" stop code, which marks the end of
+ * an indefinite-length string.
+ *
+ * \param[in] reader A pointer to an initialized cardano_cbor_reader_t structure that represents the
+ *                   CBOR reader context.
+ * \param[in] type The major type of the string being read, which should be either \ref CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING
+ *                 or \ref CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING, indicating a byte string or a text string, respectively.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. \ref CARDANO_SUCCESS
+ * is returned if the "break" stop code, marking the end of an indefinite-length string of the specified type,
+ * is successfully detected. If the operation fails, an appropriate error code is returned to
+ * indicate the reason for failure.
+ */
+cardano_error_t
+_cbor_reader_read_end_indefinite_length_string(cardano_cbor_reader_t* reader, cardano_cbor_major_type_t type);
+
+/**
+ * \brief This function is used to read data that is encoded in CBOR format with an indefinite length.
+ * It concatenates chunks of data until the "break" stop code is encountered, which marks the end
+ * of the indefinite length encoding. The concatenated data is stored in a newly allocated buffer.
+ *
+ * \param[in]  reader           A pointer to an initialized cardano_cbor_reader_t structure that represent
+ *                              the CBOR reader context.
+ * \param[out] buffer           A pointer to a pointer to a cardano_buffer_t structure where the concatenated
+ *                              data will be stored.
+ * \param[out] encoding_length  A pointer to a size_t variable where the length of the concatenated
+ *                              data will be stored.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. \ref CARDANO_SUCCESS is
+ * returned if the data is successfully read and concatenated. If the operation fails, an appropriate
+ * error code is returned to indicate the reason for failure.
+ */
+cardano_error_t
+_cbor_reader_read_indefinite_length_concatenated(cardano_cbor_reader_t* reader, cardano_buffer_t** buffer, size_t* encoding_length);
+
+/**
+ * \brief Reads the start of a CBOR array and returns its size.
+ *
+ * This function reads the start of an array (major type 4) from the CBOR stream and returns the size of
+ * the array. If the array is of indefinite length, the function will set the size to -1.
+ *
+ * \param[in] reader A pointer to the cardano_cbor_reader_t structure that represents the CBOR stream from
+ *                   which the array start is to be read.
+ * \param[out] size A pointer to an int64_t variable where the size of the array will be stored. If the
+ *                  array is of indefinite length, the value will be set to -1.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. \ref CARDANO_SUCCESS is
+ * returned if the data is successfully read. If the operation fails, an appropriate error code is returned
+ * to indicate the reason for failure.
+ */
+cardano_error_t
+_cbor_reader_read_start_array(cardano_cbor_reader_t* reader, int64_t* size);
+
+/**
+ * \brief Reads the end of a CBOR array from the stream.
+ *
+ * This function is used to read the end of an indefinite-length array (major type 4) from the CBOR stream.
+ * It checks for the presence of the "break" stop code that indicates the end of the array. It is only applicable
+ * for indefinite-length arrays.
+ *
+ * \param[in] reader A pointer to the cardano_cbor_reader_t structure that represents the CBOR stream
+ * from which the end of the array is to be read.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. \ref CARDANO_SUCCESS is
+ * returned if the data is successfully read. If the operation fails, an appropriate error code is returned
+ * to indicate the reason for failure.
+ */
+cardano_error_t
+_cbor_reader_read_end_array(cardano_cbor_reader_t* reader);
+
+/**
+ * \brief Reads the start of a CBOR map and returns its size.
+ *
+ * This function reads the start of an map (major type 5) from the CBOR stream and returns the size of the map.
+ * If the map is of indefinite length, the function will set the size to -1.
+ *
+ * \param[in] reader A pointer to the cardano_cbor_reader_t structure that represents the CBOR stream from
+ *                   which the map start is to be read.
+ * \param[out] size A pointer to an int64_t variable where the size of the map will be stored. If the
+ *                  map is of indefinite length, the value will be set to -1.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. \ref CARDANO_SUCCESS is
+ * returned if the data is successfully read. If the operation fails, an appropriate error code is returned
+ * to indicate the reason for failure.
+ */
+cardano_error_t
+_cbor_reader_read_start_map(cardano_cbor_reader_t* reader, int64_t* size);
+
+/**
+ * \brief Reads the end of a CBOR map from the stream.
+ *
+ * This function is used to read the end of an indefinite-length map (major type 5) from the CBOR stream.
+ * It checks for the presence of the "break" stop code that indicates the end of the map. It is only applicable
+ * for indefinite-length maps.
+ *
+ * \param[in] reader A pointer to the cardano_cbor_reader_t structure that represents the CBOR stream
+ * from which the end of the map is to be read.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. \ref CARDANO_SUCCESS is
+ * returned if the data is successfully read. If the operation fails, an appropriate error code is returned
+ * to indicate the reason for failure.
+ */
+cardano_error_t
+_cbor_reader_read_end_map(cardano_cbor_reader_t* reader);
+
+/**
+ * \brief Reads a string (byte or text) from the CBOR stream.
+ *
+ * This function reads a string, either a byte string (major type 2) or a text string (major type 3),
+ * from the CBOR stream. It handles both definite and indefinite length strings. For indefinite
+ * length strings, it concatenates all the chunks into a single buffer.
+ *
+ * \param[in] reader A pointer to the cardano_cbor_reader_t structure that represents the CBOR stream
+ *                   from which the string is to be read.
+ * \param[in] type The major type of the string to be read. This must be either CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING (2)
+ *                 for byte strings or CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING (3) for text strings.
+ * \param[out] byte_string A pointer to a pointer of a cardano_buffer_t structure where the read string will
+ *                         be stored. The buffer will contain the string data if the function succeeds.
+ *                         The caller is responsible for releasing the buffer using \ref cardano_buffer_unref
+ *                         when it is no longer needed.
+ *
+ * \return A cardano_error_t indicating the success or failure of the operation. \ref CARDANO_SUCCESS is
+ * returned if the data is successfully read. If the operation fails, an appropriate error code is returned
+ * to indicate the reason for failure.
+ */
+cardano_error_t
+_cbor_reader_read_string(cardano_cbor_reader_t* reader, cardano_cbor_major_type_t type, cardano_buffer_t** byte_string);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_COLLECTIONS_H
diff --git a/vendor/src/cbor/cbor_reader/cbor_reader_core.c b/vendor/src/cbor/cbor_reader/cbor_reader_core.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader/cbor_reader_core.c
@@ -0,0 +1,843 @@
+/**
+ * \file cbor_reader_core.c
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_major_type.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../../allocators.h"
+#include "../cbor_initial_byte.h"
+#include "cbor_reader_collections.h"
+#include "cbor_reader_core.h"
+#include "cbor_reader_tags.h"
+
+#include <assert.h>
+#include <stdio.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const byte_t  CBOR_INITIAL_BYTE_INDEFINITE_LENGTH_BREAK = 255U;
+static const int64_t INDEFINITE_LENGTH                         = -1;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief This function is intended to be called when a CBOR reader encounters the end of a data item
+ * that has a definite length. It updates the reader's state to reflect the completion of reading
+ * this data item.
+ *
+ * \param[in,out] reader A pointer to the \ref cardano_cbor_reader_t structure representing the
+ *                       current state of the CBOR reader. This reader's state is updated based on
+ *                       the processing of the end of the definite length item.
+ * \param[out]    state  A pointer to the \ref cardano_cbor_reader_state_t structure where the updated state
+ *                       of the reader will be stored.
+ *
+ * \return A \c cardano_error_t indicating the outcome of the operation. \c CARDANO_SUCCESS is
+ *         returned if the end of the definite length data item was processed successfully. If an
+ *         error occurs, an appropriate error code is returned to indicate the failure reason.
+ *         Error codes are detailed in the \c cardano_error_t documentation.
+ */
+static cardano_error_t
+process_end_of_definite_length(cardano_cbor_reader_t* reader, cardano_cbor_reader_state_t* state)
+{
+  assert(reader != NULL);
+  assert(state != NULL);
+
+  if (reader->current_frame.type == CARDANO_CBOR_MAJOR_TYPE_UNDEFINED)
+  {
+    *state = CARDANO_CBOR_READER_STATE_FINISHED;
+    return CARDANO_SUCCESS;
+  }
+
+  switch (reader->current_frame.type)
+  {
+    case CARDANO_CBOR_MAJOR_TYPE_ARRAY:
+      *state = CARDANO_CBOR_READER_STATE_END_ARRAY;
+      return CARDANO_SUCCESS;
+    case CARDANO_CBOR_MAJOR_TYPE_MAP:
+      *state = CARDANO_CBOR_READER_STATE_END_MAP;
+      return CARDANO_SUCCESS;
+    default:
+      cardano_object_set_last_error(&reader->base, "Invalid CBOR major type pushed to stack.");
+      return CARDANO_ERROR_DECODING;
+  }
+}
+
+/**
+ * \brief This function is called when a CBOR reader encounters the termination byte for an indefinite
+ * length data item. It updates the reader's state to correctly reflect the closure of an indefinite
+ * length data item.
+ *
+ * \param[in,out] reader A pointer to the \ref cardano_cbor_reader_t structure representing the
+ *                       current state of the CBOR reader. The reader's state is adjusted to account
+ *                       for the end of the indefinite length item.
+ * \param[out]    state  A pointer to the \ref cardano_cbor_reader_state_t structure where the updated state
+ *                       of the reader is stored.
+ *
+ * \return A \c cardano_error_t indicating the outcome of the function. \c CARDANO_SUCCESS indicates
+ *         that the end of the indefinite length item was processed correctly. Should an error occur,
+ *         a suitable error code will be returned to signify the specific issue encountered during
+ *         processing. Refer to the documentation on \c cardano_error_t for more details on possible
+ *         error codes.
+ */
+static cardano_error_t
+process_end_of_indefinite_length(cardano_cbor_reader_t* reader, cardano_cbor_reader_state_t* state)
+{
+  assert(reader != NULL);
+  assert(state != NULL);
+
+  if (reader->is_tag_context)
+  {
+    cardano_object_set_last_error(&reader->base, "Tag not followed by value.");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (reader->current_frame.definite_length == INDEFINITE_LENGTH)
+  {
+    switch (reader->current_frame.type)
+    {
+      case CARDANO_CBOR_MAJOR_TYPE_UNDEFINED:
+        cardano_object_set_last_error(&reader->base, "Unexpected break byte.");
+        return CARDANO_ERROR_DECODING;
+      case CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING:
+        *state = CARDANO_CBOR_READER_STATE_END_INDEFINITE_LENGTH_BYTESTRING;
+        return CARDANO_SUCCESS;
+      case CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING:
+        *state = CARDANO_CBOR_READER_STATE_END_INDEFINITE_LENGTH_TEXTSTRING;
+        return CARDANO_SUCCESS;
+      case CARDANO_CBOR_MAJOR_TYPE_ARRAY:
+        *state = CARDANO_CBOR_READER_STATE_END_ARRAY;
+        return CARDANO_SUCCESS;
+      case CARDANO_CBOR_MAJOR_TYPE_MAP:
+        if ((reader->current_frame.items_read % 2U) == 0U)
+        {
+          *state = CARDANO_CBOR_READER_STATE_END_MAP;
+          return CARDANO_SUCCESS;
+        }
+
+        cardano_object_set_last_error(&reader->base, "Key missing value.");
+        return CARDANO_ERROR_DECODING;
+      default:
+        cardano_object_set_last_error(&reader->base, "Invalid CBOR major type pushed to stack.");
+        return CARDANO_ERROR_DECODING;
+    }
+  }
+  else
+  {
+    cardano_object_set_last_error(&reader->base, "Unexpected break byte.");
+    return CARDANO_ERROR_DECODING;
+  }
+}
+
+/**
+ * \brief This function is invoked when the CBOR reader reaches the end of the buffer while parsing
+ * CBOR data. It ensures the reader's state is accurately updated to reflect the completion of parsing
+ * or to indicate that the data stream has been prematurely terminated.
+ *
+ * \param[in,out] reader A pointer to the \ref cardano_cbor_reader_t structure that represents the
+ *                       current state of the CBOR reader. This reader's state will be updated to
+ *                       reflect the processing of the buffer's end.
+ * \param[in] buffer_size The total size of the CBOR buffer that the reader is parsing. This size is
+ *                        used to determine whether the reader has encountered an actual end of data
+ *                        or an unexpected termination of the buffer.
+ * \param[out]    state   A pointer to the \ref cardano_cbor_reader_state_t structure where the reader's new
+ *                        state will be stored after processing the end of the buffer.
+ *
+ * \return A \c cardano_error_t indicating the outcome of processing the end of the buffer. \c CARDANO_SUCCESS
+ *         is returned if the end of the buffer was reached under expected conditions and the reader's state
+ *         has been appropriately updated. If an error occurs, such as encountering truncated data, an
+ *         appropriate error code will be returned to indicate the issue. Refer to the \c cardano_error_t
+ *         documentation for details on possible error codes.
+ */
+static cardano_error_t
+process_end_of_buffer(cardano_cbor_reader_t* reader, const size_t buffer_size, cardano_cbor_reader_state_t* state)
+{
+  assert(reader != NULL);
+  assert(state != NULL);
+
+  if (reader->offset > buffer_size)
+  {
+    cardano_object_set_last_error(&reader->base, "Unexpected end of buffer.");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if ((reader->current_frame.type == CARDANO_CBOR_MAJOR_TYPE_UNDEFINED) && (reader->current_frame.definite_length == INDEFINITE_LENGTH))
+  {
+    *state = CARDANO_CBOR_READER_STATE_FINISHED;
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_object_set_last_error(&reader->base, "Unexpected end of buffer.");
+  return CARDANO_ERROR_DECODING;
+}
+
+/**
+ * \brief This function translates a simple value from CBOR's representation into the corresponding
+ * state used by the CBOR reader.
+ *
+ * \param[in] value The simple value as defined by CBOR's \ref cardano_cbor_additional_info_t enumeration.
+ *                  This value specifies the type of simple value (e.g., boolean, null, undefined)
+ *                  to be mapped to a reader state.
+ *
+ * \return A \ref cardano_cbor_reader_state_t enumeration value that corresponds to the CBOR reader's internal
+ *         state representation of the given simple value. This state can then be used by the reader
+ *         to correctly interpret and proceed with parsing the CBOR data.
+ */
+static cardano_cbor_reader_state_t
+map_simple_value_data_to_reader_state(const cardano_cbor_additional_info_t value)
+{
+  cardano_cbor_reader_state_t result = CARDANO_CBOR_READER_STATE_SIMPLE_VALUE;
+
+  switch (value)
+  {
+    case CARDANO_CBOR_ADDITIONAL_INFO_NULL:
+      result = CARDANO_CBOR_READER_STATE_NULL;
+      break;
+    case CARDANO_CBOR_ADDITIONAL_INFO_FALSE:
+    case CARDANO_CBOR_ADDITIONAL_INFO_TRUE:
+      result = CARDANO_CBOR_READER_STATE_BOOLEAN;
+      break;
+    case CARDANO_CBOR_ADDITIONAL_INFO_16BIT_DATA:
+      result = CARDANO_CBOR_READER_STATE_HALF_PRECISION_FLOAT;
+      break;
+    case CARDANO_CBOR_ADDITIONAL_INFO_32BIT_DATA:
+      result = CARDANO_CBOR_READER_STATE_SINGLE_PRECISION_FLOAT;
+      break;
+    case CARDANO_CBOR_ADDITIONAL_INFO_64BIT_DATA:
+      result = CARDANO_CBOR_READER_STATE_DOUBLE_PRECISION_FLOAT;
+      break;
+    default:
+      break;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Maps a CBOR major type to the corresponding reader state.
+ *
+ * This function takes the current major type read from the CBOR data stream and translates it into
+ * a corresponding state for the CBOR reader.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance.
+ * \param[out] state A pointer to a \ref cardano_cbor_reader_state_t variable where the resulting reader
+ *                   state will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation. This can be
+ *         \c CARDANO_SUCCESS if the major type was successfully mapped to a reader state, or an
+ *         appropriate error code if an issue occurred during the mapping process.
+ */
+static cardano_error_t
+map_major_type_to_reader_state(cardano_cbor_reader_t* reader, cardano_cbor_reader_state_t* state)
+{
+  assert(reader != NULL);
+  assert(state != NULL);
+
+  byte_t*                              buffer_data     = cardano_buffer_get_data(reader->buffer);
+  const byte_t                         initial_byte    = buffer_data[reader->offset];
+  const cardano_cbor_additional_info_t additional_info = cardano_cbor_initial_byte_get_additional_info(initial_byte);
+  const cardano_cbor_major_type_t      major_type      = cardano_cbor_initial_byte_get_major_type(initial_byte);
+
+  switch (major_type)
+  {
+    case CARDANO_CBOR_MAJOR_TYPE_UNSIGNED_INTEGER:
+      *state = CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER;
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_NEGATIVE_INTEGER:
+      *state = CARDANO_CBOR_READER_STATE_NEGATIVE_INTEGER;
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING:
+      *state = (additional_info == CARDANO_CBOR_ADDITIONAL_INFO_INDEFINITE_LENGTH)
+        ? CARDANO_CBOR_READER_STATE_START_INDEFINITE_LENGTH_BYTESTRING
+        : CARDANO_CBOR_READER_STATE_BYTESTRING;
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING:
+      *state = (additional_info == CARDANO_CBOR_ADDITIONAL_INFO_INDEFINITE_LENGTH)
+        ? CARDANO_CBOR_READER_STATE_START_INDEFINITE_LENGTH_TEXTSTRING
+        : CARDANO_CBOR_READER_STATE_TEXTSTRING;
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_ARRAY:
+      *state = CARDANO_CBOR_READER_STATE_START_ARRAY;
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_MAP:
+      *state = CARDANO_CBOR_READER_STATE_START_MAP;
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_TAG:
+      *state = CARDANO_CBOR_READER_STATE_TAG;
+      break;
+    case CARDANO_CBOR_MAJOR_TYPE_SIMPLE:
+      *state = map_simple_value_data_to_reader_state(additional_info);
+      break;
+    default:
+      cardano_object_set_last_error(&reader->base, "Invalid CBOR major type.");
+      return CARDANO_ERROR_DECODING;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief his function is used to revert the state of the CBOR reader to a specific point previously
+ * saved in a stack frame.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance that is processing the
+ *                   CBOR data stream. The reader's current state will be modified to match that
+ *                   of the provided stack frame.
+ * \param[in] frame A pointer to the \ref cbor_reader_stack_frame_t instance representing the
+ *                  stack frame to which the reader's state should be restored.
+ */
+static void
+cbor_reader_restore_stack_frame(cardano_cbor_reader_t* reader, cbor_reader_stack_frame_t* frame)
+{
+  assert(reader != NULL);
+  assert(frame != NULL);
+
+  reader->current_frame.type               = frame->type;
+  reader->current_frame.definite_length    = frame->definite_length;
+  reader->current_frame.frame_offset       = frame->frame_offset;
+  reader->current_frame.items_read         = frame->items_read;
+  reader->current_frame.current_key_offset = frame->current_key_offset;
+  reader->cached_state                     = CARDANO_CBOR_READER_STATE_UNDEFINED;
+}
+
+/**
+ * \brief This function examines the next portion of the CBOR data stream to determine the state
+ * that the reader will transition into upon reading this data. It allows the caller to anticipate
+ * the type of data (e.g., integer, string, map start) that will be read next without actually
+ * consuming any data from the stream. This is particularly useful for decision-making processes
+ * that depend on the structure of the incoming CBOR data.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance. This reader is processing the
+ *                   CBOR data stream and needs to peek ahead at the next data item's type.
+ * \param[out] state A pointer to a \ref cardano_cbor_reader_state_t variable where the predicted reader state
+ *                   will be stored. This state represents the type and nature of the next data item that
+ *                   would be read by the reader.
+ *
+ * \return A \ref cardano_error_t indicating the success of the operation. \c CARDANO_SUCCESS is returned
+ *         if the function successfully peeks at the next state, allowing for accurate anticipation of the
+ *         next read operation. If an error occurs during peeking, an appropriate error code is returned.
+ *
+ * \note This function does not modify the reader's current position within the CBOR data stream, ensuring
+ *       that the actual read operations can proceed unaffected by the peek operation. It is a critical
+ *       tool for complex parsing logic where the handling strategy may vary depending on upcoming data.
+ */
+static cardano_error_t
+peek_state_core(cardano_cbor_reader_t* reader, cardano_cbor_reader_state_t* state)
+{
+  assert(reader != NULL);
+  assert(state != NULL);
+
+  const size_t buffer_size = cardano_buffer_get_size(reader->buffer);
+  byte_t*      buffer_data = cardano_buffer_get_data(reader->buffer);
+
+  if ((reader->current_frame.definite_length != INDEFINITE_LENGTH) && ((reader->current_frame.definite_length - (int64_t)reader->current_frame.items_read) == 0))
+  {
+    return process_end_of_definite_length(reader, state);
+  }
+
+  if (reader->offset >= buffer_size)
+  {
+    return process_end_of_buffer(reader, buffer_size, state);
+  }
+
+  const byte_t                    initial_byte = buffer_data[reader->offset];
+  const cardano_cbor_major_type_t major_type   = cardano_cbor_initial_byte_get_major_type(initial_byte);
+
+  if (initial_byte == CBOR_INITIAL_BYTE_INDEFINITE_LENGTH_BREAK)
+  {
+    return process_end_of_indefinite_length(reader, state);
+  }
+
+  if ((reader->current_frame.type != CARDANO_CBOR_MAJOR_TYPE_UNDEFINED) && (reader->current_frame.definite_length != INDEFINITE_LENGTH))
+  {
+    switch (reader->current_frame.type)
+    {
+      case CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING:
+      case CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING:
+        if (major_type != reader->current_frame.type)
+        {
+          cardano_object_set_last_error(&reader->base, "Indefinite length string contains invalid data item.");
+          return CARDANO_ERROR_DECODING;
+        }
+        break;
+      default:
+        break;
+    }
+  }
+
+  return map_major_type_to_reader_state(reader, state);
+}
+
+/* INCLUDES ******************************************************************/
+
+cardano_error_t
+_cbor_reader_push_data_item(cardano_cbor_reader_t* reader, const cardano_cbor_major_type_t type, const int64_t definite_length)
+{
+  assert(reader != NULL);
+
+  cbor_reader_stack_frame_t* frame = _cardano_malloc(sizeof(cbor_reader_stack_frame_t));
+
+  if (frame == NULL)
+  {
+    cardano_object_set_last_error(&reader->base, "Failed to allocate memory for stack frame.");
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  frame->base.ref_count     = 0;
+  frame->base.deallocator   = _cardano_free;
+  frame->base.last_error[0] = '\0';
+
+  frame->type               = reader->current_frame.type;
+  frame->frame_offset       = reader->current_frame.frame_offset;
+  frame->definite_length    = reader->current_frame.definite_length;
+  frame->items_read         = reader->current_frame.items_read;
+  frame->current_key_offset = reader->current_frame.current_key_offset;
+
+  const size_t old_size = cardano_array_get_size(reader->nested_items);
+  const size_t new_size = cardano_array_push(reader->nested_items, &frame->base);
+
+  if (new_size <= old_size)
+  {
+    cardano_object_unref((cardano_object_t**)((void*)&frame));
+    cardano_object_set_last_error(&reader->base, "Failed to add stack frame to nested items.");
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  reader->current_frame.type               = type;
+  reader->current_frame.definite_length    = definite_length;
+  reader->current_frame.frame_offset       = reader->offset;
+  reader->current_frame.items_read         = 0;
+  reader->current_frame.current_key_offset = -1;
+  reader->is_tag_context                   = false;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_pop_data_item(cardano_cbor_reader_t* reader, const cardano_cbor_major_type_t expected_type)
+{
+  assert(reader != NULL);
+
+  if ((reader->current_frame.type == CARDANO_CBOR_MAJOR_TYPE_UNDEFINED) || (cardano_array_get_size(reader->nested_items) == 0U))
+  {
+    cardano_object_set_last_error(&reader->base, "Is at root context.");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (expected_type != reader->current_frame.type)
+  {
+    char buffer[64] = { 0 };
+
+    const int written = snprintf(buffer, sizeof(buffer), "Pop major type mismatch, expected %d but got %d.", expected_type, reader->current_frame.type);
+
+    if (written < 0)
+    {
+      cardano_object_set_last_error(&reader->base, "Pop major type mismatch (Failed to write detailed error message).");
+      return CARDANO_ERROR_DECODING;
+    }
+
+    cardano_object_set_last_error(&reader->base, buffer);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if ((reader->current_frame.definite_length != INDEFINITE_LENGTH) && ((reader->current_frame.definite_length - (int64_t)reader->current_frame.items_read) > 0))
+  {
+    cardano_object_set_last_error(&reader->base, "Not at end of definite length data item.");
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (reader->is_tag_context)
+  {
+    cardano_object_set_last_error(&reader->base, "Tag not followed by value.");
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  cardano_object_t* item = cardano_array_pop(reader->nested_items);
+
+  cbor_reader_restore_stack_frame(reader, (cbor_reader_stack_frame_t*)((void*)item));
+
+  cardano_object_unref(&item);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_peek_initial_byte(cardano_cbor_reader_t* reader, const cardano_cbor_major_type_t expected_type, byte_t* initial_byte)
+{
+  assert(reader != NULL);
+  assert(initial_byte != NULL);
+
+  const size_t buffer_size = cardano_buffer_get_size(reader->buffer);
+
+  if (reader->offset >= buffer_size)
+  {
+    if ((reader->current_frame.type == CARDANO_CBOR_MAJOR_TYPE_UNDEFINED) && (reader->current_frame.definite_length == INDEFINITE_LENGTH) && (reader->offset > 0U))
+    {
+      cardano_object_set_last_error(&reader->base, "End of root-level. No more data items to read.");
+      return CARDANO_ERROR_DECODING;
+    }
+
+    cardano_object_set_last_error(&reader->base, "Unexpected end of buffer.");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  byte_t*                              buffer_data      = cardano_buffer_get_data(reader->buffer);
+  const byte_t                         tmp_initial_byte = buffer_data[reader->offset];
+  const cardano_cbor_major_type_t      major_type       = cardano_cbor_initial_byte_get_major_type(tmp_initial_byte);
+  const cardano_cbor_additional_info_t additional_info  = cardano_cbor_initial_byte_get_additional_info(tmp_initial_byte);
+
+  if ((reader->current_frame.definite_length != INDEFINITE_LENGTH) && ((reader->current_frame.definite_length - (int64_t)reader->current_frame.items_read) == 0))
+  {
+    cardano_object_set_last_error(&reader->base, "No more data items to read.");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  switch (reader->current_frame.type)
+  {
+    case CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING:
+    case CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING:
+      if (tmp_initial_byte == CBOR_INITIAL_BYTE_INDEFINITE_LENGTH_BREAK)
+      {
+        break;
+      }
+
+      if (major_type == reader->current_frame.type)
+      {
+        if (additional_info != CARDANO_CBOR_ADDITIONAL_INFO_INDEFINITE_LENGTH)
+        {
+          break;
+        }
+      }
+      else
+      {
+        cardano_object_set_last_error(&reader->base, "Indefinite length string contains invalid data item.");
+        return CARDANO_ERROR_DECODING;
+      }
+      break;
+    default:
+      break;
+  }
+
+  if ((expected_type != CARDANO_CBOR_MAJOR_TYPE_UNDEFINED) && (expected_type != major_type))
+  {
+    cardano_object_set_last_error(&reader->base, "Major type mismatch.");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *initial_byte = tmp_initial_byte;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_advance_buffer(cardano_cbor_reader_t* reader, const size_t length)
+{
+  assert(reader != NULL);
+
+  const size_t buffer_size = cardano_buffer_get_size(reader->buffer);
+
+  if ((reader->offset + length) > buffer_size)
+  {
+    cardano_object_set_last_error(&reader->base, "Buffer offset out of bounds.");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  reader->offset       += length;
+  reader->cached_state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+_cbor_reader_advance_data_item_counters(cardano_cbor_reader_t* reader)
+{
+  assert(reader != NULL);
+
+  reader->current_frame.items_read++;
+  reader->is_tag_context = false;
+}
+
+cardano_error_t
+_cbor_reader_skip_next_node(cardano_cbor_reader_t* reader, size_t* depth)
+{
+  assert(reader != NULL);
+  assert(depth != NULL);
+
+  cardano_cbor_reader_state_t state             = CARDANO_CBOR_READER_STATE_UNDEFINED;
+  const cardano_error_t       peek_state_result = peek_state_core(reader, &state);
+
+  if (peek_state_result != CARDANO_SUCCESS)
+  {
+    return peek_state_result;
+  }
+
+  while (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t result = _cbor_reader_skip_tag(reader);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_error_t peek_result = peek_state_core(reader, &state);
+
+    if (peek_result != CARDANO_SUCCESS)
+    {
+      return peek_result;
+    }
+  }
+
+  switch (state)
+  {
+    case CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER:
+    {
+      uint64_t              value  = 0;
+      const cardano_error_t result = cardano_cbor_reader_read_uint(reader, &value);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      CARDANO_UNUSED(value);
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_NEGATIVE_INTEGER:
+    {
+      uint64_t              value  = 0U;
+      const cardano_error_t result = cardano_cbor_reader_read_negative_int(reader, &value);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      CARDANO_UNUSED(value);
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_BYTESTRING:
+    {
+      cardano_buffer_t*     byte_string = NULL;
+      const cardano_error_t result      = cardano_cbor_reader_read_bytestring(reader, &byte_string);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      cardano_buffer_unref(&byte_string);
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_TEXTSTRING:
+    {
+      cardano_buffer_t*     text_string = NULL;
+      const cardano_error_t result      = cardano_cbor_reader_read_textstring(reader, &text_string);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      cardano_buffer_unref(&text_string);
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_START_INDEFINITE_LENGTH_BYTESTRING:
+    {
+      const cardano_error_t result = _cbor_reader_read_start_indefinite_length_string(reader, CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      const size_t newDepth = *depth + 1;
+      *depth                = newDepth;
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_END_INDEFINITE_LENGTH_BYTESTRING:
+    {
+      const cardano_error_t result = _cbor_reader_read_end_indefinite_length_string(reader, CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      const size_t newDepth = *depth - 1;
+      *depth                = newDepth;
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_START_INDEFINITE_LENGTH_TEXTSTRING:
+    {
+      const cardano_error_t result = _cbor_reader_read_start_indefinite_length_string(reader, CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      const size_t newDepth = *depth + 1;
+      *depth                = newDepth;
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_END_INDEFINITE_LENGTH_TEXTSTRING:
+    {
+      const cardano_error_t result = _cbor_reader_read_end_indefinite_length_string(reader, CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      const size_t newDepth = *depth - 1;
+      *depth                = newDepth;
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_START_ARRAY:
+    {
+      int64_t               value  = 0;
+      const cardano_error_t result = cardano_cbor_reader_read_start_array(reader, &value);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      const size_t newDepth = *depth + 1;
+      *depth                = newDepth;
+
+      CARDANO_UNUSED(value);
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_END_ARRAY:
+    {
+      const cardano_error_t result = cardano_cbor_reader_read_end_array(reader);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      const size_t newDepth = *depth - 1;
+      *depth                = newDepth;
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_START_MAP:
+    {
+      int64_t               value  = 0;
+      const cardano_error_t result = cardano_cbor_reader_read_start_map(reader, &value);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      const size_t newDepth = *depth + 1;
+      *depth                = newDepth;
+
+      CARDANO_UNUSED(value);
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_END_MAP:
+    {
+      const cardano_error_t result = cardano_cbor_reader_read_end_map(reader);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      const size_t newDepth = *depth - 1;
+      *depth                = newDepth;
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_HALF_PRECISION_FLOAT:
+    case CARDANO_CBOR_READER_STATE_SINGLE_PRECISION_FLOAT:
+    case CARDANO_CBOR_READER_STATE_DOUBLE_PRECISION_FLOAT:
+    {
+      double                value  = 0.0;
+      const cardano_error_t result = cardano_cbor_reader_read_double(reader, &value);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      CARDANO_UNUSED(value);
+    }
+    break;
+    case CARDANO_CBOR_READER_STATE_NULL:
+    case CARDANO_CBOR_READER_STATE_BOOLEAN:
+    case CARDANO_CBOR_READER_STATE_SIMPLE_VALUE:
+    {
+      cardano_cbor_simple_value_t value  = CARDANO_CBOR_SIMPLE_VALUE_UNDEFINED;
+      const cardano_error_t       result = cardano_cbor_reader_read_simple_value(reader, &value);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      CARDANO_UNUSED(value);
+    }
+    break;
+    default:
+      cardano_cbor_reader_set_last_error(reader, "Skip invalid state.");
+      return CARDANO_ERROR_DECODING;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_peek_state(cardano_cbor_reader_t* reader, cardano_cbor_reader_state_t* state)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (state == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader->cached_state == CARDANO_CBOR_READER_STATE_UNDEFINED)
+  {
+    const cardano_error_t error = peek_state_core(reader, &reader->cached_state);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  *state = reader->cached_state;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/cbor/cbor_reader/cbor_reader_core.h b/vendor/src/cbor/cbor_reader/cbor_reader_core.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader/cbor_reader_core.h
@@ -0,0 +1,196 @@
+/**
+ * \file cbor_reader_core.h
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_CORE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_CORE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_major_type.h>
+#include <cardano/cbor/cbor_reader_state.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/typedefs.h>
+
+#include "../../collections/array.h"
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The stack frame to keep track of nested item data.
+ */
+typedef struct cbor_reader_stack_frame_t
+{
+    cardano_object_t          base;
+    cardano_cbor_major_type_t type;
+    uint64_t                  frame_offset;
+    int64_t                   definite_length;
+    uint64_t                  items_read;
+    int64_t                   current_key_offset;
+} cbor_reader_stack_frame_t;
+
+/**
+ * \brief A simple reader for Concise Binary Object Representation (CBOR) encoded data.
+ */
+typedef struct cardano_cbor_reader_t
+{
+    cardano_object_t            base;
+    cardano_buffer_t*           buffer;
+    uint64_t                    offset;
+    cardano_array_t*            nested_items;
+    bool                        is_tag_context;
+    cbor_reader_stack_frame_t   current_frame;
+    cardano_cbor_reader_state_t cached_state;
+} cardano_cbor_reader_t;
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Pushes a new data item onto the CBOR reader's state stack.
+ *
+ * This internal function is used to update the CBOR reader's state when it encounters a new data item
+ * of a specific major type and length. It handles both definite and indefinite length data items.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance that is parsing the CBOR data.
+ * \param[in] type The CBOR major type of the new data item encountered.
+ * \param[in] definite_length The length of the data item if it is of definite length. For indefinite length
+ *                            data items, this parameter should be set to a special value (e.g., -1) to indicate
+ *                            the indefinite length nature of the item.
+ *
+ * \return A \ref cardano_error_t indicating the success of the operation. \c CARDANO_SUCCESS is returned if
+ *         the new data item was successfully pushed onto the state stack, allowing for correct parsing of
+ *         nested structures. If an error occurs, an appropriate error code is returned, indicating the issue
+ *         encountered during this state update operation.
+ */
+cardano_error_t
+_cbor_reader_push_data_item(cardano_cbor_reader_t* reader, cardano_cbor_major_type_t type, int64_t definite_length);
+
+/**
+ * \brief Removes the most recently read data item from the reader's internal stack, verifying it matches
+ * the expected major type.
+ *
+ * This function is used to ensure the data item just read from the CBOR stream matches an expected major type.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance that is processing the CBOR stream.
+ * \param[in] expected_type The \ref cardano_cbor_major_type_t that the most recently read data item is expected to be.
+ *
+ * \return A \ref cardano_error_t indicating the outcome of the operation. If the most recently read data
+ * item matches the expected major type, \ref CARDANO_SUCCESS is returned, and the item is removed from
+ * the reader's internal stack. If the data item does not match the expected type, an error code is returned
+ * to indicate the type mismatch. Other error codes may be returned to indicate different failure conditions,
+ * such as attempting to pop an item from an empty stack.
+ */
+cardano_error_t
+_cbor_reader_pop_data_item(cardano_cbor_reader_t* reader, cardano_cbor_major_type_t expected_type);
+
+/**
+ * \brief Peeks at the next initial byte in the CBOR stream without advancing the reader.
+ *
+ * This function allows for inspecting the next initial byte in the CBOR data stream to verify it matches
+ * an expected CBOR major type.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance, representing the CBOR stream being parsed.
+ * \param[in] expected_type The CBOR major type that the function expects to find as the next initial byte. This is used
+ * to validate the data's structure before proceeding with parsing operations.
+ * \param[out] initial_byte A pointer to a byte variable where the function will store the value of the next initial byte
+ * if it matches the expected type. This parameter allows the caller to inspect the initial byte value for further processing.
+ *
+ * \return A \ref cardano_error_t indicating the success of the operation. \c CARDANO_SUCCESS is returned if the next initial
+ * byte matches the expected type and the operation completes successfully. If the next initial byte does not match the expected
+ * type or if another error occurs, an appropriate error code is returned.
+ */
+cardano_error_t
+_cbor_reader_peek_initial_byte(cardano_cbor_reader_t* reader, cardano_cbor_major_type_t expected_type, byte_t* initial_byte);
+
+/**
+ * \brief Advances the internal buffer of the CBOR reader by a specified length.
+ *
+ * This function is used to move the CBOR reader's internal pointer forward, effectively skipping over
+ * a given number of bytes in the buffer.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance.
+ * \param[in] length The number of bytes to advance the buffer by. The reader's internal pointer will be
+ * moved forward by this amount, bypassing the corresponding segment of the buffer.
+ *
+ * \return A \ref cardano_error_t indicating the success of the operation. \c CARDANO_SUCCESS is returned
+ * if the buffer was successfully advanced. If attempting to advance beyond the bounds of the buffer or
+ * another error occurs, an appropriate error code is returned.
+ */
+cardano_error_t
+_cbor_reader_advance_buffer(cardano_cbor_reader_t* reader, size_t length);
+
+/**
+ * \brief The function increments the reader's data item counter, which tracks the number of data items
+ * that have been parsed.
+ *
+ * This internal utility function updates the CBOR reader's state to reflect the completion
+ * of parsing a data item. It is typically called after a data item has been successfully
+ * read from the buffer, to prepare the reader for processing the next item.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance. This instance's internal
+ * state will be updated to account for the advancement past a data item.
+ */
+void
+_cbor_reader_advance_data_item_counters(cardano_cbor_reader_t* reader);
+
+/**
+ * \brief Skips the next node in the CBOR data structure, tracking the depth.
+ *
+ * This function advances the reader past the next data node, which may be a single data item
+ * or a more complex structure such as an array or a map. When encountering nested structures,
+ * the function recursively processes each nested node, ensuring that the reader is correctly
+ * positioned after the entire structure has been skipped.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance. This instance's position
+ * will be advanced past the next node in the CBOR data stream.
+ * \param[out] depth A pointer to a size_t variable where the function can store the depth
+ * of nesting encountered while skipping the node.
+ *
+ * \return A \ref cardano_error_t indicating the result of the skip operation. \ref CARDANO_SUCCESS is
+ * returned if the next node is successfully skipped. If an error occurs during the skip, such as
+ * encountering malformed CBOR data or reaching the end of the buffer unexpectedly, an appropriate
+ * error code is returned indicating the failure reason.
+ */
+cardano_error_t
+_cbor_reader_skip_next_node(cardano_cbor_reader_t* reader, size_t* depth);
+
+/**
+ * \brief Peeks at the current state of the CBOR reader without advancing its position.
+ *
+ * This function examines the current position of the CBOR reader to determine the state of the
+ * next data item in the CBOR stream. Allowing the caller to make informed decisions on how to proceed
+ * with parsing.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance whose current state is
+ * being queried.
+ * \param[out] state A pointer to a \ref cardano_cbor_reader_state_t structure where the function will
+ * store information about the current state of the reader.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation. \ref CARDANO_SUCCESS is
+ * returned if the reader's state is successfully obtained. If an error occurs, such as if the reader
+ * is at the end of the stream or if there is malformed CBOR data, an appropriate error code is
+ * returned indicating the failure reason.
+ */
+cardano_error_t
+_cbor_reader_peek_state(cardano_cbor_reader_t* reader, cardano_cbor_reader_state_t* state);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_CORE_H
diff --git a/vendor/src/cbor/cbor_reader/cbor_reader_numeric.c b/vendor/src/cbor/cbor_reader/cbor_reader_numeric.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader/cbor_reader_numeric.c
@@ -0,0 +1,726 @@
+/**
+ * \file cbor_reader_numeric.c
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "cbor_reader_numeric.h"
+#include "cbor_reader_core.h"
+
+#include <assert.h>
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/error.h>
+
+#include "../cbor_additional_info.h"
+#include "../cbor_initial_byte.h"
+
+#include <math.h>
+#include <stdio.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Peeks at the next signed integer in the CBOR stream without advancing the reader.
+ *
+ * This function inspects the CBOR stream to determine the value of the next signed integer
+ * (major types 0 and 1 for unsigned and negative integers, respectively) without consuming
+ * any data. This allows the caller to make decisions based on the integer's value without
+ * actually removing it from the stream.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance being operated on.
+ *                   The reader's position remains unchanged after calling this function.
+ * \param[out] signed_int A pointer to an \c int64_t variable where the function will store
+ *                        the value of the signed integer.
+ * \param[out] bytes_read A pointer to a \c size_t variable where the function will store
+ *                        the total number of bytes that the signed integer occupies in the CBOR stream.
+ *
+ * \return A \ref cardano_error_t indicating the result of the operation. \ref CARDANO_SUCCESS is
+ * returned if a signed integer is successfully peeked at. If the next item in the stream is not
+ * a signed integer or if an error occurs during processing, an appropriate error code is
+ * returned to indicate the failure reason.
+ */
+static cardano_error_t
+peek_signed_integer(cardano_cbor_reader_t* reader, int64_t* signed_int, size_t* bytes_read)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(signed_int != NULL);
+  assert(bytes_read != NULL);
+
+  byte_t          header = 0;
+  cardano_error_t result = _cbor_reader_peek_initial_byte(reader, CARDANO_CBOR_MAJOR_TYPE_UNDEFINED, &header);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_major_type_t major_type = cardano_cbor_initial_byte_get_major_type(header);
+
+  switch (major_type)
+  {
+    case CARDANO_CBOR_MAJOR_TYPE_UNSIGNED_INTEGER:
+    {
+      uint64_t unsigned_int = 0;
+      size_t   read         = 0;
+
+      cardano_buffer_t* buffer = NULL;
+
+      cardano_error_t remainder_bytes_result = cardano_cbor_reader_get_remainder_bytes(reader, &buffer);
+
+      if (remainder_bytes_result != CARDANO_SUCCESS)
+      {
+        return remainder_bytes_result;
+      }
+
+      cardano_error_t decode_result = _cbor_reader_decode_unsigned_integer(buffer, header, &unsigned_int, &read);
+
+      cardano_buffer_unref(&buffer);
+
+      if (decode_result != CARDANO_SUCCESS)
+      {
+        return decode_result;
+      }
+
+      if (unsigned_int > (uint64_t)INT64_MAX)
+      {
+        cardano_object_set_last_error(&reader->base, "Signed integer out of range.");
+        return CARDANO_ERROR_INTEGER_OVERFLOW;
+      }
+
+      *signed_int = (int64_t)unsigned_int;
+      *bytes_read = read;
+      break;
+    }
+    case CARDANO_CBOR_MAJOR_TYPE_NEGATIVE_INTEGER:
+    {
+      uint64_t unsigned_int = 0;
+      size_t   read         = 0;
+
+      cardano_buffer_t* buffer = NULL;
+
+      cardano_error_t remainder_bytes_result = cardano_cbor_reader_get_remainder_bytes(reader, &buffer);
+
+      if (remainder_bytes_result != CARDANO_SUCCESS)
+      {
+        return remainder_bytes_result;
+      }
+
+      cardano_error_t decode_result = _cbor_reader_decode_unsigned_integer(buffer, header, &unsigned_int, &read);
+
+      cardano_buffer_unref(&buffer);
+
+      if (decode_result != CARDANO_SUCCESS)
+      {
+        return decode_result;
+      }
+
+      if (unsigned_int > (uint64_t)INT64_MAX)
+      {
+        cardano_object_set_last_error(&reader->base, "Signed integer out of range.");
+        return CARDANO_ERROR_INTEGER_OVERFLOW;
+      }
+
+      *signed_int = (int64_t)(-1) - (int64_t)unsigned_int;
+      *bytes_read = read;
+      break;
+    }
+    default:
+    {
+      char buffer[64] = { 0 };
+
+      int32_t written = snprintf(buffer, sizeof(buffer), "Reader type mismatch, expected %d or %d but got %d.", CARDANO_CBOR_MAJOR_TYPE_UNSIGNED_INTEGER, CARDANO_CBOR_MAJOR_TYPE_NEGATIVE_INTEGER, major_type);
+
+      if (written < 0)
+      {
+        cardano_object_set_last_error(&reader->base, "Reader type mismatch (Failed to write detailed error message).");
+        return CARDANO_ERROR_DECODING;
+      }
+
+      cardano_object_set_last_error(&reader->base, buffer);
+
+      return CARDANO_ERROR_DECODING;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Peeks at the next unsigned integer in the CBOR stream without advancing the reader.
+ *
+ * This function examines the CBOR stream to ascertain the value of the next unsigned integer
+ * (major type 0) without consuming any data from the stream.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance being processed.
+ *                   The reader's current position within the stream is unchanged after this
+ *                   function is called.
+ *
+ * \param[out] unsigned_int A pointer to a \c uint64_t variable where the function will store
+ *                          the value of the unsigned integer found in the stream.
+ *
+ * \param[out] bytes_read A pointer to a \c size_t variable where the function will store
+ *                        the total number of bytes occupied by the unsigned integer within
+ *                        the CBOR stream.
+ *
+ * \return A \ref cardano_error_t indicating the outcome of the operation. If an unsigned integer
+ * is successfully identified, \ref CARDANO_SUCCESS is returned. If the next item in the stream is
+ * not an unsigned integer or if a processing error occurs, an appropriate error code will be
+ * returned to denote the specific reason for failure.
+ */
+static cardano_error_t
+peek_unsigned_integer(cardano_cbor_reader_t* reader, uint64_t* signed_int, size_t* bytes_read)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(signed_int != NULL);
+  assert(bytes_read != NULL);
+
+  byte_t          header = 0;
+  cardano_error_t result = _cbor_reader_peek_initial_byte(reader, CARDANO_CBOR_MAJOR_TYPE_UNDEFINED, &header);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_major_type_t major_type = cardano_cbor_initial_byte_get_major_type(header);
+
+  switch (major_type)
+  {
+    case CARDANO_CBOR_MAJOR_TYPE_UNSIGNED_INTEGER:
+    {
+      uint64_t unsigned_int = 0;
+      size_t   read         = 0;
+
+      cardano_buffer_t* buffer = NULL;
+
+      cardano_error_t remainder_bytes_result = cardano_cbor_reader_get_remainder_bytes(reader, &buffer);
+
+      if (remainder_bytes_result != CARDANO_SUCCESS)
+      {
+        return remainder_bytes_result;
+      }
+
+      cardano_error_t decode_result = _cbor_reader_decode_unsigned_integer(buffer, header, &unsigned_int, &read);
+
+      cardano_buffer_unref(&buffer);
+
+      if (decode_result != CARDANO_SUCCESS)
+      {
+        return decode_result;
+      }
+
+      *signed_int = unsigned_int;
+      *bytes_read = read;
+      return CARDANO_SUCCESS;
+    }
+    case CARDANO_CBOR_MAJOR_TYPE_NEGATIVE_INTEGER:
+    {
+      cardano_object_set_last_error(&reader->base, "Integer overflow.");
+      return CARDANO_ERROR_DECODING;
+    }
+    default:
+    {
+      char buffer[64] = { 0 };
+
+      int32_t written = snprintf(buffer, sizeof(buffer), "Reader type mismatch, expected %d but got %d.", CARDANO_CBOR_MAJOR_TYPE_UNSIGNED_INTEGER, major_type);
+
+      if (written < 0)
+      {
+        cardano_object_set_last_error(&reader->base, "Reader type mismatch (Failed to write detailed error message).");
+        return CARDANO_ERROR_DECODING;
+      }
+
+      cardano_object_set_last_error(&reader->base, buffer);
+
+      return CARDANO_ERROR_DECODING;
+    }
+  }
+}
+
+/**
+ * \brief Decodes a half-precision floating point number from the buffer into a double.
+ *
+ * This function decodes a floating point number encoded in half-precision (16 bits) format
+ * stored in a given buffer and converts it into a double precision floating point number.
+ *
+ * \param[in] buffer A pointer to the \ref cardano_buffer_t instance that contains the half-precision
+ *                   floating point number to be decoded. The buffer should contain at least 2 bytes of
+ *                   data representing the half-precision float.
+ * \param[out] value A pointer to a double variable where the decoded double precision floating point
+ *                   number will be stored. The decoded value is calculated by extending the precision
+ *                   of the half-precision float to fit the double precision format.
+ *
+ * \return A \ref cardano_error_t indicating the outcome of the operation. If the half-precision float is
+ * successfully decoded, \ref CARDANO_SUCCESS is returned. If an error occurs during decoding, such as if the
+ * buffer does not contain sufficient data to represent a half-precision float, an appropriate error code will
+ * be returned to denote the specific reason for failure.
+ */
+static cardano_error_t
+decode_half_precision_float(cardano_buffer_t* buffer, double* value)
+{
+  assert(buffer != NULL);
+  assert(value != NULL);
+
+  uint16_t              half   = 0;
+  const cardano_error_t result = cardano_buffer_read_uint16_be(buffer, &half);
+
+  assert(result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(result);
+
+  const uint16_t exp  = (half >> 10) & (byte_t)0x1f;
+  const uint16_t mant = half & (uint16_t)0x03ff;
+
+  double val = 0.0;
+
+  if (exp == 0U)
+  {
+    val = ldexp(mant, -24);
+  }
+  else if (exp != 31U)
+  {
+    val = ldexp(mant + 1024u, (int16_t)exp - 25);
+  }
+  else
+  {
+    val = (mant == 0U) ? INFINITY : NAN;
+  }
+
+  *value = (half & (uint16_t)0x8000) ? -val : val;
+
+  return CARDANO_SUCCESS;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+_cbor_reader_decode_unsigned_integer(cardano_buffer_t* buffer, byte_t header, uint64_t* unsigned_int, size_t* bytes_read)
+{
+  static const byte_t additional_information_mask = 0b00011111;
+
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(unsigned_int != NULL);
+  assert(bytes_read != NULL);
+
+  if ((header & additional_information_mask) < (byte_t)CARDANO_CBOR_ADDITIONAL_INFO_8BIT_DATA)
+  {
+    *bytes_read   = 1;
+    *unsigned_int = cardano_cbor_initial_byte_get_additional_info(header);
+    return CARDANO_SUCCESS;
+  }
+
+  switch (cardano_cbor_initial_byte_get_additional_info(header))
+  {
+    case CARDANO_CBOR_ADDITIONAL_INFO_8BIT_DATA:
+    {
+      if (cardano_buffer_get_size(buffer) < 2U)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      byte_t          data[2] = { 0, 0 };
+      cardano_error_t result  = cardano_buffer_read(buffer, &data[0], 2);
+
+      assert(result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(result);
+
+      *bytes_read   = 2;
+      *unsigned_int = (uint64_t)data[1];
+
+      break;
+    }
+    case CARDANO_CBOR_ADDITIONAL_INFO_16BIT_DATA:
+    {
+      if (cardano_buffer_get_size(buffer) < 3U)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      uint16_t data    = 0;
+      byte_t   to_skip = 0;
+
+      cardano_error_t result = cardano_buffer_read(buffer, &to_skip, 1);
+
+      assert(result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(result);
+
+      result = cardano_buffer_read_uint16_be(buffer, &data);
+
+      assert(result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(result);
+
+      *bytes_read   = 3;
+      *unsigned_int = (uint64_t)data;
+
+      break;
+    }
+    case CARDANO_CBOR_ADDITIONAL_INFO_32BIT_DATA:
+    {
+      if (cardano_buffer_get_size(buffer) < 5U)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      uint32_t data    = 0;
+      byte_t   to_skip = 0;
+
+      cardano_error_t result = cardano_buffer_read(buffer, &to_skip, 1);
+
+      assert(result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(result);
+
+      result = cardano_buffer_read_uint32_be(buffer, &data);
+
+      assert(result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(result);
+
+      *bytes_read   = 5;
+      *unsigned_int = (uint64_t)data;
+
+      break;
+    }
+    case CARDANO_CBOR_ADDITIONAL_INFO_64BIT_DATA:
+    {
+      if (cardano_buffer_get_size(buffer) < 9U)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      uint64_t data    = 0;
+      byte_t   to_skip = 0;
+
+      cardano_error_t result = cardano_buffer_read(buffer, &to_skip, 1);
+
+      assert(result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(result);
+
+      result = cardano_buffer_read_uint64_be(buffer, &data);
+
+      assert(result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(result);
+
+      *bytes_read   = 9;
+      *unsigned_int = data;
+
+      break;
+    }
+    default:
+      return CARDANO_ERROR_DECODING;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_double(cardano_cbor_reader_t* reader, double* value)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  byte_t          header = 0;
+  cardano_error_t result = _cbor_reader_peek_initial_byte(reader, CARDANO_CBOR_MAJOR_TYPE_SIMPLE, &header);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_additional_info_t additional_info = cardano_cbor_initial_byte_get_additional_info(header);
+
+  cardano_buffer_t* buffer                 = NULL;
+  cardano_error_t   remainder_bytes_result = cardano_cbor_reader_get_remainder_bytes(reader, &buffer);
+
+  if (remainder_bytes_result != CARDANO_SUCCESS)
+  {
+    return remainder_bytes_result;
+  }
+
+  byte_t          to_skip     = 0;
+  cardano_error_t skip_result = cardano_buffer_read(buffer, &to_skip, 1);
+
+  assert(skip_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(skip_result);
+
+  switch (additional_info)
+  {
+    case CARDANO_CBOR_ADDITIONAL_INFO_16BIT_DATA:
+    {
+      if (cardano_buffer_get_size(buffer) < 3U)
+      {
+        cardano_buffer_unref(&buffer);
+        return CARDANO_ERROR_DECODING;
+      }
+
+      double half_precision = 0.0;
+
+      cardano_error_t decode_result = decode_half_precision_float(buffer, &half_precision);
+
+      assert(decode_result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(decode_result);
+
+      cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, 3);
+
+      assert(advance_result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(advance_result);
+
+      _cbor_reader_advance_data_item_counters(reader);
+      cardano_buffer_unref(&buffer);
+
+      *value = half_precision;
+      break;
+    }
+    case CARDANO_CBOR_ADDITIONAL_INFO_32BIT_DATA:
+    {
+      if (cardano_buffer_get_size(buffer) < 5U)
+      {
+        cardano_buffer_unref(&buffer);
+        return CARDANO_ERROR_DECODING;
+      }
+
+      float single_precision = 0.0f;
+
+      cardano_error_t decode_result = cardano_buffer_read_float_be(buffer, &single_precision);
+
+      assert(decode_result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(decode_result);
+
+      cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, 5);
+
+      assert(advance_result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(advance_result);
+
+      _cbor_reader_advance_data_item_counters(reader);
+      cardano_buffer_unref(&buffer);
+      *value = single_precision;
+      break;
+    }
+    case CARDANO_CBOR_ADDITIONAL_INFO_64BIT_DATA:
+    {
+      if (cardano_buffer_get_size(buffer) < 9U)
+      {
+        cardano_buffer_unref(&buffer);
+        return CARDANO_ERROR_DECODING;
+      }
+
+      double          double_precision = 0.0;
+      cardano_error_t decode_result    = cardano_buffer_read_double_be(buffer, &double_precision);
+
+      assert(decode_result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(decode_result);
+
+      cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, 9);
+
+      assert(advance_result == CARDANO_SUCCESS);
+      CARDANO_UNUSED(advance_result);
+
+      _cbor_reader_advance_data_item_counters(reader);
+      cardano_buffer_unref(&buffer);
+
+      *value = double_precision;
+      break;
+    }
+    default:
+      cardano_buffer_unref(&buffer);
+      cardano_cbor_reader_set_last_error(reader, "Not a float encoding");
+      return CARDANO_ERROR_DECODING;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_int(cardano_cbor_reader_t* reader, int64_t* value)
+{
+  int64_t signed_int = 0;
+  size_t  bytes_read = 0;
+
+  cardano_error_t result = peek_signed_integer(reader, &signed_int, &bytes_read);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, bytes_read);
+
+  assert(advance_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(advance_result);
+
+  _cbor_reader_advance_data_item_counters(reader);
+  *value = signed_int;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_uint(cardano_cbor_reader_t* reader, uint64_t* value)
+{
+  uint64_t unsigned_int = 0;
+  size_t   bytes_read   = 0;
+
+  cardano_error_t result = peek_unsigned_integer(reader, &unsigned_int, &bytes_read);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, bytes_read);
+
+  assert(advance_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(advance_result);
+
+  _cbor_reader_advance_data_item_counters(reader);
+  *value = unsigned_int;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_negative_int(cardano_cbor_reader_t* reader, uint64_t* argument)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (argument == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  byte_t          header = 0;
+  cardano_error_t result = _cbor_reader_peek_initial_byte(reader, CARDANO_CBOR_MAJOR_TYPE_NEGATIVE_INTEGER, &header);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_buffer_t* buffer = NULL;
+
+  result = cardano_cbor_reader_get_remainder_bytes(reader, &buffer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  uint64_t value      = 0;
+  size_t   bytes_read = 0;
+
+  result = _cbor_reader_decode_unsigned_integer(buffer, header, &value, &bytes_read);
+
+  cardano_buffer_unref(&buffer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, bytes_read);
+
+  assert(advance_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(advance_result);
+
+  _cbor_reader_advance_data_item_counters(reader);
+  *argument = value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_reader_read_bigint(cardano_cbor_reader_t* reader, cardano_bigint_t** bigint)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bigint == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_tag_t tag = CARDANO_CBOR_TAG_UNSIGNED_BIG_NUM;
+
+  cardano_error_t result = cardano_cbor_reader_read_tag(reader, &tag);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_buffer_t* buffer = NULL;
+  result                   = cardano_cbor_reader_read_bytestring(reader, &buffer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&buffer);
+    return result;
+  }
+
+  result = cardano_bigint_from_bytes(cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer), CARDANO_BYTE_ORDER_BIG_ENDIAN, bigint);
+
+  cardano_buffer_unref(&buffer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_bigint_t* copy = NULL;
+  result                 = cardano_bigint_clone(*bigint, &copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_bigint_unref(bigint);
+    return result;
+  }
+
+  if (tag == CARDANO_CBOR_TAG_NEGATIVE_BIG_NUM)
+  {
+    cardano_bigint_negate(copy, *bigint);
+    cardano_bigint_decrement(*bigint);
+  }
+
+  cardano_bigint_unref(&copy);
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/cbor/cbor_reader/cbor_reader_numeric.h b/vendor/src/cbor/cbor_reader/cbor_reader_numeric.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader/cbor_reader_numeric.h
@@ -0,0 +1,161 @@
+/**
+ * \file cbor_reader_numeric.h
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_NUMERIC_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_NUMERIC_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Decodes an unsigned integer from a buffer based on the provided CBOR header.
+ *
+ * This function is designed to decode an unsigned integer encoded in CBOR format from a given buffer.
+ * The CBOR encoding for integers uses a header byte to indicate the size and format of the integer that follows.
+ * This function interprets the header byte and reads the subsequent bytes from the buffer to reconstruct the
+ * unsigned integer value.
+ *
+ * \param[in] buffer A pointer to the \ref cardano_buffer_t instance containing the CBOR encoded data.
+ * \param[in] header The CBOR header byte that precedes the encoded integer. This byte contains information
+ *                   about the integer's size and whether it is unsigned.
+ * \param[out] unsigned_int A pointer to a uint64_t variable where the decoded unsigned integer value will be stored.
+ * \param[out] bytes_read A pointer to a size_t variable where the number of bytes read from the buffer will be stored.
+ *                        This includes the header byte and any subsequent bytes that form the integer value.
+ *
+ * \return A \ref cardano_error_t indicating the outcome of the operation. \ref CARDANO_SUCCESS is returned if the unsigned
+ * integer is successfully decoded. If an error occurs, such as if the buffer does not contain enough data to represent
+ * the integer or if the header byte is invalid, an appropriate error code will be returned to indicate the specific
+ * reason for failure.
+ */
+cardano_error_t
+_cbor_reader_decode_unsigned_integer(cardano_buffer_t* buffer, byte_t header, uint64_t* unsigned_int, size_t* bytes_read);
+
+/**
+ * \brief Reads a double-precision floating point number from the CBOR stream.
+ *
+ * This function reads the next data item from the CBOR stream associated with the reader
+ * and interprets it as a double-precision floating point number (major type 7 with additional
+ * information indicating a double float). It is expected that the current position in the stream
+ * points to the start of a floating point data item. The function decodes the value and stores it
+ * in the provided double variable.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance that represents the CBOR
+ * stream from which the double value is to be read. The reader must have been previously initialized
+ * and positioned correctly within the CBOR data stream.
+ * \param[out] value A pointer to a double variable where the decoded floating point number will be stored.
+ * The value is overwritten with the decoded number if the operation succeeds.
+ *
+ * \return A \ref cardano_error_t indicating the result of the read operation. \ref CARDANO_SUCCESS is
+ * returned if a double-precision floating point number is successfully read from the stream and decoded.
+ * If the operation fails due to reasons such as incorrect stream positioning, unexpected data format,
+ * or end of stream before completing the read, an appropriate error code will be returned to indicate
+ * the failure reason.
+ */
+cardano_error_t
+_cbor_reader_read_double(cardano_cbor_reader_t* reader, double* value);
+
+/**
+ * \brief Reads a signed integer from the CBOR stream.
+ *
+ * This function reads the next data item from the CBOR stream associated with the reader
+ * and interprets it as a signed integer (major types 0 for positive integers and 1 for negative integers).
+ * It decodes the value and stores it in the provided int64_t variable. The function handles both
+ * positive and negative integers, adjusting the decoded value appropriately for negative integers.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance that represents the CBOR
+ *                   stream from which the signed integer is to be read.
+ * \param[out] value A pointer to an int64_t variable where the decoded signed integer will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the read operation. \ref CARDANO_SUCCESS is
+ * returned if a signed integer is successfully read from the stream and decoded. If the operation fails
+ * due to reasons such as incorrect stream positioning, unexpected data format, or end of stream before
+ * completing the read, an appropriate error code will be returned to indicate the failure reason.
+ */
+cardano_error_t
+_cbor_reader_read_int(cardano_cbor_reader_t* reader, int64_t* value);
+
+/**
+ * \brief Reads an unsigned integer from the CBOR stream.
+ *
+ * This function reads the next data item from the CBOR stream associated with the reader
+ * and interprets it as an unsigned integer (major type 0). It decodes the value and stores
+ * it in the provided uint64_t variable. This function is intended for reading positive integers
+ * encoded in the CBOR format.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance that represents the CBOR
+ *                   stream from which the unsigned integer is to be read.
+ * \param[out] value A pointer to a uint64_t variable where the decoded unsigned integer will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the read operation. \ref CARDANO_SUCCESS is
+ * returned if an unsigned integer is successfully read from the stream and decoded. If the operation fails
+ * due to reasons such as incorrect stream positioning, unexpected data format, or end of stream before
+ * completing the read, an appropriate error code will be returned to indicate the failure reason.
+ */
+cardano_error_t
+_cbor_reader_read_uint(cardano_cbor_reader_t* reader, uint64_t* value);
+
+/**
+ * \brief Reads a negative integer (major type 1) from the CBOR stream as its raw argument.
+ *
+ * A negative integer is encoded as an unsigned argument \c n and represents the value \c -1 - n.
+ * This function returns \c n unchanged, so the full range of the encoding, down to \c -2^64,
+ * can be read without overflowing a signed 64-bit integer.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance that represents the CBOR
+ *                   stream from which the negative integer is to be read.
+ * \param[out] argument A pointer to a uint64_t variable where the argument \c n will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the read operation. \ref CARDANO_SUCCESS is
+ * returned if a negative integer is successfully read from the stream. If the next data item is not
+ * a negative integer or the stream is malformed, an appropriate error code is returned.
+ */
+cardano_error_t
+_cbor_reader_read_negative_int(cardano_cbor_reader_t* reader, uint64_t* argument);
+
+/**
+ * \brief Decodes and reads a big integer (bignum) from CBOR format.
+ *
+ * This function reads and decodes a bignum from a provided CBOR reader, following the
+ * encoding format specified in RFC 7049, section 2.4.2. Bignums are used to represent
+ * integers that are too large to be represented directly in the available integer types
+ * of CBOR. The function interprets the appropriate tag and decodes the integer value: tag 2
+ * (unsigned bignum) yields the byte string magnitude \c n, and tag 3 (negative bignum) yields
+ * \c -1 - n, as defined in RFC 8949, section 3.4.3.
+ *
+ * \param[in] reader The \ref cardano_cbor_reader_t instance from which the bignum will be read.
+ * \param[out] bigint A pointer to a pointer that will be set to the address of the newly created \ref cardano_bigint_t object
+ *                    representing the decoded big integer value. The caller is responsible for managing the memory of this object.
+ *
+ * \return Returns \ref CARDANO_SUCCESS if the bignum value was successfully decoded and read from the
+ *         CBOR stream. If the operation encounters an error, such as invalid parameters or issues with
+ *         reading from the stream, an appropriate error code is returned indicating the reason for the failure.
+ *         Consult the \ref cardano_error_t documentation for details on possible error codes and their meanings.
+ */
+cardano_error_t
+_cardano_reader_read_bigint(cardano_cbor_reader_t* reader, cardano_bigint_t** bigint);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_NUMERIC_H
diff --git a/vendor/src/cbor/cbor_reader/cbor_reader_simple_values.c b/vendor/src/cbor/cbor_reader/cbor_reader_simple_values.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader/cbor_reader_simple_values.c
@@ -0,0 +1,132 @@
+/**
+ * \file cbor_reader_simple_values.c
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "cbor_reader_simple_values.h"
+#include "cbor_reader_core.h"
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/error.h>
+
+#include "../cbor_initial_byte.h"
+
+#include <assert.h>
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+_cbor_reader_read_boolean(cardano_cbor_reader_t* reader, bool* value)
+{
+  byte_t          header = 0;
+  cardano_error_t result = _cbor_reader_peek_initial_byte(reader, CARDANO_CBOR_MAJOR_TYPE_SIMPLE, &header);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_additional_info_t additional_info = cardano_cbor_initial_byte_get_additional_info(header);
+
+  if ((additional_info != CARDANO_CBOR_ADDITIONAL_INFO_TRUE) && (additional_info != CARDANO_CBOR_ADDITIONAL_INFO_FALSE))
+  {
+    cardano_cbor_reader_set_last_error(reader, "Not a boolean encoding");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *value = additional_info == CARDANO_CBOR_ADDITIONAL_INFO_TRUE;
+
+  CARDANO_UNUSED(_cbor_reader_advance_buffer(reader, 1));
+
+  _cbor_reader_advance_data_item_counters(reader);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_null(cardano_cbor_reader_t* reader)
+{
+  byte_t header = 0;
+
+  cardano_error_t result = _cbor_reader_peek_initial_byte(reader, CARDANO_CBOR_MAJOR_TYPE_SIMPLE, &header);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_additional_info_t additional_info = cardano_cbor_initial_byte_get_additional_info(header);
+
+  if (additional_info != CARDANO_CBOR_ADDITIONAL_INFO_NULL)
+  {
+    cardano_cbor_reader_set_last_error(reader, "Not a null encoding");
+    return CARDANO_ERROR_DECODING;
+  }
+
+  CARDANO_UNUSED(_cbor_reader_advance_buffer(reader, 1));
+
+  _cbor_reader_advance_data_item_counters(reader);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_read_simple_value(cardano_cbor_reader_t* reader, cardano_cbor_simple_value_t* value)
+{
+  byte_t          header = 0;
+  cardano_error_t result = _cbor_reader_peek_initial_byte(reader, CARDANO_CBOR_MAJOR_TYPE_SIMPLE, &header);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_additional_info_t additional_info = cardano_cbor_initial_byte_get_additional_info(header);
+
+  if (additional_info < CARDANO_CBOR_ADDITIONAL_INFO_8BIT_DATA)
+  {
+    CARDANO_UNUSED(_cbor_reader_advance_buffer(reader, 1));
+
+    _cbor_reader_advance_data_item_counters(reader);
+    *value = (cardano_cbor_simple_value_t)additional_info;
+    return CARDANO_SUCCESS;
+  }
+
+  if (additional_info == CARDANO_CBOR_ADDITIONAL_INFO_8BIT_DATA)
+  {
+    if (cardano_buffer_get_size(reader->buffer) <= (reader->offset + 1U))
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    byte_t simple_value = cardano_buffer_get_data(reader->buffer)[reader->offset + 1U];
+
+    CARDANO_UNUSED(_cbor_reader_advance_buffer(reader, 2));
+
+    _cbor_reader_advance_data_item_counters(reader);
+    *value = (cardano_cbor_simple_value_t)simple_value;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_cbor_reader_set_last_error(reader, "Not a simple value encoding");
+  return CARDANO_ERROR_DECODING;
+}
diff --git a/vendor/src/cbor/cbor_reader/cbor_reader_simple_values.h b/vendor/src/cbor/cbor_reader/cbor_reader_simple_values.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader/cbor_reader_simple_values.h
@@ -0,0 +1,93 @@
+/**
+ * \file cbor_reader_simple_values.h
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_SIMPLE_VALUES_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_SIMPLE_VALUES_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_simple_value.h>
+#include <cardano/error.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Reads a boolean value from the CBOR stream.
+ *
+ * This function reads the next data item from the CBOR stream associated with the reader
+ * and interprets it as a boolean value. CBOR represents boolean values as simple values with
+ * specific predefined byte values (true: 0xF5, false: 0xF4). This function decodes these representations
+ * and stores the boolean result in the provided bool variable.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance that represents the CBOR
+ *                   stream from which the boolean value is to be read.
+ * \param[out] value A pointer to a bool variable where the decoded boolean value will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the read operation. \ref CARDANO_SUCCESS is
+ * returned if a boolean value is successfully read from the stream and decoded. If the operation fails
+ * due to reasons such as incorrect stream positioning, unexpected data format, or if the next item in the
+ * stream is not a boolean value, an appropriate error code will be returned to indicate the failure reason.
+ */
+cardano_error_t
+_cbor_reader_read_boolean(cardano_cbor_reader_t* reader, bool* value);
+
+/**
+ * \brief Reads a null value from the CBOR stream.
+ *
+ * This function reads the next data item from the CBOR stream associated with the reader
+ * and checks if it represents a null value. In CBOR, a null value is represented as a simple
+ * value with a specific predefined byte value (0xF6). This function ensures that the next item
+ * in the stream is indeed a null value.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance that represents the CBOR
+ *                   stream from which the null value is to be read.
+ *
+ * \return A \ref cardano_error_t indicating the result of the read operation. \ref CARDANO_SUCCESS is
+ * returned if a null value is successfully identified in the stream. If the operation fails
+ * due to reasons such as incorrect stream positioning, unexpected data format, or if the next item in the
+ * stream is not a null value, an appropriate error code will be returned to indicate the failure reason.
+ */
+cardano_error_t
+_cbor_reader_read_null(cardano_cbor_reader_t* reader);
+
+/**
+ * \brief Reads a CBOR simple value from the CBOR stream.
+ *
+ * This function reads the next data item from the CBOR stream associated with the reader
+ * and interprets it as a simple value. CBOR simple values are small, non-structured values
+ * that include boolean values, null, undefined, and simple error conditions. This function
+ * decodes the simple value representation and stores the result in the provided `cardano_cbor_simple_value_t`
+ * variable.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance that represents the CBOR
+ *                   stream from which the simple value is to be read.
+ * \param[out] value A pointer to a `cardano_cbor_simple_value_t` variable where the decoded simple value will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the read operation. \ref CARDANO_SUCCESS is
+ * returned if a simple value is successfully read from the stream and decoded. If the operation fails
+ * due to reasons such as incorrect stream positioning, unexpected data format, or if the next item in the
+ * stream is not a simple value, an appropriate error code will be returned to indicate the failure reason.
+ */
+cardano_error_t
+_cbor_reader_read_simple_value(cardano_cbor_reader_t* reader, cardano_cbor_simple_value_t* value);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_SIMPLE_VALUES_H
diff --git a/vendor/src/cbor/cbor_reader/cbor_reader_tags.c b/vendor/src/cbor/cbor_reader/cbor_reader_tags.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader/cbor_reader_tags.c
@@ -0,0 +1,178 @@
+/**
+ * \file cbor_reader_tags.c
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "cbor_reader_tags.h"
+#include "cbor_reader_core.h"
+#include "cbor_reader_numeric.h"
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_tag.h>
+#include <cardano/error.h>
+
+#include <assert.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Peeks at the next CBOR tag in the stream without advancing the reader's position.
+ *
+ * This internal function examines the next data item in the CBOR stream, expected to be a tag (major type 6),
+ * and retrieves its value. It provides a way to inspect the tag value without affecting the reader's current
+ * position in the data stream.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance representing the CBOR stream to peek into.
+ * \param[out] tag A pointer to a `uint64_t` variable where the peeked tag value will be stored.
+ * \param[out] bytes_read A pointer to a `size_t` variable where the number of bytes that the tag occupies in
+ * the stream will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the peek operation. \ref CARDANO_SUCCESS is returned
+ * if a tag is successfully peeked from the stream. If the operation fails due to reasons such as incorrect
+ * stream positioning, unexpected data format, or if the next item in the stream is not a tag, an appropriate
+ * error code will be returned to indicate the failure reason.
+ */
+static cardano_error_t
+peek_tag_core(cardano_cbor_reader_t* reader, uint64_t* tag, size_t* bytes_read)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(tag != NULL);
+  assert(bytes_read != NULL);
+
+  byte_t          header = 0;
+  cardano_error_t result = _cbor_reader_peek_initial_byte(reader, CARDANO_CBOR_MAJOR_TYPE_TAG, &header);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  uint64_t unsigned_int = 0;
+
+  size_t read = 0;
+
+  cardano_buffer_t* buffer = NULL;
+
+  cardano_error_t remainder_bytes_result = cardano_cbor_reader_get_remainder_bytes(reader, &buffer);
+
+  if (remainder_bytes_result != CARDANO_SUCCESS)
+  {
+    return remainder_bytes_result;
+  }
+
+  cardano_error_t decode_result = _cbor_reader_decode_unsigned_integer(buffer, header, &unsigned_int, &read);
+
+  cardano_buffer_unref(&buffer);
+
+  if (decode_result != CARDANO_SUCCESS)
+  {
+    return decode_result;
+  }
+
+  *tag        = unsigned_int;
+  *bytes_read = read;
+
+  return CARDANO_SUCCESS;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+_cbor_reader_read_tag(cardano_cbor_reader_t* reader, cardano_cbor_tag_t* tag)
+{
+  uint64_t read_tag  = 0U;
+  size_t   bytesRead = 0;
+
+  cardano_error_t result = peek_tag_core(reader, &read_tag, &bytesRead);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (read_tag > (uint64_t)INT32_MAX)
+  {
+    cardano_cbor_reader_set_last_error(reader, "Semantic tag out of range.");
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, bytesRead);
+
+  assert(advance_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(advance_result);
+
+  reader->is_tag_context = true;
+  *tag                   = (cardano_cbor_tag_t)read_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_peek_tag(cardano_cbor_reader_t* reader, cardano_cbor_tag_t* tag)
+{
+  uint64_t read_tag  = 0U;
+  size_t   bytesRead = 0;
+
+  cardano_error_t result = peek_tag_core(reader, &read_tag, &bytesRead);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (read_tag > (uint64_t)INT32_MAX)
+  {
+    cardano_cbor_reader_set_last_error(reader, "Semantic tag out of range.");
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  *tag = (cardano_cbor_tag_t)read_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cbor_reader_skip_tag(cardano_cbor_reader_t* reader)
+{
+  uint64_t        tag        = 0U;
+  size_t          bytes_read = 0U;
+  cardano_error_t result     = peek_tag_core(reader, &tag, &bytes_read);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  CARDANO_UNUSED(tag);
+
+  cardano_error_t advance_result = _cbor_reader_advance_buffer(reader, bytes_read);
+
+  assert(advance_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(advance_result);
+
+  reader->is_tag_context = true;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/cbor/cbor_reader/cbor_reader_tags.h b/vendor/src/cbor/cbor_reader/cbor_reader_tags.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader/cbor_reader_tags.h
@@ -0,0 +1,85 @@
+/**
+ * \file cbor_reader_tags.h
+ *
+ * \author luisd.bianchi
+ * \date   Mar 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_TAGS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_TAGS_H
+
+/* INCLUDES ******************************************************************/
+
+#include "cbor_reader_core.h"
+
+#include <cardano/cbor/cbor_tag.h>
+#include <cardano/error.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Reads the next CBOR tag from the stream and advances the reader's position.
+ *
+ * This function reads the next data item in the CBOR stream, expecting it to be a tag (major type 6).
+ * It retrieves the tag's value and advances the reader's position past the tag. This operation consumes
+ * the tag, making it suitable for scenarios where the tag's value is required for further processing,
+ * and the stream needs to be advanced to the next item.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance representing the CBOR stream
+ *                   from which the tag is to be read. The reader must have been previously initialized
+ *                   and positioned correctly within the CBOR data stream.
+ * \param[out] tag A pointer to a `cardano_cbor_tag_t` variable where the read tag value will be stored. This
+ *                 variable is populated with the tag's value if the operation is successful.
+ *
+ * \return A \ref cardano_error_t indicating the result of the read operation. \ref CARDANO_SUCCESS is
+ * returned if a tag is successfully read from the stream. If the operation fails due to reasons such
+ * as incorrect stream positioning, unexpected data format, or if the next item in the stream is not a tag,
+ * an appropriate error code will be returned to indicate the failure reason.
+ */
+cardano_error_t
+_cbor_reader_read_tag(cardano_cbor_reader_t* reader, cardano_cbor_tag_t* tag);
+
+/**
+ * \brief Peeks at the next CBOR tag from the stream without advancing the reader's position.
+ *
+ * This function examines the next data item in the CBOR stream, expecting it to be a tag (major type 6).
+ * It retrieves the tag's value without advancing the reader's position in the stream.
+ *
+ * \param[in] reader A pointer to the \ref cardano_cbor_reader_t instance representing the CBOR
+ *                   stream from which the tag is to be peeked.
+ * \param[out] tag A pointer to a `cardano_cbor_tag_t` variable where the peeked tag value will be stored.
+ *
+ * \return A \ref cardano_error_t indicating the result of the peek operation. \ref CARDANO_SUCCESS is
+ * returned if a tag is successfully peeked from the stream. If the operation fails due to
+ * reasons such as incorrect stream positioning, unexpected data format, or if the
+ * next item in the stream is not a tag, an appropriate error code will be returned to
+ * indicate the failure reason.
+ */
+cardano_error_t
+_cbor_reader_peek_tag(cardano_cbor_reader_t* reader, cardano_cbor_tag_t* tag);
+
+/**
+ * \brief Consumes a semantic tag without narrowing its unsigned 64-bit value.
+ *
+ * \param[in,out] reader The reader positioned at a semantic tag.
+ *
+ * \return CARDANO_SUCCESS on success, or the decoding error.
+ */
+cardano_error_t
+_cbor_reader_skip_tag(cardano_cbor_reader_t* reader);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_READER_INTERNAL_TAGS_H
diff --git a/vendor/src/cbor/cbor_reader_state.c b/vendor/src/cbor/cbor_reader_state.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_reader_state.c
@@ -0,0 +1,104 @@
+/**
+ * \file cbor_reader_state.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader_state.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_cbor_reader_state_to_string(const cardano_cbor_reader_state_t reader_state)
+{
+  const char* message;
+
+  switch (reader_state)
+  {
+    case CARDANO_CBOR_READER_STATE_UNDEFINED:
+      message = "Reader State: Undefined";
+      break;
+    case CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER:
+      message = "Reader State: Unsigned Integer";
+      break;
+    case CARDANO_CBOR_READER_STATE_NEGATIVE_INTEGER:
+      message = "Reader State: Negative Integer";
+      break;
+    case CARDANO_CBOR_READER_STATE_BYTESTRING:
+      message = "Reader State: Byte String";
+      break;
+    case CARDANO_CBOR_READER_STATE_START_INDEFINITE_LENGTH_BYTESTRING:
+      message = "Reader State: Start Indefinite Length Byte String";
+      break;
+    case CARDANO_CBOR_READER_STATE_END_INDEFINITE_LENGTH_BYTESTRING:
+      message = "Reader State: End Indefinite Length Byte String";
+      break;
+    case CARDANO_CBOR_READER_STATE_TEXTSTRING:
+      message = "Reader State: Text String";
+      break;
+    case CARDANO_CBOR_READER_STATE_START_INDEFINITE_LENGTH_TEXTSTRING:
+      message = "Reader State: Start Indefinite Length Text String";
+      break;
+    case CARDANO_CBOR_READER_STATE_END_INDEFINITE_LENGTH_TEXTSTRING:
+      message = "Reader State: End Indefinite Length Text String";
+      break;
+    case CARDANO_CBOR_READER_STATE_START_ARRAY:
+      message = "Reader State: Start Array";
+      break;
+    case CARDANO_CBOR_READER_STATE_END_ARRAY:
+      message = "Reader State: End Array";
+      break;
+    case CARDANO_CBOR_READER_STATE_START_MAP:
+      message = "Reader State: Start Map";
+      break;
+    case CARDANO_CBOR_READER_STATE_END_MAP:
+      message = "Reader State: End Map";
+      break;
+    case CARDANO_CBOR_READER_STATE_TAG:
+      message = "Reader State: Tag";
+      break;
+    case CARDANO_CBOR_READER_STATE_SIMPLE_VALUE:
+      message = "Reader State: Simple Value";
+      break;
+    case CARDANO_CBOR_READER_STATE_HALF_PRECISION_FLOAT:
+      message = "Reader State: Half-Precision Float";
+      break;
+    case CARDANO_CBOR_READER_STATE_SINGLE_PRECISION_FLOAT:
+      message = "Reader State: Single-Precision Float";
+      break;
+    case CARDANO_CBOR_READER_STATE_DOUBLE_PRECISION_FLOAT:
+      message = "Reader State: Double-Precision Float";
+      break;
+    case CARDANO_CBOR_READER_STATE_NULL:
+      message = "Reader State: Null";
+      break;
+    case CARDANO_CBOR_READER_STATE_BOOLEAN:
+      message = "Reader State: Boolean";
+      break;
+    case CARDANO_CBOR_READER_STATE_FINISHED:
+      message = "Reader State: Finished";
+      break;
+    default:
+      message = "Reader State: Unknown";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/cbor/cbor_simple_value.c b/vendor/src/cbor/cbor_simple_value.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_simple_value.c
@@ -0,0 +1,53 @@
+/**
+ * \file cbor_simple_value.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_simple_value.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_cbor_simple_value_to_string(const cardano_cbor_simple_value_t simple_value)
+{
+  const char* message;
+
+  switch (simple_value)
+  {
+    case CARDANO_CBOR_SIMPLE_VALUE_FALSE:
+      message = "Simple Value: False";
+      break;
+    case CARDANO_CBOR_SIMPLE_VALUE_TRUE:
+      message = "Simple Value: True";
+      break;
+    case CARDANO_CBOR_SIMPLE_VALUE_NULL:
+      message = "Simple Value: Null";
+      break;
+    case CARDANO_CBOR_SIMPLE_VALUE_UNDEFINED:
+      message = "Simple Value: Undefined";
+      break;
+    default:
+      message = "Simple Value: Unknown";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/cbor/cbor_tag.c b/vendor/src/cbor/cbor_tag.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_tag.c
@@ -0,0 +1,71 @@
+/**
+ * \file cbor_tag.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_tag.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_cbor_tag_to_string(const cardano_cbor_tag_t tag)
+{
+  const char* message;
+
+  switch (tag)
+  {
+    case CARDANO_CBOR_TAG_DATE_TIME_STRING:
+      message = "Tag: Date Time String";
+      break;
+    case CARDANO_CBOR_TAG_UNIX_TIME_SECONDS:
+      message = "Tag: Unix Time Seconds";
+      break;
+    case CARDANO_CBOR_TAG_UNSIGNED_BIG_NUM:
+      message = "Tag: Unsigned Bignum";
+      break;
+    case CARDANO_CBOR_TAG_NEGATIVE_BIG_NUM:
+      message = "Tag: Negative Bignum";
+      break;
+    case CARDANO_CBOR_TAG_DECIMAL_FRACTION:
+      message = "Tag: Decimal Fraction";
+      break;
+    case CARDANO_CBOR_TAG_BIG_FLOAT:
+      message = "Tag: Big Float";
+      break;
+    case CARDANO_ENCODED_CBOR_RATIONAL_NUMBER:
+      message = "Tag: Rational Number";
+      break;
+    case CARDANO_ENCODED_CBOR_DATA_ITEM:
+      message = "Tag: CBOR Data Item";
+      break;
+    case CARDANO_CBOR_TAG_SET:
+      message = "Tag: Set";
+      break;
+    case CARDANO_CBOR_TAG_SELF_DESCRIBE_CBOR:
+      message = "Tag: Self Describe CBOR";
+      break;
+    default:
+      message = "Tag: Custom";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/cbor/cbor_validation.c b/vendor/src/cbor/cbor_validation.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_validation.c
@@ -0,0 +1,726 @@
+/**
+ * \file cbor_validation.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "cbor_validation.h"
+
+#include <assert.h>
+#include <cardano/cbor/cbor_major_type.h>
+#include <stdio.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Sets a detailed error message on a CBOR reader.
+ *
+ * This function constructs and sets a descriptive error message on a CBOR reader object
+ * when a value does not meet the expected criteria during decoding.
+ *
+ * \param[in,out] reader The CBOR reader object where the error message will be stored.
+ * \param[in] validator_name The name of the validator or field being checked.
+ * \param[in] expected_value The expected value for comparison.
+ * \param[in] expected_friendly_name A human-readable name or description of the expected value.
+ * \param[in] actual_value The actual value retrieved from the CBOR data.
+ * \param[in] actual_friendly_name A human-readable name or description of the actual value.
+ *
+ * \note This function constructs an error message indicating a mismatch between expected
+ *       and actual values during CBOR decoding and updates the reader's error state.
+ *       It assumes that all input pointers (reader, validator_name, expected_friendly_name,
+ *       and actual_friendly_name) are valid and non-NULL.
+ */
+static void
+set_invalid_type_error_message(
+  cardano_cbor_reader_t* reader,
+  const char*            validator_name,
+  const uint64_t         expected_value,
+  const char*            expected_friendly_name,
+  const uint64_t         actual_value,
+  const char*            actual_friendly_name)
+{
+  assert(reader != NULL);
+  assert(validator_name != NULL);
+  assert(expected_friendly_name != NULL);
+  assert(actual_friendly_name != NULL);
+
+  char buffer[1023] = { 0 };
+
+  const int32_t written = snprintf(
+    buffer,
+    sizeof(buffer),
+    "There was an error decoding '%s', expected '%s' (%lu) but got '%s' (%lu).",
+    validator_name,
+    expected_friendly_name,
+    (unsigned long)expected_value,
+    actual_friendly_name,
+    (unsigned long)actual_value);
+
+  assert(written > 0);
+  CARDANO_UNUSED(written);
+
+  cardano_cbor_reader_set_last_error(reader, buffer);
+}
+
+/**
+ * \brief Sets an error message for size validation failures in CBOR decoding.
+ *
+ * This function generates and sets a descriptive error message on a CBOR reader object when the
+ * decoded data does not match the expected size criteria, providing details about the expected
+ * and actual sizes along with the type information.
+ *
+ * \param[in,out] reader The CBOR reader object where the error message will be stored.
+ * \param[in] validator_name The name of the field or type validator where the error occurred.
+ * \param[in] type_value The numerical value representing the type being validated.
+ * \param[in] type_friendly_name A human-readable description of the type.
+ * \param[in] expected_length The expected length or size of the type.
+ * \param[in] actual_length The actual length or size encountered during decoding.
+ *
+ * \note This function assumes that all input pointers (reader, validator_name, type_friendly_name) are valid.
+ */
+static void
+set_invalid_size_error_message(
+  cardano_cbor_reader_t* reader,
+  const char*            validator_name,
+  const int64_t          type_value,
+  const char*            type_friendly_name,
+  const size_t           expected_length,
+  const size_t           actual_length)
+{
+  assert(reader != NULL);
+  assert(validator_name != NULL);
+  assert(type_friendly_name != NULL);
+
+  char buffer[1023] = { 0 };
+
+  const int32_t written = snprintf(
+    buffer,
+    sizeof(buffer),
+    "There was an error decoding '%s', expected a '%s' (%ld) of %zu element(s) but got a '%s' (%ld) of %zu element(s).",
+    validator_name,
+    type_friendly_name,
+    (long)type_value,
+    expected_length,
+    type_friendly_name,
+    (long)type_value,
+    actual_length);
+
+  assert(written > 0);
+  CARDANO_UNUSED(written);
+
+  cardano_cbor_reader_set_last_error(reader, buffer);
+}
+
+/**
+ * \brief Sets an error message for range validation failures in CBOR decoding.
+ *
+ * This function generates and sets a descriptive error message on a CBOR reader object when the
+ * decoded data does not match the expected range criteria, providing details about the expected
+ * and actual values along with the type information.
+ *
+ * \param[in,out] reader The CBOR reader object where the error message will be stored.
+ * \param[in] validator_name The name of the field or type validator where the error occurred.
+ * \param[in] type_friendly_name A human-readable description of the type being validated.
+ * \param[in] expected_min_value The minimum expected value for the type.
+ * \param[in] expected_max_value The maximum expected value for the type.
+ * \param[in] actual_value The actual value encountered during decoding.
+ *
+ * \note This function assumes that all input pointers (reader, validator_name, type_friendly_name) are valid.
+ */
+static void
+set_invalid_range_error_message(
+  cardano_cbor_reader_t* reader,
+  const char*            validator_name,
+  const char*            type_friendly_name,
+  const uint64_t         expected_min_value,
+  const uint64_t         expected_max_value,
+  const uint64_t         actual_value)
+{
+  assert(reader != NULL);
+  assert(validator_name != NULL);
+  assert(type_friendly_name != NULL);
+
+  char buffer[1023] = { 0 };
+
+  const int32_t written = snprintf(
+    buffer,
+    sizeof(buffer),
+    "There was an error decoding '%s', '%s' must have a value between %lu and %lu, but got %lu.",
+    validator_name,
+    type_friendly_name,
+    (unsigned long)expected_min_value,
+    (unsigned long)expected_max_value,
+    (unsigned long)actual_value);
+
+  assert(written > 0);
+  CARDANO_UNUSED(written);
+
+  cardano_cbor_reader_set_last_error(reader, buffer);
+}
+
+/**
+ * \brief Sets an error message for invalid CBOR tag validation failures.
+ *
+ * This function generates and sets a descriptive error message on a CBOR reader object when the
+ * decoded CBOR tag does not match the expected tag, providing details about the expected
+ * and actual tags.
+ *
+ * \param[in,out] reader The CBOR reader object where the error message will be stored.
+ * \param[in] validator_name The name of the validator associated with the tag validation.
+ * \param[in] expected_tag The expected CBOR tag.
+ * \param[in] actual_tag The actual CBOR tag encountered during validation.
+ *
+ * \note This function assumes that all input pointers (reader, validator_name) are valid.
+ */
+static void
+set_invalid_tag_error_message(
+  cardano_cbor_reader_t* reader,
+  const char*            validator_name,
+  const uint64_t         expected_tag,
+  const uint64_t         actual_tag)
+{
+  assert(reader != NULL);
+  assert(validator_name != NULL);
+
+  char buffer[1023] = { 0 };
+
+  const int32_t written = snprintf(
+    buffer,
+    sizeof(buffer),
+    "There was an error decoding the '%s', unexpected tag value, expected '%s' (%lu), but got '%s' (%lu).",
+    validator_name,
+    cardano_cbor_tag_to_string(expected_tag),
+    (unsigned long)expected_tag,
+    cardano_cbor_tag_to_string(actual_tag),
+    (unsigned long)actual_tag);
+
+  assert(written > 0);
+  CARDANO_UNUSED(written);
+
+  cardano_cbor_reader_set_last_error(reader, buffer);
+}
+
+/**
+ * \brief Sets an error message for invalid enum validation failures.
+ *
+ * This function generates and sets a descriptive error message on a CBOR reader object when the
+ * decoded CBOR int does not match the expected enum value, providing details about the expected
+ * and actual enum values.
+ *
+ * \param[in,out] reader The \ref cardano_cbor_reader_t object where the error message will be stored.
+ * \param[in] validator_name The name of the validator associated with the enum validation.
+ * \param[in] type_friendly_name A friendly name for the type being validated, included in the error message.
+ * \param[in] actual_value The actual enum value encountered during validation.
+ * \param[in] expected_value The expected enum value.
+ * \param[in] enum_to_string_callback A callback function that converts an enum value to a friendly string representation.
+ */
+static void
+set_invalid_enum_error_message(
+  cardano_cbor_reader_t*    reader,
+  const char*               validator_name,
+  const char*               field_name,
+  const uint64_t            actual_value,
+  const uint64_t            expected_value,
+  enum_to_string_callback_t enum_to_string_callback)
+{
+  assert(reader != NULL);
+  assert(validator_name != NULL);
+  assert(field_name != NULL);
+
+  char buffer[1023] = { 0 };
+
+  const int32_t written = snprintf(
+    buffer,
+    sizeof(buffer),
+    "There was an error decoding '%s', expected '%s' was '%s' (%lu), but got '%s' (%lu).",
+    validator_name,
+    field_name,
+    enum_to_string_callback(expected_value),
+    (unsigned long)expected_value,
+    enum_to_string_callback(actual_value),
+    (unsigned long)actual_value);
+
+  assert(written > 0);
+  CARDANO_UNUSED(written);
+
+  cardano_cbor_reader_set_last_error(reader, buffer);
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_cbor_validate_array_of_n_elements(const char* validator_name, cardano_cbor_reader_t* reader, const uint32_t n)
+{
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (state != CARDANO_CBOR_READER_STATE_START_ARRAY)
+  {
+    set_invalid_type_error_message(
+      reader,
+      validator_name,
+      CARDANO_CBOR_READER_STATE_START_ARRAY,
+      cardano_cbor_reader_state_to_string(CARDANO_CBOR_READER_STATE_START_ARRAY),
+      state,
+      cardano_cbor_reader_state_to_string(state));
+
+    return CARDANO_ERROR_UNEXPECTED_CBOR_TYPE;
+  }
+
+  cardano_buffer_t* buffer                     = NULL;
+  cardano_error_t   get_remainder_bytes_result = cardano_cbor_reader_get_remainder_bytes(reader, &buffer);
+
+  if (get_remainder_bytes_result != CARDANO_SUCCESS)
+  {
+    return get_remainder_bytes_result;
+  }
+
+  int64_t array_size = 0U;
+
+  cardano_error_t read_start_array_result = cardano_cbor_reader_read_start_array(reader, &array_size);
+
+  if (read_start_array_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&buffer);
+    return read_start_array_result;
+  }
+
+  if (array_size < 0)
+  {
+    cardano_cbor_reader_t* inner_reader = cardano_cbor_reader_new(cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer));
+    cardano_buffer_unref(&buffer);
+
+    read_start_array_result = cardano_cbor_reader_read_start_array(inner_reader, &array_size);
+
+    if (read_start_array_result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_reader_unref(&inner_reader);
+      return read_start_array_result;
+    }
+
+    array_size                                     = 0U;
+    cardano_cbor_reader_state_t inner_reader_state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+    while (inner_reader_state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      peek_result = cardano_cbor_reader_peek_state(inner_reader, &inner_reader_state);
+
+      if (peek_result != CARDANO_SUCCESS)
+      {
+        cardano_cbor_reader_unref(&inner_reader);
+        return peek_result;
+      }
+
+      if (inner_reader_state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+      {
+        break;
+      }
+
+      ++array_size;
+
+      cardano_error_t skip_result = cardano_cbor_reader_skip_value(inner_reader);
+
+      if (skip_result != CARDANO_SUCCESS)
+      {
+        cardano_cbor_reader_unref(&inner_reader);
+        return skip_result;
+      }
+    }
+
+    cardano_cbor_reader_unref(&inner_reader);
+  }
+
+  cardano_buffer_unref(&buffer);
+
+  if ((uint64_t)array_size != n)
+  {
+    set_invalid_size_error_message(
+      reader,
+      validator_name,
+      CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING,
+      cardano_cbor_major_type_to_string(CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING),
+      n,
+      array_size);
+
+    return CARDANO_ERROR_INVALID_CBOR_ARRAY_SIZE;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_validate_uint_in_range(const char* validator_name, const char* type_name, cardano_cbor_reader_t* reader, uint64_t* type, const uint64_t min, const uint64_t max)
+{
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (state != CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER)
+  {
+    set_invalid_type_error_message(
+      reader,
+      validator_name,
+      CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER,
+      cardano_cbor_reader_state_to_string(CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER),
+      state,
+      cardano_cbor_reader_state_to_string(state));
+
+    return CARDANO_ERROR_UNEXPECTED_CBOR_TYPE;
+  }
+
+  cardano_error_t read_uint_result = cardano_cbor_reader_read_uint(reader, type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  if ((*type < min) || (*type > max))
+  {
+    set_invalid_range_error_message(
+      reader,
+      validator_name,
+      type_name,
+      min,
+      max,
+      *type);
+
+    return CARDANO_ERROR_INVALID_CBOR_VALUE;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_validate_byte_string(const char* validator_name, cardano_cbor_reader_t* reader, cardano_buffer_t** byte_string)
+{
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (state != CARDANO_CBOR_READER_STATE_BYTESTRING)
+  {
+    set_invalid_type_error_message(
+      reader,
+      validator_name,
+      CARDANO_CBOR_READER_STATE_BYTESTRING,
+      cardano_cbor_reader_state_to_string(CARDANO_CBOR_READER_STATE_BYTESTRING),
+      state,
+      cardano_cbor_reader_state_to_string(state));
+
+    return CARDANO_ERROR_UNEXPECTED_CBOR_TYPE;
+  }
+
+  cardano_error_t read_byte_string_result = cardano_cbor_reader_read_bytestring(reader, byte_string);
+
+  if (read_byte_string_result != CARDANO_SUCCESS)
+  {
+    return read_byte_string_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_validate_byte_string_of_size(const char* validator_name, cardano_cbor_reader_t* reader, cardano_buffer_t** byte_string, const uint32_t size)
+{
+  cardano_error_t read_byte_string_result = cardano_cbor_validate_byte_string(validator_name, reader, byte_string);
+
+  if (read_byte_string_result != CARDANO_SUCCESS)
+  {
+    return read_byte_string_result;
+  }
+
+  const size_t byte_string_size = cardano_buffer_get_size(*byte_string);
+
+  if (cardano_buffer_get_size(*byte_string) != size)
+  {
+    cardano_buffer_unref(byte_string);
+
+    set_invalid_size_error_message(
+      reader,
+      validator_name,
+      CARDANO_CBOR_READER_STATE_BYTESTRING,
+      cardano_cbor_reader_state_to_string(CARDANO_CBOR_READER_STATE_BYTESTRING),
+      size,
+      byte_string_size);
+
+    return CARDANO_ERROR_INVALID_CBOR_VALUE;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_validate_text_string_of_max_size(
+  const char*            validator_name,
+  cardano_cbor_reader_t* reader,
+  char*                  text_string,
+  const uint32_t         size)
+{
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (state != CARDANO_CBOR_READER_STATE_TEXTSTRING)
+  {
+    set_invalid_type_error_message(
+      reader,
+      validator_name,
+      CARDANO_CBOR_READER_STATE_TEXTSTRING,
+      cardano_cbor_reader_state_to_string(CARDANO_CBOR_READER_STATE_TEXTSTRING),
+      state,
+      cardano_cbor_reader_state_to_string(state));
+
+    return CARDANO_ERROR_UNEXPECTED_CBOR_TYPE;
+  }
+
+  cardano_buffer_t* text_string_buffer      = NULL;
+  cardano_error_t   read_text_string_result = cardano_cbor_reader_read_textstring(reader, &text_string_buffer);
+
+  if (read_text_string_result != CARDANO_SUCCESS)
+  {
+    return read_text_string_result;
+  }
+
+  const size_t text_string_size = cardano_buffer_get_size(text_string_buffer);
+
+  if (text_string_size > size)
+  {
+    cardano_buffer_unref(&text_string_buffer);
+
+    set_invalid_size_error_message(
+      reader,
+      validator_name,
+      CARDANO_CBOR_READER_STATE_TEXTSTRING,
+      cardano_cbor_reader_state_to_string(CARDANO_CBOR_READER_STATE_TEXTSTRING),
+      size,
+      text_string_size);
+
+    return CARDANO_ERROR_INVALID_CBOR_VALUE;
+  }
+
+  cardano_error_t copy_result = cardano_buffer_to_str(text_string_buffer, text_string, size);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&text_string_buffer);
+    return copy_result;
+  }
+
+  cardano_buffer_unref(&text_string_buffer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_validate_end_array(const char* validator_name, cardano_cbor_reader_t* reader)
+{
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    set_invalid_type_error_message(
+      reader,
+      validator_name,
+      CARDANO_CBOR_READER_STATE_END_ARRAY,
+      cardano_cbor_reader_state_to_string(CARDANO_CBOR_READER_STATE_END_ARRAY),
+      state,
+      cardano_cbor_reader_state_to_string(state));
+
+    return CARDANO_ERROR_UNEXPECTED_CBOR_TYPE;
+  }
+
+  cardano_error_t read_end_array_result = cardano_cbor_reader_read_end_array(reader);
+
+  if (read_end_array_result != CARDANO_SUCCESS)
+  {
+    return read_end_array_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_validate_end_map(const char* validator_name, cardano_cbor_reader_t* reader)
+{
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    set_invalid_type_error_message(
+      reader,
+      validator_name,
+      CARDANO_CBOR_READER_STATE_END_MAP,
+      cardano_cbor_reader_state_to_string(CARDANO_CBOR_READER_STATE_END_MAP),
+      state,
+      cardano_cbor_reader_state_to_string(state));
+
+    return CARDANO_ERROR_UNEXPECTED_CBOR_TYPE;
+  }
+
+  cardano_error_t read_end_map_result = cardano_cbor_reader_read_end_map(reader);
+
+  if (read_end_map_result != CARDANO_SUCCESS)
+  {
+    return read_end_map_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_validate_tag(const char* validator_name, cardano_cbor_reader_t* reader, const cardano_cbor_tag_t tag)
+{
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (state != CARDANO_CBOR_READER_STATE_TAG)
+  {
+    set_invalid_type_error_message(
+      reader,
+      validator_name,
+      CARDANO_CBOR_READER_STATE_TAG,
+      cardano_cbor_reader_state_to_string(CARDANO_CBOR_READER_STATE_TAG),
+      state,
+      cardano_cbor_reader_state_to_string(state));
+
+    return CARDANO_ERROR_UNEXPECTED_CBOR_TYPE;
+  }
+
+  cardano_cbor_tag_t actual_tag = 0U;
+
+  cardano_error_t read_tag_result = cardano_cbor_reader_read_tag(reader, &actual_tag);
+
+  if (read_tag_result != CARDANO_SUCCESS)
+  {
+    return read_tag_result;
+  }
+
+  if (actual_tag != tag)
+  {
+    set_invalid_tag_error_message(
+      reader,
+      validator_name,
+      tag,
+      actual_tag);
+
+    return CARDANO_ERROR_INVALID_CBOR_VALUE;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_validate_enum_value(
+  const char*               validator_name,
+  const char*               field_name,
+  cardano_cbor_reader_t*    reader,
+  uint64_t                  expected_value,
+  enum_to_string_callback_t enum_to_string_callback,
+  uint64_t*                 actual_value)
+{
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (state != CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER)
+  {
+    set_invalid_type_error_message(
+      reader,
+      validator_name,
+      CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER,
+      cardano_cbor_reader_state_to_string(CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER),
+      state,
+      cardano_cbor_reader_state_to_string(state));
+
+    return CARDANO_ERROR_UNEXPECTED_CBOR_TYPE;
+  }
+
+  *actual_value = 0U;
+
+  cardano_error_t read_tag_result = cardano_cbor_reader_read_uint(reader, actual_value);
+
+  if (read_tag_result != CARDANO_SUCCESS)
+  {
+    return read_tag_result;
+  }
+
+  if (*actual_value != expected_value)
+  {
+    set_invalid_enum_error_message(
+      reader,
+      validator_name,
+      field_name,
+      *actual_value,
+      expected_value,
+      enum_to_string_callback);
+
+    return CARDANO_ERROR_INVALID_CBOR_VALUE;
+  }
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/cbor/cbor_validation.h b/vendor/src/cbor/cbor_validation.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_validation.h
@@ -0,0 +1,392 @@
+/**
+ * \file cbor_validation.h
+ *
+ * \author angel.castillo
+ * \date   Apr 13, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CBOR_VALIDATION_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CBOR_VALIDATION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/common/credential_type.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* TYPES *********************************************************************/
+
+typedef const char* (*enum_to_string_callback_t)(uint64_t value);
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Validates that the next element in the CBOR stream is an array with exactly \p n elements.
+ *
+ * This function checks whether the next element to be read from the CBOR stream using the provided \p reader
+ * is an array containing exactly \p n elements.
+ *
+ * \param[in] validator_name A descriptive name for the validator, typically indicating the context
+ *                           or field name where this array is expected, which will be included in any
+ *                           error messages generated.
+ * \param[in,out] reader The \ref cardano_cbor_reader_t object that provides the interface to read
+ *                       and interpret the CBOR encoded data stream. The reader's state will be
+ *                       advanced if the validation passes.
+ * \param[in] n The expected number of elements in the array. The function checks for this exact count.
+ *
+ * \return \ref CARDANO_SUCCESS if the array contains exactly \p n elements. If the array contains a different
+ *         number of elements, or if the next element is not an array, appropriate error codes are returned,
+ *         such as \ref CARDANO_ERROR_INVALID_CBOR_ARRAY_SIZE or \ref CARDANO_ERROR_UNEXPECTED_CBOR_TYPE. If \p reader is NULL,
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL is returned.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(data, data_size);
+ * cardano_error_t result = cardano_cbor_validate_array_of_n_elements("field_name", reader, 2);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Invalid CBOR format for field_name: %s.\n", cardano_cbor_reader_get_last_error(reader));
+ * }
+ *
+ * \endcode
+ */
+cardano_error_t
+cardano_cbor_validate_array_of_n_elements(const char* validator_name, cardano_cbor_reader_t* reader, uint32_t n);
+
+/**
+ * \brief Validates that the next element in the CBOR stream is an unsigned integer within a specified range.
+ *
+ * This function checks whether the next element to be read from the CBOR stream using the provided \p reader
+ * is an unsigned integer and whether it falls within the inclusive range specified by \p min and \p max.
+ * This check is crucial for ensuring that data conforms to expected value constraints, especially when specific
+ * numerical ranges carry particular meanings or are required by the application logic.
+ *
+ * \param[in] validator_name A descriptive name for the validator, typically indicating the context or field
+ *                           name where this integer is expected, which will be included in any error messages generated.
+ * \param[in] type_name A descriptive name for the type being validated.
+ * \param[in,out] reader The \ref cardano_cbor_reader_t object that provides the interface to read and interpret
+ *                       the CBOR encoded data stream. The reader's state will be advanced if the validation passes.
+ * \param[out] type Pointer to \ref cardano_credential_type_t where the parsed and validated unsigned integer
+ *                   will be stored if validation succeeds. This parameter is ignored if validation fails.
+ * \param[in] min The minimum acceptable value for the unsigned integer.
+ * \param[in] max The maximum acceptable value for the unsigned integer.
+ *
+ * \return \ref CARDANO_SUCCESS if the next element is an unsigned integer and it falls within the specified range.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(data, data_size);
+ * cardano_credential_type_t credential_type;
+ * cardano_error_t result = cardano_cbor_validate_uint_in_range("field_name", "credential_type", reader, &credential_type, 0, 4);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the validated credential type
+ *   printf("Credential type: %u\n", credential_type);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Invalid CBOR format for field_name: %s.\n", cardano_cbor_reader_get_last_error(reader));
+ * }
+ * \endcode
+ */
+cardano_error_t
+cardano_cbor_validate_uint_in_range(const char* validator_name, const char* type_name, cardano_cbor_reader_t* reader, uint64_t* type, uint64_t min, uint64_t max);
+
+/**
+ * \brief Validates and reads a byte string of any size from a CBOR stream.
+ *
+ * This function checks if the next element in the CBOR stream, read using the provided \p reader,
+ * is a byte string. If the validation succeeds, the function reads this byte string and returns it via
+ * the \p byte_string parameter.
+ *
+ * \param[in] validator_name A descriptive name for the validator, typically indicating the context or
+ *                           the field name where this byte string is expected, which will be included in
+ *                           any error messages generated.
+ * \param[in,out] reader The \ref cardano_cbor_reader_t object that provides the interface to read
+ *                       and interpret the CBOR encoded data stream. The reader's state will be advanced
+ *                       if the byte string is successfully read.
+ * \param[out] byte_string A pointer to a pointer of \ref cardano_buffer_t that will be allocated and
+ *                         set to point to the new byte string if validation and reading succeed. The caller
+ *                         is responsible for freeing this memory using \ref cardano_buffer_unref when it
+ *                         is no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the next element is a byte string, or \ref CARDANO_ERROR_UNEXPECTED_CBOR_TYPE
+ *         if it is of another type.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(data, data_size);
+ * cardano_buffer_t* byte_string = NULL;
+ * cardano_error_t result = cardano_cbor_validate_byte_string("field_name", reader, &byte_string);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the byte string
+ *
+ *   cardano_buffer_unref(&byte_string);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *    fprintf(stderr, "Invalid CBOR format for field_name: %s.\n", cardano_cbor_reader_get_last_error(reader));
+ * }
+ *
+ * \endcode
+ */
+cardano_error_t
+cardano_cbor_validate_byte_string(const char* validator_name, cardano_cbor_reader_t* reader, cardano_buffer_t** byte_string);
+
+/**
+ * \brief Validates and reads a byte string of a specified size from a CBOR stream.
+ *
+ * This function checks if the next element in the CBOR stream, read using the provided \p reader,
+ * is a byte string of the exact length specified by \p size. If the validation succeeds, the function
+ * reads this byte string and returns it via the \p byte_string parameter.
+ *
+ * \param[in] validator_name A descriptive name for the validator, typically indicating the context or
+ *                           the field name where this byte string is expected, which will be included in
+ *                           any error messages generated.
+ * \param[in,out] reader The \ref cardano_cbor_reader_t object that provides the interface to read
+ *                       and interpret the CBOR encoded data stream. The reader's state will be advanced
+ *                       if the byte string is successfully read.
+ * \param[out] byte_string A pointer to a pointer of \ref cardano_buffer_t that will be allocated and
+ *                         set to point to the new byte string if validation and reading succeed. The caller
+ *                         is responsible for freeing this memory using \ref cardano_buffer_unref when it
+ *                         is no longer needed.
+ * \param[in] size The exact expected size of the byte string in bytes.
+ *
+ * \return \ref CARDANO_SUCCESS if the next element is a byte string and its size matches the specified \p size.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(data, data_size);
+ * cardano_buffer_t* byte_string = NULL;
+ * cardano_error_t result = cardano_cbor_validate_byte_string_of_size("field_name", reader, &byte_string, expected_size);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the byte string
+ *   // Process or inspect byte_string contents
+ *
+ *   cardano_buffer_unref(&byte_string);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *    fprintf(stderr, "Invalid CBOR format for field_name: %s.\n", cardano_cbor_reader_get_last_error(reader));
+ * }
+ *
+ * \endcode
+ */
+cardano_error_t
+cardano_cbor_validate_byte_string_of_size(const char* validator_name, cardano_cbor_reader_t* reader, cardano_buffer_t** byte_string, uint32_t size);
+
+/**
+ * \brief Validates and reads a text string of a specified maximum size from a CBOR stream.
+ *
+ * This function checks if the next element in the CBOR stream, accessed through the provided \p reader,
+ * is a text string whose length does not exceed the specified \p size. If the validation succeeds, the function
+ * reads this text string and writes it to the \p text_string parameter, ensuring not to exceed the buffer capacity.
+ *
+ * \param[in] validator_name A descriptive name for the validator, indicating the context or
+ *                           the field name where this text string is expected, which will be included in
+ *                           any error messages generated.
+ * \param[in,out] reader The \ref cardano_cbor_reader_t object that provides the interface to read
+ *                       and interpret the CBOR encoded data stream. The reader's state will be advanced
+ *                       if the text string is successfully read.
+ * \param[out] text_string A pointer to a character array where the read text string will be stored.
+ *                         The buffer must be large enough to hold the text string plus a terminating null character.
+ * \param[in] size The maximum expected size of the text string in bytes, including the null terminator.
+ *
+ * \return \ref CARDANO_SUCCESS if the next element is a text string and its length is within the specified \p size.
+ *         Returns an appropriate error code if the operation fails, which can be obtained using
+ *         \ref cardano_cbor_reader_get_last_error for more details.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(data, data_size);
+ * char text_string[100];  // Define the buffer size based on the expected maximum
+ * cardano_error_t result = cardano_cbor_validate_text_string_of_max_size("field_name", reader, text_string, sizeof(text_string));
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the text string
+ *   printf("Read text string: %s\n", text_string);
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Invalid CBOR format for field_name: %s.\n", cardano_cbor_reader_get_last_error(reader));
+ * }
+ * \endcode
+ */
+cardano_error_t
+cardano_cbor_validate_text_string_of_max_size(const char* validator_name, cardano_cbor_reader_t* reader, char* text_string, uint32_t size);
+
+/**
+ * \brief Validates the end of an array in a CBOR stream.
+ *
+ * This function checks if the current position in the CBOR stream, accessed through the provided
+ * \p reader, correctly signifies the end of an array. It is typically used after reading all expected
+ * elements of an array to ensure that there are no additional, unexpected elements in the array.
+ *
+ * \param[in] validator_name A descriptive name for the validator, typically indicating the context or
+ *                           the field name associated with the array, which will be included in any
+ *                           error messages generated.
+ * \param[in,out] reader The \ref cardano_cbor_reader_t object that provides the interface to read
+ *                       and interpret the CBOR encoded data stream. The reader's state will be checked
+ *                       to ensure it is at the end of an array structure.
+ *
+ * \return \ref CARDANO_SUCCESS if the reader is correctly positioned at the end of an array.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(data, data_size);
+ * // Assume we have read some elements from the array
+ * cardano_error_t result = cardano_cbor_validate_end_array("field_name", reader);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Array was properly closed
+ *   printf("Array reading completed successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Invalid CBOR format for field_name: %s.\n", cardano_cbor_reader_get_last_error(reader));
+ * }
+ * \endcode
+ */
+cardano_error_t
+cardano_cbor_validate_end_array(const char* validator_name, cardano_cbor_reader_t* reader);
+
+/**
+ * \brief Validates the end of an map in a CBOR stream.
+ *
+ * This function checks if the current position in the CBOR stream, accessed through the provided
+ * \p reader, correctly signifies the end of an map. It is typically used after reading all expected
+ * elements of an map to ensure that there are no additional, unexpected elements in the map.
+ *
+ * \param[in] validator_name A descriptive name for the validator, typically indicating the context or
+ *                           the field name associated with the map, which will be included in any
+ *                           error messages generated.
+ * \param[in,out] reader The \ref cardano_cbor_reader_t object that provides the interface to read
+ *                       and interpret the CBOR encoded data stream. The reader's state will be checked
+ *                       to ensure it is at the end of an map structure.
+ *
+ * \return \ref CARDANO_SUCCESS if the reader is correctly positioned at the end of an map.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(data, data_size);
+ * // Assume we have read some elements from the map
+ * cardano_error_t result = cardano_cbor_validate_end_map("field_name", reader);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Array was properly closed
+ *   printf("Array reading completed successfully.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "Invalid CBOR format for field_name: %s.\n", cardano_cbor_reader_get_last_error(reader));
+ * }
+ * \endcode
+ */
+cardano_error_t
+cardano_cbor_validate_end_map(const char* validator_name, cardano_cbor_reader_t* reader);
+
+/**
+ * \brief Validates a CBOR tag in a CBOR stream.
+ *
+ * This function validates the presence of a specific CBOR tag at the current position in the CBOR stream,
+ * accessed through the provided \p reader. It is typically used to ensure that the expected CBOR tag is present
+ * at the specified location in the CBOR data.
+ *
+ * \param[in] validator_name A descriptive name for the validator, typically indicating the context or
+ *                           the field name associated with the tag, which will be included in any
+ *                           error messages generated.
+ * \param[in,out] reader The \ref cardano_cbor_reader_t object that provides the interface to read
+ *                       and interpret the CBOR encoded data stream. The reader's state will be checked
+ *                       to ensure it contains the specified CBOR tag.
+ * \param[in] tag The CBOR tag to validate at the current position in the CBOR stream.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the validation operation. Returns \ref CARDANO_SUCCESS
+ *         if the specified CBOR tag is found at the current position in the CBOR stream, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_cbor_reader_t* reader = cardano_cbor_reader_new(data, data_size);
+ * // Assume we have read some data from the CBOR stream
+ * cardano_error_t result = cardano_cbor_validate_tag("tag_validator", reader, MY_CBOR_TAG);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // CBOR tag was found at the current position
+ *   printf("CBOR tag validation successful.\n");
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   fprintf(stderr, "CBOR tag validation failed for tag_validator: %s.\n", cardano_cbor_reader_get_last_error(reader));
+ * }
+ * \endcode
+ */
+cardano_error_t
+cardano_cbor_validate_tag(const char* validator_name, cardano_cbor_reader_t* reader, cardano_cbor_tag_t tag);
+
+/**
+ * \brief Validates an enum value in a CBOR stream.
+ *
+ * This function validates that the actual enum value read from the CBOR stream matches the expected value.
+ * It provides detailed error messages, including both friendly names and the actual values.
+ *
+ * \param[in] validator_name A descriptive name for the validator, typically indicating the context or
+ *                           the field name associated with the value, which will be included in any
+ *                           error messages generated.
+ * \param[in] field_name A descriptive name for the field.
+ * \param[in,out] reader The \ref cardano_cbor_reader_t object that provides the interface to read
+ *                       and interpret the CBOR encoded data stream. The reader's state will be checked
+ *                       to ensure it contains the expected enum value.
+ * \param[in] expected_value The expected enum value to validate against.
+ * \param[in] enum_to_string_callback A callback function that converts an enum value to a friendly string representation.
+ * \param[out] actual_value Pointer to the unsigned int where the parsed and validated unsigned integer
+ *                  will be stored if validation succeeds. This parameter is ignored if validation fails.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the validation operation. Returns \ref CARDANO_SUCCESS
+ *         if the actual enum value matches the expected value, or an appropriate error code
+ *         indicating the failure reason.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_cbor_validate_enum_value(
+  const char*               validator_name,
+  const char*               field_name,
+  cardano_cbor_reader_t*    reader,
+  uint64_t                  expected_value,
+  enum_to_string_callback_t enum_to_string_callback,
+  uint64_t*                 actual_value);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CBOR_VALIDATION_H
diff --git a/vendor/src/cbor/cbor_writer.c b/vendor/src/cbor/cbor_writer.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/cbor/cbor_writer.c
@@ -0,0 +1,680 @@
+/**
+ * \file cbor_writer.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "cbor_additional_info.h"
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_major_type.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief A simple writer for Concise Binary Object Representation (CBOR) encoded data.
+ */
+typedef struct cardano_cbor_writer_t
+{
+    cardano_object_t  base;
+    cardano_buffer_t* buffer;
+} cardano_cbor_writer_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Writes a value with a specified CBOR major type to a buffer.
+ *
+ * This function serializes a given value into a format specified by the CBOR
+ * (Concise Binary Object Representation) encoding standard, targeting the provided
+ * buffer. The major type parameter determines how the value is interpreted and encoded
+ * according to CBOR's major type specification.
+ *
+ * \param buffer A pointer to the \c cardano_buffer_t structure representing the target buffer
+ *               where the encoded data will be written.
+ * \param major_type The CBOR major type of the value to write. This parameter defines the data type
+ *                   and format of the value in the CBOR encoding (e.g., unsigned integer, byte string, etc.).
+ *                   It must be one of the values defined by the \c cardano_cbor_major_type_t enumeration.
+ * \param value The value to be encoded and written to the buffer. The function interprets and encodes
+ *              this value according to the specified CBOR major type.
+ *
+ * \return A \c cardano_error_t indicating the result of the operation. Returns \c CARDANO_SUCCESS if
+ *         the value is successfully encoded and written to the buffer. If an error occurs during the
+ *         operation, a corresponding error code is returned, indicating the failure reason.
+ */
+static cardano_error_t
+write_type_value(cardano_buffer_t* buffer, const cardano_cbor_major_type_t major_type, const uint64_t value)
+{
+  const byte_t type = (byte_t)major_type << 5;
+
+  if (value < 24U)
+  {
+    byte_t          header = type | (byte_t)value;
+    cardano_error_t result = cardano_buffer_write(buffer, &header, sizeof(header));
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+  else if (value < 256U)
+  {
+    byte_t          header = type | (byte_t)CARDANO_CBOR_ADDITIONAL_INFO_8BIT_DATA;
+    cardano_error_t result = cardano_buffer_write(buffer, &header, sizeof(header));
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    byte_t val = (byte_t)value;
+    return cardano_buffer_write(buffer, &val, 1);
+  }
+  else if (value < 65536U)
+  {
+    byte_t          header = type | (byte_t)CARDANO_CBOR_ADDITIONAL_INFO_16BIT_DATA;
+    cardano_error_t result = cardano_buffer_write(buffer, &header, sizeof(header));
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    return cardano_buffer_write_uint16_be(buffer, (uint16_t)value);
+  }
+  else if (value < 4294967296U)
+  {
+    byte_t          header = type | (byte_t)CARDANO_CBOR_ADDITIONAL_INFO_32BIT_DATA;
+    cardano_error_t result = cardano_buffer_write(buffer, &header, sizeof(header));
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    return cardano_buffer_write_uint32_be(buffer, (uint32_t)value);
+  }
+  else
+  {
+    byte_t          header = type | (byte_t)CARDANO_CBOR_ADDITIONAL_INFO_64BIT_DATA;
+    cardano_error_t result = cardano_buffer_write(buffer, &header, sizeof(header));
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    return cardano_buffer_write_uint64_be(buffer, value);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Deallocates a CBOR writer object.
+ *
+ * This function is responsible for properly deallocating a CBOR writer object (`cardano_cbor_writer_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the CBOR writer object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_cbor_writer_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the CBOR writer
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_cbor_writer_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_cbor_writer_t* cbor_writer = (cardano_cbor_writer_t*)object;
+
+  if (cbor_writer->buffer != NULL)
+  {
+    cardano_buffer_unref(&cbor_writer->buffer);
+  }
+
+  _cardano_free(cbor_writer);
+}
+
+/* DECLARATIONS **************************************************************/
+
+cardano_cbor_writer_t*
+cardano_cbor_writer_new(void)
+{
+  cardano_cbor_writer_t* obj = (cardano_cbor_writer_t*)_cardano_malloc(sizeof(cardano_cbor_writer_t));
+
+  if (obj == NULL)
+  {
+    return NULL;
+  }
+
+  obj->base.ref_count     = 1;
+  obj->base.deallocator   = cardano_cbor_writer_deallocate;
+  obj->base.last_error[0] = '\0';
+  obj->buffer             = cardano_buffer_new(128);
+
+  if (obj->buffer == NULL)
+  {
+    _cardano_free(obj);
+    return NULL;
+  }
+
+  return obj;
+}
+
+void
+cardano_cbor_writer_unref(cardano_cbor_writer_t** cbor_writer)
+{
+  if ((cbor_writer == NULL) || (*cbor_writer == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*cbor_writer)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *cbor_writer = NULL;
+    return;
+  }
+}
+
+void
+cardano_cbor_writer_ref(cardano_cbor_writer_t* cbor_writer)
+{
+  if (cbor_writer == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&cbor_writer->base);
+}
+
+size_t
+cardano_cbor_writer_refcount(const cardano_cbor_writer_t* cbor_writer)
+{
+  if (cbor_writer == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&cbor_writer->base);
+}
+
+cardano_error_t
+cardano_cbor_writer_write_bigint(cardano_cbor_writer_t* writer, const cardano_bigint_t* bigint)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bigint == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bigint_t* copy   = NULL;
+  cardano_error_t   result = cardano_bigint_clone(bigint, &copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_tag_t tag = CARDANO_CBOR_TAG_UNSIGNED_BIG_NUM;
+
+  if (cardano_bigint_signum(copy) < 0)
+  {
+    tag = CARDANO_CBOR_TAG_NEGATIVE_BIG_NUM;
+    cardano_bigint_negate(bigint, copy);
+    cardano_bigint_decrement(copy);
+  }
+
+  result = cardano_cbor_writer_write_tag(writer, tag);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_bigint_unref(&copy);
+
+    return result;
+  }
+
+  if (cardano_bigint_is_zero(copy))
+  {
+    static const byte_t empty = 0U;
+
+    cardano_bigint_unref(&copy);
+
+    return cardano_cbor_writer_write_bytestring(writer, &empty, 0U);
+  }
+
+  const size_t size = cardano_bigint_get_bytes_size(copy);
+  byte_t*      data = (byte_t*)_cardano_malloc(size);
+
+  if (data == NULL)
+  {
+    cardano_bigint_unref(&copy);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_bigint_to_bytes(copy, CARDANO_BYTE_ORDER_BIG_ENDIAN, data, size);
+
+  cardano_bigint_unref(&copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(data);
+
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, data, size);
+
+  _cardano_free(data);
+
+  return result;
+}
+
+cardano_error_t
+cardano_cbor_writer_write_bool(cardano_cbor_writer_t* writer, const bool value)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  byte_t cbor_bool_val = (byte_t)(value ? 245 : 244);
+
+  return cardano_buffer_write(writer->buffer, &cbor_bool_val, 1);
+}
+
+cardano_error_t
+cardano_cbor_writer_write_bytestring(cardano_cbor_writer_t* writer, const byte_t* data, const size_t size)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = write_type_value(writer->buffer, CARDANO_CBOR_MAJOR_TYPE_BYTE_STRING, size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return cardano_buffer_write(writer->buffer, data, size);
+}
+
+cardano_error_t
+cardano_cbor_writer_write_textstring(cardano_cbor_writer_t* writer, const char* data, const size_t size)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = write_type_value(writer->buffer, CARDANO_CBOR_MAJOR_TYPE_UTF8_STRING, size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return cardano_buffer_write(writer->buffer, (const byte_t*)data, size);
+}
+
+cardano_error_t
+cardano_cbor_writer_write_encoded(cardano_cbor_writer_t* writer, const byte_t* data, const size_t size)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_write(writer->buffer, data, size);
+}
+
+cardano_error_t
+cardano_cbor_writer_write_start_array(cardano_cbor_writer_t* writer, const int64_t size)
+{
+  static byte_t indefinite_length_array = 0x9fU;
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size < 0)
+  {
+    return cardano_buffer_write(writer->buffer, &indefinite_length_array, sizeof(indefinite_length_array));
+  }
+
+  return write_type_value(writer->buffer, CARDANO_CBOR_MAJOR_TYPE_ARRAY, size);
+}
+
+cardano_error_t
+cardano_cbor_writer_write_end_array(cardano_cbor_writer_t* writer)
+{
+  static byte_t indefiniteLengthBreakByte = 0xffU;
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_write(writer->buffer, &indefiniteLengthBreakByte, sizeof(indefiniteLengthBreakByte));
+}
+
+cardano_error_t
+cardano_cbor_writer_write_start_map(cardano_cbor_writer_t* writer, const int64_t size)
+{
+  static byte_t indefinite_length_map = 0xbfU;
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size < 0)
+  {
+    return cardano_buffer_write(writer->buffer, &indefinite_length_map, sizeof(indefinite_length_map));
+  }
+
+  return write_type_value(writer->buffer, CARDANO_CBOR_MAJOR_TYPE_MAP, size);
+}
+
+cardano_error_t
+cardano_cbor_writer_write_end_map(cardano_cbor_writer_t* writer)
+{
+  return cardano_cbor_writer_write_end_array(writer);
+}
+
+cardano_error_t
+cardano_cbor_writer_write_uint(cardano_cbor_writer_t* writer, const uint64_t value)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return write_type_value(writer->buffer, CARDANO_CBOR_MAJOR_TYPE_UNSIGNED_INTEGER, value);
+}
+
+cardano_error_t
+cardano_cbor_writer_write_negative_int(cardano_cbor_writer_t* writer, const uint64_t argument)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return write_type_value(writer->buffer, CARDANO_CBOR_MAJOR_TYPE_NEGATIVE_INTEGER, argument);
+}
+
+cardano_error_t
+cardano_cbor_writer_write_signed_int(cardano_cbor_writer_t* writer, const int64_t value)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value < 0)
+  {
+    return write_type_value(writer->buffer, CARDANO_CBOR_MAJOR_TYPE_NEGATIVE_INTEGER, -1 - value);
+  }
+
+  return write_type_value(writer->buffer, CARDANO_CBOR_MAJOR_TYPE_UNSIGNED_INTEGER, value);
+}
+
+cardano_error_t
+cardano_cbor_writer_write_null(cardano_cbor_writer_t* writer)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static byte_t cbor_null = 0xf6U;
+
+  return cardano_buffer_write(writer->buffer, &cbor_null, sizeof(cbor_null));
+}
+
+cardano_error_t
+cardano_cbor_writer_write_undefined(cardano_cbor_writer_t* writer)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static byte_t cbor_undefined = 0xf7U;
+
+  return cardano_buffer_write(writer->buffer, &cbor_undefined, sizeof(cbor_undefined));
+}
+
+cardano_error_t
+cardano_cbor_writer_write_tag(cardano_cbor_writer_t* writer, const cardano_cbor_tag_t tag)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return write_type_value(writer->buffer, CARDANO_CBOR_MAJOR_TYPE_TAG, tag);
+}
+
+size_t
+cardano_cbor_writer_get_encode_size(cardano_cbor_writer_t* writer)
+{
+  if (writer == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_buffer_get_size(writer->buffer);
+}
+
+cardano_error_t
+cardano_cbor_writer_encode(cardano_cbor_writer_t* writer, byte_t* data, const size_t size)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t buffer_size = cardano_buffer_get_size(writer->buffer);
+
+  if (buffer_size > size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  cardano_safe_memcpy(data, size, cardano_buffer_get_data(writer->buffer), buffer_size);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cbor_writer_encode_in_buffer(cardano_cbor_writer_t* writer, cardano_buffer_t** buffer)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *buffer = cardano_buffer_new(cardano_buffer_get_size(writer->buffer));
+
+  if (*buffer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_buffer_write(*buffer, cardano_buffer_get_data(writer->buffer), cardano_buffer_get_size(writer->buffer));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(buffer);
+  }
+
+  return result;
+}
+
+size_t
+cardano_cbor_writer_get_hex_size(const cardano_cbor_writer_t* writer)
+{
+  if (writer == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_buffer_get_hex_size(writer->buffer);
+}
+
+cardano_error_t
+cardano_cbor_writer_encode_hex(const cardano_cbor_writer_t* writer, char* dest, const size_t dest_size)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (dest == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_to_hex(writer->buffer, dest, dest_size);
+}
+
+cardano_error_t
+cardano_cbor_writer_reset(cardano_cbor_writer_t* writer)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* buffer = cardano_buffer_new(128);
+
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_unref(&writer->buffer);
+  writer->buffer = buffer;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_cbor_writer_set_last_error(cardano_cbor_writer_t* writer, const char* message)
+{
+  cardano_object_set_last_error(&writer->base, message);
+}
+
+const char*
+cardano_cbor_writer_get_last_error(const cardano_cbor_writer_t* writer)
+{
+  return cardano_object_get_last_error(&writer->base);
+}
+
+cardano_error_t
+cardano_cbor_writer_deep_clone(const cardano_cbor_writer_t* source, cardano_cbor_writer_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_writer_t* copy = _cardano_malloc(sizeof(cardano_cbor_writer_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->buffer             = NULL;
+
+  if (source->buffer != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->buffer, &copy->buffer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/auth_committee_hot_cert.c b/vendor/src/certs/auth_committee_hot_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/auth_committee_hot_cert.c
@@ -0,0 +1,474 @@
+/**
+ * \file auth_committee_hot_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/auth_committee_hot_cert.h>
+#include <cardano/certs/cert_type.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate registers the Hot and Cold credentials of a committee member.
+ */
+typedef struct cardano_auth_committee_hot_cert_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* committee_cold_cred;
+    cardano_credential_t* committee_hot_cred;
+} cardano_auth_committee_hot_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a auth_committee_hot_cert object.
+ *
+ * This function is responsible for properly deallocating a auth_committee_hot_cert object (`cardano_auth_committee_hot_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the auth_committee_hot_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_auth_committee_hot_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the auth_committee_hot_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_auth_committee_hot_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_auth_committee_hot_cert_t* data = (cardano_auth_committee_hot_cert_t*)object;
+
+  cardano_credential_unref(&data->committee_cold_cred);
+  cardano_credential_unref(&data->committee_hot_cred);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_auth_committee_hot_cert_new(
+  cardano_credential_t*               committee_cold_cred,
+  cardano_credential_t*               committee_hot_cred,
+  cardano_auth_committee_hot_cert_t** auth_committee_hot_cert)
+{
+  if (committee_cold_cred == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_hot_cred == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (auth_committee_hot_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_auth_committee_hot_cert_t* data = _cardano_malloc(sizeof(cardano_auth_committee_hot_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_auth_committee_hot_cert_deallocate;
+
+  cardano_credential_ref(committee_cold_cred);
+  data->committee_cold_cred = committee_cold_cred;
+
+  cardano_credential_ref(committee_hot_cred);
+  data->committee_hot_cred = committee_hot_cred;
+
+  *auth_committee_hot_cert = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_auth_committee_hot_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_auth_committee_hot_cert_t** auth_committee_hot_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (auth_committee_hot_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "auth_committee_hot_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* committee_cold_cred = NULL;
+  cardano_credential_t* committee_hot_cred  = NULL;
+
+  cardano_error_t read_cred = cardano_credential_from_cbor(reader, &committee_cold_cred);
+
+  if (read_cred != CARDANO_SUCCESS)
+  {
+    return read_cred;
+  }
+
+  read_cred = cardano_credential_from_cbor(reader, &committee_hot_cred);
+
+  if (read_cred != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&committee_cold_cred);
+
+    return read_cred;
+  }
+
+  cardano_error_t new_result = cardano_auth_committee_hot_cert_new(committee_cold_cred, committee_hot_cred, auth_committee_hot_cert);
+
+  cardano_credential_unref(&committee_cold_cred);
+  cardano_credential_unref(&committee_hot_cred);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_auth_committee_hot_cert_to_cbor(
+  const cardano_auth_committee_hot_cert_t* auth_committee_hot_cert,
+  cardano_cbor_writer_t*                   writer)
+{
+  if (auth_committee_hot_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_credential_to_cbor(auth_committee_hot_cert->committee_cold_cred, writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_credential_to_cbor(auth_committee_hot_cert->committee_hot_cred, writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_auth_committee_hot_cert_to_cip116_json(
+  const cardano_auth_committee_hot_cert_t* cert,
+  cardano_json_writer_t*                   writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const cardano_credential_t* cold = cert->committee_cold_cred;
+  const cardano_credential_t* hot  = cert->committee_hot_cred;
+
+  if ((cold == NULL) || (hot == NULL))
+  {
+    cardano_json_writer_set_last_error(writer, "Auth committee cert missing cold or hot credential");
+    return CARDANO_ERROR_ENCODING;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "auth_committee_hot", 18);
+
+  cardano_json_writer_write_property_name(writer, "committee_cold_credential", 25);
+  cardano_error_t err = cardano_credential_to_cip116_json(cold, writer);
+
+  if (err != CARDANO_SUCCESS)
+  {
+    return err;
+  }
+
+  cardano_json_writer_write_property_name(writer, "committee_hot_credential", 24);
+  err = cardano_credential_to_cip116_json(hot, writer);
+
+  if (err != CARDANO_SUCCESS)
+  {
+    return err;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_auth_committee_hot_cert_set_cold_cred(
+  cardano_auth_committee_hot_cert_t* auth_committee_hot,
+  cardano_credential_t*              credential)
+{
+  if (auth_committee_hot == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&auth_committee_hot->committee_cold_cred);
+  auth_committee_hot->committee_cold_cred = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_auth_committee_hot_cert_get_cold_cred(
+  cardano_auth_committee_hot_cert_t* auth_committee_hot,
+  cardano_credential_t**             credential)
+{
+  if (auth_committee_hot == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(auth_committee_hot->committee_cold_cred);
+  *credential = auth_committee_hot->committee_cold_cred;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_auth_committee_hot_cert_set_hot_cred(
+  cardano_auth_committee_hot_cert_t* auth_committee_hot,
+  cardano_credential_t*              credential)
+{
+  if (auth_committee_hot == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&auth_committee_hot->committee_hot_cred);
+  auth_committee_hot->committee_hot_cred = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_auth_committee_hot_cert_get_hot_cred(
+  cardano_auth_committee_hot_cert_t* auth_committee_hot,
+  cardano_credential_t**             credential)
+{
+  if (auth_committee_hot == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(auth_committee_hot->committee_hot_cred);
+  *credential = auth_committee_hot->committee_hot_cred;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_auth_committee_hot_cert_unref(cardano_auth_committee_hot_cert_t** auth_committee_hot_cert)
+{
+  if ((auth_committee_hot_cert == NULL) || (*auth_committee_hot_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*auth_committee_hot_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *auth_committee_hot_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_auth_committee_hot_cert_ref(cardano_auth_committee_hot_cert_t* auth_committee_hot_cert)
+{
+  if (auth_committee_hot_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&auth_committee_hot_cert->base);
+}
+
+size_t
+cardano_auth_committee_hot_cert_refcount(const cardano_auth_committee_hot_cert_t* auth_committee_hot_cert)
+{
+  if (auth_committee_hot_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&auth_committee_hot_cert->base);
+}
+
+void
+cardano_auth_committee_hot_cert_set_last_error(cardano_auth_committee_hot_cert_t* auth_committee_hot_cert, const char* message)
+{
+  cardano_object_set_last_error(&auth_committee_hot_cert->base, message);
+}
+
+const char*
+cardano_auth_committee_hot_cert_get_last_error(const cardano_auth_committee_hot_cert_t* auth_committee_hot_cert)
+{
+  return cardano_object_get_last_error(&auth_committee_hot_cert->base);
+}
+
+cardano_error_t
+cardano_auth_committee_hot_cert_deep_clone(const cardano_auth_committee_hot_cert_t* source, cardano_auth_committee_hot_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_auth_committee_hot_cert_t* copy = _cardano_malloc(sizeof(cardano_auth_committee_hot_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count      = 1U;
+  copy->base.deallocator    = source->base.deallocator;
+  copy->base.last_error[0]  = '\0';
+  copy->committee_cold_cred = NULL;
+  copy->committee_hot_cred  = NULL;
+
+  if (source->committee_cold_cred != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->committee_cold_cred, &copy->committee_cold_cred);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->committee_hot_cred != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->committee_hot_cred, &copy->committee_hot_cred);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/cert_type.c b/vendor/src/certs/cert_type.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/cert_type.c
@@ -0,0 +1,98 @@
+/**
+ * \file cert_type.c
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_cert_type_to_string(const cardano_cert_type_t cert_type)
+{
+  const char* message;
+
+  switch (cert_type)
+  {
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION:
+      message = "Certificate Type: Stake Registration";
+      break;
+    case CARDANO_CERT_TYPE_STAKE_DEREGISTRATION:
+      message = "Certificate Type: Stake Deregistration";
+      break;
+    case CARDANO_CERT_TYPE_STAKE_DELEGATION:
+      message = "Certificate Type: Stake Delegation";
+      break;
+    case CARDANO_CERT_TYPE_POOL_REGISTRATION:
+      message = "Certificate Type: Pool Registration";
+      break;
+    case CARDANO_CERT_TYPE_POOL_RETIREMENT:
+      message = "Certificate Type: Pool Retirement";
+      break;
+    case CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION:
+      message = "Certificate Type: Genesis Key Delegation";
+      break;
+    case CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS:
+      message = "Certificate Type: Move Instantaneous Rewards";
+      break;
+    case CARDANO_CERT_TYPE_REGISTRATION:
+      message = "Certificate Type: Registration";
+      break;
+    case CARDANO_CERT_TYPE_UNREGISTRATION:
+      message = "Certificate Type: Unregistration";
+      break;
+    case CARDANO_CERT_TYPE_VOTE_DELEGATION:
+      message = "Certificate Type: Vote Delegation";
+      break;
+    case CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION:
+      message = "Certificate Type: Stake Vote Delegation";
+      break;
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION:
+      message = "Certificate Type: Stake Registration Delegation";
+      break;
+    case CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION:
+      message = "Certificate Type: Vote Registration Delegation";
+      break;
+    case CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION:
+      message = "Certificate Type: Stake Vote Registration Delegation";
+      break;
+    case CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT:
+      message = "Certificate Type: Auth Committee Hot";
+      break;
+    case CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD:
+      message = "Certificate Type: Resign Committee Cold";
+      break;
+    case CARDANO_CERT_TYPE_DREP_REGISTRATION:
+      message = "Certificate Type: DRep Registration";
+      break;
+    case CARDANO_CERT_TYPE_DREP_UNREGISTRATION:
+      message = "Certificate Type: DRep Unregistration";
+      break;
+    case CARDANO_CERT_TYPE_UPDATE_DREP:
+      message = "Certificate Type: Update DRep";
+      break;
+    default:
+      message = "Certificate Type: Unknown";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/certs/certificate.c b/vendor/src/certs/certificate.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/certificate.c
@@ -0,0 +1,2238 @@
+/**
+ * \file certificate.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/auth_committee_hot_cert.h>
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/certificate.h>
+#include <cardano/certs/genesis_key_delegation_cert.h>
+#include <cardano/certs/mir_cert.h>
+#include <cardano/certs/pool_registration_cert.h>
+#include <cardano/certs/pool_retirement_cert.h>
+#include <cardano/certs/register_drep_cert.h>
+#include <cardano/certs/registration_cert.h>
+#include <cardano/certs/resign_committee_cold_cert.h>
+#include <cardano/certs/stake_delegation_cert.h>
+#include <cardano/certs/stake_deregistration_cert.h>
+#include <cardano/certs/stake_registration_cert.h>
+#include <cardano/certs/stake_registration_delegation_cert.h>
+#include <cardano/certs/stake_vote_delegation_cert.h>
+#include <cardano/certs/stake_vote_registration_delegation_cert.h>
+#include <cardano/certs/unregister_drep_cert.h>
+#include <cardano/certs/unregistration_cert.h>
+#include <cardano/certs/update_drep_cert.h>
+#include <cardano/certs/vote_delegation_cert.h>
+#include <cardano/certs/vote_registration_delegation_cert.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Certificates are a means to encode various essential operations related to stake
+ * delegation and stake pool management. Certificates are embedded in transactions and
+ * included in blocks. They're a vital aspect of Cardano's proof-of-stake mechanism,
+ * ensuring that stakeholders can participate in the protocol and its governance.
+ */
+typedef struct cardano_certificate_t
+{
+    cardano_object_t                                   base;
+    cardano_cert_type_t                                type;
+    cardano_auth_committee_hot_cert_t*                 auth_committee_hot_cert;
+    cardano_genesis_key_delegation_cert_t*             genesis_key_delegation_cert;
+    cardano_mir_cert_t*                                mir_cert;
+    cardano_pool_registration_cert_t*                  pool_registration_cert;
+    cardano_pool_retirement_cert_t*                    pool_retirement_cert;
+    cardano_register_drep_cert_t*                      register_drep_cert;
+    cardano_registration_cert_t*                       registration_cert;
+    cardano_resign_committee_cold_cert_t*              resign_committee_cold_cert;
+    cardano_stake_delegation_cert_t*                   stake_delegation_cert;
+    cardano_stake_deregistration_cert_t*               stake_deregistration_cert;
+    cardano_stake_registration_cert_t*                 stake_registration_cert;
+    cardano_stake_registration_delegation_cert_t*      stake_registration_delegation_cert;
+    cardano_stake_vote_delegation_cert_t*              stake_vote_delegation_cert;
+    cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration_delegation_cert;
+    cardano_unregister_drep_cert_t*                    unregister_drep_cert;
+    cardano_unregistration_cert_t*                     unregistration_cert;
+    cardano_update_drep_cert_t*                        update_drep_cert;
+    cardano_vote_delegation_cert_t*                    vote_delegation_cert;
+    cardano_vote_registration_delegation_cert_t*       vote_registration_delegation_cert;
+} cardano_certificate_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a certificate object.
+ *
+ * This function is responsible for properly deallocating a certificate object (`cardano_certificate_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the certificate object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_certificate_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the certificate
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_certificate_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_certificate_t* data = (cardano_certificate_t*)object;
+
+  cardano_auth_committee_hot_cert_unref(&data->auth_committee_hot_cert);
+  cardano_genesis_key_delegation_cert_unref(&data->genesis_key_delegation_cert);
+  cardano_mir_cert_unref(&data->mir_cert);
+  cardano_pool_registration_cert_unref(&data->pool_registration_cert);
+  cardano_pool_retirement_cert_unref(&data->pool_retirement_cert);
+  cardano_register_drep_cert_unref(&data->register_drep_cert);
+  cardano_registration_cert_unref(&data->registration_cert);
+  cardano_resign_committee_cold_cert_unref(&data->resign_committee_cold_cert);
+  cardano_stake_delegation_cert_unref(&data->stake_delegation_cert);
+  cardano_stake_deregistration_cert_unref(&data->stake_deregistration_cert);
+  cardano_stake_registration_cert_unref(&data->stake_registration_cert);
+  cardano_stake_registration_delegation_cert_unref(&data->stake_registration_delegation_cert);
+  cardano_stake_vote_delegation_cert_unref(&data->stake_vote_delegation_cert);
+  cardano_stake_vote_registration_delegation_cert_unref(&data->stake_vote_registration_delegation_cert);
+  cardano_unregister_drep_cert_unref(&data->unregister_drep_cert);
+  cardano_unregistration_cert_unref(&data->unregistration_cert);
+  cardano_update_drep_cert_unref(&data->update_drep_cert);
+  cardano_vote_delegation_cert_unref(&data->vote_delegation_cert);
+  cardano_vote_registration_delegation_cert_unref(&data->vote_registration_delegation_cert);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new certificate object.
+ *
+ * \return A pointer to the newly created cardano_certificate_t object, or `NULL` if the operation failed.
+ */
+static cardano_certificate_t*
+cardano_certificate_new(void)
+{
+  cardano_certificate_t* data = _cardano_malloc(sizeof(cardano_certificate_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count                          = 1;
+  data->base.last_error[0]                      = '\0';
+  data->base.deallocator                        = cardano_certificate_deallocate;
+  data->auth_committee_hot_cert                 = NULL;
+  data->genesis_key_delegation_cert             = NULL;
+  data->mir_cert                                = NULL;
+  data->pool_registration_cert                  = NULL;
+  data->pool_retirement_cert                    = NULL;
+  data->register_drep_cert                      = NULL;
+  data->registration_cert                       = NULL;
+  data->resign_committee_cold_cert              = NULL;
+  data->stake_delegation_cert                   = NULL;
+  data->stake_deregistration_cert               = NULL;
+  data->stake_registration_cert                 = NULL;
+  data->stake_registration_delegation_cert      = NULL;
+  data->stake_vote_delegation_cert              = NULL;
+  data->stake_vote_registration_delegation_cert = NULL;
+  data->unregister_drep_cert                    = NULL;
+  data->unregistration_cert                     = NULL;
+  data->update_drep_cert                        = NULL;
+  data->vote_delegation_cert                    = NULL;
+  data->vote_registration_delegation_cert       = NULL;
+  data->type                                    = CARDANO_CERT_TYPE_STAKE_REGISTRATION;
+
+  return data;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_certificate_new_auth_committee_hot(
+  cardano_auth_committee_hot_cert_t* auth_committee_hot_cert,
+  cardano_certificate_t**            certificate)
+{
+  if (auth_committee_hot_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_auth_committee_hot_cert_ref(auth_committee_hot_cert);
+
+  data->auth_committee_hot_cert = auth_committee_hot_cert;
+  data->type                    = CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_genesis_key_delegation(
+  cardano_genesis_key_delegation_cert_t* genesis_key_delegation,
+  cardano_certificate_t**                certificate)
+{
+  if (genesis_key_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_genesis_key_delegation_cert_ref(genesis_key_delegation);
+
+  data->genesis_key_delegation_cert = genesis_key_delegation;
+  data->type                        = CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_mir(
+  cardano_mir_cert_t*     mir,
+  cardano_certificate_t** certificate)
+{
+  if (mir == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_mir_cert_ref(mir);
+
+  data->mir_cert = mir;
+  data->type     = CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_pool_registration(
+  cardano_pool_registration_cert_t* pool_registration,
+  cardano_certificate_t**           certificate)
+{
+  if (pool_registration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_pool_registration_cert_ref(pool_registration);
+
+  data->pool_registration_cert = pool_registration;
+  data->type                   = CARDANO_CERT_TYPE_POOL_REGISTRATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_pool_retirement(
+  cardano_pool_retirement_cert_t* pool_retirement,
+  cardano_certificate_t**         certificate)
+{
+  if (pool_retirement == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_pool_retirement_cert_ref(pool_retirement);
+
+  data->pool_retirement_cert = pool_retirement;
+  data->type                 = CARDANO_CERT_TYPE_POOL_RETIREMENT;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_register_drep(
+  cardano_register_drep_cert_t* register_drep,
+  cardano_certificate_t**       certificate)
+{
+  if (register_drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_register_drep_cert_ref(register_drep);
+
+  data->register_drep_cert = register_drep;
+  data->type               = CARDANO_CERT_TYPE_DREP_REGISTRATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_registration(
+  cardano_registration_cert_t* registration,
+  cardano_certificate_t**      certificate)
+{
+  if (registration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_registration_cert_ref(registration);
+
+  data->registration_cert = registration;
+  data->type              = CARDANO_CERT_TYPE_REGISTRATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_resign_committee_cold(
+  cardano_resign_committee_cold_cert_t* resign_committee_cold,
+  cardano_certificate_t**               certificate)
+{
+  if (resign_committee_cold == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_resign_committee_cold_cert_ref(resign_committee_cold);
+
+  data->resign_committee_cold_cert = resign_committee_cold;
+  data->type                       = CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_stake_delegation(
+  cardano_stake_delegation_cert_t* stake_delegation,
+  cardano_certificate_t**          certificate)
+{
+  if (stake_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_stake_delegation_cert_ref(stake_delegation);
+
+  data->stake_delegation_cert = stake_delegation;
+  data->type                  = CARDANO_CERT_TYPE_STAKE_DELEGATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_stake_deregistration(
+  cardano_stake_deregistration_cert_t* stake_deregistration,
+  cardano_certificate_t**              certificate)
+{
+  if (stake_deregistration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_stake_deregistration_cert_ref(stake_deregistration);
+
+  data->stake_deregistration_cert = stake_deregistration;
+  data->type                      = CARDANO_CERT_TYPE_STAKE_DEREGISTRATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_stake_registration(
+  cardano_stake_registration_cert_t* stake_registration,
+  cardano_certificate_t**            certificate)
+{
+  if (stake_registration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_stake_registration_cert_ref(stake_registration);
+
+  data->stake_registration_cert = stake_registration;
+  data->type                    = CARDANO_CERT_TYPE_STAKE_REGISTRATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_stake_registration_delegation(
+  cardano_stake_registration_delegation_cert_t* stake_registration_delegation,
+  cardano_certificate_t**                       certificate)
+{
+  if (stake_registration_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_stake_registration_delegation_cert_ref(stake_registration_delegation);
+
+  data->stake_registration_delegation_cert = stake_registration_delegation;
+  data->type                               = CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_stake_vote_delegation(
+  cardano_stake_vote_delegation_cert_t* stake_vote_delegation,
+  cardano_certificate_t**               certificate)
+{
+  if (stake_vote_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_stake_vote_delegation_cert_ref(stake_vote_delegation);
+
+  data->stake_vote_delegation_cert = stake_vote_delegation;
+  data->type                       = CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_stake_vote_registration_delegation(
+  cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration_delegation,
+  cardano_certificate_t**                            certificate)
+{
+  if (stake_vote_registration_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_stake_vote_registration_delegation_cert_ref(stake_vote_registration_delegation);
+
+  data->stake_vote_registration_delegation_cert = stake_vote_registration_delegation;
+  data->type                                    = CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_unregister_drep(
+  cardano_unregister_drep_cert_t* unregister_drep,
+  cardano_certificate_t**         certificate)
+{
+  if (unregister_drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_unregister_drep_cert_ref(unregister_drep);
+
+  data->unregister_drep_cert = unregister_drep;
+  data->type                 = CARDANO_CERT_TYPE_DREP_UNREGISTRATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_unregistration(
+  cardano_unregistration_cert_t* unregistration,
+  cardano_certificate_t**        certificate)
+{
+  if (unregistration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_unregistration_cert_ref(unregistration);
+
+  data->unregistration_cert = unregistration;
+  data->type                = CARDANO_CERT_TYPE_UNREGISTRATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_update_drep(
+  cardano_update_drep_cert_t* update_drep,
+  cardano_certificate_t**     certificate)
+{
+  if (update_drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_update_drep_cert_ref(update_drep);
+
+  data->update_drep_cert = update_drep;
+  data->type             = CARDANO_CERT_TYPE_UPDATE_DREP;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_vote_delegation(
+  cardano_vote_delegation_cert_t* vote_delegation,
+  cardano_certificate_t**         certificate)
+{
+  if (vote_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_vote_delegation_cert_ref(vote_delegation);
+
+  data->vote_delegation_cert = vote_delegation;
+  data->type                 = CARDANO_CERT_TYPE_VOTE_DELEGATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_new_vote_registration_delegation(
+  cardano_vote_registration_delegation_cert_t* vote_registration_delegation,
+  cardano_certificate_t**                      certificate)
+{
+  if (vote_registration_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* data = cardano_certificate_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_vote_registration_delegation_cert_ref(vote_registration_delegation);
+
+  data->vote_registration_delegation_cert = vote_registration_delegation;
+  data->type                              = CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION;
+
+  *certificate = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_from_cbor(cardano_cbor_reader_t* reader, cardano_certificate_t** certificate)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_reader_t* reader_clone = NULL;
+
+  cardano_error_t result = cardano_cbor_reader_clone(reader, &reader_clone);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  static const char* validator_name = "certificate";
+
+  int64_t array_size = 0;
+  result             = cardano_cbor_reader_read_start_array(reader_clone, &array_size);
+
+  CARDANO_UNUSED(array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_clone);
+    return result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "type",
+    reader_clone,
+    &type,
+    CARDANO_CERT_TYPE_STAKE_REGISTRATION,
+    CARDANO_CERT_TYPE_UPDATE_DREP);
+
+  cardano_cbor_reader_unref(&reader_clone);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  switch (type)
+  {
+    case CARDANO_CERT_TYPE_REGISTRATION:
+    {
+      cardano_registration_cert_t* registration_cert = NULL;
+
+      result = cardano_registration_cert_from_cbor(reader, &registration_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_registration(registration_cert, certificate);
+
+      cardano_registration_cert_unref(&registration_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_UNREGISTRATION:
+    {
+      cardano_unregistration_cert_t* unregistration_cert = NULL;
+
+      result = cardano_unregistration_cert_from_cbor(reader, &unregistration_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_unregistration(unregistration_cert, certificate);
+
+      cardano_unregistration_cert_unref(&unregistration_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT:
+    {
+      cardano_auth_committee_hot_cert_t* auth_committee_hot_cert = NULL;
+
+      result = cardano_auth_committee_hot_cert_from_cbor(reader, &auth_committee_hot_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_auth_committee_hot(auth_committee_hot_cert, certificate);
+
+      cardano_auth_committee_hot_cert_unref(&auth_committee_hot_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION:
+    {
+      cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert = NULL;
+
+      result = cardano_genesis_key_delegation_cert_from_cbor(reader, &genesis_key_delegation_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_genesis_key_delegation(genesis_key_delegation_cert, certificate);
+
+      cardano_genesis_key_delegation_cert_unref(&genesis_key_delegation_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS:
+    {
+      cardano_mir_cert_t* mir_cert = NULL;
+
+      result = cardano_mir_cert_from_cbor(reader, &mir_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_mir(mir_cert, certificate);
+
+      cardano_mir_cert_unref(&mir_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_POOL_REGISTRATION:
+    {
+      cardano_pool_registration_cert_t* pool_registration_cert = NULL;
+
+      result = cardano_pool_registration_cert_from_cbor(reader, &pool_registration_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_pool_registration(pool_registration_cert, certificate);
+
+      cardano_pool_registration_cert_unref(&pool_registration_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_POOL_RETIREMENT:
+    {
+      cardano_pool_retirement_cert_t* pool_retirement_cert = NULL;
+
+      result = cardano_pool_retirement_cert_from_cbor(reader, &pool_retirement_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_pool_retirement(pool_retirement_cert, certificate);
+
+      cardano_pool_retirement_cert_unref(&pool_retirement_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_DREP_REGISTRATION:
+    {
+      cardano_register_drep_cert_t* register_drep_cert = NULL;
+
+      result = cardano_register_drep_cert_from_cbor(reader, &register_drep_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_register_drep(register_drep_cert, certificate);
+
+      cardano_register_drep_cert_unref(&register_drep_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION:
+    {
+      cardano_stake_registration_cert_t* stake_registration_cert = NULL;
+
+      result = cardano_stake_registration_cert_from_cbor(reader, &stake_registration_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_stake_registration(stake_registration_cert, certificate);
+
+      cardano_stake_registration_cert_unref(&stake_registration_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD:
+    {
+      cardano_resign_committee_cold_cert_t* resign_committee_cold_cert = NULL;
+
+      result = cardano_resign_committee_cold_cert_from_cbor(reader, &resign_committee_cold_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_resign_committee_cold(resign_committee_cold_cert, certificate);
+
+      cardano_resign_committee_cold_cert_unref(&resign_committee_cold_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DELEGATION:
+    {
+      cardano_stake_delegation_cert_t* stake_delegation_cert = NULL;
+
+      result = cardano_stake_delegation_cert_from_cbor(reader, &stake_delegation_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_stake_delegation(stake_delegation_cert, certificate);
+
+      cardano_stake_delegation_cert_unref(&stake_delegation_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DEREGISTRATION:
+    {
+      cardano_stake_deregistration_cert_t* stake_deregistration_cert = NULL;
+
+      result = cardano_stake_deregistration_cert_from_cbor(reader, &stake_deregistration_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_stake_deregistration(stake_deregistration_cert, certificate);
+
+      cardano_stake_deregistration_cert_unref(&stake_deregistration_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION:
+    {
+      cardano_stake_registration_delegation_cert_t* stake_registration_delegation_cert = NULL;
+
+      result = cardano_stake_registration_delegation_cert_from_cbor(reader, &stake_registration_delegation_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_stake_registration_delegation(stake_registration_delegation_cert, certificate);
+
+      cardano_stake_registration_delegation_cert_unref(&stake_registration_delegation_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION:
+    {
+      cardano_stake_vote_delegation_cert_t* stake_vote_delegation_cert = NULL;
+
+      result = cardano_stake_vote_delegation_cert_from_cbor(reader, &stake_vote_delegation_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_stake_vote_delegation(stake_vote_delegation_cert, certificate);
+
+      cardano_stake_vote_delegation_cert_unref(&stake_vote_delegation_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION:
+    {
+      cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration_delegation_cert = NULL;
+
+      result = cardano_stake_vote_registration_delegation_cert_from_cbor(reader, &stake_vote_registration_delegation_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_stake_vote_registration_delegation(stake_vote_registration_delegation_cert, certificate);
+
+      cardano_stake_vote_registration_delegation_cert_unref(&stake_vote_registration_delegation_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_DREP_UNREGISTRATION:
+    {
+      cardano_unregister_drep_cert_t* unregister_drep_cert = NULL;
+
+      result = cardano_unregister_drep_cert_from_cbor(reader, &unregister_drep_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_unregister_drep(unregister_drep_cert, certificate);
+
+      cardano_unregister_drep_cert_unref(&unregister_drep_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_UPDATE_DREP:
+    {
+      cardano_update_drep_cert_t* update_drep_cert = NULL;
+
+      result = cardano_update_drep_cert_from_cbor(reader, &update_drep_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_update_drep(update_drep_cert, certificate);
+
+      cardano_update_drep_cert_unref(&update_drep_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_VOTE_DELEGATION:
+    {
+      cardano_vote_delegation_cert_t* vote_delegation_cert = NULL;
+
+      result = cardano_vote_delegation_cert_from_cbor(reader, &vote_delegation_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_vote_delegation(vote_delegation_cert, certificate);
+
+      cardano_vote_delegation_cert_unref(&vote_delegation_cert);
+      return result;
+    }
+    case CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION:
+    {
+      cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert = NULL;
+
+      result = cardano_vote_registration_delegation_cert_from_cbor(reader, &vote_registration_delegation_cert);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_certificate_new_vote_registration_delegation(vote_registration_delegation_cert, certificate);
+
+      cardano_vote_registration_delegation_cert_unref(&vote_registration_delegation_cert);
+      return result;
+    }
+
+    default:
+    {
+      return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+    }
+  }
+}
+
+cardano_error_t
+cardano_certificate_to_cbor(
+  const cardano_certificate_t* certificate,
+  cardano_cbor_writer_t*       writer)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (certificate->type)
+  {
+    case CARDANO_CERT_TYPE_REGISTRATION:
+    {
+      result = cardano_registration_cert_to_cbor(certificate->registration_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_UNREGISTRATION:
+    {
+      result = cardano_unregistration_cert_to_cbor(certificate->unregistration_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT:
+    {
+      result = cardano_auth_committee_hot_cert_to_cbor(certificate->auth_committee_hot_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION:
+    {
+      result = cardano_genesis_key_delegation_cert_to_cbor(certificate->genesis_key_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS:
+    {
+      result = cardano_mir_cert_to_cbor(certificate->mir_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_POOL_REGISTRATION:
+    {
+      result = cardano_pool_registration_cert_to_cbor(certificate->pool_registration_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_POOL_RETIREMENT:
+    {
+      result = cardano_pool_retirement_cert_to_cbor(certificate->pool_retirement_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_DREP_REGISTRATION:
+    {
+      result = cardano_register_drep_cert_to_cbor(certificate->register_drep_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION:
+    {
+      result = cardano_stake_registration_cert_to_cbor(certificate->stake_registration_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD:
+    {
+      result = cardano_resign_committee_cold_cert_to_cbor(certificate->resign_committee_cold_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DELEGATION:
+    {
+      result = cardano_stake_delegation_cert_to_cbor(certificate->stake_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DEREGISTRATION:
+    {
+      result = cardano_stake_deregistration_cert_to_cbor(certificate->stake_deregistration_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION:
+    {
+      result = cardano_stake_registration_delegation_cert_to_cbor(certificate->stake_registration_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION:
+    {
+      result = cardano_stake_vote_delegation_cert_to_cbor(certificate->stake_vote_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION:
+    {
+      result = cardano_stake_vote_registration_delegation_cert_to_cbor(certificate->stake_vote_registration_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_DREP_UNREGISTRATION:
+    {
+      result = cardano_unregister_drep_cert_to_cbor(certificate->unregister_drep_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_UPDATE_DREP:
+    {
+      result = cardano_update_drep_cert_to_cbor(certificate->update_drep_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_VOTE_DELEGATION:
+    {
+      result = cardano_vote_delegation_cert_to_cbor(certificate->vote_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION:
+    {
+      result = cardano_vote_registration_delegation_cert_to_cbor(certificate->vote_registration_delegation_cert, writer);
+      break;
+    }
+
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_certificate_to_cip116_json(
+  const cardano_certificate_t* certificate,
+  cardano_json_writer_t*       writer)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (certificate->type)
+  {
+    case CARDANO_CERT_TYPE_REGISTRATION:
+    {
+      result = cardano_registration_cert_to_cip116_json(certificate->registration_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_UNREGISTRATION:
+    {
+      result = cardano_unregistration_cert_to_cip116_json(certificate->unregistration_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT:
+    {
+      result = cardano_auth_committee_hot_cert_to_cip116_json(certificate->auth_committee_hot_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION:
+    {
+      result = cardano_genesis_key_delegation_cert_to_cip116_json(certificate->genesis_key_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS:
+    {
+      result = cardano_mir_cert_to_cip116_json(certificate->mir_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_POOL_REGISTRATION:
+    {
+      result = cardano_pool_registration_cert_to_cip116_json(certificate->pool_registration_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_POOL_RETIREMENT:
+    {
+      result = cardano_pool_retirement_cert_to_cip116_json(certificate->pool_retirement_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_DREP_REGISTRATION:
+    {
+      result = cardano_register_drep_cert_to_cip116_json(certificate->register_drep_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION:
+    {
+      result = cardano_stake_registration_cert_to_cip116_json(certificate->stake_registration_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD:
+    {
+      result = cardano_resign_committee_cold_cert_to_cip116_json(certificate->resign_committee_cold_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DELEGATION:
+    {
+      result = cardano_stake_delegation_cert_to_cip116_json(certificate->stake_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DEREGISTRATION:
+    {
+      result = cardano_stake_deregistration_cert_to_cip116_json(certificate->stake_deregistration_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION:
+    {
+      result = cardano_stake_registration_delegation_cert_to_cip116_json(certificate->stake_registration_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION:
+    {
+      result = cardano_stake_vote_delegation_cert_to_cip116_json(certificate->stake_vote_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION:
+    {
+      result = cardano_stake_vote_registration_delegation_cert_to_cip116_json(certificate->stake_vote_registration_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_DREP_UNREGISTRATION:
+    {
+      result = cardano_unregister_drep_cert_to_cip116_json(certificate->unregister_drep_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_UPDATE_DREP:
+    {
+      result = cardano_update_drep_cert_to_cip116_json(certificate->update_drep_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_VOTE_DELEGATION:
+    {
+      result = cardano_vote_delegation_cert_to_cip116_json(certificate->vote_delegation_cert, writer);
+      break;
+    }
+    case CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION:
+    {
+      result = cardano_vote_registration_delegation_cert_to_cip116_json(certificate->vote_registration_delegation_cert, writer);
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+      break;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_cert_get_type(const cardano_certificate_t* certificate, cardano_cert_type_t* type)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = certificate->type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_auth_committee_hot(
+  cardano_certificate_t*              certificate,
+  cardano_auth_committee_hot_cert_t** auth_committee_hot_cert)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (auth_committee_hot_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_auth_committee_hot_cert_ref(certificate->auth_committee_hot_cert);
+
+  *auth_committee_hot_cert = certificate->auth_committee_hot_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_genesis_key_delegation(
+  cardano_certificate_t*                  certificate,
+  cardano_genesis_key_delegation_cert_t** genesis_key_delegation)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (genesis_key_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_genesis_key_delegation_cert_ref(certificate->genesis_key_delegation_cert);
+
+  *genesis_key_delegation = certificate->genesis_key_delegation_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_mir(
+  cardano_certificate_t* certificate,
+  cardano_mir_cert_t**   mir)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (mir == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_mir_cert_ref(certificate->mir_cert);
+
+  *mir = certificate->mir_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_pool_registration(
+  cardano_certificate_t*             certificate,
+  cardano_pool_registration_cert_t** pool_registration)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pool_registration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_POOL_REGISTRATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_pool_registration_cert_ref(certificate->pool_registration_cert);
+
+  *pool_registration = certificate->pool_registration_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_pool_retirement(
+  cardano_certificate_t*           certificate,
+  cardano_pool_retirement_cert_t** pool_retirement)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pool_retirement == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_POOL_RETIREMENT)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_pool_retirement_cert_ref(certificate->pool_retirement_cert);
+
+  *pool_retirement = certificate->pool_retirement_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_register_drep(
+  cardano_certificate_t*         certificate,
+  cardano_register_drep_cert_t** register_drep)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (register_drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_DREP_REGISTRATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_register_drep_cert_ref(certificate->register_drep_cert);
+
+  *register_drep = certificate->register_drep_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_registration(
+  cardano_certificate_t*        certificate,
+  cardano_registration_cert_t** registration)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (registration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_REGISTRATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_registration_cert_ref(certificate->registration_cert);
+
+  *registration = certificate->registration_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_resign_committee_cold(
+  cardano_certificate_t*                 certificate,
+  cardano_resign_committee_cold_cert_t** resign_committee_cold)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (resign_committee_cold == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_resign_committee_cold_cert_ref(certificate->resign_committee_cold_cert);
+
+  *resign_committee_cold = certificate->resign_committee_cold_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_stake_delegation(
+  cardano_certificate_t*            certificate,
+  cardano_stake_delegation_cert_t** stake_delegation)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_STAKE_DELEGATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_stake_delegation_cert_ref(certificate->stake_delegation_cert);
+
+  *stake_delegation = certificate->stake_delegation_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_stake_deregistration(
+  cardano_certificate_t*                certificate,
+  cardano_stake_deregistration_cert_t** stake_deregistration)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_deregistration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_STAKE_DEREGISTRATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_stake_deregistration_cert_ref(certificate->stake_deregistration_cert);
+
+  *stake_deregistration = certificate->stake_deregistration_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_stake_registration(
+  cardano_certificate_t*              certificate,
+  cardano_stake_registration_cert_t** stake_registration)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_registration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_STAKE_REGISTRATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_stake_registration_cert_ref(certificate->stake_registration_cert);
+
+  *stake_registration = certificate->stake_registration_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_stake_registration_delegation(
+  cardano_certificate_t*                         certificate,
+  cardano_stake_registration_delegation_cert_t** stake_registration_delegation)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_registration_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_stake_registration_delegation_cert_ref(certificate->stake_registration_delegation_cert);
+
+  *stake_registration_delegation = certificate->stake_registration_delegation_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_stake_vote_delegation(
+  cardano_certificate_t*                 certificate,
+  cardano_stake_vote_delegation_cert_t** stake_vote_delegation)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_vote_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_stake_vote_delegation_cert_ref(certificate->stake_vote_delegation_cert);
+
+  *stake_vote_delegation = certificate->stake_vote_delegation_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_stake_vote_registration_delegation(
+  cardano_certificate_t*                              certificate,
+  cardano_stake_vote_registration_delegation_cert_t** stake_vote_registration_delegation)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_vote_registration_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_stake_vote_registration_delegation_cert_ref(certificate->stake_vote_registration_delegation_cert);
+
+  *stake_vote_registration_delegation = certificate->stake_vote_registration_delegation_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_unregister_drep(
+  cardano_certificate_t*           certificate,
+  cardano_unregister_drep_cert_t** unregister_drep)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (unregister_drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_DREP_UNREGISTRATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_unregister_drep_cert_ref(certificate->unregister_drep_cert);
+
+  *unregister_drep = certificate->unregister_drep_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_unregistration(
+  cardano_certificate_t*          certificate,
+  cardano_unregistration_cert_t** unregistration)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (unregistration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_UNREGISTRATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_unregistration_cert_ref(certificate->unregistration_cert);
+
+  *unregistration = certificate->unregistration_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_update_drep(
+  cardano_certificate_t*       certificate,
+  cardano_update_drep_cert_t** update_drep)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (update_drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_UPDATE_DREP)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_update_drep_cert_ref(certificate->update_drep_cert);
+
+  *update_drep = certificate->update_drep_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_vote_delegation(
+  cardano_certificate_t*           certificate,
+  cardano_vote_delegation_cert_t** vote_delegation)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vote_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_VOTE_DELEGATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_vote_delegation_cert_ref(certificate->vote_delegation_cert);
+
+  *vote_delegation = certificate->vote_delegation_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_to_vote_registration_delegation(
+  cardano_certificate_t*                        certificate,
+  cardano_vote_registration_delegation_cert_t** vote_registration_delegation)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vote_registration_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate->type != CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_vote_registration_delegation_cert_ref(certificate->vote_registration_delegation_cert);
+
+  *vote_registration_delegation = certificate->vote_registration_delegation_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_certificate_unref(cardano_certificate_t** certificate)
+{
+  if ((certificate == NULL) || (*certificate == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*certificate)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *certificate = NULL;
+    return;
+  }
+}
+
+void
+cardano_certificate_ref(cardano_certificate_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&certificate->base);
+}
+
+size_t
+cardano_certificate_refcount(const cardano_certificate_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&certificate->base);
+}
+
+void
+cardano_certificate_set_last_error(cardano_certificate_t* certificate, const char* message)
+{
+  cardano_object_set_last_error(&certificate->base, message);
+}
+
+const char*
+cardano_certificate_get_last_error(const cardano_certificate_t* certificate)
+{
+  return cardano_object_get_last_error(&certificate->base);
+}
+
+cardano_error_t
+cardano_certificate_deep_clone(const cardano_certificate_t* source, cardano_certificate_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t* copy = _cardano_malloc(sizeof(cardano_certificate_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count                          = 1U;
+  copy->base.deallocator                        = source->base.deallocator;
+  copy->base.last_error[0]                      = '\0';
+  copy->type                                    = source->type;
+  copy->auth_committee_hot_cert                 = NULL;
+  copy->genesis_key_delegation_cert             = NULL;
+  copy->mir_cert                                = NULL;
+  copy->pool_registration_cert                  = NULL;
+  copy->pool_retirement_cert                    = NULL;
+  copy->register_drep_cert                      = NULL;
+  copy->registration_cert                       = NULL;
+  copy->resign_committee_cold_cert              = NULL;
+  copy->stake_delegation_cert                   = NULL;
+  copy->stake_deregistration_cert               = NULL;
+  copy->stake_registration_cert                 = NULL;
+  copy->stake_registration_delegation_cert      = NULL;
+  copy->stake_vote_delegation_cert              = NULL;
+  copy->stake_vote_registration_delegation_cert = NULL;
+  copy->unregister_drep_cert                    = NULL;
+  copy->unregistration_cert                     = NULL;
+  copy->update_drep_cert                        = NULL;
+  copy->vote_delegation_cert                    = NULL;
+  copy->vote_registration_delegation_cert       = NULL;
+
+  if (source->auth_committee_hot_cert != NULL)
+  {
+    const cardano_error_t result = cardano_auth_committee_hot_cert_deep_clone(source->auth_committee_hot_cert, &copy->auth_committee_hot_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->genesis_key_delegation_cert != NULL)
+  {
+    const cardano_error_t result = cardano_genesis_key_delegation_cert_deep_clone(source->genesis_key_delegation_cert, &copy->genesis_key_delegation_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->mir_cert != NULL)
+  {
+    const cardano_error_t result = cardano_mir_cert_deep_clone(source->mir_cert, &copy->mir_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pool_registration_cert != NULL)
+  {
+    const cardano_error_t result = cardano_pool_registration_cert_deep_clone(source->pool_registration_cert, &copy->pool_registration_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pool_retirement_cert != NULL)
+  {
+    const cardano_error_t result = cardano_pool_retirement_cert_deep_clone(source->pool_retirement_cert, &copy->pool_retirement_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->register_drep_cert != NULL)
+  {
+    const cardano_error_t result = cardano_register_drep_cert_deep_clone(source->register_drep_cert, &copy->register_drep_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->registration_cert != NULL)
+  {
+    const cardano_error_t result = cardano_registration_cert_deep_clone(source->registration_cert, &copy->registration_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->resign_committee_cold_cert != NULL)
+  {
+    const cardano_error_t result = cardano_resign_committee_cold_cert_deep_clone(source->resign_committee_cold_cert, &copy->resign_committee_cold_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->stake_delegation_cert != NULL)
+  {
+    const cardano_error_t result = cardano_stake_delegation_cert_deep_clone(source->stake_delegation_cert, &copy->stake_delegation_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->stake_deregistration_cert != NULL)
+  {
+    const cardano_error_t result = cardano_stake_deregistration_cert_deep_clone(source->stake_deregistration_cert, &copy->stake_deregistration_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->stake_registration_cert != NULL)
+  {
+    const cardano_error_t result = cardano_stake_registration_cert_deep_clone(source->stake_registration_cert, &copy->stake_registration_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->stake_registration_delegation_cert != NULL)
+  {
+    const cardano_error_t result = cardano_stake_registration_delegation_cert_deep_clone(source->stake_registration_delegation_cert, &copy->stake_registration_delegation_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->stake_vote_delegation_cert != NULL)
+  {
+    const cardano_error_t result = cardano_stake_vote_delegation_cert_deep_clone(source->stake_vote_delegation_cert, &copy->stake_vote_delegation_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->stake_vote_registration_delegation_cert != NULL)
+  {
+    const cardano_error_t result = cardano_stake_vote_registration_delegation_cert_deep_clone(source->stake_vote_registration_delegation_cert, &copy->stake_vote_registration_delegation_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->unregister_drep_cert != NULL)
+  {
+    const cardano_error_t result = cardano_unregister_drep_cert_deep_clone(source->unregister_drep_cert, &copy->unregister_drep_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->unregistration_cert != NULL)
+  {
+    const cardano_error_t result = cardano_unregistration_cert_deep_clone(source->unregistration_cert, &copy->unregistration_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->update_drep_cert != NULL)
+  {
+    const cardano_error_t result = cardano_update_drep_cert_deep_clone(source->update_drep_cert, &copy->update_drep_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->vote_delegation_cert != NULL)
+  {
+    const cardano_error_t result = cardano_vote_delegation_cert_deep_clone(source->vote_delegation_cert, &copy->vote_delegation_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->vote_registration_delegation_cert != NULL)
+  {
+    const cardano_error_t result = cardano_vote_registration_delegation_cert_deep_clone(source->vote_registration_delegation_cert, &copy->vote_registration_delegation_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/certificate_set.c b/vendor/src/certs/certificate_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/certificate_set.c
@@ -0,0 +1,472 @@
+/**
+ * \file certificate_set.c
+ *
+ * \author angel.castillo
+ * \date   Sept 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/certificate_set.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano certificate set.
+ */
+typedef struct cardano_certificate_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_certificate_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a certificate set list object.
+ *
+ * This function is responsible for properly deallocating a certificate_set list object (`cardano_certificate_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the certificate_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_certificate_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the certificate_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_certificate_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_certificate_set_t* list = (cardano_certificate_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_certificate_set_new(cardano_certificate_set_t** certificate_set)
+{
+  if (certificate_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_set_t* list = _cardano_malloc(sizeof(cardano_certificate_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_certificate_set_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *certificate_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_set_from_cbor(cardano_cbor_reader_t* reader, cardano_certificate_set_t** certificate_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificate_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_set_t* list   = NULL;
+  cardano_error_t            result = cardano_certificate_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_certificate_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("certificate_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_certificate_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_certificate_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_certificate_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_certificate_t* element = NULL;
+
+    result = cardano_certificate_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_certificate_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_certificate_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_certificate_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("certificate_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_certificate_set_unref(&list);
+    return result;
+  }
+
+  *certificate_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_set_to_cbor(const cardano_certificate_set_t* certificate_set, cardano_cbor_writer_t* writer)
+{
+  if (certificate_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(certificate_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  size_t array_size = cardano_array_get_size(certificate_set->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(certificate_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(certificate_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in certificate_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_certificate_to_cbor((cardano_certificate_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_certificate_set_to_cip116_json(
+  const cardano_certificate_set_t* certs,
+  cardano_json_writer_t*           writer)
+{
+  if ((certs == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t length = cardano_certificate_set_get_length(certs);
+
+  for (size_t i = 0; i < length; ++i)
+  {
+    cardano_certificate_t* cert  = NULL;
+    cardano_error_t        error = cardano_certificate_set_get(certs, i, &cert);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_certificate_to_cip116_json(cert, writer);
+    cardano_certificate_unref(&cert);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_certificate_set_get_length(const cardano_certificate_set_t* certificate_set)
+{
+  if (certificate_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(certificate_set->array);
+}
+
+cardano_error_t
+cardano_certificate_set_get(
+  const cardano_certificate_set_t* certificate_set,
+  size_t                           index,
+  cardano_certificate_t**          element)
+{
+  if (certificate_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(certificate_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_certificate_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_certificate_set_add(cardano_certificate_set_t* certificate_set, cardano_certificate_t* element)
+{
+  if (certificate_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(certificate_set->array);
+  const size_t new_size      = cardano_array_push(certificate_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_certificate_set_unref(cardano_certificate_set_t** certificate_set)
+{
+  if ((certificate_set == NULL) || (*certificate_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*certificate_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *certificate_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_certificate_set_ref(cardano_certificate_set_t* certificate_set)
+{
+  if (certificate_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&certificate_set->base);
+}
+
+size_t
+cardano_certificate_set_refcount(const cardano_certificate_set_t* certificate_set)
+{
+  if (certificate_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&certificate_set->base);
+}
+
+void
+cardano_certificate_set_set_last_error(cardano_certificate_set_t* certificate_set, const char* message)
+{
+  cardano_object_set_last_error(&certificate_set->base, message);
+}
+
+const char*
+cardano_certificate_set_get_last_error(const cardano_certificate_set_t* certificate_set)
+{
+  return cardano_object_get_last_error(&certificate_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_certificate_t* copy   = NULL;
+  const cardano_error_t  result = cardano_certificate_deep_clone((const cardano_certificate_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_certificate_set_deep_clone(const cardano_certificate_set_t* source, cardano_certificate_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_set_t* copy = _cardano_malloc(sizeof(cardano_certificate_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/genesis_key_delegation_cert.c b/vendor/src/certs/genesis_key_delegation_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/genesis_key_delegation_cert.c
@@ -0,0 +1,551 @@
+/**
+ * \file genesis_key_delegation_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/genesis_key_delegation_cert.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 4;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate is used to delegate from a Genesis key to a set of keys. This was primarily used in the early
+ * phases of the Cardano network's existence during the transition from the Byron to the Shelley era.
+ */
+typedef struct cardano_genesis_key_delegation_cert_t
+{
+    cardano_object_t        base;
+    cardano_blake2b_hash_t* genesis_hash;
+    cardano_blake2b_hash_t* genesis_delegate_hash;
+    cardano_blake2b_hash_t* vrf_key_hash;
+} cardano_genesis_key_delegation_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a genesis_key_delegation_cert object.
+ *
+ * This function is responsible for properly deallocating a genesis_key_delegation_cert object (`cardano_genesis_key_delegation_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the genesis_key_delegation_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_genesis_key_delegation_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the genesis_key_delegation_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_genesis_key_delegation_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_genesis_key_delegation_cert_t* data = (cardano_genesis_key_delegation_cert_t*)object;
+
+  cardano_blake2b_hash_unref(&data->genesis_hash);
+  cardano_blake2b_hash_unref(&data->genesis_delegate_hash);
+  cardano_blake2b_hash_unref(&data->vrf_key_hash);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_genesis_key_delegation_cert_new(
+  cardano_blake2b_hash_t*                 genesis_hash,
+  cardano_blake2b_hash_t*                 genesis_delegate_hash,
+  cardano_blake2b_hash_t*                 vrf_key_hash,
+  cardano_genesis_key_delegation_cert_t** cert)
+{
+  if (genesis_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (genesis_delegate_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vrf_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_genesis_key_delegation_cert_t* data = _cardano_malloc(sizeof(cardano_genesis_key_delegation_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_genesis_key_delegation_cert_deallocate;
+
+  cardano_blake2b_hash_ref(genesis_hash);
+  data->genesis_hash = genesis_hash;
+
+  cardano_blake2b_hash_ref(genesis_delegate_hash);
+  data->genesis_delegate_hash = genesis_delegate_hash;
+
+  cardano_blake2b_hash_ref(vrf_key_hash);
+  data->vrf_key_hash = vrf_key_hash;
+
+  *cert = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_genesis_key_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_genesis_key_delegation_cert_t** genesis_key_delegation_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (genesis_key_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "genesis_key_delegation_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_blake2b_hash_t* genesis_hash          = NULL;
+  cardano_blake2b_hash_t* genesis_delegate_hash = NULL;
+  cardano_blake2b_hash_t* vrf_key_hash          = NULL;
+
+  cardano_error_t read_hash = cardano_blake2b_hash_from_cbor(reader, &genesis_hash);
+
+  if (read_hash != CARDANO_SUCCESS)
+  {
+    return read_hash;
+  }
+
+  read_hash = cardano_blake2b_hash_from_cbor(reader, &genesis_delegate_hash);
+
+  if (read_hash != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&genesis_hash);
+
+    return read_hash;
+  }
+
+  read_hash = cardano_blake2b_hash_from_cbor(reader, &vrf_key_hash);
+
+  if (read_hash != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&genesis_hash);
+    cardano_blake2b_hash_unref(&genesis_delegate_hash);
+
+    return read_hash;
+  }
+
+  cardano_error_t new_result = cardano_genesis_key_delegation_cert_new(genesis_hash, genesis_delegate_hash, vrf_key_hash, genesis_key_delegation_cert);
+
+  cardano_blake2b_hash_unref(&genesis_hash);
+  cardano_blake2b_hash_unref(&genesis_delegate_hash);
+  cardano_blake2b_hash_unref(&vrf_key_hash);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_genesis_key_delegation_cert_to_cbor(
+  const cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert,
+  cardano_cbor_writer_t*                       writer)
+{
+  if (genesis_key_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_hash_result = cardano_blake2b_hash_to_cbor(genesis_key_delegation_cert->genesis_hash, writer);
+
+  if (write_hash_result != CARDANO_SUCCESS)
+  {
+    return write_hash_result;
+  }
+
+  write_hash_result = cardano_blake2b_hash_to_cbor(genesis_key_delegation_cert->genesis_delegate_hash, writer);
+
+  if (write_hash_result != CARDANO_SUCCESS)
+  {
+    return write_hash_result;
+  }
+
+  write_hash_result = cardano_blake2b_hash_to_cbor(genesis_key_delegation_cert->vrf_key_hash, writer);
+
+  if (write_hash_result != CARDANO_SUCCESS)
+  {
+    return write_hash_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_genesis_key_delegation_cert_to_cip116_json(
+  const cardano_genesis_key_delegation_cert_t* cert,
+  cardano_json_writer_t*                       writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const cardano_blake2b_hash_t* genesis_hash  = cert->genesis_hash;
+  const cardano_blake2b_hash_t* delegate_hash = cert->genesis_delegate_hash;
+  const cardano_blake2b_hash_t* vrf           = cert->vrf_key_hash;
+
+  if ((genesis_hash == NULL) || (delegate_hash == NULL) || (vrf == NULL))
+  {
+    cardano_json_writer_set_last_error(writer, "Genesis key delegation cert missing required fields");
+
+    return CARDANO_ERROR_ENCODING;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "genesis_key_delegation", 22);
+
+  cardano_json_writer_write_property_name(writer, "genesis_hash", 12);
+
+  cardano_error_t err = cardano_blake2b_hash_to_cip116_json(genesis_hash, writer);
+
+  if (err != CARDANO_SUCCESS)
+  {
+    return err;
+  }
+
+  cardano_json_writer_write_property_name(writer, "genesis_delegate_hash", 21);
+
+  err = cardano_blake2b_hash_to_cip116_json(delegate_hash, writer);
+
+  if (err != CARDANO_SUCCESS)
+  {
+    return err;
+  }
+
+  cardano_json_writer_write_property_name(writer, "vrf_keyhash", 11);
+
+  cardano_json_writer_write_bytes_as_bech32(
+    writer,
+    "vrf_vkh",
+    7,
+    cardano_blake2b_hash_get_data(vrf),
+    cardano_blake2b_hash_get_bytes_size(vrf));
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_genesis_key_delegation_cert_get_genesis_hash(cardano_genesis_key_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(certificate->genesis_hash);
+
+  return certificate->genesis_hash;
+}
+
+cardano_error_t
+cardano_genesis_key_delegation_cert_set_genesis_hash(
+  cardano_genesis_key_delegation_cert_t* certificate,
+  cardano_blake2b_hash_t*                hash)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(hash);
+  cardano_blake2b_hash_unref(&certificate->genesis_hash);
+  certificate->genesis_hash = (cardano_blake2b_hash_t*)hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_genesis_key_delegation_cert_get_genesis_delegate_hash(
+  cardano_genesis_key_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(certificate->genesis_delegate_hash);
+
+  return certificate->genesis_delegate_hash;
+}
+
+cardano_error_t
+cardano_genesis_key_delegation_cert_set_genesis_delegate_hash(
+  cardano_genesis_key_delegation_cert_t* certificate,
+  cardano_blake2b_hash_t*                hash)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(hash);
+  cardano_blake2b_hash_unref(&certificate->genesis_delegate_hash);
+  certificate->genesis_delegate_hash = (cardano_blake2b_hash_t*)hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_genesis_key_delegation_cert_get_vrf_key_hash(cardano_genesis_key_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(certificate->vrf_key_hash);
+
+  return certificate->vrf_key_hash;
+}
+
+cardano_error_t
+cardano_genesis_key_delegation_cert_set_vrf_key_hash(
+  cardano_genesis_key_delegation_cert_t* certificate,
+  cardano_blake2b_hash_t*                hash)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(hash);
+  cardano_blake2b_hash_unref(&certificate->vrf_key_hash);
+  certificate->vrf_key_hash = (cardano_blake2b_hash_t*)hash;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_genesis_key_delegation_cert_unref(cardano_genesis_key_delegation_cert_t** genesis_key_delegation_cert)
+{
+  if ((genesis_key_delegation_cert == NULL) || (*genesis_key_delegation_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*genesis_key_delegation_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *genesis_key_delegation_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_genesis_key_delegation_cert_ref(cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert)
+{
+  if (genesis_key_delegation_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&genesis_key_delegation_cert->base);
+}
+
+size_t
+cardano_genesis_key_delegation_cert_refcount(const cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert)
+{
+  if (genesis_key_delegation_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&genesis_key_delegation_cert->base);
+}
+
+void
+cardano_genesis_key_delegation_cert_set_last_error(cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert, const char* message)
+{
+  cardano_object_set_last_error(&genesis_key_delegation_cert->base, message);
+}
+
+const char*
+cardano_genesis_key_delegation_cert_get_last_error(const cardano_genesis_key_delegation_cert_t* genesis_key_delegation_cert)
+{
+  return cardano_object_get_last_error(&genesis_key_delegation_cert->base);
+}
+
+cardano_error_t
+cardano_genesis_key_delegation_cert_deep_clone(const cardano_genesis_key_delegation_cert_t* source, cardano_genesis_key_delegation_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_genesis_key_delegation_cert_t* copy = _cardano_malloc(sizeof(cardano_genesis_key_delegation_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count        = 1U;
+  copy->base.deallocator      = source->base.deallocator;
+  copy->base.last_error[0]    = '\0';
+  copy->genesis_hash          = NULL;
+  copy->genesis_delegate_hash = NULL;
+  copy->vrf_key_hash          = NULL;
+
+  if (source->genesis_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->genesis_hash, &copy->genesis_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->genesis_delegate_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->genesis_delegate_hash, &copy->genesis_delegate_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->vrf_key_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->vrf_key_hash, &copy->vrf_key_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/mir_cert.c b/vendor/src/certs/mir_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/mir_cert.c
@@ -0,0 +1,551 @@
+/**
+ * \file mir_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/mir_cert.h>
+#include <cardano/certs/mir_cert_type.h>
+#include <cardano/certs/mir_to_pot_cert.h>
+#include <cardano/certs/mir_to_stake_creds_cert.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Certificate used to facilitate an instantaneous transfer of rewards within the system.
+ */
+typedef struct cardano_mir_cert_t
+{
+    cardano_object_t                   base;
+    cardano_mir_cert_type_t            type;
+    cardano_mir_to_pot_cert_t*         mir_to_pot_cert;
+    cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert;
+} cardano_mir_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a mir_cert object.
+ *
+ * This function is responsible for properly deallocating a mir_cert object (`cardano_mir_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the mir_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_mir_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the mir_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_mir_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_mir_cert_t* data = (cardano_mir_cert_t*)object;
+
+  cardano_mir_to_pot_cert_unref(&data->mir_to_pot_cert);
+  cardano_mir_to_stake_creds_cert_unref(&data->mir_to_stake_creds_cert);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new mir_cert object.
+ *
+ * \return A pointer to the newly created mir_cert object, or `NULL` if the operation failed.
+ */
+static cardano_mir_cert_t*
+cardano_mir_cert_new(void)
+{
+  cardano_mir_cert_t* data = _cardano_malloc(sizeof(cardano_mir_cert_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_mir_cert_deallocate;
+
+  data->mir_to_pot_cert         = NULL;
+  data->mir_to_stake_creds_cert = NULL;
+  data->type                    = CARDANO_MIR_CERT_TYPE_TO_POT;
+
+  return data;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_mir_cert_new_to_other_pot(
+  cardano_mir_to_pot_cert_t* to_other_pot_cert,
+  cardano_mir_cert_t**       mir_cert)
+{
+  if (to_other_pot_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_mir_cert_t* data = cardano_mir_cert_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_mir_to_pot_cert_ref(to_other_pot_cert);
+
+  data->mir_to_pot_cert = to_other_pot_cert;
+  data->type            = CARDANO_MIR_CERT_TYPE_TO_POT;
+
+  *mir_cert = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_cert_new_to_stake_creds(
+  cardano_mir_to_stake_creds_cert_t* to_stake_creds_cert,
+  cardano_mir_cert_t**               mir_cert)
+{
+  if (to_stake_creds_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_mir_cert_t* data = cardano_mir_cert_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_mir_to_stake_creds_cert_ref(to_stake_creds_cert);
+
+  data->mir_to_stake_creds_cert = to_stake_creds_cert;
+  data->type                    = CARDANO_MIR_CERT_TYPE_TO_STAKE_CREDS;
+
+  *mir_cert = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_mir_cert_t** mir_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "mir_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_cbor_reader_t* embedded_reader = NULL;
+
+  cardano_error_t clone_reader = cardano_cbor_reader_clone(reader, &embedded_reader);
+
+  if (clone_reader != CARDANO_SUCCESS)
+  {
+    return clone_reader;
+  }
+
+  expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, embedded_reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&embedded_reader);
+
+    return expect_array_result;
+  }
+
+  uint64_t        pot      = 0U;
+  cardano_error_t read_pot = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "pot",
+    embedded_reader,
+    &pot,
+    CARDANO_MIR_CERT_POT_TYPE_RESERVE,
+    CARDANO_MIR_CERT_POT_TYPE_TREASURY);
+
+  if (read_pot != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&embedded_reader);
+
+    return read_pot;
+  }
+
+  CARDANO_UNUSED(pot);
+
+  cardano_cbor_reader_state_t state;
+  cardano_error_t             peek_result = cardano_cbor_reader_peek_state(embedded_reader, &state);
+
+  cardano_cbor_reader_unref(&embedded_reader);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER)
+  {
+    cardano_mir_to_pot_cert_t* mir_to_pot_cert = NULL;
+    cardano_error_t            to_pot_result   = cardano_mir_to_pot_cert_from_cbor(reader, &mir_to_pot_cert);
+
+    if (to_pot_result != CARDANO_SUCCESS)
+    {
+      return to_pot_result;
+    }
+
+    cardano_error_t create_mir_cert_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+    if (create_mir_cert_result == CARDANO_SUCCESS)
+    {
+      create_mir_cert_result = cardano_mir_cert_new_to_other_pot(mir_to_pot_cert, mir_cert);
+    }
+
+    cardano_mir_to_pot_cert_unref(&mir_to_pot_cert);
+
+    return create_mir_cert_result;
+  }
+
+  if ((state == CARDANO_CBOR_READER_STATE_START_ARRAY) || (state == CARDANO_CBOR_READER_STATE_START_MAP))
+  {
+    cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert = NULL;
+    cardano_error_t                    to_stake_creds_result   = cardano_mir_to_stake_creds_cert_from_cbor(reader, &mir_to_stake_creds_cert);
+
+    if (to_stake_creds_result != CARDANO_SUCCESS)
+    {
+      return to_stake_creds_result;
+    }
+
+    cardano_error_t create_mir_cert_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+    if (create_mir_cert_result == CARDANO_SUCCESS)
+    {
+      create_mir_cert_result = cardano_mir_cert_new_to_stake_creds(mir_to_stake_creds_cert, mir_cert);
+    }
+
+    cardano_mir_to_stake_creds_cert_unref(&mir_to_stake_creds_cert);
+
+    return create_mir_cert_result;
+  }
+
+  return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+}
+
+cardano_error_t
+cardano_mir_cert_to_cbor(
+  const cardano_mir_cert_t* mir_cert,
+  cardano_cbor_writer_t*    writer)
+{
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (mir_cert->type)
+  {
+    case CARDANO_MIR_CERT_TYPE_TO_POT:
+    {
+      result = cardano_mir_to_pot_cert_to_cbor(mir_cert->mir_to_pot_cert, writer);
+      break;
+    }
+    case CARDANO_MIR_CERT_TYPE_TO_STAKE_CREDS:
+    {
+      result = cardano_mir_to_stake_creds_cert_to_cbor(mir_cert->mir_to_stake_creds_cert, writer);
+      break;
+    }
+
+    default:
+      return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_mir_cert_to_cip116_json(
+  const cardano_mir_cert_t* cert,
+  cardano_json_writer_t*    writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cert->type == CARDANO_MIR_CERT_TYPE_TO_POT)
+  {
+    return cardano_mir_to_pot_cert_to_cip116_json(cert->mir_to_pot_cert, writer);
+  }
+
+  return cardano_mir_to_stake_creds_cert_to_cip116_json(cert->mir_to_stake_creds_cert, writer);
+}
+
+cardano_error_t
+cardano_mir_cert_get_type(const cardano_mir_cert_t* mir_cert, cardano_mir_cert_type_t* type)
+{
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = mir_cert->type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_cert_as_to_other_pot(
+  cardano_mir_cert_t*         mir_cert,
+  cardano_mir_to_pot_cert_t** to_other_pot_cert)
+{
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (to_other_pot_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (mir_cert->type != CARDANO_MIR_CERT_TYPE_TO_POT)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_mir_to_pot_cert_ref(mir_cert->mir_to_pot_cert);
+
+  *to_other_pot_cert = mir_cert->mir_to_pot_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_cert_as_to_stake_creds(
+  cardano_mir_cert_t*                 mir_cert,
+  cardano_mir_to_stake_creds_cert_t** to_stake_creds_cert)
+{
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (to_stake_creds_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (mir_cert->type != CARDANO_MIR_CERT_TYPE_TO_STAKE_CREDS)
+  {
+    return CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+  }
+
+  cardano_mir_to_stake_creds_cert_ref(mir_cert->mir_to_stake_creds_cert);
+
+  *to_stake_creds_cert = mir_cert->mir_to_stake_creds_cert;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_mir_cert_unref(cardano_mir_cert_t** mir_cert)
+{
+  if ((mir_cert == NULL) || (*mir_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*mir_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *mir_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_mir_cert_ref(cardano_mir_cert_t* mir_cert)
+{
+  if (mir_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&mir_cert->base);
+}
+
+size_t
+cardano_mir_cert_refcount(const cardano_mir_cert_t* mir_cert)
+{
+  if (mir_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&mir_cert->base);
+}
+
+void
+cardano_mir_cert_set_last_error(cardano_mir_cert_t* mir_cert, const char* message)
+{
+  cardano_object_set_last_error(&mir_cert->base, message);
+}
+
+const char*
+cardano_mir_cert_get_last_error(const cardano_mir_cert_t* mir_cert)
+{
+  return cardano_object_get_last_error(&mir_cert->base);
+}
+
+cardano_error_t
+cardano_mir_cert_deep_clone(const cardano_mir_cert_t* source, cardano_mir_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_mir_cert_t* copy = _cardano_malloc(sizeof(cardano_mir_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count          = 1U;
+  copy->base.deallocator        = source->base.deallocator;
+  copy->base.last_error[0]      = '\0';
+  copy->type                    = source->type;
+  copy->mir_to_pot_cert         = NULL;
+  copy->mir_to_stake_creds_cert = NULL;
+
+  if (source->mir_to_pot_cert != NULL)
+  {
+    const cardano_error_t result = cardano_mir_to_pot_cert_deep_clone(source->mir_to_pot_cert, &copy->mir_to_pot_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->mir_to_stake_creds_cert != NULL)
+  {
+    const cardano_error_t result = cardano_mir_to_stake_creds_cert_deep_clone(source->mir_to_stake_creds_cert, &copy->mir_to_stake_creds_cert);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/mir_to_pot_cert.c b/vendor/src/certs/mir_to_pot_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/mir_to_pot_cert.c
@@ -0,0 +1,377 @@
+/**
+ * \file mir_to_pot_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/mir_cert_type.h>
+#include <cardano/certs/mir_to_pot_cert.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <src/string_safe.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate move instantaneous rewards funds between accounting pots.
+ */
+typedef struct cardano_mir_to_pot_cert_t
+{
+    cardano_object_t            base;
+    cardano_mir_cert_pot_type_t pot;
+    uint64_t                    amount;
+} cardano_mir_to_pot_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a mir_to_pot_cert object.
+ *
+ * This function is responsible for properly deallocating a mir_to_pot_cert object (`cardano_mir_to_pot_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the mir_to_pot_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_mir_to_pot_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the mir_to_pot_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_mir_to_pot_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_mir_to_pot_cert_new(
+  cardano_mir_cert_pot_type_t pot_type,
+  uint64_t                    amount,
+  cardano_mir_to_pot_cert_t** mir_to_pot_cert)
+{
+  if (mir_to_pot_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_mir_to_pot_cert_t* data = _cardano_malloc(sizeof(cardano_mir_to_pot_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_mir_to_pot_cert_deallocate;
+
+  data->pot    = pot_type;
+  data->amount = amount;
+
+  *mir_to_pot_cert = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_pot_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_mir_to_pot_cert_t** mir_to_pot_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (mir_to_pot_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "mir_to_pot_cert";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t        pot      = 0U;
+  cardano_error_t read_pot = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "pot",
+    reader,
+    &pot,
+    CARDANO_MIR_CERT_TYPE_TO_POT,
+    CARDANO_MIR_CERT_TYPE_TO_STAKE_CREDS);
+
+  if (read_pot != CARDANO_SUCCESS)
+  {
+    return read_pot;
+  }
+
+  uint64_t amount = 0;
+
+  cardano_error_t read_amount = cardano_cbor_reader_read_uint(reader, &amount);
+
+  if (read_amount != CARDANO_SUCCESS)
+  {
+    return read_amount;
+  }
+
+  cardano_error_t result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_mir_to_pot_cert_new(pot, amount, mir_to_pot_cert);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_mir_to_pot_cert_to_cbor(
+  const cardano_mir_to_pot_cert_t* mir_to_pot_cert,
+  cardano_cbor_writer_t*           writer)
+{
+  if (mir_to_pot_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, mir_to_pot_cert->pot);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return cardano_cbor_writer_write_uint(writer, mir_to_pot_cert->amount);
+}
+
+cardano_error_t
+cardano_mir_to_pot_cert_to_cip116_json(
+  const cardano_mir_to_pot_cert_t* cert,
+  cardano_json_writer_t*           writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const uint64_t amount = cert->amount;
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "to_other_pot", 12);
+
+  cardano_json_writer_write_property_name(writer, "pot", 3);
+
+  if (cert->pot == CARDANO_MIR_CERT_POT_TYPE_TREASURY)
+  {
+    cardano_json_writer_write_string(writer, "treasury", 8);
+  }
+  else
+  {
+    cardano_json_writer_write_string(writer, "reserves", 8);
+  }
+
+  cardano_json_writer_write_property_name(writer, "amount", 6);
+  char         amount_str[128] = { 0 };
+  const size_t str_size        = cardano_safe_uint64_to_string(amount, amount_str, sizeof(amount_str));
+
+  cardano_json_writer_write_string(writer, amount_str, str_size);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_pot_cert_get_pot(const cardano_mir_to_pot_cert_t* mir_cert, cardano_mir_cert_pot_type_t* type)
+{
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = mir_cert->pot;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_pot_cert_set_pot(cardano_mir_to_pot_cert_t* mir_cert, cardano_mir_cert_pot_type_t type)
+{
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  mir_cert->pot = type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_pot_cert_get_amount(const cardano_mir_to_pot_cert_t* mir_cert, uint64_t* amount)
+{
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *amount = mir_cert->amount;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_pot_cert_set_amount(cardano_mir_to_pot_cert_t* mir_cert, uint64_t amount)
+{
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  mir_cert->amount = amount;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_mir_to_pot_cert_unref(cardano_mir_to_pot_cert_t** mir_to_pot_cert)
+{
+  if ((mir_to_pot_cert == NULL) || (*mir_to_pot_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*mir_to_pot_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *mir_to_pot_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_mir_to_pot_cert_ref(cardano_mir_to_pot_cert_t* mir_to_pot_cert)
+{
+  if (mir_to_pot_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&mir_to_pot_cert->base);
+}
+
+size_t
+cardano_mir_to_pot_cert_refcount(const cardano_mir_to_pot_cert_t* mir_to_pot_cert)
+{
+  if (mir_to_pot_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&mir_to_pot_cert->base);
+}
+
+void
+cardano_mir_to_pot_cert_set_last_error(cardano_mir_to_pot_cert_t* mir_to_pot_cert, const char* message)
+{
+  cardano_object_set_last_error(&mir_to_pot_cert->base, message);
+}
+
+const char*
+cardano_mir_to_pot_cert_get_last_error(const cardano_mir_to_pot_cert_t* mir_to_pot_cert)
+{
+  return cardano_object_get_last_error(&mir_to_pot_cert->base);
+}
+
+cardano_error_t
+cardano_mir_to_pot_cert_deep_clone(const cardano_mir_to_pot_cert_t* source, cardano_mir_to_pot_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_mir_to_pot_cert_t* copy = _cardano_malloc(sizeof(cardano_mir_to_pot_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->pot                = source->pot;
+  copy->amount             = source->amount;
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/mir_to_stake_creds_cert.c b/vendor/src/certs/mir_to_stake_creds_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/mir_to_stake_creds_cert.c
@@ -0,0 +1,810 @@
+/**
+ * \file mir_to_stake_creds_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/mir_cert_pot_type.h>
+#include <cardano/certs/mir_to_stake_creds_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <cardano/certs/mir_cert_type.h>
+#include <src/string_safe.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Creates a move instantaneous rewards certificate that transfers funds to the given set of reward accounts.
+ */
+typedef struct cardano_mir_to_stake_creds_cert_t
+{
+    cardano_object_t            base;
+    cardano_mir_cert_pot_type_t pot;
+    cardano_array_t*            array;
+} cardano_mir_to_stake_creds_cert_t;
+
+/**
+ * \brief Represents a key-value pair for Move Instantaneous Rewards to Stake Credentials certificate.
+ *
+ * This structure is used to hold the association between a stake credential and the amount of ADA
+ * to be rewarded to that credential. It is utilized within the context of a MIR to Stake Credentials
+ * certificate, allowing the specification of multiple such key-value pairs where each pair represents
+ * a unique stake credential and the associated reward amount.
+ */
+typedef struct cardano_mir_to_stake_creds_cert_kvp_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* key;
+    uint64_t              value;
+} cardano_mir_to_stake_creds_cert_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a MIR to stake credentials certificate object.
+ *
+ * This function is responsible for properly deallocating a MIR to stake credentials certificate object (`cardano_mir_to_stake_creds_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the mir_to_stake_creds_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_mir_to_stake_creds_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the mir_to_stake_creds_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_mir_to_stake_creds_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_mir_to_stake_creds_cert_t* map = (cardano_mir_to_stake_creds_cert_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a MIR to stake credentials certificate key value pair object.
+ *
+ * This function is responsible for properly deallocating a MIR to stake credentials certificate key value pair object (`cardano_mir_to_stake_creds_cert_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the mir_to_stake_creds_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_mir_to_stake_creds_cert_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the mir_to_stake_creds_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_mir_to_stake_creds_cert_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_mir_to_stake_creds_cert_kvp_t* map = (cardano_mir_to_stake_creds_cert_kvp_t*)object;
+
+  if (map->key != NULL)
+  {
+    cardano_credential_unref(&map->key);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their credentials.
+ *
+ * This function casts the cardano_object_t objects to cardano_mir_to_stake_creds_cert_kvp_t
+ * and compares their credentials using the cardano_credential_compare function.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the hash of lhs is less than the hash of rhs, zero if they are equal,
+ *         and a positive value if the hash of lhs is greater than the hash of rhs.
+ */
+static int32_t
+compare_by_credential(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_mir_to_stake_creds_cert_kvp_t* kvp_lhs = (const cardano_mir_to_stake_creds_cert_kvp_t*)((const void*)lhs);
+  const cardano_mir_to_stake_creds_cert_kvp_t* kvp_rhs = (const cardano_mir_to_stake_creds_cert_kvp_t*)((const void*)rhs);
+
+  return cardano_credential_compare(kvp_lhs->key, kvp_rhs->key);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_mir_to_stake_creds_cert_new(const cardano_mir_cert_pot_type_t pot_type, cardano_mir_to_stake_creds_cert_t** mir_to_stake_creds_cert)
+{
+  if (mir_to_stake_creds_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_mir_to_stake_creds_cert_t* map = _cardano_malloc(sizeof(cardano_mir_to_stake_creds_cert_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_mir_to_stake_creds_cert_deallocate;
+
+  map->array = cardano_array_new(128);
+  map->pot   = pot_type;
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *mir_to_stake_creds_cert = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_stake_creds_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_mir_to_stake_creds_cert_t** mir_to_stake_creds_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (mir_to_stake_creds_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "mir_to_stake_creds";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t        pot      = 0U;
+  cardano_error_t read_pot = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "pot",
+    reader,
+    &pot,
+    CARDANO_MIR_CERT_TYPE_TO_POT,
+    CARDANO_MIR_CERT_TYPE_TO_STAKE_CREDS);
+
+  if (read_pot != CARDANO_SUCCESS)
+  {
+    return read_pot;
+  }
+
+  cardano_mir_to_stake_creds_cert_t* map    = NULL;
+  cardano_error_t                    result = cardano_mir_to_stake_creds_cert_new(pot, &map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_map(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_mir_to_stake_creds_cert_unref(&map);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_mir_to_stake_creds_cert_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_credential_t* key   = NULL;
+    uint64_t              value = 0;
+
+    result = cardano_credential_from_cbor(reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_mir_to_stake_creds_cert_unref(&map);
+      return result;
+    }
+
+    result = cardano_cbor_reader_read_uint(reader, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_credential_unref(&key);
+      cardano_mir_to_stake_creds_cert_unref(&map);
+      return result;
+    }
+
+    cardano_mir_to_stake_creds_cert_kvp_t* kvp = _cardano_malloc(sizeof(cardano_mir_to_stake_creds_cert_kvp_t));
+
+    if (kvp == NULL)
+    {
+      cardano_credential_unref(&key);
+      cardano_mir_to_stake_creds_cert_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    kvp->base.ref_count     = 0;
+    kvp->base.last_error[0] = '\0';
+    kvp->base.deallocator   = cardano_mir_to_stake_creds_cert_kvp_deallocate;
+    kvp->key                = key;
+    kvp->value              = value;
+
+    const size_t old_size = cardano_array_get_size(map->array);
+    const size_t new_size = cardano_array_push(map->array, (cardano_object_t*)((void*)kvp));
+
+    if (new_size != (old_size + 1U))
+    {
+      cardano_mir_to_stake_creds_cert_kvp_deallocate(kvp);
+      cardano_mir_to_stake_creds_cert_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_map("mir_to_stake_creds_cert", reader);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_validate_end_array(validator_name, reader);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_mir_to_stake_creds_cert_unref(&map);
+    return result;
+  }
+
+  *mir_to_stake_creds_cert = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_stake_creds_cert_to_cbor(const cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert, cardano_cbor_writer_t* writer)
+{
+  if (mir_to_stake_creds_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, mir_to_stake_creds_cert->pot);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  size_t map_size = cardano_array_get_size(mir_to_stake_creds_cert->array);
+  result          = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(mir_to_stake_creds_cert->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(mir_to_stake_creds_cert->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in MIR to stake credentials certificate is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_mir_to_stake_creds_cert_kvp_t* kvp_data = (cardano_mir_to_stake_creds_cert_kvp_t*)((void*)kvp);
+
+    result = cardano_credential_to_cbor(kvp_data->key, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, kvp_data->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    cardano_object_unref(&kvp);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_stake_creds_cert_to_cip116_json(
+  const cardano_mir_to_stake_creds_cert_t* cert,
+  cardano_json_writer_t*                   writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "to_stake_creds", 14);
+
+  cardano_json_writer_write_property_name(writer, "pot", 3);
+  if (cert->pot == CARDANO_MIR_CERT_POT_TYPE_TREASURY)
+  {
+    cardano_json_writer_write_string(writer, "treasury", 8);
+  }
+  else
+  {
+    cardano_json_writer_write_string(writer, "reserves", 8);
+  }
+
+  cardano_json_writer_write_property_name(writer, "rewards", 7);
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0; i < cardano_array_get_size(cert->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(cert->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_json_writer_set_last_error(writer, "Element in MIR to stake credentials certificate is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_mir_to_stake_creds_cert_kvp_t* kvp_data = (cardano_mir_to_stake_creds_cert_kvp_t*)((void*)kvp);
+
+    cardano_json_writer_write_start_object(writer);
+    cardano_json_writer_write_property_name(writer, "key", 3);
+    cardano_error_t result = cardano_credential_to_cip116_json(kvp_data->key, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    cardano_json_writer_write_property_name(writer, "value", 5);
+    char         amount_str[128] = { 0 };
+    const size_t str_size        = cardano_safe_uint64_to_string(kvp_data->value, amount_str, sizeof(amount_str));
+
+    cardano_json_writer_write_string(writer, amount_str, str_size);
+    cardano_json_writer_write_end_object(writer);
+    cardano_object_unref(&kvp);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_stake_creds_cert_get_pot(const cardano_mir_to_stake_creds_cert_t* mir_cert, cardano_mir_cert_pot_type_t* type)
+{
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = mir_cert->pot;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_stake_creds_cert_set_pot(cardano_mir_to_stake_creds_cert_t* mir_cert, cardano_mir_cert_pot_type_t type)
+{
+  if (mir_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  mir_cert->pot = type;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_mir_to_stake_creds_cert_get_size(const cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert)
+{
+  if (mir_to_stake_creds_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(mir_to_stake_creds_cert->array);
+}
+
+cardano_error_t
+cardano_mir_to_stake_creds_cert_insert(
+  cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert,
+  cardano_credential_t*              credential,
+  uint64_t                           amount)
+{
+  if (mir_to_stake_creds_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_mir_to_stake_creds_cert_kvp_t* kvp = _cardano_malloc(sizeof(cardano_mir_to_stake_creds_cert_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_mir_to_stake_creds_cert_kvp_deallocate;
+  kvp->key                = credential;
+  kvp->value              = amount;
+
+  cardano_credential_ref(credential);
+
+  const size_t old_size = cardano_array_get_size(mir_to_stake_creds_cert->array);
+  const size_t new_size = cardano_array_push(mir_to_stake_creds_cert->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_mir_to_stake_creds_cert_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(mir_to_stake_creds_cert->array, compare_by_credential, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_stake_creds_cert_get_key_at(
+  cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert,
+  size_t                             index,
+  cardano_credential_t**             credential)
+{
+  if (mir_to_stake_creds_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(mir_to_stake_creds_cert->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t* object = cardano_array_get(mir_to_stake_creds_cert->array, index);
+
+  cardano_mir_to_stake_creds_cert_kvp_t* kvp = (cardano_mir_to_stake_creds_cert_kvp_t*)((void*)object);
+
+  cardano_credential_ref(kvp->key);
+
+  *credential = kvp->key;
+
+  cardano_object_unref(&object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_stake_creds_cert_get_value_at(
+  const cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert,
+  size_t                                   index,
+  uint64_t*                                amount)
+{
+  if (mir_to_stake_creds_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(mir_to_stake_creds_cert->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t* object = cardano_array_get(mir_to_stake_creds_cert->array, index);
+
+  cardano_mir_to_stake_creds_cert_kvp_t* kvp = (cardano_mir_to_stake_creds_cert_kvp_t*)((void*)object);
+
+  *amount = kvp->value;
+
+  cardano_object_unref(&object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_mir_to_stake_creds_cert_get_key_value_at(
+  cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert,
+  size_t                             index,
+  cardano_credential_t**             credential,
+  uint64_t*                          amount)
+{
+  if (mir_to_stake_creds_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(mir_to_stake_creds_cert->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t* object = cardano_array_get(mir_to_stake_creds_cert->array, index);
+
+  cardano_mir_to_stake_creds_cert_kvp_t* kvp = (cardano_mir_to_stake_creds_cert_kvp_t*)((void*)object);
+
+  cardano_credential_ref(kvp->key);
+
+  *credential = kvp->key;
+  *amount     = kvp->value;
+
+  cardano_object_unref(&object);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_mir_to_stake_creds_cert_unref(cardano_mir_to_stake_creds_cert_t** mir_to_stake_creds_cert)
+{
+  if ((mir_to_stake_creds_cert == NULL) || (*mir_to_stake_creds_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*mir_to_stake_creds_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *mir_to_stake_creds_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_mir_to_stake_creds_cert_ref(cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert)
+{
+  if (mir_to_stake_creds_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&mir_to_stake_creds_cert->base);
+}
+
+size_t
+cardano_mir_to_stake_creds_cert_refcount(const cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert)
+{
+  if (mir_to_stake_creds_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&mir_to_stake_creds_cert->base);
+}
+
+void
+cardano_mir_to_stake_creds_cert_set_last_error(cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert, const char* message)
+{
+  cardano_object_set_last_error(&mir_to_stake_creds_cert->base, message);
+}
+
+const char*
+cardano_mir_to_stake_creds_cert_get_last_error(const cardano_mir_to_stake_creds_cert_t* mir_to_stake_creds_cert)
+{
+  return cardano_object_get_last_error(&mir_to_stake_creds_cert->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_mir_to_stake_creds_cert_kvp_deep_clone(const cardano_mir_to_stake_creds_cert_kvp_t* source, cardano_mir_to_stake_creds_cert_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_mir_to_stake_creds_cert_kvp_t* copy = _cardano_malloc(sizeof(cardano_mir_to_stake_creds_cert_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = source->value;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_mir_to_stake_creds_cert_kvp_t* copy   = NULL;
+  const cardano_error_t                  result = cardano_mir_to_stake_creds_cert_kvp_deep_clone((const cardano_mir_to_stake_creds_cert_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_mir_to_stake_creds_cert_deep_clone(const cardano_mir_to_stake_creds_cert_t* source, cardano_mir_to_stake_creds_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_mir_to_stake_creds_cert_t* copy = _cardano_malloc(sizeof(cardano_mir_to_stake_creds_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->pot                = source->pot;
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/pool_registration_cert.c b/vendor/src/certs/pool_registration_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/pool_registration_cert.c
@@ -0,0 +1,407 @@
+/**
+ * \file pool_registration_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/pool_registration_cert.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/pool_params/pool_params.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE              = 10;
+static const int64_t EMBEDDED_GROUP_SIZE_WITH_BLS_KEY = 11;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate is used to register a new stake pool. It includes various details
+ * about the pool such as the pledge, costs, margin, reward account, and the pool's owners and relays.
+ */
+typedef struct cardano_pool_registration_cert_t
+{
+    cardano_object_t       base;
+    cardano_pool_params_t* params;
+} cardano_pool_registration_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a pool_registration_cert object.
+ *
+ * This function is responsible for properly deallocating a pool_registration_cert object (`cardano_pool_registration_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the pool_registration_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_pool_registration_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the pool_registration_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_pool_registration_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_pool_registration_cert_t* data = (cardano_pool_registration_cert_t*)object;
+
+  cardano_pool_params_unref(&data->params);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_pool_registration_cert_new(
+  cardano_pool_params_t*             params,
+  cardano_pool_registration_cert_t** cardano_pool_registration_cert)
+{
+  if (params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cardano_pool_registration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_registration_cert_t* data = _cardano_malloc(sizeof(cardano_pool_registration_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_pool_registration_cert_deallocate;
+
+  cardano_pool_params_ref(params);
+  data->params = params;
+
+  *cardano_pool_registration_cert = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_registration_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_registration_cert_t** pool_registration_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pool_registration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name           = "pool_registration_cert";
+  static const char* array_size_error_message = "There was an error decoding 'pool_registration_cert', expected an array of 10 or 11 elements (pool params with an optional BLS key).";
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (state != CARDANO_CBOR_READER_STATE_START_ARRAY)
+  {
+    cardano_cbor_reader_set_last_error(reader, array_size_error_message);
+
+    return CARDANO_ERROR_UNEXPECTED_CBOR_TYPE;
+  }
+
+  int64_t array_size = 0;
+
+  cardano_error_t read_start_array_result = cardano_cbor_reader_read_start_array(reader, &array_size);
+
+  if (read_start_array_result != CARDANO_SUCCESS)
+  {
+    return read_start_array_result;
+  }
+
+  if ((array_size != EMBEDDED_GROUP_SIZE) && (array_size != EMBEDDED_GROUP_SIZE_WITH_BLS_KEY))
+  {
+    cardano_cbor_reader_set_last_error(reader, array_size_error_message);
+
+    return CARDANO_ERROR_INVALID_CBOR_ARRAY_SIZE;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_POOL_REGISTRATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_pool_params_t* params = NULL;
+
+  cardano_error_t read_params = cardano_pool_params_from_cbor(reader, &params);
+
+  if (read_params != CARDANO_SUCCESS)
+  {
+    return read_params;
+  }
+
+  cardano_error_t result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_pool_registration_cert_new(params, pool_registration_cert);
+  }
+
+  cardano_pool_params_unref(&params);
+
+  return result;
+}
+
+cardano_error_t
+cardano_pool_registration_cert_to_cbor(
+  const cardano_pool_registration_cert_t* pool_registration_cert,
+  cardano_cbor_writer_t*                  writer)
+{
+  if (pool_registration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const int64_t array_size = cardano_pool_params_has_bls_key(pool_registration_cert->params) ? EMBEDDED_GROUP_SIZE_WITH_BLS_KEY : EMBEDDED_GROUP_SIZE;
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, array_size);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_POOL_REGISTRATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_params_result = cardano_pool_params_to_cbor(pool_registration_cert->params, writer);
+
+  if (write_params_result != CARDANO_SUCCESS)
+  {
+    return write_params_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_registration_cert_to_cip116_json(
+  const cardano_pool_registration_cert_t* cert,
+  cardano_json_writer_t*                  writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "pool_registration", 17);
+
+  cardano_json_writer_write_property_name(writer, "pool_params", 11);
+
+  assert(cert->params != NULL);
+
+  const cardano_error_t error = cardano_pool_params_to_cip116_json(cert->params, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_registration_cert_get_params(
+  cardano_pool_registration_cert_t* cert,
+  cardano_pool_params_t**           params)
+{
+  if (cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_params_ref(cert->params);
+  *params = cert->params;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_registration_cert_set_params(
+  cardano_pool_registration_cert_t* cert,
+  cardano_pool_params_t*            params)
+{
+  if (cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_params_ref(params);
+  cardano_pool_params_unref(&cert->params);
+  cert->params = params;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_pool_registration_cert_unref(cardano_pool_registration_cert_t** pool_registration_cert)
+{
+  if ((pool_registration_cert == NULL) || (*pool_registration_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*pool_registration_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *pool_registration_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_pool_registration_cert_ref(cardano_pool_registration_cert_t* pool_registration_cert)
+{
+  if (pool_registration_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&pool_registration_cert->base);
+}
+
+size_t
+cardano_pool_registration_cert_refcount(const cardano_pool_registration_cert_t* pool_registration_cert)
+{
+  if (pool_registration_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&pool_registration_cert->base);
+}
+
+void
+cardano_pool_registration_cert_set_last_error(cardano_pool_registration_cert_t* pool_registration_cert, const char* message)
+{
+  cardano_object_set_last_error(&pool_registration_cert->base, message);
+}
+
+const char*
+cardano_pool_registration_cert_get_last_error(const cardano_pool_registration_cert_t* pool_registration_cert)
+{
+  return cardano_object_get_last_error(&pool_registration_cert->base);
+}
+
+cardano_error_t
+cardano_pool_registration_cert_deep_clone(const cardano_pool_registration_cert_t* source, cardano_pool_registration_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_registration_cert_t* copy = _cardano_malloc(sizeof(cardano_pool_registration_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->params             = NULL;
+
+  if (source->params != NULL)
+  {
+    const cardano_error_t result = cardano_pool_params_deep_clone(source->params, &copy->params);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/pool_retirement_cert.c b/vendor/src/certs/pool_retirement_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/pool_retirement_cert.c
@@ -0,0 +1,417 @@
+/**
+ * \file pool_retirement_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/pool_retirement_cert.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief this certificate is used to retire a stake pool. it includes an epoch number indicating when the pool will be retired.
+ */
+typedef struct cardano_pool_retirement_cert_t
+{
+    cardano_object_t        base;
+    cardano_blake2b_hash_t* pool_key_hash;
+    uint64_t                epoch;
+} cardano_pool_retirement_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a pool_retirement_cert object.
+ *
+ * This function is responsible for properly deallocating a pool_retirement_cert object (`cardano_pool_retirement_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the pool_retirement_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_pool_retirement_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the pool_retirement_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_pool_retirement_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_pool_retirement_cert_t* data = (cardano_pool_retirement_cert_t*)object;
+
+  cardano_blake2b_hash_unref(&data->pool_key_hash);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_pool_retirement_cert_new(
+  cardano_blake2b_hash_t*          pool_key_hash,
+  const uint64_t                   epoch,
+  cardano_pool_retirement_cert_t** pool_retirement_cert)
+{
+  if (pool_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pool_retirement_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_retirement_cert_t* data = _cardano_malloc(sizeof(cardano_pool_retirement_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_pool_retirement_cert_deallocate;
+
+  cardano_blake2b_hash_ref(pool_key_hash);
+  data->pool_key_hash = pool_key_hash;
+  data->epoch         = epoch;
+
+  *pool_retirement_cert = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_retirement_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_retirement_cert_t** pool_retirement_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pool_retirement_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "pool_retirement_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_POOL_RETIREMENT,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_blake2b_hash_t* pool_key_hash = NULL;
+
+  cardano_error_t read_hash_result = cardano_blake2b_hash_from_cbor(reader, &pool_key_hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    return read_hash_result;
+  }
+
+  uint64_t epoch = 0U;
+
+  cardano_error_t read_epoch_result = cardano_cbor_reader_read_uint(reader, &epoch);
+
+  if (read_epoch_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&pool_key_hash);
+    return read_epoch_result;
+  }
+
+  cardano_error_t new_result = cardano_pool_retirement_cert_new(pool_key_hash, epoch, pool_retirement_cert);
+
+  cardano_blake2b_hash_unref(&pool_key_hash);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_pool_retirement_cert_to_cbor(
+  const cardano_pool_retirement_cert_t* pool_retirement_cert,
+  cardano_cbor_writer_t*                writer)
+{
+  if (pool_retirement_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_POOL_RETIREMENT);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_hash_result = cardano_blake2b_hash_to_cbor(pool_retirement_cert->pool_key_hash, writer);
+
+  if (write_hash_result != CARDANO_SUCCESS)
+  {
+    return write_hash_result;
+  }
+
+  cardano_error_t write_epoch_result = cardano_cbor_writer_write_uint(writer, pool_retirement_cert->epoch);
+
+  if (write_epoch_result != CARDANO_SUCCESS)
+  {
+    return write_epoch_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_retirement_cert_to_cip116_json(
+  const cardano_pool_retirement_cert_t* cert,
+  cardano_json_writer_t*                writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "pool_retirement", 15);
+
+  cardano_json_writer_write_property_name(writer, "pool_keyhash", 12);
+
+  assert(cert->pool_key_hash != NULL);
+
+  cardano_json_writer_write_bytes_as_bech32(
+    writer,
+    "pool",
+    4,
+    cardano_blake2b_hash_get_data(cert->pool_key_hash),
+    cardano_blake2b_hash_get_bytes_size(cert->pool_key_hash));
+
+  cardano_json_writer_write_property_name(writer, "epoch", 5);
+  cardano_json_writer_write_uint(writer, cert->epoch);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_pool_retirement_cert_get_pool_key_hash(cardano_pool_retirement_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(certificate->pool_key_hash);
+
+  return certificate->pool_key_hash;
+}
+
+cardano_error_t
+cardano_pool_retirement_cert_set_pool_key_hash(
+  cardano_pool_retirement_cert_t* certificate,
+  cardano_blake2b_hash_t*         hash)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(hash);
+  cardano_blake2b_hash_unref(&certificate->pool_key_hash);
+  certificate->pool_key_hash = hash;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_pool_retirement_cert_get_epoch(const cardano_pool_retirement_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return 0;
+  }
+
+  return certificate->epoch;
+}
+
+cardano_error_t
+cardano_pool_retirement_cert_set_epoch(cardano_pool_retirement_cert_t* certificate, const uint64_t epoch)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  certificate->epoch = epoch;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_pool_retirement_cert_unref(cardano_pool_retirement_cert_t** pool_retirement_cert)
+{
+  if ((pool_retirement_cert == NULL) || (*pool_retirement_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*pool_retirement_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *pool_retirement_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_pool_retirement_cert_ref(cardano_pool_retirement_cert_t* pool_retirement_cert)
+{
+  if (pool_retirement_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&pool_retirement_cert->base);
+}
+
+size_t
+cardano_pool_retirement_cert_refcount(const cardano_pool_retirement_cert_t* pool_retirement_cert)
+{
+  if (pool_retirement_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&pool_retirement_cert->base);
+}
+
+void
+cardano_pool_retirement_cert_set_last_error(cardano_pool_retirement_cert_t* pool_retirement_cert, const char* message)
+{
+  cardano_object_set_last_error(&pool_retirement_cert->base, message);
+}
+
+const char*
+cardano_pool_retirement_cert_get_last_error(const cardano_pool_retirement_cert_t* pool_retirement_cert)
+{
+  return cardano_object_get_last_error(&pool_retirement_cert->base);
+}
+
+cardano_error_t
+cardano_pool_retirement_cert_deep_clone(const cardano_pool_retirement_cert_t* source, cardano_pool_retirement_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_retirement_cert_t* copy = _cardano_malloc(sizeof(cardano_pool_retirement_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->pool_key_hash      = NULL;
+  copy->epoch              = source->epoch;
+
+  if (source->pool_key_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->pool_key_hash, &copy->pool_key_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/register_drep_cert.c b/vendor/src/certs/register_drep_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/register_drep_cert.c
@@ -0,0 +1,541 @@
+/**
+ * \file register_drep_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/register_drep_cert.h>
+#include <cardano/common/anchor.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 4;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief In Voltaire, existing stake credentials will be able to delegate their stake to DReps for voting
+ * purposes, in addition to the current delegation to stake pools for block production.
+ * DRep delegation will mimic the existing stake delegation mechanisms (via on-chain certificates).
+ *
+ * This certificate register a stake key as a DRep.
+ */
+typedef struct cardano_register_drep_cert_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* credential;
+    uint64_t              deposit;
+    cardano_anchor_t*     anchor;
+} cardano_register_drep_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a register_drep_cert object.
+ *
+ * This function is responsible for properly deallocating a register_drep_cert object (`cardano_register_drep_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the register_drep_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_register_drep_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the register_drep_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_register_drep_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_register_drep_cert_t* data = (cardano_register_drep_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+  cardano_anchor_unref(&data->anchor);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_register_drep_cert_new(
+  cardano_credential_t*          drep_credential,
+  uint64_t                       deposit,
+  cardano_anchor_t*              anchor,
+  cardano_register_drep_cert_t** register_drep_cert)
+{
+  if (drep_credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (register_drep_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_register_drep_cert_t* data = _cardano_malloc(sizeof(cardano_register_drep_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_register_drep_cert_deallocate;
+
+  cardano_credential_ref(drep_credential);
+  data->credential = drep_credential;
+
+  data->deposit = deposit;
+
+  if (anchor != NULL)
+  {
+    cardano_anchor_ref(anchor);
+  }
+
+  data->anchor = anchor;
+
+  *register_drep_cert = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_register_drep_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_register_drep_cert_t** register_drep_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (register_drep_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "register_drep_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_DREP_REGISTRATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  uint64_t deposit = 0U;
+
+  cardano_error_t read_deposit_result = cardano_cbor_reader_read_uint(reader, &deposit);
+
+  if (read_deposit_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_deposit_result;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_cbor_reader_state_t state;
+
+  cardano_error_t read_state = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_state != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_state;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+    CARDANO_UNUSED(read_null);
+  }
+  else
+  {
+    cardano_error_t read_anchor_result = cardano_anchor_from_cbor(reader, &anchor);
+
+    if (read_anchor_result != CARDANO_SUCCESS)
+    {
+      cardano_credential_unref(&credential);
+
+      return read_anchor_result;
+    }
+  }
+
+  cardano_error_t new_result = cardano_register_drep_cert_new(credential, deposit, anchor, register_drep_cert);
+
+  cardano_credential_unref(&credential);
+  cardano_anchor_unref(&anchor);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_register_drep_cert_to_cbor(
+  const cardano_register_drep_cert_t* register_drep_cert,
+  cardano_cbor_writer_t*              writer)
+{
+  if (register_drep_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_DREP_REGISTRATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(register_drep_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  cardano_error_t write_deposit_result = cardano_cbor_writer_write_uint(writer, register_drep_cert->deposit);
+
+  if (write_deposit_result != CARDANO_SUCCESS)
+  {
+    return write_deposit_result;
+  }
+
+  if (register_drep_cert->anchor != NULL)
+  {
+    cardano_error_t write_anchor_result = cardano_anchor_to_cbor(register_drep_cert->anchor, writer);
+
+    if (write_anchor_result != CARDANO_SUCCESS)
+    {
+      return write_anchor_result;
+    }
+  }
+  else
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_register_drep_cert_to_cip116_json(
+  const cardano_register_drep_cert_t* cert,
+  cardano_json_writer_t*              writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "register_drep", 13);
+
+  cardano_json_writer_write_property_name(writer, "drep_credential", 15);
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "coin", 4);
+  cardano_json_writer_write_uint_as_string(writer, cert->deposit);
+
+  if (cert->anchor != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "anchor", 6);
+    error = cardano_anchor_to_cip116_json(cert->anchor, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_register_drep_cert_get_credential(cardano_register_drep_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_register_drep_cert_set_credential(
+  cardano_register_drep_cert_t* certificate,
+  cardano_credential_t*         credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_register_drep_cert_get_deposit(const cardano_register_drep_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return 0U;
+  }
+
+  return certificate->deposit;
+}
+
+cardano_error_t
+cardano_register_drep_cert_set_deposit(
+  cardano_register_drep_cert_t* certificate,
+  const uint64_t                deposit)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  certificate->deposit = deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_anchor_t*
+cardano_register_drep_cert_get_anchor(cardano_register_drep_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_anchor_ref(certificate->anchor);
+
+  return certificate->anchor;
+}
+
+cardano_error_t
+cardano_register_drep_cert_set_anchor(
+  cardano_register_drep_cert_t* certificate,
+  cardano_anchor_t*             anchor)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_ref(anchor);
+  cardano_anchor_unref(&certificate->anchor);
+  certificate->anchor = anchor;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_register_drep_cert_unref(cardano_register_drep_cert_t** register_drep_cert)
+{
+  if ((register_drep_cert == NULL) || (*register_drep_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*register_drep_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *register_drep_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_register_drep_cert_ref(cardano_register_drep_cert_t* register_drep_cert)
+{
+  if (register_drep_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&register_drep_cert->base);
+}
+
+size_t
+cardano_register_drep_cert_refcount(const cardano_register_drep_cert_t* register_drep_cert)
+{
+  if (register_drep_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&register_drep_cert->base);
+}
+
+void
+cardano_register_drep_cert_set_last_error(cardano_register_drep_cert_t* register_drep_cert, const char* message)
+{
+  cardano_object_set_last_error(&register_drep_cert->base, message);
+}
+
+const char*
+cardano_register_drep_cert_get_last_error(const cardano_register_drep_cert_t* register_drep_cert)
+{
+  return cardano_object_get_last_error(&register_drep_cert->base);
+}
+
+cardano_error_t
+cardano_register_drep_cert_deep_clone(const cardano_register_drep_cert_t* source, cardano_register_drep_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_register_drep_cert_t* copy = _cardano_malloc(sizeof(cardano_register_drep_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->deposit            = source->deposit;
+  copy->anchor             = NULL;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->anchor != NULL)
+  {
+    const cardano_error_t result = cardano_anchor_deep_clone(source->anchor, &copy->anchor);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/registration_cert.c b/vendor/src/certs/registration_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/registration_cert.c
@@ -0,0 +1,426 @@
+/**
+ * \file registration_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/registration_cert.h>
+#include <cardano/common/anchor.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate is used when an individual wants to register as a stakeholder.
+ * It allows the holder to participate in the staking process by delegating their
+ * stake or creating a stake pool.
+ *
+ * This certificate also provides the ability to specify the deposit amount.
+ *
+ * Deposit must match the expected deposit amount specified by `ppKeyDepositL` in
+ * the protocol parameters.
+ */
+typedef struct cardano_registration_cert_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* credential;
+    uint64_t              deposit;
+} cardano_registration_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a registration_cert object.
+ *
+ * This function is responsible for properly deallocating a registration_cert object (`cardano_registration_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the registration_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_registration_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the registration_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_registration_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_registration_cert_t* data = (cardano_registration_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_registration_cert_new(
+  cardano_credential_t*         credential,
+  const uint64_t                deposit,
+  cardano_registration_cert_t** registration_cert)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (registration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_registration_cert_t* data = _cardano_malloc(sizeof(cardano_registration_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_registration_cert_deallocate;
+
+  cardano_credential_ref(credential);
+  data->credential = credential;
+
+  data->deposit = deposit;
+
+  *registration_cert = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_registration_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_registration_cert_t** registration_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (registration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "registration_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_REGISTRATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  uint64_t deposit = 0U;
+
+  cardano_error_t read_deposit_result = cardano_cbor_reader_read_uint(reader, &deposit);
+
+  if (read_deposit_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_deposit_result;
+  }
+
+  cardano_error_t new_result = cardano_registration_cert_new(credential, deposit, registration_cert);
+
+  cardano_credential_unref(&credential);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_registration_cert_to_cbor(
+  const cardano_registration_cert_t* registration_cert,
+  cardano_cbor_writer_t*             writer)
+{
+  if (registration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_REGISTRATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(registration_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  cardano_error_t write_deposit_result = cardano_cbor_writer_write_uint(writer, registration_cert->deposit);
+
+  if (write_deposit_result != CARDANO_SUCCESS)
+  {
+    return write_deposit_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_registration_cert_to_cip116_json(
+  const cardano_registration_cert_t* cert,
+  cardano_json_writer_t*             writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "registration", 12);
+
+  cardano_json_writer_write_property_name(writer, "credential", 10);
+  assert(cert->credential != NULL);
+
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "coin", 4);
+  cardano_json_writer_write_uint_as_string(writer, cert->deposit);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_registration_cert_get_stake_credential(cardano_registration_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_registration_cert_set_stake_credential(
+  cardano_registration_cert_t* certificate,
+  cardano_credential_t*        credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_registration_cert_get_deposit(const cardano_registration_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return 0;
+  }
+
+  return certificate->deposit;
+}
+
+cardano_error_t
+cardano_registration_cert_set_deposit(cardano_registration_cert_t* certificate, uint64_t deposit)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  certificate->deposit = deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_registration_cert_unref(cardano_registration_cert_t** registration_cert)
+{
+  if ((registration_cert == NULL) || (*registration_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*registration_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *registration_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_registration_cert_ref(cardano_registration_cert_t* registration_cert)
+{
+  if (registration_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&registration_cert->base);
+}
+
+size_t
+cardano_registration_cert_refcount(const cardano_registration_cert_t* registration_cert)
+{
+  if (registration_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&registration_cert->base);
+}
+
+void
+cardano_registration_cert_set_last_error(cardano_registration_cert_t* registration_cert, const char* message)
+{
+  cardano_object_set_last_error(&registration_cert->base, message);
+}
+
+const char*
+cardano_registration_cert_get_last_error(const cardano_registration_cert_t* registration_cert)
+{
+  return cardano_object_get_last_error(&registration_cert->base);
+}
+
+cardano_error_t
+cardano_registration_cert_deep_clone(const cardano_registration_cert_t* source, cardano_registration_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_registration_cert_t* copy = _cardano_malloc(sizeof(cardano_registration_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->deposit            = source->deposit;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/resign_committee_cold_cert.c b/vendor/src/certs/resign_committee_cold_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/resign_committee_cold_cert.c
@@ -0,0 +1,483 @@
+/**
+ * \file resign_committee_cold_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/resign_committee_cold_cert.h>
+#include <cardano/common/anchor.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate is used then a committee member wants to resign early (will be marked on-chain as an expired member).
+ */
+typedef struct cardano_resign_committee_cold_cert_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* credential;
+    cardano_anchor_t*     anchor;
+} cardano_resign_committee_cold_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a resign_committee_cold_cert object.
+ *
+ * This function is responsible for properly deallocating a resign_committee_cold_cert object (`cardano_resign_committee_cold_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the resign_committee_cold_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_resign_committee_cold_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the resign_committee_cold_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_resign_committee_cold_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_resign_committee_cold_cert_t* data = (cardano_resign_committee_cold_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+  cardano_anchor_unref(&data->anchor);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_resign_committee_cold_cert_new(
+  cardano_credential_t*                  committee_cold_cred,
+  cardano_anchor_t*                      anchor,
+  cardano_resign_committee_cold_cert_t** resign_committee_cold_cert)
+{
+  if (committee_cold_cred == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (resign_committee_cold_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_resign_committee_cold_cert_t* data = _cardano_malloc(sizeof(cardano_resign_committee_cold_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_resign_committee_cold_cert_deallocate;
+
+  cardano_credential_ref(committee_cold_cred);
+  data->credential = committee_cold_cred;
+
+  if (anchor != NULL)
+  {
+    cardano_anchor_ref(anchor);
+  }
+
+  data->anchor = anchor;
+
+  *resign_committee_cold_cert = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_resign_committee_cold_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_resign_committee_cold_cert_t** resign_committee_cold_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (resign_committee_cold_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "resign_committee_cold_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_cbor_reader_state_t state;
+
+  cardano_error_t read_state = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_state != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_state;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+    CARDANO_UNUSED(read_null);
+  }
+  else
+  {
+    cardano_error_t read_anchor_result = cardano_anchor_from_cbor(reader, &anchor);
+
+    if (read_anchor_result != CARDANO_SUCCESS)
+    {
+      cardano_credential_unref(&credential);
+
+      return read_anchor_result;
+    }
+  }
+
+  cardano_error_t new_result = cardano_resign_committee_cold_cert_new(credential, anchor, resign_committee_cold_cert);
+
+  cardano_credential_unref(&credential);
+  cardano_anchor_unref(&anchor);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_resign_committee_cold_cert_to_cbor(
+  const cardano_resign_committee_cold_cert_t* resign_committee_cold_cert,
+  cardano_cbor_writer_t*                      writer)
+{
+  if (resign_committee_cold_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(resign_committee_cold_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  if (resign_committee_cold_cert->anchor != NULL)
+  {
+    cardano_error_t write_anchor_result = cardano_anchor_to_cbor(resign_committee_cold_cert->anchor, writer);
+
+    if (write_anchor_result != CARDANO_SUCCESS)
+    {
+      return write_anchor_result;
+    }
+  }
+  else
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_resign_committee_cold_cert_to_cip116_json(
+  const cardano_resign_committee_cold_cert_t* cert,
+  cardano_json_writer_t*                      writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "resign_committee_cold", 21);
+
+  cardano_json_writer_write_property_name(writer, "committee_cold_credential", 25);
+
+  assert(cert->credential != NULL);
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (cert->anchor != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "anchor", 6);
+    error = cardano_anchor_to_cip116_json(cert->anchor, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_resign_committee_cold_cert_get_credential(cardano_resign_committee_cold_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_resign_committee_cold_cert_set_credential(cardano_resign_committee_cold_cert_t* certificate, cardano_credential_t* credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_anchor_t*
+cardano_resign_committee_cold_cert_get_anchor(cardano_resign_committee_cold_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_anchor_ref(certificate->anchor);
+
+  return certificate->anchor;
+}
+
+cardano_error_t
+cardano_resign_committee_cold_cert_set_anchor(cardano_resign_committee_cold_cert_t* certificate, cardano_anchor_t* anchor)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_ref(anchor);
+  cardano_anchor_unref(&certificate->anchor);
+  certificate->anchor = anchor;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_resign_committee_cold_cert_unref(cardano_resign_committee_cold_cert_t** resign_committee_cold_cert)
+{
+  if ((resign_committee_cold_cert == NULL) || (*resign_committee_cold_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*resign_committee_cold_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *resign_committee_cold_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_resign_committee_cold_cert_ref(cardano_resign_committee_cold_cert_t* resign_committee_cold_cert)
+{
+  if (resign_committee_cold_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&resign_committee_cold_cert->base);
+}
+
+size_t
+cardano_resign_committee_cold_cert_refcount(const cardano_resign_committee_cold_cert_t* resign_committee_cold_cert)
+{
+  if (resign_committee_cold_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&resign_committee_cold_cert->base);
+}
+
+void
+cardano_resign_committee_cold_cert_set_last_error(cardano_resign_committee_cold_cert_t* resign_committee_cold_cert, const char* message)
+{
+  cardano_object_set_last_error(&resign_committee_cold_cert->base, message);
+}
+
+const char*
+cardano_resign_committee_cold_cert_get_last_error(const cardano_resign_committee_cold_cert_t* resign_committee_cold_cert)
+{
+  return cardano_object_get_last_error(&resign_committee_cold_cert->base);
+}
+
+cardano_error_t
+cardano_resign_committee_cold_cert_deep_clone(const cardano_resign_committee_cold_cert_t* source, cardano_resign_committee_cold_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_resign_committee_cold_cert_t* copy = _cardano_malloc(sizeof(cardano_resign_committee_cold_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->anchor             = NULL;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->anchor != NULL)
+  {
+    const cardano_error_t result = cardano_anchor_deep_clone(source->anchor, &copy->anchor);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/stake_delegation_cert.c b/vendor/src/certs/stake_delegation_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/stake_delegation_cert.c
@@ -0,0 +1,455 @@
+/**
+ * \file stake_delegation_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/stake_delegation_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate is used when a stakeholder wants to delegate their stake to a
+ * specific stake pool. It includes the stake pool id to which the stake is delegated.
+ */
+typedef struct cardano_stake_delegation_cert_t
+{
+    cardano_object_t        base;
+    cardano_credential_t*   credential;
+    cardano_blake2b_hash_t* pool_key_hash;
+} cardano_stake_delegation_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a stake_delegation_cert object.
+ *
+ * This function is responsible for properly deallocating a stake_delegation_cert object (`cardano_stake_delegation_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the stake_delegation_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_stake_delegation_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the stake_delegation_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_stake_delegation_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_stake_delegation_cert_t* data = (cardano_stake_delegation_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+  cardano_blake2b_hash_unref(&data->pool_key_hash);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_stake_delegation_cert_new(
+  cardano_credential_t*             credential,
+  cardano_blake2b_hash_t*           pool_key_hash,
+  cardano_stake_delegation_cert_t** stake_delegation)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pool_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_delegation_cert_t* data = _cardano_malloc(sizeof(cardano_stake_delegation_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_stake_delegation_cert_deallocate;
+
+  cardano_credential_ref(credential);
+  data->credential = credential;
+
+  cardano_blake2b_hash_ref(pool_key_hash);
+  data->pool_key_hash = pool_key_hash;
+
+  *stake_delegation = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_delegation_cert_t** stake_delegation_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "stake_delegation_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_STAKE_DELEGATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  cardano_error_t read_hash_result = cardano_blake2b_hash_from_cbor(reader, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_hash_result;
+  }
+
+  cardano_error_t new_result = cardano_stake_delegation_cert_new(credential, hash, stake_delegation_cert);
+
+  cardano_credential_unref(&credential);
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_stake_delegation_cert_to_cbor(
+  const cardano_stake_delegation_cert_t* stake_delegation_cert,
+  cardano_cbor_writer_t*                 writer)
+{
+  if (stake_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_STAKE_DELEGATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(stake_delegation_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  cardano_error_t write_hash_result = cardano_blake2b_hash_to_cbor(stake_delegation_cert->pool_key_hash, writer);
+
+  if (write_hash_result != CARDANO_SUCCESS)
+  {
+    return write_hash_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_delegation_cert_to_cip116_json(
+  const cardano_stake_delegation_cert_t* cert,
+  cardano_json_writer_t*                 writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "stake_delegation", 16);
+
+  cardano_json_writer_write_property_name(writer, "credential", 10);
+
+  assert(cert->credential != NULL);
+
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "pool_keyhash", 12);
+
+  assert(cert->pool_key_hash != NULL);
+
+  cardano_json_writer_write_bytes_as_bech32(
+    writer,
+    "pool",
+    4,
+    cardano_blake2b_hash_get_data(cert->pool_key_hash),
+    cardano_blake2b_hash_get_bytes_size(cert->pool_key_hash));
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_stake_delegation_cert_get_credential(cardano_stake_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_stake_delegation_cert_set_credential(cardano_stake_delegation_cert_t* certificate, cardano_credential_t* credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_stake_delegation_cert_get_pool_key_hash(cardano_stake_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(certificate->pool_key_hash);
+
+  return certificate->pool_key_hash;
+}
+
+cardano_error_t
+cardano_stake_delegation_cert_set_pool_key_hash(cardano_stake_delegation_cert_t* certificate, cardano_blake2b_hash_t* hash)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(hash);
+  cardano_blake2b_hash_unref(&certificate->pool_key_hash);
+  certificate->pool_key_hash = hash;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_stake_delegation_cert_unref(cardano_stake_delegation_cert_t** stake_delegation_cert)
+{
+  if ((stake_delegation_cert == NULL) || (*stake_delegation_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*stake_delegation_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *stake_delegation_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_stake_delegation_cert_ref(cardano_stake_delegation_cert_t* stake_delegation_cert)
+{
+  if (stake_delegation_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&stake_delegation_cert->base);
+}
+
+size_t
+cardano_stake_delegation_cert_refcount(const cardano_stake_delegation_cert_t* stake_delegation_cert)
+{
+  if (stake_delegation_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&stake_delegation_cert->base);
+}
+
+void
+cardano_stake_delegation_cert_set_last_error(cardano_stake_delegation_cert_t* stake_delegation_cert, const char* message)
+{
+  cardano_object_set_last_error(&stake_delegation_cert->base, message);
+}
+
+const char*
+cardano_stake_delegation_cert_get_last_error(const cardano_stake_delegation_cert_t* stake_delegation_cert)
+{
+  return cardano_object_get_last_error(&stake_delegation_cert->base);
+}
+
+cardano_error_t
+cardano_stake_delegation_cert_deep_clone(const cardano_stake_delegation_cert_t* source, cardano_stake_delegation_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_delegation_cert_t* copy = _cardano_malloc(sizeof(cardano_stake_delegation_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->pool_key_hash      = NULL;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pool_key_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->pool_key_hash, &copy->pool_key_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/stake_deregistration_cert.c b/vendor/src/certs/stake_deregistration_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/stake_deregistration_cert.c
@@ -0,0 +1,369 @@
+/**
+ * \file stake_deregistration_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/stake_deregistration_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate is used when a stakeholder no longer wants to participate in
+ * staking. It revokes the stake registration and the associated stake is no
+ * longer counted when calculating stake pool rewards.
+ */
+typedef struct cardano_stake_deregistration_cert_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* credential;
+} cardano_stake_deregistration_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a stake_deregistration_cert object.
+ *
+ * This function is responsible for properly deallocating a stake_deregistration_cert object (`cardano_stake_deregistration_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the stake_deregistration_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_stake_deregistration_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the stake_deregistration_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_stake_deregistration_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_stake_deregistration_cert_t* data = (cardano_stake_deregistration_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_stake_deregistration_cert_new(
+  cardano_credential_t*                 credential,
+  cardano_stake_deregistration_cert_t** stake_deregistration)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_deregistration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_deregistration_cert_t* data = _cardano_malloc(sizeof(cardano_stake_deregistration_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_stake_deregistration_cert_deallocate;
+
+  cardano_credential_ref(credential);
+  data->credential = credential;
+
+  *stake_deregistration = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_deregistration_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_deregistration_cert_t** stake_deregistration_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_deregistration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "stake_deregistration_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_STAKE_DEREGISTRATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  cardano_error_t new_result = cardano_stake_deregistration_cert_new(credential, stake_deregistration_cert);
+
+  cardano_credential_unref(&credential);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_stake_deregistration_cert_to_cbor(
+  const cardano_stake_deregistration_cert_t* stake_deregistration_cert,
+  cardano_cbor_writer_t*                     writer)
+{
+  if (stake_deregistration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_STAKE_DEREGISTRATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(stake_deregistration_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_deregistration_cert_to_cip116_json(
+  const cardano_stake_deregistration_cert_t* cert,
+  cardano_json_writer_t*                     writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "stake_deregistration", 20);
+
+  cardano_json_writer_write_property_name(writer, "credential", 10);
+
+  assert(cert->credential != NULL);
+
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_stake_deregistration_cert_get_credential(cardano_stake_deregistration_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_stake_deregistration_cert_set_credential(cardano_stake_deregistration_cert_t* certificate, cardano_credential_t* credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_stake_deregistration_cert_unref(cardano_stake_deregistration_cert_t** stake_deregistration_cert)
+{
+  if ((stake_deregistration_cert == NULL) || (*stake_deregistration_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*stake_deregistration_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *stake_deregistration_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_stake_deregistration_cert_ref(cardano_stake_deregistration_cert_t* stake_deregistration_cert)
+{
+  if (stake_deregistration_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&stake_deregistration_cert->base);
+}
+
+size_t
+cardano_stake_deregistration_cert_refcount(const cardano_stake_deregistration_cert_t* stake_deregistration_cert)
+{
+  if (stake_deregistration_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&stake_deregistration_cert->base);
+}
+
+void
+cardano_stake_deregistration_cert_set_last_error(cardano_stake_deregistration_cert_t* stake_deregistration_cert, const char* message)
+{
+  cardano_object_set_last_error(&stake_deregistration_cert->base, message);
+}
+
+const char*
+cardano_stake_deregistration_cert_get_last_error(const cardano_stake_deregistration_cert_t* stake_deregistration_cert)
+{
+  return cardano_object_get_last_error(&stake_deregistration_cert->base);
+}
+
+cardano_error_t
+cardano_stake_deregistration_cert_deep_clone(const cardano_stake_deregistration_cert_t* source, cardano_stake_deregistration_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_deregistration_cert_t* copy = _cardano_malloc(sizeof(cardano_stake_deregistration_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/stake_registration_cert.c b/vendor/src/certs/stake_registration_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/stake_registration_cert.c
@@ -0,0 +1,366 @@
+/**
+ * \file stake_registration_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/stake_registration_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate is used when a stakeholder no longer wants to participate in
+ * staking. It revokes the stake registration and the associated stake is no
+ * longer counted when calculating stake pool rewards.
+ */
+typedef struct cardano_stake_registration_cert_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* credential;
+} cardano_stake_registration_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a stake_registration_cert object.
+ *
+ * This function is responsible for properly deallocating a stake_registration_cert object (`cardano_stake_registration_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the stake_registration_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_stake_registration_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the stake_registration_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_stake_registration_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_stake_registration_cert_t* data = (cardano_stake_registration_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_stake_registration_cert_new(
+  cardano_credential_t*               credential,
+  cardano_stake_registration_cert_t** stake_registration)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_registration == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_registration_cert_t* data = _cardano_malloc(sizeof(cardano_stake_registration_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_stake_registration_cert_deallocate;
+
+  cardano_credential_ref(credential);
+  data->credential = credential;
+
+  *stake_registration = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_registration_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_registration_cert_t** stake_registration_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_registration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "stake_registration_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_STAKE_REGISTRATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  cardano_error_t new_result = cardano_stake_registration_cert_new(credential, stake_registration_cert);
+
+  cardano_credential_unref(&credential);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_stake_registration_cert_to_cbor(
+  const cardano_stake_registration_cert_t* stake_registration_cert,
+  cardano_cbor_writer_t*                   writer)
+{
+  if (stake_registration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_STAKE_REGISTRATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(stake_registration_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_registration_cert_to_cip116_json(
+  const cardano_stake_registration_cert_t* cert,
+  cardano_json_writer_t*                   writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "stake_registration", 18);
+  cardano_json_writer_write_property_name(writer, "credential", 10);
+
+  const cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_stake_registration_cert_get_credential(cardano_stake_registration_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_stake_registration_cert_set_credential(cardano_stake_registration_cert_t* certificate, cardano_credential_t* credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_stake_registration_cert_unref(cardano_stake_registration_cert_t** stake_registration_cert)
+{
+  if ((stake_registration_cert == NULL) || (*stake_registration_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*stake_registration_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *stake_registration_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_stake_registration_cert_ref(cardano_stake_registration_cert_t* stake_registration_cert)
+{
+  if (stake_registration_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&stake_registration_cert->base);
+}
+
+size_t
+cardano_stake_registration_cert_refcount(const cardano_stake_registration_cert_t* stake_registration_cert)
+{
+  if (stake_registration_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&stake_registration_cert->base);
+}
+
+void
+cardano_stake_registration_cert_set_last_error(cardano_stake_registration_cert_t* stake_registration_cert, const char* message)
+{
+  cardano_object_set_last_error(&stake_registration_cert->base, message);
+}
+
+const char*
+cardano_stake_registration_cert_get_last_error(const cardano_stake_registration_cert_t* stake_registration_cert)
+{
+  return cardano_object_get_last_error(&stake_registration_cert->base);
+}
+
+cardano_error_t
+cardano_stake_registration_cert_deep_clone(const cardano_stake_registration_cert_t* source, cardano_stake_registration_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_registration_cert_t* copy = _cardano_malloc(sizeof(cardano_stake_registration_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/stake_registration_delegation_cert.c b/vendor/src/certs/stake_registration_delegation_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/stake_registration_delegation_cert.c
@@ -0,0 +1,503 @@
+/**
+ * \file stake_registration_delegation_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/stake_registration_delegation_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 4;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate Register the stake key and delegate with a single certificate to a stake pool.
+ */
+typedef struct cardano_stake_registration_delegation_cert_t
+{
+    cardano_object_t        base;
+    cardano_credential_t*   credential;
+    cardano_blake2b_hash_t* pool_key_hash;
+    uint64_t                deposit;
+} cardano_stake_registration_delegation_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a stake_registration_delegation_cert object.
+ *
+ * This function is responsible for properly deallocating a stake_registration_delegation_cert object (`cardano_stake_registration_delegation_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the stake_registration_delegation_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_stake_registration_delegation_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the stake_registration_delegation_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_stake_registration_delegation_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_stake_registration_delegation_cert_t* data = (cardano_stake_registration_delegation_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+  cardano_blake2b_hash_unref(&data->pool_key_hash);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_stake_registration_delegation_cert_new(
+  cardano_credential_t*                          credential,
+  cardano_blake2b_hash_t*                        pool_key_hash,
+  const uint64_t                                 deposit,
+  cardano_stake_registration_delegation_cert_t** stake_registration_delegation)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pool_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_registration_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_registration_delegation_cert_t* data = _cardano_malloc(sizeof(cardano_stake_registration_delegation_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_stake_registration_delegation_cert_deallocate;
+
+  cardano_credential_ref(credential);
+  data->credential = credential;
+
+  cardano_blake2b_hash_ref(pool_key_hash);
+  data->pool_key_hash = pool_key_hash;
+
+  data->deposit = deposit;
+
+  *stake_registration_delegation = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_registration_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_registration_delegation_cert_t** stake_registration_delegation_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_registration_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "stake_registration_delegation_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  cardano_error_t read_hash_result = cardano_blake2b_hash_from_cbor(reader, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_hash_result;
+  }
+
+  uint64_t deposit = 0U;
+
+  const cardano_error_t read_deposit_result = cardano_cbor_reader_read_uint(reader, &deposit);
+
+  if (read_deposit_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+    cardano_blake2b_hash_unref(&hash);
+
+    return read_deposit_result;
+  }
+
+  cardano_error_t new_result = cardano_stake_registration_delegation_cert_new(credential, hash, deposit, stake_registration_delegation_cert);
+
+  cardano_credential_unref(&credential);
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_stake_registration_delegation_cert_to_cbor(
+  const cardano_stake_registration_delegation_cert_t* stake_registration_delegation_cert,
+  cardano_cbor_writer_t*                              writer)
+{
+  if (stake_registration_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(stake_registration_delegation_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  cardano_error_t write_hash_result = cardano_blake2b_hash_to_cbor(stake_registration_delegation_cert->pool_key_hash, writer);
+
+  if (write_hash_result != CARDANO_SUCCESS)
+  {
+    return write_hash_result;
+  }
+
+  cardano_error_t write_deposit_result = cardano_cbor_writer_write_uint(writer, stake_registration_delegation_cert->deposit);
+
+  if (write_deposit_result != CARDANO_SUCCESS)
+  {
+    return write_deposit_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_registration_delegation_cert_to_cip116_json(
+  const cardano_stake_registration_delegation_cert_t* cert,
+  cardano_json_writer_t*                              writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "stake_registration_delegation", 29);
+
+  cardano_json_writer_write_property_name(writer, "credential", 10);
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "pool_keyhash", 12);
+  cardano_json_writer_write_bytes_as_bech32(
+    writer,
+    "pool",
+    4,
+    cardano_blake2b_hash_get_data(cert->pool_key_hash),
+    cardano_blake2b_hash_get_bytes_size(cert->pool_key_hash));
+
+  cardano_json_writer_write_property_name(writer, "coin", 4);
+  cardano_json_writer_write_uint_as_string(writer, cert->deposit);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_stake_registration_delegation_cert_get_credential(cardano_stake_registration_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_stake_registration_delegation_cert_set_credential(cardano_stake_registration_delegation_cert_t* certificate, cardano_credential_t* credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_stake_registration_delegation_cert_get_pool_key_hash(cardano_stake_registration_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(certificate->pool_key_hash);
+
+  return certificate->pool_key_hash;
+}
+
+cardano_error_t
+cardano_stake_registration_delegation_cert_set_pool_key_hash(cardano_stake_registration_delegation_cert_t* certificate, cardano_blake2b_hash_t* hash)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(hash);
+  cardano_blake2b_hash_unref(&certificate->pool_key_hash);
+  certificate->pool_key_hash = hash;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_stake_registration_delegation_cert_get_deposit(const cardano_stake_registration_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return 0;
+  }
+
+  return certificate->deposit;
+}
+
+cardano_error_t
+cardano_stake_registration_delegation_cert_set_deposit(
+  cardano_stake_registration_delegation_cert_t* certificate,
+  const uint64_t                                deposit)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  certificate->deposit = deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_stake_registration_delegation_cert_unref(cardano_stake_registration_delegation_cert_t** stake_registration_delegation_cert)
+{
+  if ((stake_registration_delegation_cert == NULL) || (*stake_registration_delegation_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*stake_registration_delegation_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *stake_registration_delegation_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_stake_registration_delegation_cert_ref(cardano_stake_registration_delegation_cert_t* stake_registration_delegation_cert)
+{
+  if (stake_registration_delegation_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&stake_registration_delegation_cert->base);
+}
+
+size_t
+cardano_stake_registration_delegation_cert_refcount(const cardano_stake_registration_delegation_cert_t* stake_registration_delegation_cert)
+{
+  if (stake_registration_delegation_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&stake_registration_delegation_cert->base);
+}
+
+void
+cardano_stake_registration_delegation_cert_set_last_error(cardano_stake_registration_delegation_cert_t* stake_registration_delegation_cert, const char* message)
+{
+  cardano_object_set_last_error(&stake_registration_delegation_cert->base, message);
+}
+
+const char*
+cardano_stake_registration_delegation_cert_get_last_error(const cardano_stake_registration_delegation_cert_t* stake_registration_delegation_cert)
+{
+  return cardano_object_get_last_error(&stake_registration_delegation_cert->base);
+}
+
+cardano_error_t
+cardano_stake_registration_delegation_cert_deep_clone(const cardano_stake_registration_delegation_cert_t* source, cardano_stake_registration_delegation_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_registration_delegation_cert_t* copy = _cardano_malloc(sizeof(cardano_stake_registration_delegation_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->pool_key_hash      = NULL;
+  copy->deposit            = source->deposit;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pool_key_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->pool_key_hash, &copy->pool_key_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/stake_vote_delegation_cert.c b/vendor/src/certs/stake_vote_delegation_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/stake_vote_delegation_cert.c
@@ -0,0 +1,546 @@
+/**
+ * \file stake_vote_delegation_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/stake_vote_delegation_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/drep.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 4;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate is used when an individual wants to delegate their voting
+ * rights to any other DRep and simultaneously wants to delegate their stake to a
+ * specific stake pool.
+ */
+typedef struct cardano_stake_vote_delegation_cert_t
+{
+    cardano_object_t        base;
+    cardano_credential_t*   credential;
+    cardano_blake2b_hash_t* pool_key_hash;
+    cardano_drep_t*         drep;
+} cardano_stake_vote_delegation_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a stake_vote_delegation_cert object.
+ *
+ * This function is responsible for properly deallocating a stake_vote_delegation_cert object (`cardano_stake_vote_delegation_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the stake_vote_delegation_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_stake_vote_delegation_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the stake_vote_delegation_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_stake_vote_delegation_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_stake_vote_delegation_cert_t* data = (cardano_stake_vote_delegation_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+  cardano_blake2b_hash_unref(&data->pool_key_hash);
+  cardano_drep_unref(&data->drep);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_stake_vote_delegation_cert_new(
+  cardano_credential_t*                  credential,
+  cardano_blake2b_hash_t*                pool_key_hash,
+  cardano_drep_t*                        drep,
+  cardano_stake_vote_delegation_cert_t** stake_vote_delegation)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pool_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_vote_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_vote_delegation_cert_t* data = _cardano_malloc(sizeof(cardano_stake_vote_delegation_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_stake_vote_delegation_cert_deallocate;
+
+  cardano_credential_ref(credential);
+  data->credential = credential;
+
+  cardano_blake2b_hash_ref(pool_key_hash);
+  data->pool_key_hash = pool_key_hash;
+
+  cardano_drep_ref(drep);
+  data->drep = drep;
+
+  *stake_vote_delegation = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_vote_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_vote_delegation_cert_t** stake_vote_delegation_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_vote_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "stake_vote_delegation_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  cardano_error_t read_hash_result = cardano_blake2b_hash_from_cbor(reader, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_hash_result;
+  }
+
+  cardano_drep_t* drep = NULL;
+
+  cardano_error_t read_drep_result = cardano_drep_from_cbor(reader, &drep);
+
+  if (read_drep_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+    cardano_blake2b_hash_unref(&hash);
+
+    return read_drep_result;
+  }
+
+  cardano_error_t new_result = cardano_stake_vote_delegation_cert_new(credential, hash, drep, stake_vote_delegation_cert);
+
+  cardano_credential_unref(&credential);
+  cardano_blake2b_hash_unref(&hash);
+  cardano_drep_unref(&drep);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_stake_vote_delegation_cert_to_cbor(
+  const cardano_stake_vote_delegation_cert_t* stake_vote_delegation_cert,
+  cardano_cbor_writer_t*                      writer)
+{
+  if (stake_vote_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(stake_vote_delegation_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  cardano_error_t write_hash_result = cardano_blake2b_hash_to_cbor(stake_vote_delegation_cert->pool_key_hash, writer);
+
+  if (write_hash_result != CARDANO_SUCCESS)
+  {
+    return write_hash_result;
+  }
+
+  cardano_error_t write_drep_result = cardano_drep_to_cbor(stake_vote_delegation_cert->drep, writer);
+
+  if (write_drep_result != CARDANO_SUCCESS)
+  {
+    return write_drep_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_vote_delegation_cert_to_cip116_json(
+  const cardano_stake_vote_delegation_cert_t* cert,
+  cardano_json_writer_t*                      writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "stake_vote_delegation", 21);
+
+  assert(cert->credential != NULL);
+
+  cardano_json_writer_write_property_name(writer, "credential", 10);
+
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "pool_keyhash", 12);
+
+  assert(cert->pool_key_hash != NULL);
+
+  cardano_json_writer_write_bytes_as_bech32(
+    writer,
+    "pool",
+    4,
+    cardano_blake2b_hash_get_data(cert->pool_key_hash),
+    cardano_blake2b_hash_get_bytes_size(cert->pool_key_hash));
+
+  cardano_json_writer_write_property_name(writer, "drep", 4);
+
+  assert(cert->drep != NULL);
+
+  error = cardano_drep_to_cip116_json(cert->drep, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_stake_vote_delegation_cert_get_credential(cardano_stake_vote_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_stake_vote_delegation_cert_set_credential(cardano_stake_vote_delegation_cert_t* certificate, cardano_credential_t* credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_stake_vote_delegation_cert_get_pool_key_hash(cardano_stake_vote_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(certificate->pool_key_hash);
+
+  return certificate->pool_key_hash;
+}
+
+cardano_error_t
+cardano_stake_vote_delegation_cert_set_pool_key_hash(cardano_stake_vote_delegation_cert_t* certificate, cardano_blake2b_hash_t* hash)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(hash);
+  cardano_blake2b_hash_unref(&certificate->pool_key_hash);
+  certificate->pool_key_hash = hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_drep_t*
+cardano_stake_vote_delegation_cert_get_drep(cardano_stake_vote_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_drep_ref(certificate->drep);
+
+  return certificate->drep;
+}
+
+cardano_error_t
+cardano_stake_vote_delegation_cert_set_drep(
+  cardano_stake_vote_delegation_cert_t* certificate,
+  cardano_drep_t*                       drep)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_drep_ref(drep);
+  cardano_drep_unref(&certificate->drep);
+  certificate->drep = drep;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_stake_vote_delegation_cert_unref(cardano_stake_vote_delegation_cert_t** stake_vote_delegation_cert)
+{
+  if ((stake_vote_delegation_cert == NULL) || (*stake_vote_delegation_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*stake_vote_delegation_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *stake_vote_delegation_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_stake_vote_delegation_cert_ref(cardano_stake_vote_delegation_cert_t* stake_vote_delegation_cert)
+{
+  if (stake_vote_delegation_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&stake_vote_delegation_cert->base);
+}
+
+size_t
+cardano_stake_vote_delegation_cert_refcount(const cardano_stake_vote_delegation_cert_t* stake_vote_delegation_cert)
+{
+  if (stake_vote_delegation_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&stake_vote_delegation_cert->base);
+}
+
+void
+cardano_stake_vote_delegation_cert_set_last_error(cardano_stake_vote_delegation_cert_t* stake_vote_delegation_cert, const char* message)
+{
+  cardano_object_set_last_error(&stake_vote_delegation_cert->base, message);
+}
+
+const char*
+cardano_stake_vote_delegation_cert_get_last_error(const cardano_stake_vote_delegation_cert_t* stake_vote_delegation_cert)
+{
+  return cardano_object_get_last_error(&stake_vote_delegation_cert->base);
+}
+
+cardano_error_t
+cardano_stake_vote_delegation_cert_deep_clone(const cardano_stake_vote_delegation_cert_t* source, cardano_stake_vote_delegation_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_vote_delegation_cert_t* copy = _cardano_malloc(sizeof(cardano_stake_vote_delegation_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->pool_key_hash      = NULL;
+  copy->drep               = NULL;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pool_key_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->pool_key_hash, &copy->pool_key_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->drep != NULL)
+  {
+    const cardano_error_t result = cardano_drep_deep_clone(source->drep, &copy->drep);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/stake_vote_registration_delegation_cert.c b/vendor/src/certs/stake_vote_registration_delegation_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/stake_vote_registration_delegation_cert.c
@@ -0,0 +1,597 @@
+/**
+ * \file stake_vote_registration_delegation_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/stake_vote_registration_delegation_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/drep.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 5;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate is used when an individual wants to register its stake key,
+ * delegate their voting rights to any other DRep and simultaneously wants to delegate
+ * their stake to a specific stake pool.
+ */
+typedef struct cardano_stake_vote_registration_delegation_cert_t
+{
+    cardano_object_t        base;
+    cardano_credential_t*   credential;
+    cardano_blake2b_hash_t* pool_key_hash;
+    cardano_drep_t*         drep;
+    uint64_t                deposit;
+} cardano_stake_vote_registration_delegation_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a stake_vote_registration_delegation_cert object.
+ *
+ * This function is responsible for properly deallocating a stake_vote_registration_delegation_cert object (`cardano_stake_vote_registration_delegation_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the stake_vote_registration_delegation_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_stake_vote_registration_delegation_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the stake_vote_registration_delegation_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_stake_vote_registration_delegation_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_stake_vote_registration_delegation_cert_t* data = (cardano_stake_vote_registration_delegation_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+  cardano_blake2b_hash_unref(&data->pool_key_hash);
+  cardano_drep_unref(&data->drep);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_stake_vote_registration_delegation_cert_new(
+  cardano_credential_t*                               credential,
+  const uint64_t                                      deposit,
+  cardano_drep_t*                                     drep,
+  cardano_blake2b_hash_t*                             pool_key_hash,
+  cardano_stake_vote_registration_delegation_cert_t** vote_registration_delegation)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pool_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vote_registration_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_vote_registration_delegation_cert_t* data = _cardano_malloc(sizeof(cardano_stake_vote_registration_delegation_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_stake_vote_registration_delegation_cert_deallocate;
+
+  cardano_credential_ref(credential);
+  data->credential = credential;
+
+  cardano_blake2b_hash_ref(pool_key_hash);
+  data->pool_key_hash = pool_key_hash;
+
+  cardano_drep_ref(drep);
+  data->drep = drep;
+
+  data->deposit = deposit;
+
+  *vote_registration_delegation = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_vote_registration_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_stake_vote_registration_delegation_cert_t** stake_vote_registration_delegation_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (stake_vote_registration_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "stake_vote_registration_delegation_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  cardano_error_t read_hash_result = cardano_blake2b_hash_from_cbor(reader, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_hash_result;
+  }
+
+  cardano_drep_t* drep = NULL;
+
+  cardano_error_t read_drep_result = cardano_drep_from_cbor(reader, &drep);
+
+  if (read_drep_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+    cardano_blake2b_hash_unref(&hash);
+
+    return read_drep_result;
+  }
+
+  uint64_t deposit = 0U;
+
+  cardano_error_t read_deposit_result = cardano_cbor_reader_read_uint(reader, &deposit);
+
+  if (read_deposit_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+    cardano_blake2b_hash_unref(&hash);
+    cardano_drep_unref(&drep);
+
+    return read_deposit_result;
+  }
+
+  cardano_error_t new_result = cardano_stake_vote_registration_delegation_cert_new(credential, deposit, drep, hash, stake_vote_registration_delegation_cert);
+
+  cardano_credential_unref(&credential);
+  cardano_blake2b_hash_unref(&hash);
+  cardano_drep_unref(&drep);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_stake_vote_registration_delegation_cert_to_cbor(
+  const cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration_delegation_cert,
+  cardano_cbor_writer_t*                                   writer)
+{
+  if (stake_vote_registration_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(stake_vote_registration_delegation_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  cardano_error_t write_hash_result = cardano_blake2b_hash_to_cbor(stake_vote_registration_delegation_cert->pool_key_hash, writer);
+
+  if (write_hash_result != CARDANO_SUCCESS)
+  {
+    return write_hash_result;
+  }
+
+  cardano_error_t write_drep_result = cardano_drep_to_cbor(stake_vote_registration_delegation_cert->drep, writer);
+
+  if (write_drep_result != CARDANO_SUCCESS)
+  {
+    return write_drep_result;
+  }
+
+  cardano_error_t write_deposit_result = cardano_cbor_writer_write_uint(writer, stake_vote_registration_delegation_cert->deposit);
+
+  if (write_deposit_result != CARDANO_SUCCESS)
+  {
+    return write_deposit_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_stake_vote_registration_delegation_cert_to_cip116_json(
+  const cardano_stake_vote_registration_delegation_cert_t* cert,
+  cardano_json_writer_t*                                   writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "stake_vote_registration_delegation", 34);
+
+  cardano_json_writer_write_property_name(writer, "credential", 10);
+  assert(cert->credential != NULL);
+
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "pool_keyhash", 12);
+  assert(cert->pool_key_hash != NULL);
+
+  cardano_json_writer_write_bytes_as_bech32(
+    writer,
+    "pool",
+    4,
+    cardano_blake2b_hash_get_data(cert->pool_key_hash),
+    cardano_blake2b_hash_get_bytes_size(cert->pool_key_hash));
+
+  cardano_json_writer_write_property_name(writer, "drep", 4);
+  assert(cert->drep != NULL);
+
+  error = cardano_drep_to_cip116_json(cert->drep, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "coin", 4);
+  cardano_json_writer_write_uint_as_string(writer, cert->deposit);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_stake_vote_registration_delegation_cert_get_credential(cardano_stake_vote_registration_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_stake_vote_registration_delegation_cert_set_credential(cardano_stake_vote_registration_delegation_cert_t* certificate, cardano_credential_t* credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_stake_vote_registration_delegation_cert_get_pool_key_hash(cardano_stake_vote_registration_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(certificate->pool_key_hash);
+
+  return certificate->pool_key_hash;
+}
+
+cardano_error_t
+cardano_stake_vote_registration_delegation_cert_set_pool_key_hash(cardano_stake_vote_registration_delegation_cert_t* certificate, cardano_blake2b_hash_t* hash)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(hash);
+  cardano_blake2b_hash_unref(&certificate->pool_key_hash);
+  certificate->pool_key_hash = hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_drep_t*
+cardano_stake_vote_registration_delegation_cert_get_drep(cardano_stake_vote_registration_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_drep_ref(certificate->drep);
+
+  return certificate->drep;
+}
+
+cardano_error_t
+cardano_stake_vote_registration_delegation_cert_set_drep(
+  cardano_stake_vote_registration_delegation_cert_t* certificate,
+  cardano_drep_t*                                    drep)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_drep_ref(drep);
+  cardano_drep_unref(&certificate->drep);
+  certificate->drep = drep;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_stake_vote_registration_delegation_cert_get_deposit(const cardano_stake_vote_registration_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return 0;
+  }
+
+  return certificate->deposit;
+}
+
+cardano_error_t
+cardano_stake_vote_registration_delegation_cert_set_deposit(
+  cardano_stake_vote_registration_delegation_cert_t* certificate,
+  const uint64_t                                     deposit)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  certificate->deposit = deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_stake_vote_registration_delegation_cert_unref(cardano_stake_vote_registration_delegation_cert_t** stake_vote_registration_delegation_cert)
+{
+  if ((stake_vote_registration_delegation_cert == NULL) || (*stake_vote_registration_delegation_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*stake_vote_registration_delegation_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *stake_vote_registration_delegation_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_stake_vote_registration_delegation_cert_ref(cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration_delegation_cert)
+{
+  if (stake_vote_registration_delegation_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&stake_vote_registration_delegation_cert->base);
+}
+
+size_t
+cardano_stake_vote_registration_delegation_cert_refcount(const cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration_delegation_cert)
+{
+  if (stake_vote_registration_delegation_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&stake_vote_registration_delegation_cert->base);
+}
+
+void
+cardano_stake_vote_registration_delegation_cert_set_last_error(cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration_delegation_cert, const char* message)
+{
+  cardano_object_set_last_error(&stake_vote_registration_delegation_cert->base, message);
+}
+
+const char*
+cardano_stake_vote_registration_delegation_cert_get_last_error(const cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration_delegation_cert)
+{
+  return cardano_object_get_last_error(&stake_vote_registration_delegation_cert->base);
+}
+
+cardano_error_t
+cardano_stake_vote_registration_delegation_cert_deep_clone(const cardano_stake_vote_registration_delegation_cert_t* source, cardano_stake_vote_registration_delegation_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_stake_vote_registration_delegation_cert_t* copy = _cardano_malloc(sizeof(cardano_stake_vote_registration_delegation_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->pool_key_hash      = NULL;
+  copy->drep               = NULL;
+  copy->deposit            = source->deposit;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pool_key_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->pool_key_hash, &copy->pool_key_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->drep != NULL)
+  {
+    const cardano_error_t result = cardano_drep_deep_clone(source->drep, &copy->drep);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/unregister_drep_cert.c b/vendor/src/certs/unregister_drep_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/unregister_drep_cert.c
@@ -0,0 +1,421 @@
+/**
+ * \file unregister_drep_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/unregister_drep_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate unregister an individual as a DRep.
+ *
+ * Note that a DRep is retired immediately upon the chain accepting a retirement certificate, and
+ * the deposit is returned as part of the transaction that submits the retirement certificate
+ * (the same way that stake credential registration deposits are returned).
+ */
+typedef struct cardano_unregister_drep_cert_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* credential;
+    uint64_t              deposit;
+} cardano_unregister_drep_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a unregister_drep_cert object.
+ *
+ * This function is responsible for properly deallocating a unregister_drep_cert object (`cardano_unregister_drep_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the unregister_drep_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_unregister_drep_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the unregister_drep_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_unregister_drep_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_unregister_drep_cert_t* data = (cardano_unregister_drep_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_unregister_drep_cert_new(
+  cardano_credential_t*            credential,
+  const uint64_t                   deposit,
+  cardano_unregister_drep_cert_t** unregister_drep)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (unregister_drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unregister_drep_cert_t* data = _cardano_malloc(sizeof(cardano_unregister_drep_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_unregister_drep_cert_deallocate;
+
+  cardano_credential_ref(credential);
+  data->credential = credential;
+
+  data->deposit = deposit;
+
+  *unregister_drep = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_unregister_drep_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_unregister_drep_cert_t** unregister_drep_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (unregister_drep_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "unregister_drep_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_DREP_UNREGISTRATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  uint64_t deposit = 0U;
+
+  cardano_error_t read_deposit_result = cardano_cbor_reader_read_uint(reader, &deposit);
+
+  if (read_deposit_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_deposit_result;
+  }
+
+  cardano_error_t new_result = cardano_unregister_drep_cert_new(credential, deposit, unregister_drep_cert);
+
+  cardano_credential_unref(&credential);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_unregister_drep_cert_to_cbor(
+  const cardano_unregister_drep_cert_t* unregister_drep_cert,
+  cardano_cbor_writer_t*                writer)
+{
+  if (unregister_drep_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_DREP_UNREGISTRATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(unregister_drep_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  cardano_error_t write_deposit_result = cardano_cbor_writer_write_uint(writer, unregister_drep_cert->deposit);
+
+  if (write_deposit_result != CARDANO_SUCCESS)
+  {
+    return write_deposit_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_unregister_drep_cert_to_cip116_json(
+  const cardano_unregister_drep_cert_t* cert,
+  cardano_json_writer_t*                writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "unregister_drep", 15);
+
+  cardano_json_writer_write_property_name(writer, "drep_credential", 15);
+
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "coin", 4);
+  cardano_json_writer_write_uint_as_string(writer, cert->deposit);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_unregister_drep_cert_get_credential(cardano_unregister_drep_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_unregister_drep_cert_set_credential(cardano_unregister_drep_cert_t* certificate, cardano_credential_t* credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_unregister_drep_cert_get_deposit(const cardano_unregister_drep_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return 0;
+  }
+
+  return certificate->deposit;
+}
+
+cardano_error_t
+cardano_unregister_drep_cert_set_deposit(
+  cardano_unregister_drep_cert_t* certificate,
+  const uint64_t                  deposit)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  certificate->deposit = deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_unregister_drep_cert_unref(cardano_unregister_drep_cert_t** unregister_drep_cert)
+{
+  if ((unregister_drep_cert == NULL) || (*unregister_drep_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*unregister_drep_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *unregister_drep_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_unregister_drep_cert_ref(cardano_unregister_drep_cert_t* unregister_drep_cert)
+{
+  if (unregister_drep_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&unregister_drep_cert->base);
+}
+
+size_t
+cardano_unregister_drep_cert_refcount(const cardano_unregister_drep_cert_t* unregister_drep_cert)
+{
+  if (unregister_drep_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&unregister_drep_cert->base);
+}
+
+void
+cardano_unregister_drep_cert_set_last_error(cardano_unregister_drep_cert_t* unregister_drep_cert, const char* message)
+{
+  cardano_object_set_last_error(&unregister_drep_cert->base, message);
+}
+
+const char*
+cardano_unregister_drep_cert_get_last_error(const cardano_unregister_drep_cert_t* unregister_drep_cert)
+{
+  return cardano_object_get_last_error(&unregister_drep_cert->base);
+}
+
+cardano_error_t
+cardano_unregister_drep_cert_deep_clone(const cardano_unregister_drep_cert_t* source, cardano_unregister_drep_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unregister_drep_cert_t* copy = _cardano_malloc(sizeof(cardano_unregister_drep_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->deposit            = source->deposit;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/unregistration_cert.c b/vendor/src/certs/unregistration_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/unregistration_cert.c
@@ -0,0 +1,422 @@
+/**
+ * \file unregistration_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/unregistration_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate unregister an individual as a DRep.
+ *
+ * Note that a DRep is retired immediately upon the chain accepting a retirement certificate, and
+ * the deposit is returned as part of the transaction that submits the retirement certificate
+ * (the same way that stake credential registration deposits are returned).
+ */
+typedef struct cardano_unregistration_cert_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* credential;
+    uint64_t              deposit;
+} cardano_unregistration_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a unregistration_cert object.
+ *
+ * This function is responsible for properly deallocating a unregistration_cert object (`cardano_unregistration_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the unregistration_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_unregistration_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the unregistration_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_unregistration_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_unregistration_cert_t* data = (cardano_unregistration_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_unregistration_cert_new(
+  cardano_credential_t*           credential,
+  const uint64_t                  deposit,
+  cardano_unregistration_cert_t** unregister_drep)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (unregister_drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unregistration_cert_t* data = _cardano_malloc(sizeof(cardano_unregistration_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_unregistration_cert_deallocate;
+
+  cardano_credential_ref(credential);
+  data->credential = credential;
+
+  data->deposit = deposit;
+
+  *unregister_drep = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_unregistration_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_unregistration_cert_t** unregistration_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (unregistration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "unregistration_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_UNREGISTRATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  uint64_t deposit = 0U;
+
+  cardano_error_t read_deposit_result = cardano_cbor_reader_read_uint(reader, &deposit);
+
+  if (read_deposit_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_deposit_result;
+  }
+
+  cardano_error_t new_result = cardano_unregistration_cert_new(credential, deposit, unregistration_cert);
+
+  cardano_credential_unref(&credential);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_unregistration_cert_to_cbor(
+  const cardano_unregistration_cert_t* unregistration_cert,
+  cardano_cbor_writer_t*               writer)
+{
+  if (unregistration_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_UNREGISTRATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(unregistration_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  cardano_error_t write_deposit_result = cardano_cbor_writer_write_uint(writer, unregistration_cert->deposit);
+
+  if (write_deposit_result != CARDANO_SUCCESS)
+  {
+    return write_deposit_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_unregistration_cert_to_cip116_json(
+  const cardano_unregistration_cert_t* cert,
+  cardano_json_writer_t*               writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "unregistration", 14);
+
+  cardano_json_writer_write_property_name(writer, "credential", 10);
+  assert(cert->credential != NULL);
+
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "coin", 4);
+  cardano_json_writer_write_uint_as_string(writer, cert->deposit);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_unregistration_cert_get_credential(cardano_unregistration_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_unregistration_cert_set_credential(cardano_unregistration_cert_t* certificate, cardano_credential_t* credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_unregistration_cert_get_deposit(const cardano_unregistration_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return 0;
+  }
+
+  return certificate->deposit;
+}
+
+cardano_error_t
+cardano_unregistration_cert_set_deposit(
+  cardano_unregistration_cert_t* certificate,
+  const uint64_t                 deposit)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  certificate->deposit = deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_unregistration_cert_unref(cardano_unregistration_cert_t** unregistration_cert)
+{
+  if ((unregistration_cert == NULL) || (*unregistration_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*unregistration_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *unregistration_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_unregistration_cert_ref(cardano_unregistration_cert_t* unregistration_cert)
+{
+  if (unregistration_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&unregistration_cert->base);
+}
+
+size_t
+cardano_unregistration_cert_refcount(const cardano_unregistration_cert_t* unregistration_cert)
+{
+  if (unregistration_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&unregistration_cert->base);
+}
+
+void
+cardano_unregistration_cert_set_last_error(cardano_unregistration_cert_t* unregistration_cert, const char* message)
+{
+  cardano_object_set_last_error(&unregistration_cert->base, message);
+}
+
+const char*
+cardano_unregistration_cert_get_last_error(const cardano_unregistration_cert_t* unregistration_cert)
+{
+  return cardano_object_get_last_error(&unregistration_cert->base);
+}
+
+cardano_error_t
+cardano_unregistration_cert_deep_clone(const cardano_unregistration_cert_t* source, cardano_unregistration_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unregistration_cert_t* copy = _cardano_malloc(sizeof(cardano_unregistration_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->deposit            = source->deposit;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/update_drep_cert.c b/vendor/src/certs/update_drep_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/update_drep_cert.c
@@ -0,0 +1,489 @@
+/**
+ * \file update_drep_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/update_drep_cert.h>
+#include <cardano/common/anchor.h>
+#include <cardano/common/credential.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Updates the DRep anchored metadata.
+ */
+typedef struct cardano_update_drep_cert_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* credential;
+    cardano_anchor_t*     anchor;
+} cardano_update_drep_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a update_drep_cert object.
+ *
+ * This function is responsible for properly deallocating a update_drep_cert object (`cardano_update_drep_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the update_drep_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_update_drep_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the update_drep_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_update_drep_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_update_drep_cert_t* data = (cardano_update_drep_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+  cardano_anchor_unref(&data->anchor);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_update_drep_cert_new(
+  cardano_credential_t*        drep_credential,
+  cardano_anchor_t*            anchor,
+  cardano_update_drep_cert_t** update_drep_cert)
+{
+  if (drep_credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (update_drep_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_update_drep_cert_t* data = _cardano_malloc(sizeof(cardano_update_drep_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_update_drep_cert_deallocate;
+
+  cardano_credential_ref(drep_credential);
+  data->credential = drep_credential;
+
+  if (anchor != NULL)
+  {
+    cardano_anchor_ref(anchor);
+  }
+
+  data->anchor = anchor;
+
+  *update_drep_cert = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_update_drep_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_update_drep_cert_t** update_drep_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (update_drep_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "update_drep_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_UPDATE_DREP,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_cbor_reader_state_t state;
+
+  cardano_error_t read_state = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_state != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_state;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+    CARDANO_UNUSED(read_null);
+  }
+  else
+  {
+    cardano_error_t read_anchor_result = cardano_anchor_from_cbor(reader, &anchor);
+
+    if (read_anchor_result != CARDANO_SUCCESS)
+    {
+      cardano_credential_unref(&credential);
+
+      return read_anchor_result;
+    }
+  }
+
+  cardano_error_t new_result = cardano_update_drep_cert_new(credential, anchor, update_drep_cert);
+
+  cardano_credential_unref(&credential);
+  cardano_anchor_unref(&anchor);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_update_drep_cert_to_cbor(
+  const cardano_update_drep_cert_t* update_drep_cert,
+  cardano_cbor_writer_t*            writer)
+{
+  if (update_drep_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_UPDATE_DREP);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(update_drep_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  if (update_drep_cert->anchor != NULL)
+  {
+    cardano_error_t write_anchor_result = cardano_anchor_to_cbor(update_drep_cert->anchor, writer);
+
+    if (write_anchor_result != CARDANO_SUCCESS)
+    {
+      return write_anchor_result;
+    }
+  }
+  else
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_update_drep_cert_to_cip116_json(
+  const cardano_update_drep_cert_t* cert,
+  cardano_json_writer_t*            writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "update_drep", 11);
+
+  cardano_json_writer_write_property_name(writer, "drep_credential", 15);
+
+  assert(cert->credential != NULL);
+
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (cert->anchor != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "anchor", 6);
+
+    error = cardano_anchor_to_cip116_json(cert->anchor, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_update_drep_cert_get_credential(cardano_update_drep_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_update_drep_cert_set_credential(
+  cardano_update_drep_cert_t* certificate,
+  cardano_credential_t*       credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_anchor_t*
+cardano_update_drep_cert_get_anchor(cardano_update_drep_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_anchor_ref(certificate->anchor);
+
+  return certificate->anchor;
+}
+
+cardano_error_t
+cardano_update_drep_cert_set_anchor(
+  cardano_update_drep_cert_t* certificate,
+  cardano_anchor_t*           anchor)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_ref(anchor);
+  cardano_anchor_unref(&certificate->anchor);
+  certificate->anchor = anchor;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_update_drep_cert_unref(cardano_update_drep_cert_t** update_drep_cert)
+{
+  if ((update_drep_cert == NULL) || (*update_drep_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*update_drep_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *update_drep_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_update_drep_cert_ref(cardano_update_drep_cert_t* update_drep_cert)
+{
+  if (update_drep_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&update_drep_cert->base);
+}
+
+size_t
+cardano_update_drep_cert_refcount(const cardano_update_drep_cert_t* update_drep_cert)
+{
+  if (update_drep_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&update_drep_cert->base);
+}
+
+void
+cardano_update_drep_cert_set_last_error(cardano_update_drep_cert_t* update_drep_cert, const char* message)
+{
+  cardano_object_set_last_error(&update_drep_cert->base, message);
+}
+
+const char*
+cardano_update_drep_cert_get_last_error(const cardano_update_drep_cert_t* update_drep_cert)
+{
+  return cardano_object_get_last_error(&update_drep_cert->base);
+}
+
+cardano_error_t
+cardano_update_drep_cert_deep_clone(const cardano_update_drep_cert_t* source, cardano_update_drep_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_update_drep_cert_t* copy = _cardano_malloc(sizeof(cardano_update_drep_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->anchor             = NULL;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->anchor != NULL)
+  {
+    const cardano_error_t result = cardano_anchor_deep_clone(source->anchor, &copy->anchor);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/vote_delegation_cert.c b/vendor/src/certs/vote_delegation_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/vote_delegation_cert.c
@@ -0,0 +1,456 @@
+/**
+ * \file vote_delegation_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/vote_delegation_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/drep.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate is used when an individual wants to delegate their voting rights to any other DRep.
+ */
+typedef struct cardano_vote_delegation_cert_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* credential;
+    cardano_drep_t*       drep;
+} cardano_vote_delegation_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a vote_delegation_cert object.
+ *
+ * This function is responsible for properly deallocating a vote_delegation_cert object (`cardano_vote_delegation_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the vote_delegation_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_vote_delegation_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the vote_delegation_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_vote_delegation_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_vote_delegation_cert_t* data = (cardano_vote_delegation_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+  cardano_drep_unref(&data->drep);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_vote_delegation_cert_new(
+  cardano_credential_t*            credential,
+  cardano_drep_t*                  drep,
+  cardano_vote_delegation_cert_t** vote_delegation)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vote_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_vote_delegation_cert_t* data = _cardano_malloc(sizeof(cardano_vote_delegation_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_vote_delegation_cert_deallocate;
+
+  cardano_credential_ref(credential);
+  data->credential = credential;
+
+  cardano_drep_ref(drep);
+  data->drep = drep;
+
+  *vote_delegation = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_vote_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_vote_delegation_cert_t** vote_delegation_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vote_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "vote_delegation_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_VOTE_DELEGATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  cardano_drep_t* drep = NULL;
+
+  cardano_error_t read_drep_result = cardano_drep_from_cbor(reader, &drep);
+
+  if (read_drep_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_drep_result;
+  }
+
+  cardano_error_t new_result = cardano_vote_delegation_cert_new(credential, drep, vote_delegation_cert);
+
+  cardano_credential_unref(&credential);
+  cardano_drep_unref(&drep);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_vote_delegation_cert_to_cbor(
+  const cardano_vote_delegation_cert_t* vote_delegation_cert,
+  cardano_cbor_writer_t*                writer)
+{
+  if (vote_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_VOTE_DELEGATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(vote_delegation_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  cardano_error_t write_drep_result = cardano_drep_to_cbor(vote_delegation_cert->drep, writer);
+
+  if (write_drep_result != CARDANO_SUCCESS)
+  {
+    return write_drep_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_vote_delegation_cert_to_cip116_json(
+  const cardano_vote_delegation_cert_t* cert,
+  cardano_json_writer_t*                writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "vote_delegation", 15);
+
+  cardano_json_writer_write_property_name(writer, "credential", 10);
+
+  assert(cert->credential != NULL);
+
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  assert(cert->drep != NULL);
+  cardano_json_writer_write_property_name(writer, "drep", 4);
+
+  error = cardano_drep_to_cip116_json(cert->drep, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_vote_delegation_cert_get_credential(cardano_vote_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_vote_delegation_cert_set_credential(cardano_vote_delegation_cert_t* certificate, cardano_credential_t* credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_drep_t*
+cardano_vote_delegation_cert_get_drep(cardano_vote_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_drep_ref(certificate->drep);
+
+  return certificate->drep;
+}
+
+cardano_error_t
+cardano_vote_delegation_cert_set_drep(
+  cardano_vote_delegation_cert_t* certificate,
+  cardano_drep_t*                 drep)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_drep_ref(drep);
+  cardano_drep_unref(&certificate->drep);
+  certificate->drep = drep;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_vote_delegation_cert_unref(cardano_vote_delegation_cert_t** vote_delegation_cert)
+{
+  if ((vote_delegation_cert == NULL) || (*vote_delegation_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*vote_delegation_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *vote_delegation_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_vote_delegation_cert_ref(cardano_vote_delegation_cert_t* vote_delegation_cert)
+{
+  if (vote_delegation_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&vote_delegation_cert->base);
+}
+
+size_t
+cardano_vote_delegation_cert_refcount(const cardano_vote_delegation_cert_t* vote_delegation_cert)
+{
+  if (vote_delegation_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&vote_delegation_cert->base);
+}
+
+void
+cardano_vote_delegation_cert_set_last_error(cardano_vote_delegation_cert_t* vote_delegation_cert, const char* message)
+{
+  cardano_object_set_last_error(&vote_delegation_cert->base, message);
+}
+
+const char*
+cardano_vote_delegation_cert_get_last_error(const cardano_vote_delegation_cert_t* vote_delegation_cert)
+{
+  return cardano_object_get_last_error(&vote_delegation_cert->base);
+}
+
+cardano_error_t
+cardano_vote_delegation_cert_deep_clone(const cardano_vote_delegation_cert_t* source, cardano_vote_delegation_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_vote_delegation_cert_t* copy = _cardano_malloc(sizeof(cardano_vote_delegation_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->drep               = NULL;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->drep != NULL)
+  {
+    const cardano_error_t result = cardano_drep_deep_clone(source->drep, &copy->drep);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/certs/vote_registration_delegation_cert.c b/vendor/src/certs/vote_registration_delegation_cert.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/certs/vote_registration_delegation_cert.c
@@ -0,0 +1,510 @@
+/**
+ * \file vote_registration_delegation_cert.c
+ *
+ * \author angel.castillo
+ * \date   Jul 31, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/vote_registration_delegation_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/drep.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 4;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This certificate Register the stake key and delegate with a single certificate to a DRep.
+ */
+typedef struct cardano_vote_registration_delegation_cert_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* credential;
+    cardano_drep_t*       drep;
+    uint64_t              deposit;
+} cardano_vote_registration_delegation_cert_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a vote_registration_delegation_cert object.
+ *
+ * This function is responsible for properly deallocating a vote_registration_delegation_cert object (`cardano_vote_registration_delegation_cert_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the vote_registration_delegation_cert object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_vote_registration_delegation_cert_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the vote_registration_delegation_cert
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_vote_registration_delegation_cert_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_vote_registration_delegation_cert_t* data = (cardano_vote_registration_delegation_cert_t*)object;
+
+  cardano_credential_unref(&data->credential);
+  cardano_drep_unref(&data->drep);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_vote_registration_delegation_cert_new(
+  cardano_credential_t*                         credential,
+  const uint64_t                                deposit,
+  cardano_drep_t*                               drep,
+  cardano_vote_registration_delegation_cert_t** vote_registration_delegation)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vote_registration_delegation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_vote_registration_delegation_cert_t* data = _cardano_malloc(sizeof(cardano_vote_registration_delegation_cert_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_vote_registration_delegation_cert_deallocate;
+
+  cardano_credential_ref(credential);
+  data->credential = credential;
+
+  cardano_drep_ref(drep);
+  data->drep = drep;
+
+  data->deposit = deposit;
+
+  *vote_registration_delegation = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_vote_registration_delegation_cert_from_cbor(cardano_cbor_reader_t* reader, cardano_vote_registration_delegation_cert_t** vote_registration_delegation_cert)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vote_registration_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "vote_registration_delegation_cert";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION,
+    (enum_to_string_callback_t)((void*)&cardano_cert_type_to_string),
+    &type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  cardano_drep_t* drep = NULL;
+
+  cardano_error_t read_drep_result = cardano_drep_from_cbor(reader, &drep);
+
+  if (read_drep_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+
+    return read_drep_result;
+  }
+
+  uint64_t deposit = 0U;
+
+  cardano_error_t read_deposit_result = cardano_cbor_reader_read_uint(reader, &deposit);
+
+  if (read_deposit_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+    cardano_drep_unref(&drep);
+
+    return read_deposit_result;
+  }
+
+  cardano_error_t new_result = cardano_vote_registration_delegation_cert_new(credential, deposit, drep, vote_registration_delegation_cert);
+
+  cardano_credential_unref(&credential);
+  cardano_drep_unref(&drep);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_vote_registration_delegation_cert_to_cbor(
+  const cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert,
+  cardano_cbor_writer_t*                             writer)
+{
+  if (vote_registration_delegation_cert == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_type_result = cardano_cbor_writer_write_uint(writer, CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION);
+
+  if (write_type_result != CARDANO_SUCCESS)
+  {
+    return write_type_result;
+  }
+
+  cardano_error_t write_credential_result = cardano_credential_to_cbor(vote_registration_delegation_cert->credential, writer);
+
+  if (write_credential_result != CARDANO_SUCCESS)
+  {
+    return write_credential_result;
+  }
+
+  cardano_error_t write_drep_result = cardano_drep_to_cbor(vote_registration_delegation_cert->drep, writer);
+
+  if (write_drep_result != CARDANO_SUCCESS)
+  {
+    return write_drep_result;
+  }
+
+  cardano_error_t write_deposit_result = cardano_cbor_writer_write_uint(writer, vote_registration_delegation_cert->deposit);
+
+  if (write_deposit_result != CARDANO_SUCCESS)
+  {
+    return write_deposit_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_vote_registration_delegation_cert_to_cip116_json(
+  const cardano_vote_registration_delegation_cert_t* cert,
+  cardano_json_writer_t*                             writer)
+{
+  if ((cert == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "vote_registration_delegation", 28);
+
+  cardano_json_writer_write_property_name(writer, "credential", 10);
+
+  assert(cert->credential != NULL);
+
+  cardano_error_t error = cardano_credential_to_cip116_json(cert->credential, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  assert(cert->drep != NULL);
+  cardano_json_writer_write_property_name(writer, "drep", 4);
+
+  error = cardano_drep_to_cip116_json(cert->drep, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "coin", 4);
+  cardano_json_writer_write_uint_as_string(writer, cert->deposit);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_vote_registration_delegation_cert_get_credential(cardano_vote_registration_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(certificate->credential);
+
+  return certificate->credential;
+}
+
+cardano_error_t
+cardano_vote_registration_delegation_cert_set_credential(cardano_vote_registration_delegation_cert_t* certificate, cardano_credential_t* credential)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&certificate->credential);
+  certificate->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_drep_t*
+cardano_vote_registration_delegation_cert_get_drep(cardano_vote_registration_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_drep_ref(certificate->drep);
+
+  return certificate->drep;
+}
+
+cardano_error_t
+cardano_vote_registration_delegation_cert_set_drep(
+  cardano_vote_registration_delegation_cert_t* certificate,
+  cardano_drep_t*                              drep)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_drep_ref(drep);
+  cardano_drep_unref(&certificate->drep);
+  certificate->drep = drep;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_vote_registration_delegation_cert_get_deposit(
+  const cardano_vote_registration_delegation_cert_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return 0;
+  }
+
+  return certificate->deposit;
+}
+
+cardano_error_t
+cardano_vote_registration_delegation_cert_set_deposit(
+  cardano_vote_registration_delegation_cert_t* certificate,
+  const uint64_t                               deposit)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  certificate->deposit = deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_vote_registration_delegation_cert_unref(cardano_vote_registration_delegation_cert_t** vote_registration_delegation_cert)
+{
+  if ((vote_registration_delegation_cert == NULL) || (*vote_registration_delegation_cert == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*vote_registration_delegation_cert)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *vote_registration_delegation_cert = NULL;
+    return;
+  }
+}
+
+void
+cardano_vote_registration_delegation_cert_ref(cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert)
+{
+  if (vote_registration_delegation_cert == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&vote_registration_delegation_cert->base);
+}
+
+size_t
+cardano_vote_registration_delegation_cert_refcount(const cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert)
+{
+  if (vote_registration_delegation_cert == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&vote_registration_delegation_cert->base);
+}
+
+void
+cardano_vote_registration_delegation_cert_set_last_error(cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert, const char* message)
+{
+  cardano_object_set_last_error(&vote_registration_delegation_cert->base, message);
+}
+
+const char*
+cardano_vote_registration_delegation_cert_get_last_error(const cardano_vote_registration_delegation_cert_t* vote_registration_delegation_cert)
+{
+  return cardano_object_get_last_error(&vote_registration_delegation_cert->base);
+}
+
+cardano_error_t
+cardano_vote_registration_delegation_cert_deep_clone(const cardano_vote_registration_delegation_cert_t* source, cardano_vote_registration_delegation_cert_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_vote_registration_delegation_cert_t* copy = _cardano_malloc(sizeof(cardano_vote_registration_delegation_cert_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->credential         = NULL;
+  copy->drep               = NULL;
+  copy->deposit            = source->deposit;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->drep != NULL)
+  {
+    const cardano_error_t result = cardano_drep_deep_clone(source->drep, &copy->drep);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/collections/array.c b/vendor/src/collections/array.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/collections/array.c
@@ -0,0 +1,667 @@
+/**
+ * \file array.c
+ *
+ * \author luisd.bianchi
+ * \date   Mar 04, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "array.h"
+
+#include <cardano/object.h>
+
+#include "../allocators.h"
+
+#include <assert.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../config.h"
+
+/* STRUCTS *******************************************************************/
+
+/**
+ * \brief Represents a dynamic array of cardano_object_t pointers.
+ *
+ * This structure models a dynamic array that holds pointers to \ref cardano_object_t instances.
+ * It supports operations such as insertion, deletion, and iteration over the contained objects.
+ * The array automatically resizes to accommodate new elements.
+ */
+typedef struct cardano_array_t
+{
+    cardano_object_t   base;
+    cardano_object_t** items;
+    size_t             size;
+    size_t             head;
+    size_t             capacity;
+    size_t             ref_count;
+} cardano_array_t;
+
+/* STATIC FUNCTIONS ***********************************************************/
+
+/**
+ * \brief Grows the array if there is not enough capacity to hold the new item.
+ *
+ * \param array The array to grow.
+ *
+ * \return A \c cardano_error_t indicating the result of the operation: \c CARDANO_SUCCESS on success,
+ *         or an appropriate error code indicating the failure reason. Refer to \c cardano_error_t documentation
+ *         for details on possible error codes.
+ */
+static cardano_error_t
+grow_array_if_needed(cardano_array_t* array)
+{
+  assert(array != NULL);
+
+  if ((array->size + 1U) >= array->capacity)
+  {
+    size_t             new_capacity = (size_t)ceil((float)array->capacity * (float)LIB_CARDANO_C_COLLECTION_GROW_FACTOR);
+    cardano_object_t** new_items    = (cardano_object_t**)_cardano_realloc(array->items, new_capacity * sizeof(cardano_object_t*));
+
+    if (new_items == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    array->items    = new_items;
+    array->capacity = new_capacity;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Deallocates a array object.
+ *
+ * This function is responsible for properly deallocating a array object (`cardano_array_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the array object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_array_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the array
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_array_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_array_t* array = (cardano_array_t*)object;
+
+  for (size_t i = 0; i < array->size; ++i)
+  {
+    cardano_object_unref(&array->items[i]);
+  }
+
+  if (array->items != NULL)
+  {
+    _cardano_free(array->items);
+    array->items = NULL;
+  }
+
+  _cardano_free(array);
+}
+
+/**
+ * \brief Sorts an array of cardano_object_t* pointers using the insertion sort algorithm.
+ *
+ * This function iterates through the array, sequentially placing each element in its correct
+ * position in the sorted portion of the array. The sort is stable and operates in-place,
+ * requiring no additional memory allocation. It is well-suited for small to medium-sized arrays.
+ *
+ * \param array A pointer to the first element of an array of cardano_object_t* pointers that will be sorted.
+ *              The array must be valid and initialized before calling this function.
+ * \param size The number of elements in the array. Must be greater than 0 for the function to perform any action.
+ * \param compare A function pointer to a comparison function that takes two const cardano_object_t* arguments
+ *                (left-hand side and right-hand side) and returns an int. The function should return a value
+ *                less than 0 if the first argument is considered to go before the second, 0 if they are considered
+ *                equivalent, and a value greater than 0 if the first argument is considered to go after the second.
+ *                This comparison function defines the ordering of the elements in the sorted array.
+ *  \param context A pointer to an optional context object that can be passed to the comparison function.
+ */
+static void
+insertion_sort(cardano_object_t** array, const size_t size, const cardano_array_compare_item_t compare, void* context)
+{
+  assert(array != NULL);
+  assert(compare != NULL);
+
+  cardano_object_t* key = NULL;
+
+  for (size_t i = 1u; i < size; ++i)
+  {
+    key      = array[i];
+    size_t j = i;
+
+    while ((j > 0u) && (compare(array[j - 1u], key, context) > 0))
+    {
+      array[j] = array[j - 1u];
+      --j;
+    }
+
+    array[j] = key;
+  }
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_array_t*
+cardano_array_new(const size_t capacity)
+{
+  static const size_t default_capacity = 128U;
+
+  cardano_array_t* array = (cardano_array_t*)_cardano_malloc(sizeof(cardano_array_t));
+
+  if (array == NULL)
+  {
+    return NULL;
+  }
+
+  size_t effective_capacity = capacity;
+
+  if (effective_capacity == 0U)
+  {
+    effective_capacity = default_capacity;
+  }
+
+  array->items = (cardano_object_t**)_cardano_malloc(effective_capacity * sizeof(cardano_object_t*));
+
+  if (array->items == NULL)
+  {
+    _cardano_free(array);
+    return NULL;
+  }
+
+  array->size               = 0;
+  array->head               = 0;
+  array->capacity           = effective_capacity;
+  array->base.ref_count     = 1;
+  array->base.last_error[0] = '\0';
+  array->base.deallocator   = cardano_array_deallocate;
+
+  return array;
+}
+
+cardano_array_t*
+cardano_array_concat(const cardano_array_t* lhs, const cardano_array_t* rhs)
+{
+  if (lhs == NULL)
+  {
+    return NULL;
+  }
+
+  if (rhs == NULL)
+  {
+    return NULL;
+  }
+
+  const size_t lhs_size = lhs->size;
+  const size_t rhs_size = rhs->size;
+
+  cardano_array_t* array = cardano_array_new(lhs_size + rhs_size);
+
+  if (array == NULL)
+  {
+    return NULL;
+  }
+
+  for (size_t i = 0; i < lhs_size; ++i)
+  {
+    cardano_object_t* item = lhs->items[i];
+    cardano_object_ref(item);
+    array->items[i] = item;
+  }
+
+  for (size_t i = 0; i < rhs_size; ++i)
+  {
+    cardano_object_t* item = rhs->items[i];
+    cardano_object_ref(item);
+    array->items[lhs_size + i] = item;
+  }
+
+  array->size = lhs_size + rhs_size;
+
+  return array;
+}
+
+cardano_array_t*
+cardano_array_slice(const cardano_array_t* array, size_t start, size_t end)
+{
+  if (array == NULL)
+  {
+    return NULL;
+  }
+
+  if (start > array->size)
+  {
+    return NULL;
+  }
+
+  if (end > array->size)
+  {
+    return NULL;
+  }
+
+  if (end < start)
+  {
+    return NULL;
+  }
+
+  size_t slice_size = end - start;
+
+  if (slice_size == 0U)
+  {
+    return NULL;
+  }
+
+  cardano_object_t** slice_items = (cardano_object_t**)_cardano_malloc(slice_size * sizeof(cardano_object_t*));
+
+  if (slice_items == NULL)
+  {
+    return NULL;
+  }
+
+  assert(array->items != NULL);
+
+  for (size_t i = 0; i < slice_size; ++i)
+  {
+    cardano_object_t* item = array->items[start + i];
+    cardano_object_ref(item);
+    slice_items[i] = item;
+  }
+
+  cardano_array_t* sliced_array = (cardano_array_t*)_cardano_malloc(sizeof(cardano_array_t));
+
+  if (sliced_array == NULL)
+  {
+    for (size_t i = 0; i < slice_size; ++i)
+    {
+      cardano_object_unref(&slice_items[i]);
+    }
+
+    _cardano_free(slice_items);
+    return NULL;
+  }
+
+  sliced_array->items              = slice_items;
+  sliced_array->size               = slice_size;
+  sliced_array->head               = 0;
+  sliced_array->capacity           = sliced_array->size;
+  sliced_array->base.ref_count     = 1;
+  sliced_array->base.last_error[0] = '\0';
+  sliced_array->base.deallocator   = cardano_array_deallocate;
+
+  return sliced_array;
+}
+
+cardano_array_t*
+cardano_array_erase(
+  cardano_array_t* array,
+  const int64_t    start,
+  const size_t     delete_count)
+{
+  if (array == NULL)
+  {
+    return NULL;
+  }
+
+  size_t  array_size     = array->size;
+  int64_t adjusted_start = start;
+
+  if (adjusted_start < 0)
+  {
+    adjusted_start += (int64_t)array_size;
+  }
+
+  if ((adjusted_start < 0) || ((size_t)adjusted_start >= array_size))
+  {
+    return NULL;
+  }
+
+  size_t adjusted_start_sz     = (size_t)adjusted_start;
+  size_t adjusted_delete_count = delete_count;
+
+  if ((adjusted_start_sz > (SIZE_MAX - adjusted_delete_count)) || ((adjusted_start_sz + adjusted_delete_count) > array_size))
+  {
+    return NULL;
+  }
+
+  if (adjusted_delete_count == 0U)
+  {
+    return cardano_array_new(1);
+  }
+
+  cardano_array_t* deleted_array = cardano_array_new(adjusted_delete_count);
+
+  if (deleted_array == NULL)
+  {
+    return NULL;
+  }
+
+  for (size_t i = 0; i < adjusted_delete_count; ++i)
+  {
+    size_t idx              = adjusted_start_sz + i;
+    deleted_array->items[i] = array->items[idx];
+  }
+
+  deleted_array->size = adjusted_delete_count;
+
+  size_t elements_after_deleted = array_size - (adjusted_start_sz + adjusted_delete_count);
+
+  for (size_t i = 0; i < elements_after_deleted; ++i)
+  {
+    array->items[adjusted_start_sz + i] = array->items[adjusted_start_sz + adjusted_delete_count + i];
+  }
+
+  for (size_t i = array_size - adjusted_delete_count; i < array_size; ++i)
+  {
+    array->items[i] = NULL;
+  }
+
+  array->size -= adjusted_delete_count;
+
+  return deleted_array;
+}
+
+void
+cardano_array_unref(cardano_array_t** array)
+{
+  if ((array == NULL) || (*array == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*array)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *array = NULL;
+    return;
+  }
+}
+
+void
+cardano_array_ref(cardano_array_t* array)
+{
+  if (array == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&array->base);
+}
+
+size_t
+cardano_array_refcount(const cardano_array_t* array)
+{
+  if (array == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&array->base);
+}
+
+cardano_object_t*
+cardano_array_get(const cardano_array_t* array, const size_t index)
+{
+  if (array == NULL)
+  {
+    return NULL;
+  }
+
+  if (index >= array->size)
+  {
+    return NULL;
+  }
+
+  cardano_object_t* item = array->items[index];
+
+  cardano_object_ref(item);
+
+  return item;
+}
+
+size_t
+cardano_array_push(cardano_array_t* array, cardano_object_t* item)
+{
+  if (array == NULL)
+  {
+    return 0U;
+  }
+
+  if (item == NULL)
+  {
+    return array->size;
+  }
+
+  cardano_error_t error = grow_array_if_needed(array);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_array_set_last_error(array, cardano_error_to_string(error));
+    return array->size;
+  }
+
+  cardano_object_ref(item);
+  array->items[array->size] = item;
+  ++array->size;
+
+  return array->size;
+}
+
+cardano_object_t*
+cardano_array_pop(cardano_array_t* array)
+{
+  if (array == NULL)
+  {
+    return NULL;
+  }
+
+  if (array->size == 0U)
+  {
+    return NULL;
+  }
+
+  cardano_object_t* item    = array->items[array->size - 1U];
+  array->items[array->size] = NULL;
+
+  --array->size;
+
+  return item;
+}
+
+size_t
+cardano_array_get_size(const cardano_array_t* array)
+{
+  if (array == NULL)
+  {
+    return 0;
+  }
+
+  return array->size;
+}
+
+size_t
+cardano_array_get_capacity(const cardano_array_t* array)
+{
+  if (array == NULL)
+  {
+    return 0;
+  }
+
+  return array->capacity;
+}
+
+void
+cardano_array_clear(cardano_array_t* array)
+{
+  if (array == NULL)
+  {
+    return;
+  }
+
+  for (size_t i = 0; i < array->size; ++i)
+  {
+    cardano_object_unref(&array->items[i]);
+  }
+
+  array->size = 0;
+}
+
+void
+cardano_array_sort(cardano_array_t* array, cardano_array_compare_item_t compare, void* context)
+{
+  if (array == NULL)
+  {
+    return;
+  }
+
+  if (compare == NULL)
+  {
+    return;
+  }
+
+  insertion_sort(array->items, array->size, compare, context);
+}
+
+cardano_object_t*
+cardano_array_find(const cardano_array_t* array, cardano_array_unary_predicate_t predicate, const void* context)
+{
+  if (array == NULL)
+  {
+    return NULL;
+  }
+
+  if (predicate == NULL)
+  {
+    return NULL;
+  }
+
+  for (size_t i = 0; i < array->size; ++i)
+  {
+    cardano_object_t* item = array->items[i];
+
+    if (predicate(item, context))
+    {
+      cardano_object_ref(item);
+      return item;
+    }
+  }
+
+  return NULL;
+}
+
+cardano_array_t*
+cardano_array_filter(const cardano_array_t* array, cardano_array_unary_predicate_t predicate, const void* context)
+{
+  if (array == NULL)
+  {
+    return NULL;
+  }
+
+  if (predicate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_array_t* filtered_array = cardano_array_new(array->size);
+
+  if (filtered_array == NULL)
+  {
+    return NULL;
+  }
+
+  for (size_t i = 0; i < array->size; ++i)
+  {
+    cardano_object_t* item = array->items[i];
+
+    if (predicate(item, context))
+    {
+      const size_t old_size = cardano_array_get_size(filtered_array);
+      const size_t new_size = cardano_array_push(filtered_array, item);
+
+      if (new_size != (old_size + 1U))
+      {
+        cardano_array_unref(&filtered_array);
+        return NULL;
+      }
+    }
+  }
+
+  return filtered_array;
+}
+
+void
+cardano_array_set_last_error(cardano_array_t* array, const char* message)
+{
+  cardano_object_set_last_error(&array->base, message);
+}
+
+const char*
+cardano_array_get_last_error(const cardano_array_t* array)
+{
+  return cardano_object_get_last_error(&array->base);
+}
+
+cardano_error_t
+cardano_array_deep_clone(const cardano_array_t* source, cardano_array_clone_item_t clone_item, cardano_array_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if ((source == NULL) || (clone_item == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_array_t* copy = cardano_array_new(source->capacity);
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (size_t i = 0U; i < source->size; ++i)
+  {
+    cardano_object_t*     item   = NULL;
+    const cardano_error_t result = clone_item(source->items[i], &item);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&item);
+      cardano_array_unref(&copy);
+      return result;
+    }
+
+    copy->items[i] = item;
+    ++copy->size;
+  }
+
+  copy->head = source->head;
+  *clone     = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/collections/array.h b/vendor/src/collections/array.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/collections/array.h
@@ -0,0 +1,373 @@
+/**
+ * \file array.h
+ *
+ * \author luisd.bianchi
+ * \date   Mar 04, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ARRAY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ARRAY_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/object.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Function pointer type that compares two objects of the same type and returns a value
+ * indicating whether one object is less than, equal to, or greater than the other.
+ *
+ * \param[in] lhs The left-hand side object to compare.
+ * \param[in] rhs The right-hand side object to compare.
+ * \param[in] context An optional context providing additional data or parameters for the compare function.
+ *
+ * \return A negative value if `lhs` is less than `rhs`, 0 if `lhs` is equal to `rhs`, or a positive
+ * value if `lhs` is greater than `rhs`.
+ */
+typedef int (*cardano_array_compare_item_t)(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context);
+
+/**
+ * \brief Defines a function pointer for evaluating whether a specific object meets a defined set of criteria.
+ *
+ * This typedef defines a function pointer type that represents a predicate function. A predicate function
+ * takes an object of type `cardano_object_t` and an optional context as parameters and evaluates whether
+ * the object meets a specific set of criteria.
+ *
+ * \param[in] item The object to be evaluated against the predicate's criteria.
+ * \param[in] context An optional context providing additional data or parameters for the predicate evaluation.
+ *
+ * \return Returns \c true if the `item` satisfies the predicate's conditions, \c false otherwise.
+ */
+typedef bool (*cardano_array_unary_predicate_t)(const cardano_object_t* item, const void* context);
+
+/**
+ * \brief A dynamic, reference-counted array with configurable exponential growth.
+ *
+ * \remarks The array employs an exponential growth strategy, increasing its capacity by a factor of 1.5 by default
+ * when the array becomes full. This default growth factor is based on a
+ * <a href="http://groups.google.com/group/comp.lang.c++.moderated/msg/ba558b4924758e2e">recommendation from Andrew Koenig's</a>
+ * (growth factor should be less than (1+sqrt(5))/2 (~1.6)).
+ *
+ * \note The growth factor of the array can be configured at compilation time using the environment variable `COLLECTION_GROW_FACTOR`
+ **/
+typedef struct cardano_array_t cardano_array_t;
+
+/**
+ * \brief Creates a new dynamic array with the specified initial capacity.
+ *
+ * \param[in] capacity   Initial capacity of the array. If 0 is provided, the array is created with a default
+ * capacity instead, so it can grow when items are pushed to it.
+ *
+ * \return The newly created array or NULL on memory allocation failure.
+ * The caller assumes ownership of the returned array and is responsible for its lifecycle.
+ * It must be dereferenced when no longer in use.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_array_t* cardano_array_new(size_t capacity);
+
+/**
+ * \brief Concatenates two arrays into a new one.
+ *
+ * Creates a new array containing the combined data of the provided arrays. If both arrays are empty, the result is
+ * a new empty array created with a default capacity, so it can grow when items are pushed to it.
+ *
+ * \param[in] lhs   The first array.
+ * \param[in] rhs  The second array.
+ *
+ * \return A new array containing the concatenated data or NULL on memory allocation failure.
+ * The caller assumes ownership of the returned array and must manage its lifecycle,
+ * ensuring it is dereferenced when no longer in use.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_array_t* cardano_array_concat(const cardano_array_t* lhs, const cardano_array_t* rhs);
+
+/**
+ * \brief Slices a array.
+ *
+ * Extracts a portion of the array between the given indices.
+ *
+ * \param[in] array  Source array.
+ * \param[in] start  Start index of the slice (inclusive).
+ * \param[in] end    End index of the slice (exclusive).
+ *
+ * \return A new array containing the slice or NULL for invalid input or memory allocation failure.
+ * The caller assumes ownership of the returned array and must manage its lifecycle,
+ * ensuring it is dereferenced when no longer in use.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_array_t* cardano_array_slice(const cardano_array_t* array, size_t start, size_t end);
+
+/**
+ * \brief Removes elements from the array starting at a given index.
+ *
+ * This function removes `delete_count` elements from `array` starting at index `start`.
+ *
+ * \param[in,out] array The array to modify.
+ * \param[in] start The index at which to start removing elements. Supports negative indices.
+ * \param[in] delete_count The number of elements to remove from the array starting at `start`.
+ *                         If `delete_count` exceeds the number of elements from `start` to the end,
+ *                         it will be adjusted to remove till the end.
+ *
+ * \return A new array containing the removed elements. Returns `NULL` on error.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_array_t* cardano_array_erase(
+  cardano_array_t* array,
+  int64_t          start,
+  size_t           delete_count);
+
+/**
+ * \brief Decrements the array's reference count.
+ *
+ * If the reference count reaches zero, the array memory is deallocated.
+ *
+ * \param[in] array Pointer to the array whose reference count is to be decremented.
+ */
+CARDANO_EXPORT void cardano_array_unref(cardano_array_t** array);
+
+/**
+ * \brief Increments the array's reference count.
+ *
+ * Ensures that the array remains allocated until the last reference is released.
+ *
+ * \param[in] array Array whose reference count is to be incremented.
+ */
+CARDANO_EXPORT void cardano_array_ref(cardano_array_t* array);
+
+/**
+ * \brief Retrieves the array's current reference count.
+ *
+ * \warning Does not account for transitive references.
+ *
+ * \param[in] array Target array.
+ * \return Current reference count of the array.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_array_refcount(const cardano_array_t* array);
+
+/**
+ * \brief Fetches a direct pointer to the array's data.
+ *
+ * \warning This returns a pointer to the internal data, not a copy. Do not manually deallocate.
+ *
+ * \param[in] array Target array.
+ * \param[in] index Index of the data to be fetched.
+ *
+ * \return Pointer to the array's internal data or NULL if the array is empty.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_object_t* cardano_array_get(const cardano_array_t* array, size_t index);
+
+/**
+ * \brief Adds an item to the end of the array.
+ *
+ * This function appends the specified item to the end of the array, increasing the array's size by one.
+ * The item is added by reference, and the internal array's data pointer may change if the array is resized.
+ *
+ * \warning This function increases the reference count of item, caller must free its own reference by calling \ref cardano_array_unref.
+ *
+ * \param[in] array Target array to which the item will be added.
+ * \param[in] item  Pointer to the item to be added to the array.
+ *
+ * \return The new size of the array after the item has been added.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_array_push(cardano_array_t* array, cardano_object_t* item);
+
+/**
+ * \brief Pops an item from the end of a cardano_array_t.
+ *
+ * This function removes the last item from the array and returns it. If the array is empty,
+ * NULL is returned and no operation is performed.
+ *
+ * \param[in] array A pointer to the cardano_array_t from which the item will be popped.
+ *
+ * \return On success, returns a pointer to the popped cardano_object_t item. The caller
+ *         becomes the owner of this object and is responsible for calling the appropriate
+ *         unref function on it. If the array is empty, returns NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_array_t* myArray = cardano_array_new();
+ *
+ * // Assume the array has been populated with items
+ * cardano_object_t* item = cardano_array_pop(myArray);
+ *
+ * if (item != NULL)
+ * {
+ *   // Do something with the item
+ *   cardano_object_unref(item); // Assume cardano_object_unref is the correct unref function
+ * }
+ * cardano_array_unref(&myArray);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_object_t* cardano_array_pop(cardano_array_t* array);
+
+/**
+ * \brief Fetches the current size (used space) of the array.
+ *
+ * \param[in] array Target array.
+ * \return Used space in the array. Returns 0 if array is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_array_get_size(const cardano_array_t* array);
+
+/**
+ * Clears the contents of the specified array.
+ *
+ * This function removes all elements from the array, leaving it empty.
+ *
+ * @param[in,out] array The array to clear.
+ */
+CARDANO_EXPORT void cardano_array_clear(cardano_array_t* array);
+
+/**
+ * Sorts the elements of the array according to the provided comparison function.
+ *
+ * The comparison function should return a negative value if the first argument is less
+ * than the second, zero if they are equal, and a positive value if the first is greater
+ * than the second.
+ *
+ * @param[in,out] array The array to sort.
+ * @param[in] compare The comparison function used to determine the order of the elements.
+ *                    The function must not modify the elements.
+ * @param[in] context An optional context pointer that will be passed to the compare function.
+ */
+CARDANO_EXPORT void cardano_array_sort(cardano_array_t* array, cardano_array_compare_item_t compare, void* context);
+
+/**
+ * Searches for an element in the array that satisfies a predicate.
+ *
+ * Iterates over the array elements and returns the first element for which
+ * the predicate returns true. If no such element is found, returns NULL.
+ *
+ * @param[in] array The array to search in.
+ * @param[in] predicate The unary predicate function used to evaluate each element.
+ *                      The function should return true for the target element
+ *                      and false otherwise.
+ * @param[in] context An optional context pointer that will be passed to the predicate function.
+ * @return A pointer to the first element satisfying the predicate, or NULL if
+ *         no such element is found.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT
+cardano_object_t* cardano_array_find(const cardano_array_t* array, cardano_array_unary_predicate_t predicate, const void* context);
+
+/**
+ * Creates and returns a new array containing only the elements that satisfy the given predicate.
+ *
+ * This function iterates over each element of the input array and applies the predicate function to it.
+ * Elements for which the predicate returns true are included in the new array. The original array remains
+ * unchanged. If the source array is empty, the result is a new empty array created with a default capacity.
+ * The caller is responsible for managing the unreferencing of the returned array to avoid memory leaks.
+ *
+ * @param[in] array The source array to filter.
+ * @param[in] predicate The unary predicate function used to test each element. Elements that
+ *                      satisfy the predicate (i.e., for which the predicate returns true) are
+ *                      included in the new array.
+ * @param[in] context An optional context pointer that will be passed to the predicate function.
+ * @return A new array containing only elements that satisfy the predicate. Returns NULL if
+ *         the operation fails due to memory allocation errors. The caller is responsible for unreferencing
+ *         the returned array.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT
+cardano_array_t* cardano_array_filter(const cardano_array_t* array, cardano_array_unary_predicate_t predicate, const void* context);
+
+/**
+ * \brief Fetches the array's total capacity.
+ *
+ * \param[in] array Target array.
+ * \return Total capacity of the array. Returns 0 if array is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_array_get_capacity(const cardano_array_t* array);
+
+/**
+ * \brief Sets the last error message for a given object.
+ *
+ * This function records an error message in the object's last_error buffer,
+ * overwriting any previous message. The message is truncated if it exceeds
+ * the buffer size. This function is typically used to store descriptive
+ * error information that can be retrieved later with
+ * cardano_array_get_last_error.
+ *
+ * \param[in,out] array A pointer to the \ref cardano_array_t instance whose last error
+ *               message is to be set. If the object is \c NULL, the function
+ *               has no effect.
+ * \param[in] message A null-terminated string containing the error message to be
+ *                recorded. If the message is \c NULL, the object's last_error
+ *                will be set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters due to the fixed size
+ *       of the last_error buffer (1024 characters), including the null
+ *       terminator. Messages longer than this limit will be truncated.
+ */
+CARDANO_EXPORT void cardano_array_set_last_error(cardano_array_t* array, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific object.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_object_set_last_error for the given
+ * object. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in,out] array A pointer to the \ref cardano_array_t instance whose last error
+ *               message is to be retrieved. If the object is \c NULL, the function
+ *               returns a generic error message indicating the null object.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified object. If the object is \c NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_array_set_last_error for the same object, or until
+ *       the object is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_array_get_last_error(const cardano_array_t* array);
+
+/**
+ * \brief Copies one owned array element without retaining its source.
+ */
+typedef cardano_error_t (*cardano_array_clone_item_t)(const cardano_object_t* source, cardano_object_t** clone);
+
+/**
+ * \brief Deep copies an array using the supplied typed element copier.
+ * \param[in] source Array to copy.
+ * \param[in] clone_item Copies one element and returns one owned reference.
+ * \param[out] clone Receives the copy, or NULL on failure.
+ * \return Success or the allocation/element-copy error.
+ */
+cardano_error_t cardano_array_deep_clone(const cardano_array_t* source, cardano_array_clone_item_t clone_item, cardano_array_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ARRAY_H
diff --git a/vendor/src/collections/set.c b/vendor/src/collections/set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/collections/set.c
@@ -0,0 +1,402 @@
+/**
+ * \file set.c
+ *
+ * \author luisd.bianchi
+ * \date   Mar 04, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "set.h"
+
+#include <cardano/export.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t BUCKET_COUNT = 128U;
+
+/* STRUCTS *******************************************************************/
+
+/**
+ * \brief Represents an entry in a Cardano set.
+ *
+ * This structure is a linked list node that contains a pointer to the stored object
+ * and a pointer to the next entry in the bucket.
+ */
+typedef struct cardano_set_entry_t
+{
+    cardano_object_t*           object;
+    struct cardano_set_entry_t* next;
+} cardano_set_entry_t;
+
+/**
+ * \brief Represents a set data structure in the Cardano C library.
+ *
+ * This structure provides a hash set implementation. It stores unique elements in an array of
+ * linked lists (buckets) to manage collisions.
+ */
+typedef struct cardano_set_t
+{
+    cardano_object_t           base;
+    cardano_set_entry_t*       buckets[128];
+    size_t                     size;
+    cardano_set_compare_item_t compare;
+    cardano_set_hash_func_t    hash;
+} cardano_set_t;
+
+/* STATIC FUNCTIONS ***********************************************************/
+
+/**
+ * \brief Deallocates a set object.
+ *
+ * This function is responsible for properly deallocating a set object (`cardano_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_set_deallocate(void* object)
+{
+  cardano_set_t* set = (cardano_set_t*)object;
+  assert(set != NULL);
+
+  for (size_t i = 0U; i < BUCKET_COUNT; ++i)
+  {
+    cardano_set_entry_t* entry = set->buckets[i];
+
+    while (entry != NULL)
+    {
+      cardano_set_entry_t* next = entry->next;
+
+      cardano_object_unref(&(entry->object));
+
+      _cardano_free(entry);
+
+      entry = next;
+    }
+
+    set->buckets[i] = NULL;
+  }
+
+  _cardano_free(set);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_set_t*
+cardano_set_new(cardano_set_compare_item_t compare, cardano_set_hash_func_t hash)
+{
+  cardano_set_t* set = (cardano_set_t*)_cardano_malloc(sizeof(cardano_set_t));
+
+  if (set == NULL)
+  {
+    return NULL;
+  }
+
+  CARDANO_UNUSED(memset(set->buckets, 0, sizeof(set->buckets)));
+
+  set->size               = 0;
+  set->compare            = compare;
+  set->hash               = hash;
+  set->base.ref_count     = 1;
+  set->base.last_error[0] = '\0';
+  set->base.deallocator   = cardano_set_deallocate;
+
+  return set;
+}
+
+cardano_set_t*
+cardano_set_from_array(cardano_array_t* array, cardano_set_compare_item_t compare, cardano_set_hash_func_t hash)
+{
+  if ((array == NULL) || (compare == NULL) || (hash == NULL))
+  {
+    return NULL;
+  }
+
+  cardano_set_t* set = cardano_set_new(compare, hash);
+
+  if (set == NULL)
+  {
+    return NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(array); ++i)
+  {
+    cardano_object_t* item = cardano_array_get(array, i);
+
+    assert(item != NULL);
+
+    if (cardano_set_add(set, item) == 0U)
+    {
+      cardano_set_unref(&set);
+      cardano_object_unref(&item);
+      return NULL;
+    }
+
+    cardano_object_unref(&item);
+  }
+
+  return set;
+}
+
+void
+cardano_set_unref(cardano_set_t** set)
+{
+  if ((set == NULL) || (*set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *set = NULL;
+    return;
+  }
+}
+
+void
+cardano_set_ref(cardano_set_t* set)
+{
+  if (set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&set->base);
+}
+
+size_t
+cardano_set_refcount(const cardano_set_t* set)
+{
+  if (set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&set->base);
+}
+
+size_t
+cardano_set_add(cardano_set_t* set, cardano_object_t* item)
+{
+  if ((set == NULL) || (item == NULL))
+  {
+    return 0;
+  }
+
+  size_t index = set->hash(item) % BUCKET_COUNT;
+
+  cardano_set_entry_t** entry = &(set->buckets[index]);
+
+  while (*entry != NULL)
+  {
+    if (set->compare((*entry)->object, item) == 0)
+    {
+      return set->size;
+    }
+
+    entry = &((*entry)->next);
+  }
+
+  *entry = (cardano_set_entry_t*)_cardano_malloc(sizeof(cardano_set_entry_t));
+
+  if (*entry == NULL)
+  {
+    return 0;
+  }
+
+  cardano_object_ref(item);
+  (*entry)->object = item;
+  (*entry)->next   = NULL;
+
+  ++set->size;
+
+  return set->size;
+}
+
+bool
+cardano_set_has(cardano_set_t* set, cardano_object_t* item)
+{
+  if ((set == NULL) || (item == NULL))
+  {
+    return false;
+  }
+
+  size_t index = set->hash(item) % BUCKET_COUNT;
+
+  for (cardano_set_entry_t* entry = set->buckets[index]; entry != NULL; entry = entry->next)
+  {
+    if (set->compare(entry->object, item) == 0)
+    {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool
+cardano_set_delete(cardano_set_t* set, cardano_object_t* item)
+{
+  if ((set == NULL) || (item == NULL))
+  {
+    return false;
+  }
+
+  size_t                index = set->hash(item) % BUCKET_COUNT;
+  cardano_set_entry_t** entry = &(set->buckets[index]);
+
+  while (*entry != NULL)
+  {
+    if (set->compare((*entry)->object, item) == 0)
+    {
+      cardano_set_entry_t* toDelete = *entry;
+      *entry                        = (*entry)->next;
+
+      cardano_object_unref(&(toDelete->object));
+      _cardano_free(toDelete);
+
+      --set->size;
+
+      return true;
+    }
+
+    entry = &((*entry)->next);
+  }
+
+  return false;
+}
+
+cardano_array_t*
+cardano_get_entries(cardano_set_t* set)
+{
+  if (set == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_array_t* array = cardano_array_new(set->size);
+
+  if (array == NULL)
+  {
+    return NULL;
+  }
+
+  for (size_t i = 0; i < BUCKET_COUNT; ++i)
+  {
+    for (cardano_set_entry_t* entry = set->buckets[i]; entry != NULL; entry = entry->next)
+    {
+      const size_t old_size = cardano_array_get_size(array);
+      const size_t new_size = cardano_array_push(array, entry->object);
+
+      if (new_size != (old_size + 1U))
+      {
+        cardano_array_unref(&array);
+        return NULL;
+      }
+    }
+  }
+
+  return array;
+}
+
+size_t
+cardano_set_get_size(const cardano_set_t* set)
+{
+  if (set == NULL)
+  {
+    return 0;
+  }
+
+  return set->size;
+}
+
+void
+cardano_set_clear(cardano_set_t* set)
+{
+  if (set == NULL)
+  {
+    return;
+  }
+
+  for (size_t i = 0; i < BUCKET_COUNT; ++i)
+  {
+    cardano_set_entry_t* entry = set->buckets[i];
+
+    while (entry != NULL)
+    {
+      cardano_set_entry_t* next = entry->next;
+      cardano_object_unref(&entry->object); // Assuming this is the correct function name.
+      _cardano_free(entry);
+      entry = next;
+    }
+
+    set->buckets[i] = NULL;
+  }
+
+  set->size = 0;
+}
+
+cardano_object_t*
+cardano_set_find(const cardano_set_t* set, cardano_set_unary_predicate_t predicate, const void* context)
+{
+  if ((set == NULL) || (predicate == NULL))
+  {
+    return NULL;
+  }
+
+  for (size_t i = 0; i < BUCKET_COUNT; ++i)
+  {
+    for (cardano_set_entry_t* entry = set->buckets[i]; entry != NULL; entry = entry->next)
+    {
+      if (predicate(entry->object, context))
+      {
+        cardano_object_ref(entry->object);
+        return entry->object;
+      }
+    }
+  }
+
+  return NULL;
+}
+
+void
+cardano_set_set_last_error(cardano_set_t* set, const char* message)
+{
+  cardano_object_set_last_error(&set->base, message);
+}
+
+const char*
+cardano_set_get_last_error(const cardano_set_t* set)
+{
+  return cardano_object_get_last_error(&set->base);
+}
diff --git a/vendor/src/collections/set.h b/vendor/src/collections/set.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/collections/set.h
@@ -0,0 +1,301 @@
+/**
+ * \file set.h
+ *
+ * \author luisd.bianchi
+ * \date   Mar 04, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/object.h>
+#include <cardano/typedefs.h>
+
+#include "array.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A function pointer type for hashing objects within a set.
+ *
+ * This callback function is designed to generate a hash value based on the content or
+ * the identity of a `cardano_object_t` object. The function must return a 64-bit unsigned
+ * integer representing the hash value. The quality of the hash function directly impacts
+ * the performance of the set, particularly in terms of collision frequency and distribution
+ * uniformity.
+ *
+ * Implementations of this function should aim to produce unique hash values for distinct
+ * objects as much as possible. However, it's understood that hash collisions—different
+ * objects producing the same hash value—might occur. The set implementation handles
+ * these collisions gracefully.
+ *
+ * \param[in] object A pointer to the `cardano_object_t` object to be hashed.
+ *
+ * \return A 64-bit unsigned integer representing the hash value of the object.
+ *
+ * \note The implementer must ensure that the function is deterministic—calling the hash
+ *       function with the same object should always return the same hash value.
+ */
+typedef uint64_t (*cardano_set_hash_func_t)(const cardano_object_t* object);
+
+/**
+ * \brief Function pointer type that compares two objects of the same type and returns a value
+ * indicating whether one object is less than, equal to, or greater than the other.
+ *
+ * \param[in] lhs The left-hand side object to compare.
+ * \param[in] rhs The right-hand side object to compare.
+ *
+ * \return A negative value if `lhs` is less than `rhs`, 0 if `lhs` is equal to `rhs`, or a positive
+ * value if `lhs` is greater than `rhs`.
+ */
+typedef int (*cardano_set_compare_item_t)(const cardano_object_t* lhs, const cardano_object_t* rhs);
+
+/**
+ * \brief Defines a function pointer for a predicate to assess if an object in a set meets specific criteria.
+ *
+ * This typedef specifies a function pointer type for a predicate function designed to evaluate objects
+ * within a set. The predicate function receives an object and an optional context, assessing whether the
+ * object satisfies a predefined condition.
+ *
+ * \param[in] item The object being evaluated against the set criteria.
+ * \param[in] context An optional parameter providing additional data for the predicate's evaluation.
+ *
+ * \return Returns \c true if the `item` conforms to the criteria defined within the predicate function;
+ * \c false otherwise.
+ */
+typedef bool (*cardano_set_unary_predicate_t)(const cardano_object_t* item, const void* context);
+
+/**
+ * \brief A dynamic, reference-counted set.
+ **/
+typedef struct cardano_set_t cardano_set_t;
+
+/**
+ * \brief Creates a new dynamic set with the specified initial capacity.
+ *
+ * \return The newly created set or NULL on memory allocation failure.
+ * The caller assumes ownership of the returned set and is responsible for its lifecycle.
+ * It must be dereferenced when no longer in use.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_set_t* cardano_set_new(cardano_set_compare_item_t compare, cardano_set_hash_func_t hash);
+
+/**
+ * \brief Creates a new set from an existing array.
+ *
+ * This function constructs a new set containing all unique elements from the given array.
+ *
+ * \param[in] array The source array from which to create the set. The function expects
+ *                  a valid pointer to an initialized `cardano_array_t` instance. The caller
+ *                  retains ownership of this array and must ensure it is properly deallocated
+ *                  using `cardano_array_unref`.
+ * \param[in] compare The comparison function used to determine the equality of two elements.
+ *                    Elements are considered equal if the comparison function returns 0.
+ *
+ * \param[in] hash The hash function used to compute the hash value of each element for
+ *                 placement within the set.
+ *
+ * \return A pointer to the newly created `cardano_set_t` instance if the operation is
+ *         successful. Returns `NULL` if the set cannot be created due to invalid input
+ *         parameters or memory allocation failure. The caller is responsible for calling
+ *         `cardano_set_unref` on the returned set to ensure proper deallocation.
+ *
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_set_t* cardano_set_from_array(cardano_array_t* array, cardano_set_compare_item_t compare, cardano_set_hash_func_t hash);
+
+/**
+ * \brief Decrements the set's reference count.
+ *
+ * If the reference count reaches zero, the set memory is deallocated.
+ *
+ * \param[in] set Pointer to the set whose reference count is to be decremented.
+ */
+CARDANO_EXPORT void cardano_set_unref(cardano_set_t** set);
+
+/**
+ * \brief Increments the set's reference count.
+ *
+ * Ensures that the set remains allocated until the last reference is released.
+ *
+ * \param[in] set Set whose reference count is to be incremented.
+ */
+CARDANO_EXPORT void cardano_set_ref(cardano_set_t* set);
+
+/**
+ * \brief Retrieves the set's current reference count.
+ *
+ * \warning Does not account for transitive references.
+ *
+ * \param[in] set Target set.
+ * \return Current reference count of the set.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_set_refcount(const cardano_set_t* set);
+
+/**
+ * \brief Fetches a direct pointer to the set's data.
+ *
+ * \warning This returns a pointer to the internal data, not a copy. Do not manually deallocate.
+ *
+ * \param[in] set Target set.
+ * \param[in] item Pointer to the data to be added.
+ *
+ * \return The new size of the set.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_set_add(cardano_set_t* set, cardano_object_t* item);
+
+/**
+ * \brief Checks if the specified item exists in the set.
+ *
+ * This function searches the set for the given item and determines whether it is present.
+ * It uses the set's hash function to compute the item's hash value and then performs an
+ * equality check to find an exact match within the set.
+ *
+ * \param[in] set A pointer to the set in which to search for the item.
+ * \param[in] item A pointer to the object being searched for in the set.
+ * \return Returns `true` if the item is found in the set, otherwise returns `false`.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_set_has(cardano_set_t* set, cardano_object_t* item);
+
+/**
+ * \brief Removes a specified item from the set.
+ *
+ * This function attempts to find and remove the specified item from the set.
+ * If the item is found, it is removed. The function uses the set's hash function
+ * for efficient location of the item.
+ *
+ * \param[in] set A pointer to the set from which to remove the item.
+ * \param[in] item A pointer to the object to be removed from the set.
+ * \return Returns `true` if the item was successfully removed, otherwise returns `false`
+ *         if the item was not found in the set.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT bool cardano_set_delete(cardano_set_t* set, cardano_object_t* item);
+
+/**
+ * \brief Retrieves an array containing all the entries in the set.
+ *
+ * This function creates a new cardano_array_t and populates it with all the objects
+ * currently held in the set.
+ *
+ * \param[in] set A pointer to the set from which to retrieve the entries.
+ * \return A pointer to a `cardano_array_t` containing all set entries or NULL if the operation
+ *         fails due to memory allocation errors.
+ *
+ * \note The order of the entries in the returned array is not specified and may vary.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_array_t* cardano_get_entries(cardano_set_t* set);
+
+/**
+ * \brief Fetches the current size (used space) of the set.
+ *
+ * \param[in] set Target set.
+ * \return Used space in the set. Returns 0 if set is NULL.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_set_get_size(const cardano_set_t* set);
+
+/**
+ * Clears the contents of the specified set.
+ *
+ * This function removes all elements from the set, leaving it empty.
+ *
+ * \param[in,out] set The set to clear.
+ */
+CARDANO_EXPORT void cardano_set_clear(cardano_set_t* set);
+
+/**
+ * Searches for an element in the array that satisfies a predicate.
+ *
+ * Iterates over the array elements and returns the first element for which
+ * the predicate returns true. If no such element is found, returns NULL.
+ *
+ * @param[in] array The array to search in.
+ * @param[in] predicate The unary predicate function used to evaluate each element.
+ *                      The function should return true for the target element
+ *                      and false otherwise.
+ * @param[in] context An optional context pointer that will be passed to the predicate function.
+ * @return A pointer to the first element satisfying the predicate, or NULL if
+ *         no such element is found.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT
+cardano_object_t* cardano_set_find(const cardano_set_t* array, cardano_set_unary_predicate_t predicate, const void* context);
+
+/**
+ * \brief Sets the last error message for a given object.
+ *
+ * This function records an error message in the object's last_error buffer,
+ * overwriting any previous message. The message is truncated if it exceeds
+ * the buffer size. This function is typically used to store descriptive
+ * error information that can be retrieved later with
+ * cardano_set_get_last_error.
+ *
+ * \param[in,out] set A pointer to the \ref cardano_set_t instance whose last error
+ *               message is to be set. If the object is \c NULL, the function
+ *               has no effect.
+ * \param[in] message A null-terminated string containing the error message to be
+ *                recorded. If the message is \c NULL, the object's last_error
+ *                will be set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters due to the fixed size
+ *       of the last_error buffer (1024 characters), including the null
+ *       terminator. Messages longer than this limit will be truncated.
+ */
+CARDANO_EXPORT void cardano_set_set_last_error(cardano_set_t* set, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific object.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_set_set_last_error for the given
+ * object. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in,out] set A pointer to the \ref cardano_set_t instance whose last error
+ *               message is to be retrieved. If the object is \c NULL, the function
+ *               returns a generic error message indicating the null object.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified object. If the object is \c NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_set_set_last_error for the same object, or until
+ *       the object is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_set_get_last_error(const cardano_set_t* set);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SET_H
diff --git a/vendor/src/common/anchor.c b/vendor/src/common/anchor.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/anchor.c
@@ -0,0 +1,604 @@
+/**
+ * \file anchor.c
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/anchor.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t ANCHOR_EMBEDDED_GROUP_SIZE = 2;
+static const int64_t ANCHOR_MAX_URL_LENGTH      = 128;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano anchor.
+ */
+typedef struct cardano_anchor_t
+{
+    cardano_object_t base;
+    byte_t           hash_bytes[32];
+    char             hash_hex[65];
+    char             url[129];
+} cardano_anchor_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a anchor object.
+ *
+ * This function is responsible for properly deallocating a anchor object (`cardano_anchor_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the anchor object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_anchor_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the anchor
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_anchor_deallocate(void* object)
+{
+  assert(object != NULL);
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_anchor_new(
+  const char*                   url,
+  const size_t                  url_size,
+  const cardano_blake2b_hash_t* hash,
+  cardano_anchor_t**            anchor)
+{
+  if (url == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((url_size == 0U) || (url_size > (size_t)ANCHOR_MAX_URL_LENGTH))
+  {
+    return CARDANO_ERROR_INVALID_URL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    *anchor = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *anchor = _cardano_malloc(sizeof(cardano_anchor_t));
+
+  if (*anchor == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*anchor)->base.deallocator   = cardano_anchor_deallocate;
+  (*anchor)->base.ref_count     = 1;
+  (*anchor)->base.last_error[0] = '\0';
+
+  CARDANO_UNUSED(memset((*anchor)->hash_bytes, 0, sizeof((*anchor)->hash_bytes)));
+  CARDANO_UNUSED(memset((*anchor)->hash_hex, 0, sizeof((*anchor)->hash_hex)));
+  CARDANO_UNUSED(memset((*anchor)->url, 0, sizeof((*anchor)->url)));
+
+  const size_t hash_size = cardano_blake2b_hash_get_bytes_size(hash);
+
+  if (hash_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_256)
+  {
+    cardano_anchor_unref(anchor);
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_error_t copy_hash_result = cardano_blake2b_hash_to_bytes(hash, (*anchor)->hash_bytes, sizeof((*anchor)->hash_bytes));
+
+  assert(copy_hash_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hash_result);
+
+  cardano_error_t copy_hex_result = cardano_blake2b_hash_to_hex(hash, (*anchor)->hash_hex, sizeof((*anchor)->hash_hex));
+
+  assert(copy_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hex_result);
+
+  assert(url_size <= (size_t)ANCHOR_MAX_URL_LENGTH);
+  CARDANO_UNUSED(memset((*anchor)->url, 0, sizeof((*anchor)->url)));
+  cardano_safe_memcpy((*anchor)->url, ANCHOR_MAX_URL_LENGTH, url, url_size);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_anchor_from_hash_hex(
+  const char*        url,
+  const size_t       url_size,
+  const char*        hex,
+  size_t             hex_size,
+  cardano_anchor_t** anchor)
+{
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex == NULL)
+  {
+    *anchor = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex_size != ((size_t)CARDANO_BLAKE2B_HASH_SIZE_256 * 2U))
+  {
+    *anchor = NULL;
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = cardano_blake2b_hash_from_hex(hex, hex_size, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    *anchor = NULL;
+    return read_hash_result;
+  }
+
+  cardano_error_t new_anchor_result = cardano_anchor_new(url, url_size, hash, anchor);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_anchor_result != CARDANO_SUCCESS)
+  {
+    *anchor = NULL;
+    return new_anchor_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_anchor_from_hash_bytes(
+  const char*        url,
+  const size_t       url_size,
+  const byte_t*      data,
+  size_t             data_size,
+  cardano_anchor_t** anchor)
+{
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    *anchor = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_256)
+  {
+    *anchor = NULL;
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = cardano_blake2b_hash_from_bytes(data, data_size, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    *anchor = NULL;
+    return read_hash_result;
+  }
+
+  cardano_error_t new_anchor_result = cardano_anchor_new(url, url_size, hash, anchor);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_anchor_result != CARDANO_SUCCESS)
+  {
+    *anchor = NULL;
+    return new_anchor_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_anchor_from_cbor(cardano_cbor_reader_t* reader, cardano_anchor_t** anchor)
+{
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *anchor = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "anchor";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)ANCHOR_EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *anchor = NULL;
+    return expect_array_result;
+  }
+
+  char                  url[129]         = { 0 };
+  const cardano_error_t read_uint_result = cardano_cbor_validate_text_string_of_max_size(
+    validator_name,
+    reader,
+    url,
+    (uint32_t)sizeof(url));
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    *anchor = NULL;
+    return read_uint_result;
+  }
+
+  cardano_buffer_t*     byte_string             = NULL;
+  const cardano_error_t read_byte_string_result = cardano_cbor_validate_byte_string_of_size(
+    validator_name,
+    reader,
+    &byte_string,
+    CARDANO_BLAKE2B_HASH_SIZE_256);
+
+  if (read_byte_string_result != CARDANO_SUCCESS)
+  {
+    *anchor = NULL;
+    return read_byte_string_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&byte_string);
+    *anchor = NULL;
+
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t new_anchor_result = cardano_anchor_from_hash_bytes(
+    url,
+    cardano_safe_strlen(url, ANCHOR_MAX_URL_LENGTH),
+    cardano_buffer_get_data(byte_string),
+    cardano_buffer_get_size(byte_string),
+    anchor);
+
+  cardano_buffer_unref(&byte_string);
+
+  if (new_anchor_result != CARDANO_SUCCESS)
+  {
+    *anchor = NULL;
+    return new_anchor_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_anchor_to_cbor(
+  const cardano_anchor_t* anchor,
+  cardano_cbor_writer_t*  writer)
+{
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(writer, ANCHOR_EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_url_result = cardano_cbor_writer_write_textstring(writer, anchor->url, cardano_safe_strlen(anchor->url, sizeof(anchor->url)));
+
+  if (write_url_result != CARDANO_SUCCESS)
+  {
+    return write_url_result;
+  }
+
+  cardano_error_t write_bytes_result = cardano_cbor_writer_write_bytestring(writer, anchor->hash_bytes, sizeof(anchor->hash_bytes));
+
+  if (write_bytes_result != CARDANO_SUCCESS)
+  {
+    return write_bytes_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_anchor_to_cip116_json(
+  const cardano_anchor_t* anchor,
+  cardano_json_writer_t*  writer)
+{
+  if ((anchor == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "url", 3);
+  cardano_json_writer_write_string(writer, anchor->url, cardano_safe_strlen(anchor->url, sizeof(anchor->url)));
+
+  cardano_json_writer_write_property_name(writer, "data_hash", 9);
+  cardano_json_writer_write_string(writer, anchor->hash_hex, cardano_safe_strlen(anchor->hash_hex, sizeof(anchor->hash_hex)));
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_anchor_get_hash(const cardano_anchor_t* anchor)
+{
+  if (anchor == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = cardano_blake2b_hash_from_bytes(anchor->hash_bytes, sizeof(anchor->hash_bytes), &hash);
+
+  assert(read_hash_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(read_hash_result);
+
+  return hash;
+}
+
+size_t
+cardano_anchor_get_hash_bytes_size(const cardano_anchor_t* anchor)
+{
+  if (anchor == NULL)
+  {
+    return 0;
+  }
+
+  return sizeof(anchor->hash_bytes);
+}
+
+const byte_t*
+cardano_anchor_get_hash_bytes(const cardano_anchor_t* anchor)
+{
+  if (anchor == NULL)
+  {
+    return NULL;
+  }
+
+  return anchor->hash_bytes;
+}
+
+size_t
+cardano_anchor_get_hash_hex_size(const cardano_anchor_t* anchor)
+{
+  if (anchor == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_safe_strlen(anchor->hash_hex, sizeof(anchor->hash_hex)) + 1U;
+}
+
+const char*
+cardano_anchor_get_hash_hex(const cardano_anchor_t* anchor)
+{
+  if (anchor == NULL)
+  {
+    return NULL;
+  }
+
+  return anchor->hash_hex;
+}
+
+size_t
+cardano_anchor_get_url_size(const cardano_anchor_t* anchor)
+{
+  if (anchor == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_safe_strlen(anchor->url, sizeof(anchor->url)) + 1U;
+}
+
+const char*
+cardano_anchor_get_url(const cardano_anchor_t* anchor)
+{
+  if (anchor == NULL)
+  {
+    return NULL;
+  }
+
+  return anchor->url;
+}
+
+cardano_error_t
+cardano_anchor_set_url(cardano_anchor_t* anchor, const char* url, const size_t url_size)
+{
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (url == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((url_size == 0U) || (url_size > (size_t)ANCHOR_MAX_URL_LENGTH))
+  {
+    return CARDANO_ERROR_INVALID_URL;
+  }
+
+  assert(url_size <= (size_t)ANCHOR_MAX_URL_LENGTH);
+  CARDANO_UNUSED(memset(anchor->url, 0, sizeof(anchor->url)));
+  cardano_safe_memcpy(anchor->url, ANCHOR_MAX_URL_LENGTH, url, url_size);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_anchor_set_hash(cardano_anchor_t* anchor, const cardano_blake2b_hash_t* hash)
+{
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t hash_size = cardano_blake2b_hash_get_bytes_size(hash);
+
+  if (hash_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_256)
+  {
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_error_t copy_hash_result = cardano_blake2b_hash_to_bytes(hash, &anchor->hash_bytes[0], sizeof(anchor->hash_bytes));
+
+  assert(copy_hash_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hash_result);
+
+  cardano_error_t copy_hex_result = cardano_blake2b_hash_to_hex(hash, anchor->hash_hex, sizeof(anchor->hash_hex));
+
+  assert(copy_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hex_result);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_anchor_unref(cardano_anchor_t** anchor)
+{
+  if ((anchor == NULL) || (*anchor == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*anchor)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *anchor = NULL;
+    return;
+  }
+}
+
+void
+cardano_anchor_ref(cardano_anchor_t* anchor)
+{
+  if (anchor == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&anchor->base);
+}
+
+size_t
+cardano_anchor_refcount(const cardano_anchor_t* anchor)
+{
+  if (anchor == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&anchor->base);
+}
+
+void
+cardano_anchor_set_last_error(cardano_anchor_t* anchor, const char* message)
+{
+  cardano_object_set_last_error(&anchor->base, message);
+}
+
+const char*
+cardano_anchor_get_last_error(const cardano_anchor_t* anchor)
+{
+  return cardano_object_get_last_error(&anchor->base);
+}
+
+cardano_error_t
+cardano_anchor_deep_clone(const cardano_anchor_t* source, cardano_anchor_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_t* copy = _cardano_malloc(sizeof(cardano_anchor_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  CARDANO_UNUSED(memcpy(copy->hash_bytes, source->hash_bytes, sizeof(copy->hash_bytes)));
+  CARDANO_UNUSED(memcpy(copy->hash_hex, source->hash_hex, sizeof(copy->hash_hex)));
+  CARDANO_UNUSED(memcpy(copy->url, source->url, sizeof(copy->url)));
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/bigint.c b/vendor/src/common/bigint.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/bigint.c
@@ -0,0 +1,987 @@
+/**
+ * \file bigint.c
+ *
+ * \author luisd.bianchi
+ * \date   Jun 05, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/common/bigint.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+
+#include "../external/gmp/mini-gmp.h"
+
+#include "../endian.h"
+#include <assert.h>
+
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a large numeric value.
+ *
+ * The \ref cardano_bigint_t type is used for representing numeric values that are too large to be
+ * represented by the standard numeric primitive types, such as int64_t or uint64_t.
+ */
+typedef struct cardano_bigint_t
+{
+    cardano_object_t base;
+    mpz_t            mpz;
+} cardano_bigint_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a bigint object.
+ *
+ * This function is responsible for properly deallocating a bigint object (`cardano_bigint_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the bigint object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_bigint_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the bigint
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_bigint_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_bigint_t* bigint = (cardano_bigint_t*)object;
+
+  mpz_clear(bigint->mpz);
+
+  _cardano_free(bigint);
+}
+
+/**
+ * \brief Creates a new bigint object.
+ *
+ * \return A pointer to the newly created bigint object, or `NULL` if the operation failed.
+ */
+static cardano_bigint_t*
+cardano_bigint_new(void)
+{
+  cardano_bigint_t* data = _cardano_malloc(sizeof(cardano_bigint_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_bigint_deallocate;
+
+  mpz_init(data->mpz);
+
+  return data;
+}
+
+/**
+ * \brief Exports the low 64 bits of the magnitude of a GMP integer.
+ *
+ * \param[in] value The GMP integer to export.
+ *
+ * \return The magnitude of \p value reduced modulo 2^64.
+ */
+static uint64_t
+export_low_magnitude(const mpz_t value)
+{
+  const int order  = cardano_is_little_endian() ? -1 : 1;
+  uint64_t  result = 0;
+  mpz_t     low;
+
+  mpz_init(low);
+  mpz_tdiv_r_2exp(low, value, 64U);
+  mpz_export(&result, NULL, order, sizeof(result), 0, 0, low);
+  mpz_clear(low);
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_bigint_clone(const cardano_bigint_t* bigint, cardano_bigint_t** clone)
+{
+  if ((bigint == NULL) || (clone == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = cardano_bigint_new();
+
+  if (*clone == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  mpz_init_set((*clone)->mpz, bigint->mpz);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bigint_from_string(const char* string, const size_t size, const int32_t base, cardano_bigint_t** bigint)
+{
+  if ((string == NULL) || (bigint == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((size == 0U) || (*string == '\0'))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *bigint = cardano_bigint_new();
+
+  if (*bigint == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const size_t length = cardano_safe_strlen(string, size);
+
+  if (length == SIZE_MAX)
+  {
+    cardano_bigint_unref(bigint);
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  char* terminated = _cardano_malloc(length + 1U);
+
+  if (terminated == NULL)
+  {
+    cardano_bigint_unref(bigint);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_safe_memcpy(terminated, length + 1U, string, length);
+  terminated[length] = '\0';
+
+  // cppcheck-suppress misra-c2012-11.8; Reason: False positive.
+  const int ret = mpz_set_str((*bigint)->mpz, terminated, base);
+
+  _cardano_free(terminated);
+
+  if (ret != 0)
+  {
+    cardano_bigint_unref(bigint);
+
+    return CARDANO_ERROR_CONVERSION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_bigint_get_string_size(const cardano_bigint_t* bigint, const int32_t base)
+{
+  if (bigint == NULL)
+  {
+    return 0U;
+  }
+
+  char* temp = mpz_get_str(NULL, base, bigint->mpz);
+
+  if (temp == NULL)
+  {
+    return 0;
+  }
+
+  const size_t num_digits = mpz_sizeinbase(bigint->mpz, base);
+  const size_t max_size   = num_digits + 1U + 1U;
+
+  const size_t digits = cardano_safe_strlen(temp, max_size);
+
+  _cardano_free(temp);
+
+  return digits + 1U;
+}
+
+cardano_error_t
+cardano_bigint_from_int(int64_t value, cardano_bigint_t** bigint)
+{
+  if (bigint == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *bigint = cardano_bigint_new();
+
+  if (*bigint == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  mpz_init((*bigint)->mpz);
+
+  int      order     = cardano_is_little_endian() ? -1 : 1;
+  uint64_t abs_value = (value < 0) ? ((uint64_t)(-(value + 1)) + 1U) : (uint64_t)value;
+
+  mpz_import((*bigint)->mpz, 1, order, sizeof(abs_value), 0, 0, &abs_value);
+
+  if (value < 0)
+  {
+    mpz_neg((*bigint)->mpz, (*bigint)->mpz);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bigint_from_unsigned_int(uint64_t value, cardano_bigint_t** bigint)
+{
+  if (bigint == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *bigint = cardano_bigint_new();
+
+  if (*bigint == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  mpz_init((*bigint)->mpz);
+
+  int order = cardano_is_little_endian() ? -1 : 1;
+
+  mpz_import((*bigint)->mpz, 1, order, sizeof(value), 0, 0, &value);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bigint_from_bytes(
+  const byte_t*              data,
+  const size_t               size,
+  const cardano_byte_order_t byte_order,
+  cardano_bigint_t**         bigint)
+{
+  if ((data == NULL) || (bigint == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *bigint = cardano_bigint_new();
+
+  if (*bigint == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  int32_t       order         = 1;
+  const int32_t size_per_word = 1;
+  const int32_t nails         = 0;
+
+  if (byte_order == CARDANO_BYTE_ORDER_LITTLE_ENDIAN)
+  {
+    order = -1;
+  }
+
+  mpz_import((*bigint)->mpz, size, order, size_per_word, 0, nails, data);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bigint_to_string(
+  const cardano_bigint_t* bigint,
+  char*                   string,
+  const size_t            size,
+  const int32_t           base)
+{
+  if ((bigint == NULL) || (string == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  char* temp = mpz_get_str(NULL, base, bigint->mpz);
+
+  if (temp == NULL)
+  {
+    return CARDANO_ERROR_CONVERSION_FAILED;
+  }
+
+  size_t temp_len = cardano_safe_strlen(temp, size);
+
+  if ((temp_len + 1U) > size)
+  {
+    _cardano_free(temp);
+
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  cardano_safe_memcpy(string, size, temp, temp_len);
+  string[size - 1U] = '\0';
+
+  _cardano_free(temp);
+
+  return CARDANO_SUCCESS;
+}
+
+int64_t
+cardano_bigint_to_int(const cardano_bigint_t* bigint)
+{
+  if (bigint == NULL)
+  {
+    return 0;
+  }
+
+  const uint64_t abs_result = export_low_magnitude(bigint->mpz);
+
+  const uint64_t bits = ((mpz_sgn(bigint->mpz) < 0) && (abs_result != 0U)) ? UINT64_MAX - (abs_result - 1U) : abs_result;
+
+  if (bits <= (uint64_t)INT64_MAX)
+  {
+    return (int64_t)bits;
+  }
+
+  const uint64_t complement = UINT64_MAX - bits;
+
+  return -1 - (int64_t)complement;
+}
+
+uint64_t
+cardano_bigint_to_unsigned_int(const cardano_bigint_t* bigint)
+{
+  if (bigint == NULL)
+  {
+    return 0;
+  }
+
+  return export_low_magnitude(bigint->mpz);
+}
+
+size_t
+cardano_bigint_get_bytes_size(const cardano_bigint_t* bigint)
+{
+  return (mpz_sizeinbase(bigint->mpz, 2) + 7U) / 8U;
+}
+
+cardano_error_t
+cardano_bigint_to_bytes(
+  const cardano_bigint_t* bigint,
+  cardano_byte_order_t    byte_order,
+  byte_t*                 data,
+  size_t                  size)
+{
+  if ((bigint == NULL) || (data == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t required_size = cardano_bigint_get_bytes_size(bigint);
+
+  if (required_size != size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (mpz_sgn(bigint->mpz) == 0)
+  {
+    data[0] = 0U;
+    return CARDANO_SUCCESS;
+  }
+
+  size_t        count;
+  const int32_t order         = (byte_order == CARDANO_BYTE_ORDER_BIG_ENDIAN) ? (int32_t)1 : (int32_t)-1;
+  const int32_t size_per_word = 1;
+  const int32_t nails         = 0;
+
+  mpz_export(data, &count, order, size_per_word, 0, nails, bigint->mpz);
+
+  if (count != size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_bigint_add(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result)
+{
+  if ((lhs == NULL) || (rhs == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_add(result->mpz, lhs->mpz, rhs->mpz);
+}
+
+void
+cardano_bigint_subtract(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result)
+{
+  if ((lhs == NULL) || (rhs == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_sub(result->mpz, lhs->mpz, rhs->mpz);
+}
+
+void
+cardano_bigint_multiply(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result)
+{
+  if ((lhs == NULL) || (rhs == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_mul(result->mpz, lhs->mpz, rhs->mpz);
+}
+
+void
+cardano_bigint_divide(
+  const cardano_bigint_t* dividend,
+  const cardano_bigint_t* divisor,
+  cardano_bigint_t*       result)
+{
+  if ((dividend == NULL) || (divisor == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_tdiv_q(result->mpz, dividend->mpz, divisor->mpz);
+}
+
+void
+cardano_bigint_divide_and_reminder(
+  const cardano_bigint_t* dividend,
+  const cardano_bigint_t* divisor,
+  cardano_bigint_t*       quotient,
+  cardano_bigint_t*       reminder)
+{
+  if ((dividend == NULL) || (divisor == NULL) || (quotient == NULL) || (reminder == NULL))
+  {
+    return;
+  }
+
+  mpz_tdiv_qr(quotient->mpz, reminder->mpz, dividend->mpz, divisor->mpz);
+}
+
+void
+cardano_bigint_reminder(
+  const cardano_bigint_t* dividend,
+  const cardano_bigint_t* divisor,
+  cardano_bigint_t*       reminder)
+{
+  if ((dividend == NULL) || (divisor == NULL) || (reminder == NULL))
+  {
+    return;
+  }
+
+  mpz_tdiv_r(reminder->mpz, dividend->mpz, divisor->mpz);
+}
+
+void
+cardano_bigint_abs(const cardano_bigint_t* bignum, cardano_bigint_t* result)
+{
+  if ((bignum == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_abs(result->mpz, bignum->mpz);
+}
+
+void
+cardano_bigint_gcd(const cardano_bigint_t* lhs, const cardano_bigint_t* rhs, cardano_bigint_t* result)
+{
+  if ((lhs == NULL) || (rhs == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_gcd(result->mpz, lhs->mpz, rhs->mpz);
+}
+
+void
+cardano_bigint_negate(const cardano_bigint_t* bignum, cardano_bigint_t* result)
+{
+  if ((bignum == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_neg(result->mpz, bignum->mpz);
+}
+
+int32_t
+cardano_bigint_signum(const cardano_bigint_t* bignum)
+{
+  if (bignum == NULL)
+  {
+    return 0;
+  }
+
+  return mpz_sgn(bignum->mpz);
+}
+
+void
+cardano_bigint_mod(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result)
+{
+  cardano_bigint_reminder(lhs, rhs, result);
+}
+
+void
+cardano_bigint_mod_pow(
+  const cardano_bigint_t* base,
+  const cardano_bigint_t* exponent,
+  const cardano_bigint_t* modulus,
+  cardano_bigint_t*       result)
+{
+  if ((base == NULL) || (exponent == NULL) || (modulus == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_powm(result->mpz, base->mpz, exponent->mpz, modulus->mpz);
+}
+
+void
+cardano_bigint_mod_inverse(
+  const cardano_bigint_t* bignum,
+  const cardano_bigint_t* modulus,
+  cardano_bigint_t*       result)
+{
+  if ((bignum == NULL) || (modulus == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_invert(result->mpz, bignum->mpz, modulus->mpz);
+}
+
+void
+cardano_bigint_and(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result)
+{
+  if ((lhs == NULL) || (rhs == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_and(result->mpz, lhs->mpz, rhs->mpz);
+}
+
+void
+cardano_bigint_or(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result)
+{
+  if ((lhs == NULL) || (rhs == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_ior(result->mpz, lhs->mpz, rhs->mpz);
+}
+
+void
+cardano_bigint_xor(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs,
+  cardano_bigint_t*       result)
+{
+  if ((lhs == NULL) || (rhs == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_xor(result->mpz, lhs->mpz, rhs->mpz);
+}
+
+void
+cardano_bigint_not(
+  const cardano_bigint_t* bigint,
+  cardano_bigint_t*       result)
+{
+  if ((bigint == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_com(result->mpz, bigint->mpz);
+}
+
+bool
+cardano_bigint_test_bit(
+  const cardano_bigint_t* bigint,
+  uint32_t                n)
+{
+  if (bigint == NULL)
+  {
+    return false;
+  }
+
+  return mpz_tstbit(bigint->mpz, n);
+}
+
+void
+cardano_bigint_set_bit(
+  cardano_bigint_t* bigint,
+  uint32_t          n)
+{
+  if (bigint == NULL)
+  {
+    return;
+  }
+
+  mpz_setbit(bigint->mpz, n);
+}
+
+void
+cardano_bigint_clear_bit(
+  cardano_bigint_t* bigint,
+  uint32_t          n)
+{
+  if (bigint == NULL)
+  {
+    return;
+  }
+
+  mpz_clrbit(bigint->mpz, n);
+}
+
+void
+cardano_bigint_flip_bit(
+  cardano_bigint_t* bigint,
+  uint32_t          n)
+{
+  if (bigint == NULL)
+  {
+    return;
+  }
+
+  mpz_combit(bigint->mpz, n);
+}
+
+size_t
+cardano_bigint_bit_count(const cardano_bigint_t* bigint)
+{
+  if (bigint == NULL)
+  {
+    return 0;
+  }
+
+  mpz_t tmp;
+  mpz_init_set(tmp, bigint->mpz);
+
+  mpz_abs(tmp, tmp);
+
+  size_t count = 0;
+
+  while (mpz_cmp_ui(tmp, 0) != 0)
+  {
+    // cppcheck-suppress misra-c2012-10.4; Reason: False positive.
+    if (((int32_t)mpz_odd_p(tmp)) != 0)
+    {
+      ++count;
+    }
+
+    mpz_fdiv_q_2exp(tmp, tmp, 1);
+  }
+
+  mpz_clear(tmp);
+
+  return count;
+}
+
+size_t
+cardano_bigint_bit_length(const cardano_bigint_t* bigint)
+{
+  if (bigint == NULL)
+  {
+    return 0;
+  }
+
+  return mpz_sizeinbase(bigint->mpz, 2);
+}
+
+void
+cardano_bigint_min(
+  cardano_bigint_t* lhs,
+  cardano_bigint_t* rhs,
+  cardano_bigint_t* result)
+{
+  if ((lhs == NULL) || (rhs == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  if (mpz_cmp(lhs->mpz, rhs->mpz) <= 0)
+  {
+    mpz_set(result->mpz, lhs->mpz);
+  }
+  else
+  {
+    mpz_set(result->mpz, rhs->mpz);
+  }
+}
+
+void
+cardano_bigint_max(
+  cardano_bigint_t* lhs,
+  cardano_bigint_t* rhs,
+  cardano_bigint_t* result)
+{
+  if ((lhs == NULL) || (rhs == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  if (mpz_cmp(lhs->mpz, rhs->mpz) >= 0)
+  {
+    mpz_set(result->mpz, lhs->mpz);
+  }
+  else
+  {
+    mpz_set(result->mpz, rhs->mpz);
+  }
+}
+
+void
+cardano_bigint_shift_left(
+  const cardano_bigint_t* n,
+  uint32_t                bits,
+  cardano_bigint_t*       result)
+{
+  if ((n == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_mul_2exp(result->mpz, n->mpz, bits);
+}
+
+void
+cardano_bigint_shift_right(
+  const cardano_bigint_t* n,
+  uint32_t                bits,
+  cardano_bigint_t*       result)
+{
+  if ((n == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  mpz_fdiv_q_2exp(result->mpz, n->mpz, bits);
+}
+
+bool
+cardano_bigint_equals(const cardano_bigint_t* lhs, const cardano_bigint_t* rhs)
+{
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  return mpz_cmp(lhs->mpz, rhs->mpz) == 0;
+}
+
+int32_t
+cardano_bigint_compare(
+  const cardano_bigint_t* lhs,
+  const cardano_bigint_t* rhs)
+{
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return 0;
+  }
+
+  return mpz_cmp(lhs->mpz, rhs->mpz);
+}
+
+bool
+cardano_bigint_is_zero(const cardano_bigint_t* n)
+{
+  if (n == NULL)
+  {
+    return false;
+  }
+
+  return mpz_sgn(n->mpz) == 0;
+}
+
+void
+cardano_bigint_increment(cardano_bigint_t* n)
+{
+  if (n == NULL)
+  {
+    return;
+  }
+
+  mpz_add_ui(n->mpz, n->mpz, 1);
+}
+
+void
+cardano_bigint_decrement(cardano_bigint_t* n)
+{
+  if (n == NULL)
+  {
+    return;
+  }
+
+  mpz_sub_ui(n->mpz, n->mpz, 1);
+}
+
+void
+cardano_bigint_pow(const cardano_bigint_t* base, const uint64_t exponent, cardano_bigint_t* result)
+{
+  if ((base == NULL) || (result == NULL))
+  {
+    return;
+  }
+
+  uint64_t remaining = exponent;
+  mpz_t    factor;
+  mpz_t    product;
+
+  mpz_init_set(factor, base->mpz);
+  mpz_init_set_ui(product, 1U);
+
+  while (remaining != 0U)
+  {
+    if ((remaining & 1U) != 0U)
+    {
+      mpz_mul(product, product, factor);
+    }
+
+    remaining >>= 1U;
+
+    if (remaining != 0U)
+    {
+      mpz_mul(factor, factor, factor);
+    }
+  }
+
+  mpz_swap(result->mpz, product);
+  mpz_clear(product);
+  mpz_clear(factor);
+}
+
+void
+cardano_bigint_assign(
+  const cardano_bigint_t* destination,
+  cardano_bigint_t*       source)
+{
+  if ((destination == NULL) || (source == NULL))
+  {
+    return;
+  }
+
+  mpz_set(source->mpz, destination->mpz);
+}
+
+void
+cardano_bigint_unref(cardano_bigint_t** bigint)
+{
+  if ((bigint == NULL) || (*bigint == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*bigint)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *bigint = NULL;
+    return;
+  }
+}
+
+void
+cardano_bigint_ref(cardano_bigint_t* bigint)
+{
+  if (bigint == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&bigint->base);
+}
+
+size_t
+cardano_bigint_refcount(const cardano_bigint_t* bigint)
+{
+  if (bigint == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&bigint->base);
+}
+
+void
+cardano_bigint_set_last_error(cardano_bigint_t* bigint, const char* message)
+{
+  cardano_object_set_last_error((bigint == NULL) ? NULL : &bigint->base, message);
+}
+
+const char*
+cardano_bigint_get_last_error(const cardano_bigint_t* bigint)
+{
+  return cardano_object_get_last_error((bigint == NULL) ? NULL : &bigint->base);
+}
+
+cardano_error_t
+cardano_bigint_deep_clone(const cardano_bigint_t* source, cardano_bigint_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_bigint_clone(source, clone);
+}
diff --git a/vendor/src/common/credential.c b/vendor/src/common/credential.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/credential.c
@@ -0,0 +1,609 @@
+/**
+ * \file credential.c
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/credential.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t CREDENTIAL_ARRAY_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano credential.
+ */
+typedef struct cardano_credential_t
+{
+    cardano_object_t          base;
+    cardano_credential_type_t type;
+    byte_t                    hash_bytes[28];
+    char                      hash_hex[57];
+} cardano_credential_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a credential object.
+ *
+ * This function is responsible for properly deallocating a credential object (`cardano_credential_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the credential object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_credential_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the credential
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_credential_deallocate(void* object)
+{
+  assert(object != NULL);
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_credential_new(const cardano_blake2b_hash_t* hash, const cardano_credential_type_t type, cardano_credential_t** credential)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    *credential = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *credential = _cardano_malloc(sizeof(cardano_credential_t));
+
+  if (*credential == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*credential)->base.deallocator   = cardano_credential_deallocate;
+  (*credential)->base.ref_count     = 1;
+  (*credential)->base.last_error[0] = '\0';
+  (*credential)->type               = type;
+
+  const size_t hash_size = cardano_blake2b_hash_get_bytes_size(hash);
+
+  if (hash_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_224)
+  {
+    cardano_credential_unref(credential);
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_error_t copy_hash_result = cardano_blake2b_hash_to_bytes(hash, (*credential)->hash_bytes, sizeof((*credential)->hash_bytes));
+
+  assert(copy_hash_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hash_result);
+
+  cardano_error_t copy_hex_result = cardano_blake2b_hash_to_hex(hash, (*credential)->hash_hex, sizeof((*credential)->hash_hex));
+
+  assert(copy_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hex_result);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_credential_from_hash_hex(const char* hex, size_t hex_size, cardano_credential_type_t type, cardano_credential_t** credential)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex == NULL)
+  {
+    *credential = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex_size != ((size_t)CARDANO_BLAKE2B_HASH_SIZE_224 * 2U))
+  {
+    *credential = NULL;
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = cardano_blake2b_hash_from_hex(hex, hex_size, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    *credential = NULL;
+    return read_hash_result;
+  }
+
+  cardano_error_t new_credential_result = cardano_credential_new(hash, type, credential);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_credential_result != CARDANO_SUCCESS)
+  {
+    *credential = NULL;
+    return new_credential_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_credential_from_hash_bytes(
+  const byte_t*             data,
+  size_t                    data_size,
+  cardano_credential_type_t type,
+  cardano_credential_t**    credential)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    *credential = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_224)
+  {
+    *credential = NULL;
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = cardano_blake2b_hash_from_bytes(data, data_size, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    *credential = NULL;
+    return read_hash_result;
+  }
+
+  cardano_error_t new_credential_result = cardano_credential_new(hash, type, credential);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_credential_result != CARDANO_SUCCESS)
+  {
+    *credential = NULL;
+    return new_credential_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_credential_from_cbor(cardano_cbor_reader_t* reader, cardano_credential_t** credential)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *credential = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "Credential";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)CREDENTIAL_ARRAY_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *credential = NULL;
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "credential_type",
+    reader,
+    &type,
+    CARDANO_CREDENTIAL_TYPE_KEY_HASH,
+    CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    *credential = NULL;
+    return read_uint_result;
+  }
+
+  cardano_buffer_t*     byte_string             = NULL;
+  const cardano_error_t read_byte_string_result = cardano_cbor_validate_byte_string_of_size(
+    validator_name,
+    reader,
+    &byte_string,
+    CARDANO_BLAKE2B_HASH_SIZE_224);
+
+  if (read_byte_string_result != CARDANO_SUCCESS)
+  {
+    *credential = NULL;
+    return read_byte_string_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&byte_string);
+    *credential = NULL;
+
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t new_credential_result = cardano_credential_from_hash_bytes(
+    cardano_buffer_get_data(byte_string),
+    cardano_buffer_get_size(byte_string),
+    (cardano_credential_type_t)type,
+    credential);
+
+  cardano_buffer_unref(&byte_string);
+
+  if (new_credential_result != CARDANO_SUCCESS)
+  {
+    *credential = NULL;
+    return new_credential_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_credential_to_cbor(
+  const cardano_credential_t* credential,
+  cardano_cbor_writer_t*      writer)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(writer, CREDENTIAL_ARRAY_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, credential->type);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  cardano_error_t write_bytes_result = cardano_cbor_writer_write_bytestring(writer, credential->hash_bytes, sizeof(credential->hash_bytes));
+
+  if (write_bytes_result != CARDANO_SUCCESS)
+  {
+    return write_bytes_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_credential_to_cip116_json(
+  const cardano_credential_t* credential,
+  cardano_json_writer_t*      writer)
+{
+  if ((credential == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+
+  if (credential->type == CARDANO_CREDENTIAL_TYPE_KEY_HASH)
+  {
+    cardano_json_writer_write_string(writer, "pubkey_hash", 11);
+  }
+  else
+  {
+    cardano_json_writer_write_string(writer, "script_hash", 11);
+  }
+
+  cardano_json_writer_write_property_name(writer, "value", 5);
+  cardano_json_writer_write_string(writer, credential->hash_hex, sizeof(credential->hash_hex) - 1U);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_credential_get_hash(const cardano_credential_t* credential)
+{
+  if (credential == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = cardano_blake2b_hash_from_bytes(credential->hash_bytes, sizeof(credential->hash_bytes), &hash);
+
+  CARDANO_UNUSED(read_hash_result);
+
+  return hash;
+}
+
+size_t
+cardano_credential_get_hash_bytes_size(const cardano_credential_t* credential)
+{
+  if (credential == NULL)
+  {
+    return 0U;
+  }
+
+  return sizeof(credential->hash_bytes);
+}
+
+const byte_t*
+cardano_credential_get_hash_bytes(const cardano_credential_t* credential)
+{
+  if (credential == NULL)
+  {
+    return NULL;
+  }
+
+  return credential->hash_bytes;
+}
+
+size_t
+cardano_credential_get_hash_hex_size(const cardano_credential_t* credential)
+{
+  if (credential == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_safe_strlen(credential->hash_hex, sizeof(credential->hash_hex)) + 1U;
+}
+
+const char*
+cardano_credential_get_hash_hex(const cardano_credential_t* credential)
+{
+  if (credential == NULL)
+  {
+    return NULL;
+  }
+
+  return credential->hash_hex;
+}
+
+cardano_error_t
+cardano_credential_get_type(const cardano_credential_t* credential, cardano_credential_type_t* type)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = credential->type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_credential_set_type(cardano_credential_t* credential, cardano_credential_type_t type)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((type != CARDANO_CREDENTIAL_TYPE_KEY_HASH) && (type != CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH))
+  {
+    return CARDANO_ERROR_INVALID_CREDENTIAL_TYPE;
+  }
+
+  credential->type = type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_credential_set_hash(cardano_credential_t* credential, const cardano_blake2b_hash_t* hash)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t hash_size = cardano_blake2b_hash_get_bytes_size(hash);
+
+  if (hash_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_224)
+  {
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_error_t copy_hash_result = cardano_blake2b_hash_to_bytes(hash, &credential->hash_bytes[0], sizeof(credential->hash_bytes));
+
+  assert(copy_hash_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hash_result);
+
+  cardano_error_t copy_hex_result = cardano_blake2b_hash_to_hex(hash, credential->hash_hex, sizeof(credential->hash_hex));
+
+  assert(copy_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hex_result);
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_credential_equals(
+  const cardano_credential_t* lhs,
+  const cardano_credential_t* rhs)
+{
+  return cardano_credential_compare(lhs, rhs) == 0;
+}
+
+int32_t
+cardano_credential_compare(
+  const cardano_credential_t* lhs,
+  const cardano_credential_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return 0;
+  }
+
+  if (lhs == NULL)
+  {
+    return -1;
+  }
+
+  if (rhs == NULL)
+  {
+    return 1;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return (lhs->type < rhs->type) ? -1 : 1;
+  }
+
+  return memcmp(lhs->hash_bytes, rhs->hash_bytes, sizeof(lhs->hash_bytes));
+}
+
+void
+cardano_credential_unref(cardano_credential_t** credential)
+{
+  if ((credential == NULL) || (*credential == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*credential)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *credential = NULL;
+    return;
+  }
+}
+
+void
+cardano_credential_ref(cardano_credential_t* credential)
+{
+  if (credential == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&credential->base);
+}
+
+size_t
+cardano_credential_refcount(const cardano_credential_t* credential)
+{
+  if (credential == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&credential->base);
+}
+
+void
+cardano_credential_set_last_error(cardano_credential_t* credential, const char* message)
+{
+  cardano_object_set_last_error(&credential->base, message);
+}
+
+const char*
+cardano_credential_get_last_error(const cardano_credential_t* credential)
+{
+  return cardano_object_get_last_error(&credential->base);
+}
+
+cardano_error_t
+cardano_credential_deep_clone(const cardano_credential_t* source, cardano_credential_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_t* copy = _cardano_malloc(sizeof(cardano_credential_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  CARDANO_UNUSED(memcpy(copy->hash_bytes, source->hash_bytes, sizeof(copy->hash_bytes)));
+  CARDANO_UNUSED(memcpy(copy->hash_hex, source->hash_hex, sizeof(copy->hash_hex)));
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/datum.c b/vendor/src/common/datum.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/datum.c
@@ -0,0 +1,888 @@
+/**
+ * \file datum.c
+ *
+ * \author luisd.bianchi
+ * \date   May 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/datum.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+#include <cardano/plutus_data/plutus_data.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t DATUM_ARRAY_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano datum.
+ */
+typedef struct cardano_datum_t
+{
+    cardano_object_t       base;
+    cardano_datum_type_t   type;
+    byte_t                 hash_bytes[32];
+    char                   hash_hex[65];
+    cardano_plutus_data_t* inline_data;
+} cardano_datum_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a datum object.
+ *
+ * This function is responsible for properly deallocating a datum object (`cardano_datum_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the datum object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_datum_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the datum
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_datum_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_data_unref(&((cardano_datum_t*)object)->inline_data);
+
+  _cardano_free(object);
+}
+
+/**
+ * \brief Computes the hash of the plutus data of an inline datum.
+ *
+ * The hash is the blake2b-256 digest of the CBOR encoding of the data. Data decoded from CBOR keeps the bytes
+ * it was decoded from and is hashed over them, so the result matches the datum hash the ledger computes.
+ *
+ * \param[in] data The plutus data to hash.
+ * \param[out] hash On success, the hash of the data. The caller must release it with \ref cardano_blake2b_hash_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the hash was computed, or an error code if the data could not be encoded or
+ *         memory could not be allocated.
+ */
+static cardano_error_t
+compute_inline_data_hash(const cardano_plutus_data_t* data, cardano_blake2b_hash_t** hash)
+{
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+  cardano_buffer_t*      buffer = NULL;
+
+  *hash = NULL;
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_plutus_data_to_cbor(data, writer);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_writer_encode_in_buffer(writer, &buffer);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_blake2b_compute_hash(cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer), (size_t)CARDANO_BLAKE2B_HASH_SIZE_256, hash);
+  }
+
+  cardano_buffer_unref(&buffer);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+/**
+ * \brief Refreshes the stored hash of an inline datum from its current plutus data.
+ *
+ * The plutus data of an inline datum is shared by reference and can change after the datum is created, so the
+ * stored hash bytes and hex are recomputed from the data every time they are read.
+ *
+ * \param[in] datum The inline datum whose stored hash is refreshed.
+ *
+ * \return \ref CARDANO_SUCCESS if the stored hash was refreshed, or an error code if it could not be computed.
+ */
+static cardano_error_t
+refresh_inline_data_hash(const cardano_datum_t* datum)
+{
+  cardano_blake2b_hash_t* hash   = NULL;
+  cardano_error_t         result = compute_inline_data_hash(datum->inline_data, &hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  // cppcheck-suppress misra-c2012-11.8; Reason: the stored hash is a cache of the shared plutus data
+  cardano_datum_t* cache = (cardano_datum_t*)((void*)datum);
+
+  result = cardano_blake2b_hash_to_bytes(hash, cache->hash_bytes, sizeof(cache->hash_bytes));
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_blake2b_hash_to_hex(hash, cache->hash_hex, sizeof(cache->hash_hex));
+  }
+
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_datum_new_data_hash(const cardano_blake2b_hash_t* hash, cardano_datum_t** datum)
+{
+  if (datum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    *datum = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *datum = _cardano_malloc(sizeof(cardano_datum_t));
+
+  if (*datum == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*datum)->base.deallocator   = cardano_datum_deallocate;
+  (*datum)->base.ref_count     = 1;
+  (*datum)->base.last_error[0] = '\0';
+  (*datum)->type               = CARDANO_DATUM_TYPE_DATA_HASH;
+  (*datum)->inline_data        = NULL;
+
+  const size_t hash_size = cardano_blake2b_hash_get_bytes_size(hash);
+
+  if (hash_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_256)
+  {
+    cardano_datum_unref(datum);
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_error_t copy_hash_result = cardano_blake2b_hash_to_bytes(hash, (*datum)->hash_bytes, sizeof((*datum)->hash_bytes));
+
+  assert(copy_hash_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hash_result);
+
+  cardano_error_t copy_hex_result = cardano_blake2b_hash_to_hex(hash, (*datum)->hash_hex, sizeof((*datum)->hash_hex));
+
+  assert(copy_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hex_result);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_datum_new_data_hash_hex(const char* hex, size_t hex_size, cardano_datum_t** datum)
+{
+  if (datum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex == NULL)
+  {
+    *datum = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex_size != ((size_t)CARDANO_BLAKE2B_HASH_SIZE_256 * 2U))
+  {
+    *datum = NULL;
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = cardano_blake2b_hash_from_hex(hex, hex_size, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    *datum = NULL;
+    return read_hash_result;
+  }
+
+  cardano_error_t new_datum_result = cardano_datum_new_data_hash(hash, datum);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_datum_result != CARDANO_SUCCESS)
+  {
+    *datum = NULL;
+    return new_datum_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_datum_new_data_hash_bytes(const byte_t* data, size_t data_size, cardano_datum_t** datum)
+{
+  if (datum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    *datum = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_256)
+  {
+    *datum = NULL;
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = cardano_blake2b_hash_from_bytes(data, data_size, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    *datum = NULL;
+    return read_hash_result;
+  }
+
+  cardano_error_t new_datum_result = cardano_datum_new_data_hash(hash, datum);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_datum_result != CARDANO_SUCCESS)
+  {
+    *datum = NULL;
+    return new_datum_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_datum_new_inline_data(
+  cardano_plutus_data_t* data,
+  cardano_datum_t**      datum)
+{
+  if (datum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    *datum = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *datum = _cardano_malloc(sizeof(cardano_datum_t));
+
+  if (*datum == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*datum)->base.deallocator   = cardano_datum_deallocate;
+  (*datum)->base.ref_count     = 1;
+  (*datum)->base.last_error[0] = '\0';
+  (*datum)->type               = CARDANO_DATUM_TYPE_INLINE_DATA;
+  (*datum)->inline_data        = data;
+
+  CARDANO_UNUSED(memset((*datum)->hash_bytes, 0, sizeof((*datum)->hash_bytes)));
+  CARDANO_UNUSED(memset((*datum)->hash_hex, 0, sizeof((*datum)->hash_hex)));
+
+  cardano_plutus_data_ref(data);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_datum_from_cbor(cardano_cbor_reader_t* reader, cardano_datum_t** datum)
+{
+  if (datum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *datum = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "Datum";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)DATUM_ARRAY_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *datum = NULL;
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "datum_type",
+    reader,
+    &type,
+    CARDANO_DATUM_TYPE_DATA_HASH,
+    CARDANO_DATUM_TYPE_INLINE_DATA);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    *datum = NULL;
+    return read_uint_result;
+  }
+
+  if (type == (uint64_t)CARDANO_DATUM_TYPE_DATA_HASH)
+  {
+    cardano_buffer_t*     byte_string             = NULL;
+    const cardano_error_t read_byte_string_result = cardano_cbor_validate_byte_string_of_size(
+      validator_name,
+      reader,
+      &byte_string,
+      CARDANO_BLAKE2B_HASH_SIZE_256);
+
+    if (read_byte_string_result != CARDANO_SUCCESS)
+    {
+      *datum = NULL;
+      return read_byte_string_result;
+    }
+
+    const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+    if (expect_end_array_result != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&byte_string);
+      *datum = NULL;
+
+      return expect_end_array_result;
+    }
+
+    const cardano_error_t new_datum_result = cardano_datum_new_data_hash_bytes(
+      cardano_buffer_get_data(byte_string),
+      cardano_buffer_get_size(byte_string),
+      datum);
+
+    cardano_buffer_unref(&byte_string);
+
+    if (new_datum_result != CARDANO_SUCCESS)
+    {
+      *datum = NULL;
+      return new_datum_result;
+    }
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_cbor_tag_t tag;
+
+  const cardano_error_t read_tag_result = cardano_cbor_reader_read_tag(reader, &tag);
+
+  if (read_tag_result != CARDANO_SUCCESS)
+  {
+    *datum = NULL;
+    return read_tag_result;
+  }
+
+  if (tag != CARDANO_ENCODED_CBOR_DATA_ITEM)
+  {
+    *datum = NULL;
+    return CARDANO_ERROR_INVALID_CBOR_VALUE;
+  }
+
+  cardano_buffer_t* byte_string = NULL;
+
+  const cardano_error_t read_byte_string_result = cardano_cbor_reader_read_bytestring(reader, &byte_string);
+
+  if (read_byte_string_result != CARDANO_SUCCESS)
+  {
+    *datum = NULL;
+    return read_byte_string_result;
+  }
+
+  cardano_cbor_reader_t* plutus_data_reader = cardano_cbor_reader_new(cardano_buffer_get_data(byte_string), cardano_buffer_get_size(byte_string));
+  cardano_buffer_unref(&byte_string);
+
+  cardano_plutus_data_t* inline_data = NULL;
+
+  const cardano_error_t read_inline_data_result = cardano_plutus_data_from_cbor(plutus_data_reader, &inline_data);
+
+  cardano_cbor_reader_unref(&plutus_data_reader);
+
+  if (read_inline_data_result != CARDANO_SUCCESS)
+  {
+    *datum = NULL;
+    return read_inline_data_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_unref(&inline_data);
+    *datum = NULL;
+
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t new_datum_result = cardano_datum_new_inline_data(inline_data, datum);
+
+  cardano_plutus_data_unref(&inline_data);
+
+  if (new_datum_result != CARDANO_SUCCESS)
+  {
+    *datum = NULL;
+    return new_datum_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_datum_to_cbor(
+  const cardano_datum_t* datum,
+  cardano_cbor_writer_t* writer)
+{
+  if (datum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(writer, DATUM_ARRAY_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, datum->type);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  switch (datum->type)
+  {
+    case CARDANO_DATUM_TYPE_DATA_HASH:
+    {
+      cardano_error_t write_bytes_result = cardano_cbor_writer_write_bytestring(writer, datum->hash_bytes, sizeof(datum->hash_bytes));
+
+      if (write_bytes_result != CARDANO_SUCCESS)
+      {
+        return write_bytes_result;
+      }
+
+      break;
+    }
+    case CARDANO_DATUM_TYPE_INLINE_DATA:
+    {
+      cardano_error_t write_tag_result = cardano_cbor_writer_write_tag(writer, CARDANO_ENCODED_CBOR_DATA_ITEM);
+
+      if (write_tag_result != CARDANO_SUCCESS)
+      {
+        return write_tag_result;
+      }
+
+      cardano_cbor_writer_t* plutus_data_writer       = cardano_cbor_writer_new();
+      cardano_error_t        write_plutus_data_result = cardano_plutus_data_to_cbor(datum->inline_data, plutus_data_writer);
+
+      if (write_plutus_data_result != CARDANO_SUCCESS)
+      {
+        cardano_cbor_writer_unref(&plutus_data_writer);
+        return write_plutus_data_result;
+      }
+
+      cardano_buffer_t* byte_string = NULL;
+
+      cardano_error_t encode_result = cardano_cbor_writer_encode_in_buffer(plutus_data_writer, &byte_string);
+
+      cardano_cbor_writer_unref(&plutus_data_writer);
+
+      if (encode_result != CARDANO_SUCCESS)
+      {
+        return encode_result;
+      }
+
+      cardano_error_t write_byte_string_result = cardano_cbor_writer_write_bytestring(writer, cardano_buffer_get_data(byte_string), cardano_buffer_get_size(byte_string));
+
+      cardano_buffer_unref(&byte_string);
+
+      if (write_byte_string_result != CARDANO_SUCCESS)
+      {
+        return write_byte_string_result;
+      }
+
+      break;
+    }
+
+    default:
+    {
+      cardano_cbor_writer_set_last_error(writer, "Invalid datum type");
+      return CARDANO_ERROR_INVALID_DATUM_TYPE;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_datum_to_cip116_json(
+  const cardano_datum_t* datum,
+  cardano_json_writer_t* writer)
+{
+  if ((datum == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  switch (datum->type)
+  {
+    case CARDANO_DATUM_TYPE_DATA_HASH:
+    {
+      cardano_json_writer_write_property_name(writer, "tag", 3);
+      cardano_json_writer_write_string(writer, "datum_hash", 10);
+      cardano_json_writer_write_property_name(writer, "value", 5);
+      cardano_json_writer_write_bytes_as_hex(writer, datum->hash_bytes, sizeof(datum->hash_bytes));
+      break;
+    }
+
+    case CARDANO_DATUM_TYPE_INLINE_DATA:
+    {
+      cardano_json_writer_write_property_name(writer, "tag", 3);
+      cardano_json_writer_write_string(writer, "datum", 5);
+      cardano_json_writer_write_property_name(writer, "value", 5);
+      error = cardano_plutus_data_to_cip116_json(datum->inline_data, writer);
+      break;
+    }
+    default:
+    {
+      error = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+  return error;
+}
+
+cardano_plutus_data_t*
+cardano_datum_get_inline_data(cardano_datum_t* datum)
+{
+  if (datum == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_plutus_data_ref(datum->inline_data);
+
+  return datum->inline_data;
+}
+
+cardano_blake2b_hash_t*
+cardano_datum_get_data_hash(const cardano_datum_t* datum)
+{
+  if (datum == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = CARDANO_SUCCESS;
+
+  if (datum->type == CARDANO_DATUM_TYPE_INLINE_DATA)
+  {
+    read_hash_result = compute_inline_data_hash(datum->inline_data, &hash);
+  }
+  else
+  {
+    read_hash_result = cardano_blake2b_hash_from_bytes(datum->hash_bytes, sizeof(datum->hash_bytes), &hash);
+  }
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return hash;
+}
+
+size_t
+cardano_datum_get_data_hash_bytes_size(const cardano_datum_t* datum)
+{
+  if (datum == NULL)
+  {
+    return 0U;
+  }
+
+  return sizeof(datum->hash_bytes);
+}
+
+const byte_t*
+cardano_datum_get_data_hash_bytes(const cardano_datum_t* datum)
+{
+  if (datum == NULL)
+  {
+    return NULL;
+  }
+
+  if ((datum->type == CARDANO_DATUM_TYPE_INLINE_DATA) && (refresh_inline_data_hash(datum) != CARDANO_SUCCESS))
+  {
+    return NULL;
+  }
+
+  return datum->hash_bytes;
+}
+
+size_t
+cardano_datum_get_data_hash_hex_size(const cardano_datum_t* datum)
+{
+  if (datum == NULL)
+  {
+    return 0U;
+  }
+
+  if (datum->type == CARDANO_DATUM_TYPE_INLINE_DATA)
+  {
+    return sizeof(datum->hash_hex);
+  }
+
+  return cardano_safe_strlen(datum->hash_hex, sizeof(datum->hash_hex)) + 1U;
+}
+
+const char*
+cardano_datum_get_data_hash_hex(const cardano_datum_t* datum)
+{
+  if (datum == NULL)
+  {
+    return NULL;
+  }
+
+  if ((datum->type == CARDANO_DATUM_TYPE_INLINE_DATA) && (refresh_inline_data_hash(datum) != CARDANO_SUCCESS))
+  {
+    return NULL;
+  }
+
+  return datum->hash_hex;
+}
+
+cardano_error_t
+cardano_datum_get_type(const cardano_datum_t* datum, cardano_datum_type_t* type)
+{
+  if (datum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = datum->type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_datum_set_data_hash(cardano_datum_t* datum, const cardano_blake2b_hash_t* hash)
+{
+  if (datum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t hash_size = cardano_blake2b_hash_get_bytes_size(hash);
+
+  if (hash_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_256)
+  {
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_error_t copy_hash_result = cardano_blake2b_hash_to_bytes(hash, datum->hash_bytes, sizeof(datum->hash_bytes));
+
+  assert(copy_hash_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hash_result);
+
+  cardano_error_t copy_hex_result = cardano_blake2b_hash_to_hex(hash, datum->hash_hex, sizeof(datum->hash_hex));
+
+  assert(copy_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hex_result);
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_datum_equals(const cardano_datum_t* lhs, const cardano_datum_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return false;
+  }
+
+  if (lhs->type == CARDANO_DATUM_TYPE_DATA_HASH)
+  {
+    return (memcmp(lhs->hash_bytes, rhs->hash_bytes, sizeof(lhs->hash_bytes)) == 0);
+  }
+
+  return cardano_plutus_data_equals(lhs->inline_data, rhs->inline_data);
+}
+
+void
+cardano_datum_unref(cardano_datum_t** datum)
+{
+  if ((datum == NULL) || (*datum == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*datum)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *datum = NULL;
+    return;
+  }
+}
+
+void
+cardano_datum_ref(cardano_datum_t* datum)
+{
+  if (datum == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&datum->base);
+}
+
+size_t
+cardano_datum_refcount(const cardano_datum_t* datum)
+{
+  if (datum == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&datum->base);
+}
+
+void
+cardano_datum_set_last_error(cardano_datum_t* datum, const char* message)
+{
+  cardano_object_set_last_error(&datum->base, message);
+}
+
+const char*
+cardano_datum_get_last_error(const cardano_datum_t* datum)
+{
+  return cardano_object_get_last_error(&datum->base);
+}
+
+cardano_error_t
+cardano_datum_deep_clone(const cardano_datum_t* source, cardano_datum_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_datum_t* copy = _cardano_malloc(sizeof(cardano_datum_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  CARDANO_UNUSED(memcpy(copy->hash_bytes, source->hash_bytes, sizeof(copy->hash_bytes)));
+  CARDANO_UNUSED(memcpy(copy->hash_hex, source->hash_hex, sizeof(copy->hash_hex)));
+  copy->inline_data = NULL;
+
+  if (source->inline_data != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_data_deep_clone(source->inline_data, &copy->inline_data);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/drep.c b/vendor/src/common/drep.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/drep.c
@@ -0,0 +1,729 @@
+/**
+ * \file drep.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/drep.h>
+#include <cardano/common/governance_key_type.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <cardano/encoding/bech32.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t DREP_ARRAY_SIZE          = 2;
+static const size_t  DREP_CIP129_PAYLOAD_SIZE = 29U;
+static const size_t  DREP_HEADER_SIZE         = 1U;
+static const size_t  CREDENTIAL_HASH_SIZE     = 28U;
+static const size_t  KEY_TYPE_OFFSET          = 2U;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano drep.
+ */
+typedef struct cardano_drep_t
+{
+    cardano_object_t      base;
+    cardano_drep_type_t   type;
+    cardano_credential_t* credential;
+} cardano_drep_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a drep object.
+ *
+ * This function is responsible for properly deallocating a drep object (`cardano_drep_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the drep object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_drep_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the drep
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_drep_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_drep_t* data = (cardano_drep_t*)object;
+
+  cardano_credential_unref(&data->credential);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_drep_new(const cardano_drep_type_t type, cardano_credential_t* credential, cardano_drep_t** drep)
+{
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((type == CARDANO_DREP_TYPE_KEY_HASH) || (type == CARDANO_DREP_TYPE_SCRIPT_HASH))
+  {
+    if (credential == NULL)
+    {
+      *drep = NULL;
+      return CARDANO_ERROR_POINTER_IS_NULL;
+    }
+  }
+  else
+  {
+    if (credential != NULL)
+    {
+      *drep = NULL;
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+
+  *drep = _cardano_malloc(sizeof(cardano_drep_t));
+
+  if (*drep == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*drep)->base.deallocator   = cardano_drep_deallocate;
+  (*drep)->base.ref_count     = 1;
+  (*drep)->base.last_error[0] = '\0';
+  (*drep)->type               = type;
+
+  if (credential != NULL)
+  {
+    cardano_credential_ref(credential);
+    (*drep)->credential = credential;
+  }
+  else
+  {
+    (*drep)->credential = NULL;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_from_string(
+  const char*      bech32_string,
+  const size_t     string_length,
+  cardano_drep_t** drep)
+{
+  if (bech32_string == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (string_length == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t       hrp_size    = 0;
+  const size_t data_length = cardano_encoding_bech32_get_decoded_length(bech32_string, string_length, &hrp_size);
+
+  if ((hrp_size == 0U) || (data_length == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  char* hrp = (char*)_cardano_malloc(hrp_size);
+
+  if (hrp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  byte_t* decoded_data = (byte_t*)_cardano_malloc(data_length);
+
+  if (decoded_data == NULL)
+  {
+    _cardano_free(hrp);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_encoding_bech32_decode(bech32_string, string_length, hrp, hrp_size, decoded_data, data_length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return result;
+  }
+
+  if ((strncmp(hrp, "drep", 4) != 0) && (strncmp(hrp, "drep_script", 11)) != 0)
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if ((data_length != CREDENTIAL_HASH_SIZE) && (data_length != DREP_CIP129_PAYLOAD_SIZE)) // CIP-0105 or CIP-0129
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (data_length == CREDENTIAL_HASH_SIZE)
+  {
+    // CIP-0105
+    cardano_credential_t*           credential = NULL;
+    const cardano_credential_type_t type       = (hrp_size == 5U) ? CARDANO_CREDENTIAL_TYPE_KEY_HASH : CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH;
+
+    result = cardano_credential_from_hash_bytes(decoded_data, data_length, type, &credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      _cardano_free(hrp);
+      _cardano_free(decoded_data);
+
+      return result;
+    }
+
+    result = cardano_drep_new((cardano_drep_type_t)type, credential, drep);
+    cardano_credential_unref(&credential);
+  }
+  else
+  {
+    // CIP-0129
+    assert(data_length == DREP_CIP129_PAYLOAD_SIZE);
+    byte_t header = decoded_data[0];
+
+    // Values in header are offset by 2. The values 0 and 1 are reserved
+    // to prevent accidental conflicts with Cardano Address Network tags, ensuring
+    // that governance identifiers remain distinct and are not inadvertently processed as addresses.
+    byte_t                        raw_type            = (byte_t)(header & 0x0FU);
+    cardano_credential_type_t     type                = (cardano_credential_type_t)(byte_t)(raw_type - (byte_t)KEY_TYPE_OFFSET);
+    cardano_governance_key_type_t governance_key_type = (cardano_governance_key_type_t)(byte_t)((header >> 4U) & 0x0FU);
+
+    if (raw_type < KEY_TYPE_OFFSET)
+    {
+      _cardano_free(hrp);
+      _cardano_free(decoded_data);
+
+      return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+    }
+
+    if (governance_key_type != CARDANO_GOVERNANCE_KEY_TYPE_DREP)
+    {
+      _cardano_free(hrp);
+      _cardano_free(decoded_data);
+
+      return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+    }
+
+    cardano_credential_t* credential = NULL;
+    result                           = cardano_credential_from_hash_bytes(&decoded_data[DREP_HEADER_SIZE], data_length - DREP_HEADER_SIZE, type, &credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      _cardano_free(hrp);
+      _cardano_free(decoded_data);
+
+      return result;
+    }
+
+    result = cardano_drep_new((cardano_drep_type_t)type, credential, drep);
+    cardano_credential_unref(&credential);
+  }
+
+  _cardano_free(hrp);
+  _cardano_free(decoded_data);
+
+  return result;
+}
+
+cardano_error_t
+cardano_drep_from_cbor(cardano_cbor_reader_t* reader, cardano_drep_t** drep)
+{
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *drep = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "DRep";
+
+  int64_t               array_size          = 0;
+  const cardano_error_t expect_array_result = cardano_cbor_reader_read_start_array(reader, &array_size);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *drep = NULL;
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "drep_type",
+    reader,
+    &type,
+    CARDANO_DREP_TYPE_KEY_HASH,
+    CARDANO_DREP_TYPE_NO_CONFIDENCE);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    *drep = NULL;
+    return read_uint_result;
+  }
+
+  if ((type == (uint64_t)CARDANO_DREP_TYPE_KEY_HASH) || (type == (uint64_t)CARDANO_DREP_TYPE_SCRIPT_HASH))
+  {
+    if (array_size < DREP_ARRAY_SIZE)
+    {
+      cardano_cbor_reader_set_last_error(reader, "DRep: unexpected array size, expected 2");
+
+      *drep = NULL;
+      return CARDANO_ERROR_DECODING;
+    }
+
+    cardano_buffer_t*     credential_buffer        = NULL;
+    const cardano_error_t credential_buffer_result = cardano_cbor_reader_read_bytestring(reader, &credential_buffer);
+
+    if (credential_buffer_result != CARDANO_SUCCESS)
+    {
+      *drep = NULL;
+      return credential_buffer_result;
+    }
+
+    cardano_credential_t* credential        = NULL;
+    const cardano_error_t credential_result = cardano_credential_from_hash_bytes(
+      cardano_buffer_get_data(credential_buffer),
+      cardano_buffer_get_size(credential_buffer),
+      (cardano_credential_type_t)type,
+      &credential);
+
+    cardano_buffer_unref(&credential_buffer);
+
+    if (credential_result != CARDANO_SUCCESS)
+    {
+      *drep = NULL;
+      return credential_result;
+    }
+
+    const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+    if (expect_end_array_result != CARDANO_SUCCESS)
+    {
+      cardano_credential_unref(&credential);
+      *drep = NULL;
+      return expect_end_array_result;
+    }
+
+    const cardano_error_t new_drep_result = cardano_drep_new((cardano_drep_type_t)type, credential, drep);
+    cardano_credential_unref(&credential);
+
+    if (new_drep_result != CARDANO_SUCCESS)
+    {
+      *drep = NULL;
+      return new_drep_result;
+    }
+
+    return CARDANO_SUCCESS;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    *drep = NULL;
+    return expect_end_array_result;
+  }
+
+  return cardano_drep_new((cardano_drep_type_t)type, NULL, drep);
+}
+
+cardano_error_t
+cardano_drep_to_cbor(
+  const cardano_drep_t*  drep,
+  cardano_cbor_writer_t* writer)
+{
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  int64_t array_size = ((drep->type == CARDANO_DREP_TYPE_NO_CONFIDENCE) || (drep->type == CARDANO_DREP_TYPE_ABSTAIN)) ? 1 : DREP_ARRAY_SIZE;
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(writer, array_size);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, drep->type);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  if (array_size == DREP_ARRAY_SIZE)
+  {
+    cardano_credential_t* credential = drep->credential;
+
+    cardano_error_t credential_result = cardano_cbor_writer_write_bytestring(
+      writer,
+      cardano_credential_get_hash_bytes(credential),
+      cardano_credential_get_hash_bytes_size(credential));
+
+    if (credential_result != CARDANO_SUCCESS)
+    {
+      return credential_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_to_cip116_json(
+  const cardano_drep_t*  drep,
+  cardano_json_writer_t* writer)
+{
+  if ((drep == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_drep_type_t type  = CARDANO_DREP_TYPE_KEY_HASH;
+  cardano_error_t     error = cardano_drep_get_type(drep, &type);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  switch (type)
+  {
+    case CARDANO_DREP_TYPE_KEY_HASH:
+    case CARDANO_DREP_TYPE_SCRIPT_HASH:
+    {
+      error = cardano_credential_to_cip116_json(drep->credential, writer);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      break;
+    }
+    case CARDANO_DREP_TYPE_ABSTAIN:
+    {
+      cardano_json_writer_write_start_object(writer);
+      cardano_json_writer_write_property_name(writer, "tag", 3);
+      cardano_json_writer_write_string(writer, "always_abstain", 14);
+      cardano_json_writer_write_end_object(writer);
+      break;
+    }
+    case CARDANO_DREP_TYPE_NO_CONFIDENCE:
+    {
+      cardano_json_writer_write_start_object(writer);
+      cardano_json_writer_write_property_name(writer, "tag", 3);
+      cardano_json_writer_write_string(writer, "always_no_confidence", 20);
+      cardano_json_writer_write_end_object(writer);
+      break;
+    }
+    default:
+    {
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_drep_get_string_size(const cardano_drep_t* drep)
+{
+  if (drep == NULL)
+  {
+    return 0U;
+  }
+
+  if ((drep->type != CARDANO_DREP_TYPE_KEY_HASH) && (drep->type != CARDANO_DREP_TYPE_SCRIPT_HASH))
+  {
+    return 0U;
+  }
+
+  const byte_t gov_key_type = (byte_t)CARDANO_GOVERNANCE_KEY_TYPE_DREP;
+  const byte_t type         = (byte_t)drep->type + (byte_t)KEY_TYPE_OFFSET;
+  const byte_t header       = (gov_key_type << 4) | type;
+  byte_t       payload[29]  = { 0 };
+
+  payload[0] = header;
+
+  cardano_credential_t* credential = drep->credential;
+
+  cardano_safe_memcpy(&payload[DREP_HEADER_SIZE], CREDENTIAL_HASH_SIZE, cardano_credential_get_hash_bytes(credential), CREDENTIAL_HASH_SIZE);
+
+  return cardano_encoding_bech32_get_encoded_length("drep", 4, payload, DREP_CIP129_PAYLOAD_SIZE);
+}
+
+cardano_error_t
+cardano_drep_to_string(
+  const cardano_drep_t* drep,
+  char*                 data,
+  size_t                size)
+{
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size < cardano_drep_get_string_size(drep))
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if ((drep->type != CARDANO_DREP_TYPE_KEY_HASH) && (drep->type != CARDANO_DREP_TYPE_SCRIPT_HASH))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  const byte_t gov_key_type = (byte_t)CARDANO_GOVERNANCE_KEY_TYPE_DREP;
+  const byte_t type         = (byte_t)drep->type + (byte_t)KEY_TYPE_OFFSET;
+  const byte_t header       = (gov_key_type << 4) | type;
+  byte_t       payload[29]  = { 0 };
+
+  payload[0] = header;
+
+  cardano_credential_t* credential = drep->credential;
+
+  cardano_safe_memcpy(&payload[DREP_HEADER_SIZE], CREDENTIAL_HASH_SIZE, cardano_credential_get_hash_bytes(credential), CREDENTIAL_HASH_SIZE);
+
+  return cardano_encoding_bech32_encode("drep", 4, payload, DREP_CIP129_PAYLOAD_SIZE, data, size);
+}
+
+cardano_error_t
+cardano_drep_get_credential(cardano_drep_t* drep, cardano_credential_t** credential)
+{
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((drep->type != CARDANO_DREP_TYPE_KEY_HASH) && (drep->type != CARDANO_DREP_TYPE_SCRIPT_HASH))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_credential_ref(drep->credential);
+  *credential = drep->credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_set_credential(cardano_drep_t* drep, cardano_credential_t* credential)
+{
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((drep->type != CARDANO_DREP_TYPE_KEY_HASH) && (drep->type != CARDANO_DREP_TYPE_SCRIPT_HASH))
+  {
+    cardano_drep_set_last_error(drep, "DRep: only key hash and script hash DRep types can have a credential");
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&drep->credential);
+  drep->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_get_type(const cardano_drep_t* drep, cardano_drep_type_t* type)
+{
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = drep->type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_set_type(cardano_drep_t* drep, const cardano_drep_type_t type)
+{
+  if (drep == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  drep->type = type;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_drep_unref(cardano_drep_t** drep)
+{
+  if ((drep == NULL) || (*drep == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*drep)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *drep = NULL;
+    return;
+  }
+}
+
+void
+cardano_drep_ref(cardano_drep_t* drep)
+{
+  if (drep == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&drep->base);
+}
+
+size_t
+cardano_drep_refcount(const cardano_drep_t* drep)
+{
+  if (drep == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&drep->base);
+}
+
+void
+cardano_drep_set_last_error(cardano_drep_t* drep, const char* message)
+{
+  cardano_object_set_last_error(&drep->base, message);
+}
+
+const char*
+cardano_drep_get_last_error(const cardano_drep_t* drep)
+{
+  return cardano_object_get_last_error(&drep->base);
+}
+
+cardano_error_t
+cardano_drep_deep_clone(const cardano_drep_t* source, cardano_drep_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_drep_t* copy = _cardano_malloc(sizeof(cardano_drep_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  copy->credential         = NULL;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/ex_units.c b/vendor/src/common/ex_units.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/ex_units.c
@@ -0,0 +1,376 @@
+/**
+ * \file ex_units.c
+ *
+ * \author angel.castillo
+ * \date   May 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/ex_units.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EX_UNITS_EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano ex_units.
+ */
+typedef struct cardano_ex_units_t
+{
+    cardano_object_t base;
+    uint64_t         memory;
+    uint64_t         cpu;
+} cardano_ex_units_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a ex_units object.
+ *
+ * This function is responsible for properly deallocating a execution units object (`cardano_ex_units_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the ex_units object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_ex_units_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the ex_units
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_ex_units_deallocate(void* object)
+{
+  assert(object != NULL);
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_ex_units_new(const uint64_t memory, const uint64_t cpu_steps, cardano_ex_units_t** ex_units)
+{
+  if (ex_units == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *ex_units = _cardano_malloc(sizeof(cardano_ex_units_t));
+
+  if (*ex_units == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*ex_units)->base.deallocator   = cardano_ex_units_deallocate;
+  (*ex_units)->base.ref_count     = 1;
+  (*ex_units)->base.last_error[0] = '\0';
+
+  (*ex_units)->memory = memory;
+  (*ex_units)->cpu    = cpu_steps;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ex_units_from_cbor(cardano_cbor_reader_t* reader, cardano_ex_units_t** ex_units)
+{
+  if (ex_units == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *ex_units = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "ex_units";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EX_UNITS_EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *ex_units = NULL;
+    return expect_array_result;
+  }
+
+  uint64_t              memory           = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "memory",
+    reader,
+    &memory,
+    0,
+    UINT64_MAX);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    *ex_units = NULL;
+    return read_uint_result;
+  }
+
+  uint64_t              cpu_steps       = 0U;
+  const cardano_error_t read_cpu_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "cpu",
+    reader,
+    &cpu_steps,
+    0,
+    UINT64_MAX);
+
+  if (read_cpu_result != CARDANO_SUCCESS)
+  {
+    *ex_units = NULL;
+    return read_cpu_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    *ex_units = NULL;
+
+    return expect_end_array_result;
+  }
+
+  return cardano_ex_units_new(memory, cpu_steps, ex_units);
+}
+
+cardano_error_t
+cardano_ex_units_to_cbor(const cardano_ex_units_t* ex_units, cardano_cbor_writer_t* writer)
+{
+  if (ex_units == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(writer, EX_UNITS_EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, ex_units->memory);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  return cardano_cbor_writer_write_uint(writer, ex_units->cpu);
+}
+
+cardano_error_t
+cardano_ex_units_to_cip116_json(
+  const cardano_ex_units_t* ex_units,
+  cardano_json_writer_t*    writer)
+{
+  if ((ex_units == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "mem", 3);
+  cardano_json_writer_write_uint_as_string(writer, ex_units->memory);
+
+  cardano_json_writer_write_property_name(writer, "steps", 5);
+  cardano_json_writer_write_uint_as_string(writer, ex_units->cpu);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_ex_units_get_memory(const cardano_ex_units_t* ex_units)
+{
+  if (ex_units == NULL)
+  {
+    return 0;
+  }
+
+  return ex_units->memory;
+}
+
+cardano_error_t
+cardano_ex_units_get_memory_ex(const cardano_ex_units_t* ex_units, uint64_t* memory)
+{
+  if ((ex_units == NULL) || (memory == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *memory = ex_units->memory;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ex_units_set_memory(cardano_ex_units_t* ex_units, const uint64_t memory)
+{
+  if (ex_units == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  ex_units->memory = memory;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_ex_units_get_cpu_steps(const cardano_ex_units_t* ex_units)
+{
+  if (ex_units == NULL)
+  {
+    return 0;
+  }
+
+  return ex_units->cpu;
+}
+
+cardano_error_t
+cardano_ex_units_get_cpu_steps_ex(const cardano_ex_units_t* ex_units, uint64_t* steps)
+{
+  if ((ex_units == NULL) || (steps == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *steps = ex_units->cpu;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ex_units_set_cpu_steps(cardano_ex_units_t* ex_units, const uint64_t cpu_steps)
+{
+  if (ex_units == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  ex_units->cpu = cpu_steps;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_ex_units_unref(cardano_ex_units_t** ex_units)
+{
+  if ((ex_units == NULL) || (*ex_units == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*ex_units)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *ex_units = NULL;
+    return;
+  }
+}
+
+void
+cardano_ex_units_ref(cardano_ex_units_t* ex_units)
+{
+  if (ex_units == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&ex_units->base);
+}
+
+size_t
+cardano_ex_units_refcount(const cardano_ex_units_t* ex_units)
+{
+  if (ex_units == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&ex_units->base);
+}
+
+void
+cardano_ex_units_set_last_error(cardano_ex_units_t* ex_units, const char* message)
+{
+  cardano_object_set_last_error(&ex_units->base, message);
+}
+
+const char*
+cardano_ex_units_get_last_error(const cardano_ex_units_t* ex_units)
+{
+  return cardano_object_get_last_error(&ex_units->base);
+}
+
+cardano_error_t
+cardano_ex_units_deep_clone(const cardano_ex_units_t* source, cardano_ex_units_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ex_units_t* copy = _cardano_malloc(sizeof(cardano_ex_units_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->memory             = source->memory;
+  copy->cpu                = source->cpu;
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/governance_action_id.c b/vendor/src/common/governance_action_id.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/governance_action_id.c
@@ -0,0 +1,774 @@
+/**
+ * \file governance_action_id.c
+ *
+ * \author angel.castillo
+ * \date   Apr 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/governance_action_id.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <cardano/encoding/bech32.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t GOVERNANCE_ACTION_ID_ARRAY_SIZE  = 2;
+static const char*   GOVERNANCE_ACTION_ID_PREFIX      = "gov_action";
+static const size_t  GOVERNANCE_ACTION_ID_PREFIX_SIZE = 10;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano governance_action_id.
+ */
+typedef struct cardano_governance_action_id_t
+{
+    cardano_object_t base;
+    uint64_t         index;
+    byte_t           hash_bytes[32];
+    char             hash_hex[65];
+    char             cip129_str[1024];
+} cardano_governance_action_id_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a governance_action_id object.
+ *
+ * This function is responsible for properly deallocating a governance action id object (`cardano_governance_action_id_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the governance_action_id object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_governance_action_id_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the governance_action_id
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_governance_action_id_deallocate(void* object)
+{
+  assert(object != NULL);
+  _cardano_free(object);
+}
+
+/**
+ * \brief Encodes a transaction ID and index into a CIP-29 compliant governance action id Bech32 format.
+ *
+ * The Cardano Conway era introduces governance actions (gov actions), which are uniquely identified by the transaction ID
+ * they were submitted in and an index within the transaction. This function combines the transaction ID (32 bytes) and the index
+ * (1 byte) into a single byte string, then encodes it into a CIP-29 compliant Bech32 string representation.
+ *
+ * \param[in]  bytes       A pointer to the 32-byte transaction ID. This parameter must not be NULL.
+ * \param[in]  bytes_size  The size of the `bytes` array in bytes. Must be 32 to represent a valid transaction ID.
+ * \param[in]  index       A single byte representing the governance action index within the transaction.
+ * \param[out] dest        A pointer to a buffer where the encoded Bech32 string will be stored.
+ * \param[in]  dest_size   The size of the buffer in bytes. Must be large enough to hold the Bech32 string including null-termination.
+ *
+ * \return \ref CARDANO_SUCCESS if the encoding was successful, or an appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+to_cip29_bech32(
+  const byte_t* bytes,
+  const size_t  bytes_size,
+  const byte_t  index,
+  char*         dest,
+  const size_t  dest_size)
+{
+  if (bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  byte_t cip29_payload[33] = { 0 };
+
+  cardano_safe_memcpy(cip29_payload, 32, bytes, bytes_size);
+  cip29_payload[32] = index;
+
+  cardano_error_t result = cardano_encoding_bech32_encode(GOVERNANCE_ACTION_ID_PREFIX, GOVERNANCE_ACTION_ID_PREFIX_SIZE, cip29_payload, 33, dest, dest_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_governance_action_id_new(const cardano_blake2b_hash_t* hash, const uint64_t index, cardano_governance_action_id_t** governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    *governance_action_id = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *governance_action_id = _cardano_malloc(sizeof(cardano_governance_action_id_t));
+
+  if (*governance_action_id == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*governance_action_id)->base.deallocator   = cardano_governance_action_id_deallocate;
+  (*governance_action_id)->base.ref_count     = 1;
+  (*governance_action_id)->base.last_error[0] = '\0';
+  (*governance_action_id)->index              = index;
+
+  CARDANO_UNUSED(memset((*governance_action_id)->hash_bytes, 0, sizeof((*governance_action_id)->hash_bytes)));
+  CARDANO_UNUSED(memset((*governance_action_id)->hash_hex, 0, sizeof((*governance_action_id)->hash_hex)));
+  CARDANO_UNUSED(memset((*governance_action_id)->cip129_str, 0, sizeof((*governance_action_id)->cip129_str)));
+
+  const size_t hash_size = cardano_blake2b_hash_get_bytes_size(hash);
+
+  if (hash_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_256)
+  {
+    cardano_governance_action_id_unref(governance_action_id);
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_error_t copy_hash_result = cardano_blake2b_hash_to_bytes(hash, (*governance_action_id)->hash_bytes, sizeof((*governance_action_id)->hash_bytes));
+
+  assert(copy_hash_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hash_result);
+
+  cardano_error_t copy_hex_result = cardano_blake2b_hash_to_hex(hash, (*governance_action_id)->hash_hex, sizeof((*governance_action_id)->hash_hex));
+
+  assert(copy_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hex_result);
+
+  const cardano_error_t bech32_result = to_cip29_bech32((*governance_action_id)->hash_bytes, sizeof((*governance_action_id)->hash_bytes), (byte_t)index, (*governance_action_id)->cip129_str, sizeof((*governance_action_id)->cip129_str));
+
+  if (bech32_result != CARDANO_SUCCESS)
+  {
+    cardano_governance_action_id_unref(governance_action_id);
+  }
+
+  return bech32_result;
+}
+
+cardano_error_t
+cardano_governance_action_id_from_bech32(
+  const char*                      data,
+  const size_t                     size,
+  cardano_governance_action_id_t** action_id)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  if (action_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t       hrp_size  = 0;
+  const size_t data_size = cardano_encoding_bech32_get_decoded_length(data, size, &hrp_size);
+
+  // 32 bytes for the hash and 1 byte for the index
+  if (data_size != 33U)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  char* hrp = _cardano_malloc(hrp_size);
+
+  if (hrp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  byte_t* decoded_data = _cardano_malloc(data_size);
+
+  if (decoded_data == NULL)
+  {
+    _cardano_free(hrp);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t decode_result = cardano_encoding_bech32_decode(data, size, hrp, hrp_size, decoded_data, data_size);
+
+  if (decode_result != CARDANO_SUCCESS)
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return decode_result;
+  }
+
+  hrp_size -= 1U;
+
+  if ((hrp_size != cardano_safe_strlen(GOVERNANCE_ACTION_ID_PREFIX, GOVERNANCE_ACTION_ID_PREFIX_SIZE)) || (strncmp(hrp, GOVERNANCE_ACTION_ID_PREFIX, hrp_size) != 0))
+  {
+    _cardano_free(hrp);
+    _cardano_free(decoded_data);
+
+    return CARDANO_ERROR_INVALID_ADDRESS_FORMAT;
+  }
+
+  byte_t          index  = decoded_data[data_size - 1U];
+  cardano_error_t result = cardano_governance_action_id_from_hash_bytes(decoded_data, data_size - 1U, index, action_id);
+
+  _cardano_free(hrp);
+  _cardano_free(decoded_data);
+
+  return result;
+}
+
+cardano_error_t
+cardano_governance_action_id_from_hash_hex(const char* hex, size_t hex_size, uint64_t index, cardano_governance_action_id_t** governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex == NULL)
+  {
+    *governance_action_id = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex_size != ((size_t)CARDANO_BLAKE2B_HASH_SIZE_256 * 2U))
+  {
+    *governance_action_id = NULL;
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = cardano_blake2b_hash_from_hex(hex, hex_size, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    *governance_action_id = NULL;
+    return read_hash_result;
+  }
+
+  cardano_error_t new_governance_action_id_result = cardano_governance_action_id_new(hash, index, governance_action_id);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_governance_action_id_result != CARDANO_SUCCESS)
+  {
+    *governance_action_id = NULL;
+    return new_governance_action_id_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_governance_action_id_from_hash_bytes(
+  const byte_t*                    data,
+  size_t                           data_size,
+  uint64_t                         index,
+  cardano_governance_action_id_t** governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    *governance_action_id = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_256)
+  {
+    *governance_action_id = NULL;
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = cardano_blake2b_hash_from_bytes(data, data_size, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    *governance_action_id = NULL;
+    return read_hash_result;
+  }
+
+  cardano_error_t new_governance_action_id_result = cardano_governance_action_id_new(hash, index, governance_action_id);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_governance_action_id_result != CARDANO_SUCCESS)
+  {
+    *governance_action_id = NULL;
+    return new_governance_action_id_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_governance_action_id_from_cbor(cardano_cbor_reader_t* reader, cardano_governance_action_id_t** governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *governance_action_id = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "governance_action_id";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)GOVERNANCE_ACTION_ID_ARRAY_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *governance_action_id = NULL;
+    return expect_array_result;
+  }
+
+  cardano_buffer_t*     byte_string             = NULL;
+  const cardano_error_t read_byte_string_result = cardano_cbor_validate_byte_string_of_size(
+    validator_name,
+    reader,
+    &byte_string,
+    CARDANO_BLAKE2B_HASH_SIZE_256);
+
+  if (read_byte_string_result != CARDANO_SUCCESS)
+  {
+    *governance_action_id = NULL;
+    return read_byte_string_result;
+  }
+
+  uint64_t              index            = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "governance_action_id_type",
+    reader,
+    &index,
+    0,
+    UINT64_MAX);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&byte_string);
+
+    *governance_action_id = NULL;
+    return read_uint_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&byte_string);
+    *governance_action_id = NULL;
+
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t new_governance_action_id_result = cardano_governance_action_id_from_hash_bytes(
+    cardano_buffer_get_data(byte_string),
+    cardano_buffer_get_size(byte_string),
+    index,
+    governance_action_id);
+
+  cardano_buffer_unref(&byte_string);
+
+  if (new_governance_action_id_result != CARDANO_SUCCESS)
+  {
+    *governance_action_id = NULL;
+    return new_governance_action_id_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_governance_action_id_to_cbor(
+  const cardano_governance_action_id_t* governance_action_id,
+  cardano_cbor_writer_t*                writer)
+{
+  if (governance_action_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(writer, GOVERNANCE_ACTION_ID_ARRAY_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_bytes_result = cardano_cbor_writer_write_bytestring(writer, governance_action_id->hash_bytes, sizeof(governance_action_id->hash_bytes));
+
+  if (write_bytes_result != CARDANO_SUCCESS)
+  {
+    return write_bytes_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, governance_action_id->index);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_governance_action_id_to_cip116_json(
+  const cardano_governance_action_id_t* action_id,
+  cardano_json_writer_t*                writer)
+{
+  if ((action_id == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "transaction_id", 14);
+  cardano_json_writer_write_bytes_as_hex(writer, action_id->hash_bytes, sizeof(action_id->hash_bytes));
+  cardano_json_writer_write_property_name(writer, "gov_action_index", 16);
+  cardano_json_writer_write_uint_as_string(writer, action_id->index);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_governance_action_id_get_bech32_size(const cardano_governance_action_id_t* governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_safe_strlen(governance_action_id->cip129_str, sizeof(governance_action_id->cip129_str)) + 1U;
+}
+
+cardano_error_t
+cardano_governance_action_id_to_bech32(
+  const cardano_governance_action_id_t* governance_action_id,
+  char*                                 data,
+  size_t                                size)
+{
+  if (governance_action_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t cip29_size = cardano_governance_action_id_get_bech32_size(governance_action_id);
+
+  if (size < cip29_size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  cardano_safe_memcpy(data, size, governance_action_id->cip129_str, cip29_size - 1U);
+  data[cip29_size - 1U] = '\0';
+
+  return CARDANO_SUCCESS;
+}
+
+const char*
+cardano_governance_action_id_get_string(const cardano_governance_action_id_t* governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return NULL;
+  }
+
+  return governance_action_id->cip129_str;
+}
+
+cardano_blake2b_hash_t*
+cardano_governance_action_id_get_hash(const cardano_governance_action_id_t* governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_t* hash             = NULL;
+  cardano_error_t         read_hash_result = cardano_blake2b_hash_from_bytes(governance_action_id->hash_bytes, sizeof(governance_action_id->hash_bytes), &hash);
+
+  assert(read_hash_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(read_hash_result);
+
+  return hash;
+}
+
+size_t
+cardano_governance_action_id_get_hash_bytes_size(const cardano_governance_action_id_t* governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return 0U;
+  }
+
+  return sizeof(governance_action_id->hash_bytes);
+}
+
+const byte_t*
+cardano_governance_action_id_get_hash_bytes(const cardano_governance_action_id_t* governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return NULL;
+  }
+
+  return governance_action_id->hash_bytes;
+}
+
+size_t
+cardano_governance_action_id_get_hash_hex_size(const cardano_governance_action_id_t* governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_safe_strlen(governance_action_id->hash_hex, sizeof(governance_action_id->hash_hex)) + 1U;
+}
+
+const char*
+cardano_governance_action_id_get_hash_hex(const cardano_governance_action_id_t* governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return NULL;
+  }
+
+  return governance_action_id->hash_hex;
+}
+
+cardano_error_t
+cardano_governance_action_id_get_index(
+  const cardano_governance_action_id_t* governance_action_id,
+  uint64_t*                             index)
+{
+  if (governance_action_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *index = governance_action_id->index;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_governance_action_id_set_index(
+  cardano_governance_action_id_t* governance_action_id,
+  uint64_t                        index)
+{
+  if (governance_action_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  governance_action_id->index = index;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_governance_action_id_set_hash(cardano_governance_action_id_t* governance_action_id, const cardano_blake2b_hash_t* hash)
+{
+  if (governance_action_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t hash_size = cardano_blake2b_hash_get_bytes_size(hash);
+
+  if (hash_size != (size_t)CARDANO_BLAKE2B_HASH_SIZE_256)
+  {
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_error_t copy_hash_result = cardano_blake2b_hash_to_bytes(hash, &governance_action_id->hash_bytes[0], sizeof(governance_action_id->hash_bytes));
+
+  assert(copy_hash_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hash_result);
+
+  cardano_error_t copy_hex_result = cardano_blake2b_hash_to_hex(hash, governance_action_id->hash_hex, sizeof(governance_action_id->hash_hex));
+
+  assert(copy_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(copy_hex_result);
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_governance_action_id_equals(
+  const cardano_governance_action_id_t* lhs,
+  const cardano_governance_action_id_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  if (lhs->index != rhs->index)
+  {
+    return false;
+  }
+
+  return (memcmp(lhs->hash_bytes, rhs->hash_bytes, sizeof(lhs->hash_bytes)) == 0);
+}
+
+void
+cardano_governance_action_id_unref(cardano_governance_action_id_t** governance_action_id)
+{
+  if ((governance_action_id == NULL) || (*governance_action_id == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*governance_action_id)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *governance_action_id = NULL;
+    return;
+  }
+}
+
+void
+cardano_governance_action_id_ref(cardano_governance_action_id_t* governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&governance_action_id->base);
+}
+
+size_t
+cardano_governance_action_id_refcount(const cardano_governance_action_id_t* governance_action_id)
+{
+  if (governance_action_id == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&governance_action_id->base);
+}
+
+void
+cardano_governance_action_id_set_last_error(cardano_governance_action_id_t* governance_action_id, const char* message)
+{
+  cardano_object_set_last_error(&governance_action_id->base, message);
+}
+
+const char*
+cardano_governance_action_id_get_last_error(const cardano_governance_action_id_t* governance_action_id)
+{
+  return cardano_object_get_last_error(&governance_action_id->base);
+}
+
+cardano_error_t
+cardano_governance_action_id_deep_clone(const cardano_governance_action_id_t* source, cardano_governance_action_id_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_governance_action_id_t* copy = _cardano_malloc(sizeof(cardano_governance_action_id_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->index              = source->index;
+  CARDANO_UNUSED(memcpy(copy->hash_bytes, source->hash_bytes, sizeof(copy->hash_bytes)));
+  CARDANO_UNUSED(memcpy(copy->hash_hex, source->hash_hex, sizeof(copy->hash_hex)));
+  CARDANO_UNUSED(memcpy(copy->cip129_str, source->cip129_str, sizeof(copy->cip129_str)));
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/guard_set.c b/vendor/src/common/guard_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/guard_set.c
@@ -0,0 +1,637 @@
+/**
+ * \file guard_set.c
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/guard_set.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano guard set.
+ */
+typedef struct cardano_guard_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             use_tags;
+} cardano_guard_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a guard set object.
+ *
+ * This function is responsible for properly deallocating a guard set object (`cardano_guard_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the guard_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_guard_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the guard_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_guard_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_guard_set_t* list = (cardano_guard_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/**
+ * \brief Determines whether a guard set must be encoded as an ordered set of credentials.
+ *
+ * A guard set is encoded as a set of bare key hashes while every member is a key hash
+ * credential; the presence of at least one script hash credential switches the encoding
+ * to the ordered set of credentials form.
+ *
+ * \param[in] array Pointer to the array holding the members of the guard set.
+ *
+ * \return \c true if at least one member is a script hash credential; \c false otherwise.
+ */
+static bool
+uses_credential_form(const cardano_array_t* array)
+{
+  assert(array != NULL);
+
+  bool result = false;
+
+  for (size_t i = 0U; i < cardano_array_get_size(array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(array, i);
+
+    assert(element != NULL);
+
+    cardano_credential_type_t type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+
+    const cardano_error_t get_type_result = cardano_credential_get_type((const cardano_credential_t*)((const void*)element), &type);
+
+    assert(get_type_result == CARDANO_SUCCESS);
+    CARDANO_UNUSED(get_type_result);
+
+    cardano_object_unref(&element);
+
+    if (type == CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH)
+    {
+      result = true;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Reads a bare key hash guard from a CBOR stream.
+ *
+ * Reads a 28 byte key hash byte string and wraps it as a key hash credential.
+ *
+ * \param[in,out] reader The CBOR reader positioned at the key hash byte string.
+ * \param[out] element On success, points to a newly created key hash credential.
+ *
+ * \return \ref CARDANO_SUCCESS if the key hash was successfully read, or an appropriate
+ *         error code indicating the failure reason.
+ */
+static cardano_error_t
+read_key_hash_guard(cardano_cbor_reader_t* reader, cardano_credential_t** element)
+{
+  assert(reader != NULL);
+  assert(element != NULL);
+
+  cardano_buffer_t* key_hash = NULL;
+
+  cardano_error_t result = cardano_cbor_validate_byte_string_of_size(
+    "guard_set",
+    reader,
+    &key_hash,
+    CARDANO_BLAKE2B_HASH_SIZE_224);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_credential_from_hash_bytes(
+    cardano_buffer_get_data(key_hash),
+    cardano_buffer_get_size(key_hash),
+    CARDANO_CREDENTIAL_TYPE_KEY_HASH,
+    element);
+
+  cardano_buffer_unref(&key_hash);
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_guard_set_new(cardano_guard_set_t** guard_set)
+{
+  if (guard_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_guard_set_t* list = _cardano_malloc(sizeof(cardano_guard_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_guard_set_deallocate;
+
+  list->array    = cardano_array_new(128);
+  list->use_tags = true;
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *guard_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_guard_set_from_cbor(cardano_cbor_reader_t* reader, cardano_guard_set_t** guard_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (guard_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_guard_set_t* list   = NULL;
+  cardano_error_t      result = cardano_guard_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_guard_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  list->use_tags = state == CARDANO_CBOR_READER_STATE_TAG;
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("guard_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_guard_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_guard_set_unref(&list);
+    return result;
+  }
+
+  result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_guard_set_unref(&list);
+    return result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'guard_set', the set must not be empty.");
+    cardano_guard_set_unref(&list);
+
+    return CARDANO_ERROR_INVALID_CBOR_ARRAY_SIZE;
+  }
+
+  const bool is_credential_form = state == CARDANO_CBOR_READER_STATE_START_ARRAY;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_guard_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_credential_t* element = NULL;
+
+    if (is_credential_form)
+    {
+      result = cardano_credential_from_cbor(reader, &element);
+    }
+    else
+    {
+      result = read_key_hash_guard(reader, &element);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_guard_set_unref(&list);
+      return result;
+    }
+
+    result = cardano_guard_set_add(list, element);
+
+    cardano_credential_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'guard_set', the set must not contain duplicated elements.");
+      cardano_guard_set_unref(&list);
+
+      return result;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("guard_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_guard_set_unref(&list);
+    return result;
+  }
+
+  *guard_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_guard_set_to_cbor(const cardano_guard_set_t* guard_set, cardano_cbor_writer_t* writer)
+{
+  if (guard_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(guard_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (guard_set->use_tags)
+  {
+    result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  const bool   credential_form = uses_credential_form(guard_set->array);
+  const size_t array_size      = cardano_array_get_size(guard_set->array);
+
+  result = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(guard_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(guard_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in guard_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    const cardano_credential_t* credential = (const cardano_credential_t*)((const void*)element);
+
+    if (credential_form)
+    {
+      result = cardano_credential_to_cbor(credential, writer);
+    }
+    else
+    {
+      result = cardano_cbor_writer_write_bytestring(
+        writer,
+        cardano_credential_get_hash_bytes(credential),
+        cardano_credential_get_hash_bytes_size(credential));
+    }
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+size_t
+cardano_guard_set_get_length(const cardano_guard_set_t* guard_set)
+{
+  if (guard_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(guard_set->array);
+}
+
+cardano_error_t
+cardano_guard_set_get(
+  const cardano_guard_set_t* guard_set,
+  size_t                     index,
+  cardano_credential_t**     element)
+{
+  if (guard_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(guard_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_credential_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_guard_set_add(cardano_guard_set_t* guard_set, cardano_credential_t* element)
+{
+  if (guard_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0U; i < cardano_array_get_size(guard_set->array); ++i)
+  {
+    cardano_object_t* object = cardano_array_get(guard_set->array, i);
+
+    const bool duplicated = cardano_credential_equals((const cardano_credential_t*)((const void*)object), element);
+
+    cardano_object_unref(&object);
+
+    if (duplicated)
+    {
+      return CARDANO_ERROR_DUPLICATED_KEY;
+    }
+  }
+
+  const size_t original_size = cardano_array_get_size(guard_set->array);
+  const size_t new_size      = cardano_array_push(guard_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_guard_set_is_tagged(const cardano_guard_set_t* guard_set)
+{
+  if (guard_set == NULL)
+  {
+    return false;
+  }
+
+  return guard_set->use_tags;
+}
+
+cardano_error_t
+cardano_guard_set_set_use_tag(cardano_guard_set_t* guard_set, const bool use_tag)
+{
+  if (guard_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  guard_set->use_tags = use_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_guard_set_to_cip116_json(const cardano_guard_set_t* value, cardano_json_writer_t* writer)
+{
+  if ((value == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0U; i < cardano_array_get_size(value->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(value->array, i);
+
+    if (element == NULL)
+    {
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    const cardano_error_t result = cardano_credential_to_cip116_json((const cardano_credential_t*)((const void*)element), writer);
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_guard_set_unref(cardano_guard_set_t** guard_set)
+{
+  if ((guard_set == NULL) || (*guard_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*guard_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *guard_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_guard_set_ref(cardano_guard_set_t* guard_set)
+{
+  if (guard_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&guard_set->base);
+}
+
+size_t
+cardano_guard_set_refcount(const cardano_guard_set_t* guard_set)
+{
+  if (guard_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&guard_set->base);
+}
+
+void
+cardano_guard_set_set_last_error(cardano_guard_set_t* guard_set, const char* message)
+{
+  cardano_object_set_last_error(&guard_set->base, message);
+}
+
+const char*
+cardano_guard_set_get_last_error(const cardano_guard_set_t* guard_set)
+{
+  return cardano_object_get_last_error(&guard_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_credential_t* copy   = NULL;
+  const cardano_error_t result = cardano_credential_deep_clone((const cardano_credential_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_guard_set_deep_clone(const cardano_guard_set_t* source, cardano_guard_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_guard_set_t* copy = _cardano_malloc(sizeof(cardano_guard_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+  copy->use_tags           = source->use_tags;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/ledger_order.c b/vendor/src/common/ledger_order.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/ledger_order.c
@@ -0,0 +1,376 @@
+/**
+ * \file ledger_order.c
+ *
+ * \author angel.castillo
+ * \date   Oct 28, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "ledger_order.h"
+
+#include <cardano/common/network_id.h>
+#include <cardano/voting_procedures/voter_type.h>
+
+#include "../string_safe.h"
+
+#include <stdbool.h>
+#include <string.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Returns the rank of the role of a voter kind in the ledger voter order.
+ *
+ * The ledger \c Voter type declares \c CommitteeVoter, \c DRepVoter and
+ * \c StakePoolVoter in that order, so the ranks follow that declaration order.
+ *
+ * \param[in] type The voter kind.
+ *
+ * \return The rank of the role of \p type.
+ */
+static byte_t
+voter_role_rank(const cardano_voter_type_t type)
+{
+  static const byte_t LEDGER_COMMITTEE_VOTER  = 0U;
+  static const byte_t LEDGER_DREP_VOTER       = 1U;
+  static const byte_t LEDGER_STAKE_POOL_VOTER = 2U;
+
+  byte_t rank = LEDGER_STAKE_POOL_VOTER;
+
+  switch (type)
+  {
+    case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_KEY_HASH:
+    case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_SCRIPT_HASH:
+    {
+      rank = LEDGER_COMMITTEE_VOTER;
+      break;
+    }
+    case CARDANO_VOTER_TYPE_DREP_KEY_HASH:
+    case CARDANO_VOTER_TYPE_DREP_SCRIPT_HASH:
+    {
+      rank = LEDGER_DREP_VOTER;
+      break;
+    }
+    case CARDANO_VOTER_TYPE_STAKE_POOL_KEY_HASH:
+    default:
+    {
+      rank = LEDGER_STAKE_POOL_VOTER;
+      break;
+    }
+  }
+
+  return rank;
+}
+
+/**
+ * \brief Writes a rank byte followed by the credential key of a credential.
+ *
+ * \param[in] rank The rank byte.
+ * \param[in] credential The credential.
+ * \param[out] key Receives \ref CARDANO_LEDGER_ORDER_KEY_SIZE bytes.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code if the credential key
+ *         cannot be written.
+ */
+static cardano_error_t
+ranked_credential_key(const byte_t rank, const cardano_credential_t* credential, byte_t* key)
+{
+  key[0] = rank;
+
+  return _cardano_ledger_order_credential_key(credential, &key[1]);
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+_cardano_ledger_order_credential_key(const cardano_credential_t* credential, byte_t* key)
+{
+  static const byte_t LEDGER_SCRIPT_CREDENTIAL = 0U;
+  static const byte_t LEDGER_KEY_CREDENTIAL    = 1U;
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_type_t type   = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+  cardano_error_t           result = cardano_credential_get_type(credential, &type);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    key[0] = (type == CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH) ? LEDGER_SCRIPT_CREDENTIAL : LEDGER_KEY_CREDENTIAL;
+
+    cardano_safe_memcpy(
+      &key[1],
+      (size_t)CARDANO_BLAKE2B_HASH_SIZE_224,
+      cardano_credential_get_hash_bytes(credential),
+      cardano_credential_get_hash_bytes_size(credential));
+  }
+
+  return result;
+}
+
+cardano_error_t
+_cardano_ledger_order_voter_key(cardano_voter_t* voter, byte_t* key)
+{
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voter_type_t  type       = CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_KEY_HASH;
+  cardano_credential_t* credential = NULL;
+  cardano_error_t       result     = cardano_voter_get_type(voter, &type);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    credential = cardano_voter_get_credential(voter);
+    result     = ranked_credential_key(voter_role_rank(type), credential, key);
+  }
+
+  cardano_credential_unref(&credential);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_ledger_order_reward_address_key(cardano_reward_address_t* address, byte_t* key)
+{
+  static const byte_t LEDGER_TESTNET = 0U;
+  static const byte_t LEDGER_MAINNET = 1U;
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_network_id_t  network    = CARDANO_NETWORK_ID_MAIN_NET;
+  cardano_credential_t* credential = NULL;
+  cardano_error_t       result     = cardano_reward_address_get_network_id(address, &network);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    credential = cardano_reward_address_get_credential(address);
+    result     = ranked_credential_key((network == CARDANO_NETWORK_ID_MAIN_NET) ? LEDGER_MAINNET : LEDGER_TESTNET, credential, key);
+  }
+
+  cardano_credential_unref(&credential);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_ledger_order_voter_index(cardano_voter_list_t* voters, cardano_voter_t* voter, uint64_t* index)
+{
+  if ((voters == NULL) || (voter == NULL) || (index == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  byte_t          target[CARDANO_LEDGER_ORDER_KEY_SIZE] = { 0 };
+  uint64_t        rank                                  = 0U;
+  bool            found                                 = false;
+  const size_t    count                                 = cardano_voter_list_get_length(voters);
+  cardano_error_t result                                = _cardano_ledger_order_voter_key(voter, target);
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_voter_t* entry                                    = NULL;
+    byte_t           entry_key[CARDANO_LEDGER_ORDER_KEY_SIZE] = { 0 };
+
+    result = cardano_voter_list_get(voters, i, &entry);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = _cardano_ledger_order_voter_key(entry, entry_key);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      const int32_t order = (int32_t)memcmp(entry_key, target, sizeof(target));
+
+      rank  += (order < 0) ? 1U : 0U;
+      found = found || (order == 0);
+    }
+
+    cardano_voter_unref(&entry);
+  }
+
+  if ((result == CARDANO_SUCCESS) && !found)
+  {
+    result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *index = rank;
+  }
+
+  return result;
+}
+
+cardano_error_t
+_cardano_ledger_order_withdrawal_index(cardano_withdrawal_map_t* withdrawals, cardano_reward_address_t* address, uint64_t* index)
+{
+  if ((withdrawals == NULL) || (address == NULL) || (index == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  byte_t          target[CARDANO_LEDGER_ORDER_KEY_SIZE] = { 0 };
+  uint64_t        rank                                  = 0U;
+  bool            found                                 = false;
+  const size_t    count                                 = cardano_withdrawal_map_get_length(withdrawals);
+  cardano_error_t result                                = _cardano_ledger_order_reward_address_key(address, target);
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_reward_address_t* entry                                    = NULL;
+    byte_t                    entry_key[CARDANO_LEDGER_ORDER_KEY_SIZE] = { 0 };
+
+    result = cardano_withdrawal_map_get_key_at(withdrawals, i, &entry);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = _cardano_ledger_order_reward_address_key(entry, entry_key);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      const int32_t order = (int32_t)memcmp(entry_key, target, sizeof(target));
+
+      rank  += (order < 0) ? 1U : 0U;
+      found = found || (order == 0);
+    }
+
+    cardano_reward_address_unref(&entry);
+  }
+
+  if ((result == CARDANO_SUCCESS) && !found)
+  {
+    result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *index = rank;
+  }
+
+  return result;
+}
+
+cardano_error_t
+_cardano_ledger_order_withdrawal_at_index(
+  cardano_withdrawal_map_t*  withdrawals,
+  const uint64_t             index,
+  cardano_reward_address_t** address)
+{
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t              count  = (withdrawals != NULL) ? cardano_withdrawal_map_get_length(withdrawals) : 0U;
+  cardano_reward_address_t* found  = NULL;
+  cardano_error_t           result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < count) && (found == NULL) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_reward_address_t* candidate = NULL;
+    uint64_t                  rank      = 0U;
+
+    result = cardano_withdrawal_map_get_key_at(withdrawals, i, &candidate);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = _cardano_ledger_order_withdrawal_index(withdrawals, candidate, &rank);
+    }
+
+    if ((result == CARDANO_SUCCESS) && (rank == index))
+    {
+      cardano_reward_address_ref(candidate);
+      found = candidate;
+    }
+
+    cardano_reward_address_unref(&candidate);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (found == NULL))
+  {
+    result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *address = found;
+  }
+
+  return result;
+}
+
+cardano_error_t
+_cardano_ledger_order_voter_at_index(
+  cardano_voting_procedures_t* procedures,
+  const uint64_t               index,
+  cardano_voter_t**            voter)
+{
+  if (voter == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voter_list_t* voters = NULL;
+  cardano_voter_t*      found  = NULL;
+  cardano_error_t       result = (procedures != NULL) ? cardano_voting_procedures_get_voters(procedures, &voters) : CARDANO_SUCCESS;
+  const size_t          count  = (voters != NULL) ? cardano_voter_list_get_length(voters) : 0U;
+
+  for (size_t i = 0U; (i < count) && (found == NULL) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_voter_t* candidate = NULL;
+    uint64_t         rank      = 0U;
+
+    result = cardano_voter_list_get(voters, i, &candidate);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = _cardano_ledger_order_voter_index(voters, candidate, &rank);
+    }
+
+    if ((result == CARDANO_SUCCESS) && (rank == index))
+    {
+      cardano_voter_ref(candidate);
+      found = candidate;
+    }
+
+    cardano_voter_unref(&candidate);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (found == NULL))
+  {
+    result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *voter = found;
+  }
+
+  cardano_voter_list_unref(&voters);
+
+  return result;
+}
diff --git a/vendor/src/common/ledger_order.h b/vendor/src/common/ledger_order.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/ledger_order.h
@@ -0,0 +1,190 @@
+/**
+ * \file ledger_order.h
+ *
+ * \author angel.castillo
+ * \date   Oct 28, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_LEDGER_ORDER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_LEDGER_ORDER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+#include <cardano/voting_procedures/voter.h>
+#include <cardano/voting_procedures/voter_list.h>
+#include <cardano/voting_procedures/voting_procedures.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief Sizes of the ledger order keys.
+ *
+ * A credential key is a kind byte followed by the credential hash. A voter key
+ * and a reward account key put a rank byte (the voter role or the network) in
+ * front of the credential key.
+ */
+#define CARDANO_LEDGER_ORDER_CREDENTIAL_KEY_SIZE ((size_t)CARDANO_BLAKE2B_HASH_SIZE_224 + 1U)
+#define CARDANO_LEDGER_ORDER_KEY_SIZE            (CARDANO_LEDGER_ORDER_CREDENTIAL_KEY_SIZE + 1U)
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Writes the key that orders a credential the way the ledger does.
+ *
+ * The ledger derives \c Ord for \c Credential, so script credentials sort before
+ * key credentials and credentials of the same kind sort by hash. Two keys compare
+ * in that order under \c memcmp.
+ *
+ * \param[in] credential The credential.
+ * \param[out] key Receives \ref CARDANO_LEDGER_ORDER_CREDENTIAL_KEY_SIZE bytes.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if \p credential or \p key is NULL.
+ */
+cardano_error_t
+_cardano_ledger_order_credential_key(const cardano_credential_t* credential, byte_t* key);
+
+/**
+ * \brief Writes the key that orders a voter the way the ledger does.
+ *
+ * The ledger derives \c Ord for \c Voter, so committee voters sort first, then
+ * DReps, then stake pools, and voters of the same role sort by credential. Two
+ * keys compare in that order under \c memcmp. A voting redeemer index is the
+ * position of the voter in this order.
+ *
+ * \param[in] voter The voter.
+ * \param[out] key Receives \ref CARDANO_LEDGER_ORDER_KEY_SIZE bytes.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if \p voter or \p key is NULL.
+ */
+cardano_error_t
+_cardano_ledger_order_voter_key(cardano_voter_t* voter, byte_t* key);
+
+/**
+ * \brief Writes the key that orders a reward account the way the ledger does.
+ *
+ * The ledger derives \c Ord for \c AccountAddress, so accounts sort by network,
+ * test networks first, then by credential. Two keys compare in that order under
+ * \c memcmp. A reward redeemer index is the position of the account in this
+ * order.
+ *
+ * \param[in] address The reward account.
+ * \param[out] key Receives \ref CARDANO_LEDGER_ORDER_KEY_SIZE bytes.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if \p address or \p key is NULL.
+ */
+cardano_error_t
+_cardano_ledger_order_reward_address_key(cardano_reward_address_t* address, byte_t* key);
+
+/**
+ * \brief Finds the position of a voter among a list of voters in ledger order.
+ *
+ * The position is the number of voters in \p voters that sort before \p voter.
+ *
+ * \param[in] voters The voters to search.
+ * \param[in] voter The voter to find.
+ * \param[out] index On success, the position of \p voter.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if
+ *         \p voter is not in \p voters.
+ */
+cardano_error_t
+_cardano_ledger_order_voter_index(cardano_voter_list_t* voters, cardano_voter_t* voter, uint64_t* index);
+
+/**
+ * \brief Finds the position of a reward account among withdrawals in ledger order.
+ *
+ * The position is the number of accounts in \p withdrawals that sort before
+ * \p address.
+ *
+ * \param[in] withdrawals The withdrawals to search.
+ * \param[in] address The reward account to find.
+ * \param[out] index On success, the position of \p address.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if
+ *         \p address does not withdraw in \p withdrawals.
+ */
+cardano_error_t
+_cardano_ledger_order_withdrawal_index(cardano_withdrawal_map_t* withdrawals, cardano_reward_address_t* address, uint64_t* index);
+
+/**
+ * \brief Finds the reward account a reward redeemer points to.
+ *
+ * The ledger resolves a reward redeemer index against its map of withdrawals,
+ * which orders accounts by network, test networks first, then script
+ * credentials before key credentials, then by hash. The withdrawal map of the
+ * library is ordered by address bytes, which puts key credentials first, so the
+ * position in the library map is not the redeemer index.
+ *
+ * \param[in] withdrawals The withdrawals of the transaction level. May be NULL.
+ * \param[in] index The redeemer index.
+ * \param[out] address On success, the reward account at \p index in ledger order,
+ *             owned by the caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p address is NULL, \ref CARDANO_ERROR_INDEX_OUT_OF_BOUNDS if \p index
+ *         is past the withdrawals, or another error code otherwise.
+ */
+cardano_error_t
+_cardano_ledger_order_withdrawal_at_index(
+  cardano_withdrawal_map_t*  withdrawals,
+  uint64_t                   index,
+  cardano_reward_address_t** address);
+
+/**
+ * \brief Finds the voter a voting redeemer points to.
+ *
+ * The ledger resolves a voting redeemer index against its map of voting
+ * procedures, which orders committee voters first, then DReps, then stake
+ * pools, each with script credentials before key credentials. The library
+ * orders key credentials first within a role, so the position in the library
+ * map is not the redeemer index.
+ *
+ * \param[in] procedures The voting procedures of the transaction level. May be NULL.
+ * \param[in] index The redeemer index.
+ * \param[out] voter On success, the voter at \p index in ledger order, owned by
+ *             the caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p voter is NULL, \ref CARDANO_ERROR_INDEX_OUT_OF_BOUNDS if \p index is
+ *         past the voters, or another error code otherwise.
+ */
+cardano_error_t
+_cardano_ledger_order_voter_at_index(
+  cardano_voting_procedures_t* procedures,
+  uint64_t                     index,
+  cardano_voter_t**            voter);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_LEDGER_ORDER_H */
diff --git a/vendor/src/common/network_magic.c b/vendor/src/common/network_magic.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/network_magic.c
@@ -0,0 +1,53 @@
+/**
+ * \file network_magic.c
+ *
+ * \author angel.castillo
+ * \date   Sep 28, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/network_magic.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_network_magic_to_string(const cardano_network_magic_t network_magic)
+{
+  const char* message;
+
+  switch (network_magic)
+  {
+    case CARDANO_NETWORK_MAGIC_PREPROD:
+      message = "preprod";
+      break;
+    case CARDANO_NETWORK_MAGIC_PREVIEW:
+      message = "preview";
+      break;
+    case CARDANO_NETWORK_MAGIC_SANCHONET:
+      message = "sanchonet";
+      break;
+    case CARDANO_NETWORK_MAGIC_MAINNET:
+      message = "mainnet";
+      break;
+    default:
+      message = "unknown";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/common/protocol_version.c b/vendor/src/common/protocol_version.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/protocol_version.c
@@ -0,0 +1,360 @@
+/**
+ * \file protocol_version.c
+ *
+ * \author angel.castillo
+ * \date   May 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/protocol_version.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t PROTOCOL_VERSION_EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano protocol version.
+ */
+typedef struct cardano_protocol_version_t
+{
+    cardano_object_t base;
+    uint64_t         major;
+    uint64_t         minor;
+} cardano_protocol_version_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a protocol version object.
+ *
+ * This function is responsible for properly deallocating a protocol version object (`cardano_protocol_version_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the protocol_version object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_protocol_version_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the protocol_version
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_protocol_version_deallocate(void* object)
+{
+  assert(object != NULL);
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_protocol_version_new(
+  const uint64_t               major,
+  const uint64_t               minor,
+  cardano_protocol_version_t** protocol_version)
+{
+  if (protocol_version == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *protocol_version = _cardano_malloc(sizeof(cardano_protocol_version_t));
+
+  if (*protocol_version == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*protocol_version)->base.deallocator   = cardano_protocol_version_deallocate;
+  (*protocol_version)->base.ref_count     = 1;
+  (*protocol_version)->base.last_error[0] = '\0';
+
+  (*protocol_version)->major = major;
+  (*protocol_version)->minor = minor;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_version_from_cbor(cardano_cbor_reader_t* reader, cardano_protocol_version_t** protocol_version)
+{
+  if (protocol_version == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *protocol_version = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "protocol_version";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)PROTOCOL_VERSION_EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *protocol_version = NULL;
+    return expect_array_result;
+  }
+
+  uint64_t              major            = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "major",
+    reader,
+    &major,
+    0,
+    UINT64_MAX);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    *protocol_version = NULL;
+    return read_uint_result;
+  }
+
+  uint64_t              minor             = 0U;
+  const cardano_error_t read_minor_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "minor",
+    reader,
+    &minor,
+    0,
+    UINT32_MAX);
+
+  if (read_minor_result != CARDANO_SUCCESS)
+  {
+    *protocol_version = NULL;
+    return read_minor_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    *protocol_version = NULL;
+
+    return expect_end_array_result;
+  }
+
+  return cardano_protocol_version_new(major, minor, protocol_version);
+}
+
+cardano_error_t
+cardano_protocol_version_to_cbor(const cardano_protocol_version_t* protocol_version, cardano_cbor_writer_t* writer)
+{
+  if (protocol_version == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    PROTOCOL_VERSION_EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, protocol_version->major);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  return cardano_cbor_writer_write_uint(writer, protocol_version->minor);
+}
+
+cardano_error_t
+cardano_protocol_version_to_cip116_json(
+  const cardano_protocol_version_t* version,
+  cardano_json_writer_t*            writer)
+{
+  if ((version == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "major", 5);
+  cardano_json_writer_write_uint(writer, version->major);
+
+  cardano_json_writer_write_property_name(writer, "minor", 5);
+  cardano_json_writer_write_uint(writer, version->minor);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_protocol_version_get_major(const cardano_protocol_version_t* protocol_version)
+{
+  if (protocol_version == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_version->major;
+}
+
+cardano_error_t
+cardano_protocol_version_set_major(cardano_protocol_version_t* protocol_version, const uint64_t major)
+{
+  if (protocol_version == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_version->major = major;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_protocol_version_get_minor(const cardano_protocol_version_t* protocol_version)
+{
+  if (protocol_version == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_version->minor;
+}
+
+cardano_error_t
+cardano_protocol_version_set_minor(cardano_protocol_version_t* protocol_version, const uint64_t minor)
+{
+  if (protocol_version == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (minor > (uint64_t)UINT32_MAX)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_version->minor = minor;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_protocol_version_unref(cardano_protocol_version_t** protocol_version)
+{
+  if ((protocol_version == NULL) || (*protocol_version == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*protocol_version)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *protocol_version = NULL;
+    return;
+  }
+}
+
+void
+cardano_protocol_version_ref(cardano_protocol_version_t* protocol_version)
+{
+  if (protocol_version == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&protocol_version->base);
+}
+
+size_t
+cardano_protocol_version_refcount(const cardano_protocol_version_t* protocol_version)
+{
+  if (protocol_version == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&protocol_version->base);
+}
+
+void
+cardano_protocol_version_set_last_error(cardano_protocol_version_t* protocol_version, const char* message)
+{
+  cardano_object_set_last_error(&protocol_version->base, message);
+}
+
+const char*
+cardano_protocol_version_get_last_error(const cardano_protocol_version_t* protocol_version)
+{
+  return cardano_object_get_last_error(&protocol_version->base);
+}
+
+cardano_error_t
+cardano_protocol_version_deep_clone(const cardano_protocol_version_t* source, cardano_protocol_version_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_protocol_version_t* copy = _cardano_malloc(sizeof(cardano_protocol_version_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->major              = source->major;
+  copy->minor              = source->minor;
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/reward_address_list.c b/vendor/src/common/reward_address_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/reward_address_list.c
@@ -0,0 +1,315 @@
+/**
+ * \file reward_address_list.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/common/reward_address_list.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano reward_address list.
+ */
+typedef struct cardano_reward_address_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_reward_address_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a reward_address list object.
+ *
+ * This function is responsible for properly deallocating a reward_address list object (`cardano_reward_address_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the reward_address_list object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_reward_address_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the reward_address_list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_reward_address_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_reward_address_list_t* list = (cardano_reward_address_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their reward_address.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context A pointer to a context object. This parameter is not used in this function.
+ *
+ * \return A negative value if the address of lhs is less than the address of rhs, zero if they are equal,
+ *         and a positive value if the address of lhs is greater than the address of rhs.
+ */
+static int32_t
+compare_by_bytes(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_reward_address_t* lhs_address = (const cardano_reward_address_t*)((const void*)lhs);
+  const cardano_reward_address_t* rhs_address = (const cardano_reward_address_t*)((const void*)rhs);
+
+  const size_t lhs_size = cardano_reward_address_get_bytes_size(lhs_address);
+  const size_t rhs_size = cardano_reward_address_get_bytes_size(rhs_address);
+
+  if (lhs_size != rhs_size)
+  {
+    return (lhs_size < rhs_size) ? -1 : 1;
+  }
+
+  const uint8_t* lhs_bytes = cardano_reward_address_get_bytes(lhs_address);
+  const uint8_t* rhs_bytes = cardano_reward_address_get_bytes(rhs_address);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_reward_address_list_new(cardano_reward_address_list_t** reward_address_list)
+{
+  if (reward_address_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_list_t* list = _cardano_malloc(sizeof(cardano_reward_address_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_reward_address_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *reward_address_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_reward_address_list_get_length(const cardano_reward_address_list_t* reward_address_list)
+{
+  if (reward_address_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(reward_address_list->array);
+}
+
+cardano_error_t
+cardano_reward_address_list_get(
+  const cardano_reward_address_list_t* reward_address_list,
+  size_t                               index,
+  cardano_reward_address_t**           element)
+{
+  if (reward_address_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(reward_address_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_reward_address_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_reward_address_list_add(cardano_reward_address_list_t* reward_address_list, cardano_reward_address_t* element)
+{
+  if (reward_address_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(reward_address_list->array);
+  const size_t new_size      = cardano_array_push(reward_address_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(reward_address_list->array, compare_by_bytes, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_reward_address_list_unref(cardano_reward_address_list_t** reward_address_list)
+{
+  if ((reward_address_list == NULL) || (*reward_address_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*reward_address_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *reward_address_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_reward_address_list_ref(cardano_reward_address_list_t* reward_address_list)
+{
+  if (reward_address_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&reward_address_list->base);
+}
+
+size_t
+cardano_reward_address_list_refcount(const cardano_reward_address_list_t* reward_address_list)
+{
+  if (reward_address_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&reward_address_list->base);
+}
+
+void
+cardano_reward_address_list_set_last_error(cardano_reward_address_list_t* reward_address_list, const char* message)
+{
+  cardano_object_set_last_error(&reward_address_list->base, message);
+}
+
+const char*
+cardano_reward_address_list_get_last_error(const cardano_reward_address_list_t* reward_address_list)
+{
+  return cardano_object_get_last_error(&reward_address_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_reward_address_t* copy   = NULL;
+  const cardano_error_t     result = cardano_reward_address_deep_clone((const cardano_reward_address_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_reward_address_list_deep_clone(const cardano_reward_address_list_t* source, cardano_reward_address_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_list_t* copy = _cardano_malloc(sizeof(cardano_reward_address_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/unit_interval.c b/vendor/src/common/unit_interval.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/unit_interval.c
@@ -0,0 +1,470 @@
+/**
+ * \file unit_interval.c
+ *
+ * \author angel.castillo
+ * \date   May 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/unit_interval.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t UNIT_INTERVAL_EMBEDDED_GROUP_SIZE = 2;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Computes the greatest common divisor (GCD) of two integers.
+ *
+ * This function calculates the greatest common divisor (GCD) of two integers using
+ * Euclid's algorithm, a recursive algorithm that finds the GCD of two numbers by
+ * repeatedly taking the remainder of the division of the larger number by the smaller number
+ * until the smaller number is zero.
+ *
+ * \param[in] a The first integer.
+ * \param[in] b The second integer.
+ *
+ * \return The greatest common divisor of the two integers.
+ * \endcode
+ */
+static uint64_t
+compute_greatest_common_divisor(const uint64_t a, const uint64_t b)
+{
+  uint64_t dividend = a;
+  uint64_t divisor  = b;
+
+  while (divisor != 0U)
+  {
+    uint64_t remainder = dividend % divisor;
+    dividend           = divisor;
+    divisor            = remainder;
+  }
+
+  return dividend;
+}
+
+/**
+ * \brief Converts a floating-point value to a fraction representation.
+ *
+ * This function converts a floating-point value to a fraction representation, where
+ * the integer part, numerator, and denominator are stored in the provided pointers.
+ * The fraction is reduced to its simplest form by dividing both the numerator and
+ * denominator by their greatest common divisor.
+ *
+ * \param[in] value The floating-point value to convert to a fraction.
+ * \param[out] int_part Pointer to store the integer part of the fraction.
+ * \param[out] numerator Pointer to store the numerator of the fraction.
+ * \param[out] denominator Pointer to store the denominator of the fraction.
+ */
+static void
+float_to_fraction(const double value, uint64_t* numerator, uint64_t* denominator)
+{
+  double int_part = floor(value);
+  double dec_part = value - int_part;
+
+  if (dec_part == 0.0)
+  {
+    *numerator   = (uint64_t)int_part;
+    *denominator = 1;
+    return;
+  }
+
+  int64_t num_digits = snprintf(NULL, 0, "%.15f", dec_part) - 2;
+
+  *numerator   = (uint64_t)floor(dec_part * pow(10, (double)num_digits));
+  *denominator = (uint64_t)pow(10, (double)num_digits);
+
+  uint64_t greatest_common_divisor = compute_greatest_common_divisor(*numerator, *denominator);
+
+  *numerator   /= greatest_common_divisor;
+  *denominator /= greatest_common_divisor;
+
+  *numerator += (uint64_t)int_part * (*denominator);
+}
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano unit interval.
+ */
+typedef struct cardano_unit_interval_t
+{
+    cardano_object_t base;
+    uint64_t         numerator;
+    uint64_t         denominator;
+} cardano_unit_interval_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a unit interval object.
+ *
+ * This function is responsible for properly deallocating a unit interval object (`cardano_unit_interval_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the unit_interval object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_unit_interval_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the unit_interval
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_unit_interval_deallocate(void* object)
+{
+  assert(object != NULL);
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_unit_interval_new(
+  const uint64_t            numerator,
+  const uint64_t            denominator,
+  cardano_unit_interval_t** unit_interval)
+{
+  if (unit_interval == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *unit_interval = _cardano_malloc(sizeof(cardano_unit_interval_t));
+
+  if (*unit_interval == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*unit_interval)->base.deallocator   = cardano_unit_interval_deallocate;
+  (*unit_interval)->base.ref_count     = 1;
+  (*unit_interval)->base.last_error[0] = '\0';
+
+  (*unit_interval)->numerator   = numerator;
+  (*unit_interval)->denominator = denominator;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_unit_interval_from_double(const double value, cardano_unit_interval_t** unit_interval)
+{
+  if (value < 0.0)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  uint64_t numerator   = 0U;
+  uint64_t denominator = 0U;
+
+  float_to_fraction(value, &numerator, &denominator);
+
+  return cardano_unit_interval_new(numerator, denominator, unit_interval);
+}
+
+cardano_error_t
+cardano_unit_interval_from_cbor(cardano_cbor_reader_t* reader, cardano_unit_interval_t** unit_interval)
+{
+  if (unit_interval == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *unit_interval = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "unit_interval";
+
+  const cardano_error_t expect_tag_result = cardano_cbor_validate_tag(validator_name, reader, CARDANO_ENCODED_CBOR_RATIONAL_NUMBER);
+
+  if (expect_tag_result != CARDANO_SUCCESS)
+  {
+    *unit_interval = NULL;
+    return expect_tag_result;
+  }
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)UNIT_INTERVAL_EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *unit_interval = NULL;
+    return expect_array_result;
+  }
+
+  uint64_t              numerator        = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "numerator",
+    reader,
+    &numerator,
+    0,
+    UINT64_MAX);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    *unit_interval = NULL;
+    return read_uint_result;
+  }
+
+  uint64_t              denominator             = 0U;
+  const cardano_error_t read_denominator_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "denominator",
+    reader,
+    &denominator,
+    0,
+    UINT64_MAX);
+
+  if (read_denominator_result != CARDANO_SUCCESS)
+  {
+    *unit_interval = NULL;
+    return read_denominator_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    *unit_interval = NULL;
+
+    return expect_end_array_result;
+  }
+
+  return cardano_unit_interval_new(numerator, denominator, unit_interval);
+}
+
+cardano_error_t
+cardano_unit_interval_to_cbor(const cardano_unit_interval_t* unit_interval, cardano_cbor_writer_t* writer)
+{
+  if (unit_interval == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_tag_result = cardano_cbor_writer_write_tag(writer, CARDANO_ENCODED_CBOR_RATIONAL_NUMBER);
+
+  if (write_tag_result != CARDANO_SUCCESS)
+  {
+    return write_tag_result;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    UNIT_INTERVAL_EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, unit_interval->numerator);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  return cardano_cbor_writer_write_uint(writer, unit_interval->denominator);
+}
+
+cardano_error_t
+cardano_unit_interval_to_cip116_json(
+  const cardano_unit_interval_t* interval,
+  cardano_json_writer_t*         writer)
+{
+  if ((interval == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "numerator", 9);
+  cardano_json_writer_write_uint_as_string(writer, interval->numerator);
+
+  cardano_json_writer_write_property_name(writer, "denominator", 11);
+  cardano_json_writer_write_uint_as_string(writer, interval->denominator);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_unit_interval_get_numerator(const cardano_unit_interval_t* unit_interval)
+{
+  if (unit_interval == NULL)
+  {
+    return 0;
+  }
+
+  return unit_interval->numerator;
+}
+
+cardano_error_t
+cardano_unit_interval_set_numerator(cardano_unit_interval_t* unit_interval, const uint64_t numerator)
+{
+  if (unit_interval == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  unit_interval->numerator = numerator;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_unit_interval_get_denominator(const cardano_unit_interval_t* unit_interval)
+{
+  if (unit_interval == NULL)
+  {
+    return 0;
+  }
+
+  return unit_interval->denominator;
+}
+
+cardano_error_t
+cardano_unit_interval_set_denominator(cardano_unit_interval_t* unit_interval, const uint64_t denominator)
+{
+  if (unit_interval == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  unit_interval->denominator = denominator;
+
+  return CARDANO_SUCCESS;
+}
+
+double
+cardano_unit_interval_to_double(const cardano_unit_interval_t* unit_interval)
+{
+  if (unit_interval == NULL)
+  {
+    return 0.0;
+  }
+
+  return (double)unit_interval->numerator / (double)unit_interval->denominator;
+}
+
+void
+cardano_unit_interval_unref(cardano_unit_interval_t** unit_interval)
+{
+  if ((unit_interval == NULL) || (*unit_interval == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*unit_interval)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *unit_interval = NULL;
+    return;
+  }
+}
+
+void
+cardano_unit_interval_ref(cardano_unit_interval_t* unit_interval)
+{
+  if (unit_interval == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&unit_interval->base);
+}
+
+size_t
+cardano_unit_interval_refcount(const cardano_unit_interval_t* unit_interval)
+{
+  if (unit_interval == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&unit_interval->base);
+}
+
+void
+cardano_unit_interval_set_last_error(cardano_unit_interval_t* unit_interval, const char* message)
+{
+  cardano_object_set_last_error(&unit_interval->base, message);
+}
+
+const char*
+cardano_unit_interval_get_last_error(const cardano_unit_interval_t* unit_interval)
+{
+  return cardano_object_get_last_error(&unit_interval->base);
+}
+
+cardano_error_t
+cardano_unit_interval_deep_clone(const cardano_unit_interval_t* source, cardano_unit_interval_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_t* copy = _cardano_malloc(sizeof(cardano_unit_interval_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->numerator          = source->numerator;
+  copy->denominator        = source->denominator;
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/utxo.c b/vendor/src/common/utxo.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/utxo.c
@@ -0,0 +1,449 @@
+/**
+ * \file utxo.c
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano UTxO.
+ */
+typedef struct cardano_utxo_t
+{
+    cardano_object_t              base;
+    cardano_transaction_input_t*  input;
+    cardano_transaction_output_t* output;
+} cardano_utxo_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a utxo object.
+ *
+ * This function is responsible for properly deallocating a utxo object (`cardano_utxo_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the utxo object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_utxo_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the utxo
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_utxo_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_utxo_t* utxo = (cardano_utxo_t*)object;
+
+  cardano_transaction_input_unref(&utxo->input);
+  cardano_transaction_output_unref(&utxo->output);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_utxo_new(
+  cardano_transaction_input_t*  input,
+  cardano_transaction_output_t* output,
+  cardano_utxo_t**              utxo)
+{
+  if (utxo == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (input == NULL)
+  {
+    *utxo = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (output == NULL)
+  {
+    *utxo = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *utxo = _cardano_malloc(sizeof(cardano_utxo_t));
+
+  if (*utxo == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*utxo)->base.deallocator   = cardano_utxo_deallocate;
+  (*utxo)->base.ref_count     = 1;
+  (*utxo)->base.last_error[0] = '\0';
+
+  cardano_transaction_input_ref(input);
+  (*utxo)->input = input;
+
+  cardano_transaction_output_ref(output);
+  (*utxo)->output = output;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_utxo_from_cbor(cardano_cbor_reader_t* reader, cardano_utxo_t** utxo)
+{
+  if (utxo == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *utxo = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "utxo";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *utxo = NULL;
+    return expect_array_result;
+  }
+
+  cardano_transaction_input_t*  input  = NULL;
+  cardano_transaction_output_t* output = NULL;
+
+  cardano_error_t input_from_cbor_result = cardano_transaction_input_from_cbor(reader, &input);
+
+  if (input_from_cbor_result != CARDANO_SUCCESS)
+  {
+    *utxo = NULL;
+    return input_from_cbor_result;
+  }
+
+  cardano_error_t output_from_cbor_result = cardano_transaction_output_from_cbor(reader, &output);
+
+  if (output_from_cbor_result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_input_unref(&input);
+    *utxo = NULL;
+    return output_from_cbor_result;
+  }
+
+  cardano_error_t utxo_new_result = cardano_utxo_new(input, output, utxo);
+
+  cardano_transaction_input_unref(&input);
+  cardano_transaction_output_unref(&output);
+
+  if (utxo_new_result != CARDANO_SUCCESS)
+  {
+    *utxo = NULL;
+    return utxo_new_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_unref(utxo);
+
+    return expect_end_array_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_utxo_to_cbor(const cardano_utxo_t* utxo, cardano_cbor_writer_t* writer)
+{
+  if (utxo == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t input_to_cbor_result = cardano_transaction_input_to_cbor(utxo->input, writer);
+
+  if (input_to_cbor_result != CARDANO_SUCCESS)
+  {
+    return input_to_cbor_result;
+  }
+
+  return cardano_transaction_output_to_cbor(utxo->output, writer);
+}
+
+cardano_error_t
+cardano_utxo_to_cip116_json(
+  const cardano_utxo_t*  utxo,
+  cardano_json_writer_t* writer)
+{
+  if ((utxo == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_property_name(writer, "input", 5);
+  error = cardano_transaction_input_to_cip116_json(utxo->input, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "output", 6);
+  error = cardano_transaction_output_to_cip116_json(utxo->output, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_transaction_input_t*
+cardano_utxo_get_input(cardano_utxo_t* utxo)
+{
+  if (utxo == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_input_ref(utxo->input);
+
+  return utxo->input;
+}
+
+cardano_error_t
+cardano_utxo_set_input(cardano_utxo_t* utxo, cardano_transaction_input_t* input)
+{
+  if (utxo == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_input_ref(input);
+  cardano_transaction_input_unref(&utxo->input);
+  utxo->input = input;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_transaction_output_t*
+cardano_utxo_get_output(cardano_utxo_t* utxo)
+{
+  if (utxo == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_output_ref(utxo->output);
+
+  return utxo->output;
+}
+
+cardano_error_t
+cardano_utxo_set_output(cardano_utxo_t* utxo, cardano_transaction_output_t* output)
+{
+  if (utxo == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_ref(output);
+  cardano_transaction_output_unref(&utxo->output);
+  utxo->output = output;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_utxo_equals(const cardano_utxo_t* lhs, const cardano_utxo_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  return cardano_transaction_input_equals(lhs->input, rhs->input) &&
+    cardano_transaction_output_equals(lhs->output, rhs->output);
+}
+
+void
+cardano_utxo_unref(cardano_utxo_t** utxo)
+{
+  if ((utxo == NULL) || (*utxo == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*utxo)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *utxo = NULL;
+    return;
+  }
+}
+
+void
+cardano_utxo_ref(cardano_utxo_t* utxo)
+{
+  if (utxo == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&utxo->base);
+}
+
+size_t
+cardano_utxo_refcount(const cardano_utxo_t* utxo)
+{
+  if (utxo == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&utxo->base);
+}
+
+void
+cardano_utxo_set_last_error(cardano_utxo_t* utxo, const char* message)
+{
+  cardano_object_set_last_error(&utxo->base, message);
+}
+
+const char*
+cardano_utxo_get_last_error(const cardano_utxo_t* utxo)
+{
+  return cardano_object_get_last_error(&utxo->base);
+}
+
+cardano_error_t
+cardano_utxo_deep_clone(const cardano_utxo_t* source, cardano_utxo_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_utxo_t* copy = _cardano_malloc(sizeof(cardano_utxo_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->input              = NULL;
+  copy->output             = NULL;
+
+  if (source->input != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_input_deep_clone(source->input, &copy->input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->output != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_output_deep_clone(source->output, &copy->output);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/utxo_list.c b/vendor/src/common/utxo_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/utxo_list.c
@@ -0,0 +1,511 @@
+/**
+ * \file utxo_list.c
+ *
+ * \author angel.castillo
+ * \date   Sep 25, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano utxo list.
+ */
+typedef struct cardano_utxo_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_utxo_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a utxo list object.
+ *
+ * This function is responsible for properly deallocating a utxo list object (`cardano_utxo_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the utxo_list object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_utxo_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the utxo_list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_utxo_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_utxo_list_t* list = (cardano_utxo_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_utxo_list_new(cardano_utxo_list_t** utxo_list)
+{
+  if (utxo_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_utxo_list_t* list = _cardano_malloc(sizeof(cardano_utxo_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_utxo_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *utxo_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_utxo_list_get_length(const cardano_utxo_list_t* utxo_list)
+{
+  if (utxo_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(utxo_list->array);
+}
+
+cardano_error_t
+cardano_utxo_list_get(
+  const cardano_utxo_list_t* utxo_list,
+  size_t                     index,
+  cardano_utxo_t**           element)
+{
+  if (utxo_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(utxo_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_utxo_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_utxo_list_add(cardano_utxo_list_t* utxo_list, cardano_utxo_t* element)
+{
+  if (utxo_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(utxo_list->array);
+
+  // cppcheck-suppress misra-c2012-11.1; Reason: We need this so we can have typesafe parameters.
+  const size_t new_size = cardano_array_push(utxo_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_utxo_list_clear(cardano_utxo_list_t* utxo_list)
+{
+  if (utxo_list == NULL)
+  {
+    return;
+  }
+
+  cardano_array_clear(utxo_list->array);
+}
+
+void
+cardano_utxo_list_sort(cardano_utxo_list_t* utxo_list, cardano_utxo_list_compare_item_t compare, void* context)
+{
+  if (utxo_list == NULL)
+  {
+    return;
+  }
+
+  if (compare == NULL)
+  {
+    return;
+  }
+
+  // cppcheck-suppress misra-c2012-11.1; Reason: We need this so we can have typesafe parameters.
+  cardano_array_sort(utxo_list->array, (cardano_array_compare_item_t)(void*)compare, context);
+}
+
+cardano_utxo_t*
+cardano_utxo_list_find(const cardano_utxo_list_t* utxo_list, cardano_utxo_list_unary_predicate_t predicate, const void* context)
+{
+  if (utxo_list == NULL)
+  {
+    return NULL;
+  }
+
+  // cppcheck-suppress misra-c2012-11.1; Reason: We need this so we can have typesafe parameters.
+  return (cardano_utxo_t*)(void*)cardano_array_find(utxo_list->array, (cardano_array_unary_predicate_t)predicate, context);
+}
+
+cardano_utxo_list_t*
+cardano_utxo_list_filter(const cardano_utxo_list_t* utxo_list, cardano_utxo_list_unary_predicate_t predicate, const void* context)
+{
+  if (utxo_list == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_utxo_list_t* result = NULL;
+
+  cardano_error_t error = cardano_utxo_list_new(&result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  cardano_array_unref(&result->array);
+  result->array = NULL;
+
+  // cppcheck-suppress misra-c2012-11.1; Reason: We need this so we can have typesafe parameters.
+  result->array = cardano_array_filter(utxo_list->array, (cardano_array_unary_predicate_t)(void*)predicate, context);
+
+  if (result->array == NULL)
+  {
+    cardano_utxo_list_unref(&result);
+    return NULL;
+  }
+
+  return result;
+}
+
+cardano_utxo_list_t*
+cardano_utxo_list_concat(const cardano_utxo_list_t* lhs, const cardano_utxo_list_t* rhs)
+{
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return NULL;
+  }
+
+  cardano_utxo_list_t* result = NULL;
+
+  cardano_error_t error = cardano_utxo_list_new(&result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  cardano_array_unref(&result->array);
+  result->array = NULL;
+  result->array = cardano_array_concat(lhs->array, rhs->array);
+
+  if (result->array == NULL)
+  {
+    cardano_utxo_list_unref(&result);
+    return NULL;
+  }
+
+  return result;
+}
+
+cardano_utxo_list_t*
+cardano_utxo_list_slice(const cardano_utxo_list_t* utxo_list, size_t start, size_t end)
+{
+  if (utxo_list == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_utxo_list_t* result = NULL;
+
+  cardano_error_t error = cardano_utxo_list_new(&result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  cardano_array_unref(&result->array);
+  result->array = NULL;
+  result->array = cardano_array_slice(utxo_list->array, start, end);
+
+  if (result->array == NULL)
+  {
+    cardano_utxo_list_unref(&result);
+    return NULL;
+  }
+
+  return result;
+}
+
+cardano_utxo_list_t*
+cardano_utxo_list_erase(
+  cardano_utxo_list_t* utxo_list,
+  int64_t              start,
+  size_t               delete_count)
+{
+  if (utxo_list == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_utxo_list_t* result = NULL;
+
+  cardano_error_t error = cardano_utxo_list_new(&result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  cardano_array_unref(&result->array);
+  result->array = NULL;
+  result->array = cardano_array_erase(utxo_list->array, start, delete_count);
+
+  if (result->array == NULL)
+  {
+    cardano_utxo_list_unref(&result);
+    return NULL;
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_utxo_list_remove(cardano_utxo_list_t* utxo_list, cardano_utxo_t* element)
+{
+  int32_t found_at = -1;
+
+  const size_t length = cardano_utxo_list_get_length(utxo_list);
+
+  for (size_t i = 0; i < length; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    cardano_error_t result = cardano_utxo_list_get(utxo_list, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (cardano_utxo_equals(element, utxo) == true)
+    {
+      found_at = (int32_t)i;
+      break;
+    }
+  }
+
+  if (found_at >= 0)
+  {
+    cardano_utxo_list_t* erased = cardano_utxo_list_erase(utxo_list, found_at, 1);
+
+    if (erased == NULL)
+    {
+      cardano_utxo_list_unref(&erased);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    cardano_utxo_list_unref(&erased);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_utxo_list_t*
+cardano_utxo_list_clone(cardano_utxo_list_t* utxo_list)
+{
+  if (utxo_list == NULL)
+  {
+    return NULL;
+  }
+
+  if (cardano_utxo_list_get_length(utxo_list) == 0U)
+  {
+    cardano_utxo_list_t* empty_list = NULL;
+
+    if (cardano_utxo_list_new(&empty_list) != CARDANO_SUCCESS)
+    {
+      return NULL;
+    }
+
+    return empty_list;
+  }
+
+  return cardano_utxo_list_slice(utxo_list, 0, cardano_utxo_list_get_length(utxo_list));
+}
+
+void
+cardano_utxo_list_unref(cardano_utxo_list_t** utxo_list)
+{
+  if ((utxo_list == NULL) || (*utxo_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*utxo_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *utxo_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_utxo_list_ref(cardano_utxo_list_t* utxo_list)
+{
+  if (utxo_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&utxo_list->base);
+}
+
+size_t
+cardano_utxo_list_refcount(const cardano_utxo_list_t* utxo_list)
+{
+  if (utxo_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&utxo_list->base);
+}
+
+void
+cardano_utxo_list_set_last_error(cardano_utxo_list_t* utxo_list, const char* message)
+{
+  cardano_object_set_last_error(&utxo_list->base, message);
+}
+
+const char*
+cardano_utxo_list_get_last_error(const cardano_utxo_list_t* utxo_list)
+{
+  return cardano_object_get_last_error(&utxo_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_utxo_t*       copy   = NULL;
+  const cardano_error_t result = cardano_utxo_deep_clone((const cardano_utxo_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_utxo_list_deep_clone(const cardano_utxo_list_t* source, cardano_utxo_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_utxo_list_t* copy = _cardano_malloc(sizeof(cardano_utxo_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/common/withdrawal_map.c b/vendor/src/common/withdrawal_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/common/withdrawal_map.c
@@ -0,0 +1,874 @@
+/**
+ * \file withdrawal_map.c
+ *
+ * \author angel.castillo
+ * \date   May 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/reward_address_list.h>
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/set.h"
+
+#include <assert.h>
+#include <cardano/address/reward_address.h>
+#include <src/string_safe.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano withdrawal map.
+ */
+typedef struct cardano_withdrawal_map_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_withdrawal_map_t;
+
+/**
+ * \brief Represents a Cardano withdrawal map key value pair.
+ */
+typedef struct cardano_withdrawal_map_kvp_t
+{
+    cardano_object_t          base;
+    cardano_reward_address_t* key;
+    uint64_t                  value;
+} cardano_withdrawal_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a withdrawal map object.
+ *
+ * This function is responsible for properly deallocating a withdrawal map object (`cardano_withdrawal_map_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the withdrawal_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_withdrawal_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the withdrawal_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_withdrawal_map_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_withdrawal_map_t* map = (cardano_withdrawal_map_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a withdrawal map key value pair object.
+ *
+ * This function is responsible for properly deallocating a withdrawal map key value pair object (`cardano_withdrawal_map_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the withdrawal_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_withdrawal_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the withdrawal_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_withdrawal_map_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_withdrawal_map_kvp_t* map = (cardano_withdrawal_map_kvp_t*)object;
+
+  cardano_reward_address_unref(&map->key);
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their reward_address.
+ *
+ * @param lhs Pointer to the first cardano_object_t object.
+ * @param rhs Pointer to the second cardano_object_t object.
+ *
+ * @return true if the addresses are equal, false otherwise.
+ */
+static bool
+reward_address_equals(const cardano_reward_address_t* lhs, const cardano_reward_address_t* rhs)
+{
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  const size_t lhs_size = cardano_reward_address_get_bytes_size(lhs);
+  const size_t rhs_size = cardano_reward_address_get_bytes_size(rhs);
+
+  if (lhs_size != rhs_size)
+  {
+    return false;
+  }
+
+  const uint8_t* lhs_bytes = cardano_reward_address_get_bytes(lhs);
+  const uint8_t* rhs_bytes = cardano_reward_address_get_bytes(rhs);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size) == 0;
+}
+
+/**
+ * \brief Compares two cardano_withdrawal_map_kvp_t objects based on their reward_address.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the address of lhs is less than the address of rhs, zero if they are equal,
+ *         and a positive value if the address of lhs is greater than the address of rhs.
+ */
+static int32_t
+compare_by_bytes(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_withdrawal_map_kvp_t* lhs_kvp = (const cardano_withdrawal_map_kvp_t*)((const void*)lhs);
+  const cardano_withdrawal_map_kvp_t* rhs_kvp = (const cardano_withdrawal_map_kvp_t*)((const void*)rhs);
+
+  const size_t lhs_size = cardano_reward_address_get_bytes_size(lhs_kvp->key);
+  const size_t rhs_size = cardano_reward_address_get_bytes_size(rhs_kvp->key);
+
+  if (lhs_size != rhs_size)
+  {
+    return (lhs_size < rhs_size) ? -1 : 1;
+  }
+
+  const uint8_t* lhs_bytes = cardano_reward_address_get_bytes(lhs_kvp->key);
+  const uint8_t* rhs_bytes = cardano_reward_address_get_bytes(rhs_kvp->key);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_withdrawal_map_new(cardano_withdrawal_map_t** withdrawal_map)
+{
+  if (withdrawal_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_withdrawal_map_t* map = _cardano_malloc(sizeof(cardano_withdrawal_map_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_withdrawal_map_deallocate;
+
+  map->array = cardano_array_new(32);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *withdrawal_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_withdrawal_map_from_cbor(cardano_cbor_reader_t* reader, cardano_withdrawal_map_t** withdrawal_map)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (withdrawal_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_withdrawal_map_t* map    = NULL;
+  cardano_error_t           result = cardano_withdrawal_map_new(&map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_map(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_withdrawal_map_unref(&map);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_withdrawal_map_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_reward_address_t* key   = NULL;
+    uint64_t                  value = 0;
+
+    cardano_buffer_t* reward_address_bytes = NULL;
+
+    cardano_error_t read_reward_address_result = cardano_cbor_reader_read_bytestring(reader, &reward_address_bytes);
+
+    if (read_reward_address_result != CARDANO_SUCCESS)
+    {
+      cardano_withdrawal_map_unref(&map);
+      return read_reward_address_result;
+    }
+
+    cardano_error_t reward_address_result = cardano_reward_address_from_bytes(cardano_buffer_get_data(reward_address_bytes), cardano_buffer_get_size(reward_address_bytes), &key);
+
+    cardano_buffer_unref(&reward_address_bytes);
+
+    if (reward_address_result != CARDANO_SUCCESS)
+    {
+      cardano_withdrawal_map_unref(&map);
+      return reward_address_result;
+    }
+
+    result = cardano_cbor_reader_read_uint(reader, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_reward_address_unref(&key);
+      cardano_withdrawal_map_unref(&map);
+      return result;
+    }
+
+    cardano_withdrawal_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_withdrawal_map_kvp_t));
+
+    if (kvp == NULL)
+    {
+      cardano_reward_address_unref(&key);
+      cardano_withdrawal_map_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    kvp->base.ref_count     = 0;
+    kvp->base.last_error[0] = '\0';
+    kvp->base.deallocator   = cardano_withdrawal_map_kvp_deallocate;
+    kvp->key                = key;
+    kvp->value              = value;
+
+    const size_t old_size = cardano_array_get_size(map->array);
+    const size_t new_size = cardano_array_push(map->array, (cardano_object_t*)((void*)kvp));
+
+    if (new_size != (old_size + 1U))
+    {
+      cardano_withdrawal_map_kvp_deallocate(kvp);
+      cardano_withdrawal_map_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    cardano_array_sort(map->array, compare_by_bytes, NULL);
+  }
+
+  result = cardano_cbor_validate_end_map("withdrawal_map", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_withdrawal_map_unref(&map);
+    return result;
+  }
+
+  *withdrawal_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_withdrawal_map_to_cbor(const cardano_withdrawal_map_t* withdrawal_map, cardano_cbor_writer_t* writer)
+{
+  if (withdrawal_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t map_size = cardano_array_get_size(withdrawal_map->array);
+  result          = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(withdrawal_map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(withdrawal_map->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in withdrawal map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_withdrawal_map_kvp_t* kvp_data = (cardano_withdrawal_map_kvp_t*)((void*)kvp);
+
+    cardano_error_t write_reward_address_result = cardano_cbor_writer_write_bytestring(writer, cardano_reward_address_get_bytes(kvp_data->key), cardano_reward_address_get_bytes_size(kvp_data->key));
+
+    if (write_reward_address_result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return write_reward_address_result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, kvp_data->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    cardano_object_unref(&kvp);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_withdrawal_map_to_cip116_json(
+  const cardano_withdrawal_map_t* map,
+  cardano_json_writer_t*          writer)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0; i < cardano_array_get_size(map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(map->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_json_writer_set_last_error(writer, "Element in withdrawal map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_withdrawal_map_kvp_t* kvp_data = (cardano_withdrawal_map_kvp_t*)((void*)kvp);
+
+    cardano_json_writer_write_start_object(writer);
+    cardano_json_writer_write_property_name(writer, "key", 3);
+
+    const char*  address                      = cardano_reward_address_get_string(kvp_data->key);
+    const size_t addres_size                  = cardano_reward_address_get_bech32_size(kvp_data->key);
+    const size_t size_without_null_terminator = cardano_safe_strlen(address, addres_size);
+
+    cardano_json_writer_write_string(writer, address, size_without_null_terminator);
+
+    cardano_json_writer_write_property_name(writer, "value", 5);
+
+    cardano_json_writer_write_uint_as_string(writer, kvp_data->value);
+    cardano_json_writer_write_end_object(writer);
+
+    cardano_object_unref(&kvp);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_withdrawal_map_get_length(const cardano_withdrawal_map_t* withdrawal_map)
+{
+  if (withdrawal_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(withdrawal_map->array);
+}
+
+cardano_error_t
+cardano_withdrawal_map_get(
+  cardano_withdrawal_map_t* withdrawal_map,
+  cardano_reward_address_t* key,
+  uint64_t*                 element)
+{
+  if (withdrawal_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(withdrawal_map->array); ++i)
+  {
+    cardano_object_t*             object = cardano_array_get(withdrawal_map->array, i);
+    cardano_withdrawal_map_kvp_t* kvp    = (cardano_withdrawal_map_kvp_t*)((void*)object);
+
+    if (reward_address_equals(kvp->key, key))
+    {
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_withdrawal_map_insert(
+  cardano_withdrawal_map_t* withdrawal_map,
+  cardano_reward_address_t* key,
+  const uint64_t            value)
+{
+  if (withdrawal_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_withdrawal_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_withdrawal_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_withdrawal_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_reward_address_ref(key);
+
+  const size_t old_size = cardano_array_get_size(withdrawal_map->array);
+  const size_t new_size = cardano_array_push(withdrawal_map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_withdrawal_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(withdrawal_map->array, compare_by_bytes, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_withdrawal_map_insert_ex(
+  cardano_withdrawal_map_t* withdrawal_map,
+  const char*               reward_address,
+  size_t                    reward_address_size,
+  uint64_t                  value)
+{
+  if (withdrawal_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_t* key = NULL;
+
+  cardano_error_t result = cardano_reward_address_from_bech32(reward_address, reward_address_size, &key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_withdrawal_map_insert(withdrawal_map, key, value);
+
+  cardano_reward_address_unref(&key);
+
+  return result;
+}
+
+cardano_error_t
+cardano_withdrawal_map_get_keys(
+  cardano_withdrawal_map_t*       withdrawal_map,
+  cardano_reward_address_list_t** keys)
+{
+  if (withdrawal_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_list_t* list = NULL;
+
+  cardano_error_t result = cardano_reward_address_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(withdrawal_map->array); ++i)
+  {
+    cardano_object_t*             object = cardano_array_get(withdrawal_map->array, i);
+    cardano_withdrawal_map_kvp_t* kvp    = (cardano_withdrawal_map_kvp_t*)((void*)object);
+
+    result = cardano_reward_address_list_add(list, kvp->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_reward_address_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_withdrawal_map_get_key_at(
+  const cardano_withdrawal_map_t* withdrawal_map,
+  const size_t                    index,
+  cardano_reward_address_t**      reward_address)
+{
+  if (withdrawal_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(withdrawal_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*             object = cardano_array_get(withdrawal_map->array, index);
+  cardano_withdrawal_map_kvp_t* kvp    = (cardano_withdrawal_map_kvp_t*)((void*)object);
+
+  cardano_reward_address_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *reward_address = kvp->key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_withdrawal_map_get_value_at(
+  const cardano_withdrawal_map_t* withdrawal_map,
+  size_t                          index,
+  uint64_t*                       amount)
+{
+  if (withdrawal_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(withdrawal_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*             object = cardano_array_get(withdrawal_map->array, index);
+  cardano_withdrawal_map_kvp_t* kvp    = (cardano_withdrawal_map_kvp_t*)((void*)object);
+
+  cardano_object_unref(&object);
+
+  *amount = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_withdrawal_map_get_key_value_at(
+  const cardano_withdrawal_map_t* withdrawal_map,
+  size_t                          index,
+  cardano_reward_address_t**      reward_address,
+  uint64_t*                       amount)
+{
+  if (withdrawal_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(withdrawal_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*             object = cardano_array_get(withdrawal_map->array, index);
+  cardano_withdrawal_map_kvp_t* kvp    = (cardano_withdrawal_map_kvp_t*)((void*)object);
+
+  cardano_reward_address_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *reward_address = kvp->key;
+  *amount         = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_withdrawal_map_unref(cardano_withdrawal_map_t** withdrawal_map)
+{
+  if ((withdrawal_map == NULL) || (*withdrawal_map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*withdrawal_map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *withdrawal_map = NULL;
+    return;
+  }
+}
+
+void
+cardano_withdrawal_map_ref(cardano_withdrawal_map_t* withdrawal_map)
+{
+  if (withdrawal_map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&withdrawal_map->base);
+}
+
+size_t
+cardano_withdrawal_map_refcount(const cardano_withdrawal_map_t* withdrawal_map)
+{
+  if (withdrawal_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&withdrawal_map->base);
+}
+
+void
+cardano_withdrawal_map_set_last_error(cardano_withdrawal_map_t* withdrawal_map, const char* message)
+{
+  cardano_object_set_last_error(&withdrawal_map->base, message);
+}
+
+const char*
+cardano_withdrawal_map_get_last_error(const cardano_withdrawal_map_t* withdrawal_map)
+{
+  return cardano_object_get_last_error(&withdrawal_map->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_withdrawal_map_kvp_deep_clone(const cardano_withdrawal_map_kvp_t* source, cardano_withdrawal_map_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_withdrawal_map_kvp_t* copy = _cardano_malloc(sizeof(cardano_withdrawal_map_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = source->value;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_reward_address_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_withdrawal_map_kvp_t* copy   = NULL;
+  const cardano_error_t         result = cardano_withdrawal_map_kvp_deep_clone((const cardano_withdrawal_map_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_withdrawal_map_deep_clone(const cardano_withdrawal_map_t* source, cardano_withdrawal_map_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_withdrawal_map_t* copy = _cardano_malloc(sizeof(cardano_withdrawal_map_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/config.h b/vendor/src/config.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/config.h
@@ -0,0 +1,35 @@
+/**
+ * \file config.h
+ *
+ * \author angel.castillo
+ * \date   Sep 09, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CARDANO_C_CONFIG_H_
+#define CARDANO_C_CONFIG_H_
+
+/* DEFINES *******************************************************************/
+
+#define LIB_CARDANO_C_VERSION_MAJOR      2
+#define LIB_CARDANO_C_VERSION_MINOR      0
+#define LIB_CARDANO_C_VERSION_PATCH      0
+#define LIB_CARDANO_C_VERSION            "2.0.0-rc.7"
+
+#define LIB_CARDANO_C_COLLECTION_GROW_FACTOR (1.5)
+#define LIB_CARDANO_C_MAX_JSON_DEPTH         (256)
+
+#endif /* CARDANO_C_CONFIG_H_ */
diff --git a/vendor/src/crypto/arithmetic.c b/vendor/src/crypto/arithmetic.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/arithmetic.c
@@ -0,0 +1,59 @@
+/**
+ * \file arithmetic.c
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "arithmetic.h"
+
+/* DEFINITIONS ****************************************************************/
+
+void
+_cardano_crypto_add28_mul8(const byte_t* x, const byte_t* y, byte_t* out)
+{
+  uint32_t carry = 0;
+
+  for (int i = 0; i < 28; i++)
+  {
+    uint32_t r = x[i] + ((uint32_t)y[i] << 3) + carry;
+    out[i]     = (uint8_t)(r & 0xFFu);
+    carry      = r >> 8;
+  }
+
+  for (int i = 28; i < 32; i++)
+  {
+    uint32_t r = x[i] + carry;
+    out[i]     = (uint8_t)(r & 0xFFu);
+    carry      = r >> 8;
+  }
+}
+
+void
+_cardano_crypto_add256bits(const uint8_t* x, const uint8_t* y, uint8_t* out)
+{
+  uint32_t carry = 0;
+
+  for (int i = 0; i < 32; i++)
+  {
+    uint32_t r = (uint32_t)x[i] + (uint32_t)y[i] + carry;
+    out[i]     = (uint8_t)(r & 0xFFu);
+    carry      = r >> 8;
+  }
+}
diff --git a/vendor/src/crypto/arithmetic.h b/vendor/src/crypto/arithmetic.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/arithmetic.h
@@ -0,0 +1,76 @@
+/**
+ * \file arithmetic.h
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ARITHMETIC_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ARITHMETIC_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Adds a 256-bit number to another 256-bit number multiplied by 8, both represented as byte arrays.
+ *
+ * This function computes the sum of two 256-bit numbers where the second number is first
+ * multiplied by 8 (equivalent to left-shifting its bits by 3 positions). The operation is
+ * carried out on a byte-by-byte basis for the first 28 bytes of the input arrays, with the
+ * remaining 4 bytes of the array being added without multiplication. The result is stored
+ * in a provided output buffer.
+ *
+ * \param[in] x A pointer to the first operand, a 256-bit number represented as a 32-byte array.
+ * \param[in] y A pointer to the second operand, a 256-bit number also represented as a 32-byte
+ *              array. The first 28 bytes of this array will be effectively multiplied by 8 before
+ *              being added to the corresponding bytes of the first operand.
+ * \param[out] out A pointer to the output buffer where the result of the operation will be stored.
+ *                 This buffer must be at least 32 bytes in size to accommodate the result.
+ *
+ * \note It's important to ensure that all input arrays and the output buffer are properly
+ *       allocated and that the output buffer can safely hold 32 bytes. The function implements
+ *       carry-over logic for the byte-wise addition, with carries propagated through the
+ *       calculation. If the sum of the final bytes plus any remaining carry exceeds the size
+ *       of a byte, the overflow is ignored, effectively treating the operation as modulo
+ *       2^256.
+ */
+void _cardano_crypto_add28_mul8(const byte_t* x, const byte_t* y, byte_t* out);
+
+/**
+ * \brief Adds two 256-bit numbers represented as byte arrays, including carry handling.
+ *
+ * This function performs the addition of two 256-bit numbers, each represented as a 32-byte
+ * array. The addition includes carry handling across byte boundaries, making it suitable
+ * for arithmetic operations on large numbers beyond the range of standard integer types.
+ * The result of the addition is stored in the provided output buffer, `out`.
+ *
+ * \param[in] x A pointer to the first operand, a 256-bit number represented as a 32-byte array.
+ * \param[in] y A pointer to the second operand, another 256-bit number represented similarly to
+ *              the first operand.
+ * \param[out] out A pointer to a 32-byte output buffer where the result of the addition will be stored.
+ *
+ * \note The function correctly handles carry-over during the addition, ensuring that any overflow
+ *       from adding individual bytes (including the carry from the previous byte, if any) is
+ *       accounted for in the next byte. If the final byte addition results in an overflow, this
+ *       overflow is ignored, effectively treating the numbers as if they were modulo 2^256.
+ */
+void _cardano_crypto_add256bits(const byte_t* x, const byte_t* y, byte_t* out);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_ARITHMETIC_H
diff --git a/vendor/src/crypto/bip32_key_derivation.c b/vendor/src/crypto/bip32_key_derivation.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/bip32_key_derivation.c
@@ -0,0 +1,239 @@
+/**
+ * \file bip32_key_derivation.c
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "bip32_key_derivation.h"
+
+#include <assert.h>
+#include <sodium.h>
+#include <string.h>
+
+#include "../string_safe.h"
+#include "arithmetic.h"
+
+/* DEFINITIONS ****************************************************************/
+
+bool
+_cardano_crypto_is_hardened_derivation(const uint32_t index)
+{
+  return index >= 0x80000000u;
+}
+
+cardano_error_t
+_cardano_crypto_derive_hardened(
+  const int32_t index,
+  const byte_t* scalar,
+  const byte_t* iv,
+  const byte_t* chain_code,
+  byte_t*       z_mac,
+  byte_t*       cc_mac)
+{
+  byte_t data[1 + 64 + 4] = { 0 };
+
+  cardano_safe_memcpy(&data[1], sizeof(data) - 1U, scalar, 32);
+  cardano_safe_memcpy(&data[1 + 32], sizeof(data) - (1U + 32U), iv, 32);
+
+  data[1 + 64]     = (byte_t)((uint32_t)index & 0xFFu);
+  data[1 + 64 + 1] = (byte_t)(((uint32_t)index >> 8) & 0xFFu);
+  data[1 + 64 + 2] = (byte_t)(((uint32_t)index >> 16) & 0xFFu);
+  data[1 + 64 + 3] = (byte_t)(((uint32_t)index >> 24) & 0xFFu);
+
+  data[0] = 0x00;
+
+  if (crypto_auth_hmacsha512(z_mac, data, sizeof(data), chain_code) == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  data[0] = 0x01;
+
+  if (crypto_auth_hmacsha512(cc_mac, data, sizeof(data), chain_code) == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_crypto_derive_soft(
+  const int32_t index,
+  const byte_t* scalar,
+  const byte_t* chain_code,
+  byte_t*       z_mac,
+  byte_t*       cc_mac)
+{
+  byte_t data[1 + 32 + 4] = { 0 };
+  byte_t vk[32]           = { 0 };
+
+  if (crypto_scalarmult_ed25519_base_noclamp(vk, scalar) != 0)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  cardano_safe_memcpy(&data[1], sizeof(data) - 1U, vk, 32);
+
+  data[1 + 32]     = (byte_t)((uint32_t)index & 0xFFu);
+  data[1 + 32 + 1] = (byte_t)(((uint32_t)index >> 8) & 0xFFu);
+  data[1 + 32 + 2] = (byte_t)(((uint32_t)index >> 16) & 0xFFu);
+  data[1 + 32 + 3] = (byte_t)(((uint32_t)index >> 24) & 0xFFu);
+
+  data[0] = 0x02;
+
+  if (crypto_auth_hmacsha512(z_mac, data, sizeof(data), chain_code) != 0)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  data[0] = 0x03;
+
+  if (crypto_auth_hmacsha512(cc_mac, data, sizeof(data), chain_code) != 0)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_crypto_point_of_trunc28_mul8(const byte_t* sk, byte_t* out)
+{
+  byte_t zero[32]   = { 0 };
+  byte_t scalar[32] = { 0 };
+
+  _cardano_crypto_add28_mul8(zero, sk, scalar);
+
+  if (crypto_scalarmult_ed25519_base_noclamp(out, scalar) != 0)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_crypto_derive_private(const byte_t* key, const int32_t index, byte_t* out, const size_t out_size)
+{
+  assert(out_size >= 96U);
+
+  const byte_t* kl = key;
+  const byte_t* kr = &key[32];
+  const byte_t* cc = &key[64];
+
+  byte_t z_mac[64]  = { 0 };
+  byte_t cc_mac[64] = { 0 };
+
+  if (_cardano_crypto_is_hardened_derivation(index))
+  {
+    cardano_error_t error = _cardano_crypto_derive_hardened(index, kl, kr, cc, z_mac, cc_mac);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+  else
+  {
+    cardano_error_t error = _cardano_crypto_derive_soft(index, kl, cc, z_mac, cc_mac);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  byte_t zl[32] = { 0 };
+  byte_t zr[32] = { 0 };
+
+  cardano_safe_memcpy(zl, sizeof(zl), &z_mac, 32);
+  cardano_safe_memcpy(zr, sizeof(zr), &z_mac[32], 32);
+
+  byte_t left[32]  = { 0 };
+  byte_t right[32] = { 0 };
+
+  _cardano_crypto_add28_mul8(kl, zl, left);
+  _cardano_crypto_add256bits(kr, zr, right);
+
+  cardano_safe_memcpy(out, out_size, left, 32);
+  cardano_safe_memcpy(&out[32], out_size - 32U, right, 32);
+  cardano_safe_memcpy(&out[64], out_size - 64U, &cc_mac[32], 32);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_crypto_derive_public(const byte_t* key, const int32_t index, byte_t* out, const size_t out_size)
+{
+  assert(out_size >= 64U);
+
+  const byte_t* pk = key;
+  const byte_t* cc = &key[32];
+
+  byte_t data[1 + 32 + 4] = { 0 };
+  byte_t z[64]            = { 0 };
+  byte_t c[64]            = { 0 };
+  byte_t zl[32]           = { 0 };
+  byte_t p[32]            = { 0 };
+
+  CARDANO_UNUSED(memset(data, 0, sizeof(data)));
+
+  cardano_safe_memcpy(&data[1], sizeof(data) - 1U, pk, 32);
+
+  data[0] = 0x02;
+
+  data[1 + 32]     = (byte_t)((uint32_t)index & 0xFFu);
+  data[1 + 32 + 1] = (byte_t)(((uint32_t)index >> 8) & 0xFFu);
+  data[1 + 32 + 2] = (byte_t)(((uint32_t)index >> 16) & 0xFFu);
+  data[1 + 32 + 3] = (byte_t)(((uint32_t)index >> 24) & 0xFFu);
+
+  if (crypto_auth_hmacsha512(z, data, sizeof(data), cc) != 0)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  data[0] = 0x03;
+
+  if (crypto_auth_hmacsha512(c, data, sizeof(data), cc) != 0)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  byte_t* chain_code = &c[32];
+
+  cardano_safe_memcpy(zl, sizeof(zl), z, 32);
+
+  cardano_error_t error = _cardano_crypto_point_of_trunc28_mul8(zl, p);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (crypto_core_ed25519_add(out, p, pk) != 0)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  cardano_safe_memcpy(&out[32], out_size - 32U, chain_code, 32);
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/crypto/bip32_key_derivation.h b/vendor/src/crypto/bip32_key_derivation.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/bip32_key_derivation.h
@@ -0,0 +1,191 @@
+/**
+ * \file bip32_key_derivation.h
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BIP32_KEY_DERIVATION_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BIP32_KEY_DERIVATION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Determines if a given index represents a hardened derivation in hierarchical deterministic (HD) wallets.
+ *
+ * In the context of HD wallet key derivation paths, indices greater than or equal to 2^31 are considered hardened.
+ * This function checks if the provided index falls into the hardened category according to the BIP32 specification.
+ * Hardened indices are used to increase security by ensuring that child private keys cannot be derived from parent
+ * public keys, thereby protecting against certain types of attacks if a child private key is compromised.
+ *
+ * \param index The 32-bit integer index to verify. This index is part of a derivation path for generating
+ *              child keys in an HD wallet. The BIP32 specification dictates that indices in the range
+ *              [0, 2^31 - 1] are non-hardened, while indices in the range [2^31, 2^32 - 1] are hardened.
+ *
+ * \returns Returns `true` if the index represents a hardened derivation (i.e., is greater than or equal to 2^31).
+ *          Returns `false` otherwise, indicating a non-hardened index.
+ */
+bool _cardano_crypto_is_hardened_derivation(uint32_t index);
+
+/**
+ * \brief Derives a child private key using a hardened index from a given parent key in hierarchical
+ * deterministic (HD) wallets.
+ *
+ * This function performs hardened derivation of a child private key from a parent private key
+ * using the Ed25519 curve. Hardened key derivation ensures that even if a child private key is
+ * compromised, attackers cannot derive parent or sibling keys, enhancing security. This method
+ * is part of the HD wallet structure that allows for generating a tree of keys from a single seed.
+ *
+ * \param index The derivation index for generating the child key. For hardened derivation,
+ *              the index must be in the range [2^31, 2^32 - 1]. This function assumes the index
+ *              is already hardened and does not check or modify it.
+ * \param scalar A pointer to the 32-byte Ed25519 scalar (private key) of the parent from which
+ *               the child key will be derived.
+ * \param iv A pointer to the 32-byte Ed25519 initialization vector (IV) associated with the parent
+ *           key.
+ * \param chain_code A pointer to the 32-byte chain code associated with the parent key. The chain
+ *                  code is used to add entropy to the derivation process and differentiate keys
+ *                  derived from the same parent scalar but different indices.
+ * \param[out] z_mac A pointer to the output buffer where the derived scalar (z) MAC (Message Authentication Code)
+ *                   will be stored. This buffer must be pre-allocated with at least 32 bytes of space.
+ * \param[out] cc_mac A pointer to the output buffer where the derived chain code MAC will be stored.
+ *                    This buffer must also be pre-allocated with at least 32 bytes of space.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ */
+cardano_error_t _cardano_crypto_derive_hardened(
+  int32_t       index,
+  const byte_t* scalar,
+  const byte_t* iv,
+  const byte_t* chain_code,
+  byte_t*       z_mac,
+  byte_t*       cc_mac);
+
+/**
+ * \brief Derives a child private key using a non-hardened (soft) index from a given parent key in
+ * hierarchical deterministic (HD) wallets.
+ *
+ * This function facilitates the soft derivation of a child private key from a parent private key using the
+ * Ed25519 curve. In contrast to hardened derivation, soft derivation allows the child public key to be
+ * derived from the parent public key without needing access to the parent private key. This property is
+ * useful for creating public key hierarchies where public keys can be generated independently of private keys,
+ * though it offers less security against certain types of attacks compared to hardened derivation.
+ *
+ * \param index The derivation index for generating the child key. For soft derivation, the index must be in the
+ *              range [0, 2^31 - 1].
+ * \param scalar A pointer to the 32-byte Ed25519 SCALAR (private key) of the parent from which the child key will
+ *               be derived.
+ * \param chain_code A pointer to the 32-byte chain code associated with the parent key. The chain code is used
+ *                  to introduce additional entropy into the derivation process and ensures that keys derived
+ *                  from the same scalar but different indices are unique and cryptographically separate.
+ * \param[out] z_mac A pointer to the output buffer where the derived scalar (z) MAC (Message Authentication Code)
+ *                   for the child key will be stored. This buffer must be pre-allocated with at least 32 bytes of space.
+ * \param[out] cc_mac A pointer to the output buffer where the derived chain code MAC for the child key will be stored.
+ *                    Like the z_mac buffer, this buffer must also be pre-allocated with at least 32 bytes of space.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ */
+cardano_error_t _cardano_crypto_derive_soft(
+  int32_t       index,
+  const byte_t* scalar,
+  const byte_t* chain_code,
+  byte_t*       z_mac,
+  byte_t*       cc_mac);
+
+/**
+ * \brief Computes the scalar multiplication of a truncated secret key by 8 and the curve's base point.
+ *
+ * This function performs a specific scalar multiplication operation where the first 28 bytes of a little-endian
+ * encoded secret key (`sk`) are multiplied by 8, and then the result is used as the scalar for multiplication with
+ * the curve's base point, `G`. The operation `(8 * sk[:28])*G` is common in certain cryptographic protocols and
+ * optimizations, where `sk[:28]` represents the truncation of the secret key to its first 28 bytes. This is typically
+ * done to fit within certain computational or protocol-specific constraints while ensuring the resulting point
+ * remains on the curve.
+ *
+ * \param[in] sk A pointer to the secret key, represented as a 32-byte array in little-endian format. Only the first
+ *               28 bytes of this array are used in the computation, with the remaining bytes being ignored.
+ * \param[out] out A pointer to the output buffer where the result of the scalar multiplication will be stored.
+ *                 The result is the x-coordinate of the point resulting from the scalar multiplication of
+ *                 the truncated secret key by 8 with the curve's base point, encoded as a 32-byte array. The
+ *                 caller must ensure this buffer is allocated with sufficient space (typically 32 bytes) to
+ *                 hold the result.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ */
+cardano_error_t _cardano_crypto_point_of_trunc28_mul8(const byte_t* sk, byte_t* out);
+
+/**
+ * Derives a child private key from a given parent private key using a specified derivation index.
+ *
+ * This function supports both hard and soft derivation processes as defined in the hierarchical deterministic (HD)
+ * wallet architecture (BIP32). The derivation type (hard or soft) is determined by the value of the provided index.
+ *
+ * \param[in] key A pointer to the 32-byte parent private key from which the child key will be derived.
+ * \param[in] index The derivation index. If the index is less than 0x80000000, it specifies a soft derivation;
+ *                    otherwise, it specifies a hard derivation.
+ * \param[out] out A pointer to the output buffer where the derived 32-byte child private key will be stored.
+ * \param[in] out_size The size of the output buffer.
+ *
+ * \section Security considerations
+ * - Hard derivation is secure under the assumption that the parent private key remains confidential. It prevents
+ *   the derivation of sibling keys from the knowledge of a child key. However, hard derivation does not allow for
+ *   the public key of the derived child key to be computed without access to the parent private key.
+ * - Soft derivation allows for the associated public key of the derived child key to be computed directly from
+ *   the parent public key, enhancing usability in scenarios where public key distribution is necessary. However,
+ *   it introduces potential security risks if a child private key is compromised, potentially compromising sibling
+ *   keys.
+ *
+ * \section Hard derivation vs. Soft derivation
+ * - Soft derivation (index < 0x80000000): Allows the associated public key to be derived directly, facilitating
+ *   scenarios where the public key needs to be shared or published without exposing the private key. The derived
+ *   private and public keys maintain a direct relationship, allowing for streamlined key management in hierarchical
+ *   structures.
+ * - Hard derivation (index >= 0x80000000): Enhances security by isolating the derivation path, preventing the derivation
+ *   of sibling keys from the knowledge of a child key. This is recommended for scenarios where the utmost security
+ *   is required, and public key derivation from the parent key is not necessary.
+ *
+ * \section Operational semantics
+ * - Derivation of the private key should always succeed provided the inputs are valid and correctly formatted.
+ * - Derivation of the associated public key may fail if attempted with a hard derivation index, as the public key
+ *   cannot be derived without access to the corresponding private key information.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ */
+cardano_error_t _cardano_crypto_derive_private(const byte_t* key, int32_t index, byte_t* out, size_t out_size);
+
+/**
+ * Derives a public key from a given private key using a specified derivation index.
+ *
+ * This function supports the derivation of a child public key based on BIP32 specifications. It allows
+ * for both hardened and non-hardened (soft) derivations.
+ *
+ * \param[in] key A pointer to the 32-byte private key from which the public key will be derived.
+ * \param[in] index The derivation index. Indices in the range [0x80000000, 0xFFFFFFFF] specify a hardened
+ *                  derivation, while indices in the range [0, 0x7FFFFFFF] specify a non-hardened (soft) derivation.
+ * \param[out] out A pointer to the output buffer where the derived 32-byte key will be stored.
+ * \param[in] out_size The size of the output buffer.
+ *
+ * \return cardano_error_t Returns an error code indicating the status of the operation.
+ */
+cardano_error_t _cardano_crypto_derive_public(const byte_t* key, int32_t index, byte_t* out, size_t out_size);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BIP32_KEY_DERIVATION_H
diff --git a/vendor/src/crypto/bip32_private_key.c b/vendor/src/crypto/bip32_private_key.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/bip32_private_key.c
@@ -0,0 +1,564 @@
+/**
+ * \file bip32_private_key.c
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/bip32_private_key.h>
+
+#include <cardano/buffer.h>
+#include <cardano/crypto/ed25519_private_key.h>
+#include <cardano/crypto/pbkdf2.h>
+#include <cardano/export.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+#include "bip32_key_derivation.h"
+
+#include <assert.h>
+#include <sodium.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t BIP32_ED25519_PRIVATE_KEY_LENGTH = 96;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a BIP32 hierarchical deterministic private key.
+ *
+ * This structure encapsulates a BIP32 private key, part of the hierarchical deterministic (HD) wallet
+ * architecture. HD wallets allow for the generation of a family of private keys from a single master
+ * seed.
+ */
+typedef struct cardano_bip32_private_key_t
+{
+    cardano_object_t  base;
+    cardano_buffer_t* key_material;
+} cardano_bip32_private_key_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a BIP32 private key object.
+ *
+ * This function is responsible for properly deallocating a BIP32 private key object (`cardano_bip32_private_key_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the BIP32 private key object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_bip32_private_key_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the BIP32 private key
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_bip32_private_key_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_bip32_private_key_t* private_key = (cardano_bip32_private_key_t*)object;
+
+  if (private_key->key_material != NULL)
+  {
+    sodium_memzero(cardano_buffer_get_data(private_key->key_material), cardano_buffer_get_size(private_key->key_material));
+    cardano_buffer_unref(&private_key->key_material);
+  }
+
+  _cardano_free(private_key);
+}
+
+/**
+ * \brief clamp the scalar by:
+ *
+ *  1. Clearing the 3 lower bits.
+ *  2. Clearing the three highest bits.
+ *  3. Setting the second-highest bit.
+ *
+ * \param[out] scalar The clamped scalar.
+ */
+static void
+clamp_scalar(byte_t* scalar)
+{
+  assert(scalar != NULL);
+
+  scalar[0]  &= 0b11111000u;
+  scalar[31] &= 0b00011111u;
+  scalar[31] |= 0b01000000u;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_bip32_private_key_from_bytes(
+  const byte_t*                 key_bytes,
+  const size_t                  key_length,
+  cardano_bip32_private_key_t** private_key)
+{
+  if (private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key_bytes == NULL)
+  {
+    *private_key = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key_length != BIP32_ED25519_PRIVATE_KEY_LENGTH)
+  {
+    *private_key = NULL;
+    return CARDANO_ERROR_INVALID_BIP32_PRIVATE_KEY_SIZE;
+  }
+
+  cardano_bip32_private_key_t* bip32_private_key = (cardano_bip32_private_key_t*)_cardano_malloc(sizeof(cardano_bip32_private_key_t));
+
+  if (bip32_private_key == NULL)
+  {
+    *private_key = NULL;
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  bip32_private_key->base.ref_count     = 1;
+  bip32_private_key->base.deallocator   = cardano_bip32_private_key_deallocate;
+  bip32_private_key->base.last_error[0] = '\0';
+  bip32_private_key->key_material       = cardano_buffer_new_from(key_bytes, key_length);
+
+  if (bip32_private_key->key_material == NULL)
+  {
+    _cardano_free(bip32_private_key);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *private_key = bip32_private_key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bip32_private_key_from_bip39_entropy(
+  const byte_t*                 password,
+  const size_t                  password_length,
+  const byte_t*                 entropy,
+  const size_t                  entropy_length,
+  cardano_bip32_private_key_t** key)
+{
+  static const size_t pbkdf2_iterations = 4096;
+  static const size_t pbkdf2_key_size   = 96;
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((password == NULL) && (password_length > 0U))
+  {
+    *key = NULL;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (entropy == NULL)
+  {
+    *key = NULL;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (entropy_length == 0U)
+  {
+    *key = NULL;
+
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  byte_t pbkdf2_key[96] = { 0 };
+
+  cardano_error_t result = cardano_crypto_pbkdf2_hmac_sha512(
+    password,
+    password_length,
+    entropy,
+    entropy_length,
+    (uint32_t)pbkdf2_iterations,
+    &pbkdf2_key[0],
+    pbkdf2_key_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *key = NULL;
+    sodium_memzero(pbkdf2_key, sizeof(pbkdf2_key));
+
+    return result;
+  }
+
+  clamp_scalar(&pbkdf2_key[0]);
+
+  result = cardano_bip32_private_key_from_bytes(&pbkdf2_key[0], BIP32_ED25519_PRIVATE_KEY_LENGTH, key);
+  sodium_memzero(pbkdf2_key, sizeof(pbkdf2_key));
+
+  return result;
+}
+
+cardano_error_t
+cardano_bip32_private_key_from_hex(
+  const char*                   hex,
+  const size_t                  hex_length,
+  cardano_bip32_private_key_t** private_key)
+{
+  if (private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex == NULL)
+  {
+    *private_key = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex_length != (BIP32_ED25519_PRIVATE_KEY_LENGTH * 2U))
+  {
+    *private_key = NULL;
+    return CARDANO_ERROR_INVALID_BIP32_PRIVATE_KEY_SIZE;
+  }
+
+  cardano_bip32_private_key_t* bip32_private_key = (cardano_bip32_private_key_t*)_cardano_malloc(sizeof(cardano_bip32_private_key_t));
+
+  if (bip32_private_key == NULL)
+  {
+    *private_key = NULL;
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  bip32_private_key->base.ref_count     = 1;
+  bip32_private_key->base.deallocator   = cardano_bip32_private_key_deallocate;
+  bip32_private_key->base.last_error[0] = '\0';
+  bip32_private_key->key_material       = cardano_buffer_from_hex(hex, hex_length);
+
+  if (bip32_private_key->key_material == NULL)
+  {
+    _cardano_free(bip32_private_key);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *private_key = bip32_private_key;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_bip32_private_key_unref(cardano_bip32_private_key_t** bip32_private_key)
+{
+  if ((bip32_private_key == NULL) || (*bip32_private_key == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*bip32_private_key)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *bip32_private_key = NULL;
+    return;
+  }
+}
+
+void
+cardano_bip32_private_key_ref(cardano_bip32_private_key_t* bip32_private_key)
+{
+  if (bip32_private_key == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&bip32_private_key->base);
+}
+
+size_t
+cardano_bip32_private_key_refcount(const cardano_bip32_private_key_t* bip32_private_key)
+{
+  if (bip32_private_key == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&bip32_private_key->base);
+}
+
+cardano_error_t
+cardano_bip32_private_key_derive(
+  const cardano_bip32_private_key_t* private_key,
+  const uint32_t*                    indices,
+  size_t                             indices_count,
+  cardano_bip32_private_key_t**      derived_private_key)
+{
+  if (derived_private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (private_key == NULL)
+  {
+    *derived_private_key = NULL;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (indices == NULL)
+  {
+    *derived_private_key = NULL;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (indices_count == 0U)
+  {
+    *derived_private_key = NULL;
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_bip32_private_key_t* working_key      = NULL;
+  cardano_error_t              clone_key_result = cardano_bip32_private_key_from_bytes(
+    cardano_buffer_get_data(private_key->key_material),
+    BIP32_ED25519_PRIVATE_KEY_LENGTH,
+    &working_key);
+
+  if (clone_key_result != CARDANO_SUCCESS)
+  {
+    *derived_private_key = NULL;
+
+    return clone_key_result;
+  }
+
+  for (size_t i = 0; i < indices_count; ++i)
+  {
+    const byte_t*   key_data         = cardano_buffer_get_data(working_key->key_material);
+    byte_t          derived_key[96U] = { 0 };
+    cardano_error_t error            = _cardano_crypto_derive_private(key_data, (int32_t)indices[i], &derived_key[0], sizeof(derived_key));
+
+    if (error != CARDANO_SUCCESS)
+    {
+      *derived_private_key = NULL;
+      cardano_bip32_private_key_unref(&working_key);
+
+      return error;
+    }
+
+    cardano_bip32_private_key_t* new_key = NULL;
+
+    error = cardano_bip32_private_key_from_bytes(&derived_key[0], BIP32_ED25519_PRIVATE_KEY_LENGTH, &new_key);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      *derived_private_key = NULL;
+      cardano_bip32_private_key_unref(&working_key);
+
+      return error;
+    }
+
+    cardano_bip32_private_key_unref(&working_key);
+    working_key = new_key;
+  }
+
+  *derived_private_key = working_key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bip32_private_key_to_ed25519_key(
+  const cardano_bip32_private_key_t* private_key,
+  cardano_ed25519_private_key_t**    ed25519_private_key)
+{
+  static const size_t extended_ed25519_private_key_length = 64;
+
+  if (ed25519_private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (private_key == NULL)
+  {
+    *ed25519_private_key = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const byte_t* data = cardano_buffer_get_data(private_key->key_material);
+
+  return cardano_ed25519_private_key_from_extended_bytes(
+    data,
+    extended_ed25519_private_key_length,
+    ed25519_private_key);
+}
+
+cardano_error_t
+cardano_bip32_private_key_get_public_key(
+  const cardano_bip32_private_key_t* private_key,
+  cardano_bip32_public_key_t**       ed25519_public_key)
+{
+  static const size_t chain_code_index                = 64;
+  static const size_t chain_code_size                 = 32;
+  static const size_t bip32_ed25519_public_key_length = 64;
+
+  if (ed25519_public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (private_key == NULL)
+  {
+    *ed25519_public_key = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const byte_t* extended_scalar = cardano_buffer_get_data(private_key->key_material);
+  byte_t        public_key[32]  = { 0 };
+
+  if (crypto_scalarmult_ed25519_base_noclamp(&public_key[0], extended_scalar) != 0)
+  {
+    *ed25519_public_key = NULL;
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  byte_t bip32_public_key[64] = { 0 };
+
+  cardano_safe_memcpy(&bip32_public_key[0], sizeof(bip32_public_key), &public_key[0], 32);
+  cardano_safe_memcpy(&bip32_public_key[32], sizeof(bip32_public_key) - 32U, &extended_scalar[chain_code_index], chain_code_size);
+
+  return cardano_bip32_public_key_from_bytes(
+    &bip32_public_key[0],
+    bip32_ed25519_public_key_length,
+    ed25519_public_key);
+}
+
+const byte_t*
+cardano_bip32_private_key_get_data(const cardano_bip32_private_key_t* bip32_private_key)
+{
+  if (bip32_private_key == NULL)
+  {
+    return NULL;
+  }
+
+  return cardano_buffer_get_data(bip32_private_key->key_material);
+}
+
+size_t
+cardano_bip32_private_key_get_bytes_size(const cardano_bip32_private_key_t* bip32_private_key)
+{
+  if (bip32_private_key == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_buffer_get_size(bip32_private_key->key_material);
+}
+
+cardano_error_t
+cardano_bip32_private_key_to_bytes(
+  const cardano_bip32_private_key_t* private_key,
+  byte_t*                            out_key_bytes,
+  const size_t                       out_key_length)
+{
+  if (private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_copy_bytes(private_key->key_material, out_key_bytes, out_key_length);
+}
+
+size_t
+cardano_bip32_private_key_get_hex_size(const cardano_bip32_private_key_t* bip32_private_key)
+{
+  if (bip32_private_key == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_buffer_get_hex_size(bip32_private_key->key_material);
+}
+
+cardano_error_t
+cardano_bip32_private_key_to_hex(
+  const cardano_bip32_private_key_t* bip32_private_key,
+  char*                              hex,
+  const size_t                       hex_length)
+{
+  if (bip32_private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_to_hex(bip32_private_key->key_material, hex, hex_length);
+}
+
+uint32_t
+cardano_bip32_harden(uint32_t index)
+{
+  return index | 0x80000000;
+}
+
+cardano_error_t
+cardano_bip32_private_key_deep_clone(const cardano_bip32_private_key_t* source, cardano_bip32_private_key_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bip32_private_key_t* copy = _cardano_malloc(sizeof(cardano_bip32_private_key_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key_material       = NULL;
+
+  if (source->key_material != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->key_material, &copy->key_material);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/crypto/bip32_public_key.c b/vendor/src/crypto/bip32_public_key.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/bip32_public_key.c
@@ -0,0 +1,457 @@
+/**
+ * \file bip32_public_key.c
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/bip32_public_key.h>
+
+#include <cardano/buffer.h>
+#include <cardano/export.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "bip32_key_derivation.h"
+
+#include <assert.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t BIP32_ED25519_PUBLIC_KEY_LENGTH = 64;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a BIP32 hierarchical deterministic public key.
+ *
+ * This structure encapsulates a BIP32 public key, part of the hierarchical deterministic (HD) wallet
+ * architecture. HD wallets allow for the generation of a family of public keys from a single master
+ * seed.
+ */
+typedef struct cardano_bip32_public_key_t
+{
+    cardano_object_t  base;
+    cardano_buffer_t* key_material;
+} cardano_bip32_public_key_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a BIP32 public key object.
+ *
+ * This function is responsible for properly deallocating a BIP32 public key object (`cardano_bip32_public_key_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the BIP32 public key object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_bip32_public_key_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the BIP32 public key
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_bip32_public_key_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_bip32_public_key_t* public_key = (cardano_bip32_public_key_t*)object;
+
+  if (public_key->key_material != NULL)
+  {
+    cardano_buffer_unref(&public_key->key_material);
+  }
+
+  _cardano_free(public_key);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_bip32_public_key_from_bytes(
+  const byte_t*                data,
+  const size_t                 data_length,
+  cardano_bip32_public_key_t** public_key)
+{
+  if (public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data_length != BIP32_ED25519_PUBLIC_KEY_LENGTH)
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_INVALID_BIP32_PUBLIC_KEY_SIZE;
+  }
+
+  cardano_bip32_public_key_t* bip32_public_key = (cardano_bip32_public_key_t*)_cardano_malloc(sizeof(cardano_bip32_public_key_t));
+
+  if (bip32_public_key == NULL)
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  bip32_public_key->base.ref_count     = 1;
+  bip32_public_key->base.deallocator   = cardano_bip32_public_key_deallocate;
+  bip32_public_key->base.last_error[0] = '\0';
+  bip32_public_key->key_material       = cardano_buffer_new_from(data, data_length);
+
+  if (bip32_public_key->key_material == NULL)
+  {
+    _cardano_free(bip32_public_key);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *public_key = bip32_public_key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bip32_public_key_from_hex(
+  const char*                  hex,
+  const size_t                 hex_length,
+  cardano_bip32_public_key_t** public_key)
+{
+  if (public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex == NULL)
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex_length != (BIP32_ED25519_PUBLIC_KEY_LENGTH * 2U))
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_INVALID_BIP32_PUBLIC_KEY_SIZE;
+  }
+
+  cardano_bip32_public_key_t* bip32_public_key = (cardano_bip32_public_key_t*)_cardano_malloc(sizeof(cardano_bip32_public_key_t));
+
+  if (bip32_public_key == NULL)
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  bip32_public_key->base.ref_count     = 1;
+  bip32_public_key->base.deallocator   = cardano_bip32_public_key_deallocate;
+  bip32_public_key->base.last_error[0] = '\0';
+  bip32_public_key->key_material       = cardano_buffer_from_hex(hex, hex_length);
+
+  if (bip32_public_key->key_material == NULL)
+  {
+    _cardano_free(bip32_public_key);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *public_key = bip32_public_key;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_bip32_public_key_unref(cardano_bip32_public_key_t** bip32_public_key)
+{
+  if ((bip32_public_key == NULL) || (*bip32_public_key == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*bip32_public_key)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *bip32_public_key = NULL;
+    return;
+  }
+}
+
+void
+cardano_bip32_public_key_ref(cardano_bip32_public_key_t* bip32_public_key)
+{
+  if (bip32_public_key == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&bip32_public_key->base);
+}
+
+size_t
+cardano_bip32_public_key_refcount(const cardano_bip32_public_key_t* bip32_public_key)
+{
+  if (bip32_public_key == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&bip32_public_key->base);
+}
+
+cardano_error_t
+cardano_bip32_public_key_derive(
+  const cardano_bip32_public_key_t* bip32_public_key,
+  const uint32_t*                   indices,
+  const size_t                      indices_count,
+  cardano_bip32_public_key_t**      derived_bip32_public_key)
+{
+  if (derived_bip32_public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bip32_public_key == NULL)
+  {
+    *derived_bip32_public_key = NULL;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (indices == NULL)
+  {
+    *derived_bip32_public_key = NULL;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (indices_count == 0U)
+  {
+    *derived_bip32_public_key = NULL;
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_bip32_public_key_t* working_key      = NULL;
+  cardano_error_t             clone_key_result = cardano_bip32_public_key_from_bytes(
+    cardano_buffer_get_data(bip32_public_key->key_material),
+    BIP32_ED25519_PUBLIC_KEY_LENGTH,
+    &working_key);
+
+  if (clone_key_result != CARDANO_SUCCESS)
+  {
+    *derived_bip32_public_key = NULL;
+
+    return clone_key_result;
+  }
+
+  for (size_t i = 0; i < indices_count; ++i)
+  {
+    if (_cardano_crypto_is_hardened_derivation(indices[i]))
+    {
+      *derived_bip32_public_key = NULL;
+      cardano_bip32_public_key_unref(&working_key);
+
+      return CARDANO_ERROR_INVALID_BIP32_DERIVATION_INDEX;
+    }
+
+    const byte_t*   key_data         = cardano_buffer_get_data(working_key->key_material);
+    byte_t          derived_key[64U] = { 0 };
+    cardano_error_t error            = _cardano_crypto_derive_public(key_data, (int32_t)indices[i], &derived_key[0], 64U);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      *derived_bip32_public_key = NULL;
+      cardano_bip32_public_key_unref(&working_key);
+
+      return error;
+    }
+
+    cardano_bip32_public_key_t* new_key = NULL;
+
+    error = cardano_bip32_public_key_from_bytes(&derived_key[0], BIP32_ED25519_PUBLIC_KEY_LENGTH, &new_key);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      *derived_bip32_public_key = NULL;
+      cardano_bip32_public_key_unref(&working_key);
+
+      return error;
+    }
+
+    cardano_bip32_public_key_unref(&working_key);
+    working_key = new_key;
+  }
+
+  *derived_bip32_public_key = working_key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bip32_public_key_to_ed25519_key(
+  const cardano_bip32_public_key_t* public_key,
+  cardano_ed25519_public_key_t**    ed25519_public_key)
+{
+  static const size_t ed25519_public_key_length = 32;
+
+  if (ed25519_public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (public_key == NULL)
+  {
+    *ed25519_public_key = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const byte_t* data = cardano_buffer_get_data(public_key->key_material);
+
+  return cardano_ed25519_public_key_from_bytes(data, ed25519_public_key_length, ed25519_public_key);
+}
+
+const byte_t*
+cardano_bip32_public_key_get_data(const cardano_bip32_public_key_t* bip32_public_key)
+{
+  if (bip32_public_key == NULL)
+  {
+    return NULL;
+  }
+
+  return cardano_buffer_get_data(bip32_public_key->key_material);
+}
+
+size_t
+cardano_bip32_public_key_get_bytes_size(const cardano_bip32_public_key_t* bip32_public_key)
+{
+  if (bip32_public_key == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_buffer_get_size(bip32_public_key->key_material);
+}
+
+cardano_error_t
+cardano_bip32_public_key_to_bytes(
+  const cardano_bip32_public_key_t* public_key,
+  byte_t*                           out_key_bytes,
+  const size_t                      out_key_length)
+{
+  if (public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_copy_bytes(public_key->key_material, out_key_bytes, out_key_length);
+}
+
+size_t
+cardano_bip32_public_key_get_hex_size(const cardano_bip32_public_key_t* bip32_public_key)
+{
+  if (bip32_public_key == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_buffer_get_hex_size(bip32_public_key->key_material);
+}
+
+cardano_error_t
+cardano_bip32_public_key_to_hex(
+  const cardano_bip32_public_key_t* bip32_public_key,
+  char*                             hex,
+  const size_t                      hex_length)
+{
+  if (bip32_public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_to_hex(bip32_public_key->key_material, hex, hex_length);
+}
+
+cardano_error_t
+cardano_bip32_public_key_to_hash(
+  const cardano_bip32_public_key_t* bip32_public_key,
+  cardano_blake2b_hash_t**          hash)
+{
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bip32_public_key == NULL)
+  {
+    *hash = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const byte_t* data = cardano_buffer_get_data(bip32_public_key->key_material);
+
+  return cardano_blake2b_compute_hash(data, cardano_buffer_get_size(bip32_public_key->key_material), CARDANO_BLAKE2B_HASH_SIZE_224, hash);
+}
+
+cardano_error_t
+cardano_bip32_public_key_deep_clone(const cardano_bip32_public_key_t* source, cardano_bip32_public_key_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bip32_public_key_t* copy = _cardano_malloc(sizeof(cardano_bip32_public_key_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key_material       = NULL;
+
+  if (source->key_material != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->key_material, &copy->key_material);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/crypto/blake2b_hash.c b/vendor/src/crypto/blake2b_hash.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/blake2b_hash.c
@@ -0,0 +1,595 @@
+/**
+ * \file blake2b_hash.c
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+
+#include <cardano/buffer.h>
+#include <cardano/export.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "blake2b_hash_internal.h"
+
+#include <assert.h>
+#include <sodium.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a BLAKE2b cryptographic hash.
+ */
+typedef struct cardano_blake2b_hash_t
+{
+    cardano_object_t  base;
+    cardano_buffer_t* buffer;
+} cardano_blake2b_hash_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a Blake2b hash object.
+ *
+ * This function is responsible for properly deallocating a Blake2b hash object (`cardano_blake2b_hash_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the Blake2b hash object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_blake2b_hash_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the Blake2b hash
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_blake2b_hash_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_blake2b_hash_t* hash = (cardano_blake2b_hash_t*)object;
+
+  if (hash->buffer != NULL)
+  {
+    cardano_buffer_unref(&hash->buffer);
+  }
+
+  _cardano_free(hash);
+}
+
+/**
+ * \brief Reads the byte string that holds an encoded hash.
+ *
+ * \param[in] reader The CBOR reader positioned at the byte string.
+ * \param[out] byte_string On success, the bytes of the byte string, owned by the caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_UNEXPECTED_CBOR_TYPE if the next item is
+ *         not a byte string, or the error reported by the reader.
+ */
+static cardano_error_t
+cardano_blake2b_hash_read_byte_string(cardano_cbor_reader_t* reader, cardano_buffer_t** byte_string)
+{
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  const cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (state != CARDANO_CBOR_READER_STATE_BYTESTRING)
+  {
+    return CARDANO_ERROR_UNEXPECTED_CBOR_TYPE;
+  }
+
+  return cardano_cbor_reader_read_bytestring(reader, byte_string);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_blake2b_compute_hash(
+  const byte_t*            data,
+  const size_t             data_length,
+  const size_t             hash_length,
+  cardano_blake2b_hash_t** hash)
+{
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    *hash = NULL;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data_length == 0U)
+  {
+    *hash = NULL;
+
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  if (hash_length == 0U)
+  {
+    *hash = NULL;
+
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_blake2b_hash_t* obj = (cardano_blake2b_hash_t*)_cardano_malloc(sizeof(cardano_blake2b_hash_t));
+
+  if (obj == NULL)
+  {
+    *hash = NULL;
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  obj->base.ref_count     = 1;
+  obj->base.deallocator   = cardano_blake2b_hash_deallocate;
+  obj->base.last_error[0] = '\0';
+  obj->buffer             = cardano_buffer_new(hash_length);
+
+  if (obj->buffer == NULL)
+  {
+    _cardano_free(obj);
+    *hash = NULL;
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  int init_result = sodium_init();
+
+  if (init_result == -1)
+  {
+    cardano_blake2b_hash_deallocate(obj);
+    *hash = NULL;
+
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  int hashing_result = crypto_generichash(
+    cardano_buffer_get_data(obj->buffer),
+    hash_length,
+    data,
+    data_length,
+    NULL,
+    0U);
+
+  if (hashing_result == -1)
+  {
+    cardano_blake2b_hash_deallocate(obj);
+    *hash = NULL;
+
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  cardano_error_t set_size_result = cardano_buffer_set_size(obj->buffer, hash_length);
+
+  assert(set_size_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(set_size_result);
+
+  *hash = obj;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_blake2b_hash_from_bytes(
+  const byte_t*            data,
+  const size_t             data_length,
+  cardano_blake2b_hash_t** hash)
+{
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    *hash = NULL;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data_length == 0U)
+  {
+    *hash = NULL;
+
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_blake2b_hash_t* blake2b_hash = (cardano_blake2b_hash_t*)_cardano_malloc(sizeof(cardano_blake2b_hash_t));
+
+  if (blake2b_hash == NULL)
+  {
+    *hash = NULL;
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  blake2b_hash->base.ref_count     = 1;
+  blake2b_hash->base.deallocator   = cardano_blake2b_hash_deallocate;
+  blake2b_hash->base.last_error[0] = '\0';
+  blake2b_hash->buffer             = cardano_buffer_new_from(data, data_length);
+
+  if (blake2b_hash->buffer == NULL)
+  {
+    *hash = NULL;
+    _cardano_free(blake2b_hash);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *hash = blake2b_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_blake2b_hash_from_hex(
+  const char*              hex,
+  const size_t             hex_length,
+  cardano_blake2b_hash_t** hash)
+{
+  if (hex == NULL)
+  {
+    *hash = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex_length == 0U)
+  {
+    *hash = NULL;
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_blake2b_hash_t* blake2b_hash = (cardano_blake2b_hash_t*)_cardano_malloc(sizeof(cardano_blake2b_hash_t));
+
+  if (blake2b_hash == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  blake2b_hash->base.ref_count     = 1;
+  blake2b_hash->base.deallocator   = cardano_blake2b_hash_deallocate;
+  blake2b_hash->base.last_error[0] = '\0';
+  blake2b_hash->buffer             = cardano_buffer_from_hex(hex, hex_length);
+
+  if (blake2b_hash->buffer == NULL)
+  {
+    _cardano_free(blake2b_hash);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *hash = blake2b_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_blake2b_hash_from_cbor(cardano_cbor_reader_t* reader, cardano_blake2b_hash_t** blake2b_hash)
+{
+  cardano_buffer_t*     byte_string             = NULL;
+  const cardano_error_t read_byte_string_result = cardano_blake2b_hash_read_byte_string(reader, &byte_string);
+
+  if (read_byte_string_result != CARDANO_SUCCESS)
+  {
+    return read_byte_string_result;
+  }
+
+  const cardano_error_t create_hash_result = cardano_blake2b_hash_from_bytes(
+    cardano_buffer_get_data(byte_string),
+    cardano_buffer_get_size(byte_string),
+    blake2b_hash);
+
+  cardano_buffer_unref(&byte_string);
+
+  return create_hash_result;
+}
+
+cardano_error_t
+_cardano_blake2b_hash_from_cbor_allow_empty(cardano_cbor_reader_t* reader, cardano_blake2b_hash_t** blake2b_hash)
+{
+  if (blake2b_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t*     byte_string             = NULL;
+  const cardano_error_t read_byte_string_result = cardano_blake2b_hash_read_byte_string(reader, &byte_string);
+
+  if (read_byte_string_result != CARDANO_SUCCESS)
+  {
+    *blake2b_hash = NULL;
+
+    return read_byte_string_result;
+  }
+
+  if (cardano_buffer_get_size(byte_string) > 0U)
+  {
+    const cardano_error_t create_hash_result = cardano_blake2b_hash_from_bytes(
+      cardano_buffer_get_data(byte_string),
+      cardano_buffer_get_size(byte_string),
+      blake2b_hash);
+
+    cardano_buffer_unref(&byte_string);
+
+    return create_hash_result;
+  }
+
+  cardano_blake2b_hash_t* empty_hash = (cardano_blake2b_hash_t*)_cardano_malloc(sizeof(cardano_blake2b_hash_t));
+
+  if (empty_hash == NULL)
+  {
+    cardano_buffer_unref(&byte_string);
+    *blake2b_hash = NULL;
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  empty_hash->base.ref_count     = 1;
+  empty_hash->base.deallocator   = cardano_blake2b_hash_deallocate;
+  empty_hash->base.last_error[0] = '\0';
+  empty_hash->buffer             = byte_string;
+
+  *blake2b_hash = empty_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_blake2b_hash_to_cbor(
+  const cardano_blake2b_hash_t* blake2b_hash,
+  cardano_cbor_writer_t*        writer)
+{
+  if (blake2b_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_bytes_result = cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_buffer_get_data(blake2b_hash->buffer),
+    cardano_buffer_get_size(blake2b_hash->buffer));
+
+  if (write_bytes_result != CARDANO_SUCCESS)
+  {
+    return write_bytes_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_blake2b_hash_to_cip116_json(const cardano_blake2b_hash_t* blake2b_hash, cardano_json_writer_t* writer)
+{
+  if ((blake2b_hash == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_buffer_as_hex(writer, blake2b_hash->buffer);
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_blake2b_hash_equals(
+  const cardano_blake2b_hash_t* lhs,
+  const cardano_blake2b_hash_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  return cardano_buffer_equals(lhs->buffer, rhs->buffer);
+}
+
+int32_t
+cardano_blake2b_hash_compare(
+  const cardano_blake2b_hash_t* lhs,
+  const cardano_blake2b_hash_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return 0;
+  }
+
+  if (lhs == NULL)
+  {
+    return -1;
+  }
+
+  if (rhs == NULL)
+  {
+    return 1;
+  }
+
+  return cardano_buffer_compare(lhs->buffer, rhs->buffer);
+}
+
+void
+cardano_blake2b_hash_unref(cardano_blake2b_hash_t** blake2b_hash)
+{
+  if ((blake2b_hash == NULL) || (*blake2b_hash == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*blake2b_hash)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *blake2b_hash = NULL;
+    return;
+  }
+}
+
+void
+cardano_blake2b_hash_ref(cardano_blake2b_hash_t* blake2b_hash)
+{
+  if (blake2b_hash == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&blake2b_hash->base);
+}
+
+size_t
+cardano_blake2b_hash_refcount(const cardano_blake2b_hash_t* blake2b_hash)
+{
+  if (blake2b_hash == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&blake2b_hash->base);
+}
+
+const byte_t*
+cardano_blake2b_hash_get_data(const cardano_blake2b_hash_t* blake2b_hash)
+{
+  if (blake2b_hash == NULL)
+  {
+    return NULL;
+  }
+
+  return cardano_buffer_get_data(blake2b_hash->buffer);
+}
+
+size_t
+cardano_blake2b_hash_get_bytes_size(const cardano_blake2b_hash_t* blake2b_hash)
+{
+  if (blake2b_hash == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_buffer_get_size(blake2b_hash->buffer);
+}
+
+cardano_error_t
+cardano_blake2b_hash_to_bytes(
+  const cardano_blake2b_hash_t* blake2b_hash,
+  byte_t*                       hash,
+  const size_t                  hash_length)
+{
+  if (blake2b_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_copy_bytes(blake2b_hash->buffer, hash, hash_length);
+}
+
+size_t
+cardano_blake2b_hash_get_hex_size(const cardano_blake2b_hash_t* blake2b_hash)
+{
+  if (blake2b_hash == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_buffer_get_hex_size(blake2b_hash->buffer);
+}
+
+cardano_error_t
+cardano_blake2b_hash_to_hex(
+  const cardano_blake2b_hash_t* blake2b_hash,
+  char*                         hex_hash,
+  const size_t                  hash_len)
+{
+  if (blake2b_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_to_hex(blake2b_hash->buffer, hex_hash, hash_len);
+}
+
+cardano_error_t
+cardano_blake2b_hash_deep_clone(const cardano_blake2b_hash_t* source, cardano_blake2b_hash_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t* copy = _cardano_malloc(sizeof(cardano_blake2b_hash_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->buffer             = NULL;
+
+  if (source->buffer != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->buffer, &copy->buffer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/crypto/blake2b_hash_internal.h b/vendor/src/crypto/blake2b_hash_internal.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/blake2b_hash_internal.h
@@ -0,0 +1,60 @@
+/**
+ * \file blake2b_hash_internal.h
+ *
+ * \author angel.castillo
+ * \date   Oct 31, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BLAKE2B_HASH_INTERNAL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BLAKE2B_HASH_INTERNAL_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Decodes a hash from a CBOR byte string that may be empty.
+ *
+ * Behaves like \ref cardano_blake2b_hash_from_cbor, except that a zero length byte string is accepted
+ * and yields a hash of zero bytes. The ledger stores some hashes, such as the hash of the stake pool
+ * metadata, as arbitrary byte arrays, so an empty value is valid on chain. A hash read this way encodes
+ * back as an empty byte string and writes an empty string in CIP-116 JSON.
+ *
+ * \param[in] reader The CBOR reader positioned at the byte string.
+ * \param[out] blake2b_hash On success, the decoded hash, owned by the caller and released with
+ *             \ref cardano_blake2b_hash_unref.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_UNEXPECTED_CBOR_TYPE if the next item is
+ *         not a byte string, \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if memory cannot be allocated, or
+ *         the error reported by the reader.
+ */
+cardano_error_t
+_cardano_blake2b_hash_from_cbor_allow_empty(cardano_cbor_reader_t* reader, cardano_blake2b_hash_t** blake2b_hash);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_CRYPTO_BLAKE2B_HASH_INTERNAL_H */
diff --git a/vendor/src/crypto/blake2b_hash_set.c b/vendor/src/crypto/blake2b_hash_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/blake2b_hash_set.c
@@ -0,0 +1,500 @@
+/**
+ * \file blake2b_hash_set.c
+ *
+ * \author angel.castillo
+ * \date   Sep 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/blake2b_hash_set.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano blake2b hash set.
+ */
+typedef struct cardano_blake2b_hash_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_blake2b_hash_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a blake2b_hash_set object.
+ *
+ * This function is responsible for properly deallocating a blake2b_hash_set object (`cardano_blake2b_hash_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the blake2b_hash_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_blake2b_hash_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the blake2b_hash_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_blake2b_hash_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_blake2b_hash_set_t* list = (cardano_blake2b_hash_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their blake2b_hash.
+ *
+ * This function casts the cardano_object_t objects to cardano_blake2b_hash_t
+ * and compares their hashes using the cardano_blake2b_hash_compare function.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the hash of lhs is less than the hash of rhs, zero if they are equal,
+ *         and a positive value if the hash of lhs is greater than the hash of rhs.
+ */
+static int32_t
+compare_by_hash(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_blake2b_hash_t* lhs_hash = (const cardano_blake2b_hash_t*)((const void*)lhs);
+  const cardano_blake2b_hash_t* rhs_hash = (const cardano_blake2b_hash_t*)((const void*)rhs);
+
+  return cardano_blake2b_hash_compare(lhs_hash, rhs_hash);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_blake2b_hash_set_new(cardano_blake2b_hash_set_t** blake2b_hash_set)
+{
+  if (blake2b_hash_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_set_t* list = _cardano_malloc(sizeof(cardano_blake2b_hash_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_blake2b_hash_set_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *blake2b_hash_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_blake2b_hash_set_from_cbor(cardano_cbor_reader_t* reader, cardano_blake2b_hash_set_t** blake2b_hash_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (blake2b_hash_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_set_t* list   = NULL;
+  cardano_error_t             result = cardano_blake2b_hash_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("blake2b_hash_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_blake2b_hash_t* element = NULL;
+
+    result = cardano_blake2b_hash_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_blake2b_hash_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_blake2b_hash_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("blake2b_hash_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(&list);
+    return result;
+  }
+
+  cardano_array_sort(list->array, compare_by_hash, NULL);
+
+  *blake2b_hash_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_blake2b_hash_set_to_cbor(const cardano_blake2b_hash_set_t* blake2b_hash_set, cardano_cbor_writer_t* writer)
+{
+  if (blake2b_hash_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(blake2b_hash_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  size_t array_size = cardano_array_get_size(blake2b_hash_set->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(blake2b_hash_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(blake2b_hash_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in blake2b_hash_set is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_blake2b_hash_to_cbor((cardano_blake2b_hash_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_blake2b_hash_set_to_cip116_json(const cardano_blake2b_hash_set_t* hashes, cardano_json_writer_t* json)
+{
+  if ((hashes == NULL) || (json == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(json);
+
+  const size_t count = cardano_blake2b_hash_set_get_length(hashes);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    cardano_blake2b_hash_t* hash = NULL;
+
+    cardano_error_t error = cardano_blake2b_hash_set_get(hashes, i, (cardano_blake2b_hash_t**)&hash);
+    cardano_blake2b_hash_unref(&hash);
+
+    assert(error == CARDANO_SUCCESS);
+    CARDANO_UNUSED(error);
+
+    error = cardano_blake2b_hash_to_cip116_json(hash, json);
+
+    assert(error == CARDANO_SUCCESS);
+    CARDANO_UNUSED(error);
+  }
+
+  cardano_json_writer_write_end_array(json);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_blake2b_hash_set_get_length(const cardano_blake2b_hash_set_t* blake2b_hash_set)
+{
+  if (blake2b_hash_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(blake2b_hash_set->array);
+}
+
+cardano_error_t
+cardano_blake2b_hash_set_get(
+  const cardano_blake2b_hash_set_t* blake2b_hash_set,
+  size_t                            index,
+  cardano_blake2b_hash_t**          element)
+{
+  if (blake2b_hash_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(blake2b_hash_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_blake2b_hash_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_blake2b_hash_set_add(cardano_blake2b_hash_set_t* blake2b_hash_set, cardano_blake2b_hash_t* element)
+{
+  if (blake2b_hash_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(blake2b_hash_set->array);
+  const size_t new_size      = cardano_array_push(blake2b_hash_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(blake2b_hash_set->array, compare_by_hash, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_blake2b_hash_set_unref(cardano_blake2b_hash_set_t** blake2b_hash_set)
+{
+  if ((blake2b_hash_set == NULL) || (*blake2b_hash_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*blake2b_hash_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *blake2b_hash_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_blake2b_hash_set_ref(cardano_blake2b_hash_set_t* blake2b_hash_set)
+{
+  if (blake2b_hash_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&blake2b_hash_set->base);
+}
+
+size_t
+cardano_blake2b_hash_set_refcount(const cardano_blake2b_hash_set_t* blake2b_hash_set)
+{
+  if (blake2b_hash_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&blake2b_hash_set->base);
+}
+
+void
+cardano_blake2b_hash_set_set_last_error(cardano_blake2b_hash_set_t* blake2b_hash_set, const char* message)
+{
+  cardano_object_set_last_error(&blake2b_hash_set->base, message);
+}
+
+const char*
+cardano_blake2b_hash_set_get_last_error(const cardano_blake2b_hash_set_t* blake2b_hash_set)
+{
+  return cardano_object_get_last_error(&blake2b_hash_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_blake2b_hash_t* copy   = NULL;
+  const cardano_error_t   result = cardano_blake2b_hash_deep_clone((const cardano_blake2b_hash_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_blake2b_hash_set_deep_clone(const cardano_blake2b_hash_set_t* source, cardano_blake2b_hash_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_set_t* copy = _cardano_malloc(sizeof(cardano_blake2b_hash_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/crypto/crc32.c b/vendor/src/crypto/crc32.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/crc32.c
@@ -0,0 +1,134 @@
+/**
+ * \file crc21.c
+ *
+ * \author angel.castillo
+ * \date   Mar 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/crc32.h>
+
+/* MACROS ********************************************************************/
+
+#ifdef __GNUC__
+#ifdef __cplusplus
+#define CARDANO_32_ALIGN alignas(32)
+#else
+#define CARDANO_32_ALIGN __attribute__((aligned(32))) const
+#endif
+#else
+#define CARDANO_32_ALIGN
+#endif
+
+/* STATIC CONSTANTS **********************************************************/
+
+/* clang-format off */
+
+// We suppress the MISRA C:2012 rule 8.9 because the table inlining the table inside the function
+// would make the code less readable.
+
+// cppcheck-suppress misra-c2012-8.9
+CARDANO_32_ALIGN static uint32_t s_crc32_table[256] =
+{
+    (uint32_t)(0x00000000), (uint32_t)(0x77073096), (uint32_t)(0xee0e612c), (uint32_t)(0x990951ba),
+    (uint32_t)(0x076dc419), (uint32_t)(0x706af48f), (uint32_t)(0xe963a535), (uint32_t)(0x9e6495a3),
+    (uint32_t)(0x0edb8832), (uint32_t)(0x79dcb8a4), (uint32_t)(0xe0d5e91e), (uint32_t)(0x97d2d988),
+    (uint32_t)(0x09b64c2b), (uint32_t)(0x7eb17cbd), (uint32_t)(0xe7b82d07), (uint32_t)(0x90bf1d91),
+    (uint32_t)(0x1db71064), (uint32_t)(0x6ab020f2), (uint32_t)(0xf3b97148), (uint32_t)(0x84be41de),
+    (uint32_t)(0x1adad47d), (uint32_t)(0x6ddde4eb), (uint32_t)(0xf4d4b551), (uint32_t)(0x83d385c7),
+    (uint32_t)(0x136c9856), (uint32_t)(0x646ba8c0), (uint32_t)(0xfd62f97a), (uint32_t)(0x8a65c9ec),
+    (uint32_t)(0x14015c4f), (uint32_t)(0x63066cd9), (uint32_t)(0xfa0f3d63), (uint32_t)(0x8d080df5),
+    (uint32_t)(0x3b6e20c8), (uint32_t)(0x4c69105e), (uint32_t)(0xd56041e4), (uint32_t)(0xa2677172),
+    (uint32_t)(0x3c03e4d1), (uint32_t)(0x4b04d447), (uint32_t)(0xd20d85fd), (uint32_t)(0xa50ab56b),
+    (uint32_t)(0x35b5a8fa), (uint32_t)(0x42b2986c), (uint32_t)(0xdbbbc9d6), (uint32_t)(0xacbcf940),
+    (uint32_t)(0x32d86ce3), (uint32_t)(0x45df5c75), (uint32_t)(0xdcd60dcf), (uint32_t)(0xabd13d59),
+    (uint32_t)(0x26d930ac), (uint32_t)(0x51de003a), (uint32_t)(0xc8d75180), (uint32_t)(0xbfd06116),
+    (uint32_t)(0x21b4f4b5), (uint32_t)(0x56b3c423), (uint32_t)(0xcfba9599), (uint32_t)(0xb8bda50f),
+    (uint32_t)(0x2802b89e), (uint32_t)(0x5f058808), (uint32_t)(0xc60cd9b2), (uint32_t)(0xb10be924),
+    (uint32_t)(0x2f6f7c87), (uint32_t)(0x58684c11), (uint32_t)(0xc1611dab), (uint32_t)(0xb6662d3d),
+    (uint32_t)(0x76dc4190), (uint32_t)(0x01db7106), (uint32_t)(0x98d220bc), (uint32_t)(0xefd5102a),
+    (uint32_t)(0x71b18589), (uint32_t)(0x06b6b51f), (uint32_t)(0x9fbfe4a5), (uint32_t)(0xe8b8d433),
+    (uint32_t)(0x7807c9a2), (uint32_t)(0x0f00f934), (uint32_t)(0x9609a88e), (uint32_t)(0xe10e9818),
+    (uint32_t)(0x7f6a0dbb), (uint32_t)(0x086d3d2d), (uint32_t)(0x91646c97), (uint32_t)(0xe6635c01),
+    (uint32_t)(0x6b6b51f4), (uint32_t)(0x1c6c6162), (uint32_t)(0x856530d8), (uint32_t)(0xf262004e),
+    (uint32_t)(0x6c0695ed), (uint32_t)(0x1b01a57b), (uint32_t)(0x8208f4c1), (uint32_t)(0xf50fc457),
+    (uint32_t)(0x65b0d9c6), (uint32_t)(0x12b7e950), (uint32_t)(0x8bbeb8ea), (uint32_t)(0xfcb9887c),
+    (uint32_t)(0x62dd1ddf), (uint32_t)(0x15da2d49), (uint32_t)(0x8cd37cf3), (uint32_t)(0xfbd44c65),
+    (uint32_t)(0x4db26158), (uint32_t)(0x3ab551ce), (uint32_t)(0xa3bc0074), (uint32_t)(0xd4bb30e2),
+    (uint32_t)(0x4adfa541), (uint32_t)(0x3dd895d7), (uint32_t)(0xa4d1c46d), (uint32_t)(0xd3d6f4fb),
+    (uint32_t)(0x4369e96a), (uint32_t)(0x346ed9fc), (uint32_t)(0xad678846), (uint32_t)(0xda60b8d0),
+    (uint32_t)(0x44042d73), (uint32_t)(0x33031de5), (uint32_t)(0xaa0a4c5f), (uint32_t)(0xdd0d7cc9),
+    (uint32_t)(0x5005713c), (uint32_t)(0x270241aa), (uint32_t)(0xbe0b1010), (uint32_t)(0xc90c2086),
+    (uint32_t)(0x5768b525), (uint32_t)(0x206f85b3), (uint32_t)(0xb966d409), (uint32_t)(0xce61e49f),
+    (uint32_t)(0x5edef90e), (uint32_t)(0x29d9c998), (uint32_t)(0xb0d09822), (uint32_t)(0xc7d7a8b4),
+    (uint32_t)(0x59b33d17), (uint32_t)(0x2eb40d81), (uint32_t)(0xb7bd5c3b), (uint32_t)(0xc0ba6cad),
+    (uint32_t)(0xedb88320), (uint32_t)(0x9abfb3b6), (uint32_t)(0x03b6e20c), (uint32_t)(0x74b1d29a),
+    (uint32_t)(0xead54739), (uint32_t)(0x9dd277af), (uint32_t)(0x04db2615), (uint32_t)(0x73dc1683),
+    (uint32_t)(0xe3630b12), (uint32_t)(0x94643b84), (uint32_t)(0x0d6d6a3e), (uint32_t)(0x7a6a5aa8),
+    (uint32_t)(0xe40ecf0b), (uint32_t)(0x9309ff9d), (uint32_t)(0x0a00ae27), (uint32_t)(0x7d079eb1),
+    (uint32_t)(0xf00f9344), (uint32_t)(0x8708a3d2), (uint32_t)(0x1e01f268), (uint32_t)(0x6906c2fe),
+    (uint32_t)(0xf762575d), (uint32_t)(0x806567cb), (uint32_t)(0x196c3671), (uint32_t)(0x6e6b06e7),
+    (uint32_t)(0xfed41b76), (uint32_t)(0x89d32be0), (uint32_t)(0x10da7a5a), (uint32_t)(0x67dd4acc),
+    (uint32_t)(0xf9b9df6f), (uint32_t)(0x8ebeeff9), (uint32_t)(0x17b7be43), (uint32_t)(0x60b08ed5),
+    (uint32_t)(0xd6d6a3e8), (uint32_t)(0xa1d1937e), (uint32_t)(0x38d8c2c4), (uint32_t)(0x4fdff252),
+    (uint32_t)(0xd1bb67f1), (uint32_t)(0xa6bc5767), (uint32_t)(0x3fb506dd), (uint32_t)(0x48b2364b),
+    (uint32_t)(0xd80d2bda), (uint32_t)(0xaf0a1b4c), (uint32_t)(0x36034af6), (uint32_t)(0x41047a60),
+    (uint32_t)(0xdf60efc3), (uint32_t)(0xa867df55), (uint32_t)(0x316e8eef), (uint32_t)(0x4669be79),
+    (uint32_t)(0xcb61b38c), (uint32_t)(0xbc66831a), (uint32_t)(0x256fd2a0), (uint32_t)(0x5268e236),
+    (uint32_t)(0xcc0c7795), (uint32_t)(0xbb0b4703), (uint32_t)(0x220216b9), (uint32_t)(0x5505262f),
+    (uint32_t)(0xc5ba3bbe), (uint32_t)(0xb2bd0b28), (uint32_t)(0x2bb45a92), (uint32_t)(0x5cb36a04),
+    (uint32_t)(0xc2d7ffa7), (uint32_t)(0xb5d0cf31), (uint32_t)(0x2cd99e8b), (uint32_t)(0x5bdeae1d),
+    (uint32_t)(0x9b64c2b0), (uint32_t)(0xec63f226), (uint32_t)(0x756aa39c), (uint32_t)(0x026d930a),
+    (uint32_t)(0x9c0906a9), (uint32_t)(0xeb0e363f), (uint32_t)(0x72076785), (uint32_t)(0x05005713),
+    (uint32_t)(0x95bf4a82), (uint32_t)(0xe2b87a14), (uint32_t)(0x7bb12bae), (uint32_t)(0x0cb61b38),
+    (uint32_t)(0x92d28e9b), (uint32_t)(0xe5d5be0d), (uint32_t)(0x7cdcefb7), (uint32_t)(0x0bdbdf21),
+    (uint32_t)(0x86d3d2d4), (uint32_t)(0xf1d4e242), (uint32_t)(0x68ddb3f8), (uint32_t)(0x1fda836e),
+    (uint32_t)(0x81be16cd), (uint32_t)(0xf6b9265b), (uint32_t)(0x6fb077e1), (uint32_t)(0x18b74777),
+    (uint32_t)(0x88085ae6), (uint32_t)(0xff0f6a70), (uint32_t)(0x66063bca), (uint32_t)(0x11010b5c),
+    (uint32_t)(0x8f659eff), (uint32_t)(0xf862ae69), (uint32_t)(0x616bffd3), (uint32_t)(0x166ccf45),
+    (uint32_t)(0xa00ae278), (uint32_t)(0xd70dd2ee), (uint32_t)(0x4e048354), (uint32_t)(0x3903b3c2),
+    (uint32_t)(0xa7672661), (uint32_t)(0xd06016f7), (uint32_t)(0x4969474d), (uint32_t)(0x3e6e77db),
+    (uint32_t)(0xaed16a4a), (uint32_t)(0xd9d65adc), (uint32_t)(0x40df0b66), (uint32_t)(0x37d83bf0),
+    (uint32_t)(0xa9bcae53), (uint32_t)(0xdebb9ec5), (uint32_t)(0x47b2cf7f), (uint32_t)(0x30b5ffe9),
+    (uint32_t)(0xbdbdf21c), (uint32_t)(0xcabac28a), (uint32_t)(0x53b39330), (uint32_t)(0x24b4a3a6),
+    (uint32_t)(0xbad03605), (uint32_t)(0xcdd70693), (uint32_t)(0x54de5729), (uint32_t)(0x23d967bf),
+    (uint32_t)(0xb3667a2e), (uint32_t)(0xc4614ab8), (uint32_t)(0x5d681b02), (uint32_t)(0x2a6f2b94),
+    (uint32_t)(0xb40bbe37), (uint32_t)(0xc30c8ea1), (uint32_t)(0x5a05df1b), (uint32_t)(0x2d02ef8d)
+};
+
+/* clang-format on */
+
+/* DEFINITIONS ****************************************************************/
+
+uint32_t
+cardano_checksum_crc32(const byte_t* data, const size_t size)
+{
+  if ((data == NULL) || (size == 0U))
+  {
+    return 0;
+  }
+
+  uint32_t crc = 0xFFFFFFFFU;
+
+  for (size_t i = 0; i < size; ++i)
+  {
+    byte_t k = (data)[i];
+    crc      = s_crc32_table[((byte_t)(crc) ^ k) & 0xFFU] ^ (crc >> 8);
+  }
+  return (crc ^ 0xFFFFFFFF);
+}
diff --git a/vendor/src/crypto/ed25519_private_key.c b/vendor/src/crypto/ed25519_private_key.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/ed25519_private_key.c
@@ -0,0 +1,883 @@
+/**
+ * \file ed25519_private_key.c
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/ed25519_private_key.h>
+
+#include <cardano/buffer.h>
+#include <cardano/export.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <sodium.h>
+#include <string.h>
+
+/* COSTANTS ******************************************************************/
+
+static const size_t SCALAR_SIZE = 32U;
+
+/* ENUMS *********************************************************************/
+
+/**
+ * \brief Enumerates the types of Ed25519 private keys based on their size and structure.
+ */
+typedef enum
+{
+  /**
+   * Represents a standard Ed25519 private key, which is 32 bytes in length.
+   */
+  CARDANO_ED25519_PRIVATE_KEY_SIZE_NORMAL = 32,
+
+  /**
+   * Represents an extended Ed25519 private key, which extends the standard format to 64 bytes in length.
+   * This extended format is divided into two parts:
+   *  - The first 32 bytes consist of an Ed25519 curve scalar, slightly modified (tweaked) for compatibility
+   *    with the ED25519-BIP32 specification.
+   *  - The second 32 bytes serve as an initialization vector (IV).
+   */
+  CARDANO_ED25519_PRIVATE_KEY_SIZE_EXTENDED = 64,
+} cardano_ed25519_private_key_size_t;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an Ed25519 private key within the Cardano ecosystem.
+ *
+ * This structure encapsulates the information necessary to represent and manage an Ed25519
+ * private key. It includes both the raw key material and metadata indicating the key's type
+ * (normal or extended).
+ */
+typedef struct cardano_ed25519_private_key_t
+{
+    cardano_object_t                   base;
+    cardano_buffer_t*                  key_material;
+    cardano_ed25519_private_key_size_t key_size;
+} cardano_ed25519_private_key_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a Ed25519 private key object.
+ *
+ * This function is responsible for properly deallocating a Ed25519 private key object (`cardano_ed25519_private_key_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the Ed25519 private key object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_ed25519_private_key_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the Ed25519 private key
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_ed25519_private_key_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_ed25519_private_key_t* private_key = (cardano_ed25519_private_key_t*)object;
+
+  if (private_key->key_material != NULL)
+  {
+    sodium_memzero(cardano_buffer_get_data(private_key->key_material), cardano_buffer_get_size(private_key->key_material));
+    cardano_buffer_unref(&private_key->key_material);
+  }
+
+  _cardano_free(private_key);
+}
+
+/**
+ * \brief Creates an Ed25519 private key object from a raw byte array.
+ *
+ * This function constructs an Ed25519 private key from a provided array of bytes.
+ *
+ * \param[in] key_bytes A pointer to the byte array containing the binary representation of the Ed25519 private key.
+ * \param[in] key_length The length of the byte array pointed to by `key`. For Ed25519, this is typically 32 bytes.
+ * \param[out] private_key A pointer to a pointer that will be updated to point to the newly created
+ *            `cardano_ed25519_private_key_t` object. The caller is responsible for managing
+ *            the lifecycle of this object, including its deallocation, to prevent memory leaks.
+ * \param[in] key_size The size of the Ed25519 private key, which determines the structure of the key.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the private key was successfully created
+ *         from the byte array. On failure, a non-zero error code is returned, indicating an issue
+ *         with the input parameters or an internal error in the key creation process. If the function
+ *         fails, the value pointed to by `key` is set to `NULL`.
+ */
+static cardano_error_t
+private_key_from_bytes(
+  const byte_t*                            data,
+  const size_t                             data_length,
+  cardano_ed25519_private_key_t**          private_key,
+  const cardano_ed25519_private_key_size_t key_size)
+{
+  if (private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    *private_key = NULL;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data_length != (size_t)key_size)
+  {
+    *private_key = NULL;
+
+    return CARDANO_ERROR_INVALID_ED25519_PRIVATE_KEY_SIZE;
+  }
+
+  cardano_ed25519_private_key_t* ed25519_private_key = (cardano_ed25519_private_key_t*)_cardano_malloc(sizeof(cardano_ed25519_private_key_t));
+
+  if (ed25519_private_key == NULL)
+  {
+    *private_key = NULL;
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  ed25519_private_key->base.ref_count     = 1;
+  ed25519_private_key->base.deallocator   = cardano_ed25519_private_key_deallocate;
+  ed25519_private_key->base.last_error[0] = '\0';
+  ed25519_private_key->key_material       = cardano_buffer_new_from(data, data_length);
+  ed25519_private_key->key_size           = key_size;
+
+  if (ed25519_private_key->key_material == NULL)
+  {
+    *private_key = NULL;
+    _cardano_free(ed25519_private_key);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *private_key = ed25519_private_key;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Generates an Ed25519 private key from a hexadecimal string.
+ *
+ * This function is designed to create an Ed25519 private key from a provided hexadecimal string,
+ * which should represent the bytes of the private key.
+ *
+ * \param[in] hex A pointer to the null-terminated hexadecimal string representing the seed bytes.
+ * \param[in] hex_length The length of the hexadecimal string, not including the null terminator.
+ * \param[out] key A pointer to a pointer that will be updated to point to the newly created
+ *            `cardano_ed25519_private_key_t` object. The caller is responsible for the lifecycle
+ *            management of this object, including its secure deallocation, to prevent memory leaks.
+ * \param[in] key_size The size of the Ed25519 private key, which determines the structure of the key.
+ *
+ * \return cardano_error_t Returns `CARDANO_SUCCESS` if the private key is successfully created
+ *         from the hexadecimal string. On failure, returns a non-zero error code indicating
+ *         an issue with the input parameters. If the function fails, the value pointed to by `key` is set to `NULL`.
+ */
+static cardano_error_t
+private_key_from_hex(
+  const char*                              hex,
+  const size_t                             hex_length,
+  cardano_ed25519_private_key_t**          private_key,
+  const cardano_ed25519_private_key_size_t key_size)
+{
+  if (private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex == NULL)
+  {
+    *private_key = NULL;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex_length != ((size_t)key_size * 2U))
+  {
+    *private_key = NULL;
+
+    return CARDANO_ERROR_INVALID_ED25519_PRIVATE_KEY_SIZE;
+  }
+
+  cardano_ed25519_private_key_t* ed25519_private_key = (cardano_ed25519_private_key_t*)_cardano_malloc(sizeof(cardano_ed25519_private_key_t));
+
+  if (ed25519_private_key == NULL)
+  {
+    *private_key = NULL;
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  ed25519_private_key->base.ref_count     = 1;
+  ed25519_private_key->base.deallocator   = cardano_ed25519_private_key_deallocate;
+  ed25519_private_key->base.last_error[0] = '\0';
+  ed25519_private_key->key_material       = cardano_buffer_from_hex(hex, hex_length);
+  ed25519_private_key->key_size           = key_size;
+
+  if (ed25519_private_key->key_material == NULL)
+  {
+    *private_key = NULL;
+    _cardano_free(ed25519_private_key);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *private_key = ed25519_private_key;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Computes the public key from a "normal" Ed25519 private key.
+ *
+ * \param private_key A pointer to the cardano_ed25519_private_key_t object representing
+ *                    the normal Ed25519 private key.
+ * \param[out] public_key On success, this will point to a newly allocated
+ *                        cardano_ed25519_public_key_t object representing the corresponding
+ *                        public key. The caller is responsible for deallocating this object.
+ * \return Returns CARDANO_SUCCESS on successful computation of the public key. On failure,
+ *         returns a non-zero error code indicating the type of failure.
+ */
+static cardano_error_t
+compute_normal_public_key(
+  const cardano_ed25519_private_key_t* private_key,
+  cardano_ed25519_public_key_t**       public_key)
+{
+  assert(private_key != NULL);
+  assert(public_key != NULL);
+
+  byte_t public_key_bytes[32U] = { 0 };
+  byte_t secret_key_bytes[64U] = { 0 };
+
+  if (crypto_sign_seed_keypair(public_key_bytes, secret_key_bytes, cardano_buffer_get_data(private_key->key_material)) == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  sodium_memzero(secret_key_bytes, 64U);
+
+  cardano_ed25519_public_key_t* ed25519_public_key = NULL;
+  cardano_error_t               error              = cardano_ed25519_public_key_from_bytes(public_key_bytes, SCALAR_SIZE, &ed25519_public_key);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *public_key = ed25519_public_key;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Computes the public key from an "extended" Ed25519 private key.
+ *
+ * \param private_key A pointer to the cardano_ed25519_private_key_t object representing
+ *                    the extended Ed25519 private key.
+ * \param[out] public_key On success, this will point to a newly allocated
+ *                        cardano_ed25519_public_key_t object representing the corresponding
+ *                        public key. The caller is responsible for deallocating this object.
+ * \return Returns CARDANO_SUCCESS on successful computation of the public key. On failure,
+ *         returns CARDANO_ERROR_GENERIC or another non-zero error code indicating the type
+ *         of failure.
+ */
+static cardano_error_t
+compute_extended_public_key(
+  const cardano_ed25519_private_key_t* private_key,
+  cardano_ed25519_public_key_t**       public_key)
+{
+  assert(private_key != NULL);
+  assert(public_key != NULL);
+
+  byte_t* extended_scalar  = cardano_buffer_get_data(private_key->key_material);
+  byte_t  scalar_data[32U] = { 0 };
+
+  assert(extended_scalar != NULL);
+  assert(cardano_buffer_get_size(private_key->key_material) >= SCALAR_SIZE);
+
+  if (crypto_scalarmult_ed25519_base_noclamp(&scalar_data[0], extended_scalar) == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  cardano_ed25519_public_key_t* ed25519_public_key = NULL;
+  cardano_error_t               error              = cardano_ed25519_public_key_from_bytes(scalar_data, SCALAR_SIZE, &ed25519_public_key);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *public_key = ed25519_public_key;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Determines the type of the private key (normal or extended) and computes the corresponding
+ * public key.
+ *
+ * This function checks the size of the private key to determine whether it is a normal
+ * or extended key and then calls the appropriate function to compute the public key.
+ *
+ * \param private_key A pointer to the cardano_ed25519_private_key_t object for which the public
+ *                    key is to be computed. The key type is determined based on its size.
+ * \param[out] public_key On success, this will point to a newly allocated
+ *                        cardano_ed25519_public_key_t object representing the computed public
+ *                        key. The caller is responsible for deallocating this object.
+ * \return Returns CARDANO_SUCCESS if the public key is successfully computed. On failure,
+ *         returns a non-zero error code indicating the type of failure.
+ */
+static cardano_error_t
+compute_public_key(
+  const cardano_ed25519_private_key_t* private_key,
+  cardano_ed25519_public_key_t**       public_key)
+{
+  assert(private_key != NULL);
+  assert(public_key != NULL);
+
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  if (private_key->key_size == CARDANO_ED25519_PRIVATE_KEY_SIZE_NORMAL)
+  {
+    error = compute_normal_public_key(private_key, public_key);
+  }
+  else
+  {
+    error = compute_extended_public_key(private_key, public_key);
+  }
+
+  return error;
+}
+
+/**
+ * Computes a digital signature using an extended Ed25519 private key.
+ *
+ * This function generates a digital signature for a given message using
+ * the extended Ed25519 private key.
+ *
+ * @param[in] private_key A pointer to a `cardano_ed25519_private_key_t` structure representing
+ *                        the extended Ed25519 private key used for signing.
+ * @param[in] message A pointer to the byte array containing the message to be signed.
+ * @param[in] message_length The length of the message in bytes.
+ * @param[out] signature On successful execution, this parameter will be updated to point
+ *                       to a newly allocated `cardano_ed25519_signature_t` structure
+ *                       containing the signature of the message. The caller is responsible
+ *                       for managing the lifecycle of this object, including deallocating
+ *                       it when it's no longer needed.
+ *
+ * @return Returns `CARDANO_SUCCESS` if the signature was successfully generated. If an error
+ *         occurs, a non-zero error code is returned, indicating the type of error encountered
+ *         during the execution. Possible errors include invalid input parameters, failure in
+ *         cryptographic operations, or memory allocation issues. If the function fails, the
+ *         value pointed to by `signature` is set to `NULL`.
+ */
+static cardano_error_t
+compute_signature_with_extended_key(
+  const cardano_ed25519_private_key_t* private_key,
+  const byte_t*                        message,
+  const size_t                         message_length,
+  cardano_ed25519_signature_t**        signature)
+{
+  static const size_t IV_SIZE = 32U;
+
+  assert(private_key != NULL);
+  assert(message != NULL);
+  assert(signature != NULL);
+
+  byte_t* extended_scalar = cardano_buffer_get_data(private_key->key_material);
+
+  assert(extended_scalar != NULL);
+  assert(cardano_buffer_get_size(private_key->key_material) == (SCALAR_SIZE * 2U));
+
+  byte_t public_key[32U]      = { 0 };
+  byte_t hash_output[64U]     = { 0 };
+  byte_t nonce[32U]           = { 0 };
+  byte_t hram[64U]            = { 0 };
+  byte_t hram_reduced[32U]    = { 0 };
+  byte_t r[32U]               = { 0 };
+  byte_t s[32U]               = { 0 };
+  byte_t signature_bytes[64U] = { 0 };
+
+  cardano_error_t result            = CARDANO_SUCCESS;
+  size_t          digest_input_size = 0U;
+  byte_t*         digest_input      = NULL;
+  byte_t*         hram_input        = NULL;
+
+  if (crypto_scalarmult_ed25519_base_noclamp(public_key, extended_scalar) != 0)
+  {
+    result = CARDANO_ERROR_GENERIC;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    digest_input_size = IV_SIZE + message_length;
+    digest_input      = (byte_t*)_cardano_malloc(digest_input_size);
+
+    if (digest_input == NULL)
+    {
+      result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_safe_memcpy(digest_input, digest_input_size, &extended_scalar[SCALAR_SIZE], IV_SIZE);
+    cardano_safe_memcpy(&digest_input[IV_SIZE], digest_input_size - IV_SIZE, message, message_length);
+
+    if (crypto_hash_sha512(hash_output, digest_input, digest_input_size) != 0)
+    {
+      result = CARDANO_ERROR_GENERIC;
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    sodium_memzero(digest_input, digest_input_size);
+    _cardano_free(digest_input);
+    digest_input = NULL;
+
+    crypto_core_ed25519_scalar_reduce(nonce, hash_output);
+
+    if (crypto_scalarmult_ed25519_base_noclamp(r, nonce) != 0)
+    {
+      result = CARDANO_ERROR_GENERIC;
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    digest_input_size = sizeof(r) + sizeof(public_key) + message_length;
+    hram_input        = (byte_t*)_cardano_malloc(digest_input_size);
+
+    if (hram_input == NULL)
+    {
+      result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_safe_memcpy(hram_input, digest_input_size, r, sizeof(r));
+    cardano_safe_memcpy(&hram_input[sizeof(r)], digest_input_size - sizeof(r), public_key, sizeof(public_key));
+    cardano_safe_memcpy(
+      &hram_input[sizeof(r) + sizeof(public_key)],
+      digest_input_size - sizeof(r) - sizeof(public_key),
+      message,
+      message_length);
+
+    if (crypto_hash_sha512(hram, hram_input, digest_input_size) != 0)
+    {
+      result = CARDANO_ERROR_GENERIC;
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    sodium_memzero(hram_input, digest_input_size);
+    _cardano_free(hram_input);
+    hram_input = NULL;
+
+    crypto_core_ed25519_scalar_reduce(hram_reduced, hram);
+
+    crypto_core_ed25519_scalar_mul(s, hram_reduced, extended_scalar);
+    crypto_core_ed25519_scalar_add(s, s, nonce);
+
+    cardano_safe_memcpy(signature_bytes, sizeof(signature_bytes), r, sizeof(r));
+    cardano_safe_memcpy(&signature_bytes[sizeof(r)], sizeof(signature_bytes) - sizeof(r), s, sizeof(s));
+
+    result = cardano_ed25519_signature_from_bytes(signature_bytes, sizeof(signature_bytes), signature);
+  }
+
+  if (digest_input != NULL)
+  {
+    sodium_memzero(digest_input, digest_input_size);
+    _cardano_free(digest_input);
+    digest_input = NULL;
+  }
+
+  if (hram_input != NULL)
+  {
+    sodium_memzero(hram_input, digest_input_size);
+    _cardano_free(hram_input);
+    hram_input = NULL;
+  }
+
+  sodium_memzero(hash_output, sizeof(hash_output));
+  sodium_memzero(nonce, sizeof(nonce));
+  sodium_memzero(hram, sizeof(hram));
+  sodium_memzero(hram_reduced, sizeof(hram_reduced));
+  sodium_memzero(s, sizeof(s));
+  sodium_memzero(signature_bytes, sizeof(signature_bytes));
+
+  return result;
+}
+
+/**
+ * Computes a digital signature using an normal Ed25519 private key.
+ *
+ * This function generates a digital signature for a given message using
+ * the normal Ed25519 private key.
+ *
+ * @param[in] private_key A pointer to a `cardano_ed25519_private_key_t` structure representing
+ *                        the normal Ed25519 private key used for signing.
+ * @param[in] message A pointer to the byte array containing the message to be signed.
+ * @param[in] message_length The length of the message in bytes.
+ * @param[out] signature On successful execution, this parameter will be updated to point
+ *                       to a newly allocated `cardano_ed25519_signature_t` structure
+ *                       containing the signature of the message. The caller is responsible
+ *                       for managing the lifecycle of this object, including deallocating
+ *                       it when it's no longer needed.
+ *
+ * @return Returns `CARDANO_SUCCESS` if the signature was successfully generated. If an error
+ *         occurs, a non-zero error code is returned, indicating the type of error encountered
+ *         during the execution. Possible errors include invalid input parameters, failure in
+ *         cryptographic operations, or memory allocation issues. If the function fails, the
+ *         value pointed to by `signature` is set to `NULL`.
+ */
+static cardano_error_t
+compute_signature_with_normal_key(
+  const cardano_ed25519_private_key_t* private_key,
+  const byte_t*                        message,
+  const size_t                         message_length,
+  cardano_ed25519_signature_t**        signature)
+{
+  assert(private_key != NULL);
+  assert(signature != NULL);
+
+  cardano_ed25519_public_key_t* public_key            = NULL;
+  cardano_error_t               compute_pub_key_error = compute_normal_public_key(private_key, &public_key);
+
+  if (compute_pub_key_error != CARDANO_SUCCESS)
+  {
+    return compute_pub_key_error;
+  }
+
+  const byte_t* private_key_bytes = cardano_buffer_get_data(private_key->key_material);
+
+  assert(private_key_bytes != NULL);
+
+  byte_t signature_bytes[64U] = { 0 };
+  byte_t sk[64U]              = { 0 };
+
+  cardano_safe_memcpy(sk, sizeof(sk), private_key_bytes, 32U);
+  cardano_safe_memcpy(&sk[32U], sizeof(sk) - 32U, cardano_ed25519_public_key_get_data(public_key), 32U);
+
+  cardano_ed25519_public_key_unref(&public_key);
+
+  const int sign_result = crypto_sign_detached(signature_bytes, NULL, message, message_length, sk);
+  sodium_memzero(sk, sizeof(sk));
+
+  if (sign_result == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  cardano_ed25519_signature_t* ed25519_signature = NULL;
+  cardano_error_t              error             = cardano_ed25519_signature_from_bytes(signature_bytes, crypto_sign_BYTES, &ed25519_signature);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *signature = ed25519_signature;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Computes a digital signature for a given message using either a normal or an extended Ed25519 private key.
+ *
+ * This function abstracts the process of generating a digital signature by automatically determining
+ * whether the provided private key is normal or extended, and then calling the appropriate internal
+ * function to perform the signature computation.
+ *
+ * @param[in] private_key A pointer to a `cardano_ed25519_private_key_t` structure that represents
+ *                        the Ed25519 private key (either normal or extended) to be used for signing.
+ * @param[in] message A pointer to the byte array containing the message data to be signed.
+ * @param[in] message_length The length of the message in bytes.
+ * @param[out] signature Upon successful execution, this parameter will be updated to point to a newly
+ *                       allocated `cardano_ed25519_signature_t` structure that contains the generated
+ *                       signature.
+ * @return Returns `CARDANO_SUCCESS` if the signature was successfully generated. If the function encounters
+ *         an error, it returns a non-zero error code indicative of the type of error. Possible errors include
+ *         issues with the input parameters, failure to correctly determine the key type, or errors during the
+ *         signature computation process. If the function fails, the value pointed to by `signature` is set to `NULL`.
+ */
+static cardano_error_t
+compute_signature(
+  const cardano_ed25519_private_key_t* private_key,
+  const byte_t*                        message,
+  const size_t                         message_length,
+  cardano_ed25519_signature_t**        signature)
+{
+  assert(private_key != NULL);
+  assert(signature != NULL);
+
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  if (private_key->key_size == CARDANO_ED25519_PRIVATE_KEY_SIZE_NORMAL)
+  {
+    error = compute_signature_with_normal_key(private_key, message, message_length, signature);
+  }
+  else
+  {
+    error = compute_signature_with_extended_key(private_key, message, message_length, signature);
+  }
+
+  return error;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_ed25519_private_key_from_normal_bytes(
+  const byte_t*                   data,
+  const size_t                    data_length,
+  cardano_ed25519_private_key_t** private_key)
+{
+  return private_key_from_bytes(data, data_length, private_key, CARDANO_ED25519_PRIVATE_KEY_SIZE_NORMAL);
+}
+
+cardano_error_t
+cardano_ed25519_private_key_from_extended_bytes(
+  const byte_t*                   data,
+  const size_t                    data_length,
+  cardano_ed25519_private_key_t** private_key)
+{
+  return private_key_from_bytes(data, data_length, private_key, CARDANO_ED25519_PRIVATE_KEY_SIZE_EXTENDED);
+}
+
+cardano_error_t
+cardano_ed25519_private_key_from_normal_hex(
+  const char*                     hex,
+  const size_t                    hex_length,
+  cardano_ed25519_private_key_t** private_key)
+{
+  return private_key_from_hex(hex, hex_length, private_key, CARDANO_ED25519_PRIVATE_KEY_SIZE_NORMAL);
+}
+
+cardano_error_t
+cardano_ed25519_private_key_from_extended_hex(
+  const char*                     hex,
+  const size_t                    hex_length,
+  cardano_ed25519_private_key_t** private_key)
+{
+  return private_key_from_hex(hex, hex_length, private_key, CARDANO_ED25519_PRIVATE_KEY_SIZE_EXTENDED);
+}
+
+void
+cardano_ed25519_private_key_unref(cardano_ed25519_private_key_t** ed25519_private_key)
+{
+  if ((ed25519_private_key == NULL) || (*ed25519_private_key == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*ed25519_private_key)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *ed25519_private_key = NULL;
+    return;
+  }
+}
+
+void
+cardano_ed25519_private_key_ref(cardano_ed25519_private_key_t* ed25519_private_key)
+{
+  if (ed25519_private_key == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&ed25519_private_key->base);
+}
+
+size_t
+cardano_ed25519_private_key_refcount(const cardano_ed25519_private_key_t* ed25519_private_key)
+{
+  if (ed25519_private_key == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&ed25519_private_key->base);
+}
+
+cardano_error_t
+cardano_ed25519_private_key_sign(
+  const cardano_ed25519_private_key_t* private_key,
+  const byte_t*                        message,
+  const size_t                         message_length,
+  cardano_ed25519_signature_t**        signature)
+{
+  if (private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (signature == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (sodium_init() == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  return compute_signature(private_key, message, message_length, signature);
+}
+
+cardano_error_t
+cardano_ed25519_private_key_get_public_key(
+  const cardano_ed25519_private_key_t* private_key,
+  cardano_ed25519_public_key_t**       public_key)
+{
+  if (private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (sodium_init() == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  return compute_public_key(private_key, public_key);
+}
+
+const byte_t*
+cardano_ed25519_private_key_get_data(const cardano_ed25519_private_key_t* ed25519_private_key)
+{
+  if (ed25519_private_key == NULL)
+  {
+    return NULL;
+  }
+
+  return cardano_buffer_get_data(ed25519_private_key->key_material);
+}
+
+size_t
+cardano_ed25519_private_key_get_bytes_size(const cardano_ed25519_private_key_t* ed25519_private_key)
+{
+  if (ed25519_private_key == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_buffer_get_size(ed25519_private_key->key_material);
+}
+
+cardano_error_t
+cardano_ed25519_private_key_to_bytes(
+  const cardano_ed25519_private_key_t* private_key,
+  byte_t*                              out_key_bytes,
+  const size_t                         out_key_length)
+{
+  if (private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_copy_bytes(private_key->key_material, out_key_bytes, out_key_length);
+}
+
+size_t
+cardano_ed25519_private_key_get_hex_size(const cardano_ed25519_private_key_t* private_key)
+{
+  if (private_key == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_buffer_get_hex_size(private_key->key_material);
+}
+
+cardano_error_t
+cardano_ed25519_private_key_to_hex(
+  const cardano_ed25519_private_key_t* private_key,
+  char*                                hex,
+  const size_t                         hex_length)
+{
+  if (private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_to_hex(private_key->key_material, hex, hex_length);
+}
+
+cardano_error_t
+cardano_ed25519_private_key_deep_clone(const cardano_ed25519_private_key_t* source, cardano_ed25519_private_key_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ed25519_private_key_t* copy = _cardano_malloc(sizeof(cardano_ed25519_private_key_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key_material       = NULL;
+  copy->key_size           = source->key_size;
+
+  if (source->key_material != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->key_material, &copy->key_material);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/crypto/ed25519_public_key.c b/vendor/src/crypto/ed25519_public_key.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/ed25519_public_key.c
@@ -0,0 +1,372 @@
+/**
+ * \file ed25519_public_key.c
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/ed25519_public_key.h>
+
+#include <cardano/buffer.h>
+#include <cardano/export.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+
+#include <assert.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <sodium.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an Ed25519 public key.
+ *
+ * This structure is designed to hold an Ed25519 public key, which is part of an asymmetric key pair used in
+ * digital signatures.
+ */
+typedef struct cardano_ed25519_public_key_t
+{
+    cardano_object_t  base;
+    cardano_buffer_t* key_material;
+} cardano_ed25519_public_key_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a Ed25519 public key object.
+ *
+ * This function is responsible for properly deallocating a Ed25519 public key object (`cardano_ed25519_public_key_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the Ed25519 public key object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_ed25519_public_key_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the Ed25519 public key
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_ed25519_public_key_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_ed25519_public_key_t* public_key = (cardano_ed25519_public_key_t*)object;
+
+  if (public_key->key_material != NULL)
+  {
+    cardano_buffer_unref(&public_key->key_material);
+  }
+
+  _cardano_free(public_key);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_ed25519_public_key_from_bytes(
+  const byte_t*                  data,
+  const size_t                   data_length,
+  cardano_ed25519_public_key_t** public_key)
+{
+  if (public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data_length != crypto_sign_PUBLICKEYBYTES)
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_INVALID_ED25519_PUBLIC_KEY_SIZE;
+  }
+
+  cardano_ed25519_public_key_t* ed25519_public_key = (cardano_ed25519_public_key_t*)_cardano_malloc(sizeof(cardano_ed25519_public_key_t));
+
+  if (ed25519_public_key == NULL)
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  ed25519_public_key->base.ref_count     = 1;
+  ed25519_public_key->base.deallocator   = cardano_ed25519_public_key_deallocate;
+  ed25519_public_key->base.last_error[0] = '\0';
+  ed25519_public_key->key_material       = cardano_buffer_new_from(data, data_length);
+
+  if (ed25519_public_key->key_material == NULL)
+  {
+    *public_key = NULL;
+    _cardano_free(ed25519_public_key);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *public_key = ed25519_public_key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ed25519_public_key_from_hex(
+  const char*                    hex,
+  const size_t                   hex_length,
+  cardano_ed25519_public_key_t** public_key)
+{
+  if (public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex == NULL)
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex_length != (crypto_sign_PUBLICKEYBYTES * 2))
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_INVALID_ED25519_PUBLIC_KEY_SIZE;
+  }
+
+  cardano_ed25519_public_key_t* ed25519_public_key = (cardano_ed25519_public_key_t*)_cardano_malloc(sizeof(cardano_ed25519_public_key_t));
+
+  if (ed25519_public_key == NULL)
+  {
+    *public_key = NULL;
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  ed25519_public_key->base.ref_count     = 1;
+  ed25519_public_key->base.deallocator   = cardano_ed25519_public_key_deallocate;
+  ed25519_public_key->base.last_error[0] = '\0';
+  ed25519_public_key->key_material       = cardano_buffer_from_hex(hex, hex_length);
+
+  if (ed25519_public_key->key_material == NULL)
+  {
+    *public_key = NULL;
+    _cardano_free(ed25519_public_key);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *public_key = ed25519_public_key;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_ed25519_public_key_unref(cardano_ed25519_public_key_t** ed25519_public_key)
+{
+  if ((ed25519_public_key == NULL) || (*ed25519_public_key == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*ed25519_public_key)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *ed25519_public_key = NULL;
+    return;
+  }
+}
+
+void
+cardano_ed25519_public_key_ref(cardano_ed25519_public_key_t* ed25519_public_key)
+{
+  if (ed25519_public_key == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&ed25519_public_key->base);
+}
+
+size_t
+cardano_ed25519_public_key_refcount(const cardano_ed25519_public_key_t* ed25519_public_key)
+{
+  if (ed25519_public_key == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&ed25519_public_key->base);
+}
+
+bool
+cardano_ed25519_public_verify(
+  const cardano_ed25519_public_key_t* public_key,
+  const cardano_ed25519_signature_t*  signature,
+  const byte_t*                       message,
+  const size_t                        message_len)
+{
+  if ((public_key == NULL) || (signature == NULL))
+  {
+    return false;
+  }
+
+  assert(cardano_ed25519_signature_get_bytes_size(signature) == crypto_sign_BYTES);
+
+  if (sodium_init() == -1)
+  {
+    return false;
+  }
+
+  int verify_result = crypto_sign_verify_detached(
+    cardano_ed25519_signature_get_data(signature),
+    message,
+    message_len,
+    cardano_buffer_get_data(public_key->key_material));
+
+  return verify_result == 0;
+}
+
+const byte_t*
+cardano_ed25519_public_key_get_data(const cardano_ed25519_public_key_t* ed25519_public_key)
+{
+  if (ed25519_public_key == NULL)
+  {
+    return NULL;
+  }
+
+  return cardano_buffer_get_data(ed25519_public_key->key_material);
+}
+
+size_t
+cardano_ed25519_public_key_get_bytes_size(const cardano_ed25519_public_key_t* ed25519_public_key)
+{
+  if (ed25519_public_key == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_buffer_get_size(ed25519_public_key->key_material);
+}
+
+cardano_error_t
+cardano_ed25519_public_key_to_bytes(
+  const cardano_ed25519_public_key_t* public_key,
+  byte_t*                             out_key_bytes,
+  const size_t                        out_key_length)
+{
+  if (public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_copy_bytes(public_key->key_material, out_key_bytes, out_key_length);
+}
+
+size_t
+cardano_ed25519_public_key_get_hex_size(const cardano_ed25519_public_key_t* ed25519_public_key)
+{
+  if (ed25519_public_key == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_buffer_get_hex_size(ed25519_public_key->key_material);
+}
+
+cardano_error_t
+cardano_ed25519_public_key_to_hex(
+  const cardano_ed25519_public_key_t* ed25519_public_key,
+  char*                               hex,
+  const size_t                        hex_length)
+{
+  if (ed25519_public_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_to_hex(ed25519_public_key->key_material, hex, hex_length);
+}
+
+cardano_error_t
+cardano_ed25519_public_key_to_hash(
+  const cardano_ed25519_public_key_t* public_key,
+  cardano_blake2b_hash_t**            hash)
+{
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (public_key == NULL)
+  {
+    *hash = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const byte_t* data = cardano_buffer_get_data(public_key->key_material);
+
+  return cardano_blake2b_compute_hash(data, cardano_buffer_get_size(public_key->key_material), CARDANO_BLAKE2B_HASH_SIZE_224, hash);
+}
+
+cardano_error_t
+cardano_ed25519_public_key_deep_clone(const cardano_ed25519_public_key_t* source, cardano_ed25519_public_key_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ed25519_public_key_t* copy = _cardano_malloc(sizeof(cardano_ed25519_public_key_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key_material       = NULL;
+
+  if (source->key_material != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->key_material, &copy->key_material);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/crypto/ed25519_signature.c b/vendor/src/crypto/ed25519_signature.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/ed25519_signature.c
@@ -0,0 +1,321 @@
+/**
+ * \file ed25519_signature.c
+ *
+ * \author angel.castillo
+ * \date   Mar 20, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/ed25519_signature.h>
+
+#include <cardano/buffer.h>
+#include <cardano/export.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+
+#include <assert.h>
+#include <sodium.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an Ed25519 signature.
+ *
+ * This structure encapsulates an Ed25519 signature, which is a digital signature algorithm
+ * used for cryptographic verification in the Cardano blockchain ecosystem.
+ */
+typedef struct cardano_ed25519_signature_t
+{
+    cardano_object_t  base;
+    cardano_buffer_t* buffer;
+} cardano_ed25519_signature_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a Ed25519 signature object.
+ *
+ * This function is responsible for properly deallocating a Ed25519 signature object (`cardano_ed25519_signature_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the Ed25519 signature object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_ed25519_signature_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the Ed25519 signature
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_ed25519_signature_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_ed25519_signature_t* signature = (cardano_ed25519_signature_t*)object;
+
+  if (signature->buffer != NULL)
+  {
+    cardano_buffer_unref(&signature->buffer);
+  }
+
+  _cardano_free(signature);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_ed25519_signature_from_bytes(
+  const byte_t*                 data,
+  const size_t                  data_length,
+  cardano_ed25519_signature_t** signature)
+{
+  if (signature == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    *signature = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data_length != crypto_sign_BYTES)
+  {
+    *signature = NULL;
+    return CARDANO_ERROR_INVALID_ED25519_SIGNATURE_SIZE;
+  }
+
+  cardano_ed25519_signature_t* ed25519_signature = (cardano_ed25519_signature_t*)_cardano_malloc(sizeof(cardano_ed25519_signature_t));
+
+  if (ed25519_signature == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  ed25519_signature->base.ref_count     = 1;
+  ed25519_signature->base.deallocator   = cardano_ed25519_signature_deallocate;
+  ed25519_signature->base.last_error[0] = '\0';
+  ed25519_signature->buffer             = cardano_buffer_new_from(data, data_length);
+
+  if (ed25519_signature->buffer == NULL)
+  {
+    _cardano_free(ed25519_signature);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *signature = ed25519_signature;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ed25519_signature_from_hex(
+  const char*                   hex,
+  const size_t                  hex_length,
+  cardano_ed25519_signature_t** signature)
+{
+  if (signature == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex == NULL)
+  {
+    *signature = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex_length != (crypto_sign_BYTES * 2))
+  {
+    *signature = NULL;
+
+    return CARDANO_ERROR_INVALID_ED25519_SIGNATURE_SIZE;
+  }
+
+  cardano_ed25519_signature_t* ed25519_signature = (cardano_ed25519_signature_t*)_cardano_malloc(sizeof(cardano_ed25519_signature_t));
+
+  if (ed25519_signature == NULL)
+  {
+    *signature = NULL;
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  ed25519_signature->base.ref_count     = 1;
+  ed25519_signature->base.deallocator   = cardano_ed25519_signature_deallocate;
+  ed25519_signature->base.last_error[0] = '\0';
+  ed25519_signature->buffer             = cardano_buffer_from_hex(hex, hex_length);
+
+  if (ed25519_signature->buffer == NULL)
+  {
+    *signature = NULL;
+    _cardano_free(ed25519_signature);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *signature = ed25519_signature;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_ed25519_signature_unref(cardano_ed25519_signature_t** ed25519_signature)
+{
+  if ((ed25519_signature == NULL) || (*ed25519_signature == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*ed25519_signature)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *ed25519_signature = NULL;
+    return;
+  }
+}
+
+void
+cardano_ed25519_signature_ref(cardano_ed25519_signature_t* ed25519_signature)
+{
+  if (ed25519_signature == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&ed25519_signature->base);
+}
+
+size_t
+cardano_ed25519_signature_refcount(const cardano_ed25519_signature_t* ed25519_signature)
+{
+  if (ed25519_signature == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&ed25519_signature->base);
+}
+
+const byte_t*
+cardano_ed25519_signature_get_data(const cardano_ed25519_signature_t* ed25519_signature)
+{
+  if (ed25519_signature == NULL)
+  {
+    return NULL;
+  }
+
+  return cardano_buffer_get_data(ed25519_signature->buffer);
+}
+
+size_t
+cardano_ed25519_signature_get_bytes_size(const cardano_ed25519_signature_t* ed25519_signature)
+{
+  if (ed25519_signature == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_buffer_get_size(ed25519_signature->buffer);
+}
+
+cardano_error_t
+cardano_ed25519_signature_to_bytes(
+  const cardano_ed25519_signature_t* ed25519_signature,
+  byte_t*                            signature,
+  const size_t                       signature_length)
+{
+  if (ed25519_signature == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_copy_bytes(ed25519_signature->buffer, signature, signature_length);
+}
+
+size_t
+cardano_ed25519_signature_get_hex_size(const cardano_ed25519_signature_t* ed25519_signature)
+{
+  if (ed25519_signature == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_buffer_get_hex_size(ed25519_signature->buffer);
+}
+
+cardano_error_t
+cardano_ed25519_signature_to_hex(
+  const cardano_ed25519_signature_t* ed25519_signature,
+  char*                              hex,
+  const size_t                       hex_length)
+{
+  if (ed25519_signature == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_buffer_to_hex(ed25519_signature->buffer, hex, hex_length);
+}
+
+cardano_error_t
+cardano_ed25519_signature_deep_clone(const cardano_ed25519_signature_t* source, cardano_ed25519_signature_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ed25519_signature_t* copy = _cardano_malloc(sizeof(cardano_ed25519_signature_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->buffer             = NULL;
+
+  if (source->buffer != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->buffer, &copy->buffer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/crypto/emip3.c b/vendor/src/crypto/emip3.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/emip3.c
@@ -0,0 +1,214 @@
+/**
+ * \file emip3.c
+ *
+ * \author angel.castillo
+ * \date   Oct 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/emip3.h>
+
+#include <cardano/crypto/pbkdf2.h>
+
+#include "../string_safe.h"
+
+#include <sodium.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const uint64_t SALT_LENGTH       = 32U;
+static const uint64_t NONCE_LENGTH      = 12U;
+static const uint64_t TAG_LENGTH        = crypto_aead_chacha20poly1305_IETF_ABYTES;
+static const uint64_t KEY_LENGTH        = 32U;
+static const uint64_t PBKDF2_ITERATIONS = 19162U;
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_crypto_emip3_encrypt(
+  const byte_t*      data,
+  const size_t       data_length,
+  const byte_t*      passphrase,
+  const size_t       passphrase_length,
+  cardano_buffer_t** encrypted_data)
+{
+  if (encrypted_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *encrypted_data = NULL;
+
+  if ((data == NULL) || ((passphrase_length > 0U) && (passphrase == NULL)))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((data_length > (SIZE_MAX - SALT_LENGTH - NONCE_LENGTH - TAG_LENGTH)) || (data_length > crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (sodium_init() == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  const size_t required_length = SALT_LENGTH + NONCE_LENGTH + TAG_LENGTH + data_length;
+  *encrypted_data              = cardano_buffer_new(required_length);
+
+  if (*encrypted_data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_buffer_set_size(*encrypted_data, required_length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(encrypted_data);
+
+    return result;
+  }
+
+  byte_t* output     = cardano_buffer_get_data(*encrypted_data);
+  byte_t* salt       = output;
+  byte_t* nonce      = &output[SALT_LENGTH];
+  byte_t* tag        = &nonce[NONCE_LENGTH];
+  byte_t* ciphertext = &tag[TAG_LENGTH];
+
+  randombytes_buf(salt, SALT_LENGTH);
+
+  byte_t key[32U] = { 0 };
+
+  result = cardano_crypto_pbkdf2_hmac_sha512(
+    passphrase, passphrase_length, salt, SALT_LENGTH, (uint32_t)PBKDF2_ITERATIONS, key, KEY_LENGTH);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(encrypted_data);
+    sodium_memzero(key, KEY_LENGTH);
+
+    return result;
+  }
+
+  randombytes_buf(nonce, NONCE_LENGTH);
+
+  unsigned char tag_output[16] = { 0 };
+
+  if (crypto_aead_chacha20poly1305_ietf_encrypt_detached(ciphertext, tag_output, NULL, data, data_length, NULL, 0, NULL, nonce, key) != 0)
+  {
+    cardano_buffer_unref(encrypted_data);
+    sodium_memzero(key, KEY_LENGTH);
+
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  cardano_safe_memcpy(tag, TAG_LENGTH, tag_output, TAG_LENGTH);
+
+  sodium_memzero(key, KEY_LENGTH);
+
+  return result;
+}
+
+cardano_error_t
+cardano_crypto_emip3_decrypt(
+  const byte_t*      encrypted_data,
+  const size_t       encrypted_data_length,
+  const byte_t*      passphrase,
+  const size_t       passphrase_length,
+  cardano_buffer_t** data)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *data = NULL;
+
+  if ((encrypted_data == NULL) || ((passphrase_length > 0U) && (passphrase == NULL)))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (encrypted_data_length < (SALT_LENGTH + NONCE_LENGTH + TAG_LENGTH))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  const size_t ciphertext_len = encrypted_data_length - (SALT_LENGTH + NONCE_LENGTH + TAG_LENGTH);
+
+  if (ciphertext_len > crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (sodium_init() == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  *data = cardano_buffer_new((ciphertext_len == 0U) ? 1U : ciphertext_len);
+
+  if (*data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_buffer_set_size(*data, ciphertext_len);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(data);
+
+    return result;
+  }
+
+  const byte_t* salt       = encrypted_data;
+  const byte_t* nonce      = &encrypted_data[SALT_LENGTH];
+  const byte_t* tag        = &nonce[NONCE_LENGTH];
+  const byte_t* ciphertext = &tag[TAG_LENGTH];
+
+  byte_t key[32U] = { 0 };
+
+  result = cardano_crypto_pbkdf2_hmac_sha512(
+    passphrase, passphrase_length, salt, SALT_LENGTH, (uint32_t)PBKDF2_ITERATIONS, key, KEY_LENGTH);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(data);
+    sodium_memzero(key, KEY_LENGTH);
+
+    return result;
+  }
+
+  if (crypto_aead_chacha20poly1305_ietf_decrypt_detached(cardano_buffer_get_data(*data), NULL, ciphertext, ciphertext_len, tag, NULL, 0, nonce, key) != 0)
+  {
+    cardano_buffer_unref(data);
+    sodium_memzero(key, KEY_LENGTH);
+
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  sodium_memzero(key, KEY_LENGTH);
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/crypto/pbkdf2.c b/vendor/src/crypto/pbkdf2.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/crypto/pbkdf2.c
@@ -0,0 +1,120 @@
+/**
+ * \file pbkdf2.c
+ *
+ * \author angel.castillo
+ * \date   Mar 02, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/pbkdf2.h>
+
+#include <cardano/export.h>
+
+#include "../string_safe.h"
+
+#include <sodium.h>
+#include <string.h>
+
+#include "../endian.h"
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_crypto_pbkdf2_hmac_sha512(
+  const byte_t*  password,
+  const size_t   password_length,
+  const byte_t*  salt,
+  const size_t   salt_length,
+  const uint32_t iterations,
+  byte_t*        derived_key,
+  const size_t   derived_key_length)
+{
+  if (((password_length > 0U) && (password == NULL)) || (salt == NULL) || (derived_key == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((salt_length == 0U) || (derived_key_length == 0U))
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if ((iterations == 0U) || ((uint64_t)derived_key_length > ((uint64_t)UINT32_MAX * crypto_auth_hmacsha512_BYTES)))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  crypto_auth_hmacsha512_state initial_hmac_state   = { 0 };
+  crypto_auth_hmacsha512_state loop_hHmac_state     = { 0 };
+  byte_t                       iteration_vector[4U] = { 0 };
+  byte_t                       temp_digest[64U]     = { 0 };
+  byte_t                       block_digest[64U]    = { 0 };
+
+  crypto_auth_hmacsha512_init(&initial_hmac_state, password, password_length);
+  crypto_auth_hmacsha512_update(&initial_hmac_state, salt, salt_length);
+
+  const size_t block_count = (derived_key_length / crypto_auth_hmacsha512_BYTES) +
+    (((derived_key_length % crypto_auth_hmacsha512_BYTES) != 0U) ? 1U : 0U);
+
+  for (size_t i = 0; i < block_count; ++i)
+  {
+    size_t current_block_length = 0;
+
+    CARDANO_UNUSED(cardano_write_uint32_be((uint32_t)(i + 1U), iteration_vector, sizeof(iteration_vector), 0));
+
+    cardano_safe_memcpy(&loop_hHmac_state, sizeof(crypto_auth_hmacsha512_state), &initial_hmac_state, sizeof(crypto_auth_hmacsha512_state));
+
+    crypto_auth_hmacsha512_update(&loop_hHmac_state, iteration_vector, sizeof(iteration_vector));
+    crypto_auth_hmacsha512_final(&loop_hHmac_state, temp_digest);
+
+    cardano_safe_memcpy(block_digest, sizeof(block_digest), temp_digest, sizeof(temp_digest));
+
+    for (uint32_t j = 1U; j < iterations; ++j)
+    {
+      crypto_auth_hmacsha512_init(&loop_hHmac_state, password, password_length);
+      crypto_auth_hmacsha512_update(&loop_hHmac_state, temp_digest, crypto_auth_hmacsha512_BYTES);
+      crypto_auth_hmacsha512_final(&loop_hHmac_state, temp_digest);
+
+      for (size_t k = 0; k < crypto_auth_hmacsha512_BYTES; ++k)
+      {
+        block_digest[k] ^= temp_digest[k];
+      }
+    }
+
+    current_block_length = derived_key_length - (i * crypto_auth_hmacsha512_BYTES);
+
+    if (current_block_length > crypto_auth_hmacsha512_BYTES)
+    {
+      current_block_length = crypto_auth_hmacsha512_BYTES;
+    }
+
+    cardano_safe_memcpy(
+      &derived_key[i * crypto_auth_hmacsha512_BYTES],
+      derived_key_length - (i * crypto_auth_hmacsha512_BYTES),
+      block_digest,
+      current_block_length);
+  }
+
+  sodium_memzero((void*)&initial_hmac_state, sizeof(initial_hmac_state));
+  sodium_memzero((void*)&loop_hHmac_state, sizeof(loop_hHmac_state));
+  sodium_memzero((void*)iteration_vector, sizeof(iteration_vector));
+  sodium_memzero((void*)temp_digest, sizeof(temp_digest));
+  sodium_memzero((void*)block_digest, sizeof(block_digest));
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/encoding/base58.c b/vendor/src/encoding/base58.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/encoding/base58.c
@@ -0,0 +1,302 @@
+/**
+ * \file base58.c
+ *
+ * \author angel.castillo
+ * \date   Apr 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/encoding/base58.h>
+
+#include "../allocators.h"
+
+#include <stddef.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const char BASE58_ALPHABET[] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Finds the index of a character in the Base58 alphabet.
+ *
+ * \param c The character to find.
+ * \param alphabet The Base58 alphabet.
+ *
+ * \return The index of the character in the alphabet, or -1 if the character is not found.
+ */
+static int64_t
+char_index(const char c, const char* alphabet)
+{
+  for (size_t i = 0; alphabet[i] != '\0'; ++i)
+  {
+    if (alphabet[i] == c)
+    {
+      return (int64_t)i;
+    }
+  }
+
+  return -1;
+}
+
+/**
+ * \brief Converts Base58 digits into a caller-owned buffer and reports their exact byte count.
+ *
+ * \param input The validated non-null input pointer.
+ * \param input_length The number of input characters.
+ * \param data The validated non-null destination pointer.
+ * \param data_length The nonzero destination capacity.
+ * \param decoded_length Receives the exact byte count on success.
+ *
+ * \return Success, a decoding error, or an insufficient-buffer error.
+ */
+static cardano_error_t
+base58_decode_into(const char* input, const size_t input_length, byte_t* data, const size_t data_length, size_t* decoded_length)
+{
+  size_t leading_ones = 0U;
+
+  while ((leading_ones < input_length) && (input[leading_ones] == '1'))
+  {
+    ++leading_ones;
+  }
+
+  CARDANO_UNUSED(memset(data, 0, data_length));
+
+  for (size_t i = leading_ones; i < input_length; ++i)
+  {
+    const int64_t value = char_index(input[i], BASE58_ALPHABET);
+
+    if (value < 0)
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    uint32_t carry = (uint32_t)value;
+
+    for (size_t j = data_length; j > 0U; --j)
+    {
+      carry        += 58U * (uint32_t)data[j - 1U];
+      data[j - 1U] = (byte_t)(carry % 256U);
+      carry        /= 256U;
+    }
+
+    if (carry != 0U)
+    {
+      return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+    }
+  }
+
+  size_t first_nonzero = 0U;
+
+  while ((first_nonzero < data_length) && (data[first_nonzero] == 0U))
+  {
+    ++first_nonzero;
+  }
+
+  if (leading_ones > first_nonzero)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  const size_t magnitude_length = data_length - first_nonzero;
+  *decoded_length               = leading_ones + magnitude_length;
+
+  CARDANO_UNUSED(memmove(&data[leading_ones], &data[first_nonzero], magnitude_length));
+  CARDANO_UNUSED(memset(data, 0, leading_ones));
+  CARDANO_UNUSED(memset(&data[*decoded_length], 0, data_length - *decoded_length));
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+size_t
+cardano_encoding_base58_get_encoded_length(const byte_t* data, const size_t data_length)
+{
+  if (data == NULL)
+  {
+    return 0;
+  }
+
+  if (data_length == 0U)
+  {
+    return 1;
+  }
+
+  size_t leading_zeros = 0;
+
+  for (size_t i = 0; (i < data_length) && (data[i] == 0U); ++i)
+  {
+    ++leading_zeros;
+  }
+
+  const size_t non_zero_length = data_length - leading_zeros;
+
+  if (data_length > ((SIZE_MAX - 1U) / 2U))
+  {
+    return 0U;
+  }
+
+  // 1.38 exceeds log(256) / log(58); round the integer estimate upward.
+  const size_t digits = ((non_zero_length / 100U) * 138U) + ((((non_zero_length % 100U) * 138U) + 99U) / 100U);
+
+  return digits + leading_zeros + 1U;
+}
+
+cardano_error_t
+cardano_encoding_base58_encode(
+  const byte_t* data,
+  const size_t  data_length,
+  char*         output,
+  const size_t  output_length)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data_length == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t encoded_length = cardano_encoding_base58_get_encoded_length(data, data_length);
+
+  if ((encoded_length == 0U) || (output_length < encoded_length))
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  uint8_t* temp = (uint8_t*)_cardano_malloc(encoded_length);
+
+  if (!temp)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  CARDANO_UNUSED(memset(temp, 0, encoded_length));
+
+  for (size_t i = 0; i < data_length; i++)
+  {
+    int64_t carry = data[i];
+
+    for (size_t j = encoded_length - 2U; j < encoded_length; j--)
+    {
+      carry   += 256 * (int64_t)temp[j];
+      temp[j] = carry % 58;
+      carry   /= 58;
+    }
+  }
+
+  size_t output_index = 0U;
+
+  while ((output_index < data_length) && (data[output_index] == 0U))
+  {
+    output[output_index] = '1';
+    ++output_index;
+  }
+
+  size_t first_digit = 0U;
+
+  while ((first_digit < (encoded_length - 1U)) && (temp[first_digit] == 0U))
+  {
+    ++first_digit;
+  }
+
+  for (size_t i = first_digit; i < (encoded_length - 1U); ++i)
+  {
+    output[output_index] = BASE58_ALPHABET[temp[i]];
+    ++output_index;
+  }
+
+  output[output_index] = '\0';
+
+  _cardano_free(temp);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_encoding_base58_get_decoded_length(const char* data, const size_t data_length)
+{
+  if (data == NULL)
+  {
+    return 0;
+  }
+
+  if (data_length == 0U)
+  {
+    return 0;
+  }
+
+  byte_t* decoded = _cardano_malloc(data_length);
+
+  if (decoded == NULL)
+  {
+    return 0U;
+  }
+
+  size_t                decoded_length = 0U;
+  const cardano_error_t result         = base58_decode_into(data, data_length, decoded, data_length, &decoded_length);
+
+  _cardano_free(decoded);
+
+  return (result == CARDANO_SUCCESS) ? decoded_length : 0U;
+}
+
+cardano_error_t
+cardano_encoding_base58_decode(
+  const char* input,
+  size_t      input_length,
+  byte_t*     data,
+  size_t      data_length)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0U; i < input_length; ++i)
+  {
+    if (char_index(input[i], BASE58_ALPHABET) < 0)
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+  }
+
+  if (data_length == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  size_t decoded_length = 0U;
+
+  return base58_decode_into(input, input_length, data, data_length, &decoded_length);
+}
diff --git a/vendor/src/encoding/bech32.c b/vendor/src/encoding/bech32.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/encoding/bech32.c
@@ -0,0 +1,890 @@
+/**
+ * \file bech32.c
+ *
+ * \author angel.castillo
+ * \date   Apr 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "../allocators.h"
+#include "../string_safe.h"
+#include <cardano/encoding/bech32.h>
+
+#include <assert.h>
+#include <ctype.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const size_t BECH32_CHECKSUM_LENGTH = 6;
+static const char   BECH32_SEPARATOR       = '1';
+static const size_t NULL_TERMINATOR_LENGTH = 1;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Finds the index of a character in a string.
+ *
+ * \param[in] data The data to search.
+ * \param[in] length The length of the data.
+ * \param[in] separator The character to find.
+ *
+ * \return The index of the separator character in the data, or -1 if the separator is not found.
+ */
+static int32_t
+get_index_of(const char* data, const size_t length, const char separator)
+{
+  assert(data != NULL);
+  assert(length > 0U);
+
+  int32_t index = -1;
+
+  for (size_t i = length - 1U; i > 0U; --i)
+  {
+    if (data[i] == separator)
+    {
+      index = (int32_t)i;
+      break;
+    }
+  }
+
+  return index;
+}
+
+/**
+ * \brief Calculate the number of 5-bit groups needed to represent the data.
+ * This is data_length_8bit * 8 (bits) / 5 (bits per group), rounded up to the nearest whole number.
+ *
+ * \param[in] data_length_8bit The length of the data in 8-bit groups.
+ *
+ * \return The length of the data in 5-bit groups.
+ */
+static size_t
+convert_8bit_to_5bit_length(const size_t data_length_8bit)
+{
+  return ((data_length_8bit * 8U) + 4U) / 5U;
+}
+
+/**
+ * \brief Calculate the number of bytes needed to represent the data in 5-bit groups.
+ * This is data_length_5bit * 5 (bits) / 8 (bits per byte), rounded down to the nearest whole number.
+ *
+ * \param[in] data_length_5bit The length of the data in 5-bit groups.
+ *
+ * \return The number of bytes needed to represent the data in 5-bit groups.
+ */
+static size_t
+convert_5bit_to_8bit_length(const size_t data_length_5bit)
+{
+  return (data_length_5bit * 5U) / 8U;
+}
+
+/**
+ * \brief Converts a string to lowercase.
+ *
+ * \param[out] dest Destination string where the lowercase string will be stored.
+ * \param[in] src Source string to be converted to lowercase.
+ * \param[in] length Length of the source string.
+ */
+static void
+to_lower_string(char* dest, const char* src, const size_t length)
+{
+  assert(dest != NULL);
+
+  for (size_t i = 0; i < length; ++i)
+  {
+    dest[i] = (char)tolower((int)src[i]);
+  }
+
+  dest[length] = '\0';
+}
+
+/**
+ * \brief Converts a string to uppercase.
+ *
+ * \param[out] dest Destination string where the uppercase string will be stored.
+ * \param[in] src Source string to be converted to uppercase.
+ * \param[in] length Length of the source string.
+ */
+static void
+to_upper_string(char* dest, const char* src, const size_t length)
+{
+  assert(dest != NULL);
+
+  for (size_t i = 0; i < length; ++i)
+  {
+    dest[i] = (char)toupper((int)src[i]);
+  }
+
+  dest[length] = '\0';
+}
+
+/**
+ * \brief PolyMod takes a byte slice and returns the 32-bit BCH checksum.
+ *
+ * Note that the input bytes to poly_mod need to be squashed to 5-bits tall
+ * before being used in this function.  And this function will not error,
+ * but instead return an unstable checksum, if you give it full-height bytes.
+ *
+ * \param[in] values The values to get the checksum from.
+ * \param[in] length The length of the values array.
+ *
+ * \return The checksum.
+ */
+static uint32_t
+poly_mod(const byte_t* values, const size_t length)
+{
+  assert(values != NULL);
+
+  static const uint32_t GENERATOR[] = { 0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3 };
+
+  uint32_t checksum = 1;
+
+  for (size_t i = 0; i < length; ++i)
+  {
+    byte_t top = (byte_t)(checksum >> 25);
+
+    checksum = ((checksum & 0x1ffffffU) << 5U) ^ values[i];
+
+    for (size_t j = 0; j < 5U; ++j)
+    {
+      if (((top >> j) & 1U) == 1U)
+      {
+        checksum ^= GENERATOR[j];
+      }
+    }
+  }
+
+  return checksum;
+}
+
+/**
+ * \brief Checks if a string contains mixed case letters and formats it to lowercase.
+ *
+ * \param[out] dest Destination string where the lowercase address will be stored.
+ * \param[in] address The address to be verified.
+ * \param[in] length Length of the address string.
+ *
+ * \return 0 if successful, 1 if the address contains mixed case.
+ */
+static cardano_error_t
+check_and_format(char* dest, const char* address, const size_t length)
+{
+  assert(dest != NULL);
+  assert(address != NULL);
+
+  char* low_addr = (char*)_cardano_malloc(length + NULL_TERMINATOR_LENGTH);
+
+  if (low_addr == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  char* high_addr = (char*)_cardano_malloc(length + NULL_TERMINATOR_LENGTH);
+
+  if (high_addr == NULL)
+  {
+    _cardano_free(low_addr);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  to_lower_string(low_addr, address, length);
+  to_upper_string(high_addr, address, length);
+
+  if ((strncmp(address, low_addr, length) != 0) && (strncmp(address, high_addr, length) != 0))
+  {
+    _cardano_free(low_addr);
+    _cardano_free(high_addr);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  cardano_safe_memcpy(dest, length, low_addr, length);
+  dest[length] = '\0';
+
+  _cardano_free(low_addr);
+  _cardano_free(high_addr);
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Expands the human readable part into 5bit-bytes for later processing.
+ *
+ * \param[in] input The human readable part to be expanded.
+ * \param[in] input_length The length of the input string.
+ * \param[out] output A pointer to the pointer of the output array, where the result will be stored.
+ * \param[out] output_length A pointer to a size_t variable, where the length of the output array will be stored.
+ */
+static void
+hrp_expand(const char* input, const size_t input_length, byte_t** output, size_t* output_length)
+{
+  assert(input != NULL);
+  assert(output != NULL);
+  assert(output_length != NULL);
+
+  *output_length = (input_length * 2U) + 1U;
+  *output        = (byte_t*)_cardano_malloc(*output_length * sizeof(byte_t));
+
+  if (*output == NULL)
+  {
+    return;
+  }
+
+  CARDANO_UNUSED(memset(*output, 0, *output_length));
+
+  for (size_t i = 0; i < input_length; ++i)
+  {
+    const byte_t khar = (byte_t)input[i];
+    (*output)[i]      = khar >> 5;
+  }
+
+  for (size_t i = 0; i < input_length; ++i)
+  {
+    const byte_t khar                = (byte_t)input[i];
+    (*output)[i + input_length + 1U] = khar & 0x1FU;
+  }
+}
+
+/**
+ * \brief Verifies the checksum of the address.
+ *
+ * \param[in] hrp The human readable part of the address.
+ * \param[in] hrp_length The length of the hrp string.
+ * \param[in] data The data part of the address.
+ * \param[in] data_length The length of the data array.
+ *
+ * \return \c true if the checksum is valid; otherwise; \c false.
+ */
+static bool
+verify_checksum(const char* hrp, const size_t hrp_length, const byte_t* data, const size_t data_length)
+{
+  size_t  expanded_hrp_length = 0;
+  byte_t* expanded_hrp        = NULL;
+
+  assert(hrp != NULL);
+  assert(data != NULL);
+
+  hrp_expand(hrp, hrp_length, &expanded_hrp, &expanded_hrp_length);
+
+  if (expanded_hrp == NULL)
+  {
+    return false;
+  }
+
+  const size_t values_length = expanded_hrp_length + data_length;
+  byte_t*      values        = (byte_t*)_cardano_malloc(values_length);
+
+  if (values == NULL)
+  {
+    _cardano_free(expanded_hrp);
+    return false;
+  }
+
+  cardano_safe_memcpy(values, values_length, expanded_hrp, expanded_hrp_length);
+  cardano_safe_memcpy(&values[expanded_hrp_length], values_length - expanded_hrp_length, data, data_length);
+
+  const byte_t checksum = poly_mod(values, values_length);
+
+  _cardano_free(expanded_hrp);
+  _cardano_free(values);
+
+  return checksum == 1U;
+}
+
+/**
+ * Creates an address checksum.
+ *
+ * \param[in] hrp The human readable part of the address.
+ * \param[in] hrp_length The length of the hrp string.
+ * \param[in] data The data part of the address.
+ * \param[in] data_length The length of the data array.
+ * \param[out] checksum Output parameter for the checksum. The caller is responsible for allocating memory for 6 bytes.
+ */
+static cardano_error_t
+create_checksum(const char* hrp, size_t hrp_length, const byte_t* data, const size_t data_length, byte_t* checksum)
+{
+  size_t  expanded_hrp_length = 0;
+  byte_t* expanded_hrp        = NULL;
+
+  assert(hrp != NULL);
+  assert(checksum != NULL);
+
+  hrp_expand(hrp, hrp_length, &expanded_hrp, &expanded_hrp_length);
+
+  if (expanded_hrp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const size_t values_length = expanded_hrp_length + data_length + BECH32_CHECKSUM_LENGTH;
+  byte_t*      values        = (byte_t*)_cardano_malloc(values_length * sizeof(byte_t));
+
+  if (values == NULL)
+  {
+    _cardano_free(expanded_hrp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_safe_memcpy(values, values_length, expanded_hrp, expanded_hrp_length);
+  cardano_safe_memcpy(&values[expanded_hrp_length], values_length - expanded_hrp_length, data, data_length);
+
+  CARDANO_UNUSED(memset(&values[expanded_hrp_length + data_length], 0, BECH32_CHECKSUM_LENGTH));
+
+  const uint32_t poly_checksum = poly_mod(values, values_length) ^ 1U;
+
+  for (size_t i = 0; i < BECH32_CHECKSUM_LENGTH; i++)
+  {
+    checksum[i] = (poly_checksum >> (5U * (5U - i))) & 0x1fU;
+  }
+
+  _cardano_free(expanded_hrp);
+  _cardano_free(values);
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Converts a string to an array of squashed bytes.
+ *
+ * \param[in] input The string to be squashed.
+ * \param[in] input_length The length of the input string.
+ * \param[out] output A pointer to the pointer of the output array where the squashed bytes will be stored.
+ * \param[out] output_length A pointer to a size_t variable where the length of the output array will be stored.
+ *
+ * \return 0 if successful, non-zero if the string contains an invalid character.
+ */
+static cardano_error_t
+string_to_squashed_bytes(const char* input, const size_t input_length, byte_t** output, size_t* output_length)
+{
+  assert(input != NULL);
+  assert(output != NULL);
+  assert(output_length != NULL);
+
+  // clang-format off
+
+  static const int16_t
+  ICHARSET[] =
+  {
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    15, -1, 10, 17, 21, 20, 26, 30,  7,  5, -1, -1, -1, -1, -1, -1,
+    -1, 29, -1, 24, 13, 25,  9,  8, 23, -1, 18, 22, 31, 27, 19, -1,
+    1,  0,  3, 16, 11, 28, 12, 14,  6,  4,  2, -1, -1, -1, -1, -1,
+    -1, 29, -1, 24, 13, 25,  9,  8, 23, -1, 18, 22, 31, 27, 19, -1,
+    1,  0,  3, 16, 11, 28, 12, 14,  6,  4,  2, -1, -1, -1, -1, -1
+  };
+
+  // clang-format on
+
+  byte_t* tmp = (byte_t*)_cardano_malloc(input_length * sizeof(byte_t));
+
+  if (tmp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (size_t i = 0; i < input_length; ++i)
+  {
+    unsigned char khar   = input[i];
+    short         buffer = ICHARSET[khar];
+
+    if (buffer == -1)
+    {
+      _cardano_free(tmp);
+      *output = NULL;
+
+      return CARDANO_ERROR_DECODING;
+    }
+
+    tmp[i] = (byte_t)buffer;
+  }
+
+  *output_length = input_length;
+  *output        = tmp;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Decodes a bech32 string into a squashed byte array.
+ *
+ * \param[in] address The bech32 address to be decoded.
+ * \param[in] address_length Length of the bech32 address.
+ * \param[out] hrp Output buffer for the human-readable part.
+ * \param[in] hrp_length Length of the buffer allocated for hrp.
+ * \param[out] data Output buffer for the decoded data.
+ * \param[out] data_length Pointer to store the length of the decoded data.
+ *
+ * \return 0 if successful, non-zero if the bech32 string is invalid.
+ */
+static cardano_error_t
+decode_squashed(const char* address, const size_t address_length, char* hrp, const size_t hrp_length, byte_t** data, size_t* data_length)
+{
+  assert(address != NULL);
+  assert(hrp != NULL);
+  assert(data != NULL);
+  assert(*data == NULL);
+  assert(data_length != NULL);
+
+  char* formatted_address = _cardano_malloc(address_length + NULL_TERMINATOR_LENGTH);
+
+  if (formatted_address == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  if (check_and_format(formatted_address, address, address_length) != CARDANO_SUCCESS)
+  {
+    _cardano_free(formatted_address);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  int32_t split_loc = get_index_of(formatted_address, address_length, BECH32_SEPARATOR);
+
+  if (split_loc == -1)
+  {
+    _cardano_free(formatted_address);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if ((size_t)split_loc >= hrp_length)
+  {
+    _cardano_free(formatted_address);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  cardano_safe_memcpy(hrp, hrp_length, formatted_address, split_loc);
+
+  hrp[split_loc]          = '\0';
+  byte_t* squashed        = NULL;
+  size_t  squashed_length = 0;
+
+  if (string_to_squashed_bytes(&formatted_address[split_loc + 1], address_length - (size_t)split_loc - 1U, &squashed, &squashed_length) != CARDANO_SUCCESS)
+  {
+    _cardano_free(formatted_address);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (!verify_checksum(hrp, cardano_safe_strlen(hrp, split_loc), squashed, squashed_length))
+  {
+    _cardano_free(formatted_address);
+    _cardano_free(squashed);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *data_length = squashed_length - BECH32_CHECKSUM_LENGTH;
+  *data        = _cardano_malloc(*data_length);
+
+  if (*data == NULL)
+  {
+    _cardano_free(formatted_address);
+    _cardano_free(squashed);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_safe_memcpy(*data, *data_length, squashed, *data_length);
+
+  _cardano_free(formatted_address);
+  _cardano_free(squashed);
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Converts a squashed byte array to a string.
+ *
+ * \param[in] input The squashed byte array to be converted.
+ * \param[in] input_length The length of the squashed byte array.
+ * \param[out] output Pointer to a char* that will point to the newly created string.
+ * \param[out] output_length Pointer to a size_t that will store the length of the output string.
+ *
+ * \return 0 on success, non-zero error code on failure.
+ */
+static cardano_error_t
+squashed_bytes_to_string(const byte_t* input, const size_t input_length, char** output, size_t* output_length)
+{
+  assert(input != NULL);
+  assert(output != NULL);
+  assert(*output == NULL);
+
+  static const char* CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
+
+  *output = _cardano_malloc(input_length + NULL_TERMINATOR_LENGTH);
+
+  if (*output == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (size_t i = 0; i < input_length; ++i)
+  {
+    assert((input[i] & 0xE0U) == 0U);
+
+    (*output)[i] = CHARSET[input[i]];
+  }
+
+  (*output)[input_length] = '\0';
+  *output_length          = input_length;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Encodes a squashed byte array into a bech32 string.
+ *
+ * \param[in] hrp The human-readable part.
+ * \param[in] hrp_length Length of the human-readable part.
+ * \param[in] data The squashed data.
+ * \param[in] data_length Length of the squashed data.
+ * \param[out] output Pointer to the char* that will hold the bech32 encoded string.
+ * \param[in] output_length Length of the output buffer.
+ *
+ * \return 0 on success, non-zero error code on failure. Caller is responsible for freeing the output string.
+ */
+static cardano_error_t
+encode_squashed(
+  const char*   hrp,
+  const size_t  hrp_length,
+  const byte_t* data,
+  const size_t  data_length,
+  char*         output,
+  const size_t  output_length)
+{
+  assert(hrp != NULL);
+  assert(output != NULL);
+
+  byte_t* checksum = (byte_t*)_cardano_malloc(BECH32_CHECKSUM_LENGTH);
+
+  if (checksum == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = create_checksum(hrp, hrp_length, data, data_length, checksum);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(checksum);
+    return result;
+  }
+
+  size_t  combined_length = data_length + BECH32_CHECKSUM_LENGTH;
+  byte_t* combined        = _cardano_malloc(combined_length);
+
+  if (combined == NULL)
+  {
+    _cardano_free(checksum);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_safe_memcpy(combined, combined_length, data, data_length);
+  cardano_safe_memcpy(&combined[data_length], combined_length - data_length, checksum, BECH32_CHECKSUM_LENGTH);
+
+  char*  encoded        = NULL;
+  size_t encoded_length = 0U;
+  result                = squashed_bytes_to_string(combined, combined_length, &encoded, &encoded_length);
+
+  _cardano_free(combined);
+  _cardano_free(checksum);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  size_t required_output_length = hrp_length + NULL_TERMINATOR_LENGTH + cardano_safe_strlen(encoded, encoded_length);
+
+  if (output_length < required_output_length)
+  {
+    _cardano_free(encoded);
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  int32_t format_result = snprintf(output, output_length, "%s1%s", hrp, encoded);
+
+  _cardano_free(encoded);
+
+  if (format_result < 0)
+  {
+    return CARDANO_ERROR_ENCODING;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Converts full-width (8-bit) bytes into "squashed" 5-bit bytes, and vice versa.
+ *
+ * \param[in] input The data to be squashed.
+ * \param[in] input_length The length of the input data.
+ * \param[in] input_width The width of the input bytes.
+ * \param[in] output_width The width of the output bytes.
+ * \param[out] output A pointer to a buffer that will hold the squashed data. This buffer should be allocated by the caller.
+ * \param[out] output_length The length of the output data (number of bytes).
+ *
+ * \return CARDANO_SUCCESS on success, an error code on failure.
+ */
+static cardano_error_t
+byte_squasher(const byte_t* input, const size_t input_length, const size_t input_width, const size_t output_width, byte_t** output, size_t* output_length)
+{
+  assert(output != NULL);
+  assert(*output == NULL);
+  assert(output_length != NULL);
+
+  if ((input == NULL) || (input_length == 0U))
+  {
+    *output_length = 0;
+    return CARDANO_SUCCESS;
+  }
+
+  size_t         bit_stash        = 0;
+  uint32_t       accumulator      = 0;
+  const uint32_t max_output_value = ((uint32_t)1U << (uint32_t)output_width) - 1U;
+
+  const size_t estimated_output_size = ((input_length * input_width) + (output_width - 1U)) / output_width;
+  *output                            = _cardano_malloc(estimated_output_size);
+
+  if (*output == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  size_t current_output_length = 0;
+
+  for (size_t i = 0; i < input_length; ++i)
+  {
+    assert((input[i] >> input_width) == 0U);
+
+    accumulator = (accumulator << input_width) | input[i];
+    bit_stash   += input_width;
+
+    while (bit_stash >= output_width)
+    {
+      bit_stash                        -= output_width;
+      (*output)[current_output_length] = (accumulator >> bit_stash) & max_output_value;
+      ++current_output_length;
+    }
+  }
+
+  if (input_width == 8U)
+  {
+    if (bit_stash != 0U)
+    {
+      (*output)[current_output_length] = (accumulator << (output_width - bit_stash)) & max_output_value;
+      ++current_output_length;
+    }
+  }
+  else
+  {
+    if ((bit_stash >= input_width) || (((accumulator << (output_width - bit_stash)) & max_output_value) != 0U))
+    {
+      _cardano_free(*output);
+      *output = NULL;
+
+      return CARDANO_ERROR_ENCODING;
+    }
+  }
+
+  *output_length = current_output_length;
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+size_t
+cardano_encoding_bech32_get_encoded_length(
+  const char*   hrp,
+  const size_t  hrp_length,
+  const byte_t* data,
+  const size_t  data_length)
+{
+  static const size_t BECH32_SEPARATOR_LENGTH = 1;
+
+  CARDANO_UNUSED(hrp);
+  CARDANO_UNUSED(data);
+
+  return hrp_length +
+    BECH32_SEPARATOR_LENGTH +
+    convert_8bit_to_5bit_length(data_length) +
+    BECH32_CHECKSUM_LENGTH +
+    NULL_TERMINATOR_LENGTH;
+}
+
+cardano_error_t
+cardano_encoding_bech32_encode(
+  const char*   hrp,
+  const size_t  hrp_length,
+  const byte_t* data,
+  const size_t  data_length,
+  char*         output,
+  const size_t  output_length)
+{
+  if (hrp == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((data == NULL) && (data_length > 0U))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (output_length == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  byte_t* squashed_data   = NULL;
+  size_t  squashed_length = 0;
+
+  cardano_error_t result = byte_squasher(data, data_length, 8, 5, &squashed_data, &squashed_length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    if (squashed_data != NULL)
+    {
+      _cardano_free(squashed_data);
+    }
+
+    return result;
+  }
+
+  result = encode_squashed(hrp, hrp_length, squashed_data, squashed_length, output, output_length);
+
+  _cardano_free(squashed_data);
+
+  return result;
+}
+
+size_t
+cardano_encoding_bech32_get_decoded_length(
+  const char*  data,
+  const size_t data_length,
+  size_t*      hrp_length)
+{
+  if (data == NULL)
+  {
+    return 0;
+  }
+
+  if (data_length == 0U)
+  {
+    return 0;
+  }
+
+  if (hrp_length == NULL)
+  {
+    return 0;
+  }
+
+  *hrp_length = 0;
+
+  int32_t separator_index = get_index_of(data, data_length, BECH32_SEPARATOR);
+
+  if (separator_index == -1)
+  {
+    return 0;
+  }
+
+  *hrp_length = separator_index;
+
+  if (data_length < (*hrp_length + NULL_TERMINATOR_LENGTH + BECH32_CHECKSUM_LENGTH))
+  {
+    return 0;
+  }
+
+  size_t data_part_length = data_length - *hrp_length - NULL_TERMINATOR_LENGTH - BECH32_CHECKSUM_LENGTH;
+
+  size_t decoded_data_length = convert_5bit_to_8bit_length(data_part_length);
+
+  *hrp_length += NULL_TERMINATOR_LENGTH;
+
+  return decoded_data_length;
+}
+
+cardano_error_t
+cardano_encoding_bech32_decode(
+  const char*  input,
+  const size_t input_length,
+  char*        hrp,
+  const size_t hrp_length,
+  byte_t*      data,
+  const size_t data_length)
+{
+  if (input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hrp == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  byte_t* squashed_data   = NULL;
+  size_t  squashed_length = 0;
+
+  cardano_error_t result = decode_squashed(input, input_length, hrp, hrp_length, &squashed_data, &squashed_length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  byte_t* output_data   = NULL;
+  size_t  output_length = 0;
+
+  result = byte_squasher((byte_t*)squashed_data, squashed_length, 5, 8, &output_data, &output_length);
+
+  _cardano_free(squashed_data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (output_length > data_length)
+  {
+    _cardano_free(output_data);
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  cardano_safe_memcpy(data, data_length, output_data, output_length);
+
+  _cardano_free(output_data);
+
+  return result;
+}
diff --git a/vendor/src/endian.c b/vendor/src/endian.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/endian.c
@@ -0,0 +1,530 @@
+/**
+ * \file endian.c
+ *
+ * \author angel.castillo
+ * \date   Sep 09, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "endian.h"
+#include "string_safe.h"
+
+/* CONSTANTS *****************************************************************/
+
+static const byte_t SIZE_IN_BYTES_16_BITS = 2;
+static const byte_t SIZE_IN_BYTES_32_BITS = 4;
+static const byte_t SIZE_IN_BYTES_64_BITS = 8;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Copies count bytes from the memory pointed to by src to the memory pointed to by dest in reverse order.
+ * Both objects are reinterpreted as arrays of unsigned char.
+ *
+ * \param dest Pointer to the destination memory.
+ * \param dest_size The max capacity of the destination memory.
+ * \param src Pointer to the source memory.
+ * \param size The number of bytes to copy.
+ */
+static void
+reverse_memcpy(byte_t* dest, const size_t dest_size, const byte_t* src, const size_t size)
+{
+  const size_t max_size = (size > dest_size) ? dest_size : size;
+
+  for (size_t i = 0; i < max_size; ++i)
+  {
+    dest[i] = src[max_size - i - (size_t)1];
+  }
+}
+
+/**
+ * Writes the source buffer into the destination buffer adjusting for endianess.
+ *
+ * \param[in] src The source buffer.
+ * \param[in] src_size The size of the source buffer.
+ * \param[out] dest The destination buffer.
+ * \param[in] dest_size The size of the destination buffer.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ * \param[in] is_native_endian Whether the current system endianess matches the desired endianess.
+ *
+ * \return \c cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \c cardano_error_t otherwise.
+ */
+static cardano_error_t
+write_bytes(
+  const byte_t* src,
+  const size_t  src_size,
+  byte_t*       dest,
+  const size_t  dest_size,
+  const size_t  offset,
+  const bool    is_native_endian)
+{
+  if ((dest_size - offset) < src_size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (is_native_endian)
+  {
+    cardano_safe_memcpy(&dest[offset], dest_size - offset, src, src_size);
+  }
+  else
+  {
+    reverse_memcpy(&dest[offset], dest_size - offset, src, src_size);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Read the source buffer into the destination buffer adjusting for endianess.
+ *
+ * \param[in] src The source buffer.
+ * \param[in] src_size The size of the source buffer.
+ * \param[out] dest The destination buffer.
+ * \param[in] dest_size The size of the destination buffer.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ * \param[in] is_native_endian Whether the current system endianess matches the desired endianess.
+ *
+ * \return \c cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \c cardano_error_t otherwise.
+ */
+static cardano_error_t
+read_bytes(
+  const byte_t* src,
+  const size_t  src_size,
+  byte_t*       dest,
+  const size_t  dest_size,
+  const size_t  offset,
+  const bool    is_native_endian)
+{
+  if ((src_size - offset) < dest_size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (is_native_endian)
+  {
+    cardano_safe_memcpy(dest, dest_size, &src[offset], src_size - offset);
+  }
+  else
+  {
+    reverse_memcpy(dest, dest_size, &src[offset], src_size - offset);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+bool
+cardano_is_little_endian(void)
+{
+  int16_t  number  = 0x1;
+  uint8_t* num_ptr = (uint8_t*)&number;
+
+  return num_ptr[0] == (uint8_t)1;
+}
+
+bool
+cardano_is_big_endian(void)
+{
+  return !cardano_is_little_endian();
+}
+
+cardano_error_t
+cardano_write_uint16_le(const uint16_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_write_uint32_le(const uint32_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_write_uint64_le(const uint64_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_write_int16_le(const int16_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_write_int32_le(const int32_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_write_int64_le(const int64_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_write_float_le(const float value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_write_double_le(const double value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_write_uint16_be(const uint16_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_write_uint32_be(const uint32_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_write_uint64_be(const uint64_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_write_int16_be(const int16_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_write_int32_be(const int32_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_write_int64_be(const int64_t value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_write_float_be(const float value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_write_double_be(const double value, byte_t* buffer, const size_t size, const size_t offset)
+{
+  return write_bytes(
+    (const byte_t*)&value,
+    sizeof(value),
+    buffer,
+    size,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_read_uint16_le(uint16_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_16_BITS,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_read_uint32_le(uint32_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_32_BITS,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_read_uint64_le(uint64_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_64_BITS,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_read_int16_le(int16_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_16_BITS,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_read_int32_le(int32_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_32_BITS,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_read_int64_le(int64_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_64_BITS,
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_read_float_le(float* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    sizeof(float),
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_read_double_le(double* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    sizeof(double),
+    offset,
+    cardano_is_little_endian());
+}
+
+cardano_error_t
+cardano_read_uint16_be(uint16_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_16_BITS,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_read_uint32_be(uint32_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_32_BITS,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_read_uint64_be(uint64_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_64_BITS,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_read_int16_be(int16_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_16_BITS,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_read_int32_be(int32_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_32_BITS,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_read_int64_be(int64_t* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    SIZE_IN_BYTES_64_BITS,
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_read_float_be(float* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    sizeof(float),
+    offset,
+    cardano_is_big_endian());
+}
+
+cardano_error_t
+cardano_read_double_be(double* value, const byte_t* buffer, const size_t size, const size_t offset)
+{
+  return read_bytes(
+    buffer,
+    size,
+    (byte_t*)value,
+    sizeof(double),
+    offset,
+    cardano_is_big_endian());
+}
diff --git a/vendor/src/endian.h b/vendor/src/endian.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/endian.h
@@ -0,0 +1,440 @@
+/**
+ * \file endian.h
+ *
+ * \author angel.castillo
+ * \date   Sep 09, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_ENDIAN_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_ENDIAN_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Gets whether the scalar types are little-endian. That is, the least significant byte
+ * is stored in the smallest address. For example, 0x1234 is stored 0x34 0x12.
+ *
+ * \return \c true if the system is little endian; otherwise; \c false.
+ */
+bool cardano_is_little_endian(void);
+
+/**
+ * \brief Gets whether that scalar types are big-endian, that is, the most significant byte is stored
+ * in the smallest address. For example, 0x1234 is stored 0x12 0x34.
+ *
+ * \return \c true if the system is big endian; otherwise; \c false.
+ */
+bool cardano_is_big_endian(void);
+
+/**
+ * \brief Writes an uint16_t value as little-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_uint16_le(uint16_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an uint32_t value as little-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_uint32_le(uint32_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an uint64_t value as little-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_uint64_le(uint64_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an int16_t value as little-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_int16_le(int16_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an int32_t value as little-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_int32_le(int32_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an int64_t value as little-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_int64_le(int64_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an float value as little-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_float_le(float value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an double value as little-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_double_le(double value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an uint16_t value as big-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_uint16_be(uint16_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an uint32_t value as big-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_uint32_be(uint32_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an uint64_t value as big-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_uint64_be(uint64_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an int16_t value as big-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_int16_be(int16_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an int32_t value as big-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_int32_be(int32_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an int64_t value as big-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_int64_be(int64_t value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an float value as big-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_float_be(float value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Writes an double value as big-endian into the given buffer.
+ *
+ * \param[in] value The value to be written into the buffer.
+ * \param[out] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to write.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_write_double_be(double value, byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a uint16_t value as little-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_uint16_le(uint16_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a uint32_t value as little-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_uint32_le(uint32_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a uint64_t value as little-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_uint64_le(uint64_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a int16_t value as little-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_int16_le(int16_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a int32_t value as little-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_int32_le(int32_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a int64_t value as little-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_int64_le(int64_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a float value as little-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_float_le(float* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a double value as little-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_double_le(double* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a uint16_t value as big-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_uint16_be(uint16_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a uint32_t value as big-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_uint32_be(uint32_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a uint64_t value as big-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_uint64_be(uint64_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a int16_t value as big-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_int16_be(int16_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a int32_t value as big-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_int32_be(int32_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a int64_t value as big-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_int64_be(int64_t* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a float value as big-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_float_be(float* value, const byte_t* buffer, size_t size, size_t offset);
+
+/**
+ * \brief Reads a double value as big-endian from the given buffer.
+ *
+ * \param[out] value A pointer to variable where the result will be written.
+ * \param[in] buffer The buffer where the value will be written to.
+ * \param[in] size The sizeof the buffer in bytes.
+ * \param[in] offset The number of bytes to skip before starting to read.
+ *
+ * \return \ref cardano_error_t Returns \c CARDANO_SUCCESS on success, member of \ref cardano_error_t otherwise.
+ */
+cardano_error_t cardano_read_double_be(double* value, const byte_t* buffer, size_t size, size_t offset);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_ENDIAN_H
diff --git a/vendor/src/error.c b/vendor/src/error.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/error.c
@@ -0,0 +1,224 @@
+/**
+ * \file error.c
+ *
+ * \author angel.castillo
+ * \date   Sep 09, 2023
+ *
+ * Copyright 2023 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_error_to_string(const cardano_error_t error)
+{
+  const char* message;
+
+  switch (error)
+  {
+    case CARDANO_SUCCESS:
+      message = "Successful operation";
+      break;
+    case CARDANO_ERROR_GENERIC:
+      message = "Generic error";
+      break;
+    case CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE:
+      message = "Insufficient buffer size";
+      break;
+    case CARDANO_ERROR_POINTER_IS_NULL:
+      message = "Argument is a NULL pointer";
+      break;
+    case CARDANO_ERROR_MEMORY_ALLOCATION_FAILED:
+      message = "Requested memory could not be allocated";
+      break;
+    case CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ:
+      message = "Out of bounds memory read";
+      break;
+    case CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_WRITE:
+      message = "Out of bounds memory write";
+      break;
+    case CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE:
+      message = "Invalid Blake2b hash size";
+      break;
+    case CARDANO_ERROR_INVALID_ED25519_SIGNATURE_SIZE:
+      message = "Invalid Ed25519 signature size";
+      break;
+    case CARDANO_ERROR_INVALID_ED25519_PUBLIC_KEY_SIZE:
+      message = "Invalid Ed25519 public key size";
+      break;
+    case CARDANO_ERROR_INVALID_ED25519_PRIVATE_KEY_SIZE:
+      message = "Invalid Ed25519 private key size";
+      break;
+    case CARDANO_ERROR_INVALID_BIP32_PUBLIC_KEY_SIZE:
+      message = "Invalid BIP32 public key size";
+      break;
+    case CARDANO_ERROR_INVALID_BIP32_PRIVATE_KEY_SIZE:
+      message = "Invalid BIP32 private key size";
+      break;
+    case CARDANO_ERROR_INVALID_ARGUMENT:
+      message = "Invalid argument";
+      break;
+    case CARDANO_ERROR_INVALID_URL:
+      message = "Invalid argument. Invalid URL";
+      break;
+    case CARDANO_ERROR_ELEMENT_NOT_FOUND:
+      message = "Element not found";
+      break;
+    case CARDANO_ERROR_INVALID_BIP32_DERIVATION_INDEX:
+      message = "Invalid BIP32 derivation index";
+      break;
+    case CARDANO_ERROR_ENCODING:
+      message = "Encoding failure";
+      break;
+    case CARDANO_ERROR_DECODING:
+      message = "Decoding failure";
+      break;
+    case CARDANO_ERROR_CHECKSUM_MISMATCH:
+      message = "Checksum mismatch";
+      break;
+    case CARDANO_ERROR_INVALID_JSON:
+      message = "Invalid JSON";
+      break;
+    case CARDANO_ERROR_INTEGER_OVERFLOW:
+      message = "Integer overflow";
+      break;
+    case CARDANO_ERROR_INTEGER_UNDERFLOW:
+      message = "Integer underflow";
+      break;
+    case CARDANO_ERROR_CONVERSION_FAILED:
+      message = "Conversion error";
+      break;
+    case CARDANO_ERROR_LOSS_OF_PRECISION:
+      message = "Loss of precision";
+      break;
+    case CARDANO_ERROR_INVALID_MAGIC:
+      message = "Invalid magic";
+      break;
+    case CARDANO_ERROR_INVALID_CHECKSUM:
+      message = "Invalid checksum";
+      break;
+    case CARDANO_ERROR_UNEXPECTED_CBOR_TYPE:
+      message = "Unexpected CBOR type";
+      break;
+    case CARDANO_ERROR_INVALID_CBOR_VALUE:
+      message = "Invalid CBOR value";
+      break;
+    case CARDANO_ERROR_INVALID_CBOR_ARRAY_SIZE:
+      message = "Invalid CBOR array size";
+      break;
+    case CARDANO_ERROR_INVALID_CBOR_MAP_SIZE:
+      message = "Invalid CBOR map size";
+      break;
+    case CARDANO_ERROR_INVALID_ADDRESS_TYPE:
+      message = "Invalid address type";
+      break;
+    case CARDANO_ERROR_INVALID_ADDRESS_FORMAT:
+      message = "Invalid address format";
+      break;
+    case CARDANO_ERROR_INVALID_CREDENTIAL_TYPE:
+      message = "Invalid credential type";
+      break;
+    case CARDANO_ERROR_INVALID_PLUTUS_DATA_CONVERSION:
+      message = "Invalid Plutus data conversion";
+      break;
+    case CARDANO_ERROR_INVALID_DATUM_TYPE:
+      message = "Invalid datum type";
+      break;
+    case CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE:
+      message = "Invalid script language";
+      break;
+    case CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE:
+      message = "Invalid native script type";
+      break;
+    case CARDANO_ERROR_INVALID_PLUTUS_COST_MODEL:
+      message = "Invalid Plutus cost model";
+      break;
+    case CARDANO_ERROR_INDEX_OUT_OF_BOUNDS:
+      message = "Index out of bounds";
+      break;
+    case CARDANO_ERROR_INVALID_CERTIFICATE_TYPE:
+      message = "Invalid certificate type";
+      break;
+    case CARDANO_ERROR_NOT_IMPLEMENTED:
+      message = "Not implemented";
+      break;
+    case CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY:
+      message = "Duplicated CBOR map key";
+      break;
+    case CARDANO_ERROR_INVALID_CBOR_MAP_KEY:
+      message = "Invalid CBOR map key";
+      break;
+    case CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE:
+      message = "Invalid procedure proposal type";
+      break;
+    case CARDANO_ERROR_INVALID_METADATUM_CONVERSION:
+      message = "Invalid metadatum conversion";
+      break;
+    case CARDANO_ERROR_INVALID_METADATUM_TEXT_STRING_SIZE:
+      message = "Invalid metadatum text string size, must be less than 64 bytes";
+      break;
+    case CARDANO_ERROR_INVALID_METADATUM_BOUNDED_BYTES_SIZE:
+      message = "Invalid metadatum bounded bytes size, must be less than 64 bytes";
+      break;
+    case CARDANO_ERROR_INVALID_HTTP_REQUEST:
+      message = "Invalid HTTP request";
+      break;
+    case CARDANO_ERROR_INVALID_PASSPHRASE:
+      message = "Invalid passphrase";
+      break;
+    case CARDANO_ERROR_ILLEGAL_STATE:
+      message = "Illegal state";
+      break;
+    case CARDANO_ERROR_DUPLICATED_KEY:
+      message = "Duplicated key";
+      break;
+    case CARDANO_ERROR_BALANCE_INSUFFICIENT:
+      message = "Insufficient balance";
+      break;
+    case CARDANO_ERROR_UTXO_NOT_FRAGMENTED_ENOUGH:
+      message = "UTXO not fragmented enough";
+      break;
+    case CARDANO_ERROR_UTXO_FULLY_DEPLETED:
+      message = "UTXO fully depleted";
+      break;
+    case CARDANO_ERROR_MAXIMUM_INPUT_COUNT_EXCEEDED:
+      message = "Maximum input count exceeded";
+      break;
+    case CARDANO_ERROR_UNBALANCED_SUB_TRANSACTIONS:
+      message = "Unbalanced sub transactions";
+      break;
+    case CARDANO_ERROR_NOT_ALLOWED_SUPPLEMENTAL_DATUMS:
+      message = "Not allowed supplemental datums";
+      break;
+    case CARDANO_ERROR_MISSING_REDEEMER:
+      message = "Missing redeemer";
+      break;
+    case CARDANO_ERROR_SCRIPT_EVALUATION_FAILURE:
+      message = "Script evaluation failure";
+      break;
+    case CARDANO_ERROR_JSON_TYPE_MISMATCH:
+      message = "JSON type mismatch";
+      break;
+    default:
+      message = "Unknown error code";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/json/internals/json_object_common.c b/vendor/src/json/internals/json_object_common.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/internals/json_object_common.c
@@ -0,0 +1,309 @@
+/**
+ * \file json_object_common.c
+ *
+ * \author angel.castillo
+ * \date   Dec 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/json/json_object.h>
+#include <cardano/typedefs.h>
+
+#include "../../allocators.h"
+#include "../../collections/array.h"
+#include "json_object_common.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a JSON object and its associated resources.
+ *
+ * This function is responsible for properly releasing the memory and resources
+ * associated with a \ref cardano_json_object_t. It ensures that all nested objects,
+ * arrays, strings, and other dynamically allocated components are also cleaned up.
+ *
+ * \param[in] object A void pointer to the \ref cardano_json_object_t instance
+ *                   to be deallocated. This must not be \c NULL.
+ */
+static void
+cardano_json_object_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_json_object_t* json_object = (cardano_json_object_t*)object;
+
+  cardano_buffer_unref(&json_object->string);
+  cardano_array_unref(&json_object->pairs);
+  cardano_array_unref(&json_object->array);
+
+  if (json_object->json_string != NULL)
+  {
+    _cardano_free(json_object->json_string);
+  }
+
+  _cardano_free(json_object);
+}
+
+/**
+ * \brief Deallocates a JSON key-value pair and its associated resources.
+ *
+ * This function is responsible for properly releasing the memory and resources
+ * associated with a \ref cardano_json_kvp_t. It ensures that both the key and
+ * the value components are appropriately cleaned up.
+ *
+ * \param[in] object A void pointer to the \ref cardano_json_kvp_t instance
+ *                   to be deallocated. This must not be \c NULL.
+ */
+static void
+cardano_json_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_json_kvp_t* map = (cardano_json_kvp_t*)object;
+
+  cardano_buffer_unref(&map->key);
+  cardano_json_object_unref(&map->value);
+
+  _cardano_free(map);
+}
+
+/* FUNCTIONS *****************************************************************/
+
+cardano_json_object_t*
+cardano_json_object_new(void)
+{
+  cardano_json_object_t* object = (cardano_json_object_t*)_cardano_malloc(sizeof(cardano_json_object_t));
+
+  if (object != NULL)
+  {
+    object->base.ref_count     = 1U;
+    object->base.deallocator   = cardano_json_object_deallocate;
+    object->type               = CARDANO_JSON_OBJECT_TYPE_NULL;
+    object->pairs              = NULL;
+    object->array              = NULL;
+    object->string             = NULL;
+    object->int_value          = 0;
+    object->uint_value         = 0;
+    object->double_value       = 0.0;
+    object->bool_value         = false;
+    object->is_real            = false;
+    object->is_negative        = false;
+    object->json_string        = NULL;
+    object->json_string_length = 0U;
+    object->json_format        = CARDANO_JSON_FORMAT_COMPACT;
+  }
+
+  return object;
+}
+
+cardano_json_kvp_t*
+cardano_json_kvp_new(void)
+{
+  cardano_json_kvp_t* kvp = (cardano_json_kvp_t*)_cardano_malloc(sizeof(cardano_json_kvp_t));
+
+  if (kvp != NULL)
+  {
+    kvp->base.ref_count   = 1U;
+    kvp->base.deallocator = cardano_json_kvp_deallocate;
+    kvp->key              = NULL;
+    kvp->value            = NULL;
+  }
+
+  return kvp;
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_json_kvp_deep_clone(const cardano_json_kvp_t* source, cardano_json_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_kvp_t* copy = _cardano_malloc(sizeof(cardano_json_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = NULL;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_json_object_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_json_pair(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_json_kvp_t*   copy   = NULL;
+  const cardano_error_t result = cardano_json_kvp_deep_clone((const cardano_json_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_json_object_t* copy   = NULL;
+  const cardano_error_t  result = cardano_json_object_deep_clone((const cardano_json_object_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_json_object_deep_clone(const cardano_json_object_t* source, cardano_json_object_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_object_t* copy = _cardano_malloc(sizeof(cardano_json_object_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  copy->pairs              = NULL;
+  copy->array              = NULL;
+  copy->string             = NULL;
+  copy->is_real            = source->is_real;
+  copy->is_negative        = source->is_negative;
+  copy->int_value          = source->int_value;
+  copy->uint_value         = source->uint_value;
+  copy->double_value       = source->double_value;
+  copy->bool_value         = source->bool_value;
+  copy->json_string        = NULL;
+  copy->json_string_length = source->json_string_length;
+  copy->json_format        = source->json_format;
+
+  if (source->pairs != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->pairs, clone_json_pair, &copy->pairs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->string != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->string, &copy->string);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->json_string != NULL)
+  {
+    const size_t size = source->json_string_length;
+
+    copy->json_string = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->json_string == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->json_string, source->json_string, size));
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/json/internals/json_object_common.h b/vendor/src/json/internals/json_object_common.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/internals/json_object_common.h
@@ -0,0 +1,111 @@
+/**
+ * \file json_object_common.h
+ *
+ * \author angel.castillo
+ * \date   Nov 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_COMMON_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_COMMON_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../../collections/array.h"
+#include <cardano/buffer.h>
+#include <cardano/json/json_format.h>
+#include <cardano/json/json_object_type.h>
+#include <cardano/object.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Represents a JSON value in the Cardano library.
+ *
+ * This structure encapsulates a JSON value, which can be an object, array, string, number,
+ * boolean, or null. It provides a flexible representation of JSON data and includes metadata
+ * for efficiently accessing the type and value of the JSON element.
+ *
+ * The structure supports the following JSON types:
+ * - Object: A collection of key-value pairs.
+ * - Array: An ordered collection of values.
+ * - String: A UTF-8 encoded sequence of characters.
+ * - Number: A numeric value that can be integer or floating-point.
+ * - Boolean: A true or false value.
+ * - Null: Represents a JSON null value.
+ */
+typedef struct cardano_json_object_t
+{
+    cardano_object_t           base;               /**< Reference counting and error handling base. */
+    cardano_json_object_type_t type;               /**< Type of the JSON value. */
+    cardano_array_t*           pairs;              /**< Array of key-value pairs for objects. */
+    cardano_array_t*           array;              /**< Array of elements for JSON arrays. */
+    cardano_buffer_t*          string;             /**< Buffer holding a UTF-8 string or validated number token, including its terminator. */
+    bool                       is_real;            /**< Indicates if the number is a floating-point value. */
+    bool                       is_negative;        /**< Indicates if the number is negative. */
+    int64_t                    int_value;          /**< Signed integer value for JSON numbers. */
+    uint64_t                   uint_value;         /**< Unsigned integer value for JSON numbers. */
+    double                     double_value;       /**< Floating-point value for JSON numbers. */
+    bool                       bool_value;         /**< Boolean value for JSON booleans. */
+    char*                      json_string;        /**< String representation of the JSON value. */
+    cardano_json_format_t      json_format;        /**< Format of the cached serialization. */
+    size_t                     json_string_length; /**< Length of the string representation. */
+
+} cardano_json_object_t;
+
+/**
+ * \brief Represents a key-value pair in a JSON object.
+ *
+ * This structure encapsulates a key-value pair within a JSON object. It provides
+ * fields to store the key and the associated value, enabling structured access to
+ * JSON object properties. The `key` is represented as a UTF-8 encoded string, and
+ * the `value` is a pointer to another \ref cardano_json_object_t, allowing nested
+ * JSON structures.
+ */
+typedef struct cardano_json_kvp_t
+{
+    cardano_object_t       base;
+    cardano_buffer_t*      key;
+    cardano_json_object_t* value;
+} cardano_json_kvp_t;
+
+/* FUNCTIONS *****************************************************************/
+
+/**
+ * \brief Creates a new, empty JSON object.
+ *
+ * This function allocates and initializes a new \ref cardano_json_object_t
+ * instance, representing an empty JSON value. The created object can later be
+ * populated with data such as arrays, objects, strings, numbers, booleans, or null.
+ *
+ * \return A pointer to the newly created \ref cardano_json_object_t instance, or \c NULL if
+ *         the allocation fails due to insufficient memory.
+ */
+cardano_json_object_t* cardano_json_object_new(void);
+
+/**
+ * \brief Creates a new, empty key-value pair for a JSON object.
+ *
+ * This function allocates and initializes a new \ref cardano_json_kvp_t
+ * instance, representing a single key-value pair in a JSON object.
+ *
+ * \return A pointer to the newly created \ref cardano_json_kvp_t instance, or \c NULL if
+ *         the allocation fails due to insufficient memory.
+ */
+cardano_json_kvp_t* cardano_json_kvp_new(void);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_COMMON_H
diff --git a/vendor/src/json/internals/json_object_serialization.c b/vendor/src/json/internals/json_object_serialization.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/internals/json_object_serialization.c
@@ -0,0 +1,201 @@
+/**
+ * \file json_object_serialization.c
+ *
+ * \author angel.castillo
+ * \date   Dec 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/json/json_object.h>
+#include <cardano/typedefs.h>
+
+#include "../../collections/array.h"
+#include "json_object_common.h"
+#include "json_object_serialization.h"
+#include "json_writer_common.h"
+
+#include <assert.h>
+#include <inttypes.h>
+#include <string.h>
+
+/* FUNCTIONS *****************************************************************/
+
+cardano_error_t
+cardano_write_json_object(cardano_json_writer_t* writer, const cardano_json_object_t* object)
+{
+  assert(writer != NULL);
+  assert(object != NULL);
+
+  cardano_json_object_type_t type = cardano_json_object_get_type(object);
+
+  switch (type)
+  {
+    case CARDANO_JSON_OBJECT_TYPE_OBJECT:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: We need to use recursion to write nested objects.
+      cardano_write_json_object_type_object(writer, object);
+      break;
+    }
+    case CARDANO_JSON_OBJECT_TYPE_ARRAY:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: We need to use recursion to write nested objects.
+      cardano_write_json_object_type_array(writer, object);
+      break;
+    }
+    case CARDANO_JSON_OBJECT_TYPE_STRING:
+    {
+      cardano_write_json_object_type_string(writer, object);
+      break;
+    }
+    case CARDANO_JSON_OBJECT_TYPE_NUMBER:
+    {
+      cardano_write_json_object_type_number(writer, object);
+      break;
+    }
+    case CARDANO_JSON_OBJECT_TYPE_BOOLEAN:
+    {
+      cardano_write_json_object_type_boolean(writer, object);
+      break;
+    }
+    case CARDANO_JSON_OBJECT_TYPE_NULL:
+    {
+      cardano_json_writer_write_null(writer);
+      break;
+    }
+    default:
+    {
+      cardano_json_writer_set_last_error(writer, "Unknown JSON object type.");
+      return CARDANO_ERROR_ENCODING;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_write_json_object_type_object(cardano_json_writer_t* writer, const cardano_json_object_t* object)
+{
+  cardano_json_writer_write_start_object(writer);
+
+  size_t property_count = cardano_json_object_get_property_count(object);
+
+  for (size_t i = 0U; i < property_count; ++i)
+  {
+    size_t      key_length = 0;
+    const char* key        = cardano_json_object_get_key_at(object, i, &key_length);
+
+    cardano_json_writer_write_property_name(writer, key, key_length);
+
+    cardano_json_object_t* value = cardano_json_object_get_value_at(object, i);
+    cardano_json_object_unref(&value);
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: We need to use recursion to write nested objects.
+    cardano_error_t result = cardano_write_json_object(writer, value);
+
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write object property.");
+  }
+
+  cardano_json_writer_write_end_object(writer);
+}
+
+void
+cardano_write_json_object_type_array(cardano_json_writer_t* writer, const cardano_json_object_t* array)
+{
+  cardano_json_writer_write_start_array(writer);
+
+  size_t array_length = cardano_json_object_array_get_length(array);
+
+  for (size_t i = 0U; i < array_length; ++i)
+  {
+    cardano_json_object_t* element = cardano_json_object_array_get(array, i);
+    cardano_json_object_unref(&element);
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: We need to use recursion to write nested objects.
+    cardano_error_t result = cardano_write_json_object(writer, element);
+
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write array element.");
+  }
+
+  cardano_json_writer_write_end_array(writer);
+}
+
+void
+cardano_write_json_object_type_string(cardano_json_writer_t* writer, const cardano_json_object_t* string_obj)
+{
+  size_t      value_size = 0;
+  const char* value      = cardano_json_object_get_string(string_obj, &value_size);
+
+  cardano_json_writer_write_string(writer, value, value_size - 1U);
+}
+
+void
+cardano_write_json_object_type_number(cardano_json_writer_t* writer, const cardano_json_object_t* number_obj)
+{
+  assert(writer != NULL);
+  assert(number_obj != NULL);
+
+  if (number_obj->string != NULL)
+  {
+    cardano_json_writer_write_raw_value(writer, (const char*)cardano_buffer_get_data(number_obj->string), cardano_buffer_get_size(number_obj->string) - 1U);
+    return;
+  }
+
+  if (number_obj->is_real)
+  {
+    double          value  = 0.0;
+    cardano_error_t result = cardano_json_object_get_double(number_obj, &value);
+
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to get double value.");
+
+    cardano_json_writer_write_double(writer, value);
+  }
+  else
+  {
+    if (number_obj->is_negative)
+    {
+      int64_t signed_value = 0;
+
+      cardano_error_t result = cardano_json_object_get_signed_int(number_obj, &signed_value);
+
+      cardano_json_writer_set_message_if_error(writer, result, "Failed to get signed integer value.");
+
+      cardano_json_writer_write_signed_int(writer, signed_value);
+    }
+    else
+    {
+      uint64_t value = 0;
+
+      cardano_error_t result = cardano_json_object_get_uint(number_obj, &value);
+
+      cardano_json_writer_set_message_if_error(writer, result, "Failed to get unsigned integer value.");
+
+      cardano_json_writer_write_uint(writer, value);
+    }
+  }
+}
+
+void
+cardano_write_json_object_type_boolean(cardano_json_writer_t* writer, const cardano_json_object_t* bool_obj)
+{
+  bool            value  = false;
+  cardano_error_t result = cardano_json_object_get_boolean(bool_obj, &value);
+
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to get boolean value.");
+
+  cardano_json_writer_write_bool(writer, value);
+}
diff --git a/vendor/src/json/internals/json_object_serialization.h b/vendor/src/json/internals/json_object_serialization.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/internals/json_object_serialization.h
@@ -0,0 +1,137 @@
+/**
+ * \file json_object_serialization.h
+ *
+ * \author angel.castillo
+ * \date   Nov 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_SERIALIZATION_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_SERIALIZATION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/json/json_object.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Writes a JSON object to a JSON writer.
+ *
+ * This function serializes a \ref cardano_json_object_t instance into its JSON representation
+ * and writes it to the specified \ref cardano_json_writer_t.
+ *
+ * \param[in,out] writer A pointer to the \ref cardano_json_writer_t instance responsible for writing the serialized JSON data.
+ *                       This parameter must not be \c NULL.
+ * \param[in]     object A pointer to the \ref cardano_json_object_t instance to be serialized and written. This parameter
+ *                       must not be \c NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the object is successfully written; otherwise, an appropriate error code is returned.
+ */
+cardano_error_t
+cardano_write_json_object(
+  cardano_json_writer_t*       writer,
+  const cardano_json_object_t* object);
+
+/**
+ * \brief Writes a JSON object of type `CARDANO_JSON_OBJECT_TYPE_OBJECT` to a JSON writer.
+ *
+ * This function serializes a JSON object with key-value pairs and writes it to the provided
+ * JSON writer. It handles proper formatting and escaping to ensure the output conforms to the
+ * JSON standard.
+ *
+ * \param[in,out] writer A pointer to the \ref cardano_json_writer_t instance responsible for writing
+ *                       the serialized JSON data. This parameter must not be \c NULL.
+ * \param[in]     object A pointer to the \ref cardano_json_object_t instance of type
+ *                       `CARDANO_JSON_OBJECT_TYPE_OBJECT` to be serialized and written. This parameter
+ *                       must not be \c NULL and must represent a valid object with key-value pairs.
+ */
+void
+cardano_write_json_object_type_object(
+  cardano_json_writer_t*       writer,
+  const cardano_json_object_t* object);
+
+/**
+ * \brief Writes a JSON object of type `CARDANO_JSON_OBJECT_TYPE_ARRAY` to a JSON writer.
+ *
+ * This function serializes a JSON array and writes it to the provided JSON writer. It handles
+ * proper formatting to ensure the output conforms to the JSON standard.
+ *
+ * \param[in,out] writer A pointer to the \ref cardano_json_writer_t instance responsible for writing
+ *                       the serialized JSON data. This parameter must not be \c NULL.
+ * \param[in]     array  A pointer to the \ref cardano_json_object_t instance of type
+ *                       `CARDANO_JSON_OBJECT_TYPE_ARRAY` to be serialized and written. This parameter
+ *                       must not be \c NULL and must represent a valid JSON array.
+ */
+void
+cardano_write_json_object_type_array(
+  cardano_json_writer_t*       writer,
+  const cardano_json_object_t* array);
+
+/**
+ * \brief Writes a JSON object of type `CARDANO_JSON_OBJECT_TYPE_STRING` to a JSON writer.
+ *
+ * This function serializes a JSON string and writes it to the provided JSON writer, handling
+ * necessary escaping and formatting to ensure the output conforms to the JSON standard.
+ *
+ * \param[in,out] writer     A pointer to the \ref cardano_json_writer_t instance responsible for writing
+ *                           the serialized JSON data. This parameter must not be \c NULL.
+ * \param[in]     string_obj A pointer to the \ref cardano_json_object_t instance of type
+ *                           `CARDANO_JSON_OBJECT_TYPE_STRING` to be serialized and written. This parameter
+ *                           must not be \c NULL and must represent a valid JSON string.
+ */
+void
+cardano_write_json_object_type_string(
+  cardano_json_writer_t*       writer,
+  const cardano_json_object_t* string_obj);
+
+/**
+ * \brief Writes a JSON object of type `CARDANO_JSON_OBJECT_TYPE_NUMBER` to a JSON writer.
+ *
+ * This function serializes a JSON number and writes it to the provided JSON writer. It supports
+ * both integer and floating-point numbers, ensuring proper formatting according to JSON standards.
+ *
+ * \param[in,out] writer     A pointer to the \ref cardano_json_writer_t instance responsible for writing
+ *                           the serialized JSON data. This parameter must not be \c NULL.
+ * \param[in]     number_obj A pointer to the \ref cardano_json_object_t instance of type
+ *                           `CARDANO_JSON_OBJECT_TYPE_NUMBER` to be serialized and written. This parameter
+ *                           must not be \c NULL and must represent a valid JSON number.
+ */
+void
+cardano_write_json_object_type_number(
+  cardano_json_writer_t*       writer,
+  const cardano_json_object_t* number_obj);
+
+/**
+ * \brief Writes a JSON object of type `CARDANO_JSON_OBJECT_TYPE_BOOLEAN` to a JSON writer.
+ *
+ * This function serializes a JSON boolean value (true or false) and writes it to the provided
+ * JSON writer in the correct JSON format.
+ *
+ * \param[in,out] writer    A pointer to the \ref cardano_json_writer_t instance responsible for writing
+ *                          the serialized JSON data. This parameter must not be \c NULL.
+ * \param[in]     bool_obj  A pointer to the \ref cardano_json_object_t instance of type
+ *                          `CARDANO_JSON_OBJECT_TYPE_BOOLEAN` to be serialized and written. This parameter
+ *                          must not be \c NULL and must represent a valid JSON boolean value.
+ */
+void
+cardano_write_json_object_type_boolean(
+  cardano_json_writer_t*       writer,
+  const cardano_json_object_t* bool_obj);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_JSON_OBJECT_SERIALIZATION_H
diff --git a/vendor/src/json/internals/json_parser.c b/vendor/src/json/internals/json_parser.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/internals/json_parser.c
@@ -0,0 +1,940 @@
+/**
+ * \file json_parser.c
+ *
+ * \author angel.castillo
+ * \date   Dec 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+#include "../../config.h"
+#include "../../string_safe.h"
+#include "json_object_common.h"
+#include "json_parser.h"
+#include "utf8.h"
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const byte_t* ESC_QUOTE                  = (const byte_t*)"\""; // cppcheck-suppress misra-c2012-8.9
+static const byte_t* ESC_BACKSLASH              = (const byte_t*)"\\"; // cppcheck-suppress misra-c2012-8.9
+static const byte_t* ESC_SLASH                  = (const byte_t*)"/";  // cppcheck-suppress misra-c2012-8.9
+static const byte_t* ESC_BACKSPACE              = (const byte_t*)"\b"; // cppcheck-suppress misra-c2012-8.9
+static const byte_t* ESC_FORMFEED               = (const byte_t*)"\f"; // cppcheck-suppress misra-c2012-8.9
+static const byte_t* ESC_NEWLINE                = (const byte_t*)"\n"; // cppcheck-suppress misra-c2012-8.9
+static const byte_t* ESC_CARRIAGE               = (const byte_t*)"\r"; // cppcheck-suppress misra-c2012-8.9
+static const byte_t* ESC_TAB                    = (const byte_t*)"\t"; // cppcheck-suppress misra-c2012-8.9
+static const size_t  UNICODE_BASIC_ESCAPE_LEN   = 6U;                  // cppcheck-suppress misra-c2012-8.9
+static const size_t  UNICODE_SURROGATE_PAIR_LEN = 12U;                 // cppcheck-suppress misra-c2012-8.9
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Sets the last error message in a JSON parsing context.
+ *
+ * This function records an error message in the `last_error` buffer of the specified
+ * \ref cardano_json_parse_context_t instance. The message is truncated if it exceeds the
+ * size of the buffer to ensure memory safety.
+ *
+ * \param[in,out] ctx     A pointer to the \ref cardano_json_parse_context_t instance where the error
+ *                        message will be stored. This parameter must not be \c NULL.
+ * \param[in]     error The parsing error code; allocation failures remain sticky.
+ * \param[in]     message A null-terminated string containing the error message. This parameter
+ *                        must not be \c NULL. If the message exceeds the buffer size, it will
+ *                        be truncated to fit.
+ */
+static void
+set_last_error(cardano_json_parse_context_t* ctx, const cardano_error_t error, const char* message)
+{
+  if (ctx->error != CARDANO_ERROR_MEMORY_ALLOCATION_FAILED)
+  {
+    ctx->error = error;
+  }
+
+  cardano_safe_memcpy(ctx->last_error, sizeof(ctx->last_error) - 1U, message, cardano_safe_strlen(message, sizeof(ctx->last_error) - 1U));
+}
+
+/* FUNCTIONS *****************************************************************/
+
+void
+cardano_skip_whitespace(cardano_json_parse_context_t* ctx)
+{
+  while (ctx->offset < ctx->length)
+  {
+    char c = ctx->input[ctx->offset];
+
+    if ((c == ' ') || (c == '\n') || (c == '\r') || (c == '\t'))
+    {
+      ++ctx->offset;
+    }
+    else
+    {
+      break;
+    }
+  }
+}
+
+bool
+cardano_handle_utf8_sequence(cardano_json_parse_context_t* ctx, cardano_buffer_t* buf)
+{
+  byte_t first_byte = (byte_t)ctx->input[ctx->offset];
+  size_t seq_len    = cardano_utf8_sequence_length(first_byte);
+
+  if ((seq_len == 0U) || ((ctx->offset + seq_len) > ctx->length))
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid UTF-8 sequence");
+
+    return false;
+  }
+
+  for (size_t i = 1U; i < seq_len; ++i)
+  {
+    if ((ctx->input[ctx->offset + i] & 0xC0) != 0x80)
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid UTF-8 continuation byte");
+
+      return false;
+    }
+  }
+
+  if ((seq_len > 1U) && ((first_byte < 0xc2U) || (first_byte > 0xf4U)))
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid UTF-8 leading byte");
+    return false;
+  }
+
+  if (seq_len >= 3U)
+  {
+    const byte_t second = (byte_t)ctx->input[ctx->offset + 1U];
+
+    if (((first_byte == 0xe0U) && (second < 0xa0U)) || ((first_byte == 0xedU) && (second >= 0xa0U)) || ((first_byte == 0xf0U) && (second < 0x90U)) || ((first_byte == 0xf4U) && (second >= 0x90U)))
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid UTF-8 codepoint");
+      return false;
+    }
+  }
+
+  cardano_error_t result = cardano_buffer_write(buf, (const byte_t*)&ctx->input[ctx->offset], seq_len);
+  if (result != CARDANO_SUCCESS)
+  {
+    set_last_error(ctx, result, cardano_error_to_string(result));
+
+    return false;
+  }
+
+  ctx->offset += seq_len;
+
+  return true;
+}
+
+bool
+cardano_handle_unicode_sequence(cardano_json_parse_context_t* ctx, cardano_buffer_t* buf)
+{
+  if ((ctx->offset + 4U) > ctx->length)
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Not enough characters for Unicode escape sequence");
+    return false;
+  }
+
+  for (size_t i = 0; i < 4U; ++i)
+  {
+    if (!isxdigit((unsigned char)ctx->input[ctx->offset + i]))
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid character in Unicode escape sequence");
+      return false;
+    }
+  }
+
+  int32_t high = cardano_parse_unicode_escape(&ctx->input[ctx->offset]);
+
+  if (high < 0)
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid Unicode escape sequence");
+    return false;
+  }
+
+  size_t consumed = UNICODE_BASIC_ESCAPE_LEN;
+
+  if ((high >= 0xdc00) && (high <= 0xdfff))
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Unpaired low surrogate");
+    return false;
+  }
+
+  if ((high >= 0xd800) && (high <= 0xdbff))
+  {
+    if (((ctx->offset + 10U) > ctx->length) || ((char)ctx->input[ctx->offset + 4U] != (char)'\\') || ((char)ctx->input[ctx->offset + 5U] != (char)'u'))
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Missing low surrogate");
+      return false;
+    }
+
+    for (size_t i = 6U; i < 10U; ++i)
+    {
+      if (!isxdigit((unsigned char)ctx->input[ctx->offset + i]))
+      {
+        set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid character in second Unicode escape sequence");
+        return false;
+      }
+    }
+
+    int32_t low = cardano_parse_unicode_escape(&ctx->input[ctx->offset + 6U]);
+
+    if ((low >= 0xdc00) && (low <= 0xdfff))
+    {
+      uint32_t masked_high = (uint32_t)high & 0x3ffU;
+      uint32_t masked_low  = (uint32_t)low & 0x3ffU;
+      uint32_t codepoint   = 0x10000U + (masked_high << 10U) + masked_low;
+
+      char   utf8_buf[4]   = { 0 };
+      size_t bytes_written = cardano_encode_utf8((int32_t)codepoint, utf8_buf);
+
+      if (bytes_written == 0U)
+      {
+        set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Failed to encode surrogate pair as UTF-8");
+        return false;
+      }
+
+      cardano_error_t result = cardano_buffer_write(buf, (byte_t*)&utf8_buf[0], bytes_written);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        set_last_error(ctx, result, cardano_error_to_string(result));
+        return false;
+      }
+
+      consumed = UNICODE_SURROGATE_PAIR_LEN;
+    }
+    else
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid surrogate pair in Unicode escape sequence");
+      return false;
+    }
+  }
+  else
+  {
+    char   utf8_buf[4]   = { 0 };
+    size_t bytes_written = cardano_encode_utf8(high, utf8_buf);
+
+    if (bytes_written == 0U)
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Failed to encode Unicode character as UTF-8");
+      return false;
+    }
+
+    cardano_error_t result = cardano_buffer_write(buf, (byte_t*)&utf8_buf[0], bytes_written);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      set_last_error(ctx, result, cardano_error_to_string(result));
+      return false;
+    }
+  }
+
+  ctx->offset += (consumed - 2U);
+  return true;
+}
+
+bool
+cardano_handle_escape_sequence(cardano_json_parse_context_t* ctx, cardano_buffer_t* buf)
+{
+  if (ctx->offset >= ctx->length)
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Unexpected end of input in escape sequence");
+    return false;
+  }
+
+  char e = ctx->input[ctx->offset];
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (e)
+  {
+    case '\"':
+      result = cardano_buffer_write(buf, ESC_QUOTE, 1);
+      break;
+    case '\\':
+      result = cardano_buffer_write(buf, ESC_BACKSLASH, 1);
+      break;
+    case '/':
+      result = cardano_buffer_write(buf, ESC_SLASH, 1);
+      break;
+    case 'b':
+      result = cardano_buffer_write(buf, ESC_BACKSPACE, 1);
+      break;
+    case 'f':
+      result = cardano_buffer_write(buf, ESC_FORMFEED, 1);
+      break;
+    case 'n':
+      result = cardano_buffer_write(buf, ESC_NEWLINE, 1);
+      break;
+    case 'r':
+      result = cardano_buffer_write(buf, ESC_CARRIAGE, 1);
+      break;
+    case 't':
+      result = cardano_buffer_write(buf, ESC_TAB, 1);
+      break;
+    case 'u':
+      ++ctx->offset;
+      if (!cardano_handle_unicode_sequence(ctx, buf))
+      {
+        return false;
+      }
+      return true;
+    default:
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid escape sequence");
+      return false;
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    set_last_error(ctx, result, cardano_error_to_string(result));
+    return false;
+  }
+
+  ++ctx->offset;
+
+  return true;
+}
+
+cardano_json_object_t*
+cardano_parse_string_value(cardano_json_parse_context_t* ctx)
+{
+  cardano_skip_whitespace(ctx);
+
+  if ((ctx->offset >= ctx->length) || ((char)ctx->input[ctx->offset] != (char)'\"'))
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON string start");
+
+    return NULL;
+  }
+
+  ++ctx->offset;
+
+  cardano_buffer_t* buf = cardano_buffer_new(128);
+
+  if (buf == NULL)
+  {
+    set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+
+    return NULL;
+  }
+
+  bool closed = false;
+
+  while (ctx->offset < ctx->length)
+  {
+    char c = ctx->input[ctx->offset];
+
+    if (c == '\"')
+    {
+      ++ctx->offset;
+      closed = true;
+      break;
+    }
+
+    if ((unsigned char)c < 0x20U)
+    {
+      cardano_buffer_unref(&buf);
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Unescaped control character in JSON string");
+      return NULL;
+    }
+
+    if (c == '\\')
+    {
+      ++ctx->offset;
+
+      if (!cardano_handle_escape_sequence(ctx, buf))
+      {
+        cardano_buffer_unref(&buf);
+
+        return NULL;
+      }
+    }
+    else
+    {
+      if (!cardano_handle_utf8_sequence(ctx, buf))
+      {
+        cardano_buffer_unref(&buf);
+
+        return NULL;
+      }
+    }
+  }
+
+  if (!closed)
+  {
+    cardano_buffer_unref(&buf);
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Unterminated JSON string");
+    return NULL;
+  }
+
+  cardano_json_object_t* obj = cardano_json_object_new();
+
+  if (obj == NULL)
+  {
+    cardano_buffer_unref(&buf);
+    set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+
+    return NULL;
+  }
+
+  cardano_error_t result = cardano_buffer_write(buf, (const byte_t*)"\0", 1);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&buf);
+    cardano_json_object_unref(&obj);
+    set_last_error(ctx, result, cardano_error_to_string(result));
+
+    return NULL;
+  }
+
+  obj->type   = CARDANO_JSON_OBJECT_TYPE_STRING;
+  obj->string = buf;
+
+  return obj;
+}
+
+cardano_json_object_t*
+cardano_parse_number_value(cardano_json_parse_context_t* ctx)
+{
+  cardano_skip_whitespace(ctx);
+
+  const size_t start = ctx->offset;
+  size_t       end   = start;
+
+  if ((end < ctx->length) && ((char)ctx->input[end] == (char)'-'))
+  {
+    ++end;
+  }
+
+  if ((end >= ctx->length) || ((char)ctx->input[end] < (char)'0') || ((char)ctx->input[end] > (char)'9'))
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON number");
+    return NULL;
+  }
+
+  if ((char)ctx->input[end] == (char)'0')
+  {
+    ++end;
+  }
+  else
+  {
+    while ((end < ctx->length) && ((char)ctx->input[end] >= (char)'0') && ((char)ctx->input[end] <= (char)'9'))
+    {
+      ++end;
+    }
+  }
+
+  bool is_real = false;
+
+  if ((end < ctx->length) && ((char)ctx->input[end] == (char)'.'))
+  {
+    is_real = true;
+    ++end;
+    const size_t fraction_start = end;
+
+    while ((end < ctx->length) && ((char)ctx->input[end] >= (char)'0') && ((char)ctx->input[end] <= (char)'9'))
+    {
+      ++end;
+    }
+
+    if (end == fraction_start)
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON fraction");
+      return NULL;
+    }
+  }
+
+  if ((end < ctx->length) && (((char)ctx->input[end] == (char)'e') || ((char)ctx->input[end] == (char)'E')))
+  {
+    is_real = true;
+    ++end;
+
+    if ((end < ctx->length) && (((char)ctx->input[end] == (char)'+') || ((char)ctx->input[end] == (char)'-')))
+    {
+      ++end;
+    }
+
+    const size_t exponent_start = end;
+
+    while ((end < ctx->length) && ((char)ctx->input[end] >= (char)'0') && ((char)ctx->input[end] <= (char)'9'))
+    {
+      ++end;
+    }
+
+    if (end == exponent_start)
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON exponent");
+      return NULL;
+    }
+  }
+
+  if ((end < ctx->length) && ((char)ctx->input[end] != (char)',') && ((char)ctx->input[end] != (char)']') && ((char)ctx->input[end] != (char)'}') && ((char)ctx->input[end] != (char)' ') && ((char)ctx->input[end] != (char)'\t') && ((char)ctx->input[end] != (char)'\r') && ((char)ctx->input[end] != (char)'\n'))
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON number delimiter");
+    return NULL;
+  }
+
+  cardano_json_object_t* obj = cardano_json_object_new();
+
+  if (obj == NULL)
+  {
+    set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+    return NULL;
+  }
+
+  obj->type        = CARDANO_JSON_OBJECT_TYPE_NUMBER;
+  obj->is_negative = (char)ctx->input[start] == (char)'-';
+  obj->is_real     = is_real;
+  obj->string      = cardano_buffer_new_from((const byte_t*)&ctx->input[start], end - start);
+
+  if (obj->string == NULL)
+  {
+    cardano_json_object_unref(&obj);
+    set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+    return NULL;
+  }
+
+  cardano_error_t result = cardano_buffer_write(obj->string, (const byte_t*)"\0", 1U);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_json_object_unref(&obj);
+    set_last_error(ctx, result, cardano_error_to_string(result));
+    return NULL;
+  }
+
+  ctx->offset = end;
+
+  return obj;
+}
+
+cardano_json_object_t*
+cardano_parse_object_value(cardano_json_parse_context_t* ctx)
+{
+  if ((ctx->offset >= ctx->length) || ((char)ctx->input[ctx->offset] != (char)'{'))
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON object start");
+
+    return NULL;
+  }
+
+  ++ctx->offset;
+  ++ctx->depth;
+
+  if (ctx->depth >= (size_t)LIB_CARDANO_C_MAX_JSON_DEPTH)
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Maximum object depth exceeded");
+    return NULL;
+  }
+
+  cardano_skip_whitespace(ctx);
+
+  if (ctx->offset >= ctx->length)
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON object start");
+
+    return NULL;
+  }
+
+  cardano_array_t* pairs = cardano_array_new(32);
+
+  if (pairs == NULL)
+  {
+    set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+
+    return NULL;
+  }
+
+  cardano_skip_whitespace(ctx);
+
+  if ((ctx->offset < ctx->length) && ((char)ctx->input[ctx->offset] == (char)'}'))
+  {
+    ++ctx->offset;
+    --ctx->depth;
+
+    cardano_json_object_t* obj = cardano_json_object_new();
+
+    if (obj == NULL)
+    {
+      cardano_array_unref(&pairs);
+      set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+
+      return NULL;
+    }
+
+    obj->type  = CARDANO_JSON_OBJECT_TYPE_OBJECT;
+    obj->pairs = pairs;
+
+    return obj;
+  }
+
+  bool end_of_object = false;
+  while (!end_of_object)
+  {
+    if (ctx->offset >= ctx->length)
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Unexpected end of input");
+      cardano_array_unref(&pairs);
+
+      return NULL;
+    }
+
+    cardano_json_object_t* key = cardano_parse_string_value(ctx);
+
+    if (!key || (key->type != CARDANO_JSON_OBJECT_TYPE_STRING))
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON object key");
+      cardano_json_object_unref(&key);
+      cardano_array_unref(&pairs);
+
+      return NULL;
+    }
+
+    cardano_skip_whitespace(ctx);
+
+    if ((ctx->offset >= ctx->length) || ((char)ctx->input[ctx->offset] != (char)':'))
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON object key-value separator");
+      cardano_json_object_unref(&key);
+      cardano_array_unref(&pairs);
+
+      return NULL;
+    }
+
+    ++ctx->offset;
+
+    if (ctx->depth >= (size_t)LIB_CARDANO_C_MAX_JSON_DEPTH)
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Maximum object depth exceeded");
+      cardano_json_object_unref(&key);
+      cardano_array_unref(&pairs);
+
+      return NULL;
+    }
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: We need to use recursion to parse nested objects.
+    cardano_json_object_t* val = cardano_parse_value(ctx);
+
+    if (!val)
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON object value");
+      cardano_json_object_unref(&key);
+      cardano_array_unref(&pairs);
+
+      return NULL;
+    }
+
+    cardano_json_kvp_t* kvp = cardano_json_kvp_new();
+
+    if (kvp == NULL)
+    {
+      cardano_json_object_unref(&key);
+      cardano_json_object_unref(&val);
+      cardano_array_unref(&pairs);
+
+      set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+
+      return NULL;
+    }
+
+    cardano_buffer_ref(key->string);
+
+    kvp->key = key->string;
+
+    cardano_json_object_unref(&key);
+
+    kvp->value = val;
+
+    const size_t old_size = cardano_array_get_size(pairs);
+    const size_t new_size = cardano_array_push(pairs, (cardano_object_t*)((void*)kvp));
+
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+    if (new_size != (old_size + 1U))
+    {
+      cardano_array_unref(&pairs);
+
+      set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+
+      return NULL;
+    }
+
+    cardano_skip_whitespace(ctx);
+
+    if ((ctx->offset < ctx->length) && ((char)ctx->input[ctx->offset] == (char)','))
+    {
+      ++ctx->offset;
+      cardano_skip_whitespace(ctx);
+
+      continue;
+    }
+    else if ((ctx->offset < ctx->length) && ((char)ctx->input[ctx->offset] == (char)'}'))
+    {
+      ++ctx->offset;
+      --ctx->depth;
+
+      end_of_object = true;
+      continue;
+    }
+    else
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Expected ',' or '}'");
+      cardano_array_unref(&pairs);
+
+      return NULL;
+    }
+  }
+
+  cardano_json_object_t* obj = cardano_json_object_new();
+
+  if (obj == NULL)
+  {
+    cardano_array_unref(&pairs);
+    set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+
+    return NULL;
+  }
+
+  obj->type  = CARDANO_JSON_OBJECT_TYPE_OBJECT;
+  obj->pairs = pairs;
+
+  return obj;
+}
+
+cardano_json_object_t*
+cardano_parse_array_value(cardano_json_parse_context_t* ctx)
+{
+  cardano_skip_whitespace(ctx);
+
+  if ((ctx->offset >= ctx->length) || ((char)ctx->input[ctx->offset] != (char)'['))
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON array start");
+
+    return NULL;
+  }
+
+  ++ctx->depth;
+  ++ctx->offset;
+
+  if (ctx->depth >= (size_t)LIB_CARDANO_C_MAX_JSON_DEPTH)
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Maximum object depth exceeded");
+
+    return NULL;
+  }
+
+  cardano_array_t* arr = cardano_array_new(32);
+
+  if (arr == NULL)
+  {
+    set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+
+    return NULL;
+  }
+
+  cardano_skip_whitespace(ctx);
+
+  if ((ctx->offset < ctx->length) && ((char)ctx->input[ctx->offset] == (char)']'))
+  {
+    ctx->offset++;
+    --ctx->depth;
+    cardano_json_object_t* obj = cardano_json_object_new();
+
+    if (obj == NULL)
+    {
+      cardano_array_unref(&arr);
+      set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+
+      return NULL;
+    }
+
+    obj->type  = CARDANO_JSON_OBJECT_TYPE_ARRAY;
+    obj->array = arr;
+
+    return obj;
+  }
+
+  bool end_of_array = false;
+  while (!end_of_array)
+  {
+    if (ctx->offset >= ctx->length)
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Unexpected end of input");
+      cardano_array_unref(&arr);
+
+      return NULL;
+    }
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: We need to use recursion to parse nested objects.
+    cardano_json_object_t* val = cardano_parse_value(ctx);
+
+    if (!val)
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Invalid JSON array value");
+      cardano_array_unref(&arr);
+
+      return NULL;
+    }
+
+    const size_t old_size = cardano_array_get_size(arr);
+    const size_t new_size = cardano_array_push(arr, ((cardano_object_t*)(void*)val));
+
+    cardano_json_object_unref(&val);
+
+    if (new_size != (old_size + 1U))
+    {
+      cardano_array_unref(&arr);
+
+      set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+
+      return NULL;
+    }
+
+    cardano_skip_whitespace(ctx);
+
+    if ((ctx->offset < ctx->length) && ((char)ctx->input[ctx->offset] == (char)','))
+    {
+      ++ctx->offset;
+      cardano_skip_whitespace(ctx);
+
+      continue;
+    }
+    else if ((ctx->offset < ctx->length) && ((char)ctx->input[ctx->offset] == (char)']'))
+    {
+      ++ctx->offset;
+      --ctx->depth;
+
+      end_of_array = true;
+      continue;
+    }
+    else
+    {
+      set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Expected ',' or ']'");
+      cardano_array_unref(&arr);
+
+      return NULL;
+    }
+  }
+
+  cardano_json_object_t* obj = cardano_json_object_new();
+
+  if (obj == NULL)
+  {
+    cardano_array_unref(&arr);
+    set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+
+    return NULL;
+  }
+
+  obj->type  = CARDANO_JSON_OBJECT_TYPE_ARRAY;
+  obj->array = arr;
+
+  return obj;
+}
+
+cardano_json_object_t*
+cardano_parse_literal(
+  cardano_json_parse_context_t*    ctx,
+  const char*                      literal,
+  const size_t                     literal_size,
+  const cardano_json_object_type_t type)
+{
+  if (((ctx->offset + literal_size) <= ctx->length) && (strncmp(&ctx->input[ctx->offset], literal, literal_size) == 0))
+  {
+    ctx->offset                += literal_size;
+    cardano_json_object_t* obj = cardano_json_object_new();
+
+    if (obj == NULL)
+    {
+      set_last_error(ctx, CARDANO_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
+      return NULL;
+    }
+
+    obj->type = type;
+
+    if (type == CARDANO_JSON_OBJECT_TYPE_BOOLEAN)
+    {
+      obj->bool_value = (strcmp(literal, "true") == 0);
+    }
+
+    return obj;
+  }
+
+  return NULL;
+}
+
+cardano_json_object_t*
+cardano_parse_value(cardano_json_parse_context_t* ctx)
+{
+  cardano_skip_whitespace(ctx);
+
+  if (ctx->offset >= ctx->length)
+  {
+    set_last_error(ctx, CARDANO_ERROR_INVALID_JSON, "Unexpected end of input");
+    return NULL;
+  }
+
+  char c = ctx->input[ctx->offset];
+
+  if (c == '{')
+  {
+    // cppcheck-suppress misra-c2012-17.2; Reason: We need to use recursion to parse nested objects.
+    return cardano_parse_object_value(ctx);
+  }
+
+  if (c == '[')
+  {
+    // cppcheck-suppress misra-c2012-17.2; Reason: We need to use recursion to parse nested objects.
+    return cardano_parse_array_value(ctx);
+  }
+
+  if (c == '\"')
+  {
+    return cardano_parse_string_value(ctx);
+  }
+
+  if (c == 't')
+  {
+    return cardano_parse_literal(ctx, "true", 4, CARDANO_JSON_OBJECT_TYPE_BOOLEAN);
+  }
+
+  if (c == 'f')
+  {
+    return cardano_parse_literal(ctx, "false", 5, CARDANO_JSON_OBJECT_TYPE_BOOLEAN);
+  }
+
+  if (c == 'n')
+  {
+    return cardano_parse_literal(ctx, "null", 4, CARDANO_JSON_OBJECT_TYPE_NULL);
+  }
+
+  if ((c == '-') || ((c >= '0') && (c <= '9')))
+  {
+    return cardano_parse_number_value(ctx);
+  }
+
+  return NULL;
+}
diff --git a/vendor/src/json/internals/json_parser.h b/vendor/src/json/internals/json_parser.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/internals/json_parser.h
@@ -0,0 +1,221 @@
+/**
+ * \file json_parser.h
+ *
+ * \author angel.castillo
+ * \date   Nov 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_JSON_PARSER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_JSON_PARSER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/json/json_object.h>
+#include <cardano/typedefs.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents the state and context of a JSON parsing operation.
+ *
+ * This structure is used internally to manage the state during JSON parsing operations.
+ * It keeps track of the input data, current parsing position, nesting depth, and any
+ * encountered errors.
+ */
+typedef struct
+{
+    const char*     input;           /**< The input JSON string to be parsed. */
+    size_t          length;          /**< The total length of the input JSON string, in bytes. */
+    size_t          offset;          /**< The current position within the input JSON string. */
+    size_t          depth;           /**< The current depth of the JSON structure being parsed. */
+    cardano_error_t error;           /**< Allocation error classification for checked parsing. */
+    char            last_error[256]; /**< Buffer for storing the last error message encountered. */
+} cardano_json_parse_context_t;
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Skips over any whitespace characters in the JSON input.
+ *
+ * This function advances the parsing position (`offset`) in the JSON input
+ * until a non-whitespace character is encountered or the end of the input is reached.
+ *
+ * \param[in,out] ctx A pointer to the \ref cardano_json_parse_context_t structure
+ *                    representing the current parsing context. This parameter must not
+ *                    be NULL.
+ */
+void
+cardano_skip_whitespace(cardano_json_parse_context_t* ctx);
+
+/**
+ * \brief Processes a UTF-8 sequence from the JSON input and writes it to a buffer.
+ *
+ * This function validates and processes a UTF-8 sequence starting at the current offset
+ * in the JSON parse context. If the sequence is valid, it is written to the specified
+ * buffer. If the sequence is invalid, the function records an error and returns `false`.
+ *
+ * \param[in,out] ctx A pointer to the JSON parse context. This must not be NULL.
+ *                    The context's offset is advanced by the length of the processed UTF-8 sequence.
+ * \param[out] buf A pointer to the buffer where the processed UTF-8 sequence is written. This must not be NULL.
+ *
+ * \return `true` if the UTF-8 sequence was successfully processed and written to the buffer, `false` otherwise.
+ */
+bool
+cardano_handle_utf8_sequence(cardano_json_parse_context_t* ctx, cardano_buffer_t* buf);
+
+/**
+ * \brief Processes a Unicode escape sequence from the JSON input and writes it to a buffer.
+ *
+ * This function validates and processes a Unicode escape sequence (e.g., `\uXXXX`) starting
+ * at the current offset in the JSON parse context. If the sequence is valid, it converts the
+ * Unicode code point to its UTF-8 representation and writes it to the specified buffer.
+ * Surrogate pairs are handled for sequences representing characters outside the Basic Multilingual Plane (BMP).
+ *
+ * \param[in,out] ctx A pointer to the JSON parse context. This must not be NULL.
+ *                    The context's offset is advanced by the length of the processed Unicode escape sequence.
+ * \param[out] buf A pointer to the buffer where the UTF-8 encoded representation of the Unicode code point is written.
+ *                 This must not be NULL.
+ *
+ * \return `true` if the Unicode escape sequence was successfully processed and written to the buffer, `false` otherwise.
+ */
+bool
+cardano_handle_unicode_sequence(cardano_json_parse_context_t* ctx, cardano_buffer_t* buf);
+
+/**
+ * \brief Processes a JSON escape sequence and writes the corresponding character to a buffer.
+ *
+ * This function validates and processes a JSON escape sequence starting at the current offset
+ * in the parse context. It converts the escape sequence to its corresponding character or
+ * sequence of characters (e.g., Unicode or control characters) and writes it to the specified buffer.
+ *
+ * \param[in,out] ctx A pointer to the JSON parse context. This must not be NULL.
+ *                    The context's offset is advanced by the length of the processed escape sequence.
+ * \param[out] buf A pointer to the buffer where the decoded character(s) are written. This must not be NULL.
+ *
+ * \return `true` if the escape sequence was successfully processed and written to the buffer, `false` otherwise.
+ */
+bool
+cardano_handle_escape_sequence(cardano_json_parse_context_t* ctx, cardano_buffer_t* buf);
+
+/**
+ * \brief Parses a JSON string value from the input context.
+ *
+ * This function reads a JSON string value from the input provided in the parse context.
+ * It handles escape sequences, Unicode sequences, and validates the format of the string.
+ * The parsed value is returned as a \ref cardano_json_object_t of type `CARDANO_JSON_OBJECT_TYPE_STRING`.
+ *
+ * \param[in,out] ctx A pointer to the JSON parse context. This must not be NULL.
+ *                    The context's offset is advanced as the string is processed.
+ *
+ * \return A pointer to a \ref cardano_json_object_t representing the parsed string,
+ *         or `NULL` if parsing fails. The caller is responsible for releasing the returned object
+ *         using \ref cardano_json_object_unref.
+ */
+cardano_json_object_t*
+cardano_parse_string_value(cardano_json_parse_context_t* ctx);
+
+/**
+ * \brief Parses a JSON number value from the input context.
+ *
+ * This function reads a JSON number from the input provided in the parse context.
+ * It validates the format of the number and stores it as a \ref cardano_json_object_t
+ * with the appropriate numeric type (integer, unsigned integer, or real number).
+ *
+ * \param[in,out] ctx A pointer to the JSON parse context. This must not be NULL.
+ *                    The context's offset is advanced as the number is processed.
+ *
+ * \return A pointer to a \ref cardano_json_object_t representing the parsed number,
+ *         or `NULL` if parsing fails. The caller is responsible for releasing the returned object
+ *         using \ref cardano_json_object_unref.
+ */
+cardano_json_object_t*
+cardano_parse_number_value(cardano_json_parse_context_t* ctx);
+
+/**
+ * \brief Parses a JSON object from the input context.
+ *
+ * This function reads and parses a JSON object from the input provided in the parse context.
+ * It validates the object structure, including keys and values, and constructs a corresponding
+ * \ref cardano_json_object_t representation.
+ *
+ * \param[in,out] ctx A pointer to the JSON parse context. This must not be NULL.
+ *                    The context's offset is advanced as the object is parsed.
+ *
+ * \return A pointer to a \ref cardano_json_object_t representing the parsed object,
+ *         or `NULL` if parsing fails. The caller is responsible for releasing the returned object
+ *         using \ref cardano_json_object_unref.
+ */
+cardano_json_object_t*
+cardano_parse_object_value(cardano_json_parse_context_t* ctx);
+
+/**
+ * \brief Parses a JSON array from the input context.
+ *
+ * This function reads and parses a JSON array from the input provided in the parse context.
+ * It validates the array structure and constructs a corresponding \ref cardano_json_object_t representation.
+ *
+ * \param[in,out] ctx A pointer to the JSON parse context. This must not be NULL.
+ *                    The context's offset is advanced as the array is parsed.
+ *
+ * \return A pointer to a \ref cardano_json_object_t representing the parsed array,
+ *         or `NULL` if parsing fails. The caller is responsible for releasing the returned object
+ *         using \ref cardano_json_object_unref.
+ */
+cardano_json_object_t*
+cardano_parse_array_value(cardano_json_parse_context_t* ctx);
+
+/**
+ * \brief Parses a specific JSON literal (e.g., `true`, `false`, `null`) from the input context.
+ *
+ * This function validates and parses a specific JSON literal from the input provided in the parse context.
+ * It creates a corresponding \ref cardano_json_object_t with the specified type.
+ *
+ * \param[in,out] ctx A pointer to the JSON parse context. This must not be NULL.
+ *                    The context's offset is advanced as the literal is parsed.
+ * \param[in] literal A pointer to the expected literal string (e.g., `"true"`, `"false"`, or `"null"`).
+ *                    This must not be NULL and must point to a valid, null-terminated string.
+ * \param[in] literal_size The length of the expected literal string, in bytes.
+ * \param[in] type The \ref cardano_json_object_type_t representing the type of the literal
+ *                 (e.g., `CARDANO_JSON_OBJECT_TYPE_BOOLEAN` for `true` or `false`,
+ *                 `CARDANO_JSON_OBJECT_TYPE_NULL` for `null`).
+ *
+ * \return A pointer to a \ref cardano_json_object_t representing the parsed literal, or `NULL` if parsing fails.
+ *         The caller is responsible for releasing the returned object using \ref cardano_json_object_unref.
+ */
+cardano_json_object_t*
+cardano_parse_literal(
+  cardano_json_parse_context_t* ctx,
+  const char*                   literal,
+  size_t                        literal_size,
+  cardano_json_object_type_t    type);
+
+/**
+ * \brief Parses a JSON value from the input context.
+ *
+ * This function identifies and parses a JSON value (e.g., object, array, string, number, boolean, or null)
+ * from the input context. It creates and returns a corresponding \ref cardano_json_object_t.
+ *
+ * \param[in,out] ctx A pointer to the JSON parse context. This must not be NULL.
+ *                    The context's offset is advanced as the value is parsed.
+ *
+ * \return A pointer to a \ref cardano_json_object_t representing the parsed JSON value, or `NULL` if parsing fails.
+ *         The caller is responsible for releasing the returned object using \ref cardano_json_object_unref.
+ */
+cardano_json_object_t*
+cardano_parse_value(cardano_json_parse_context_t* ctx);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_JSON_PARSER_H
diff --git a/vendor/src/json/internals/json_writer_common.c b/vendor/src/json/internals/json_writer_common.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/internals/json_writer_common.c
@@ -0,0 +1,47 @@
+/**
+ * \file json_writer_common.c
+ *
+ * \author angel.castillo
+ * \date   Dec 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "json_writer_common.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* FUNCTIONS *****************************************************************/
+
+void
+cardano_json_writer_set_message_if_error(
+  cardano_json_writer_t* writer,
+  const cardano_error_t  error,
+  const char*            message)
+{
+  assert(writer != NULL);
+  assert(message != NULL);
+
+  if ((writer->last_error != CARDANO_SUCCESS) || (error == CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  writer->last_error = error;
+  cardano_object_set_last_error(&writer->base, message);
+}
diff --git a/vendor/src/json/internals/json_writer_common.h b/vendor/src/json/internals/json_writer_common.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/internals/json_writer_common.h
@@ -0,0 +1,90 @@
+/**
+ * \file json_writer_common.h
+ *
+ * \author angel.castillo
+ * \date   Nov 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_JSON_WRITER_COMMON_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_JSON_WRITER_COMMON_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../../collections/array.h"
+#include <cardano/buffer.h>
+#include <cardano/json/json_context.h>
+#include <cardano/json/json_format.h>
+#include <cardano/json/json_object_type.h>
+#include <cardano/object.h>
+#include <cardano/typedefs.h>
+
+#include "../../config.h"
+
+/* CONSTANTS *****************************************************************/
+
+static const byte_t* QUOTES       = (const byte_t*)"\"";    // cppcheck-suppress misra-c2012-8.9
+static const byte_t* COLON        = (const byte_t*)":";     // cppcheck-suppress misra-c2012-8.9
+static const byte_t* COMMA        = (const byte_t*)",";     // cppcheck-suppress misra-c2012-8.9
+static const byte_t* OPEN_ARRAY   = (const byte_t*)"[";     // cppcheck-suppress misra-c2012-8.9
+static const byte_t* CLOSE_ARRAY  = (const byte_t*)"]";     // cppcheck-suppress misra-c2012-8.9
+static const byte_t* OPEN_OBJECT  = (const byte_t*)"{";     // cppcheck-suppress misra-c2012-8.9
+static const byte_t* CLOSE_OBJECT = (const byte_t*)"}";     // cppcheck-suppress misra-c2012-8.9
+static const byte_t* TRUE         = (const byte_t*)"true";  // cppcheck-suppress misra-c2012-8.9
+static const byte_t* FALSE        = (const byte_t*)"false"; // cppcheck-suppress misra-c2012-8.9
+static const byte_t* NULL_VALUE   = (const byte_t*)"null";  // cppcheck-suppress misra-c2012-8.9
+static const byte_t* NEW_LINE     = (const byte_t*)"\n";    // cppcheck-suppress misra-c2012-8.9
+static const byte_t* SPACE        = (const byte_t*)" ";     // cppcheck-suppress misra-c2012-8.9
+static const byte_t* ESCAPE       = (const byte_t*)"\\";    // cppcheck-suppress misra-c2012-8.9
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Structure to represent the current state of a JSON context.
+ */
+typedef struct
+{
+    cardano_json_context_t context;      /**< Current context (object, array, root). */
+    size_t                 item_count;   /**< Number of items (properties or elements) in the current context. */
+    bool                   expect_value; /**< Indicates whether the next write operation should expect a value. */
+} cardano_json_stack_frame_t;
+
+/**
+ * \brief Provides a API for forward-only, non-cached writing of UTF-8 encoded JSON text.
+ */
+typedef struct cardano_json_writer_t
+{
+    cardano_object_t           base;
+    cardano_buffer_t*          buffer;
+    cardano_error_t            last_error;
+    size_t                     depth;
+    cardano_json_format_t      format;
+    cardano_json_stack_frame_t current_frame[LIB_CARDANO_C_MAX_JSON_DEPTH];
+} cardano_json_writer_t;
+
+/* FUNCTIONS *****************************************************************/
+
+/**
+ * \brief Sets the last error message if an error occurred.
+ *
+ * \param writer The JSON writer instance.
+ * \param error The error code.
+ * \param message The error message.
+ */
+void
+cardano_json_writer_set_message_if_error(cardano_json_writer_t* writer, cardano_error_t error, const char* message);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_JSON_WRITER_COMMON_H
diff --git a/vendor/src/json/internals/utf8.c b/vendor/src/json/internals/utf8.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/internals/utf8.c
@@ -0,0 +1,200 @@
+/**
+ * \file utf8.c
+ *
+ * \author angel.castillo
+ * \date   Dec 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "utf8.h"
+#include <cardano/typedefs.h>
+#include <string.h>
+
+/* FUNCTIONS *****************************************************************/
+
+size_t
+cardano_utf8_sequence_length(const byte_t first_byte)
+{
+  if (first_byte <= 0x7fU)
+  {
+    return 1U;
+  }
+
+  else if ((first_byte & 0xe0U) == 0xc0U)
+  {
+    return 2U;
+  }
+
+  else if ((first_byte & 0xf0U) == 0xe0U)
+  {
+    return 3U;
+  }
+
+  else if ((first_byte & 0xf8U) == 0xf0U)
+  {
+    return 4U;
+  }
+  else
+  {
+    return 0U;
+  }
+}
+
+int32_t
+cardano_parse_hex_digit(const char c)
+{
+  if ((c >= '0') && (c <= '9'))
+  {
+    return c - '0';
+  }
+  if ((c >= 'A') && (c <= 'F'))
+  {
+    return c - 'A' + 10;
+  }
+  if ((c >= 'a') && (c <= 'f'))
+  {
+    return c - 'a' + 10;
+  }
+
+  return -1;
+}
+
+int32_t
+cardano_parse_unicode_escape(const char* str)
+{
+  int32_t codepoint = 0;
+
+  for (size_t i = 0U; i < 4U; ++i)
+  {
+    int32_t d = cardano_parse_hex_digit(str[i]);
+
+    if (d < 0)
+    {
+      return -1;
+    }
+
+    uint32_t shifted_codepoint = (uint32_t)codepoint << 4U;
+    uint32_t result            = shifted_codepoint | (uint32_t)d;
+
+    codepoint = (int32_t)result;
+  }
+
+  return codepoint;
+}
+
+size_t
+cardano_encode_utf8(const int32_t codepoint, char* out)
+{
+  if (codepoint <= 0x7f)
+  {
+    out[0] = (char)codepoint;
+
+    return 1;
+  }
+  else if (codepoint <= 0x7ff)
+  {
+    uint32_t shifted_codepoint = (uint32_t)codepoint;
+
+    uint32_t part1 = 0xc0u | (shifted_codepoint >> 6U);
+    uint32_t part2 = 0x80u | (shifted_codepoint & 0x3fu);
+
+    out[0] = (char)part1;
+    out[1] = (char)part2;
+
+    return 2;
+  }
+  else if (codepoint <= 0xffff)
+  {
+    uint32_t shifted_codepoint = (uint32_t)codepoint;
+
+    uint32_t part1 = 0xE0U | ((shifted_codepoint >> 12U) & 0x0FU);
+    uint32_t part2 = 0x80U | ((shifted_codepoint >> 6U) & 0x3FU);
+    uint32_t part3 = 0x80U | (shifted_codepoint & 0x3FU);
+
+    out[0] = (char)part1;
+    out[1] = (char)part2;
+    out[2] = (char)part3;
+
+    return 3;
+  }
+  else if (codepoint <= 0x10ffff)
+  {
+    uint32_t shifted_codepoint = (uint32_t)codepoint;
+
+    uint32_t part1 = 0xF0U | (shifted_codepoint >> 18U);
+    uint32_t part2 = 0x80U | ((shifted_codepoint >> 12U) & 0x3FU);
+    uint32_t part3 = 0x80U | ((shifted_codepoint >> 6U) & 0x3FU);
+    uint32_t part4 = 0x80U | (shifted_codepoint & 0x3FU);
+
+    out[0] = (char)part1;
+    out[1] = (char)part2;
+    out[2] = (char)part3;
+    out[3] = (char)part4;
+
+    return 4;
+  }
+  else
+  {
+    return 0;
+  }
+}
+
+size_t
+cardano_decode_unicode_sequence(const char* str, const size_t len, char* out)
+{
+  if (len < 6U)
+  {
+    return 0U;
+  }
+
+  int32_t high = cardano_parse_unicode_escape(&str[2]);
+
+  if (high < 0)
+  {
+    return 0U;
+  }
+
+  if ((high >= 0xd800) && (high <= 0xdbff))
+  {
+    if ((len < 12U) || (str[6] != '\\') || (str[7] != 'u'))
+    {
+      return 0U;
+    }
+
+    int32_t low = cardano_parse_unicode_escape(&str[8]);
+    if ((low < 0xdc00) || (low > 0xdfff))
+    {
+      return 0U;
+    }
+
+    uint32_t masked_high = (uint32_t)high & 0x3ffu;
+    uint32_t masked_low  = (uint32_t)low & 0x3ffu;
+    uint32_t high_bits   = masked_high << 10u;
+    uint32_t codepoint   = 0x10000u + high_bits + masked_low;
+
+    return cardano_encode_utf8((int32_t)codepoint, out);
+  }
+  else if ((high >= 0xdc00) && (high <= 0xdfff))
+  {
+    return 0U;
+  }
+  else
+  {
+    return cardano_encode_utf8(high, out);
+  }
+}
diff --git a/vendor/src/json/internals/utf8.h b/vendor/src/json/internals/utf8.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/internals/utf8.h
@@ -0,0 +1,108 @@
+/**
+ * \file utf8.h
+ *
+ * \author angel.castillo
+ * \date   Nov 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UTF8_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UTF8_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Determines the length of a UTF-8 encoded character based on its first byte.
+ *
+ * This function analyzes the first byte of a UTF-8 sequence and returns the
+ * total number of bytes required to encode the character. It supports 1-byte
+ * (ASCII), 2-byte, 3-byte, and 4-byte UTF-8 sequences.
+ *
+ * \param[in] first_byte The first byte of a UTF-8 encoded character.
+ *
+ * \return The length of the UTF-8 sequence:
+ * - `1` for a 1-byte sequence (ASCII characters).
+ * - `2` for a 2-byte sequence.
+ * - `3` for a 3-byte sequence.
+ * - `4` for a 4-byte sequence.
+ * - `0` if the byte does not match a valid UTF-8 sequence start byte.
+ */
+size_t
+cardano_utf8_sequence_length(byte_t first_byte);
+
+/**
+ * \brief Parses a single hexadecimal character and returns its integer value.
+ *
+ * \param[in] c The character to parse.
+ *
+ * \return
+ * - The integer value of the hexadecimal character (0-15) if valid.
+ * - -1 if the character is not a valid hexadecimal digit.
+ */
+int32_t
+cardano_parse_hex_digit(char c);
+
+/**
+ * \brief Parses a Unicode escape sequence and returns its corresponding Unicode code point.
+ *
+ * This function interprets a Unicode escape sequence in the form of `\uXXXX`, where `XXXX`
+ * represents four hexadecimal digits, and converts it into a Unicode code point.
+ *
+ * \param[in] str A pointer to a 4-character string containing the hexadecimal digits of the Unicode escape sequence (e.g., "0041" for '\\u0041').
+ *
+ * \return The integer value of the Unicode code point represented by the escape sequence.
+ *         Returns -1 if the input contains invalid hexadecimal characters.
+ *
+ * \note This function assumes the input string contains exactly 4 characters representing a valid Unicode escape sequence.
+ *       It does not validate the resulting code point against Unicode ranges.
+ */
+int32_t
+cardano_parse_unicode_escape(const char* str);
+
+/**
+ * \brief Encodes a Unicode code point into its UTF-8 representation.
+ *
+ * This function converts a Unicode code point into a UTF-8 encoded sequence and writes it to the provided buffer.
+ * The function supports encoding for code points in the valid Unicode range (U+0000 to U+10FFFF).
+ *
+ * \param[in] codepoint The Unicode code point to encode.
+ * \param[out] out A pointer to the character buffer where the UTF-8 encoded bytes will be stored.
+ *                 The buffer must be large enough to accommodate up to 4 bytes.
+ *
+ * \return The number of bytes written to the buffer.
+ *         Returns 0 if the codepoint is invalid or outside the range of valid Unicode code points.
+ */
+size_t
+cardano_encode_utf8(int32_t codepoint, char* out);
+
+/**
+ * \brief Decodes a Unicode escape sequence (e.g., `\uXXXX` or a surrogate pair `\uXXXX\uXXXX`) into UTF-8.
+ *
+ * \param[in] str A pointer to the input string containing the Unicode escape sequence.
+ *                The sequence should start with `\u` and be at least 6 characters long.
+ * \param[in] len The length of the input string. It must be at least 6 for a single Unicode escape and at least 12 for a surrogate pair.
+ * \param[out] out A buffer to store the resulting UTF-8-encoded character. The buffer must have enough space to hold up to 4 bytes.
+ *
+ * \return The number of bytes written to the `out` buffer. Returns 0 if decoding fails due to invalid input or insufficient length.
+ */
+size_t
+cardano_decode_unicode_sequence(const char* str, size_t len, char* out);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_UTF8_H
diff --git a/vendor/src/json/json_object.c b/vendor/src/json/json_object.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/json_object.c
@@ -0,0 +1,612 @@
+/**
+ * \file json_object.c
+ *
+ * \author angel.castillo
+ * \date   Dec 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/json/json_object.h>
+#include <cardano/json/json_object_type.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+
+#include <string.h>
+
+#include "../collections/array.h"
+#include "../string_safe.h"
+#include "./internals/json_object_common.h"
+#include "./internals/json_parser.h"
+
+/* DECLARATIONS **************************************************************/
+
+cardano_json_object_t*
+cardano_json_object_parse(const char* json, const size_t size)
+{
+  cardano_json_object_t* result = NULL;
+  cardano_error_t        error  = cardano_json_object_parse_ex(json, size, &result);
+
+  CARDANO_UNUSED(error);
+
+  return result;
+}
+
+cardano_error_t
+cardano_json_object_parse_ex(const char* json, const size_t size, cardano_json_object_t** result)
+{
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *result = NULL;
+
+  if (json == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_json_parse_context_t ctx = { 0 };
+
+  ctx.input  = json;
+  ctx.length = size;
+  ctx.error  = CARDANO_ERROR_INVALID_JSON;
+
+  cardano_json_object_t* root = cardano_parse_value(&ctx);
+
+  if (root == NULL)
+  {
+    return ctx.error;
+  }
+
+  cardano_skip_whitespace(&ctx);
+
+  if (ctx.offset < ctx.length)
+  {
+    cardano_json_object_unref(&root);
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  *result = root;
+
+  return CARDANO_SUCCESS;
+}
+
+const char*
+cardano_json_object_to_json_string(
+  cardano_json_object_t*      json_object,
+  const cardano_json_format_t format,
+  size_t*                     length)
+{
+  if (json_object == NULL)
+  {
+    return NULL;
+  }
+
+  if ((json_object->json_string != NULL) && (json_object->json_format == format))
+  {
+    if (length != NULL)
+    {
+      *length = json_object->json_string_length;
+    }
+
+    return json_object->json_string;
+  }
+
+  cardano_json_writer_t* writer = cardano_json_writer_new(format);
+
+  if (writer == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_json_writer_write_object(writer, json_object);
+
+  const size_t encoded_size = cardano_json_writer_get_encoded_size(writer);
+
+  if (encoded_size == 0U)
+  {
+    cardano_json_writer_unref(&writer);
+    return NULL;
+  }
+
+  char* buffer = _cardano_malloc(encoded_size);
+  if (buffer == NULL)
+  {
+    cardano_json_writer_unref(&writer);
+    return NULL;
+  }
+
+  CARDANO_UNUSED(memset(buffer, 0, encoded_size));
+
+  cardano_error_t result = cardano_json_writer_encode(writer, buffer, encoded_size);
+
+  cardano_json_writer_unref(&writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(buffer);
+
+    return NULL;
+  }
+
+  _cardano_free(json_object->json_string);
+  json_object->json_format        = format;
+  json_object->json_string        = buffer;
+  json_object->json_string_length = encoded_size;
+
+  if (length != NULL)
+  {
+    *length = encoded_size;
+  }
+
+  return buffer;
+}
+
+cardano_json_object_type_t
+cardano_json_object_get_type(
+  const cardano_json_object_t* json_object)
+{
+  if (json_object == NULL)
+  {
+    return CARDANO_JSON_OBJECT_TYPE_NULL;
+  }
+
+  return json_object->type;
+}
+
+bool
+cardano_json_object_has_property(
+  const cardano_json_object_t* json_object,
+  const char*                  key,
+  const size_t                 size)
+{
+  if ((json_object == NULL) || (key == NULL))
+  {
+    return false;
+  }
+
+  if (json_object->type != CARDANO_JSON_OBJECT_TYPE_OBJECT)
+  {
+    return false;
+  }
+
+  for (size_t i = 0U; i < cardano_array_get_size(json_object->pairs); ++i)
+  {
+    cardano_json_kvp_t* kvp = (cardano_json_kvp_t*)((void*)cardano_array_get(json_object->pairs, i));
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+    const size_t key_size = cardano_buffer_get_size(kvp->key) - 1U;
+
+    if (key_size != size)
+    {
+      continue;
+    }
+
+    if (memcmp(cardano_buffer_get_data(kvp->key), key, key_size) == 0)
+    {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+size_t
+cardano_json_object_get_property_count(
+  const cardano_json_object_t* json_object)
+{
+  if ((json_object == NULL) || (json_object->type != CARDANO_JSON_OBJECT_TYPE_OBJECT))
+  {
+    return 0U;
+  }
+
+  return cardano_array_get_size(json_object->pairs);
+}
+
+const char*
+cardano_json_object_get_key_at(
+  const cardano_json_object_t* json_object,
+  const size_t                 index,
+  size_t*                      key_length)
+{
+  if ((json_object == NULL) || (json_object->type != CARDANO_JSON_OBJECT_TYPE_OBJECT))
+  {
+    return NULL;
+  }
+
+  if (index >= cardano_array_get_size(json_object->pairs))
+  {
+    return NULL;
+  }
+
+  cardano_json_kvp_t* kvp = (cardano_json_kvp_t*)((void*)cardano_array_get(json_object->pairs, index));
+  cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+  if (key_length != NULL)
+  {
+    *key_length = cardano_buffer_get_size(kvp->key) - 1U;
+  }
+
+  return (const char*)((const void*)cardano_buffer_get_data(kvp->key));
+}
+
+cardano_json_object_t*
+cardano_json_object_get_value_at(
+  const cardano_json_object_t* json_object,
+  const size_t                 index)
+{
+  if ((json_object == NULL) || (json_object->type != CARDANO_JSON_OBJECT_TYPE_OBJECT))
+  {
+    return NULL;
+  }
+
+  if (index >= cardano_array_get_size(json_object->pairs))
+  {
+    return NULL;
+  }
+
+  cardano_json_kvp_t* kvp = (cardano_json_kvp_t*)((void*)cardano_array_get(json_object->pairs, index));
+  cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+  cardano_object_ref((cardano_object_t*)((void*)kvp->value));
+
+  return kvp->value;
+}
+
+cardano_json_object_t*
+cardano_json_object_get_value_at_ex(
+  const cardano_json_object_t* json_object,
+  const size_t                 index)
+{
+  cardano_json_object_t* value = cardano_json_object_get_value_at(json_object, index);
+  cardano_json_object_unref(&value);
+
+  return value;
+}
+
+bool
+cardano_json_object_get(
+  const cardano_json_object_t* json_object,
+  const char*                  key,
+  const size_t                 size,
+  cardano_json_object_t**      value)
+{
+  if ((json_object == NULL) || (key == NULL) || (value == NULL))
+  {
+    return false;
+  }
+
+  if (json_object->type != CARDANO_JSON_OBJECT_TYPE_OBJECT)
+  {
+    return false;
+  }
+
+  for (size_t i = 0U; i < cardano_array_get_size(json_object->pairs); ++i)
+  {
+    cardano_json_kvp_t* kvp = (cardano_json_kvp_t*)((void*)cardano_array_get(json_object->pairs, i));
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+    const size_t key_size = cardano_buffer_get_size(kvp->key) - 1U;
+
+    if (key_size != size)
+    {
+      continue;
+    }
+
+    if (memcmp(cardano_buffer_get_data(kvp->key), key, key_size) == 0)
+    {
+      cardano_json_object_ref(kvp->value);
+
+      *value = kvp->value;
+
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool
+cardano_json_object_get_ex(
+  const cardano_json_object_t* json_object,
+  const char*                  key,
+  size_t                       size,
+  cardano_json_object_t**      value)
+{
+  if (cardano_json_object_get(json_object, key, size, value))
+  {
+    cardano_json_object_unref(value);
+    return true;
+  }
+
+  return false;
+}
+
+size_t
+cardano_json_object_array_get_length(
+  const cardano_json_object_t* json_object)
+{
+  if ((json_object == NULL) || (json_object->type != CARDANO_JSON_OBJECT_TYPE_ARRAY))
+  {
+    return 0U;
+  }
+
+  return cardano_array_get_size(json_object->array);
+}
+
+cardano_json_object_t*
+cardano_json_object_array_get(
+  const cardano_json_object_t* json_array,
+  const size_t                 index)
+{
+  if ((json_array == NULL) || (json_array->type != CARDANO_JSON_OBJECT_TYPE_ARRAY))
+  {
+    return NULL;
+  }
+
+  if (index >= cardano_array_get_size(json_array->array))
+  {
+    return NULL;
+  }
+
+  cardano_json_object_t* element = (cardano_json_object_t*)((void*)cardano_array_get(json_array->array, index));
+
+  return element;
+}
+
+cardano_json_object_t*
+cardano_json_object_array_get_ex(
+  const cardano_json_object_t* json_array,
+  const size_t                 index)
+{
+  cardano_json_object_t* element = cardano_json_object_array_get(json_array, index);
+  cardano_json_object_unref(&element);
+
+  return element;
+}
+
+const char*
+cardano_json_object_get_string(
+  const cardano_json_object_t* json_object,
+  size_t*                      string_length)
+{
+  if ((json_object == NULL) || (json_object->type != CARDANO_JSON_OBJECT_TYPE_STRING))
+  {
+    return NULL;
+  }
+
+  if (string_length != NULL)
+  {
+    *string_length = cardano_buffer_get_size(json_object->string);
+  }
+
+  return (const char*)((const void*)cardano_buffer_get_data(json_object->string));
+}
+
+bool
+cardano_json_object_get_is_negative_number(const cardano_json_object_t* json_object)
+{
+  if ((json_object == NULL) || (json_object->type != CARDANO_JSON_OBJECT_TYPE_NUMBER))
+  {
+    return false;
+  }
+
+  return json_object->is_negative;
+}
+
+bool
+cardano_json_object_get_is_real_number(const cardano_json_object_t* json_object)
+{
+  if ((json_object == NULL) || (json_object->type != CARDANO_JSON_OBJECT_TYPE_NUMBER))
+  {
+    return false;
+  }
+
+  return json_object->is_real;
+}
+
+cardano_error_t
+cardano_json_object_get_uint(
+  const cardano_json_object_t* json_object,
+  uint64_t*                    value)
+{
+  if ((json_object == NULL) || ((json_object->type != CARDANO_JSON_OBJECT_TYPE_NUMBER) && (json_object->type != CARDANO_JSON_OBJECT_TYPE_STRING)))
+  {
+    return CARDANO_ERROR_JSON_TYPE_MISMATCH;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((json_object->string != NULL) && (memchr(cardano_buffer_get_data(json_object->string), '\0', cardano_buffer_get_size(json_object->string) - 1U) != NULL))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (json_object->type == CARDANO_JSON_OBJECT_TYPE_STRING)
+  {
+    return cardano_safe_string_to_uint64((const char*)cardano_buffer_get_data(json_object->string), cardano_buffer_get_size(json_object->string) - 1U, value);
+  }
+
+  if (json_object->is_negative)
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  if (json_object->string != NULL)
+  {
+    return cardano_safe_string_to_uint64((const char*)cardano_buffer_get_data(json_object->string), cardano_buffer_get_size(json_object->string) - 1U, value);
+  }
+
+  *value = json_object->uint_value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_json_object_get_signed_int(
+  const cardano_json_object_t* json_object,
+  int64_t*                     value)
+{
+  if ((json_object == NULL) || ((json_object->type != CARDANO_JSON_OBJECT_TYPE_NUMBER) && (json_object->type != CARDANO_JSON_OBJECT_TYPE_STRING)))
+  {
+    return CARDANO_ERROR_JSON_TYPE_MISMATCH;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((json_object->string != NULL) && (memchr(cardano_buffer_get_data(json_object->string), '\0', cardano_buffer_get_size(json_object->string) - 1U) != NULL))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (json_object->type == CARDANO_JSON_OBJECT_TYPE_STRING)
+  {
+    return cardano_safe_string_to_int64((const char*)cardano_buffer_get_data(json_object->string), cardano_buffer_get_size(json_object->string) - 1U, value);
+  }
+
+  if (json_object->string != NULL)
+  {
+    return cardano_safe_string_to_int64((const char*)cardano_buffer_get_data(json_object->string), cardano_buffer_get_size(json_object->string) - 1U, value);
+  }
+
+  *value = json_object->int_value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_json_object_get_double(
+  const cardano_json_object_t* json_object,
+  double*                      value)
+{
+  if ((json_object == NULL) || ((json_object->type != CARDANO_JSON_OBJECT_TYPE_NUMBER) && (json_object->type != CARDANO_JSON_OBJECT_TYPE_STRING)))
+  {
+    return CARDANO_ERROR_JSON_TYPE_MISMATCH;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((json_object->string != NULL) && (memchr(cardano_buffer_get_data(json_object->string), '\0', cardano_buffer_get_size(json_object->string) - 1U) != NULL))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (json_object->type == CARDANO_JSON_OBJECT_TYPE_STRING)
+  {
+    return cardano_safe_string_to_double((const char*)cardano_buffer_get_data(json_object->string), cardano_buffer_get_size(json_object->string) - 1U, value);
+  }
+
+  if (json_object->string != NULL)
+  {
+    return cardano_safe_string_to_double((const char*)cardano_buffer_get_data(json_object->string), cardano_buffer_get_size(json_object->string) - 1U, value);
+  }
+
+  *value = json_object->double_value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_json_object_get_boolean(
+  const cardano_json_object_t* json_object,
+  bool*                        value)
+{
+  if ((json_object == NULL) || (json_object->type != CARDANO_JSON_OBJECT_TYPE_BOOLEAN))
+  {
+    return CARDANO_ERROR_JSON_TYPE_MISMATCH;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *value = json_object->bool_value;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_json_object_unref(cardano_json_object_t** json_object)
+{
+  if ((json_object == NULL) || (*json_object == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*json_object)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *json_object = NULL;
+    return;
+  }
+}
+
+void
+cardano_json_object_ref(cardano_json_object_t* json_object)
+{
+  if (json_object == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&json_object->base);
+}
+
+size_t
+cardano_json_object_refcount(const cardano_json_object_t* json_object)
+{
+  if (json_object == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&json_object->base);
+}
+
+void
+cardano_json_object_set_last_error(cardano_json_object_t* writer, const char* message)
+{
+  cardano_object_set_last_error(&writer->base, message);
+}
+
+const char*
+cardano_json_object_get_last_error(const cardano_json_object_t* writer)
+{
+  return cardano_object_get_last_error(&writer->base);
+}
diff --git a/vendor/src/json/json_writer.c b/vendor/src/json/json_writer.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/json/json_writer.c
@@ -0,0 +1,1363 @@
+/**
+ * \file json_writer.c
+ *
+ * \author angel.castillo
+ * \date   Dec 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+#include "internals/json_object_serialization.h"
+#include "internals/json_writer_common.h"
+
+#include <assert.h>
+#include <cardano/encoding/bech32.h>
+#include <cardano/json/json_format.h>
+#include <string.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a JSON writer object.
+ *
+ * This function is responsible for properly deallocating a JSON writer object (`cardano_json_writer_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the JSON writer object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_json_writer_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the JSON writer
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_json_writer_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_json_writer_t* json_writer = (cardano_json_writer_t*)object;
+
+  if (json_writer->buffer != NULL)
+  {
+    cardano_buffer_unref(&json_writer->buffer);
+  }
+
+  _cardano_free(json_writer);
+}
+
+/**
+ * \brief Pushes a new JSON context onto the writer's context stack.
+ *
+ * This function adds a new JSON context (e.g., an object or array) to the writer's stack,
+ * updating the depth and initializing the new context's state. It ensures the writer does
+ * not exceed the maximum allowable nesting depth.
+ *
+ * \param[in,out] writer  A pointer to the JSON writer instance whose context stack is to be modified. Must not be NULL.
+ * \param[in]     context The JSON context to be added to the stack. Valid values include:
+ *                        - \c CARDANO_JSON_CONTEXT_OBJECT: Represents a JSON object.
+ *                        - \c CARDANO_JSON_CONTEXT_ARRAY: Represents a JSON array.
+ */
+static void
+push_context(cardano_json_writer_t* writer, const cardano_json_context_t context)
+{
+  assert(writer != NULL);
+  assert(writer->last_error == CARDANO_SUCCESS);
+
+  if (writer->depth >= ((size_t)LIB_CARDANO_C_MAX_JSON_DEPTH - 1U))
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "JSON nesting depth exceeded maximum allowed.");
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_frame = &writer->current_frame[writer->depth];
+
+  if ((current_frame->context == CARDANO_JSON_CONTEXT_OBJECT) && (!current_frame->expect_value))
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Cannot push a new context without writing a property value.");
+    return;
+  }
+
+  const bool expect_value = (context == CARDANO_JSON_CONTEXT_ARRAY);
+
+  ++writer->depth;
+
+  writer->current_frame[writer->depth] = (cardano_json_stack_frame_t) {
+    .context      = context,
+    .item_count   = 0,
+    .expect_value = expect_value
+  };
+}
+
+/**
+ * \brief Pops the current JSON context from the writer's context stack.
+ *
+ * This function removes the topmost JSON context from the writer's stack,
+ * effectively signaling the end of the current JSON scope (such as an object
+ * or an array). It also adjusts the writer's depth to reflect the new active
+ * context. If the stack is already at the root context, an error is recorded.
+ *
+ * \param[in,out] writer A pointer to the JSON writer instance whose context
+ *                       stack is to be modified. Must not be NULL.
+ */
+static void
+pop_context(cardano_json_writer_t* writer)
+{
+  assert(writer != NULL);
+  assert(writer->depth > 0U);
+
+  --writer->depth;
+}
+
+/**
+ * \brief Writes indentation based on the current depth.
+ *
+ * \param[in] writer The JSON writer instance.
+ * \return CARDANO_SUCCESS on success, or an appropriate error code on failure.
+ */
+static cardano_error_t
+write_indentation(cardano_json_writer_t* writer)
+{
+  if (writer->depth == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  const size_t indent_size = (writer->depth) * 2U;
+
+  // cppcheck-suppress misra-c2012-18.8; Reason: LIB_CARDANO_C_MAX_JSON_DEPTH is injected by CMake and is a constant.
+  static char buffer[(LIB_CARDANO_C_MAX_JSON_DEPTH * 2) + 1] = { 0 };
+
+  CARDANO_UNUSED(memset((void*)buffer, ' ', indent_size));
+
+  return cardano_buffer_write(writer->buffer, (byte_t*)buffer, indent_size);
+}
+
+/**
+ * \brief Get the escape character of a non-printable.
+ * \param ch Character source.
+ *
+ * \return The escape character or null character if error.
+ * */
+static int32_t
+escape(const int32_t ch)
+{
+  static struct
+  {
+      char code;
+      char ch;
+  } const pair[] = {
+    { '\"', '\"' },
+    { '\\', '\\' },
+    { 'b', '\b' },
+    { 'f', '\f' },
+    { 'n', '\n' },
+    { 'r', '\r' },
+    { 't', '\t' },
+  };
+
+  for (size_t i = 0U; i < (sizeof(pair) / sizeof(*pair)); ++i)
+  {
+    if (ch == pair[i].ch)
+    {
+      return pair[i].code;
+    }
+  }
+
+  return '\0';
+}
+
+/**
+ * \brief Writes one string byte with JSON escaping where required.
+ * \param[in,out] writer Writer receiving the escaped byte.
+ * \param[in] value The byte to write.
+ * \return CARDANO_SUCCESS or a buffer allocation error.
+ */
+static cardano_error_t
+write_escaped_byte(cardano_json_writer_t* writer, const byte_t value)
+{
+  const int32_t escaped = escape(value);
+
+  if (escaped != 0)
+  {
+    const byte_t bytes[2] = { '\\', (byte_t)escaped };
+    return cardano_buffer_write(writer->buffer, bytes, sizeof(bytes));
+  }
+
+  if (value < 0x20U)
+  {
+    const char   digits[] = "0123456789abcdef";
+    const byte_t bytes[6] = { '\\', 'u', '0', '0', (byte_t)digits[value >> 4U], (byte_t)digits[value & 15U] };
+    return cardano_buffer_write(writer->buffer, bytes, sizeof(bytes));
+  }
+
+  return cardano_buffer_write(writer->buffer, &value, 1U);
+}
+
+/* DECLARATIONS **************************************************************/
+
+cardano_json_writer_t*
+cardano_json_writer_new(const cardano_json_format_t format)
+{
+  cardano_json_writer_t* obj = (cardano_json_writer_t*)_cardano_malloc(sizeof(cardano_json_writer_t));
+
+  if (obj == NULL)
+  {
+    return NULL;
+  }
+
+  obj->base.ref_count     = 1;
+  obj->base.deallocator   = cardano_json_writer_deallocate;
+  obj->base.last_error[0] = '\0';
+  obj->buffer             = cardano_buffer_new(128);
+  obj->last_error         = CARDANO_SUCCESS;
+  obj->depth              = 0;
+  obj->format             = format;
+  obj->current_frame[0]   = (cardano_json_stack_frame_t) {
+      .context      = CARDANO_JSON_CONTEXT_ROOT,
+      .item_count   = 0,
+      .expect_value = false
+  };
+
+  if (obj->buffer == NULL)
+  {
+    _cardano_free(obj);
+    return NULL;
+  }
+
+  return obj;
+}
+
+void
+cardano_json_writer_write_property_name(
+  cardano_json_writer_t* writer,
+  const char*            name,
+  const size_t           name_size)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  if (name == NULL)
+  {
+    writer->last_error = CARDANO_ERROR_POINTER_IS_NULL;
+    cardano_object_set_last_error(&writer->base, "Property name cannot be NULL or empty.");
+    return;
+  }
+
+  if ((writer->depth == 0U) || (writer->current_frame[writer->depth].context != CARDANO_JSON_CONTEXT_OBJECT))
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Property name can only be written within an object context.");
+    return;
+  }
+
+  if (writer->current_frame[writer->depth].expect_value)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Previous property has no value.");
+    return;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (writer->current_frame[writer->depth].item_count > 0U)
+  {
+    result = cardano_buffer_write(writer->buffer, COMMA, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write comma before property name.");
+  }
+
+  if (writer->format == CARDANO_JSON_FORMAT_PRETTY)
+  {
+    result = cardano_buffer_write(writer->buffer, &NEW_LINE[0], 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before property name.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before property name.");
+  }
+
+  result = cardano_buffer_write(writer->buffer, QUOTES, 1);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write quotes before property name.");
+
+  for (size_t i = 0; i < name_size; ++i)
+  {
+    result = write_escaped_byte(writer, (byte_t)name[i]);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write escaped string byte.");
+  }
+
+  result = cardano_buffer_write(writer->buffer, QUOTES, 1);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write quotes after property name.");
+
+  result = cardano_buffer_write(writer->buffer, COLON, 1);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write colon after property name.");
+
+  if (writer->format == CARDANO_JSON_FORMAT_PRETTY)
+  {
+    result = cardano_buffer_write(writer->buffer, &SPACE[0], 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write space after colon.");
+  }
+
+  writer->current_frame[writer->depth].expect_value = true;
+}
+
+void
+cardano_json_writer_write_bool(
+  cardano_json_writer_t* writer,
+  const bool             value)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_context = &writer->current_frame[writer->depth];
+
+  const bool is_root       = (current_context->context == CARDANO_JSON_CONTEXT_ROOT);
+  const bool is_root_first = (is_root && (current_context->item_count == 0U));
+  const bool can_write     = (is_root_first || current_context->expect_value);
+
+  if (!can_write)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Unexpected boolean value.");
+
+    return;
+  }
+
+  if ((current_context->item_count > 0U) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, COMMA, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write comma before boolean value.");
+  }
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before boolean value.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before boolean value.");
+  }
+
+  cardano_error_t result = cardano_buffer_write(writer->buffer, value ? TRUE : FALSE, value ? 4 : 5);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write boolean value.");
+
+  current_context->item_count++;
+  current_context->expect_value = current_context->context == CARDANO_JSON_CONTEXT_ARRAY;
+}
+
+void
+cardano_json_writer_write_null(cardano_json_writer_t* writer)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_context = &writer->current_frame[writer->depth];
+
+  const bool is_root       = (current_context->context == CARDANO_JSON_CONTEXT_ROOT);
+  const bool is_root_first = (is_root && (current_context->item_count == 0U));
+  const bool can_write     = (is_root_first || current_context->expect_value);
+
+  if (!can_write)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Unexpected null value.");
+    return;
+  }
+
+  if ((current_context->item_count > 0U) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, COMMA, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write comma before null value.");
+  }
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before null value.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before null value.");
+  }
+
+  cardano_error_t result = cardano_buffer_write(writer->buffer, NULL_VALUE, 4);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write null value.");
+
+  current_context->item_count++;
+  current_context->expect_value = current_context->context == CARDANO_JSON_CONTEXT_ARRAY;
+}
+
+void
+cardano_json_writer_write_bigint(
+  cardano_json_writer_t*  writer,
+  const cardano_bigint_t* bigint)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  if (bigint == NULL)
+  {
+    writer->last_error = CARDANO_ERROR_POINTER_IS_NULL;
+    cardano_object_set_last_error(&writer->base, "Bigint value cannot be NULL.");
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_context = &writer->current_frame[writer->depth];
+
+  const bool is_root       = (current_context->context == CARDANO_JSON_CONTEXT_ROOT);
+  const bool is_root_first = (is_root && (current_context->item_count == 0U));
+  const bool can_write     = (is_root_first || current_context->expect_value);
+
+  if (!can_write)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Unexpected bigint value.");
+    return;
+  }
+
+  if ((current_context->item_count > 0U) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, COMMA, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write comma before bigint value.");
+  }
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before bigint value.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before bigint value.");
+  }
+
+  const size_t size = cardano_bigint_get_string_size(bigint, 10);
+  byte_t*      data = (byte_t*)_cardano_malloc(size);
+  if (data == NULL)
+  {
+    writer->last_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    cardano_object_set_last_error(&writer->base, "Failed to allocate memory for bigint value.");
+    return;
+  }
+
+  cardano_error_t result = cardano_bigint_to_string(bigint, (char*)data, size, 10);
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(data);
+    writer->last_error = result;
+    cardano_object_set_last_error(&writer->base, "Failed to convert bigint value to string.");
+    return;
+  }
+
+  result = cardano_buffer_write(writer->buffer, QUOTES, 1);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write quotes before bigint value.");
+
+  result = cardano_buffer_write(writer->buffer, data, size - 1U);
+  _cardano_free(data);
+
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write bigint value.");
+
+  result = cardano_buffer_write(writer->buffer, QUOTES, 1);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write quotes after bigint value.");
+
+  current_context->item_count++;
+  current_context->expect_value = current_context->context == CARDANO_JSON_CONTEXT_ARRAY;
+}
+
+void
+cardano_json_writer_write_start_array(
+  cardano_json_writer_t* writer)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_context = &writer->current_frame[writer->depth];
+
+  const bool is_root       = (current_context->context == CARDANO_JSON_CONTEXT_ROOT);
+  const bool is_root_first = (is_root && (current_context->item_count == 0U));
+  const bool can_write     = (is_root_first || current_context->expect_value);
+
+  if (!can_write)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Unexpected start of array.");
+    return;
+  }
+
+  if ((current_context->item_count > 0U) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, COMMA, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write comma before starting array.");
+  }
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before starting array.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before starting array.");
+  }
+
+  cardano_error_t result = cardano_buffer_write(writer->buffer, OPEN_ARRAY, 1);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write opening array.");
+
+  if (writer->last_error == CARDANO_SUCCESS)
+  {
+    push_context(writer, CARDANO_JSON_CONTEXT_ARRAY);
+  }
+}
+
+void
+cardano_json_writer_write_end_array(cardano_json_writer_t* writer)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  if ((writer->depth == 0U) || (writer->current_frame[writer->depth].context != CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Cannot write end of array: Not in an array context.");
+    return;
+  }
+
+  const size_t item_count = writer->current_frame[writer->depth].item_count;
+  pop_context(writer);
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (item_count > 0U))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before closing array.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before closing array.");
+  }
+
+  cardano_error_t result = cardano_buffer_write(writer->buffer, CLOSE_ARRAY, 1);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write closing array.");
+
+  writer->current_frame[writer->depth].item_count++;
+  writer->current_frame[writer->depth].expect_value = writer->current_frame[writer->depth].context == CARDANO_JSON_CONTEXT_ARRAY;
+}
+
+void
+cardano_json_writer_write_start_object(cardano_json_writer_t* writer)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_context = &writer->current_frame[writer->depth];
+
+  const bool is_root_first = (current_context->context == CARDANO_JSON_CONTEXT_ROOT) && (current_context->item_count == 0U);
+
+  if (!is_root_first && !current_context->expect_value)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Unexpected start of object.");
+    return;
+  }
+
+  if ((current_context->item_count > 0U) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, COMMA, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write comma before starting object.");
+  }
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before starting object.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before starting object.");
+  }
+
+  cardano_error_t result = cardano_buffer_write(writer->buffer, OPEN_OBJECT, 1);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write opening object.");
+
+  if (writer->last_error == CARDANO_SUCCESS)
+  {
+    push_context(writer, CARDANO_JSON_CONTEXT_OBJECT);
+  }
+}
+
+void
+cardano_json_writer_write_end_object(cardano_json_writer_t* writer)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  if ((writer->depth == 0U) || (writer->current_frame[writer->depth].context != CARDANO_JSON_CONTEXT_OBJECT))
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Cannot write end of object: Not in an object context.");
+    return;
+  }
+
+  if (writer->current_frame[writer->depth].expect_value)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Object property has no value.");
+    return;
+  }
+
+  const size_t item_count = writer->current_frame[writer->depth].item_count;
+  pop_context(writer);
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (item_count > 0U))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before closing object.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before closing object.");
+  }
+
+  cardano_error_t result = cardano_buffer_write(writer->buffer, CLOSE_OBJECT, 1);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write closing object.");
+
+  writer->current_frame[writer->depth].item_count++;
+  writer->current_frame[writer->depth].expect_value = writer->current_frame[writer->depth].context == CARDANO_JSON_CONTEXT_ARRAY;
+}
+
+void
+cardano_json_writer_write_raw_value(
+  cardano_json_writer_t* writer,
+  const char*            data,
+  size_t                 size)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  if (data == NULL)
+  {
+    writer->last_error = CARDANO_ERROR_POINTER_IS_NULL;
+    cardano_object_set_last_error(&writer->base, "Raw value data cannot be NULL.");
+    return;
+  }
+
+  if (size == 0U)
+  {
+    writer->last_error = CARDANO_ERROR_INVALID_ARGUMENT;
+    cardano_object_set_last_error(&writer->base, "Raw value size cannot be zero.");
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_context = &writer->current_frame[writer->depth];
+
+  const bool is_root       = (current_context->context == CARDANO_JSON_CONTEXT_ROOT);
+  const bool is_root_first = (is_root && (current_context->item_count == 0U));
+  const bool can_write     = (is_root_first || current_context->expect_value);
+
+  if (!can_write)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Unexpected raw value.");
+    return;
+  }
+
+  if ((current_context->item_count > 0U) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, COMMA, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write comma before raw value.");
+  }
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before raw value.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before raw value.");
+  }
+
+  cardano_error_t result = cardano_buffer_write(writer->buffer, (const byte_t*)data, size);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write raw value.");
+
+  current_context->item_count++;
+  current_context->expect_value = current_context->context == CARDANO_JSON_CONTEXT_ARRAY;
+}
+
+void
+cardano_json_writer_write_object(
+  cardano_json_writer_t* writer,
+  cardano_json_object_t* object)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  if (object == NULL)
+  {
+    writer->last_error = CARDANO_ERROR_POINTER_IS_NULL;
+    cardano_object_set_last_error(&writer->base, "Object cannot be NULL.");
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_context = &writer->current_frame[writer->depth];
+
+  const bool is_root       = (current_context->context == CARDANO_JSON_CONTEXT_ROOT);
+  const bool is_root_first = (is_root && (current_context->item_count == 0U));
+  const bool can_write     = (is_root_first || current_context->expect_value);
+
+  if (!can_write)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Unexpected object value.");
+    return;
+  }
+
+  cardano_error_t result = cardano_write_json_object(writer, object);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write object value.");
+}
+
+void
+cardano_json_writer_write_uint(
+  cardano_json_writer_t* writer,
+  const uint64_t         value)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_context = &writer->current_frame[writer->depth];
+
+  const bool is_root       = (current_context->context == CARDANO_JSON_CONTEXT_ROOT);
+  const bool is_root_first = (is_root && (current_context->item_count == 0U));
+  const bool can_write     = (is_root_first || current_context->expect_value);
+
+  if (!can_write)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Unexpected unsigned integer value.");
+    return;
+  }
+
+  if ((current_context->item_count > 0U) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, COMMA, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write comma before unsigned integer value.");
+  }
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before unsigned integer value.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before unsigned integer value.");
+  }
+
+  char   buffer[32]  = { 0 };
+  size_t buffer_size = cardano_safe_uint64_to_string(value, buffer, sizeof(buffer));
+  if (buffer_size == 0U)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Failed to convert unsigned integer value to string.");
+    return;
+  }
+
+  cardano_error_t result = cardano_buffer_write(writer->buffer, (const byte_t*)buffer, buffer_size);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write unsigned integer value.");
+
+  current_context->item_count++;
+  current_context->expect_value = current_context->context == CARDANO_JSON_CONTEXT_ARRAY;
+}
+
+void
+cardano_json_writer_write_uint_as_string(
+  cardano_json_writer_t* writer,
+  const uint64_t         value)
+{
+  char         amount_str[128] = { 0 };
+  const size_t str_size        = cardano_safe_uint64_to_string(value, amount_str, sizeof(amount_str));
+
+  cardano_json_writer_write_string(writer, amount_str, str_size);
+}
+
+void
+cardano_json_writer_write_signed_int(
+  cardano_json_writer_t* writer,
+  int64_t                value)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_context = &writer->current_frame[writer->depth];
+
+  const bool is_root       = (current_context->context == CARDANO_JSON_CONTEXT_ROOT);
+  const bool is_root_first = (is_root && (current_context->item_count == 0U));
+  const bool can_write     = (is_root_first || current_context->expect_value);
+
+  if (!can_write)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Unexpected signed integer value.");
+    return;
+  }
+
+  if ((current_context->item_count > 0U) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, COMMA, 1);
+    CARDANO_UNUSED(result);
+  }
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before signed integer value.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before signed integer value.");
+  }
+
+  char   buffer[32]  = { 0 };
+  size_t buffer_size = cardano_safe_int64_to_string(value, buffer, sizeof(buffer));
+  if (buffer_size == 0U)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Failed to convert signed integer value to string.");
+    return;
+  }
+
+  cardano_error_t result = cardano_buffer_write(writer->buffer, (const byte_t*)buffer, buffer_size);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write signed integer value.");
+
+  current_context->item_count++;
+  current_context->expect_value = current_context->context == CARDANO_JSON_CONTEXT_ARRAY;
+}
+
+void
+cardano_json_writer_write_signed_int_as_string(
+  cardano_json_writer_t* writer,
+  const int64_t          value)
+{
+  char         amount_str[128] = { 0 };
+  const size_t str_size        = cardano_safe_int64_to_string(value, amount_str, sizeof(amount_str));
+  cardano_json_writer_write_string(writer, amount_str, str_size);
+}
+
+void
+cardano_json_writer_write_double(
+  cardano_json_writer_t* writer,
+  double                 value)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_context = &writer->current_frame[writer->depth];
+
+  const bool is_root       = (current_context->context == CARDANO_JSON_CONTEXT_ROOT);
+  const bool is_root_first = (is_root && (current_context->item_count == 0U));
+  const bool can_write     = (is_root_first || current_context->expect_value);
+
+  if (!can_write)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Unexpected double value.");
+    return;
+  }
+
+  if ((current_context->item_count > 0U) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, COMMA, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write comma before double value.");
+  }
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before double value.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before double value.");
+  }
+
+  char   buffer[32]  = { 0 };
+  size_t buffer_size = cardano_safe_double_to_string(value, buffer, sizeof(buffer));
+  if (buffer_size == 0U)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Failed to convert double value to string.");
+    return;
+  }
+
+  cardano_error_t result = cardano_buffer_write(writer->buffer, (const byte_t*)buffer, buffer_size);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write double value.");
+
+  current_context->item_count++;
+  current_context->expect_value = current_context->context == CARDANO_JSON_CONTEXT_ARRAY;
+}
+
+void
+cardano_json_writer_write_double_as_string(
+  cardano_json_writer_t* writer,
+  const double           value)
+{
+  char         amount_str[128] = { 0 };
+  const size_t str_size        = cardano_safe_double_to_string(value, amount_str, sizeof(amount_str));
+  cardano_json_writer_write_string(writer, amount_str, str_size);
+}
+
+void
+cardano_json_writer_write_buffer_as_hex(
+  cardano_json_writer_t*  writer,
+  const cardano_buffer_t* value)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const size_t size = cardano_buffer_get_hex_size(value);
+
+  if (size <= 1U) // Account for null termination on empty strings
+  {
+    cardano_json_writer_write_string(writer, "", 0U);
+    return;
+  }
+
+  char* hex_str = _cardano_malloc(size);
+
+  if (hex_str == NULL)
+  {
+    writer->last_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    cardano_object_set_last_error(&writer->base, "Failed to allocate memory for hex string.");
+    return;
+  }
+
+  cardano_error_t error = cardano_buffer_to_hex(value, hex_str, size);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    writer->last_error = error;
+    cardano_object_set_last_error(&writer->base, "Failed to convert buffer to hex string.");
+    _cardano_free(hex_str);
+    return;
+  }
+
+  const size_t hex_str_size = cardano_safe_strlen(hex_str, size);
+
+  cardano_json_writer_write_string(writer, hex_str, hex_str_size);
+  _cardano_free(hex_str);
+}
+
+void
+cardano_json_writer_write_bytes_as_hex(
+  cardano_json_writer_t* writer,
+  const byte_t*          bytes,
+  const size_t           bytes_size)
+{
+  cardano_buffer_t* buffer = cardano_buffer_new_from(bytes, bytes_size);
+
+  if (buffer == NULL)
+  {
+    writer->last_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    cardano_object_set_last_error(&writer->base, "Failed to create buffer from bytes.");
+    return;
+  }
+
+  cardano_json_writer_write_buffer_as_hex(writer, buffer);
+  cardano_buffer_unref(&buffer);
+}
+
+void
+cardano_json_writer_write_bytes_as_bech32(
+  cardano_json_writer_t* writer,
+  const char*            hrp,
+  const size_t           hrp_length,
+  const byte_t*          bytes,
+  const size_t           bytes_size)
+{
+  if ((writer == NULL) || (hrp == NULL) || (bytes == NULL))
+  {
+    return;
+  }
+
+  const size_t encoded_size = cardano_encoding_bech32_get_encoded_length(
+    hrp,
+    hrp_length,
+    bytes,
+    bytes_size);
+
+  if (encoded_size == 0U)
+  {
+    writer->last_error = CARDANO_ERROR_INVALID_ARGUMENT;
+    cardano_object_set_last_error(&writer->base, "Invalid arguments for Bech32 encoding.");
+    return;
+  }
+
+  char* buffer = _cardano_malloc(encoded_size);
+
+  if (buffer == NULL)
+  {
+    writer->last_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    cardano_object_set_last_error(&writer->base, "Failed to allocate temporary buffer.");
+    return;
+  }
+
+  cardano_error_t error = cardano_encoding_bech32_encode(
+    hrp,
+    hrp_length,
+    bytes,
+    bytes_size,
+    buffer,
+    encoded_size);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    _cardano_free(buffer);
+    writer->last_error = error;
+    cardano_object_set_last_error(&writer->base, "Failed during Bech32 encoding.");
+    return;
+  }
+
+  cardano_json_writer_write_string(writer, buffer, cardano_safe_strlen(buffer, encoded_size));
+  _cardano_free(buffer);
+}
+
+void
+cardano_json_writer_write_buffer_as_bech32(
+  cardano_json_writer_t*  writer,
+  const char*             hrp,
+  const size_t            hrp_length,
+  const cardano_buffer_t* value)
+{
+  if ((writer == NULL) || (value == NULL))
+  {
+    return;
+  }
+
+  const byte_t* bytes      = cardano_buffer_get_data(value);
+  const size_t  bytes_size = cardano_buffer_get_size(value);
+
+  cardano_json_writer_write_bytes_as_bech32(writer, hrp, hrp_length, bytes, bytes_size);
+}
+
+void
+cardano_json_writer_write_string(
+  cardano_json_writer_t* writer,
+  const char*            value,
+  size_t                 value_size)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  if ((value == NULL) && (value_size != 0U))
+  {
+    writer->last_error = CARDANO_ERROR_POINTER_IS_NULL;
+    cardano_object_set_last_error(&writer->base, "String value cannot be NULL or empty.");
+    return;
+  }
+
+  cardano_json_stack_frame_t* current_context = &writer->current_frame[writer->depth];
+
+  const bool is_root       = (current_context->context == CARDANO_JSON_CONTEXT_ROOT);
+  const bool is_root_first = (is_root && (current_context->item_count == 0U));
+  const bool can_write     = (is_root_first || current_context->expect_value);
+
+  if (!can_write)
+  {
+    writer->last_error = CARDANO_ERROR_ENCODING;
+    cardano_object_set_last_error(&writer->base, "Unexpected string value.");
+    return;
+  }
+
+  if ((current_context->item_count > 0U) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, COMMA, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write comma before string value.");
+  }
+
+  if ((writer->format == CARDANO_JSON_FORMAT_PRETTY) && (current_context->context == CARDANO_JSON_CONTEXT_ARRAY))
+  {
+    cardano_error_t result = cardano_buffer_write(writer->buffer, NEW_LINE, 1);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write new line before string value.");
+
+    result = write_indentation(writer);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write indentation before string value.");
+  }
+
+  cardano_error_t result = cardano_buffer_write(writer->buffer, QUOTES, 1);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write quotes before string value.");
+
+  for (size_t i = 0; i < value_size; ++i)
+  {
+    result = write_escaped_byte(writer, (byte_t)value[i]);
+    cardano_json_writer_set_message_if_error(writer, result, "Failed to write escaped string byte.");
+  }
+
+  result = cardano_buffer_write(writer->buffer, QUOTES, 1);
+  cardano_json_writer_set_message_if_error(writer, result, "Failed to write quotes after string value.");
+
+  current_context->item_count++;
+  current_context->expect_value = current_context->context == CARDANO_JSON_CONTEXT_ARRAY;
+}
+
+cardano_json_context_t
+cardano_json_writer_get_context(cardano_json_writer_t* writer)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_JSON_CONTEXT_ROOT;
+  }
+
+  if (writer->depth == 0U)
+  {
+    return CARDANO_JSON_CONTEXT_ROOT;
+  }
+
+  return writer->current_frame[writer->depth].context;
+}
+
+size_t
+cardano_json_writer_get_encoded_size(cardano_json_writer_t* writer)
+{
+  if ((writer == NULL) || (writer->last_error != CARDANO_SUCCESS))
+  {
+    return 0U;
+  }
+
+  return cardano_buffer_get_size(writer->buffer) + 1U;
+}
+
+cardano_error_t
+cardano_json_writer_encode(cardano_json_writer_t* writer, char* data, const size_t size)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  if (writer->last_error != CARDANO_SUCCESS)
+  {
+    return writer->last_error;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((writer->current_frame[writer->depth].context != CARDANO_JSON_CONTEXT_ROOT) || (writer->current_frame[writer->depth].expect_value))
+  {
+    cardano_json_writer_set_last_error(writer, "JSON document is incomplete.");
+    return CARDANO_ERROR_ENCODING;
+  }
+
+  const size_t buffer_size = cardano_buffer_get_size(writer->buffer);
+
+  if ((buffer_size + 1U) > size)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  CARDANO_UNUSED(memset(data, 0, buffer_size + 1U));
+  cardano_safe_memcpy(data, size, cardano_buffer_get_data(writer->buffer), buffer_size);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_json_writer_encode_in_buffer(cardano_json_writer_t* writer, cardano_buffer_t** buffer)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer->last_error != CARDANO_SUCCESS)
+  {
+    return writer->last_error;
+  }
+
+  const size_t buffer_size = cardano_buffer_get_size(writer->buffer);
+
+  if (buffer_size == 0U)
+  {
+    cardano_json_writer_set_last_error(writer, "JSON document is empty.");
+    return CARDANO_ERROR_ENCODING;
+  }
+
+  *buffer = cardano_buffer_new(cardano_buffer_get_size(writer->buffer));
+
+  if (*buffer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_buffer_write(*buffer, cardano_buffer_get_data(writer->buffer), cardano_buffer_get_size(writer->buffer));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(buffer);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_json_writer_reset(cardano_json_writer_t* writer)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_unref(&writer->buffer);
+
+  writer->buffer                        = cardano_buffer_new(128);
+  writer->depth                         = 0U;
+  writer->last_error                    = CARDANO_SUCCESS;
+  writer->current_frame[0].context      = CARDANO_JSON_CONTEXT_ROOT;
+  writer->current_frame[0].item_count   = 0U;
+  writer->current_frame[0].expect_value = false;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_json_writer_unref(cardano_json_writer_t** json_writer)
+{
+  if ((json_writer == NULL) || (*json_writer == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*json_writer)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *json_writer = NULL;
+    return;
+  }
+}
+
+void
+cardano_json_writer_ref(cardano_json_writer_t* json_writer)
+{
+  if (json_writer == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&json_writer->base);
+}
+
+size_t
+cardano_json_writer_refcount(const cardano_json_writer_t* json_writer)
+{
+  if (json_writer == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&json_writer->base);
+}
+
+void
+cardano_json_writer_set_last_error(cardano_json_writer_t* writer, const char* message)
+{
+  cardano_object_set_last_error(&writer->base, message);
+}
+
+const char*
+cardano_json_writer_get_last_error(const cardano_json_writer_t* writer)
+{
+  return cardano_object_get_last_error(&writer->base);
+}
+
+cardano_error_t
+cardano_json_writer_deep_clone(const cardano_json_writer_t* source, cardano_json_writer_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_t* copy = _cardano_malloc(sizeof(cardano_json_writer_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->buffer             = NULL;
+  copy->last_error         = source->last_error;
+  copy->depth              = source->depth;
+  copy->format             = source->format;
+  CARDANO_UNUSED(memcpy(copy->current_frame, source->current_frame, sizeof(copy->current_frame)));
+
+  if (source->buffer != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->buffer, &copy->buffer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/key_handlers/secure_key_handler.c b/vendor/src/key_handlers/secure_key_handler.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/key_handlers/secure_key_handler.c
@@ -0,0 +1,354 @@
+/**
+ * \file secure_key_handler.c
+ *
+ * \author angel.castillo
+ * \date   Oct 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/key_handlers/secure_key_handler.h>
+#include <cardano/key_handlers/secure_key_handler_impl.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Opaque type definition for the secure key handler.
+ *
+ * `cardano_secure_key_handler_t` is an opaque structure representing a secure key handler. This handler abstracts the management of
+ * cryptographic key operations for both BIP32 (HD) and Ed25519 key types, ensuring that sensitive key material is managed securely.
+ * The internal details of this structure are hidden from users of the API, who interact with it through
+ * the provided API functions.
+ */
+typedef struct cardano_secure_key_handler_t
+{
+    cardano_object_t                  base;
+    cardano_secure_key_handler_impl_t impl;
+} cardano_secure_key_handler_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a secure_key_handler object.
+ *
+ * This function is responsible for properly deallocating a secure_key_handler object (`cardano_secure_key_handler_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the secure_key_handler object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_secure_key_handler_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the secure_key_handler
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_secure_key_handler_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_secure_key_handler_t* secure_key_handler = (cardano_secure_key_handler_t*)object;
+
+  cardano_object_unref(&secure_key_handler->impl.context);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_secure_key_handler_new(
+  cardano_secure_key_handler_impl_t impl,
+  cardano_secure_key_handler_t**    secure_key_handler)
+{
+  if (secure_key_handler == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *secure_key_handler = _cardano_malloc(sizeof(cardano_secure_key_handler_t));
+
+  if (*secure_key_handler == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*secure_key_handler)->base.deallocator   = cardano_secure_key_handler_deallocate;
+  (*secure_key_handler)->base.ref_count     = 1;
+  (*secure_key_handler)->base.last_error[0] = '\0';
+
+  (*secure_key_handler)->impl = impl;
+
+  // Make sure secure_key_handler name is null terminated
+  (*secure_key_handler)->impl.name[sizeof((*secure_key_handler)->impl.name) - 1U] = '\0';
+  (*secure_key_handler)->impl.error_message[0]                                    = '\0';
+
+  return CARDANO_SUCCESS;
+}
+
+const char*
+cardano_secure_key_handler_get_name(const cardano_secure_key_handler_t* secure_key_handler)
+{
+  if (secure_key_handler == NULL)
+  {
+    return "";
+  }
+
+  return secure_key_handler->impl.name;
+}
+
+cardano_error_t
+cardano_secure_key_handler_bip32_sign_transaction(
+  cardano_secure_key_handler_t*    secure_key_handler,
+  cardano_transaction_t*           tx,
+  const cardano_derivation_path_t* derivation_paths,
+  size_t                           num_paths,
+  cardano_vkey_witness_set_t**     vkey_witness_set)
+{
+  if ((secure_key_handler == NULL) || (tx == NULL) || (derivation_paths == NULL) || (vkey_witness_set == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (secure_key_handler->impl.bip32_sign_transaction == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = secure_key_handler->impl.bip32_sign_transaction(&secure_key_handler->impl, tx, derivation_paths, num_paths, vkey_witness_set);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_set_last_error(secure_key_handler, secure_key_handler->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_secure_key_handler_bip32_sign_sub_transaction(
+  cardano_secure_key_handler_t*    secure_key_handler,
+  cardano_sub_transaction_t*       sub_tx,
+  const cardano_derivation_path_t* derivation_paths,
+  size_t                           num_paths,
+  cardano_vkey_witness_set_t**     vkey_witness_set)
+{
+  if ((secure_key_handler == NULL) || (sub_tx == NULL) || (derivation_paths == NULL) || (vkey_witness_set == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (secure_key_handler->impl.bip32_sign_sub_transaction == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = secure_key_handler->impl.bip32_sign_sub_transaction(&secure_key_handler->impl, sub_tx, derivation_paths, num_paths, vkey_witness_set);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_set_last_error(secure_key_handler, secure_key_handler->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_secure_key_handler_bip32_get_extended_account_public_key(
+  cardano_secure_key_handler_t*           secure_key_handler,
+  const cardano_account_derivation_path_t derivation_path,
+  cardano_bip32_public_key_t**            bip32_public_key)
+{
+  if ((secure_key_handler == NULL) || (bip32_public_key == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (secure_key_handler->impl.bip32_get_extended_account_public_key == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = secure_key_handler->impl.bip32_get_extended_account_public_key(&secure_key_handler->impl, derivation_path, bip32_public_key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_set_last_error(secure_key_handler, secure_key_handler->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_secure_key_handler_ed25519_sign_transaction(
+  cardano_secure_key_handler_t* secure_key_handler,
+  cardano_transaction_t*        tx,
+  cardano_vkey_witness_set_t**  vkey_witness_set)
+{
+  if ((secure_key_handler == NULL) || (tx == NULL) || (vkey_witness_set == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (secure_key_handler->impl.ed25519_sign_transaction == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = secure_key_handler->impl.ed25519_sign_transaction(&secure_key_handler->impl, tx, vkey_witness_set);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_set_last_error(secure_key_handler, secure_key_handler->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_secure_key_handler_ed25519_sign_sub_transaction(
+  cardano_secure_key_handler_t* secure_key_handler,
+  cardano_sub_transaction_t*    sub_tx,
+  cardano_vkey_witness_set_t**  vkey_witness_set)
+{
+  if ((secure_key_handler == NULL) || (sub_tx == NULL) || (vkey_witness_set == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (secure_key_handler->impl.ed25519_sign_sub_transaction == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = secure_key_handler->impl.ed25519_sign_sub_transaction(&secure_key_handler->impl, sub_tx, vkey_witness_set);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_set_last_error(secure_key_handler, secure_key_handler->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_secure_key_handler_ed25519_get_public_key(
+  cardano_secure_key_handler_t*  secure_key_handler,
+  cardano_ed25519_public_key_t** public_key)
+{
+  if ((secure_key_handler == NULL) || (public_key == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (secure_key_handler->impl.ed25519_get_public_key == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = secure_key_handler->impl.ed25519_get_public_key(&secure_key_handler->impl, public_key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_set_last_error(secure_key_handler, secure_key_handler->impl.error_message);
+  }
+
+  return result;
+}
+
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_secure_key_handler_serialize(
+  cardano_secure_key_handler_t* secure_key_handler,
+  cardano_buffer_t**            serialized_data)
+{
+  if ((secure_key_handler == NULL) || (serialized_data == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (secure_key_handler->impl.serialize == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = secure_key_handler->impl.serialize(&secure_key_handler->impl, serialized_data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_set_last_error(secure_key_handler, secure_key_handler->impl.error_message);
+  }
+
+  return result;
+}
+
+void
+cardano_secure_key_handler_unref(cardano_secure_key_handler_t** secure_key_handler)
+{
+  if ((secure_key_handler == NULL) || (*secure_key_handler == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*secure_key_handler)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *secure_key_handler = NULL;
+    return;
+  }
+}
+
+void
+cardano_secure_key_handler_ref(cardano_secure_key_handler_t* secure_key_handler)
+{
+  if (secure_key_handler == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&secure_key_handler->base);
+}
+
+size_t
+cardano_secure_key_handler_refcount(const cardano_secure_key_handler_t* secure_key_handler)
+{
+  if (secure_key_handler == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&secure_key_handler->base);
+}
+
+void
+cardano_secure_key_handler_set_last_error(cardano_secure_key_handler_t* secure_key_handler, const char* message)
+{
+  cardano_object_set_last_error(&secure_key_handler->base, message);
+}
+
+const char*
+cardano_secure_key_handler_get_last_error(const cardano_secure_key_handler_t* secure_key_handler)
+{
+  return cardano_object_get_last_error(&secure_key_handler->base);
+}
diff --git a/vendor/src/key_handlers/software_secure_key_handler.c b/vendor/src/key_handlers/software_secure_key_handler.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/key_handlers/software_secure_key_handler.c
@@ -0,0 +1,1385 @@
+/**
+ * \file secure_key_handler.c
+ *
+ * \author angel.castillo
+ * \date   Oct 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/bip32_private_key.h>
+#include <cardano/crypto/bip32_public_key.h>
+#include <cardano/crypto/crc32.h>
+#include <cardano/crypto/ed25519_private_key.h>
+#include <cardano/crypto/ed25519_public_key.h>
+#include <cardano/crypto/emip3.h>
+#include <cardano/key_handlers/secure_key_handler.h>
+#include <cardano/key_handlers/secure_key_handler_impl.h>
+#include <cardano/key_handlers/secure_key_handler_type.h>
+#include <cardano/key_handlers/software_secure_key_handler.h>
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <sodium/utils.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const uint32_t SW_SECURE_KEY_BINARY_FORMAT_HANDLER_MAGIC = 0x0A0A0A0A;
+static const uint8_t  SW_SECURE_KEY_BINARY_FORMAT_VERSION       = 0x01;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Context structure for the Software Secure Key Handler.
+ *
+ * The `software_secure_key_handler_context_t` structure represents the internal context of the software-based
+ * secure key handler.
+ *
+ * This context manages the encrypted key data as well as the mechanism for retrieving the passphrase when
+ * required to decrypt the key for operations like signing or key derivation.
+ */
+typedef struct software_secure_key_handler_context_t
+{
+    cardano_object_t              base;
+    cardano_buffer_t*             encrypted_data;
+    cardano_get_passphrase_func_t get_passphrase;
+} software_secure_key_handler_context_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a secure_key_handler object.
+ *
+ * This function is responsible for properly deallocating a secure_key_handler object (`cardano_secure_key_handler_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the secure_key_handler object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_secure_key_handler_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the secure_key_handler
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_secure_key_handler_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  software_secure_key_handler_context_t* context = (software_secure_key_handler_context_t*)object;
+
+  cardano_buffer_memzero(context->encrypted_data);
+  cardano_buffer_unref(&context->encrypted_data);
+
+  _cardano_free(object);
+}
+
+/**
+ * \brief Creates a new secure_key_handler context object.
+ *
+ * \return A pointer to the newly created secure_key_handler context object, or `NULL` if the operation failed.
+ */
+static software_secure_key_handler_context_t*
+cardano_software_secure_key_handler_context_new(void)
+{
+  software_secure_key_handler_context_t* data = _cardano_malloc(sizeof(software_secure_key_handler_context_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_secure_key_handler_deallocate;
+  data->encrypted_data     = NULL;
+  data->get_passphrase     = NULL;
+
+  return data;
+}
+
+/**
+ * \brief Serializes the secure key handler context into a buffer.
+ *
+ * The `serialize` function is responsible for serializing the internal state of the secure key handler,
+ * including its encrypted key material and relevant configuration, into a buffer that can later be deserialized
+ * to restore the state.
+ *
+ * This function allows secure key handlers to persist their state across different sessions, enabling
+ * operations such as storing the handler's state on disk for later retrieval.
+ *
+ * The serialized data includes:
+ * - The encrypted key material (`encrypted_data` field).
+ * - Other internal state required to reconstruct the key handler (e.g., key handler type).
+ *
+ * \param[in]  secure_key_handler_impl A pointer to the secure key handler implementation to be serialized.
+ * \param[out] serialized_data A pointer to the buffer where the serialized data will be stored. The caller is
+ *                             responsible for managing the lifecycle of this buffer, including freeing it after use.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during serialization.
+ *
+ * \note The caller is responsible for freeing the memory associated with `serialized_data` by calling `cardano_buffer_unref`
+ *       when it is no longer needed.
+ *
+ * \see cardano_secure_key_handler_deserialize for deserialization of the serialized data.
+ */
+static cardano_error_t
+serialize(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_buffer_t**                 serialized_data)
+{
+  if ((secure_key_handler_impl == NULL) || (serialized_data == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  software_secure_key_handler_context_t* context = (software_secure_key_handler_context_t*)((void*)secure_key_handler_impl->context);
+
+  if ((context == NULL) || (context->encrypted_data == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((secure_key_handler_impl->type != CARDANO_SECURE_KEY_HANDLER_TYPE_ED25519) && (secure_key_handler_impl->type != CARDANO_SECURE_KEY_HANDLER_TYPE_BIP32))
+  {
+    return CARDANO_ERROR_ENCODING;
+  }
+
+  const uint8_t type                = (uint8_t)secure_key_handler_impl->type;
+  const size_t  encrypted_data_size = cardano_buffer_get_size(context->encrypted_data);
+
+  const size_t total_size = (size_t)4UL // Magic
+    + (size_t)1UL                       // Version
+    + (size_t)1UL                       // Type
+    + (size_t)4UL                       // Encrypted data size
+    + encrypted_data_size               // Encrypted data
+    + (size_t)4UL;                      // Checksum
+
+  *serialized_data = cardano_buffer_new(total_size);
+
+  if (*serialized_data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = *serialized_data;
+  cardano_error_t   result = CARDANO_SUCCESS;
+
+  result = cardano_buffer_write_uint32_be(buffer, SW_SECURE_KEY_BINARY_FORMAT_HANDLER_MAGIC);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(serialized_data);
+
+    return result;
+  }
+
+  result = cardano_buffer_write(buffer, &SW_SECURE_KEY_BINARY_FORMAT_VERSION, 1);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(serialized_data);
+
+    return result;
+  }
+
+  result = cardano_buffer_write(buffer, &type, sizeof(type));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(serialized_data);
+
+    return result;
+  }
+
+  result = cardano_buffer_write_uint32_be(buffer, (uint32_t)encrypted_data_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(serialized_data);
+
+    return result;
+  }
+
+  result = cardano_buffer_write(buffer, cardano_buffer_get_data(context->encrypted_data), encrypted_data_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(serialized_data);
+
+    return result;
+  }
+
+  const uint32_t crc32_checksum = cardano_checksum_crc32(cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer));
+
+  result = cardano_buffer_write_uint32_be(buffer, crc32_checksum);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(serialized_data);
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Retrieves the extended BIP32 public key for a given account derivation path.
+ *
+ * The `bip32_get_extended_account_public_key` function retrieves the extended BIP32 public key corresponding
+ * to a specific account derivation path from the secure key handler. This public key can be used for operations
+ * such as address generation or public key authentication.
+ *
+ * The BIP32 public key includes both the public key and the chain code, enabling derivation of child keys without
+ * access to the private key. This allows for secure public key operations while keeping private keys secure.
+ *
+ * \param[in]  secure_key_handler_impl A pointer to the secure key handler implementation that manages the cryptographic operations.
+ * \param[in]  derivation_path The account derivation path used to derive the corresponding public key.
+ * \param[out] bip32_public_key A pointer to the BIP32 extended public key structure. This will be populated with the derived
+ *                              public key and chain code. The caller is responsible for managing the lifecycle of this
+ *                              public key by calling `cardano_bip32_public_key_unref` when it is no longer needed.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during the public key derivation process.
+ *
+ * \note The caller must ensure proper memory management by unreferencing the `bip32_public_key` when it is no longer needed.
+ *
+ * \see cardano_bip32_public_key_unref for proper memory cleanup of the public key.
+ */
+static cardano_error_t
+bip32_get_extended_account_public_key(
+  cardano_secure_key_handler_impl_t*      secure_key_handler_impl,
+  const cardano_account_derivation_path_t derivation_path,
+  cardano_bip32_public_key_t**            bip32_public_key)
+{
+  if ((secure_key_handler_impl == NULL) || (bip32_public_key == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  software_secure_key_handler_context_t* context = (software_secure_key_handler_context_t*)((void*)secure_key_handler_impl->context);
+
+  byte_t passphrase[128] = { 0 };
+
+  int32_t pass_len = context->get_passphrase(&passphrase[0], sizeof(passphrase));
+
+  if ((pass_len <= 0) || (pass_len > 128))
+  {
+    sodium_memzero(passphrase, sizeof(passphrase));
+
+    return CARDANO_ERROR_INVALID_PASSPHRASE;
+  }
+
+  cardano_buffer_t* decrypted_data = NULL;
+
+  cardano_error_t result = cardano_crypto_emip3_decrypt(
+    cardano_buffer_get_data(context->encrypted_data),
+    cardano_buffer_get_size(context->encrypted_data),
+    passphrase,
+    (size_t)pass_len,
+    &decrypted_data);
+
+  sodium_memzero(&passphrase[0], sizeof(passphrase));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_bip32_private_key_t* root_private_key    = NULL;
+  cardano_bip32_private_key_t* account_private_key = NULL;
+
+  result = cardano_bip32_private_key_from_bip39_entropy(NULL, 0, cardano_buffer_get_data(decrypted_data), cardano_buffer_get_size(decrypted_data), &root_private_key);
+
+  cardano_buffer_memzero(decrypted_data);
+  cardano_buffer_unref(&decrypted_data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const uint32_t path[3] = {
+    cardano_bip32_harden((uint32_t)derivation_path.purpose),
+    cardano_bip32_harden((uint32_t)derivation_path.coin_type),
+    cardano_bip32_harden((uint32_t)derivation_path.account)
+  };
+
+  result = cardano_bip32_private_key_derive(root_private_key, path, sizeof(path) / sizeof(uint32_t), &account_private_key);
+
+  cardano_bip32_private_key_unref(&root_private_key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_bip32_public_key_t* account_public_key = NULL;
+
+  result = cardano_bip32_private_key_get_public_key(account_private_key, &account_public_key);
+
+  cardano_bip32_private_key_unref(&account_private_key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *bip32_public_key = account_public_key;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Signs a hash using BIP32 Hierarchical Deterministic (HD) keys.
+ *
+ * The `bip32_sign_hash` function is the signing path shared by every BIP32 signing entry point. It decrypts the key
+ * material, derives the BIP32 private keys of the provided derivation paths, signs the given hash with each of them and
+ * generates a verification key witness set that contains the resulting signatures. The decrypted key material is wiped
+ * from memory as soon as it is no longer needed.
+ *
+ * \param[in]  secure_key_handler_impl A pointer to the secure key handler implementation that securely manages cryptographic operations.
+ * \param[in]  hash The hash to be signed, the id of a transaction or of a sub transaction. The hash is borrowed: this
+ *                   function never releases it and the caller retains ownership.
+ * \param[in]  derivation_paths An array of derivation paths specifying the private keys used to sign the hash.
+ * \param[in]  num_paths The number of derivation paths provided in the `derivation_paths` array.
+ * \param[out] vkey_witness_set A pointer to the verification key witness set, which will be populated with the
+ *                              signatures generated during the signing process. The caller is responsible for managing
+ *                              the lifecycle of the witness set by calling `cardano_vkey_witness_set_unref` when it is no longer needed.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during the signing process.
+ *
+ * \see cardano_vkey_witness_set_unref for proper memory cleanup of the witness set.
+ */
+static cardano_error_t
+bip32_sign_hash(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  const cardano_blake2b_hash_t*      hash,
+  const cardano_derivation_path_t*   derivation_paths,
+  const size_t                       num_paths,
+  cardano_vkey_witness_set_t**       vkey_witness_set)
+{
+  if ((secure_key_handler_impl == NULL) || (hash == NULL) || (derivation_paths == NULL) || (vkey_witness_set == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  software_secure_key_handler_context_t* context = (software_secure_key_handler_context_t*)((void*)secure_key_handler_impl->context);
+
+  if (context == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* decrypted_data = NULL;
+
+  byte_t passphrase[128] = { 0 };
+
+  int32_t pass_len = context->get_passphrase(&passphrase[0], sizeof(passphrase));
+
+  if ((pass_len <= 0) || (pass_len > 128))
+  {
+    sodium_memzero(passphrase, sizeof(passphrase));
+
+    return CARDANO_ERROR_INVALID_PASSPHRASE;
+  }
+
+  cardano_error_t result = cardano_crypto_emip3_decrypt(
+    cardano_buffer_get_data(context->encrypted_data),
+    cardano_buffer_get_size(context->encrypted_data),
+    passphrase,
+    (size_t)pass_len,
+    &decrypted_data);
+
+  sodium_memzero(passphrase, sizeof(passphrase));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_memzero(decrypted_data);
+    cardano_buffer_unref(&decrypted_data);
+
+    return result;
+  }
+
+  cardano_bip32_private_key_t* root_private_key = NULL;
+
+  result = cardano_bip32_private_key_from_bip39_entropy(NULL, 0, cardano_buffer_get_data(decrypted_data), cardano_buffer_get_size(decrypted_data), &root_private_key);
+
+  cardano_buffer_memzero(decrypted_data);
+  cardano_buffer_unref(&decrypted_data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_vkey_witness_set_new(vkey_witness_set);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_bip32_private_key_unref(&root_private_key);
+
+    return result;
+  }
+
+  for (size_t i = 0U; i < num_paths; ++i)
+  {
+    cardano_ed25519_private_key_t* ed25519_private_key = NULL;
+    cardano_bip32_private_key_t*   bip32_private_key   = NULL;
+
+    const uint32_t path[5] = {
+      cardano_bip32_harden((uint32_t)derivation_paths[i].purpose),
+      cardano_bip32_harden((uint32_t)derivation_paths[i].coin_type),
+      cardano_bip32_harden((uint32_t)derivation_paths[i].account),
+      (uint32_t)derivation_paths[i].role,
+      (uint32_t)derivation_paths[i].index
+    };
+
+    result = cardano_bip32_private_key_derive(root_private_key, &path[0], 5, &bip32_private_key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_vkey_witness_set_unref(vkey_witness_set);
+      cardano_bip32_private_key_unref(&root_private_key);
+
+      return result;
+    }
+
+    result = cardano_bip32_private_key_to_ed25519_key(bip32_private_key, &ed25519_private_key);
+
+    cardano_bip32_private_key_unref(&bip32_private_key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_vkey_witness_set_unref(vkey_witness_set);
+      cardano_bip32_private_key_unref(&root_private_key);
+
+      return result;
+    }
+
+    cardano_ed25519_signature_t*  signature  = NULL;
+    cardano_ed25519_public_key_t* public_key = NULL;
+    cardano_vkey_witness_t*       witness    = NULL;
+
+    result = cardano_ed25519_private_key_sign(ed25519_private_key, cardano_blake2b_hash_get_data(hash), cardano_blake2b_hash_get_bytes_size(hash), &signature);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_ed25519_private_key_unref(&ed25519_private_key);
+      cardano_vkey_witness_set_unref(vkey_witness_set);
+      cardano_bip32_private_key_unref(&root_private_key);
+
+      return result;
+    }
+
+    result = cardano_ed25519_private_key_get_public_key(ed25519_private_key, &public_key);
+
+    cardano_ed25519_private_key_unref(&ed25519_private_key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_ed25519_signature_unref(&signature);
+      cardano_vkey_witness_set_unref(vkey_witness_set);
+      cardano_bip32_private_key_unref(&root_private_key);
+
+      return result;
+    }
+
+    result = cardano_vkey_witness_new(public_key, signature, &witness);
+
+    cardano_ed25519_public_key_unref(&public_key);
+    cardano_ed25519_signature_unref(&signature);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_vkey_witness_unref(&witness);
+      cardano_vkey_witness_set_unref(vkey_witness_set);
+      cardano_bip32_private_key_unref(&root_private_key);
+
+      return result;
+    }
+
+    result = cardano_vkey_witness_set_add(*vkey_witness_set, witness);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_vkey_witness_unref(&witness);
+      cardano_vkey_witness_set_unref(vkey_witness_set);
+      cardano_bip32_private_key_unref(&root_private_key);
+
+      return result;
+    }
+
+    cardano_vkey_witness_unref(&witness);
+  }
+
+  cardano_bip32_private_key_unref(&root_private_key);
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Signs a transaction using BIP32 Hierarchical Deterministic (HD) keys.
+ *
+ * The `bip32_sign_transaction` function is responsible for signing a transaction by deriving the appropriate
+ * BIP32 private keys using the provided derivation paths. It generates a verification key witness set that contains
+ * the necessary signatures for the transaction.
+ *
+ * This function uses the secure key handler to access and manage the cryptographic operations necessary for deriving
+ * private keys and signing the transaction.
+ *
+ * \param[in]  secure_key_handler_impl A pointer to the secure key handler implementation that securely manages cryptographic operations.
+ * \param[in]  tx The transaction object to be signed.
+ * \param[in]  derivation_paths An array of derivation paths specifying the private keys used to sign the transaction.
+ * \param[in]  num_paths The number of derivation paths provided in the `derivation_paths` array.
+ * \param[out] vkey_witness_set A pointer to the verification key witness set, which will be populated with the
+ *                              signatures generated during the signing process. The caller is responsible for managing
+ *                              the lifecycle of the witness set by calling `cardano_vkey_witness_set_unref` when it is no longer needed.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during the signing process.
+ *
+ * \note The function assumes that the necessary private keys are securely stored and managed by the key handler.
+ *       The caller is responsible for ensuring that the `vkey_witness_set` is unreferenced properly to prevent memory leaks.
+ *
+ * \see cardano_vkey_witness_set_unref for proper memory cleanup of the witness set.
+ */
+static cardano_error_t
+bip32_sign_transaction(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_transaction_t*             tx,
+  const cardano_derivation_path_t*   derivation_paths,
+  const size_t                       num_paths,
+  cardano_vkey_witness_set_t**       vkey_witness_set)
+{
+  if ((secure_key_handler_impl == NULL) || (tx == NULL) || (derivation_paths == NULL) || (vkey_witness_set == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t* hash = cardano_transaction_get_id(tx);
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = bip32_sign_hash(secure_key_handler_impl, hash, derivation_paths, num_paths, vkey_witness_set);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+/**
+ * \brief Signs a sub transaction using BIP32 Hierarchical Deterministic (HD) keys.
+ *
+ * The `bip32_sign_sub_transaction` function is responsible for signing a sub transaction by deriving the appropriate
+ * BIP32 private keys using the provided derivation paths. It generates a verification key witness set that contains
+ * the necessary signatures for the sub transaction. What is signed is the id of the sub transaction, the hash of its body.
+ *
+ * This function uses the secure key handler to access and manage the cryptographic operations necessary for deriving
+ * private keys and signing the sub transaction.
+ *
+ * \param[in]  secure_key_handler_impl A pointer to the secure key handler implementation that securely manages cryptographic operations.
+ * \param[in]  sub_tx The sub transaction object to be signed.
+ * \param[in]  derivation_paths An array of derivation paths specifying the private keys used to sign the sub transaction.
+ * \param[in]  num_paths The number of derivation paths provided in the `derivation_paths` array.
+ * \param[out] vkey_witness_set A pointer to the verification key witness set, which will be populated with the
+ *                              signatures generated during the signing process. The caller is responsible for managing
+ *                              the lifecycle of the witness set by calling `cardano_vkey_witness_set_unref` when it is no longer needed.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during the signing process.
+ *
+ * \note The function assumes that the necessary private keys are securely stored and managed by the key handler.
+ *       The caller is responsible for ensuring that the `vkey_witness_set` is unreferenced properly to prevent memory leaks.
+ *
+ * \see cardano_vkey_witness_set_unref for proper memory cleanup of the witness set.
+ */
+static cardano_error_t
+bip32_sign_sub_transaction(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_sub_transaction_t*         sub_tx,
+  const cardano_derivation_path_t*   derivation_paths,
+  const size_t                       num_paths,
+  cardano_vkey_witness_set_t**       vkey_witness_set)
+{
+  if ((secure_key_handler_impl == NULL) || (sub_tx == NULL) || (derivation_paths == NULL) || (vkey_witness_set == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t* hash = cardano_sub_transaction_get_id(sub_tx);
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = bip32_sign_hash(secure_key_handler_impl, hash, derivation_paths, num_paths, vkey_witness_set);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+/**
+ * \brief Retrieves the public key for the Ed25519 key pair.
+ *
+ * The `ed25519_get_public_key` function retrieves the Ed25519 public key associated with the private key
+ * managed by the secure key handler implementation. The retrieved public key is intended for cryptographic
+ * operations like transaction verification or signature validation.
+ *
+ * \param[in]  secure_key_handler_impl A pointer to the secure key handler implementation that securely manages
+ *                                     the Ed25519 key operations.
+ * \param[out] public_key A pointer to the Ed25519 public key that will be populated by the function.
+ *                        The caller is responsible for managing the lifecycle of the public key by calling
+ *                        `cardano_ed25519_public_key_unref` when it is no longer needed.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during the process of retrieving the public key.
+ *
+ * \note The public key is derived from the private key managed by the secure key handler. This function ensures
+ *       that the private key is securely accessed, and the public key is properly returned. The caller is responsible for
+ *       unreferencing the public key to prevent memory leaks.
+ *
+ * \see cardano_ed25519_public_key_unref for proper memory cleanup of the public key.
+ */
+static cardano_error_t
+ed25519_get_public_key(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_ed25519_public_key_t**     public_key)
+{
+  if ((secure_key_handler_impl == NULL) || (public_key == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  software_secure_key_handler_context_t* context = (software_secure_key_handler_context_t*)((void*)secure_key_handler_impl->context);
+
+  if (context == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* decrypted_data = NULL;
+
+  byte_t  passphrase[128] = { 0 };
+  int32_t pass_len        = context->get_passphrase(&passphrase[0], sizeof(passphrase));
+
+  if ((pass_len <= 0) || (pass_len > 128))
+  {
+    sodium_memzero(passphrase, sizeof(passphrase));
+
+    return CARDANO_ERROR_INVALID_PASSPHRASE;
+  }
+
+  cardano_error_t result = cardano_crypto_emip3_decrypt(
+    cardano_buffer_get_data(context->encrypted_data),
+    cardano_buffer_get_size(context->encrypted_data),
+    passphrase,
+    (size_t)pass_len,
+    &decrypted_data);
+
+  sodium_memzero(passphrase, sizeof(passphrase));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_memzero(decrypted_data);
+    cardano_buffer_unref(&decrypted_data);
+
+    return result;
+  }
+
+  cardano_ed25519_private_key_t* ed25519_private_key = NULL;
+
+  if (cardano_buffer_get_size(decrypted_data) == 64U)
+  {
+    result = cardano_ed25519_private_key_from_extended_bytes(cardano_buffer_get_data(decrypted_data), cardano_buffer_get_size(decrypted_data), &ed25519_private_key);
+  }
+  else
+  {
+    result = cardano_ed25519_private_key_from_normal_bytes(cardano_buffer_get_data(decrypted_data), cardano_buffer_get_size(decrypted_data), &ed25519_private_key);
+  }
+
+  cardano_buffer_memzero(decrypted_data);
+  cardano_buffer_unref(&decrypted_data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_private_key_unref(&ed25519_private_key);
+
+    return result;
+  }
+
+  result = cardano_ed25519_private_key_get_public_key(ed25519_private_key, public_key);
+
+  cardano_ed25519_private_key_unref(&ed25519_private_key);
+
+  return result;
+}
+
+/**
+ * \brief Signs a hash using the Ed25519 private key.
+ *
+ * The `ed25519_sign_hash` function is the signing path shared by every Ed25519 signing entry point. It decrypts the
+ * Ed25519 private key managed by the secure key handler implementation, signs the given hash with it and generates a
+ * verification key witness set that contains the public key and the resulting signature. The decrypted key material is
+ * wiped from memory as soon as it is no longer needed.
+ *
+ * \param[in]  secure_key_handler_impl A pointer to the secure key handler implementation that securely manages
+ *                                     the Ed25519 key operations.
+ * \param[in]  hash                    The hash to be signed, the id of a transaction or of a sub transaction.
+ *                                     The hash is borrowed: this function never releases it and the caller retains
+ *                                     ownership.
+ * \param[out] vkey_witness_set        A pointer to the verification key witness set, which will be populated by the
+ *                                     function with the signature and the associated public key.
+ *                                     The caller is responsible for managing the lifecycle of this witness set and releasing
+ *                                     it when no longer needed.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during the signing process.
+ *
+ * \see cardano_vkey_witness_set_unref for proper memory cleanup of the witness set.
+ */
+static cardano_error_t
+ed25519_sign_hash(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  const cardano_blake2b_hash_t*      hash,
+  cardano_vkey_witness_set_t**       vkey_witness_set)
+{
+  if ((secure_key_handler_impl == NULL) || (hash == NULL) || (vkey_witness_set == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  software_secure_key_handler_context_t* context = (software_secure_key_handler_context_t*)((void*)secure_key_handler_impl->context);
+
+  if (context == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* decrypted_data = NULL;
+
+  byte_t passphrase[128] = { 0 };
+
+  int32_t pass_len = context->get_passphrase(&passphrase[0], sizeof(passphrase));
+
+  if ((pass_len <= 0) || (pass_len > 128))
+  {
+    sodium_memzero(passphrase, sizeof(passphrase));
+
+    return CARDANO_ERROR_INVALID_PASSPHRASE;
+  }
+
+  cardano_error_t result = cardano_crypto_emip3_decrypt(
+    cardano_buffer_get_data(context->encrypted_data),
+    cardano_buffer_get_size(context->encrypted_data),
+    passphrase,
+    (size_t)pass_len,
+    &decrypted_data);
+
+  sodium_memzero(passphrase, sizeof(passphrase));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_memzero(decrypted_data);
+    cardano_buffer_unref(&decrypted_data);
+
+    return result;
+  }
+
+  cardano_ed25519_private_key_t* private_key = NULL;
+  cardano_ed25519_public_key_t*  public_key  = NULL;
+  cardano_ed25519_signature_t*   signature   = NULL;
+  cardano_vkey_witness_t*        witness     = NULL;
+
+  if (cardano_buffer_get_size(decrypted_data) == 64U)
+  {
+    result = cardano_ed25519_private_key_from_extended_bytes(cardano_buffer_get_data(decrypted_data), cardano_buffer_get_size(decrypted_data), &private_key);
+  }
+  else
+  {
+    result = cardano_ed25519_private_key_from_normal_bytes(cardano_buffer_get_data(decrypted_data), cardano_buffer_get_size(decrypted_data), &private_key);
+  }
+
+  cardano_buffer_memzero(decrypted_data);
+  cardano_buffer_unref(&decrypted_data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_private_key_unref(&private_key);
+
+    return result;
+  }
+
+  result = cardano_vkey_witness_set_new(vkey_witness_set);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_private_key_unref(&private_key);
+
+    return result;
+  }
+
+  result = cardano_ed25519_private_key_sign(private_key, cardano_blake2b_hash_get_data(hash), cardano_blake2b_hash_get_bytes_size(hash), &signature);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_signature_unref(&signature);
+    cardano_vkey_witness_set_unref(vkey_witness_set);
+    cardano_ed25519_private_key_unref(&private_key);
+
+    return result;
+  }
+
+  result = cardano_ed25519_private_key_get_public_key(private_key, &public_key);
+
+  cardano_ed25519_private_key_unref(&private_key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_signature_unref(&signature);
+    cardano_vkey_witness_set_unref(vkey_witness_set);
+
+    return result;
+  }
+
+  result = cardano_vkey_witness_new(public_key, signature, &witness);
+
+  cardano_ed25519_public_key_unref(&public_key);
+  cardano_ed25519_signature_unref(&signature);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_vkey_witness_set_unref(vkey_witness_set);
+
+    return result;
+  }
+
+  result = cardano_vkey_witness_set_add(*vkey_witness_set, witness);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_vkey_witness_unref(&witness);
+    cardano_vkey_witness_set_unref(vkey_witness_set);
+
+    return result;
+  }
+
+  cardano_vkey_witness_unref(&witness);
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Signs a transaction using the Ed25519 private key.
+ *
+ * The `ed25519_sign_transaction` function signs the provided transaction using the Ed25519 private key
+ * managed by the secure key handler implementation. The function generates the necessary verification
+ * key witness set, which contains the public keys and signatures required for transaction validation.
+ *
+ * \param[in]  secure_key_handler_impl A pointer to the secure key handler implementation that securely manages
+ *                                     the Ed25519 key operations.
+ * \param[in]  tx                      The transaction object to be signed.
+ * \param[out] vkey_witness_set        A pointer to the verification key witness set, which will be populated by the
+ *                                     function with the signatures and associated public keys required for the transaction.
+ *                                     The caller is responsible for managing the lifecycle of this witness set and releasing
+ *                                     it when no longer needed.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during the signing process.
+ *
+ * \note The Ed25519 private key is securely accessed to sign the transaction. The public key and signature generated
+ *       are added to the `vkey_witness_set`. The caller must ensure that the `vkey_witness_set` is properly released
+ *       after use to avoid memory leaks.
+ *
+ * \see cardano_vkey_witness_set_unref for proper memory cleanup of the witness set.
+ */
+static cardano_error_t
+ed25519_sign_transaction(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_transaction_t*             tx,
+  cardano_vkey_witness_set_t**       vkey_witness_set)
+{
+  if ((secure_key_handler_impl == NULL) || (tx == NULL) || (vkey_witness_set == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t* hash = cardano_transaction_get_id(tx);
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = ed25519_sign_hash(secure_key_handler_impl, hash, vkey_witness_set);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+/**
+ * \brief Signs a sub transaction using the Ed25519 private key.
+ *
+ * The `ed25519_sign_sub_transaction` function signs the id of the provided sub transaction (the hash of its body)
+ * using the Ed25519 private key managed by the secure key handler implementation. The function generates the necessary
+ * verification key witness set, which contains the public keys and signatures required for sub transaction validation.
+ *
+ * \param[in]  secure_key_handler_impl A pointer to the secure key handler implementation that securely manages
+ *                                     the Ed25519 key operations.
+ * \param[in]  sub_tx                  The sub transaction object to be signed.
+ * \param[out] vkey_witness_set        A pointer to the verification key witness set, which will be populated by the
+ *                                     function with the signatures and associated public keys required for the sub transaction.
+ *                                     The caller is responsible for managing the lifecycle of this witness set and releasing
+ *                                     it when no longer needed.
+ *
+ * \returns `cardano_error_t` indicating success or the type of error encountered during the signing process.
+ *
+ * \note The Ed25519 private key is securely accessed to sign the sub transaction. The public key and signature generated
+ *       are added to the `vkey_witness_set`. The caller must ensure that the `vkey_witness_set` is properly released
+ *       after use to avoid memory leaks.
+ *
+ * \see cardano_vkey_witness_set_unref for proper memory cleanup of the witness set.
+ */
+static cardano_error_t
+ed25519_sign_sub_transaction(
+  cardano_secure_key_handler_impl_t* secure_key_handler_impl,
+  cardano_sub_transaction_t*         sub_tx,
+  cardano_vkey_witness_set_t**       vkey_witness_set)
+{
+  if ((secure_key_handler_impl == NULL) || (sub_tx == NULL) || (vkey_witness_set == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t* hash = cardano_sub_transaction_get_id(sub_tx);
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = ed25519_sign_hash(secure_key_handler_impl, hash, vkey_witness_set);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_software_secure_key_handler_new(
+  const byte_t*                  entropy_bytes,
+  size_t                         entropy_bytes_len,
+  const byte_t*                  passphrase,
+  size_t                         passphrase_len,
+  cardano_get_passphrase_func_t  get_passphrase,
+  cardano_secure_key_handler_t** secure_key_handler)
+{
+  static const char*                handler_name = "BIP32 Software Secure Key Handler";
+  cardano_secure_key_handler_impl_t impl         = { 0 };
+
+  cardano_safe_memcpy(impl.name, 256U, handler_name, cardano_safe_strlen(handler_name, 256U));
+
+  if (entropy_bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (entropy_bytes_len == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (passphrase == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (passphrase_len == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (get_passphrase == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (secure_key_handler == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  software_secure_key_handler_context_t* context = cardano_software_secure_key_handler_context_new();
+
+  if (context == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_crypto_emip3_encrypt(entropy_bytes, entropy_bytes_len, passphrase, passphrase_len, &context->encrypted_data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_deallocate(context);
+
+    return result;
+  }
+
+  impl.bip32_get_extended_account_public_key = bip32_get_extended_account_public_key;
+  impl.bip32_sign_transaction                = bip32_sign_transaction;
+  impl.bip32_sign_sub_transaction            = bip32_sign_sub_transaction;
+  impl.ed25519_get_public_key                = NULL;
+  impl.ed25519_sign_transaction              = NULL;
+  impl.ed25519_sign_sub_transaction          = NULL;
+  impl.serialize                             = serialize;
+  impl.type                                  = CARDANO_SECURE_KEY_HANDLER_TYPE_BIP32;
+
+  context->get_passphrase = get_passphrase;
+
+  impl.context = (cardano_object_t*)((void*)context);
+
+  result = cardano_secure_key_handler_new(impl, secure_key_handler);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_deallocate(context);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_software_secure_key_handler_ed25519_new(
+  cardano_ed25519_private_key_t* ed25519_private_key,
+  const byte_t*                  passphrase,
+  size_t                         passphrase_len,
+  cardano_get_passphrase_func_t  get_passphrase,
+  cardano_secure_key_handler_t** secure_key_handler)
+{
+  static const char*                handler_name = "Ed25519 Software Secure Key Handler";
+  cardano_secure_key_handler_impl_t impl         = { 0 };
+
+  cardano_safe_memcpy(impl.name, 256U, handler_name, cardano_safe_strlen(handler_name, 256U));
+
+  if (ed25519_private_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (passphrase == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (passphrase_len == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (get_passphrase == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (secure_key_handler == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  software_secure_key_handler_context_t* context = cardano_software_secure_key_handler_context_new();
+
+  if (context == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_crypto_emip3_encrypt(cardano_ed25519_private_key_get_data(ed25519_private_key), cardano_ed25519_private_key_get_bytes_size(ed25519_private_key), passphrase, passphrase_len, &context->encrypted_data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_deallocate(context);
+
+    return result;
+  }
+
+  impl.bip32_get_extended_account_public_key = NULL;
+  impl.bip32_sign_transaction                = NULL;
+  impl.bip32_sign_sub_transaction            = NULL;
+  impl.ed25519_get_public_key                = ed25519_get_public_key;
+  impl.ed25519_sign_transaction              = ed25519_sign_transaction;
+  impl.ed25519_sign_sub_transaction          = ed25519_sign_sub_transaction;
+  impl.serialize                             = serialize;
+  impl.type                                  = CARDANO_SECURE_KEY_HANDLER_TYPE_ED25519;
+
+  context->get_passphrase = get_passphrase;
+
+  impl.context = (cardano_object_t*)((void*)context);
+
+  result = cardano_secure_key_handler_new(impl, secure_key_handler);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_deallocate(context);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_software_secure_key_handler_deserialize(
+  const byte_t*                  serialized_data,
+  const size_t                   serialized_data_len,
+  cardano_get_passphrase_func_t  get_passphrase,
+  cardano_secure_key_handler_t** secure_key_handler)
+{
+  if ((serialized_data == NULL) || (get_passphrase == NULL) || (secure_key_handler == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (serialized_data_len == 0U)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  cardano_buffer_t* data = cardano_buffer_new(serialized_data_len);
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_buffer_write(data, serialized_data, serialized_data_len);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&data);
+
+    return result;
+  }
+
+  uint32_t          magic          = 0U;
+  uint8_t           version        = 0U;
+  uint8_t           type           = 0U;
+  cardano_buffer_t* encrypted_data = NULL;
+  uint32_t          checksum       = 0U;
+
+  result = cardano_buffer_read_uint32_be(data, &magic);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&data);
+
+    return result;
+  }
+
+  if (magic != SW_SECURE_KEY_BINARY_FORMAT_HANDLER_MAGIC)
+  {
+    cardano_buffer_unref(&data);
+
+    return CARDANO_ERROR_INVALID_MAGIC;
+  }
+
+  result = cardano_buffer_read(data, &version, 1U);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&data);
+
+    return result;
+  }
+
+  if (version != SW_SECURE_KEY_BINARY_FORMAT_VERSION)
+  {
+    cardano_buffer_unref(&data);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = cardano_buffer_read(data, &type, sizeof(type));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&data);
+
+    return result;
+  }
+
+  if ((type != (uint8_t)CARDANO_SECURE_KEY_HANDLER_TYPE_ED25519) && (type != (uint8_t)CARDANO_SECURE_KEY_HANDLER_TYPE_BIP32))
+  {
+    cardano_buffer_unref(&data);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  uint32_t encrypted_data_size = 0U;
+  result                       = cardano_buffer_read_uint32_be(data, &encrypted_data_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&data);
+
+    return result;
+  }
+
+  if (encrypted_data_size == 0U)
+  {
+    cardano_buffer_unref(&data);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  // The header is ten bytes and the checksum is four bytes. Check by subtraction
+  // so that even UINT32_MAX payload lengths cannot overflow on 32-bit platforms.
+  if ((serialized_data_len < 14U) || (encrypted_data_size > (serialized_data_len - 14U)))
+  {
+    cardano_buffer_unref(&data);
+
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  encrypted_data = cardano_buffer_new(encrypted_data_size);
+
+  if (encrypted_data == NULL)
+  {
+    cardano_buffer_unref(&data);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_buffer_set_size(encrypted_data, encrypted_data_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&encrypted_data);
+    cardano_buffer_unref(&data);
+
+    return result;
+  }
+
+  result = cardano_buffer_read(data, cardano_buffer_get_data(encrypted_data), encrypted_data_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&encrypted_data);
+    cardano_buffer_unref(&data);
+
+    return result;
+  }
+
+  result = cardano_buffer_read_uint32_be(data, &checksum);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&encrypted_data);
+    cardano_buffer_unref(&data);
+
+    return result;
+  }
+
+  const uint32_t expected_checksum = cardano_checksum_crc32(serialized_data, (serialized_data_len - 4U));
+
+  if (checksum != expected_checksum)
+  {
+    cardano_buffer_unref(&encrypted_data);
+    cardano_buffer_unref(&data);
+
+    return CARDANO_ERROR_CHECKSUM_MISMATCH;
+  }
+
+  cardano_secure_key_handler_impl_t impl = { 0 };
+
+  software_secure_key_handler_context_t* context = cardano_software_secure_key_handler_context_new();
+
+  if (context == NULL)
+  {
+    cardano_buffer_unref(&encrypted_data);
+    cardano_buffer_unref(&data);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  switch ((cardano_secure_key_handler_type_t)type)
+  {
+    case CARDANO_SECURE_KEY_HANDLER_TYPE_ED25519:
+    {
+      static const char* ed25519_handler_name = "Ed25519 Software Secure Key Handler";
+      cardano_safe_memcpy(impl.name, sizeof(impl.name), ed25519_handler_name, cardano_safe_strlen(ed25519_handler_name, sizeof(impl.name)));
+      impl.bip32_get_extended_account_public_key = NULL;
+      impl.bip32_sign_transaction                = NULL;
+      impl.bip32_sign_sub_transaction            = NULL;
+      impl.ed25519_get_public_key                = ed25519_get_public_key;
+      impl.ed25519_sign_transaction              = ed25519_sign_transaction;
+      impl.ed25519_sign_sub_transaction          = ed25519_sign_sub_transaction;
+      impl.serialize                             = serialize;
+
+      context->get_passphrase = get_passphrase;
+      context->encrypted_data = encrypted_data;
+
+      impl.type    = CARDANO_SECURE_KEY_HANDLER_TYPE_ED25519;
+      impl.context = (cardano_object_t*)((void*)context);
+
+      break;
+    }
+    case CARDANO_SECURE_KEY_HANDLER_TYPE_BIP32:
+    {
+      static const char* bip32_handler_name = "BIP32 Software Secure Key Handler";
+      cardano_safe_memcpy(impl.name, sizeof(impl.name), bip32_handler_name, cardano_safe_strlen(bip32_handler_name, sizeof(impl.name)));
+
+      impl.bip32_get_extended_account_public_key = bip32_get_extended_account_public_key;
+      impl.bip32_sign_transaction                = bip32_sign_transaction;
+      impl.bip32_sign_sub_transaction            = bip32_sign_sub_transaction;
+      impl.ed25519_get_public_key                = NULL;
+      impl.ed25519_sign_transaction              = NULL;
+      impl.ed25519_sign_sub_transaction          = NULL;
+      impl.serialize                             = serialize;
+
+      context->get_passphrase = get_passphrase;
+      context->encrypted_data = encrypted_data;
+
+      impl.type    = CARDANO_SECURE_KEY_HANDLER_TYPE_BIP32;
+      impl.context = (cardano_object_t*)((void*)context);
+
+      break;
+    }
+    default:
+    {
+      cardano_secure_key_handler_deallocate(context);
+      cardano_buffer_unref(&encrypted_data);
+      cardano_buffer_unref(&data);
+
+      return CARDANO_ERROR_DECODING;
+    }
+  }
+
+  cardano_buffer_unref(&data);
+
+  result = cardano_secure_key_handler_new(impl, secure_key_handler);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_secure_key_handler_deallocate(context);
+  }
+
+  return result;
+}
diff --git a/vendor/src/message_signing/cip8.c b/vendor/src/message_signing/cip8.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/message_signing/cip8.c
@@ -0,0 +1,923 @@
+/**
+ * \file cip8.c
+ *
+ * \author angel.castillo
+ * \date   Nov 21, 2025
+ *
+ * Copyright 2025 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <assert.h>
+#include <cardano/message_signing/cip8.h>
+#include <src/string_safe.h>
+#include <string.h>
+
+/* STATIC CONSTANTS **********************************************************/
+
+// cppcheck-suppress misra-c2012-8.9
+static const int32_t COSE_HEADER_ALG_LABEL = 1; /* alg */
+// cppcheck-suppress misra-c2012-8.9
+static const int32_t COSE_HEADER_KID_LABEL = 4; /* kid */
+
+// cppcheck-suppress misra-c2012-8.9
+static const int32_t COSE_KEY_LABEL_KTY = 1; /* key type */
+// cppcheck-suppress misra-c2012-8.9
+static const int32_t COSE_KEY_LABEL_KID = 2; /* key id */
+// cppcheck-suppress misra-c2012-8.9
+static const int32_t COSE_KEY_LABEL_ALG = 3; /* algorithm */
+// cppcheck-suppress misra-c2012-8.9
+static const int32_t COSE_KEY_LABEL_CRV = -1; /* curve */
+// cppcheck-suppress misra-c2012-8.9
+static const int32_t COSE_KEY_LABEL_X = -2; /* public key bytes */
+
+// cppcheck-suppress misra-c2012-8.9
+static const int32_t COSE_KTY_OKP = 1; /* OKP */
+// cppcheck-suppress misra-c2012-8.9
+static const int32_t COSE_ALG_EDDSA = -8; /* EdDSA */
+// cppcheck-suppress misra-c2012-8.9
+static const int32_t COSE_CRV_ED25519 = 6; /* Ed25519 */
+
+/* STATIC FUNCTIONS ***********************************************************/
+
+/**
+ * \brief Builds the protected header map used in CIP-8 COSE_Sign1 structures for
+ *        address-bound signatures.
+ *
+ * This function constructs the CBOR-encoded protected headers required by CIP-8.
+ * The resulting protected header map has the following shape:
+ *
+ * \code{.cbor}
+ * {
+ *   1:  -8,
+ *   4:  <address_bytes>,
+ *   "address": <address_bytes>
+ * }
+ * \endcode
+ *
+ * The encoded map is returned as a \ref cardano_buffer_t containing the CBOR
+ * bytes for the protected header bstr. This buffer must be released with
+ * \ref cardano_buffer_unref() by the caller.
+ *
+ * \param[in]  address_bytes   Pointer to the raw address bytes.
+ * \param[in]  address_size    Size of \p address_bytes in bytes.
+ * \param[out] protected_bstr_out
+ *                             On success, receives a newly allocated buffer
+ *                             containing the CBOR-encoded protected header bstr.
+ *                             The caller takes ownership and must unref it.
+ *
+ * \retval CARDANO_SUCCESS                   The protected header was generated.
+ * \retval CARDANO_ERROR_POINTER_IS_NULL     A required argument is NULL.
+ * \retval CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *                                           Memory allocation failed.
+ * \retval CARDANO_ERROR_CBOR_ENCODING       An encoding error occurred while
+ *                                           writing the CBOR map.
+ *
+ * \note The protected headers are immutable, as required by COSE.
+ * \note The address bytes are included twice: once under COSE header label `4`
+ *       (`kid`), and once under the CIP-8 semantic field `"address"` to allow
+ *       Cardano-specific verifiers to bind the signature to an address.
+ */
+static cardano_error_t
+cip8_build_protected_headers(
+  const byte_t*      address_bytes,
+  const size_t       address_size,
+  cardano_buffer_t** protected_bstr_out)
+{
+  assert(address_size > 0U);
+  assert(protected_bstr_out != NULL);
+
+  if (address_bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *protected_bstr_out = NULL;
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_cbor_writer_write_start_map(writer, 3);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, COSE_HEADER_ALG_LABEL);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_signed_int(writer, COSE_ALG_EDDSA);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, COSE_HEADER_KID_LABEL);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, address_bytes, address_size);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  static const char ADDRESS_LABEL[] = "address";
+
+  result = cardano_cbor_writer_write_textstring(writer, ADDRESS_LABEL, sizeof(ADDRESS_LABEL) - 1U);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, address_bytes, address_size);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_encode_in_buffer(writer, protected_bstr_out);
+
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+/**
+ * \brief Builds the protected header map used in CIP-8 COSE_Sign1 structures
+ *        for key-hash–bound signatures.
+ *
+ * This function constructs the CBOR-encoded protected headers required by CIP-8
+ * when the signature is bound to a payment key hash rather than a full address.
+ *
+ * The resulting protected header map has the following form:
+ *
+ * \code{.cbor}
+ * {
+ *   1:  -8,
+ *   "address": <key_hash_bytes>
+ * }
+ * \endcode
+ *
+ * The encoded map is returned as a \ref cardano_buffer_t containing the CBOR
+ * bytes corresponding to the protected header bstr. The caller becomes the
+ * owner of the returned buffer and must release it with
+ * \ref cardano_buffer_unref().
+ *
+ * \param[in]  key_hash_bytes   Pointer to the raw Blake2b-224 key hash bytes.
+ * \param[in]  key_hash_size    Size of \p key_hash_bytes in bytes.
+ * \param[out] protected_bstr_out
+ *                               On success, receives a newly allocated buffer
+ *                               containing the CBOR-encoded protected headers.
+ *                               Must be freed with \ref cardano_buffer_unref().
+ *
+ * \retval CARDANO_SUCCESS                    The protected headers were built.
+ * \retval CARDANO_ERROR_POINTER_IS_NULL      A required pointer argument is NULL.
+ * \retval CARDANO_ERROR_INVALID_ARGUMENT      The key hash is empty or invalid.
+ * \retval CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *                                            Memory allocation failed.
+ * \retval CARDANO_ERROR_CBOR_ENCODING        A CBOR encoding error occurred.
+ *
+ * \note The protected header is immutable by COSE design.
+ */
+static cardano_error_t
+cip8_build_protected_headers_for_key_hash(
+  const byte_t*      key_hash_bytes,
+  const size_t       key_hash_size,
+  cardano_buffer_t** protected_bstr_out)
+{
+  assert(key_hash_size > 0U);
+  assert(protected_bstr_out != NULL);
+
+  if (key_hash_bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *protected_bstr_out = NULL;
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_cbor_writer_write_start_map(writer, 2);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, COSE_HEADER_ALG_LABEL);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_signed_int(writer, COSE_ALG_EDDSA);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  static const char ADDRESS_LABEL[] = "address";
+
+  result = cardano_cbor_writer_write_textstring(writer, ADDRESS_LABEL, sizeof(ADDRESS_LABEL) - 1U);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, key_hash_bytes, key_hash_size);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_encode_in_buffer(writer, protected_bstr_out);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+/**
+ * \brief Builds and signs the CIP-8 Sig_structure for a COSE_Sign1 signature.
+ *
+ * This function constructs the COSE_Sign1 Sig_structure defined by RFC 8152
+ * and required by CIP-8, then uses the provided Ed25519 private key to sign it.
+ *
+ * The Sig_structure is defined as:
+ *
+ * \code{.cbor}
+ * Sig_structure = [
+ *   "Signature1",
+ *   protected,
+ *   external_aad,
+ *   payload
+ * ]
+ * \endcode
+ *
+ * Where:
+ *   - `"Signature1"` is the fixed COSE context string.
+ *   - `protected` is the raw bstr of the protected headers.
+ *   - `external_aad` is always the empty bstr for CIP-8.
+ *   - `payload` is the original message being signed.
+ *
+ * This function:
+ *   1. CBOR-encodes the Sig_structure into a temporary buffer.
+ *   2. Signs the encoded bytes using Ed25519.
+ *   3. Returns the resulting signature object.
+ *
+ * The caller takes ownership of \p signature_out and must free it using
+ * \ref cardano_ed25519_signature_unref().
+ *
+ * \param[in]  message         Pointer to the message to be signed.
+ * \param[in]  message_size    Size of \p message in bytes.
+ * \param[in]  protected_bstr  The CBOR-encoded protected header bstr produced
+ *                             by CIP-8 header construction functions.
+ * \param[in]  signing_key     The Ed25519 private key used to sign the structure.
+ * \param[out] signature_out   On success, receives a newly allocated signature
+ *                             object. Must be unref'd with
+ *                             \ref cardano_ed25519_signature_unref().
+ *
+ * \retval CARDANO_SUCCESS                      The Sig_structure was signed successfully.
+ * \retval CARDANO_ERROR_POINTER_IS_NULL        One of the arguments is NULL.
+ * \retval CARDANO_ERROR_INVALID_ARGUMENT       The message size is zero.
+ * \retval CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *                                              Memory allocation failed.
+ * \retval CARDANO_ERROR_CBOR_ENCODING          Failed to encode the Sig_structure.
+ * \retval CARDANO_ERROR_CRYPTO                 An error occurred during signing.
+ *
+ * \note This function does **not** modify \p protected_bstr or \p message.
+ * \note The caller is responsible for passing a valid protected header bstr.
+ */
+static cardano_error_t
+cip8_sign_sig_structure(
+  const byte_t*                        message,
+  const size_t                         message_size,
+  const cardano_buffer_t*              protected_bstr,
+  const cardano_ed25519_private_key_t* signing_key,
+  cardano_ed25519_signature_t**        signature_out)
+{
+  assert(message != NULL);
+  assert(message_size > 0U);
+  assert(signature_out != NULL);
+  assert(signing_key != NULL);
+  assert(protected_bstr != NULL);
+
+  *signature_out = NULL;
+
+  const byte_t* body_protected      = cardano_buffer_get_data(protected_bstr);
+  const size_t  body_protected_size = cardano_buffer_get_size(protected_bstr);
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_cbor_writer_write_start_array(writer, 4);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  static const char CONTEXT_SIGNATURE1[] = "Signature1";
+
+  result = cardano_cbor_writer_write_textstring(writer, CONTEXT_SIGNATURE1, sizeof(CONTEXT_SIGNATURE1) - 1U);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, body_protected, body_protected_size);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  static const byte_t EMPTY_BYTES[1] = { 0 };
+  result                             = cardano_cbor_writer_write_bytestring(writer, EMPTY_BYTES, 0U);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, message, message_size);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  cardano_buffer_t* sig_struct_buf = NULL;
+  result                           = cardano_cbor_writer_encode_in_buffer(writer, &sig_struct_buf);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  const byte_t* sig_struct_bytes = cardano_buffer_get_data(sig_struct_buf);
+  const size_t  sig_struct_size  = cardano_buffer_get_size(sig_struct_buf);
+
+  result = cardano_ed25519_private_key_sign(
+    signing_key,
+    sig_struct_bytes,
+    sig_struct_size,
+    signature_out);
+
+  cardano_buffer_unref(&sig_struct_buf);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+/**
+ * \brief Constructs a COSE_Sign1 structure for CIP-8.
+ *
+ * This function builds the full COSE_Sign1 object required by CIP-8, using the
+ * already-signed Ed25519 signature and the protected headers.
+ *
+ * The produced COSE_Sign1 structure has the canonical form:
+ *
+ * \code{.cbor}
+ * COSE_Sign1 = [
+ *   protected : bstr,
+ *   unprotected : { "hashed" : false },
+ *   payload : bstr,
+ *   signature : bstr
+ * ]
+ * \endcode
+ *
+ * Where:
+ *   - `protected` is the raw bstr of the CBOR-encoded protected header map.
+ *   - `unprotected` always contains `"hashed" = false` for CIP-8.
+ *   - `payload` is the message being signed (as a bstr).
+ *   - `signature` is the raw Ed25519 signature.
+ *
+ * This function:
+ *   1. Assembles the 4-element COSE_Sign1 array.
+ *   2. Encodes it into a CBOR buffer.
+ *   3. Returns the resulting buffer to the caller.
+ *
+ * Upon success, the caller takes ownership of \p cose_sign1_out, which must be
+ * freed using \ref cardano_buffer_unref().
+ *
+ * \param[in]  message         The message payload to embed inside the COSE_Sign1.
+ * \param[in]  message_size    Size of \p message in bytes.
+ * \param[in]  protected_bstr  The CBOR-encoded protected header bstr previously
+ *                             produced by CIP-8 header construction.
+ * \param[in]  signature       The Ed25519 signature object returned by
+ *                             \ref cip8_sign_sig_structure().
+ * \param[out] cose_sign1_out  On success, receives the newly allocated COSE_Sign1
+ *                             buffer. Must be released with \ref cardano_buffer_unref().
+ *
+ * \retval CARDANO_SUCCESS                      The COSE_Sign1 object was built successfully.
+ * \retval CARDANO_ERROR_POINTER_IS_NULL        A required pointer argument is NULL.
+ * \retval CARDANO_ERROR_INVALID_ARGUMENT       The message size was zero.
+ * \retval CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *                                              Memory allocation failed.
+ * \retval CARDANO_ERROR_CBOR_ENCODING          Failed to encode the COSE_Sign1 structure.
+ *
+ * \note This function does not validate the signature or message.
+ * \note This function assumes the signature is valid and corresponds to the
+ *       Sig_structure previously produced for this message.
+ */
+static cardano_error_t
+cip8_build_cose_sign1(
+  const byte_t*                      message,
+  const size_t                       message_size,
+  const cardano_buffer_t*            protected_bstr,
+  const cardano_ed25519_signature_t* signature,
+  cardano_buffer_t**                 cose_sign1_out)
+{
+  assert(message != NULL);
+  assert(message_size > 0U);
+  assert(cose_sign1_out != NULL);
+  assert(protected_bstr != NULL);
+  assert(signature != NULL);
+
+  *cose_sign1_out = NULL;
+
+  const byte_t* protected_bytes = cardano_buffer_get_data(protected_bstr);
+  const size_t  protected_size  = cardano_buffer_get_size(protected_bstr);
+
+  const byte_t* sig_bytes = cardano_ed25519_signature_get_data(signature);
+  const size_t  sig_size  = cardano_ed25519_signature_get_bytes_size(signature);
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_cbor_writer_write_start_array(writer, 4);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, protected_bytes, protected_size);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_start_map(writer, 1);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  static const char HASHED_LABEL[] = "hashed";
+
+  result = cardano_cbor_writer_write_textstring(writer, HASHED_LABEL, sizeof(HASHED_LABEL) - 1U);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bool(writer, false);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, message, message_size);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, sig_bytes, sig_size);
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_encode_in_buffer(writer, cose_sign1_out);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+/**
+ * \brief Constructs a COSE_Key structure for CIP-8.
+ *
+ * This function builds a COSE_Key map compliant with CIP-8 and COSE (RFC 8152)
+ * using the provided Ed25519 public key and key identifier (kid).
+ *
+ * The resulting structure has the canonical form:
+ *
+ * \code{.cbor}
+ * COSE_Key = {
+ *   1  : 1,
+ *   3  : -8,
+ *   2  : <kid>,
+ *  -1  : 6,
+ *  -2  : <public key>
+ * }
+ * \endcode
+ *
+ * The `kid` is application-defined within CIP-8:
+ *   - When signing with a full address: it is the address bytes.
+ *   - When signing with a payment key hash: it is the 28-byte key hash.
+ *
+ * On success, the function encodes the COSE_Key into a CBOR buffer and returns it
+ * via \p cose_key_out. The caller becomes responsible for releasing the buffer
+ * with \ref cardano_buffer_unref().
+ *
+ * \param[in]  kid_bytes     The key identifier bytes (address or key hash).
+ * \param[in]  kid_size      Size of \p kid_bytes in bytes.
+ * \param[in]  public_key    The Ed25519 public key associated with the signing key.
+ * \param[out] cose_key_out  On success, receives a newly allocated COSE_Key CBOR buffer.
+ *                           Must be freed with \ref cardano_buffer_unref().
+ *
+ * \retval CARDANO_SUCCESS                      The COSE_Key was constructed successfully.
+ * \retval CARDANO_ERROR_POINTER_IS_NULL        One or more required pointers were NULL.
+ * \retval CARDANO_ERROR_INVALID_ARGUMENT       \p kid_size was zero or invalid.
+ * \retval CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *                                              Memory allocation failed.
+ * \retval CARDANO_ERROR_CBOR_ENCODING          Failed to encode the COSE_Key.
+ *
+ * \note The caller must ensure \p public_key is a valid Ed25519 public key.
+ * \note The COSE_Key contains no private material; it is safe to share and transmit.
+ */
+static cardano_error_t
+cip8_build_cose_key(
+  const byte_t*                       kid_bytes,
+  const size_t                        kid_size,
+  const cardano_ed25519_public_key_t* public_key,
+  cardano_buffer_t**                  cose_key_out)
+{
+  assert(kid_bytes != NULL);
+  assert(kid_size > 0U);
+  assert(cose_key_out != NULL);
+  assert(public_key != NULL);
+
+  *cose_key_out = NULL;
+
+  const byte_t* pub_bytes = cardano_ed25519_public_key_get_data(public_key);
+  size_t        pub_size  = cardano_ed25519_public_key_get_bytes_size(public_key);
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_map(writer, 5);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, COSE_KEY_LABEL_KTY);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, COSE_KTY_OKP);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, COSE_KEY_LABEL_KID);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, kid_bytes, kid_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, COSE_KEY_LABEL_ALG);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_signed_int(writer, COSE_ALG_EDDSA);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_signed_int(writer, COSE_KEY_LABEL_CRV);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, COSE_CRV_ED25519);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_signed_int(writer, COSE_KEY_LABEL_X);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, pub_bytes, pub_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  result = cardano_cbor_writer_encode_in_buffer(writer, cose_key_out);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+/* PUBLIC FUNCTIONS ************************************************************/
+
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_cip8_sign(
+  const byte_t*                        message,
+  const size_t                         message_size,
+  const cardano_address_t*             address,
+  const cardano_ed25519_private_key_t* signing_key,
+  cardano_buffer_t**                   cose_sign1_out,
+  cardano_buffer_t**                   cose_key_out)
+{
+  if ((message == NULL) || (address == NULL) || (signing_key == NULL) || (cose_sign1_out == NULL) || (cose_key_out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (message_size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *cose_sign1_out = NULL;
+  *cose_key_out   = NULL;
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  const byte_t* address_bytes = cardano_address_get_bytes(address);
+  size_t        address_size  = cardano_address_get_bytes_size(address);
+
+  cardano_buffer_t* protected_bstr = NULL;
+  result                           = cip8_build_protected_headers(address_bytes, address_size, &protected_bstr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_ed25519_signature_t* signature = NULL;
+  result                                 = cip8_sign_sig_structure(
+    message,
+    message_size,
+    protected_bstr,
+    signing_key,
+    &signature);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&protected_bstr);
+    return result;
+  }
+
+  result = cip8_build_cose_sign1(
+    message,
+    message_size,
+    protected_bstr,
+    signature,
+    cose_sign1_out);
+
+  cardano_buffer_unref(&protected_bstr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_signature_unref(&signature);
+    return result;
+  }
+
+  cardano_ed25519_public_key_t* public_key = NULL;
+
+  result = cardano_ed25519_private_key_get_public_key(
+    signing_key,
+    &public_key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_signature_unref(&signature);
+    cardano_buffer_unref(cose_sign1_out);
+    *cose_sign1_out = NULL;
+
+    return result;
+  }
+
+  result = cip8_build_cose_key(address_bytes, address_size, public_key, cose_key_out);
+
+  cardano_ed25519_public_key_unref(&public_key);
+  cardano_ed25519_signature_unref(&signature);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(cose_sign1_out);
+    *cose_sign1_out = NULL;
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cip8_sign_ex(
+  const byte_t*                        message,
+  const size_t                         message_size,
+  const cardano_blake2b_hash_t*        key_hash,
+  const cardano_ed25519_private_key_t* signing_key,
+  cardano_buffer_t**                   cose_sign1_out,
+  cardano_buffer_t**                   cose_key_out)
+{
+  if ((message == NULL) || (key_hash == NULL) || (signing_key == NULL) || (cose_sign1_out == NULL) || (cose_key_out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (message_size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *cose_sign1_out = NULL;
+  *cose_key_out   = NULL;
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  const byte_t* key_hash_bytes = cardano_blake2b_hash_get_data(key_hash);
+  size_t        key_hash_size  = cardano_blake2b_hash_get_bytes_size(key_hash);
+
+  if ((key_hash_bytes == NULL) || (key_hash_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_buffer_t* protected_bstr = NULL;
+  result                           = cip8_build_protected_headers_for_key_hash(
+    key_hash_bytes,
+    key_hash_size,
+    &protected_bstr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_ed25519_signature_t* signature = NULL;
+  result                                 = cip8_sign_sig_structure(
+    message,
+    message_size,
+    protected_bstr,
+    signing_key,
+    &signature);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&protected_bstr);
+    return result;
+  }
+
+  result = cip8_build_cose_sign1(
+    message,
+    message_size,
+    protected_bstr,
+    signature,
+    cose_sign1_out);
+
+  cardano_buffer_unref(&protected_bstr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_signature_unref(&signature);
+    return result;
+  }
+
+  cardano_ed25519_public_key_t* public_key = NULL;
+
+  result = cardano_ed25519_private_key_get_public_key(
+    signing_key,
+    &public_key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_signature_unref(&signature);
+    cardano_buffer_unref(cose_sign1_out);
+    *cose_sign1_out = NULL;
+
+    return result;
+  }
+
+  result = cip8_build_cose_key(
+    key_hash_bytes,
+    key_hash_size,
+    public_key,
+    cose_key_out);
+
+  cardano_ed25519_public_key_unref(&public_key);
+  cardano_ed25519_signature_unref(&signature);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(cose_sign1_out);
+    *cose_sign1_out = NULL;
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/object.c b/vendor/src/object.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/object.c
@@ -0,0 +1,121 @@
+/**
+ * \file object.c
+ *
+ * \author luisd.bianchi
+ * \date   Mar 03, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+
+#include <assert.h>
+#include <string.h>
+
+#include "./config.h"
+#include "./string_safe.h"
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * Copies a null-terminated string into a buffer safely using memcpy.
+ *
+ * @param dest Destination buffer where the string is copied.
+ * @param src Source string to be copied.
+ * @param maxDestSize Maximum size of the destination buffer.
+ */
+static void
+safe_string_copy(char* dest, const char* src, const size_t max_dest_size)
+{
+  assert(dest != NULL);
+  assert(src != NULL);
+  assert(max_dest_size > 0U);
+
+  const size_t src_length = cardano_safe_strlen(src, max_dest_size);
+  const size_t copy_size  = (src_length < (max_dest_size - 1U)) ? src_length : (max_dest_size - 1U);
+
+  cardano_safe_memcpy(dest, max_dest_size, src, copy_size);
+
+  dest[copy_size] = '\0';
+}
+
+/* DEFINITIONS ****************************************************************/
+
+void
+cardano_object_unref(cardano_object_t** object)
+{
+  if ((object == NULL) || (*object == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* reference = *object;
+
+  if (reference->ref_count > 0U)
+  {
+    reference->ref_count -= 1U;
+  }
+
+  if (reference->ref_count == 0U)
+  {
+    assert(reference->deallocator != NULL);
+    reference->deallocator(reference);
+    *object = NULL;
+  }
+}
+
+void
+cardano_object_ref(cardano_object_t* object)
+{
+  if (object == NULL)
+  {
+    return;
+  }
+
+  object->ref_count += 1U;
+}
+
+size_t
+cardano_object_refcount(const cardano_object_t* object)
+{
+  if (object == NULL)
+  {
+    return 0;
+  }
+
+  return object->ref_count;
+}
+
+void
+cardano_object_set_last_error(cardano_object_t* object, const char* message)
+{
+  if ((object != NULL) && (message != NULL))
+  {
+    safe_string_copy(object->last_error, message, sizeof(object->last_error));
+  }
+}
+
+const char*
+cardano_object_get_last_error(const cardano_object_t* object)
+{
+  if (object == NULL)
+  {
+    return "Object is NULL.";
+  }
+
+  return object->last_error;
+}
diff --git a/vendor/src/plutus_data/constr_plutus_data.c b/vendor/src/plutus_data/constr_plutus_data.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/plutus_data/constr_plutus_data.c
@@ -0,0 +1,622 @@
+/**
+ * \file constr_plutus_data.c
+ *
+ * \author angel.castillo
+ * \date   May 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/plutus_data/constr_plutus_data.h>
+#include <cardano/plutus_data/plutus_list.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t  CONSTR_PLUTUS_EMBEDDED_GROUP_SIZE = 2;
+static const uint64_t GENERAL_FORM_TAG                  = 102;
+static const uint64_t ALTERNATIVE_TAG_OFFSET            = 7;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano constr plutus data.
+ */
+typedef struct cardano_constr_plutus_data_t
+{
+    cardano_object_t       base;
+    uint64_t               alternative;
+    cardano_plutus_list_t* data;
+    cardano_buffer_t*      cbor_cache;
+} cardano_constr_plutus_data_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+// Mapping functions to and from alternative to and from CBOR tags.
+// See https://github.com/input-output-hk/plutus/blob/1f31e640e8a258185db01fa899da63f9018c0e85/plutus-core/plutus-core/src/PlutusCore/Data.hs#L69-L72
+
+/**
+ * \brief Converts a CBOR compact tag to a Constr alternative.
+ *
+ * \param tag The tag to be converted.
+ *
+ * \returns The Constr alternative.
+ */
+static uint64_t
+compact_cbor_tag_to_alternative(const uint64_t tag)
+{
+  if ((tag >= 121U) && (tag <= 127U))
+  {
+    return tag - 121U;
+  }
+
+  if ((tag >= 1280U) && (tag <= 1400U))
+  {
+    return (tag - 1280U) + ALTERNATIVE_TAG_OFFSET;
+  }
+
+  return GENERAL_FORM_TAG;
+}
+
+/**
+ * \brief Converts the constructor alternative to its CBOR compact tag.
+ *
+ * \param alternative The Constr alternative to be converted.
+ *
+ * \returns The compact CBOR tag.
+ */
+static uint64_t
+alternative_to_compact_cbor_tag(const uint64_t alternative)
+{
+  if (alternative <= 6U)
+  {
+    return 121U + alternative;
+  }
+
+  if (alternative <= 127U)
+  {
+    return 1280U - ALTERNATIVE_TAG_OFFSET + alternative;
+  }
+
+  return GENERAL_FORM_TAG;
+}
+
+/**
+ * \brief Deallocates a constr plutus data object.
+ *
+ * This function is responsible for properly deallocating a constr plutus data object (`cardano_constr_plutus_data_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the constr_plutus_data object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_constr_plutus_data_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the constr_plutus_data
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_constr_plutus_data_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_constr_plutus_data_t* constr = (cardano_constr_plutus_data_t*)object;
+
+  cardano_plutus_list_unref(&constr->data);
+  cardano_buffer_unref(&constr->cbor_cache);
+
+  _cardano_free(constr);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_constr_plutus_data_new(
+  uint64_t                       alternative,
+  cardano_plutus_list_t*         data,
+  cardano_constr_plutus_data_t** constr_plutus_data)
+{
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (constr_plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *constr_plutus_data = _cardano_malloc(sizeof(cardano_constr_plutus_data_t));
+
+  if (*constr_plutus_data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*constr_plutus_data)->base.deallocator   = cardano_constr_plutus_data_deallocate;
+  (*constr_plutus_data)->base.ref_count     = 1;
+  (*constr_plutus_data)->base.last_error[0] = '\0';
+  (*constr_plutus_data)->cbor_cache         = NULL;
+
+  (*constr_plutus_data)->alternative = alternative;
+
+  cardano_plutus_list_ref(data);
+
+  (*constr_plutus_data)->data = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_constr_plutus_data_from_cbor(cardano_cbor_reader_t* reader, cardano_constr_plutus_data_t** constr_plutus_data)
+{
+  if (constr_plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *constr_plutus_data = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t*      cbor_cache  = NULL;
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        copy_result = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return copy_result;
+  }
+
+  copy_result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    *constr_plutus_data = NULL;
+    return copy_result;
+  }
+
+  cardano_cbor_tag_t    tag               = 0;
+  const cardano_error_t expect_tag_result = cardano_cbor_reader_read_tag(reader, &tag);
+
+  if (expect_tag_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    *constr_plutus_data = NULL;
+    return expect_tag_result;
+  }
+
+  if ((uint64_t)tag == GENERAL_FORM_TAG)
+  {
+    static const char* validator_name = "constr_plutus_data";
+
+    const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)CONSTR_PLUTUS_EMBEDDED_GROUP_SIZE);
+
+    if (expect_array_result != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&cbor_cache);
+      *constr_plutus_data = NULL;
+      return expect_array_result;
+    }
+
+    uint64_t              alternative      = 0U;
+    const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+      validator_name,
+      "alternative",
+      reader,
+      &alternative,
+      0,
+      UINT64_MAX);
+
+    if (read_uint_result != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&cbor_cache);
+      *constr_plutus_data = NULL;
+      return read_uint_result;
+    }
+
+    cardano_plutus_list_t* data             = NULL;
+    const cardano_error_t  read_data_result = cardano_plutus_list_from_cbor(reader, &data);
+
+    if (read_data_result != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&cbor_cache);
+      *constr_plutus_data = NULL;
+      return read_data_result;
+    }
+
+    const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+    if (expect_end_array_result != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&cbor_cache);
+      *constr_plutus_data = NULL;
+      cardano_plutus_list_unref(&data);
+
+      return expect_end_array_result;
+    }
+
+    cardano_error_t result = cardano_constr_plutus_data_new(alternative, data, constr_plutus_data);
+    cardano_plutus_list_unref(&data);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&cbor_cache);
+      *constr_plutus_data = NULL;
+      return result;
+    }
+
+    (*constr_plutus_data)->cbor_cache = cbor_cache;
+
+    return result;
+  }
+
+  const uint64_t alternative = compact_cbor_tag_to_alternative(tag);
+
+  cardano_plutus_list_t* data             = NULL;
+  const cardano_error_t  read_data_result = cardano_plutus_list_from_cbor(reader, &data);
+
+  if (read_data_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    *constr_plutus_data = NULL;
+    return read_data_result;
+  }
+
+  cardano_error_t result = cardano_constr_plutus_data_new(alternative, data, constr_plutus_data);
+  cardano_plutus_list_unref(&data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    *constr_plutus_data = NULL;
+    return result;
+  }
+
+  (*constr_plutus_data)->cbor_cache = cbor_cache;
+
+  return result;
+}
+
+cardano_error_t
+cardano_constr_plutus_data_to_cbor(const cardano_constr_plutus_data_t* constr_plutus_data, cardano_cbor_writer_t* writer)
+{
+  if (constr_plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (constr_plutus_data->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(constr_plutus_data->cbor_cache), cardano_buffer_get_size(constr_plutus_data->cbor_cache));
+  }
+
+  const uint64_t tag = alternative_to_compact_cbor_tag(constr_plutus_data->alternative);
+
+  const cardano_error_t write_tag_result = cardano_cbor_writer_write_tag(writer, tag);
+
+  if (write_tag_result != CARDANO_SUCCESS)
+  {
+    return write_tag_result;
+  }
+
+  if (tag != GENERAL_FORM_TAG)
+  {
+    return cardano_plutus_list_to_cbor(constr_plutus_data->data, writer);
+  }
+
+  const cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(writer, CONSTR_PLUTUS_EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  const cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, constr_plutus_data->alternative);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  return cardano_plutus_list_to_cbor(constr_plutus_data->data, writer);
+}
+
+cardano_error_t
+cardano_constr_plutus_data_to_cip116_json(
+  const cardano_constr_plutus_data_t* constr_data,
+  cardano_json_writer_t*              writer)
+{
+  if ((constr_data == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "constr", 6);
+
+  cardano_json_writer_write_property_name(writer, "alternative", 11);
+  cardano_json_writer_write_uint_as_string(writer, constr_data->alternative);
+
+  cardano_json_writer_write_property_name(writer, "data", 4);
+  size_t len = cardano_plutus_list_get_length(constr_data->data);
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0; i < len; ++i)
+  {
+    cardano_plutus_data_t* elem  = NULL;
+    cardano_error_t        error = cardano_plutus_list_get(constr_data->data, i, &elem);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_plutus_data_to_cip116_json(elem, writer);
+    cardano_plutus_data_unref(&elem);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_constr_plutus_data_get_data(
+  cardano_constr_plutus_data_t* constr_plutus_data,
+  cardano_plutus_list_t**       data)
+{
+  if (constr_plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_list_ref(constr_plutus_data->data);
+  *data = constr_plutus_data->data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_constr_plutus_data_set_data(
+  cardano_constr_plutus_data_t* constr_plutus_data,
+  cardano_plutus_list_t*        data)
+{
+  if (constr_plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_list_ref(data);
+
+  cardano_plutus_list_unref(&constr_plutus_data->data);
+
+  constr_plutus_data->data = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_constr_plutus_data_get_alternative(
+  const cardano_constr_plutus_data_t* constr_plutus_data,
+  uint64_t*                           alternative)
+{
+  if (constr_plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (alternative == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *alternative = constr_plutus_data->alternative;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_constr_plutus_data_set_alternative(
+  cardano_constr_plutus_data_t* constr_plutus_data,
+  const uint64_t                alternative)
+{
+  if (constr_plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  constr_plutus_data->alternative = alternative;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_constr_plutus_equals(
+  const cardano_constr_plutus_data_t* lhs,
+  const cardano_constr_plutus_data_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  if (lhs->alternative != rhs->alternative)
+  {
+    return false;
+  }
+
+  return cardano_plutus_list_equals(lhs->data, rhs->data);
+}
+
+void
+cardano_constr_plutus_data_clear_cbor_cache(cardano_constr_plutus_data_t* constr_plutus_data)
+{
+  if (constr_plutus_data == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&constr_plutus_data->cbor_cache);
+  constr_plutus_data->cbor_cache = NULL;
+}
+
+void
+cardano_constr_plutus_data_unref(cardano_constr_plutus_data_t** constr_plutus_data)
+{
+  if ((constr_plutus_data == NULL) || (*constr_plutus_data == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*constr_plutus_data)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *constr_plutus_data = NULL;
+    return;
+  }
+}
+
+void
+cardano_constr_plutus_data_ref(cardano_constr_plutus_data_t* constr_plutus_data)
+{
+  if (constr_plutus_data == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&constr_plutus_data->base);
+}
+
+size_t
+cardano_constr_plutus_data_refcount(const cardano_constr_plutus_data_t* constr_plutus_data)
+{
+  if (constr_plutus_data == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&constr_plutus_data->base);
+}
+
+void
+cardano_constr_plutus_data_set_last_error(cardano_constr_plutus_data_t* constr_plutus_data, const char* message)
+{
+  cardano_object_set_last_error(&constr_plutus_data->base, message);
+}
+
+const char*
+cardano_constr_plutus_data_get_last_error(const cardano_constr_plutus_data_t* constr_plutus_data)
+{
+  return cardano_object_get_last_error(&constr_plutus_data->base);
+}
+
+cardano_error_t
+cardano_constr_plutus_data_deep_clone(const cardano_constr_plutus_data_t* source, cardano_constr_plutus_data_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_constr_plutus_data_t* copy = _cardano_malloc(sizeof(cardano_constr_plutus_data_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->alternative        = source->alternative;
+  copy->data               = NULL;
+  copy->cbor_cache         = NULL;
+
+  if (source->data != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_list_deep_clone(source->data, &copy->data);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/plutus_data/plutus_data.c b/vendor/src/plutus_data/plutus_data.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/plutus_data/plutus_data.c
@@ -0,0 +1,1336 @@
+/**
+ * \file plutus_data.c
+ *
+ * \author angel.castillo
+ * \date   May 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/common/bigint.h>
+#include <cardano/object.h>
+#include <cardano/plutus_data/constr_plutus_data.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/plutus_data/plutus_data_kind.h>
+#include <cardano/plutus_data/plutus_list.h>
+#include <cardano/plutus_data/plutus_map.h>
+
+#include "../allocators.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus data.
+ */
+typedef struct cardano_plutus_data_t
+{
+    cardano_object_t              base;
+    cardano_plutus_map_t*         map;
+    cardano_plutus_list_t*        list;
+    cardano_bigint_t*             integer;
+    cardano_buffer_t*             bytes;
+    cardano_constr_plutus_data_t* constr;
+    cardano_plutus_data_kind_t    kind;
+    cardano_buffer_t*             cbor_cache;
+} cardano_plutus_data_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus data object.
+ *
+ * This function is responsible for properly deallocating a plutus data object (`cardano_plutus_data_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus_data object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_data_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_data
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_data_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_data_t* data = (cardano_plutus_data_t*)object;
+
+  cardano_plutus_map_unref(&data->map);
+  cardano_plutus_list_unref(&data->list);
+  cardano_buffer_unref(&data->bytes);
+  cardano_constr_plutus_data_unref(&data->constr);
+  cardano_bigint_unref(&data->integer);
+  cardano_buffer_unref(&data->cbor_cache);
+
+  data->integer = NULL;
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new plutus data object.
+ *
+ * \return A pointer to the newly created plutus data object, or `NULL` if the operation failed.
+ */
+static cardano_plutus_data_t*
+cardano_plutus_data_new(void)
+{
+  cardano_plutus_data_t* data = _cardano_malloc(sizeof(cardano_plutus_data_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_plutus_data_deallocate;
+  data->cbor_cache         = NULL;
+
+  data->map     = NULL;
+  data->list    = NULL;
+  data->integer = NULL;
+  data->bytes   = NULL;
+  data->constr  = NULL;
+  data->kind    = CARDANO_PLUTUS_DATA_KIND_CONSTR;
+
+  return data;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_data_new_constr(
+  cardano_constr_plutus_data_t* constr,
+  cardano_plutus_data_t**       plutus_data)
+{
+  if (constr == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* data = cardano_plutus_data_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_constr_plutus_data_ref(constr);
+
+  data->constr = (cardano_constr_plutus_data_t*)constr;
+  data->kind   = CARDANO_PLUTUS_DATA_KIND_CONSTR;
+
+  *plutus_data = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_new_map(
+  cardano_plutus_map_t*   map,
+  cardano_plutus_data_t** plutus_data)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* data = cardano_plutus_data_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_plutus_map_ref(map);
+
+  data->map  = map;
+  data->kind = CARDANO_PLUTUS_DATA_KIND_MAP;
+
+  *plutus_data = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_new_list(
+  cardano_plutus_list_t*  list,
+  cardano_plutus_data_t** plutus_data)
+{
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* data = cardano_plutus_data_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_plutus_list_ref(list);
+
+  data->list = list;
+  data->kind = CARDANO_PLUTUS_DATA_KIND_LIST;
+
+  *plutus_data = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_new_integer(
+  const cardano_bigint_t* bigint,
+  cardano_plutus_data_t** plutus_data)
+{
+  if (bigint == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* data = cardano_plutus_data_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_bigint_clone(bigint, &data->integer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_deallocate(data);
+    return result;
+  }
+
+  data->kind = CARDANO_PLUTUS_DATA_KIND_INTEGER;
+
+  *plutus_data = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_new_integer_from_int(
+  const int64_t           integer,
+  cardano_plutus_data_t** plutus_data)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bigint_t* bigint = NULL;
+  cardano_error_t   result = cardano_bigint_from_int(integer, &bigint);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_plutus_data_new_integer(bigint, plutus_data);
+
+  cardano_bigint_unref(&bigint);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_data_new_integer_from_uint(
+  const uint64_t          integer,
+  cardano_plutus_data_t** plutus_data)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bigint_t* bigint = NULL;
+  cardano_error_t   result = cardano_bigint_from_unsigned_int(integer, &bigint);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_plutus_data_new_integer(bigint, plutus_data);
+
+  cardano_bigint_unref(&bigint);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_data_new_integer_from_string(
+  const char*             string,
+  size_t                  size,
+  int32_t                 base,
+  cardano_plutus_data_t** plutus_data)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (string == NULL)
+  {
+    *plutus_data = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bigint_t* bigint = NULL;
+  cardano_error_t   result = cardano_bigint_from_string(string, size, base, &bigint);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_plutus_data_new_integer(bigint, plutus_data);
+
+  cardano_bigint_unref(&bigint);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_data_new_bytes(
+  const byte_t*           bytes,
+  size_t                  size,
+  cardano_plutus_data_t** plutus_data)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bytes == NULL)
+  {
+    *plutus_data = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* data = cardano_plutus_data_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = cardano_buffer_new_from(bytes, size);
+
+  if (buffer == NULL)
+  {
+    cardano_plutus_data_deallocate(data);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->bytes = buffer;
+  data->kind  = CARDANO_PLUTUS_DATA_KIND_BYTES;
+
+  *plutus_data = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_new_bytes_from_hex(
+  const char*             hex,
+  size_t                  size,
+  cardano_plutus_data_t** plutus_data)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hex == NULL)
+  {
+    *plutus_data = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* data = cardano_plutus_data_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = cardano_buffer_from_hex(hex, size);
+
+  if (buffer == NULL)
+  {
+    cardano_plutus_data_deallocate(data);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->bytes = buffer;
+  data->kind  = CARDANO_PLUTUS_DATA_KIND_BYTES;
+
+  *plutus_data = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_data_t** plutus_data)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *plutus_data = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t*      cbor_cache  = NULL;
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        copy_result = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return copy_result;
+  }
+
+  copy_result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    *plutus_data = NULL;
+    return copy_result;
+  }
+
+  cardano_plutus_data_t* data = cardano_plutus_data_new();
+
+  if (data == NULL)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->cbor_cache = cbor_cache;
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_deallocate(data);
+    return result;
+  }
+
+  switch (state)
+  {
+    case CARDANO_CBOR_READER_STATE_TAG:
+    {
+      cardano_cbor_tag_t tag = 0;
+
+      result = cardano_cbor_reader_peek_tag(reader, &tag);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_deallocate(data);
+        return result;
+      }
+
+      switch (tag)
+      {
+        case CARDANO_CBOR_TAG_UNSIGNED_BIG_NUM:
+        case CARDANO_CBOR_TAG_NEGATIVE_BIG_NUM:
+        {
+          result = cardano_cbor_reader_read_bigint(reader, &data->integer);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            cardano_plutus_data_deallocate(data);
+            return result;
+          }
+
+          data->kind = CARDANO_PLUTUS_DATA_KIND_INTEGER;
+
+          break;
+        }
+        default:
+        {
+          result = cardano_constr_plutus_data_from_cbor(reader, &data->constr);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            cardano_plutus_data_deallocate(data);
+            return result;
+          }
+
+          data->kind = CARDANO_PLUTUS_DATA_KIND_CONSTR;
+
+          break;
+        }
+      }
+      break;
+    }
+    case CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER:
+    {
+      uint64_t integer = 0;
+
+      result = cardano_cbor_reader_read_uint(reader, &integer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_deallocate(data);
+        return result;
+      }
+
+      result = cardano_bigint_from_unsigned_int(integer, &data->integer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_deallocate(data);
+        return result;
+      }
+
+      data->kind = CARDANO_PLUTUS_DATA_KIND_INTEGER;
+
+      break;
+    }
+    case CARDANO_CBOR_READER_STATE_NEGATIVE_INTEGER:
+    {
+      uint64_t argument = 0;
+
+      result = cardano_cbor_reader_read_negative_int(reader, &argument);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_deallocate(data);
+        return result;
+      }
+
+      result = cardano_bigint_from_unsigned_int(argument, &data->integer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_deallocate(data);
+        return result;
+      }
+
+      cardano_bigint_negate(data->integer, data->integer);
+      cardano_bigint_decrement(data->integer);
+
+      data->kind = CARDANO_PLUTUS_DATA_KIND_INTEGER;
+
+      break;
+    }
+    case CARDANO_CBOR_READER_STATE_START_INDEFINITE_LENGTH_BYTESTRING:
+    case CARDANO_CBOR_READER_STATE_BYTESTRING:
+    {
+      cardano_buffer_t* bytes = NULL;
+
+      result = cardano_cbor_reader_read_bytestring(reader, &bytes);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_deallocate(data);
+        return result;
+      }
+
+      data->bytes = bytes;
+      data->kind  = CARDANO_PLUTUS_DATA_KIND_BYTES;
+
+      break;
+    }
+    case CARDANO_CBOR_READER_STATE_START_ARRAY:
+    {
+      cardano_plutus_list_t* list = NULL;
+
+      result = cardano_plutus_list_from_cbor(reader, &list);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_deallocate(data);
+        return result;
+      }
+
+      data->list = list;
+      data->kind = CARDANO_PLUTUS_DATA_KIND_LIST;
+
+      break;
+    }
+    case CARDANO_CBOR_READER_STATE_START_MAP:
+    {
+      cardano_plutus_map_t* map = NULL;
+
+      result = cardano_plutus_map_from_cbor(reader, &map);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_deallocate(data);
+        return result;
+      }
+
+      data->map  = map;
+      data->kind = CARDANO_PLUTUS_DATA_KIND_MAP;
+
+      break;
+    }
+    default:
+    {
+      cardano_plutus_data_deallocate(data);
+
+      cardano_cbor_reader_set_last_error(reader, "Invalid CBOR data item type for plutus data.");
+      return CARDANO_ERROR_DECODING;
+    }
+  }
+
+  *plutus_data = data;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_to_cbor(const cardano_plutus_data_t* plutus_data, cardano_cbor_writer_t* writer)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(plutus_data->cbor_cache), cardano_buffer_get_size(plutus_data->cbor_cache));
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (plutus_data->kind)
+  {
+    case CARDANO_PLUTUS_DATA_KIND_CONSTR:
+    {
+      result = cardano_constr_plutus_data_to_cbor(plutus_data->constr, writer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    case CARDANO_PLUTUS_DATA_KIND_MAP:
+    {
+      result = cardano_plutus_map_to_cbor(plutus_data->map, writer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    case CARDANO_PLUTUS_DATA_KIND_LIST:
+    {
+      result = cardano_plutus_list_to_cbor(plutus_data->list, writer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    case CARDANO_PLUTUS_DATA_KIND_INTEGER:
+    {
+      const bool   is_negative = cardano_bigint_signum(plutus_data->integer) < 0;
+      const size_t bit_length  = cardano_bigint_bit_length(plutus_data->integer);
+
+      if (bit_length <= 64U)
+      {
+        const uint64_t absolute = cardano_bigint_to_unsigned_int(plutus_data->integer);
+
+        if (is_negative)
+        {
+          result = cardano_cbor_writer_write_negative_int(writer, absolute - 1U);
+        }
+        else
+        {
+          result = cardano_cbor_writer_write_uint(writer, absolute);
+        }
+      }
+      else
+      {
+        cardano_bigint_t* magnitude = NULL;
+
+        result = cardano_bigint_clone(plutus_data->integer, &magnitude);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        if (is_negative)
+        {
+          cardano_bigint_negate(plutus_data->integer, magnitude);
+          cardano_bigint_decrement(magnitude);
+        }
+
+        if (is_negative && (cardano_bigint_bit_length(magnitude) <= 64U))
+        {
+          result = cardano_cbor_writer_write_negative_int(writer, cardano_bigint_to_unsigned_int(magnitude));
+          cardano_bigint_unref(&magnitude);
+
+          return result;
+        }
+
+        const size_t size  = cardano_bigint_get_bytes_size(magnitude);
+        byte_t*      bytes = _cardano_malloc(size);
+
+        if (bytes == NULL)
+        {
+          cardano_bigint_unref(&magnitude);
+
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+
+        result = cardano_bigint_to_bytes(magnitude, CARDANO_BYTE_ORDER_BIG_ENDIAN, bytes, size);
+
+        cardano_bigint_unref(&magnitude);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          _cardano_free(bytes);
+          return result;
+        }
+
+        result = cardano_cbor_writer_write_tag(writer, is_negative ? CARDANO_CBOR_TAG_NEGATIVE_BIG_NUM : CARDANO_CBOR_TAG_UNSIGNED_BIG_NUM);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          _cardano_free(bytes);
+          return result;
+        }
+
+        static const uint64_t max_byte_string_chunk_size = 64;
+
+        if (size <= max_byte_string_chunk_size)
+        {
+          result = cardano_cbor_writer_write_bytestring(writer, bytes, size);
+          _cardano_free(bytes);
+
+          return result;
+        }
+
+        static const byte_t indefinite_byte_string = 95;
+
+        const size_t chunks = size / max_byte_string_chunk_size;
+        const size_t rest   = size % max_byte_string_chunk_size;
+        result              = cardano_cbor_writer_write_encoded(writer, &indefinite_byte_string, sizeof(indefinite_byte_string));
+
+        if (result != CARDANO_SUCCESS)
+        {
+          _cardano_free(bytes);
+          return result;
+        }
+
+        for (size_t i = 0; i < chunks; ++i)
+        {
+          result = cardano_cbor_writer_write_bytestring(
+            writer, &bytes[i * max_byte_string_chunk_size], max_byte_string_chunk_size);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            _cardano_free(bytes);
+            return result;
+          }
+        }
+
+        if (rest > 0U)
+        {
+          result = cardano_cbor_writer_write_bytestring(
+            writer, &bytes[chunks * max_byte_string_chunk_size], rest);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            _cardano_free(bytes);
+            return result;
+          }
+        }
+
+        _cardano_free(bytes);
+        result = cardano_cbor_writer_write_end_array(writer);
+      }
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    // Note [The 64-byte limit]: See https://github.com/input-output-hk/plutus/blob/1f31e640e8a258185db01fa899da63f9018c0e85/plutus-core/plutus-core/src/PlutusCore/Data.hs#L61-L105
+    // If the bytestring is >64bytes, we encode it as indefinite-length bytestrings with 64-byte chunks. We have to write
+    // our own encoders/decoders so we can produce chunks of the right size and check
+    // the sizes when we decode.
+    case CARDANO_PLUTUS_DATA_KIND_BYTES:
+    {
+      static const uint64_t max_byte_string_chunk_size = 64;
+
+      const size_t size = cardano_buffer_get_size(plutus_data->bytes);
+
+      if (size <= max_byte_string_chunk_size)
+      {
+        result = cardano_cbor_writer_write_bytestring(writer, cardano_buffer_get_data(plutus_data->bytes), size);
+      }
+      else
+      {
+        static const byte_t indefinite_byte_string = 95;
+
+        const size_t chunks = size / max_byte_string_chunk_size;
+        const size_t rest   = size % max_byte_string_chunk_size;
+        result              = cardano_cbor_writer_write_encoded(writer, &indefinite_byte_string, sizeof(indefinite_byte_string));
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        for (size_t i = 0; i < chunks; ++i)
+        {
+          result = cardano_cbor_writer_write_bytestring(
+            writer, &cardano_buffer_get_data(plutus_data->bytes)[i * max_byte_string_chunk_size], max_byte_string_chunk_size);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            return result;
+          }
+        }
+
+        if (rest > 0U)
+        {
+          result = cardano_cbor_writer_write_bytestring(
+            writer, &cardano_buffer_get_data(plutus_data->bytes)[chunks * max_byte_string_chunk_size], rest);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            return result;
+          }
+        }
+
+        result = cardano_cbor_writer_write_end_array(writer);
+      }
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+
+    default:
+    {
+      cardano_cbor_writer_set_last_error(writer, "Invalid plutus data kind");
+      return CARDANO_ERROR_ENCODING;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_to_cip116_json(
+  const cardano_plutus_data_t* data,
+  cardano_json_writer_t*       writer)
+{
+  if ((data == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  switch (data->kind)
+  {
+    case CARDANO_PLUTUS_DATA_KIND_CONSTR:
+    {
+      error = cardano_constr_plutus_data_to_cip116_json(data->constr, writer);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      break;
+    }
+    case CARDANO_PLUTUS_DATA_KIND_MAP:
+    {
+      error = cardano_plutus_map_to_cip116_json(data->map, writer);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      break;
+    }
+    case CARDANO_PLUTUS_DATA_KIND_LIST:
+    {
+      error = cardano_plutus_list_to_cip116_json(data->list, writer);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      break;
+    }
+    case CARDANO_PLUTUS_DATA_KIND_INTEGER:
+    {
+      cardano_json_writer_write_start_object(writer);
+      cardano_json_writer_write_property_name(writer, "tag", 3);
+      cardano_json_writer_write_string(writer, "integer", 7);
+      cardano_json_writer_write_property_name(writer, "value", 5);
+      cardano_json_writer_write_bigint(writer, data->integer);
+      cardano_json_writer_write_end_object(writer);
+      break;
+    }
+    case CARDANO_PLUTUS_DATA_KIND_BYTES:
+    {
+      cardano_json_writer_write_start_object(writer);
+      cardano_json_writer_write_property_name(writer, "tag", 3);
+      cardano_json_writer_write_string(writer, "bytes", 5);
+      cardano_json_writer_write_property_name(writer, "value", 5);
+      cardano_json_writer_write_buffer_as_hex(writer, data->bytes);
+      cardano_json_writer_write_end_object(writer);
+      break;
+    }
+    default:
+    {
+      error = CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+
+  return error;
+}
+
+cardano_error_t
+cardano_plutus_data_get_kind(
+  const cardano_plutus_data_t* plutus_data,
+  cardano_plutus_data_kind_t*  kind)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (kind == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *kind = plutus_data->kind;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_to_constr(
+  cardano_plutus_data_t*         plutus_data,
+  cardano_constr_plutus_data_t** constr)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (constr == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data->kind != CARDANO_PLUTUS_DATA_KIND_CONSTR)
+  {
+    return CARDANO_ERROR_INVALID_PLUTUS_DATA_CONVERSION;
+  }
+
+  cardano_constr_plutus_data_ref(plutus_data->constr);
+  *constr = plutus_data->constr;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_to_map(
+  cardano_plutus_data_t* plutus_data,
+  cardano_plutus_map_t** map)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data->kind != CARDANO_PLUTUS_DATA_KIND_MAP)
+  {
+    return CARDANO_ERROR_INVALID_PLUTUS_DATA_CONVERSION;
+  }
+
+  cardano_plutus_map_ref(plutus_data->map);
+  *map = plutus_data->map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_to_list(
+  cardano_plutus_data_t*  plutus_data,
+  cardano_plutus_list_t** list)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data->kind != CARDANO_PLUTUS_DATA_KIND_LIST)
+  {
+    return CARDANO_ERROR_INVALID_PLUTUS_DATA_CONVERSION;
+  }
+
+  cardano_plutus_list_ref(plutus_data->list);
+  *list = plutus_data->list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_to_integer(
+  const cardano_plutus_data_t* plutus_data,
+  cardano_bigint_t**           integer)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (integer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data->kind != CARDANO_PLUTUS_DATA_KIND_INTEGER)
+  {
+    return CARDANO_ERROR_INVALID_PLUTUS_DATA_CONVERSION;
+  }
+
+  cardano_error_t error = cardano_bigint_clone(plutus_data->integer, integer);
+
+  return error;
+}
+
+cardano_error_t
+cardano_plutus_data_to_bounded_bytes(
+  cardano_plutus_data_t* plutus_data,
+  cardano_buffer_t**     bounded_bytes)
+{
+  if (plutus_data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bounded_bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data->kind != CARDANO_PLUTUS_DATA_KIND_BYTES)
+  {
+    return CARDANO_ERROR_INVALID_PLUTUS_DATA_CONVERSION;
+  }
+
+  cardano_buffer_ref(plutus_data->bytes);
+  *bounded_bytes = plutus_data->bytes;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_plutus_data_equals(const cardano_plutus_data_t* lhs, const cardano_plutus_data_t* rhs)
+{
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs->kind != rhs->kind)
+  {
+    return false;
+  }
+
+  switch (lhs->kind)
+  {
+    case CARDANO_PLUTUS_DATA_KIND_CONSTR:
+    {
+      return cardano_constr_plutus_equals(lhs->constr, rhs->constr);
+    }
+    case CARDANO_PLUTUS_DATA_KIND_MAP:
+    {
+      return cardano_plutus_map_equals(lhs->map, rhs->map);
+    }
+    case CARDANO_PLUTUS_DATA_KIND_LIST:
+    {
+      return cardano_plutus_list_equals(lhs->list, rhs->list);
+    }
+    case CARDANO_PLUTUS_DATA_KIND_INTEGER:
+    {
+      return cardano_bigint_equals(lhs->integer, rhs->integer);
+    }
+    case CARDANO_PLUTUS_DATA_KIND_BYTES:
+    {
+      return cardano_buffer_equals(lhs->bytes, rhs->bytes);
+    }
+
+    default:
+    {
+      return false;
+    }
+  }
+}
+
+void
+cardano_plutus_data_clear_cbor_cache(cardano_plutus_data_t* plutus_data)
+{
+  if (plutus_data == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&plutus_data->cbor_cache);
+  cardano_plutus_list_clear_cbor_cache(plutus_data->list);
+  cardano_plutus_map_clear_cbor_cache(plutus_data->map);
+  cardano_constr_plutus_data_clear_cbor_cache(plutus_data->constr);
+
+  plutus_data->cbor_cache = NULL;
+}
+
+void
+cardano_plutus_data_unref(cardano_plutus_data_t** plutus_data)
+{
+  if ((plutus_data == NULL) || (*plutus_data == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_data)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_data = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_data_ref(cardano_plutus_data_t* plutus_data)
+{
+  if (plutus_data == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_data->base);
+}
+
+size_t
+cardano_plutus_data_refcount(const cardano_plutus_data_t* plutus_data)
+{
+  if (plutus_data == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_data->base);
+}
+
+void
+cardano_plutus_data_set_last_error(cardano_plutus_data_t* plutus_data, const char* message)
+{
+  cardano_object_set_last_error(&plutus_data->base, message);
+}
+
+const char*
+cardano_plutus_data_get_last_error(const cardano_plutus_data_t* plutus_data)
+{
+  return cardano_object_get_last_error(&plutus_data->base);
+}
+
+cardano_error_t
+cardano_plutus_data_deep_clone(const cardano_plutus_data_t* source, cardano_plutus_data_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* copy = _cardano_malloc(sizeof(cardano_plutus_data_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->map                = NULL;
+  copy->list               = NULL;
+  copy->integer            = NULL;
+  copy->bytes              = NULL;
+  copy->constr             = NULL;
+  copy->kind               = source->kind;
+  copy->cbor_cache         = NULL;
+
+  if (source->map != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_map_deep_clone(source->map, &copy->map);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->list != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_list_deep_clone(source->list, &copy->list);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->integer != NULL)
+  {
+    const cardano_error_t result = cardano_bigint_deep_clone(source->integer, &copy->integer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->bytes != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->bytes, &copy->bytes);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->constr != NULL)
+  {
+    const cardano_error_t result = cardano_constr_plutus_data_deep_clone(source->constr, &copy->constr);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/plutus_data/plutus_list.c b/vendor/src/plutus_data/plutus_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/plutus_data/plutus_list.c
@@ -0,0 +1,565 @@
+/**
+ * \file plutus_list.c
+ *
+ * \author angel.castillo
+ * \date   May 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/plutus_data/plutus_list.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus list.
+ */
+typedef struct cardano_plutus_list_t
+{
+    cardano_object_t  base;
+    cardano_array_t*  array;
+    cardano_buffer_t* cbor_cache;
+} cardano_plutus_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus list object.
+ *
+ * This function is responsible for properly deallocating a plutus list object (`cardano_plutus_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus_list object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_list_t* list = (cardano_plutus_list_t*)object;
+
+  cardano_array_unref(&list->array);
+  cardano_buffer_unref(&list->cbor_cache);
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_list_new(cardano_plutus_list_t** plutus_list)
+{
+  if (plutus_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_list_t* list = _cardano_malloc(sizeof(cardano_plutus_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_plutus_list_deallocate;
+  list->cbor_cache         = NULL;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *plutus_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_list_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_list_t** plutus_list)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t*      cbor_cache  = NULL;
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        copy_result = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return copy_result;
+  }
+
+  copy_result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    *plutus_list = NULL;
+    return copy_result;
+  }
+
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    return result;
+  }
+
+  list->cbor_cache = cbor_cache;
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_list_unref(&list);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_list_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_plutus_data_t* element = NULL;
+
+    result = cardano_plutus_data_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_list_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_plutus_data_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_plutus_list_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("plutus_list", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_list_unref(&list);
+    return result;
+  }
+
+  *plutus_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_list_to_cbor(const cardano_plutus_list_t* plutus_list, cardano_cbor_writer_t* writer)
+{
+  if (plutus_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_list->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(plutus_list->cbor_cache), cardano_buffer_get_size(plutus_list->cbor_cache));
+  }
+
+  assert(plutus_list->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t array_size = cardano_array_get_size(plutus_list->array);
+
+  if (array_size > 0U)
+  {
+    result = cardano_cbor_writer_write_start_array(writer, -1);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    };
+  }
+  else
+  {
+    result = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_list->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(plutus_list->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in plutus list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_plutus_data_to_cbor((cardano_plutus_data_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (array_size > 0U)
+  {
+    result = cardano_cbor_writer_write_end_array(writer);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_list_to_cip116_json(
+  const cardano_plutus_list_t* list,
+  cardano_json_writer_t*       writer)
+{
+  if ((list == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "list", 4);
+  cardano_json_writer_write_property_name(writer, "contents", 8);
+  cardano_json_writer_write_start_array(writer);
+
+  size_t len = cardano_plutus_list_get_length(list);
+
+  for (size_t i = 0; i < len; ++i)
+  {
+    cardano_plutus_data_t* elem  = NULL;
+    cardano_error_t        error = cardano_plutus_list_get(list, i, &elem);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_plutus_data_to_cip116_json(elem, writer);
+    cardano_plutus_data_unref(&elem);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_plutus_list_get_length(const cardano_plutus_list_t* plutus_list)
+{
+  if (plutus_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(plutus_list->array);
+}
+
+cardano_error_t
+cardano_plutus_list_get(
+  const cardano_plutus_list_t* plutus_list,
+  size_t                       index,
+  cardano_plutus_data_t**      element)
+{
+  if (plutus_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(plutus_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_plutus_data_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_list_add(cardano_plutus_list_t* plutus_list, cardano_plutus_data_t* element)
+{
+  if (plutus_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(plutus_list->array);
+  const size_t new_size      = cardano_array_push(plutus_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_plutus_list_equals(const cardano_plutus_list_t* lhs, const cardano_plutus_list_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  if (cardano_array_get_size(lhs->array) != cardano_array_get_size(rhs->array))
+  {
+    return false;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_plutus_data_t* lhs_element = (cardano_plutus_data_t*)((void*)cardano_array_get(lhs->array, i));
+    cardano_plutus_data_t* rhs_element = (cardano_plutus_data_t*)((void*)cardano_array_get(rhs->array, i));
+
+    cardano_plutus_data_unref(&lhs_element);
+    cardano_plutus_data_unref(&rhs_element);
+
+    if (!cardano_plutus_data_equals(lhs_element, rhs_element))
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+void
+cardano_plutus_list_clear_cbor_cache(cardano_plutus_list_t* plutus_list)
+{
+  if (plutus_list == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&plutus_list->cbor_cache);
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_list->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(plutus_list->array, i);
+    cardano_object_unref(&element);
+
+    cardano_plutus_data_clear_cbor_cache((cardano_plutus_data_t*)(void*)element);
+  }
+
+  plutus_list->cbor_cache = NULL;
+}
+
+void
+cardano_plutus_list_unref(cardano_plutus_list_t** plutus_list)
+{
+  if ((plutus_list == NULL) || (*plutus_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_list_ref(cardano_plutus_list_t* plutus_list)
+{
+  if (plutus_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_list->base);
+}
+
+size_t
+cardano_plutus_list_refcount(const cardano_plutus_list_t* plutus_list)
+{
+  if (plutus_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_list->base);
+}
+
+void
+cardano_plutus_list_set_last_error(cardano_plutus_list_t* plutus_list, const char* message)
+{
+  cardano_object_set_last_error(&plutus_list->base, message);
+}
+
+const char*
+cardano_plutus_list_get_last_error(const cardano_plutus_list_t* plutus_list)
+{
+  return cardano_object_get_last_error(&plutus_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_plutus_data_t* copy   = NULL;
+  const cardano_error_t  result = cardano_plutus_data_deep_clone((const cardano_plutus_data_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_list_deep_clone(const cardano_plutus_list_t* source, cardano_plutus_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_list_t* copy = _cardano_malloc(sizeof(cardano_plutus_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+  copy->cbor_cache         = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/plutus_data/plutus_map.c b/vendor/src/plutus_data/plutus_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/plutus_data/plutus_map.c
@@ -0,0 +1,865 @@
+/**
+ * \file plutus_map.c
+ *
+ * \author angel.castillo
+ * \date   May 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/plutus_data/plutus_list.h>
+#include <cardano/plutus_data/plutus_map.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/set.h"
+
+#include <assert.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus map.
+ */
+typedef struct cardano_plutus_map_t
+{
+    cardano_object_t  base;
+    cardano_array_t*  array;
+    cardano_buffer_t* cbor_cache;
+    bool              use_indefinite_encoding;
+} cardano_plutus_map_t;
+
+/**
+ * \brief Represents a Cardano plutus map key value pair.
+ */
+typedef struct cardano_plutus_map_kvp_t
+{
+    cardano_object_t       base;
+    cardano_plutus_data_t* key;
+    cardano_plutus_data_t* value;
+} cardano_plutus_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus map object.
+ *
+ * This function is responsible for properly deallocating a plutus map object (`cardano_plutus_map_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_map_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_map_t* map = (cardano_plutus_map_t*)object;
+
+  cardano_array_unref(&map->array);
+  cardano_buffer_unref(&map->cbor_cache);
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a plutus map key value pair object.
+ *
+ * This function is responsible for properly deallocating a plutus map key value pair object (`cardano_plutus_map_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_map_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_map_kvp_t* map = (cardano_plutus_map_kvp_t*)object;
+
+  if (map->key != NULL)
+  {
+    cardano_plutus_data_unref(&map->key);
+  }
+
+  if (map->value != NULL)
+  {
+    cardano_plutus_data_unref(&map->value);
+  }
+
+  _cardano_free(map);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_map_new(cardano_plutus_map_t** plutus_map)
+{
+  if (plutus_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_map_t* map = _cardano_malloc(sizeof(cardano_plutus_map_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count          = 1;
+  map->base.last_error[0]      = '\0';
+  map->base.deallocator        = cardano_plutus_map_deallocate;
+  map->use_indefinite_encoding = false;
+  map->cbor_cache              = NULL;
+
+  map->array = cardano_array_new(128);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *plutus_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_map_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_map_t** plutus_map)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t*      cbor_cache  = NULL;
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        copy_result = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return copy_result;
+  }
+
+  copy_result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    *plutus_map = NULL;
+    return copy_result;
+  }
+
+  cardano_plutus_map_t* map    = NULL;
+  cardano_error_t       result = cardano_plutus_map_new(&map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    return result;
+  }
+
+  map->cbor_cache = cbor_cache;
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_map(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_map_unref(&map);
+    return result;
+  }
+
+  map->use_indefinite_encoding = length < 0;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_map_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_plutus_data_t* key   = NULL;
+    cardano_plutus_data_t* value = NULL;
+
+    result = cardano_plutus_data_from_cbor(reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_map_unref(&map);
+      return result;
+    }
+
+    result = cardano_plutus_data_from_cbor(reader, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_data_unref(&key);
+      cardano_plutus_map_unref(&map);
+      return result;
+    }
+
+    cardano_plutus_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_plutus_map_kvp_t));
+
+    if (kvp == NULL)
+    {
+      cardano_plutus_data_unref(&key);
+      cardano_plutus_data_unref(&value);
+      cardano_plutus_map_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    kvp->base.ref_count     = 0;
+    kvp->base.last_error[0] = '\0';
+    kvp->base.deallocator   = cardano_plutus_map_kvp_deallocate;
+    kvp->key                = key;
+    kvp->value              = value;
+
+    const size_t old_size = cardano_array_get_size(map->array);
+    const size_t new_size = cardano_array_push(map->array, (cardano_object_t*)((void*)kvp));
+
+    if (new_size != (old_size + 1U))
+    {
+      cardano_plutus_map_kvp_deallocate(kvp);
+      cardano_plutus_map_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_map("plutus_map", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_map_unref(&map);
+    return result;
+  }
+
+  *plutus_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_map_to_cbor(const cardano_plutus_map_t* plutus_map, cardano_cbor_writer_t* writer)
+{
+  if (plutus_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_map->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(plutus_map->cbor_cache), cardano_buffer_get_size(plutus_map->cbor_cache));
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (plutus_map->use_indefinite_encoding)
+  {
+    result = cardano_cbor_writer_write_start_map(writer, -1);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    };
+  }
+  else
+  {
+    size_t map_size = cardano_array_get_size(plutus_map->array);
+    result          = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(plutus_map->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in plutus map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_plutus_map_kvp_t* kvp_data = (cardano_plutus_map_kvp_t*)((void*)kvp);
+
+    result = cardano_plutus_data_to_cbor(kvp_data->key, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    result = cardano_plutus_data_to_cbor(kvp_data->value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    cardano_object_unref(&kvp);
+  }
+
+  if (plutus_map->use_indefinite_encoding)
+  {
+    result = cardano_cbor_writer_write_end_map(writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_map_to_cip116_json(
+  const cardano_plutus_map_t* map,
+  cardano_json_writer_t*      writer)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "map", 3);
+  cardano_json_writer_write_property_name(writer, "contents", 8);
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0; i < cardano_array_get_size(map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(map->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_json_writer_set_last_error(writer, "Element in plutus map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_plutus_map_kvp_t* kvp_data = (cardano_plutus_map_kvp_t*)((void*)kvp);
+
+    cardano_json_writer_write_start_object(writer);
+    cardano_json_writer_write_property_name(writer, "key", 3);
+    result = cardano_plutus_data_to_cip116_json(kvp_data->key, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    cardano_json_writer_write_property_name(writer, "value", 5);
+    result = cardano_plutus_data_to_cip116_json(kvp_data->value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    cardano_json_writer_write_end_object(writer);
+
+    cardano_object_unref(&kvp);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+  cardano_json_writer_write_end_object(writer);
+
+  return result;
+}
+
+size_t
+cardano_plutus_map_get_length(const cardano_plutus_map_t* plutus_map)
+{
+  if (plutus_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(plutus_map->array);
+}
+
+cardano_error_t
+cardano_plutus_map_get(
+  cardano_plutus_map_t*   plutus_map,
+  cardano_plutus_data_t*  key,
+  cardano_plutus_data_t** element)
+{
+  if (plutus_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_map->array); ++i)
+  {
+    cardano_object_t*         object = cardano_array_get(plutus_map->array, i);
+    cardano_plutus_map_kvp_t* kvp    = (cardano_plutus_map_kvp_t*)((void*)object);
+
+    if (cardano_plutus_data_equals(kvp->key, key))
+    {
+      cardano_plutus_data_ref(kvp->value);
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_plutus_map_insert(
+  cardano_plutus_map_t*  plutus_map,
+  cardano_plutus_data_t* key,
+  cardano_plutus_data_t* value)
+{
+  if (plutus_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_plutus_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_plutus_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_plutus_data_ref(key);
+  cardano_plutus_data_ref(value);
+
+  const size_t old_size = cardano_array_get_size(plutus_map->array);
+  const size_t new_size = cardano_array_push(plutus_map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_plutus_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_map_get_keys(
+  cardano_plutus_map_t*   plutus_map,
+  cardano_plutus_list_t** keys)
+{
+  if (plutus_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_list_t* list = NULL;
+
+  cardano_error_t result = cardano_plutus_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_map->array); ++i)
+  {
+    cardano_object_t*         object = cardano_array_get(plutus_map->array, i);
+    cardano_plutus_map_kvp_t* kvp    = (cardano_plutus_map_kvp_t*)((void*)object);
+
+    result = cardano_plutus_list_add(list, kvp->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_map_get_values(
+  cardano_plutus_map_t*   plutus_map,
+  cardano_plutus_list_t** values)
+{
+  if (plutus_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (values == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_list_t* list = NULL;
+
+  cardano_error_t result = cardano_plutus_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_map->array); ++i)
+  {
+    cardano_object_t*         object = cardano_array_get(plutus_map->array, i);
+    cardano_plutus_map_kvp_t* kvp    = (cardano_plutus_map_kvp_t*)((void*)object);
+
+    result = cardano_plutus_list_add(list, kvp->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *values = list;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_plutus_map_equals(const cardano_plutus_map_t* lhs, const cardano_plutus_map_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  if (cardano_array_get_size(lhs->array) != cardano_array_get_size(rhs->array))
+  {
+    return false;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_object_t* lhs_element = cardano_array_get(lhs->array, i);
+    cardano_object_t* rhs_element = cardano_array_get(rhs->array, i);
+
+    cardano_object_unref(&lhs_element);
+    cardano_object_unref(&rhs_element);
+
+    cardano_plutus_map_kvp_t* lhs_element_data = (cardano_plutus_map_kvp_t*)((void*)lhs_element);
+    cardano_plutus_map_kvp_t* rhs_element_data = (cardano_plutus_map_kvp_t*)((void*)rhs_element);
+
+    if (!cardano_plutus_data_equals(lhs_element_data->key, rhs_element_data->key))
+    {
+      return false;
+    }
+
+    if (!cardano_plutus_data_equals(lhs_element_data->value, rhs_element_data->value))
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+void
+cardano_plutus_map_clear_cbor_cache(cardano_plutus_map_t* plutus_map)
+{
+  if (plutus_map == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&plutus_map->cbor_cache);
+
+  plutus_map->cbor_cache = NULL;
+}
+
+void
+cardano_plutus_map_unref(cardano_plutus_map_t** plutus_map)
+{
+  if ((plutus_map == NULL) || (*plutus_map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_map = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_map_ref(cardano_plutus_map_t* plutus_map)
+{
+  if (plutus_map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_map->base);
+}
+
+size_t
+cardano_plutus_map_refcount(const cardano_plutus_map_t* plutus_map)
+{
+  if (plutus_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_map->base);
+}
+
+void
+cardano_plutus_map_set_last_error(cardano_plutus_map_t* plutus_map, const char* message)
+{
+  cardano_object_set_last_error(&plutus_map->base, message);
+}
+
+const char*
+cardano_plutus_map_get_last_error(const cardano_plutus_map_t* plutus_map)
+{
+  return cardano_object_get_last_error(&plutus_map->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_plutus_map_kvp_deep_clone(const cardano_plutus_map_kvp_t* source, cardano_plutus_map_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_map_kvp_t* copy = _cardano_malloc(sizeof(cardano_plutus_map_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = NULL;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_data_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_data_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_plutus_map_kvp_t* copy   = NULL;
+  const cardano_error_t     result = cardano_plutus_map_kvp_deep_clone((const cardano_plutus_map_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_map_deep_clone(const cardano_plutus_map_t* source, cardano_plutus_map_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_map_t* copy = _cardano_malloc(sizeof(cardano_plutus_map_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count          = 1U;
+  copy->base.deallocator        = source->base.deallocator;
+  copy->base.last_error[0]      = '\0';
+  copy->array                   = NULL;
+  copy->cbor_cache              = NULL;
+  copy->use_indefinite_encoding = source->use_indefinite_encoding;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/pool_params/bls_key.c b/vendor/src/pool_params/bls_key.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/bls_key.c
@@ -0,0 +1,420 @@
+/**
+ * \file bls_key.c
+ *
+ * \author angel.castillo
+ * \date   Sep 05, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/object.h>
+#include <cardano/pool_params/bls_key.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <sodium/core.h>
+#include <sodium/utils.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE       = 2;
+static const size_t  BLS_PUBLIC_KEY_SIZE       = 96U;
+static const size_t  BLS_POSSESSION_PROOF_SIZE = 48U;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a stake pool BLS key.
+ *
+ * Each instance of `cardano_bls_key_t` holds a BLS public key together with its proof of possession.
+ */
+typedef struct cardano_bls_key_t
+{
+    cardano_object_t base;
+    byte_t           public_key[96];
+    byte_t           possession_proof[48];
+} cardano_bls_key_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a bls_key object.
+ *
+ * This function is responsible for properly deallocating a bls_key object (`cardano_bls_key_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the bls_key object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_bls_key_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the bls_key
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_bls_key_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_bls_key_new(
+  const byte_t*       public_key,
+  const size_t        public_key_size,
+  const byte_t*       possession_proof,
+  const size_t        possession_proof_size,
+  cardano_bls_key_t** bls_key)
+{
+  if (bls_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *bls_key = NULL;
+
+  if ((public_key == NULL) || (possession_proof == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((public_key_size != BLS_PUBLIC_KEY_SIZE) || (possession_proof_size != BLS_POSSESSION_PROOF_SIZE))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *bls_key = _cardano_malloc(sizeof(cardano_bls_key_t));
+
+  if (*bls_key == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*bls_key)->base.deallocator   = cardano_bls_key_deallocate;
+  (*bls_key)->base.ref_count     = 1;
+  (*bls_key)->base.last_error[0] = '\0';
+
+  cardano_safe_memcpy((*bls_key)->public_key, sizeof((*bls_key)->public_key), public_key, public_key_size);
+  cardano_safe_memcpy((*bls_key)->possession_proof, sizeof((*bls_key)->possession_proof), possession_proof, possession_proof_size);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bls_key_new_from_hex(
+  const char*         public_key_hex,
+  const size_t        public_key_hex_size,
+  const char*         possession_proof_hex,
+  const size_t        possession_proof_hex_size,
+  cardano_bls_key_t** bls_key)
+{
+  if (bls_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *bls_key = NULL;
+
+  if ((public_key_hex == NULL) || (possession_proof_hex == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const size_t hex_characters_per_byte = 2U;
+
+  if ((public_key_hex_size != (BLS_PUBLIC_KEY_SIZE * hex_characters_per_byte)) || (possession_proof_hex_size != (BLS_POSSESSION_PROOF_SIZE * hex_characters_per_byte)))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  byte_t public_key[96]       = { 0 };
+  byte_t possession_proof[48] = { 0 };
+
+  const int init_result = sodium_init();
+
+  if (init_result == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  if (sodium_hex2bin(public_key, sizeof(public_key), public_key_hex, public_key_hex_size, NULL, NULL, NULL) < 0)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (sodium_hex2bin(possession_proof, sizeof(possession_proof), possession_proof_hex, possession_proof_hex_size, NULL, NULL, NULL) < 0)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  return cardano_bls_key_new(public_key, sizeof(public_key), possession_proof, sizeof(possession_proof), bls_key);
+}
+
+cardano_error_t
+cardano_bls_key_from_cbor(cardano_cbor_reader_t* reader, cardano_bls_key_t** bls_key)
+{
+  if (bls_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *bls_key = NULL;
+
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "bls_key";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  cardano_buffer_t*     public_key             = NULL;
+  const cardano_error_t read_public_key_result = cardano_cbor_validate_byte_string_of_size(validator_name, reader, &public_key, (uint32_t)BLS_PUBLIC_KEY_SIZE);
+
+  if (read_public_key_result != CARDANO_SUCCESS)
+  {
+    return read_public_key_result;
+  }
+
+  cardano_buffer_t*     possession_proof             = NULL;
+  const cardano_error_t read_possession_proof_result = cardano_cbor_validate_byte_string_of_size(validator_name, reader, &possession_proof, (uint32_t)BLS_POSSESSION_PROOF_SIZE);
+
+  if (read_possession_proof_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&public_key);
+    return read_possession_proof_result;
+  }
+
+  const cardano_error_t new_result = cardano_bls_key_new(
+    cardano_buffer_get_data(public_key),
+    cardano_buffer_get_size(public_key),
+    cardano_buffer_get_data(possession_proof),
+    cardano_buffer_get_size(possession_proof),
+    bls_key);
+
+  cardano_buffer_unref(&public_key);
+  cardano_buffer_unref(&possession_proof);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  const cardano_error_t end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_bls_key_unref(bls_key);
+  }
+
+  return end_array_result;
+}
+
+cardano_error_t
+cardano_bls_key_to_cbor(const cardano_bls_key_t* bls_key, cardano_cbor_writer_t* writer)
+{
+  if (bls_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  const cardano_error_t write_public_key_result = cardano_cbor_writer_write_bytestring(writer, bls_key->public_key, sizeof(bls_key->public_key));
+
+  if (write_public_key_result != CARDANO_SUCCESS)
+  {
+    return write_public_key_result;
+  }
+
+  return cardano_cbor_writer_write_bytestring(writer, bls_key->possession_proof, sizeof(bls_key->possession_proof));
+}
+
+cardano_error_t
+cardano_bls_key_to_cip116_json(
+  const cardano_bls_key_t* bls_key,
+  cardano_json_writer_t*   writer)
+{
+  if ((bls_key == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "public_key", 10);
+  cardano_json_writer_write_bytes_as_hex(writer, bls_key->public_key, sizeof(bls_key->public_key));
+
+  cardano_json_writer_write_property_name(writer, "possession_proof", 16);
+  cardano_json_writer_write_bytes_as_hex(writer, bls_key->possession_proof, sizeof(bls_key->possession_proof));
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_bls_key_get_public_key_size(const cardano_bls_key_t* bls_key)
+{
+  if (bls_key == NULL)
+  {
+    return 0;
+  }
+
+  return sizeof(bls_key->public_key);
+}
+
+const byte_t*
+cardano_bls_key_get_public_key_bytes(const cardano_bls_key_t* bls_key)
+{
+  if (bls_key == NULL)
+  {
+    return NULL;
+  }
+
+  return bls_key->public_key;
+}
+
+size_t
+cardano_bls_key_get_possession_proof_size(const cardano_bls_key_t* bls_key)
+{
+  if (bls_key == NULL)
+  {
+    return 0;
+  }
+
+  return sizeof(bls_key->possession_proof);
+}
+
+const byte_t*
+cardano_bls_key_get_possession_proof_bytes(const cardano_bls_key_t* bls_key)
+{
+  if (bls_key == NULL)
+  {
+    return NULL;
+  }
+
+  return bls_key->possession_proof;
+}
+
+void
+cardano_bls_key_unref(cardano_bls_key_t** bls_key)
+{
+  if ((bls_key == NULL) || (*bls_key == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*bls_key)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *bls_key = NULL;
+    return;
+  }
+}
+
+void
+cardano_bls_key_ref(cardano_bls_key_t* bls_key)
+{
+  if (bls_key == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&bls_key->base);
+}
+
+size_t
+cardano_bls_key_refcount(const cardano_bls_key_t* bls_key)
+{
+  if (bls_key == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&bls_key->base);
+}
+
+void
+cardano_bls_key_set_last_error(cardano_bls_key_t* bls_key, const char* message)
+{
+  cardano_object_set_last_error(&bls_key->base, message);
+}
+
+const char*
+cardano_bls_key_get_last_error(const cardano_bls_key_t* bls_key)
+{
+  return cardano_object_get_last_error(&bls_key->base);
+}
+
+cardano_error_t
+cardano_bls_key_deep_clone(const cardano_bls_key_t* source, cardano_bls_key_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bls_key_t* copy = _cardano_malloc(sizeof(cardano_bls_key_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  CARDANO_UNUSED(memcpy(copy->public_key, source->public_key, sizeof(copy->public_key)));
+  CARDANO_UNUSED(memcpy(copy->possession_proof, source->possession_proof, sizeof(copy->possession_proof)));
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/pool_params/ipv4.c b/vendor/src/pool_params/ipv4.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/ipv4.c
@@ -0,0 +1,410 @@
+/**
+ * \file ipv4.c
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/pool_params/ipv4.h>
+
+#include "../allocators.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an IPv4 address.
+ *
+ * Each instance of `cardano_ipv4_t` holds a single IPv4 address in network byte order (big endian).
+ */
+typedef struct cardano_ipv4_t
+{
+    cardano_object_t base;
+    byte_t           ip_bytes[4];
+    char             ip_str[16];
+} cardano_ipv4_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a ipv4 object.
+ *
+ * This function is responsible for properly deallocating a ipv4 object (`cardano_ipv4_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the ipv4 object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_ipv4_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the ipv4
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_ipv4_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  _cardano_free(object);
+}
+
+/**
+ * Converts a 4-byte array representing an IPv4 address into a dotted decimal string.
+ *
+ * \param[in] ip_data Pointer to an array containing the 4 bytes of the IPv4 address.
+ * \param[in] ip_data_size The size of the array pointed to by ip_data. Should be 4 for valid IPv4 addresses.
+ * \param[out] destination Pointer to the buffer where the resulting string representation of the IP address will be stored.
+ * \param[in] destination_size The size of the buffer pointed to by destination. Must be at least 16 bytes to fit the entire string.
+ *
+ * \warning The function assumes ip_data_size is correctly 4. If not, the behavior is undefined.
+ * Make sure destination is large enough to hold the IP address string ("xxx.xxx.xxx.xxx\0").
+ */
+static void
+ip_to_string(const byte_t* ip_data, const size_t ip_data_size, char* destination, const size_t destination_size)
+{
+  assert(ip_data != NULL);
+  assert(ip_data_size == 4U);
+  assert(destination != NULL);
+  assert(destination_size == 16U);
+
+  CARDANO_UNUSED(ip_data_size);
+
+  const int32_t result = snprintf(destination, destination_size, "%d.%d.%d.%d", ip_data[0], ip_data[1], ip_data[2], ip_data[3]);
+
+  assert(result > 0);
+  CARDANO_UNUSED(result);
+}
+
+/**
+ * Converts a string representing an IPv4 address in dotted decimal format into a 4-byte array.
+ *
+ * \param ip_string Pointer to the string containing the IPv4 address in dotted decimal format.
+ * \param string_size The number of input characters.
+ * \param ip_data Pointer to the array where the bytes of the IPv4 address will be stored.
+ * \param ip_data_size The size of the array pointed to by ip_data. Should be at least 4.
+ *
+ * \return int Returns 0 if the conversion is successful, \ref cardano_error_t if the string format is invalid or ip_data_size is less than 4.
+ */
+static cardano_error_t
+ip_from_string(const char* ip_string, const size_t string_size, byte_t* ip_data, const size_t ip_data_size)
+{
+  assert(ip_string != NULL);
+  assert(ip_data != NULL);
+  assert(ip_data_size == 4U);
+
+  size_t   component = 0U;
+  size_t   digits    = 0U;
+  uint32_t value     = 0U;
+
+  for (size_t i = 0U; i < string_size; ++i)
+  {
+    const char current = ip_string[i];
+
+    if ((current >= '0') && (current <= '9'))
+    {
+      ++digits;
+      value = (value * 10U) + ((uint32_t)current - (uint32_t)'0');
+
+      if ((digits > 3U) || (value > 255U))
+      {
+        return CARDANO_ERROR_INVALID_ARGUMENT;
+      }
+    }
+    else if ((current == '.') && (digits > 0U) && (component < (ip_data_size - 1U)))
+    {
+      ip_data[component] = (byte_t)value;
+      ++component;
+      digits = 0U;
+      value  = 0U;
+    }
+    else
+    {
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+
+  if ((component != (ip_data_size - 1U)) || (digits == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  ip_data[component] = (byte_t)value;
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_ipv4_new(const byte_t* data, const size_t size, cardano_ipv4_t** ipv4)
+{
+  if (ipv4 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size != 4U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *ipv4 = _cardano_malloc(sizeof(cardano_ipv4_t));
+
+  if (*ipv4 == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*ipv4)->base.deallocator   = cardano_ipv4_deallocate;
+  (*ipv4)->base.ref_count     = 1;
+  (*ipv4)->base.last_error[0] = '\0';
+
+  cardano_safe_memcpy((*ipv4)->ip_bytes, 4, data, 4);
+  ip_to_string((*ipv4)->ip_bytes, 4, (*ipv4)->ip_str, 16);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ipv4_from_string(const char* string, const size_t size, cardano_ipv4_t** ipv4)
+{
+  if (ipv4 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (string == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((size < 7U) || (size > 15U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *ipv4 = _cardano_malloc(sizeof(cardano_ipv4_t));
+
+  if (*ipv4 == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*ipv4)->base.deallocator   = cardano_ipv4_deallocate;
+  (*ipv4)->base.ref_count     = 1;
+  (*ipv4)->base.last_error[0] = '\0';
+
+  cardano_error_t result = ip_from_string(string, size, (*ipv4)->ip_bytes, 4);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_ipv4_deallocate(*ipv4);
+    *ipv4 = NULL;
+    return result;
+  }
+
+  CARDANO_UNUSED(memset((*ipv4)->ip_str, 0, 16));
+
+  cardano_safe_memcpy((*ipv4)->ip_str, 16, string, size);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ipv4_from_cbor(cardano_cbor_reader_t* reader, cardano_ipv4_t** ipv4)
+{
+  if (ipv4 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *ipv4 = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* buffer           = NULL;
+  cardano_error_t   read_byte_string = cardano_cbor_reader_read_bytestring(reader, &buffer);
+
+  if (read_byte_string != CARDANO_SUCCESS)
+  {
+    return read_byte_string;
+  }
+
+  cardano_error_t result = cardano_ipv4_new(cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer), ipv4);
+
+  cardano_buffer_unref(&buffer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_ipv4_to_cbor(const cardano_ipv4_t* ipv4, cardano_cbor_writer_t* writer)
+{
+  if (ipv4 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_cbor_writer_write_bytestring(writer, ipv4->ip_bytes, sizeof(ipv4->ip_bytes));
+}
+
+size_t
+cardano_ipv4_get_bytes_size(const cardano_ipv4_t* ipv4)
+{
+  if (ipv4 == NULL)
+  {
+    return 0;
+  }
+
+  return 4;
+}
+
+const byte_t*
+cardano_ipv4_get_bytes(const cardano_ipv4_t* ipv4)
+{
+  if (ipv4 == NULL)
+  {
+    return NULL;
+  }
+
+  return ipv4->ip_bytes;
+}
+
+size_t
+cardano_ipv4_get_string_size(const cardano_ipv4_t* ipv4)
+{
+  if (ipv4 == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_safe_strlen(ipv4->ip_str, 16);
+}
+
+const char*
+cardano_ipv4_get_string(const cardano_ipv4_t* ipv4)
+{
+  if (ipv4 == NULL)
+  {
+    return NULL;
+  }
+
+  return ipv4->ip_str;
+}
+
+void
+cardano_ipv4_unref(cardano_ipv4_t** ipv4)
+{
+  if ((ipv4 == NULL) || (*ipv4 == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*ipv4)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *ipv4 = NULL;
+    return;
+  }
+}
+
+void
+cardano_ipv4_ref(cardano_ipv4_t* ipv4)
+{
+  if (ipv4 == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&ipv4->base);
+}
+
+size_t
+cardano_ipv4_refcount(const cardano_ipv4_t* ipv4)
+{
+  if (ipv4 == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&ipv4->base);
+}
+
+void
+cardano_ipv4_set_last_error(cardano_ipv4_t* ipv4, const char* message)
+{
+  cardano_object_set_last_error(&ipv4->base, message);
+}
+
+const char*
+cardano_ipv4_get_last_error(const cardano_ipv4_t* ipv4)
+{
+  return cardano_object_get_last_error(&ipv4->base);
+}
+
+cardano_error_t
+cardano_ipv4_deep_clone(const cardano_ipv4_t* source, cardano_ipv4_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ipv4_t* copy = _cardano_malloc(sizeof(cardano_ipv4_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  CARDANO_UNUSED(memcpy(copy->ip_bytes, source->ip_bytes, sizeof(copy->ip_bytes)));
+  CARDANO_UNUSED(memcpy(copy->ip_str, source->ip_str, sizeof(copy->ip_str)));
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/pool_params/ipv6.c b/vendor/src/pool_params/ipv6.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/ipv6.c
@@ -0,0 +1,419 @@
+/**
+ * \file ipv6.c
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/pool_params/ipv6.h>
+
+#include "../allocators.h"
+#include "../endian.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an IPv6 address.
+ *
+ * Each instance of `cardano_ipv6_t` holds a single IPv6 address in network byte order (big endian).
+ */
+typedef struct cardano_ipv6_t
+{
+    cardano_object_t base;
+    byte_t           ip_bytes[16];
+    char             ip_str[40];
+} cardano_ipv6_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a ipv6 object.
+ *
+ * This function is responsible for properly deallocating a ipv6 object (`cardano_ipv6_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the ipv6 object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_ipv6_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the ipv6
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_ipv6_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  _cardano_free(object);
+}
+
+/**
+ * Converts a 16-byte array representing an IPv6 address into a colon-separated hexadecimal string.
+ *
+ * \param[in] ip_data Pointer to an array containing the 16 bytes of the IPv6 address.
+ * \param[in] ip_data_size The size of the array pointed to by ip_data. Should be 16 for valid IPv6 addresses.
+ * \param[out] destination Pointer to the buffer where the resulting string representation of the IP address will be stored.
+ * \param[in] destination_size The size of the buffer pointed to by destination. Must be at least 40 bytes to fit the entire string plus the null terminator.
+ *
+ * \warning The function assumes ip_data_size is correctly 16. If not, the behavior is undefined.
+ * Make sure the destination is large enough to hold the IP address string (up to "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx\0").
+ */
+static void
+ip_to_string(const byte_t* ip_data, const size_t ip_data_size, char* destination, const size_t destination_size)
+{
+  assert(ip_data != NULL);
+  assert(ip_data_size == 16U);
+  assert(destination != NULL);
+  assert(destination_size >= 40U);
+
+  CARDANO_UNUSED(ip_data_size);
+
+  int32_t result = snprintf(destination, destination_size, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", ip_data[0], ip_data[1], ip_data[2], ip_data[3], ip_data[4], ip_data[5], ip_data[6], ip_data[7], ip_data[8], ip_data[9], ip_data[10], ip_data[11], ip_data[12], ip_data[13], ip_data[14], ip_data[15]);
+
+  assert(result > 0);
+  CARDANO_UNUSED(result);
+}
+
+/**
+ * Converts a string representing an IPv6 address in colon-separated hexadecimal format into a 16-byte array.
+ *
+ * \param ip_string Pointer to the string containing the IPv6 address in colon-separated hexadecimal format.
+ * \param string_size The number of input characters.
+ * \param ip_data Pointer to the array where the bytes of the IPv6 address will be stored.
+ * \param ip_data_size The size of the array pointed to by ip_data. Should be at least 16.
+ *
+ * \return cardano_error_t Returns CARDANO_SUCCESS if the conversion is successful,
+ *         CARDANO_ERROR_INVALID_ARGUMENT if the string format is invalid or ip_data_size is less than 16.
+ */
+static cardano_error_t
+ip_from_string(const char* ip_string, const size_t string_size, byte_t* ip_data, const size_t ip_data_size)
+{
+  assert(ip_string != NULL);
+  assert(ip_data != NULL);
+  assert(ip_data_size == 16U);
+  assert(string_size == 39U);
+
+  CARDANO_UNUSED(string_size);
+
+  for (size_t component = 0U; component < 8U; ++component)
+  {
+    uint16_t value = 0U;
+
+    for (size_t digit = 0U; digit < 4U; ++digit)
+    {
+      const char current = ip_string[(component * 5U) + digit];
+      uint16_t   nibble  = 0U;
+
+      if ((current >= '0') && (current <= '9'))
+      {
+        nibble = (uint16_t)current - (uint16_t)'0';
+      }
+      else if ((current >= 'a') && (current <= 'f'))
+      {
+        nibble = ((uint16_t)current - (uint16_t)'a') + 10U;
+      }
+      else if ((current >= 'A') && (current <= 'F'))
+      {
+        nibble = ((uint16_t)current - (uint16_t)'A') + 10U;
+      }
+      else
+      {
+        return CARDANO_ERROR_INVALID_ARGUMENT;
+      }
+
+      value = (uint16_t)((value * 16U) + nibble);
+    }
+
+    if ((component < 7U) && (ip_string[(component * 5U) + 4U] != ':'))
+    {
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+
+    const cardano_error_t result = cardano_write_uint16_be(value, ip_data, ip_data_size, component * 2U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_ipv6_new(const byte_t* data, const size_t size, cardano_ipv6_t** ipv6)
+{
+  if (ipv6 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size != 16U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *ipv6 = _cardano_malloc(sizeof(cardano_ipv6_t));
+
+  if (*ipv6 == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*ipv6)->base.deallocator   = cardano_ipv6_deallocate;
+  (*ipv6)->base.ref_count     = 1;
+  (*ipv6)->base.last_error[0] = '\0';
+
+  cardano_safe_memcpy((*ipv6)->ip_bytes, 16, data, 16);
+  ip_to_string((*ipv6)->ip_bytes, 16, (*ipv6)->ip_str, 40);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ipv6_from_string(const char* string, const size_t size, cardano_ipv6_t** ipv6)
+{
+  if (ipv6 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (string == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size != 39U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *ipv6 = _cardano_malloc(sizeof(cardano_ipv6_t));
+
+  if (*ipv6 == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*ipv6)->base.deallocator   = cardano_ipv6_deallocate;
+  (*ipv6)->base.ref_count     = 1;
+  (*ipv6)->base.last_error[0] = '\0';
+
+  cardano_error_t result = ip_from_string(string, size, (*ipv6)->ip_bytes, 16);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_ipv6_deallocate(*ipv6);
+    *ipv6 = NULL;
+    return result;
+  }
+
+  CARDANO_UNUSED(memset((*ipv6)->ip_str, 0, 40));
+
+  cardano_safe_memcpy((*ipv6)->ip_str, 40, string, size);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ipv6_from_cbor(cardano_cbor_reader_t* reader, cardano_ipv6_t** ipv6)
+{
+  if (ipv6 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *ipv6 = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* buffer           = NULL;
+  cardano_error_t   read_byte_string = cardano_cbor_reader_read_bytestring(reader, &buffer);
+
+  if (read_byte_string != CARDANO_SUCCESS)
+  {
+    return read_byte_string;
+  }
+
+  cardano_error_t result = cardano_ipv6_new(cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer), ipv6);
+
+  cardano_buffer_unref(&buffer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_ipv6_to_cbor(const cardano_ipv6_t* ipv6, cardano_cbor_writer_t* writer)
+{
+  if (ipv6 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_cbor_writer_write_bytestring(writer, ipv6->ip_bytes, sizeof(ipv6->ip_bytes));
+}
+
+size_t
+cardano_ipv6_get_bytes_size(const cardano_ipv6_t* ipv6)
+{
+  if (ipv6 == NULL)
+  {
+    return 0;
+  }
+
+  return 16;
+}
+
+const byte_t*
+cardano_ipv6_get_bytes(const cardano_ipv6_t* ipv6)
+{
+  if (ipv6 == NULL)
+  {
+    return NULL;
+  }
+
+  return ipv6->ip_bytes;
+}
+
+size_t
+cardano_ipv6_get_string_size(const cardano_ipv6_t* ipv6)
+{
+  if (ipv6 == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_safe_strlen(ipv6->ip_str, 40);
+}
+
+const char*
+cardano_ipv6_get_string(const cardano_ipv6_t* ipv6)
+{
+  if (ipv6 == NULL)
+  {
+    return NULL;
+  }
+
+  return ipv6->ip_str;
+}
+
+void
+cardano_ipv6_unref(cardano_ipv6_t** ipv6)
+{
+  if ((ipv6 == NULL) || (*ipv6 == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*ipv6)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *ipv6 = NULL;
+    return;
+  }
+}
+
+void
+cardano_ipv6_ref(cardano_ipv6_t* ipv6)
+{
+  if (ipv6 == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&ipv6->base);
+}
+
+size_t
+cardano_ipv6_refcount(const cardano_ipv6_t* ipv6)
+{
+  if (ipv6 == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&ipv6->base);
+}
+
+void
+cardano_ipv6_set_last_error(cardano_ipv6_t* ipv6, const char* message)
+{
+  cardano_object_set_last_error(&ipv6->base, message);
+}
+
+const char*
+cardano_ipv6_get_last_error(const cardano_ipv6_t* ipv6)
+{
+  return cardano_object_get_last_error(&ipv6->base);
+}
+
+cardano_error_t
+cardano_ipv6_deep_clone(const cardano_ipv6_t* source, cardano_ipv6_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ipv6_t* copy = _cardano_malloc(sizeof(cardano_ipv6_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  CARDANO_UNUSED(memcpy(copy->ip_bytes, source->ip_bytes, sizeof(copy->ip_bytes)));
+  CARDANO_UNUSED(memcpy(copy->ip_str, source->ip_str, sizeof(copy->ip_str)));
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/pool_params/multi_host_name_relay.c b/vendor/src/pool_params/multi_host_name_relay.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/multi_host_name_relay.c
@@ -0,0 +1,373 @@
+/**
+ * \file multi_host_name_relay.c
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/pool_params/multi_host_name_relay.h>
+#include <cardano/pool_params/relay.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an multi host name relay.
+ *
+ * Each instance of `cardano_multi_host_name_relay_t` holds a single multi host name relay.
+ */
+typedef struct cardano_multi_host_name_relay_t
+{
+    cardano_object_t base;
+    char             dns[65];
+} cardano_multi_host_name_relay_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a multi_host_name_relay object.
+ *
+ * This function is responsible for properly deallocating a multi_host_name_relay object (`cardano_multi_host_name_relay_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the multi_host_name_relay object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_multi_host_name_relay_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the multi_host_name_relay
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_multi_host_name_relay_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_multi_host_name_relay_new(const char* dns, const size_t str_size, cardano_multi_host_name_relay_t** multi_host_name_relay)
+{
+  if (multi_host_name_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (dns == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((str_size > 64U) || (str_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *multi_host_name_relay = _cardano_malloc(sizeof(cardano_multi_host_name_relay_t));
+
+  if (*multi_host_name_relay == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*multi_host_name_relay)->base.deallocator   = cardano_multi_host_name_relay_deallocate;
+  (*multi_host_name_relay)->base.ref_count     = 1;
+  (*multi_host_name_relay)->base.last_error[0] = '\0';
+
+  CARDANO_UNUSED(memset((*multi_host_name_relay)->dns, 0, 65));
+  cardano_safe_memcpy((*multi_host_name_relay)->dns, 65, dns, str_size);
+
+  const size_t dns_size                   = cardano_safe_strlen((*multi_host_name_relay)->dns, 64);
+  (*multi_host_name_relay)->dns[dns_size] = '\0';
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_multi_host_name_relay_from_cbor(cardano_cbor_reader_t* reader, cardano_multi_host_name_relay_t** multi_host_name_relay)
+{
+  if (multi_host_name_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *multi_host_name_relay = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "multi_host_name_relay";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *multi_host_name_relay = NULL;
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_RELAY_TYPE_MULTI_HOST_NAME,
+    (enum_to_string_callback_t)((void*)&cardano_relay_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_buffer_t* dns = NULL;
+
+  const cardano_error_t read_string_result = cardano_cbor_reader_read_textstring(reader, &dns);
+
+  if (read_string_result != CARDANO_SUCCESS)
+  {
+    return read_string_result;
+  }
+
+  const size_t dns_size = cardano_buffer_get_size(dns);
+  const char*  dns_data = (char*)((void*)cardano_buffer_get_data(dns));
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&dns);
+    *multi_host_name_relay = NULL;
+
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t result = cardano_multi_host_name_relay_new(dns_data, dns_size, multi_host_name_relay);
+
+  cardano_buffer_unref(&dns);
+
+  return result;
+}
+
+cardano_error_t
+cardano_multi_host_name_relay_to_cbor(const cardano_multi_host_name_relay_t* multi_host_name_relay, cardano_cbor_writer_t* writer)
+{
+  if (multi_host_name_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, CARDANO_RELAY_TYPE_MULTI_HOST_NAME);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  return cardano_cbor_writer_write_textstring(writer, multi_host_name_relay->dns, cardano_safe_strlen(multi_host_name_relay->dns, 64));
+}
+
+cardano_error_t
+cardano_multi_host_name_relay_to_cip116_json(
+  const cardano_multi_host_name_relay_t* relay,
+  cardano_json_writer_t*                 writer)
+{
+  if ((relay == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "multi_host_name", 15);
+
+  cardano_json_writer_write_property_name(writer, "dns_name", 8);
+  cardano_json_writer_write_string(writer, relay->dns, cardano_safe_strlen(relay->dns, 64));
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_multi_host_name_relay_get_dns_size(
+  const cardano_multi_host_name_relay_t* multi_host_name_relay)
+{
+  if (multi_host_name_relay == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_safe_strlen(multi_host_name_relay->dns, 64) + 1U;
+}
+
+const char*
+cardano_multi_host_name_relay_get_dns(
+  const cardano_multi_host_name_relay_t* multi_host_name_relay)
+{
+  if (multi_host_name_relay == NULL)
+  {
+    return NULL;
+  }
+
+  return multi_host_name_relay->dns;
+}
+
+cardano_error_t
+cardano_multi_host_name_relay_set_dns(
+  const char*                      dns,
+  size_t                           dns_size,
+  cardano_multi_host_name_relay_t* multi_host_name_relay)
+{
+  if (multi_host_name_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (dns == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((dns_size > 64U) || (dns_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_safe_memcpy((void*)&multi_host_name_relay->dns, 65U, dns, dns_size);
+
+  multi_host_name_relay->dns[dns_size] = '\0';
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_multi_host_name_relay_unref(cardano_multi_host_name_relay_t** multi_host_name_relay)
+{
+  if ((multi_host_name_relay == NULL) || (*multi_host_name_relay == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*multi_host_name_relay)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *multi_host_name_relay = NULL;
+    return;
+  }
+}
+
+void
+cardano_multi_host_name_relay_ref(cardano_multi_host_name_relay_t* multi_host_name_relay)
+{
+  if (multi_host_name_relay == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&multi_host_name_relay->base);
+}
+
+size_t
+cardano_multi_host_name_relay_refcount(const cardano_multi_host_name_relay_t* multi_host_name_relay)
+{
+  if (multi_host_name_relay == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&multi_host_name_relay->base);
+}
+
+void
+cardano_multi_host_name_relay_set_last_error(cardano_multi_host_name_relay_t* multi_host_name_relay, const char* message)
+{
+  cardano_object_set_last_error(&multi_host_name_relay->base, message);
+}
+
+const char*
+cardano_multi_host_name_relay_get_last_error(const cardano_multi_host_name_relay_t* multi_host_name_relay)
+{
+  return cardano_object_get_last_error(&multi_host_name_relay->base);
+}
+
+cardano_error_t
+cardano_multi_host_name_relay_deep_clone(const cardano_multi_host_name_relay_t* source, cardano_multi_host_name_relay_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_host_name_relay_t* copy = _cardano_malloc(sizeof(cardano_multi_host_name_relay_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  CARDANO_UNUSED(memcpy(copy->dns, source->dns, sizeof(copy->dns)));
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/pool_params/pool_metadata.c b/vendor/src/pool_params/pool_metadata.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/pool_metadata.c
@@ -0,0 +1,506 @@
+/**
+ * \file pool_metadata.c
+ *
+ * \author angel.castillo
+ * \date   jun 26, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license") {}
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/object.h>
+#include <cardano/pool_params/pool_metadata.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../crypto/blake2b_hash_internal.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an pool metadata.
+ *
+ * Each instance of `cardano_pool_metadata_t` holds a single pool metadata.
+ */
+typedef struct cardano_pool_metadata_t
+{
+    cardano_object_t        base;
+    char                    url[129];
+    cardano_blake2b_hash_t* hash;
+} cardano_pool_metadata_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a pool_metadata object.
+ *
+ * This function is responsible for properly deallocating a pool_metadata object (`cardano_pool_metadata_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the pool_metadata object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_pool_metadata_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the pool_metadata
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_pool_metadata_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_pool_metadata_t* pool_metadata = (cardano_pool_metadata_t*)object;
+
+  cardano_blake2b_hash_unref(&pool_metadata->hash);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_pool_metadata_new(
+  const char*               url,
+  const size_t              url_length,
+  cardano_blake2b_hash_t*   hash,
+  cardano_pool_metadata_t** pool_metadata)
+{
+  if (pool_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (url == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (url_length > 128U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *pool_metadata = _cardano_malloc(sizeof(cardano_pool_metadata_t));
+
+  if (*pool_metadata == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*pool_metadata)->base.deallocator   = cardano_pool_metadata_deallocate;
+  (*pool_metadata)->base.ref_count     = 1;
+  (*pool_metadata)->base.last_error[0] = '\0';
+
+  CARDANO_UNUSED(memset((*pool_metadata)->url, 0, 129));
+
+  cardano_safe_memcpy((*pool_metadata)->url, 129, url, url_length);
+
+  const size_t url_size           = cardano_safe_strlen((*pool_metadata)->url, 128);
+  (*pool_metadata)->url[url_size] = '\0';
+
+  cardano_blake2b_hash_ref(hash);
+  (*pool_metadata)->hash = hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_metadata_from_hash_hex(
+  const char*               url,
+  size_t                    url_size,
+  const char*               hash,
+  size_t                    hash_size,
+  cardano_pool_metadata_t** pool_metadata)
+{
+  if (pool_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (url == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (url_size > 128U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash_size != 64U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_blake2b_hash_t* blake2b_hash = NULL;
+
+  const cardano_error_t hash_result = cardano_blake2b_hash_from_hex(hash, hash_size, &blake2b_hash);
+
+  if (hash_result != CARDANO_SUCCESS)
+  {
+    *pool_metadata = NULL;
+    return hash_result;
+  }
+
+  cardano_error_t new_metadata_result = cardano_pool_metadata_new(url, url_size, blake2b_hash, pool_metadata);
+
+  cardano_blake2b_hash_unref(&blake2b_hash);
+
+  return new_metadata_result;
+}
+
+cardano_error_t
+cardano_pool_metadata_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_metadata_t** pool_metadata)
+{
+  if (pool_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *pool_metadata = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "pool_metadata";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *pool_metadata = NULL;
+    return expect_array_result;
+  }
+
+  cardano_buffer_t*     url                = NULL;
+  const cardano_error_t read_string_result = cardano_cbor_reader_read_textstring(reader, &url);
+
+  if (read_string_result != CARDANO_SUCCESS)
+  {
+    *pool_metadata = NULL;
+    return read_string_result;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  const cardano_error_t read_hash_result = _cardano_blake2b_hash_from_cbor_allow_empty(reader, &hash);
+
+  if (read_hash_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&url);
+    *pool_metadata = NULL;
+    return read_hash_result;
+  }
+
+  cardano_error_t new_result = cardano_pool_metadata_new(
+    (char*)((void*)cardano_buffer_get_data(url)),
+    cardano_buffer_get_size(url),
+    hash,
+    pool_metadata);
+
+  cardano_buffer_unref(&url);
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    *pool_metadata = NULL;
+    return new_result;
+  }
+
+  const cardano_error_t end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_pool_metadata_unref(pool_metadata);
+    *pool_metadata = NULL;
+  }
+
+  return end_array_result;
+}
+
+cardano_error_t
+cardano_pool_metadata_to_cbor(const cardano_pool_metadata_t* pool_metadata, cardano_cbor_writer_t* writer)
+{
+  if (pool_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_string_result = cardano_cbor_writer_write_textstring(
+    writer,
+    pool_metadata->url,
+    cardano_safe_strlen(pool_metadata->url, 128));
+
+  if (write_string_result != CARDANO_SUCCESS)
+  {
+    return write_string_result;
+  }
+
+  return cardano_blake2b_hash_to_cbor(pool_metadata->hash, writer);
+}
+
+cardano_error_t
+cardano_pool_metadata_to_cip116_json(
+  const cardano_pool_metadata_t* metadata,
+  cardano_json_writer_t*         writer)
+{
+  if ((metadata == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "url", 3);
+  cardano_json_writer_write_string(writer, metadata->url, cardano_safe_strlen(metadata->url, 128));
+
+  cardano_json_writer_write_property_name(writer, "hash", 4);
+  cardano_error_t error = cardano_blake2b_hash_to_cip116_json(metadata->hash, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_pool_metadata_get_url_size(
+  const cardano_pool_metadata_t* pool_metadata)
+{
+  if (pool_metadata == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_safe_strlen(pool_metadata->url, 128);
+}
+
+const char*
+cardano_pool_metadata_get_url(
+  const cardano_pool_metadata_t* pool_metadata)
+{
+  if (pool_metadata == NULL)
+  {
+    return NULL;
+  }
+
+  return pool_metadata->url;
+}
+
+cardano_error_t
+cardano_pool_metadata_set_url(
+  const char*              url,
+  size_t                   url_size,
+  cardano_pool_metadata_t* pool_metadata)
+{
+  if (pool_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (url == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (url_size > 128U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_safe_memcpy(pool_metadata->url, 129, url, url_size);
+
+  pool_metadata->url[url_size] = '\0';
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_metadata_get_hash(
+  cardano_pool_metadata_t* pool_metadata,
+  cardano_blake2b_hash_t** hash)
+{
+  if (pool_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(pool_metadata->hash);
+  *hash = pool_metadata->hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_metadata_set_hash(
+  cardano_pool_metadata_t* pool_metadata,
+  cardano_blake2b_hash_t*  hash)
+{
+  if (pool_metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(hash);
+  cardano_blake2b_hash_unref(&pool_metadata->hash);
+  pool_metadata->hash = hash;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_pool_metadata_unref(cardano_pool_metadata_t** pool_metadata)
+{
+  if ((pool_metadata == NULL) || (*pool_metadata == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*pool_metadata)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *pool_metadata = NULL;
+    return;
+  }
+}
+
+void
+cardano_pool_metadata_ref(cardano_pool_metadata_t* pool_metadata)
+{
+  if (pool_metadata == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&pool_metadata->base);
+}
+
+size_t
+cardano_pool_metadata_refcount(const cardano_pool_metadata_t* pool_metadata)
+{
+  if (pool_metadata == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&pool_metadata->base);
+}
+
+void
+cardano_pool_metadata_set_last_error(cardano_pool_metadata_t* pool_metadata, const char* message)
+{
+  cardano_object_set_last_error(&pool_metadata->base, message);
+}
+
+const char*
+cardano_pool_metadata_get_last_error(const cardano_pool_metadata_t* pool_metadata)
+{
+  return cardano_object_get_last_error(&pool_metadata->base);
+}
+
+cardano_error_t
+cardano_pool_metadata_deep_clone(const cardano_pool_metadata_t* source, cardano_pool_metadata_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_metadata_t* copy = _cardano_malloc(sizeof(cardano_pool_metadata_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  CARDANO_UNUSED(memcpy(copy->url, source->url, sizeof(copy->url)));
+  copy->hash = NULL;
+
+  if (source->hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->hash, &copy->hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/pool_params/pool_owners.c b/vendor/src/pool_params/pool_owners.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/pool_owners.c
@@ -0,0 +1,504 @@
+/**
+ * \file pool_owners.c
+ *
+ * \author angel.castillo
+ * \date   jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/pool_params/pool_owners.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano pool_owners list.
+ */
+typedef struct cardano_pool_owners_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_pool_owners_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a pool_owners list object.
+ *
+ * This function is responsible for properly deallocating a pool_owners list object (`cardano_pool_owners_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the pool_owners object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_pool_owners_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the pool_owners
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_pool_owners_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_pool_owners_t* list = (cardano_pool_owners_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their hash.
+ *
+ * This function casts the cardano_object_t objects to cardano_blake2b_hash_t
+ * and compares their hashes using the cardano_blake2b_hash_compare function.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the hash of lhs is less than the hash of rhs, zero if they are equal,
+ *         and a positive value if the hash of lhs is greater than the hash of rhs.
+ */
+static int32_t
+compare_by_hash(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_blake2b_hash_t* lhs_hash = (const cardano_blake2b_hash_t*)((const void*)lhs);
+  const cardano_blake2b_hash_t* rhs_hash = (const cardano_blake2b_hash_t*)((const void*)rhs);
+
+  return cardano_blake2b_hash_compare(lhs_hash, rhs_hash);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_pool_owners_new(cardano_pool_owners_t** pool_owners)
+{
+  if (pool_owners == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_owners_t* list = _cardano_malloc(sizeof(cardano_pool_owners_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_pool_owners_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *pool_owners = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_owners_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_owners_t** pool_owners)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pool_owners == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_owners_t* list   = NULL;
+  cardano_error_t        result = cardano_pool_owners_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_pool_owners_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("pool_owners", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_pool_owners_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_pool_owners_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_pool_owners_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_blake2b_hash_t* element = NULL;
+
+    result = cardano_blake2b_hash_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_pool_owners_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_blake2b_hash_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_pool_owners_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("pool_owners", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_pool_owners_unref(&list);
+    return result;
+  }
+
+  cardano_array_sort(list->array, compare_by_hash, NULL);
+
+  *pool_owners = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_owners_to_cbor(const cardano_pool_owners_t* pool_owners, cardano_cbor_writer_t* writer)
+{
+  if (pool_owners == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(pool_owners->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  size_t array_size = cardano_array_get_size(pool_owners->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(pool_owners->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(pool_owners->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in pool_owners list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_blake2b_hash_to_cbor((cardano_blake2b_hash_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_pool_owners_to_cip116_json(
+  const cardano_pool_owners_t* owners,
+  cardano_json_writer_t*       writer)
+{
+  if ((owners == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t length = cardano_pool_owners_get_length(owners);
+
+  for (size_t i = 0; i < length; ++i)
+  {
+    cardano_blake2b_hash_t* owner_hash = NULL;
+    cardano_error_t         error      = cardano_pool_owners_get(owners, i, &owner_hash);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_blake2b_hash_to_cip116_json(owner_hash, writer);
+
+    cardano_blake2b_hash_unref(&owner_hash);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_pool_owners_get_length(const cardano_pool_owners_t* pool_owners)
+{
+  if (pool_owners == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(pool_owners->array);
+}
+
+cardano_error_t
+cardano_pool_owners_get(
+  const cardano_pool_owners_t* pool_owners,
+  size_t                       index,
+  cardano_blake2b_hash_t**     element)
+{
+  if (pool_owners == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(pool_owners->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_blake2b_hash_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_owners_add(cardano_pool_owners_t* pool_owners, cardano_blake2b_hash_t* element)
+{
+  if (pool_owners == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(pool_owners->array);
+  const size_t new_size      = cardano_array_push(pool_owners->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(pool_owners->array, compare_by_hash, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_pool_owners_unref(cardano_pool_owners_t** pool_owners)
+{
+  if ((pool_owners == NULL) || (*pool_owners == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*pool_owners)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *pool_owners = NULL;
+    return;
+  }
+}
+
+void
+cardano_pool_owners_ref(cardano_pool_owners_t* pool_owners)
+{
+  if (pool_owners == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&pool_owners->base);
+}
+
+size_t
+cardano_pool_owners_refcount(const cardano_pool_owners_t* pool_owners)
+{
+  if (pool_owners == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&pool_owners->base);
+}
+
+void
+cardano_pool_owners_set_last_error(cardano_pool_owners_t* pool_owners, const char* message)
+{
+  cardano_object_set_last_error(&pool_owners->base, message);
+}
+
+const char*
+cardano_pool_owners_get_last_error(const cardano_pool_owners_t* pool_owners)
+{
+  return cardano_object_get_last_error(&pool_owners->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_blake2b_hash_t* copy   = NULL;
+  const cardano_error_t   result = cardano_blake2b_hash_deep_clone((const cardano_blake2b_hash_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_pool_owners_deep_clone(const cardano_pool_owners_t* source, cardano_pool_owners_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_owners_t* copy = _cardano_malloc(sizeof(cardano_pool_owners_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/pool_params/pool_params.c b/vendor/src/pool_params/pool_params.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/pool_params.c
@@ -0,0 +1,1369 @@
+/**
+ * \file pool_params.c
+ *
+ * \author angel.castillo
+ * \date   jun 26, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license") {}
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/object.h>
+#include <cardano/pool_params/bls_key.h>
+#include <cardano/pool_params/pool_metadata.h>
+#include <cardano/pool_params/pool_owners.h>
+#include <cardano/pool_params/pool_params.h>
+#include <cardano/pool_params/relays.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 9;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an pool params.
+ *
+ * Each instance of `cardano_pool_params_t` holds a pool params object.
+ */
+typedef struct cardano_pool_params_t
+{
+    cardano_object_t          base;
+    cardano_blake2b_hash_t*   operator_hash;
+    cardano_blake2b_hash_t*   vrf_vk_hash;
+    cardano_bls_key_t*        bls_key;
+    uint64_t                  pledge;
+    uint64_t                  cost;
+    cardano_unit_interval_t*  margin;
+    cardano_reward_address_t* reward_account;
+    cardano_pool_owners_t*    owners;
+    cardano_relays_t*         relays;
+    cardano_pool_metadata_t*  metadata;
+} cardano_pool_params_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a pool_params object.
+ *
+ * This function is responsible for properly deallocating a pool_params object (`cardano_pool_params_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the pool_params object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_pool_params_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the pool_params
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_pool_params_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_pool_params_t* pool_params = (cardano_pool_params_t*)object;
+
+  cardano_blake2b_hash_unref(&pool_params->operator_hash);
+  cardano_blake2b_hash_unref(&pool_params->vrf_vk_hash);
+  cardano_bls_key_unref(&pool_params->bls_key);
+  cardano_unit_interval_unref(&pool_params->margin);
+  cardano_reward_address_unref(&pool_params->reward_account);
+  cardano_pool_owners_unref(&pool_params->owners);
+  cardano_relays_unref(&pool_params->relays);
+  cardano_pool_metadata_unref(&pool_params->metadata);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_pool_params_new(
+  cardano_blake2b_hash_t*   operator_key_hash,
+  cardano_blake2b_hash_t*   vrf_vk_hash,
+  uint64_t                  pledge,
+  uint64_t                  cost,
+  cardano_unit_interval_t*  margin,
+  cardano_reward_address_t* reward_account,
+  cardano_pool_owners_t*    owners,
+  cardano_relays_t*         relays,
+  cardano_pool_metadata_t*  metadata,
+  cardano_pool_params_t**   pool_params)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (operator_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vrf_vk_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (margin == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_account == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (owners == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (relays == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *pool_params = _cardano_malloc(sizeof(cardano_pool_params_t));
+
+  if (*pool_params == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*pool_params)->base.deallocator   = cardano_pool_params_deallocate;
+  (*pool_params)->base.ref_count     = 1;
+  (*pool_params)->base.last_error[0] = '\0';
+
+  cardano_blake2b_hash_ref(operator_key_hash);
+  (*pool_params)->operator_hash = operator_key_hash;
+
+  cardano_blake2b_hash_ref(vrf_vk_hash);
+  (*pool_params)->vrf_vk_hash = vrf_vk_hash;
+
+  (*pool_params)->bls_key = NULL;
+  (*pool_params)->pledge  = pledge;
+  (*pool_params)->cost    = cost;
+
+  cardano_unit_interval_ref(margin);
+  (*pool_params)->margin = margin;
+
+  cardano_reward_address_ref(reward_account);
+  (*pool_params)->reward_account = reward_account;
+
+  cardano_pool_owners_ref(owners);
+  (*pool_params)->owners = owners;
+
+  cardano_relays_ref(relays);
+  (*pool_params)->relays = relays;
+
+  cardano_pool_metadata_ref(metadata);
+  (*pool_params)->metadata = metadata;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_params_t** pool_params)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *pool_params = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t*   operator_key_hash = NULL;
+  cardano_blake2b_hash_t*   vrf_vk_hash       = NULL;
+  cardano_bls_key_t*        bls_key           = NULL;
+  uint64_t                  pledge            = 0;
+  uint64_t                  cost              = 0;
+  cardano_unit_interval_t*  margin            = NULL;
+  cardano_reward_address_t* reward_account    = NULL;
+  cardano_pool_owners_t*    owners            = NULL;
+  cardano_relays_t*         relays            = NULL;
+  cardano_pool_metadata_t*  metadata          = NULL;
+
+  const cardano_error_t operator_key_hash_result = cardano_blake2b_hash_from_cbor(reader, &operator_key_hash);
+
+  if (operator_key_hash_result != CARDANO_SUCCESS)
+  {
+    return operator_key_hash_result;
+  }
+
+  const cardano_error_t vrf_vk_hash_result = cardano_blake2b_hash_from_cbor(reader, &vrf_vk_hash);
+
+  if (vrf_vk_hash_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&operator_key_hash);
+    return vrf_vk_hash_result;
+  }
+
+  cardano_cbor_reader_state_t bls_key_state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t bls_key_result = cardano_cbor_reader_peek_state(reader, &bls_key_state);
+
+  if (bls_key_result == CARDANO_SUCCESS)
+  {
+    if (bls_key_state == CARDANO_CBOR_READER_STATE_START_ARRAY)
+    {
+      bls_key_result = cardano_bls_key_from_cbor(reader, &bls_key);
+    }
+    else if (bls_key_state == CARDANO_CBOR_READER_STATE_NULL)
+    {
+      bls_key_result = cardano_cbor_reader_read_null(reader);
+    }
+    else
+    {
+      bls_key = NULL;
+    }
+  }
+
+  if (bls_key_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&operator_key_hash);
+    cardano_blake2b_hash_unref(&vrf_vk_hash);
+    return bls_key_result;
+  }
+
+  cardano_error_t read_uint_result = cardano_cbor_reader_read_uint(reader, &pledge);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&operator_key_hash);
+    cardano_blake2b_hash_unref(&vrf_vk_hash);
+    cardano_bls_key_unref(&bls_key);
+    return read_uint_result;
+  }
+
+  read_uint_result = cardano_cbor_reader_read_uint(reader, &cost);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&operator_key_hash);
+    cardano_blake2b_hash_unref(&vrf_vk_hash);
+    cardano_bls_key_unref(&bls_key);
+    return read_uint_result;
+  }
+
+  const cardano_error_t read_margin_result = cardano_unit_interval_from_cbor(reader, &margin);
+
+  if (read_margin_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&operator_key_hash);
+    cardano_blake2b_hash_unref(&vrf_vk_hash);
+    cardano_bls_key_unref(&bls_key);
+    return read_margin_result;
+  }
+
+  cardano_buffer_t* reward_account_buffer = NULL;
+
+  const cardano_error_t read_reward_account_result = cardano_cbor_reader_read_bytestring(reader, &reward_account_buffer);
+
+  if (read_reward_account_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&operator_key_hash);
+    cardano_blake2b_hash_unref(&vrf_vk_hash);
+    cardano_bls_key_unref(&bls_key);
+    cardano_unit_interval_unref(&margin);
+    return read_reward_account_result;
+  }
+
+  cardano_error_t reward_account_result = cardano_reward_address_from_bytes(cardano_buffer_get_data(reward_account_buffer), cardano_buffer_get_size(reward_account_buffer), &reward_account);
+
+  cardano_buffer_unref(&reward_account_buffer);
+
+  if (reward_account_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&operator_key_hash);
+    cardano_blake2b_hash_unref(&vrf_vk_hash);
+    cardano_bls_key_unref(&bls_key);
+    cardano_unit_interval_unref(&margin);
+    return reward_account_result;
+  }
+
+  const cardano_error_t read_owners_result = cardano_pool_owners_from_cbor(reader, &owners);
+
+  if (read_owners_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&operator_key_hash);
+    cardano_blake2b_hash_unref(&vrf_vk_hash);
+    cardano_bls_key_unref(&bls_key);
+    cardano_unit_interval_unref(&margin);
+    cardano_reward_address_unref(&reward_account);
+
+    return read_owners_result;
+  }
+
+  const cardano_error_t read_relays_result = cardano_relays_from_cbor(reader, &relays);
+
+  if (read_relays_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&operator_key_hash);
+    cardano_blake2b_hash_unref(&vrf_vk_hash);
+    cardano_bls_key_unref(&bls_key);
+    cardano_unit_interval_unref(&margin);
+    cardano_reward_address_unref(&reward_account);
+    cardano_pool_owners_unref(&owners);
+
+    return read_relays_result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  cardano_error_t peek_state_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_state_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&operator_key_hash);
+    cardano_blake2b_hash_unref(&vrf_vk_hash);
+    cardano_bls_key_unref(&bls_key);
+    cardano_unit_interval_unref(&margin);
+    cardano_reward_address_unref(&reward_account);
+    cardano_pool_owners_unref(&owners);
+    cardano_relays_unref(&relays);
+
+    return peek_state_result;
+  }
+
+  if (state != CARDANO_CBOR_READER_STATE_NULL)
+  {
+    const cardano_error_t read_metadata_result = cardano_pool_metadata_from_cbor(reader, &metadata);
+
+    if (read_metadata_result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&operator_key_hash);
+      cardano_blake2b_hash_unref(&vrf_vk_hash);
+      cardano_bls_key_unref(&bls_key);
+      cardano_unit_interval_unref(&margin);
+      cardano_reward_address_unref(&reward_account);
+      cardano_pool_owners_unref(&owners);
+      cardano_relays_unref(&relays);
+
+      return read_metadata_result;
+    }
+  }
+  else
+  {
+    metadata = NULL;
+
+    const cardano_error_t read_null_result = cardano_cbor_reader_read_null(reader);
+
+    if (read_null_result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&operator_key_hash);
+      cardano_blake2b_hash_unref(&vrf_vk_hash);
+      cardano_bls_key_unref(&bls_key);
+      cardano_unit_interval_unref(&margin);
+      cardano_reward_address_unref(&reward_account);
+      cardano_pool_owners_unref(&owners);
+      cardano_relays_unref(&relays);
+
+      return read_null_result;
+    }
+  }
+
+  const cardano_error_t create_instance_result = cardano_pool_params_new(
+    operator_key_hash,
+    vrf_vk_hash,
+    pledge,
+    cost,
+    margin,
+    reward_account,
+    owners,
+    relays,
+    metadata,
+    pool_params);
+
+  if (create_instance_result == CARDANO_SUCCESS)
+  {
+    cardano_bls_key_ref(bls_key);
+    (*pool_params)->bls_key = bls_key;
+  }
+
+  cardano_blake2b_hash_unref(&operator_key_hash);
+  cardano_blake2b_hash_unref(&vrf_vk_hash);
+  cardano_bls_key_unref(&bls_key);
+  cardano_unit_interval_unref(&margin);
+  cardano_reward_address_unref(&reward_account);
+  cardano_pool_owners_unref(&owners);
+  cardano_relays_unref(&relays);
+  cardano_pool_metadata_unref(&metadata);
+
+  return create_instance_result;
+}
+
+cardano_error_t
+cardano_pool_params_to_cbor(const cardano_pool_params_t* pool_params, cardano_cbor_writer_t* writer)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_operator_key_hash_result = cardano_blake2b_hash_to_cbor(pool_params->operator_hash, writer);
+
+  if (write_operator_key_hash_result != CARDANO_SUCCESS)
+  {
+    return write_operator_key_hash_result;
+  }
+
+  cardano_error_t write_vrf_vk_hash_result = cardano_blake2b_hash_to_cbor(pool_params->vrf_vk_hash, writer);
+
+  if (write_vrf_vk_hash_result != CARDANO_SUCCESS)
+  {
+    return write_vrf_vk_hash_result;
+  }
+
+  if (pool_params->bls_key != NULL)
+  {
+    cardano_error_t write_bls_key_result = cardano_bls_key_to_cbor(pool_params->bls_key, writer);
+
+    if (write_bls_key_result != CARDANO_SUCCESS)
+    {
+      return write_bls_key_result;
+    }
+  }
+
+  cardano_error_t write_pledge_result = cardano_cbor_writer_write_uint(writer, pool_params->pledge);
+
+  if (write_pledge_result != CARDANO_SUCCESS)
+  {
+    return write_pledge_result;
+  }
+
+  cardano_error_t write_cost_result = cardano_cbor_writer_write_uint(writer, pool_params->cost);
+
+  if (write_cost_result != CARDANO_SUCCESS)
+  {
+    return write_cost_result;
+  }
+
+  cardano_error_t write_margin_result = cardano_unit_interval_to_cbor(pool_params->margin, writer);
+
+  if (write_margin_result != CARDANO_SUCCESS)
+  {
+    return write_margin_result;
+  }
+
+  cardano_error_t write_reward_account_result = cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_reward_address_get_bytes(pool_params->reward_account),
+    cardano_reward_address_get_bytes_size(pool_params->reward_account));
+
+  if (write_reward_account_result != CARDANO_SUCCESS)
+  {
+    return write_reward_account_result;
+  }
+
+  cardano_error_t write_owners_result = cardano_pool_owners_to_cbor(pool_params->owners, writer);
+
+  if (write_owners_result != CARDANO_SUCCESS)
+  {
+    return write_owners_result;
+  }
+
+  cardano_error_t write_relays_result = cardano_relays_to_cbor(pool_params->relays, writer);
+
+  if (write_relays_result != CARDANO_SUCCESS)
+  {
+    return write_relays_result;
+  }
+
+  if (pool_params->metadata != NULL)
+  {
+    return cardano_pool_metadata_to_cbor(pool_params->metadata, writer);
+  }
+
+  return cardano_cbor_writer_write_null(writer);
+}
+
+cardano_error_t
+cardano_pool_params_to_cip116_json(
+  const cardano_pool_params_t* params,
+  cardano_json_writer_t*       writer)
+{
+  if ((params == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "operator", 8);
+
+  assert((params->operator_hash != NULL));
+
+  cardano_json_writer_write_bytes_as_bech32(
+    writer,
+    "pool",
+    4,
+    cardano_blake2b_hash_get_data(params->operator_hash),
+    cardano_blake2b_hash_get_bytes_size(params->operator_hash));
+
+  cardano_json_writer_write_property_name(writer, "vrf_keyhash", 11);
+
+  assert((params->vrf_vk_hash != NULL));
+
+  cardano_json_writer_write_bytes_as_bech32(
+    writer,
+    "vrf_vkh",
+    7,
+    cardano_blake2b_hash_get_data(params->vrf_vk_hash),
+    cardano_blake2b_hash_get_bytes_size(params->vrf_vk_hash));
+
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  if (params->bls_key != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "bls_key", 7);
+    error = cardano_bls_key_to_cip116_json(params->bls_key, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_property_name(writer, "pledge", 6);
+  cardano_json_writer_write_uint_as_string(writer, params->pledge);
+
+  cardano_json_writer_write_property_name(writer, "cost", 4);
+  cardano_json_writer_write_uint_as_string(writer, params->cost);
+
+  cardano_json_writer_write_property_name(writer, "margin", 6);
+  error = cardano_unit_interval_to_cip116_json(params->margin, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  assert((params->reward_account != NULL));
+
+  cardano_json_writer_write_property_name(writer, "reward_account", 14);
+  cardano_json_writer_write_string(writer, cardano_reward_address_get_string(params->reward_account), cardano_reward_address_get_bech32_size(params->reward_account) - 1U);
+
+  assert((params->owners != NULL));
+
+  cardano_json_writer_write_property_name(writer, "pool_owners", 11);
+  error = cardano_pool_owners_to_cip116_json(params->owners, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  assert((params->relays != NULL));
+
+  cardano_json_writer_write_property_name(writer, "relays", 6);
+  error = cardano_relays_to_cip116_json(params->relays, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (params->metadata != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "pool_metadata", 13);
+    error = cardano_pool_metadata_to_cip116_json(params->metadata, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_get_operator_key_hash(
+  cardano_pool_params_t*   pool_params,
+  cardano_blake2b_hash_t** operator_key_hash)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (operator_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(pool_params->operator_hash);
+  *operator_key_hash = pool_params->operator_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_set_operator_key_hash(
+  cardano_pool_params_t*  pool_params,
+  cardano_blake2b_hash_t* operator_key_hash)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (operator_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(operator_key_hash);
+  cardano_blake2b_hash_unref(&pool_params->operator_hash);
+  pool_params->operator_hash = operator_key_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_get_vrf_vk_hash(
+  cardano_pool_params_t*   pool_params,
+  cardano_blake2b_hash_t** vrf_vk_hash)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vrf_vk_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(pool_params->vrf_vk_hash);
+  *vrf_vk_hash = pool_params->vrf_vk_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_set_vrf_vk_hash(
+  cardano_pool_params_t*  pool_params,
+  cardano_blake2b_hash_t* vrf_vk_hash)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vrf_vk_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(vrf_vk_hash);
+  cardano_blake2b_hash_unref(&pool_params->vrf_vk_hash);
+  pool_params->vrf_vk_hash = vrf_vk_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_pool_params_has_bls_key(const cardano_pool_params_t* pool_params)
+{
+  if (pool_params == NULL)
+  {
+    return false;
+  }
+
+  return pool_params->bls_key != NULL;
+}
+
+cardano_error_t
+cardano_pool_params_get_bls_key(
+  cardano_pool_params_t* pool_params,
+  cardano_bls_key_t**    bls_key)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bls_key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bls_key_ref(pool_params->bls_key);
+  *bls_key = pool_params->bls_key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_set_bls_key(
+  cardano_pool_params_t* pool_params,
+  cardano_bls_key_t*     bls_key)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bls_key == NULL)
+  {
+    cardano_bls_key_unref(&pool_params->bls_key);
+    pool_params->bls_key = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_bls_key_ref(bls_key);
+  cardano_bls_key_unref(&pool_params->bls_key);
+  pool_params->bls_key = bls_key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_get_pledge(
+  cardano_pool_params_t* pool_params,
+  uint64_t*              pledge)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pledge == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *pledge = pool_params->pledge;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_set_pledge(
+  cardano_pool_params_t* pool_params,
+  uint64_t               pledge)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  pool_params->pledge = pledge;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_get_cost(
+  cardano_pool_params_t* pool_params,
+  uint64_t*              cost)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cost == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *cost = pool_params->cost;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_set_cost(
+  cardano_pool_params_t* pool_params,
+  uint64_t               cost)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  pool_params->cost = cost;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_get_margin(
+  cardano_pool_params_t*    pool_params,
+  cardano_unit_interval_t** margin)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (margin == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(pool_params->margin);
+  *margin = pool_params->margin;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_set_margin(
+  cardano_pool_params_t*   pool_params,
+  cardano_unit_interval_t* margin)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (margin == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(margin);
+  cardano_unit_interval_unref(&pool_params->margin);
+  pool_params->margin = margin;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_get_reward_account(
+  cardano_pool_params_t*     pool_params,
+  cardano_reward_address_t** reward_account)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_account == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_ref(pool_params->reward_account);
+  *reward_account = pool_params->reward_account;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_set_reward_account(
+  cardano_pool_params_t*    pool_params,
+  cardano_reward_address_t* reward_account)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_account == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_ref(reward_account);
+  cardano_reward_address_unref(&pool_params->reward_account);
+  pool_params->reward_account = reward_account;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_get_owners(
+  cardano_pool_params_t*  pool_params,
+  cardano_pool_owners_t** owners)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (owners == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_owners_ref(pool_params->owners);
+  *owners = pool_params->owners;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_set_owners(
+  cardano_pool_params_t* pool_params,
+  cardano_pool_owners_t* owners)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (owners == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_owners_ref(owners);
+  cardano_pool_owners_unref(&pool_params->owners);
+  pool_params->owners = owners;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_get_relays(
+  cardano_pool_params_t* pool_params,
+  cardano_relays_t**     relays)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (relays == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_relays_ref(pool_params->relays);
+  *relays = pool_params->relays;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_set_relays(
+  cardano_pool_params_t* pool_params,
+  cardano_relays_t*      relays)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (relays == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_relays_ref(relays);
+  cardano_relays_unref(&pool_params->relays);
+  pool_params->relays = relays;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_get_metadata(
+  cardano_pool_params_t*    pool_params,
+  cardano_pool_metadata_t** metadata)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadata == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_metadata_ref(pool_params->metadata);
+  *metadata = pool_params->metadata;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_set_metadata(
+  cardano_pool_params_t*   pool_params,
+  cardano_pool_metadata_t* metadata)
+{
+  if (pool_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (metadata == NULL)
+  {
+    cardano_pool_metadata_unref(&pool_params->metadata);
+    pool_params->metadata = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_pool_metadata_ref(metadata);
+  cardano_pool_metadata_unref(&pool_params->metadata);
+  pool_params->metadata = metadata;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_pool_params_unref(cardano_pool_params_t** pool_params)
+{
+  if ((pool_params == NULL) || (*pool_params == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*pool_params)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *pool_params = NULL;
+    return;
+  }
+}
+
+void
+cardano_pool_params_ref(cardano_pool_params_t* pool_params)
+{
+  if (pool_params == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&pool_params->base);
+}
+
+size_t
+cardano_pool_params_refcount(const cardano_pool_params_t* pool_params)
+{
+  if (pool_params == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&pool_params->base);
+}
+
+void
+cardano_pool_params_set_last_error(cardano_pool_params_t* pool_params, const char* message)
+{
+  cardano_object_set_last_error(&pool_params->base, message);
+}
+
+const char*
+cardano_pool_params_get_last_error(const cardano_pool_params_t* pool_params)
+{
+  return cardano_object_get_last_error(&pool_params->base);
+}
+
+cardano_error_t
+cardano_pool_params_deep_clone(const cardano_pool_params_t* source, cardano_pool_params_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_params_t* copy = _cardano_malloc(sizeof(cardano_pool_params_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->operator_hash      = NULL;
+  copy->vrf_vk_hash        = NULL;
+  copy->bls_key            = NULL;
+  copy->pledge             = source->pledge;
+  copy->cost               = source->cost;
+  copy->margin             = NULL;
+  copy->reward_account     = NULL;
+  copy->owners             = NULL;
+  copy->relays             = NULL;
+  copy->metadata           = NULL;
+
+  if (source->operator_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->operator_hash, &copy->operator_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->vrf_vk_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->vrf_vk_hash, &copy->vrf_vk_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->bls_key != NULL)
+  {
+    const cardano_error_t result = cardano_bls_key_deep_clone(source->bls_key, &copy->bls_key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->margin != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->margin, &copy->margin);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->reward_account != NULL)
+  {
+    const cardano_error_t result = cardano_reward_address_deep_clone(source->reward_account, &copy->reward_account);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->owners != NULL)
+  {
+    const cardano_error_t result = cardano_pool_owners_deep_clone(source->owners, &copy->owners);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->relays != NULL)
+  {
+    const cardano_error_t result = cardano_relays_deep_clone(source->relays, &copy->relays);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->metadata != NULL)
+  {
+    const cardano_error_t result = cardano_pool_metadata_deep_clone(source->metadata, &copy->metadata);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Computes the greatest common divisor for normalized margin comparison.
+ * \param[in] a First integer.
+ * \param[in] b Second integer.
+ * \return Their greatest common divisor.
+ */
+static uint64_t
+margin_gcd(const uint64_t a, const uint64_t b)
+{
+  uint64_t x = a;
+  uint64_t y = b;
+  while (y != 0U)
+  {
+    const uint64_t remainder = x % y;
+    x                        = y;
+    y                        = remainder;
+  }
+  return x;
+}
+
+/**
+ * \brief Tests owner set inclusion, ignoring insertion order and duplicates.
+ * \param[in] a The first owner set.
+ * \param[in] b The second owner set.
+ * \param[out] included Whether every owner in a belongs to b.
+ * \return Success or a collection access error.
+ */
+static cardano_error_t
+owners_included(const cardano_pool_owners_t* a, const cardano_pool_owners_t* b, bool* included)
+{
+  *included = true;
+  for (size_t i = 0U; i < cardano_pool_owners_get_length(a); ++i)
+  {
+    cardano_blake2b_hash_t* owner  = NULL;
+    cardano_error_t         result = cardano_pool_owners_get(a, i, &owner);
+    bool                    found  = false;
+    for (size_t j = 0U; (result == CARDANO_SUCCESS) && !found && (j < cardano_pool_owners_get_length(b)); ++j)
+    {
+      cardano_blake2b_hash_t* other = NULL;
+      result                        = cardano_pool_owners_get(b, j, &other);
+      found                         = cardano_blake2b_hash_equals(owner, other);
+      cardano_blake2b_hash_unref(&other);
+    }
+    cardano_blake2b_hash_unref(&owner);
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+    if (!found)
+    {
+      *included = false;
+      break;
+    }
+  }
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_params_requires_owner_witnesses(
+  const cardano_pool_params_t* proposed,
+  const cardano_pool_params_t* latest,
+  bool*                        required)
+{
+  if ((proposed == NULL) || (required == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  *required = true;
+  if (latest == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  const uint64_t an = cardano_unit_interval_get_numerator(proposed->margin);
+  const uint64_t ad = cardano_unit_interval_get_denominator(proposed->margin);
+  const uint64_t bn = cardano_unit_interval_get_numerator(latest->margin);
+  const uint64_t bd = cardano_unit_interval_get_denominator(latest->margin);
+  const uint64_t ag = margin_gcd(an, ad);
+  const uint64_t bg = margin_gcd(bn, bd);
+  if ((ad == 0U) || (bd == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+  if (((an / ag) != (bn / bg)) || ((ad / ag) != (bd / bg)))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  bool            included = false;
+  cardano_error_t result   = owners_included(proposed->owners, latest->owners, &included);
+  if ((result != CARDANO_SUCCESS) || !included)
+  {
+    return result;
+  }
+  result = owners_included(latest->owners, proposed->owners, &included);
+  if ((result != CARDANO_SUCCESS) || !included)
+  {
+    return result;
+  }
+
+  /* Pool parameters and their children encode from their fields, without a CBOR cache.
+   * Normalize the two semantic sets/rationals already compared, and omit both BLS keys.
+   * The borrowed copies are never mutated or released as reference-counted objects. */
+  cardano_pool_params_t a   = *proposed;
+  cardano_pool_params_t b   = *latest;
+  a.bls_key                 = NULL;
+  b.bls_key                 = NULL;
+  a.owners                  = b.owners;
+  a.margin                  = b.margin;
+  cardano_cbor_writer_t* aw = cardano_cbor_writer_new();
+  cardano_cbor_writer_t* bw = cardano_cbor_writer_new();
+  cardano_buffer_t*      ab = NULL;
+  cardano_buffer_t*      bb = NULL;
+  if ((aw == NULL) || (bw == NULL))
+  {
+    result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_pool_params_to_cbor(&a, aw);
+  }
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_pool_params_to_cbor(&b, bw);
+  }
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_writer_encode_in_buffer(aw, &ab);
+  }
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_writer_encode_in_buffer(bw, &bb);
+  }
+  if (result == CARDANO_SUCCESS)
+  {
+    *required = !cardano_buffer_equals(ab, bb);
+  }
+  cardano_buffer_unref(&ab);
+  cardano_buffer_unref(&bb);
+  cardano_cbor_writer_unref(&aw);
+  cardano_cbor_writer_unref(&bw);
+  return result;
+}
diff --git a/vendor/src/pool_params/relay.c b/vendor/src/pool_params/relay.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/relay.c
@@ -0,0 +1,612 @@
+/**
+ * \file relay.c
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/pool_params/multi_host_name_relay.h>
+#include <cardano/pool_params/relay.h>
+#include <cardano/pool_params/relay_type.h>
+#include <cardano/pool_params/single_host_addr_relay.h>
+#include <cardano/pool_params/single_host_name_relay.h>
+
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief A relay is a type of node that acts as intermediaries between core nodes
+ * (which produce blocks) and the wider internet. They help in passing along
+ * transactions and blocks, ensuring that data is propagated throughout the
+ * network.
+ */
+typedef struct cardano_relay_t
+{
+    cardano_object_t                  base;
+    cardano_relay_type_t              type;
+    cardano_multi_host_name_relay_t*  multi_host_name_relay;
+    cardano_single_host_addr_relay_t* single_host_addr_relay;
+    cardano_single_host_name_relay_t* single_host_name_relay;
+} cardano_relay_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a relay object.
+ *
+ * This function is responsible for properly deallocating a relay object (`cardano_relay_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the relay object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_relay_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the relay
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_relay_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_relay_t* data = (cardano_relay_t*)object;
+
+  cardano_multi_host_name_relay_unref(&data->multi_host_name_relay);
+  cardano_single_host_addr_relay_unref(&data->single_host_addr_relay);
+  cardano_single_host_name_relay_unref(&data->single_host_name_relay);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new relay object.
+ *
+ * \return A pointer to the newly created relay object, or `NULL` if the operation failed.
+ */
+static cardano_relay_t*
+cardano_relay_new(void)
+{
+  cardano_relay_t* data = _cardano_malloc(sizeof(cardano_relay_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_relay_deallocate;
+
+  data->type                   = CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS;
+  data->multi_host_name_relay  = NULL;
+  data->single_host_addr_relay = NULL;
+  data->single_host_name_relay = NULL;
+
+  return data;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_relay_new_single_host_addr(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  cardano_relay_t**                 relay)
+{
+  if (single_host_addr_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_relay_t* data = cardano_relay_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->type                   = CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS;
+  data->single_host_addr_relay = single_host_addr_relay;
+
+  cardano_single_host_addr_relay_ref(single_host_addr_relay);
+
+  *relay = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_relay_new_single_host_name(
+  cardano_single_host_name_relay_t* single_host_name,
+  cardano_relay_t**                 relay)
+{
+  if (single_host_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_relay_t* data = cardano_relay_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->type                   = CARDANO_RELAY_TYPE_SINGLE_HOST_NAME;
+  data->single_host_name_relay = single_host_name;
+
+  cardano_single_host_name_relay_ref(single_host_name);
+
+  *relay = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_relay_new_multi_host_name(
+  cardano_multi_host_name_relay_t* multi_host_name_relay,
+  cardano_relay_t**                relay)
+{
+  if (multi_host_name_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_relay_t* data = cardano_relay_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->type                  = CARDANO_RELAY_TYPE_MULTI_HOST_NAME;
+  data->multi_host_name_relay = multi_host_name_relay;
+
+  cardano_multi_host_name_relay_ref(multi_host_name_relay);
+
+  *relay = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_relay_from_cbor(cardano_cbor_reader_t* reader, cardano_relay_t** relay)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_reader_t* reader_clone = NULL;
+
+  cardano_error_t result = cardano_cbor_reader_clone(reader, &reader_clone);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  static const char* validator_name = "relay";
+
+  int64_t array_size = 0;
+  result             = cardano_cbor_reader_read_start_array(reader_clone, &array_size);
+
+  CARDANO_UNUSED(array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_clone);
+    return result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "type",
+    reader_clone,
+    &type,
+    CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS,
+    CARDANO_RELAY_TYPE_MULTI_HOST_NAME);
+
+  cardano_cbor_reader_unref(&reader_clone);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  switch (type)
+  {
+    case CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS:
+    {
+      cardano_single_host_addr_relay_t* single_host_addr_relay = NULL;
+      result                                                   = cardano_single_host_addr_relay_from_cbor(reader, &single_host_addr_relay);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_relay_new_single_host_addr(single_host_addr_relay, relay);
+      cardano_single_host_addr_relay_unref(&single_host_addr_relay);
+
+      break;
+    }
+    case CARDANO_RELAY_TYPE_SINGLE_HOST_NAME:
+    {
+      cardano_single_host_name_relay_t* single_host_name_relay = NULL;
+      result                                                   = cardano_single_host_name_relay_from_cbor(reader, &single_host_name_relay);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_relay_new_single_host_name(single_host_name_relay, relay);
+      cardano_single_host_name_relay_unref(&single_host_name_relay);
+
+      break;
+    }
+    case CARDANO_RELAY_TYPE_MULTI_HOST_NAME:
+    {
+      cardano_multi_host_name_relay_t* multi_host_name_relay = NULL;
+      result                                                 = cardano_multi_host_name_relay_from_cbor(reader, &multi_host_name_relay);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_relay_new_multi_host_name(multi_host_name_relay, relay);
+      cardano_multi_host_name_relay_unref(&multi_host_name_relay);
+
+      break;
+    }
+
+    default:
+      result = CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+      break;
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_relay_to_cbor(
+  const cardano_relay_t* relay,
+  cardano_cbor_writer_t* writer)
+{
+  if (relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (relay->type)
+  {
+    case CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS:
+    {
+      result = cardano_single_host_addr_relay_to_cbor(relay->single_host_addr_relay, writer);
+      break;
+    }
+    case CARDANO_RELAY_TYPE_SINGLE_HOST_NAME:
+    {
+      result = cardano_single_host_name_relay_to_cbor(relay->single_host_name_relay, writer);
+      break;
+    }
+    case CARDANO_RELAY_TYPE_MULTI_HOST_NAME:
+    {
+      result = cardano_multi_host_name_relay_to_cbor(relay->multi_host_name_relay, writer);
+      break;
+    }
+
+    default:
+      result = CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+      break;
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_relay_to_cip116_json(
+  const cardano_relay_t* relay,
+  cardano_json_writer_t* writer)
+{
+  if ((relay == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  switch (relay->type)
+  {
+    case CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS:
+    {
+      return cardano_single_host_addr_relay_to_cip116_json(relay->single_host_addr_relay, writer);
+    }
+    case CARDANO_RELAY_TYPE_SINGLE_HOST_NAME:
+    {
+      return cardano_single_host_name_relay_to_cip116_json(relay->single_host_name_relay, writer);
+    }
+    case CARDANO_RELAY_TYPE_MULTI_HOST_NAME:
+    {
+      return cardano_multi_host_name_relay_to_cip116_json(relay->multi_host_name_relay, writer);
+    }
+    default:
+    {
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_relay_get_type(
+  const cardano_relay_t* relay,
+  cardano_relay_type_t*  type)
+{
+  if (relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = relay->type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_relay_to_single_host_addr(
+  cardano_relay_t*                   relay,
+  cardano_single_host_addr_relay_t** single_host_addr)
+{
+  if (relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (single_host_addr == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (relay->type != CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_single_host_addr_relay_ref(relay->single_host_addr_relay);
+
+  *single_host_addr = relay->single_host_addr_relay;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_relay_to_single_host_name(
+  cardano_relay_t*                   relay,
+  cardano_single_host_name_relay_t** single_host_name)
+{
+  if (relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (single_host_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (relay->type != CARDANO_RELAY_TYPE_SINGLE_HOST_NAME)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_single_host_name_relay_ref(relay->single_host_name_relay);
+
+  *single_host_name = relay->single_host_name_relay;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_relay_to_multi_host_name(
+  cardano_relay_t*                  relay,
+  cardano_multi_host_name_relay_t** multi_host_name)
+{
+  if (relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (multi_host_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (relay->type != CARDANO_RELAY_TYPE_MULTI_HOST_NAME)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_multi_host_name_relay_ref(relay->multi_host_name_relay);
+
+  *multi_host_name = relay->multi_host_name_relay;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_relay_unref(cardano_relay_t** relay)
+{
+  if ((relay == NULL) || (*relay == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*relay)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *relay = NULL;
+    return;
+  }
+}
+
+void
+cardano_relay_ref(cardano_relay_t* relay)
+{
+  if (relay == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&relay->base);
+}
+
+size_t
+cardano_relay_refcount(const cardano_relay_t* relay)
+{
+  if (relay == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&relay->base);
+}
+
+void
+cardano_relay_set_last_error(cardano_relay_t* relay, const char* message)
+{
+  cardano_object_set_last_error(&relay->base, message);
+}
+
+const char*
+cardano_relay_get_last_error(const cardano_relay_t* relay)
+{
+  return cardano_object_get_last_error(&relay->base);
+}
+
+cardano_error_t
+cardano_relay_deep_clone(const cardano_relay_t* source, cardano_relay_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_relay_t* copy = _cardano_malloc(sizeof(cardano_relay_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count         = 1U;
+  copy->base.deallocator       = source->base.deallocator;
+  copy->base.last_error[0]     = '\0';
+  copy->type                   = source->type;
+  copy->multi_host_name_relay  = NULL;
+  copy->single_host_addr_relay = NULL;
+  copy->single_host_name_relay = NULL;
+
+  if (source->multi_host_name_relay != NULL)
+  {
+    const cardano_error_t result = cardano_multi_host_name_relay_deep_clone(source->multi_host_name_relay, &copy->multi_host_name_relay);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->single_host_addr_relay != NULL)
+  {
+    const cardano_error_t result = cardano_single_host_addr_relay_deep_clone(source->single_host_addr_relay, &copy->single_host_addr_relay);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->single_host_name_relay != NULL)
+  {
+    const cardano_error_t result = cardano_single_host_name_relay_deep_clone(source->single_host_name_relay, &copy->single_host_name_relay);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/pool_params/relay_type.c b/vendor/src/pool_params/relay_type.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/relay_type.c
@@ -0,0 +1,50 @@
+/**
+ * \file relay_type.c
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/pool_params/relay_type.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_relay_type_to_string(const cardano_relay_type_t relay_type)
+{
+  const char* message;
+
+  switch (relay_type)
+  {
+    case CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS:
+      message = "Relay Type: Single Host Address";
+      break;
+    case CARDANO_RELAY_TYPE_SINGLE_HOST_NAME:
+      message = "Relay Type: Single Host Name";
+      break;
+    case CARDANO_RELAY_TYPE_MULTI_HOST_NAME:
+      message = "Relay Type: Multi Host Name";
+      break;
+    default:
+      message = "Relay Type: Unknown";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/pool_params/relays.c b/vendor/src/pool_params/relays.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/relays.c
@@ -0,0 +1,448 @@
+/**
+ * \file relays.c
+ *
+ * \author angel.castillo
+ * \date   jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/pool_params/relay.h>
+#include <cardano/pool_params/relays.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano relays list.
+ */
+typedef struct cardano_relays_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_relays_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a relays list object.
+ *
+ * This function is responsible for properly deallocating a relays list object (`cardano_relays_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the relays object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_relays_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the relays
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_relays_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_relays_t* list = (cardano_relays_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_relays_new(cardano_relays_t** relays)
+{
+  if (relays == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_relays_t* list = _cardano_malloc(sizeof(cardano_relays_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_relays_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *relays = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_relays_from_cbor(cardano_cbor_reader_t* reader, cardano_relays_t** relays)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (relays == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_relays_t* list   = NULL;
+  cardano_error_t   result = cardano_relays_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_relays_unref(&list);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_relays_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_relay_t* element = NULL;
+
+    result = cardano_relay_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_relays_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_relay_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_relays_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("relays", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_relays_unref(&list);
+    return result;
+  }
+
+  *relays = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_relays_to_cbor(const cardano_relays_t* relays, cardano_cbor_writer_t* writer)
+{
+  if (relays == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(relays->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t array_size = cardano_array_get_size(relays->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(relays->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(relays->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in relays list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_relay_to_cbor((cardano_relay_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_relays_to_cip116_json(
+  const cardano_relays_t* relays,
+  cardano_json_writer_t*  writer)
+{
+  if ((relays == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t length = cardano_relays_get_length(relays);
+
+  for (size_t i = 0; i < length; ++i)
+  {
+    cardano_relay_t* relay = NULL;
+    cardano_error_t  error = cardano_relays_get(relays, i, &relay);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_relay_to_cip116_json(relay, writer);
+    cardano_relay_unref(&relay);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_relays_get_length(const cardano_relays_t* relays)
+{
+  if (relays == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(relays->array);
+}
+
+cardano_error_t
+cardano_relays_get(
+  const cardano_relays_t* relays,
+  size_t                  index,
+  cardano_relay_t**       element)
+{
+  if (relays == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(relays->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_relay_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_relays_add(cardano_relays_t* relays, cardano_relay_t* element)
+{
+  if (relays == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(relays->array);
+  const size_t new_size      = cardano_array_push(relays->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_relays_unref(cardano_relays_t** relays)
+{
+  if ((relays == NULL) || (*relays == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*relays)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *relays = NULL;
+    return;
+  }
+}
+
+void
+cardano_relays_ref(cardano_relays_t* relays)
+{
+  if (relays == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&relays->base);
+}
+
+size_t
+cardano_relays_refcount(const cardano_relays_t* relays)
+{
+  if (relays == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&relays->base);
+}
+
+void
+cardano_relays_set_last_error(cardano_relays_t* relays, const char* message)
+{
+  cardano_object_set_last_error(&relays->base, message);
+}
+
+const char*
+cardano_relays_get_last_error(const cardano_relays_t* relays)
+{
+  return cardano_object_get_last_error(&relays->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_relay_t*      copy   = NULL;
+  const cardano_error_t result = cardano_relay_deep_clone((const cardano_relay_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_relays_deep_clone(const cardano_relays_t* source, cardano_relays_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_relays_t* copy = _cardano_malloc(sizeof(cardano_relays_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/pool_params/single_host_addr_relay.c b/vendor/src/pool_params/single_host_addr_relay.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/single_host_addr_relay.c
@@ -0,0 +1,701 @@
+/**
+ * \file single_host_addr_relay.c
+ *
+ * \author angel.castillo
+ * \date   jun 26, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license") {}
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/pool_params/ipv4.h>
+#include <cardano/pool_params/ipv6.h>
+#include <cardano/pool_params/relay.h>
+#include <cardano/pool_params/single_host_addr_relay.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 4;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an single host addr relay.
+ *
+ * Each instance of `cardano_single_host_addr_relay_t` holds a single host addr relay.
+ */
+typedef struct cardano_single_host_addr_relay_t
+{
+    cardano_object_t base;
+    uint16_t*        port;
+    cardano_ipv4_t*  ipv4;
+    cardano_ipv6_t*  ipv6;
+} cardano_single_host_addr_relay_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a single_host_addr_relay object.
+ *
+ * This function is responsible for properly deallocating a single_host_addr_relay object (`cardano_single_host_addr_relay_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the single_host_addr_relay object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_single_host_addr_relay_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the single_host_addr_relay
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_single_host_addr_relay_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_single_host_addr_relay_t* single_host_addr_relay = (cardano_single_host_addr_relay_t*)object;
+
+  _cardano_free(single_host_addr_relay->port);
+  cardano_ipv4_unref(&single_host_addr_relay->ipv4);
+  cardano_ipv6_unref(&single_host_addr_relay->ipv6);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_single_host_addr_relay_new(
+  const uint16_t*                    port,
+  cardano_ipv4_t*                    ipv4,
+  cardano_ipv6_t*                    ipv6,
+  cardano_single_host_addr_relay_t** single_host_addr_relay)
+{
+  if (single_host_addr_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *single_host_addr_relay = _cardano_malloc(sizeof(cardano_single_host_addr_relay_t));
+
+  if (*single_host_addr_relay == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*single_host_addr_relay)->base.deallocator   = cardano_single_host_addr_relay_deallocate;
+  (*single_host_addr_relay)->base.ref_count     = 1;
+  (*single_host_addr_relay)->base.last_error[0] = '\0';
+  (*single_host_addr_relay)->port               = NULL;
+  (*single_host_addr_relay)->ipv4               = NULL;
+  (*single_host_addr_relay)->ipv6               = NULL;
+
+  if (port != NULL)
+  {
+    (*single_host_addr_relay)->port = _cardano_malloc(sizeof(uint16_t));
+
+    if ((*single_host_addr_relay)->port == NULL)
+    {
+      cardano_single_host_addr_relay_unref(single_host_addr_relay);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    *(*single_host_addr_relay)->port = *port;
+  }
+
+  if (ipv4 != NULL)
+  {
+    cardano_ipv4_ref(ipv4);
+    (*single_host_addr_relay)->ipv4 = ipv4;
+  }
+
+  if (ipv6 != NULL)
+  {
+    cardano_ipv6_ref(ipv6);
+    (*single_host_addr_relay)->ipv6 = ipv6;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_single_host_addr_relay_from_cbor(cardano_cbor_reader_t* reader, cardano_single_host_addr_relay_t** single_host_addr_relay)
+{
+  if (single_host_addr_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *single_host_addr_relay = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "single_host_addr_relay";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *single_host_addr_relay = NULL;
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS,
+    (enum_to_string_callback_t)((void*)&cardano_relay_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  bool            has_port = false;
+  uint64_t        port64   = 0U;
+  uint16_t        port     = 0U;
+  cardano_ipv4_t* ipv4     = NULL;
+  cardano_ipv6_t* ipv6     = NULL;
+
+  cardano_cbor_reader_state_t state;
+  cardano_error_t             peek_state = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_state != CARDANO_SUCCESS)
+  {
+    return peek_state;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    const cardano_error_t read_null_result = cardano_cbor_reader_read_null(reader);
+
+    if (read_null_result != CARDANO_SUCCESS)
+    {
+      return read_null_result;
+    }
+  }
+  else
+  {
+    const cardano_error_t read_port_result = cardano_cbor_reader_read_uint(reader, &port64);
+
+    if (read_port_result != CARDANO_SUCCESS)
+    {
+      return read_port_result;
+    }
+
+    if (port64 > UINT16_MAX)
+    {
+      cardano_cbor_reader_set_last_error(reader, "Relay port exceeds the unsigned 16-bit range.");
+      return CARDANO_ERROR_DECODING;
+    }
+
+    port     = (uint16_t)port64;
+    has_port = true;
+  }
+
+  peek_state = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_state != CARDANO_SUCCESS)
+  {
+    return peek_state;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    const cardano_error_t read_null_result = cardano_cbor_reader_read_null(reader);
+
+    if (read_null_result != CARDANO_SUCCESS)
+    {
+      return read_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t read_ipv4_result = cardano_ipv4_from_cbor(reader, &ipv4);
+
+    if (read_ipv4_result != CARDANO_SUCCESS)
+    {
+      return read_ipv4_result;
+    }
+  }
+
+  peek_state = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_state != CARDANO_SUCCESS)
+  {
+    cardano_ipv4_unref(&ipv4);
+    return peek_state;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    const cardano_error_t read_null_result = cardano_cbor_reader_read_null(reader);
+
+    if (read_null_result != CARDANO_SUCCESS)
+    {
+      cardano_ipv4_unref(&ipv4);
+      return read_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t read_ipv6_result = cardano_ipv6_from_cbor(reader, &ipv6);
+
+    if (read_ipv6_result != CARDANO_SUCCESS)
+    {
+      cardano_ipv4_unref(&ipv4);
+      return read_ipv6_result;
+    }
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    *single_host_addr_relay = NULL;
+
+    cardano_ipv4_unref(&ipv4);
+    cardano_ipv6_unref(&ipv6);
+
+    return expect_end_array_result;
+  }
+
+  cardano_error_t new_result = cardano_single_host_addr_relay_new(
+    has_port ? &port : NULL,
+    ipv4,
+    ipv6,
+    single_host_addr_relay);
+
+  cardano_ipv4_unref(&ipv4);
+  cardano_ipv6_unref(&ipv6);
+
+  return new_result;
+}
+
+cardano_error_t
+cardano_single_host_addr_relay_to_cbor(const cardano_single_host_addr_relay_t* single_host_addr_relay, cardano_cbor_writer_t* writer)
+{
+  if (single_host_addr_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, CARDANO_RELAY_TYPE_SINGLE_HOST_ADDRESS);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  if (single_host_addr_relay->port == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t write_port_result = cardano_cbor_writer_write_uint(writer, *single_host_addr_relay->port);
+
+    if (write_port_result != CARDANO_SUCCESS)
+    {
+      return write_port_result;
+    }
+  }
+
+  if (single_host_addr_relay->ipv4 == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t write_ipv4_result = cardano_ipv4_to_cbor(single_host_addr_relay->ipv4, writer);
+
+    if (write_ipv4_result != CARDANO_SUCCESS)
+    {
+      return write_ipv4_result;
+    }
+  }
+
+  if (single_host_addr_relay->ipv6 == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t write_ipv6_result = cardano_ipv6_to_cbor(single_host_addr_relay->ipv6, writer);
+
+    if (write_ipv6_result != CARDANO_SUCCESS)
+    {
+      return write_ipv6_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_single_host_addr_relay_to_cip116_json(
+  const cardano_single_host_addr_relay_t* relay,
+  cardano_json_writer_t*                  writer)
+{
+  if ((relay == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "single_host_addr", 16);
+
+  cardano_json_writer_write_property_name(writer, "port", 4);
+
+  if (relay->port != NULL)
+  {
+    cardano_json_writer_write_uint(writer, *relay->port);
+  }
+  else
+  {
+    cardano_json_writer_write_null(writer);
+  }
+
+  cardano_json_writer_write_property_name(writer, "ipv4", 4);
+
+  if (relay->ipv4 != NULL)
+  {
+    const char* addrString = cardano_ipv4_get_string(relay->ipv4);
+    cardano_json_writer_write_string(writer, addrString, cardano_safe_strlen(addrString, 16));
+  }
+  else
+  {
+    cardano_json_writer_write_null(writer);
+  }
+
+  cardano_json_writer_write_property_name(writer, "ipv6", 4);
+
+  if (relay->ipv6 != NULL)
+  {
+    const char* addrString = cardano_ipv6_get_string(relay->ipv6);
+    cardano_json_writer_write_string(writer, addrString, cardano_safe_strlen(addrString, 40));
+  }
+  else
+  {
+    cardano_json_writer_write_null(writer);
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+const uint16_t*
+cardano_single_host_addr_relay_get_port(
+  const cardano_single_host_addr_relay_t* relay)
+{
+  if (relay == NULL)
+  {
+    return NULL;
+  }
+
+  return relay->port;
+}
+
+cardano_error_t
+cardano_single_host_addr_relay_set_port(
+  cardano_single_host_addr_relay_t* relay,
+  const uint16_t*                   port)
+{
+  if (relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (port == NULL)
+  {
+    if (relay->port != NULL)
+    {
+      _cardano_free(relay->port);
+      relay->port = NULL;
+    }
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (relay->port == NULL)
+  {
+    relay->port = _cardano_malloc(sizeof(uint16_t));
+
+    if (relay->port == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *relay->port = *port;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_single_host_addr_relay_get_ipv4(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  cardano_ipv4_t**                  ipv4)
+{
+  if (single_host_addr_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (ipv4 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ipv4_ref(single_host_addr_relay->ipv4);
+  *ipv4 = single_host_addr_relay->ipv4;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_single_host_addr_relay_set_ipv4(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  cardano_ipv4_t*                   ipv4)
+{
+  if (single_host_addr_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (ipv4 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ipv4_ref(ipv4);
+  cardano_ipv4_unref(&single_host_addr_relay->ipv4);
+  single_host_addr_relay->ipv4 = ipv4;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_single_host_addr_relay_get_ipv6(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  cardano_ipv6_t**                  ipv6)
+{
+  if (single_host_addr_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (ipv6 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ipv6_ref(single_host_addr_relay->ipv6);
+  *ipv6 = single_host_addr_relay->ipv6;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_single_host_addr_relay_set_ipv6(
+  cardano_single_host_addr_relay_t* single_host_addr_relay,
+  cardano_ipv6_t*                   ipv6)
+{
+  if (single_host_addr_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (ipv6 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ipv6_ref(ipv6);
+  cardano_ipv6_unref(&single_host_addr_relay->ipv6);
+  single_host_addr_relay->ipv6 = ipv6;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_single_host_addr_relay_unref(cardano_single_host_addr_relay_t** single_host_addr_relay)
+{
+  if ((single_host_addr_relay == NULL) || (*single_host_addr_relay == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*single_host_addr_relay)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *single_host_addr_relay = NULL;
+    return;
+  }
+}
+
+void
+cardano_single_host_addr_relay_ref(cardano_single_host_addr_relay_t* single_host_addr_relay)
+{
+  if (single_host_addr_relay == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&single_host_addr_relay->base);
+}
+
+size_t
+cardano_single_host_addr_relay_refcount(const cardano_single_host_addr_relay_t* single_host_addr_relay)
+{
+  if (single_host_addr_relay == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&single_host_addr_relay->base);
+}
+
+void
+cardano_single_host_addr_relay_set_last_error(cardano_single_host_addr_relay_t* single_host_addr_relay, const char* message)
+{
+  cardano_object_set_last_error(&single_host_addr_relay->base, message);
+}
+
+const char*
+cardano_single_host_addr_relay_get_last_error(const cardano_single_host_addr_relay_t* single_host_addr_relay)
+{
+  return cardano_object_get_last_error(&single_host_addr_relay->base);
+}
+
+cardano_error_t
+cardano_single_host_addr_relay_deep_clone(const cardano_single_host_addr_relay_t* source, cardano_single_host_addr_relay_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_single_host_addr_relay_t* copy = _cardano_malloc(sizeof(cardano_single_host_addr_relay_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->port               = NULL;
+  copy->ipv4               = NULL;
+  copy->ipv6               = NULL;
+
+  if (source->port != NULL)
+  {
+    const size_t size = sizeof(uint16_t);
+
+    copy->port = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->port == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->port, source->port, size));
+  }
+
+  if (source->ipv4 != NULL)
+  {
+    const cardano_error_t result = cardano_ipv4_deep_clone(source->ipv4, &copy->ipv4);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->ipv6 != NULL)
+  {
+    const cardano_error_t result = cardano_ipv6_deep_clone(source->ipv6, &copy->ipv6);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/pool_params/single_host_name_relay.c b/vendor/src/pool_params/single_host_name_relay.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/pool_params/single_host_name_relay.c
@@ -0,0 +1,529 @@
+/**
+ * \file single_host_name_relay.c
+ *
+ * \author angel.castillo
+ * \date   Jun 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/pool_params/relay.h>
+#include <cardano/pool_params/single_host_name_relay.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an single host name relay.
+ *
+ * Each instance of `cardano_single_host_name_relay_t` holds a single host name relay.
+ */
+typedef struct cardano_single_host_name_relay_t
+{
+    cardano_object_t base;
+    char             dns[65];
+    uint16_t*        port;
+} cardano_single_host_name_relay_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a single_host_name_relay object.
+ *
+ * This function is responsible for properly deallocating a single_host_name_relay object (`cardano_single_host_name_relay_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the single_host_name_relay object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_single_host_name_relay_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the single_host_name_relay
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_single_host_name_relay_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_single_host_name_relay_t* single_host_name_relay = (cardano_single_host_name_relay_t*)object;
+
+  _cardano_free(single_host_name_relay->port);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_single_host_name_relay_new(const uint16_t* port, const char* dns, const size_t str_size, cardano_single_host_name_relay_t** single_host_name_relay)
+{
+  if (single_host_name_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (dns == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((str_size > 64U) || (str_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *single_host_name_relay = _cardano_malloc(sizeof(cardano_single_host_name_relay_t));
+
+  if (*single_host_name_relay == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*single_host_name_relay)->base.deallocator   = cardano_single_host_name_relay_deallocate;
+  (*single_host_name_relay)->base.ref_count     = 1;
+  (*single_host_name_relay)->base.last_error[0] = '\0';
+
+  CARDANO_UNUSED(memset((*single_host_name_relay)->dns, 0, 65));
+  cardano_safe_memcpy((*single_host_name_relay)->dns, 65, dns, str_size);
+
+  const size_t dns_size                    = cardano_safe_strlen((*single_host_name_relay)->dns, 64);
+  (*single_host_name_relay)->dns[dns_size] = '\0';
+
+  if (port == NULL)
+  {
+    (*single_host_name_relay)->port = NULL;
+    return CARDANO_SUCCESS;
+  }
+
+  (*single_host_name_relay)->port = _cardano_malloc(sizeof(uint16_t));
+
+  if ((*single_host_name_relay)->port == NULL)
+  {
+    cardano_single_host_name_relay_unref(single_host_name_relay);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *(*single_host_name_relay)->port = *port;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_single_host_name_relay_from_cbor(cardano_cbor_reader_t* reader, cardano_single_host_name_relay_t** single_host_name_relay)
+{
+  if (single_host_name_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *single_host_name_relay = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "single_host_name_relay";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *single_host_name_relay = NULL;
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_RELAY_TYPE_SINGLE_HOST_NAME,
+    (enum_to_string_callback_t)((void*)&cardano_relay_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  bool     has_port = false;
+  uint16_t port     = 0U;
+  uint64_t port64   = 0U;
+
+  cardano_cbor_reader_state_t state;
+
+  const cardano_error_t peek_state = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_state != CARDANO_SUCCESS)
+  {
+    return peek_state;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    const cardano_error_t read_null_result = cardano_cbor_reader_read_null(reader);
+
+    if (read_null_result != CARDANO_SUCCESS)
+    {
+      return read_null_result;
+    }
+  }
+  else
+  {
+    const cardano_error_t read_port_result = cardano_cbor_reader_read_uint(reader, &port64);
+
+    if (read_port_result != CARDANO_SUCCESS)
+    {
+      return read_port_result;
+    }
+
+    has_port = true;
+    if (port64 > UINT16_MAX)
+    {
+      cardano_cbor_reader_set_last_error(reader, "Relay port exceeds the unsigned 16-bit range.");
+      return CARDANO_ERROR_DECODING;
+    }
+
+    port = (uint16_t)port64;
+  }
+
+  cardano_buffer_t* dns = NULL;
+
+  const cardano_error_t read_string_result = cardano_cbor_reader_read_textstring(reader, &dns);
+
+  if (read_string_result != CARDANO_SUCCESS)
+  {
+    return read_string_result;
+  }
+
+  const size_t dns_size = cardano_buffer_get_size(dns);
+  const char*  dns_data = (char*)((void*)cardano_buffer_get_data(dns));
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&dns);
+    *single_host_name_relay = NULL;
+
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t result = cardano_single_host_name_relay_new(has_port ? &port : NULL, dns_data, dns_size, single_host_name_relay);
+
+  cardano_buffer_unref(&dns);
+
+  return result;
+}
+
+cardano_error_t
+cardano_single_host_name_relay_to_cbor(const cardano_single_host_name_relay_t* single_host_name_relay, cardano_cbor_writer_t* writer)
+{
+  if (single_host_name_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, CARDANO_RELAY_TYPE_SINGLE_HOST_NAME);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  if (single_host_name_relay->port == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t write_port_result = cardano_cbor_writer_write_uint(writer, *single_host_name_relay->port);
+
+    if (write_port_result != CARDANO_SUCCESS)
+    {
+      return write_port_result;
+    }
+  }
+
+  return cardano_cbor_writer_write_textstring(writer, single_host_name_relay->dns, cardano_safe_strlen(single_host_name_relay->dns, 64));
+}
+
+cardano_error_t
+cardano_single_host_name_relay_to_cip116_json(
+  const cardano_single_host_name_relay_t* relay,
+  cardano_json_writer_t*                  writer)
+{
+  if ((relay == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "single_host_name", 16);
+
+  cardano_json_writer_write_property_name(writer, "port", 4);
+
+  if (relay->port != NULL)
+  {
+    cardano_json_writer_write_uint(writer, *relay->port);
+  }
+  else
+  {
+    cardano_json_writer_write_null(writer);
+  }
+
+  cardano_json_writer_write_property_name(writer, "dns_name", 8);
+  cardano_json_writer_write_string(writer, relay->dns, cardano_safe_strlen(relay->dns, 64));
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+const uint16_t*
+cardano_single_host_name_relay_get_port(
+  const cardano_single_host_name_relay_t* relay)
+{
+  if (relay == NULL)
+  {
+    return NULL;
+  }
+
+  return relay->port;
+}
+
+cardano_error_t
+cardano_single_host_name_relay_set_port(
+  cardano_single_host_name_relay_t* relay,
+  const uint16_t*                   port)
+{
+  if (relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (port == NULL)
+  {
+    if (relay->port != NULL)
+    {
+      _cardano_free(relay->port);
+      relay->port = NULL;
+    }
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (relay->port == NULL)
+  {
+    relay->port = _cardano_malloc(sizeof(uint16_t));
+
+    if (relay->port == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *relay->port = *port;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_single_host_name_relay_get_dns_size(
+  const cardano_single_host_name_relay_t* single_host_name_relay)
+{
+  if (single_host_name_relay == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_safe_strlen(single_host_name_relay->dns, 64) + 1U;
+}
+
+const char*
+cardano_single_host_name_relay_get_dns(
+  const cardano_single_host_name_relay_t* single_host_name_relay)
+{
+  if (single_host_name_relay == NULL)
+  {
+    return NULL;
+  }
+
+  return single_host_name_relay->dns;
+}
+
+cardano_error_t
+cardano_single_host_name_relay_set_dns(
+  const char*                       dns,
+  size_t                            dns_size,
+  cardano_single_host_name_relay_t* single_host_name_relay)
+{
+  if (single_host_name_relay == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (dns == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((dns_size > 64U) || (dns_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_safe_memcpy((void*)&single_host_name_relay->dns[0], 65, dns, dns_size);
+
+  single_host_name_relay->dns[dns_size] = '\0';
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_single_host_name_relay_unref(cardano_single_host_name_relay_t** single_host_name_relay)
+{
+  if ((single_host_name_relay == NULL) || (*single_host_name_relay == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*single_host_name_relay)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *single_host_name_relay = NULL;
+    return;
+  }
+}
+
+void
+cardano_single_host_name_relay_ref(cardano_single_host_name_relay_t* single_host_name_relay)
+{
+  if (single_host_name_relay == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&single_host_name_relay->base);
+}
+
+size_t
+cardano_single_host_name_relay_refcount(const cardano_single_host_name_relay_t* single_host_name_relay)
+{
+  if (single_host_name_relay == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&single_host_name_relay->base);
+}
+
+void
+cardano_single_host_name_relay_set_last_error(cardano_single_host_name_relay_t* single_host_name_relay, const char* message)
+{
+  cardano_object_set_last_error(&single_host_name_relay->base, message);
+}
+
+const char*
+cardano_single_host_name_relay_get_last_error(const cardano_single_host_name_relay_t* single_host_name_relay)
+{
+  return cardano_object_get_last_error(&single_host_name_relay->base);
+}
+
+cardano_error_t
+cardano_single_host_name_relay_deep_clone(const cardano_single_host_name_relay_t* source, cardano_single_host_name_relay_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_single_host_name_relay_t* copy = _cardano_malloc(sizeof(cardano_single_host_name_relay_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  CARDANO_UNUSED(memcpy(copy->dns, source->dns, sizeof(copy->dns)));
+  copy->port = NULL;
+
+  if (source->port != NULL)
+  {
+    const size_t size = sizeof(uint16_t);
+
+    copy->port = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->port == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->port, source->port, size));
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/committee.c b/vendor/src/proposal_procedures/committee.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/committee.c
@@ -0,0 +1,492 @@
+/**
+ * \file committee.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/unit_interval.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/committee.h>
+#include <cardano/proposal_procedures/committee_members_map.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The constitutional committee represents a set of individuals or entities (each associated with a pair of Ed25519 credentials)
+ * that are collectively responsible for ensuring that the Constitution is respected.
+ *
+ * Though it cannot be enforced on-chain, the constitutional committee is only supposed to vote on the constitutionality
+ * of governance actions (which should thus ensure the long-term sustainability of the blockchain) and should be replaced
+ * (via the no confidence action) if they overstep this boundary.
+ */
+typedef struct cardano_committee_t
+{
+    cardano_object_t                 base;
+    cardano_unit_interval_t*         quorum_threshold;
+    cardano_committee_members_map_t* committee_members_map;
+} cardano_committee_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a committee object.
+ *
+ * This function is responsible for properly deallocating a committee object (`cardano_committee_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the committee object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_committee_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the committee
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_committee_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_committee_t* data = (cardano_committee_t*)object;
+
+  cardano_unit_interval_unref(&data->quorum_threshold);
+  cardano_committee_members_map_unref(&data->committee_members_map);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_committee_new(
+  cardano_unit_interval_t* quorum_threshold,
+  cardano_committee_t**    committee)
+{
+  if (quorum_threshold == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_committee_t* data = _cardano_malloc(sizeof(cardano_committee_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_committee_deallocate;
+
+  cardano_unit_interval_ref(quorum_threshold);
+  data->quorum_threshold = quorum_threshold;
+
+  cardano_error_t new_map_result = cardano_committee_members_map_new(&data->committee_members_map);
+
+  if (new_map_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&data->quorum_threshold);
+    _cardano_free(data);
+
+    return new_map_result;
+  }
+
+  *committee = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_committee_from_cbor(cardano_cbor_reader_t* reader, cardano_committee_t** committee)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "committee";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  cardano_unit_interval_t*         quorum_threshold      = NULL;
+  cardano_committee_members_map_t* committee_members_map = NULL;
+
+  cardano_error_t read_map_result = cardano_committee_members_map_from_cbor(reader, &committee_members_map);
+
+  if (read_map_result != CARDANO_SUCCESS)
+  {
+    return read_map_result;
+  }
+
+  cardano_error_t read_quorum_result = cardano_unit_interval_from_cbor(reader, &quorum_threshold);
+
+  if (read_quorum_result != CARDANO_SUCCESS)
+  {
+    cardano_committee_members_map_unref(&committee_members_map);
+    return read_quorum_result;
+  }
+
+  cardano_error_t new_result = cardano_committee_new(quorum_threshold, committee);
+
+  cardano_unit_interval_unref(&quorum_threshold);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    cardano_committee_members_map_unref(&committee_members_map);
+    return new_result;
+  }
+
+  cardano_committee_members_map_unref(&(*committee)->committee_members_map);
+  (*committee)->committee_members_map = committee_members_map;
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_committee_to_cbor(
+  const cardano_committee_t* committee,
+  cardano_cbor_writer_t*     writer)
+{
+  if (committee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_map_result = cardano_committee_members_map_to_cbor(committee->committee_members_map, writer);
+
+  if (write_map_result != CARDANO_SUCCESS)
+  {
+    return write_map_result;
+  }
+
+  cardano_error_t write_quorum_result = cardano_unit_interval_to_cbor(committee->quorum_threshold, writer);
+
+  if (write_quorum_result != CARDANO_SUCCESS)
+  {
+    return write_quorum_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_committee_set_quorum_threshold(
+  cardano_committee_t*     committee,
+  cardano_unit_interval_t* quorum_threshold)
+{
+  if (committee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (quorum_threshold == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&committee->quorum_threshold);
+  cardano_unit_interval_ref(quorum_threshold);
+
+  committee->quorum_threshold = quorum_threshold;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_unit_interval_t*
+cardano_committee_get_quorum_threshold(cardano_committee_t* committee)
+{
+  if (committee == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(committee->quorum_threshold);
+
+  return committee->quorum_threshold;
+}
+
+cardano_error_t
+cardano_committee_members_keys(cardano_committee_t* committee, cardano_credential_set_t** credentials)
+{
+  if (committee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credentials == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_committee_members_map_get_keys(committee->committee_members_map, credentials);
+}
+
+cardano_error_t
+cardano_committee_add_member(
+  cardano_committee_t*  committee,
+  cardano_credential_t* credential,
+  const uint64_t        epoch)
+{
+  if (committee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_committee_members_map_insert(committee->committee_members_map, credential, epoch);
+}
+
+uint64_t
+cardano_committee_get_member_epoch(
+  cardano_committee_t*  committee,
+  cardano_credential_t* credential)
+{
+  if (committee == NULL)
+  {
+    return 0;
+  }
+
+  if (credential == NULL)
+  {
+    return 0;
+  }
+
+  uint64_t epoch = 0;
+
+  cardano_error_t result = cardano_committee_members_map_get(committee->committee_members_map, credential, &epoch);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return 0;
+  }
+
+  return epoch;
+}
+
+cardano_error_t
+cardano_committee_get_key_at(
+  const cardano_committee_t* committee,
+  size_t                     index,
+  cardano_credential_t**     credential)
+{
+  if (committee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_committee_members_map_get_key_at(committee->committee_members_map, index, credential);
+}
+
+cardano_error_t
+cardano_committee_get_value_at(
+  const cardano_committee_t* committee,
+  size_t                     index,
+  uint64_t*                  epoch)
+{
+  if (committee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (epoch == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_committee_members_map_get_value_at(committee->committee_members_map, index, epoch);
+}
+
+cardano_error_t
+cardano_committee_get_key_value_at(
+  const cardano_committee_t* committee,
+  size_t                     index,
+  cardano_credential_t**     credential,
+  uint64_t*                  epoch)
+{
+  if (committee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (epoch == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_committee_members_map_get_key_value_at(committee->committee_members_map, index, credential, epoch);
+}
+
+void
+cardano_committee_unref(cardano_committee_t** committee)
+{
+  if ((committee == NULL) || (*committee == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*committee)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *committee = NULL;
+    return;
+  }
+}
+
+void
+cardano_committee_ref(cardano_committee_t* committee)
+{
+  if (committee == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&committee->base);
+}
+
+size_t
+cardano_committee_refcount(const cardano_committee_t* committee)
+{
+  if (committee == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&committee->base);
+}
+
+void
+cardano_committee_set_last_error(cardano_committee_t* committee, const char* message)
+{
+  cardano_object_set_last_error(&committee->base, message);
+}
+
+const char*
+cardano_committee_get_last_error(const cardano_committee_t* committee)
+{
+  return cardano_object_get_last_error(&committee->base);
+}
+
+cardano_error_t
+cardano_committee_deep_clone(const cardano_committee_t* source, cardano_committee_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_committee_t* copy = _cardano_malloc(sizeof(cardano_committee_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count        = 1U;
+  copy->base.deallocator      = source->base.deallocator;
+  copy->base.last_error[0]    = '\0';
+  copy->quorum_threshold      = NULL;
+  copy->committee_members_map = NULL;
+
+  if (source->quorum_threshold != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->quorum_threshold, &copy->quorum_threshold);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->committee_members_map != NULL)
+  {
+    const cardano_error_t result = cardano_committee_members_map_deep_clone(source->committee_members_map, &copy->committee_members_map);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/committee_members_map.c b/vendor/src/proposal_procedures/committee_members_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/committee_members_map.c
@@ -0,0 +1,789 @@
+/**
+ * \file committee_members_map.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/committee_members_map.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a map of committee members to epoch.
+ */
+typedef struct cardano_committee_members_map_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_committee_members_map_t;
+
+/**
+ * \brief Represents a committee members to epoch key value pair.
+ */
+typedef struct cardano_committee_members_map_kvp_t
+{
+    cardano_object_t      base;
+    cardano_credential_t* key;
+    uint64_t              value;
+} cardano_committee_members_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a committee members object.
+ *
+ * This function is responsible for properly deallocating a committee members object (`cardano_committee_members_map_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the committee_members_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_committee_members_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the committee_members_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_committee_members_map_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_committee_members_map_t* map = (cardano_committee_members_map_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a committee members key value pair object.
+ *
+ * This function is responsible for properly deallocating a committee members key value pair object (`cardano_committee_members_map_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the committee_members_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_committee_members_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the committee_members_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_committee_members_map_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_committee_members_map_kvp_t* map = (cardano_committee_members_map_kvp_t*)object;
+
+  if (map->key != NULL)
+  {
+    cardano_credential_unref(&map->key);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two cardano_committee_members_map_kvp_t objects based on their credential.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the credential of lhs is less than the credential of rhs, zero if they are equal,
+ *         and a positive value if the credential of lhs is greater than the credential of rhs.
+ */
+static int32_t
+compare_by_credentials(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_committee_members_map_kvp_t* lhs_kvp = (const cardano_committee_members_map_kvp_t*)((const void*)lhs);
+  const cardano_committee_members_map_kvp_t* rhs_kvp = (const cardano_committee_members_map_kvp_t*)((const void*)rhs);
+
+  return cardano_credential_compare(lhs_kvp->key, rhs_kvp->key);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_committee_members_map_new(cardano_committee_members_map_t** committee_members_map)
+{
+  if (committee_members_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_committee_members_map_t* map = _cardano_malloc(sizeof(cardano_committee_members_map_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_committee_members_map_deallocate;
+
+  map->array = cardano_array_new(32);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *committee_members_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_committee_members_map_from_cbor(cardano_cbor_reader_t* reader, cardano_committee_members_map_t** committee_members_map)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_members_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_committee_members_map_t* map    = NULL;
+  cardano_error_t                  result = cardano_committee_members_map_new(&map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_map(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_committee_members_map_unref(&map);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_committee_members_map_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_credential_t* key   = NULL;
+    uint64_t              value = 0;
+
+    result = cardano_credential_from_cbor(reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_committee_members_map_unref(&map);
+      return result;
+    }
+
+    result = cardano_cbor_reader_read_uint(reader, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_credential_unref(&key);
+      cardano_committee_members_map_unref(&map);
+      return result;
+    }
+
+    cardano_committee_members_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_committee_members_map_kvp_t));
+
+    if (kvp == NULL)
+    {
+      cardano_credential_unref(&key);
+      cardano_committee_members_map_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    kvp->base.ref_count     = 0;
+    kvp->base.last_error[0] = '\0';
+    kvp->base.deallocator   = cardano_committee_members_map_kvp_deallocate;
+    kvp->key                = key;
+    kvp->value              = value;
+
+    const size_t old_size = cardano_array_get_size(map->array);
+    const size_t new_size = cardano_array_push(map->array, (cardano_object_t*)((void*)kvp));
+
+    if (new_size != (old_size + 1U))
+    {
+      cardano_committee_members_map_kvp_deallocate(kvp);
+      cardano_committee_members_map_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    cardano_array_sort(map->array, compare_by_credentials, NULL);
+  }
+
+  result = cardano_cbor_validate_end_map("committee_members_map", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_committee_members_map_unref(&map);
+    return result;
+  }
+
+  *committee_members_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_committee_members_map_to_cbor(const cardano_committee_members_map_t* committee_members_map, cardano_cbor_writer_t* writer)
+{
+  if (committee_members_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t map_size = cardano_array_get_size(committee_members_map->array);
+  result          = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(committee_members_map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(committee_members_map->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in committee members is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_committee_members_map_kvp_t* kvp_data = (cardano_committee_members_map_kvp_t*)((void*)kvp);
+
+    result = cardano_credential_to_cbor(kvp_data->key, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, kvp_data->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    cardano_object_unref(&kvp);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_committee_members_map_to_cip116_json(
+  const cardano_committee_members_map_t* map,
+  cardano_json_writer_t*                 writer)
+{
+  if ((map == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t          array_size = cardano_array_get_size(map->array);
+  cardano_error_t error      = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; i < array_size; ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(map->array, i);
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    cardano_committee_members_map_kvp_t* kvp_data = (cardano_committee_members_map_kvp_t*)((void*)kvp);
+
+    cardano_json_writer_write_start_object(writer);
+
+    cardano_json_writer_write_property_name(writer, "key", 3);
+    error = cardano_credential_to_cip116_json(kvp_data->key, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return error;
+    }
+
+    cardano_json_writer_write_property_name(writer, "value", 5);
+    cardano_json_writer_write_uint_as_string(writer, kvp_data->value);
+
+    cardano_json_writer_write_end_object(writer);
+    cardano_object_unref(&kvp);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return error;
+}
+
+size_t
+cardano_committee_members_map_get_length(const cardano_committee_members_map_t* committee_members_map)
+{
+  if (committee_members_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(committee_members_map->array);
+}
+
+cardano_error_t
+cardano_committee_members_map_get(
+  cardano_committee_members_map_t* committee_members_map,
+  cardano_credential_t*            key,
+  uint64_t*                        element)
+{
+  if (committee_members_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(committee_members_map->array); ++i)
+  {
+    cardano_object_t*                    object = cardano_array_get(committee_members_map->array, i);
+    cardano_committee_members_map_kvp_t* kvp    = (cardano_committee_members_map_kvp_t*)((void*)object);
+
+    if (cardano_credential_equals(kvp->key, key))
+    {
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_committee_members_map_insert(
+  cardano_committee_members_map_t* committee_members_map,
+  cardano_credential_t*            key,
+  const uint64_t                   value)
+{
+  if (committee_members_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_committee_members_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_committee_members_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_committee_members_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_credential_ref(key);
+
+  const size_t old_size = cardano_array_get_size(committee_members_map->array);
+  const size_t new_size = cardano_array_push(committee_members_map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_committee_members_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(committee_members_map->array, compare_by_credentials, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_committee_members_map_get_keys(
+  cardano_committee_members_map_t* committee_members_map,
+  cardano_credential_set_t**       keys)
+{
+  if (committee_members_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_set_t* list = NULL;
+
+  cardano_error_t result = cardano_credential_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(committee_members_map->array); ++i)
+  {
+    cardano_object_t*                    object = cardano_array_get(committee_members_map->array, i);
+    cardano_committee_members_map_kvp_t* kvp    = (cardano_committee_members_map_kvp_t*)((void*)object);
+
+    result = cardano_credential_set_add(list, kvp->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_credential_set_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_committee_members_map_get_key_at(
+  const cardano_committee_members_map_t* committee_members_map,
+  const size_t                           index,
+  cardano_credential_t**                 credential)
+{
+  if (committee_members_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(committee_members_map->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_committee_members_map_kvp_t* kvp = (cardano_committee_members_map_kvp_t*)((void*)object);
+
+  cardano_object_unref(&object);
+  cardano_credential_ref(kvp->key);
+
+  *credential = kvp->key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_committee_members_map_get_value_at(
+  const cardano_committee_members_map_t* committee_members_map,
+  const size_t                           index,
+  uint64_t*                              epoch)
+{
+  if (committee_members_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (epoch == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(committee_members_map->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_committee_members_map_kvp_t* kvp = (cardano_committee_members_map_kvp_t*)((void*)object);
+
+  *epoch = kvp->value;
+
+  cardano_object_unref(&object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_committee_members_map_get_key_value_at(
+  const cardano_committee_members_map_t* committee_members_map,
+  const size_t                           index,
+  cardano_credential_t**                 credential,
+  uint64_t*                              epoch)
+{
+  if (committee_members_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (epoch == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(committee_members_map->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_committee_members_map_kvp_t* kvp = (cardano_committee_members_map_kvp_t*)((void*)object);
+
+  cardano_credential_ref(kvp->key);
+  *credential = kvp->key;
+  *epoch      = kvp->value;
+
+  cardano_object_unref(&object);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_committee_members_map_unref(cardano_committee_members_map_t** committee_members_map)
+{
+  if ((committee_members_map == NULL) || (*committee_members_map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*committee_members_map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *committee_members_map = NULL;
+    return;
+  }
+}
+
+void
+cardano_committee_members_map_ref(cardano_committee_members_map_t* committee_members_map)
+{
+  if (committee_members_map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&committee_members_map->base);
+}
+
+size_t
+cardano_committee_members_map_refcount(const cardano_committee_members_map_t* committee_members_map)
+{
+  if (committee_members_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&committee_members_map->base);
+}
+
+void
+cardano_committee_members_map_set_last_error(cardano_committee_members_map_t* committee_members_map, const char* message)
+{
+  cardano_object_set_last_error(&committee_members_map->base, message);
+}
+
+const char*
+cardano_committee_members_map_get_last_error(const cardano_committee_members_map_t* committee_members_map)
+{
+  return cardano_object_get_last_error(&committee_members_map->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_committee_members_map_kvp_deep_clone(const cardano_committee_members_map_kvp_t* source, cardano_committee_members_map_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_committee_members_map_kvp_t* copy = _cardano_malloc(sizeof(cardano_committee_members_map_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = source->value;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_committee_members_map_kvp_t* copy   = NULL;
+  const cardano_error_t                result = cardano_committee_members_map_kvp_deep_clone((const cardano_committee_members_map_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_committee_members_map_deep_clone(const cardano_committee_members_map_t* source, cardano_committee_members_map_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_committee_members_map_t* copy = _cardano_malloc(sizeof(cardano_committee_members_map_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/constitution.c b/vendor/src/proposal_procedures/constitution.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/constitution.c
@@ -0,0 +1,472 @@
+/**
+ * \file constitution.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/anchor.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/constitution.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The Cardano Constitution is a text document that defines Cardano's shared values and guiding principles.
+ * At this stage, the Constitution is an informational document that unambiguously captures the core values
+ * of Cardano and acts to ensure its long-term sustainability. At a later stage, we can imagine the Constitution
+ * perhaps evolving into a smart-contract based set of rules that drives the entire governance framework.
+ *
+ * For now, however, the Constitution will remain an off-chain document whose hash digest value will be recorded
+ * on-chain.
+ */
+typedef struct cardano_constitution_t
+{
+    cardano_object_t        base;
+    cardano_anchor_t*       anchor;
+    cardano_blake2b_hash_t* script_hash;
+} cardano_constitution_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a constitution object.
+ *
+ * This function is responsible for properly deallocating a constitution object (`cardano_constitution_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the constitution object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_constitution_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the constitution
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_constitution_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_constitution_t* data = (cardano_constitution_t*)object;
+
+  cardano_anchor_unref(&data->anchor);
+  cardano_blake2b_hash_unref(&data->script_hash);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_constitution_new(
+  cardano_anchor_t*        anchor,
+  cardano_blake2b_hash_t*  script_hash,
+  cardano_constitution_t** constitution)
+{
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (constitution == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_constitution_t* data = _cardano_malloc(sizeof(cardano_constitution_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_constitution_deallocate;
+  data->script_hash        = NULL;
+
+  cardano_anchor_ref(anchor);
+  data->anchor = anchor;
+
+  if (script_hash != NULL)
+  {
+    cardano_blake2b_hash_ref(script_hash);
+    data->script_hash = script_hash;
+  }
+
+  *constitution = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_constitution_from_cbor(cardano_cbor_reader_t* reader, cardano_constitution_t** constitution)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (constitution == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "constitution";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_error_t read_quorum_result = cardano_anchor_from_cbor(reader, &anchor);
+
+  if (read_quorum_result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    return read_quorum_result;
+  }
+
+  cardano_blake2b_hash_t* script_hash = NULL;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_NULL;
+
+  cardano_error_t read_map_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_map_result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    return read_map_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+
+    if (read_null != CARDANO_SUCCESS)
+    {
+      cardano_anchor_unref(&anchor);
+      return read_null;
+    }
+  }
+  else
+  {
+    cardano_error_t read_hash_result = cardano_blake2b_hash_from_cbor(reader, &script_hash);
+
+    if (read_hash_result != CARDANO_SUCCESS)
+    {
+      cardano_anchor_unref(&anchor);
+      cardano_blake2b_hash_unref(&script_hash);
+
+      return read_hash_result;
+    }
+  }
+
+  cardano_error_t result = cardano_constitution_new(anchor, script_hash, constitution);
+
+  cardano_anchor_unref(&anchor);
+  cardano_blake2b_hash_unref(&script_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_constitution_to_cbor(
+  const cardano_constitution_t* constitution,
+  cardano_cbor_writer_t*        writer)
+{
+  if (constitution == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_anchor_result = cardano_anchor_to_cbor(constitution->anchor, writer);
+
+  if (write_anchor_result != CARDANO_SUCCESS)
+  {
+    return write_anchor_result;
+  }
+
+  if (constitution->script_hash == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t write_hash_result = cardano_blake2b_hash_to_cbor(constitution->script_hash, writer);
+
+    if (write_hash_result != CARDANO_SUCCESS)
+    {
+      return write_hash_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_constitution_to_cip116_json(
+  const cardano_constitution_t* constitution,
+  cardano_json_writer_t*        writer)
+{
+  if ((constitution == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_json_writer_write_property_name(writer, "anchor", 6);
+
+  cardano_error_t error = cardano_anchor_to_cip116_json(constitution->anchor, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (constitution->script_hash != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "script_hash", 11);
+
+    error = cardano_blake2b_hash_to_cip116_json(constitution->script_hash, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return error;
+}
+
+cardano_error_t
+cardano_constitution_set_anchor(cardano_constitution_t* constitution, cardano_anchor_t* anchor)
+{
+  if (constitution == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_ref(anchor);
+  cardano_anchor_unref(&constitution->anchor);
+  constitution->anchor = anchor;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_anchor_t*
+cardano_constitution_get_anchor(cardano_constitution_t* constitution)
+{
+  if (constitution == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_anchor_ref(constitution->anchor);
+
+  return constitution->anchor;
+}
+
+cardano_error_t
+cardano_constitution_set_script_hash(cardano_constitution_t* constitution, cardano_blake2b_hash_t* script_hash)
+{
+  if (constitution == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_hash == NULL)
+  {
+    cardano_blake2b_hash_unref(&constitution->script_hash);
+    constitution->script_hash = script_hash;
+  }
+  else
+  {
+    cardano_blake2b_hash_ref(script_hash);
+    cardano_blake2b_hash_unref(&constitution->script_hash);
+    constitution->script_hash = script_hash;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_constitution_get_script_hash(cardano_constitution_t* constitution)
+{
+  if (constitution == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(constitution->script_hash);
+
+  return constitution->script_hash;
+}
+
+void
+cardano_constitution_unref(cardano_constitution_t** constitution)
+{
+  if ((constitution == NULL) || (*constitution == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*constitution)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *constitution = NULL;
+    return;
+  }
+}
+
+void
+cardano_constitution_ref(cardano_constitution_t* constitution)
+{
+  if (constitution == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&constitution->base);
+}
+
+size_t
+cardano_constitution_refcount(const cardano_constitution_t* constitution)
+{
+  if (constitution == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&constitution->base);
+}
+
+void
+cardano_constitution_set_last_error(cardano_constitution_t* constitution, const char* message)
+{
+  cardano_object_set_last_error(&constitution->base, message);
+}
+
+const char*
+cardano_constitution_get_last_error(const cardano_constitution_t* constitution)
+{
+  return cardano_object_get_last_error(&constitution->base);
+}
+
+cardano_error_t
+cardano_constitution_deep_clone(const cardano_constitution_t* source, cardano_constitution_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_constitution_t* copy = _cardano_malloc(sizeof(cardano_constitution_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->anchor             = NULL;
+  copy->script_hash        = NULL;
+
+  if (source->anchor != NULL)
+  {
+    const cardano_error_t result = cardano_anchor_deep_clone(source->anchor, &copy->anchor);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->script_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->script_hash, &copy->script_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/credential_set.c b/vendor/src/proposal_procedures/credential_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/credential_set.c
@@ -0,0 +1,504 @@
+/**
+ * \file credential_set.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/credential_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano credential_set list.
+ */
+typedef struct cardano_credential_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_credential_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a credential_set list object.
+ *
+ * This function is responsible for properly deallocating a credential_set list object (`cardano_credential_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the credential_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_credential_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the credential_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_credential_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_credential_set_t* list = (cardano_credential_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their credential.
+ *
+ * This function casts the cardano_object_t objects to cardano_credential_t
+ * and compares their hashes using the cardano_credential_compare function.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused context parameter.
+ *
+ * \return A negative value if the hash of lhs is less than the hash of rhs, zero if they are equal,
+ *         and a positive value if the hash of lhs is greater than the hash of rhs.
+ */
+static int32_t
+compare_by_hash(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_credential_t* lhs_hash = (const cardano_credential_t*)((const void*)lhs);
+  const cardano_credential_t* rhs_hash = (const cardano_credential_t*)((const void*)rhs);
+
+  return cardano_credential_compare(lhs_hash, rhs_hash);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_credential_set_new(cardano_credential_set_t** credential_set)
+{
+  if (credential_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_set_t* list = _cardano_malloc(sizeof(cardano_credential_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_credential_set_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *credential_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_credential_set_from_cbor(cardano_cbor_reader_t* reader, cardano_credential_set_t** credential_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_set_t* list   = NULL;
+  cardano_error_t           result = cardano_credential_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_credential_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("credential_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_credential_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_credential_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_credential_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_credential_t* element = NULL;
+
+    result = cardano_credential_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_credential_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_credential_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_credential_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("credential_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_credential_set_unref(&list);
+    return result;
+  }
+
+  cardano_array_sort(list->array, compare_by_hash, NULL);
+
+  *credential_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_credential_set_to_cbor(const cardano_credential_set_t* credential_set, cardano_cbor_writer_t* writer)
+{
+  if (credential_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(credential_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  size_t array_size = cardano_array_get_size(credential_set->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(credential_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(credential_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in credential_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_credential_to_cbor((cardano_credential_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_credential_set_to_cip116_json(
+  const cardano_credential_set_t* set,
+  cardano_json_writer_t*          writer)
+{
+  if ((set == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t          length = cardano_credential_set_get_length(set);
+  cardano_error_t error  = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_credential_t* cred = NULL;
+    error                      = cardano_credential_set_get(set, i, &cred);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_credential_to_cip116_json(cred, writer);
+    cardano_credential_unref(&cred);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return error;
+}
+
+size_t
+cardano_credential_set_get_length(const cardano_credential_set_t* credential_set)
+{
+  if (credential_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(credential_set->array);
+}
+
+cardano_error_t
+cardano_credential_set_get(
+  const cardano_credential_set_t* credential_set,
+  size_t                          index,
+  cardano_credential_t**          element)
+{
+  if (credential_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(credential_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_credential_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_credential_set_add(cardano_credential_set_t* credential_set, cardano_credential_t* element)
+{
+  if (credential_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(credential_set->array);
+  const size_t new_size      = cardano_array_push(credential_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(credential_set->array, compare_by_hash, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_credential_set_unref(cardano_credential_set_t** credential_set)
+{
+  if ((credential_set == NULL) || (*credential_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*credential_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *credential_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_credential_set_ref(cardano_credential_set_t* credential_set)
+{
+  if (credential_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&credential_set->base);
+}
+
+size_t
+cardano_credential_set_refcount(const cardano_credential_set_t* credential_set)
+{
+  if (credential_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&credential_set->base);
+}
+
+void
+cardano_credential_set_set_last_error(cardano_credential_set_t* credential_set, const char* message)
+{
+  cardano_object_set_last_error(&credential_set->base, message);
+}
+
+const char*
+cardano_credential_set_get_last_error(const cardano_credential_set_t* credential_set)
+{
+  return cardano_object_get_last_error(&credential_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_credential_t* copy   = NULL;
+  const cardano_error_t result = cardano_credential_deep_clone((const cardano_credential_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_credential_set_deep_clone(const cardano_credential_set_t* source, cardano_credential_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_set_t* copy = _cardano_malloc(sizeof(cardano_credential_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/governance_action_type.c b/vendor/src/proposal_procedures/governance_action_type.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/governance_action_type.c
@@ -0,0 +1,62 @@
+/**
+ * \file governance_action_type.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/proposal_procedures/governance_action_type.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_governance_action_type_to_string(const cardano_governance_action_type_t governance_action_type)
+{
+  const char* message;
+
+  switch (governance_action_type)
+  {
+    case CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE:
+      message = "Governance Action Type: Parameter Change";
+      break;
+    case CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION:
+      message = "Governance Action Type: Hard Fork Initiation";
+      break;
+    case CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS:
+      message = "Governance Action Type: Treasury Withdrawals";
+      break;
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE:
+      message = "Governance Action Type: No Confidence";
+      break;
+    case CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE:
+      message = "Governance Action Type: Update Committee";
+      break;
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION:
+      message = "Governance Action Type: New Constitution";
+      break;
+    case CARDANO_GOVERNANCE_ACTION_TYPE_INFO:
+      message = "Governance Action Type: Info";
+      break;
+    default:
+      message = "Governance Action Type: Unknown";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/proposal_procedures/hard_fork_initiation_action.c b/vendor/src/proposal_procedures/hard_fork_initiation_action.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/hard_fork_initiation_action.c
@@ -0,0 +1,488 @@
+/**
+ * \file hard_fork_initiation_action.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license");
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/governance_action_id.h>
+#include <cardano/common/protocol_version.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/governance_action_type.h>
+#include <cardano/proposal_procedures/hard_fork_initiation_action.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents the initiation action for a hard fork in the Cardano network.
+ */
+typedef struct cardano_hard_fork_initiation_action_t
+{
+    cardano_object_t                base;
+    cardano_protocol_version_t*     protocol_version;
+    cardano_governance_action_id_t* governance_action_id;
+} cardano_hard_fork_initiation_action_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a hard_fork_initiation_action object.
+ *
+ * This function is responsible for properly deallocating a hard_fork_initiation_action object (`cardano_hard_fork_initiation_action_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the hard_fork_initiation_action object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_hard_fork_initiation_action_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the hard_fork_initiation_action
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_hard_fork_initiation_action_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_hard_fork_initiation_action_t* data = (cardano_hard_fork_initiation_action_t*)object;
+
+  cardano_protocol_version_unref(&data->protocol_version);
+  cardano_governance_action_id_unref(&data->governance_action_id);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_hard_fork_initiation_action_new(
+  cardano_protocol_version_t*             protocol_version,
+  cardano_governance_action_id_t*         governance_action_id,
+  cardano_hard_fork_initiation_action_t** hard_fork_initiation_action)
+{
+  if (protocol_version == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hard_fork_initiation_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_hard_fork_initiation_action_t* data = _cardano_malloc(sizeof(cardano_hard_fork_initiation_action_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_hard_fork_initiation_action_deallocate;
+
+  cardano_protocol_version_ref(protocol_version);
+  data->protocol_version     = protocol_version;
+  data->governance_action_id = NULL;
+
+  if (governance_action_id != NULL)
+  {
+    cardano_governance_action_id_ref(governance_action_id);
+    data->governance_action_id = governance_action_id;
+  }
+
+  *hard_fork_initiation_action = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_hard_fork_initiation_action_from_cbor(cardano_cbor_reader_t* reader, cardano_hard_fork_initiation_action_t** hard_fork_initiation_action)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hard_fork_initiation_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "hard_fork_initiation_action";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION,
+    (enum_to_string_callback_t)((void*)&cardano_governance_action_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_protocol_version_t*     protocol_version     = NULL;
+  cardano_governance_action_id_t* governance_action_id = NULL;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_NULL;
+
+  cardano_error_t read_map_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_map_result != CARDANO_SUCCESS)
+  {
+    cardano_protocol_version_unref(&protocol_version);
+    return read_map_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+
+    if (read_null != CARDANO_SUCCESS)
+    {
+      cardano_protocol_version_unref(&protocol_version);
+      return read_null;
+    }
+  }
+  else
+  {
+    cardano_error_t governance_action_id_result = cardano_governance_action_id_from_cbor(reader, &governance_action_id);
+
+    if (governance_action_id_result != CARDANO_SUCCESS)
+    {
+      cardano_protocol_version_unref(&protocol_version);
+      return governance_action_id_result;
+    }
+  }
+
+  cardano_error_t protocol_version_result = cardano_protocol_version_from_cbor(reader, &protocol_version);
+
+  if (protocol_version_result != CARDANO_SUCCESS)
+  {
+    return protocol_version_result;
+  }
+
+  cardano_error_t new_result = cardano_hard_fork_initiation_action_new(protocol_version, governance_action_id, hard_fork_initiation_action);
+
+  cardano_protocol_version_unref(&protocol_version);
+  cardano_governance_action_id_unref(&governance_action_id);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_hard_fork_initiation_action_to_cbor(
+  const cardano_hard_fork_initiation_action_t* hard_fork_initiation_action,
+  cardano_cbor_writer_t*                       writer)
+{
+  if (hard_fork_initiation_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_enum_result = cardano_cbor_writer_write_uint(writer, CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION);
+
+  if (write_enum_result != CARDANO_SUCCESS)
+  {
+    return write_enum_result;
+  }
+
+  if (hard_fork_initiation_action->governance_action_id == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t governance_action_id_result = cardano_governance_action_id_to_cbor(hard_fork_initiation_action->governance_action_id, writer);
+
+    if (governance_action_id_result != CARDANO_SUCCESS)
+    {
+      return governance_action_id_result;
+    }
+  }
+
+  cardano_error_t protocol_version_result = cardano_protocol_version_to_cbor(hard_fork_initiation_action->protocol_version, writer);
+
+  if (protocol_version_result != CARDANO_SUCCESS)
+  {
+    return protocol_version_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_hard_fork_initiation_action_to_cip116_json(
+  const cardano_hard_fork_initiation_action_t* action,
+  cardano_json_writer_t*                       writer)
+{
+  if ((action == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "hard_fork_initiation_action", 27);
+
+  if (action->governance_action_id != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "gov_action_id", 13);
+    error = cardano_governance_action_id_to_cip116_json(action->governance_action_id, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_property_name(writer, "protocol_version", 16);
+
+  error = cardano_protocol_version_to_cip116_json(action->protocol_version, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_hard_fork_initiation_action_set_protocol_version(
+  cardano_hard_fork_initiation_action_t* hard_fork_initiation_action,
+  cardano_protocol_version_t*            protocol_version)
+{
+  if (hard_fork_initiation_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_version == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_protocol_version_ref(protocol_version);
+  cardano_protocol_version_unref(&hard_fork_initiation_action->protocol_version);
+  hard_fork_initiation_action->protocol_version = protocol_version;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_protocol_version_t*
+cardano_hard_fork_initiation_action_get_protocol_version(
+  cardano_hard_fork_initiation_action_t* hard_fork_initiation_action)
+{
+  if (hard_fork_initiation_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_protocol_version_ref(hard_fork_initiation_action->protocol_version);
+
+  return hard_fork_initiation_action->protocol_version;
+}
+
+cardano_error_t
+cardano_hard_fork_initiation_action_set_governance_action_id(
+  cardano_hard_fork_initiation_action_t* hard_fork_initiation_action,
+  cardano_governance_action_id_t*        governance_action_id)
+{
+  if (hard_fork_initiation_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_governance_action_id_ref(governance_action_id);
+  cardano_governance_action_id_unref(&hard_fork_initiation_action->governance_action_id);
+  hard_fork_initiation_action->governance_action_id = governance_action_id;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_governance_action_id_t*
+cardano_hard_fork_initiation_action_get_governance_action_id(
+  cardano_hard_fork_initiation_action_t* hard_fork_initiation_action)
+{
+  if (hard_fork_initiation_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_governance_action_id_ref(hard_fork_initiation_action->governance_action_id);
+
+  return hard_fork_initiation_action->governance_action_id;
+}
+
+void
+cardano_hard_fork_initiation_action_unref(cardano_hard_fork_initiation_action_t** hard_fork_initiation_action)
+{
+  if ((hard_fork_initiation_action == NULL) || (*hard_fork_initiation_action == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*hard_fork_initiation_action)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *hard_fork_initiation_action = NULL;
+    return;
+  }
+}
+
+void
+cardano_hard_fork_initiation_action_ref(cardano_hard_fork_initiation_action_t* hard_fork_initiation_action)
+{
+  if (hard_fork_initiation_action == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&hard_fork_initiation_action->base);
+}
+
+size_t
+cardano_hard_fork_initiation_action_refcount(const cardano_hard_fork_initiation_action_t* hard_fork_initiation_action)
+{
+  if (hard_fork_initiation_action == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&hard_fork_initiation_action->base);
+}
+
+void
+cardano_hard_fork_initiation_action_set_last_error(cardano_hard_fork_initiation_action_t* hard_fork_initiation_action, const char* message)
+{
+  cardano_object_set_last_error(&hard_fork_initiation_action->base, message);
+}
+
+const char*
+cardano_hard_fork_initiation_action_get_last_error(const cardano_hard_fork_initiation_action_t* hard_fork_initiation_action)
+{
+  return cardano_object_get_last_error(&hard_fork_initiation_action->base);
+}
+
+cardano_error_t
+cardano_hard_fork_initiation_action_deep_clone(const cardano_hard_fork_initiation_action_t* source, cardano_hard_fork_initiation_action_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_hard_fork_initiation_action_t* copy = _cardano_malloc(sizeof(cardano_hard_fork_initiation_action_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count       = 1U;
+  copy->base.deallocator     = source->base.deallocator;
+  copy->base.last_error[0]   = '\0';
+  copy->protocol_version     = NULL;
+  copy->governance_action_id = NULL;
+
+  if (source->protocol_version != NULL)
+  {
+    const cardano_error_t result = cardano_protocol_version_deep_clone(source->protocol_version, &copy->protocol_version);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->governance_action_id != NULL)
+  {
+    const cardano_error_t result = cardano_governance_action_id_deep_clone(source->governance_action_id, &copy->governance_action_id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/info_action.c b/vendor/src/proposal_procedures/info_action.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/info_action.c
@@ -0,0 +1,282 @@
+/**
+ * \file info_action.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license");
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/governance_action_type.h>
+#include <cardano/proposal_procedures/info_action.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 1;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents an action that has no direct effect on the blockchain,
+ * but serves as an on-chain record or informative notice.
+ */
+typedef struct cardano_info_action_t
+{
+    cardano_object_t base;
+} cardano_info_action_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a info_action object.
+ *
+ * This function is responsible for properly deallocating a info_action object (`cardano_info_action_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the info_action object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_info_action_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the info_action
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_info_action_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_info_action_t* data = (cardano_info_action_t*)object;
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_info_action_new(cardano_info_action_t** info_action)
+{
+  if (info_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_info_action_t* data = _cardano_malloc(sizeof(cardano_info_action_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_info_action_deallocate;
+
+  *info_action = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_info_action_from_cbor(cardano_cbor_reader_t* reader, cardano_info_action_t** info_action)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (info_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "info_action";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_GOVERNANCE_ACTION_TYPE_INFO,
+    (enum_to_string_callback_t)((void*)&cardano_governance_action_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_error_t end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (end_array_result != CARDANO_SUCCESS)
+  {
+    return end_array_result;
+  }
+
+  return cardano_info_action_new(info_action);
+}
+
+cardano_error_t
+cardano_info_action_to_cbor(
+  const cardano_info_action_t* info_action,
+  cardano_cbor_writer_t*       writer)
+{
+  if (info_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_enum_result = cardano_cbor_writer_write_uint(writer, CARDANO_GOVERNANCE_ACTION_TYPE_INFO);
+
+  if (write_enum_result != CARDANO_SUCCESS)
+  {
+    return write_enum_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_info_action_to_cip116_json(
+  const cardano_info_action_t* action,
+  cardano_json_writer_t*       writer)
+{
+  if ((action == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "info_action", 11);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_info_action_unref(cardano_info_action_t** info_action)
+{
+  if ((info_action == NULL) || (*info_action == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*info_action)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *info_action = NULL;
+    return;
+  }
+}
+
+void
+cardano_info_action_ref(cardano_info_action_t* info_action)
+{
+  if (info_action == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&info_action->base);
+}
+
+size_t
+cardano_info_action_refcount(const cardano_info_action_t* info_action)
+{
+  if (info_action == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&info_action->base);
+}
+
+void
+cardano_info_action_set_last_error(cardano_info_action_t* info_action, const char* message)
+{
+  cardano_object_set_last_error(&info_action->base, message);
+}
+
+const char*
+cardano_info_action_get_last_error(const cardano_info_action_t* info_action)
+{
+  return cardano_object_get_last_error(&info_action->base);
+}
+
+cardano_error_t
+cardano_info_action_deep_clone(const cardano_info_action_t* source, cardano_info_action_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_info_action_t* copy = _cardano_malloc(sizeof(cardano_info_action_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/new_constitution_action.c b/vendor/src/proposal_procedures/new_constitution_action.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/new_constitution_action.c
@@ -0,0 +1,488 @@
+/**
+ * \file new_constitution_action.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license");
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/governance_action_id.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/constitution.h>
+#include <cardano/proposal_procedures/governance_action_type.h>
+#include <cardano/proposal_procedures/new_constitution_action.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Changes or amendments the Constitution.
+ */
+typedef struct cardano_new_constitution_action_t
+{
+    cardano_object_t                base;
+    cardano_constitution_t*         constitution;
+    cardano_governance_action_id_t* governance_action_id;
+} cardano_new_constitution_action_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a new_constitution_action object.
+ *
+ * This function is responsible for properly deallocating a new_constitution_action object (`cardano_new_constitution_action_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the new_constitution_action object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_new_constitution_action_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the new_constitution_action
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_new_constitution_action_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_new_constitution_action_t* data = (cardano_new_constitution_action_t*)object;
+
+  cardano_constitution_unref(&data->constitution);
+  cardano_governance_action_id_unref(&data->governance_action_id);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_new_constitution_action_new(
+  cardano_constitution_t*             constitution,
+  cardano_governance_action_id_t*     governance_action_id,
+  cardano_new_constitution_action_t** new_constitution_action)
+{
+  if (constitution == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (new_constitution_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_new_constitution_action_t* data = _cardano_malloc(sizeof(cardano_new_constitution_action_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_new_constitution_action_deallocate;
+
+  cardano_constitution_ref(constitution);
+  data->constitution         = constitution;
+  data->governance_action_id = NULL;
+
+  if (governance_action_id != NULL)
+  {
+    cardano_governance_action_id_ref(governance_action_id);
+    data->governance_action_id = governance_action_id;
+  }
+
+  *new_constitution_action = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_new_constitution_action_from_cbor(cardano_cbor_reader_t* reader, cardano_new_constitution_action_t** new_constitution_action)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (new_constitution_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "new_constitution_action";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION,
+    (enum_to_string_callback_t)((void*)&cardano_governance_action_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_constitution_t*         constitution         = NULL;
+  cardano_governance_action_id_t* governance_action_id = NULL;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_NULL;
+
+  cardano_error_t read_map_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_map_result != CARDANO_SUCCESS)
+  {
+    cardano_constitution_unref(&constitution);
+    return read_map_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+
+    if (read_null != CARDANO_SUCCESS)
+    {
+      cardano_constitution_unref(&constitution);
+      return read_null;
+    }
+  }
+  else
+  {
+    cardano_error_t governance_action_id_result = cardano_governance_action_id_from_cbor(reader, &governance_action_id);
+
+    if (governance_action_id_result != CARDANO_SUCCESS)
+    {
+      cardano_constitution_unref(&constitution);
+      return governance_action_id_result;
+    }
+  }
+
+  cardano_error_t constitution_result = cardano_constitution_from_cbor(reader, &constitution);
+
+  if (constitution_result != CARDANO_SUCCESS)
+  {
+    return constitution_result;
+  }
+
+  cardano_error_t new_result = cardano_new_constitution_action_new(constitution, governance_action_id, new_constitution_action);
+
+  cardano_constitution_unref(&constitution);
+  cardano_governance_action_id_unref(&governance_action_id);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_new_constitution_action_to_cbor(
+  const cardano_new_constitution_action_t* new_constitution_action,
+  cardano_cbor_writer_t*                   writer)
+{
+  if (new_constitution_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_enum_result = cardano_cbor_writer_write_uint(writer, CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION);
+
+  if (write_enum_result != CARDANO_SUCCESS)
+  {
+    return write_enum_result;
+  }
+
+  if (new_constitution_action->governance_action_id == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t governance_action_id_result = cardano_governance_action_id_to_cbor(new_constitution_action->governance_action_id, writer);
+
+    if (governance_action_id_result != CARDANO_SUCCESS)
+    {
+      return governance_action_id_result;
+    }
+  }
+
+  cardano_error_t constitution_result = cardano_constitution_to_cbor(new_constitution_action->constitution, writer);
+
+  if (constitution_result != CARDANO_SUCCESS)
+  {
+    return constitution_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_new_constitution_action_to_cip116_json(
+  const cardano_new_constitution_action_t* action,
+  cardano_json_writer_t*                   writer)
+{
+  if ((action == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "new_constitution", 16);
+
+  if (action->governance_action_id != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "gov_action_id", 13);
+    error = cardano_governance_action_id_to_cip116_json(action->governance_action_id, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_property_name(writer, "constitution", 12);
+
+  error = cardano_constitution_to_cip116_json(action->constitution, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return error;
+}
+
+cardano_error_t
+cardano_new_constitution_action_set_constitution(
+  cardano_new_constitution_action_t* new_constitution_action,
+  cardano_constitution_t*            constitution)
+{
+  if (new_constitution_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (constitution == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_constitution_ref(constitution);
+  cardano_constitution_unref(&new_constitution_action->constitution);
+  new_constitution_action->constitution = constitution;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_constitution_t*
+cardano_new_constitution_action_get_constitution(
+  cardano_new_constitution_action_t* new_constitution_action)
+{
+  if (new_constitution_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_constitution_ref(new_constitution_action->constitution);
+
+  return new_constitution_action->constitution;
+}
+
+cardano_error_t
+cardano_new_constitution_action_set_governance_action_id(
+  cardano_new_constitution_action_t* new_constitution_action,
+  cardano_governance_action_id_t*    governance_action_id)
+{
+  if (new_constitution_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_governance_action_id_ref(governance_action_id);
+  cardano_governance_action_id_unref(&new_constitution_action->governance_action_id);
+  new_constitution_action->governance_action_id = governance_action_id;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_governance_action_id_t*
+cardano_new_constitution_action_get_governance_action_id(
+  cardano_new_constitution_action_t* new_constitution_action)
+{
+  if (new_constitution_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_governance_action_id_ref(new_constitution_action->governance_action_id);
+
+  return new_constitution_action->governance_action_id;
+}
+
+void
+cardano_new_constitution_action_unref(cardano_new_constitution_action_t** new_constitution_action)
+{
+  if ((new_constitution_action == NULL) || (*new_constitution_action == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*new_constitution_action)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *new_constitution_action = NULL;
+    return;
+  }
+}
+
+void
+cardano_new_constitution_action_ref(cardano_new_constitution_action_t* new_constitution_action)
+{
+  if (new_constitution_action == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&new_constitution_action->base);
+}
+
+size_t
+cardano_new_constitution_action_refcount(const cardano_new_constitution_action_t* new_constitution_action)
+{
+  if (new_constitution_action == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&new_constitution_action->base);
+}
+
+void
+cardano_new_constitution_action_set_last_error(cardano_new_constitution_action_t* new_constitution_action, const char* message)
+{
+  cardano_object_set_last_error(&new_constitution_action->base, message);
+}
+
+const char*
+cardano_new_constitution_action_get_last_error(const cardano_new_constitution_action_t* new_constitution_action)
+{
+  return cardano_object_get_last_error(&new_constitution_action->base);
+}
+
+cardano_error_t
+cardano_new_constitution_action_deep_clone(const cardano_new_constitution_action_t* source, cardano_new_constitution_action_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_new_constitution_action_t* copy = _cardano_malloc(sizeof(cardano_new_constitution_action_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count       = 1U;
+  copy->base.deallocator     = source->base.deallocator;
+  copy->base.last_error[0]   = '\0';
+  copy->constitution         = NULL;
+  copy->governance_action_id = NULL;
+
+  if (source->constitution != NULL)
+  {
+    const cardano_error_t result = cardano_constitution_deep_clone(source->constitution, &copy->constitution);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->governance_action_id != NULL)
+  {
+    const cardano_error_t result = cardano_governance_action_id_deep_clone(source->governance_action_id, &copy->governance_action_id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/no_confidence_action.c b/vendor/src/proposal_procedures/no_confidence_action.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/no_confidence_action.c
@@ -0,0 +1,400 @@
+/**
+ * \file no_confidence_action.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license");
+ * you may not use this file except in COMPLIANCE with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/governance_action_id.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/governance_action_type.h>
+#include <cardano/proposal_procedures/no_confidence_action.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Propose a state of no-confidence in the current constitutional committee.
+ * Allows Ada holders to challenge the authority granted to the existing committee.
+ */
+typedef struct cardano_no_confidence_action_t
+{
+    cardano_object_t                base;
+    cardano_governance_action_id_t* governance_action_id;
+} cardano_no_confidence_action_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a no_confidence_action object.
+ *
+ * This function is responsible for properly deallocating a no_confidence_action object (`cardano_no_confidence_action_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the no_confidence_action object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_no_confidence_action_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the no_confidence_action
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_no_confidence_action_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_no_confidence_action_t* data = (cardano_no_confidence_action_t*)object;
+
+  cardano_governance_action_id_unref(&data->governance_action_id);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_no_confidence_action_new(
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_no_confidence_action_t** no_confidence_action)
+{
+  if (no_confidence_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_no_confidence_action_t* data = _cardano_malloc(sizeof(cardano_no_confidence_action_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count       = 1;
+  data->base.last_error[0]   = '\0';
+  data->base.deallocator     = cardano_no_confidence_action_deallocate;
+  data->governance_action_id = NULL;
+
+  if (governance_action_id != NULL)
+  {
+    cardano_governance_action_id_ref(governance_action_id);
+    data->governance_action_id = governance_action_id;
+  }
+
+  *no_confidence_action = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_no_confidence_action_from_cbor(cardano_cbor_reader_t* reader, cardano_no_confidence_action_t** no_confidence_action)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (no_confidence_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "no_confidence_action";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE,
+    (enum_to_string_callback_t)((void*)&cardano_governance_action_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_governance_action_id_t* governance_action_id = NULL;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_NULL;
+
+  cardano_error_t read_map_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_map_result != CARDANO_SUCCESS)
+  {
+    return read_map_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+
+    if (read_null != CARDANO_SUCCESS)
+    {
+      return read_null;
+    }
+  }
+  else
+  {
+    cardano_error_t governance_action_id_result = cardano_governance_action_id_from_cbor(reader, &governance_action_id);
+
+    if (governance_action_id_result != CARDANO_SUCCESS)
+    {
+      return governance_action_id_result;
+    }
+  }
+
+  cardano_error_t new_result = cardano_no_confidence_action_new(governance_action_id, no_confidence_action);
+
+  cardano_governance_action_id_unref(&governance_action_id);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_no_confidence_action_to_cbor(
+  const cardano_no_confidence_action_t* no_confidence_action,
+  cardano_cbor_writer_t*                writer)
+{
+  if (no_confidence_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_enum_result = cardano_cbor_writer_write_uint(writer, CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE);
+
+  if (write_enum_result != CARDANO_SUCCESS)
+  {
+    return write_enum_result;
+  }
+
+  if (no_confidence_action->governance_action_id == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t governance_action_id_result = cardano_governance_action_id_to_cbor(no_confidence_action->governance_action_id, writer);
+
+    if (governance_action_id_result != CARDANO_SUCCESS)
+    {
+      return governance_action_id_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_no_confidence_action_to_cip116_json(
+  const cardano_no_confidence_action_t* action,
+  cardano_json_writer_t*                writer)
+{
+  if ((action == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "no_confidence", 13);
+
+  if (action->governance_action_id != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "gov_action_id", 13);
+    cardano_error_t error = cardano_governance_action_id_to_cip116_json(action->governance_action_id, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_no_confidence_action_set_governance_action_id(
+  cardano_no_confidence_action_t* no_confidence_action,
+  cardano_governance_action_id_t* governance_action_id)
+{
+  if (no_confidence_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_governance_action_id_ref(governance_action_id);
+  cardano_governance_action_id_unref(&no_confidence_action->governance_action_id);
+  no_confidence_action->governance_action_id = governance_action_id;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_governance_action_id_t*
+cardano_no_confidence_action_get_governance_action_id(
+  cardano_no_confidence_action_t* no_confidence_action)
+{
+  if (no_confidence_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_governance_action_id_ref(no_confidence_action->governance_action_id);
+
+  return no_confidence_action->governance_action_id;
+}
+
+void
+cardano_no_confidence_action_unref(cardano_no_confidence_action_t** no_confidence_action)
+{
+  if ((no_confidence_action == NULL) || (*no_confidence_action == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*no_confidence_action)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *no_confidence_action = NULL;
+    return;
+  }
+}
+
+void
+cardano_no_confidence_action_ref(cardano_no_confidence_action_t* no_confidence_action)
+{
+  if (no_confidence_action == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&no_confidence_action->base);
+}
+
+size_t
+cardano_no_confidence_action_refcount(const cardano_no_confidence_action_t* no_confidence_action)
+{
+  if (no_confidence_action == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&no_confidence_action->base);
+}
+
+void
+cardano_no_confidence_action_set_last_error(cardano_no_confidence_action_t* no_confidence_action, const char* message)
+{
+  cardano_object_set_last_error(&no_confidence_action->base, message);
+}
+
+const char*
+cardano_no_confidence_action_get_last_error(const cardano_no_confidence_action_t* no_confidence_action)
+{
+  return cardano_object_get_last_error(&no_confidence_action->base);
+}
+
+cardano_error_t
+cardano_no_confidence_action_deep_clone(const cardano_no_confidence_action_t* source, cardano_no_confidence_action_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_no_confidence_action_t* copy = _cardano_malloc(sizeof(cardano_no_confidence_action_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count       = 1U;
+  copy->base.deallocator     = source->base.deallocator;
+  copy->base.last_error[0]   = '\0';
+  copy->governance_action_id = NULL;
+
+  if (source->governance_action_id != NULL)
+  {
+    const cardano_error_t result = cardano_governance_action_id_deep_clone(source->governance_action_id, &copy->governance_action_id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/parameter_change_action.c b/vendor/src/proposal_procedures/parameter_change_action.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/parameter_change_action.c
@@ -0,0 +1,600 @@
+/**
+ * \file parameter_change_action.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license");
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/governance_action_id.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/protocol_params/protocol_param_update.h>
+
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/governance_action_type.h>
+#include <cardano/proposal_procedures/parameter_change_action.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 4;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Updates one or more updatable protocol parameters, excluding changes to major protocol versions (i.e., "hard forks").
+ */
+typedef struct cardano_parameter_change_action_t
+{
+    cardano_object_t                 base;
+    cardano_protocol_param_update_t* protocol_param_update;
+    cardano_blake2b_hash_t*          policy_hash;
+    cardano_governance_action_id_t*  governance_action_id;
+} cardano_parameter_change_action_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a parameter_change_action object.
+ *
+ * This function is responsible for properly deallocating a parameter_change_action object (`cardano_parameter_change_action_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the parameter_change_action object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_parameter_change_action_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the parameter_change_action
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_parameter_change_action_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_parameter_change_action_t* data = (cardano_parameter_change_action_t*)object;
+
+  cardano_protocol_param_update_unref(&data->protocol_param_update);
+  cardano_blake2b_hash_unref(&data->policy_hash);
+  cardano_governance_action_id_unref(&data->governance_action_id);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_parameter_change_action_new(
+  cardano_protocol_param_update_t*    protocol_param_update,
+  cardano_governance_action_id_t*     governance_action_id,
+  cardano_blake2b_hash_t*             policy_hash,
+  cardano_parameter_change_action_t** parameter_change_action)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (parameter_change_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_parameter_change_action_t* data = _cardano_malloc(sizeof(cardano_parameter_change_action_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count        = 1;
+  data->base.last_error[0]    = '\0';
+  data->base.deallocator      = cardano_parameter_change_action_deallocate;
+  data->governance_action_id  = NULL;
+  data->protocol_param_update = NULL;
+  data->policy_hash           = NULL;
+
+  cardano_protocol_param_update_ref(protocol_param_update);
+  data->protocol_param_update = protocol_param_update;
+
+  if (policy_hash != NULL)
+  {
+    cardano_blake2b_hash_ref(policy_hash);
+    data->policy_hash = policy_hash;
+  }
+
+  if (governance_action_id != NULL)
+  {
+    cardano_governance_action_id_ref(governance_action_id);
+    data->governance_action_id = governance_action_id;
+  }
+
+  *parameter_change_action = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_parameter_change_action_from_cbor(cardano_cbor_reader_t* reader, cardano_parameter_change_action_t** parameter_change_action)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (parameter_change_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "parameter_change_action";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE,
+    (enum_to_string_callback_t)((void*)&cardano_governance_action_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_governance_action_id_t*  governance_action_id  = NULL;
+  cardano_protocol_param_update_t* protocol_param_update = NULL;
+  cardano_blake2b_hash_t*          policy_hash           = NULL;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_NULL;
+
+  cardano_error_t read_map_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_map_result != CARDANO_SUCCESS)
+  {
+    return read_map_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+
+    if (read_null != CARDANO_SUCCESS)
+    {
+      return read_null;
+    }
+  }
+  else
+  {
+    cardano_error_t governance_action_id_result = cardano_governance_action_id_from_cbor(reader, &governance_action_id);
+
+    if (governance_action_id_result != CARDANO_SUCCESS)
+    {
+      return governance_action_id_result;
+    }
+  }
+
+  cardano_error_t protocol_param_update_result = cardano_protocol_param_update_from_cbor(reader, &protocol_param_update);
+
+  if (protocol_param_update_result != CARDANO_SUCCESS)
+  {
+    cardano_governance_action_id_unref(&governance_action_id);
+    return protocol_param_update_result;
+  }
+
+  read_map_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_map_result != CARDANO_SUCCESS)
+  {
+    cardano_governance_action_id_unref(&governance_action_id);
+    cardano_protocol_param_update_unref(&protocol_param_update);
+
+    return read_map_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+
+    if (read_null != CARDANO_SUCCESS)
+    {
+      cardano_governance_action_id_unref(&governance_action_id);
+      cardano_protocol_param_update_unref(&protocol_param_update);
+
+      return read_null;
+    }
+  }
+  else
+  {
+    cardano_error_t policy_hash_result = cardano_blake2b_hash_from_cbor(reader, &policy_hash);
+
+    if (policy_hash_result != CARDANO_SUCCESS)
+    {
+      cardano_governance_action_id_unref(&governance_action_id);
+      cardano_protocol_param_update_unref(&protocol_param_update);
+      return policy_hash_result;
+    }
+  }
+
+  cardano_error_t new_result = cardano_parameter_change_action_new(protocol_param_update, governance_action_id, policy_hash, parameter_change_action);
+
+  cardano_governance_action_id_unref(&governance_action_id);
+  cardano_protocol_param_update_unref(&protocol_param_update);
+  cardano_blake2b_hash_unref(&policy_hash);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_parameter_change_action_to_cbor(
+  const cardano_parameter_change_action_t* parameter_change_action,
+  cardano_cbor_writer_t*                   writer)
+{
+  if (parameter_change_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_enum_result = cardano_cbor_writer_write_uint(writer, CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE);
+
+  if (write_enum_result != CARDANO_SUCCESS)
+  {
+    return write_enum_result;
+  }
+
+  if (parameter_change_action->governance_action_id == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t governance_action_id_result = cardano_governance_action_id_to_cbor(parameter_change_action->governance_action_id, writer);
+
+    if (governance_action_id_result != CARDANO_SUCCESS)
+    {
+      return governance_action_id_result;
+    }
+  }
+
+  cardano_error_t protocol_param_update_result = cardano_protocol_param_update_to_cbor(parameter_change_action->protocol_param_update, writer);
+
+  if (protocol_param_update_result != CARDANO_SUCCESS)
+  {
+    return protocol_param_update_result;
+  }
+
+  if (parameter_change_action->policy_hash == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t policy_hash_result = cardano_blake2b_hash_to_cbor(parameter_change_action->policy_hash, writer);
+
+    if (policy_hash_result != CARDANO_SUCCESS)
+    {
+      return policy_hash_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_parameter_change_action_to_cip116_json(
+  const cardano_parameter_change_action_t* action,
+  cardano_json_writer_t*                   writer)
+{
+  if ((action == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "parameter_change_action", 23);
+
+  if (action->governance_action_id != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "gov_action_id", 13);
+    error = cardano_governance_action_id_to_cip116_json(action->governance_action_id, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_property_name(writer, "protocol_param_update", 21);
+
+  error = cardano_protocol_param_update_to_cip116_json(action->protocol_param_update, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (action->policy_hash != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "policy_hash", 11);
+
+    error = cardano_blake2b_hash_to_cip116_json(action->policy_hash, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return error;
+}
+
+cardano_error_t
+cardano_parameter_change_action_set_protocol_param_update(
+  cardano_parameter_change_action_t* parameter_change_action,
+  cardano_protocol_param_update_t*   protocol_param_update)
+{
+  if (parameter_change_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_protocol_param_update_ref(protocol_param_update);
+  cardano_protocol_param_update_unref(&parameter_change_action->protocol_param_update);
+  parameter_change_action->protocol_param_update = protocol_param_update;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_protocol_param_update_t*
+cardano_parameter_change_action_get_protocol_param_update(cardano_parameter_change_action_t* parameter_change_action)
+{
+  if (parameter_change_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_protocol_param_update_ref(parameter_change_action->protocol_param_update);
+
+  return parameter_change_action->protocol_param_update;
+}
+
+cardano_error_t
+cardano_parameter_change_action_set_policy_hash(cardano_parameter_change_action_t* parameter_change_action, cardano_blake2b_hash_t* policy_hash)
+{
+  if (parameter_change_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(policy_hash);
+  cardano_blake2b_hash_unref(&parameter_change_action->policy_hash);
+  parameter_change_action->policy_hash = policy_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_parameter_change_action_get_policy_hash(cardano_parameter_change_action_t* parameter_change_action)
+{
+  if (parameter_change_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(parameter_change_action->policy_hash);
+
+  return parameter_change_action->policy_hash;
+}
+
+cardano_error_t
+cardano_parameter_change_action_set_governance_action_id(
+  cardano_parameter_change_action_t* parameter_change_action,
+  cardano_governance_action_id_t*    governance_action_id)
+{
+  if (parameter_change_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_governance_action_id_ref(governance_action_id);
+  cardano_governance_action_id_unref(&parameter_change_action->governance_action_id);
+  parameter_change_action->governance_action_id = governance_action_id;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_governance_action_id_t*
+cardano_parameter_change_action_get_governance_action_id(
+  cardano_parameter_change_action_t* parameter_change_action)
+{
+  if (parameter_change_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_governance_action_id_ref(parameter_change_action->governance_action_id);
+
+  return parameter_change_action->governance_action_id;
+}
+
+void
+cardano_parameter_change_action_unref(cardano_parameter_change_action_t** parameter_change_action)
+{
+  if ((parameter_change_action == NULL) || (*parameter_change_action == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*parameter_change_action)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *parameter_change_action = NULL;
+    return;
+  }
+}
+
+void
+cardano_parameter_change_action_ref(cardano_parameter_change_action_t* parameter_change_action)
+{
+  if (parameter_change_action == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&parameter_change_action->base);
+}
+
+size_t
+cardano_parameter_change_action_refcount(const cardano_parameter_change_action_t* parameter_change_action)
+{
+  if (parameter_change_action == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&parameter_change_action->base);
+}
+
+void
+cardano_parameter_change_action_set_last_error(cardano_parameter_change_action_t* parameter_change_action, const char* message)
+{
+  cardano_object_set_last_error(&parameter_change_action->base, message);
+}
+
+const char*
+cardano_parameter_change_action_get_last_error(const cardano_parameter_change_action_t* parameter_change_action)
+{
+  return cardano_object_get_last_error(&parameter_change_action->base);
+}
+
+cardano_error_t
+cardano_parameter_change_action_deep_clone(const cardano_parameter_change_action_t* source, cardano_parameter_change_action_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_parameter_change_action_t* copy = _cardano_malloc(sizeof(cardano_parameter_change_action_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count        = 1U;
+  copy->base.deallocator      = source->base.deallocator;
+  copy->base.last_error[0]    = '\0';
+  copy->protocol_param_update = NULL;
+  copy->policy_hash           = NULL;
+  copy->governance_action_id  = NULL;
+
+  if (source->protocol_param_update != NULL)
+  {
+    const cardano_error_t result = cardano_protocol_param_update_deep_clone(source->protocol_param_update, &copy->protocol_param_update);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->policy_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->policy_hash, &copy->policy_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->governance_action_id != NULL)
+  {
+    const cardano_error_t result = cardano_governance_action_id_deep_clone(source->governance_action_id, &copy->governance_action_id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/proposal_procedure.c b/vendor/src/proposal_procedures/proposal_procedure.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/proposal_procedure.c
@@ -0,0 +1,1550 @@
+/**
+ * \file proposal_procedure.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * Copyright 2024 Biglup labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include <cardano/address/reward_address.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/anchor.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/governance_action_type.h>
+#include <cardano/proposal_procedures/hard_fork_initiation_action.h>
+#include <cardano/proposal_procedures/info_action.h>
+#include <cardano/proposal_procedures/new_constitution_action.h>
+#include <cardano/proposal_procedures/no_confidence_action.h>
+#include <cardano/proposal_procedures/parameter_change_action.h>
+#include <cardano/proposal_procedures/proposal_procedure.h>
+#include <cardano/proposal_procedures/treasury_withdrawals_action.h>
+
+#include <assert.h>
+#include <src/string_safe.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 4;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Governance proposal procedure for the Cardano blockchain, it supports various types of governance actions.
+ */
+typedef struct cardano_proposal_procedure_t
+{
+    cardano_object_t                       base;
+    cardano_hard_fork_initiation_action_t* hard_fork_initiation_action;
+    cardano_info_action_t*                 info_action;
+    cardano_new_constitution_action_t*     new_constitution_action;
+    cardano_no_confidence_action_t*        no_confidence_action;
+    cardano_parameter_change_action_t*     parameter_change_action;
+    cardano_treasury_withdrawals_action_t* treasury_withdrawals_action;
+    cardano_update_committee_action_t*     update_committee_action;
+    cardano_governance_action_type_t       action_type;
+    cardano_reward_address_t*              reward_address;
+    uint64_t                               deposit;
+    cardano_anchor_t*                      anchor;
+} cardano_proposal_procedure_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a proposal_procedure object.
+ *
+ * This function is responsible for properly deallocating a proposal_procedure object (`cardano_proposal_procedure_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the proposal_procedure object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_proposal_procedure_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the proposal_procedure
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_proposal_procedure_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_proposal_procedure_t* data = (cardano_proposal_procedure_t*)object;
+
+  cardano_anchor_unref(&data->anchor);
+  cardano_hard_fork_initiation_action_unref(&data->hard_fork_initiation_action);
+  cardano_info_action_unref(&data->info_action);
+  cardano_new_constitution_action_unref(&data->new_constitution_action);
+  cardano_no_confidence_action_unref(&data->no_confidence_action);
+  cardano_parameter_change_action_unref(&data->parameter_change_action);
+  cardano_treasury_withdrawals_action_unref(&data->treasury_withdrawals_action);
+  cardano_update_committee_action_unref(&data->update_committee_action);
+  cardano_reward_address_unref(&data->reward_address);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new proposal_procedure object.
+ *
+ * @return A pointer to the newly created proposal_procedure object, or NULL if the allocation failed.
+ */
+static cardano_proposal_procedure_t*
+new_proposal_procedure(void)
+{
+  cardano_proposal_procedure_t* data = _cardano_malloc(sizeof(cardano_proposal_procedure_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_proposal_procedure_deallocate;
+
+  data->hard_fork_initiation_action = NULL;
+  data->info_action                 = NULL;
+  data->new_constitution_action     = NULL;
+  data->no_confidence_action        = NULL;
+  data->parameter_change_action     = NULL;
+  data->treasury_withdrawals_action = NULL;
+  data->update_committee_action     = NULL;
+  data->action_type                 = CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE;
+  data->reward_address              = NULL;
+  data->anchor                      = NULL;
+
+  return data;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_proposal_procedure_new_parameter_change_action(
+  const uint64_t                     deposit,
+  cardano_reward_address_t*          reward_address,
+  cardano_anchor_t*                  anchor,
+  cardano_parameter_change_action_t* parameter_change_action,
+  cardano_proposal_procedure_t**     proposal)
+{
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (parameter_change_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposal_procedure_t* data = new_proposal_procedure();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_reward_address_ref(reward_address);
+  data->reward_address = reward_address;
+
+  cardano_anchor_ref(anchor);
+  data->anchor = anchor;
+
+  cardano_parameter_change_action_ref(parameter_change_action);
+  data->parameter_change_action = parameter_change_action;
+
+  data->action_type = CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE;
+  data->deposit     = deposit;
+
+  *proposal = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_new_hard_fork_initiation_action(
+  const uint64_t                         deposit,
+  cardano_reward_address_t*              reward_address,
+  cardano_anchor_t*                      anchor,
+  cardano_hard_fork_initiation_action_t* hard_fork_initiation_action,
+  cardano_proposal_procedure_t**         proposal)
+{
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hard_fork_initiation_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposal_procedure_t* data = new_proposal_procedure();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_reward_address_ref(reward_address);
+  data->reward_address = reward_address;
+
+  cardano_anchor_ref(anchor);
+  data->anchor = anchor;
+
+  cardano_hard_fork_initiation_action_ref(hard_fork_initiation_action);
+  data->hard_fork_initiation_action = hard_fork_initiation_action;
+
+  data->action_type = CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION;
+  data->deposit     = deposit;
+
+  *proposal = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_new_treasury_withdrawals_action(
+  const uint64_t                         deposit,
+  cardano_reward_address_t*              reward_address,
+  cardano_anchor_t*                      anchor,
+  cardano_treasury_withdrawals_action_t* treasury_withdrawals_action,
+  cardano_proposal_procedure_t**         proposal)
+{
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (treasury_withdrawals_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposal_procedure_t* data = new_proposal_procedure();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_reward_address_ref(reward_address);
+  data->reward_address = reward_address;
+
+  cardano_anchor_ref(anchor);
+  data->anchor = anchor;
+
+  cardano_treasury_withdrawals_action_ref(treasury_withdrawals_action);
+  data->treasury_withdrawals_action = treasury_withdrawals_action;
+
+  data->action_type = CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS;
+  data->deposit     = deposit;
+
+  *proposal = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_new_no_confidence_action(
+  const uint64_t                  deposit,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_no_confidence_action_t* no_confidence_action,
+  cardano_proposal_procedure_t**  proposal)
+{
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (no_confidence_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposal_procedure_t* data = new_proposal_procedure();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_reward_address_ref(reward_address);
+  data->reward_address = reward_address;
+
+  cardano_anchor_ref(anchor);
+  data->anchor = anchor;
+
+  cardano_no_confidence_action_ref(no_confidence_action);
+  data->no_confidence_action = no_confidence_action;
+
+  data->action_type = CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE;
+  data->deposit     = deposit;
+
+  *proposal = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_new_update_committee_action(
+  const uint64_t                     deposit,
+  cardano_reward_address_t*          reward_address,
+  cardano_anchor_t*                  anchor,
+  cardano_update_committee_action_t* update_committee_action,
+  cardano_proposal_procedure_t**     proposal)
+{
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (update_committee_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposal_procedure_t* data = new_proposal_procedure();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_reward_address_ref(reward_address);
+  data->reward_address = reward_address;
+
+  cardano_anchor_ref(anchor);
+  data->anchor = anchor;
+
+  cardano_update_committee_action_ref(update_committee_action);
+  data->update_committee_action = update_committee_action;
+
+  data->action_type = CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE;
+  data->deposit     = deposit;
+
+  *proposal = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_new_constitution_action(
+  const uint64_t                     deposit,
+  cardano_reward_address_t*          reward_address,
+  cardano_anchor_t*                  anchor,
+  cardano_new_constitution_action_t* new_constitution_action,
+  cardano_proposal_procedure_t**     proposal)
+{
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (new_constitution_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposal_procedure_t* data = new_proposal_procedure();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_reward_address_ref(reward_address);
+  data->reward_address = reward_address;
+
+  cardano_anchor_ref(anchor);
+  data->anchor = anchor;
+
+  cardano_new_constitution_action_ref(new_constitution_action);
+  data->new_constitution_action = new_constitution_action;
+
+  data->action_type = CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION;
+  data->deposit     = deposit;
+
+  *proposal = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_new_info_action(
+  const uint64_t                 deposit,
+  cardano_reward_address_t*      reward_address,
+  cardano_anchor_t*              anchor,
+  cardano_info_action_t*         info_action,
+  cardano_proposal_procedure_t** proposal)
+{
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (info_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposal_procedure_t* data = new_proposal_procedure();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_reward_address_ref(reward_address);
+  data->reward_address = reward_address;
+
+  cardano_anchor_ref(anchor);
+  data->anchor = anchor;
+
+  cardano_info_action_ref(info_action);
+  data->info_action = info_action;
+
+  data->action_type = CARDANO_GOVERNANCE_ACTION_TYPE_INFO;
+  data->deposit     = deposit;
+
+  *proposal = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_from_cbor(cardano_cbor_reader_t* reader, cardano_proposal_procedure_t** proposal_procedure)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal_procedure == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "proposal_procedure";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t deposit = 0;
+
+  cardano_error_t read_deposit_result = cardano_cbor_reader_read_uint(reader, &deposit);
+
+  if (read_deposit_result != CARDANO_SUCCESS)
+  {
+    return read_deposit_result;
+  }
+
+  cardano_buffer_t*         reward_address_bytes = NULL;
+  cardano_reward_address_t* reward_address       = NULL;
+  cardano_anchor_t*         anchor               = NULL;
+
+  cardano_error_t read_reward_address_result = cardano_cbor_reader_read_bytestring(reader, &reward_address_bytes);
+
+  if (read_reward_address_result != CARDANO_SUCCESS)
+  {
+    return read_reward_address_result;
+  }
+
+  cardano_error_t reward_address_result = cardano_reward_address_from_bytes(cardano_buffer_get_data(reward_address_bytes), cardano_buffer_get_size(reward_address_bytes), &reward_address);
+
+  cardano_buffer_unref(&reward_address_bytes);
+
+  if (reward_address_result != CARDANO_SUCCESS)
+  {
+    return reward_address_result;
+  }
+
+  cardano_buffer_t* encoded_action = NULL;
+
+  cardano_error_t read_action_result = cardano_cbor_reader_read_encoded_value(reader, &encoded_action);
+
+  if (read_action_result != CARDANO_SUCCESS)
+  {
+    cardano_reward_address_unref(&reward_address);
+    return read_action_result;
+  }
+
+  cardano_error_t read_anchor_result = cardano_anchor_from_cbor(reader, &anchor);
+
+  if (read_anchor_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&encoded_action);
+    cardano_reward_address_unref(&reward_address);
+    return read_anchor_result;
+  }
+
+  cardano_cbor_reader_t* action_reader        = cardano_cbor_reader_new(cardano_buffer_get_data(encoded_action), cardano_buffer_get_size(encoded_action));
+  cardano_cbor_reader_t* action_reader_cloned = cardano_cbor_reader_new(cardano_buffer_get_data(encoded_action), cardano_buffer_get_size(encoded_action));
+
+  cardano_buffer_unref(&encoded_action);
+
+  if ((action_reader == NULL) || (action_reader_cloned == NULL))
+  {
+    cardano_reward_address_unref(&reward_address);
+    cardano_anchor_unref(&anchor);
+    cardano_cbor_reader_unref(&action_reader);
+    cardano_cbor_reader_unref(&action_reader_cloned);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  int64_t         array_size  = 0;
+  cardano_error_t peek_result = cardano_cbor_reader_read_start_array(action_reader_cloned, &array_size);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    cardano_reward_address_unref(&reward_address);
+    cardano_anchor_unref(&anchor);
+    cardano_cbor_reader_unref(&action_reader);
+    cardano_cbor_reader_unref(&action_reader_cloned);
+
+    return peek_result;
+  }
+
+  uint64_t type = 0;
+
+  cardano_error_t read_type_result = cardano_cbor_reader_read_uint(action_reader_cloned, &type);
+  cardano_cbor_reader_unref(&action_reader_cloned);
+
+  if (read_type_result != CARDANO_SUCCESS)
+  {
+    cardano_reward_address_unref(&reward_address);
+    cardano_anchor_unref(&anchor);
+    cardano_cbor_reader_unref(&action_reader);
+
+    return read_type_result;
+  }
+
+  cardano_error_t final_result = CARDANO_SUCCESS;
+
+  switch (type)
+  {
+    case CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE:
+    {
+      cardano_parameter_change_action_t* parameter_change_action = NULL;
+
+      cardano_error_t read_parameter_change_action_result = cardano_parameter_change_action_from_cbor(action_reader, &parameter_change_action);
+
+      if (read_parameter_change_action_result != CARDANO_SUCCESS)
+      {
+        cardano_reward_address_unref(&reward_address);
+        cardano_anchor_unref(&anchor);
+        cardano_cbor_reader_unref(&action_reader);
+
+        return read_parameter_change_action_result;
+      }
+
+      cardano_error_t new_instance_result = cardano_proposal_procedure_new_parameter_change_action(deposit, reward_address, anchor, parameter_change_action, proposal_procedure);
+
+      cardano_parameter_change_action_unref(&parameter_change_action);
+      cardano_reward_address_unref(&reward_address);
+      cardano_anchor_unref(&anchor);
+      cardano_cbor_reader_unref(&action_reader);
+
+      final_result = new_instance_result;
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION:
+    {
+      cardano_hard_fork_initiation_action_t* hard_fork_initiation_action = NULL;
+
+      cardano_error_t read_hard_fork_initiation_action_result = cardano_hard_fork_initiation_action_from_cbor(action_reader, &hard_fork_initiation_action);
+
+      if (read_hard_fork_initiation_action_result != CARDANO_SUCCESS)
+      {
+        cardano_reward_address_unref(&reward_address);
+        cardano_anchor_unref(&anchor);
+        cardano_cbor_reader_unref(&action_reader);
+
+        return read_hard_fork_initiation_action_result;
+      }
+
+      cardano_error_t new_instance_result = cardano_proposal_procedure_new_hard_fork_initiation_action(deposit, reward_address, anchor, hard_fork_initiation_action, proposal_procedure);
+
+      cardano_hard_fork_initiation_action_unref(&hard_fork_initiation_action);
+      cardano_reward_address_unref(&reward_address);
+      cardano_anchor_unref(&anchor);
+      cardano_cbor_reader_unref(&action_reader);
+
+      final_result = new_instance_result;
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS:
+    {
+      cardano_treasury_withdrawals_action_t* treasury_withdrawals_action = NULL;
+
+      cardano_error_t read_treasury_withdrawals_action_result = cardano_treasury_withdrawals_action_from_cbor(action_reader, &treasury_withdrawals_action);
+
+      if (read_treasury_withdrawals_action_result != CARDANO_SUCCESS)
+      {
+        cardano_reward_address_unref(&reward_address);
+        cardano_anchor_unref(&anchor);
+        cardano_cbor_reader_unref(&action_reader);
+
+        return read_treasury_withdrawals_action_result;
+      }
+
+      cardano_error_t new_instance_result = cardano_proposal_procedure_new_treasury_withdrawals_action(deposit, reward_address, anchor, treasury_withdrawals_action, proposal_procedure);
+
+      cardano_treasury_withdrawals_action_unref(&treasury_withdrawals_action);
+      cardano_reward_address_unref(&reward_address);
+      cardano_anchor_unref(&anchor);
+      cardano_cbor_reader_unref(&action_reader);
+
+      final_result = new_instance_result;
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE:
+    {
+      cardano_no_confidence_action_t* no_confidence_action = NULL;
+
+      cardano_error_t read_no_confidence_action_result = cardano_no_confidence_action_from_cbor(action_reader, &no_confidence_action);
+
+      if (read_no_confidence_action_result != CARDANO_SUCCESS)
+      {
+        cardano_reward_address_unref(&reward_address);
+        cardano_anchor_unref(&anchor);
+        cardano_cbor_reader_unref(&action_reader);
+
+        return read_no_confidence_action_result;
+      }
+
+      cardano_error_t new_instance_result = cardano_proposal_procedure_new_no_confidence_action(deposit, reward_address, anchor, no_confidence_action, proposal_procedure);
+
+      cardano_no_confidence_action_unref(&no_confidence_action);
+      cardano_reward_address_unref(&reward_address);
+      cardano_anchor_unref(&anchor);
+      cardano_cbor_reader_unref(&action_reader);
+
+      final_result = new_instance_result;
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE:
+    {
+      cardano_update_committee_action_t* update_committee_action = NULL;
+
+      cardano_error_t read_update_committee_action_result = cardano_update_committee_action_from_cbor(action_reader, &update_committee_action);
+
+      if (read_update_committee_action_result != CARDANO_SUCCESS)
+      {
+        cardano_reward_address_unref(&reward_address);
+        cardano_anchor_unref(&anchor);
+        cardano_cbor_reader_unref(&action_reader);
+
+        return read_update_committee_action_result;
+      }
+
+      cardano_error_t new_instance_result = cardano_proposal_procedure_new_update_committee_action(deposit, reward_address, anchor, update_committee_action, proposal_procedure);
+
+      cardano_update_committee_action_unref(&update_committee_action);
+      cardano_reward_address_unref(&reward_address);
+      cardano_anchor_unref(&anchor);
+      cardano_cbor_reader_unref(&action_reader);
+
+      final_result = new_instance_result;
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION:
+    {
+      cardano_new_constitution_action_t* new_constitution_action = NULL;
+
+      cardano_error_t read_new_constitution_action_result = cardano_new_constitution_action_from_cbor(action_reader, &new_constitution_action);
+
+      if (read_new_constitution_action_result != CARDANO_SUCCESS)
+      {
+        cardano_reward_address_unref(&reward_address);
+        cardano_anchor_unref(&anchor);
+        cardano_cbor_reader_unref(&action_reader);
+
+        return read_new_constitution_action_result;
+      }
+
+      cardano_error_t new_instance_result = cardano_proposal_procedure_new_constitution_action(deposit, reward_address, anchor, new_constitution_action, proposal_procedure);
+
+      cardano_new_constitution_action_unref(&new_constitution_action);
+      cardano_reward_address_unref(&reward_address);
+      cardano_anchor_unref(&anchor);
+      cardano_cbor_reader_unref(&action_reader);
+
+      final_result = new_instance_result;
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_INFO:
+    {
+      cardano_info_action_t* info_action = NULL;
+
+      cardano_error_t read_info_action_result = cardano_info_action_from_cbor(action_reader, &info_action);
+
+      if (read_info_action_result != CARDANO_SUCCESS)
+      {
+        cardano_reward_address_unref(&reward_address);
+        cardano_anchor_unref(&anchor);
+        cardano_cbor_reader_unref(&action_reader);
+
+        return read_info_action_result;
+      }
+
+      cardano_error_t new_instance_result = cardano_proposal_procedure_new_info_action(deposit, reward_address, anchor, info_action, proposal_procedure);
+
+      cardano_info_action_unref(&info_action);
+      cardano_reward_address_unref(&reward_address);
+      cardano_anchor_unref(&anchor);
+      cardano_cbor_reader_unref(&action_reader);
+
+      final_result = new_instance_result;
+      break;
+    }
+
+    default:
+    {
+      cardano_reward_address_unref(&reward_address);
+      cardano_anchor_unref(&anchor);
+      cardano_cbor_reader_unref(&action_reader);
+
+      return CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE;
+    }
+  }
+
+  if (final_result != CARDANO_SUCCESS)
+  {
+    return final_result;
+  }
+
+  return cardano_cbor_reader_read_end_array(reader);
+}
+
+cardano_error_t
+cardano_proposal_procedure_to_cbor(
+  const cardano_proposal_procedure_t* proposal_procedure,
+  cardano_cbor_writer_t*              writer)
+{
+  if (proposal_procedure == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_deposit_result = cardano_cbor_writer_write_uint(writer, proposal_procedure->deposit);
+
+  if (write_deposit_result != CARDANO_SUCCESS)
+  {
+    return write_deposit_result;
+  }
+
+  cardano_error_t write_reward_address_result = cardano_cbor_writer_write_bytestring(writer, cardano_reward_address_get_bytes(proposal_procedure->reward_address), cardano_reward_address_get_bytes_size(proposal_procedure->reward_address));
+
+  if (write_reward_address_result != CARDANO_SUCCESS)
+  {
+    return write_reward_address_result;
+  }
+
+  switch (proposal_procedure->action_type)
+  {
+    case CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE:
+    {
+      cardano_error_t write_action_result = cardano_parameter_change_action_to_cbor(proposal_procedure->parameter_change_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION:
+    {
+      cardano_error_t write_action_result = cardano_hard_fork_initiation_action_to_cbor(proposal_procedure->hard_fork_initiation_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS:
+    {
+      cardano_error_t write_action_result = cardano_treasury_withdrawals_action_to_cbor(proposal_procedure->treasury_withdrawals_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE:
+    {
+      cardano_error_t write_action_result = cardano_no_confidence_action_to_cbor(proposal_procedure->no_confidence_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE:
+    {
+      cardano_error_t write_action_result = cardano_update_committee_action_to_cbor(proposal_procedure->update_committee_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION:
+    {
+      cardano_error_t write_action_result = cardano_new_constitution_action_to_cbor(proposal_procedure->new_constitution_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_INFO:
+    {
+      cardano_error_t write_action_result = cardano_info_action_to_cbor(proposal_procedure->info_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+
+    default:
+    {
+      return CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE;
+    }
+  }
+
+  cardano_error_t write_anchor_result = cardano_anchor_to_cbor(proposal_procedure->anchor, writer);
+
+  if (write_anchor_result != CARDANO_SUCCESS)
+  {
+    return write_anchor_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_to_cip116_json(
+  const cardano_proposal_procedure_t* procedure,
+  cardano_json_writer_t*              writer)
+{
+  if ((procedure == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_property_name(writer, "deposit", 7);
+  cardano_json_writer_write_uint_as_string(writer, procedure->deposit);
+
+  const char*  address           = cardano_reward_address_get_string(procedure->reward_address);
+  const size_t addr_len          = cardano_reward_address_get_bech32_size(procedure->reward_address);
+  const size_t size_with_no_null = cardano_safe_strlen(address, addr_len);
+
+  cardano_json_writer_write_property_name(writer, "reward_account", 14);
+  cardano_json_writer_write_string(writer, address, size_with_no_null);
+
+  cardano_json_writer_write_property_name(writer, "gov_action", 10);
+
+  switch (procedure->action_type)
+  {
+    case CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE:
+    {
+      cardano_error_t write_action_result = cardano_parameter_change_action_to_cip116_json(procedure->parameter_change_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION:
+    {
+      cardano_error_t write_action_result = cardano_hard_fork_initiation_action_to_cip116_json(procedure->hard_fork_initiation_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS:
+    {
+      cardano_error_t write_action_result = cardano_treasury_withdrawals_action_to_cip116_json(procedure->treasury_withdrawals_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE:
+    {
+      cardano_error_t write_action_result = cardano_no_confidence_action_to_cip116_json(procedure->no_confidence_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE:
+    {
+      cardano_error_t write_action_result = cardano_update_committee_action_to_cip116_json(procedure->update_committee_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION:
+    {
+      cardano_error_t write_action_result = cardano_new_constitution_action_to_cip116_json(procedure->new_constitution_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_INFO:
+    {
+      cardano_error_t write_action_result = cardano_info_action_to_cip116_json(procedure->info_action, writer);
+
+      if (write_action_result != CARDANO_SUCCESS)
+      {
+        return write_action_result;
+      }
+
+      break;
+    }
+    default:
+    {
+      return CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE;
+    }
+  }
+
+  cardano_json_writer_write_property_name(writer, "anchor", 6);
+  error = cardano_anchor_to_cip116_json(procedure->anchor, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return error;
+}
+
+cardano_error_t
+cardano_proposal_procedure_get_action_type(
+  const cardano_proposal_procedure_t* certificate,
+  cardano_governance_action_type_t*   type)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = certificate->action_type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_to_parameter_change_action(
+  cardano_proposal_procedure_t*       proposal,
+  cardano_parameter_change_action_t** parameter_change_action)
+{
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (parameter_change_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal->action_type != CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE)
+  {
+    return CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE;
+  }
+
+  cardano_parameter_change_action_ref(proposal->parameter_change_action);
+  *parameter_change_action = proposal->parameter_change_action;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_to_hard_fork_initiation_action(
+  cardano_proposal_procedure_t*           proposal,
+  cardano_hard_fork_initiation_action_t** hard_fork_initiation_action)
+{
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hard_fork_initiation_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal->action_type != CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION)
+  {
+    return CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE;
+  }
+
+  cardano_hard_fork_initiation_action_ref(proposal->hard_fork_initiation_action);
+  *hard_fork_initiation_action = proposal->hard_fork_initiation_action;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_to_treasury_withdrawals_action(
+  cardano_proposal_procedure_t*           proposal,
+  cardano_treasury_withdrawals_action_t** treasury_withdrawals_action)
+{
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (treasury_withdrawals_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal->action_type != CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS)
+  {
+    return CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE;
+  }
+
+  cardano_treasury_withdrawals_action_ref(proposal->treasury_withdrawals_action);
+  *treasury_withdrawals_action = proposal->treasury_withdrawals_action;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_to_no_confidence_action(
+  cardano_proposal_procedure_t*    proposal,
+  cardano_no_confidence_action_t** no_confidence_action)
+{
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (no_confidence_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal->action_type != CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE)
+  {
+    return CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE;
+  }
+
+  cardano_no_confidence_action_ref(proposal->no_confidence_action);
+  *no_confidence_action = proposal->no_confidence_action;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_to_update_committee_action(
+  cardano_proposal_procedure_t*       proposal,
+  cardano_update_committee_action_t** update_committee_action)
+{
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (update_committee_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal->action_type != CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE)
+  {
+    return CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE;
+  }
+
+  cardano_update_committee_action_ref(proposal->update_committee_action);
+  *update_committee_action = proposal->update_committee_action;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_to_constitution_action(
+  cardano_proposal_procedure_t*       proposal,
+  cardano_new_constitution_action_t** constitution_action)
+{
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (constitution_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal->action_type != CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION)
+  {
+    return CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE;
+  }
+
+  cardano_new_constitution_action_ref(proposal->new_constitution_action);
+  *constitution_action = proposal->new_constitution_action;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_to_info_action(
+  cardano_proposal_procedure_t* proposal,
+  cardano_info_action_t**       info_action)
+{
+  if (proposal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (info_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal->action_type != CARDANO_GOVERNANCE_ACTION_TYPE_INFO)
+  {
+    return CARDANO_ERROR_INVALID_PROCEDURE_PROPOSAL_TYPE;
+  }
+
+  cardano_info_action_ref(proposal->info_action);
+  *info_action = proposal->info_action;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_set_anchor(cardano_proposal_procedure_t* proposal_procedure, cardano_anchor_t* anchor)
+{
+  if (proposal_procedure == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_ref(anchor);
+  cardano_anchor_unref(&proposal_procedure->anchor);
+  proposal_procedure->anchor = anchor;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_anchor_t*
+cardano_proposal_procedure_get_anchor(cardano_proposal_procedure_t* proposal_procedure)
+{
+  if (proposal_procedure == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_anchor_ref(proposal_procedure->anchor);
+  return proposal_procedure->anchor;
+}
+
+cardano_error_t
+cardano_proposal_procedure_set_reward_address(cardano_proposal_procedure_t* proposal_procedure, cardano_reward_address_t* reward_address)
+{
+  if (proposal_procedure == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_ref(reward_address);
+  cardano_reward_address_unref(&proposal_procedure->reward_address);
+  proposal_procedure->reward_address = reward_address;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_reward_address_t*
+cardano_proposal_procedure_get_reward_address(cardano_proposal_procedure_t* proposal_procedure)
+{
+  if (proposal_procedure == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_reward_address_ref(proposal_procedure->reward_address);
+  return proposal_procedure->reward_address;
+}
+
+uint64_t
+cardano_proposal_procedure_get_deposit(const cardano_proposal_procedure_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return 0;
+  }
+
+  return certificate->deposit;
+}
+
+cardano_error_t
+cardano_proposal_procedure_set_deposit(cardano_proposal_procedure_t* certificate, const uint64_t deposit)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  certificate->deposit = deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_proposal_procedure_unref(cardano_proposal_procedure_t** proposal_procedure)
+{
+  if ((proposal_procedure == NULL) || (*proposal_procedure == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*proposal_procedure)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *proposal_procedure = NULL;
+    return;
+  }
+}
+
+void
+cardano_proposal_procedure_ref(cardano_proposal_procedure_t* proposal_procedure)
+{
+  if (proposal_procedure == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&proposal_procedure->base);
+}
+
+size_t
+cardano_proposal_procedure_refcount(const cardano_proposal_procedure_t* proposal_procedure)
+{
+  if (proposal_procedure == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&proposal_procedure->base);
+}
+
+void
+cardano_proposal_procedure_set_last_error(cardano_proposal_procedure_t* proposal_procedure, const char* message)
+{
+  cardano_object_set_last_error(&proposal_procedure->base, message);
+}
+
+const char*
+cardano_proposal_procedure_get_last_error(const cardano_proposal_procedure_t* proposal_procedure)
+{
+  return cardano_object_get_last_error(&proposal_procedure->base);
+}
+
+cardano_error_t
+cardano_proposal_procedure_deep_clone(const cardano_proposal_procedure_t* source, cardano_proposal_procedure_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposal_procedure_t* copy = _cardano_malloc(sizeof(cardano_proposal_procedure_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count              = 1U;
+  copy->base.deallocator            = source->base.deallocator;
+  copy->base.last_error[0]          = '\0';
+  copy->hard_fork_initiation_action = NULL;
+  copy->info_action                 = NULL;
+  copy->new_constitution_action     = NULL;
+  copy->no_confidence_action        = NULL;
+  copy->parameter_change_action     = NULL;
+  copy->treasury_withdrawals_action = NULL;
+  copy->update_committee_action     = NULL;
+  copy->action_type                 = source->action_type;
+  copy->reward_address              = NULL;
+  copy->deposit                     = source->deposit;
+  copy->anchor                      = NULL;
+
+  if (source->hard_fork_initiation_action != NULL)
+  {
+    const cardano_error_t result = cardano_hard_fork_initiation_action_deep_clone(source->hard_fork_initiation_action, &copy->hard_fork_initiation_action);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->info_action != NULL)
+  {
+    const cardano_error_t result = cardano_info_action_deep_clone(source->info_action, &copy->info_action);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->new_constitution_action != NULL)
+  {
+    const cardano_error_t result = cardano_new_constitution_action_deep_clone(source->new_constitution_action, &copy->new_constitution_action);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->no_confidence_action != NULL)
+  {
+    const cardano_error_t result = cardano_no_confidence_action_deep_clone(source->no_confidence_action, &copy->no_confidence_action);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->parameter_change_action != NULL)
+  {
+    const cardano_error_t result = cardano_parameter_change_action_deep_clone(source->parameter_change_action, &copy->parameter_change_action);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->treasury_withdrawals_action != NULL)
+  {
+    const cardano_error_t result = cardano_treasury_withdrawals_action_deep_clone(source->treasury_withdrawals_action, &copy->treasury_withdrawals_action);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->update_committee_action != NULL)
+  {
+    const cardano_error_t result = cardano_update_committee_action_deep_clone(source->update_committee_action, &copy->update_committee_action);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->reward_address != NULL)
+  {
+    const cardano_error_t result = cardano_reward_address_deep_clone(source->reward_address, &copy->reward_address);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->anchor != NULL)
+  {
+    const cardano_error_t result = cardano_anchor_deep_clone(source->anchor, &copy->anchor);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/proposal_procedure_set.c b/vendor/src/proposal_procedures/proposal_procedure_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/proposal_procedure_set.c
@@ -0,0 +1,474 @@
+/**
+ * \file proposal_procedure_set.c
+ *
+ * \author angel.castillo
+ * \date   Sept 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/proposal_procedure.h>
+#include <cardano/proposal_procedures/proposal_procedure_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano proposal procedure set.
+ */
+typedef struct cardano_proposal_procedure_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_proposal_procedure_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a proposal procedure set object.
+ *
+ * This function is responsible for properly deallocating a proposal procedure set object (`cardano_proposal_procedure_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the proposal procedure_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_proposal_procedure_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the proposal procedure set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_proposal_procedure_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_proposal_procedure_set_t* list = (cardano_proposal_procedure_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_proposal_procedure_set_new(cardano_proposal_procedure_set_t** proposal_procedure_set)
+{
+  if (proposal_procedure_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposal_procedure_set_t* list = _cardano_malloc(sizeof(cardano_proposal_procedure_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_proposal_procedure_set_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *proposal_procedure_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_set_from_cbor(cardano_cbor_reader_t* reader, cardano_proposal_procedure_set_t** proposal_procedure_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal_procedure_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposal_procedure_set_t* list   = NULL;
+  cardano_error_t                   result = cardano_proposal_procedure_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_proposal_procedure_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("proposal_procedure_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_proposal_procedure_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_proposal_procedure_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_proposal_procedure_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_proposal_procedure_t* element = NULL;
+
+    result = cardano_proposal_procedure_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_proposal_procedure_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_proposal_procedure_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_proposal_procedure_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("proposal_procedure_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_proposal_procedure_set_unref(&list);
+    return result;
+  }
+
+  *proposal_procedure_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_set_to_cbor(const cardano_proposal_procedure_set_t* proposal_procedure_set, cardano_cbor_writer_t* writer)
+{
+  if (proposal_procedure_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(proposal_procedure_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  size_t array_size = cardano_array_get_size(proposal_procedure_set->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(proposal_procedure_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(proposal_procedure_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in proposal_procedure_set is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_proposal_procedure_to_cbor((cardano_proposal_procedure_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_proposal_procedure_set_to_cip116_json(
+  const cardano_proposal_procedure_set_t* procedures,
+  cardano_json_writer_t*                  writer)
+{
+  if ((procedures == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t          length = cardano_proposal_procedure_set_get_length(procedures);
+  cardano_error_t error  = CARDANO_SUCCESS;
+
+  for (size_t i = 0; i < length; ++i)
+  {
+    cardano_proposal_procedure_t* procedure = NULL;
+    error                                   = cardano_proposal_procedure_set_get(procedures, i, &procedure);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_proposal_procedure_to_cip116_json(procedure, writer);
+    cardano_proposal_procedure_unref(&procedure);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return error;
+}
+
+size_t
+cardano_proposal_procedure_set_get_length(const cardano_proposal_procedure_set_t* proposal_procedure_set)
+{
+  if (proposal_procedure_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(proposal_procedure_set->array);
+}
+
+cardano_error_t
+cardano_proposal_procedure_set_get(
+  const cardano_proposal_procedure_set_t* proposal_procedure_set,
+  size_t                                  index,
+  cardano_proposal_procedure_t**          element)
+{
+  if (proposal_procedure_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(proposal_procedure_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_proposal_procedure_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposal_procedure_set_add(cardano_proposal_procedure_set_t* proposal_procedure_set, cardano_proposal_procedure_t* element)
+{
+  if (proposal_procedure_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(proposal_procedure_set->array);
+  const size_t new_size      = cardano_array_push(proposal_procedure_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_proposal_procedure_set_unref(cardano_proposal_procedure_set_t** proposal_procedure_set)
+{
+  if ((proposal_procedure_set == NULL) || (*proposal_procedure_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*proposal_procedure_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *proposal_procedure_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_proposal_procedure_set_ref(cardano_proposal_procedure_set_t* proposal_procedure_set)
+{
+  if (proposal_procedure_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&proposal_procedure_set->base);
+}
+
+size_t
+cardano_proposal_procedure_set_refcount(const cardano_proposal_procedure_set_t* proposal_procedure_set)
+{
+  if (proposal_procedure_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&proposal_procedure_set->base);
+}
+
+void
+cardano_proposal_procedure_set_set_last_error(cardano_proposal_procedure_set_t* proposal_procedure_set, const char* message)
+{
+  cardano_object_set_last_error(&proposal_procedure_set->base, message);
+}
+
+const char*
+cardano_proposal_procedure_set_get_last_error(const cardano_proposal_procedure_set_t* proposal_procedure_set)
+{
+  return cardano_object_get_last_error(&proposal_procedure_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_proposal_procedure_t* copy   = NULL;
+  const cardano_error_t         result = cardano_proposal_procedure_deep_clone((const cardano_proposal_procedure_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_proposal_procedure_set_deep_clone(const cardano_proposal_procedure_set_t* source, cardano_proposal_procedure_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposal_procedure_set_t* copy = _cardano_malloc(sizeof(cardano_proposal_procedure_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/treasury_withdrawals_action.c b/vendor/src/proposal_procedures/treasury_withdrawals_action.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/treasury_withdrawals_action.c
@@ -0,0 +1,490 @@
+/**
+ * \file treasury_withdrawals_action.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license");
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/crypto/blake2b_hash.h>
+
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/governance_action_type.h>
+#include <cardano/proposal_procedures/treasury_withdrawals_action.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 3;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Withdraws funds from the treasury.
+ */
+typedef struct cardano_treasury_withdrawals_action_t
+{
+    cardano_object_t          base;
+    cardano_withdrawal_map_t* withdrawals;
+    cardano_blake2b_hash_t*   policy_hash;
+} cardano_treasury_withdrawals_action_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a treasury_withdrawals_action object.
+ *
+ * This function is responsible for properly deallocating a treasury_withdrawals_action object (`cardano_treasury_withdrawals_action_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the treasury_withdrawals_action object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_treasury_withdrawals_action_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the treasury_withdrawals_action
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_treasury_withdrawals_action_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_treasury_withdrawals_action_t* data = (cardano_treasury_withdrawals_action_t*)object;
+
+  cardano_withdrawal_map_unref(&data->withdrawals);
+  cardano_blake2b_hash_unref(&data->policy_hash);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_treasury_withdrawals_action_new(
+  cardano_withdrawal_map_t*               withdrawals,
+  cardano_blake2b_hash_t*                 policy_hash,
+  cardano_treasury_withdrawals_action_t** treasury_withdrawals_action)
+{
+  if (withdrawals == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (treasury_withdrawals_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_treasury_withdrawals_action_t* data = _cardano_malloc(sizeof(cardano_treasury_withdrawals_action_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_treasury_withdrawals_action_deallocate;
+  data->withdrawals        = NULL;
+  data->policy_hash        = NULL;
+
+  cardano_withdrawal_map_ref(withdrawals);
+  data->withdrawals = withdrawals;
+
+  if (policy_hash != NULL)
+  {
+    cardano_blake2b_hash_ref(policy_hash);
+    data->policy_hash = policy_hash;
+  }
+
+  *treasury_withdrawals_action = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_treasury_withdrawals_action_from_cbor(cardano_cbor_reader_t* reader, cardano_treasury_withdrawals_action_t** treasury_withdrawals_action)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (treasury_withdrawals_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "treasury_withdrawals_action";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS,
+    (enum_to_string_callback_t)((void*)&cardano_governance_action_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_withdrawal_map_t* withdrawals = NULL;
+  cardano_blake2b_hash_t*   policy_hash = NULL;
+
+  cardano_error_t withdrawals_result = cardano_withdrawal_map_from_cbor(reader, &withdrawals);
+
+  if (withdrawals_result != CARDANO_SUCCESS)
+  {
+    cardano_withdrawal_map_unref(&withdrawals);
+    return withdrawals_result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_NULL;
+
+  cardano_error_t read_map_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_map_result != CARDANO_SUCCESS)
+  {
+    cardano_withdrawal_map_unref(&withdrawals);
+    return read_map_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+
+    if (read_null != CARDANO_SUCCESS)
+    {
+      cardano_withdrawal_map_unref(&withdrawals);
+      return read_null;
+    }
+  }
+  else
+  {
+    cardano_error_t policy_hash_result = cardano_blake2b_hash_from_cbor(reader, &policy_hash);
+
+    if (policy_hash_result != CARDANO_SUCCESS)
+    {
+      cardano_withdrawal_map_unref(&withdrawals);
+      return policy_hash_result;
+    }
+  }
+
+  cardano_error_t new_result = cardano_treasury_withdrawals_action_new(withdrawals, policy_hash, treasury_withdrawals_action);
+
+  cardano_withdrawal_map_unref(&withdrawals);
+  cardano_blake2b_hash_unref(&policy_hash);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_treasury_withdrawals_action_to_cbor(
+  const cardano_treasury_withdrawals_action_t* treasury_withdrawals_action,
+  cardano_cbor_writer_t*                       writer)
+{
+  if (treasury_withdrawals_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_enum_result = cardano_cbor_writer_write_uint(writer, CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS);
+
+  if (write_enum_result != CARDANO_SUCCESS)
+  {
+    return write_enum_result;
+  }
+
+  cardano_error_t withdrawals_result = cardano_withdrawal_map_to_cbor(treasury_withdrawals_action->withdrawals, writer);
+
+  if (withdrawals_result != CARDANO_SUCCESS)
+  {
+    return withdrawals_result;
+  }
+
+  if (treasury_withdrawals_action->policy_hash == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t policy_hash_result = cardano_blake2b_hash_to_cbor(treasury_withdrawals_action->policy_hash, writer);
+
+    if (policy_hash_result != CARDANO_SUCCESS)
+    {
+      return policy_hash_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_treasury_withdrawals_action_to_cip116_json(
+  const cardano_treasury_withdrawals_action_t* action,
+  cardano_json_writer_t*                       writer)
+{
+  if ((action == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "treasury_withdrawals_action", 27);
+
+  cardano_json_writer_write_property_name(writer, "rewards", 7);
+
+  cardano_error_t error = cardano_withdrawal_map_to_cip116_json(action->withdrawals, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (action->policy_hash != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "policy_hash", 11);
+    error = cardano_blake2b_hash_to_cip116_json(action->policy_hash, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return error;
+}
+
+cardano_error_t
+cardano_treasury_withdrawals_action_set_withdrawals(
+  cardano_treasury_withdrawals_action_t* treasury_withdrawals_action,
+  cardano_withdrawal_map_t*              withdrawals)
+{
+  if (treasury_withdrawals_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (withdrawals == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_withdrawal_map_ref(withdrawals);
+  cardano_withdrawal_map_unref(&treasury_withdrawals_action->withdrawals);
+  treasury_withdrawals_action->withdrawals = withdrawals;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_withdrawal_map_t*
+cardano_treasury_withdrawals_action_get_withdrawals(
+  cardano_treasury_withdrawals_action_t* treasury_withdrawals_action)
+{
+  if (treasury_withdrawals_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_withdrawal_map_ref(treasury_withdrawals_action->withdrawals);
+
+  return treasury_withdrawals_action->withdrawals;
+}
+
+cardano_error_t
+cardano_treasury_withdrawals_action_set_policy_hash(
+  cardano_treasury_withdrawals_action_t* treasury_withdrawals_action,
+  cardano_blake2b_hash_t*                policy_hash)
+{
+  if (treasury_withdrawals_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(policy_hash);
+  cardano_blake2b_hash_unref(&treasury_withdrawals_action->policy_hash);
+  treasury_withdrawals_action->policy_hash = policy_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_treasury_withdrawals_action_get_policy_hash(
+  cardano_treasury_withdrawals_action_t* treasury_withdrawals_action)
+{
+  if (treasury_withdrawals_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(treasury_withdrawals_action->policy_hash);
+
+  return treasury_withdrawals_action->policy_hash;
+}
+
+void
+cardano_treasury_withdrawals_action_unref(cardano_treasury_withdrawals_action_t** treasury_withdrawals_action)
+{
+  if ((treasury_withdrawals_action == NULL) || (*treasury_withdrawals_action == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*treasury_withdrawals_action)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *treasury_withdrawals_action = NULL;
+    return;
+  }
+}
+
+void
+cardano_treasury_withdrawals_action_ref(cardano_treasury_withdrawals_action_t* treasury_withdrawals_action)
+{
+  if (treasury_withdrawals_action == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&treasury_withdrawals_action->base);
+}
+
+size_t
+cardano_treasury_withdrawals_action_refcount(const cardano_treasury_withdrawals_action_t* treasury_withdrawals_action)
+{
+  if (treasury_withdrawals_action == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&treasury_withdrawals_action->base);
+}
+
+void
+cardano_treasury_withdrawals_action_set_last_error(cardano_treasury_withdrawals_action_t* treasury_withdrawals_action, const char* message)
+{
+  cardano_object_set_last_error(&treasury_withdrawals_action->base, message);
+}
+
+const char*
+cardano_treasury_withdrawals_action_get_last_error(const cardano_treasury_withdrawals_action_t* treasury_withdrawals_action)
+{
+  return cardano_object_get_last_error(&treasury_withdrawals_action->base);
+}
+
+cardano_error_t
+cardano_treasury_withdrawals_action_deep_clone(const cardano_treasury_withdrawals_action_t* source, cardano_treasury_withdrawals_action_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_treasury_withdrawals_action_t* copy = _cardano_malloc(sizeof(cardano_treasury_withdrawals_action_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->withdrawals        = NULL;
+  copy->policy_hash        = NULL;
+
+  if (source->withdrawals != NULL)
+  {
+    const cardano_error_t result = cardano_withdrawal_map_deep_clone(source->withdrawals, &copy->withdrawals);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->policy_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->policy_hash, &copy->policy_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/proposal_procedures/update_committee_action.c b/vendor/src/proposal_procedures/update_committee_action.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/proposal_procedures/update_committee_action.c
@@ -0,0 +1,669 @@
+/**
+ * \file update_committee_action.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * copyright 2024 biglup labs
+ *
+ * licensed under the apache license, version 2.0 (the "license");
+ * you may not use this file except in compliance with the license.
+ * you may obtain a copy of the license at
+ *
+ *     www.apache.org/licenses/license-2.0
+ *
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the license is distributed on an "as is" basis,
+ * without warranties or conditions of any kind, either express or implied.
+ * see the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/governance_action_id.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/committee_members_map.h>
+#include <cardano/proposal_procedures/credential_set.h>
+#include <cardano/proposal_procedures/governance_action_type.h>
+#include <cardano/proposal_procedures/update_committee_action.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 5;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Modifies the composition of the constitutional committee, its signature threshold, or its terms of operation.
+ */
+typedef struct cardano_update_committee_action_t
+{
+    cardano_object_t                 base;
+    cardano_credential_set_t*        members_to_be_removed;
+    cardano_committee_members_map_t* members_to_be_added;
+    cardano_unit_interval_t*         new_quorum;
+    cardano_governance_action_id_t*  governance_action_id;
+} cardano_update_committee_action_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a update_committee_action object.
+ *
+ * This function is responsible for properly deallocating a update_committee_action object (`cardano_update_committee_action_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the update_committee_action object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_update_committee_action_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the update_committee_action
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_update_committee_action_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_update_committee_action_t* data = (cardano_update_committee_action_t*)object;
+
+  cardano_governance_action_id_unref(&data->governance_action_id);
+  cardano_credential_set_unref(&data->members_to_be_removed);
+  cardano_committee_members_map_unref(&data->members_to_be_added);
+  cardano_unit_interval_unref(&data->new_quorum);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_update_committee_action_new(
+  cardano_credential_set_t*           members_to_be_removed,
+  cardano_committee_members_map_t*    members_to_be_added,
+  cardano_unit_interval_t*            new_quorum,
+  cardano_governance_action_id_t*     governance_action_id,
+  cardano_update_committee_action_t** update_committee_action)
+{
+  if (members_to_be_removed == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (members_to_be_added == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (new_quorum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (update_committee_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_update_committee_action_t* data = _cardano_malloc(sizeof(cardano_update_committee_action_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count        = 1;
+  data->base.last_error[0]    = '\0';
+  data->base.deallocator      = cardano_update_committee_action_deallocate;
+  data->governance_action_id  = NULL;
+  data->members_to_be_removed = NULL;
+  data->members_to_be_added   = NULL;
+  data->new_quorum            = NULL;
+
+  cardano_credential_set_ref(members_to_be_removed);
+  data->members_to_be_removed = members_to_be_removed;
+
+  cardano_committee_members_map_ref(members_to_be_added);
+  data->members_to_be_added = members_to_be_added;
+
+  cardano_unit_interval_ref(new_quorum);
+  data->new_quorum = new_quorum;
+
+  data->governance_action_id = NULL;
+
+  if (governance_action_id != NULL)
+  {
+    cardano_governance_action_id_ref(governance_action_id);
+    data->governance_action_id = governance_action_id;
+  }
+
+  *update_committee_action = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_update_committee_action_from_cbor(cardano_cbor_reader_t* reader, cardano_update_committee_action_t** update_committee_action)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (update_committee_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "update_committee_action";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE,
+    (enum_to_string_callback_t)((void*)&cardano_governance_action_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_set_t*        members_to_be_removed = NULL;
+  cardano_committee_members_map_t* members_to_be_added   = NULL;
+  cardano_unit_interval_t*         new_quorum            = NULL;
+  cardano_governance_action_id_t*  governance_action_id  = NULL;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_NULL;
+
+  cardano_error_t read_map_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_map_result != CARDANO_SUCCESS)
+  {
+    return read_map_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+
+    if (read_null != CARDANO_SUCCESS)
+    {
+      return read_null;
+    }
+  }
+  else
+  {
+    cardano_error_t governance_action_id_result = cardano_governance_action_id_from_cbor(reader, &governance_action_id);
+
+    if (governance_action_id_result != CARDANO_SUCCESS)
+    {
+      return governance_action_id_result;
+    }
+  }
+
+  cardano_error_t members_to_be_removed_result = cardano_credential_set_from_cbor(reader, &members_to_be_removed);
+
+  if (members_to_be_removed_result != CARDANO_SUCCESS)
+  {
+    cardano_governance_action_id_unref(&governance_action_id);
+    return members_to_be_removed_result;
+  }
+
+  cardano_error_t members_to_be_added_result = cardano_committee_members_map_from_cbor(reader, &members_to_be_added);
+
+  if (members_to_be_added_result != CARDANO_SUCCESS)
+  {
+    cardano_governance_action_id_unref(&governance_action_id);
+    cardano_credential_set_unref(&members_to_be_removed);
+    return members_to_be_added_result;
+  }
+
+  cardano_error_t new_quorum_result = cardano_unit_interval_from_cbor(reader, &new_quorum);
+
+  if (new_quorum_result != CARDANO_SUCCESS)
+  {
+    cardano_governance_action_id_unref(&governance_action_id);
+    cardano_credential_set_unref(&members_to_be_removed);
+    cardano_committee_members_map_unref(&members_to_be_added);
+    return new_quorum_result;
+  }
+
+  cardano_error_t new_result = cardano_update_committee_action_new(
+    members_to_be_removed,
+    members_to_be_added,
+    new_quorum,
+    governance_action_id,
+    update_committee_action);
+
+  cardano_governance_action_id_unref(&governance_action_id);
+  cardano_credential_set_unref(&members_to_be_removed);
+  cardano_committee_members_map_unref(&members_to_be_added);
+  cardano_unit_interval_unref(&new_quorum);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_update_committee_action_to_cbor(
+  const cardano_update_committee_action_t* update_committee_action,
+  cardano_cbor_writer_t*                   writer)
+{
+  if (update_committee_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_enum_result = cardano_cbor_writer_write_uint(writer, CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE);
+
+  if (write_enum_result != CARDANO_SUCCESS)
+  {
+    return write_enum_result;
+  }
+
+  if (update_committee_action->governance_action_id == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t governance_action_id_result = cardano_governance_action_id_to_cbor(update_committee_action->governance_action_id, writer);
+
+    if (governance_action_id_result != CARDANO_SUCCESS)
+    {
+      return governance_action_id_result;
+    }
+  }
+
+  cardano_error_t members_to_be_removed_result = cardano_credential_set_to_cbor(update_committee_action->members_to_be_removed, writer);
+
+  if (members_to_be_removed_result != CARDANO_SUCCESS)
+  {
+    return members_to_be_removed_result;
+  }
+
+  cardano_error_t members_to_be_added_result = cardano_committee_members_map_to_cbor(update_committee_action->members_to_be_added, writer);
+
+  if (members_to_be_added_result != CARDANO_SUCCESS)
+  {
+    return members_to_be_added_result;
+  }
+
+  cardano_error_t new_quorum_result = cardano_unit_interval_to_cbor(update_committee_action->new_quorum, writer);
+
+  if (new_quorum_result != CARDANO_SUCCESS)
+  {
+    return new_quorum_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_update_committee_action_to_cip116_json(
+  const cardano_update_committee_action_t* action,
+  cardano_json_writer_t*                   writer)
+{
+  if ((action == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "update_committee", 16);
+
+  if (action->governance_action_id != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "gov_action_id", 13);
+    error = cardano_governance_action_id_to_cip116_json(action->governance_action_id, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_property_name(writer, "members_to_remove", 17);
+
+  error = cardano_credential_set_to_cip116_json(action->members_to_be_removed, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "committee", 9);
+  error = cardano_committee_members_map_to_cip116_json(action->members_to_be_added, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "signature_threshold", 19);
+
+  error = cardano_unit_interval_to_cip116_json(action->new_quorum, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return error;
+}
+
+cardano_error_t
+cardano_update_committee_action_set_members_to_be_removed(
+  cardano_update_committee_action_t* update_committee_action,
+  cardano_credential_set_t*          members_to_be_removed)
+{
+  if (update_committee_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (members_to_be_removed == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_set_ref(members_to_be_removed);
+  cardano_credential_set_unref(&update_committee_action->members_to_be_removed);
+  update_committee_action->members_to_be_removed = members_to_be_removed;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_set_t*
+cardano_update_committee_action_get_members_to_be_removed(
+  cardano_update_committee_action_t* update_committee_action)
+{
+  if (update_committee_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_set_ref(update_committee_action->members_to_be_removed);
+
+  return update_committee_action->members_to_be_removed;
+}
+
+cardano_error_t
+cardano_update_committee_action_set_members_to_be_added(
+  cardano_update_committee_action_t* update_committee_action,
+  cardano_committee_members_map_t*   members_to_be_added)
+{
+  if (update_committee_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (members_to_be_added == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_committee_members_map_ref(members_to_be_added);
+  cardano_committee_members_map_unref(&update_committee_action->members_to_be_added);
+  update_committee_action->members_to_be_added = members_to_be_added;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_committee_members_map_t*
+cardano_update_committee_action_get_members_to_be_added(
+  cardano_update_committee_action_t* update_committee_action)
+{
+  if (update_committee_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_committee_members_map_ref(update_committee_action->members_to_be_added);
+
+  return update_committee_action->members_to_be_added;
+}
+
+cardano_error_t
+cardano_update_committee_action_set_quorum(
+  cardano_update_committee_action_t* update_committee_action,
+  cardano_unit_interval_t*           quorum)
+{
+  if (update_committee_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (quorum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(quorum);
+  cardano_unit_interval_unref(&update_committee_action->new_quorum);
+  update_committee_action->new_quorum = quorum;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_unit_interval_t*
+cardano_update_committee_action_get_quorum(cardano_update_committee_action_t* update_committee_action)
+{
+  if (update_committee_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(update_committee_action->new_quorum);
+
+  return update_committee_action->new_quorum;
+}
+
+cardano_error_t
+cardano_update_committee_action_set_governance_action_id(
+  cardano_update_committee_action_t* update_committee_action,
+  cardano_governance_action_id_t*    governance_action_id)
+{
+  if (update_committee_action == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_governance_action_id_ref(governance_action_id);
+  cardano_governance_action_id_unref(&update_committee_action->governance_action_id);
+  update_committee_action->governance_action_id = governance_action_id;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_governance_action_id_t*
+cardano_update_committee_action_get_governance_action_id(
+  cardano_update_committee_action_t* update_committee_action)
+{
+  if (update_committee_action == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_governance_action_id_ref(update_committee_action->governance_action_id);
+
+  return update_committee_action->governance_action_id;
+}
+
+void
+cardano_update_committee_action_unref(cardano_update_committee_action_t** update_committee_action)
+{
+  if ((update_committee_action == NULL) || (*update_committee_action == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*update_committee_action)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *update_committee_action = NULL;
+    return;
+  }
+}
+
+void
+cardano_update_committee_action_ref(cardano_update_committee_action_t* update_committee_action)
+{
+  if (update_committee_action == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&update_committee_action->base);
+}
+
+size_t
+cardano_update_committee_action_refcount(const cardano_update_committee_action_t* update_committee_action)
+{
+  if (update_committee_action == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&update_committee_action->base);
+}
+
+void
+cardano_update_committee_action_set_last_error(cardano_update_committee_action_t* update_committee_action, const char* message)
+{
+  cardano_object_set_last_error(&update_committee_action->base, message);
+}
+
+const char*
+cardano_update_committee_action_get_last_error(const cardano_update_committee_action_t* update_committee_action)
+{
+  return cardano_object_get_last_error(&update_committee_action->base);
+}
+
+cardano_error_t
+cardano_update_committee_action_deep_clone(const cardano_update_committee_action_t* source, cardano_update_committee_action_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_update_committee_action_t* copy = _cardano_malloc(sizeof(cardano_update_committee_action_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count        = 1U;
+  copy->base.deallocator      = source->base.deallocator;
+  copy->base.last_error[0]    = '\0';
+  copy->members_to_be_removed = NULL;
+  copy->members_to_be_added   = NULL;
+  copy->new_quorum            = NULL;
+  copy->governance_action_id  = NULL;
+
+  if (source->members_to_be_removed != NULL)
+  {
+    const cardano_error_t result = cardano_credential_set_deep_clone(source->members_to_be_removed, &copy->members_to_be_removed);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->members_to_be_added != NULL)
+  {
+    const cardano_error_t result = cardano_committee_members_map_deep_clone(source->members_to_be_added, &copy->members_to_be_added);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->new_quorum != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->new_quorum, &copy->new_quorum);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->governance_action_id != NULL)
+  {
+    const cardano_error_t result = cardano_governance_action_id_deep_clone(source->governance_action_id, &copy->governance_action_id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/protocol_params/cost_model.c b/vendor/src/protocol_params/cost_model.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/protocol_params/cost_model.c
@@ -0,0 +1,572 @@
+/**
+ * \file cost_model.c
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+#include <cardano/protocol_params/cost_model.h>
+#include <cardano/scripts/plutus_scripts/plutus_language_version.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief The Plutus language versions known to this library, indexed by their language id.
+ */
+static const cardano_plutus_language_version_t KNOWN_LANGUAGES[] = {
+  CARDANO_PLUTUS_LANGUAGE_VERSION_V1,
+  CARDANO_PLUTUS_LANGUAGE_VERSION_V2,
+  CARDANO_PLUTUS_LANGUAGE_VERSION_V3,
+  CARDANO_PLUTUS_LANGUAGE_VERSION_V4,
+};
+
+static const size_t KNOWN_LANGUAGES_COUNT = sizeof(KNOWN_LANGUAGES) / sizeof(KNOWN_LANGUAGES[0]);
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano cost model.
+ *
+ * The language is kept as its raw language id, so cost models for language ids this library does not know
+ * yet (the ledger accepts any id from 0 to 255) are preserved and re-encoded unchanged.
+ */
+typedef struct cardano_cost_model_t
+{
+    cardano_object_t base;
+    uint8_t          language_id;
+    int64_t*         costs;
+    size_t           size;
+} cardano_cost_model_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a cost model object.
+ *
+ * This function is responsible for properly deallocating a cost model object (`cardano_cost_model_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the cost_model object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_cost_model_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the cost_model
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_cost_model_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_cost_model_t* cost_model = (cardano_cost_model_t*)object;
+
+  if (cost_model->costs != NULL)
+  {
+    _cardano_free(cost_model->costs);
+  }
+
+  _cardano_free(object);
+}
+
+/**
+ * \brief Creates a cost model for the given raw language id.
+ *
+ * \param[in] language_id The language id of the cost model, known or not.
+ * \param[in] cost_array The costs of the cost model.
+ * \param[in] costs_size The number of costs in \p cost_array.
+ * \param[out] cost_model On success, points to the new cost model.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code on failure.
+ */
+static cardano_error_t
+create_cost_model(
+  const uint8_t          language_id,
+  const int64_t*         cost_array,
+  const size_t           costs_size,
+  cardano_cost_model_t** cost_model)
+{
+  *cost_model = _cardano_malloc(sizeof(cardano_cost_model_t));
+
+  if (*cost_model == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  // Lets add a practical limit here (10 times current cost models size)
+  if (costs_size > 2048U)
+  {
+    _cardano_free(*cost_model);
+    *cost_model = NULL;
+
+    return CARDANO_ERROR_INVALID_PLUTUS_COST_MODEL;
+  }
+
+  (*cost_model)->costs = _cardano_malloc(costs_size * sizeof(int64_t));
+  (*cost_model)->size  = costs_size;
+
+  if ((*cost_model)->costs == NULL)
+  {
+    _cardano_free(*cost_model);
+    *cost_model = NULL;
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*cost_model)->language_id        = language_id;
+  (*cost_model)->base.deallocator   = cardano_cost_model_deallocate;
+  (*cost_model)->base.ref_count     = 1;
+  (*cost_model)->base.last_error[0] = '\0';
+
+  for (size_t i = 0U; i < costs_size; ++i)
+  {
+    (*cost_model)->costs[i] = cost_array[i];
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_cost_model_new(
+  cardano_plutus_language_version_t language,
+  const int64_t*                    cost_array,
+  size_t                            costs_size,
+  cardano_cost_model_t**            cost_model)
+{
+  if (cost_model == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0U; i < KNOWN_LANGUAGES_COUNT; ++i)
+  {
+    if (KNOWN_LANGUAGES[i] == language)
+    {
+      return create_cost_model((uint8_t)i, cost_array, costs_size, cost_model);
+    }
+  }
+
+  *cost_model = NULL;
+
+  return CARDANO_ERROR_INVALID_PLUTUS_COST_MODEL;
+}
+
+cardano_error_t
+cardano_cost_model_from_cbor(cardano_cbor_reader_t* reader, cardano_cost_model_t** cost_model)
+{
+  if (cost_model == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *cost_model = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "cost_model";
+
+  uint64_t              language_version  = 0U;
+  const cardano_error_t read_minor_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "language_version",
+    reader,
+    &language_version,
+    0U,
+    UINT8_MAX);
+
+  if (read_minor_result != CARDANO_SUCCESS)
+  {
+    *cost_model = NULL;
+    return read_minor_result;
+  }
+
+  int64_t cost_model_size = 0U;
+
+  const cardano_error_t read_array_result = cardano_cbor_reader_read_start_array(reader, &cost_model_size);
+
+  if (read_array_result != CARDANO_SUCCESS)
+  {
+    *cost_model = NULL;
+    return read_array_result;
+  }
+
+  if (cost_model_size > 2048)
+  {
+    *cost_model = NULL;
+    return CARDANO_ERROR_INVALID_PLUTUS_COST_MODEL;
+  }
+
+  const bool   is_indefinite = cost_model_size < 0;
+  const size_t max_costs     = is_indefinite ? 2048U : (size_t)cost_model_size;
+
+  int64_t* costs = _cardano_malloc(max_costs * sizeof(int64_t));
+
+  if (costs == NULL)
+  {
+    *cost_model = NULL;
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  size_t costs_count = 0U;
+
+  while (costs_count < max_costs)
+  {
+    if (is_indefinite)
+    {
+      cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+      const cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+      if (peek_result != CARDANO_SUCCESS)
+      {
+        _cardano_free(costs);
+        *cost_model = NULL;
+        return peek_result;
+      }
+
+      if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+      {
+        break;
+      }
+    }
+
+    const cardano_error_t read_cost_result = cardano_cbor_reader_read_int(reader, &costs[costs_count]);
+
+    if (read_cost_result != CARDANO_SUCCESS)
+    {
+      _cardano_free(costs);
+      *cost_model = NULL;
+      return read_cost_result;
+    }
+
+    ++costs_count;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    *cost_model = NULL;
+    _cardano_free(costs);
+
+    return expect_end_array_result;
+  }
+
+  cardano_error_t new_model_result = create_cost_model((uint8_t)language_version, costs, costs_count, cost_model);
+  _cardano_free(costs);
+
+  return new_model_result;
+}
+
+cardano_error_t
+cardano_cost_model_to_cbor(const cardano_cost_model_t* cost_model, cardano_cbor_writer_t* writer)
+{
+  if (cost_model == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, cost_model->language_id);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    (int32_t)cost_model->size);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  for (size_t i = 0U; i < cost_model->size; ++i)
+  {
+    const cardano_error_t write_int_result = cardano_cbor_writer_write_signed_int(writer, cost_model->costs[i]);
+
+    if (write_int_result != CARDANO_SUCCESS)
+    {
+      return write_int_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cost_model_to_cip116_json(
+  const cardano_cost_model_t* cost_model,
+  cardano_json_writer_t*      writer)
+{
+  if ((cost_model == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t count = cardano_cost_model_get_costs_size(cost_model);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    int64_t         value = 0;
+    cardano_error_t error = cardano_cost_model_get_cost(cost_model, i, &value);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    cardano_json_writer_write_signed_int_as_string(writer, value);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cost_model_set_cost(
+  cardano_cost_model_t* cost_model,
+  size_t                operation,
+  int64_t               cost)
+{
+  if (cost_model == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (operation >= cost_model->size)
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cost_model->costs[operation] = cost;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cost_model_get_cost(const cardano_cost_model_t* cost_model, size_t operation, int64_t* cost)
+{
+  if (cost_model == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (operation >= cost_model->size)
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  if (cost == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *cost = cost_model->costs[operation];
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_cost_model_get_costs_size(const cardano_cost_model_t* cost_model)
+{
+  if (cost_model == NULL)
+  {
+    return 0U;
+  }
+
+  return cost_model->size;
+}
+
+const int64_t*
+cardano_cost_model_get_costs(const cardano_cost_model_t* cost_model)
+{
+  if (cost_model == NULL)
+  {
+    return NULL;
+  }
+
+  return cost_model->costs;
+}
+
+cardano_error_t
+cardano_cost_model_get_language(
+  const cardano_cost_model_t*        cost_model,
+  cardano_plutus_language_version_t* language)
+{
+  if (cost_model == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (language == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((size_t)cost_model->language_id >= KNOWN_LANGUAGES_COUNT)
+  {
+    return CARDANO_ERROR_INVALID_PLUTUS_COST_MODEL;
+  }
+
+  *language = KNOWN_LANGUAGES[cost_model->language_id];
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_cost_model_get_language_id(
+  const cardano_cost_model_t* cost_model,
+  uint8_t*                    language_id)
+{
+  if (cost_model == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (language_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *language_id = cost_model->language_id;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_cost_model_unref(cardano_cost_model_t** cost_model)
+{
+  if ((cost_model == NULL) || (*cost_model == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*cost_model)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *cost_model = NULL;
+    return;
+  }
+}
+
+void
+cardano_cost_model_ref(cardano_cost_model_t* cost_model)
+{
+  if (cost_model == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&cost_model->base);
+}
+
+size_t
+cardano_cost_model_refcount(const cardano_cost_model_t* cost_model)
+{
+  if (cost_model == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&cost_model->base);
+}
+
+void
+cardano_cost_model_set_last_error(cardano_cost_model_t* cost_model, const char* message)
+{
+  cardano_object_set_last_error(&cost_model->base, message);
+}
+
+const char*
+cardano_cost_model_get_last_error(const cardano_cost_model_t* cost_model)
+{
+  return cardano_object_get_last_error(&cost_model->base);
+}
+
+cardano_error_t
+cardano_cost_model_deep_clone(const cardano_cost_model_t* source, cardano_cost_model_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cost_model_t* copy = _cardano_malloc(sizeof(cardano_cost_model_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->language_id        = source->language_id;
+  copy->costs              = NULL;
+  copy->size               = source->size;
+
+  if (source->costs != NULL)
+  {
+    const size_t size = source->size * sizeof(int64_t);
+
+    copy->costs = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->costs == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->costs, source->costs, size));
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/protocol_params/costmdls.c b/vendor/src/protocol_params/costmdls.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/protocol_params/costmdls.c
@@ -0,0 +1,670 @@
+/**
+ * \file costmdls.c
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/object.h>
+#include <cardano/protocol_params/cost_model.h>
+#include <cardano/protocol_params/costmdls.h>
+#include <cardano/scripts/plutus_scripts/plutus_language_version.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+#define COSTMDLS_LANGUAGE_ID_COUNT ((size_t)256U)
+#define KNOWN_LANGUAGE_ID_COUNT    ((size_t)CARDANO_PLUTUS_LANGUAGE_VERSION_V4 + 1U)
+#define PROPERTY_NAME_SIZE         ((size_t)9U)
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Map of language id to CostModel.
+ *
+ * The models are indexed by their language id. Ids 0 to 3 are the known Plutus language versions; the other ids
+ * hold the cost models of languages this library does not know yet, which the ledger accepts and re-encodes.
+ */
+typedef struct cardano_costmdls_t
+{
+    cardano_object_t      base;
+    cardano_cost_model_t* models[COSTMDLS_LANGUAGE_ID_COUNT];
+} cardano_costmdls_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a cost model object.
+ *
+ * This function is responsible for properly deallocating a cost model object (`cardano_costmdls_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the costmdls object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_costmdls_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the costmdls
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_costmdls_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_costmdls_t* data = (cardano_costmdls_t*)object;
+
+  for (size_t i = 0U; i < COSTMDLS_LANGUAGE_ID_COUNT; ++i)
+  {
+    cardano_cost_model_unref(&data->models[i]);
+  }
+
+  _cardano_free(object);
+}
+
+/**
+ * \brief Checks whether the given language is a known Plutus language version.
+ *
+ * \param language The language to check.
+ *
+ * \return \c true if the language is a known Plutus language version, \c false otherwise.
+ */
+static bool
+is_known_language(const cardano_plutus_language_version_t language)
+{
+  switch (language)
+  {
+    case CARDANO_PLUTUS_LANGUAGE_VERSION_V1:
+    case CARDANO_PLUTUS_LANGUAGE_VERSION_V2:
+    case CARDANO_PLUTUS_LANGUAGE_VERSION_V3:
+    case CARDANO_PLUTUS_LANGUAGE_VERSION_V4:
+      return true;
+    default:
+      return false;
+  }
+}
+
+/**
+ * \brief Counts the cost models stored for the language ids in the given range.
+ *
+ * \param costmdls The costmdls object to count the cost models of.
+ * \param first_id The first language id of the range.
+ * \param end_id The language id one past the end of the range.
+ *
+ * \return The number of cost models stored for the language ids in the range.
+ */
+static size_t
+count_models(const cardano_costmdls_t* costmdls, const size_t first_id, const size_t end_id)
+{
+  size_t count = 0U;
+
+  for (size_t i = first_id; i < end_id; ++i)
+  {
+    if (costmdls->models[i] != NULL)
+    {
+      ++count;
+    }
+  }
+
+  return count;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_costmdls_new(cardano_costmdls_t** costmdls)
+{
+  if (costmdls == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *costmdls = _cardano_malloc(sizeof(cardano_costmdls_t));
+
+  if (*costmdls == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*costmdls)->base.deallocator   = cardano_costmdls_deallocate;
+  (*costmdls)->base.ref_count     = 1;
+  (*costmdls)->base.last_error[0] = '\0';
+
+  for (size_t i = 0U; i < COSTMDLS_LANGUAGE_ID_COUNT; ++i)
+  {
+    (*costmdls)->models[i] = NULL;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_costmdls_from_cbor(cardano_cbor_reader_t* reader, cardano_costmdls_t** costmdls)
+{
+  if (costmdls == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *costmdls = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  int64_t map_size = 0U;
+
+  const cardano_error_t read_map_result = cardano_cbor_reader_read_start_map(reader, &map_size);
+
+  if (read_map_result != CARDANO_SUCCESS)
+  {
+    *costmdls = NULL;
+    return read_map_result;
+  }
+
+  cardano_costmdls_t*   costmdls_data       = NULL;
+  const cardano_error_t costmdls_new_result = cardano_costmdls_new(&costmdls_data);
+
+  if (costmdls_new_result != CARDANO_SUCCESS)
+  {
+    *costmdls = NULL;
+    return costmdls_new_result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    const cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (peek_result != CARDANO_SUCCESS)
+    {
+      cardano_costmdls_unref(&costmdls_data);
+      *costmdls = NULL;
+
+      return peek_result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_cost_model_t* model           = NULL;
+    const cardano_error_t read_cost_model = cardano_cost_model_from_cbor(reader, &model);
+
+    if (read_cost_model != CARDANO_SUCCESS)
+    {
+      cardano_costmdls_unref(&costmdls_data);
+      *costmdls = NULL;
+      return read_cost_model;
+    }
+
+    const cardano_error_t insert_result = cardano_costmdls_insert(costmdls_data, model);
+    cardano_cost_model_unref(&model);
+
+    if (insert_result != CARDANO_SUCCESS)
+    {
+      cardano_costmdls_unref(&costmdls_data);
+      *costmdls = NULL;
+
+      return insert_result;
+    }
+  }
+
+  const cardano_error_t end_map_result = cardano_cbor_validate_end_map("costmdls", reader);
+
+  if (end_map_result != CARDANO_SUCCESS)
+  {
+    cardano_costmdls_unref(&costmdls_data);
+    *costmdls = NULL;
+
+    return end_map_result;
+  }
+
+  *costmdls = costmdls_data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_costmdls_to_cbor(const cardano_costmdls_t* costmdls, cardano_cbor_writer_t* writer)
+{
+  if (costmdls == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t map_size = count_models(costmdls, 0U, COSTMDLS_LANGUAGE_ID_COUNT);
+
+  const cardano_error_t write_map_result = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (write_map_result != CARDANO_SUCCESS)
+  {
+    return write_map_result;
+  }
+
+  for (size_t i = 0U; i < COSTMDLS_LANGUAGE_ID_COUNT; ++i)
+  {
+    if (costmdls->models[i] != NULL)
+    {
+      const cardano_error_t write_model_result = cardano_cost_model_to_cbor(costmdls->models[i], writer);
+
+      if (write_model_result != CARDANO_SUCCESS)
+      {
+        return write_model_result;
+      }
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_costmdls_to_cip116_json(
+  const cardano_costmdls_t* costmdls,
+  cardano_json_writer_t*    writer)
+{
+  if ((costmdls == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* property_names[] = { "plutus_v1", "plutus_v2", "plutus_v3", "plutus_v4" };
+
+  cardano_json_writer_write_start_object(writer);
+
+  for (size_t i = 0U; i < (sizeof(property_names) / sizeof(property_names[0])); ++i)
+  {
+    if (costmdls->models[i] != NULL)
+    {
+      cardano_json_writer_write_property_name(writer, property_names[i], PROPERTY_NAME_SIZE);
+      cardano_error_t write_model_result = cardano_cost_model_to_cip116_json(costmdls->models[i], writer);
+
+      if (write_model_result != CARDANO_SUCCESS)
+      {
+        return write_model_result;
+      }
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_costmdls_insert(
+  cardano_costmdls_t*   costmdls,
+  cardano_cost_model_t* cost_model)
+{
+  if (costmdls == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cost_model == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  uint8_t language_id = 0U;
+
+  const cardano_error_t get_language_result = cardano_cost_model_get_language_id(cost_model, &language_id);
+
+  if (get_language_result != CARDANO_SUCCESS)
+  {
+    return get_language_result;
+  }
+
+  cardano_cost_model_ref(cost_model);
+  cardano_cost_model_unref(&costmdls->models[language_id]);
+  costmdls->models[language_id] = cost_model;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_costmdls_get(
+  cardano_costmdls_t*                     costmdls,
+  const cardano_plutus_language_version_t language,
+  cardano_cost_model_t**                  cost_model)
+{
+  if (costmdls == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cost_model == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (!is_known_language(language))
+  {
+    return CARDANO_ERROR_INVALID_PLUTUS_COST_MODEL;
+  }
+
+  *cost_model = costmdls->models[(size_t)language];
+  cardano_cost_model_ref(*cost_model);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_costmdls_get_by_language_id(
+  cardano_costmdls_t*    costmdls,
+  const uint8_t          language_id,
+  cardano_cost_model_t** cost_model)
+{
+  if (costmdls == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cost_model == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *cost_model = costmdls->models[language_id];
+  cardano_cost_model_ref(*cost_model);
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_costmdls_has(
+  const cardano_costmdls_t*               costmdls,
+  const cardano_plutus_language_version_t language)
+{
+  if (costmdls == NULL)
+  {
+    return false;
+  }
+
+  if (!is_known_language(language))
+  {
+    return false;
+  }
+
+  return costmdls->models[(size_t)language] != NULL;
+}
+
+cardano_error_t
+cardano_costmdls_get_language_views_encoding(
+  const cardano_costmdls_t* costmdls,
+  cardano_buffer_t**        language_views)
+{
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const size_t map_size = count_models(costmdls, 0U, KNOWN_LANGUAGE_ID_COUNT);
+
+  const cardano_error_t write_map_result = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (write_map_result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+
+    return write_map_result;
+  }
+
+  for (size_t i = (size_t)CARDANO_PLUTUS_LANGUAGE_VERSION_V2; i < KNOWN_LANGUAGE_ID_COUNT; ++i)
+  {
+    if (costmdls->models[i] != NULL)
+    {
+      const cardano_error_t write_model_result = cardano_cost_model_to_cbor(costmdls->models[i], writer);
+
+      if (write_model_result != CARDANO_SUCCESS)
+      {
+        cardano_cbor_writer_unref(&writer);
+        return write_model_result;
+      }
+    }
+  }
+
+  const cardano_cost_model_t* plutus_v1_costs = costmdls->models[(size_t)CARDANO_PLUTUS_LANGUAGE_VERSION_V1];
+
+  if (plutus_v1_costs != NULL)
+  {
+    cardano_cbor_writer_t* inner_writer = cardano_cbor_writer_new();
+
+    if (inner_writer == NULL)
+    {
+      cardano_cbor_writer_unref(&writer);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    const cardano_error_t write_v1_result = cardano_cbor_writer_write_start_array(inner_writer, -1);
+
+    if (write_v1_result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_writer_unref(&inner_writer);
+      cardano_cbor_writer_unref(&writer);
+
+      return write_v1_result;
+    }
+
+    const size_t v1_costs_size = cardano_cost_model_get_costs_size(plutus_v1_costs);
+
+    for (size_t i = 0U; i < v1_costs_size; ++i)
+    {
+      int64_t cost = 0;
+
+      cardano_error_t get_cost_result = cardano_cost_model_get_cost(plutus_v1_costs, i, &cost);
+
+      if (get_cost_result != CARDANO_SUCCESS)
+      {
+        cardano_cbor_writer_unref(&inner_writer);
+        cardano_cbor_writer_unref(&writer);
+
+        return get_cost_result;
+      }
+
+      const cardano_error_t write_result = cardano_cbor_writer_write_signed_int(inner_writer, cost);
+
+      if (write_result != CARDANO_SUCCESS)
+      {
+        cardano_cbor_writer_unref(&inner_writer);
+        cardano_cbor_writer_unref(&writer);
+
+        return write_result;
+      }
+    }
+
+    const cardano_error_t write_v1_end_result = cardano_cbor_writer_write_end_array(inner_writer);
+
+    if (write_v1_end_result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_writer_unref(&inner_writer);
+      cardano_cbor_writer_unref(&writer);
+
+      return write_v1_end_result;
+    }
+
+    cardano_buffer_t*     buffer             = NULL;
+    const cardano_error_t get_encoded_result = cardano_cbor_writer_encode_in_buffer(inner_writer, &buffer);
+
+    if (get_encoded_result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_writer_unref(&inner_writer);
+      cardano_cbor_writer_unref(&writer);
+
+      return get_encoded_result;
+    }
+
+    byte_t plutus_v1_id = 0U;
+
+    cardano_error_t write_inner_data_result = cardano_cbor_writer_write_bytestring(writer, &plutus_v1_id, 1);
+    cardano_cbor_writer_unref(&inner_writer);
+
+    if (write_inner_data_result != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&buffer);
+      cardano_cbor_writer_unref(&inner_writer);
+      cardano_cbor_writer_unref(&writer);
+
+      return write_inner_data_result;
+    }
+
+    write_inner_data_result = cardano_cbor_writer_write_bytestring(writer, cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer));
+    cardano_buffer_unref(&buffer);
+
+    if (write_inner_data_result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_writer_unref(&inner_writer);
+      cardano_cbor_writer_unref(&writer);
+
+      return write_inner_data_result;
+    }
+  }
+
+  cardano_buffer_t* buffer = NULL;
+
+  const cardano_error_t get_encoded_result = cardano_cbor_writer_encode_in_buffer(writer, &buffer);
+
+  cardano_cbor_writer_unref(&writer);
+
+  if (get_encoded_result != CARDANO_SUCCESS)
+  {
+    return get_encoded_result;
+  }
+
+  *language_views = buffer;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_costmdls_unref(cardano_costmdls_t** costmdls)
+{
+  if ((costmdls == NULL) || (*costmdls == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*costmdls)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *costmdls = NULL;
+    return;
+  }
+}
+
+void
+cardano_costmdls_ref(cardano_costmdls_t* costmdls)
+{
+  if (costmdls == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&costmdls->base);
+}
+
+size_t
+cardano_costmdls_refcount(const cardano_costmdls_t* costmdls)
+{
+  if (costmdls == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_object_refcount(&costmdls->base);
+}
+
+void
+cardano_costmdls_set_last_error(cardano_costmdls_t* costmdls, const char* message)
+{
+  cardano_object_set_last_error(&costmdls->base, message);
+}
+
+const char*
+cardano_costmdls_get_last_error(const cardano_costmdls_t* costmdls)
+{
+  return cardano_object_get_last_error(&costmdls->base);
+}
+
+cardano_error_t
+cardano_costmdls_deep_clone(const cardano_costmdls_t* source, cardano_costmdls_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_costmdls_t* copy = _cardano_malloc(sizeof(cardano_costmdls_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  for (size_t i = 0U; i < COSTMDLS_LANGUAGE_ID_COUNT; ++i)
+  {
+    copy->models[i] = NULL;
+  }
+
+  for (size_t i = 0U; i < COSTMDLS_LANGUAGE_ID_COUNT; ++i)
+  {
+    if (source->models[i] != NULL)
+    {
+      const cardano_error_t result = cardano_cost_model_deep_clone(source->models[i], &copy->models[i]);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        copy->base.deallocator(copy);
+        return result;
+      }
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/protocol_params/drep_voting_thresholds.c b/vendor/src/protocol_params/drep_voting_thresholds.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/protocol_params/drep_voting_thresholds.c
@@ -0,0 +1,1228 @@
+/**
+ * \file drep_voting_thresholds.c
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/protocol_params/drep_voting_thresholds.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Governance actions are ratified through on-chain voting. Different
+ * kinds of governance actions have different ratification requirements. One of those
+ * requirements is the approval of the action by DReps. These thresholds specify
+ * the percentage of the total active voting stake that must be meet by the DReps who vote Yes
+ * for the approval to be successful.
+ */
+typedef struct cardano_drep_voting_thresholds_t
+{
+    cardano_object_t         base;
+    cardano_unit_interval_t* motion_no_confidence;
+    cardano_unit_interval_t* committee_normal;
+    cardano_unit_interval_t* committee_no_confidence;
+    cardano_unit_interval_t* update_constitution;
+    cardano_unit_interval_t* hard_fork_initiation;
+    cardano_unit_interval_t* pp_network_group;
+    cardano_unit_interval_t* pp_economic_group;
+    cardano_unit_interval_t* pp_technical_group;
+    cardano_unit_interval_t* pp_governance_group;
+    cardano_unit_interval_t* treasury_withdrawal;
+} cardano_drep_voting_thresholds_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a drep voting thresholds object.
+ *
+ * This function is responsible for properly deallocating a drep voting thresholds object (`cardano_drep_voting_thresholds_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the drep_voting_thresholds object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_drep_voting_thresholds_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the drep_voting_thresholds
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_drep_voting_thresholds_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_drep_voting_thresholds_t* data = (cardano_drep_voting_thresholds_t*)object;
+
+  cardano_unit_interval_unref(&data->motion_no_confidence);
+  cardano_unit_interval_unref(&data->committee_normal);
+  cardano_unit_interval_unref(&data->committee_no_confidence);
+  cardano_unit_interval_unref(&data->update_constitution);
+  cardano_unit_interval_unref(&data->hard_fork_initiation);
+  cardano_unit_interval_unref(&data->pp_network_group);
+  cardano_unit_interval_unref(&data->pp_economic_group);
+  cardano_unit_interval_unref(&data->pp_technical_group);
+  cardano_unit_interval_unref(&data->pp_governance_group);
+  cardano_unit_interval_unref(&data->treasury_withdrawal);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_drep_voting_thresholds_new(
+  cardano_unit_interval_t*           motion_no_confidence,
+  cardano_unit_interval_t*           committee_normal,
+  cardano_unit_interval_t*           committee_no_confidence,
+  cardano_unit_interval_t*           update_constitution,
+  cardano_unit_interval_t*           hard_fork_initiation,
+  cardano_unit_interval_t*           pp_network_group,
+  cardano_unit_interval_t*           pp_economic_group,
+  cardano_unit_interval_t*           pp_technical_group,
+  cardano_unit_interval_t*           pp_governance_group,
+  cardano_unit_interval_t*           treasury_withdrawal,
+  cardano_drep_voting_thresholds_t** drep_voting_thresholds)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (motion_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_normal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (update_constitution == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hard_fork_initiation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_network_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_economic_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_technical_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_governance_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (treasury_withdrawal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *drep_voting_thresholds = _cardano_malloc(sizeof(cardano_drep_voting_thresholds_t));
+
+  if (*drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*drep_voting_thresholds)->base.deallocator   = cardano_drep_voting_thresholds_deallocate;
+  (*drep_voting_thresholds)->base.ref_count     = 1;
+  (*drep_voting_thresholds)->base.last_error[0] = '\0';
+
+  cardano_unit_interval_ref(motion_no_confidence);
+  (*drep_voting_thresholds)->motion_no_confidence = motion_no_confidence;
+
+  cardano_unit_interval_ref(committee_normal);
+  (*drep_voting_thresholds)->committee_normal = committee_normal;
+
+  cardano_unit_interval_ref(committee_no_confidence);
+  (*drep_voting_thresholds)->committee_no_confidence = committee_no_confidence;
+
+  cardano_unit_interval_ref(update_constitution);
+  (*drep_voting_thresholds)->update_constitution = update_constitution;
+
+  cardano_unit_interval_ref(hard_fork_initiation);
+  (*drep_voting_thresholds)->hard_fork_initiation = hard_fork_initiation;
+
+  cardano_unit_interval_ref(pp_network_group);
+  (*drep_voting_thresholds)->pp_network_group = pp_network_group;
+
+  cardano_unit_interval_ref(pp_economic_group);
+  (*drep_voting_thresholds)->pp_economic_group = pp_economic_group;
+
+  cardano_unit_interval_ref(pp_technical_group);
+  (*drep_voting_thresholds)->pp_technical_group = pp_technical_group;
+
+  cardano_unit_interval_ref(pp_governance_group);
+  (*drep_voting_thresholds)->pp_governance_group = pp_governance_group;
+
+  cardano_unit_interval_ref(treasury_withdrawal);
+  (*drep_voting_thresholds)->treasury_withdrawal = treasury_withdrawal;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_from_cbor(cardano_cbor_reader_t* reader, cardano_drep_voting_thresholds_t** drep_voting_thresholds)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *drep_voting_thresholds = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "drep_voting_thresholds";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, 10);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *drep_voting_thresholds = NULL;
+    return expect_array_result;
+  }
+
+  cardano_unit_interval_t* motion_no_confidence = NULL;
+
+  const cardano_error_t motion_no_confidence_result = cardano_unit_interval_from_cbor(reader, &motion_no_confidence);
+
+  if (motion_no_confidence_result != CARDANO_SUCCESS)
+  {
+    *drep_voting_thresholds = NULL;
+    return motion_no_confidence_result;
+  }
+
+  cardano_unit_interval_t* committee_normal = NULL;
+
+  const cardano_error_t committee_normal_result = cardano_unit_interval_from_cbor(reader, &committee_normal);
+
+  if (committee_normal_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    *drep_voting_thresholds = NULL;
+    return committee_normal_result;
+  }
+
+  cardano_unit_interval_t* committee_no_confidence = NULL;
+
+  const cardano_error_t committee_no_confidence_result = cardano_unit_interval_from_cbor(reader, &committee_no_confidence);
+
+  if (committee_no_confidence_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    *drep_voting_thresholds = NULL;
+    return committee_no_confidence_result;
+  }
+
+  cardano_unit_interval_t* update_constitution = NULL;
+
+  const cardano_error_t update_constitution_result = cardano_unit_interval_from_cbor(reader, &update_constitution);
+
+  if (update_constitution_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    cardano_unit_interval_unref(&committee_no_confidence);
+    *drep_voting_thresholds = NULL;
+    return update_constitution_result;
+  }
+
+  cardano_unit_interval_t* hard_fork_initiation = NULL;
+
+  const cardano_error_t hard_fork_initiation_result = cardano_unit_interval_from_cbor(reader, &hard_fork_initiation);
+
+  if (hard_fork_initiation_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    cardano_unit_interval_unref(&committee_no_confidence);
+    cardano_unit_interval_unref(&update_constitution);
+    *drep_voting_thresholds = NULL;
+    return hard_fork_initiation_result;
+  }
+
+  cardano_unit_interval_t* pp_network_group = NULL;
+
+  const cardano_error_t pp_network_group_result = cardano_unit_interval_from_cbor(reader, &pp_network_group);
+
+  if (pp_network_group_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    cardano_unit_interval_unref(&committee_no_confidence);
+    cardano_unit_interval_unref(&update_constitution);
+    cardano_unit_interval_unref(&hard_fork_initiation);
+    *drep_voting_thresholds = NULL;
+    return pp_network_group_result;
+  }
+
+  cardano_unit_interval_t* pp_economic_group = NULL;
+
+  const cardano_error_t pp_economic_group_result = cardano_unit_interval_from_cbor(reader, &pp_economic_group);
+
+  if (pp_economic_group_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    cardano_unit_interval_unref(&committee_no_confidence);
+    cardano_unit_interval_unref(&update_constitution);
+    cardano_unit_interval_unref(&hard_fork_initiation);
+    cardano_unit_interval_unref(&pp_network_group);
+    *drep_voting_thresholds = NULL;
+    return pp_economic_group_result;
+  }
+
+  cardano_unit_interval_t* pp_technical_group = NULL;
+
+  const cardano_error_t pp_technical_group_result = cardano_unit_interval_from_cbor(reader, &pp_technical_group);
+
+  if (pp_technical_group_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    cardano_unit_interval_unref(&committee_no_confidence);
+    cardano_unit_interval_unref(&update_constitution);
+    cardano_unit_interval_unref(&hard_fork_initiation);
+    cardano_unit_interval_unref(&pp_network_group);
+    cardano_unit_interval_unref(&pp_economic_group);
+    *drep_voting_thresholds = NULL;
+    return pp_technical_group_result;
+  }
+
+  cardano_unit_interval_t* pp_governance_group = NULL;
+
+  const cardano_error_t pp_governance_group_result = cardano_unit_interval_from_cbor(reader, &pp_governance_group);
+
+  if (pp_governance_group_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    cardano_unit_interval_unref(&committee_no_confidence);
+    cardano_unit_interval_unref(&update_constitution);
+    cardano_unit_interval_unref(&hard_fork_initiation);
+    cardano_unit_interval_unref(&pp_network_group);
+    cardano_unit_interval_unref(&pp_economic_group);
+    cardano_unit_interval_unref(&pp_technical_group);
+    *drep_voting_thresholds = NULL;
+    return pp_governance_group_result;
+  }
+
+  cardano_unit_interval_t* treasury_withdrawal = NULL;
+
+  const cardano_error_t treasury_withdrawal_result = cardano_unit_interval_from_cbor(reader, &treasury_withdrawal);
+
+  if (treasury_withdrawal_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    cardano_unit_interval_unref(&committee_no_confidence);
+    cardano_unit_interval_unref(&update_constitution);
+    cardano_unit_interval_unref(&hard_fork_initiation);
+    cardano_unit_interval_unref(&pp_network_group);
+    cardano_unit_interval_unref(&pp_economic_group);
+    cardano_unit_interval_unref(&pp_technical_group);
+    cardano_unit_interval_unref(&pp_governance_group);
+    *drep_voting_thresholds = NULL;
+    return treasury_withdrawal_result;
+  }
+
+  cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    cardano_unit_interval_unref(&committee_no_confidence);
+    cardano_unit_interval_unref(&update_constitution);
+    cardano_unit_interval_unref(&hard_fork_initiation);
+    cardano_unit_interval_unref(&pp_network_group);
+    cardano_unit_interval_unref(&pp_economic_group);
+    cardano_unit_interval_unref(&pp_technical_group);
+    cardano_unit_interval_unref(&pp_governance_group);
+    cardano_unit_interval_unref(&treasury_withdrawal);
+    *drep_voting_thresholds = NULL;
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t result = cardano_drep_voting_thresholds_new(
+    motion_no_confidence,
+    committee_normal,
+    committee_no_confidence,
+    update_constitution,
+    hard_fork_initiation,
+    pp_network_group,
+    pp_economic_group,
+    pp_technical_group,
+    pp_governance_group,
+    treasury_withdrawal,
+    drep_voting_thresholds);
+
+  cardano_unit_interval_unref(&motion_no_confidence);
+  cardano_unit_interval_unref(&committee_normal);
+  cardano_unit_interval_unref(&committee_no_confidence);
+  cardano_unit_interval_unref(&update_constitution);
+  cardano_unit_interval_unref(&hard_fork_initiation);
+  cardano_unit_interval_unref(&pp_network_group);
+  cardano_unit_interval_unref(&pp_economic_group);
+  cardano_unit_interval_unref(&pp_technical_group);
+  cardano_unit_interval_unref(&pp_governance_group);
+  cardano_unit_interval_unref(&treasury_withdrawal);
+
+  return result;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_to_cbor(const cardano_drep_voting_thresholds_t* drep_voting_thresholds, cardano_cbor_writer_t* writer)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    10);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t motion_no_confidence_result = cardano_unit_interval_to_cbor(drep_voting_thresholds->motion_no_confidence, writer);
+
+  if (motion_no_confidence_result != CARDANO_SUCCESS)
+  {
+    return motion_no_confidence_result;
+  }
+
+  cardano_error_t committee_normal_result = cardano_unit_interval_to_cbor(drep_voting_thresholds->committee_normal, writer);
+
+  if (committee_normal_result != CARDANO_SUCCESS)
+  {
+    return committee_normal_result;
+  }
+
+  cardano_error_t committee_no_confidence_result = cardano_unit_interval_to_cbor(drep_voting_thresholds->committee_no_confidence, writer);
+
+  if (committee_no_confidence_result != CARDANO_SUCCESS)
+  {
+    return committee_no_confidence_result;
+  }
+
+  cardano_error_t update_constitution_result = cardano_unit_interval_to_cbor(drep_voting_thresholds->update_constitution, writer);
+
+  if (update_constitution_result != CARDANO_SUCCESS)
+  {
+    return update_constitution_result;
+  }
+
+  cardano_error_t hard_fork_initiation_result = cardano_unit_interval_to_cbor(drep_voting_thresholds->hard_fork_initiation, writer);
+
+  if (hard_fork_initiation_result != CARDANO_SUCCESS)
+  {
+    return hard_fork_initiation_result;
+  }
+
+  cardano_error_t pp_network_group_result = cardano_unit_interval_to_cbor(drep_voting_thresholds->pp_network_group, writer);
+
+  if (pp_network_group_result != CARDANO_SUCCESS)
+  {
+    return pp_network_group_result;
+  }
+
+  cardano_error_t pp_economic_group_result = cardano_unit_interval_to_cbor(drep_voting_thresholds->pp_economic_group, writer);
+
+  if (pp_economic_group_result != CARDANO_SUCCESS)
+  {
+    return pp_economic_group_result;
+  }
+
+  cardano_error_t pp_technical_group_result = cardano_unit_interval_to_cbor(drep_voting_thresholds->pp_technical_group, writer);
+
+  if (pp_technical_group_result != CARDANO_SUCCESS)
+  {
+    return pp_technical_group_result;
+  }
+
+  cardano_error_t pp_governance_group_result = cardano_unit_interval_to_cbor(drep_voting_thresholds->pp_governance_group, writer);
+
+  if (pp_governance_group_result != CARDANO_SUCCESS)
+  {
+    return pp_governance_group_result;
+  }
+
+  return cardano_unit_interval_to_cbor(drep_voting_thresholds->treasury_withdrawal, writer);
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_to_cip116_json(
+  const cardano_drep_voting_thresholds_t* thresholds,
+  cardano_json_writer_t*                  writer)
+{
+  if ((thresholds == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "motion_no_confidence", 20);
+  cardano_error_t error = cardano_unit_interval_to_cip116_json(thresholds->motion_no_confidence, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "committee_normal", 16);
+  error = cardano_unit_interval_to_cip116_json(thresholds->committee_normal, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "committee_no_confidence", 23);
+  error = cardano_unit_interval_to_cip116_json(thresholds->committee_no_confidence, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "update_constitution", 19);
+  error = cardano_unit_interval_to_cip116_json(thresholds->update_constitution, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "hard_fork_initiation", 20);
+  error = cardano_unit_interval_to_cip116_json(thresholds->hard_fork_initiation, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "pp_network_group", 16);
+  error = cardano_unit_interval_to_cip116_json(thresholds->pp_network_group, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "pp_economic_group", 17);
+  error = cardano_unit_interval_to_cip116_json(thresholds->pp_economic_group, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "pp_technical_group", 18);
+  error = cardano_unit_interval_to_cip116_json(thresholds->pp_technical_group, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "pp_gov_group", 12);
+  error = cardano_unit_interval_to_cip116_json(thresholds->pp_governance_group, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "treasury_withdrawal", 19);
+  error = cardano_unit_interval_to_cip116_json(thresholds->treasury_withdrawal, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_get_motion_no_confidence(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         motion_no_confidence)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (motion_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(drep_voting_thresholds->motion_no_confidence);
+  *motion_no_confidence = drep_voting_thresholds->motion_no_confidence;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_get_committee_normal(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         committee_normal)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_normal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(drep_voting_thresholds->committee_normal);
+  *committee_normal = drep_voting_thresholds->committee_normal;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_get_committee_no_confidence(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         committee_no_confidence)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(drep_voting_thresholds->committee_no_confidence);
+  *committee_no_confidence = drep_voting_thresholds->committee_no_confidence;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_get_update_constitution(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         update_constitution)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (update_constitution == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(drep_voting_thresholds->update_constitution);
+  *update_constitution = drep_voting_thresholds->update_constitution;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_get_hard_fork_initiation(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         hard_fork_initiation)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hard_fork_initiation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(drep_voting_thresholds->hard_fork_initiation);
+  *hard_fork_initiation = drep_voting_thresholds->hard_fork_initiation;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_get_pp_network_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         pp_network_group)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_network_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(drep_voting_thresholds->pp_network_group);
+  *pp_network_group = drep_voting_thresholds->pp_network_group;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_get_pp_economic_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         pp_economic_group)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_economic_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(drep_voting_thresholds->pp_economic_group);
+  *pp_economic_group = drep_voting_thresholds->pp_economic_group;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_get_pp_technical_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         pp_technical_group)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_technical_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(drep_voting_thresholds->pp_technical_group);
+  *pp_technical_group = drep_voting_thresholds->pp_technical_group;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_get_pp_governance_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         pp_governance_group)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_governance_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(drep_voting_thresholds->pp_governance_group);
+  *pp_governance_group = drep_voting_thresholds->pp_governance_group;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_get_treasury_withdrawal(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t**         treasury_withdrawal)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (treasury_withdrawal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(drep_voting_thresholds->treasury_withdrawal);
+  *treasury_withdrawal = drep_voting_thresholds->treasury_withdrawal;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_set_motion_no_confidence(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          motion_no_confidence)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (motion_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&drep_voting_thresholds->motion_no_confidence);
+  cardano_unit_interval_ref(motion_no_confidence);
+  drep_voting_thresholds->motion_no_confidence = motion_no_confidence;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_set_committee_normal(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          committee_normal)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_normal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&drep_voting_thresholds->committee_normal);
+  cardano_unit_interval_ref(committee_normal);
+  drep_voting_thresholds->committee_normal = committee_normal;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_set_committee_no_confidence(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          committee_no_confidence)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&drep_voting_thresholds->committee_no_confidence);
+  cardano_unit_interval_ref(committee_no_confidence);
+  drep_voting_thresholds->committee_no_confidence = committee_no_confidence;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_set_update_constitution(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          update_constitution)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (update_constitution == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&drep_voting_thresholds->update_constitution);
+  cardano_unit_interval_ref(update_constitution);
+  drep_voting_thresholds->update_constitution = update_constitution;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_set_hard_fork_initiation(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          hard_fork_initiation)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hard_fork_initiation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&drep_voting_thresholds->hard_fork_initiation);
+  cardano_unit_interval_ref(hard_fork_initiation);
+  drep_voting_thresholds->hard_fork_initiation = hard_fork_initiation;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_set_pp_network_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          pp_network_group)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_network_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&drep_voting_thresholds->pp_network_group);
+  cardano_unit_interval_ref(pp_network_group);
+  drep_voting_thresholds->pp_network_group = pp_network_group;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_set_pp_economic_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          pp_economic_group)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_economic_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&drep_voting_thresholds->pp_economic_group);
+  cardano_unit_interval_ref(pp_economic_group);
+  drep_voting_thresholds->pp_economic_group = pp_economic_group;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_set_pp_technical_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          pp_technical_group)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_technical_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&drep_voting_thresholds->pp_technical_group);
+  cardano_unit_interval_ref(pp_technical_group);
+  drep_voting_thresholds->pp_technical_group = pp_technical_group;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_set_pp_governance_group(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          pp_governance_group)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pp_governance_group == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&drep_voting_thresholds->pp_governance_group);
+  cardano_unit_interval_ref(pp_governance_group);
+  drep_voting_thresholds->pp_governance_group = pp_governance_group;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_set_treasury_withdrawal(
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds,
+  cardano_unit_interval_t*          treasury_withdrawal)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (treasury_withdrawal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&drep_voting_thresholds->treasury_withdrawal);
+  cardano_unit_interval_ref(treasury_withdrawal);
+  drep_voting_thresholds->treasury_withdrawal = treasury_withdrawal;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_drep_voting_thresholds_unref(cardano_drep_voting_thresholds_t** drep_voting_thresholds)
+{
+  if ((drep_voting_thresholds == NULL) || (*drep_voting_thresholds == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*drep_voting_thresholds)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *drep_voting_thresholds = NULL;
+    return;
+  }
+}
+
+void
+cardano_drep_voting_thresholds_ref(cardano_drep_voting_thresholds_t* drep_voting_thresholds)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&drep_voting_thresholds->base);
+}
+
+size_t
+cardano_drep_voting_thresholds_refcount(const cardano_drep_voting_thresholds_t* drep_voting_thresholds)
+{
+  if (drep_voting_thresholds == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&drep_voting_thresholds->base);
+}
+
+void
+cardano_drep_voting_thresholds_set_last_error(cardano_drep_voting_thresholds_t* drep_voting_thresholds, const char* message)
+{
+  cardano_object_set_last_error(&drep_voting_thresholds->base, message);
+}
+
+const char*
+cardano_drep_voting_thresholds_get_last_error(const cardano_drep_voting_thresholds_t* drep_voting_thresholds)
+{
+  return cardano_object_get_last_error(&drep_voting_thresholds->base);
+}
+
+cardano_error_t
+cardano_drep_voting_thresholds_deep_clone(const cardano_drep_voting_thresholds_t* source, cardano_drep_voting_thresholds_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_drep_voting_thresholds_t* copy = _cardano_malloc(sizeof(cardano_drep_voting_thresholds_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count          = 1U;
+  copy->base.deallocator        = source->base.deallocator;
+  copy->base.last_error[0]      = '\0';
+  copy->motion_no_confidence    = NULL;
+  copy->committee_normal        = NULL;
+  copy->committee_no_confidence = NULL;
+  copy->update_constitution     = NULL;
+  copy->hard_fork_initiation    = NULL;
+  copy->pp_network_group        = NULL;
+  copy->pp_economic_group       = NULL;
+  copy->pp_technical_group      = NULL;
+  copy->pp_governance_group     = NULL;
+  copy->treasury_withdrawal     = NULL;
+
+  if (source->motion_no_confidence != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->motion_no_confidence, &copy->motion_no_confidence);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->committee_normal != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->committee_normal, &copy->committee_normal);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->committee_no_confidence != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->committee_no_confidence, &copy->committee_no_confidence);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->update_constitution != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->update_constitution, &copy->update_constitution);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->hard_fork_initiation != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->hard_fork_initiation, &copy->hard_fork_initiation);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pp_network_group != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->pp_network_group, &copy->pp_network_group);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pp_economic_group != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->pp_economic_group, &copy->pp_economic_group);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pp_technical_group != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->pp_technical_group, &copy->pp_technical_group);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pp_governance_group != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->pp_governance_group, &copy->pp_governance_group);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->treasury_withdrawal != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->treasury_withdrawal, &copy->treasury_withdrawal);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/protocol_params/ex_unit_prices.c b/vendor/src/protocol_params/ex_unit_prices.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/protocol_params/ex_unit_prices.c
@@ -0,0 +1,443 @@
+/**
+ * \file ex_unit_prices.c
+ *
+ * \author angel.castillo
+ * \date   May 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+#include <cardano/protocol_params/ex_unit_prices.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Specifies the cost (in Lovelace) of these ExUnits. In essence, they set the
+ * "price" for the computational resources used by a smart contract.
+ */
+typedef struct cardano_ex_unit_prices_t
+{
+    cardano_object_t         base;
+    cardano_unit_interval_t* mem_prices;
+    cardano_unit_interval_t* cpu_prices;
+} cardano_ex_unit_prices_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a execution unit prices object.
+ *
+ * This function is responsible for properly deallocating a execution unit prices object (`cardano_ex_unit_prices_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the ex_unit_prices object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_ex_unit_prices_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the ex_unit_prices
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_ex_unit_prices_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_ex_unit_prices_t* data = (cardano_ex_unit_prices_t*)object;
+
+  cardano_unit_interval_unref(&data->mem_prices);
+  cardano_unit_interval_unref(&data->cpu_prices);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_ex_unit_prices_new(
+  cardano_unit_interval_t*   memory_prices,
+  cardano_unit_interval_t*   steps_prices,
+  cardano_ex_unit_prices_t** ex_unit_prices)
+{
+  if (ex_unit_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (memory_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (steps_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *ex_unit_prices = _cardano_malloc(sizeof(cardano_ex_unit_prices_t));
+
+  if (*ex_unit_prices == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*ex_unit_prices)->base.deallocator   = cardano_ex_unit_prices_deallocate;
+  (*ex_unit_prices)->base.ref_count     = 1;
+  (*ex_unit_prices)->base.last_error[0] = '\0';
+
+  cardano_unit_interval_ref(memory_prices);
+  (*ex_unit_prices)->mem_prices = memory_prices;
+
+  cardano_unit_interval_ref(steps_prices);
+  (*ex_unit_prices)->cpu_prices = steps_prices;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ex_unit_prices_from_cbor(cardano_cbor_reader_t* reader, cardano_ex_unit_prices_t** ex_unit_prices)
+{
+  if (ex_unit_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *ex_unit_prices = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "ex_unit_prices";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *ex_unit_prices = NULL;
+    return expect_array_result;
+  }
+
+  cardano_unit_interval_t* mem_prices = NULL;
+
+  const cardano_error_t mem_prices_result = cardano_unit_interval_from_cbor(reader, &mem_prices);
+
+  if (mem_prices_result != CARDANO_SUCCESS)
+  {
+    *ex_unit_prices = NULL;
+    return mem_prices_result;
+  }
+
+  cardano_unit_interval_t* cpu_prices = NULL;
+
+  const cardano_error_t cpu_prices_result = cardano_unit_interval_from_cbor(reader, &cpu_prices);
+
+  if (cpu_prices_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&mem_prices);
+    *ex_unit_prices = NULL;
+    return cpu_prices_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    *ex_unit_prices = NULL;
+
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t result = cardano_ex_unit_prices_new(mem_prices, cpu_prices, ex_unit_prices);
+
+  cardano_unit_interval_unref(&mem_prices);
+  cardano_unit_interval_unref(&cpu_prices);
+
+  return result;
+}
+
+cardano_error_t
+cardano_ex_unit_prices_to_cbor(const cardano_ex_unit_prices_t* ex_unit_prices, cardano_cbor_writer_t* writer)
+{
+  if (ex_unit_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_mem_prices_result = cardano_unit_interval_to_cbor(ex_unit_prices->mem_prices, writer);
+
+  if (write_mem_prices_result != CARDANO_SUCCESS)
+  {
+    return write_mem_prices_result;
+  }
+
+  return cardano_unit_interval_to_cbor(ex_unit_prices->cpu_prices, writer);
+}
+
+cardano_error_t
+cardano_ex_unit_prices_to_cip116_json(
+  const cardano_ex_unit_prices_t* prices,
+  cardano_json_writer_t*          writer)
+{
+  if ((prices == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  assert(prices->mem_prices != NULL);
+  cardano_json_writer_write_property_name(writer, "mem_price", 9);
+  cardano_error_t error = cardano_unit_interval_to_cip116_json(prices->mem_prices, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  assert(prices->cpu_prices != NULL);
+  cardano_json_writer_write_property_name(writer, "step_price", 10);
+  error = cardano_unit_interval_to_cip116_json(prices->cpu_prices, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ex_unit_prices_get_memory_prices(
+  cardano_ex_unit_prices_t* ex_unit_prices,
+  cardano_unit_interval_t** memory_prices)
+{
+  if (ex_unit_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (memory_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(ex_unit_prices->mem_prices);
+  *memory_prices = ex_unit_prices->mem_prices;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ex_unit_prices_get_steps_prices(
+  cardano_ex_unit_prices_t* ex_unit_prices,
+  cardano_unit_interval_t** steps_prices)
+{
+  if (ex_unit_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (steps_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(ex_unit_prices->cpu_prices);
+  *steps_prices = ex_unit_prices->cpu_prices;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ex_unit_prices_set_memory_prices(
+  cardano_ex_unit_prices_t* ex_unit_prices,
+  cardano_unit_interval_t*  memory_prices)
+{
+  if (ex_unit_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (memory_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&ex_unit_prices->mem_prices);
+  cardano_unit_interval_ref(memory_prices);
+  ex_unit_prices->mem_prices = memory_prices;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_ex_unit_prices_set_steps_prices(
+  cardano_ex_unit_prices_t* ex_unit_prices,
+  cardano_unit_interval_t*  steps_prices)
+{
+  if (ex_unit_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (steps_prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&ex_unit_prices->cpu_prices);
+  cardano_unit_interval_ref(steps_prices);
+  ex_unit_prices->cpu_prices = steps_prices;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_ex_unit_prices_unref(cardano_ex_unit_prices_t** ex_unit_prices)
+{
+  if ((ex_unit_prices == NULL) || (*ex_unit_prices == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*ex_unit_prices)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *ex_unit_prices = NULL;
+    return;
+  }
+}
+
+void
+cardano_ex_unit_prices_ref(cardano_ex_unit_prices_t* ex_unit_prices)
+{
+  if (ex_unit_prices == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&ex_unit_prices->base);
+}
+
+size_t
+cardano_ex_unit_prices_refcount(const cardano_ex_unit_prices_t* ex_unit_prices)
+{
+  if (ex_unit_prices == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&ex_unit_prices->base);
+}
+
+void
+cardano_ex_unit_prices_set_last_error(cardano_ex_unit_prices_t* ex_unit_prices, const char* message)
+{
+  cardano_object_set_last_error(&ex_unit_prices->base, message);
+}
+
+const char*
+cardano_ex_unit_prices_get_last_error(const cardano_ex_unit_prices_t* ex_unit_prices)
+{
+  return cardano_object_get_last_error(&ex_unit_prices->base);
+}
+
+cardano_error_t
+cardano_ex_unit_prices_deep_clone(const cardano_ex_unit_prices_t* source, cardano_ex_unit_prices_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ex_unit_prices_t* copy = _cardano_malloc(sizeof(cardano_ex_unit_prices_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->mem_prices         = NULL;
+  copy->cpu_prices         = NULL;
+
+  if (source->mem_prices != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->mem_prices, &copy->mem_prices);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cpu_prices != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->cpu_prices, &copy->cpu_prices);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/protocol_params/pool_voting_thresholds.c b/vendor/src/protocol_params/pool_voting_thresholds.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/protocol_params/pool_voting_thresholds.c
@@ -0,0 +1,736 @@
+/**
+ * \file pool_voting_thresholds.c
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/protocol_params/pool_voting_thresholds.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Governance actions are ratified through on-chain voting. Different
+ * kinds of governance actions have different ratification requirements. One of those
+ * requirements is the approval of the action by SPOs. These thresholds specify
+ * the percentage of the stake held by all stake pools that must be meet by the SPOs who
+ * vote Yes for the approval to be successful.
+ */
+typedef struct cardano_pool_voting_thresholds_t
+{
+    cardano_object_t         base;
+    cardano_unit_interval_t* motion_no_confidence;
+    cardano_unit_interval_t* committee_normal;
+    cardano_unit_interval_t* committee_no_confidence;
+    cardano_unit_interval_t* hard_fork_initiation;
+    cardano_unit_interval_t* security_relevant_param;
+} cardano_pool_voting_thresholds_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a pool voting thresholds object.
+ *
+ * This function is responsible for properly deallocating a pool voting thresholds object (`cardano_pool_voting_thresholds_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the pool_voting_thresholds object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_pool_voting_thresholds_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the pool_voting_thresholds
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_pool_voting_thresholds_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_pool_voting_thresholds_t* data = (cardano_pool_voting_thresholds_t*)object;
+
+  cardano_unit_interval_unref(&data->motion_no_confidence);
+  cardano_unit_interval_unref(&data->committee_normal);
+  cardano_unit_interval_unref(&data->committee_no_confidence);
+  cardano_unit_interval_unref(&data->hard_fork_initiation);
+  cardano_unit_interval_unref(&data->security_relevant_param);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_pool_voting_thresholds_new(
+  cardano_unit_interval_t*           motion_no_confidence,
+  cardano_unit_interval_t*           committee_normal,
+  cardano_unit_interval_t*           committee_no_confidence,
+  cardano_unit_interval_t*           hard_fork_initiation,
+  cardano_unit_interval_t*           security_relevant_param,
+  cardano_pool_voting_thresholds_t** pool_voting_thresholds)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (motion_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_normal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hard_fork_initiation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (security_relevant_param == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *pool_voting_thresholds = _cardano_malloc(sizeof(cardano_pool_voting_thresholds_t));
+
+  if (*pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*pool_voting_thresholds)->base.deallocator   = cardano_pool_voting_thresholds_deallocate;
+  (*pool_voting_thresholds)->base.ref_count     = 1;
+  (*pool_voting_thresholds)->base.last_error[0] = '\0';
+
+  cardano_unit_interval_ref(motion_no_confidence);
+  (*pool_voting_thresholds)->motion_no_confidence = motion_no_confidence;
+
+  cardano_unit_interval_ref(committee_normal);
+  (*pool_voting_thresholds)->committee_normal = committee_normal;
+
+  cardano_unit_interval_ref(committee_no_confidence);
+  (*pool_voting_thresholds)->committee_no_confidence = committee_no_confidence;
+
+  cardano_unit_interval_ref(hard_fork_initiation);
+  (*pool_voting_thresholds)->hard_fork_initiation = hard_fork_initiation;
+
+  cardano_unit_interval_ref(security_relevant_param);
+  (*pool_voting_thresholds)->security_relevant_param = security_relevant_param;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_from_cbor(cardano_cbor_reader_t* reader, cardano_pool_voting_thresholds_t** pool_voting_thresholds)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *pool_voting_thresholds = NULL;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "pool_voting_thresholds";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, 5);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *pool_voting_thresholds = NULL;
+
+    return expect_array_result;
+  }
+
+  cardano_unit_interval_t* motion_no_confidence = NULL;
+
+  const cardano_error_t motion_no_confidence_result = cardano_unit_interval_from_cbor(reader, &motion_no_confidence);
+
+  if (motion_no_confidence_result != CARDANO_SUCCESS)
+  {
+    *pool_voting_thresholds = NULL;
+
+    return motion_no_confidence_result;
+  }
+
+  cardano_unit_interval_t* committee_normal = NULL;
+
+  const cardano_error_t committee_normal_result = cardano_unit_interval_from_cbor(reader, &committee_normal);
+
+  if (committee_normal_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    *pool_voting_thresholds = NULL;
+
+    return committee_normal_result;
+  }
+
+  cardano_unit_interval_t* committee_no_confidence = NULL;
+
+  const cardano_error_t committee_no_confidence_result = cardano_unit_interval_from_cbor(reader, &committee_no_confidence);
+
+  if (committee_no_confidence_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    *pool_voting_thresholds = NULL;
+
+    return committee_no_confidence_result;
+  }
+
+  cardano_unit_interval_t* hard_fork_initiation = NULL;
+
+  const cardano_error_t hard_fork_initiation_result = cardano_unit_interval_from_cbor(reader, &hard_fork_initiation);
+
+  if (hard_fork_initiation_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    cardano_unit_interval_unref(&committee_no_confidence);
+    *pool_voting_thresholds = NULL;
+
+    return hard_fork_initiation_result;
+  }
+
+  cardano_unit_interval_t* security_relevant_param = NULL;
+
+  const cardano_error_t security_relevant_param_result = cardano_unit_interval_from_cbor(reader, &security_relevant_param);
+
+  if (security_relevant_param_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    cardano_unit_interval_unref(&committee_no_confidence);
+    cardano_unit_interval_unref(&hard_fork_initiation);
+    *pool_voting_thresholds = NULL;
+
+    return security_relevant_param_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&motion_no_confidence);
+    cardano_unit_interval_unref(&committee_normal);
+    cardano_unit_interval_unref(&committee_no_confidence);
+    cardano_unit_interval_unref(&hard_fork_initiation);
+    cardano_unit_interval_unref(&security_relevant_param);
+    *pool_voting_thresholds = NULL;
+
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t result = cardano_pool_voting_thresholds_new(
+    motion_no_confidence,
+    committee_normal,
+    committee_no_confidence,
+    hard_fork_initiation,
+    security_relevant_param,
+    pool_voting_thresholds);
+
+  cardano_unit_interval_unref(&motion_no_confidence);
+  cardano_unit_interval_unref(&committee_normal);
+  cardano_unit_interval_unref(&committee_no_confidence);
+  cardano_unit_interval_unref(&hard_fork_initiation);
+  cardano_unit_interval_unref(&security_relevant_param);
+
+  return result;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_to_cbor(const cardano_pool_voting_thresholds_t* pool_voting_thresholds, cardano_cbor_writer_t* writer)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    5);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t motion_no_confidence_result = cardano_unit_interval_to_cbor(pool_voting_thresholds->motion_no_confidence, writer);
+
+  if (motion_no_confidence_result != CARDANO_SUCCESS)
+  {
+    return motion_no_confidence_result;
+  }
+
+  cardano_error_t committee_normal_result = cardano_unit_interval_to_cbor(pool_voting_thresholds->committee_normal, writer);
+
+  if (committee_normal_result != CARDANO_SUCCESS)
+  {
+    return committee_normal_result;
+  }
+
+  cardano_error_t committee_no_confidence_result = cardano_unit_interval_to_cbor(pool_voting_thresholds->committee_no_confidence, writer);
+
+  if (committee_no_confidence_result != CARDANO_SUCCESS)
+  {
+    return committee_no_confidence_result;
+  }
+
+  cardano_error_t hard_fork_initiation_result = cardano_unit_interval_to_cbor(pool_voting_thresholds->hard_fork_initiation, writer);
+
+  if (hard_fork_initiation_result != CARDANO_SUCCESS)
+  {
+    return hard_fork_initiation_result;
+  }
+
+  return cardano_unit_interval_to_cbor(pool_voting_thresholds->security_relevant_param, writer);
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_to_cip116_json(
+  const cardano_pool_voting_thresholds_t* thresholds,
+  cardano_json_writer_t*                  writer)
+{
+  if ((thresholds == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "motion_no_confidence", 20);
+  cardano_error_t error = cardano_unit_interval_to_cip116_json(thresholds->motion_no_confidence, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "committee_normal", 16);
+  error = cardano_unit_interval_to_cip116_json(thresholds->committee_normal, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "committee_no_confidence", 23);
+  error = cardano_unit_interval_to_cip116_json(thresholds->committee_no_confidence, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "hard_fork_initiation", 20);
+  error = cardano_unit_interval_to_cip116_json(thresholds->hard_fork_initiation, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "security_relevant_param", 23);
+  error = cardano_unit_interval_to_cip116_json(thresholds->security_relevant_param, writer);
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_get_motion_no_confidence(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t**         motion_no_confidence)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (motion_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(pool_voting_thresholds->motion_no_confidence);
+  *motion_no_confidence = pool_voting_thresholds->motion_no_confidence;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_get_committee_normal(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t**         committee_normal)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_normal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(pool_voting_thresholds->committee_normal);
+  *committee_normal = pool_voting_thresholds->committee_normal;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_get_committee_no_confidence(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t**         committee_no_confidence)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(pool_voting_thresholds->committee_no_confidence);
+  *committee_no_confidence = pool_voting_thresholds->committee_no_confidence;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_get_hard_fork_initiation(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t**         hard_fork_initiation)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hard_fork_initiation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(pool_voting_thresholds->hard_fork_initiation);
+  *hard_fork_initiation = pool_voting_thresholds->hard_fork_initiation;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_get_security_relevant_param(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t**         security_relevant_param)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (security_relevant_param == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(pool_voting_thresholds->security_relevant_param);
+  *security_relevant_param = pool_voting_thresholds->security_relevant_param;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_set_motion_no_confidence(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t*          motion_no_confidence)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (motion_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&pool_voting_thresholds->motion_no_confidence);
+  cardano_unit_interval_ref(motion_no_confidence);
+  pool_voting_thresholds->motion_no_confidence = motion_no_confidence;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_set_committee_normal(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t*          committee_normal)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_normal == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&pool_voting_thresholds->committee_normal);
+  cardano_unit_interval_ref(committee_normal);
+  pool_voting_thresholds->committee_normal = committee_normal;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_set_committee_no_confidence(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t*          committee_no_confidence)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (committee_no_confidence == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&pool_voting_thresholds->committee_no_confidence);
+  cardano_unit_interval_ref(committee_no_confidence);
+  pool_voting_thresholds->committee_no_confidence = committee_no_confidence;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_set_hard_fork_initiation(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t*          hard_fork_initiation)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (hard_fork_initiation == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&pool_voting_thresholds->hard_fork_initiation);
+  cardano_unit_interval_ref(hard_fork_initiation);
+  pool_voting_thresholds->hard_fork_initiation = hard_fork_initiation;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_set_security_relevant_param(
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds,
+  cardano_unit_interval_t*          security_relevant_param)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (security_relevant_param == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&pool_voting_thresholds->security_relevant_param);
+  cardano_unit_interval_ref(security_relevant_param);
+  pool_voting_thresholds->security_relevant_param = security_relevant_param;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_pool_voting_thresholds_unref(cardano_pool_voting_thresholds_t** pool_voting_thresholds)
+{
+  if ((pool_voting_thresholds == NULL) || (*pool_voting_thresholds == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*pool_voting_thresholds)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *pool_voting_thresholds = NULL;
+    return;
+  }
+}
+
+void
+cardano_pool_voting_thresholds_ref(cardano_pool_voting_thresholds_t* pool_voting_thresholds)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&pool_voting_thresholds->base);
+}
+
+size_t
+cardano_pool_voting_thresholds_refcount(const cardano_pool_voting_thresholds_t* pool_voting_thresholds)
+{
+  if (pool_voting_thresholds == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&pool_voting_thresholds->base);
+}
+
+void
+cardano_pool_voting_thresholds_set_last_error(cardano_pool_voting_thresholds_t* pool_voting_thresholds, const char* message)
+{
+  cardano_object_set_last_error(&pool_voting_thresholds->base, message);
+}
+
+const char*
+cardano_pool_voting_thresholds_get_last_error(const cardano_pool_voting_thresholds_t* pool_voting_thresholds)
+{
+  return cardano_object_get_last_error(&pool_voting_thresholds->base);
+}
+
+cardano_error_t
+cardano_pool_voting_thresholds_deep_clone(const cardano_pool_voting_thresholds_t* source, cardano_pool_voting_thresholds_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_voting_thresholds_t* copy = _cardano_malloc(sizeof(cardano_pool_voting_thresholds_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count          = 1U;
+  copy->base.deallocator        = source->base.deallocator;
+  copy->base.last_error[0]      = '\0';
+  copy->motion_no_confidence    = NULL;
+  copy->committee_normal        = NULL;
+  copy->committee_no_confidence = NULL;
+  copy->hard_fork_initiation    = NULL;
+  copy->security_relevant_param = NULL;
+
+  if (source->motion_no_confidence != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->motion_no_confidence, &copy->motion_no_confidence);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->committee_normal != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->committee_normal, &copy->committee_normal);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->committee_no_confidence != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->committee_no_confidence, &copy->committee_no_confidence);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->hard_fork_initiation != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->hard_fork_initiation, &copy->hard_fork_initiation);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->security_relevant_param != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->security_relevant_param, &copy->security_relevant_param);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/protocol_params/proposed_param_updates.c b/vendor/src/protocol_params/proposed_param_updates.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/protocol_params/proposed_param_updates.c
@@ -0,0 +1,780 @@
+/**
+ * \file proposed_params_updates.c
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/object.h>
+#include <cardano/protocol_params/proposed_param_updates.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief In the Cardano network, stakeholders can propose changes to the protocol parameters. These proposals are then
+ * collected into a set which represents the ProposedProtocolParameterUpdates.
+ */
+typedef struct cardano_proposed_param_updates_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_proposed_param_updates_t;
+
+/**
+ * \brief This proposed protocol parameter updates are represented as a map of genesis delegate key hash to parameters updates. So in principles,
+ * each genesis delegate can propose a different update.
+ */
+typedef struct cardano_proposed_param_updates_kvp_t
+{
+    cardano_object_t                 base;
+    cardano_blake2b_hash_t*          key;
+    cardano_protocol_param_update_t* value;
+} cardano_proposed_param_updates_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a proposed params updates object.
+ *
+ * This function is responsible for properly deallocating a proposed params updates object (`cardano_proposed_param_updates_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the proposed_params_updates object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_proposed_param_updates_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the proposed_params_updates
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_proposed_param_updates_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_proposed_param_updates_t* map = (cardano_proposed_param_updates_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a proposed params updates key value pair object.
+ *
+ * This function is responsible for properly deallocating a proposed params updates key value pair object (`cardano_proposed_param_updates_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the proposed_params_updates object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_proposed_param_updates_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the proposed_params_updates
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_proposed_param_updates_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_proposed_param_updates_kvp_t* map = (cardano_proposed_param_updates_kvp_t*)object;
+
+  if (map->key != NULL)
+  {
+    cardano_blake2b_hash_unref(&map->key);
+  }
+
+  if (map->value != NULL)
+  {
+    cardano_protocol_param_update_unref(&map->value);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their Blake2b hashes.
+ *
+ * This function casts the cardano_object_t objects to cardano_proposed_param_updates_kvp_t
+ * and compares their Blake2b hashes using the cardano_blake2b_hash_compare function.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context A pointer to a context object. This parameter is not used in this function.
+ *
+ * \return A negative value if the hash of lhs is less than the hash of rhs, zero if they are equal,
+ *         and a positive value if the hash of lhs is greater than the hash of rhs.
+ */
+static int32_t
+compare_by_hash(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_proposed_param_updates_kvp_t* kvp_lhs = (const cardano_proposed_param_updates_kvp_t*)((const void*)lhs);
+  const cardano_proposed_param_updates_kvp_t* kvp_rhs = (const cardano_proposed_param_updates_kvp_t*)((const void*)rhs);
+
+  return cardano_blake2b_hash_compare(kvp_lhs->key, kvp_rhs->key);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_proposed_param_updates_new(cardano_proposed_param_updates_t** proposed_params_updates)
+{
+  if (proposed_params_updates == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposed_param_updates_t* map = _cardano_malloc(sizeof(cardano_proposed_param_updates_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_proposed_param_updates_deallocate;
+
+  map->array = cardano_array_new(128);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *proposed_params_updates = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposed_param_updates_from_cbor(cardano_cbor_reader_t* reader, cardano_proposed_param_updates_t** proposed_params_updates)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposed_params_updates == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposed_param_updates_t* map    = NULL;
+  cardano_error_t                   result = cardano_proposed_param_updates_new(&map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_map(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_proposed_param_updates_unref(&map);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_proposed_param_updates_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_blake2b_hash_t*          key   = NULL;
+    cardano_protocol_param_update_t* value = NULL;
+
+    result = cardano_blake2b_hash_from_cbor(reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_proposed_param_updates_unref(&map);
+      return result;
+    }
+
+    result = cardano_protocol_param_update_from_cbor(reader, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&key);
+      cardano_proposed_param_updates_unref(&map);
+      return result;
+    }
+
+    cardano_proposed_param_updates_kvp_t* kvp = _cardano_malloc(sizeof(cardano_proposed_param_updates_kvp_t));
+
+    if (kvp == NULL)
+    {
+      cardano_blake2b_hash_unref(&key);
+      cardano_protocol_param_update_unref(&value);
+      cardano_proposed_param_updates_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    kvp->base.ref_count     = 0;
+    kvp->base.last_error[0] = '\0';
+    kvp->base.deallocator   = cardano_proposed_param_updates_kvp_deallocate;
+    kvp->key                = key;
+    kvp->value              = value;
+
+    const size_t old_size = cardano_array_get_size(map->array);
+    const size_t new_size = cardano_array_push(map->array, (cardano_object_t*)((void*)kvp));
+
+    if (new_size != (old_size + 1U))
+    {
+      cardano_proposed_param_updates_kvp_deallocate(kvp);
+      cardano_proposed_param_updates_unref(&map);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_map("proposed_params_updates", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_proposed_param_updates_unref(&map);
+    return result;
+  }
+
+  *proposed_params_updates = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposed_param_updates_to_cbor(const cardano_proposed_param_updates_t* proposed_params_updates, cardano_cbor_writer_t* writer)
+{
+  if (proposed_params_updates == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t          map_size = cardano_array_get_size(proposed_params_updates->array);
+  cardano_error_t result   = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(proposed_params_updates->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(proposed_params_updates->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in proposed params updates is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_proposed_param_updates_kvp_t* kvp_data = (cardano_proposed_param_updates_kvp_t*)((void*)kvp);
+
+    result = cardano_blake2b_hash_to_cbor(kvp_data->key, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    result = cardano_protocol_param_update_to_cbor(kvp_data->value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    cardano_object_unref(&kvp);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposed_param_updates_to_cip116_json(
+  const cardano_proposed_param_updates_t* updates,
+  cardano_json_writer_t*                  writer)
+{
+  if ((updates == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  size_t array_size = cardano_array_get_size(updates->array);
+
+  for (size_t i = 0; i < array_size; ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(updates->array, i);
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    cardano_proposed_param_updates_kvp_t* kvp_data = (cardano_proposed_param_updates_kvp_t*)((void*)kvp);
+    char                                  hex[128] = { 0 };
+    const size_t                          size     = cardano_blake2b_hash_get_hex_size(kvp_data->key);
+    cardano_error_t                       error    = cardano_blake2b_hash_to_hex(
+      kvp_data->key,
+      hex,
+      sizeof(hex));
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return error;
+    }
+
+    cardano_json_writer_write_property_name(writer, hex, size - 1U);
+
+    error = cardano_protocol_param_update_to_cip116_json(kvp_data->value, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return error;
+    }
+
+    cardano_object_unref(&kvp);
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_proposed_param_updates_get_size(const cardano_proposed_param_updates_t* proposed_params_updates)
+{
+  if (proposed_params_updates == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(proposed_params_updates->array);
+}
+
+cardano_error_t
+cardano_proposed_param_updates_insert(
+  cardano_proposed_param_updates_t* proposed_param_updates,
+  cardano_blake2b_hash_t*           genesis_delegate_key_hash,
+  cardano_protocol_param_update_t*  protocol_param_update)
+{
+  if (proposed_param_updates == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (genesis_delegate_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposed_param_updates_kvp_t* kvp = _cardano_malloc(sizeof(cardano_proposed_param_updates_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_proposed_param_updates_kvp_deallocate;
+  kvp->key                = genesis_delegate_key_hash;
+  kvp->value              = protocol_param_update;
+
+  cardano_blake2b_hash_ref(genesis_delegate_key_hash);
+  cardano_protocol_param_update_ref(protocol_param_update);
+
+  const size_t old_size = cardano_array_get_size(proposed_param_updates->array);
+  const size_t new_size = cardano_array_push(proposed_param_updates->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_proposed_param_updates_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(proposed_param_updates->array, compare_by_hash, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposed_param_updates_get(
+  const cardano_proposed_param_updates_t* proposed_param_updates,
+  cardano_blake2b_hash_t*                 genesis_delegate_key_hash,
+  cardano_protocol_param_update_t**       protocol_param_update)
+{
+  if (proposed_param_updates == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (genesis_delegate_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(proposed_param_updates->array); ++i)
+  {
+    cardano_object_t*                     object = cardano_array_get(proposed_param_updates->array, i);
+    cardano_proposed_param_updates_kvp_t* kvp    = (cardano_proposed_param_updates_kvp_t*)((void*)object);
+
+    if (cardano_blake2b_hash_equals(kvp->key, genesis_delegate_key_hash))
+    {
+      cardano_protocol_param_update_ref(kvp->value);
+      *protocol_param_update = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_proposed_param_updates_get_key_at(
+  const cardano_proposed_param_updates_t* proposed_param_updates,
+  size_t                                  index,
+  cardano_blake2b_hash_t**                genesis_delegate_key_hash)
+{
+  if (proposed_param_updates == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (genesis_delegate_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(proposed_param_updates->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t* object = cardano_array_get(proposed_param_updates->array, index);
+
+  cardano_proposed_param_updates_kvp_t* kvp = (cardano_proposed_param_updates_kvp_t*)((void*)object);
+
+  cardano_blake2b_hash_ref(kvp->key);
+
+  *genesis_delegate_key_hash = kvp->key;
+
+  cardano_object_unref(&object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposed_param_updates_get_value_at(
+  const cardano_proposed_param_updates_t* proposed_param_updates,
+  size_t                                  index,
+  cardano_protocol_param_update_t**       protocol_param_update)
+{
+  if (proposed_param_updates == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(proposed_param_updates->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t* object = cardano_array_get(proposed_param_updates->array, index);
+
+  cardano_proposed_param_updates_kvp_t* kvp = (cardano_proposed_param_updates_kvp_t*)((void*)object);
+
+  cardano_protocol_param_update_ref(kvp->value);
+
+  *protocol_param_update = kvp->value;
+
+  cardano_object_unref(&object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_proposed_param_updates_get_key_value_at(
+  const cardano_proposed_param_updates_t* proposed_param_updates,
+  size_t                                  index,
+  cardano_blake2b_hash_t**                genesis_delegate_key_hash,
+  cardano_protocol_param_update_t**       protocol_param_update)
+{
+  if (proposed_param_updates == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (genesis_delegate_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(proposed_param_updates->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t* object = cardano_array_get(proposed_param_updates->array, index);
+
+  cardano_proposed_param_updates_kvp_t* kvp = (cardano_proposed_param_updates_kvp_t*)((void*)object);
+
+  cardano_blake2b_hash_ref(kvp->key);
+  cardano_protocol_param_update_ref(kvp->value);
+
+  *genesis_delegate_key_hash = kvp->key;
+  *protocol_param_update     = kvp->value;
+
+  cardano_object_unref(&object);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_proposed_param_updates_unref(cardano_proposed_param_updates_t** proposed_params_updates)
+{
+  if ((proposed_params_updates == NULL) || (*proposed_params_updates == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*proposed_params_updates)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *proposed_params_updates = NULL;
+    return;
+  }
+}
+
+void
+cardano_proposed_param_updates_ref(cardano_proposed_param_updates_t* proposed_params_updates)
+{
+  if (proposed_params_updates == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&proposed_params_updates->base);
+}
+
+size_t
+cardano_proposed_param_updates_refcount(const cardano_proposed_param_updates_t* proposed_params_updates)
+{
+  if (proposed_params_updates == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&proposed_params_updates->base);
+}
+
+void
+cardano_proposed_param_updates_set_last_error(cardano_proposed_param_updates_t* proposed_params_updates, const char* message)
+{
+  cardano_object_set_last_error(&proposed_params_updates->base, message);
+}
+
+const char*
+cardano_proposed_param_updates_get_last_error(const cardano_proposed_param_updates_t* proposed_params_updates)
+{
+  return cardano_object_get_last_error(&proposed_params_updates->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_proposed_param_updates_kvp_deep_clone(const cardano_proposed_param_updates_kvp_t* source, cardano_proposed_param_updates_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposed_param_updates_kvp_t* copy = _cardano_malloc(sizeof(cardano_proposed_param_updates_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = NULL;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_protocol_param_update_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_proposed_param_updates_kvp_t* copy   = NULL;
+  const cardano_error_t                 result = cardano_proposed_param_updates_kvp_deep_clone((const cardano_proposed_param_updates_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_proposed_param_updates_deep_clone(const cardano_proposed_param_updates_t* source, cardano_proposed_param_updates_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposed_param_updates_t* copy = _cardano_malloc(sizeof(cardano_proposed_param_updates_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/protocol_params/protocol_param_update.c b/vendor/src/protocol_params/protocol_param_update.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/protocol_params/protocol_param_update.c
@@ -0,0 +1,8083 @@
+/**
+ * \file protocol_param_update.c
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/protocol_params/protocol_param_update.h>
+
+#include <cardano/plutus_data/constr_plutus_data.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/plutus_data/plutus_list.h>
+#include <cardano/plutus_data/plutus_map.h>
+#include <cardano/protocol_params/cost_model.h>
+#include <cardano/scripts/plutus_scripts/plutus_language_version.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The ProtocolParamUpdate structure in Cardano is used to propose changes to
+ * the protocol parameters of the blockchain. Protocol parameters govern various
+ * aspects of the Cardano network.
+ */
+typedef struct cardano_protocol_param_update_t
+{
+    cardano_object_t                  base;
+    uint64_t*                         min_fee_a;
+    uint64_t*                         min_fee_b;
+    uint64_t*                         max_block_body_size;
+    uint64_t*                         max_tx_size;
+    uint64_t*                         max_block_header_size;
+    uint64_t*                         key_deposit;
+    uint64_t*                         pool_deposit;
+    uint64_t*                         max_epoch;
+    uint64_t*                         n_opt;
+    cardano_unit_interval_t*          pool_pledge_influence;
+    cardano_unit_interval_t*          expansion_rate;
+    cardano_unit_interval_t*          treasury_growth_rate;
+    cardano_unit_interval_t*          d;
+    cardano_buffer_t*                 extra_entropy;
+    cardano_protocol_version_t*       protocol_version;
+    uint64_t*                         min_pool_cost;
+    uint64_t*                         ada_per_utxo_byte;
+    cardano_costmdls_t*               cost_models;
+    cardano_ex_unit_prices_t*         execution_costs;
+    cardano_ex_units_t*               max_tx_ex_units;
+    cardano_ex_units_t*               max_block_ex_units;
+    uint64_t*                         max_value_size;
+    uint64_t*                         collateral_percentage;
+    uint64_t*                         max_collateral_inputs;
+    cardano_pool_voting_thresholds_t* pool_voting_thresholds;
+    cardano_drep_voting_thresholds_t* drep_voting_thresholds;
+    uint64_t*                         min_committee_size;
+    uint64_t*                         committee_term_limit;
+    uint64_t*                         governance_action_validity_period;
+    uint64_t*                         governance_action_deposit;
+    uint64_t*                         drep_deposit;
+    uint64_t*                         drep_inactivity_period;
+    cardano_unit_interval_t*          ref_script_cost_per_byte;
+    uint64_t*                         max_ref_script_size_per_block;
+    uint64_t*                         max_ref_script_size_per_tx;
+    uint64_t*                         ref_script_cost_stride;
+    cardano_unit_interval_t*          ref_script_cost_multiplier;
+    bool                              has_max_pledge_leverage;
+    cardano_unit_interval_t*          max_pledge_leverage;
+    cardano_unit_interval_t*          min_pool_margin;
+    uint64_t*                         leios_announcement_period_length;
+    uint64_t*                         leios_vote_period_length;
+    uint64_t*                         leios_diffusion_period_length;
+    uint64_t*                         leios_committee_size;
+    cardano_unit_interval_t*          leios_quorum_stake_threshold;
+    uint64_t*                         max_endorser_block_references_size;
+    uint64_t*                         max_endorser_block_txs_size;
+    cardano_ex_units_t*               max_endorser_block_execution_units;
+    uint64_t*                         max_ref_script_size_per_endorser_block;
+    uint64_t*                         peras_min_candidate_block_age;
+    cardano_unit_interval_t*          peras_healing_factor;
+    uint64_t*                         peras_cert_boost;
+    uint64_t*                         peras_target_committee_size;
+    bool                              has_peras_bootstrap_round;
+    uint64_t*                         peras_bootstrap_round;
+    cardano_unit_interval_t*          peras_quorum_threshold_safety_margin;
+    uint64_t*                         ref_inputs_cost_per_multi_asset_byte;
+    uint64_t*                         ref_inputs_cost_per_datum_byte;
+} cardano_protocol_param_update_t;
+
+/* PLUTUS-DATA ENCODING ******************************************************/
+
+/**
+ * \brief Greatest common divisor of two unsigned integers (Euclid).
+ */
+static uint64_t
+pp_gcd(uint64_t a, uint64_t b)
+{
+  uint64_t x = a;
+  uint64_t y = b;
+
+  while (y != 0U)
+  {
+    const uint64_t t = y;
+    y                = x % y;
+    x                = t;
+  }
+
+  return x;
+}
+
+/**
+ * \brief Encodes an unsigned integer as a plutus-data integer.
+ */
+static cardano_error_t
+pp_encode_uint(uint64_t value, cardano_plutus_data_t** out)
+{
+  return cardano_plutus_data_new_integer_from_uint(value, out);
+}
+
+/**
+ * \brief Encodes a unit interval as a gcd-reduced rational: List [I num, I den].
+ *
+ * Matches the ledger's \c ToPlutusData Rational (List [num, den]) over the reduced
+ * fraction, the same normalization Aiken applies via \c WithArrayRational.
+ */
+static cardano_error_t
+pp_encode_rational(cardano_unit_interval_t* interval, cardano_plutus_data_t** out)
+{
+  const uint64_t num = cardano_unit_interval_get_numerator(interval);
+  const uint64_t den = cardano_unit_interval_get_denominator(interval);
+  const uint64_t gcd = pp_gcd(num, den);
+
+  uint64_t reduced_num = num;
+  uint64_t reduced_den = den;
+
+  if (gcd != 0U)
+  {
+    reduced_num = num / gcd;
+    reduced_den = den / gcd;
+  }
+
+  cardano_plutus_list_t* list   = NULL;
+  cardano_plutus_data_t* num_pd = NULL;
+  cardano_plutus_data_t* den_pd = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(reduced_num, &num_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(reduced_den, &den_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(list, num_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(list, den_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+  cardano_plutus_data_unref(&num_pd);
+  cardano_plutus_data_unref(&den_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes ExUnits as List [I mem, I steps].
+ */
+static cardano_error_t
+pp_encode_ex_units(cardano_ex_units_t* ex_units, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list    = NULL;
+  cardano_plutus_data_t* mem_pd  = NULL;
+  cardano_plutus_data_t* step_pd = NULL;
+  cardano_error_t        result  = cardano_plutus_list_new(&list);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(cardano_ex_units_get_memory(ex_units), &mem_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(cardano_ex_units_get_cpu_steps(ex_units), &step_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(list, mem_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(list, step_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+  cardano_plutus_data_unref(&mem_pd);
+  cardano_plutus_data_unref(&step_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes an optional rational the way the ledger encodes a StrictMaybe:
+ * Constr 1 [] when the value is absent and Constr 0 [rational] when it is present.
+ */
+static cardano_error_t
+pp_encode_optional_rational(cardano_unit_interval_t* interval, cardano_plutus_data_t** out)
+{
+  static const uint64_t just_alternative    = 0U;
+  static const uint64_t nothing_alternative = 1U;
+
+  cardano_plutus_list_t*        fields = NULL;
+  cardano_plutus_data_t*        value  = NULL;
+  cardano_constr_plutus_data_t* constr = NULL;
+  cardano_error_t               result = cardano_plutus_list_new(&fields);
+
+  if ((result == CARDANO_SUCCESS) && (interval != NULL))
+  {
+    result = pp_encode_rational(interval, &value);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(fields, value);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_constr_plutus_data_new((interval != NULL) ? just_alternative : nothing_alternative, fields, &constr);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_constr(constr, out);
+  }
+
+  cardano_constr_plutus_data_unref(&constr);
+  cardano_plutus_data_unref(&value);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Encodes an optional unsigned integer the way the ledger encodes a StrictMaybe:
+ * Constr 1 [] when the value is absent and Constr 0 [I n] when it is present.
+ */
+static cardano_error_t
+pp_encode_optional_uint(const uint64_t* value, cardano_plutus_data_t** out)
+{
+  static const uint64_t just_alternative    = 0U;
+  static const uint64_t nothing_alternative = 1U;
+
+  cardano_plutus_list_t*        fields  = NULL;
+  cardano_plutus_data_t*        integer = NULL;
+  cardano_constr_plutus_data_t* constr  = NULL;
+  cardano_error_t               result  = cardano_plutus_list_new(&fields);
+
+  if ((result == CARDANO_SUCCESS) && (value != NULL))
+  {
+    result = pp_encode_uint(*value, &integer);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(fields, integer);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_constr_plutus_data_new((value != NULL) ? just_alternative : nothing_alternative, fields, &constr);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_constr(constr, out);
+  }
+
+  cardano_constr_plutus_data_unref(&constr);
+  cardano_plutus_data_unref(&integer);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Encodes ExUnitPrices as List [rational mem, rational steps].
+ */
+static cardano_error_t
+pp_encode_prices(cardano_ex_unit_prices_t* prices, cardano_plutus_data_t** out)
+{
+  cardano_unit_interval_t* mem    = NULL;
+  cardano_unit_interval_t* steps  = NULL;
+  cardano_plutus_list_t*   list   = NULL;
+  cardano_plutus_data_t*   mem_pd = NULL;
+  cardano_plutus_data_t*   stp_pd = NULL;
+  cardano_error_t          result = cardano_ex_unit_prices_get_memory_prices(prices, &mem);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_ex_unit_prices_get_steps_prices(prices, &steps);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_new(&list);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = pp_encode_rational(mem, &mem_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = pp_encode_rational(steps, &stp_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(list, mem_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(list, stp_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_unit_interval_unref(&mem);
+  cardano_unit_interval_unref(&steps);
+  cardano_plutus_list_unref(&list);
+  cardano_plutus_data_unref(&mem_pd);
+  cardano_plutus_data_unref(&stp_pd);
+
+  return result;
+}
+
+/**
+ * \brief Appends a unit interval, as a rational, to a plutus list.
+ */
+static cardano_error_t
+pp_append_rational(cardano_plutus_list_t* list, cardano_unit_interval_t* interval)
+{
+  cardano_plutus_data_t* pd     = NULL;
+  cardano_error_t        result = pp_encode_rational(interval, &pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(list, pd);
+  }
+
+  cardano_plutus_data_unref(&pd);
+  cardano_unit_interval_unref(&interval);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the pool voting thresholds as List of 5 rationals.
+ */
+static cardano_error_t
+pp_encode_pool_thresholds(cardano_pool_voting_thresholds_t* t, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t*   list   = NULL;
+  cardano_unit_interval_t* v      = NULL;
+  cardano_error_t          result = cardano_plutus_list_new(&list);
+
+  if ((result == CARDANO_SUCCESS) && (cardano_pool_voting_thresholds_get_motion_no_confidence(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_pool_voting_thresholds_get_committee_normal(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_pool_voting_thresholds_get_committee_no_confidence(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_pool_voting_thresholds_get_hard_fork_initiation(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_pool_voting_thresholds_get_security_relevant_param(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the DRep voting thresholds as List of 10 rationals.
+ */
+static cardano_error_t
+pp_encode_drep_thresholds(cardano_drep_voting_thresholds_t* t, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t*   list   = NULL;
+  cardano_unit_interval_t* v      = NULL;
+  cardano_error_t          result = cardano_plutus_list_new(&list);
+
+  if ((result == CARDANO_SUCCESS) && (cardano_drep_voting_thresholds_get_motion_no_confidence(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_drep_voting_thresholds_get_committee_normal(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_drep_voting_thresholds_get_committee_no_confidence(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_drep_voting_thresholds_get_update_constitution(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_drep_voting_thresholds_get_hard_fork_initiation(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_drep_voting_thresholds_get_pp_network_group(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_drep_voting_thresholds_get_pp_economic_group(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_drep_voting_thresholds_get_pp_technical_group(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_drep_voting_thresholds_get_pp_governance_group(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cardano_drep_voting_thresholds_get_treasury_withdrawal(t, &v) == CARDANO_SUCCESS))
+  {
+    result = pp_append_rational(list, v);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the cost models as a Map of language id to a list of cost integers.
+ *
+ * Matches the ledger's \c ToPlutusData CostModels = toPlutusData (Map Word8 [Integer]), which holds the cost
+ * models of every language id, known or not, in ascending order of language id.
+ */
+static cardano_error_t
+pp_encode_cost_models(cardano_costmdls_t* costmdls, cardano_plutus_data_t** out)
+{
+  cardano_plutus_map_t* map    = NULL;
+  cardano_error_t       result = cardano_plutus_map_new(&map);
+
+  for (size_t i = 0U; (result == CARDANO_SUCCESS) && (i <= (size_t)UINT8_MAX); ++i)
+  {
+    cardano_cost_model_t* model = NULL;
+
+    result = cardano_costmdls_get_by_language_id(costmdls, (uint8_t)i, &model);
+
+    if ((result != CARDANO_SUCCESS) || (model == NULL))
+    {
+      continue;
+    }
+
+    cardano_plutus_list_t* costs   = NULL;
+    cardano_plutus_data_t* key_pd  = NULL;
+    cardano_plutus_data_t* list_pd = NULL;
+
+    result = cardano_plutus_list_new(&costs);
+
+    const size_t count = cardano_cost_model_get_costs_size(model);
+
+    for (size_t j = 0U; (result == CARDANO_SUCCESS) && (j < count); ++j)
+    {
+      int64_t                cost    = 0;
+      cardano_plutus_data_t* cost_pd = NULL;
+
+      result = cardano_cost_model_get_cost(model, j, &cost);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_data_new_integer_from_int(cost, &cost_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_list_add(costs, cost_pd);
+      }
+
+      cardano_plutus_data_unref(&cost_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_data_new_integer_from_uint((uint64_t)i, &key_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_data_new_list(costs, &list_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_map_insert(map, key_pd, list_pd);
+    }
+
+    cardano_plutus_list_unref(&costs);
+    cardano_plutus_data_unref(&key_pd);
+    cardano_plutus_data_unref(&list_pd);
+    cardano_cost_model_unref(&model);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(map, out);
+  }
+
+  cardano_plutus_map_unref(&map);
+
+  return result;
+}
+
+/**
+ * \brief Inserts a (tag, value) pair into the changed-parameters map.
+ *
+ * The map takes its own reference to \p value; the caller retains ownership of the
+ * value it passed in and releases it afterwards.
+ */
+static cardano_error_t
+pp_map_push(cardano_plutus_map_t* map, uint64_t tag, cardano_plutus_data_t* value)
+{
+  cardano_plutus_data_t* key_pd = NULL;
+  cardano_error_t        result = cardano_plutus_data_new_integer_from_uint(tag, &key_pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_map_insert(map, key_pd, value);
+  }
+
+  cardano_plutus_data_unref(&key_pd);
+
+  return result;
+}
+
+cardano_error_t
+cardano_protocol_param_update_to_plutus_data(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_plutus_data_t**          plutus_data)
+{
+  if ((protocol_param_update == NULL) || (plutus_data == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_map_t* map    = NULL;
+  cardano_error_t       result = cardano_plutus_map_new(&map);
+
+  cardano_protocol_param_update_t* u = protocol_param_update;
+
+  // Scalar parameters: tag -> I value.
+  if ((result == CARDANO_SUCCESS) && (u->min_fee_a != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->min_fee_a, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 0U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->min_fee_b != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->min_fee_b, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 1U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_block_body_size != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->max_block_body_size, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 2U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_tx_size != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->max_tx_size, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 3U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_block_header_size != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->max_block_header_size, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 4U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->key_deposit != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->key_deposit, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 5U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->pool_deposit != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->pool_deposit, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 6U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_epoch != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->max_epoch, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 7U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->n_opt != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->n_opt, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 8U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->pool_pledge_influence != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_rational(u->pool_pledge_influence, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 9U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->expansion_rate != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_rational(u->expansion_rate, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 10U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->treasury_growth_rate != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_rational(u->treasury_growth_rate, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 11U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->min_pool_cost != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->min_pool_cost, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 16U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->ada_per_utxo_byte != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->ada_per_utxo_byte, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 17U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->cost_models != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_cost_models(u->cost_models, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 18U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->execution_costs != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_prices(u->execution_costs, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 19U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_tx_ex_units != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_ex_units(u->max_tx_ex_units, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 20U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_block_ex_units != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_ex_units(u->max_block_ex_units, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 21U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_value_size != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->max_value_size, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 22U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->collateral_percentage != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->collateral_percentage, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 23U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_collateral_inputs != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->max_collateral_inputs, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 24U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->pool_voting_thresholds != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_pool_thresholds(u->pool_voting_thresholds, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 25U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->drep_voting_thresholds != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_drep_thresholds(u->drep_voting_thresholds, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 26U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->min_committee_size != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->min_committee_size, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 27U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->committee_term_limit != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->committee_term_limit, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 28U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->governance_action_validity_period != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->governance_action_validity_period, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 29U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->governance_action_deposit != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->governance_action_deposit, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 30U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->drep_deposit != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->drep_deposit, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 31U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->drep_inactivity_period != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->drep_inactivity_period, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 32U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->ref_script_cost_per_byte != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_rational(u->ref_script_cost_per_byte, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 33U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_ref_script_size_per_block != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->max_ref_script_size_per_block, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 34U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_ref_script_size_per_tx != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->max_ref_script_size_per_tx, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 35U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->ref_script_cost_stride != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->ref_script_cost_stride, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 36U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->ref_script_cost_multiplier != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_rational(u->ref_script_cost_multiplier, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 37U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->has_max_pledge_leverage))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_optional_rational(u->max_pledge_leverage, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 38U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->min_pool_margin != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_rational(u->min_pool_margin, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 39U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->leios_announcement_period_length != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->leios_announcement_period_length, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 40U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->leios_vote_period_length != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->leios_vote_period_length, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 41U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->leios_diffusion_period_length != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->leios_diffusion_period_length, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 42U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->leios_committee_size != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->leios_committee_size, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 43U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->leios_quorum_stake_threshold != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_rational(u->leios_quorum_stake_threshold, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 44U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_endorser_block_references_size != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->max_endorser_block_references_size, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 45U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_endorser_block_txs_size != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->max_endorser_block_txs_size, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 46U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_endorser_block_execution_units != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_ex_units(u->max_endorser_block_execution_units, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 47U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->max_ref_script_size_per_endorser_block != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->max_ref_script_size_per_endorser_block, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 48U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->peras_min_candidate_block_age != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->peras_min_candidate_block_age, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 49U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->peras_healing_factor != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_rational(u->peras_healing_factor, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 50U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->peras_cert_boost != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->peras_cert_boost, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 51U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->peras_target_committee_size != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->peras_target_committee_size, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 52U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->has_peras_bootstrap_round))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_optional_uint(u->peras_bootstrap_round, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 53U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->peras_quorum_threshold_safety_margin != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_rational(u->peras_quorum_threshold_safety_margin, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 54U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->ref_inputs_cost_per_multi_asset_byte != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->ref_inputs_cost_per_multi_asset_byte, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 55U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (u->ref_inputs_cost_per_datum_byte != NULL))
+  {
+    cardano_plutus_data_t* v = NULL;
+    result                   = pp_encode_uint(*u->ref_inputs_cost_per_datum_byte, &v);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = pp_map_push(map, 56U, v);
+    }
+
+    cardano_plutus_data_unref(&v);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(map, plutus_data);
+  }
+
+  cardano_plutus_map_unref(&map);
+
+  return result;
+}
+
+/* STATIC DECLARATIONS *******************************************************/
+
+/**
+ * \brief Type definition for a parameter handler function.
+ *
+ * This type defines a function pointer used for handling protocol parameter fields
+ * when reading from a CBOR reader. Each handler function reads a specific type of
+ * field from the CBOR reader and stores the result in the specified field pointer.
+ *
+ * The function pointed to by `param_handler_t` is responsible for:
+ * - Reading the field value from the provided CBOR reader.
+ * - Storing the field value in the provided field pointer.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the field value.
+ * \param[out] field_ptr A pointer to the field where the read value should be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the field was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+typedef cardano_error_t (*param_handler_t)(cardano_cbor_reader_t*, void*);
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a protocol parameters update object.
+ *
+ * This function is responsible for properly deallocating a protocol parameters update object (`cardano_protocol_param_update_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the protocol_param_update object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_protocol_param_update_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the protocol_param_update
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_protocol_param_update_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_protocol_param_update_t* data = (cardano_protocol_param_update_t*)object;
+
+  _cardano_free(data->min_fee_a);
+  _cardano_free(data->min_fee_b);
+  _cardano_free(data->max_block_body_size);
+  _cardano_free(data->max_tx_size);
+  _cardano_free(data->max_block_header_size);
+  _cardano_free(data->key_deposit);
+  _cardano_free(data->pool_deposit);
+  _cardano_free(data->max_epoch);
+  _cardano_free(data->n_opt);
+  cardano_unit_interval_unref(&data->pool_pledge_influence);
+  cardano_unit_interval_unref(&data->expansion_rate);
+  cardano_unit_interval_unref(&data->treasury_growth_rate);
+  cardano_unit_interval_unref(&data->d);
+  cardano_buffer_unref(&data->extra_entropy);
+  cardano_protocol_version_unref(&data->protocol_version);
+  _cardano_free(data->min_pool_cost);
+  _cardano_free(data->ada_per_utxo_byte);
+  cardano_costmdls_unref(&data->cost_models);
+  cardano_ex_unit_prices_unref(&data->execution_costs);
+  cardano_ex_units_unref(&data->max_tx_ex_units);
+  cardano_ex_units_unref(&data->max_block_ex_units);
+  _cardano_free(data->max_value_size);
+  _cardano_free(data->collateral_percentage);
+  _cardano_free(data->max_collateral_inputs);
+  cardano_pool_voting_thresholds_unref(&data->pool_voting_thresholds);
+  cardano_drep_voting_thresholds_unref(&data->drep_voting_thresholds);
+  _cardano_free(data->min_committee_size);
+  _cardano_free(data->committee_term_limit);
+  _cardano_free(data->governance_action_validity_period);
+  _cardano_free(data->governance_action_deposit);
+  _cardano_free(data->drep_deposit);
+  _cardano_free(data->drep_inactivity_period);
+  cardano_unit_interval_unref(&data->ref_script_cost_per_byte);
+  _cardano_free(data->max_ref_script_size_per_block);
+  _cardano_free(data->max_ref_script_size_per_tx);
+  _cardano_free(data->ref_script_cost_stride);
+  cardano_unit_interval_unref(&data->ref_script_cost_multiplier);
+  cardano_unit_interval_unref(&data->max_pledge_leverage);
+  cardano_unit_interval_unref(&data->min_pool_margin);
+  _cardano_free(data->leios_announcement_period_length);
+  _cardano_free(data->leios_vote_period_length);
+  _cardano_free(data->leios_diffusion_period_length);
+  _cardano_free(data->leios_committee_size);
+  cardano_unit_interval_unref(&data->leios_quorum_stake_threshold);
+  _cardano_free(data->max_endorser_block_references_size);
+  _cardano_free(data->max_endorser_block_txs_size);
+  cardano_ex_units_unref(&data->max_endorser_block_execution_units);
+  _cardano_free(data->max_ref_script_size_per_endorser_block);
+  _cardano_free(data->peras_min_candidate_block_age);
+  cardano_unit_interval_unref(&data->peras_healing_factor);
+  _cardano_free(data->peras_cert_boost);
+  _cardano_free(data->peras_target_committee_size);
+  _cardano_free(data->peras_bootstrap_round);
+  cardano_unit_interval_unref(&data->peras_quorum_threshold_safety_margin);
+  _cardano_free(data->ref_inputs_cost_per_multi_asset_byte);
+  _cardano_free(data->ref_inputs_cost_per_datum_byte);
+
+  _cardano_free(object);
+}
+
+/**
+ * \brief Computes the map size of this update object.
+ *
+ * \param update The update object to compute the map size for.
+ *
+ * \return The map size of the update object.
+ */
+static size_t
+get_map_size(const cardano_protocol_param_update_t* update)
+{
+  assert(update != NULL);
+
+  size_t map_size = 0U;
+
+  if (update->min_fee_a != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->min_fee_b != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_block_body_size != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_tx_size != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_block_header_size != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->key_deposit != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->pool_deposit != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_epoch != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->n_opt != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->pool_pledge_influence != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->expansion_rate != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->treasury_growth_rate != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->d != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->extra_entropy != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->protocol_version != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->min_pool_cost != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->ada_per_utxo_byte != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->cost_models != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->execution_costs != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_tx_ex_units != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_block_ex_units != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_value_size != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->collateral_percentage != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_collateral_inputs != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->pool_voting_thresholds != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->drep_voting_thresholds != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->min_committee_size != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->committee_term_limit != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->governance_action_validity_period != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->governance_action_deposit != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->drep_deposit != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->drep_inactivity_period != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->ref_script_cost_per_byte != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_ref_script_size_per_block != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_ref_script_size_per_tx != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->ref_script_cost_stride != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->ref_script_cost_multiplier != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->has_max_pledge_leverage)
+  {
+    ++map_size;
+  }
+
+  if (update->min_pool_margin != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->leios_announcement_period_length != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->leios_vote_period_length != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->leios_diffusion_period_length != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->leios_committee_size != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->leios_quorum_stake_threshold != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_endorser_block_references_size != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_endorser_block_txs_size != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_endorser_block_execution_units != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->max_ref_script_size_per_endorser_block != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->peras_min_candidate_block_age != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->peras_healing_factor != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->peras_cert_boost != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->peras_target_committee_size != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->has_peras_bootstrap_round)
+  {
+    ++map_size;
+  }
+
+  if (update->peras_quorum_threshold_safety_margin != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->ref_inputs_cost_per_multi_asset_byte != NULL)
+  {
+    ++map_size;
+  }
+
+  if (update->ref_inputs_cost_per_datum_byte != NULL)
+  {
+    ++map_size;
+  }
+
+  return map_size;
+}
+
+/**
+ * \brief Retrieves a pointer to the specified field in the protocol parameter update object.
+ *
+ * This function returns a pointer to the field specified by the key in the given protocol
+ * parameter update object. The key corresponds to different fields within the update object.
+ * If the key does not correspond to any field, NULL is returned.
+ *
+ * \param[in] update Pointer to the protocol parameter update object.
+ *
+ * \return void* A pointer to the specified field, or NULL if the key does not correspond to any field.
+ *
+ * \note The caller must ensure that the `update` pointer is not NULL before calling this function.
+ */
+static void*
+get_field_ptr(cardano_protocol_param_update_t* update, size_t key)
+{
+  assert(update != NULL);
+
+  switch (key)
+  {
+    case 0:
+      return (void*)&update->min_fee_a;
+    case 1:
+      return (void*)&update->min_fee_b;
+    case 2:
+      return (void*)&update->max_block_body_size;
+    case 3:
+      return (void*)&update->max_tx_size;
+    case 4:
+      return (void*)&update->max_block_header_size;
+    case 5:
+      return (void*)&update->key_deposit;
+    case 6:
+      return (void*)&update->pool_deposit;
+    case 7:
+      return (void*)&update->max_epoch;
+    case 8:
+      return (void*)&update->n_opt;
+    case 9:
+      return (void*)&update->pool_pledge_influence;
+    case 10:
+      return (void*)&update->expansion_rate;
+    case 11:
+      return (void*)&update->treasury_growth_rate;
+    case 12:
+      return (void*)&update->d;
+    case 13:
+      return (void*)&update->extra_entropy;
+    case 14:
+      return (void*)&update->protocol_version;
+    case 16:
+      return (void*)&update->min_pool_cost;
+    case 17:
+      return (void*)&update->ada_per_utxo_byte;
+    case 18:
+      return (void*)&update->cost_models;
+    case 19:
+      return (void*)&update->execution_costs;
+    case 20:
+      return (void*)&update->max_tx_ex_units;
+    case 21:
+      return (void*)&update->max_block_ex_units;
+    case 22:
+      return (void*)&update->max_value_size;
+    case 23:
+      return (void*)&update->collateral_percentage;
+    case 24:
+      return (void*)&update->max_collateral_inputs;
+    case 25:
+      return (void*)&update->pool_voting_thresholds;
+    case 26:
+      return (void*)&update->drep_voting_thresholds;
+    case 27:
+      return (void*)&update->min_committee_size;
+    case 28:
+      return (void*)&update->committee_term_limit;
+    case 29:
+      return (void*)&update->governance_action_validity_period;
+    case 30:
+      return (void*)&update->governance_action_deposit;
+    case 31:
+      return (void*)&update->drep_deposit;
+    case 32:
+      return (void*)&update->drep_inactivity_period;
+    case 33:
+      return (void*)&update->ref_script_cost_per_byte;
+    case 34:
+      return (void*)&update->max_ref_script_size_per_block;
+    case 35:
+      return (void*)&update->max_ref_script_size_per_tx;
+    case 36:
+      return (void*)&update->ref_script_cost_stride;
+    case 37:
+      return (void*)&update->ref_script_cost_multiplier;
+    case 38:
+      return (void*)update;
+    case 39:
+      return (void*)&update->min_pool_margin;
+    case 40:
+      return (void*)&update->leios_announcement_period_length;
+    case 41:
+      return (void*)&update->leios_vote_period_length;
+    case 42:
+      return (void*)&update->leios_diffusion_period_length;
+    case 43:
+      return (void*)&update->leios_committee_size;
+    case 44:
+      return (void*)&update->leios_quorum_stake_threshold;
+    case 45:
+      return (void*)&update->max_endorser_block_references_size;
+    case 46:
+      return (void*)&update->max_endorser_block_txs_size;
+    case 47:
+      return (void*)&update->max_endorser_block_execution_units;
+    case 48:
+      return (void*)&update->max_ref_script_size_per_endorser_block;
+    case 49:
+      return (void*)&update->peras_min_candidate_block_age;
+    case 50:
+      return (void*)&update->peras_healing_factor;
+    case 51:
+      return (void*)&update->peras_cert_boost;
+    case 52:
+      return (void*)&update->peras_target_committee_size;
+    case 53:
+      return (void*)update;
+    case 54:
+      return (void*)&update->peras_quorum_threshold_safety_margin;
+    case 55:
+      return (void*)&update->ref_inputs_cost_per_multi_asset_byte;
+    case 56:
+      return (void*)&update->ref_inputs_cost_per_datum_byte;
+
+    default:
+      return NULL;
+  }
+}
+
+/**
+ * \brief Reads a uint64_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a uint64_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as uint64_t in the protocol parameter update.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the uint64_t value.
+ * \param[out] field_ptr A pointer to the field where the read uint64_t value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the uint64_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_uint64(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_cbor_reader_read_uint(reader, *field);
+}
+
+/**
+ * \brief Reads a 32-bit bounded unsigned integer from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads an unsigned integer from the provided CBOR reader, validates that it fits
+ * in 32 bits and stores the result in the specified field pointer. It is used as a handler
+ * function for parameters whose wire format is a 32-bit unsigned integer.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the value.
+ * \param[out] field_ptr A pointer to the field where the read value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_uint32(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  uint64_t value = 0U;
+
+  cardano_error_t result = cardano_cbor_validate_uint_in_range("protocol_param_update", "parameter", reader, &value, 0U, UINT32_MAX);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  **field = value;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a positive 32-bit bounded unsigned integer from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads an unsigned integer from the provided CBOR reader, validates that it is
+ * greater than zero and fits in 32 bits, and stores the result in the specified field pointer.
+ * It is used as a handler function for parameters whose wire format is a positive 32-bit
+ * unsigned integer.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the value.
+ * \param[out] field_ptr A pointer to the field where the read value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_positive_uint32(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  uint64_t value = 0U;
+
+  cardano_error_t result = cardano_cbor_validate_uint_in_range("protocol_param_update", "parameter", reader, &value, 1U, UINT32_MAX);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  **field = value;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a 16-bit bounded unsigned integer from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads an unsigned integer from the provided CBOR reader, validates that it fits
+ * in 16 bits and stores the result in the specified field pointer. It is used as a handler
+ * function for parameters whose wire format is a 16-bit unsigned integer.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the value.
+ * \param[out] field_ptr A pointer to the field where the read value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_uint16(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  uint64_t value = 0U;
+
+  cardano_error_t result = cardano_cbor_validate_uint_in_range("protocol_param_update", "parameter", reader, &value, 0U, UINT16_MAX);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  **field = value;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a unit interval value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a unit interval value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as `cardano_unit_interval_t` in the protocol parameter update.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the unit interval value.
+ * \param[out] field_ptr A pointer to the field where the read unit interval value should be stored.
+ *                       The field pointer should be of type `cardano_unit_interval_t**`.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the unit interval value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_unit_interval(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_unit_interval_t** field = (cardano_unit_interval_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_unit_interval_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads the maximum pledge leverage from the CBOR reader and stores it in the update.
+ *
+ * The maximum pledge leverage is a nullable parameter: the wire value is either a nonnegative
+ * interval (a bounded leverage) or CBOR null (an unbounded leverage). Both forms mark the
+ * parameter as present in the update; the null form leaves the stored interval NULL.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the value.
+ * \param[out] field_ptr A pointer to the protocol parameter update object that receives the value.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_max_pledge_leverage(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_protocol_param_update_t* update = (cardano_protocol_param_update_t*)field_ptr;
+
+  if (update->has_max_pledge_leverage)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  cardano_cbor_reader_state_t state  = CARDANO_CBOR_READER_STATE_UNDEFINED;
+  cardano_error_t             result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    result = cardano_cbor_reader_read_null(reader);
+  }
+  else
+  {
+    result = cardano_unit_interval_from_cbor(reader, &update->max_pledge_leverage);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  update->has_max_pledge_leverage = true;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads the Peras bootstrap round from the CBOR reader and stores it in the update.
+ *
+ * The Peras bootstrap round is a nullable parameter: the wire value is either a 32-bit unsigned
+ * integer (the round at which voting is manually bootstrapped) or CBOR null (no bootstrap round).
+ * Both forms mark the parameter as present in the update; the null form leaves the stored round NULL.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the value.
+ * \param[out] field_ptr A pointer to the protocol parameter update object that receives the value.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_peras_bootstrap_round(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_protocol_param_update_t* update = (cardano_protocol_param_update_t*)field_ptr;
+
+  if (update->has_peras_bootstrap_round)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  cardano_cbor_reader_state_t state  = CARDANO_CBOR_READER_STATE_UNDEFINED;
+  cardano_error_t             result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    result = cardano_cbor_reader_read_null(reader);
+  }
+  else
+  {
+    result = handle_uint32(reader, (void*)&update->peras_bootstrap_round);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  update->has_peras_bootstrap_round = true;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads an entropy value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads an entropy value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as `cardano_buffer_t*` in the protocol parameter update.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the entropy value.
+ * \param[out] field_ptr A pointer to the field where the read entropy value should be stored.
+ *                       The field pointer should be of type `cardano_buffer_t**`.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the entropy value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_entropy(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_buffer_t** field = (cardano_buffer_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  int64_t array_size = 0;
+
+  cardano_error_t read_extra_entropy_array = cardano_cbor_reader_read_start_array(reader, &array_size);
+
+  if (read_extra_entropy_array != CARDANO_SUCCESS)
+  {
+    return read_extra_entropy_array;
+  }
+
+  uint64_t entropy_key = 0U;
+
+  cardano_error_t read_extra_entropy = cardano_cbor_reader_read_uint(reader, &entropy_key);
+
+  if (read_extra_entropy != CARDANO_SUCCESS)
+  {
+    return read_extra_entropy;
+  }
+
+  if (array_size == 1)
+  {
+    (*field) = cardano_buffer_new(1);
+
+    return cardano_cbor_validate_end_array("entropy", reader);
+  }
+
+  if (array_size != 2)
+  {
+    return CARDANO_ERROR_INVALID_CBOR_ARRAY_SIZE;
+  }
+
+  read_extra_entropy = cardano_cbor_reader_read_bytestring(reader, field);
+
+  if (read_extra_entropy != CARDANO_SUCCESS)
+  {
+    return read_extra_entropy;
+  }
+
+  return cardano_cbor_validate_end_array("entropy", reader);
+}
+
+/**
+ * \brief Reads a protocol version value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a protocol version value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as `cardano_protocol_version_t*` in the protocol parameter update.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the protocol version value.
+ * \param[out] field_ptr A pointer to the field where the read protocol version value should be stored.
+ *                       The field pointer should be of type `cardano_protocol_version_t**`.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the protocol version value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_protocol_version(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_protocol_version_t** field = (cardano_protocol_version_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_protocol_version_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a cost models value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cost models value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as `cardano_costmdls_t*` in the protocol parameter update.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cost models value.
+ * \param[out] field_ptr A pointer to the field where the read cost models value should be stored.
+ *                       The field pointer should be of type `cardano_costmdls_t**`.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cost models value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_cost_models(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_costmdls_t** field = (cardano_costmdls_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_costmdls_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads an execution unit prices value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads an execution unit prices value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as `cardano_ex_unit_prices_t*` in the protocol parameter update.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the execution unit prices value.
+ * \param[out] field_ptr A pointer to the field where the read execution unit prices value should be stored.
+ *                       The field pointer should be of type `cardano_ex_unit_prices_t**`.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the execution unit prices value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_ex_unit_prices(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_ex_unit_prices_t** field = (cardano_ex_unit_prices_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_ex_unit_prices_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads an execution unit prices value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads an execution unit prices value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as `cardano_ex_unit_prices_t*` in the protocol parameter update.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the execution unit prices value.
+ * \param[out] field_ptr A pointer to the field where the read execution unit prices value should be stored.
+ *                       The field pointer should be of type `cardano_ex_unit_prices_t**`.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the execution unit prices value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_ex_units(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_ex_units_t** field = (cardano_ex_units_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_ex_units_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a pool voting thresholds value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a pool voting thresholds value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as `cardano_pool_voting_thresholds_t*` in the protocol parameter update.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the pool voting thresholds value.
+ * \param[out] field_ptr A pointer to the field where the read pool voting thresholds value should be stored.
+ *                       The field pointer should be of type `cardano_pool_voting_thresholds_t**`.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the pool voting thresholds value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_pool_voting_thresholds(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_pool_voting_thresholds_t** field = (cardano_pool_voting_thresholds_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_pool_voting_thresholds_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a DRep voting thresholds value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a DRep voting thresholds value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as `cardano_drep_voting_thresholds_t*` in the protocol parameter update.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the DRep voting thresholds value.
+ * \param[out] field_ptr A pointer to the field where the read DRep voting thresholds value should be stored.
+ *                       The field pointer should be of type `cardano_drep_voting_thresholds_t**`.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the DRep voting thresholds value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_drep_voting_thresholds(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_drep_voting_thresholds_t** field = (cardano_drep_voting_thresholds_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_drep_voting_thresholds_from_cbor(reader, field);
+}
+
+/**
+ * \brief Handles an invalid key in the CBOR map during deserialization.
+ *
+ * This function is used as a handler for invalid keys encountered in the CBOR map.
+ * It does nothing with the provided reader and field pointer, and always returns
+ * \ref CARDANO_ERROR_INVALID_CBOR_MAP_KEY to indicate the error.
+ *
+ * \param[in] reader A pointer to the CBOR reader. This parameter is unused.
+ * \param[in] field_ptr A pointer to the field where the value should be stored. This parameter is unused.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - Always returns \ref CARDANO_ERROR_INVALID_CBOR_MAP_KEY.
+ */
+static cardano_error_t
+handle_invalid_key(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  CARDANO_UNUSED(reader);
+  CARDANO_UNUSED(field_ptr);
+
+  return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated unsigned integer value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the unsigned integer value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_uint_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const uint64_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, *value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated unit interval value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the unit interval value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_unit_interval_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_unit_interval_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_unit_interval_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key and its nullable unit interval value to the CBOR writer if the parameter is present.
+ *
+ * This function writes a key and its associated unit interval value to the CBOR writer only if
+ * the parameter is marked as present. A present parameter whose value is NULL is written as
+ * CBOR null, which proposes lifting the bound. If the parameter is not present, the function
+ * does nothing and returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] is_present Whether the parameter is part of the update.
+ * \param[in] value A pointer to the unit interval value to be written. If NULL, CBOR null is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the parameter is absent.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_nullable_unit_interval_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const bool is_present, const cardano_unit_interval_t* value)
+{
+  assert(writer != NULL);
+
+  if (!is_present)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (value == NULL)
+  {
+    return cardano_cbor_writer_write_null(writer);
+  }
+
+  return cardano_unit_interval_to_cbor(value, writer);
+}
+
+/**
+ * \brief Writes a key and its nullable unsigned integer value to the CBOR writer if the parameter is present.
+ *
+ * This function writes a key and its associated unsigned integer value to the CBOR writer only if
+ * the parameter is marked as present. A present parameter whose value is NULL is written as
+ * CBOR null. If the parameter is not present, the function does nothing and returns
+ * \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] is_present Whether the parameter is part of the update.
+ * \param[in] value A pointer to the unsigned integer value to be written. If NULL, CBOR null is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the parameter is absent.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_nullable_uint_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const bool is_present, const uint64_t* value)
+{
+  assert(writer != NULL);
+
+  if (!is_present)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (value == NULL)
+  {
+    return cardano_cbor_writer_write_null(writer);
+  }
+
+  return cardano_cbor_writer_write_uint(writer, *value);
+}
+
+/**
+ * \brief Writes a key-value pair for entropy to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated entropy value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the entropy buffer value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_entropy_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_buffer_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (cardano_buffer_get_size(value) == 0U)
+    {
+      result = cardano_cbor_writer_write_start_array(writer, 1U);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_cbor_writer_write_uint(writer, 0U);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      return CARDANO_SUCCESS;
+    }
+
+    result = cardano_cbor_writer_write_start_array(writer, 2U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, 1U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_bytestring(writer, cardano_buffer_get_data(value), cardano_buffer_get_size(value));
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair for the protocol version to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated protocol version value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the protocol version value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_protocol_version_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_protocol_version_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_protocol_version_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair for the cost models to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated cost models value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the cost models value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_cost_models_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_costmdls_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_costmdls_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair for the ex unit prices to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated ex unit prices value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the ex unit prices value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_ex_unit_prices_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_ex_unit_prices_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_ex_unit_prices_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair for the execution unit prices to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated execution unit prices value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the execution unit prices value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_ex_units_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_ex_units_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_ex_units_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair for the pool voting thresholds to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated pool voting thresholds value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the pool voting thresholds value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_pool_voting_thresholds_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_pool_voting_thresholds_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_pool_voting_thresholds_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair for the DRep voting thresholds to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated DRep voting thresholds value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the DRep voting thresholds value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_drep_voting_thresholds_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_drep_voting_thresholds_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_drep_voting_thresholds_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/* STATIC CONSTANTS ***********************************************************/
+
+// cppcheck-suppress misra-c2012-8.9; Reason: Is more readable to define the map here
+static const param_handler_t param_handlers[] = {
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_unit_interval,
+  handle_unit_interval,
+  handle_unit_interval,
+  handle_unit_interval,
+  handle_entropy,
+  handle_protocol_version,
+  handle_invalid_key, // unused key
+  handle_uint64,
+  handle_uint64,
+  handle_cost_models,
+  handle_ex_unit_prices,
+  handle_ex_units,
+  handle_ex_units,
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_pool_voting_thresholds,
+  handle_drep_voting_thresholds,
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_uint64,
+  handle_unit_interval,
+  handle_uint32,
+  handle_uint32,
+  handle_positive_uint32,
+  handle_unit_interval,
+  handle_max_pledge_leverage,
+  handle_unit_interval,
+  handle_uint32,
+  handle_uint32,
+  handle_uint32,
+  handle_uint16,
+  handle_unit_interval,
+  handle_uint32,
+  handle_uint32,
+  handle_ex_units,
+  handle_uint32,
+  handle_uint32,
+  handle_unit_interval,
+  handle_uint16,
+  handle_uint16,
+  handle_peras_bootstrap_round,
+  handle_unit_interval,
+  handle_uint64,
+  handle_uint64
+};
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_protocol_param_update_new(cardano_protocol_param_update_t** protocol_param_update)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *protocol_param_update = _cardano_malloc(sizeof(cardano_protocol_param_update_t));
+
+  if (*protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*protocol_param_update)->base.deallocator   = cardano_protocol_param_update_deallocate;
+  (*protocol_param_update)->base.ref_count     = 1;
+  (*protocol_param_update)->base.last_error[0] = '\0';
+
+  (*protocol_param_update)->min_fee_a                              = NULL;
+  (*protocol_param_update)->min_fee_b                              = NULL;
+  (*protocol_param_update)->max_block_body_size                    = NULL;
+  (*protocol_param_update)->max_tx_size                            = NULL;
+  (*protocol_param_update)->max_block_header_size                  = NULL;
+  (*protocol_param_update)->key_deposit                            = NULL;
+  (*protocol_param_update)->pool_deposit                           = NULL;
+  (*protocol_param_update)->max_epoch                              = NULL;
+  (*protocol_param_update)->n_opt                                  = NULL;
+  (*protocol_param_update)->pool_pledge_influence                  = NULL;
+  (*protocol_param_update)->expansion_rate                         = NULL;
+  (*protocol_param_update)->treasury_growth_rate                   = NULL;
+  (*protocol_param_update)->d                                      = NULL;
+  (*protocol_param_update)->extra_entropy                          = NULL;
+  (*protocol_param_update)->protocol_version                       = NULL;
+  (*protocol_param_update)->min_pool_cost                          = NULL;
+  (*protocol_param_update)->ada_per_utxo_byte                      = NULL;
+  (*protocol_param_update)->cost_models                            = NULL;
+  (*protocol_param_update)->execution_costs                        = NULL;
+  (*protocol_param_update)->max_tx_ex_units                        = NULL;
+  (*protocol_param_update)->max_block_ex_units                     = NULL;
+  (*protocol_param_update)->max_value_size                         = NULL;
+  (*protocol_param_update)->collateral_percentage                  = NULL;
+  (*protocol_param_update)->max_collateral_inputs                  = NULL;
+  (*protocol_param_update)->pool_voting_thresholds                 = NULL;
+  (*protocol_param_update)->drep_voting_thresholds                 = NULL;
+  (*protocol_param_update)->min_committee_size                     = NULL;
+  (*protocol_param_update)->committee_term_limit                   = NULL;
+  (*protocol_param_update)->governance_action_validity_period      = NULL;
+  (*protocol_param_update)->governance_action_deposit              = NULL;
+  (*protocol_param_update)->drep_deposit                           = NULL;
+  (*protocol_param_update)->drep_inactivity_period                 = NULL;
+  (*protocol_param_update)->ref_script_cost_per_byte               = NULL;
+  (*protocol_param_update)->max_ref_script_size_per_block          = NULL;
+  (*protocol_param_update)->max_ref_script_size_per_tx             = NULL;
+  (*protocol_param_update)->ref_script_cost_stride                 = NULL;
+  (*protocol_param_update)->ref_script_cost_multiplier             = NULL;
+  (*protocol_param_update)->has_max_pledge_leverage                = false;
+  (*protocol_param_update)->max_pledge_leverage                    = NULL;
+  (*protocol_param_update)->min_pool_margin                        = NULL;
+  (*protocol_param_update)->leios_announcement_period_length       = NULL;
+  (*protocol_param_update)->leios_vote_period_length               = NULL;
+  (*protocol_param_update)->leios_diffusion_period_length          = NULL;
+  (*protocol_param_update)->leios_committee_size                   = NULL;
+  (*protocol_param_update)->leios_quorum_stake_threshold           = NULL;
+  (*protocol_param_update)->max_endorser_block_references_size     = NULL;
+  (*protocol_param_update)->max_endorser_block_txs_size            = NULL;
+  (*protocol_param_update)->max_endorser_block_execution_units     = NULL;
+  (*protocol_param_update)->max_ref_script_size_per_endorser_block = NULL;
+  (*protocol_param_update)->peras_min_candidate_block_age          = NULL;
+  (*protocol_param_update)->peras_healing_factor                   = NULL;
+  (*protocol_param_update)->peras_cert_boost                       = NULL;
+  (*protocol_param_update)->peras_target_committee_size            = NULL;
+  (*protocol_param_update)->has_peras_bootstrap_round              = false;
+  (*protocol_param_update)->peras_bootstrap_round                  = NULL;
+  (*protocol_param_update)->peras_quorum_threshold_safety_margin   = NULL;
+  (*protocol_param_update)->ref_inputs_cost_per_multi_asset_byte   = NULL;
+  (*protocol_param_update)->ref_inputs_cost_per_datum_byte         = NULL;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_from_cbor(cardano_cbor_reader_t* reader, cardano_protocol_param_update_t** protocol_param_update)
+{
+  if (!reader || !protocol_param_update)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *protocol_param_update                  = NULL;
+  cardano_protocol_param_update_t* update = NULL;
+  cardano_error_t                  result = cardano_protocol_param_update_new(&update);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t map_size = 0;
+  result           = cardano_cbor_reader_read_start_map(reader, &map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_protocol_param_update_unref(&update);
+
+    return result;
+  }
+
+  for (size_t i = 0U; i < (size_t)map_size; ++i)
+  {
+    uint64_t key = 0;
+    result       = cardano_cbor_reader_read_uint(reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_protocol_param_update_unref(&update);
+
+      return result;
+    }
+
+    if (key >= (sizeof(param_handlers) / sizeof(param_handlers[0])))
+    {
+      cardano_protocol_param_update_unref(&update);
+
+      return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+    }
+
+    void* field_ptr = get_field_ptr(update, key);
+
+    if (field_ptr == NULL)
+    {
+      cardano_protocol_param_update_unref(&update);
+
+      return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+    }
+
+    result = param_handlers[key](reader, field_ptr);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_protocol_param_update_unref(&update);
+
+      return result;
+    }
+  }
+
+  *protocol_param_update = update;
+
+  return cardano_cbor_validate_end_map("protocol_param_update", reader);
+}
+
+cardano_error_t
+cardano_protocol_param_update_to_cbor(const cardano_protocol_param_update_t* protocol_param_update, cardano_cbor_writer_t* writer)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t map_size = get_map_size(protocol_param_update);
+
+  cardano_error_t result = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 0U, protocol_param_update->min_fee_a);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 1U, protocol_param_update->min_fee_b);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 2U, protocol_param_update->max_block_body_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 3U, protocol_param_update->max_tx_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 4U, protocol_param_update->max_block_header_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 5U, protocol_param_update->key_deposit);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 6U, protocol_param_update->pool_deposit);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 7U, protocol_param_update->max_epoch);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 8U, protocol_param_update->n_opt);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_unit_interval_if_present(writer, 9U, protocol_param_update->pool_pledge_influence);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_unit_interval_if_present(writer, 10U, protocol_param_update->expansion_rate);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_unit_interval_if_present(writer, 11U, protocol_param_update->treasury_growth_rate);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_unit_interval_if_present(writer, 12U, protocol_param_update->d);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_entropy_if_present(writer, 13U, protocol_param_update->extra_entropy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_protocol_version_if_present(writer, 14U, protocol_param_update->protocol_version);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 16U, protocol_param_update->min_pool_cost);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 17U, protocol_param_update->ada_per_utxo_byte);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_cost_models_if_present(writer, 18U, protocol_param_update->cost_models);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_ex_unit_prices_if_present(writer, 19U, protocol_param_update->execution_costs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_ex_units_if_present(writer, 20U, protocol_param_update->max_tx_ex_units);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_ex_units_if_present(writer, 21U, protocol_param_update->max_block_ex_units);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 22U, protocol_param_update->max_value_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 23U, protocol_param_update->collateral_percentage);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 24U, protocol_param_update->max_collateral_inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_pool_voting_thresholds_if_present(writer, 25U, protocol_param_update->pool_voting_thresholds);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_drep_voting_thresholds_if_present(writer, 26U, protocol_param_update->drep_voting_thresholds);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 27U, protocol_param_update->min_committee_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 28U, protocol_param_update->committee_term_limit);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 29U, protocol_param_update->governance_action_validity_period);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 30U, protocol_param_update->governance_action_deposit);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 31U, protocol_param_update->drep_deposit);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 32U, protocol_param_update->drep_inactivity_period);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_unit_interval_if_present(writer, 33U, protocol_param_update->ref_script_cost_per_byte);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 34U, protocol_param_update->max_ref_script_size_per_block);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 35U, protocol_param_update->max_ref_script_size_per_tx);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 36U, protocol_param_update->ref_script_cost_stride);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_unit_interval_if_present(writer, 37U, protocol_param_update->ref_script_cost_multiplier);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_nullable_unit_interval_if_present(writer, 38U, protocol_param_update->has_max_pledge_leverage, protocol_param_update->max_pledge_leverage);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_unit_interval_if_present(writer, 39U, protocol_param_update->min_pool_margin);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 40U, protocol_param_update->leios_announcement_period_length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 41U, protocol_param_update->leios_vote_period_length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 42U, protocol_param_update->leios_diffusion_period_length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 43U, protocol_param_update->leios_committee_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_unit_interval_if_present(writer, 44U, protocol_param_update->leios_quorum_stake_threshold);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 45U, protocol_param_update->max_endorser_block_references_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 46U, protocol_param_update->max_endorser_block_txs_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_ex_units_if_present(writer, 47U, protocol_param_update->max_endorser_block_execution_units);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 48U, protocol_param_update->max_ref_script_size_per_endorser_block);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 49U, protocol_param_update->peras_min_candidate_block_age);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_unit_interval_if_present(writer, 50U, protocol_param_update->peras_healing_factor);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 51U, protocol_param_update->peras_cert_boost);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 52U, protocol_param_update->peras_target_committee_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_nullable_uint_if_present(writer, 53U, protocol_param_update->has_peras_bootstrap_round, protocol_param_update->peras_bootstrap_round);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_unit_interval_if_present(writer, 54U, protocol_param_update->peras_quorum_threshold_safety_margin);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 55U, protocol_param_update->ref_inputs_cost_per_multi_asset_byte);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 56U, protocol_param_update->ref_inputs_cost_per_datum_byte);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_to_cip116_json(
+  const cardano_protocol_param_update_t* update,
+  cardano_json_writer_t*                 writer)
+{
+  if ((update == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  if (update->min_fee_a != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "min_fee_a", 9);
+    cardano_json_writer_write_uint_as_string(writer, *update->min_fee_a);
+  }
+
+  if (update->min_fee_b != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "min_fee_b", 9);
+    cardano_json_writer_write_uint_as_string(writer, *update->min_fee_b);
+  }
+
+  if (update->max_block_body_size != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_block_body_size", 19);
+    cardano_json_writer_write_uint_as_string(writer, *update->max_block_body_size);
+  }
+
+  if (update->max_tx_size != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_tx_size", 11);
+    cardano_json_writer_write_uint_as_string(writer, *update->max_tx_size);
+  }
+
+  if (update->max_block_header_size != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_block_header_size", 21);
+    cardano_json_writer_write_uint_as_string(writer, *update->max_block_header_size);
+  }
+
+  if (update->key_deposit != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "key_deposit", 11);
+    cardano_json_writer_write_uint_as_string(writer, *update->key_deposit);
+  }
+
+  if (update->pool_deposit != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "pool_deposit", 12);
+    cardano_json_writer_write_uint_as_string(writer, *update->pool_deposit);
+  }
+
+  if (update->max_epoch != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_epoch", 9);
+    cardano_json_writer_write_uint_as_string(writer, *update->max_epoch);
+  }
+
+  if (update->n_opt != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "n_opt", 5);
+    cardano_json_writer_write_uint_as_string(writer, *update->n_opt);
+  }
+
+  if (update->pool_pledge_influence != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "pool_pledge_influence", 21);
+    cardano_error_t error = cardano_unit_interval_to_cip116_json(update->pool_pledge_influence, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->expansion_rate != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "expansion_rate", 14);
+    cardano_error_t error = cardano_unit_interval_to_cip116_json(update->expansion_rate, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->treasury_growth_rate != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "treasury_growth_rate", 20);
+    cardano_error_t error = cardano_unit_interval_to_cip116_json(update->treasury_growth_rate, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->d != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "d", 1);
+    cardano_error_t error = cardano_unit_interval_to_cip116_json(update->d, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->extra_entropy != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "extra_entropy", 13);
+    cardano_json_writer_write_buffer_as_hex(writer, update->extra_entropy);
+  }
+
+  if (update->protocol_version != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "protocol_version", 16);
+    cardano_error_t error = cardano_protocol_version_to_cip116_json(update->protocol_version, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->min_pool_cost != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "min_pool_cost", 13);
+    cardano_json_writer_write_uint_as_string(writer, *update->min_pool_cost);
+  }
+
+  if (update->ada_per_utxo_byte != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "ada_per_utxo_byte", 17);
+    cardano_json_writer_write_uint_as_string(writer, *update->ada_per_utxo_byte);
+  }
+
+  if (update->cost_models != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "cost_models", 11);
+    cardano_error_t error = cardano_costmdls_to_cip116_json(update->cost_models, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->execution_costs != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "execution_costs", 15);
+    cardano_error_t error = cardano_ex_unit_prices_to_cip116_json(update->execution_costs, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->max_tx_ex_units != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_tx_ex_units", 15);
+    cardano_error_t error = cardano_ex_units_to_cip116_json(update->max_tx_ex_units, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->max_block_ex_units != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_block_ex_units", 18);
+    cardano_error_t error = cardano_ex_units_to_cip116_json(update->max_block_ex_units, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->max_value_size != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_value_size", 14);
+    cardano_json_writer_write_uint_as_string(writer, *update->max_value_size);
+  }
+
+  if (update->collateral_percentage != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "collateral_percentage", 21);
+    cardano_json_writer_write_uint_as_string(writer, *update->collateral_percentage);
+  }
+
+  if (update->max_collateral_inputs != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_collateral_inputs", 21);
+    cardano_json_writer_write_uint_as_string(writer, *update->max_collateral_inputs);
+  }
+
+  if (update->pool_voting_thresholds != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "pool_voting_thresholds", 22);
+    cardano_error_t error = cardano_pool_voting_thresholds_to_cip116_json(update->pool_voting_thresholds, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->drep_voting_thresholds != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "drep_voting_thresholds", 22);
+    cardano_error_t error = cardano_drep_voting_thresholds_to_cip116_json(update->drep_voting_thresholds, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->min_committee_size != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "min_committee_size", 18);
+    cardano_json_writer_write_uint_as_string(writer, *update->min_committee_size);
+  }
+
+  if (update->committee_term_limit != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "committee_term_limit", 20);
+    cardano_json_writer_write_uint_as_string(writer, *update->committee_term_limit);
+  }
+
+  if (update->governance_action_validity_period != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "governance_action_validity_period", 33);
+    cardano_json_writer_write_uint_as_string(writer, *update->governance_action_validity_period);
+  }
+
+  if (update->governance_action_deposit != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "governance_action_deposit", 25);
+    cardano_json_writer_write_uint_as_string(writer, *update->governance_action_deposit);
+  }
+
+  if (update->drep_deposit != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "drep_deposit", 12);
+    cardano_json_writer_write_uint_as_string(writer, *update->drep_deposit);
+  }
+
+  if (update->drep_inactivity_period != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "drep_inactivity_period", 22);
+    cardano_json_writer_write_uint_as_string(writer, *update->drep_inactivity_period);
+  }
+
+  if (update->ref_script_cost_per_byte != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "ref_script_cost_per_byte", 24);
+    cardano_error_t error = cardano_unit_interval_to_cip116_json(update->ref_script_cost_per_byte, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->max_ref_script_size_per_block != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_ref_script_size_per_block", 29);
+    cardano_json_writer_write_uint_as_string(writer, *update->max_ref_script_size_per_block);
+  }
+
+  if (update->max_ref_script_size_per_tx != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_ref_script_size_per_tx", 26);
+    cardano_json_writer_write_uint_as_string(writer, *update->max_ref_script_size_per_tx);
+  }
+
+  if (update->ref_script_cost_stride != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "ref_script_cost_stride", 22);
+    cardano_json_writer_write_uint_as_string(writer, *update->ref_script_cost_stride);
+  }
+
+  if (update->ref_script_cost_multiplier != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "ref_script_cost_multiplier", 26);
+    cardano_error_t error = cardano_unit_interval_to_cip116_json(update->ref_script_cost_multiplier, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->has_max_pledge_leverage)
+  {
+    cardano_json_writer_write_property_name(writer, "max_pledge_leverage", 19);
+
+    if (update->max_pledge_leverage == NULL)
+    {
+      cardano_json_writer_write_null(writer);
+    }
+    else
+    {
+      cardano_error_t error = cardano_unit_interval_to_cip116_json(update->max_pledge_leverage, writer);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+    }
+  }
+
+  if (update->min_pool_margin != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "min_pool_margin", 15);
+    cardano_error_t error = cardano_unit_interval_to_cip116_json(update->min_pool_margin, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->leios_announcement_period_length != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "leios_announcement_period_length", 32);
+    cardano_json_writer_write_uint_as_string(writer, *update->leios_announcement_period_length);
+  }
+
+  if (update->leios_vote_period_length != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "leios_vote_period_length", 24);
+    cardano_json_writer_write_uint_as_string(writer, *update->leios_vote_period_length);
+  }
+
+  if (update->leios_diffusion_period_length != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "leios_diffusion_period_length", 29);
+    cardano_json_writer_write_uint_as_string(writer, *update->leios_diffusion_period_length);
+  }
+
+  if (update->leios_committee_size != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "leios_committee_size", 20);
+    cardano_json_writer_write_uint_as_string(writer, *update->leios_committee_size);
+  }
+
+  if (update->leios_quorum_stake_threshold != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "leios_quorum_stake_threshold", 28);
+    cardano_error_t error = cardano_unit_interval_to_cip116_json(update->leios_quorum_stake_threshold, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->max_endorser_block_references_size != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_endorser_block_references_size", 34);
+    cardano_json_writer_write_uint_as_string(writer, *update->max_endorser_block_references_size);
+  }
+
+  if (update->max_endorser_block_txs_size != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_endorser_block_txs_size", 27);
+    cardano_json_writer_write_uint_as_string(writer, *update->max_endorser_block_txs_size);
+  }
+
+  if (update->max_endorser_block_execution_units != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_endorser_block_execution_units", 34);
+    cardano_error_t error = cardano_ex_units_to_cip116_json(update->max_endorser_block_execution_units, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->max_ref_script_size_per_endorser_block != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "max_ref_script_size_per_endorser_block", 38);
+    cardano_json_writer_write_uint_as_string(writer, *update->max_ref_script_size_per_endorser_block);
+  }
+
+  if (update->peras_min_candidate_block_age != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "peras_min_candidate_block_age", 29);
+    cardano_json_writer_write_uint_as_string(writer, *update->peras_min_candidate_block_age);
+  }
+
+  if (update->peras_healing_factor != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "peras_healing_factor", 20);
+    cardano_error_t error = cardano_unit_interval_to_cip116_json(update->peras_healing_factor, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->peras_cert_boost != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "peras_cert_boost", 16);
+    cardano_json_writer_write_uint_as_string(writer, *update->peras_cert_boost);
+  }
+
+  if (update->peras_target_committee_size != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "peras_target_committee_size", 27);
+    cardano_json_writer_write_uint_as_string(writer, *update->peras_target_committee_size);
+  }
+
+  if (update->has_peras_bootstrap_round)
+  {
+    cardano_json_writer_write_property_name(writer, "peras_bootstrap_round", 21);
+
+    if (update->peras_bootstrap_round == NULL)
+    {
+      cardano_json_writer_write_null(writer);
+    }
+    else
+    {
+      cardano_json_writer_write_uint_as_string(writer, *update->peras_bootstrap_round);
+    }
+  }
+
+  if (update->peras_quorum_threshold_safety_margin != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "peras_quorum_threshold_safety_margin", 36);
+    cardano_error_t error = cardano_unit_interval_to_cip116_json(update->peras_quorum_threshold_safety_margin, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (update->ref_inputs_cost_per_multi_asset_byte != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "ref_inputs_cost_per_multi_asset_byte", 36);
+    cardano_json_writer_write_uint_as_string(writer, *update->ref_inputs_cost_per_multi_asset_byte);
+  }
+
+  if (update->ref_inputs_cost_per_datum_byte != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "ref_inputs_cost_per_datum_byte", 30);
+    cardano_json_writer_write_uint_as_string(writer, *update->ref_inputs_cost_per_datum_byte);
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_min_fee_a(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              min_fee_a)
+{
+  if ((protocol_param_update == NULL) || (min_fee_a == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->min_fee_a == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *min_fee_a = *protocol_param_update->min_fee_a;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_min_fee_b(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              min_fee_b)
+{
+  if ((protocol_param_update == NULL) || (min_fee_b == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->min_fee_b == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *min_fee_b = *protocol_param_update->min_fee_b;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_block_body_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_block_body_size)
+{
+  if ((protocol_param_update == NULL) || (max_block_body_size == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_block_body_size == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *max_block_body_size = *protocol_param_update->max_block_body_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_tx_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_tx_size)
+{
+  if ((protocol_param_update == NULL) || (max_tx_size == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_tx_size == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *max_tx_size = *protocol_param_update->max_tx_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_block_header_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_block_header_size)
+{
+  if ((protocol_param_update == NULL) || (max_block_header_size == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_block_header_size == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *max_block_header_size = *protocol_param_update->max_block_header_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_key_deposit(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              key_deposit)
+{
+  if ((protocol_param_update == NULL) || (key_deposit == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->key_deposit == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *key_deposit = *protocol_param_update->key_deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_pool_deposit(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              pool_deposit)
+{
+  if ((protocol_param_update == NULL) || (pool_deposit == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->pool_deposit == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *pool_deposit = *protocol_param_update->pool_deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_epoch(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_epoch)
+{
+  if ((protocol_param_update == NULL) || (max_epoch == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_epoch == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *max_epoch = *protocol_param_update->max_epoch;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_n_opt(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              n_opt)
+{
+  if ((protocol_param_update == NULL) || (n_opt == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->n_opt == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *n_opt = *protocol_param_update->n_opt;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_pool_pledge_influence(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        pool_pledge_influence)
+{
+  if ((protocol_param_update == NULL) || (pool_pledge_influence == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->pool_pledge_influence == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_unit_interval_ref(protocol_param_update->pool_pledge_influence);
+  *pool_pledge_influence = protocol_param_update->pool_pledge_influence;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_expansion_rate(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        expansion_rate)
+{
+  if ((protocol_param_update == NULL) || (expansion_rate == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->expansion_rate == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_unit_interval_ref(protocol_param_update->expansion_rate);
+  *expansion_rate = protocol_param_update->expansion_rate;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_treasury_growth_rate(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        treasury_growth_rate)
+{
+  if ((protocol_param_update == NULL) || (treasury_growth_rate == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->treasury_growth_rate == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_unit_interval_ref(protocol_param_update->treasury_growth_rate);
+  *treasury_growth_rate = protocol_param_update->treasury_growth_rate;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_d(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        d)
+{
+  if ((protocol_param_update == NULL) || (d == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->d == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_unit_interval_ref(protocol_param_update->d);
+  *d = protocol_param_update->d;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_extra_entropy(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_buffer_t**               extra_entropy)
+{
+  if ((protocol_param_update == NULL) || (extra_entropy == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->extra_entropy == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_buffer_ref(protocol_param_update->extra_entropy);
+  *extra_entropy = protocol_param_update->extra_entropy;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_protocol_version(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_protocol_version_t**     protocol_version)
+{
+  if ((protocol_param_update == NULL) || (protocol_version == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->protocol_version == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_protocol_version_ref(protocol_param_update->protocol_version);
+  *protocol_version = protocol_param_update->protocol_version;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_min_pool_cost(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              min_pool_cost)
+{
+  if ((protocol_param_update == NULL) || (min_pool_cost == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->min_pool_cost == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *min_pool_cost = *protocol_param_update->min_pool_cost;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_ada_per_utxo_byte(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              ada_per_utxo_byte)
+{
+  if ((protocol_param_update == NULL) || (ada_per_utxo_byte == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->ada_per_utxo_byte == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *ada_per_utxo_byte = *protocol_param_update->ada_per_utxo_byte;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_cost_models(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_costmdls_t**             cost_models)
+{
+  if ((protocol_param_update == NULL) || (cost_models == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->cost_models == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_costmdls_ref(protocol_param_update->cost_models);
+  *cost_models = protocol_param_update->cost_models;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_execution_costs(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_unit_prices_t**       execution_costs)
+{
+  if ((protocol_param_update == NULL) || (execution_costs == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->execution_costs == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_ex_unit_prices_ref(protocol_param_update->execution_costs);
+  *execution_costs = protocol_param_update->execution_costs;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_tx_ex_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t**             max_tx_ex_units)
+{
+  if ((protocol_param_update == NULL) || (max_tx_ex_units == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_tx_ex_units == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_ex_units_ref(protocol_param_update->max_tx_ex_units);
+  *max_tx_ex_units = protocol_param_update->max_tx_ex_units;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_block_ex_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t**             max_block_ex_units)
+{
+  if ((protocol_param_update == NULL) || (max_block_ex_units == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_block_ex_units == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_ex_units_ref(protocol_param_update->max_block_ex_units);
+  *max_block_ex_units = protocol_param_update->max_block_ex_units;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_value_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_value_size)
+{
+  if ((protocol_param_update == NULL) || (max_value_size == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_value_size == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *max_value_size = *protocol_param_update->max_value_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_collateral_percentage(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              collateral_percentage)
+{
+  if ((protocol_param_update == NULL) || (collateral_percentage == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->collateral_percentage == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *collateral_percentage = *protocol_param_update->collateral_percentage;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_collateral_inputs(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_collateral_inputs)
+{
+  if ((protocol_param_update == NULL) || (max_collateral_inputs == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_collateral_inputs == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *max_collateral_inputs = *protocol_param_update->max_collateral_inputs;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_pool_voting_thresholds(
+  cardano_protocol_param_update_t*   protocol_param_update,
+  cardano_pool_voting_thresholds_t** pool_voting_thresholds)
+{
+  if ((protocol_param_update == NULL) || (pool_voting_thresholds == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->pool_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_pool_voting_thresholds_ref(protocol_param_update->pool_voting_thresholds);
+  *pool_voting_thresholds = protocol_param_update->pool_voting_thresholds;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_drep_voting_thresholds(
+  cardano_protocol_param_update_t*   protocol_param_update,
+  cardano_drep_voting_thresholds_t** drep_voting_thresholds)
+{
+  if ((protocol_param_update == NULL) || (drep_voting_thresholds == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->drep_voting_thresholds == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_drep_voting_thresholds_ref(protocol_param_update->drep_voting_thresholds);
+  *drep_voting_thresholds = protocol_param_update->drep_voting_thresholds;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_min_committee_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              min_committee_size)
+{
+  if ((protocol_param_update == NULL) || (min_committee_size == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->min_committee_size == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *min_committee_size = *protocol_param_update->min_committee_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_committee_term_limit(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              committee_term_limit)
+{
+  if ((protocol_param_update == NULL) || (committee_term_limit == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->committee_term_limit == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *committee_term_limit = *protocol_param_update->committee_term_limit;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_governance_action_validity_period(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              governance_action_validity_period)
+{
+  if ((protocol_param_update == NULL) || (governance_action_validity_period == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->governance_action_validity_period == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *governance_action_validity_period = *protocol_param_update->governance_action_validity_period;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_governance_action_deposit(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              governance_action_deposit)
+{
+  if ((protocol_param_update == NULL) || (governance_action_deposit == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->governance_action_deposit == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *governance_action_deposit = *protocol_param_update->governance_action_deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_drep_deposit(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              drep_deposit)
+{
+  if ((protocol_param_update == NULL) || (drep_deposit == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->drep_deposit == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *drep_deposit = *protocol_param_update->drep_deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_drep_inactivity_period(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              drep_inactivity_period)
+{
+  if ((protocol_param_update == NULL) || (drep_inactivity_period == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->drep_inactivity_period == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *drep_inactivity_period = *protocol_param_update->drep_inactivity_period;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_ref_script_cost_per_byte(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        ref_script_cost_per_byte)
+{
+  if ((protocol_param_update == NULL) || (ref_script_cost_per_byte == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->ref_script_cost_per_byte == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_unit_interval_ref(protocol_param_update->ref_script_cost_per_byte);
+  *ref_script_cost_per_byte = protocol_param_update->ref_script_cost_per_byte;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_ref_script_size_per_block(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_ref_script_size_per_block)
+{
+  if ((protocol_param_update == NULL) || (max_ref_script_size_per_block == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_ref_script_size_per_block == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *max_ref_script_size_per_block = *protocol_param_update->max_ref_script_size_per_block;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_ref_script_size_per_tx(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_ref_script_size_per_tx)
+{
+  if ((protocol_param_update == NULL) || (max_ref_script_size_per_tx == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_ref_script_size_per_tx == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *max_ref_script_size_per_tx = *protocol_param_update->max_ref_script_size_per_tx;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_ref_script_cost_stride(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              ref_script_cost_stride)
+{
+  if ((protocol_param_update == NULL) || (ref_script_cost_stride == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->ref_script_cost_stride == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *ref_script_cost_stride = *protocol_param_update->ref_script_cost_stride;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_ref_script_cost_multiplier(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        ref_script_cost_multiplier)
+{
+  if ((protocol_param_update == NULL) || (ref_script_cost_multiplier == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->ref_script_cost_multiplier == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_unit_interval_ref(protocol_param_update->ref_script_cost_multiplier);
+  *ref_script_cost_multiplier = protocol_param_update->ref_script_cost_multiplier;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_pledge_leverage(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        max_pledge_leverage)
+{
+  if ((protocol_param_update == NULL) || (max_pledge_leverage == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (!protocol_param_update->has_max_pledge_leverage)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  if (protocol_param_update->max_pledge_leverage != NULL)
+  {
+    cardano_unit_interval_ref(protocol_param_update->max_pledge_leverage);
+  }
+
+  *max_pledge_leverage = protocol_param_update->max_pledge_leverage;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_protocol_param_update_has_max_pledge_leverage(
+  const cardano_protocol_param_update_t* protocol_param_update)
+{
+  if (protocol_param_update == NULL)
+  {
+    return false;
+  }
+
+  return protocol_param_update->has_max_pledge_leverage;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_min_pool_margin(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        min_pool_margin)
+{
+  if ((protocol_param_update == NULL) || (min_pool_margin == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->min_pool_margin == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_unit_interval_ref(protocol_param_update->min_pool_margin);
+  *min_pool_margin = protocol_param_update->min_pool_margin;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_leios_announcement_period_length(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              leios_announcement_period_length)
+{
+  if ((protocol_param_update == NULL) || (leios_announcement_period_length == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->leios_announcement_period_length == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *leios_announcement_period_length = *protocol_param_update->leios_announcement_period_length;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_leios_vote_period_length(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              leios_vote_period_length)
+{
+  if ((protocol_param_update == NULL) || (leios_vote_period_length == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->leios_vote_period_length == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *leios_vote_period_length = *protocol_param_update->leios_vote_period_length;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_leios_diffusion_period_length(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              leios_diffusion_period_length)
+{
+  if ((protocol_param_update == NULL) || (leios_diffusion_period_length == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->leios_diffusion_period_length == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *leios_diffusion_period_length = *protocol_param_update->leios_diffusion_period_length;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_leios_committee_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              leios_committee_size)
+{
+  if ((protocol_param_update == NULL) || (leios_committee_size == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->leios_committee_size == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *leios_committee_size = *protocol_param_update->leios_committee_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_leios_quorum_stake_threshold(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        leios_quorum_stake_threshold)
+{
+  if ((protocol_param_update == NULL) || (leios_quorum_stake_threshold == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->leios_quorum_stake_threshold == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_unit_interval_ref(protocol_param_update->leios_quorum_stake_threshold);
+  *leios_quorum_stake_threshold = protocol_param_update->leios_quorum_stake_threshold;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_endorser_block_references_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_endorser_block_references_size)
+{
+  if ((protocol_param_update == NULL) || (max_endorser_block_references_size == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_endorser_block_references_size == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *max_endorser_block_references_size = *protocol_param_update->max_endorser_block_references_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_endorser_block_txs_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_endorser_block_txs_size)
+{
+  if ((protocol_param_update == NULL) || (max_endorser_block_txs_size == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_endorser_block_txs_size == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *max_endorser_block_txs_size = *protocol_param_update->max_endorser_block_txs_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_endorser_block_execution_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t**             max_endorser_block_execution_units)
+{
+  if ((protocol_param_update == NULL) || (max_endorser_block_execution_units == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_endorser_block_execution_units == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_ex_units_ref(protocol_param_update->max_endorser_block_execution_units);
+  *max_endorser_block_execution_units = protocol_param_update->max_endorser_block_execution_units;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_max_ref_script_size_per_endorser_block(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              max_ref_script_size_per_endorser_block)
+{
+  if ((protocol_param_update == NULL) || (max_ref_script_size_per_endorser_block == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_ref_script_size_per_endorser_block == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *max_ref_script_size_per_endorser_block = *protocol_param_update->max_ref_script_size_per_endorser_block;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_peras_min_candidate_block_age(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              peras_min_candidate_block_age)
+{
+  if ((protocol_param_update == NULL) || (peras_min_candidate_block_age == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->peras_min_candidate_block_age == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *peras_min_candidate_block_age = *protocol_param_update->peras_min_candidate_block_age;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_peras_healing_factor(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        peras_healing_factor)
+{
+  if ((protocol_param_update == NULL) || (peras_healing_factor == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->peras_healing_factor == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_unit_interval_ref(protocol_param_update->peras_healing_factor);
+  *peras_healing_factor = protocol_param_update->peras_healing_factor;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_peras_cert_boost(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              peras_cert_boost)
+{
+  if ((protocol_param_update == NULL) || (peras_cert_boost == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->peras_cert_boost == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *peras_cert_boost = *protocol_param_update->peras_cert_boost;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_peras_target_committee_size(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              peras_target_committee_size)
+{
+  if ((protocol_param_update == NULL) || (peras_target_committee_size == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->peras_target_committee_size == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *peras_target_committee_size = *protocol_param_update->peras_target_committee_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_peras_bootstrap_round(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              peras_bootstrap_round)
+{
+  if ((protocol_param_update == NULL) || (peras_bootstrap_round == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->peras_bootstrap_round == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *peras_bootstrap_round = *protocol_param_update->peras_bootstrap_round;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_protocol_param_update_has_peras_bootstrap_round(
+  const cardano_protocol_param_update_t* protocol_param_update)
+{
+  if (protocol_param_update == NULL)
+  {
+    return false;
+  }
+
+  return protocol_param_update->has_peras_bootstrap_round;
+}
+
+bool
+cardano_protocol_param_update_is_peras_bootstrap_round_null(
+  const cardano_protocol_param_update_t* protocol_param_update)
+{
+  if (protocol_param_update == NULL)
+  {
+    return false;
+  }
+
+  return protocol_param_update->has_peras_bootstrap_round && (protocol_param_update->peras_bootstrap_round == NULL);
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_peras_quorum_threshold_safety_margin(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t**        peras_quorum_threshold_safety_margin)
+{
+  if ((protocol_param_update == NULL) || (peras_quorum_threshold_safety_margin == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->peras_quorum_threshold_safety_margin == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_unit_interval_ref(protocol_param_update->peras_quorum_threshold_safety_margin);
+  *peras_quorum_threshold_safety_margin = protocol_param_update->peras_quorum_threshold_safety_margin;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_ref_inputs_cost_per_multi_asset_byte(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              ref_inputs_cost_per_multi_asset_byte)
+{
+  if ((protocol_param_update == NULL) || (ref_inputs_cost_per_multi_asset_byte == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->ref_inputs_cost_per_multi_asset_byte == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *ref_inputs_cost_per_multi_asset_byte = *protocol_param_update->ref_inputs_cost_per_multi_asset_byte;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_ref_inputs_cost_per_datum_byte(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              ref_inputs_cost_per_datum_byte)
+{
+  if ((protocol_param_update == NULL) || (ref_inputs_cost_per_datum_byte == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->ref_inputs_cost_per_datum_byte == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *ref_inputs_cost_per_datum_byte = *protocol_param_update->ref_inputs_cost_per_datum_byte;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_min_fee_a(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  min_fee_a)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->min_fee_a != NULL)
+  {
+    _cardano_free(protocol_param_update->min_fee_a);
+  }
+
+  if (min_fee_a == NULL)
+  {
+    protocol_param_update->min_fee_a = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->min_fee_a = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->min_fee_a == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->min_fee_a = *min_fee_a;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_min_fee_b(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  min_fee_b)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->min_fee_b != NULL)
+  {
+    _cardano_free(protocol_param_update->min_fee_b);
+  }
+
+  if (min_fee_b == NULL)
+  {
+    protocol_param_update->min_fee_b = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->min_fee_b = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->min_fee_b == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->min_fee_b = *min_fee_b;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_block_body_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_block_body_size)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_block_body_size != NULL)
+  {
+    _cardano_free(protocol_param_update->max_block_body_size);
+  }
+
+  if (max_block_body_size == NULL)
+  {
+    protocol_param_update->max_block_body_size = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->max_block_body_size = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->max_block_body_size == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->max_block_body_size = *max_block_body_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_tx_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_tx_size)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_tx_size != NULL)
+  {
+    _cardano_free(protocol_param_update->max_tx_size);
+  }
+
+  if (max_tx_size == NULL)
+  {
+    protocol_param_update->max_tx_size = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->max_tx_size = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->max_tx_size == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->max_tx_size = *max_tx_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_block_header_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_block_header_size)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_block_header_size != NULL)
+  {
+    _cardano_free(protocol_param_update->max_block_header_size);
+  }
+
+  if (max_block_header_size == NULL)
+  {
+    protocol_param_update->max_block_header_size = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->max_block_header_size = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->max_block_header_size == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->max_block_header_size = *max_block_header_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_key_deposit(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  key_deposit)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->key_deposit != NULL)
+  {
+    _cardano_free(protocol_param_update->key_deposit);
+  }
+
+  if (key_deposit == NULL)
+  {
+    protocol_param_update->key_deposit = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->key_deposit = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->key_deposit == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->key_deposit = *key_deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_pool_deposit(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  pool_deposit)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->pool_deposit != NULL)
+  {
+    _cardano_free(protocol_param_update->pool_deposit);
+  }
+
+  if (pool_deposit == NULL)
+  {
+    protocol_param_update->pool_deposit = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->pool_deposit = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->pool_deposit == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->pool_deposit = *pool_deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_epoch(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_epoch)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_epoch != NULL)
+  {
+    _cardano_free(protocol_param_update->max_epoch);
+  }
+
+  if (max_epoch == NULL)
+  {
+    protocol_param_update->max_epoch = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->max_epoch = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->max_epoch == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->max_epoch = *max_epoch;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_n_opt(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  n_opt)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->n_opt != NULL)
+  {
+    _cardano_free(protocol_param_update->n_opt);
+  }
+
+  if (n_opt == NULL)
+  {
+    protocol_param_update->n_opt = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->n_opt = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->n_opt == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->n_opt = *n_opt;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_pool_pledge_influence(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         pool_pledge_influence)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->pool_pledge_influence != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->pool_pledge_influence);
+  }
+
+  if (pool_pledge_influence == NULL)
+  {
+    protocol_param_update->pool_pledge_influence = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_unit_interval_ref(pool_pledge_influence);
+  protocol_param_update->pool_pledge_influence = (cardano_unit_interval_t*)pool_pledge_influence;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_expansion_rate(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         expansion_rate)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->expansion_rate != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->expansion_rate);
+  }
+
+  if (expansion_rate == NULL)
+  {
+    protocol_param_update->expansion_rate = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_unit_interval_ref(expansion_rate);
+  protocol_param_update->expansion_rate = (cardano_unit_interval_t*)expansion_rate;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_treasury_growth_rate(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         treasury_growth_rate)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->treasury_growth_rate != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->treasury_growth_rate);
+  }
+
+  if (treasury_growth_rate == NULL)
+  {
+    protocol_param_update->treasury_growth_rate = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_unit_interval_ref(treasury_growth_rate);
+  protocol_param_update->treasury_growth_rate = (cardano_unit_interval_t*)treasury_growth_rate;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_d(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         d)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->d != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->d);
+  }
+
+  if (d == NULL)
+  {
+    protocol_param_update->d = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_unit_interval_ref(d);
+  protocol_param_update->d = (cardano_unit_interval_t*)d;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_extra_entropy(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_buffer_t*                extra_entropy)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->extra_entropy != NULL)
+  {
+    cardano_buffer_unref(&protocol_param_update->extra_entropy);
+  }
+
+  if (extra_entropy == NULL)
+  {
+    protocol_param_update->extra_entropy = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_buffer_ref(extra_entropy);
+  protocol_param_update->extra_entropy = (cardano_buffer_t*)extra_entropy;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_protocol_version(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_protocol_version_t*      protocol_version)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->protocol_version != NULL)
+  {
+    cardano_protocol_version_unref(&protocol_param_update->protocol_version);
+  }
+
+  if (protocol_version == NULL)
+  {
+    protocol_param_update->protocol_version = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_protocol_version_ref(protocol_version);
+  protocol_param_update->protocol_version = (cardano_protocol_version_t*)protocol_version;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_min_pool_cost(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  min_pool_cost)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->min_pool_cost != NULL)
+  {
+    _cardano_free(protocol_param_update->min_pool_cost);
+  }
+
+  if (min_pool_cost == NULL)
+  {
+    protocol_param_update->min_pool_cost = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->min_pool_cost = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->min_pool_cost == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->min_pool_cost = *min_pool_cost;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_ada_per_utxo_byte(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  ada_per_utxo_byte)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->ada_per_utxo_byte != NULL)
+  {
+    _cardano_free(protocol_param_update->ada_per_utxo_byte);
+  }
+
+  if (ada_per_utxo_byte == NULL)
+  {
+    protocol_param_update->ada_per_utxo_byte = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->ada_per_utxo_byte = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->ada_per_utxo_byte == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->ada_per_utxo_byte = *ada_per_utxo_byte;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_cost_models(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_costmdls_t*              cost_models)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->cost_models != NULL)
+  {
+    cardano_costmdls_unref(&protocol_param_update->cost_models);
+  }
+
+  if (cost_models == NULL)
+  {
+    protocol_param_update->cost_models = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_costmdls_ref(cost_models);
+  protocol_param_update->cost_models = (cardano_costmdls_t*)cost_models;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_execution_costs(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_unit_prices_t*        execution_costs)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->execution_costs != NULL)
+  {
+    cardano_ex_unit_prices_unref(&protocol_param_update->execution_costs);
+  }
+
+  if (execution_costs == NULL)
+  {
+    protocol_param_update->execution_costs = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_ex_unit_prices_ref(execution_costs);
+  protocol_param_update->execution_costs = (cardano_ex_unit_prices_t*)execution_costs;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_tx_ex_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t*              max_tx_ex_units)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_tx_ex_units != NULL)
+  {
+    cardano_ex_units_unref(&protocol_param_update->max_tx_ex_units);
+  }
+
+  if (max_tx_ex_units == NULL)
+  {
+    protocol_param_update->max_tx_ex_units = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_ex_units_ref(max_tx_ex_units);
+  protocol_param_update->max_tx_ex_units = (cardano_ex_units_t*)max_tx_ex_units;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_block_ex_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t*              max_block_ex_units)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_block_ex_units != NULL)
+  {
+    cardano_ex_units_unref(&protocol_param_update->max_block_ex_units);
+  }
+
+  if (max_block_ex_units == NULL)
+  {
+    protocol_param_update->max_block_ex_units = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_ex_units_ref(max_block_ex_units);
+  protocol_param_update->max_block_ex_units = (cardano_ex_units_t*)max_block_ex_units;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_value_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_value_size)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_value_size != NULL)
+  {
+    _cardano_free(protocol_param_update->max_value_size);
+  }
+
+  if (max_value_size == NULL)
+  {
+    protocol_param_update->max_value_size = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->max_value_size = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->max_value_size == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->max_value_size = *max_value_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_collateral_percentage(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  collateral_percentage)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->collateral_percentage != NULL)
+  {
+    _cardano_free(protocol_param_update->collateral_percentage);
+  }
+
+  if (collateral_percentage == NULL)
+  {
+    protocol_param_update->collateral_percentage = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->collateral_percentage = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->collateral_percentage == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->collateral_percentage = *collateral_percentage;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_collateral_inputs(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_collateral_inputs)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_collateral_inputs != NULL)
+  {
+    _cardano_free(protocol_param_update->max_collateral_inputs);
+  }
+
+  if (max_collateral_inputs == NULL)
+  {
+    protocol_param_update->max_collateral_inputs = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->max_collateral_inputs = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->max_collateral_inputs == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->max_collateral_inputs = *max_collateral_inputs;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_pool_voting_thresholds(
+  cardano_protocol_param_update_t*  protocol_param_update,
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->pool_voting_thresholds != NULL)
+  {
+    cardano_pool_voting_thresholds_unref(&protocol_param_update->pool_voting_thresholds);
+  }
+
+  if (pool_voting_thresholds == NULL)
+  {
+    protocol_param_update->pool_voting_thresholds = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_pool_voting_thresholds_ref(pool_voting_thresholds);
+  protocol_param_update->pool_voting_thresholds = (cardano_pool_voting_thresholds_t*)pool_voting_thresholds;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_drep_voting_thresholds(
+  cardano_protocol_param_update_t*  protocol_param_update,
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->drep_voting_thresholds != NULL)
+  {
+    cardano_drep_voting_thresholds_unref(&protocol_param_update->drep_voting_thresholds);
+  }
+
+  if (drep_voting_thresholds == NULL)
+  {
+    protocol_param_update->drep_voting_thresholds = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_drep_voting_thresholds_ref(drep_voting_thresholds);
+  protocol_param_update->drep_voting_thresholds = (cardano_drep_voting_thresholds_t*)drep_voting_thresholds;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_min_committee_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  min_committee_size)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->min_committee_size != NULL)
+  {
+    _cardano_free(protocol_param_update->min_committee_size);
+  }
+
+  if (min_committee_size == NULL)
+  {
+    protocol_param_update->min_committee_size = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->min_committee_size = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->min_committee_size == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->min_committee_size = *min_committee_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_committee_term_limit(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  committee_term_limit)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->committee_term_limit != NULL)
+  {
+    _cardano_free(protocol_param_update->committee_term_limit);
+  }
+
+  if (committee_term_limit == NULL)
+  {
+    protocol_param_update->committee_term_limit = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->committee_term_limit = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->committee_term_limit == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->committee_term_limit = *committee_term_limit;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_governance_action_validity_period(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  governance_action_validity_period)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->governance_action_validity_period != NULL)
+  {
+    _cardano_free(protocol_param_update->governance_action_validity_period);
+  }
+
+  if (governance_action_validity_period == NULL)
+  {
+    protocol_param_update->governance_action_validity_period = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->governance_action_validity_period = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->governance_action_validity_period == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->governance_action_validity_period = *governance_action_validity_period;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_governance_action_deposit(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  governance_action_deposit)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->governance_action_deposit != NULL)
+  {
+    _cardano_free(protocol_param_update->governance_action_deposit);
+  }
+
+  if (governance_action_deposit == NULL)
+  {
+    protocol_param_update->governance_action_deposit = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->governance_action_deposit = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->governance_action_deposit == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->governance_action_deposit = *governance_action_deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_drep_deposit(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  drep_deposit)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->drep_deposit != NULL)
+  {
+    _cardano_free(protocol_param_update->drep_deposit);
+  }
+
+  if (drep_deposit == NULL)
+  {
+    protocol_param_update->drep_deposit = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->drep_deposit = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->drep_deposit == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->drep_deposit = *drep_deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_drep_inactivity_period(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  drep_inactivity_period)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->drep_inactivity_period != NULL)
+  {
+    _cardano_free(protocol_param_update->drep_inactivity_period);
+  }
+
+  if (drep_inactivity_period == NULL)
+  {
+    protocol_param_update->drep_inactivity_period = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->drep_inactivity_period = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->drep_inactivity_period == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->drep_inactivity_period = *drep_inactivity_period;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_ref_script_cost_per_byte(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         ref_script_cost_per_byte)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->ref_script_cost_per_byte != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->ref_script_cost_per_byte);
+  }
+
+  if (ref_script_cost_per_byte == NULL)
+  {
+    protocol_param_update->ref_script_cost_per_byte = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_unit_interval_ref(ref_script_cost_per_byte);
+  protocol_param_update->ref_script_cost_per_byte = (cardano_unit_interval_t*)ref_script_cost_per_byte;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_ref_script_size_per_block(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_ref_script_size_per_block)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((max_ref_script_size_per_block != NULL) && (*max_ref_script_size_per_block > UINT32_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Max ref script size per block must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->max_ref_script_size_per_block != NULL)
+  {
+    _cardano_free(protocol_param_update->max_ref_script_size_per_block);
+  }
+
+  if (max_ref_script_size_per_block == NULL)
+  {
+    protocol_param_update->max_ref_script_size_per_block = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->max_ref_script_size_per_block = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->max_ref_script_size_per_block == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->max_ref_script_size_per_block = *max_ref_script_size_per_block;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_ref_script_size_per_tx(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_ref_script_size_per_tx)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((max_ref_script_size_per_tx != NULL) && (*max_ref_script_size_per_tx > UINT32_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Max ref script size per tx must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->max_ref_script_size_per_tx != NULL)
+  {
+    _cardano_free(protocol_param_update->max_ref_script_size_per_tx);
+  }
+
+  if (max_ref_script_size_per_tx == NULL)
+  {
+    protocol_param_update->max_ref_script_size_per_tx = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->max_ref_script_size_per_tx = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->max_ref_script_size_per_tx == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->max_ref_script_size_per_tx = *max_ref_script_size_per_tx;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_ref_script_cost_stride(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  ref_script_cost_stride)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((ref_script_cost_stride != NULL) && ((*ref_script_cost_stride == 0U) || (*ref_script_cost_stride > UINT32_MAX)))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Ref script cost stride must be a positive 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->ref_script_cost_stride != NULL)
+  {
+    _cardano_free(protocol_param_update->ref_script_cost_stride);
+  }
+
+  if (ref_script_cost_stride == NULL)
+  {
+    protocol_param_update->ref_script_cost_stride = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->ref_script_cost_stride = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->ref_script_cost_stride == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->ref_script_cost_stride = *ref_script_cost_stride;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_ref_script_cost_multiplier(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         ref_script_cost_multiplier)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->ref_script_cost_multiplier != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->ref_script_cost_multiplier);
+  }
+
+  if (ref_script_cost_multiplier == NULL)
+  {
+    protocol_param_update->ref_script_cost_multiplier = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_unit_interval_ref(ref_script_cost_multiplier);
+  protocol_param_update->ref_script_cost_multiplier = (cardano_unit_interval_t*)ref_script_cost_multiplier;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_pledge_leverage(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         max_pledge_leverage)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_pledge_leverage != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->max_pledge_leverage);
+  }
+
+  if (max_pledge_leverage == NULL)
+  {
+    protocol_param_update->max_pledge_leverage     = NULL;
+    protocol_param_update->has_max_pledge_leverage = false;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_unit_interval_ref(max_pledge_leverage);
+  protocol_param_update->max_pledge_leverage     = max_pledge_leverage;
+  protocol_param_update->has_max_pledge_leverage = true;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_pledge_leverage_unbounded(
+  cardano_protocol_param_update_t* protocol_param_update)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_pledge_leverage != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->max_pledge_leverage);
+  }
+
+  protocol_param_update->max_pledge_leverage     = NULL;
+  protocol_param_update->has_max_pledge_leverage = true;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_clear_max_pledge_leverage(
+  cardano_protocol_param_update_t* protocol_param_update)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_pledge_leverage != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->max_pledge_leverage);
+  }
+
+  protocol_param_update->max_pledge_leverage     = NULL;
+  protocol_param_update->has_max_pledge_leverage = false;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_min_pool_margin(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         min_pool_margin)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->min_pool_margin != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->min_pool_margin);
+  }
+
+  if (min_pool_margin == NULL)
+  {
+    protocol_param_update->min_pool_margin = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_unit_interval_ref(min_pool_margin);
+  protocol_param_update->min_pool_margin = min_pool_margin;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_leios_announcement_period_length(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  leios_announcement_period_length)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((leios_announcement_period_length != NULL) && (*leios_announcement_period_length > UINT32_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Leios announcement period length must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->leios_announcement_period_length != NULL)
+  {
+    _cardano_free(protocol_param_update->leios_announcement_period_length);
+  }
+
+  if (leios_announcement_period_length == NULL)
+  {
+    protocol_param_update->leios_announcement_period_length = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->leios_announcement_period_length = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->leios_announcement_period_length == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->leios_announcement_period_length = *leios_announcement_period_length;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_leios_vote_period_length(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  leios_vote_period_length)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((leios_vote_period_length != NULL) && (*leios_vote_period_length > UINT32_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Leios vote period length must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->leios_vote_period_length != NULL)
+  {
+    _cardano_free(protocol_param_update->leios_vote_period_length);
+  }
+
+  if (leios_vote_period_length == NULL)
+  {
+    protocol_param_update->leios_vote_period_length = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->leios_vote_period_length = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->leios_vote_period_length == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->leios_vote_period_length = *leios_vote_period_length;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_leios_diffusion_period_length(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  leios_diffusion_period_length)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((leios_diffusion_period_length != NULL) && (*leios_diffusion_period_length > UINT32_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Leios diffusion period length must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->leios_diffusion_period_length != NULL)
+  {
+    _cardano_free(protocol_param_update->leios_diffusion_period_length);
+  }
+
+  if (leios_diffusion_period_length == NULL)
+  {
+    protocol_param_update->leios_diffusion_period_length = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->leios_diffusion_period_length = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->leios_diffusion_period_length == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->leios_diffusion_period_length = *leios_diffusion_period_length;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_leios_committee_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  leios_committee_size)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((leios_committee_size != NULL) && (*leios_committee_size > UINT16_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Leios committee size must fit in a 16-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->leios_committee_size != NULL)
+  {
+    _cardano_free(protocol_param_update->leios_committee_size);
+  }
+
+  if (leios_committee_size == NULL)
+  {
+    protocol_param_update->leios_committee_size = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->leios_committee_size = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->leios_committee_size == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->leios_committee_size = *leios_committee_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_leios_quorum_stake_threshold(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         leios_quorum_stake_threshold)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->leios_quorum_stake_threshold != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->leios_quorum_stake_threshold);
+  }
+
+  if (leios_quorum_stake_threshold == NULL)
+  {
+    protocol_param_update->leios_quorum_stake_threshold = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_unit_interval_ref(leios_quorum_stake_threshold);
+  protocol_param_update->leios_quorum_stake_threshold = leios_quorum_stake_threshold;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_endorser_block_references_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_endorser_block_references_size)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((max_endorser_block_references_size != NULL) && (*max_endorser_block_references_size > UINT32_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Max endorser block references size must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->max_endorser_block_references_size != NULL)
+  {
+    _cardano_free(protocol_param_update->max_endorser_block_references_size);
+  }
+
+  if (max_endorser_block_references_size == NULL)
+  {
+    protocol_param_update->max_endorser_block_references_size = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->max_endorser_block_references_size = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->max_endorser_block_references_size == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->max_endorser_block_references_size = *max_endorser_block_references_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_endorser_block_txs_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_endorser_block_txs_size)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((max_endorser_block_txs_size != NULL) && (*max_endorser_block_txs_size > UINT32_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Max endorser block txs size must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->max_endorser_block_txs_size != NULL)
+  {
+    _cardano_free(protocol_param_update->max_endorser_block_txs_size);
+  }
+
+  if (max_endorser_block_txs_size == NULL)
+  {
+    protocol_param_update->max_endorser_block_txs_size = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->max_endorser_block_txs_size = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->max_endorser_block_txs_size == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->max_endorser_block_txs_size = *max_endorser_block_txs_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_endorser_block_execution_units(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_ex_units_t*              max_endorser_block_execution_units)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->max_endorser_block_execution_units != NULL)
+  {
+    cardano_ex_units_unref(&protocol_param_update->max_endorser_block_execution_units);
+  }
+
+  if (max_endorser_block_execution_units == NULL)
+  {
+    protocol_param_update->max_endorser_block_execution_units = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_ex_units_ref(max_endorser_block_execution_units);
+  protocol_param_update->max_endorser_block_execution_units = max_endorser_block_execution_units;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_max_ref_script_size_per_endorser_block(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  max_ref_script_size_per_endorser_block)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((max_ref_script_size_per_endorser_block != NULL) && (*max_ref_script_size_per_endorser_block > UINT32_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Max ref script size per endorser block must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->max_ref_script_size_per_endorser_block != NULL)
+  {
+    _cardano_free(protocol_param_update->max_ref_script_size_per_endorser_block);
+  }
+
+  if (max_ref_script_size_per_endorser_block == NULL)
+  {
+    protocol_param_update->max_ref_script_size_per_endorser_block = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->max_ref_script_size_per_endorser_block = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->max_ref_script_size_per_endorser_block == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->max_ref_script_size_per_endorser_block = *max_ref_script_size_per_endorser_block;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_peras_min_candidate_block_age(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  peras_min_candidate_block_age)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((peras_min_candidate_block_age != NULL) && (*peras_min_candidate_block_age > UINT32_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Peras minimum candidate block age must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->peras_min_candidate_block_age != NULL)
+  {
+    _cardano_free(protocol_param_update->peras_min_candidate_block_age);
+  }
+
+  if (peras_min_candidate_block_age == NULL)
+  {
+    protocol_param_update->peras_min_candidate_block_age = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->peras_min_candidate_block_age = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->peras_min_candidate_block_age == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->peras_min_candidate_block_age = *peras_min_candidate_block_age;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_peras_healing_factor(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         peras_healing_factor)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->peras_healing_factor != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->peras_healing_factor);
+  }
+
+  if (peras_healing_factor == NULL)
+  {
+    protocol_param_update->peras_healing_factor = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_unit_interval_ref(peras_healing_factor);
+  protocol_param_update->peras_healing_factor = peras_healing_factor;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_peras_cert_boost(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  peras_cert_boost)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((peras_cert_boost != NULL) && (*peras_cert_boost > UINT16_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Peras certificate boost must fit in a 16-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->peras_cert_boost != NULL)
+  {
+    _cardano_free(protocol_param_update->peras_cert_boost);
+  }
+
+  if (peras_cert_boost == NULL)
+  {
+    protocol_param_update->peras_cert_boost = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->peras_cert_boost = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->peras_cert_boost == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->peras_cert_boost = *peras_cert_boost;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_peras_target_committee_size(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  peras_target_committee_size)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((peras_target_committee_size != NULL) && (*peras_target_committee_size > UINT16_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Peras target committee size must fit in a 16-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->peras_target_committee_size != NULL)
+  {
+    _cardano_free(protocol_param_update->peras_target_committee_size);
+  }
+
+  if (peras_target_committee_size == NULL)
+  {
+    protocol_param_update->peras_target_committee_size = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->peras_target_committee_size = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->peras_target_committee_size == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->peras_target_committee_size = *peras_target_committee_size;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_peras_bootstrap_round(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  peras_bootstrap_round)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((peras_bootstrap_round != NULL) && (*peras_bootstrap_round > UINT32_MAX))
+  {
+    cardano_protocol_param_update_set_last_error(protocol_param_update, "Peras bootstrap round must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (protocol_param_update->peras_bootstrap_round != NULL)
+  {
+    _cardano_free(protocol_param_update->peras_bootstrap_round);
+  }
+
+  if (peras_bootstrap_round == NULL)
+  {
+    protocol_param_update->peras_bootstrap_round     = NULL;
+    protocol_param_update->has_peras_bootstrap_round = false;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->peras_bootstrap_round = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->peras_bootstrap_round == NULL)
+  {
+    protocol_param_update->has_peras_bootstrap_round = false;
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->peras_bootstrap_round    = *peras_bootstrap_round;
+  protocol_param_update->has_peras_bootstrap_round = true;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_peras_bootstrap_round_null(
+  cardano_protocol_param_update_t* protocol_param_update)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->peras_bootstrap_round != NULL)
+  {
+    _cardano_free(protocol_param_update->peras_bootstrap_round);
+  }
+
+  protocol_param_update->peras_bootstrap_round     = NULL;
+  protocol_param_update->has_peras_bootstrap_round = true;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_clear_peras_bootstrap_round(
+  cardano_protocol_param_update_t* protocol_param_update)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->peras_bootstrap_round != NULL)
+  {
+    _cardano_free(protocol_param_update->peras_bootstrap_round);
+  }
+
+  protocol_param_update->peras_bootstrap_round     = NULL;
+  protocol_param_update->has_peras_bootstrap_round = false;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_peras_quorum_threshold_safety_margin(
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_unit_interval_t*         peras_quorum_threshold_safety_margin)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->peras_quorum_threshold_safety_margin != NULL)
+  {
+    cardano_unit_interval_unref(&protocol_param_update->peras_quorum_threshold_safety_margin);
+  }
+
+  if (peras_quorum_threshold_safety_margin == NULL)
+  {
+    protocol_param_update->peras_quorum_threshold_safety_margin = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_unit_interval_ref(peras_quorum_threshold_safety_margin);
+  protocol_param_update->peras_quorum_threshold_safety_margin = peras_quorum_threshold_safety_margin;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_ref_inputs_cost_per_multi_asset_byte(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  ref_inputs_cost_per_multi_asset_byte)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->ref_inputs_cost_per_multi_asset_byte != NULL)
+  {
+    _cardano_free(protocol_param_update->ref_inputs_cost_per_multi_asset_byte);
+  }
+
+  if (ref_inputs_cost_per_multi_asset_byte == NULL)
+  {
+    protocol_param_update->ref_inputs_cost_per_multi_asset_byte = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->ref_inputs_cost_per_multi_asset_byte = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->ref_inputs_cost_per_multi_asset_byte == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->ref_inputs_cost_per_multi_asset_byte = *ref_inputs_cost_per_multi_asset_byte;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_ref_inputs_cost_per_datum_byte(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  ref_inputs_cost_per_datum_byte)
+{
+  if (protocol_param_update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_param_update->ref_inputs_cost_per_datum_byte != NULL)
+  {
+    _cardano_free(protocol_param_update->ref_inputs_cost_per_datum_byte);
+  }
+
+  if (ref_inputs_cost_per_datum_byte == NULL)
+  {
+    protocol_param_update->ref_inputs_cost_per_datum_byte = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  protocol_param_update->ref_inputs_cost_per_datum_byte = _cardano_malloc(sizeof(uint64_t));
+
+  if (protocol_param_update->ref_inputs_cost_per_datum_byte == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *protocol_param_update->ref_inputs_cost_per_datum_byte = *ref_inputs_cost_per_datum_byte;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_protocol_param_update_unref(cardano_protocol_param_update_t** protocol_param_update)
+{
+  if ((protocol_param_update == NULL) || (*protocol_param_update == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*protocol_param_update)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *protocol_param_update = NULL;
+    return;
+  }
+}
+
+void
+cardano_protocol_param_update_ref(cardano_protocol_param_update_t* protocol_param_update)
+{
+  if (protocol_param_update == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&protocol_param_update->base);
+}
+
+size_t
+cardano_protocol_param_update_refcount(const cardano_protocol_param_update_t* protocol_param_update)
+{
+  if (protocol_param_update == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&protocol_param_update->base);
+}
+
+void
+cardano_protocol_param_update_set_last_error(cardano_protocol_param_update_t* protocol_param_update, const char* message)
+{
+  cardano_object_set_last_error(&protocol_param_update->base, message);
+}
+
+const char*
+cardano_protocol_param_update_get_last_error(const cardano_protocol_param_update_t* protocol_param_update)
+{
+  return cardano_object_get_last_error(&protocol_param_update->base);
+}
+
+cardano_error_t
+cardano_protocol_param_update_deep_clone(const cardano_protocol_param_update_t* source, cardano_protocol_param_update_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_protocol_param_update_t* copy = _cardano_malloc(sizeof(cardano_protocol_param_update_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count                         = 1U;
+  copy->base.deallocator                       = source->base.deallocator;
+  copy->base.last_error[0]                     = '\0';
+  copy->min_fee_a                              = NULL;
+  copy->min_fee_b                              = NULL;
+  copy->max_block_body_size                    = NULL;
+  copy->max_tx_size                            = NULL;
+  copy->max_block_header_size                  = NULL;
+  copy->key_deposit                            = NULL;
+  copy->pool_deposit                           = NULL;
+  copy->max_epoch                              = NULL;
+  copy->n_opt                                  = NULL;
+  copy->pool_pledge_influence                  = NULL;
+  copy->expansion_rate                         = NULL;
+  copy->treasury_growth_rate                   = NULL;
+  copy->d                                      = NULL;
+  copy->extra_entropy                          = NULL;
+  copy->protocol_version                       = NULL;
+  copy->min_pool_cost                          = NULL;
+  copy->ada_per_utxo_byte                      = NULL;
+  copy->cost_models                            = NULL;
+  copy->execution_costs                        = NULL;
+  copy->max_tx_ex_units                        = NULL;
+  copy->max_block_ex_units                     = NULL;
+  copy->max_value_size                         = NULL;
+  copy->collateral_percentage                  = NULL;
+  copy->max_collateral_inputs                  = NULL;
+  copy->pool_voting_thresholds                 = NULL;
+  copy->drep_voting_thresholds                 = NULL;
+  copy->min_committee_size                     = NULL;
+  copy->committee_term_limit                   = NULL;
+  copy->governance_action_validity_period      = NULL;
+  copy->governance_action_deposit              = NULL;
+  copy->drep_deposit                           = NULL;
+  copy->drep_inactivity_period                 = NULL;
+  copy->ref_script_cost_per_byte               = NULL;
+  copy->max_ref_script_size_per_block          = NULL;
+  copy->max_ref_script_size_per_tx             = NULL;
+  copy->ref_script_cost_stride                 = NULL;
+  copy->ref_script_cost_multiplier             = NULL;
+  copy->has_max_pledge_leverage                = source->has_max_pledge_leverage;
+  copy->max_pledge_leverage                    = NULL;
+  copy->min_pool_margin                        = NULL;
+  copy->leios_announcement_period_length       = NULL;
+  copy->leios_vote_period_length               = NULL;
+  copy->leios_diffusion_period_length          = NULL;
+  copy->leios_committee_size                   = NULL;
+  copy->leios_quorum_stake_threshold           = NULL;
+  copy->max_endorser_block_references_size     = NULL;
+  copy->max_endorser_block_txs_size            = NULL;
+  copy->max_endorser_block_execution_units     = NULL;
+  copy->max_ref_script_size_per_endorser_block = NULL;
+  copy->peras_min_candidate_block_age          = NULL;
+  copy->peras_healing_factor                   = NULL;
+  copy->peras_cert_boost                       = NULL;
+  copy->peras_target_committee_size            = NULL;
+  copy->has_peras_bootstrap_round              = source->has_peras_bootstrap_round;
+  copy->peras_bootstrap_round                  = NULL;
+  copy->peras_quorum_threshold_safety_margin   = NULL;
+  copy->ref_inputs_cost_per_multi_asset_byte   = NULL;
+  copy->ref_inputs_cost_per_datum_byte         = NULL;
+
+  if (source->min_fee_a != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->min_fee_a = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->min_fee_a == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->min_fee_a, source->min_fee_a, size));
+  }
+
+  if (source->min_fee_b != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->min_fee_b = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->min_fee_b == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->min_fee_b, source->min_fee_b, size));
+  }
+
+  if (source->max_block_body_size != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->max_block_body_size = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->max_block_body_size == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->max_block_body_size, source->max_block_body_size, size));
+  }
+
+  if (source->max_tx_size != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->max_tx_size = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->max_tx_size == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->max_tx_size, source->max_tx_size, size));
+  }
+
+  if (source->max_block_header_size != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->max_block_header_size = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->max_block_header_size == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->max_block_header_size, source->max_block_header_size, size));
+  }
+
+  if (source->key_deposit != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->key_deposit = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->key_deposit == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->key_deposit, source->key_deposit, size));
+  }
+
+  if (source->pool_deposit != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->pool_deposit = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->pool_deposit == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->pool_deposit, source->pool_deposit, size));
+  }
+
+  if (source->max_epoch != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->max_epoch = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->max_epoch == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->max_epoch, source->max_epoch, size));
+  }
+
+  if (source->n_opt != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->n_opt = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->n_opt == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->n_opt, source->n_opt, size));
+  }
+
+  if (source->pool_pledge_influence != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->pool_pledge_influence, &copy->pool_pledge_influence);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->expansion_rate != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->expansion_rate, &copy->expansion_rate);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->treasury_growth_rate != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->treasury_growth_rate, &copy->treasury_growth_rate);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->d != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->d, &copy->d);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->extra_entropy != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->extra_entropy, &copy->extra_entropy);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->protocol_version != NULL)
+  {
+    const cardano_error_t result = cardano_protocol_version_deep_clone(source->protocol_version, &copy->protocol_version);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->min_pool_cost != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->min_pool_cost = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->min_pool_cost == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->min_pool_cost, source->min_pool_cost, size));
+  }
+
+  if (source->ada_per_utxo_byte != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->ada_per_utxo_byte = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->ada_per_utxo_byte == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->ada_per_utxo_byte, source->ada_per_utxo_byte, size));
+  }
+
+  if (source->cost_models != NULL)
+  {
+    const cardano_error_t result = cardano_costmdls_deep_clone(source->cost_models, &copy->cost_models);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->execution_costs != NULL)
+  {
+    const cardano_error_t result = cardano_ex_unit_prices_deep_clone(source->execution_costs, &copy->execution_costs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->max_tx_ex_units != NULL)
+  {
+    const cardano_error_t result = cardano_ex_units_deep_clone(source->max_tx_ex_units, &copy->max_tx_ex_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->max_block_ex_units != NULL)
+  {
+    const cardano_error_t result = cardano_ex_units_deep_clone(source->max_block_ex_units, &copy->max_block_ex_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->max_value_size != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->max_value_size = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->max_value_size == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->max_value_size, source->max_value_size, size));
+  }
+
+  if (source->collateral_percentage != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->collateral_percentage = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->collateral_percentage == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->collateral_percentage, source->collateral_percentage, size));
+  }
+
+  if (source->max_collateral_inputs != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->max_collateral_inputs = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->max_collateral_inputs == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->max_collateral_inputs, source->max_collateral_inputs, size));
+  }
+
+  if (source->pool_voting_thresholds != NULL)
+  {
+    const cardano_error_t result = cardano_pool_voting_thresholds_deep_clone(source->pool_voting_thresholds, &copy->pool_voting_thresholds);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->drep_voting_thresholds != NULL)
+  {
+    const cardano_error_t result = cardano_drep_voting_thresholds_deep_clone(source->drep_voting_thresholds, &copy->drep_voting_thresholds);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->min_committee_size != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->min_committee_size = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->min_committee_size == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->min_committee_size, source->min_committee_size, size));
+  }
+
+  if (source->committee_term_limit != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->committee_term_limit = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->committee_term_limit == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->committee_term_limit, source->committee_term_limit, size));
+  }
+
+  if (source->governance_action_validity_period != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->governance_action_validity_period = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->governance_action_validity_period == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->governance_action_validity_period, source->governance_action_validity_period, size));
+  }
+
+  if (source->governance_action_deposit != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->governance_action_deposit = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->governance_action_deposit == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->governance_action_deposit, source->governance_action_deposit, size));
+  }
+
+  if (source->drep_deposit != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->drep_deposit = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->drep_deposit == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->drep_deposit, source->drep_deposit, size));
+  }
+
+  if (source->drep_inactivity_period != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->drep_inactivity_period = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->drep_inactivity_period == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->drep_inactivity_period, source->drep_inactivity_period, size));
+  }
+
+  if (source->ref_script_cost_per_byte != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->ref_script_cost_per_byte, &copy->ref_script_cost_per_byte);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->max_ref_script_size_per_block != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->max_ref_script_size_per_block = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->max_ref_script_size_per_block == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->max_ref_script_size_per_block, source->max_ref_script_size_per_block, size));
+  }
+
+  if (source->max_ref_script_size_per_tx != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->max_ref_script_size_per_tx = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->max_ref_script_size_per_tx == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->max_ref_script_size_per_tx, source->max_ref_script_size_per_tx, size));
+  }
+
+  if (source->ref_script_cost_stride != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->ref_script_cost_stride = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->ref_script_cost_stride == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->ref_script_cost_stride, source->ref_script_cost_stride, size));
+  }
+
+  if (source->ref_script_cost_multiplier != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->ref_script_cost_multiplier, &copy->ref_script_cost_multiplier);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->max_pledge_leverage != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->max_pledge_leverage, &copy->max_pledge_leverage);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->min_pool_margin != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->min_pool_margin, &copy->min_pool_margin);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->leios_announcement_period_length != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->leios_announcement_period_length = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->leios_announcement_period_length == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->leios_announcement_period_length, source->leios_announcement_period_length, size));
+  }
+
+  if (source->leios_vote_period_length != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->leios_vote_period_length = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->leios_vote_period_length == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->leios_vote_period_length, source->leios_vote_period_length, size));
+  }
+
+  if (source->leios_diffusion_period_length != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->leios_diffusion_period_length = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->leios_diffusion_period_length == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->leios_diffusion_period_length, source->leios_diffusion_period_length, size));
+  }
+
+  if (source->leios_committee_size != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->leios_committee_size = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->leios_committee_size == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->leios_committee_size, source->leios_committee_size, size));
+  }
+
+  if (source->leios_quorum_stake_threshold != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->leios_quorum_stake_threshold, &copy->leios_quorum_stake_threshold);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->max_endorser_block_references_size != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->max_endorser_block_references_size = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->max_endorser_block_references_size == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->max_endorser_block_references_size, source->max_endorser_block_references_size, size));
+  }
+
+  if (source->max_endorser_block_txs_size != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->max_endorser_block_txs_size = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->max_endorser_block_txs_size == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->max_endorser_block_txs_size, source->max_endorser_block_txs_size, size));
+  }
+
+  if (source->max_endorser_block_execution_units != NULL)
+  {
+    const cardano_error_t result = cardano_ex_units_deep_clone(source->max_endorser_block_execution_units, &copy->max_endorser_block_execution_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->max_ref_script_size_per_endorser_block != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->max_ref_script_size_per_endorser_block = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->max_ref_script_size_per_endorser_block == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->max_ref_script_size_per_endorser_block, source->max_ref_script_size_per_endorser_block, size));
+  }
+
+  if (source->peras_min_candidate_block_age != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->peras_min_candidate_block_age = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->peras_min_candidate_block_age == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->peras_min_candidate_block_age, source->peras_min_candidate_block_age, size));
+  }
+
+  if (source->peras_healing_factor != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->peras_healing_factor, &copy->peras_healing_factor);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->peras_cert_boost != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->peras_cert_boost = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->peras_cert_boost == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->peras_cert_boost, source->peras_cert_boost, size));
+  }
+
+  if (source->peras_target_committee_size != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->peras_target_committee_size = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->peras_target_committee_size == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->peras_target_committee_size, source->peras_target_committee_size, size));
+  }
+
+  if (source->peras_bootstrap_round != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->peras_bootstrap_round = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->peras_bootstrap_round == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->peras_bootstrap_round, source->peras_bootstrap_round, size));
+  }
+
+  if (source->peras_quorum_threshold_safety_margin != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->peras_quorum_threshold_safety_margin, &copy->peras_quorum_threshold_safety_margin);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->ref_inputs_cost_per_multi_asset_byte != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->ref_inputs_cost_per_multi_asset_byte = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->ref_inputs_cost_per_multi_asset_byte == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->ref_inputs_cost_per_multi_asset_byte, source->ref_inputs_cost_per_multi_asset_byte, size));
+  }
+
+  if (source->ref_inputs_cost_per_datum_byte != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->ref_inputs_cost_per_datum_byte = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->ref_inputs_cost_per_datum_byte == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->ref_inputs_cost_per_datum_byte, source->ref_inputs_cost_per_datum_byte, size));
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_param_update_get_ref_inputs_cost_per_multi_asset_policy(
+  const cardano_protocol_param_update_t* protocol_param_update,
+  uint64_t*                              ref_inputs_cost_per_multi_asset_policy)
+{
+  return cardano_protocol_param_update_get_ref_inputs_cost_per_multi_asset_byte(protocol_param_update, ref_inputs_cost_per_multi_asset_policy);
+}
+
+cardano_error_t
+cardano_protocol_param_update_set_ref_inputs_cost_per_multi_asset_policy(
+  cardano_protocol_param_update_t* protocol_param_update,
+  const uint64_t*                  ref_inputs_cost_per_multi_asset_policy)
+{
+  return cardano_protocol_param_update_set_ref_inputs_cost_per_multi_asset_byte(protocol_param_update, ref_inputs_cost_per_multi_asset_policy);
+}
diff --git a/vendor/src/protocol_params/protocol_parameters.c b/vendor/src/protocol_params/protocol_parameters.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/protocol_params/protocol_parameters.c
@@ -0,0 +1,2449 @@
+/**
+ * \file protocol_parameters.c
+ *
+ * \author angel.castillo
+ * \date   Sep 26, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/protocol_params/protocol_parameters.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Protocol parameters govern various aspects of the Cardano network.
+ */
+typedef struct cardano_protocol_parameters_t
+{
+    cardano_object_t                  base;
+    uint64_t                          min_fee_a;
+    uint64_t                          min_fee_b;
+    uint64_t                          max_block_body_size;
+    uint64_t                          max_tx_size;
+    uint64_t                          max_block_header_size;
+    uint64_t                          key_deposit;
+    uint64_t                          pool_deposit;
+    uint64_t                          max_epoch;
+    uint64_t                          n_opt;
+    cardano_unit_interval_t*          pool_pledge_influence;
+    cardano_unit_interval_t*          expansion_rate;
+    cardano_unit_interval_t*          treasury_growth_rate;
+    cardano_unit_interval_t*          d;
+    cardano_buffer_t*                 extra_entropy;
+    cardano_protocol_version_t*       protocol_version;
+    uint64_t                          min_pool_cost;
+    uint64_t                          ada_per_utxo_byte;
+    cardano_costmdls_t*               cost_models;
+    cardano_ex_unit_prices_t*         execution_costs;
+    cardano_ex_units_t*               max_tx_ex_units;
+    cardano_ex_units_t*               max_block_ex_units;
+    uint64_t                          max_value_size;
+    uint64_t                          collateral_percentage;
+    uint64_t                          max_collateral_inputs;
+    cardano_pool_voting_thresholds_t* pool_voting_thresholds;
+    cardano_drep_voting_thresholds_t* drep_voting_thresholds;
+    uint64_t                          min_committee_size;
+    uint64_t                          committee_term_limit;
+    uint64_t                          governance_action_validity_period;
+    uint64_t                          governance_action_deposit;
+    uint64_t                          drep_deposit;
+    uint64_t                          drep_inactivity_period;
+    cardano_unit_interval_t*          ref_script_cost_per_byte;
+    uint64_t                          max_ref_script_size_per_block;
+    uint64_t                          max_ref_script_size_per_tx;
+    uint64_t                          ref_script_cost_stride;
+    cardano_unit_interval_t*          ref_script_cost_multiplier;
+    cardano_unit_interval_t*          max_pledge_leverage;
+    cardano_unit_interval_t*          min_pool_margin;
+    uint64_t                          leios_announcement_period_length;
+    uint64_t                          leios_vote_period_length;
+    uint64_t                          leios_diffusion_period_length;
+    uint64_t                          leios_committee_size;
+    cardano_unit_interval_t*          leios_quorum_stake_threshold;
+    uint64_t                          max_endorser_block_references_size;
+    uint64_t                          max_endorser_block_txs_size;
+    cardano_ex_units_t*               max_endorser_block_execution_units;
+    uint64_t                          max_ref_script_size_per_endorser_block;
+    uint64_t                          peras_min_candidate_block_age;
+    cardano_unit_interval_t*          peras_healing_factor;
+    uint64_t                          peras_cert_boost;
+    uint64_t                          peras_target_committee_size;
+    bool                              has_peras_bootstrap_round;
+    uint64_t                          peras_bootstrap_round;
+    cardano_unit_interval_t*          peras_quorum_threshold_safety_margin;
+    uint64_t                          ref_inputs_cost_per_multi_asset_byte;
+    uint64_t                          ref_inputs_cost_per_datum_byte;
+} cardano_protocol_parameters_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a protocol parameters update object.
+ *
+ * This function is responsible for properly deallocating a protocol parameters update object (`cardano_protocol_parameters_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the protocol_parameters object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_protocol_parameters_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the protocol_parameters
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_protocol_parameters_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_protocol_parameters_t* data = (cardano_protocol_parameters_t*)object;
+
+  cardano_unit_interval_unref(&data->pool_pledge_influence);
+  cardano_unit_interval_unref(&data->expansion_rate);
+  cardano_unit_interval_unref(&data->treasury_growth_rate);
+  cardano_unit_interval_unref(&data->d);
+  cardano_buffer_unref(&data->extra_entropy);
+  cardano_protocol_version_unref(&data->protocol_version);
+  cardano_costmdls_unref(&data->cost_models);
+  cardano_ex_unit_prices_unref(&data->execution_costs);
+  cardano_ex_units_unref(&data->max_tx_ex_units);
+  cardano_ex_units_unref(&data->max_block_ex_units);
+  cardano_pool_voting_thresholds_unref(&data->pool_voting_thresholds);
+  cardano_drep_voting_thresholds_unref(&data->drep_voting_thresholds);
+  cardano_unit_interval_unref(&data->ref_script_cost_per_byte);
+  cardano_unit_interval_unref(&data->ref_script_cost_multiplier);
+  cardano_unit_interval_unref(&data->max_pledge_leverage);
+  cardano_unit_interval_unref(&data->min_pool_margin);
+  cardano_unit_interval_unref(&data->leios_quorum_stake_threshold);
+  cardano_ex_units_unref(&data->max_endorser_block_execution_units);
+  cardano_unit_interval_unref(&data->peras_healing_factor);
+  cardano_unit_interval_unref(&data->peras_quorum_threshold_safety_margin);
+
+  _cardano_free(object);
+}
+
+/**
+ * Creates a unit interval with 1/1 values.
+ *
+ * @return The new unit interval.
+ */
+static cardano_unit_interval_t*
+cardano_get_one_interval(void)
+{
+  cardano_unit_interval_t* unit_interval = NULL;
+
+  cardano_error_t result = cardano_unit_interval_new(1, 1, &unit_interval);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return unit_interval;
+}
+
+/**
+ * Creates a unit interval with 0/1 values.
+ *
+ * @return The new unit interval.
+ */
+static cardano_unit_interval_t*
+cardano_get_zero_interval(void)
+{
+  cardano_unit_interval_t* unit_interval = NULL;
+
+  cardano_error_t result = cardano_unit_interval_new(0, 1, &unit_interval);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return unit_interval;
+}
+
+/**
+ * Creates a protocol version with 0 0 values.
+ *
+ * @return The protocol version.
+ */
+static cardano_protocol_version_t*
+cardano_get_protocol_version(void)
+{
+  cardano_protocol_version_t* protocol_version = NULL;
+
+  cardano_error_t result = cardano_protocol_version_new(0, 0, &protocol_version);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return protocol_version;
+}
+
+/**
+ * Creates empty costmdls.
+ *
+ * @return The costmdls.
+ */
+static cardano_costmdls_t*
+cardano_get_costmdls(void)
+{
+  cardano_costmdls_t* costmdls = NULL;
+
+  cardano_error_t result = cardano_costmdls_new(&costmdls);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return costmdls;
+}
+
+/**
+ * Creates ex unit prices.
+ *
+ * @return The ex unit prices.
+ */
+static cardano_ex_unit_prices_t*
+cardano_get_ex_unit_prices(void)
+{
+  cardano_ex_unit_prices_t* ex_unit_prices = NULL;
+
+  cardano_unit_interval_t* memory_prices = cardano_get_one_interval();
+  cardano_unit_interval_t* steps_prices  = cardano_get_one_interval();
+
+  cardano_error_t result = cardano_ex_unit_prices_new(memory_prices, steps_prices, &ex_unit_prices);
+
+  cardano_unit_interval_unref(&memory_prices);
+  cardano_unit_interval_unref(&steps_prices);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return ex_unit_prices;
+}
+
+/**
+ * Creates ex units.
+ *
+ * @return The ex units.
+ */
+static cardano_ex_units_t*
+cardano_get_ex_unit(void)
+{
+  cardano_ex_units_t* ex_units = NULL;
+
+  cardano_error_t result = cardano_ex_units_new(0, 0, &ex_units);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return ex_units;
+}
+
+/**
+ * Creates voting thresholds.
+ *
+ * @return The voting thresholds.
+ */
+static cardano_pool_voting_thresholds_t*
+cardano_get_pool_voting_thresholds(void)
+{
+  cardano_unit_interval_t* motion_no_confidence    = cardano_get_one_interval();
+  cardano_unit_interval_t* committee_normal        = cardano_get_one_interval();
+  cardano_unit_interval_t* committee_no_confidence = cardano_get_one_interval();
+  cardano_unit_interval_t* hard_fork_initiation    = cardano_get_one_interval();
+  cardano_unit_interval_t* security_relevant_param = cardano_get_one_interval();
+
+  cardano_pool_voting_thresholds_t* thresholds = NULL;
+
+  cardano_error_t result = cardano_pool_voting_thresholds_new(
+    motion_no_confidence,
+    committee_normal,
+    committee_no_confidence,
+    hard_fork_initiation,
+    security_relevant_param,
+    &thresholds);
+
+  cardano_unit_interval_unref(&motion_no_confidence);
+  cardano_unit_interval_unref(&committee_normal);
+  cardano_unit_interval_unref(&committee_no_confidence);
+  cardano_unit_interval_unref(&hard_fork_initiation);
+  cardano_unit_interval_unref(&security_relevant_param);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return thresholds;
+}
+
+/**
+ * Creates voting thresholds.
+ *
+ * @return The voting thresholds.
+ */
+static cardano_drep_voting_thresholds_t*
+cardano_get_drep_voting_thresholds(void)
+{
+  cardano_unit_interval_t* motion_no_confidence    = cardano_get_one_interval();
+  cardano_unit_interval_t* committee_normal        = cardano_get_one_interval();
+  cardano_unit_interval_t* committee_no_confidence = cardano_get_one_interval();
+  cardano_unit_interval_t* update_constitution     = cardano_get_one_interval();
+  cardano_unit_interval_t* hard_fork_initiation    = cardano_get_one_interval();
+  cardano_unit_interval_t* pp_network_group        = cardano_get_one_interval();
+  cardano_unit_interval_t* pp_economic_group       = cardano_get_one_interval();
+  cardano_unit_interval_t* pp_technical_group      = cardano_get_one_interval();
+  cardano_unit_interval_t* pp_governance_group     = cardano_get_one_interval();
+  cardano_unit_interval_t* treasury_withdrawal     = cardano_get_one_interval();
+
+  cardano_drep_voting_thresholds_t* thresholds = NULL;
+
+  cardano_error_t result = cardano_drep_voting_thresholds_new(
+    motion_no_confidence,
+    committee_normal,
+    committee_no_confidence,
+    update_constitution,
+    hard_fork_initiation,
+    pp_network_group,
+    pp_economic_group,
+    pp_technical_group,
+    pp_governance_group,
+    treasury_withdrawal,
+    &thresholds);
+
+  cardano_unit_interval_unref(&motion_no_confidence);
+  cardano_unit_interval_unref(&committee_normal);
+  cardano_unit_interval_unref(&committee_no_confidence);
+  cardano_unit_interval_unref(&update_constitution);
+  cardano_unit_interval_unref(&hard_fork_initiation);
+  cardano_unit_interval_unref(&pp_network_group);
+  cardano_unit_interval_unref(&pp_economic_group);
+  cardano_unit_interval_unref(&pp_technical_group);
+  cardano_unit_interval_unref(&pp_governance_group);
+  cardano_unit_interval_unref(&treasury_withdrawal);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return thresholds;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_protocol_parameters_new(cardano_protocol_parameters_t** protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *protocol_parameters = _cardano_malloc(sizeof(cardano_protocol_parameters_t));
+
+  if (*protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*protocol_parameters)->base.deallocator   = cardano_protocol_parameters_deallocate;
+  (*protocol_parameters)->base.ref_count     = 1;
+  (*protocol_parameters)->base.last_error[0] = '\0';
+
+  (*protocol_parameters)->min_fee_a                              = 0;
+  (*protocol_parameters)->min_fee_b                              = 0;
+  (*protocol_parameters)->max_block_body_size                    = 0;
+  (*protocol_parameters)->max_tx_size                            = 0;
+  (*protocol_parameters)->max_block_header_size                  = 0;
+  (*protocol_parameters)->key_deposit                            = 0;
+  (*protocol_parameters)->pool_deposit                           = 0;
+  (*protocol_parameters)->max_epoch                              = 0;
+  (*protocol_parameters)->n_opt                                  = 0;
+  (*protocol_parameters)->pool_pledge_influence                  = cardano_get_one_interval();
+  (*protocol_parameters)->expansion_rate                         = cardano_get_one_interval();
+  (*protocol_parameters)->treasury_growth_rate                   = cardano_get_one_interval();
+  (*protocol_parameters)->d                                      = cardano_get_one_interval();
+  (*protocol_parameters)->extra_entropy                          = cardano_buffer_new(1);
+  (*protocol_parameters)->protocol_version                       = cardano_get_protocol_version();
+  (*protocol_parameters)->min_pool_cost                          = 0;
+  (*protocol_parameters)->ada_per_utxo_byte                      = 0;
+  (*protocol_parameters)->cost_models                            = cardano_get_costmdls();
+  (*protocol_parameters)->execution_costs                        = cardano_get_ex_unit_prices();
+  (*protocol_parameters)->max_tx_ex_units                        = cardano_get_ex_unit();
+  (*protocol_parameters)->max_block_ex_units                     = cardano_get_ex_unit();
+  (*protocol_parameters)->max_value_size                         = 0;
+  (*protocol_parameters)->collateral_percentage                  = 0;
+  (*protocol_parameters)->max_collateral_inputs                  = 0;
+  (*protocol_parameters)->pool_voting_thresholds                 = cardano_get_pool_voting_thresholds();
+  (*protocol_parameters)->drep_voting_thresholds                 = cardano_get_drep_voting_thresholds();
+  (*protocol_parameters)->min_committee_size                     = 0;
+  (*protocol_parameters)->committee_term_limit                   = 0;
+  (*protocol_parameters)->governance_action_validity_period      = 0;
+  (*protocol_parameters)->governance_action_deposit              = 0;
+  (*protocol_parameters)->drep_deposit                           = 0;
+  (*protocol_parameters)->drep_inactivity_period                 = 0;
+  (*protocol_parameters)->ref_script_cost_per_byte               = cardano_get_one_interval();
+  (*protocol_parameters)->max_ref_script_size_per_block          = 0;
+  (*protocol_parameters)->max_ref_script_size_per_tx             = 0;
+  (*protocol_parameters)->ref_script_cost_stride                 = 0;
+  (*protocol_parameters)->ref_script_cost_multiplier             = NULL;
+  (*protocol_parameters)->max_pledge_leverage                    = NULL;
+  (*protocol_parameters)->min_pool_margin                        = cardano_get_zero_interval();
+  (*protocol_parameters)->leios_announcement_period_length       = 0;
+  (*protocol_parameters)->leios_vote_period_length               = 0;
+  (*protocol_parameters)->leios_diffusion_period_length          = 0;
+  (*protocol_parameters)->leios_committee_size                   = 0;
+  (*protocol_parameters)->leios_quorum_stake_threshold           = cardano_get_zero_interval();
+  (*protocol_parameters)->max_endorser_block_references_size     = 0;
+  (*protocol_parameters)->max_endorser_block_txs_size            = 0;
+  (*protocol_parameters)->max_endorser_block_execution_units     = cardano_get_ex_unit();
+  (*protocol_parameters)->max_ref_script_size_per_endorser_block = 0;
+  (*protocol_parameters)->peras_min_candidate_block_age          = 0;
+  (*protocol_parameters)->peras_healing_factor                   = NULL;
+  (*protocol_parameters)->peras_cert_boost                       = 0;
+  (*protocol_parameters)->peras_target_committee_size            = 0;
+  (*protocol_parameters)->has_peras_bootstrap_round              = false;
+  (*protocol_parameters)->peras_bootstrap_round                  = 0;
+  (*protocol_parameters)->peras_quorum_threshold_safety_margin   = cardano_get_zero_interval();
+  (*protocol_parameters)->ref_inputs_cost_per_multi_asset_byte   = 0;
+  (*protocol_parameters)->ref_inputs_cost_per_datum_byte         = 0;
+
+  if (((*protocol_parameters)->pool_pledge_influence == NULL) || ((*protocol_parameters)->expansion_rate == NULL) || ((*protocol_parameters)->treasury_growth_rate == NULL) || ((*protocol_parameters)->d == NULL) || ((*protocol_parameters)->extra_entropy == NULL) || ((*protocol_parameters)->protocol_version == NULL) || ((*protocol_parameters)->cost_models == NULL) || ((*protocol_parameters)->execution_costs == NULL) || ((*protocol_parameters)->max_tx_ex_units == NULL) || ((*protocol_parameters)->max_block_ex_units == NULL) || ((*protocol_parameters)->pool_voting_thresholds == NULL) || ((*protocol_parameters)->drep_voting_thresholds == NULL) || ((*protocol_parameters)->ref_script_cost_per_byte == NULL) || ((*protocol_parameters)->min_pool_margin == NULL) || ((*protocol_parameters)->leios_quorum_stake_threshold == NULL) || ((*protocol_parameters)->max_endorser_block_execution_units == NULL) || ((*protocol_parameters)->peras_quorum_threshold_safety_margin == NULL))
+  {
+    cardano_protocol_parameters_unref(protocol_parameters);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_protocol_parameters_get_min_fee_a(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->min_fee_a;
+}
+
+uint64_t
+cardano_protocol_parameters_get_min_fee_b(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->min_fee_b;
+}
+
+uint64_t
+cardano_protocol_parameters_get_max_block_body_size(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->max_block_body_size;
+}
+
+uint64_t
+cardano_protocol_parameters_get_max_tx_size(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->max_tx_size;
+}
+
+uint64_t
+cardano_protocol_parameters_get_max_block_header_size(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->max_block_header_size;
+}
+
+uint64_t
+cardano_protocol_parameters_get_key_deposit(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->key_deposit;
+}
+
+uint64_t
+cardano_protocol_parameters_get_pool_deposit(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->pool_deposit;
+}
+
+uint64_t
+cardano_protocol_parameters_get_max_epoch(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->max_epoch;
+}
+
+uint64_t
+cardano_protocol_parameters_get_n_opt(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->n_opt;
+}
+
+cardano_unit_interval_t*
+cardano_protocol_parameters_get_pool_pledge_influence(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(protocol_parameters->pool_pledge_influence);
+  return protocol_parameters->pool_pledge_influence;
+}
+
+cardano_unit_interval_t*
+cardano_protocol_parameters_get_expansion_rate(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(protocol_parameters->expansion_rate);
+  return protocol_parameters->expansion_rate;
+}
+
+cardano_unit_interval_t*
+cardano_protocol_parameters_get_treasury_growth_rate(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(protocol_parameters->treasury_growth_rate);
+  return protocol_parameters->treasury_growth_rate;
+}
+
+cardano_unit_interval_t*
+cardano_protocol_parameters_get_d(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(protocol_parameters->d);
+  return protocol_parameters->d;
+}
+
+cardano_buffer_t*
+cardano_protocol_parameters_get_extra_entropy(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_buffer_ref(protocol_parameters->extra_entropy);
+  return protocol_parameters->extra_entropy;
+}
+
+cardano_protocol_version_t*
+cardano_protocol_parameters_get_protocol_version(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_protocol_version_ref(protocol_parameters->protocol_version);
+  return protocol_parameters->protocol_version;
+}
+
+uint64_t
+cardano_protocol_parameters_get_min_pool_cost(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->min_pool_cost;
+}
+
+uint64_t
+cardano_protocol_parameters_get_ada_per_utxo_byte(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->ada_per_utxo_byte;
+}
+
+cardano_costmdls_t*
+cardano_protocol_parameters_get_cost_models(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_costmdls_ref(protocol_parameters->cost_models);
+  return protocol_parameters->cost_models;
+}
+
+cardano_ex_unit_prices_t*
+cardano_protocol_parameters_get_execution_costs(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_ex_unit_prices_ref(protocol_parameters->execution_costs);
+  return protocol_parameters->execution_costs;
+}
+
+cardano_ex_units_t*
+cardano_protocol_parameters_get_max_tx_ex_units(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_ex_units_ref(protocol_parameters->max_tx_ex_units);
+  return protocol_parameters->max_tx_ex_units;
+}
+
+cardano_ex_units_t*
+cardano_protocol_parameters_get_max_block_ex_units(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_ex_units_ref(protocol_parameters->max_block_ex_units);
+  return protocol_parameters->max_block_ex_units;
+}
+
+uint64_t
+cardano_protocol_parameters_get_max_value_size(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->max_value_size;
+}
+
+uint64_t
+cardano_protocol_parameters_get_collateral_percentage(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->collateral_percentage;
+}
+
+uint64_t
+cardano_protocol_parameters_get_max_collateral_inputs(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->max_collateral_inputs;
+}
+
+cardano_pool_voting_thresholds_t*
+cardano_protocol_parameters_get_pool_voting_thresholds(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_pool_voting_thresholds_ref(protocol_parameters->pool_voting_thresholds);
+  return protocol_parameters->pool_voting_thresholds;
+}
+
+cardano_drep_voting_thresholds_t*
+cardano_protocol_parameters_get_drep_voting_thresholds(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_drep_voting_thresholds_ref(protocol_parameters->drep_voting_thresholds);
+  return protocol_parameters->drep_voting_thresholds;
+}
+
+uint64_t
+cardano_protocol_parameters_get_min_committee_size(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->min_committee_size;
+}
+
+uint64_t
+cardano_protocol_parameters_get_committee_term_limit(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->committee_term_limit;
+}
+
+uint64_t
+cardano_protocol_parameters_get_governance_action_validity_period(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->governance_action_validity_period;
+}
+
+uint64_t
+cardano_protocol_parameters_get_governance_action_deposit(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->governance_action_deposit;
+}
+
+uint64_t
+cardano_protocol_parameters_get_drep_deposit(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->drep_deposit;
+}
+
+uint64_t
+cardano_protocol_parameters_get_drep_inactivity_period(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->drep_inactivity_period;
+}
+
+cardano_unit_interval_t*
+cardano_protocol_parameters_get_ref_script_cost_per_byte(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(protocol_parameters->ref_script_cost_per_byte);
+  return protocol_parameters->ref_script_cost_per_byte;
+}
+
+uint64_t
+cardano_protocol_parameters_get_max_ref_script_size_per_block(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->max_ref_script_size_per_block;
+}
+
+uint64_t
+cardano_protocol_parameters_get_max_ref_script_size_per_tx(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->max_ref_script_size_per_tx;
+}
+
+uint64_t
+cardano_protocol_parameters_get_ref_script_cost_stride(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->ref_script_cost_stride;
+}
+
+cardano_unit_interval_t*
+cardano_protocol_parameters_get_ref_script_cost_multiplier(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(protocol_parameters->ref_script_cost_multiplier);
+  return protocol_parameters->ref_script_cost_multiplier;
+}
+
+cardano_unit_interval_t*
+cardano_protocol_parameters_get_max_pledge_leverage(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(protocol_parameters->max_pledge_leverage);
+  return protocol_parameters->max_pledge_leverage;
+}
+
+cardano_unit_interval_t*
+cardano_protocol_parameters_get_min_pool_margin(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(protocol_parameters->min_pool_margin);
+  return protocol_parameters->min_pool_margin;
+}
+
+uint64_t
+cardano_protocol_parameters_get_leios_announcement_period_length(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->leios_announcement_period_length;
+}
+
+uint64_t
+cardano_protocol_parameters_get_leios_vote_period_length(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->leios_vote_period_length;
+}
+
+uint64_t
+cardano_protocol_parameters_get_leios_diffusion_period_length(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->leios_diffusion_period_length;
+}
+
+uint64_t
+cardano_protocol_parameters_get_leios_committee_size(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->leios_committee_size;
+}
+
+cardano_unit_interval_t*
+cardano_protocol_parameters_get_leios_quorum_stake_threshold(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(protocol_parameters->leios_quorum_stake_threshold);
+  return protocol_parameters->leios_quorum_stake_threshold;
+}
+
+uint64_t
+cardano_protocol_parameters_get_max_endorser_block_references_size(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->max_endorser_block_references_size;
+}
+
+uint64_t
+cardano_protocol_parameters_get_max_endorser_block_txs_size(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->max_endorser_block_txs_size;
+}
+
+cardano_ex_units_t*
+cardano_protocol_parameters_get_max_endorser_block_execution_units(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_ex_units_ref(protocol_parameters->max_endorser_block_execution_units);
+  return protocol_parameters->max_endorser_block_execution_units;
+}
+
+uint64_t
+cardano_protocol_parameters_get_max_ref_script_size_per_endorser_block(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->max_ref_script_size_per_endorser_block;
+}
+
+uint64_t
+cardano_protocol_parameters_get_peras_min_candidate_block_age(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->peras_min_candidate_block_age;
+}
+
+cardano_unit_interval_t*
+cardano_protocol_parameters_get_peras_healing_factor(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(protocol_parameters->peras_healing_factor);
+  return protocol_parameters->peras_healing_factor;
+}
+
+uint64_t
+cardano_protocol_parameters_get_peras_cert_boost(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->peras_cert_boost;
+}
+
+uint64_t
+cardano_protocol_parameters_get_peras_target_committee_size(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->peras_target_committee_size;
+}
+
+const uint64_t*
+cardano_protocol_parameters_get_peras_bootstrap_round(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if ((protocol_parameters == NULL) || !protocol_parameters->has_peras_bootstrap_round)
+  {
+    return NULL;
+  }
+
+  return &protocol_parameters->peras_bootstrap_round;
+}
+
+cardano_unit_interval_t*
+cardano_protocol_parameters_get_peras_quorum_threshold_safety_margin(
+  cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_unit_interval_ref(protocol_parameters->peras_quorum_threshold_safety_margin);
+  return protocol_parameters->peras_quorum_threshold_safety_margin;
+}
+
+uint64_t
+cardano_protocol_parameters_get_ref_inputs_cost_per_multi_asset_byte(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->ref_inputs_cost_per_multi_asset_byte;
+}
+
+uint64_t
+cardano_protocol_parameters_get_ref_inputs_cost_per_datum_byte(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return protocol_parameters->ref_inputs_cost_per_datum_byte;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_min_fee_a(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       min_fee_a)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->min_fee_a = min_fee_a;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_min_fee_b(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       min_fee_b)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->min_fee_b = min_fee_b;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_block_body_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_block_body_size)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->max_block_body_size = max_block_body_size;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_tx_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_tx_size)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->max_tx_size = max_tx_size;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_block_header_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_block_header_size)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->max_block_header_size = max_block_header_size;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_key_deposit(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       key_deposit)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->key_deposit = key_deposit;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_pool_deposit(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       pool_deposit)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->pool_deposit = pool_deposit;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_epoch(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_epoch)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->max_epoch = max_epoch;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_n_opt(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       n_opt)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->n_opt = n_opt;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_pool_pledge_influence(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       pool_pledge_influence)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(pool_pledge_influence);
+  cardano_unit_interval_unref(&protocol_parameters->pool_pledge_influence);
+  protocol_parameters->pool_pledge_influence = pool_pledge_influence;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_expansion_rate(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       expansion_rate)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(expansion_rate);
+  cardano_unit_interval_unref(&protocol_parameters->expansion_rate);
+  protocol_parameters->expansion_rate = expansion_rate;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_treasury_growth_rate(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       treasury_growth_rate)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(treasury_growth_rate);
+  cardano_unit_interval_unref(&protocol_parameters->treasury_growth_rate);
+  protocol_parameters->treasury_growth_rate = treasury_growth_rate;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_d(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       d)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(d);
+  cardano_unit_interval_unref(&protocol_parameters->d);
+  protocol_parameters->d = d;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_extra_entropy(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_buffer_t*              extra_entropy)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_ref(extra_entropy);
+  cardano_buffer_unref(&protocol_parameters->extra_entropy);
+  protocol_parameters->extra_entropy = extra_entropy;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_protocol_version(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_protocol_version_t*    protocol_version)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_protocol_version_ref(protocol_version);
+  cardano_protocol_version_unref(&protocol_parameters->protocol_version);
+  protocol_parameters->protocol_version = protocol_version;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_min_pool_cost(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       min_pool_cost)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->min_pool_cost = min_pool_cost;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_ada_per_utxo_byte(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       ada_per_utxo_byte)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->ada_per_utxo_byte = ada_per_utxo_byte;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_cost_models(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_costmdls_t*            cost_models)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_costmdls_ref(cost_models);
+  cardano_costmdls_unref(&protocol_parameters->cost_models);
+  protocol_parameters->cost_models = cost_models;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_execution_costs(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_ex_unit_prices_t*      execution_costs)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ex_unit_prices_ref(execution_costs);
+  cardano_ex_unit_prices_unref(&protocol_parameters->execution_costs);
+  protocol_parameters->execution_costs = execution_costs;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_tx_ex_units(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_ex_units_t*            max_tx_ex_units)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ex_units_ref(max_tx_ex_units);
+  cardano_ex_units_unref(&protocol_parameters->max_tx_ex_units);
+  protocol_parameters->max_tx_ex_units = max_tx_ex_units;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_block_ex_units(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_ex_units_t*            max_block_ex_units)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ex_units_ref(max_block_ex_units);
+  cardano_ex_units_unref(&protocol_parameters->max_block_ex_units);
+  protocol_parameters->max_block_ex_units = max_block_ex_units;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_value_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  int64_t                        max_value_size)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->max_value_size = max_value_size;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_collateral_percentage(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       collateral_percentage)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->collateral_percentage = collateral_percentage;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_collateral_inputs(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_collateral_inputs)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->max_collateral_inputs = max_collateral_inputs;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_pool_voting_thresholds(
+  cardano_protocol_parameters_t*    protocol_parameters,
+  cardano_pool_voting_thresholds_t* pool_voting_thresholds)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_pool_voting_thresholds_ref(pool_voting_thresholds);
+  cardano_pool_voting_thresholds_unref(&protocol_parameters->pool_voting_thresholds);
+  protocol_parameters->pool_voting_thresholds = pool_voting_thresholds;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_drep_voting_thresholds(
+  cardano_protocol_parameters_t*    protocol_parameters,
+  cardano_drep_voting_thresholds_t* drep_voting_thresholds)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_drep_voting_thresholds_ref(drep_voting_thresholds);
+  cardano_drep_voting_thresholds_unref(&protocol_parameters->drep_voting_thresholds);
+  protocol_parameters->drep_voting_thresholds = drep_voting_thresholds;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_min_committee_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       min_committee_size)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->min_committee_size = min_committee_size;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_committee_term_limit(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       committee_term_limit)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->committee_term_limit = committee_term_limit;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_governance_action_validity_period(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       governance_action_validity_period)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->governance_action_validity_period = governance_action_validity_period;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_governance_action_deposit(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       governance_action_deposit)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->governance_action_deposit = governance_action_deposit;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_drep_deposit(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       drep_deposit)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->drep_deposit = drep_deposit;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_drep_inactivity_period(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       drep_inactivity_period)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->drep_inactivity_period = drep_inactivity_period;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_ref_script_cost_per_byte(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       ref_script_cost_per_byte)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(ref_script_cost_per_byte);
+  cardano_unit_interval_unref(&protocol_parameters->ref_script_cost_per_byte);
+  protocol_parameters->ref_script_cost_per_byte = ref_script_cost_per_byte;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_ref_script_size_per_block(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_ref_script_size_per_block)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (max_ref_script_size_per_block > UINT32_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Max ref script size per block must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->max_ref_script_size_per_block = max_ref_script_size_per_block;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_ref_script_size_per_tx(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_ref_script_size_per_tx)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (max_ref_script_size_per_tx > UINT32_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Max ref script size per tx must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->max_ref_script_size_per_tx = max_ref_script_size_per_tx;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_ref_script_cost_stride(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       ref_script_cost_stride)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((ref_script_cost_stride == 0U) || (ref_script_cost_stride > UINT32_MAX))
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Ref script cost stride must be a positive 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->ref_script_cost_stride = ref_script_cost_stride;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_ref_script_cost_multiplier(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       ref_script_cost_multiplier)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(ref_script_cost_multiplier);
+  cardano_unit_interval_unref(&protocol_parameters->ref_script_cost_multiplier);
+  protocol_parameters->ref_script_cost_multiplier = ref_script_cost_multiplier;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_pledge_leverage(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       max_pledge_leverage)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(max_pledge_leverage);
+  cardano_unit_interval_unref(&protocol_parameters->max_pledge_leverage);
+  protocol_parameters->max_pledge_leverage = max_pledge_leverage;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_min_pool_margin(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       min_pool_margin)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(min_pool_margin);
+  cardano_unit_interval_unref(&protocol_parameters->min_pool_margin);
+  protocol_parameters->min_pool_margin = min_pool_margin;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_leios_announcement_period_length(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       leios_announcement_period_length)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (leios_announcement_period_length > UINT32_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Leios announcement period length must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->leios_announcement_period_length = leios_announcement_period_length;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_leios_vote_period_length(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       leios_vote_period_length)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (leios_vote_period_length > UINT32_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Leios vote period length must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->leios_vote_period_length = leios_vote_period_length;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_leios_diffusion_period_length(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       leios_diffusion_period_length)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (leios_diffusion_period_length > UINT32_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Leios diffusion period length must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->leios_diffusion_period_length = leios_diffusion_period_length;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_leios_committee_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       leios_committee_size)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (leios_committee_size > UINT16_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Leios committee size must fit in a 16-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->leios_committee_size = leios_committee_size;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_leios_quorum_stake_threshold(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       leios_quorum_stake_threshold)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(leios_quorum_stake_threshold);
+  cardano_unit_interval_unref(&protocol_parameters->leios_quorum_stake_threshold);
+  protocol_parameters->leios_quorum_stake_threshold = leios_quorum_stake_threshold;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_endorser_block_references_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_endorser_block_references_size)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (max_endorser_block_references_size > UINT32_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Max endorser block references size must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->max_endorser_block_references_size = max_endorser_block_references_size;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_endorser_block_txs_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_endorser_block_txs_size)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (max_endorser_block_txs_size > UINT32_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Max endorser block txs size must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->max_endorser_block_txs_size = max_endorser_block_txs_size;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_endorser_block_execution_units(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_ex_units_t*            max_endorser_block_execution_units)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ex_units_ref(max_endorser_block_execution_units);
+  cardano_ex_units_unref(&protocol_parameters->max_endorser_block_execution_units);
+  protocol_parameters->max_endorser_block_execution_units = max_endorser_block_execution_units;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_max_ref_script_size_per_endorser_block(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       max_ref_script_size_per_endorser_block)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (max_ref_script_size_per_endorser_block > UINT32_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Max ref script size per endorser block must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->max_ref_script_size_per_endorser_block = max_ref_script_size_per_endorser_block;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_peras_min_candidate_block_age(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       peras_min_candidate_block_age)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (peras_min_candidate_block_age > UINT32_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Peras min candidate block age must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->peras_min_candidate_block_age = peras_min_candidate_block_age;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_peras_healing_factor(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       peras_healing_factor)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(peras_healing_factor);
+  cardano_unit_interval_unref(&protocol_parameters->peras_healing_factor);
+  protocol_parameters->peras_healing_factor = peras_healing_factor;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_peras_cert_boost(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       peras_cert_boost)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (peras_cert_boost > UINT16_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Peras cert boost must fit in a 16-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->peras_cert_boost = peras_cert_boost;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_peras_target_committee_size(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       peras_target_committee_size)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (peras_target_committee_size > UINT16_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Peras target committee size must fit in a 16-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->peras_target_committee_size = peras_target_committee_size;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_peras_bootstrap_round(
+  cardano_protocol_parameters_t* protocol_parameters,
+  const uint64_t*                peras_bootstrap_round)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (peras_bootstrap_round == NULL)
+  {
+    protocol_parameters->has_peras_bootstrap_round = false;
+    protocol_parameters->peras_bootstrap_round     = 0;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (*peras_bootstrap_round > UINT32_MAX)
+  {
+    cardano_protocol_parameters_set_last_error(protocol_parameters, "Peras bootstrap round must fit in a 32-bit unsigned integer.");
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  protocol_parameters->has_peras_bootstrap_round = true;
+  protocol_parameters->peras_bootstrap_round     = *peras_bootstrap_round;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_peras_quorum_threshold_safety_margin(
+  cardano_protocol_parameters_t* protocol_parameters,
+  cardano_unit_interval_t*       peras_quorum_threshold_safety_margin)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_ref(peras_quorum_threshold_safety_margin);
+  cardano_unit_interval_unref(&protocol_parameters->peras_quorum_threshold_safety_margin);
+  protocol_parameters->peras_quorum_threshold_safety_margin = peras_quorum_threshold_safety_margin;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_ref_inputs_cost_per_multi_asset_byte(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       ref_inputs_cost_per_multi_asset_byte)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->ref_inputs_cost_per_multi_asset_byte = ref_inputs_cost_per_multi_asset_byte;
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_ref_inputs_cost_per_datum_byte(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       ref_inputs_cost_per_datum_byte)
+{
+  if (protocol_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  protocol_parameters->ref_inputs_cost_per_datum_byte = ref_inputs_cost_per_datum_byte;
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_protocol_parameters_unref(cardano_protocol_parameters_t** protocol_parameters)
+{
+  if ((protocol_parameters == NULL) || (*protocol_parameters == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*protocol_parameters)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *protocol_parameters = NULL;
+    return;
+  }
+}
+
+void
+cardano_protocol_parameters_ref(cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&protocol_parameters->base);
+}
+
+size_t
+cardano_protocol_parameters_refcount(const cardano_protocol_parameters_t* protocol_parameters)
+{
+  if (protocol_parameters == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&protocol_parameters->base);
+}
+
+void
+cardano_protocol_parameters_set_last_error(cardano_protocol_parameters_t* protocol_parameters, const char* message)
+{
+  cardano_object_set_last_error(&protocol_parameters->base, message);
+}
+
+const char*
+cardano_protocol_parameters_get_last_error(const cardano_protocol_parameters_t* protocol_parameters)
+{
+  return cardano_object_get_last_error(&protocol_parameters->base);
+}
+
+cardano_error_t
+cardano_protocol_parameters_deep_clone(const cardano_protocol_parameters_t* source, cardano_protocol_parameters_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_protocol_parameters_t* copy = _cardano_malloc(sizeof(cardano_protocol_parameters_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count                         = 1U;
+  copy->base.deallocator                       = source->base.deallocator;
+  copy->base.last_error[0]                     = '\0';
+  copy->min_fee_a                              = source->min_fee_a;
+  copy->min_fee_b                              = source->min_fee_b;
+  copy->max_block_body_size                    = source->max_block_body_size;
+  copy->max_tx_size                            = source->max_tx_size;
+  copy->max_block_header_size                  = source->max_block_header_size;
+  copy->key_deposit                            = source->key_deposit;
+  copy->pool_deposit                           = source->pool_deposit;
+  copy->max_epoch                              = source->max_epoch;
+  copy->n_opt                                  = source->n_opt;
+  copy->pool_pledge_influence                  = NULL;
+  copy->expansion_rate                         = NULL;
+  copy->treasury_growth_rate                   = NULL;
+  copy->d                                      = NULL;
+  copy->extra_entropy                          = NULL;
+  copy->protocol_version                       = NULL;
+  copy->min_pool_cost                          = source->min_pool_cost;
+  copy->ada_per_utxo_byte                      = source->ada_per_utxo_byte;
+  copy->cost_models                            = NULL;
+  copy->execution_costs                        = NULL;
+  copy->max_tx_ex_units                        = NULL;
+  copy->max_block_ex_units                     = NULL;
+  copy->max_value_size                         = source->max_value_size;
+  copy->collateral_percentage                  = source->collateral_percentage;
+  copy->max_collateral_inputs                  = source->max_collateral_inputs;
+  copy->pool_voting_thresholds                 = NULL;
+  copy->drep_voting_thresholds                 = NULL;
+  copy->min_committee_size                     = source->min_committee_size;
+  copy->committee_term_limit                   = source->committee_term_limit;
+  copy->governance_action_validity_period      = source->governance_action_validity_period;
+  copy->governance_action_deposit              = source->governance_action_deposit;
+  copy->drep_deposit                           = source->drep_deposit;
+  copy->drep_inactivity_period                 = source->drep_inactivity_period;
+  copy->ref_script_cost_per_byte               = NULL;
+  copy->max_ref_script_size_per_block          = source->max_ref_script_size_per_block;
+  copy->max_ref_script_size_per_tx             = source->max_ref_script_size_per_tx;
+  copy->ref_script_cost_stride                 = source->ref_script_cost_stride;
+  copy->ref_script_cost_multiplier             = NULL;
+  copy->max_pledge_leverage                    = NULL;
+  copy->min_pool_margin                        = NULL;
+  copy->leios_announcement_period_length       = source->leios_announcement_period_length;
+  copy->leios_vote_period_length               = source->leios_vote_period_length;
+  copy->leios_diffusion_period_length          = source->leios_diffusion_period_length;
+  copy->leios_committee_size                   = source->leios_committee_size;
+  copy->leios_quorum_stake_threshold           = NULL;
+  copy->max_endorser_block_references_size     = source->max_endorser_block_references_size;
+  copy->max_endorser_block_txs_size            = source->max_endorser_block_txs_size;
+  copy->max_endorser_block_execution_units     = NULL;
+  copy->max_ref_script_size_per_endorser_block = source->max_ref_script_size_per_endorser_block;
+  copy->peras_min_candidate_block_age          = source->peras_min_candidate_block_age;
+  copy->peras_healing_factor                   = NULL;
+  copy->peras_cert_boost                       = source->peras_cert_boost;
+  copy->peras_target_committee_size            = source->peras_target_committee_size;
+  copy->has_peras_bootstrap_round              = source->has_peras_bootstrap_round;
+  copy->peras_bootstrap_round                  = source->peras_bootstrap_round;
+  copy->peras_quorum_threshold_safety_margin   = NULL;
+  copy->ref_inputs_cost_per_multi_asset_byte   = source->ref_inputs_cost_per_multi_asset_byte;
+  copy->ref_inputs_cost_per_datum_byte         = source->ref_inputs_cost_per_datum_byte;
+
+  if (source->pool_pledge_influence != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->pool_pledge_influence, &copy->pool_pledge_influence);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->expansion_rate != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->expansion_rate, &copy->expansion_rate);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->treasury_growth_rate != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->treasury_growth_rate, &copy->treasury_growth_rate);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->d != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->d, &copy->d);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->extra_entropy != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->extra_entropy, &copy->extra_entropy);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->protocol_version != NULL)
+  {
+    const cardano_error_t result = cardano_protocol_version_deep_clone(source->protocol_version, &copy->protocol_version);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cost_models != NULL)
+  {
+    const cardano_error_t result = cardano_costmdls_deep_clone(source->cost_models, &copy->cost_models);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->execution_costs != NULL)
+  {
+    const cardano_error_t result = cardano_ex_unit_prices_deep_clone(source->execution_costs, &copy->execution_costs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->max_tx_ex_units != NULL)
+  {
+    const cardano_error_t result = cardano_ex_units_deep_clone(source->max_tx_ex_units, &copy->max_tx_ex_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->max_block_ex_units != NULL)
+  {
+    const cardano_error_t result = cardano_ex_units_deep_clone(source->max_block_ex_units, &copy->max_block_ex_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pool_voting_thresholds != NULL)
+  {
+    const cardano_error_t result = cardano_pool_voting_thresholds_deep_clone(source->pool_voting_thresholds, &copy->pool_voting_thresholds);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->drep_voting_thresholds != NULL)
+  {
+    const cardano_error_t result = cardano_drep_voting_thresholds_deep_clone(source->drep_voting_thresholds, &copy->drep_voting_thresholds);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->ref_script_cost_per_byte != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->ref_script_cost_per_byte, &copy->ref_script_cost_per_byte);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->ref_script_cost_multiplier != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->ref_script_cost_multiplier, &copy->ref_script_cost_multiplier);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->max_pledge_leverage != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->max_pledge_leverage, &copy->max_pledge_leverage);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->min_pool_margin != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->min_pool_margin, &copy->min_pool_margin);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->leios_quorum_stake_threshold != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->leios_quorum_stake_threshold, &copy->leios_quorum_stake_threshold);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->max_endorser_block_execution_units != NULL)
+  {
+    const cardano_error_t result = cardano_ex_units_deep_clone(source->max_endorser_block_execution_units, &copy->max_endorser_block_execution_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->peras_healing_factor != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->peras_healing_factor, &copy->peras_healing_factor);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->peras_quorum_threshold_safety_margin != NULL)
+  {
+    const cardano_error_t result = cardano_unit_interval_deep_clone(source->peras_quorum_threshold_safety_margin, &copy->peras_quorum_threshold_safety_margin);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_protocol_parameters_get_ref_inputs_cost_per_multi_asset_policy(
+  const cardano_protocol_parameters_t* protocol_parameters)
+{
+  return cardano_protocol_parameters_get_ref_inputs_cost_per_multi_asset_byte(protocol_parameters);
+}
+
+cardano_error_t
+cardano_protocol_parameters_set_ref_inputs_cost_per_multi_asset_policy(
+  cardano_protocol_parameters_t* protocol_parameters,
+  uint64_t                       ref_inputs_cost_per_multi_asset_policy)
+{
+  return cardano_protocol_parameters_set_ref_inputs_cost_per_multi_asset_byte(protocol_parameters, ref_inputs_cost_per_multi_asset_policy);
+}
diff --git a/vendor/src/protocol_params/update.c b/vendor/src/protocol_params/update.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/protocol_params/update.c
@@ -0,0 +1,407 @@
+/**
+ * \file update.c
+ *
+ * \author angel.castillo
+ * \date   Jun 09, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/protocol_params/proposed_param_updates.h>
+#include <cardano/protocol_params/update.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief When stakeholders wish to propose changes to the system's parameters, they submit an update proposal.
+ * Such proposals are then voted on by the community. If approved, the protocol parameters are adjusted
+ * accordingly in the specified epoch.
+ */
+typedef struct cardano_update_t
+{
+    cardano_object_t                  base;
+    uint64_t                          epoch;
+    cardano_proposed_param_updates_t* proposed_param_updates;
+} cardano_update_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a update object.
+ *
+ * This function is responsible for properly deallocating a update object (`cardano_update_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the update object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_update_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the update
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_update_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_update_t* data = (cardano_update_t*)object;
+
+  cardano_proposed_param_updates_unref(&data->proposed_param_updates);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_update_new(uint64_t epoch, cardano_proposed_param_updates_t* updates, cardano_update_t** update)
+{
+  if (update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *update = _cardano_malloc(sizeof(cardano_update_t));
+
+  if (*update == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*update)->base.deallocator   = cardano_update_deallocate;
+  (*update)->base.ref_count     = 1;
+  (*update)->base.last_error[0] = '\0';
+
+  (*update)->epoch = epoch;
+
+  cardano_proposed_param_updates_ref(updates);
+
+  (*update)->proposed_param_updates = updates;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_update_from_cbor(cardano_cbor_reader_t* reader, cardano_update_t** update)
+{
+  if (update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *update = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "update";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *update = NULL;
+    return expect_array_result;
+  }
+
+  cardano_proposed_param_updates_t* proposed_param_updates = NULL;
+
+  cardano_error_t error = cardano_proposed_param_updates_from_cbor(reader, &proposed_param_updates);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    *update = NULL;
+    return error;
+  }
+
+  uint64_t epoch = 0;
+
+  error = cardano_cbor_reader_read_uint(reader, &epoch);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_proposed_param_updates_unref(&proposed_param_updates);
+    *update = NULL;
+    return error;
+  }
+
+  error = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_proposed_param_updates_unref(&proposed_param_updates);
+    *update = NULL;
+    return error;
+  }
+
+  error = cardano_update_new(epoch, proposed_param_updates, update);
+
+  cardano_proposed_param_updates_unref(&proposed_param_updates);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    *update = NULL;
+    return error;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_update_to_cbor(const cardano_update_t* update, cardano_cbor_writer_t* writer)
+{
+  if (update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t error = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_proposed_param_updates_to_cbor(update->proposed_param_updates, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_cbor_writer_write_uint(writer, update->epoch);
+
+  return error;
+}
+
+cardano_error_t
+cardano_update_to_cip116_json(
+  const cardano_update_t* update,
+  cardano_json_writer_t*  writer)
+{
+  if ((update == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "epoch", 5);
+  cardano_json_writer_write_uint(writer, update->epoch);
+
+  cardano_json_writer_write_property_name(writer, "proposed_protocol_parameter_updates", 35);
+
+  assert(update->proposed_param_updates != NULL);
+
+  cardano_error_t error = cardano_proposed_param_updates_to_cip116_json(update->proposed_param_updates, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_update_get_epoch(
+  const cardano_update_t* update,
+  uint64_t*               epoch)
+{
+  if (update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (epoch == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *epoch = update->epoch;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_update_get_proposed_parameters(
+  const cardano_update_t*            update,
+  cardano_proposed_param_updates_t** proposed_parameters)
+{
+  if (update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposed_parameters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *proposed_parameters = update->proposed_param_updates;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_update_set_epoch(
+  cardano_update_t* update,
+  uint64_t          epoch)
+{
+  if (update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  update->epoch = epoch;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_update_set_proposed_parameters(
+  cardano_update_t*                 update,
+  cardano_proposed_param_updates_t* proposed_parameters)
+{
+  if (update == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_proposed_param_updates_ref(proposed_parameters);
+
+  cardano_proposed_param_updates_unref(&update->proposed_param_updates);
+
+  update->proposed_param_updates = proposed_parameters;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_update_unref(cardano_update_t** update)
+{
+  if ((update == NULL) || (*update == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*update)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *update = NULL;
+    return;
+  }
+}
+
+void
+cardano_update_ref(cardano_update_t* update)
+{
+  if (update == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&update->base);
+}
+
+size_t
+cardano_update_refcount(const cardano_update_t* update)
+{
+  if (update == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&update->base);
+}
+
+void
+cardano_update_set_last_error(cardano_update_t* update, const char* message)
+{
+  cardano_object_set_last_error(&update->base, message);
+}
+
+const char*
+cardano_update_get_last_error(const cardano_update_t* update)
+{
+  return cardano_object_get_last_error(&update->base);
+}
+
+cardano_error_t
+cardano_update_deep_clone(const cardano_update_t* source, cardano_update_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_update_t* copy = _cardano_malloc(sizeof(cardano_update_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count         = 1U;
+  copy->base.deallocator       = source->base.deallocator;
+  copy->base.last_error[0]     = '\0';
+  copy->epoch                  = source->epoch;
+  copy->proposed_param_updates = NULL;
+
+  if (source->proposed_param_updates != NULL)
+  {
+    const cardano_error_t result = cardano_proposed_param_updates_deep_clone(source->proposed_param_updates, &copy->proposed_param_updates);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/providers/emscripten/emscripten_provider.c b/vendor/src/providers/emscripten/emscripten_provider.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/providers/emscripten/emscripten_provider.c
@@ -0,0 +1,1000 @@
+/**
+ * \file emscripten_provider.c
+ *
+ * \author angel.castillo
+ * \date   Apr 06, 2025
+ *
+ * Copyright 2025 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef __EMSCRIPTEN__
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/providers/provider.h>
+#include <cardano/providers/provider_impl.h>
+#include <emscripten.h>
+
+#include "../../allocators.h"
+#include "../../string_safe.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Context for the JavaScript provider implementation.
+ */
+typedef struct emscripten_provider_context_t
+{
+    cardano_object_t base;
+    uint32_t         object_id;
+    char             name[256];
+} emscripten_provider_context_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Creates a new JavaScript provider context.
+ *
+ * \return A pointer to the newly created context, or NULL if allocation failed.
+ */
+static emscripten_provider_context_t*
+emscripten_provider_context_new(const uint32_t object_id)
+{
+  emscripten_provider_context_t* context = (emscripten_provider_context_t*)_cardano_malloc(sizeof(emscripten_provider_context_t));
+
+  if (context == NULL)
+  {
+    return NULL;
+  }
+
+  context->base.ref_count     = 1;
+  context->base.last_error[0] = '\0';
+  context->base.deallocator   = _cardano_free;
+  context->object_id          = object_id;
+
+  return context;
+}
+
+/* JAVASCRIPT INTERFACE *****************************************************/
+
+/**
+ * @brief Retrieves a JavaScript provider object from a central registry.
+ *
+ * This function is called from C to get a handle to a JavaScript object that
+ * implements the provider interface.
+ *
+ * @param[in] object_id The unique ID for the registered provider object.
+ * @return A handle to the JavaScript provider object, or `null` if not found.
+ */
+extern void* get_provider_from_registry(uint32_t object_id);
+
+/**
+ * @brief Reports an exception from the C provider layer back to the JavaScript side.
+ *
+ * This function is implemented in JavaScript and imported into the C/WASM module. It
+ * serves as a bridge to pass an error that occurred within a C provider's asynchronous
+ * operation back to the JavaScript error handling system.
+ *
+ * @param object_id The unique identifier of the JavaScript provider instance that
+ * initiated the operation.
+ * @param exception A pointer to an object or string containing the details of the
+ * exception.
+ */
+extern void report_provider_bridge_error(uint32_t object_id, void* exception);
+
+/**
+ * @brief Marshals a JavaScript object into a C `cardano_protocol_parameters_t`.
+ *
+ * @param[in] params_obj A handle to the JavaScript object containing protocol parameters.
+ * @return A pointer to a newly allocated `cardano_protocol_parameters_t` in WASM memory. Returns `0` on failure.
+ * @note The caller in C is responsible for freeing the returned object via `cardano_object_unref`.
+ */
+extern void* marshal_protocol_parameters(void* params_obj);
+
+/**
+ * @brief Marshals a C `cardano_address_t` object into a JavaScript string (Bech32).
+ *
+ * @param[in] address_obj A pointer to a `cardano_address_t` object in WASM memory.
+ * @return A handle to a JavaScript string representing the address.
+ */
+extern void* marshall_address(void* address_obj);
+
+/**
+ * @brief Marshals a JavaScript array of UTXO objects into a C `cardano_utxo_list_t`.
+ *
+ * @param[in] utxo_list_obj A handle to a JavaScript array, where each element is a UTXO object.
+ * @return A pointer to a newly allocated `cardano_utxo_list_t` in WASM memory. Returns `0` on failure.
+ * @note The caller in C is responsible for freeing the returned object via `cardano_object_unref`.
+ */
+extern void* marshal_utxo_list(void* utxo_list_obj);
+
+/**
+ * @brief Marshals a C `cardano_reward_address_t` object into a JavaScript string (Bech32).
+ *
+ * @param[in] reward_address_ptr A pointer to a `cardano_reward_address_t` object in WASM memory.
+ * @return A handle to a JavaScript string representing the reward address.
+ */
+extern void* marshall_reward_address(void* reward_address_ptr);
+
+/**
+ * @brief Marshals a C `cardano_asset_id_t` object into a JavaScript hex string.
+ *
+ * @param[in] asset_id_ptr A pointer to a `cardano_asset_id_t` object in WASM memory.
+ * @return A handle to a JavaScript hex string representing the asset ID.
+ */
+extern void* marshall_asset_id(void* asset_id_ptr);
+
+/**
+ * @brief Marshals a C `cardano_transaction_input_set_t` into a JavaScript array of input objects.
+ *
+ * @param[in] tx_input_set_ptr A pointer to a `cardano_transaction_input_set_t` object in WASM memory.
+ * @return A handle to a JavaScript array of transaction input objects.
+ */
+extern void* marshall_tx_input_set(void* tx_input_set_ptr);
+
+/**
+ * @brief Marshals a C `cardano_blake2b_hash_t` into a JavaScript hex string.
+ *
+ * @param[in] hash_ptr A pointer to a `cardano_blake2b_hash_t` object in WASM memory.
+ * @return A handle to a JavaScript hex string representing the hash.
+ */
+extern void* marshall_blake2b_hash(void* hash_ptr);
+
+/**
+ * @brief Marshals a C `cardano_transaction_t` into its CBOR representation as a JavaScript hex string.
+ *
+ * @param[in] tx_ptr A pointer to a `cardano_transaction_t` object in WASM memory.
+ * @return A handle to a JavaScript hex string of the transaction's CBOR.
+ */
+extern void* marshall_transaction_to_cbor_hex(void* tx_ptr);
+
+/**
+ * @brief Marshals a C `cardano_utxo_list_t` into a JavaScript array of UTXO objects.
+ *
+ * This is useful for passing complex C structures to JS functions that expect plain objects,
+ * like in `evaluate_transaction`.
+ *
+ * @param[in] utxo_list_ptr A pointer to a `cardano_utxo_list_t` object in WASM memory.
+ * @return A handle to a JavaScript array of UTXO objects.
+ */
+extern void* marshall_utxo_list_to_js(void* utxo_list_ptr);
+
+/**
+ * @brief Marshals a single JavaScript UTXO object into a C `cardano_utxo_t`.
+ *
+ * @param[in] js_utxo_obj A handle to a single JavaScript UTXO object.
+ * @return A pointer to a newly allocated `cardano_utxo_t` in WASM memory. Returns `0` on failure.
+ * @note The caller in C is responsible for freeing the returned object via `cardano_object_unref`.
+ */
+extern void* marshal_utxo(void* js_utxo_obj);
+
+/**
+ * @brief Marshals a JavaScript string of Plutus data CBOR hex into a C `cardano_plutus_data_t`.
+ *
+ * @param[in] js_plutus_data_cbor_hex A handle to a JavaScript string containing the CBOR hex of a Plutus datum.
+ * @return A pointer to a newly allocated `cardano_plutus_data_t` in WASM memory. Returns `0` on failure.
+ * @note The caller in C is responsible for freeing the returned object via `cardano_object_unref`.
+ */
+extern void* marshal_plutus_data(void* js_plutus_data_cbor_hex);
+
+/**
+ * @brief Marshals a JavaScript hex string into a C `cardano_blake2b_hash_t`.
+ *
+ * @param[in] js_hex_string A pointer to a null-terminated UTF8 string passed from JavaScript.
+ * @return A pointer to a newly allocated `cardano_blake2b_hash_t` in WASM memory. Returns `0` on failure.
+ * @note The caller in C is responsible for freeing the returned object via `cardano_object_unref`.
+ */
+extern void* marshal_blake2b_hash_from_hex(const char* js_hex_string);
+
+/**
+ * @brief Marshals a JavaScript array of redeemer objects into a C `cardano_redeemer_list_t`.
+ *
+ * @param[in] js_redeemer_list_obj A handle to a JavaScript array of redeemer objects.
+ * @return A pointer to a newly allocated `cardano_redeemer_list_t` in WASM memory. Returns `0` on failure.
+ * @note The caller in C is responsible for freeing the returned object via `cardano_object_unref`.
+ */
+extern void* marshal_redeemer_list(void* js_redeemer_list_obj);
+
+/* C -> JS ASYNC BRIDGE FUNCTIONS ********************************************/
+
+/**
+ * @brief Asynchronously fetches the latest protocol parameters from the provider.
+ *
+ * This function acts as a bridge to the JavaScript `provider.getParameters()` method.
+ * It uses Emscripten's Asyncify feature to pause C execution and await the result from JavaScript.
+ *
+ * @param[in] object_id The unique ID for the registered JavaScript provider object.
+ * @param[out] parameters_ptr A pointer to a `cardano_protocol_parameters_t*` where the pointer to the
+ * newly created C object will be stored.
+ * @return A cardano_error_t indicating the success or failure of the operation.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_provider_bridge_get_parameters, (uint32_t object_id, cardano_protocol_parameters_t** parameters_ptr), {
+  const provider = get_provider_from_registry(object_id);
+
+  if (!provider)
+  {
+    return 1;
+  }
+
+  try
+  {
+    const params               = await provider.getParameters();
+    const marshaled_params_ptr = marshal_protocol_parameters(params);
+
+    if (marshaled_params_ptr === 0)
+    {
+      return 1;
+    }
+
+    HEAPU32[parameters_ptr >> 2] = marshaled_params_ptr;
+
+    return 0;
+  }
+  catch (e)
+  {
+    report_provider_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/**
+ * @brief Asynchronously fetches all unspent transaction outputs (UTxOs) for a given address.
+ *
+ * This function acts as a bridge to the JavaScript `provider.getUnspentOutputs()` method.
+ *
+ * @param[in] object_id The unique ID for the registered JavaScript provider object.
+ * @param[in] address A pointer to the `cardano_address_t` object to query.
+ * @param[out] utxo_list A pointer to a `cardano_utxo_list_t*` where the pointer to the
+ * newly created list of UTxOs will be stored.
+ * @return A cardano_error_t indicating the success or failure of the operation.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_provider_bridge_get_unspent_outputs, (uint32_t object_id, cardano_address_t* address, cardano_utxo_list_t** utxo_list), {
+  const provider = get_provider_from_registry(object_id);
+
+  if (!provider || !address || !utxo_list)
+  {
+    return 1;
+  }
+
+  try
+  {
+    const stringAddress           = marshall_address(address);
+    const utxos                   = await provider.getUnspentOutputs(stringAddress);
+    const marshaled_utxo_list_ptr = marshal_utxo_list(utxos);
+
+    if (marshaled_utxo_list_ptr === 0)
+    {
+      return ;
+    }
+
+    HEAPU32[utxo_list >> 2] = marshaled_utxo_list_ptr;
+
+    return 0;
+  }
+  catch (e)
+  {
+    report_provider_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/**
+ * @brief Asynchronously fetches the rewards balance for a given reward address.
+ *
+ * This function acts as a bridge to the JavaScript `provider.getRewardsBalance()` method.
+ *
+ * @param[in] object_id The unique ID for the registered JavaScript provider object.
+ * @param[in] address A pointer to the `cardano_reward_address_t` object to query.
+ * @param[out] rewards_ptr A pointer to a `uint64_t` where the reward amount (in Lovelace) will be stored.
+ * @return A cardano_error_t indicating the success or failure of the operation.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_provider_bridge_get_rewards_balance, (uint32_t object_id, cardano_reward_address_t* address, uint64_t* rewards_ptr), {
+  const provider = get_provider_from_registry(object_id);
+  if (!provider) {
+    return 1;
+  }
+
+  try
+  {
+    const address_str = marshall_reward_address(address);
+    const result_rewards = await provider.getRewardsBalance(address_str);
+
+    const low32  = Number(result_rewards & 0xFFFFFFFFn);
+    const high32 = Number(result_rewards >> 32n);
+
+    setValue(rewards_ptr,     low32,  'i32');
+    setValue(rewards_ptr + 4, high32, 'i32');
+
+    return 0;
+  }
+  catch (e)
+  {
+    report_provider_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/**
+ * @brief Asynchronously fetches all UTxOs for an address that contain a specific asset.
+ *
+ * This function acts as a bridge to the JavaScript `provider.getUnspentOutputsWithAsset()` method.
+ *
+ * @param[in] object_id The unique ID for the registered JavaScript provider object.
+ * @param[in] address A pointer to the `cardano_address_t` object to query.
+ * @param[in] asset_id A pointer to the `cardano_asset_id_t` to filter by.
+ * @param[out] utxo_list_ptr A pointer to a `cardano_utxo_list_t*` where the pointer to the
+ * resulting list will be stored.
+ * @return A cardano_error_t indicating the success or failure of the operation.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_provider_bridge_get_unspent_outputs_with_asset, (uint32_t object_id, cardano_address_t* address, cardano_asset_id_t* asset_id, cardano_utxo_list_t** utxo_list_ptr), {
+  const provider = get_provider_from_registry(object_id);
+  if (!provider)
+    return 1;
+
+  try
+  {
+    const address_str   = marshall_address(address);
+    const asset_id_str  = marshall_asset_id(asset_id);
+    const result_utxos  = await provider.getUnspentOutputsWithAsset(address_str, asset_id_str);
+    const marshaled_ptr = marshal_utxo_list(result_utxos);
+
+    if (marshaled_ptr === 0)
+      return 1;
+
+    HEAPU32[utxo_list_ptr >> 2] = marshaled_ptr;
+    return 0;
+  }
+  catch (e)
+  {
+    report_provider_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/**
+ * @brief Asynchronously fetches the single UTxO that contains a specific NFT.
+ *
+ * This function acts as a bridge to the JavaScript `provider.getUnspentOutputByNft()` method.
+ *
+ * @param[in] object_id The unique ID for the registered JavaScript provider object.
+ * @param[in] asset_id A pointer to the `cardano_asset_id_t` of the NFT to find.
+ * @param[out] utxo_ptr A pointer to a `cardano_utxo_t*` where the pointer to the
+ * resulting UTxO will be stored.
+ * @return A cardano_error_t indicating the success or failure of the operation. Returns
+ * `CARDANO_ERROR_ELEMENT_NOT_FOUND` if the NFT's UTxO does not exist.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_provider_bridge_get_unspent_output_by_nft, (uint32_t object_id, cardano_asset_id_t* asset_id, cardano_utxo_t** utxo_ptr), {
+  const provider = get_provider_from_registry(object_id);
+  if (!provider)
+    return 1;
+
+  try
+  {
+    const asset_id_str  = marshall_asset_id(asset_id);
+    const result_utxo   = await provider.getUnspentOutputByNft(asset_id_str);
+    const marshaled_ptr = marshal_utxo(result_utxo);
+
+    if (marshaled_ptr === 0)
+      return 1;
+
+    HEAPU32[utxo_ptr >> 2] = marshaled_ptr;
+    return 0;
+  }
+  catch (e)
+  {
+    report_provider_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/**
+ * @brief Asynchronously resolves a set of transaction inputs to their corresponding UTxOs.
+ *
+ * This function acts as a bridge to the JavaScript `provider.resolveUnspentOutputs()` method.
+ *
+ * @param[in] object_id The unique ID for the registered JavaScript provider object.
+ * @param[in] tx_ins A pointer to the `cardano_transaction_input_set_t` to resolve.
+ * @param[out] utxo_list_ptr A pointer to a `cardano_utxo_list_t*` where the pointer to the
+ * list of resolved UTxOs will be stored.
+ * @return A cardano_error_t indicating the success or failure of the operation.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_provider_bridge_resolve_unspent_outputs, (uint32_t object_id, cardano_transaction_input_set_t* tx_ins, cardano_utxo_list_t** utxo_list_ptr), {
+  const provider = get_provider_from_registry(object_id);
+  if (!provider)
+    return 1;
+
+  try
+  {
+    const inputs_array  = marshall_tx_input_set(tx_ins);
+    const result_utxos  = await provider.resolveUnspentOutputs(inputs_array);
+    const marshaled_ptr = marshal_utxo_list(result_utxos);
+
+    if (marshaled_ptr === 0)
+      return 1;
+
+    HEAPU32[utxo_list_ptr >> 2] = marshaled_ptr;
+    return 0;
+  }
+  catch (e)
+  {
+    report_provider_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/**
+ * @brief Asynchronously fetches a Plutus datum from its hash.
+ *
+ * This function acts as a bridge to the JavaScript `provider.resolveDatum()` method.
+ *
+ * @param[in] object_id The unique ID for the registered JavaScript provider object.
+ * @param[in] datum_hash A pointer to the `cardano_blake2b_hash_t` of the datum to resolve.
+ * @param[out] datum_ptr A pointer to a `cardano_plutus_data_t*` where the pointer to the
+ * resolved datum will be stored.
+ * @return A cardano_error_t indicating the success or failure of the operation. Returns
+ * `CARDANO_ERROR_ELEMENT_NOT_FOUND` if the datum does not exist.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_provider_bridge_resolve_datum, (uint32_t object_id, cardano_blake2b_hash_t* datum_hash, cardano_plutus_data_t** datum_ptr), {
+  const provider = get_provider_from_registry(object_id);
+  if (!provider)
+    return 1;
+
+  try
+  {
+    const datum_hash_hex    = marshall_blake2b_hash(datum_hash);
+    const result_datum_cbor = await provider.resolveDatum(datum_hash_hex);
+    const marshaled_ptr     = marshal_plutus_data(result_datum_cbor);
+
+    if (marshaled_ptr === 0)
+      return 1;
+
+    HEAPU32[datum_ptr >> 2] = marshaled_ptr;
+    return 0;
+  }
+  catch (e)
+  {
+    report_provider_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/**
+ * @brief Asynchronously waits for a transaction to be confirmed on the blockchain.
+ *
+ * This function acts as a bridge to the JavaScript `provider.confirmTransaction()` method.
+ *
+ * @param[in] object_id The unique ID for the registered JavaScript provider object.
+ * @param[in] tx_id A pointer to the `cardano_blake2b_hash_t` of the transaction to confirm.
+ * @param[in] timeout_ms The maximum time in milliseconds to wait for confirmation.
+ * @param[out] confirmed_ptr A pointer to a `bool` where the confirmation status (true/false) will be stored.
+ * @return A cardano_error_t indicating the success or failure of the operation.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_provider_bridge_confirm_transaction, (uint32_t object_id, cardano_blake2b_hash_t* tx_id, uint32_t timeout_ms, bool* confirmed_ptr), {
+  const provider = get_provider_from_registry(object_id);
+  if (!provider)
+    return 1;
+
+  try
+  {
+    const tx_id_hex    = marshall_blake2b_hash(tx_id);
+    const is_confirmed = await provider.confirmTransaction(tx_id_hex, Number(timeout_ms));
+
+    HEAPU8[confirmed_ptr] = is_confirmed ? 1 : 0;
+
+    return 0;
+  }
+  catch (e)
+  {
+    report_provider_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/**
+ * @brief Asynchronously submits a signed transaction to the network.
+ *
+ * This function acts as a bridge to the JavaScript `provider.submitTransaction()` method.
+ *
+ * @param[in] object_id The unique ID for the registered JavaScript provider object.
+ * @param[in] tx A pointer to the `cardano_transaction_t` to be submitted.
+ * @param[out] tx_id_ptr A pointer to a `cardano_blake2b_hash_t*` where the pointer to the
+ * resulting transaction ID (hash) will be stored.
+ * @return A cardano_error_t indicating the success or failure of the operation.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_provider_bridge_submit_transaction, (uint32_t object_id, cardano_transaction_t* tx, cardano_blake2b_hash_t** tx_id_ptr), {
+  const provider = get_provider_from_registry(object_id);
+  if (!provider)
+    return 1;
+
+  try
+  {
+    const tx_cbor_hex        = marshall_transaction_to_cbor_hex(tx);
+    const result_tx_hash_hex = await provider.submitTransaction(tx_cbor_hex);
+
+    const marshaled_hash_ptr = marshal_blake2b_hash_from_hex(result_tx_hash_hex);
+    if (marshaled_hash_ptr === 0)
+      return 1;
+
+    HEAPU32[tx_id_ptr >> 2] = marshaled_hash_ptr;
+
+    return 0;
+  }
+  catch (e)
+  {
+    report_provider_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/**
+ * @brief Asynchronously evaluates the execution units (ExUnits) for a transaction.
+ *
+ * This function acts as a bridge to the JavaScript `provider.evaluateTransaction()` method.
+ *
+ * @param[in] object_id The unique ID for the registered JavaScript provider object.
+ * @param[in] tx A pointer to the `cardano_transaction_t` to evaluate.
+ * @param[in] additional_utxos A pointer to a `cardano_utxo_list_t` of additional UTxOs to use
+ * for evaluation. Can be `NULL`.
+ * @param[out] redeemers_ptr A pointer to a `cardano_redeemer_list_t*` where the pointer to the
+ * list of redeemers with their calculated ExUnits will be stored.
+ * @return A cardano_error_t indicating the success or failure of the operation. Returns
+ * `CARDANO_ERROR_SCRIPT_EVALUATION_FAILURE` if the transaction fails evaluation.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_provider_bridge_evaluate_transaction, (uint32_t object_id, cardano_transaction_t* tx, cardano_utxo_list_t* additional_utxos, cardano_redeemer_list_t** redeemers_ptr), {
+  const provider = get_provider_from_registry(object_id);
+  if (!provider)
+    return 1;
+
+  try
+  {
+    const tx_cbor_hex = marshall_transaction_to_cbor_hex(tx);
+    const additional_utxos_array = marshall_utxo_list_to_js(additional_utxos);
+
+    const result_redeemers = await provider.evaluateTransaction(tx_cbor_hex, additional_utxos_array);
+    const marshaled_ptr    = marshal_redeemer_list(result_redeemers);
+
+    if (marshaled_ptr === 0)
+      return 1;
+
+    HEAPU32[redeemers_ptr >> 2] = marshaled_ptr;
+    return 0;
+  }
+  catch (e)
+  {
+    report_provider_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/* PROVIDER IMPLEMENTATION **************************************************/
+
+/**
+ * \brief Retrieves the current protocol parameters from the Cardano blockchain.
+ *
+ * The protocol parameters include important configuration details of the Cardano network,
+ * such as parameters to compute fees, maximum block sizes, and other protocol-related settings.
+ *
+ * \param[in]  provider   Pointer to the \ref cardano_provider_t instance.
+ *                        Must not be `NULL`.
+ * \param[out] parameters Pointer to a location where the function will store a pointer
+ *                        to the retrieved \ref cardano_protocol_parameters_t structure.
+ *                        This parameter must not be `NULL`. On success, the caller is
+ *                        responsible for freeing the returned \ref cardano_protocol_parameters_t
+ *                        object using the \ref cardano_protocol_parameters_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - \ref CARDANO_SUCCESS on success.
+ *          - An appropriate error code on failure.
+dwq */
+static cardano_error_t
+get_parameters(cardano_provider_impl_t* provider_impl, cardano_protocol_parameters_t** parameters)
+{
+  emscripten_provider_context_t* ctx = (emscripten_provider_context_t*)provider_impl->context;
+
+  if (!ctx || !parameters)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_provider_bridge_get_parameters(ctx->object_id, parameters);
+}
+
+/**
+ * \brief Retrieves unspent transaction outputs (UTXOs) for a given address.
+ *
+ * This function obtains a list of unspent transaction outputs (UTXOs) associated with the specified
+ * address using the provided Cardano provider instance. UTXOs represent funds that can be used as
+ * inputs in new transactions. Retrieving UTXOs is essential for constructing transactions and
+ * managing balances.
+ *
+ * \param[in]  provider  Pointer to the \ref cardano_provider_t instance.
+ *                       Must not be `NULL`.
+ * \param[in]  address   Pointer to a \ref cardano_address_t representing the address for which
+ *                       to retrieve unspent outputs. Must not be `NULL`.
+ * \param[out] utxo_list Pointer to a location where the function will store a pointer to the
+ *                       retrieved \ref cardano_utxo_list_t structure. Must not be `NULL`. On success,
+ *                       the caller is responsible for freeing the returned \ref cardano_utxo_list_t
+ *                       object using the \ref cardano_utxo_list_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - \ref CARDANO_SUCCESS on success.
+ *          - An appropriate error code on failure.
+ */
+static cardano_error_t
+get_unspent_outputs(
+  cardano_provider_impl_t* provider_impl,
+  cardano_address_t*       address,
+  cardano_utxo_list_t**    utxo_list)
+{
+  emscripten_provider_context_t* ctx = (emscripten_provider_context_t*)provider_impl->context;
+
+  if (!ctx || !address || !utxo_list)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_provider_bridge_get_unspent_outputs(ctx->object_id, address, utxo_list);
+}
+
+/**
+ * \brief Retrieves the staking rewards for a given address.
+ *
+ * This function obtains the current available staking rewards associated with the specified address.
+ * It uses the provided Cardano provider instance to access blockchain data and retrieve
+ * the reward balance for the address. Staking rewards are accumulated for addresses that
+ * delegate their stake to a stake pool.
+ *
+ * \param[in]  provider Pointer to the \ref cardano_provider_t instance.
+ *                      Must not be `NULL`.
+ * \param[in]  address  Pointer to a \ref cardano_address_t representing the address
+ *                      for which to retrieve staking rewards. Must not be `NULL`.
+ * \param[out] rewards  Pointer to a `uint64_t` variable where the function will store
+ *                      the amount of rewards (in Lovelace). Must not be `NULL`.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - Other error codes for provider-specific failures.
+ */
+static cardano_error_t
+get_rewards_balance(
+  cardano_provider_impl_t*  provider_impl,
+  cardano_reward_address_t* address,
+  uint64_t*                 rewards)
+{
+  emscripten_provider_context_t* ctx = (emscripten_provider_context_t*)provider_impl->context;
+
+  if (!ctx || !address || !rewards)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_provider_bridge_get_rewards_balance(ctx->object_id, address, rewards);
+}
+
+/**
+ * \brief Retrieves unspent transaction outputs (UTXOs) for a given address that contain a specific asset.
+ *
+ * This function obtains a list of unspent transaction outputs (UTXOs) associated with the specified
+ * address that contain the specified asset. It uses the provided Cardano provider instance to access
+ * the blockchain data. UTXOs represent funds that can be used as inputs in new transactions.
+ *
+ * \param[in]  provider  Pointer to the \ref cardano_provider_t instance.
+ *                       Must not be `NULL`.
+ * \param[in]  address   Pointer to a \ref cardano_address_t representing the address for which
+ *                       to retrieve unspent outputs. Must not be `NULL`.
+ * \param[in]  asset_id  Pointer to a \ref cardano_asset_id_t representing the asset identifier
+ *                       used to filter the UTXOs. Must not be `NULL`.
+ * \param[out] utxo_list Pointer to a location where the function will store a pointer to the
+ *                       retrieved \ref cardano_utxo_list_t structure containing UTXOs that include
+ *                       the specified asset. Must not be `NULL`. On success, the caller is responsible
+ *                       for freeing the returned \ref cardano_utxo_list_t object using the \ref cardano_utxo_list_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - \ref CARDANO_SUCCESS on success.
+ *          - Other error codes for provider-specific failures.
+ */
+static cardano_error_t
+get_unspent_outputs_with_asset(
+  cardano_provider_impl_t* provider_impl,
+  cardano_address_t*       address,
+  cardano_asset_id_t*      asset_id,
+  cardano_utxo_list_t**    utxo_list)
+{
+  emscripten_provider_context_t* ctx = (emscripten_provider_context_t*)provider_impl->context;
+
+  if (!ctx || !address || !asset_id || !utxo_list)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_provider_bridge_get_unspent_outputs_with_asset(ctx->object_id, address, asset_id, utxo_list);
+}
+
+/**
+ * \brief Retrieves an unspent transaction output (UTXO) containing a specific Non-Fungible Token (NFT).
+ *
+ * This function obtains a UTXO that contains the specified NFT (Non-Fungible Token) identified by the given asset ID.
+ * It uses the provided Cardano provider instance to access the blockchain data.
+ *
+ * \param[in]  provider Pointer to the \ref cardano_provider_t instance.
+ *                      Must not be `NULL`.
+ * \param[in]  asset_id Pointer to a \ref cardano_asset_id_t representing the asset identifier of the NFT.
+ *                      Must not be `NULL`.
+ * \param[out] utxo     Pointer to a location where the function will store a pointer to the retrieved
+ *                      \ref cardano_utxo_t structure containing the NFT. Must not be `NULL`.
+ *                      On success, the caller is responsible for freeing the returned \ref cardano_utxo_t
+ *                      object using the \ref cardano_utxo_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - \ref CARDANO_SUCCESS on success.
+ *          - Other error codes for provider-specific failures.
+ */
+static cardano_error_t
+get_unspent_output_by_nft(
+  cardano_provider_impl_t* provider_impl,
+  cardano_asset_id_t*      asset_id,
+  cardano_utxo_t**         utxo)
+{
+  emscripten_provider_context_t* ctx = (emscripten_provider_context_t*)provider_impl->context;
+
+  if (!ctx || !asset_id || !utxo)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_provider_bridge_get_unspent_output_by_nft(ctx->object_id, asset_id, utxo);
+}
+
+/**
+ * \brief Resolves unspent transaction outputs (UTXOs) for given transaction inputs.
+ *
+ * This function obtains the unspent transaction outputs (UTXOs) corresponding to the specified
+ * set of transaction inputs. It uses the provided Cardano provider instance to access the blockchain
+ * data.
+ *
+ * \param[in]  provider  Pointer to the \ref cardano_provider_t instance.
+ *                       Must not be `NULL`.
+ * \param[in]  tx_ins    Pointer to a \ref cardano_transaction_input_set_t containing the set of
+ *                       transaction inputs to resolve. Must not be `NULL`.
+ * \param[out] utxo_list Pointer to a location where the function will store a pointer to the
+ *                       retrieved \ref cardano_utxo_list_t structure containing the resolved UTXOs.
+ *                       Must not be `NULL`. On success, the caller is responsible for freeing the
+ *                       returned \ref cardano_utxo_list_t object using the \ref cardano_utxo_list_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - Other error codes for provider-specific failures.
+ */
+static cardano_error_t
+resolve_unspent_outputs(
+  cardano_provider_impl_t*         provider_impl,
+  cardano_transaction_input_set_t* tx_ins,
+  cardano_utxo_list_t**            utxo_list)
+{
+  emscripten_provider_context_t* ctx = (emscripten_provider_context_t*)provider_impl->context;
+
+  if (!ctx || !tx_ins || !utxo_list)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_provider_bridge_resolve_unspent_outputs(ctx->object_id, tx_ins, utxo_list);
+}
+
+/**
+ * \brief Resolves a Plutus datum from its hash.
+ *
+ * This function retrieves the Plutus datum associated with the given datum hash.
+ * It uses the provided Cardano provider instance to access the blockchain data.
+ *
+ * \param[in]  provider    Pointer to the \ref cardano_provider_t instance.
+ *                         Must not be `NULL`.
+ * \param[in]  datum_hash  Pointer to a \ref cardano_blake2b_hash_t representing the hash
+ *                         of the datum to resolve. Must not be `NULL`.
+ * \param[out] datum       Pointer to a location where the function will store a pointer
+ *                         to the retrieved \ref cardano_plutus_data_t structure containing
+ *                         the datum. Must not be `NULL`. On success, the caller is responsible
+ *                         for freeing the returned \ref cardano_plutus_data_t object using
+ *                         the \ref cardano_plutus_data_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - Other error codes for provider-specific failures.
+ */
+static cardano_error_t
+resolve_datum(
+  cardano_provider_impl_t* provider_impl,
+  cardano_blake2b_hash_t*  datum_hash,
+  cardano_plutus_data_t**  datum)
+{
+  emscripten_provider_context_t* ctx = (emscripten_provider_context_t*)provider_impl->context;
+
+  if (!ctx || !datum_hash || !datum)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_provider_bridge_resolve_datum(ctx->object_id, datum_hash, datum);
+}
+
+/**
+ * \brief Confirms the inclusion of a transaction in the blockchain within a specified timeout period.
+ *
+ * This function waits for the specified transaction to be confirmed (i.e., included in a block)
+ * within a given timeout period. It uses the provided Cardano provider instance to monitor
+ * the blockchain for the transaction's confirmation.
+ *
+ * \param[in] provider    Pointer to the \ref cardano_provider_t instance.
+ *                        Must not be `NULL`.
+ * \param[in] tx_id       Pointer to a \ref cardano_blake2b_hash_t representing the transaction ID
+ *                        to confirm. Must not be `NULL`.
+ * \param[in] timeout_ms  Timeout in milliseconds to wait for the transaction confirmation.
+ *                        If the transaction is not confirmed within this period, the function will return
+ *                        an appropriate error code.
+ *  \param[out] confirmed  Pointer to a boolean variable where the function will store the confirmation status.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ */
+static cardano_error_t
+confirm_transaction(
+  cardano_provider_impl_t* provider_impl,
+  cardano_blake2b_hash_t*  tx_id,
+  uint64_t                 timeout_ms,
+  bool*                    confirmed)
+{
+  emscripten_provider_context_t* ctx = (emscripten_provider_context_t*)provider_impl->context;
+
+  if (!ctx || !tx_id || !confirmed)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_provider_bridge_confirm_transaction(ctx->object_id, tx_id, timeout_ms, confirmed);
+}
+
+/**
+ * \brief Submits a transaction to the Cardano blockchain network.
+ *
+ * This function submits the given transaction to the Cardano network for processing.
+ * Upon successful submission, it returns the transaction ID (hash) of the submitted transaction.
+ * The transaction ID can be used to track the transaction's status and confirmation.
+ *
+ * \param[in]  provider Pointer to the \ref cardano_provider_t instance.
+ *                      Must not be `NULL`.
+ * \param[in]  tx       Pointer to the \ref cardano_transaction_t representing the transaction to submit.
+ *                      Must not be `NULL`.
+ * \param[out] tx_id    Pointer to a location where the function will store a pointer to the
+ *                      newly allocated \ref cardano_blake2b_hash_t representing the transaction ID.
+ *                      Must not be `NULL`. On success, the caller is responsible for freeing the
+ *                      returned \ref cardano_blake2b_hash_t object using the appropriate deallocation function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - Other error codes for provider-specific failures.
+ */
+static cardano_error_t
+submit_transaction(
+  cardano_provider_impl_t* provider_impl,
+  cardano_transaction_t*   tx,
+  cardano_blake2b_hash_t** tx_id)
+{
+  emscripten_provider_context_t* ctx = (emscripten_provider_context_t*)provider_impl->context;
+
+  if (!ctx || !tx || !tx_id)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_provider_bridge_submit_transaction(ctx->object_id, tx, tx_id);
+}
+
+/**
+ * \brief Evaluates a transaction to estimate the required execution units for Plutus scripts.
+ *
+ * This function evaluates the given transaction to determine the execution units (e.g., memory and CPU usage)
+ * required by any Plutus scripts involved in the transaction. The evaluation considers any additional UTXOs
+ * and redeemers provided.
+ *
+ * \param[in]  provider         Pointer to the \ref cardano_provider_t instance.
+ *                              Must not be `NULL`.
+ * \param[in]  tx               Pointer to the \ref cardano_transaction_t representing the transaction to evaluate.
+ *                              Must not be `NULL`.
+ * \param[in]  additional_utxos Pointer to a \ref cardano_utxo_list_t containing additional UTXOs required
+ *                              for evaluation. Can be `NULL` if not needed.
+ * \param[out] redeemers        Pointer to a location where the function will store a pointer to the
+ *                              \ref cardano_redeemer_list_t containing updated redeemers with estimated
+ *                              execution units. Must not be `NULL`. On success, the caller is responsible
+ *                              for freeing the returned \ref cardano_redeemer_list_t object using the
+ *                              \ref cardano_redeemer_list_unref function.
+ *
+ * \returns A \ref cardano_error_t indicating success or failure of the operation.
+ *          - Other error codes for provider-specific failures.
+ */
+static cardano_error_t
+evaluate_transaction(
+  cardano_provider_impl_t*  provider_impl,
+  cardano_transaction_t*    tx,
+  cardano_utxo_list_t*      additional_utxos,
+  cardano_redeemer_list_t** redeemers)
+{
+  emscripten_provider_context_t* ctx = (emscripten_provider_context_t*)provider_impl->context;
+
+  if (!ctx || !tx || !redeemers)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_provider_bridge_evaluate_transaction(ctx->object_id, tx, additional_utxos, redeemers);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+EMSCRIPTEN_KEEPALIVE
+cardano_error_t
+create_emscripten_provider(
+  const cardano_network_magic_t network,
+  const char*                   name,
+  const size_t                  name_size,
+  const uint32_t                object_id,
+  cardano_provider_t**          provider)
+{
+  if ((provider == NULL) || (name == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((name_size > 256U) || (name_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  emscripten_provider_context_t* context = emscripten_provider_context_new(object_id);
+
+  if (context == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_safe_memcpy(context->name, 256, name, name_size);
+
+  cardano_provider_impl_t impl = { 0 };
+
+  impl.context       = (cardano_object_t*)context;
+  impl.network_magic = network;
+
+  impl.get_parameters                 = get_parameters;
+  impl.get_unspent_outputs            = get_unspent_outputs;
+  impl.get_rewards_balance            = get_rewards_balance;
+  impl.get_unspent_outputs_with_asset = get_unspent_outputs_with_asset;
+  impl.get_unspent_output_by_nft      = get_unspent_output_by_nft;
+  impl.resolve_unspent_outputs        = resolve_unspent_outputs;
+  impl.resolve_datum                  = resolve_datum;
+  impl.await_transaction_confirmation = confirm_transaction;
+  impl.post_transaction_to_chain      = submit_transaction;
+  impl.evaluate_transaction           = evaluate_transaction;
+
+  cardano_error_t result = cardano_provider_new(impl, provider);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(context);
+    return result;
+  }
+
+  return result;
+}
+
+#endif /* __EMSCRIPTEN__ */
diff --git a/vendor/src/providers/provider.c b/vendor/src/providers/provider.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/providers/provider.c
@@ -0,0 +1,439 @@
+/**
+ * \file provider.c
+ *
+ * \author angel.castillo
+ * \date   Sep 27, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/providers/provider.h>
+
+#include "../allocators.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Opaque structure representing a Cardano blockchain data provider instance.
+ *
+ * This structure serves as a handle to a Cardano provider, encapsulating the necessary context and
+ * state required to interact with the Cardano blockchain.
+ */
+typedef struct cardano_provider_t
+{
+    cardano_object_t        base;
+    cardano_provider_impl_t impl;
+} cardano_provider_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a provider object.
+ *
+ * This function is responsible for properly deallocating a provider object (`cardano_provider_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the provider object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_provider_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the provider
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_provider_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_provider_t* provider = (cardano_provider_t*)object;
+
+  cardano_object_unref(&provider->impl.context);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_provider_new(
+  cardano_provider_impl_t impl,
+  cardano_provider_t**    provider)
+{
+  if (provider == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *provider = _cardano_malloc(sizeof(cardano_provider_t));
+
+  if (*provider == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*provider)->base.deallocator   = cardano_provider_deallocate;
+  (*provider)->base.ref_count     = 1;
+  (*provider)->base.last_error[0] = '\0';
+
+  (*provider)->impl = impl;
+
+  // Make sure provider name is null terminated
+  (*provider)->impl.name[sizeof((*provider)->impl.name) - 1U] = '\0';
+  (*provider)->impl.error_message[0]                          = '\0';
+
+  return CARDANO_SUCCESS;
+}
+
+const char*
+cardano_provider_get_name(const cardano_provider_t* provider)
+{
+  if (provider == NULL)
+  {
+    return "";
+  }
+
+  return provider->impl.name;
+}
+
+cardano_network_magic_t
+cardano_provider_get_network_magic(const cardano_provider_t* provider)
+{
+  if (provider == NULL)
+  {
+    return CARDANO_NETWORK_MAGIC_PREPROD;
+  }
+
+  return provider->impl.network_magic;
+}
+
+cardano_error_t
+cardano_provider_get_parameters(
+  cardano_provider_t*             provider,
+  cardano_protocol_parameters_t** parameters)
+{
+  if ((provider == NULL) || (parameters == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (provider->impl.get_parameters == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = provider->impl.get_parameters(&provider->impl, parameters);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_provider_set_last_error(provider, provider->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_provider_get_unspent_outputs(
+  cardano_provider_t*   provider,
+  cardano_address_t*    address,
+  cardano_utxo_list_t** utxo_list)
+{
+  if ((provider == NULL) || (address == NULL) || (utxo_list == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (provider->impl.get_unspent_outputs == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = provider->impl.get_unspent_outputs(&provider->impl, address, utxo_list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_provider_set_last_error(provider, provider->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_provider_get_rewards_available(
+  cardano_provider_t*       provider,
+  cardano_reward_address_t* address,
+  uint64_t*                 rewards)
+{
+  if ((provider == NULL) || (address == NULL) || (rewards == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (provider->impl.get_rewards_balance == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = provider->impl.get_rewards_balance(&provider->impl, address, rewards);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_provider_set_last_error(provider, provider->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_provider_get_unspent_outputs_with_asset(
+  cardano_provider_t*   provider,
+  cardano_address_t*    address,
+  cardano_asset_id_t*   asset_id,
+  cardano_utxo_list_t** utxo_list)
+{
+  if ((provider == NULL) || (address == NULL) || (asset_id == NULL) || (utxo_list == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (provider->impl.get_unspent_outputs_with_asset == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = provider->impl.get_unspent_outputs_with_asset(&provider->impl, address, asset_id, utxo_list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_provider_set_last_error(provider, provider->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_provider_get_unspent_output_by_nft(
+  cardano_provider_t* provider,
+  cardano_asset_id_t* asset_id,
+  cardano_utxo_t**    utxo)
+{
+  if ((provider == NULL) || (asset_id == NULL) || (utxo == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (provider->impl.get_unspent_output_by_nft == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = provider->impl.get_unspent_output_by_nft(&provider->impl, asset_id, utxo);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_provider_set_last_error(provider, provider->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_provider_resolve_unspent_outputs(
+  cardano_provider_t*              provider,
+  cardano_transaction_input_set_t* tx_ins,
+  cardano_utxo_list_t**            utxo_list)
+{
+  if ((provider == NULL) || (tx_ins == NULL) || (utxo_list == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (provider->impl.resolve_unspent_outputs == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = provider->impl.resolve_unspent_outputs(&provider->impl, tx_ins, utxo_list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_provider_set_last_error(provider, provider->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_provider_resolve_datum(
+  cardano_provider_t*     provider,
+  cardano_blake2b_hash_t* datum_hash,
+  cardano_plutus_data_t** datum)
+{
+  if ((provider == NULL) || (datum_hash == NULL) || (datum == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (provider->impl.resolve_datum == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = provider->impl.resolve_datum(&provider->impl, datum_hash, datum);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_provider_set_last_error(provider, provider->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_provider_confirm_transaction(
+  cardano_provider_t*     provider,
+  cardano_blake2b_hash_t* tx_id,
+  const uint64_t          timeout_ms,
+  bool*                   confirmed)
+{
+  if ((provider == NULL) || (tx_id == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (provider->impl.await_transaction_confirmation == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = provider->impl.await_transaction_confirmation(&provider->impl, tx_id, timeout_ms, confirmed);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_provider_set_last_error(provider, provider->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_provider_submit_transaction(
+  cardano_provider_t*      provider,
+  cardano_transaction_t*   tx,
+  cardano_blake2b_hash_t** tx_id)
+{
+  if ((provider == NULL) || (tx == NULL) || (tx_id == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (provider->impl.post_transaction_to_chain == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = provider->impl.post_transaction_to_chain(&provider->impl, tx, tx_id);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_provider_set_last_error(provider, provider->impl.error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_provider_evaluate_transaction(
+  cardano_provider_t*       provider,
+  cardano_transaction_t*    tx,
+  cardano_utxo_list_t*      additional_utxos,
+  cardano_redeemer_list_t** redeemers)
+{
+  if ((provider == NULL) || (tx == NULL) || (redeemers == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (provider->impl.evaluate_transaction == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = provider->impl.evaluate_transaction(&provider->impl, tx, additional_utxos, redeemers);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_provider_set_last_error(provider, provider->impl.error_message);
+  }
+
+  return result;
+}
+
+void
+cardano_provider_unref(cardano_provider_t** provider)
+{
+  if ((provider == NULL) || (*provider == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*provider)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *provider = NULL;
+    return;
+  }
+}
+
+void
+cardano_provider_ref(cardano_provider_t* provider)
+{
+  if (provider == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&provider->base);
+}
+
+size_t
+cardano_provider_refcount(const cardano_provider_t* provider)
+{
+  if (provider == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&provider->base);
+}
+
+void
+cardano_provider_set_last_error(cardano_provider_t* provider, const char* message)
+{
+  cardano_object_set_last_error(&provider->base, message);
+}
+
+const char*
+cardano_provider_get_last_error(const cardano_provider_t* provider)
+{
+  return cardano_object_get_last_error(&provider->base);
+}
diff --git a/vendor/src/scripts/native_scripts/native_script.c b/vendor/src/scripts/native_scripts/native_script.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/native_scripts/native_script.c
@@ -0,0 +1,1334 @@
+/**
+ * \file native_script.c
+ *
+ * \author angel.castillo
+ * \date   May 28, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/error.h>
+#include <cardano/scripts/native_scripts/native_script.h>
+#include <cardano/scripts/native_scripts/native_script_type.h>
+#include <cardano/scripts/native_scripts/script_all.h>
+#include <cardano/scripts/native_scripts/script_any.h>
+#include <cardano/scripts/native_scripts/script_invalid_after.h>
+#include <cardano/scripts/native_scripts/script_invalid_before.h>
+#include <cardano/scripts/native_scripts/script_n_of_k.h>
+#include <cardano/scripts/native_scripts/script_pubkey.h>
+#include <cardano/scripts/native_scripts/script_require_guard.h>
+
+#include <cardano/object.h>
+
+#include "../../allocators.h"
+#include "../../cbor/cbor_validation.h"
+#include "../../string_safe.h"
+
+#include <assert.h>
+#include <cardano/json/json_object.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The Native scripts form an expression tree, the evaluation of the script produces either true or false.
+ */
+typedef struct cardano_native_script_t
+{
+    cardano_object_t                 base;
+    cardano_native_script_type_t     type;
+    cardano_script_all_t*            all;
+    cardano_script_any_t*            any;
+    cardano_script_invalid_after_t*  invalid_after;
+    cardano_script_invalid_before_t* invalid_before;
+    cardano_script_n_of_k_t*         n_of_k;
+    cardano_script_pubkey_t*         pubkey;
+    cardano_script_require_guard_t*  require_guard;
+
+} cardano_native_script_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a native_script object.
+ *
+ * This function is responsible for properly deallocating a native_script object (`cardano_native_script_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the native_script object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_native_script_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the native_script
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_native_script_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_native_script_t* data = (cardano_native_script_t*)object;
+
+  cardano_script_all_unref(&data->all);
+  cardano_script_any_unref(&data->any);
+  cardano_script_invalid_after_unref(&data->invalid_after);
+  cardano_script_invalid_before_unref(&data->invalid_before);
+  cardano_script_n_of_k_unref(&data->n_of_k);
+  cardano_script_pubkey_unref(&data->pubkey);
+  cardano_script_require_guard_unref(&data->require_guard);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new native_script object.
+ *
+ * \return A pointer to the newly created native_script object, or `NULL` if the operation failed.
+ */
+static cardano_native_script_t*
+cardano_native_script_new(void)
+{
+  cardano_native_script_t* data = _cardano_malloc(sizeof(cardano_native_script_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_native_script_deallocate;
+
+  data->type           = CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF;
+  data->all            = NULL;
+  data->any            = NULL;
+  data->invalid_after  = NULL;
+  data->invalid_before = NULL;
+  data->n_of_k         = NULL;
+  data->pubkey         = NULL;
+  data->require_guard  = NULL;
+
+  return data;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_native_script_new_all(
+  cardano_script_all_t*     script_all,
+  cardano_native_script_t** native_script)
+{
+  if (script_all == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_t* data = cardano_native_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->type = CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF;
+  data->all  = script_all;
+
+  cardano_script_all_ref(script_all);
+
+  *native_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_new_any(
+  cardano_script_any_t*     script_any,
+  cardano_native_script_t** native_script)
+{
+  if (script_any == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_t* data = cardano_native_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->type = CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ANY_OF;
+  data->any  = script_any;
+
+  cardano_script_any_ref(script_any);
+
+  *native_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_new_n_of_k(
+  cardano_script_n_of_k_t*  script_n_of_k,
+  cardano_native_script_t** native_script)
+{
+  if (script_n_of_k == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_t* data = cardano_native_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->type   = CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_N_OF_K;
+  data->n_of_k = script_n_of_k;
+
+  cardano_script_n_of_k_ref(script_n_of_k);
+
+  *native_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_new_pubkey(
+  cardano_script_pubkey_t*  script_pubkey,
+  cardano_native_script_t** native_script)
+{
+  if (script_pubkey == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_t* data = cardano_native_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->type   = CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY;
+  data->pubkey = script_pubkey;
+
+  cardano_script_pubkey_ref(script_pubkey);
+
+  *native_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_new_invalid_after(
+  cardano_script_invalid_after_t* invalid_after,
+  cardano_native_script_t**       native_script)
+{
+  if (invalid_after == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_t* data = cardano_native_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->type          = CARDANO_NATIVE_SCRIPT_TYPE_INVALID_AFTER;
+  data->invalid_after = invalid_after;
+
+  cardano_script_invalid_after_ref(invalid_after);
+
+  *native_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_new_invalid_before(
+  cardano_script_invalid_before_t* invalid_before,
+  cardano_native_script_t**        native_script)
+{
+  if (invalid_before == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_t* data = cardano_native_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->type           = CARDANO_NATIVE_SCRIPT_TYPE_INVALID_BEFORE;
+  data->invalid_before = invalid_before;
+
+  cardano_script_invalid_before_ref(invalid_before);
+
+  *native_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_new_require_guard(
+  cardano_script_require_guard_t* require_guard,
+  cardano_native_script_t**       native_script)
+{
+  if (require_guard == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_t* data = cardano_native_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->type          = CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD;
+  data->require_guard = require_guard;
+
+  cardano_script_require_guard_ref(require_guard);
+
+  *native_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_from_cbor(cardano_cbor_reader_t* reader, cardano_native_script_t** native_script)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_reader_t* reader_clone = NULL;
+
+  cardano_error_t result = cardano_cbor_reader_clone(reader, &reader_clone);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  static const char* validator_name = "native_script";
+
+  int64_t array_size = 0;
+  result             = cardano_cbor_reader_read_start_array(reader_clone, &array_size);
+
+  CARDANO_UNUSED(array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_clone);
+    return result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "type",
+    reader_clone,
+    &type,
+    CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY,
+    CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD);
+
+  cardano_cbor_reader_unref(&reader_clone);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  switch (type)
+  {
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF:
+    {
+      cardano_script_all_t* script_all = NULL;
+      result                           = cardano_script_all_from_cbor(reader, &script_all);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_native_script_new_all(script_all, native_script);
+      cardano_script_all_unref(&script_all);
+
+      break;
+    }
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ANY_OF:
+    {
+      cardano_script_any_t* script_any = NULL;
+      result                           = cardano_script_any_from_cbor(reader, &script_any);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_native_script_new_any(script_any, native_script);
+      cardano_script_any_unref(&script_any);
+
+      break;
+    }
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_N_OF_K:
+    {
+      cardano_script_n_of_k_t* script_n_of_k = NULL;
+      result                                 = cardano_script_n_of_k_from_cbor(reader, &script_n_of_k);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_native_script_new_n_of_k(script_n_of_k, native_script);
+      cardano_script_n_of_k_unref(&script_n_of_k);
+
+      break;
+    }
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY:
+    {
+      cardano_script_pubkey_t* script_pubkey = NULL;
+      result                                 = cardano_script_pubkey_from_cbor(reader, &script_pubkey);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_native_script_new_pubkey(script_pubkey, native_script);
+      cardano_script_pubkey_unref(&script_pubkey);
+
+      break;
+    }
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_AFTER:
+    {
+      cardano_script_invalid_after_t* invalid_after = NULL;
+      result                                        = cardano_script_invalid_after_from_cbor(reader, &invalid_after);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_native_script_new_invalid_after(invalid_after, native_script);
+      cardano_script_invalid_after_unref(&invalid_after);
+
+      break;
+    }
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_BEFORE:
+    {
+      cardano_script_invalid_before_t* invalid_before = NULL;
+      result                                          = cardano_script_invalid_before_from_cbor(reader, &invalid_before);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_native_script_new_invalid_before(invalid_before, native_script);
+      cardano_script_invalid_before_unref(&invalid_before);
+
+      break;
+    }
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD:
+    {
+      cardano_script_require_guard_t* require_guard = NULL;
+      result                                        = cardano_script_require_guard_from_cbor(reader, &require_guard);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_native_script_new_require_guard(require_guard, native_script);
+      cardano_script_require_guard_unref(&require_guard);
+
+      break;
+    }
+
+    default:
+      result = CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+      break;
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_native_script_to_cbor(
+  const cardano_native_script_t* native_script,
+  cardano_cbor_writer_t*         writer)
+{
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (native_script->type)
+  {
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF:
+      result = cardano_script_all_to_cbor(native_script->all, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ANY_OF:
+      result = cardano_script_any_to_cbor(native_script->any, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_N_OF_K:
+      result = cardano_script_n_of_k_to_cbor(native_script->n_of_k, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY:
+      result = cardano_script_pubkey_to_cbor(native_script->pubkey, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_AFTER:
+      result = cardano_script_invalid_after_to_cbor(native_script->invalid_after, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_BEFORE:
+      result = cardano_script_invalid_before_to_cbor(native_script->invalid_before, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD:
+      result = cardano_script_require_guard_to_cbor(native_script->require_guard, writer);
+      break;
+
+    default:
+      result = CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+      break;
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_native_script_to_cip116_json(
+  const cardano_native_script_t* script,
+  cardano_json_writer_t*         writer)
+{
+  if ((script == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (script->type)
+  {
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF:
+      result = cardano_script_all_to_cip116_json(script->all, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ANY_OF:
+      result = cardano_script_any_to_cip116_json(script->any, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_N_OF_K:
+      result = cardano_script_n_of_k_to_cip116_json(script->n_of_k, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY:
+      result = cardano_script_pubkey_to_cip116_json(script->pubkey, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_AFTER:
+      result = cardano_script_invalid_after_to_cip116_json(script->invalid_after, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_BEFORE:
+      result = cardano_script_invalid_before_to_cip116_json(script->invalid_before, writer);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD:
+      result = cardano_script_require_guard_to_cip116_json(script->require_guard, writer);
+      break;
+    default:
+      result = CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+      break;
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_native_script_from_json(const char* json, const size_t json_size, cardano_native_script_t** native_script)
+{
+  if (json == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_object_t* json_object = cardano_json_object_parse(json, json_size);
+
+  if (json_object == NULL)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_error_t          result = CARDANO_SUCCESS;
+  cardano_native_script_t* data   = NULL;
+
+  cardano_json_object_t* type = NULL;
+
+  if (!cardano_json_object_get_ex(json_object, "type", 4, &type))
+  {
+    cardano_json_object_unref(&json_object);
+    cardano_native_script_unref(&data);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  const char* type_string = cardano_json_object_get_string(type, NULL);
+
+  if (type_string == NULL)
+  {
+    cardano_json_object_unref(&json_object);
+    cardano_native_script_unref(&data);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  if (strcmp(type_string, "all") == 0)
+  {
+    cardano_script_all_t* script_all = NULL;
+    result                           = cardano_script_all_from_json(json, json_size, &script_all);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_json_object_unref(&json_object);
+      cardano_native_script_unref(&data);
+      return result;
+    }
+
+    result = cardano_native_script_new_all(script_all, &data);
+    cardano_script_all_unref(&script_all);
+  }
+  else if (strcmp(type_string, "any") == 0)
+  {
+    cardano_script_any_t* script_any = NULL;
+    result                           = cardano_script_any_from_json(json, json_size, &script_any);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_json_object_unref(&json_object);
+      cardano_native_script_unref(&data);
+      return result;
+    }
+
+    result = cardano_native_script_new_any(script_any, &data);
+    cardano_script_any_unref(&script_any);
+  }
+  else if (strcmp(type_string, "atLeast") == 0)
+  {
+    cardano_script_n_of_k_t* script_n_of_k = NULL;
+    result                                 = cardano_script_n_of_k_from_json(json, json_size, &script_n_of_k);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_json_object_unref(&json_object);
+      cardano_native_script_unref(&data);
+      return result;
+    }
+
+    result = cardano_native_script_new_n_of_k(script_n_of_k, &data);
+    cardano_script_n_of_k_unref(&script_n_of_k);
+  }
+  else if (strcmp(type_string, "sig") == 0)
+  {
+    cardano_script_pubkey_t* script_pubkey = NULL;
+    result                                 = cardano_script_pubkey_from_json(json, json_size, &script_pubkey);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_json_object_unref(&json_object);
+      cardano_native_script_unref(&data);
+      return result;
+    }
+
+    result = cardano_native_script_new_pubkey(script_pubkey, &data);
+    cardano_script_pubkey_unref(&script_pubkey);
+  }
+  else if (strcmp(type_string, "before") == 0)
+  {
+    cardano_script_invalid_after_t* invalid_after = NULL;
+    result                                        = cardano_script_invalid_after_from_json(json, json_size, &invalid_after);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_json_object_unref(&json_object);
+      cardano_native_script_unref(&data);
+      return result;
+    }
+
+    result = cardano_native_script_new_invalid_after(invalid_after, &data);
+    cardano_script_invalid_after_unref(&invalid_after);
+  }
+  else if (strcmp(type_string, "after") == 0)
+  {
+    cardano_script_invalid_before_t* invalid_before = NULL;
+    result                                          = cardano_script_invalid_before_from_json(json, json_size, &invalid_before);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_json_object_unref(&json_object);
+      cardano_native_script_unref(&data);
+      return result;
+    }
+
+    result = cardano_native_script_new_invalid_before(invalid_before, &data);
+    cardano_script_invalid_before_unref(&invalid_before);
+  }
+  else if (strcmp(type_string, "guard") == 0)
+  {
+    cardano_script_require_guard_t* require_guard = NULL;
+    result                                        = cardano_script_require_guard_from_json(json, json_size, &require_guard);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_json_object_unref(&json_object);
+      cardano_native_script_unref(&data);
+      return result;
+    }
+
+    result = cardano_native_script_new_require_guard(require_guard, &data);
+    cardano_script_require_guard_unref(&require_guard);
+  }
+  else
+  {
+    cardano_json_object_unref(&json_object);
+    cardano_native_script_unref(&data);
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_json_object_unref(&json_object);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_native_script_unref(&data);
+    return result;
+  }
+
+  *native_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_get_type(
+  const cardano_native_script_t* native_script,
+  cardano_native_script_type_t*  type)
+{
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = native_script->type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_to_all(
+  cardano_native_script_t* native_script,
+  cardano_script_all_t**   script_all)
+{
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_all == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script->type != CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF)
+  {
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_script_all_ref(native_script->all);
+
+  *script_all = native_script->all;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_to_any(
+  cardano_native_script_t* native_script,
+  cardano_script_any_t**   script_any)
+{
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_any == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script->type != CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ANY_OF)
+  {
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_script_any_ref(native_script->any);
+
+  *script_any = native_script->any;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_to_n_of_k(
+  cardano_native_script_t*  native_script,
+  cardano_script_n_of_k_t** script_n_of_k)
+{
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_n_of_k == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script->type != CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_N_OF_K)
+  {
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_script_n_of_k_ref(native_script->n_of_k);
+
+  *script_n_of_k = native_script->n_of_k;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_to_pubkey(
+  cardano_native_script_t*  native_script,
+  cardano_script_pubkey_t** script_pubkey)
+{
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_pubkey == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script->type != CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY)
+  {
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_script_pubkey_ref(native_script->pubkey);
+
+  *script_pubkey = native_script->pubkey;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_to_invalid_after(
+  cardano_native_script_t*         native_script,
+  cardano_script_invalid_after_t** invalid_after)
+{
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (invalid_after == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script->type != CARDANO_NATIVE_SCRIPT_TYPE_INVALID_AFTER)
+  {
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_script_invalid_after_ref(native_script->invalid_after);
+
+  *invalid_after = native_script->invalid_after;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_to_invalid_before(
+  cardano_native_script_t*          native_script,
+  cardano_script_invalid_before_t** invalid_before)
+{
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (invalid_before == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script->type != CARDANO_NATIVE_SCRIPT_TYPE_INVALID_BEFORE)
+  {
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_script_invalid_before_ref(native_script->invalid_before);
+
+  *invalid_before = native_script->invalid_before;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_to_require_guard(
+  cardano_native_script_t*         native_script,
+  cardano_script_require_guard_t** require_guard)
+{
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (require_guard == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script->type != CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD)
+  {
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_script_require_guard_ref(native_script->require_guard);
+
+  *require_guard = native_script->require_guard;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_native_script_get_hash(
+  const cardano_native_script_t* native_script)
+{
+  if (native_script == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_buffer_t*      cbor   = NULL;
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_error_t result = cardano_native_script_to_cbor(native_script, writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return NULL;
+  }
+
+  result = cardano_cbor_writer_encode_in_buffer(writer, &cbor);
+
+  cardano_cbor_writer_unref(&writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  static const byte_t native_prefix = 0x00;
+
+  cardano_buffer_t* hash_input = cardano_buffer_new(cardano_buffer_get_size(cbor) + 1U);
+
+  if (hash_input == NULL)
+  {
+    cardano_buffer_unref(&cbor);
+    return NULL;
+  }
+
+  cardano_error_t error = cardano_buffer_write(hash_input, &native_prefix, 1);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor);
+    cardano_buffer_unref(&hash_input);
+
+    return NULL;
+  }
+
+  error = cardano_buffer_write(hash_input, cardano_buffer_get_data(cbor), cardano_buffer_get_size(cbor));
+
+  cardano_buffer_unref(&cbor);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&hash_input);
+
+    return NULL;
+  }
+
+  error = cardano_blake2b_compute_hash(
+    cardano_buffer_get_data(hash_input),
+    cardano_buffer_get_size(hash_input),
+    CARDANO_BLAKE2B_HASH_SIZE_224,
+    &hash);
+
+  cardano_buffer_unref(&hash_input);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return hash;
+}
+
+bool
+cardano_native_script_equals(
+  const cardano_native_script_t* lhs,
+  const cardano_native_script_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return false;
+  }
+
+  bool result = false;
+  switch (lhs->type)
+  {
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF:
+      result = cardano_script_all_equals(lhs->all, rhs->all);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ANY_OF:
+      result = cardano_script_any_equals(lhs->any, rhs->any);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_N_OF_K:
+      result = cardano_script_n_of_k_equals(lhs->n_of_k, rhs->n_of_k);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY:
+      result = cardano_script_pubkey_equals(lhs->pubkey, rhs->pubkey);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_AFTER:
+      result = cardano_script_invalid_after_equals(lhs->invalid_after, rhs->invalid_after);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_BEFORE:
+      result = cardano_script_invalid_before_equals(lhs->invalid_before, rhs->invalid_before);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD:
+      result = cardano_script_require_guard_equals(lhs->require_guard, rhs->require_guard);
+      break;
+
+    default:
+      return false;
+  }
+
+  return result;
+}
+
+void
+cardano_native_script_clear_cbor_cache(cardano_native_script_t* native_script)
+{
+  if (native_script == NULL)
+  {
+    return;
+  }
+
+  switch (native_script->type)
+  {
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF:
+      cardano_script_all_clear_cbor_cache(native_script->all);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ANY_OF:
+      cardano_script_any_clear_cbor_cache(native_script->any);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_N_OF_K:
+      cardano_script_n_of_k_clear_cbor_cache(native_script->n_of_k);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY:
+      cardano_script_pubkey_clear_cbor_cache(native_script->pubkey);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_AFTER:
+      cardano_script_invalid_after_clear_cbor_cache(native_script->invalid_after);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_BEFORE:
+      cardano_script_invalid_before_clear_cbor_cache(native_script->invalid_before);
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD:
+      cardano_script_require_guard_clear_cbor_cache(native_script->require_guard);
+      break;
+
+    default:
+      break;
+  }
+}
+
+void
+cardano_native_script_unref(cardano_native_script_t** native_script)
+{
+  if ((native_script == NULL) || (*native_script == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*native_script)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *native_script = NULL;
+    return;
+  }
+}
+
+void
+cardano_native_script_ref(cardano_native_script_t* native_script)
+{
+  if (native_script == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&native_script->base);
+}
+
+size_t
+cardano_native_script_refcount(const cardano_native_script_t* native_script)
+{
+  if (native_script == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&native_script->base);
+}
+
+void
+cardano_native_script_set_last_error(cardano_native_script_t* native_script, const char* message)
+{
+  cardano_object_set_last_error(&native_script->base, message);
+}
+
+const char*
+cardano_native_script_get_last_error(const cardano_native_script_t* native_script)
+{
+  return cardano_object_get_last_error(&native_script->base);
+}
+
+cardano_error_t
+cardano_native_script_deep_clone(const cardano_native_script_t* source, cardano_native_script_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_t* copy = _cardano_malloc(sizeof(cardano_native_script_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  copy->all                = NULL;
+  copy->any                = NULL;
+  copy->invalid_after      = NULL;
+  copy->invalid_before     = NULL;
+  copy->n_of_k             = NULL;
+  copy->pubkey             = NULL;
+  copy->require_guard      = NULL;
+
+  if (source->all != NULL)
+  {
+    const cardano_error_t result = cardano_script_all_deep_clone(source->all, &copy->all);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->any != NULL)
+  {
+    const cardano_error_t result = cardano_script_any_deep_clone(source->any, &copy->any);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->invalid_after != NULL)
+  {
+    const cardano_error_t result = cardano_script_invalid_after_deep_clone(source->invalid_after, &copy->invalid_after);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->invalid_before != NULL)
+  {
+    const cardano_error_t result = cardano_script_invalid_before_deep_clone(source->invalid_before, &copy->invalid_before);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->n_of_k != NULL)
+  {
+    const cardano_error_t result = cardano_script_n_of_k_deep_clone(source->n_of_k, &copy->n_of_k);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->pubkey != NULL)
+  {
+    const cardano_error_t result = cardano_script_pubkey_deep_clone(source->pubkey, &copy->pubkey);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->require_guard != NULL)
+  {
+    const cardano_error_t result = cardano_script_require_guard_deep_clone(source->require_guard, &copy->require_guard);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/native_scripts/native_script_list.c b/vendor/src/scripts/native_scripts/native_script_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/native_scripts/native_script_list.c
@@ -0,0 +1,625 @@
+/**
+ * \file native_script_list.c
+ *
+ * \author angel.castillo
+ * \date   Jun 2, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/scripts/native_scripts/native_script.h>
+#include <cardano/scripts/native_scripts/native_script_list.h>
+
+#include "../../allocators.h"
+#include "../../cbor/cbor_validation.h"
+#include "../../collections/array.h"
+
+#include <assert.h>
+#include <cardano/json/json_object.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano native script list.
+ */
+typedef struct cardano_native_script_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             use_indefinite_encoding;
+} cardano_native_script_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a native script list object.
+ *
+ * This function is responsible for properly deallocating a native script list object (`cardano_native_script_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the native_script_list object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_native_script_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the native_script_list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_native_script_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_native_script_list_t* list = (cardano_native_script_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_native_script_list_new(cardano_native_script_list_t** native_script_list)
+{
+  if (native_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_list_t* list = _cardano_malloc(sizeof(cardano_native_script_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_native_script_list_deallocate;
+
+  list->array                   = cardano_array_new(128);
+  list->use_indefinite_encoding = false;
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *native_script_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_list_from_cbor(cardano_cbor_reader_t* reader, cardano_native_script_list_t** native_script_list)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_list_t* list   = NULL;
+  cardano_error_t               result = cardano_native_script_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_native_script_list_unref(&list);
+    return result;
+  }
+
+  list->use_indefinite_encoding = length < 0;
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_native_script_list_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_native_script_t* element = NULL;
+
+    result = cardano_native_script_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_native_script_list_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_native_script_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_native_script_list_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("native_script_list", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_native_script_list_unref(&list);
+    return result;
+  }
+
+  *native_script_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_list_from_json(
+  const char*                    json,
+  size_t                         json_size,
+  cardano_native_script_list_t** native_script_list)
+{
+  if (json == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (json_size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  if (native_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_object_t* root = cardano_json_object_parse(json, json_size);
+
+  if (root == NULL)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_native_script_list_t* list   = NULL;
+  cardano_error_t               result = cardano_native_script_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_json_object_unref(&root);
+    return result;
+  }
+
+  cardano_json_object_t* array = NULL;
+
+  if (!cardano_json_object_get_ex(root, "scripts", 7, &array))
+  {
+    cardano_native_script_list_unref(&list);
+    cardano_json_object_unref(&root);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  if (cardano_json_object_get_type(array) != CARDANO_JSON_OBJECT_TYPE_ARRAY)
+  {
+    cardano_native_script_list_unref(&list);
+    cardano_json_object_unref(&root);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  const size_t array_size = cardano_json_object_array_get_length(array);
+
+  for (size_t i = 0U; i < array_size; ++i)
+  {
+    cardano_json_object_t* element = cardano_json_object_array_get_ex(array, i);
+
+    if (element == NULL)
+    {
+      cardano_native_script_list_unref(&list);
+      cardano_json_object_unref(&root);
+
+      return CARDANO_ERROR_INVALID_JSON;
+    }
+
+    cardano_native_script_t* script = NULL;
+
+    size_t      json_length  = 0;
+    const char* element_json = cardano_json_object_to_json_string(element, CARDANO_JSON_FORMAT_COMPACT, &json_length);
+
+    result = cardano_native_script_from_json(element_json, json_length - 1U, &script);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_native_script_list_unref(&list);
+      cardano_json_object_unref(&root);
+
+      return result;
+    }
+
+    result = cardano_native_script_list_add(list, script);
+
+    cardano_native_script_unref(&script);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_native_script_list_unref(&list);
+      cardano_json_object_unref(&root);
+
+      return result;
+    }
+  }
+
+  cardano_json_object_unref(&root);
+
+  *native_script_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_list_to_cbor(const cardano_native_script_list_t* native_script_list, cardano_cbor_writer_t* writer)
+{
+  if (native_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(native_script_list->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (native_script_list->use_indefinite_encoding)
+  {
+    result = cardano_cbor_writer_write_start_array(writer, -1);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    };
+  }
+  else
+  {
+    size_t array_size = cardano_array_get_size(native_script_list->array);
+    result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(native_script_list->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(native_script_list->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in native script list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_native_script_to_cbor((cardano_native_script_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (native_script_list->use_indefinite_encoding)
+  {
+    result = cardano_cbor_writer_write_end_array(writer);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_native_script_list_to_cip116_json(
+  const cardano_native_script_list_t* native_script_list,
+  cardano_json_writer_t*              writer)
+{
+  if ((native_script_list == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(native_script_list->array != NULL);
+
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0; i < cardano_array_get_size(native_script_list->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(native_script_list->array, i);
+
+    assert(element != NULL);
+    CARDANO_UNUSED(element);
+
+    cardano_error_t result = cardano_native_script_to_cip116_json((cardano_native_script_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_native_script_list_get_length(const cardano_native_script_list_t* native_script_list)
+{
+  if (native_script_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(native_script_list->array);
+}
+
+cardano_error_t
+cardano_native_script_list_get(
+  const cardano_native_script_list_t* native_script_list,
+  size_t                              index,
+  cardano_native_script_t**           element)
+{
+  if (native_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(native_script_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_native_script_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_list_add(cardano_native_script_list_t* native_script_list, cardano_native_script_t* element)
+{
+  if (native_script_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(native_script_list->array);
+  const size_t new_size      = cardano_array_push(native_script_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_native_script_list_equals(const cardano_native_script_list_t* lhs, const cardano_native_script_list_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  if (cardano_array_get_size(lhs->array) != cardano_array_get_size(rhs->array))
+  {
+    return false;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(lhs->array); ++i)
+  {
+    cardano_native_script_t* lhs_element = (cardano_native_script_t*)((void*)cardano_array_get(lhs->array, i));
+    cardano_native_script_t* rhs_element = (cardano_native_script_t*)((void*)cardano_array_get(rhs->array, i));
+
+    cardano_native_script_unref(&lhs_element);
+    cardano_native_script_unref(&rhs_element);
+
+    if (!cardano_native_script_equals(lhs_element, rhs_element))
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+void
+cardano_native_script_list_clear_cbor_cache(cardano_native_script_list_t* native_script_list)
+{
+  if (native_script_list == NULL)
+  {
+    return;
+  }
+
+  for (size_t i = 0U; i < cardano_array_get_size(native_script_list->array); ++i)
+  {
+    cardano_native_script_t* element = (cardano_native_script_t*)((void*)cardano_array_get(native_script_list->array, i));
+
+    cardano_native_script_clear_cbor_cache(element);
+    cardano_native_script_unref(&element);
+  }
+}
+
+void
+cardano_native_script_list_unref(cardano_native_script_list_t** native_script_list)
+{
+  if ((native_script_list == NULL) || (*native_script_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*native_script_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *native_script_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_native_script_list_ref(cardano_native_script_list_t* native_script_list)
+{
+  if (native_script_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&native_script_list->base);
+}
+
+size_t
+cardano_native_script_list_refcount(const cardano_native_script_list_t* native_script_list)
+{
+  if (native_script_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&native_script_list->base);
+}
+
+void
+cardano_native_script_list_set_last_error(cardano_native_script_list_t* native_script_list, const char* message)
+{
+  cardano_object_set_last_error(&native_script_list->base, message);
+}
+
+const char*
+cardano_native_script_list_get_last_error(const cardano_native_script_list_t* native_script_list)
+{
+  return cardano_object_get_last_error(&native_script_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_native_script_t* copy   = NULL;
+  const cardano_error_t    result = cardano_native_script_deep_clone((const cardano_native_script_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_native_script_list_deep_clone(const cardano_native_script_list_t* source, cardano_native_script_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_list_t* copy = _cardano_malloc(sizeof(cardano_native_script_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count          = 1U;
+  copy->base.deallocator        = source->base.deallocator;
+  copy->base.last_error[0]      = '\0';
+  copy->array                   = NULL;
+  copy->use_indefinite_encoding = source->use_indefinite_encoding;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/native_scripts/native_script_type.c b/vendor/src/scripts/native_scripts/native_script_type.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/native_scripts/native_script_type.c
@@ -0,0 +1,62 @@
+/**
+ * \file native_script_type.c
+ *
+ * \author angel.castillo
+ * \date   Jun 03, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/scripts/native_scripts/native_script_type.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_native_script_type_to_string(const cardano_native_script_type_t native_script_type)
+{
+  const char* message;
+
+  switch (native_script_type)
+  {
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY:
+      message = "Native Script Type: Require Pubkey";
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF:
+      message = "Native Script Type: Require All Of";
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ANY_OF:
+      message = "Native Script Type: Require Any Of";
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_N_OF_K:
+      message = "Native Script Type: Require N Of K";
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_BEFORE:
+      message = "Native Script Type: Invalid Before";
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_INVALID_AFTER:
+      message = "Native Script Type: Invalid After";
+      break;
+    case CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD:
+      message = "Native Script Type: Require Guard";
+      break;
+    default:
+      message = "Native Script Type: Unknown";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/scripts/native_scripts/script_all.c b/vendor/src/scripts/native_scripts/script_all.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/native_scripts/script_all.c
@@ -0,0 +1,566 @@
+/**
+ * \file script_all.c
+ *
+ * \author angel.castillo
+ * \date   Jun 2, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/scripts/native_scripts/native_script_list.h>
+#include <cardano/scripts/native_scripts/native_script_type.h>
+#include <cardano/scripts/native_scripts/script_all.h>
+
+#include <cardano/object.h>
+
+#include "../../allocators.h"
+#include "../../cbor/cbor_validation.h"
+#include "../../string_safe.h"
+
+#include <assert.h>
+#include <cardano/json/json_object.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This script evaluates to true if all the sub-scripts evaluate to true.
+ *
+ * If the list of sub-scripts is empty, this script evaluates to true.
+ */
+typedef struct cardano_script_all_t
+{
+    cardano_object_t              base;
+    cardano_native_script_type_t  type;
+    cardano_native_script_list_t* scripts;
+    cardano_buffer_t*             cbor_cache;
+
+} cardano_script_all_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a script_all object.
+ *
+ * This function is responsible for properly deallocating a script_all object (`cardano_script_all_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the script_all object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_script_all_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the script_all
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_script_all_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_script_all_t* data = (cardano_script_all_t*)object;
+
+  cardano_native_script_list_unref(&data->scripts);
+
+  cardano_buffer_unref(&data->cbor_cache);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Decodes the fields of a script_all from a CBOR reader.
+ *
+ * This function reads the CBOR encoded script_all at the current position of the reader and creates a new
+ * \ref cardano_script_all_t object from its fields. It does not cache the original CBOR representation, that is done
+ * by \ref cardano_script_all_from_cbor.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t positioned at the script_all.
+ * \param[out] script_all On success, set to the newly created \ref cardano_script_all_t object.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_all was decoded, or an appropriate error code otherwise.
+ */
+static cardano_error_t
+cardano_script_all_decode(cardano_cbor_reader_t* reader, cardano_script_all_t** script_all)
+{
+  static const char* validator_name = "script_all";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, 2);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF,
+    (enum_to_string_callback_t)((void*)&cardano_native_script_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_native_script_list_t* native_scripts          = NULL;
+  const cardano_error_t         read_script_list_result = cardano_native_script_list_from_cbor(reader, &native_scripts);
+
+  if (read_script_list_result != CARDANO_SUCCESS)
+  {
+    return read_script_list_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_native_script_list_unref(&native_scripts);
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t create_all_new_result = cardano_script_all_new(native_scripts, script_all);
+  cardano_native_script_list_unref(&native_scripts);
+
+  return create_all_new_result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_script_all_new(cardano_native_script_list_t* native_scripts, cardano_script_all_t** script_all)
+{
+  if (native_scripts == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_all == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_all_t* data = _cardano_malloc(sizeof(cardano_script_all_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_native_script_list_ref(native_scripts);
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_script_all_deallocate;
+  data->cbor_cache         = NULL;
+  data->type               = CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ALL_OF;
+  data->scripts            = native_scripts;
+
+  *script_all = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_all_from_cbor(cardano_cbor_reader_t* reader, cardano_script_all_t** script_all)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_all == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        result      = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_script_all_decode(reader, script_all);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_copy);
+    return result;
+  }
+
+  cardano_buffer_t* cbor_cache = NULL;
+
+  result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if ((result != CARDANO_SUCCESS) || (cbor_cache == NULL))
+  {
+    cardano_script_all_unref(script_all);
+
+    return (result != CARDANO_SUCCESS) ? result : CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*script_all)->cbor_cache = cbor_cache;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_all_to_cbor(
+  const cardano_script_all_t* script_all,
+  cardano_cbor_writer_t*      writer)
+{
+  if (script_all == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_all->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(script_all->cbor_cache), cardano_buffer_get_size(script_all->cbor_cache));
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 2);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, script_all->type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_native_script_list_to_cbor(script_all->scripts, writer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_script_all_to_cip116_json(
+  const cardano_script_all_t* script_all,
+  cardano_json_writer_t*      writer)
+{
+  if ((script_all == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "all", 3);
+  cardano_json_writer_write_property_name(writer, "scripts", 7);
+
+  cardano_error_t error = cardano_native_script_list_to_cip116_json(script_all->scripts, writer);
+
+  assert(error == CARDANO_SUCCESS);
+  CARDANO_UNUSED(error);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_all_from_json(const char* json, size_t json_size, cardano_script_all_t** native_script)
+{
+  if (json == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_object_t* json_object = cardano_json_object_parse(json, json_size);
+
+  if (json_object == NULL)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_json_object_t* type = NULL;
+
+  if (!cardano_json_object_get_ex(json_object, "type", 4, &type))
+  {
+    cardano_json_object_unref(&json_object);
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  const char* type_string = cardano_json_object_get_string(type, NULL);
+
+  if (type_string == NULL)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_native_script_list_t* native_scripts = NULL;
+
+  if (strcmp(type_string, "all") == 0)
+  {
+    cardano_error_t result = cardano_native_script_list_from_json(json, json_size, &native_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_json_object_unref(&json_object);
+
+      return result;
+    }
+  }
+  else
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_json_object_unref(&json_object);
+
+  const cardano_error_t create_all_new_result = cardano_script_all_new(native_scripts, native_script);
+  cardano_native_script_list_unref(&native_scripts);
+
+  return create_all_new_result;
+}
+
+size_t
+cardano_script_all_get_length(const cardano_script_all_t* script_all)
+{
+  if (script_all == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_native_script_list_get_length(script_all->scripts);
+}
+
+cardano_error_t
+cardano_script_all_get_scripts(
+  cardano_script_all_t*          script_all,
+  cardano_native_script_list_t** list)
+{
+  if (script_all == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_list_ref(script_all->scripts);
+
+  *list = script_all->scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_all_set_scripts(
+  cardano_script_all_t*         script_all,
+  cardano_native_script_list_t* list)
+{
+  if (script_all == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_list_ref(list);
+
+  cardano_native_script_list_unref(&script_all->scripts);
+
+  script_all->scripts = list;
+  cardano_buffer_unref(&script_all->cbor_cache);
+  script_all->cbor_cache = NULL;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_script_all_equals(const cardano_script_all_t* lhs, const cardano_script_all_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return false;
+  }
+
+  assert(lhs->scripts);
+  assert(rhs->scripts);
+
+  return cardano_native_script_list_equals(lhs->scripts, rhs->scripts);
+}
+
+void
+cardano_script_all_clear_cbor_cache(cardano_script_all_t* script_all)
+{
+  if (script_all == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&script_all->cbor_cache);
+  script_all->cbor_cache = NULL;
+  cardano_native_script_list_clear_cbor_cache(script_all->scripts);
+}
+
+void
+cardano_script_all_unref(cardano_script_all_t** script_all)
+{
+  if ((script_all == NULL) || (*script_all == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*script_all)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *script_all = NULL;
+    return;
+  }
+}
+
+void
+cardano_script_all_ref(cardano_script_all_t* script_all)
+{
+  if (script_all == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&script_all->base);
+}
+
+size_t
+cardano_script_all_refcount(const cardano_script_all_t* script_all)
+{
+  if (script_all == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&script_all->base);
+}
+
+void
+cardano_script_all_set_last_error(cardano_script_all_t* script_all, const char* message)
+{
+  cardano_object_set_last_error(&script_all->base, message);
+}
+
+const char*
+cardano_script_all_get_last_error(const cardano_script_all_t* script_all)
+{
+  return cardano_object_get_last_error(&script_all->base);
+}
+
+cardano_error_t
+cardano_script_all_deep_clone(const cardano_script_all_t* source, cardano_script_all_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_all_t* copy = _cardano_malloc(sizeof(cardano_script_all_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  copy->scripts            = NULL;
+  copy->cbor_cache         = NULL;
+
+  if (source->scripts != NULL)
+  {
+    const cardano_error_t result = cardano_native_script_list_deep_clone(source->scripts, &copy->scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/native_scripts/script_any.c b/vendor/src/scripts/native_scripts/script_any.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/native_scripts/script_any.c
@@ -0,0 +1,562 @@
+/**
+ * \file script_any.c
+ *
+ * \author angel.castillo
+ * \date   Jun 2, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/scripts/native_scripts/native_script_list.h>
+#include <cardano/scripts/native_scripts/native_script_type.h>
+#include <cardano/scripts/native_scripts/script_any.h>
+
+#include <cardano/object.h>
+
+#include "../../allocators.h"
+#include "../../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <cardano/json/json_object.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This script evaluates to true if all the sub-scripts evaluate to true.
+ *
+ * If the list of sub-scripts is empty, this script evaluates to true.
+ */
+typedef struct cardano_script_any_t
+{
+    cardano_object_t              base;
+    cardano_native_script_type_t  type;
+    cardano_native_script_list_t* scripts;
+    cardano_buffer_t*             cbor_cache;
+
+} cardano_script_any_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a script_any object.
+ *
+ * This function is responsible for properly deallocating a script_any object (`cardano_script_any_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the script_any object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_script_any_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the script_any
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_script_any_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_script_any_t* data = (cardano_script_any_t*)object;
+
+  cardano_native_script_list_unref(&data->scripts);
+
+  cardano_buffer_unref(&data->cbor_cache);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Decodes the fields of a script_any from a CBOR reader.
+ *
+ * This function reads the CBOR encoded script_any at the current position of the reader and creates a new
+ * \ref cardano_script_any_t object from its fields. It does not cache the original CBOR representation, that is done
+ * by \ref cardano_script_any_from_cbor.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t positioned at the script_any.
+ * \param[out] script_any On success, set to the newly created \ref cardano_script_any_t object.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_any was decoded, or an appropriate error code otherwise.
+ */
+static cardano_error_t
+cardano_script_any_decode(cardano_cbor_reader_t* reader, cardano_script_any_t** script_any)
+{
+  static const char* validator_name = "script_any";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, 2);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ANY_OF,
+    (enum_to_string_callback_t)((void*)&cardano_native_script_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_native_script_list_t* native_scripts          = NULL;
+  const cardano_error_t         read_script_list_result = cardano_native_script_list_from_cbor(reader, &native_scripts);
+
+  if (read_script_list_result != CARDANO_SUCCESS)
+  {
+    return read_script_list_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_native_script_list_unref(&native_scripts);
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t create_any_new_result = cardano_script_any_new(native_scripts, script_any);
+  cardano_native_script_list_unref(&native_scripts);
+
+  return create_any_new_result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_script_any_new(cardano_native_script_list_t* native_scripts, cardano_script_any_t** script_any)
+{
+  if (native_scripts == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_any == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_any_t* data = _cardano_malloc(sizeof(cardano_script_any_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_native_script_list_ref(native_scripts);
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_script_any_deallocate;
+  data->cbor_cache         = NULL;
+  data->type               = CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_ANY_OF;
+  data->scripts            = native_scripts;
+
+  *script_any = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_any_from_cbor(cardano_cbor_reader_t* reader, cardano_script_any_t** script_any)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_any == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        result      = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_script_any_decode(reader, script_any);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_copy);
+    return result;
+  }
+
+  cardano_buffer_t* cbor_cache = NULL;
+
+  result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if ((result != CARDANO_SUCCESS) || (cbor_cache == NULL))
+  {
+    cardano_script_any_unref(script_any);
+
+    return (result != CARDANO_SUCCESS) ? result : CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*script_any)->cbor_cache = cbor_cache;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_any_to_cbor(
+  const cardano_script_any_t* script_any,
+  cardano_cbor_writer_t*      writer)
+{
+  if (script_any == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_any->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(script_any->cbor_cache), cardano_buffer_get_size(script_any->cbor_cache));
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 2);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, script_any->type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_native_script_list_to_cbor(script_any->scripts, writer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_script_any_to_cip116_json(
+  const cardano_script_any_t* script_any,
+  cardano_json_writer_t*      writer)
+{
+  if ((script_any == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "any", 3);
+  cardano_json_writer_write_property_name(writer, "scripts", 7);
+
+  cardano_error_t error = cardano_native_script_list_to_cip116_json(script_any->scripts, writer);
+
+  assert(error == CARDANO_SUCCESS);
+  CARDANO_UNUSED(error);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_any_from_json(const char* json, size_t json_size, cardano_script_any_t** native_script)
+{
+  if (json == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_object_t* json_object = cardano_json_object_parse(json, json_size);
+
+  if (json_object == NULL)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_json_object_t* type = NULL;
+
+  if (!cardano_json_object_get_ex(json_object, "type", 4, &type))
+  {
+    cardano_json_object_unref(&json_object);
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  const char* type_string = cardano_json_object_get_string(type, NULL);
+
+  if (type_string == NULL)
+  {
+    cardano_json_object_unref(&json_object);
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_native_script_list_t* native_scripts = NULL;
+
+  if (strcmp(type_string, "any") == 0)
+  {
+    cardano_error_t result = cardano_native_script_list_from_json(json, json_size, &native_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_json_object_unref(&json_object);
+      return result;
+    }
+  }
+  else
+  {
+    cardano_json_object_unref(&json_object);
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_json_object_unref(&json_object);
+
+  const cardano_error_t create_any_new_result = cardano_script_any_new(native_scripts, native_script);
+  cardano_native_script_list_unref(&native_scripts);
+
+  return create_any_new_result;
+}
+
+size_t
+cardano_script_any_get_length(const cardano_script_any_t* script_any)
+{
+  if (script_any == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_native_script_list_get_length(script_any->scripts);
+}
+
+cardano_error_t
+cardano_script_any_get_scripts(
+  cardano_script_any_t*          script_any,
+  cardano_native_script_list_t** list)
+{
+  if (script_any == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_list_ref(script_any->scripts);
+
+  *list = script_any->scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_any_set_scripts(
+  cardano_script_any_t*         script_any,
+  cardano_native_script_list_t* list)
+{
+  if (script_any == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_list_ref(list);
+
+  cardano_native_script_list_unref(&script_any->scripts);
+
+  script_any->scripts = list;
+  cardano_buffer_unref(&script_any->cbor_cache);
+  script_any->cbor_cache = NULL;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_script_any_equals(const cardano_script_any_t* lhs, const cardano_script_any_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return false;
+  }
+
+  assert(lhs->scripts);
+  assert(rhs->scripts);
+
+  return cardano_native_script_list_equals(lhs->scripts, rhs->scripts);
+}
+
+void
+cardano_script_any_clear_cbor_cache(cardano_script_any_t* script_any)
+{
+  if (script_any == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&script_any->cbor_cache);
+  script_any->cbor_cache = NULL;
+  cardano_native_script_list_clear_cbor_cache(script_any->scripts);
+}
+
+void
+cardano_script_any_unref(cardano_script_any_t** script_any)
+{
+  if ((script_any == NULL) || (*script_any == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*script_any)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *script_any = NULL;
+    return;
+  }
+}
+
+void
+cardano_script_any_ref(cardano_script_any_t* script_any)
+{
+  if (script_any == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&script_any->base);
+}
+
+size_t
+cardano_script_any_refcount(const cardano_script_any_t* script_any)
+{
+  if (script_any == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&script_any->base);
+}
+
+void
+cardano_script_any_set_last_error(cardano_script_any_t* script_any, const char* message)
+{
+  cardano_object_set_last_error(&script_any->base, message);
+}
+
+const char*
+cardano_script_any_get_last_error(const cardano_script_any_t* script_any)
+{
+  return cardano_object_get_last_error(&script_any->base);
+}
+
+cardano_error_t
+cardano_script_any_deep_clone(const cardano_script_any_t* source, cardano_script_any_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_any_t* copy = _cardano_malloc(sizeof(cardano_script_any_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  copy->scripts            = NULL;
+  copy->cbor_cache         = NULL;
+
+  if (source->scripts != NULL)
+  {
+    const cardano_error_t result = cardano_native_script_list_deep_clone(source->scripts, &copy->scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/native_scripts/script_invalid_after.c b/vendor/src/scripts/native_scripts/script_invalid_after.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/native_scripts/script_invalid_after.c
@@ -0,0 +1,532 @@
+/**
+ * \file script_invalid_after.c
+ *
+ * \author angel.castillo
+ * \date   Jun 2, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/scripts/native_scripts/native_script_list.h>
+#include <cardano/scripts/native_scripts/native_script_type.h>
+#include <cardano/scripts/native_scripts/script_invalid_after.h>
+
+#include <cardano/object.h>
+
+#include "../../allocators.h"
+#include "../../cbor/cbor_validation.h"
+#include "../../string_safe.h"
+
+#include <assert.h>
+#include <cardano/json/json_object.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This script evaluates to true if the upper bound of the transaction validity interval is a
+ * slot number Y, and X <= Y.
+ *
+ * This condition guarantees that the actual slot number in which the transaction is included is
+ * (strictly) less than slot number X.
+ */
+typedef struct cardano_script_invalid_after_t
+{
+    cardano_object_t             base;
+    cardano_native_script_type_t type;
+    uint64_t                     slot;
+    cardano_buffer_t*            cbor_cache;
+
+} cardano_script_invalid_after_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a script_invalid_after object.
+ *
+ * This function is responsible for properly deallocating a script_invalid_after object (`cardano_script_invalid_after_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the script_invalid_after object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_script_invalid_after_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the script_invalid_after
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_script_invalid_after_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_script_invalid_after_t* data = (cardano_script_invalid_after_t*)object;
+
+  cardano_buffer_unref(&data->cbor_cache);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Decodes the fields of a script_invalid_after from a CBOR reader.
+ *
+ * This function reads the CBOR encoded script_invalid_after at the current position of the reader and creates a new
+ * \ref cardano_script_invalid_after_t object from its fields. It does not cache the original CBOR representation, that is done
+ * by \ref cardano_script_invalid_after_from_cbor.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t positioned at the script_invalid_after.
+ * \param[out] script_invalid_after On success, set to the newly created \ref cardano_script_invalid_after_t object.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_invalid_after was decoded, or an appropriate error code otherwise.
+ */
+static cardano_error_t
+cardano_script_invalid_after_decode(cardano_cbor_reader_t* reader, cardano_script_invalid_after_t** script_invalid_after)
+{
+  static const char* validator_name = "script_invalid_after";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, 2);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_NATIVE_SCRIPT_TYPE_INVALID_AFTER,
+    (enum_to_string_callback_t)((void*)&cardano_native_script_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  uint64_t slot = 0U;
+
+  const cardano_error_t read_slot_result = cardano_cbor_reader_read_uint(reader, &slot);
+
+  if (read_slot_result != CARDANO_SUCCESS)
+  {
+    return read_slot_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    return expect_end_array_result;
+  }
+
+  return cardano_script_invalid_after_new(slot, script_invalid_after);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_script_invalid_after_new(const uint64_t slot, cardano_script_invalid_after_t** script_invalid_after)
+{
+  if (script_invalid_after == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_invalid_after_t* data = _cardano_malloc(sizeof(cardano_script_invalid_after_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_script_invalid_after_deallocate;
+  data->cbor_cache         = NULL;
+  data->type               = CARDANO_NATIVE_SCRIPT_TYPE_INVALID_AFTER;
+  data->slot               = slot;
+
+  *script_invalid_after = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_invalid_after_from_cbor(cardano_cbor_reader_t* reader, cardano_script_invalid_after_t** script_invalid_after)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_invalid_after == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        result      = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_script_invalid_after_decode(reader, script_invalid_after);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_copy);
+    return result;
+  }
+
+  cardano_buffer_t* cbor_cache = NULL;
+
+  result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if ((result != CARDANO_SUCCESS) || (cbor_cache == NULL))
+  {
+    cardano_script_invalid_after_unref(script_invalid_after);
+
+    return (result != CARDANO_SUCCESS) ? result : CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*script_invalid_after)->cbor_cache = cbor_cache;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_invalid_after_to_cbor(
+  const cardano_script_invalid_after_t* script_invalid_after,
+  cardano_cbor_writer_t*                writer)
+{
+  if (script_invalid_after == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_invalid_after->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(script_invalid_after->cbor_cache), cardano_buffer_get_size(script_invalid_after->cbor_cache));
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 2);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, script_invalid_after->type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, script_invalid_after->slot);
+
+  return result;
+}
+
+cardano_error_t
+cardano_script_invalid_after_to_cip116_json(
+  const cardano_script_invalid_after_t* script_invalid_after,
+  cardano_json_writer_t*                writer)
+{
+  if ((script_invalid_after == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "timelock_expiry", 15);
+  cardano_json_writer_write_property_name(writer, "slot", 4);
+
+  char         number_str[32] = { 0 };
+  const size_t size           = cardano_safe_uint64_to_string(script_invalid_after->slot, number_str, sizeof(number_str));
+
+  assert(size > 0U);
+  CARDANO_UNUSED(size);
+
+  cardano_json_writer_write_string(writer, number_str, cardano_safe_strlen(number_str, 32));
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_invalid_after_from_json(const char* json, size_t json_size, cardano_script_invalid_after_t** native_script)
+{
+  if (json == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (json_size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_object_t* json_object = cardano_json_object_parse(json, json_size);
+
+  if (json_object == NULL)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_json_object_t* type = NULL;
+
+  if (!cardano_json_object_get_ex(json_object, "type", 4, &type))
+  {
+    cardano_json_object_unref(&json_object);
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_json_object_t* slot_object = NULL;
+
+  if (!cardano_json_object_get_ex(json_object, "slot", 4, &slot_object))
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  const char* type_string = cardano_json_object_get_string(type, NULL);
+
+  if (type_string == NULL)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  uint64_t slot = 0U;
+
+  cardano_error_t result = cardano_json_object_get_uint(slot_object, &slot);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return result;
+  }
+
+  if (strcmp(type_string, "before") != 0)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_json_object_unref(&json_object);
+
+  return cardano_script_invalid_after_new(slot, native_script);
+}
+
+cardano_error_t
+cardano_script_invalid_after_get_slot(const cardano_script_invalid_after_t* script_invalid_after, uint64_t* slot)
+{
+  if (script_invalid_after == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (slot == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *slot = script_invalid_after->slot;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_invalid_after_set_slot(cardano_script_invalid_after_t* script_invalid_after, uint64_t slot)
+{
+  if (script_invalid_after == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  script_invalid_after->slot = slot;
+  cardano_buffer_unref(&script_invalid_after->cbor_cache);
+  script_invalid_after->cbor_cache = NULL;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_script_invalid_after_equals(const cardano_script_invalid_after_t* lhs, const cardano_script_invalid_after_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return false;
+  }
+
+  if (lhs->slot != rhs->slot)
+  {
+    return false;
+  }
+
+  return true;
+}
+
+void
+cardano_script_invalid_after_clear_cbor_cache(cardano_script_invalid_after_t* script_invalid_after)
+{
+  if (script_invalid_after == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&script_invalid_after->cbor_cache);
+  script_invalid_after->cbor_cache = NULL;
+}
+
+void
+cardano_script_invalid_after_unref(cardano_script_invalid_after_t** script_invalid_after)
+{
+  if ((script_invalid_after == NULL) || (*script_invalid_after == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*script_invalid_after)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *script_invalid_after = NULL;
+    return;
+  }
+}
+
+void
+cardano_script_invalid_after_ref(cardano_script_invalid_after_t* script_invalid_after)
+{
+  if (script_invalid_after == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&script_invalid_after->base);
+}
+
+size_t
+cardano_script_invalid_after_refcount(const cardano_script_invalid_after_t* script_invalid_after)
+{
+  if (script_invalid_after == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&script_invalid_after->base);
+}
+
+void
+cardano_script_invalid_after_set_last_error(cardano_script_invalid_after_t* script_invalid_after, const char* message)
+{
+  cardano_object_set_last_error(&script_invalid_after->base, message);
+}
+
+const char*
+cardano_script_invalid_after_get_last_error(const cardano_script_invalid_after_t* script_invalid_after)
+{
+  return cardano_object_get_last_error(&script_invalid_after->base);
+}
+
+cardano_error_t
+cardano_script_invalid_after_deep_clone(const cardano_script_invalid_after_t* source, cardano_script_invalid_after_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_invalid_after_t* copy = _cardano_malloc(sizeof(cardano_script_invalid_after_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  copy->slot               = source->slot;
+  copy->cbor_cache         = NULL;
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/native_scripts/script_invalid_before.c b/vendor/src/scripts/native_scripts/script_invalid_before.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/native_scripts/script_invalid_before.c
@@ -0,0 +1,531 @@
+/**
+ * \file script_invalid_before.c
+ *
+ * \author angel.castillo
+ * \date   Jun 2, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/scripts/native_scripts/native_script_list.h>
+#include <cardano/scripts/native_scripts/native_script_type.h>
+#include <cardano/scripts/native_scripts/script_invalid_before.h>
+
+#include <cardano/object.h>
+
+#include "../../allocators.h"
+#include "../../cbor/cbor_validation.h"
+#include "../../string_safe.h"
+
+#include <assert.h>
+#include <cardano/json/json_object.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This script evaluates to true if the lower bound of the transaction validity interval is a
+ * slot number Y, and Y >= X.
+ *
+ * This condition guarantees that the actual slot number in which the transaction is included
+ * is greater than or equal to slot number X.
+ */
+typedef struct cardano_script_invalid_before_t
+{
+    cardano_object_t             base;
+    cardano_native_script_type_t type;
+    uint64_t                     slot;
+    cardano_buffer_t*            cbor_cache;
+
+} cardano_script_invalid_before_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a script_invalid_before object.
+ *
+ * This function is responsible for properly deallocating a script_invalid_before object (`cardano_script_invalid_before_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the script_invalid_before object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_script_invalid_before_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the script_invalid_before
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_script_invalid_before_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_script_invalid_before_t* data = (cardano_script_invalid_before_t*)object;
+
+  cardano_buffer_unref(&data->cbor_cache);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Decodes the fields of a script_invalid_before from a CBOR reader.
+ *
+ * This function reads the CBOR encoded script_invalid_before at the current position of the reader and creates a new
+ * \ref cardano_script_invalid_before_t object from its fields. It does not cache the original CBOR representation, that is done
+ * by \ref cardano_script_invalid_before_from_cbor.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t positioned at the script_invalid_before.
+ * \param[out] script_invalid_before On success, set to the newly created \ref cardano_script_invalid_before_t object.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_invalid_before was decoded, or an appropriate error code otherwise.
+ */
+static cardano_error_t
+cardano_script_invalid_before_decode(cardano_cbor_reader_t* reader, cardano_script_invalid_before_t** script_invalid_before)
+{
+  static const char* validator_name = "script_invalid_before";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, 2);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_NATIVE_SCRIPT_TYPE_INVALID_BEFORE,
+    (enum_to_string_callback_t)((void*)&cardano_native_script_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  uint64_t slot = 0U;
+
+  const cardano_error_t read_slot_result = cardano_cbor_reader_read_uint(reader, &slot);
+
+  if (read_slot_result != CARDANO_SUCCESS)
+  {
+    return read_slot_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    return expect_end_array_result;
+  }
+
+  return cardano_script_invalid_before_new(slot, script_invalid_before);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_script_invalid_before_new(const uint64_t slot, cardano_script_invalid_before_t** script_invalid_before)
+{
+  if (script_invalid_before == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_invalid_before_t* data = _cardano_malloc(sizeof(cardano_script_invalid_before_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_script_invalid_before_deallocate;
+  data->cbor_cache         = NULL;
+  data->type               = CARDANO_NATIVE_SCRIPT_TYPE_INVALID_BEFORE;
+  data->slot               = slot;
+
+  *script_invalid_before = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_invalid_before_from_cbor(cardano_cbor_reader_t* reader, cardano_script_invalid_before_t** script_invalid_before)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_invalid_before == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        result      = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_script_invalid_before_decode(reader, script_invalid_before);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_copy);
+    return result;
+  }
+
+  cardano_buffer_t* cbor_cache = NULL;
+
+  result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if ((result != CARDANO_SUCCESS) || (cbor_cache == NULL))
+  {
+    cardano_script_invalid_before_unref(script_invalid_before);
+
+    return (result != CARDANO_SUCCESS) ? result : CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*script_invalid_before)->cbor_cache = cbor_cache;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_invalid_before_to_cbor(
+  const cardano_script_invalid_before_t* script_invalid_before,
+  cardano_cbor_writer_t*                 writer)
+{
+  if (script_invalid_before == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_invalid_before->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(script_invalid_before->cbor_cache), cardano_buffer_get_size(script_invalid_before->cbor_cache));
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 2);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, script_invalid_before->type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, script_invalid_before->slot);
+
+  return result;
+}
+
+cardano_error_t
+cardano_script_invalid_before_to_cip116_json(
+  const cardano_script_invalid_before_t* script_invalid_before,
+  cardano_json_writer_t*                 writer)
+{
+  if ((script_invalid_before == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "timelock_start", 14);
+  cardano_json_writer_write_property_name(writer, "slot", 4);
+
+  char         number_str[32] = { 0 };
+  const size_t size           = cardano_safe_uint64_to_string(script_invalid_before->slot, number_str, sizeof(number_str));
+
+  assert(size > 0U);
+  CARDANO_UNUSED(size);
+
+  cardano_json_writer_write_string(writer, number_str, cardano_safe_strlen(number_str, 32));
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_invalid_before_from_json(const char* json, const size_t json_size, cardano_script_invalid_before_t** native_script)
+{
+  if (json == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (json_size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_object_t* json_object = cardano_json_object_parse(json, json_size);
+
+  if (json_object == NULL)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_json_object_t* type     = NULL;
+  bool                   has_type = cardano_json_object_get_ex(json_object, "type", 4, &type);
+
+  if (!has_type)
+  {
+    cardano_json_object_unref(&json_object);
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_json_object_t* slot_object = NULL;
+
+  if (!cardano_json_object_get_ex(json_object, "slot", 4, &slot_object))
+  {
+    cardano_json_object_unref(&json_object);
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  const char* type_string = cardano_json_object_get_string(type, NULL);
+
+  if (type_string == NULL)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  uint64_t slot = 0U;
+
+  cardano_error_t result = cardano_json_object_get_uint(slot_object, &slot);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_json_object_unref(&json_object);
+    return result;
+  }
+
+  if (strcmp(type_string, "after") != 0)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_json_object_unref(&json_object);
+
+  return cardano_script_invalid_before_new(slot, native_script);
+}
+
+cardano_error_t
+cardano_script_invalid_before_get_slot(const cardano_script_invalid_before_t* script_invalid_before, uint64_t* slot)
+{
+  if (script_invalid_before == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (slot == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *slot = script_invalid_before->slot;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_invalid_before_set_slot(cardano_script_invalid_before_t* script_invalid_before, uint64_t slot)
+{
+  if (script_invalid_before == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  script_invalid_before->slot = slot;
+  cardano_buffer_unref(&script_invalid_before->cbor_cache);
+  script_invalid_before->cbor_cache = NULL;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_script_invalid_before_equals(const cardano_script_invalid_before_t* lhs, const cardano_script_invalid_before_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return false;
+  }
+
+  if (lhs->slot != rhs->slot)
+  {
+    return false;
+  }
+
+  return true;
+}
+
+void
+cardano_script_invalid_before_clear_cbor_cache(cardano_script_invalid_before_t* script_invalid_before)
+{
+  if (script_invalid_before == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&script_invalid_before->cbor_cache);
+  script_invalid_before->cbor_cache = NULL;
+}
+
+void
+cardano_script_invalid_before_unref(cardano_script_invalid_before_t** script_invalid_before)
+{
+  if ((script_invalid_before == NULL) || (*script_invalid_before == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*script_invalid_before)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *script_invalid_before = NULL;
+    return;
+  }
+}
+
+void
+cardano_script_invalid_before_ref(cardano_script_invalid_before_t* script_invalid_before)
+{
+  if (script_invalid_before == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&script_invalid_before->base);
+}
+
+size_t
+cardano_script_invalid_before_refcount(const cardano_script_invalid_before_t* script_invalid_before)
+{
+  if (script_invalid_before == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&script_invalid_before->base);
+}
+
+void
+cardano_script_invalid_before_set_last_error(cardano_script_invalid_before_t* script_invalid_before, const char* message)
+{
+  cardano_object_set_last_error(&script_invalid_before->base, message);
+}
+
+const char*
+cardano_script_invalid_before_get_last_error(const cardano_script_invalid_before_t* script_invalid_before)
+{
+  return cardano_object_get_last_error(&script_invalid_before->base);
+}
+
+cardano_error_t
+cardano_script_invalid_before_deep_clone(const cardano_script_invalid_before_t* source, cardano_script_invalid_before_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_invalid_before_t* copy = _cardano_malloc(sizeof(cardano_script_invalid_before_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  copy->slot               = source->slot;
+  copy->cbor_cache         = NULL;
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/native_scripts/script_n_of_k.c b/vendor/src/scripts/native_scripts/script_n_of_k.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/native_scripts/script_n_of_k.c
@@ -0,0 +1,643 @@
+/**
+ * \file script_n_of_k.c
+ *
+ * \author angel.castillo
+ * \date   Jun 2, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF n_of_k KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/scripts/native_scripts/native_script_list.h>
+#include <cardano/scripts/native_scripts/native_script_type.h>
+#include <cardano/scripts/native_scripts/script_n_of_k.h>
+
+#include <cardano/object.h>
+
+#include "../../allocators.h"
+#include "../../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <cardano/json/json_object.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This script evaluates to true if at least M (required field) of the sub-scripts evaluate to true.
+ */
+typedef struct cardano_script_n_of_k_t
+{
+    cardano_object_t              base;
+    cardano_native_script_type_t  type;
+    size_t                        required;
+    cardano_native_script_list_t* scripts;
+    cardano_buffer_t*             cbor_cache;
+
+} cardano_script_n_of_k_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a script_n_of_k object.
+ *
+ * This function is responsible for properly deallocating a script_n_of_k object (`cardano_script_n_of_k_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the script_n_of_k object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_script_n_of_k_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the script_n_of_k
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_script_n_of_k_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_script_n_of_k_t* data = (cardano_script_n_of_k_t*)object;
+
+  cardano_native_script_list_unref(&data->scripts);
+
+  cardano_buffer_unref(&data->cbor_cache);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Decodes the fields of a script_n_of_k from a CBOR reader.
+ *
+ * This function reads the CBOR encoded script_n_of_k at the current position of the reader and creates a new
+ * \ref cardano_script_n_of_k_t object from its fields. It does not cache the original CBOR representation, that is done
+ * by \ref cardano_script_n_of_k_from_cbor.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t positioned at the script_n_of_k.
+ * \param[out] script_n_of_k On success, set to the newly created \ref cardano_script_n_of_k_t object.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_n_of_k was decoded, or an appropriate error code otherwise.
+ */
+static cardano_error_t
+cardano_script_n_of_k_decode(cardano_cbor_reader_t* reader, cardano_script_n_of_k_t** script_n_of_k)
+{
+  static const char* validator_name = "script_n_of_k";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, 3);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_N_OF_K,
+    (enum_to_string_callback_t)((void*)&cardano_native_script_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  uint64_t        required             = 0;
+  cardano_error_t read_required_result = cardano_cbor_reader_read_uint(reader, &required);
+
+  if (read_required_result != CARDANO_SUCCESS)
+  {
+    return read_required_result;
+  }
+
+  if ((uint64_t)(size_t)required != required)
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  cardano_native_script_list_t* native_scripts          = NULL;
+  const cardano_error_t         read_script_list_result = cardano_native_script_list_from_cbor(reader, &native_scripts);
+
+  if (read_script_list_result != CARDANO_SUCCESS)
+  {
+    return read_script_list_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_native_script_list_unref(&native_scripts);
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t create_n_of_k_new_result = cardano_script_n_of_k_new(native_scripts, (size_t)required, script_n_of_k);
+  cardano_native_script_list_unref(&native_scripts);
+
+  return create_n_of_k_new_result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_script_n_of_k_new(cardano_native_script_list_t* native_scripts, const size_t required, cardano_script_n_of_k_t** script_n_of_k)
+{
+  if (native_scripts == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_n_of_k == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_n_of_k_t* data = _cardano_malloc(sizeof(cardano_script_n_of_k_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_native_script_list_ref(native_scripts);
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_script_n_of_k_deallocate;
+  data->cbor_cache         = NULL;
+  data->type               = CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_N_OF_K;
+  data->scripts            = native_scripts;
+  data->required           = required;
+
+  *script_n_of_k = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_n_of_k_from_cbor(cardano_cbor_reader_t* reader, cardano_script_n_of_k_t** script_n_of_k)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_n_of_k == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        result      = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_script_n_of_k_decode(reader, script_n_of_k);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_copy);
+    return result;
+  }
+
+  cardano_buffer_t* cbor_cache = NULL;
+
+  result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if ((result != CARDANO_SUCCESS) || (cbor_cache == NULL))
+  {
+    cardano_script_n_of_k_unref(script_n_of_k);
+
+    return (result != CARDANO_SUCCESS) ? result : CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*script_n_of_k)->cbor_cache = cbor_cache;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_n_of_k_to_cbor(
+  const cardano_script_n_of_k_t* script_n_of_k,
+  cardano_cbor_writer_t*         writer)
+{
+  if (script_n_of_k == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_n_of_k->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(script_n_of_k->cbor_cache), cardano_buffer_get_size(script_n_of_k->cbor_cache));
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 3);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, script_n_of_k->type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, (uint64_t)script_n_of_k->required);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_native_script_list_to_cbor(script_n_of_k->scripts, writer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_script_n_of_k_to_cip116_json(
+  const cardano_script_n_of_k_t* script_n_of_k,
+  cardano_json_writer_t*         writer)
+{
+  if ((script_n_of_k == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "n_of_k", 6);
+  cardano_json_writer_write_property_name(writer, "scripts", 7);
+
+  cardano_error_t error = cardano_native_script_list_to_cip116_json(script_n_of_k->scripts, writer);
+
+  assert(error == CARDANO_SUCCESS);
+  CARDANO_UNUSED(error);
+
+  cardano_json_writer_write_property_name(writer, "n", 1);
+  cardano_json_writer_write_uint(writer, (uint64_t)script_n_of_k->required);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_n_of_k_from_json(const char* json, size_t json_size, cardano_script_n_of_k_t** native_script)
+{
+  if (json == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_object_t* json_object = cardano_json_object_parse(json, json_size);
+
+  if (json_object == NULL)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_json_object_t* type     = NULL;
+  bool                   has_type = cardano_json_object_get_ex(json_object, "type", 4, &type);
+
+  if (!has_type)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_json_object_t* req = NULL;
+
+  if (!cardano_json_object_get_ex(json_object, "required", 8, &req))
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  const char* type_string = cardano_json_object_get_string(type, NULL);
+
+  if (type_string == NULL)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  uint64_t required = 0U;
+
+  cardano_error_t result = cardano_json_object_get_uint(req, &required);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return result;
+  }
+
+  if ((uint64_t)(size_t)required != required)
+  {
+    cardano_json_object_unref(&json_object);
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  cardano_native_script_list_t* native_scripts = NULL;
+
+  if (strcmp(type_string, "atLeast") == 0)
+  {
+    result = cardano_native_script_list_from_json(json, json_size, &native_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_json_object_unref(&json_object);
+
+      return result;
+    }
+  }
+  else
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_json_object_unref(&json_object);
+
+  const cardano_error_t create_n_of_k_new_result = cardano_script_n_of_k_new(native_scripts, (size_t)required, native_script);
+  cardano_native_script_list_unref(&native_scripts);
+
+  return create_n_of_k_new_result;
+}
+
+size_t
+cardano_script_n_of_k_get_required(const cardano_script_n_of_k_t* script_n_of_k)
+{
+  if (script_n_of_k == NULL)
+  {
+    return 0;
+  }
+
+  return script_n_of_k->required;
+}
+
+cardano_error_t
+cardano_script_n_of_k_set_required(cardano_script_n_of_k_t* script_n_of_k, size_t required)
+{
+  if (script_n_of_k == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  script_n_of_k->required = required;
+  cardano_buffer_unref(&script_n_of_k->cbor_cache);
+  script_n_of_k->cbor_cache = NULL;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_script_n_of_k_get_length(const cardano_script_n_of_k_t* script_n_of_k)
+{
+  if (script_n_of_k == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_native_script_list_get_length(script_n_of_k->scripts);
+}
+
+cardano_error_t
+cardano_script_n_of_k_get_scripts(
+  cardano_script_n_of_k_t*       script_n_of_k,
+  cardano_native_script_list_t** list)
+{
+  if (script_n_of_k == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_list_ref(script_n_of_k->scripts);
+
+  *list = script_n_of_k->scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_n_of_k_set_scripts(
+  cardano_script_n_of_k_t*      script_n_of_k,
+  cardano_native_script_list_t* list)
+{
+  if (script_n_of_k == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_list_ref(list);
+
+  cardano_native_script_list_unref(&script_n_of_k->scripts);
+
+  script_n_of_k->scripts = list;
+  cardano_buffer_unref(&script_n_of_k->cbor_cache);
+  script_n_of_k->cbor_cache = NULL;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_script_n_of_k_equals(const cardano_script_n_of_k_t* lhs, const cardano_script_n_of_k_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if ((lhs->type != rhs->type) || (lhs->required != rhs->required))
+  {
+    return false;
+  }
+
+  assert(lhs->scripts);
+  assert(rhs->scripts);
+
+  return cardano_native_script_list_equals(lhs->scripts, rhs->scripts);
+}
+
+void
+cardano_script_n_of_k_clear_cbor_cache(cardano_script_n_of_k_t* script_n_of_k)
+{
+  if (script_n_of_k == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&script_n_of_k->cbor_cache);
+  script_n_of_k->cbor_cache = NULL;
+  cardano_native_script_list_clear_cbor_cache(script_n_of_k->scripts);
+}
+
+void
+cardano_script_n_of_k_unref(cardano_script_n_of_k_t** script_n_of_k)
+{
+  if ((script_n_of_k == NULL) || (*script_n_of_k == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*script_n_of_k)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *script_n_of_k = NULL;
+    return;
+  }
+}
+
+void
+cardano_script_n_of_k_ref(cardano_script_n_of_k_t* script_n_of_k)
+{
+  if (script_n_of_k == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&script_n_of_k->base);
+}
+
+size_t
+cardano_script_n_of_k_refcount(const cardano_script_n_of_k_t* script_n_of_k)
+{
+  if (script_n_of_k == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&script_n_of_k->base);
+}
+
+void
+cardano_script_n_of_k_set_last_error(cardano_script_n_of_k_t* script_n_of_k, const char* message)
+{
+  cardano_object_set_last_error(&script_n_of_k->base, message);
+}
+
+const char*
+cardano_script_n_of_k_get_last_error(const cardano_script_n_of_k_t* script_n_of_k)
+{
+  return cardano_object_get_last_error(&script_n_of_k->base);
+}
+
+cardano_error_t
+cardano_script_n_of_k_deep_clone(const cardano_script_n_of_k_t* source, cardano_script_n_of_k_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_n_of_k_t* copy = _cardano_malloc(sizeof(cardano_script_n_of_k_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  copy->required           = source->required;
+  copy->scripts            = NULL;
+  copy->cbor_cache         = NULL;
+
+  if (source->scripts != NULL)
+  {
+    const cardano_error_t result = cardano_native_script_list_deep_clone(source->scripts, &copy->scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/native_scripts/script_pubkey.c b/vendor/src/scripts/native_scripts/script_pubkey.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/native_scripts/script_pubkey.c
@@ -0,0 +1,579 @@
+/**
+ * \file script_pubkey.c
+ *
+ * \author angel.castillo
+ * \date   Jun 2, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/scripts/native_scripts/native_script_list.h>
+#include <cardano/scripts/native_scripts/native_script_type.h>
+#include <cardano/scripts/native_scripts/script_pubkey.h>
+
+#include <cardano/object.h>
+
+#include "../../allocators.h"
+#include "../../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <cardano/json/json_object.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This script evaluates to true if the transaction also includes a valid key witness
+ * where the witness verification key hashes to the given hash.
+ *
+ * In other words, this checks that the transaction is signed by a particular key, identified by its verification
+ * key hash.
+ */
+typedef struct cardano_script_pubkey_t
+{
+    cardano_object_t             base;
+    cardano_native_script_type_t type;
+    cardano_blake2b_hash_t*      key_hash;
+    cardano_buffer_t*            cbor_cache;
+
+} cardano_script_pubkey_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a script_pubkey object.
+ *
+ * This function is responsible for properly deallocating a script_pubkey object (`cardano_script_pubkey_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the script_pubkey object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_script_pubkey_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the script_pubkey
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_script_pubkey_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_script_pubkey_t* data = (cardano_script_pubkey_t*)object;
+
+  cardano_blake2b_hash_unref(&data->key_hash);
+
+  cardano_buffer_unref(&data->cbor_cache);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Decodes the fields of a script_pubkey from a CBOR reader.
+ *
+ * This function reads the CBOR encoded script_pubkey at the current position of the reader and creates a new
+ * \ref cardano_script_pubkey_t object from its fields. It does not cache the original CBOR representation, that is done
+ * by \ref cardano_script_pubkey_from_cbor.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t positioned at the script_pubkey.
+ * \param[out] script_pubkey On success, set to the newly created \ref cardano_script_pubkey_t object.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_pubkey was decoded, or an appropriate error code otherwise.
+ */
+static cardano_error_t
+cardano_script_pubkey_decode(cardano_cbor_reader_t* reader, cardano_script_pubkey_t** script_pubkey)
+{
+  static const char* validator_name = "script_pubkey";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, 2);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY,
+    (enum_to_string_callback_t)((void*)&cardano_native_script_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_blake2b_hash_t* key_hash             = NULL;
+  const cardano_error_t   read_key_hash_result = cardano_blake2b_hash_from_cbor(reader, &key_hash);
+
+  if (read_key_hash_result != CARDANO_SUCCESS)
+  {
+    return read_key_hash_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&key_hash);
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t create_pubkey_new_result = cardano_script_pubkey_new(key_hash, script_pubkey);
+  cardano_blake2b_hash_unref(&key_hash);
+
+  return create_pubkey_new_result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_script_pubkey_new(cardano_blake2b_hash_t* key_hash, cardano_script_pubkey_t** script_pubkey)
+{
+  if (key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_pubkey == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_pubkey_t* data = _cardano_malloc(sizeof(cardano_script_pubkey_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_blake2b_hash_ref(key_hash);
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_script_pubkey_deallocate;
+  data->cbor_cache         = NULL;
+  data->type               = CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_PUBKEY;
+  data->key_hash           = key_hash;
+
+  *script_pubkey = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_pubkey_from_cbor(cardano_cbor_reader_t* reader, cardano_script_pubkey_t** script_pubkey)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_pubkey == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        result      = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_script_pubkey_decode(reader, script_pubkey);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_copy);
+    return result;
+  }
+
+  cardano_buffer_t* cbor_cache = NULL;
+
+  result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if ((result != CARDANO_SUCCESS) || (cbor_cache == NULL))
+  {
+    cardano_script_pubkey_unref(script_pubkey);
+
+    return (result != CARDANO_SUCCESS) ? result : CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*script_pubkey)->cbor_cache = cbor_cache;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_pubkey_to_cbor(
+  const cardano_script_pubkey_t* script_pubkey,
+  cardano_cbor_writer_t*         writer)
+{
+  if (script_pubkey == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_pubkey->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(script_pubkey->cbor_cache), cardano_buffer_get_size(script_pubkey->cbor_cache));
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 2);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, script_pubkey->type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_blake2b_hash_to_cbor(script_pubkey->key_hash, writer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_script_pubkey_to_cip116_json(
+  const cardano_script_pubkey_t* script_pubkey,
+  cardano_json_writer_t*         writer)
+{
+  if ((script_pubkey == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "pubkey", 6);
+  cardano_json_writer_write_property_name(writer, "pubkey", 6);
+  cardano_error_t error = cardano_blake2b_hash_to_cip116_json(script_pubkey->key_hash, writer);
+
+  assert(error == CARDANO_SUCCESS);
+  CARDANO_UNUSED(error);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_pubkey_from_json(const char* json, size_t json_size, cardano_script_pubkey_t** native_script)
+{
+  if (json == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (json_size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_object_t* json_object = cardano_json_object_parse(json, json_size);
+
+  if (json_object == NULL)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  cardano_json_object_t* type     = NULL;
+  bool                   has_type = cardano_json_object_get_ex(json_object, "type", 4, &type);
+
+  if (!has_type)
+  {
+    cardano_json_object_unref(&json_object);
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  const char* type_string = cardano_json_object_get_string(type, NULL);
+
+  if (type_string == NULL)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_json_object_t* hash_object = NULL;
+
+  if (!cardano_json_object_get_ex(json_object, "keyHash", 7, &hash_object))
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  size_t      hash_len    = 0U;
+  const char* hash_string = cardano_json_object_get_string(hash_object, &hash_len);
+
+  if (hash_string == NULL)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  if (strcmp(type_string, "sig") != 0)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  result = cardano_blake2b_hash_from_hex(hash_string, hash_len - 1U, &hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return result;
+  }
+
+  cardano_json_object_unref(&json_object);
+
+  const cardano_error_t create_pubkey_new_result = cardano_script_pubkey_new(hash, native_script);
+  cardano_blake2b_hash_unref(&hash);
+
+  return create_pubkey_new_result;
+}
+
+cardano_error_t
+cardano_script_pubkey_get_key_hash(cardano_script_pubkey_t* script_pubkey, cardano_blake2b_hash_t** key_hash)
+{
+  if (script_pubkey == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(script_pubkey->key_hash);
+  *key_hash = script_pubkey->key_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_pubkey_set_key_hash(cardano_script_pubkey_t* script_pubkey, cardano_blake2b_hash_t* key_hash)
+{
+  if (script_pubkey == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_ref(key_hash);
+  cardano_blake2b_hash_unref(&script_pubkey->key_hash);
+  script_pubkey->key_hash = key_hash;
+  cardano_buffer_unref(&script_pubkey->cbor_cache);
+  script_pubkey->cbor_cache = NULL;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_script_pubkey_equals(const cardano_script_pubkey_t* lhs, const cardano_script_pubkey_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return false;
+  }
+
+  if (cardano_blake2b_hash_get_bytes_size(lhs->key_hash) != cardano_blake2b_hash_get_bytes_size(rhs->key_hash))
+  {
+    return false;
+  }
+
+  if (memcmp(cardano_blake2b_hash_get_data(lhs->key_hash), cardano_blake2b_hash_get_data(rhs->key_hash), cardano_blake2b_hash_get_bytes_size(rhs->key_hash)) != 0)
+  {
+    return false;
+  }
+
+  return true;
+}
+
+void
+cardano_script_pubkey_clear_cbor_cache(cardano_script_pubkey_t* script_pubkey)
+{
+  if (script_pubkey == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&script_pubkey->cbor_cache);
+  script_pubkey->cbor_cache = NULL;
+}
+
+void
+cardano_script_pubkey_unref(cardano_script_pubkey_t** script_pubkey)
+{
+  if ((script_pubkey == NULL) || (*script_pubkey == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*script_pubkey)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *script_pubkey = NULL;
+    return;
+  }
+}
+
+void
+cardano_script_pubkey_ref(cardano_script_pubkey_t* script_pubkey)
+{
+  if (script_pubkey == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&script_pubkey->base);
+}
+
+size_t
+cardano_script_pubkey_refcount(const cardano_script_pubkey_t* script_pubkey)
+{
+  if (script_pubkey == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&script_pubkey->base);
+}
+
+void
+cardano_script_pubkey_set_last_error(cardano_script_pubkey_t* script_pubkey, const char* message)
+{
+  cardano_object_set_last_error(&script_pubkey->base, message);
+}
+
+const char*
+cardano_script_pubkey_get_last_error(const cardano_script_pubkey_t* script_pubkey)
+{
+  return cardano_object_get_last_error(&script_pubkey->base);
+}
+
+cardano_error_t
+cardano_script_pubkey_deep_clone(const cardano_script_pubkey_t* source, cardano_script_pubkey_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_pubkey_t* copy = _cardano_malloc(sizeof(cardano_script_pubkey_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  copy->key_hash           = NULL;
+  copy->cbor_cache         = NULL;
+
+  if (source->key_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->key_hash, &copy->key_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/native_scripts/script_require_guard.c b/vendor/src/scripts/native_scripts/script_require_guard.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/native_scripts/script_require_guard.c
@@ -0,0 +1,571 @@
+/**
+ * \file script_require_guard.c
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/scripts/native_scripts/native_script_list.h>
+#include <cardano/scripts/native_scripts/native_script_type.h>
+#include <cardano/scripts/native_scripts/script_require_guard.h>
+
+#include <cardano/object.h>
+
+#include "../../allocators.h"
+#include "../../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <cardano/json/json_object.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief This script evaluates to true if the given credential is present in the
+ * transaction guards.
+ *
+ * In other words, this checks that the transaction was authorized by a particular guard,
+ * identified by its key hash or script hash credential.
+ */
+typedef struct cardano_script_require_guard_t
+{
+    cardano_object_t             base;
+    cardano_native_script_type_t type;
+    cardano_credential_t*        credential;
+    cardano_buffer_t*            cbor_cache;
+
+} cardano_script_require_guard_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a script_require_guard object.
+ *
+ * This function is responsible for properly deallocating a script_require_guard object (`cardano_script_require_guard_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the script_require_guard object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_script_require_guard_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the script_require_guard
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_script_require_guard_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_script_require_guard_t* data = (cardano_script_require_guard_t*)object;
+
+  cardano_credential_unref(&data->credential);
+
+  cardano_buffer_unref(&data->cbor_cache);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Decodes the fields of a script_require_guard from a CBOR reader.
+ *
+ * This function reads the CBOR encoded script_require_guard at the current position of the reader and creates a new
+ * \ref cardano_script_require_guard_t object from its fields. It does not cache the original CBOR representation, that is done
+ * by \ref cardano_script_require_guard_from_cbor.
+ *
+ * \param[in] reader A pointer to an initialized \ref cardano_cbor_reader_t positioned at the script_require_guard.
+ * \param[out] script_require_guard On success, set to the newly created \ref cardano_script_require_guard_t object.
+ *
+ * \return \ref CARDANO_SUCCESS if the script_require_guard was decoded, or an appropriate error code otherwise.
+ */
+static cardano_error_t
+cardano_script_require_guard_decode(cardano_cbor_reader_t* reader, cardano_script_require_guard_t** script_require_guard)
+{
+  static const char* validator_name = "script_require_guard";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, 2);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_enum_value(
+    validator_name,
+    "type",
+    reader,
+    CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD,
+    (enum_to_string_callback_t)((void*)&cardano_native_script_type_to_string),
+    &type);
+
+  CARDANO_UNUSED(type);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_credential_t* credential             = NULL;
+  const cardano_error_t read_credential_result = cardano_credential_from_cbor(reader, &credential);
+
+  if (read_credential_result != CARDANO_SUCCESS)
+  {
+    return read_credential_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t create_require_guard_new_result = cardano_script_require_guard_new(credential, script_require_guard);
+  cardano_credential_unref(&credential);
+
+  return create_require_guard_new_result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_script_require_guard_new(cardano_credential_t* credential, cardano_script_require_guard_t** script_require_guard)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_require_guard == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_require_guard_t* data = _cardano_malloc(sizeof(cardano_script_require_guard_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_credential_ref(credential);
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_script_require_guard_deallocate;
+  data->cbor_cache         = NULL;
+  data->type               = CARDANO_NATIVE_SCRIPT_TYPE_REQUIRE_GUARD;
+  data->credential         = credential;
+
+  *script_require_guard = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_require_guard_from_cbor(cardano_cbor_reader_t* reader, cardano_script_require_guard_t** script_require_guard)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_require_guard == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        result      = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_script_require_guard_decode(reader, script_require_guard);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_copy);
+    return result;
+  }
+
+  cardano_buffer_t* cbor_cache = NULL;
+
+  result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if ((result != CARDANO_SUCCESS) || (cbor_cache == NULL))
+  {
+    cardano_script_require_guard_unref(script_require_guard);
+
+    return (result != CARDANO_SUCCESS) ? result : CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*script_require_guard)->cbor_cache = cbor_cache;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_require_guard_to_cbor(
+  const cardano_script_require_guard_t* script_require_guard,
+  cardano_cbor_writer_t*                writer)
+{
+  if (script_require_guard == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_require_guard->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(script_require_guard->cbor_cache), cardano_buffer_get_size(script_require_guard->cbor_cache));
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 2);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, script_require_guard->type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_credential_to_cbor(script_require_guard->credential, writer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_script_require_guard_to_cip116_json(
+  const cardano_script_require_guard_t* script_require_guard,
+  cardano_json_writer_t*                writer)
+{
+  if ((script_require_guard == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+  cardano_json_writer_write_string(writer, "require_guard", 13);
+  cardano_json_writer_write_property_name(writer, "credential", 10);
+  cardano_error_t error = cardano_credential_to_cip116_json(script_require_guard->credential, writer);
+
+  assert(error == CARDANO_SUCCESS);
+  CARDANO_UNUSED(error);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_require_guard_from_json(const char* json, size_t json_size, cardano_script_require_guard_t** native_script)
+{
+  if (json == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (json_size == 0U)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_object_t* json_object = cardano_json_object_parse(json, json_size);
+
+  if (json_object == NULL)
+  {
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_json_object_t* type     = NULL;
+  bool                   has_type = cardano_json_object_get_ex(json_object, "type", 4, &type);
+
+  if (!has_type)
+  {
+    cardano_json_object_unref(&json_object);
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  const char* type_string = cardano_json_object_get_string(type, NULL);
+
+  if (type_string == NULL)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  if (strcmp(type_string, "guard") != 0)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_NATIVE_SCRIPT_TYPE;
+  }
+
+  cardano_credential_type_t credential_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+  cardano_json_object_t*    hash_object     = NULL;
+
+  if (!cardano_json_object_get_ex(json_object, "keyHash", 7, &hash_object))
+  {
+    if (!cardano_json_object_get_ex(json_object, "scriptHash", 10, &hash_object))
+    {
+      cardano_json_object_unref(&json_object);
+
+      return CARDANO_ERROR_INVALID_JSON;
+    }
+
+    credential_type = CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH;
+  }
+
+  size_t      hash_len    = 0U;
+  const char* hash_string = cardano_json_object_get_string(hash_object, &hash_len);
+
+  if (hash_string == NULL)
+  {
+    cardano_json_object_unref(&json_object);
+
+    return CARDANO_ERROR_INVALID_JSON;
+  }
+
+  cardano_credential_t* credential = NULL;
+
+  cardano_error_t result = cardano_credential_from_hash_hex(hash_string, hash_len - 1U, credential_type, &credential);
+
+  cardano_json_object_unref(&json_object);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const cardano_error_t create_require_guard_new_result = cardano_script_require_guard_new(credential, native_script);
+  cardano_credential_unref(&credential);
+
+  return create_require_guard_new_result;
+}
+
+cardano_error_t
+cardano_script_require_guard_get_credential(cardano_script_require_guard_t* script_require_guard, cardano_credential_t** credential)
+{
+  if (script_require_guard == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(script_require_guard->credential);
+  *credential = script_require_guard->credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_require_guard_set_credential(cardano_script_require_guard_t* script_require_guard, cardano_credential_t* credential)
+{
+  if (script_require_guard == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&script_require_guard->credential);
+  script_require_guard->credential = credential;
+  cardano_buffer_unref(&script_require_guard->cbor_cache);
+  script_require_guard->cbor_cache = NULL;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_script_require_guard_equals(const cardano_script_require_guard_t* lhs, const cardano_script_require_guard_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return false;
+  }
+
+  return cardano_credential_equals(lhs->credential, rhs->credential);
+}
+
+void
+cardano_script_require_guard_clear_cbor_cache(cardano_script_require_guard_t* script_require_guard)
+{
+  if (script_require_guard == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&script_require_guard->cbor_cache);
+  script_require_guard->cbor_cache = NULL;
+}
+
+void
+cardano_script_require_guard_unref(cardano_script_require_guard_t** script_require_guard)
+{
+  if ((script_require_guard == NULL) || (*script_require_guard == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*script_require_guard)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *script_require_guard = NULL;
+    return;
+  }
+}
+
+void
+cardano_script_require_guard_ref(cardano_script_require_guard_t* script_require_guard)
+{
+  if (script_require_guard == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&script_require_guard->base);
+}
+
+size_t
+cardano_script_require_guard_refcount(const cardano_script_require_guard_t* script_require_guard)
+{
+  if (script_require_guard == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&script_require_guard->base);
+}
+
+void
+cardano_script_require_guard_set_last_error(cardano_script_require_guard_t* script_require_guard, const char* message)
+{
+  cardano_object_set_last_error(&script_require_guard->base, message);
+}
+
+const char*
+cardano_script_require_guard_get_last_error(const cardano_script_require_guard_t* script_require_guard)
+{
+  return cardano_object_get_last_error(&script_require_guard->base);
+}
+
+cardano_error_t
+cardano_script_require_guard_deep_clone(const cardano_script_require_guard_t* source, cardano_script_require_guard_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_require_guard_t* copy = _cardano_malloc(sizeof(cardano_script_require_guard_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  copy->credential         = NULL;
+  copy->cbor_cache         = NULL;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/plutus_scripts/plutus_v1_script.c b/vendor/src/scripts/plutus_scripts/plutus_v1_script.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/plutus_scripts/plutus_v1_script.c
@@ -0,0 +1,469 @@
+/**
+ * \file plutus_v1_script.c
+ *
+ * \author angel.castillo
+ * \date   May 28, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/scripts/plutus_scripts/plutus_v1_script.h>
+
+#include "../../allocators.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Plutus V1 was the initial version of Plutus, introduced in the Alonzo hard fork.
+ */
+typedef struct cardano_plutus_v1_script_t
+{
+    cardano_object_t  base;
+    cardano_buffer_t* compiled_code;
+} cardano_plutus_v1_script_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus v1 script object.
+ *
+ * This function is responsible for properly deallocating a plutus v1 script object (`cardano_plutus_v1_script_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus v1 script object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v1_script_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_v1_script
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v1_script_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v1_script_t* data = (cardano_plutus_v1_script_t*)object;
+
+  cardano_buffer_unref(&data->compiled_code);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new plutus_v1_script object.
+ *
+ * \return A pointer to the newly created plutus_v1_script object, or `NULL` if the operation failed.
+ */
+static cardano_plutus_v1_script_t*
+cardano_plutus_v1_script_new(void)
+{
+  cardano_plutus_v1_script_t* data = _cardano_malloc(sizeof(cardano_plutus_v1_script_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_plutus_v1_script_deallocate;
+  data->compiled_code      = cardano_buffer_new(128);
+
+  if (data->compiled_code == NULL)
+  {
+    _cardano_free(data);
+    return NULL;
+  }
+
+  return data;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v1_script_new_bytes(
+  const byte_t*                bytes,
+  size_t                       size,
+  cardano_plutus_v1_script_t** plutus_v1_script)
+{
+  if (bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (plutus_v1_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v1_script_t* data = cardano_plutus_v1_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t error = cardano_buffer_write(data->compiled_code, bytes, size);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v1_script_unref(&data);
+    return error;
+  }
+
+  *plutus_v1_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_new_bytes_from_hex(
+  const char*                  hex,
+  size_t                       size,
+  cardano_plutus_v1_script_t** plutus_v1_script)
+{
+  if (hex == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (plutus_v1_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v1_script_t* data = cardano_plutus_v1_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = cardano_buffer_from_hex(hex, size);
+
+  if (buffer == NULL)
+  {
+    cardano_plutus_v1_script_unref(&data);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t error = cardano_buffer_write(data->compiled_code, cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer));
+
+  cardano_buffer_unref(&buffer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v1_script_unref(&data);
+    return error;
+  }
+
+  *plutus_v1_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v1_script_t** plutus_v1_script)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v1_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* compiled_code = NULL;
+  cardano_error_t   result        = cardano_cbor_reader_read_bytestring(reader, &compiled_code);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&compiled_code);
+    return result;
+  }
+
+  result = cardano_plutus_v1_script_new_bytes(
+    cardano_buffer_get_data(compiled_code),
+    cardano_buffer_get_size(compiled_code),
+    plutus_v1_script);
+
+  cardano_buffer_unref(&compiled_code);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_to_cbor(
+  const cardano_plutus_v1_script_t* plutus_v1_script,
+  cardano_cbor_writer_t*            writer)
+{
+  if (plutus_v1_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_buffer_get_data(plutus_v1_script->compiled_code),
+    cardano_buffer_get_size(plutus_v1_script->compiled_code));
+}
+
+cardano_error_t
+cardano_plutus_v1_script_to_cip116_json(
+  const cardano_plutus_v1_script_t* plutus_v1_script,
+  cardano_json_writer_t*            writer)
+{
+  if ((plutus_v1_script == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "language", 8);
+  cardano_json_writer_write_string(writer, "plutus_v1", 9);
+
+  cardano_json_writer_write_property_name(writer, "bytes", 5);
+
+  const size_t hex_size = cardano_buffer_get_hex_size(plutus_v1_script->compiled_code);
+  char*        hex      = (char*)_cardano_malloc(hex_size);
+
+  if (hex == NULL)
+  {
+    cardano_json_writer_write_end_object(writer);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t to_hex_result =
+    cardano_buffer_to_hex(plutus_v1_script->compiled_code, hex, hex_size);
+
+  assert(to_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(to_hex_result);
+
+  cardano_json_writer_write_string(writer, hex, hex_size - 1U);
+
+  _cardano_free(hex);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_to_raw_bytes(
+  cardano_plutus_v1_script_t* plutus_v1_script,
+  cardano_buffer_t**          compiled_script)
+{
+  if (plutus_v1_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (compiled_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_ref(plutus_v1_script->compiled_code);
+
+  *compiled_script = plutus_v1_script->compiled_code;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_plutus_v1_script_get_hash(const cardano_plutus_v1_script_t* plutus_v1_script)
+{
+  if (plutus_v1_script == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  // To compute a script hash, note that you must prepend a tag to the bytes of
+  // the script before hashing. The tags in the Babbage era for PlutusV1 is "\x01"
+  static const byte_t plutus_v1_prefix = 0x01;
+
+  cardano_buffer_t* hash_input = cardano_buffer_new((size_t)CARDANO_BLAKE2B_HASH_SIZE_224 + 1U);
+
+  if (hash_input == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_error_t error = cardano_buffer_write(hash_input, &plutus_v1_prefix, 1);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&hash_input);
+    return NULL;
+  }
+
+  error = cardano_buffer_write(hash_input, cardano_buffer_get_data(plutus_v1_script->compiled_code), cardano_buffer_get_size(plutus_v1_script->compiled_code));
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&hash_input);
+    return NULL;
+  }
+
+  error = cardano_blake2b_compute_hash(
+    cardano_buffer_get_data(hash_input),
+    cardano_buffer_get_size(hash_input),
+    CARDANO_BLAKE2B_HASH_SIZE_224,
+    &hash);
+
+  cardano_buffer_unref(&hash_input);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return hash;
+}
+
+bool
+cardano_plutus_v1_script_equals(const cardano_plutus_v1_script_t* lhs, const cardano_plutus_v1_script_t* rhs)
+{
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  return cardano_buffer_equals(lhs->compiled_code, rhs->compiled_code);
+}
+
+void
+cardano_plutus_v1_script_unref(cardano_plutus_v1_script_t** plutus_v1_script)
+{
+  if ((plutus_v1_script == NULL) || (*plutus_v1_script == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v1_script)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v1_script = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v1_script_ref(cardano_plutus_v1_script_t* plutus_v1_script)
+{
+  if (plutus_v1_script == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v1_script->base);
+}
+
+size_t
+cardano_plutus_v1_script_refcount(const cardano_plutus_v1_script_t* plutus_v1_script)
+{
+  if (plutus_v1_script == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v1_script->base);
+}
+
+void
+cardano_plutus_v1_script_set_last_error(cardano_plutus_v1_script_t* plutus_v1_script, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v1_script->base, message);
+}
+
+const char*
+cardano_plutus_v1_script_get_last_error(const cardano_plutus_v1_script_t* plutus_v1_script)
+{
+  return cardano_object_get_last_error(&plutus_v1_script->base);
+}
+
+cardano_error_t
+cardano_plutus_v1_script_deep_clone(const cardano_plutus_v1_script_t* source, cardano_plutus_v1_script_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v1_script_t* copy = _cardano_malloc(sizeof(cardano_plutus_v1_script_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->compiled_code      = NULL;
+
+  if (source->compiled_code != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->compiled_code, &copy->compiled_code);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/plutus_scripts/plutus_v2_script.c b/vendor/src/scripts/plutus_scripts/plutus_v2_script.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/plutus_scripts/plutus_v2_script.c
@@ -0,0 +1,469 @@
+/**
+ * \file plutus_v2_script.c
+ *
+ * \author angel.castillo
+ * \date   May 28, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/scripts/plutus_scripts/plutus_v2_script.h>
+
+#include "../../allocators.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Plutus v2 was the initial version of Plutus, introduced in the Alonzo hard fork.
+ */
+typedef struct cardano_plutus_v2_script_t
+{
+    cardano_object_t  base;
+    cardano_buffer_t* compiled_code;
+} cardano_plutus_v2_script_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus v2 script object.
+ *
+ * This function is responsible for properly deallocating a plutus v2 script object (`cardano_plutus_v2_script_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus v2 script object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v2_script_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_v2_script
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v2_script_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v2_script_t* data = (cardano_plutus_v2_script_t*)object;
+
+  cardano_buffer_unref(&data->compiled_code);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new plutus_v2_script object.
+ *
+ * \return A pointer to the newly created plutus_v2_script object, or `NULL` if the operation failed.
+ */
+static cardano_plutus_v2_script_t*
+cardano_plutus_v2_script_new(void)
+{
+  cardano_plutus_v2_script_t* data = _cardano_malloc(sizeof(cardano_plutus_v2_script_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_plutus_v2_script_deallocate;
+  data->compiled_code      = cardano_buffer_new(128);
+
+  if (data->compiled_code == NULL)
+  {
+    _cardano_free(data);
+    return NULL;
+  }
+
+  return data;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v2_script_new_bytes(
+  const byte_t*                bytes,
+  size_t                       size,
+  cardano_plutus_v2_script_t** plutus_v2_script)
+{
+  if (bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (plutus_v2_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v2_script_t* data = cardano_plutus_v2_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t error = cardano_buffer_write(data->compiled_code, bytes, size);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v2_script_unref(&data);
+    return error;
+  }
+
+  *plutus_v2_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_new_bytes_from_hex(
+  const char*                  hex,
+  size_t                       size,
+  cardano_plutus_v2_script_t** plutus_v2_script)
+{
+  if (hex == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (plutus_v2_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v2_script_t* data = cardano_plutus_v2_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = cardano_buffer_from_hex(hex, size);
+
+  if (buffer == NULL)
+  {
+    cardano_plutus_v2_script_unref(&data);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t error = cardano_buffer_write(data->compiled_code, cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer));
+
+  cardano_buffer_unref(&buffer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v2_script_unref(&data);
+    return error;
+  }
+
+  *plutus_v2_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v2_script_t** plutus_v2_script)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v2_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* compiled_code = NULL;
+  cardano_error_t   result        = cardano_cbor_reader_read_bytestring(reader, &compiled_code);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&compiled_code);
+    return result;
+  }
+
+  result = cardano_plutus_v2_script_new_bytes(
+    cardano_buffer_get_data(compiled_code),
+    cardano_buffer_get_size(compiled_code),
+    plutus_v2_script);
+
+  cardano_buffer_unref(&compiled_code);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_to_cbor(
+  const cardano_plutus_v2_script_t* plutus_v2_script,
+  cardano_cbor_writer_t*            writer)
+{
+  if (plutus_v2_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_buffer_get_data(plutus_v2_script->compiled_code),
+    cardano_buffer_get_size(plutus_v2_script->compiled_code));
+}
+
+cardano_error_t
+cardano_plutus_v2_script_to_cip116_json(
+  const cardano_plutus_v2_script_t* plutus_v2_script,
+  cardano_json_writer_t*            writer)
+{
+  if ((plutus_v2_script == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "language", 8);
+  cardano_json_writer_write_string(writer, "plutus_v2", 9);
+
+  cardano_json_writer_write_property_name(writer, "bytes", 5);
+
+  const size_t hex_size = cardano_buffer_get_hex_size(plutus_v2_script->compiled_code);
+  char*        hex      = (char*)_cardano_malloc(hex_size);
+
+  if (hex == NULL)
+  {
+    cardano_json_writer_write_end_object(writer);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t to_hex_result =
+    cardano_buffer_to_hex(plutus_v2_script->compiled_code, hex, hex_size);
+
+  assert(to_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(to_hex_result);
+
+  cardano_json_writer_write_string(writer, hex, hex_size - 1U);
+
+  _cardano_free(hex);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_to_raw_bytes(
+  cardano_plutus_v2_script_t* plutus_v2_script,
+  cardano_buffer_t**          compiled_script)
+{
+  if (plutus_v2_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (compiled_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_ref(plutus_v2_script->compiled_code);
+
+  *compiled_script = plutus_v2_script->compiled_code;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_plutus_v2_script_get_hash(const cardano_plutus_v2_script_t* plutus_v2_script)
+{
+  if (plutus_v2_script == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  // To compute a script hash, note that you must prepend a tag to the bytes of
+  // the script before hashing. The tags in the Babbage era for PlutusV2 is "\x02"
+  static const byte_t plutus_v2_prefix = 0x02;
+
+  cardano_buffer_t* hash_input = cardano_buffer_new((size_t)CARDANO_BLAKE2B_HASH_SIZE_224 + 1U);
+
+  if (hash_input == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_error_t error = cardano_buffer_write(hash_input, &plutus_v2_prefix, 1);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&hash_input);
+    return NULL;
+  }
+
+  error = cardano_buffer_write(hash_input, cardano_buffer_get_data(plutus_v2_script->compiled_code), cardano_buffer_get_size(plutus_v2_script->compiled_code));
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&hash_input);
+    return NULL;
+  }
+
+  error = cardano_blake2b_compute_hash(
+    cardano_buffer_get_data(hash_input),
+    cardano_buffer_get_size(hash_input),
+    CARDANO_BLAKE2B_HASH_SIZE_224,
+    &hash);
+
+  cardano_buffer_unref(&hash_input);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return hash;
+}
+
+bool
+cardano_plutus_v2_script_equals(const cardano_plutus_v2_script_t* lhs, const cardano_plutus_v2_script_t* rhs)
+{
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  return cardano_buffer_equals(lhs->compiled_code, rhs->compiled_code);
+}
+
+void
+cardano_plutus_v2_script_unref(cardano_plutus_v2_script_t** plutus_v2_script)
+{
+  if ((plutus_v2_script == NULL) || (*plutus_v2_script == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v2_script)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v2_script = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v2_script_ref(cardano_plutus_v2_script_t* plutus_v2_script)
+{
+  if (plutus_v2_script == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v2_script->base);
+}
+
+size_t
+cardano_plutus_v2_script_refcount(const cardano_plutus_v2_script_t* plutus_v2_script)
+{
+  if (plutus_v2_script == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v2_script->base);
+}
+
+void
+cardano_plutus_v2_script_set_last_error(cardano_plutus_v2_script_t* plutus_v2_script, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v2_script->base, message);
+}
+
+const char*
+cardano_plutus_v2_script_get_last_error(const cardano_plutus_v2_script_t* plutus_v2_script)
+{
+  return cardano_object_get_last_error(&plutus_v2_script->base);
+}
+
+cardano_error_t
+cardano_plutus_v2_script_deep_clone(const cardano_plutus_v2_script_t* source, cardano_plutus_v2_script_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v2_script_t* copy = _cardano_malloc(sizeof(cardano_plutus_v2_script_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->compiled_code      = NULL;
+
+  if (source->compiled_code != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->compiled_code, &copy->compiled_code);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/plutus_scripts/plutus_v3_script.c b/vendor/src/scripts/plutus_scripts/plutus_v3_script.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/plutus_scripts/plutus_v3_script.c
@@ -0,0 +1,469 @@
+/**
+ * \file plutus_v3_script.c
+ *
+ * \author angel.castillo
+ * \date   May 28, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/scripts/plutus_scripts/plutus_v3_script.h>
+
+#include "../../allocators.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Plutus v3 was the initial version of Plutus, introduced in the Alonzo hard fork.
+ */
+typedef struct cardano_plutus_v3_script_t
+{
+    cardano_object_t  base;
+    cardano_buffer_t* compiled_code;
+} cardano_plutus_v3_script_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus v3 script object.
+ *
+ * This function is responsible for properly deallocating a plutus v3 script object (`cardano_plutus_v3_script_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus v3 script object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v3_script_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_v3_script
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v3_script_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v3_script_t* data = (cardano_plutus_v3_script_t*)object;
+
+  cardano_buffer_unref(&data->compiled_code);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new plutus_v3_script object.
+ *
+ * \return A pointer to the newly created plutus_v3_script object, or `NULL` if the operation failed.
+ */
+static cardano_plutus_v3_script_t*
+cardano_plutus_v3_script_new(void)
+{
+  cardano_plutus_v3_script_t* data = _cardano_malloc(sizeof(cardano_plutus_v3_script_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_plutus_v3_script_deallocate;
+  data->compiled_code      = cardano_buffer_new(128);
+
+  if (data->compiled_code == NULL)
+  {
+    _cardano_free(data);
+    return NULL;
+  }
+
+  return data;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v3_script_new_bytes(
+  const byte_t*                bytes,
+  size_t                       size,
+  cardano_plutus_v3_script_t** plutus_v3_script)
+{
+  if (bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (plutus_v3_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v3_script_t* data = cardano_plutus_v3_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t error = cardano_buffer_write(data->compiled_code, bytes, size);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v3_script_unref(&data);
+    return error;
+  }
+
+  *plutus_v3_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_new_bytes_from_hex(
+  const char*                  hex,
+  size_t                       size,
+  cardano_plutus_v3_script_t** plutus_v3_script)
+{
+  if (hex == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (plutus_v3_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v3_script_t* data = cardano_plutus_v3_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = cardano_buffer_from_hex(hex, size);
+
+  if (buffer == NULL)
+  {
+    cardano_plutus_v3_script_unref(&data);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t error = cardano_buffer_write(data->compiled_code, cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer));
+
+  cardano_buffer_unref(&buffer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v3_script_unref(&data);
+    return error;
+  }
+
+  *plutus_v3_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v3_script_t** plutus_v3_script)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v3_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* compiled_code = NULL;
+  cardano_error_t   result        = cardano_cbor_reader_read_bytestring(reader, &compiled_code);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&compiled_code);
+    return result;
+  }
+
+  result = cardano_plutus_v3_script_new_bytes(
+    cardano_buffer_get_data(compiled_code),
+    cardano_buffer_get_size(compiled_code),
+    plutus_v3_script);
+
+  cardano_buffer_unref(&compiled_code);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_to_cbor(
+  const cardano_plutus_v3_script_t* plutus_v3_script,
+  cardano_cbor_writer_t*            writer)
+{
+  if (plutus_v3_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_buffer_get_data(plutus_v3_script->compiled_code),
+    cardano_buffer_get_size(plutus_v3_script->compiled_code));
+}
+
+cardano_error_t
+cardano_plutus_v3_script_to_cip116_json(
+  const cardano_plutus_v3_script_t* plutus_v3_script,
+  cardano_json_writer_t*            writer)
+{
+  if ((plutus_v3_script == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "language", 8);
+  cardano_json_writer_write_string(writer, "plutus_v3", 9);
+
+  cardano_json_writer_write_property_name(writer, "bytes", 5);
+
+  const size_t hex_size = cardano_buffer_get_hex_size(plutus_v3_script->compiled_code);
+  char*        hex      = (char*)_cardano_malloc(hex_size);
+
+  if (hex == NULL)
+  {
+    cardano_json_writer_write_end_object(writer);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t to_hex_result =
+    cardano_buffer_to_hex(plutus_v3_script->compiled_code, hex, hex_size);
+
+  assert(to_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(to_hex_result);
+
+  cardano_json_writer_write_string(writer, hex, hex_size - 1U);
+
+  _cardano_free(hex);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_to_raw_bytes(
+  cardano_plutus_v3_script_t* plutus_v3_script,
+  cardano_buffer_t**          compiled_script)
+{
+  if (plutus_v3_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (compiled_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_ref(plutus_v3_script->compiled_code);
+
+  *compiled_script = plutus_v3_script->compiled_code;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_plutus_v3_script_get_hash(const cardano_plutus_v3_script_t* plutus_v3_script)
+{
+  if (plutus_v3_script == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  // To compute a script hash, note that you must prepend a tag to the bytes of
+  // the script before hashing. The tags in the Babbage era for PlutusV3 is "\x03"
+  static const byte_t plutus_v3_prefix = 0x03;
+
+  cardano_buffer_t* hash_input = cardano_buffer_new((size_t)CARDANO_BLAKE2B_HASH_SIZE_224 + 1U);
+
+  if (hash_input == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_error_t error = cardano_buffer_write(hash_input, &plutus_v3_prefix, 1);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&hash_input);
+    return NULL;
+  }
+
+  error = cardano_buffer_write(hash_input, cardano_buffer_get_data(plutus_v3_script->compiled_code), cardano_buffer_get_size(plutus_v3_script->compiled_code));
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&hash_input);
+    return NULL;
+  }
+
+  error = cardano_blake2b_compute_hash(
+    cardano_buffer_get_data(hash_input),
+    cardano_buffer_get_size(hash_input),
+    CARDANO_BLAKE2B_HASH_SIZE_224,
+    &hash);
+
+  cardano_buffer_unref(&hash_input);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return hash;
+}
+
+bool
+cardano_plutus_v3_script_equals(const cardano_plutus_v3_script_t* lhs, const cardano_plutus_v3_script_t* rhs)
+{
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  return cardano_buffer_equals(lhs->compiled_code, rhs->compiled_code);
+}
+
+void
+cardano_plutus_v3_script_unref(cardano_plutus_v3_script_t** plutus_v3_script)
+{
+  if ((plutus_v3_script == NULL) || (*plutus_v3_script == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v3_script)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v3_script = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v3_script_ref(cardano_plutus_v3_script_t* plutus_v3_script)
+{
+  if (plutus_v3_script == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v3_script->base);
+}
+
+size_t
+cardano_plutus_v3_script_refcount(const cardano_plutus_v3_script_t* plutus_v3_script)
+{
+  if (plutus_v3_script == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v3_script->base);
+}
+
+void
+cardano_plutus_v3_script_set_last_error(cardano_plutus_v3_script_t* plutus_v3_script, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v3_script->base, message);
+}
+
+const char*
+cardano_plutus_v3_script_get_last_error(const cardano_plutus_v3_script_t* plutus_v3_script)
+{
+  return cardano_object_get_last_error(&plutus_v3_script->base);
+}
+
+cardano_error_t
+cardano_plutus_v3_script_deep_clone(const cardano_plutus_v3_script_t* source, cardano_plutus_v3_script_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v3_script_t* copy = _cardano_malloc(sizeof(cardano_plutus_v3_script_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->compiled_code      = NULL;
+
+  if (source->compiled_code != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->compiled_code, &copy->compiled_code);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/plutus_scripts/plutus_v4_script.c b/vendor/src/scripts/plutus_scripts/plutus_v4_script.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/plutus_scripts/plutus_v4_script.c
@@ -0,0 +1,470 @@
+/**
+ * \file plutus_v4_script.c
+ *
+ * \author angel.castillo
+ * \date   Jul 17, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/scripts/plutus_scripts/plutus_v4_script.h>
+
+#include "../../allocators.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Plutus v4 scripts were introduced in the Dijkstra hard fork. They run from protocol
+ * version 12.
+ */
+typedef struct cardano_plutus_v4_script_t
+{
+    cardano_object_t  base;
+    cardano_buffer_t* compiled_code;
+} cardano_plutus_v4_script_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus v4 script object.
+ *
+ * This function is responsible for properly deallocating a plutus v4 script object (`cardano_plutus_v4_script_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus v4 script object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v4_script_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_v4_script
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v4_script_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v4_script_t* data = (cardano_plutus_v4_script_t*)object;
+
+  cardano_buffer_unref(&data->compiled_code);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new plutus_v4_script object.
+ *
+ * \return A pointer to the newly created plutus_v4_script object, or `NULL` if the operation failed.
+ */
+static cardano_plutus_v4_script_t*
+cardano_plutus_v4_script_new(void)
+{
+  cardano_plutus_v4_script_t* data = _cardano_malloc(sizeof(cardano_plutus_v4_script_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_plutus_v4_script_deallocate;
+  data->compiled_code      = cardano_buffer_new(128);
+
+  if (data->compiled_code == NULL)
+  {
+    _cardano_free(data);
+    return NULL;
+  }
+
+  return data;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v4_script_new_bytes(
+  const byte_t*                bytes,
+  size_t                       size,
+  cardano_plutus_v4_script_t** plutus_v4_script)
+{
+  if (bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (plutus_v4_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v4_script_t* data = cardano_plutus_v4_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t error = cardano_buffer_write(data->compiled_code, bytes, size);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v4_script_unref(&data);
+    return error;
+  }
+
+  *plutus_v4_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_new_bytes_from_hex(
+  const char*                  hex,
+  size_t                       size,
+  cardano_plutus_v4_script_t** plutus_v4_script)
+{
+  if (hex == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_INSUFFICIENT_BUFFER_SIZE;
+  }
+
+  if (plutus_v4_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v4_script_t* data = cardano_plutus_v4_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = cardano_buffer_from_hex(hex, size);
+
+  if (buffer == NULL)
+  {
+    cardano_plutus_v4_script_unref(&data);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t error = cardano_buffer_write(data->compiled_code, cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer));
+
+  cardano_buffer_unref(&buffer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v4_script_unref(&data);
+    return error;
+  }
+
+  *plutus_v4_script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v4_script_t** plutus_v4_script)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v4_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t* compiled_code = NULL;
+  cardano_error_t   result        = cardano_cbor_reader_read_bytestring(reader, &compiled_code);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&compiled_code);
+    return result;
+  }
+
+  result = cardano_plutus_v4_script_new_bytes(
+    cardano_buffer_get_data(compiled_code),
+    cardano_buffer_get_size(compiled_code),
+    plutus_v4_script);
+
+  cardano_buffer_unref(&compiled_code);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_to_cbor(
+  const cardano_plutus_v4_script_t* plutus_v4_script,
+  cardano_cbor_writer_t*            writer)
+{
+  if (plutus_v4_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_buffer_get_data(plutus_v4_script->compiled_code),
+    cardano_buffer_get_size(plutus_v4_script->compiled_code));
+}
+
+cardano_error_t
+cardano_plutus_v4_script_to_cip116_json(
+  const cardano_plutus_v4_script_t* plutus_v4_script,
+  cardano_json_writer_t*            writer)
+{
+  if ((plutus_v4_script == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "language", 8);
+  cardano_json_writer_write_string(writer, "plutus_v4", 9);
+
+  cardano_json_writer_write_property_name(writer, "bytes", 5);
+
+  const size_t hex_size = cardano_buffer_get_hex_size(plutus_v4_script->compiled_code);
+  char*        hex      = (char*)_cardano_malloc(hex_size);
+
+  if (hex == NULL)
+  {
+    cardano_json_writer_write_end_object(writer);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t to_hex_result =
+    cardano_buffer_to_hex(plutus_v4_script->compiled_code, hex, hex_size);
+
+  assert(to_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(to_hex_result);
+
+  cardano_json_writer_write_string(writer, hex, hex_size - 1U);
+
+  _cardano_free(hex);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_to_raw_bytes(
+  cardano_plutus_v4_script_t* plutus_v4_script,
+  cardano_buffer_t**          compiled_script)
+{
+  if (plutus_v4_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (compiled_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_ref(plutus_v4_script->compiled_code);
+
+  *compiled_script = plutus_v4_script->compiled_code;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_plutus_v4_script_get_hash(const cardano_plutus_v4_script_t* plutus_v4_script)
+{
+  if (plutus_v4_script == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  // To compute a script hash, note that you must prepend a tag to the bytes of
+  // the script before hashing. The tag in the Dijkstra era for PlutusV4 is "\x04"
+  static const byte_t plutus_v4_prefix = 0x04;
+
+  cardano_buffer_t* hash_input = cardano_buffer_new((size_t)CARDANO_BLAKE2B_HASH_SIZE_224 + 1U);
+
+  if (hash_input == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_error_t error = cardano_buffer_write(hash_input, &plutus_v4_prefix, 1);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&hash_input);
+    return NULL;
+  }
+
+  error = cardano_buffer_write(hash_input, cardano_buffer_get_data(plutus_v4_script->compiled_code), cardano_buffer_get_size(plutus_v4_script->compiled_code));
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&hash_input);
+    return NULL;
+  }
+
+  error = cardano_blake2b_compute_hash(
+    cardano_buffer_get_data(hash_input),
+    cardano_buffer_get_size(hash_input),
+    CARDANO_BLAKE2B_HASH_SIZE_224,
+    &hash);
+
+  cardano_buffer_unref(&hash_input);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return hash;
+}
+
+bool
+cardano_plutus_v4_script_equals(const cardano_plutus_v4_script_t* lhs, const cardano_plutus_v4_script_t* rhs)
+{
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  return cardano_buffer_equals(lhs->compiled_code, rhs->compiled_code);
+}
+
+void
+cardano_plutus_v4_script_unref(cardano_plutus_v4_script_t** plutus_v4_script)
+{
+  if ((plutus_v4_script == NULL) || (*plutus_v4_script == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v4_script)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v4_script = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v4_script_ref(cardano_plutus_v4_script_t* plutus_v4_script)
+{
+  if (plutus_v4_script == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v4_script->base);
+}
+
+size_t
+cardano_plutus_v4_script_refcount(const cardano_plutus_v4_script_t* plutus_v4_script)
+{
+  if (plutus_v4_script == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v4_script->base);
+}
+
+void
+cardano_plutus_v4_script_set_last_error(cardano_plutus_v4_script_t* plutus_v4_script, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v4_script->base, message);
+}
+
+const char*
+cardano_plutus_v4_script_get_last_error(const cardano_plutus_v4_script_t* plutus_v4_script)
+{
+  return cardano_object_get_last_error(&plutus_v4_script->base);
+}
+
+cardano_error_t
+cardano_plutus_v4_script_deep_clone(const cardano_plutus_v4_script_t* source, cardano_plutus_v4_script_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v4_script_t* copy = _cardano_malloc(sizeof(cardano_plutus_v4_script_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->compiled_code      = NULL;
+
+  if (source->compiled_code != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->compiled_code, &copy->compiled_code);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/scripts/script.c b/vendor/src/scripts/script.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/scripts/script.c
@@ -0,0 +1,904 @@
+/**
+ * \file script.c
+ *
+ * \author angel.castillo
+ * \date   May 28, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/scripts/native_scripts/native_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v1_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v2_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v3_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v4_script.h>
+#include <cardano/scripts/script.h>
+#include <cardano/scripts/script_language.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Program that decides whether the transaction that spends the output is authorized to do so.
+ */
+typedef struct cardano_script_t
+{
+    cardano_object_t            base;
+    cardano_script_language_t   language;
+    cardano_native_script_t*    native_script;
+    cardano_plutus_v1_script_t* plutus_v1_script;
+    cardano_plutus_v2_script_t* plutus_v2_script;
+    cardano_plutus_v3_script_t* plutus_v3_script;
+    cardano_plutus_v4_script_t* plutus_v4_script;
+} cardano_script_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a script object.
+ *
+ * This function is responsible for properly deallocating a script object (`cardano_script_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the script object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_script_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the script
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_script_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_script_t* data = (cardano_script_t*)object;
+
+  cardano_native_script_unref(&data->native_script);
+  cardano_plutus_v1_script_unref(&data->plutus_v1_script);
+  cardano_plutus_v2_script_unref(&data->plutus_v2_script);
+  cardano_plutus_v3_script_unref(&data->plutus_v3_script);
+  cardano_plutus_v4_script_unref(&data->plutus_v4_script);
+
+  _cardano_free(data);
+}
+
+/**
+ * \brief Creates a new script object.
+ *
+ * \return A pointer to the newly created script object, or `NULL` if the operation failed.
+ */
+static cardano_script_t*
+cardano_script_new(void)
+{
+  cardano_script_t* data = _cardano_malloc(sizeof(cardano_script_t));
+
+  if (data == NULL)
+  {
+    return NULL;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_script_deallocate;
+
+  data->native_script    = NULL;
+  data->plutus_v1_script = NULL;
+  data->plutus_v2_script = NULL;
+  data->plutus_v3_script = NULL;
+  data->plutus_v4_script = NULL;
+  data->language         = CARDANO_SCRIPT_LANGUAGE_NATIVE;
+
+  return data;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_script_new_native(
+  cardano_native_script_t* native_script,
+  cardano_script_t**       script)
+{
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_t* data = cardano_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_native_script_ref(native_script);
+
+  data->native_script = native_script;
+  data->language      = CARDANO_SCRIPT_LANGUAGE_NATIVE;
+
+  *script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_new_plutus_v1(
+  cardano_plutus_v1_script_t* plutus_v1_script,
+  cardano_script_t**          script)
+{
+  if (plutus_v1_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_t* data = cardano_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_plutus_v1_script_ref(plutus_v1_script);
+
+  data->plutus_v1_script = plutus_v1_script;
+  data->language         = CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1;
+
+  *script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_new_plutus_v2(
+  cardano_plutus_v2_script_t* plutus_v2_script,
+  cardano_script_t**          script)
+{
+  if (plutus_v2_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_t* data = cardano_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_plutus_v2_script_ref(plutus_v2_script);
+
+  data->plutus_v2_script = plutus_v2_script;
+  data->language         = CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2;
+
+  *script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_new_plutus_v3(
+  cardano_plutus_v3_script_t* plutus_v3_script,
+  cardano_script_t**          script)
+{
+  if (plutus_v3_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_t* data = cardano_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_plutus_v3_script_ref(plutus_v3_script);
+
+  data->plutus_v3_script = plutus_v3_script;
+  data->language         = CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3;
+
+  *script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_new_plutus_v4(
+  cardano_plutus_v4_script_t* plutus_v4_script,
+  cardano_script_t**          script)
+{
+  if (plutus_v4_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_t* data = cardano_script_new();
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_plutus_v4_script_ref(plutus_v4_script);
+
+  data->plutus_v4_script = plutus_v4_script;
+  data->language         = CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4;
+
+  *script = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_from_cbor(cardano_cbor_reader_t* reader, cardano_script_t** script)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "script";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              language         = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "language",
+    reader,
+    &language,
+    CARDANO_SCRIPT_LANGUAGE_NATIVE,
+    CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+  switch (language)
+  {
+    case CARDANO_SCRIPT_LANGUAGE_NATIVE:
+    {
+      cardano_native_script_t* native_script = NULL;
+      result                                 = cardano_native_script_from_cbor(reader, &native_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_script_new_native(native_script, script);
+      cardano_native_script_unref(&native_script);
+
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1:
+    {
+      cardano_plutus_v1_script_t* plutus_v1_script = NULL;
+      result                                       = cardano_plutus_v1_script_from_cbor(reader, &plutus_v1_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_script_new_plutus_v1(plutus_v1_script, script);
+      cardano_plutus_v1_script_unref(&plutus_v1_script);
+
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2:
+    {
+      cardano_plutus_v2_script_t* plutus_v2_script = NULL;
+      result                                       = cardano_plutus_v2_script_from_cbor(reader, &plutus_v2_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_script_new_plutus_v2(plutus_v2_script, script);
+      cardano_plutus_v2_script_unref(&plutus_v2_script);
+
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3:
+    {
+      cardano_plutus_v3_script_t* plutus_v3_script = NULL;
+      result                                       = cardano_plutus_v3_script_from_cbor(reader, &plutus_v3_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_script_new_plutus_v3(plutus_v3_script, script);
+      cardano_plutus_v3_script_unref(&plutus_v3_script);
+
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4:
+    {
+      cardano_plutus_v4_script_t* plutus_v4_script = NULL;
+      result                                       = cardano_plutus_v4_script_from_cbor(reader, &plutus_v4_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_script_new_plutus_v4(plutus_v4_script, script);
+      cardano_plutus_v4_script_unref(&plutus_v4_script);
+
+      break;
+    }
+
+    default:
+      result = CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+      break;
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_script_to_cbor(
+  const cardano_script_t* script,
+  cardano_cbor_writer_t*  writer)
+{
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_writer_write_uint(writer, script->language);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (script->language)
+  {
+    case CARDANO_SCRIPT_LANGUAGE_NATIVE:
+      result = cardano_native_script_to_cbor(script->native_script, writer);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1:
+      result = cardano_plutus_v1_script_to_cbor(script->plutus_v1_script, writer);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2:
+      result = cardano_plutus_v2_script_to_cbor(script->plutus_v2_script, writer);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3:
+      result = cardano_plutus_v3_script_to_cbor(script->plutus_v3_script, writer);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4:
+      result = cardano_plutus_v4_script_to_cbor(script->plutus_v4_script, writer);
+      break;
+
+    default:
+      result = CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+      break;
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_script_to_cip116_json(
+  const cardano_script_t* script,
+  cardano_json_writer_t*  writer)
+{
+  if ((script == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+
+  switch (script->language)
+  {
+    case CARDANO_SCRIPT_LANGUAGE_NATIVE:
+      cardano_json_writer_write_string(writer, "native_script", 13);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1:
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2:
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3:
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4:
+      cardano_json_writer_write_string(writer, "plutus_script", 13);
+      break;
+    default:
+      cardano_json_writer_write_end_object(writer);
+      return CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+  }
+
+  cardano_json_writer_write_property_name(writer, "value", 5);
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (script->language)
+  {
+    case CARDANO_SCRIPT_LANGUAGE_NATIVE:
+      result = cardano_native_script_to_cip116_json(script->native_script, writer);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1:
+      result = cardano_plutus_v1_script_to_cip116_json(script->plutus_v1_script, writer);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2:
+      result = cardano_plutus_v2_script_to_cip116_json(script->plutus_v2_script, writer);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3:
+      result = cardano_plutus_v3_script_to_cip116_json(script->plutus_v3_script, writer);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4:
+      result = cardano_plutus_v4_script_to_cip116_json(script->plutus_v4_script, writer);
+      break;
+    default:
+      result = CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+      break;
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_get_language(
+  const cardano_script_t*    script,
+  cardano_script_language_t* language)
+{
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (language == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *language = script->language;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_to_native(
+  cardano_script_t*         script,
+  cardano_native_script_t** native_script)
+{
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script->language != CARDANO_SCRIPT_LANGUAGE_NATIVE)
+  {
+    return CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+  }
+
+  cardano_native_script_ref(script->native_script);
+
+  *native_script = script->native_script;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_to_plutus_v1(
+  cardano_script_t*            script,
+  cardano_plutus_v1_script_t** plutus_v1)
+{
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v1 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script->language != CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1)
+  {
+    return CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+  }
+
+  cardano_plutus_v1_script_ref(script->plutus_v1_script);
+
+  *plutus_v1 = script->plutus_v1_script;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_to_plutus_v2(
+  cardano_script_t*            script,
+  cardano_plutus_v2_script_t** plutus_v2)
+{
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v2 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script->language != CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2)
+  {
+    return CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+  }
+
+  cardano_plutus_v2_script_ref(script->plutus_v2_script);
+
+  *plutus_v2 = script->plutus_v2_script;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_to_plutus_v3(
+  cardano_script_t*            script,
+  cardano_plutus_v3_script_t** plutus_v3)
+{
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v3 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script->language != CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3)
+  {
+    return CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+  }
+
+  cardano_plutus_v3_script_ref(script->plutus_v3_script);
+
+  *plutus_v3 = script->plutus_v3_script;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_script_to_plutus_v4(
+  cardano_script_t*            script,
+  cardano_plutus_v4_script_t** plutus_v4)
+{
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v4 == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script->language != CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4)
+  {
+    return CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+  }
+
+  cardano_plutus_v4_script_ref(script->plutus_v4_script);
+
+  *plutus_v4 = script->plutus_v4_script;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_script_get_hash(const cardano_script_t* script)
+{
+  if (script == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  switch (script->language)
+  {
+    case CARDANO_SCRIPT_LANGUAGE_NATIVE:
+      hash = cardano_native_script_get_hash(script->native_script);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1:
+      hash = cardano_plutus_v1_script_get_hash(script->plutus_v1_script);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2:
+      hash = cardano_plutus_v2_script_get_hash(script->plutus_v2_script);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3:
+      hash = cardano_plutus_v3_script_get_hash(script->plutus_v3_script);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4:
+      hash = cardano_plutus_v4_script_get_hash(script->plutus_v4_script);
+      break;
+
+    default:
+      break;
+  }
+
+  return hash;
+}
+
+bool
+cardano_script_equals(const cardano_script_t* lhs, const cardano_script_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->language != rhs->language)
+  {
+    return false;
+  }
+
+  bool result = false;
+  switch (lhs->language)
+  {
+    case CARDANO_SCRIPT_LANGUAGE_NATIVE:
+      result = cardano_native_script_equals(lhs->native_script, rhs->native_script);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1:
+      result = cardano_plutus_v1_script_equals(lhs->plutus_v1_script, rhs->plutus_v1_script);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2:
+      result = cardano_plutus_v2_script_equals(lhs->plutus_v2_script, rhs->plutus_v2_script);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3:
+      result = cardano_plutus_v3_script_equals(lhs->plutus_v3_script, rhs->plutus_v3_script);
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4:
+      result = cardano_plutus_v4_script_equals(lhs->plutus_v4_script, rhs->plutus_v4_script);
+      break;
+
+    default:
+      return false;
+  }
+
+  return result;
+}
+
+void
+cardano_script_unref(cardano_script_t** script)
+{
+  if ((script == NULL) || (*script == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*script)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *script = NULL;
+    return;
+  }
+}
+
+void
+cardano_script_ref(cardano_script_t* script)
+{
+  if (script == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&script->base);
+}
+
+size_t
+cardano_script_refcount(const cardano_script_t* script)
+{
+  if (script == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&script->base);
+}
+
+void
+cardano_script_set_last_error(cardano_script_t* script, const char* message)
+{
+  cardano_object_set_last_error(&script->base, message);
+}
+
+const char*
+cardano_script_get_last_error(const cardano_script_t* script)
+{
+  return cardano_object_get_last_error(&script->base);
+}
+
+cardano_error_t
+cardano_script_deep_clone(const cardano_script_t* source, cardano_script_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_t* copy = _cardano_malloc(sizeof(cardano_script_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->language           = source->language;
+  copy->native_script      = NULL;
+  copy->plutus_v1_script   = NULL;
+  copy->plutus_v2_script   = NULL;
+  copy->plutus_v3_script   = NULL;
+  copy->plutus_v4_script   = NULL;
+
+  if (source->native_script != NULL)
+  {
+    const cardano_error_t result = cardano_native_script_deep_clone(source->native_script, &copy->native_script);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v1_script != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v1_script_deep_clone(source->plutus_v1_script, &copy->plutus_v1_script);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v2_script != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v2_script_deep_clone(source->plutus_v2_script, &copy->plutus_v2_script);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v3_script != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v3_script_deep_clone(source->plutus_v3_script, &copy->plutus_v3_script);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v4_script != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v4_script_deep_clone(source->plutus_v4_script, &copy->plutus_v4_script);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/string_safe.c b/vendor/src/string_safe.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/string_safe.c
@@ -0,0 +1,251 @@
+/**
+ * \file string_safe.c
+ *
+ * \author luisd.bianchi
+ * \date   Apr 28, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "string_safe.h"
+
+#include <cardano/export.h>
+
+#include <errno.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* DEFINITIONS ***************************************************************/
+
+void
+cardano_safe_memcpy(void* dest, const size_t dest_size, const void* src, const size_t src_size)
+{
+  if ((dest == NULL) || (src == NULL) || (dest_size == 0U) || (src_size == 0U))
+  {
+    return;
+  }
+
+  size_t copy_size = (src_size < dest_size) ? src_size : dest_size;
+
+  CARDANO_UNUSED(memcpy(dest, src, copy_size)); // nosemgrep
+}
+
+size_t
+cardano_safe_strlen(const char* str, const size_t max_length)
+{
+  if (str == NULL)
+  {
+    return 0U;
+  }
+
+  size_t index = 0U;
+
+  while ((index < max_length) && (str[index] != '\0'))
+  {
+    ++index;
+  }
+
+  return index;
+}
+
+size_t
+cardano_safe_int64_to_string(const int64_t value, char* buffer, size_t buffer_size)
+{
+  if ((buffer == NULL) || (buffer_size == 0U))
+  {
+    return 0U;
+  }
+
+  int written = snprintf(buffer, buffer_size, "%lld", (long long)value);
+
+  if ((written < 0) || ((size_t)written >= buffer_size))
+  {
+    return 0U;
+  }
+
+  return (size_t)written;
+}
+
+cardano_error_t
+cardano_safe_string_to_int64(const char* str, size_t string_size, int64_t* value)
+{
+  if ((str == NULL) || (value == NULL) || (string_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (string_size >= 32U)
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  char temp[32] = { 0 };
+  cardano_safe_memcpy(temp, 32, str, string_size);
+  temp[string_size] = '\0';
+
+  char* endptr = NULL;
+  errno        = 0;
+
+  int64_t result = strtoll(temp, &endptr, 10);
+
+  if (errno == ERANGE)
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  if (endptr == temp)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (*endptr != '\0')
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *value = result;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_safe_uint64_to_string(const uint64_t value, char* buffer, size_t buffer_size)
+{
+  if ((buffer == NULL) || (buffer_size == 0U))
+  {
+    return 0U;
+  }
+
+  int written = snprintf(buffer, buffer_size, "%llu", (unsigned long long)value);
+
+  if ((written < 0) || ((size_t)written >= buffer_size))
+  {
+    return 0U;
+  }
+
+  return (size_t)written;
+}
+
+cardano_error_t
+cardano_safe_string_to_uint64(const char* str, const size_t string_size, uint64_t* value)
+{
+  if ((str == NULL) || (value == NULL) || (string_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (string_size >= 32U)
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  char temp[32] = { 0 };
+  cardano_safe_memcpy(temp, 32, str, string_size);
+  temp[string_size] = '\0';
+
+  char* endptr = NULL;
+  errno        = 0;
+
+  unsigned long long result = strtoull(temp, &endptr, 10);
+
+  // cppcheck-suppress misra-c2012-22.10; Reason: False positive, strtoull sets errno.
+  if ((errno == ERANGE) || (result > UINT64_MAX))
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  if (endptr == temp)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (*endptr != '\0')
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *value = (uint64_t)result;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_safe_double_to_string(double value, char* buffer, const size_t buffer_size)
+{
+  if ((buffer == NULL) || (buffer_size == 0U))
+  {
+    return 0U;
+  }
+
+  if (isnan(value) || isinf(value))
+  {
+    return 0U;
+  }
+
+  int written = snprintf(buffer, buffer_size, "%.17g", value);
+
+  if ((written < 0) || ((size_t)written >= buffer_size))
+  {
+    return 0U;
+  }
+
+  return (size_t)written;
+}
+
+cardano_error_t
+cardano_safe_string_to_double(const char* str, const size_t string_size, double* value)
+{
+  if ((str == NULL) || (value == NULL) || (string_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (string_size >= 128U)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  char temp[128] = { 0 };
+  cardano_safe_memcpy(temp, 128, str, string_size);
+  temp[string_size] = '\0';
+
+  char* endptr = NULL;
+  errno        = 0;
+
+  double result = strtod(temp, &endptr);
+
+  if (errno == ERANGE)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (endptr == temp)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (*endptr != '\0')
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *value = result;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/string_safe.h b/vendor/src/string_safe.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/string_safe.h
@@ -0,0 +1,130 @@
+/**
+ * \file string_safe.h
+ *
+ * \author luisd.bianchi
+ * \date   Apr 28, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_STRING_SAFE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_STRING_SAFE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Safe version of memcpy that copies up to buffer size into the destination buffer.
+ *
+ * \param dest Destination buffer.
+ * \param dest_size Size of the destination buffer.
+ * \param src Source buffer.
+ * \param src_size Number of bytes to copy.
+ */
+void
+cardano_safe_memcpy(void* dest, size_t dest_size, const void* src, size_t src_size);
+
+/**
+ * \brief Safe version of strlen that limits the maximum number of characters to inspect.
+ *
+ * \param str The string to measure.
+ * \param max_length Maximum number of characters to inspect.
+ *
+ * \return Length of the string or \c max_length if the string exceeds max_length.
+ */
+size_t
+cardano_safe_strlen(const char* str, size_t max_length);
+
+/**
+ * \brief Safely converts a 64-bit integer to a string.
+ *
+ * \param[in] value The 64-bit integer value to convert.
+ * \param[out] buffer The buffer to store the resulting string.
+ * \param[in] buffer_size The size of the buffer.
+ *
+ * \return The number of characters written to the buffer.
+ */
+size_t
+cardano_safe_int64_to_string(int64_t value, char* buffer, size_t buffer_size);
+
+/**
+ * \brief Safely converts a string to a 64-bit integer.
+ *
+ * \param[in] str The string to convert.
+ * \param[in] string_size The size of the string.
+ * \param[out] value The resulting 64-bit integer value.
+ *
+ * \return A \ref cardano_error_t indicating the outcome of the operation.
+ */
+cardano_error_t cardano_safe_string_to_int64(const char* str, size_t string_size, int64_t* value);
+
+/**
+ * \brief Safely converts an unsigned 64-bit integer to a string.
+ *
+ * \param[in] value The unsigned 64-bit integer value to convert.
+ * \param[out] buffer The buffer to store the resulting string.
+ * \param[in] buffer_size The size of the buffer.
+ *
+ * \return The number of characters written to the buffer.
+ */
+size_t
+cardano_safe_uint64_to_string(uint64_t value, char* buffer, size_t buffer_size);
+
+/**
+ * \brief Safely converts a string to a unsigned 64-bit integer.
+ *
+ * \param[in] str The string to convert.
+ * \param[in] string_size The size of the string.
+ * \param[out] value The resulting 64 64-bit integer value.
+ *
+ * \return A \ref cardano_error_t indicating the outcome of the operation.
+ */
+cardano_error_t cardano_safe_string_to_uint64(const char* str, size_t string_size, uint64_t* value);
+
+/**
+ * \brief Converts a double to a string.
+ *
+ * \param[in] value The double value to convert.
+ * \param[out] buffer The buffer to store the string representation.
+ * \param[in] buffer_size The size of the output buffer.
+ * \return The number of characters written (excluding null terminator), or 0 on failure.
+ */
+size_t
+cardano_safe_double_to_string(double value, char* buffer, size_t buffer_size);
+
+/**
+ * \brief Converts a string to a double value.
+ *
+ * \param[in] str The input string to convert.
+ * \param[in] string_size The size of the input string.
+ * \param[out] value The resulting double value.
+ * \return A cardano_error_t indicating success or failure.
+ */
+cardano_error_t
+cardano_safe_string_to_double(const char* str, size_t string_size, double* value);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_STRING_SAFE_H
diff --git a/vendor/src/time.c b/vendor/src/time.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/time.c
@@ -0,0 +1,116 @@
+/**
+ * \file time.c
+ *
+ * \author angel.castillo
+ * \date   Nov 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/slot_config.h>
+#include <cardano/time.h>
+
+/* CONSTANTS *****************************************************************/
+
+const cardano_slot_config_t        CARDANO_MAINNET_SLOT_CONFIG = { 1596059091000, 4492800, 1000 };
+const cardano_slot_config_t        CARDANO_PREVIEW_SLOT_CONFIG = { 1666656000000, 0, 1000 };
+const cardano_slot_config_t        CARDANO_PREPROD_SLOT_CONFIG = { 1654041600000 + 1728000000, 86400, 1000 };
+static const cardano_slot_config_t CARDANO_TESTNET_SLOT_CONFIG = { 0, 0, 0 };
+
+/* DEFINITIONS ***************************************************************/
+
+uint64_t
+slot_to_begin_unix_time(const uint64_t slot, const cardano_slot_config_t* config)
+{
+  if (config == NULL)
+  {
+    return 0U;
+  }
+
+  const uint64_t ms_after_begin = (slot - config->zero_slot) * config->slot_length;
+
+  return config->zero_time + ms_after_begin;
+}
+
+uint64_t
+unix_time_to_enclosing_slot(const uint64_t unix_time, const cardano_slot_config_t* config)
+{
+  if (config == NULL)
+  {
+    return 0U;
+  }
+
+  if (config->slot_length == 0U)
+  {
+    return UINT64_MAX;
+  }
+
+  const uint64_t time_passed  = unix_time - config->zero_time;
+  const uint64_t slots_passed = time_passed / config->slot_length;
+
+  return slots_passed + config->zero_slot;
+}
+
+uint64_t
+cardano_compute_slot_from_unix_time(const cardano_network_magic_t magic, const uint64_t unix_time)
+{
+  cardano_slot_config_t config = { 0U };
+
+  switch (magic)
+  {
+    case CARDANO_NETWORK_MAGIC_MAINNET:
+      config = CARDANO_MAINNET_SLOT_CONFIG;
+      break;
+    case CARDANO_NETWORK_MAGIC_PREVIEW:
+      config = CARDANO_PREVIEW_SLOT_CONFIG;
+      break;
+    case CARDANO_NETWORK_MAGIC_PREPROD:
+      config = CARDANO_PREPROD_SLOT_CONFIG;
+      break;
+    default:
+    {
+      config = CARDANO_TESTNET_SLOT_CONFIG;
+    }
+  }
+
+  return unix_time_to_enclosing_slot(unix_time * 1000U, &config);
+}
+
+uint64_t
+cardano_compute_unix_time_from_slot(const cardano_network_magic_t magic, const uint64_t slot)
+{
+  cardano_slot_config_t config = { 0U };
+
+  switch (magic)
+  {
+    case CARDANO_NETWORK_MAGIC_MAINNET:
+      config = CARDANO_MAINNET_SLOT_CONFIG;
+      break;
+    case CARDANO_NETWORK_MAGIC_PREVIEW:
+      config = CARDANO_PREVIEW_SLOT_CONFIG;
+      break;
+    case CARDANO_NETWORK_MAGIC_PREPROD:
+      config = CARDANO_PREPROD_SLOT_CONFIG;
+      break;
+    default:
+    {
+      config = CARDANO_TESTNET_SLOT_CONFIG;
+    }
+  }
+
+  return slot_to_begin_unix_time(slot, &config) / 1000U;
+}
diff --git a/vendor/src/transaction/sub_transaction.c b/vendor/src/transaction/sub_transaction.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction/sub_transaction.c
@@ -0,0 +1,667 @@
+/**
+ * \file sub_transaction.c
+ *
+ * \author angel.castillo
+ * \date   Jul 17, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/transaction/sub_transaction.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const uint32_t SUB_TRANSACTION_FRAME_SIZE = 3U;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano sub transaction.
+ */
+typedef struct cardano_sub_transaction_t
+{
+    cardano_object_t                base;
+    cardano_sub_transaction_body_t* body;
+    cardano_witness_set_t*          witness_set;
+    cardano_auxiliary_data_t*       auxiliary_data;
+    cardano_blake2b_hash_t*         id;
+} cardano_sub_transaction_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a sub transaction object.
+ *
+ * This function is responsible for properly deallocating a sub transaction object (`cardano_sub_transaction_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the sub transaction object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_sub_transaction_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the sub transaction
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_sub_transaction_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_sub_transaction_t* sub_transaction = (cardano_sub_transaction_t*)object;
+
+  cardano_sub_transaction_body_unref(&sub_transaction->body);
+  cardano_witness_set_unref(&sub_transaction->witness_set);
+  cardano_auxiliary_data_unref(&sub_transaction->auxiliary_data);
+  cardano_blake2b_hash_unref(&sub_transaction->id);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_sub_transaction_new(
+  cardano_sub_transaction_body_t* body,
+  cardano_witness_set_t*          witness_set,
+  cardano_auxiliary_data_t*       auxiliary_data,
+  cardano_sub_transaction_t**     sub_transaction)
+{
+  if (body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (sub_transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *sub_transaction = _cardano_malloc(sizeof(cardano_sub_transaction_t));
+
+  if (*sub_transaction == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*sub_transaction)->base.deallocator   = cardano_sub_transaction_deallocate;
+  (*sub_transaction)->base.ref_count     = 1;
+  (*sub_transaction)->base.last_error[0] = '\0';
+  (*sub_transaction)->body               = body;
+  (*sub_transaction)->witness_set        = witness_set;
+  (*sub_transaction)->auxiliary_data     = auxiliary_data;
+  (*sub_transaction)->id                 = NULL;
+
+  cardano_sub_transaction_body_ref(body);
+  cardano_witness_set_ref(witness_set);
+  cardano_auxiliary_data_ref(auxiliary_data);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_sub_transaction_from_cbor(cardano_cbor_reader_t* reader, cardano_sub_transaction_t** sub_transaction)
+{
+  if (sub_transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *sub_transaction = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "sub_transaction";
+
+  cardano_error_t result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, SUB_TRANSACTION_FRAME_SIZE);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *sub_transaction = NULL;
+    return result;
+  }
+
+  cardano_sub_transaction_body_t* body           = NULL;
+  cardano_witness_set_t*          witness_set    = NULL;
+  cardano_auxiliary_data_t*       auxiliary_data = NULL;
+
+  cardano_error_t body_result = cardano_sub_transaction_body_from_cbor(reader, &body);
+
+  if (body_result != CARDANO_SUCCESS)
+  {
+    *sub_transaction = NULL;
+    return body_result;
+  }
+
+  cardano_error_t witness_set_result = cardano_witness_set_from_cbor(reader, &witness_set);
+
+  if (witness_set_result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_body_unref(&body);
+    *sub_transaction = NULL;
+
+    return witness_set_result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t state_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (state_result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_body_unref(&body);
+    cardano_witness_set_unref(&witness_set);
+    *sub_transaction = NULL;
+
+    return state_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null_result = cardano_cbor_reader_read_null(reader);
+
+    if (read_null_result != CARDANO_SUCCESS)
+    {
+      cardano_sub_transaction_body_unref(&body);
+      cardano_witness_set_unref(&witness_set);
+      *sub_transaction = NULL;
+
+      return read_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t auxiliary_data_result = cardano_auxiliary_data_from_cbor(reader, &auxiliary_data);
+
+    if (auxiliary_data_result != CARDANO_SUCCESS)
+    {
+      cardano_sub_transaction_body_unref(&body);
+      cardano_witness_set_unref(&witness_set);
+      *sub_transaction = NULL;
+
+      return auxiliary_data_result;
+    }
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    *sub_transaction = NULL;
+
+    cardano_sub_transaction_body_unref(&body);
+    cardano_witness_set_unref(&witness_set);
+    cardano_auxiliary_data_unref(&auxiliary_data);
+
+    return expect_end_array_result;
+  }
+
+  cardano_error_t create_instance_result = cardano_sub_transaction_new(body, witness_set, auxiliary_data, sub_transaction);
+
+  cardano_sub_transaction_body_unref(&body);
+  cardano_witness_set_unref(&witness_set);
+  cardano_auxiliary_data_unref(&auxiliary_data);
+
+  if (create_instance_result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_unref(sub_transaction);
+    return create_instance_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_sub_transaction_to_cbor(const cardano_sub_transaction_t* sub_transaction, cardano_cbor_writer_t* writer)
+{
+  if (sub_transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    (int64_t)SUB_TRANSACTION_FRAME_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t body_result = cardano_sub_transaction_body_to_cbor(sub_transaction->body, writer);
+
+  if (body_result != CARDANO_SUCCESS)
+  {
+    return body_result;
+  }
+
+  cardano_error_t witness_set_result = cardano_witness_set_to_cbor(sub_transaction->witness_set, writer);
+
+  if (witness_set_result != CARDANO_SUCCESS)
+  {
+    return witness_set_result;
+  }
+
+  if (sub_transaction->auxiliary_data == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t auxiliary_data_result = cardano_auxiliary_data_to_cbor(sub_transaction->auxiliary_data, writer);
+
+    if (auxiliary_data_result != CARDANO_SUCCESS)
+    {
+      return auxiliary_data_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_sub_transaction_body_t*
+cardano_sub_transaction_get_body(cardano_sub_transaction_t* sub_transaction)
+{
+  if (sub_transaction == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_sub_transaction_body_ref(sub_transaction->body);
+
+  return sub_transaction->body;
+}
+
+cardano_error_t
+cardano_sub_transaction_set_body(cardano_sub_transaction_t* sub_transaction, cardano_sub_transaction_body_t* body)
+{
+  if (sub_transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_sub_transaction_body_unref(&sub_transaction->body);
+
+  sub_transaction->body = body;
+
+  cardano_sub_transaction_body_ref(body);
+
+  cardano_blake2b_hash_unref(&sub_transaction->id);
+  sub_transaction->id = NULL;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_witness_set_t*
+cardano_sub_transaction_get_witness_set(cardano_sub_transaction_t* sub_transaction)
+{
+  if (sub_transaction == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_witness_set_ref(sub_transaction->witness_set);
+
+  return sub_transaction->witness_set;
+}
+
+cardano_error_t
+cardano_sub_transaction_set_witness_set(cardano_sub_transaction_t* sub_transaction, cardano_witness_set_t* witness_set)
+{
+  if (sub_transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_witness_set_unref(&sub_transaction->witness_set);
+
+  sub_transaction->witness_set = witness_set;
+
+  cardano_witness_set_ref(witness_set);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_auxiliary_data_t*
+cardano_sub_transaction_get_auxiliary_data(cardano_sub_transaction_t* sub_transaction)
+{
+  if (sub_transaction == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_auxiliary_data_ref(sub_transaction->auxiliary_data);
+
+  return sub_transaction->auxiliary_data;
+}
+
+cardano_error_t
+cardano_sub_transaction_set_auxiliary_data(cardano_sub_transaction_t* sub_transaction, cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (sub_transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_auxiliary_data_unref(&sub_transaction->auxiliary_data);
+
+  sub_transaction->auxiliary_data = auxiliary_data;
+
+  cardano_auxiliary_data_ref(auxiliary_data);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_sub_transaction_get_id(cardano_sub_transaction_t* sub_transaction)
+{
+  if (sub_transaction == NULL)
+  {
+    return NULL;
+  }
+
+  if (sub_transaction->id == NULL)
+  {
+    sub_transaction->id = cardano_sub_transaction_body_get_hash(sub_transaction->body);
+
+    if (sub_transaction->id == NULL)
+    {
+      return NULL;
+    }
+  }
+
+  cardano_blake2b_hash_ref(sub_transaction->id);
+
+  return sub_transaction->id;
+}
+
+void
+cardano_sub_transaction_clear_cbor_cache(cardano_sub_transaction_t* sub_transaction)
+{
+  if (sub_transaction == NULL)
+  {
+    return;
+  }
+
+  cardano_sub_transaction_body_clear_cbor_cache(sub_transaction->body);
+  cardano_witness_set_clear_cbor_cache(sub_transaction->witness_set);
+  cardano_auxiliary_data_clear_cbor_cache(sub_transaction->auxiliary_data);
+
+  cardano_blake2b_hash_unref(&sub_transaction->id);
+  sub_transaction->id = NULL;
+}
+
+cardano_error_t
+cardano_sub_transaction_apply_vkey_witnesses(
+  cardano_sub_transaction_t*  sub_transaction,
+  cardano_vkey_witness_set_t* new_vkeys)
+{
+  if (sub_transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (new_vkeys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_witness_set_t* witness_set = cardano_sub_transaction_get_witness_set(sub_transaction);
+
+  cardano_witness_set_unref(&witness_set);
+
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_vkey_witness_set_t* inner_vkeys = cardano_witness_set_get_vkeys(witness_set);
+
+  if (inner_vkeys == NULL)
+  {
+    cardano_error_t result = cardano_vkey_witness_set_new(&inner_vkeys);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_witness_set_set_vkeys(witness_set, inner_vkeys);
+    cardano_vkey_witness_set_unref(&inner_vkeys);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+  else
+  {
+    cardano_vkey_witness_set_unref(&inner_vkeys);
+  }
+
+  return cardano_vkey_witness_set_apply(inner_vkeys, new_vkeys);
+}
+
+cardano_error_t
+cardano_sub_transaction_to_cip116_json(
+  const cardano_sub_transaction_t* tx,
+  cardano_json_writer_t*           writer)
+{
+  if ((tx == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_property_name(writer, "body", 4);
+  error = cardano_sub_transaction_body_to_cip116_json(tx->body, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "witness_set", 11);
+  error = cardano_witness_set_to_cip116_json(tx->witness_set, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (tx->auxiliary_data != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "auxiliary_data", 14);
+
+    error = cardano_auxiliary_data_to_cip116_json(tx->auxiliary_data, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return error;
+}
+
+void
+cardano_sub_transaction_unref(cardano_sub_transaction_t** sub_transaction)
+{
+  if ((sub_transaction == NULL) || (*sub_transaction == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*sub_transaction)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *sub_transaction = NULL;
+    return;
+  }
+}
+
+void
+cardano_sub_transaction_ref(cardano_sub_transaction_t* sub_transaction)
+{
+  if (sub_transaction == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&sub_transaction->base);
+}
+
+size_t
+cardano_sub_transaction_refcount(const cardano_sub_transaction_t* sub_transaction)
+{
+  if (sub_transaction == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&sub_transaction->base);
+}
+
+void
+cardano_sub_transaction_set_last_error(cardano_sub_transaction_t* sub_transaction, const char* message)
+{
+  cardano_object_set_last_error(&sub_transaction->base, message);
+}
+
+const char*
+cardano_sub_transaction_get_last_error(const cardano_sub_transaction_t* sub_transaction)
+{
+  return cardano_object_get_last_error(&sub_transaction->base);
+}
+
+cardano_error_t
+cardano_sub_transaction_deep_clone(const cardano_sub_transaction_t* source, cardano_sub_transaction_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_sub_transaction_t* copy = _cardano_malloc(sizeof(cardano_sub_transaction_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->body               = NULL;
+  copy->witness_set        = NULL;
+  copy->auxiliary_data     = NULL;
+  copy->id                 = NULL;
+
+  if (source->body != NULL)
+  {
+    const cardano_error_t result = cardano_sub_transaction_body_deep_clone(source->body, &copy->body);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->witness_set != NULL)
+  {
+    const cardano_error_t result = cardano_witness_set_deep_clone(source->witness_set, &copy->witness_set);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->auxiliary_data != NULL)
+  {
+    const cardano_error_t result = cardano_auxiliary_data_deep_clone(source->auxiliary_data, &copy->auxiliary_data);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->id != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->id, &copy->id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction/transaction.c b/vendor/src/transaction/transaction.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction/transaction.c
@@ -0,0 +1,1417 @@
+/**
+ * \file transaction.c
+ *
+ * \author angel.castillo
+ * \date   Sep 23, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/certificate_set.h>
+#include <cardano/object.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/voting_procedures/voter_list.h>
+#include <cardano/voting_procedures/voting_procedures.h>
+#include <cardano/witness_set/redeemer.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../common/ledger_order.h"
+#include "../transaction_builder/balancing/internals/unique_signers.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t ALONZO_ERA_FRAME_SIZE = 4;
+
+/* ENUMS *********************************************************************/
+
+/**
+ * \brief The layout of the array that frames a transaction.
+ */
+typedef enum
+{
+  /** \brief [body, witness_set, auxiliary_data / null]. */
+  PRV_TRANSACTION_FRAME_SHELLEY = 0,
+  /** \brief [body, witness_set, is_valid, auxiliary_data / null]. */
+  PRV_TRANSACTION_FRAME_ALONZO = 1,
+  /** \brief [body, witness_set, auxiliary_data / null, is_valid], the layout of a transaction in a block. */
+  PRV_TRANSACTION_FRAME_BLOCK = 2
+} transaction_frame_t;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano protocol version.
+ */
+typedef struct cardano_transaction_t
+{
+    cardano_object_t            base;
+    cardano_transaction_body_t* body;
+    cardano_witness_set_t*      witness_set;
+    cardano_auxiliary_data_t*   auxiliary_data;
+    bool                        is_valid;
+    transaction_frame_t         frame;
+} cardano_transaction_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a protocol version object.
+ *
+ * This function is responsible for properly deallocating a protocol version object (`cardano_transaction_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the transaction object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_transaction_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the transaction
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_transaction_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_transaction_t* transaction = (cardano_transaction_t*)object;
+
+  cardano_transaction_body_unref(&transaction->body);
+  cardano_witness_set_unref(&transaction->witness_set);
+  cardano_auxiliary_data_unref(&transaction->auxiliary_data);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_transaction_new(
+  cardano_transaction_body_t* body,
+  cardano_witness_set_t*      witness_set,
+  cardano_auxiliary_data_t*   auxiliary_data,
+  cardano_transaction_t**     transaction)
+{
+  if (body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *transaction = _cardano_malloc(sizeof(cardano_transaction_t));
+
+  if (*transaction == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*transaction)->base.deallocator   = cardano_transaction_deallocate;
+  (*transaction)->base.ref_count     = 1;
+  (*transaction)->base.last_error[0] = '\0';
+  (*transaction)->body               = body;
+  (*transaction)->witness_set        = witness_set;
+  (*transaction)->auxiliary_data     = auxiliary_data;
+  (*transaction)->is_valid           = true;
+  (*transaction)->frame              = PRV_TRANSACTION_FRAME_ALONZO;
+
+  cardano_transaction_body_ref(body);
+  cardano_witness_set_ref(witness_set);
+  cardano_auxiliary_data_ref(auxiliary_data);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_t** transaction)
+{
+  if (transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *transaction = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "transaction";
+
+  int64_t array_size = 0U;
+
+  cardano_error_t result = cardano_cbor_reader_read_start_array(reader, &array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *transaction = NULL;
+    return result;
+  }
+
+  cardano_transaction_body_t* body           = NULL;
+  cardano_witness_set_t*      witness_set    = NULL;
+  cardano_auxiliary_data_t*   auxiliary_data = NULL;
+  bool                        is_valid       = true;
+  transaction_frame_t         frame          = PRV_TRANSACTION_FRAME_SHELLEY;
+
+  cardano_error_t body_result = cardano_transaction_body_from_cbor(reader, &body);
+
+  if (body_result != CARDANO_SUCCESS)
+  {
+    *transaction = NULL;
+    return body_result;
+  }
+
+  cardano_error_t witness_set_result = cardano_witness_set_from_cbor(reader, &witness_set);
+
+  if (witness_set_result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_body_unref(&body);
+    *transaction = NULL;
+    return witness_set_result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t state_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (state_result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_body_unref(&body);
+    cardano_witness_set_unref(&witness_set);
+    *transaction = NULL;
+
+    return state_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_BOOLEAN)
+  {
+    cardano_error_t read_bool_result = cardano_cbor_reader_read_bool(reader, &is_valid);
+
+    if (read_bool_result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_body_unref(&body);
+      cardano_witness_set_unref(&witness_set);
+      *transaction = NULL;
+
+      return read_bool_result;
+    }
+
+    frame = PRV_TRANSACTION_FRAME_ALONZO;
+
+    state_result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (state_result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_body_unref(&body);
+      cardano_witness_set_unref(&witness_set);
+      *transaction = NULL;
+
+      return state_result;
+    }
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null_result = cardano_cbor_reader_read_null(reader);
+
+    if (read_null_result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_body_unref(&body);
+      cardano_witness_set_unref(&witness_set);
+      *transaction = NULL;
+
+      return read_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t auxiliary_data_result = cardano_auxiliary_data_from_cbor(reader, &auxiliary_data);
+
+    if (auxiliary_data_result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_body_unref(&body);
+      cardano_witness_set_unref(&witness_set);
+      *transaction = NULL;
+
+      return auxiliary_data_result;
+    }
+  }
+
+  if (frame == PRV_TRANSACTION_FRAME_SHELLEY)
+  {
+    if (array_size == ALONZO_ERA_FRAME_SIZE)
+    {
+      frame = PRV_TRANSACTION_FRAME_BLOCK;
+    }
+    else if (array_size < 0)
+    {
+      state_result = cardano_cbor_reader_peek_state(reader, &state);
+
+      if (state_result != CARDANO_SUCCESS)
+      {
+        cardano_transaction_body_unref(&body);
+        cardano_witness_set_unref(&witness_set);
+        cardano_auxiliary_data_unref(&auxiliary_data);
+        *transaction = NULL;
+
+        return state_result;
+      }
+
+      if (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+      {
+        frame = PRV_TRANSACTION_FRAME_BLOCK;
+      }
+    }
+    else
+    {
+      frame = PRV_TRANSACTION_FRAME_SHELLEY;
+    }
+  }
+
+  if (frame == PRV_TRANSACTION_FRAME_BLOCK)
+  {
+    cardano_error_t read_bool_result = cardano_cbor_reader_read_bool(reader, &is_valid);
+
+    if (read_bool_result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_body_unref(&body);
+      cardano_witness_set_unref(&witness_set);
+      cardano_auxiliary_data_unref(&auxiliary_data);
+      *transaction = NULL;
+
+      return read_bool_result;
+    }
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    *transaction = NULL;
+
+    cardano_transaction_body_unref(&body);
+    cardano_witness_set_unref(&witness_set);
+    cardano_auxiliary_data_unref(&auxiliary_data);
+
+    return expect_end_array_result;
+  }
+
+  cardano_error_t create_instance_result = cardano_transaction_new(body, witness_set, auxiliary_data, transaction);
+
+  cardano_transaction_body_unref(&body);
+  cardano_witness_set_unref(&witness_set);
+  cardano_auxiliary_data_unref(&auxiliary_data);
+
+  if (create_instance_result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_unref(transaction);
+    return create_instance_result;
+  }
+
+  cardano_error_t set_is_valid_result = cardano_transaction_set_is_valid(*transaction, is_valid);
+
+  if (set_is_valid_result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_unref(transaction);
+    return set_is_valid_result;
+  }
+
+  (*transaction)->frame = frame;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_to_cbor(const cardano_transaction_t* transaction, cardano_cbor_writer_t* writer)
+{
+  if (transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const int64_t SHELLEY_ERA_FRAME_SIZE = 3;
+
+  transaction_frame_t frame      = transaction->frame;
+  int64_t             frame_size = ALONZO_ERA_FRAME_SIZE;
+
+  if ((frame == PRV_TRANSACTION_FRAME_SHELLEY) && !transaction->is_valid)
+  {
+    frame = PRV_TRANSACTION_FRAME_ALONZO;
+  }
+
+  if (frame == PRV_TRANSACTION_FRAME_SHELLEY)
+  {
+    frame_size = SHELLEY_ERA_FRAME_SIZE;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    frame_size);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t body_result = cardano_transaction_body_to_cbor(transaction->body, writer);
+
+  if (body_result != CARDANO_SUCCESS)
+  {
+    return body_result;
+  }
+
+  cardano_error_t witness_set_result = cardano_witness_set_to_cbor(transaction->witness_set, writer);
+
+  if (witness_set_result != CARDANO_SUCCESS)
+  {
+    return witness_set_result;
+  }
+
+  if (frame == PRV_TRANSACTION_FRAME_ALONZO)
+  {
+    cardano_error_t write_bool_result = cardano_cbor_writer_write_bool(writer, transaction->is_valid);
+
+    if (write_bool_result != CARDANO_SUCCESS)
+    {
+      return write_bool_result;
+    }
+  }
+
+  if (transaction->auxiliary_data == NULL)
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+  else
+  {
+    cardano_error_t auxiliary_data_result = cardano_auxiliary_data_to_cbor(transaction->auxiliary_data, writer);
+
+    if (auxiliary_data_result != CARDANO_SUCCESS)
+    {
+      return auxiliary_data_result;
+    }
+  }
+
+  if (frame == PRV_TRANSACTION_FRAME_BLOCK)
+  {
+    cardano_error_t write_bool_result = cardano_cbor_writer_write_bool(writer, transaction->is_valid);
+
+    if (write_bool_result != CARDANO_SUCCESS)
+    {
+      return write_bool_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_to_cip116_json(
+  const cardano_transaction_t* tx,
+  cardano_json_writer_t*       writer)
+{
+  if ((tx == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_property_name(writer, "body", 4);
+  error = cardano_transaction_body_to_cip116_json(tx->body, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "is_valid", 8);
+  cardano_json_writer_write_bool(writer, tx->is_valid);
+
+  cardano_json_writer_write_property_name(writer, "witness_set", 11);
+  error = cardano_witness_set_to_cip116_json(tx->witness_set, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (tx->auxiliary_data != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "auxiliary_data", 14);
+
+    error = cardano_auxiliary_data_to_cip116_json(tx->auxiliary_data, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return error;
+}
+
+cardano_transaction_body_t*
+cardano_transaction_get_body(cardano_transaction_t* transaction)
+{
+  if (transaction == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_body_ref(transaction->body);
+
+  return transaction->body;
+}
+
+cardano_error_t
+cardano_transaction_set_body(cardano_transaction_t* transaction, cardano_transaction_body_t* body)
+{
+  if (transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_unref(&transaction->body);
+
+  transaction->body = body;
+
+  cardano_transaction_body_ref(body);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_witness_set_t*
+cardano_transaction_get_witness_set(cardano_transaction_t* transaction)
+{
+  if (transaction == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_witness_set_ref(transaction->witness_set);
+
+  return transaction->witness_set;
+}
+
+cardano_error_t
+cardano_transaction_set_witness_set(cardano_transaction_t* transaction, cardano_witness_set_t* witness_set)
+{
+  if (transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_witness_set_unref(&transaction->witness_set);
+
+  transaction->witness_set = witness_set;
+
+  cardano_witness_set_ref(witness_set);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_auxiliary_data_t*
+cardano_transaction_get_auxiliary_data(cardano_transaction_t* transaction)
+{
+  if (transaction == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_auxiliary_data_ref(transaction->auxiliary_data);
+
+  return transaction->auxiliary_data;
+}
+
+cardano_error_t
+cardano_transaction_set_auxiliary_data(cardano_transaction_t* transaction, cardano_auxiliary_data_t* auxiliary_data)
+{
+  if (transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_auxiliary_data_unref(&transaction->auxiliary_data);
+
+  transaction->auxiliary_data = auxiliary_data;
+
+  cardano_auxiliary_data_ref(auxiliary_data);
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_transaction_get_is_valid(cardano_transaction_t* transaction)
+{
+  if (transaction == NULL)
+  {
+    return false;
+  }
+
+  return transaction->is_valid;
+}
+
+cardano_error_t
+cardano_transaction_set_is_valid(cardano_transaction_t* transaction, const bool is_valid)
+{
+  if (transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  transaction->is_valid = is_valid;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_transaction_get_id(cardano_transaction_t* transaction)
+{
+  if (transaction == NULL)
+  {
+    return NULL;
+  }
+
+  return cardano_transaction_body_get_hash(transaction->body);
+}
+
+void
+cardano_transaction_clear_cbor_cache(cardano_transaction_t* transaction)
+{
+  if (transaction == NULL)
+  {
+    return;
+  }
+
+  cardano_transaction_body_clear_cbor_cache(transaction->body);
+  cardano_witness_set_clear_cbor_cache(transaction->witness_set);
+  cardano_auxiliary_data_clear_cbor_cache(transaction->auxiliary_data);
+}
+
+cardano_error_t
+cardano_transaction_apply_vkey_witnesses(
+  cardano_transaction_t*      transaction,
+  cardano_vkey_witness_set_t* new_vkeys)
+{
+  if (transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (new_vkeys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(transaction);
+
+  cardano_witness_set_unref(&witness_set);
+
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t             result;
+  cardano_vkey_witness_set_t* inner_vkeys = cardano_witness_set_get_vkeys(witness_set);
+
+  if (inner_vkeys == NULL)
+  {
+    result = cardano_vkey_witness_set_new(&inner_vkeys);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_witness_set_set_vkeys(witness_set, inner_vkeys);
+    cardano_vkey_witness_set_unref(&inner_vkeys);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+  else
+  {
+    cardano_vkey_witness_set_unref(&inner_vkeys);
+  }
+
+  return cardano_vkey_witness_set_apply(inner_vkeys, new_vkeys);
+}
+
+bool
+cardano_transaction_has_script_data(cardano_transaction_t* transaction)
+{
+  if (transaction == NULL)
+  {
+    return false;
+  }
+
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(transaction);
+  cardano_witness_set_unref(&witness_set);
+
+  cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witness_set);
+  cardano_redeemer_list_unref(&redeemers);
+
+  cardano_plutus_data_set_t* datums = cardano_witness_set_get_plutus_data(witness_set);
+  cardano_plutus_data_set_unref(&datums);
+
+  const size_t redeemers_size = cardano_redeemer_list_get_length(redeemers);
+  const size_t datums_size    = cardano_plutus_data_set_get_length(datums);
+
+  return (redeemers_size > 0U) || (datums_size > 0U);
+}
+
+void
+cardano_transaction_unref(cardano_transaction_t** transaction)
+{
+  if ((transaction == NULL) || (*transaction == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*transaction)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *transaction = NULL;
+    return;
+  }
+}
+
+cardano_error_t
+cardano_transaction_get_unique_signers(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  cardano_blake2b_hash_set_t** unique_signers)
+{
+  return _cardano_get_unique_signers(tx, resolved_inputs, unique_signers);
+}
+
+void
+cardano_transaction_ref(cardano_transaction_t* transaction)
+{
+  if (transaction == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&transaction->base);
+}
+
+size_t
+cardano_transaction_refcount(const cardano_transaction_t* transaction)
+{
+  if (transaction == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&transaction->base);
+}
+
+void
+cardano_transaction_set_last_error(cardano_transaction_t* transaction, const char* message)
+{
+  cardano_object_set_last_error(&transaction->base, message);
+}
+
+const char*
+cardano_transaction_get_last_error(const cardano_transaction_t* transaction)
+{
+  return cardano_object_get_last_error(&transaction->base);
+}
+
+/**
+ * \brief Finds the position of an input matching the given id and index within an input set.
+ *
+ * \param[in]  inputs     The input set to search.
+ * \param[in]  id         The transaction id to match.
+ * \param[in]  utxo_index The output index to match.
+ * \param[out] index      The position of the matching input.
+ *
+ * \return \ref CARDANO_SUCCESS if found, or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ */
+static cardano_error_t
+find_in_input_set(
+  cardano_transaction_input_set_t* inputs,
+  cardano_blake2b_hash_t*          id,
+  const uint64_t                   utxo_index,
+  uint64_t*                        index)
+{
+  const size_t length = cardano_transaction_input_set_get_length(inputs);
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_transaction_input_t* input = NULL;
+
+    cardano_error_t result = cardano_transaction_input_set_get(inputs, i, &input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_blake2b_hash_t* input_id = cardano_transaction_input_get_id(input);
+
+    const bool matches = cardano_blake2b_hash_equals(input_id, id) && (cardano_transaction_input_get_index(input) == utxo_index);
+
+    cardano_blake2b_hash_unref(&input_id);
+    cardano_transaction_input_unref(&input);
+
+    if (matches)
+    {
+      *index = i;
+
+      return CARDANO_SUCCESS;
+    }
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_transaction_find_input_index(
+  cardano_transaction_t*  transaction,
+  cardano_blake2b_hash_t* id,
+  const uint64_t          utxo_index,
+  uint64_t*               index)
+{
+  if ((transaction == NULL) || (id == NULL) || (index == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_input_set_t* inputs = cardano_transaction_body_get_inputs(body);
+  cardano_transaction_input_set_unref(&inputs);
+
+  if (inputs == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  return find_in_input_set(inputs, id, utxo_index, index);
+}
+
+cardano_error_t
+cardano_transaction_find_reference_input_index(
+  cardano_transaction_t*  transaction,
+  cardano_blake2b_hash_t* id,
+  const uint64_t          utxo_index,
+  uint64_t*               index)
+{
+  if ((transaction == NULL) || (id == NULL) || (index == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_input_set_t* inputs = cardano_transaction_body_get_reference_inputs(body);
+  cardano_transaction_input_set_unref(&inputs);
+
+  if (inputs == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  return find_in_input_set(inputs, id, utxo_index, index);
+}
+
+cardano_error_t
+cardano_transaction_find_output_index(
+  cardano_transaction_t* transaction,
+  cardano_address_t*     address,
+  const uint64_t         min_lovelace,
+  uint64_t*              index)
+{
+  if ((transaction == NULL) || (address == NULL) || (index == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(body);
+  cardano_transaction_output_list_unref(&outputs);
+
+  if (outputs == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  const size_t length = cardano_transaction_output_list_get_length(outputs);
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_transaction_output_t* output = NULL;
+
+    cardano_error_t result = cardano_transaction_output_list_get(outputs, i, &output);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_address_t* output_address = cardano_transaction_output_get_address(output);
+    cardano_value_t*   value          = cardano_transaction_output_get_value(output);
+
+    const bool matches = cardano_address_equals(output_address, address) && (cardano_value_get_coin(value) >= (int64_t)min_lovelace);
+
+    cardano_address_unref(&output_address);
+    cardano_value_unref(&value);
+    cardano_transaction_output_unref(&output);
+
+    if (matches)
+    {
+      *index = i;
+
+      return CARDANO_SUCCESS;
+    }
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_transaction_find_mint_policy_index(
+  cardano_transaction_t*  transaction,
+  cardano_blake2b_hash_t* policy_id,
+  uint64_t*               index)
+{
+  if ((transaction == NULL) || (policy_id == NULL) || (index == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_multi_asset_t* mint = cardano_transaction_body_get_mint(body);
+  cardano_multi_asset_unref(&mint);
+
+  if (mint == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_policy_id_list_t* policies = NULL;
+
+  cardano_error_t result = cardano_multi_asset_get_keys(mint, &policies);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+
+  const size_t length = cardano_policy_id_list_get_length(policies);
+
+  for (size_t i = 0U; (i < length) && (result == CARDANO_ERROR_ELEMENT_NOT_FOUND); ++i)
+  {
+    cardano_blake2b_hash_t* policy = NULL;
+
+    const cardano_error_t get_result = cardano_policy_id_list_get(policies, i, &policy);
+
+    if (get_result != CARDANO_SUCCESS)
+    {
+      result = get_result;
+      break;
+    }
+
+    if (cardano_blake2b_hash_equals(policy, policy_id))
+    {
+      *index = i;
+      result = CARDANO_SUCCESS;
+    }
+
+    cardano_blake2b_hash_unref(&policy);
+  }
+
+  cardano_policy_id_list_unref(&policies);
+
+  return result;
+}
+
+cardano_error_t
+cardano_transaction_find_withdrawal_index(
+  cardano_transaction_t*    transaction,
+  cardano_reward_address_t* reward_address,
+  uint64_t*                 index)
+{
+  if ((transaction == NULL) || (reward_address == NULL) || (index == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_withdrawal_map_t* withdrawals = cardano_transaction_body_get_withdrawals(body);
+  cardano_withdrawal_map_unref(&withdrawals);
+
+  if (withdrawals == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  return _cardano_ledger_order_withdrawal_index(withdrawals, reward_address, index);
+}
+
+/**
+ * \brief Serializes a certificate into a freshly allocated buffer.
+ *
+ * \param[in]  certificate The certificate to serialize.
+ * \param[out] buffer      The serialized bytes. The caller takes ownership.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+certificate_to_cbor_buffer(cardano_certificate_t* certificate, cardano_buffer_t** buffer)
+{
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_certificate_to_cbor(certificate, writer);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_writer_encode_in_buffer(writer, buffer);
+  }
+
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_transaction_find_certificate_index(
+  cardano_transaction_t* transaction,
+  cardano_certificate_t* certificate,
+  uint64_t*              index)
+{
+  if ((transaction == NULL) || (certificate == NULL) || (index == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_certificate_set_t* certificates = cardano_transaction_body_get_certificates(body);
+  cardano_certificate_set_unref(&certificates);
+
+  if (certificates == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_buffer_t* target_bytes = NULL;
+
+  cardano_error_t result = certificate_to_cbor_buffer(certificate, &target_bytes);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+
+  const size_t length = cardano_certificate_set_get_length(certificates);
+
+  for (size_t i = 0U; (i < length) && (result == CARDANO_ERROR_ELEMENT_NOT_FOUND); ++i)
+  {
+    cardano_certificate_t* entry = NULL;
+
+    const cardano_error_t get_result = cardano_certificate_set_get(certificates, i, &entry);
+
+    if (get_result != CARDANO_SUCCESS)
+    {
+      result = get_result;
+    }
+    else
+    {
+      cardano_buffer_t* entry_bytes = NULL;
+
+      const cardano_error_t serialize_result = certificate_to_cbor_buffer(entry, &entry_bytes);
+
+      cardano_certificate_unref(&entry);
+
+      if (serialize_result != CARDANO_SUCCESS)
+      {
+        result = serialize_result;
+      }
+      else
+      {
+        if (cardano_buffer_equals(entry_bytes, target_bytes))
+        {
+          *index = i;
+          result = CARDANO_SUCCESS;
+        }
+
+        cardano_buffer_unref(&entry_bytes);
+      }
+    }
+  }
+
+  cardano_buffer_unref(&target_bytes);
+
+  return result;
+}
+
+/**
+ * \brief Serializes a proposal into a freshly allocated buffer.
+ *
+ * \param[in]  proposal The proposal to serialize.
+ * \param[out] buffer      The serialized bytes. The caller takes ownership.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+proposal_to_cbor_buffer(cardano_proposal_procedure_t* proposal, cardano_buffer_t** buffer)
+{
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_proposal_procedure_to_cbor(proposal, writer);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_writer_encode_in_buffer(writer, buffer);
+  }
+
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_transaction_find_proposal_index(
+  cardano_transaction_t*        transaction,
+  cardano_proposal_procedure_t* proposal,
+  uint64_t*                     index)
+{
+  if ((transaction == NULL) || (proposal == NULL) || (index == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_proposal_procedure_set_t* proposals = cardano_transaction_body_get_proposal_procedures(body);
+  cardano_proposal_procedure_set_unref(&proposals);
+
+  if (proposals == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_buffer_t* target_bytes = NULL;
+
+  cardano_error_t result = proposal_to_cbor_buffer(proposal, &target_bytes);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+
+  const size_t length = cardano_proposal_procedure_set_get_length(proposals);
+
+  for (size_t i = 0U; (i < length) && (result == CARDANO_ERROR_ELEMENT_NOT_FOUND); ++i)
+  {
+    cardano_proposal_procedure_t* entry = NULL;
+
+    const cardano_error_t get_result = cardano_proposal_procedure_set_get(proposals, i, &entry);
+
+    if (get_result != CARDANO_SUCCESS)
+    {
+      result = get_result;
+    }
+    else
+    {
+      cardano_buffer_t* entry_bytes = NULL;
+
+      const cardano_error_t serialize_result = proposal_to_cbor_buffer(entry, &entry_bytes);
+
+      cardano_proposal_procedure_unref(&entry);
+
+      if (serialize_result != CARDANO_SUCCESS)
+      {
+        result = serialize_result;
+      }
+      else
+      {
+        if (cardano_buffer_equals(entry_bytes, target_bytes))
+        {
+          *index = i;
+          result = CARDANO_SUCCESS;
+        }
+
+        cardano_buffer_unref(&entry_bytes);
+      }
+    }
+  }
+
+  cardano_buffer_unref(&target_bytes);
+
+  return result;
+}
+
+cardano_error_t
+cardano_transaction_find_vote_index(
+  cardano_transaction_t* transaction,
+  cardano_voter_t*       voter,
+  uint64_t*              index)
+{
+  if ((transaction == NULL) || (voter == NULL) || (index == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_voting_procedures_t* votes = cardano_transaction_body_get_voting_procedures(body);
+  cardano_voting_procedures_unref(&votes);
+
+  if (votes == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_voter_list_t* voters = NULL;
+
+  cardano_error_t result = cardano_voting_procedures_get_voters(votes, &voters);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = _cardano_ledger_order_voter_index(voters, voter, index);
+
+  cardano_voter_list_unref(&voters);
+
+  return result;
+}
+
+cardano_error_t
+cardano_transaction_find_redeemer_index(
+  cardano_transaction_t*       transaction,
+  const cardano_redeemer_tag_t tag,
+  const uint64_t               purpose_index,
+  uint64_t*                    index)
+{
+  if ((transaction == NULL) || (index == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(transaction);
+  cardano_witness_set_unref(&witness_set);
+
+  cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witness_set);
+  cardano_redeemer_list_unref(&redeemers);
+
+  if (redeemers == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  const size_t length = cardano_redeemer_list_get_length(redeemers);
+
+  uint64_t rank  = 0U;
+  bool     found = false;
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_redeemer_t* redeemer = NULL;
+
+    cardano_error_t result = cardano_redeemer_list_get(redeemers, i, &redeemer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    const cardano_redeemer_tag_t entry_tag   = cardano_redeemer_get_tag(redeemer);
+    const uint64_t               entry_index = cardano_redeemer_get_index(redeemer);
+
+    cardano_redeemer_unref(&redeemer);
+
+    if ((entry_tag == tag) && (entry_index == purpose_index))
+    {
+      found = true;
+    }
+    else if ((entry_tag < tag) || ((entry_tag == tag) && (entry_index < purpose_index)))
+    {
+      ++rank;
+    }
+    else
+    {
+      /* Entry orders after the requested redeemer. */
+    }
+  }
+
+  if (!found)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  *index = rank;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_deep_clone(const cardano_transaction_t* source, cardano_transaction_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_t* copy = _cardano_malloc(sizeof(cardano_transaction_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->body               = NULL;
+  copy->witness_set        = NULL;
+  copy->auxiliary_data     = NULL;
+  copy->is_valid           = source->is_valid;
+  copy->frame              = source->frame;
+
+  if (source->body != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_body_deep_clone(source->body, &copy->body);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->witness_set != NULL)
+  {
+    const cardano_error_t result = cardano_witness_set_deep_clone(source->witness_set, &copy->witness_set);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->auxiliary_data != NULL)
+  {
+    const cardano_error_t result = cardano_auxiliary_data_deep_clone(source->auxiliary_data, &copy->auxiliary_data);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_get_unique_signers_with_pool_state(
+  cardano_transaction_t*        tx,
+  cardano_utxo_list_t*          resolved_inputs,
+  const uint64_t                protocol_major,
+  cardano_pool_params_t* const* pool_state,
+  const size_t                  pool_state_size,
+  cardano_blake2b_hash_set_t**  unique_signers)
+{
+  const cardano_error_t result = _cardano_validate_pool_state(pool_state, pool_state_size);
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+  return _cardano_get_unique_signers_with_pool_state(tx, resolved_inputs, unique_signers, pool_state, (protocol_major >= 12U) ? pool_state_size : 0U);
+}
diff --git a/vendor/src/transaction_body/account_balance_interval.c b/vendor/src/transaction_body/account_balance_interval.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/account_balance_interval.c
@@ -0,0 +1,533 @@
+/**
+ * \file account_balance_interval.c
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/transaction_body/account_balance_interval.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t ACCOUNT_BALANCE_INTERVAL_EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a constraint on an account balance expressed in lovelace.
+ */
+typedef struct cardano_account_balance_interval_t
+{
+    cardano_object_t base;
+    bool             has_inclusive_lower_bound;
+    uint64_t         inclusive_lower_bound;
+    bool             has_exclusive_upper_bound;
+    uint64_t         exclusive_upper_bound;
+    bool             is_exact;
+    uint64_t         exact_balance;
+} cardano_account_balance_interval_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates an account balance interval object.
+ *
+ * This function is responsible for properly deallocating an account balance interval object (`cardano_account_balance_interval_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the account_balance_interval object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_account_balance_interval_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the account_balance_interval
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_account_balance_interval_deallocate(void* object)
+{
+  assert(object != NULL);
+  _cardano_free(object);
+}
+
+/**
+ * \brief Allocates an account balance interval with every field cleared.
+ *
+ * \param[out] account_balance_interval On success, points to a newly allocated interval with no bounds and no
+ *                                      exact balance. Set to NULL on failure.
+ *
+ * \return \ref CARDANO_SUCCESS if the interval was allocated, \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED otherwise.
+ */
+static cardano_error_t
+cardano_account_balance_interval_allocate(cardano_account_balance_interval_t** account_balance_interval)
+{
+  *account_balance_interval = _cardano_malloc(sizeof(cardano_account_balance_interval_t));
+
+  if (*account_balance_interval == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*account_balance_interval)->base.deallocator   = cardano_account_balance_interval_deallocate;
+  (*account_balance_interval)->base.ref_count     = 1;
+  (*account_balance_interval)->base.last_error[0] = '\0';
+
+  (*account_balance_interval)->has_inclusive_lower_bound = false;
+  (*account_balance_interval)->inclusive_lower_bound     = 0U;
+  (*account_balance_interval)->has_exclusive_upper_bound = false;
+  (*account_balance_interval)->exclusive_upper_bound     = 0U;
+  (*account_balance_interval)->is_exact                  = false;
+  (*account_balance_interval)->exact_balance             = 0U;
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_account_balance_interval_new(
+  const uint64_t*                      inclusive_lower_bound,
+  const uint64_t*                      exclusive_upper_bound,
+  cardano_account_balance_interval_t** account_balance_interval)
+{
+  if (account_balance_interval == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((inclusive_lower_bound == NULL) && (exclusive_upper_bound == NULL))
+  {
+    *account_balance_interval = NULL;
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  const cardano_error_t allocate_result = cardano_account_balance_interval_allocate(account_balance_interval);
+
+  if (allocate_result != CARDANO_SUCCESS)
+  {
+    return allocate_result;
+  }
+
+  (*account_balance_interval)->has_inclusive_lower_bound = (inclusive_lower_bound != NULL);
+  (*account_balance_interval)->inclusive_lower_bound     = (inclusive_lower_bound != NULL) ? *inclusive_lower_bound : 0U;
+  (*account_balance_interval)->has_exclusive_upper_bound = (exclusive_upper_bound != NULL);
+  (*account_balance_interval)->exclusive_upper_bound     = (exclusive_upper_bound != NULL) ? *exclusive_upper_bound : 0U;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_account_balance_interval_new_exact(
+  const uint64_t                       exact_balance,
+  cardano_account_balance_interval_t** account_balance_interval)
+{
+  if (account_balance_interval == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const cardano_error_t allocate_result = cardano_account_balance_interval_allocate(account_balance_interval);
+
+  if (allocate_result != CARDANO_SUCCESS)
+  {
+    return allocate_result;
+  }
+
+  (*account_balance_interval)->is_exact      = true;
+  (*account_balance_interval)->exact_balance = exact_balance;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_account_balance_interval_from_cbor(cardano_cbor_reader_t* reader, cardano_account_balance_interval_t** account_balance_interval)
+{
+  if (account_balance_interval == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *account_balance_interval = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "account_balance_interval";
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  cardano_error_t result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *account_balance_interval = NULL;
+    return result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER)
+  {
+    uint64_t exact_balance = 0U;
+
+    result = cardano_cbor_reader_read_uint(reader, &exact_balance);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *account_balance_interval = NULL;
+      return result;
+    }
+
+    return cardano_account_balance_interval_new_exact(exact_balance, account_balance_interval);
+  }
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)ACCOUNT_BALANCE_INTERVAL_EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *account_balance_interval = NULL;
+    return expect_array_result;
+  }
+
+  bool     has_inclusive_lower_bound = false;
+  uint64_t inclusive_lower_bound     = 0U;
+  bool     has_exclusive_upper_bound = false;
+  uint64_t exclusive_upper_bound     = 0U;
+
+  result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *account_balance_interval = NULL;
+    return result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    result = cardano_cbor_reader_read_null(reader);
+  }
+  else
+  {
+    result                    = cardano_cbor_reader_read_uint(reader, &inclusive_lower_bound);
+    has_inclusive_lower_bound = true;
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *account_balance_interval = NULL;
+    return result;
+  }
+
+  result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *account_balance_interval = NULL;
+    return result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    result = cardano_cbor_reader_read_null(reader);
+  }
+  else
+  {
+    result                    = cardano_cbor_reader_read_uint(reader, &exclusive_upper_bound);
+    has_exclusive_upper_bound = true;
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *account_balance_interval = NULL;
+    return result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    *account_balance_interval = NULL;
+    return expect_end_array_result;
+  }
+
+  if (!has_inclusive_lower_bound && !has_exclusive_upper_bound)
+  {
+    cardano_cbor_reader_set_last_error(reader, "Both interval bounds cannot be nil.");
+    *account_balance_interval = NULL;
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  return cardano_account_balance_interval_new(
+    has_inclusive_lower_bound ? &inclusive_lower_bound : NULL,
+    has_exclusive_upper_bound ? &exclusive_upper_bound : NULL,
+    account_balance_interval);
+}
+
+cardano_error_t
+cardano_account_balance_interval_to_cbor(const cardano_account_balance_interval_t* account_balance_interval, cardano_cbor_writer_t* writer)
+{
+  if (account_balance_interval == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (account_balance_interval->is_exact)
+  {
+    return cardano_cbor_writer_write_uint(writer, account_balance_interval->exact_balance);
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, ACCOUNT_BALANCE_INTERVAL_EMBEDDED_GROUP_SIZE);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (account_balance_interval->has_inclusive_lower_bound)
+  {
+    result = cardano_cbor_writer_write_uint(writer, account_balance_interval->inclusive_lower_bound);
+  }
+  else
+  {
+    result = cardano_cbor_writer_write_null(writer);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (account_balance_interval->has_exclusive_upper_bound)
+  {
+    result = cardano_cbor_writer_write_uint(writer, account_balance_interval->exclusive_upper_bound);
+  }
+  else
+  {
+    result = cardano_cbor_writer_write_null(writer);
+  }
+
+  return result;
+}
+
+const uint64_t*
+cardano_account_balance_interval_get_inclusive_lower_bound(const cardano_account_balance_interval_t* account_balance_interval)
+{
+  if (account_balance_interval == NULL)
+  {
+    return NULL;
+  }
+
+  if (!account_balance_interval->has_inclusive_lower_bound)
+  {
+    return NULL;
+  }
+
+  return &account_balance_interval->inclusive_lower_bound;
+}
+
+const uint64_t*
+cardano_account_balance_interval_get_exclusive_upper_bound(const cardano_account_balance_interval_t* account_balance_interval)
+{
+  if (account_balance_interval == NULL)
+  {
+    return NULL;
+  }
+
+  if (!account_balance_interval->has_exclusive_upper_bound)
+  {
+    return NULL;
+  }
+
+  return &account_balance_interval->exclusive_upper_bound;
+}
+
+const uint64_t*
+cardano_account_balance_interval_get_exact_balance(const cardano_account_balance_interval_t* account_balance_interval)
+{
+  if (account_balance_interval == NULL)
+  {
+    return NULL;
+  }
+
+  if (!account_balance_interval->is_exact)
+  {
+    return NULL;
+  }
+
+  return &account_balance_interval->exact_balance;
+}
+
+bool
+cardano_account_balance_interval_is_exact(const cardano_account_balance_interval_t* account_balance_interval)
+{
+  if (account_balance_interval == NULL)
+  {
+    return false;
+  }
+
+  return account_balance_interval->is_exact;
+}
+
+cardano_error_t
+cardano_account_balance_interval_to_cip116_json(const cardano_account_balance_interval_t* value, cardano_json_writer_t* writer)
+{
+  if ((value == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+
+  if (value->is_exact)
+  {
+    cardano_json_writer_write_string(writer, "exact", 5);
+    cardano_json_writer_write_property_name(writer, "value", 5);
+    cardano_json_writer_write_uint_as_string(writer, value->exact_balance);
+  }
+  else
+  {
+    cardano_json_writer_write_string(writer, "range", 5);
+    cardano_json_writer_write_property_name(writer, "inclusive_lower_bound", 21);
+
+    if (value->has_inclusive_lower_bound)
+    {
+      cardano_json_writer_write_uint_as_string(writer, value->inclusive_lower_bound);
+    }
+    else
+    {
+      cardano_json_writer_write_null(writer);
+    }
+
+    cardano_json_writer_write_property_name(writer, "exclusive_upper_bound", 21);
+
+    if (value->has_exclusive_upper_bound)
+    {
+      cardano_json_writer_write_uint_as_string(writer, value->exclusive_upper_bound);
+    }
+    else
+    {
+      cardano_json_writer_write_null(writer);
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_account_balance_interval_unref(cardano_account_balance_interval_t** account_balance_interval)
+{
+  if ((account_balance_interval == NULL) || (*account_balance_interval == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*account_balance_interval)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *account_balance_interval = NULL;
+    return;
+  }
+}
+
+void
+cardano_account_balance_interval_ref(cardano_account_balance_interval_t* account_balance_interval)
+{
+  if (account_balance_interval == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&account_balance_interval->base);
+}
+
+size_t
+cardano_account_balance_interval_refcount(const cardano_account_balance_interval_t* account_balance_interval)
+{
+  if (account_balance_interval == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&account_balance_interval->base);
+}
+
+void
+cardano_account_balance_interval_set_last_error(cardano_account_balance_interval_t* account_balance_interval, const char* message)
+{
+  cardano_object_set_last_error(&account_balance_interval->base, message);
+}
+
+const char*
+cardano_account_balance_interval_get_last_error(const cardano_account_balance_interval_t* account_balance_interval)
+{
+  return cardano_object_get_last_error(&account_balance_interval->base);
+}
+
+cardano_error_t
+cardano_account_balance_interval_deep_clone(const cardano_account_balance_interval_t* source, cardano_account_balance_interval_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_account_balance_interval_t* copy = _cardano_malloc(sizeof(cardano_account_balance_interval_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count            = 1U;
+  copy->base.deallocator          = source->base.deallocator;
+  copy->base.last_error[0]        = '\0';
+  copy->has_inclusive_lower_bound = source->has_inclusive_lower_bound;
+  copy->inclusive_lower_bound     = source->inclusive_lower_bound;
+  copy->has_exclusive_upper_bound = source->has_exclusive_upper_bound;
+  copy->exclusive_upper_bound     = source->exclusive_upper_bound;
+  copy->is_exact                  = source->is_exact;
+  copy->exact_balance             = source->exact_balance;
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/account_balance_intervals_map.c b/vendor/src/transaction_body/account_balance_intervals_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/account_balance_intervals_map.c
@@ -0,0 +1,907 @@
+/**
+ * \file account_balance_intervals_map.c
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/transaction_body/account_balance_intervals_map.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a map of reward addresses to account balance intervals.
+ */
+typedef struct cardano_account_balance_intervals_map_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_account_balance_intervals_map_t;
+
+/**
+ * \brief Represents a reward address to account balance interval key value pair.
+ */
+typedef struct cardano_account_balance_intervals_map_kvp_t
+{
+    cardano_object_t                    base;
+    cardano_reward_address_t*           key;
+    cardano_account_balance_interval_t* value;
+} cardano_account_balance_intervals_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates an account balance intervals map object.
+ *
+ * This function is responsible for properly deallocating an account balance intervals map object (`cardano_account_balance_intervals_map_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the account_balance_intervals_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_account_balance_intervals_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the account_balance_intervals_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_account_balance_intervals_map_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_account_balance_intervals_map_t* map = (cardano_account_balance_intervals_map_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates an account balance intervals map key value pair object.
+ *
+ * This function is responsible for properly deallocating an account balance intervals map key value pair object
+ * (`cardano_account_balance_intervals_map_kvp_t`) and its associated resources.
+ *
+ * \param object A void pointer to the account_balance_intervals_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_account_balance_intervals_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the account_balance_intervals_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_account_balance_intervals_map_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_account_balance_intervals_map_kvp_t* map = (cardano_account_balance_intervals_map_kvp_t*)object;
+
+  if (map->key != NULL)
+  {
+    cardano_reward_address_unref(&map->key);
+  }
+
+  if (map->value != NULL)
+  {
+    cardano_account_balance_interval_unref(&map->value);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two reward addresses based on their serialized bytes.
+ *
+ * \param[in] lhs Pointer to the first reward address object.
+ * \param[in] rhs Pointer to the second reward address object.
+ *
+ * \return true if the addresses are equal, false otherwise.
+ */
+static bool
+reward_address_equals(const cardano_reward_address_t* lhs, const cardano_reward_address_t* rhs)
+{
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  const size_t lhs_size = cardano_reward_address_get_bytes_size(lhs);
+  const size_t rhs_size = cardano_reward_address_get_bytes_size(rhs);
+
+  if (lhs_size != rhs_size)
+  {
+    return false;
+  }
+
+  const uint8_t* lhs_bytes = cardano_reward_address_get_bytes(lhs);
+  const uint8_t* rhs_bytes = cardano_reward_address_get_bytes(rhs);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size) == 0;
+}
+
+/**
+ * \brief Compares two cardano_account_balance_intervals_map_kvp_t objects based on their reward_address.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the address of lhs is less than the address of rhs, zero if they are equal,
+ *         and a positive value if the address of lhs is greater than the address of rhs.
+ */
+static int32_t
+compare_by_bytes(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_account_balance_intervals_map_kvp_t* lhs_kvp = (const cardano_account_balance_intervals_map_kvp_t*)((const void*)lhs);
+  const cardano_account_balance_intervals_map_kvp_t* rhs_kvp = (const cardano_account_balance_intervals_map_kvp_t*)((const void*)rhs);
+
+  const size_t lhs_size = cardano_reward_address_get_bytes_size(lhs_kvp->key);
+  const size_t rhs_size = cardano_reward_address_get_bytes_size(rhs_kvp->key);
+
+  if (lhs_size != rhs_size)
+  {
+    return (lhs_size < rhs_size) ? -1 : 1;
+  }
+
+  const uint8_t* lhs_bytes = cardano_reward_address_get_bytes(lhs_kvp->key);
+  const uint8_t* rhs_bytes = cardano_reward_address_get_bytes(rhs_kvp->key);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_account_balance_intervals_map_new(cardano_account_balance_intervals_map_t** account_balance_intervals_map)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_account_balance_intervals_map_t* map = _cardano_malloc(sizeof(cardano_account_balance_intervals_map_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_account_balance_intervals_map_deallocate;
+
+  map->array = cardano_array_new(32);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *account_balance_intervals_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_account_balance_intervals_map_from_cbor(cardano_cbor_reader_t* reader, cardano_account_balance_intervals_map_t** account_balance_intervals_map)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (account_balance_intervals_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_account_balance_intervals_map_t* map    = NULL;
+  cardano_error_t                          result = cardano_account_balance_intervals_map_new(&map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_map(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_account_balance_intervals_map_unref(&map);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_account_balance_intervals_map_unref(&map);
+    return result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'account_balance_intervals_map', the map must not be empty.");
+    cardano_account_balance_intervals_map_unref(&map);
+
+    return CARDANO_ERROR_INVALID_CBOR_MAP_SIZE;
+  }
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_account_balance_intervals_map_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_reward_address_t*           key   = NULL;
+    cardano_account_balance_interval_t* value = NULL;
+
+    cardano_buffer_t* reward_address_bytes = NULL;
+
+    result = cardano_cbor_reader_read_bytestring(reader, &reward_address_bytes);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_account_balance_intervals_map_unref(&map);
+      return result;
+    }
+
+    result = cardano_reward_address_from_bytes(cardano_buffer_get_data(reward_address_bytes), cardano_buffer_get_size(reward_address_bytes), &key);
+
+    cardano_buffer_unref(&reward_address_bytes);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_account_balance_intervals_map_unref(&map);
+      return result;
+    }
+
+    result = cardano_account_balance_interval_from_cbor(reader, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_reward_address_unref(&key);
+      cardano_account_balance_intervals_map_unref(&map);
+      return result;
+    }
+
+    result = cardano_account_balance_intervals_map_insert(map, key, value);
+
+    cardano_reward_address_unref(&key);
+    cardano_account_balance_interval_unref(&value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'account_balance_intervals_map', the map must not contain duplicated keys.");
+      cardano_account_balance_intervals_map_unref(&map);
+
+      return result;
+    }
+  }
+
+  result = cardano_cbor_validate_end_map("account_balance_intervals_map", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_account_balance_intervals_map_unref(&map);
+    return result;
+  }
+
+  *account_balance_intervals_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_account_balance_intervals_map_to_cbor(const cardano_account_balance_intervals_map_t* account_balance_intervals_map, cardano_cbor_writer_t* writer)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t map_size = cardano_array_get_size(account_balance_intervals_map->array);
+  result          = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(account_balance_intervals_map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(account_balance_intervals_map->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in account balance intervals map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_account_balance_intervals_map_kvp_t* kvp_data = (cardano_account_balance_intervals_map_kvp_t*)((void*)kvp);
+
+    result = cardano_cbor_writer_write_bytestring(writer, cardano_reward_address_get_bytes(kvp_data->key), cardano_reward_address_get_bytes_size(kvp_data->key));
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    result = cardano_account_balance_interval_to_cbor(kvp_data->value, writer);
+
+    cardano_object_unref(&kvp);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_account_balance_intervals_map_get_length(const cardano_account_balance_intervals_map_t* account_balance_intervals_map)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(account_balance_intervals_map->array);
+}
+
+cardano_error_t
+cardano_account_balance_intervals_map_get(
+  const cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  cardano_reward_address_t*                      key,
+  cardano_account_balance_interval_t**           element)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(account_balance_intervals_map->array); ++i)
+  {
+    cardano_object_t*                            object = cardano_array_get(account_balance_intervals_map->array, i);
+    cardano_account_balance_intervals_map_kvp_t* kvp    = (cardano_account_balance_intervals_map_kvp_t*)((void*)object);
+
+    if (reward_address_equals(kvp->key, key))
+    {
+      cardano_account_balance_interval_ref(kvp->value);
+
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_account_balance_intervals_map_insert(
+  cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  cardano_reward_address_t*                key,
+  cardano_account_balance_interval_t*      value)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(account_balance_intervals_map->array); ++i)
+  {
+    cardano_object_t*                            object = cardano_array_get(account_balance_intervals_map->array, i);
+    cardano_account_balance_intervals_map_kvp_t* kvp    = (cardano_account_balance_intervals_map_kvp_t*)((void*)object);
+
+    const bool duplicated = reward_address_equals(kvp->key, key);
+
+    cardano_object_unref(&object);
+
+    if (duplicated)
+    {
+      return CARDANO_ERROR_DUPLICATED_KEY;
+    }
+  }
+
+  cardano_account_balance_intervals_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_account_balance_intervals_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_account_balance_intervals_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_reward_address_ref(key);
+  cardano_account_balance_interval_ref(value);
+
+  const size_t old_size = cardano_array_get_size(account_balance_intervals_map->array);
+  const size_t new_size = cardano_array_push(account_balance_intervals_map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_account_balance_intervals_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(account_balance_intervals_map->array, compare_by_bytes, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_account_balance_intervals_map_insert_ex(
+  cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  const char*                              reward_address,
+  size_t                                   reward_address_size,
+  cardano_account_balance_interval_t*      value)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_t* key = NULL;
+
+  cardano_error_t result = cardano_reward_address_from_bech32(reward_address, reward_address_size, &key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_account_balance_intervals_map_insert(account_balance_intervals_map, key, value);
+
+  cardano_reward_address_unref(&key);
+
+  return result;
+}
+
+cardano_error_t
+cardano_account_balance_intervals_map_get_keys(
+  cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  cardano_reward_address_list_t**          keys)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_list_t* list = NULL;
+
+  cardano_error_t result = cardano_reward_address_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(account_balance_intervals_map->array); ++i)
+  {
+    cardano_object_t*                            object = cardano_array_get(account_balance_intervals_map->array, i);
+    cardano_account_balance_intervals_map_kvp_t* kvp    = (cardano_account_balance_intervals_map_kvp_t*)((void*)object);
+
+    result = cardano_reward_address_list_add(list, kvp->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_reward_address_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_account_balance_intervals_map_get_key_at(
+  const cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  const size_t                                   index,
+  cardano_reward_address_t**                     reward_address)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(account_balance_intervals_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                            object = cardano_array_get(account_balance_intervals_map->array, index);
+  cardano_account_balance_intervals_map_kvp_t* kvp    = (cardano_account_balance_intervals_map_kvp_t*)((void*)object);
+
+  cardano_reward_address_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *reward_address = kvp->key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_account_balance_intervals_map_get_value_at(
+  const cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  const size_t                                   index,
+  cardano_account_balance_interval_t**           interval)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (interval == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(account_balance_intervals_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                            object = cardano_array_get(account_balance_intervals_map->array, index);
+  cardano_account_balance_intervals_map_kvp_t* kvp    = (cardano_account_balance_intervals_map_kvp_t*)((void*)object);
+
+  cardano_account_balance_interval_ref(kvp->value);
+  cardano_object_unref(&object);
+
+  *interval = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_account_balance_intervals_map_get_key_value_at(
+  const cardano_account_balance_intervals_map_t* account_balance_intervals_map,
+  const size_t                                   index,
+  cardano_reward_address_t**                     reward_address,
+  cardano_account_balance_interval_t**           interval)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (interval == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(account_balance_intervals_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                            object = cardano_array_get(account_balance_intervals_map->array, index);
+  cardano_account_balance_intervals_map_kvp_t* kvp    = (cardano_account_balance_intervals_map_kvp_t*)((void*)object);
+
+  cardano_reward_address_ref(kvp->key);
+  cardano_account_balance_interval_ref(kvp->value);
+  cardano_object_unref(&object);
+
+  *reward_address = kvp->key;
+  *interval       = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_account_balance_intervals_map_to_cip116_json(const cardano_account_balance_intervals_map_t* value, cardano_json_writer_t* writer)
+{
+  if ((value == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0U; i < cardano_array_get_size(value->array); ++i)
+  {
+    cardano_object_t* entry = cardano_array_get(value->array, i);
+
+    if (entry == NULL)
+    {
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    const cardano_account_balance_intervals_map_kvp_t* pair   = (const cardano_account_balance_intervals_map_kvp_t*)((const void*)entry);
+    cardano_error_t                                    result = CARDANO_SUCCESS;
+
+    cardano_json_writer_write_start_object(writer);
+    cardano_json_writer_write_property_name(writer, "key", 3);
+    const char*  address = cardano_reward_address_get_string(pair->key);
+    const size_t size    = cardano_safe_strlen(address, cardano_reward_address_get_bech32_size(pair->key));
+    cardano_json_writer_write_string(writer, address, size);
+    cardano_json_writer_write_property_name(writer, "value", 5);
+    result = cardano_account_balance_interval_to_cip116_json(pair->value, writer);
+    cardano_json_writer_write_end_object(writer);
+    cardano_object_unref(&entry);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_account_balance_intervals_map_unref(cardano_account_balance_intervals_map_t** account_balance_intervals_map)
+{
+  if ((account_balance_intervals_map == NULL) || (*account_balance_intervals_map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*account_balance_intervals_map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *account_balance_intervals_map = NULL;
+    return;
+  }
+}
+
+void
+cardano_account_balance_intervals_map_ref(cardano_account_balance_intervals_map_t* account_balance_intervals_map)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&account_balance_intervals_map->base);
+}
+
+size_t
+cardano_account_balance_intervals_map_refcount(const cardano_account_balance_intervals_map_t* account_balance_intervals_map)
+{
+  if (account_balance_intervals_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&account_balance_intervals_map->base);
+}
+
+void
+cardano_account_balance_intervals_map_set_last_error(cardano_account_balance_intervals_map_t* account_balance_intervals_map, const char* message)
+{
+  cardano_object_set_last_error(&account_balance_intervals_map->base, message);
+}
+
+const char*
+cardano_account_balance_intervals_map_get_last_error(const cardano_account_balance_intervals_map_t* account_balance_intervals_map)
+{
+  return cardano_object_get_last_error(&account_balance_intervals_map->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_account_balance_intervals_map_kvp_deep_clone(const cardano_account_balance_intervals_map_kvp_t* source, cardano_account_balance_intervals_map_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_account_balance_intervals_map_kvp_t* copy = _cardano_malloc(sizeof(cardano_account_balance_intervals_map_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = NULL;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_reward_address_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_account_balance_interval_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_account_balance_intervals_map_kvp_t* copy   = NULL;
+  const cardano_error_t                        result = cardano_account_balance_intervals_map_kvp_deep_clone((const cardano_account_balance_intervals_map_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_account_balance_intervals_map_deep_clone(const cardano_account_balance_intervals_map_t* source, cardano_account_balance_intervals_map_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_account_balance_intervals_map_t* copy = _cardano_malloc(sizeof(cardano_account_balance_intervals_map_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/direct_deposit_map.c b/vendor/src/transaction_body/direct_deposit_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/direct_deposit_map.c
@@ -0,0 +1,875 @@
+/**
+ * \file direct_deposit_map.c
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/transaction_body/direct_deposit_map.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a map of reward address to lovelace amount.
+ */
+typedef struct cardano_direct_deposit_map_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_direct_deposit_map_t;
+
+/**
+ * \brief Represents a reward address to lovelace amount key value pair.
+ */
+typedef struct cardano_direct_deposit_map_kvp_t
+{
+    cardano_object_t          base;
+    cardano_reward_address_t* key;
+    uint64_t                  value;
+} cardano_direct_deposit_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a direct deposit map object.
+ *
+ * This function is responsible for properly deallocating a direct deposit map object (`cardano_direct_deposit_map_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the direct_deposit_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_direct_deposit_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the direct_deposit_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_direct_deposit_map_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_direct_deposit_map_t* map = (cardano_direct_deposit_map_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a direct deposit map key value pair object.
+ *
+ * This function is responsible for properly deallocating a direct deposit map key value pair object
+ * (`cardano_direct_deposit_map_kvp_t`) and its associated resources.
+ *
+ * \param object A void pointer to the direct_deposit_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_direct_deposit_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the direct_deposit_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_direct_deposit_map_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_direct_deposit_map_kvp_t* map = (cardano_direct_deposit_map_kvp_t*)object;
+
+  if (map->key != NULL)
+  {
+    cardano_reward_address_unref(&map->key);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two reward addresses based on their serialized bytes.
+ *
+ * \param[in] lhs Pointer to the first reward address object.
+ * \param[in] rhs Pointer to the second reward address object.
+ *
+ * \return true if the addresses are equal, false otherwise.
+ */
+static bool
+reward_address_equals(const cardano_reward_address_t* lhs, const cardano_reward_address_t* rhs)
+{
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  const size_t lhs_size = cardano_reward_address_get_bytes_size(lhs);
+  const size_t rhs_size = cardano_reward_address_get_bytes_size(rhs);
+
+  if (lhs_size != rhs_size)
+  {
+    return false;
+  }
+
+  const uint8_t* lhs_bytes = cardano_reward_address_get_bytes(lhs);
+  const uint8_t* rhs_bytes = cardano_reward_address_get_bytes(rhs);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size) == 0;
+}
+
+/**
+ * \brief Compares two cardano_direct_deposit_map_kvp_t objects based on their reward_address.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the address of lhs is less than the address of rhs, zero if they are equal,
+ *         and a positive value if the address of lhs is greater than the address of rhs.
+ */
+static int32_t
+compare_by_bytes(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_direct_deposit_map_kvp_t* lhs_kvp = (const cardano_direct_deposit_map_kvp_t*)((const void*)lhs);
+  const cardano_direct_deposit_map_kvp_t* rhs_kvp = (const cardano_direct_deposit_map_kvp_t*)((const void*)rhs);
+
+  const size_t lhs_size = cardano_reward_address_get_bytes_size(lhs_kvp->key);
+  const size_t rhs_size = cardano_reward_address_get_bytes_size(rhs_kvp->key);
+
+  if (lhs_size != rhs_size)
+  {
+    return (lhs_size < rhs_size) ? -1 : 1;
+  }
+
+  const uint8_t* lhs_bytes = cardano_reward_address_get_bytes(lhs_kvp->key);
+  const uint8_t* rhs_bytes = cardano_reward_address_get_bytes(rhs_kvp->key);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_direct_deposit_map_new(cardano_direct_deposit_map_t** direct_deposit_map)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_direct_deposit_map_t* map = _cardano_malloc(sizeof(cardano_direct_deposit_map_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_direct_deposit_map_deallocate;
+
+  map->array = cardano_array_new(32);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *direct_deposit_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_direct_deposit_map_from_cbor(cardano_cbor_reader_t* reader, cardano_direct_deposit_map_t** direct_deposit_map)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (direct_deposit_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_direct_deposit_map_t* map    = NULL;
+  cardano_error_t               result = cardano_direct_deposit_map_new(&map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_map(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_direct_deposit_map_unref(&map);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_direct_deposit_map_unref(&map);
+    return result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'direct_deposit_map', the map must not be empty.");
+    cardano_direct_deposit_map_unref(&map);
+
+    return CARDANO_ERROR_INVALID_CBOR_MAP_SIZE;
+  }
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_direct_deposit_map_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_reward_address_t* key   = NULL;
+    uint64_t                  value = 0;
+
+    cardano_buffer_t* reward_address_bytes = NULL;
+
+    result = cardano_cbor_reader_read_bytestring(reader, &reward_address_bytes);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_direct_deposit_map_unref(&map);
+      return result;
+    }
+
+    result = cardano_reward_address_from_bytes(cardano_buffer_get_data(reward_address_bytes), cardano_buffer_get_size(reward_address_bytes), &key);
+
+    cardano_buffer_unref(&reward_address_bytes);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_direct_deposit_map_unref(&map);
+      return result;
+    }
+
+    result = cardano_cbor_reader_read_uint(reader, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_reward_address_unref(&key);
+      cardano_direct_deposit_map_unref(&map);
+      return result;
+    }
+
+    result = cardano_direct_deposit_map_insert(map, key, value);
+
+    cardano_reward_address_unref(&key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'direct_deposit_map', the map must not contain duplicated keys.");
+      cardano_direct_deposit_map_unref(&map);
+
+      return result;
+    }
+  }
+
+  result = cardano_cbor_validate_end_map("direct_deposit_map", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_direct_deposit_map_unref(&map);
+    return result;
+  }
+
+  *direct_deposit_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_direct_deposit_map_to_cbor(const cardano_direct_deposit_map_t* direct_deposit_map, cardano_cbor_writer_t* writer)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t map_size = cardano_array_get_size(direct_deposit_map->array);
+  result          = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(direct_deposit_map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(direct_deposit_map->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in direct deposit map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_direct_deposit_map_kvp_t* kvp_data = (cardano_direct_deposit_map_kvp_t*)((void*)kvp);
+
+    result = cardano_cbor_writer_write_bytestring(writer, cardano_reward_address_get_bytes(kvp_data->key), cardano_reward_address_get_bytes_size(kvp_data->key));
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, kvp_data->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    cardano_object_unref(&kvp);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_direct_deposit_map_get_length(const cardano_direct_deposit_map_t* direct_deposit_map)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(direct_deposit_map->array);
+}
+
+cardano_error_t
+cardano_direct_deposit_map_get(
+  const cardano_direct_deposit_map_t* direct_deposit_map,
+  cardano_reward_address_t*           key,
+  uint64_t*                           element)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(direct_deposit_map->array); ++i)
+  {
+    cardano_object_t*                 object = cardano_array_get(direct_deposit_map->array, i);
+    cardano_direct_deposit_map_kvp_t* kvp    = (cardano_direct_deposit_map_kvp_t*)((void*)object);
+
+    if (reward_address_equals(kvp->key, key))
+    {
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_direct_deposit_map_insert(
+  cardano_direct_deposit_map_t* direct_deposit_map,
+  cardano_reward_address_t*     key,
+  const uint64_t                value)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(direct_deposit_map->array); ++i)
+  {
+    cardano_object_t*                 object = cardano_array_get(direct_deposit_map->array, i);
+    cardano_direct_deposit_map_kvp_t* kvp    = (cardano_direct_deposit_map_kvp_t*)((void*)object);
+
+    const bool duplicated = reward_address_equals(kvp->key, key);
+
+    cardano_object_unref(&object);
+
+    if (duplicated)
+    {
+      return CARDANO_ERROR_DUPLICATED_KEY;
+    }
+  }
+
+  cardano_direct_deposit_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_direct_deposit_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_direct_deposit_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_reward_address_ref(key);
+
+  const size_t old_size = cardano_array_get_size(direct_deposit_map->array);
+  const size_t new_size = cardano_array_push(direct_deposit_map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_direct_deposit_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(direct_deposit_map->array, compare_by_bytes, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_direct_deposit_map_insert_ex(
+  cardano_direct_deposit_map_t* direct_deposit_map,
+  const char*                   reward_address,
+  size_t                        reward_address_size,
+  const uint64_t                value)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_t* key = NULL;
+
+  cardano_error_t result = cardano_reward_address_from_bech32(reward_address, reward_address_size, &key);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_direct_deposit_map_insert(direct_deposit_map, key, value);
+
+  cardano_reward_address_unref(&key);
+
+  return result;
+}
+
+cardano_error_t
+cardano_direct_deposit_map_get_keys(
+  cardano_direct_deposit_map_t*   direct_deposit_map,
+  cardano_reward_address_list_t** keys)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_list_t* list = NULL;
+
+  cardano_error_t result = cardano_reward_address_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(direct_deposit_map->array); ++i)
+  {
+    cardano_object_t*                 object = cardano_array_get(direct_deposit_map->array, i);
+    cardano_direct_deposit_map_kvp_t* kvp    = (cardano_direct_deposit_map_kvp_t*)((void*)object);
+
+    result = cardano_reward_address_list_add(list, kvp->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_reward_address_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_direct_deposit_map_get_key_at(
+  const cardano_direct_deposit_map_t* direct_deposit_map,
+  const size_t                        index,
+  cardano_reward_address_t**          reward_address)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(direct_deposit_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                 object = cardano_array_get(direct_deposit_map->array, index);
+  cardano_direct_deposit_map_kvp_t* kvp    = (cardano_direct_deposit_map_kvp_t*)((void*)object);
+
+  cardano_reward_address_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *reward_address = kvp->key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_direct_deposit_map_get_value_at(
+  const cardano_direct_deposit_map_t* direct_deposit_map,
+  const size_t                        index,
+  uint64_t*                           amount)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(direct_deposit_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                 object = cardano_array_get(direct_deposit_map->array, index);
+  cardano_direct_deposit_map_kvp_t* kvp    = (cardano_direct_deposit_map_kvp_t*)((void*)object);
+
+  cardano_object_unref(&object);
+
+  *amount = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_direct_deposit_map_get_key_value_at(
+  const cardano_direct_deposit_map_t* direct_deposit_map,
+  const size_t                        index,
+  cardano_reward_address_t**          reward_address,
+  uint64_t*                           amount)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reward_address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(direct_deposit_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                 object = cardano_array_get(direct_deposit_map->array, index);
+  cardano_direct_deposit_map_kvp_t* kvp    = (cardano_direct_deposit_map_kvp_t*)((void*)object);
+
+  cardano_reward_address_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *reward_address = kvp->key;
+  *amount         = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_direct_deposit_map_to_cip116_json(const cardano_direct_deposit_map_t* value, cardano_json_writer_t* writer)
+{
+  if ((value == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0U; i < cardano_array_get_size(value->array); ++i)
+  {
+    cardano_object_t* entry = cardano_array_get(value->array, i);
+
+    if (entry == NULL)
+    {
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    const cardano_direct_deposit_map_kvp_t* pair = (const cardano_direct_deposit_map_kvp_t*)((const void*)entry);
+
+    cardano_json_writer_write_start_object(writer);
+    cardano_json_writer_write_property_name(writer, "key", 3);
+    const char*  address = cardano_reward_address_get_string(pair->key);
+    const size_t size    = cardano_safe_strlen(address, cardano_reward_address_get_bech32_size(pair->key));
+    cardano_json_writer_write_string(writer, address, size);
+    cardano_json_writer_write_property_name(writer, "value", 5);
+    cardano_json_writer_write_uint_as_string(writer, pair->value);
+    cardano_json_writer_write_end_object(writer);
+    cardano_object_unref(&entry);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_direct_deposit_map_unref(cardano_direct_deposit_map_t** direct_deposit_map)
+{
+  if ((direct_deposit_map == NULL) || (*direct_deposit_map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*direct_deposit_map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *direct_deposit_map = NULL;
+    return;
+  }
+}
+
+void
+cardano_direct_deposit_map_ref(cardano_direct_deposit_map_t* direct_deposit_map)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&direct_deposit_map->base);
+}
+
+size_t
+cardano_direct_deposit_map_refcount(const cardano_direct_deposit_map_t* direct_deposit_map)
+{
+  if (direct_deposit_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&direct_deposit_map->base);
+}
+
+void
+cardano_direct_deposit_map_set_last_error(cardano_direct_deposit_map_t* direct_deposit_map, const char* message)
+{
+  cardano_object_set_last_error(&direct_deposit_map->base, message);
+}
+
+const char*
+cardano_direct_deposit_map_get_last_error(const cardano_direct_deposit_map_t* direct_deposit_map)
+{
+  return cardano_object_get_last_error(&direct_deposit_map->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_direct_deposit_map_kvp_deep_clone(const cardano_direct_deposit_map_kvp_t* source, cardano_direct_deposit_map_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_direct_deposit_map_kvp_t* copy = _cardano_malloc(sizeof(cardano_direct_deposit_map_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = source->value;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_reward_address_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_direct_deposit_map_kvp_t* copy   = NULL;
+  const cardano_error_t             result = cardano_direct_deposit_map_kvp_deep_clone((const cardano_direct_deposit_map_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_direct_deposit_map_deep_clone(const cardano_direct_deposit_map_t* source, cardano_direct_deposit_map_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_direct_deposit_map_t* copy = _cardano_malloc(sizeof(cardano_direct_deposit_map_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/internals/body_fields.c b/vendor/src/transaction_body/internals/body_fields.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/internals/body_fields.c
@@ -0,0 +1,714 @@
+/**
+ * \file body_fields.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "body_fields.h"
+
+#include <assert.h>
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_body_read_inputs(cardano_cbor_reader_t* reader, cardano_transaction_input_set_t** inputs)
+{
+  assert(reader != NULL);
+  assert(inputs != NULL);
+
+  return cardano_transaction_input_set_from_cbor(reader, inputs);
+}
+
+cardano_error_t
+cardano_body_read_outputs(cardano_cbor_reader_t* reader, cardano_transaction_output_list_t** outputs)
+{
+  assert(reader != NULL);
+  assert(outputs != NULL);
+
+  return cardano_transaction_output_list_from_cbor(reader, outputs);
+}
+
+cardano_error_t
+cardano_body_read_ttl(cardano_cbor_reader_t* reader, uint64_t* ttl)
+{
+  assert(reader != NULL);
+  assert(ttl != NULL);
+
+  return cardano_cbor_reader_read_uint(reader, ttl);
+}
+
+cardano_error_t
+cardano_body_read_certificates(cardano_cbor_reader_t* reader, cardano_certificate_set_t** certificates)
+{
+  assert(reader != NULL);
+  assert(certificates != NULL);
+
+  return cardano_certificate_set_from_cbor(reader, certificates);
+}
+
+cardano_error_t
+cardano_body_read_withdrawals(cardano_cbor_reader_t* reader, cardano_withdrawal_map_t** withdrawals)
+{
+  assert(reader != NULL);
+  assert(withdrawals != NULL);
+
+  return cardano_withdrawal_map_from_cbor(reader, withdrawals);
+}
+
+cardano_error_t
+cardano_body_read_aux_data_hash(cardano_cbor_reader_t* reader, cardano_blake2b_hash_t** aux_data_hash)
+{
+  assert(reader != NULL);
+  assert(aux_data_hash != NULL);
+
+  return cardano_blake2b_hash_from_cbor(reader, aux_data_hash);
+}
+
+cardano_error_t
+cardano_body_read_validity_start(cardano_cbor_reader_t* reader, uint64_t* validity_start)
+{
+  assert(reader != NULL);
+  assert(validity_start != NULL);
+
+  return cardano_cbor_reader_read_uint(reader, validity_start);
+}
+
+cardano_error_t
+cardano_body_read_mint(cardano_cbor_reader_t* reader, cardano_multi_asset_t** mint)
+{
+  assert(reader != NULL);
+  assert(mint != NULL);
+
+  return cardano_multi_asset_from_cbor(reader, mint);
+}
+
+cardano_error_t
+cardano_body_read_script_data_hash(cardano_cbor_reader_t* reader, cardano_blake2b_hash_t** script_data_hash)
+{
+  assert(reader != NULL);
+  assert(script_data_hash != NULL);
+
+  return cardano_blake2b_hash_from_cbor(reader, script_data_hash);
+}
+
+cardano_error_t
+cardano_body_read_guards(cardano_cbor_reader_t* reader, cardano_guard_set_t** guards)
+{
+  assert(reader != NULL);
+  assert(guards != NULL);
+
+  return cardano_guard_set_from_cbor(reader, guards);
+}
+
+cardano_error_t
+cardano_body_read_network_id(cardano_cbor_reader_t* reader, cardano_network_id_t* network_id)
+{
+  assert(reader != NULL);
+  assert(network_id != NULL);
+
+  return cardano_cbor_reader_read_uint(reader, (uint64_t*)((void*)network_id));
+}
+
+cardano_error_t
+cardano_body_read_reference_inputs(cardano_cbor_reader_t* reader, cardano_transaction_input_set_t** reference_inputs)
+{
+  assert(reader != NULL);
+  assert(reference_inputs != NULL);
+
+  return cardano_transaction_input_set_from_cbor(reader, reference_inputs);
+}
+
+cardano_error_t
+cardano_body_read_voting_procedures(cardano_cbor_reader_t* reader, cardano_voting_procedures_t** voting_procedures)
+{
+  assert(reader != NULL);
+  assert(voting_procedures != NULL);
+
+  return cardano_voting_procedures_from_cbor(reader, voting_procedures);
+}
+
+cardano_error_t
+cardano_body_read_proposal_procedures(cardano_cbor_reader_t* reader, cardano_proposal_procedure_set_t** proposal_procedures)
+{
+  assert(reader != NULL);
+  assert(proposal_procedures != NULL);
+
+  return cardano_proposal_procedure_set_from_cbor(reader, proposal_procedures);
+}
+
+cardano_error_t
+cardano_body_read_treasury_value(cardano_cbor_reader_t* reader, uint64_t* treasury_value)
+{
+  assert(reader != NULL);
+  assert(treasury_value != NULL);
+
+  return cardano_cbor_reader_read_uint(reader, treasury_value);
+}
+
+cardano_error_t
+cardano_body_read_donation(cardano_cbor_reader_t* reader, uint64_t* donation)
+{
+  assert(reader != NULL);
+  assert(donation != NULL);
+
+  return cardano_cbor_reader_read_uint(reader, donation);
+}
+
+cardano_error_t
+cardano_body_read_required_top_level_guards(cardano_cbor_reader_t* reader, cardano_required_guards_map_t** required_top_level_guards)
+{
+  assert(reader != NULL);
+  assert(required_top_level_guards != NULL);
+
+  return cardano_required_guards_map_from_cbor(reader, required_top_level_guards);
+}
+
+cardano_error_t
+cardano_body_read_direct_deposits(cardano_cbor_reader_t* reader, cardano_direct_deposit_map_t** direct_deposits)
+{
+  assert(reader != NULL);
+  assert(direct_deposits != NULL);
+
+  return cardano_direct_deposit_map_from_cbor(reader, direct_deposits);
+}
+
+cardano_error_t
+cardano_body_read_account_balance_intervals(cardano_cbor_reader_t* reader, cardano_account_balance_intervals_map_t** account_balance_intervals)
+{
+  assert(reader != NULL);
+  assert(account_balance_intervals != NULL);
+
+  return cardano_account_balance_intervals_map_from_cbor(reader, account_balance_intervals);
+}
+
+cardano_error_t
+cardano_body_read_starting_account_balance_intervals(cardano_cbor_reader_t* reader, cardano_account_balance_intervals_map_t** starting_account_balance_intervals)
+{
+  assert(reader != NULL);
+  assert(starting_account_balance_intervals != NULL);
+
+  return cardano_account_balance_intervals_map_from_cbor(reader, starting_account_balance_intervals);
+}
+
+cardano_error_t
+cardano_body_write_inputs_if_present(cardano_cbor_writer_t* writer, const cardano_transaction_input_set_t* inputs)
+{
+  assert(writer != NULL);
+
+  if (inputs != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 0U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_transaction_input_set_to_cbor(inputs, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_outputs_if_present(cardano_cbor_writer_t* writer, const cardano_transaction_output_list_t* outputs)
+{
+  assert(writer != NULL);
+
+  if (outputs != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 1U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_transaction_output_list_to_cbor(outputs, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_ttl_if_present(cardano_cbor_writer_t* writer, const uint64_t* ttl)
+{
+  assert(writer != NULL);
+
+  if (ttl != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 3U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, *ttl);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_certificates_if_present(cardano_cbor_writer_t* writer, const cardano_certificate_set_t* certificates)
+{
+  assert(writer != NULL);
+
+  if (certificates != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 4U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_certificate_set_to_cbor(certificates, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_withdrawals_if_present(cardano_cbor_writer_t* writer, const cardano_withdrawal_map_t* withdrawals)
+{
+  assert(writer != NULL);
+
+  if (withdrawals != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 5U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_withdrawal_map_to_cbor(withdrawals, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_aux_data_hash_if_present(cardano_cbor_writer_t* writer, const cardano_blake2b_hash_t* aux_data_hash)
+{
+  assert(writer != NULL);
+
+  if (aux_data_hash != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 7U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_blake2b_hash_to_cbor(aux_data_hash, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_validity_start_if_present(cardano_cbor_writer_t* writer, const uint64_t* validity_start)
+{
+  assert(writer != NULL);
+
+  if (validity_start != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 8U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, *validity_start);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_mint_if_present(cardano_cbor_writer_t* writer, const cardano_multi_asset_t* mint)
+{
+  assert(writer != NULL);
+
+  if (mint != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 9U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_multi_asset_to_cbor(mint, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_script_data_hash_if_present(cardano_cbor_writer_t* writer, const cardano_blake2b_hash_t* script_data_hash)
+{
+  assert(writer != NULL);
+
+  if (script_data_hash != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 11U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_blake2b_hash_to_cbor(script_data_hash, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_guards_if_present(cardano_cbor_writer_t* writer, const cardano_guard_set_t* guards)
+{
+  assert(writer != NULL);
+
+  if (cardano_body_has_guards(guards))
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 14U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_guard_set_to_cbor(guards, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_body_has_guards(const cardano_guard_set_t* guards)
+{
+  return (guards != NULL) && (cardano_guard_set_get_length(guards) > 0U);
+}
+
+cardano_error_t
+cardano_body_write_network_id_if_present(cardano_cbor_writer_t* writer, const cardano_network_id_t* network_id)
+{
+  assert(writer != NULL);
+
+  if (network_id != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 15U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, *network_id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_reference_inputs_if_present(cardano_cbor_writer_t* writer, const cardano_transaction_input_set_t* reference_inputs)
+{
+  assert(writer != NULL);
+
+  if (reference_inputs != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 18U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_transaction_input_set_to_cbor(reference_inputs, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_voting_procedures_if_present(cardano_cbor_writer_t* writer, const cardano_voting_procedures_t* voting_procedures)
+{
+  assert(writer != NULL);
+
+  if (voting_procedures != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 19U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_voting_procedures_to_cbor(voting_procedures, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_proposal_procedures_if_present(cardano_cbor_writer_t* writer, const cardano_proposal_procedure_set_t* proposal_procedures)
+{
+  assert(writer != NULL);
+
+  if (proposal_procedures != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 20U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_proposal_procedure_set_to_cbor(proposal_procedures, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_treasury_value_if_present(cardano_cbor_writer_t* writer, const uint64_t* treasury_value)
+{
+  assert(writer != NULL);
+
+  if (treasury_value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 21U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, *treasury_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_donation_if_present(cardano_cbor_writer_t* writer, const uint64_t* donation)
+{
+  assert(writer != NULL);
+
+  if (donation != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 22U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, *donation);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_required_top_level_guards_if_present(cardano_cbor_writer_t* writer, const cardano_required_guards_map_t* required_top_level_guards)
+{
+  assert(writer != NULL);
+
+  if (required_top_level_guards != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 24U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_required_guards_map_to_cbor(required_top_level_guards, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_direct_deposits_if_present(cardano_cbor_writer_t* writer, const cardano_direct_deposit_map_t* direct_deposits)
+{
+  assert(writer != NULL);
+
+  if (direct_deposits != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 25U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_direct_deposit_map_to_cbor(direct_deposits, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_account_balance_intervals_if_present(cardano_cbor_writer_t* writer, const cardano_account_balance_intervals_map_t* account_balance_intervals)
+{
+  assert(writer != NULL);
+
+  if (account_balance_intervals != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 26U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_account_balance_intervals_map_to_cbor(account_balance_intervals, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_body_write_starting_account_balance_intervals_if_present(cardano_cbor_writer_t* writer, const cardano_account_balance_intervals_map_t* starting_account_balance_intervals)
+{
+  assert(writer != NULL);
+
+  if (starting_account_balance_intervals != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, 27U);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_account_balance_intervals_map_to_cbor(starting_account_balance_intervals, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/internals/body_fields.h b/vendor/src/transaction_body/internals/body_fields.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/internals/body_fields.h
@@ -0,0 +1,732 @@
+/**
+ * \file body_fields.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BODY_FIELDS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BODY_FIELDS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/multi_asset.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/certs/certificate_set.h>
+#include <cardano/common/guard_set.h>
+#include <cardano/common/network_id.h>
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/proposal_procedures/proposal_procedure_set.h>
+#include <cardano/transaction_body/account_balance_intervals_map.h>
+#include <cardano/transaction_body/direct_deposit_map.h>
+#include <cardano/transaction_body/required_guards_map.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+#include <cardano/voting_procedures/voting_procedures.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Reads the wire form of a body inputs field value.
+ *
+ * This function decodes a transaction input set from the given CBOR reader. The map key is
+ * expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] inputs On success, points to the decoded transaction input set. The caller owns
+ *                    the returned reference and must release it. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_inputs(cardano_cbor_reader_t* reader, cardano_transaction_input_set_t** inputs);
+
+/**
+ * \brief Reads the wire form of a body outputs field value.
+ *
+ * This function decodes a transaction output list from the given CBOR reader. The map key is
+ * expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] outputs On success, points to the decoded transaction output list. The caller owns
+ *                     the returned reference and must release it. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_outputs(cardano_cbor_reader_t* reader, cardano_transaction_output_list_t** outputs);
+
+/**
+ * \brief Reads the wire form of a body time to live field value.
+ *
+ * This function decodes an unsigned integer from the given CBOR reader and stores it in \p ttl.
+ * The map key is expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] ttl A pointer to the storage that receives the decoded value. This parameter must
+ *                 not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_ttl(cardano_cbor_reader_t* reader, uint64_t* ttl);
+
+/**
+ * \brief Reads the wire form of a body certificates field value.
+ *
+ * This function decodes a certificate set from the given CBOR reader. The map key is expected
+ * to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] certificates On success, points to the decoded certificate set. The caller owns
+ *                          the returned reference and must release it. This parameter must not
+ *                          be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_certificates(cardano_cbor_reader_t* reader, cardano_certificate_set_t** certificates);
+
+/**
+ * \brief Reads the wire form of a body withdrawals field value.
+ *
+ * This function decodes a withdrawal map from the given CBOR reader. The map key is expected
+ * to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] withdrawals On success, points to the decoded withdrawal map. The caller owns the
+ *                         returned reference and must release it. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_withdrawals(cardano_cbor_reader_t* reader, cardano_withdrawal_map_t** withdrawals);
+
+/**
+ * \brief Reads the wire form of a body auxiliary data hash field value.
+ *
+ * This function decodes a blake2b hash from the given CBOR reader. The map key is expected to
+ * have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] aux_data_hash On success, points to the decoded hash. The caller owns the returned
+ *                           reference and must release it. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_aux_data_hash(cardano_cbor_reader_t* reader, cardano_blake2b_hash_t** aux_data_hash);
+
+/**
+ * \brief Reads the wire form of a body validity start interval field value.
+ *
+ * This function decodes an unsigned integer from the given CBOR reader and stores it in
+ * \p validity_start. The map key is expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] validity_start A pointer to the storage that receives the decoded value. This
+ *                            parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_validity_start(cardano_cbor_reader_t* reader, uint64_t* validity_start);
+
+/**
+ * \brief Reads the wire form of a body mint field value.
+ *
+ * This function decodes a multi asset from the given CBOR reader. The map key is expected to
+ * have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] mint On success, points to the decoded multi asset. The caller owns the returned
+ *                  reference and must release it. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_mint(cardano_cbor_reader_t* reader, cardano_multi_asset_t** mint);
+
+/**
+ * \brief Reads the wire form of a body script data hash field value.
+ *
+ * This function decodes a blake2b hash from the given CBOR reader. The map key is expected to
+ * have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] script_data_hash On success, points to the decoded hash. The caller owns the
+ *                              returned reference and must release it. This parameter must not
+ *                              be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_script_data_hash(cardano_cbor_reader_t* reader, cardano_blake2b_hash_t** script_data_hash);
+
+/**
+ * \brief Reads the wire form of a body guards field value.
+ *
+ * This function decodes a guard set from the given CBOR reader. The map key is expected to have
+ * already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] guards On success, points to the decoded guard set. The caller owns the returned
+ *                    reference and must release it. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_guards(cardano_cbor_reader_t* reader, cardano_guard_set_t** guards);
+
+/**
+ * \brief Reads the wire form of a body network id field value.
+ *
+ * This function decodes an unsigned integer from the given CBOR reader and stores it in the
+ * storage pointed to by \p network_id. The map key is expected to have already been consumed by
+ * the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] network_id A pointer to the storage that receives the decoded value. The storage
+ *                        must be at least the size of an unsigned 64 bit integer. This parameter
+ *                        must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_network_id(cardano_cbor_reader_t* reader, cardano_network_id_t* network_id);
+
+/**
+ * \brief Reads the wire form of a body reference inputs field value.
+ *
+ * This function decodes a transaction input set from the given CBOR reader. The map key is
+ * expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] reference_inputs On success, points to the decoded transaction input set. The
+ *                              caller owns the returned reference and must release it. This
+ *                              parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_reference_inputs(cardano_cbor_reader_t* reader, cardano_transaction_input_set_t** reference_inputs);
+
+/**
+ * \brief Reads the wire form of a body voting procedures field value.
+ *
+ * This function decodes a voting procedures object from the given CBOR reader. The map key is
+ * expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] voting_procedures On success, points to the decoded voting procedures. The caller
+ *                               owns the returned reference and must release it. This parameter
+ *                               must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_voting_procedures(cardano_cbor_reader_t* reader, cardano_voting_procedures_t** voting_procedures);
+
+/**
+ * \brief Reads the wire form of a body proposal procedures field value.
+ *
+ * This function decodes a proposal procedure set from the given CBOR reader. The map key is
+ * expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] proposal_procedures On success, points to the decoded proposal procedure set. The
+ *                                 caller owns the returned reference and must release it. This
+ *                                 parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_proposal_procedures(cardano_cbor_reader_t* reader, cardano_proposal_procedure_set_t** proposal_procedures);
+
+/**
+ * \brief Reads the wire form of a body treasury value field value.
+ *
+ * This function decodes an unsigned integer from the given CBOR reader and stores it in
+ * \p treasury_value. The map key is expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] treasury_value A pointer to the storage that receives the decoded value. This
+ *                            parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_treasury_value(cardano_cbor_reader_t* reader, uint64_t* treasury_value);
+
+/**
+ * \brief Reads the wire form of a body donation field value.
+ *
+ * This function decodes an unsigned integer from the given CBOR reader and stores it in
+ * \p donation. The map key is expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] donation A pointer to the storage that receives the decoded value. This parameter
+ *                      must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_donation(cardano_cbor_reader_t* reader, uint64_t* donation);
+
+/**
+ * \brief Reads the wire form of a body required top level guards field value.
+ *
+ * This function decodes a required guards map from the given CBOR reader. The map key is
+ * expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] required_top_level_guards On success, points to the decoded required guards map.
+ *                                       The caller owns the returned reference and must release
+ *                                       it. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_required_top_level_guards(cardano_cbor_reader_t* reader, cardano_required_guards_map_t** required_top_level_guards);
+
+/**
+ * \brief Reads the wire form of a body direct deposits field value.
+ *
+ * This function decodes a direct deposit map from the given CBOR reader. The map key is expected
+ * to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] direct_deposits On success, points to the decoded direct deposit map. The caller
+ *                             owns the returned reference and must release it. This parameter
+ *                             must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_direct_deposits(cardano_cbor_reader_t* reader, cardano_direct_deposit_map_t** direct_deposits);
+
+/**
+ * \brief Reads the wire form of a body account balance intervals field value.
+ *
+ * This function decodes an account balance intervals map from the given CBOR reader. The map key
+ * is expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] account_balance_intervals On success, points to the decoded account balance
+ *                                       intervals map. The caller owns the returned reference and
+ *                                       must release it. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_account_balance_intervals(cardano_cbor_reader_t* reader, cardano_account_balance_intervals_map_t** account_balance_intervals);
+
+/**
+ * \brief Reads the wire form of a body starting account balance intervals field value.
+ *
+ * This function decodes a starting account balance intervals map from the given CBOR reader. The
+ * map key is expected to have already been consumed by the caller.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the field value. This parameter
+ *                   must not be NULL.
+ * \param[out] starting_account_balance_intervals On success, points to the decoded starting
+ *                                                account balance intervals map. The caller owns
+ *                                                the returned reference and must release it.
+ *                                                This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value was decoded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_body_read_starting_account_balance_intervals(cardano_cbor_reader_t* reader, cardano_account_balance_intervals_map_t** starting_account_balance_intervals);
+
+/**
+ * \brief Writes a body inputs field as a key value pair when the value is present.
+ *
+ * This function writes map key 0 followed by the CBOR encoding of \p inputs to the given writer.
+ * If \p inputs is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] inputs A pointer to the transaction input set to write. If NULL, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_inputs_if_present(cardano_cbor_writer_t* writer, const cardano_transaction_input_set_t* inputs);
+
+/**
+ * \brief Writes a body outputs field as a key value pair when the value is present.
+ *
+ * This function writes map key 1 followed by the CBOR encoding of \p outputs to the given writer.
+ * If \p outputs is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] outputs A pointer to the transaction output list to write. If NULL, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_outputs_if_present(cardano_cbor_writer_t* writer, const cardano_transaction_output_list_t* outputs);
+
+/**
+ * \brief Writes a body time to live field as a key value pair when the value is present.
+ *
+ * This function writes map key 3 followed by the CBOR encoding of \p ttl to the given writer.
+ * If \p ttl is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] ttl A pointer to the unsigned integer value to write. If NULL, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_ttl_if_present(cardano_cbor_writer_t* writer, const uint64_t* ttl);
+
+/**
+ * \brief Writes a body certificates field as a key value pair when the value is present.
+ *
+ * This function writes map key 4 followed by the CBOR encoding of \p certificates to the given
+ * writer. If \p certificates is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] certificates A pointer to the certificate set to write. If NULL, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_certificates_if_present(cardano_cbor_writer_t* writer, const cardano_certificate_set_t* certificates);
+
+/**
+ * \brief Writes a body withdrawals field as a key value pair when the value is present.
+ *
+ * This function writes map key 5 followed by the CBOR encoding of \p withdrawals to the given
+ * writer. If \p withdrawals is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] withdrawals A pointer to the withdrawal map to write. If NULL, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_withdrawals_if_present(cardano_cbor_writer_t* writer, const cardano_withdrawal_map_t* withdrawals);
+
+/**
+ * \brief Writes a body auxiliary data hash field as a key value pair when the value is present.
+ *
+ * This function writes map key 7 followed by the CBOR encoding of \p aux_data_hash to the given
+ * writer. If \p aux_data_hash is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] aux_data_hash A pointer to the blake2b hash to write. If NULL, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_aux_data_hash_if_present(cardano_cbor_writer_t* writer, const cardano_blake2b_hash_t* aux_data_hash);
+
+/**
+ * \brief Writes a body validity start interval field as a key value pair when the value is present.
+ *
+ * This function writes map key 8 followed by the CBOR encoding of \p validity_start to the given
+ * writer. If \p validity_start is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] validity_start A pointer to the unsigned integer value to write. If NULL, nothing is
+ *                           written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_validity_start_if_present(cardano_cbor_writer_t* writer, const uint64_t* validity_start);
+
+/**
+ * \brief Writes a body mint field as a key value pair when the value is present.
+ *
+ * This function writes map key 9 followed by the CBOR encoding of \p mint to the given writer.
+ * If \p mint is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] mint A pointer to the multi asset to write. If NULL, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_mint_if_present(cardano_cbor_writer_t* writer, const cardano_multi_asset_t* mint);
+
+/**
+ * \brief Writes a body script data hash field as a key value pair when the value is present.
+ *
+ * This function writes map key 11 followed by the CBOR encoding of \p script_data_hash to the
+ * given writer. If \p script_data_hash is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] script_data_hash A pointer to the blake2b hash to write. If NULL, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_script_data_hash_if_present(cardano_cbor_writer_t* writer, const cardano_blake2b_hash_t* script_data_hash);
+
+/**
+ * \brief Writes a body guards field as a key value pair when the value is present.
+ *
+ * This function writes map key 14 followed by the CBOR encoding of \p guards to the given writer.
+ * If \p guards is NULL or empty, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] guards A pointer to the guard set to write. If NULL or empty, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_guards_if_present(cardano_cbor_writer_t* writer, const cardano_guard_set_t* guards);
+
+/**
+ * \brief Checks whether a body guards field is encoded.
+ *
+ * A guard set is encoded at map key 14 only when it holds at least one guard. An empty guard set is treated as
+ * absent, because the Conway and Dijkstra eras reject an explicitly empty set at that key.
+ *
+ * \param[in] guards A pointer to the guard set to check. If NULL, the field is absent.
+ *
+ * \return True if \p guards is not NULL and holds at least one guard, false otherwise.
+ */
+bool
+cardano_body_has_guards(const cardano_guard_set_t* guards);
+
+/**
+ * \brief Writes a body network id field as a key value pair when the value is present.
+ *
+ * This function writes map key 15 followed by the CBOR encoding of \p network_id to the given
+ * writer. If \p network_id is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] network_id A pointer to the network id value to write. If NULL, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_network_id_if_present(cardano_cbor_writer_t* writer, const cardano_network_id_t* network_id);
+
+/**
+ * \brief Writes a body reference inputs field as a key value pair when the value is present.
+ *
+ * This function writes map key 18 followed by the CBOR encoding of \p reference_inputs to the
+ * given writer. If \p reference_inputs is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] reference_inputs A pointer to the transaction input set to write. If NULL, nothing
+ *                             is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_reference_inputs_if_present(cardano_cbor_writer_t* writer, const cardano_transaction_input_set_t* reference_inputs);
+
+/**
+ * \brief Writes a body voting procedures field as a key value pair when the value is present.
+ *
+ * This function writes map key 19 followed by the CBOR encoding of \p voting_procedures to the
+ * given writer. If \p voting_procedures is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] voting_procedures A pointer to the voting procedures to write. If NULL, nothing is
+ *                              written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_voting_procedures_if_present(cardano_cbor_writer_t* writer, const cardano_voting_procedures_t* voting_procedures);
+
+/**
+ * \brief Writes a body proposal procedures field as a key value pair when the value is present.
+ *
+ * This function writes map key 20 followed by the CBOR encoding of \p proposal_procedures to the
+ * given writer. If \p proposal_procedures is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] proposal_procedures A pointer to the proposal procedure set to write. If NULL,
+ *                                nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_proposal_procedures_if_present(cardano_cbor_writer_t* writer, const cardano_proposal_procedure_set_t* proposal_procedures);
+
+/**
+ * \brief Writes a body treasury value field as a key value pair when the value is present.
+ *
+ * This function writes map key 21 followed by the CBOR encoding of \p treasury_value to the given
+ * writer. If \p treasury_value is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] treasury_value A pointer to the unsigned integer value to write. If NULL, nothing is
+ *                           written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_treasury_value_if_present(cardano_cbor_writer_t* writer, const uint64_t* treasury_value);
+
+/**
+ * \brief Writes a body donation field as a key value pair when the value is present.
+ *
+ * This function writes map key 22 followed by the CBOR encoding of \p donation to the given
+ * writer. If \p donation is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] donation A pointer to the unsigned integer value to write. If NULL, nothing is
+ *                     written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_donation_if_present(cardano_cbor_writer_t* writer, const uint64_t* donation);
+
+/**
+ * \brief Writes a body required top level guards field as a key value pair when the value is present.
+ *
+ * This function writes map key 24 followed by the CBOR encoding of \p required_top_level_guards
+ * to the given writer. If \p required_top_level_guards is NULL, nothing is written and the
+ * function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] required_top_level_guards A pointer to the required guards map to write. If NULL,
+ *                                      nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_required_top_level_guards_if_present(cardano_cbor_writer_t* writer, const cardano_required_guards_map_t* required_top_level_guards);
+
+/**
+ * \brief Writes a body direct deposits field as a key value pair when the value is present.
+ *
+ * This function writes map key 25 followed by the CBOR encoding of \p direct_deposits to the
+ * given writer. If \p direct_deposits is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] direct_deposits A pointer to the direct deposit map to write. If NULL, nothing is
+ *                            written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_direct_deposits_if_present(cardano_cbor_writer_t* writer, const cardano_direct_deposit_map_t* direct_deposits);
+
+/**
+ * \brief Writes a body account balance intervals field as a key value pair when the value is present.
+ *
+ * This function writes map key 26 followed by the CBOR encoding of \p account_balance_intervals
+ * to the given writer. If \p account_balance_intervals is NULL, nothing is written and the
+ * function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] account_balance_intervals A pointer to the account balance intervals map to write.
+ *                                      If NULL, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_account_balance_intervals_if_present(cardano_cbor_writer_t* writer, const cardano_account_balance_intervals_map_t* account_balance_intervals);
+
+/**
+ * \brief Writes a body starting account balance intervals field as a key value pair when the value is present.
+ *
+ * This function writes map key 27 followed by the CBOR encoding of
+ * \p starting_account_balance_intervals to the given writer. If
+ * \p starting_account_balance_intervals is NULL, nothing is written and the function succeeds.
+ *
+ * \param[in] writer A pointer to the CBOR writer. This parameter must not be NULL.
+ * \param[in] starting_account_balance_intervals A pointer to the starting account balance intervals
+ *                                               map to write. If NULL, nothing is written.
+ *
+ * \return \ref CARDANO_SUCCESS if the field was written or absent, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_body_write_starting_account_balance_intervals_if_present(cardano_cbor_writer_t* writer, const cardano_account_balance_intervals_map_t* starting_account_balance_intervals);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BODY_FIELDS_H
diff --git a/vendor/src/transaction_body/required_guards_map.c b/vendor/src/transaction_body/required_guards_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/required_guards_map.c
@@ -0,0 +1,867 @@
+/**
+ * \file required_guards_map.c
+ *
+ * \author angel.castillo
+ * \date   Jul 16, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/transaction_body/required_guards_map.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a map of credentials to an optional plutus datum.
+ */
+typedef struct cardano_required_guards_map_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_required_guards_map_t;
+
+/**
+ * \brief Represents a credential to optional plutus datum key value pair.
+ */
+typedef struct cardano_required_guards_map_kvp_t
+{
+    cardano_object_t       base;
+    cardano_credential_t*  key;
+    cardano_plutus_data_t* value;
+} cardano_required_guards_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a required guards map object.
+ *
+ * This function is responsible for properly deallocating a required guards map object (`cardano_required_guards_map_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the required_guards_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_required_guards_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the required_guards_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_required_guards_map_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_required_guards_map_t* map = (cardano_required_guards_map_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a required guards map key value pair object.
+ *
+ * This function is responsible for properly deallocating a required guards map key value pair object
+ * (`cardano_required_guards_map_kvp_t`) and its associated resources.
+ *
+ * \param object A void pointer to the required_guards_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_required_guards_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the required_guards_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_required_guards_map_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_required_guards_map_kvp_t* map = (cardano_required_guards_map_kvp_t*)object;
+
+  if (map->key != NULL)
+  {
+    cardano_credential_unref(&map->key);
+  }
+
+  if (map->value != NULL)
+  {
+    cardano_plutus_data_unref(&map->value);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two cardano_required_guards_map_kvp_t objects based on their credential.
+ *
+ * Credentials are ordered by their type and then by their hash, which is the bytewise order of their
+ * CBOR encoding as a [type, hash] array.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the credential of lhs is less than the credential of rhs, zero if they are equal,
+ *         and a positive value if the credential of lhs is greater than the credential of rhs.
+ */
+static int32_t
+compare_by_credentials(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_required_guards_map_kvp_t* lhs_kvp = (const cardano_required_guards_map_kvp_t*)((const void*)lhs);
+  const cardano_required_guards_map_kvp_t* rhs_kvp = (const cardano_required_guards_map_kvp_t*)((const void*)rhs);
+
+  return cardano_credential_compare(lhs_kvp->key, rhs_kvp->key);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_required_guards_map_new(cardano_required_guards_map_t** required_guards_map)
+{
+  if (required_guards_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_required_guards_map_t* map = _cardano_malloc(sizeof(cardano_required_guards_map_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_required_guards_map_deallocate;
+
+  map->array = cardano_array_new(32);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *required_guards_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_required_guards_map_from_cbor(cardano_cbor_reader_t* reader, cardano_required_guards_map_t** required_guards_map)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (required_guards_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_required_guards_map_t* map    = NULL;
+  cardano_error_t                result = cardano_required_guards_map_new(&map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_map(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_required_guards_map_unref(&map);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_required_guards_map_unref(&map);
+    return result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'required_guards_map', the map must not be empty.");
+    cardano_required_guards_map_unref(&map);
+
+    return CARDANO_ERROR_INVALID_CBOR_MAP_SIZE;
+  }
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_required_guards_map_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      break;
+    }
+
+    cardano_credential_t*  key   = NULL;
+    cardano_plutus_data_t* value = NULL;
+
+    result = cardano_credential_from_cbor(reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_required_guards_map_unref(&map);
+      return result;
+    }
+
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_credential_unref(&key);
+      cardano_required_guards_map_unref(&map);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_NULL)
+    {
+      result = cardano_cbor_reader_read_null(reader);
+    }
+    else
+    {
+      result = cardano_plutus_data_from_cbor(reader, &value);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_credential_unref(&key);
+      cardano_required_guards_map_unref(&map);
+      return result;
+    }
+
+    result = cardano_required_guards_map_insert(map, key, value);
+
+    cardano_credential_unref(&key);
+    cardano_plutus_data_unref(&value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'required_guards_map', the map must not contain duplicated keys.");
+      cardano_required_guards_map_unref(&map);
+
+      return result;
+    }
+  }
+
+  result = cardano_cbor_validate_end_map("required_guards_map", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_required_guards_map_unref(&map);
+    return result;
+  }
+
+  *required_guards_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_required_guards_map_to_cbor(const cardano_required_guards_map_t* required_guards_map, cardano_cbor_writer_t* writer)
+{
+  if (required_guards_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t map_size = cardano_array_get_size(required_guards_map->array);
+  result          = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(required_guards_map->array); ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(required_guards_map->array, i);
+
+    if (kvp == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in required guards map is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    cardano_required_guards_map_kvp_t* kvp_data = (cardano_required_guards_map_kvp_t*)((void*)kvp);
+
+    result = cardano_credential_to_cbor(kvp_data->key, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return result;
+    }
+
+    if (kvp_data->value == NULL)
+    {
+      result = cardano_cbor_writer_write_null(writer);
+    }
+    else
+    {
+      result = cardano_plutus_data_to_cbor(kvp_data->value, writer);
+    }
+
+    cardano_object_unref(&kvp);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_required_guards_map_get_length(const cardano_required_guards_map_t* required_guards_map)
+{
+  if (required_guards_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(required_guards_map->array);
+}
+
+cardano_error_t
+cardano_required_guards_map_get(
+  const cardano_required_guards_map_t* required_guards_map,
+  cardano_credential_t*                key,
+  cardano_plutus_data_t**              element)
+{
+  if (required_guards_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(required_guards_map->array); ++i)
+  {
+    cardano_object_t*                  object = cardano_array_get(required_guards_map->array, i);
+    cardano_required_guards_map_kvp_t* kvp    = (cardano_required_guards_map_kvp_t*)((void*)object);
+
+    if (cardano_credential_equals(kvp->key, key))
+    {
+      if (kvp->value != NULL)
+      {
+        cardano_plutus_data_ref(kvp->value);
+      }
+
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_required_guards_map_insert(
+  cardano_required_guards_map_t* required_guards_map,
+  cardano_credential_t*          key,
+  cardano_plutus_data_t*         value)
+{
+  if (required_guards_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(required_guards_map->array); ++i)
+  {
+    cardano_object_t*                  object = cardano_array_get(required_guards_map->array, i);
+    cardano_required_guards_map_kvp_t* kvp    = (cardano_required_guards_map_kvp_t*)((void*)object);
+
+    const bool duplicated = cardano_credential_equals(kvp->key, key);
+
+    cardano_object_unref(&object);
+
+    if (duplicated)
+    {
+      return CARDANO_ERROR_DUPLICATED_KEY;
+    }
+  }
+
+  cardano_required_guards_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_required_guards_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_required_guards_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_credential_ref(key);
+
+  if (value != NULL)
+  {
+    cardano_plutus_data_ref(value);
+  }
+
+  const size_t old_size = cardano_array_get_size(required_guards_map->array);
+  const size_t new_size = cardano_array_push(required_guards_map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_required_guards_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(required_guards_map->array, compare_by_credentials, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_required_guards_map_get_keys(
+  cardano_required_guards_map_t* required_guards_map,
+  cardano_credential_set_t**     keys)
+{
+  if (required_guards_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_set_t* list = NULL;
+
+  cardano_error_t result = cardano_credential_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(required_guards_map->array); ++i)
+  {
+    cardano_object_t*                  object = cardano_array_get(required_guards_map->array, i);
+    cardano_required_guards_map_kvp_t* kvp    = (cardano_required_guards_map_kvp_t*)((void*)object);
+
+    result = cardano_credential_set_add(list, kvp->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_credential_set_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_required_guards_map_get_key_at(
+  const cardano_required_guards_map_t* required_guards_map,
+  const size_t                         index,
+  cardano_credential_t**               credential)
+{
+  if (required_guards_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(required_guards_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                  object = cardano_array_get(required_guards_map->array, index);
+  cardano_required_guards_map_kvp_t* kvp    = (cardano_required_guards_map_kvp_t*)((void*)object);
+
+  cardano_credential_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *credential = kvp->key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_required_guards_map_get_value_at(
+  const cardano_required_guards_map_t* required_guards_map,
+  const size_t                         index,
+  cardano_plutus_data_t**              datum)
+{
+  if (required_guards_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (datum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(required_guards_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                  object = cardano_array_get(required_guards_map->array, index);
+  cardano_required_guards_map_kvp_t* kvp    = (cardano_required_guards_map_kvp_t*)((void*)object);
+
+  if (kvp->value != NULL)
+  {
+    cardano_plutus_data_ref(kvp->value);
+  }
+
+  cardano_object_unref(&object);
+
+  *datum = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_required_guards_map_get_key_value_at(
+  const cardano_required_guards_map_t* required_guards_map,
+  const size_t                         index,
+  cardano_credential_t**               credential,
+  cardano_plutus_data_t**              datum)
+{
+  if (required_guards_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (datum == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(required_guards_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                  object = cardano_array_get(required_guards_map->array, index);
+  cardano_required_guards_map_kvp_t* kvp    = (cardano_required_guards_map_kvp_t*)((void*)object);
+
+  cardano_credential_ref(kvp->key);
+
+  if (kvp->value != NULL)
+  {
+    cardano_plutus_data_ref(kvp->value);
+  }
+
+  cardano_object_unref(&object);
+
+  *credential = kvp->key;
+  *datum      = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_required_guards_map_to_cip116_json(const cardano_required_guards_map_t* value, cardano_json_writer_t* writer)
+{
+  if ((value == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0U; i < cardano_array_get_size(value->array); ++i)
+  {
+    cardano_object_t* entry = cardano_array_get(value->array, i);
+
+    if (entry == NULL)
+    {
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    const cardano_required_guards_map_kvp_t* pair   = (const cardano_required_guards_map_kvp_t*)((const void*)entry);
+    cardano_error_t                          result = CARDANO_SUCCESS;
+
+    cardano_json_writer_write_start_object(writer);
+    cardano_json_writer_write_property_name(writer, "key", 3);
+    result = cardano_credential_to_cip116_json(pair->key, writer);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_json_writer_write_property_name(writer, "value", 5);
+
+      if (pair->value == NULL)
+      {
+        cardano_json_writer_write_null(writer);
+      }
+      else
+      {
+        result = cardano_plutus_data_to_cip116_json(pair->value, writer);
+      }
+    }
+    cardano_json_writer_write_end_object(writer);
+    cardano_object_unref(&entry);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_required_guards_map_unref(cardano_required_guards_map_t** required_guards_map)
+{
+  if ((required_guards_map == NULL) || (*required_guards_map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*required_guards_map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *required_guards_map = NULL;
+    return;
+  }
+}
+
+void
+cardano_required_guards_map_ref(cardano_required_guards_map_t* required_guards_map)
+{
+  if (required_guards_map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&required_guards_map->base);
+}
+
+size_t
+cardano_required_guards_map_refcount(const cardano_required_guards_map_t* required_guards_map)
+{
+  if (required_guards_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&required_guards_map->base);
+}
+
+void
+cardano_required_guards_map_set_last_error(cardano_required_guards_map_t* required_guards_map, const char* message)
+{
+  cardano_object_set_last_error(&required_guards_map->base, message);
+}
+
+const char*
+cardano_required_guards_map_get_last_error(const cardano_required_guards_map_t* required_guards_map)
+{
+  return cardano_object_get_last_error(&required_guards_map->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_required_guards_map_kvp_deep_clone(const cardano_required_guards_map_kvp_t* source, cardano_required_guards_map_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_required_guards_map_kvp_t* copy = _cardano_malloc(sizeof(cardano_required_guards_map_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = NULL;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_data_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_required_guards_map_kvp_t* copy   = NULL;
+  const cardano_error_t              result = cardano_required_guards_map_kvp_deep_clone((const cardano_required_guards_map_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_required_guards_map_deep_clone(const cardano_required_guards_map_t* source, cardano_required_guards_map_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_required_guards_map_t* copy = _cardano_malloc(sizeof(cardano_required_guards_map_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/sub_transaction_body.c b/vendor/src/transaction_body/sub_transaction_body.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/sub_transaction_body.c
@@ -0,0 +1,2721 @@
+/**
+ * \file sub_transaction_body.c
+ *
+ * \author angel.castillo
+ * \date   Jul 17, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "internals/body_fields.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The sub transaction body encapsulates the core details of a sub transaction.
+ */
+typedef struct cardano_sub_transaction_body_t
+{
+    cardano_object_t                         base;
+    cardano_transaction_input_set_t*         inputs;
+    cardano_transaction_output_list_t*       outputs;
+    uint64_t*                                invalid_after;
+    cardano_certificate_set_t*               certificates;
+    cardano_withdrawal_map_t*                withdrawals;
+    cardano_blake2b_hash_t*                  aux_data_hash;
+    uint64_t*                                invalid_before;
+    cardano_multi_asset_t*                   mint;
+    cardano_blake2b_hash_t*                  script_data_hash;
+    cardano_guard_set_t*                     guards;
+    cardano_network_id_t*                    network_id;
+    cardano_transaction_input_set_t*         reference_inputs;
+    cardano_voting_procedures_t*             voting_procedures;
+    cardano_proposal_procedure_set_t*        proposal_procedures;
+    uint64_t*                                treasury_value;
+    uint64_t*                                donation;
+    cardano_required_guards_map_t*           required_top_level_guards;
+    cardano_direct_deposit_map_t*            direct_deposits;
+    cardano_account_balance_intervals_map_t* account_balance_intervals;
+    cardano_buffer_t*                        cbor_cache;
+} cardano_sub_transaction_body_t;
+
+/* STATIC DECLARATIONS *******************************************************/
+
+/**
+ * \brief Type definition for a parameter handler function.
+ *
+ * This type defines a function pointer used for handling sub transaction body fields
+ * when reading from a CBOR reader. Each handler function reads a specific type of
+ * field from the CBOR reader and stores the result in the specified field pointer.
+ *
+ * The function pointed to by `param_handler_t` is responsible for:
+ * - Reading the field value from the provided CBOR reader.
+ * - Storing the field value in the provided field pointer.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the field value.
+ * \param[out] field_ptr A pointer to the field where the read value should be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the field was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+typedef cardano_error_t (*param_handler_t)(cardano_cbor_reader_t*, void*);
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a sub transaction body object.
+ *
+ * This function is responsible for properly deallocating a sub transaction body object (`cardano_sub_transaction_body_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the sub_transaction_body object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_sub_transaction_body_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the sub_transaction_body
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_sub_transaction_body_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_sub_transaction_body_t* data = (cardano_sub_transaction_body_t*)object;
+
+  cardano_transaction_input_set_unref(&data->inputs);
+  cardano_transaction_output_list_unref(&data->outputs);
+  _cardano_free(data->invalid_after);
+  cardano_certificate_set_unref(&data->certificates);
+  cardano_withdrawal_map_unref(&data->withdrawals);
+  cardano_blake2b_hash_unref(&data->aux_data_hash);
+  _cardano_free(data->invalid_before);
+  cardano_multi_asset_unref(&data->mint);
+  cardano_blake2b_hash_unref(&data->script_data_hash);
+  cardano_guard_set_unref(&data->guards);
+  _cardano_free(data->network_id);
+  cardano_transaction_input_set_unref(&data->reference_inputs);
+  cardano_voting_procedures_unref(&data->voting_procedures);
+  cardano_proposal_procedure_set_unref(&data->proposal_procedures);
+  _cardano_free(data->treasury_value);
+  _cardano_free(data->donation);
+  cardano_required_guards_map_unref(&data->required_top_level_guards);
+  cardano_direct_deposit_map_unref(&data->direct_deposits);
+  cardano_account_balance_intervals_map_unref(&data->account_balance_intervals);
+  cardano_buffer_unref(&data->cbor_cache);
+
+  _cardano_free(object);
+}
+
+/**
+ * \brief Computes the map size of this sub transaction body object.
+ *
+ * \param body The sub transaction body object to compute the map size for.
+ *
+ * \return The map size of the sub transaction body object.
+ */
+static size_t
+get_map_size(const cardano_sub_transaction_body_t* body)
+{
+  assert(body != NULL);
+
+  size_t map_size = 0U;
+
+  if (body->inputs != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->outputs != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->invalid_after != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->certificates != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->withdrawals != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->aux_data_hash != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->invalid_before != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->mint != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->script_data_hash != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (cardano_body_has_guards(body->guards))
+  {
+    map_size += 1U;
+  }
+
+  if (body->network_id != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->reference_inputs != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->voting_procedures != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->proposal_procedures != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->treasury_value != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->donation != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->required_top_level_guards != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->direct_deposits != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->account_balance_intervals != NULL)
+  {
+    map_size += 1U;
+  }
+
+  return map_size;
+}
+
+/**
+ * \brief Retrieves a pointer to the specified field in the sub transaction body object.
+ *
+ * This function returns a pointer to the field specified by the key in the given sub transaction
+ * body object. The key corresponds to different fields within the body object.
+ * If the key does not correspond to any field, NULL is returned.
+ *
+ * \param[in] body Pointer to the sub transaction body object.
+ *
+ * \return void* A pointer to the specified field, or NULL if the key does not correspond to any field.
+ *
+ * \note The caller must ensure that the `cardano_sub_transaction_body_t` pointer is not NULL before calling this function.
+ */
+static void*
+get_field_ptr(cardano_sub_transaction_body_t* body, size_t key)
+{
+  assert(body != NULL);
+
+  switch (key)
+  {
+    case 0:
+      return (void*)&body->inputs;
+    case 1:
+      return (void*)&body->outputs;
+    case 3:
+      return (void*)&body->invalid_after;
+    case 4:
+      return (void*)&body->certificates;
+    case 5:
+      return (void*)&body->withdrawals;
+    case 7:
+      return (void*)&body->aux_data_hash;
+    case 8:
+      return (void*)&body->invalid_before;
+    case 9:
+      return (void*)&body->mint;
+    case 11:
+      return (void*)&body->script_data_hash;
+    case 14:
+      return (void*)&body->guards;
+    case 15:
+      return (void*)&body->network_id;
+    case 18:
+      return (void*)&body->reference_inputs;
+    case 19:
+      return (void*)&body->voting_procedures;
+    case 20:
+      return (void*)&body->proposal_procedures;
+    case 21:
+      return (void*)&body->treasury_value;
+    case 22:
+      return (void*)&body->donation;
+    case 24:
+      return (void*)&body->required_top_level_guards;
+    case 25:
+      return (void*)&body->direct_deposits;
+    case 26:
+      return (void*)&body->account_balance_intervals;
+
+    default:
+      return NULL;
+  }
+}
+
+/**
+ * \brief Reads the time to live field from the CBOR reader and stores it in the specified field.
+ *
+ * This function allocates the storage for the time to live value and delegates the wire decoding
+ * to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the uint64_t value.
+ * \param[out] field_ptr A pointer to the field where the read uint64_t value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the uint64_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_ttl(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_body_read_ttl(reader, *field);
+}
+
+/**
+ * \brief Reads the validity start interval field from the CBOR reader and stores it in the specified field.
+ *
+ * This function allocates the storage for the validity start interval value and delegates the
+ * wire decoding to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the uint64_t value.
+ * \param[out] field_ptr A pointer to the field where the read uint64_t value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the uint64_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_validity_start(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_body_read_validity_start(reader, *field);
+}
+
+/**
+ * \brief Reads the treasury value field from the CBOR reader and stores it in the specified field.
+ *
+ * This function allocates the storage for the treasury value and delegates the wire decoding to
+ * the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the uint64_t value.
+ * \param[out] field_ptr A pointer to the field where the read uint64_t value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the uint64_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_treasury_value(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_body_read_treasury_value(reader, *field);
+}
+
+/**
+ * \brief Reads the donation field from the CBOR reader and stores it in the specified field.
+ *
+ * This function allocates the storage for the donation value and delegates the wire decoding to
+ * the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the uint64_t value.
+ * \param[out] field_ptr A pointer to the field where the read uint64_t value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the uint64_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_donation(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_body_read_donation(reader, *field);
+}
+
+/**
+ * \brief Reads the inputs field from the CBOR reader and stores it in the specified field.
+ *
+ * This function checks the field for duplicates and delegates the wire decoding of the
+ * transaction input set to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_transaction_input_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_transaction_input_set_t value should be stored.
+ *                       The field pointer should be of type cardano_transaction_input_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_transaction_input_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_inputs(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_transaction_input_set_t** field = (cardano_transaction_input_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_inputs(reader, field);
+}
+
+/**
+ * \brief Reads the reference inputs field from the CBOR reader and stores it in the specified field.
+ *
+ * This function checks the field for duplicates and delegates the wire decoding of the
+ * transaction input set to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_transaction_input_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_transaction_input_set_t value should be stored.
+ *                       The field pointer should be of type cardano_transaction_input_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_transaction_input_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_reference_inputs(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_transaction_input_set_t** field = (cardano_transaction_input_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_reference_inputs(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_transaction_output_list_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_transaction_output_list_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_transaction_output_list_t in the sub transaction body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_transaction_output_list_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_transaction_output_list_t value should be stored.
+ *                       The field pointer should be of type cardano_transaction_output_list_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_transaction_output_list_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_transaction_output_list(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_transaction_output_list_t** field = (cardano_transaction_output_list_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_outputs(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_certificate_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_certificate_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_certificate_set_t in the sub transaction body. The set must not be
+ * empty on the wire.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_certificate_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_certificate_set_t value should be stored.
+ *                       The field pointer should be of type cardano_certificate_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_certificate_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_certificate_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_certificate_set_t** field = (cardano_certificate_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  cardano_error_t result = cardano_body_read_certificates(reader, field);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (cardano_certificate_set_get_length(*field) == 0U)
+  {
+    cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'sub_transaction_body', 'certificates' must not be empty.");
+
+    return CARDANO_ERROR_INVALID_CBOR_ARRAY_SIZE;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a cardano_withdrawal_map_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_withdrawal_map_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_withdrawal_map_t in the sub transaction body. The map must not be
+ * empty on the wire.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_withdrawal_map_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_withdrawal_map_t value should be stored.
+ *                       The field pointer should be of type cardano_withdrawal_map_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_withdrawal_map_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_withdrawal_map(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_withdrawal_map_t** field = (cardano_withdrawal_map_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  cardano_error_t result = cardano_body_read_withdrawals(reader, field);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (cardano_withdrawal_map_get_length(*field) == 0U)
+  {
+    cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'sub_transaction_body', 'withdrawals' must not be empty.");
+
+    return CARDANO_ERROR_INVALID_CBOR_MAP_SIZE;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads the auxiliary data hash field from the CBOR reader and stores it in the specified field.
+ *
+ * This function checks the field for duplicates and delegates the wire decoding of the blake2b
+ * hash to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_blake2b_hash_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_blake2b_hash_t value should be stored.
+ *                       The field pointer should be of type cardano_blake2b_hash_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_blake2b_hash_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_aux_data_hash(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_blake2b_hash_t** field = (cardano_blake2b_hash_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_aux_data_hash(reader, field);
+}
+
+/**
+ * \brief Reads the script data hash field from the CBOR reader and stores it in the specified field.
+ *
+ * This function checks the field for duplicates and delegates the wire decoding of the blake2b
+ * hash to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_blake2b_hash_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_blake2b_hash_t value should be stored.
+ *                       The field pointer should be of type cardano_blake2b_hash_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_blake2b_hash_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_script_data_hash(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_blake2b_hash_t** field = (cardano_blake2b_hash_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_script_data_hash(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_multi_asset_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_multi_asset_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_multi_asset_t in the sub transaction body. The map must not be
+ * empty on the wire.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_multi_asset_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_multi_asset_t value should be stored.
+ *                       The field pointer should be of type cardano_multi_asset_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_multi_asset_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_multi_asset(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_multi_asset_t** field = (cardano_multi_asset_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  cardano_error_t result = cardano_body_read_mint(reader, field);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (cardano_multi_asset_get_policy_count(*field) == 0U)
+  {
+    cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'sub_transaction_body', 'mint' must not be empty.");
+
+    return CARDANO_ERROR_INVALID_CBOR_MAP_SIZE;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a cardano_guard_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_guard_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_guard_set_t in the sub transaction body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_guard_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_guard_set_t value should be stored.
+ *                       The field pointer should be of type cardano_guard_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_guard_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_guard_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_guard_set_t** field = (cardano_guard_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_guards(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_network_id_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_network_id_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_network_id_t in the sub transaction body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_network_id_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_network_id_t value should be stored.
+ *                       The field pointer should be of type cardano_network_id_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_network_id_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_network_id(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_network_id_t** field = (cardano_network_id_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_body_read_network_id(reader, *field);
+}
+
+/**
+ * \brief Reads a cardano_voting_procedures_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_voting_procedures_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_voting_procedures_t in the sub transaction body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_voting_procedures_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_voting_procedures_t value should be stored.
+ *                       The field pointer should be of type cardano_voting_procedures_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_voting_procedures_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_voting_procedures(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_voting_procedures_t** field = (cardano_voting_procedures_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_voting_procedures(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_proposal_procedure_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_proposal_procedure_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_proposal_procedure_set_t in the sub transaction body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_proposal_procedure_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_proposal_procedure_set_t value should be stored.
+ *                       The field pointer should be of type cardano_proposal_procedure_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_proposal_procedure_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_proposal_procedure_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_proposal_procedure_set_t** field = (cardano_proposal_procedure_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_proposal_procedures(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_required_guards_map_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_required_guards_map_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_required_guards_map_t in the sub transaction body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_required_guards_map_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_required_guards_map_t value should be stored.
+ *                       The field pointer should be of type cardano_required_guards_map_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_required_guards_map_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_required_guards_map(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_required_guards_map_t** field = (cardano_required_guards_map_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_required_top_level_guards(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_direct_deposit_map_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_direct_deposit_map_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_direct_deposit_map_t in the sub transaction body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_direct_deposit_map_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_direct_deposit_map_t value should be stored.
+ *                       The field pointer should be of type cardano_direct_deposit_map_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_direct_deposit_map_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_direct_deposit_map(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_direct_deposit_map_t** field = (cardano_direct_deposit_map_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_direct_deposits(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_account_balance_intervals_map_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_account_balance_intervals_map_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_account_balance_intervals_map_t in the sub transaction body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_account_balance_intervals_map_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_account_balance_intervals_map_t value should be stored.
+ *                       The field pointer should be of type cardano_account_balance_intervals_map_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_account_balance_intervals_map_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_account_balance_intervals_map(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_account_balance_intervals_map_t** field = (cardano_account_balance_intervals_map_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_account_balance_intervals(reader, field);
+}
+
+/**
+ * \brief Handles an invalid key in the CBOR map during deserialization.
+ *
+ * This function is used as a handler for keys that are not admitted at the sub transaction
+ * level, including the top-level-only keys 2 (fee), 13 (collateral), 16 (collateral return),
+ * 17 (total collateral) and 23 (sub transactions). It does nothing with the provided reader
+ * and field pointer, and always returns \ref CARDANO_ERROR_INVALID_CBOR_MAP_KEY to indicate
+ * the error.
+ *
+ * \param[in] reader A pointer to the CBOR reader. This parameter is unused.
+ * \param[in] field_ptr A pointer to the field where the value should be stored. This parameter is unused.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - Always returns \ref CARDANO_ERROR_INVALID_CBOR_MAP_KEY.
+ */
+static cardano_error_t
+handle_invalid_key(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  CARDANO_UNUSED(reader);
+  CARDANO_UNUSED(field_ptr);
+
+  return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+}
+
+/**
+ * \brief Allocates and initializes a new cardano_sub_transaction_body_t structure.
+ *
+ * \return The pointer to the newly allocated cardano_sub_transaction_body_t structure.
+ */
+static cardano_sub_transaction_body_t*
+create_sub_transaction_body_new(void)
+{
+  cardano_sub_transaction_body_t* sub_transaction_body = (cardano_sub_transaction_body_t*)_cardano_malloc(sizeof(cardano_sub_transaction_body_t));
+
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  sub_transaction_body->base.deallocator          = cardano_sub_transaction_body_deallocate;
+  sub_transaction_body->base.ref_count            = 1;
+  sub_transaction_body->base.last_error[0]        = '\0';
+  sub_transaction_body->inputs                    = NULL;
+  sub_transaction_body->outputs                   = NULL;
+  sub_transaction_body->invalid_after             = NULL;
+  sub_transaction_body->certificates              = NULL;
+  sub_transaction_body->withdrawals               = NULL;
+  sub_transaction_body->aux_data_hash             = NULL;
+  sub_transaction_body->invalid_before            = NULL;
+  sub_transaction_body->mint                      = NULL;
+  sub_transaction_body->script_data_hash          = NULL;
+  sub_transaction_body->guards                    = NULL;
+  sub_transaction_body->network_id                = NULL;
+  sub_transaction_body->reference_inputs          = NULL;
+  sub_transaction_body->voting_procedures         = NULL;
+  sub_transaction_body->proposal_procedures       = NULL;
+  sub_transaction_body->treasury_value            = NULL;
+  sub_transaction_body->donation                  = NULL;
+  sub_transaction_body->required_top_level_guards = NULL;
+  sub_transaction_body->direct_deposits           = NULL;
+  sub_transaction_body->account_balance_intervals = NULL;
+  sub_transaction_body->cbor_cache                = NULL;
+
+  return sub_transaction_body;
+}
+
+/* STATIC CONSTANTS ***********************************************************/
+
+// cppcheck-suppress misra-c2012-8.9; Reason: Is more readable to define the map here
+static const param_handler_t param_handlers[] = {
+  handle_inputs,
+  handle_transaction_output_list,
+  handle_invalid_key, // top-level-only key (fee)
+  handle_ttl,
+  handle_certificate_set,
+  handle_withdrawal_map,
+  handle_invalid_key, // unused key
+  handle_aux_data_hash,
+  handle_validity_start,
+  handle_multi_asset,
+  handle_invalid_key, // unused key
+  handle_script_data_hash,
+  handle_invalid_key, // unused key
+  handle_invalid_key, // top-level-only key (collateral)
+  handle_guard_set,
+  handle_network_id,
+  handle_invalid_key, // top-level-only key (collateral return)
+  handle_invalid_key, // top-level-only key (total collateral)
+  handle_reference_inputs,
+  handle_voting_procedures,
+  handle_proposal_procedure_set,
+  handle_treasury_value,
+  handle_donation,
+  handle_invalid_key, // top-level-only key (sub transactions)
+  handle_required_guards_map,
+  handle_direct_deposit_map,
+  handle_account_balance_intervals_map,
+  handle_invalid_key // top-level-only key (starting account balance intervals)
+};
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_sub_transaction_body_new(
+  cardano_transaction_input_set_t*   inputs,
+  cardano_transaction_output_list_t* outputs,
+  const uint64_t*                    ttl,
+  cardano_sub_transaction_body_t**   sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (outputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *sub_transaction_body = create_sub_transaction_body_new();
+
+  if (*sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_transaction_input_set_ref(inputs);
+  cardano_transaction_output_list_ref(outputs);
+
+  (*sub_transaction_body)->inputs  = inputs;
+  (*sub_transaction_body)->outputs = outputs;
+
+  if (ttl != NULL)
+  {
+    (*sub_transaction_body)->invalid_after = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if ((*sub_transaction_body)->invalid_after == NULL)
+    {
+      cardano_sub_transaction_body_unref(sub_transaction_body);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    *(*sub_transaction_body)->invalid_after = *ttl;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_from_cbor(cardano_cbor_reader_t* reader, cardano_sub_transaction_body_t** sub_transaction_body)
+{
+  if (!reader || !sub_transaction_body)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *sub_transaction_body                = NULL;
+  cardano_sub_transaction_body_t* body = create_sub_transaction_body_new();
+
+  if (body == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        copy_result = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_body_unref(&body);
+    return copy_result;
+  }
+
+  copy_result = cardano_cbor_reader_read_encoded_value(reader_copy, &body->cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_body_unref(&body);
+    return copy_result;
+  }
+
+  int64_t         map_size = 0;
+  cardano_error_t result   = cardano_cbor_reader_read_start_map(reader, &map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_body_unref(&body);
+
+    return result;
+  }
+
+  for (size_t i = 0U; i < (size_t)map_size; ++i)
+  {
+    uint64_t key = 0;
+    result       = cardano_cbor_reader_read_uint(reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_sub_transaction_body_unref(&body);
+
+      return result;
+    }
+
+    if (key >= (sizeof(param_handlers) / sizeof(param_handlers[0])))
+    {
+      cardano_sub_transaction_body_unref(&body);
+
+      return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+    }
+
+    void* field_ptr = get_field_ptr(body, key);
+
+    if (field_ptr == NULL)
+    {
+      cardano_sub_transaction_body_unref(&body);
+
+      return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+    }
+
+    result = param_handlers[key](reader, field_ptr);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_sub_transaction_body_unref(&body);
+
+      return result;
+    }
+  }
+
+  if ((body->inputs == NULL) || (body->outputs == NULL))
+  {
+    cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'sub_transaction_body', 'inputs' (key 0) and 'outputs' (key 1) must be present.");
+    cardano_sub_transaction_body_unref(&body);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *sub_transaction_body = body;
+
+  cardano_error_t validation_result = cardano_cbor_validate_end_map("sub_transaction_body", reader);
+
+  if (validation_result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_body_unref(sub_transaction_body);
+    return validation_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_to_cbor(const cardano_sub_transaction_body_t* sub_transaction_body, cardano_cbor_writer_t* writer)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (sub_transaction_body->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(sub_transaction_body->cbor_cache), cardano_buffer_get_size(sub_transaction_body->cbor_cache));
+  }
+
+  const size_t map_size = get_map_size(sub_transaction_body);
+
+  cardano_error_t result = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_inputs_if_present(writer, sub_transaction_body->inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_outputs_if_present(writer, sub_transaction_body->outputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_ttl_if_present(writer, sub_transaction_body->invalid_after);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_certificates_if_present(writer, sub_transaction_body->certificates);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_withdrawals_if_present(writer, sub_transaction_body->withdrawals);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_aux_data_hash_if_present(writer, sub_transaction_body->aux_data_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_validity_start_if_present(writer, sub_transaction_body->invalid_before);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_mint_if_present(writer, sub_transaction_body->mint);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_script_data_hash_if_present(writer, sub_transaction_body->script_data_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_guards_if_present(writer, sub_transaction_body->guards);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_network_id_if_present(writer, sub_transaction_body->network_id);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_reference_inputs_if_present(writer, sub_transaction_body->reference_inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_voting_procedures_if_present(writer, sub_transaction_body->voting_procedures);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_proposal_procedures_if_present(writer, sub_transaction_body->proposal_procedures);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_treasury_value_if_present(writer, sub_transaction_body->treasury_value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_donation_if_present(writer, sub_transaction_body->donation);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_required_top_level_guards_if_present(writer, sub_transaction_body->required_top_level_guards);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_direct_deposits_if_present(writer, sub_transaction_body->direct_deposits);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_account_balance_intervals_if_present(writer, sub_transaction_body->account_balance_intervals);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_transaction_input_set_t*
+cardano_sub_transaction_body_get_inputs(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_input_set_ref(sub_transaction_body->inputs);
+
+  return sub_transaction_body->inputs;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_inputs(cardano_sub_transaction_body_t* sub_transaction_body, cardano_transaction_input_set_t* inputs)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_input_set_ref(inputs);
+  cardano_transaction_input_set_unref(&sub_transaction_body->inputs);
+  sub_transaction_body->inputs = inputs;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_transaction_output_list_t*
+cardano_sub_transaction_body_get_outputs(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_output_list_ref(sub_transaction_body->outputs);
+
+  return sub_transaction_body->outputs;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_outputs(cardano_sub_transaction_body_t* sub_transaction_body, cardano_transaction_output_list_t* outputs)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (outputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_list_ref(outputs);
+  cardano_transaction_output_list_unref(&sub_transaction_body->outputs);
+  sub_transaction_body->outputs = outputs;
+
+  return CARDANO_SUCCESS;
+}
+
+const uint64_t*
+cardano_sub_transaction_body_get_invalid_after(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  return sub_transaction_body->invalid_after;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_invalid_after(cardano_sub_transaction_body_t* sub_transaction_body, const uint64_t* slot)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (slot == NULL)
+  {
+    _cardano_free(sub_transaction_body->invalid_after);
+    sub_transaction_body->invalid_after = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (sub_transaction_body->invalid_after == NULL)
+  {
+    sub_transaction_body->invalid_after = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if (sub_transaction_body->invalid_after == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *sub_transaction_body->invalid_after = *slot;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_certificate_set_t*
+cardano_sub_transaction_body_get_certificates(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_certificate_set_ref(sub_transaction_body->certificates);
+
+  return sub_transaction_body->certificates;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_certificates(cardano_sub_transaction_body_t* sub_transaction_body, cardano_certificate_set_t* certificates)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificates == NULL)
+  {
+    cardano_certificate_set_unref(&sub_transaction_body->certificates);
+    sub_transaction_body->certificates = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_certificate_set_ref(certificates);
+  cardano_certificate_set_unref(&sub_transaction_body->certificates);
+  sub_transaction_body->certificates = certificates;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_withdrawal_map_t*
+cardano_sub_transaction_body_get_withdrawals(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_withdrawal_map_ref(sub_transaction_body->withdrawals);
+
+  return sub_transaction_body->withdrawals;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_withdrawals(cardano_sub_transaction_body_t* sub_transaction_body, cardano_withdrawal_map_t* withdrawals)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (withdrawals == NULL)
+  {
+    cardano_withdrawal_map_unref(&sub_transaction_body->withdrawals);
+    sub_transaction_body->withdrawals = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_withdrawal_map_ref(withdrawals);
+  cardano_withdrawal_map_unref(&sub_transaction_body->withdrawals);
+  sub_transaction_body->withdrawals = withdrawals;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_sub_transaction_body_get_aux_data_hash(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(sub_transaction_body->aux_data_hash);
+
+  return sub_transaction_body->aux_data_hash;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_aux_data_hash(cardano_sub_transaction_body_t* sub_transaction_body, cardano_blake2b_hash_t* aux_data_hash)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (aux_data_hash == NULL)
+  {
+    cardano_blake2b_hash_unref(&sub_transaction_body->aux_data_hash);
+    sub_transaction_body->aux_data_hash = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_blake2b_hash_ref(aux_data_hash);
+  cardano_blake2b_hash_unref(&sub_transaction_body->aux_data_hash);
+  sub_transaction_body->aux_data_hash = aux_data_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+const uint64_t*
+cardano_sub_transaction_body_get_invalid_before(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  return sub_transaction_body->invalid_before;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_invalid_before(cardano_sub_transaction_body_t* sub_transaction_body, const uint64_t* slot)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (slot == NULL)
+  {
+    _cardano_free(sub_transaction_body->invalid_before);
+    sub_transaction_body->invalid_before = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (sub_transaction_body->invalid_before == NULL)
+  {
+    sub_transaction_body->invalid_before = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if (sub_transaction_body->invalid_before == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *sub_transaction_body->invalid_before = *slot;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_multi_asset_t*
+cardano_sub_transaction_body_get_mint(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_multi_asset_ref(sub_transaction_body->mint);
+
+  return sub_transaction_body->mint;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_mint(cardano_sub_transaction_body_t* sub_transaction_body, cardano_multi_asset_t* mint)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (mint == NULL)
+  {
+    cardano_multi_asset_unref(&sub_transaction_body->mint);
+    sub_transaction_body->mint = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_multi_asset_ref(mint);
+  cardano_multi_asset_unref(&sub_transaction_body->mint);
+  sub_transaction_body->mint = mint;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_sub_transaction_body_get_script_data_hash(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(sub_transaction_body->script_data_hash);
+
+  return sub_transaction_body->script_data_hash;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_script_data_hash(cardano_sub_transaction_body_t* sub_transaction_body, cardano_blake2b_hash_t* script_data_hash)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_data_hash == NULL)
+  {
+    cardano_blake2b_hash_unref(&sub_transaction_body->script_data_hash);
+    sub_transaction_body->script_data_hash = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_blake2b_hash_ref(script_data_hash);
+  cardano_blake2b_hash_unref(&sub_transaction_body->script_data_hash);
+  sub_transaction_body->script_data_hash = script_data_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_guard_set_t*
+cardano_sub_transaction_body_get_guards(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_guard_set_ref(sub_transaction_body->guards);
+
+  return sub_transaction_body->guards;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_guards(cardano_sub_transaction_body_t* sub_transaction_body, cardano_guard_set_t* guards)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (guards == NULL)
+  {
+    cardano_guard_set_unref(&sub_transaction_body->guards);
+    sub_transaction_body->guards = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_guard_set_ref(guards);
+  cardano_guard_set_unref(&sub_transaction_body->guards);
+  sub_transaction_body->guards = guards;
+
+  return CARDANO_SUCCESS;
+}
+
+const cardano_network_id_t*
+cardano_sub_transaction_body_get_network_id(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  return sub_transaction_body->network_id;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_network_id(cardano_sub_transaction_body_t* sub_transaction_body, const cardano_network_id_t* network_id)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (network_id == NULL)
+  {
+    _cardano_free(sub_transaction_body->network_id);
+    sub_transaction_body->network_id = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (sub_transaction_body->network_id == NULL)
+  {
+    sub_transaction_body->network_id = (cardano_network_id_t*)_cardano_malloc(sizeof(cardano_network_id_t));
+
+    if (sub_transaction_body->network_id == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *sub_transaction_body->network_id = *network_id;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_transaction_input_set_t*
+cardano_sub_transaction_body_get_reference_inputs(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_input_set_ref(sub_transaction_body->reference_inputs);
+
+  return sub_transaction_body->reference_inputs;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_reference_inputs(
+  cardano_sub_transaction_body_t*  sub_transaction_body,
+  cardano_transaction_input_set_t* reference_inputs)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reference_inputs == NULL)
+  {
+    cardano_transaction_input_set_unref(&sub_transaction_body->reference_inputs);
+    sub_transaction_body->reference_inputs = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_transaction_input_set_ref(reference_inputs);
+  cardano_transaction_input_set_unref(&sub_transaction_body->reference_inputs);
+  sub_transaction_body->reference_inputs = reference_inputs;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_voting_procedures_t*
+cardano_sub_transaction_body_get_voting_procedures(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_voting_procedures_ref(sub_transaction_body->voting_procedures);
+
+  return sub_transaction_body->voting_procedures;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_voting_procedures(
+  cardano_sub_transaction_body_t* sub_transaction_body,
+  cardano_voting_procedures_t*    voting_procedures)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (voting_procedures == NULL)
+  {
+    cardano_voting_procedures_unref(&sub_transaction_body->voting_procedures);
+    sub_transaction_body->voting_procedures = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_voting_procedures_ref(voting_procedures);
+  cardano_voting_procedures_unref(&sub_transaction_body->voting_procedures);
+  sub_transaction_body->voting_procedures = voting_procedures;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_proposal_procedure_set_t*
+cardano_sub_transaction_body_get_proposal_procedures(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_proposal_procedure_set_ref(sub_transaction_body->proposal_procedures);
+
+  return sub_transaction_body->proposal_procedures;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_proposal_procedures(
+  cardano_sub_transaction_body_t*   sub_transaction_body,
+  cardano_proposal_procedure_set_t* proposal_procedures)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal_procedures == NULL)
+  {
+    cardano_proposal_procedure_set_unref(&sub_transaction_body->proposal_procedures);
+    sub_transaction_body->proposal_procedures = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_proposal_procedure_set_ref(proposal_procedures);
+  cardano_proposal_procedure_set_unref(&sub_transaction_body->proposal_procedures);
+  sub_transaction_body->proposal_procedures = proposal_procedures;
+
+  return CARDANO_SUCCESS;
+}
+
+const uint64_t*
+cardano_sub_transaction_body_get_treasury_value(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  return sub_transaction_body->treasury_value;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_treasury_value(cardano_sub_transaction_body_t* sub_transaction_body, const uint64_t* treasury_value)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (treasury_value == NULL)
+  {
+    _cardano_free(sub_transaction_body->treasury_value);
+    sub_transaction_body->treasury_value = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (sub_transaction_body->treasury_value == NULL)
+  {
+    sub_transaction_body->treasury_value = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if (sub_transaction_body->treasury_value == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *sub_transaction_body->treasury_value = *treasury_value;
+
+  return CARDANO_SUCCESS;
+}
+
+const uint64_t*
+cardano_sub_transaction_body_get_donation(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  return sub_transaction_body->donation;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_donation(cardano_sub_transaction_body_t* sub_transaction_body, const uint64_t* donation)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (donation == NULL)
+  {
+    _cardano_free(sub_transaction_body->donation);
+    sub_transaction_body->donation = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (sub_transaction_body->donation == NULL)
+  {
+    sub_transaction_body->donation = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if (sub_transaction_body->donation == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *sub_transaction_body->donation = *donation;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_required_guards_map_t*
+cardano_sub_transaction_body_get_required_top_level_guards(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_required_guards_map_ref(sub_transaction_body->required_top_level_guards);
+
+  return sub_transaction_body->required_top_level_guards;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_required_top_level_guards(
+  cardano_sub_transaction_body_t* sub_transaction_body,
+  cardano_required_guards_map_t*  required_top_level_guards)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (required_top_level_guards == NULL)
+  {
+    cardano_required_guards_map_unref(&sub_transaction_body->required_top_level_guards);
+    sub_transaction_body->required_top_level_guards = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_required_guards_map_ref(required_top_level_guards);
+  cardano_required_guards_map_unref(&sub_transaction_body->required_top_level_guards);
+  sub_transaction_body->required_top_level_guards = required_top_level_guards;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_direct_deposit_map_t*
+cardano_sub_transaction_body_get_direct_deposits(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_direct_deposit_map_ref(sub_transaction_body->direct_deposits);
+
+  return sub_transaction_body->direct_deposits;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_direct_deposits(
+  cardano_sub_transaction_body_t* sub_transaction_body,
+  cardano_direct_deposit_map_t*   direct_deposits)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (direct_deposits == NULL)
+  {
+    cardano_direct_deposit_map_unref(&sub_transaction_body->direct_deposits);
+    sub_transaction_body->direct_deposits = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_direct_deposit_map_ref(direct_deposits);
+  cardano_direct_deposit_map_unref(&sub_transaction_body->direct_deposits);
+  sub_transaction_body->direct_deposits = direct_deposits;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_account_balance_intervals_map_t*
+cardano_sub_transaction_body_get_account_balance_intervals(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_account_balance_intervals_map_ref(sub_transaction_body->account_balance_intervals);
+
+  return sub_transaction_body->account_balance_intervals;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_set_account_balance_intervals(
+  cardano_sub_transaction_body_t*          sub_transaction_body,
+  cardano_account_balance_intervals_map_t* account_balance_intervals)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (account_balance_intervals == NULL)
+  {
+    cardano_account_balance_intervals_map_unref(&sub_transaction_body->account_balance_intervals);
+    sub_transaction_body->account_balance_intervals = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_account_balance_intervals_map_ref(account_balance_intervals);
+  cardano_account_balance_intervals_map_unref(&sub_transaction_body->account_balance_intervals);
+  sub_transaction_body->account_balance_intervals = account_balance_intervals;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_sub_transaction_body_get_hash(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_error_t result = cardano_sub_transaction_body_to_cbor(sub_transaction_body, writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return NULL;
+  }
+
+  const size_t cbor_size = cardano_cbor_writer_get_encode_size(writer);
+  byte_t*      cbor_data = (byte_t*)_cardano_malloc(cbor_size);
+
+  if (cbor_data == NULL)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return NULL;
+  }
+
+  result = cardano_cbor_writer_encode(writer, cbor_data, cbor_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(cbor_data);
+    cardano_cbor_writer_unref(&writer);
+
+    return NULL;
+  }
+
+  cardano_cbor_writer_unref(&writer);
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  result = cardano_blake2b_compute_hash(cbor_data, cbor_size, CARDANO_BLAKE2B_HASH_SIZE_256, &hash);
+
+  _cardano_free(cbor_data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return hash;
+}
+
+void
+cardano_sub_transaction_body_clear_cbor_cache(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&sub_transaction_body->cbor_cache);
+  sub_transaction_body->cbor_cache = NULL;
+}
+
+cardano_error_t
+cardano_sub_transaction_body_to_cip116_json(const cardano_sub_transaction_body_t* transaction_body, cardano_json_writer_t* writer)
+{
+  if ((transaction_body == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "inputs", 6);
+  cardano_error_t result = cardano_transaction_input_set_to_cip116_json(transaction_body->inputs, writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (transaction_body->outputs != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "outputs", 7);
+    result = cardano_transaction_output_list_to_cip116_json(transaction_body->outputs, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->invalid_after != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "ttl", 3);
+    cardano_json_writer_write_uint_as_string(writer, *transaction_body->invalid_after);
+  }
+
+  if (transaction_body->certificates != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "certs", 5);
+    result = cardano_certificate_set_to_cip116_json(transaction_body->certificates, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->withdrawals != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "withdrawals", 11);
+    result = cardano_withdrawal_map_to_cip116_json(transaction_body->withdrawals, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->aux_data_hash != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "auxiliary_data_hash", 19);
+    result = cardano_blake2b_hash_to_cip116_json(transaction_body->aux_data_hash, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->invalid_before != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "validity_start_interval", 23);
+    cardano_json_writer_write_uint_as_string(writer, *transaction_body->invalid_before);
+  }
+
+  if (transaction_body->mint != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "mint", 4);
+    result = cardano_multi_asset_to_cip116_json_ex(transaction_body->mint, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->script_data_hash != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "script_data_hash", 16);
+    result = cardano_blake2b_hash_to_cip116_json(transaction_body->script_data_hash, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (cardano_body_has_guards(transaction_body->guards))
+  {
+    cardano_json_writer_write_property_name(writer, "guards", 6);
+    result = cardano_guard_set_to_cip116_json(transaction_body->guards, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->network_id != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "network_id", 10);
+
+    const cardano_network_id_t network_id     = *transaction_body->network_id;
+    const char*                network_id_str = (network_id == CARDANO_NETWORK_ID_MAIN_NET) ? "mainnet" : "testnet";
+    cardano_json_writer_write_string(writer, network_id_str, 7);
+  }
+
+  if (transaction_body->reference_inputs != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "reference_inputs", 16);
+    result = cardano_transaction_input_set_to_cip116_json(transaction_body->reference_inputs, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->voting_procedures != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "voting_procedures", 17);
+    result = cardano_voting_procedures_to_cip116_json(transaction_body->voting_procedures, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->proposal_procedures != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "proposal_procedures", 19);
+    result = cardano_proposal_procedure_set_to_cip116_json(transaction_body->proposal_procedures, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->treasury_value != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "treasury_value", 14);
+    cardano_json_writer_write_uint_as_string(writer, *transaction_body->treasury_value);
+  }
+
+  if (transaction_body->donation != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "donation", 8);
+    cardano_json_writer_write_uint_as_string(writer, *transaction_body->donation);
+  }
+
+  if (transaction_body->required_top_level_guards != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "required_top_level_guards", 25);
+    result = cardano_required_guards_map_to_cip116_json(transaction_body->required_top_level_guards, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->direct_deposits != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "direct_deposits", 15);
+    result = cardano_direct_deposit_map_to_cip116_json(transaction_body->direct_deposits, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->account_balance_intervals != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "account_balance_intervals", 25);
+    result = cardano_account_balance_intervals_map_to_cip116_json(transaction_body->account_balance_intervals, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return result;
+}
+
+void
+cardano_sub_transaction_body_unref(cardano_sub_transaction_body_t** sub_transaction_body)
+{
+  if ((sub_transaction_body == NULL) || (*sub_transaction_body == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*sub_transaction_body)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *sub_transaction_body = NULL;
+    return;
+  }
+}
+
+void
+cardano_sub_transaction_body_ref(cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&sub_transaction_body->base);
+}
+
+size_t
+cardano_sub_transaction_body_refcount(const cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  if (sub_transaction_body == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&sub_transaction_body->base);
+}
+
+void
+cardano_sub_transaction_body_set_last_error(cardano_sub_transaction_body_t* sub_transaction_body, const char* message)
+{
+  cardano_object_set_last_error(&sub_transaction_body->base, message);
+}
+
+const char*
+cardano_sub_transaction_body_get_last_error(const cardano_sub_transaction_body_t* sub_transaction_body)
+{
+  return cardano_object_get_last_error(&sub_transaction_body->base);
+}
+
+cardano_error_t
+cardano_sub_transaction_body_deep_clone(const cardano_sub_transaction_body_t* source, cardano_sub_transaction_body_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_sub_transaction_body_t* copy = _cardano_malloc(sizeof(cardano_sub_transaction_body_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count            = 1U;
+  copy->base.deallocator          = source->base.deallocator;
+  copy->base.last_error[0]        = '\0';
+  copy->inputs                    = NULL;
+  copy->outputs                   = NULL;
+  copy->invalid_after             = NULL;
+  copy->certificates              = NULL;
+  copy->withdrawals               = NULL;
+  copy->aux_data_hash             = NULL;
+  copy->invalid_before            = NULL;
+  copy->mint                      = NULL;
+  copy->script_data_hash          = NULL;
+  copy->guards                    = NULL;
+  copy->network_id                = NULL;
+  copy->reference_inputs          = NULL;
+  copy->voting_procedures         = NULL;
+  copy->proposal_procedures       = NULL;
+  copy->treasury_value            = NULL;
+  copy->donation                  = NULL;
+  copy->required_top_level_guards = NULL;
+  copy->direct_deposits           = NULL;
+  copy->account_balance_intervals = NULL;
+  copy->cbor_cache                = NULL;
+
+  if (source->inputs != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_input_set_deep_clone(source->inputs, &copy->inputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->outputs != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_output_list_deep_clone(source->outputs, &copy->outputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->invalid_after != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->invalid_after = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->invalid_after == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->invalid_after, source->invalid_after, size));
+  }
+
+  if (source->certificates != NULL)
+  {
+    const cardano_error_t result = cardano_certificate_set_deep_clone(source->certificates, &copy->certificates);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->withdrawals != NULL)
+  {
+    const cardano_error_t result = cardano_withdrawal_map_deep_clone(source->withdrawals, &copy->withdrawals);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->aux_data_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->aux_data_hash, &copy->aux_data_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->invalid_before != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->invalid_before = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->invalid_before == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->invalid_before, source->invalid_before, size));
+  }
+
+  if (source->mint != NULL)
+  {
+    const cardano_error_t result = cardano_multi_asset_deep_clone(source->mint, &copy->mint);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->script_data_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->script_data_hash, &copy->script_data_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->guards != NULL)
+  {
+    const cardano_error_t result = cardano_guard_set_deep_clone(source->guards, &copy->guards);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->network_id != NULL)
+  {
+    const size_t size = sizeof(cardano_network_id_t);
+
+    copy->network_id = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->network_id == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->network_id, source->network_id, size));
+  }
+
+  if (source->reference_inputs != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_input_set_deep_clone(source->reference_inputs, &copy->reference_inputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->voting_procedures != NULL)
+  {
+    const cardano_error_t result = cardano_voting_procedures_deep_clone(source->voting_procedures, &copy->voting_procedures);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->proposal_procedures != NULL)
+  {
+    const cardano_error_t result = cardano_proposal_procedure_set_deep_clone(source->proposal_procedures, &copy->proposal_procedures);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->treasury_value != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->treasury_value = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->treasury_value == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->treasury_value, source->treasury_value, size));
+  }
+
+  if (source->donation != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->donation = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->donation == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->donation, source->donation, size));
+  }
+
+  if (source->required_top_level_guards != NULL)
+  {
+    const cardano_error_t result = cardano_required_guards_map_deep_clone(source->required_top_level_guards, &copy->required_top_level_guards);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->direct_deposits != NULL)
+  {
+    const cardano_error_t result = cardano_direct_deposit_map_deep_clone(source->direct_deposits, &copy->direct_deposits);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->account_balance_intervals != NULL)
+  {
+    const cardano_error_t result = cardano_account_balance_intervals_map_deep_clone(source->account_balance_intervals, &copy->account_balance_intervals);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/sub_transaction_set.c b/vendor/src/transaction_body/sub_transaction_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/sub_transaction_set.c
@@ -0,0 +1,600 @@
+/**
+ * \file sub_transaction_set.c
+ *
+ * \author angel.castillo
+ * \date   Jul 17, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano sub transaction set.
+ */
+typedef struct cardano_sub_transaction_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             use_tags;
+} cardano_sub_transaction_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a sub transaction set object.
+ *
+ * This function is responsible for properly deallocating a sub transaction set object (`cardano_sub_transaction_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the sub_transaction_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_sub_transaction_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the sub_transaction_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_sub_transaction_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_sub_transaction_set_t* list = (cardano_sub_transaction_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_sub_transaction_set_new(cardano_sub_transaction_set_t** sub_transaction_set)
+{
+  if (sub_transaction_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_sub_transaction_set_t* list = _cardano_malloc(sizeof(cardano_sub_transaction_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_sub_transaction_set_deallocate;
+
+  list->array    = cardano_array_new(128);
+  list->use_tags = true;
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *sub_transaction_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_sub_transaction_set_from_cbor(cardano_cbor_reader_t* reader, cardano_sub_transaction_set_t** sub_transaction_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (sub_transaction_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_sub_transaction_set_t* list   = NULL;
+  cardano_error_t                result = cardano_sub_transaction_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  list->use_tags = state == CARDANO_CBOR_READER_STATE_TAG;
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("sub_transaction_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_sub_transaction_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_set_unref(&list);
+    return result;
+  }
+
+  result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_set_unref(&list);
+    return result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'sub_transaction_set', the set must not be empty.");
+    cardano_sub_transaction_set_unref(&list);
+
+    return CARDANO_ERROR_INVALID_CBOR_ARRAY_SIZE;
+  }
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_sub_transaction_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_sub_transaction_t* element = NULL;
+
+    result = cardano_sub_transaction_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_sub_transaction_set_unref(&list);
+      return result;
+    }
+
+    result = cardano_sub_transaction_set_add(list, element);
+
+    cardano_sub_transaction_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'sub_transaction_set', the set must not contain duplicated elements.");
+      cardano_sub_transaction_set_unref(&list);
+
+      return result;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("sub_transaction_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_set_unref(&list);
+    return result;
+  }
+
+  *sub_transaction_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_sub_transaction_set_to_cbor(const cardano_sub_transaction_set_t* sub_transaction_set, cardano_cbor_writer_t* writer)
+{
+  if (sub_transaction_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(sub_transaction_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (sub_transaction_set->use_tags)
+  {
+    result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  const size_t array_size = cardano_array_get_size(sub_transaction_set->array);
+
+  result = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(sub_transaction_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(sub_transaction_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in sub_transaction_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_sub_transaction_to_cbor((const cardano_sub_transaction_t*)((const void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+size_t
+cardano_sub_transaction_set_get_length(const cardano_sub_transaction_set_t* sub_transaction_set)
+{
+  if (sub_transaction_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(sub_transaction_set->array);
+}
+
+cardano_error_t
+cardano_sub_transaction_set_get(
+  const cardano_sub_transaction_set_t* sub_transaction_set,
+  size_t                               index,
+  cardano_sub_transaction_t**          element)
+{
+  if (sub_transaction_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(sub_transaction_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_sub_transaction_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_sub_transaction_set_add(cardano_sub_transaction_set_t* sub_transaction_set, cardano_sub_transaction_t* element)
+{
+  if (sub_transaction_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t* id = cardano_sub_transaction_get_id(element);
+
+  if (id == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (size_t i = 0U; i < cardano_array_get_size(sub_transaction_set->array); ++i)
+  {
+    cardano_object_t* object = cardano_array_get(sub_transaction_set->array, i);
+
+    cardano_blake2b_hash_t* member_id = cardano_sub_transaction_get_id((cardano_sub_transaction_t*)((void*)object));
+
+    cardano_object_unref(&object);
+
+    if (member_id == NULL)
+    {
+      cardano_blake2b_hash_unref(&id);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    const bool duplicated = cardano_blake2b_hash_equals(member_id, id);
+
+    cardano_blake2b_hash_unref(&member_id);
+
+    if (duplicated)
+    {
+      cardano_blake2b_hash_unref(&id);
+      return CARDANO_ERROR_DUPLICATED_KEY;
+    }
+  }
+
+  cardano_blake2b_hash_unref(&id);
+
+  const size_t original_size = cardano_array_get_size(sub_transaction_set->array);
+  const size_t new_size      = cardano_array_push(sub_transaction_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_sub_transaction_set_find_by_id(
+  const cardano_sub_transaction_set_t* sub_transaction_set,
+  const cardano_blake2b_hash_t*        id,
+  cardano_sub_transaction_t**          element)
+{
+  if (sub_transaction_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0U; i < cardano_array_get_size(sub_transaction_set->array); ++i)
+  {
+    cardano_object_t* object = cardano_array_get(sub_transaction_set->array, i);
+
+    cardano_blake2b_hash_t* member_id = cardano_sub_transaction_get_id((cardano_sub_transaction_t*)((void*)object));
+
+    if (member_id == NULL)
+    {
+      cardano_object_unref(&object);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    const bool found = cardano_blake2b_hash_equals(member_id, id);
+
+    cardano_blake2b_hash_unref(&member_id);
+
+    if (found)
+    {
+      *element = (cardano_sub_transaction_t*)((void*)object);
+
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+bool
+cardano_sub_transaction_set_is_tagged(const cardano_sub_transaction_set_t* sub_transaction_set)
+{
+  if (sub_transaction_set == NULL)
+  {
+    return false;
+  }
+
+  return sub_transaction_set->use_tags;
+}
+
+cardano_error_t
+cardano_sub_transaction_set_set_use_tag(cardano_sub_transaction_set_t* sub_transaction_set, const bool use_tag)
+{
+  if (sub_transaction_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  sub_transaction_set->use_tags = use_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_sub_transaction_set_to_cip116_json(const cardano_sub_transaction_set_t* value, cardano_json_writer_t* writer)
+{
+  if ((value == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  for (size_t i = 0U; i < cardano_array_get_size(value->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(value->array, i);
+
+    if (element == NULL)
+    {
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    const cardano_error_t result = cardano_sub_transaction_to_cip116_json((const cardano_sub_transaction_t*)((const void*)element), writer);
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_sub_transaction_set_unref(cardano_sub_transaction_set_t** sub_transaction_set)
+{
+  if ((sub_transaction_set == NULL) || (*sub_transaction_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*sub_transaction_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *sub_transaction_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_sub_transaction_set_ref(cardano_sub_transaction_set_t* sub_transaction_set)
+{
+  if (sub_transaction_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&sub_transaction_set->base);
+}
+
+size_t
+cardano_sub_transaction_set_refcount(const cardano_sub_transaction_set_t* sub_transaction_set)
+{
+  if (sub_transaction_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&sub_transaction_set->base);
+}
+
+void
+cardano_sub_transaction_set_set_last_error(cardano_sub_transaction_set_t* sub_transaction_set, const char* message)
+{
+  cardano_object_set_last_error(&sub_transaction_set->base, message);
+}
+
+const char*
+cardano_sub_transaction_set_get_last_error(const cardano_sub_transaction_set_t* sub_transaction_set)
+{
+  return cardano_object_get_last_error(&sub_transaction_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_sub_transaction_t* copy   = NULL;
+  const cardano_error_t      result = cardano_sub_transaction_deep_clone((const cardano_sub_transaction_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_sub_transaction_set_deep_clone(const cardano_sub_transaction_set_t* source, cardano_sub_transaction_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_sub_transaction_set_t* copy = _cardano_malloc(sizeof(cardano_sub_transaction_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+  copy->use_tags           = source->use_tags;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/transaction_body.c b/vendor/src/transaction_body/transaction_body.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/transaction_body.c
@@ -0,0 +1,3977 @@
+/**
+ * \file transaction_body.c
+ *
+ * \author angel.castillo
+ * \date   Sep 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/guard_set.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "internals/body_fields.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The transaction body encapsulates the core details of a transaction.
+ */
+typedef struct cardano_transaction_body_t
+{
+    cardano_object_t                         base;
+    cardano_transaction_input_set_t*         inputs;
+    cardano_transaction_output_list_t*       outputs;
+    uint64_t*                                fee;
+    uint64_t*                                invalid_after;
+    cardano_certificate_set_t*               certificates;
+    cardano_withdrawal_map_t*                withdrawals;
+    cardano_update_t*                        update;
+    cardano_blake2b_hash_t*                  aux_data_hash;
+    uint64_t*                                invalid_before;
+    cardano_multi_asset_t*                   mint;
+    cardano_blake2b_hash_t*                  script_data_hash;
+    cardano_transaction_input_set_t*         collateral;
+    cardano_guard_set_t*                     guards;
+    cardano_network_id_t*                    network_id;
+    cardano_transaction_output_t*            collateral_return;
+    uint64_t*                                total_collateral;
+    cardano_transaction_input_set_t*         reference_inputs;
+    cardano_voting_procedures_t*             voting_procedures;
+    cardano_proposal_procedure_set_t*        proposal_procedures;
+    uint64_t*                                treasury_value;
+    uint64_t*                                donation;
+    cardano_sub_transaction_set_t*           sub_transactions;
+    cardano_required_guards_map_t*           required_top_level_guards;
+    cardano_direct_deposit_map_t*            direct_deposits;
+    cardano_account_balance_intervals_map_t* account_balance_intervals;
+    cardano_account_balance_intervals_map_t* starting_account_balance_intervals;
+    cardano_buffer_t*                        cbor_cache;
+} cardano_transaction_body_t;
+
+/* STATIC DECLARATIONS *******************************************************/
+
+/**
+ * \brief Type definition for a parameter handler function.
+ *
+ * This type defines a function pointer used for handling transaction body fields
+ * when reading from a CBOR reader. Each handler function reads a specific type of
+ * field from the CBOR reader and stores the result in the specified field pointer.
+ *
+ * The function pointed to by `param_handler_t` is responsible for:
+ * - Reading the field value from the provided CBOR reader.
+ * - Storing the field value in the provided field pointer.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the field value.
+ * \param[out] field_ptr A pointer to the field where the read value should be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the field was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+typedef cardano_error_t (*param_handler_t)(cardano_cbor_reader_t*, void*);
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a transaction body object.
+ *
+ * This function is responsible for properly deallocating a transaction body object (`cardano_transaction_body_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the transaction_body object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_transaction_body_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the transaction_body
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_transaction_body_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_transaction_body_t* data = (cardano_transaction_body_t*)object;
+
+  cardano_transaction_input_set_unref(&data->inputs);
+  cardano_transaction_output_list_unref(&data->outputs);
+  _cardano_free(data->fee);
+  _cardano_free(data->invalid_after);
+  cardano_certificate_set_unref(&data->certificates);
+  cardano_withdrawal_map_unref(&data->withdrawals);
+  cardano_update_unref(&data->update);
+  cardano_blake2b_hash_unref(&data->aux_data_hash);
+  _cardano_free(data->invalid_before);
+  cardano_multi_asset_unref(&data->mint);
+  cardano_blake2b_hash_unref(&data->script_data_hash);
+  cardano_transaction_input_set_unref(&data->collateral);
+  cardano_guard_set_unref(&data->guards);
+  _cardano_free(data->network_id);
+  cardano_transaction_output_unref(&data->collateral_return);
+  _cardano_free(data->total_collateral);
+  cardano_transaction_input_set_unref(&data->reference_inputs);
+  cardano_voting_procedures_unref(&data->voting_procedures);
+  cardano_proposal_procedure_set_unref(&data->proposal_procedures);
+  _cardano_free(data->treasury_value);
+  _cardano_free(data->donation);
+  cardano_sub_transaction_set_unref(&data->sub_transactions);
+  cardano_required_guards_map_unref(&data->required_top_level_guards);
+  cardano_direct_deposit_map_unref(&data->direct_deposits);
+  cardano_account_balance_intervals_map_unref(&data->account_balance_intervals);
+  cardano_account_balance_intervals_map_unref(&data->starting_account_balance_intervals);
+  cardano_buffer_unref(&data->cbor_cache);
+
+  _cardano_free(object);
+}
+
+/**
+ * \brief Computes the map size of this transaction body object.
+ *
+ * \param body The transaction body object to compute the map size for.
+ *
+ * \return The map size of the transaction body object.
+ */
+static size_t
+get_map_size(const cardano_transaction_body_t* body)
+{
+  assert(body != NULL);
+
+  size_t map_size = 0U;
+
+  if (body->inputs != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->outputs != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->fee != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->invalid_after != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->certificates != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->withdrawals != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->update != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->aux_data_hash != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->invalid_before != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->mint != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->script_data_hash != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->collateral != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (cardano_body_has_guards(body->guards))
+  {
+    map_size += 1U;
+  }
+
+  if (body->network_id != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->collateral_return != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->total_collateral != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->reference_inputs != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->voting_procedures != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->proposal_procedures != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->treasury_value != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->donation != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->sub_transactions != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->required_top_level_guards != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->direct_deposits != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->account_balance_intervals != NULL)
+  {
+    map_size += 1U;
+  }
+
+  if (body->starting_account_balance_intervals != NULL)
+  {
+    map_size += 1U;
+  }
+
+  return map_size;
+}
+
+/**
+ * \brief Retrieves a pointer to the specified field in the transaction body body object.
+ *
+ * This function returns a pointer to the field specified by the key in the given protocol
+ * parameter body object. The key corresponds to different fields within the body object.
+ * If the key does not correspond to any field, NULL is returned.
+ *
+ * \param[in] body Pointer to the transaction body body object.
+ *
+ * \return void* A pointer to the specified field, or NULL if the key does not correspond to any field.
+ *
+ * \note The caller must ensure that the `cardano_transaction_body_t` pointer is not NULL before calling this function.
+ */
+static void*
+get_field_ptr(cardano_transaction_body_t* body, size_t key)
+{
+  assert(body != NULL);
+
+  switch (key)
+  {
+    case 0:
+      return (void*)&body->inputs;
+    case 1:
+      return (void*)&body->outputs;
+    case 2:
+      return (void*)&body->fee;
+    case 3:
+      return (void*)&body->invalid_after;
+    case 4:
+      return (void*)&body->certificates;
+    case 5:
+      return (void*)&body->withdrawals;
+    case 6:
+      return (void*)&body->update;
+    case 7:
+      return (void*)&body->aux_data_hash;
+    case 8:
+      return (void*)&body->invalid_before;
+    case 9:
+      return (void*)&body->mint;
+    case 11:
+      return (void*)&body->script_data_hash;
+    case 13:
+      return (void*)&body->collateral;
+    case 14:
+      return (void*)&body->guards;
+    case 15:
+      return (void*)&body->network_id;
+    case 16:
+      return (void*)&body->collateral_return;
+    case 17:
+      return (void*)&body->total_collateral;
+    case 18:
+      return (void*)&body->reference_inputs;
+    case 19:
+      return (void*)&body->voting_procedures;
+    case 20:
+      return (void*)&body->proposal_procedures;
+    case 21:
+      return (void*)&body->treasury_value;
+    case 22:
+      return (void*)&body->donation;
+    case 23:
+      return (void*)&body->sub_transactions;
+    case 24:
+      return (void*)&body->required_top_level_guards;
+    case 25:
+      return (void*)&body->direct_deposits;
+    case 26:
+      return (void*)&body->account_balance_intervals;
+    case 27:
+      return (void*)&body->starting_account_balance_intervals;
+
+    default:
+      return NULL;
+  }
+}
+
+/**
+ * \brief Reads a uint64_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a uint64_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as uint64_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the uint64_t value.
+ * \param[out] field_ptr A pointer to the field where the read uint64_t value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the uint64_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_uint64(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_cbor_reader_read_uint(reader, *field);
+}
+
+/**
+ * \brief Reads the time to live field from the CBOR reader and stores it in the specified field.
+ *
+ * This function allocates the storage for the time to live value and delegates the wire decoding
+ * to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the uint64_t value.
+ * \param[out] field_ptr A pointer to the field where the read uint64_t value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the uint64_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_ttl(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_body_read_ttl(reader, *field);
+}
+
+/**
+ * \brief Reads the validity start interval field from the CBOR reader and stores it in the specified field.
+ *
+ * This function allocates the storage for the validity start interval value and delegates the
+ * wire decoding to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the uint64_t value.
+ * \param[out] field_ptr A pointer to the field where the read uint64_t value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the uint64_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_validity_start(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_body_read_validity_start(reader, *field);
+}
+
+/**
+ * \brief Reads the treasury value field from the CBOR reader and stores it in the specified field.
+ *
+ * This function allocates the storage for the treasury value and delegates the wire decoding to
+ * the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the uint64_t value.
+ * \param[out] field_ptr A pointer to the field where the read uint64_t value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the uint64_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_treasury_value(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_body_read_treasury_value(reader, *field);
+}
+
+/**
+ * \brief Reads the donation field from the CBOR reader and stores it in the specified field.
+ *
+ * This function allocates the storage for the donation value and delegates the wire decoding to
+ * the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the uint64_t value.
+ * \param[out] field_ptr A pointer to the field where the read uint64_t value should be stored.
+ *                       The field pointer should be of type uint64_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the uint64_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_donation(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  uint64_t** field = (uint64_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_body_read_donation(reader, *field);
+}
+
+/**
+ * \brief Reads a cardano_transaction_input_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_transaction_input_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_transaction_input_set_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_transaction_input_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_transaction_input_set_t value should be stored.
+ *                       The field pointer should be of type cardano_transaction_input_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_transaction_input_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_transaction_input_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_transaction_input_set_t** field = (cardano_transaction_input_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_transaction_input_set_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads the inputs field from the CBOR reader and stores it in the specified field.
+ *
+ * This function checks the field for duplicates and delegates the wire decoding of the
+ * transaction input set to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_transaction_input_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_transaction_input_set_t value should be stored.
+ *                       The field pointer should be of type cardano_transaction_input_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_transaction_input_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_inputs(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_transaction_input_set_t** field = (cardano_transaction_input_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_inputs(reader, field);
+}
+
+/**
+ * \brief Reads the reference inputs field from the CBOR reader and stores it in the specified field.
+ *
+ * This function checks the field for duplicates and delegates the wire decoding of the
+ * transaction input set to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_transaction_input_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_transaction_input_set_t value should be stored.
+ *                       The field pointer should be of type cardano_transaction_input_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_transaction_input_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_reference_inputs(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_transaction_input_set_t** field = (cardano_transaction_input_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_reference_inputs(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_transaction_output_list_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_transaction_output_list_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_transaction_output_list_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_transaction_output_list_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_transaction_output_list_t value should be stored.
+ *                       The field pointer should be of type cardano_transaction_output_list_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_transaction_output_list_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_transaction_output_list(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_transaction_output_list_t** field = (cardano_transaction_output_list_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_outputs(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_certificate_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_certificate_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_certificate_set_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_certificate_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_certificate_set_t value should be stored.
+ *                       The field pointer should be of type cardano_certificate_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_certificate_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_certificate_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_certificate_set_t** field = (cardano_certificate_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_certificates(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_withdrawal_map_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_withdrawal_map_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_withdrawal_map_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_withdrawal_map_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_withdrawal_map_t value should be stored.
+ *                       The field pointer should be of type cardano_withdrawal_map_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_withdrawal_map_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_withdrawal_map(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_withdrawal_map_t** field = (cardano_withdrawal_map_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_withdrawals(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_update_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_update_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_update_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_update_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_update_t value should be stored.
+ *                       The field pointer should be of type cardano_update_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_update_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_update(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_update_t** field = (cardano_update_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_update_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads the auxiliary data hash field from the CBOR reader and stores it in the specified field.
+ *
+ * This function checks the field for duplicates and delegates the wire decoding of the blake2b
+ * hash to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_blake2b_hash_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_blake2b_hash_t value should be stored.
+ *                       The field pointer should be of type cardano_blake2b_hash_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_blake2b_hash_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_aux_data_hash(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_blake2b_hash_t** field = (cardano_blake2b_hash_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_aux_data_hash(reader, field);
+}
+
+/**
+ * \brief Reads the script data hash field from the CBOR reader and stores it in the specified field.
+ *
+ * This function checks the field for duplicates and delegates the wire decoding of the blake2b
+ * hash to the shared body field codec.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_blake2b_hash_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_blake2b_hash_t value should be stored.
+ *                       The field pointer should be of type cardano_blake2b_hash_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_blake2b_hash_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_script_data_hash(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_blake2b_hash_t** field = (cardano_blake2b_hash_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_script_data_hash(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_multi_asset_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_multi_asset_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_multi_asset_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_multi_asset_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_multi_asset_t value should be stored.
+ *                       The field pointer should be of type cardano_multi_asset_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_multi_asset_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_multi_asset(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_multi_asset_t** field = (cardano_multi_asset_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_mint(reader, field);
+}
+
+/**
+ * \brief Determines whether the CBOR reader is positioned at an empty guard set.
+ *
+ * Historical (pre-Conway) transaction bodies may carry an empty required signers set at key 14,
+ * either as a bare empty array or as a tag 258 empty array. This function looks ahead on a clone
+ * of the reader without consuming any input.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the guard set value.
+ * \param[out] is_empty On success, set to \c true if the guard set is empty; \c false otherwise.
+ * \param[out] is_tagged On success, set to \c true if the guard set is prefixed with tag 258; \c false otherwise.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the look ahead completed successfully.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+peek_empty_guard_set(cardano_cbor_reader_t* reader, bool* is_empty, bool* is_tagged)
+{
+  assert(reader != NULL);
+  assert(is_empty != NULL);
+  assert(is_tagged != NULL);
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        result      = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  result = cardano_cbor_reader_peek_state(reader_copy, &state);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_copy);
+    return result;
+  }
+
+  *is_tagged = state == CARDANO_CBOR_READER_STATE_TAG;
+
+  if (*is_tagged)
+  {
+    cardano_cbor_tag_t tag = CARDANO_CBOR_TAG_SET;
+
+    result = cardano_cbor_reader_read_tag(reader_copy, &tag);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_reader_unref(&reader_copy);
+      return result;
+    }
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_array(reader_copy, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader_copy);
+    return result;
+  }
+
+  result = cardano_cbor_reader_peek_state(reader_copy, &state);
+
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *is_empty = state == CARDANO_CBOR_READER_STATE_END_ARRAY;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Consumes an empty guard set from the CBOR reader and materializes it as an empty set.
+ *
+ * The guard set decoder rejects empty sets because the Dijkstra sub body forbids them, but the
+ * transaction body key 14 must remain permissive with the historical empty required signers form.
+ * This function consumes the optional tag 258, the empty array, and creates an empty guard set
+ * that preserves the tag presence, so the set keeps its decoded form when it is encoded on its own.
+ * The body re-encodes the decoded bytes from its CBOR cache, and omits an empty guard set when it
+ * is encoded from its fields.
+ *
+ * \param[in] reader A pointer to the CBOR reader positioned at the empty guard set value.
+ * \param[in] is_tagged \c true if the empty guard set is prefixed with tag 258; \c false otherwise.
+ * \param[out] guard_set On success, points to a newly created empty guard set.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the empty guard set was successfully read.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+read_empty_guard_set(cardano_cbor_reader_t* reader, const bool is_tagged, cardano_guard_set_t** guard_set)
+{
+  assert(reader != NULL);
+  assert(guard_set != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (is_tagged)
+  {
+    result = cardano_cbor_validate_tag("guard_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  int64_t length = 0;
+
+  result = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_cbor_validate_end_array("guard_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_guard_set_t* empty_set = NULL;
+
+  result = cardano_guard_set_new(&empty_set);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_guard_set_set_use_tag(empty_set, is_tagged);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_guard_set_unref(&empty_set);
+    return result;
+  }
+
+  *guard_set = empty_set;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a cardano_guard_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_guard_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_guard_set_t in the transaction body body.
+ *
+ * Empty sets are accepted for backwards compatibility with the historical required signers form
+ * and are materialized as empty guard sets, both with and without the tag 258 prefix.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_guard_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_guard_set_t value should be stored.
+ *                       The field pointer should be of type cardano_guard_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_guard_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_guard_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_guard_set_t** field = (cardano_guard_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  bool is_empty  = false;
+  bool is_tagged = false;
+
+  const cardano_error_t peek_result = peek_empty_guard_set(reader, &is_empty, &is_tagged);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    return peek_result;
+  }
+
+  if (is_empty)
+  {
+    return read_empty_guard_set(reader, is_tagged, field);
+  }
+
+  return cardano_body_read_guards(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_sub_transaction_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_sub_transaction_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_sub_transaction_set_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_sub_transaction_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_sub_transaction_set_t value should be stored.
+ *                       The field pointer should be of type cardano_sub_transaction_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_sub_transaction_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_sub_transaction_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_sub_transaction_set_t** field = (cardano_sub_transaction_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_sub_transaction_set_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_required_guards_map_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_required_guards_map_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_required_guards_map_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_required_guards_map_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_required_guards_map_t value should be stored.
+ *                       The field pointer should be of type cardano_required_guards_map_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_required_guards_map_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_required_guards_map(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_required_guards_map_t** field = (cardano_required_guards_map_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_required_top_level_guards(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_direct_deposit_map_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_direct_deposit_map_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_direct_deposit_map_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_direct_deposit_map_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_direct_deposit_map_t value should be stored.
+ *                       The field pointer should be of type cardano_direct_deposit_map_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_direct_deposit_map_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_direct_deposit_map(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_direct_deposit_map_t** field = (cardano_direct_deposit_map_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_direct_deposits(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_account_balance_intervals_map_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_account_balance_intervals_map_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_account_balance_intervals_map_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_account_balance_intervals_map_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_account_balance_intervals_map_t value should be stored.
+ *                       The field pointer should be of type cardano_account_balance_intervals_map_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_account_balance_intervals_map_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_account_balance_intervals_map(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_account_balance_intervals_map_t** field = (cardano_account_balance_intervals_map_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_account_balance_intervals(reader, field);
+}
+
+/**
+ * \brief Reads the starting account balance intervals map from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_account_balance_intervals_map_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as the handler function for the starting account balance
+ * intervals field of the transaction body, which constrains the account balances as they were before
+ * the batch started.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_account_balance_intervals_map_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_account_balance_intervals_map_t value should be stored.
+ *                       The field pointer should be of type cardano_account_balance_intervals_map_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_account_balance_intervals_map_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_starting_account_balance_intervals_map(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_account_balance_intervals_map_t** field = (cardano_account_balance_intervals_map_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_starting_account_balance_intervals(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_network_id_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_network_id_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_network_id_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_network_id_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_network_id_t value should be stored.
+ *                       The field pointer should be of type cardano_network_id_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_network_id_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_network_id(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_network_id_t** field = (cardano_network_id_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  *field = _cardano_malloc(sizeof(uint64_t));
+
+  if (*field == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return cardano_body_read_network_id(reader, *field);
+}
+
+/**
+ * \brief Reads a cardano_transaction_output_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_transaction_output_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_transaction_output_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_transaction_output_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_transaction_output_t value should be stored.
+ *                       The field pointer should be of type cardano_transaction_output_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_transaction_output_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_transaction_output(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_transaction_output_t** field = (cardano_transaction_output_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_transaction_output_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_voting_procedures_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_voting_procedures_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_voting_procedures_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_voting_procedures_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_voting_procedures_t value should be stored.
+ *                       The field pointer should be of type cardano_voting_procedures_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_voting_procedures_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_voting_procedures(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_voting_procedures_t** field = (cardano_voting_procedures_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_voting_procedures(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_proposal_procedure_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_proposal_procedure_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_proposal_procedure_set_t in the transaction body body.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_proposal_procedure_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_proposal_procedure_set_t value should be stored.
+ *                       The field pointer should be of type cardano_proposal_procedure_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_proposal_procedure_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_proposal_procedure_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_proposal_procedure_set_t** field = (cardano_proposal_procedure_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_body_read_proposal_procedures(reader, field);
+}
+
+/**
+ * \brief Handles an invalid key in the CBOR map during deserialization.
+ *
+ * This function is used as a handler for invalid keys encountered in the CBOR map.
+ * It does nothing with the provided reader and field pointer, and always returns
+ * \ref CARDANO_ERROR_INVALID_CBOR_MAP_KEY to indicate the error.
+ *
+ * \param[in] reader A pointer to the CBOR reader. This parameter is unused.
+ * \param[in] field_ptr A pointer to the field where the value should be stored. This parameter is unused.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - Always returns \ref CARDANO_ERROR_INVALID_CBOR_MAP_KEY.
+ */
+static cardano_error_t
+handle_invalid_key(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  CARDANO_UNUSED(reader);
+  CARDANO_UNUSED(field_ptr);
+
+  return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated unsigned integer value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the unsigned integer value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_uint_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const uint64_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, *value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated input set value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the input set value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_transaction_input_set_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_transaction_input_set_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_transaction_input_set_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated update value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the update value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_update_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_update_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_update_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated output value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the output value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_transaction_output_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_transaction_output_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_transaction_output_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated sub transaction set value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the sub transaction set value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_sub_transaction_set_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_sub_transaction_set_t* value)
+{
+  assert(writer != NULL);
+
+  if (value != NULL)
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_sub_transaction_set_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Builds the legacy required signers view over a guard set.
+ *
+ * The Dijkstra ledger derives the required signer hashes of a transaction from the key hash
+ * members of its guards. This function materializes that view as a set of blake2b hashes,
+ * skipping any script hash guard.
+ *
+ * \param[in] guards Pointer to the guard set to derive the view from. Must not be NULL.
+ *
+ * \return A newly allocated \ref cardano_blake2b_hash_set_t with the key hash guard members,
+ *         or NULL if memory allocation fails.
+ */
+static cardano_blake2b_hash_set_t*
+get_key_hash_guards(const cardano_guard_set_t* guards)
+{
+  assert(guards != NULL);
+
+  cardano_blake2b_hash_set_t* hashes = NULL;
+
+  if (cardano_blake2b_hash_set_new(&hashes) != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  for (size_t i = 0U; i < cardano_guard_set_get_length(guards); ++i)
+  {
+    cardano_credential_t* credential = NULL;
+    cardano_error_t       result     = cardano_guard_set_get(guards, i, &credential);
+
+    cardano_credential_unref(&credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_set_unref(&hashes);
+      return NULL;
+    }
+
+    cardano_credential_type_t type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+
+    result = cardano_credential_get_type(credential, &type);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_set_unref(&hashes);
+      return NULL;
+    }
+
+    if (type != CARDANO_CREDENTIAL_TYPE_KEY_HASH)
+    {
+      continue;
+    }
+
+    cardano_blake2b_hash_t* hash = cardano_credential_get_hash(credential);
+
+    if (hash == NULL)
+    {
+      cardano_blake2b_hash_set_unref(&hashes);
+      return NULL;
+    }
+
+    result = cardano_blake2b_hash_set_add(hashes, hash);
+
+    cardano_blake2b_hash_unref(&hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_set_unref(&hashes);
+      return NULL;
+    }
+  }
+
+  return hashes;
+}
+
+/**
+ * \brief Allocates and initializes a new cardano_transaction_body_t structure.
+ *
+ * \param transaction_body A pointer to the location where the new cardano_transaction_body_t structure should be stored.
+ * \return The pointer to the newly allocated cardano_transaction_body_t structure.
+ */
+static cardano_transaction_body_t*
+create_transaction_body_new(void)
+{
+  cardano_transaction_body_t* transaction_body = (cardano_transaction_body_t*)_cardano_malloc(sizeof(cardano_transaction_body_t));
+
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  transaction_body->base.deallocator                   = cardano_transaction_body_deallocate;
+  transaction_body->base.ref_count                     = 1;
+  transaction_body->base.last_error[0]                 = '\0';
+  transaction_body->inputs                             = NULL;
+  transaction_body->outputs                            = NULL;
+  transaction_body->fee                                = NULL;
+  transaction_body->invalid_after                      = NULL;
+  transaction_body->certificates                       = NULL;
+  transaction_body->withdrawals                        = NULL;
+  transaction_body->update                             = NULL;
+  transaction_body->aux_data_hash                      = NULL;
+  transaction_body->invalid_before                     = NULL;
+  transaction_body->mint                               = NULL;
+  transaction_body->script_data_hash                   = NULL;
+  transaction_body->collateral                         = NULL;
+  transaction_body->guards                             = NULL;
+  transaction_body->network_id                         = NULL;
+  transaction_body->collateral_return                  = NULL;
+  transaction_body->total_collateral                   = NULL;
+  transaction_body->reference_inputs                   = NULL;
+  transaction_body->voting_procedures                  = NULL;
+  transaction_body->proposal_procedures                = NULL;
+  transaction_body->treasury_value                     = NULL;
+  transaction_body->donation                           = NULL;
+  transaction_body->sub_transactions                   = NULL;
+  transaction_body->required_top_level_guards          = NULL;
+  transaction_body->direct_deposits                    = NULL;
+  transaction_body->account_balance_intervals          = NULL;
+  transaction_body->starting_account_balance_intervals = NULL;
+  transaction_body->cbor_cache                         = NULL;
+
+  return transaction_body;
+}
+
+/* STATIC CONSTANTS ***********************************************************/
+
+// cppcheck-suppress misra-c2012-8.9; Reason: Is more readable to define the map here
+static const param_handler_t param_handlers[] = {
+  handle_inputs,
+  handle_transaction_output_list,
+  handle_uint64,
+  handle_ttl,
+  handle_certificate_set,
+  handle_withdrawal_map,
+  handle_update,
+  handle_aux_data_hash,
+  handle_validity_start,
+  handle_multi_asset,
+  handle_invalid_key, // unused key
+  handle_script_data_hash,
+  handle_invalid_key, // unused key
+  handle_transaction_input_set,
+  handle_guard_set,
+  handle_network_id,
+  handle_transaction_output,
+  handle_uint64,
+  handle_reference_inputs,
+  handle_voting_procedures,
+  handle_proposal_procedure_set,
+  handle_treasury_value,
+  handle_donation,
+  handle_sub_transaction_set,
+  handle_required_guards_map,
+  handle_direct_deposit_map,
+  handle_account_balance_intervals_map,
+  handle_starting_account_balance_intervals_map
+};
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_transaction_body_new(
+  cardano_transaction_input_set_t*   inputs,
+  cardano_transaction_output_list_t* outputs,
+  const uint64_t                     fee,
+  const uint64_t*                    ttl,
+  cardano_transaction_body_t**       transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (outputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *transaction_body = create_transaction_body_new();
+
+  if (*transaction_body == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*transaction_body)->fee = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+  if ((*transaction_body)->fee == NULL)
+  {
+    cardano_transaction_body_deallocate(*transaction_body);
+    *transaction_body = NULL;
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_transaction_input_set_ref(inputs);
+  cardano_transaction_output_list_ref(outputs);
+
+  (*transaction_body)->inputs  = inputs;
+  (*transaction_body)->outputs = outputs;
+  *(*transaction_body)->fee    = fee;
+
+  if (ttl != NULL)
+  {
+    (*transaction_body)->invalid_after = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if ((*transaction_body)->invalid_after == NULL)
+    {
+      cardano_transaction_body_deallocate(*transaction_body);
+      *transaction_body = NULL;
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    *(*transaction_body)->invalid_after = *ttl;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_body_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_body_t** transaction_body)
+{
+  if (!reader || !transaction_body)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *transaction_body                = NULL;
+  cardano_transaction_body_t* body = create_transaction_body_new();
+
+  if (body == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        copy_result = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_body_unref(&body);
+    return copy_result;
+  }
+
+  copy_result = cardano_cbor_reader_read_encoded_value(reader_copy, &body->cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_body_unref(&body);
+    return copy_result;
+  }
+
+  int64_t         map_size = 0;
+  cardano_error_t result   = cardano_cbor_reader_read_start_map(reader, &map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_body_unref(&body);
+
+    return result;
+  }
+
+  for (size_t i = 0U; i < (size_t)map_size; ++i)
+  {
+    uint64_t key = 0;
+    result       = cardano_cbor_reader_read_uint(reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_body_unref(&body);
+
+      return result;
+    }
+
+    if (key >= (sizeof(param_handlers) / sizeof(param_handlers[0])))
+    {
+      cardano_transaction_body_unref(&body);
+
+      return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+    }
+
+    void* field_ptr = get_field_ptr(body, key);
+
+    if (field_ptr == NULL)
+    {
+      cardano_transaction_body_unref(&body);
+
+      return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+    }
+
+    result = param_handlers[key](reader, field_ptr);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_body_unref(&body);
+
+      return result;
+    }
+  }
+
+  if ((body->inputs == NULL) || (body->outputs == NULL) || (body->fee == NULL))
+  {
+    cardano_cbor_reader_set_last_error(reader, "There was an error decoding 'transaction_body', 'inputs' (key 0), 'outputs' (key 1) and 'fee' (key 2) must be present.");
+    cardano_transaction_body_unref(&body);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *transaction_body = body;
+
+  cardano_error_t validation_result = cardano_cbor_validate_end_map("transaction_body", reader);
+
+  if (validation_result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_body_unref(transaction_body);
+    return validation_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_body_to_cbor(const cardano_transaction_body_t* transaction_body, cardano_cbor_writer_t* writer)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (transaction_body->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(transaction_body->cbor_cache), cardano_buffer_get_size(transaction_body->cbor_cache));
+  }
+
+  const size_t map_size = get_map_size(transaction_body);
+
+  cardano_error_t result = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_inputs_if_present(writer, transaction_body->inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_outputs_if_present(writer, transaction_body->outputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 2U, transaction_body->fee);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_ttl_if_present(writer, transaction_body->invalid_after);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_certificates_if_present(writer, transaction_body->certificates);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_withdrawals_if_present(writer, transaction_body->withdrawals);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_update_if_present(writer, 6U, transaction_body->update);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_aux_data_hash_if_present(writer, transaction_body->aux_data_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_validity_start_if_present(writer, transaction_body->invalid_before);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_mint_if_present(writer, transaction_body->mint);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_script_data_hash_if_present(writer, transaction_body->script_data_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_transaction_input_set_if_present(writer, 13U, transaction_body->collateral);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_guards_if_present(writer, transaction_body->guards);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_network_id_if_present(writer, transaction_body->network_id);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_transaction_output_if_present(writer, 16U, transaction_body->collateral_return);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_uint_if_present(writer, 17U, transaction_body->total_collateral);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_reference_inputs_if_present(writer, transaction_body->reference_inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_voting_procedures_if_present(writer, transaction_body->voting_procedures);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_proposal_procedures_if_present(writer, transaction_body->proposal_procedures);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_treasury_value_if_present(writer, transaction_body->treasury_value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_donation_if_present(writer, transaction_body->donation);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = write_sub_transaction_set_if_present(writer, 23U, transaction_body->sub_transactions);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_required_top_level_guards_if_present(writer, transaction_body->required_top_level_guards);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_direct_deposits_if_present(writer, transaction_body->direct_deposits);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_account_balance_intervals_if_present(writer, transaction_body->account_balance_intervals);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_body_write_starting_account_balance_intervals_if_present(writer, transaction_body->starting_account_balance_intervals);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_body_to_cip116_json(const cardano_transaction_body_t* transaction_body, cardano_json_writer_t* writer)
+{
+  if ((transaction_body == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "inputs", 6);
+  cardano_error_t result = cardano_transaction_input_set_to_cip116_json(transaction_body->inputs, writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (transaction_body->outputs != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "outputs", 7);
+    result = cardano_transaction_output_list_to_cip116_json(transaction_body->outputs, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  const uint64_t fee = (transaction_body->fee == NULL) ? (0U) : (*transaction_body->fee);
+  cardano_json_writer_write_property_name(writer, "fee", 3);
+  cardano_json_writer_write_uint_as_string(writer, fee);
+
+  if (transaction_body->invalid_after != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "ttl", 3);
+    cardano_json_writer_write_uint_as_string(writer, *transaction_body->invalid_after);
+  }
+
+  if (transaction_body->certificates != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "certs", 5);
+    result = cardano_certificate_set_to_cip116_json(transaction_body->certificates, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->withdrawals != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "withdrawals", 11);
+    result = cardano_withdrawal_map_to_cip116_json(transaction_body->withdrawals, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->update != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "update", 6);
+    result = cardano_update_to_cip116_json(transaction_body->update, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->aux_data_hash != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "auxiliary_data_hash", 19);
+    result = cardano_blake2b_hash_to_cip116_json(transaction_body->aux_data_hash, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->invalid_before != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "validity_start_interval", 23);
+    cardano_json_writer_write_uint_as_string(writer, *transaction_body->invalid_before);
+  }
+
+  if (transaction_body->mint != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "mint", 4);
+    result = cardano_multi_asset_to_cip116_json_ex(transaction_body->mint, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->script_data_hash != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "script_data_hash", 16);
+    result = cardano_blake2b_hash_to_cip116_json(transaction_body->script_data_hash, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->collateral != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "collateral", 10);
+    result = cardano_transaction_input_set_to_cip116_json(transaction_body->collateral, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (cardano_body_has_guards(transaction_body->guards))
+  {
+    cardano_json_writer_write_property_name(writer, "guards", 6);
+    result = cardano_guard_set_to_cip116_json(transaction_body->guards, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->network_id != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "network_id", 10);
+
+    const cardano_network_id_t network_id     = *transaction_body->network_id;
+    const char*                network_id_str = (network_id == CARDANO_NETWORK_ID_MAIN_NET) ? "mainnet" : "testnet";
+    cardano_json_writer_write_string(writer, network_id_str, 7);
+  }
+
+  if (transaction_body->collateral_return != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "collateral_return", 17);
+    result = cardano_transaction_output_to_cip116_json(transaction_body->collateral_return, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->total_collateral != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "total_collateral", 16);
+    cardano_json_writer_write_uint_as_string(writer, *transaction_body->total_collateral);
+  }
+
+  if (transaction_body->reference_inputs != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "reference_inputs", 16);
+    result = cardano_transaction_input_set_to_cip116_json(transaction_body->reference_inputs, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->voting_procedures != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "voting_procedures", 17);
+    result = cardano_voting_procedures_to_cip116_json(transaction_body->voting_procedures, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->proposal_procedures != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "proposal_procedures", 19);
+    result = cardano_proposal_procedure_set_to_cip116_json(transaction_body->proposal_procedures, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->treasury_value != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "treasury_value", 14);
+    cardano_json_writer_write_uint_as_string(writer, *transaction_body->treasury_value);
+  }
+
+  if (transaction_body->donation != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "donation", 8);
+    cardano_json_writer_write_uint_as_string(writer, *transaction_body->donation);
+  }
+
+  if (transaction_body->sub_transactions != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "sub_transactions", 16);
+    result = cardano_sub_transaction_set_to_cip116_json(transaction_body->sub_transactions, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->required_top_level_guards != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "required_top_level_guards", 25);
+    result = cardano_required_guards_map_to_cip116_json(transaction_body->required_top_level_guards, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->direct_deposits != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "direct_deposits", 15);
+    result = cardano_direct_deposit_map_to_cip116_json(transaction_body->direct_deposits, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->account_balance_intervals != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "account_balance_intervals", 25);
+    result = cardano_account_balance_intervals_map_to_cip116_json(transaction_body->account_balance_intervals, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (transaction_body->starting_account_balance_intervals != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "starting_account_balance_intervals", 34);
+    result = cardano_account_balance_intervals_map_to_cip116_json(transaction_body->starting_account_balance_intervals, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return result;
+}
+
+cardano_transaction_input_set_t*
+cardano_transaction_body_get_inputs(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_input_set_ref(transaction_body->inputs);
+
+  return transaction_body->inputs;
+}
+
+cardano_error_t
+cardano_transaction_body_set_inputs(cardano_transaction_body_t* transaction_body, cardano_transaction_input_set_t* inputs)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_input_set_ref(inputs);
+  cardano_transaction_input_set_unref(&transaction_body->inputs);
+  transaction_body->inputs = inputs;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_transaction_output_list_t*
+cardano_transaction_body_get_outputs(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_output_list_ref(transaction_body->outputs);
+
+  return transaction_body->outputs;
+}
+
+cardano_error_t
+cardano_transaction_body_set_outputs(cardano_transaction_body_t* transaction_body, cardano_transaction_output_list_t* outputs)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (outputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_list_ref(outputs);
+  cardano_transaction_output_list_unref(&transaction_body->outputs);
+  transaction_body->outputs = outputs;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_transaction_body_get_fee(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return 0U;
+  }
+
+  if (transaction_body->fee == NULL)
+  {
+    return 0U;
+  }
+
+  return *transaction_body->fee;
+}
+
+cardano_error_t
+cardano_transaction_body_set_fee(cardano_transaction_body_t* transaction_body, const uint64_t fee)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (transaction_body->fee == NULL)
+  {
+    transaction_body->fee = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if (transaction_body->fee == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *transaction_body->fee = fee;
+
+  return CARDANO_SUCCESS;
+}
+
+const uint64_t*
+cardano_transaction_body_get_invalid_after(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  return transaction_body->invalid_after;
+}
+
+cardano_error_t
+cardano_transaction_body_set_invalid_after(cardano_transaction_body_t* transaction_body, const uint64_t* epoch)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (epoch == NULL)
+  {
+    _cardano_free(transaction_body->invalid_after);
+    transaction_body->invalid_after = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (transaction_body->invalid_after == NULL)
+  {
+    transaction_body->invalid_after = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if (transaction_body->invalid_after == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *transaction_body->invalid_after = *epoch;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_certificate_set_t*
+cardano_transaction_body_get_certificates(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_certificate_set_ref(transaction_body->certificates);
+
+  return transaction_body->certificates;
+}
+
+cardano_error_t
+cardano_transaction_body_set_certificates(cardano_transaction_body_t* transaction_body, cardano_certificate_set_t* certificates)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificates == NULL)
+  {
+    cardano_certificate_set_unref(&transaction_body->certificates);
+    transaction_body->certificates = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_certificate_set_ref(certificates);
+  cardano_certificate_set_unref(&transaction_body->certificates);
+  transaction_body->certificates = certificates;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_withdrawal_map_t*
+cardano_transaction_body_get_withdrawals(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_withdrawal_map_ref(transaction_body->withdrawals);
+
+  return transaction_body->withdrawals;
+}
+
+cardano_error_t
+cardano_transaction_body_set_withdrawals(cardano_transaction_body_t* transaction_body, cardano_withdrawal_map_t* withdrawals)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (withdrawals == NULL)
+  {
+    cardano_withdrawal_map_unref(&transaction_body->withdrawals);
+    transaction_body->withdrawals = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_withdrawal_map_ref(withdrawals);
+  cardano_withdrawal_map_unref(&transaction_body->withdrawals);
+  transaction_body->withdrawals = withdrawals;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_update_t*
+cardano_transaction_body_get_update(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_update_ref(transaction_body->update);
+
+  return transaction_body->update;
+}
+
+cardano_error_t
+cardano_transaction_body_set_update(cardano_transaction_body_t* transaction_body, cardano_update_t* update)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (update == NULL)
+  {
+    cardano_update_unref(&transaction_body->update);
+    transaction_body->update = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_update_ref(update);
+  cardano_update_unref(&transaction_body->update);
+  transaction_body->update = update;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_transaction_body_get_aux_data_hash(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(transaction_body->aux_data_hash);
+
+  return transaction_body->aux_data_hash;
+}
+
+cardano_error_t
+cardano_transaction_body_set_aux_data_hash(cardano_transaction_body_t* transaction_body, cardano_blake2b_hash_t* aux_data_hash)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (aux_data_hash == NULL)
+  {
+    cardano_blake2b_hash_unref(&transaction_body->aux_data_hash);
+    transaction_body->aux_data_hash = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_blake2b_hash_ref(aux_data_hash);
+  cardano_blake2b_hash_unref(&transaction_body->aux_data_hash);
+  transaction_body->aux_data_hash = aux_data_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+const uint64_t*
+cardano_transaction_body_get_invalid_before(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  return transaction_body->invalid_before;
+}
+
+cardano_error_t
+cardano_transaction_body_set_invalid_before(cardano_transaction_body_t* transaction_body, const uint64_t* epoch)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (epoch == NULL)
+  {
+    _cardano_free(transaction_body->invalid_before);
+    transaction_body->invalid_before = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (transaction_body->invalid_before == NULL)
+  {
+    transaction_body->invalid_before = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if (transaction_body->invalid_before == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *transaction_body->invalid_before = *epoch;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_multi_asset_t*
+cardano_transaction_body_get_mint(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_multi_asset_ref(transaction_body->mint);
+
+  return transaction_body->mint;
+}
+
+cardano_error_t
+cardano_transaction_body_set_mint(cardano_transaction_body_t* transaction_body, cardano_multi_asset_t* mint)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (mint == NULL)
+  {
+    cardano_multi_asset_unref(&transaction_body->mint);
+    transaction_body->mint = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_multi_asset_ref(mint);
+  cardano_multi_asset_unref(&transaction_body->mint);
+  transaction_body->mint = mint;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_transaction_body_get_script_data_hash(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(transaction_body->script_data_hash);
+
+  return transaction_body->script_data_hash;
+}
+
+cardano_error_t
+cardano_transaction_body_set_script_data_hash(cardano_transaction_body_t* transaction_body, cardano_blake2b_hash_t* script_data_hash)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_data_hash == NULL)
+  {
+    cardano_blake2b_hash_unref(&transaction_body->script_data_hash);
+    transaction_body->script_data_hash = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_blake2b_hash_ref(script_data_hash);
+  cardano_blake2b_hash_unref(&transaction_body->script_data_hash);
+  transaction_body->script_data_hash = script_data_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_transaction_input_set_t*
+cardano_transaction_body_get_collateral(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_input_set_ref(transaction_body->collateral);
+
+  return transaction_body->collateral;
+}
+
+cardano_error_t
+cardano_transaction_body_set_collateral(cardano_transaction_body_t* transaction_body, cardano_transaction_input_set_t* collateral)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (collateral == NULL)
+  {
+    cardano_transaction_input_set_unref(&transaction_body->collateral);
+    transaction_body->collateral = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_transaction_input_set_ref(collateral);
+  cardano_transaction_input_set_unref(&transaction_body->collateral);
+  transaction_body->collateral = collateral;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_set_t*
+cardano_transaction_body_get_required_signers(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  if (transaction_body->guards == NULL)
+  {
+    return NULL;
+  }
+
+  return get_key_hash_guards(transaction_body->guards);
+}
+
+cardano_error_t
+cardano_transaction_body_set_required_signers(
+  cardano_transaction_body_t* transaction_body,
+  cardano_blake2b_hash_set_t* required_signers)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (required_signers == NULL)
+  {
+    cardano_guard_set_unref(&transaction_body->guards);
+    transaction_body->guards = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_guard_set_t* guards = NULL;
+  cardano_error_t      result = cardano_guard_set_new(&guards);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0U; i < cardano_blake2b_hash_set_get_length(required_signers); ++i)
+  {
+    cardano_blake2b_hash_t* hash = NULL;
+
+    result = cardano_blake2b_hash_set_get(required_signers, i, &hash);
+
+    cardano_blake2b_hash_unref(&hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_guard_set_unref(&guards);
+      return result;
+    }
+
+    cardano_credential_t* credential = NULL;
+
+    result = cardano_credential_new(hash, CARDANO_CREDENTIAL_TYPE_KEY_HASH, &credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_guard_set_unref(&guards);
+      return result;
+    }
+
+    result = cardano_guard_set_add(guards, credential);
+
+    cardano_credential_unref(&credential);
+
+    if ((result != CARDANO_SUCCESS) && (result != CARDANO_ERROR_DUPLICATED_KEY))
+    {
+      cardano_guard_set_unref(&guards);
+      return result;
+    }
+  }
+
+  cardano_guard_set_unref(&transaction_body->guards);
+  transaction_body->guards = guards;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_guard_set_t*
+cardano_transaction_body_get_guards(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_guard_set_ref(transaction_body->guards);
+
+  return transaction_body->guards;
+}
+
+cardano_error_t
+cardano_transaction_body_set_guards(cardano_transaction_body_t* transaction_body, cardano_guard_set_t* guards)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (guards == NULL)
+  {
+    cardano_guard_set_unref(&transaction_body->guards);
+    transaction_body->guards = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_guard_set_ref(guards);
+  cardano_guard_set_unref(&transaction_body->guards);
+  transaction_body->guards = guards;
+
+  return CARDANO_SUCCESS;
+}
+
+const cardano_network_id_t*
+cardano_transaction_body_get_network_id(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  return transaction_body->network_id;
+}
+
+cardano_error_t
+cardano_transaction_body_set_network_id(cardano_transaction_body_t* transaction_body, const cardano_network_id_t* network_id)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (network_id == NULL)
+  {
+    _cardano_free(transaction_body->network_id);
+    transaction_body->network_id = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (transaction_body->network_id == NULL)
+  {
+    transaction_body->network_id = (cardano_network_id_t*)_cardano_malloc(sizeof(cardano_network_id_t));
+
+    if (transaction_body->network_id == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *transaction_body->network_id = *network_id;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_transaction_output_t*
+cardano_transaction_body_get_collateral_return(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_output_ref(transaction_body->collateral_return);
+
+  return transaction_body->collateral_return;
+}
+
+cardano_error_t
+cardano_transaction_body_set_collateral_return(cardano_transaction_body_t* transaction_body, cardano_transaction_output_t* output)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (output == NULL)
+  {
+    cardano_transaction_output_unref(&transaction_body->collateral_return);
+    transaction_body->collateral_return = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_transaction_output_ref(output);
+  cardano_transaction_output_unref(&transaction_body->collateral_return);
+  transaction_body->collateral_return = output;
+
+  return CARDANO_SUCCESS;
+}
+
+const uint64_t*
+cardano_transaction_body_get_total_collateral(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  return transaction_body->total_collateral;
+}
+
+cardano_error_t
+cardano_transaction_body_set_total_collateral(cardano_transaction_body_t* transaction_body, const uint64_t* total_collateral)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (total_collateral == NULL)
+  {
+    _cardano_free(transaction_body->total_collateral);
+    transaction_body->total_collateral = NULL;
+    return CARDANO_SUCCESS;
+  }
+
+  if (transaction_body->total_collateral == NULL)
+  {
+    transaction_body->total_collateral = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if (transaction_body->total_collateral == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *transaction_body->total_collateral = *total_collateral;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_transaction_input_set_t*
+cardano_transaction_body_get_reference_inputs(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_transaction_input_set_ref(transaction_body->reference_inputs);
+
+  return transaction_body->reference_inputs;
+}
+
+cardano_error_t
+cardano_transaction_body_set_reference_inputs(
+  cardano_transaction_body_t*      transaction_body,
+  cardano_transaction_input_set_t* reference_inputs)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reference_inputs == NULL)
+  {
+    cardano_transaction_input_set_unref(&transaction_body->reference_inputs);
+    transaction_body->reference_inputs = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_transaction_input_set_ref(reference_inputs);
+  cardano_transaction_input_set_unref(&transaction_body->reference_inputs);
+  transaction_body->reference_inputs = reference_inputs;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_voting_procedures_t*
+cardano_transaction_body_get_voting_procedures(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_voting_procedures_ref(transaction_body->voting_procedures);
+
+  return transaction_body->voting_procedures;
+}
+
+cardano_error_t
+cardano_transaction_body_set_voting_procedures(
+  cardano_transaction_body_t*  transaction_body,
+  cardano_voting_procedures_t* voting_procedures)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (voting_procedures == NULL)
+  {
+    cardano_voting_procedures_unref(&transaction_body->voting_procedures);
+    transaction_body->voting_procedures = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_voting_procedures_ref(voting_procedures);
+  cardano_voting_procedures_unref(&transaction_body->voting_procedures);
+  transaction_body->voting_procedures = voting_procedures;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_proposal_procedure_set_t*
+cardano_transaction_body_get_proposal_procedures(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_proposal_procedure_set_ref(transaction_body->proposal_procedures);
+
+  return transaction_body->proposal_procedures;
+}
+
+cardano_error_t
+cardano_transaction_body_set_proposal_procedure(
+  cardano_transaction_body_t*       transaction_body,
+  cardano_proposal_procedure_set_t* proposal_procedures)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (proposal_procedures == NULL)
+  {
+    cardano_proposal_procedure_set_unref(&transaction_body->proposal_procedures);
+    transaction_body->proposal_procedures = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_proposal_procedure_set_ref(proposal_procedures);
+  cardano_proposal_procedure_set_unref(&transaction_body->proposal_procedures);
+  transaction_body->proposal_procedures = proposal_procedures;
+
+  return CARDANO_SUCCESS;
+}
+
+const uint64_t*
+cardano_transaction_body_get_treasury_value(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  return transaction_body->treasury_value;
+}
+
+cardano_error_t
+cardano_transaction_body_set_treasury_value(cardano_transaction_body_t* transaction_body, const uint64_t* treasury_value)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (treasury_value == NULL)
+  {
+    _cardano_free(transaction_body->treasury_value);
+    transaction_body->treasury_value = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (transaction_body->treasury_value == NULL)
+  {
+    transaction_body->treasury_value = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if (transaction_body->treasury_value == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *transaction_body->treasury_value = *treasury_value;
+
+  return CARDANO_SUCCESS;
+}
+
+const uint64_t*
+cardano_transaction_body_get_donation(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  return transaction_body->donation;
+}
+
+cardano_error_t
+cardano_transaction_body_set_donation(cardano_transaction_body_t* transaction_body, const uint64_t* donation)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (donation == NULL)
+  {
+    _cardano_free(transaction_body->donation);
+    transaction_body->donation = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (transaction_body->donation == NULL)
+  {
+    transaction_body->donation = (uint64_t*)_cardano_malloc(sizeof(uint64_t));
+
+    if (transaction_body->donation == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *transaction_body->donation = *donation;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_sub_transaction_set_t*
+cardano_transaction_body_get_sub_transactions(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_sub_transaction_set_ref(transaction_body->sub_transactions);
+
+  return transaction_body->sub_transactions;
+}
+
+cardano_error_t
+cardano_transaction_body_set_sub_transactions(
+  cardano_transaction_body_t*    transaction_body,
+  cardano_sub_transaction_set_t* sub_transactions)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (sub_transactions == NULL)
+  {
+    cardano_sub_transaction_set_unref(&transaction_body->sub_transactions);
+    transaction_body->sub_transactions = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_sub_transaction_set_ref(sub_transactions);
+  cardano_sub_transaction_set_unref(&transaction_body->sub_transactions);
+  transaction_body->sub_transactions = sub_transactions;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_required_guards_map_t*
+cardano_transaction_body_get_required_top_level_guards(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_required_guards_map_ref(transaction_body->required_top_level_guards);
+
+  return transaction_body->required_top_level_guards;
+}
+
+cardano_error_t
+cardano_transaction_body_set_required_top_level_guards(
+  cardano_transaction_body_t*    transaction_body,
+  cardano_required_guards_map_t* required_top_level_guards)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (required_top_level_guards == NULL)
+  {
+    cardano_required_guards_map_unref(&transaction_body->required_top_level_guards);
+    transaction_body->required_top_level_guards = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_required_guards_map_ref(required_top_level_guards);
+  cardano_required_guards_map_unref(&transaction_body->required_top_level_guards);
+  transaction_body->required_top_level_guards = required_top_level_guards;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_direct_deposit_map_t*
+cardano_transaction_body_get_direct_deposits(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_direct_deposit_map_ref(transaction_body->direct_deposits);
+
+  return transaction_body->direct_deposits;
+}
+
+cardano_error_t
+cardano_transaction_body_set_direct_deposits(
+  cardano_transaction_body_t*   transaction_body,
+  cardano_direct_deposit_map_t* direct_deposits)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (direct_deposits == NULL)
+  {
+    cardano_direct_deposit_map_unref(&transaction_body->direct_deposits);
+    transaction_body->direct_deposits = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_direct_deposit_map_ref(direct_deposits);
+  cardano_direct_deposit_map_unref(&transaction_body->direct_deposits);
+  transaction_body->direct_deposits = direct_deposits;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_account_balance_intervals_map_t*
+cardano_transaction_body_get_account_balance_intervals(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_account_balance_intervals_map_ref(transaction_body->account_balance_intervals);
+
+  return transaction_body->account_balance_intervals;
+}
+
+cardano_error_t
+cardano_transaction_body_set_account_balance_intervals(
+  cardano_transaction_body_t*              transaction_body,
+  cardano_account_balance_intervals_map_t* account_balance_intervals)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (account_balance_intervals == NULL)
+  {
+    cardano_account_balance_intervals_map_unref(&transaction_body->account_balance_intervals);
+    transaction_body->account_balance_intervals = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_account_balance_intervals_map_ref(account_balance_intervals);
+  cardano_account_balance_intervals_map_unref(&transaction_body->account_balance_intervals);
+  transaction_body->account_balance_intervals = account_balance_intervals;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_account_balance_intervals_map_t*
+cardano_transaction_body_get_starting_account_balance_intervals(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_account_balance_intervals_map_ref(transaction_body->starting_account_balance_intervals);
+
+  return transaction_body->starting_account_balance_intervals;
+}
+
+cardano_error_t
+cardano_transaction_body_set_starting_account_balance_intervals(
+  cardano_transaction_body_t*              transaction_body,
+  cardano_account_balance_intervals_map_t* starting_account_balance_intervals)
+{
+  if (transaction_body == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (starting_account_balance_intervals == NULL)
+  {
+    cardano_account_balance_intervals_map_unref(&transaction_body->starting_account_balance_intervals);
+    transaction_body->starting_account_balance_intervals = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_account_balance_intervals_map_ref(starting_account_balance_intervals);
+  cardano_account_balance_intervals_map_unref(&transaction_body->starting_account_balance_intervals);
+  transaction_body->starting_account_balance_intervals = starting_account_balance_intervals;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_transaction_body_get_hash(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_error_t result = cardano_transaction_body_to_cbor(transaction_body, writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return NULL;
+  }
+
+  const size_t cbor_size = cardano_cbor_writer_get_encode_size(writer);
+  byte_t*      cbor_data = (byte_t*)_cardano_malloc(cbor_size);
+
+  if (cbor_data == NULL)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return NULL;
+  }
+
+  result = cardano_cbor_writer_encode(writer, cbor_data, cbor_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(cbor_data);
+    cardano_cbor_writer_unref(&writer);
+
+    return NULL;
+  }
+
+  cardano_cbor_writer_unref(&writer);
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  result = cardano_blake2b_compute_hash(cbor_data, cbor_size, CARDANO_BLAKE2B_HASH_SIZE_256, &hash);
+
+  _cardano_free(cbor_data);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return hash;
+}
+
+bool
+cardano_transaction_body_has_tagged_sets(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return false;
+  }
+
+  if (transaction_body->cbor_cache == NULL)
+  {
+    return true;
+  }
+
+  return cardano_transaction_input_set_is_tagged(transaction_body->inputs);
+}
+
+void
+cardano_transaction_body_clear_cbor_cache(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&transaction_body->cbor_cache);
+  transaction_body->cbor_cache = NULL;
+}
+
+void
+cardano_transaction_body_unref(cardano_transaction_body_t** transaction_body)
+{
+  if ((transaction_body == NULL) || (*transaction_body == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*transaction_body)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *transaction_body = NULL;
+    return;
+  }
+}
+
+void
+cardano_transaction_body_ref(cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&transaction_body->base);
+}
+
+size_t
+cardano_transaction_body_refcount(const cardano_transaction_body_t* transaction_body)
+{
+  if (transaction_body == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&transaction_body->base);
+}
+
+void
+cardano_transaction_body_set_last_error(cardano_transaction_body_t* transaction_body, const char* message)
+{
+  cardano_object_set_last_error(&transaction_body->base, message);
+}
+
+const char*
+cardano_transaction_body_get_last_error(const cardano_transaction_body_t* transaction_body)
+{
+  return cardano_object_get_last_error(&transaction_body->base);
+}
+
+cardano_error_t
+cardano_transaction_body_deep_clone(const cardano_transaction_body_t* source, cardano_transaction_body_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* copy = _cardano_malloc(sizeof(cardano_transaction_body_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count                     = 1U;
+  copy->base.deallocator                   = source->base.deallocator;
+  copy->base.last_error[0]                 = '\0';
+  copy->inputs                             = NULL;
+  copy->outputs                            = NULL;
+  copy->fee                                = NULL;
+  copy->invalid_after                      = NULL;
+  copy->certificates                       = NULL;
+  copy->withdrawals                        = NULL;
+  copy->update                             = NULL;
+  copy->aux_data_hash                      = NULL;
+  copy->invalid_before                     = NULL;
+  copy->mint                               = NULL;
+  copy->script_data_hash                   = NULL;
+  copy->collateral                         = NULL;
+  copy->guards                             = NULL;
+  copy->network_id                         = NULL;
+  copy->collateral_return                  = NULL;
+  copy->total_collateral                   = NULL;
+  copy->reference_inputs                   = NULL;
+  copy->voting_procedures                  = NULL;
+  copy->proposal_procedures                = NULL;
+  copy->treasury_value                     = NULL;
+  copy->donation                           = NULL;
+  copy->sub_transactions                   = NULL;
+  copy->required_top_level_guards          = NULL;
+  copy->direct_deposits                    = NULL;
+  copy->account_balance_intervals          = NULL;
+  copy->starting_account_balance_intervals = NULL;
+  copy->cbor_cache                         = NULL;
+
+  if (source->inputs != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_input_set_deep_clone(source->inputs, &copy->inputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->outputs != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_output_list_deep_clone(source->outputs, &copy->outputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->fee != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->fee = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->fee == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->fee, source->fee, size));
+  }
+
+  if (source->invalid_after != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->invalid_after = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->invalid_after == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->invalid_after, source->invalid_after, size));
+  }
+
+  if (source->certificates != NULL)
+  {
+    const cardano_error_t result = cardano_certificate_set_deep_clone(source->certificates, &copy->certificates);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->withdrawals != NULL)
+  {
+    const cardano_error_t result = cardano_withdrawal_map_deep_clone(source->withdrawals, &copy->withdrawals);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->update != NULL)
+  {
+    const cardano_error_t result = cardano_update_deep_clone(source->update, &copy->update);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->aux_data_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->aux_data_hash, &copy->aux_data_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->invalid_before != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->invalid_before = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->invalid_before == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->invalid_before, source->invalid_before, size));
+  }
+
+  if (source->mint != NULL)
+  {
+    const cardano_error_t result = cardano_multi_asset_deep_clone(source->mint, &copy->mint);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->script_data_hash != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->script_data_hash, &copy->script_data_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->collateral != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_input_set_deep_clone(source->collateral, &copy->collateral);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->guards != NULL)
+  {
+    const cardano_error_t result = cardano_guard_set_deep_clone(source->guards, &copy->guards);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->network_id != NULL)
+  {
+    const size_t size = sizeof(cardano_network_id_t);
+
+    copy->network_id = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->network_id == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->network_id, source->network_id, size));
+  }
+
+  if (source->collateral_return != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_output_deep_clone(source->collateral_return, &copy->collateral_return);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->total_collateral != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->total_collateral = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->total_collateral == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->total_collateral, source->total_collateral, size));
+  }
+
+  if (source->reference_inputs != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_input_set_deep_clone(source->reference_inputs, &copy->reference_inputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->voting_procedures != NULL)
+  {
+    const cardano_error_t result = cardano_voting_procedures_deep_clone(source->voting_procedures, &copy->voting_procedures);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->proposal_procedures != NULL)
+  {
+    const cardano_error_t result = cardano_proposal_procedure_set_deep_clone(source->proposal_procedures, &copy->proposal_procedures);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->treasury_value != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->treasury_value = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->treasury_value == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->treasury_value, source->treasury_value, size));
+  }
+
+  if (source->donation != NULL)
+  {
+    const size_t size = sizeof(uint64_t);
+
+    copy->donation = _cardano_malloc((size > 0U) ? size : 1U);
+
+    if (copy->donation == NULL)
+    {
+      copy->base.deallocator(copy);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    CARDANO_UNUSED(memcpy(copy->donation, source->donation, size));
+  }
+
+  if (source->sub_transactions != NULL)
+  {
+    const cardano_error_t result = cardano_sub_transaction_set_deep_clone(source->sub_transactions, &copy->sub_transactions);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->required_top_level_guards != NULL)
+  {
+    const cardano_error_t result = cardano_required_guards_map_deep_clone(source->required_top_level_guards, &copy->required_top_level_guards);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->direct_deposits != NULL)
+  {
+    const cardano_error_t result = cardano_direct_deposit_map_deep_clone(source->direct_deposits, &copy->direct_deposits);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->account_balance_intervals != NULL)
+  {
+    const cardano_error_t result = cardano_account_balance_intervals_map_deep_clone(source->account_balance_intervals, &copy->account_balance_intervals);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->starting_account_balance_intervals != NULL)
+  {
+    const cardano_error_t result = cardano_account_balance_intervals_map_deep_clone(source->starting_account_balance_intervals, &copy->starting_account_balance_intervals);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/transaction_input.c b/vendor/src/transaction_body/transaction_input.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/transaction_input.c
@@ -0,0 +1,502 @@
+/**
+ * \file transaction_input.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/json/json_writer.h>
+#include <cardano/object.h>
+#include <cardano/transaction_body/transaction_input.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t TRANSACTION_INPUT_ARRAY_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a reference to an unspent transaction output (UTxO) from a previous
+ * transaction, which the current transaction intends to spend.
+ */
+typedef struct cardano_transaction_input_t
+{
+    cardano_object_t        base;
+    cardano_blake2b_hash_t* id;
+    uint64_t                index;
+} cardano_transaction_input_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a transaction_input object.
+ *
+ * This function is responsible for properly deallocating a transaction_input object (`cardano_transaction_input_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the transaction_input object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_transaction_input_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the transaction_input
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_transaction_input_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_transaction_input_t* transaction_input = (cardano_transaction_input_t*)object;
+  cardano_blake2b_hash_unref(&transaction_input->id);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_transaction_input_new(
+  cardano_blake2b_hash_t*       id,
+  uint64_t                      index,
+  cardano_transaction_input_t** transaction_input)
+{
+  if (transaction_input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cardano_blake2b_hash_get_bytes_size(id) != (size_t)CARDANO_BLAKE2B_HASH_SIZE_256)
+  {
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_transaction_input_t* new_transaction_input = (cardano_transaction_input_t*)_cardano_malloc(sizeof(cardano_transaction_input_t));
+
+  if (new_transaction_input == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  new_transaction_input->base.ref_count     = 1;
+  new_transaction_input->base.last_error[0] = '\0';
+  new_transaction_input->base.deallocator   = cardano_transaction_input_deallocate;
+
+  cardano_blake2b_hash_ref(id);
+  new_transaction_input->id    = id;
+  new_transaction_input->index = index;
+
+  *transaction_input = new_transaction_input;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_input_from_hex(
+  const char*                   id_hex,
+  size_t                        id_hex_size,
+  uint64_t                      index,
+  cardano_transaction_input_t** transaction_input)
+{
+  if (transaction_input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (id_hex == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((id_hex_size / 2U) != (size_t)CARDANO_BLAKE2B_HASH_SIZE_256)
+  {
+    return CARDANO_ERROR_INVALID_BLAKE2B_HASH_SIZE;
+  }
+
+  cardano_blake2b_hash_t* id        = NULL;
+  cardano_error_t         id_result = cardano_blake2b_hash_from_hex(id_hex, id_hex_size, &id);
+
+  if (id_result != CARDANO_SUCCESS)
+  {
+    *transaction_input = NULL;
+
+    return id_result;
+  }
+
+  const cardano_error_t new_transaction_input_result = cardano_transaction_input_new(id, index, transaction_input);
+
+  cardano_blake2b_hash_unref(&id);
+
+  if (new_transaction_input_result != CARDANO_SUCCESS)
+  {
+    *transaction_input = NULL;
+
+    return new_transaction_input_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_input_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_input_t** transaction_input)
+{
+  if (transaction_input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *transaction_input = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "transaction_input";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)TRANSACTION_INPUT_ARRAY_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *transaction_input = NULL;
+    return expect_array_result;
+  }
+
+  cardano_blake2b_hash_t* id = NULL;
+
+  const cardano_error_t read_id_error = cardano_blake2b_hash_from_cbor(reader, &id);
+
+  if (read_id_error != CARDANO_SUCCESS)
+  {
+    *transaction_input = NULL;
+
+    return read_id_error;
+  }
+
+  uint64_t index = 0;
+
+  const cardano_error_t read_index_result = cardano_cbor_reader_read_uint(reader, &index);
+
+  if (read_index_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&id);
+    *transaction_input = NULL;
+
+    return read_index_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&id);
+    *transaction_input = NULL;
+
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t new_transaction_input_result = cardano_transaction_input_new(
+    id,
+    index,
+    transaction_input);
+
+  cardano_blake2b_hash_unref(&id);
+
+  if (new_transaction_input_result != CARDANO_SUCCESS)
+  {
+    *transaction_input = NULL;
+    return new_transaction_input_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_input_to_cbor(
+  const cardano_transaction_input_t* transaction_input,
+  cardano_cbor_writer_t*             writer)
+{
+  if (transaction_input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(writer, TRANSACTION_INPUT_ARRAY_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_id_result = cardano_blake2b_hash_to_cbor(transaction_input->id, writer);
+
+  if (write_id_result != CARDANO_SUCCESS)
+  {
+    return write_id_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, transaction_input->index);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_input_to_cip116_json(const cardano_transaction_input_t* input, cardano_json_writer_t* json)
+{
+  if ((input == NULL) || (json == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  char                  hex[128]      = { 0 };
+  const cardano_error_t to_hex_result = cardano_blake2b_hash_to_hex(input->id, hex, 128);
+
+  assert(to_hex_result == CARDANO_SUCCESS);
+  CARDANO_UNUSED(to_hex_result);
+
+  cardano_json_writer_write_start_object(json);
+  cardano_json_writer_write_property_name(json, "transaction_id", 14);
+  cardano_json_writer_write_string(json, hex, cardano_safe_strlen(hex, 128));
+  cardano_json_writer_write_property_name(json, "index", 5);
+  cardano_json_writer_write_uint(json, input->index);
+  cardano_json_writer_write_end_object(json);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+cardano_transaction_input_get_id(cardano_transaction_input_t* input)
+{
+  if (input == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_blake2b_hash_ref(input->id);
+
+  return input->id;
+}
+
+cardano_error_t
+cardano_transaction_input_set_id(cardano_transaction_input_t* input, cardano_blake2b_hash_t* id)
+{
+  if (input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_unref(&input->id);
+  cardano_blake2b_hash_ref(id);
+
+  input->id = id;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_transaction_input_get_index(const cardano_transaction_input_t* transaction_input)
+{
+  if (transaction_input == NULL)
+  {
+    return 0;
+  }
+
+  return transaction_input->index;
+}
+
+cardano_error_t
+cardano_transaction_input_set_index(cardano_transaction_input_t* transaction_input, uint64_t index)
+{
+  if (transaction_input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  transaction_input->index = index;
+
+  return CARDANO_SUCCESS;
+}
+
+int32_t
+cardano_transaction_input_compare(
+  const cardano_transaction_input_t* lhs,
+  const cardano_transaction_input_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return 0;
+  }
+
+  if (lhs == NULL)
+  {
+    return -1;
+  }
+
+  if (rhs == NULL)
+  {
+    return 1;
+  }
+
+  const int32_t id_comparison = cardano_blake2b_hash_compare(lhs->id, rhs->id);
+
+  if (id_comparison != 0)
+  {
+    return id_comparison;
+  }
+
+  if (lhs->index < rhs->index)
+  {
+    return -1;
+  }
+
+  if (lhs->index > rhs->index)
+  {
+    return 1;
+  }
+
+  return 0;
+}
+
+bool
+cardano_transaction_input_equals(const cardano_transaction_input_t* lhs, const cardano_transaction_input_t* rhs)
+{
+  return cardano_transaction_input_compare(lhs, rhs) == 0;
+}
+
+void
+cardano_transaction_input_unref(cardano_transaction_input_t** transaction_input)
+{
+  if ((transaction_input == NULL) || (*transaction_input == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*transaction_input)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *transaction_input = NULL;
+    return;
+  }
+}
+
+void
+cardano_transaction_input_ref(cardano_transaction_input_t* transaction_input)
+{
+  if (transaction_input == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&transaction_input->base);
+}
+
+size_t
+cardano_transaction_input_refcount(const cardano_transaction_input_t* transaction_input)
+{
+  if (transaction_input == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&transaction_input->base);
+}
+
+void
+cardano_transaction_input_set_last_error(cardano_transaction_input_t* transaction_input, const char* message)
+{
+  cardano_object_set_last_error(&transaction_input->base, message);
+}
+
+const char*
+cardano_transaction_input_get_last_error(const cardano_transaction_input_t* transaction_input)
+{
+  return cardano_object_get_last_error(&transaction_input->base);
+}
+
+cardano_error_t
+cardano_transaction_input_deep_clone(const cardano_transaction_input_t* source, cardano_transaction_input_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_input_t* copy = _cardano_malloc(sizeof(cardano_transaction_input_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->id                 = NULL;
+  copy->index              = source->index;
+
+  if (source->id != NULL)
+  {
+    const cardano_error_t result = cardano_blake2b_hash_deep_clone(source->id, &copy->id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/transaction_input_set.c b/vendor/src/transaction_body/transaction_input_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/transaction_input_set.c
@@ -0,0 +1,520 @@
+/**
+ * \file transaction_input_set.c
+ *
+ * \author angel.castillo
+ * \date   Sept 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano transaction input set list.
+ */
+typedef struct cardano_transaction_input_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             use_tags;
+} cardano_transaction_input_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a transaction input set list object.
+ *
+ * This function is responsible for properly deallocating a transaction_input_set list object (`cardano_transaction_input_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the transaction_input_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_transaction_input_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the transaction_input_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_transaction_input_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_transaction_input_set_t* list = (cardano_transaction_input_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their transaction_input.
+ *
+ * This function casts the cardano_object_t objects to cardano_transaction_input_t
+ * and compares their ids using the cardano_blake2b_hash_compare function.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the id of lhs is less than the id of rhs, zero if they are equal,
+ *         and a positive value if the id of lhs is greater than the id of rhs.
+ */
+static int32_t
+compare_by_input(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_transaction_input_t* lhs_input = (const cardano_transaction_input_t*)((const void*)lhs);
+  const cardano_transaction_input_t* rhs_input = (const cardano_transaction_input_t*)((const void*)rhs);
+
+  return cardano_transaction_input_compare(lhs_input, rhs_input);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_transaction_input_set_new(cardano_transaction_input_set_t** transaction_input_set)
+{
+  if (transaction_input_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_input_set_t* list = _cardano_malloc(sizeof(cardano_transaction_input_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_transaction_input_set_deallocate;
+
+  list->array    = cardano_array_new(128);
+  list->use_tags = true;
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *transaction_input_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_input_set_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_input_set_t** transaction_input_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (transaction_input_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_input_set_t* list   = NULL;
+  cardano_error_t                  result = cardano_transaction_input_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_transaction_input_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  list->use_tags = state == CARDANO_CBOR_READER_STATE_TAG;
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("transaction_input_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_input_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_input_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_input_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_transaction_input_t* element = NULL;
+
+    result = cardano_transaction_input_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_input_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_transaction_input_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_transaction_input_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("transaction_input_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_input_set_unref(&list);
+    return result;
+  }
+
+  cardano_array_sort(list->array, compare_by_input, NULL);
+
+  *transaction_input_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_input_set_to_cbor(const cardano_transaction_input_set_t* transaction_input_set, cardano_cbor_writer_t* writer)
+{
+  if (transaction_input_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(transaction_input_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  size_t array_size = cardano_array_get_size(transaction_input_set->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(transaction_input_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(transaction_input_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in transaction_input_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_transaction_input_to_cbor((cardano_transaction_input_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_transaction_input_set_to_cip116_json(
+  const cardano_transaction_input_set_t* set,
+  cardano_json_writer_t*                 writer)
+{
+  if ((set == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t          length = cardano_transaction_input_set_get_length(set);
+  cardano_error_t error  = CARDANO_SUCCESS;
+
+  for (size_t i = 0; i < length; ++i)
+  {
+    cardano_transaction_input_t* input = NULL;
+    error                              = cardano_transaction_input_set_get(set, i, &input);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_transaction_input_to_cip116_json(input, writer);
+    cardano_transaction_input_unref(&input);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return error;
+}
+
+size_t
+cardano_transaction_input_set_get_length(const cardano_transaction_input_set_t* transaction_input_set)
+{
+  if (transaction_input_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(transaction_input_set->array);
+}
+
+cardano_error_t
+cardano_transaction_input_set_get(
+  const cardano_transaction_input_set_t* transaction_input_set,
+  size_t                                 index,
+  cardano_transaction_input_t**          element)
+{
+  if (transaction_input_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(transaction_input_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_transaction_input_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_input_set_add(cardano_transaction_input_set_t* transaction_input_set, cardano_transaction_input_t* element)
+{
+  if (transaction_input_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(transaction_input_set->array);
+  const size_t new_size      = cardano_array_push(transaction_input_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(transaction_input_set->array, compare_by_input, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_transaction_input_set_is_tagged(cardano_transaction_input_set_t* transaction_input_set)
+{
+  if (transaction_input_set == NULL)
+  {
+    return false;
+  }
+
+  return transaction_input_set->use_tags;
+}
+
+void
+cardano_transaction_input_set_unref(cardano_transaction_input_set_t** transaction_input_set)
+{
+  if ((transaction_input_set == NULL) || (*transaction_input_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*transaction_input_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *transaction_input_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_transaction_input_set_ref(cardano_transaction_input_set_t* transaction_input_set)
+{
+  if (transaction_input_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&transaction_input_set->base);
+}
+
+size_t
+cardano_transaction_input_set_refcount(const cardano_transaction_input_set_t* transaction_input_set)
+{
+  if (transaction_input_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&transaction_input_set->base);
+}
+
+void
+cardano_transaction_input_set_set_last_error(cardano_transaction_input_set_t* transaction_input_set, const char* message)
+{
+  cardano_object_set_last_error(&transaction_input_set->base, message);
+}
+
+const char*
+cardano_transaction_input_set_get_last_error(const cardano_transaction_input_set_t* transaction_input_set)
+{
+  return cardano_object_get_last_error(&transaction_input_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_transaction_input_t* copy   = NULL;
+  const cardano_error_t        result = cardano_transaction_input_deep_clone((const cardano_transaction_input_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_transaction_input_set_deep_clone(const cardano_transaction_input_set_t* source, cardano_transaction_input_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_input_set_t* copy = _cardano_malloc(sizeof(cardano_transaction_input_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+  copy->use_tags           = source->use_tags;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/transaction_output.c b/vendor/src/transaction_body/transaction_output.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/transaction_output.c
@@ -0,0 +1,1018 @@
+/**
+ * \file transaction_output.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+#include <cardano/transaction_body/transaction_output.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief A transaction output object includes the address which represents a public key
+ * hash or a script hash that can unlock the output, and the funds that are held
+ * inside.
+ */
+typedef struct cardano_transaction_output_t
+{
+    cardano_object_t   base;
+    cardano_address_t* address;
+    cardano_value_t*   value;
+    cardano_datum_t*   datum;
+    cardano_script_t*  script_ref;
+} cardano_transaction_output_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a transaction_output object.
+ *
+ * This function is responsible for properly deallocating a transaction_output object (`cardano_transaction_output_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the transaction_output object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_transaction_output_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the transaction_output
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_transaction_output_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_transaction_output_t* transaction_output = (cardano_transaction_output_t*)object;
+
+  cardano_address_unref(&transaction_output->address);
+  cardano_value_unref(&transaction_output->value);
+  cardano_datum_unref(&transaction_output->datum);
+  cardano_script_unref(&transaction_output->script_ref);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_transaction_output_new(
+  cardano_address_t*             address,
+  const uint64_t                 amount,
+  cardano_transaction_output_t** transaction_output)
+{
+  if (transaction_output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_t* new_transaction_output = (cardano_transaction_output_t*)_cardano_malloc(sizeof(cardano_transaction_output_t));
+
+  if (new_transaction_output == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t new_val_result = cardano_value_new((int64_t)amount, NULL, &new_transaction_output->value);
+
+  if (new_val_result != CARDANO_SUCCESS)
+  {
+    _cardano_free(new_transaction_output);
+    *transaction_output = NULL;
+
+    return new_val_result;
+  }
+
+  new_transaction_output->base.ref_count     = 1;
+  new_transaction_output->base.last_error[0] = '\0';
+  new_transaction_output->base.deallocator   = cardano_transaction_output_deallocate;
+  new_transaction_output->address            = NULL;
+  new_transaction_output->datum              = NULL;
+  new_transaction_output->script_ref         = NULL;
+
+  cardano_address_ref(address);
+  new_transaction_output->address = address;
+
+  *transaction_output = new_transaction_output;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_output_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_output_t** transaction_output)
+{
+  if (transaction_output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *transaction_output = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "transaction_output";
+
+  cardano_address_t* address    = NULL;
+  cardano_value_t*   value      = NULL;
+  cardano_datum_t*   datum      = NULL;
+  cardano_script_t*  script_ref = NULL;
+
+  cardano_cbor_reader_state_t state;
+
+  cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    *transaction_output = NULL;
+    return peek_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_START_MAP)
+  {
+    int64_t map_size = 0U;
+
+    const cardano_error_t read_map_result = cardano_cbor_reader_read_start_map(reader, &map_size);
+
+    CARDANO_UNUSED(read_map_result);
+
+    if (read_map_result != CARDANO_SUCCESS)
+    {
+      *transaction_output = NULL;
+      return read_map_result;
+    }
+
+    while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+      if (peek_result != CARDANO_SUCCESS)
+      {
+        cardano_address_unref(&address);
+        cardano_value_unref(&value);
+        cardano_datum_unref(&datum);
+        cardano_script_unref(&script_ref);
+
+        *transaction_output = NULL;
+
+        return peek_result;
+      }
+
+      if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+      {
+        break;
+      }
+
+      uint64_t key = 0U;
+
+      const cardano_error_t read_key_result = cardano_cbor_reader_read_uint(reader, &key);
+
+      if (read_key_result != CARDANO_SUCCESS)
+      {
+        cardano_address_unref(&address);
+        cardano_value_unref(&value);
+        cardano_datum_unref(&datum);
+        cardano_script_unref(&script_ref);
+
+        *transaction_output = NULL;
+        return read_key_result;
+      }
+
+      switch (key)
+      {
+        case 0U:
+        {
+          cardano_address_unref(&address);
+          cardano_buffer_t* address_bytes = NULL;
+
+          const cardano_error_t read_address_result = cardano_cbor_reader_read_bytestring(reader, &address_bytes);
+
+          if (read_address_result != CARDANO_SUCCESS)
+          {
+            cardano_address_unref(&address);
+            cardano_value_unref(&value);
+            cardano_datum_unref(&datum);
+            cardano_script_unref(&script_ref);
+
+            *transaction_output = NULL;
+
+            return read_address_result;
+          }
+
+          const cardano_error_t address_from_bytes_result = cardano_address_from_bytes(cardano_buffer_get_data(address_bytes), cardano_buffer_get_size(address_bytes), &address);
+
+          cardano_buffer_unref(&address_bytes);
+
+          if (address_from_bytes_result != CARDANO_SUCCESS)
+          {
+            cardano_address_unref(&address);
+            cardano_value_unref(&value);
+            cardano_datum_unref(&datum);
+            cardano_script_unref(&script_ref);
+
+            *transaction_output = NULL;
+
+            return address_from_bytes_result;
+          }
+
+          break;
+        }
+        case 1U:
+        {
+          cardano_value_unref(&value);
+          const cardano_error_t read_value_result = cardano_value_from_cbor(reader, &value);
+
+          if (read_value_result != CARDANO_SUCCESS)
+          {
+            cardano_address_unref(&address);
+            cardano_value_unref(&value);
+            cardano_datum_unref(&datum);
+            cardano_script_unref(&script_ref);
+
+            *transaction_output = NULL;
+
+            return read_value_result;
+          }
+
+          break;
+        }
+        case 2U:
+        {
+          cardano_datum_unref(&datum);
+          const cardano_error_t read_datum_result = cardano_datum_from_cbor(reader, &datum);
+
+          if (read_datum_result != CARDANO_SUCCESS)
+          {
+            cardano_address_unref(&address);
+            cardano_value_unref(&value);
+            cardano_datum_unref(&datum);
+            cardano_script_unref(&script_ref);
+
+            *transaction_output = NULL;
+
+            return read_datum_result;
+          }
+
+          break;
+        }
+        case 3U:
+        {
+          cardano_script_unref(&script_ref);
+          cardano_cbor_tag_t tag;
+
+          const cardano_error_t read_tag_result = cardano_cbor_reader_read_tag(reader, &tag);
+
+          if (read_tag_result != CARDANO_SUCCESS)
+          {
+            cardano_address_unref(&address);
+            cardano_value_unref(&value);
+            cardano_datum_unref(&datum);
+            cardano_script_unref(&script_ref);
+
+            *transaction_output = NULL;
+
+            return read_tag_result;
+          }
+
+          if (tag != CARDANO_ENCODED_CBOR_DATA_ITEM)
+          {
+            cardano_address_unref(&address);
+            cardano_value_unref(&value);
+            cardano_datum_unref(&datum);
+            cardano_script_unref(&script_ref);
+
+            *transaction_output = NULL;
+
+            return CARDANO_ERROR_INVALID_CBOR_VALUE;
+          }
+
+          cardano_buffer_t* script_bytes = NULL;
+
+          const cardano_error_t read_script_bytes_result = cardano_cbor_reader_read_bytestring(reader, &script_bytes);
+
+          if (read_script_bytes_result != CARDANO_SUCCESS)
+          {
+            cardano_address_unref(&address);
+            cardano_value_unref(&value);
+            cardano_datum_unref(&datum);
+            cardano_script_unref(&script_ref);
+
+            *transaction_output = NULL;
+
+            return read_script_bytes_result;
+          }
+
+          cardano_cbor_reader_t* script_reader = cardano_cbor_reader_new(cardano_buffer_get_data(script_bytes), cardano_buffer_get_size(script_bytes));
+
+          cardano_buffer_unref(&script_bytes);
+
+          const cardano_error_t read_script_result = cardano_script_from_cbor(script_reader, &script_ref);
+
+          cardano_cbor_reader_unref(&script_reader);
+
+          if (read_script_result != CARDANO_SUCCESS)
+          {
+            cardano_address_unref(&address);
+            cardano_value_unref(&value);
+            cardano_datum_unref(&datum);
+            cardano_script_unref(&script_ref);
+
+            *transaction_output = NULL;
+
+            return read_script_result;
+          }
+
+          break;
+        }
+        default:
+        {
+          cardano_address_unref(&address);
+          cardano_value_unref(&value);
+          cardano_datum_unref(&datum);
+          cardano_script_unref(&script_ref);
+
+          *transaction_output = NULL;
+
+          return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+        }
+      }
+    }
+
+    const cardano_error_t expect_end_map_result = cardano_cbor_validate_end_map(validator_name, reader);
+
+    if (expect_end_map_result != CARDANO_SUCCESS)
+    {
+      cardano_address_unref(&address);
+      cardano_value_unref(&value);
+      cardano_datum_unref(&datum);
+      cardano_script_unref(&script_ref);
+
+      *transaction_output = NULL;
+
+      return expect_end_map_result;
+    }
+
+    const cardano_error_t new_output_result = cardano_transaction_output_new(address, 0U, transaction_output);
+    cardano_error_t       set_value_result  = cardano_transaction_output_set_value(*transaction_output, value);
+    cardano_error_t       set_datum_result  = cardano_transaction_output_set_datum(*transaction_output, datum);
+    cardano_error_t       set_script_result = cardano_transaction_output_set_script_ref(*transaction_output, script_ref);
+
+    cardano_address_unref(&address);
+    cardano_value_unref(&value);
+    cardano_datum_unref(&datum);
+    cardano_script_unref(&script_ref);
+
+    if ((new_output_result != CARDANO_SUCCESS) || (set_value_result != CARDANO_SUCCESS) || (set_datum_result != CARDANO_SUCCESS) || (set_script_result != CARDANO_SUCCESS))
+    {
+      cardano_transaction_output_unref(transaction_output);
+      *transaction_output = NULL;
+
+      return new_output_result;
+    }
+  }
+  else
+  {
+    int64_t length = 0U;
+
+    const cardano_error_t read_array_result = cardano_cbor_reader_read_start_array(reader, &length);
+
+    if (read_array_result != CARDANO_SUCCESS)
+    {
+      cardano_address_unref(&address);
+      cardano_value_unref(&value);
+      cardano_datum_unref(&datum);
+      cardano_script_unref(&script_ref);
+
+      *transaction_output = NULL;
+
+      return read_array_result;
+    }
+
+    cardano_buffer_t* address_bytes = NULL;
+
+    const cardano_error_t read_address_result = cardano_cbor_reader_read_bytestring(reader, &address_bytes);
+
+    if (read_address_result != CARDANO_SUCCESS)
+    {
+      cardano_address_unref(&address);
+      cardano_value_unref(&value);
+      cardano_datum_unref(&datum);
+      cardano_script_unref(&script_ref);
+
+      *transaction_output = NULL;
+
+      return read_address_result;
+    }
+
+    const cardano_error_t address_from_bytes_result = cardano_address_from_bytes(cardano_buffer_get_data(address_bytes), cardano_buffer_get_size(address_bytes), &address);
+
+    cardano_buffer_unref(&address_bytes);
+
+    if (address_from_bytes_result != CARDANO_SUCCESS)
+    {
+      cardano_address_unref(&address);
+      cardano_value_unref(&value);
+      cardano_datum_unref(&datum);
+      cardano_script_unref(&script_ref);
+
+      *transaction_output = NULL;
+
+      return address_from_bytes_result;
+    }
+
+    const cardano_error_t read_value_result = cardano_value_from_cbor(reader, &value);
+
+    if (read_value_result != CARDANO_SUCCESS)
+    {
+      cardano_address_unref(&address);
+      cardano_value_unref(&value);
+      cardano_datum_unref(&datum);
+      cardano_script_unref(&script_ref);
+
+      *transaction_output = NULL;
+
+      return read_value_result;
+    }
+
+    if (length == 3)
+    {
+      cardano_blake2b_hash_t* datum_hash_data   = NULL;
+      const cardano_error_t   read_datum_result = cardano_blake2b_hash_from_cbor(reader, &datum_hash_data);
+
+      if (read_datum_result != CARDANO_SUCCESS)
+      {
+        cardano_address_unref(&address);
+        cardano_value_unref(&value);
+        cardano_datum_unref(&datum);
+        cardano_script_unref(&script_ref);
+
+        *transaction_output = NULL;
+
+        return read_datum_result;
+      }
+
+      cardano_error_t datum_from_hash_result = cardano_datum_new_data_hash(datum_hash_data, &datum);
+      cardano_blake2b_hash_unref(&datum_hash_data);
+
+      if (datum_from_hash_result != CARDANO_SUCCESS)
+      {
+        cardano_address_unref(&address);
+        cardano_value_unref(&value);
+        cardano_datum_unref(&datum);
+        cardano_script_unref(&script_ref);
+
+        *transaction_output = NULL;
+
+        return datum_from_hash_result;
+      }
+    }
+
+    const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+    if (expect_end_array_result != CARDANO_SUCCESS)
+    {
+      cardano_address_unref(&address);
+      cardano_value_unref(&value);
+      cardano_datum_unref(&datum);
+      cardano_script_unref(&script_ref);
+
+      *transaction_output = NULL;
+
+      return expect_end_array_result;
+    }
+
+    const cardano_error_t new_output_result = cardano_transaction_output_new(address, 0U, transaction_output);
+    cardano_error_t       set_value_result  = cardano_transaction_output_set_value(*transaction_output, value);
+    cardano_error_t       set_datum_result  = cardano_transaction_output_set_datum(*transaction_output, datum);
+
+    cardano_address_unref(&address);
+    cardano_value_unref(&value);
+    cardano_datum_unref(&datum);
+    cardano_script_unref(&script_ref);
+
+    if ((new_output_result != CARDANO_SUCCESS) || (set_value_result != CARDANO_SUCCESS) || (set_datum_result != CARDANO_SUCCESS))
+    {
+      cardano_transaction_output_unref(transaction_output);
+      *transaction_output = NULL;
+
+      return new_output_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_output_to_cbor(
+  const cardano_transaction_output_t* transaction_output,
+  cardano_cbor_writer_t*              writer)
+{
+  if (transaction_output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  int64_t map_size = 2;
+
+  if (transaction_output->datum != NULL)
+  {
+    ++map_size;
+  }
+
+  if (transaction_output->script_ref != NULL)
+  {
+    ++map_size;
+  }
+
+  cardano_error_t write_start_map_result = cardano_cbor_writer_write_start_map(writer, map_size);
+
+  if (write_start_map_result != CARDANO_SUCCESS)
+  {
+    return write_start_map_result;
+  }
+
+  cardano_error_t write_address_result = cardano_cbor_writer_write_uint(writer, 0U);
+
+  if (write_address_result != CARDANO_SUCCESS)
+  {
+    return write_address_result;
+  }
+
+  write_address_result = cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_address_get_bytes(transaction_output->address),
+    cardano_address_get_bytes_size(transaction_output->address));
+
+  if (write_address_result != CARDANO_SUCCESS)
+  {
+    return write_address_result;
+  }
+
+  cardano_error_t write_value_result = cardano_cbor_writer_write_uint(writer, 1U);
+
+  if (write_value_result != CARDANO_SUCCESS)
+  {
+    return write_value_result;
+  }
+
+  write_value_result = cardano_value_to_cbor(transaction_output->value, writer);
+
+  if (write_value_result != CARDANO_SUCCESS)
+  {
+    return write_value_result;
+  }
+
+  if (transaction_output->datum != NULL)
+  {
+    cardano_error_t write_datum_result = cardano_cbor_writer_write_uint(writer, 2U);
+
+    if (write_datum_result != CARDANO_SUCCESS)
+    {
+      return write_datum_result;
+    }
+
+    write_datum_result = cardano_datum_to_cbor(transaction_output->datum, writer);
+
+    if (write_datum_result != CARDANO_SUCCESS)
+    {
+      return write_datum_result;
+    }
+  }
+
+  if (transaction_output->script_ref != NULL)
+  {
+    cardano_error_t write_script_result = cardano_cbor_writer_write_uint(writer, 3U);
+
+    if (write_script_result != CARDANO_SUCCESS)
+    {
+      return write_script_result;
+    }
+
+    cardano_error_t write_tag_result = cardano_cbor_writer_write_tag(writer, CARDANO_ENCODED_CBOR_DATA_ITEM);
+
+    if (write_tag_result != CARDANO_SUCCESS)
+    {
+      return write_tag_result;
+    }
+
+    cardano_cbor_writer_t* script_writer = cardano_cbor_writer_new();
+
+    write_script_result = cardano_script_to_cbor(transaction_output->script_ref, script_writer);
+
+    if (write_script_result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_writer_unref(&script_writer);
+      return write_script_result;
+    }
+
+    cardano_buffer_t* script_bytes = NULL;
+
+    cardano_error_t script_bytes_result = cardano_cbor_writer_encode_in_buffer(script_writer, &script_bytes);
+
+    cardano_cbor_writer_unref(&script_writer);
+
+    if (script_bytes_result != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&script_bytes);
+      return script_bytes_result;
+    }
+
+    write_script_result = cardano_cbor_writer_write_bytestring(writer, cardano_buffer_get_data(script_bytes), cardano_buffer_get_size(script_bytes));
+
+    cardano_buffer_unref(&script_bytes);
+
+    if (write_script_result != CARDANO_SUCCESS)
+    {
+      return write_script_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_output_to_cip116_json(
+  const cardano_transaction_output_t* output,
+  cardano_json_writer_t*              writer)
+{
+  if ((output == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_property_name(writer, "address", 7);
+
+  size_t      addr_len = cardano_address_get_string_size(output->address);
+  const char* address  = cardano_address_get_string(output->address);
+
+  cardano_json_writer_write_string(writer, address, cardano_safe_strlen(address, addr_len));
+
+  cardano_json_writer_write_property_name(writer, "amount", 6);
+
+  error = cardano_value_to_cip116_json(output->value, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (output->datum != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "plutus_data", 11);
+    error = cardano_datum_to_cip116_json(output->datum, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if (output->script_ref != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "script_ref", 10);
+    error = cardano_script_to_cip116_json(output->script_ref, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_address_t*
+cardano_transaction_output_get_address(cardano_transaction_output_t* output)
+{
+  if (output == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_address_ref(output->address);
+
+  return output->address;
+}
+
+cardano_error_t
+cardano_transaction_output_set_address(cardano_transaction_output_t* output, cardano_address_t* address)
+{
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (address == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_ref(address);
+  cardano_address_unref(&output->address);
+
+  output->address = address;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_value_t*
+cardano_transaction_output_get_value(cardano_transaction_output_t* output)
+{
+  if (output == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_value_ref(output->value);
+
+  return output->value;
+}
+
+cardano_error_t
+cardano_transaction_output_set_value(cardano_transaction_output_t* output, cardano_value_t* value)
+{
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_value_ref(value);
+  cardano_value_unref(&output->value);
+
+  output->value = value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_datum_t*
+cardano_transaction_output_get_datum(cardano_transaction_output_t* output)
+{
+  if (output == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_datum_ref(output->datum);
+
+  return output->datum;
+}
+
+cardano_error_t
+cardano_transaction_output_set_datum(cardano_transaction_output_t* output, cardano_datum_t* datum)
+{
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_datum_ref(datum);
+  cardano_datum_unref(&output->datum);
+
+  output->datum = datum;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_script_t*
+cardano_transaction_output_get_script_ref(cardano_transaction_output_t* output)
+{
+  if (output == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_script_ref(output->script_ref);
+
+  return output->script_ref;
+}
+
+cardano_error_t
+cardano_transaction_output_set_script_ref(cardano_transaction_output_t* output, cardano_script_t* script_ref)
+{
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_ref(script_ref);
+  cardano_script_unref(&output->script_ref);
+
+  output->script_ref = script_ref;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_transaction_output_equals(
+  const cardano_transaction_output_t* lhs,
+  const cardano_transaction_output_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return false;
+  }
+
+  if (!cardano_address_equals(lhs->address, rhs->address))
+  {
+    return false;
+  }
+
+  if (!cardano_value_equals(lhs->value, rhs->value))
+  {
+    return false;
+  }
+
+  if (!cardano_datum_equals(lhs->datum, rhs->datum))
+  {
+    return false;
+  }
+
+  if (!cardano_script_equals(lhs->script_ref, rhs->script_ref))
+  {
+    return false;
+  }
+
+  return true;
+}
+
+void
+cardano_transaction_output_unref(cardano_transaction_output_t** transaction_output)
+{
+  if ((transaction_output == NULL) || (*transaction_output == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*transaction_output)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *transaction_output = NULL;
+    return;
+  }
+}
+
+void
+cardano_transaction_output_ref(cardano_transaction_output_t* transaction_output)
+{
+  if (transaction_output == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&transaction_output->base);
+}
+
+size_t
+cardano_transaction_output_refcount(const cardano_transaction_output_t* transaction_output)
+{
+  if (transaction_output == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&transaction_output->base);
+}
+
+void
+cardano_transaction_output_set_last_error(cardano_transaction_output_t* transaction_output, const char* message)
+{
+  cardano_object_set_last_error(&transaction_output->base, message);
+}
+
+const char*
+cardano_transaction_output_get_last_error(const cardano_transaction_output_t* transaction_output)
+{
+  return cardano_object_get_last_error(&transaction_output->base);
+}
+
+cardano_error_t
+cardano_transaction_output_deep_clone(const cardano_transaction_output_t* source, cardano_transaction_output_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_t* copy = _cardano_malloc(sizeof(cardano_transaction_output_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->address            = NULL;
+  copy->value              = NULL;
+  copy->datum              = NULL;
+  copy->script_ref         = NULL;
+
+  if (source->address != NULL)
+  {
+    const cardano_error_t result = cardano_address_deep_clone(source->address, &copy->address);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_value_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->datum != NULL)
+  {
+    const cardano_error_t result = cardano_datum_deep_clone(source->datum, &copy->datum);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->script_ref != NULL)
+  {
+    const cardano_error_t result = cardano_script_deep_clone(source->script_ref, &copy->script_ref);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/transaction_output_list.c b/vendor/src/transaction_body/transaction_output_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/transaction_output_list.c
@@ -0,0 +1,450 @@
+/**
+ * \file transaction_output_list.c
+ *
+ * \author angel.castillo
+ * \date   Sept 17, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/transaction_body/transaction_output.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano transaction output list.
+ */
+typedef struct cardano_transaction_output_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_transaction_output_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a transaction output list object.
+ *
+ * This function is responsible for properly deallocating a transaction output list object (`cardano_transaction_output_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the proposal procedure_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_transaction_output_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the transaction output list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_transaction_output_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_transaction_output_list_t* list = (cardano_transaction_output_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_transaction_output_list_new(cardano_transaction_output_list_t** transaction_output_list)
+{
+  if (transaction_output_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_list_t* list = _cardano_malloc(sizeof(cardano_transaction_output_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_transaction_output_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *transaction_output_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_output_list_from_cbor(cardano_cbor_reader_t* reader, cardano_transaction_output_list_t** transaction_output_list)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (transaction_output_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_list_t* list   = NULL;
+  cardano_error_t                    result = cardano_transaction_output_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  CARDANO_UNUSED(length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_output_list_unref(&list);
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_transaction_output_t* element = NULL;
+
+    result = cardano_transaction_output_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_transaction_output_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_transaction_output_list_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("transaction_output_list", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_output_list_unref(&list);
+    return result;
+  }
+
+  *transaction_output_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_output_list_to_cbor(const cardano_transaction_output_list_t* transaction_output_list, cardano_cbor_writer_t* writer)
+{
+  if (transaction_output_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(transaction_output_list->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  size_t array_size = cardano_array_get_size(transaction_output_list->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(transaction_output_list->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(transaction_output_list->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in transaction_output_list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_transaction_output_to_cbor((cardano_transaction_output_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_transaction_output_list_to_cip116_json(
+  const cardano_transaction_output_list_t* list,
+  cardano_json_writer_t*                   writer)
+{
+  if ((list == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t          length = cardano_transaction_output_list_get_length(list);
+  cardano_error_t error  = CARDANO_SUCCESS;
+
+  for (size_t i = 0; i < length; ++i)
+  {
+    cardano_transaction_output_t* output = NULL;
+    error                                = cardano_transaction_output_list_get(list, i, &output);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_transaction_output_to_cip116_json(output, writer);
+    cardano_transaction_output_unref(&output);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return error;
+}
+
+size_t
+cardano_transaction_output_list_get_length(const cardano_transaction_output_list_t* transaction_output_list)
+{
+  if (transaction_output_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(transaction_output_list->array);
+}
+
+cardano_error_t
+cardano_transaction_output_list_get(
+  const cardano_transaction_output_list_t* transaction_output_list,
+  size_t                                   index,
+  cardano_transaction_output_t**           element)
+{
+  if (transaction_output_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(transaction_output_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_transaction_output_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_transaction_output_list_add(cardano_transaction_output_list_t* transaction_output_list, cardano_transaction_output_t* element)
+{
+  if (transaction_output_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(transaction_output_list->array);
+  const size_t new_size      = cardano_array_push(transaction_output_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_transaction_output_list_unref(cardano_transaction_output_list_t** transaction_output_list)
+{
+  if ((transaction_output_list == NULL) || (*transaction_output_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*transaction_output_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *transaction_output_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_transaction_output_list_ref(cardano_transaction_output_list_t* transaction_output_list)
+{
+  if (transaction_output_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&transaction_output_list->base);
+}
+
+size_t
+cardano_transaction_output_list_refcount(const cardano_transaction_output_list_t* transaction_output_list)
+{
+  if (transaction_output_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&transaction_output_list->base);
+}
+
+void
+cardano_transaction_output_list_set_last_error(cardano_transaction_output_list_t* transaction_output_list, const char* message)
+{
+  cardano_object_set_last_error(&transaction_output_list->base, message);
+}
+
+const char*
+cardano_transaction_output_list_get_last_error(const cardano_transaction_output_list_t* transaction_output_list)
+{
+  return cardano_object_get_last_error(&transaction_output_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_transaction_output_t* copy   = NULL;
+  const cardano_error_t         result = cardano_transaction_output_deep_clone((const cardano_transaction_output_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_transaction_output_list_deep_clone(const cardano_transaction_output_list_t* source, cardano_transaction_output_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_list_t* copy = _cardano_malloc(sizeof(cardano_transaction_output_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_body/value.c b/vendor/src/transaction_body/value.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_body/value.c
@@ -0,0 +1,1419 @@
+/**
+ * \file value.c
+ *
+ * \author angel.castillo
+ * \date   Sep 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id_map.h>
+#include <cardano/assets/asset_name.h>
+#include <cardano/assets/asset_name_list.h>
+#include <cardano/assets/asset_name_map.h>
+#include <cardano/assets/multi_asset.h>
+#include <cardano/assets/policy_id_list.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/object.h>
+#include <cardano/transaction_body/value.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t VALUE_ARRAY_REQUIRED_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief A Value object encapsulates the quantity of assets of different types,
+ * including ADA (Cardano's native cryptocurrency) expressed in lovelace,
+ * where 1 ADA = 1,000,000 lovelace, and other native tokens. Each key in the
+ * tokens object is a unique identifier for an asset, and the corresponding
+ * value is the quantity of that asset.
+ */
+typedef struct cardano_value_t
+{
+    cardano_object_t       base;
+    int64_t                coin;
+    cardano_multi_asset_t* multi_asset;
+} cardano_value_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a value object.
+ *
+ * This function is responsible for properly deallocating a value object (`cardano_value_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the value object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_value_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the value
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_value_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_value_t* value = (cardano_value_t*)object;
+
+  cardano_multi_asset_unref(&value->multi_asset);
+
+  _cardano_free(object);
+}
+
+/**
+ * \brief Checks whether a multi asset carries at least one asset entry.
+ *
+ * Policies whose inner asset name maps are empty do not count as encodable entries.
+ *
+ * \param[in]  multi_asset The multi asset to inspect.
+ * \param[out] has_assets  Set to true if at least one policy has a non empty asset name map.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+multi_asset_has_assets(const cardano_multi_asset_t* multi_asset, bool* has_assets)
+{
+  cardano_policy_id_list_t* policies = NULL;
+
+  cardano_error_t result = cardano_multi_asset_get_keys(multi_asset, &policies);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *has_assets = false;
+
+  const size_t length = cardano_policy_id_list_get_length(policies);
+
+  for (size_t i = 0U; (i < length) && (!(*has_assets)) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_blake2b_hash_t* policy_id = NULL;
+
+    result = cardano_policy_id_list_get(policies, i, &policy_id);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_asset_name_map_t* assets = NULL;
+
+      result = cardano_multi_asset_get_assets(multi_asset, policy_id, &assets);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *has_assets = cardano_asset_name_map_get_length(assets) > 0U;
+
+        cardano_asset_name_map_unref(&assets);
+      }
+
+      cardano_blake2b_hash_unref(&policy_id);
+    }
+  }
+
+  cardano_policy_id_list_unref(&policies);
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_value_new(
+  const int64_t          coin,
+  cardano_multi_asset_t* assets,
+  cardano_value_t**      value)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_value_t* new_value = (cardano_value_t*)_cardano_malloc(sizeof(cardano_value_t));
+
+  if (new_value == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  new_value->base.ref_count     = 1;
+  new_value->base.last_error[0] = '\0';
+  new_value->base.deallocator   = cardano_value_deallocate;
+  new_value->coin               = coin;
+  new_value->multi_asset        = NULL;
+
+  if (assets != NULL)
+  {
+    cardano_multi_asset_ref(assets);
+    new_value->multi_asset = assets;
+  }
+  else
+  {
+    cardano_error_t multi_asset_new_result = cardano_multi_asset_new(&new_value->multi_asset);
+
+    if (multi_asset_new_result != CARDANO_SUCCESS)
+    {
+      _cardano_free(new_value);
+      return multi_asset_new_result;
+    }
+  }
+
+  *value = new_value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_value_t*
+cardano_value_new_zero(void)
+{
+  cardano_value_t* value = NULL;
+
+  cardano_error_t result = cardano_value_new(0, NULL, &value);
+  CARDANO_UNUSED(result);
+
+  return value;
+}
+
+cardano_value_t*
+cardano_value_new_from_coin(const int64_t lovelace)
+{
+  cardano_value_t* value = NULL;
+
+  cardano_error_t result = cardano_value_new(lovelace, NULL, &value);
+  CARDANO_UNUSED(result);
+
+  return value;
+}
+
+cardano_error_t
+cardano_value_from_asset_map(
+  cardano_asset_id_map_t* asset_map,
+  cardano_value_t**       value)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  uint64_t               coin        = 0U;
+  cardano_multi_asset_t* multi_asset = NULL;
+
+  cardano_error_t result = cardano_multi_asset_new(&multi_asset);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *value = NULL;
+    return result;
+  }
+
+  const size_t asset_count = cardano_asset_id_map_get_length(asset_map);
+
+  for (size_t i = 0U; i < asset_count; ++i)
+  {
+    cardano_asset_id_t* asset_id = NULL;
+    int64_t             amount   = 0;
+
+    result = cardano_asset_id_map_get_key_value_at(asset_map, i, &asset_id, &amount);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_multi_asset_unref(&multi_asset);
+
+      *value = NULL;
+      return result;
+    }
+
+    if (cardano_asset_id_is_lovelace(asset_id))
+    {
+      coin = amount;
+
+      cardano_asset_id_unref(&asset_id);
+    }
+    else
+    {
+      cardano_asset_name_t*   asset_name = cardano_asset_id_get_asset_name(asset_id);
+      cardano_blake2b_hash_t* policy_id  = cardano_asset_id_get_policy_id(asset_id);
+
+      cardano_asset_id_unref(&asset_id);
+
+      if ((asset_name == NULL) || (policy_id == NULL))
+      {
+        cardano_multi_asset_unref(&multi_asset);
+        cardano_asset_name_unref(&asset_name);
+        cardano_blake2b_hash_unref(&policy_id);
+
+        *value = NULL;
+
+        return CARDANO_ERROR_POINTER_IS_NULL;
+      }
+
+      result = cardano_multi_asset_set(multi_asset, policy_id, asset_name, amount);
+
+      cardano_asset_name_unref(&asset_name);
+      cardano_blake2b_hash_unref(&policy_id);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_multi_asset_unref(&multi_asset);
+
+        *value = NULL;
+        return result;
+      }
+    }
+  }
+
+  result = cardano_value_new((int64_t)coin, multi_asset, value);
+
+  cardano_multi_asset_unref(&multi_asset);
+
+  return result;
+}
+
+cardano_error_t
+cardano_value_from_cbor(cardano_cbor_reader_t* reader, cardano_value_t** value)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *value = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_asset_t*      multi_asset = NULL;
+  uint64_t                    coin        = 0U;
+  cardano_cbor_reader_state_t state;
+
+  const cardano_error_t peek_result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (peek_result != CARDANO_SUCCESS)
+  {
+    *value = NULL;
+    return peek_result;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_UNSIGNED_INTEGER)
+  {
+    const cardano_error_t read_coin_result = cardano_cbor_reader_read_uint(reader, &coin);
+
+    if (read_coin_result != CARDANO_SUCCESS)
+    {
+      *value = NULL;
+      return read_coin_result;
+    }
+
+    return cardano_value_new((int64_t)coin, NULL, value);
+  }
+  else
+  {
+    static const char* validator_name = "value";
+
+    const cardano_error_t read_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)VALUE_ARRAY_REQUIRED_SIZE);
+
+    if (read_array_result != CARDANO_SUCCESS)
+    {
+      *value = NULL;
+      return read_array_result;
+    }
+
+    const cardano_error_t read_coin_result = cardano_cbor_reader_read_uint(reader, &coin);
+
+    if (read_coin_result != CARDANO_SUCCESS)
+    {
+      *value = NULL;
+      return read_coin_result;
+    }
+
+    const cardano_error_t read_multi_asset_result = cardano_multi_asset_from_cbor(reader, &multi_asset);
+
+    if (read_multi_asset_result != CARDANO_SUCCESS)
+    {
+      *value = NULL;
+      return read_multi_asset_result;
+    }
+
+    const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+    if (expect_end_array_result != CARDANO_SUCCESS)
+    {
+      cardano_multi_asset_unref(&multi_asset);
+      *value = NULL;
+      return expect_end_array_result;
+    }
+
+    cardano_error_t new_val_result = cardano_value_new((int64_t)coin, multi_asset, value);
+
+    cardano_multi_asset_unref(&multi_asset);
+
+    return new_val_result;
+  }
+}
+
+cardano_error_t
+cardano_value_to_cbor(
+  const cardano_value_t* value,
+  cardano_cbor_writer_t* writer)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  bool has_assets = false;
+
+  if (value->multi_asset != NULL)
+  {
+    cardano_error_t has_assets_result = multi_asset_has_assets(value->multi_asset, &has_assets);
+
+    if (has_assets_result != CARDANO_SUCCESS)
+    {
+      return has_assets_result;
+    }
+  }
+
+  if (!has_assets)
+  {
+    return cardano_cbor_writer_write_uint(writer, value->coin);
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(writer, VALUE_ARRAY_REQUIRED_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_coin_result = cardano_cbor_writer_write_uint(writer, value->coin);
+
+  if (write_coin_result != CARDANO_SUCCESS)
+  {
+    return write_coin_result;
+  }
+
+  return cardano_multi_asset_to_cbor(value->multi_asset, writer);
+}
+
+cardano_error_t
+cardano_value_to_cip116_json(
+  const cardano_value_t* value,
+  cardano_json_writer_t* writer)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_json_writer_write_property_name(writer, "coin", 4);
+  cardano_json_writer_write_signed_int_as_string(writer, value->coin);
+
+  if ((value->multi_asset == NULL) || (cardano_multi_asset_get_policy_count(value->multi_asset) == 0U))
+  {
+    cardano_json_writer_write_end_object(writer);
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_json_writer_write_property_name(writer, "assets", 6);
+  cardano_error_t error = cardano_multi_asset_to_cip116_json(value->multi_asset, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_multi_asset_t*
+cardano_value_get_multi_asset(cardano_value_t* value)
+{
+  if (value == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_multi_asset_ref(value->multi_asset);
+
+  return value->multi_asset;
+}
+
+cardano_error_t
+cardano_value_set_multi_asset(cardano_value_t* value, cardano_multi_asset_t* assets)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_asset_ref(assets);
+  cardano_multi_asset_unref(&value->multi_asset);
+  value->multi_asset = assets;
+
+  return CARDANO_SUCCESS;
+}
+
+int64_t
+cardano_value_get_coin(const cardano_value_t* value)
+{
+  if (value == NULL)
+  {
+    return 0U;
+  }
+
+  return value->coin;
+}
+
+cardano_error_t
+cardano_value_set_coin(cardano_value_t* value, const int64_t coin)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  value->coin = coin;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_value_add_coin(cardano_value_t* value, const int64_t coin)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  value->coin += coin;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_value_subtract_coin(cardano_value_t* value, const int64_t coin)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  value->coin -= coin;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_value_add_multi_asset(cardano_value_t* value, cardano_multi_asset_t* multi_asset)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_asset_t* add_result = NULL;
+  cardano_error_t        result     = cardano_multi_asset_add(value->multi_asset, multi_asset, &add_result);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_multi_asset_unref(&value->multi_asset);
+  value->multi_asset = add_result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_value_subtract_multi_asset(cardano_value_t* value, cardano_multi_asset_t* multi_asset)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (multi_asset == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_multi_asset_t* subtraction_result = NULL;
+  cardano_error_t        result             = cardano_multi_asset_subtract(value->multi_asset, multi_asset, &subtraction_result);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_multi_asset_unref(&value->multi_asset);
+  value->multi_asset = subtraction_result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_value_add_asset(
+  cardano_value_t*        value,
+  cardano_blake2b_hash_t* policy_id,
+  cardano_asset_name_t*   asset_name,
+  int64_t                 quantity)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (policy_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_name == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(value->multi_asset != NULL);
+
+  int64_t         current_quantity = 0;
+  cardano_error_t result           = cardano_multi_asset_get(value->multi_asset, policy_id, asset_name, &current_quantity);
+
+  if ((result != CARDANO_SUCCESS) && (result != CARDANO_ERROR_ELEMENT_NOT_FOUND))
+  {
+    return result;
+  }
+
+  return cardano_multi_asset_set(value->multi_asset, policy_id, asset_name, current_quantity + quantity);
+}
+
+cardano_error_t
+cardano_value_add_asset_ex(
+  cardano_value_t* value,
+  const char*      policy_id_hex,
+  const size_t     policy_id_hex_len,
+  const char*      asset_name_hex,
+  const size_t     asset_name_hex_len,
+  const int64_t    quantity)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (policy_id_hex == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_name_hex == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(value->multi_asset != NULL);
+
+  cardano_blake2b_hash_t* policy_id  = NULL;
+  cardano_asset_name_t*   asset_name = NULL;
+
+  cardano_error_t policy_id_result = cardano_blake2b_hash_from_hex(policy_id_hex, policy_id_hex_len, &policy_id);
+
+  if (policy_id_result != CARDANO_SUCCESS)
+  {
+    return policy_id_result;
+  }
+
+  cardano_error_t asset_name_result = cardano_asset_name_from_hex(asset_name_hex, asset_name_hex_len, &asset_name);
+
+  if (asset_name_result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&policy_id);
+    return asset_name_result;
+  }
+
+  cardano_error_t add_asset_result = cardano_value_add_asset(value, policy_id, asset_name, quantity);
+
+  cardano_blake2b_hash_unref(&policy_id);
+  cardano_asset_name_unref(&asset_name);
+
+  return add_asset_result;
+}
+
+cardano_error_t
+cardano_value_add_asset_with_id(
+  cardano_value_t*    value,
+  cardano_asset_id_t* asset_id,
+  int64_t             quantity)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(value->multi_asset != NULL);
+
+  cardano_asset_name_t*   asset_name = cardano_asset_id_get_asset_name(asset_id);
+  cardano_blake2b_hash_t* policy_id  = cardano_asset_id_get_policy_id(asset_id);
+
+  cardano_error_t result = cardano_value_add_asset(value, policy_id, asset_name, quantity);
+
+  cardano_asset_name_unref(&asset_name);
+  cardano_blake2b_hash_unref(&policy_id);
+
+  return result;
+}
+
+cardano_error_t
+cardano_value_add_asset_with_id_ex(
+  cardano_value_t* value,
+  const char*      asset_id_hex,
+  size_t           asset_id_hex_len,
+  int64_t          quantity)
+{
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (asset_id_hex == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(value->multi_asset != NULL);
+
+  cardano_asset_id_t* asset_id = NULL;
+
+  cardano_error_t asset_id_result = cardano_asset_id_from_hex(asset_id_hex, asset_id_hex_len, &asset_id);
+
+  if (asset_id_result != CARDANO_SUCCESS)
+  {
+    return asset_id_result;
+  }
+
+  cardano_error_t add_asset_result = cardano_value_add_asset_with_id(value, asset_id, quantity);
+
+  cardano_asset_id_unref(&asset_id);
+
+  return add_asset_result;
+}
+
+cardano_error_t
+cardano_value_add(cardano_value_t* lhs, cardano_value_t* rhs, cardano_value_t** result)
+{
+  if (lhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (rhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((lhs->multi_asset == NULL) || (cardano_multi_asset_get_policy_count(lhs->multi_asset) == 0U))
+  {
+    return cardano_value_new(lhs->coin + rhs->coin, rhs->multi_asset, result);
+  }
+
+  if ((rhs->multi_asset == NULL) || (cardano_multi_asset_get_policy_count(rhs->multi_asset) == 0U))
+  {
+    return cardano_value_new(lhs->coin + rhs->coin, lhs->multi_asset, result);
+  }
+
+  int64_t                coin        = lhs->coin + rhs->coin;
+  cardano_multi_asset_t* multi_asset = NULL;
+
+  cardano_error_t multi_asset_result = cardano_multi_asset_add(lhs->multi_asset, rhs->multi_asset, &multi_asset);
+
+  if (multi_asset_result != CARDANO_SUCCESS)
+  {
+    return multi_asset_result;
+  }
+
+  cardano_error_t new_value_result = cardano_value_new(coin, multi_asset, result);
+  cardano_multi_asset_unref(&multi_asset);
+
+  return new_value_result;
+}
+
+cardano_error_t
+cardano_value_subtract(cardano_value_t* lhs, cardano_value_t* rhs, cardano_value_t** result)
+{
+  if (lhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (rhs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((lhs->multi_asset == NULL) || (cardano_multi_asset_get_policy_count(lhs->multi_asset) == 0U))
+  {
+    cardano_error_t new_val_result = cardano_value_new(lhs->coin - rhs->coin, NULL, result);
+
+    if (new_val_result != CARDANO_SUCCESS)
+    {
+      (*result) = NULL;
+      return new_val_result;
+    }
+
+    new_val_result = cardano_value_subtract_multi_asset(*result, rhs->multi_asset);
+
+    if (new_val_result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(result);
+      return new_val_result;
+    }
+
+    return new_val_result;
+  }
+
+  if ((rhs->multi_asset == NULL) || (cardano_multi_asset_get_policy_count(rhs->multi_asset) == 0U))
+  {
+    return cardano_value_new(lhs->coin - rhs->coin, lhs->multi_asset, result);
+  }
+
+  int64_t                coin        = lhs->coin - rhs->coin;
+  cardano_multi_asset_t* multi_asset = NULL;
+
+  cardano_error_t multi_asset_result = cardano_multi_asset_subtract(lhs->multi_asset, rhs->multi_asset, &multi_asset);
+
+  if (multi_asset_result != CARDANO_SUCCESS)
+  {
+    return multi_asset_result;
+  }
+
+  cardano_error_t new_value_result = cardano_value_new(coin, multi_asset, result);
+  cardano_multi_asset_unref(&multi_asset);
+
+  return new_value_result;
+}
+
+cardano_error_t
+cardano_value_get_intersection(cardano_value_t* lhs, cardano_value_t* rhs, cardano_asset_id_list_t** result)
+{
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_list_t* intersection = NULL;
+
+  cardano_error_t get_intersection_result = cardano_asset_id_list_new(&intersection);
+
+  if (get_intersection_result != CARDANO_SUCCESS)
+  {
+    return get_intersection_result;
+  }
+
+  if ((lhs->coin > 0) && (rhs->coin > 0))
+  {
+    cardano_asset_id_t* lovelace_asset_id = NULL;
+
+    cardano_error_t add_lovelace_result = cardano_asset_id_new_lovelace(&lovelace_asset_id);
+
+    if (add_lovelace_result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_list_unref(&intersection);
+      return add_lovelace_result;
+    }
+
+    add_lovelace_result = cardano_asset_id_list_add(intersection, lovelace_asset_id);
+
+    cardano_asset_id_unref(&lovelace_asset_id);
+
+    if (add_lovelace_result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_list_unref(&intersection);
+      return add_lovelace_result;
+    }
+  }
+
+  cardano_policy_id_list_t* lhs_policies    = NULL;
+  cardano_error_t           get_keys_result = cardano_multi_asset_get_keys(lhs->multi_asset, &lhs_policies);
+
+  if (get_keys_result != CARDANO_SUCCESS)
+  {
+    return get_keys_result;
+  }
+
+  for (size_t i = 0U; i < cardano_policy_id_list_get_length(lhs_policies); ++i)
+  {
+    cardano_blake2b_hash_t* policy_id = NULL;
+
+    cardano_error_t get_policy_result = cardano_policy_id_list_get(lhs_policies, i, &policy_id);
+
+    if (get_policy_result != CARDANO_SUCCESS)
+    {
+      cardano_policy_id_list_unref(&lhs_policies);
+
+      return get_policy_result;
+    }
+
+    cardano_asset_name_map_t* lhs_asset_map = NULL;
+    cardano_asset_name_map_t* rhs_asset_map = NULL;
+
+    cardano_error_t get_asset_result = cardano_multi_asset_get_assets(lhs->multi_asset, policy_id, &lhs_asset_map);
+
+    if (get_asset_result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&policy_id);
+      cardano_policy_id_list_unref(&lhs_policies);
+
+      return get_asset_result;
+    }
+
+    get_asset_result = cardano_multi_asset_get_assets(rhs->multi_asset, policy_id, &rhs_asset_map);
+
+    if ((get_asset_result != CARDANO_SUCCESS) || (rhs_asset_map == NULL))
+    {
+      cardano_blake2b_hash_unref(&policy_id);
+      cardano_asset_name_map_unref(&lhs_asset_map);
+
+      continue;
+    }
+
+    cardano_asset_name_list_t* lhs_asset_names       = NULL;
+    cardano_error_t            get_asset_list_result = cardano_asset_name_map_get_keys(lhs_asset_map, &lhs_asset_names);
+
+    if (get_asset_list_result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&policy_id);
+      cardano_asset_name_map_unref(&lhs_asset_map);
+      cardano_asset_name_map_unref(&rhs_asset_map);
+      cardano_policy_id_list_unref(&lhs_policies);
+
+      return get_asset_list_result;
+    }
+
+    for (size_t j = 0U; j < cardano_asset_name_list_get_length(lhs_asset_names); ++j)
+    {
+      cardano_asset_name_t* asset_name = NULL;
+
+      cardano_error_t get_asset_name_result = cardano_asset_name_list_get(lhs_asset_names, j, &asset_name);
+
+      if (get_asset_name_result != CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_unref(&policy_id);
+        cardano_asset_name_list_unref(&lhs_asset_names);
+        cardano_asset_name_map_unref(&lhs_asset_map);
+        cardano_asset_name_map_unref(&rhs_asset_map);
+        cardano_policy_id_list_unref(&lhs_policies);
+
+        return get_asset_name_result;
+      }
+
+      int64_t lhs_value = 0;
+      int64_t rhs_value = 0;
+
+      cardano_error_t get_asset_value_result = cardano_multi_asset_get(lhs->multi_asset, policy_id, asset_name, &lhs_value);
+
+      if (get_asset_value_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_name_unref(&asset_name);
+        cardano_blake2b_hash_unref(&policy_id);
+        cardano_asset_name_list_unref(&lhs_asset_names);
+        cardano_asset_name_map_unref(&lhs_asset_map);
+        cardano_asset_name_map_unref(&rhs_asset_map);
+        cardano_policy_id_list_unref(&lhs_policies);
+
+        return get_asset_value_result;
+      }
+
+      if (cardano_multi_asset_get(rhs->multi_asset, policy_id, asset_name, &rhs_value) == CARDANO_SUCCESS)
+      {
+        cardano_asset_id_t* asset_id = NULL;
+
+        cardano_error_t asset_id_result = cardano_asset_id_new(policy_id, asset_name, &asset_id);
+
+        if (asset_id_result != CARDANO_SUCCESS)
+        {
+          cardano_asset_name_unref(&asset_name);
+          cardano_blake2b_hash_unref(&policy_id);
+          cardano_asset_name_list_unref(&lhs_asset_names);
+          cardano_asset_name_map_unref(&lhs_asset_map);
+          cardano_asset_name_map_unref(&rhs_asset_map);
+          cardano_policy_id_list_unref(&lhs_policies);
+
+          return asset_id_result;
+        }
+
+        asset_id_result = cardano_asset_id_list_add(intersection, asset_id);
+
+        cardano_asset_id_unref(&asset_id);
+
+        if (asset_id_result != CARDANO_SUCCESS)
+        {
+          cardano_asset_name_unref(&asset_name);
+          cardano_blake2b_hash_unref(&policy_id);
+          cardano_asset_name_list_unref(&lhs_asset_names);
+          cardano_asset_name_map_unref(&lhs_asset_map);
+          cardano_asset_name_map_unref(&rhs_asset_map);
+          cardano_policy_id_list_unref(&lhs_policies);
+
+          return asset_id_result;
+        }
+      }
+
+      cardano_asset_name_unref(&asset_name);
+    }
+
+    cardano_asset_name_list_unref(&lhs_asset_names);
+    cardano_asset_name_map_unref(&lhs_asset_map);
+    cardano_asset_name_map_unref(&rhs_asset_map);
+    cardano_blake2b_hash_unref(&policy_id);
+  }
+
+  cardano_policy_id_list_unref(&lhs_policies);
+
+  *result = intersection;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_value_get_intersection_count(cardano_value_t* lhs, cardano_value_t* rhs, uint64_t* result)
+{
+  if ((lhs == NULL) || (rhs == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_list_t* intersection = NULL;
+
+  cardano_error_t get_intersection_result = cardano_value_get_intersection(lhs, rhs, &intersection);
+
+  if (get_intersection_result != CARDANO_SUCCESS)
+  {
+    return get_intersection_result;
+  }
+
+  *result = cardano_asset_id_list_get_length(intersection);
+
+  cardano_asset_id_list_unref(&intersection);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_asset_id_map_t*
+cardano_value_as_assets_map(cardano_value_t* value)
+{
+  if (value == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_asset_id_map_t* asset_map = NULL;
+  cardano_error_t         result    = cardano_asset_id_map_new(&asset_map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  if (value->coin != 0)
+  {
+    cardano_asset_id_t* lovelace_asset_id = NULL;
+    result                                = cardano_asset_id_new_lovelace(&lovelace_asset_id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_map_unref(&asset_map);
+      return NULL;
+    }
+
+    result = cardano_asset_id_map_insert(asset_map, lovelace_asset_id, (int64_t)value->coin);
+    cardano_asset_id_unref(&lovelace_asset_id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_map_unref(&asset_map);
+      return NULL;
+    }
+  }
+
+  if (value->multi_asset != NULL)
+  {
+    cardano_policy_id_list_t* policies = NULL;
+    result                             = cardano_multi_asset_get_keys(value->multi_asset, &policies);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_map_unref(&asset_map);
+      return NULL;
+    }
+
+    for (size_t i = 0U; i < cardano_policy_id_list_get_length(policies); ++i)
+    {
+      cardano_blake2b_hash_t* policy_id = NULL;
+      result                            = cardano_policy_id_list_get(policies, i, &policy_id);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_policy_id_list_unref(&policies);
+        cardano_asset_id_map_unref(&asset_map);
+
+        return NULL;
+      }
+
+      cardano_asset_name_map_t* asset_names = NULL;
+      result                                = cardano_multi_asset_get_assets(value->multi_asset, policy_id, &asset_names);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_unref(&policy_id);
+        cardano_policy_id_list_unref(&policies);
+        cardano_asset_id_map_unref(&asset_map);
+
+        return NULL;
+      }
+
+      cardano_asset_name_list_t* asset_name_list = NULL;
+      result                                     = cardano_asset_name_map_get_keys(asset_names, &asset_name_list);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_unref(&policy_id);
+        cardano_asset_name_map_unref(&asset_names);
+        cardano_policy_id_list_unref(&policies);
+        cardano_asset_id_map_unref(&asset_map);
+
+        return NULL;
+      }
+
+      for (size_t j = 0; j < cardano_asset_name_list_get_length(asset_name_list); ++j)
+      {
+        cardano_asset_name_t* asset_name = NULL;
+        result                           = cardano_asset_name_list_get(asset_name_list, j, &asset_name);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_asset_name_list_unref(&asset_name_list);
+          cardano_asset_name_map_unref(&asset_names);
+          cardano_blake2b_hash_unref(&policy_id);
+          cardano_policy_id_list_unref(&policies);
+          cardano_asset_id_map_unref(&asset_map);
+
+          return NULL;
+        }
+
+        int64_t amount = 0;
+        result         = cardano_multi_asset_get(value->multi_asset, policy_id, asset_name, &amount);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_asset_name_unref(&asset_name);
+          cardano_asset_name_list_unref(&asset_name_list);
+          cardano_asset_name_map_unref(&asset_names);
+          cardano_blake2b_hash_unref(&policy_id);
+          cardano_policy_id_list_unref(&policies);
+          cardano_asset_id_map_unref(&asset_map);
+
+          return NULL;
+        }
+
+        cardano_asset_id_t* asset_id = NULL;
+        result                       = cardano_asset_id_new(policy_id, asset_name, &asset_id);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_asset_name_unref(&asset_name);
+          cardano_asset_name_list_unref(&asset_name_list);
+          cardano_asset_name_map_unref(&asset_names);
+          cardano_blake2b_hash_unref(&policy_id);
+          cardano_policy_id_list_unref(&policies);
+          cardano_asset_id_map_unref(&asset_map);
+
+          return NULL;
+        }
+
+        result = cardano_asset_id_map_insert(asset_map, asset_id, amount);
+        cardano_asset_id_unref(&asset_id);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_asset_name_unref(&asset_name);
+          cardano_asset_name_list_unref(&asset_name_list);
+          cardano_asset_name_map_unref(&asset_names);
+          cardano_blake2b_hash_unref(&policy_id);
+          cardano_policy_id_list_unref(&policies);
+          cardano_asset_id_map_unref(&asset_map);
+
+          return NULL;
+        }
+
+        cardano_asset_name_unref(&asset_name);
+      }
+
+      cardano_asset_name_list_unref(&asset_name_list);
+      cardano_asset_name_map_unref(&asset_names);
+      cardano_blake2b_hash_unref(&policy_id);
+    }
+
+    cardano_policy_id_list_unref(&policies);
+  }
+
+  return asset_map;
+}
+
+uint64_t
+cardano_value_get_asset_count(const cardano_value_t* value)
+{
+  if (value == NULL)
+  {
+    return 0U;
+  }
+
+  uint64_t asset_count = 0U;
+
+  if (value->coin > 0)
+  {
+    ++asset_count;
+  }
+
+  if (value->multi_asset != NULL)
+  {
+    cardano_policy_id_list_t* policies = NULL;
+    cardano_error_t           result   = cardano_multi_asset_get_keys(value->multi_asset, &policies);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return 0U;
+    }
+
+    for (size_t i = 0U; i < cardano_policy_id_list_get_length(policies); ++i)
+    {
+      cardano_blake2b_hash_t* policy_id = NULL;
+      result                            = cardano_policy_id_list_get(policies, i, &policy_id);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_policy_id_list_unref(&policies);
+
+        return 0U;
+      }
+
+      cardano_asset_name_map_t* asset_names = NULL;
+      result                                = cardano_multi_asset_get_assets(value->multi_asset, policy_id, &asset_names);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_unref(&policy_id);
+        cardano_policy_id_list_unref(&policies);
+
+        return 0U;
+      }
+
+      asset_count += cardano_asset_name_map_get_length(asset_names);
+
+      cardano_asset_name_map_unref(&asset_names);
+      cardano_blake2b_hash_unref(&policy_id);
+    }
+
+    cardano_policy_id_list_unref(&policies);
+  }
+
+  return asset_count;
+}
+
+bool
+cardano_value_is_zero(const cardano_value_t* value)
+{
+  if (value == NULL)
+  {
+    return true;
+  }
+
+  return (value->coin == 0) && (cardano_multi_asset_get_policy_count(value->multi_asset) == 0U);
+}
+
+bool
+cardano_value_equals(const cardano_value_t* lhs, const cardano_value_t* rhs)
+{
+  if (lhs == NULL)
+  {
+    return rhs == NULL;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->coin != rhs->coin)
+  {
+    return false;
+  }
+
+  if ((lhs->multi_asset == NULL) || cardano_multi_asset_get_policy_count(lhs->multi_asset) == 0U)
+  {
+    return (rhs->multi_asset == NULL) || cardano_multi_asset_get_policy_count(rhs->multi_asset) == 0U;
+  }
+
+  return cardano_multi_asset_equals(lhs->multi_asset, rhs->multi_asset);
+}
+
+void
+cardano_value_unref(cardano_value_t** value)
+{
+  if ((value == NULL) || (*value == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*value)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *value = NULL;
+    return;
+  }
+}
+
+void
+cardano_value_ref(cardano_value_t* value)
+{
+  if (value == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&value->base);
+}
+
+size_t
+cardano_value_refcount(const cardano_value_t* value)
+{
+  if (value == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&value->base);
+}
+
+void
+cardano_value_set_last_error(cardano_value_t* value, const char* message)
+{
+  cardano_object_set_last_error(&value->base, message);
+}
+
+const char*
+cardano_value_get_last_error(const cardano_value_t* value)
+{
+  return cardano_object_get_last_error(&value->base);
+}
+
+cardano_error_t
+cardano_value_deep_clone(const cardano_value_t* source, cardano_value_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_value_t* copy = _cardano_malloc(sizeof(cardano_value_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->coin               = source->coin;
+  copy->multi_asset        = NULL;
+
+  if (source->multi_asset != NULL)
+  {
+    const cardano_error_t result = cardano_multi_asset_deep_clone(source->multi_asset, &copy->multi_asset);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_builder/balancing/deferred_redeemer_list.c b/vendor/src/transaction_builder/balancing/deferred_redeemer_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/deferred_redeemer_list.c
@@ -0,0 +1,239 @@
+/**
+ * \file deferred_redeemer_list.c
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+
+#include "../../allocators.h"
+
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief A registered deferred redeemer: the shared witness-set redeemer object and the callback
+ * that produces its payload.
+ */
+typedef struct deferred_redeemer_entry_t
+{
+    cardano_redeemer_t*            redeemer;
+    cardano_deferred_redeemer_fn_t callback;
+    void*                          user_context;
+} deferred_redeemer_entry_t;
+
+/**
+ * \brief A list of pending deferred redeemers.
+ */
+typedef struct cardano_deferred_redeemer_list_t
+{
+    cardano_object_t           base;
+    deferred_redeemer_entry_t* entries;
+    size_t                     size;
+    size_t                     capacity;
+} cardano_deferred_redeemer_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Releases the redeemer references held by the list and frees its storage.
+ *
+ * \param[in] object The list to deallocate.
+ */
+static void
+deferred_redeemer_list_deallocate(void* object)
+{
+  cardano_deferred_redeemer_list_t* list = (cardano_deferred_redeemer_list_t*)object;
+
+  for (size_t i = 0U; i < list->size; ++i)
+  {
+    cardano_redeemer_unref(&list->entries[i].redeemer);
+  }
+
+  _cardano_free(list->entries);
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_deferred_redeemer_list_new(cardano_deferred_redeemer_list_t** list)
+{
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_deferred_redeemer_list_t* new_list = (cardano_deferred_redeemer_list_t*)_cardano_malloc(sizeof(cardano_deferred_redeemer_list_t));
+
+  if (new_list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  new_list->base.ref_count     = 1;
+  new_list->base.last_error[0] = '\0';
+  new_list->base.deallocator   = deferred_redeemer_list_deallocate;
+  new_list->entries            = NULL;
+  new_list->size               = 0U;
+  new_list->capacity           = 0U;
+
+  *list = new_list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_deferred_redeemer_list_add(
+  cardano_deferred_redeemer_list_t* list,
+  cardano_redeemer_t*               redeemer,
+  cardano_deferred_redeemer_fn_t    callback,
+  void*                             user_context)
+{
+  if ((list == NULL) || (redeemer == NULL) || (callback == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (list->size == list->capacity)
+  {
+    const size_t               new_capacity = (list->capacity == 0U) ? 4U : (list->capacity * 2U);
+    deferred_redeemer_entry_t* new_entries  = (deferred_redeemer_entry_t*)_cardano_malloc(new_capacity * sizeof(deferred_redeemer_entry_t));
+
+    if (new_entries == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    for (size_t i = 0U; i < list->size; ++i)
+    {
+      new_entries[i] = list->entries[i];
+    }
+
+    _cardano_free(list->entries);
+
+    list->entries  = new_entries;
+    list->capacity = new_capacity;
+  }
+
+  cardano_redeemer_ref(redeemer);
+
+  list->entries[list->size].redeemer     = redeemer;
+  list->entries[list->size].callback     = callback;
+  list->entries[list->size].user_context = user_context;
+
+  ++list->size;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_deferred_redeemer_list_get_length(const cardano_deferred_redeemer_list_t* list)
+{
+  if (list == NULL)
+  {
+    return 0U;
+  }
+
+  return list->size;
+}
+
+cardano_error_t
+cardano_deferred_redeemer_list_resolve(
+  cardano_deferred_redeemer_list_t* list,
+  cardano_transaction_t*            draft_tx,
+  cardano_utxo_list_t*              resolved_inputs)
+{
+  if (list == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  if ((draft_tx == NULL) || (resolved_inputs == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < list->size) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_plutus_data_t* payload = NULL;
+
+    result = list->entries[i].callback(list->entries[i].user_context, draft_tx, resolved_inputs, &payload);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      if (payload == NULL)
+      {
+        result = CARDANO_ERROR_POINTER_IS_NULL;
+      }
+      else
+      {
+        result = cardano_redeemer_set_data(list->entries[i].redeemer, payload);
+      }
+    }
+
+    cardano_plutus_data_unref(&payload);
+  }
+
+  return result;
+}
+
+void
+cardano_deferred_redeemer_list_ref(cardano_deferred_redeemer_list_t* list)
+{
+  if (list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&list->base);
+}
+
+void
+cardano_deferred_redeemer_list_unref(cardano_deferred_redeemer_list_t** list)
+{
+  if ((list == NULL) || (*list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *list = NULL;
+  }
+}
+
+size_t
+cardano_deferred_redeemer_list_refcount(const cardano_deferred_redeemer_list_t* list)
+{
+  if (list == NULL)
+  {
+    return 0U;
+  }
+
+  return cardano_object_refcount(&list->base);
+}
diff --git a/vendor/src/transaction_builder/balancing/implicit_coin.c b/vendor/src/transaction_builder/balancing/implicit_coin.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/implicit_coin.c
@@ -0,0 +1,545 @@
+/**
+ * \file implicit_coin.c
+ *
+ * \author angel.castillo
+ * \date   Nov 02, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/register_drep_cert.h>
+#include <cardano/certs/registration_cert.h>
+#include <cardano/certs/stake_registration_delegation_cert.h>
+#include <cardano/certs/stake_vote_registration_delegation_cert.h>
+#include <cardano/certs/unregister_drep_cert.h>
+#include <cardano/certs/unregistration_cert.h>
+#include <cardano/certs/vote_registration_delegation_cert.h>
+#include <cardano/transaction_builder/balancing/implicit_coin.h>
+#include <string.h>
+
+#include "../../string_safe.h"
+#include "internals/pool_deposits.h"
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Adds a lovelace amount to an implicit coin accumulator.
+ *
+ * \param[in,out] accumulator A pointer to the accumulator. On failure it is left untouched.
+ * \param[in]     amount      The lovelace amount to add.
+ *
+ * \return \ref CARDANO_SUCCESS if the amount was added, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if the sum
+ *         exceeds UINT64_MAX.
+ */
+static cardano_error_t
+add_amount(uint64_t* accumulator, const uint64_t amount)
+{
+  if (amount > (UINT64_MAX - *accumulator))
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  *accumulator += amount;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Accumulates the reward withdrawals of a body into the implicit coin.
+ *
+ * \param[in]  withdrawals   The withdrawal map of the body, or NULL when the body has none.
+ * \param[out] implicit_coin The implicit coin accumulator to update.
+ *
+ * \return \ref CARDANO_SUCCESS if the withdrawals were accumulated, or an appropriate error code.
+ */
+static cardano_error_t
+compute_withdrawals(
+  cardano_withdrawal_map_t* withdrawals,
+  cardano_implicit_coin_t*  implicit_coin)
+{
+  const size_t size = cardano_withdrawal_map_get_length(withdrawals);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    uint64_t amount = 0;
+
+    cardano_error_t result = cardano_withdrawal_map_get_value_at(withdrawals, i, &amount);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = add_amount(&implicit_coin->withdrawals, amount);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Determines whether a pool registration certificate registers a pool for the first time in its certificate set.
+ *
+ * The ledger charges the pool deposit once per pool: a later registration of the same pool in the same set updates
+ * the pool parameters and pays no deposit.
+ *
+ * \param[in]  certificates The certificate set holding the pool registration certificate.
+ * \param[in]  index        The position of the pool registration certificate in the set.
+ * \param[in]  certificate  The pool registration certificate at `index`.
+ * \param[out] is_first     On success, `true` if no certificate before `index` registers the same pool; otherwise, `false`.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificates were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+is_first_pool_registration(
+  cardano_certificate_set_t* certificates,
+  const size_t               index,
+  cardano_certificate_t*     certificate,
+  bool*                      is_first)
+{
+  cardano_blake2b_hash_t* operator_key_hash = NULL;
+
+  cardano_error_t result = _cardano_get_pool_operator_key_hash(certificate, &operator_key_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *is_first = true;
+
+  for (size_t i = 0U; (i < index) && *is_first && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_certificate_t* previous = NULL;
+
+    result = cardano_certificate_set_get(certificates, i, &previous);
+    cardano_certificate_unref(&previous);
+
+    cardano_cert_type_t type = CARDANO_CERT_TYPE_STAKE_REGISTRATION;
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_cert_get_type(previous, &type);
+    }
+
+    if ((result == CARDANO_SUCCESS) && (type == CARDANO_CERT_TYPE_POOL_REGISTRATION))
+    {
+      cardano_blake2b_hash_t* previous_operator_key_hash = NULL;
+
+      result    = _cardano_get_pool_operator_key_hash(previous, &previous_operator_key_hash);
+      *is_first = !cardano_blake2b_hash_equals(operator_key_hash, previous_operator_key_hash);
+
+      cardano_blake2b_hash_unref(&previous_operator_key_hash);
+    }
+  }
+
+  cardano_blake2b_hash_unref(&operator_key_hash);
+
+  return result;
+}
+
+/**
+ * \brief Accumulates the deposits and refunds of the Shelley era certificates into the implicit coin.
+ *
+ * Shelley era certificates do not carry their deposit, so the amounts are taken from the protocol parameters. A pool
+ * registration pays the pool deposit unless the same pool is registered earlier in the set, and a pool retirement
+ * reclaims nothing, as the ledger returns the pool deposit when the pool retires at an epoch boundary.
+ *
+ * \param[in]  certificates  The certificate set of the body, or NULL when the body has none.
+ * \param[in]  pool_deposit  The pool deposit from the protocol parameters.
+ * \param[in]  stake_deposit The stake key deposit from the protocol parameters.
+ * \param[out] implicit_coin The implicit coin accumulator to update.
+ *
+ * \return \ref CARDANO_SUCCESS if the deposits were accumulated, or an appropriate error code.
+ */
+static cardano_error_t
+compute_shelley_deposits(
+  cardano_certificate_set_t* certificates,
+  const uint64_t             pool_deposit,
+  const uint64_t             stake_deposit,
+  cardano_implicit_coin_t*   implicit_coin)
+{
+  const size_t size = cardano_certificate_set_get_length(certificates);
+
+  // Remark: For the case of deregistration (CARDANO_CERT_TYPE_STAKE_DEREGISTRATION) the code here is not entirely correct
+  // as we are assuming the current protocol parameters for the deposits where the same as the ones used when the certificates where issued.
+  // This is going to work for now, but to properly implement this we need a way to know when the certificate we are undoing was originally issued
+  // and get the protocol parameters for that epoch. However, these parameters in particular have never changed in mainnet and these certificates will be deprecated,
+  // so this is probably good for now.
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_certificate_t* certificate = NULL;
+
+    cardano_error_t result = cardano_certificate_set_get(certificates, i, &certificate);
+    cardano_certificate_unref(&certificate);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_cert_type_t type;
+
+    result = cardano_cert_get_type(certificate, &type);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    switch (type)
+    {
+      case CARDANO_CERT_TYPE_STAKE_REGISTRATION:
+      {
+        result = add_amount(&implicit_coin->deposits, stake_deposit);
+        break;
+      }
+      case CARDANO_CERT_TYPE_STAKE_DEREGISTRATION:
+      {
+        result = add_amount(&implicit_coin->reclaim_deposits, stake_deposit);
+        break;
+      }
+      case CARDANO_CERT_TYPE_POOL_REGISTRATION:
+      {
+        bool is_first = false;
+
+        result = is_first_pool_registration(certificates, i, certificate, &is_first);
+
+        if ((result == CARDANO_SUCCESS) && is_first)
+        {
+          result = add_amount(&implicit_coin->deposits, pool_deposit);
+        }
+
+        break;
+      }
+      default:
+      {
+        continue;
+      }
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Accumulates the deposits and refunds of the Conway era certificates and proposals into the implicit coin.
+ *
+ * Conway era certificates and governance proposals carry their own deposit amount.
+ *
+ * \param[in]  certificates        The certificate set of the body, or NULL when the body has none.
+ * \param[in]  proposal_procedures The proposal procedure set of the body, or NULL when the body has none.
+ * \param[out] implicit_coin       The implicit coin accumulator to update.
+ *
+ * \return \ref CARDANO_SUCCESS if the deposits were accumulated, or an appropriate error code.
+ */
+static cardano_error_t
+compute_conway_deposits(
+  cardano_certificate_set_t*        certificates,
+  cardano_proposal_procedure_set_t* proposal_procedures,
+  cardano_implicit_coin_t*          implicit_coin)
+{
+  const size_t size = cardano_certificate_set_get_length(certificates);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_certificate_t* certificate = NULL;
+
+    cardano_error_t result = cardano_certificate_set_get(certificates, i, &certificate);
+    cardano_certificate_unref(&certificate);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_cert_type_t type;
+
+    result = cardano_cert_get_type(certificate, &type);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    switch (type)
+    {
+      case CARDANO_CERT_TYPE_REGISTRATION:
+      {
+        cardano_registration_cert_t* registration = NULL;
+        result                                    = cardano_certificate_to_registration(certificate, &registration);
+        cardano_registration_cert_unref(&registration);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = add_amount(&implicit_coin->deposits, cardano_registration_cert_get_deposit(registration));
+
+        break;
+      }
+      case CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION:
+      {
+        cardano_stake_registration_delegation_cert_t* stake_registration = NULL;
+        result                                                           = cardano_certificate_to_stake_registration_delegation(certificate, &stake_registration);
+        cardano_stake_registration_delegation_cert_unref(&stake_registration);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = add_amount(&implicit_coin->deposits, cardano_stake_registration_delegation_cert_get_deposit(stake_registration));
+
+        break;
+      }
+      case CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION:
+      {
+        cardano_vote_registration_delegation_cert_t* vote_registration = NULL;
+        result                                                         = cardano_certificate_to_vote_registration_delegation(certificate, &vote_registration);
+        cardano_vote_registration_delegation_cert_unref(&vote_registration);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = add_amount(&implicit_coin->deposits, cardano_vote_registration_delegation_cert_get_deposit(vote_registration));
+
+        break;
+      }
+      case CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION:
+      {
+        cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration = NULL;
+        result                                                                     = cardano_certificate_to_stake_vote_registration_delegation(certificate, &stake_vote_registration);
+        cardano_stake_vote_registration_delegation_cert_unref(&stake_vote_registration);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = add_amount(&implicit_coin->deposits, cardano_stake_vote_registration_delegation_cert_get_deposit(stake_vote_registration));
+
+        break;
+      }
+      case CARDANO_CERT_TYPE_UNREGISTRATION:
+      {
+        cardano_unregistration_cert_t* unregistration = NULL;
+        result                                        = cardano_certificate_to_unregistration(certificate, &unregistration);
+        cardano_unregistration_cert_unref(&unregistration);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = add_amount(&implicit_coin->reclaim_deposits, cardano_unregistration_cert_get_deposit(unregistration));
+
+        break;
+      }
+      case CARDANO_CERT_TYPE_DREP_REGISTRATION:
+      {
+        cardano_register_drep_cert_t* register_drep = NULL;
+        result                                      = cardano_certificate_to_register_drep(certificate, &register_drep);
+        cardano_register_drep_cert_unref(&register_drep);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = add_amount(&implicit_coin->deposits, cardano_register_drep_cert_get_deposit(register_drep));
+
+        break;
+      }
+      case CARDANO_CERT_TYPE_DREP_UNREGISTRATION:
+      {
+        cardano_unregister_drep_cert_t* unregister_drep = NULL;
+        result                                          = cardano_certificate_to_unregister_drep(certificate, &unregister_drep);
+        cardano_unregister_drep_cert_unref(&unregister_drep);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = add_amount(&implicit_coin->reclaim_deposits, cardano_unregister_drep_cert_get_deposit(unregister_drep));
+
+        break;
+      }
+      default:
+      {
+        continue;
+      }
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  const size_t proposal_size = cardano_proposal_procedure_set_get_length(proposal_procedures);
+
+  for (size_t i = 0U; i < proposal_size; ++i)
+  {
+    cardano_proposal_procedure_t* proposal_procedure = NULL;
+
+    cardano_error_t result = cardano_proposal_procedure_set_get(proposal_procedures, i, &proposal_procedure);
+    cardano_proposal_procedure_unref(&proposal_procedure);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = add_amount(&implicit_coin->deposits, cardano_proposal_procedure_get_deposit(proposal_procedure));
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Computes the implicit coin from the certificates, withdrawals and proposals of a body.
+ *
+ * \param[in]  certificates        The certificate set of the body, or NULL when the body has none.
+ * \param[in]  withdrawals         The withdrawal map of the body, or NULL when the body has none.
+ * \param[in]  proposal_procedures The proposal procedure set of the body, or NULL when the body has none.
+ * \param[in]  protocol_params     The protocol parameters supplying the Shelley era deposit amounts.
+ * \param[out] implicit_coin       The implicit coin accumulator to update.
+ *
+ * \return \ref CARDANO_SUCCESS if the implicit coin was computed, or an appropriate error code.
+ */
+static cardano_error_t
+compute_implicit_coin(
+  cardano_certificate_set_t*        certificates,
+  cardano_withdrawal_map_t*         withdrawals,
+  cardano_proposal_procedure_set_t* proposal_procedures,
+  cardano_protocol_parameters_t*    protocol_params,
+  cardano_implicit_coin_t*          implicit_coin)
+{
+  const uint64_t pool_deposit  = cardano_protocol_parameters_get_pool_deposit(protocol_params);
+  const uint64_t stake_deposit = cardano_protocol_parameters_get_key_deposit(protocol_params);
+
+  cardano_error_t result = compute_withdrawals(withdrawals, implicit_coin);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = compute_shelley_deposits(certificates, pool_deposit, stake_deposit, implicit_coin);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = compute_conway_deposits(certificates, proposal_procedures, implicit_coin);
+
+  return result;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_compute_implicit_coin(
+  cardano_transaction_t*         tx,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_implicit_coin_t*       implicit_coin)
+{
+  if (tx == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (implicit_coin == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_certificate_set_t* certificates = cardano_transaction_body_get_certificates(body);
+  cardano_certificate_set_unref(&certificates);
+
+  cardano_withdrawal_map_t* withdrawals = cardano_transaction_body_get_withdrawals(body);
+  cardano_withdrawal_map_unref(&withdrawals);
+
+  cardano_proposal_procedure_set_t* proposal_procedures = cardano_transaction_body_get_proposal_procedures(body);
+  cardano_proposal_procedure_set_unref(&proposal_procedures);
+
+  return compute_implicit_coin(certificates, withdrawals, proposal_procedures, protocol_params, implicit_coin);
+}
+
+cardano_error_t
+cardano_compute_sub_transaction_implicit_coin(
+  cardano_sub_transaction_t*     sub_tx,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_implicit_coin_t*       implicit_coin)
+{
+  if (sub_tx == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (implicit_coin == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_sub_transaction_body_t* body = cardano_sub_transaction_get_body(sub_tx);
+  cardano_sub_transaction_body_unref(&body);
+
+  cardano_certificate_set_t* certificates = cardano_sub_transaction_body_get_certificates(body);
+  cardano_certificate_set_unref(&certificates);
+
+  cardano_withdrawal_map_t* withdrawals = cardano_sub_transaction_body_get_withdrawals(body);
+  cardano_withdrawal_map_unref(&withdrawals);
+
+  cardano_proposal_procedure_set_t* proposal_procedures = cardano_sub_transaction_body_get_proposal_procedures(body);
+  cardano_proposal_procedure_set_unref(&proposal_procedures);
+
+  return compute_implicit_coin(certificates, withdrawals, proposal_procedures, protocol_params, implicit_coin);
+}
diff --git a/vendor/src/transaction_builder/balancing/input_to_redeemer_map.c b/vendor/src/transaction_builder/balancing/input_to_redeemer_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/input_to_redeemer_map.c
@@ -0,0 +1,544 @@
+/**
+ * \file input_to_redeemer_map.c
+ *
+ * \author angel.castillo
+ * \date   Nov 11, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/transaction_builder/balancing/input_to_redeemer_map.h>
+
+#include "../../allocators.h"
+#include "../../collections/array.h"
+#include <assert.h>
+#include <cardano/object.h>
+#include <cardano/transaction_body/transaction_input.h>
+#include <cardano/witness_set/redeemer.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano input to redeemer input_to_redeemer_map.
+ */
+typedef struct cardano_input_to_redeemer_map_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_input_to_redeemer_map_t;
+
+/**
+ * \brief Represents a Cardano input to redeemer input_to_redeemer_map key value pair.
+ */
+typedef struct cardano_input_to_redeemer_map_kvp_t
+{
+    cardano_object_t             base;
+    cardano_transaction_input_t* key;
+    cardano_redeemer_t*          value;
+} cardano_input_to_redeemer_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates the input_to_redeemer_map.
+ *
+ * This function is responsible for properly deallocating a input to redeemer input_to_redeemer_map (`cardano_input_to_redeemer_map_t`)
+ * and its associated resources.
+ *
+ * \param input A void pointer to the input_to_redeemer_map input to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_input_to_redeemer_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the input_to_redeemer_map
+ *       input reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these reward addresses.
+ */
+static void
+cardano_input_to_redeemer_map_deallocate(void* input)
+{
+  assert(input != NULL);
+
+  cardano_input_to_redeemer_map_t* input_to_redeemer_map = (cardano_input_to_redeemer_map_t*)input;
+
+  if (input_to_redeemer_map->array != NULL)
+  {
+    cardano_array_unref(&input_to_redeemer_map->array);
+  }
+
+  _cardano_free(input_to_redeemer_map);
+}
+
+/**
+ * \brief Deallocates a reward address to redeemer input_to_redeemer_map key value pair.
+ *
+ * This function is responsible for properly deallocating a input to redeemer input_to_redeemer_map key value pair (`cardano_input_to_redeemer_map_kvp_t`)
+ * and its associated resources.
+ *
+ * \param input A void pointer to the input_to_redeemer_map input to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_input_to_redeemer_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the input_to_redeemer_map
+ *       input reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_input_to_redeemer_map_kvp_deallocate(void* input)
+{
+  assert(input != NULL);
+
+  cardano_input_to_redeemer_map_kvp_t* input_to_redeemer_map = (cardano_input_to_redeemer_map_kvp_t*)input;
+
+  cardano_transaction_input_unref(&input_to_redeemer_map->key);
+  cardano_redeemer_unref(&input_to_redeemer_map->value);
+
+  _cardano_free(input_to_redeemer_map);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_input_to_redeemer_map_new(cardano_input_to_redeemer_map_t** input_to_redeemer_map)
+{
+  if (input_to_redeemer_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *input_to_redeemer_map = _cardano_malloc(sizeof(cardano_input_to_redeemer_map_t));
+
+  if ((*input_to_redeemer_map) == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*input_to_redeemer_map)->base.ref_count     = 1;
+  (*input_to_redeemer_map)->base.last_error[0] = '\0';
+  (*input_to_redeemer_map)->base.deallocator   = cardano_input_to_redeemer_map_deallocate;
+
+  (*input_to_redeemer_map)->array = cardano_array_new(32);
+
+  if ((*input_to_redeemer_map)->array == NULL)
+  {
+    _cardano_free((*input_to_redeemer_map));
+    *input_to_redeemer_map = NULL;
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_input_to_redeemer_map_get_length(const cardano_input_to_redeemer_map_t* input_to_redeemer_map)
+{
+  if (input_to_redeemer_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(input_to_redeemer_map->array);
+}
+
+cardano_error_t
+cardano_input_to_redeemer_map_get(
+  cardano_input_to_redeemer_map_t*   input_to_redeemer_map,
+  const cardano_transaction_input_t* key,
+  cardano_redeemer_t**               element)
+{
+  if (input_to_redeemer_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(input_to_redeemer_map->array); ++i)
+  {
+    cardano_object_t*                    object = cardano_array_get(input_to_redeemer_map->array, i);
+    cardano_input_to_redeemer_map_kvp_t* kvp    = (cardano_input_to_redeemer_map_kvp_t*)((void*)object);
+
+    if (cardano_transaction_input_equals(kvp->key, key))
+    {
+      cardano_redeemer_ref(kvp->value);
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_input_to_redeemer_map_insert(
+  cardano_input_to_redeemer_map_t* input_to_redeemer_map,
+  cardano_transaction_input_t*     key,
+  cardano_redeemer_t*              value)
+{
+  if (input_to_redeemer_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_input_to_redeemer_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_input_to_redeemer_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_input_to_redeemer_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_transaction_input_ref(key);
+  cardano_redeemer_ref(value);
+
+  const size_t old_size = cardano_array_get_size(input_to_redeemer_map->array);
+  const size_t new_size = cardano_array_push(input_to_redeemer_map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_input_to_redeemer_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_input_to_redeemer_map_get_key_at(
+  const cardano_input_to_redeemer_map_t* input_to_redeemer_map,
+  const size_t                           index,
+  cardano_transaction_input_t**          input)
+{
+  if (input_to_redeemer_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(input_to_redeemer_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                    object = cardano_array_get(input_to_redeemer_map->array, index);
+  cardano_input_to_redeemer_map_kvp_t* kvp    = (cardano_input_to_redeemer_map_kvp_t*)((void*)object);
+
+  cardano_transaction_input_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *input = kvp->key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_input_to_redeemer_map_get_value_at(
+  const cardano_input_to_redeemer_map_t* input_to_redeemer_map,
+  size_t                                 index,
+  cardano_redeemer_t**                   redeemer)
+{
+  if (input_to_redeemer_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (redeemer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(input_to_redeemer_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                    object = cardano_array_get(input_to_redeemer_map->array, index);
+  cardano_input_to_redeemer_map_kvp_t* kvp    = (cardano_input_to_redeemer_map_kvp_t*)((void*)object);
+
+  cardano_object_unref(&object);
+
+  cardano_redeemer_ref(kvp->value);
+  *redeemer = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_input_to_redeemer_map_get_key_value_at(
+  const cardano_input_to_redeemer_map_t* input_to_redeemer_map,
+  size_t                                 index,
+  cardano_transaction_input_t**          input,
+  cardano_redeemer_t**                   redeemer)
+{
+  if (input_to_redeemer_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (redeemer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(input_to_redeemer_map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                    object = cardano_array_get(input_to_redeemer_map->array, index);
+  cardano_input_to_redeemer_map_kvp_t* kvp    = (cardano_input_to_redeemer_map_kvp_t*)((void*)object);
+
+  cardano_transaction_input_ref(kvp->key);
+  cardano_redeemer_ref(kvp->value);
+  cardano_object_unref(&object);
+
+  *input    = kvp->key;
+  *redeemer = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_input_to_redeemer_map_unref(cardano_input_to_redeemer_map_t** input_to_redeemer_map)
+{
+  if ((input_to_redeemer_map == NULL) || (*input_to_redeemer_map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*input_to_redeemer_map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *input_to_redeemer_map = NULL;
+    return;
+  }
+}
+
+cardano_error_t
+cardano_input_to_redeemer_map_update_redeemer_index(
+  cardano_input_to_redeemer_map_t* input_to_redeemer_map,
+  cardano_transaction_input_t*     input,
+  const uint64_t                   index)
+{
+  if (input_to_redeemer_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (input == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_redeemer_t* redeemer = NULL;
+  cardano_error_t     result   = cardano_input_to_redeemer_map_get(input_to_redeemer_map, input, &redeemer);
+  cardano_redeemer_unref(&redeemer);
+
+  if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  result = cardano_redeemer_set_index(redeemer, index);
+
+  return result;
+}
+
+void
+cardano_input_to_redeemer_map_ref(cardano_input_to_redeemer_map_t* input_to_redeemer_map)
+{
+  if (input_to_redeemer_map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&input_to_redeemer_map->base);
+}
+
+size_t
+cardano_input_to_redeemer_map_refcount(const cardano_input_to_redeemer_map_t* input_to_redeemer_map)
+{
+  if (input_to_redeemer_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&input_to_redeemer_map->base);
+}
+
+void
+cardano_input_to_redeemer_map_set_last_error(cardano_input_to_redeemer_map_t* input_to_redeemer_map, const char* message)
+{
+  cardano_object_set_last_error(&input_to_redeemer_map->base, message);
+}
+
+const char*
+cardano_input_to_redeemer_map_get_last_error(const cardano_input_to_redeemer_map_t* input_to_redeemer_map)
+{
+  return cardano_object_get_last_error(&input_to_redeemer_map->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_input_to_redeemer_map_kvp_deep_clone(const cardano_input_to_redeemer_map_kvp_t* source, cardano_input_to_redeemer_map_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_input_to_redeemer_map_kvp_t* copy = _cardano_malloc(sizeof(cardano_input_to_redeemer_map_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = NULL;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_transaction_input_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_redeemer_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_input_to_redeemer_map_kvp_t* copy   = NULL;
+  const cardano_error_t                result = cardano_input_to_redeemer_map_kvp_deep_clone((const cardano_input_to_redeemer_map_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_input_to_redeemer_map_deep_clone(const cardano_input_to_redeemer_map_t* source, cardano_input_to_redeemer_map_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_input_to_redeemer_map_t* copy = _cardano_malloc(sizeof(cardano_input_to_redeemer_map_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_builder/balancing/internals/collateral.c b/vendor/src/transaction_builder/balancing/internals/collateral.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/internals/collateral.c
@@ -0,0 +1,530 @@
+/**
+ * \file collateral.c
+ *
+ * \author angel.castillo
+ * \date   Nov 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "collateral.h"
+
+#include <cardano/common/utxo.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+#include <cardano/transaction_builder/coin_selection/large_first_coin_selector.h>
+
+#include <cardano/transaction_builder/fee.h>
+
+#include <assert.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Sets the last error of a transaction to describe collateral that the collateral UTXOs can not cover.
+ *
+ * \param[in,out] tx                The transaction that receives the error message.
+ * \param[in]     collateral_amount The collateral the transaction requires, in lovelace.
+ * \param[in]     available_utxos   The UTXOs available as collateral.
+ */
+static void
+set_insufficient_collateral_error(
+  cardano_transaction_t* tx,
+  const uint64_t         collateral_amount,
+  cardano_utxo_list_t*   available_utxos)
+{
+  cardano_value_t* available_value = NULL;
+  int64_t          available_coin  = 0;
+
+  if (_cardano_coalesce_all_utxos(available_utxos, &available_value) == CARDANO_SUCCESS)
+  {
+    available_coin = cardano_value_get_coin(available_value);
+  }
+
+  cardano_value_unref(&available_value);
+
+  char buffer[256] = { 0 };
+
+  const int32_t written = snprintf(
+    buffer,
+    sizeof(buffer),
+    "The transaction requires %" PRIu64 " lovelace of collateral, plus the min-ADA of the collateral return, but the collateral UTXOs hold %" PRId64 " lovelace.",
+    collateral_amount,
+    available_coin);
+
+  assert(written > 0);
+  CARDANO_UNUSED(written);
+
+  cardano_transaction_set_last_error(tx, buffer);
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+_cardano_coalesce_all_utxos(cardano_utxo_list_t* utxos, cardano_value_t** total_output_value)
+{
+  const size_t num_utxos = cardano_utxo_list_get_length(utxos);
+
+  cardano_value_t* total_value = cardano_value_new_zero();
+
+  if (total_value == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (size_t i = 0U; i < num_utxos; ++i)
+  {
+    cardano_utxo_t* utxo   = NULL;
+    cardano_error_t result = cardano_utxo_list_get(utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&total_value);
+      return result;
+    }
+
+    cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+    cardano_value_t*              value  = cardano_transaction_output_get_value(output);
+
+    cardano_transaction_output_unref(&output);
+    cardano_value_unref(&value);
+
+    cardano_value_t* tmp_value = NULL;
+
+    result = cardano_value_add(total_value, value, &tmp_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&tmp_value);
+      cardano_value_unref(&total_value);
+
+      return result;
+    }
+
+    cardano_value_unref(&total_value);
+    total_value = tmp_value;
+  }
+
+  *total_output_value = total_value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_transaction_input_set_t*
+_cardano_utxo_list_to_input_set(cardano_utxo_list_t* utxos)
+{
+  cardano_transaction_input_set_t* inputs = NULL;
+  cardano_error_t                  result = cardano_transaction_input_set_new(&inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  const size_t num_utxos = cardano_utxo_list_get_length(utxos);
+
+  for (size_t i = 0U; i < num_utxos; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+    result               = cardano_utxo_list_get(utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_input_set_unref(&inputs);
+
+      return NULL;
+    }
+
+    cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+    cardano_transaction_input_unref(&input);
+
+    result = cardano_transaction_input_set_add(inputs, input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_input_set_unref(&inputs);
+
+      return NULL;
+    }
+  }
+
+  return inputs;
+}
+
+cardano_error_t
+_cardano_calculate_collateral_amount(
+  const uint64_t fee,
+  const uint64_t collateral_percentage,
+  uint64_t*      collateral_amount)
+{
+  const uint64_t hundreds  = fee / 100U;
+  const uint64_t remainder = fee % 100U;
+
+  if ((collateral_percentage != 0U) && (hundreds > (UINT64_MAX / collateral_percentage)))
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  if ((collateral_percentage != 0U) && (remainder > (UINT64_MAX / collateral_percentage)))
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  const uint64_t whole_part        = hundreds * collateral_percentage;
+  const uint64_t remainder_product = remainder * collateral_percentage;
+  const uint64_t remainder_part    = (remainder_product / 100U) + (((remainder_product % 100U) != 0U) ? 1U : 0U);
+
+  if ((whole_part > (uint64_t)INT64_MAX) || (remainder_part > ((uint64_t)INT64_MAX - whole_part)))
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  *collateral_amount = whole_part + remainder_part;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_create_collateral_change_output(
+  cardano_value_t*               change_value,
+  cardano_address_t*             change_address,
+  cardano_protocol_parameters_t* protocol_params,
+  uint64_t*                      change_padding,
+  cardano_transaction_output_t** change_output)
+{
+  cardano_error_t result;
+  *change_output = NULL;
+
+  if (!cardano_value_is_zero(change_value))
+  {
+    result = cardano_transaction_output_new(change_address, 0, change_output);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_transaction_output_set_value(*change_output, change_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_unref(change_output);
+
+      return result;
+    }
+
+    const uint64_t ada_per_utxo_byte = cardano_protocol_parameters_get_ada_per_utxo_byte(protocol_params);
+    uint64_t       min_utxo_value    = 0U;
+    result                           = cardano_compute_min_ada_required(*change_output, ada_per_utxo_byte, &min_utxo_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_unref(change_output);
+
+      return result;
+    }
+
+    const uint64_t change_coin = cardano_value_get_coin(change_value);
+
+    if (change_coin < min_utxo_value)
+    {
+      *change_padding += min_utxo_value - change_coin;
+      cardano_transaction_output_unref(change_output);
+      *change_output = NULL;
+
+      return CARDANO_ERROR_BALANCE_INSUFFICIENT;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_update_transaction_body_collateral(
+  cardano_transaction_body_t*   body,
+  const uint64_t                collateral_amount,
+  cardano_transaction_output_t* change_output,
+  cardano_utxo_list_t*          selection)
+{
+  cardano_error_t result;
+
+  result = cardano_transaction_body_set_total_collateral(body, &collateral_amount);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (change_output != NULL)
+  {
+    result = cardano_transaction_body_set_collateral_return(body, change_output);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  cardano_transaction_input_set_t* collateral_inputs = _cardano_utxo_list_to_input_set(selection);
+
+  result = cardano_transaction_body_set_collateral(body, collateral_inputs);
+  cardano_transaction_input_set_unref(&collateral_inputs);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_is_collateral_required(cardano_transaction_t* tx, bool* is_required)
+{
+  if ((tx == NULL) || (is_required == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_witness_set_t* witnesses = cardano_transaction_get_witness_set(tx);
+  cardano_witness_set_unref(&witnesses);
+
+  cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witnesses);
+  cardano_redeemer_list_unref(&redeemers);
+
+  bool found = cardano_redeemer_list_get_length(redeemers) > 0U;
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_sub_transaction_set_t* sub_transactions = cardano_transaction_body_get_sub_transactions(body);
+  cardano_sub_transaction_set_unref(&sub_transactions);
+
+  const size_t num_sub_transactions = cardano_sub_transaction_set_get_length(sub_transactions);
+
+  for (size_t i = 0U; (i < num_sub_transactions) && !found; ++i)
+  {
+    cardano_sub_transaction_t* sub_tx = NULL;
+
+    const cardano_error_t result = cardano_sub_transaction_set_get(sub_transactions, i, &sub_tx);
+    cardano_sub_transaction_unref(&sub_tx);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_witness_set_t* sub_tx_witnesses = cardano_sub_transaction_get_witness_set(sub_tx);
+    cardano_witness_set_unref(&sub_tx_witnesses);
+
+    cardano_redeemer_list_t* sub_tx_redeemers = cardano_witness_set_get_redeemers(sub_tx_witnesses);
+    cardano_redeemer_list_unref(&sub_tx_redeemers);
+
+    found = cardano_redeemer_list_get_length(sub_tx_redeemers) > 0U;
+  }
+
+  *is_required = found;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_set_collateral_output(
+  cardano_transaction_t*         tx,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_utxo_list_t*           available_collateral_outputs,
+  cardano_address_t*             change_address)
+{
+  if ((tx == NULL) || (protocol_params == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t collateral_count = cardano_utxo_list_get_length(available_collateral_outputs);
+
+  bool is_collateral_required = false;
+
+  cardano_error_t result = _cardano_is_collateral_required(tx, &is_collateral_required);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (!is_collateral_required)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  if (collateral_count == 0U)
+  {
+    cardano_transaction_set_last_error(tx, "The transaction requires collateral, but no collateral UTXOs were given.");
+
+    return CARDANO_ERROR_BALANCE_INSUFFICIENT;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  const uint64_t fee                   = cardano_transaction_body_get_fee(body);
+  const uint64_t collateral_percentage = cardano_protocol_parameters_get_collateral_percentage(protocol_params);
+  uint64_t       collateral_amount     = 0U;
+  uint64_t       change_padding        = 0U;
+  bool           is_balanced           = false;
+
+  result = _cardano_calculate_collateral_amount(fee, collateral_percentage, &collateral_amount);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_set_last_error(tx, "The collateral the fee of the transaction requires exceeds the maximum amount the balancer can represent.");
+
+    return result;
+  }
+
+  cardano_coin_selector_t* coin_selector = NULL;
+
+  result = cardano_large_first_coin_selector_new(&coin_selector);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  while (!is_balanced)
+  {
+    if (change_padding > ((uint64_t)INT64_MAX - collateral_amount))
+    {
+      cardano_transaction_set_last_error(tx, "The collateral the fee of the transaction requires exceeds the maximum amount the balancer can represent.");
+      cardano_coin_selector_unref(&coin_selector);
+
+      return CARDANO_ERROR_INTEGER_OVERFLOW;
+    }
+
+    const uint64_t                     total_collateral       = collateral_amount + change_padding;
+    cardano_value_t*                   collateral_value       = cardano_value_new_from_coin((int64_t)total_collateral);
+    cardano_utxo_list_t*               selection              = NULL;
+    cardano_utxo_list_t*               remaining_utxo         = NULL;
+    cardano_transaction_output_list_t* selector_change_output = NULL;
+
+    cardano_coin_selection_request_t request = { 0 };
+
+    request.available_utxo  = available_collateral_outputs;
+    request.target          = collateral_value;
+    request.change_address  = change_address;
+    request.protocol_params = protocol_params;
+
+    result = cardano_coin_selector_select(
+      coin_selector,
+      &request,
+      &selection,
+      &remaining_utxo,
+      &selector_change_output);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      if (result == CARDANO_ERROR_BALANCE_INSUFFICIENT)
+      {
+        set_insufficient_collateral_error(tx, total_collateral, available_collateral_outputs);
+      }
+
+      cardano_value_unref(&collateral_value);
+      cardano_coin_selector_unref(&coin_selector);
+      return result;
+    }
+
+    cardano_transaction_output_list_unref(&selector_change_output);
+
+    cardano_value_t* selected_input_value = NULL;
+    result                                = _cardano_coalesce_all_utxos(selection, &selected_input_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&collateral_value);
+      cardano_utxo_list_unref(&selection);
+      cardano_utxo_list_unref(&remaining_utxo);
+      cardano_coin_selector_unref(&coin_selector);
+      return result;
+    }
+
+    cardano_value_t* change_value = NULL;
+    result                        = cardano_value_subtract(selected_input_value, collateral_value, &change_value);
+    cardano_value_unref(&selected_input_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&collateral_value);
+      cardano_value_unref(&change_value);
+      cardano_utxo_list_unref(&selection);
+      cardano_utxo_list_unref(&remaining_utxo);
+      cardano_coin_selector_unref(&coin_selector);
+
+      return result;
+    }
+
+    cardano_transaction_output_t* change_output = NULL;
+    result                                      = _cardano_create_collateral_change_output(change_value, change_address, protocol_params, &change_padding, &change_output);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&collateral_value);
+      cardano_value_unref(&change_value);
+      cardano_utxo_list_unref(&selection);
+      cardano_utxo_list_unref(&remaining_utxo);
+
+      if (result == CARDANO_ERROR_BALANCE_INSUFFICIENT)
+      {
+        continue;
+      }
+
+      cardano_coin_selector_unref(&coin_selector);
+      return result;
+    }
+
+    result = _cardano_update_transaction_body_collateral(body, total_collateral, change_output, selection);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      if (change_output != NULL)
+      {
+        cardano_transaction_output_unref(&change_output);
+      }
+
+      cardano_value_unref(&collateral_value);
+      cardano_value_unref(&change_value);
+      cardano_utxo_list_unref(&selection);
+      cardano_utxo_list_unref(&remaining_utxo);
+      cardano_coin_selector_unref(&coin_selector);
+
+      return result;
+    }
+
+    if (change_output != NULL)
+    {
+      cardano_transaction_output_unref(&change_output);
+    }
+
+    cardano_value_unref(&collateral_value);
+    cardano_value_unref(&change_value);
+    cardano_utxo_list_unref(&selection);
+    cardano_utxo_list_unref(&remaining_utxo);
+
+    is_balanced = true;
+  }
+
+  cardano_coin_selector_unref(&coin_selector);
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_builder/balancing/internals/collateral.h b/vendor/src/transaction_builder/balancing/internals/collateral.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/internals/collateral.h
@@ -0,0 +1,166 @@
+/**
+ * \file collateral.h
+ *
+ * \author angel.castillo
+ * \date   Nov 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_COLLATERAL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_COLLATERAL_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/protocol_params/protocol_parameters.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Coalesces all output values in a UTXO list into a single total value.
+ *
+ * This function iterates over each UTXO in the provided list, extracts its value,
+ * and accumulates it into a single total output value.
+ *
+ * \param[in]  utxos               The list of UTXO to coalesce.
+ * \param[out] total_output_value  A pointer to store the cumulative value of all UTXO.
+ *
+ * \return \ref CARDANO_SUCCESS if the total UTXO value was successfully calculated, or an appropriate error code.
+ */
+cardano_error_t
+_cardano_coalesce_all_utxos(cardano_utxo_list_t* utxos, cardano_value_t** total_output_value);
+
+/**
+ * \brief Converts a list of UTXOs to a set of transaction inputs.
+ *
+ * This function takes a list of UTXOs and converts it into a \ref cardano_transaction_input_set_t.
+ *
+ * \param[in] utxos A pointer to the \ref cardano_utxo_list_t containing the UTXOs to be converted.
+ *
+ * \return A pointer to a \ref cardano_transaction_input_set_t containing the transaction inputs created
+ *         from the UTXO list. Returns NULL if the conversion fails.
+ */
+cardano_transaction_input_set_t*
+_cardano_utxo_list_to_input_set(cardano_utxo_list_t* utxos);
+
+/**
+ * \brief Calculates the collateral amount required for a transaction based on the transaction fee and collateral percentage.
+ *
+ * The ledger requires the balance of the collateral times 100 to be at least the fee times the collateral percentage, so
+ * the collateral amount is the fee times the collateral percentage over 100, rounded up, computed in integer arithmetic.
+ * A zero fee or a zero percentage requires no collateral amount.
+ *
+ * \param[in]  fee                   The transaction fee in lovelace.
+ * \param[in]  collateral_percentage The collateral percentage as an integer. For example, a 150% collateral would be passed as 150.
+ * \param[out] collateral_amount     The calculated collateral amount in lovelace. It is only written on success.
+ *
+ * \return \ref CARDANO_SUCCESS if the amount was calculated, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if it exceeds the largest
+ *         coin a value can hold.
+ */
+cardano_error_t
+_cardano_calculate_collateral_amount(uint64_t fee, uint64_t collateral_percentage, uint64_t* collateral_amount);
+
+/**
+ * \brief Creates a collateral change output for a transaction.
+ *
+ * \param[in]  change_value       The change amount in \ref cardano_value_t format.
+ * \param[in]  change_address     A pointer to the \ref cardano_address_t representing the change address.
+ * \param[in]  protocol_params    A pointer to the \ref cardano_protocol_parameters_t containing relevant protocol parameters.
+ * \param[out] change_padding     If the change output cant be created, the missing value to reach the minimum UTXO value will be set here.
+ * \param[out] change_output      On success, this will point to the created \ref cardano_transaction_output_t.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the collateral change
+ *         output was created successfully, or an appropriate error code indicating the failure reason.
+ */
+cardano_error_t
+_cardano_create_collateral_change_output(
+  cardano_value_t*               change_value,
+  cardano_address_t*             change_address,
+  cardano_protocol_parameters_t* protocol_params,
+  uint64_t*                      change_padding,
+  cardano_transaction_output_t** change_output);
+
+/**
+ * \brief Updates the transaction body with collateral inputs and collateral change output.
+ *
+ * This function updates a transaction body by setting the collateral amount and adding the specified
+ * collateral change output. It also includes a selection of collateral inputs that will satisfy the collateral requirement.
+ *
+ * \param[in,out] body              A pointer to the \ref cardano_transaction_body_t to be updated.
+ * \param[in]     collateral_amount The amount required as collateral.
+ * \param[in]     change_output     A pointer to the \ref cardano_transaction_output_t representing the collateral change output.
+ * \param[in]     selection         A list of selected UTXOs to be used as collateral inputs.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the transaction body was
+ *         successfully updated with the collateral details, or an appropriate error code indicating the failure reason.
+ */
+cardano_error_t
+_cardano_update_transaction_body_collateral(
+  cardano_transaction_body_t*   body,
+  uint64_t                      collateral_amount,
+  cardano_transaction_output_t* change_output,
+  cardano_utxo_list_t*          selection);
+
+/**
+ * \brief Checks whether a transaction must post collateral.
+ *
+ * Collateral is only posted by the top level transaction and covers the whole batch, so it is required when a redeemer
+ * exists in the witness set of the transaction or in the witness set of any of the sub transactions it carries.
+ *
+ * \param[in]  tx          A pointer to the \ref cardano_transaction_t to inspect.
+ * \param[out] is_required Set to true if the transaction or one of its sub transactions carries a redeemer.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction was inspected, or an appropriate error code.
+ */
+cardano_error_t
+_cardano_is_collateral_required(cardano_transaction_t* tx, bool* is_required);
+
+/**
+ * \brief Sets the collateral output in a Cardano transaction.
+ *
+ * This function selects collateral outputs from a list of available collateral UTXOs to meet the required collateral amount
+ * for the transaction. If the total collateral exceeds the required amount, a change collateral output is created and added to the transaction.
+ *
+ * Collateral is set when the transaction or any of the sub transactions it carries has redeemers, and it is sized from the
+ * fee of the transaction, which pays for the whole batch. The UTXOs are selected for that fee alone, so a transaction
+ * whose fee is not known yet selects at least one UTXO and selects again once its fee is computed.
+ *
+ * The total collateral of the transaction is always the lovelace of the collateral inputs minus the lovelace of the
+ * collateral return, so it includes any lovelace selected to raise the collateral return to its min-ADA.
+ *
+ * When the collateral can not be selected because the collateral UTXOs are missing or do not cover it, the last error
+ * of \p tx describes the shortfall.
+ *
+ * \param[in,out] tx                           A pointer to the \ref cardano_transaction_t where the collateral output will be set.
+ * \param[in]     protocol_params              A pointer to the \ref cardano_protocol_parameters_t containing protocol parameters for collateral calculations.
+ * \param[in]     available_collateral_outputs A list of available UTXOs that can be used for collateral.
+ * \param[in]     change_address               A pointer to the \ref cardano_address_t where any collateral change will be sent.
+ *
+ * \return \c cardano_error_t indicating the outcome of the operation. Returns \c CARDANO_SUCCESS if the collateral output was
+ *         successfully set or no collateral is required, \c CARDANO_ERROR_BALANCE_INSUFFICIENT if collateral is required and
+ *         \p available_collateral_outputs is NULL or empty, or an appropriate error code indicating the failure reason.
+ */
+cardano_error_t
+_cardano_set_collateral_output(
+  cardano_transaction_t*         tx,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_utxo_list_t*           available_collateral_outputs,
+  cardano_address_t*             change_address);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_COLLATERAL_H
diff --git a/vendor/src/transaction_builder/balancing/internals/pool_deposits.c b/vendor/src/transaction_builder/balancing/internals/pool_deposits.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/internals/pool_deposits.c
@@ -0,0 +1,221 @@
+/**
+ * \file pool_deposits.c
+ *
+ * \author angel.castillo
+ * \date   Nov 02, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "pool_deposits.h"
+
+#include "unique_signers.h"
+
+#include <cardano/certs/pool_registration_cert.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Records a pool registered by a body and counts it if another body of the batch already registers it.
+ *
+ * \param[in,out] body_pools        The operator key hashes of the pools the body registers in the certificates
+ *                                  inspected so far.
+ * \param[in,out] batch_pools       The operator key hashes of the pools the batch registers in the bodies inspected
+ *                                  so far.
+ * \param[in]     operator_key_hash The operator key hash of the registered pool.
+ * \param[in,out] count             The running count of pool deposits counted more than once.
+ *
+ * \return \ref CARDANO_SUCCESS if the pool was recorded, or an appropriate error code.
+ */
+static cardano_error_t
+add_pool_registration(
+  cardano_blake2b_hash_set_t* body_pools,
+  cardano_blake2b_hash_set_t* batch_pools,
+  cardano_blake2b_hash_t*     operator_key_hash,
+  uint64_t*                   count)
+{
+  if (_cardano_blake2b_hash_set_has(body_pools, operator_key_hash))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_error_t result = cardano_blake2b_hash_set_add(body_pools, operator_key_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (_cardano_blake2b_hash_set_has(batch_pools, operator_key_hash))
+  {
+    ++(*count);
+
+    return CARDANO_SUCCESS;
+  }
+
+  return cardano_blake2b_hash_set_add(batch_pools, operator_key_hash);
+}
+
+/**
+ * \brief Records the pools a body registers and counts the ones another body of the batch already registers.
+ *
+ * \param[in]     certificates The certificates of the body, or NULL when it has none.
+ * \param[in,out] batch_pools  The operator key hashes of the pools the bodies inspected so far register. The pools of
+ *                             this body are added to it.
+ * \param[in,out] count        The running count of pool deposits counted more than once.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificates were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+add_body_pool_registrations(
+  cardano_certificate_set_t*  certificates,
+  cardano_blake2b_hash_set_t* batch_pools,
+  uint64_t*                   count)
+{
+  cardano_blake2b_hash_set_t* body_pools = NULL;
+
+  cardano_error_t result = cardano_blake2b_hash_set_new(&body_pools);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const size_t size = cardano_certificate_set_get_length(certificates);
+
+  for (size_t i = 0U; (i < size) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_certificate_t* certificate = NULL;
+
+    result = cardano_certificate_set_get(certificates, i, &certificate);
+    cardano_certificate_unref(&certificate);
+
+    cardano_cert_type_t type = CARDANO_CERT_TYPE_STAKE_REGISTRATION;
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_cert_get_type(certificate, &type);
+    }
+
+    if ((result == CARDANO_SUCCESS) && (type == CARDANO_CERT_TYPE_POOL_REGISTRATION))
+    {
+      cardano_blake2b_hash_t* operator_key_hash = NULL;
+
+      result = _cardano_get_pool_operator_key_hash(certificate, &operator_key_hash);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = add_pool_registration(body_pools, batch_pools, operator_key_hash, count);
+      }
+
+      cardano_blake2b_hash_unref(&operator_key_hash);
+    }
+  }
+
+  cardano_blake2b_hash_set_unref(&body_pools);
+
+  return result;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+_cardano_get_pool_operator_key_hash(
+  cardano_certificate_t*   certificate,
+  cardano_blake2b_hash_t** operator_key_hash)
+{
+  cardano_pool_registration_cert_t* registration = NULL;
+
+  cardano_error_t result = cardano_certificate_to_pool_registration(certificate, &registration);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_pool_params_t* params = NULL;
+
+  result = cardano_pool_registration_cert_get_params(registration, &params);
+  cardano_pool_registration_cert_unref(&registration);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_pool_params_get_operator_key_hash(params, operator_key_hash);
+  cardano_pool_params_unref(&params);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_count_repeated_pool_deposits(
+  cardano_certificate_set_t*     certificates,
+  cardano_sub_transaction_set_t* sub_transactions,
+  uint64_t*                      count)
+{
+  if (count == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_set_t* batch_pools = NULL;
+
+  cardano_error_t result = cardano_blake2b_hash_set_new(&batch_pools);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  uint64_t repeated = 0U;
+
+  result = add_body_pool_registrations(certificates, batch_pools, &repeated);
+
+  const size_t num_sub_transactions = cardano_sub_transaction_set_get_length(sub_transactions);
+
+  for (size_t i = 0U; (i < num_sub_transactions) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_sub_transaction_t* sub_tx = NULL;
+
+    result = cardano_sub_transaction_set_get(sub_transactions, i, &sub_tx);
+    cardano_sub_transaction_unref(&sub_tx);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_sub_transaction_body_t* body = cardano_sub_transaction_get_body(sub_tx);
+      cardano_sub_transaction_body_unref(&body);
+
+      cardano_certificate_set_t* sub_certificates = cardano_sub_transaction_body_get_certificates(body);
+      cardano_certificate_set_unref(&sub_certificates);
+
+      result = add_body_pool_registrations(sub_certificates, batch_pools, &repeated);
+    }
+  }
+
+  cardano_blake2b_hash_set_unref(&batch_pools);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *count = repeated;
+  }
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/balancing/internals/pool_deposits.h b/vendor/src/transaction_builder/balancing/internals/pool_deposits.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/internals/pool_deposits.h
@@ -0,0 +1,73 @@
+/**
+ * \file pool_deposits.h
+ *
+ * \author angel.castillo
+ * \date   Nov 02, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_POOL_DEPOSITS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_POOL_DEPOSITS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/certificate.h>
+#include <cardano/certs/certificate_set.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Gets the key hash of the operator of the pool a pool registration certificate registers.
+ *
+ * The operator key hash identifies the pool: two registrations with the same operator key hash register the same pool.
+ *
+ * \param[in]  certificate       The pool registration certificate.
+ * \param[out] operator_key_hash On success, the key hash of the pool operator. The caller must release it with
+ *                               \ref cardano_blake2b_hash_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the operator key hash was retrieved, \ref CARDANO_ERROR_INVALID_CERTIFICATE_TYPE if the
+ *         certificate is not a pool registration, or an appropriate error code.
+ */
+cardano_error_t
+_cardano_get_pool_operator_key_hash(
+  cardano_certificate_t*   certificate,
+  cardano_blake2b_hash_t** operator_key_hash);
+
+/**
+ * \brief Counts the pool deposits that charging each body of a CIP-118 batch on its own counts more than once.
+ *
+ * Each body charges the pool deposit once per pool it registers, while the ledger charges it once per pool across the
+ * whole batch. The count is the number of pools registered by each body, summed over the bodies, minus the number of
+ * pools registered by the batch, so the pool deposits the batch pays are the per body deposits minus this count times
+ * the pool deposit.
+ *
+ * \param[in]  certificates     The certificates of the top level body, or NULL when it has none.
+ * \param[in]  sub_transactions The sub transactions of the batch, or NULL when there are none.
+ * \param[out] count            On success, the number of pool deposits counted more than once.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificates were inspected, or an appropriate error code.
+ */
+cardano_error_t
+_cardano_count_repeated_pool_deposits(
+  cardano_certificate_set_t*     certificates,
+  cardano_sub_transaction_set_t* sub_transactions,
+  uint64_t*                      count);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_POOL_DEPOSITS_H
diff --git a/vendor/src/transaction_builder/balancing/internals/scripts_needed.c b/vendor/src/transaction_builder/balancing/internals/scripts_needed.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/internals/scripts_needed.c
@@ -0,0 +1,1598 @@
+/**
+ * \file scripts_needed.c
+ *
+ * \author angel.castillo
+ * \date   Sep 23, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "scripts_needed.h"
+#include "../../internals/created_output_scripts.h"
+#include "unique_signers.h"
+
+#include <cardano/address/base_address.h>
+#include <cardano/address/enterprise_address.h>
+#include <cardano/address/pointer_address.h>
+#include <cardano/certs/auth_committee_hot_cert.h>
+#include <cardano/common/guard_set.h>
+#include <cardano/common/utxo.h>
+#include <cardano/proposal_procedures/parameter_change_action.h>
+#include <cardano/proposal_procedures/proposal_procedure.h>
+#include <cardano/proposal_procedures/proposal_procedure_set.h>
+#include <cardano/proposal_procedures/treasury_withdrawals_action.h>
+#include <cardano/scripts/script.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+#include <cardano/witness_set/redeemer.h>
+#include <cardano/witness_set/redeemer_list.h>
+
+#include "../../../common/ledger_order.h"
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The Plutus languages of the needed scripts found among the provided scripts.
+ */
+typedef struct plutus_languages_t
+{
+    bool has_plutus_v1;
+    bool has_plutus_v2;
+    bool has_plutus_v3;
+    bool has_plutus_v4;
+} plutus_languages_t;
+
+/**
+ * \brief The outcome of looking the needed script hashes up among the scripts a transaction is provided with.
+ */
+typedef struct script_lookup_t
+{
+    cardano_blake2b_hash_set_t* needed_scripts;
+    cardano_blake2b_hash_set_t* matched_scripts;
+    cardano_blake2b_hash_set_t* plutus_scripts;
+    plutus_languages_t          languages;
+} script_lookup_t;
+
+/**
+ * \brief Receives a script purpose of a transaction body.
+ *
+ * \param[in,out] context The context the visit was started with.
+ * \param[in] tag The redeemer tag of the purpose.
+ * \param[in] index The redeemer index of the purpose.
+ * \param[in] script_hash The hash of the script the purpose needs.
+ *
+ * \return \ref CARDANO_SUCCESS to continue the visit, or an appropriate error code that ends it.
+ */
+typedef cardano_error_t (*script_purpose_callback_t)(
+  void*                   context,
+  cardano_redeemer_tag_t  tag,
+  uint64_t                index,
+  cardano_blake2b_hash_t* script_hash);
+
+/**
+ * \brief A callback that receives every script purpose of a transaction body, and its context.
+ */
+typedef struct script_purpose_visitor_t
+{
+    script_purpose_callback_t callback;
+    void*                     context;
+} script_purpose_visitor_t;
+
+/**
+ * \brief The fields of a transaction body or sub transaction body that hold script purposes.
+ */
+typedef struct script_purpose_fields_t
+{
+    cardano_transaction_input_set_t*  inputs;
+    cardano_utxo_list_t*              resolved_inputs;
+    cardano_multi_asset_t*            mint;
+    cardano_withdrawal_map_t*         withdrawals;
+    cardano_certificate_set_t*        certificates;
+    cardano_voting_procedures_t*      voting_procedures;
+    cardano_proposal_procedure_set_t* proposals;
+    cardano_guard_set_t*              guards;
+} script_purpose_fields_t;
+
+/**
+ * \brief The state of the search for a Plutus script purpose that has no redeemer.
+ */
+typedef struct missing_redeemer_search_t
+{
+    cardano_blake2b_hash_set_t* plutus_scripts;
+    cardano_redeemer_list_t*    redeemers;
+    cardano_redeemer_tag_t      tag;
+    uint64_t                    index;
+    cardano_blake2b_hash_t*     script_hash;
+} missing_redeemer_search_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Callback function to find the UTXO of a transaction input.
+ *
+ * \param[in] item The UTXO to evaluate.
+ * \param[in] context The transaction input to look for.
+ *
+ * \return `true` if the input of the UTXO is the given transaction input; otherwise, `false`.
+ */
+static bool
+find_utxo(cardano_utxo_t* item, const void* context)
+{
+  const cardano_transaction_input_t* input      = (const cardano_transaction_input_t*)context;
+  cardano_transaction_input_t*       utxo_input = cardano_utxo_get_input(item);
+
+  bool found = cardano_transaction_input_equals(utxo_input, input);
+
+  cardano_transaction_input_unref(&utxo_input);
+
+  return found;
+}
+
+/**
+ * \brief Adds a hash to a set if the set does not hold it yet.
+ *
+ * \param[in,out] set The set that receives the hash.
+ * \param[in] hash The hash to add.
+ *
+ * \return \ref CARDANO_SUCCESS if the set holds the hash, or an appropriate error code.
+ */
+static cardano_error_t
+add_unique_hash(cardano_blake2b_hash_set_t* set, cardano_blake2b_hash_t* hash)
+{
+  if (_cardano_blake2b_hash_set_has(set, hash))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  return cardano_blake2b_hash_set_add(set, hash);
+}
+
+/**
+ * \brief Script purpose callback that adds the needed script hash to a set.
+ *
+ * \param[in,out] context The \ref cardano_blake2b_hash_set_t that receives the script hash.
+ * \param[in] tag Unused.
+ * \param[in] index Unused.
+ * \param[in] script_hash The hash of the needed script.
+ *
+ * \return \ref CARDANO_SUCCESS if the set holds the script hash, or an appropriate error code.
+ */
+static cardano_error_t
+collect_script_hash(
+  void*                   context,
+  cardano_redeemer_tag_t  tag,
+  uint64_t                index,
+  cardano_blake2b_hash_t* script_hash)
+{
+  CARDANO_UNUSED(tag);
+  CARDANO_UNUSED(index);
+
+  return add_unique_hash((cardano_blake2b_hash_set_t*)context, script_hash);
+}
+
+/**
+ * \brief Checks whether a redeemer list holds a redeemer with the given tag and index.
+ *
+ * \param[in] redeemers The redeemers to search, or NULL when there are none.
+ * \param[in] tag The redeemer tag to look for.
+ * \param[in] index The redeemer index to look for.
+ *
+ * \return true if the list holds a redeemer with that tag and index, false otherwise.
+ */
+static bool
+has_redeemer(const cardano_redeemer_list_t* redeemers, const cardano_redeemer_tag_t tag, const uint64_t index)
+{
+  const size_t length = cardano_redeemer_list_get_length(redeemers);
+  bool         found  = false;
+
+  for (size_t i = 0U; (i < length) && !found; ++i)
+  {
+    cardano_redeemer_t* redeemer = NULL;
+
+    const cardano_error_t result = cardano_redeemer_list_get(redeemers, i, &redeemer);
+    cardano_redeemer_unref(&redeemer);
+
+    found = (result == CARDANO_SUCCESS) && (cardano_redeemer_get_tag(redeemer) == tag) && (cardano_redeemer_get_index(redeemer) == index);
+  }
+
+  return found;
+}
+
+/**
+ * \brief Script purpose callback that records the first purpose whose Plutus script has no redeemer.
+ *
+ * \param[in,out] context The \ref missing_redeemer_search_t that holds the Plutus script hashes and the redeemers,
+ *                        and receives the purpose.
+ * \param[in] tag The redeemer tag of the purpose.
+ * \param[in] index The redeemer index of the purpose.
+ * \param[in] script_hash The hash of the script the purpose needs.
+ *
+ * \return \ref CARDANO_SUCCESS, since the purpose is only recorded.
+ */
+static cardano_error_t
+find_purpose_without_redeemer(
+  void*                   context,
+  cardano_redeemer_tag_t  tag,
+  uint64_t                index,
+  cardano_blake2b_hash_t* script_hash)
+{
+  missing_redeemer_search_t* search = (missing_redeemer_search_t*)context;
+
+  if ((search->script_hash != NULL) || !_cardano_blake2b_hash_set_has(search->plutus_scripts, script_hash) || has_redeemer(search->redeemers, tag, index))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_blake2b_hash_ref(script_hash);
+
+  search->tag         = tag;
+  search->index       = index;
+  search->script_hash = script_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Visits the purpose of a credential if the credential is a script hash.
+ *
+ * \param[in] visitor The visitor that receives the purpose.
+ * \param[in] tag The redeemer tag of the purpose.
+ * \param[in] index The redeemer index of the purpose.
+ * \param[in] credential The credential to inspect.
+ *
+ * \return \ref CARDANO_SUCCESS if the credential was inspected, or an appropriate error code.
+ */
+static cardano_error_t
+visit_script_credential(
+  const script_purpose_visitor_t* visitor,
+  const cardano_redeemer_tag_t    tag,
+  const uint64_t                  index,
+  cardano_credential_t*           credential)
+{
+  cardano_credential_type_t type   = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+  cardano_error_t           result = cardano_credential_get_type(credential, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (type != CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_blake2b_hash_t* hash = cardano_credential_get_hash(credential);
+
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = visitor->callback(visitor->context, tag, index, hash);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+/**
+ * \brief Visits the spend purpose of every spent input locked by a script.
+ *
+ * The index of each purpose is the position of its input in the sorted input set.
+ *
+ * \param[in] visitor The visitor that receives the purposes.
+ * \param[in] inputs The spent inputs, or NULL when there are none.
+ * \param[in] resolved_inputs The resolved UTXOs of the spent inputs.
+ *
+ * \return \ref CARDANO_SUCCESS if the inputs were inspected, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if an input is not
+ *         resolved, or an appropriate error code.
+ */
+static cardano_error_t
+visit_input_purposes(
+  const script_purpose_visitor_t*  visitor,
+  cardano_transaction_input_set_t* inputs,
+  cardano_utxo_list_t*             resolved_inputs)
+{
+  const size_t size = cardano_transaction_input_set_get_length(inputs);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_transaction_input_t* input  = NULL;
+    cardano_error_t              result = cardano_transaction_input_set_get(inputs, i, &input);
+    cardano_transaction_input_unref(&input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_utxo_t* utxo = cardano_utxo_list_find(resolved_inputs, find_utxo, (const void*)input);
+    cardano_utxo_unref(&utxo);
+
+    if (utxo == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+    cardano_transaction_output_unref(&output);
+
+    cardano_address_t* address = cardano_transaction_output_get_address(output);
+    cardano_address_unref(&address);
+
+    if (!_cardano_has_payment_script(address))
+    {
+      continue;
+    }
+
+    cardano_blake2b_hash_t* script_hash = _cardano_get_payment_script_hash(address);
+
+    if (script_hash == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    result = visitor->callback(visitor->context, CARDANO_REDEEMER_TAG_SPEND, (uint64_t)i, script_hash);
+
+    cardano_blake2b_hash_unref(&script_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Visits the mint purpose of every policy id of the mint field.
+ *
+ * The index of each purpose is the position of its policy in the mint field.
+ *
+ * \param[in] visitor The visitor that receives the purposes.
+ * \param[in] mint The mint field, or NULL when the body mints nothing.
+ *
+ * \return \ref CARDANO_SUCCESS if the mint field was inspected, or an appropriate error code.
+ */
+static cardano_error_t
+visit_mint_purposes(const script_purpose_visitor_t* visitor, cardano_multi_asset_t* mint)
+{
+  if (mint == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_policy_id_list_t* policies = NULL;
+  cardano_error_t           result   = cardano_multi_asset_get_keys(mint, &policies);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const size_t size = cardano_policy_id_list_get_length(policies);
+
+  for (size_t i = 0U; (i < size) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_blake2b_hash_t* policy_id = NULL;
+
+    result = cardano_policy_id_list_get(policies, i, &policy_id);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = visitor->callback(visitor->context, CARDANO_REDEEMER_TAG_MINT, (uint64_t)i, policy_id);
+    }
+
+    cardano_blake2b_hash_unref(&policy_id);
+  }
+
+  cardano_policy_id_list_unref(&policies);
+
+  return result;
+}
+
+/**
+ * \brief Visits the reward purpose of every withdrawal whose reward address is controlled by a script.
+ *
+ * The index of each purpose is the position of its reward address among the withdrawals in ledger order.
+ *
+ * \param[in] visitor The visitor that receives the purposes.
+ * \param[in] withdrawals The withdrawals, or NULL when the body withdraws nothing.
+ *
+ * \return \ref CARDANO_SUCCESS if the withdrawals were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+visit_withdrawal_purposes(const script_purpose_visitor_t* visitor, cardano_withdrawal_map_t* withdrawals)
+{
+  const size_t size = cardano_withdrawal_map_get_length(withdrawals);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_reward_address_t* reward_address = NULL;
+    cardano_error_t           result         = cardano_withdrawal_map_get_key_at(withdrawals, i, &reward_address);
+    cardano_reward_address_unref(&reward_address);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    uint64_t index = 0U;
+
+    result = _cardano_ledger_order_withdrawal_index(withdrawals, reward_address, &index);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_credential_t* credential = cardano_reward_address_get_credential(reward_address);
+
+    if (credential == NULL)
+    {
+      return CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    result = visit_script_credential(visitor, CARDANO_REDEEMER_TAG_REWARD, index, credential);
+
+    cardano_credential_unref(&credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Retrieves the credential that must authorize a certificate.
+ *
+ * \param[in] certificate The certificate to inspect.
+ * \param[in] type The type of the certificate.
+ * \param[out] credential On success, a new reference to the credential, or NULL if the certificate needs none.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was inspected, or an appropriate error code.
+ */
+static cardano_error_t
+get_certificate_witness_credential(
+  cardano_certificate_t* certificate,
+  cardano_cert_type_t    type,
+  cardano_credential_t** credential)
+{
+  if (type != CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT)
+  {
+    return _cardano_get_certificate_credential(certificate, type, credential);
+  }
+
+  cardano_auth_committee_hot_cert_t* auth_committee = NULL;
+  cardano_error_t                    result         = cardano_certificate_to_auth_committee_hot(certificate, &auth_committee);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_auth_committee_hot_cert_get_cold_cred(auth_committee, credential);
+
+  cardano_auth_committee_hot_cert_unref(&auth_committee);
+
+  return result;
+}
+
+/**
+ * \brief Visits the certifying purpose of every certificate a script must authorize.
+ *
+ * The index of each purpose is the position of its certificate in the certificate list.
+ *
+ * \param[in] visitor The visitor that receives the purposes.
+ * \param[in] certificates The certificates, or NULL when the body carries none.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificates were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+visit_certificate_purposes(const script_purpose_visitor_t* visitor, cardano_certificate_set_t* certificates)
+{
+  const size_t size = cardano_certificate_set_get_length(certificates);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_certificate_t* certificate = NULL;
+    cardano_error_t        result      = cardano_certificate_set_get(certificates, i, &certificate);
+    cardano_certificate_unref(&certificate);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_cert_type_t type = CARDANO_CERT_TYPE_STAKE_REGISTRATION;
+
+    result = cardano_cert_get_type(certificate, &type);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_credential_t* credential = NULL;
+
+    result = get_certificate_witness_credential(certificate, type, &credential);
+
+    if ((result == CARDANO_SUCCESS) && (credential != NULL))
+    {
+      result = visit_script_credential(visitor, CARDANO_REDEEMER_TAG_CERTIFYING, (uint64_t)i, credential);
+    }
+
+    cardano_credential_unref(&credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Visits the voting purpose of every voter that is a script.
+ *
+ * The index of each purpose is the position of its voter among the voters in ledger order.
+ *
+ * \param[in] visitor The visitor that receives the purposes.
+ * \param[in] procedures The voting procedures, or NULL when the body casts no vote.
+ *
+ * \return \ref CARDANO_SUCCESS if the voters were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+visit_voter_purposes(const script_purpose_visitor_t* visitor, cardano_voting_procedures_t* procedures)
+{
+  if (procedures == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_voter_list_t* voters = NULL;
+  cardano_error_t       result = cardano_voting_procedures_get_voters(procedures, &voters);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const size_t size = cardano_voter_list_get_length(voters);
+
+  for (size_t i = 0U; (i < size) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_voter_t* voter = NULL;
+    uint64_t         index = 0U;
+
+    result = cardano_voter_list_get(voters, i, &voter);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = _cardano_ledger_order_voter_index(voters, voter, &index);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_credential_t* credential = cardano_voter_get_credential(voter);
+
+      result = (credential == NULL) ? CARDANO_ERROR_POINTER_IS_NULL : visit_script_credential(visitor, CARDANO_REDEEMER_TAG_VOTING, index, credential);
+
+      cardano_credential_unref(&credential);
+    }
+
+    cardano_voter_unref(&voter);
+  }
+
+  cardano_voter_list_unref(&voters);
+
+  return result;
+}
+
+/**
+ * \brief Visits the guarding purpose of every guard that is a script hash.
+ *
+ * The index of each purpose is the position of its guard in the guard set, counting key hash guards.
+ *
+ * \param[in] visitor The visitor that receives the purposes.
+ * \param[in] guards The guards, or NULL when the body has none.
+ *
+ * \return \ref CARDANO_SUCCESS if the guards were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+visit_guard_purposes(const script_purpose_visitor_t* visitor, cardano_guard_set_t* guards)
+{
+  const size_t size = cardano_guard_set_get_length(guards);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_credential_t* credential = NULL;
+    cardano_error_t       result     = cardano_guard_set_get(guards, i, &credential);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = visit_script_credential(visitor, CARDANO_REDEEMER_TAG_GUARDING, (uint64_t)i, credential);
+    }
+
+    cardano_credential_unref(&credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Retrieves the guardrails script hash of a proposal procedure.
+ *
+ * \param[in] proposal The proposal procedure to inspect.
+ * \param[out] policy_hash On success, a new reference to the guardrails script hash of the proposal, or NULL if its
+ *                         governance action carries none.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was inspected, or an appropriate error code.
+ */
+static cardano_error_t
+get_proposal_policy_hash(cardano_proposal_procedure_t* proposal, cardano_blake2b_hash_t** policy_hash)
+{
+  *policy_hash = NULL;
+
+  cardano_governance_action_type_t type   = CARDANO_GOVERNANCE_ACTION_TYPE_INFO;
+  cardano_error_t                  result = cardano_proposal_procedure_get_action_type(proposal, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (type)
+  {
+    case CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE:
+    {
+      cardano_parameter_change_action_t* action = NULL;
+
+      result = cardano_proposal_procedure_to_parameter_change_action(proposal, &action);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *policy_hash = cardano_parameter_change_action_get_policy_hash(action);
+      }
+
+      cardano_parameter_change_action_unref(&action);
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS:
+    {
+      cardano_treasury_withdrawals_action_t* action = NULL;
+
+      result = cardano_proposal_procedure_to_treasury_withdrawals_action(proposal, &action);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *policy_hash = cardano_treasury_withdrawals_action_get_policy_hash(action);
+      }
+
+      cardano_treasury_withdrawals_action_unref(&action);
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION:
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE:
+    case CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE:
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION:
+    case CARDANO_GOVERNANCE_ACTION_TYPE_INFO:
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Visits the proposing purpose of every proposal procedure whose governance action carries a guardrails script.
+ *
+ * The index of each purpose is the position of its proposal in the proposal list.
+ *
+ * \param[in] visitor The visitor that receives the purposes.
+ * \param[in] proposals The proposal procedures, or NULL when the body proposes nothing.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposals were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+visit_proposal_purposes(const script_purpose_visitor_t* visitor, cardano_proposal_procedure_set_t* proposals)
+{
+  const size_t size = cardano_proposal_procedure_set_get_length(proposals);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_proposal_procedure_t* proposal = NULL;
+    cardano_error_t               result   = cardano_proposal_procedure_set_get(proposals, i, &proposal);
+    cardano_proposal_procedure_unref(&proposal);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_blake2b_hash_t* policy_hash = NULL;
+
+    result = get_proposal_policy_hash(proposal, &policy_hash);
+
+    if ((result == CARDANO_SUCCESS) && (policy_hash != NULL))
+    {
+      result = visitor->callback(visitor->context, CARDANO_REDEEMER_TAG_PROPOSING, (uint64_t)i, policy_hash);
+    }
+
+    cardano_blake2b_hash_unref(&policy_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Visits every script purpose of the fields of a transaction body or sub transaction body.
+ *
+ * The purposes are visited in this order: the spent inputs, the mint field, the withdrawals, the certificates, the
+ * voters, the proposals and the guards.
+ *
+ * \param[in] visitor The visitor that receives the purposes.
+ * \param[in] fields The fields whose purposes are visited.
+ *
+ * \return \ref CARDANO_SUCCESS if every purpose was visited, or the first error code returned while visiting them.
+ */
+static cardano_error_t
+visit_script_purposes(const script_purpose_visitor_t* visitor, script_purpose_fields_t* fields)
+{
+  cardano_error_t result = visit_input_purposes(visitor, fields->inputs, fields->resolved_inputs);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = visit_mint_purposes(visitor, fields->mint);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = visit_withdrawal_purposes(visitor, fields->withdrawals);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = visit_certificate_purposes(visitor, fields->certificates);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = visit_voter_purposes(visitor, fields->voting_procedures);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = visit_proposal_purposes(visitor, fields->proposals);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = visit_guard_purposes(visitor, fields->guards);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Gets the fields of a transaction body that hold script purposes.
+ *
+ * \param[in] body The transaction body.
+ * \param[in] inputs The inputs spent by the body, or NULL to visit no spend purpose.
+ * \param[in] resolved_inputs The resolved UTXOs of \p inputs.
+ *
+ * \return The fields of the body. They are borrowed from the body and must not be released.
+ */
+static script_purpose_fields_t
+get_body_purpose_fields(
+  cardano_transaction_body_t*      body,
+  cardano_transaction_input_set_t* inputs,
+  cardano_utxo_list_t*             resolved_inputs)
+{
+  script_purpose_fields_t fields = { inputs, resolved_inputs, NULL, NULL, NULL, NULL, NULL, NULL };
+
+  fields.mint = cardano_transaction_body_get_mint(body);
+  cardano_multi_asset_unref(&fields.mint);
+
+  fields.withdrawals = cardano_transaction_body_get_withdrawals(body);
+  cardano_withdrawal_map_unref(&fields.withdrawals);
+
+  fields.certificates = cardano_transaction_body_get_certificates(body);
+  cardano_certificate_set_unref(&fields.certificates);
+
+  fields.voting_procedures = cardano_transaction_body_get_voting_procedures(body);
+  cardano_voting_procedures_unref(&fields.voting_procedures);
+
+  fields.proposals = cardano_transaction_body_get_proposal_procedures(body);
+  cardano_proposal_procedure_set_unref(&fields.proposals);
+
+  fields.guards = cardano_transaction_body_get_guards(body);
+  cardano_guard_set_unref(&fields.guards);
+
+  return fields;
+}
+
+/**
+ * \brief Gets the fields of a sub transaction body that hold script purposes.
+ *
+ * \param[in] body The sub transaction body.
+ * \param[in] resolved_inputs The resolved UTXOs of the inputs of the body, or NULL to visit no spend purpose.
+ *
+ * \return The fields of the body. They are borrowed from the body and must not be released.
+ */
+static script_purpose_fields_t
+get_sub_body_purpose_fields(cardano_sub_transaction_body_t* body, cardano_utxo_list_t* resolved_inputs)
+{
+  script_purpose_fields_t fields = { NULL, resolved_inputs, NULL, NULL, NULL, NULL, NULL, NULL };
+
+  if (resolved_inputs != NULL)
+  {
+    fields.inputs = cardano_sub_transaction_body_get_inputs(body);
+    cardano_transaction_input_set_unref(&fields.inputs);
+  }
+
+  fields.mint = cardano_sub_transaction_body_get_mint(body);
+  cardano_multi_asset_unref(&fields.mint);
+
+  fields.withdrawals = cardano_sub_transaction_body_get_withdrawals(body);
+  cardano_withdrawal_map_unref(&fields.withdrawals);
+
+  fields.certificates = cardano_sub_transaction_body_get_certificates(body);
+  cardano_certificate_set_unref(&fields.certificates);
+
+  fields.voting_procedures = cardano_sub_transaction_body_get_voting_procedures(body);
+  cardano_voting_procedures_unref(&fields.voting_procedures);
+
+  fields.proposals = cardano_sub_transaction_body_get_proposal_procedures(body);
+  cardano_proposal_procedure_set_unref(&fields.proposals);
+
+  fields.guards = cardano_sub_transaction_body_get_guards(body);
+  cardano_guard_set_unref(&fields.guards);
+
+  return fields;
+}
+
+/**
+ * \brief Collects the hashes of the scripts the purposes of a body need.
+ *
+ * \param[in] fields The fields of the body whose purposes are inspected.
+ * \param[out] script_hashes On success, a new set holding each needed script hash once.
+ *
+ * \return \ref CARDANO_SUCCESS if the hashes were collected, or an appropriate error code.
+ */
+static cardano_error_t
+collect_script_hashes_needed(script_purpose_fields_t* fields, cardano_blake2b_hash_set_t** script_hashes)
+{
+  cardano_blake2b_hash_set_t* needed = NULL;
+  cardano_error_t             result = cardano_blake2b_hash_set_new(&needed);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const script_purpose_visitor_t visitor = { collect_script_hash, (void*)needed };
+
+  result = visit_script_purposes(&visitor, fields);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(&needed);
+
+    return result;
+  }
+
+  *script_hashes = needed;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Finds the first purpose of a body whose Plutus script has no redeemer.
+ *
+ * \param[in] fields The fields of the body whose purposes are inspected.
+ * \param[in] plutus_scripts The script hashes that resolve to a Plutus script.
+ * \param[in] redeemers The redeemers of the body, or NULL when it has none.
+ * \param[out] tag On success, the redeemer tag of the purpose without a redeemer, if any.
+ * \param[out] index On success, the redeemer index of the purpose without a redeemer, if any.
+ * \param[out] script_hash On success, a new reference to the Plutus script hash of the purpose, or NULL if every
+ *                         purpose has its redeemer.
+ *
+ * \return \ref CARDANO_SUCCESS if the purposes were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+find_missing_redeemer(
+  script_purpose_fields_t*    fields,
+  cardano_blake2b_hash_set_t* plutus_scripts,
+  cardano_redeemer_list_t*    redeemers,
+  cardano_redeemer_tag_t*     tag,
+  uint64_t*                   index,
+  cardano_blake2b_hash_t**    script_hash)
+{
+  missing_redeemer_search_t search = { plutus_scripts, redeemers, CARDANO_REDEEMER_TAG_SPEND, 0U, NULL };
+
+  const script_purpose_visitor_t visitor = { find_purpose_without_redeemer, (void*)&search };
+
+  const cardano_error_t result = visit_script_purposes(&visitor, fields);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&search.script_hash);
+
+    return result;
+  }
+
+  *tag         = search.tag;
+  *index       = search.index;
+  *script_hash = search.script_hash;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Records the language of a provided script if the script is needed.
+ *
+ * \param[in,out] lookup The lookup that holds the needed script hashes and receives the match.
+ * \param[in] hash The hash of the provided script.
+ * \param[in] language The language of the provided script.
+ *
+ * \return \ref CARDANO_SUCCESS if the script was recorded or is not needed, or an appropriate error code.
+ */
+static cardano_error_t
+record_provided_script(
+  script_lookup_t*          lookup,
+  cardano_blake2b_hash_t*   hash,
+  cardano_script_language_t language)
+{
+  if (hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (!_cardano_blake2b_hash_set_has(lookup->needed_scripts, hash))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  bool is_plutus = true;
+
+  switch (language)
+  {
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1:
+    {
+      lookup->languages.has_plutus_v1 = true;
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2:
+    {
+      lookup->languages.has_plutus_v2 = true;
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3:
+    {
+      lookup->languages.has_plutus_v3 = true;
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4:
+    {
+      lookup->languages.has_plutus_v4 = true;
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_NATIVE:
+    default:
+    {
+      is_plutus = false;
+      break;
+    }
+  }
+
+  cardano_error_t result = add_unique_hash(lookup->matched_scripts, hash);
+
+  if ((result == CARDANO_SUCCESS) && is_plutus)
+  {
+    result = add_unique_hash(lookup->plutus_scripts, hash);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Records the languages of the needed scripts among the scripts of a witness set.
+ *
+ * \param[in] witnesses The witness set that provides the scripts.
+ * \param[in,out] lookup The lookup that holds the needed script hashes and receives the matches.
+ *
+ * \return \ref CARDANO_SUCCESS if the scripts were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+record_witness_set_scripts(cardano_witness_set_t* witnesses, script_lookup_t* lookup)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  cardano_native_script_set_t* native_scripts = cardano_witness_set_get_native_scripts(witnesses);
+  cardano_native_script_set_unref(&native_scripts);
+
+  for (size_t i = 0U; (i < cardano_native_script_set_get_length(native_scripts)) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_native_script_t* script = NULL;
+
+    result = cardano_native_script_set_get(native_scripts, i, &script);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_t* hash = cardano_native_script_get_hash(script);
+
+      result = record_provided_script(lookup, hash, CARDANO_SCRIPT_LANGUAGE_NATIVE);
+
+      cardano_blake2b_hash_unref(&hash);
+    }
+
+    cardano_native_script_unref(&script);
+  }
+
+  cardano_plutus_v1_script_set_t* plutus_v1_scripts = cardano_witness_set_get_plutus_v1_scripts(witnesses);
+  cardano_plutus_v1_script_set_unref(&plutus_v1_scripts);
+
+  for (size_t i = 0U; (i < cardano_plutus_v1_script_set_get_length(plutus_v1_scripts)) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_plutus_v1_script_t* script = NULL;
+
+    result = cardano_plutus_v1_script_set_get(plutus_v1_scripts, i, &script);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_t* hash = cardano_plutus_v1_script_get_hash(script);
+
+      result = record_provided_script(lookup, hash, CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1);
+
+      cardano_blake2b_hash_unref(&hash);
+    }
+
+    cardano_plutus_v1_script_unref(&script);
+  }
+
+  cardano_plutus_v2_script_set_t* plutus_v2_scripts = cardano_witness_set_get_plutus_v2_scripts(witnesses);
+  cardano_plutus_v2_script_set_unref(&plutus_v2_scripts);
+
+  for (size_t i = 0U; (i < cardano_plutus_v2_script_set_get_length(plutus_v2_scripts)) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_plutus_v2_script_t* script = NULL;
+
+    result = cardano_plutus_v2_script_set_get(plutus_v2_scripts, i, &script);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_t* hash = cardano_plutus_v2_script_get_hash(script);
+
+      result = record_provided_script(lookup, hash, CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2);
+
+      cardano_blake2b_hash_unref(&hash);
+    }
+
+    cardano_plutus_v2_script_unref(&script);
+  }
+
+  cardano_plutus_v3_script_set_t* plutus_v3_scripts = cardano_witness_set_get_plutus_v3_scripts(witnesses);
+  cardano_plutus_v3_script_set_unref(&plutus_v3_scripts);
+
+  for (size_t i = 0U; (i < cardano_plutus_v3_script_set_get_length(plutus_v3_scripts)) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_plutus_v3_script_t* script = NULL;
+
+    result = cardano_plutus_v3_script_set_get(plutus_v3_scripts, i, &script);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_t* hash = cardano_plutus_v3_script_get_hash(script);
+
+      result = record_provided_script(lookup, hash, CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3);
+
+      cardano_blake2b_hash_unref(&hash);
+    }
+
+    cardano_plutus_v3_script_unref(&script);
+  }
+
+  cardano_plutus_v4_script_set_t* plutus_v4_scripts = cardano_witness_set_get_plutus_v4_scripts(witnesses);
+  cardano_plutus_v4_script_set_unref(&plutus_v4_scripts);
+
+  for (size_t i = 0U; (i < cardano_plutus_v4_script_set_get_length(plutus_v4_scripts)) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_plutus_v4_script_t* script = NULL;
+
+    result = cardano_plutus_v4_script_set_get(plutus_v4_scripts, i, &script);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_t* hash = cardano_plutus_v4_script_get_hash(script);
+
+      result = record_provided_script(lookup, hash, CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4);
+
+      cardano_blake2b_hash_unref(&hash);
+    }
+
+    cardano_plutus_v4_script_unref(&script);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Records the languages of the needed scripts among the reference scripts of a list of resolved UTXOs.
+ *
+ * \param[in] utxos The resolved UTXOs whose reference scripts are provided, or NULL when there are none.
+ * \param[in,out] lookup The lookup that holds the needed script hashes and receives the matches.
+ *
+ * \return \ref CARDANO_SUCCESS if the reference scripts were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+record_reference_scripts(cardano_utxo_list_t* utxos, script_lookup_t* lookup)
+{
+  const size_t size = cardano_utxo_list_get_length(utxos);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_utxo_t* utxo   = NULL;
+    cardano_error_t result = cardano_utxo_list_get(utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+    cardano_transaction_output_unref(&output);
+
+    cardano_script_t* script = cardano_transaction_output_get_script_ref(output);
+    cardano_script_unref(&script);
+
+    if (script == NULL)
+    {
+      continue;
+    }
+
+    cardano_script_language_t language = CARDANO_SCRIPT_LANGUAGE_NATIVE;
+
+    result = cardano_script_get_language(script, &language);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_blake2b_hash_t* hash = cardano_script_get_hash(script);
+
+    result = record_provided_script(lookup, hash, language);
+
+    cardano_blake2b_hash_unref(&hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Records the languages of the needed scripts among the scripts of the witness sets of the sub transactions.
+ *
+ * \param[in] tx The transaction whose sub transactions provide the scripts.
+ * \param[in,out] lookup The lookup that holds the needed script hashes and receives the matches.
+ *
+ * \return \ref CARDANO_SUCCESS if the scripts were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+record_sub_transaction_scripts(cardano_transaction_t* tx, script_lookup_t* lookup)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_sub_transaction_set_t* sub_transactions = cardano_transaction_body_get_sub_transactions(body);
+  cardano_sub_transaction_set_unref(&sub_transactions);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < cardano_sub_transaction_set_get_length(sub_transactions)) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_sub_transaction_t* sub_tx = NULL;
+
+    result = cardano_sub_transaction_set_get(sub_transactions, i, &sub_tx);
+    cardano_sub_transaction_unref(&sub_tx);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_witness_set_t* witnesses = cardano_sub_transaction_get_witness_set(sub_tx);
+      cardano_witness_set_unref(&witnesses);
+
+      result = record_witness_set_scripts(witnesses, lookup);
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Looks the needed script hashes up among the scripts a transaction is provided with.
+ *
+ * The provided scripts are pooled over the whole batch, as the ledger does for a top level transaction: the scripts of
+ * its witness set and of the witness sets of its sub transactions, and the reference scripts of the resolved UTXOs.
+ *
+ * \param[in] tx The transaction whose witness sets provide scripts.
+ * \param[in] needed_scripts The needed script hashes.
+ * \param[in] reference_inputs The resolved reference inputs whose reference scripts are provided, or NULL.
+ * \param[in] pre_selected_utxo The pre selected UTXOs whose reference scripts are provided, or NULL.
+ * \param[in] selection The UTXOs chosen by coin selection whose reference scripts are provided, or NULL.
+ * \param[in] sub_transaction_utxos The resolved UTXOs of the sub transactions whose reference scripts are provided, or NULL.
+ * \param[out] lookup On success, the needed script hashes that were matched and the ones matched by a Plutus script,
+ *                    which the caller must release with \ref cardano_blake2b_hash_set_unref, and their languages.
+ *
+ * \return \ref CARDANO_SUCCESS if the provided scripts were inspected, or an appropriate error code.
+ * \param[in] include_created_scripts Enables CIP-172 script sources for Dijkstra.
+ */
+static cardano_error_t
+lookup_provided_scripts(
+  cardano_transaction_t*      tx,
+  const bool                  include_created_scripts,
+  cardano_blake2b_hash_set_t* needed_scripts,
+  cardano_utxo_list_t*        reference_inputs,
+  cardano_utxo_list_t*        pre_selected_utxo,
+  cardano_utxo_list_t*        selection,
+  cardano_utxo_list_t*        sub_transaction_utxos,
+  script_lookup_t*            lookup)
+{
+  const plutus_languages_t no_languages = { false, false, false, false };
+
+  lookup->needed_scripts  = needed_scripts;
+  lookup->matched_scripts = NULL;
+  lookup->plutus_scripts  = NULL;
+  lookup->languages       = no_languages;
+
+  cardano_error_t result = cardano_blake2b_hash_set_new(&lookup->matched_scripts);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_blake2b_hash_set_new(&lookup->plutus_scripts);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_witness_set_t* witnesses = cardano_transaction_get_witness_set(tx);
+    cardano_witness_set_unref(&witnesses);
+
+    result = record_witness_set_scripts(witnesses, lookup);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = record_sub_transaction_scripts(tx, lookup);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = record_reference_scripts(reference_inputs, lookup);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = record_reference_scripts(pre_selected_utxo, lookup);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = record_reference_scripts(selection, lookup);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = record_reference_scripts(sub_transaction_utxos, lookup);
+  }
+
+  if ((result == CARDANO_SUCCESS) && include_created_scripts)
+  {
+    for (size_t i = 0U; (result == CARDANO_SUCCESS) && (i < cardano_blake2b_hash_set_get_length(needed_scripts)); ++i)
+    {
+      cardano_blake2b_hash_t* hash   = NULL;
+      cardano_script_t*       script = NULL;
+      result                         = cardano_blake2b_hash_set_get(needed_scripts, i, &hash);
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_builder_find_created_script(tx, hash, &script);
+        if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+        {
+          result = CARDANO_SUCCESS;
+        }
+        else if (result == CARDANO_SUCCESS)
+        {
+          cardano_script_language_t language = CARDANO_SCRIPT_LANGUAGE_NATIVE;
+          result                             = cardano_script_get_language(script, &language);
+          if (result == CARDANO_SUCCESS)
+          {
+            result = record_provided_script(lookup, hash, language);
+          }
+        }
+        else
+        {
+          /* Preserve the lookup error for the caller. */
+        }
+      }
+      cardano_script_unref(&script);
+      cardano_blake2b_hash_unref(&hash);
+    }
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(&lookup->matched_scripts);
+    cardano_blake2b_hash_set_unref(&lookup->plutus_scripts);
+  }
+
+  return result;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+bool
+_cardano_has_payment_script(const cardano_address_t* address)
+{
+  cardano_address_type_t type = CARDANO_ADDRESS_TYPE_BYRON;
+
+  if ((address == NULL) || (cardano_address_get_type(address, &type) != CARDANO_SUCCESS))
+  {
+    return false;
+  }
+
+  return (type == CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY) || (type == CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT) || (type == CARDANO_ADDRESS_TYPE_POINTER_SCRIPT) || (type == CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT);
+}
+
+cardano_blake2b_hash_t*
+_cardano_get_payment_script_hash(cardano_address_t* address)
+{
+  if (!_cardano_has_payment_script(address))
+  {
+    return NULL;
+  }
+
+  cardano_address_type_t type       = CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT;
+  cardano_credential_t*  credential = NULL;
+
+  CARDANO_UNUSED(cardano_address_get_type(address, &type));
+
+  if ((type == CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY) || (type == CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT))
+  {
+    cardano_base_address_t* base_address = cardano_address_to_base_address(address);
+
+    credential = cardano_base_address_get_payment_credential(base_address);
+    cardano_base_address_unref(&base_address);
+  }
+  else if (type == CARDANO_ADDRESS_TYPE_POINTER_SCRIPT)
+  {
+    cardano_pointer_address_t* pointer_address = cardano_address_to_pointer_address(address);
+
+    credential = cardano_pointer_address_get_payment_credential(pointer_address);
+    cardano_pointer_address_unref(&pointer_address);
+  }
+  else
+  {
+    cardano_enterprise_address_t* enterprise_address = cardano_address_to_enterprise_address(address);
+
+    credential = cardano_enterprise_address_get_payment_credential(enterprise_address);
+    cardano_enterprise_address_unref(&enterprise_address);
+  }
+
+  cardano_blake2b_hash_t* script_hash = cardano_credential_get_hash(credential);
+
+  cardano_credential_unref(&credential);
+
+  return script_hash;
+}
+
+cardano_error_t
+_cardano_get_script_hashes_needed(
+  cardano_transaction_body_t*  body,
+  cardano_utxo_list_t*         resolved_inputs,
+  cardano_blake2b_hash_set_t** script_hashes)
+{
+  if ((body == NULL) || (script_hashes == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_input_set_t* inputs = NULL;
+
+  if (resolved_inputs != NULL)
+  {
+    inputs = cardano_transaction_body_get_inputs(body);
+    cardano_transaction_input_set_unref(&inputs);
+  }
+
+  script_purpose_fields_t fields = get_body_purpose_fields(body, inputs, resolved_inputs);
+
+  return collect_script_hashes_needed(&fields, script_hashes);
+}
+
+cardano_error_t
+_cardano_get_sub_transaction_script_hashes_needed(
+  cardano_sub_transaction_body_t* body,
+  cardano_utxo_list_t*            resolved_inputs,
+  cardano_blake2b_hash_set_t**    script_hashes)
+{
+  if ((body == NULL) || (script_hashes == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  script_purpose_fields_t fields = get_sub_body_purpose_fields(body, resolved_inputs);
+
+  return collect_script_hashes_needed(&fields, script_hashes);
+}
+
+cardano_error_t
+_cardano_get_plutus_languages_used(
+  cardano_transaction_t*      tx,
+  const bool                  include_created_scripts,
+  cardano_blake2b_hash_set_t* needed_scripts,
+  cardano_utxo_list_t*        reference_inputs,
+  cardano_utxo_list_t*        pre_selected_utxo,
+  cardano_utxo_list_t*        selection,
+  cardano_utxo_list_t*        sub_transaction_utxos,
+  bool*                       has_plutus_v1,
+  bool*                       has_plutus_v2,
+  bool*                       has_plutus_v3,
+  bool*                       has_plutus_v4,
+  bool*                       has_missing_scripts)
+{
+  if ((tx == NULL) || (needed_scripts == NULL) || (has_plutus_v1 == NULL) || (has_plutus_v2 == NULL) || (has_plutus_v3 == NULL) || (has_plutus_v4 == NULL) || (has_missing_scripts == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  script_lookup_t lookup = { NULL, NULL, NULL, { false, false, false, false } };
+
+  cardano_error_t result = lookup_provided_scripts(tx, include_created_scripts, needed_scripts, reference_inputs, pre_selected_utxo, selection, sub_transaction_utxos, &lookup);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  bool is_missing = false;
+
+  const size_t needed_count = cardano_blake2b_hash_set_get_length(needed_scripts);
+
+  for (size_t i = 0U; (i < needed_count) && (result == CARDANO_SUCCESS) && !is_missing; ++i)
+  {
+    cardano_blake2b_hash_t* hash = NULL;
+
+    result = cardano_blake2b_hash_set_get(needed_scripts, i, &hash);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      is_missing = !_cardano_blake2b_hash_set_has(lookup.matched_scripts, hash);
+    }
+
+    cardano_blake2b_hash_unref(&hash);
+  }
+
+  cardano_blake2b_hash_set_unref(&lookup.matched_scripts);
+  cardano_blake2b_hash_set_unref(&lookup.plutus_scripts);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *has_plutus_v1       = lookup.languages.has_plutus_v1;
+  *has_plutus_v2       = lookup.languages.has_plutus_v2;
+  *has_plutus_v3       = lookup.languages.has_plutus_v3;
+  *has_plutus_v4       = lookup.languages.has_plutus_v4;
+  *has_missing_scripts = is_missing;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_get_plutus_scripts_provided(
+  cardano_transaction_t*       tx,
+  const bool                   include_created_scripts,
+  cardano_blake2b_hash_set_t*  script_hashes,
+  cardano_utxo_list_t*         reference_inputs,
+  cardano_utxo_list_t*         pre_selected_utxo,
+  cardano_utxo_list_t*         selection,
+  cardano_utxo_list_t*         sub_transaction_utxos,
+  cardano_blake2b_hash_set_t** plutus_scripts)
+{
+  if ((tx == NULL) || (script_hashes == NULL) || (plutus_scripts == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  script_lookup_t lookup = { NULL, NULL, NULL, { false, false, false, false } };
+
+  const cardano_error_t result = lookup_provided_scripts(tx, include_created_scripts, script_hashes, reference_inputs, pre_selected_utxo, selection, sub_transaction_utxos, &lookup);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_set_unref(&lookup.matched_scripts);
+
+  *plutus_scripts = lookup.plutus_scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_find_missing_redeemer(
+  cardano_transaction_body_t*      body,
+  cardano_transaction_input_set_t* inputs,
+  cardano_utxo_list_t*             resolved_inputs,
+  cardano_blake2b_hash_set_t*      plutus_scripts,
+  cardano_redeemer_list_t*         redeemers,
+  cardano_redeemer_tag_t*          tag,
+  uint64_t*                        index,
+  cardano_blake2b_hash_t**         script_hash)
+{
+  if ((body == NULL) || (plutus_scripts == NULL) || (tag == NULL) || (index == NULL) || (script_hash == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  script_purpose_fields_t fields = get_body_purpose_fields(body, inputs, resolved_inputs);
+
+  return find_missing_redeemer(&fields, plutus_scripts, redeemers, tag, index, script_hash);
+}
+
+cardano_error_t
+_cardano_find_sub_transaction_missing_redeemer(
+  cardano_sub_transaction_body_t* body,
+  cardano_utxo_list_t*            resolved_inputs,
+  cardano_blake2b_hash_set_t*     plutus_scripts,
+  cardano_redeemer_list_t*        redeemers,
+  cardano_redeemer_tag_t*         tag,
+  uint64_t*                       index,
+  cardano_blake2b_hash_t**        script_hash)
+{
+  if ((body == NULL) || (plutus_scripts == NULL) || (tag == NULL) || (index == NULL) || (script_hash == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  script_purpose_fields_t fields = get_sub_body_purpose_fields(body, resolved_inputs);
+
+  return find_missing_redeemer(&fields, plutus_scripts, redeemers, tag, index, script_hash);
+}
diff --git a/vendor/src/transaction_builder/balancing/internals/scripts_needed.h b/vendor/src/transaction_builder/balancing/internals/scripts_needed.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/internals/scripts_needed.h
@@ -0,0 +1,316 @@
+/**
+ * \file scripts_needed.h
+ *
+ * \author angel.castillo
+ * \date   Sep 23, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SCRIPTS_NEEDED_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SCRIPTS_NEEDED_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+#include <cardano/typedefs.h>
+#include <cardano/witness_set/redeemer_list.h>
+#include <cardano/witness_set/redeemer_tag.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Checks whether a Cardano address has a payment credential that is a script hash.
+ *
+ * Only base, pointer and enterprise addresses whose payment credential is a script hash have one. This check does not
+ * allocate, so a NULL result of \ref _cardano_get_payment_script_hash for an address that has a payment script can only
+ * mean an allocation failure. It must list exactly the address types \ref _cardano_get_payment_script_hash resolves.
+ *
+ * \param[in] address A pointer to an initialized \ref cardano_address_t object, or NULL.
+ *
+ * \return true if the payment credential of the address is a script hash, false otherwise or if \p address is NULL.
+ */
+bool
+_cardano_has_payment_script(const cardano_address_t* address);
+
+/**
+ * \brief Retrieves the script hash of the payment credential of a Cardano address.
+ *
+ * This function extracts the script hash from the payment credential of the specified Cardano address, if the
+ * address has a payment script as reported by \ref _cardano_has_payment_script.
+ *
+ * \param[in] address A pointer to an initialized \ref cardano_address_t object representing the Cardano address
+ *                    from which the payment script hash will be retrieved. This parameter is required and must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_blake2b_hash_t object containing the script hash of the payment credential,
+ *         or NULL if the payment credential of the address is not a script hash or if an error occurs. The caller is
+ *         responsible for managing the lifecycle of this object. Specifically, the caller must release it by calling
+ *         \ref cardano_blake2b_hash_unref once it is no longer needed.
+ */
+cardano_blake2b_hash_t*
+_cardano_get_payment_script_hash(cardano_address_t* address);
+
+/**
+ * \brief Collects the hashes of the scripts a Cardano transaction body needs to run.
+ *
+ * A script is needed when the body spends an input locked by it, mints or burns under its policy, withdraws from
+ * a reward account it controls, carries a certificate whose credential it is, casts a vote with it as the voter,
+ * carries a proposal it guards or lists it among its guards. This mirrors how the ledger derives the scripts a
+ * transaction needs:
+ *
+ * - The payment credential of every spent input whose address is a script address. Every spent input is resolved
+ *   through \p resolved_inputs.
+ * - The policy id of every entry of the mint field.
+ * - The credential of every withdrawal whose reward address is a script address.
+ * - The script credential that must authorize each certificate: the stake credential of the stake deregistration,
+ *   delegation, Conway registration and unregistration certificates (the legacy stake registration certificate, which
+ *   the ledger does not require a witness for, yields none), the DRep credential of the DRep certificates and the cold
+ *   credential of the committee resignation and committee hot key authorization certificates.
+ * - The credential of every voter that is a script, a DRep script or a constitutional committee hot script.
+ * - The guardrails script hash of every proposal procedure whose governance action carries one, a parameter change
+ *   or a treasury withdrawals action.
+ * - Every guard of the body that is a script hash.
+ *
+ * Reference inputs never make a script needed.
+ *
+ * \param[in] body A pointer to an initialized \ref cardano_transaction_body_t object whose needed scripts are collected.
+ *                 This parameter is required and must not be NULL.
+ * \param[in] resolved_inputs A pointer to an initialized \ref cardano_utxo_list_t object containing the resolved UTXOs of
+ *                            the inputs spent by the body. If this parameter is NULL, the spent inputs are ignored.
+ * \param[out] script_hashes On successful execution, this will point to a newly created \ref cardano_blake2b_hash_set_t
+ *                           object containing each needed script hash once. The caller is responsible for managing the
+ *                           lifecycle of this object. Specifically, the caller must release it by calling
+ *                           \ref cardano_blake2b_hash_set_unref once it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the needed script
+ *         hashes were collected, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if a spent input is not among \p resolved_inputs, or
+ *         an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if `body` or
+ *         `script_hashes` is NULL.
+ */
+cardano_error_t
+_cardano_get_script_hashes_needed(
+  cardano_transaction_body_t*  body,
+  cardano_utxo_list_t*         resolved_inputs,
+  cardano_blake2b_hash_set_t** script_hashes);
+
+/**
+ * \brief Collects the hashes of the scripts a Cardano sub transaction body needs to run.
+ *
+ * The needed scripts of a sub transaction are found the same way as the ones of a transaction body, described in
+ * \ref _cardano_get_script_hashes_needed, from the spent inputs, the mint field, the withdrawals, the certificates, the
+ * voters, the proposal procedures and the guards of the sub transaction body.
+ *
+ * \param[in] body A pointer to an initialized \ref cardano_sub_transaction_body_t object whose needed scripts are
+ *                 collected. This parameter is required and must not be NULL.
+ * \param[in] resolved_inputs A pointer to an initialized \ref cardano_utxo_list_t object containing the resolved UTXOs of
+ *                            the inputs spent by the body. If this parameter is NULL, the spent inputs are ignored.
+ * \param[out] script_hashes On successful execution, this will point to a newly created \ref cardano_blake2b_hash_set_t
+ *                           object containing each needed script hash once. The caller is responsible for managing the
+ *                           lifecycle of this object. Specifically, the caller must release it by calling
+ *                           \ref cardano_blake2b_hash_set_unref once it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the needed script
+ *         hashes were collected, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if a spent input is not among \p resolved_inputs, or
+ *         an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if `body` or
+ *         `script_hashes` is NULL.
+ */
+cardano_error_t
+_cardano_get_sub_transaction_script_hashes_needed(
+  cardano_sub_transaction_body_t* body,
+  cardano_utxo_list_t*            resolved_inputs,
+  cardano_blake2b_hash_set_t**    script_hashes);
+
+/**
+ * \brief Finds the Plutus languages of the scripts a Cardano transaction needs among the scripts it is provided with.
+ *
+ * Every needed script hash is looked up among the provided scripts, which the ledger pools over the whole batch of a
+ * top level transaction: the native, PlutusV1, PlutusV2, PlutusV3 and PlutusV4 scripts of the witness set of \p tx and
+ * of the witness sets of its sub transactions, and the reference scripts of the UTXOs of \p reference_inputs,
+ * \p pre_selected_utxo, \p selection and \p sub_transaction_utxos. The language of every matched Plutus script is
+ * reported, while a needed hash matched by a native script reports no language. A needed hash that no provided script
+ * matches is reported through \p has_missing_scripts, and its language remains unknown.
+ *
+ * \param[in] tx A pointer to an initialized \ref cardano_transaction_t object whose witness set, and the witness sets of
+ *               whose sub transactions, provide scripts. This parameter is required and must not be NULL.
+ * \param[in] needed_scripts A pointer to an initialized \ref cardano_blake2b_hash_set_t object holding the needed script
+ *                           hashes, as collected by \ref _cardano_get_script_hashes_needed. This parameter is required
+ *                           and must not be NULL.
+ * \param[in] reference_inputs The resolved reference inputs whose reference scripts are provided, or NULL when there are none.
+ * \param[in] pre_selected_utxo The pre selected UTXOs whose reference scripts are provided, or NULL when there are none.
+ * \param[in] selection The UTXOs chosen by coin selection whose reference scripts are provided, or NULL when there are none.
+ * \param[in] sub_transaction_utxos The resolved UTXOs the sub transactions spend or reference, whose reference scripts are
+ *                                  provided, or NULL when there are none.
+ * \param[out] has_plutus_v1 Set to true if a needed script is a PlutusV1 script. This parameter must not be NULL.
+ * \param[out] has_plutus_v2 Set to true if a needed script is a PlutusV2 script. This parameter must not be NULL.
+ * \param[out] has_plutus_v3 Set to true if a needed script is a PlutusV3 script. This parameter must not be NULL.
+ * \param[out] has_plutus_v4 Set to true if a needed script is a PlutusV4 script. This parameter must not be NULL.
+ * \param[out] has_missing_scripts Set to true if a needed script is not among the provided scripts. This parameter must
+ *                                 not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the provided scripts
+ *         were inspected, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if a required parameter is NULL.
+ * \param[in] include_created_scripts Enables CIP-172 reference scripts from created outputs (PV12+).
+ */
+cardano_error_t
+_cardano_get_plutus_languages_used(
+  cardano_transaction_t*      tx,
+  bool                        include_created_scripts,
+  cardano_blake2b_hash_set_t* needed_scripts,
+  cardano_utxo_list_t*        reference_inputs,
+  cardano_utxo_list_t*        pre_selected_utxo,
+  cardano_utxo_list_t*        selection,
+  cardano_utxo_list_t*        sub_transaction_utxos,
+  bool*                       has_plutus_v1,
+  bool*                       has_plutus_v2,
+  bool*                       has_plutus_v3,
+  bool*                       has_plutus_v4,
+  bool*                       has_missing_scripts);
+
+/**
+ * \brief Finds the script hashes that resolve to a Plutus script among the scripts a Cardano transaction is provided with.
+ *
+ * Every hash of \p script_hashes is looked up among the same pooled scripts as \ref _cardano_get_plutus_languages_used
+ * does: the scripts of the witness set of \p tx and of the witness sets of its sub transactions, and the reference
+ * scripts of the UTXOs of \p reference_inputs, \p pre_selected_utxo, \p selection and \p sub_transaction_utxos. A hash
+ * is kept when a PlutusV1, PlutusV2, PlutusV3 or PlutusV4 script matches it, while a hash matched only by a native
+ * script, or by no provided script, is left out. This is how the ledger decides which spent inputs need, and therefore
+ * allow, the witness datum of their datum hash.
+ *
+ * \param[in] tx A pointer to an initialized \ref cardano_transaction_t object whose witness set, and the witness sets of
+ *               whose sub transactions, provide scripts. This parameter is required and must not be NULL.
+ * \param[in] script_hashes A pointer to an initialized \ref cardano_blake2b_hash_set_t object holding the script hashes
+ *                          to look up. This parameter is required and must not be NULL.
+ * \param[in] reference_inputs The resolved reference inputs whose reference scripts are provided, or NULL when there are none.
+ * \param[in] pre_selected_utxo The pre selected UTXOs whose reference scripts are provided, or NULL when there are none.
+ * \param[in] selection The UTXOs chosen by coin selection whose reference scripts are provided, or NULL when there are none.
+ * \param[in] sub_transaction_utxos The resolved UTXOs the sub transactions spend or reference, whose reference scripts are
+ *                                  provided, or NULL when there are none.
+ * \param[out] plutus_scripts On successful execution, this will point to a newly created \ref cardano_blake2b_hash_set_t
+ *                            object containing each hash of \p script_hashes that resolves to a Plutus script once. The
+ *                            caller is responsible for managing the lifecycle of this object. Specifically, the caller
+ *                            must release it by calling \ref cardano_blake2b_hash_set_unref once it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the provided scripts
+ *         were inspected, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if a required parameter is NULL.
+ * \param[in] include_created_scripts Enables CIP-172 reference scripts from created outputs (PV12+).
+ */
+cardano_error_t
+_cardano_get_plutus_scripts_provided(
+  cardano_transaction_t*       tx,
+  bool                         include_created_scripts,
+  cardano_blake2b_hash_set_t*  script_hashes,
+  cardano_utxo_list_t*         reference_inputs,
+  cardano_utxo_list_t*         pre_selected_utxo,
+  cardano_utxo_list_t*         selection,
+  cardano_utxo_list_t*         sub_transaction_utxos,
+  cardano_blake2b_hash_set_t** plutus_scripts);
+
+/**
+ * \brief Finds a script purpose of a Cardano transaction body whose Plutus script has no redeemer.
+ *
+ * The ledger requires a redeemer for every script purpose of a body whose needed script hash resolves to a Plutus
+ * script among the scripts the transaction is provided with. The purposes are the ones described in
+ * \ref _cardano_get_script_hashes_needed, and each one is looked for among \p redeemers by the tag and the index the
+ * ledger gives it:
+ *
+ * - Spend: the position of the input in \p inputs, which is sorted.
+ * - Mint: the position of the policy id in the mint field.
+ * - Reward: the position of the reward address among the withdrawals in ledger order.
+ * - Certifying: the position of the certificate in the certificate list.
+ * - Voting: the position of the voter among the voters in ledger order.
+ * - Proposing: the position of the proposal procedure in the proposal list.
+ * - Guarding: the position of the guard in the guard set, counting key hash guards.
+ *
+ * A purpose whose script hash is not among \p plutus_scripts, such as one resolved only by a native script or by no
+ * provided script, needs no redeemer. The purposes are inspected in the order of the list above, and the first one
+ * that has no redeemer is reported.
+ *
+ * \param[in] body A pointer to an initialized \ref cardano_transaction_body_t object whose purposes are inspected. Its
+ *                 inputs are ignored. This parameter is required and must not be NULL.
+ * \param[in] inputs A pointer to the \ref cardano_transaction_input_set_t spent by the body, or NULL to inspect no spend
+ *                   purpose.
+ * \param[in] resolved_inputs A pointer to the \ref cardano_utxo_list_t holding the resolved UTXOs of \p inputs.
+ * \param[in] plutus_scripts A pointer to an initialized \ref cardano_blake2b_hash_set_t object holding the script hashes
+ *                           that resolve to a Plutus script, as found by \ref _cardano_get_plutus_scripts_provided.
+ *                           This parameter is required and must not be NULL.
+ * \param[in] redeemers A pointer to the \ref cardano_redeemer_list_t of the transaction, or NULL when it has none.
+ * \param[out] tag On success, the redeemer tag of the purpose without a redeemer, if any. This parameter must not be NULL.
+ * \param[out] index On success, the redeemer index of the purpose without a redeemer, if any. This parameter must not
+ *                   be NULL.
+ * \param[out] script_hash On success, a new reference to the hash of the Plutus script of the first purpose that has no
+ *                         redeemer, or NULL if every such purpose has one. The caller is responsible for releasing it
+ *                         by calling \ref cardano_blake2b_hash_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the purposes
+ *         were inspected, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if an input is not among \p resolved_inputs, or an
+ *         appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if a required
+ *         parameter is NULL.
+ */
+cardano_error_t
+_cardano_find_missing_redeemer(
+  cardano_transaction_body_t*      body,
+  cardano_transaction_input_set_t* inputs,
+  cardano_utxo_list_t*             resolved_inputs,
+  cardano_blake2b_hash_set_t*      plutus_scripts,
+  cardano_redeemer_list_t*         redeemers,
+  cardano_redeemer_tag_t*          tag,
+  uint64_t*                        index,
+  cardano_blake2b_hash_t**         script_hash);
+
+/**
+ * \brief Finds a script purpose of a Cardano sub transaction body whose Plutus script has no redeemer.
+ *
+ * The ledger checks the redeemers of every sub transaction of a batch on their own: each script purpose of the sub
+ * transaction body whose needed script hash resolves to a Plutus script among the scripts provided to the whole batch
+ * must have a redeemer in the witness set of that sub transaction. The purposes, their redeemer indices and the order
+ * in which they are inspected are the ones described in \ref _cardano_find_missing_redeemer, and the spend indices are
+ * positions in the sorted inputs of the sub transaction body.
+ *
+ * \param[in] body A pointer to an initialized \ref cardano_sub_transaction_body_t object whose purposes are inspected.
+ *                 This parameter is required and must not be NULL.
+ * \param[in] resolved_inputs A pointer to the \ref cardano_utxo_list_t holding the resolved UTXOs of the inputs of
+ *                            \p body, or NULL to inspect no spend purpose.
+ * \param[in] plutus_scripts A pointer to an initialized \ref cardano_blake2b_hash_set_t object holding the script hashes
+ *                           that resolve to a Plutus script, as found by \ref _cardano_get_plutus_scripts_provided.
+ *                           This parameter is required and must not be NULL.
+ * \param[in] redeemers A pointer to the \ref cardano_redeemer_list_t of the sub transaction, or NULL when it has none.
+ * \param[out] tag On success, the redeemer tag of the purpose without a redeemer, if any. This parameter must not be NULL.
+ * \param[out] index On success, the redeemer index of the purpose without a redeemer, if any. This parameter must not
+ *                   be NULL.
+ * \param[out] script_hash On success, a new reference to the hash of the Plutus script of the first purpose that has no
+ *                         redeemer, or NULL if every such purpose has one. The caller is responsible for releasing it
+ *                         by calling \ref cardano_blake2b_hash_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the purposes
+ *         were inspected, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if an input is not among \p resolved_inputs, or an
+ *         appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL if a required
+ *         parameter is NULL.
+ */
+cardano_error_t
+_cardano_find_sub_transaction_missing_redeemer(
+  cardano_sub_transaction_body_t* body,
+  cardano_utxo_list_t*            resolved_inputs,
+  cardano_blake2b_hash_set_t*     plutus_scripts,
+  cardano_redeemer_list_t*        redeemers,
+  cardano_redeemer_tag_t*         tag,
+  uint64_t*                       index,
+  cardano_blake2b_hash_t**        script_hash);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SCRIPTS_NEEDED_H
diff --git a/vendor/src/transaction_builder/balancing/internals/unique_signers.c b/vendor/src/transaction_builder/balancing/internals/unique_signers.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/internals/unique_signers.c
@@ -0,0 +1,1522 @@
+/**
+ * \file unique_signers.c
+ *
+ * \author angel.castillo
+ * \date   Nov 07, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "unique_signers.h"
+
+#include <cardano/address/base_address.h>
+#include <cardano/address/byron_address.h>
+#include <cardano/address/enterprise_address.h>
+#include <cardano/address/pointer_address.h>
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/certs/auth_committee_hot_cert.h>
+#include <cardano/certs/pool_registration_cert.h>
+#include <cardano/certs/pool_retirement_cert.h>
+#include <cardano/certs/register_drep_cert.h>
+#include <cardano/certs/registration_cert.h>
+#include <cardano/certs/resign_committee_cold_cert.h>
+#include <cardano/certs/stake_delegation_cert.h>
+#include <cardano/certs/stake_deregistration_cert.h>
+#include <cardano/certs/stake_registration_delegation_cert.h>
+#include <cardano/certs/stake_vote_delegation_cert.h>
+#include <cardano/certs/stake_vote_registration_delegation_cert.h>
+#include <cardano/certs/unregister_drep_cert.h>
+#include <cardano/certs/unregistration_cert.h>
+#include <cardano/certs/update_drep_cert.h>
+#include <cardano/certs/vote_delegation_cert.h>
+#include <cardano/certs/vote_registration_delegation_cert.h>
+#include <cardano/common/utxo.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Callback function to find a specific UTXO based on the provided context.
+ *
+ * This function checks if the provided UTXO matches the criteria specified in `context`.
+ *
+ * \param[in] item The UTXO to evaluate.
+ * \param[in] context A pointer to the search criteria, typically a structure or identifier.
+ *
+ * \return `true` if the UTXO matches the search criteria; otherwise, `false`.
+ */
+static bool
+find_utxo(cardano_utxo_t* item, const void* context)
+{
+  const cardano_transaction_input_t* input      = (const cardano_transaction_input_t*)context;
+  cardano_transaction_input_t*       utxo_input = cardano_utxo_get_input(item);
+
+  bool found = cardano_transaction_input_equals(utxo_input, input);
+
+  cardano_transaction_input_unref(&utxo_input);
+
+  return found;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+bool
+_cardano_blake2b_hash_set_has(cardano_blake2b_hash_set_t* set, const cardano_blake2b_hash_t* hash)
+{
+  if ((set == NULL) || (hash == NULL))
+  {
+    return false;
+  }
+
+  const size_t size = cardano_blake2b_hash_set_get_length(set);
+
+  if (size == 0U)
+  {
+    return false;
+  }
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_blake2b_hash_t* current = NULL;
+
+    cardano_error_t result = cardano_blake2b_hash_set_get(set, i, &current);
+    cardano_blake2b_hash_unref(&current);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return false;
+    }
+
+    if (cardano_blake2b_hash_equals(current, hash))
+    {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+cardano_error_t
+_cardano_add_required_signers(cardano_blake2b_hash_set_t* unique_signers, cardano_blake2b_hash_set_t* required_signers)
+{
+  if (unique_signers == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t size = cardano_blake2b_hash_set_get_length(required_signers);
+
+  if (size == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_blake2b_hash_t* current = NULL;
+    cardano_error_t         result  = cardano_blake2b_hash_set_get(required_signers, i, &current);
+
+    cardano_blake2b_hash_unref(&current);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (!_cardano_blake2b_hash_set_has(unique_signers, current))
+    {
+      result = cardano_blake2b_hash_set_add(unique_signers, current);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_blake2b_hash_t*
+_cardano_get_payment_pub_key_hash(cardano_address_t* address)
+{
+  if (address == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_address_type_t type;
+
+  cardano_error_t result = cardano_address_get_type(address, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  cardano_credential_t* credential;
+
+  switch (type)
+  {
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_KEY:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_SCRIPT:
+    {
+      cardano_base_address_t* base_address = cardano_address_to_base_address(address);
+
+      if (base_address == NULL)
+      {
+        return NULL;
+      }
+
+      credential = cardano_base_address_get_payment_credential(base_address);
+      cardano_base_address_unref(&base_address);
+      break;
+    }
+    case CARDANO_ADDRESS_TYPE_POINTER_KEY:
+    {
+      cardano_pointer_address_t* pointer_address = cardano_address_to_pointer_address(address);
+
+      if (pointer_address == NULL)
+      {
+        return NULL;
+      }
+
+      credential = cardano_pointer_address_get_payment_credential(pointer_address);
+      cardano_pointer_address_unref(&pointer_address);
+      break;
+    }
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_KEY:
+    {
+      cardano_enterprise_address_t* enterprise_address = cardano_address_to_enterprise_address(address);
+
+      if (enterprise_address == NULL)
+      {
+        return NULL;
+      }
+
+      credential = cardano_enterprise_address_get_payment_credential(enterprise_address);
+      cardano_enterprise_address_unref(&enterprise_address);
+      break;
+    }
+    case CARDANO_ADDRESS_TYPE_BYRON:
+    case CARDANO_ADDRESS_TYPE_REWARD_KEY:
+    case CARDANO_ADDRESS_TYPE_REWARD_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_POINTER_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY:
+    default:
+    {
+      credential = NULL;
+    }
+  }
+
+  cardano_blake2b_hash_t* pub_key_hash = cardano_credential_get_hash(credential);
+
+  cardano_credential_unref(&credential);
+
+  return pub_key_hash;
+}
+
+cardano_error_t
+_cardano_add_input_signers(
+  cardano_blake2b_hash_set_t*      unique_signers,
+  cardano_transaction_input_set_t* set,
+  cardano_utxo_list_t*             resolved_inputs)
+{
+  if ((unique_signers == NULL) || (set == NULL) || (resolved_inputs == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t size = cardano_transaction_input_set_get_length(set);
+
+  if (size == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_transaction_input_t* input  = NULL;
+    cardano_error_t              result = cardano_transaction_input_set_get(set, i, &input);
+    cardano_transaction_input_unref(&input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_utxo_t* utxo = cardano_utxo_list_find(resolved_inputs, find_utxo, (void*)input);
+    cardano_utxo_unref(&utxo);
+
+    if (utxo == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+    cardano_transaction_output_unref(&output);
+
+    cardano_address_t* address = cardano_transaction_output_get_address(output);
+    cardano_address_unref(&address);
+
+    cardano_blake2b_hash_t* pub_key_hash = _cardano_get_payment_pub_key_hash(address);
+
+    if (pub_key_hash == NULL)
+    {
+      continue;
+    }
+
+    if (!_cardano_blake2b_hash_set_has(unique_signers, pub_key_hash))
+    {
+      result = cardano_blake2b_hash_set_add(unique_signers, pub_key_hash);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_unref(&pub_key_hash);
+        return result;
+      }
+    }
+
+    cardano_blake2b_hash_unref(&pub_key_hash);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_get_bootstrap_key_hash(cardano_address_t* address, cardano_blake2b_hash_t** root)
+{
+  if ((address == NULL) || (root == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *root = NULL;
+
+  cardano_address_type_t type;
+
+  cardano_error_t result = cardano_address_get_type(address, &type);
+
+  if ((result != CARDANO_SUCCESS) || (type != CARDANO_ADDRESS_TYPE_BYRON))
+  {
+    return result;
+  }
+
+  cardano_byron_address_t* byron_address = NULL;
+
+  result = cardano_byron_address_from_address(address, &byron_address);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_byron_address_get_root(byron_address, root);
+
+  cardano_byron_address_unref(&byron_address);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_get_bootstrap_witness_attributes(cardano_address_t* address, cardano_buffer_t** attributes)
+{
+  if ((address == NULL) || (attributes == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_type_t type;
+
+  cardano_error_t result = cardano_address_get_type(address, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (type != CARDANO_ADDRESS_TYPE_BYRON)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_TYPE;
+  }
+
+  cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cardano_address_get_bytes(address), cardano_address_get_bytes_size(address));
+
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  int64_t            array_size = 0;
+  cardano_cbor_tag_t tag        = CARDANO_ENCODED_CBOR_DATA_ITEM;
+  cardano_buffer_t*  payload    = NULL;
+
+  result = cardano_cbor_reader_read_start_array(reader, &array_size);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_reader_read_tag(reader, &tag);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (tag != CARDANO_ENCODED_CBOR_DATA_ITEM))
+  {
+    result = CARDANO_ERROR_INVALID_CBOR_VALUE;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_reader_read_bytestring(reader, &payload);
+  }
+
+  cardano_cbor_reader_unref(&reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  reader = cardano_cbor_reader_new(cardano_buffer_get_data(payload), cardano_buffer_get_size(payload));
+
+  cardano_buffer_unref(&payload);
+
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_cbor_reader_read_start_array(reader, &array_size);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_reader_skip_value(reader);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_reader_read_encoded_value(reader, attributes);
+  }
+
+  cardano_cbor_reader_unref(&reader);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_add_input_bootstrap_signers(
+  cardano_blake2b_hash_set_t*      roots,
+  cardano_utxo_list_t*             bootstrap_signers,
+  cardano_transaction_input_set_t* set,
+  cardano_utxo_list_t*             resolved_inputs)
+{
+  if ((roots == NULL) || (bootstrap_signers == NULL) || (set == NULL) || (resolved_inputs == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t size = cardano_transaction_input_set_get_length(set);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_transaction_input_t* input  = NULL;
+    cardano_error_t              result = cardano_transaction_input_set_get(set, i, &input);
+    cardano_transaction_input_unref(&input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_utxo_t* utxo = cardano_utxo_list_find(resolved_inputs, find_utxo, (void*)input);
+    cardano_utxo_unref(&utxo);
+
+    if (utxo == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+    cardano_transaction_output_unref(&output);
+
+    cardano_address_t* address = cardano_transaction_output_get_address(output);
+    cardano_address_unref(&address);
+
+    cardano_blake2b_hash_t* root = NULL;
+
+    result = _cardano_get_bootstrap_key_hash(address, &root);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (root == NULL)
+    {
+      continue;
+    }
+
+    if (!_cardano_blake2b_hash_set_has(roots, root))
+    {
+      result = cardano_blake2b_hash_set_add(roots, root);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_utxo_list_add(bootstrap_signers, utxo);
+      }
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_unref(&root);
+        return result;
+      }
+    }
+
+    cardano_blake2b_hash_unref(&root);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_add_withdrawals(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_withdrawal_map_t*   withdrawals)
+{
+  if (unique_signers == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (withdrawals == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  const size_t size = cardano_withdrawal_map_get_length(withdrawals);
+
+  if (size == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_reward_address_t* reward_address = NULL;
+    cardano_error_t           result         = cardano_withdrawal_map_get_key_at(withdrawals, i, &reward_address);
+    cardano_reward_address_unref(&reward_address);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_credential_t*   credential   = cardano_reward_address_get_credential(reward_address);
+    cardano_blake2b_hash_t* pub_key_hash = cardano_credential_get_hash(credential);
+
+    cardano_credential_unref(&credential);
+
+    cardano_credential_type_t type;
+
+    result = cardano_credential_get_type(credential, &type);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&pub_key_hash);
+
+      return result;
+    }
+
+    if (type != CARDANO_CREDENTIAL_TYPE_KEY_HASH)
+    {
+      cardano_blake2b_hash_unref(&pub_key_hash);
+
+      continue;
+    }
+
+    if (pub_key_hash == NULL)
+    {
+      return CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    if (!_cardano_blake2b_hash_set_has(unique_signers, pub_key_hash))
+    {
+      result = cardano_blake2b_hash_set_add(unique_signers, pub_key_hash);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_unref(&pub_key_hash);
+
+        return result;
+      }
+    }
+
+    cardano_blake2b_hash_unref(&pub_key_hash);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_process_credential(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_credential_t*       credential)
+{
+  if (unique_signers == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t           result;
+  cardano_credential_type_t cred_type;
+  result = cardano_credential_get_type(credential, &cred_type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (cred_type != CARDANO_CREDENTIAL_TYPE_KEY_HASH)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_blake2b_hash_t* pub_key_hash = cardano_credential_get_hash(credential);
+
+  if (pub_key_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (!_cardano_blake2b_hash_set_has(unique_signers, pub_key_hash))
+  {
+    result = cardano_blake2b_hash_set_add(unique_signers, pub_key_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&pub_key_hash);
+      return result;
+    }
+  }
+
+  cardano_blake2b_hash_unref(&pub_key_hash);
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Adds the operator and, unless exempt in the supplied pool state, the pool owners.
+ * \param[in,out] unique_signers The signer set to extend.
+ * \param[in] certificate The certificate or certificate set.
+ * \param[in] pool_state Known latest registered pool parameters.
+ * \param[in] pool_state_size Number of entries; zero before Dijkstra.
+ * \return Success or an allocation/access error.
+ */
+static cardano_error_t
+process_pool_registration_with_state(
+  cardano_blake2b_hash_set_t*   unique_signers,
+  cardano_certificate_t*        certificate,
+  cardano_pool_params_t* const* pool_state,
+  const size_t                  pool_state_size)
+{
+  cardano_error_t                   result;
+  cardano_pool_registration_cert_t* registration = NULL;
+
+  result = cardano_certificate_to_pool_registration(certificate, &registration);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_pool_params_t* params = NULL;
+  result                        = cardano_pool_registration_cert_get_params(registration, &params);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_pool_registration_cert_unref(&registration);
+
+    return result;
+  }
+
+  cardano_blake2b_hash_t* operator_key_hash = NULL;
+  result                                    = cardano_pool_params_get_operator_key_hash(params, &operator_key_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_pool_params_unref(&params);
+    cardano_pool_registration_cert_unref(&registration);
+
+    return result;
+  }
+
+  if (!_cardano_blake2b_hash_set_has(unique_signers, operator_key_hash))
+  {
+    result = cardano_blake2b_hash_set_add(unique_signers, operator_key_hash);
+  }
+
+  cardano_blake2b_hash_unref(&operator_key_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_pool_params_unref(&params);
+    cardano_pool_registration_cert_unref(&registration);
+
+    return result;
+  }
+
+  bool owners_required = true;
+  for (size_t i = 0U; (result == CARDANO_SUCCESS) && (i < pool_state_size); ++i)
+  {
+    cardano_blake2b_hash_t* known_operator    = NULL;
+    cardano_blake2b_hash_t* proposed_operator = NULL;
+    result                                    = cardano_pool_params_get_operator_key_hash(pool_state[i], &known_operator);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_pool_params_get_operator_key_hash(params, &proposed_operator);
+    }
+    const bool matches = cardano_blake2b_hash_equals(known_operator, proposed_operator);
+    cardano_blake2b_hash_unref(&known_operator);
+    cardano_blake2b_hash_unref(&proposed_operator);
+    if ((result == CARDANO_SUCCESS) && matches)
+    {
+      result = cardano_pool_params_requires_owner_witnesses(params, pool_state[i], &owners_required);
+      break;
+    }
+  }
+  if ((result != CARDANO_SUCCESS) || !owners_required)
+  {
+    cardano_pool_params_unref(&params);
+    cardano_pool_registration_cert_unref(&registration);
+    return result;
+  }
+
+  cardano_pool_owners_t* owners = NULL;
+  result                        = cardano_pool_params_get_owners(params, &owners);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_pool_params_unref(&params);
+    cardano_pool_registration_cert_unref(&registration);
+
+    return result;
+  }
+
+  const size_t owners_size = cardano_pool_owners_get_length(owners);
+
+  for (size_t j = 0U; j < owners_size; ++j)
+  {
+    cardano_blake2b_hash_t* pub_key_hash = NULL;
+    result                               = cardano_pool_owners_get(owners, j, &pub_key_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_pool_owners_unref(&owners);
+      cardano_pool_params_unref(&params);
+      cardano_pool_registration_cert_unref(&registration);
+
+      return result;
+    }
+
+    if (!_cardano_blake2b_hash_set_has(unique_signers, pub_key_hash))
+    {
+      result = cardano_blake2b_hash_set_add(unique_signers, pub_key_hash);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_unref(&pub_key_hash);
+        cardano_pool_owners_unref(&owners);
+        cardano_pool_params_unref(&params);
+        cardano_pool_registration_cert_unref(&registration);
+
+        return result;
+      }
+    }
+
+    cardano_blake2b_hash_unref(&pub_key_hash);
+  }
+
+  cardano_pool_owners_unref(&owners);
+  cardano_pool_params_unref(&params);
+  cardano_pool_registration_cert_unref(&registration);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_process_pool_retirement(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_certificate_t*      certificate)
+{
+  cardano_error_t                 result;
+  cardano_pool_retirement_cert_t* retirement = NULL;
+
+  result = cardano_certificate_to_pool_retirement(certificate, &retirement);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_t* pub_key_hash = cardano_pool_retirement_cert_get_pool_key_hash(retirement);
+
+  if (pub_key_hash == NULL)
+  {
+    cardano_pool_retirement_cert_unref(&retirement);
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (!_cardano_blake2b_hash_set_has(unique_signers, pub_key_hash))
+  {
+    result = cardano_blake2b_hash_set_add(unique_signers, pub_key_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&pub_key_hash);
+      cardano_pool_retirement_cert_unref(&retirement);
+
+      return result;
+    }
+  }
+
+  cardano_blake2b_hash_unref(&pub_key_hash);
+  cardano_pool_retirement_cert_unref(&retirement);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_process_auth_committee_hot(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_certificate_t*      certificate)
+{
+  cardano_error_t                    result;
+  cardano_auth_committee_hot_cert_t* auth_committee = NULL;
+
+  result = cardano_certificate_to_auth_committee_hot(certificate, &auth_committee);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_credential_t* credential = NULL;
+  result                           = cardano_auth_committee_hot_cert_get_cold_cred(auth_committee, &credential);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_auth_committee_hot_cert_unref(&auth_committee);
+
+    return result;
+  }
+
+  result = _process_credential(unique_signers, credential);
+  cardano_credential_unref(&credential);
+  cardano_auth_committee_hot_cert_unref(&auth_committee);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_get_certificate_credential(
+  cardano_certificate_t* certificate,
+  cardano_cert_type_t    type,
+  cardano_credential_t** credential)
+{
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *credential = NULL;
+
+  cardano_error_t result;
+
+  switch (type)
+  {
+    case CARDANO_CERT_TYPE_STAKE_DEREGISTRATION:
+    {
+      cardano_stake_deregistration_cert_t* deregistration = NULL;
+      result                                              = cardano_certificate_to_stake_deregistration(certificate, &deregistration);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_stake_deregistration_cert_get_credential(deregistration);
+      cardano_stake_deregistration_cert_unref(&deregistration);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DELEGATION:
+    {
+      cardano_stake_delegation_cert_t* delegation = NULL;
+      result                                      = cardano_certificate_to_stake_delegation(certificate, &delegation);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_stake_delegation_cert_get_credential(delegation);
+      cardano_stake_delegation_cert_unref(&delegation);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_REGISTRATION:
+    {
+      cardano_registration_cert_t* registration = NULL;
+      result                                    = cardano_certificate_to_registration(certificate, &registration);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_registration_cert_get_stake_credential(registration);
+      cardano_registration_cert_unref(&registration);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_UNREGISTRATION:
+    {
+      cardano_unregistration_cert_t* unregistration = NULL;
+      result                                        = cardano_certificate_to_unregistration(certificate, &unregistration);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_unregistration_cert_get_credential(unregistration);
+      cardano_unregistration_cert_unref(&unregistration);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_VOTE_DELEGATION:
+    {
+      cardano_vote_delegation_cert_t* vote_delegation = NULL;
+      result                                          = cardano_certificate_to_vote_delegation(certificate, &vote_delegation);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_vote_delegation_cert_get_credential(vote_delegation);
+      cardano_vote_delegation_cert_unref(&vote_delegation);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION:
+    {
+      cardano_stake_vote_delegation_cert_t* stake_vote_delegation = NULL;
+      result                                                      = cardano_certificate_to_stake_vote_delegation(certificate, &stake_vote_delegation);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_stake_vote_delegation_cert_get_credential(stake_vote_delegation);
+      cardano_stake_vote_delegation_cert_unref(&stake_vote_delegation);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION:
+    {
+      cardano_stake_registration_delegation_cert_t* stake_registration_delegation = NULL;
+      result                                                                      = cardano_certificate_to_stake_registration_delegation(certificate, &stake_registration_delegation);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_stake_registration_delegation_cert_get_credential(stake_registration_delegation);
+      cardano_stake_registration_delegation_cert_unref(&stake_registration_delegation);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION:
+    {
+      cardano_vote_registration_delegation_cert_t* vote_registration_delegation = NULL;
+      result                                                                    = cardano_certificate_to_vote_registration_delegation(certificate, &vote_registration_delegation);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_vote_registration_delegation_cert_get_credential(vote_registration_delegation);
+      cardano_vote_registration_delegation_cert_unref(&vote_registration_delegation);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION:
+    {
+      cardano_stake_vote_registration_delegation_cert_t* stake_vote_registration_delegation = NULL;
+      result                                                                                = cardano_certificate_to_stake_vote_registration_delegation(certificate, &stake_vote_registration_delegation);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_stake_vote_registration_delegation_cert_get_credential(stake_vote_registration_delegation);
+      cardano_stake_vote_registration_delegation_cert_unref(&stake_vote_registration_delegation);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD:
+    {
+      cardano_resign_committee_cold_cert_t* resign_committee = NULL;
+      result                                                 = cardano_certificate_to_resign_committee_cold(certificate, &resign_committee);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_resign_committee_cold_cert_get_credential(resign_committee);
+      cardano_resign_committee_cold_cert_unref(&resign_committee);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_DREP_REGISTRATION:
+    {
+      cardano_register_drep_cert_t* register_drep = NULL;
+      result                                      = cardano_certificate_to_register_drep(certificate, &register_drep);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_register_drep_cert_get_credential(register_drep);
+      cardano_register_drep_cert_unref(&register_drep);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_DREP_UNREGISTRATION:
+    {
+      cardano_unregister_drep_cert_t* unregister_drep = NULL;
+      result                                          = cardano_certificate_to_unregister_drep(certificate, &unregister_drep);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_unregister_drep_cert_get_credential(unregister_drep);
+      cardano_unregister_drep_cert_unref(&unregister_drep);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_UPDATE_DREP:
+    {
+      cardano_update_drep_cert_t* update_drep = NULL;
+      result                                  = cardano_certificate_to_update_drep(certificate, &update_drep);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *credential = cardano_update_drep_cert_get_credential(update_drep);
+      cardano_update_drep_cert_unref(&update_drep);
+
+      break;
+    }
+    default:
+      return CARDANO_SUCCESS;
+  }
+
+  if (*credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_process_certificate_with_credential(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_certificate_t*      certificate,
+  cardano_cert_type_t         type)
+{
+  cardano_credential_t* credential = NULL;
+  cardano_error_t       result     = _cardano_get_certificate_credential(certificate, type, &credential);
+
+  if ((result != CARDANO_SUCCESS) || (credential == NULL))
+  {
+    return result;
+  }
+
+  result = _process_credential(unique_signers, credential);
+  cardano_credential_unref(&credential);
+
+  return result;
+}
+
+/**
+ * \brief Collects certificate signers using the Dijkstra pool-owner exemption.
+ * \param[in,out] unique_signers The signer set to extend.
+ * \param[in] certificates The certificate or certificate set.
+ * \param[in] pool_state Known latest registered pool parameters.
+ * \param[in] pool_state_size Number of entries; zero before Dijkstra.
+ * \return Success or an allocation/access error.
+ */
+static cardano_error_t
+add_certificates_with_pool_state(
+  cardano_blake2b_hash_set_t*   unique_signers,
+  cardano_certificate_set_t*    certificates,
+  cardano_pool_params_t* const* pool_state,
+  const size_t                  pool_state_size)
+{
+  if (unique_signers == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (certificates == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  const size_t size = cardano_certificate_set_get_length(certificates);
+
+  if (size == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_certificate_t* certificate = NULL;
+    cardano_error_t        result      = cardano_certificate_set_get(certificates, i, &certificate);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_cert_type_t type;
+    result = cardano_cert_get_type(certificate, &type);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_certificate_unref(&certificate);
+
+      return result;
+    }
+
+    switch (type)
+    {
+      case CARDANO_CERT_TYPE_STAKE_DEREGISTRATION:
+      case CARDANO_CERT_TYPE_STAKE_DELEGATION:
+      case CARDANO_CERT_TYPE_REGISTRATION:
+      case CARDANO_CERT_TYPE_UNREGISTRATION:
+      case CARDANO_CERT_TYPE_VOTE_DELEGATION:
+      case CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION:
+      case CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION:
+      case CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION:
+      case CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION:
+      case CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD:
+      case CARDANO_CERT_TYPE_DREP_REGISTRATION:
+      case CARDANO_CERT_TYPE_DREP_UNREGISTRATION:
+      case CARDANO_CERT_TYPE_UPDATE_DREP:
+      {
+        result = _process_certificate_with_credential(unique_signers, certificate, type);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_certificate_unref(&certificate);
+
+          return result;
+        }
+
+        break;
+      }
+      case CARDANO_CERT_TYPE_POOL_REGISTRATION:
+      {
+        result = process_pool_registration_with_state(unique_signers, certificate, pool_state, pool_state_size);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_certificate_unref(&certificate);
+
+          return result;
+        }
+
+        break;
+      }
+      case CARDANO_CERT_TYPE_POOL_RETIREMENT:
+      {
+        result = _process_pool_retirement(unique_signers, certificate);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_certificate_unref(&certificate);
+
+          return result;
+        }
+
+        break;
+      }
+      case CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT:
+      {
+        result = _process_auth_committee_hot(unique_signers, certificate);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_certificate_unref(&certificate);
+
+          return result;
+        }
+
+        break;
+      }
+      default:
+        break;
+    }
+    cardano_certificate_unref(&certificate);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_voting_procedures_pub_key_hashes(
+  cardano_blake2b_hash_set_t*  unique_signers,
+  cardano_voting_procedures_t* procedures)
+{
+  if (unique_signers == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (procedures == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_voter_list_t* voters = NULL;
+  cardano_error_t       result = cardano_voting_procedures_get_voters(procedures, &voters);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_voter_list_unref(&voters);
+
+    return result;
+  }
+
+  const size_t size = cardano_voter_list_get_length(voters);
+
+  if (size == 0U)
+  {
+    cardano_voter_list_unref(&voters);
+    return CARDANO_SUCCESS;
+  }
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_voter_t* voter = NULL;
+    result                 = cardano_voter_list_get(voters, i, &voter);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_voter_unref(&voter);
+      cardano_voter_list_unref(&voters);
+
+      return result;
+    }
+
+    cardano_credential_t* credential = cardano_voter_get_credential(voter);
+
+    cardano_credential_type_t cred_type;
+    cardano_credential_unref(&credential);
+
+    result = cardano_credential_get_type(credential, &cred_type);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_voter_unref(&voter);
+      cardano_voter_list_unref(&voters);
+
+      return result;
+    }
+
+    if (cred_type != CARDANO_CREDENTIAL_TYPE_KEY_HASH)
+    {
+      cardano_voter_unref(&voter);
+      continue;
+    }
+
+    cardano_blake2b_hash_t* pub_key_hash = cardano_credential_get_hash(credential);
+
+    if (pub_key_hash == NULL)
+    {
+      cardano_voter_unref(&voter);
+      cardano_voter_list_unref(&voters);
+
+      return CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    if (!_cardano_blake2b_hash_set_has(unique_signers, pub_key_hash))
+    {
+      result = cardano_blake2b_hash_set_add(unique_signers, pub_key_hash);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_unref(&pub_key_hash);
+        cardano_voter_unref(&voter);
+        cardano_voter_list_unref(&voters);
+
+        return result;
+      }
+    }
+
+    cardano_blake2b_hash_unref(&pub_key_hash);
+    cardano_voter_unref(&voter);
+  }
+
+  cardano_voter_list_unref(&voters);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_get_unique_signers_with_pool_state(
+  cardano_transaction_t*        tx,
+  cardano_utxo_list_t*          resolved_inputs,
+  cardano_blake2b_hash_set_t**  unique_signers,
+  cardano_pool_params_t* const* pool_state,
+  const size_t                  pool_state_size)
+{
+  if ((tx == NULL) || (unique_signers == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t*      body              = cardano_transaction_get_body(tx);
+  cardano_transaction_input_set_t* inputs            = cardano_transaction_body_get_inputs(body);
+  cardano_transaction_input_set_t* collateral_inputs = cardano_transaction_body_get_collateral(body);
+
+  cardano_transaction_body_unref(&body);
+  cardano_transaction_input_set_unref(&inputs);
+  cardano_transaction_input_set_unref(&collateral_inputs);
+
+  if (inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_blake2b_hash_set_new(unique_signers);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_set_t* required_signers = cardano_transaction_body_get_required_signers(body);
+
+  result = _cardano_add_required_signers(*unique_signers, required_signers);
+
+  cardano_blake2b_hash_set_unref(&required_signers);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(unique_signers);
+
+    return result;
+  }
+
+  if (resolved_inputs != NULL)
+  {
+    result = _cardano_add_input_signers(*unique_signers, inputs, resolved_inputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_set_unref(unique_signers);
+
+      return result;
+    }
+
+    if (collateral_inputs != NULL)
+    {
+      result = _cardano_add_input_signers(*unique_signers, collateral_inputs, resolved_inputs);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_set_unref(unique_signers);
+
+        return result;
+      }
+    }
+  }
+
+  cardano_withdrawal_map_t* withdrawals = cardano_transaction_body_get_withdrawals(body);
+  cardano_withdrawal_map_unref(&withdrawals);
+
+  result = _cardano_add_withdrawals(*unique_signers, withdrawals);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(unique_signers);
+
+    return result;
+  }
+
+  cardano_certificate_set_t* certificates = cardano_transaction_body_get_certificates(body);
+  cardano_certificate_set_unref(&certificates);
+
+  result = add_certificates_with_pool_state(*unique_signers, certificates, pool_state, pool_state_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(unique_signers);
+
+    return result;
+  }
+
+  cardano_voting_procedures_t* procedures = cardano_transaction_body_get_voting_procedures(body);
+  cardano_voting_procedures_unref(&procedures);
+
+  result = _cardano_voting_procedures_pub_key_hashes(*unique_signers, procedures);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(unique_signers);
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_get_bootstrap_signers(
+  cardano_transaction_t* tx,
+  cardano_utxo_list_t*   resolved_inputs,
+  cardano_utxo_list_t**  bootstrap_signers)
+{
+  if ((tx == NULL) || (bootstrap_signers == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t*      body              = cardano_transaction_get_body(tx);
+  cardano_transaction_input_set_t* inputs            = cardano_transaction_body_get_inputs(body);
+  cardano_transaction_input_set_t* collateral_inputs = cardano_transaction_body_get_collateral(body);
+
+  cardano_transaction_body_unref(&body);
+  cardano_transaction_input_set_unref(&inputs);
+  cardano_transaction_input_set_unref(&collateral_inputs);
+
+  if (inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_utxo_list_new(bootstrap_signers);
+
+  if ((result != CARDANO_SUCCESS) || (resolved_inputs == NULL))
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_set_t* roots = NULL;
+
+  result = cardano_blake2b_hash_set_new(&roots);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = _cardano_add_input_bootstrap_signers(roots, *bootstrap_signers, inputs, resolved_inputs);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (collateral_inputs != NULL))
+  {
+    result = _cardano_add_input_bootstrap_signers(roots, *bootstrap_signers, collateral_inputs, resolved_inputs);
+  }
+
+  cardano_blake2b_hash_set_unref(&roots);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(bootstrap_signers);
+  }
+
+  return result;
+}
+
+cardano_error_t
+_process_pool_registration(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_certificate_t*      certificate)
+{
+  return process_pool_registration_with_state(unique_signers, certificate, NULL, 0U);
+}
+
+cardano_error_t
+_cardano_add_certificates_pub_key_hashes(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_certificate_set_t*  certificates)
+{
+  return add_certificates_with_pool_state(unique_signers, certificates, NULL, 0U);
+}
+
+cardano_error_t
+_cardano_get_unique_signers(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  cardano_blake2b_hash_set_t** unique_signers)
+{
+  return _cardano_get_unique_signers_with_pool_state(tx, resolved_inputs, unique_signers, NULL, 0U);
+}
+
+cardano_error_t
+_cardano_validate_pool_state(cardano_pool_params_t* const* pool_state, const size_t pool_state_size)
+{
+  if ((pool_state == NULL) && (pool_state_size != 0U))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  for (size_t i = 0U; i < pool_state_size; ++i)
+  {
+    cardano_blake2b_hash_t* hash   = NULL;
+    cardano_error_t         result = cardano_pool_params_get_operator_key_hash(pool_state[i], &hash);
+    for (size_t j = 0U; (result == CARDANO_SUCCESS) && (j < i); ++j)
+    {
+      cardano_blake2b_hash_t* other = NULL;
+      result                        = cardano_pool_params_get_operator_key_hash(pool_state[j], &other);
+      if ((result == CARDANO_SUCCESS) && cardano_blake2b_hash_equals(hash, other))
+      {
+        result = CARDANO_ERROR_DUPLICATED_KEY;
+      }
+      cardano_blake2b_hash_unref(&other);
+    }
+    cardano_blake2b_hash_unref(&hash);
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_builder/balancing/internals/unique_signers.h b/vendor/src/transaction_builder/balancing/internals/unique_signers.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/internals/unique_signers.h
@@ -0,0 +1,467 @@
+/**
+ * \file unique_signers.h
+ *
+ * \author angel.castillo
+ * \date   Nov 07, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_SIGNERS_COUNT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_SIGNERS_COUNT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/pool_params/pool_params.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Checks if a specified public key hash exists within a Cardano Blake2b hash set.
+ *
+ * This function determines whether a given public key hash is present in the specified `set`
+ * of Blake2b hashes. It is typically used to verify if a particular signer’s hash has already
+ * been added to a collection of required or unique signers.
+ *
+ * \param[in] set A pointer to an initialized \ref cardano_blake2b_hash_set_t object representing the set
+ *                of hashes to search. This parameter is required and must not be NULL.
+ * \param[in] hash A pointer to a \ref cardano_blake2b_hash_t object representing the hash to search for within `set`.
+ *                 This parameter is required and must not be NULL.
+ *
+ * \return A boolean value indicating the presence of the specified hash in the set:
+ *         - `true` if the hash exists in `set`
+ *         - `false` if the hash does not exist in `set` or if an error occurs
+ */
+bool
+_cardano_blake2b_hash_set_has(
+  cardano_blake2b_hash_set_t*   set,
+  const cardano_blake2b_hash_t* hash);
+
+/**
+ * \brief Adds public key hashes from a set of required signers to the unique signers set.
+ *
+ * This function iterates through a set of required public key hashes (signers) and adds each unique hash
+ * to the specified `unique_signers` set.
+ *
+ * \param[in,out] unique_signers A pointer to an initialized \ref cardano_blake2b_hash_set_t object where the required
+ *                               public key hashes will be added. This parameter must not be NULL.
+ * \param[in] required_signers A pointer to an initialized \ref cardano_blake2b_hash_set_t object representing the set
+ *                             of required public key hashes to be added to `unique_signers`. This parameter is required
+ *                             and must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if all required signers
+ *         were successfully added to `unique_signers`, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (`unique_signers` or `required_signers`) are NULL.
+ */
+cardano_error_t
+_cardano_add_required_signers(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_blake2b_hash_set_t* required_signers);
+
+/**
+ * \brief Retrieves the public key hash associated with the payment credential of a Cardano address.
+ *
+ * This function extracts the public key hash from the payment credential of the specified Cardano address,
+ * if the address contains a payment credential represented by a key hash.
+ *
+ * \param[in] address A pointer to an initialized \ref cardano_address_t object representing the Cardano address
+ *                    from which the payment public key hash will be retrieved. This parameter is required and must not be NULL.
+ *
+ * \return A pointer to a \ref cardano_blake2b_hash_t object containing the public key hash associated with the payment
+ *         credential, or NULL if the address does not contain a valid payment key hash credential or if an error occurs.
+ *         The caller is responsible for managing the lifecycle of this object. Specifically, the caller must release it by
+ *         calling \ref cardano_blake2b_hash_unref once it is no longer needed.
+ */
+cardano_blake2b_hash_t*
+_cardano_get_payment_pub_key_hash(cardano_address_t* address);
+
+/**
+ * \brief Adds unique public key hashes required for a set of Cardano transaction inputs.
+ *
+ * This function processes a set of Cardano transaction inputs and their corresponding resolved UTXOs,
+ * extracts the public key hashes required for each input, and adds these hashes to the provided `unique_signers` set.
+ * Each input may require authorization from different signers, identified by their public key hashes.
+ *
+ * \param[in,out] unique_signers A pointer to an initialized \ref cardano_blake2b_hash_set_t object where the unique
+ *                               public key hashes required for the transaction inputs will be added. This parameter must not be NULL.
+ * \param[in] set A pointer to an initialized \ref cardano_transaction_input_set_t object representing the set of transaction
+ *                inputs to be processed. This parameter is required and must not be NULL.
+ * \param[in] resolved_inputs A pointer to an initialized \ref cardano_utxo_list_t object containing the list of resolved UTXOs
+ *                            (inputs) corresponding to the transaction inputs. This parameter is required and must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the public key hashes
+ *         were successfully extracted and added to `unique_signers`, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (`unique_signers`, `set`, or `resolved_inputs`) are NULL.
+ */
+cardano_error_t
+_cardano_add_input_signers(
+  cardano_blake2b_hash_set_t*      unique_signers,
+  cardano_transaction_input_set_t* set,
+  cardano_utxo_list_t*             resolved_inputs);
+
+/**
+ * \brief Retrieves the hash that identifies the owner of a Byron address, the key that signs for it with a bootstrap witness.
+ *
+ * A Byron address embeds its root, the hash of its type, the spending data (the extended public key of its owner) and
+ * its attributes. The ledger identifies the witness a Byron input needs by this root, so two inputs held by the same
+ * Byron address are covered by a single bootstrap witness.
+ *
+ * \param[in] address A pointer to an initialized \ref cardano_address_t object representing the Cardano address
+ *                    whose root will be retrieved. This parameter is required and must not be NULL.
+ * \param[out] root On success, a new reference to the root of the Byron address, or NULL if the address is not a Byron
+ *                  address. The caller must release it by calling \ref cardano_blake2b_hash_unref once it is no longer
+ *                  needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the address was
+ *         inspected, whether or not it is a Byron address, \ref CARDANO_ERROR_POINTER_IS_NULL if `address` or `root` is
+ *         NULL, or an appropriate error code if the root of a Byron address could not be retrieved.
+ */
+cardano_error_t
+_cardano_get_bootstrap_key_hash(cardano_address_t* address, cardano_blake2b_hash_t** root);
+
+/**
+ * \brief Retrieves the attributes a bootstrap witness for a Byron address carries.
+ *
+ * The bootstrap witness of a Byron address holds the attributes of the address, as the address encodes them, so the
+ * ledger can recompute the root of the address from the witness. This function returns the CBOR encoded attributes
+ * map, exactly as it appears in the payload of the address.
+ *
+ * \param[in] address A pointer to an initialized \ref cardano_address_t object representing a Byron address. This
+ *                    parameter is required and must not be NULL.
+ * \param[out] attributes On success, a new buffer holding the CBOR encoded attributes of the address. The caller must
+ *                        release it by calling \ref cardano_buffer_unref once it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the attributes
+ *         were retrieved, \ref CARDANO_ERROR_POINTER_IS_NULL if `address` or `attributes` is NULL, or an appropriate
+ *         error code if the address is not a Byron address.
+ */
+cardano_error_t
+_cardano_get_bootstrap_witness_attributes(cardano_address_t* address, cardano_buffer_t** attributes);
+
+/**
+ * \brief Adds the owners of the Byron inputs of a set of Cardano transaction inputs to a list of bootstrap signers.
+ *
+ * This function processes a set of Cardano transaction inputs and their corresponding resolved UTXOs and, for each
+ * input held by a Byron address whose root is not yet in `roots`, adds the root to `roots` and the resolved UTXO to
+ * `bootstrap_signers`. Inputs held by any other kind of address are ignored.
+ *
+ * \param[in,out] roots A pointer to an initialized \ref cardano_blake2b_hash_set_t object holding the roots of the Byron
+ *                      owners already found. This parameter must not be NULL.
+ * \param[in,out] bootstrap_signers A pointer to an initialized \ref cardano_utxo_list_t object that receives one resolved
+ *                                  UTXO per new Byron owner. This parameter must not be NULL.
+ * \param[in] set A pointer to an initialized \ref cardano_transaction_input_set_t object representing the set of transaction
+ *                inputs to be processed. This parameter is required and must not be NULL.
+ * \param[in] resolved_inputs A pointer to an initialized \ref cardano_utxo_list_t object containing the list of resolved UTXOs
+ *                            (inputs) corresponding to the transaction inputs. This parameter is required and must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the Byron owners
+ *         were added, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if a required parameter is NULL or \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if an input is not resolved.
+ */
+cardano_error_t
+_cardano_add_input_bootstrap_signers(
+  cardano_blake2b_hash_set_t*      roots,
+  cardano_utxo_list_t*             bootstrap_signers,
+  cardano_transaction_input_set_t* set,
+  cardano_utxo_list_t*             resolved_inputs);
+
+/**
+ * \brief Adds unique public key hashes required for a set of Cardano withdrawals.
+ *
+ * This function processes a set of Cardano withdrawals, extracts the public key hashes associated
+ * with each withdrawal address, and adds these hashes to the provided `unique_signers` set. Each withdrawal
+ * may require authorization from different signers, identified by their public key hashes.
+ *
+ * \param[in,out] unique_signers A pointer to an initialized \ref cardano_blake2b_hash_set_t object where the unique
+ *                               public key hashes required for the withdrawals will be added. This parameter must not be NULL.
+ * \param[in] withdrawals A pointer to an initialized \ref cardano_withdrawal_map_t object representing the set of withdrawals
+ *                        to be processed. This parameter is required and must not be NULL. If the map is empty, the function
+ *                        will complete successfully without modifying `unique_signers`.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the public key hashes
+ *         were successfully extracted and added to `unique_signers`, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (`unique_signers` or `withdrawals`) are NULL.
+ */
+cardano_error_t
+_cardano_add_withdrawals(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_withdrawal_map_t*   withdrawals);
+
+/**
+ * \brief Processes a Cardano credential by extracting and adding its unique public key hash.
+ *
+ * This function processes a given Cardano credential, extracts the public key hash associated
+ * with it if it represents a key hash credential type, and adds this hash to the provided `unique_signers` set.
+ * This is commonly used in processing various certificate types where credentials are involved.
+ *
+ * \param[in,out] unique_signers A pointer to an initialized \ref cardano_blake2b_hash_set_t object where the unique
+ *                               public key hash required for the credential will be added. This parameter must not be NULL.
+ * \param[in] credential A pointer to an initialized \ref cardano_credential_t object representing the credential
+ *                       to be processed. This parameter is required and must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the public key hash
+ *         was successfully extracted and added to `unique_signers`, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (`unique_signers` or `credential`) are NULL.
+ */
+cardano_error_t
+_process_credential(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_credential_t*       credential);
+
+/**
+ * \brief Processes a pool registration certificate by extracting and adding its unique public key hashes.
+ *
+ * This function processes a Cardano pool registration certificate, extracts the public key hashes of the pool
+ * operator and of the pool owners, and adds these hashes to the provided `unique_signers` set. This certificate type
+ * represents the registration of a staking pool within the Cardano network, and the ledger requires the signature of
+ * the operator and of every owner of the pool.
+ *
+ * \param[in,out] unique_signers A pointer to an initialized \ref cardano_blake2b_hash_set_t object where the unique
+ *                               public key hashes required for the pool registration certificate will be added.
+ *                               This parameter must not be NULL.
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object representing the pool registration
+ *                        certificate to be processed. This parameter is required and must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the public key hashes
+ *         were successfully extracted and added to `unique_signers`, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (`unique_signers` or `certificate`) are NULL.
+ */
+cardano_error_t
+_process_pool_registration(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_certificate_t*      certificate);
+
+/**
+ * \brief Processes a pool retirement certificate by extracting and adding its unique public key hash.
+ *
+ * This function processes a Cardano pool retirement certificate, extracts the public key hash associated
+ * with the retiring pool, and adds this hash to the provided `unique_signers` set. This certificate type
+ * represents the retirement of a staking pool within the Cardano network.
+ *
+ * \param[in,out] unique_signers A pointer to an initialized \ref cardano_blake2b_hash_set_t object where the unique
+ *                               public key hash required for the pool retirement certificate will be added.
+ *                               This parameter must not be NULL.
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object representing the pool retirement
+ *                        certificate to be processed. This parameter is required and must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the public key hash
+ *         was successfully extracted and added to `unique_signers`, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (`unique_signers` or `certificate`) are NULL.
+ */
+cardano_error_t
+_process_pool_retirement(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_certificate_t*      certificate);
+
+/**
+ * \brief Processes an authorization committee hot certificate by extracting and adding its unique public key hash.
+ *
+ * This function processes a Cardano authorization committee hot certificate, extracts the public key hash associated
+ * with it, and adds this hash to the provided `unique_signers` set.
+ *
+ * \param[in,out] unique_signers A pointer to an initialized \ref cardano_blake2b_hash_set_t object where the unique
+ *                               public key hash required for the authorization committee hot certificate will be added.
+ *                               This parameter must not be NULL.
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object representing the authorization
+ *                        committee hot certificate to be processed. This parameter is required and must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the public key hash
+ *         was successfully extracted and added to `unique_signers`, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (`unique_signers` or `certificate`) are NULL.
+ */
+cardano_error_t
+_process_auth_committee_hot(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_certificate_t*      certificate);
+
+/**
+ * \brief Retrieves the credential that must authorize a certificate of a given type.
+ *
+ * This function returns the stake credential of the stake deregistration, delegation, Conway registration and
+ * unregistration certificates, the DRep credential of the DRep certificates and the cold credential of the committee
+ * resignation certificate. The legacy stake registration certificate, which the ledger does not require a witness
+ * for, yields none, and so do the certificates of any other type.
+ *
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object representing the certificate
+ *                        to be inspected. This parameter is required and must not be NULL.
+ * \param[in] type The type of the certificate (\ref cardano_cert_type_t) that selects the credential to retrieve.
+ * \param[out] credential On success, a new reference to the credential of the certificate, or NULL if a certificate
+ *                        of this type carries no such credential. The caller must release it by calling
+ *                        \ref cardano_credential_unref once it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the certificate
+ *         was inspected, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if `credential` is NULL or if the credential of the certificate could not be retrieved.
+ */
+cardano_error_t
+_cardano_get_certificate_credential(
+  cardano_certificate_t* certificate,
+  cardano_cert_type_t    type,
+  cardano_credential_t** credential);
+
+/**
+ * \brief Processes a Cardano certificate by extracting and adding the unique public key hash required
+ * for a given certificate type.
+ *
+ * This function examines a specific Cardano certificate of a given type, extracts the public key hash associated
+ * with it (if applicable), and adds this hash to the provided `unique_signers` set.
+ *
+ * \param[in,out] unique_signers A pointer to an initialized \ref cardano_blake2b_hash_set_t object where the unique
+ *                               public key hash required for the certificate will be added. This parameter must not be NULL.
+ * \param[in] certificate A pointer to an initialized \ref cardano_certificate_t object representing the certificate
+ *                        to be processed. This parameter is required and must not be NULL.
+ * \param[in] type The type of the certificate (\ref cardano_cert_type_t) to determine the specific processing logic.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the public key hash
+ *         was successfully extracted and added to `unique_signers`, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (`unique_signers` or `certificate`) are NULL.
+ */
+cardano_error_t
+_process_certificate_with_credential(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_certificate_t*      certificate,
+  cardano_cert_type_t         type);
+
+/**
+ * \brief Adds the unique set of public key hashes required for a set of Cardano certificates.
+ *
+ * This function iterates through a set of Cardano certificates and extracts the unique public key
+ * hashes required to authorize each certificate. These hashes are added to the specified `unique_signers` set.
+ *
+ * \param[in,out] unique_signers A pointer to an initialized \ref cardano_blake2b_hash_set_t object where the unique
+ *                               public key hashes required for the certificates will be added. This parameter must
+ *                               not be NULL. The caller is responsible for managing this object and ensuring it is
+ *                               correctly initialized before calling this function.
+ * \param[in] certificates A pointer to an initialized \ref cardano_certificate_set_t object representing the set of
+ *                         certificates to be analyzed. This parameter is required and must not be NULL. If the set
+ *                         is empty, the function will complete successfully without modifying `unique_signers`.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the unique signers
+ *         were successfully added to `unique_signers`, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (`unique_signers` or `certificates`) are NULL.
+ */
+cardano_error_t
+_cardano_add_certificates_pub_key_hashes(
+  cardano_blake2b_hash_set_t* unique_signers,
+  cardano_certificate_set_t*  certificates);
+
+/**
+ * \brief Extracts the unique set of public key hashes required for a set of Cardano voting procedures.
+ *
+ * This function processes a given set of voting procedures and adds the unique public key hashes
+ * (representing the signers) required for each procedure to the specified `unique_signers` set.
+ *
+ * \param[in,out] unique_signers A pointer to an initialized \ref cardano_blake2b_hash_set_t object where the unique
+ *                               public key hashes required for the voting procedures will be added. This parameter must
+ *                               not be NULL. The caller is responsible for managing this object and ensuring it is
+ *                               correctly initialized before calling this function.
+ * \param[in] procedures A pointer to an initialized \ref cardano_voting_procedures_t object representing the set of
+ *                       voting procedures to be analyzed. This parameter is required and must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the unique signers
+ *         were successfully added to `unique_signers`, or an appropriate error code indicating the failure reason,
+ *         such as \ref CARDANO_ERROR_POINTER_IS_NULL if required inputs (`unique_signers` or `procedures`) are NULL.
+ */
+cardano_error_t
+_cardano_voting_procedures_pub_key_hashes(
+  cardano_blake2b_hash_set_t*  unique_signers,
+  cardano_voting_procedures_t* procedures);
+
+/**
+ * \brief Extracts the unique set of public key hashes (signers) required to sign a Cardano transaction.
+ *
+ * This function computes the unique set of signers for a given Cardano transaction by analyzing the transaction body
+ * and resolved inputs. This set is represented as a `cardano_blake2b_hash_set_t` containing the hashes of public keys
+ * that are required to authorize the transaction.
+ *
+ * \param[in] tx A pointer to an initialized \ref cardano_transaction_t object that represents the Cardano transaction
+ *               for which the unique signers are to be determined. This parameter is required and must not be NULL.
+ * \param[in] resolved_inputs A pointer to an initialized \ref cardano_utxo_list_t object containing the list of resolved UTXOs
+ *                            (inputs) referenced in the transaction. If this parameters is NULL, the function will ignore inputs
+ *                            and collateral inputs.
+ * \param[out] unique_signers On successful execution, this will point to a newly created \ref cardano_blake2b_hash_set_t object
+ *                            containing the unique public key hashes required to authorize the transaction. The caller is responsible
+ *                            for managing the lifecycle of this object. Specifically, the caller must release it by calling
+ *                            \ref cardano_blake2b_hash_set_unref once it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the unique signers were
+ *         successfully computed, or an appropriate error code indicating the failure reason, such as \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if required inputs (tx or resolved_inputs) are NULL.
+ */
+cardano_error_t
+_cardano_get_unique_signers(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  cardano_blake2b_hash_set_t** unique_signers);
+
+/**
+ * \brief Extracts the owners of the Byron inputs of a Cardano transaction, which sign it with bootstrap witnesses.
+ *
+ * The inputs and collateral inputs held by Byron addresses are not signed with VK witnesses, and are therefore not
+ * part of the set \ref _cardano_get_unique_signers returns: each distinct Byron owner, identified by the root of its
+ * address, signs with a single bootstrap witness. This function returns one resolved UTXO per distinct Byron owner, in
+ * the order the inputs and then the collateral inputs list them. The number of elements of the list is the number of
+ * bootstrap witnesses the transaction needs, and the address of each UTXO holds the attributes the bootstrap witness of
+ * its owner carries.
+ *
+ * \param[in] tx A pointer to an initialized \ref cardano_transaction_t object that represents the Cardano transaction
+ *               for which the bootstrap signers are to be determined. This parameter is required and must not be NULL.
+ * \param[in] resolved_inputs A pointer to an initialized \ref cardano_utxo_list_t object containing the list of resolved UTXOs
+ *                            (inputs) referenced in the transaction. If this parameter is NULL, the function returns an
+ *                            empty list.
+ * \param[out] bootstrap_signers On successful execution, this will point to a newly created \ref cardano_utxo_list_t object
+ *                               holding one resolved UTXO per distinct Byron owner. The caller must release it by calling
+ *                               \ref cardano_utxo_list_unref once it is no longer needed.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS if the bootstrap signers
+ *         were successfully computed, or an appropriate error code indicating the failure reason, such as
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if `tx` or `bootstrap_signers` is NULL.
+ */
+cardano_error_t
+_cardano_get_bootstrap_signers(
+  cardano_transaction_t* tx,
+  cardano_utxo_list_t*   resolved_inputs,
+  cardano_utxo_list_t**  bootstrap_signers);
+
+/**
+ * \brief Gets signers using known latest pool parameters for the Dijkstra owner exemption.
+ * \param[in] tx The transaction.
+ * \param[in] resolved_inputs Resolved spend/collateral inputs.
+ * \param[out] unique_signers The resulting owned signer set.
+ * \param[in] pool_state Latest registered pool parameters, pending preferred over active.
+ * \param[in] pool_state_size Number of pool parameters; use zero before Dijkstra.
+ * \return Success or an allocation/access error.
+ */
+cardano_error_t _cardano_get_unique_signers_with_pool_state(
+  cardano_transaction_t*        tx,
+  cardano_utxo_list_t*          resolved_inputs,
+  cardano_blake2b_hash_set_t**  unique_signers,
+  cardano_pool_params_t* const* pool_state,
+  size_t                        pool_state_size);
+
+/**
+ * \brief Validates a pool-state snapshot, rejecting null entries and duplicate pool IDs.
+ * \param[in] pool_state The latest parameters of each known pool.
+ * \param[in] pool_state_size The number of entries.
+ * \return Success, a null argument error, or CARDANO_ERROR_DUPLICATED_KEY.
+ */
+cardano_error_t _cardano_validate_pool_state(cardano_pool_params_t* const* pool_state, size_t pool_state_size);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_SIGNERS_COUNT_H
diff --git a/vendor/src/transaction_builder/balancing/transaction_balancing.c b/vendor/src/transaction_builder/balancing/transaction_balancing.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/balancing/transaction_balancing.c
@@ -0,0 +1,3937 @@
+/**
+ * \file transaction_balancing.c
+ *
+ * \author angel.castillo
+ * \date   Nov 01, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "internals/collateral.h"
+#include "internals/pool_deposits.h"
+#include "internals/scripts_needed.h"
+#include "internals/unique_signers.h"
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/datum.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/transaction_builder/balancing/implicit_coin.h>
+#include <cardano/transaction_builder/balancing/transaction_balancing.h>
+#include <cardano/transaction_builder/fee.h>
+
+#include <assert.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief The error message reported when the direct deposits of a transaction add up to more than INT64_MAX.
+ */
+static const char* DIRECT_DEPOSITS_OVERFLOW_ERROR = "The direct deposits of the transaction add up to more than the maximum amount the balancer can represent.";
+
+/**
+ * \brief The error message reported when the coin produced by a transaction adds up to more than INT64_MAX.
+ */
+static const char* PRODUCED_COIN_OVERFLOW_ERROR = "The coin produced by the transaction exceeds the maximum amount the balancer can represent.";
+
+/**
+ * \brief The error message reported when the coin consumed by a transaction adds up to more than INT64_MAX.
+ */
+static const char* CONSUMED_COIN_OVERFLOW_ERROR = "The coin consumed by the transaction exceeds the maximum amount the balancer can represent.";
+
+/**
+ * \brief The error message reported when the withdrawals, deposits or reclaimed deposits of a transaction add up to more than UINT64_MAX.
+ */
+static const char* IMPLICIT_COIN_OVERFLOW_ERROR = "The withdrawals, deposits or reclaimed deposits of the transaction add up to more than the maximum amount the balancer can represent.";
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Callback function to find a specific UTXO based on the provided context.
+ *
+ * This function checks if the provided UTXO matches the criteria specified in `context`.
+ *
+ * \param[in] item The UTXO to evaluate.
+ * \param[in] context A pointer to the search criteria, typically a structure or identifier.
+ *
+ * \return `true` if the UTXO matches the search criteria; otherwise, `false`.
+ */
+static bool
+find_utxo(cardano_utxo_t* item, const void* context)
+{
+  const cardano_transaction_input_t* input      = (const cardano_transaction_input_t*)context;
+  cardano_transaction_input_t*       utxo_input = cardano_utxo_get_input(item);
+
+  bool found = cardano_transaction_input_equals(utxo_input, input);
+
+  cardano_transaction_input_unref(&utxo_input);
+
+  return found;
+}
+
+/**
+ * \brief Coalesces all input values in a transaction input set into a single total value.
+ *
+ * This function iterates over each input in the provided transaction input set, looks up the resolved value
+ * in the corresponding UTXO list, and accumulates it into a single total input value.
+ *
+ * \param[in]  inputs            The set of transaction inputs to coalesce.
+ * \param[in]  resolved_inputs   The UTXO list containing resolved values for each input.
+ * \param[out] total_input_value A pointer to store the cumulative value of all inputs.
+ *
+ * \return \ref CARDANO_SUCCESS if the total input value was successfully calculated, or an appropriate error code.
+ *
+ * \note The caller is responsible for freeing `total_input_value` when it is no longer needed.
+ */
+static cardano_error_t
+coalesce_all_inputs(
+  cardano_transaction_input_set_t* inputs,
+  cardano_utxo_list_t*             resolved_inputs,
+  cardano_value_t**                total_input_value)
+{
+  const size_t num_inputs = cardano_transaction_input_set_get_length(inputs);
+
+  cardano_value_t* total_value = cardano_value_new_zero();
+
+  if (total_value == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (size_t i = 0U; i < num_inputs; ++i)
+  {
+    cardano_transaction_input_t* input  = NULL;
+    cardano_error_t              result = cardano_transaction_input_set_get(inputs, i, &input);
+    cardano_transaction_input_unref(&input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&total_value);
+
+      return result;
+    }
+
+    cardano_utxo_t* utxo = cardano_utxo_list_find(resolved_inputs, find_utxo, (void*)input);
+    cardano_utxo_unref(&utxo);
+
+    if (utxo == NULL)
+    {
+      cardano_value_unref(&total_value);
+
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+    cardano_value_t*              value  = cardano_transaction_output_get_value(output);
+
+    cardano_transaction_output_unref(&output);
+    cardano_value_unref(&value);
+
+    cardano_value_t* tmp_value = NULL;
+
+    result = cardano_value_add(total_value, value, &tmp_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&tmp_value);
+      cardano_value_unref(&total_value);
+
+      return result;
+    }
+
+    cardano_value_unref(&total_value);
+    total_value = tmp_value;
+  }
+
+  *total_input_value = total_value;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Coalesces all output values in a transaction output list into a single total value.
+ *
+ * This function iterates over each transaction output in the provided list, extracts its value,
+ * and accumulates it into a single total output value.
+ *
+ * \param[in]  outputs            The list of transaction outputs to coalesce.
+ * \param[out] total_output_value  A pointer to store the cumulative value of all outputs.
+ *
+ * \return \ref CARDANO_SUCCESS if the total output value was successfully calculated, or an appropriate error code.
+ *
+ * \note The caller is responsible for freeing `total_output_value` when it is no longer needed.
+ */
+static cardano_error_t
+coalesce_all_outputs(cardano_transaction_output_list_t* outputs, cardano_value_t** total_output_value)
+{
+  const size_t num_outputs = cardano_transaction_output_list_get_length(outputs);
+
+  cardano_value_t* total_value = cardano_value_new_zero();
+
+  if (total_value == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (size_t i = 0U; i < num_outputs; ++i)
+  {
+    cardano_transaction_output_t* output = NULL;
+    cardano_error_t               result = cardano_transaction_output_list_get(outputs, i, &output);
+    cardano_transaction_output_unref(&output);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&total_value);
+
+      return result;
+    }
+
+    cardano_value_t* value = cardano_transaction_output_get_value(output);
+    cardano_value_unref(&value);
+
+    cardano_value_t* tmp_value = NULL;
+
+    result = cardano_value_add(total_value, value, &tmp_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&tmp_value);
+      cardano_value_unref(&total_value);
+
+      return result;
+    }
+
+    cardano_value_unref(&total_value);
+    total_value = tmp_value;
+  }
+
+  *total_output_value = total_value;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Sums the lovelace amounts of a direct deposit map.
+ *
+ * The balancer keeps lovelace amounts as signed 64 bit integers, so the total must not exceed INT64_MAX.
+ *
+ * \param[in]  direct_deposits The direct deposit map of the body, or NULL when the body has none.
+ * \param[out] total           A pointer to store the sum of all direct deposit amounts.
+ *
+ * \return \ref CARDANO_SUCCESS if the total was computed, \ref CARDANO_ERROR_INTEGER_OVERFLOW if the total
+ *         exceeds INT64_MAX, or an appropriate error code.
+ */
+static cardano_error_t
+sum_direct_deposits(cardano_direct_deposit_map_t* direct_deposits, uint64_t* total)
+{
+  const size_t num_deposits = cardano_direct_deposit_map_get_length(direct_deposits);
+
+  *total = 0U;
+
+  for (size_t i = 0U; i < num_deposits; ++i)
+  {
+    uint64_t amount = 0U;
+
+    cardano_error_t result = cardano_direct_deposit_map_get_value_at(direct_deposits, i, &amount);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (amount > ((uint64_t)INT64_MAX - *total))
+    {
+      return CARDANO_ERROR_INTEGER_OVERFLOW;
+    }
+
+    *total += amount;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Adds a lovelace amount to a signed coin accumulator.
+ *
+ * \param[in,out] accumulator A pointer to the accumulator. It must not be negative. On failure it is left untouched.
+ * \param[in]     amount      The lovelace amount to add.
+ *
+ * \return \ref CARDANO_SUCCESS if the amount was added, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if the sum
+ *         exceeds INT64_MAX.
+ */
+static cardano_error_t
+add_coin(int64_t* accumulator, const uint64_t amount)
+{
+  const int64_t headroom = INT64_MAX - *accumulator;
+
+  if ((amount > (uint64_t)INT64_MAX) || (amount > (uint64_t)headroom))
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  *accumulator += (int64_t)amount;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Computes the coin consumed by a transaction or sub transaction.
+ *
+ * The consumed coin is the sum of the reward withdrawals and the reclaimed deposits. The balancer keeps lovelace
+ * amounts as signed 64 bit integers, so the sum must not exceed INT64_MAX.
+ *
+ * \param[in]  withdrawals      The sum of the reward withdrawals.
+ * \param[in]  reclaim_deposits The deposits reclaimed by the certificates.
+ * \param[out] consumed_coin    A pointer to store the consumed coin. It is left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS if the consumed coin was computed, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if it
+ *         exceeds INT64_MAX.
+ */
+static cardano_error_t
+compute_consumed_coin(
+  const uint64_t withdrawals,
+  const uint64_t reclaim_deposits,
+  int64_t*       consumed_coin)
+{
+  int64_t total = 0;
+
+  cardano_error_t result = add_coin(&total, withdrawals);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = add_coin(&total, reclaim_deposits);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *consumed_coin = total;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Computes the coin produced by a transaction or sub transaction.
+ *
+ * The produced coin is the sum of the deposits, the fee, the donation and the direct deposits. The balancer keeps
+ * lovelace amounts as signed 64 bit integers, so the sum must not exceed INT64_MAX.
+ *
+ * \param[in]  deposits             The deposits of the certificates and proposals.
+ * \param[in]  fee                  The fee, or zero for a sub transaction.
+ * \param[in]  donation             The treasury donation.
+ * \param[in]  direct_deposit_total The sum of the direct deposits.
+ * \param[out] produced_coin        A pointer to store the produced coin. It is left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS if the produced coin was computed, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if it
+ *         exceeds INT64_MAX.
+ */
+static cardano_error_t
+compute_produced_coin(
+  const uint64_t deposits,
+  const uint64_t fee,
+  const uint64_t donation,
+  const uint64_t direct_deposit_total,
+  int64_t*       produced_coin)
+{
+  int64_t total = 0;
+
+  cardano_error_t result = add_coin(&total, deposits);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = add_coin(&total, fee);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = add_coin(&total, donation);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = add_coin(&total, direct_deposit_total);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *produced_coin = total;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Adds every asset of one policy to a value.
+ *
+ * \param[in,out] value     The value that receives the assets.
+ * \param[in]     policy_id The policy id of the assets.
+ * \param[in]     assets    The asset name map holding the quantity of each asset.
+ *
+ * \return \ref CARDANO_SUCCESS if every asset was added, or an appropriate error code.
+ */
+static cardano_error_t
+add_policy_assets(cardano_value_t* value, cardano_blake2b_hash_t* policy_id, cardano_asset_name_map_t* assets)
+{
+  const size_t asset_count = cardano_asset_name_map_get_length(assets);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < asset_count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_asset_name_t* asset_name = NULL;
+    int64_t               quantity   = 0;
+
+    result = cardano_asset_name_map_get_key_value_at(assets, i, &asset_name, &quantity);
+    cardano_asset_name_unref(&asset_name);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_value_add_asset(value, policy_id, asset_name, quantity);
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Creates a value with the same coin and assets as another value but backed by its own multi asset object.
+ *
+ * Value arithmetic shares the multi asset of the non-empty operand when the other operand carries no assets, and
+ * merging two multi assets shares the asset name maps of the policies that only one of them holds. The outcome of a
+ * chain of additions and subtractions can therefore still reference the maps of one of its inputs. This function
+ * rebuilds the value asset by asset so that it can be modified without affecting any of those inputs.
+ *
+ * \param[in]  value A pointer to the value to copy.
+ * \param[out] copy  A pointer to store the independent copy of the value.
+ *
+ * \return \ref CARDANO_SUCCESS if the copy was created, or an appropriate error code.
+ *
+ * \note The caller is responsible for freeing `copy` when it is no longer needed.
+ */
+static cardano_error_t
+copy_value(cardano_value_t* value, cardano_value_t** copy)
+{
+  cardano_error_t result = cardano_value_new(cardano_value_get_coin(value), NULL, copy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_multi_asset_t* multi_asset = cardano_value_get_multi_asset(value);
+  cardano_multi_asset_unref(&multi_asset);
+
+  cardano_policy_id_list_t* policies = NULL;
+
+  result = cardano_multi_asset_get_keys(multi_asset, &policies);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(copy);
+
+    return result;
+  }
+
+  const size_t policy_count = cardano_policy_id_list_get_length(policies);
+
+  for (size_t i = 0U; (i < policy_count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_blake2b_hash_t*   policy_id = NULL;
+    cardano_asset_name_map_t* assets    = NULL;
+
+    result = cardano_policy_id_list_get(policies, i, &policy_id);
+    cardano_blake2b_hash_unref(&policy_id);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_multi_asset_get_assets(multi_asset, policy_id, &assets);
+      cardano_asset_name_map_unref(&assets);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = add_policy_assets(*copy, policy_id, assets);
+    }
+  }
+
+  cardano_policy_id_list_unref(&policies);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(copy);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Computes the imbalance of a body as the value it consumes minus the value it produces.
+ *
+ * The consumed value is the sum of the resolved inputs plus the implicit consumed coin and the mint field (where
+ * minted assets are positive and burned assets negative). The produced value is the sum of the outputs plus the
+ * implicit produced coin.
+ *
+ * \param[in]  inputs          The set of inputs of the body.
+ * \param[in]  resolved_inputs The UTXO list containing resolved values for each input.
+ * \param[in]  outputs         The list of outputs of the body.
+ * \param[in]  mint            The mint field of the body, or NULL when the body has none.
+ * \param[in]  consumed_coin   The implicit consumed coin: the withdrawals plus the deposit refunds.
+ * \param[in]  produced_coin   The implicit produced coin: the fee, the deposits, the donation and the direct deposits.
+ * \param[out] imbalance       A pointer to store the resulting imbalance value. The value owns its multi asset, so it
+ *                             never aliases the mint field or a resolved input and can be modified freely.
+ *
+ * \return \ref CARDANO_SUCCESS if the imbalance was computed, or an appropriate error code.
+ *
+ * \note The caller is responsible for freeing `imbalance` when it is no longer needed.
+ */
+static cardano_error_t
+compute_imbalance(
+  cardano_transaction_input_set_t*   inputs,
+  cardano_utxo_list_t*               resolved_inputs,
+  cardano_transaction_output_list_t* outputs,
+  cardano_multi_asset_t*             mint,
+  const int64_t                      consumed_coin,
+  const int64_t                      produced_coin,
+  cardano_value_t**                  imbalance)
+{
+  cardano_value_t* implicit_consumed = NULL;
+  cardano_value_t* implicit_produced = NULL;
+
+  cardano_error_t result = cardano_value_new(consumed_coin, mint, &implicit_consumed);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_value_new(produced_coin, NULL, &implicit_produced);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(&implicit_consumed);
+
+    return result;
+  }
+
+  cardano_value_t* total_input_value  = NULL;
+  cardano_value_t* total_output_value = NULL;
+  cardano_value_t* consumed_value     = NULL;
+  cardano_value_t* diff_value         = NULL;
+
+  result = coalesce_all_inputs(inputs, resolved_inputs, &total_input_value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(&implicit_consumed);
+    cardano_value_unref(&implicit_produced);
+
+    return result;
+  }
+
+  result = coalesce_all_outputs(outputs, &total_output_value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(&implicit_consumed);
+    cardano_value_unref(&implicit_produced);
+    cardano_value_unref(&total_input_value);
+
+    return result;
+  }
+
+  result = cardano_value_add(total_input_value, implicit_consumed, &consumed_value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(&implicit_consumed);
+    cardano_value_unref(&implicit_produced);
+    cardano_value_unref(&total_input_value);
+    cardano_value_unref(&total_output_value);
+
+    return result;
+  }
+
+  result = cardano_value_subtract(consumed_value, total_output_value, &diff_value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(&implicit_consumed);
+    cardano_value_unref(&implicit_produced);
+    cardano_value_unref(&total_input_value);
+    cardano_value_unref(&total_output_value);
+    cardano_value_unref(&consumed_value);
+
+    return result;
+  }
+
+  cardano_value_t* imbalance_value = NULL;
+
+  result = cardano_value_subtract(diff_value, implicit_produced, &imbalance_value);
+
+  cardano_value_unref(&implicit_consumed);
+  cardano_value_unref(&implicit_produced);
+  cardano_value_unref(&total_input_value);
+  cardano_value_unref(&total_output_value);
+  cardano_value_unref(&consumed_value);
+  cardano_value_unref(&diff_value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = copy_value(imbalance_value, imbalance);
+
+  cardano_value_unref(&imbalance_value);
+
+  return result;
+}
+
+/**
+ * \brief Adds the imbalance of a sub transaction to a running total.
+ *
+ * \param[in]     sub_tx          The sub transaction whose imbalance is added.
+ * \param[in]     resolved_inputs The UTXO list containing resolved values for each input of the sub transaction.
+ * \param[in]     protocol_params The protocol parameters supplying the deposit amounts.
+ * \param[in,out] total           The running total. On success it is replaced by a new value holding the sum; on
+ *                                failure it is left untouched.
+ *
+ * \return \ref CARDANO_SUCCESS if the imbalance was added, or an appropriate error code.
+ */
+static cardano_error_t
+add_sub_transaction_imbalance(
+  cardano_sub_transaction_t*     sub_tx,
+  cardano_utxo_list_t*           resolved_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_value_t**              total)
+{
+  cardano_value_t* sub_imbalance = NULL;
+
+  cardano_error_t result = cardano_compute_sub_transaction_imbalance(sub_tx, resolved_inputs, protocol_params, &sub_imbalance);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_value_t* tmp_value = NULL;
+
+  result = cardano_value_add(*total, sub_imbalance, &tmp_value);
+
+  cardano_value_unref(&sub_imbalance);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(&tmp_value);
+
+    return result;
+  }
+
+  cardano_value_unref(total);
+  *total = tmp_value;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Adds the imbalance of every sub transaction of a set to a running total.
+ *
+ * \param[in]     sub_transactions The sub transactions whose imbalances are added, or NULL when the body has none.
+ * \param[in]     resolved_inputs  The UTXO list containing resolved values for each input of the sub transactions, or
+ *                                 NULL when the body has none.
+ * \param[in]     protocol_params  The protocol parameters supplying the deposit amounts.
+ * \param[in,out] total            The running total. On success it holds the sum; on failure the caller must still
+ *                                 release it.
+ * \param[out]    error_message    An optional pointer that receives the last error of the sub transaction whose
+ *                                 imbalance could not be computed. It is set to an empty string when that sub
+ *                                 transaction reports no error, and left untouched on success. When it is not NULL
+ *                                 the last error of each sub transaction is cleared before its imbalance is computed.
+ *                                 It can be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if every imbalance was added, or an appropriate error code.
+ */
+static cardano_error_t
+add_sub_transactions_imbalance(
+  cardano_sub_transaction_set_t* sub_transactions,
+  cardano_utxo_list_t*           resolved_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_value_t**              total,
+  const char**                   error_message)
+{
+  const size_t num_sub_transactions = cardano_sub_transaction_set_get_length(sub_transactions);
+
+  for (size_t i = 0U; i < num_sub_transactions; ++i)
+  {
+    cardano_sub_transaction_t* sub_tx = NULL;
+
+    cardano_error_t result = cardano_sub_transaction_set_get(sub_transactions, i, &sub_tx);
+    cardano_sub_transaction_unref(&sub_tx);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (error_message != NULL)
+    {
+      cardano_sub_transaction_set_last_error(sub_tx, "");
+    }
+
+    result = add_sub_transaction_imbalance(sub_tx, resolved_inputs, protocol_params, total);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      if (error_message != NULL)
+      {
+        *error_message = cardano_sub_transaction_get_last_error(sub_tx);
+      }
+
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Computes the pool deposits that summing the imbalance of each body of a batch counts more than once.
+ *
+ * Each body of a CIP-118 batch is charged the pool deposit once per pool it registers, while the ledger charges it once
+ * per pool across the whole batch. The result is the pool deposit times the number of extra times a pool registered by
+ * several bodies was charged.
+ *
+ * \param[in]  certificates     The certificates of the top level body, or NULL to inspect the sub transactions only.
+ * \param[in]  sub_transactions The sub transactions of the batch, or NULL when there are none.
+ * \param[in]  protocol_params  The protocol parameters supplying the pool deposit.
+ * \param[out] pool_deposits    On success, the pool deposits counted more than once.
+ *
+ * \return \ref CARDANO_SUCCESS if the pool deposits were computed, \ref CARDANO_ERROR_INTEGER_OVERFLOW if they exceed
+ *         INT64_MAX, or an appropriate error code.
+ */
+static cardano_error_t
+compute_repeated_pool_deposits(
+  cardano_certificate_set_t*     certificates,
+  cardano_sub_transaction_set_t* sub_transactions,
+  cardano_protocol_parameters_t* protocol_params,
+  uint64_t*                      pool_deposits)
+{
+  *pool_deposits = 0U;
+
+  if (cardano_sub_transaction_set_get_length(sub_transactions) == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  uint64_t repeated = 0U;
+
+  cardano_error_t result = _cardano_count_repeated_pool_deposits(certificates, sub_transactions, &repeated);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const uint64_t pool_deposit = cardano_protocol_parameters_get_pool_deposit(protocol_params);
+
+  if ((pool_deposit != 0U) && (repeated > ((uint64_t)INT64_MAX / pool_deposit)))
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  *pool_deposits = repeated * pool_deposit;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Adds a lovelace amount to the coin of a value.
+ *
+ * \param[in,out] value  The value. On failure it is left untouched.
+ * \param[in]     amount The lovelace amount to add. It must not exceed INT64_MAX.
+ *
+ * \return \ref CARDANO_SUCCESS if the amount was added, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if the coin of the value
+ *         would exceed INT64_MAX.
+ */
+static cardano_error_t
+add_lovelace(cardano_value_t* value, const uint64_t amount)
+{
+  if (cardano_value_get_coin(value) > (INT64_MAX - (int64_t)amount))
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  return cardano_value_add_coin(value, (int64_t)amount);
+}
+
+/**
+ * \brief Gives back to a batch imbalance the pool deposits that summing the imbalance of each body counts more than once.
+ *
+ * \param[in]     certificates     The certificates of the top level body, or NULL when it has none.
+ * \param[in]     sub_transactions The sub transactions of the batch, or NULL when there are none.
+ * \param[in]     protocol_params  The protocol parameters supplying the pool deposit.
+ * \param[in,out] imbalance        The imbalance of the whole batch, as the sum of the imbalance of each body. On
+ *                                 failure it is left untouched.
+ *
+ * \return \ref CARDANO_SUCCESS if the imbalance was adjusted, \ref CARDANO_ERROR_INTEGER_OVERFLOW if the pool deposits
+ *         to give back or the resulting coin exceed INT64_MAX, or an appropriate error code.
+ */
+static cardano_error_t
+add_repeated_pool_deposits(
+  cardano_certificate_set_t*     certificates,
+  cardano_sub_transaction_set_t* sub_transactions,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_value_t*               imbalance)
+{
+  uint64_t pool_deposits = 0U;
+
+  cardano_error_t result = compute_repeated_pool_deposits(certificates, sub_transactions, protocol_params, &pool_deposits);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return add_lovelace(imbalance, pool_deposits);
+}
+
+/**
+ * \brief Splits the pool deposits a batch counts more than once between its sub transactions and its top level body.
+ *
+ * The ledger applies the sub transactions before the top level body, so a pool registered by a sub transaction is
+ * already registered when the top level body registers it again, and a top level body validated on its own in legacy
+ * mode pays no deposit for it. The pool deposits the sub transactions count more than once among themselves are given
+ * back to their imbalance, and the ones the top level body is charged for pools a sub transaction registers are
+ * reported separately so that the top level body is not charged for them.
+ *
+ * \param[in]     certificates               The certificates of the top level body, or NULL when it has none.
+ * \param[in]     sub_transactions           The sub transactions of the batch, or NULL when there are none.
+ * \param[in]     protocol_params            The protocol parameters supplying the pool deposit.
+ * \param[in,out] sub_transactions_imbalance The net imbalance of the sub transactions. On failure it is left untouched.
+ * \param[out]    top_level_pool_deposits    On success, the pool deposits the top level body is charged for pools that
+ *                                           a sub transaction registers.
+ *
+ * \return \ref CARDANO_SUCCESS if the pool deposits were split, \ref CARDANO_ERROR_INTEGER_OVERFLOW if they exceed
+ *         INT64_MAX, or an appropriate error code.
+ */
+static cardano_error_t
+split_repeated_pool_deposits(
+  cardano_certificate_set_t*     certificates,
+  cardano_sub_transaction_set_t* sub_transactions,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_value_t*               sub_transactions_imbalance,
+  uint64_t*                      top_level_pool_deposits)
+{
+  uint64_t sub_transaction_pool_deposits = 0U;
+  uint64_t batch_pool_deposits           = 0U;
+
+  cardano_error_t result = compute_repeated_pool_deposits(NULL, sub_transactions, protocol_params, &sub_transaction_pool_deposits);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = compute_repeated_pool_deposits(certificates, sub_transactions, protocol_params, &batch_pool_deposits);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_lovelace(sub_transactions_imbalance, sub_transaction_pool_deposits);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *top_level_pool_deposits = batch_pool_deposits - sub_transaction_pool_deposits;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Checks whether a set of transaction inputs holds a transaction input.
+ *
+ * \param[in]  inputs    The transaction inputs to search, or NULL when there are none.
+ * \param[in]  input     The transaction input to look up.
+ * \param[out] has_input Set to true if the set holds the input.
+ *
+ * \return \ref CARDANO_SUCCESS if the inputs were searched, or an appropriate error code.
+ */
+static cardano_error_t
+has_transaction_input(
+  cardano_transaction_input_set_t*   inputs,
+  const cardano_transaction_input_t* input,
+  bool*                              has_input)
+{
+  const size_t num_inputs = cardano_transaction_input_set_get_length(inputs);
+
+  bool found = false;
+
+  for (size_t i = 0U; (i < num_inputs) && !found; ++i)
+  {
+    cardano_transaction_input_t* current_input = NULL;
+
+    cardano_error_t result = cardano_transaction_input_set_get(inputs, i, &current_input);
+    cardano_transaction_input_unref(&current_input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    found = cardano_transaction_input_equals(current_input, input);
+  }
+
+  *has_input = found;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Checks whether a sub transaction uses a transaction input.
+ *
+ * A sub transaction uses the inputs it spends and, if \p include_references is set, the inputs it references.
+ *
+ * \param[in]  sub_tx             The sub transaction whose inputs are searched.
+ * \param[in]  input              The transaction input to look up.
+ * \param[in]  include_references Whether the reference inputs of the sub transaction are searched too.
+ * \param[out] is_used            Set to true if the sub transaction uses the input.
+ *
+ * \return \ref CARDANO_SUCCESS if the inputs were searched, or an appropriate error code.
+ */
+static cardano_error_t
+is_used_by_sub_transaction(
+  cardano_sub_transaction_t*         sub_tx,
+  const cardano_transaction_input_t* input,
+  const bool                         include_references,
+  bool*                              is_used)
+{
+  cardano_sub_transaction_body_t* body = cardano_sub_transaction_get_body(sub_tx);
+  cardano_sub_transaction_body_unref(&body);
+
+  cardano_transaction_input_set_t* inputs = cardano_sub_transaction_body_get_inputs(body);
+  cardano_transaction_input_set_unref(&inputs);
+
+  const cardano_error_t result = has_transaction_input(inputs, input, is_used);
+
+  if ((result != CARDANO_SUCCESS) || *is_used || !include_references)
+  {
+    return result;
+  }
+
+  cardano_transaction_input_set_t* reference_inputs = cardano_sub_transaction_body_get_reference_inputs(body);
+  cardano_transaction_input_set_unref(&reference_inputs);
+
+  return has_transaction_input(reference_inputs, input, is_used);
+}
+
+/**
+ * \brief Checks whether any sub transaction of a set uses a transaction input.
+ *
+ * A sub transaction uses the inputs it spends and, if \p include_references is set, the inputs it references.
+ *
+ * \param[in]  sub_transactions   The sub transactions whose inputs are searched.
+ * \param[in]  input              The transaction input to look up.
+ * \param[in]  include_references Whether the reference inputs of the sub transactions are searched too.
+ * \param[out] is_used            Set to true if one of the sub transactions uses the input.
+ *
+ * \return \ref CARDANO_SUCCESS if the sub transactions were searched, or an appropriate error code.
+ */
+static cardano_error_t
+is_used_by_sub_transactions(
+  cardano_sub_transaction_set_t*     sub_transactions,
+  const cardano_transaction_input_t* input,
+  const bool                         include_references,
+  bool*                              is_used)
+{
+  const size_t num_sub_transactions = cardano_sub_transaction_set_get_length(sub_transactions);
+
+  bool found = false;
+
+  for (size_t i = 0U; (i < num_sub_transactions) && !found; ++i)
+  {
+    cardano_sub_transaction_t* sub_tx = NULL;
+
+    cardano_error_t result = cardano_sub_transaction_set_get(sub_transactions, i, &sub_tx);
+    cardano_sub_transaction_unref(&sub_tx);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = is_used_by_sub_transaction(sub_tx, input, include_references, &found);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  *is_used = found;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Checks whether any UTXO of a list is spent by a sub transaction of a set.
+ *
+ * \param[in]  utxos            The UTXOs to look up, or NULL when there are none.
+ * \param[in]  sub_transactions The sub transactions whose spend inputs are searched, or NULL when the body has none.
+ * \param[out] has_spent_utxo   Set to true if one of the sub transactions spends one of the UTXOs.
+ *
+ * \return \ref CARDANO_SUCCESS if the UTXOs were searched, or an appropriate error code.
+ */
+static cardano_error_t
+has_utxo_spent_by_sub_transactions(
+  cardano_utxo_list_t*           utxos,
+  cardano_sub_transaction_set_t* sub_transactions,
+  bool*                          has_spent_utxo)
+{
+  if (cardano_sub_transaction_set_get_length(sub_transactions) == 0U)
+  {
+    *has_spent_utxo = false;
+
+    return CARDANO_SUCCESS;
+  }
+
+  const size_t num_utxos = cardano_utxo_list_get_length(utxos);
+
+  bool found = false;
+
+  for (size_t i = 0U; (i < num_utxos) && !found; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    cardano_error_t result = cardano_utxo_list_get(utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+    cardano_transaction_input_unref(&input);
+
+    result = is_used_by_sub_transactions(sub_transactions, input, false, &found);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  *has_spent_utxo = found;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Creates the list of UTXOs that coin selection or collateral selection may use at the top level of a batch.
+ *
+ * The available UTXOs, and the collateral UTXOs when the batcher is also a party of the batch, may hold the resolved
+ * UTXOs of the sub transactions, which belong to the parties of the batch and to the holders of the scripts they use,
+ * so every UTXO that a sub transaction spends or references is left out. The order of the remaining UTXOs is preserved.
+ *
+ * \param[in]  available_utxo   The list of available UTXOs, or NULL when there are none.
+ * \param[in]  sub_transactions The sub transactions carried by the transaction, or NULL when it has none.
+ * \param[out] selectable_utxo  A pointer to store the selectable UTXOs, which is \p available_utxo itself when it is
+ *                              NULL or when the transaction carries no sub transactions.
+ *
+ * \return \ref CARDANO_SUCCESS if the list was created, or an appropriate error code.
+ *
+ * \note The caller is responsible for freeing `selectable_utxo` when it is no longer needed.
+ */
+static cardano_error_t
+exclude_sub_transaction_inputs(
+  cardano_utxo_list_t*           available_utxo,
+  cardano_sub_transaction_set_t* sub_transactions,
+  cardano_utxo_list_t**          selectable_utxo)
+{
+  if ((available_utxo == NULL) || (cardano_sub_transaction_set_get_length(sub_transactions) == 0U))
+  {
+    cardano_utxo_list_ref(available_utxo);
+    *selectable_utxo = available_utxo;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_utxo_list_t* utxos  = NULL;
+  cardano_error_t      result = cardano_utxo_list_new(&utxos);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const size_t num_utxos = cardano_utxo_list_get_length(available_utxo);
+
+  for (size_t i = 0U; i < num_utxos; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    result = cardano_utxo_list_get(available_utxo, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_utxo_list_unref(&utxos);
+
+      return result;
+    }
+
+    cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+    cardano_transaction_input_unref(&input);
+
+    bool is_used = false;
+
+    result = is_used_by_sub_transactions(sub_transactions, input, true, &is_used);
+
+    if ((result == CARDANO_SUCCESS) && !is_used)
+    {
+      result = cardano_utxo_list_add(utxos, utxo);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_utxo_list_unref(&utxos);
+
+      return result;
+    }
+  }
+
+  *selectable_utxo = utxos;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Collects the hashes of the scripts the body of the top level transaction needs on the current iteration.
+ *
+ * \param[in]  tx                The top level transaction, whose inputs are the ones of the current iteration.
+ * \param[in]  pre_selected_utxo The UTXOs that must be included in the transaction inputs, or NULL when there are none.
+ * \param[in]  selection         The UTXOs spent by the transaction on this iteration.
+ * \param[out] needed_scripts    On success, the needed script hashes. The caller must release them with
+ *                               \ref cardano_blake2b_hash_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the hashes were collected, or an appropriate error code.
+ */
+static cardano_error_t
+get_top_level_needed_scripts(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         pre_selected_utxo,
+  cardano_utxo_list_t*         selection,
+  cardano_blake2b_hash_set_t** needed_scripts)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_utxo_list_t* spent_utxos = selection;
+  cardano_utxo_list_ref(selection);
+
+  if (pre_selected_utxo != NULL)
+  {
+    cardano_utxo_list_unref(&spent_utxos);
+    spent_utxos = cardano_utxo_list_concat(pre_selected_utxo, selection);
+
+    if (spent_utxos == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  const cardano_error_t result = _cardano_get_script_hashes_needed(body, spent_utxos, needed_scripts);
+
+  cardano_utxo_list_unref(&spent_utxos);
+
+  return result;
+}
+
+/**
+ * \brief Checks whether the ledger validates a transaction in legacy mode.
+ *
+ * A top level transaction that needs a PlutusV1, PlutusV2 or PlutusV3 script must also conserve value by itself, with
+ * its sub transactions removed. The scripts the body needs are collected from the spent inputs, the mint field, the
+ * withdrawals, the certificates, the voters, the guardrails scripts of the proposals and the guards, and each one is
+ * looked up among the scripts the ledger pools over the whole batch: the ones of the witness set of the transaction and
+ * of the witness sets of its sub transactions, and the reference scripts of the resolved reference inputs, the pre
+ * selected inputs, the inputs chosen by coin selection and the resolved UTXOs the sub transactions spend or reference.
+ * A needed script that none of them provides has an unknown language and does not make the transaction legacy.
+ *
+ * \param[in]  tx                    The top level transaction, whose inputs are the ones of the current iteration.
+ * \param[in]  reference_inputs      The resolved reference inputs of the transaction, or NULL when it has none.
+ * \param[in]  pre_selected_utxo     The UTXOs that must be included in the transaction inputs, or NULL when there are
+ *                                   none.
+ * \param[in]  selection             The UTXOs spent by the transaction on this iteration.
+ * \param[in]  sub_transaction_utxos The resolved UTXOs the sub transactions spend or reference. A reference input of a
+ *                                   sub transaction that the balancer was not given the UTXO of is not among them, so
+ *                                   its reference script is not seen.
+ * \param[out] is_legacy_mode        Set to true if the transaction needs a PlutusV1, PlutusV2 or PlutusV3 script.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction was inspected, or an appropriate error code.
+ */
+static cardano_error_t
+is_legacy_mode_transaction(
+  cardano_transaction_t* tx,
+  cardano_utxo_list_t*   reference_inputs,
+  cardano_utxo_list_t*   pre_selected_utxo,
+  cardano_utxo_list_t*   selection,
+  cardano_utxo_list_t*   sub_transaction_utxos,
+  bool*                  is_legacy_mode)
+{
+  cardano_blake2b_hash_set_t* needed_scripts = NULL;
+
+  cardano_error_t result = get_top_level_needed_scripts(tx, pre_selected_utxo, selection, &needed_scripts);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  bool has_plutus_v1       = false;
+  bool has_plutus_v2       = false;
+  bool has_plutus_v3       = false;
+  bool has_plutus_v4       = false;
+  bool has_missing_scripts = false;
+
+  result = _cardano_get_plutus_languages_used(
+    tx,
+    true,
+    needed_scripts,
+    reference_inputs,
+    pre_selected_utxo,
+    selection,
+    sub_transaction_utxos,
+    &has_plutus_v1,
+    &has_plutus_v2,
+    &has_plutus_v3,
+    &has_plutus_v4,
+    &has_missing_scripts);
+
+  cardano_blake2b_hash_set_unref(&needed_scripts);
+
+  *is_legacy_mode = has_plutus_v1 || has_plutus_v2 || has_plutus_v3;
+
+  return result;
+}
+
+/**
+ * \brief Rejects an iteration of the balancing loop whose sub transactions must, but do not, balance between themselves.
+ *
+ * When the top level transaction of the current iteration is validated in legacy mode it must conserve value by itself,
+ * so a net imbalance of its sub transactions can not be absorbed by top level inputs or change.
+ *
+ * \param[in] tx                         The top level transaction, whose inputs are the ones of the current iteration.
+ * \param[in] sub_transactions_imbalance The net imbalance of the sub transactions.
+ * \param[in] reference_inputs           The resolved reference inputs of the transaction, or NULL when it has none.
+ * \param[in] pre_selected_utxo          The UTXOs that must be included in the transaction inputs, or NULL when there
+ *                                       are none.
+ * \param[in] selection                  The UTXOs spent by the transaction on this iteration.
+ * \param[in] sub_transaction_utxos      The resolved UTXOs the sub transactions spend or reference.
+ *
+ * \return \ref CARDANO_SUCCESS if the iteration may go on, \ref CARDANO_ERROR_UNBALANCED_SUB_TRANSACTIONS if the
+ *         transaction is validated in legacy mode and its sub transactions do not balance between themselves, or an
+ *         appropriate error code.
+ */
+static cardano_error_t
+check_legacy_mode_sub_transactions(
+  cardano_transaction_t* tx,
+  cardano_value_t*       sub_transactions_imbalance,
+  cardano_utxo_list_t*   reference_inputs,
+  cardano_utxo_list_t*   pre_selected_utxo,
+  cardano_utxo_list_t*   selection,
+  cardano_utxo_list_t*   sub_transaction_utxos)
+{
+  if (cardano_value_is_zero(sub_transactions_imbalance))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  bool is_legacy_mode = false;
+
+  const cardano_error_t result = is_legacy_mode_transaction(tx, reference_inputs, pre_selected_utxo, selection, sub_transaction_utxos, &is_legacy_mode);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (!is_legacy_mode)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_transaction_set_last_error(
+    tx,
+    "The top level transaction needs a PlutusV1, PlutusV2 or PlutusV3 script, so the sub transactions must balance between themselves. Add a balancing sub transaction, top level change can not absorb their imbalance.");
+
+  return CARDANO_ERROR_UNBALANCED_SUB_TRANSACTIONS;
+}
+
+/**
+ * \brief Computes the hash the ledger keys a witness datum by.
+ *
+ * \param[in]  data The datum to hash.
+ * \param[out] hash On success, the Blake2b-256 hash of the CBOR of the datum. The caller must release it with
+ *                  \ref cardano_blake2b_hash_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the datum was hashed, or an appropriate error code.
+ */
+static cardano_error_t
+compute_datum_hash(cardano_plutus_data_t* data, cardano_blake2b_hash_t** hash)
+{
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = NULL;
+  cardano_error_t   result = cardano_plutus_data_to_cbor(data, writer);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_writer_encode_in_buffer(writer, &buffer);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_blake2b_compute_hash(
+      cardano_buffer_get_data(buffer),
+      cardano_buffer_get_size(buffer),
+      (size_t)CARDANO_BLAKE2B_HASH_SIZE_256,
+      hash);
+  }
+
+  cardano_buffer_unref(&buffer);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+/**
+ * \brief Adds the datum hash of an output to a set of hashes, when the output carries a datum hash.
+ *
+ * \param[in,out] hashes The set that receives the datum hash.
+ * \param[in]     output The output whose datum hash is added.
+ *
+ * \return \ref CARDANO_SUCCESS if the output was inspected, or an appropriate error code.
+ */
+static cardano_error_t
+add_output_datum_hash(cardano_blake2b_hash_set_t* hashes, cardano_transaction_output_t* output)
+{
+  cardano_datum_t* datum = cardano_transaction_output_get_datum(output);
+  cardano_datum_unref(&datum);
+
+  if (datum == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_datum_type_t datum_type = CARDANO_DATUM_TYPE_INLINE_DATA;
+
+  cardano_error_t result = cardano_datum_get_type(datum, &datum_type);
+
+  if ((result != CARDANO_SUCCESS) || (datum_type != CARDANO_DATUM_TYPE_DATA_HASH))
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  result = cardano_blake2b_hash_from_bytes(
+    cardano_datum_get_data_hash_bytes(datum),
+    cardano_datum_get_data_hash_bytes_size(datum),
+    &hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_blake2b_hash_set_add(hashes, hash);
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+/**
+ * \brief Adds the datum hashes of the outputs behind a list of UTXOs to a set of hashes.
+ *
+ * A spent input needs its datum only when the script hash of its payment credential resolves to a Plutus script among
+ * the provided scripts. An input locked by a native script may carry a datum hash, but its datum is never needed.
+ *
+ * \param[in,out] hashes         The set that receives the datum hashes.
+ * \param[in]     utxos          The UTXOs whose datum hashes are added, or NULL when there are none.
+ * \param[in]     plutus_scripts The script hashes that resolve to a provided Plutus script. When given, only the UTXOs
+ *                               held at an address whose payment credential is one of them are inspected; when NULL,
+ *                               every UTXO is.
+ *
+ * \return \ref CARDANO_SUCCESS if the UTXOs were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+add_utxo_datum_hashes(cardano_blake2b_hash_set_t* hashes, cardano_utxo_list_t* utxos, cardano_blake2b_hash_set_t* plutus_scripts)
+{
+  const size_t length = cardano_utxo_list_get_length(utxos);
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    cardano_error_t result = cardano_utxo_list_get(utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+    cardano_transaction_output_unref(&output);
+
+    cardano_address_t* address = cardano_transaction_output_get_address(output);
+    cardano_address_unref(&address);
+
+    bool is_needed = (plutus_scripts == NULL);
+
+    if (!is_needed && _cardano_has_payment_script(address))
+    {
+      cardano_blake2b_hash_t* script_hash = _cardano_get_payment_script_hash(address);
+
+      if (script_hash == NULL)
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+
+      is_needed = _cardano_blake2b_hash_set_has(plutus_scripts, script_hash);
+      cardano_blake2b_hash_unref(&script_hash);
+    }
+
+    if (is_needed)
+    {
+      result = add_output_datum_hash(hashes, output);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Collects the datum hashes the top level transaction alone allows its witness datums to have.
+ *
+ * Those are the datum hashes of the spent outputs locked by a Plutus script, which the script needs, and the datum
+ * hashes of the outputs of the body and of the outputs behind its reference inputs. A spent output counts only when the
+ * script hash of its payment credential resolves to a PlutusV1, PlutusV2, PlutusV3 or PlutusV4 script among the scripts
+ * the ledger pools over the whole batch: the ones of the witness set of the transaction and of the witness sets of its
+ * sub transactions, and the reference scripts of the resolved reference inputs, the spent inputs and the resolved UTXOs
+ * the sub transactions spend or reference. A spent output locked by a native script, or by a script that nothing
+ * provides, does not count. The outputs and the reference inputs of the sub transactions allow no datum hash.
+ *
+ * \param[in]  tx                    The top level transaction, whose inputs and outputs are the ones of the current
+ *                                   iteration.
+ * \param[in]  reference_inputs      The resolved reference inputs of the transaction, or NULL when it has none.
+ * \param[in]  pre_selected_utxo     The UTXOs that must be included in the transaction inputs, or NULL when there are
+ *                                   none.
+ * \param[in]  selection             The UTXOs spent by the transaction on this iteration.
+ * \param[in]  sub_transaction_utxos The resolved UTXOs the sub transactions spend or reference. A reference input of a
+ *                                   sub transaction that the balancer was not given the UTXO of is not among them, so
+ *                                   its reference script is not seen.
+ * \param[out] allowed_hashes        On success, the allowed datum hashes. The caller must release them with
+ *                                   \ref cardano_blake2b_hash_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the hashes were collected, or an appropriate error code.
+ */
+static cardano_error_t
+get_top_level_allowed_datum_hashes(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         reference_inputs,
+  cardano_utxo_list_t*         pre_selected_utxo,
+  cardano_utxo_list_t*         selection,
+  cardano_utxo_list_t*         sub_transaction_utxos,
+  cardano_blake2b_hash_set_t** allowed_hashes)
+{
+  cardano_blake2b_hash_set_t* needed_scripts = NULL;
+
+  cardano_error_t result = get_top_level_needed_scripts(tx, pre_selected_utxo, selection, &needed_scripts);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_set_t* plutus_scripts = NULL;
+
+  result = _cardano_get_plutus_scripts_provided(tx, true, needed_scripts, reference_inputs, pre_selected_utxo, selection, sub_transaction_utxos, &plutus_scripts);
+
+  cardano_blake2b_hash_set_unref(&needed_scripts);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_set_t* hashes = NULL;
+
+  result = cardano_blake2b_hash_set_new(&hashes);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(&plutus_scripts);
+
+    return result;
+  }
+
+  result = add_utxo_datum_hashes(hashes, pre_selected_utxo, plutus_scripts);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_utxo_datum_hashes(hashes, selection, plutus_scripts);
+  }
+
+  cardano_blake2b_hash_set_unref(&plutus_scripts);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_utxo_datum_hashes(hashes, reference_inputs, NULL);
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(body);
+  cardano_transaction_output_list_unref(&outputs);
+
+  const size_t output_count = cardano_transaction_output_list_get_length(outputs);
+
+  for (size_t i = 0U; (result == CARDANO_SUCCESS) && (i < output_count); ++i)
+  {
+    cardano_transaction_output_t* output = NULL;
+
+    result = cardano_transaction_output_list_get(outputs, i, &output);
+    cardano_transaction_output_unref(&output);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = add_output_datum_hash(hashes, output);
+    }
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(&hashes);
+
+    return result;
+  }
+
+  *allowed_hashes = hashes;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Checks whether the top level transaction carries a witness datum that the ledger does not allow once its sub
+ * transactions are removed.
+ *
+ * \param[in]  tx                    The top level transaction, whose inputs and outputs are the ones of the current
+ *                                   iteration.
+ * \param[in]  datums                The witness datums of the top level transaction.
+ * \param[in]  reference_inputs      The resolved reference inputs of the transaction, or NULL when it has none.
+ * \param[in]  pre_selected_utxo     The UTXOs that must be included in the transaction inputs, or NULL when there are
+ *                                   none.
+ * \param[in]  selection             The UTXOs spent by the transaction on this iteration.
+ * \param[in]  sub_transaction_utxos The resolved UTXOs the sub transactions spend or reference.
+ * \param[out] has_foreign_datums    Set to true if a witness datum is neither needed by a spent input locked by a Plutus
+ *                                   script nor allowed by the outputs and the reference inputs of the top level
+ *                                   transaction.
+ *
+ * \return \ref CARDANO_SUCCESS if the witness datums were inspected, or an appropriate error code.
+ */
+static cardano_error_t
+has_datums_not_allowed_by_top_level(
+  cardano_transaction_t*     tx,
+  cardano_plutus_data_set_t* datums,
+  cardano_utxo_list_t*       reference_inputs,
+  cardano_utxo_list_t*       pre_selected_utxo,
+  cardano_utxo_list_t*       selection,
+  cardano_utxo_list_t*       sub_transaction_utxos,
+  bool*                      has_foreign_datums)
+{
+  cardano_blake2b_hash_set_t* allowed_hashes = NULL;
+
+  cardano_error_t result = get_top_level_allowed_datum_hashes(tx, reference_inputs, pre_selected_utxo, selection, sub_transaction_utxos, &allowed_hashes);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const size_t datum_count = cardano_plutus_data_set_get_length(datums);
+  bool         found       = false;
+
+  for (size_t i = 0U; (result == CARDANO_SUCCESS) && !found && (i < datum_count); ++i)
+  {
+    cardano_plutus_data_t* datum = NULL;
+
+    result = cardano_plutus_data_set_get(datums, i, &datum);
+    cardano_plutus_data_unref(&datum);
+
+    cardano_blake2b_hash_t* hash = NULL;
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = compute_datum_hash(datum, &hash);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      found = !_cardano_blake2b_hash_set_has(allowed_hashes, hash);
+    }
+
+    cardano_blake2b_hash_unref(&hash);
+  }
+
+  cardano_blake2b_hash_set_unref(&allowed_hashes);
+
+  *has_foreign_datums = found;
+
+  return result;
+}
+
+/**
+ * \brief Rejects an iteration of the balancing loop whose top level transaction carries a witness datum the ledger
+ * does not allow in legacy mode.
+ *
+ * Every witness datum of a level must be needed by an input that level spends and that a Plutus script locks, or
+ * match a datum hash of the outputs it creates or of the outputs behind its reference inputs. A spent input locked by a
+ * native script, or by a script hash that no provided script matches, never needs its datum. A sub transaction
+ * normally extends the datum hashes the top level transaction may carry with its own outputs and reference inputs,
+ * but when the top level transaction is validated in legacy mode the ledger checks its datums with the sub
+ * transactions removed. The scripts the sub transactions provide still take part in resolving the scripts that lock
+ * the inputs of the top level transaction, since the ledger pools the provided scripts over the whole batch.
+ *
+ * \param[in] tx                    The top level transaction, whose inputs and outputs are the ones of the current
+ *                                  iteration.
+ * \param[in] reference_inputs      The resolved reference inputs of the transaction, or NULL when it has none.
+ * \param[in] pre_selected_utxo     The UTXOs that must be included in the transaction inputs, or NULL when there are
+ *                                  none.
+ * \param[in] selection             The UTXOs spent by the transaction on this iteration.
+ * \param[in] sub_transaction_utxos The resolved UTXOs the sub transactions spend or reference.
+ *
+ * \return \ref CARDANO_SUCCESS if the iteration may go on, \ref CARDANO_ERROR_NOT_ALLOWED_SUPPLEMENTAL_DATUMS if the
+ *         transaction carries sub transactions, is validated in legacy mode and carries a witness datum that the
+ *         ledger does not allow once the sub transactions are removed, or an appropriate error code.
+ */
+static cardano_error_t
+check_legacy_mode_supplemental_datums(
+  cardano_transaction_t* tx,
+  cardano_utxo_list_t*   reference_inputs,
+  cardano_utxo_list_t*   pre_selected_utxo,
+  cardano_utxo_list_t*   selection,
+  cardano_utxo_list_t*   sub_transaction_utxos)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_sub_transaction_set_t* sub_transactions = cardano_transaction_body_get_sub_transactions(body);
+  cardano_sub_transaction_set_unref(&sub_transactions);
+
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(tx);
+  cardano_witness_set_unref(&witness_set);
+
+  cardano_plutus_data_set_t* datums = cardano_witness_set_get_plutus_data(witness_set);
+  cardano_plutus_data_set_unref(&datums);
+
+  if ((cardano_sub_transaction_set_get_length(sub_transactions) == 0U) || (cardano_plutus_data_set_get_length(datums) == 0U))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  bool has_foreign_datums = false;
+
+  cardano_error_t result = has_datums_not_allowed_by_top_level(tx, datums, reference_inputs, pre_selected_utxo, selection, sub_transaction_utxos, &has_foreign_datums);
+
+  if ((result != CARDANO_SUCCESS) || !has_foreign_datums)
+  {
+    return result;
+  }
+
+  bool is_legacy_mode = false;
+
+  result = is_legacy_mode_transaction(tx, reference_inputs, pre_selected_utxo, selection, sub_transaction_utxos, &is_legacy_mode);
+
+  if ((result != CARDANO_SUCCESS) || !is_legacy_mode)
+  {
+    return result;
+  }
+
+  cardano_transaction_set_last_error(
+    tx,
+    "The top level transaction needs a PlutusV1, PlutusV2 or PlutusV3 script, so each of its witness datums must be needed by an input it spends or match a datum hash of its own outputs or reference inputs. For example, a datum that only matches an output or a reference input of a sub transaction is not allowed.");
+
+  return CARDANO_ERROR_NOT_ALLOWED_SUPPLEMENTAL_DATUMS;
+}
+
+/**
+ * \brief Adds to a list the UTXOs of another list whose input the list does not hold yet.
+ *
+ * \param[in,out] list  The list that receives the UTXOs.
+ * \param[in]     utxos The UTXOs to add, or NULL when there are none.
+ *
+ * \return \ref CARDANO_SUCCESS if the UTXOs were added, or an appropriate error code.
+ */
+static cardano_error_t
+add_utxos_with_new_inputs(cardano_utxo_list_t* list, cardano_utxo_list_t* utxos)
+{
+  const size_t num_utxos = cardano_utxo_list_get_length(utxos);
+
+  for (size_t i = 0U; i < num_utxos; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    cardano_error_t result = cardano_utxo_list_get(utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+    cardano_transaction_input_unref(&input);
+
+    cardano_utxo_t* listed_utxo = cardano_utxo_list_find(list, find_utxo, (void*)input);
+    cardano_utxo_unref(&listed_utxo);
+
+    if (listed_utxo == NULL)
+    {
+      result = cardano_utxo_list_add(list, utxo);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Looks up the resolved UTXO of a transaction input among the lists of UTXOs given to the balancer.
+ *
+ * The available UTXOs are searched first, then the resolved reference inputs of the top level transaction and then the
+ * pre selected UTXOs, since a UTXO may be shared between the top level transaction and its sub transactions.
+ *
+ * \param[in] input             The transaction input to resolve.
+ * \param[in] available_utxo    The list of available UTXOs, or NULL when there are none.
+ * \param[in] reference_inputs  The resolved reference inputs of the top level transaction, or NULL when it has none.
+ * \param[in] pre_selected_utxo The UTXOs that must be included in the transaction inputs, or NULL when there are none.
+ *
+ * \return A new reference to the resolved UTXO, or NULL if none of the lists resolves the input.
+ *
+ * \note The caller is responsible for releasing the returned UTXO with \ref cardano_utxo_unref.
+ */
+static cardano_utxo_t*
+find_resolved_utxo(
+  const cardano_transaction_input_t* input,
+  cardano_utxo_list_t*               available_utxo,
+  cardano_utxo_list_t*               reference_inputs,
+  cardano_utxo_list_t*               pre_selected_utxo)
+{
+  cardano_utxo_t* utxo = cardano_utxo_list_find(available_utxo, find_utxo, input);
+
+  if (utxo == NULL)
+  {
+    utxo = cardano_utxo_list_find(reference_inputs, find_utxo, input);
+  }
+
+  if (utxo == NULL)
+  {
+    utxo = cardano_utxo_list_find(pre_selected_utxo, find_utxo, input);
+  }
+
+  return utxo;
+}
+
+/**
+ * \brief Adds to a list the resolved UTXOs of a set of transaction inputs whose input the list does not hold yet.
+ *
+ * \param[in,out] list              The list that receives the UTXOs.
+ * \param[in]     inputs            The transaction inputs to resolve, or NULL when there are none.
+ * \param[in]     available_utxo    The list of available UTXOs, or NULL when there are none.
+ * \param[in]     reference_inputs  The resolved reference inputs of the top level transaction, or NULL when it has none.
+ * \param[in]     pre_selected_utxo The UTXOs that must be included in the transaction inputs, or NULL when there are none.
+ * \param[in]     skip_unresolved   Whether an input that is not resolved is skipped instead of reported as an error.
+ *
+ * \return \ref CARDANO_SUCCESS if the UTXOs were added, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if an input is not
+ *         resolved and \p skip_unresolved is not set, or an appropriate error code.
+ */
+static cardano_error_t
+add_resolved_inputs(
+  cardano_utxo_list_t*             list,
+  cardano_transaction_input_set_t* inputs,
+  cardano_utxo_list_t*             available_utxo,
+  cardano_utxo_list_t*             reference_inputs,
+  cardano_utxo_list_t*             pre_selected_utxo,
+  const bool                       skip_unresolved)
+{
+  const size_t num_inputs = cardano_transaction_input_set_get_length(inputs);
+
+  for (size_t i = 0U; i < num_inputs; ++i)
+  {
+    cardano_transaction_input_t* input = NULL;
+
+    cardano_error_t result = cardano_transaction_input_set_get(inputs, i, &input);
+    cardano_transaction_input_unref(&input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_utxo_t* listed_utxo = cardano_utxo_list_find(list, find_utxo, input);
+    cardano_utxo_unref(&listed_utxo);
+
+    if (listed_utxo != NULL)
+    {
+      continue;
+    }
+
+    cardano_utxo_t* utxo = find_resolved_utxo(input, available_utxo, reference_inputs, pre_selected_utxo);
+    cardano_utxo_unref(&utxo);
+
+    if ((utxo == NULL) && !skip_unresolved)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    if (utxo != NULL)
+    {
+      result = cardano_utxo_list_add(list, utxo);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Creates the list of resolved UTXOs spent by the sub transactions of a set.
+ *
+ * The value of these UTXOs takes part in the value conservation of the whole batch, so every spend input of every sub
+ * transaction must be resolved.
+ *
+ * \param[in]  sub_transactions  The sub transactions carried by the transaction, or NULL when it has none.
+ * \param[in]  available_utxo    The list of available UTXOs, or NULL when there are none.
+ * \param[in]  reference_inputs  The resolved reference inputs of the top level transaction, or NULL when it has none.
+ * \param[in]  pre_selected_utxo The UTXOs that must be included in the transaction inputs, or NULL when there are none.
+ * \param[out] spent_utxos       A pointer to store the list, which is NULL when the transaction carries no sub
+ *                               transactions.
+ *
+ * \return \ref CARDANO_SUCCESS if the list was created, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if a sub transaction spends
+ *         an input that is not resolved, or an appropriate error code.
+ *
+ * \note The caller is responsible for freeing `spent_utxos` when it is no longer needed.
+ */
+static cardano_error_t
+get_sub_transaction_spent_utxos(
+  cardano_sub_transaction_set_t* sub_transactions,
+  cardano_utxo_list_t*           available_utxo,
+  cardano_utxo_list_t*           reference_inputs,
+  cardano_utxo_list_t*           pre_selected_utxo,
+  cardano_utxo_list_t**          spent_utxos)
+{
+  const size_t num_sub_transactions = cardano_sub_transaction_set_get_length(sub_transactions);
+
+  if (num_sub_transactions == 0U)
+  {
+    *spent_utxos = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_utxo_list_t* spent_list = NULL;
+
+  cardano_error_t result = cardano_utxo_list_new(&spent_list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0U; i < num_sub_transactions; ++i)
+  {
+    cardano_sub_transaction_t* sub_tx = NULL;
+
+    result = cardano_sub_transaction_set_get(sub_transactions, i, &sub_tx);
+    cardano_sub_transaction_unref(&sub_tx);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_utxo_list_unref(&spent_list);
+
+      return result;
+    }
+
+    cardano_sub_transaction_body_t* body = cardano_sub_transaction_get_body(sub_tx);
+    cardano_sub_transaction_body_unref(&body);
+
+    cardano_transaction_input_set_t* inputs = cardano_sub_transaction_body_get_inputs(body);
+    cardano_transaction_input_set_unref(&inputs);
+
+    result = add_resolved_inputs(spent_list, inputs, available_utxo, reference_inputs, pre_selected_utxo, false);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_utxo_list_unref(&spent_list);
+
+      return result;
+    }
+  }
+
+  *spent_utxos = spent_list;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Appends the resolved UTXOs of a sub transaction whose reference scripts the fee includes to a running list.
+ *
+ * The reference inputs and the spend inputs of the sub transaction are taken as a set, so a UTXO that the sub
+ * transaction both references and spends is appended once. Reference inputs that are not resolved are skipped, since
+ * they are only needed to price their reference scripts.
+ *
+ * \param[in]     sub_tx            The sub transaction whose resolved UTXOs are appended.
+ * \param[in]     available_utxo    The list of available UTXOs, or NULL when there are none.
+ * \param[in]     reference_inputs  The resolved reference inputs of the top level transaction, or NULL when it has none.
+ * \param[in]     pre_selected_utxo The UTXOs that must be included in the transaction inputs, or NULL when there are none.
+ * \param[in,out] priced_inputs     The running list. On success it is replaced by a new list that also holds the UTXOs
+ *                                  of the sub transaction; on failure, or when the sub transaction has no resolved
+ *                                  UTXOs, it is left untouched.
+ *
+ * \return \ref CARDANO_SUCCESS if the UTXOs were appended, or an appropriate error code.
+ */
+static cardano_error_t
+add_sub_transaction_priced_inputs(
+  cardano_sub_transaction_t* sub_tx,
+  cardano_utxo_list_t*       available_utxo,
+  cardano_utxo_list_t*       reference_inputs,
+  cardano_utxo_list_t*       pre_selected_utxo,
+  cardano_utxo_list_t**      priced_inputs)
+{
+  cardano_sub_transaction_body_t* body = cardano_sub_transaction_get_body(sub_tx);
+  cardano_sub_transaction_body_unref(&body);
+
+  cardano_transaction_input_set_t* body_reference_inputs = cardano_sub_transaction_body_get_reference_inputs(body);
+  cardano_transaction_input_set_t* body_inputs           = cardano_sub_transaction_body_get_inputs(body);
+
+  cardano_transaction_input_set_unref(&body_reference_inputs);
+  cardano_transaction_input_set_unref(&body_inputs);
+
+  cardano_utxo_list_t* body_utxos = NULL;
+
+  cardano_error_t result = cardano_utxo_list_new(&body_utxos);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = add_resolved_inputs(body_utxos, body_reference_inputs, available_utxo, reference_inputs, pre_selected_utxo, true);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_resolved_inputs(body_utxos, body_inputs, available_utxo, reference_inputs, pre_selected_utxo, false);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&body_utxos);
+
+    return result;
+  }
+
+  if (cardano_utxo_list_get_length(body_utxos) == 0U)
+  {
+    cardano_utxo_list_unref(&body_utxos);
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_utxo_list_t* updated_inputs = cardano_utxo_list_concat(*priced_inputs, body_utxos);
+
+  cardano_utxo_list_unref(&body_utxos);
+
+  if (updated_inputs == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_utxo_list_unref(priced_inputs);
+  *priced_inputs = updated_inputs;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Creates the list of resolved UTXOs of the sub transactions whose reference scripts the fee includes.
+ *
+ * The top level transaction pays the fee of the whole batch, so the reference scripts reachable from its sub
+ * transactions are priced too: the ones of their resolved reference inputs and the ones that sit on the UTXOs they
+ * spend. The UTXOs are taken from the body of each sub transaction, as a set, so a UTXO that a sub transaction both
+ * references and spends is listed once, while a UTXO used by several sub transactions is listed, and priced, once per
+ * sub transaction, as the ledger prices the reference scripts of a batch. Besides pricing reference scripts, this list
+ * resolves the inputs and reference inputs of the sub transactions when the transaction evaluator runs their scripts
+ * together with the ones of the top level transaction, and provides their reference scripts to the lookup of the
+ * scripts the top level transaction needs, which the ledger pools over the whole batch. The scripts the sub
+ * transactions need take no part in the validation mode of the top level transaction.
+ *
+ * \param[in]  sub_transactions  The sub transactions carried by the transaction, or NULL when it has none.
+ * \param[in]  available_utxo    The list of available UTXOs, or NULL when there are none.
+ * \param[in]  reference_inputs  The resolved reference inputs of the top level transaction, or NULL when it has none.
+ * \param[in]  pre_selected_utxo The UTXOs that must be included in the transaction inputs, or NULL when there are none.
+ * \param[out] priced_inputs     A pointer to store the list.
+ *
+ * \return \ref CARDANO_SUCCESS if the list was created, or an appropriate error code.
+ *
+ * \note The caller is responsible for freeing `priced_inputs` when it is no longer needed.
+ */
+static cardano_error_t
+get_sub_transaction_priced_inputs(
+  cardano_sub_transaction_set_t* sub_transactions,
+  cardano_utxo_list_t*           available_utxo,
+  cardano_utxo_list_t*           reference_inputs,
+  cardano_utxo_list_t*           pre_selected_utxo,
+  cardano_utxo_list_t**          priced_inputs)
+{
+  cardano_utxo_list_t* priced_list = NULL;
+
+  cardano_error_t result = cardano_utxo_list_new(&priced_list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const size_t num_sub_transactions = cardano_sub_transaction_set_get_length(sub_transactions);
+
+  for (size_t i = 0U; i < num_sub_transactions; ++i)
+  {
+    cardano_sub_transaction_t* sub_tx = NULL;
+
+    result = cardano_sub_transaction_set_get(sub_transactions, i, &sub_tx);
+    cardano_sub_transaction_unref(&sub_tx);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = add_sub_transaction_priced_inputs(sub_tx, available_utxo, reference_inputs, pre_selected_utxo, &priced_list);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_utxo_list_unref(&priced_list);
+
+      return result;
+    }
+  }
+
+  *priced_inputs = priced_list;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Creates the list of resolved UTXOs whose reference scripts the fee of a balancing iteration includes.
+ *
+ * The ledger charges for every reference script found on the outputs behind the reference inputs and the spend
+ * inputs of a transaction, whatever its language and whether or not it runs. The inputs are taken as a set, so a UTXO
+ * that is both referenced and spent is priced once, while the same script sitting on two different UTXOs is priced
+ * twice. The spend inputs change with every coin selection, so the list is created again on every iteration. The
+ * priced UTXOs of the sub transactions are appended as they are.
+ *
+ * \param[in]  reference_inputs              The resolved reference inputs of the top level transaction.
+ * \param[in]  pre_selected_utxo             The UTXOs that must be included in the transaction inputs, or NULL when
+ *                                           there are none.
+ * \param[in]  selection                     The UTXOs spent by the transaction on this iteration.
+ * \param[in]  sub_transaction_priced_inputs The priced UTXOs of the sub transactions.
+ * \param[out] priced_inputs                 A pointer to store the list.
+ *
+ * \return \ref CARDANO_SUCCESS if the list was created, or an appropriate error code.
+ *
+ * \note The caller is responsible for freeing `priced_inputs` when it is no longer needed.
+ */
+static cardano_error_t
+get_priced_inputs(
+  cardano_utxo_list_t*  reference_inputs,
+  cardano_utxo_list_t*  pre_selected_utxo,
+  cardano_utxo_list_t*  selection,
+  cardano_utxo_list_t*  sub_transaction_priced_inputs,
+  cardano_utxo_list_t** priced_inputs)
+{
+  if (reference_inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_utxo_list_t* top_level_inputs = NULL;
+
+  cardano_error_t result = cardano_utxo_list_new(&top_level_inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = add_utxos_with_new_inputs(top_level_inputs, reference_inputs);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_utxos_with_new_inputs(top_level_inputs, pre_selected_utxo);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_utxos_with_new_inputs(top_level_inputs, selection);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&top_level_inputs);
+
+    return result;
+  }
+
+  if (cardano_utxo_list_get_length(sub_transaction_priced_inputs) == 0U)
+  {
+    *priced_inputs = top_level_inputs;
+
+    return CARDANO_SUCCESS;
+  }
+
+  *priced_inputs = cardano_utxo_list_concat(top_level_inputs, sub_transaction_priced_inputs);
+
+  cardano_utxo_list_unref(&top_level_inputs);
+
+  if (*priced_inputs == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Sets the transaction inputs for a transaction body.
+ *
+ * This function takes a list of selected UTXOs and sets them as inputs in the provided transaction body.
+ *
+ * \param[in,out] body       The transaction body to which the inputs will be added.
+ * \param[in]     selection  The list of selected UTXOs to be set as transaction inputs.
+ * \param[in]     input_to_redeemer_map A map of input to redeemer values.
+ *
+ * \return \ref CARDANO_SUCCESS if the inputs were successfully set, or an appropriate error code indicating failure.
+ */
+static cardano_error_t
+set_transaction_inputs(
+  cardano_transaction_body_t*      body,
+  cardano_utxo_list_t*             selection,
+  cardano_input_to_redeemer_map_t* input_to_redeemer_map)
+{
+  cardano_transaction_input_set_t* inputs = NULL;
+  cardano_error_t                  result = cardano_transaction_input_set_new(&inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const size_t num_inputs = cardano_utxo_list_get_length(selection);
+
+  for (size_t i = 0U; i < num_inputs; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+    result               = cardano_utxo_list_get(selection, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_input_set_unref(&inputs);
+
+      return result;
+    }
+
+    cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+    cardano_transaction_input_unref(&input);
+
+    result = cardano_transaction_input_set_add(inputs, input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_input_set_unref(&inputs);
+
+      return result;
+    }
+  }
+
+  if (input_to_redeemer_map != NULL)
+  {
+    for (size_t i = 0U; i < num_inputs; ++i)
+    {
+      cardano_transaction_input_t* input = NULL;
+
+      result = cardano_transaction_input_set_get(inputs, i, &input);
+      cardano_transaction_input_unref(&input);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_transaction_input_set_unref(&inputs);
+        return result;
+      }
+
+      result = cardano_input_to_redeemer_map_update_redeemer_index(input_to_redeemer_map, input, i);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_transaction_input_set_unref(&inputs);
+
+        return result;
+      }
+    }
+  }
+
+  result = cardano_transaction_body_set_inputs(body, inputs);
+
+  cardano_transaction_input_set_unref(&inputs);
+
+  return result;
+}
+
+/**
+ * \brief Verifies and appends the change outputs produced by the coin selector to a transaction body.
+ *
+ * This function verifies that every change output returned by the coin selector meets the minimum ADA
+ * requirement specified by the protocol parameters, and appends them to the transaction body's output list.
+ *
+ * \param[in,out] body            The transaction body to which the change outputs will be added.
+ * \param[in]     protocol_params The protocol parameters for computing minimum UTXO requirements.
+ * \param[in]     change_outputs  The list of change outputs produced by the coin selector.
+ *
+ * \return \ref CARDANO_SUCCESS if the change outputs were successfully added, \ref CARDANO_ERROR_BALANCE_INSUFFICIENT
+ *         if a change output is below the min-ADA requirement, or an error code if any issue was encountered.
+ */
+static cardano_error_t
+add_change_outputs(
+  cardano_transaction_body_t*        body,
+  cardano_protocol_parameters_t*     protocol_params,
+  cardano_transaction_output_list_t* change_outputs)
+{
+  const uint64_t ada_per_utxo_byte  = cardano_protocol_parameters_get_ada_per_utxo_byte(protocol_params);
+  const size_t   num_change_outputs = cardano_transaction_output_list_get_length(change_outputs);
+
+  cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(body);
+  cardano_transaction_output_list_unref(&outputs);
+
+  for (size_t i = 0U; i < num_change_outputs; ++i)
+  {
+    cardano_transaction_output_t* change_output = NULL;
+    cardano_error_t               result        = cardano_transaction_output_list_get(change_outputs, i, &change_output);
+    cardano_transaction_output_unref(&change_output);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    uint64_t min_utxo_value = 0U;
+    result                  = cardano_compute_min_ada_required(change_output, ada_per_utxo_byte, &min_utxo_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_value_t* change_value = cardano_transaction_output_get_value(change_output);
+    cardano_value_unref(&change_value);
+
+    if (cardano_value_get_coin(change_value) < (int64_t)min_utxo_value)
+    {
+      return CARDANO_ERROR_BALANCE_INSUFFICIENT;
+    }
+
+    result = cardano_transaction_output_list_add(outputs, change_output);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Creates a shallow copy of a transaction output list.
+ *
+ * This function creates a shallow clone of the given `cardano_transaction_output_list_t`.
+ * Each output in the list is referenced by the new list, but no deep copy of the individual
+ * outputs is made. The reference count of each output is incremented to manage shared ownership.
+ *
+ * \param[in] original The original transaction output list to clone.
+ *
+ * \return A new `cardano_transaction_output_list_t` that references the same outputs as `original`.
+ *         Returns NULL if memory allocation fails or if `original` is NULL.
+ */
+static cardano_transaction_output_list_t*
+shallow_clone_outputs(cardano_transaction_output_list_t* original)
+{
+  cardano_transaction_output_list_t* new_outputs = NULL;
+  cardano_error_t                    result      = cardano_transaction_output_list_new(&new_outputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_output_list_unref(&new_outputs);
+
+    return NULL;
+  }
+
+  const size_t num_outputs = cardano_transaction_output_list_get_length(original);
+
+  for (size_t i = 0U; i < num_outputs; ++i)
+  {
+    cardano_transaction_output_t* output = NULL;
+    result                               = cardano_transaction_output_list_get(original, i, &output);
+    cardano_transaction_output_unref(&output);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&new_outputs);
+
+      return NULL;
+    }
+
+    result = cardano_transaction_output_list_add(new_outputs, output);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&new_outputs);
+
+      return NULL;
+    }
+  }
+
+  return new_outputs;
+}
+
+/**
+ * \brief Finds the first native asset that a value requires beyond what another value holds.
+ *
+ * \param[in]  required_value   The value the inputs of the transaction must provide.
+ * \param[in]  available_value  The value the UTXOs available to balance the transaction hold.
+ * \param[out] asset_id         The first asset the available value does not cover, or NULL if it covers every asset.
+ * \param[out] required_amount  The amount of that asset the inputs must provide.
+ * \param[out] available_amount The amount of that asset the available UTXOs hold.
+ */
+static void
+find_missing_asset(
+  cardano_value_t*     required_value,
+  cardano_value_t*     available_value,
+  cardano_asset_id_t** asset_id,
+  int64_t*             required_amount,
+  int64_t*             available_amount)
+{
+  cardano_asset_id_map_t* required_assets  = cardano_value_as_assets_map(required_value);
+  cardano_asset_id_map_t* available_assets = cardano_value_as_assets_map(available_value);
+  const size_t            asset_count      = cardano_asset_id_map_get_length(required_assets);
+
+  *asset_id = NULL;
+
+  for (size_t i = 0U; (i < asset_count) && (*asset_id == NULL); ++i)
+  {
+    cardano_asset_id_t* candidate        = NULL;
+    int64_t             candidate_amount = 0;
+    int64_t             held_amount      = 0;
+
+    if (cardano_asset_id_map_get_key_value_at(required_assets, i, &candidate, &candidate_amount) == CARDANO_SUCCESS)
+    {
+      if (cardano_asset_id_map_get(available_assets, candidate, &held_amount) != CARDANO_SUCCESS)
+      {
+        held_amount = 0;
+      }
+
+      if (!cardano_asset_id_is_lovelace(candidate) && (candidate_amount > held_amount))
+      {
+        cardano_asset_id_ref(candidate);
+
+        *asset_id         = candidate;
+        *required_amount  = candidate_amount;
+        *available_amount = held_amount;
+      }
+    }
+
+    cardano_asset_id_unref(&candidate);
+  }
+
+  cardano_asset_id_map_unref(&required_assets);
+  cardano_asset_id_map_unref(&available_assets);
+}
+
+/**
+ * \brief Sets the last error of a transaction to describe a value that coin selection can not cover.
+ *
+ * When the UTXOs available to balance the transaction lack a native asset it spends, the error names that asset.
+ * Otherwise it reports the lovelace the inputs must provide, or zero when the implicit value of the transaction already
+ * covers its outputs, and the lovelace the available UTXOs hold.
+ *
+ * \param[in,out] tx                The transaction that receives the error message.
+ * \param[in]     required_value    The value the inputs of the transaction must provide.
+ * \param[in]     pre_selected_utxo The UTXOs the transaction must spend, or NULL.
+ * \param[in]     available_utxo    The UTXOs coin selection may spend.
+ */
+static void
+set_insufficient_balance_error(
+  cardano_transaction_t* tx,
+  cardano_value_t*       required_value,
+  cardano_utxo_list_t*   pre_selected_utxo,
+  cardano_utxo_list_t*   available_utxo)
+{
+  cardano_value_t*    pre_selected_value = NULL;
+  cardano_value_t*    available_value    = NULL;
+  cardano_value_t*    total_value        = NULL;
+  cardano_asset_id_t* missing_asset      = NULL;
+  int64_t             required_amount    = 0;
+  int64_t             available_amount   = 0;
+  int64_t             required_coin      = cardano_value_get_coin(required_value);
+  int64_t             available_coin     = 0;
+
+  if ((_cardano_coalesce_all_utxos(pre_selected_utxo, &pre_selected_value) == CARDANO_SUCCESS) && (_cardano_coalesce_all_utxos(available_utxo, &available_value) == CARDANO_SUCCESS) && (cardano_value_add(pre_selected_value, available_value, &total_value) == CARDANO_SUCCESS))
+  {
+    available_coin = cardano_value_get_coin(total_value);
+
+    find_missing_asset(required_value, total_value, &missing_asset, &required_amount, &available_amount);
+  }
+
+  cardano_value_unref(&pre_selected_value);
+  cardano_value_unref(&available_value);
+  cardano_value_unref(&total_value);
+
+  if (required_coin < 0)
+  {
+    required_coin = 0;
+  }
+
+  char    buffer[512] = { 0 };
+  int32_t written     = 0;
+
+  if (missing_asset != NULL)
+  {
+    written = snprintf(
+      buffer,
+      sizeof(buffer),
+      "The transaction requires %" PRId64 " of the asset %s from its inputs, but the UTXOs available to balance it hold %" PRId64 ".",
+      required_amount,
+      cardano_asset_id_get_hex(missing_asset),
+      available_amount);
+  }
+  else
+  {
+    written = snprintf(
+      buffer,
+      sizeof(buffer),
+      "The transaction requires %" PRId64 " lovelace from its inputs, plus the assets it spends and the min-ADA of its change, but the UTXOs available to balance it hold %" PRId64 " lovelace.",
+      required_coin,
+      available_coin);
+  }
+
+  assert(written > 0);
+  CARDANO_UNUSED(written);
+
+  cardano_asset_id_unref(&missing_asset);
+
+  cardano_transaction_set_last_error(tx, buffer);
+}
+
+/**
+ * \brief Computes the CBOR array header size for a given element count.
+ *
+ * This function determines the number of bytes required for encoding the header of a CBOR array,
+ * based on the element count, following CBOR's size encoding conventions.
+ *
+ * \param[in] element_count The number of elements in the array.
+ *
+ * \return The size, in bytes, required to encode the CBOR array header for the specified element count.
+ */
+static size_t
+cbor_array_header_size(const size_t element_count)
+{
+  if (element_count <= 23U)
+  {
+    // 1 byte: 0x80 | element_count
+    return 1U;
+  }
+  else if (element_count <= 255U)
+  {
+    // 2 bytes: 0x98 followed by 1 byte for element count
+    return 2U;
+  }
+  else if (element_count <= 65535U)
+  {
+    // 3 bytes: 0x99 followed by 2 bytes for element count
+    return 3U;
+  }
+  else
+  {
+    // 5 bytes: 0x9a followed by 4 bytes for element count
+    return 5U;
+  }
+}
+
+/**
+ * \brief Computes the cost for VK (verification key) witnesses in a transaction.
+ *
+ * This function calculates the cost required to include a specified number of VK witnesses in a transaction, based on the
+ * minimum fee coefficient and an estimated size for each witness structure.
+ *
+ * Each VK witness takes 101 bytes, a structure with 2 fields (signature, public key). When the witness set already
+ * holds VK witnesses, its map key, the tag and the list header are part of the unsigned transaction, so only the new
+ * witnesses and the growth of the list header are added to the estimate. Otherwise signing introduces the entry, and
+ * the estimate adds its map key of 1 byte, the list header and, when the set signing fills is tagged, the 3 bytes of
+ * its tag. That set is the VK witness set the witness set already carries, even if empty, or a new set, which is
+ * tagged. No cost is added when there are no signatures. Any other entry of the witness set, such as native scripts or
+ * datums, keeps its own key and does not change the estimate.
+ *
+ * \param[in] witness_set The witness set of the transaction as it is before the VK witnesses are added.
+ * \param[in] signature_count The number of VK witnesses to include.
+ * \param[in] min_fee_coefficient The coefficient used to compute fees based on transaction size.
+ *
+ * \return The computed cost for including the VK witnesses.
+ */
+static int64_t
+compute_vk_witnesses_cost(
+  cardano_witness_set_t* witness_set,
+  const size_t           signature_count,
+  const uint64_t         min_fee_coefficient)
+{
+  if (signature_count == 0U)
+  {
+    return 0;
+  }
+
+  cardano_vkey_witness_set_t* vkey_witnesses = cardano_witness_set_get_vkeys(witness_set);
+  cardano_vkey_witness_set_unref(&vkey_witnesses);
+
+  const size_t current_count       = cardano_vkey_witness_set_get_length(vkey_witnesses);
+  size_t       vk_witness_set_size = 101U * signature_count;
+
+  if (current_count > 0U)
+  {
+    vk_witness_set_size += cbor_array_header_size(current_count + signature_count) - cbor_array_header_size(current_count);
+  }
+  else
+  {
+    vk_witness_set_size += 1U + cbor_array_header_size(signature_count);
+
+    if ((vkey_witnesses == NULL) || cardano_vkey_witness_set_get_use_tag(vkey_witnesses))
+    {
+      vk_witness_set_size += 3U;
+    }
+  }
+
+  return (int64_t)vk_witness_set_size * (int64_t)min_fee_coefficient;
+}
+
+/**
+ * \brief Computes the cost for the bootstrap witnesses the owners of the Byron inputs of a transaction add to it.
+ *
+ * Each bootstrap witness is a structure with 4 fields (public key, signature, chain code, attributes): an array header
+ * of 1 byte, the public key of 34 bytes, the signature of 66 bytes, the chain code of 34 bytes and the attributes of
+ * the Byron address of its owner, a byte string holding the CBOR encoded attributes map as the address encodes it,
+ * whose header has the size of an array header of the same length. When the witness set already holds bootstrap
+ * witnesses, its map key, the tag and the list header are part of the unsigned transaction, so only the new witnesses
+ * and the growth of the list header are added to the estimate. Otherwise signing introduces the entry, and the estimate
+ * adds its map key of 1 byte, the list header and, when the set signing fills is tagged, the 3 bytes of its tag. That
+ * set is the bootstrap witness set the witness set already carries, even if empty, or a new set, which is tagged. No
+ * cost is added when there are no Byron owners.
+ *
+ * \param[in] witness_set The witness set of the transaction as it is before the bootstrap witnesses are added.
+ * \param[in] bootstrap_signers One resolved UTXO per distinct Byron owner, as \ref _cardano_get_bootstrap_signers
+ *                              returns them.
+ * \param[in] min_fee_coefficient The coefficient used to compute fees based on transaction size.
+ * \param[out] cost On success, the computed cost for including the bootstrap witnesses.
+ *
+ * \return \ref CARDANO_SUCCESS if the cost was computed, or an appropriate error code if the attributes of a Byron
+ *         address could not be read.
+ */
+static cardano_error_t
+compute_bootstrap_witnesses_cost(
+  cardano_witness_set_t* witness_set,
+  cardano_utxo_list_t*   bootstrap_signers,
+  const uint64_t         min_fee_coefficient,
+  int64_t*               cost)
+{
+  *cost = 0;
+
+  const size_t signer_count = cardano_utxo_list_get_length(bootstrap_signers);
+
+  if (signer_count == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  size_t bootstrap_witness_set_size = 0U;
+
+  for (size_t i = 0U; i < signer_count; ++i)
+  {
+    cardano_utxo_t* utxo   = NULL;
+    cardano_error_t result = cardano_utxo_list_get(bootstrap_signers, i, &utxo);
+
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+    cardano_transaction_output_unref(&output);
+
+    cardano_address_t* address = cardano_transaction_output_get_address(output);
+    cardano_address_unref(&address);
+
+    cardano_buffer_t* attributes = NULL;
+
+    result = _cardano_get_bootstrap_witness_attributes(address, &attributes);
+
+    const size_t attributes_size = cardano_buffer_get_size(attributes);
+
+    cardano_buffer_unref(&attributes);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    bootstrap_witness_set_size += 135U + cbor_array_header_size(attributes_size) + attributes_size;
+  }
+
+  cardano_bootstrap_witness_set_t* bootstrap_witnesses = cardano_witness_set_get_bootstrap(witness_set);
+  cardano_bootstrap_witness_set_unref(&bootstrap_witnesses);
+
+  const size_t current_count = cardano_bootstrap_witness_set_get_length(bootstrap_witnesses);
+
+  if (current_count > 0U)
+  {
+    bootstrap_witness_set_size += cbor_array_header_size(current_count + signer_count) - cbor_array_header_size(current_count);
+  }
+  else
+  {
+    bootstrap_witness_set_size += 1U + cbor_array_header_size(signer_count);
+
+    if ((bootstrap_witnesses == NULL) || cardano_bootstrap_witness_set_get_use_tag(bootstrap_witnesses))
+    {
+      bootstrap_witness_set_size += 3U;
+    }
+  }
+
+  *cost = (int64_t)bootstrap_witness_set_size * (int64_t)min_fee_coefficient;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Runs the balancing loop of a transaction until the fee converges and the whole batch is balanced.
+ *
+ * On every iteration the value that coin selection must cover is the value of the outputs minus the implicit value of
+ * the batch: the withdrawals, the deposit refunds, the minted assets and the net imbalance of the sub transactions,
+ * minus the deposits, the fee, the donation and the direct deposits. A surplus of the sub transactions therefore lowers
+ * the target or ends up as change, while a deficit is funded by the selected inputs.
+ *
+ * The collateral, the coin selection and the change of an iteration are sized for the fee of that iteration, and the
+ * fee of the next iteration is the minimum fee the ledger requires for the transaction they produced, never lower than
+ * the fee the transaction carried before balancing. The loop ends once that minimum fee is the fee the iteration was
+ * sized for, so the fee is the ledger minimum for the transaction it pays for. The fee goes down when a lower fee needs
+ * a smaller transaction, for example fewer collateral inputs or a shorter change amount, but once it goes up again after
+ * going down it only goes up, which makes the loop end. The fee then exceeds the minimum by the bytes that kept the fee
+ * from settling.
+ *
+ * \param[in,out] unbalanced_tx                   The transaction to balance.
+ * \param[in]     foreign_signature_count         The number of expected extra signatures, not specified in the transaction.
+ * \param[in]     protocol_params                 The protocol parameters.
+ * \param[in]     reference_inputs                The resolved reference inputs of the transaction.
+ * \param[in]     sub_transaction_priced_inputs   The resolved UTXOs of the sub transactions whose reference scripts the
+ *                                                fee includes.
+ * \param[in]     pre_selected_utxo               The UTXOs that must be included in the transaction inputs.
+ * \param[in]     sub_transaction_spent_utxos     The resolved UTXOs spent by the sub transactions, or NULL when the
+ *                                                transaction carries none.
+ * \param[in]     sub_transactions_imbalance      The net imbalance of the sub transactions, zero when the transaction
+ *                                                carries none.
+ * \param[in]     top_level_pool_deposits         The pool deposits the top level body is charged for pools that a sub
+ *                                                transaction registers, which the ledger does not charge it. They are
+ *                                                taken out of the deposits of the top level body.
+ * \param[in]     input_to_redeemer_map           The map of inputs to redeemers.
+ * \param[in]     available_utxo                  The UTXOs coin selection may spend at the top level.
+ * \param[in]     coin_selector                   The coin selector.
+ * \param[in]     change_address                  The address that receives the change.
+ * \param[in]     available_collateral_utxo       The UTXOs available as collateral.
+ * \param[in]     collateral_change_address       The address that receives the collateral change.
+ * \param[in]     evaluator                       The transaction evaluator.
+ * \param[in]     deferred_redeemers              The deferred redeemers to resolve on every iteration, or NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction was balanced, or an appropriate error code.
+ */
+static cardano_error_t
+balance_transaction(
+  cardano_transaction_t*            unbalanced_tx,
+  const size_t                      foreign_signature_count,
+  cardano_protocol_parameters_t*    protocol_params,
+  cardano_utxo_list_t*              reference_inputs,
+  cardano_utxo_list_t*              sub_transaction_priced_inputs,
+  cardano_utxo_list_t*              pre_selected_utxo,
+  cardano_utxo_list_t*              sub_transaction_spent_utxos,
+  cardano_value_t*                  sub_transactions_imbalance,
+  const uint64_t                    top_level_pool_deposits,
+  cardano_input_to_redeemer_map_t*  input_to_redeemer_map,
+  cardano_utxo_list_t*              available_utxo,
+  cardano_coin_selector_t*          coin_selector,
+  cardano_address_t*                change_address,
+  cardano_utxo_list_t*              available_collateral_utxo,
+  cardano_address_t*                collateral_change_address,
+  cardano_tx_evaluator_t*           evaluator,
+  cardano_deferred_redeemer_list_t* deferred_redeemers,
+  cardano_pool_params_t* const*     pool_state,
+  const size_t                      pool_state_size)
+{
+  cardano_error_t result      = CARDANO_SUCCESS;
+  bool            is_balanced = false;
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(unbalanced_tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_multi_asset_t* mint = cardano_transaction_body_get_mint(body);
+  cardano_multi_asset_unref(&mint);
+
+  cardano_implicit_coin_t implicit_coin = { 0 };
+  result                                = cardano_compute_implicit_coin(unbalanced_tx, protocol_params, &implicit_coin);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    if (result == CARDANO_ERROR_INTEGER_OVERFLOW)
+    {
+      cardano_transaction_set_last_error(unbalanced_tx, IMPLICIT_COIN_OVERFLOW_ERROR);
+    }
+    else
+    {
+      cardano_transaction_set_last_error(
+        unbalanced_tx,
+        "Failed to compute implicit coin for transaction balancing.");
+    }
+
+    return result;
+  }
+
+  assert(top_level_pool_deposits <= implicit_coin.deposits);
+
+  implicit_coin.deposits -= top_level_pool_deposits;
+
+  cardano_direct_deposit_map_t* direct_deposits = cardano_transaction_body_get_direct_deposits(body);
+  cardano_direct_deposit_map_unref(&direct_deposits);
+
+  uint64_t direct_deposit_total = 0U;
+
+  result = sum_direct_deposits(direct_deposits, &direct_deposit_total);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    if (result == CARDANO_ERROR_INTEGER_OVERFLOW)
+    {
+      cardano_transaction_set_last_error(unbalanced_tx, DIRECT_DEPOSITS_OVERFLOW_ERROR);
+    }
+    else
+    {
+      cardano_transaction_set_last_error(
+        unbalanced_tx,
+        "Failed to compute direct deposits for transaction balancing.");
+    }
+
+    return result;
+  }
+
+  cardano_transaction_output_list_t* original_outputs       = cardano_transaction_body_get_outputs(body);
+  cardano_transaction_output_list_t* shallow_cloned_outputs = shallow_clone_outputs(original_outputs);
+  cardano_transaction_output_list_unref(&original_outputs);
+
+  const uint64_t minimum_fee     = cardano_transaction_body_get_fee(body);
+  uint64_t       fee             = minimum_fee;
+  uint64_t       donation        = 0;
+  bool           has_lowered_fee = false;
+  bool           may_lower_fee   = true;
+
+  const uint64_t* donationPtr = cardano_transaction_body_get_donation(body);
+  if (donationPtr != NULL)
+  {
+    donation = *donationPtr;
+  }
+
+  while (!is_balanced)
+  {
+    cardano_transaction_output_list_t* outputs            = cardano_transaction_body_get_outputs(body);
+    cardano_value_t*                   total_output_value = NULL;
+    result                                                = coalesce_all_outputs(outputs, &total_output_value);
+
+    cardano_transaction_output_list_unref(&outputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      return result;
+    }
+
+    result = _cardano_set_collateral_output(
+      unbalanced_tx,
+      protocol_params,
+      available_collateral_utxo,
+      collateral_change_address);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_value_unref(&total_output_value);
+
+      return result;
+    }
+
+    int64_t consumed_coin = 0;
+
+    result = compute_consumed_coin(implicit_coin.withdrawals, implicit_coin.reclaim_deposits, &consumed_coin);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_value_unref(&total_output_value);
+
+      cardano_transaction_set_last_error(unbalanced_tx, CONSUMED_COIN_OVERFLOW_ERROR);
+
+      return result;
+    }
+
+    int64_t produced_coin = 0;
+
+    result = compute_produced_coin(implicit_coin.deposits, fee, donation, direct_deposit_total, &produced_coin);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_value_unref(&total_output_value);
+
+      cardano_transaction_set_last_error(unbalanced_tx, PRODUCED_COIN_OVERFLOW_ERROR);
+
+      return result;
+    }
+
+    cardano_value_t* top_level_implicit_value = NULL;
+
+    result = cardano_value_new(
+      consumed_coin - produced_coin,
+      mint,
+      &top_level_implicit_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_value_unref(&total_output_value);
+
+      return result;
+    }
+
+    cardano_value_t* implicit_value = NULL;
+
+    result = cardano_value_add(top_level_implicit_value, sub_transactions_imbalance, &implicit_value);
+
+    cardano_value_unref(&top_level_implicit_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_value_unref(&total_output_value);
+
+      return result;
+    }
+
+    cardano_value_t* required_input_value = NULL;
+    result                                = cardano_value_subtract(total_output_value, implicit_value, &required_input_value);
+
+    cardano_value_unref(&total_output_value);
+    cardano_value_unref(&implicit_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+
+      return result;
+    }
+
+    cardano_utxo_list_t*               selection      = NULL;
+    cardano_utxo_list_t*               remaining_utxo = NULL;
+    cardano_transaction_output_list_t* change_outputs = NULL;
+
+    cardano_coin_selection_request_t request = { 0 };
+
+    request.pre_selected_utxo = pre_selected_utxo;
+    request.available_utxo    = available_utxo;
+    request.target            = required_input_value;
+    request.outputs_to_cover  = shallow_cloned_outputs;
+    request.change_address    = change_address;
+    request.protocol_params   = protocol_params;
+
+    result = cardano_coin_selector_select(
+      coin_selector,
+      &request,
+      &selection,
+      &remaining_utxo,
+      &change_outputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+
+      const char* selector_error = cardano_coin_selector_get_last_error(coin_selector);
+
+      if ((result == CARDANO_ERROR_BALANCE_INSUFFICIENT) && (selector_error[0] == '\0'))
+      {
+        set_insufficient_balance_error(unbalanced_tx, required_input_value, pre_selected_utxo, available_utxo);
+      }
+      else
+      {
+        cardano_transaction_set_last_error(unbalanced_tx, selector_error);
+      }
+
+      cardano_value_unref(&required_input_value);
+
+      return result;
+    }
+
+    cardano_value_unref(&required_input_value);
+
+    result = set_transaction_inputs(body, selection, input_to_redeemer_map);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_transaction_output_list_unref(&change_outputs);
+      cardano_utxo_list_unref(&selection);
+      cardano_utxo_list_unref(&remaining_utxo);
+
+      return result;
+    }
+
+    result = add_change_outputs(body, protocol_params, change_outputs);
+
+    cardano_transaction_output_list_unref(&change_outputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_utxo_list_unref(&selection);
+      cardano_utxo_list_unref(&remaining_utxo);
+
+      if (result == CARDANO_ERROR_BALANCE_INSUFFICIENT)
+      {
+        cardano_transaction_set_last_error(
+          unbalanced_tx,
+          "Coin selector returned a change output below the min-ADA requirement.");
+      }
+
+      return result;
+    }
+
+    result = check_legacy_mode_sub_transactions(unbalanced_tx, sub_transactions_imbalance, reference_inputs, pre_selected_utxo, selection, sub_transaction_priced_inputs);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = check_legacy_mode_supplemental_datums(unbalanced_tx, reference_inputs, pre_selected_utxo, selection, sub_transaction_priced_inputs);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_utxo_list_unref(&selection);
+      cardano_utxo_list_unref(&remaining_utxo);
+
+      return result;
+    }
+
+    // Deferred redeemers are resolved once the canonical input order and the change outputs are
+    // final, and before evaluation, so that payloads are priced within the same iteration.
+    result = cardano_deferred_redeemer_list_resolve(deferred_redeemers, unbalanced_tx, selection);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_utxo_list_unref(&selection);
+      cardano_utxo_list_unref(&remaining_utxo);
+
+      return result;
+    }
+
+    cardano_witness_set_t* witnesses = cardano_transaction_get_witness_set(unbalanced_tx);
+    cardano_witness_set_unref(&witnesses);
+
+    cardano_redeemer_list_t* current_redeemers = cardano_witness_set_get_redeemers(witnesses);
+    cardano_redeemer_list_unref(&current_redeemers);
+
+    const bool has_plutus_scripts = cardano_redeemer_list_get_length(current_redeemers) > 0U;
+
+    if (has_plutus_scripts)
+    {
+      if (evaluator == NULL)
+      {
+        cardano_transaction_set_last_error(
+          unbalanced_tx,
+          "Transaction evaluator not set. Transaction evaluator is required to balance transactions with Plutus scripts.");
+
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+        cardano_utxo_list_unref(&selection);
+        cardano_utxo_list_unref(&remaining_utxo);
+
+        return CARDANO_ERROR_SCRIPT_EVALUATION_FAILURE;
+      }
+
+      cardano_redeemer_list_t* redeemers = NULL;
+
+      cardano_utxo_list_t* eval_utxos = selection;
+
+      if ((reference_inputs != NULL) && (cardano_utxo_list_get_length(reference_inputs) > 0U))
+      {
+        eval_utxos = cardano_utxo_list_concat(selection, reference_inputs);
+
+        if (eval_utxos == NULL)
+        {
+          cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+          cardano_utxo_list_unref(&selection);
+          cardano_utxo_list_unref(&remaining_utxo);
+
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+      }
+
+      if (cardano_utxo_list_get_length(sub_transaction_priced_inputs) > 0U)
+      {
+        cardano_utxo_list_t* batch_utxos = cardano_utxo_list_concat(eval_utxos, sub_transaction_priced_inputs);
+
+        if (eval_utxos != selection)
+        {
+          cardano_utxo_list_unref(&eval_utxos);
+        }
+
+        if (batch_utxos == NULL)
+        {
+          cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+          cardano_utxo_list_unref(&selection);
+          cardano_utxo_list_unref(&remaining_utxo);
+
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+
+        eval_utxos = batch_utxos;
+      }
+
+      result = cardano_tx_evaluator_evaluate(evaluator, unbalanced_tx, eval_utxos, &redeemers);
+
+      if (eval_utxos != selection)
+      {
+        cardano_utxo_list_unref(&eval_utxos);
+      }
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+        cardano_utxo_list_unref(&selection);
+        cardano_utxo_list_unref(&remaining_utxo);
+
+        cardano_transaction_set_last_error(
+          unbalanced_tx,
+          cardano_tx_evaluator_get_last_error(evaluator));
+
+        return result;
+      }
+
+      cardano_redeemer_list_t* tx_redeemers = cardano_witness_set_get_redeemers(witnesses);
+      cardano_redeemer_list_unref(&tx_redeemers);
+
+      const size_t redeemers_count = cardano_redeemer_list_get_length(redeemers);
+
+      for (size_t i = 0U; i < redeemers_count; ++i)
+      {
+        cardano_redeemer_t* redeemer = NULL;
+        result                       = cardano_redeemer_list_get(redeemers, i, &redeemer);
+        cardano_redeemer_unref(&redeemer);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+          cardano_utxo_list_unref(&selection);
+          cardano_utxo_list_unref(&remaining_utxo);
+          cardano_redeemer_list_unref(&redeemers);
+
+          return result;
+        }
+
+        const cardano_redeemer_tag_t tag   = cardano_redeemer_get_tag(redeemer);
+        const uint64_t               index = cardano_redeemer_get_index(redeemer);
+
+        cardano_ex_units_t* ex_units = cardano_redeemer_get_ex_units(redeemer);
+        cardano_ex_units_unref(&ex_units);
+
+        const uint64_t mem   = cardano_ex_units_get_memory(ex_units);
+        const uint64_t steps = cardano_ex_units_get_cpu_steps(ex_units);
+
+        result = cardano_redeemer_list_set_ex_units(tx_redeemers, tag, index, mem, steps);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+          cardano_utxo_list_unref(&selection);
+          cardano_utxo_list_unref(&remaining_utxo);
+          cardano_redeemer_list_unref(&redeemers);
+
+          return result;
+        }
+      }
+
+      cardano_redeemer_list_unref(&redeemers);
+    }
+
+    uint64_t             computed_fee    = 0;
+    cardano_utxo_list_t* resolved_inputs = selection;
+    cardano_utxo_list_ref(selection);
+
+    if (pre_selected_utxo != NULL)
+    {
+      cardano_utxo_list_unref(&resolved_inputs);
+      resolved_inputs = cardano_utxo_list_concat(pre_selected_utxo, selection);
+
+      if (resolved_inputs == NULL)
+      {
+        cardano_transaction_set_last_error(
+          unbalanced_tx,
+          "Joining the pre selected UTXOs and the coin selection into the resolved inputs ran out of memory.");
+
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+        cardano_utxo_list_unref(&selection);
+        cardano_utxo_list_unref(&remaining_utxo);
+
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+    }
+
+    if (available_collateral_utxo != NULL)
+    {
+      cardano_utxo_list_t* resolved_with_collateral = cardano_utxo_list_concat(available_collateral_utxo, resolved_inputs);
+
+      cardano_utxo_list_unref(&resolved_inputs);
+      resolved_inputs = resolved_with_collateral;
+
+      if (resolved_inputs == NULL)
+      {
+        cardano_transaction_set_last_error(
+          unbalanced_tx,
+          "Adding the collateral UTXOs to the resolved inputs ran out of memory.");
+
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+        cardano_utxo_list_unref(&selection);
+        cardano_utxo_list_unref(&remaining_utxo);
+
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+    }
+
+    cardano_blake2b_hash_set_t* unique_signers = NULL;
+
+    cardano_protocol_version_t* version = cardano_protocol_parameters_get_protocol_version(protocol_params);
+    result                              = cardano_transaction_get_unique_signers_with_pool_state(unbalanced_tx, resolved_inputs, cardano_protocol_version_get_major(version), pool_state, pool_state_size, &unique_signers);
+    cardano_protocol_version_unref(&version);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_utxo_list_unref(&resolved_inputs);
+      cardano_utxo_list_unref(&selection);
+      cardano_utxo_list_unref(&remaining_utxo);
+
+      return result;
+    }
+
+    cardano_utxo_list_t* bootstrap_signers = NULL;
+
+    result = _cardano_get_bootstrap_signers(unbalanced_tx, resolved_inputs, &bootstrap_signers);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_utxo_list_unref(&resolved_inputs);
+      cardano_utxo_list_unref(&selection);
+      cardano_utxo_list_unref(&remaining_utxo);
+      cardano_blake2b_hash_set_unref(&unique_signers);
+
+      return result;
+    }
+
+    cardano_utxo_list_t* priced_inputs = NULL;
+
+    result = get_priced_inputs(reference_inputs, pre_selected_utxo, selection, sub_transaction_priced_inputs, &priced_inputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_utxo_list_unref(&resolved_inputs);
+      cardano_utxo_list_unref(&selection);
+      cardano_utxo_list_unref(&remaining_utxo);
+      cardano_blake2b_hash_set_unref(&unique_signers);
+      cardano_utxo_list_unref(&bootstrap_signers);
+
+      return result;
+    }
+
+    result = cardano_compute_transaction_fee(unbalanced_tx, priced_inputs, protocol_params, &computed_fee);
+
+    cardano_utxo_list_unref(&priced_inputs);
+
+    const uint64_t signer_count             = foreign_signature_count + cardano_blake2b_hash_set_get_length(unique_signers);
+    const int64_t  vk_witnesses_cost        = compute_vk_witnesses_cost(witnesses, signer_count, cardano_protocol_parameters_get_min_fee_a(protocol_params));
+    int64_t        bootstrap_witnesses_cost = 0;
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = compute_bootstrap_witnesses_cost(witnesses, bootstrap_signers, cardano_protocol_parameters_get_min_fee_a(protocol_params), &bootstrap_witnesses_cost);
+    }
+
+    computed_fee += (uint64_t)vk_witnesses_cost + (uint64_t)bootstrap_witnesses_cost;
+
+    cardano_utxo_list_unref(&selection);
+    cardano_utxo_list_unref(&remaining_utxo);
+    cardano_blake2b_hash_set_unref(&unique_signers);
+    cardano_utxo_list_unref(&bootstrap_signers);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      cardano_utxo_list_unref(&resolved_inputs);
+
+      return result;
+    }
+
+    if (computed_fee < minimum_fee)
+    {
+      computed_fee = minimum_fee;
+    }
+
+    if ((computed_fee > fee) && has_lowered_fee)
+    {
+      may_lower_fee = false;
+    }
+
+    if ((computed_fee > fee) || ((computed_fee < fee) && may_lower_fee))
+    {
+      has_lowered_fee = has_lowered_fee || (computed_fee < fee);
+      fee             = computed_fee;
+      result          = cardano_transaction_body_set_fee(body, fee);
+
+      cardano_utxo_list_unref(&resolved_inputs);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+        return result;
+      }
+
+      cardano_transaction_output_list_t* tmp = shallow_clone_outputs(shallow_cloned_outputs);
+      result                                 = cardano_transaction_body_set_outputs(body, tmp);
+      cardano_transaction_output_list_unref(&tmp);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+
+        return result;
+      }
+
+      cardano_transaction_input_set_t* empty_inputs = NULL;
+      result                                        = cardano_transaction_input_set_new(&empty_inputs);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+        return result;
+      }
+
+      result = cardano_transaction_body_set_inputs(body, empty_inputs);
+      cardano_transaction_input_set_unref(&empty_inputs);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+        return result;
+      }
+
+      result = cardano_transaction_body_set_collateral(body, NULL);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+        return result;
+      }
+
+      result = cardano_transaction_body_set_collateral_return(body, NULL);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+        return result;
+      }
+
+      result = cardano_transaction_body_set_total_collateral(body, NULL);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+        return result;
+      }
+
+      continue;
+    }
+
+    if (cardano_utxo_list_get_length(sub_transaction_spent_utxos) > 0U)
+    {
+      cardano_utxo_list_t* resolved_with_sub_transactions = cardano_utxo_list_concat(resolved_inputs, sub_transaction_spent_utxos);
+
+      cardano_utxo_list_unref(&resolved_inputs);
+      resolved_inputs = resolved_with_sub_transactions;
+
+      if (resolved_inputs == NULL)
+      {
+        cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+    }
+
+    result = cardano_is_transaction_balanced(unbalanced_tx, resolved_inputs, protocol_params, &is_balanced);
+    cardano_utxo_list_unref(&resolved_inputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      return result;
+    }
+
+    if (!is_balanced)
+    {
+      cardano_transaction_set_last_error(
+        unbalanced_tx,
+        "The inputs of the transaction do not balance its outputs, fee, deposits and donation once its change is added.");
+
+      cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+      return CARDANO_ERROR_BALANCE_INSUFFICIENT;
+    }
+  }
+
+  cardano_transaction_output_list_unref(&shallow_cloned_outputs);
+
+  return CARDANO_SUCCESS;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_balance_transaction_with_pool_state(
+  cardano_transaction_t*            unbalanced_tx,
+  const size_t                      foreign_signature_count,
+  cardano_protocol_parameters_t*    protocol_params,
+  cardano_utxo_list_t*              reference_inputs,
+  cardano_utxo_list_t*              pre_selected_utxo,
+  cardano_input_to_redeemer_map_t*  input_to_redeemer_map,
+  cardano_utxo_list_t*              available_utxo,
+  cardano_coin_selector_t*          coin_selector,
+  cardano_address_t*                change_address,
+  cardano_utxo_list_t*              available_collateral_utxo,
+  cardano_address_t*                collateral_change_address,
+  cardano_tx_evaluator_t*           evaluator,
+  cardano_deferred_redeemer_list_t* deferred_redeemers,
+  cardano_pool_params_t* const*     pool_state,
+  const size_t                      pool_state_size)
+{
+  const cardano_error_t validation = _cardano_validate_pool_state(pool_state, pool_state_size);
+  if (validation != CARDANO_SUCCESS)
+  {
+    return validation;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(unbalanced_tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_sub_transaction_set_t* sub_transactions = cardano_transaction_body_get_sub_transactions(body);
+  cardano_sub_transaction_set_unref(&sub_transactions);
+
+  bool has_spent_utxo = false;
+
+  cardano_error_t result = has_utxo_spent_by_sub_transactions(pre_selected_utxo, sub_transactions, &has_spent_utxo);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (has_spent_utxo)
+  {
+    cardano_transaction_set_last_error(
+      unbalanced_tx,
+      "A pre selected input is already spent by a sub transaction. The inputs of the top level transaction must be disjoint from the inputs spent by its sub transactions.");
+
+    return CARDANO_ERROR_DUPLICATED_KEY;
+  }
+
+  cardano_utxo_list_t* sub_transaction_spent_utxos = NULL;
+
+  result = get_sub_transaction_spent_utxos(
+    sub_transactions,
+    available_utxo,
+    reference_inputs,
+    pre_selected_utxo,
+    &sub_transaction_spent_utxos);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+    {
+      cardano_transaction_set_last_error(
+        unbalanced_tx,
+        "A sub transaction spends an input that is not among the UTXOs given to the balancer. The resolved UTXOs of the sub transactions must be included in the available UTXOs.");
+    }
+
+    return result;
+  }
+
+  cardano_value_t* sub_transactions_imbalance = cardano_value_new_zero();
+
+  if (sub_transactions_imbalance == NULL)
+  {
+    cardano_utxo_list_unref(&sub_transaction_spent_utxos);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const char* sub_transaction_error = NULL;
+
+  result = add_sub_transactions_imbalance(
+    sub_transactions,
+    sub_transaction_spent_utxos,
+    protocol_params,
+    &sub_transactions_imbalance,
+    &sub_transaction_error);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&sub_transaction_spent_utxos);
+    cardano_value_unref(&sub_transactions_imbalance);
+
+    if ((sub_transaction_error != NULL) && (sub_transaction_error[0] != '\0'))
+    {
+      cardano_transaction_set_last_error(unbalanced_tx, sub_transaction_error);
+    }
+    else
+    {
+      cardano_transaction_set_last_error(
+        unbalanced_tx,
+        "Failed to compute the imbalance of the sub transactions for transaction balancing.");
+    }
+
+    return result;
+  }
+
+  cardano_certificate_set_t* certificates = cardano_transaction_body_get_certificates(body);
+  cardano_certificate_set_unref(&certificates);
+
+  uint64_t top_level_pool_deposits = 0U;
+
+  result = split_repeated_pool_deposits(certificates, sub_transactions, protocol_params, sub_transactions_imbalance, &top_level_pool_deposits);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&sub_transaction_spent_utxos);
+    cardano_value_unref(&sub_transactions_imbalance);
+
+    cardano_transaction_set_last_error(
+      unbalanced_tx,
+      "Failed to count the pool deposits of the pools registered by several bodies of the batch for transaction balancing.");
+
+    return result;
+  }
+
+  cardano_utxo_list_t* selectable_utxo = NULL;
+
+  result = exclude_sub_transaction_inputs(available_utxo, sub_transactions, &selectable_utxo);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&sub_transaction_spent_utxos);
+    cardano_value_unref(&sub_transactions_imbalance);
+
+    return result;
+  }
+
+  cardano_utxo_list_t* collateral_utxo = NULL;
+
+  result = exclude_sub_transaction_inputs(available_collateral_utxo, sub_transactions, &collateral_utxo);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&sub_transaction_spent_utxos);
+    cardano_value_unref(&sub_transactions_imbalance);
+    cardano_utxo_list_unref(&selectable_utxo);
+
+    return result;
+  }
+
+  if (cardano_utxo_list_get_length(collateral_utxo) == 0U)
+  {
+    bool is_collateral_required = false;
+
+    result = _cardano_is_collateral_required(unbalanced_tx, &is_collateral_required);
+
+    if ((result == CARDANO_SUCCESS) && is_collateral_required)
+    {
+      if (cardano_utxo_list_get_length(available_collateral_utxo) > 0U)
+      {
+        cardano_transaction_set_last_error(
+          unbalanced_tx,
+          "Every collateral UTXO given to the balancer is spent or referenced by a sub transaction. The collateral of the top level transaction must come from UTXOs that its sub transactions do not use.");
+      }
+      else
+      {
+        cardano_transaction_set_last_error(
+          unbalanced_tx,
+          "Collateral UTXOs are required because the transaction or one of its sub transactions carries redeemers, but none were given to the balancer.");
+      }
+
+      result = CARDANO_ERROR_BALANCE_INSUFFICIENT;
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_utxo_list_unref(&sub_transaction_spent_utxos);
+      cardano_value_unref(&sub_transactions_imbalance);
+      cardano_utxo_list_unref(&selectable_utxo);
+      cardano_utxo_list_unref(&collateral_utxo);
+
+      return result;
+    }
+  }
+
+  cardano_utxo_list_t* sub_transaction_priced_inputs = NULL;
+
+  result = get_sub_transaction_priced_inputs(
+    sub_transactions,
+    available_utxo,
+    reference_inputs,
+    pre_selected_utxo,
+    &sub_transaction_priced_inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&sub_transaction_spent_utxos);
+    cardano_value_unref(&sub_transactions_imbalance);
+    cardano_utxo_list_unref(&selectable_utxo);
+    cardano_utxo_list_unref(&collateral_utxo);
+
+    return result;
+  }
+
+  result = balance_transaction(
+    unbalanced_tx,
+    foreign_signature_count,
+    protocol_params,
+    reference_inputs,
+    sub_transaction_priced_inputs,
+    pre_selected_utxo,
+    sub_transaction_spent_utxos,
+    sub_transactions_imbalance,
+    top_level_pool_deposits,
+    input_to_redeemer_map,
+    selectable_utxo,
+    coin_selector,
+    change_address,
+    collateral_utxo,
+    collateral_change_address,
+    evaluator,
+    deferred_redeemers,
+    pool_state,
+    pool_state_size);
+
+  cardano_utxo_list_unref(&sub_transaction_spent_utxos);
+  cardano_value_unref(&sub_transactions_imbalance);
+  cardano_utxo_list_unref(&selectable_utxo);
+  cardano_utxo_list_unref(&collateral_utxo);
+  cardano_utxo_list_unref(&sub_transaction_priced_inputs);
+
+  return result;
+}
+
+cardano_error_t
+cardano_is_transaction_balanced(
+  cardano_transaction_t*         tx,
+  cardano_utxo_list_t*           resolved_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  bool*                          is_balanced)
+{
+  if (tx == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (is_balanced == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (resolved_inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *is_balanced = false;
+
+  cardano_value_t* imbalance = NULL;
+
+  cardano_error_t result = cardano_compute_transaction_batch_imbalance(tx, resolved_inputs, protocol_params, &imbalance);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *is_balanced = cardano_value_is_zero(imbalance);
+
+  cardano_value_unref(&imbalance);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_compute_transaction_imbalance(
+  cardano_transaction_t*         tx,
+  cardano_utxo_list_t*           resolved_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_value_t**              imbalance)
+{
+  if (imbalance == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *imbalance = NULL;
+
+  if (tx == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (resolved_inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_implicit_coin_t implicit_coin = { 0 };
+
+  cardano_error_t result = cardano_compute_implicit_coin(tx, protocol_params, &implicit_coin);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    if (result == CARDANO_ERROR_INTEGER_OVERFLOW)
+    {
+      cardano_transaction_set_last_error(tx, IMPLICIT_COIN_OVERFLOW_ERROR);
+    }
+
+    return result;
+  }
+
+  cardano_direct_deposit_map_t* direct_deposits = cardano_transaction_body_get_direct_deposits(body);
+  cardano_direct_deposit_map_unref(&direct_deposits);
+
+  uint64_t direct_deposit_total = 0U;
+
+  result = sum_direct_deposits(direct_deposits, &direct_deposit_total);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    if (result == CARDANO_ERROR_INTEGER_OVERFLOW)
+    {
+      cardano_transaction_set_last_error(tx, DIRECT_DEPOSITS_OVERFLOW_ERROR);
+    }
+
+    return result;
+  }
+
+  cardano_multi_asset_t* mint = cardano_transaction_body_get_mint(body);
+  cardano_multi_asset_unref(&mint);
+
+  cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(body);
+  cardano_transaction_input_set_t*   inputs  = cardano_transaction_body_get_inputs(body);
+
+  cardano_transaction_output_list_unref(&outputs);
+  cardano_transaction_input_set_unref(&inputs);
+
+  const uint64_t* donation_ptr  = cardano_transaction_body_get_donation(body);
+  const uint64_t  donation      = (donation_ptr != NULL) ? *donation_ptr : 0U;
+  const uint64_t  fee           = cardano_transaction_body_get_fee(body);
+  int64_t         consumed_coin = 0;
+  int64_t         produced_coin = 0;
+
+  result = compute_consumed_coin(implicit_coin.withdrawals, implicit_coin.reclaim_deposits, &consumed_coin);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_set_last_error(tx, CONSUMED_COIN_OVERFLOW_ERROR);
+
+    return result;
+  }
+
+  result = compute_produced_coin(implicit_coin.deposits, fee, donation, direct_deposit_total, &produced_coin);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_set_last_error(tx, PRODUCED_COIN_OVERFLOW_ERROR);
+
+    return result;
+  }
+
+  return compute_imbalance(inputs, resolved_inputs, outputs, mint, consumed_coin, produced_coin, imbalance);
+}
+
+cardano_error_t
+cardano_compute_sub_transaction_imbalance(
+  cardano_sub_transaction_t*     sub_tx,
+  cardano_utxo_list_t*           resolved_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_value_t**              imbalance)
+{
+  if (imbalance == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *imbalance = NULL;
+
+  if (sub_tx == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (resolved_inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_sub_transaction_body_t* body = cardano_sub_transaction_get_body(sub_tx);
+  cardano_sub_transaction_body_unref(&body);
+
+  cardano_implicit_coin_t implicit_coin = { 0 };
+
+  cardano_error_t result = cardano_compute_sub_transaction_implicit_coin(sub_tx, protocol_params, &implicit_coin);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    if (result == CARDANO_ERROR_INTEGER_OVERFLOW)
+    {
+      cardano_sub_transaction_set_last_error(sub_tx, "The withdrawals, deposits or reclaimed deposits of a sub transaction add up to more than the maximum amount the balancer can represent.");
+    }
+
+    return result;
+  }
+
+  cardano_direct_deposit_map_t* direct_deposits = cardano_sub_transaction_body_get_direct_deposits(body);
+  cardano_direct_deposit_map_unref(&direct_deposits);
+
+  uint64_t direct_deposit_total = 0U;
+
+  result = sum_direct_deposits(direct_deposits, &direct_deposit_total);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    if (result == CARDANO_ERROR_INTEGER_OVERFLOW)
+    {
+      cardano_sub_transaction_set_last_error(sub_tx, "The direct deposits of a sub transaction add up to more than the maximum amount the balancer can represent.");
+    }
+
+    return result;
+  }
+
+  cardano_multi_asset_t* mint = cardano_sub_transaction_body_get_mint(body);
+  cardano_multi_asset_unref(&mint);
+
+  cardano_transaction_output_list_t* outputs = cardano_sub_transaction_body_get_outputs(body);
+  cardano_transaction_input_set_t*   inputs  = cardano_sub_transaction_body_get_inputs(body);
+
+  cardano_transaction_output_list_unref(&outputs);
+  cardano_transaction_input_set_unref(&inputs);
+
+  const uint64_t* donation_ptr  = cardano_sub_transaction_body_get_donation(body);
+  const uint64_t  donation      = (donation_ptr != NULL) ? *donation_ptr : 0U;
+  int64_t         consumed_coin = 0;
+  int64_t         produced_coin = 0;
+
+  result = compute_consumed_coin(implicit_coin.withdrawals, implicit_coin.reclaim_deposits, &consumed_coin);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_set_last_error(sub_tx, "The coin consumed by a sub transaction exceeds the maximum amount the balancer can represent.");
+
+    return result;
+  }
+
+  result = compute_produced_coin(implicit_coin.deposits, 0U, donation, direct_deposit_total, &produced_coin);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_set_last_error(sub_tx, "The coin produced by a sub transaction exceeds the maximum amount the balancer can represent.");
+
+    return result;
+  }
+
+  return compute_imbalance(inputs, resolved_inputs, outputs, mint, consumed_coin, produced_coin, imbalance);
+}
+
+cardano_error_t
+cardano_compute_transaction_batch_imbalance(
+  cardano_transaction_t*         tx,
+  cardano_utxo_list_t*           resolved_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  cardano_value_t**              imbalance)
+{
+  if (imbalance == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *imbalance = NULL;
+
+  if (tx == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (resolved_inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_value_t* total = NULL;
+
+  cardano_error_t result = cardano_compute_transaction_imbalance(tx, resolved_inputs, protocol_params, &total);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_sub_transaction_set_t* sub_transactions = cardano_transaction_body_get_sub_transactions(body);
+  cardano_sub_transaction_set_unref(&sub_transactions);
+
+  result = add_sub_transactions_imbalance(sub_transactions, resolved_inputs, protocol_params, &total, NULL);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_certificate_set_t* certificates = cardano_transaction_body_get_certificates(body);
+    cardano_certificate_set_unref(&certificates);
+
+    result = add_repeated_pool_deposits(certificates, sub_transactions, protocol_params, total);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(&total);
+
+    return result;
+  }
+
+  *imbalance = total;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_balance_transaction(
+  cardano_transaction_t*            unbalanced_tx,
+  const size_t                      foreign_signature_count,
+  cardano_protocol_parameters_t*    protocol_params,
+  cardano_utxo_list_t*              reference_inputs,
+  cardano_utxo_list_t*              pre_selected_utxo,
+  cardano_input_to_redeemer_map_t*  input_to_redeemer_map,
+  cardano_utxo_list_t*              available_utxo,
+  cardano_coin_selector_t*          coin_selector,
+  cardano_address_t*                change_address,
+  cardano_utxo_list_t*              available_collateral_utxo,
+  cardano_address_t*                collateral_change_address,
+  cardano_tx_evaluator_t*           evaluator,
+  cardano_deferred_redeemer_list_t* deferred_redeemers)
+{
+  return cardano_balance_transaction_with_pool_state(unbalanced_tx, foreign_signature_count, protocol_params, reference_inputs, pre_selected_utxo, input_to_redeemer_map, available_utxo, coin_selector, change_address, available_collateral_utxo, collateral_change_address, evaluator, deferred_redeemers, NULL, 0U);
+}
diff --git a/vendor/src/transaction_builder/coin_selection/coin_selector.c b/vendor/src/transaction_builder/coin_selection/coin_selector.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/coin_selector.c
@@ -0,0 +1,196 @@
+/**
+ * \file coin_selector.c
+ *
+ * \author angel.castillo
+ * \date   Oct 14, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+
+#include "../../allocators.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Opaque structure representing a Cardano blockchain data coin_selector instance.
+ */
+typedef struct cardano_coin_selector_t
+{
+    cardano_object_t             base;
+    cardano_coin_selector_impl_t impl;
+} cardano_coin_selector_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a coin_selector object.
+ *
+ * This function is responsible for properly deallocating a coin_selector object (`cardano_coin_selector_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the coin_selector object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_coin_selector_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the coin_selector
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_coin_selector_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_coin_selector_t* coin_selector = (cardano_coin_selector_t*)object;
+
+  cardano_object_unref(&coin_selector->impl.context);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_coin_selector_new(
+  cardano_coin_selector_impl_t impl,
+  cardano_coin_selector_t**    coin_selector)
+{
+  if (coin_selector == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *coin_selector = _cardano_malloc(sizeof(cardano_coin_selector_t));
+
+  if (*coin_selector == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*coin_selector)->base.deallocator   = cardano_coin_selector_deallocate;
+  (*coin_selector)->base.ref_count     = 1;
+  (*coin_selector)->base.last_error[0] = '\0';
+
+  (*coin_selector)->impl = impl;
+
+  // Make sure coin_selector name is null terminated
+  (*coin_selector)->impl.name[sizeof((*coin_selector)->impl.name) - 1U] = '\0';
+  (*coin_selector)->impl.error_message[0]                               = '\0';
+
+  return CARDANO_SUCCESS;
+}
+
+const char*
+cardano_coin_selector_get_name(const cardano_coin_selector_t* coin_selector)
+{
+  if (coin_selector == NULL)
+  {
+    return "";
+  }
+
+  return coin_selector->impl.name;
+}
+
+cardano_error_t
+cardano_coin_selector_select(
+  cardano_coin_selector_t*                coin_selector,
+  const cardano_coin_selection_request_t* request,
+  cardano_utxo_list_t**                   selection,
+  cardano_utxo_list_t**                   remaining_utxo,
+  cardano_transaction_output_list_t**     change_outputs)
+{
+  if ((coin_selector == NULL) || (request == NULL) || (selection == NULL) || (remaining_utxo == NULL) || (change_outputs == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((request->available_utxo == NULL) || (request->target == NULL) || (request->change_address == NULL) || (request->protocol_params == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (coin_selector->impl.select == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = coin_selector->impl.select(&coin_selector->impl, request, selection, remaining_utxo, change_outputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_coin_selector_set_last_error(coin_selector, coin_selector->impl.error_message);
+  }
+
+  return result;
+}
+
+void
+cardano_coin_selector_unref(cardano_coin_selector_t** coin_selector)
+{
+  if ((coin_selector == NULL) || (*coin_selector == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*coin_selector)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *coin_selector = NULL;
+    return;
+  }
+}
+
+void
+cardano_coin_selector_ref(cardano_coin_selector_t* coin_selector)
+{
+  if (coin_selector == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&coin_selector->base);
+}
+
+size_t
+cardano_coin_selector_refcount(const cardano_coin_selector_t* coin_selector)
+{
+  if (coin_selector == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&coin_selector->base);
+}
+
+void
+cardano_coin_selector_set_last_error(cardano_coin_selector_t* coin_selector, const char* message)
+{
+  cardano_object_set_last_error(&coin_selector->base, message);
+}
+
+const char*
+cardano_coin_selector_get_last_error(const cardano_coin_selector_t* coin_selector)
+{
+  return cardano_object_get_last_error(&coin_selector->base);
+}
diff --git a/vendor/src/transaction_builder/coin_selection/internals/change_builder.c b/vendor/src/transaction_builder/coin_selection/internals/change_builder.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/change_builder.c
@@ -0,0 +1,454 @@
+/**
+ * \file change_builder.c
+ *
+ * \author angel.castillo
+ * \date   Jul 02, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/assets/asset_id_map.h>
+#include <cardano/common/utxo.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/transaction_builder/fee.h>
+
+#include "../../../allocators.h"
+
+#include "./change_builder.h"
+#include "./large_first_helpers.h"
+#include "./value_splitting.h"
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Coalesces the values of all UTXOs in a list into a single total value.
+ *
+ * \param[in]  utxos       The list of UTXOs to coalesce.
+ * \param[out] total_value A pointer to store the cumulative value of all UTXOs.
+ *
+ * \return \ref CARDANO_SUCCESS if the total value was successfully calculated, or an appropriate error code.
+ */
+static cardano_error_t
+sum_utxo_values(cardano_utxo_list_t* utxos, cardano_value_t** total_value)
+{
+  const size_t num_utxos = cardano_utxo_list_get_length(utxos);
+
+  cardano_value_t* total = cardano_value_new_zero();
+
+  if (total == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (size_t i = 0U; i < num_utxos; ++i)
+  {
+    cardano_utxo_t* utxo   = NULL;
+    cardano_error_t result = cardano_utxo_list_get(utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&total);
+
+      return result;
+    }
+
+    cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+    cardano_value_t*              value  = cardano_transaction_output_get_value(output);
+
+    cardano_transaction_output_unref(&output);
+    cardano_value_unref(&value);
+
+    cardano_value_t* tmp_value = NULL;
+
+    result = cardano_value_add(total, value, &tmp_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&tmp_value);
+      cardano_value_unref(&total);
+
+      return result;
+    }
+
+    cardano_value_unref(&total);
+    total = tmp_value;
+  }
+
+  *total_value = total;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Checks that a value has no negative components (neither lovelace nor any asset).
+ *
+ * \param[in]  value           The value to inspect.
+ * \param[out] is_non_negative Set to true if every component of the value is greater than or equal to zero.
+ *
+ * \return \ref CARDANO_SUCCESS if the check completed, or an appropriate error code.
+ */
+static cardano_error_t
+value_is_non_negative(cardano_value_t* value, bool* is_non_negative)
+{
+  *is_non_negative = true;
+
+  cardano_asset_id_map_t* assets = cardano_value_as_assets_map(value);
+
+  if (assets == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const size_t asset_count = cardano_asset_id_map_get_length(assets);
+
+  for (size_t i = 0U; i < asset_count; ++i)
+  {
+    cardano_asset_id_t* asset_id = NULL;
+    cardano_error_t     result   = cardano_asset_id_map_get_key_at(assets, i, &asset_id);
+    cardano_asset_id_unref(&asset_id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_map_unref(&assets);
+
+      return result;
+    }
+
+    int64_t amount = 0;
+    result         = cardano_asset_id_map_get(assets, asset_id, &amount);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_map_unref(&assets);
+
+      return result;
+    }
+
+    if (amount < 0)
+    {
+      *is_non_negative = false;
+      break;
+    }
+  }
+
+  cardano_asset_id_map_unref(&assets);
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Moves the UTXO with the largest lovelace amount from `remaining_utxo` into `selection`.
+ *
+ * \param[in,out] selection      The selection list to which the UTXO will be added.
+ * \param[in,out] remaining_utxo The pool from which the UTXO will be removed.
+ * \param[out]    moved_value    The value of the moved UTXO.
+ *
+ * \return \ref CARDANO_SUCCESS if a UTXO carrying lovelace was moved, \ref CARDANO_ERROR_BALANCE_INSUFFICIENT
+ *         if the pool is exhausted or holds no more lovelace, or an appropriate error code.
+ */
+static cardano_error_t
+move_largest_lovelace_utxo(
+  cardano_utxo_list_t* selection,
+  cardano_utxo_list_t* remaining_utxo,
+  cardano_value_t**    moved_value)
+{
+  if (cardano_utxo_list_get_length(remaining_utxo) == 0U)
+  {
+    return CARDANO_ERROR_BALANCE_INSUFFICIENT;
+  }
+
+  cardano_asset_id_t* lovelace = NULL;
+  cardano_error_t     result   = cardano_asset_id_new_lovelace(&lovelace);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_utxo_list_sort(remaining_utxo, _cardano_large_fist_compare_utxos, (void*)lovelace);
+  cardano_asset_id_unref(&lovelace);
+
+  cardano_utxo_t* utxo = NULL;
+  result               = cardano_utxo_list_get(remaining_utxo, 0U, &utxo);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+  cardano_value_t*              value  = cardano_transaction_output_get_value(output);
+
+  cardano_transaction_output_unref(&output);
+
+  if (cardano_value_get_coin(value) == 0)
+  {
+    cardano_value_unref(&value);
+    cardano_utxo_unref(&utxo);
+
+    return CARDANO_ERROR_BALANCE_INSUFFICIENT;
+  }
+
+  result = cardano_utxo_list_add(selection, utxo);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(&value);
+    cardano_utxo_unref(&utxo);
+
+    return result;
+  }
+
+  cardano_utxo_list_t* removed = cardano_utxo_list_erase(remaining_utxo, 0, 1);
+  cardano_utxo_list_unref(&removed);
+  cardano_utxo_unref(&utxo);
+
+  *moved_value = value;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Computes the minimum required ada for a change output holding the given value's assets.
+ *
+ * \param[in]  value             The asset-only value the output would hold.
+ * \param[in]  change_address    The address the output would be sent to.
+ * \param[in]  ada_per_utxo_byte The protocol parameter driving the min-ADA computation.
+ * \param[out] min_ada           The minimum required ada quantity.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+min_ada_for_value(
+  cardano_value_t*   value,
+  cardano_address_t* change_address,
+  const uint64_t     ada_per_utxo_byte,
+  uint64_t*          min_ada)
+{
+  cardano_transaction_output_t* output = NULL;
+
+  cardano_error_t result = cardano_transaction_output_new(change_address, 1, &output);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_transaction_output_set_value(output, value);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_compute_min_ada_required(output, ada_per_utxo_byte, min_ada);
+  }
+
+  cardano_transaction_output_unref(&output);
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+_cardano_coin_selector_build_change(
+  cardano_value_t*                    target,
+  cardano_address_t*                  change_address,
+  cardano_protocol_parameters_t*      protocol_params,
+  cardano_utxo_list_t*                selection,
+  cardano_utxo_list_t*                remaining_utxo,
+  cardano_transaction_output_list_t** change_outputs)
+{
+  if ((target == NULL) || (change_address == NULL) || (protocol_params == NULL) || (selection == NULL) || (remaining_utxo == NULL) || (change_outputs == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_transaction_output_list_new(change_outputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_value_t* selected_value = NULL;
+  result                          = sum_utxo_values(selection, &selected_value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_output_list_unref(change_outputs);
+
+    return result;
+  }
+
+  cardano_value_t* change_value = NULL;
+  result                        = cardano_value_subtract(selected_value, target, &change_value);
+
+  cardano_value_unref(&selected_value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_output_list_unref(change_outputs);
+
+    return result;
+  }
+
+  bool change_is_non_negative = false;
+  result                      = value_is_non_negative(change_value, &change_is_non_negative);
+
+  if ((result == CARDANO_SUCCESS) && !change_is_non_negative)
+  {
+    result = CARDANO_ERROR_BALANCE_INSUFFICIENT;
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(&change_value);
+    cardano_transaction_output_list_unref(change_outputs);
+
+    return result;
+  }
+
+  if (cardano_value_is_zero(change_value))
+  {
+    cardano_value_unref(&change_value);
+
+    return CARDANO_SUCCESS;
+  }
+
+  const uint64_t ada_per_utxo_byte = cardano_protocol_parameters_get_ada_per_utxo_byte(protocol_params);
+  const uint64_t max_value_size    = cardano_protocol_parameters_get_max_value_size(protocol_params);
+
+  cardano_value_part_list_t parts = { NULL, 0U, 0U };
+
+  uint64_t* min_adas      = NULL;
+  uint64_t  total_min_ada = 0U;
+  bool      fundable      = false;
+
+  // Split the change assets into as many outputs as the maximum output value size requires, then
+  // keep consuming additional UTXOs until the change carries enough ada to make every resulting
+  // output min-ADA compliant. Consuming a UTXO can add assets to the change, so the split is
+  // recomputed on every iteration.
+  while ((result == CARDANO_SUCCESS) && !fundable)
+  {
+    _cardano_coin_selection_value_parts_free(&parts);
+    _cardano_free(min_adas);
+    min_adas = NULL;
+
+    result = _cardano_coin_selection_split_value_assets(change_value, max_value_size, &parts);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      min_adas = (uint64_t*)_cardano_malloc(parts.size * sizeof(uint64_t));
+
+      if (min_adas == NULL)
+      {
+        result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      total_min_ada = 0U;
+
+      for (size_t i = 0U; (i < parts.size) && (result == CARDANO_SUCCESS); ++i)
+      {
+        result = min_ada_for_value(parts.items[i], change_address, ada_per_utxo_byte, &min_adas[i]);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          total_min_ada += min_adas[i];
+        }
+      }
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      if (cardano_value_get_coin(change_value) >= (int64_t)total_min_ada)
+      {
+        fundable = true;
+      }
+      else
+      {
+        cardano_value_t* moved_value = NULL;
+
+        result = move_largest_lovelace_utxo(selection, remaining_utxo, &moved_value);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          cardano_value_t* new_change_value = NULL;
+
+          result = cardano_value_add(change_value, moved_value, &new_change_value);
+
+          cardano_value_unref(&moved_value);
+
+          if (result == CARDANO_SUCCESS)
+          {
+            cardano_value_unref(&change_value);
+            change_value = new_change_value;
+          }
+        }
+      }
+    }
+  }
+
+  // Assign the ada: every part receives its min-ADA requirement, and the last part additionally
+  // receives the remainder, so that the parts sum exactly to the change value.
+  const int64_t change_coin = cardano_value_get_coin(change_value);
+
+  for (size_t i = 0U; (i < parts.size) && (result == CARDANO_SUCCESS); ++i)
+  {
+    uint64_t part_coin = min_adas[i];
+
+    if (i == (parts.size - 1U))
+    {
+      part_coin += (uint64_t)change_coin - total_min_ada;
+    }
+
+    result = cardano_value_set_coin(parts.items[i], (int64_t)part_coin);
+
+    cardano_transaction_output_t* change_output = NULL;
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_transaction_output_new(change_address, 0, &change_output);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_transaction_output_set_value(change_output, parts.items[i]);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_transaction_output_list_add(*change_outputs, change_output);
+    }
+
+    cardano_transaction_output_unref(&change_output);
+  }
+
+  _cardano_coin_selection_value_parts_free(&parts);
+  _cardano_free(min_adas);
+  cardano_value_unref(&change_value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_output_list_unref(change_outputs);
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_builder/coin_selection/internals/change_builder.h b/vendor/src/transaction_builder/coin_selection/internals/change_builder.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/change_builder.h
@@ -0,0 +1,70 @@
+/**
+ * \file change_builder.h
+ *
+ * \author angel.castillo
+ * \date   Jul 02, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_CHANGE_BUILDER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_CHANGE_BUILDER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Builds min-ADA compliant change outputs for a coin selection.
+ *
+ * This function computes the change left over by a selection (`sum(selection) - target`) and materializes it
+ * as change output(s) sent to `change_address`, upholding the local balance invariant:
+ *
+ * \code
+ * sum(selection) = target + sum(change_outputs)
+ * \endcode
+ *
+ * If the change is below the min-ADA requirement for its output, additional UTXOs are moved from
+ * `remaining_utxo` into `selection` (largest lovelace first) until the change output is min-ADA compliant.
+ * If the available pool is exhausted before compliance is reached, \ref CARDANO_ERROR_BALANCE_INSUFFICIENT
+ * is returned.
+ *
+ * \param[in]     target          The target value the selection must cover.
+ * \param[in]     change_address  The address to which the change outputs will be sent.
+ * \param[in]     protocol_params The protocol parameters, used to compute the min-ADA requirement.
+ * \param[in,out] selection       The list of selected UTXOs. May grow if additional UTXOs are needed to make
+ *                                the change min-ADA compliant.
+ * \param[in,out] remaining_utxo  The list of unselected UTXOs. May shrink as UTXOs are moved into `selection`.
+ * \param[out]    change_outputs  A pointer to the list where the change outputs will be stored. The list is
+ *                                empty if the selection matches the target exactly.
+ *
+ * \return \ref CARDANO_SUCCESS if the change outputs were successfully built, or an appropriate error code.
+ *
+ * \note The caller is responsible for releasing the `change_outputs` list when it is no longer needed.
+ */
+cardano_error_t
+_cardano_coin_selector_build_change(
+  cardano_value_t*                    target,
+  cardano_address_t*                  change_address,
+  cardano_protocol_parameters_t*      protocol_params,
+  cardano_utxo_list_t*                selection,
+  cardano_utxo_list_t*                remaining_utxo,
+  cardano_transaction_output_list_t** change_outputs);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_CHANGE_BUILDER_H
diff --git a/vendor/src/transaction_builder/coin_selection/internals/emscripten_coin_selector.c b/vendor/src/transaction_builder/coin_selection/internals/emscripten_coin_selector.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/emscripten_coin_selector.c
@@ -0,0 +1,375 @@
+/**
+ * \file emscripten_coin_selector.c
+ *
+ * \author angel.castillo
+ * \date   Aug 14, 2025
+ *
+ * Copyright 2025 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef __EMSCRIPTEN__
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/transaction_body/value.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector_impl.h>
+#include <emscripten.h>
+
+#include "../../../allocators.h"
+#include "../../../string_safe.h"
+#include "./change_builder.h"
+
+#include <stdio.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Context for the JavaScript coin selector implementation.
+ */
+typedef struct emscripten_coin_selector_context_t
+{
+    cardano_object_t base;
+    uint32_t         object_id;
+    char             name[256];
+} emscripten_coin_selector_context_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Creates a new JavaScript coin selector context.
+ *
+ * \return A pointer to the newly created context, or NULL if allocation failed.
+ */
+static emscripten_coin_selector_context_t*
+emscripten_coin_selector_context_new(const uint32_t object_id)
+{
+  emscripten_coin_selector_context_t* context = (emscripten_coin_selector_context_t*)_cardano_malloc(sizeof(emscripten_coin_selector_context_t));
+
+  if (context == NULL)
+  {
+    return NULL;
+  }
+
+  context->base.ref_count     = 1;
+  context->base.last_error[0] = '\0';
+  context->base.deallocator   = _cardano_free;
+  context->object_id          = object_id;
+
+  return context;
+}
+
+/* JAVASCRIPT INTERFACE *****************************************************/
+
+/**
+ * @brief Retrieves a JavaScript coin_selector object from a central registry.
+ *
+ * This function is called from C to get a handle to a JavaScript object that
+ * implements the coin_selector interface.
+ *
+ * @param[in] object_id The unique ID for the registered coin_selector object.
+ * @return A handle to the JavaScript coin_selector object, or `null` if not found.
+ */
+extern void* get_coin_selector_from_registry(uint32_t object_id);
+
+/**
+ * @brief Reports an exception from the C provider layer back to the JavaScript side.
+ *
+ * This function is implemented in JavaScript and imported into the C/WASM module. It
+ * serves as a bridge to pass an error that occurred within a C provider's asynchronous
+ * operation back to the JavaScript error handling system.
+ *
+ * @param object_id The unique identifier of the JavaScript provider instance that
+ * initiated the operation.
+ * @param exception A pointer to an object or string containing the details of the
+ * exception.
+ */
+extern void report_coin_selector_bridge_error(uint32_t object_id, void* exception);
+
+/**
+ * @brief Marshals a C `cardano_value_t` object into a JavaScript `Value` object.
+ *
+ * @param[in] value_obj A pointer to the `cardano_value_t` object to be marshalled.
+ * @return A handle to a new JavaScript object. The memory for this JS object is
+ * managed by the JavaScript garbage collector.
+ */
+extern void* marshall_value_to_js(void* value_obj);
+
+/**
+ * @brief Marshals a JavaScript array of UTXO objects into a C `cardano_utxo_list_t`.
+ *
+ * @param[in] utxo_list_obj A handle to a JavaScript array, where each element is a UTXO object.
+ * @return A pointer to a newly allocated `cardano_utxo_list_t` in WASM memory. Returns `0` on failure.
+ * @note The caller in C is responsible for freeing the returned object via `cardano_object_unref`.
+ */
+extern void* marshal_utxo_list(void* utxo_list_obj);
+
+/**
+ * @brief Marshals a C `cardano_utxo_list_t` into a JavaScript array of UTXO objects.
+ *
+ * This is useful for passing complex C structures to JS functions that expect plain objects,
+ * like in `evaluate_transaction`.
+ *
+ * @param[in] utxo_list_ptr A pointer to a `cardano_utxo_list_t` object in WASM memory.
+ * @return A handle to a JavaScript array of UTXO objects.
+ */
+extern void* marshall_utxo_list_to_js(void* utxo_list_ptr);
+
+/**
+ * @brief Marshals a C `cardano_transaction_output_list_t` into a JavaScript array of output objects.
+ *
+ * @param[in] output_list_ptr A pointer to a `cardano_transaction_output_list_t` object in WASM memory.
+ * @return A handle to a JavaScript array of transaction output objects.
+ */
+extern void* marshall_transaction_output_list_to_js(void* output_list_ptr);
+
+/**
+ * @brief Marshals a JavaScript array of transaction output objects into a C `cardano_transaction_output_list_t`.
+ *
+ * @param[in] output_list_obj A handle to a JavaScript array, where each element is a transaction output object.
+ * @return A pointer to a newly allocated `cardano_transaction_output_list_t` in WASM memory. Returns `0` on failure.
+ * @note The caller in C is responsible for freeing the returned object via `cardano_object_unref`.
+ */
+extern void* marshal_transaction_output_list(void* output_list_obj);
+
+/* C -> JS ASYNC BRIDGE FUNCTIONS ********************************************/
+
+/**
+ * @brief Asynchronously performs coin selection by bridging to a JavaScript implementation.
+ *
+ * This function acts as the low-level bridge between the C coin selection API and a
+ * registered JavaScript coin selector object. It marshals the fields of the C selection
+ * request into JavaScript types, calls the asynchronous `select` method on the JS object,
+ * and then marshals the resulting JS selection, remaining UTXO and change output arrays
+ * back into C objects.
+ *
+ * @note This function's body is implemented in JavaScript and relies on Emscripten's Asyncify
+ * feature to pause C execution while awaiting the result from the JavaScript `Promise`.
+ *
+ * @param[in] object_id The unique ID for the registered JavaScript coin selector object.
+ * @param[in] pre_selected_utxo A pointer to a C `cardano_utxo_list_t` of UTxOs to force into the selection.
+ * @param[in] available_utxo A pointer to a C `cardano_utxo_list_t` of UTxOs available for selection.
+ * @param[in] target A pointer to a C `cardano_value_t` representing the total value the selection must cover.
+ * @param[in] outputs_to_cover A pointer to a C `cardano_transaction_output_list_t` with the user-specified
+ * outputs the target was derived from, or `0`. Passed to the JS selector as a shape hint for change generation.
+ * @param[in] change_address_str The change address encoded as a null-terminated bech32 string.
+ * @param[in] coins_per_utxo_byte The protocol parameter used to compute min-ADA requirements for change outputs.
+ * @param[out] selection_ptr A pointer to a `cardano_utxo_list_t*` where the pointer to the newly
+ * created C list of selected UTxOs will be stored.
+ * @param[out] remaining_utxo_ptr A pointer to a `cardano_utxo_list_t*` where the pointer to the newly
+ * created C list of remaining (unselected) UTxOs will be stored.
+ * @param[out] change_outputs_ptr A pointer to a `cardano_transaction_output_list_t*` where the pointer to the
+ * newly created C list of change outputs will be stored, or `0` if the JS selector did not produce change
+ * outputs (in which case the C side generates the change).
+ * @return A `cardano_error_t` indicating the success or failure of the operation.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_coin_selector_bridge_select, (uint32_t object_id, cardano_utxo_list_t* pre_selected_utxo, cardano_utxo_list_t* available_utxo, cardano_value_t* target, cardano_transaction_output_list_t* outputs_to_cover, const char* change_address_str, double coins_per_utxo_byte, cardano_utxo_list_t** selection_ptr, cardano_utxo_list_t** remaining_utxo_ptr, cardano_transaction_output_list_t** change_outputs_ptr), {
+  const coin_selector = get_coin_selector_from_registry(object_id);
+  if (!coin_selector)
+  {
+    return 1;
+  }
+
+  try
+  {
+    const preSelectedUtxoArray = marshall_utxo_list_to_js(pre_selected_utxo);
+    const availableUtxoArray   = marshall_utxo_list_to_js(available_utxo);
+    const targetValue          = marshall_value_to_js(target);
+    const outputsToCoverArray  = outputs_to_cover !== 0 ? marshall_transaction_output_list_to_js(outputs_to_cover) : undefined;
+    const changeAddress        = UTF8ToString(change_address_str);
+
+    const result = await coin_selector.select({
+      preSelectedUtxo : preSelectedUtxoArray.length > 0 ? preSelectedUtxoArray : undefined,
+      availableUtxo : availableUtxoArray,
+      targetValue : targetValue,
+      outputsToCover : outputsToCoverArray,
+      changeAddress : changeAddress,
+      coinsPerUtxoByte : coins_per_utxo_byte
+    });
+
+    const selectionListPtr = marshal_utxo_list(result.selection);
+    const remainingListPtr = marshal_utxo_list(result.remaining);
+
+    if (selectionListPtr === 0 || remainingListPtr === 0)
+    {
+      if (selectionListPtr !== 0)
+        cardano_utxo_list_unref(selectionListPtr);
+      if (remainingListPtr !== 0)
+        cardano_utxo_list_unref(remainingListPtr);
+      return 4;
+    }
+
+    let changeOutputsListPtr = 0;
+
+    if (result.changeOutputs !== undefined)
+    {
+      changeOutputsListPtr = marshal_transaction_output_list(result.changeOutputs);
+
+      if (changeOutputsListPtr === 0)
+      {
+        cardano_utxo_list_unref(selectionListPtr);
+        cardano_utxo_list_unref(remainingListPtr);
+        return 4;
+      }
+    }
+
+    HEAPU32[selection_ptr >> 2]      = selectionListPtr;
+    HEAPU32[remaining_utxo_ptr >> 2] = remainingListPtr;
+    HEAPU32[change_outputs_ptr >> 2] = changeOutputsListPtr;
+
+    return 0;
+  }
+  catch (e)
+  {
+    report_coin_selector_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/* PROVIDER IMPLEMENTATION **************************************************/
+
+/**
+ * \brief Selects UTXOs from the available list and pre-selected UTXOs to meet the target value.
+ *
+ * This function delegates the coin selection to the registered JavaScript coin selector, forwarding
+ * the full selection request (including the outputs-to-cover shape hint, the change address and the
+ * relevant protocol parameters). If the JavaScript selector produces change outputs, they are used
+ * as-is; otherwise the change outputs are built on the C side so that the selection is locally
+ * balanced and every change output is min-ADA compliant.
+ *
+ * \param[in] coin_selector A pointer to the coin selector implementation object.
+ * \param[in] request The selection request. All fields are forwarded to the JavaScript selector.
+ * \param[out] selection A pointer to the list of selected UTXOs that meet the target value.
+ * \param[out] remaining_utxo A pointer to the list of UTXOs that were not selected and remain available for future transactions.
+ * \param[out] change_outputs A pointer to the list of change outputs produced by the selection.
+ *
+ * \return \ref CARDANO_SUCCESS if UTXOs were successfully selected, or an appropriate error code indicating failure.
+ */
+static cardano_error_t
+select(
+  cardano_coin_selector_impl_t*           coin_selector,
+  const cardano_coin_selection_request_t* request,
+  cardano_utxo_list_t**                   selection,
+  cardano_utxo_list_t**                   remaining_utxo,
+  cardano_transaction_output_list_t**     change_outputs)
+{
+  if (!coin_selector || !request || !selection || !remaining_utxo || !change_outputs)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  emscripten_coin_selector_context_t* ctx = (emscripten_coin_selector_context_t*)coin_selector->context;
+
+  cardano_utxo_list_t*               pre_selected_utxo = request->pre_selected_utxo;
+  cardano_utxo_list_t*               available_utxo    = request->available_utxo;
+  cardano_value_t*                   target            = request->target;
+  cardano_transaction_output_list_t* outputs_to_cover  = request->outputs_to_cover;
+  cardano_address_t*                 change_address    = request->change_address;
+  cardano_protocol_parameters_t*     protocol_params   = request->protocol_params;
+
+  if (!ctx || !available_utxo || !target || !change_address || !protocol_params)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const char*    change_address_str  = cardano_address_get_string(change_address);
+  const uint64_t coins_per_utxo_byte = cardano_protocol_parameters_get_ada_per_utxo_byte(protocol_params);
+
+  *change_outputs = NULL;
+
+  cardano_error_t result = cardano_coin_selector_bridge_select(
+    ctx->object_id,
+    pre_selected_utxo,
+    available_utxo,
+    target,
+    outputs_to_cover,
+    change_address_str,
+    (double)coins_per_utxo_byte,
+    selection,
+    remaining_utxo,
+    change_outputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (*change_outputs != NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  result = _cardano_coin_selector_build_change(target, change_address, protocol_params, *selection, *remaining_utxo, change_outputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(selection);
+    cardano_utxo_list_unref(remaining_utxo);
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+EMSCRIPTEN_KEEPALIVE
+cardano_error_t
+create_emscripten_coin_selector(
+  const char*               name,
+  const size_t              name_size,
+  const uint32_t            object_id,
+  cardano_coin_selector_t** coin_selector_ptr)
+{
+  if ((coin_selector_ptr == NULL) || (name == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((name_size >= 256U) || (name_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  emscripten_coin_selector_context_t* context = emscripten_coin_selector_context_new(object_id);
+
+  if (context == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_safe_memcpy(context->name, 256, name, name_size);
+
+  cardano_coin_selector_impl_t impl = { 0 };
+
+  impl.select  = select;
+  impl.context = (cardano_object_t*)context;
+
+  cardano_error_t result = cardano_coin_selector_new(impl, coin_selector_ptr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(context);
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+#endif /* __EMSCRIPTEN__ */
diff --git a/vendor/src/transaction_builder/coin_selection/internals/large_first_coin_selector.c b/vendor/src/transaction_builder/coin_selection/internals/large_first_coin_selector.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/large_first_coin_selector.c
@@ -0,0 +1,289 @@
+/**
+ * \file large_first_coin_selector.c
+ *
+ * \author angel.castillo
+ * \date   Oct 16, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/assets/asset_id_map.h>
+#include <cardano/common/utxo.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+#include <cardano/transaction_builder/coin_selection/large_first_coin_selector.h>
+
+#include "../../../string_safe.h"
+#include "./change_builder.h"
+#include "./large_first_helpers.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STATIC FUNCTIONS ************************************************************/
+
+/**
+ * \brief Moves the UTXO with the largest lovelace amount from the available UTXOs into the selection.
+ *
+ * A transaction must spend at least one input, so a selection must never be empty. This function is the fall back
+ * for a target that requires nothing from the available UTXOs, which happens when the target is already met or
+ * exceeded by implicit value (its lovelace and every one of its assets are zero or negative).
+ *
+ * \param[in,out] remaining_utxo The available UTXOs from which the UTXO is removed.
+ * \param[in,out] selection The selection to which the UTXO is added.
+ *
+ * \return \ref CARDANO_SUCCESS if a UTXO was selected, \ref CARDANO_ERROR_BALANCE_INSUFFICIENT if no UTXO holding
+ *         lovelace is available, or an appropriate error code indicating failure.
+ */
+static cardano_error_t
+select_largest_lovelace_utxo(cardano_utxo_list_t* remaining_utxo, cardano_utxo_list_t* selection)
+{
+  cardano_asset_id_t* lovelace = NULL;
+  cardano_error_t     result   = cardano_asset_id_new_lovelace(&lovelace);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_value_t* accumulated_value = cardano_value_new_zero();
+
+  result = _cardano_large_fist_select_utxos(lovelace, 1, remaining_utxo, selection, &accumulated_value);
+
+  cardano_value_unref(&accumulated_value);
+  cardano_asset_id_unref(&lovelace);
+
+  return result;
+}
+
+/**
+ * \brief Selects UTXOs from the available list and pre-selected UTXOs to meet the target value.
+ *
+ * This function selects UTXOs from both the pre-selected UTXO list and available UTXOs to meet a specified target value.
+ * The selected UTXOs are stored in the `selection` list, and any remaining UTXOs are stored in the `remaining_utxo` list.
+ * Any excess value is returned as min-ADA compliant change outputs in the `change_outputs` list, upholding the local
+ * balance invariant: sum(selection) = target + sum(change_outputs).
+ *
+ * The selection is never empty: when neither the pre-selected UTXOs nor the target require an input, the available UTXO
+ * with the largest lovelace amount is selected and its value is returned in the change outputs.
+ *
+ * \param[in] coin_selector A pointer to the coin selector implementation object.
+ * \param[in] request The selection request. The request's outputs_to_cover hint is unused by this selector.
+ * \param[out] selection A pointer to the list of selected UTXOs that meet the target value.
+ * \param[out] remaining_utxo A pointer to the list of UTXOs that were not selected and remain available for future transactions.
+ * \param[out] change_outputs A pointer to the list of change outputs produced by the selection.
+ *
+ * \return \ref CARDANO_SUCCESS if the target is covered and the selection is not empty,
+ *         \ref CARDANO_ERROR_BALANCE_INSUFFICIENT if the available UTXOs can not cover the target or there is no UTXO
+ *         to select, or an appropriate error code indicating failure.
+ */
+static cardano_error_t
+select(
+  cardano_coin_selector_impl_t*           coin_selector,
+  const cardano_coin_selection_request_t* request,
+  cardano_utxo_list_t**                   selection,
+  cardano_utxo_list_t**                   remaining_utxo,
+  cardano_transaction_output_list_t**     change_outputs)
+{
+  assert(coin_selector != NULL);
+  assert(request != NULL);
+
+  cardano_utxo_list_t*           pre_selected_utxo = request->pre_selected_utxo;
+  cardano_utxo_list_t*           available_utxo    = request->available_utxo;
+  cardano_value_t*               target            = request->target;
+  cardano_address_t*             change_address    = request->change_address;
+  cardano_protocol_parameters_t* protocol_params   = request->protocol_params;
+
+  assert(available_utxo != NULL);
+  assert(target != NULL);
+  assert(change_address != NULL);
+  assert(protocol_params != NULL);
+
+  CARDANO_UNUSED(coin_selector);
+
+  cardano_error_t result = cardano_utxo_list_new(selection);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *remaining_utxo = cardano_utxo_list_clone(available_utxo);
+
+  if (*remaining_utxo == NULL)
+  {
+    cardano_utxo_list_unref(selection);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_value_t* accumulated_value = NULL;
+
+  bool preselected_utxo_satisfies_target = false;
+
+  if (pre_selected_utxo != NULL)
+  {
+    result = _cardano_large_fist_check_preselected(pre_selected_utxo, target, &accumulated_value, &preselected_utxo_satisfies_target);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_utxo_list_unref(remaining_utxo);
+      cardano_utxo_list_unref(selection);
+      cardano_value_unref(&accumulated_value);
+
+      return result;
+    }
+
+    const size_t pre_selected_count = cardano_utxo_list_get_length(pre_selected_utxo);
+
+    for (size_t i = 0U; i < pre_selected_count; ++i)
+    {
+      cardano_utxo_t* utxo = NULL;
+
+      result = cardano_utxo_list_get(pre_selected_utxo, i, &utxo);
+      cardano_utxo_unref(&utxo);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_utxo_list_unref(remaining_utxo);
+        cardano_utxo_list_unref(selection);
+        cardano_value_unref(&accumulated_value);
+
+        return result;
+      }
+
+      result = cardano_utxo_list_add(*selection, utxo);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_utxo_list_unref(remaining_utxo);
+        cardano_utxo_list_unref(selection);
+        cardano_value_unref(&accumulated_value);
+
+        return result;
+      }
+
+      result = cardano_utxo_list_remove(*remaining_utxo, utxo);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_utxo_list_unref(remaining_utxo);
+      cardano_utxo_list_unref(selection);
+      cardano_value_unref(&accumulated_value);
+
+      return result;
+    }
+  }
+
+  cardano_asset_id_map_t* assets      = cardano_value_as_assets_map(target);
+  size_t                  asset_count = cardano_asset_id_map_get_length(assets);
+
+  for (size_t i = 0U; i < asset_count; ++i)
+  {
+    cardano_asset_id_t* asset_id     = NULL;
+    int64_t             asset_amount = 0;
+
+    result = cardano_asset_id_map_get_key_at(assets, i, &asset_id);
+    cardano_asset_id_unref(&asset_id);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_map_unref(&assets);
+      cardano_utxo_list_unref(selection);
+      cardano_utxo_list_unref(remaining_utxo);
+      cardano_value_unref(&accumulated_value);
+
+      return result;
+    }
+
+    result = cardano_asset_id_map_get(assets, asset_id, &asset_amount);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_map_unref(&assets);
+      cardano_utxo_list_unref(selection);
+      cardano_utxo_list_unref(remaining_utxo);
+      cardano_value_unref(&accumulated_value);
+
+      return result;
+    }
+
+    result = _cardano_large_fist_select_utxos(asset_id, asset_amount, *remaining_utxo, *selection, &accumulated_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_map_unref(&assets);
+      cardano_utxo_list_unref(selection);
+      cardano_utxo_list_unref(remaining_utxo);
+      cardano_value_unref(&accumulated_value);
+
+      return result;
+    }
+  }
+
+  cardano_asset_id_map_unref(&assets);
+  cardano_value_unref(&accumulated_value);
+
+  if (cardano_utxo_list_get_length(*selection) == 0U)
+  {
+    result = select_largest_lovelace_utxo(*remaining_utxo, *selection);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_utxo_list_unref(selection);
+      cardano_utxo_list_unref(remaining_utxo);
+
+      return result;
+    }
+  }
+
+  result = _cardano_coin_selector_build_change(target, change_address, protocol_params, *selection, *remaining_utxo, change_outputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(selection);
+    cardano_utxo_list_unref(remaining_utxo);
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_large_first_coin_selector_new(cardano_coin_selector_t** cardano_coin_selector)
+{
+  static const char*           handler_name = "Large first coin selector";
+  cardano_coin_selector_impl_t impl         = { 0 };
+
+  cardano_safe_memcpy(impl.name, 256U, handler_name, cardano_safe_strlen(handler_name, 256U));
+
+  if (cardano_coin_selector == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  impl.select  = select;
+  impl.context = NULL;
+
+  return cardano_coin_selector_new(impl, cardano_coin_selector);
+}
diff --git a/vendor/src/transaction_builder/coin_selection/internals/large_first_helpers.c b/vendor/src/transaction_builder/coin_selection/internals/large_first_helpers.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/large_first_helpers.c
@@ -0,0 +1,434 @@
+/**
+ * \file large_first_utils.c
+ *
+ * \author angel.castillo
+ * \date   Oct 16, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/assets/asset_id_map.h>
+#include <cardano/common/utxo.h>
+#include <cardano/common/utxo_list.h>
+
+#include "./large_first_helpers.h"
+
+#include <string.h>
+
+/* DEFINITIONS ****************************************************************/
+
+int64_t
+_cardano_large_fist_get_amount(cardano_value_t* value, cardano_asset_id_t* asset_id)
+{
+  if (!value || !asset_id)
+  {
+    return 0;
+  }
+
+  if (cardano_asset_id_is_lovelace(asset_id))
+  {
+    return (int64_t)cardano_value_get_coin(value);
+  }
+
+  int64_t amount = 0;
+
+  cardano_multi_asset_t* multi_asset = cardano_value_get_multi_asset(value);
+  cardano_multi_asset_unref(&multi_asset);
+
+  if (multi_asset != NULL)
+  {
+    cardano_error_t result = cardano_multi_asset_get_with_id(multi_asset, asset_id, &amount);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return 0;
+    }
+  }
+
+  return amount;
+}
+
+cardano_error_t
+_cardano_large_fist_value_gte(
+  cardano_value_t* lhs,
+  cardano_value_t* rhs,
+  bool*            result)
+{
+  if ((lhs == NULL) || (rhs == NULL) || (result == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  uint64_t lhs_coin = cardano_value_get_coin(lhs);
+  uint64_t rhs_coin = cardano_value_get_coin(rhs);
+
+  if (lhs_coin < rhs_coin)
+  {
+    *result = false;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_asset_id_map_t* lhs_asset_id_map = cardano_value_as_assets_map(lhs);
+  cardano_asset_id_map_t* rhs_asset_id_map = cardano_value_as_assets_map(rhs);
+
+  if ((lhs_asset_id_map == NULL) || (rhs_asset_id_map == NULL))
+  {
+    cardano_asset_id_map_unref(&lhs_asset_id_map);
+    cardano_asset_id_map_unref(&rhs_asset_id_map);
+
+    *result = false;
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t op_result;
+
+  if (rhs != NULL)
+  {
+    cardano_asset_id_list_t* asset_ids = NULL;
+
+    op_result = cardano_asset_id_map_get_keys(rhs_asset_id_map, &asset_ids);
+
+    if (op_result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_list_unref(&asset_ids);
+      cardano_asset_id_map_unref(&lhs_asset_id_map);
+      cardano_asset_id_map_unref(&rhs_asset_id_map);
+
+      return op_result;
+    }
+
+    const size_t assets_count = cardano_asset_id_list_get_length(asset_ids);
+
+    for (size_t i = 0U; i < assets_count; ++i)
+    {
+      cardano_asset_id_t* id = NULL;
+
+      op_result = cardano_asset_id_list_get(asset_ids, i, &id);
+
+      cardano_asset_id_unref(&id);
+
+      if (op_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_id_list_unref(&asset_ids);
+        cardano_asset_id_map_unref(&lhs_asset_id_map);
+        cardano_asset_id_map_unref(&rhs_asset_id_map);
+
+        return op_result;
+      }
+
+      int64_t lhs_multi_asset_amount = 0;
+      int64_t rhs_multi_asset_amount = 0;
+
+      op_result = cardano_asset_id_map_get(lhs_asset_id_map, id, &lhs_multi_asset_amount);
+
+      if (op_result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+      {
+        cardano_asset_id_list_unref(&asset_ids);
+        cardano_asset_id_map_unref(&lhs_asset_id_map);
+        cardano_asset_id_map_unref(&rhs_asset_id_map);
+
+        *result = false;
+
+        return CARDANO_SUCCESS;
+      }
+
+      if (op_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_id_list_unref(&asset_ids);
+        cardano_asset_id_map_unref(&lhs_asset_id_map);
+        cardano_asset_id_map_unref(&rhs_asset_id_map);
+
+        return op_result;
+      }
+
+      op_result = cardano_asset_id_map_get(rhs_asset_id_map, id, &rhs_multi_asset_amount);
+
+      if (op_result != CARDANO_SUCCESS)
+      {
+        cardano_asset_id_list_unref(&asset_ids);
+        cardano_asset_id_map_unref(&lhs_asset_id_map);
+        cardano_asset_id_map_unref(&rhs_asset_id_map);
+
+        return op_result;
+      }
+
+      if (lhs_multi_asset_amount < rhs_multi_asset_amount)
+      {
+        cardano_asset_id_list_unref(&asset_ids);
+        cardano_asset_id_map_unref(&lhs_asset_id_map);
+        cardano_asset_id_map_unref(&rhs_asset_id_map);
+
+        *result = false;
+        return CARDANO_SUCCESS;
+      }
+    }
+
+    cardano_asset_id_list_unref(&asset_ids);
+  }
+
+  cardano_asset_id_map_unref(&lhs_asset_id_map);
+  cardano_asset_id_map_unref(&rhs_asset_id_map);
+
+  *result = true;
+
+  return CARDANO_SUCCESS;
+}
+
+int32_t
+_cardano_large_fist_compare_utxos(cardano_utxo_t* lhs, cardano_utxo_t* rhs, void* context)
+{
+  cardano_asset_id_t* asset_id = (cardano_asset_id_t*)context;
+
+  cardano_transaction_output_t* lhs_output = cardano_utxo_get_output(lhs);
+  cardano_transaction_output_t* rhs_output = cardano_utxo_get_output(rhs);
+
+  cardano_value_t* lhs_value = cardano_transaction_output_get_value(lhs_output);
+  cardano_value_t* rhs_value = cardano_transaction_output_get_value(rhs_output);
+
+  int64_t lhs_amount = _cardano_large_fist_get_amount(lhs_value, asset_id);
+  int64_t rhs_amount = _cardano_large_fist_get_amount(rhs_value, asset_id);
+
+  int32_t result = 0;
+
+  if (lhs_amount < rhs_amount)
+  {
+    result = 1;
+  }
+  else if (lhs_amount > rhs_amount)
+  {
+    result = -1;
+  }
+  else
+  {
+    result = 0;
+  }
+
+  cardano_value_unref(&lhs_value);
+  cardano_value_unref(&rhs_value);
+  cardano_transaction_output_unref(&lhs_output);
+  cardano_transaction_output_unref(&rhs_output);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_large_fist_check_preselected(
+  cardano_utxo_list_t* pre_selected_utxo,
+  cardano_value_t*     target_value,
+  cardano_value_t**    accumulated_value,
+  bool*                satisfies_target)
+{
+  if ((pre_selected_utxo == NULL) || (target_value == NULL) || (satisfies_target == NULL) || (accumulated_value == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (*accumulated_value == NULL)
+  {
+    result = cardano_value_new(0, NULL, accumulated_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  size_t utxo_count = cardano_utxo_list_get_length(pre_selected_utxo);
+
+  for (size_t i = 0U; i < utxo_count; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    result = cardano_utxo_list_get(pre_selected_utxo, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(accumulated_value);
+
+      return result;
+    }
+
+    cardano_transaction_output_t* output     = cardano_utxo_get_output(utxo);
+    cardano_value_t*              utxo_value = cardano_transaction_output_get_value(output);
+
+    cardano_transaction_output_unref(&output);
+    cardano_value_unref(&utxo_value);
+
+    if (utxo_value == NULL)
+    {
+      cardano_value_unref(accumulated_value);
+
+      return result;
+    }
+
+    cardano_value_t* new_accumulated_value = NULL;
+
+    result = cardano_value_add(*accumulated_value, utxo_value, &new_accumulated_value);
+
+    cardano_value_unref(accumulated_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    *accumulated_value = new_accumulated_value;
+  }
+
+  result = _cardano_large_fist_value_gte(*accumulated_value, target_value, satisfies_target);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(accumulated_value);
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_large_fist_select_utxos(
+  cardano_asset_id_t*  asset_req,
+  int64_t              required_amount,
+  cardano_utxo_list_t* available_utxos,
+  cardano_utxo_list_t* selected_utxos,
+  cardano_value_t**    accumulated_value)
+{
+  if ((asset_req == NULL) || (available_utxos == NULL) || (selected_utxos == NULL) || (accumulated_value == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (*accumulated_value == NULL)
+  {
+    result = cardano_value_new(0, NULL, accumulated_value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  cardano_asset_id_map_t* assets = cardano_value_as_assets_map(*accumulated_value);
+
+  if (assets == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  int64_t accumulated_amount = 0;
+  result                     = cardano_asset_id_map_get(assets, asset_req, &accumulated_amount);
+
+  if ((result != CARDANO_SUCCESS) && (result != CARDANO_ERROR_ELEMENT_NOT_FOUND))
+  {
+    cardano_asset_id_map_unref(&assets);
+
+    return result;
+  }
+
+  if (accumulated_amount >= required_amount)
+  {
+    cardano_asset_id_map_unref(&assets);
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_utxo_list_sort(available_utxos, _cardano_large_fist_compare_utxos, (void*)asset_req);
+
+  size_t utxo_count = cardano_utxo_list_get_length(available_utxos);
+
+  for (size_t i = 0U; (i < utxo_count) && (accumulated_amount < required_amount); ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+    result               = cardano_utxo_list_get(available_utxos, i, &utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_asset_id_map_unref(&assets);
+
+      return result;
+    }
+
+    cardano_transaction_output_t* output     = cardano_utxo_get_output(utxo);
+    cardano_value_t*              utxo_value = cardano_transaction_output_get_value(output);
+
+    int64_t utxo_asset_amount = _cardano_large_fist_get_amount(utxo_value, asset_req);
+
+    if (utxo_asset_amount > 0)
+    {
+      result = cardano_utxo_list_add(selected_utxos, utxo);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_asset_id_map_unref(&assets);
+        cardano_value_unref(&utxo_value);
+        cardano_transaction_output_unref(&output);
+        cardano_utxo_unref(&utxo);
+
+        return result;
+      }
+
+      accumulated_amount += utxo_asset_amount;
+
+      cardano_value_t* new_accumulated_value = NULL;
+      result                                 = cardano_value_add(*accumulated_value, utxo_value, &new_accumulated_value);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_asset_id_map_unref(&assets);
+        cardano_value_unref(&utxo_value);
+        cardano_transaction_output_unref(&output);
+        cardano_utxo_unref(&utxo);
+
+        return result;
+      }
+
+      cardano_value_unref(accumulated_value);
+      *accumulated_value = new_accumulated_value;
+
+      cardano_utxo_list_t* removed = cardano_utxo_list_erase(available_utxos, (int64_t)i, 1);
+      cardano_utxo_list_unref(&removed);
+
+      --i;
+      --utxo_count;
+    }
+
+    cardano_value_unref(&utxo_value);
+    cardano_transaction_output_unref(&output);
+    cardano_utxo_unref(&utxo);
+  }
+
+  if (accumulated_amount < required_amount)
+  {
+    cardano_asset_id_map_unref(&assets);
+
+    return CARDANO_ERROR_BALANCE_INSUFFICIENT;
+  }
+
+  cardano_asset_id_map_unref(&assets);
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_builder/coin_selection/internals/large_first_helpers.h b/vendor/src/transaction_builder/coin_selection/internals/large_first_helpers.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/large_first_helpers.h
@@ -0,0 +1,123 @@
+/**
+ * \file large_first_helpers.h
+ *
+ * \author angel.castillo
+ * \date   Oct 16, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_LARGE_FIRST_HELPERS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_LARGE_FIRST_HELPERS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Retrieves the amount of a specific asset from a Cardano value.
+ *
+ * This function retrieves the amount of a specific asset identified by `asset_id` from a `cardano_value_t` object.
+ *
+ * \param[in] value A pointer to the \ref cardano_value_t object representing the value containing multiple assets.
+ * \param[in] asset_id A pointer to the \ref cardano_asset_id_t object identifying the specific asset to look up.
+ *
+ * \return \ref CARDANO_SUCCESS if the asset amount was successfully retrieved, or an appropriate error code indicating failure.
+ */
+int64_t _cardano_large_fist_get_amount(cardano_value_t* value, cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Compares two cardano_value_t objects to check if lhs is greater than or equal to rhs.
+ *
+ * This function compares the ADA and multi-asset values in the lhs and rhs `cardano_value_t` objects.
+ * It sets the result to `true` if lhs >= rhs for all assets (including ADA), and `false` otherwise.
+ *
+ * \param[in] lhs The left-hand side value to compare.
+ * \param[in] rhs The right-hand side value to compare.
+ * \param[out] result Pointer to a boolean that will be set to true if lhs >= rhs, otherwise false.
+ *
+ * \return \ref CARDANO_SUCCESS if the comparison was successful, or an appropriate error code indicating failure.
+ *
+ * \note This function only compares ADA and multi-asset amounts between the two values. If rhs has any asset that is
+ * greater than the same asset in lhs, the result will be set to `false`.
+ */
+cardano_error_t _cardano_large_fist_value_gte(
+  cardano_value_t* lhs,
+  cardano_value_t* rhs,
+  bool*            result);
+
+/**
+ * \brief Compares two UTXOs by a specific asset amount in descending order.
+ *
+ * This function compares the specified asset amounts in the values of two UTXOs. It sorts in descending order,
+ * meaning the UTXO with the greater amount of the asset comes first.
+ *
+ * \param[in] lhs The left-hand side UTXO to compare.
+ * \param[in] rhs The right-hand side UTXO to compare.
+ * \param[in] context A pointer to the specific \ref cardano_asset_id_t representing the asset to compare.
+ *
+ * \return A negative value if lhs has more of the asset than rhs, a positive value if rhs has more of the asset than lhs,
+ *         or 0 if they are equal in terms of the asset amount.
+ */
+int32_t _cardano_large_fist_compare_utxos(cardano_utxo_t* lhs, cardano_utxo_t* rhs, void* context);
+
+/**
+ * \brief Checks if the pre-selected UTXOs satisfy the target value.
+ *
+ * This function iterates over the provided list of pre-selected UTXOs and accumulates their value.
+ * It checks whether the accumulated value satisfies the target value.
+ *
+ * \param[in] pre_selected_utxo A list of pre-selected UTXOs.
+ * \param[in] target_value The target value to satisfy with the pre-selected UTXOs.
+ * \param[out] accumulated_value A pointer to a \ref cardano_value_t object where the accumulated value will be stored.
+ * \param[out] satisfies_target A boolean flag that will be set to true if the accumulated value satisfies the target value,
+ *                              false otherwise.
+ *
+ * \return \ref CARDANO_SUCCESS if the UTXOs were processed successfully, or an appropriate error code.
+ */
+cardano_error_t _cardano_large_fist_check_preselected(
+  cardano_utxo_list_t* pre_selected_utxo,
+  cardano_value_t*     target_value,
+  cardano_value_t**    accumulated_value,
+  bool*                satisfies_target);
+
+/**
+ * \brief Selects UTXOs containing the specified asset to satisfy the required amount.
+ *
+ * This function iterates over the available UTXOs and selects those that contain the specified asset,
+ * accumulating their value until the required amount is met or exceeded.
+ *
+ * \param[in] asset_req The asset ID for which UTXOs are being selected.
+ * \param[in] required_amount The amount of the asset required.
+ * \param[in] available_utxos A list of available UTXOs to select from.
+ * \param[out] selected_utxos A list where the selected UTXOs will be added.
+ * \param[out] accumulated_value A pointer to a \ref cardano_value_t object that will accumulate the selected asset's value.
+ *
+ * \return \ref CARDANO_SUCCESS if UTXOs were successfully selected, or an appropriate error code indicating failure.
+ *
+ * \note The caller is responsible for managing the memory of the `selected_utxos` and `accumulated_value` lists.
+ */
+cardano_error_t _cardano_large_fist_select_utxos(
+  cardano_asset_id_t*  asset_req,
+  int64_t              required_amount,
+  cardano_utxo_list_t* available_utxos,
+  cardano_utxo_list_t* selected_utxos,
+  cardano_value_t**    accumulated_value);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_LARGE_FIRST_HELPERS_H
diff --git a/vendor/src/transaction_builder/coin_selection/internals/random_improve_change_state.c b/vendor/src/transaction_builder/coin_selection/internals/random_improve_change_state.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/random_improve_change_state.c
@@ -0,0 +1,923 @@
+/**
+ * \file random_improve_change_state.c
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id_map.h>
+#include <cardano/transaction_body/transaction_output.h>
+#include <cardano/transaction_builder/fee.h>
+
+#include "./random_improve_change_state.h"
+
+#include "../../../allocators.h"
+#include "../../../string_safe.h"
+#include "./random_improve_helpers.h"
+#include "./random_improve_utxo_utils.h"
+#include "./value_splitting.h"
+
+#include <string.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Adds an asset id to the table if it is not already present.
+ *
+ * The table takes a reference on the added asset id. The storage grows geometrically as needed.
+ *
+ * \param[in,out] table    The table to add to.
+ * \param[in]     asset_id The asset id to add.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+asset_table_add(random_improve_asset_table_t* table, cardano_asset_id_t* asset_id)
+{
+  for (size_t i = 0U; i < table->size; ++i)
+  {
+    if (_cardano_random_improve_asset_id_equals(table->ids[i], asset_id))
+    {
+      return CARDANO_SUCCESS;
+    }
+  }
+
+  if (table->size == table->capacity)
+  {
+    const size_t         new_capacity = (table->capacity == 0U) ? 8U : (table->capacity * 2U);
+    cardano_asset_id_t** new_ids      = (cardano_asset_id_t**)_cardano_malloc(new_capacity * sizeof(cardano_asset_id_t*));
+
+    if (new_ids == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    if (table->ids != NULL)
+    {
+      cardano_safe_memcpy(new_ids, new_capacity * sizeof(cardano_asset_id_t*), table->ids, table->size * sizeof(cardano_asset_id_t*));
+      _cardano_free(table->ids);
+    }
+
+    table->ids      = new_ids;
+    table->capacity = new_capacity;
+  }
+
+  cardano_asset_id_ref(asset_id);
+  table->ids[table->size] = asset_id;
+  ++table->size;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Collects the original output coins to be used as weights for the ada distribution.
+ *
+ * When no outputs were provided, a single change map with a unit weight is used.
+ *
+ * \param[in,out] state            The change state to fill.
+ * \param[in]     outputs_to_cover The user-specified outputs, or NULL.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+collect_output_coin_weights(random_improve_change_state_t* state, cardano_transaction_output_list_t* outputs_to_cover)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t m = 0U; (m < state->map_count) && (result == CARDANO_SUCCESS); ++m)
+  {
+    state->map_order[m]   = m;
+    state->out_weights[m] = 1U;
+
+    if (state->output_count > 0U)
+    {
+      cardano_transaction_output_t* output = NULL;
+
+      result = cardano_transaction_output_list_get(outputs_to_cover, m, &output);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_value_t* value = cardano_transaction_output_get_value(output);
+
+        const int64_t coin = cardano_value_get_coin(value);
+
+        if (coin > 0)
+        {
+          state->out_weights[m] = (uint64_t)coin;
+        }
+        else
+        {
+          state->out_weights[m] = 0U;
+        }
+
+        cardano_value_unref(&value);
+        cardano_transaction_output_unref(&output);
+      }
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Allocates the working buffers of the change state.
+ *
+ * \param[in,out] state The change state; its size fields must already be set.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+allocate_state_buffers(random_improve_change_state_t* state)
+{
+  const size_t scratch_size = (state->selection_size > state->map_count) ? state->selection_size : state->map_count;
+
+  if (state->table.size > 0U)
+  {
+    state->quantities = (uint64_t*)_cardano_malloc(state->table.size * state->map_count * sizeof(uint64_t));
+  }
+
+  state->scratch     = (uint64_t*)_cardano_malloc(scratch_size * sizeof(uint64_t));
+  state->out_weights = (uint64_t*)_cardano_malloc(state->map_count * sizeof(uint64_t));
+  state->map_order   = (size_t*)_cardano_malloc(state->map_count * sizeof(size_t));
+  state->min_adas    = (uint64_t*)_cardano_malloc(state->map_count * sizeof(uint64_t));
+
+  const bool quantities_missing = (state->table.size > 0U) && (state->quantities == NULL);
+
+  if (quantities_missing || (state->scratch == NULL) || (state->out_weights == NULL) || (state->map_order == NULL) || (state->min_adas == NULL))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  if (state->quantities != NULL)
+  {
+    CARDANO_UNUSED(memset(state->quantities, 0, state->table.size * state->map_count * sizeof(uint64_t)));
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Returns the number of distinct assets assigned to the given change map.
+ *
+ * \param[in] state     The change state.
+ * \param[in] map_index The change map to inspect.
+ *
+ * \return The number of assets with a positive quantity in the map.
+ */
+static size_t
+map_asset_count(random_improve_change_state_t* state, const size_t map_index)
+{
+  size_t count = 0U;
+
+  for (size_t a = 0U; a < state->table.size; ++a)
+  {
+    if (state->quantities[(a * state->map_count) + map_index] > 0U)
+    {
+      ++count;
+    }
+  }
+
+  return count;
+}
+
+/**
+ * \brief Computes the minimum required ada for a change output holding the given map's assets.
+ *
+ * \param[in]  state             The change state.
+ * \param[in]  map_index         The change map to measure.
+ * \param[in]  change_address    The address the change output would be sent to.
+ * \param[in]  ada_per_utxo_byte The protocol parameter driving the min-ADA computation.
+ * \param[out] min_ada           The minimum required ada quantity.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+min_ada_for_change_map(
+  random_improve_change_state_t* state,
+  const size_t                   map_index,
+  cardano_address_t*             change_address,
+  const uint64_t                 ada_per_utxo_byte,
+  uint64_t*                      min_ada)
+{
+  cardano_value_t* value = cardano_value_new_zero();
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_value_set_coin(value, 1);
+
+  for (size_t a = 0U; (a < state->table.size) && (result == CARDANO_SUCCESS); ++a)
+  {
+    const uint64_t quantity = state->quantities[(a * state->map_count) + map_index];
+
+    if (quantity > 0U)
+    {
+      result = cardano_value_add_asset_with_id(value, state->table.ids[a], (int64_t)quantity);
+    }
+  }
+
+  cardano_transaction_output_t* output = NULL;
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_transaction_output_new(change_address, 0, &output);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_transaction_output_set_value(output, value);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_compute_min_ada_required(output, ada_per_utxo_byte, min_ada);
+  }
+
+  cardano_transaction_output_unref(&output);
+  cardano_value_unref(&value);
+
+  return result;
+}
+
+/**
+ * \brief Builds the value of a single change output from its map quantities and coin.
+ *
+ * \param[in]  state     The change state.
+ * \param[in]  map_index The change map to materialize.
+ * \param[in]  coin      The ada quantity to assign to the output.
+ * \param[out] value     The resulting value.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+build_change_bundle_value(
+  random_improve_change_state_t* state,
+  const size_t                   map_index,
+  const uint64_t                 coin,
+  cardano_value_t**              value)
+{
+  *value = cardano_value_new_zero();
+
+  if (*value == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_value_set_coin(*value, (int64_t)coin);
+
+  for (size_t a = 0U; (a < state->table.size) && (result == CARDANO_SUCCESS); ++a)
+  {
+    const uint64_t quantity = state->quantities[(a * state->map_count) + map_index];
+
+    if (quantity > 0U)
+    {
+      result = cardano_value_add_asset_with_id(*value, state->table.ids[a], (int64_t)quantity);
+    }
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(value);
+  }
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+void
+_cardano_random_improve_asset_table_free(random_improve_asset_table_t* table)
+{
+  for (size_t i = 0U; i < table->size; ++i)
+  {
+    cardano_asset_id_unref(&table->ids[i]);
+  }
+
+  _cardano_free(table->ids);
+
+  table->ids      = NULL;
+  table->size     = 0U;
+  table->capacity = 0U;
+}
+
+cardano_error_t
+_cardano_random_improve_asset_table_add_value_assets(random_improve_asset_table_t* table, cardano_value_t* value)
+{
+  cardano_asset_id_map_t* assets = cardano_value_as_assets_map(value);
+
+  if (assets == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  const size_t size = cardano_asset_id_map_get_length(assets);
+
+  for (size_t i = 0U; (i < size) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_asset_id_t* asset_id = NULL;
+
+    result = cardano_asset_id_map_get_key_at(assets, i, &asset_id);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      if (!cardano_asset_id_is_lovelace(asset_id))
+      {
+        result = asset_table_add(table, asset_id);
+      }
+
+      cardano_asset_id_unref(&asset_id);
+    }
+  }
+
+  cardano_asset_id_map_unref(&assets);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_random_improve_change_state_init(
+  random_improve_change_state_t*     state,
+  cardano_utxo_list_t*               selection,
+  cardano_value_t*                   target,
+  cardano_transaction_output_list_t* outputs_to_cover)
+{
+  CARDANO_UNUSED(memset(state, 0, sizeof(*state)));
+
+  state->output_count   = (outputs_to_cover != NULL) ? cardano_transaction_output_list_get_length(outputs_to_cover) : 0U;
+  state->map_count      = (state->output_count > 0U) ? state->output_count : 1U;
+  state->selection_size = cardano_utxo_list_get_length(selection);
+  state->excess_valid   = true;
+
+  cardano_error_t result = _cardano_random_improve_asset_table_add_value_assets(&state->table, target);
+
+  for (size_t i = 0U; (i < state->selection_size) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    result = cardano_utxo_list_get(selection, i, &utxo);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_utxo_unref(&utxo);
+      result = _cardano_random_improve_asset_table_add_value_assets(&state->table, _cardano_random_improve_borrow_utxo_value(utxo));
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = allocate_state_buffers(state);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    int64_t selected_coin = 0;
+
+    for (size_t i = 0U; (i < state->selection_size) && (result == CARDANO_SUCCESS); ++i)
+    {
+      cardano_utxo_t* utxo = NULL;
+
+      result = cardano_utxo_list_get(selection, i, &utxo);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_utxo_unref(&utxo);
+        selected_coin += cardano_value_get_coin(_cardano_random_improve_borrow_utxo_value(utxo));
+      }
+    }
+
+    state->excess_coin = selected_coin - cardano_value_get_coin(target);
+
+    if (state->excess_coin < 0)
+    {
+      state->excess_valid = false;
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = collect_output_coin_weights(state, outputs_to_cover);
+  }
+
+  return result;
+}
+
+void
+_cardano_random_improve_change_state_free(random_improve_change_state_t* state)
+{
+  _cardano_random_improve_asset_table_free(&state->table);
+
+  _cardano_free(state->quantities);
+  _cardano_free(state->scratch);
+  _cardano_free(state->out_weights);
+  _cardano_free(state->map_order);
+  _cardano_free(state->min_adas);
+
+  state->quantities  = NULL;
+  state->scratch     = NULL;
+  state->out_weights = NULL;
+  state->map_order   = NULL;
+  state->min_adas    = NULL;
+}
+
+size_t
+_cardano_random_improve_collect_input_quantities(
+  random_improve_change_state_t* state,
+  cardano_utxo_list_t*           selection,
+  cardano_asset_id_t*            asset_id,
+  int64_t*                       selected_total)
+{
+  size_t count = 0U;
+
+  *selected_total = 0;
+
+  for (size_t i = 0U; i < state->selection_size; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    if (cardano_utxo_list_get(selection, i, &utxo) != CARDANO_SUCCESS)
+    {
+      continue;
+    }
+
+    cardano_utxo_unref(&utxo);
+
+    const int64_t quantity = _cardano_random_improve_get_asset_quantity(_cardano_random_improve_borrow_utxo_value(utxo), asset_id);
+
+    if (quantity > 0)
+    {
+      *selected_total       += quantity;
+      state->scratch[count] = (uint64_t)quantity;
+      ++count;
+    }
+  }
+
+  return count;
+}
+
+uint64_t
+_cardano_random_improve_collect_user_weights(
+  random_improve_change_state_t*     state,
+  cardano_transaction_output_list_t* outputs_to_cover,
+  cardano_asset_id_t*                asset_id)
+{
+  uint64_t total = 0U;
+
+  for (size_t m = 0U; m < state->output_count; ++m)
+  {
+    cardano_transaction_output_t* output = NULL;
+
+    if (cardano_transaction_output_list_get(outputs_to_cover, m, &output) != CARDANO_SUCCESS)
+    {
+      continue;
+    }
+
+    cardano_transaction_output_unref(&output);
+
+    cardano_value_t* value = cardano_transaction_output_get_value(output);
+    cardano_value_unref(&value);
+
+    const int64_t quantity = _cardano_random_improve_get_asset_quantity(value, asset_id);
+
+    state->scratch[m] = (quantity > 0) ? (uint64_t)quantity : 0U;
+    total             += state->scratch[m];
+  }
+
+  return total;
+}
+
+void
+_cardano_random_improve_store_distribution(
+  random_improve_change_state_t* state,
+  const size_t                   asset_index,
+  const uint64_t*                parts)
+{
+  for (size_t m = 0U; m < state->map_count; ++m)
+  {
+    state->quantities[(asset_index * state->map_count) + m] = parts[m];
+  }
+}
+
+/**
+ * \brief Builds an asset-only value from the quantities of a single change map.
+ *
+ * \param[in]  state     The change state.
+ * \param[in]  map_index The change map to materialize.
+ * \param[out] value     The resulting asset-only value (zero coin).
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+build_map_asset_value(random_improve_change_state_t* state, const size_t map_index, cardano_value_t** value)
+{
+  *value = cardano_value_new_zero();
+
+  if (*value == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t a = 0U; (a < state->table.size) && (result == CARDANO_SUCCESS); ++a)
+  {
+    const uint64_t quantity = state->quantities[(a * state->map_count) + map_index];
+
+    if (quantity > 0U)
+    {
+      result = cardano_value_add_asset_with_id(*value, state->table.ids[a], (int64_t)quantity);
+    }
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(value);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Writes the assets of a part value into a column of the given quantity matrix.
+ *
+ * \param[in]     state        The change state (for the asset table).
+ * \param[in]     part         The asset-only value holding the part's assets.
+ * \param[in,out] quantities   The destination matrix, `table.size` rows by `column_count` columns.
+ * \param[in]     column_count The number of columns of the destination matrix.
+ * \param[in]     column       The destination column.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+write_part_to_column(
+  random_improve_change_state_t* state,
+  cardano_value_t*               part,
+  uint64_t*                      quantities,
+  const size_t                   column_count,
+  const size_t                   column)
+{
+  cardano_asset_id_map_t* assets = cardano_value_as_assets_map(part);
+
+  if (assets == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  const size_t asset_count = cardano_asset_id_map_get_length(assets);
+
+  for (size_t i = 0U; (i < asset_count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_asset_id_t* asset_id = NULL;
+
+    result = cardano_asset_id_map_get_key_at(assets, i, &asset_id);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      if (!cardano_asset_id_is_lovelace(asset_id))
+      {
+        int64_t quantity = 0;
+
+        result = cardano_asset_id_map_get(assets, asset_id, &quantity);
+
+        for (size_t a = 0U; (a < state->table.size) && (result == CARDANO_SUCCESS); ++a)
+        {
+          if (_cardano_random_improve_asset_id_equals(state->table.ids[a], asset_id))
+          {
+            quantities[(a * column_count) + column] = (quantity > 0) ? (uint64_t)quantity : 0U;
+          }
+        }
+      }
+
+      cardano_asset_id_unref(&asset_id);
+    }
+  }
+
+  cardano_asset_id_map_unref(&assets);
+
+  return result;
+}
+
+cardano_error_t
+_cardano_random_improve_split_oversized_maps(
+  random_improve_change_state_t* state,
+  const uint64_t                 max_value_size)
+{
+  if ((max_value_size == 0U) || (state->table.size == 0U))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  const size_t original_map_count = state->map_count;
+
+  cardano_value_part_list_t* map_parts = (cardano_value_part_list_t*)_cardano_malloc(original_map_count * sizeof(cardano_value_part_list_t));
+
+  if (map_parts == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  CARDANO_UNUSED(memset(map_parts, 0, original_map_count * sizeof(cardano_value_part_list_t)));
+
+  cardano_error_t result    = CARDANO_SUCCESS;
+  size_t          new_count = 0U;
+
+  for (size_t m = 0U; (m < original_map_count) && (result == CARDANO_SUCCESS); ++m)
+  {
+    cardano_value_t* map_value = NULL;
+
+    result = build_map_asset_value(state, m, &map_value);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = _cardano_coin_selection_split_value_assets(map_value, max_value_size, &map_parts[m]);
+
+      cardano_value_unref(&map_value);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      new_count += map_parts[m].size;
+    }
+  }
+
+  if ((result == CARDANO_SUCCESS) && (new_count > original_map_count))
+  {
+    uint64_t* new_quantities  = (uint64_t*)_cardano_malloc(state->table.size * new_count * sizeof(uint64_t));
+    uint64_t* new_out_weights = (uint64_t*)_cardano_malloc(new_count * sizeof(uint64_t));
+    size_t*   new_map_order   = (size_t*)_cardano_malloc(new_count * sizeof(size_t));
+    uint64_t* new_min_adas    = (uint64_t*)_cardano_malloc(new_count * sizeof(uint64_t));
+
+    if ((new_quantities == NULL) || (new_out_weights == NULL) || (new_map_order == NULL) || (new_min_adas == NULL))
+    {
+      result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+    else
+    {
+      CARDANO_UNUSED(memset(new_quantities, 0, state->table.size * new_count * sizeof(uint64_t)));
+
+      size_t column = 0U;
+
+      for (size_t m = 0U; (m < original_map_count) && (result == CARDANO_SUCCESS); ++m)
+      {
+        const size_t   parts  = map_parts[m].size;
+        const uint64_t weight = state->out_weights[m];
+
+        for (size_t p = 0U; (p < parts) && (result == CARDANO_SUCCESS); ++p)
+        {
+          result = write_part_to_column(state, map_parts[m].items[p], new_quantities, new_count, column);
+
+          if (result == CARDANO_SUCCESS)
+          {
+            uint64_t part_weight = weight / (uint64_t)parts;
+
+            if ((uint64_t)p < (weight % (uint64_t)parts))
+            {
+              part_weight += 1U;
+            }
+
+            new_out_weights[column] = part_weight;
+            new_map_order[column]   = column;
+
+            ++column;
+          }
+        }
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        _cardano_free(state->quantities);
+        _cardano_free(state->out_weights);
+        _cardano_free(state->map_order);
+        _cardano_free(state->min_adas);
+
+        state->quantities  = new_quantities;
+        state->out_weights = new_out_weights;
+        state->map_order   = new_map_order;
+        state->min_adas    = new_min_adas;
+        state->map_count   = new_count;
+      }
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      _cardano_free(new_quantities);
+      _cardano_free(new_out_weights);
+      _cardano_free(new_map_order);
+      _cardano_free(new_min_adas);
+    }
+  }
+
+  for (size_t m = 0U; m < original_map_count; ++m)
+  {
+    _cardano_coin_selection_value_parts_free(&map_parts[m]);
+  }
+
+  _cardano_free(map_parts);
+
+  return result;
+}
+
+void
+_cardano_random_improve_order_maps_by_asset_count(random_improve_change_state_t* state)
+{
+  for (size_t i = 1U; i < state->map_count; ++i)
+  {
+    const size_t key        = state->map_order[i];
+    const size_t key_assets = map_asset_count(state, key);
+
+    size_t j        = i;
+    bool   in_place = false;
+
+    while ((j > 0U) && !in_place)
+    {
+      if (map_asset_count(state, state->map_order[j - 1U]) <= key_assets)
+      {
+        in_place = true;
+      }
+      else
+      {
+        state->map_order[j] = state->map_order[j - 1U];
+        --j;
+      }
+    }
+
+    state->map_order[j] = key;
+  }
+}
+
+cardano_error_t
+_cardano_random_improve_compute_min_ada_requirements(
+  random_improve_change_state_t* state,
+  cardano_address_t*             change_address,
+  const uint64_t                 ada_per_utxo_byte,
+  uint64_t*                      ada_required)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  *ada_required = 0U;
+
+  for (size_t m = 0U; (m < state->map_count) && (result == CARDANO_SUCCESS); ++m)
+  {
+    result = min_ada_for_change_map(state, state->map_order[m], change_address, ada_per_utxo_byte, &state->min_adas[m]);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      *ada_required += state->min_adas[m];
+    }
+  }
+
+  return result;
+}
+
+bool
+_cardano_random_improve_change_is_exact_match(random_improve_change_state_t* state)
+{
+  if (state->excess_coin != 0)
+  {
+    return false;
+  }
+
+  for (size_t a = 0U; a < state->table.size; ++a)
+  {
+    for (size_t m = 0U; m < state->map_count; ++m)
+    {
+      if (state->quantities[(a * state->map_count) + m] > 0U)
+      {
+        return false;
+      }
+    }
+  }
+
+  return true;
+}
+
+void
+_cardano_random_improve_drop_underfunded_empty_maps(
+  random_improve_change_state_t* state,
+  const uint64_t                 ada_available,
+  uint64_t*                      ada_required,
+  size_t*                        first_map)
+{
+  *first_map = 0U;
+
+  bool done = false;
+
+  while ((ada_available < *ada_required) && !done)
+  {
+    const bool can_drop = (*first_map < (state->map_count - 1U)) && (map_asset_count(state, state->map_order[*first_map]) == 0U);
+
+    if (can_drop)
+    {
+      *ada_required -= state->min_adas[*first_map];
+      ++(*first_map);
+    }
+    else
+    {
+      done = true;
+    }
+  }
+}
+
+cardano_error_t
+_cardano_random_improve_emit_change_outputs(
+  random_improve_change_state_t*      state,
+  const size_t                        first_map,
+  const uint64_t                      ada_available,
+  const uint64_t                      ada_required,
+  cardano_address_t*                  change_address,
+  cardano_transaction_output_list_t** change_outputs)
+{
+  const size_t   remaining_maps = state->map_count - first_map;
+  const uint64_t ada_remaining  = ada_available - ada_required;
+
+  uint64_t* weights = (uint64_t*)_cardano_malloc(remaining_maps * sizeof(uint64_t));
+  uint64_t* shares  = (uint64_t*)_cardano_malloc(remaining_maps * sizeof(uint64_t));
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if ((weights == NULL) || (shares == NULL))
+  {
+    result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+  else
+  {
+    uint64_t weight_total = 0U;
+
+    for (size_t m = 0U; m < remaining_maps; ++m)
+    {
+      weights[m]   = state->out_weights[state->map_order[first_map + m]];
+      weight_total += weights[m];
+    }
+
+    if (weight_total == 0U)
+    {
+      CARDANO_UNUSED(memset(shares, 0, remaining_maps * sizeof(uint64_t)));
+      shares[remaining_maps - 1U] = ada_remaining;
+    }
+    else
+    {
+      result = _cardano_random_improve_partition(ada_remaining, weights, remaining_maps, shares);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_transaction_output_list_new(change_outputs);
+  }
+
+  for (size_t m = 0U; (m < remaining_maps) && (result == CARDANO_SUCCESS); ++m)
+  {
+    const size_t   map_index   = state->map_order[first_map + m];
+    const uint64_t bundle_coin = state->min_adas[m + first_map] + shares[m];
+
+    cardano_value_t* value = NULL;
+
+    result = build_change_bundle_value(state, map_index, bundle_coin, &value);
+
+    cardano_transaction_output_t* output = NULL;
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_transaction_output_new(change_address, 0, &output);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_transaction_output_set_value(output, value);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_transaction_output_list_add(*change_outputs, output);
+    }
+
+    cardano_transaction_output_unref(&output);
+    cardano_value_unref(&value);
+  }
+
+  _cardano_free(weights);
+  _cardano_free(shares);
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/coin_selection/internals/random_improve_change_state.h b/vendor/src/transaction_builder/coin_selection/internals/random_improve_change_state.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/random_improve_change_state.h
@@ -0,0 +1,271 @@
+/**
+ * \file random_improve_change_state.h
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_CHANGE_STATE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_CHANGE_STATE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/assets/asset_id.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/protocol_params/protocol_parameters.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+#include <cardano/transaction_body/value.h>
+#include <cardano/typedefs.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Working table of every distinct asset involved in a selection.
+ */
+typedef struct random_improve_asset_table_t
+{
+    cardano_asset_id_t** ids;
+    size_t               size;
+    size_t               capacity;
+} random_improve_asset_table_t;
+
+/**
+ * \brief Working state for the change generation phase of the random improve selector.
+ *
+ * The `quantities` buffer is an asset-major matrix of `table.size` rows by `map_count` columns:
+ * entry `(a, m)` holds the quantity of asset `a` assigned to change map `m`. The `map_order`
+ * buffer holds a permutation of the change map indices, sorted by ascending asset count so that
+ * empty maps come first. The `scratch` buffer is shared working space for per-asset collection.
+ */
+typedef struct random_improve_change_state_t
+{
+    random_improve_asset_table_t table;
+    size_t                       map_count;
+    size_t                       output_count;
+    size_t                       selection_size;
+    uint64_t*                    quantities;
+    uint64_t*                    scratch;
+    uint64_t*                    out_weights;
+    size_t*                      map_order;
+    uint64_t*                    min_adas;
+    int64_t                      excess_coin;
+    bool                         excess_valid;
+} random_improve_change_state_t;
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Releases the asset ids held by the table and frees its storage.
+ *
+ * \param[in,out] table The table to free. Reset to an empty table.
+ */
+void
+_cardano_random_improve_asset_table_free(random_improve_asset_table_t* table);
+
+/**
+ * \brief Adds every non-lovelace asset of the given value to the table, skipping duplicates.
+ *
+ * The table takes a reference on every added asset id. The storage grows geometrically as needed.
+ *
+ * \param[in,out] table The table to add to.
+ * \param[in]     value The value whose assets to add.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+cardano_error_t
+_cardano_random_improve_asset_table_add_value_assets(random_improve_asset_table_t* table, cardano_value_t* value);
+
+/**
+ * \brief Initializes the change state: allocates the working buffers, collects the involved
+ * assets, gathers the output coin weights and computes the excess coin of the selection over
+ * the target.
+ *
+ * \param[out] state            The state to initialize.
+ * \param[in]  selection        The selected UTXOs.
+ * \param[in]  target           The target value.
+ * \param[in]  outputs_to_cover The user-specified outputs, or NULL (in which case a single
+ *                              change map with a unit weight is used).
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code. On failure the state
+ *         is safe to pass to \ref _cardano_random_improve_change_state_free.
+ */
+cardano_error_t
+_cardano_random_improve_change_state_init(
+  random_improve_change_state_t*     state,
+  cardano_utxo_list_t*               selection,
+  cardano_value_t*                   target,
+  cardano_transaction_output_list_t* outputs_to_cover);
+
+/**
+ * \brief Frees all buffers held by the change state.
+ *
+ * \param[in,out] state The state to free.
+ */
+void
+_cardano_random_improve_change_state_free(random_improve_change_state_t* state);
+
+/**
+ * \brief Collects the per-input quantities of the given asset into the state's scratch buffer.
+ *
+ * \param[in,out] state          The change state (its scratch buffer receives the quantities).
+ * \param[in]     selection      The selected UTXOs.
+ * \param[in]     asset_id       The asset to collect.
+ * \param[out]    selected_total The total selected quantity of the asset.
+ *
+ * \return The number of inputs holding a positive quantity of the asset.
+ */
+size_t
+_cardano_random_improve_collect_input_quantities(
+  random_improve_change_state_t* state,
+  cardano_utxo_list_t*           selection,
+  cardano_asset_id_t*            asset_id,
+  int64_t*                       selected_total);
+
+/**
+ * \brief Collects the per-output quantities of the given asset (the user-specified weights)
+ * into the state's scratch buffer.
+ *
+ * \param[in,out] state            The change state (its scratch buffer receives the weights).
+ * \param[in]     outputs_to_cover The user-specified outputs.
+ * \param[in]     asset_id         The asset to collect.
+ *
+ * \return The total user-specified quantity of the asset. A value of zero means the asset is
+ *         not user-specified.
+ */
+uint64_t
+_cardano_random_improve_collect_user_weights(
+  random_improve_change_state_t*     state,
+  cardano_transaction_output_list_t* outputs_to_cover,
+  cardano_asset_id_t*                asset_id);
+
+/**
+ * \brief Writes the distributed parts of an asset into the state's quantity matrix.
+ *
+ * \param[in,out] state       The change state.
+ * \param[in]     asset_index The row (asset) to write.
+ * \param[in]     parts       The quantities to write, one per change map.
+ */
+void
+_cardano_random_improve_store_distribution(
+  random_improve_change_state_t* state,
+  size_t                         asset_index,
+  const uint64_t*                parts);
+
+/**
+ * \brief Splits change maps whose assets would exceed the maximum serialized size of a
+ * transaction output value.
+ *
+ * This is a port of `splitBundlesWithExcessiveAssetCounts` from the cardano-coin-selection
+ * library: every oversized map has its assets recursively equipartitioned into halves, and each
+ * half becomes a change map of its own. The output coin weight of a split map is distributed
+ * evenly among its parts. As a result, the number of change maps can exceed the number of
+ * user-specified outputs.
+ *
+ * \param[in,out] state          The change state; its buffers are reallocated when maps split.
+ * \param[in]     max_value_size The protocol maximum serialized size of an output value, in
+ *                               bytes. A value of zero means "no limit" (no splitting occurs).
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+cardano_error_t
+_cardano_random_improve_split_oversized_maps(
+  random_improve_change_state_t* state,
+  uint64_t                       max_value_size);
+
+/**
+ * \brief Orders the change maps by ascending asset count (stable), so empty maps come first.
+ *
+ * This ordering allows the coin assignment step to drop empty maps from the front of the list
+ * when the available ada is insufficient (port of the AssetCount ordering used by
+ * assignCoinsToChangeMaps in the reference implementation).
+ *
+ * \param[in,out] state The change state; its `map_order` buffer is rearranged.
+ */
+void
+_cardano_random_improve_order_maps_by_asset_count(random_improve_change_state_t* state);
+
+/**
+ * \brief Computes the min-ADA requirement of every change map, in map order.
+ *
+ * \param[in,out] state             The change state; its `min_adas` buffer is filled.
+ * \param[in]     change_address    The address the change outputs would be sent to.
+ * \param[in]     ada_per_utxo_byte The protocol parameter driving the min-ADA computation.
+ * \param[out]    ada_required      The total min-ADA requirement across all maps.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+cardano_error_t
+_cardano_random_improve_compute_min_ada_requirements(
+  random_improve_change_state_t* state,
+  cardano_address_t*             change_address,
+  uint64_t                       ada_per_utxo_byte,
+  uint64_t*                      ada_required);
+
+/**
+ * \brief Indicates whether the selection matches the target exactly (no change is needed).
+ *
+ * \param[in] state The change state.
+ *
+ * \return true if the excess coin is zero and no asset quantities were distributed.
+ */
+bool
+_cardano_random_improve_change_is_exact_match(random_improve_change_state_t* state);
+
+/**
+ * \brief Drops empty change maps from the front of the ordered list while the available ada is
+ * insufficient to fund the min-ADA requirement of every remaining map.
+ *
+ * At least one map is always kept: the change must carry the full excess, since the local
+ * balance invariant of the coin selector contract does not allow leftover ada to be discarded.
+ *
+ * \param[in]     state         The change state.
+ * \param[in]     ada_available The ada available for the change outputs.
+ * \param[in,out] ada_required  The total min-ADA requirement; reduced as maps are dropped.
+ * \param[out]    first_map     The index (in map order) of the first map that is kept.
+ */
+void
+_cardano_random_improve_drop_underfunded_empty_maps(
+  random_improve_change_state_t* state,
+  uint64_t                       ada_available,
+  uint64_t*                      ada_required,
+  size_t*                        first_map);
+
+/**
+ * \brief Emits the final change outputs: assigns each kept map its min-ADA plus a share of the
+ * remaining ada, proportional to the original output coins (port of assignCoinsToChangeMaps).
+ *
+ * \param[in]  state          The change state.
+ * \param[in]  first_map      The index (in map order) of the first map that was kept.
+ * \param[in]  ada_available  The ada available for the change outputs.
+ * \param[in]  ada_required   The total min-ADA requirement of the kept maps.
+ * \param[in]  change_address The address the change outputs are sent to.
+ * \param[out] change_outputs The resulting list of change outputs.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+cardano_error_t
+_cardano_random_improve_emit_change_outputs(
+  random_improve_change_state_t*      state,
+  size_t                              first_map,
+  uint64_t                            ada_available,
+  uint64_t                            ada_required,
+  cardano_address_t*                  change_address,
+  cardano_transaction_output_list_t** change_outputs);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_CHANGE_STATE_H
diff --git a/vendor/src/transaction_builder/coin_selection/internals/random_improve_coin_selector.c b/vendor/src/transaction_builder/coin_selection/internals/random_improve_coin_selector.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/random_improve_coin_selector.c
@@ -0,0 +1,790 @@
+/**
+ * \file random_improve_coin_selector.c
+ *
+ * \author angel.castillo
+ * \date   Jul 02, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+#include <cardano/transaction_builder/coin_selection/random_improve_coin_selector.h>
+
+#include "../../../allocators.h"
+#include "../../../string_safe.h"
+#include "./random_improve_change_state.h"
+#include "./random_improve_helpers.h"
+#include "./random_improve_selection_index.h"
+#include "./random_improve_utxo_utils.h"
+
+#include <sodium.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Context for the random improve coin selector, holding the RNG seed.
+ */
+typedef struct random_improve_context_t
+{
+    cardano_object_t             base;
+    uint64_t                     seed;
+    cardano_selection_strategy_t strategy;
+} random_improve_context_t;
+
+/* SELECTION PHASE ***********************************************************/
+
+/**
+ * \brief Runs a single selection step for the given requirement (port of runSelectionStep).
+ *
+ * While the selected quantity is below the minimum, any successful pick is accepted. Once at or
+ * above the minimum, a pick is accepted only if it moves the selected quantity strictly closer
+ * to the improvement target (the minimum times the strategy multiplier); otherwise it is undone.
+ *
+ * \param[in,out] index             The selection index.
+ * \param[in,out] rng_state         The random number generator state.
+ * \param[in]     processor_index   The requirement being processed.
+ * \param[in]     target_multiplier The improvement target as a multiple of the minimum
+ *                                  (2 for the optimal strategy, 1 for the minimal one).
+ *
+ * \return true if the step improved the selection, false if the requirement is exhausted.
+ */
+static bool
+run_selection_step(
+  random_improve_selection_index_t* index,
+  uint64_t*                         rng_state,
+  const size_t                      processor_index,
+  const uint64_t                    target_multiplier)
+{
+  const uint64_t minimum = index->processors[processor_index].minimum;
+  const uint64_t current = index->processors[processor_index].selected_total;
+
+  if (current < minimum)
+  {
+    return _cardano_random_improve_index_pick(index, rng_state, processor_index);
+  }
+
+  const uint64_t target = minimum * target_multiplier;
+
+  if (!_cardano_random_improve_index_pick(index, rng_state, processor_index))
+  {
+    return false;
+  }
+
+  const uint64_t updated = index->processors[processor_index].selected_total;
+
+  if (_cardano_random_improve_distance(target, updated) < _cardano_random_improve_distance(target, current))
+  {
+    return true;
+  }
+
+  _cardano_random_improve_index_undo_last_pick(index);
+
+  return false;
+}
+
+/**
+ * \brief Runs the requirements round-robin until none of them can improve the selection.
+ *
+ * Each active requirement performs one selection step per cycle. A requirement that fails to
+ * improve the selection is deactivated; the loop terminates when a full cycle makes no progress.
+ *
+ * \param[in,out] index             The selection index.
+ * \param[in,out] rng_state         The random number generator state.
+ * \param[in]     target_multiplier The improvement target as a multiple of each requirement's
+ *                                  minimum.
+ */
+static void
+run_round_robin(
+  random_improve_selection_index_t* index,
+  uint64_t*                         rng_state,
+  const uint64_t                    target_multiplier)
+{
+  bool progress = true;
+
+  while (progress)
+  {
+    progress = false;
+
+    for (size_t p = 0U; p < index->processor_count; ++p)
+    {
+      if (!index->processors[p].active)
+      {
+        continue;
+      }
+
+      if (run_selection_step(index, rng_state, p, target_multiplier))
+      {
+        progress = true;
+      }
+      else
+      {
+        index->processors[p].active = false;
+      }
+    }
+  }
+}
+
+/**
+ * \brief Runs the selection phase: covers the target via round-robin random-improve selection.
+ *
+ * \param[in,out] index     The selection index, seeded with the pool and the requirements.
+ * \param[in,out] rng_state The random number generator state.
+ * \param[in]     strategy  The selection strategy to use.
+ *
+ * \return \ref CARDANO_SUCCESS if the target is covered and the selection is not empty, or
+ *         \ref CARDANO_ERROR_BALANCE_INSUFFICIENT otherwise.
+ */
+static cardano_error_t
+run_selection_phase(
+  random_improve_selection_index_t*  index,
+  uint64_t*                          rng_state,
+  const cardano_selection_strategy_t strategy)
+{
+  uint64_t target_multiplier = 1U;
+
+  if (strategy == CARDANO_SELECTION_STRATEGY_OPTIMAL)
+  {
+    target_multiplier = 2U;
+  }
+
+  run_round_robin(index, rng_state, target_multiplier);
+
+  for (size_t p = 0U; p < index->processor_count; ++p)
+  {
+    if (index->processors[p].selected_total < index->processors[p].minimum)
+    {
+      return CARDANO_ERROR_BALANCE_INSUFFICIENT;
+    }
+  }
+
+  // A selection must never be empty: fall back to a single ada pick when nothing was required.
+  if ((index->pre_selected_count == 0U) && (index->pick_count == 0U))
+  {
+    if (!_cardano_random_improve_index_pick(index, rng_state, index->processor_count - 1U))
+    {
+      return CARDANO_ERROR_BALANCE_INSUFFICIENT;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Picks one additional ada-bearing UTXO for change construction and appends it to the
+ * materialized selection list.
+ *
+ * \param[in,out] index     The selection index.
+ * \param[in,out] rng_state The random number generator state.
+ * \param[in,out] selection The materialized selection list.
+ *
+ * \return true if a UTXO was picked and appended, false if the pool is exhausted.
+ */
+static bool
+pick_additional_ada(
+  random_improve_selection_index_t* index,
+  uint64_t*                         rng_state,
+  cardano_utxo_list_t*              selection)
+{
+  const size_t coin_processor = index->processor_count - 1U;
+
+  if (!_cardano_random_improve_index_pick(index, rng_state, coin_processor))
+  {
+    return false;
+  }
+
+  const size_t entry = index->picks[index->pick_count - 1U].pool_index;
+
+  if (cardano_utxo_list_add(selection, index->pool[entry]) != CARDANO_SUCCESS)
+  {
+    _cardano_random_improve_index_undo_last_pick(index);
+
+    return false;
+  }
+
+  return true;
+}
+
+/* CHANGE GENERATION *********************************************************/
+
+/**
+ * \brief Distributes the excess of a user-specified asset proportionally to the quantities
+ * of that asset in the user-specified outputs (port of makeChangeForUserSpecifiedAsset).
+ *
+ * The per-output weights are expected in the state's scratch buffer.
+ *
+ * \param[in,out] state       The change state.
+ * \param[in]     asset_index The row (asset) being distributed.
+ * \param[in]     excess      The excess quantity to distribute.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+distribute_user_specified_excess(random_improve_change_state_t* state, const size_t asset_index, const int64_t excess)
+{
+  uint64_t* parts = (uint64_t*)_cardano_malloc(state->map_count * sizeof(uint64_t));
+
+  if (parts == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = _cardano_random_improve_partition((uint64_t)excess, state->scratch, state->map_count, parts);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    _cardano_random_improve_store_distribution(state, asset_index, parts);
+  }
+
+  _cardano_free(parts);
+
+  return result;
+}
+
+/**
+ * \brief Distributes the excess of a non-user-specified asset, preserving the granularity of the
+ * selected inputs (port of makeChangeForNonUserSpecifiedAsset).
+ *
+ * The per-input quantities are expected in the state's scratch buffer, and are pad-coalesced to
+ * the number of change maps. Mints (excess greater than the selected total) are added to the
+ * largest map; burns (excess smaller than the selected total) are removed from the smallest maps.
+ *
+ * \param[in,out] state          The change state.
+ * \param[in]     asset_index    The row (asset) being distributed.
+ * \param[in]     excess         The excess quantity to distribute.
+ * \param[in]     selected_total The total selected quantity of the asset.
+ * \param[in]     input_count    The number of per-input quantities in the scratch buffer.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+distribute_non_user_specified_excess(
+  random_improve_change_state_t* state,
+  const size_t                   asset_index,
+  const int64_t                  excess,
+  const int64_t                  selected_total,
+  const size_t                   input_count)
+{
+  uint64_t* parts = (uint64_t*)_cardano_malloc(state->map_count * sizeof(uint64_t));
+
+  if (parts == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (input_count == 0U)
+  {
+    CARDANO_UNUSED(memset(parts, 0, state->map_count * sizeof(uint64_t)));
+  }
+  else
+  {
+    result = _cardano_random_improve_pad_coalesce(state->scratch, input_count, state->map_count, parts);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    if (excess < selected_total)
+    {
+      const int64_t burn_amount = selected_total - excess;
+
+      _cardano_random_improve_reduce_quantities((uint64_t)burn_amount, parts, state->map_count);
+    }
+
+    if (excess > selected_total)
+    {
+      const int64_t mint_amount = excess - selected_total;
+
+      parts[state->map_count - 1U] += (uint64_t)mint_amount;
+    }
+
+    _cardano_random_improve_store_distribution(state, asset_index, parts);
+  }
+
+  _cardano_free(parts);
+
+  return result;
+}
+
+/**
+ * \brief Distributes the excess of every involved asset across the change maps.
+ *
+ * Sets the state's `excess_valid` flag to false if the selection does not cover the target
+ * for some asset.
+ *
+ * \param[in,out] state            The change state.
+ * \param[in]     selection        The selected UTXOs.
+ * \param[in]     target           The target value.
+ * \param[in]     outputs_to_cover The user-specified outputs, or NULL.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+distribute_asset_excesses(
+  random_improve_change_state_t*     state,
+  cardano_utxo_list_t*               selection,
+  cardano_value_t*                   target,
+  cardano_transaction_output_list_t* outputs_to_cover)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t a = 0U; ((a < state->table.size) && (result == CARDANO_SUCCESS)) && state->excess_valid; ++a)
+  {
+    cardano_asset_id_t* asset_id = state->table.ids[a];
+
+    const int64_t selected_total = (int64_t)_cardano_random_improve_selected_quantity(selection, asset_id);
+    const int64_t required       = _cardano_random_improve_get_asset_quantity(target, asset_id);
+    const int64_t excess         = selected_total - required;
+
+    if (excess < 0)
+    {
+      state->excess_valid = false;
+      continue;
+    }
+
+    if (excess == 0)
+    {
+      continue;
+    }
+
+    // The user-specified check must run before collecting input quantities: both collectors
+    // share the state's scratch buffer, so only the branch that is taken may fill it.
+    const uint64_t user_weight_total = (state->output_count > 0U) ? _cardano_random_improve_collect_user_weights(state, outputs_to_cover, asset_id) : 0U;
+
+    if (user_weight_total > 0U)
+    {
+      result = distribute_user_specified_excess(state, a, excess);
+    }
+    else
+    {
+      int64_t      collected_total = 0;
+      const size_t input_count     = _cardano_random_improve_collect_input_quantities(state, selection, asset_id, &collected_total);
+
+      result = distribute_non_user_specified_excess(state, a, excess, selected_total, input_count);
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Attempts to construct change outputs for the current selection (port of makeChange).
+ *
+ * On success, the resulting change outputs are stored in `change_outputs`. If the selected ada
+ * is insufficient to make every non-empty change bundle min-ADA compliant, the function returns
+ * \ref CARDANO_ERROR_BALANCE_INSUFFICIENT so that the caller can select additional ada and retry.
+ *
+ * \param[in]  selection        The selected UTXOs.
+ * \param[in]  target           The target value.
+ * \param[in]  outputs_to_cover The user-specified outputs used as a shape hint, or NULL.
+ * \param[in]  change_address   The address the change outputs are sent to.
+ * \param[in]  protocol_params  The protocol parameters, used for min-ADA compliance.
+ * \param[out] change_outputs   The resulting list of change outputs.
+ * \param[out] change_count     The number of change outputs generated (may be fewer than the
+ *                              number of change maps when ada was tight and empty maps were dropped).
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+make_change(
+  cardano_utxo_list_t*                selection,
+  cardano_value_t*                    target,
+  cardano_transaction_output_list_t*  outputs_to_cover,
+  cardano_address_t*                  change_address,
+  cardano_protocol_parameters_t*      protocol_params,
+  cardano_transaction_output_list_t** change_outputs,
+  size_t*                             change_count)
+{
+  *change_outputs = NULL;
+  *change_count   = 0U;
+
+  random_improve_change_state_t state;
+
+  cardano_error_t result = _cardano_random_improve_change_state_init(&state, selection, target, outputs_to_cover);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = distribute_asset_excesses(&state, selection, target, outputs_to_cover);
+  }
+
+  if ((result == CARDANO_SUCCESS) && !state.excess_valid)
+  {
+    result = CARDANO_ERROR_BALANCE_INSUFFICIENT;
+  }
+
+  if ((result == CARDANO_SUCCESS) && _cardano_random_improve_change_is_exact_match(&state))
+  {
+    result = cardano_transaction_output_list_new(change_outputs);
+
+    _cardano_random_improve_change_state_free(&state);
+
+    return result;
+  }
+
+  uint64_t ada_required = 0U;
+  size_t   first_map    = 0U;
+
+  const uint64_t ada_available = (state.excess_coin > 0) ? (uint64_t)state.excess_coin : 0U;
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = _cardano_random_improve_split_oversized_maps(&state, cardano_protocol_parameters_get_max_value_size(protocol_params));
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    const uint64_t ada_per_utxo_byte = cardano_protocol_parameters_get_ada_per_utxo_byte(protocol_params);
+
+    _cardano_random_improve_order_maps_by_asset_count(&state);
+
+    result = _cardano_random_improve_compute_min_ada_requirements(&state, change_address, ada_per_utxo_byte, &ada_required);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    _cardano_random_improve_drop_underfunded_empty_maps(&state, ada_available, &ada_required, &first_map);
+
+    if (ada_available < ada_required)
+    {
+      result = CARDANO_ERROR_BALANCE_INSUFFICIENT;
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = _cardano_random_improve_emit_change_outputs(&state, first_map, ada_available, ada_required, change_address, change_outputs);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *change_count = state.map_count - first_map;
+  }
+
+  if ((result != CARDANO_SUCCESS) && (*change_outputs != NULL))
+  {
+    cardano_transaction_output_list_unref(change_outputs);
+  }
+
+  _cardano_random_improve_change_state_free(&state);
+
+  return result;
+}
+
+/**
+ * \brief Generates change outputs, selecting one additional ada UTXO and retrying while change
+ * cannot be constructed, or while the number of change outputs is fewer than desired
+ * (port of makeChangeRepeatedly).
+ *
+ * \param[in,out] rng_state        The random number generator state.
+ * \param[in,out] selection        The selected UTXOs; may grow as additional ada is selected.
+ * \param[in,out] leftover         The pool of unselected UTXOs.
+ * \param[in]     target           The target value.
+ * \param[in]     outputs_to_cover The user-specified outputs used as a shape hint, or NULL.
+ * \param[in]     change_address   The address the change outputs are sent to.
+ * \param[in]     protocol_params  The protocol parameters, used for min-ADA compliance.
+ * \param[out]    change_outputs   The resulting list of change outputs.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+generate_change_with_retries(
+  random_improve_selection_index_t*   index,
+  uint64_t*                           rng_state,
+  cardano_utxo_list_t*                selection,
+  cardano_value_t*                    target,
+  cardano_transaction_output_list_t*  outputs_to_cover,
+  cardano_address_t*                  change_address,
+  cardano_protocol_parameters_t*      protocol_params,
+  cardano_transaction_output_list_t** change_outputs)
+{
+  const size_t output_count      = (outputs_to_cover != NULL) ? cardano_transaction_output_list_get_length(outputs_to_cover) : 0U;
+  const size_t desired_map_count = (output_count > 0U) ? output_count : 1U;
+
+  cardano_error_t result = CARDANO_SUCCESS;
+  bool            done   = false;
+
+  while ((result == CARDANO_SUCCESS) && !done)
+  {
+    size_t change_count = 0U;
+
+    const cardano_error_t change_result = make_change(
+      selection,
+      target,
+      outputs_to_cover,
+      change_address,
+      protocol_params,
+      change_outputs,
+      &change_count);
+
+    if (change_result == CARDANO_SUCCESS)
+    {
+      if ((change_count >= desired_map_count) || !pick_additional_ada(index, rng_state, selection))
+      {
+        done = true;
+      }
+      else
+      {
+        cardano_transaction_output_list_unref(change_outputs);
+      }
+    }
+    else if (change_result == CARDANO_ERROR_BALANCE_INSUFFICIENT)
+    {
+      if (!pick_additional_ada(index, rng_state, selection))
+      {
+        result = change_result;
+      }
+    }
+    else
+    {
+      result = change_result;
+    }
+  }
+
+  return result;
+}
+
+/* SELECT ********************************************************************/
+
+/**
+ * \brief Records the standard insufficient-balance error message on the implementation.
+ *
+ * \param[in,out] coin_selector The coin selector implementation.
+ */
+static void
+set_insufficient_balance_error(cardano_coin_selector_impl_t* coin_selector)
+{
+  static const char* message = "Random improve selection failed: insufficient balance to cover the target and min-ADA compliant change.";
+
+  cardano_safe_memcpy(coin_selector->error_message, 1024U, message, cardano_safe_strlen(message, 1023U));
+}
+
+/**
+ * \brief Selects UTXOs using the Round-Robin Random-Improve algorithm and produces
+ * min-ADA compliant change outputs that mimic the shape of the user-specified outputs.
+ *
+ * \param[in] coin_selector A pointer to the coin selector implementation object.
+ * \param[in] request The selection request. The request's outputs_to_cover hint is used to size the change outputs.
+ * \param[out] selection A pointer to the list of selected UTXOs that meet the target value.
+ * \param[out] remaining_utxo A pointer to the list of UTXOs that were not selected.
+ * \param[out] change_outputs A pointer to the list of change outputs produced by the selection.
+ *
+ * \return \ref CARDANO_SUCCESS if UTXOs were successfully selected, or an appropriate error code.
+ */
+static cardano_error_t
+random_improve_select(
+  cardano_coin_selector_impl_t*           coin_selector,
+  const cardano_coin_selection_request_t* request,
+  cardano_utxo_list_t**                   selection,
+  cardano_utxo_list_t**                   remaining_utxo,
+  cardano_transaction_output_list_t**     change_outputs)
+{
+  if ((coin_selector == NULL) || (request == NULL) || (selection == NULL) || (remaining_utxo == NULL) || (change_outputs == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((request->available_utxo == NULL) || (request->target == NULL) || (request->change_address == NULL) || (request->protocol_params == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  // cppcheck-suppress misra-c2012-11.3; Reason: The context is always created as a random_improve_context_t.
+  random_improve_context_t* context = (random_improve_context_t*)((void*)coin_selector->context);
+
+  if (context == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  // The RNG is re-seeded on every call so that repeated invocations from the balancing loop are
+  // reproducible: each fee-convergence iteration sees the same random choices for the same inputs,
+  // allowing the selection to evolve progressively as the target grows instead of being reshuffled.
+  uint64_t rng_state = context->seed;
+
+  cardano_utxo_list_t*               pre_selected_utxo = request->pre_selected_utxo;
+  cardano_utxo_list_t*               available_utxo    = request->available_utxo;
+  cardano_value_t*                   target            = request->target;
+  cardano_transaction_output_list_t* outputs_to_cover  = request->outputs_to_cover;
+  cardano_address_t*                 change_address    = request->change_address;
+  cardano_protocol_parameters_t*     protocol_params   = request->protocol_params;
+
+  *selection      = NULL;
+  *remaining_utxo = NULL;
+  *change_outputs = NULL;
+
+  random_improve_selection_index_t index;
+
+  cardano_error_t result = _cardano_random_improve_index_init(&index, pre_selected_utxo, available_utxo, target);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = run_selection_phase(&index, &rng_state, context->strategy);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_utxo_list_new(selection);
+  }
+
+  // Materialize the selection (pre-selected entries first, then every pick in pick order) so
+  // that the change generation can inspect it; further ada picks are appended incrementally.
+  if (result == CARDANO_SUCCESS)
+  {
+    for (size_t i = 0U; (i < index.pre_selected_count) && (result == CARDANO_SUCCESS); ++i)
+    {
+      result = cardano_utxo_list_add(*selection, index.pool[i]);
+    }
+
+    for (size_t i = 0U; (i < index.pick_count) && (result == CARDANO_SUCCESS); ++i)
+    {
+      result = cardano_utxo_list_add(*selection, index.pool[index.picks[i].pool_index]);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = generate_change_with_retries(
+      &index,
+      &rng_state,
+      *selection,
+      target,
+      outputs_to_cover,
+      change_address,
+      protocol_params,
+      change_outputs);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_utxo_list_new(remaining_utxo);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    for (size_t i = 0U; (i < index.pool_size) && (result == CARDANO_SUCCESS); ++i)
+    {
+      if (!index.pool_selected[i])
+      {
+        result = cardano_utxo_list_add(*remaining_utxo, index.pool[i]);
+      }
+    }
+  }
+
+  _cardano_random_improve_index_free(&index);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    if (*selection != NULL)
+    {
+      cardano_utxo_list_unref(selection);
+    }
+
+    if (*remaining_utxo != NULL)
+    {
+      cardano_utxo_list_unref(remaining_utxo);
+    }
+
+    if (*change_outputs != NULL)
+    {
+      cardano_transaction_output_list_unref(change_outputs);
+    }
+
+    set_insufficient_balance_error(coin_selector);
+  }
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_random_improve_coin_selector_new_with_options(
+  const uint64_t                     seed,
+  const cardano_selection_strategy_t strategy,
+  cardano_coin_selector_t**          coin_selector)
+{
+  if (coin_selector == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  random_improve_context_t* context = (random_improve_context_t*)_cardano_malloc(sizeof(random_improve_context_t));
+
+  if (context == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  context->base.ref_count     = 1;
+  context->base.last_error[0] = '\0';
+  context->base.deallocator   = _cardano_free;
+  context->seed               = seed;
+  context->strategy           = strategy;
+
+  static const char* selector_name = "Random improve coin selector";
+
+  cardano_coin_selector_impl_t impl = { 0 };
+
+  cardano_safe_memcpy(impl.name, 256U, selector_name, cardano_safe_strlen(selector_name, 256U));
+
+  impl.select = random_improve_select;
+  // cppcheck-suppress misra-c2012-11.3; Reason: The context embeds cardano_object_t as its first member.
+  impl.context = (cardano_object_t*)((void*)context);
+
+  cardano_error_t result = cardano_coin_selector_new(impl, coin_selector);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(context);
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_random_improve_coin_selector_new_with_seed(
+  const uint64_t            seed,
+  cardano_coin_selector_t** coin_selector)
+{
+  return cardano_random_improve_coin_selector_new_with_options(seed, CARDANO_SELECTION_STRATEGY_OPTIMAL, coin_selector);
+}
+
+cardano_error_t
+cardano_random_improve_coin_selector_new(cardano_coin_selector_t** coin_selector)
+{
+  if (coin_selector == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *coin_selector = NULL;
+
+  if (sodium_init() == -1)
+  {
+    return CARDANO_ERROR_GENERIC;
+  }
+
+  uint64_t seed = 0U;
+
+  randombytes_buf(&seed, sizeof(seed));
+
+  return cardano_random_improve_coin_selector_new_with_seed(seed, coin_selector);
+}
diff --git a/vendor/src/transaction_builder/coin_selection/internals/random_improve_helpers.c b/vendor/src/transaction_builder/coin_selection/internals/random_improve_helpers.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/random_improve_helpers.c
@@ -0,0 +1,324 @@
+/**
+ * \file random_improve_helpers.c
+ *
+ * \author angel.castillo
+ * \date   Jul 02, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/bigint.h>
+
+#include "./random_improve_helpers.h"
+
+#include "../../../allocators.h"
+
+#include <string.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Computes the quotient and remainder of (a * b) / divisor without overflowing.
+ *
+ * The product of two 64-bit quantities can exceed the range of a 64-bit integer, so the
+ * intermediate product is computed with \ref cardano_bigint_t.
+ *
+ * \param[in]  a         The first factor.
+ * \param[in]  b         The second factor.
+ * \param[in]  divisor   The divisor. Must not be zero.
+ * \param[out] quotient  The resulting quotient.
+ * \param[out] remainder The resulting remainder.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+mul_div_mod(
+  const uint64_t a,
+  const uint64_t b,
+  const uint64_t divisor,
+  uint64_t*      quotient,
+  uint64_t*      remainder)
+{
+  cardano_bigint_t* big_a         = NULL;
+  cardano_bigint_t* big_b         = NULL;
+  cardano_bigint_t* big_divisor   = NULL;
+  cardano_bigint_t* big_product   = NULL;
+  cardano_bigint_t* big_quotient  = NULL;
+  cardano_bigint_t* big_remainder = NULL;
+
+  cardano_error_t result = cardano_bigint_from_unsigned_int(a, &big_a);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_bigint_from_unsigned_int(b, &big_b);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_bigint_from_unsigned_int(divisor, &big_divisor);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_bigint_from_int(0, &big_product);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_bigint_from_int(0, &big_quotient);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_bigint_from_int(0, &big_remainder);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_bigint_multiply(big_a, big_b, big_product);
+    cardano_bigint_divide(big_product, big_divisor, big_quotient);
+    cardano_bigint_mod(big_product, big_divisor, big_remainder);
+
+    *quotient  = cardano_bigint_to_unsigned_int(big_quotient);
+    *remainder = cardano_bigint_to_unsigned_int(big_remainder);
+  }
+
+  cardano_bigint_unref(&big_a);
+  cardano_bigint_unref(&big_b);
+  cardano_bigint_unref(&big_divisor);
+  cardano_bigint_unref(&big_product);
+  cardano_bigint_unref(&big_quotient);
+  cardano_bigint_unref(&big_remainder);
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+uint64_t
+_cardano_random_improve_rng_next(uint64_t* rng_state)
+{
+  *rng_state += 0x9e3779b97f4a7c15ULL;
+
+  uint64_t z = *rng_state;
+
+  z = (z ^ (z >> 30U)) * 0xbf58476d1ce4e5b9ULL;
+  z = (z ^ (z >> 27U)) * 0x94d049bb133111ebULL;
+
+  return z ^ (z >> 31U);
+}
+
+size_t
+_cardano_random_improve_rng_below(uint64_t* rng_state, const size_t bound)
+{
+  return (size_t)(_cardano_random_improve_rng_next(rng_state) % (uint64_t)bound);
+}
+
+uint64_t
+_cardano_random_improve_distance(const uint64_t a, const uint64_t b)
+{
+  uint64_t result = b - a;
+
+  if (a > b)
+  {
+    result = a - b;
+  }
+
+  return result;
+}
+
+cardano_error_t
+_cardano_random_improve_partition(
+  const uint64_t  target,
+  const uint64_t* weights,
+  const size_t    size,
+  uint64_t*       parts)
+{
+  if ((weights == NULL) || (parts == NULL) || (size == 0U))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  uint64_t total_weight = 0U;
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    total_weight += weights[i];
+  }
+
+  if (total_weight == 0U)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  uint64_t* remainders = (uint64_t*)_cardano_malloc(size * sizeof(uint64_t));
+
+  if (remainders == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result   = CARDANO_SUCCESS;
+  uint64_t        assigned = 0U;
+
+  for (size_t i = 0U; (i < size) && (result == CARDANO_SUCCESS); ++i)
+  {
+    result = mul_div_mod(target, weights[i], total_weight, &parts[i], &remainders[i]);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      assigned += parts[i];
+    }
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(remainders);
+
+    return result;
+  }
+
+  uint64_t shortfall = target - assigned;
+
+  while (shortfall > 0U)
+  {
+    size_t best = SIZE_MAX;
+
+    for (size_t i = 0U; i < size; ++i)
+    {
+      if (remainders[i] == 0U)
+      {
+        continue;
+      }
+
+      if ((best == SIZE_MAX) || (remainders[i] > remainders[best]) || ((remainders[i] == remainders[best]) && (parts[i] > parts[best])))
+      {
+        best = i;
+      }
+    }
+
+    if (best == SIZE_MAX)
+    {
+      break;
+    }
+
+    parts[best]      += 1U;
+    remainders[best] = 0U;
+    shortfall        -= 1U;
+  }
+
+  _cardano_free(remainders);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+_cardano_random_improve_pad_coalesce(
+  const uint64_t* quantities,
+  const size_t    size,
+  const size_t    target_size,
+  uint64_t*       result)
+{
+  if ((result == NULL) || (target_size == 0U) || ((quantities == NULL) && (size > 0U)))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  uint64_t* sorted = (uint64_t*)_cardano_malloc(((size > 0U) ? size : 1U) * sizeof(uint64_t));
+
+  if (sorted == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    uint64_t value = quantities[i];
+    size_t   j     = i;
+
+    while ((j > 0U) && (sorted[j - 1U] > value))
+    {
+      sorted[j] = sorted[j - 1U];
+      --j;
+    }
+
+    sorted[j] = value;
+  }
+
+  size_t length = size;
+
+  while (length > target_size)
+  {
+    const uint64_t coalesced = sorted[0] + sorted[1];
+
+    size_t j = 2U;
+
+    while ((j < length) && (sorted[j] < coalesced))
+    {
+      sorted[j - 2U] = sorted[j];
+      ++j;
+    }
+
+    sorted[j - 2U] = coalesced;
+
+    for (size_t k = j; k < length; ++k)
+    {
+      sorted[k - 1U] = sorted[k];
+    }
+
+    --length;
+  }
+
+  const size_t padding = target_size - length;
+
+  for (size_t i = 0U; i < padding; ++i)
+  {
+    result[i] = 0U;
+  }
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    result[padding + i] = sorted[i];
+  }
+
+  _cardano_free(sorted);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+_cardano_random_improve_reduce_quantities(
+  const uint64_t reduction_target,
+  uint64_t*      quantities,
+  const size_t   size)
+{
+  uint64_t remaining = reduction_target;
+
+  for (size_t i = 0U; (i < size) && (remaining > 0U); ++i)
+  {
+    if (quantities[i] >= remaining)
+    {
+      quantities[i] -= remaining;
+      remaining     = 0U;
+    }
+    else
+    {
+      remaining     -= quantities[i];
+      quantities[i] = 0U;
+    }
+  }
+}
diff --git a/vendor/src/transaction_builder/coin_selection/internals/random_improve_helpers.h b/vendor/src/transaction_builder/coin_selection/internals/random_improve_helpers.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/random_improve_helpers.h
@@ -0,0 +1,151 @@
+/**
+ * \file random_improve_helpers.h
+ *
+ * \author angel.castillo
+ * \date   Jul 02, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_HELPERS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_HELPERS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Advances the given SplitMix64 state and returns the next pseudo-random number.
+ *
+ * SplitMix64 is a well-known, statistically strong 64-bit pseudo-random number generator with a
+ * single 64-bit word of state ("Fast Splittable Pseudorandom Number Generators", Steele, Lea and
+ * Flood, OOPSLA 2014; the constants are from Sebastiano Vigna's public domain reference
+ * implementation). It is used by the random improve coin selector because its tiny state makes it
+ * trivial to re-seed deterministically on every selection, which keeps repeated invocations from
+ * the transaction balancing loop reproducible.
+ *
+ * \param[in,out] rng_state The generator state. Updated in place on every call.
+ *
+ * \return The next pseudo-random 64-bit number in the sequence.
+ *
+ * \note This generator is NOT cryptographically secure. It must only be used for input selection
+ *       randomization, never for key material or any security sensitive purpose.
+ */
+uint64_t
+_cardano_random_improve_rng_next(uint64_t* rng_state);
+
+/**
+ * \brief Returns a pseudo-random index in the range [0, bound).
+ *
+ * \param[in,out] rng_state The generator state. Updated in place. See \ref _cardano_random_improve_rng_next.
+ * \param[in]     bound     The exclusive upper bound. Must be greater than zero.
+ *
+ * \return A pseudo-random index in the range [0, bound).
+ *
+ * \note The index is derived by modulo reduction, which introduces a negligible bias for the small
+ *       bounds used during input selection (bounded by the number of UTXOs in a wallet).
+ */
+size_t
+_cardano_random_improve_rng_below(uint64_t* rng_state, size_t bound);
+
+/**
+ * \brief Returns the absolute difference between two quantities.
+ *
+ * This is a port of `distance` from the cardano-coin-selection library. It is used by the
+ * "improve" phase of the selection algorithm to decide whether an additional UTXO moves the
+ * selected quantity closer to its target.
+ *
+ * \param[in] a The first quantity.
+ * \param[in] b The second quantity.
+ *
+ * \return The absolute difference between the two quantities.
+ */
+uint64_t
+_cardano_random_improve_distance(uint64_t a, uint64_t b);
+
+/**
+ * \brief Partitions a target quantity into parts proportional to the given weights.
+ *
+ * This is a port of `partitionNatural` from the cardano-coin-selection library. The result is
+ * computed with the largest-remainder method: each part receives the floor of its ideal
+ * proportional share, and the leftover units are awarded to the parts with the largest
+ * remainders (ties broken by the larger integral part, then by original position).
+ *
+ * The sum of the resulting parts is always exactly equal to the target quantity.
+ *
+ * \param[in]  target  The quantity to partition.
+ * \param[in]  weights The weight of each part.
+ * \param[in]  size    The number of parts. Must be greater than zero.
+ * \param[out] parts   The resulting parts, in the same order as the given weights.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_INVALID_ARGUMENT if the sum
+ *         of the weights is zero.
+ */
+cardano_error_t
+_cardano_random_improve_partition(
+  uint64_t        target,
+  const uint64_t* weights,
+  size_t          size,
+  uint64_t*       parts);
+
+/**
+ * \brief Adjusts a list of quantities to a given length, preserving its sum and ascending order.
+ *
+ * This is a port of `padCoalesce` from the cardano-coin-selection library:
+ *
+ * - The source quantities are first sorted into ascending order.
+ * - If the source is shorter than the target length, zeros are inserted at the start.
+ * - If the source is longer than the target length, the two smallest quantities are repeatedly
+ *   coalesced (summed and re-inserted in sorted position) until the target length is reached.
+ *
+ * \param[in]  quantities     The source quantities.
+ * \param[in]  size           The number of source quantities.
+ * \param[in]  target_size    The desired number of output quantities. Must be greater than zero.
+ * \param[out] result         The resulting quantities, sorted in ascending order.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+cardano_error_t
+_cardano_random_improve_pad_coalesce(
+  const uint64_t* quantities,
+  size_t          size,
+  size_t          target_size,
+  uint64_t*       result);
+
+/**
+ * \brief Reduces the total value of an ascending list of quantities by a reduction target.
+ *
+ * This is a port of `reduceTokenQuantities` from the cardano-coin-selection library. It walks
+ * the list from left to right (smallest first), zeroing out each quantity until the total
+ * reduction is equal to the reduction target, or until the list is exhausted.
+ *
+ * \param[in]     reduction_target The total amount by which to reduce the quantities.
+ * \param[in,out] quantities       The quantities to reduce, sorted in ascending order.
+ * \param[in]     size             The number of quantities.
+ */
+void
+_cardano_random_improve_reduce_quantities(
+  uint64_t  reduction_target,
+  uint64_t* quantities,
+  size_t    size);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_HELPERS_H
diff --git a/vendor/src/transaction_builder/coin_selection/internals/random_improve_selection_index.c b/vendor/src/transaction_builder/coin_selection/internals/random_improve_selection_index.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/random_improve_selection_index.c
@@ -0,0 +1,449 @@
+/**
+ * \file random_improve_selection_index.c
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id_map.h>
+
+#include "./random_improve_selection_index.h"
+
+#include "../../../allocators.h"
+#include "./random_improve_change_state.h"
+#include "./random_improve_helpers.h"
+#include "./random_improve_utxo_utils.h"
+
+#include <string.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Appends a pool entry index to a bucket, growing its storage as needed.
+ *
+ * \param[in,out] bucket The bucket to append to.
+ * \param[in]     entry  The pool entry index to append.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+bucket_append(selection_index_bucket_t* bucket, const size_t entry)
+{
+  if (bucket->size == bucket->capacity)
+  {
+    const size_t new_capacity = (bucket->capacity == 0U) ? 8U : (bucket->capacity * 2U);
+    size_t*      new_items    = (size_t*)_cardano_malloc(new_capacity * sizeof(size_t));
+
+    if (new_items == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    for (size_t i = 0U; i < bucket->size; ++i)
+    {
+      new_items[i] = bucket->items[i];
+    }
+
+    _cardano_free(bucket->items);
+
+    bucket->items    = new_items;
+    bucket->capacity = new_capacity;
+  }
+
+  bucket->items[bucket->size] = entry;
+  ++bucket->size;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Records a pick on the undo stack, growing its storage as needed.
+ *
+ * \param[in,out] index           The selection index.
+ * \param[in]     pool_index      The picked pool entry.
+ * \param[in]     processor_index The processor the pick was made for.
+ * \param[in]     tier            The bucket tier the entry was picked from.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+record_pick(
+  random_improve_selection_index_t* index,
+  const size_t                      pool_index,
+  const size_t                      processor_index,
+  const size_t                      tier)
+{
+  if (index->pick_count == index->pick_capacity)
+  {
+    const size_t            new_capacity = (index->pick_capacity == 0U) ? 8U : (index->pick_capacity * 2U);
+    selection_index_pick_t* new_picks    = (selection_index_pick_t*)_cardano_malloc(new_capacity * sizeof(selection_index_pick_t));
+
+    if (new_picks == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    for (size_t i = 0U; i < index->pick_count; ++i)
+    {
+      new_picks[i] = index->picks[i];
+    }
+
+    _cardano_free(index->picks);
+
+    index->picks         = new_picks;
+    index->pick_capacity = new_capacity;
+  }
+
+  index->picks[index->pick_count].pool_index      = pool_index;
+  index->picks[index->pick_count].processor_index = processor_index;
+  index->picks[index->pick_count].tier            = tier;
+
+  ++index->pick_count;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Returns the cached quantity of a processor's asset held by a pool entry.
+ *
+ * \param[in] index           The selection index.
+ * \param[in] pool_index      The pool entry.
+ * \param[in] processor_index The processor whose asset quantity to read.
+ *
+ * \return The cached quantity.
+ */
+static int64_t
+pool_quantity(
+  const random_improve_selection_index_t* index,
+  const size_t                            pool_index,
+  const size_t                            processor_index)
+{
+  return index->pool_quantities[(pool_index * index->processor_count) + processor_index];
+}
+
+/**
+ * \brief Applies a pick or an undo to every processor's running total.
+ *
+ * \param[in,out] index      The selection index.
+ * \param[in]     pool_index The pool entry being selected or deselected.
+ * \param[in]     selected   True when selecting the entry, false when deselecting it.
+ */
+static void
+apply_to_totals(random_improve_selection_index_t* index, const size_t pool_index, const bool selected)
+{
+  for (size_t p = 0U; p < index->processor_count; ++p)
+  {
+    const int64_t quantity = pool_quantity(index, pool_index, p);
+
+    if (quantity > 0)
+    {
+      if (selected)
+      {
+        index->processors[p].selected_total += (uint64_t)quantity;
+      }
+      else
+      {
+        index->processors[p].selected_total -= (uint64_t)quantity;
+      }
+    }
+  }
+}
+
+/**
+ * \brief Caches the asset count and per-processor quantities of a pool entry, and seeds the
+ * buckets of every processor whose asset the entry holds.
+ *
+ * \param[in,out] index      The selection index.
+ * \param[in]     pool_index The pool entry to register.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+register_pool_entry(random_improve_selection_index_t* index, const size_t pool_index)
+{
+  cardano_utxo_t*  utxo  = index->pool[pool_index];
+  cardano_value_t* value = _cardano_random_improve_borrow_utxo_value(utxo);
+
+  cardano_asset_id_map_t* assets = cardano_value_as_assets_map(value);
+
+  if (assets == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const size_t asset_count = cardano_asset_id_map_get_length(assets);
+
+  cardano_asset_id_map_unref(&assets);
+
+  index->pool_asset_counts[pool_index] = asset_count;
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t p = 0U; (p < index->processor_count) && (result == CARDANO_SUCCESS); ++p)
+  {
+    int64_t quantity = 0;
+
+    if (index->processors[p].asset_id == NULL)
+    {
+      quantity = cardano_value_get_coin(value);
+    }
+    else
+    {
+      quantity = _cardano_random_improve_get_asset_quantity(value, index->processors[p].asset_id);
+    }
+
+    index->pool_quantities[(pool_index * index->processor_count) + p] = quantity;
+
+    if (quantity > 0)
+    {
+      size_t tier = 2U;
+
+      if (asset_count == 1U)
+      {
+        tier = 0U;
+      }
+      else if (asset_count == 2U)
+      {
+        tier = 1U;
+      }
+      else
+      {
+        tier = 2U;
+      }
+
+      result = bucket_append(&index->processors[p].buckets[tier], pool_index);
+
+      if ((result == CARDANO_SUCCESS) && (tier != 2U))
+      {
+        // Every entry is also a candidate of the lowest-priority tier, so that picks can fall
+        // back to it when the preferred tiers are exhausted.
+        result = bucket_append(&index->processors[p].buckets[2], pool_index);
+      }
+    }
+  }
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+_cardano_random_improve_index_init(
+  random_improve_selection_index_t* index,
+  cardano_utxo_list_t*              pre_selected_utxo,
+  cardano_utxo_list_t*              available_utxo,
+  cardano_value_t*                  target)
+{
+  CARDANO_UNUSED(memset(index, 0, sizeof(*index)));
+
+  const size_t pre_count       = (pre_selected_utxo != NULL) ? cardano_utxo_list_get_length(pre_selected_utxo) : 0U;
+  const size_t available_count = cardano_utxo_list_get_length(available_utxo);
+
+  index->pool_size          = pre_count + available_count;
+  index->pre_selected_count = pre_count;
+
+  // Build the processors: one per asset required by the target, plus lovelace last.
+  random_improve_asset_table_t required_assets = { NULL, 0U, 0U };
+
+  cardano_error_t result = _cardano_random_improve_asset_table_add_value_assets(&required_assets, target);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    index->processors = (selection_index_processor_t*)_cardano_malloc((required_assets.size + 1U) * sizeof(selection_index_processor_t));
+
+    if (index->processors == NULL)
+    {
+      result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+    else
+    {
+      CARDANO_UNUSED(memset(index->processors, 0, (required_assets.size + 1U) * sizeof(selection_index_processor_t)));
+
+      for (size_t a = 0U; a < required_assets.size; ++a)
+      {
+        const int64_t required = _cardano_random_improve_get_asset_quantity(target, required_assets.ids[a]);
+
+        if (required > 0)
+        {
+          cardano_asset_id_ref(required_assets.ids[a]);
+
+          index->processors[index->processor_count].asset_id = required_assets.ids[a];
+          index->processors[index->processor_count].minimum  = (uint64_t)required;
+          index->processors[index->processor_count].active   = true;
+
+          ++index->processor_count;
+        }
+      }
+
+      const int64_t target_coin = cardano_value_get_coin(target);
+
+      index->processors[index->processor_count].asset_id = NULL;
+      index->processors[index->processor_count].minimum  = (target_coin > 0) ? (uint64_t)target_coin : 0U;
+      index->processors[index->processor_count].active   = true;
+
+      ++index->processor_count;
+    }
+  }
+
+  _cardano_random_improve_asset_table_free(&required_assets);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    const size_t pool_size = (index->pool_size > 0U) ? index->pool_size : 1U;
+
+    index->pool              = (cardano_utxo_t**)_cardano_malloc(pool_size * sizeof(cardano_utxo_t*));
+    index->pool_asset_counts = (size_t*)_cardano_malloc(pool_size * sizeof(size_t));
+    index->pool_selected     = (bool*)_cardano_malloc(pool_size * sizeof(bool));
+    index->pool_quantities   = (int64_t*)_cardano_malloc(pool_size * index->processor_count * sizeof(int64_t));
+
+    if (index->pool != NULL)
+    {
+      CARDANO_UNUSED(memset(index->pool, 0, pool_size * sizeof(cardano_utxo_t*)));
+    }
+
+    if (index->pool_selected != NULL)
+    {
+      CARDANO_UNUSED(memset(index->pool_selected, 0, pool_size * sizeof(bool)));
+    }
+
+    if ((index->pool == NULL) || (index->pool_asset_counts == NULL) || (index->pool_selected == NULL) || (index->pool_quantities == NULL))
+    {
+      result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  for (size_t i = 0U; (i < index->pool_size) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_utxo_t*      utxo   = NULL;
+    cardano_utxo_list_t* source = (i < pre_count) ? pre_selected_utxo : available_utxo;
+    const size_t         offset = (i < pre_count) ? i : (i - pre_count);
+
+    result = cardano_utxo_list_get(source, offset, &utxo);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      index->pool[i] = utxo;
+
+      result = register_pool_entry(index, i);
+    }
+  }
+
+  // Mark the pre-selected entries as selected and seed the running totals with their contents.
+  for (size_t i = 0U; (i < pre_count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    index->pool_selected[i] = true;
+
+    apply_to_totals(index, i, true);
+  }
+
+  return result;
+}
+
+void
+_cardano_random_improve_index_free(random_improve_selection_index_t* index)
+{
+  if (index->pool != NULL)
+  {
+    for (size_t i = 0U; i < index->pool_size; ++i)
+    {
+      cardano_utxo_unref(&index->pool[i]);
+    }
+  }
+
+  for (size_t p = 0U; p < index->processor_count; ++p)
+  {
+    cardano_asset_id_unref(&index->processors[p].asset_id);
+
+    for (size_t t = 0U; t < 3U; ++t)
+    {
+      _cardano_free(index->processors[p].buckets[t].items);
+    }
+  }
+
+  _cardano_free(index->pool);
+  _cardano_free(index->pool_asset_counts);
+  _cardano_free(index->pool_selected);
+  _cardano_free(index->pool_quantities);
+  _cardano_free(index->processors);
+  _cardano_free(index->picks);
+
+  CARDANO_UNUSED(memset(index, 0, sizeof(*index)));
+}
+
+bool
+_cardano_random_improve_index_pick(
+  random_improve_selection_index_t* index,
+  uint64_t*                         rng_state,
+  const size_t                      processor_index)
+{
+  selection_index_processor_t* processor = &index->processors[processor_index];
+
+  for (size_t tier = 0U; tier < 3U; ++tier)
+  {
+    selection_index_bucket_t* bucket = &processor->buckets[tier];
+
+    while (bucket->size > 0U)
+    {
+      const size_t slot  = _cardano_random_improve_rng_below(rng_state, bucket->size);
+      const size_t entry = bucket->items[slot];
+
+      // Lazy deletion: remove the slot regardless. If the entry turns out to be selectable it
+      // is recorded on the pick stack (and restored on undo); if it was already selected by
+      // another requirement it is simply dropped from this bucket.
+      bucket->items[slot] = bucket->items[bucket->size - 1U];
+      --bucket->size;
+
+      if (!index->pool_selected[entry])
+      {
+        if (record_pick(index, entry, processor_index, tier) != CARDANO_SUCCESS)
+        {
+          return false;
+        }
+
+        index->pool_selected[entry] = true;
+
+        apply_to_totals(index, entry, true);
+
+        return true;
+      }
+    }
+  }
+
+  return false;
+}
+
+void
+_cardano_random_improve_index_undo_last_pick(random_improve_selection_index_t* index)
+{
+  if (index->pick_count == 0U)
+  {
+    return;
+  }
+
+  --index->pick_count;
+
+  const selection_index_pick_t pick = index->picks[index->pick_count];
+
+  index->pool_selected[pick.pool_index] = false;
+
+  apply_to_totals(index, pick.pool_index, false);
+
+  // Return the entry to the bucket it was picked from so it remains a candidate.
+  CARDANO_UNUSED(bucket_append(&index->processors[pick.processor_index].buckets[pick.tier], pick.pool_index));
+}
diff --git a/vendor/src/transaction_builder/coin_selection/internals/random_improve_selection_index.h b/vendor/src/transaction_builder/coin_selection/internals/random_improve_selection_index.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/random_improve_selection_index.h
@@ -0,0 +1,160 @@
+/**
+ * \file random_improve_selection_index.h
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_SELECTION_INDEX_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_SELECTION_INDEX_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/common/utxo.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/transaction_body/value.h>
+#include <cardano/typedefs.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief A growable list of pool entry indices, used as a selection bucket.
+ *
+ * Buckets use lazy deletion: entries that have already been selected by another requirement are
+ * skipped (and removed) when encountered during a pick.
+ */
+typedef struct selection_index_bucket_t
+{
+    size_t* items;
+    size_t  size;
+    size_t  capacity;
+} selection_index_bucket_t;
+
+/**
+ * \brief A selection requirement tracked by the index: one per required asset, plus one for
+ * lovelace (with a NULL asset id), which is placed last.
+ *
+ * The three buckets hold candidate pool entries by priority tier (port of the reference
+ * implementation's SelectSingleton / SelectPairWith / SelectAnyWith filters): entries whose
+ * total asset count (lovelace included) is exactly one, exactly two, and any, respectively.
+ */
+typedef struct selection_index_processor_t
+{
+    cardano_asset_id_t*      asset_id;
+    uint64_t                 minimum;
+    bool                     active;
+    uint64_t                 selected_total;
+    selection_index_bucket_t buckets[3];
+} selection_index_processor_t;
+
+/**
+ * \brief A single pick, recorded so that it can be undone by the improvement step.
+ */
+typedef struct selection_index_pick_t
+{
+    size_t pool_index;
+    size_t processor_index;
+    size_t tier;
+} selection_index_pick_t;
+
+/**
+ * \brief A per-selection index over the available UTXO pool, providing constant-time selected
+ * quantity queries and cheap randomized picks by priority tier.
+ *
+ * The index caches, for every pool entry, its total asset count and its quantity of every
+ * requirement's asset, so that the selection loop never re-derives asset maps from values.
+ * Picks record their origin so that the most recent pick can be undone.
+ */
+typedef struct random_improve_selection_index_t
+{
+    cardano_utxo_t**             pool;
+    size_t*                      pool_asset_counts;
+    bool*                        pool_selected;
+    int64_t*                     pool_quantities;
+    size_t                       pool_size;
+    size_t                       pre_selected_count;
+    selection_index_processor_t* processors;
+    size_t                       processor_count;
+    selection_index_pick_t*      picks;
+    size_t                       pick_count;
+    size_t                       pick_capacity;
+} random_improve_selection_index_t;
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Initializes the selection index for a target and a UTXO pool.
+ *
+ * Builds one processor per asset required by the target (plus a final one for lovelace),
+ * caches every pool entry's asset count and per-requirement quantities, seeds the priority
+ * buckets, marks the pre-selected entries as selected and initializes the running totals
+ * with their contents.
+ *
+ * \param[out] index             The index to initialize.
+ * \param[in]  pre_selected_utxo The pre-selected UTXOs, or NULL.
+ * \param[in]  available_utxo    The available UTXO pool.
+ * \param[in]  target            The target value the selection must cover.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code. On failure the index
+ *         is safe to pass to \ref _cardano_random_improve_index_free.
+ */
+cardano_error_t
+_cardano_random_improve_index_init(
+  random_improve_selection_index_t* index,
+  cardano_utxo_list_t*              pre_selected_utxo,
+  cardano_utxo_list_t*              available_utxo,
+  cardano_value_t*                  target);
+
+/**
+ * \brief Frees all buffers held by the index and releases its UTXO references.
+ *
+ * \param[in,out] index The index to free.
+ */
+void
+_cardano_random_improve_index_free(random_improve_selection_index_t* index);
+
+/**
+ * \brief Picks a random unselected pool entry for the given processor, preferring entries with
+ * fewer assets (priority tiers: singleton, pair, any).
+ *
+ * On success the entry is marked as selected, every processor's running total is updated, and
+ * the pick is recorded so that it can be undone.
+ *
+ * \param[in,out] index           The selection index.
+ * \param[in,out] rng_state       The random number generator state.
+ * \param[in]     processor_index The processor to pick for.
+ *
+ * \return true if an entry was picked, false if no unselected entry holds the processor's asset.
+ */
+bool
+_cardano_random_improve_index_pick(
+  random_improve_selection_index_t* index,
+  uint64_t*                         rng_state,
+  size_t                            processor_index);
+
+/**
+ * \brief Undoes the most recent pick: unmarks the entry, restores the running totals and
+ * returns the entry to the bucket it was picked from.
+ *
+ * \param[in,out] index The selection index.
+ */
+void
+_cardano_random_improve_index_undo_last_pick(random_improve_selection_index_t* index);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_SELECTION_INDEX_H
diff --git a/vendor/src/transaction_builder/coin_selection/internals/random_improve_utxo_utils.c b/vendor/src/transaction_builder/coin_selection/internals/random_improve_utxo_utils.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/random_improve_utxo_utils.c
@@ -0,0 +1,122 @@
+/**
+ * \file random_improve_utxo_utils.c
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id_map.h>
+#include <cardano/assets/multi_asset.h>
+
+#include "./random_improve_utxo_utils.h"
+
+#include "../../../allocators.h"
+
+#include <string.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/* DEFINITIONS ****************************************************************/
+
+int64_t
+_cardano_random_improve_get_asset_quantity(cardano_value_t* value, cardano_asset_id_t* asset_id)
+{
+  cardano_multi_asset_t* multi_asset = cardano_value_get_multi_asset(value);
+  cardano_multi_asset_unref(&multi_asset);
+
+  if (multi_asset == NULL)
+  {
+    return 0;
+  }
+
+  int64_t quantity = 0;
+
+  if (cardano_multi_asset_get_with_id(multi_asset, asset_id, &quantity) != CARDANO_SUCCESS)
+  {
+    return 0;
+  }
+
+  return quantity;
+}
+
+cardano_value_t*
+_cardano_random_improve_borrow_utxo_value(cardano_utxo_t* utxo)
+{
+  cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+  cardano_value_t*              value  = cardano_transaction_output_get_value(output);
+
+  cardano_transaction_output_unref(&output);
+  cardano_value_unref(&value);
+
+  return value;
+}
+
+bool
+_cardano_random_improve_asset_id_equals(cardano_asset_id_t* lhs, cardano_asset_id_t* rhs)
+{
+  const char* lhs_hex = cardano_asset_id_get_hex(lhs);
+  const char* rhs_hex = cardano_asset_id_get_hex(rhs);
+
+  if ((lhs_hex == NULL) || (rhs_hex == NULL))
+  {
+    return false;
+  }
+
+  return strcmp(lhs_hex, rhs_hex) == 0;
+}
+
+uint64_t
+_cardano_random_improve_selected_quantity(cardano_utxo_list_t* selection, cardano_asset_id_t* asset_id)
+{
+  uint64_t total = 0U;
+
+  const size_t size = cardano_utxo_list_get_length(selection);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    if (cardano_utxo_list_get(selection, i, &utxo) != CARDANO_SUCCESS)
+    {
+      continue;
+    }
+
+    cardano_utxo_unref(&utxo);
+
+    cardano_value_t* value = _cardano_random_improve_borrow_utxo_value(utxo);
+
+    int64_t quantity = 0;
+
+    if (asset_id == NULL)
+    {
+      quantity = cardano_value_get_coin(value);
+    }
+    else
+    {
+      quantity = _cardano_random_improve_get_asset_quantity(value, asset_id);
+    }
+
+    if (quantity > 0)
+    {
+      total += (uint64_t)quantity;
+    }
+  }
+
+  return total;
+}
diff --git a/vendor/src/transaction_builder/coin_selection/internals/random_improve_utxo_utils.h b/vendor/src/transaction_builder/coin_selection/internals/random_improve_utxo_utils.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/random_improve_utxo_utils.h
@@ -0,0 +1,79 @@
+/**
+ * \file random_improve_utxo_utils.h
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_UTXO_UTILS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_UTXO_UTILS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/common/utxo.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/transaction_body/value.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Returns the quantity of the given asset in the given value (0 if absent).
+ *
+ * \param[in] value    The value to inspect.
+ * \param[in] asset_id The asset to look up.
+ *
+ * \return The quantity of the asset, or 0 if the value does not contain the asset.
+ */
+int64_t
+_cardano_random_improve_get_asset_quantity(cardano_value_t* value, cardano_asset_id_t* asset_id);
+
+/**
+ * \brief Returns the value of the output of the given UTXO as a borrowed reference.
+ *
+ * \param[in] utxo The UTXO whose output value to borrow.
+ *
+ * \return A borrowed pointer to the value; valid while the UTXO is alive.
+ */
+cardano_value_t*
+_cardano_random_improve_borrow_utxo_value(cardano_utxo_t* utxo);
+
+/**
+ * \brief Indicates whether two asset ids identify the same asset.
+ *
+ * \param[in] lhs The first asset id.
+ * \param[in] rhs The second asset id.
+ *
+ * \return true if both ids refer to the same policy and asset name, false otherwise.
+ */
+bool
+_cardano_random_improve_asset_id_equals(cardano_asset_id_t* lhs, cardano_asset_id_t* rhs);
+
+/**
+ * \brief Returns the total selected quantity of the given asset (NULL asset id = lovelace).
+ *
+ * \param[in] selection The list of selected UTXOs.
+ * \param[in] asset_id  The asset to total, or NULL for lovelace.
+ *
+ * \return The total quantity of the asset across all selected UTXOs.
+ */
+uint64_t
+_cardano_random_improve_selected_quantity(cardano_utxo_list_t* selection, cardano_asset_id_t* asset_id);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_RANDOM_IMPROVE_UTXO_UTILS_H
diff --git a/vendor/src/transaction_builder/coin_selection/internals/value_splitting.c b/vendor/src/transaction_builder/coin_selection/internals/value_splitting.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/value_splitting.c
@@ -0,0 +1,394 @@
+/**
+ * \file value_splitting.c
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/assets/asset_id_map.h>
+#include <cardano/cbor/cbor_writer.h>
+
+#include "./value_splitting.h"
+
+#include "../../../allocators.h"
+
+#include <string.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Appends a value to a part list, taking ownership of the reference.
+ *
+ * \param[in,out] parts The list to append to. Reallocated as needed.
+ * \param[in]     value The value to append.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code (in which case
+ *         ownership of the value is NOT taken).
+ */
+static cardano_error_t
+part_list_append(cardano_value_part_list_t* parts, cardano_value_t* value)
+{
+  if (parts->size == parts->capacity)
+  {
+    const size_t      new_capacity = (parts->capacity == 0U) ? 4U : (parts->capacity * 2U);
+    cardano_value_t** new_items    = (cardano_value_t**)_cardano_malloc(new_capacity * sizeof(cardano_value_t*));
+
+    if (new_items == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    for (size_t i = 0U; i < parts->size; ++i)
+    {
+      new_items[i] = parts->items[i];
+    }
+
+    _cardano_free(parts->items);
+
+    parts->items    = new_items;
+    parts->capacity = new_capacity;
+  }
+
+  parts->items[parts->size] = value;
+  ++parts->size;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Removes and returns the last value of a part list.
+ *
+ * \param[in,out] parts The list to pop from. Must not be empty.
+ *
+ * \return The removed value. Ownership passes to the caller.
+ */
+static cardano_value_t*
+part_list_pop(cardano_value_part_list_t* parts)
+{
+  --parts->size;
+
+  return parts->items[parts->size];
+}
+
+/**
+ * \brief Builds a value holding the given slice of another value's assets, with a zero coin.
+ *
+ * \param[in]  assets The flattened asset map of the source value.
+ * \param[in]  start  The index of the first asset to include.
+ * \param[in]  end    The index one past the last asset to include.
+ * \param[out] value  The resulting asset-only value.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+build_asset_slice(
+  cardano_asset_id_map_t* assets,
+  const size_t            start,
+  const size_t            end,
+  cardano_value_t**       value)
+{
+  *value = cardano_value_new_zero();
+
+  if (*value == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = start; (i < end) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_asset_id_t* asset_id = NULL;
+
+    result = cardano_asset_id_map_get_key_at(assets, i, &asset_id);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      if (!cardano_asset_id_is_lovelace(asset_id))
+      {
+        int64_t quantity = 0;
+
+        result = cardano_asset_id_map_get(assets, asset_id, &quantity);
+
+        if ((result == CARDANO_SUCCESS) && (quantity != 0))
+        {
+          result = cardano_value_add_asset_with_id(*value, asset_id, quantity);
+        }
+      }
+
+      cardano_asset_id_unref(&asset_id);
+    }
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(value);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Splits an asset-only value in half, appending both halves to the pending list.
+ *
+ * \param[in]     value   The asset-only value to split. Released by this function.
+ * \param[in,out] pending The list receiving the two halves.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+static cardano_error_t
+split_in_half(cardano_value_t* value, cardano_value_part_list_t* pending)
+{
+  cardano_asset_id_map_t* assets = cardano_value_as_assets_map(value);
+
+  if (assets == NULL)
+  {
+    cardano_value_unref(&value);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const size_t asset_count = cardano_asset_id_map_get_length(assets);
+  const size_t half        = asset_count / 2U;
+
+  cardano_value_t* first_half  = NULL;
+  cardano_value_t* second_half = NULL;
+
+  cardano_error_t result = build_asset_slice(assets, 0U, half, &first_half);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = build_asset_slice(assets, half, asset_count, &second_half);
+  }
+
+  cardano_asset_id_map_unref(&assets);
+  cardano_value_unref(&value);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = part_list_append(pending, first_half);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&first_half);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = part_list_append(pending, second_half);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_value_unref(&second_half);
+      second_half = NULL;
+    }
+  }
+
+  if ((result != CARDANO_SUCCESS) && (second_half != NULL) && (first_half != NULL))
+  {
+    cardano_value_unref(&second_half);
+  }
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+void
+_cardano_coin_selection_value_parts_free(cardano_value_part_list_t* parts)
+{
+  for (size_t i = 0U; i < parts->size; ++i)
+  {
+    cardano_value_unref(&parts->items[i]);
+  }
+
+  _cardano_free(parts->items);
+
+  parts->items    = NULL;
+  parts->size     = 0U;
+  parts->capacity = 0U;
+}
+
+cardano_error_t
+_cardano_coin_selection_value_is_oversized(
+  cardano_value_t* value,
+  const uint64_t   max_value_size,
+  bool*            is_oversized)
+{
+  // The largest ada quantity that can appear in a transaction output: the total lovelace
+  // supply (45 billion ada). Used to assess sizes conservatively before the final ada
+  // quantity of a change output is known.
+  static const int64_t max_output_ada_quantity = 45000000000000000;
+
+  if ((value == NULL) || (is_oversized == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *is_oversized = false;
+
+  if (max_value_size == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  const int64_t original_coin = cardano_value_get_coin(value);
+
+  cardano_error_t result = cardano_value_set_coin(value, max_output_ada_quantity);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    const cardano_error_t rollback_result = cardano_value_set_coin(value, original_coin);
+    CARDANO_UNUSED(rollback_result);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_value_to_cbor(value, writer);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *is_oversized = cardano_cbor_writer_get_encode_size(writer) > max_value_size;
+  }
+
+  cardano_cbor_writer_unref(&writer);
+
+  const cardano_error_t restore_result = cardano_value_set_coin(value, original_coin);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = restore_result;
+  }
+
+  return result;
+}
+
+cardano_error_t
+_cardano_coin_selection_split_value_assets(
+  cardano_value_t*           value,
+  const uint64_t             max_value_size,
+  cardano_value_part_list_t* parts)
+{
+  if ((value == NULL) || (parts == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_map_t* assets = cardano_value_as_assets_map(value);
+
+  if (assets == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const size_t asset_count = cardano_asset_id_map_get_length(assets);
+
+  cardano_value_t* asset_only = NULL;
+
+  cardano_error_t result = build_asset_slice(assets, 0U, asset_count, &asset_only);
+
+  cardano_asset_id_map_unref(&assets);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  // Work through a pending stack instead of recursing: pop a candidate, and either accept it
+  // as a final part or split it in half and push both halves back for re-assessment.
+  cardano_value_part_list_t pending = { NULL, 0U, 0U };
+
+  result = part_list_append(&pending, asset_only);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_value_unref(&asset_only);
+  }
+
+  while ((result == CARDANO_SUCCESS) && (pending.size > 0U))
+  {
+    cardano_value_t* candidate = part_list_pop(&pending);
+
+    bool is_oversized = false;
+
+    result = _cardano_coin_selection_value_is_oversized(candidate, max_value_size, &is_oversized);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      size_t candidate_assets = 0U;
+
+      if (is_oversized)
+      {
+        cardano_asset_id_map_t* candidate_map = cardano_value_as_assets_map(candidate);
+
+        if (candidate_map == NULL)
+        {
+          result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+        else
+        {
+          candidate_assets = cardano_asset_id_map_get_length(candidate_map);
+
+          cardano_asset_id_map_unref(&candidate_map);
+        }
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        if (is_oversized && (candidate_assets >= 2U))
+        {
+          result    = split_in_half(candidate, &pending);
+          candidate = NULL;
+        }
+        else
+        {
+          result = part_list_append(parts, candidate);
+
+          if (result == CARDANO_SUCCESS)
+          {
+            candidate = NULL;
+          }
+        }
+      }
+    }
+
+    if (candidate != NULL)
+    {
+      cardano_value_unref(&candidate);
+    }
+  }
+
+  _cardano_coin_selection_value_parts_free(&pending);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_coin_selection_value_parts_free(parts);
+  }
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/coin_selection/internals/value_splitting.h b/vendor/src/transaction_builder/coin_selection/internals/value_splitting.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/coin_selection/internals/value_splitting.h
@@ -0,0 +1,102 @@
+/**
+ * \file value_splitting.h
+ *
+ * \author angel.castillo
+ * \date   Jul 03, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VALUE_SPLITTING_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VALUE_SPLITTING_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/transaction_body/value.h>
+#include <cardano/typedefs.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief A growable list of values, used to return the parts of a split value.
+ */
+typedef struct cardano_value_part_list_t
+{
+    cardano_value_t** items;
+    size_t            size;
+    size_t            capacity;
+} cardano_value_part_list_t;
+
+/* DECLARATIONS **************************************************************/
+
+/**
+ * \brief Releases every value held by the part list and frees its storage.
+ *
+ * \param[in,out] parts The list to free. Reset to an empty list.
+ */
+void
+_cardano_coin_selection_value_parts_free(cardano_value_part_list_t* parts);
+
+/**
+ * \brief Indicates whether a value would exceed the maximum serialized size of a transaction
+ * output value.
+ *
+ * The size is assessed conservatively: the value is measured with the largest possible ada
+ * quantity (the total lovelace supply), since the final ada quantity of a change output is
+ * not known until coins are assigned. This mirrors the reference implementation, which prefers
+ * over-splitting to producing an output that is marginally over the limit.
+ *
+ * \param[in]  value          The value to assess.
+ * \param[in]  max_value_size The protocol maximum serialized size of an output value, in bytes.
+ *                            A value of zero means "no limit" and always assesses as within limits.
+ * \param[out] is_oversized   Set to true if the serialized size exceeds the maximum.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+cardano_error_t
+_cardano_coin_selection_value_is_oversized(
+  cardano_value_t* value,
+  uint64_t         max_value_size,
+  bool*            is_oversized);
+
+/**
+ * \brief Splits the assets of a value into the minimum number of groups needed for every group
+ * to fit within the maximum serialized size of a transaction output value.
+ *
+ * This is a port of `splitBundlesWithExcessiveAssetCounts` from the cardano-coin-selection
+ * library: an oversized value has its assets equipartitioned into halves until every resulting
+ * part is within the limit. The coin quantity of the input value is not distributed; every
+ * returned part has a coin quantity of zero, and callers are expected to assign ada quantities
+ * afterwards (typically the min-ADA requirement plus a share of the change).
+ *
+ * The concatenation of the parts' assets is always exactly equal to the assets of the input value.
+ *
+ * \param[in]     value          The value whose assets to split.
+ * \param[in]     max_value_size The protocol maximum serialized size of an output value, in bytes.
+ *                               A value of zero means "no limit"; a single part is returned.
+ * \param[in,out] parts          The list receiving the parts. Must be zero-initialized by the
+ *                               caller and released with \ref _cardano_coin_selection_value_parts_free.
+ *                               Always holds at least one part on success.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+cardano_error_t
+_cardano_coin_selection_split_value_assets(
+  cardano_value_t*           value,
+  uint64_t                   max_value_size,
+  cardano_value_part_list_t* parts);
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VALUE_SPLITTING_H
diff --git a/vendor/src/transaction_builder/evaluation/emscripten_tx_evaluator.c b/vendor/src/transaction_builder/evaluation/emscripten_tx_evaluator.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/evaluation/emscripten_tx_evaluator.c
@@ -0,0 +1,250 @@
+/**
+ * \file emscripten_tx_evaluator.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2025
+ *
+ * Copyright 2025 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef __EMSCRIPTEN__
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/transaction_builder/evaluation/tx_evaluator.h>
+#include <emscripten.h>
+
+#include "../../allocators.h"
+#include "../../string_safe.h"
+
+#include <stdio.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Context for the JavaScript transaction evaluator implementation.
+ */
+typedef struct emscripten_tx_evaluator_context_t
+{
+    cardano_object_t base;
+    uint32_t         object_id;
+    char             name[256];
+} emscripten_tx_evaluator_context_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Creates a new JavaScript transaction evaluator context.
+ *
+ * \return A pointer to the newly created context, or NULL if allocation failed.
+ */
+static emscripten_tx_evaluator_context_t*
+emscripten_tx_evaluator_context_new(const uint32_t object_id)
+{
+  emscripten_tx_evaluator_context_t* context = (emscripten_tx_evaluator_context_t*)_cardano_malloc(sizeof(emscripten_tx_evaluator_context_t));
+
+  if (context == NULL)
+  {
+    return NULL;
+  }
+
+  context->base.ref_count     = 1;
+  context->base.last_error[0] = '\0';
+  context->base.deallocator   = _cardano_free;
+  context->object_id          = object_id;
+
+  return context;
+}
+
+/* JAVASCRIPT INTERFACE *****************************************************/
+
+/**
+ * @brief Retrieves a JavaScript tx_evaluator object from a central registry.
+ *
+ * This function is called from C to get a handle to a JavaScript object that
+ * implements the tx_evaluator interface.
+ *
+ * @param[in] object_id The unique ID for the registered tx_evaluator object.
+ * @return A handle to the JavaScript tx_evaluator object, or `null` if not found.
+ */
+extern void* get_tx_evaluator_from_registry(uint32_t object_id);
+
+/**
+ * @brief Reports an exception from the C provider layer back to the JavaScript side.
+ *
+ * This function is implemented in JavaScript and imported into the C/WASM module. It
+ * serves as a bridge to pass an error that occurred within a C provider's asynchronous
+ * operation back to the JavaScript error handling system.
+ *
+ * @param object_id The unique identifier of the JavaScript provider instance that
+ * initiated the operation.
+ * @param exception A pointer to an object or string containing the details of the
+ * exception.
+ */
+extern void report_tx_evaluator_bridge_error(uint32_t object_id, void* exception);
+
+/**
+ * @brief Marshals a C `cardano_transaction_t` into its CBOR representation as a JavaScript hex string.
+ *
+ * @param[in] tx_ptr A pointer to a `cardano_transaction_t` object in WASM memory.
+ * @return A handle to a JavaScript hex string of the transaction's CBOR.
+ */
+extern void* marshall_transaction_to_cbor_hex(void* tx_ptr);
+
+/**
+ * @brief Marshals a C `cardano_utxo_list_t` into a JavaScript array of UTXO objects.
+ *
+ * This is useful for passing complex C structures to JS functions that expect plain objects,
+ * like in `evaluate_transaction`.
+ *
+ * @param[in] utxo_list_ptr A pointer to a `cardano_utxo_list_t` object in WASM memory.
+ * @return A handle to a JavaScript array of UTXO objects.
+ */
+extern void* marshall_utxo_list_to_js(void* utxo_list_ptr);
+
+/**
+ * @brief Marshals a JavaScript array of redeemer objects into a C `cardano_redeemer_list_t`.
+ *
+ * @param[in] js_redeemer_list_obj A handle to a JavaScript array of redeemer objects.
+ * @return A pointer to a newly allocated `cardano_redeemer_list_t` in WASM memory. Returns `0` on failure.
+ * @note The caller in C is responsible for freeing the returned object via `cardano_object_unref`.
+ */
+extern void* marshal_redeemer_list(void* js_redeemer_array);
+
+/* C -> JS ASYNC BRIDGE FUNCTIONS ********************************************/
+
+/**
+ * @brief Asynchronously evaluates the execution units (ExUnits) for a transaction.
+ *
+ * This function acts as a bridge to the JavaScript `tx_evaluator.evaluateTransaction()` method.
+ */
+EM_ASYNC_JS(cardano_error_t, cardano_tx_evaluator_bridge_evaluate, (uint32_t object_id, cardano_transaction_t* tx, cardano_utxo_list_t* additional_utxos, cardano_redeemer_list_t** redeemers_ptr), {
+  const tx_evaluator = get_tx_evaluator_from_registry(object_id);
+  if (!tx_evaluator)
+  {
+    return 1;
+  }
+
+  try
+  {
+    const tx_cbor_hex            = marshall_transaction_to_cbor_hex(tx);
+    const additional_utxos_array = marshall_utxo_list_to_js(additional_utxos);
+
+    const result_redeemers = await tx_evaluator.evaluate(tx_cbor_hex, additional_utxos_array);
+
+    const marshaled_ptr = marshal_redeemer_list(result_redeemers);
+
+    if (marshaled_ptr === 0)
+    {
+      return 4;
+    }
+
+    HEAPU32[redeemers_ptr >> 2] = marshaled_ptr;
+
+    return 0;
+  }
+  catch (e)
+  {
+    report_tx_evaluator_bridge_error(object_id, e);
+    return 1;
+  }
+});
+
+/* C -> JS ASYNC BRIDGE FUNCTIONS ********************************************/
+
+/**
+ * \brief Selects UTXOs from the available list and pre-selected UTXOs to meet the target value.
+ *
+ * This function selects UTXOs from both the pre-selected UTXO list and available UTXOs to meet a specified target value.
+ * The selected UTXOs are stored in the `selection` list, and any remaining UTXOs are stored in the `remaining_utxo` list.
+ *
+ * \param[in] coin_selector A pointer to the coin selector implementation object.
+ * \param[in] pre_selected_utxo A list of pre-selected UTXOs that must be included in the final selection.
+ * \param[in] available_utxo A list of available UTXOs to select from.
+ * \param[in] target A pointer to a \ref cardano_value_t object that defines the target amount of ADA and assets.
+ * \param[out] selection A pointer to the list of selected UTXOs that meet the target value.
+ * \param[out] remaining_utxo A pointer to the list of UTXOs that were not selected and remain available for future transactions.
+ *
+ * \return \ref CARDANO_SUCCESS if UTXOs were successfully selected, or an appropriate error code indicating failure.
+ */
+static cardano_error_t
+evaluate(
+  cardano_tx_evaluator_impl_t* tx_evaluator_impl,
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         additional_utxos,
+  cardano_redeemer_list_t**    redeemers)
+{
+  emscripten_tx_evaluator_context_t* ctx = (emscripten_tx_evaluator_context_t*)tx_evaluator_impl->context;
+
+  if (!ctx || !tx || !redeemers)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_tx_evaluator_bridge_evaluate(ctx->object_id, tx, additional_utxos, redeemers);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+/**
+ * @brief Creates a new transaction evaluator that is implemented in JavaScript.
+ */
+EMSCRIPTEN_KEEPALIVE
+cardano_error_t
+create_emscripten_tx_evaluator(
+  const char*              name,
+  const size_t             name_size,
+  const uint32_t           object_id,
+  cardano_tx_evaluator_t** tx_evaluator_ptr)
+{
+  if ((tx_evaluator_ptr == NULL) || (name == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((name_size >= 256U) || (name_size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  emscripten_tx_evaluator_context_t* context = emscripten_tx_evaluator_context_new(object_id);
+
+  if (context == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_safe_memcpy(context->name, 256, name, name_size);
+
+  cardano_tx_evaluator_impl_t impl = { 0 };
+
+  impl.evaluate = evaluate;
+  impl.context  = (cardano_object_t*)context;
+
+  cardano_error_t result = cardano_tx_evaluator_new(impl, tx_evaluator_ptr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    _cardano_free(context);
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+#endif /* __EMSCRIPTEN__ */
diff --git a/vendor/src/transaction_builder/evaluation/native_tx_evaluator.c b/vendor/src/transaction_builder/evaluation/native_tx_evaluator.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/evaluation/native_tx_evaluator.c
@@ -0,0 +1,2377 @@
+/**
+ * \file native_tx_evaluator.c
+ *
+ * \author angel.castillo
+ * \date   Jun 20, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "../../uplc/ast/uplc_term.h"
+#include "../../uplc/cost/uplc_selected_cost_model.h"
+#include "../../uplc/machine/uplc_machine.h"
+#include "../internals/created_output_scripts.h"
+#include <cardano/address/address.h>
+#include <cardano/address/address_type.h>
+#include <cardano/address/base_address.h>
+#include <cardano/address/enterprise_address.h>
+#include <cardano/address/pointer_address.h>
+#include <cardano/address/reward_address.h>
+#include <cardano/assets/multi_asset.h>
+#include <cardano/assets/policy_id_list.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/certs/auth_committee_hot_cert.h>
+#include <cardano/certs/cert_type.h>
+#include <cardano/certs/certificate.h>
+#include <cardano/certs/certificate_set.h>
+#include <cardano/certs/register_drep_cert.h>
+#include <cardano/certs/registration_cert.h>
+#include <cardano/certs/resign_committee_cold_cert.h>
+#include <cardano/certs/stake_delegation_cert.h>
+#include <cardano/certs/stake_deregistration_cert.h>
+#include <cardano/certs/stake_registration_delegation_cert.h>
+#include <cardano/certs/stake_vote_delegation_cert.h>
+#include <cardano/certs/stake_vote_registration_delegation_cert.h>
+#include <cardano/certs/unregister_drep_cert.h>
+#include <cardano/certs/unregistration_cert.h>
+#include <cardano/certs/update_drep_cert.h>
+#include <cardano/certs/vote_delegation_cert.h>
+#include <cardano/certs/vote_registration_delegation_cert.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/credential_type.h>
+#include <cardano/common/datum.h>
+#include <cardano/common/datum_type.h>
+#include <cardano/common/ex_units.h>
+#include <cardano/common/guard_set.h>
+#include <cardano/common/utxo.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/object.h>
+#include <cardano/proposal_procedures/governance_action_type.h>
+#include <cardano/proposal_procedures/parameter_change_action.h>
+#include <cardano/proposal_procedures/proposal_procedure.h>
+#include <cardano/proposal_procedures/proposal_procedure_set.h>
+#include <cardano/proposal_procedures/treasury_withdrawals_action.h>
+#include <cardano/protocol_params/cost_model.h>
+#include <cardano/protocol_params/costmdls.h>
+#include <cardano/scripts/plutus_scripts/plutus_language_version.h>
+#include <cardano/scripts/plutus_scripts/plutus_v1_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v2_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v3_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v4_script.h>
+#include <cardano/scripts/script.h>
+#include <cardano/scripts/script_language.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/transaction_body/transaction_input.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+#include <cardano/transaction_body/transaction_output.h>
+#include <cardano/transaction_builder/evaluation/native_tx_evaluator.h>
+#include <cardano/voting_procedures/voter.h>
+#include <cardano/voting_procedures/voter_type.h>
+#include <cardano/voting_procedures/voting_procedures.h>
+#include <cardano/witness_set/plutus_data_set.h>
+#include <cardano/witness_set/plutus_v1_script_set.h>
+#include <cardano/witness_set/plutus_v2_script_set.h>
+#include <cardano/witness_set/plutus_v3_script_set.h>
+#include <cardano/witness_set/plutus_v4_script_set.h>
+#include <cardano/witness_set/witness_set.h>
+
+#include "../../allocators.h"
+#include "../../common/ledger_order.h"
+#include "../../string_safe.h"
+#include "../../uplc/arena/uplc_arena.h"
+#include "../../uplc/tx/script_context.h"
+#include <cardano/uplc/uplc_apply_params.h>
+
+#include <stddef.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief The arena block size used for one redeemer evaluation.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t PRV_ARENA_BLOCK_SIZE = 4096U;
+
+/**
+ * \brief The CPU ceiling for the whole transaction, shared across redeemers.
+ *
+ * This is the aggregate transaction-level budget the evaluator hands out: each
+ * redeemer's CEK machine is bounded by what remains after the earlier redeemers
+ * have spent, mirroring the reference (Aiken eval_phase_two threads a single
+ * remaining_budget through the redeemer loop, subtracting each script's spent
+ * units before the next one runs, so a transaction whose redeemers collectively
+ * exceed the budget fails). The spent budget reported per redeemer is the actual
+ * charge, never this ceiling.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t PRV_MAX_CPU = (int64_t)100000000000;
+
+/**
+ * \brief The memory ceiling for the whole transaction, shared across redeemers.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t PRV_MAX_MEM = (int64_t)100000000;
+
+/**
+ * \brief The Dijkstra protocol major version, from which the ledger's scope check
+ * of a script also visits the subterms of \c constr and \c case.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t PRV_DIJKSTRA_PROTOCOL_MAJOR = 12U;
+
+/**
+ * \brief The name the native evaluator reports.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const char* const PRV_EVALUATOR_NAME = "Native UPLC transaction evaluator";
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The bound state of a native phase-2 evaluator.
+ *
+ * Stored as the \c context of the \ref cardano_tx_evaluator_impl_t and reached
+ * by casting the \c cardano_object_t base. Holds the inputs the evaluate
+ * signature does not carry: the slot config (copied by value), the ledger cost
+ * models (referenced), the protocol major version and the transaction level
+ * whose redeemers the evaluator returns.
+ */
+typedef struct native_context_t
+{
+    cardano_object_t      base;
+    cardano_slot_config_t slot_config;
+    cardano_costmdls_t*   cost_models;
+    uint64_t              protocol_major;
+    bool                  has_sub_tx_index;
+    uint64_t              sub_tx_index;
+} native_context_t;
+
+/**
+ * \brief The Plutus language version of a resolved script.
+ */
+typedef enum
+{
+  PRV_SCRIPT_V1 = 0,
+  PRV_SCRIPT_V2 = 1,
+  PRV_SCRIPT_V3 = 2,
+  PRV_SCRIPT_V4 = 3
+} script_version_t;
+
+/**
+ * \brief The parts of a transaction level its redeemers point into.
+ *
+ * A Dijkstra transaction runs scripts at two levels: the top-level transaction
+ * and each of its sub-transactions. Each level has its own body and witness set,
+ * and the redeemers of a level index into the collections of that level only.
+ */
+typedef struct tx_level_t
+{
+    cardano_witness_set_t*            witness_set;
+    cardano_transaction_input_set_t*  inputs;
+    cardano_multi_asset_t*            mint;
+    cardano_withdrawal_map_t*         withdrawals;
+    cardano_certificate_set_t*        certificates;
+    cardano_voting_procedures_t*      votes;
+    cardano_proposal_procedure_set_t* proposals;
+    cardano_guard_set_t*              guards;
+} tx_level_t;
+
+/**
+ * \brief A redeemer resolved to the script it runs.
+ *
+ * Holds the raw script bytes, the language of the script and, for a spend, the
+ * datum of the spent output.
+ */
+typedef struct resolved_script_t
+{
+    cardano_buffer_t*      script_bytes;
+    script_version_t       version;
+    cardano_plutus_data_t* datum;
+} resolved_script_t;
+
+/**
+ * \brief The outcome of evaluating one redeemer that the host could run.
+ */
+typedef enum
+{
+  /** \brief The script deserialised and evaluated successfully. */
+  PRV_REDEEMER_SUCCEEDED = 0,
+  /** \brief The script cannot be deserialised for its language at the protocol version. */
+  PRV_REDEEMER_NOT_DESERIALISABLE = 1,
+  /** \brief The script deserialised but failed phase-2 evaluation. */
+  PRV_REDEEMER_SCRIPT_FAILED = 2
+} redeemer_outcome_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Releases the evaluator context once its reference count reaches zero.
+ */
+static void
+context_deallocate(void* object)
+{
+  native_context_t* ctx = (native_context_t*)object;
+
+  if (ctx != NULL)
+  {
+    cardano_costmdls_unref(&ctx->cost_models);
+    _cardano_free(ctx);
+  }
+}
+
+/**
+ * \brief Returns the payment credential of an output address, or NULL.
+ *
+ * Handles base, enterprise and pointer Shelley addresses; a Byron or stake
+ * address has no payment credential and yields NULL. The caller owns the
+ * returned credential and releases it with \ref cardano_credential_unref.
+ */
+static cardano_credential_t*
+payment_credential(cardano_address_t* address)
+{
+  cardano_address_type_t type   = CARDANO_ADDRESS_TYPE_BYRON;
+  cardano_credential_t*  result = NULL;
+
+  if (address == NULL)
+  {
+    return NULL;
+  }
+
+  if (cardano_address_get_type(address, &type) != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  switch (type)
+  {
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_KEY:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT:
+    {
+      cardano_base_address_t* base = cardano_address_to_base_address(address);
+
+      result = cardano_base_address_get_payment_credential(base);
+      cardano_base_address_unref(&base);
+      break;
+    }
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_KEY:
+    case CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT:
+    {
+      cardano_enterprise_address_t* ent = cardano_address_to_enterprise_address(address);
+
+      result = cardano_enterprise_address_get_payment_credential(ent);
+      cardano_enterprise_address_unref(&ent);
+      break;
+    }
+    case CARDANO_ADDRESS_TYPE_POINTER_KEY:
+    case CARDANO_ADDRESS_TYPE_POINTER_SCRIPT:
+    {
+      cardano_pointer_address_t* ptr = cardano_address_to_pointer_address(address);
+
+      result = cardano_pointer_address_get_payment_credential(ptr);
+      cardano_pointer_address_unref(&ptr);
+      break;
+    }
+    case CARDANO_ADDRESS_TYPE_REWARD_KEY:
+    case CARDANO_ADDRESS_TYPE_REWARD_SCRIPT:
+    case CARDANO_ADDRESS_TYPE_BYRON:
+    default:
+    {
+      result = NULL;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Looks a script hash up in the plutus script sets of a witness set.
+ *
+ * The raw witness-set bytes (CBOR-wrapped flat) and the language version are
+ * returned on a match. The caller owns \p out_bytes and releases it with
+ * \ref cardano_buffer_unref.
+ *
+ * \return \ref CARDANO_SUCCESS on a match, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the witness set holds no plutus script with that hash, or a
+ *         propagated error.
+ */
+static cardano_error_t
+find_witness_script(
+  cardano_witness_set_t*        witness_set,
+  const cardano_blake2b_hash_t* script_hash,
+  cardano_buffer_t**            out_bytes,
+  script_version_t*             out_version)
+{
+  cardano_error_t result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+
+  cardano_plutus_v1_script_set_t* v1 = cardano_witness_set_get_plutus_v1_scripts(witness_set);
+  cardano_plutus_v2_script_set_t* v2 = cardano_witness_set_get_plutus_v2_scripts(witness_set);
+  cardano_plutus_v3_script_set_t* v3 = cardano_witness_set_get_plutus_v3_scripts(witness_set);
+  cardano_plutus_v4_script_set_t* v4 = cardano_witness_set_get_plutus_v4_scripts(witness_set);
+
+  size_t i = 0U;
+
+  for (i = 0U; (result == CARDANO_ERROR_ELEMENT_NOT_FOUND) && (v1 != NULL) && (i < cardano_plutus_v1_script_set_get_length(v1)); ++i)
+  {
+    cardano_plutus_v1_script_t* script = NULL;
+
+    cardano_error_t get_result = cardano_plutus_v1_script_set_get(v1, i, &script);
+
+    if (get_result != CARDANO_SUCCESS)
+    {
+      result = get_result;
+    }
+    else
+    {
+      cardano_blake2b_hash_t* hash = cardano_plutus_v1_script_get_hash(script);
+
+      if (hash == NULL)
+      {
+        result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+      else
+      {
+        if (cardano_blake2b_hash_equals(hash, script_hash))
+        {
+          result       = cardano_plutus_v1_script_to_raw_bytes(script, out_bytes);
+          *out_version = PRV_SCRIPT_V1;
+        }
+      }
+
+      cardano_blake2b_hash_unref(&hash);
+    }
+
+    cardano_plutus_v1_script_unref(&script);
+  }
+
+  for (i = 0U; (result == CARDANO_ERROR_ELEMENT_NOT_FOUND) && (v2 != NULL) && (i < cardano_plutus_v2_script_set_get_length(v2)); ++i)
+  {
+    cardano_plutus_v2_script_t* script = NULL;
+
+    cardano_error_t get_result = cardano_plutus_v2_script_set_get(v2, i, &script);
+
+    if (get_result != CARDANO_SUCCESS)
+    {
+      result = get_result;
+    }
+    else
+    {
+      cardano_blake2b_hash_t* hash = cardano_plutus_v2_script_get_hash(script);
+
+      if (hash == NULL)
+      {
+        result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+      else
+      {
+        if (cardano_blake2b_hash_equals(hash, script_hash))
+        {
+          result       = cardano_plutus_v2_script_to_raw_bytes(script, out_bytes);
+          *out_version = PRV_SCRIPT_V2;
+        }
+      }
+
+      cardano_blake2b_hash_unref(&hash);
+    }
+
+    cardano_plutus_v2_script_unref(&script);
+  }
+
+  for (i = 0U; (result == CARDANO_ERROR_ELEMENT_NOT_FOUND) && (v3 != NULL) && (i < cardano_plutus_v3_script_set_get_length(v3)); ++i)
+  {
+    cardano_plutus_v3_script_t* script = NULL;
+
+    cardano_error_t get_result = cardano_plutus_v3_script_set_get(v3, i, &script);
+
+    if (get_result != CARDANO_SUCCESS)
+    {
+      result = get_result;
+    }
+    else
+    {
+      cardano_blake2b_hash_t* hash = cardano_plutus_v3_script_get_hash(script);
+
+      if (hash == NULL)
+      {
+        result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+      else
+      {
+        if (cardano_blake2b_hash_equals(hash, script_hash))
+        {
+          result       = cardano_plutus_v3_script_to_raw_bytes(script, out_bytes);
+          *out_version = PRV_SCRIPT_V3;
+        }
+      }
+
+      cardano_blake2b_hash_unref(&hash);
+    }
+
+    cardano_plutus_v3_script_unref(&script);
+  }
+
+  for (i = 0U; (result == CARDANO_ERROR_ELEMENT_NOT_FOUND) && (v4 != NULL) && (i < cardano_plutus_v4_script_set_get_length(v4)); ++i)
+  {
+    cardano_plutus_v4_script_t* script = NULL;
+
+    cardano_error_t get_result = cardano_plutus_v4_script_set_get(v4, i, &script);
+
+    if (get_result != CARDANO_SUCCESS)
+    {
+      result = get_result;
+    }
+    else
+    {
+      cardano_blake2b_hash_t* hash = cardano_plutus_v4_script_get_hash(script);
+
+      if (hash == NULL)
+      {
+        result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+      else
+      {
+        if (cardano_blake2b_hash_equals(hash, script_hash))
+        {
+          result       = cardano_plutus_v4_script_to_raw_bytes(script, out_bytes);
+          *out_version = PRV_SCRIPT_V4;
+        }
+      }
+
+      cardano_blake2b_hash_unref(&hash);
+    }
+
+    cardano_plutus_v4_script_unref(&script);
+  }
+
+  cardano_plutus_v1_script_set_unref(&v1);
+  cardano_plutus_v2_script_set_unref(&v2);
+  cardano_plutus_v3_script_set_unref(&v3);
+  cardano_plutus_v4_script_set_unref(&v4);
+
+  return result;
+}
+
+/**
+ * \brief Returns the raw bytes and language version of a plutus reference script.
+ *
+ * \return \ref CARDANO_SUCCESS for a plutus script, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         for a native script, or a propagated error.
+ */
+static cardano_error_t
+reference_script_bytes(cardano_script_t* script_ref, cardano_buffer_t** out_bytes, script_version_t* out_version)
+{
+  cardano_script_language_t lang   = CARDANO_SCRIPT_LANGUAGE_NATIVE;
+  cardano_error_t           result = cardano_script_get_language(script_ref, &lang);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+
+  switch (lang)
+  {
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1:
+    {
+      cardano_plutus_v1_script_t* s = NULL;
+
+      result = cardano_script_to_plutus_v1(script_ref, &s);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result       = cardano_plutus_v1_script_to_raw_bytes(s, out_bytes);
+        *out_version = PRV_SCRIPT_V1;
+      }
+
+      cardano_plutus_v1_script_unref(&s);
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2:
+    {
+      cardano_plutus_v2_script_t* s = NULL;
+
+      result = cardano_script_to_plutus_v2(script_ref, &s);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result       = cardano_plutus_v2_script_to_raw_bytes(s, out_bytes);
+        *out_version = PRV_SCRIPT_V2;
+      }
+
+      cardano_plutus_v2_script_unref(&s);
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3:
+    {
+      cardano_plutus_v3_script_t* s = NULL;
+
+      result = cardano_script_to_plutus_v3(script_ref, &s);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result       = cardano_plutus_v3_script_to_raw_bytes(s, out_bytes);
+        *out_version = PRV_SCRIPT_V3;
+      }
+
+      cardano_plutus_v3_script_unref(&s);
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4:
+    {
+      cardano_plutus_v4_script_t* s = NULL;
+
+      result = cardano_script_to_plutus_v4(script_ref, &s);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result       = cardano_plutus_v4_script_to_raw_bytes(s, out_bytes);
+        *out_version = PRV_SCRIPT_V4;
+      }
+
+      cardano_plutus_v4_script_unref(&s);
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_NATIVE:
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Looks a script hash up in the reference scripts of the resolved outputs.
+ *
+ * \return \ref CARDANO_SUCCESS on a match, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if no resolved output carries a plutus reference script with that hash,
+ *         or a propagated error.
+ */
+static cardano_error_t
+find_reference_script(
+  cardano_utxo_list_t*          resolved_inputs,
+  const cardano_blake2b_hash_t* script_hash,
+  cardano_buffer_t**            out_bytes,
+  script_version_t*             out_version)
+{
+  cardano_error_t result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+
+  for (size_t i = 0U; (result == CARDANO_ERROR_ELEMENT_NOT_FOUND) && (resolved_inputs != NULL) && (i < cardano_utxo_list_get_length(resolved_inputs)); ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    if (cardano_utxo_list_get(resolved_inputs, i, &utxo) == CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_t* output     = cardano_utxo_get_output(utxo);
+      cardano_script_t*             script_ref = cardano_transaction_output_get_script_ref(output);
+
+      if (script_ref != NULL)
+      {
+        cardano_blake2b_hash_t* hash = cardano_script_get_hash(script_ref);
+
+        if (hash == NULL)
+        {
+          result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+        else
+        {
+          if (cardano_blake2b_hash_equals(hash, script_hash))
+          {
+            result = reference_script_bytes(script_ref, out_bytes, out_version);
+          }
+        }
+
+        cardano_blake2b_hash_unref(&hash);
+        cardano_script_unref(&script_ref);
+      }
+
+      cardano_transaction_output_unref(&output);
+    }
+
+    cardano_utxo_unref(&utxo);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Looks a script hash up in every script the transaction provides.
+ *
+ * Like the ledger, the scripts a Dijkstra transaction provides are the union of
+ * the witness scripts of the top-level transaction and of every sub-transaction,
+ * and the reference scripts of resolved inputs and, from protocol version 12, created outputs
+ * including collateral return (CIP-172); a redeemer at any level can
+ * run any of them. The caller owns \p out_bytes and releases it with
+ * \ref cardano_buffer_unref.
+ *
+ * \return \ref CARDANO_SUCCESS on a match, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if no plutus script with that hash exists, or a propagated error.
+ */
+static cardano_error_t
+find_script_by_hash(
+  cardano_transaction_t*        tx,
+  const uint64_t                protocol_major,
+  cardano_utxo_list_t*          resolved_inputs,
+  const cardano_blake2b_hash_t* script_hash,
+  cardano_buffer_t**            out_bytes,
+  script_version_t*             out_version)
+{
+  cardano_witness_set_t*         witness_set = cardano_transaction_get_witness_set(tx);
+  cardano_transaction_body_t*    body        = cardano_transaction_get_body(tx);
+  cardano_sub_transaction_set_t* subs        = cardano_transaction_body_get_sub_transactions(body);
+  cardano_error_t                result      = find_witness_script(witness_set, script_hash, out_bytes, out_version);
+
+  for (size_t i = 0U; (result == CARDANO_ERROR_ELEMENT_NOT_FOUND) && (i < cardano_sub_transaction_set_get_length(subs)); ++i)
+  {
+    cardano_sub_transaction_t* sub = NULL;
+
+    if (cardano_sub_transaction_set_get(subs, i, &sub) == CARDANO_SUCCESS)
+    {
+      cardano_witness_set_t* sub_witness_set = cardano_sub_transaction_get_witness_set(sub);
+
+      result = find_witness_script(sub_witness_set, script_hash, out_bytes, out_version);
+
+      cardano_witness_set_unref(&sub_witness_set);
+    }
+
+    cardano_sub_transaction_unref(&sub);
+  }
+
+  if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+  {
+    result = find_reference_script(resolved_inputs, script_hash, out_bytes, out_version);
+  }
+
+  if ((result == CARDANO_ERROR_ELEMENT_NOT_FOUND) && (protocol_major >= PRV_DIJKSTRA_PROTOCOL_MAJOR))
+  {
+    cardano_script_t* created_script = NULL;
+    result                           = cardano_builder_find_created_script(tx, script_hash, &created_script);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = reference_script_bytes(created_script, out_bytes, out_version);
+    }
+    cardano_script_unref(&created_script);
+  }
+
+  cardano_sub_transaction_set_unref(&subs);
+  cardano_transaction_body_unref(&body);
+  cardano_witness_set_unref(&witness_set);
+
+  return result;
+}
+
+/**
+ * \brief Computes the Blake2b-256 hash of a plutus-data value.
+ *
+ * Serializes the data to canonical CBOR and hashes it, matching the datum-hash
+ * the ledger keys witness datums by. The caller owns the returned hash and
+ * releases it with \ref cardano_blake2b_hash_unref.
+ */
+static cardano_error_t
+hash_plutus_data(cardano_plutus_data_t* data, cardano_blake2b_hash_t** out_hash)
+{
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+  cardano_buffer_t*      buffer = NULL;
+  cardano_error_t        result = CARDANO_SUCCESS;
+
+  *out_hash = NULL;
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_plutus_data_to_cbor(data, writer);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_writer_encode_in_buffer(writer, &buffer);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_blake2b_compute_hash(cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer), (size_t)CARDANO_BLAKE2B_HASH_SIZE_256, out_hash);
+  }
+
+  cardano_buffer_unref(&buffer);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+/**
+ * \brief Resolves the datum of a spent output for the V1/V2/V3 spend purpose.
+ *
+ * An inline datum yields its data directly; a datum hash is resolved against the
+ * witness datum set by re-hashing each witness datum and comparing. The caller
+ * owns the returned datum and releases it with \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS with \p *out_datum NULL when the output carries no
+ *         datum, \ref CARDANO_SUCCESS with a datum on a match,
+ *         \ref CARDANO_ERROR_ELEMENT_NOT_FOUND when a hash cannot be resolved, or
+ *         a propagated error.
+ */
+static cardano_error_t
+resolve_datum(
+  cardano_witness_set_t*        witness_set,
+  cardano_transaction_output_t* output,
+  cardano_plutus_data_t**       out_datum)
+{
+  cardano_datum_t* datum  = cardano_transaction_output_get_datum(output);
+  cardano_error_t  result = CARDANO_SUCCESS;
+
+  *out_datum = NULL;
+
+  if (datum == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_datum_type_t datum_type = CARDANO_DATUM_TYPE_DATA_HASH;
+
+  result = cardano_datum_get_type(datum, &datum_type);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    switch (datum_type)
+    {
+      case CARDANO_DATUM_TYPE_INLINE_DATA:
+      {
+        *out_datum = cardano_datum_get_inline_data(datum);
+        break;
+      }
+      case CARDANO_DATUM_TYPE_DATA_HASH:
+      {
+        cardano_blake2b_hash_t*    target = cardano_datum_get_data_hash(datum);
+        cardano_plutus_data_set_t* datums = cardano_witness_set_get_plutus_data(witness_set);
+
+        result = (target == NULL) ? CARDANO_ERROR_MEMORY_ALLOCATION_FAILED : CARDANO_ERROR_ELEMENT_NOT_FOUND;
+
+        for (size_t i = 0U; (result == CARDANO_ERROR_ELEMENT_NOT_FOUND) && (datums != NULL) && (i < cardano_plutus_data_set_get_length(datums)); ++i)
+        {
+          cardano_plutus_data_t* candidate = NULL;
+
+          cardano_error_t get_result = cardano_plutus_data_set_get(datums, i, &candidate);
+
+          if (get_result != CARDANO_SUCCESS)
+          {
+            result = get_result;
+          }
+          else
+          {
+            cardano_blake2b_hash_t* hash        = NULL;
+            cardano_error_t         hash_result = hash_plutus_data(candidate, &hash);
+
+            if (hash_result != CARDANO_SUCCESS)
+            {
+              result = hash_result;
+            }
+            else
+            {
+              if (cardano_blake2b_hash_equals(hash, target))
+              {
+                *out_datum = candidate;
+                cardano_plutus_data_ref(*out_datum);
+                result = CARDANO_SUCCESS;
+              }
+
+              cardano_blake2b_hash_unref(&hash);
+            }
+          }
+
+          cardano_plutus_data_unref(&candidate);
+        }
+
+        cardano_blake2b_hash_unref(&target);
+        cardano_plutus_data_set_unref(&datums);
+        break;
+      }
+      default:
+      {
+        result = CARDANO_ERROR_INVALID_ARGUMENT;
+        break;
+      }
+    }
+  }
+
+  cardano_datum_unref(&datum);
+
+  return result;
+}
+
+/**
+ * \brief Extracts the script hash of a script-typed credential.
+ *
+ * A redeemer can only authorize a credential whose payment/stake credential is a
+ * script hash; a key-hash credential (or a NULL one) is rejected. The returned
+ * hash is owned by the caller and released with \ref cardano_blake2b_hash_unref.
+ *
+ * \return \ref CARDANO_SUCCESS with the script hash, or
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT for a NULL or non-script credential.
+ */
+static cardano_error_t
+script_hash_from_credential(cardano_credential_t* credential, cardano_blake2b_hash_t** out_hash)
+{
+  cardano_credential_type_t cred_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (cardano_credential_get_type(credential, &cred_type) != CARDANO_SUCCESS)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (cred_type != CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *out_hash = cardano_credential_get_hash(credential);
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Returns the credential a certificate authorizes with a script witness.
+ *
+ * Mirrors the ledger's \c getScriptWitnessConwayTxCert: deregistration,
+ * delegation, the registration-and-delegation combinations, the DRep
+ * registration/update/unregistration and the committee hot/cold certificates are
+ * authorized by their (cold) credential; pool, genesis, MIR and bare stake
+ * registration carry no script witness. The Conway registration-with-deposit
+ * certificate is authorized by its stake credential. The returned credential is
+ * owned by the caller and released with \ref cardano_credential_unref.
+ *
+ * \return \ref CARDANO_SUCCESS with the credential, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         for a certificate that takes no script witness, or a propagated error.
+ */
+static cardano_error_t
+certificate_witness_credential(cardano_certificate_t* certificate, cardano_credential_t** out)
+{
+  cardano_cert_type_t type   = CARDANO_CERT_TYPE_STAKE_REGISTRATION;
+  cardano_error_t     result = cardano_cert_get_type(certificate, &type);
+
+  *out = NULL;
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (type)
+  {
+    case CARDANO_CERT_TYPE_STAKE_DEREGISTRATION:
+    {
+      cardano_stake_deregistration_cert_t* cert = NULL;
+      result                                    = cardano_certificate_to_stake_deregistration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_stake_deregistration_cert_get_credential(cert);
+      }
+
+      cardano_stake_deregistration_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DELEGATION:
+    {
+      cardano_stake_delegation_cert_t* cert = NULL;
+      result                                = cardano_certificate_to_stake_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_stake_delegation_cert_get_credential(cert);
+      }
+
+      cardano_stake_delegation_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_REGISTRATION:
+    {
+      cardano_registration_cert_t* cert = NULL;
+      result                            = cardano_certificate_to_registration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_registration_cert_get_stake_credential(cert);
+      }
+
+      cardano_registration_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_UNREGISTRATION:
+    {
+      cardano_unregistration_cert_t* cert = NULL;
+      result                              = cardano_certificate_to_unregistration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_unregistration_cert_get_credential(cert);
+      }
+
+      cardano_unregistration_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_VOTE_DELEGATION:
+    {
+      cardano_vote_delegation_cert_t* cert = NULL;
+      result                               = cardano_certificate_to_vote_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_vote_delegation_cert_get_credential(cert);
+      }
+
+      cardano_vote_delegation_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION:
+    {
+      cardano_stake_vote_delegation_cert_t* cert = NULL;
+      result                                     = cardano_certificate_to_stake_vote_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_stake_vote_delegation_cert_get_credential(cert);
+      }
+
+      cardano_stake_vote_delegation_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION:
+    {
+      cardano_stake_registration_delegation_cert_t* cert = NULL;
+      result                                             = cardano_certificate_to_stake_registration_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_stake_registration_delegation_cert_get_credential(cert);
+      }
+
+      cardano_stake_registration_delegation_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION:
+    {
+      cardano_vote_registration_delegation_cert_t* cert = NULL;
+      result                                            = cardano_certificate_to_vote_registration_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_vote_registration_delegation_cert_get_credential(cert);
+      }
+
+      cardano_vote_registration_delegation_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION:
+    {
+      cardano_stake_vote_registration_delegation_cert_t* cert = NULL;
+      result                                                  = cardano_certificate_to_stake_vote_registration_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_stake_vote_registration_delegation_cert_get_credential(cert);
+      }
+
+      cardano_stake_vote_registration_delegation_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT:
+    {
+      cardano_auth_committee_hot_cert_t* cert = NULL;
+      result                                  = cardano_certificate_to_auth_committee_hot(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_auth_committee_hot_cert_get_cold_cred(cert, out);
+      }
+
+      cardano_auth_committee_hot_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD:
+    {
+      cardano_resign_committee_cold_cert_t* cert = NULL;
+      result                                     = cardano_certificate_to_resign_committee_cold(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_resign_committee_cold_cert_get_credential(cert);
+      }
+
+      cardano_resign_committee_cold_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_DREP_REGISTRATION:
+    {
+      cardano_register_drep_cert_t* cert = NULL;
+      result                             = cardano_certificate_to_register_drep(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_register_drep_cert_get_credential(cert);
+      }
+
+      cardano_register_drep_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_DREP_UNREGISTRATION:
+    {
+      cardano_unregister_drep_cert_t* cert = NULL;
+      result                               = cardano_certificate_to_unregister_drep(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_unregister_drep_cert_get_credential(cert);
+      }
+
+      cardano_unregister_drep_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_UPDATE_DREP:
+    {
+      cardano_update_drep_cert_t* cert = NULL;
+      result                           = cardano_certificate_to_update_drep(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out = cardano_update_drep_cert_get_credential(cert);
+      }
+
+      cardano_update_drep_cert_unref(&cert);
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION:
+    case CARDANO_CERT_TYPE_POOL_REGISTRATION:
+    case CARDANO_CERT_TYPE_POOL_RETIREMENT:
+    case CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION:
+    case CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS:
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Returns the guardrail policy script hash a proposal authorizes.
+ *
+ * Mirrors the ledger's \c getProposalScriptHash: only a parameter-change or a
+ * treasury-withdrawals action carries a guardrail policy; any other action, or a
+ * proposal without a policy, takes no script witness. The returned hash is owned
+ * by the caller and released with \ref cardano_blake2b_hash_unref.
+ *
+ * \return \ref CARDANO_SUCCESS with the policy hash, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         when the proposal carries no guardrail policy, or a propagated error.
+ */
+static cardano_error_t
+proposal_policy_hash(cardano_proposal_procedure_t* proposal, cardano_blake2b_hash_t** out_hash)
+{
+  cardano_governance_action_type_t action_type = CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE;
+  cardano_error_t                  result      = cardano_proposal_procedure_get_action_type(proposal, &action_type);
+
+  *out_hash = NULL;
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (action_type)
+  {
+    case CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE:
+    {
+      cardano_parameter_change_action_t* action = NULL;
+      result                                    = cardano_proposal_procedure_to_parameter_change_action(proposal, &action);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out_hash = cardano_parameter_change_action_get_policy_hash(action);
+      }
+
+      cardano_parameter_change_action_unref(&action);
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS:
+    {
+      cardano_treasury_withdrawals_action_t* action = NULL;
+      result                                        = cardano_proposal_procedure_to_treasury_withdrawals_action(proposal, &action);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *out_hash = cardano_treasury_withdrawals_action_get_policy_hash(action);
+      }
+
+      cardano_treasury_withdrawals_action_unref(&action);
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  if ((result == CARDANO_SUCCESS) && (*out_hash == NULL))
+  {
+    result = CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Releases the references held by a transaction level.
+ */
+static void
+release_level(tx_level_t* level)
+{
+  cardano_witness_set_unref(&level->witness_set);
+  cardano_transaction_input_set_unref(&level->inputs);
+  cardano_multi_asset_unref(&level->mint);
+  cardano_withdrawal_map_unref(&level->withdrawals);
+  cardano_certificate_set_unref(&level->certificates);
+  cardano_voting_procedures_unref(&level->votes);
+  cardano_proposal_procedure_set_unref(&level->proposals);
+  cardano_guard_set_unref(&level->guards);
+}
+
+/**
+ * \brief Reads the parts of a transaction level its redeemers point into.
+ *
+ * \param[in] tx The top-level transaction.
+ * \param[in] sub_tx_index The position of the sub-transaction in the body of \p tx,
+ *            or NULL for the top-level transaction.
+ * \param[out] level The level to fill; release it with \ref release_level.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_INDEX_OUT_OF_BOUNDS
+ *         when \p sub_tx_index points past the sub-transactions.
+ */
+static cardano_error_t
+read_level(cardano_transaction_t* tx, const uint64_t* sub_tx_index, tx_level_t* level)
+{
+  cardano_transaction_body_t*    body   = cardano_transaction_get_body(tx);
+  cardano_sub_transaction_set_t* subs   = NULL;
+  cardano_sub_transaction_t*     sub    = NULL;
+  cardano_error_t                result = CARDANO_SUCCESS;
+
+  CARDANO_UNUSED(memset(level, 0, sizeof(tx_level_t)));
+
+  if (sub_tx_index == NULL)
+  {
+    level->witness_set  = cardano_transaction_get_witness_set(tx);
+    level->inputs       = cardano_transaction_body_get_inputs(body);
+    level->mint         = cardano_transaction_body_get_mint(body);
+    level->withdrawals  = cardano_transaction_body_get_withdrawals(body);
+    level->certificates = cardano_transaction_body_get_certificates(body);
+    level->votes        = cardano_transaction_body_get_voting_procedures(body);
+    level->proposals    = cardano_transaction_body_get_proposal_procedures(body);
+    level->guards       = cardano_transaction_body_get_guards(body);
+
+    cardano_transaction_body_unref(&body);
+
+    return CARDANO_SUCCESS;
+  }
+
+  subs = cardano_transaction_body_get_sub_transactions(body);
+
+  if (*sub_tx_index >= (uint64_t)cardano_sub_transaction_set_get_length(subs))
+  {
+    result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_sub_transaction_set_get(subs, (size_t)*sub_tx_index, &sub);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_body_t* sub_body = cardano_sub_transaction_get_body(sub);
+
+    level->witness_set  = cardano_sub_transaction_get_witness_set(sub);
+    level->inputs       = cardano_sub_transaction_body_get_inputs(sub_body);
+    level->mint         = cardano_sub_transaction_body_get_mint(sub_body);
+    level->withdrawals  = cardano_sub_transaction_body_get_withdrawals(sub_body);
+    level->certificates = cardano_sub_transaction_body_get_certificates(sub_body);
+    level->votes        = cardano_sub_transaction_body_get_voting_procedures(sub_body);
+    level->proposals    = cardano_sub_transaction_body_get_proposal_procedures(sub_body);
+    level->guards       = cardano_sub_transaction_body_get_guards(sub_body);
+
+    cardano_sub_transaction_body_unref(&sub_body);
+  }
+
+  cardano_sub_transaction_unref(&sub);
+  cardano_sub_transaction_set_unref(&subs);
+  cardano_transaction_body_unref(&body);
+
+  return result;
+}
+
+/**
+ * \brief Resolves the script hash a redeemer points at, plus the spend datum.
+ *
+ * The (tag, index) pair selects the concrete item against the collections of the
+ * redeemer's own transaction level: sorted inputs (spend), sorted mint policies
+ * (mint), withdrawals in ledger account order (reward), certificates (cert),
+ * voters in ledger voter order (vote), proposals (propose) or guards (guard).
+ * The guard index is the position in the guard set in transaction order,
+ * counting key-hash guards too. The script hash is the script credential the
+ * item is authorized by; the spend purpose also resolves the datum from the
+ * witness datums of the level. The index ordering mirrors the ledger's
+ * per-purpose ordering, which is the consensus-critical mapping.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_INDEX_OUT_OF_BOUNDS
+ *         if the index is out of range, \ref CARDANO_ERROR_INVALID_ARGUMENT for a
+ *         non-script credential or an unsupported tag, or a propagated error.
+ */
+static cardano_error_t
+resolve_script_hash(
+  tx_level_t*              level,
+  cardano_utxo_list_t*     resolved_inputs,
+  cardano_redeemer_t*      redeemer,
+  cardano_blake2b_hash_t** out_hash,
+  cardano_plutus_data_t**  out_datum)
+{
+  const cardano_redeemer_tag_t tag    = cardano_redeemer_get_tag(redeemer);
+  const uint64_t               index  = cardano_redeemer_get_index(redeemer);
+  cardano_error_t              result = CARDANO_SUCCESS;
+
+  *out_hash  = NULL;
+  *out_datum = NULL;
+
+  switch (tag)
+  {
+    case CARDANO_REDEEMER_TAG_MINT:
+    {
+      cardano_policy_id_list_t* policies = NULL;
+
+      result = (level->mint != NULL) ? cardano_multi_asset_get_keys(level->mint, &policies) : CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+
+      if ((result == CARDANO_SUCCESS) && (index >= cardano_policy_id_list_get_length(policies)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_policy_id_list_get(policies, (size_t)index, out_hash);
+      }
+
+      cardano_policy_id_list_unref(&policies);
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_SPEND:
+    {
+      if ((level->inputs == NULL) || (index >= cardano_transaction_input_set_get_length(level->inputs)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_transaction_input_t*  input  = NULL;
+        cardano_transaction_output_t* output = NULL;
+
+        result = cardano_transaction_input_set_get(level->inputs, (size_t)index, &input);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          size_t j = 0U;
+
+          result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+
+          for (j = 0U; (output == NULL) && (j < cardano_utxo_list_get_length(resolved_inputs)); ++j)
+          {
+            cardano_utxo_t* utxo = NULL;
+
+            if (cardano_utxo_list_get(resolved_inputs, j, &utxo) == CARDANO_SUCCESS)
+            {
+              cardano_transaction_input_t* candidate = cardano_utxo_get_input(utxo);
+
+              if (cardano_transaction_input_equals(candidate, input))
+              {
+                output = cardano_utxo_get_output(utxo);
+                result = CARDANO_SUCCESS;
+              }
+
+              cardano_transaction_input_unref(&candidate);
+            }
+
+            cardano_utxo_unref(&utxo);
+          }
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          cardano_address_t*    address    = cardano_transaction_output_get_address(output);
+          cardano_credential_t* credential = payment_credential(address);
+
+          result = script_hash_from_credential(credential, out_hash);
+
+          if (result == CARDANO_SUCCESS)
+          {
+            result = resolve_datum(level->witness_set, output, out_datum);
+          }
+
+          cardano_credential_unref(&credential);
+          cardano_address_unref(&address);
+        }
+
+        cardano_transaction_output_unref(&output);
+        cardano_transaction_input_unref(&input);
+      }
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_REWARD:
+    {
+      cardano_reward_address_t* address = NULL;
+
+      result = _cardano_ledger_order_withdrawal_at_index(level->withdrawals, index, &address);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_credential_t* credential = cardano_reward_address_get_credential(address);
+
+        result = script_hash_from_credential(credential, out_hash);
+
+        cardano_credential_unref(&credential);
+      }
+
+      cardano_reward_address_unref(&address);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_CERTIFYING:
+    {
+      if ((level->certificates == NULL) || (index >= cardano_certificate_set_get_length(level->certificates)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_certificate_t* certificate = NULL;
+
+        result = cardano_certificate_set_get(level->certificates, (size_t)index, &certificate);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          cardano_credential_t* credential = NULL;
+
+          result = certificate_witness_credential(certificate, &credential);
+
+          if (result == CARDANO_SUCCESS)
+          {
+            result = script_hash_from_credential(credential, out_hash);
+          }
+
+          cardano_credential_unref(&credential);
+        }
+
+        cardano_certificate_unref(&certificate);
+      }
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_VOTING:
+    {
+      cardano_voter_t* voter = NULL;
+
+      result = _cardano_ledger_order_voter_at_index(level->votes, index, &voter);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_credential_t* credential = cardano_voter_get_credential(voter);
+
+        result = script_hash_from_credential(credential, out_hash);
+
+        cardano_credential_unref(&credential);
+      }
+
+      cardano_voter_unref(&voter);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_PROPOSING:
+    {
+      if ((level->proposals == NULL) || (index >= cardano_proposal_procedure_set_get_length(level->proposals)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_proposal_procedure_t* proposal = NULL;
+
+        result = cardano_proposal_procedure_set_get(level->proposals, (size_t)index, &proposal);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = proposal_policy_hash(proposal, out_hash);
+        }
+
+        cardano_proposal_procedure_unref(&proposal);
+      }
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_GUARDING:
+    {
+      if ((level->guards == NULL) || (index >= cardano_guard_set_get_length(level->guards)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_credential_t* credential = NULL;
+
+        result = cardano_guard_set_get(level->guards, (size_t)index, &credential);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = script_hash_from_credential(credential, out_hash);
+        }
+
+        cardano_credential_unref(&credential);
+      }
+
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(out_hash);
+    cardano_plutus_data_unref(out_datum);
+    *out_hash  = NULL;
+    *out_datum = NULL;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Maps a resolved script version to its ledger Plutus language version.
+ */
+static cardano_plutus_language_version_t
+plutus_language(script_version_t version)
+{
+  cardano_plutus_language_version_t result = CARDANO_PLUTUS_LANGUAGE_VERSION_V3;
+
+  switch (version)
+  {
+    case PRV_SCRIPT_V1:
+    {
+      result = CARDANO_PLUTUS_LANGUAGE_VERSION_V1;
+      break;
+    }
+    case PRV_SCRIPT_V2:
+    {
+      result = CARDANO_PLUTUS_LANGUAGE_VERSION_V2;
+      break;
+    }
+    case PRV_SCRIPT_V4:
+    {
+      result = CARDANO_PLUTUS_LANGUAGE_VERSION_V4;
+      break;
+    }
+    case PRV_SCRIPT_V3:
+    default:
+    {
+      result = CARDANO_PLUTUS_LANGUAGE_VERSION_V3;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Maps a resolved script version to the UPLC cost-model language version.
+ */
+static cardano_uplc_lang_version_t
+uplc_lang_version(script_version_t version)
+{
+  cardano_uplc_lang_version_t result = CARDANO_UPLC_LANG_VERSION_V3;
+
+  switch (version)
+  {
+    case PRV_SCRIPT_V1:
+    {
+      result = CARDANO_UPLC_LANG_VERSION_V1;
+      break;
+    }
+    case PRV_SCRIPT_V2:
+    {
+      result = CARDANO_UPLC_LANG_VERSION_V2;
+      break;
+    }
+    case PRV_SCRIPT_V4:
+    {
+      result = CARDANO_UPLC_LANG_VERSION_V4;
+      break;
+    }
+    case PRV_SCRIPT_V3:
+    default:
+    {
+      result = CARDANO_UPLC_LANG_VERSION_V3;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Selects the cost model and semantics for a script from the ledger costmdls.
+ *
+ * Reads the ordered cost vector the ledger keyed under the script's Plutus
+ * language version and selects the structured cost model and builtin semantics
+ * for that language and the protocol major version
+ * (\ref cardano_uplc_select_cost_model). When no cost model exists for the
+ * language the version default is returned, reshaped for the semantics variant
+ * of the protocol version, which keeps an under-specified host usable.
+ * Consensus-critical: the spent ex-units track the cost model the transaction
+ * was submitted under, not a hardcoded default.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a propagated error.
+ */
+static cardano_error_t
+select_cost_model(
+  native_context_t*                   ctx,
+  script_version_t                    version,
+  cardano_uplc_selected_cost_model_t* out)
+{
+  cardano_cost_model_t* cost_model = NULL;
+  cardano_error_t       result     = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+
+  if (ctx->cost_models != NULL)
+  {
+    result = cardano_costmdls_get(ctx->cost_models, plutus_language(version), &cost_model);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (cost_model == NULL))
+  {
+    result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    const int64_t* params = cardano_cost_model_get_costs(cost_model);
+    size_t         count  = cardano_cost_model_get_costs_size(cost_model);
+
+    result = cardano_uplc_select_cost_model(
+      uplc_lang_version(version),
+      ctx->protocol_major,
+      params,
+      count,
+      out);
+
+    cardano_cost_model_unref(&cost_model);
+  }
+  else
+  {
+    cardano_uplc_cost_model_version_t cm_version = cardano_uplc_cost_model_version_for_language(uplc_lang_version(version));
+
+    out->model.machine = cardano_uplc_machine_costs_default(cm_version);
+
+    switch (cm_version)
+    {
+      case CARDANO_UPLC_COST_MODEL_VERSION_V1:
+      {
+        out->model.builtins = cardano_uplc_builtin_costs_v1();
+        break;
+      }
+      case CARDANO_UPLC_COST_MODEL_VERSION_V2:
+      {
+        out->model.builtins = cardano_uplc_builtin_costs_v2();
+        break;
+      }
+      case CARDANO_UPLC_COST_MODEL_VERSION_V3:
+      case CARDANO_UPLC_COST_MODEL_VERSION_V4:
+      default:
+      {
+        out->model.builtins = cardano_uplc_builtin_costs_v3();
+        break;
+      }
+    }
+
+    out->semantics = cardano_uplc_builtin_semantics_for_language_and_protocol(uplc_lang_version(version), ctx->protocol_major);
+    result         = CARDANO_SUCCESS;
+
+    cardano_uplc_builtin_costs_select_division_shapes(&out->model.builtins, out->semantics);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Builds the version-appropriate ScriptContext for a redeemer.
+ *
+ * Dispatches to the V1, V2, V3 or V4 builder. The V3 and V4 builders embed the
+ * redeemer data and the optional datum inside the context, the V1/V2 builders
+ * carry only the TxInfo and the script purpose. The V4 context is the one of the
+ * transaction level the redeemer belongs to.
+ */
+static cardano_error_t
+build_script_context(
+  script_version_t             version,
+  cardano_transaction_t*       tx,
+  const uint64_t*              sub_tx_index,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_redeemer_t*          redeemer,
+  cardano_plutus_data_t*       datum,
+  cardano_plutus_data_t**      script_context)
+{
+  cardano_error_t result = CARDANO_ERROR_INVALID_ARGUMENT;
+
+  switch (version)
+  {
+    case PRV_SCRIPT_V1:
+    {
+      result = cardano_uplc_int_build_script_context_v1(tx, resolved_inputs, slot_config, redeemer, script_context);
+      break;
+    }
+    case PRV_SCRIPT_V2:
+    {
+      result = cardano_uplc_int_build_script_context_v2(tx, resolved_inputs, slot_config, redeemer, script_context);
+      break;
+    }
+    case PRV_SCRIPT_V3:
+    {
+      result = cardano_uplc_int_build_script_context_v3(tx, resolved_inputs, slot_config, redeemer, datum, script_context);
+      break;
+    }
+    case PRV_SCRIPT_V4:
+    default:
+    {
+      result = cardano_uplc_int_build_script_context_v4(tx, sub_tx_index, resolved_inputs, slot_config, redeemer, datum, script_context);
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Applies the version-appropriate arguments to a decoded program.
+ *
+ * V1/V2 spend applies [datum, redeemer, context]; V1/V2 non-spend applies
+ * [redeemer, context]; V3 and V4 apply [context] only, since their context
+ * already carries the redeemer and the datum.
+ */
+static cardano_error_t
+apply_arguments(
+  cardano_uplc_arena_t*         arena,
+  script_version_t              version,
+  const cardano_uplc_program_t* program,
+  cardano_redeemer_t*           redeemer,
+  cardano_plutus_data_t*        datum,
+  cardano_plutus_data_t*        script_context,
+  cardano_uplc_program_t**      out)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if ((version == PRV_SCRIPT_V3) || (version == PRV_SCRIPT_V4))
+  {
+    result = cardano_uplc_program_apply_data(arena, program, script_context, out);
+  }
+  else
+  {
+    cardano_plutus_data_t* redeemer_data = cardano_redeemer_get_data(redeemer);
+    cardano_plutus_data_t* args[3]       = { NULL, NULL, NULL };
+    size_t                 count         = 0U;
+
+    if (redeemer_data == NULL)
+    {
+      return CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    if (datum != NULL)
+    {
+      args[count] = datum;
+      ++count;
+    }
+
+    args[count] = redeemer_data;
+    ++count;
+    args[count] = script_context;
+    ++count;
+
+    result = cardano_uplc_program_apply_data_params(arena, program, args, count, out);
+
+    cardano_plutus_data_unref(&redeemer_data);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Deserialises a script the way the ledger does before evaluating it.
+ *
+ * Decodes the script for its language at \p protocol_major
+ * (\ref cardano_uplc_program_from_ledger_script): the language and every builtin
+ * it names must be available there. The Plutus Core version of the program is
+ * not checked here; the ledger checks it when evaluating the script, so an
+ * unavailable one is a phase-2 failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING when the
+ *         script cannot be deserialised, or a propagated host error.
+ */
+static cardano_error_t
+deserialise_script(
+  cardano_uplc_arena_t*          arena,
+  script_version_t               version,
+  uint64_t                       protocol_major,
+  const cardano_buffer_t*        script_bytes,
+  const cardano_uplc_program_t** program)
+{
+  return cardano_uplc_program_from_ledger_script(
+    arena,
+    cardano_buffer_get_data(script_bytes),
+    cardano_buffer_get_size(script_bytes),
+    uplc_lang_version(version),
+    protocol_major,
+    program);
+}
+
+/**
+ * \brief Returns whether a script is closed, as the ledger checks before evaluating it.
+ *
+ * Below the Dijkstra protocol version the ledger's scope check does not visit the
+ * subterms of \c constr and \c case; from Dijkstra on it visits every subterm. A
+ * script that is not closed fails phase-2 validation without being evaluated.
+ *
+ * \param[in] program The deserialised script.
+ * \param[in] protocol_major The protocol major version.
+ *
+ * \return \c true when the script passes the scope check, \c false otherwise.
+ */
+static bool
+script_is_closed(const cardano_uplc_program_t* program, const uint64_t protocol_major)
+{
+  const cardano_uplc_scope_check_mode_t mode = (protocol_major < PRV_DIJKSTRA_PROTOCOL_MAJOR)
+    ? CARDANO_UPLC_SCOPE_CHECK_NO_CASE_CONSTR
+    : CARDANO_UPLC_SCOPE_CHECK_FULL;
+
+  return cardano_uplc_term_is_closed(program->term, mode);
+}
+
+/**
+ * \brief Returns whether the result of a script is accepted.
+ *
+ * A Plutus V3 or V4 script only succeeds when it evaluates to the unit constant;
+ * any other result fails phase-2 validation, as the ledger's
+ * \c processLogsAndErrors reports \c InvalidReturnValue. V1 and V2 results are
+ * accepted as they are.
+ *
+ * \param[in] version The language version of the script.
+ * \param[in] result The discharged result term of the evaluation.
+ *
+ * \return \c true when the result is accepted, \c false otherwise.
+ */
+static bool
+result_is_accepted(const script_version_t version, const cardano_uplc_term_t* result)
+{
+  if ((version == PRV_SCRIPT_V1) || (version == PRV_SCRIPT_V2))
+  {
+    return true;
+  }
+
+  return (result->kind == CARDANO_UPLC_TERM_CONSTANT) && (result->as.constant->kind == CARDANO_UPLC_TYPE_UNIT);
+}
+
+/**
+ * \brief Releases the references held by a resolved script.
+ */
+static void
+release_resolved_script(resolved_script_t* script)
+{
+  cardano_buffer_unref(&script->script_bytes);
+  cardano_plutus_data_unref(&script->datum);
+}
+
+/**
+ * \brief Resolves the script a redeemer of a transaction level runs.
+ *
+ * Plutus V1, V2 and V3 scripts only run at the top level: like the ledger, a
+ * sub-transaction redeemer that resolves to one of them is rejected before any
+ * script runs.
+ *
+ * \param[in] tx The top-level transaction.
+ * \param[in] protocol_major The protocol major version controlling CIP-172 availability.
+ * \param[in] sub_tx_index The position of the redeemer's sub-transaction, or NULL
+ *            for the top level.
+ * \param[in] level The transaction level of the redeemer.
+ * \param[in] resolved_inputs The UTxO set resolving the inputs of every level.
+ * \param[in] redeemer The redeemer to resolve.
+ * \param[out] script The resolved script; release it with \ref release_resolved_script.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND when
+ *         the script is not provided or a V1/V2 spend has no datum,
+ *         \ref CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE for a V1, V2 or V3 script in a
+ *         sub-transaction, or a propagated error.
+ */
+static cardano_error_t
+resolve_script(
+  cardano_transaction_t* tx,
+  const uint64_t         protocol_major,
+  const uint64_t*        sub_tx_index,
+  tx_level_t*            level,
+  cardano_utxo_list_t*   resolved_inputs,
+  cardano_redeemer_t*    redeemer,
+  resolved_script_t*     script)
+{
+  cardano_blake2b_hash_t* script_hash = NULL;
+  cardano_error_t         result      = CARDANO_SUCCESS;
+
+  script->script_bytes = NULL;
+  script->version      = PRV_SCRIPT_V3;
+  script->datum        = NULL;
+
+  result = resolve_script_hash(level, resolved_inputs, redeemer, &script_hash, &script->datum);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = find_script_by_hash(tx, protocol_major, resolved_inputs, script_hash, &script->script_bytes, &script->version);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    if ((script->datum == NULL) && ((script->version == PRV_SCRIPT_V1) || (script->version == PRV_SCRIPT_V2)) && (cardano_redeemer_get_tag(redeemer) == CARDANO_REDEEMER_TAG_SPEND))
+    {
+      result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+  }
+
+  if ((result == CARDANO_SUCCESS) && (sub_tx_index != NULL) && (script->version != PRV_SCRIPT_V4))
+  {
+    result = CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+  }
+
+  cardano_blake2b_hash_unref(&script_hash);
+
+  return result;
+}
+
+/**
+ * \brief Checks that the script of a redeemer can be deserialised.
+ *
+ * The ledger deserialises every script a transaction runs, at every level,
+ * before it evaluates any of them, so a script that cannot be deserialised is
+ * reported even when another script would fail phase-2 validation. A script
+ * that cannot be deserialised for its language at the protocol version is
+ * reported through \p out_outcome, not as a host error.
+ *
+ * \return \ref CARDANO_SUCCESS when the host checked the redeemer (whatever the
+ *         outcome), or a \ref cardano_error_t when the host could not check it.
+ */
+static cardano_error_t
+check_redeemer(
+  native_context_t*      ctx,
+  cardano_transaction_t* tx,
+  const uint64_t*        sub_tx_index,
+  tx_level_t*            level,
+  cardano_utxo_list_t*   resolved_inputs,
+  cardano_redeemer_t*    redeemer,
+  redeemer_outcome_t*    out_outcome)
+{
+  resolved_script_t             script;
+  cardano_uplc_arena_t*         arena   = NULL;
+  const cardano_uplc_program_t* program = NULL;
+  cardano_error_t               result  = resolve_script(tx, ctx->protocol_major, sub_tx_index, level, resolved_inputs, redeemer, &script);
+
+  *out_outcome = PRV_REDEEMER_SUCCEEDED;
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_arena_new(PRV_ARENA_BLOCK_SIZE, &arena);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = deserialise_script(arena, script.version, ctx->protocol_major, script.script_bytes, &program);
+
+    if (result == CARDANO_ERROR_DECODING)
+    {
+      *out_outcome = PRV_REDEEMER_NOT_DESERIALISABLE;
+      result       = CARDANO_SUCCESS;
+    }
+  }
+
+  cardano_uplc_arena_free(&arena);
+  release_resolved_script(&script);
+
+  return result;
+}
+
+/**
+ * \brief Evaluates one redeemer and writes its consumed ex-units into a new redeemer.
+ *
+ * The whole evaluation runs inside a per-redeemer arena that is freed on every
+ * path. A script that fails (Plutus Core version not available at the protocol
+ * version, a free variable, error term, out of budget, unsupported builtin, or a
+ * V3 or V4 script that does not return unit) is reported through \p out_outcome,
+ * not as a host error.
+ *
+ * The CEK machine is bounded by \p remaining, the budget left for the whole
+ * transaction; on a successful evaluation the script's spent units are deducted
+ * from it so the next redeemer sees a smaller ceiling, matching the reference.
+ *
+ * \return \ref CARDANO_SUCCESS when the host ran the redeemer (whatever the script
+ *         outcome), or a \ref cardano_error_t when the host could not run it.
+ */
+static cardano_error_t
+eval_redeemer(
+  native_context_t*      ctx,
+  cardano_transaction_t* tx,
+  const uint64_t*        sub_tx_index,
+  tx_level_t*            level,
+  cardano_utxo_list_t*   resolved_inputs,
+  cardano_redeemer_t*    redeemer,
+  cardano_uplc_budget_t* remaining,
+  cardano_redeemer_t**   out_redeemer,
+  redeemer_outcome_t*    out_outcome)
+{
+  resolved_script_t             script;
+  cardano_plutus_data_t*        script_context = NULL;
+  cardano_uplc_arena_t*         arena          = NULL;
+  const cardano_uplc_program_t* program        = NULL;
+  cardano_uplc_program_t*       applied        = NULL;
+  cardano_ex_units_t*           ex_units       = NULL;
+  cardano_uplc_eval_result_t    eval_result;
+  cardano_error_t               result = CARDANO_SUCCESS;
+
+  *out_redeemer = NULL;
+  *out_outcome  = PRV_REDEEMER_SUCCEEDED;
+
+  result = resolve_script(tx, ctx->protocol_major, sub_tx_index, level, resolved_inputs, redeemer, &script);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = build_script_context(script.version, tx, sub_tx_index, resolved_inputs, &ctx->slot_config, redeemer, script.datum, &script_context);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_arena_new(PRV_ARENA_BLOCK_SIZE, &arena);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = deserialise_script(arena, script.version, ctx->protocol_major, script.script_bytes, &program);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    if (!cardano_uplc_plc_version_available(uplc_lang_version(script.version), ctx->protocol_major, program->version_major, program->version_minor, program->version_patch))
+    {
+      *out_outcome = PRV_REDEEMER_SCRIPT_FAILED;
+    }
+  }
+
+  if ((result == CARDANO_SUCCESS) && (*out_outcome == PRV_REDEEMER_SUCCEEDED))
+  {
+    if (!script_is_closed(program, ctx->protocol_major))
+    {
+      *out_outcome = PRV_REDEEMER_SCRIPT_FAILED;
+    }
+  }
+
+  if ((result == CARDANO_SUCCESS) && (*out_outcome == PRV_REDEEMER_SUCCEEDED))
+  {
+    result = apply_arguments(arena, script.version, program, redeemer, script.datum, script_context, &applied);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (*out_outcome == PRV_REDEEMER_SUCCEEDED))
+  {
+    cardano_uplc_selected_cost_model_t selected;
+
+    result = select_cost_model(ctx, script.version, &selected);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_uplc_int_evaluate_with_costs(arena, applied, &selected.model, selected.semantics, ctx->protocol_major, *remaining, &eval_result);
+    }
+  }
+
+  if ((result == CARDANO_SUCCESS) && (*out_outcome == PRV_REDEEMER_SUCCEEDED))
+  {
+    if ((eval_result.status == CARDANO_UPLC_EVAL_SUCCESS) && result_is_accepted(script.version, eval_result.result))
+    {
+      remaining->cpu -= eval_result.spent.cpu;
+      remaining->mem -= eval_result.spent.mem;
+
+      result = cardano_ex_units_new((uint64_t)eval_result.spent.mem, (uint64_t)eval_result.spent.cpu, &ex_units);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_t* redeemer_data = cardano_redeemer_get_data(redeemer);
+
+        result = cardano_redeemer_new(
+          cardano_redeemer_get_tag(redeemer),
+          cardano_redeemer_get_index(redeemer),
+          redeemer_data,
+          ex_units,
+          out_redeemer);
+
+        cardano_plutus_data_unref(&redeemer_data);
+      }
+    }
+    else
+    {
+      *out_outcome = PRV_REDEEMER_SCRIPT_FAILED;
+    }
+  }
+
+  cardano_ex_units_unref(&ex_units);
+  cardano_uplc_arena_free(&arena);
+  cardano_plutus_data_unref(&script_context);
+  release_resolved_script(&script);
+
+  return result;
+}
+
+/**
+ * \brief Stores a failure message in the evaluator, truncated to fit.
+ *
+ * \param[in,out] impl The evaluator implementation receiving the message.
+ * \param[in] message The NUL-terminated message.
+ */
+static void
+set_error_message(cardano_tx_evaluator_impl_t* impl, const char* message)
+{
+  const size_t length = cardano_safe_strlen(message, sizeof(impl->error_message) - 1U);
+
+  cardano_safe_memcpy(impl->error_message, sizeof(impl->error_message), message, length);
+  impl->error_message[length] = '\0';
+}
+
+/**
+ * \brief Maps a level number to the sub-transaction index the script context builders take.
+ *
+ * Level 0 is the top-level transaction, level \c n is the sub-transaction at
+ * position \c n - 1.
+ *
+ * \param[in] level The level number.
+ * \param[out] index The storage for the sub-transaction index.
+ *
+ * \return NULL for the top level, \p index holding the position otherwise.
+ */
+static const uint64_t*
+level_sub_tx_index(const size_t level, uint64_t* index)
+{
+  if (level == 0U)
+  {
+    return NULL;
+  }
+
+  *index = (uint64_t)level - 1U;
+
+  return index;
+}
+
+/**
+ * \brief Checks or evaluates every redeemer of a transaction level.
+ *
+ * When \p remaining is NULL the script of every redeemer is checked for
+ * deserialisation only. Otherwise every redeemer is evaluated against the shared
+ * remaining budget and, when \p out_list is not NULL, the redeemers carrying the
+ * consumed execution units are appended to it in witness set order.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING when a
+ *         script cannot be deserialised, \ref CARDANO_ERROR_SCRIPT_EVALUATION_FAILURE
+ *         when a script fails phase-2 validation, or a propagated host error.
+ */
+static cardano_error_t
+run_level(
+  cardano_tx_evaluator_impl_t* impl,
+  cardano_transaction_t*       tx,
+  const uint64_t*              sub_tx_index,
+  cardano_utxo_list_t*         resolved_inputs,
+  cardano_uplc_budget_t*       remaining,
+  cardano_redeemer_list_t*     out_list)
+{
+  native_context_t*        ctx       = (native_context_t*)((void*)impl->context);
+  cardano_redeemer_list_t* redeemers = NULL;
+  tx_level_t               level;
+  cardano_error_t          result = read_level(tx, sub_tx_index, &level);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    redeemers = cardano_witness_set_get_redeemers(level.witness_set);
+  }
+
+  for (size_t i = 0U; (result == CARDANO_SUCCESS) && (i < cardano_redeemer_list_get_length(redeemers)); ++i)
+  {
+    cardano_redeemer_t* redeemer     = NULL;
+    cardano_redeemer_t* new_redeemer = NULL;
+    redeemer_outcome_t  outcome      = PRV_REDEEMER_SUCCEEDED;
+
+    result = cardano_redeemer_list_get(redeemers, i, &redeemer);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = (remaining == NULL)
+        ? check_redeemer(ctx, tx, sub_tx_index, &level, resolved_inputs, redeemer, &outcome)
+        : eval_redeemer(ctx, tx, sub_tx_index, &level, resolved_inputs, redeemer, remaining, &new_redeemer, &outcome);
+    }
+
+    if (result == CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE)
+    {
+      set_error_message(impl, "a sub-transaction redeemer runs a Plutus V1, V2 or V3 script, which only run at the top level");
+    }
+
+    if ((result == CARDANO_SUCCESS) && (outcome == PRV_REDEEMER_NOT_DESERIALISABLE))
+    {
+      set_error_message(impl, "a redeemer's script cannot be deserialised at this protocol version");
+      result = CARDANO_ERROR_DECODING;
+    }
+
+    if ((result == CARDANO_SUCCESS) && (outcome == PRV_REDEEMER_SCRIPT_FAILED))
+    {
+      set_error_message(impl, "phase-2 validation failed for a redeemer");
+      result = CARDANO_ERROR_SCRIPT_EVALUATION_FAILURE;
+    }
+
+    if ((result == CARDANO_SUCCESS) && (out_list != NULL))
+    {
+      result = cardano_redeemer_list_add(out_list, new_redeemer);
+    }
+
+    cardano_redeemer_unref(&new_redeemer);
+    cardano_redeemer_unref(&redeemer);
+  }
+
+  cardano_redeemer_list_unref(&redeemers);
+  release_level(&level);
+
+  return result;
+}
+
+/**
+ * \brief The \ref cardano_tx_evaluate_func_t entry of the native evaluator.
+ *
+ * Evaluates the redeemers of the top-level transaction and of every
+ * sub-transaction together, as the ledger evaluates a Dijkstra transaction as a
+ * whole: the scripts of every level are first deserialised, and only then
+ * evaluated, top level first and then each sub-transaction in order. The
+ * transaction's own inputs and those of its sub-transactions must be resolvable
+ * in the additional UTxOs. The returned redeemer list carries the computed
+ * ex-units of the level the evaluator is bound to: the top-level transaction, or
+ * one sub-transaction. A script that cannot be deserialised for its language at
+ * the protocol version (an unavailable language or builtin, or a malformed
+ * script) is reported as \ref CARDANO_ERROR_DECODING, and a script that fails
+ * phase-2 validation (including a Plutus Core version not available at the
+ * protocol version and a script with a free variable) as
+ * \ref CARDANO_ERROR_SCRIPT_EVALUATION_FAILURE, each with an error message
+ * naming the failure.
+ */
+static cardano_error_t
+evaluate_transaction(
+  cardano_tx_evaluator_impl_t* impl,
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         additional_utxos,
+  cardano_redeemer_list_t**    redeemers)
+{
+  native_context_t*              ctx       = NULL;
+  cardano_transaction_body_t*    body      = NULL;
+  cardano_sub_transaction_set_t* subs      = NULL;
+  cardano_redeemer_list_t*       out_list  = NULL;
+  size_t                         sub_count = 0U;
+  cardano_uplc_budget_t          remaining;
+  cardano_error_t                result = CARDANO_SUCCESS;
+
+  if ((impl == NULL) || (tx == NULL) || (redeemers == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  ctx       = (native_context_t*)((void*)impl->context);
+  body      = cardano_transaction_get_body(tx);
+  subs      = cardano_transaction_body_get_sub_transactions(body);
+  sub_count = cardano_sub_transaction_set_get_length(subs);
+
+  cardano_sub_transaction_set_unref(&subs);
+  cardano_transaction_body_unref(&body);
+
+  if (ctx->has_sub_tx_index)
+  {
+    tx_level_t target;
+
+    result = read_level(tx, &ctx->sub_tx_index, &target);
+    release_level(&target);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      set_error_message(impl, "the transaction has no sub-transaction at the evaluated position");
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_redeemer_list_new(&out_list);
+  }
+
+  for (size_t level = 0U; (result == CARDANO_SUCCESS) && (level <= sub_count); ++level)
+  {
+    uint64_t index = 0U;
+
+    result = run_level(impl, tx, level_sub_tx_index(level, &index), additional_utxos, NULL, NULL);
+  }
+
+  remaining.cpu = PRV_MAX_CPU;
+  remaining.mem = PRV_MAX_MEM;
+
+  for (size_t level = 0U; (result == CARDANO_SUCCESS) && (level <= sub_count); ++level)
+  {
+    uint64_t        index     = 0U;
+    const uint64_t* sub_index = level_sub_tx_index(level, &index);
+    const bool      is_target = (sub_index == NULL) ? !ctx->has_sub_tx_index : (ctx->has_sub_tx_index && (ctx->sub_tx_index == index));
+
+    result = run_level(impl, tx, sub_index, additional_utxos, &remaining, is_target ? out_list : NULL);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *redeemers = out_list;
+  }
+  else
+  {
+    cardano_redeemer_list_unref(&out_list);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Creates a native evaluator bound to one transaction level.
+ *
+ * \param[in] slot_config The slot/time parameters. Must not be NULL.
+ * \param[in] cost_models The ledger cost models, or NULL.
+ * \param[in] protocol_major The protocol major version.
+ * \param[in] sub_tx_index The position of the sub-transaction whose redeemers the
+ *            evaluator returns, or NULL for the top-level transaction.
+ * \param[out] tx_evaluator On success, the new evaluator.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p slot_config or \p tx_evaluator is NULL, or a propagated error.
+ */
+static cardano_error_t
+new_native_evaluator(
+  const cardano_slot_config_t* slot_config,
+  cardano_costmdls_t*          cost_models,
+  const uint64_t               protocol_major,
+  const uint64_t*              sub_tx_index,
+  cardano_tx_evaluator_t**     tx_evaluator)
+{
+  cardano_tx_evaluator_impl_t impl = { { 0 }, { 0 }, NULL, NULL };
+  native_context_t*           ctx  = NULL;
+  cardano_error_t             result;
+
+  if ((slot_config == NULL) || (tx_evaluator == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  ctx = (native_context_t*)_cardano_malloc(sizeof(native_context_t));
+
+  if (ctx == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  ctx->base.ref_count     = 1U;
+  ctx->base.deallocator   = context_deallocate;
+  ctx->base.last_error[0] = '\0';
+  ctx->slot_config        = *slot_config;
+  ctx->cost_models        = cost_models;
+  ctx->protocol_major     = protocol_major;
+  ctx->has_sub_tx_index   = (sub_tx_index != NULL);
+  ctx->sub_tx_index       = (sub_tx_index != NULL) ? *sub_tx_index : 0U;
+
+  if (cost_models != NULL)
+  {
+    cardano_costmdls_ref(cost_models);
+  }
+
+  impl.context  = (cardano_object_t*)((void*)ctx);
+  impl.evaluate = evaluate_transaction;
+
+  cardano_safe_memcpy(impl.name, sizeof(impl.name), PRV_EVALUATOR_NAME, cardano_safe_strlen(PRV_EVALUATOR_NAME, sizeof(impl.name) - 1U));
+
+  result = cardano_tx_evaluator_new(impl, tx_evaluator);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_object_t* base = &ctx->base;
+    cardano_object_unref(&base);
+  }
+
+  return result;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_tx_evaluator_new_native(
+  const cardano_slot_config_t* slot_config,
+  cardano_costmdls_t*          cost_models,
+  uint64_t                     protocol_major,
+  cardano_tx_evaluator_t**     tx_evaluator)
+{
+  return new_native_evaluator(slot_config, cost_models, protocol_major, NULL, tx_evaluator);
+}
+
+cardano_error_t
+cardano_tx_evaluator_new_native_sub_transaction(
+  const cardano_slot_config_t* slot_config,
+  cardano_costmdls_t*          cost_models,
+  uint64_t                     protocol_major,
+  uint64_t                     sub_tx_index,
+  cardano_tx_evaluator_t**     tx_evaluator)
+{
+  return new_native_evaluator(slot_config, cost_models, protocol_major, &sub_tx_index, tx_evaluator);
+}
diff --git a/vendor/src/transaction_builder/evaluation/provider_tx_evaluator.c b/vendor/src/transaction_builder/evaluation/provider_tx_evaluator.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/evaluation/provider_tx_evaluator.c
@@ -0,0 +1,98 @@
+/**
+ * \file provider_tx_evaluator.c
+ *
+ * \author angel.castillo
+ * \date   Nov 05, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+
+#include "../../string_safe.h"
+
+#include <assert.h>
+#include <cardano/providers/provider.h>
+#include <cardano/transaction_builder/evaluation/provider_tx_evaluator.h>
+#include <string.h>
+
+/* STATIC FUNCTIONS ************************************************************/
+
+/**
+ * \brief Selects UTXOs from the available list and pre-selected UTXOs to meet the target value.
+ *
+ * This function selects UTXOs from both the pre-selected UTXO list and available UTXOs to meet a specified target value.
+ * The selected UTXOs are stored in the `selection` list, and any remaining UTXOs are stored in the `remaining_utxo` list.
+ *
+ * \param[in] coin_selector A pointer to the coin selector implementation object.
+ * \param[in] pre_selected_utxo A list of pre-selected UTXOs that must be included in the final selection.
+ * \param[in] available_utxo A list of available UTXOs to select from.
+ * \param[in] target A pointer to a \ref cardano_value_t object that defines the target amount of ADA and assets.
+ * \param[out] selection A pointer to the list of selected UTXOs that meet the target value.
+ * \param[out] remaining_utxo A pointer to the list of UTXOs that were not selected and remain available for future transactions.
+ *
+ * \return \ref CARDANO_SUCCESS if UTXOs were successfully selected, or an appropriate error code indicating failure.
+ */
+static cardano_error_t
+evaluate(
+  cardano_tx_evaluator_impl_t* tx_evaluator_impl,
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         additional_utxos,
+  cardano_redeemer_list_t**    redeemers)
+{
+  assert(tx_evaluator_impl != NULL);
+  assert(tx_evaluator_impl->context != NULL);
+  assert(tx != NULL);
+  assert(redeemers != NULL);
+
+  cardano_provider_t* provider = (cardano_provider_t*)((void*)tx_evaluator_impl->context);
+
+  return cardano_provider_evaluate_transaction(provider, tx, additional_utxos, redeemers);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_tx_evaluator_from_provider(
+  cardano_provider_t*      provider,
+  cardano_tx_evaluator_t** tx_evaluator)
+{
+  cardano_tx_evaluator_impl_t impl = { 0 };
+
+  if ((provider == NULL) || (tx_evaluator == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_provider_ref(provider);
+  impl.context = (cardano_object_t*)((void*)provider);
+
+  static const char* evaluator_name = "Provider transaction evaluator";
+  cardano_safe_memcpy(impl.name, sizeof(impl.name), evaluator_name, cardano_safe_strlen(evaluator_name, sizeof(impl.name)));
+
+  impl.evaluate = evaluate;
+
+  cardano_error_t result = cardano_tx_evaluator_new(impl, tx_evaluator);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_provider_unref(&provider);
+  }
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/evaluation/tx_evaluator.c b/vendor/src/transaction_builder/evaluation/tx_evaluator.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/evaluation/tx_evaluator.c
@@ -0,0 +1,193 @@
+/**
+ * \file tx_evaluator.c
+ *
+ * \author angel.castillo
+ * \date   Nov 05, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/transaction_builder/evaluation/tx_evaluator.h>
+
+#include "../../allocators.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Opaque structure for a transaction evaluator.
+ *
+ * The `cardano_tx_evaluator_t` structure serves as the public-facing handle for managing
+ * the transaction evaluation process within the Cardano framework.
+ */
+typedef struct cardano_tx_evaluator_t
+{
+    cardano_object_t            base;
+    cardano_tx_evaluator_impl_t impl;
+} cardano_tx_evaluator_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a tx_evaluator object.
+ *
+ * This function is responsible for properly deallocating a tx_evaluator object (`cardano_tx_evaluator_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the tx_evaluator object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_tx_evaluator_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the tx_evaluator
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_tx_evaluator_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_tx_evaluator_t* tx_evaluator = (cardano_tx_evaluator_t*)object;
+
+  cardano_object_unref(&tx_evaluator->impl.context);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_tx_evaluator_new(
+  cardano_tx_evaluator_impl_t impl,
+  cardano_tx_evaluator_t**    tx_evaluator)
+{
+  if (tx_evaluator == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *tx_evaluator = _cardano_malloc(sizeof(cardano_tx_evaluator_t));
+
+  if (*tx_evaluator == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*tx_evaluator)->base.deallocator   = cardano_tx_evaluator_deallocate;
+  (*tx_evaluator)->base.ref_count     = 1;
+  (*tx_evaluator)->base.last_error[0] = '\0';
+
+  (*tx_evaluator)->impl = impl;
+
+  // Make sure tx_evaluator name is null terminated
+  (*tx_evaluator)->impl.name[sizeof((*tx_evaluator)->impl.name) - 1U] = '\0';
+  (*tx_evaluator)->impl.error_message[0]                              = '\0';
+
+  return CARDANO_SUCCESS;
+}
+
+const char*
+cardano_tx_evaluator_get_name(const cardano_tx_evaluator_t* tx_evaluator)
+{
+  if (tx_evaluator == NULL)
+  {
+    return "";
+  }
+
+  return tx_evaluator->impl.name;
+}
+
+cardano_error_t
+cardano_tx_evaluator_evaluate(
+  cardano_tx_evaluator_t*   tx_evaluator,
+  cardano_transaction_t*    tx,
+  cardano_utxo_list_t*      additional_utxos,
+  cardano_redeemer_list_t** redeemers)
+{
+  if ((tx_evaluator == NULL) || (tx == NULL) || (redeemers == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (tx_evaluator->impl.evaluate == NULL)
+  {
+    return CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+
+  cardano_error_t result = tx_evaluator->impl.evaluate(&tx_evaluator->impl, tx, additional_utxos, redeemers);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_tx_evaluator_set_last_error(tx_evaluator, tx_evaluator->impl.error_message);
+  }
+
+  return result;
+}
+
+void
+cardano_tx_evaluator_unref(cardano_tx_evaluator_t** tx_evaluator)
+{
+  if ((tx_evaluator == NULL) || (*tx_evaluator == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*tx_evaluator)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *tx_evaluator = NULL;
+    return;
+  }
+}
+
+void
+cardano_tx_evaluator_ref(cardano_tx_evaluator_t* tx_evaluator)
+{
+  if (tx_evaluator == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&tx_evaluator->base);
+}
+
+size_t
+cardano_tx_evaluator_refcount(const cardano_tx_evaluator_t* tx_evaluator)
+{
+  if (tx_evaluator == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&tx_evaluator->base);
+}
+
+void
+cardano_tx_evaluator_set_last_error(cardano_tx_evaluator_t* tx_evaluator, const char* message)
+{
+  cardano_object_set_last_error(&tx_evaluator->base, message);
+}
+
+const char*
+cardano_tx_evaluator_get_last_error(const cardano_tx_evaluator_t* tx_evaluator)
+{
+  return cardano_object_get_last_error(&tx_evaluator->base);
+}
diff --git a/vendor/src/transaction_builder/fee.c b/vendor/src/transaction_builder/fee.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/fee.c
@@ -0,0 +1,1781 @@
+/**
+ * \file fee.c
+ *
+ * \author angel.castillo
+ * \date   Oct 13, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/scripts/native_scripts/native_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v1_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v2_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v3_script.h>
+#include <cardano/scripts/plutus_scripts/plutus_v4_script.h>
+#include <cardano/scripts/script.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+#include <cardano/transaction_builder/fee.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The tiered pricing model of the reference scripts: the size of a tier and the factor that scales the per byte
+ * price from one tier to the next, as the fraction multiplier_numerator / multiplier_denominator.
+ */
+typedef struct
+{
+    uint64_t stride;
+    uint64_t multiplier_numerator;
+    uint64_t multiplier_denominator;
+} ref_script_tiers_t;
+
+/**
+ * \brief The per byte price of a tier of the tiered pricing model, kept as a mixed number: an integer part plus the
+ * fraction fraction / denominator, which is lower than one.
+ */
+typedef struct
+{
+    uint64_t integer;
+    uint64_t fraction;
+    uint64_t denominator;
+} tier_price_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Computes the greatest common divisor of two integers with Euclid's algorithm.
+ *
+ * \param[in] a The first integer.
+ * \param[in] b The second integer.
+ *
+ * \return The greatest common divisor of the two integers, or \p a when \p b is zero.
+ */
+static uint64_t
+compute_greatest_common_divisor(const uint64_t a, const uint64_t b)
+{
+  uint64_t dividend = a;
+  uint64_t divisor  = b;
+
+  while (divisor != 0U)
+  {
+    const uint64_t remainder = dividend % divisor;
+
+    dividend = divisor;
+    divisor  = remainder;
+  }
+
+  return dividend;
+}
+
+/**
+ * \brief Multiplies two integers and reports whether the product fits in 64 bits.
+ *
+ * \param[in]  a       The first factor.
+ * \param[in]  b       The second factor.
+ * \param[out] product The product of the two factors. It is only written when the product fits.
+ *
+ * \return \ref CARDANO_SUCCESS if the product fits in 64 bits, or \ref CARDANO_ERROR_INTEGER_OVERFLOW otherwise.
+ */
+static cardano_error_t
+checked_multiply(const uint64_t a, const uint64_t b, uint64_t* product)
+{
+  if ((b != 0U) && (a > (UINT64_MAX / b)))
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  *product = a * b;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Adds two integers and reports whether the sum fits in 64 bits.
+ *
+ * \param[in]  a   The first term.
+ * \param[in]  b   The second term.
+ * \param[out] sum The sum of the two terms. It is only written when the sum fits.
+ *
+ * \return \ref CARDANO_SUCCESS if the sum fits in 64 bits, or \ref CARDANO_ERROR_INTEGER_OVERFLOW otherwise.
+ */
+static cardano_error_t
+checked_add(const uint64_t a, const uint64_t b, uint64_t* sum)
+{
+  if (a > (UINT64_MAX - b))
+  {
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  *sum = a + b;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Divides two integers, rounding the quotient up.
+ *
+ * \param[in] dividend The dividend.
+ * \param[in] divisor  The divisor, not zero.
+ *
+ * \return The smallest integer that is not lower than \p dividend / \p divisor.
+ */
+static uint64_t
+divide_rounding_up(const uint64_t dividend, const uint64_t divisor)
+{
+  return (dividend / divisor) + (((dividend % divisor) != 0U) ? 1U : 0U);
+}
+
+/**
+ * \brief Replaces a fraction by a fraction that is not lower and has a denominator half as large.
+ *
+ * The numerator is halved rounding up and the denominator is halved rounding down, so the new fraction is at least
+ * the old one.
+ *
+ * \param[in,out] numerator   The numerator of the fraction.
+ * \param[in,out] denominator The denominator of the fraction, at least 2.
+ */
+static void
+halve_fraction(uint64_t* numerator, uint64_t* denominator)
+{
+  *numerator   = (*numerator / 2U) + (*numerator % 2U);
+  *denominator = *denominator / 2U;
+}
+
+/**
+ * \brief Adds a fraction below one to a running sum kept as a whole part and a remainder over the same denominator.
+ *
+ * \param[in]     value       The numerator of the fraction, lower than \p denominator.
+ * \param[in]     denominator The denominator of the fraction and of the remainder.
+ * \param[in,out] whole       The whole part of the running sum.
+ * \param[in,out] remainder   The remainder of the running sum, lower than \p denominator.
+ *
+ * \return \ref CARDANO_SUCCESS if the fraction was added, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if the whole part does
+ *         not fit in 64 bits.
+ */
+static cardano_error_t
+add_fraction(
+  const uint64_t value,
+  const uint64_t denominator,
+  uint64_t*      whole,
+  uint64_t*      remainder)
+{
+  const uint64_t carry_limit = denominator - value;
+
+  if (*remainder >= carry_limit)
+  {
+    *remainder -= carry_limit;
+
+    return checked_add(*whole, 1U, whole);
+  }
+
+  *remainder += value;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Multiplies a fraction below one by an integer, giving the integer part and the remainder of the product.
+ *
+ * The product is built bit by bit, doubling and adding over the denominator, so no intermediate value exceeds the
+ * denominator and the computation never overflows, whatever the size of the factor and of the denominator.
+ *
+ * \param[in]  value     The numerator of the fraction, lower than \p divisor.
+ * \param[in]  factor    The integer the fraction is multiplied by.
+ * \param[in]  divisor   The denominator of the fraction, not zero.
+ * \param[out] quotient  The integer part of \p value times \p factor over \p divisor, which is lower than \p factor when
+ *                       \p factor is not zero, and zero otherwise.
+ * \param[out] remainder The remainder of \p value times \p factor over \p divisor.
+ *
+ * \return \ref CARDANO_SUCCESS, since the quotient is never larger than \p factor and always fits in 64 bits.
+ */
+static cardano_error_t
+multiply_fraction(
+  const uint64_t value,
+  const uint64_t factor,
+  const uint64_t divisor,
+  uint64_t*      quotient,
+  uint64_t*      remainder)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  *quotient  = 0U;
+  *remainder = 0U;
+
+  for (uint64_t bit = 64U; (bit > 0U) && (result == CARDANO_SUCCESS); --bit)
+  {
+    *quotient *= 2U;
+    result    = add_fraction(*remainder, divisor, quotient, remainder);
+
+    if ((result == CARDANO_SUCCESS) && (((factor >> (bit - 1U)) & 1U) != 0U))
+    {
+      result = add_fraction(value, divisor, quotient, remainder);
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Adds the price of the bytes of a tier to a running sum kept as a whole part and a remainder over the
+ * denominator of the price of the tier.
+ *
+ * \param[in]     tier_size The number of bytes of the tier.
+ * \param[in]     price     The per byte price of the tier.
+ * \param[in,out] whole     The whole part of the running sum.
+ * \param[in,out] remainder The remainder of the running sum, lower than the denominator of \p price.
+ *
+ * \return \ref CARDANO_SUCCESS if the price was added, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if the price of the
+ *         integer part of the tier or the sum does not fit in 64 bits.
+ */
+static cardano_error_t
+add_tier_price(
+  const uint64_t      tier_size,
+  const tier_price_t* price,
+  uint64_t*           whole,
+  uint64_t*           remainder)
+{
+  uint64_t integer_part       = 0U;
+  uint64_t fraction_quotient  = 0U;
+  uint64_t fraction_remainder = 0U;
+
+  cardano_error_t result = checked_multiply(tier_size, price->integer, &integer_part);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = checked_add(*whole, integer_part, whole);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = multiply_fraction(price->fraction, tier_size, price->denominator, &fraction_quotient, &fraction_remainder);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = checked_add(*whole, fraction_quotient, whole);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_fraction(fraction_remainder, price->denominator, whole, remainder);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Replaces the fraction of the per byte price of a tier and the remainder of the running sum by fractions that
+ * are not lower and have a denominator half as large.
+ *
+ * A fraction that reaches one after the halving is carried into the integer part of the price or into the whole part
+ * of the sum, so both fractions stay lower than one.
+ *
+ * \param[in,out] price     The per byte price of the tier, whose denominator is at least 2.
+ * \param[in,out] whole     The whole part of the running sum.
+ * \param[in,out] remainder The remainder of the running sum over the denominator of \p price.
+ *
+ * \return \ref CARDANO_SUCCESS if the fractions were replaced, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if a carry does
+ *         not fit in 64 bits.
+ */
+static cardano_error_t
+coarsen_tier_price(tier_price_t* price, uint64_t* whole, uint64_t* remainder)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  halve_fraction(&price->fraction, &price->denominator);
+  *remainder = (*remainder / 2U) + (*remainder % 2U);
+
+  if (price->fraction == price->denominator)
+  {
+    price->fraction = 0U;
+    result          = checked_add(price->integer, 1U, &price->integer);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (*remainder == price->denominator))
+  {
+    *remainder = 0U;
+    result     = checked_add(*whole, 1U, whole);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Scales the per byte price of a tier by the multiplier of the tiered model, giving the price of the next tier.
+ *
+ * With the price I + r / D and the multiplier n / d, the integer part I is split as q d + i with i lower than d, and
+ * the price of the next tier is q n + floor(i n / d) plus the fraction ((i n mod d) D + r n) / (D d), whose excess over
+ * one is carried into the integer part. The remainder of the running sum is moved to the new denominator, and the
+ * fraction, the denominator and the remainder are then divided by their greatest common divisor, so the denominator
+ * only grows as much as the exact prices require. Only the new integer part and the new denominator can overflow.
+ *
+ * \param[in]     tiers     The tiered pricing model, whose multiplier has a denominator that is not zero.
+ * \param[in,out] price     The per byte price of the tier, replaced by the one of the next tier.
+ * \param[in,out] remainder The remainder of the running sum over the denominator of \p price.
+ *
+ * \return \ref CARDANO_SUCCESS if the price was scaled, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if the integer part or
+ *         the denominator of the next price does not fit in 64 bits. \p price and \p remainder are only written on
+ *         success.
+ */
+static cardano_error_t
+scale_tier_price(
+  const ref_script_tiers_t* tiers,
+  tier_price_t*             price,
+  uint64_t*                 remainder)
+{
+  const uint64_t multiplier_numerator   = tiers->multiplier_numerator;
+  const uint64_t multiplier_denominator = tiers->multiplier_denominator;
+  uint64_t       next_integer           = 0U;
+  uint64_t       next_denominator       = 0U;
+  uint64_t       integer_quotient       = 0U;
+  uint64_t       integer_remainder      = 0U;
+  uint64_t       fraction_quotient      = 0U;
+  uint64_t       fraction_remainder     = 0U;
+
+  cardano_error_t result = checked_multiply(price->denominator, multiplier_denominator, &next_denominator);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = checked_multiply(price->integer / multiplier_denominator, multiplier_numerator, &next_integer);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = multiply_fraction(price->integer % multiplier_denominator, multiplier_numerator, multiplier_denominator, &integer_quotient, &integer_remainder);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = checked_add(next_integer, integer_quotient, &next_integer);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = multiply_fraction(price->fraction, multiplier_numerator, next_denominator, &fraction_quotient, &fraction_remainder);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = checked_add(next_integer, fraction_quotient, &next_integer);
+  }
+
+  uint64_t next_fraction = integer_remainder * price->denominator;
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_fraction(fraction_remainder, next_denominator, &next_integer, &next_fraction);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    const uint64_t next_remainder = *remainder * multiplier_denominator;
+    const uint64_t divisor        = compute_greatest_common_divisor(compute_greatest_common_divisor(next_denominator, next_fraction), next_remainder);
+
+    price->integer     = next_integer;
+    price->fraction    = next_fraction / divisor;
+    price->denominator = next_denominator / divisor;
+    *remainder         = next_remainder / divisor;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Prices a total size of reference scripts with the tiered model of the ledger, in exact arithmetic.
+ *
+ * The size is split in tiers of \p tiers stride bytes, the last one possibly partial. The bytes of the first tier cost
+ * \p price_numerator / \p price_denominator each and the price of every further tier is the one of the previous tier
+ * scaled by the multiplier of \p tiers. The prices are kept as exact fractions and the fee is the floor of the exact
+ * sum, taken once.
+ *
+ * The per byte price of every tier is kept as a mixed number, an integer part plus a fraction lower than one, and the
+ * sum as a whole part plus a remainder over the denominator of that fraction. The values that grow from tier to tier
+ * are therefore the integer part of the price, which is not larger than the price, and the denominator, which is the
+ * one of the exact price in lowest terms with the remainder of the sum. The products of a fraction by an integer are
+ * built without intermediate values larger than their denominator, so the computation stays exact whenever the
+ * integer parts, the denominators and the fee fit in 64 bits.
+ *
+ * \param[in]  tiers             The tiered pricing model, whose multiplier has a denominator that is not zero.
+ * \param[in]  total_size        The total size of the reference scripts, in bytes.
+ * \param[in]  price_numerator   The numerator of the price of a byte in the first tier.
+ * \param[in]  price_denominator The denominator of the price of a byte in the first tier, not zero.
+ * \param[in]  coarsen           Whether a denominator that would not fit in 64 bits is avoided by replacing the fraction
+ *                               of the price and the remainder of the sum by fractions that are not lower and have a
+ *                               denominator half as large, as often as needed. The fee is then an upper bound of the
+ *                               exact fee.
+ * \param[out] fee               The floor of the exact price of \p total_size bytes, or its upper bound when
+ *                               \p coarsen is true. It is only written on success.
+ *
+ * \return \ref CARDANO_SUCCESS if the fee was computed, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if an intermediate value
+ *         or the fee does not fit in 64 bits.
+ */
+static cardano_error_t
+compute_exact_tiered_fee(
+  const ref_script_tiers_t* tiers,
+  const uint64_t            total_size,
+  const uint64_t            price_numerator,
+  const uint64_t            price_denominator,
+  const bool                coarsen,
+  uint64_t*                 fee)
+{
+  tier_price_t    price     = { price_numerator / price_denominator, price_numerator % price_denominator, price_denominator };
+  uint64_t        whole     = 0U;
+  uint64_t        remainder = 0U;
+  uint64_t        remaining = total_size;
+  cardano_error_t result    = CARDANO_SUCCESS;
+
+  while ((remaining > 0U) && (result == CARDANO_SUCCESS))
+  {
+    const uint64_t tier_size = (remaining < tiers->stride) ? remaining : tiers->stride;
+
+    result    = add_tier_price(tier_size, &price, &whole, &remainder);
+    remaining -= tier_size;
+
+    if ((result == CARDANO_SUCCESS) && (remaining > 0U))
+    {
+      while (coarsen && (result == CARDANO_SUCCESS) && (price.denominator > (UINT64_MAX / tiers->multiplier_denominator)))
+      {
+        result = coarsen_tier_price(&price, &whole, &remainder);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = scale_tier_price(tiers, &price, &remainder);
+      }
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *fee = whole;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Prices a total size of reference scripts with the tiered model, rounding the per byte price of every tier up to
+ * a whole number of lovelace.
+ *
+ * The price of the first tier is \p price_numerator / \p price_denominator rounded up, and the price of every further
+ * tier is the price of the previous one scaled by the multiplier of \p tiers and rounded up. Every price is at least the
+ * exact price of its tier, so the fee is an upper bound of the exact fee. Its intermediate values are the prices and the
+ * fee, which do not grow with the denominator of the price.
+ *
+ * \param[in]  tiers             The tiered pricing model.
+ * \param[in]  total_size        The total size of the reference scripts, in bytes.
+ * \param[in]  price_numerator   The numerator of the price of a byte in the first tier.
+ * \param[in]  price_denominator The denominator of the price of a byte in the first tier, not zero.
+ * \param[out] fee               The upper bound of the price of \p total_size bytes. It is only written on success.
+ *
+ * \return \ref CARDANO_SUCCESS if the fee was computed, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if the fee or the price of
+ *         a tier does not fit in 64 bits.
+ */
+static cardano_error_t
+compute_rounded_up_tiered_fee(
+  const ref_script_tiers_t* tiers,
+  const uint64_t            total_size,
+  const uint64_t            price_numerator,
+  const uint64_t            price_denominator,
+  uint64_t*                 fee)
+{
+  uint64_t        tier_price = divide_rounding_up(price_numerator, price_denominator);
+  uint64_t        total      = 0U;
+  uint64_t        remaining  = total_size;
+  cardano_error_t result     = CARDANO_SUCCESS;
+
+  while ((remaining > 0U) && (result == CARDANO_SUCCESS))
+  {
+    const uint64_t tier_size = (remaining < tiers->stride) ? remaining : tiers->stride;
+    uint64_t       tier_fee  = 0U;
+
+    result = checked_multiply(tier_size, tier_price, &tier_fee);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = checked_add(total, tier_fee, &total);
+    }
+
+    remaining -= tier_size;
+
+    if ((result == CARDANO_SUCCESS) && (remaining > 0U))
+    {
+      uint64_t scaled_price = 0U;
+
+      result = checked_multiply(tier_price, tiers->multiplier_numerator, &scaled_price);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        tier_price = divide_rounding_up(scaled_price, tiers->multiplier_denominator);
+      }
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *fee = total;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Prices a total size of reference scripts in exact arithmetic after replacing the price and the multiplier by
+ * fractions that are not lower, halving their denominators until the computation fits in 64 bits.
+ *
+ * Every step halves the fraction with the larger denominator, the price when both denominators are equal. Every
+ * halving replaces a fraction by one that is not lower, and the fee grows with the price and with the multiplier, so
+ * the fee is an upper bound of the exact fee.
+ *
+ * \param[in]  tiers             The tiered pricing model, whose multiplier has a denominator that is not zero.
+ * \param[in]  total_size        The total size of the reference scripts, in bytes.
+ * \param[in]  price_numerator   The numerator of the price of a byte in the first tier.
+ * \param[in]  price_denominator The denominator of the price of a byte in the first tier, not zero.
+ * \param[out] fee               The upper bound of the price of \p total_size bytes. It is only written on success.
+ *
+ * \return \ref CARDANO_SUCCESS if the bound was computed, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if no halving made the
+ *         computation fit.
+ */
+static cardano_error_t
+compute_halved_tiered_fee(
+  const ref_script_tiers_t* tiers,
+  const uint64_t            total_size,
+  const uint64_t            price_numerator,
+  const uint64_t            price_denominator,
+  uint64_t*                 fee)
+{
+  ref_script_tiers_t halved_tiers       = *tiers;
+  uint64_t           halved_numerator   = price_numerator;
+  uint64_t           halved_denominator = price_denominator;
+  cardano_error_t    result             = CARDANO_ERROR_INTEGER_OVERFLOW;
+
+  while ((result == CARDANO_ERROR_INTEGER_OVERFLOW) && ((halved_denominator > 1U) || (halved_tiers.multiplier_denominator > 1U)))
+  {
+    if (halved_denominator >= halved_tiers.multiplier_denominator)
+    {
+      halve_fraction(&halved_numerator, &halved_denominator);
+    }
+    else
+    {
+      halve_fraction(&halved_tiers.multiplier_numerator, &halved_tiers.multiplier_denominator);
+    }
+
+    result = compute_exact_tiered_fee(&halved_tiers, total_size, halved_numerator, halved_denominator, false, fee);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Keeps the lower of a candidate fee and the best fee found so far, ignoring a candidate that was not computed.
+ *
+ * \param[in]     candidate_result The result of the computation of the candidate fee.
+ * \param[in]     candidate_fee    The candidate fee, only meaningful when \p candidate_result is \ref CARDANO_SUCCESS.
+ * \param[in,out] best_result      \ref CARDANO_SUCCESS once a fee was kept.
+ * \param[in,out] best_fee         The lowest fee kept so far.
+ */
+static void
+keep_lower_fee(
+  const cardano_error_t candidate_result,
+  const uint64_t        candidate_fee,
+  cardano_error_t*      best_result,
+  uint64_t*             best_fee)
+{
+  if (candidate_result != CARDANO_SUCCESS)
+  {
+    return;
+  }
+
+  if ((*best_result != CARDANO_SUCCESS) || (candidate_fee < *best_fee))
+  {
+    *best_fee    = candidate_fee;
+    *best_result = CARDANO_SUCCESS;
+  }
+}
+
+/**
+ * \brief Resolves the tiered pricing model of the reference scripts from the reference script cost stride and
+ * multiplier protocol parameters.
+ *
+ * A parameter that is not set takes its Conway value: a stride of 0 takes 25600 bytes and a missing multiplier takes
+ * 6/5. Parameter sets of the eras before Dijkstra do not carry them, and the ledger of those eras prices with these
+ * values.
+ *
+ * \param[in]  stride     The reference script cost stride in bytes, or 0 when it is not set.
+ * \param[in]  multiplier The reference script cost multiplier, or NULL when it is not set.
+ * \param[out] tiers      The tiered pricing model, whose stride is never zero.
+ */
+static void
+resolve_ref_script_tiers(
+  const uint64_t           stride,
+  cardano_unit_interval_t* multiplier,
+  ref_script_tiers_t*      tiers)
+{
+  static const ref_script_tiers_t conway_tiers = { 25600U, 6U, 5U };
+
+  *tiers = conway_tiers;
+
+  if (stride != 0U)
+  {
+    tiers->stride = stride;
+  }
+
+  if (multiplier != NULL)
+  {
+    tiers->multiplier_numerator   = cardano_unit_interval_get_numerator(multiplier);
+    tiers->multiplier_denominator = cardano_unit_interval_get_denominator(multiplier);
+  }
+}
+
+/**
+ * \brief Prices a total size of reference scripts with the tiered model of the ledger.
+ *
+ * The size is split in tiers of the stride of \p tiers bytes, the last one possibly partial, and the price of every
+ * tier is the one of the previous tier multiplied by the multiplier of \p tiers. The fee is computed exactly as the
+ * ledger does, the floor of the exact sum of the price of every tier taken once, whenever the denominator of the price
+ * in lowest terms times the denominator of the multiplier in lowest terms to the power of the number of tiers minus
+ * one fits in 64 bits, together with the integer parts of the prices of the tiers and the fee.
+ *
+ * When the exact computation does not fit, which happens with a price or a multiplier whose denominator is large (for
+ * example one converted from a floating point value), with many tiers or with a very large price, the fee is a
+ * conservative upper bound instead, the lowest of three bounds, none of which is lower than the exact fee:
+ * - the same computation, where a denominator that would not fit is avoided by replacing the fraction of the price
+ *   and the remainder of the sum by fractions that are not lower and have a denominator half as large. The excess is a
+ *   tiny fraction of the fee when the denominators are small and grows with them, up to about a thousandth of the fee
+ *   for a multiplier denominator around 10^15;
+ * - the exact computation with the price and the multiplier replaced, repeatedly, by fractions that are not lower,
+ *   halving the one with the larger denominator, and the price when both denominators are equal, until it fits;
+ * - the per byte price of every tier rounded up to a whole number of lovelace, which stays close to the exact fee when
+ *   the price is large.
+ *
+ * Replacing the price or the multiplier by a fraction that is not lower cannot lower the fee, since the fee grows with
+ * both.
+ *
+ * \param[in]  tiers             The tiered pricing model, whose stride is not zero.
+ * \param[in]  total_size        The total size of the reference scripts, in bytes.
+ * \param[in]  price_numerator   The numerator of the price of a byte in the first tier.
+ * \param[in]  price_denominator The denominator of the price of a byte in the first tier.
+ * \param[out] fee               The price of \p total_size bytes, or zero on failure.
+ *
+ * \return \ref CARDANO_SUCCESS if the fee was computed, \ref CARDANO_ERROR_INVALID_ARGUMENT if there are bytes to price
+ *         and \p price_denominator or the denominator of the multiplier is zero, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if
+ *         the fee, or the upper bound computed in its place, does not fit in 64 bits.
+ */
+static cardano_error_t
+compute_tiered_ref_script_fee(
+  const ref_script_tiers_t* tiers,
+  const uint64_t            total_size,
+  const uint64_t            price_numerator,
+  const uint64_t            price_denominator,
+  uint64_t*                 fee)
+{
+  *fee = 0U;
+
+  if (total_size == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  if ((price_denominator == 0U) || (tiers->multiplier_denominator == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  const uint64_t     divisor            = compute_greatest_common_divisor(price_numerator, price_denominator);
+  const uint64_t     numerator          = price_numerator / divisor;
+  const uint64_t     denominator        = price_denominator / divisor;
+  const uint64_t     multiplier_divisor = compute_greatest_common_divisor(tiers->multiplier_numerator, tiers->multiplier_denominator);
+  ref_script_tiers_t reduced_tiers      = *tiers;
+  uint64_t           exact_fee          = 0U;
+
+  reduced_tiers.multiplier_numerator   = tiers->multiplier_numerator / multiplier_divisor;
+  reduced_tiers.multiplier_denominator = tiers->multiplier_denominator / multiplier_divisor;
+
+  cardano_error_t result = compute_exact_tiered_fee(&reduced_tiers, total_size, numerator, denominator, false, &exact_fee);
+
+  if (result != CARDANO_ERROR_INTEGER_OVERFLOW)
+  {
+    *fee = exact_fee;
+
+    return result;
+  }
+
+  uint64_t        best_fee    = 0U;
+  cardano_error_t best_result = CARDANO_ERROR_INTEGER_OVERFLOW;
+  uint64_t        bound_fee   = 0U;
+
+  cardano_error_t bound_result = compute_exact_tiered_fee(&reduced_tiers, total_size, numerator, denominator, true, &bound_fee);
+  keep_lower_fee(bound_result, bound_fee, &best_result, &best_fee);
+
+  bound_result = compute_halved_tiered_fee(&reduced_tiers, total_size, numerator, denominator, &bound_fee);
+  keep_lower_fee(bound_result, bound_fee, &best_result, &best_fee);
+
+  bound_result = compute_rounded_up_tiered_fee(&reduced_tiers, total_size, numerator, denominator, &bound_fee);
+  keep_lower_fee(bound_result, bound_fee, &best_result, &best_fee);
+
+  if (best_result == CARDANO_SUCCESS)
+  {
+    *fee = best_fee;
+  }
+
+  return best_result;
+}
+
+/**
+ * \brief Computes the size of the bytes of a Plutus script: the ones the byte string of the script holds.
+ *
+ * \param[in]  script        The script, of a Plutus language.
+ * \param[in]  language      The language of \p script.
+ * \param[out] size_in_bytes The number of bytes of the script.
+ *
+ * \return \ref CARDANO_SUCCESS if the size was computed, or an appropriate error code indicating failure.
+ */
+static cardano_error_t
+get_plutus_script_size(
+  cardano_script_t*               script,
+  const cardano_script_language_t language,
+  size_t*                         size_in_bytes)
+{
+  cardano_plutus_v1_script_t* plutus_v1 = NULL;
+  cardano_plutus_v2_script_t* plutus_v2 = NULL;
+  cardano_plutus_v3_script_t* plutus_v3 = NULL;
+  cardano_plutus_v4_script_t* plutus_v4 = NULL;
+  cardano_buffer_t*           bytes     = NULL;
+  cardano_error_t             result    = CARDANO_SUCCESS;
+
+  switch (language)
+  {
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1:
+      result = cardano_script_to_plutus_v1(script, &plutus_v1);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_v1_script_to_raw_bytes(plutus_v1, &bytes);
+      }
+
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2:
+      result = cardano_script_to_plutus_v2(script, &plutus_v2);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_v2_script_to_raw_bytes(plutus_v2, &bytes);
+      }
+
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3:
+      result = cardano_script_to_plutus_v3(script, &plutus_v3);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_v3_script_to_raw_bytes(plutus_v3, &bytes);
+      }
+
+      break;
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4:
+      result = cardano_script_to_plutus_v4(script, &plutus_v4);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_v4_script_to_raw_bytes(plutus_v4, &bytes);
+      }
+
+      break;
+    default:
+      result = CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+      break;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *size_in_bytes = cardano_buffer_get_size(bytes);
+  }
+
+  cardano_buffer_unref(&bytes);
+  cardano_plutus_v1_script_unref(&plutus_v1);
+  cardano_plutus_v2_script_unref(&plutus_v2);
+  cardano_plutus_v3_script_unref(&plutus_v3);
+  cardano_plutus_v4_script_unref(&plutus_v4);
+
+  return result;
+}
+
+/**
+ * \brief Computes the size of the CBOR of a native script, the bytes it was decoded from when it was decoded.
+ *
+ * \param[in]  script        The script, of the native language.
+ * \param[out] size_in_bytes The size of the CBOR of the native script.
+ *
+ * \return \ref CARDANO_SUCCESS if the size was computed, or an appropriate error code indicating failure.
+ */
+static cardano_error_t
+get_native_script_size(cardano_script_t* script, size_t* size_in_bytes)
+{
+  cardano_native_script_t* native_script = NULL;
+  cardano_error_t          result        = cardano_script_to_native(script, &native_script);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    cardano_native_script_unref(&native_script);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_native_script_to_cbor(native_script, writer);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *size_in_bytes = cardano_cbor_writer_get_encode_size(writer);
+  }
+
+  cardano_cbor_writer_unref(&writer);
+  cardano_native_script_unref(&native_script);
+
+  return result;
+}
+
+/**
+ * \brief Multiplies an integer by a fraction, giving the integer part and the remainder of the product.
+ *
+ * \param[in]  factor      The integer.
+ * \param[in]  numerator   The numerator of the fraction.
+ * \param[in]  denominator The denominator of the fraction, not zero.
+ * \param[out] whole       The integer part of \p factor times \p numerator over \p denominator.
+ * \param[out] remainder   The remainder of \p factor times \p numerator over \p denominator, lower than \p denominator.
+ *
+ * \return \ref CARDANO_SUCCESS if the product was computed, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if its integer part
+ *         does not fit in 64 bits.
+ */
+static cardano_error_t
+multiply_by_fraction(
+  const uint64_t factor,
+  const uint64_t numerator,
+  const uint64_t denominator,
+  uint64_t*      whole,
+  uint64_t*      remainder)
+{
+  uint64_t fraction_quotient = 0U;
+
+  cardano_error_t result = checked_multiply(factor, numerator / denominator, whole);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = multiply_fraction(numerator % denominator, factor, denominator, &fraction_quotient, remainder);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = checked_add(*whole, fraction_quotient, whole);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Computes the fee of execution units as the ledger does: the ceiling of the exact price of the memory units
+ * plus the exact price of the CPU steps.
+ *
+ * Each price is split in an integer part and a remainder over the denominator of its price. The fee is the sum of the
+ * integer parts plus the ceiling of the sum of the two fractions: 0 when both are zero, 1 when their sum does not
+ * exceed one and 2 otherwise. The memory fraction m / M does not exceed one minus the steps fraction s / S exactly when
+ * m times S over M, computed as an integer part and a remainder, does not exceed S - s.
+ *
+ * Without memory units and CPU steps the fee is zero whatever the prices are, so a transaction without redeemers is
+ * never refused because of a price it does not pay.
+ *
+ * \param[in]  memory        The memory units.
+ * \param[in]  cpu_steps     The CPU steps.
+ * \param[in]  memory_prices The price of a memory unit.
+ * \param[in]  steps_prices  The price of a CPU step.
+ * \param[out] fee           The fee of the execution units. It is only written on success.
+ *
+ * \return \ref CARDANO_SUCCESS if the fee was computed, \ref CARDANO_ERROR_INVALID_ARGUMENT if there are memory
+ *         units or CPU steps to price and a price has a zero denominator, or \ref CARDANO_ERROR_INTEGER_OVERFLOW if
+ *         the fee does not fit in 64 bits.
+ */
+static cardano_error_t
+compute_ex_units_fee(
+  const uint64_t                 memory,
+  const uint64_t                 cpu_steps,
+  const cardano_unit_interval_t* memory_prices,
+  const cardano_unit_interval_t* steps_prices,
+  uint64_t*                      fee)
+{
+  const uint64_t memory_denominator = cardano_unit_interval_get_denominator(memory_prices);
+  const uint64_t steps_denominator  = cardano_unit_interval_get_denominator(steps_prices);
+
+  if ((memory == 0U) && (cpu_steps == 0U))
+  {
+    *fee = 0U;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if ((memory_denominator == 0U) || (steps_denominator == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  uint64_t memory_whole     = 0U;
+  uint64_t memory_remainder = 0U;
+  uint64_t steps_whole      = 0U;
+  uint64_t steps_remainder  = 0U;
+  uint64_t total            = 0U;
+
+  cardano_error_t result = multiply_by_fraction(memory, cardano_unit_interval_get_numerator(memory_prices), memory_denominator, &memory_whole, &memory_remainder);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = multiply_by_fraction(cpu_steps, cardano_unit_interval_get_numerator(steps_prices), steps_denominator, &steps_whole, &steps_remainder);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = checked_add(memory_whole, steps_whole, &total);
+  }
+
+  if ((result == CARDANO_SUCCESS) && ((memory_remainder != 0U) || (steps_remainder != 0U)))
+  {
+    uint64_t scaled_quotient  = 0U;
+    uint64_t scaled_remainder = 0U;
+
+    result = multiply_fraction(memory_remainder, steps_denominator, memory_denominator, &scaled_quotient, &scaled_remainder);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      const uint64_t steps_complement = steps_denominator - steps_remainder;
+      const bool     exceeds_one      = (scaled_quotient > steps_complement) || ((scaled_quotient == steps_complement) && (scaled_remainder != 0U));
+
+      result = checked_add(total, exceeds_one ? 2U : 1U, &total);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *fee = total;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Computes the size of a transaction as the ledger measures it to compute its fee.
+ *
+ * The ledger sizes a transaction as a three element array of its body, its witness set and its auxiliary data, or null
+ * when it has none. The is valid flag of the four element frame is not part of that size, whatever its value.
+ *
+ * \param[in]  transaction   The transaction.
+ * \param[out] size_in_bytes The size of the transaction for its fee. It is only written on success.
+ *
+ * \return \ref CARDANO_SUCCESS if the size was computed, or an appropriate error code indicating failure.
+ */
+static cardano_error_t
+get_transaction_size_for_fee(cardano_transaction_t* transaction, size_t* size_in_bytes)
+{
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(transaction);
+  cardano_witness_set_unref(&witness_set);
+
+  cardano_auxiliary_data_t* auxiliary_data = cardano_transaction_get_auxiliary_data(transaction);
+  cardano_auxiliary_data_unref(&auxiliary_data);
+
+  cardano_error_t result = cardano_cbor_writer_write_start_array(writer, 3);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_transaction_body_to_cbor(body, writer);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_witness_set_to_cbor(witness_set, writer);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (auxiliary_data == NULL))
+  {
+    result = cardano_cbor_writer_write_null(writer);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (auxiliary_data != NULL))
+  {
+    result = cardano_auxiliary_data_to_cbor(auxiliary_data, writer);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *size_in_bytes = cardano_cbor_writer_get_encode_size(writer);
+  }
+
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+/**
+ * \brief Adds the execution units of the redeemers of a witness set to a running total.
+ *
+ * \param[in]     witness_set The witness set whose redeemers are added.
+ * \param[in,out] cpu_steps   The running total of CPU steps.
+ * \param[in,out] memory      The running total of memory units.
+ *
+ * \return \ref CARDANO_SUCCESS if the execution units were added, or an appropriate error code.
+ */
+static cardano_error_t
+add_witness_set_ex_units(
+  cardano_witness_set_t* witness_set,
+  uint64_t*              cpu_steps,
+  uint64_t*              memory)
+{
+  cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witness_set);
+  cardano_redeemer_list_unref(&redeemers);
+
+  if (cardano_redeemer_list_get_length(redeemers) == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_ex_units_t* total_ex_units = NULL;
+
+  const cardano_error_t result = cardano_get_total_ex_units_in_redeemers(redeemers, &total_ex_units);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *cpu_steps += cardano_ex_units_get_cpu_steps(total_ex_units);
+  *memory    += cardano_ex_units_get_memory(total_ex_units);
+
+  cardano_ex_units_unref(&total_ex_units);
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Computes the total execution units of a transaction and of the sub transactions it carries.
+ *
+ * The transaction that carries sub transactions pays for the script execution of the whole batch, so the execution
+ * units of the redeemers of its witness set are added to the ones of the witness set of every sub transaction.
+ *
+ * \param[in]  tx        The transaction.
+ * \param[out] cpu_steps The total CPU steps of the batch, zero when the batch has no redeemers.
+ * \param[out] memory    The total memory units of the batch, zero when the batch has no redeemers.
+ *
+ * \return \ref CARDANO_SUCCESS if the execution units were computed, or an appropriate error code.
+ */
+static cardano_error_t
+get_batch_ex_units(
+  cardano_transaction_t* tx,
+  uint64_t*              cpu_steps,
+  uint64_t*              memory)
+{
+  *cpu_steps = 0U;
+  *memory    = 0U;
+
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(tx);
+  cardano_witness_set_unref(&witness_set);
+
+  cardano_error_t result = add_witness_set_ex_units(witness_set, cpu_steps, memory);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_sub_transaction_set_t* sub_transactions = cardano_transaction_body_get_sub_transactions(body);
+  cardano_sub_transaction_set_unref(&sub_transactions);
+
+  const size_t num_sub_transactions = cardano_sub_transaction_set_get_length(sub_transactions);
+
+  for (size_t i = 0U; i < num_sub_transactions; ++i)
+  {
+    cardano_sub_transaction_t* sub_tx = NULL;
+
+    result = cardano_sub_transaction_set_get(sub_transactions, i, &sub_tx);
+    cardano_sub_transaction_unref(&sub_tx);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_witness_set_t* sub_tx_witness_set = cardano_sub_transaction_get_witness_set(sub_tx);
+    cardano_witness_set_unref(&sub_tx_witness_set);
+
+    result = add_witness_set_ex_units(sub_tx_witness_set, cpu_steps, memory);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Prices the reference scripts of a list of resolved UTXOs with a tiered pricing model.
+ *
+ * \param[in]  resolved_reference_inputs Every resolved UTXO whose reference script is priced.
+ * \param[in]  coins_per_ref_script_byte The price of a byte in the first tier.
+ * \param[in]  tiers                     The tiered pricing model, whose stride is not zero.
+ * \param[out] script_ref_fee            The reference script fee, or zero on failure.
+ *
+ * \return \ref CARDANO_SUCCESS if the fee was computed, or an appropriate error code indicating failure.
+ */
+static cardano_error_t
+compute_ref_script_fee_with_tiers(
+  cardano_utxo_list_t*      resolved_reference_inputs,
+  cardano_unit_interval_t*  coins_per_ref_script_byte,
+  const ref_script_tiers_t* tiers,
+  uint64_t*                 script_ref_fee)
+{
+  *script_ref_fee = 0U;
+
+  size_t total_ref_scripts_size = 0U;
+
+  for (size_t i = 0U; i < cardano_utxo_list_get_length(resolved_reference_inputs); ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    cardano_error_t result = cardano_utxo_list_get(resolved_reference_inputs, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+    cardano_transaction_output_unref(&output);
+
+    if (output == NULL)
+    {
+      return CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    cardano_script_t* script = cardano_transaction_output_get_script_ref(output);
+    cardano_script_unref(&script);
+
+    if (script == NULL)
+    {
+      continue;
+    }
+
+    size_t script_size = 0U;
+
+    result = cardano_get_serialized_script_size(script, &script_size);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    total_ref_scripts_size += script_size;
+  }
+
+  return compute_tiered_ref_script_fee(
+    tiers,
+    (uint64_t)total_ref_scripts_size,
+    cardano_unit_interval_get_numerator(coins_per_ref_script_byte),
+    cardano_unit_interval_get_denominator(coins_per_ref_script_byte),
+    script_ref_fee);
+}
+
+/**
+ * \brief Computes the script part of the minimum fee of a transaction, pricing its reference scripts with a tiered
+ * pricing model.
+ *
+ * \param[in]  tx                        The transaction.
+ * \param[in]  prices                    The prices of the execution units.
+ * \param[in]  resolved_reference_inputs Every resolved UTXO whose reference script is priced.
+ * \param[in]  coins_per_ref_script_byte The price of a byte of reference script in the first tier.
+ * \param[in]  tiers                     The tiered pricing model, whose stride is not zero.
+ * \param[out] min_fee                   The script part of the minimum fee.
+ *
+ * \return \ref CARDANO_SUCCESS if the fee was computed, or an appropriate error code indicating failure.
+ */
+static cardano_error_t
+compute_min_script_fee_with_tiers(
+  cardano_transaction_t*    tx,
+  cardano_ex_unit_prices_t* prices,
+  cardano_utxo_list_t*      resolved_reference_inputs,
+  cardano_unit_interval_t*  coins_per_ref_script_byte,
+  const ref_script_tiers_t* tiers,
+  uint64_t*                 min_fee)
+{
+  uint64_t cpu_steps = 0U;
+  uint64_t memory    = 0U;
+
+  cardano_error_t result = get_batch_ex_units(tx, &cpu_steps, &memory);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_unit_interval_t* cpu_steps_prices = NULL;
+  cardano_unit_interval_t* memory_prices    = NULL;
+
+  result = cardano_ex_unit_prices_get_steps_prices(prices, &cpu_steps_prices);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_ex_unit_prices_get_memory_prices(prices, &memory_prices);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_unit_interval_unref(&cpu_steps_prices);
+    return result;
+  }
+
+  uint64_t ex_units_fee = 0U;
+
+  result = compute_ex_units_fee(memory, cpu_steps, memory_prices, cpu_steps_prices, &ex_units_fee);
+
+  cardano_unit_interval_unref(&cpu_steps_prices);
+  cardano_unit_interval_unref(&memory_prices);
+
+  uint64_t ref_script_fee = 0U;
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = compute_ref_script_fee_with_tiers(resolved_reference_inputs, coins_per_ref_script_byte, tiers, &ref_script_fee);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = checked_add(ex_units_fee, ref_script_fee, min_fee);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *min_fee = 0U;
+  }
+
+  return result;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_get_serialized_coin_size(const uint64_t lovelace, size_t* size_in_bytes)
+{
+  if (size_in_bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_cbor_writer_write_uint(writer, lovelace);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+
+    return result;
+  }
+
+  *size_in_bytes = cardano_cbor_writer_get_encode_size(writer);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_get_serialized_output_size(cardano_transaction_output_t* output, size_t* size_in_bytes)
+{
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size_in_bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_transaction_output_to_cbor(output, writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+
+    return result;
+  }
+
+  *size_in_bytes = cardano_cbor_writer_get_encode_size(writer);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_get_serialized_script_size(cardano_script_t* script, size_t* size_in_bytes)
+{
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size_in_bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_language_t language = CARDANO_SCRIPT_LANGUAGE_NATIVE;
+  cardano_error_t           result   = cardano_script_get_language(script, &language);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (language == CARDANO_SCRIPT_LANGUAGE_NATIVE)
+  {
+    return get_native_script_size(script, size_in_bytes);
+  }
+
+  return get_plutus_script_size(script, language, size_in_bytes);
+}
+
+cardano_error_t
+cardano_get_serialized_transaction_size(cardano_transaction_t* transaction, size_t* size_in_bytes)
+{
+  if (transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (size_in_bytes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_transaction_to_cbor(transaction, writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+
+    return result;
+  }
+
+  *size_in_bytes = cardano_cbor_writer_get_encode_size(writer);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_get_total_ex_units_in_redeemers(cardano_redeemer_list_t* redeemers, cardano_ex_units_t** total)
+{
+  if (redeemers == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (total == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ex_units_t* total_ex_units = NULL;
+  cardano_error_t     result         = cardano_ex_units_new(0, 0, &total_ex_units);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0U; i < cardano_redeemer_list_get_length(redeemers); ++i)
+  {
+    cardano_redeemer_t* redeemer = NULL;
+
+    result = cardano_redeemer_list_get(redeemers, i, &redeemer);
+    cardano_redeemer_unref(&redeemer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_ex_units_unref(&total_ex_units);
+      return result;
+    }
+
+    cardano_ex_units_t* ex_units = cardano_redeemer_get_ex_units(redeemer);
+    cardano_ex_units_unref(&ex_units);
+
+    if (ex_units == NULL)
+    {
+      cardano_ex_units_unref(&total_ex_units);
+      result = CARDANO_ERROR_GENERIC;
+
+      return result;
+    }
+
+    const uint64_t cpu_steps = cardano_ex_units_get_cpu_steps(ex_units);
+    const uint64_t memory    = cardano_ex_units_get_memory(ex_units);
+
+    result = cardano_ex_units_set_cpu_steps(total_ex_units, cardano_ex_units_get_cpu_steps(total_ex_units) + cpu_steps);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_ex_units_unref(&total_ex_units);
+      return result;
+    }
+
+    result = cardano_ex_units_set_memory(total_ex_units, cardano_ex_units_get_memory(total_ex_units) + memory);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_ex_units_unref(&total_ex_units);
+      return result;
+    }
+  }
+
+  *total = total_ex_units;
+
+  return result;
+}
+
+cardano_error_t
+cardano_compute_script_ref_fee(
+  cardano_utxo_list_t*     resolved_reference_inputs,
+  cardano_unit_interval_t* coins_per_ref_script_byte,
+  uint64_t*                script_ref_fee)
+{
+  if (resolved_reference_inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (coins_per_ref_script_byte == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_ref_fee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  ref_script_tiers_t tiers = { 0U, 0U, 0U };
+
+  resolve_ref_script_tiers(0U, NULL, &tiers);
+
+  return compute_ref_script_fee_with_tiers(resolved_reference_inputs, coins_per_ref_script_byte, &tiers, script_ref_fee);
+}
+
+cardano_error_t
+cardano_compute_script_ref_fee_with_params(
+  cardano_utxo_list_t*           resolved_reference_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  uint64_t*                      script_ref_fee)
+{
+  if (resolved_reference_inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script_ref_fee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_t* coins_per_ref_script_byte = cardano_protocol_parameters_get_ref_script_cost_per_byte(protocol_params);
+  cardano_unit_interval_t* multiplier                = cardano_protocol_parameters_get_ref_script_cost_multiplier(protocol_params);
+  ref_script_tiers_t       tiers                     = { 0U, 0U, 0U };
+
+  cardano_unit_interval_unref(&coins_per_ref_script_byte);
+  cardano_unit_interval_unref(&multiplier);
+
+  if (coins_per_ref_script_byte == NULL)
+  {
+    *script_ref_fee = 0U;
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  resolve_ref_script_tiers(cardano_protocol_parameters_get_ref_script_cost_stride(protocol_params), multiplier, &tiers);
+
+  return compute_ref_script_fee_with_tiers(resolved_reference_inputs, coins_per_ref_script_byte, &tiers, script_ref_fee);
+}
+
+cardano_error_t
+cardano_compute_min_script_fee(
+  cardano_transaction_t*    tx,
+  cardano_ex_unit_prices_t* prices,
+  cardano_utxo_list_t*      resolved_reference_inputs,
+  cardano_unit_interval_t*  coins_per_ref_script_byte,
+  uint64_t*                 min_fee)
+{
+  if (tx == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (resolved_reference_inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (coins_per_ref_script_byte == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (min_fee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  ref_script_tiers_t tiers = { 0U, 0U, 0U };
+
+  resolve_ref_script_tiers(0U, NULL, &tiers);
+
+  return compute_min_script_fee_with_tiers(tx, prices, resolved_reference_inputs, coins_per_ref_script_byte, &tiers, min_fee);
+}
+
+cardano_error_t
+cardano_compute_min_fee_without_scripts(
+  cardano_transaction_t* tx,
+  const uint64_t         min_fee_constant,
+  const uint64_t         min_fee_coefficient,
+  uint64_t*              min_fee)
+{
+  if (tx == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (min_fee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t   size_in_bytes = 0U;
+  uint64_t size_fee      = 0U;
+
+  cardano_error_t result = get_transaction_size_for_fee(tx, &size_in_bytes);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = checked_multiply(min_fee_coefficient, (uint64_t)size_in_bytes, &size_fee);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = checked_add(min_fee_constant, size_fee, min_fee);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_compute_min_ada_required(
+  cardano_transaction_output_t* output,
+  const uint64_t                coins_per_utxo_byte,
+  uint64_t*                     lovelace_required)
+{
+  // The constant overhead of 160 bytes accounts for the transaction input
+  // and the entry in the UTxO map data structure (20 words * 8 bytes).
+  static const size_t min_ada_overhead = 160U;
+
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (lovelace_required == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_value_t* value = cardano_transaction_output_get_value(output);
+  cardano_value_unref(&value);
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t          old_coin_size = 0U;
+  size_t          output_size   = 0U;
+  cardano_error_t result        = cardano_get_serialized_coin_size(cardano_value_get_coin(value), &old_coin_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_get_serialized_output_size(output, &output_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  size_t last_size = old_coin_size;
+  bool   is_done   = false;
+
+  while (!is_done)
+  {
+    size_t   size_diff         = last_size - old_coin_size;
+    uint64_t tentative_min_ada = (output_size + min_ada_overhead + size_diff) * coins_per_utxo_byte;
+
+    size_t new_coin_size = 0U;
+
+    result = cardano_get_serialized_coin_size(tentative_min_ada, &new_coin_size);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    is_done   = (new_coin_size == last_size);
+    last_size = new_coin_size;
+  }
+
+  size_t size_change = last_size - old_coin_size;
+
+  *lovelace_required = (output_size + size_change + min_ada_overhead) * coins_per_utxo_byte;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_compute_transaction_fee(
+  cardano_transaction_t*         transaction,
+  cardano_utxo_list_t*           resolved_inputs,
+  cardano_protocol_parameters_t* protocol_params,
+  uint64_t*                      fee)
+{
+  if (transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (resolved_inputs == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (protocol_params == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (fee == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ex_unit_prices_t* prices                    = cardano_protocol_parameters_get_execution_costs(protocol_params);
+  const uint64_t            min_fee_coefficient       = cardano_protocol_parameters_get_min_fee_a(protocol_params);
+  const uint64_t            min_fee_constant          = cardano_protocol_parameters_get_min_fee_b(protocol_params);
+  cardano_unit_interval_t*  coins_per_ref_script_byte = cardano_protocol_parameters_get_ref_script_cost_per_byte(protocol_params);
+  cardano_unit_interval_t*  ref_script_multiplier     = cardano_protocol_parameters_get_ref_script_cost_multiplier(protocol_params);
+  ref_script_tiers_t        tiers                     = { 0U, 0U, 0U };
+
+  cardano_ex_unit_prices_unref(&prices);
+  cardano_unit_interval_unref(&coins_per_ref_script_byte);
+  cardano_unit_interval_unref(&ref_script_multiplier);
+
+  if (prices == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (coins_per_ref_script_byte == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  resolve_ref_script_tiers(cardano_protocol_parameters_get_ref_script_cost_stride(protocol_params), ref_script_multiplier, &tiers);
+
+  uint64_t        min_script_fee = 0U;
+  cardano_error_t result         = compute_min_script_fee_with_tiers(transaction, prices, resolved_inputs, coins_per_ref_script_byte, &tiers, &min_script_fee);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  uint64_t no_script_fee = 0U;
+
+  result = cardano_compute_min_fee_without_scripts(transaction, min_fee_constant, min_fee_coefficient, &no_script_fee);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return checked_add(min_script_fee, no_script_fee, fee);
+}
diff --git a/vendor/src/transaction_builder/internals/blake2b_hash_to_redeemer_map.c b/vendor/src/transaction_builder/internals/blake2b_hash_to_redeemer_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/blake2b_hash_to_redeemer_map.c
@@ -0,0 +1,483 @@
+/**
+ * \file map.c
+ *
+ * \author angel.castillo
+ * \date   Nov 11, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "blake2b_hash_to_redeemer_map.h"
+
+#include <cardano/crypto/blake2b_hash_set.h>
+
+#include "../../allocators.h"
+#include "../../collections/array.h"
+#include <assert.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/object.h>
+#include <cardano/witness_set/redeemer.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano blake2b_hash to redeemer map.
+ */
+typedef struct cardano_blake2b_hash_to_redeemer_map_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_blake2b_hash_to_redeemer_map_t;
+
+/**
+ * \brief Represents a Cardano blake2b_hash to redeemer map key value pair.
+ */
+typedef struct cardano_blake2b_hash_to_redeemer_map_kvp_t
+{
+    cardano_object_t        base;
+    cardano_blake2b_hash_t* key;
+    cardano_redeemer_t*     value;
+} cardano_blake2b_hash_to_redeemer_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates the map.
+ *
+ * This function is responsible for properly deallocating a blake2b_hash to redeemer map (`cardano_blake2b_hash_to_redeemer_map_t`)
+ * and its associated resources.
+ *
+ * \param blake2b_hash A void pointer to the map blake2b_hash to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_blake2b_hash_to_redeemer_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the map
+ *       blake2b_hash reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these blake2b hashes.
+ */
+static void
+cardano_blake2b_hash_to_redeemer_map_deallocate(void* blake2b_hash)
+{
+  assert(blake2b_hash != NULL);
+
+  cardano_blake2b_hash_to_redeemer_map_t* map = (cardano_blake2b_hash_to_redeemer_map_t*)blake2b_hash;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a blake2b hash to redeemer map key value pair.
+ *
+ * This function is responsible for properly deallocating a blake2b_hash to redeemer map key value pair (`cardano_blake2b_hash_to_redeemer_map_kvp_t`)
+ * and its associated resources.
+ *
+ * \param blake2b_hash A void pointer to the map blake2b_hash to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_blake2b_hash_to_redeemer_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the map
+ *       blake2b_hash reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_blake2b_hash_to_redeemer_map_kvp_deallocate(void* blake2b_hash)
+{
+  assert(blake2b_hash != NULL);
+
+  cardano_blake2b_hash_to_redeemer_map_kvp_t* map = (cardano_blake2b_hash_to_redeemer_map_kvp_t*)blake2b_hash;
+
+  cardano_blake2b_hash_unref(&map->key);
+  cardano_redeemer_unref(&map->value);
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two objects based on their blake2b_hash.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the hash of lhs is less than the hash of rhs, zero if they are equal,
+ *         and a positive value if the hash of lhs is greater than the hash of rhs.
+ */
+static int32_t
+compare_by_bytes(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_blake2b_hash_to_redeemer_map_kvp_t* lhs_kvp = (const cardano_blake2b_hash_to_redeemer_map_kvp_t*)((const void*)lhs);
+  const cardano_blake2b_hash_to_redeemer_map_kvp_t* rhs_kvp = (const cardano_blake2b_hash_to_redeemer_map_kvp_t*)((const void*)rhs);
+
+  return cardano_blake2b_hash_compare(lhs_kvp->key, rhs_kvp->key);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_blake2b_hash_to_redeemer_map_new(cardano_blake2b_hash_to_redeemer_map_t** map)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *map = _cardano_malloc(sizeof(cardano_blake2b_hash_to_redeemer_map_t));
+
+  if ((*map) == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*map)->base.ref_count     = 1;
+  (*map)->base.last_error[0] = '\0';
+  (*map)->base.deallocator   = cardano_blake2b_hash_to_redeemer_map_deallocate;
+
+  (*map)->array = cardano_array_new(32);
+
+  if ((*map)->array == NULL)
+  {
+    _cardano_free((*map));
+    *map = NULL;
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_blake2b_hash_to_redeemer_map_get_length(const cardano_blake2b_hash_to_redeemer_map_t* map)
+{
+  if (map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(map->array);
+}
+
+cardano_error_t
+cardano_blake2b_hash_to_redeemer_map_get(
+  cardano_blake2b_hash_to_redeemer_map_t* map,
+  const cardano_blake2b_hash_t*           key,
+  cardano_redeemer_t**                    element)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(map->array); ++i)
+  {
+    cardano_object_t*                           object = cardano_array_get(map->array, i);
+    cardano_blake2b_hash_to_redeemer_map_kvp_t* kvp    = (cardano_blake2b_hash_to_redeemer_map_kvp_t*)((void*)object);
+
+    if (cardano_blake2b_hash_equals(kvp->key, key))
+    {
+      cardano_redeemer_ref(kvp->value);
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_blake2b_hash_to_redeemer_map_insert(
+  cardano_blake2b_hash_to_redeemer_map_t* map,
+  cardano_blake2b_hash_t*                 key,
+  cardano_redeemer_t*                     value)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_redeemer_t* element = NULL;
+  cardano_error_t     result  = cardano_blake2b_hash_to_redeemer_map_get(map, key, &element);
+
+  cardano_redeemer_unref(&element);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    return CARDANO_ERROR_DUPLICATED_KEY;
+  }
+
+  cardano_blake2b_hash_to_redeemer_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_blake2b_hash_to_redeemer_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_blake2b_hash_to_redeemer_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_blake2b_hash_ref(key);
+  cardano_redeemer_ref(value);
+
+  const size_t old_size = cardano_array_get_size(map->array);
+  const size_t new_size = cardano_array_push(map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_blake2b_hash_to_redeemer_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(map->array, compare_by_bytes, NULL);
+
+  // Update redeemer indices
+  for (size_t i = 0; i < cardano_array_get_size(map->array); ++i)
+  {
+    cardano_object_t* object = cardano_array_get(map->array, i);
+    cardano_object_unref(&object);
+
+    cardano_blake2b_hash_to_redeemer_map_kvp_t* entry = (cardano_blake2b_hash_to_redeemer_map_kvp_t*)((void*)object);
+
+    if ((entry == NULL) || (entry->value == NULL))
+    {
+      continue;
+    }
+
+    result = cardano_redeemer_set_index(entry->value, i);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_blake2b_hash_to_redeemer_map_get_key_at(
+  const cardano_blake2b_hash_to_redeemer_map_t* map,
+  const size_t                                  index,
+  cardano_blake2b_hash_t**                      blake2b_hash)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (blake2b_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                           object = cardano_array_get(map->array, index);
+  cardano_blake2b_hash_to_redeemer_map_kvp_t* kvp    = (cardano_blake2b_hash_to_redeemer_map_kvp_t*)((void*)object);
+
+  cardano_blake2b_hash_ref(kvp->key);
+  cardano_object_unref(&object);
+
+  *blake2b_hash = kvp->key;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_blake2b_hash_to_redeemer_map_get_value_at(
+  const cardano_blake2b_hash_to_redeemer_map_t* map,
+  size_t                                        index,
+  cardano_redeemer_t**                          redeemer)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (redeemer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                           object = cardano_array_get(map->array, index);
+  cardano_blake2b_hash_to_redeemer_map_kvp_t* kvp    = (cardano_blake2b_hash_to_redeemer_map_kvp_t*)((void*)object);
+
+  cardano_object_unref(&object);
+
+  cardano_redeemer_ref(kvp->value);
+  *redeemer = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_blake2b_hash_to_redeemer_map_get_key_value_at(
+  const cardano_blake2b_hash_to_redeemer_map_t* map,
+  size_t                                        index,
+  cardano_blake2b_hash_t**                      blake2b_hash,
+  cardano_redeemer_t**                          redeemer)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (blake2b_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (redeemer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index >= cardano_array_get_size(map->array))
+  {
+    return CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  cardano_object_t*                           object = cardano_array_get(map->array, index);
+  cardano_blake2b_hash_to_redeemer_map_kvp_t* kvp    = (cardano_blake2b_hash_to_redeemer_map_kvp_t*)((void*)object);
+
+  cardano_blake2b_hash_ref(kvp->key);
+  cardano_redeemer_ref(kvp->value);
+  cardano_object_unref(&object);
+
+  *blake2b_hash = kvp->key;
+  *redeemer     = kvp->value;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_blake2b_hash_to_redeemer_map_unref(cardano_blake2b_hash_to_redeemer_map_t** map)
+{
+  if ((map == NULL) || (*map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *map = NULL;
+    return;
+  }
+}
+
+cardano_error_t
+cardano_blake2b_hash_to_redeemer_map_update_redeemer_index(
+  cardano_blake2b_hash_to_redeemer_map_t* map,
+  cardano_blake2b_hash_t*                 blake2b_hash,
+  const uint64_t                          index)
+{
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (blake2b_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_redeemer_t* redeemer = NULL;
+  cardano_error_t     result   = cardano_blake2b_hash_to_redeemer_map_get(map, blake2b_hash, &redeemer);
+  cardano_redeemer_unref(&redeemer);
+
+  if ((result == CARDANO_ERROR_ELEMENT_NOT_FOUND) || (redeemer == NULL))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  result = cardano_redeemer_set_index(redeemer, index);
+
+  return result;
+}
+
+void
+cardano_blake2b_hash_to_redeemer_map_ref(cardano_blake2b_hash_to_redeemer_map_t* map)
+{
+  if (map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&map->base);
+}
+
+size_t
+cardano_blake2b_hash_to_redeemer_map_refcount(const cardano_blake2b_hash_to_redeemer_map_t* map)
+{
+  if (map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&map->base);
+}
+
+void
+cardano_blake2b_hash_to_redeemer_map_set_last_error(cardano_blake2b_hash_to_redeemer_map_t* map, const char* message)
+{
+  cardano_object_set_last_error(&map->base, message);
+}
+
+const char*
+cardano_blake2b_hash_to_redeemer_map_get_last_error(const cardano_blake2b_hash_to_redeemer_map_t* map)
+{
+  return cardano_object_get_last_error(&map->base);
+}
diff --git a/vendor/src/transaction_builder/internals/blake2b_hash_to_redeemer_map.h b/vendor/src/transaction_builder/internals/blake2b_hash_to_redeemer_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/blake2b_hash_to_redeemer_map.h
@@ -0,0 +1,475 @@
+/**
+ * \file blake2b_hash_to_redeemer_map.h
+ *
+ * \author angel.castillo
+ * \date   Nov 16, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BLAKE2B_HASH_TO_REDEEMER_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BLAKE2B_HASH_TO_REDEEMER_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/export.h>
+#include <cardano/witness_set/redeemer.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of blake2b hash to redeemers.
+ */
+typedef struct cardano_blake2b_hash_to_redeemer_map_t cardano_blake2b_hash_to_redeemer_map_t;
+
+/**
+ * \brief Creates and initializes a new instance of a map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_blake2b_hash_to_redeemer_map_t,
+ * representing a map structure. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] map A pointer to a pointer to a \ref cardano_blake2b_hash_to_redeemer_map_t blake2b_hash. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_blake2b_hash_to_redeemer_map_t
+ *                        blake2b_hash. This blake2b hash represents a "strong reference" to the map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this blake2b_hash. Specifically, once the map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_blake2b_hash_to_redeemer_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_to_redeemer_map_t* map = NULL;
+ *
+ * // Attempt to create a new map
+ * cardano_error_t result = cardano_blake2b_hash_to_redeemer_map_new(&blake2b_hash_to_redeemer_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the map
+ *
+ *   // Once done, ensure to clean up and release the map
+ *   cardano_blake2b_hash_to_redeemer_map_unref(&blake2b_hash_to_redeemer_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_blake2b_hash_to_redeemer_map_new(cardano_blake2b_hash_to_redeemer_map_t** map);
+
+/**
+ * \brief Retrieves the length of the map.
+ *
+ * This function returns the number of key-value pairs contained in the specified map.
+ *
+ * \param[in] map A constant pointer to the \ref cardano_blake2b_hash_to_redeemer_map_t blake2b hash for which
+ *                the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the map. Returns 0 if the map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_to_redeemer_map_t* map = cardano_blake2b_hash_to_redeemer_map_new();
+ *
+ * // Populate the map with key-value pairs
+ *
+ * size_t length = cardano_blake2b_hash_to_redeemer_map_get_length(blake2b_hash_to_redeemer_map);
+ * printf("The length of the map is: %zu\n", length);
+ *
+ * cardano_blake2b_hash_to_redeemer_map_unref(&blake2b_hash_to_redeemer_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_blake2b_hash_to_redeemer_map_get_length(const cardano_blake2b_hash_to_redeemer_map_t* map);
+
+/**
+ * \brief Retrieves the value associated with a given key in the map.
+ *
+ * This function retrieves the value associated with the specified key in the provided map.
+ * It returns the value through the output parameter `element`. If the key is not found in the map,
+ * the output parameter `element` will be set to NULL.
+ *
+ * \param[in] map A constant pointer to the \ref cardano_blake2b_hash_to_redeemer_map_t blake2b hash from which
+ *                       the value is to be retrieved.
+ * \param[in] key The key whose associated value is to be retrieved from the map.
+ * \param[out] element A pointer to a variable where the retrieved value will be stored. If the key
+ *                     is found in the map, this variable will be set to the associated value.
+ *                     If the key is not found, this variable will be set to NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the value associated with the key was successfully retrieved, or
+ *         an appropriate error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_to_redeemer_map_t* map = cardano_blake2b_hash_to_redeemer_map_new();
+ *
+ * // Populate the map with key-value pairs
+ *
+ * cardano_blake2b_hash_t* key = ...; // Create a blake2b hash representing the key
+ * cardano_redeemer_t* value = NULL;
+ * cardano_error_t result = cardano_blake2b_hash_to_redeemer_map_get(blake2b_hash_to_redeemer_map, key, &value);
+ *
+ * if (result == CARDANO_SUCCESS && value != NULL)
+ * {
+ *   // Use the retrieved value
+ *   // ...
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_blake2b_hash_unref(&key); // Clean up the key resource
+ * cardano_blake2b_hash_to_redeemer_map_unref(&blake2b_hash_to_redeemer_map);
+ * cardano_redeemer_unref(&value); // Clean up the value resource
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_to_redeemer_map_get(cardano_blake2b_hash_to_redeemer_map_t* map, const cardano_blake2b_hash_t* key, cardano_redeemer_t** element);
+
+/**
+ * \brief Inserts a key-value pair into the map.
+ *
+ * This function inserts the specified key-value pair into the provided map.
+ *
+ * \param[in] map A constant pointer to the \ref cardano_blake2b_hash_to_redeemer_map_t blake2b hash where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The key to be inserted into the map.
+ * \param[in] value The value to be associated with the key and inserted into the map.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_to_redeemer_map_t* map = cardano_blake2b_hash_to_redeemer_map_new();
+ *
+ * // Create key and value blake2b hash
+ * cardano_blake2b_hash_t* key = ...;
+ * cardano_redeemer_t* value = ...;
+ *
+ * // Insert the key-value pair into the map
+ * cardano_error_t result = cardano_blake2b_hash_to_redeemer_map_insert(blake2b_hash_to_redeemer_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value blake2b hash
+ * cardano_blake2b_hash_unref(&key);
+ *
+ * cardano_blake2b_hash_to_redeemer_map_unref(&blake2b_hash_to_redeemer_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_to_redeemer_map_insert(cardano_blake2b_hash_to_redeemer_map_t* map, cardano_blake2b_hash_t* key, cardano_redeemer_t* value);
+
+/**
+ * \brief Retrieves the blake2b hash at a specific index from the map.
+ *
+ * This function retrieves the blake2b hash at the specified index from the map.
+ *
+ * \param[in] map Pointer to the map blake2b_hash.
+ * \param[in] index The index of the blake2b hash to retrieve.
+ * \param[out] blake2b_hash On successful retrieval, this will point to the blake2b hash
+ *                            at the specified index. The caller is responsible for managing the lifecycle
+ *                            of this blake2b_hash. Specifically, once the blake2b hash is no longer needed,
+ *                            the caller must release it by calling \ref cardano_blake2b_hash_unref.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the blake2b hash was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_to_redeemer_map_t* map = NULL;
+ * cardano_blake2b_hash_t* blake2b hash = NULL;
+ * size_t index = 0; // Index of the key hash to retrieve
+ *
+ * // Assume map is initialized properly
+ *
+ * cardano_error_t result = cardano_blake2b_hash_to_redeemer_map_get_key_at(blake2b_hash_to_redeemer_map, index, &blake2b_hash);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the blake2b_hash
+ *
+ *   // Once done, ensure to clean up and release the blake2b_hash
+ *   cardano_blake2b_hash_unref(&blake2b_hash);
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_to_redeemer_map_get_key_at(
+  const cardano_blake2b_hash_to_redeemer_map_t* map,
+  size_t                                        index,
+  cardano_blake2b_hash_t**                      blake2b_hash);
+
+/**
+ * \brief Retrieves the redeemer at a specific index from the map.
+ *
+ * This function retrieves the redeemer at the specified index from the map.
+ *
+ * \param[in] map Pointer to the map blake2b_hash.
+ * \param[in] index The index of the redeemer to retrieve.
+ * \param[out] redeemer On successful retrieval, this will point to the redeemer
+ *                    at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the redeemer was successfully retrieved, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_to_redeemer_map_t* map = NULL;
+ * cardano_redeemer_t* redeemer = 0;
+ * size_t index = 0; // Index of the redeemer to retrieve
+ *
+ * // Assume map is initialized properly
+ *
+ * cardano_error_t result = cardano_blake2b_hash_to_redeemer_map_get_value_at(blake2b_hash_to_redeemer_map, index, &redeemer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the redeemer
+ * }
+ * else
+ * {
+ *   // Handle the error
+ * }
+ *
+ * cardano_redeemer_unref(&redeemer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_to_redeemer_map_get_value_at(
+  const cardano_blake2b_hash_to_redeemer_map_t* map,
+  size_t                                        index,
+  cardano_redeemer_t**                          redeemer);
+
+/**
+ * \brief Retrieves the blake2b hash and redeemer at the specified index.
+ *
+ * This function retrieves the blake2b hash and redeemer from the proposed redeemers
+ * at the specified index.
+ *
+ * \param[in]  map    Pointer to the proposed redeemers blake2b_hash.
+ * \param[in]  index             The index at which to retrieve the key-value pair.
+ * \param[out] blake2b_hash On successful retrieval, this will point to the blake2b hash at the specified index.
+ *                            The caller is responsible for managing the lifecycle of this blake2b hash and should release it using
+ *                            \ref cardano_blake2b_hash_unref when it is no longer needed.
+ * \param[out] redeemer On successful retrieval, this will point to the redeemer at the specified index.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS
+ *         if the key-value pair was successfully retrieved, or an appropriate error code indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_to_redeemer_map_t* map = NULL;
+ * // Assume map is initialized properly
+ *
+ * size_t index = 0;
+ * cardano_blake2b_hash_t* blake2b hash = NULL;
+ * cardano_redeemer_t* redeemer = 0;
+ *
+ * cardano_error_t result = cardano_blake2b_hash_to_redeemer_map_get_key_value_at(blake2b_hash_to_redeemer_map, index, &blake2b_hash, &redeemer);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   if (blake2b_hash != NULL && redeemer != NULL)
+ *   {
+ *     // Use the blake2b hash and redeemer
+ *   }
+ *   else
+ *   {
+ *     printf("Key-value pair not set at index %zu.\n", index);
+ *   }
+ * }
+ * else
+ * {
+ *   // Handle error
+ *   printf("Failed to get key-value pair at index %zu.\n", index);
+ * }
+ *
+ * // Clean up
+ * cardano_blake2b_hash_to_redeemer_map_unref(&blake2b_hash_to_redeemer_map);
+ * cardano_blake2b_hash_unref(&blake2b_hash);
+ * cardano_redeemer_unref(&redeemer);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_blake2b_hash_to_redeemer_map_get_key_value_at(
+  const cardano_blake2b_hash_to_redeemer_map_t* map,
+  size_t                                        index,
+  cardano_blake2b_hash_t**                      blake2b_hash,
+  cardano_redeemer_t**                          redeemer);
+
+/**
+ * \brief Finds a redeemer that matches the given blake2b hash reference. If it finds it, it updates its index. Otherwise
+ * it does nothing.
+ *
+ * \param map The map to search for the blake2b_hash.
+ * \param blake2b_hash The blake2b hash key that will be used to search for the redeemer.
+ * \param index The new index to assign to the redeemer.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation. Returns \ref CARDANO_SUCCESS.
+ */
+CARDANO_NODISCARD
+cardano_error_t cardano_blake2b_hash_to_redeemer_map_update_redeemer_index(
+  cardano_blake2b_hash_to_redeemer_map_t* map,
+  cardano_blake2b_hash_t*                 blake2b_hash,
+  uint64_t                                index);
+
+/**
+ * \brief Decrements the reference count of a map blake2b_hash.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_blake2b_hash_to_redeemer_map_t blake2b_hash
+ * by decreasing its reference count. When the reference count reaches zero, the map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] map A pointer to the pointer of the map blake2b_hash. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the blake2b hash has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_blake2b_hash_to_redeemer_map_t* map = cardano_blake2b_hash_to_redeemer_map_new();
+ *
+ * // Perform operations with the map...
+ *
+ * cardano_blake2b_hash_to_redeemer_map_unref(&blake2b_hash_to_redeemer_map);
+ * // At this point, map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_blake2b_hash_to_redeemer_map_unref, the pointer to the \ref cardano_blake2b_hash_to_redeemer_map_t blake2b_hash
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_blake2b_hash_to_redeemer_map_unref(cardano_blake2b_hash_to_redeemer_map_t** map);
+
+/**
+ * \brief Increases the reference count of the cardano_blake2b_hash_to_redeemer_map_t blake2b_hash.
+ *
+ * This function is used to manually increment the reference count of a map
+ * blake2b_hash, indicating that another part of the code has taken ownership of it. This
+ * ensures the blake2b hash remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_blake2b_hash_to_redeemer_map_unref.
+ *
+ * \param map A pointer to the map blake2b hash whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming map is a previously created map blake2b_hash
+ *
+ * cardano_blake2b_hash_to_redeemer_map_ref(blake2b_hash_to_redeemer_map);
+ *
+ * // Now map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_blake2b_hash_to_redeemer_map_ref there is a corresponding
+ * call to \ref cardano_blake2b_hash_to_redeemer_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_blake2b_hash_to_redeemer_map_ref(cardano_blake2b_hash_to_redeemer_map_t* map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_blake2b_hash_to_redeemer_map_t blake2b_hash.
+ *
+ * This function returns the number of active references to a map blake2b_hash. It's useful
+ * for debugging purposes or managing the lifecycle of the blake2b hash in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an blake2b hash holds a reference to another blake2b_hash, rather than directly to the
+ * cardano_blake2b_hash_to_redeemer_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param map A pointer to the map blake2b hash whose reference count is queried.
+ *                    The blake2b hash must not be NULL.
+ *
+ * \return The number of active references to the specified map blake2b_hash. If the blake2b_hash
+ * is properly managed (i.e., every \ref cardano_blake2b_hash_to_redeemer_map_ref call is matched with a
+ * \ref cardano_blake2b_hash_to_redeemer_map_unref call), this count should reach zero right before the blake2b_hash
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming map is a previously created map blake2b_hash
+ *
+ * size_t ref_count = cardano_blake2b_hash_to_redeemer_map_refcount(blake2b_hash_to_redeemer_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_blake2b_hash_to_redeemer_map_refcount(const cardano_blake2b_hash_to_redeemer_map_t* map);
+
+/**
+ * \brief Sets the last error message for a given map blake2b_hash.
+ *
+ * Records an error message in the map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] map A pointer to the \ref cardano_blake2b_hash_to_redeemer_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_blake2b_hash_to_redeemer_map_set_last_error(cardano_blake2b_hash_to_redeemer_map_t* map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_blake2b_hash_to_redeemer_map_set_last_error for the given
+ * map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] map A pointer to the \ref cardano_blake2b_hash_to_redeemer_map_t instance whose last error
+ *                   message is to be retrieved. If the map is NULL, the function
+ *                   returns a generic error message indicating the null map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified map. If the map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the blake2b hash and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_blake2b_hash_to_redeemer_map_set_last_error for the same map, or until
+ *       the map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_blake2b_hash_to_redeemer_map_get_last_error(const cardano_blake2b_hash_to_redeemer_map_t* map);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BLAKE2B_HASH_TO_REDEEMER_MAP_H
diff --git a/vendor/src/transaction_builder/internals/builder_build.c b/vendor/src/transaction_builder/internals/builder_build.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_build.c
@@ -0,0 +1,1474 @@
+/**
+ * \file builder_build.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_build.h"
+
+#include <cardano/address/address.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/guard_set.h>
+#include <cardano/common/protocol_version.h>
+#include <cardano/common/utxo.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/blake2b_hash_set.h>
+#include <cardano/protocol_params/cost_model.h>
+#include <cardano/protocol_params/costmdls.h>
+#include <cardano/scripts/plutus_scripts/plutus_language_version.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction_body/required_guards_map.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+#include <cardano/transaction_body/transaction_output.h>
+#include <cardano/transaction_builder/balancing/transaction_balancing.h>
+#include <cardano/transaction_builder/script_data_hash.h>
+#include <cardano/witness_set/plutus_data_set.h>
+#include <cardano/witness_set/redeemer_list.h>
+#include <cardano/witness_set/witness_set.h>
+
+#include "../balancing/internals/collateral.h"
+#include "../balancing/internals/scripts_needed.h"
+#include "../balancing/internals/unique_signers.h"
+
+#include <assert.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+/* STATIC DECLARATIONS *******************************************************/
+
+/**
+ * \brief Reports whether CIP-172 script sources are enabled by the protocol parameters.
+ * \param[in] state The builder state.
+ * \return True for Dijkstra and later.
+ */
+static bool
+uses_created_output_scripts(cardano_builder_state_t* state)
+{
+  cardano_protocol_version_t* version = cardano_protocol_parameters_get_protocol_version(state->params);
+  const bool                  enabled = cardano_protocol_version_get_major(version) >= 12U;
+  cardano_protocol_version_unref(&version);
+  return enabled;
+}
+
+/**
+ * \brief Retrieves the cost model for a specified Plutus language version.
+ *
+ * This function searches for the cost model matching the specified Plutus language version within a
+ * provided set of source cost models and, if found, copies it into a destination cost model set.
+ *
+ * \param[in] source_models A pointer to the \ref cardano_costmdls_t object containing the source cost models.
+ * \param[out] dest_models A pointer to the \ref cardano_costmdls_t object where the matching cost model
+ *                         for the specified version will be copied. This parameter must not be NULL.
+ * \param[in] version The Plutus language version of the cost model to retrieve.
+ *
+ * \return \ref cardano_error_t indicating the result of the operation. Returns \ref CARDANO_SUCCESS if the cost model
+ *         was successfully found and copied, or an appropriate error code if an internal error occurs.
+ */
+static cardano_error_t
+get_cost_model_for_version(
+  cardano_costmdls_t*                     source_models,
+  cardano_costmdls_t*                     dest_models,
+  const cardano_plutus_language_version_t version)
+{
+  assert(source_models != NULL);
+  assert(dest_models != NULL);
+
+  cardano_cost_model_t* cost_model = NULL;
+
+  cardano_error_t result = cardano_costmdls_get(source_models, version, &cost_model);
+  cardano_cost_model_unref(&cost_model);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_costmdls_insert(dest_models, cost_model);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Checks whether a guard set holds a credential.
+ *
+ * Two credentials are the same guard only when both their type and their hash match.
+ *
+ * \param[in] guards A pointer to the \ref cardano_guard_set_t to search, or NULL when the transaction
+ *                   carries no guards.
+ * \param[in] credential A pointer to the \ref cardano_credential_t to look up.
+ *
+ * \return true if the guard set holds the credential, false otherwise.
+ */
+static bool
+has_guard(const cardano_guard_set_t* guards, const cardano_credential_t* credential)
+{
+  const size_t length = cardano_guard_set_get_length(guards);
+  bool         found  = false;
+
+  for (size_t i = 0U; (i < length) && !found; ++i)
+  {
+    cardano_credential_t* guard = NULL;
+
+    const cardano_error_t result = cardano_guard_set_get(guards, i, &guard);
+    cardano_credential_unref(&guard);
+
+    found = (result == CARDANO_SUCCESS) && cardano_credential_equals(guard, credential);
+  }
+
+  return found;
+}
+
+/**
+ * \brief Checks that a guard set holds every top level guard a sub transaction requires.
+ *
+ * \param[in] guards A pointer to the \ref cardano_guard_set_t of the top level transaction, or NULL
+ *                   when it carries no guards.
+ * \param[in] sub_transaction A pointer to the \ref cardano_sub_transaction_t whose required top level
+ *                            guards are checked.
+ * \param[out] error_message A pointer that receives a static string describing the failure when a
+ *                           required guard is missing.
+ *
+ * \return \ref CARDANO_SUCCESS if every required guard is present or the sub transaction requires
+ *         none, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if a required guard is missing, or an appropriate
+ *         error code indicating the failure reason.
+ */
+static cardano_error_t
+check_sub_transaction_required_guards(
+  const cardano_guard_set_t* guards,
+  cardano_sub_transaction_t* sub_transaction,
+  const char**               error_message)
+{
+  cardano_sub_transaction_body_t* sub_body = cardano_sub_transaction_get_body(sub_transaction);
+  cardano_sub_transaction_body_unref(&sub_body);
+
+  cardano_required_guards_map_t* required_guards = cardano_sub_transaction_body_get_required_top_level_guards(sub_body);
+  cardano_required_guards_map_unref(&required_guards);
+
+  const size_t length = cardano_required_guards_map_get_length(required_guards);
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_credential_t* credential = NULL;
+
+    const cardano_error_t result = cardano_required_guards_map_get_key_at(required_guards, i, &credential);
+    cardano_credential_unref(&credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (!has_guard(guards, credential))
+    {
+      *error_message = "A sub transaction requires a top level guard that the transaction does not carry. You must add it with `cardano_tx_builder_add_guard` before calling `build`.";
+
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Checks that the transaction carries every top level guard its sub transactions require.
+ *
+ * A sub transaction can list the guards it requires from the transaction that carries it, and the
+ * batch is only valid when each of them is among the guards of that transaction. Guards are never
+ * added on behalf of the batcher, since a key hash guard is also a required signer. Transactions
+ * without sub transactions always pass.
+ *
+ * \param[in] tx A pointer to the \ref cardano_transaction_t to check.
+ * \param[out] error_message A pointer that receives a static string describing the failure when a
+ *                           required guard is missing.
+ *
+ * \return \ref CARDANO_SUCCESS if no required guard is missing, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND
+ *         if the transaction lacks a guard required by one of its sub transactions, or an appropriate
+ *         error code indicating the failure reason.
+ */
+static cardano_error_t
+check_required_top_level_guards(cardano_transaction_t* tx, const char** error_message)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_guard_set_t* guards = cardano_transaction_body_get_guards(body);
+  cardano_guard_set_unref(&guards);
+
+  cardano_sub_transaction_set_t* sub_transactions = cardano_transaction_body_get_sub_transactions(body);
+  cardano_sub_transaction_set_unref(&sub_transactions);
+
+  const size_t length = cardano_sub_transaction_set_get_length(sub_transactions);
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_sub_transaction_t* sub_transaction = NULL;
+
+    cardano_error_t result = cardano_sub_transaction_set_get(sub_transactions, i, &sub_transaction);
+    cardano_sub_transaction_unref(&sub_transaction);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = check_sub_transaction_required_guards(guards, sub_transaction, error_message);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Callback that checks whether a UTXO belongs to a transaction input.
+ *
+ * \param[in] item A pointer to the \ref cardano_utxo_t to evaluate.
+ * \param[in] context A pointer to the \ref cardano_transaction_input_t to match against.
+ *
+ * \return true if the UTXO belongs to the transaction input, false otherwise.
+ */
+static bool
+find_utxo(cardano_utxo_t* item, const void* context)
+{
+  const cardano_transaction_input_t* input      = (const cardano_transaction_input_t*)context;
+  cardano_transaction_input_t*       utxo_input = cardano_utxo_get_input(item);
+
+  bool found = cardano_transaction_input_equals(utxo_input, input);
+
+  cardano_transaction_input_unref(&utxo_input);
+
+  return found;
+}
+
+/**
+ * \brief Adds to a list the UTXOs of another list whose input the list does not hold yet.
+ *
+ * \param[in,out] list A pointer to the \ref cardano_utxo_list_t that receives the UTXOs.
+ * \param[in] utxos A pointer to the \ref cardano_utxo_list_t with the UTXOs to add.
+ *
+ * \return \ref CARDANO_SUCCESS if the UTXOs were added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+static cardano_error_t
+add_utxos_with_new_inputs(cardano_utxo_list_t* list, cardano_utxo_list_t* utxos)
+{
+  const size_t length = cardano_utxo_list_get_length(utxos);
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    cardano_error_t result = cardano_utxo_list_get(utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+    cardano_transaction_input_unref(&input);
+
+    cardano_utxo_t* listed_utxo = cardano_utxo_list_find(list, find_utxo, input);
+    cardano_utxo_unref(&listed_utxo);
+
+    if (listed_utxo == NULL)
+    {
+      result = cardano_utxo_list_add(list, utxo);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Checks whether the protocol version forbids a transaction to spend one of its reference inputs.
+ *
+ * The ledger rejects a transaction that spends and references the same UTXO only under protocol
+ * versions 9 and 10. Earlier versions and the versions from 11 on allow the overlap.
+ *
+ * \param[in] params A pointer to the \ref cardano_protocol_parameters_t the transaction is built with.
+ *
+ * \return true if the major protocol version is 9 or 10, false otherwise.
+ */
+static bool
+are_spent_reference_inputs_forbidden(cardano_protocol_parameters_t* params)
+{
+  cardano_protocol_version_t* version = cardano_protocol_parameters_get_protocol_version(params);
+  cardano_protocol_version_unref(&version);
+
+  const uint64_t major = cardano_protocol_version_get_major(version);
+
+  return (major == 9U) || (major == 10U);
+}
+
+/**
+ * \brief Checks whether a UTXO is one of the top level reference inputs of the transaction.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction.
+ * \param[in] utxo A pointer to the \ref cardano_utxo_t to look up.
+ *
+ * \return true if the input of the UTXO was added as a reference input, false otherwise.
+ */
+static bool
+is_reference_input(const cardano_builder_state_t* state, cardano_utxo_t* utxo)
+{
+  cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+  cardano_transaction_input_unref(&input);
+
+  cardano_utxo_t* reference_utxo = cardano_utxo_list_find(state->reference_inputs, find_utxo, input);
+  cardano_utxo_unref(&reference_utxo);
+
+  return reference_utxo != NULL;
+}
+
+/**
+ * \brief Checks whether a UTXO list holds one of the top level reference inputs of the transaction.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction.
+ * \param[in] utxos A pointer to the \ref cardano_utxo_list_t to search.
+ *
+ * \return true if the list holds a UTXO that was added as a reference input, false otherwise.
+ */
+static bool
+has_reference_input(const cardano_builder_state_t* state, const cardano_utxo_list_t* utxos)
+{
+  const size_t length = cardano_utxo_list_get_length(utxos);
+  bool         found  = false;
+
+  for (size_t i = 0U; (i < length) && !found; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    const cardano_error_t result = cardano_utxo_list_get(utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    found = (result == CARDANO_SUCCESS) && is_reference_input(state, utxo);
+  }
+
+  return found;
+}
+
+/**
+ * \brief Checks that no explicitly added input of the transaction is also one of its reference inputs.
+ *
+ * Under protocol versions 9 and 10 the ledger rejects a transaction that spends and references the
+ * same UTXO, so a UTXO added both as an input and as a reference input makes the build fail. Only the
+ * top level is checked, since sub transactions exist only from protocol version 12.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction.
+ * \param[out] error_message A pointer that receives a static string describing the failure when a
+ *                           UTXO is both spent and referenced.
+ *
+ * \return \ref CARDANO_SUCCESS if the added inputs and the reference inputs are disjoint or the
+ *         protocol version allows the overlap, or \ref CARDANO_ERROR_DUPLICATED_KEY if a UTXO is both
+ *         spent and referenced under protocol versions 9 and 10.
+ */
+static cardano_error_t
+check_disjoint_reference_inputs(cardano_builder_state_t* state, const char** error_message)
+{
+  if (!are_spent_reference_inputs_forbidden(state->params) || !has_reference_input(state, state->pre_selected_inputs))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  *error_message = "A UTXO can not be both spent and referenced by the same transaction under protocol versions 9 and 10.";
+
+  return CARDANO_ERROR_DUPLICATED_KEY;
+}
+
+/**
+ * \brief Creates the list of available UTXOs coin selection may spend at the top level.
+ *
+ * Under protocol versions 9 and 10 the ledger rejects a transaction that spends one of its reference
+ * inputs, so the UTXOs added as reference inputs are left out of the available UTXOs. The order of the
+ * remaining UTXOs is preserved and the list of the state is never modified.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction.
+ * \param[out] utxos On success, this will point to the selectable UTXOs, which is the list of available
+ *                   UTXOs of the state itself when the protocol version allows the overlap or when no
+ *                   available UTXO is a reference input. The caller is responsible for releasing it
+ *                   with \ref cardano_utxo_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the list was created, or an appropriate error code indicating the
+ *         failure reason.
+ */
+static cardano_error_t
+exclude_reference_inputs(cardano_builder_state_t* state, cardano_utxo_list_t** utxos)
+{
+  if (!are_spent_reference_inputs_forbidden(state->params) || !has_reference_input(state, state->available_utxos))
+  {
+    cardano_utxo_list_ref(state->available_utxos);
+    *utxos = state->available_utxos;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_utxo_list_t* selectable_utxos = NULL;
+  cardano_error_t      result           = cardano_utxo_list_new(&selectable_utxos);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const size_t length = cardano_utxo_list_get_length(state->available_utxos);
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    result = cardano_utxo_list_get(state->available_utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if ((result == CARDANO_SUCCESS) && !is_reference_input(state, utxo))
+    {
+      result = cardano_utxo_list_add(selectable_utxos, utxo);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_utxo_list_unref(&selectable_utxos);
+
+      return result;
+    }
+  }
+
+  *utxos = selectable_utxos;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Creates the list of available UTXOs the transaction is balanced with.
+ *
+ * The balancer takes the resolved UTXOs of the sub transactions from the available UTXOs, so the UTXOs
+ * the sub transactions spend and reference are added to the ones available for input selection. The
+ * batcher can also be a party of the batch, so a UTXO that is already available is not listed again.
+ * Under protocol versions 9 and 10 the UTXOs added as top level reference inputs are left out of the
+ * available UTXOs, since the ledger does not allow a transaction to spend them. The list of the state
+ * is never modified.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction.
+ * \param[out] utxos On success, this will point to the list to balance the transaction with, which is
+ *                   the list of available UTXOs of the state itself when the transaction carries no sub
+ *                   transactions and no available UTXO has to be left out. The caller is responsible for
+ *                   releasing it with \ref cardano_utxo_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the list was created, or an appropriate error code indicating the
+ *         failure reason.
+ */
+static cardano_error_t
+get_balancing_utxos(cardano_builder_state_t* state, cardano_utxo_list_t** utxos)
+{
+  cardano_utxo_list_t* selectable_utxos = NULL;
+
+  cardano_error_t result = exclude_reference_inputs(state, &selectable_utxos);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const size_t sub_transaction_utxo_count = cardano_utxo_list_get_length(state->sub_transaction_inputs) +
+    cardano_utxo_list_get_length(state->sub_transaction_reference_inputs);
+
+  if (sub_transaction_utxo_count == 0U)
+  {
+    *utxos = selectable_utxos;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_utxo_list_t* balancing_utxos = cardano_utxo_list_clone(selectable_utxos);
+  cardano_utxo_list_unref(&selectable_utxos);
+
+  if (balancing_utxos == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = add_utxos_with_new_inputs(balancing_utxos, state->sub_transaction_inputs);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_utxos_with_new_inputs(balancing_utxos, state->sub_transaction_reference_inputs);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&balancing_utxos);
+
+    return result;
+  }
+
+  *utxos = balancing_utxos;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Adds to a list the resolved UTXO of an input the transaction spends, unless the list holds it.
+ *
+ * The UTXO is looked up among the available UTXOs and the resolved spend inputs of the sub
+ * transactions, which hold every UTXO coin selection can add to the inputs of the transaction.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction.
+ * \param[in] input A pointer to the \ref cardano_transaction_input_t spent by the transaction.
+ * \param[in,out] spent_utxos A pointer to the \ref cardano_utxo_list_t that receives the UTXO.
+ *
+ * \return \ref CARDANO_SUCCESS if the list holds the UTXO, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if
+ *         the input is not resolved, or an appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+add_spent_utxo(
+  const cardano_builder_state_t*     state,
+  const cardano_transaction_input_t* input,
+  cardano_utxo_list_t*               spent_utxos)
+{
+  cardano_utxo_t* utxo = cardano_utxo_list_find(spent_utxos, find_utxo, input);
+
+  if (utxo != NULL)
+  {
+    cardano_utxo_unref(&utxo);
+
+    return CARDANO_SUCCESS;
+  }
+
+  utxo = cardano_utxo_list_find(state->available_utxos, find_utxo, input);
+
+  if (utxo == NULL)
+  {
+    utxo = cardano_utxo_list_find(state->sub_transaction_inputs, find_utxo, input);
+  }
+
+  if (utxo == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  const cardano_error_t result = cardano_utxo_list_add(spent_utxos, utxo);
+  cardano_utxo_unref(&utxo);
+
+  return result;
+}
+
+/**
+ * \brief Creates the list of resolved UTXOs a transaction spends.
+ *
+ * Those are the pre selected inputs, which a sub transaction spends even though the body of the
+ * transaction held by its state does not list them, and the inputs of the body, which at the top
+ * level also hold the inputs chosen by coin selection.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction.
+ * \param[in] tx A pointer to the \ref cardano_transaction_t whose inputs are resolved.
+ * \param[out] spent_utxos On success, this will point to the resolved UTXOs. The caller is
+ *                         responsible for releasing it with \ref cardano_utxo_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if every input was resolved, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if
+ *         an input is not resolved, or an appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+get_spent_utxos(
+  cardano_builder_state_t* state,
+  cardano_transaction_t*   tx,
+  cardano_utxo_list_t**    spent_utxos)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_input_set_t* inputs = cardano_transaction_body_get_inputs(body);
+  cardano_transaction_input_set_unref(&inputs);
+
+  cardano_utxo_list_t* utxos = cardano_utxo_list_clone(state->pre_selected_inputs);
+
+  if (utxos == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+  const size_t    length = cardano_transaction_input_set_get_length(inputs);
+
+  for (size_t i = 0U; (i < length) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_transaction_input_t* input = NULL;
+
+    result = cardano_transaction_input_set_get(inputs, i, &input);
+    cardano_transaction_input_unref(&input);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = add_spent_utxo(state, input, utxos);
+    }
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&utxos);
+
+    return result;
+  }
+
+  *spent_utxos = utxos;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Adds to a set the payment script hash of every spent UTXO locked by a script.
+ *
+ * \param[in,out] script_hashes A pointer to the \ref cardano_blake2b_hash_set_t that receives the
+ *                              script hashes. A hash the set already holds is not added again.
+ * \param[in] spent_utxos A pointer to the \ref cardano_utxo_list_t with the spent UTXOs.
+ *
+ * \return \ref CARDANO_SUCCESS if the UTXOs were inspected, or an appropriate error code indicating
+ *         the failure reason.
+ */
+static cardano_error_t
+add_spent_script_hashes(cardano_blake2b_hash_set_t* script_hashes, cardano_utxo_list_t* spent_utxos)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+  const size_t    length = cardano_utxo_list_get_length(spent_utxos);
+
+  for (size_t i = 0U; (i < length) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    result = cardano_utxo_list_get(spent_utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    cardano_address_t* address = NULL;
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+      cardano_transaction_output_unref(&output);
+
+      address = cardano_transaction_output_get_address(output);
+      cardano_address_unref(&address);
+    }
+
+    if ((result == CARDANO_SUCCESS) && _cardano_has_payment_script(address))
+    {
+      cardano_blake2b_hash_t* script_hash = _cardano_get_payment_script_hash(address);
+
+      result = (script_hash != NULL) ? CARDANO_SUCCESS : CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+      if ((result == CARDANO_SUCCESS) && !_cardano_blake2b_hash_set_has(script_hashes, script_hash))
+      {
+        result = cardano_blake2b_hash_set_add(script_hashes, script_hash);
+      }
+
+      cardano_blake2b_hash_unref(&script_hash);
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Collects the hashes of the scripts a transaction needs.
+ *
+ * Those are the scripts of the spent UTXOs locked by a script, its mint, withdrawals, certificates, voters, proposal
+ * guardrails and guards.
+ *
+ * \param[in] tx A pointer to the \ref cardano_transaction_t whose needed scripts are collected.
+ * \param[in] spent_utxos A pointer to the \ref cardano_utxo_list_t with the UTXOs the transaction spends.
+ * \param[out] needed_scripts On success, this will point to the needed script hashes. The caller is responsible for
+ *                            releasing them with \ref cardano_blake2b_hash_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the hashes were collected, or an appropriate error code indicating the failure
+ *         reason.
+ */
+static cardano_error_t
+get_needed_scripts(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         spent_utxos,
+  cardano_blake2b_hash_set_t** needed_scripts)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_blake2b_hash_set_t* script_hashes = NULL;
+
+  cardano_error_t result = _cardano_get_script_hashes_needed(body, NULL, &script_hashes);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_spent_script_hashes(script_hashes, spent_utxos);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_set_unref(&script_hashes);
+
+    return result;
+  }
+
+  *needed_scripts = script_hashes;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Finds the Plutus languages of the scripts a transaction needs.
+ *
+ * Like the ledger, only the scripts the body needs count: the scripts of its spent inputs, mint,
+ * withdrawals, certificates, voters, proposal guardrails and guards. Each one is looked up among the
+ * scripts provided to the batch: the ones of the witness set of the transaction and of the witness
+ * sets of its sub transactions, and the reference scripts of the reference inputs, the spent inputs
+ * and the UTXOs the sub transactions spend or reference. A provided script that no field of the body
+ * needs adds no language, and a needed script that is not provided adds none either, since its
+ * language is unknown.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction.
+ * \param[in] tx A pointer to the \ref cardano_transaction_t whose needed scripts are inspected.
+ * \param[out] has_plutus_v1 Set to true if a needed script is a PlutusV1 script.
+ * \param[out] has_plutus_v2 Set to true if a needed script is a PlutusV2 script.
+ * \param[out] has_plutus_v3 Set to true if a needed script is a PlutusV3 script.
+ * \param[out] has_plutus_v4 Set to true if a needed script is a PlutusV4 script.
+ *
+ * \return \ref CARDANO_SUCCESS if the languages were found, or an appropriate error code indicating
+ *         the failure reason.
+ */
+static cardano_error_t
+get_plutus_languages_used(
+  cardano_builder_state_t* state,
+  cardano_transaction_t*   tx,
+  bool*                    has_plutus_v1,
+  bool*                    has_plutus_v2,
+  bool*                    has_plutus_v3,
+  bool*                    has_plutus_v4)
+{
+  cardano_utxo_list_t* spent_utxos = NULL;
+
+  cardano_error_t result = get_spent_utxos(state, tx, &spent_utxos);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_set_t* needed_scripts = NULL;
+
+  result = get_needed_scripts(tx, spent_utxos, &needed_scripts);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&spent_utxos);
+
+    return result;
+  }
+
+  cardano_utxo_list_t* sub_transaction_utxos = cardano_utxo_list_concat(state->sub_transaction_inputs, state->sub_transaction_reference_inputs);
+
+  if (sub_transaction_utxos == NULL)
+  {
+    result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+  else
+  {
+    bool has_missing_scripts = false;
+
+    result = _cardano_get_plutus_languages_used(
+      tx,
+      uses_created_output_scripts(state),
+      needed_scripts,
+      state->reference_inputs,
+      spent_utxos,
+      NULL,
+      sub_transaction_utxos,
+      has_plutus_v1,
+      has_plutus_v2,
+      has_plutus_v3,
+      has_plutus_v4,
+      &has_missing_scripts);
+  }
+
+  cardano_utxo_list_unref(&sub_transaction_utxos);
+  cardano_blake2b_hash_set_unref(&needed_scripts);
+  cardano_utxo_list_unref(&spent_utxos);
+
+  return result;
+}
+
+/**
+ * \brief Retrieves the cost models of the Plutus languages a transaction uses.
+ *
+ * The script data hash carries the language view of each Plutus language of the scripts the
+ * transaction needs, so the cost model of every such language is copied from the protocol parameters.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t holding the protocol parameters and
+ *                  the resolved UTXOs of the transaction.
+ * \param[in] tx A pointer to the \ref cardano_transaction_t whose languages are retrieved.
+ * \param[out] costmdls A pointer to an initialized \ref cardano_costmdls_t object where the cost models will be stored.
+ *                      This parameter must not be NULL.
+ *
+ * \return \ref cardano_error_t indicating the result of the operation. Returns \ref CARDANO_SUCCESS if the cost models
+ *         were successfully retrieved and stored, or an appropriate error code if an error occurs during retrieval.
+ */
+static cardano_error_t
+get_cost_models(cardano_builder_state_t* state, cardano_transaction_t* tx, cardano_costmdls_t* costmdls)
+{
+  bool has_plutus_v1 = false;
+  bool has_plutus_v2 = false;
+  bool has_plutus_v3 = false;
+  bool has_plutus_v4 = false;
+
+  cardano_error_t result = get_plutus_languages_used(state, tx, &has_plutus_v1, &has_plutus_v2, &has_plutus_v3, &has_plutus_v4);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_costmdls_t* pparams_costmdls = cardano_protocol_parameters_get_cost_models(state->params);
+  cardano_costmdls_unref(&pparams_costmdls);
+
+  if (has_plutus_v1)
+  {
+    result = get_cost_model_for_version(pparams_costmdls, costmdls, CARDANO_PLUTUS_LANGUAGE_VERSION_V1);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (has_plutus_v2)
+  {
+    result = get_cost_model_for_version(pparams_costmdls, costmdls, CARDANO_PLUTUS_LANGUAGE_VERSION_V2);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (has_plutus_v3)
+  {
+    result = get_cost_model_for_version(pparams_costmdls, costmdls, CARDANO_PLUTUS_LANGUAGE_VERSION_V3);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (has_plutus_v4)
+  {
+    result = get_cost_model_for_version(pparams_costmdls, costmdls, CARDANO_PLUTUS_LANGUAGE_VERSION_V4);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Retrieves the name of the script purpose of a redeemer tag.
+ *
+ * \param[in] tag The redeemer tag.
+ *
+ * \return A static string naming the purpose.
+ */
+static const char*
+get_purpose_name(const cardano_redeemer_tag_t tag)
+{
+  const char* name = "unknown";
+
+  switch (tag)
+  {
+    case CARDANO_REDEEMER_TAG_SPEND:
+    {
+      name = "spending";
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_MINT:
+    {
+      name = "minting";
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_CERTIFYING:
+    {
+      name = "certifying";
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_REWARD:
+    {
+      name = "rewarding";
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_VOTING:
+    {
+      name = "voting";
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_PROPOSING:
+    {
+      name = "proposing";
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_GUARDING:
+    {
+      name = "guarding";
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return name;
+}
+
+/**
+ * \brief Sets the last error of a transaction to describe a script purpose that has no redeemer.
+ *
+ * \param[in,out] tx A pointer to the \ref cardano_transaction_t that receives the error message.
+ * \param[in] tag The redeemer tag of the purpose.
+ * \param[in] index The redeemer index of the purpose.
+ * \param[in] script_hash A pointer to the \ref cardano_blake2b_hash_t of the Plutus script of the purpose.
+ */
+static void
+set_missing_redeemer_error(
+  cardano_transaction_t*        tx,
+  const cardano_redeemer_tag_t  tag,
+  const uint64_t                index,
+  const cardano_blake2b_hash_t* script_hash)
+{
+  char hash_hex[65] = { 0 };
+
+  CARDANO_UNUSED(cardano_blake2b_hash_to_hex(script_hash, hash_hex, sizeof(hash_hex)));
+
+  char buffer[256] = { 0 };
+
+  const int32_t written = snprintf(
+    buffer,
+    sizeof(buffer),
+    "The %s purpose at index %" PRIu64 " needs a redeemer for the Plutus script %s, but the transaction carries none.",
+    get_purpose_name(tag),
+    index,
+    hash_hex);
+
+  assert(written > 0);
+  CARDANO_UNUSED(written);
+
+  cardano_transaction_set_last_error(tx, buffer);
+}
+
+/**
+ * \brief Sets the last error of a transaction to describe a script purpose of one of its sub transactions that has
+ * no redeemer.
+ *
+ * \param[in,out] tx A pointer to the \ref cardano_transaction_t that receives the error message.
+ * \param[in] sub_transaction A pointer to the \ref cardano_sub_transaction_t the purpose belongs to.
+ * \param[in] batch_index The zero based index of the sub transaction in the batch.
+ * \param[in] tag The redeemer tag of the purpose.
+ * \param[in] index The redeemer index of the purpose.
+ * \param[in] script_hash A pointer to the \ref cardano_blake2b_hash_t of the Plutus script of the purpose.
+ */
+static void
+set_sub_transaction_missing_redeemer_error(
+  cardano_transaction_t*        tx,
+  cardano_sub_transaction_t*    sub_transaction,
+  const size_t                  batch_index,
+  const cardano_redeemer_tag_t  tag,
+  const uint64_t                index,
+  const cardano_blake2b_hash_t* script_hash)
+{
+  char hash_hex[65] = { 0 };
+  char id_hex[65]   = { 0 };
+
+  CARDANO_UNUSED(cardano_blake2b_hash_to_hex(script_hash, hash_hex, sizeof(hash_hex)));
+
+  cardano_blake2b_hash_t* id = cardano_sub_transaction_get_id(sub_transaction);
+
+  CARDANO_UNUSED(cardano_blake2b_hash_to_hex(id, id_hex, sizeof(id_hex)));
+  cardano_blake2b_hash_unref(&id);
+
+  char buffer[384] = { 0 };
+
+  const int32_t written = snprintf(
+    buffer,
+    sizeof(buffer),
+    "The %s purpose at index %" PRIu64 " of the sub transaction %s (index %" PRIu64 " in the batch) needs a redeemer for the Plutus script %s, but the sub transaction carries none.",
+    get_purpose_name(tag),
+    index,
+    id_hex,
+    (uint64_t)batch_index,
+    hash_hex);
+
+  assert(written > 0);
+  CARDANO_UNUSED(written);
+
+  cardano_transaction_set_last_error(tx, buffer);
+}
+
+/**
+ * \brief Checks that every script purpose of a sub transaction whose script is a Plutus script has a redeemer.
+ *
+ * The purposes come from the body of the sub transaction, its spend indices are positions in its own sorted inputs
+ * and its redeemers are the ones of its own witness set, while the scripts are looked up among the ones provided to
+ * the whole batch.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t holding the resolved UTXOs of the batch.
+ * \param[in,out] tx A pointer to the \ref cardano_transaction_t carrying the sub transaction. Its last error describes
+ *                   the purpose that has no redeemer.
+ * \param[in] spent_utxos A pointer to the \ref cardano_utxo_list_t with the UTXOs the transaction spends.
+ * \param[in] sub_transaction_utxos A pointer to the \ref cardano_utxo_list_t with the UTXOs the sub transactions spend
+ *                                  or reference.
+ * \param[in] sub_transaction A pointer to the \ref cardano_sub_transaction_t to check.
+ * \param[in] batch_index The zero based index of the sub transaction in the batch.
+ *
+ * \return \ref CARDANO_SUCCESS if every such purpose has a redeemer, \ref CARDANO_ERROR_MISSING_REDEEMER if one of
+ *         them has none, or an appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+check_sub_transaction_redeemers(
+  cardano_builder_state_t*   state,
+  cardano_transaction_t*     tx,
+  cardano_utxo_list_t*       spent_utxos,
+  cardano_utxo_list_t*       sub_transaction_utxos,
+  cardano_sub_transaction_t* sub_transaction,
+  const size_t               batch_index)
+{
+  cardano_blake2b_hash_set_t* needed_scripts = NULL;
+  cardano_blake2b_hash_set_t* plutus_scripts = NULL;
+  cardano_blake2b_hash_t*     script_hash    = NULL;
+  cardano_redeemer_tag_t      tag            = CARDANO_REDEEMER_TAG_SPEND;
+  uint64_t                    index          = 0U;
+
+  cardano_sub_transaction_body_t* sub_body = cardano_sub_transaction_get_body(sub_transaction);
+  cardano_sub_transaction_body_unref(&sub_body);
+
+  cardano_error_t result = _cardano_get_sub_transaction_script_hashes_needed(sub_body, state->sub_transaction_inputs, &needed_scripts);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = _cardano_get_plutus_scripts_provided(tx, uses_created_output_scripts(state), needed_scripts, state->reference_inputs, spent_utxos, NULL, sub_transaction_utxos, &plutus_scripts);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_witness_set_t* witness_set = cardano_sub_transaction_get_witness_set(sub_transaction);
+    cardano_witness_set_unref(&witness_set);
+
+    cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witness_set);
+    cardano_redeemer_list_unref(&redeemers);
+
+    result = _cardano_find_sub_transaction_missing_redeemer(sub_body, state->sub_transaction_inputs, plutus_scripts, redeemers, &tag, &index, &script_hash);
+  }
+
+  if (script_hash != NULL)
+  {
+    set_sub_transaction_missing_redeemer_error(tx, sub_transaction, batch_index, tag, index, script_hash);
+
+    result = CARDANO_ERROR_MISSING_REDEEMER;
+  }
+
+  cardano_blake2b_hash_unref(&script_hash);
+  cardano_blake2b_hash_set_unref(&plutus_scripts);
+  cardano_blake2b_hash_set_unref(&needed_scripts);
+
+  return result;
+}
+
+/**
+ * \brief Checks the redeemers of every sub transaction of a transaction.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t holding the resolved UTXOs of the batch.
+ * \param[in,out] tx A pointer to the \ref cardano_transaction_t whose sub transactions are checked. Its last error
+ *                   describes the purpose that has no redeemer.
+ * \param[in] spent_utxos A pointer to the \ref cardano_utxo_list_t with the UTXOs the transaction spends.
+ * \param[in] sub_transaction_utxos A pointer to the \ref cardano_utxo_list_t with the UTXOs the sub transactions spend
+ *                                  or reference.
+ *
+ * \return \ref CARDANO_SUCCESS if every Plutus script purpose of every sub transaction has a redeemer,
+ *         \ref CARDANO_ERROR_MISSING_REDEEMER if one of them has none, or an appropriate error code indicating the
+ *         failure reason.
+ */
+static cardano_error_t
+check_sub_transactions_redeemers(
+  cardano_builder_state_t* state,
+  cardano_transaction_t*   tx,
+  cardano_utxo_list_t*     spent_utxos,
+  cardano_utxo_list_t*     sub_transaction_utxos)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_sub_transaction_set_t* sub_transactions = cardano_transaction_body_get_sub_transactions(body);
+  cardano_sub_transaction_set_unref(&sub_transactions);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+  const size_t    length = cardano_sub_transaction_set_get_length(sub_transactions);
+
+  for (size_t i = 0U; (i < length) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_sub_transaction_t* sub_transaction = NULL;
+
+    result = cardano_sub_transaction_set_get(sub_transactions, i, &sub_transaction);
+    cardano_sub_transaction_unref(&sub_transaction);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = check_sub_transaction_redeemers(state, tx, spent_utxos, sub_transaction_utxos, sub_transaction, i);
+    }
+  }
+
+  return result;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_set_dummy_script_data_hash(cardano_transaction_t* tx)
+{
+  if (!cardano_transaction_has_script_data(tx))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  static byte_t           dummy_hash[32] = { 0 };
+  cardano_blake2b_hash_t* hash           = NULL;
+
+  cardano_error_t new_hash_result = cardano_blake2b_hash_from_bytes(dummy_hash, sizeof(dummy_hash), &hash);
+
+  if (new_hash_result != CARDANO_SUCCESS)
+  {
+    return new_hash_result;
+  }
+
+  new_hash_result = cardano_transaction_body_set_script_data_hash(body, hash);
+  cardano_blake2b_hash_unref(&hash);
+
+  if (new_hash_result != CARDANO_SUCCESS)
+  {
+    return new_hash_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_update_script_data_hash(cardano_builder_state_t* state, cardano_transaction_t* tx)
+{
+  if (!cardano_transaction_has_script_data(tx))
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_costmdls_t* costmdls = NULL;
+
+  cardano_error_t result = cardano_costmdls_new(&costmdls);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = get_cost_models(state, tx, costmdls);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_costmdls_unref(&costmdls);
+    return result;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(tx);
+  cardano_witness_set_unref(&witness_set);
+
+  cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witness_set);
+  cardano_redeemer_list_unref(&redeemers);
+
+  cardano_plutus_data_set_t* datums = cardano_witness_set_get_plutus_data(witness_set);
+  cardano_plutus_data_set_unref(&datums);
+
+  result = cardano_compute_script_data_hash(costmdls, redeemers, datums, &hash);
+  cardano_costmdls_unref(&costmdls);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&hash);
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  result = cardano_transaction_body_set_script_data_hash(body, hash);
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_check_redeemers(
+  cardano_builder_state_t*         state,
+  cardano_transaction_t*           tx,
+  cardano_transaction_input_set_t* inputs,
+  const char**                     error_message)
+{
+  cardano_utxo_list_t*        spent_utxos           = NULL;
+  cardano_blake2b_hash_set_t* needed_scripts        = NULL;
+  cardano_utxo_list_t*        sub_transaction_utxos = NULL;
+  cardano_blake2b_hash_set_t* plutus_scripts        = NULL;
+  cardano_blake2b_hash_t*     script_hash           = NULL;
+  cardano_redeemer_tag_t      tag                   = CARDANO_REDEEMER_TAG_SPEND;
+  uint64_t                    index                 = 0U;
+
+  cardano_error_t result = get_spent_utxos(state, tx, &spent_utxos);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = get_needed_scripts(tx, spent_utxos, &needed_scripts);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    sub_transaction_utxos = cardano_utxo_list_concat(state->sub_transaction_inputs, state->sub_transaction_reference_inputs);
+    result                = (sub_transaction_utxos != NULL) ? CARDANO_SUCCESS : CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = _cardano_get_plutus_scripts_provided(tx, uses_created_output_scripts(state), needed_scripts, state->reference_inputs, spent_utxos, NULL, sub_transaction_utxos, &plutus_scripts);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+    cardano_transaction_body_unref(&body);
+
+    cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(tx);
+    cardano_witness_set_unref(&witness_set);
+
+    cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witness_set);
+    cardano_redeemer_list_unref(&redeemers);
+
+    result = _cardano_find_missing_redeemer(body, inputs, spent_utxos, plutus_scripts, redeemers, &tag, &index, &script_hash);
+  }
+
+  if (script_hash != NULL)
+  {
+    set_missing_redeemer_error(tx, tag, index, script_hash);
+
+    result = CARDANO_ERROR_MISSING_REDEEMER;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = check_sub_transactions_redeemers(state, tx, spent_utxos, sub_transaction_utxos);
+  }
+
+  if (result == CARDANO_ERROR_MISSING_REDEEMER)
+  {
+    *error_message = cardano_transaction_get_last_error(tx);
+  }
+
+  if ((result != CARDANO_SUCCESS) && (result != CARDANO_ERROR_MISSING_REDEEMER))
+  {
+    *error_message = "Failed to check the redeemers of the Plutus scripts the transaction needs.";
+  }
+
+  cardano_blake2b_hash_unref(&script_hash);
+  cardano_blake2b_hash_set_unref(&plutus_scripts);
+  cardano_utxo_list_unref(&sub_transaction_utxos);
+  cardano_blake2b_hash_set_unref(&needed_scripts);
+  cardano_utxo_list_unref(&spent_utxos);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_build(
+  cardano_builder_state_t* state,
+  cardano_transaction_t**  transaction,
+  const char**             error_message)
+{
+  if (state->change_address == NULL)
+  {
+    *error_message = "You must set a change address before calling `build`.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (state->available_utxos == NULL)
+  {
+    *error_message = "You must set the available UTXOs for input selection before calling `build`.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = check_required_top_level_guards(state->transaction, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  bool is_collateral_required = false;
+
+  result = _cardano_is_collateral_required(state->transaction, &is_collateral_required);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (is_collateral_required)
+  {
+    if (state->collateral_address == NULL)
+    {
+      *error_message = "This transaction interacts with plutus validators. You must set a collateral change address before calling `build`.";
+
+      return CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    if (state->collateral_utxos == NULL)
+    {
+      *error_message = "This transaction interacts with plutus validators. You must set the collateral UTXOs before calling `build`.";
+
+      return CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    if (cardano_utxo_list_get_length(state->collateral_utxos) == 0U)
+    {
+      *error_message = "This transaction interacts with plutus validators. You must set at least one collateral UTXO before calling `build`.";
+
+      return CARDANO_ERROR_BALANCE_INSUFFICIENT;
+    }
+  }
+
+  result = check_disjoint_reference_inputs(state, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_transaction_t* tx = state->transaction;
+
+  result = cardano_builder_set_dummy_script_data_hash(tx);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_utxo_list_t* balancing_utxos = NULL;
+
+  result = get_balancing_utxos(state, &balancing_utxos);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to gather the UTXOs the transaction is balanced with.";
+
+    return result;
+  }
+
+  result = cardano_balance_transaction_with_pool_state(
+    tx,
+    state->additional_signature_count,
+    state->params,
+    state->reference_inputs,
+    state->pre_selected_inputs,
+    state->input_to_redeemer_map,
+    balancing_utxos,
+    state->coin_selector,
+    state->change_address,
+    state->collateral_utxos,
+    state->collateral_address,
+    state->tx_evaluator,
+    state->deferred_redeemers,
+    state->pool_state,
+    state->pool_state_size);
+
+  cardano_utxo_list_unref(&balancing_utxos);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = cardano_transaction_get_last_error(tx);
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(tx);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_input_set_t* inputs = cardano_transaction_body_get_inputs(body);
+  cardano_transaction_input_set_unref(&inputs);
+
+  result = cardano_builder_check_redeemers(state, tx, inputs, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_builder_update_script_data_hash(state, tx);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_transaction_ref(tx);
+  *transaction = tx;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_builder/internals/builder_build.h b/vendor/src/transaction_builder/internals/builder_build.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_build.h
@@ -0,0 +1,155 @@
+/**
+ * \file builder_build.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_BUILD_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_BUILD_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/transaction/transaction.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Balances and finalizes the transaction under construction.
+ *
+ * This function verifies that a change address and an available UTXO list were configured, that the
+ * transaction carries every top level guard its sub transactions require, and that a collateral
+ * change address and collateral UTXOs were configured when the transaction carries script data or a
+ * redeemer exists anywhere in the batch, including one carried only by a sub transaction. It then
+ * sets a placeholder script data hash for fee calculation when the transaction carries script data,
+ * balances the transaction using the configured protocol parameters, coin selector and transaction
+ * evaluator, checks that every script purpose of the balanced body and of the bodies of its sub
+ * transactions whose script is a Plutus script has a redeemer, recomputes the script data hash
+ * from the final redeemers, datums and cost models, and returns the finalized transaction with a
+ * new reference.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[out] transaction A pointer to a pointer that receives the finalized
+ *                         \ref cardano_transaction_t. The caller must release it with
+ *                         \ref cardano_transaction_unref. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS, or is left untouched
+ *                           when the failing operation does not report a message. The string is
+ *                           either static or owned by the transaction held by the state. It is left
+ *                           untouched on success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction was balanced and finalized,
+ *         \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if the transaction lacks a guard required by one of its
+ *         sub transactions, \ref CARDANO_ERROR_MISSING_REDEEMER if a script purpose of the transaction
+ *         or of one of its sub transactions needs a Plutus script but has no redeemer, or an
+ *         appropriate error code indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_build(
+  cardano_builder_state_t* state,
+  cardano_transaction_t**  transaction,
+  const char**             error_message);
+
+/**
+ * \brief Sets a placeholder script data hash in a transaction that carries script data.
+ *
+ * The placeholder has the size of the real hash, so the transaction can be sized and evaluated
+ * before its redeemers carry their final execution units. A transaction without script data is
+ * left unchanged.
+ *
+ * \param[in,out] tx A pointer to the \ref cardano_transaction_t that receives the placeholder. This
+ *                   parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the placeholder was set or the transaction carries no script data,
+ *         or an appropriate error code indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_set_dummy_script_data_hash(cardano_transaction_t* tx);
+
+/**
+ * \brief Computes and sets the script data hash of a transaction that carries script data.
+ *
+ * The hash covers the redeemers and datums of the transaction witness set and the cost models of
+ * the Plutus languages of the scripts the transaction needs. Like the ledger, a script counts only
+ * when the body needs it, through a spent input, the mint, a withdrawal, a certificate, a vote, a
+ * proposal guardrail or a guard, and its language is found among the scripts provided to the batch:
+ * the witness sets of the transaction and of its sub transactions, and the reference scripts of the
+ * reference inputs, the spent inputs and the UTXOs the sub transactions spend or reference. A
+ * provided script that the body does not need adds no language view. A transaction without script
+ * data is left unchanged.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t holding the protocol parameters and
+ *                  the resolved UTXOs of the transaction. This parameter must not be NULL.
+ * \param[in,out] tx A pointer to the \ref cardano_transaction_t whose script data hash is set. This
+ *                   parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the hash was set or the transaction carries no script data,
+ *         \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if an input of the transaction is not among the UTXOs of
+ *         \p state, or an appropriate error code indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_update_script_data_hash(cardano_builder_state_t* state, cardano_transaction_t* tx);
+
+/**
+ * \brief Checks that every script purpose of a transaction and of its sub transactions whose
+ * script is a Plutus script has a redeemer.
+ *
+ * The scripts the body needs are collected from the spent inputs, the mint, the withdrawals, the
+ * certificates, the voters, the proposal guardrails and the guards, and each one is looked up among
+ * the scripts provided to the batch: the witness sets of the transaction and of its sub transactions,
+ * and the reference scripts of the reference inputs, the spent inputs and the UTXOs the sub
+ * transactions spend or reference. Every purpose whose script resolves to a Plutus script must have a
+ * redeemer with the tag and index the ledger gives that purpose. The purposes of every sub
+ * transaction the transaction carries are then checked against the same pooled scripts, each one
+ * with the redeemers of the witness set of that sub transaction and spend indices counted in its own
+ * sorted inputs, which are resolved among the UTXOs the sub transactions spend. A purpose whose
+ * script is a native script, or a script that nothing provides, needs no redeemer.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t holding the resolved UTXOs of the
+ *                  transaction. This parameter must not be NULL.
+ * \param[in,out] tx A pointer to the \ref cardano_transaction_t to check. Its last error describes
+ *                   the purpose that has no redeemer. This parameter must not be NULL.
+ * \param[in] inputs A pointer to the sorted \ref cardano_transaction_input_set_t the transaction
+ *                   spends, which the indices of the spend redeemers point into.
+ * \param[out] error_message A pointer that receives a string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. The string is either
+ *                           static or owned by \p tx. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if every such purpose has a redeemer,
+ *         \ref CARDANO_ERROR_MISSING_REDEEMER if one of them has none, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_check_redeemers(
+  cardano_builder_state_t*         state,
+  cardano_transaction_t*           tx,
+  cardano_transaction_input_set_t* inputs,
+  const char**                     error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_BUILD_H
diff --git a/vendor/src/transaction_builder/internals/builder_certs.c b/vendor/src/transaction_builder/internals/builder_certs.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_certs.c
@@ -0,0 +1,939 @@
+/**
+ * \file builder_certs.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_certs.h"
+
+#include <cardano/certs/certificate_set.h>
+#include <cardano/certs/register_drep_cert.h>
+#include <cardano/certs/registration_cert.h>
+#include <cardano/certs/stake_delegation_cert.h>
+#include <cardano/certs/unregister_drep_cert.h>
+#include <cardano/certs/unregistration_cert.h>
+#include <cardano/certs/update_drep_cert.h>
+#include <cardano/certs/vote_delegation_cert.h>
+#include <cardano/common/ex_units.h>
+#include <cardano/encoding/bech32.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/witness_set/redeemer_list.h>
+#include <cardano/witness_set/witness_set.h>
+
+#include "builder_redeemers.h"
+
+#include <string.h>
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_add_certificate(
+  cardano_builder_state_t* state,
+  cardano_certificate_t*   certificate,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if (certificate == NULL)
+  {
+    *error_message = "Certificate is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_certificate_set_t* certs = cardano_transaction_body_get_certificates(body);
+
+  if (certs == NULL)
+  {
+    cardano_error_t result = cardano_certificate_set_new(&certs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create certificate set.";
+
+      return result;
+    }
+
+    result = cardano_transaction_body_set_certificates(body, certs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set certificate set.";
+      cardano_certificate_set_unref(&certs);
+
+      return result;
+    }
+  }
+
+  cardano_certificate_set_unref(&certs);
+
+  cardano_error_t result = cardano_certificate_set_add(certs, certificate);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add certificate.";
+
+    return result;
+  }
+
+  if (redeemer != NULL)
+  {
+    cardano_redeemer_t* rdmer = NULL;
+
+    cardano_ex_units_t* ex_units = NULL;
+    result                       = cardano_ex_units_new(0, 0, &ex_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create execution units.";
+
+      return result;
+    }
+
+    const size_t certs_size = cardano_certificate_set_get_length(certs);
+
+    if (certs_size == 0U)
+    {
+      cardano_ex_units_unref(&ex_units);
+      *error_message = "Unexpected empty certificate set.";
+
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+
+    const size_t cert_index = cardano_certificate_set_get_length(certs) - 1U;
+
+    result = cardano_redeemer_new(CARDANO_REDEEMER_TAG_CERTIFYING, cert_index, redeemer, ex_units, &rdmer);
+    cardano_ex_units_unref(&ex_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create redeemer.";
+
+      return result;
+    }
+
+    cardano_witness_set_t* witnesses = cardano_transaction_get_witness_set(state->transaction);
+    cardano_witness_set_unref(&witnesses);
+
+    cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witnesses);
+
+    if (redeemers == NULL)
+    {
+      result = cardano_redeemer_list_new(&redeemers);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_redeemer_unref(&rdmer);
+        *error_message = "Failed to create redeemer list.";
+
+        return result;
+      }
+
+      result = cardano_witness_set_set_redeemers(witnesses, redeemers);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_redeemer_unref(&rdmer);
+        *error_message = "Failed to set redeemer list.";
+        cardano_redeemer_list_unref(&redeemers);
+
+        return result;
+      }
+    }
+
+    cardano_redeemer_list_unref(&redeemers);
+
+    result = cardano_redeemer_list_add(redeemers, rdmer);
+    cardano_redeemer_unref(&rdmer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to add redeemer.";
+
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_register_reward_address(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer,
+  const char**              error_message)
+{
+  if (address == NULL)
+  {
+    *error_message = "Reward address is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_t* credential = cardano_reward_address_get_credential(address);
+  cardano_credential_unref(&credential);
+
+  const uint64_t deposit = cardano_protocol_parameters_get_key_deposit(state->params);
+
+  cardano_certificate_t*       cert         = NULL;
+  cardano_registration_cert_t* registration = NULL;
+  cardano_error_t              result       = cardano_registration_cert_new(credential, deposit, &registration);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create registration certificate.";
+
+    return result;
+  }
+
+  result = cardano_certificate_new_registration(registration, &cert);
+  cardano_registration_cert_unref(&registration);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create certificate.";
+
+    return result;
+  }
+
+  result = cardano_builder_add_certificate(state, cert, redeemer, error_message);
+  cardano_certificate_unref(&cert);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_register_reward_address_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if ((reward_address == NULL) || (address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_t* addr   = NULL;
+  cardano_error_t           result = cardano_reward_address_from_bech32(reward_address, address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  result = cardano_builder_register_reward_address(state, addr, redeemer, error_message);
+  cardano_reward_address_unref(&addr);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_deregister_reward_address(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer,
+  const char**              error_message)
+{
+  if (address == NULL)
+  {
+    *error_message = "Reward address is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_t* credential = cardano_reward_address_get_credential(address);
+  cardano_credential_unref(&credential);
+
+  const uint64_t deposit = cardano_protocol_parameters_get_key_deposit(state->params);
+
+  cardano_certificate_t*         cert           = NULL;
+  cardano_unregistration_cert_t* unregistration = NULL;
+
+  cardano_error_t result = cardano_unregistration_cert_new(credential, deposit, &unregistration);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create unregistration certificate.";
+
+    return result;
+  }
+
+  result = cardano_certificate_new_unregistration(unregistration, &cert);
+  cardano_unregistration_cert_unref(&unregistration);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create certificate.";
+
+    return result;
+  }
+
+  result = cardano_builder_add_certificate(state, cert, redeemer, error_message);
+  cardano_certificate_unref(&cert);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_deregister_reward_address_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if ((reward_address == NULL) || (address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_t* addr = NULL;
+
+  cardano_error_t result = cardano_reward_address_from_bech32(reward_address, address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  result = cardano_builder_deregister_reward_address(state, addr, redeemer, error_message);
+  cardano_reward_address_unref(&addr);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_delegate_stake(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* address,
+  cardano_blake2b_hash_t*   pool_id,
+  cardano_plutus_data_t*    redeemer,
+  const char**              error_message)
+{
+  if (address == NULL)
+  {
+    *error_message = "Reward address is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (pool_id == NULL)
+  {
+    *error_message = "Pool ID is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_t* credential = cardano_reward_address_get_credential(address);
+  cardano_credential_unref(&credential);
+
+  cardano_certificate_t*           cert       = NULL;
+  cardano_stake_delegation_cert_t* delegation = NULL;
+
+  cardano_error_t result = cardano_stake_delegation_cert_new(credential, pool_id, &delegation);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create delegation certificate.";
+
+    return result;
+  }
+
+  result = cardano_certificate_new_stake_delegation(delegation, &cert);
+  cardano_stake_delegation_cert_unref(&delegation);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create certificate.";
+
+    return result;
+  }
+
+  result = cardano_builder_add_certificate(state, cert, redeemer, error_message);
+  cardano_certificate_unref(&cert);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_delegate_stake_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  const char*              pool_id,
+  size_t                   pool_id_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if ((reward_address == NULL) || (address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((pool_id == NULL) || (pool_id_size == 0U))
+  {
+    *error_message = "Pool ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  byte_t pool_id_hex[28] = { 0 };
+  char   pool_hrp[5]     = { 0 };
+
+  cardano_error_t result = cardano_encoding_bech32_decode(pool_id, pool_id_size, pool_hrp, sizeof(pool_hrp), pool_id_hex, sizeof(pool_id_hex));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to decode pool ID.";
+
+    return result;
+  }
+
+  if (strncmp(pool_hrp, "pool", 4) != 0)
+  {
+    *error_message = "Invalid pool ID.";
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+  result                       = cardano_blake2b_hash_from_bytes(pool_id_hex, sizeof(pool_id_hex), &hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse pool ID.";
+
+    return result;
+  }
+
+  cardano_reward_address_t* addr = NULL;
+  result                         = cardano_reward_address_from_bech32(reward_address, address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&hash);
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  result = cardano_builder_delegate_stake(state, addr, hash, redeemer, error_message);
+  cardano_reward_address_unref(&addr);
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_delegate_voting_power(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* address,
+  cardano_drep_t*           drep,
+  cardano_plutus_data_t*    redeemer,
+  const char**              error_message)
+{
+  if (address == NULL)
+  {
+    *error_message = "Reward address is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (drep == NULL)
+  {
+    *error_message = "DREP is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_t* credential = cardano_reward_address_get_credential(address);
+  cardano_credential_unref(&credential);
+
+  cardano_certificate_t*          cert       = NULL;
+  cardano_vote_delegation_cert_t* delegation = NULL;
+
+  cardano_error_t result = cardano_vote_delegation_cert_new(credential, drep, &delegation);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create delegation certificate.";
+
+    return result;
+  }
+
+  result = cardano_certificate_new_vote_delegation(delegation, &cert);
+  cardano_vote_delegation_cert_unref(&delegation);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create certificate.";
+
+    return result;
+  }
+
+  result = cardano_builder_add_certificate(state, cert, redeemer, error_message);
+  cardano_certificate_unref(&cert);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_delegate_voting_power_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  const char*              drep_id,
+  size_t                   drep_id_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if ((reward_address == NULL) || (address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((drep_id == NULL) || (drep_id_size == 0U))
+  {
+    *error_message = "DREP ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_t* addr   = NULL;
+  cardano_error_t           result = cardano_reward_address_from_bech32(reward_address, address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  cardano_drep_t* drep = NULL;
+  result               = cardano_drep_from_string(drep_id, drep_id_size, &drep);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse DREP ID.";
+    cardano_reward_address_unref(&addr);
+
+    return result;
+  }
+
+  result = cardano_builder_delegate_voting_power(state, addr, drep, redeemer, error_message);
+
+  cardano_reward_address_unref(&addr);
+  cardano_drep_unref(&drep);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_register_drep(
+  cardano_builder_state_t* state,
+  cardano_drep_t*          drep,
+  cardano_anchor_t*        anchor,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if (drep == NULL)
+  {
+    *error_message = "DRep is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t*        cert          = NULL;
+  cardano_register_drep_cert_t* register_drep = NULL;
+  cardano_credential_t*         credential    = NULL;
+
+  cardano_error_t result = cardano_drep_get_credential(drep, &credential);
+  cardano_credential_unref(&credential);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to get credential.";
+
+    return result;
+  }
+
+  const uint64_t deposit = cardano_protocol_parameters_get_drep_deposit(state->params);
+  result                 = cardano_register_drep_cert_new(credential, deposit, anchor, &register_drep);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create DRep registration certificate.";
+
+    return result;
+  }
+
+  result = cardano_certificate_new_register_drep(register_drep, &cert);
+  cardano_register_drep_cert_unref(&register_drep);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create certificate.";
+
+    return result;
+  }
+
+  result = cardano_builder_add_certificate(state, cert, redeemer, error_message);
+  cardano_certificate_unref(&cert);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_register_drep_ex(
+  cardano_builder_state_t* state,
+  const char*              drep_id,
+  const size_t             drep_id_size,
+  const char*              metadata_url,
+  const size_t             metadata_url_size,
+  const char*              metadata_hash_hex,
+  const size_t             metadata_hash_hex_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if ((drep_id == NULL) || (drep_id_size == 0U))
+  {
+    *error_message = "DRep ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_error_t result = cardano_anchor_from_hash_hex(metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, &anchor);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create anchor.";
+
+    return result;
+  }
+
+  cardano_drep_t* drep = NULL;
+  result               = cardano_drep_from_string(drep_id, drep_id_size, &drep);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    *error_message = "Failed to parse DRep ID.";
+
+    return result;
+  }
+
+  result = cardano_builder_register_drep(state, drep, anchor, redeemer, error_message);
+
+  cardano_drep_unref(&drep);
+  cardano_anchor_unref(&anchor);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_update_drep(
+  cardano_builder_state_t* state,
+  cardano_drep_t*          drep,
+  cardano_anchor_t*        anchor,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if (drep == NULL)
+  {
+    *error_message = "DRep is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t*      cert        = NULL;
+  cardano_update_drep_cert_t* update_drep = NULL;
+  cardano_credential_t*       credential  = NULL;
+
+  cardano_error_t result = cardano_drep_get_credential(drep, &credential);
+  cardano_credential_unref(&credential);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to get credential.";
+
+    return result;
+  }
+
+  result = cardano_update_drep_cert_new(credential, anchor, &update_drep);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create DRep update certificate.";
+
+    return result;
+  }
+
+  result = cardano_certificate_new_update_drep(update_drep, &cert);
+  cardano_update_drep_cert_unref(&update_drep);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create certificate.";
+
+    return result;
+  }
+
+  result = cardano_builder_add_certificate(state, cert, redeemer, error_message);
+  cardano_certificate_unref(&cert);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_update_drep_ex(
+  cardano_builder_state_t* state,
+  const char*              drep_id,
+  const size_t             drep_id_size,
+  const char*              metadata_url,
+  const size_t             metadata_url_size,
+  const char*              metadata_hash_hex,
+  const size_t             metadata_hash_hex_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if ((drep_id == NULL) || (drep_id_size == 0U))
+  {
+    *error_message = "DRep ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_error_t result = cardano_anchor_from_hash_hex(metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, &anchor);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create anchor.";
+
+    return result;
+  }
+
+  cardano_drep_t* drep = NULL;
+  result               = cardano_drep_from_string(drep_id, drep_id_size, &drep);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    *error_message = "Failed to parse DRep ID.";
+
+    return result;
+  }
+
+  result = cardano_builder_update_drep(state, drep, anchor, redeemer, error_message);
+
+  cardano_drep_unref(&drep);
+  cardano_anchor_unref(&anchor);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_deregister_drep(
+  cardano_builder_state_t* state,
+  cardano_drep_t*          drep,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if (drep == NULL)
+  {
+    *error_message = "DRep is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_certificate_t*          cert           = NULL;
+  cardano_unregister_drep_cert_t* deregistration = NULL;
+  cardano_credential_t*           credential     = NULL;
+
+  cardano_error_t result = cardano_drep_get_credential(drep, &credential);
+  cardano_credential_unref(&credential);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to get credential.";
+
+    return result;
+  }
+
+  const uint64_t deposit = cardano_protocol_parameters_get_drep_deposit(state->params);
+  result                 = cardano_unregister_drep_cert_new(credential, deposit, &deregistration);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create DRep deregistration certificate.";
+
+    return result;
+  }
+
+  result = cardano_certificate_new_unregister_drep(deregistration, &cert);
+  cardano_unregister_drep_cert_unref(&deregistration);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create certificate.";
+
+    return result;
+  }
+
+  result = cardano_builder_add_certificate(state, cert, redeemer, error_message);
+  cardano_certificate_unref(&cert);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_deregister_drep_ex(
+  cardano_builder_state_t* state,
+  const char*              drep_id,
+  size_t                   drep_id_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if ((drep_id == NULL) || (drep_id_size == 0U))
+  {
+    *error_message = "DRep ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_drep_t* drep   = NULL;
+  cardano_error_t result = cardano_drep_from_string(drep_id, drep_id_size, &drep);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse DRep ID.";
+
+    return result;
+  }
+
+  result = cardano_builder_deregister_drep(state, drep, redeemer, error_message);
+  cardano_drep_unref(&drep);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_certificate_with_deferred_redeemer(
+  cardano_builder_state_t*       state,
+  cardano_certificate_t*         certificate,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  const char**                   error_message)
+{
+  if ((certificate == NULL) || (callback == NULL))
+  {
+    *error_message = "Certificate and callback are required";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* placeholder = NULL;
+
+  cardano_error_t result = cardano_builder_create_placeholder_plutus_data(&placeholder);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create the placeholder redeemer.";
+
+    return result;
+  }
+
+  result = cardano_builder_add_certificate(state, certificate, placeholder, error_message);
+
+  cardano_plutus_data_unref(&placeholder);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_certificate_set_t* certs = cardano_transaction_body_get_certificates(body);
+  cardano_certificate_set_unref(&certs);
+
+  const uint64_t cert_index = (uint64_t)(cardano_certificate_set_get_length(certs) - 1U);
+
+  cardano_witness_set_t* witnesses = cardano_transaction_get_witness_set(state->transaction);
+  cardano_witness_set_unref(&witnesses);
+
+  cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witnesses);
+  cardano_redeemer_list_unref(&redeemers);
+
+  result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+
+  const size_t redeemer_count = cardano_redeemer_list_get_length(redeemers);
+
+  for (size_t i = 0U; (i < redeemer_count) && (result == CARDANO_ERROR_ELEMENT_NOT_FOUND); ++i)
+  {
+    cardano_redeemer_t* redeemer = NULL;
+
+    const cardano_error_t get_result = cardano_redeemer_list_get(redeemers, i, &redeemer);
+
+    if (get_result != CARDANO_SUCCESS)
+    {
+      result = get_result;
+      break;
+    }
+
+    const bool matches = (cardano_redeemer_get_tag(redeemer) == CARDANO_REDEEMER_TAG_CERTIFYING) &&
+      (cardano_redeemer_get_index(redeemer) == cert_index);
+
+    if (matches)
+    {
+      result = cardano_deferred_redeemer_list_add(state->deferred_redeemers, redeemer, callback, user_context);
+    }
+
+    cardano_redeemer_unref(&redeemer);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to register the deferred redeemer.";
+  }
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/internals/builder_certs.h b/vendor/src/transaction_builder/internals/builder_certs.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_certs.h
@@ -0,0 +1,513 @@
+/**
+ * \file builder_certs.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_CERTS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_CERTS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/certs/certificate.h>
+#include <cardano/common/anchor.h>
+#include <cardano/common/drep.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Appends a certificate to the transaction.
+ *
+ * This function adds \p certificate to the certificate set of the transaction body, creating the
+ * set when it is missing. When \p redeemer is not NULL a certifying redeemer with the index of the
+ * appended certificate and zero execution units is created and appended to the witness set redeemer
+ * list, creating the list when it is missing.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] certificate A pointer to the \ref cardano_certificate_t to add. This parameter must not
+ *                        be NULL.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the certificate does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_add_certificate(
+  cardano_builder_state_t* state,
+  cardano_certificate_t*   certificate,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Adds a stake registration certificate for a reward address.
+ *
+ * This function creates a registration certificate for the credential of \p address using the key
+ * deposit from the state protocol parameters and delegates to \ref cardano_builder_add_certificate.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t to register. This parameter must
+ *                    not be NULL.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_register_reward_address(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer,
+  const char**              error_message);
+
+/**
+ * \brief Adds a stake registration certificate given the reward address as a bech32 string.
+ *
+ * This function parses the reward address and delegates to
+ * \ref cardano_builder_register_reward_address.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_register_reward_address_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Adds a stake unregistration certificate for a reward address.
+ *
+ * This function creates an unregistration certificate for the credential of \p address using the
+ * key deposit from the state protocol parameters and delegates to
+ * \ref cardano_builder_add_certificate.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t to deregister. This parameter
+ *                    must not be NULL.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_deregister_reward_address(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer,
+  const char**              error_message);
+
+/**
+ * \brief Adds a stake unregistration certificate given the reward address as a bech32 string.
+ *
+ * This function parses the reward address and delegates to
+ * \ref cardano_builder_deregister_reward_address.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_deregister_reward_address_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Adds a stake delegation certificate for a reward address and a pool.
+ *
+ * This function creates a stake delegation certificate delegating the credential of \p address to
+ * the pool identified by \p pool_id and delegates to \ref cardano_builder_add_certificate.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t whose stake is delegated. This
+ *                    parameter must not be NULL.
+ * \param[in] pool_id A pointer to the \ref cardano_blake2b_hash_t with the pool key hash. This
+ *                    parameter must not be NULL.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_delegate_stake(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* address,
+  cardano_blake2b_hash_t*   pool_id,
+  cardano_plutus_data_t*    redeemer,
+  const char**              error_message);
+
+/**
+ * \brief Adds a stake delegation certificate given the reward address and pool id as bech32 strings.
+ *
+ * This function decodes the pool id, requiring the pool prefix, parses the reward address and
+ * delegates to \ref cardano_builder_delegate_stake.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] pool_id A pointer to the bech32 string with the pool id.
+ * \param[in] pool_id_size The size of the pool id string in bytes.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_delegate_stake_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  const char*              pool_id,
+  size_t                   pool_id_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Adds a vote delegation certificate for a reward address and a DRep.
+ *
+ * This function creates a vote delegation certificate delegating the voting power of the credential
+ * of \p address to \p drep and delegates to \ref cardano_builder_add_certificate.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t whose voting power is delegated.
+ *                    This parameter must not be NULL.
+ * \param[in] drep A pointer to the \ref cardano_drep_t receiving the voting power. This parameter
+ *                 must not be NULL.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_delegate_voting_power(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* address,
+  cardano_drep_t*           drep,
+  cardano_plutus_data_t*    redeemer,
+  const char**              error_message);
+
+/**
+ * \brief Adds a vote delegation certificate given the reward address and DRep id as strings.
+ *
+ * This function parses the reward address and the DRep id and delegates to
+ * \ref cardano_builder_delegate_voting_power.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] drep_id A pointer to the string with the DRep id.
+ * \param[in] drep_id_size The size of the DRep id string in bytes.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_delegate_voting_power_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  const char*              drep_id,
+  size_t                   drep_id_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Adds a DRep registration certificate.
+ *
+ * This function creates a DRep registration certificate for the credential of \p drep using the
+ * DRep deposit from the state protocol parameters and the optional \p anchor, and delegates to
+ * \ref cardano_builder_add_certificate.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] drep A pointer to the \ref cardano_drep_t to register. This parameter must not be NULL.
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t with the DRep metadata, or NULL when the
+ *                   DRep has none.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_register_drep(
+  cardano_builder_state_t* state,
+  cardano_drep_t*          drep,
+  cardano_anchor_t*        anchor,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Adds a DRep registration certificate given the DRep id and metadata as strings.
+ *
+ * This function creates the metadata anchor from the url and hash strings, parses the DRep id and
+ * delegates to \ref cardano_builder_register_drep.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] drep_id A pointer to the string with the DRep id.
+ * \param[in] drep_id_size The size of the DRep id string in bytes.
+ * \param[in] metadata_url A pointer to the string with the metadata url.
+ * \param[in] metadata_url_size The size of the metadata url string in bytes.
+ * \param[in] metadata_hash_hex A pointer to the hexadecimal string with the metadata hash.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_register_drep_ex(
+  cardano_builder_state_t* state,
+  const char*              drep_id,
+  size_t                   drep_id_size,
+  const char*              metadata_url,
+  size_t                   metadata_url_size,
+  const char*              metadata_hash_hex,
+  size_t                   metadata_hash_hex_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Adds a DRep update certificate.
+ *
+ * This function creates a DRep update certificate for the credential of \p drep carrying the
+ * optional \p anchor and delegates to \ref cardano_builder_add_certificate.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] drep A pointer to the \ref cardano_drep_t to update. This parameter must not be NULL.
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t with the DRep metadata, or NULL when the
+ *                   DRep has none.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_update_drep(
+  cardano_builder_state_t* state,
+  cardano_drep_t*          drep,
+  cardano_anchor_t*        anchor,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Adds a DRep update certificate given the DRep id and metadata as strings.
+ *
+ * This function creates the metadata anchor from the url and hash strings, parses the DRep id and
+ * delegates to \ref cardano_builder_update_drep.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] drep_id A pointer to the string with the DRep id.
+ * \param[in] drep_id_size The size of the DRep id string in bytes.
+ * \param[in] metadata_url A pointer to the string with the metadata url.
+ * \param[in] metadata_url_size The size of the metadata url string in bytes.
+ * \param[in] metadata_hash_hex A pointer to the hexadecimal string with the metadata hash.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_update_drep_ex(
+  cardano_builder_state_t* state,
+  const char*              drep_id,
+  size_t                   drep_id_size,
+  const char*              metadata_url,
+  size_t                   metadata_url_size,
+  const char*              metadata_hash_hex,
+  size_t                   metadata_hash_hex_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Adds a DRep deregistration certificate.
+ *
+ * This function creates a DRep deregistration certificate for the credential of \p drep using the
+ * DRep deposit from the state protocol parameters and delegates to
+ * \ref cardano_builder_add_certificate.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] drep A pointer to the \ref cardano_drep_t to deregister. This parameter must not be
+ *                 NULL.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_deregister_drep(
+  cardano_builder_state_t* state,
+  cardano_drep_t*          drep,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Adds a DRep deregistration certificate given the DRep id as a string.
+ *
+ * This function parses the DRep id and delegates to \ref cardano_builder_deregister_drep.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] drep_id A pointer to the string with the DRep id.
+ * \param[in] drep_id_size The size of the DRep id string in bytes.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as certifying redeemer
+ *                     payload, or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_deregister_drep_ex(
+  cardano_builder_state_t* state,
+  const char*              drep_id,
+  size_t                   drep_id_size,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Appends a certificate whose redeemer payload is resolved during balancing.
+ *
+ * This function appends the certificate with an empty placeholder redeemer, finds the certifying
+ * redeemer created for it in the witness set redeemer list and registers the callback for it in the
+ * state deferred redeemer list. The callback is invoked while the transaction is balanced to produce
+ * the final redeemer payload.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] certificate A pointer to the \ref cardano_certificate_t to add. This parameter must not
+ *                        be NULL.
+ * \param[in] callback The deferred redeemer callback invoked during balancing. This parameter must
+ *                     not be NULL.
+ * \param[in] user_context The opaque pointer forwarded to the callback.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the certificate and callback were registered, or an appropriate
+ *         error code indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_add_certificate_with_deferred_redeemer(
+  cardano_builder_state_t*       state,
+  cardano_certificate_t*         certificate,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  const char**                   error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_CERTS_H
diff --git a/vendor/src/transaction_builder/internals/builder_config.c b/vendor/src/transaction_builder/internals/builder_config.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_config.c
@@ -0,0 +1,528 @@
+/**
+ * \file builder_config.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_config.h"
+
+#include <cardano/auxiliary_data/auxiliary_data.h>
+#include <cardano/auxiliary_data/transaction_metadata.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/time.h>
+#include <cardano/transaction_body/transaction_body.h>
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_set_coin_selector(
+  cardano_builder_state_t* state,
+  cardano_coin_selector_t* coin_selector,
+  const char**             error_message)
+{
+  if (coin_selector == NULL)
+  {
+    *error_message = "Coin selector is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_coin_selector_ref(coin_selector);
+  cardano_coin_selector_unref(&state->coin_selector);
+  state->coin_selector = coin_selector;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_set_tx_evaluator(
+  cardano_builder_state_t* state,
+  cardano_tx_evaluator_t*  tx_evaluator,
+  const char**             error_message)
+{
+  if (tx_evaluator == NULL)
+  {
+    *error_message = "Transaction evaluator is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_tx_evaluator_ref(tx_evaluator);
+  cardano_tx_evaluator_unref(&state->tx_evaluator);
+  state->tx_evaluator = tx_evaluator;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_set_network_id(
+  cardano_builder_state_t*   state,
+  const cardano_network_id_t network_id,
+  const char**               error_message)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  if (body == NULL)
+  {
+    *error_message = "Transaction body is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_transaction_body_set_network_id(body, &network_id);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set network ID.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_set_change_address(
+  cardano_builder_state_t* state,
+  cardano_address_t*       change_address,
+  const char**             error_message)
+{
+  if (change_address == NULL)
+  {
+    *error_message = "Change address is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_ref(change_address);
+  cardano_address_unref(&state->change_address);
+  state->change_address = change_address;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_set_change_address_ex(
+  cardano_builder_state_t* state,
+  const char*              change_address,
+  const size_t             address_size,
+  const char**             error_message)
+{
+  if ((change_address == NULL) || (address_size == 0U))
+  {
+    *error_message = "Change address is NULL or empty.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_t* address = NULL;
+  cardano_error_t    result  = cardano_address_from_string(change_address, address_size, &address);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse change address.";
+    return result;
+  }
+
+  result = cardano_builder_set_change_address(state, address, error_message);
+  cardano_address_unref(&address);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_set_collateral_change_address(
+  cardano_builder_state_t* state,
+  cardano_address_t*       collateral_change_address,
+  const char**             error_message)
+{
+  if (collateral_change_address == NULL)
+  {
+    *error_message = "Collateral change address is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_ref(collateral_change_address);
+  cardano_address_unref(&state->collateral_address);
+  state->collateral_address = collateral_change_address;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_set_collateral_change_address_ex(
+  cardano_builder_state_t* state,
+  const char*              collateral_change_address,
+  const size_t             address_size,
+  const char**             error_message)
+{
+  if ((collateral_change_address == NULL) || (address_size == 0U))
+  {
+    *error_message = "Collateral change address is NULL or empty.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_t* address = NULL;
+  cardano_error_t    result  = cardano_address_from_string(collateral_change_address, address_size, &address);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse collateral change address.";
+    return result;
+  }
+
+  result = cardano_builder_set_collateral_change_address(state, address, error_message);
+  cardano_address_unref(&address);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_set_minimum_fee(
+  cardano_builder_state_t* state,
+  const uint64_t           minimum_fee,
+  const char**             error_message)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  if (body == NULL)
+  {
+    *error_message = "Transaction body is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_transaction_body_set_fee(body, minimum_fee);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set fee.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_set_donation(
+  cardano_builder_state_t* state,
+  const uint64_t           donation,
+  const char**             error_message)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  if (body == NULL)
+  {
+    *error_message = "Transaction body is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (donation == 0U)
+  {
+    result = cardano_transaction_body_set_donation(body, NULL);
+  }
+  else
+  {
+    result = cardano_transaction_body_set_donation(body, &donation);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set donation.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_set_current_treasury_value(
+  cardano_builder_state_t* state,
+  const uint64_t           current_treasury_value,
+  const char**             error_message)
+{
+  cardano_transaction_body_t* body   = cardano_transaction_get_body(state->transaction);
+  const cardano_error_t       result = cardano_transaction_body_set_treasury_value(body, &current_treasury_value);
+  cardano_transaction_body_unref(&body);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set current treasury value.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_set_utxos(
+  cardano_builder_state_t* state,
+  cardano_utxo_list_t*     utxos,
+  const char**             error_message)
+{
+  if (utxos == NULL)
+  {
+    *error_message = "UTXOs list is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_utxo_list_ref(utxos);
+  cardano_utxo_list_unref(&state->available_utxos);
+  state->available_utxos = utxos;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_set_collateral_utxos(
+  cardano_builder_state_t* state,
+  cardano_utxo_list_t*     utxos,
+  const char**             error_message)
+{
+  if (utxos == NULL)
+  {
+    *error_message = "Collateral UTXOs list is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_utxo_list_ref(utxos);
+  cardano_utxo_list_unref(&state->collateral_utxos);
+  state->collateral_utxos = utxos;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_set_invalid_after(
+  cardano_builder_state_t* state,
+  const uint64_t           slot,
+  const char**             error_message)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  if (body == NULL)
+  {
+    *error_message = "Transaction body is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_transaction_body_set_invalid_after(body, &slot);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set invalid after.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_set_invalid_after_ex(
+  cardano_builder_state_t* state,
+  const uint64_t           unix_time,
+  const char**             error_message)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  if (body == NULL)
+  {
+    *error_message = "Transaction body is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const uint64_t  slot   = unix_time_to_enclosing_slot(unix_time * 1000U, &state->slot_config);
+  cardano_error_t result = cardano_transaction_body_set_invalid_after(body, &slot);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set invalid after.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_set_invalid_before(
+  cardano_builder_state_t* state,
+  const uint64_t           slot,
+  const char**             error_message)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  if (body == NULL)
+  {
+    *error_message = "Transaction body is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = cardano_transaction_body_set_invalid_before(body, &slot);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set invalid before.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_set_invalid_before_ex(
+  cardano_builder_state_t* state,
+  const uint64_t           unix_time,
+  const char**             error_message)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  if (body == NULL)
+  {
+    *error_message = "Transaction body is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const uint64_t  slot   = unix_time_to_enclosing_slot(unix_time * 1000U, &state->slot_config);
+  cardano_error_t result = cardano_transaction_body_set_invalid_before(body, &slot);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set invalid before.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_set_metadata(
+  cardano_builder_state_t* state,
+  const uint64_t           tag,
+  cardano_metadatum_t*     metadata,
+  const char**             error_message)
+{
+  if (metadata == NULL)
+  {
+    *error_message = "Metadata is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_auxiliary_data_t* auxiliary_data = cardano_transaction_get_auxiliary_data(state->transaction);
+
+  if (auxiliary_data == NULL)
+  {
+    cardano_error_t result = cardano_auxiliary_data_new(&auxiliary_data);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create auxiliary data.";
+      return result;
+    }
+
+    result = cardano_transaction_set_auxiliary_data(state->transaction, auxiliary_data);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set auxiliary data.";
+      cardano_auxiliary_data_unref(&auxiliary_data);
+      return result;
+    }
+  }
+
+  cardano_auxiliary_data_unref(&auxiliary_data);
+
+  cardano_transaction_metadata_t* tx_metadata = cardano_auxiliary_data_get_transaction_metadata(auxiliary_data);
+
+  if (tx_metadata == NULL)
+  {
+    cardano_error_t result = cardano_transaction_metadata_new(&tx_metadata);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create transaction metadata.";
+      return result;
+    }
+
+    result = cardano_auxiliary_data_set_transaction_metadata(auxiliary_data, tx_metadata);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set transaction metadata.";
+      cardano_transaction_metadata_unref(&tx_metadata);
+      return result;
+    }
+  }
+
+  cardano_transaction_metadata_unref(&tx_metadata);
+
+  cardano_error_t result = cardano_transaction_metadata_insert(tx_metadata, tag, metadata);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to insert metadata.";
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_blake2b_hash_t* hash = cardano_auxiliary_data_get_hash(auxiliary_data);
+
+  result = cardano_transaction_body_set_aux_data_hash(body, hash);
+  cardano_blake2b_hash_unref(&hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set auxiliary data hash.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_set_metadata_ex(
+  cardano_builder_state_t* state,
+  const uint64_t           tag,
+  const char*              metadata_json,
+  const size_t             json_size,
+  const char**             error_message)
+{
+  if ((metadata_json == NULL) || (json_size == 0U))
+  {
+    *error_message = "Metadata is NULL or empty.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_metadatum_t* metadata = NULL;
+  cardano_error_t      result   = cardano_metadatum_from_json(metadata_json, json_size, &metadata);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse metadata.";
+    return result;
+  }
+
+  result = cardano_builder_set_metadata(state, tag, metadata, error_message);
+  cardano_metadatum_unref(&metadata);
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/internals/builder_config.h b/vendor/src/transaction_builder/internals/builder_config.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_config.h
@@ -0,0 +1,440 @@
+/**
+ * \file builder_config.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_CONFIG_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_CONFIG_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/auxiliary_data/metadatum.h>
+#include <cardano/common/network_id.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+#include <cardano/transaction_builder/evaluation/tx_evaluator.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Sets the coin selection strategy used during balancing.
+ *
+ * This function takes a reference on \p coin_selector and stores it in the state, releasing the
+ * previously configured coin selector.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] coin_selector A pointer to the \ref cardano_coin_selector_t to use. This parameter must
+ *                          not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the coin selector was set, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_set_coin_selector(
+  cardano_builder_state_t* state,
+  cardano_coin_selector_t* coin_selector,
+  const char**             error_message);
+
+/**
+ * \brief Sets the evaluator used to compute execution units for Plutus scripts.
+ *
+ * This function takes a reference on \p tx_evaluator and stores it in the state, releasing the
+ * previously configured transaction evaluator.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] tx_evaluator A pointer to the \ref cardano_tx_evaluator_t to use. This parameter must
+ *                         not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction evaluator was set, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_set_tx_evaluator(
+  cardano_builder_state_t* state,
+  cardano_tx_evaluator_t*  tx_evaluator,
+  const char**             error_message);
+
+/**
+ * \brief Sets the network identifier in the transaction body.
+ *
+ * This function writes \p network_id into the body of the transaction under construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] network_id The \ref cardano_network_id_t to set.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the network identifier was set, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_set_network_id(
+  cardano_builder_state_t* state,
+  cardano_network_id_t     network_id,
+  const char**             error_message);
+
+/**
+ * \brief Sets the address that receives any change produced while balancing.
+ *
+ * This function takes a reference on \p change_address and stores it in the state, releasing the
+ * previously configured change address.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] change_address A pointer to the \ref cardano_address_t to use. This parameter must not
+ *                           be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the change address was set, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_set_change_address(
+  cardano_builder_state_t* state,
+  cardano_address_t*       change_address,
+  const char**             error_message);
+
+/**
+ * \brief Sets the change address given its string representation.
+ *
+ * This function parses \p change_address and delegates to \ref cardano_builder_set_change_address.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] change_address A pointer to the string with the change address.
+ * \param[in] address_size The size of the change address string in bytes.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the change address was set, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_set_change_address_ex(
+  cardano_builder_state_t* state,
+  const char*              change_address,
+  size_t                   address_size,
+  const char**             error_message);
+
+/**
+ * \brief Sets the address that receives any collateral change output.
+ *
+ * This function takes a reference on \p collateral_change_address and stores it in the state,
+ * releasing the previously configured collateral change address.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] collateral_change_address A pointer to the \ref cardano_address_t to use. This parameter
+ *                                      must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the collateral change address was set, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_set_collateral_change_address(
+  cardano_builder_state_t* state,
+  cardano_address_t*       collateral_change_address,
+  const char**             error_message);
+
+/**
+ * \brief Sets the collateral change address given its string representation.
+ *
+ * This function parses \p collateral_change_address and delegates to
+ * \ref cardano_builder_set_collateral_change_address.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] collateral_change_address A pointer to the string with the collateral change address.
+ * \param[in] address_size The size of the collateral change address string in bytes.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the collateral change address was set, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_set_collateral_change_address_ex(
+  cardano_builder_state_t* state,
+  const char*              collateral_change_address,
+  size_t                   address_size,
+  const char**             error_message);
+
+/**
+ * \brief Sets the fee in the transaction body.
+ *
+ * This function writes \p minimum_fee as the fee of the transaction under construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] minimum_fee The fee in lovelace to set.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the fee was set, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_set_minimum_fee(
+  cardano_builder_state_t* state,
+  uint64_t                 minimum_fee,
+  const char**             error_message);
+
+/**
+ * \brief Sets the treasury donation in the transaction body.
+ *
+ * This function writes \p donation as the donation of the transaction under construction, removing
+ * any previously set donation when \p donation is zero.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] donation The donation in lovelace to set.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the donation was set, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_set_donation(
+  cardano_builder_state_t* state,
+  uint64_t                 donation,
+  const char**             error_message);
+
+/** \brief Sets the current treasury value, including an explicit zero. */
+
+cardano_error_t
+cardano_builder_set_current_treasury_value(
+  cardano_builder_state_t* state,
+  uint64_t                 current_treasury_value,
+  const char**             error_message);
+
+/**
+ * \brief Sets the UTXO set available to the coin selector for input selection.
+ *
+ * This function takes a reference on \p utxos and stores it in the state, releasing the previously
+ * configured UTXO list.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] utxos A pointer to the \ref cardano_utxo_list_t to use. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the UTXO list was set, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_set_utxos(
+  cardano_builder_state_t* state,
+  cardano_utxo_list_t*     utxos,
+  const char**             error_message);
+
+/**
+ * \brief Sets the UTXO set available for collateral selection.
+ *
+ * This function takes a reference on \p utxos and stores it in the state, releasing the previously
+ * configured collateral UTXO list.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] utxos A pointer to the \ref cardano_utxo_list_t to use. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the collateral UTXO list was set, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_set_collateral_utxos(
+  cardano_builder_state_t* state,
+  cardano_utxo_list_t*     utxos,
+  const char**             error_message);
+
+/**
+ * \brief Sets the slot after which the transaction is invalid.
+ *
+ * This function writes \p slot as the invalid after bound of the transaction under construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] slot The slot number to set.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the bound was set, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_set_invalid_after(
+  cardano_builder_state_t* state,
+  uint64_t                 slot,
+  const char**             error_message);
+
+/**
+ * \brief Sets the slot after which the transaction is invalid given a Unix time.
+ *
+ * This function converts \p unix_time to the enclosing slot using the state slot configuration and
+ * writes it as the invalid after bound of the transaction under construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] unix_time The Unix time in seconds to convert.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the bound was set, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_set_invalid_after_ex(
+  cardano_builder_state_t* state,
+  uint64_t                 unix_time,
+  const char**             error_message);
+
+/**
+ * \brief Sets the slot before which the transaction is invalid.
+ *
+ * This function writes \p slot as the invalid before bound of the transaction under construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] slot The slot number to set.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the bound was set, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_set_invalid_before(
+  cardano_builder_state_t* state,
+  uint64_t                 slot,
+  const char**             error_message);
+
+/**
+ * \brief Sets the slot before which the transaction is invalid given a Unix time.
+ *
+ * This function converts \p unix_time to the enclosing slot using the state slot configuration and
+ * writes it as the invalid before bound of the transaction under construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] unix_time The Unix time in seconds to convert.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the bound was set, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_set_invalid_before_ex(
+  cardano_builder_state_t* state,
+  uint64_t                 unix_time,
+  const char**             error_message);
+
+/**
+ * \brief Inserts a metadatum under a tag in the transaction metadata.
+ *
+ * This function inserts \p metadata under \p tag in the transaction metadata of the auxiliary data,
+ * creating the auxiliary data and the metadata map when they are missing, and refreshes the
+ * auxiliary data hash in the transaction body.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] tag The metadata label under which the metadatum is inserted.
+ * \param[in] metadata A pointer to the \ref cardano_metadatum_t to insert. This parameter must not
+ *                     be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum was inserted, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_set_metadata(
+  cardano_builder_state_t* state,
+  uint64_t                 tag,
+  cardano_metadatum_t*     metadata,
+  const char**             error_message);
+
+/**
+ * \brief Inserts a metadatum under a tag given its JSON representation.
+ *
+ * This function parses \p metadata_json into a metadatum and delegates to
+ * \ref cardano_builder_set_metadata.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] tag The metadata label under which the metadatum is inserted.
+ * \param[in] metadata_json A pointer to the JSON string with the metadatum.
+ * \param[in] json_size The size of the JSON string in bytes.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the metadatum was inserted, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_set_metadata_ex(
+  cardano_builder_state_t* state,
+  uint64_t                 tag,
+  const char*              metadata_json,
+  size_t                   json_size,
+  const char**             error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_CONFIG_H
diff --git a/vendor/src/transaction_builder/internals/builder_entities.c b/vendor/src/transaction_builder/internals/builder_entities.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_entities.c
@@ -0,0 +1,508 @@
+/**
+ * \file builder_entities.c
+ *
+ * \author angel.castillo
+ * \date   Sep 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_entities.h"
+
+#include <cardano/transaction_body/account_balance_intervals_map.h>
+#include <cardano/transaction_body/direct_deposit_map.h>
+#include <cardano/transaction_body/transaction_body.h>
+
+#include <string.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Compares two reward addresses based on their serialized bytes.
+ *
+ * \param[in] lhs Pointer to the first reward address object.
+ * \param[in] rhs Pointer to the second reward address object.
+ *
+ * \return true if the addresses are equal, false otherwise.
+ */
+static bool
+reward_address_equals(const cardano_reward_address_t* lhs, const cardano_reward_address_t* rhs)
+{
+  const size_t lhs_size = cardano_reward_address_get_bytes_size(lhs);
+  const size_t rhs_size = cardano_reward_address_get_bytes_size(rhs);
+
+  if (lhs_size != rhs_size)
+  {
+    return false;
+  }
+
+  const byte_t* lhs_bytes = cardano_reward_address_get_bytes(lhs);
+  const byte_t* rhs_bytes = cardano_reward_address_get_bytes(rhs);
+
+  return memcmp(lhs_bytes, rhs_bytes, lhs_size) == 0;
+}
+
+/**
+ * \brief Parses a reward address from its bech32 representation.
+ *
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[out] address On success, this will point to a newly created \ref cardano_reward_address_t.
+ *                     The caller is responsible for releasing it with \ref cardano_reward_address_unref.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS.
+ *
+ * \return \ref CARDANO_SUCCESS if the reward address was parsed, or an appropriate error code
+ *         indicating the failure reason.
+ */
+static cardano_error_t
+parse_reward_address(
+  const char*                reward_address,
+  const size_t               address_size,
+  cardano_reward_address_t** address,
+  const char**               error_message)
+{
+  if ((reward_address == NULL) || (address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const cardano_error_t result = cardano_reward_address_from_bech32(reward_address, address_size, address);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse reward address.";
+  }
+
+  return result;
+}
+
+/**
+ * \brief Copies a direct deposit map setting the amount deposited to one reward account.
+ *
+ * Direct deposit maps reject duplicated keys and entries can not be updated in place, so this
+ * function builds a new map with every entry of \p current, kept sorted by reward address. The
+ * entry of \p reward_address gets \p amount, and it is added when the account is not present.
+ *
+ * \param[in] current A pointer to the \ref cardano_direct_deposit_map_t to copy, or NULL when there
+ *                    are no direct deposits yet.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t of the entry to set.
+ * \param[in] amount The amount of lovelace stored in the entry.
+ * \param[out] updated On success, this will point to the newly created map. The caller is responsible
+ *                     for releasing it with \ref cardano_direct_deposit_map_unref.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS.
+ *
+ * \return \ref CARDANO_SUCCESS if the map was created, or an appropriate error code indicating the
+ *         failure reason.
+ */
+static cardano_error_t
+copy_with_direct_deposit(
+  const cardano_direct_deposit_map_t* current,
+  cardano_reward_address_t*           reward_address,
+  const uint64_t                      amount,
+  cardano_direct_deposit_map_t**      updated,
+  const char**                        error_message)
+{
+  cardano_direct_deposit_map_t* deposits = NULL;
+  cardano_error_t               result   = cardano_direct_deposit_map_new(&deposits);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create direct deposit map.";
+
+    return result;
+  }
+
+  const size_t length   = cardano_direct_deposit_map_get_length(current);
+  bool         replaced = false;
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_reward_address_t* key   = NULL;
+    uint64_t                  value = 0U;
+
+    result = cardano_direct_deposit_map_get_key_value_at(current, i, &key, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to read direct deposit.";
+      cardano_direct_deposit_map_unref(&deposits);
+
+      return result;
+    }
+
+    if (reward_address_equals(key, reward_address))
+    {
+      value    = amount;
+      replaced = true;
+    }
+
+    result = cardano_direct_deposit_map_insert(deposits, key, value);
+    cardano_reward_address_unref(&key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to insert direct deposit.";
+      cardano_direct_deposit_map_unref(&deposits);
+
+      return result;
+    }
+  }
+
+  if (!replaced)
+  {
+    result = cardano_direct_deposit_map_insert(deposits, reward_address, amount);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to insert direct deposit.";
+      cardano_direct_deposit_map_unref(&deposits);
+
+      return result;
+    }
+  }
+
+  *updated = deposits;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Copies an account balance intervals map setting the interval of one reward account.
+ *
+ * Account balance intervals maps reject duplicated keys and entries can not be updated in place, so
+ * this function builds a new map with every entry of \p current, kept sorted by reward address. The
+ * entry of \p reward_address gets \p interval, and it is added when the account is not present.
+ *
+ * \param[in] current A pointer to the \ref cardano_account_balance_intervals_map_t to copy, or NULL
+ *                    when there are no intervals yet.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t of the entry to set.
+ * \param[in] interval A pointer to the \ref cardano_account_balance_interval_t stored in the entry.
+ * \param[out] updated On success, this will point to the newly created map. The caller is responsible
+ *                     for releasing it with \ref cardano_account_balance_intervals_map_unref.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS.
+ *
+ * \return \ref CARDANO_SUCCESS if the map was created, or an appropriate error code indicating the
+ *         failure reason.
+ */
+static cardano_error_t
+copy_with_interval(
+  const cardano_account_balance_intervals_map_t* current,
+  cardano_reward_address_t*                      reward_address,
+  cardano_account_balance_interval_t*            interval,
+  cardano_account_balance_intervals_map_t**      updated,
+  const char**                                   error_message)
+{
+  cardano_account_balance_intervals_map_t* intervals = NULL;
+  cardano_error_t                          result    = cardano_account_balance_intervals_map_new(&intervals);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create account balance intervals map.";
+
+    return result;
+  }
+
+  const size_t length   = cardano_account_balance_intervals_map_get_length(current);
+  bool         replaced = false;
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_reward_address_t*           key   = NULL;
+    cardano_account_balance_interval_t* value = NULL;
+
+    result = cardano_account_balance_intervals_map_get_key_value_at(current, i, &key, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to read account balance interval.";
+      cardano_account_balance_intervals_map_unref(&intervals);
+
+      return result;
+    }
+
+    if (reward_address_equals(key, reward_address))
+    {
+      result   = cardano_account_balance_intervals_map_insert(intervals, key, interval);
+      replaced = true;
+    }
+    else
+    {
+      result = cardano_account_balance_intervals_map_insert(intervals, key, value);
+    }
+
+    cardano_reward_address_unref(&key);
+    cardano_account_balance_interval_unref(&value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to insert account balance interval.";
+      cardano_account_balance_intervals_map_unref(&intervals);
+
+      return result;
+    }
+  }
+
+  if (!replaced)
+  {
+    result = cardano_account_balance_intervals_map_insert(intervals, reward_address, interval);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to insert account balance interval.";
+      cardano_account_balance_intervals_map_unref(&intervals);
+
+      return result;
+    }
+  }
+
+  *updated = intervals;
+
+  return CARDANO_SUCCESS;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_add_direct_deposit(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* reward_address,
+  const uint64_t            amount,
+  const char**              error_message)
+{
+  if (reward_address == NULL)
+  {
+    *error_message = "Reward address is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount == 0U)
+  {
+    *error_message = "Direct deposit amount must be greater than zero.";
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (amount > (uint64_t)INT64_MAX)
+  {
+    *error_message = "Direct deposit amount exceeds the maximum representable amount.";
+
+    return CARDANO_ERROR_INTEGER_OVERFLOW;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_direct_deposit_map_t* current = cardano_transaction_body_get_direct_deposits(body);
+  cardano_direct_deposit_map_unref(&current);
+
+  uint64_t deposited = 0U;
+  uint64_t total     = amount;
+
+  if (cardano_direct_deposit_map_get(current, reward_address, &deposited) == CARDANO_SUCCESS)
+  {
+    if ((deposited > (uint64_t)INT64_MAX) || (amount > ((uint64_t)INT64_MAX - deposited)))
+    {
+      *error_message = "Accumulated direct deposit amount exceeds the maximum representable amount.";
+
+      return CARDANO_ERROR_INTEGER_OVERFLOW;
+    }
+
+    total += deposited;
+  }
+
+  cardano_direct_deposit_map_t* updated = NULL;
+  cardano_error_t               result  = copy_with_direct_deposit(current, reward_address, total, &updated, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_transaction_body_set_direct_deposits(body, updated);
+  cardano_direct_deposit_map_unref(&updated);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set direct deposit map.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_direct_deposit_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  const uint64_t           amount,
+  const char**             error_message)
+{
+  cardano_reward_address_t* address = NULL;
+  cardano_error_t           result  = parse_reward_address(reward_address, address_size, &address, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_builder_add_direct_deposit(state, address, amount, error_message);
+  cardano_reward_address_unref(&address);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_account_balance_interval(
+  cardano_builder_state_t*            state,
+  cardano_reward_address_t*           reward_address,
+  cardano_account_balance_interval_t* interval,
+  const char**                        error_message)
+{
+  if (reward_address == NULL)
+  {
+    *error_message = "Reward address is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (interval == NULL)
+  {
+    *error_message = "Account balance interval is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_account_balance_intervals_map_t* current = cardano_transaction_body_get_account_balance_intervals(body);
+  cardano_account_balance_intervals_map_unref(&current);
+
+  cardano_account_balance_intervals_map_t* updated = NULL;
+  cardano_error_t                          result  = copy_with_interval(current, reward_address, interval, &updated, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_transaction_body_set_account_balance_intervals(body, updated);
+  cardano_account_balance_intervals_map_unref(&updated);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set account balance intervals map.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_account_balance_interval_ex(
+  cardano_builder_state_t*            state,
+  const char*                         reward_address,
+  size_t                              address_size,
+  cardano_account_balance_interval_t* interval,
+  const char**                        error_message)
+{
+  cardano_reward_address_t* address = NULL;
+  cardano_error_t           result  = parse_reward_address(reward_address, address_size, &address, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_builder_add_account_balance_interval(state, address, interval, error_message);
+  cardano_reward_address_unref(&address);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_starting_account_balance_interval(
+  cardano_builder_state_t*            state,
+  cardano_reward_address_t*           reward_address,
+  cardano_account_balance_interval_t* interval,
+  const char**                        error_message)
+{
+  if (reward_address == NULL)
+  {
+    *error_message = "Reward address is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (interval == NULL)
+  {
+    *error_message = "Starting account balance interval is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_account_balance_intervals_map_t* current = cardano_transaction_body_get_starting_account_balance_intervals(body);
+  cardano_account_balance_intervals_map_unref(&current);
+
+  cardano_account_balance_intervals_map_t* updated = NULL;
+  cardano_error_t                          result  = copy_with_interval(current, reward_address, interval, &updated, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_transaction_body_set_starting_account_balance_intervals(body, updated);
+  cardano_account_balance_intervals_map_unref(&updated);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set starting account balance intervals map.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_starting_account_balance_interval_ex(
+  cardano_builder_state_t*            state,
+  const char*                         reward_address,
+  size_t                              address_size,
+  cardano_account_balance_interval_t* interval,
+  const char**                        error_message)
+{
+  cardano_reward_address_t* address = NULL;
+  cardano_error_t           result  = parse_reward_address(reward_address, address_size, &address, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_builder_add_starting_account_balance_interval(state, address, interval, error_message);
+  cardano_reward_address_unref(&address);
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/internals/builder_entities.h b/vendor/src/transaction_builder/internals/builder_entities.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_entities.h
@@ -0,0 +1,210 @@
+/**
+ * \file builder_entities.h
+ *
+ * \author angel.castillo
+ * \date   Sep 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_ENTITIES_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_ENTITIES_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/error.h>
+#include <cardano/transaction_body/account_balance_interval.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Records a direct deposit in the transaction.
+ *
+ * A direct deposit pays lovelace straight into a reward account without creating a UTxO. This
+ * function adds \p amount to the direct deposit map of the transaction body, creating the map when
+ * it is missing. When the reward account already has a direct deposit the amounts are accumulated,
+ * keeping the position of the account in the map.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t of the reward account that
+ *                           receives the deposit. This parameter must not be NULL.
+ * \param[in] amount The amount of lovelace to deposit. It must be greater than zero and at most
+ *                   INT64_MAX, the largest amount the balancer can represent.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the direct deposit was recorded, \ref CARDANO_ERROR_INTEGER_OVERFLOW
+ *         if \p amount, or the accumulated amount of the reward account, exceeds INT64_MAX, or an
+ *         appropriate error code indicating the failure reason. The transaction is left unchanged on
+ *         failure.
+ */
+cardano_error_t
+cardano_builder_add_direct_deposit(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* reward_address,
+  uint64_t                  amount,
+  const char**              error_message);
+
+/**
+ * \brief Records a direct deposit given the reward address as a bech32 string.
+ *
+ * This function parses the reward address and delegates to \ref cardano_builder_add_direct_deposit.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] amount The amount of lovelace to deposit. It must be greater than zero.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the direct deposit was recorded, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_add_direct_deposit_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  uint64_t                 amount,
+  const char**             error_message);
+
+/**
+ * \brief Records an account balance interval in the transaction.
+ *
+ * An account balance interval makes the transaction valid only while the balance of the reward
+ * account sits inside the interval at the point the transaction is applied. This function stores
+ * \p interval in the account balance intervals map of the transaction body, creating the map when it
+ * is missing. When the reward account already has an interval it is replaced, keeping the position
+ * of the account in the map.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t of the reward account the
+ *                           interval constrains. This parameter must not be NULL.
+ * \param[in] interval A pointer to the \ref cardano_account_balance_interval_t the balance must sit
+ *                     in. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the interval was recorded, or an appropriate error code indicating
+ *         the failure reason. The transaction is left unchanged on failure.
+ */
+cardano_error_t
+cardano_builder_add_account_balance_interval(
+  cardano_builder_state_t*            state,
+  cardano_reward_address_t*           reward_address,
+  cardano_account_balance_interval_t* interval,
+  const char**                        error_message);
+
+/**
+ * \brief Records an account balance interval given the reward address as a bech32 string.
+ *
+ * This function parses the reward address and delegates to
+ * \ref cardano_builder_add_account_balance_interval.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] interval A pointer to the \ref cardano_account_balance_interval_t the balance must sit
+ *                     in. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the interval was recorded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_add_account_balance_interval_ex(
+  cardano_builder_state_t*            state,
+  const char*                         reward_address,
+  size_t                              address_size,
+  cardano_account_balance_interval_t* interval,
+  const char**                        error_message);
+
+/**
+ * \brief Records a starting account balance interval in the transaction.
+ *
+ * A starting account balance interval makes the transaction valid only while the balance the reward
+ * account had before any sub transaction was applied sits inside the interval. This function stores
+ * \p interval in the starting account balance intervals map of the transaction body, creating the
+ * map when it is missing. When the reward account already has an interval it is replaced, keeping
+ * the position of the account in the map.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t of the reward account the
+ *                           interval constrains. This parameter must not be NULL.
+ * \param[in] interval A pointer to the \ref cardano_account_balance_interval_t the starting balance
+ *                     must sit in. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the interval was recorded, or an appropriate error code indicating
+ *         the failure reason. The transaction is left unchanged on failure.
+ */
+cardano_error_t
+cardano_builder_add_starting_account_balance_interval(
+  cardano_builder_state_t*            state,
+  cardano_reward_address_t*           reward_address,
+  cardano_account_balance_interval_t* interval,
+  const char**                        error_message);
+
+/**
+ * \brief Records a starting account balance interval given the reward address as a bech32 string.
+ *
+ * This function parses the reward address and delegates to
+ * \ref cardano_builder_add_starting_account_balance_interval.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] interval A pointer to the \ref cardano_account_balance_interval_t the starting balance
+ *                     must sit in. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the interval was recorded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_add_starting_account_balance_interval_ex(
+  cardano_builder_state_t*            state,
+  const char*                         reward_address,
+  size_t                              address_size,
+  cardano_account_balance_interval_t* interval,
+  const char**                        error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_ENTITIES_H
diff --git a/vendor/src/transaction_builder/internals/builder_inputs.c b/vendor/src/transaction_builder/internals/builder_inputs.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_inputs.c
@@ -0,0 +1,368 @@
+/**
+ * \file builder_inputs.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_inputs.h"
+
+#include <cardano/common/ex_units.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+#include <cardano/witness_set/redeemer_list.h>
+#include <cardano/witness_set/witness_set.h>
+
+#include "builder_redeemers.h"
+#include "builder_sub_transactions.h"
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Predicate that checks whether a UTXO is the one a transaction input points to.
+ *
+ * \param[in] item The UTXO to evaluate.
+ * \param[in] context A pointer to the \ref cardano_transaction_input_t being looked up.
+ *
+ * \return true if the UTXO belongs to the transaction input, false otherwise.
+ */
+static bool
+find_utxo(cardano_utxo_t* item, const void* context)
+{
+  const cardano_transaction_input_t* input      = (const cardano_transaction_input_t*)context;
+  cardano_transaction_input_t*       utxo_input = cardano_utxo_get_input(item);
+
+  bool found = cardano_transaction_input_equals(utxo_input, input);
+
+  cardano_transaction_input_unref(&utxo_input);
+
+  return found;
+}
+
+/**
+ * \brief Checks whether a UTXO list resolves a transaction input.
+ *
+ * \param[in] utxos A pointer to the \ref cardano_utxo_list_t to search.
+ * \param[in] input A pointer to the \ref cardano_transaction_input_t to look up.
+ *
+ * \return true if the list holds the UTXO the input points to, false otherwise.
+ */
+static bool
+has_utxo(const cardano_utxo_list_t* utxos, const cardano_transaction_input_t* input)
+{
+  cardano_utxo_t* utxo = cardano_utxo_list_find(utxos, find_utxo, input);
+  cardano_utxo_unref(&utxo);
+
+  return utxo != NULL;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_add_input(
+  cardano_builder_state_t* state,
+  cardano_utxo_t*          utxo,
+  cardano_plutus_data_t*   redeemer,
+  cardano_plutus_data_t*   datum,
+  const char**             error_message)
+{
+  if (utxo == NULL)
+  {
+    *error_message = "UTXO is required";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+  cardano_transaction_output_unref(&output);
+
+  cardano_address_t* address = cardano_transaction_output_get_address(output);
+  cardano_address_unref(&address);
+
+  cardano_address_type_t address_type;
+
+  cardano_error_t result = cardano_address_get_type(address, &address_type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to get address type";
+    return result;
+  }
+
+  cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+  cardano_transaction_input_unref(&input);
+
+  if (cardano_builder_is_input_spent_by_sub_transaction(state, input))
+  {
+    *error_message = "Input is already spent by a sub transaction";
+    return CARDANO_ERROR_DUPLICATED_KEY;
+  }
+
+  if (has_utxo(state->pre_selected_inputs, input))
+  {
+    *error_message = "Input is already added to the transaction";
+    return CARDANO_ERROR_DUPLICATED_KEY;
+  }
+
+  result = cardano_utxo_list_add(state->pre_selected_inputs, utxo);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add UTXO to pre-selected inputs";
+
+    return result;
+  }
+
+  cardano_witness_set_t* witnesses = cardano_transaction_get_witness_set(state->transaction);
+  cardano_witness_set_unref(&witnesses);
+
+  cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witnesses);
+
+  if (redeemers == NULL)
+  {
+    result = cardano_redeemer_list_new(&redeemers);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create redeemers list";
+      return result;
+    }
+
+    result = cardano_witness_set_set_redeemers(witnesses, redeemers);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set redeemers list";
+      cardano_redeemer_list_unref(&redeemers);
+      return result;
+    }
+  }
+
+  cardano_redeemer_list_unref(&redeemers);
+
+  if (redeemer != NULL)
+  {
+    cardano_redeemer_t* rdmer = NULL;
+
+    cardano_ex_units_t* ex_units = NULL;
+    result                       = cardano_ex_units_new(0, 0, &ex_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create execution units";
+      return result;
+    }
+
+    result = cardano_redeemer_new(CARDANO_REDEEMER_TAG_SPEND, 0, redeemer, ex_units, &rdmer);
+    cardano_ex_units_unref(&ex_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create redeemer";
+      return result;
+    }
+
+    result = cardano_redeemer_list_add(redeemers, rdmer);
+    cardano_redeemer_unref(&rdmer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to add redeemer to list";
+      return result;
+    }
+
+    result = cardano_input_to_redeemer_map_insert(state->input_to_redeemer_map, input, rdmer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to insert input to redeemer map";
+      return result;
+    }
+  }
+
+  cardano_plutus_data_set_t* datums = cardano_witness_set_get_plutus_data(witnesses);
+
+  if (datums == NULL)
+  {
+    result = cardano_plutus_data_set_new(&datums);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create datums set";
+      return result;
+    }
+
+    result = cardano_witness_set_set_plutus_data(witnesses, datums);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set datums set";
+      cardano_plutus_data_set_unref(&datums);
+      return result;
+    }
+  }
+
+  cardano_plutus_data_set_unref(&datums);
+
+  if (datum != NULL)
+  {
+    result = cardano_plutus_data_set_add(datums, datum);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to add datum to set";
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_add_input_with_deferred_redeemer(
+  cardano_builder_state_t*       state,
+  cardano_utxo_t*                utxo,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  cardano_plutus_data_t*         datum,
+  const char**                   error_message)
+{
+  if ((utxo == NULL) || (callback == NULL))
+  {
+    *error_message = "UTXO and callback are required";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* placeholder = NULL;
+
+  cardano_error_t result = cardano_builder_create_placeholder_plutus_data(&placeholder);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create the placeholder redeemer.";
+
+    return result;
+  }
+
+  result = cardano_builder_add_input(state, utxo, placeholder, datum, error_message);
+
+  cardano_plutus_data_unref(&placeholder);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+  cardano_transaction_input_unref(&input);
+
+  cardano_redeemer_t* redeemer = NULL;
+
+  result = cardano_input_to_redeemer_map_get(state->input_to_redeemer_map, input, &redeemer);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_deferred_redeemer_list_add(state->deferred_redeemers, redeemer, callback, user_context);
+  }
+
+  cardano_redeemer_unref(&redeemer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to register the deferred redeemer.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_reference_input(
+  cardano_builder_state_t* state,
+  cardano_utxo_t*          utxo,
+  const char**             error_message)
+{
+  if (utxo == NULL)
+  {
+    *error_message = "UTXO is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+  cardano_transaction_input_unref(&input);
+
+  if (has_utxo(state->reference_inputs, input))
+  {
+    *error_message = "Reference input is already added to the transaction.";
+    return CARDANO_ERROR_DUPLICATED_KEY;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_input_set_t* inputs = cardano_transaction_body_get_reference_inputs(body);
+
+  if (inputs == NULL)
+  {
+    cardano_error_t result = cardano_transaction_input_set_new(&inputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create reference inputs.";
+      return result;
+    }
+
+    result = cardano_transaction_body_set_reference_inputs(body, inputs);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set reference inputs.";
+      cardano_transaction_input_set_unref(&inputs);
+
+      return result;
+    }
+  }
+
+  cardano_transaction_input_set_unref(&inputs);
+
+  cardano_error_t result = cardano_transaction_input_set_add(inputs, input);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add input to reference inputs.";
+    return result;
+  }
+
+  cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+  cardano_transaction_output_unref(&output);
+
+  if (output == NULL)
+  {
+    *error_message = "Output is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_utxo_list_add(state->reference_inputs, utxo);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add UTXO to reference inputs.";
+  }
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/internals/builder_inputs.h b/vendor/src/transaction_builder/internals/builder_inputs.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_inputs.h
@@ -0,0 +1,135 @@
+/**
+ * \file builder_inputs.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_INPUTS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_INPUTS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo.h>
+#include <cardano/error.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Adds a UTXO to the set of inputs the transaction must spend.
+ *
+ * This function appends the UTXO to the state pre selected input list so it is always included when
+ * the transaction is balanced. When \p redeemer is not NULL it creates a spend redeemer with a zero
+ * index and zero execution units, appends it to the witness set redeemer list and records it in the
+ * state input to redeemer map so its index can be resolved during balancing. When \p datum is not
+ * NULL it is added to the witness set plutus data set. The inputs spent by a transaction and by its
+ * sub transactions must be disjoint, so a UTXO that is already spent by a sub transaction added to the
+ * transaction is rejected. An input set cannot hold the same input twice, so a UTXO whose input
+ * (transaction id and index) is already in the pre selected input list is rejected as well.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] utxo A pointer to the \ref cardano_utxo_t to spend. The list holds a reference to it.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as spend redeemer payload, or
+ *                     NULL when the input does not require a redeemer.
+ * \param[in] datum A pointer to the \ref cardano_plutus_data_t witness datum, or NULL when the input
+ *                  does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the input was added, \ref CARDANO_ERROR_DUPLICATED_KEY if the input
+ *         is already spent by a sub transaction or already added as an input, or an appropriate error
+ *         code indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_add_input(
+  cardano_builder_state_t* state,
+  cardano_utxo_t*          utxo,
+  cardano_plutus_data_t*   redeemer,
+  cardano_plutus_data_t*   datum,
+  const char**             error_message);
+
+/**
+ * \brief Adds a UTXO to spend whose redeemer payload is resolved during balancing.
+ *
+ * This function adds the UTXO as a pre selected input with an empty placeholder redeemer and
+ * registers the callback in the state deferred redeemer list. The callback is invoked while the
+ * transaction is balanced to produce the final redeemer payload.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] utxo A pointer to the \ref cardano_utxo_t to spend. This parameter must not be NULL.
+ * \param[in] callback The deferred redeemer callback invoked during balancing. This parameter must
+ *                     not be NULL.
+ * \param[in] user_context The opaque pointer forwarded to the callback.
+ * \param[in] datum A pointer to the \ref cardano_plutus_data_t witness datum, or NULL when the input
+ *                  does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the input and callback were registered, or an appropriate error
+ *         code indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_add_input_with_deferred_redeemer(
+  cardano_builder_state_t*       state,
+  cardano_utxo_t*                utxo,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  cardano_plutus_data_t*         datum,
+  const char**                   error_message);
+
+/**
+ * \brief Adds a UTXO as a reference input of the transaction.
+ *
+ * This function appends the UTXO input to the transaction body reference input set, creating the set
+ * when it is missing, and records the UTXO in the state reference input list. A UTXO whose input
+ * (transaction id and index) is already in the state reference input list is rejected, since a
+ * reference input set cannot hold the same input twice.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] utxo A pointer to the \ref cardano_utxo_t to reference. The list holds a reference to it.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the reference input was added, \ref CARDANO_ERROR_DUPLICATED_KEY
+ *         if the input is already added as a reference input, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_add_reference_input(
+  cardano_builder_state_t* state,
+  cardano_utxo_t*          utxo,
+  const char**             error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_INPUTS_H
diff --git a/vendor/src/transaction_builder/internals/builder_mint.c b/vendor/src/transaction_builder/internals/builder_mint.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_mint.c
@@ -0,0 +1,272 @@
+/**
+ * \file builder_mint.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_mint.h"
+
+#include <cardano/assets/multi_asset.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/witness_set/witness_set.h>
+
+#include "builder_redeemers.h"
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_mint_token(
+  cardano_builder_state_t* state,
+  cardano_blake2b_hash_t*  policy_id,
+  cardano_asset_name_t*    name,
+  const int64_t            amount,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if (policy_id == NULL)
+  {
+    *error_message = "Policy ID is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (name == NULL)
+  {
+    *error_message = "Asset name is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_multi_asset_t* tokens = cardano_transaction_body_get_mint(body);
+
+  if (tokens == NULL)
+  {
+    cardano_error_t result = cardano_multi_asset_new(&tokens);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create multi-asset.";
+
+      return result;
+    }
+
+    result = cardano_transaction_body_set_mint(body, tokens);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set multi-asset.";
+      cardano_multi_asset_unref(&tokens);
+
+      return result;
+    }
+  }
+
+  cardano_multi_asset_unref(&tokens);
+
+  cardano_error_t result = cardano_multi_asset_set(tokens, policy_id, name, amount);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set multi-asset.";
+
+    return result;
+  }
+
+  if (redeemer != NULL)
+  {
+    cardano_witness_set_t* witnesses = cardano_transaction_get_witness_set(state->transaction);
+    cardano_witness_set_unref(&witnesses);
+
+    result = cardano_builder_add_redeemer(witnesses, policy_id, redeemer, CARDANO_REDEEMER_TAG_MINT, state, error_message);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to add redeemer.";
+
+      return result;
+    }
+  }
+  else
+  {
+    result = cardano_blake2b_hash_to_redeemer_map_insert(state->mints_to_redeemer_map, policy_id, NULL);
+
+    if ((result != CARDANO_SUCCESS) && (result != CARDANO_ERROR_DUPLICATED_KEY))
+    {
+      *error_message = "Failed to add mint.";
+
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_mint_token_ex(
+  cardano_builder_state_t* state,
+  const char*              policy_id_hex,
+  size_t                   policy_id_size,
+  const char*              name_hex,
+  size_t                   name_size,
+  const int64_t            amount,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if ((policy_id_hex == NULL) || (policy_id_size == 0U))
+  {
+    *error_message = "Policy ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((name_hex == NULL) || (name_size == 0U))
+  {
+    *error_message = "Asset name is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t* policy_id = NULL;
+  cardano_error_t         result    = cardano_blake2b_hash_from_hex(policy_id_hex, policy_id_size, &policy_id);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse policy ID.";
+
+    return result;
+  }
+
+  cardano_asset_name_t* name = NULL;
+  result                     = cardano_asset_name_from_hex(name_hex, name_size, &name);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_blake2b_hash_unref(&policy_id);
+    *error_message = "Failed to parse asset name.";
+
+    return result;
+  }
+
+  result = cardano_builder_mint_token(state, policy_id, name, amount, redeemer, error_message);
+
+  cardano_blake2b_hash_unref(&policy_id);
+  cardano_asset_name_unref(&name);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_mint_token_with_id(
+  cardano_builder_state_t* state,
+  cardano_asset_id_t*      asset_id,
+  const int64_t            amount,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if (asset_id == NULL)
+  {
+    *error_message = "Asset ID is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t* policy_id = cardano_asset_id_get_policy_id(asset_id);
+  cardano_asset_name_t*   name      = cardano_asset_id_get_asset_name(asset_id);
+
+  cardano_blake2b_hash_unref(&policy_id);
+  cardano_asset_name_unref(&name);
+
+  return cardano_builder_mint_token(state, policy_id, name, amount, redeemer, error_message);
+}
+
+cardano_error_t
+cardano_builder_mint_token_with_id_ex(
+  cardano_builder_state_t* state,
+  const char*              asset_id_hex,
+  size_t                   hex_size,
+  int64_t                  amount,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if ((asset_id_hex == NULL) || (hex_size == 0U))
+  {
+    *error_message = "Asset ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_asset_id_t* asset_id = NULL;
+  cardano_error_t     result   = cardano_asset_id_from_hex(asset_id_hex, hex_size, &asset_id);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse asset ID.";
+
+    return result;
+  }
+
+  result = cardano_builder_mint_token_with_id(state, asset_id, amount, redeemer, error_message);
+  cardano_asset_id_unref(&asset_id);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_mint_token_with_deferred_redeemer(
+  cardano_builder_state_t*       state,
+  cardano_blake2b_hash_t*        policy_id,
+  cardano_asset_name_t*          name,
+  const int64_t                  amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  const char**                   error_message)
+{
+  if ((policy_id == NULL) || (callback == NULL))
+  {
+    *error_message = "Policy id and callback are required";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* placeholder = NULL;
+
+  cardano_error_t result = cardano_builder_create_placeholder_plutus_data(&placeholder);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create the placeholder redeemer.";
+
+    return result;
+  }
+
+  result = cardano_builder_mint_token(state, policy_id, name, amount, placeholder, error_message);
+
+  cardano_plutus_data_unref(&placeholder);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return cardano_builder_register_deferred_from_map(state, state->mints_to_redeemer_map, policy_id, callback, user_context, error_message);
+}
diff --git a/vendor/src/transaction_builder/internals/builder_mint.h b/vendor/src/transaction_builder/internals/builder_mint.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_mint.h
@@ -0,0 +1,203 @@
+/**
+ * \file builder_mint.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_MINT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_MINT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/assets/asset_id.h>
+#include <cardano/assets/asset_name.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Records a token mint or burn in the transaction.
+ *
+ * This function sets the amount for the asset identified by \p policy_id and \p name in the mint
+ * field of the transaction body, creating the mint multi asset when it is missing. When \p redeemer
+ * is not NULL it is attached as a mint redeemer keyed by the policy in the state mint redeemer map.
+ * When \p redeemer is NULL the policy is still recorded in the map with a NULL redeemer so redeemer
+ * indices can be computed, and an already recorded policy is tolerated.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] policy_id A pointer to the \ref cardano_blake2b_hash_t with the minting policy hash.
+ *                      This parameter must not be NULL.
+ * \param[in] name A pointer to the \ref cardano_asset_name_t of the token. This parameter must not
+ *                 be NULL.
+ * \param[in] amount The amount to mint when positive or burn when negative.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as mint redeemer payload, or
+ *                     NULL when the policy does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the mint was recorded, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_mint_token(
+  cardano_builder_state_t* state,
+  cardano_blake2b_hash_t*  policy_id,
+  cardano_asset_name_t*    name,
+  int64_t                  amount,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Records a token mint or burn given the policy hash and asset name as hexadecimal strings.
+ *
+ * This function parses the policy hash and asset name and delegates to
+ * \ref cardano_builder_mint_token.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] policy_id_hex A pointer to the hexadecimal string with the minting policy hash.
+ * \param[in] policy_id_size The size of the policy hash string in bytes.
+ * \param[in] name_hex A pointer to the hexadecimal string with the asset name.
+ * \param[in] name_size The size of the asset name string in bytes.
+ * \param[in] amount The amount to mint when positive or burn when negative.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as mint redeemer payload, or
+ *                     NULL when the policy does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the mint was recorded, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_mint_token_ex(
+  cardano_builder_state_t* state,
+  const char*              policy_id_hex,
+  size_t                   policy_id_size,
+  const char*              name_hex,
+  size_t                   name_size,
+  int64_t                  amount,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Records a token mint or burn given a fully formed asset id.
+ *
+ * This function extracts the policy hash and asset name from \p asset_id and delegates to
+ * \ref cardano_builder_mint_token.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] asset_id A pointer to the \ref cardano_asset_id_t identifying the token. This parameter
+ *                     must not be NULL.
+ * \param[in] amount The amount to mint when positive or burn when negative.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as mint redeemer payload, or
+ *                     NULL when the policy does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the mint was recorded, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_mint_token_with_id(
+  cardano_builder_state_t* state,
+  cardano_asset_id_t*      asset_id,
+  int64_t                  amount,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Records a token mint or burn given an asset id as a hexadecimal string.
+ *
+ * This function parses the asset id and delegates to \ref cardano_builder_mint_token_with_id.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] asset_id_hex A pointer to the hexadecimal string with the asset id.
+ * \param[in] hex_size The size of the asset id string in bytes.
+ * \param[in] amount The amount to mint when positive or burn when negative.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as mint redeemer payload, or
+ *                     NULL when the policy does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the mint was recorded, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_mint_token_with_id_ex(
+  cardano_builder_state_t* state,
+  const char*              asset_id_hex,
+  size_t                   hex_size,
+  int64_t                  amount,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Records a token mint or burn whose redeemer payload is resolved during balancing.
+ *
+ * This function records the mint with an empty placeholder redeemer and registers the callback in
+ * the state deferred redeemer list. The callback is invoked while the transaction is balanced to
+ * produce the final redeemer payload.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] policy_id A pointer to the \ref cardano_blake2b_hash_t with the minting policy hash.
+ *                      This parameter must not be NULL.
+ * \param[in] name A pointer to the \ref cardano_asset_name_t of the token. This parameter must not
+ *                 be NULL.
+ * \param[in] amount The amount to mint when positive or burn when negative.
+ * \param[in] callback The deferred redeemer callback invoked during balancing. This parameter must
+ *                     not be NULL.
+ * \param[in] user_context The opaque pointer forwarded to the callback.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the mint and callback were registered, or an appropriate error
+ *         code indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_mint_token_with_deferred_redeemer(
+  cardano_builder_state_t*       state,
+  cardano_blake2b_hash_t*        policy_id,
+  cardano_asset_name_t*          name,
+  int64_t                        amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  const char**                   error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_MINT_H
diff --git a/vendor/src/transaction_builder/internals/builder_outputs.c b/vendor/src/transaction_builder/internals/builder_outputs.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_outputs.c
@@ -0,0 +1,384 @@
+/**
+ * \file builder_outputs.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_outputs.h"
+
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_send_lovelace(
+  cardano_builder_state_t* state,
+  cardano_address_t*       address,
+  const uint64_t           amount,
+  const char**             error_message)
+{
+  if (address == NULL)
+  {
+    *error_message = "Address is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_t* output = NULL;
+  cardano_error_t               result = cardano_transaction_output_new(address, amount, &output);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create output.";
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(body);
+  cardano_transaction_output_list_unref(&outputs);
+
+  result = cardano_transaction_output_list_add(outputs, output);
+  cardano_transaction_output_unref(&output);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add output to transaction.";
+    cardano_transaction_output_unref(&output);
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_send_lovelace_ex(
+  cardano_builder_state_t* state,
+  const char*              address,
+  size_t                   address_size,
+  uint64_t                 amount,
+  const char**             error_message)
+{
+  if ((address == NULL) || (address_size == 0U))
+  {
+    *error_message = "Address is NULL or empty.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_t* addr   = NULL;
+  cardano_error_t    result = cardano_address_from_string(address, address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse address.";
+    return result;
+  }
+
+  result = cardano_builder_send_lovelace(state, addr, amount, error_message);
+  cardano_address_unref(&addr);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_send_value(
+  cardano_builder_state_t* state,
+  cardano_address_t*       address,
+  cardano_value_t*         value,
+  const char**             error_message)
+{
+  if (address == NULL)
+  {
+    *error_message = "Address is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    *error_message = "Value is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_t* output = NULL;
+  cardano_error_t               result = cardano_transaction_output_new(address, 0U, &output);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create output.";
+    return result;
+  }
+
+  result = cardano_transaction_output_set_value(output, value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set value.";
+    cardano_transaction_output_unref(&output);
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(body);
+  cardano_transaction_output_list_unref(&outputs);
+
+  result = cardano_transaction_output_list_add(outputs, output);
+  cardano_transaction_output_unref(&output);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add output to transaction.";
+    cardano_transaction_output_unref(&output);
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_send_value_ex(
+  cardano_builder_state_t* state,
+  const char*              address,
+  size_t                   address_size,
+  cardano_value_t*         value,
+  const char**             error_message)
+{
+  if ((address == NULL) || (address_size == 0U))
+  {
+    *error_message = "Address is NULL or empty.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    *error_message = "Value is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_t* addr   = NULL;
+  cardano_error_t    result = cardano_address_from_string(address, address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse address.";
+    return result;
+  }
+
+  result = cardano_builder_send_value(state, addr, value, error_message);
+  cardano_address_unref(&addr);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_lock_lovelace(
+  cardano_builder_state_t* state,
+  cardano_address_t*       script_address,
+  const uint64_t           amount,
+  cardano_datum_t*         datum,
+  const char**             error_message)
+{
+  if (script_address == NULL)
+  {
+    *error_message = "Script address is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_t* output = NULL;
+  cardano_error_t               result = cardano_transaction_output_new(script_address, amount, &output);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create output.";
+    return result;
+  }
+
+  result = cardano_transaction_output_set_datum(output, datum);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set datum.";
+    cardano_transaction_output_unref(&output);
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(body);
+  cardano_transaction_output_list_unref(&outputs);
+
+  result = cardano_transaction_output_list_add(outputs, output);
+  cardano_transaction_output_unref(&output);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add output to transaction.";
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_lock_lovelace_ex(
+  cardano_builder_state_t* state,
+  const char*              script_address,
+  size_t                   script_address_size,
+  uint64_t                 amount,
+  cardano_datum_t*         datum,
+  const char**             error_message)
+{
+  if ((script_address == NULL) || (script_address_size == 0U))
+  {
+    *error_message = "Script address is NULL or empty.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_t* addr   = NULL;
+  cardano_error_t    result = cardano_address_from_string(script_address, script_address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse script address.";
+    return result;
+  }
+
+  result = cardano_builder_lock_lovelace(state, addr, amount, datum, error_message);
+  cardano_address_unref(&addr);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_lock_value(
+  cardano_builder_state_t* state,
+  cardano_address_t*       script_address,
+  cardano_value_t*         value,
+  cardano_datum_t*         datum,
+  const char**             error_message)
+{
+  if (script_address == NULL)
+  {
+    *error_message = "Script address is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_output_t* output = NULL;
+  cardano_error_t               result = cardano_transaction_output_new(script_address, 0U, &output);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create output.";
+    return result;
+  }
+
+  result = cardano_transaction_output_set_value(output, value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set value.";
+    cardano_transaction_output_unref(&output);
+
+    return result;
+  }
+
+  result = cardano_transaction_output_set_datum(output, datum);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set datum.";
+    cardano_transaction_output_unref(&output);
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(body);
+  cardano_transaction_output_list_unref(&outputs);
+
+  result = cardano_transaction_output_list_add(outputs, output);
+  cardano_transaction_output_unref(&output);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add output to transaction.";
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_lock_value_ex(
+  cardano_builder_state_t* state,
+  const char*              script_address,
+  size_t                   script_address_size,
+  cardano_value_t*         value,
+  cardano_datum_t*         datum,
+  const char**             error_message)
+{
+  if ((script_address == NULL) || (script_address_size == 0U))
+  {
+    *error_message = "Script address is NULL or empty.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_address_t* addr   = NULL;
+  cardano_error_t    result = cardano_address_from_string(script_address, script_address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse script address.";
+    return result;
+  }
+
+  result = cardano_builder_lock_value(state, addr, value, datum, error_message);
+  cardano_address_unref(&addr);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_output(
+  cardano_builder_state_t*      state,
+  cardano_transaction_output_t* output)
+{
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(body);
+  cardano_transaction_output_list_unref(&outputs);
+
+  return cardano_transaction_output_list_add(outputs, output);
+}
diff --git a/vendor/src/transaction_builder/internals/builder_outputs.h b/vendor/src/transaction_builder/internals/builder_outputs.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_outputs.h
@@ -0,0 +1,277 @@
+/**
+ * \file builder_outputs.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_OUTPUTS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_OUTPUTS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/common/datum.h>
+#include <cardano/error.h>
+#include <cardano/transaction_body/transaction_output.h>
+#include <cardano/transaction_body/value.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Adds an output that sends the given amount of lovelace to an address.
+ *
+ * This function creates a transaction output paying \p amount lovelace to \p address and appends it
+ * to the output list of the transaction body under construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] address A pointer to the \ref cardano_address_t receiving the lovelace. The output holds
+ *                    a reference to it.
+ * \param[in] amount The amount of lovelace to send.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the output was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_send_lovelace(
+  cardano_builder_state_t* state,
+  cardano_address_t*       address,
+  uint64_t                 amount,
+  const char**             error_message);
+
+/**
+ * \brief Adds an output that sends the given amount of lovelace to an address given as a string.
+ *
+ * This function parses the address string and delegates to \ref cardano_builder_send_lovelace.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] address A pointer to the character string with the destination address.
+ * \param[in] address_size The size of the address string in bytes.
+ * \param[in] amount The amount of lovelace to send.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the output was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_send_lovelace_ex(
+  cardano_builder_state_t* state,
+  const char*              address,
+  size_t                   address_size,
+  uint64_t                 amount,
+  const char**             error_message);
+
+/**
+ * \brief Adds an output that sends the given value to an address.
+ *
+ * This function creates a transaction output carrying \p value (lovelace and native assets) for
+ * \p address and appends it to the output list of the transaction body under construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] address A pointer to the \ref cardano_address_t receiving the value. The output holds a
+ *                    reference to it.
+ * \param[in] value A pointer to the \ref cardano_value_t to send. The output holds a reference to it.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the output was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_send_value(
+  cardano_builder_state_t* state,
+  cardano_address_t*       address,
+  cardano_value_t*         value,
+  const char**             error_message);
+
+/**
+ * \brief Adds an output that sends the given value to an address given as a string.
+ *
+ * This function parses the address string and delegates to \ref cardano_builder_send_value.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] address A pointer to the character string with the destination address.
+ * \param[in] address_size The size of the address string in bytes.
+ * \param[in] value A pointer to the \ref cardano_value_t to send. The output holds a reference to it.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the output was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_send_value_ex(
+  cardano_builder_state_t* state,
+  const char*              address,
+  size_t                   address_size,
+  cardano_value_t*         value,
+  const char**             error_message);
+
+/**
+ * \brief Adds an output that locks the given amount of lovelace at a script address.
+ *
+ * This function creates a transaction output paying \p amount lovelace to \p script_address, attaches
+ * the optional datum and appends it to the output list of the transaction body under construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] script_address A pointer to the \ref cardano_address_t of the script. The output holds a
+ *                           reference to it.
+ * \param[in] amount The amount of lovelace to lock.
+ * \param[in] datum A pointer to the \ref cardano_datum_t attached to the output, or NULL when the
+ *                  output carries no datum.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the output was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_lock_lovelace(
+  cardano_builder_state_t* state,
+  cardano_address_t*       script_address,
+  uint64_t                 amount,
+  cardano_datum_t*         datum,
+  const char**             error_message);
+
+/**
+ * \brief Adds an output that locks the given amount of lovelace at a script address given as a string.
+ *
+ * This function parses the script address string and delegates to \ref cardano_builder_lock_lovelace.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] script_address A pointer to the character string with the script address.
+ * \param[in] script_address_size The size of the script address string in bytes.
+ * \param[in] amount The amount of lovelace to lock.
+ * \param[in] datum A pointer to the \ref cardano_datum_t attached to the output, or NULL when the
+ *                  output carries no datum.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the output was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_lock_lovelace_ex(
+  cardano_builder_state_t* state,
+  const char*              script_address,
+  size_t                   script_address_size,
+  uint64_t                 amount,
+  cardano_datum_t*         datum,
+  const char**             error_message);
+
+/**
+ * \brief Adds an output that locks the given value at a script address.
+ *
+ * This function creates a transaction output carrying \p value (lovelace and native assets) for
+ * \p script_address, attaches the optional datum and appends it to the output list of the transaction
+ * body under construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] script_address A pointer to the \ref cardano_address_t of the script. The output holds a
+ *                           reference to it.
+ * \param[in] value A pointer to the \ref cardano_value_t to lock. The output holds a reference to it.
+ * \param[in] datum A pointer to the \ref cardano_datum_t attached to the output, or NULL when the
+ *                  output carries no datum.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the output was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_lock_value(
+  cardano_builder_state_t* state,
+  cardano_address_t*       script_address,
+  cardano_value_t*         value,
+  cardano_datum_t*         datum,
+  const char**             error_message);
+
+/**
+ * \brief Adds an output that locks the given value at a script address given as a string.
+ *
+ * This function parses the script address string and delegates to \ref cardano_builder_lock_value.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] script_address A pointer to the character string with the script address.
+ * \param[in] script_address_size The size of the script address string in bytes.
+ * \param[in] value A pointer to the \ref cardano_value_t to lock. The output holds a reference to it.
+ * \param[in] datum A pointer to the \ref cardano_datum_t attached to the output, or NULL when the
+ *                  output carries no datum.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the output was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_lock_value_ex(
+  cardano_builder_state_t* state,
+  const char*              script_address,
+  size_t                   script_address_size,
+  cardano_value_t*         value,
+  cardano_datum_t*         datum,
+  const char**             error_message);
+
+/**
+ * \brief Adds a fully formed output to the transaction.
+ *
+ * This function appends the given output to the output list of the transaction body under
+ * construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] output A pointer to the \ref cardano_transaction_output_t to add. The list holds a
+ *                   reference to it.
+ *
+ * \return \ref CARDANO_SUCCESS if the output was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_add_output(
+  cardano_builder_state_t*      state,
+  cardano_transaction_output_t* output);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_OUTPUTS_H
diff --git a/vendor/src/transaction_builder/internals/builder_proposals.c b/vendor/src/transaction_builder/internals/builder_proposals.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_proposals.c
@@ -0,0 +1,1472 @@
+/**
+ * \file builder_proposals.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_proposals.h"
+
+#include <cardano/proposal_procedures/hard_fork_initiation_action.h>
+#include <cardano/proposal_procedures/info_action.h>
+#include <cardano/proposal_procedures/new_constitution_action.h>
+#include <cardano/proposal_procedures/no_confidence_action.h>
+#include <cardano/proposal_procedures/parameter_change_action.h>
+#include <cardano/proposal_procedures/proposal_procedure.h>
+#include <cardano/proposal_procedures/proposal_procedure_set.h>
+#include <cardano/proposal_procedures/treasury_withdrawals_action.h>
+#include <cardano/proposal_procedures/update_committee_action.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/witness_set/redeemer.h>
+#include <cardano/witness_set/witness_set.h>
+
+#include "../../string_safe.h"
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Gets the proposal procedures set from the transaction body. If there are no proposal
+ * procedures set, it creates a new list.
+ *
+ * \param body The transaction body.
+ *
+ * \return The proposal procedures set, or NULL when it could not be created or attached.
+ */
+static cardano_proposal_procedure_set_t*
+get_proposal_procedure_set(cardano_transaction_body_t* body)
+{
+  cardano_proposal_procedure_set_t* proposals = cardano_transaction_body_get_proposal_procedures(body);
+
+  if (proposals == NULL)
+  {
+    cardano_error_t result = cardano_proposal_procedure_set_new(&proposals);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return NULL;
+    }
+
+    result = cardano_transaction_body_set_proposal_procedure(body, proposals);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_proposal_procedure_set_unref(&proposals);
+
+      return NULL;
+    }
+  }
+
+  cardano_proposal_procedure_set_unref(&proposals);
+
+  return proposals;
+}
+
+/**
+ * \brief Creates an empty plutus data object.
+ *
+ * \return The empty plutus data object.
+ */
+static cardano_plutus_data_t*
+create_empty_plutus_data(void)
+{
+  static const char* VOID_DATA = "d87980";
+
+  cardano_plutus_data_t* plutus_data = NULL;
+  cardano_cbor_reader_t* reader      = cardano_cbor_reader_from_hex(VOID_DATA, cardano_safe_strlen(VOID_DATA, 6));
+
+  cardano_error_t result = cardano_plutus_data_from_cbor(reader, &plutus_data);
+  cardano_cbor_reader_unref(&reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  return plutus_data;
+}
+
+/**
+ * \brief Adds an empty proposing redeemer to the witness set.
+ *
+ * \param witness_set The witness set.
+ * \param proposal_index The index of the proposal that requires the redeemer.
+ *
+ * \return The result of the operation.
+ */
+static cardano_error_t
+add_proposing_redeemer(
+  cardano_witness_set_t* witness_set,
+  const size_t           proposal_index)
+{
+  cardano_redeemer_list_t* redeemers         = cardano_witness_set_get_redeemers(witness_set);
+  cardano_plutus_data_t*   empty_plutus_data = create_empty_plutus_data();
+  cardano_redeemer_t*      rdmer             = NULL;
+  cardano_ex_units_t*      ex_units          = NULL;
+
+  if (empty_plutus_data == NULL)
+  {
+    cardano_redeemer_list_unref(&redeemers);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_ex_units_new(0, 0, &ex_units);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_unref(&empty_plutus_data);
+    cardano_redeemer_list_unref(&redeemers);
+
+    return result;
+  }
+
+  result = cardano_redeemer_new(CARDANO_REDEEMER_TAG_PROPOSING, proposal_index, empty_plutus_data, ex_units, &rdmer);
+
+  cardano_plutus_data_unref(&empty_plutus_data);
+  cardano_ex_units_unref(&ex_units);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_redeemer_list_unref(&redeemers);
+
+    return result;
+  }
+
+  if (redeemers == NULL)
+  {
+    result = cardano_redeemer_list_new(&redeemers);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_redeemer_unref(&rdmer);
+
+      return result;
+    }
+
+    result = cardano_witness_set_set_redeemers(witness_set, redeemers);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_redeemer_unref(&rdmer);
+      cardano_redeemer_list_unref(&redeemers);
+
+      return result;
+    }
+  }
+
+  cardano_redeemer_list_unref(&redeemers);
+
+  result = cardano_redeemer_list_add(redeemers, rdmer);
+  cardano_redeemer_unref(&rdmer);
+
+  return result;
+}
+
+/** \brief Inspects whether a proposal carries a constitution policy hash. */
+static cardano_error_t
+proposal_has_policy(cardano_proposal_procedure_t* proposal, bool* has_policy)
+{
+  cardano_governance_action_type_t type   = CARDANO_GOVERNANCE_ACTION_TYPE_INFO;
+  cardano_error_t                  result = cardano_proposal_procedure_get_action_type(proposal, &type);
+  cardano_blake2b_hash_t*          policy = NULL;
+
+  if ((result == CARDANO_SUCCESS) && (type == CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE))
+  {
+    cardano_parameter_change_action_t* action = NULL;
+    result                                    = cardano_proposal_procedure_to_parameter_change_action(proposal, &action);
+    policy                                    = cardano_parameter_change_action_get_policy_hash(action);
+    cardano_parameter_change_action_unref(&action);
+  }
+  else if ((result == CARDANO_SUCCESS) && (type == CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS))
+  {
+    cardano_treasury_withdrawals_action_t* action = NULL;
+    result                                        = cardano_proposal_procedure_to_treasury_withdrawals_action(proposal, &action);
+    policy                                        = cardano_treasury_withdrawals_action_get_policy_hash(action);
+    cardano_treasury_withdrawals_action_unref(&action);
+  }
+  else
+  {
+    /* Other proposal actions do not carry a constitution policy hash. */
+  }
+
+  *has_policy = policy != NULL;
+  cardano_blake2b_hash_unref(&policy);
+
+  return result;
+}
+
+/** \brief Appends the proposing witness and registers its optional deferred payload. */
+static cardano_error_t
+add_proposal_redeemer(
+  cardano_builder_state_t*       state,
+  uint64_t                       index,
+  cardano_plutus_data_t*         data,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  const char**                   error_message)
+{
+  cardano_ex_units_t* ex_units = NULL;
+  cardano_redeemer_t* redeemer = NULL;
+  cardano_error_t     result   = cardano_ex_units_new(0, 0, &ex_units);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_redeemer_new(CARDANO_REDEEMER_TAG_PROPOSING, index, data, ex_units, &redeemer);
+  }
+
+  cardano_ex_units_unref(&ex_units);
+  cardano_witness_set_t*   witnesses = cardano_transaction_get_witness_set(state->transaction);
+  cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witnesses);
+
+  if ((result == CARDANO_SUCCESS) && (redeemers == NULL))
+  {
+    result = cardano_redeemer_list_new(&redeemers);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_witness_set_set_redeemers(witnesses, redeemers);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_redeemer_list_add(redeemers, redeemer);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (callback != NULL))
+  {
+    result = cardano_deferred_redeemer_list_add(state->deferred_redeemers, redeemer, callback, user_context);
+  }
+
+  cardano_redeemer_unref(&redeemer);
+  cardano_redeemer_list_unref(&redeemers);
+  cardano_witness_set_unref(&witnesses);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add proposing redeemer.";
+  }
+
+  return result;
+}
+
+/**
+ * \brief Adds a proposal and its optional proposing witness to the shared builder state.
+ */
+static cardano_error_t
+add_proposal(
+  cardano_builder_state_t*       state,
+  cardano_proposal_procedure_t*  proposal,
+  cardano_plutus_data_t*         data,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  const char**                   error_message)
+{
+  if (proposal == NULL)
+  {
+    *error_message = "Proposal is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cardano_proposal_procedure_get_deposit(proposal) != cardano_protocol_parameters_get_governance_action_deposit(state->params))
+  {
+    *error_message = "Proposal deposit does not match the protocol governance action deposit.";
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  bool            has_policy = false;
+  cardano_error_t result     = proposal_has_policy(proposal, &has_policy);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to inspect proposal action.";
+
+    return result;
+  }
+
+  if (((data != NULL) || (callback != NULL)) && !has_policy)
+  {
+    *error_message = "A proposing redeemer requires a proposal with a policy hash.";
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  uint64_t index = 0U;
+  result         = cardano_transaction_find_proposal_index(state->transaction, proposal, &index);
+
+  if (result != CARDANO_ERROR_ELEMENT_NOT_FOUND)
+  {
+    *error_message = "Proposal is already present or could not be compared.";
+
+    return (result == CARDANO_SUCCESS) ? CARDANO_ERROR_DUPLICATED_KEY : result;
+  }
+
+  cardano_transaction_body_t*       body      = cardano_transaction_get_body(state->transaction);
+  cardano_proposal_procedure_set_t* proposals = get_proposal_procedure_set(body);
+  cardano_transaction_body_unref(&body);
+
+  if (proposals == NULL)
+  {
+    *error_message = "Failed to create proposal procedures.";
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  index  = cardano_proposal_procedure_set_get_length(proposals);
+  result = cardano_proposal_procedure_set_add(proposals, proposal);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add proposal procedure.";
+
+    return result;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  return add_proposal_redeemer(state, index, data, callback, user_context, error_message);
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_add_proposal(
+  cardano_builder_state_t*      state,
+  cardano_proposal_procedure_t* proposal,
+  cardano_plutus_data_t*        redeemer,
+  const char**                  error_message)
+{
+  return add_proposal(state, proposal, redeemer, NULL, NULL, error_message);
+}
+
+cardano_error_t
+cardano_builder_add_proposal_with_deferred_redeemer(
+  cardano_builder_state_t*       state,
+  cardano_proposal_procedure_t*  proposal,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  const char**                   error_message)
+{
+  if (callback == NULL)
+  {
+    *error_message = "Callback is NULL.";
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* placeholder = create_empty_plutus_data();
+
+  if (placeholder == NULL)
+  {
+    *error_message = "Failed to create placeholder redeemer.";
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  const cardano_error_t result = add_proposal(state, proposal, placeholder, callback, user_context, error_message);
+  cardano_plutus_data_unref(&placeholder);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_propose_parameter_change(
+  cardano_builder_state_t*         state,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_blake2b_hash_t*          policy_hash,
+  const char**                     error_message)
+{
+  if (policy_hash == NULL)
+  {
+    *error_message = "Policy hash is NULL. You must provide the constitution script hash.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_parameter_change_action_t* action = NULL;
+  cardano_error_t                    result = cardano_parameter_change_action_new(protocol_param_update, governance_action_id, policy_hash, &action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create parameter change action.";
+
+    return result;
+  }
+
+  cardano_proposal_procedure_t* proposal = NULL;
+  const uint64_t                deposit  = cardano_protocol_parameters_get_governance_action_deposit(state->params);
+
+  result = cardano_proposal_procedure_new_parameter_change_action(deposit, reward_address, anchor, action, &proposal);
+
+  cardano_parameter_change_action_unref(&action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create proposal procedure.";
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_proposal_procedure_set_t* proposals = get_proposal_procedure_set(body);
+
+  if (proposals == NULL)
+  {
+    cardano_proposal_procedure_unref(&proposal);
+    *error_message = "Failed to add proposal procedure.";
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_proposal_procedure_set_add(proposals, proposal);
+  cardano_proposal_procedure_unref(&proposal);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add proposal procedure.";
+
+    return result;
+  }
+
+  cardano_witness_set_t* witnesses = cardano_transaction_get_witness_set(state->transaction);
+  cardano_witness_set_unref(&witnesses);
+  const size_t proposal_index = cardano_proposal_procedure_set_get_length(proposals) - 1U;
+
+  result = add_proposing_redeemer(witnesses, proposal_index);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add proposing redeemer.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_propose_parameter_change_ex(
+  cardano_builder_state_t*         state,
+  const char*                      reward_address,
+  const size_t                     reward_address_size,
+  const char*                      metadata_url,
+  const size_t                     metadata_url_size,
+  const char*                      metadata_hash_hex,
+  const size_t                     metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  const size_t                     gov_action_id_size,
+  const char*                      policy_hash_hash_hex,
+  const size_t                     policy_hash_hash_hex_size,
+  cardano_protocol_param_update_t* protocol_param_update,
+  const char**                     error_message)
+{
+  if ((reward_address == NULL) || (reward_address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_url == NULL) || (metadata_url_size == 0U))
+  {
+    *error_message = "Metadata URL is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_hash_hex == NULL) || (metadata_hash_hex_size == 0U))
+  {
+    *error_message = "Metadata hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((gov_action_id == NULL) || (gov_action_id_size == 0U))
+  {
+    *error_message = "Governance action ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((policy_hash_hash_hex == NULL) || (policy_hash_hash_hex_size == 0U))
+  {
+    *error_message = "Policy hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_error_t result = cardano_anchor_from_hash_hex(metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, &anchor);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create anchor.";
+
+    return result;
+  }
+
+  cardano_reward_address_t* addr = NULL;
+  result                         = cardano_reward_address_from_bech32(reward_address, reward_address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  cardano_governance_action_id_t* id = NULL;
+
+  result = cardano_governance_action_id_from_bech32(gov_action_id, gov_action_id_size, &id);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    cardano_reward_address_unref(&addr);
+    *error_message = "Failed to parse governance action ID.";
+
+    return result;
+  }
+
+  cardano_blake2b_hash_t* policy_hash = NULL;
+
+  result = cardano_blake2b_hash_from_hex(policy_hash_hash_hex, policy_hash_hash_hex_size, &policy_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    cardano_reward_address_unref(&addr);
+    cardano_governance_action_id_unref(&id);
+    *error_message = "Failed to parse policy hash.";
+
+    return result;
+  }
+
+  result = cardano_builder_propose_parameter_change(state, addr, anchor, protocol_param_update, id, policy_hash, error_message);
+
+  cardano_anchor_unref(&anchor);
+  cardano_reward_address_unref(&addr);
+  cardano_governance_action_id_unref(&id);
+  cardano_blake2b_hash_unref(&policy_hash);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_propose_hardfork(
+  cardano_builder_state_t*        state,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_protocol_version_t*     version,
+  cardano_governance_action_id_t* governance_action_id,
+  const char**                    error_message)
+{
+  cardano_hard_fork_initiation_action_t* action = NULL;
+  cardano_error_t                        result = cardano_hard_fork_initiation_action_new(version, governance_action_id, &action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create hard fork action.";
+
+    return result;
+  }
+
+  cardano_proposal_procedure_t* proposal = NULL;
+  const uint64_t                deposit  = cardano_protocol_parameters_get_governance_action_deposit(state->params);
+
+  result = cardano_proposal_procedure_new_hard_fork_initiation_action(deposit, reward_address, anchor, action, &proposal);
+
+  cardano_hard_fork_initiation_action_unref(&action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create proposal procedure.";
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_proposal_procedure_set_t* proposals = get_proposal_procedure_set(body);
+
+  if (proposals == NULL)
+  {
+    cardano_proposal_procedure_unref(&proposal);
+    *error_message = "Failed to add proposal procedure.";
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_proposal_procedure_set_add(proposals, proposal);
+  cardano_proposal_procedure_unref(&proposal);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add proposal procedure.";
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_propose_hardfork_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  const size_t             reward_address_size,
+  const char*              metadata_url,
+  const size_t             metadata_url_size,
+  const char*              metadata_hash_hex,
+  const size_t             metadata_hash_hex_size,
+  const char*              gov_action_id,
+  const size_t             gov_action_id_size,
+  const uint64_t           minor_protocol_version,
+  const uint64_t           major_protocol_version,
+  const char**             error_message)
+{
+  if ((reward_address == NULL) || (reward_address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_url == NULL) || (metadata_url_size == 0U))
+  {
+    *error_message = "Metadata URL is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_hash_hex == NULL) || (metadata_hash_hex_size == 0U))
+  {
+    *error_message = "Metadata hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((gov_action_id == NULL) || (gov_action_id_size == 0U))
+  {
+    *error_message = "Governance action ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_error_t result = cardano_anchor_from_hash_hex(metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, &anchor);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create anchor.";
+
+    return result;
+  }
+
+  cardano_reward_address_t* addr = NULL;
+  result                         = cardano_reward_address_from_bech32(reward_address, reward_address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  cardano_governance_action_id_t* id = NULL;
+
+  result = cardano_governance_action_id_from_bech32(gov_action_id, gov_action_id_size, &id);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    cardano_reward_address_unref(&addr);
+    *error_message = "Failed to parse governance action ID.";
+
+    return result;
+  }
+
+  cardano_protocol_version_t* version = NULL;
+  result                              = cardano_protocol_version_new(major_protocol_version, minor_protocol_version, &version);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    cardano_reward_address_unref(&addr);
+    cardano_governance_action_id_unref(&id);
+    *error_message = "Failed to create protocol version.";
+
+    return result;
+  }
+
+  result = cardano_builder_propose_hardfork(state, addr, anchor, version, id, error_message);
+
+  cardano_anchor_unref(&anchor);
+  cardano_reward_address_unref(&addr);
+  cardano_governance_action_id_unref(&id);
+  cardano_protocol_version_unref(&version);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_propose_treasury_withdrawals(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor,
+  cardano_withdrawal_map_t* withdrawals,
+  cardano_blake2b_hash_t*   policy_hash,
+  const char**              error_message)
+{
+  if (policy_hash == NULL)
+  {
+    *error_message = "Policy hash is NULL. You must provide the constitution script hash.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_treasury_withdrawals_action_t* action = NULL;
+  cardano_error_t                        result = cardano_treasury_withdrawals_action_new(withdrawals, policy_hash, &action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create treasury withdrawal action.";
+
+    return result;
+  }
+
+  cardano_proposal_procedure_t* proposal = NULL;
+  const uint64_t                deposit  = cardano_protocol_parameters_get_governance_action_deposit(state->params);
+
+  result = cardano_proposal_procedure_new_treasury_withdrawals_action(deposit, reward_address, anchor, action, &proposal);
+
+  cardano_treasury_withdrawals_action_unref(&action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create proposal procedure.";
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_proposal_procedure_set_t* proposals = get_proposal_procedure_set(body);
+
+  if (proposals == NULL)
+  {
+    cardano_proposal_procedure_unref(&proposal);
+    *error_message = "Failed to add proposal procedure.";
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_proposal_procedure_set_add(proposals, proposal);
+  cardano_proposal_procedure_unref(&proposal);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add proposal procedure.";
+
+    return result;
+  }
+
+  cardano_witness_set_t* witnesses = cardano_transaction_get_witness_set(state->transaction);
+  cardano_witness_set_unref(&witnesses);
+  const size_t proposal_index = cardano_proposal_procedure_set_get_length(proposals) - 1U;
+
+  result = add_proposing_redeemer(witnesses, proposal_index);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add proposing redeemer.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_propose_treasury_withdrawals_ex(
+  cardano_builder_state_t*  state,
+  const char*               reward_address,
+  const size_t              reward_address_size,
+  const char*               metadata_url,
+  const size_t              metadata_url_size,
+  const char*               metadata_hash_hex,
+  const size_t              metadata_hash_hex_size,
+  const char*               policy_hash_hash_hex,
+  const size_t              policy_hash_hash_hex_size,
+  cardano_withdrawal_map_t* withdrawals,
+  const char**              error_message)
+{
+  if ((reward_address == NULL) || (reward_address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_url == NULL) || (metadata_url_size == 0U))
+  {
+    *error_message = "Metadata URL is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_hash_hex == NULL) || (metadata_hash_hex_size == 0U))
+  {
+    *error_message = "Metadata hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((policy_hash_hash_hex == NULL) || (policy_hash_hash_hex_size == 0U))
+  {
+    *error_message = "Policy hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_error_t result = cardano_anchor_from_hash_hex(metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, &anchor);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create anchor.";
+
+    return result;
+  }
+
+  cardano_reward_address_t* addr = NULL;
+  result                         = cardano_reward_address_from_bech32(reward_address, reward_address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  cardano_blake2b_hash_t* policy_hash = NULL;
+  result                              = cardano_blake2b_hash_from_hex(policy_hash_hash_hex, policy_hash_hash_hex_size, &policy_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    cardano_reward_address_unref(&addr);
+    *error_message = "Failed to parse policy hash.";
+
+    return result;
+  }
+
+  result = cardano_builder_propose_treasury_withdrawals(state, addr, anchor, withdrawals, policy_hash, error_message);
+
+  cardano_anchor_unref(&anchor);
+  cardano_reward_address_unref(&addr);
+  cardano_blake2b_hash_unref(&policy_hash);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_propose_no_confidence(
+  cardano_builder_state_t*        state,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id,
+  const char**                    error_message)
+{
+  cardano_no_confidence_action_t* action = NULL;
+  cardano_error_t                 result = cardano_no_confidence_action_new(governance_action_id, &action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create no confidence action.";
+
+    return result;
+  }
+
+  cardano_proposal_procedure_t* proposal = NULL;
+  const uint64_t                deposit  = cardano_protocol_parameters_get_governance_action_deposit(state->params);
+
+  result = cardano_proposal_procedure_new_no_confidence_action(deposit, reward_address, anchor, action, &proposal);
+  cardano_no_confidence_action_unref(&action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create proposal procedure.";
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_proposal_procedure_set_t* proposals = get_proposal_procedure_set(body);
+
+  if (proposals == NULL)
+  {
+    cardano_proposal_procedure_unref(&proposal);
+    *error_message = "Failed to add proposal procedure.";
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_proposal_procedure_set_add(proposals, proposal);
+  cardano_proposal_procedure_unref(&proposal);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add proposal procedure.";
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_propose_no_confidence_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  const size_t             reward_address_size,
+  const char*              metadata_url,
+  const size_t             metadata_url_size,
+  const char*              metadata_hash_hex,
+  const size_t             metadata_hash_hex_size,
+  const char*              gov_action_id,
+  const size_t             gov_action_id_size,
+  const char**             error_message)
+{
+  if ((reward_address == NULL) || (reward_address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_url == NULL) || (metadata_url_size == 0U))
+  {
+    *error_message = "Metadata URL is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_hash_hex == NULL) || (metadata_hash_hex_size == 0U))
+  {
+    *error_message = "Metadata hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((gov_action_id == NULL) || (gov_action_id_size == 0U))
+  {
+    *error_message = "Governance action ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_error_t result = cardano_anchor_from_hash_hex(metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, &anchor);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create anchor.";
+
+    return result;
+  }
+
+  cardano_reward_address_t* addr = NULL;
+  result                         = cardano_reward_address_from_bech32(reward_address, reward_address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  cardano_governance_action_id_t* id = NULL;
+
+  result = cardano_governance_action_id_from_bech32(gov_action_id, gov_action_id_size, &id);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    cardano_reward_address_unref(&addr);
+    *error_message = "Failed to parse governance action ID.";
+
+    return result;
+  }
+
+  result = cardano_builder_propose_no_confidence(state, addr, anchor, id, error_message);
+
+  cardano_anchor_unref(&anchor);
+  cardano_reward_address_unref(&addr);
+  cardano_governance_action_id_unref(&id);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_propose_update_committee(
+  cardano_builder_state_t*         state,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  cardano_unit_interval_t*         new_quorum,
+  const char**                     error_message)
+{
+  cardano_update_committee_action_t* action = NULL;
+  cardano_error_t                    result = cardano_update_committee_action_new(members_to_be_removed, members_to_be_added, new_quorum, governance_action_id, &action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create update committee action.";
+
+    return result;
+  }
+
+  cardano_proposal_procedure_t* proposal = NULL;
+
+  const uint64_t deposit = cardano_protocol_parameters_get_governance_action_deposit(state->params);
+
+  result = cardano_proposal_procedure_new_update_committee_action(deposit, reward_address, anchor, action, &proposal);
+
+  cardano_update_committee_action_unref(&action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create proposal procedure.";
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_proposal_procedure_set_t* proposals = get_proposal_procedure_set(body);
+
+  if (proposals == NULL)
+  {
+    cardano_proposal_procedure_unref(&proposal);
+    *error_message = "Failed to add proposal procedure.";
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_proposal_procedure_set_add(proposals, proposal);
+  cardano_proposal_procedure_unref(&proposal);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add proposal procedure.";
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_propose_update_committee_ex(
+  cardano_builder_state_t*         state,
+  const char*                      reward_address,
+  const size_t                     reward_address_size,
+  const char*                      metadata_url,
+  const size_t                     metadata_url_size,
+  const char*                      metadata_hash_hex,
+  const size_t                     metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  const size_t                     gov_action_id_size,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  const double                     new_quorum,
+  const char**                     error_message)
+{
+  if ((reward_address == NULL) || (reward_address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_url == NULL) || (metadata_url_size == 0U))
+  {
+    *error_message = "Metadata URL is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_hash_hex == NULL) || (metadata_hash_hex_size == 0U))
+  {
+    *error_message = "Metadata hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((gov_action_id == NULL) || (gov_action_id_size == 0U))
+  {
+    *error_message = "Governance action ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_error_t result = cardano_anchor_from_hash_hex(metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, &anchor);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create anchor.";
+
+    return result;
+  }
+
+  cardano_reward_address_t* addr = NULL;
+  result                         = cardano_reward_address_from_bech32(reward_address, reward_address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  cardano_governance_action_id_t* id = NULL;
+
+  result = cardano_governance_action_id_from_bech32(gov_action_id, gov_action_id_size, &id);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    cardano_reward_address_unref(&addr);
+    *error_message = "Failed to parse governance action ID.";
+
+    return result;
+  }
+
+  cardano_unit_interval_t* quorum = NULL;
+  result                          = cardano_unit_interval_from_double(new_quorum, &quorum);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    cardano_reward_address_unref(&addr);
+    cardano_governance_action_id_unref(&id);
+    *error_message = "Failed to create unit interval.";
+
+    return result;
+  }
+
+  result = cardano_builder_propose_update_committee(state, addr, anchor, id, members_to_be_removed, members_to_be_added, quorum, error_message);
+
+  cardano_unit_interval_unref(&quorum);
+  cardano_anchor_unref(&anchor);
+  cardano_reward_address_unref(&addr);
+  cardano_governance_action_id_unref(&id);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_propose_new_constitution(
+  cardano_builder_state_t*        state,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id,
+  cardano_constitution_t*         constitution,
+  const char**                    error_message)
+{
+  cardano_new_constitution_action_t* action = NULL;
+
+  cardano_error_t result = cardano_new_constitution_action_new(constitution, governance_action_id, &action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create new constitution action.";
+
+    return result;
+  }
+
+  cardano_proposal_procedure_t* proposal = NULL;
+  const uint64_t                deposit  = cardano_protocol_parameters_get_governance_action_deposit(state->params);
+
+  result = cardano_proposal_procedure_new_constitution_action(deposit, reward_address, anchor, action, &proposal);
+
+  cardano_new_constitution_action_unref(&action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create proposal procedure.";
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_proposal_procedure_set_t* proposals = get_proposal_procedure_set(body);
+
+  if (proposals == NULL)
+  {
+    cardano_proposal_procedure_unref(&proposal);
+    *error_message = "Failed to add proposal procedure.";
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_proposal_procedure_set_add(proposals, proposal);
+  cardano_proposal_procedure_unref(&proposal);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add proposal procedure.";
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_propose_new_constitution_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  const size_t             reward_address_size,
+  const char*              metadata_url,
+  const size_t             metadata_url_size,
+  const char*              metadata_hash_hex,
+  const size_t             metadata_hash_hex_size,
+  const char*              gov_action_id,
+  const size_t             gov_action_id_size,
+  cardano_constitution_t*  constitution,
+  const char**             error_message)
+{
+  if ((reward_address == NULL) || (reward_address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_url == NULL) || (metadata_url_size == 0U))
+  {
+    *error_message = "Metadata URL is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_hash_hex == NULL) || (metadata_hash_hex_size == 0U))
+  {
+    *error_message = "Metadata hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((gov_action_id == NULL) || (gov_action_id_size == 0U))
+  {
+    *error_message = "Governance action ID is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_error_t result = cardano_anchor_from_hash_hex(metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, &anchor);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create anchor.";
+
+    return result;
+  }
+
+  cardano_reward_address_t* addr = NULL;
+
+  result = cardano_reward_address_from_bech32(reward_address, reward_address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  cardano_governance_action_id_t* id = NULL;
+
+  result = cardano_governance_action_id_from_bech32(gov_action_id, gov_action_id_size, &id);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    cardano_reward_address_unref(&addr);
+    *error_message = "Failed to parse governance action ID.";
+
+    return result;
+  }
+
+  result = cardano_builder_propose_new_constitution(state, addr, anchor, id, constitution, error_message);
+
+  cardano_anchor_unref(&anchor);
+  cardano_reward_address_unref(&addr);
+  cardano_governance_action_id_unref(&id);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_propose_info(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor,
+  const char**              error_message)
+{
+  cardano_info_action_t* action = NULL;
+  cardano_error_t        result = cardano_info_action_new(&action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create info action.";
+
+    return result;
+  }
+
+  cardano_proposal_procedure_t* proposal = NULL;
+  const uint64_t                deposit  = cardano_protocol_parameters_get_governance_action_deposit(state->params);
+
+  result = cardano_proposal_procedure_new_info_action(deposit, reward_address, anchor, action, &proposal);
+
+  cardano_info_action_unref(&action);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create proposal procedure.";
+
+    return result;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_proposal_procedure_set_t* proposals = get_proposal_procedure_set(body);
+
+  if (proposals == NULL)
+  {
+    cardano_proposal_procedure_unref(&proposal);
+    *error_message = "Failed to add proposal procedure.";
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_proposal_procedure_set_add(proposals, proposal);
+
+  cardano_proposal_procedure_unref(&proposal);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add proposal procedure.";
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_propose_info_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  const size_t             reward_address_size,
+  const char*              metadata_url,
+  const size_t             metadata_url_size,
+  const char*              metadata_hash_hex,
+  const size_t             metadata_hash_hex_size,
+  const char**             error_message)
+{
+  if ((reward_address == NULL) || (reward_address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_url == NULL) || (metadata_url_size == 0U))
+  {
+    *error_message = "Metadata URL is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((metadata_hash_hex == NULL) || (metadata_hash_hex_size == 0U))
+  {
+    *error_message = "Metadata hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_error_t result = cardano_anchor_from_hash_hex(metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, &anchor);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create anchor.";
+
+    return result;
+  }
+
+  cardano_reward_address_t* addr = NULL;
+
+  result = cardano_reward_address_from_bech32(reward_address, reward_address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_anchor_unref(&anchor);
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  result = cardano_builder_propose_info(state, addr, anchor, error_message);
+
+  cardano_anchor_unref(&anchor);
+  cardano_reward_address_unref(&addr);
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/internals/builder_proposals.h b/vendor/src/transaction_builder/internals/builder_proposals.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_proposals.h
@@ -0,0 +1,587 @@
+/**
+ * \file builder_proposals.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_PROPOSALS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_PROPOSALS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/common/anchor.h>
+#include <cardano/common/governance_action_id.h>
+#include <cardano/common/protocol_version.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/proposal_procedures/committee_members_map.h>
+#include <cardano/proposal_procedures/constitution.h>
+#include <cardano/proposal_procedures/credential_set.h>
+#include <cardano/protocol_params/protocol_param_update.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** \brief Adds a proposal with an optional explicit proposing redeemer. */
+cardano_error_t cardano_builder_add_proposal(
+  cardano_builder_state_t*      state,
+  cardano_proposal_procedure_t* proposal,
+  cardano_plutus_data_t*        redeemer,
+  const char**                  error_message);
+
+/** \brief Adds a proposal with a deferred proposing redeemer. */
+cardano_error_t cardano_builder_add_proposal_with_deferred_redeemer(
+  cardano_builder_state_t*       state,
+  cardano_proposal_procedure_t*  proposal,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  const char**                   error_message);
+
+/**
+ * \brief Adds a protocol parameter change proposal to the transaction.
+ *
+ * This function creates a parameter change governance action from \p protocol_param_update,
+ * \p governance_action_id and \p policy_hash, wraps it in a proposal procedure funded with the
+ * governance action deposit from the state protocol parameters and adds it to the proposal
+ * procedures of the transaction body, creating the set when it is missing. It also adds an empty
+ * proposing redeemer for the proposal to the witness set so the constitution script can validate
+ * the proposal. The proposing redeemer is added only after the proposal was added successfully;
+ * when adding the proposal fails, that error is returned and the witness set is left untouched.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t that receives the deposit
+ *                           refund. This parameter must not be NULL.
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t with the proposal metadata. This
+ *                   parameter must not be NULL.
+ * \param[in] protocol_param_update A pointer to the \ref cardano_protocol_param_update_t with the
+ *                                  parameter changes being proposed. This parameter must not be NULL.
+ * \param[in] governance_action_id A pointer to the \ref cardano_governance_action_id_t of the most
+ *                                 recently enacted action of this kind, or NULL when there is none.
+ * \param[in] policy_hash A pointer to the \ref cardano_blake2b_hash_t with the constitution script
+ *                        hash. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_parameter_change(
+  cardano_builder_state_t*         state,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_blake2b_hash_t*          policy_hash,
+  const char**                     error_message);
+
+/**
+ * \brief Adds a protocol parameter change proposal given its parts as strings.
+ *
+ * This function parses the reward address, metadata anchor, governance action id and policy hash
+ * from their string representations and delegates to
+ * \ref cardano_builder_propose_parameter_change.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] reward_address_size The size of the reward address string in bytes.
+ * \param[in] metadata_url A pointer to the string with the metadata URL of the anchor.
+ * \param[in] metadata_url_size The size of the metadata URL string in bytes.
+ * \param[in] metadata_hash_hex A pointer to the hex string with the metadata hash of the anchor.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] gov_action_id A pointer to the bech32 string with the governance action id.
+ * \param[in] gov_action_id_size The size of the governance action id string in bytes.
+ * \param[in] policy_hash_hash_hex A pointer to the hex string with the constitution script hash.
+ * \param[in] policy_hash_hash_hex_size The size of the constitution script hash string in bytes.
+ * \param[in] protocol_param_update A pointer to the \ref cardano_protocol_param_update_t with the
+ *                                  parameter changes being proposed. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_parameter_change_ex(
+  cardano_builder_state_t*         state,
+  const char*                      reward_address,
+  size_t                           reward_address_size,
+  const char*                      metadata_url,
+  size_t                           metadata_url_size,
+  const char*                      metadata_hash_hex,
+  size_t                           metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  size_t                           gov_action_id_size,
+  const char*                      policy_hash_hash_hex,
+  size_t                           policy_hash_hash_hex_size,
+  cardano_protocol_param_update_t* protocol_param_update,
+  const char**                     error_message);
+
+/**
+ * \brief Adds a hard fork initiation proposal to the transaction.
+ *
+ * This function creates a hard fork initiation governance action for \p version, wraps it in a
+ * proposal procedure funded with the governance action deposit from the state protocol parameters
+ * and adds it to the proposal procedures of the transaction body, creating the set when it is
+ * missing.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t that receives the deposit
+ *                           refund. This parameter must not be NULL.
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t with the proposal metadata. This
+ *                   parameter must not be NULL.
+ * \param[in] version A pointer to the \ref cardano_protocol_version_t being proposed. This parameter
+ *                    must not be NULL.
+ * \param[in] governance_action_id A pointer to the \ref cardano_governance_action_id_t of the most
+ *                                 recently enacted action of this kind, or NULL when there is none.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_hardfork(
+  cardano_builder_state_t*        state,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_protocol_version_t*     version,
+  cardano_governance_action_id_t* governance_action_id,
+  const char**                    error_message);
+
+/**
+ * \brief Adds a hard fork initiation proposal given its parts as strings.
+ *
+ * This function parses the reward address, metadata anchor and governance action id from their
+ * string representations, builds the protocol version from its components and delegates to
+ * \ref cardano_builder_propose_hardfork.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] reward_address_size The size of the reward address string in bytes.
+ * \param[in] metadata_url A pointer to the string with the metadata URL of the anchor.
+ * \param[in] metadata_url_size The size of the metadata URL string in bytes.
+ * \param[in] metadata_hash_hex A pointer to the hex string with the metadata hash of the anchor.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] gov_action_id A pointer to the bech32 string with the governance action id.
+ * \param[in] gov_action_id_size The size of the governance action id string in bytes.
+ * \param[in] minor_protocol_version The minor component of the proposed protocol version.
+ * \param[in] major_protocol_version The major component of the proposed protocol version.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_hardfork_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   reward_address_size,
+  const char*              metadata_url,
+  size_t                   metadata_url_size,
+  const char*              metadata_hash_hex,
+  size_t                   metadata_hash_hex_size,
+  const char*              gov_action_id,
+  size_t                   gov_action_id_size,
+  uint64_t                 minor_protocol_version,
+  uint64_t                 major_protocol_version,
+  const char**             error_message);
+
+/**
+ * \brief Adds a treasury withdrawals proposal to the transaction.
+ *
+ * This function creates a treasury withdrawals governance action from \p withdrawals and
+ * \p policy_hash, wraps it in a proposal procedure funded with the governance action deposit from
+ * the state protocol parameters and adds it to the proposal procedures of the transaction body,
+ * creating the set when it is missing. It also adds an empty proposing redeemer for the proposal
+ * to the witness set so the constitution script can validate the proposal. The proposing redeemer
+ * is added only after the proposal was added successfully; when adding the proposal fails, that
+ * error is returned and the witness set is left untouched.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t that receives the deposit
+ *                           refund. This parameter must not be NULL.
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t with the proposal metadata. This
+ *                   parameter must not be NULL.
+ * \param[in] withdrawals A pointer to the \ref cardano_withdrawal_map_t with the reward addresses
+ *                        and amounts to withdraw from the treasury. This parameter must not be NULL.
+ * \param[in] policy_hash A pointer to the \ref cardano_blake2b_hash_t with the constitution script
+ *                        hash. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_treasury_withdrawals(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor,
+  cardano_withdrawal_map_t* withdrawals,
+  cardano_blake2b_hash_t*   policy_hash,
+  const char**              error_message);
+
+/**
+ * \brief Adds a treasury withdrawals proposal given its parts as strings.
+ *
+ * This function parses the reward address, metadata anchor and policy hash from their string
+ * representations and delegates to \ref cardano_builder_propose_treasury_withdrawals.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] reward_address_size The size of the reward address string in bytes.
+ * \param[in] metadata_url A pointer to the string with the metadata URL of the anchor.
+ * \param[in] metadata_url_size The size of the metadata URL string in bytes.
+ * \param[in] metadata_hash_hex A pointer to the hex string with the metadata hash of the anchor.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] policy_hash_hash_hex A pointer to the hex string with the constitution script hash.
+ * \param[in] policy_hash_hash_hex_size The size of the constitution script hash string in bytes.
+ * \param[in] withdrawals A pointer to the \ref cardano_withdrawal_map_t with the reward addresses
+ *                        and amounts to withdraw from the treasury. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_treasury_withdrawals_ex(
+  cardano_builder_state_t*  state,
+  const char*               reward_address,
+  size_t                    reward_address_size,
+  const char*               metadata_url,
+  size_t                    metadata_url_size,
+  const char*               metadata_hash_hex,
+  size_t                    metadata_hash_hex_size,
+  const char*               policy_hash_hash_hex,
+  size_t                    policy_hash_hash_hex_size,
+  cardano_withdrawal_map_t* withdrawals,
+  const char**              error_message);
+
+/**
+ * \brief Adds a no confidence proposal to the transaction.
+ *
+ * This function creates a no confidence governance action, wraps it in a proposal procedure funded
+ * with the governance action deposit from the state protocol parameters and adds it to the proposal
+ * procedures of the transaction body, creating the set when it is missing.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t that receives the deposit
+ *                           refund. This parameter must not be NULL.
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t with the proposal metadata. This
+ *                   parameter must not be NULL.
+ * \param[in] governance_action_id A pointer to the \ref cardano_governance_action_id_t of the most
+ *                                 recently enacted action of this kind, or NULL when there is none.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_no_confidence(
+  cardano_builder_state_t*        state,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id,
+  const char**                    error_message);
+
+/**
+ * \brief Adds a no confidence proposal given its parts as strings.
+ *
+ * This function parses the reward address, metadata anchor and governance action id from their
+ * string representations and delegates to \ref cardano_builder_propose_no_confidence.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] reward_address_size The size of the reward address string in bytes.
+ * \param[in] metadata_url A pointer to the string with the metadata URL of the anchor.
+ * \param[in] metadata_url_size The size of the metadata URL string in bytes.
+ * \param[in] metadata_hash_hex A pointer to the hex string with the metadata hash of the anchor.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] gov_action_id A pointer to the bech32 string with the governance action id.
+ * \param[in] gov_action_id_size The size of the governance action id string in bytes.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_no_confidence_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   reward_address_size,
+  const char*              metadata_url,
+  size_t                   metadata_url_size,
+  const char*              metadata_hash_hex,
+  size_t                   metadata_hash_hex_size,
+  const char*              gov_action_id,
+  size_t                   gov_action_id_size,
+  const char**             error_message);
+
+/**
+ * \brief Adds an update committee proposal to the transaction.
+ *
+ * This function creates an update committee governance action from the members to remove, the
+ * members to add and the new quorum, wraps it in a proposal procedure funded with the governance
+ * action deposit from the state protocol parameters and adds it to the proposal procedures of the
+ * transaction body, creating the set when it is missing.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t that receives the deposit
+ *                           refund. This parameter must not be NULL.
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t with the proposal metadata. This
+ *                   parameter must not be NULL.
+ * \param[in] governance_action_id A pointer to the \ref cardano_governance_action_id_t of the most
+ *                                 recently enacted action of this kind, or NULL when there is none.
+ * \param[in] members_to_be_removed A pointer to the \ref cardano_credential_set_t with the cold
+ *                                  credentials of the committee members to remove. This parameter
+ *                                  must not be NULL.
+ * \param[in] members_to_be_added A pointer to the \ref cardano_committee_members_map_t with the new
+ *                                committee members and their terms. This parameter must not be NULL.
+ * \param[in] new_quorum A pointer to the \ref cardano_unit_interval_t with the new committee quorum
+ *                       threshold. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_update_committee(
+  cardano_builder_state_t*         state,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  cardano_unit_interval_t*         new_quorum,
+  const char**                     error_message);
+
+/**
+ * \brief Adds an update committee proposal given its parts as strings.
+ *
+ * This function parses the reward address, metadata anchor and governance action id from their
+ * string representations, builds the quorum unit interval from a double and delegates to
+ * \ref cardano_builder_propose_update_committee.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] reward_address_size The size of the reward address string in bytes.
+ * \param[in] metadata_url A pointer to the string with the metadata URL of the anchor.
+ * \param[in] metadata_url_size The size of the metadata URL string in bytes.
+ * \param[in] metadata_hash_hex A pointer to the hex string with the metadata hash of the anchor.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] gov_action_id A pointer to the bech32 string with the governance action id.
+ * \param[in] gov_action_id_size The size of the governance action id string in bytes.
+ * \param[in] members_to_be_removed A pointer to the \ref cardano_credential_set_t with the cold
+ *                                  credentials of the committee members to remove. This parameter
+ *                                  must not be NULL.
+ * \param[in] members_to_be_added A pointer to the \ref cardano_committee_members_map_t with the new
+ *                                committee members and their terms. This parameter must not be NULL.
+ * \param[in] new_quorum The new committee quorum threshold as a value between 0 and 1.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_update_committee_ex(
+  cardano_builder_state_t*         state,
+  const char*                      reward_address,
+  size_t                           reward_address_size,
+  const char*                      metadata_url,
+  size_t                           metadata_url_size,
+  const char*                      metadata_hash_hex,
+  size_t                           metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  size_t                           gov_action_id_size,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  double                           new_quorum,
+  const char**                     error_message);
+
+/**
+ * \brief Adds a new constitution proposal to the transaction.
+ *
+ * This function creates a new constitution governance action from \p constitution, wraps it in a
+ * proposal procedure funded with the governance action deposit from the state protocol parameters
+ * and adds it to the proposal procedures of the transaction body, creating the set when it is
+ * missing.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t that receives the deposit
+ *                           refund. This parameter must not be NULL.
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t with the proposal metadata. This
+ *                   parameter must not be NULL.
+ * \param[in] governance_action_id A pointer to the \ref cardano_governance_action_id_t of the most
+ *                                 recently enacted action of this kind, or NULL when there is none.
+ * \param[in] constitution A pointer to the \ref cardano_constitution_t being proposed. This
+ *                         parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_new_constitution(
+  cardano_builder_state_t*        state,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id,
+  cardano_constitution_t*         constitution,
+  const char**                    error_message);
+
+/**
+ * \brief Adds a new constitution proposal given its parts as strings.
+ *
+ * This function parses the reward address, metadata anchor and governance action id from their
+ * string representations and delegates to \ref cardano_builder_propose_new_constitution.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] reward_address_size The size of the reward address string in bytes.
+ * \param[in] metadata_url A pointer to the string with the metadata URL of the anchor.
+ * \param[in] metadata_url_size The size of the metadata URL string in bytes.
+ * \param[in] metadata_hash_hex A pointer to the hex string with the metadata hash of the anchor.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[in] gov_action_id A pointer to the bech32 string with the governance action id.
+ * \param[in] gov_action_id_size The size of the governance action id string in bytes.
+ * \param[in] constitution A pointer to the \ref cardano_constitution_t being proposed. This
+ *                         parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_new_constitution_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   reward_address_size,
+  const char*              metadata_url,
+  size_t                   metadata_url_size,
+  const char*              metadata_hash_hex,
+  size_t                   metadata_hash_hex_size,
+  const char*              gov_action_id,
+  size_t                   gov_action_id_size,
+  cardano_constitution_t*  constitution,
+  const char**             error_message);
+
+/**
+ * \brief Adds an info proposal to the transaction.
+ *
+ * This function creates an info governance action, wraps it in a proposal procedure funded with
+ * the governance action deposit from the state protocol parameters and adds it to the proposal
+ * procedures of the transaction body, creating the set when it is missing.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the \ref cardano_reward_address_t that receives the deposit
+ *                           refund. This parameter must not be NULL.
+ * \param[in] anchor A pointer to the \ref cardano_anchor_t with the proposal metadata. This
+ *                   parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_info(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor,
+  const char**              error_message);
+
+/**
+ * \brief Adds an info proposal given its parts as strings.
+ *
+ * This function parses the reward address and metadata anchor from their string representations
+ * and delegates to \ref cardano_builder_propose_info.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] reward_address_size The size of the reward address string in bytes.
+ * \param[in] metadata_url A pointer to the string with the metadata URL of the anchor.
+ * \param[in] metadata_url_size The size of the metadata URL string in bytes.
+ * \param[in] metadata_hash_hex A pointer to the hex string with the metadata hash of the anchor.
+ * \param[in] metadata_hash_hex_size The size of the metadata hash string in bytes.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the proposal was added, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_propose_info_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   reward_address_size,
+  const char*              metadata_url,
+  size_t                   metadata_url_size,
+  const char*              metadata_hash_hex,
+  size_t                   metadata_hash_hex_size,
+  const char**             error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_PROPOSALS_H
diff --git a/vendor/src/transaction_builder/internals/builder_redeemers.c b/vendor/src/transaction_builder/internals/builder_redeemers.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_redeemers.c
@@ -0,0 +1,232 @@
+/**
+ * \file builder_redeemers.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_redeemers.h"
+
+#include <cardano/common/ex_units.h>
+#include <cardano/plutus_data/constr_plutus_data.h>
+#include <cardano/plutus_data/plutus_list.h>
+#include <cardano/witness_set/redeemer_list.h>
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_add_redeemer(
+  cardano_witness_set_t*       witness_set,
+  cardano_blake2b_hash_t*      hash,
+  cardano_plutus_data_t*       data,
+  const cardano_redeemer_tag_t tag,
+  cardano_builder_state_t*     state,
+  const char**                 error_message)
+{
+  cardano_error_t          result    = CARDANO_SUCCESS;
+  cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witness_set);
+
+  if (redeemers == NULL)
+  {
+    result = cardano_redeemer_list_new(&redeemers);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_witness_set_set_redeemers(witness_set, redeemers);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_redeemer_list_unref(&redeemers);
+      return result;
+    }
+  }
+
+  cardano_redeemer_list_unref(&redeemers);
+
+  if (data != NULL)
+  {
+    cardano_redeemer_t* rdmer = NULL;
+
+    cardano_ex_units_t* ex_units = NULL;
+    result                       = cardano_ex_units_new(0, 0, &ex_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_redeemer_new(tag, 0, data, ex_units, &rdmer);
+    cardano_ex_units_unref(&ex_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    bool duplicate = false;
+
+    switch (tag)
+    {
+      case CARDANO_REDEEMER_TAG_MINT:
+      {
+        result = cardano_blake2b_hash_to_redeemer_map_insert(state->mints_to_redeemer_map, hash, rdmer);
+
+        if ((result != CARDANO_SUCCESS) && (result != CARDANO_ERROR_DUPLICATED_KEY))
+        {
+          *error_message = "Failed to insert plutus data to redeemer map.";
+
+          cardano_redeemer_unref(&rdmer);
+
+          return result;
+        }
+
+        if (result == CARDANO_ERROR_DUPLICATED_KEY)
+        {
+          duplicate = true;
+          result    = CARDANO_SUCCESS;
+        }
+
+        break;
+      }
+      case CARDANO_REDEEMER_TAG_REWARD:
+      {
+        result = cardano_blake2b_hash_to_redeemer_map_insert(state->withdrawals_to_redeemer_map, hash, rdmer);
+
+        if ((result != CARDANO_SUCCESS) && (result != CARDANO_ERROR_DUPLICATED_KEY))
+        {
+          *error_message = "Failed to insert plutus data to redeemer map.";
+
+          cardano_redeemer_unref(&rdmer);
+
+          return result;
+        }
+
+        if (result == CARDANO_ERROR_DUPLICATED_KEY)
+        {
+          duplicate = true;
+          result    = CARDANO_SUCCESS;
+        }
+
+        break;
+      }
+      case CARDANO_REDEEMER_TAG_VOTING:
+      {
+        result = cardano_blake2b_hash_to_redeemer_map_insert(state->votes_to_redeemer_map, hash, rdmer);
+
+        if ((result != CARDANO_SUCCESS) && (result != CARDANO_ERROR_DUPLICATED_KEY))
+        {
+          *error_message = "Failed to insert plutus data to redeemer map.";
+
+          cardano_redeemer_unref(&rdmer);
+
+          return result;
+        }
+
+        if (result == CARDANO_ERROR_DUPLICATED_KEY)
+        {
+          duplicate = true;
+          result    = CARDANO_SUCCESS;
+        }
+
+        break;
+      }
+      case CARDANO_REDEEMER_TAG_CERTIFYING:
+      case CARDANO_REDEEMER_TAG_PROPOSING:
+      case CARDANO_REDEEMER_TAG_SPEND:
+      case CARDANO_REDEEMER_TAG_GUARDING:
+      default:
+      {
+        *error_message = "Invalid redeemer tag.";
+        cardano_redeemer_unref(&rdmer);
+
+        return CARDANO_ERROR_ILLEGAL_STATE;
+      }
+    }
+
+    if (!duplicate)
+    {
+      result = cardano_redeemer_list_add(redeemers, rdmer);
+    }
+
+    cardano_redeemer_unref(&rdmer);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_create_placeholder_plutus_data(cardano_plutus_data_t** data)
+{
+  cardano_plutus_list_t* fields = NULL;
+
+  cardano_error_t result = cardano_plutus_list_new(&fields);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_constr_plutus_data_t* constr = NULL;
+
+  result = cardano_constr_plutus_data_new(0U, fields, &constr);
+
+  cardano_plutus_list_unref(&fields);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_plutus_data_new_constr(constr, data);
+
+  cardano_constr_plutus_data_unref(&constr);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_register_deferred_from_map(
+  cardano_builder_state_t*                state,
+  cardano_blake2b_hash_to_redeemer_map_t* map,
+  cardano_blake2b_hash_t*                 hash,
+  cardano_deferred_redeemer_fn_t          callback,
+  void*                                   user_context,
+  const char**                            error_message)
+{
+  cardano_redeemer_t* redeemer = NULL;
+
+  cardano_error_t result = cardano_blake2b_hash_to_redeemer_map_get(map, hash, &redeemer);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_deferred_redeemer_list_add(state->deferred_redeemers, redeemer, callback, user_context);
+  }
+
+  cardano_redeemer_unref(&redeemer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to register the deferred redeemer.";
+  }
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/internals/builder_redeemers.h b/vendor/src/transaction_builder/internals/builder_redeemers.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_redeemers.h
@@ -0,0 +1,129 @@
+/**
+ * \file builder_redeemers.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_REDEEMERS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_REDEEMERS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+#include <cardano/witness_set/redeemer.h>
+#include <cardano/witness_set/witness_set.h>
+
+#include "blake2b_hash_to_redeemer_map.h"
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Adds a redeemer for the given tag to a witness set and records it in the matching redeemer map.
+ *
+ * This function ensures the witness set has a redeemer list, creating and attaching an empty one when it
+ * is missing. When \p data is not NULL it creates a redeemer with the given tag, a zero index and zero
+ * execution units, inserts it keyed by \p hash into the state redeemer map that matches the tag (mint,
+ * reward or vote) and appends it to the witness set redeemer list unless the key was already present in
+ * the map.
+ *
+ * \param[in,out] witness_set A pointer to the \ref cardano_witness_set_t that receives the redeemer. This
+ *                            parameter must not be NULL.
+ * \param[in] hash A pointer to the \ref cardano_blake2b_hash_t used as the key in the redeemer map. This
+ *                 parameter must not be NULL.
+ * \param[in] data A pointer to the \ref cardano_plutus_data_t with the redeemer payload, or NULL to only
+ *                 ensure the witness set redeemer list exists.
+ * \param[in] tag The \ref cardano_redeemer_tag_t identifying the redeemer purpose. Only the mint, reward
+ *                and vote tags are accepted.
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t holding the redeemer maps. This
+ *                      parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the redeemer was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_add_redeemer(
+  cardano_witness_set_t*   witness_set,
+  cardano_blake2b_hash_t*  hash,
+  cardano_plutus_data_t*   data,
+  cardano_redeemer_tag_t   tag,
+  cardano_builder_state_t* state,
+  const char**             error_message);
+
+/**
+ * \brief Creates the placeholder payload used by deferred redeemers until they are resolved.
+ *
+ * The placeholder is an empty constructor (constr 0 []), so the transaction can be sized and
+ * hashed before the first balancing iteration replaces it with the real payload.
+ *
+ * \param[out] data A pointer to a pointer to a \ref cardano_plutus_data_t. On success it points to the
+ *                  newly created placeholder and the caller must release it with
+ *                  \ref cardano_plutus_data_unref. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an appropriate error code.
+ */
+cardano_error_t
+cardano_builder_create_placeholder_plutus_data(cardano_plutus_data_t** data);
+
+/**
+ * \brief Registers a deferred callback for the redeemer stored under the given hash in one of
+ * the builder state redeemer maps.
+ *
+ * This function looks up the redeemer keyed by \p hash in \p map and, when found, adds it to the
+ * state deferred redeemer list together with the callback and its context so the payload can be
+ * resolved during balancing.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t holding the deferred redeemer
+ *                      list. This parameter must not be NULL.
+ * \param[in] map A pointer to the \ref cardano_blake2b_hash_to_redeemer_map_t holding the redeemer
+ *                (mint, withdrawal or vote map). This parameter must not be NULL.
+ * \param[in] hash A pointer to the \ref cardano_blake2b_hash_t key of the redeemer in the map. This
+ *                 parameter must not be NULL.
+ * \param[in] callback The deferred redeemer callback invoked during balancing.
+ * \param[in] user_context The opaque pointer forwarded to the callback.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the deferred redeemer was registered, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_register_deferred_from_map(
+  cardano_builder_state_t*                state,
+  cardano_blake2b_hash_to_redeemer_map_t* map,
+  cardano_blake2b_hash_t*                 hash,
+  cardano_deferred_redeemer_fn_t          callback,
+  void*                                   user_context,
+  const char**                            error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_REDEEMERS_H
diff --git a/vendor/src/transaction_builder/internals/builder_state.c b/vendor/src/transaction_builder/internals/builder_state.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_state.c
@@ -0,0 +1,289 @@
+/**
+ * \file builder_state.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_state.h"
+#include "../../allocators.h"
+
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+#include <cardano/transaction_builder/coin_selection/random_improve_coin_selector.h>
+#include <cardano/transaction_builder/evaluation/native_tx_evaluator.h>
+#include <cardano/witness_set/witness_set.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Creates and initializes a new, empty transaction.
+ *
+ * This function allocates and initializes a new instance of a \ref cardano_transaction_t object.
+ *
+ * \return A pointer to the newly created \ref cardano_transaction_t object if successful. Returns
+ * \c NULL if memory allocation fails.
+ */
+static cardano_transaction_t*
+transaction_new(void)
+{
+  cardano_transaction_body_t*        body        = NULL;
+  cardano_transaction_input_set_t*   inputs      = NULL;
+  cardano_transaction_output_list_t* outputs     = NULL;
+  cardano_witness_set_t*             witnesses   = NULL;
+  cardano_transaction_t*             transaction = NULL;
+
+  cardano_error_t result = cardano_transaction_input_set_new(&inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return NULL;
+  }
+
+  result = cardano_transaction_output_list_new(&outputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_input_set_unref(&inputs);
+    return NULL;
+  }
+
+  result = cardano_transaction_body_new(inputs, outputs, 0U, NULL, &body);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_input_set_unref(&inputs);
+    cardano_transaction_output_list_unref(&outputs);
+    return NULL;
+  }
+
+  result = cardano_witness_set_new(&witnesses);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_input_set_unref(&inputs);
+    cardano_transaction_output_list_unref(&outputs);
+    cardano_transaction_body_unref(&body);
+    return NULL;
+  }
+
+  result = cardano_transaction_new(body, witnesses, NULL, &transaction);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_input_set_unref(&inputs);
+    cardano_transaction_output_list_unref(&outputs);
+    cardano_transaction_body_unref(&body);
+    cardano_witness_set_unref(&witnesses);
+
+    return NULL;
+  }
+
+  cardano_transaction_input_set_unref(&inputs);
+  cardano_transaction_output_list_unref(&outputs);
+  cardano_transaction_body_unref(&body);
+  cardano_witness_set_unref(&witnesses);
+
+  return transaction;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_state_init(
+  cardano_builder_state_t*       state,
+  cardano_protocol_parameters_t* params,
+  const cardano_slot_config_t*   slot_config)
+{
+  if ((state == NULL) || (params == NULL) || (slot_config == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  state->transaction                      = NULL;
+  state->pool_state                       = NULL;
+  state->pool_state_size                  = 0U;
+  state->params                           = NULL;
+  state->slot_config                      = *slot_config;
+  state->coin_selector                    = NULL;
+  state->tx_evaluator                     = NULL;
+  state->change_address                   = NULL;
+  state->collateral_address               = NULL;
+  state->available_utxos                  = NULL;
+  state->collateral_utxos                 = NULL;
+  state->pre_selected_inputs              = NULL;
+  state->reference_inputs                 = NULL;
+  state->sub_transaction_inputs           = NULL;
+  state->sub_transaction_reference_inputs = NULL;
+  state->input_to_redeemer_map            = NULL;
+  state->withdrawals_to_redeemer_map      = NULL;
+  state->mints_to_redeemer_map            = NULL;
+  state->votes_to_redeemer_map            = NULL;
+  state->deferred_redeemers               = NULL;
+  state->additional_signature_count       = 0U;
+
+  cardano_protocol_parameters_ref(params);
+  state->params = params;
+
+  cardano_error_t result = cardano_random_improve_coin_selector_new(&state->coin_selector);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  state->transaction = transaction_new();
+
+  if (state->transaction == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_utxo_list_new(&state->pre_selected_inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_utxo_list_new(&state->reference_inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_utxo_list_new(&state->sub_transaction_inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_utxo_list_new(&state->sub_transaction_reference_inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_input_to_redeemer_map_new(&state->input_to_redeemer_map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_blake2b_hash_to_redeemer_map_new(&state->withdrawals_to_redeemer_map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_blake2b_hash_to_redeemer_map_new(&state->mints_to_redeemer_map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_blake2b_hash_to_redeemer_map_new(&state->votes_to_redeemer_map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_deferred_redeemer_list_new(&state->deferred_redeemers);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_costmdls_t*         cost_models    = cardano_protocol_parameters_get_cost_models(state->params);
+  cardano_protocol_version_t* version        = cardano_protocol_parameters_get_protocol_version(state->params);
+  const uint64_t              protocol_major = cardano_protocol_version_get_major(version);
+
+  result = cardano_tx_evaluator_new_native(&state->slot_config, cost_models, protocol_major, &state->tx_evaluator);
+
+  cardano_costmdls_unref(&cost_models);
+  cardano_protocol_version_unref(&version);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_builder_state_release(cardano_builder_state_t* state)
+{
+  if (state == NULL)
+  {
+    return;
+  }
+
+  cardano_transaction_unref(&state->transaction);
+  for (size_t i = 0U; i < state->pool_state_size; ++i)
+  {
+    cardano_pool_params_unref(&state->pool_state[i]);
+  }
+  _cardano_free(state->pool_state);
+  state->pool_state      = NULL;
+  state->pool_state_size = 0U;
+  cardano_protocol_parameters_unref(&state->params);
+  cardano_coin_selector_unref(&state->coin_selector);
+  cardano_tx_evaluator_unref(&state->tx_evaluator);
+  cardano_address_unref(&state->change_address);
+  cardano_address_unref(&state->collateral_address);
+  cardano_utxo_list_unref(&state->available_utxos);
+  cardano_utxo_list_unref(&state->collateral_utxos);
+  cardano_utxo_list_unref(&state->pre_selected_inputs);
+  cardano_utxo_list_unref(&state->reference_inputs);
+  cardano_utxo_list_unref(&state->sub_transaction_inputs);
+  cardano_utxo_list_unref(&state->sub_transaction_reference_inputs);
+  cardano_input_to_redeemer_map_unref(&state->input_to_redeemer_map);
+  cardano_blake2b_hash_to_redeemer_map_unref(&state->withdrawals_to_redeemer_map);
+  cardano_blake2b_hash_to_redeemer_map_unref(&state->mints_to_redeemer_map);
+  cardano_blake2b_hash_to_redeemer_map_unref(&state->votes_to_redeemer_map);
+  cardano_deferred_redeemer_list_unref(&state->deferred_redeemers);
+
+  state->transaction                      = NULL;
+  state->params                           = NULL;
+  state->coin_selector                    = NULL;
+  state->tx_evaluator                     = NULL;
+  state->change_address                   = NULL;
+  state->collateral_address               = NULL;
+  state->available_utxos                  = NULL;
+  state->collateral_utxos                 = NULL;
+  state->pre_selected_inputs              = NULL;
+  state->reference_inputs                 = NULL;
+  state->sub_transaction_inputs           = NULL;
+  state->sub_transaction_reference_inputs = NULL;
+  state->input_to_redeemer_map            = NULL;
+  state->withdrawals_to_redeemer_map      = NULL;
+  state->mints_to_redeemer_map            = NULL;
+  state->votes_to_redeemer_map            = NULL;
+  state->deferred_redeemers               = NULL;
+}
diff --git a/vendor/src/transaction_builder/internals/builder_state.h b/vendor/src/transaction_builder/internals/builder_state.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_state.h
@@ -0,0 +1,170 @@
+/**
+ * \file builder_state.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_STATE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_STATE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/address.h>
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/protocol_params/protocol_parameters.h>
+#include <cardano/slot_config.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+#include <cardano/transaction_builder/balancing/input_to_redeemer_map.h>
+#include <cardano/transaction_builder/coin_selection/coin_selector.h>
+#include <cardano/transaction_builder/evaluation/tx_evaluator.h>
+#include <cardano/typedefs.h>
+
+#include "blake2b_hash_to_redeemer_map.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Holds everything a transaction builder tracks while assembling a transaction.
+ *
+ * The `cardano_builder_state_t` structure carries the transaction under construction together
+ * with the protocol parameters, selection strategies, addresses, UTXO lists and redeemer
+ * bookkeeping that the builder consults when balancing and finalizing the transaction.
+ */
+typedef struct cardano_builder_state_t
+{
+    /** \brief The transaction being incrementally assembled by the builder. */
+    cardano_transaction_t* transaction;
+
+    /** \brief The protocol parameters used for fee, deposit and size computations. */
+    cardano_protocol_parameters_t* params;
+
+    /** \brief Owned snapshots of latest registered pool parameters for witness estimation. */
+    cardano_pool_params_t** pool_state;
+
+    /** \brief Number of entries in pool_state. */
+    size_t pool_state_size;
+
+    /** \brief The slot timing configuration used to convert between Unix time and slots. */
+    cardano_slot_config_t slot_config;
+
+    /** \brief The coin selection strategy used to pick inputs during balancing. */
+    cardano_coin_selector_t* coin_selector;
+
+    /** \brief The evaluator used to compute execution units for Plutus scripts. */
+    cardano_tx_evaluator_t* tx_evaluator;
+
+    /** \brief The address that receives any change produced while balancing. */
+    cardano_address_t* change_address;
+
+    /** \brief The address that receives any collateral change output. */
+    cardano_address_t* collateral_address;
+
+    /** \brief The UTXO set available to the coin selector for input selection. */
+    cardano_utxo_list_t* available_utxos;
+
+    /** \brief The UTXO set available for collateral selection. */
+    cardano_utxo_list_t* collateral_utxos;
+
+    /** \brief The inputs explicitly added by the caller that must be spent by the transaction. */
+    cardano_utxo_list_t* pre_selected_inputs;
+
+    /** \brief The reference inputs added to the transaction. */
+    cardano_utxo_list_t* reference_inputs;
+
+    /** \brief The resolved spend inputs of every sub transaction added to the transaction. */
+    cardano_utxo_list_t* sub_transaction_inputs;
+
+    /**
+     * \brief The resolved reference inputs of every sub transaction added to the transaction.
+     *
+     * Only the reference inputs that were resolved when their sub transaction was added are listed, and
+     * a reference input shared by several sub transactions is listed once per sub transaction.
+     */
+    cardano_utxo_list_t* sub_transaction_reference_inputs;
+
+    /** \brief The number of additional signatures accounted for when computing fees. */
+    size_t additional_signature_count;
+
+    /** \brief Maps transaction inputs to their spend redeemers. */
+    cardano_input_to_redeemer_map_t* input_to_redeemer_map;
+
+    /** \brief Maps reward credential hashes to their withdrawal redeemers. */
+    cardano_blake2b_hash_to_redeemer_map_t* withdrawals_to_redeemer_map;
+
+    /** \brief Maps minting policy hashes to their mint redeemers. */
+    cardano_blake2b_hash_to_redeemer_map_t* mints_to_redeemer_map;
+
+    /** \brief Maps voter credential hashes to their voting redeemers. */
+    cardano_blake2b_hash_to_redeemer_map_t* votes_to_redeemer_map;
+
+    /** \brief The redeemers whose indices are resolved when the transaction is balanced. */
+    cardano_deferred_redeemer_list_t* deferred_redeemers;
+} cardano_builder_state_t;
+
+/**
+ * \brief Initializes a builder state with its default contents.
+ *
+ * This function initializes every field of the given state, takes a reference on the provided
+ * protocol parameters, copies the slot configuration and creates the objects the builder starts
+ * from: a random improve coin selector, an empty transaction, the pre selected and reference
+ * input lists, the sub transaction input lists, the redeemer maps, the deferred redeemer list and
+ * a native transaction evaluator configured from the protocol parameters cost models and protocol
+ * version.
+ *
+ * \param[out] state A pointer to the \ref cardano_builder_state_t to initialize. This parameter
+ *                   must not be NULL.
+ * \param[in] params A pointer to the \ref cardano_protocol_parameters_t used by the builder. The
+ *                   state holds a reference to this object until it is released. This parameter
+ *                   must not be NULL.
+ * \param[in] slot_config A pointer to the \ref cardano_slot_config_t copied into the state. This
+ *                        parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the state was fully initialized, or an appropriate error code
+ *         indicating the failure reason. On failure the state may be partially initialized and
+ *         the caller must release it with \ref cardano_builder_state_release.
+ */
+cardano_error_t
+cardano_builder_state_init(
+  cardano_builder_state_t*       state,
+  cardano_protocol_parameters_t* params,
+  const cardano_slot_config_t*   slot_config);
+
+/**
+ * \brief Releases every object held by a builder state.
+ *
+ * This function releases the references the state holds on the transaction, protocol parameters,
+ * coin selector, transaction evaluator, addresses, UTXO lists, redeemer maps and deferred
+ * redeemer list, setting each pointer field to NULL. It does not free the state itself. Calling
+ * it on an already released state or with NULL has no effect.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t to release.
+ */
+void
+cardano_builder_state_release(cardano_builder_state_t* state);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_STATE_H
diff --git a/vendor/src/transaction_builder/internals/builder_sub_build.c b/vendor/src/transaction_builder/internals/builder_sub_build.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_sub_build.c
@@ -0,0 +1,752 @@
+/**
+ * \file builder_sub_build.c
+ *
+ * \author angel.castillo
+ * \date   Sep 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_sub_build.h"
+#include "builder_build.h"
+
+#include <cardano/common/ex_units.h>
+#include <cardano/common/protocol_version.h>
+#include <cardano/common/utxo.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+#include <cardano/transaction_builder/balancing/input_to_redeemer_map.h>
+#include <cardano/transaction_builder/evaluation/native_tx_evaluator.h>
+#include <cardano/witness_set/redeemer_list.h>
+#include <cardano/witness_set/witness_set.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Creates the input set that spends a list of resolved UTXOs.
+ *
+ * \param[in] utxos A pointer to the \ref cardano_utxo_list_t with the UTXOs to spend.
+ * \param[out] inputs On success, this will point to a newly created \ref cardano_transaction_input_set_t
+ *                    with the input of every UTXO in \p utxos. The caller is responsible for releasing
+ *                    it with \ref cardano_transaction_input_set_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the input set was created, or an appropriate error code indicating
+ *         the failure reason.
+ */
+static cardano_error_t
+create_input_set(cardano_utxo_list_t* utxos, cardano_transaction_input_set_t** inputs)
+{
+  cardano_transaction_input_set_t* input_set = NULL;
+  cardano_error_t                  result    = cardano_transaction_input_set_new(&input_set);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  const size_t length = cardano_utxo_list_get_length(utxos);
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    result = cardano_utxo_list_get(utxos, i, &utxo);
+    cardano_utxo_unref(&utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_input_set_unref(&input_set);
+
+      return result;
+    }
+
+    cardano_transaction_input_t* input = cardano_utxo_get_input(utxo);
+    cardano_transaction_input_unref(&input);
+
+    result = cardano_transaction_input_set_add(input_set, input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_transaction_input_set_unref(&input_set);
+
+      return result;
+    }
+  }
+
+  *inputs = input_set;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Sets the index of every spend redeemer to the position of its input in the sorted input set.
+ *
+ * A spend redeemer points at its input by the position of that input in the inputs of the body, so
+ * its index can only be known once the input set of the sub transaction exists. Inputs spent without
+ * a redeemer are skipped.
+ *
+ * \param[in] inputs A pointer to the \ref cardano_transaction_input_set_t spent by the sub transaction.
+ * \param[in,out] input_to_redeemer_map A pointer to the \ref cardano_input_to_redeemer_map_t that maps
+ *                                      every input spent with a redeemer to that redeemer.
+ *
+ * \return \ref CARDANO_SUCCESS if every spend redeemer index was set, or an appropriate error code
+ *         indicating the failure reason.
+ */
+static cardano_error_t
+set_spend_redeemer_indices(
+  cardano_transaction_input_set_t* inputs,
+  cardano_input_to_redeemer_map_t* input_to_redeemer_map)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+  const size_t    length = cardano_transaction_input_set_get_length(inputs);
+
+  for (size_t i = 0U; (i < length) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_transaction_input_t* input = NULL;
+
+    result = cardano_transaction_input_set_get(inputs, i, &input);
+    cardano_transaction_input_unref(&input);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_input_to_redeemer_map_update_redeemer_index(input_to_redeemer_map, input, i);
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Orders two resolved UTXOs by their inputs, the order of the inputs of a body.
+ *
+ * \param[in] lhs A pointer to the first \ref cardano_utxo_t to compare.
+ * \param[in] rhs A pointer to the second \ref cardano_utxo_t to compare.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the input of \p lhs sorts before the input of \p rhs, zero if both inputs are
+ *         equal, and a positive value otherwise.
+ */
+static int32_t
+compare_utxo_inputs(cardano_utxo_t* lhs, cardano_utxo_t* rhs, void* context)
+{
+  CARDANO_UNUSED(context);
+
+  cardano_transaction_input_t* lhs_input = cardano_utxo_get_input(lhs);
+  cardano_transaction_input_unref(&lhs_input);
+
+  cardano_transaction_input_t* rhs_input = cardano_utxo_get_input(rhs);
+  cardano_transaction_input_unref(&rhs_input);
+
+  return cardano_transaction_input_compare(lhs_input, rhs_input);
+}
+
+/**
+ * \brief Resolves the deferred redeemers of the sub transaction against the body that is signed.
+ *
+ * Every deferred redeemer callback receives a transaction and its resolved inputs. The transaction held by the
+ * state carries every field of the sub transaction body but its inputs, so its inputs are set to the sorted inputs
+ * of the sub transaction and the resolved inputs are given in that same order. The callbacks therefore observe the
+ * inputs, outputs and every other field of the sub transaction body, and any index they compute is local to it.
+ * Nothing is changed when no deferred redeemer was added.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the sub transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] inputs A pointer to the sorted \ref cardano_transaction_input_set_t spent by the sub transaction.
+ *
+ * \return \ref CARDANO_SUCCESS if every deferred redeemer was resolved, or the error returned by the first
+ *         callback that failed, or another appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+resolve_deferred_redeemers(cardano_builder_state_t* state, cardano_transaction_input_set_t* inputs)
+{
+  if (cardano_deferred_redeemer_list_get_length(state->deferred_redeemers) == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_error_t result = cardano_transaction_body_set_inputs(body, inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_utxo_list_t* resolved_inputs = cardano_utxo_list_clone(state->pre_selected_inputs);
+
+  if (resolved_inputs == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_utxo_list_sort(resolved_inputs, compare_utxo_inputs, NULL);
+
+  result = cardano_deferred_redeemer_list_resolve(state->deferred_redeemers, state->transaction, resolved_inputs);
+  cardano_utxo_list_unref(&resolved_inputs);
+
+  return result;
+}
+
+/**
+ * \brief Copies the optional scalar fields of a transaction body into a sub transaction body.
+ *
+ * This function copies the validity interval, the network id, the treasury value and the donation.
+ * A field that is absent in \p body is left absent in \p sub_body.
+ *
+ * \param[in] body A pointer to the \ref cardano_transaction_body_t to copy from.
+ * \param[in,out] sub_body A pointer to the \ref cardano_sub_transaction_body_t to copy into.
+ *
+ * \return \ref CARDANO_SUCCESS if every field was copied, or an appropriate error code indicating the
+ *         failure reason.
+ */
+static cardano_error_t
+copy_scalar_fields(cardano_transaction_body_t* body, cardano_sub_transaction_body_t* sub_body)
+{
+  cardano_error_t result = cardano_sub_transaction_body_set_invalid_before(sub_body, cardano_transaction_body_get_invalid_before(body));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_sub_transaction_body_set_invalid_after(sub_body, cardano_transaction_body_get_invalid_after(body));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_sub_transaction_body_set_network_id(sub_body, cardano_transaction_body_get_network_id(body));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_sub_transaction_body_set_treasury_value(sub_body, cardano_transaction_body_get_treasury_value(body));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return cardano_sub_transaction_body_set_donation(sub_body, cardano_transaction_body_get_donation(body));
+}
+
+/**
+ * \brief Copies the optional object fields of a transaction body into a sub transaction body.
+ *
+ * This function copies the mint, certificates, withdrawals, auxiliary data hash, script data hash,
+ * reference inputs, voting procedures, proposal procedures, guards, required top level guards, direct
+ * deposits and account balance intervals. The objects are shared between both bodies, and a field
+ * that is absent in \p body is left absent in \p sub_body.
+ *
+ * \param[in] body A pointer to the \ref cardano_transaction_body_t to copy from.
+ * \param[in,out] sub_body A pointer to the \ref cardano_sub_transaction_body_t to copy into.
+ *
+ * \return \ref CARDANO_SUCCESS if every field was copied, or an appropriate error code indicating the
+ *         failure reason.
+ */
+static cardano_error_t
+copy_object_fields(cardano_transaction_body_t* body, cardano_sub_transaction_body_t* sub_body)
+{
+  cardano_multi_asset_t* mint = cardano_transaction_body_get_mint(body);
+  cardano_multi_asset_unref(&mint);
+
+  cardano_error_t result = cardano_sub_transaction_body_set_mint(sub_body, mint);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_certificate_set_t* certificates = cardano_transaction_body_get_certificates(body);
+  cardano_certificate_set_unref(&certificates);
+
+  result = cardano_sub_transaction_body_set_certificates(sub_body, certificates);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_withdrawal_map_t* withdrawals = cardano_transaction_body_get_withdrawals(body);
+  cardano_withdrawal_map_unref(&withdrawals);
+
+  result = cardano_sub_transaction_body_set_withdrawals(sub_body, withdrawals);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_t* aux_data_hash = cardano_transaction_body_get_aux_data_hash(body);
+  cardano_blake2b_hash_unref(&aux_data_hash);
+
+  result = cardano_sub_transaction_body_set_aux_data_hash(sub_body, aux_data_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_t* script_data_hash = cardano_transaction_body_get_script_data_hash(body);
+  cardano_blake2b_hash_unref(&script_data_hash);
+
+  result = cardano_sub_transaction_body_set_script_data_hash(sub_body, script_data_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_transaction_input_set_t* reference_inputs = cardano_transaction_body_get_reference_inputs(body);
+  cardano_transaction_input_set_unref(&reference_inputs);
+
+  result = cardano_sub_transaction_body_set_reference_inputs(sub_body, reference_inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_voting_procedures_t* voting_procedures = cardano_transaction_body_get_voting_procedures(body);
+  cardano_voting_procedures_unref(&voting_procedures);
+
+  result = cardano_sub_transaction_body_set_voting_procedures(sub_body, voting_procedures);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_proposal_procedure_set_t* proposal_procedures = cardano_transaction_body_get_proposal_procedures(body);
+  cardano_proposal_procedure_set_unref(&proposal_procedures);
+
+  result = cardano_sub_transaction_body_set_proposal_procedures(sub_body, proposal_procedures);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_guard_set_t* guards = cardano_transaction_body_get_guards(body);
+  cardano_guard_set_unref(&guards);
+
+  result = cardano_sub_transaction_body_set_guards(sub_body, guards);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_required_guards_map_t* required_top_level_guards = cardano_transaction_body_get_required_top_level_guards(body);
+  cardano_required_guards_map_unref(&required_top_level_guards);
+
+  result = cardano_sub_transaction_body_set_required_top_level_guards(sub_body, required_top_level_guards);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_direct_deposit_map_t* direct_deposits = cardano_transaction_body_get_direct_deposits(body);
+  cardano_direct_deposit_map_unref(&direct_deposits);
+
+  result = cardano_sub_transaction_body_set_direct_deposits(sub_body, direct_deposits);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_account_balance_intervals_map_t* account_balance_intervals = cardano_transaction_body_get_account_balance_intervals(body);
+  cardano_account_balance_intervals_map_unref(&account_balance_intervals);
+
+  return cardano_sub_transaction_body_set_account_balance_intervals(sub_body, account_balance_intervals);
+}
+
+/**
+ * \brief Creates a top level transaction that carries a sub transaction and nothing else.
+ *
+ * The sub transaction is the single sub transaction of the carrier, so its scripts are evaluated
+ * at position 0 of the batch. The script context of a sub transaction carries its position in the
+ * batch, so a script whose path or cost depends on that position may need different execution
+ * units in the final batch.
+ *
+ * \param[in] sub_transaction A pointer to the \ref cardano_sub_transaction_t to carry.
+ * \param[out] transaction On success, this will point to the newly created \ref cardano_transaction_t.
+ *                         The caller is responsible for releasing it with \ref cardano_transaction_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the transaction was created, or an appropriate error code indicating
+ *         the failure reason.
+ */
+static cardano_error_t
+create_carrier_transaction(cardano_sub_transaction_t* sub_transaction, cardano_transaction_t** transaction)
+{
+  cardano_transaction_input_set_t*   inputs           = NULL;
+  cardano_transaction_output_list_t* outputs          = NULL;
+  cardano_transaction_body_t*        body             = NULL;
+  cardano_sub_transaction_set_t*     sub_transactions = NULL;
+  cardano_witness_set_t*             witness_set      = NULL;
+  cardano_error_t                    result           = cardano_transaction_input_set_new(&inputs);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_transaction_output_list_new(&outputs);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_transaction_body_new(inputs, outputs, 0U, NULL, &body);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_sub_transaction_set_new(&sub_transactions);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_sub_transaction_set_add(sub_transactions, sub_transaction);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_transaction_body_set_sub_transactions(body, sub_transactions);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_witness_set_new(&witness_set);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_transaction_new(body, witness_set, NULL, transaction);
+  }
+
+  cardano_transaction_input_set_unref(&inputs);
+  cardano_transaction_output_list_unref(&outputs);
+  cardano_transaction_body_unref(&body);
+  cardano_sub_transaction_set_unref(&sub_transactions);
+  cardano_witness_set_unref(&witness_set);
+
+  return result;
+}
+
+/**
+ * \brief Writes evaluated execution units into the matching redeemers of a redeemer list.
+ *
+ * \param[in,out] redeemers A pointer to the \ref cardano_redeemer_list_t whose redeemers are updated.
+ * \param[in] evaluated A pointer to the \ref cardano_redeemer_list_t holding the evaluated redeemers.
+ *
+ * \return \ref CARDANO_SUCCESS if every redeemer was updated, or an appropriate error code indicating
+ *         the failure reason.
+ */
+static cardano_error_t
+apply_execution_units(cardano_redeemer_list_t* redeemers, cardano_redeemer_list_t* evaluated)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+  const size_t    length = cardano_redeemer_list_get_length(evaluated);
+
+  for (size_t i = 0U; (i < length) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_redeemer_t* redeemer = NULL;
+
+    result = cardano_redeemer_list_get(evaluated, i, &redeemer);
+    cardano_redeemer_unref(&redeemer);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_ex_units_t* ex_units = cardano_redeemer_get_ex_units(redeemer);
+      cardano_ex_units_unref(&ex_units);
+
+      result = cardano_redeemer_list_set_ex_units(
+        redeemers,
+        cardano_redeemer_get_tag(redeemer),
+        cardano_redeemer_get_index(redeemer),
+        cardano_ex_units_get_memory(ex_units),
+        cardano_ex_units_get_cpu_steps(ex_units));
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Computes the execution units of the redeemers of a sub transaction.
+ *
+ * The sub transaction is evaluated with the native evaluator configured from the cost models and the
+ * protocol version of the state, resolving its inputs and reference inputs with the UTXOs added to
+ * the state. The computed execution units are written into the redeemers of the witness set the sub
+ * transaction shares with the state. A sub transaction without redeemers is left unchanged.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the sub transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] sub_transaction A pointer to the \ref cardano_sub_transaction_t to evaluate.
+ * \param[out] error_message A pointer that receives a string describing the failure when the function
+ *                           does not return \ref CARDANO_SUCCESS. The string is static or owned by the
+ *                           transaction held by the state. \c *error_message must be NULL on entry,
+ *                           since the generic failure message is only set when no message was set.
+ *
+ * \return \ref CARDANO_SUCCESS if the redeemers were evaluated, or an appropriate error code indicating
+ *         the failure reason.
+ */
+static cardano_error_t
+evaluate_sub_transaction(
+  cardano_builder_state_t*   state,
+  cardano_sub_transaction_t* sub_transaction,
+  const char**               error_message)
+{
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(state->transaction);
+  cardano_witness_set_unref(&witness_set);
+
+  cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witness_set);
+  cardano_redeemer_list_unref(&redeemers);
+
+  if (cardano_redeemer_list_get_length(redeemers) == 0U)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_costmdls_t*         cost_models = cardano_protocol_parameters_get_cost_models(state->params);
+  cardano_protocol_version_t* version     = cardano_protocol_parameters_get_protocol_version(state->params);
+  cardano_transaction_t*      carrier     = NULL;
+  cardano_utxo_list_t*        utxos       = NULL;
+  cardano_tx_evaluator_t*     evaluator   = NULL;
+  cardano_redeemer_list_t*    evaluated   = NULL;
+  cardano_error_t             result      = cardano_tx_evaluator_new_native_sub_transaction(&state->slot_config, cost_models, cardano_protocol_version_get_major(version), 0U, &evaluator);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = create_carrier_transaction(sub_transaction, &carrier);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    utxos  = cardano_utxo_list_concat(state->pre_selected_inputs, state->reference_inputs);
+    result = (utxos != NULL) ? CARDANO_SUCCESS : CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_tx_evaluator_evaluate(evaluator, carrier, utxos, &evaluated);
+
+    const char* evaluator_error = cardano_tx_evaluator_get_last_error(evaluator);
+
+    if ((result != CARDANO_SUCCESS) && (evaluator_error[0] != '\0'))
+    {
+      cardano_transaction_set_last_error(state->transaction, evaluator_error);
+      *error_message = cardano_transaction_get_last_error(state->transaction);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = apply_execution_units(redeemers, evaluated);
+  }
+
+  if ((result != CARDANO_SUCCESS) && (*error_message == NULL))
+  {
+    *error_message = "Failed to evaluate the redeemers of the sub transaction.";
+  }
+
+  cardano_redeemer_list_unref(&evaluated);
+  cardano_tx_evaluator_unref(&evaluator);
+  cardano_utxo_list_unref(&utxos);
+  cardano_transaction_unref(&carrier);
+  cardano_protocol_version_unref(&version);
+  cardano_costmdls_unref(&cost_models);
+
+  return result;
+}
+
+/**
+ * \brief Evaluates the redeemers of a built sub transaction and sets its script data hash.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the sub transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in,out] sub_transaction A pointer to the \ref cardano_sub_transaction_t to finalize.
+ * \param[out] error_message A pointer that receives a string describing the failure when the function
+ *                           does not return \ref CARDANO_SUCCESS.
+ *
+ * \return \ref CARDANO_SUCCESS if the sub transaction was finalized, or an appropriate error code
+ *         indicating the failure reason.
+ */
+static cardano_error_t
+finalize_script_data(
+  cardano_builder_state_t*   state,
+  cardano_sub_transaction_t* sub_transaction,
+  const char**               error_message)
+{
+  cardano_error_t result = evaluate_sub_transaction(state, sub_transaction, error_message);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_builder_update_script_data_hash(state, state->transaction);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to compute the script data hash of the sub transaction.";
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+    cardano_transaction_body_unref(&body);
+
+    cardano_blake2b_hash_t* script_data_hash = cardano_transaction_body_get_script_data_hash(body);
+    cardano_blake2b_hash_unref(&script_data_hash);
+
+    cardano_sub_transaction_body_t* sub_body = cardano_sub_transaction_get_body(sub_transaction);
+    cardano_sub_transaction_body_unref(&sub_body);
+
+    result = cardano_sub_transaction_body_set_script_data_hash(sub_body, script_data_hash);
+    cardano_sub_transaction_clear_cbor_cache(sub_transaction);
+  }
+
+  return result;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_build_sub_transaction(
+  cardano_builder_state_t*    state,
+  cardano_sub_transaction_t** sub_transaction,
+  const char**                error_message)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_error_t result = cardano_builder_set_dummy_script_data_hash(state->transaction);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set the script data hash of the sub transaction.";
+
+    return result;
+  }
+
+  cardano_transaction_input_set_t* inputs = NULL;
+
+  result = create_input_set(state->pre_selected_inputs, &inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create the sub transaction inputs.";
+
+    return result;
+  }
+
+  result = set_spend_redeemer_indices(inputs, state->input_to_redeemer_map);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set the spend redeemer indices of the sub transaction.";
+    cardano_transaction_input_set_unref(&inputs);
+
+    return result;
+  }
+
+  result = resolve_deferred_redeemers(state, inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to resolve the deferred redeemers of the sub transaction.";
+    cardano_transaction_input_set_unref(&inputs);
+
+    return result;
+  }
+
+  result = cardano_builder_check_redeemers(state, state->transaction, inputs, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_transaction_input_set_unref(&inputs);
+
+    return result;
+  }
+
+  cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(body);
+  cardano_transaction_output_list_unref(&outputs);
+
+  cardano_sub_transaction_body_t* sub_body = NULL;
+
+  result = cardano_sub_transaction_body_new(inputs, outputs, NULL, &sub_body);
+  cardano_transaction_input_set_unref(&inputs);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create the sub transaction body.";
+
+    return result;
+  }
+
+  result = copy_scalar_fields(body, sub_body);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to copy the sub transaction body fields.";
+    cardano_sub_transaction_body_unref(&sub_body);
+
+    return result;
+  }
+
+  result = copy_object_fields(body, sub_body);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to copy the sub transaction body fields.";
+    cardano_sub_transaction_body_unref(&sub_body);
+
+    return result;
+  }
+
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(state->transaction);
+  cardano_witness_set_unref(&witness_set);
+
+  cardano_auxiliary_data_t* auxiliary_data = cardano_transaction_get_auxiliary_data(state->transaction);
+  cardano_auxiliary_data_unref(&auxiliary_data);
+
+  result = cardano_sub_transaction_new(sub_body, witness_set, auxiliary_data, sub_transaction);
+  cardano_sub_transaction_body_unref(&sub_body);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create the sub transaction.";
+
+    return result;
+  }
+
+  result = finalize_script_data(state, *sub_transaction, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_unref(sub_transaction);
+  }
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/internals/builder_sub_build.h b/vendor/src/transaction_builder/internals/builder_sub_build.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_sub_build.h
@@ -0,0 +1,89 @@
+/**
+ * \file builder_sub_build.h
+ *
+ * \author angel.castillo
+ * \date   Sep 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_SUB_BUILD_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_SUB_BUILD_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/transaction/sub_transaction.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Produces the sub transaction described by the builder state.
+ *
+ * A sub transaction is an intent: it is deliberately unbalanced, pays no fee and posts no
+ * collateral, so this function neither selects inputs nor balances. It projects the transaction
+ * under construction onto a new \ref cardano_sub_transaction_t member by member. The inputs are the
+ * UTXOs explicitly added to the state, and the outputs, mint, certificates, withdrawals, validity
+ * interval, network id, auxiliary data hash, script data hash, reference inputs, voting procedures,
+ * proposal procedures, treasury value, donation, guards, required top level guards, direct deposits
+ * and account balance intervals are taken from the body of the transaction held by the state. The
+ * witness set and the auxiliary data of that transaction are shared with the sub transaction. Fields
+ * that only exist on a top level transaction, such as the fee and the collateral, are left out.
+ *
+ * The index of every spend redeemer is set to the position of its input in the sorted inputs of the
+ * sub transaction, since the sub transaction is never balanced and its inputs are known at this point.
+ *
+ * The deferred redeemers of the state are then resolved. Their callbacks receive the transaction held
+ * by the state, whose inputs are set to the sorted inputs of the sub transaction, and the resolved
+ * inputs in that same order, so they observe the body that is signed and the indices they compute
+ * are local to the sub transaction. A failing callback makes the build fail with its error.
+ *
+ * When the sub transaction carries redeemers, its scripts are evaluated with the native evaluator,
+ * configured from the cost models and protocol version of the state, and the computed execution
+ * units are written into the redeemers. The sub transaction is evaluated at position 0 of a batch
+ * that holds nothing else, so a script whose path or cost depends on its position in the batch may
+ * need different execution units in the final batch. The script data hash is then computed from the
+ * evaluated redeemers. A script that fails phase-2 validation makes the build fail.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction. This parameter must not be NULL.
+ * \param[out] sub_transaction A pointer to a pointer that receives the newly created
+ *                             \ref cardano_sub_transaction_t. The caller must release it with
+ *                             \ref cardano_sub_transaction_unref. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. The string is static or
+ *                           owned by the transaction held by the state. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the sub transaction was created, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_build_sub_transaction(
+  cardano_builder_state_t*    state,
+  cardano_sub_transaction_t** sub_transaction,
+  const char**                error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_SUB_BUILD_H
diff --git a/vendor/src/transaction_builder/internals/builder_sub_transactions.c b/vendor/src/transaction_builder/internals/builder_sub_transactions.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_sub_transactions.c
@@ -0,0 +1,517 @@
+/**
+ * \file builder_sub_transactions.c
+ *
+ * \author angel.castillo
+ * \date   Sep 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_sub_transactions.h"
+
+#include <cardano/common/utxo.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Predicate that checks whether a UTXO is the one a transaction input points to.
+ *
+ * \param[in] item The UTXO to evaluate.
+ * \param[in] context A pointer to the \ref cardano_transaction_input_t being looked up.
+ *
+ * \return true if the UTXO belongs to the transaction input, false otherwise.
+ */
+static bool
+find_utxo(cardano_utxo_t* item, const void* context)
+{
+  const cardano_transaction_input_t* input      = (const cardano_transaction_input_t*)context;
+  cardano_transaction_input_t*       utxo_input = cardano_utxo_get_input(item);
+
+  bool found = cardano_transaction_input_equals(utxo_input, input);
+
+  cardano_transaction_input_unref(&utxo_input);
+
+  return found;
+}
+
+/**
+ * \brief Checks whether a UTXO list resolves a transaction input.
+ *
+ * \param[in] utxos A pointer to the \ref cardano_utxo_list_t to search.
+ * \param[in] input A pointer to the \ref cardano_transaction_input_t to look up.
+ *
+ * \return true if the list holds the UTXO the input points to, false otherwise.
+ */
+static bool
+has_utxo(const cardano_utxo_list_t* utxos, const cardano_transaction_input_t* input)
+{
+  cardano_utxo_t* utxo = cardano_utxo_list_find(utxos, find_utxo, input);
+  cardano_utxo_unref(&utxo);
+
+  return utxo != NULL;
+}
+
+/**
+ * \brief Checks that the id of a sub transaction is not yet in a sub transaction set.
+ *
+ * \param[in] sub_transactions A pointer to the \ref cardano_sub_transaction_set_t of the transaction,
+ *                             or NULL when no sub transaction was added yet.
+ * \param[in] sub_transaction A pointer to the \ref cardano_sub_transaction_t to check.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS.
+ *
+ * \return \ref CARDANO_SUCCESS if the id is not in the set, \ref CARDANO_ERROR_DUPLICATED_KEY if it
+ *         is, or an appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+check_id_is_unique(
+  const cardano_sub_transaction_set_t* sub_transactions,
+  cardano_sub_transaction_t*           sub_transaction,
+  const char**                         error_message)
+{
+  if (sub_transactions == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_blake2b_hash_t* id = cardano_sub_transaction_get_id(sub_transaction);
+
+  if (id == NULL)
+  {
+    *error_message = "Failed to compute the sub transaction id.";
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_sub_transaction_t* existing = NULL;
+  const cardano_error_t      result   = cardano_sub_transaction_set_find_by_id(sub_transactions, id, &existing);
+
+  cardano_sub_transaction_unref(&existing);
+  cardano_blake2b_hash_unref(&id);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *error_message = "Sub transaction is already part of the transaction.";
+
+    return CARDANO_ERROR_DUPLICATED_KEY;
+  }
+
+  if (result != CARDANO_ERROR_ELEMENT_NOT_FOUND)
+  {
+    *error_message = "Failed to look up the sub transaction id.";
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Resolves the spend inputs of a sub transaction.
+ *
+ * Every spend input must be resolved and must not be spent anywhere else in the batch, neither by the
+ * inputs explicitly added to the transaction nor by the sub transactions added before.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction.
+ * \param[in] inputs A pointer to the \ref cardano_transaction_input_set_t with the spend inputs of the
+ *                   sub transaction.
+ * \param[in] resolved_utxos A pointer to the \ref cardano_utxo_list_t that resolves the inputs.
+ * \param[out] resolved On success, this will point to a newly created list with the UTXO of every
+ *                      spend input. The caller is responsible for releasing it with
+ *                      \ref cardano_utxo_list_unref.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS.
+ *
+ * \return \ref CARDANO_SUCCESS if every spend input was resolved, \ref CARDANO_ERROR_DUPLICATED_KEY if
+ *         an input is already spent, \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if an input is not resolved,
+ *         or an appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+resolve_spend_inputs(
+  const cardano_builder_state_t*         state,
+  const cardano_transaction_input_set_t* inputs,
+  const cardano_utxo_list_t*             resolved_utxos,
+  cardano_utxo_list_t**                  resolved,
+  const char**                           error_message)
+{
+  cardano_utxo_list_t* utxos  = NULL;
+  cardano_error_t      result = cardano_utxo_list_new(&utxos);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create the sub transaction inputs list.";
+
+    return result;
+  }
+
+  const size_t length = cardano_transaction_input_set_get_length(inputs);
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_transaction_input_t* input = NULL;
+
+    result = cardano_transaction_input_set_get(inputs, i, &input);
+    cardano_transaction_input_unref(&input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to read the sub transaction inputs.";
+      cardano_utxo_list_unref(&utxos);
+
+      return result;
+    }
+
+    if (has_utxo(state->pre_selected_inputs, input))
+    {
+      *error_message = "Sub transaction spends an input that is already spent by the transaction.";
+      cardano_utxo_list_unref(&utxos);
+
+      return CARDANO_ERROR_DUPLICATED_KEY;
+    }
+
+    if (has_utxo(state->sub_transaction_inputs, input))
+    {
+      *error_message = "Sub transaction spends an input that is already spent by another sub transaction.";
+      cardano_utxo_list_unref(&utxos);
+
+      return CARDANO_ERROR_DUPLICATED_KEY;
+    }
+
+    cardano_utxo_t* utxo = cardano_utxo_list_find(resolved_utxos, find_utxo, input);
+    cardano_utxo_unref(&utxo);
+
+    if (utxo == NULL)
+    {
+      *error_message = "Sub transaction spends an input that is not in the resolved UTXOs.";
+      cardano_utxo_list_unref(&utxos);
+
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    result = cardano_utxo_list_add(utxos, utxo);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to add UTXO to the sub transaction inputs.";
+      cardano_utxo_list_unref(&utxos);
+
+      return result;
+    }
+  }
+
+  *resolved = utxos;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Resolves the reference inputs of a sub transaction.
+ *
+ * Reference inputs are only needed to account for the reference scripts they carry, so the ones that
+ * are not resolved are skipped.
+ *
+ * \param[in] reference_inputs A pointer to the \ref cardano_transaction_input_set_t with the reference
+ *                             inputs of the sub transaction, or NULL when it has none.
+ * \param[in] resolved_utxos A pointer to the \ref cardano_utxo_list_t that resolves the inputs.
+ * \param[out] resolved On success, this will point to a newly created list with the UTXO of every
+ *                      resolved reference input. The caller is responsible for releasing it with
+ *                      \ref cardano_utxo_list_unref.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS.
+ *
+ * \return \ref CARDANO_SUCCESS if the list was created, or an appropriate error code indicating the
+ *         failure reason.
+ */
+static cardano_error_t
+resolve_reference_inputs(
+  const cardano_transaction_input_set_t* reference_inputs,
+  const cardano_utxo_list_t*             resolved_utxos,
+  cardano_utxo_list_t**                  resolved,
+  const char**                           error_message)
+{
+  cardano_utxo_list_t* utxos  = NULL;
+  cardano_error_t      result = cardano_utxo_list_new(&utxos);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create the sub transaction reference inputs list.";
+
+    return result;
+  }
+
+  const size_t length = cardano_transaction_input_set_get_length(reference_inputs);
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_transaction_input_t* input = NULL;
+
+    result = cardano_transaction_input_set_get(reference_inputs, i, &input);
+    cardano_transaction_input_unref(&input);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to read the sub transaction reference inputs.";
+      cardano_utxo_list_unref(&utxos);
+
+      return result;
+    }
+
+    cardano_utxo_t* utxo = cardano_utxo_list_find(resolved_utxos, find_utxo, input);
+    cardano_utxo_unref(&utxo);
+
+    if (utxo != NULL)
+    {
+      result = cardano_utxo_list_add(utxos, utxo);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        *error_message = "Failed to add UTXO to the sub transaction reference inputs.";
+        cardano_utxo_list_unref(&utxos);
+
+        return result;
+      }
+    }
+  }
+
+  *resolved = utxos;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Creates the list that results from appending UTXOs to a list of the state.
+ *
+ * The state lists are replaced instead of being extended in place, so a sub transaction is either
+ * fully recorded or not recorded at all.
+ *
+ * \param[in] current A pointer to the \ref cardano_utxo_list_t held by the state.
+ * \param[in] added A pointer to the \ref cardano_utxo_list_t with the UTXOs to append.
+ * \param[out] updated On success, this will point to the list that replaces \p current, which is
+ *                     \p current itself when there is nothing to append. The caller is responsible for
+ *                     releasing it with \ref cardano_utxo_list_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the list was created, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *         if memory could not be allocated.
+ */
+static cardano_error_t
+append_utxos(
+  cardano_utxo_list_t*       current,
+  const cardano_utxo_list_t* added,
+  cardano_utxo_list_t**      updated)
+{
+  if (cardano_utxo_list_get_length(added) == 0U)
+  {
+    cardano_utxo_list_ref(current);
+    *updated = current;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_utxo_list_t* utxos = cardano_utxo_list_concat(current, added);
+
+  if (utxos == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *updated = utxos;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Adds a sub transaction to the sub transaction set of a transaction body.
+ *
+ * The set is created and stored in the body when the body has none. A set that could not take the
+ * sub transaction is never stored.
+ *
+ * \param[in,out] body A pointer to the \ref cardano_transaction_body_t that carries the set.
+ * \param[in] sub_transaction A pointer to the \ref cardano_sub_transaction_t to add.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS.
+ *
+ * \return \ref CARDANO_SUCCESS if the sub transaction was added, or an appropriate error code
+ *         indicating the failure reason.
+ */
+static cardano_error_t
+insert_sub_transaction(
+  cardano_transaction_body_t* body,
+  cardano_sub_transaction_t*  sub_transaction,
+  const char**                error_message)
+{
+  cardano_sub_transaction_set_t* sub_transactions = cardano_transaction_body_get_sub_transactions(body);
+  const bool                     is_new_set       = (sub_transactions == NULL);
+
+  if (is_new_set)
+  {
+    const cardano_error_t new_result = cardano_sub_transaction_set_new(&sub_transactions);
+
+    if (new_result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create the sub transaction set.";
+
+      return new_result;
+    }
+  }
+
+  cardano_error_t result = cardano_sub_transaction_set_add(sub_transactions, sub_transaction);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add the sub transaction to the set.";
+    cardano_sub_transaction_set_unref(&sub_transactions);
+
+    return result;
+  }
+
+  if (is_new_set)
+  {
+    result = cardano_transaction_body_set_sub_transactions(body, sub_transactions);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set the sub transaction set.";
+    }
+  }
+
+  cardano_sub_transaction_set_unref(&sub_transactions);
+
+  return result;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_add_sub_transaction(
+  cardano_builder_state_t*   state,
+  cardano_sub_transaction_t* sub_transaction,
+  cardano_utxo_list_t*       resolved_utxos,
+  const char**               error_message)
+{
+  if (sub_transaction == NULL)
+  {
+    *error_message = "Sub transaction is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (resolved_utxos == NULL)
+  {
+    *error_message = "Resolved UTXOs list is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_sub_transaction_set_t* sub_transactions = cardano_transaction_body_get_sub_transactions(body);
+  cardano_sub_transaction_set_unref(&sub_transactions);
+
+  cardano_error_t result = check_id_is_unique(sub_transactions, sub_transaction, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_sub_transaction_body_t* sub_body = cardano_sub_transaction_get_body(sub_transaction);
+  cardano_sub_transaction_body_unref(&sub_body);
+
+  cardano_transaction_input_set_t* inputs = cardano_sub_transaction_body_get_inputs(sub_body);
+  cardano_transaction_input_set_unref(&inputs);
+
+  cardano_transaction_input_set_t* reference_inputs = cardano_sub_transaction_body_get_reference_inputs(sub_body);
+  cardano_transaction_input_set_unref(&reference_inputs);
+
+  cardano_utxo_list_t* spent = NULL;
+
+  result = resolve_spend_inputs(state, inputs, resolved_utxos, &spent, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_utxo_list_t* referenced = NULL;
+
+  result = resolve_reference_inputs(reference_inputs, resolved_utxos, &referenced, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&spent);
+
+    return result;
+  }
+
+  cardano_utxo_list_t* updated_inputs = NULL;
+
+  result = append_utxos(state->sub_transaction_inputs, spent, &updated_inputs);
+  cardano_utxo_list_unref(&spent);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to record the sub transaction inputs.";
+    cardano_utxo_list_unref(&referenced);
+
+    return result;
+  }
+
+  cardano_utxo_list_t* updated_reference_inputs = NULL;
+
+  result = append_utxos(state->sub_transaction_reference_inputs, referenced, &updated_reference_inputs);
+  cardano_utxo_list_unref(&referenced);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to record the sub transaction reference inputs.";
+    cardano_utxo_list_unref(&updated_inputs);
+
+    return result;
+  }
+
+  result = insert_sub_transaction(body, sub_transaction, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_utxo_list_unref(&updated_inputs);
+    cardano_utxo_list_unref(&updated_reference_inputs);
+
+    return result;
+  }
+
+  cardano_utxo_list_unref(&state->sub_transaction_inputs);
+  cardano_utxo_list_unref(&state->sub_transaction_reference_inputs);
+
+  state->sub_transaction_inputs           = updated_inputs;
+  state->sub_transaction_reference_inputs = updated_reference_inputs;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_builder_is_input_spent_by_sub_transaction(
+  const cardano_builder_state_t*     state,
+  const cardano_transaction_input_t* input)
+{
+  return has_utxo(state->sub_transaction_inputs, input);
+}
diff --git a/vendor/src/transaction_builder/internals/builder_sub_transactions.h b/vendor/src/transaction_builder/internals/builder_sub_transactions.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_sub_transactions.h
@@ -0,0 +1,101 @@
+/**
+ * \file builder_sub_transactions.h
+ *
+ * \author angel.castillo
+ * \date   Sep 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_SUB_TRANSACTIONS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_SUB_TRANSACTIONS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction_body/transaction_input.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Adds a finished sub transaction to the transaction.
+ *
+ * A sub transaction is built and signed by an independent party, so it is treated as opaque: this
+ * function adds it to the sub transaction set of the transaction body, creating the set when it is
+ * missing, and never modifies it. The set holds a reference to the very same object, which keeps
+ * its original bytes and therefore its id and signatures.
+ *
+ * The inputs spent by a batch must be disjoint and the ids of its sub transactions unique, so the
+ * sub transaction is rejected when its id is already in the set, or when one of its spend inputs is
+ * spent by a sub transaction added before or by an input explicitly added to the transaction.
+ *
+ * \p resolved_utxos must resolve every spend input of the sub transaction, since the value they hold
+ * takes part in the value conservation of the whole batch and the reference scripts they carry are
+ * priced in the fee. It may also resolve its reference inputs, which carry the reference scripts the
+ * fee accounts for. The resolved spend inputs are appended to the state sub transaction inputs and
+ * the resolved reference inputs to the state sub transaction reference inputs. Reference inputs that
+ * are not resolved are skipped, and any other UTXO of the list is ignored.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] sub_transaction A pointer to the \ref cardano_sub_transaction_t to add. The transaction
+ *                            holds a reference to it. This parameter must not be NULL.
+ * \param[in] resolved_utxos A pointer to the \ref cardano_utxo_list_t with the UTXOs behind the inputs
+ *                           of the sub transaction. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the sub transaction was added, \ref CARDANO_ERROR_DUPLICATED_KEY if
+ *         its id is already in the transaction or one of its spend inputs is already spent,
+ *         \ref CARDANO_ERROR_ELEMENT_NOT_FOUND if one of its spend inputs is not resolved by
+ *         \p resolved_utxos, or an appropriate error code indicating the failure reason. The state is
+ *         left unchanged on failure.
+ */
+cardano_error_t
+cardano_builder_add_sub_transaction(
+  cardano_builder_state_t*   state,
+  cardano_sub_transaction_t* sub_transaction,
+  cardano_utxo_list_t*       resolved_utxos,
+  const char**               error_message);
+
+/**
+ * \brief Checks whether an input is spent by a sub transaction of the transaction.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction. This parameter must not be NULL.
+ * \param[in] input A pointer to the \ref cardano_transaction_input_t to look up.
+ *
+ * \return true if one of the sub transactions added to the transaction spends the input, false
+ *         otherwise.
+ */
+bool
+cardano_builder_is_input_spent_by_sub_transaction(
+  const cardano_builder_state_t*     state,
+  const cardano_transaction_input_t* input);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_SUB_TRANSACTIONS_H
diff --git a/vendor/src/transaction_builder/internals/builder_votes.c b/vendor/src/transaction_builder/internals/builder_votes.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_votes.c
@@ -0,0 +1,239 @@
+/**
+ * \file builder_votes.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_votes.h"
+
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/voting_procedures/voting_procedures.h>
+#include <cardano/witness_set/witness_set.h>
+
+#include "../../common/ledger_order.h"
+#include "builder_redeemers.h"
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Computes a deterministic, sortable hash ID for a voter.
+ *
+ * The identifier is the ledger order key of the voter (its role, its credential kind and its
+ * credential hash), so the IDs sort in the order the ledger uses to resolve voting redeemer
+ * indices.
+ *
+ * This ID can be used to establish a canonical sorting order for a voter's redeemer.
+ *
+ * \param[in] voter A pointer to the `cardano_voter_t` object.
+ * \param[out] id On success, this will be populated with a pointer to a newly allocated
+ * `cardano_blake2b_hash_t` object representing the unique ID.
+ *
+ * \return `CARDANO_SUCCESS` if the ID was computed successfully. Returns an appropriate
+ * error code on failure.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned `id` object
+ * and must release it by calling `cardano_blake2b_hash_unref`.
+ */
+static cardano_error_t
+compute_voting_procedures_sortable_id(cardano_voter_t* voter, cardano_blake2b_hash_t** id)
+{
+  if ((id == NULL) || (voter == NULL))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  byte_t          key[CARDANO_LEDGER_ORDER_KEY_SIZE] = { 0 };
+  cardano_error_t result                             = _cardano_ledger_order_voter_key(voter, key);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_blake2b_hash_from_bytes(key, sizeof(key), id);
+  }
+
+  return result;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_vote(
+  cardano_builder_state_t*        state,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_plutus_data_t*          redeemer,
+  const char**                    error_message)
+{
+  if (voter == NULL)
+  {
+    *error_message = "Voter is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (action_id == NULL)
+  {
+    *error_message = "Action ID is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vote == NULL)
+  {
+    *error_message = "Vote is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_voting_procedures_t* votes = cardano_transaction_body_get_voting_procedures(body);
+
+  if (votes == NULL)
+  {
+    cardano_error_t result = cardano_voting_procedures_new(&votes);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create voting procedures.";
+
+      return result;
+    }
+
+    result = cardano_transaction_body_set_voting_procedures(body, votes);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set voting procedures.";
+      cardano_voting_procedures_unref(&votes);
+
+      return result;
+    }
+  }
+
+  cardano_voting_procedures_unref(&votes);
+
+  cardano_error_t result = cardano_voting_procedures_insert(votes, voter, action_id, vote);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to insert vote.";
+
+    return result;
+  }
+
+  cardano_blake2b_hash_t* id_hash = NULL;
+  result                          = compute_voting_procedures_sortable_id(voter, &id_hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create voting procedure ID hash.";
+
+    return result;
+  }
+
+  if (redeemer != NULL)
+  {
+    cardano_witness_set_t* witnesses = cardano_transaction_get_witness_set(state->transaction);
+    cardano_witness_set_unref(&witnesses);
+
+    result = cardano_builder_add_redeemer(witnesses, id_hash, redeemer, CARDANO_REDEEMER_TAG_VOTING, state, error_message);
+    cardano_blake2b_hash_unref(&id_hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to add redeemer.";
+
+      return result;
+    }
+  }
+  else
+  {
+    result = cardano_blake2b_hash_to_redeemer_map_insert(state->votes_to_redeemer_map, id_hash, NULL);
+
+    if ((result != CARDANO_SUCCESS) && (result != CARDANO_ERROR_DUPLICATED_KEY))
+    {
+      cardano_blake2b_hash_unref(&id_hash);
+      *error_message = "Failed to add vote redeemer placeholder.";
+
+      return result;
+    }
+
+    cardano_blake2b_hash_unref(&id_hash);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_vote_with_deferred_redeemer(
+  cardano_builder_state_t*        state,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_deferred_redeemer_fn_t  callback,
+  void*                           user_context,
+  const char**                    error_message)
+{
+  if ((voter == NULL) || (action_id == NULL) || (vote == NULL) || (callback == NULL))
+  {
+    *error_message = "Voter, action id, vote and callback are required";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* placeholder = NULL;
+
+  cardano_error_t result = cardano_builder_create_placeholder_plutus_data(&placeholder);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create the placeholder redeemer.";
+
+    return result;
+  }
+
+  result = cardano_builder_vote(state, voter, action_id, vote, placeholder, error_message);
+
+  cardano_plutus_data_unref(&placeholder);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  result = compute_voting_procedures_sortable_id(voter, &hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to compute the vote sortable id.";
+
+    return result;
+  }
+
+  result = cardano_builder_register_deferred_from_map(state, state->votes_to_redeemer_map, hash, callback, user_context, error_message);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/internals/builder_votes.h b/vendor/src/transaction_builder/internals/builder_votes.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_votes.h
@@ -0,0 +1,116 @@
+/**
+ * \file builder_votes.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_VOTES_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_VOTES_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/governance_action_id.h>
+#include <cardano/error.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+#include <cardano/voting_procedures/voter.h>
+#include <cardano/voting_procedures/voting_procedure.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Records a vote for a governance action in the transaction.
+ *
+ * This function inserts the voting procedure for \p voter and \p action_id into the voting
+ * procedures of the transaction body, creating the collection when it is missing. When
+ * \p redeemer is not NULL it is attached as a voting redeemer keyed by the sortable id of the
+ * voter in the state vote redeemer map. When \p redeemer is NULL the sortable id is still
+ * recorded in the map with a NULL redeemer so redeemer indices can be computed.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] voter A pointer to the \ref cardano_voter_t casting the vote. This parameter must not
+ *                  be NULL.
+ * \param[in] action_id A pointer to the \ref cardano_governance_action_id_t of the governance action
+ *                      being voted on. This parameter must not be NULL.
+ * \param[in] vote A pointer to the \ref cardano_voting_procedure_t with the vote to record. This
+ *                 parameter must not be NULL.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as voting redeemer payload,
+ *                     or NULL when the voter does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the vote was recorded, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_vote(
+  cardano_builder_state_t*        state,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_plutus_data_t*          redeemer,
+  const char**                    error_message);
+
+/**
+ * \brief Records a vote whose redeemer payload is resolved during balancing.
+ *
+ * This function records the vote with an empty placeholder redeemer and registers the callback in
+ * the state deferred redeemer list keyed by the sortable id of the voter. The callback is invoked
+ * while the transaction is balanced to produce the final redeemer payload.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] voter A pointer to the \ref cardano_voter_t casting the vote. This parameter must not
+ *                  be NULL.
+ * \param[in] action_id A pointer to the \ref cardano_governance_action_id_t of the governance action
+ *                      being voted on. This parameter must not be NULL.
+ * \param[in] vote A pointer to the \ref cardano_voting_procedure_t with the vote to record. This
+ *                 parameter must not be NULL.
+ * \param[in] callback The deferred redeemer callback invoked during balancing. This parameter must
+ *                     not be NULL.
+ * \param[in] user_context The opaque pointer forwarded to the callback.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the vote and callback were registered, or an appropriate error
+ *         code indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_vote_with_deferred_redeemer(
+  cardano_builder_state_t*        state,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_deferred_redeemer_fn_t  callback,
+  void*                           user_context,
+  const char**                    error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_VOTES_H
diff --git a/vendor/src/transaction_builder/internals/builder_withdrawals.c b/vendor/src/transaction_builder/internals/builder_withdrawals.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_withdrawals.c
@@ -0,0 +1,279 @@
+/**
+ * \file builder_withdrawals.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_withdrawals.h"
+
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/witness_set/witness_set.h>
+
+#include "../../common/ledger_order.h"
+#include "builder_redeemers.h"
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Computes a deterministic, sortable hash ID for a reward account.
+ *
+ * The identifier is the ledger order key of the account (its network, its credential kind and
+ * its credential hash), so the IDs sort in the order the ledger uses to resolve reward redeemer
+ * indices.
+ *
+ * \param[in] address A pointer to the `cardano_reward_address_t` object.
+ * \param[out] id On success, this will be populated with a pointer to a newly allocated
+ * `cardano_blake2b_hash_t` object representing the unique ID.
+ *
+ * \return `CARDANO_SUCCESS` if the ID was computed successfully, or an appropriate
+ * error code on failure.
+ *
+ * \note The caller is responsible for managing the lifecycle of the returned `id` object
+ * and must release it by calling `cardano_blake2b_hash_unref`.
+ */
+static cardano_error_t
+compute_withdrawal_sortable_id(cardano_reward_address_t* address, cardano_blake2b_hash_t** id)
+{
+  if ((address == NULL) || (id == NULL))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  byte_t          key[CARDANO_LEDGER_ORDER_KEY_SIZE] = { 0 };
+  cardano_error_t result                             = _cardano_ledger_order_reward_address_key(address, key);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_blake2b_hash_from_bytes(key, sizeof(key), id);
+  }
+
+  return result;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_withdraw_rewards(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* address,
+  const int64_t             amount,
+  cardano_plutus_data_t*    redeemer,
+  const char**              error_message)
+{
+  if (address == NULL)
+  {
+    *error_message = "Reward address is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (amount < 0)
+  {
+    *error_message = "Amount must be greater than zero.";
+
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_withdrawal_map_t* withdrawals = cardano_transaction_body_get_withdrawals(body);
+
+  if (withdrawals == NULL)
+  {
+    cardano_error_t result = cardano_withdrawal_map_new(&withdrawals);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create withdrawal map.";
+
+      return result;
+    }
+
+    result = cardano_transaction_body_set_withdrawals(body, withdrawals);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set withdrawal map.";
+      cardano_withdrawal_map_unref(&withdrawals);
+
+      return result;
+    }
+  }
+
+  cardano_withdrawal_map_unref(&withdrawals);
+
+  cardano_error_t result = cardano_withdrawal_map_insert(withdrawals, address, amount);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to insert withdrawal.";
+
+    return result;
+  }
+
+  cardano_credential_t* credential = cardano_reward_address_get_credential(address);
+  cardano_credential_unref(&credential);
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  result = compute_withdrawal_sortable_id(address, &hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to compute the withdrawal sortable id.";
+
+    return result;
+  }
+
+  if (redeemer != NULL)
+  {
+    cardano_witness_set_t* witnesses = cardano_transaction_get_witness_set(state->transaction);
+    cardano_witness_set_unref(&witnesses);
+
+    result = cardano_builder_add_redeemer(witnesses, hash, redeemer, CARDANO_REDEEMER_TAG_REWARD, state, error_message);
+
+    cardano_blake2b_hash_unref(&hash);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to add redeemer.";
+
+      return result;
+    }
+  }
+  else
+  {
+    cardano_credential_type_t cred_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+    result                              = cardano_credential_get_type(credential, &cred_type);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_blake2b_hash_unref(&hash);
+      *error_message = "Failed to add withdrawal.";
+
+      return result;
+    }
+
+    if (cred_type != CARDANO_CREDENTIAL_TYPE_KEY_HASH)
+    {
+      result = cardano_blake2b_hash_to_redeemer_map_insert(state->withdrawals_to_redeemer_map, hash, NULL);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_unref(&hash);
+        *error_message = "Failed to add withdrawal.";
+
+        return result;
+      }
+    }
+
+    cardano_blake2b_hash_unref(&hash);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_withdraw_rewards_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  const int64_t            amount,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if ((reward_address == NULL) || (address_size == 0U))
+  {
+    *error_message = "Reward address is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_reward_address_t* addr   = NULL;
+  cardano_error_t           result = cardano_reward_address_from_bech32(reward_address, address_size, &addr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse reward address.";
+
+    return result;
+  }
+
+  result = cardano_builder_withdraw_rewards(state, addr, amount, redeemer, error_message);
+  cardano_reward_address_unref(&addr);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_withdraw_rewards_with_deferred_redeemer(
+  cardano_builder_state_t*       state,
+  cardano_reward_address_t*      address,
+  const int64_t                  amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  const char**                   error_message)
+{
+  if ((address == NULL) || (callback == NULL))
+  {
+    *error_message = "Reward address and callback are required";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_t* placeholder = NULL;
+
+  cardano_error_t result = cardano_builder_create_placeholder_plutus_data(&placeholder);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create the placeholder redeemer.";
+
+    return result;
+  }
+
+  result = cardano_builder_withdraw_rewards(state, address, amount, placeholder, error_message);
+
+  cardano_plutus_data_unref(&placeholder);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+
+  result = compute_withdrawal_sortable_id(address, &hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to compute the withdrawal sortable id.";
+
+    return result;
+  }
+
+  result = cardano_builder_register_deferred_from_map(state, state->withdrawals_to_redeemer_map, hash, callback, user_context, error_message);
+
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
diff --git a/vendor/src/transaction_builder/internals/builder_withdrawals.h b/vendor/src/transaction_builder/internals/builder_withdrawals.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_withdrawals.h
@@ -0,0 +1,136 @@
+/**
+ * \file builder_withdrawals.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_WITHDRAWALS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_WITHDRAWALS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/address/reward_address.h>
+#include <cardano/error.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/transaction_builder/balancing/deferred_redeemer_list.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Records a reward withdrawal in the transaction.
+ *
+ * This function inserts the withdrawal for \p address with the given amount into the withdrawal map
+ * of the transaction body, creating the map when it is missing. When \p redeemer is not NULL it is
+ * attached as a reward redeemer keyed by the sortable id of the reward account in the state
+ * withdrawal redeemer map. When \p redeemer is NULL and the reward credential is a script credential
+ * the sortable id is still recorded in the map with a NULL redeemer so redeemer indices can be
+ * computed; the ids follow the ledger order of the withdrawals, where script credentials sort before
+ * key hash credentials, so key hash credentials are skipped.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t to withdraw from. This parameter
+ *                    must not be NULL.
+ * \param[in] amount The amount of lovelace to withdraw. It must not be negative.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as reward redeemer payload,
+ *                     or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the withdrawal was recorded, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_withdraw_rewards(
+  cardano_builder_state_t*  state,
+  cardano_reward_address_t* address,
+  int64_t                   amount,
+  cardano_plutus_data_t*    redeemer,
+  const char**              error_message);
+
+/**
+ * \brief Records a reward withdrawal given the reward address as a bech32 string.
+ *
+ * This function parses the reward address and delegates to \ref cardano_builder_withdraw_rewards.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] reward_address A pointer to the bech32 string with the reward address.
+ * \param[in] address_size The size of the reward address string in bytes.
+ * \param[in] amount The amount of lovelace to withdraw. It must not be negative.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t used as reward redeemer payload,
+ *                     or NULL when the credential does not require one.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the withdrawal was recorded, or an appropriate error code
+ *         indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_withdraw_rewards_ex(
+  cardano_builder_state_t* state,
+  const char*              reward_address,
+  size_t                   address_size,
+  int64_t                  amount,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Records a reward withdrawal whose redeemer payload is resolved during balancing.
+ *
+ * This function records the withdrawal with an empty placeholder redeemer and registers the callback
+ * in the state deferred redeemer list keyed by the sortable id of the reward account. The callback
+ * is invoked while the transaction is balanced to produce the final redeemer payload.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] address A pointer to the \ref cardano_reward_address_t to withdraw from. This parameter
+ *                    must not be NULL.
+ * \param[in] amount The amount of lovelace to withdraw. It must not be negative.
+ * \param[in] callback The deferred redeemer callback invoked during balancing. This parameter must
+ *                     not be NULL.
+ * \param[in] user_context The opaque pointer forwarded to the callback.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the withdrawal and callback were registered, or an appropriate
+ *         error code indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_withdraw_rewards_with_deferred_redeemer(
+  cardano_builder_state_t*       state,
+  cardano_reward_address_t*      address,
+  int64_t                        amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  const char**                   error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_WITHDRAWALS_H
diff --git a/vendor/src/transaction_builder/internals/builder_witnesses.c b/vendor/src/transaction_builder/internals/builder_witnesses.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_witnesses.c
@@ -0,0 +1,686 @@
+/**
+ * \file builder_witnesses.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "builder_witnesses.h"
+
+#include <cardano/common/credential.h>
+#include <cardano/common/ex_units.h>
+#include <cardano/common/guard_set.h>
+#include <cardano/transaction_body/required_guards_map.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/witness_set/plutus_data_set.h>
+#include <cardano/witness_set/redeemer_list.h>
+#include <cardano/witness_set/witness_set.h>
+
+/* STATIC DECLARATIONS *******************************************************/
+
+/**
+ * \brief Adds a credential to the guard set of the transaction body.
+ *
+ * This function fetches the guard set of the transaction body, creating it when it is missing, and
+ * appends \p credential to it. Adding a credential that is already present leaves the transaction
+ * unchanged and succeeds.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] credential A pointer to the \ref cardano_credential_t to add. This parameter must not be
+ *                       NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the credential was added or was already present, or an appropriate
+ *         error code indicating the failure reason.
+ */
+static cardano_error_t
+add_guard_credential(
+  cardano_builder_state_t* state,
+  cardano_credential_t*    credential,
+  const char**             error_message)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_guard_set_t* guards = cardano_transaction_body_get_guards(body);
+
+  if (guards == NULL)
+  {
+    cardano_error_t result = cardano_guard_set_new(&guards);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create guards set.";
+
+      return result;
+    }
+
+    result = cardano_transaction_body_set_guards(body, guards);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set guards set.";
+      cardano_guard_set_unref(&guards);
+
+      return result;
+    }
+  }
+
+  cardano_guard_set_unref(&guards);
+
+  const cardano_error_t result = cardano_guard_set_add(guards, credential);
+
+  if ((result != CARDANO_SUCCESS) && (result != CARDANO_ERROR_DUPLICATED_KEY))
+  {
+    *error_message = "Failed to add guard.";
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Copies a required guards map setting the datum required for one credential.
+ *
+ * Required guards maps reject duplicated keys and entries can not be updated in place, so this
+ * function builds a new map with every entry of \p current, kept sorted by credential. The entry of
+ * \p credential gets \p datum, and it is added when the credential is not present.
+ *
+ * \param[in] current A pointer to the \ref cardano_required_guards_map_t to copy, or NULL when there
+ *                    are no required guards yet.
+ * \param[in] credential A pointer to the \ref cardano_credential_t of the entry to set.
+ * \param[in] datum A pointer to the \ref cardano_plutus_data_t stored in the entry, or NULL when the
+ *                  guard takes no datum.
+ * \param[out] updated On success, this will point to the newly created map. The caller is responsible
+ *                     for releasing it with \ref cardano_required_guards_map_unref.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS.
+ *
+ * \return \ref CARDANO_SUCCESS if the map was created, or an appropriate error code indicating the
+ *         failure reason.
+ */
+static cardano_error_t
+copy_with_required_guard(
+  const cardano_required_guards_map_t* current,
+  cardano_credential_t*                credential,
+  cardano_plutus_data_t*               datum,
+  cardano_required_guards_map_t**      updated,
+  const char**                         error_message)
+{
+  cardano_required_guards_map_t* required_guards = NULL;
+  cardano_error_t                result          = cardano_required_guards_map_new(&required_guards);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create required top level guards map.";
+
+    return result;
+  }
+
+  const size_t length   = cardano_required_guards_map_get_length(current);
+  bool         replaced = false;
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_credential_t*  key   = NULL;
+    cardano_plutus_data_t* value = NULL;
+
+    result = cardano_required_guards_map_get_key_value_at(current, i, &key, &value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to read required top level guard.";
+      cardano_required_guards_map_unref(&required_guards);
+
+      return result;
+    }
+
+    if (cardano_credential_equals(key, credential))
+    {
+      result   = cardano_required_guards_map_insert(required_guards, key, datum);
+      replaced = true;
+    }
+    else
+    {
+      result = cardano_required_guards_map_insert(required_guards, key, value);
+    }
+
+    cardano_credential_unref(&key);
+    cardano_plutus_data_unref(&value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to insert required top level guard.";
+      cardano_required_guards_map_unref(&required_guards);
+
+      return result;
+    }
+  }
+
+  if (!replaced)
+  {
+    result = cardano_required_guards_map_insert(required_guards, credential, datum);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to insert required top level guard.";
+      cardano_required_guards_map_unref(&required_guards);
+
+      return result;
+    }
+  }
+
+  *updated = required_guards;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Returns the position of a credential in the guard set of the transaction body.
+ *
+ * The position is the index a guarding redeemer points to: guards keep the order in which they
+ * were added, and key hash guards count towards it. The credential must already be in the guard
+ * set of the body, since the callers add it just before the lookup; if it is not found, the
+ * position of the last guard is returned.
+ *
+ * \param[in] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                  construction. This parameter must not be NULL.
+ * \param[in] credential A pointer to the \ref cardano_credential_t to look up. It must be among the
+ *                       guards of the transaction.
+ *
+ * \return The position of \p credential in the guard set.
+ */
+static size_t
+guard_index(cardano_builder_state_t* state, const cardano_credential_t* credential)
+{
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_guard_set_t* guards = cardano_transaction_body_get_guards(body);
+  cardano_guard_set_unref(&guards);
+
+  const size_t length = cardano_guard_set_get_length(guards);
+  size_t       index  = 0U;
+  bool         found  = false;
+
+  for (size_t i = 0U; (i < length) && !found; ++i)
+  {
+    cardano_credential_t* guard = NULL;
+
+    const cardano_error_t result = cardano_guard_set_get(guards, i, &guard);
+    cardano_credential_unref(&guard);
+
+    found = (result == CARDANO_SUCCESS) && cardano_credential_equals(guard, credential);
+    index = i;
+  }
+
+  return index;
+}
+
+/**
+ * \brief Adds a guarding redeemer to the witness set of the transaction.
+ *
+ * This function creates a redeemer with the guarding tag, the given index and zero execution units,
+ * and appends it to the witness set redeemer list, creating the list when it is missing. The
+ * execution units are computed when the transaction is evaluated.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] index The position of the guard in the guard set.
+ * \param[in] data A pointer to the \ref cardano_plutus_data_t with the redeemer payload. This
+ *                 parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS.
+ *
+ * \return \ref CARDANO_SUCCESS if the redeemer was added, \ref CARDANO_ERROR_DUPLICATED_KEY if the
+ *         guard already has a redeemer, or an appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+add_guarding_redeemer(
+  cardano_builder_state_t* state,
+  const size_t             index,
+  cardano_plutus_data_t*   data,
+  const char**             error_message)
+{
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(state->transaction);
+  cardano_witness_set_unref(&witness_set);
+
+  cardano_redeemer_list_t* redeemers = cardano_witness_set_get_redeemers(witness_set);
+  cardano_error_t          result    = CARDANO_SUCCESS;
+
+  if (redeemers == NULL)
+  {
+    result = cardano_redeemer_list_new(&redeemers);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_witness_set_set_redeemers(witness_set, redeemers);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create redeemer list.";
+      cardano_redeemer_list_unref(&redeemers);
+
+      return result;
+    }
+  }
+
+  cardano_redeemer_list_unref(&redeemers);
+
+  const size_t length = cardano_redeemer_list_get_length(redeemers);
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_redeemer_t* existing = NULL;
+
+    result = cardano_redeemer_list_get(redeemers, i, &existing);
+    cardano_redeemer_unref(&existing);
+
+    if ((result == CARDANO_SUCCESS) && (cardano_redeemer_get_tag(existing) == CARDANO_REDEEMER_TAG_GUARDING) && (cardano_redeemer_get_index(existing) == (uint64_t)index))
+    {
+      *error_message = "The guard already has a redeemer.";
+
+      return CARDANO_ERROR_DUPLICATED_KEY;
+    }
+  }
+
+  cardano_ex_units_t* ex_units = NULL;
+
+  result = cardano_ex_units_new(0U, 0U, &ex_units);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create execution units.";
+
+    return result;
+  }
+
+  cardano_redeemer_t* redeemer = NULL;
+
+  result = cardano_redeemer_new(CARDANO_REDEEMER_TAG_GUARDING, (uint64_t)index, data, ex_units, &redeemer);
+  cardano_ex_units_unref(&ex_units);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create redeemer.";
+
+    return result;
+  }
+
+  result = cardano_redeemer_list_add(redeemers, redeemer);
+  cardano_redeemer_unref(&redeemer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add redeemer.";
+  }
+
+  return result;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_builder_pad_signer_count(
+  cardano_builder_state_t* state,
+  const size_t             count)
+{
+  state->additional_signature_count = count;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_add_signer(
+  cardano_builder_state_t* state,
+  cardano_blake2b_hash_t*  pub_key_hash,
+  const char**             error_message)
+{
+  if (pub_key_hash == NULL)
+  {
+    *error_message = "Public key hash is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_t* credential = NULL;
+  cardano_error_t       result     = cardano_credential_new(pub_key_hash, CARDANO_CREDENTIAL_TYPE_KEY_HASH, &credential);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to create signer credential.";
+
+    return result;
+  }
+
+  result = add_guard_credential(state, credential, error_message);
+  cardano_credential_unref(&credential);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_signer_ex(
+  cardano_builder_state_t* state,
+  const char*              pub_key_hash,
+  size_t                   hash_size,
+  const char**             error_message)
+{
+  if ((pub_key_hash == NULL) || (hash_size == 0U))
+  {
+    *error_message = "Public key hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_blake2b_hash_t* hash   = NULL;
+  cardano_error_t         result = cardano_blake2b_hash_from_hex(pub_key_hash, hash_size, &hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse public key hash.";
+
+    return result;
+  }
+
+  result = cardano_builder_add_signer(state, hash, error_message);
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_guard(
+  cardano_builder_state_t* state,
+  cardano_credential_t*    guard,
+  const char**             error_message)
+{
+  if (guard == NULL)
+  {
+    *error_message = "Guard is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return add_guard_credential(state, guard, error_message);
+}
+
+cardano_error_t
+cardano_builder_add_guard_ex(
+  cardano_builder_state_t*        state,
+  const char*                     hash_hex,
+  size_t                          hash_hex_size,
+  const cardano_credential_type_t type,
+  const char**                    error_message)
+{
+  if ((hash_hex == NULL) || (hash_hex_size == 0U))
+  {
+    *error_message = "Guard hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_t* guard  = NULL;
+  cardano_error_t       result = cardano_credential_from_hash_hex(hash_hex, hash_hex_size, type, &guard);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse guard hash.";
+
+    return result;
+  }
+
+  result = cardano_builder_add_guard(state, guard, error_message);
+  cardano_credential_unref(&guard);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_guard_with_redeemer(
+  cardano_builder_state_t* state,
+  cardano_credential_t*    guard,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message)
+{
+  if (guard == NULL)
+  {
+    *error_message = "Guard is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (redeemer == NULL)
+  {
+    *error_message = "Redeemer is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_type_t type   = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+  cardano_error_t           result = cardano_credential_get_type(guard, &type);
+
+  if ((result == CARDANO_SUCCESS) && (type != CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH))
+  {
+    *error_message = "Only a script hash guard is satisfied by a redeemer.";
+
+    result = CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_guard_credential(state, guard, error_message);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = add_guarding_redeemer(state, guard_index(state, guard), redeemer, error_message);
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_require_top_level_guard(
+  cardano_builder_state_t* state,
+  cardano_credential_t*    credential,
+  cardano_plutus_data_t*   datum,
+  const char**             error_message)
+{
+  if (credential == NULL)
+  {
+    *error_message = "Required top level guard is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body = cardano_transaction_get_body(state->transaction);
+  cardano_transaction_body_unref(&body);
+
+  cardano_required_guards_map_t* current = cardano_transaction_body_get_required_top_level_guards(body);
+  cardano_required_guards_map_unref(&current);
+
+  cardano_required_guards_map_t* updated = NULL;
+  cardano_error_t                result  = copy_with_required_guard(current, credential, datum, &updated, error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_transaction_body_set_required_top_level_guards(body, updated);
+  cardano_required_guards_map_unref(&updated);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to set required top level guards map.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_require_top_level_guard_ex(
+  cardano_builder_state_t*        state,
+  const char*                     hash_hex,
+  size_t                          hash_hex_size,
+  const cardano_credential_type_t type,
+  cardano_plutus_data_t*          datum,
+  const char**                    error_message)
+{
+  if ((hash_hex == NULL) || (hash_hex_size == 0U))
+  {
+    *error_message = "Required top level guard hash is NULL or empty.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_t* credential = NULL;
+  cardano_error_t       result     = cardano_credential_from_hash_hex(hash_hex, hash_hex_size, type, &credential);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to parse required top level guard hash.";
+
+    return result;
+  }
+
+  result = cardano_builder_require_top_level_guard(state, credential, datum, error_message);
+  cardano_credential_unref(&credential);
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_datum(
+  cardano_builder_state_t* state,
+  cardano_plutus_data_t*   datum,
+  const char**             error_message)
+{
+  if (datum == NULL)
+  {
+    *error_message = "Datum is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(state->transaction);
+  cardano_witness_set_unref(&witness_set);
+
+  cardano_plutus_data_set_t* datums = cardano_witness_set_get_plutus_data(witness_set);
+
+  if (datums == NULL)
+  {
+    cardano_error_t result = cardano_plutus_data_set_new(&datums);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to create datums set.";
+
+      return result;
+    }
+
+    result = cardano_witness_set_set_plutus_data(witness_set, datums);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      *error_message = "Failed to set datums set.";
+      cardano_plutus_data_set_unref(&datums);
+
+      return result;
+    }
+  }
+
+  cardano_plutus_data_set_unref(&datums);
+
+  cardano_error_t result = cardano_plutus_data_set_add(datums, datum);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add datum.";
+
+    return result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_builder_add_script(
+  cardano_builder_state_t* state,
+  cardano_script_t*        script,
+  const char**             error_message)
+{
+  if (script == NULL)
+  {
+    *error_message = "Script is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_witness_set_t* witness_set = cardano_transaction_get_witness_set(state->transaction);
+  cardano_witness_set_unref(&witness_set);
+
+  cardano_error_t result = cardano_witness_set_add_script(witness_set, script);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to add script to witness set.";
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_builder_add_sub_transaction_script(
+  cardano_builder_state_t* state,
+  cardano_script_t*        script,
+  const char**             error_message)
+{
+  if (script == NULL)
+  {
+    *error_message = "Script is NULL.";
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_script_language_t language;
+  const cardano_error_t     result = cardano_script_get_language(script, &language);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    *error_message = "Failed to get script language.";
+
+    return result;
+  }
+
+  if ((language != CARDANO_SCRIPT_LANGUAGE_NATIVE) && (language != CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4))
+  {
+    *error_message = "PlutusV1, PlutusV2 and PlutusV3 scripts can not run inside a sub transaction, only native and PlutusV4 scripts are supported.";
+
+    return CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+  }
+
+  return cardano_builder_add_script(state, script, error_message);
+}
diff --git a/vendor/src/transaction_builder/internals/builder_witnesses.h b/vendor/src/transaction_builder/internals/builder_witnesses.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/builder_witnesses.h
@@ -0,0 +1,314 @@
+/**
+ * \file builder_witnesses.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_WITNESSES_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_WITNESSES_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/credential.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/error.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/scripts/script.h>
+
+#include "builder_state.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Sets the number of additional signatures accounted for when computing fees.
+ *
+ * This function stores \p count in the state so that balancing reserves fee room for that many
+ * signatures beyond the ones the builder can infer from the transaction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] count The number of additional signatures to account for.
+ *
+ * \return \ref CARDANO_SUCCESS.
+ */
+cardano_error_t
+cardano_builder_pad_signer_count(
+  cardano_builder_state_t* state,
+  size_t                   count);
+
+/**
+ * \brief Adds a required signer to the transaction.
+ *
+ * This function adds the key hash credential of \p pub_key_hash to the guard set of the transaction
+ * body, creating the set when it is missing. Adding a signer that is already present leaves the
+ * transaction unchanged and succeeds.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] pub_key_hash A pointer to the \ref cardano_blake2b_hash_t with the public key hash of
+ *                         the signer. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the signer was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_add_signer(
+  cardano_builder_state_t* state,
+  cardano_blake2b_hash_t*  pub_key_hash,
+  const char**             error_message);
+
+/**
+ * \brief Adds a required signer given the public key hash as a hexadecimal string.
+ *
+ * This function parses the public key hash and delegates to \ref cardano_builder_add_signer.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] pub_key_hash A pointer to the hexadecimal string with the public key hash.
+ * \param[in] hash_size The size of the public key hash string in bytes.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the signer was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_add_signer_ex(
+  cardano_builder_state_t* state,
+  const char*              pub_key_hash,
+  size_t                   hash_size,
+  const char**             error_message);
+
+/**
+ * \brief Adds a guard credential to the transaction.
+ *
+ * This function adds \p guard to the guard set of the transaction body, creating the set when it is
+ * missing. A key hash guard is a required signer; a script hash guard requires the ledger to run the
+ * script with the guarding redeemer purpose. Adding a guard that is already present leaves the
+ * transaction unchanged and succeeds.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] guard A pointer to the \ref cardano_credential_t to add. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the guard was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_add_guard(
+  cardano_builder_state_t* state,
+  cardano_credential_t*    guard,
+  const char**             error_message);
+
+/**
+ * \brief Adds a guard credential given its hash as a hexadecimal string.
+ *
+ * This function parses the credential hash and delegates to \ref cardano_builder_add_guard.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] hash_hex A pointer to the hexadecimal string with the credential hash.
+ * \param[in] hash_hex_size The size of the credential hash string in bytes.
+ * \param[in] type The type of the credential, key hash or script hash.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the guard was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_add_guard_ex(
+  cardano_builder_state_t*  state,
+  const char*               hash_hex,
+  size_t                    hash_hex_size,
+  cardano_credential_type_t type,
+  const char**              error_message);
+
+/**
+ * \brief Adds a script hash guard credential together with the redeemer that satisfies it.
+ *
+ * This function adds \p guard to the guard set of the transaction body like
+ * \ref cardano_builder_add_guard, and appends a guarding redeemer with \p redeemer as payload and
+ * zero execution units to the witness set. The redeemer index is the position of the guard in the
+ * guard set, which keeps the order in which guards were added and counts key hash guards too.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] guard A pointer to the script hash \ref cardano_credential_t to add. This parameter must
+ *                  not be NULL.
+ * \param[in] redeemer A pointer to the \ref cardano_plutus_data_t handed to the guard script. This
+ *                     parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the guard and its redeemer were added,
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT if \p guard is a key hash credential,
+ *         \ref CARDANO_ERROR_DUPLICATED_KEY if the guard already has a redeemer, or an appropriate
+ *         error code indicating the failure reason.
+ */
+cardano_error_t
+cardano_builder_add_guard_with_redeemer(
+  cardano_builder_state_t* state,
+  cardano_credential_t*    guard,
+  cardano_plutus_data_t*   redeemer,
+  const char**             error_message);
+
+/**
+ * \brief Requires a guard from the top level transaction of the batch.
+ *
+ * This function sets the entry of \p credential in the required top level guards map of the
+ * transaction body, creating the map when it is missing. The top level transaction that carries the
+ * sub transaction must list \p credential among its guards, and \p datum, when present, is handed to
+ * the guard script. Requiring a credential that is already present replaces its datum and keeps its
+ * position in the map.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] credential A pointer to the \ref cardano_credential_t the top level transaction must be
+ *                       guarded by. This parameter must not be NULL.
+ * \param[in] datum A pointer to the \ref cardano_plutus_data_t handed to the guard, or NULL when the
+ *                  guard takes no datum.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the required guard was set, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_require_top_level_guard(
+  cardano_builder_state_t* state,
+  cardano_credential_t*    credential,
+  cardano_plutus_data_t*   datum,
+  const char**             error_message);
+
+/**
+ * \brief Requires a guard from the top level transaction given its hash as a hexadecimal string.
+ *
+ * This function parses the credential hash and delegates to
+ * \ref cardano_builder_require_top_level_guard.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] hash_hex A pointer to the hexadecimal string with the credential hash.
+ * \param[in] hash_hex_size The size of the credential hash string in bytes.
+ * \param[in] type The type of the credential, key hash or script hash.
+ * \param[in] datum A pointer to the \ref cardano_plutus_data_t handed to the guard, or NULL when the
+ *                  guard takes no datum.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the required guard was set, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_require_top_level_guard_ex(
+  cardano_builder_state_t*  state,
+  const char*               hash_hex,
+  size_t                    hash_hex_size,
+  cardano_credential_type_t type,
+  cardano_plutus_data_t*    datum,
+  const char**              error_message);
+
+/**
+ * \brief Adds a datum to the witness set.
+ *
+ * This function appends \p datum to the plutus data set of the witness set, creating the set when it
+ * is missing.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] datum A pointer to the \ref cardano_plutus_data_t to add. This parameter must not be
+ *                  NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the datum was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_add_datum(
+  cardano_builder_state_t* state,
+  cardano_plutus_data_t*   datum,
+  const char**             error_message);
+
+/**
+ * \brief Adds a script to the witness set.
+ *
+ * This function adds \p script to the witness set of the transaction under construction.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the transaction under
+ *                      construction. This parameter must not be NULL.
+ * \param[in] script A pointer to the \ref cardano_script_t to add. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the script was added, or an appropriate error code indicating the
+ *         failure reason.
+ */
+cardano_error_t
+cardano_builder_add_script(
+  cardano_builder_state_t* state,
+  cardano_script_t*        script,
+  const char**             error_message);
+
+/**
+ * \brief Adds a script to the witness set of a sub transaction.
+ *
+ * PlutusV1, PlutusV2 and PlutusV3 scripts can not run inside a sub transaction, so this function only
+ * accepts native and PlutusV4 scripts. They are added through \ref cardano_builder_add_script, and a
+ * script of an earlier Plutus language version is rejected leaving the witness set unchanged.
+ *
+ * \param[in,out] state A pointer to the \ref cardano_builder_state_t tracking the sub transaction
+ *                      under construction. This parameter must not be NULL.
+ * \param[in] script A pointer to the \ref cardano_script_t to add. This parameter must not be NULL.
+ * \param[out] error_message A pointer that receives a static string describing the failure when the
+ *                           function does not return \ref CARDANO_SUCCESS. It is left untouched on
+ *                           success. This parameter must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS if the script was added, \ref CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE if
+ *         the script is a PlutusV1, PlutusV2 or PlutusV3 script, or an appropriate error code indicating
+ *         the failure reason.
+ */
+cardano_error_t
+cardano_builder_add_sub_transaction_script(
+  cardano_builder_state_t* state,
+  cardano_script_t*        script,
+  const char**             error_message);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_BUILDER_WITNESSES_H
diff --git a/vendor/src/transaction_builder/internals/created_output_scripts.c b/vendor/src/transaction_builder/internals/created_output_scripts.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/created_output_scripts.c
@@ -0,0 +1,125 @@
+/**
+ * \file created_output_scripts.c
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "created_output_scripts.h"
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+
+/**
+ * \brief Matches the reference script of one output.
+ * \param[in] output The output, which may be NULL.
+ * \param[in] hash The required hash.
+ * \param[out] script An owned matching script reference.
+ * \return Success, not found, or an allocation error.
+ */
+static cardano_error_t
+find_in_output(cardano_transaction_output_t* output, const cardano_blake2b_hash_t* hash, cardano_script_t** script)
+{
+  cardano_script_t* candidate = cardano_transaction_output_get_script_ref(output);
+  if (candidate == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+  cardano_blake2b_hash_t* candidate_hash = cardano_script_get_hash(candidate);
+  cardano_error_t         result         = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  if (candidate_hash == NULL)
+  {
+    result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+  else if (cardano_blake2b_hash_equals(hash, candidate_hash))
+  {
+    *script = candidate;
+    cardano_script_ref(candidate);
+    result = CARDANO_SUCCESS;
+  }
+  else
+  {
+    /* A different hash leaves the search result as not found. */
+  }
+  cardano_blake2b_hash_unref(&candidate_hash);
+  cardano_script_unref(&candidate);
+  return result;
+}
+
+/**
+ * \brief Searches the reference scripts in an output list.
+ * \param[in] outputs The outputs to search.
+ * \param[in] hash The required hash.
+ * \param[out] script An owned matching script reference.
+ * \return Success, not found, or an allocation/access error.
+ */
+static cardano_error_t
+find_in_outputs(cardano_transaction_output_list_t* outputs, const cardano_blake2b_hash_t* hash, cardano_script_t** script)
+{
+  cardano_error_t result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  for (size_t i = 0U; (result == CARDANO_ERROR_ELEMENT_NOT_FOUND) && (i < cardano_transaction_output_list_get_length(outputs)); ++i)
+  {
+    cardano_transaction_output_t* output = NULL;
+    result                               = cardano_transaction_output_list_get(outputs, i, &output);
+    if (result == CARDANO_SUCCESS)
+    {
+      result = find_in_output(output, hash, script);
+    }
+    cardano_transaction_output_unref(&output);
+  }
+  return result;
+}
+
+cardano_error_t
+cardano_builder_find_created_script(cardano_transaction_t* tx, const cardano_blake2b_hash_t* hash, cardano_script_t** script)
+{
+  if ((tx == NULL) || (hash == NULL) || (script == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  *script                                    = NULL;
+  cardano_transaction_body_t*        body    = cardano_transaction_get_body(tx);
+  cardano_transaction_output_list_t* outputs = cardano_transaction_body_get_outputs(body);
+  cardano_error_t                    result  = find_in_outputs(outputs, hash, script);
+  cardano_transaction_output_list_unref(&outputs);
+
+  if (result == CARDANO_ERROR_ELEMENT_NOT_FOUND)
+  {
+    cardano_transaction_output_t* collateral = cardano_transaction_body_get_collateral_return(body);
+    result                                   = find_in_output(collateral, hash, script);
+    cardano_transaction_output_unref(&collateral);
+  }
+
+  cardano_sub_transaction_set_t* subs = cardano_transaction_body_get_sub_transactions(body);
+  for (size_t i = 0U; (result == CARDANO_ERROR_ELEMENT_NOT_FOUND) && (i < cardano_sub_transaction_set_get_length(subs)); ++i)
+  {
+    cardano_sub_transaction_t* sub = NULL;
+    result                         = cardano_sub_transaction_set_get(subs, i, &sub);
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_sub_transaction_body_t* sub_body = cardano_sub_transaction_get_body(sub);
+      outputs                                  = cardano_sub_transaction_body_get_outputs(sub_body);
+      result                                   = find_in_outputs(outputs, hash, script);
+      cardano_transaction_output_list_unref(&outputs);
+      cardano_sub_transaction_body_unref(&sub_body);
+    }
+    cardano_sub_transaction_unref(&sub);
+  }
+  cardano_sub_transaction_set_unref(&subs);
+  cardano_transaction_body_unref(&body);
+  return result;
+}
diff --git a/vendor/src/transaction_builder/internals/created_output_scripts.h b/vendor/src/transaction_builder/internals/created_output_scripts.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/internals/created_output_scripts.h
@@ -0,0 +1,39 @@
+/**
+ * \file created_output_scripts.h
+ *
+ * \author angel.castillo
+ * \date   Jul 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CARDANO_CREATED_OUTPUT_SCRIPTS_H
+#define CARDANO_CREATED_OUTPUT_SCRIPTS_H
+
+#include <cardano/scripts/script.h>
+#include <cardano/transaction/transaction.h>
+
+/**
+ * \brief Finds a CIP-172 reference script in outputs created by a batch, including collateral return.
+ * \param[in] tx The top-level transaction containing the complete batch.
+ * \param[in] hash The required script hash.
+ * \param[out] script An owned reference, or NULL when the script is not present.
+ * \return CARDANO_SUCCESS, CARDANO_ERROR_ELEMENT_NOT_FOUND, or an allocation/access error.
+ * \note Call only for Dijkstra (protocol version 12 or later).
+ */
+cardano_error_t
+cardano_builder_find_created_script(cardano_transaction_t* tx, const cardano_blake2b_hash_t* hash, cardano_script_t** script);
+
+#endif /* CARDANO_CREATED_OUTPUT_SCRIPTS_H */
diff --git a/vendor/src/transaction_builder/script_data_hash.c b/vendor/src/transaction_builder/script_data_hash.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/script_data_hash.c
@@ -0,0 +1,161 @@
+/**
+ * \file script_data_hash.c
+ *
+ * \author angel.castillo
+ * \date   Nov 12, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/transaction_builder/script_data_hash.h>
+#include <cardano/witness_set/plutus_data_set.h>
+#include <cardano/witness_set/redeemer_list.h>
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_compute_script_data_hash(
+  cardano_costmdls_t*        costmdls,
+  cardano_redeemer_list_t*   redeemers,
+  cardano_plutus_data_set_t* datums,
+  cardano_blake2b_hash_t**   data_hash)
+{
+  if (data_hash == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (costmdls == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  //  These are safe to call, returns 0 if the pointer is NULL
+  const size_t plutus_data_size = cardano_plutus_data_set_get_length(datums);
+  const size_t redeemers_size   = cardano_redeemer_list_get_length(redeemers);
+
+  if ((plutus_data_size == 0U) && (redeemers_size == 0U))
+  {
+    *data_hash = NULL;
+    return result;
+  }
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  if (redeemers_size == 0U)
+  {
+    result = cardano_cbor_writer_write_start_map(writer, 0);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_writer_unref(&writer);
+      return result;
+    }
+
+    result = cardano_plutus_data_set_to_cbor(datums, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_writer_unref(&writer);
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_start_map(writer, 0);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_writer_unref(&writer);
+      return result;
+    }
+  }
+  else
+  {
+    result = cardano_redeemer_list_to_cbor(redeemers, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_writer_unref(&writer);
+      return result;
+    }
+
+    if (plutus_data_size > 0U)
+    {
+      result = cardano_plutus_data_set_to_cbor(datums, writer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_cbor_writer_unref(&writer);
+        return result;
+      }
+    }
+
+    cardano_buffer_t* buffer = NULL;
+    result                   = cardano_costmdls_get_language_views_encoding(costmdls, &buffer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_writer_unref(&writer);
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer));
+
+    cardano_buffer_unref(&buffer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_cbor_writer_unref(&writer);
+      return result;
+    }
+  }
+
+  cardano_buffer_t* preimage_buffer = NULL;
+  result                            = cardano_cbor_writer_encode_in_buffer(writer, &preimage_buffer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  cardano_blake2b_hash_t* hash = NULL;
+  result                       = cardano_blake2b_compute_hash(
+    cardano_buffer_get_data(preimage_buffer),
+    cardano_buffer_get_size(preimage_buffer),
+    CARDANO_BLAKE2B_HASH_SIZE_256,
+    &hash);
+
+  cardano_buffer_unref(&preimage_buffer);
+  cardano_cbor_writer_unref(&writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *data_hash = hash;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/transaction_builder/sub_transaction_builder.c b/vendor/src/transaction_builder/sub_transaction_builder.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/sub_transaction_builder.c
@@ -0,0 +1,1702 @@
+/**
+ * \file sub_transaction_builder.c
+ *
+ * \author angel.castillo
+ * \date   Sep 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/transaction_builder/sub_transaction_builder.h>
+
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "./internals/builder_certs.h"
+#include "./internals/builder_config.h"
+#include "./internals/builder_entities.h"
+#include "./internals/builder_inputs.h"
+#include "./internals/builder_mint.h"
+#include "./internals/builder_outputs.h"
+#include "./internals/builder_proposals.h"
+#include "./internals/builder_state.h"
+#include "./internals/builder_sub_build.h"
+#include "./internals/builder_votes.h"
+#include "./internals/builder_withdrawals.h"
+#include "./internals/builder_witnesses.h"
+
+#include <assert.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Type definition for the Cardano Sub Transaction builder.
+ *
+ * The `cardano_sub_tx_builder_t` type represents an instance of a sub transaction builder for creating
+ * CIP-118 sub transactions. It provides methods for adding inputs, outputs and the other elements a sub
+ * transaction can carry.
+ *
+ * A sub transaction is an intent, so the builder never balances it: the result spends exactly the inputs
+ * and produces exactly the outputs that were added, and it carries no fee and no collateral.
+ */
+typedef struct cardano_sub_tx_builder_t
+{
+    cardano_object_t        base;
+    cardano_error_t         last_error;
+    cardano_builder_state_t state;
+} cardano_sub_tx_builder_t;
+
+/* STATIC DECLARATIONS *******************************************************/
+
+/**
+ * \brief Deallocates a sub_tx_builder object.
+ *
+ * This function is responsible for properly deallocating a sub_tx_builder object (`cardano_sub_tx_builder_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the sub_tx_builder object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_sub_tx_builder_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the sub_tx_builder
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_sub_tx_builder_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_sub_tx_builder_t* builder = (cardano_sub_tx_builder_t*)object;
+
+  cardano_builder_state_release(&builder->state);
+
+  _cardano_free(builder);
+}
+
+/**
+ * \brief Records the outcome of an internal builder operation in the builder.
+ *
+ * This function stores the error code of a failed internal operation as the builder deferred error
+ * and, when the operation reported an error message, copies it into the builder last error message.
+ * A successful outcome leaves the builder untouched.
+ *
+ * \param[in,out] builder A pointer to the \ref cardano_sub_tx_builder_t that receives the outcome. This
+ *                        parameter must not be NULL.
+ * \param[in] result The error code returned by the internal operation.
+ * \param[in] error_message The error message reported by the internal operation, or NULL when the
+ *                          operation did not report one.
+ */
+static void
+track_builder_result(
+  cardano_sub_tx_builder_t* builder,
+  const cardano_error_t     result,
+  const char*               error_message)
+{
+  if (result != CARDANO_SUCCESS)
+  {
+    if (error_message != NULL)
+    {
+      cardano_sub_tx_builder_set_last_error(builder, error_message);
+    }
+
+    builder->last_error = result;
+  }
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_sub_tx_builder_t*
+cardano_sub_tx_builder_new(
+  cardano_protocol_parameters_t* params,
+  const cardano_slot_config_t*   slot_config)
+{
+  if ((params == NULL) || (slot_config == NULL))
+  {
+    return NULL;
+  }
+
+  cardano_sub_tx_builder_t* builder = _cardano_malloc(sizeof(cardano_sub_tx_builder_t));
+
+  if (builder == NULL)
+  {
+    return NULL;
+  }
+
+  builder->base.ref_count     = 1;
+  builder->base.last_error[0] = '\0';
+  builder->base.deallocator   = cardano_sub_tx_builder_deallocate;
+
+  builder->last_error = CARDANO_SUCCESS;
+
+  const cardano_error_t result = cardano_builder_state_init(&builder->state, params, slot_config);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_sub_tx_builder_unref(&builder);
+    return NULL;
+  }
+
+  return builder;
+}
+
+void
+cardano_sub_tx_builder_set_network_id(
+  cardano_sub_tx_builder_t*  builder,
+  const cardano_network_id_t network_id)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_network_id(&builder->state, network_id, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_set_donation(
+  cardano_sub_tx_builder_t* builder,
+  const uint64_t            donation)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_donation(&builder->state, donation, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_set_invalid_after(
+  cardano_sub_tx_builder_t* builder,
+  const uint64_t            slot)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_invalid_after(&builder->state, slot, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_set_invalid_after_ex(
+  cardano_sub_tx_builder_t* builder,
+  const uint64_t            unix_time)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_invalid_after_ex(&builder->state, unix_time, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_set_invalid_before(
+  cardano_sub_tx_builder_t* builder,
+  const uint64_t            slot)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_invalid_before(&builder->state, slot, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_set_invalid_before_ex(
+  cardano_sub_tx_builder_t* builder,
+  const uint64_t            unix_time)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_invalid_before_ex(&builder->state, unix_time, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_input(
+  cardano_sub_tx_builder_t* builder,
+  cardano_utxo_t*           utxo,
+  cardano_plutus_data_t*    redeemer,
+  cardano_plutus_data_t*    datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_input(&builder->state, utxo, redeemer, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_input_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*      builder,
+  cardano_utxo_t*                utxo,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  cardano_plutus_data_t*         datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_input_with_deferred_redeemer(&builder->state, utxo, callback, user_context, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_reference_input(
+  cardano_sub_tx_builder_t* builder,
+  cardano_utxo_t*           utxo)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_reference_input(&builder->state, utxo, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_output(
+  cardano_sub_tx_builder_t*     builder,
+  cardano_transaction_output_t* output)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const cardano_error_t result = cardano_builder_add_output(&builder->state, output);
+
+  track_builder_result(builder, result, NULL);
+}
+
+void
+cardano_sub_tx_builder_send_lovelace(
+  cardano_sub_tx_builder_t* builder,
+  cardano_address_t*        address,
+  const uint64_t            amount)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_send_lovelace(&builder->state, address, amount, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_send_lovelace_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               address,
+  size_t                    address_size,
+  uint64_t                  amount)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_send_lovelace_ex(&builder->state, address, address_size, amount, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_send_value(
+  cardano_sub_tx_builder_t* builder,
+  cardano_address_t*        address,
+  cardano_value_t*          value)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_send_value(&builder->state, address, value, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_send_value_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               address,
+  size_t                    address_size,
+  cardano_value_t*          value)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_send_value_ex(&builder->state, address, address_size, value, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_lock_lovelace(
+  cardano_sub_tx_builder_t* builder,
+  cardano_address_t*        script_address,
+  uint64_t                  amount,
+  cardano_datum_t*          datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_lock_lovelace(&builder->state, script_address, amount, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_lock_lovelace_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               script_address,
+  size_t                    script_address_size,
+  uint64_t                  amount,
+  cardano_datum_t*          datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_lock_lovelace_ex(&builder->state, script_address, script_address_size, amount, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_lock_value(
+  cardano_sub_tx_builder_t* builder,
+  cardano_address_t*        script_address,
+  cardano_value_t*          value,
+  cardano_datum_t*          datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_lock_value(&builder->state, script_address, value, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_lock_value_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               script_address,
+  size_t                    script_address_size,
+  cardano_value_t*          value,
+  cardano_datum_t*          datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_lock_value_ex(&builder->state, script_address, script_address_size, value, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_set_metadata(
+  cardano_sub_tx_builder_t* builder,
+  const uint64_t            tag,
+  cardano_metadatum_t*      metadata)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_metadata(&builder->state, tag, metadata, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_set_metadata_ex(
+  cardano_sub_tx_builder_t* builder,
+  uint64_t                  tag,
+  const char*               metadata_json,
+  const size_t              json_size)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_metadata_ex(&builder->state, tag, metadata_json, json_size, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_mint_token(
+  cardano_sub_tx_builder_t* builder,
+  cardano_blake2b_hash_t*   policy_id,
+  cardano_asset_name_t*     name,
+  const int64_t             amount,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_mint_token(&builder->state, policy_id, name, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_mint_token_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*      builder,
+  cardano_blake2b_hash_t*        policy_id,
+  cardano_asset_name_t*          name,
+  const int64_t                  amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_mint_token_with_deferred_redeemer(&builder->state, policy_id, name, amount, callback, user_context, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_mint_token_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               policy_id_hex,
+  size_t                    policy_id_size,
+  const char*               name_hex,
+  size_t                    name_size,
+  const int64_t             amount,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_mint_token_ex(&builder->state, policy_id_hex, policy_id_size, name_hex, name_size, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_mint_token_with_id(
+  cardano_sub_tx_builder_t* builder,
+  cardano_asset_id_t*       asset_id,
+  const int64_t             amount,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_mint_token_with_id(&builder->state, asset_id, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_mint_token_with_id_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               asset_id_hex,
+  size_t                    hex_size,
+  int64_t                   amount,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_mint_token_with_id_ex(&builder->state, asset_id_hex, hex_size, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_script(
+  cardano_sub_tx_builder_t* builder,
+  cardano_script_t*         script)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_sub_transaction_script(&builder->state, script, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_signer(
+  cardano_sub_tx_builder_t* builder,
+  cardano_blake2b_hash_t*   pub_key_hash)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_signer(&builder->state, pub_key_hash, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_signer_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               pub_key_hash,
+  size_t                    hash_size)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_signer_ex(&builder->state, pub_key_hash, hash_size, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_guard(
+  cardano_sub_tx_builder_t* builder,
+  cardano_credential_t*     guard)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_guard(&builder->state, guard, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_guard_ex(
+  cardano_sub_tx_builder_t*       builder,
+  const char*                     hash_hex,
+  size_t                          hash_hex_size,
+  const cardano_credential_type_t type)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_guard_ex(&builder->state, hash_hex, hash_hex_size, type, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_guard_with_redeemer(
+  cardano_sub_tx_builder_t* builder,
+  cardano_credential_t*     guard,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_guard_with_redeemer(&builder->state, guard, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_datum(
+  cardano_sub_tx_builder_t* builder,
+  cardano_plutus_data_t*    datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_datum(&builder->state, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_require_top_level_guard(
+  cardano_sub_tx_builder_t* builder,
+  cardano_credential_t*     credential,
+  cardano_plutus_data_t*    datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_require_top_level_guard(&builder->state, credential, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_require_top_level_guard_ex(
+  cardano_sub_tx_builder_t*       builder,
+  const char*                     hash_hex,
+  size_t                          hash_hex_size,
+  const cardano_credential_type_t type,
+  cardano_plutus_data_t*          datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_require_top_level_guard_ex(&builder->state, hash_hex, hash_hex_size, type, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_direct_deposit(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* reward_address,
+  const uint64_t            amount)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_direct_deposit(&builder->state, reward_address, amount, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_direct_deposit_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  const uint64_t            amount)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_direct_deposit_ex(&builder->state, reward_address, address_size, amount, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_account_balance_interval(
+  cardano_sub_tx_builder_t*           builder,
+  cardano_reward_address_t*           reward_address,
+  cardano_account_balance_interval_t* interval)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_account_balance_interval(&builder->state, reward_address, interval, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_account_balance_interval_ex(
+  cardano_sub_tx_builder_t*           builder,
+  const char*                         reward_address,
+  size_t                              address_size,
+  cardano_account_balance_interval_t* interval)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_account_balance_interval_ex(&builder->state, reward_address, address_size, interval, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_withdraw_rewards(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* address,
+  const int64_t             amount,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_withdraw_rewards(&builder->state, address, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_withdraw_rewards_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*      builder,
+  cardano_reward_address_t*      address,
+  const int64_t                  amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_withdraw_rewards_with_deferred_redeemer(&builder->state, address, amount, callback, user_context, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_withdraw_rewards_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  const int64_t             amount,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_withdraw_rewards_ex(&builder->state, reward_address, address_size, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_register_reward_address(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_register_reward_address(&builder->state, address, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_register_reward_address_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_register_reward_address_ex(&builder->state, reward_address, address_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_deregister_reward_address(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_deregister_reward_address(&builder->state, address, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_deregister_reward_address_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_deregister_reward_address_ex(&builder->state, reward_address, address_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_delegate_stake(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* address,
+  cardano_blake2b_hash_t*   pool_id,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_delegate_stake(&builder->state, address, pool_id, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_delegate_stake_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  const char*               pool_id,
+  size_t                    pool_id_size,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_delegate_stake_ex(&builder->state, reward_address, address_size, pool_id, pool_id_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_delegate_voting_power(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* address,
+  cardano_drep_t*           drep,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_delegate_voting_power(&builder->state, address, drep, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_delegate_voting_power_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  size_t                    address_size,
+  const char*               drep_id,
+  size_t                    drep_id_size,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_delegate_voting_power_ex(&builder->state, reward_address, address_size, drep_id, drep_id_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_register_drep(
+  cardano_sub_tx_builder_t* builder,
+  cardano_drep_t*           drep,
+  cardano_anchor_t*         anchor,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_register_drep(&builder->state, drep, anchor, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_register_drep_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               drep_id,
+  const size_t              drep_id_size,
+  const char*               metadata_url,
+  const size_t              metadata_url_size,
+  const char*               metadata_hash_hex,
+  const size_t              metadata_hash_hex_size,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_register_drep_ex(&builder->state, drep_id, drep_id_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_update_drep(
+  cardano_sub_tx_builder_t* builder,
+  cardano_drep_t*           drep,
+  cardano_anchor_t*         anchor,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_update_drep(&builder->state, drep, anchor, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_update_drep_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               drep_id,
+  const size_t              drep_id_size,
+  const char*               metadata_url,
+  const size_t              metadata_url_size,
+  const char*               metadata_hash_hex,
+  const size_t              metadata_hash_hex_size,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_update_drep_ex(&builder->state, drep_id, drep_id_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_deregister_drep(
+  cardano_sub_tx_builder_t* builder,
+  cardano_drep_t*           drep,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_deregister_drep(&builder->state, drep, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_deregister_drep_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               drep_id,
+  size_t                    drep_id_size,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_deregister_drep_ex(&builder->state, drep_id, drep_id_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_vote(
+  cardano_sub_tx_builder_t*       builder,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_plutus_data_t*          redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_vote(&builder->state, voter, action_id, vote, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_vote_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*       builder,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_deferred_redeemer_fn_t  callback,
+  void*                           user_context)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_vote_with_deferred_redeemer(&builder->state, voter, action_id, vote, callback, user_context, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_certificate(
+  cardano_sub_tx_builder_t* builder,
+  cardano_certificate_t*    certificate,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_certificate(&builder->state, certificate, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_certificate_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*      builder,
+  cardano_certificate_t*         certificate,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_certificate_with_deferred_redeemer(&builder->state, certificate, callback, user_context, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_proposal(
+  cardano_sub_tx_builder_t*     builder,
+  cardano_proposal_procedure_t* proposal,
+  cardano_plutus_data_t*        redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char*           error_message = NULL;
+  const cardano_error_t result        = cardano_builder_add_proposal(&builder->state, proposal, redeemer, &error_message);
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_add_proposal_with_deferred_redeemer(
+  cardano_sub_tx_builder_t*      builder,
+  cardano_proposal_procedure_t*  proposal,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char*           error_message = NULL;
+  const cardano_error_t result        = cardano_builder_add_proposal_with_deferred_redeemer(&builder->state, proposal, callback, user_context, &error_message);
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_parameter_change(
+  cardano_sub_tx_builder_t*        builder,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_blake2b_hash_t*          policy_hash)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_parameter_change(&builder->state, reward_address, anchor, protocol_param_update, governance_action_id, policy_hash, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_parameter_change_ex(
+  cardano_sub_tx_builder_t*        builder,
+  const char*                      reward_address,
+  const size_t                     reward_address_size,
+  const char*                      metadata_url,
+  const size_t                     metadata_url_size,
+  const char*                      metadata_hash_hex,
+  const size_t                     metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  const size_t                     gov_action_id_size,
+  const char*                      policy_hash_hash_hex,
+  const size_t                     policy_hash_hash_hex_size,
+  cardano_protocol_param_update_t* protocol_param_update)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_parameter_change_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, gov_action_id, gov_action_id_size, policy_hash_hash_hex, policy_hash_hash_hex_size, protocol_param_update, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_hardfork(
+  cardano_sub_tx_builder_t*       builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_protocol_version_t*     version,
+  cardano_governance_action_id_t* governance_action_id)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_hardfork(&builder->state, reward_address, anchor, version, governance_action_id, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_hardfork_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  const size_t              reward_address_size,
+  const char*               metadata_url,
+  const size_t              metadata_url_size,
+  const char*               metadata_hash_hex,
+  const size_t              metadata_hash_hex_size,
+  const char*               gov_action_id,
+  const size_t              gov_action_id_size,
+  const uint64_t            minor_protocol_version,
+  const uint64_t            major_protocol_version)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_hardfork_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, gov_action_id, gov_action_id_size, minor_protocol_version, major_protocol_version, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_treasury_withdrawals(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor,
+  cardano_withdrawal_map_t* withdrawals,
+  cardano_blake2b_hash_t*   policy_hash)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_treasury_withdrawals(&builder->state, reward_address, anchor, withdrawals, policy_hash, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_treasury_withdrawals_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  const size_t              reward_address_size,
+  const char*               metadata_url,
+  const size_t              metadata_url_size,
+  const char*               metadata_hash_hex,
+  const size_t              metadata_hash_hex_size,
+  const char*               policy_hash_hash_hex,
+  const size_t              policy_hash_hash_hex_size,
+  cardano_withdrawal_map_t* withdrawals)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_treasury_withdrawals_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, policy_hash_hash_hex, policy_hash_hash_hex_size, withdrawals, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_no_confidence(
+  cardano_sub_tx_builder_t*       builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_no_confidence(&builder->state, reward_address, anchor, governance_action_id, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_no_confidence_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  const size_t              reward_address_size,
+  const char*               metadata_url,
+  const size_t              metadata_url_size,
+  const char*               metadata_hash_hex,
+  const size_t              metadata_hash_hex_size,
+  const char*               gov_action_id,
+  const size_t              gov_action_id_size)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_no_confidence_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, gov_action_id, gov_action_id_size, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_update_committee(
+  cardano_sub_tx_builder_t*        builder,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  cardano_unit_interval_t*         new_quorum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_update_committee(&builder->state, reward_address, anchor, governance_action_id, members_to_be_removed, members_to_be_added, new_quorum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_update_committee_ex(
+  cardano_sub_tx_builder_t*        builder,
+  const char*                      reward_address,
+  const size_t                     reward_address_size,
+  const char*                      metadata_url,
+  const size_t                     metadata_url_size,
+  const char*                      metadata_hash_hex,
+  const size_t                     metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  const size_t                     gov_action_id_size,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  const double                     new_quorum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_update_committee_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, gov_action_id, gov_action_id_size, members_to_be_removed, members_to_be_added, new_quorum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_new_constitution(
+  cardano_sub_tx_builder_t*       builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id,
+  cardano_constitution_t*         constitution)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_new_constitution(&builder->state, reward_address, anchor, governance_action_id, constitution, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_new_constitution_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  const size_t              reward_address_size,
+  const char*               metadata_url,
+  const size_t              metadata_url_size,
+  const char*               metadata_hash_hex,
+  const size_t              metadata_hash_hex_size,
+  const char*               gov_action_id,
+  const size_t              gov_action_id_size,
+  cardano_constitution_t*   constitution)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_new_constitution_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, gov_action_id, gov_action_id_size, constitution, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_info(
+  cardano_sub_tx_builder_t* builder,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_info(&builder->state, reward_address, anchor, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_sub_tx_builder_propose_info_ex(
+  cardano_sub_tx_builder_t* builder,
+  const char*               reward_address,
+  const size_t              reward_address_size,
+  const char*               metadata_url,
+  const size_t              metadata_url_size,
+  const char*               metadata_hash_hex,
+  const size_t              metadata_hash_hex_size)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_info_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+cardano_error_t
+cardano_sub_tx_builder_build(
+  cardano_sub_tx_builder_t*   builder,
+  cardano_sub_transaction_t** sub_transaction)
+{
+  if (builder == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (sub_transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (builder->last_error != CARDANO_SUCCESS)
+  {
+    return builder->last_error;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_build_sub_transaction(&builder->state, sub_transaction, &error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    track_builder_result(builder, result, error_message);
+
+    return result;
+  }
+
+  builder->last_error = CARDANO_ERROR_ILLEGAL_STATE;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_sub_tx_builder_unref(cardano_sub_tx_builder_t** sub_tx_builder)
+{
+  if ((sub_tx_builder == NULL) || (*sub_tx_builder == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*sub_tx_builder)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *sub_tx_builder = NULL;
+    return;
+  }
+}
+
+void
+cardano_sub_tx_builder_ref(cardano_sub_tx_builder_t* sub_tx_builder)
+{
+  if (sub_tx_builder == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&sub_tx_builder->base);
+}
+
+size_t
+cardano_sub_tx_builder_refcount(const cardano_sub_tx_builder_t* sub_tx_builder)
+{
+  if (sub_tx_builder == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&sub_tx_builder->base);
+}
+
+void
+cardano_sub_tx_builder_set_last_error(cardano_sub_tx_builder_t* sub_tx_builder, const char* message)
+{
+  cardano_object_set_last_error(&sub_tx_builder->base, message);
+}
+
+const char*
+cardano_sub_tx_builder_get_last_error(const cardano_sub_tx_builder_t* sub_tx_builder)
+{
+  return cardano_object_get_last_error(&sub_tx_builder->base);
+}
diff --git a/vendor/src/transaction_builder/transaction_builder.c b/vendor/src/transaction_builder/transaction_builder.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/transaction_builder/transaction_builder.c
@@ -0,0 +1,1965 @@
+/**
+ * \file transaction_builder.c
+ *
+ * \author angel.castillo
+ * \date   Nov 06, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/transaction_builder/transaction_builder.h>
+
+#include <cardano/object.h>
+
+#include "../allocators.h"
+#include "./internals/builder_build.h"
+#include "./internals/builder_certs.h"
+#include "./internals/builder_config.h"
+#include "./internals/builder_entities.h"
+#include "./internals/builder_inputs.h"
+#include "./internals/builder_mint.h"
+#include "./internals/builder_outputs.h"
+#include "./internals/builder_proposals.h"
+#include "./internals/builder_redeemers.h"
+#include "./internals/builder_state.h"
+#include "./internals/builder_sub_transactions.h"
+#include "./internals/builder_votes.h"
+#include "./internals/builder_withdrawals.h"
+#include "./internals/builder_witnesses.h"
+#include "balancing/internals/unique_signers.h"
+
+#include <assert.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Type definition for the Cardano Transaction builder.
+ *
+ * The `cardano_tx_builder_t` type represents an instance of a transaction builder for creating
+ * and managing Cardano transactions. It provides methods for adding inputs and outputs, setting
+ * fees, and ensuring that the transaction is balanced according to protocol parameters.
+ *
+ * A transaction builder simplifies the creation of complex transactions by allowing the incremental
+ * addition of transaction elements, handling necessary computations such as fee calculations and
+ * change outputs, and enforcing protocol compliance.
+ */
+typedef struct cardano_tx_builder_t
+{
+    cardano_object_t        base;
+    cardano_error_t         last_error;
+    cardano_builder_state_t state;
+} cardano_tx_builder_t;
+
+/* STATIC DECLARATIONS *******************************************************/
+
+/**
+ * \brief Deallocates a tx_builder object.
+ *
+ * This function is responsible for properly deallocating a tx_builder object (`cardano_tx_builder_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the tx_builder object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_tx_builder_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the tx_builder
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_tx_builder_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_tx_builder_t* builder = (cardano_tx_builder_t*)object;
+
+  cardano_builder_state_release(&builder->state);
+
+  _cardano_free(builder);
+}
+
+/**
+ * \brief Records the outcome of an internal builder operation in the builder.
+ *
+ * This function stores the error code of a failed internal operation as the builder deferred error
+ * and, when the operation reported an error message, copies it into the builder last error message.
+ * A successful outcome leaves the builder untouched.
+ *
+ * \param[in,out] builder A pointer to the \ref cardano_tx_builder_t that receives the outcome. This
+ *                        parameter must not be NULL.
+ * \param[in] result The error code returned by the internal operation.
+ * \param[in] error_message The error message reported by the internal operation, or NULL when the
+ *                          operation did not report one.
+ */
+static void
+track_builder_result(
+  cardano_tx_builder_t* builder,
+  const cardano_error_t result,
+  const char*           error_message)
+{
+  if (result != CARDANO_SUCCESS)
+  {
+    if (error_message != NULL)
+    {
+      cardano_tx_builder_set_last_error(builder, error_message);
+    }
+
+    builder->last_error = result;
+  }
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_tx_builder_t*
+cardano_tx_builder_new(
+  cardano_protocol_parameters_t* params,
+  const cardano_slot_config_t*   slot_config)
+{
+  if ((params == NULL) || (slot_config == NULL))
+  {
+    return NULL;
+  }
+
+  cardano_tx_builder_t* builder = _cardano_malloc(sizeof(cardano_tx_builder_t));
+
+  if (builder == NULL)
+  {
+    return NULL;
+  }
+
+  builder->base.ref_count     = 1;
+  builder->base.last_error[0] = '\0';
+  builder->base.deallocator   = cardano_tx_builder_deallocate;
+
+  builder->last_error = CARDANO_SUCCESS;
+
+  const cardano_error_t result = cardano_builder_state_init(&builder->state, params, slot_config);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_tx_builder_unref(&builder);
+    return NULL;
+  }
+
+  return builder;
+}
+
+void
+cardano_tx_builder_set_coin_selector(
+  cardano_tx_builder_t*    builder,
+  cardano_coin_selector_t* coin_selector)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_coin_selector(&builder->state, coin_selector, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_tx_evaluator(
+  cardano_tx_builder_t*   builder,
+  cardano_tx_evaluator_t* tx_evaluator)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_tx_evaluator(&builder->state, tx_evaluator, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_network_id(
+  cardano_tx_builder_t*      builder,
+  const cardano_network_id_t network_id)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_network_id(&builder->state, network_id, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_change_address(
+  cardano_tx_builder_t* builder,
+  cardano_address_t*    change_address)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_change_address(&builder->state, change_address, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_change_address_ex(
+  cardano_tx_builder_t* builder,
+  const char*           change_address,
+  const size_t          address_size)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_change_address_ex(&builder->state, change_address, address_size, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_collateral_change_address(
+  cardano_tx_builder_t* builder,
+  cardano_address_t*    collateral_change_address)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_collateral_change_address(&builder->state, collateral_change_address, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_collateral_change_address_ex(
+  cardano_tx_builder_t* builder,
+  const char*           collateral_change_address,
+  const size_t          address_size)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_collateral_change_address_ex(&builder->state, collateral_change_address, address_size, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_minimum_fee(
+  cardano_tx_builder_t* builder,
+  const uint64_t        minimum_fee)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_minimum_fee(&builder->state, minimum_fee, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_donation(
+  cardano_tx_builder_t* builder,
+  const uint64_t        donation)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_donation(&builder->state, donation, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_current_treasury_value(
+  cardano_tx_builder_t* builder,
+  const uint64_t        current_treasury_value)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_current_treasury_value(&builder->state, current_treasury_value, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_utxos(
+  cardano_tx_builder_t* builder,
+  cardano_utxo_list_t*  utxos)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_utxos(&builder->state, utxos, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_collateral_utxos(
+  cardano_tx_builder_t* builder,
+  cardano_utxo_list_t*  utxos)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_collateral_utxos(&builder->state, utxos, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_invalid_after(
+  cardano_tx_builder_t* builder,
+  const uint64_t        slot)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_invalid_after(&builder->state, slot, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_invalid_after_ex(
+  cardano_tx_builder_t* builder,
+  const uint64_t        unix_time)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_invalid_after_ex(&builder->state, unix_time, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_invalid_before(
+  cardano_tx_builder_t* builder,
+  const uint64_t        slot)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_invalid_before(&builder->state, slot, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_invalid_before_ex(
+  cardano_tx_builder_t* builder,
+  const uint64_t        unix_time)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_invalid_before_ex(&builder->state, unix_time, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_reference_input(
+  cardano_tx_builder_t* builder,
+  cardano_utxo_t*       utxo)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_reference_input(&builder->state, utxo, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_send_lovelace(
+  cardano_tx_builder_t* builder,
+  cardano_address_t*    address,
+  const uint64_t        amount)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_send_lovelace(&builder->state, address, amount, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_send_lovelace_ex(
+  cardano_tx_builder_t* builder,
+  const char*           address,
+  size_t                address_size,
+  uint64_t              amount)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_send_lovelace_ex(&builder->state, address, address_size, amount, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_send_value(
+  cardano_tx_builder_t* builder,
+  cardano_address_t*    address,
+  cardano_value_t*      value)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_send_value(&builder->state, address, value, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_send_value_ex(
+  cardano_tx_builder_t* builder,
+  const char*           address,
+  size_t                address_size,
+  cardano_value_t*      value)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_send_value_ex(&builder->state, address, address_size, value, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_lock_lovelace(
+  cardano_tx_builder_t* builder,
+  cardano_address_t*    script_address,
+  const uint64_t        amount,
+  cardano_datum_t*      datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_lock_lovelace(&builder->state, script_address, amount, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_lock_lovelace_ex(
+  cardano_tx_builder_t* builder,
+  const char*           script_address,
+  size_t                script_address_size,
+  uint64_t              amount,
+  cardano_datum_t*      datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_lock_lovelace_ex(&builder->state, script_address, script_address_size, amount, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_lock_value(
+  cardano_tx_builder_t* builder,
+  cardano_address_t*    script_address,
+  cardano_value_t*      value,
+  cardano_datum_t*      datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_lock_value(&builder->state, script_address, value, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_lock_value_ex(
+  cardano_tx_builder_t* builder,
+  const char*           script_address,
+  size_t                script_address_size,
+  cardano_value_t*      value,
+  cardano_datum_t*      datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_lock_value_ex(&builder->state, script_address, script_address_size, value, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_input(
+  cardano_tx_builder_t*  builder,
+  cardano_utxo_t*        utxo,
+  cardano_plutus_data_t* redeemer,
+  cardano_plutus_data_t* datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_input(&builder->state, utxo, redeemer, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_output(
+  cardano_tx_builder_t*         builder,
+  cardano_transaction_output_t* output)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const cardano_error_t result = cardano_builder_add_output(&builder->state, output);
+
+  track_builder_result(builder, result, NULL);
+}
+
+void
+cardano_tx_builder_set_metadata(
+  cardano_tx_builder_t* builder,
+  const uint64_t        tag,
+  cardano_metadatum_t*  metadata)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_metadata(&builder->state, tag, metadata, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_set_metadata_ex(
+  cardano_tx_builder_t* builder,
+  uint64_t              tag,
+  const char*           metadata_json,
+  const size_t          json_size)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_set_metadata_ex(&builder->state, tag, metadata_json, json_size, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_mint_token(
+  cardano_tx_builder_t*   builder,
+  cardano_blake2b_hash_t* policy_id,
+  cardano_asset_name_t*   name,
+  const int64_t           amount,
+  cardano_plutus_data_t*  redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_mint_token(&builder->state, policy_id, name, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_mint_token_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            policy_id_hex,
+  size_t                 policy_id_size,
+  const char*            name_hex,
+  size_t                 name_size,
+  const int64_t          amount,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_mint_token_ex(&builder->state, policy_id_hex, policy_id_size, name_hex, name_size, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_mint_token_with_id(
+  cardano_tx_builder_t*  builder,
+  cardano_asset_id_t*    asset_id,
+  const int64_t          amount,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_mint_token_with_id(&builder->state, asset_id, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_mint_token_with_id_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            asset_id_hex,
+  size_t                 hex_size,
+  int64_t                amount,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_mint_token_with_id_ex(&builder->state, asset_id_hex, hex_size, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_pad_signer_count(
+  cardano_tx_builder_t* builder,
+  const size_t          count)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const cardano_error_t result = cardano_builder_pad_signer_count(&builder->state, count);
+
+  track_builder_result(builder, result, NULL);
+}
+
+void
+cardano_tx_builder_add_signer(
+  cardano_tx_builder_t*   builder,
+  cardano_blake2b_hash_t* pub_key_hash)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_signer(&builder->state, pub_key_hash, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_signer_ex(
+  cardano_tx_builder_t* builder,
+  const char*           pub_key_hash,
+  size_t                hash_size)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_signer_ex(&builder->state, pub_key_hash, hash_size, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_guard(
+  cardano_tx_builder_t* builder,
+  cardano_credential_t* guard)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_guard(&builder->state, guard, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_guard_ex(
+  cardano_tx_builder_t*           builder,
+  const char*                     hash_hex,
+  size_t                          hash_hex_size,
+  const cardano_credential_type_t type)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_guard_ex(&builder->state, hash_hex, hash_hex_size, type, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_guard_with_redeemer(
+  cardano_tx_builder_t*  builder,
+  cardano_credential_t*  guard,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_guard_with_redeemer(&builder->state, guard, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_datum(
+  cardano_tx_builder_t*  builder,
+  cardano_plutus_data_t* datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_datum(&builder->state, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_withdraw_rewards(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* address,
+  const int64_t             amount,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_withdraw_rewards(&builder->state, address, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_withdraw_rewards_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            reward_address,
+  size_t                 address_size,
+  const int64_t          amount,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_withdraw_rewards_ex(&builder->state, reward_address, address_size, amount, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_direct_deposit(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* reward_address,
+  const uint64_t            amount)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_direct_deposit(&builder->state, reward_address, amount, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_direct_deposit_ex(
+  cardano_tx_builder_t* builder,
+  const char*           reward_address,
+  size_t                address_size,
+  const uint64_t        amount)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_direct_deposit_ex(&builder->state, reward_address, address_size, amount, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_account_balance_interval(
+  cardano_tx_builder_t*               builder,
+  cardano_reward_address_t*           reward_address,
+  cardano_account_balance_interval_t* interval)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_account_balance_interval(&builder->state, reward_address, interval, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_account_balance_interval_ex(
+  cardano_tx_builder_t*               builder,
+  const char*                         reward_address,
+  size_t                              address_size,
+  cardano_account_balance_interval_t* interval)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_account_balance_interval_ex(&builder->state, reward_address, address_size, interval, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_starting_account_balance_interval(
+  cardano_tx_builder_t*               builder,
+  cardano_reward_address_t*           reward_address,
+  cardano_account_balance_interval_t* interval)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_starting_account_balance_interval(&builder->state, reward_address, interval, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_starting_account_balance_interval_ex(
+  cardano_tx_builder_t*               builder,
+  const char*                         reward_address,
+  size_t                              address_size,
+  cardano_account_balance_interval_t* interval)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_starting_account_balance_interval_ex(&builder->state, reward_address, address_size, interval, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_sub_transaction(
+  cardano_tx_builder_t*      builder,
+  cardano_sub_transaction_t* sub_transaction,
+  cardano_utxo_list_t*       resolved_utxos)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_sub_transaction(&builder->state, sub_transaction, resolved_utxos, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_register_reward_address(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_register_reward_address(&builder->state, address, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_register_reward_address_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            reward_address,
+  size_t                 address_size,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_register_reward_address_ex(&builder->state, reward_address, address_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_deregister_reward_address(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* address,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_deregister_reward_address(&builder->state, address, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_deregister_reward_address_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            reward_address,
+  size_t                 address_size,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_deregister_reward_address_ex(&builder->state, reward_address, address_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_delegate_stake(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* address,
+  cardano_blake2b_hash_t*   pool_id,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_delegate_stake(&builder->state, address, pool_id, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_delegate_stake_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            reward_address,
+  size_t                 address_size,
+  const char*            pool_id,
+  size_t                 pool_id_size,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_delegate_stake_ex(&builder->state, reward_address, address_size, pool_id, pool_id_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_delegate_voting_power(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* address,
+  cardano_drep_t*           drep,
+  cardano_plutus_data_t*    redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_delegate_voting_power(&builder->state, address, drep, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_delegate_voting_power_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            reward_address,
+  size_t                 address_size,
+  const char*            drep_id,
+  size_t                 drep_id_size,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_delegate_voting_power_ex(&builder->state, reward_address, address_size, drep_id, drep_id_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_register_drep(
+  cardano_tx_builder_t*  builder,
+  cardano_drep_t*        drep,
+  cardano_anchor_t*      anchor,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_register_drep(&builder->state, drep, anchor, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_register_drep_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            drep_id,
+  const size_t           drep_id_size,
+  const char*            metadata_url,
+  const size_t           metadata_url_size,
+  const char*            metadata_hash_hex,
+  const size_t           metadata_hash_hex_size,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_register_drep_ex(&builder->state, drep_id, drep_id_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_update_drep(
+  cardano_tx_builder_t*  builder,
+  cardano_drep_t*        drep,
+  cardano_anchor_t*      anchor,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_update_drep(&builder->state, drep, anchor, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_update_drep_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            drep_id,
+  const size_t           drep_id_size,
+  const char*            metadata_url,
+  const size_t           metadata_url_size,
+  const char*            metadata_hash_hex,
+  const size_t           metadata_hash_hex_size,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_update_drep_ex(&builder->state, drep_id, drep_id_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_deregister_drep(
+  cardano_tx_builder_t*  builder,
+  cardano_drep_t*        drep,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_deregister_drep(&builder->state, drep, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_deregister_drep_ex(
+  cardano_tx_builder_t*  builder,
+  const char*            drep_id,
+  size_t                 drep_id_size,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_deregister_drep_ex(&builder->state, drep_id, drep_id_size, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_vote(
+  cardano_tx_builder_t*           builder,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_plutus_data_t*          redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_vote(&builder->state, voter, action_id, vote, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_certificate(
+  cardano_tx_builder_t*  builder,
+  cardano_certificate_t* certificate,
+  cardano_plutus_data_t* redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_certificate(&builder->state, certificate, redeemer, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_script(
+  cardano_tx_builder_t* builder,
+  cardano_script_t*     script)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_script(&builder->state, script, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_proposal(
+  cardano_tx_builder_t*         builder,
+  cardano_proposal_procedure_t* proposal,
+  cardano_plutus_data_t*        redeemer)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char*           error_message = NULL;
+  const cardano_error_t result        = cardano_builder_add_proposal(&builder->state, proposal, redeemer, &error_message);
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_proposal_with_deferred_redeemer(
+  cardano_tx_builder_t*          builder,
+  cardano_proposal_procedure_t*  proposal,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char*           error_message = NULL;
+  const cardano_error_t result        = cardano_builder_add_proposal_with_deferred_redeemer(&builder->state, proposal, callback, user_context, &error_message);
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_parameter_change(
+  cardano_tx_builder_t*            builder,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_protocol_param_update_t* protocol_param_update,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_blake2b_hash_t*          policy_hash)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_parameter_change(&builder->state, reward_address, anchor, protocol_param_update, governance_action_id, policy_hash, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_parameter_change_ex(
+  cardano_tx_builder_t*            builder,
+  const char*                      reward_address,
+  const size_t                     reward_address_size,
+  const char*                      metadata_url,
+  const size_t                     metadata_url_size,
+  const char*                      metadata_hash_hex,
+  const size_t                     metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  const size_t                     gov_action_id_size,
+  const char*                      policy_hash_hash_hex,
+  const size_t                     policy_hash_hash_hex_size,
+  cardano_protocol_param_update_t* protocol_param_update)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_parameter_change_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, gov_action_id, gov_action_id_size, policy_hash_hash_hex, policy_hash_hash_hex_size, protocol_param_update, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_hardfork(
+  cardano_tx_builder_t*           builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_protocol_version_t*     version,
+  cardano_governance_action_id_t* governance_action_id)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_hardfork(&builder->state, reward_address, anchor, version, governance_action_id, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_hardfork_ex(
+  cardano_tx_builder_t* builder,
+  const char*           reward_address,
+  const size_t          reward_address_size,
+  const char*           metadata_url,
+  const size_t          metadata_url_size,
+  const char*           metadata_hash_hex,
+  const size_t          metadata_hash_hex_size,
+  const char*           gov_action_id,
+  const size_t          gov_action_id_size,
+  const uint64_t        minor_protocol_version,
+  const uint64_t        major_protocol_version)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_hardfork_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, gov_action_id, gov_action_id_size, minor_protocol_version, major_protocol_version, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_treasury_withdrawals(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor,
+  cardano_withdrawal_map_t* withdrawals,
+  cardano_blake2b_hash_t*   policy_hash)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_treasury_withdrawals(&builder->state, reward_address, anchor, withdrawals, policy_hash, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_treasury_withdrawals_ex(
+  cardano_tx_builder_t*     builder,
+  const char*               reward_address,
+  const size_t              reward_address_size,
+  const char*               metadata_url,
+  const size_t              metadata_url_size,
+  const char*               metadata_hash_hex,
+  const size_t              metadata_hash_hex_size,
+  const char*               policy_hash_hash_hex,
+  const size_t              policy_hash_hash_hex_size,
+  cardano_withdrawal_map_t* withdrawals)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_treasury_withdrawals_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, policy_hash_hash_hex, policy_hash_hash_hex_size, withdrawals, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_no_confidence(
+  cardano_tx_builder_t*           builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_no_confidence(&builder->state, reward_address, anchor, governance_action_id, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_no_confidence_ex(
+  cardano_tx_builder_t* builder,
+  const char*           reward_address,
+  const size_t          reward_address_size,
+  const char*           metadata_url,
+  const size_t          metadata_url_size,
+  const char*           metadata_hash_hex,
+  const size_t          metadata_hash_hex_size,
+  const char*           gov_action_id,
+  const size_t          gov_action_id_size)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_no_confidence_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, gov_action_id, gov_action_id_size, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_update_committee(
+  cardano_tx_builder_t*            builder,
+  cardano_reward_address_t*        reward_address,
+  cardano_anchor_t*                anchor,
+  cardano_governance_action_id_t*  governance_action_id,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  cardano_unit_interval_t*         new_quorum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_update_committee(&builder->state, reward_address, anchor, governance_action_id, members_to_be_removed, members_to_be_added, new_quorum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_update_committee_ex(
+  cardano_tx_builder_t*            builder,
+  const char*                      reward_address,
+  const size_t                     reward_address_size,
+  const char*                      metadata_url,
+  const size_t                     metadata_url_size,
+  const char*                      metadata_hash_hex,
+  const size_t                     metadata_hash_hex_size,
+  const char*                      gov_action_id,
+  const size_t                     gov_action_id_size,
+  cardano_credential_set_t*        members_to_be_removed,
+  cardano_committee_members_map_t* members_to_be_added,
+  const double                     new_quorum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_update_committee_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, gov_action_id, gov_action_id_size, members_to_be_removed, members_to_be_added, new_quorum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_new_constitution(
+  cardano_tx_builder_t*           builder,
+  cardano_reward_address_t*       reward_address,
+  cardano_anchor_t*               anchor,
+  cardano_governance_action_id_t* governance_action_id,
+  cardano_constitution_t*         constitution)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_new_constitution(&builder->state, reward_address, anchor, governance_action_id, constitution, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_new_constitution_ex(
+  cardano_tx_builder_t*   builder,
+  const char*             reward_address,
+  const size_t            reward_address_size,
+  const char*             metadata_url,
+  const size_t            metadata_url_size,
+  const char*             metadata_hash_hex,
+  const size_t            metadata_hash_hex_size,
+  const char*             gov_action_id,
+  const size_t            gov_action_id_size,
+  cardano_constitution_t* constitution)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_new_constitution_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, gov_action_id, gov_action_id_size, constitution, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_info(
+  cardano_tx_builder_t*     builder,
+  cardano_reward_address_t* reward_address,
+  cardano_anchor_t*         anchor)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_info(&builder->state, reward_address, anchor, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_propose_info_ex(
+  cardano_tx_builder_t* builder,
+  const char*           reward_address,
+  const size_t          reward_address_size,
+  const char*           metadata_url,
+  const size_t          metadata_url_size,
+  const char*           metadata_hash_hex,
+  const size_t          metadata_hash_hex_size)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_propose_info_ex(&builder->state, reward_address, reward_address_size, metadata_url, metadata_url_size, metadata_hash_hex, metadata_hash_hex_size, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+cardano_error_t
+cardano_tx_builder_build(
+  cardano_tx_builder_t*   builder,
+  cardano_transaction_t** transaction)
+{
+  if (builder == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (transaction == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (builder->last_error != CARDANO_SUCCESS)
+  {
+    return builder->last_error;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_build(&builder->state, transaction, &error_message);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    track_builder_result(builder, result, error_message);
+
+    return result;
+  }
+
+  builder->last_error = CARDANO_ERROR_ILLEGAL_STATE;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_tx_builder_unref(cardano_tx_builder_t** tx_builder)
+{
+  if ((tx_builder == NULL) || (*tx_builder == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*tx_builder)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *tx_builder = NULL;
+    return;
+  }
+}
+
+void
+cardano_tx_builder_ref(cardano_tx_builder_t* tx_builder)
+{
+  if (tx_builder == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&tx_builder->base);
+}
+
+size_t
+cardano_tx_builder_refcount(const cardano_tx_builder_t* tx_builder)
+{
+  if (tx_builder == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&tx_builder->base);
+}
+
+void
+cardano_tx_builder_set_last_error(cardano_tx_builder_t* tx_builder, const char* message)
+{
+  cardano_object_set_last_error(&tx_builder->base, message);
+}
+
+const char*
+cardano_tx_builder_get_last_error(const cardano_tx_builder_t* tx_builder)
+{
+  return cardano_object_get_last_error(&tx_builder->base);
+}
+
+void
+cardano_tx_builder_add_input_with_deferred_redeemer(
+  cardano_tx_builder_t*          builder,
+  cardano_utxo_t*                utxo,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context,
+  cardano_plutus_data_t*         datum)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_input_with_deferred_redeemer(&builder->state, utxo, callback, user_context, datum, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_mint_token_with_deferred_redeemer(
+  cardano_tx_builder_t*          builder,
+  cardano_blake2b_hash_t*        policy_id,
+  cardano_asset_name_t*          name,
+  const int64_t                  amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_mint_token_with_deferred_redeemer(&builder->state, policy_id, name, amount, callback, user_context, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_withdraw_rewards_with_deferred_redeemer(
+  cardano_tx_builder_t*          builder,
+  cardano_reward_address_t*      address,
+  const int64_t                  amount,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_withdraw_rewards_with_deferred_redeemer(&builder->state, address, amount, callback, user_context, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_add_certificate_with_deferred_redeemer(
+  cardano_tx_builder_t*          builder,
+  cardano_certificate_t*         certificate,
+  cardano_deferred_redeemer_fn_t callback,
+  void*                          user_context)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_add_certificate_with_deferred_redeemer(&builder->state, certificate, callback, user_context, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+void
+cardano_tx_builder_vote_with_deferred_redeemer(
+  cardano_tx_builder_t*           builder,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* action_id,
+  cardano_voting_procedure_t*     vote,
+  cardano_deferred_redeemer_fn_t  callback,
+  void*                           user_context)
+{
+  if ((builder == NULL) || (builder->last_error != CARDANO_SUCCESS))
+  {
+    return;
+  }
+
+  const char* error_message = NULL;
+
+  const cardano_error_t result = cardano_builder_vote_with_deferred_redeemer(&builder->state, voter, action_id, vote, callback, user_context, &error_message);
+
+  track_builder_result(builder, result, error_message);
+}
+
+cardano_error_t
+cardano_tx_builder_set_pool_state(cardano_tx_builder_t* builder, cardano_pool_params_t* const* pool_state, const size_t pool_state_size)
+{
+  if ((builder == NULL) || ((pool_state == NULL) && (pool_state_size != 0U)))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  if (pool_state_size > (SIZE_MAX / sizeof(cardano_pool_params_t*)))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+  const cardano_error_t validation = _cardano_validate_pool_state(pool_state, pool_state_size);
+  if (validation != CARDANO_SUCCESS)
+  {
+    return validation;
+  }
+  cardano_pool_params_t** snapshot = NULL;
+  if (pool_state_size != 0U)
+  {
+    snapshot = _cardano_malloc(pool_state_size * sizeof(cardano_pool_params_t*));
+    if (snapshot == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+  size_t          copied = 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+  for (size_t i = 0U; (i < pool_state_size) && (result == CARDANO_SUCCESS); ++i)
+  {
+    snapshot[i] = NULL;
+    result      = cardano_pool_params_deep_clone(pool_state[i], &snapshot[i]);
+    if (result == CARDANO_SUCCESS)
+    {
+      ++copied;
+    }
+  }
+  if (result != CARDANO_SUCCESS)
+  {
+    for (size_t i = 0U; i < copied; ++i)
+    {
+      cardano_pool_params_unref(&snapshot[i]);
+    }
+    _cardano_free(snapshot);
+    return result;
+  }
+  for (size_t i = 0U; i < builder->state.pool_state_size; ++i)
+  {
+    cardano_pool_params_unref(&builder->state.pool_state[i]);
+  }
+  _cardano_free(builder->state.pool_state);
+  builder->state.pool_state      = snapshot;
+  builder->state.pool_state_size = pool_state_size;
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/arena/uplc_arena.c b/vendor/src/uplc/arena/uplc_arena.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/arena/uplc_arena.c
@@ -0,0 +1,505 @@
+/**
+ * \file uplc_arena.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_arena.h"
+
+#include "../../allocators.h"
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief Default block payload size, used when the caller passes 0 to
+ *        \ref cardano_uplc_arena_new.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t ARENA_DEFAULT_BLOCK_SIZE = (size_t)64U * 1024U;
+
+/**
+ * \brief Upper bound on the total payload bytes the arena will serve.
+ *
+ * Decoding and evaluation of malformed input must not be able to allocate
+ * without bound before the machine charges for it. The ceiling is the largest
+ * Plutus execution-memory budget (about 14e6 ex-mem units) scaled by a generous
+ * bytes-per-unit factor, giving a few hundred megabytes; large enough never to
+ * bite a legitimate script, small enough to deny an unbounded allocation. Past
+ * the ceiling, allocation fails and creation refuses with
+ * \ref CARDANO_ERROR_ILLEGAL_STATE at the call sites that surface it.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t ARENA_BYTE_CEILING = (size_t)512U * 1024U * 1024U;
+
+/**
+ * \brief Natural maximum alignment used when the caller passes align 0.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t ARENA_MAX_ALIGN = sizeof(long double) > sizeof(void*) ? sizeof(long double) : sizeof(void*);
+
+/**
+ * \brief Keeps the refill path out of the allocator entry point.
+ *
+ * \ref cardano_uplc_arena_alloc is deliberately a handful of instructions so
+ * link-time optimization can inline it into the interpreter hot loops; without
+ * this marker the compiler folds the single-caller refill body back into it
+ * and the entry point grows past the inlining threshold.
+ */
+#if defined(__GNUC__) || defined(__clang__)
+#define CARDANO_UPLC_ARENA_NOINLINE __attribute__((noinline))
+#elif defined(_MSC_VER)
+#define CARDANO_UPLC_ARENA_NOINLINE __declspec(noinline)
+#else
+#define CARDANO_UPLC_ARENA_NOINLINE
+#endif
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief One backing block: a header followed by its payload.
+ */
+typedef struct cardano_uplc_arena_block_t
+{
+    struct cardano_uplc_arena_block_t* next;
+    size_t                             capacity;
+    size_t                             offset;
+    byte_t*                            payload;
+} cardano_uplc_arena_block_t;
+
+/**
+ * \brief One entry on the on-free unref list.
+ */
+typedef struct cardano_uplc_arena_unref_node_t
+{
+    struct cardano_uplc_arena_unref_node_t* next;
+    void*                                   object;
+    cardano_uplc_arena_unref_t              unref;
+} cardano_uplc_arena_unref_node_t;
+
+/**
+ * \brief Region allocator state.
+ *
+ * \c blocks heads the live list and only its first block is bumped; \c spares
+ * holds the blocks parked by \ref cardano_uplc_arena_reset for reuse.
+ */
+struct cardano_uplc_arena_t
+{
+    cardano_uplc_arena_block_t*      blocks;
+    cardano_uplc_arena_block_t*      spares;
+    cardano_uplc_arena_unref_node_t* unrefs;
+    size_t                           block_size;
+    size_t                           bytes_used;
+    size_t                           byte_ceiling;
+};
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Tests whether a value is a non-zero power of two.
+ *
+ * \param[in] value The value to test.
+ *
+ * \return \c true if \p value is a power of two, \c false otherwise.
+ */
+static bool
+is_power_of_two(const size_t value)
+{
+  return (value != 0U) && ((value & (value - 1U)) == 0U);
+}
+
+/**
+ * \brief Computes the offset within a block at which an allocation of the given
+ *        alignment must start so that its absolute address is aligned.
+ *
+ * Aligns the absolute address \p base + \p offset up to \p align and returns the
+ * resulting distance from \p base, so \p base plus the returned offset is an
+ * aligned pointer regardless of how the block payload itself is aligned.
+ *
+ * \param[in] base Address of the block payload.
+ * \param[in] offset Bytes already consumed in the block.
+ * \param[in] align The alignment; must be a power of two.
+ * \param[out] result The aligned offset.
+ *
+ * \note Rounding up to a power-of-two alignment cannot overflow a live address:
+ *       \p base + \p offset is the address of allocated memory and \p align - 1
+ *       is at most \ref ARENA_MAX_ALIGN - 1, so their sum stays within the
+ *       address space. No allocation can sit within \p align bytes of
+ *       \c UINTPTR_MAX.
+ */
+static void
+compute_aligned_offset(const byte_t* base, const size_t offset, const size_t align, size_t* result)
+{
+  const uintptr_t mask = (uintptr_t)align - 1U;
+  // cppcheck-suppress misra-c2012-11.4; Reason: integer-pointer conversion for arena alignment bookkeeping
+  const uintptr_t address = (uintptr_t)base + (uintptr_t)offset;
+
+  // cppcheck-suppress misra-c2012-11.4; Reason: integer-pointer conversion for arena alignment bookkeeping
+  *result = (size_t)(((address + mask) & ~mask) - (uintptr_t)base);
+}
+
+/**
+ * \brief Charges \p amount against the byte ceiling.
+ *
+ * \param[in] arena The arena whose running total is updated.
+ * \param[in] amount The number of bytes to charge.
+ *
+ * \return \c true if the charge stays within the arena's ceiling and is applied,
+ *         \c false if it would overflow or exceed that ceiling.
+ */
+static bool
+charge_bytes(cardano_uplc_arena_t* arena, const size_t amount)
+{
+  if (amount > (arena->byte_ceiling - arena->bytes_used))
+  {
+    return false;
+  }
+
+  arena->bytes_used += amount;
+
+  return true;
+}
+
+/**
+ * \brief Allocates and links a new block with at least \p min_capacity payload
+ *        bytes.
+ *
+ * \param[in] arena The arena to extend.
+ * \param[in] min_capacity The minimum payload the block must hold.
+ *
+ * \return The new block on success, or \c NULL if the backing allocator fails.
+ */
+static cardano_uplc_arena_block_t*
+grow_arena(cardano_uplc_arena_t* arena, const size_t min_capacity)
+{
+  cardano_uplc_arena_block_t** spare_link = &arena->spares;
+
+  while (*spare_link != NULL)
+  {
+    cardano_uplc_arena_block_t* spare = *spare_link;
+
+    if (spare->capacity >= min_capacity)
+    {
+      *spare_link   = spare->next;
+      spare->offset = 0U;
+      spare->next   = arena->blocks;
+      arena->blocks = spare;
+
+      return spare;
+    }
+
+    spare_link = &spare->next;
+  }
+
+  size_t capacity = arena->block_size;
+
+  if (capacity < min_capacity)
+  {
+    capacity = min_capacity;
+  }
+
+  if (capacity > (SIZE_MAX - sizeof(cardano_uplc_arena_block_t)))
+  {
+    return NULL;
+  }
+
+  cardano_uplc_arena_block_t* block = _cardano_malloc(sizeof(cardano_uplc_arena_block_t) + capacity);
+
+  if (block == NULL)
+  {
+    return NULL;
+  }
+
+  block->capacity = capacity;
+  block->offset   = 0U;
+  // cppcheck-suppress misra-c2012-18.4; Reason: pointer arithmetic over a contiguous arena buffer
+  block->payload = (byte_t*)block + sizeof(cardano_uplc_arena_block_t);
+  block->next    = arena->blocks;
+  arena->blocks  = block;
+
+  return block;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_arena_new(const size_t block_size, cardano_uplc_arena_t** arena)
+{
+  return cardano_uplc_int_arena_new_with_ceiling(block_size, ARENA_BYTE_CEILING, arena);
+}
+
+cardano_error_t
+cardano_uplc_int_arena_new_with_ceiling(const size_t block_size, const size_t byte_ceiling, cardano_uplc_arena_t** arena)
+{
+  if (arena == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_uplc_arena_t* result = _cardano_malloc(sizeof(cardano_uplc_arena_t));
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->blocks       = NULL;
+  result->spares       = NULL;
+  result->unrefs       = NULL;
+  result->bytes_used   = 0U;
+  result->block_size   = (block_size == 0U) ? ARENA_DEFAULT_BLOCK_SIZE : block_size;
+  result->byte_ceiling = byte_ceiling;
+
+  *arena = result;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Refill path behind \ref cardano_uplc_arena_alloc.
+ *
+ * Serves the requests the head-block bump cannot: an empty arena, a full head
+ * block, or an oversized request. Kept out of line (and marked so) so the
+ * public entry point stays a handful of instructions that link-time
+ * optimization can inline into the interpreter hot loops.
+ *
+ * \param[in] arena The arena to allocate from. Must not be NULL.
+ * \param[in] size The number of bytes to allocate.
+ * \param[in] effective_align The alignment to honor; a power of two.
+ *
+ * \return The allocation, or \c NULL when the ceiling or the backing allocator
+ *         refuses it.
+ */
+static CARDANO_UPLC_ARENA_NOINLINE void*
+alloc_refill(cardano_uplc_arena_t* arena, const size_t size, const size_t effective_align)
+{
+  cardano_uplc_arena_block_t* block          = NULL;
+  size_t                      aligned_offset = 0U;
+  size_t                      end            = 0U;
+  size_t                      provisional    = 0U;
+
+  if (size > (SIZE_MAX - (effective_align - 1U)))
+  {
+    return NULL;
+  }
+
+  provisional = size + (effective_align - 1U);
+
+  if (!charge_bytes(arena, provisional))
+  {
+    return NULL;
+  }
+
+  block = grow_arena(arena, provisional);
+
+  if (block == NULL)
+  {
+    arena->bytes_used -= provisional;
+
+    return NULL;
+  }
+
+  compute_aligned_offset(block->payload, block->offset, effective_align, &aligned_offset);
+  end = aligned_offset + size;
+
+  arena->bytes_used -= (provisional - end);
+
+  block->offset = end;
+
+  // cppcheck-suppress misra-c2012-18.4; Reason: pointer arithmetic over a contiguous arena buffer
+  return block->payload + aligned_offset;
+}
+
+void*
+cardano_uplc_arena_alloc(cardano_uplc_arena_t* arena, const size_t size, const size_t align)
+{
+  const size_t                effective_align = (align == 0U) ? ARENA_MAX_ALIGN : align;
+  cardano_uplc_arena_block_t* block           = NULL;
+
+  if (arena == NULL)
+  {
+    return NULL;
+  }
+
+  if ((align != 0U) && !is_power_of_two(align))
+  {
+    return NULL;
+  }
+
+  block = arena->blocks;
+
+  if (block != NULL)
+  {
+    const uintptr_t mask = (uintptr_t)effective_align - 1U;
+    // cppcheck-suppress misra-c2012-11.4; Reason: integer-pointer conversion for arena alignment bookkeeping
+    const uintptr_t address = (uintptr_t)block->payload + (uintptr_t)block->offset;
+
+    // cppcheck-suppress misra-c2012-11.4; Reason: integer-pointer conversion for arena alignment bookkeeping
+    const size_t aligned_offset = (size_t)(((address + mask) & ~mask) - (uintptr_t)block->payload);
+
+    if ((aligned_offset <= block->capacity) && (size <= (block->capacity - aligned_offset)))
+    {
+      const size_t charge = (aligned_offset - block->offset) + size;
+
+      if (charge <= (arena->byte_ceiling - arena->bytes_used))
+      {
+        arena->bytes_used += charge;
+        block->offset     = aligned_offset + size;
+
+        // cppcheck-suppress misra-c2012-18.4; Reason: pointer arithmetic over a contiguous arena buffer
+        return block->payload + aligned_offset;
+      }
+
+      return NULL;
+    }
+  }
+
+  return alloc_refill(arena, size, effective_align);
+}
+
+cardano_error_t
+cardano_uplc_arena_register_unref(cardano_uplc_arena_t* arena, void* object, cardano_uplc_arena_unref_t unref)
+{
+  if ((arena == NULL) || (object == NULL) || (unref == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_uplc_arena_unref_node_t* node = _cardano_malloc(sizeof(cardano_uplc_arena_unref_node_t));
+
+  if (node == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  if (!charge_bytes(arena, sizeof(cardano_uplc_arena_unref_node_t)))
+  {
+    _cardano_free(node);
+
+    return CARDANO_ERROR_ILLEGAL_STATE;
+  }
+
+  node->object  = object;
+  node->unref   = unref;
+  node->next    = arena->unrefs;
+  arena->unrefs = node;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_uplc_arena_bytes_used(const cardano_uplc_arena_t* arena)
+{
+  if (arena == NULL)
+  {
+    return 0U;
+  }
+
+  return arena->bytes_used;
+}
+
+void
+cardano_uplc_arena_free(cardano_uplc_arena_t** arena)
+{
+  if ((arena == NULL) || (*arena == NULL))
+  {
+    return;
+  }
+
+  cardano_uplc_arena_t*            self  = *arena;
+  cardano_uplc_arena_unref_node_t* node  = self->unrefs;
+  cardano_uplc_arena_block_t*      block = self->blocks;
+
+  while (node != NULL)
+  {
+    cardano_uplc_arena_unref_node_t* next = node->next;
+
+    node->unref(node->object);
+    _cardano_free(node);
+
+    node = next;
+  }
+
+  while (block != NULL)
+  {
+    cardano_uplc_arena_block_t* next = block->next;
+
+    _cardano_free(block);
+
+    block = next;
+  }
+
+  block = self->spares;
+
+  while (block != NULL)
+  {
+    cardano_uplc_arena_block_t* next = block->next;
+
+    _cardano_free(block);
+
+    block = next;
+  }
+
+  _cardano_free(self);
+
+  *arena = NULL;
+}
+
+void
+cardano_uplc_arena_reset(cardano_uplc_arena_t* arena)
+{
+  if (arena == NULL)
+  {
+    return;
+  }
+
+  cardano_uplc_arena_unref_node_t* node = arena->unrefs;
+
+  while (node != NULL)
+  {
+    cardano_uplc_arena_unref_node_t* next = node->next;
+
+    node->unref(node->object);
+    _cardano_free(node);
+
+    node = next;
+  }
+
+  arena->unrefs = NULL;
+
+  cardano_uplc_arena_block_t* block = arena->blocks;
+
+  while (block != NULL)
+  {
+    cardano_uplc_arena_block_t* next = block->next;
+
+    block->offset = 0U;
+    block->next   = arena->spares;
+    arena->spares = block;
+
+    block = next;
+  }
+
+  arena->blocks     = NULL;
+  arena->bytes_used = 0U;
+}
diff --git a/vendor/src/uplc/arena/uplc_arena.h b/vendor/src/uplc/arena/uplc_arena.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/arena/uplc_arena.h
@@ -0,0 +1,194 @@
+/**
+ * \file uplc_arena.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_ARENA_UPLC_ARENA_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_ARENA_UPLC_ARENA_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Region (arena) allocator for the UPLC interpreter interior.
+ *
+ * Serves aligned chunks from \ref _cardano_malloc by bumping an offset inside a
+ * singly linked list of blocks and releases every block in one call. Terms,
+ * constants, values, environment cells and continuation frames are allocated
+ * here and never freed individually; the single free point is
+ * \ref cardano_uplc_arena_free. A request larger than the configured block size
+ * gets its own dedicated block.
+ *
+ * The caller creates an arena, hands it to the public decode/evaluate entry
+ * points, and frees it once the results have been consumed; the arena is not
+ * refcounted.
+ */
+typedef struct cardano_uplc_arena_t cardano_uplc_arena_t;
+
+/**
+ * \brief Function invoked for each registered object when the arena is freed.
+ *
+ * The arena owns a small number of interior values that are refcounted library
+ * objects (bigints, plutus data) rather than raw arena memory. Such an object is
+ * registered with \ref cardano_uplc_arena_register_unref and released through a
+ * callback of this type when the arena is freed.
+ *
+ * \param[in] object The object passed to \ref cardano_uplc_arena_register_unref.
+ */
+typedef void (*cardano_uplc_arena_unref_t)(void* object);
+
+/**
+ * \brief Creates a region allocator that serves blocks from \ref _cardano_malloc
+ *        and releases them all at once.
+ *
+ * \param[in] block_size Size in bytes of each underlying block payload. A value
+ *            of 0 selects an internal default. Allocations larger than this get
+ *            their own oversized block.
+ * \param[out] arena On success, set to the new arena; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         backing allocator fails.
+ */
+cardano_error_t
+cardano_uplc_arena_new(size_t block_size, cardano_uplc_arena_t** arena);
+
+/**
+ * \brief Allocates \p size bytes aligned to \p align from the arena.
+ *
+ * Rounds the current block offset up to \p align and bumps it by \p size,
+ * starting a new block when the current one cannot satisfy the request and
+ * giving an oversized request its own block. The returned memory is not zeroed.
+ *
+ * \param[in] arena The arena to allocate from.
+ * \param[in] size Number of bytes to allocate. A size of 0 yields a valid,
+ *            non-dereferenceable pointer into the arena.
+ * \param[in] align Required alignment in bytes. Must be a power of two; a value
+ *            of 0 selects the natural maximum alignment.
+ *
+ * \return A pointer to the allocated memory, or \c NULL when \p arena is NULL,
+ *         \p align is not a power of two, the request cannot be represented, the
+ *         total-bytes ceiling would be exceeded, or the backing allocator fails.
+ */
+void*
+cardano_uplc_arena_alloc(cardano_uplc_arena_t* arena, size_t size, size_t align);
+
+/**
+ * \brief Registers a refcounted object to be released when the arena is freed.
+ *
+ * Records \p object and \p unref on an intrusive list owned by the arena. When
+ * \ref cardano_uplc_arena_free runs, every registered \p unref is called with its
+ * \p object, in unspecified order, exactly once. This is the single bridge between
+ * the arena and the library's refcounted interior values; the caller must have a
+ * reference for the arena to drop.
+ *
+ * \param[in] arena The arena that will own the unref.
+ * \param[in] object The object to release on free. Must not be NULL.
+ * \param[in] unref The callback that releases \p object. Must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         list node cannot be allocated, or \ref CARDANO_ERROR_ILLEGAL_STATE if the
+ *         node would push the arena past its byte ceiling.
+ */
+cardano_error_t
+cardano_uplc_arena_register_unref(cardano_uplc_arena_t* arena, void* object, cardano_uplc_arena_unref_t unref);
+
+/**
+ * \brief Returns the total number of payload bytes the arena has served.
+ *
+ * Counts the aligned, padded bytes handed out by \ref cardano_uplc_arena_alloc; it
+ * does not count block headers or list bookkeeping. Intended for tests and budget
+ * cross-checks.
+ *
+ * \param[in] arena The arena to query.
+ *
+ * \return The number of bytes served, or 0 if \p arena is NULL.
+ */
+size_t
+cardano_uplc_arena_bytes_used(const cardano_uplc_arena_t* arena);
+
+/**
+ * \brief Releases every block owned by the arena, runs all registered unref
+ *        callbacks, and frees the arena itself.
+ *
+ * \param[in,out] arena Address of the arena pointer. The pointee is freed and set
+ *                to NULL. Does nothing if \p arena or \p *arena is NULL.
+ */
+void
+cardano_uplc_arena_free(cardano_uplc_arena_t** arena);
+
+/**
+ * \brief Runs all registered unref callbacks and rewinds the arena for reuse.
+ *
+ * Calls every registered unref callback, clears the unref list, and moves every
+ * block onto a spare list while keeping the allocated block memory, so the next
+ * generation of allocations reuses the same blocks without touching the backing
+ * allocator. The arena remains valid; it is not freed.
+ *
+ * \param[in,out] arena The arena to rewind. Does nothing if \p arena is NULL.
+ */
+void
+cardano_uplc_arena_reset(cardano_uplc_arena_t* arena);
+
+/* INTERNAL DECLARATIONS *****************************************************/
+
+/* The following entry points are module-internal (the cardano_uplc_int_ prefix
+ * marks them so). They are not part of the public API and are declared here so
+ * that the arena implementation and a small number of internal callers/tests can
+ * reach them. */
+
+/**
+ * \brief Creates a region allocator with an explicit byte ceiling.
+ *
+ * Internal entry point behind \ref cardano_uplc_arena_new. The public function
+ * delegates here with the default ceiling; exposing the explicit ceiling lets
+ * callers and tests drive the ceiling-enforcement branches with a small, cheap
+ * bound. Not part of the public API; the \c cardano_uplc_int_ prefix marks it
+ * module-internal.
+ *
+ * \param[in] block_size Size in bytes of each underlying block payload. A value
+ *            of 0 selects an internal default. Allocations larger than this get
+ *            their own oversized block.
+ * \param[in] byte_ceiling Upper bound on the total payload bytes the arena will
+ *            serve before allocation fails and \ref cardano_uplc_arena_register_unref
+ *            refuses.
+ * \param[out] arena On success, set to the new arena; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         backing allocator fails.
+ */
+cardano_error_t
+cardano_uplc_int_arena_new_with_ceiling(size_t block_size, size_t byte_ceiling, cardano_uplc_arena_t** arena);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_ARENA_UPLC_ARENA_H */
diff --git a/vendor/src/uplc/ast/uplc_constant.c b/vendor/src/uplc/ast/uplc_constant.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_constant.c
@@ -0,0 +1,415 @@
+/**
+ * \file uplc_constant.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_constant.h"
+#include "uplc_int.h"
+
+#include "../arena/uplc_arena.h"
+#include "../data/uplc_data.h"
+
+#include <cardano/buffer.h>
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_constant_new_integer(
+  cardano_uplc_arena_t*     arena,
+  cardano_bigint_t*         value,
+  cardano_uplc_constant_t** constant)
+{
+  cardano_uplc_constant_t* result       = NULL;
+  cardano_error_t          register_res = CARDANO_SUCCESS;
+
+  if ((arena == NULL) || (value == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_bigint_ref(value);
+
+  register_res = cardano_uplc_arena_register_unref(arena, value, &cardano_uplc_int_unref_bigint);
+
+  if (register_res != CARDANO_SUCCESS)
+  {
+    cardano_bigint_unref(&value);
+
+    return register_res;
+  }
+
+  result->kind                = CARDANO_UPLC_TYPE_INTEGER;
+  result->as.integer.is_small = false;
+  result->as.integer.small    = 0;
+  result->as.integer.big      = value;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_constant_new_integer_small(
+  cardano_uplc_arena_t*     arena,
+  int64_t                   value,
+  cardano_uplc_constant_t** constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+
+  if ((arena == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                = CARDANO_UPLC_TYPE_INTEGER;
+  result->as.integer.is_small = true;
+  result->as.integer.small    = value;
+  result->as.integer.big      = NULL;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_constant_new_byte_string(
+  cardano_uplc_arena_t*     arena,
+  cardano_buffer_t*         bytes,
+  cardano_uplc_constant_t** constant)
+{
+  if ((arena == NULL) || (bytes == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_uplc_int_constant_new_byte_string_copy(
+    arena,
+    cardano_buffer_get_data(bytes),
+    cardano_buffer_get_size(bytes),
+    constant);
+}
+
+cardano_error_t
+cardano_uplc_constant_new_string(
+  cardano_uplc_arena_t*     arena,
+  cardano_buffer_t*         string,
+  cardano_uplc_constant_t** constant)
+{
+  if ((arena == NULL) || (string == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_uplc_int_constant_new_string_copy(
+    arena,
+    cardano_buffer_get_data(string),
+    cardano_buffer_get_size(string),
+    constant);
+}
+
+cardano_error_t
+cardano_uplc_constant_new_bool(
+  cardano_uplc_arena_t*     arena,
+  bool                      value,
+  cardano_uplc_constant_t** constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+
+  if ((arena == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind       = CARDANO_UPLC_TYPE_BOOL;
+  result->as.boolean = value;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_constant_new_unit(
+  cardano_uplc_arena_t*     arena,
+  cardano_uplc_constant_t** constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+
+  if ((arena == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind = CARDANO_UPLC_TYPE_UNIT;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_constant_new_data(
+  cardano_uplc_arena_t*     arena,
+  cardano_plutus_data_t*    data,
+  cardano_uplc_constant_t** constant)
+{
+  cardano_uplc_data_t* node   = NULL;
+  cardano_error_t      result = CARDANO_SUCCESS;
+
+  if ((arena == NULL) || (data == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_uplc_data_from_plutus_data(arena, data, &node);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return cardano_uplc_int_constant_new_data_node(arena, node, constant);
+}
+
+cardano_error_t
+cardano_uplc_constant_new_bls(
+  cardano_uplc_arena_t*     arena,
+  cardano_uplc_type_kind_t  kind,
+  const void*               data,
+  size_t                    size,
+  cardano_uplc_constant_t** constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+  void*                    blob   = NULL;
+  const byte_t*            src    = (const byte_t*)data;
+  byte_t*                  dst    = NULL;
+  size_t                   i      = 0U;
+
+  if ((arena == NULL) || (data == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (((kind != CARDANO_UPLC_TYPE_BLS_G1) && (kind != CARDANO_UPLC_TYPE_BLS_G2) && (kind != CARDANO_UPLC_TYPE_BLS_ML_RESULT)) || (size == 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  blob = cardano_uplc_arena_alloc(arena, size, 0U);
+
+  if (blob == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  dst = (byte_t*)blob;
+
+  for (i = 0U; i < size; ++i)
+  {
+    dst[i] = src[i];
+  }
+
+  result->kind   = kind;
+  result->as.bls = blob;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_constant_new_list(
+  cardano_uplc_arena_t*                 arena,
+  const cardano_uplc_type_t*            element_type,
+  const cardano_uplc_constant_t* const* items,
+  size_t                                count,
+  cardano_uplc_constant_t**             constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+
+  if ((arena == NULL) || (element_type == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((items == NULL) && (count != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                 = CARDANO_UPLC_TYPE_LIST;
+  result->as.list.element_type = element_type;
+  result->as.list.items        = items;
+  result->as.list.count        = count;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_constant_new_array(
+  cardano_uplc_arena_t*                 arena,
+  const cardano_uplc_type_t*            element_type,
+  const cardano_uplc_constant_t* const* items,
+  size_t                                count,
+  cardano_uplc_constant_t**             constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+
+  if ((arena == NULL) || (element_type == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((items == NULL) && (count != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                 = CARDANO_UPLC_TYPE_ARRAY;
+  result->as.list.element_type = element_type;
+  result->as.list.items        = items;
+  result->as.list.count        = count;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_constant_new_value(
+  cardano_uplc_arena_t*                 arena,
+  const cardano_uplc_type_t*            element_type,
+  const cardano_uplc_constant_t* const* items,
+  size_t                                count,
+  cardano_uplc_constant_t**             constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+
+  if ((arena == NULL) || (element_type == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((items == NULL) && (count != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                 = CARDANO_UPLC_TYPE_VALUE;
+  result->as.list.element_type = element_type;
+  result->as.list.items        = items;
+  result->as.list.count        = count;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_constant_new_pair(
+  cardano_uplc_arena_t*          arena,
+  const cardano_uplc_constant_t* fst,
+  const cardano_uplc_constant_t* snd,
+  cardano_uplc_constant_t**      constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+
+  if ((arena == NULL) || (fst == NULL) || (snd == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind        = CARDANO_UPLC_TYPE_PAIR;
+  result->as.pair.fst = fst;
+  result->as.pair.snd = snd;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/ast/uplc_constant.h b/vendor/src/uplc/ast/uplc_constant.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_constant.h
@@ -0,0 +1,427 @@
+/**
+ * \file uplc_constant.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_CONSTANT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_CONSTANT_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../arena/uplc_arena.h"
+#include "../builtins/uplc_builtin.h"
+#include "uplc_type.h"
+#include "uplc_type_kind.h"
+#include <cardano/buffer.h>
+#include <cardano/common/bigint.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/typedefs.h>
+
+/* FORWARD DECLARATIONS ******************************************************/
+
+/**
+ * \brief A VM-internal, arena-allocated Plutus-data node.
+ *
+ * The data constant arm holds a pointer to this lean, arena-allocated node rather
+ * than the heavyweight refcounted \ref cardano_plutus_data_t. The struct is defined
+ * in the module-private header \c uplc_data.h; the public header keeps the arm
+ * opaque, as the BLS arm keeps the blst point opaque.
+ */
+struct cardano_uplc_data_t;
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A constant value tagged by its constant kind.
+ *
+ * The \c kind selects the active union arm. Integer constants reuse the library's
+ * refcounted \ref cardano_bigint_t (for the rare value that does not fit inline).
+ * Byte-string and string constants store an inline \c (data, size) descriptor that
+ * points into arena memory: the bytes are bump-allocated from the arena that built
+ * the constant and released with it, so the hot byte-string builtins neither malloc
+ * nor refcount per result. The \c data pointer is NULL only for the empty
+ * byte string or string, where \c size is 0 and the pointer is never dereferenced.
+ * A data constant holds an opaque pointer to a VM-internal, arena-allocated
+ * \c cardano_uplc_data_t node (defined in \c uplc_data.h): it is not refcounted and
+ * is released with the arena, like the BLS arm.
+ *
+ * A BLS arm (\ref CARDANO_UPLC_TYPE_BLS_G1, \ref CARDANO_UPLC_TYPE_BLS_G2 or
+ * \ref CARDANO_UPLC_TYPE_BLS_ML_RESULT) holds \c bls: an opaque, arena-allocated
+ * blob carrying the in-memory blst point (\c blst_p1 for G1, \c blst_p2 for G2)
+ * or pairing result (\c blst_fp12 for ML result). The blob is not refcounted and
+ * is owned by the arena; the runtime in \c builtins.c casts it to the concrete
+ * blst type. The public header stays free of the blst dependency by treating the
+ * arm as opaque storage; see \ref cardano_uplc_constant_new_bls.
+ */
+typedef struct cardano_uplc_constant_t
+{
+    cardano_uplc_type_kind_t kind;
+
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        /**
+         * \brief An arbitrary-precision integer stored inline when it fits an \c int64_t.
+         *
+         * Most UPLC integers are tiny, so the machine keeps them as a flat \c int64_t
+         * with no heap allocation; \c big is reserved for the rare value whose magnitude
+         * exceeds the signed 64-bit range. When \c is_small is \c true the value is
+         * exactly \c small and \c big is either NULL or a lazily materialized,
+         * arena-owned copy of \c small built on demand by the builtins that need a
+         * \ref cardano_bigint_t (a read-through cache, never the source of truth). When
+         * \c is_small is \c false the value lives in \c big and \c small is unused. The
+         * fast arithmetic path operates on \c small directly and falls back to \c big
+         * only on overflow.
+         */
+        struct
+        {
+            int64_t           small;
+            cardano_bigint_t* big;
+            bool              is_small;
+        } integer;
+
+        struct
+        {
+            const byte_t* data;
+            size_t        size;
+        } bytes;
+
+        struct
+        {
+            const byte_t* data;
+            size_t        size;
+        } string;
+
+        bool                              boolean;
+        const struct cardano_uplc_data_t* data;
+        const void*                       bls;
+
+        struct
+        {
+            const cardano_uplc_type_t*                   element_type;
+            const struct cardano_uplc_constant_t* const* items;
+            size_t                                       count;
+        } list; /* also the active arm for CARDANO_UPLC_TYPE_ARRAY and CARDANO_UPLC_TYPE_VALUE */
+
+        struct
+        {
+            const struct cardano_uplc_constant_t* fst;
+            const struct cardano_uplc_constant_t* snd;
+        } pair;
+
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } as;
+} cardano_uplc_constant_t;
+
+/**
+ * \brief Builds an integer constant that borrows a refcounted bigint.
+ *
+ * Allocates the constant node from \p arena and registers \p value with the
+ * arena so a single \ref cardano_uplc_arena_free releases the arena's reference.
+ * The arena takes its own reference; the caller keeps the reference it passed in
+ * and must still release it.
+ *
+ * \param[in] arena The arena to allocate the constant from.
+ * \param[in] value The integer value. Must not be NULL.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         arena cannot serve the node, or \ref CARDANO_ERROR_ILLEGAL_STATE if the
+ *         arena is past its byte ceiling.
+ */
+cardano_error_t
+cardano_uplc_constant_new_integer(
+  struct cardano_uplc_arena_t* arena,
+  cardano_bigint_t*            value,
+  cardano_uplc_constant_t**    constant);
+
+/**
+ * \brief Builds an integer constant from an inline \c int64_t with no allocation.
+ *
+ * This is the fast path for the overwhelmingly common case of a small integer: the
+ * value is stored inline in the constant node and no \ref cardano_bigint_t is
+ * allocated. A \ref cardano_bigint_t is only ever built lazily, and cached in the
+ * node, by the builtins that genuinely need one. Use this whenever the value is
+ * known to fit \c int64_t; otherwise use \ref cardano_uplc_constant_new_integer.
+ *
+ * \param[in] arena The arena to allocate the constant from.
+ * \param[in] value The inline integer value.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p constant is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve the
+ *         node.
+ */
+cardano_error_t
+cardano_uplc_constant_new_integer_small(
+  struct cardano_uplc_arena_t* arena,
+  int64_t                      value,
+  cardano_uplc_constant_t**    constant);
+
+/**
+ * \brief Builds a byte-string constant by copying a buffer's bytes into the arena.
+ *
+ * Allocates the constant node and a copy of \p bytes from \p arena, both released by
+ * a single \ref cardano_uplc_arena_free. The constant does not retain \p bytes;
+ * nothing is refcounted. The copy is the boundary path the flat decoder and text
+ * parser use to publish a freshly read buffer as an arena byte string.
+ *
+ * \param[in] arena The arena to allocate the constant and the byte copy from.
+ * \param[in] bytes The byte-string contents. Must not be NULL.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         arena cannot serve the node or the byte copy.
+ */
+cardano_error_t
+cardano_uplc_constant_new_byte_string(
+  struct cardano_uplc_arena_t* arena,
+  cardano_buffer_t*            bytes,
+  cardano_uplc_constant_t**    constant);
+
+/**
+ * \brief Builds a UTF-8 string constant by copying a buffer's bytes into the arena.
+ *
+ * Allocates the constant node and a copy of \p string from \p arena, both released
+ * by a single \ref cardano_uplc_arena_free; nothing is refcounted. The caller is
+ * responsible for having validated the UTF-8; this constructor does not re-validate.
+ *
+ * \param[in] arena The arena to allocate the constant and the byte copy from.
+ * \param[in] string The text contents. Must not be NULL.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         arena cannot serve the node or the byte copy.
+ */
+cardano_error_t
+cardano_uplc_constant_new_string(
+  struct cardano_uplc_arena_t* arena,
+  cardano_buffer_t*            string,
+  cardano_uplc_constant_t**    constant);
+
+/**
+ * \brief Builds a boolean constant.
+ *
+ * \param[in] arena The arena to allocate the constant from.
+ * \param[in] value The boolean value.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p constant is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_constant_new_bool(
+  struct cardano_uplc_arena_t* arena,
+  bool                         value,
+  cardano_uplc_constant_t**    constant);
+
+/**
+ * \brief Builds the unit constant.
+ *
+ * \param[in] arena The arena to allocate the constant from.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p constant is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_constant_new_unit(
+  struct cardano_uplc_arena_t* arena,
+  cardano_uplc_constant_t**    constant);
+
+/**
+ * \brief Builds a data constant that borrows a refcounted plutus-data object.
+ *
+ * Allocates the constant node from \p arena and registers \p data with the arena
+ * so a single \ref cardano_uplc_arena_free releases the arena's reference. The
+ * arena takes its own reference; the caller keeps the reference it passed in.
+ *
+ * \param[in] arena The arena to allocate the constant from.
+ * \param[in] data The plutus-data value. Must not be NULL.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         arena cannot serve the node, or \ref CARDANO_ERROR_ILLEGAL_STATE if the
+ *         arena is past its byte ceiling.
+ */
+cardano_error_t
+cardano_uplc_constant_new_data(
+  struct cardano_uplc_arena_t* arena,
+  cardano_plutus_data_t*       data,
+  cardano_uplc_constant_t**    constant);
+
+/**
+ * \brief Builds a BLS12-381 constant from a raw in-memory blst value.
+ *
+ * Copies \p size bytes from \p data into the arena and stores the copy in the
+ * \c bls arm. \p kind must be one of \ref CARDANO_UPLC_TYPE_BLS_G1,
+ * \ref CARDANO_UPLC_TYPE_BLS_G2 or \ref CARDANO_UPLC_TYPE_BLS_ML_RESULT, and
+ * \p data must point at the matching blst struct (\c blst_p1, \c blst_p2 or
+ * \c blst_fp12). The copy is owned by the arena and released with it; it is not
+ * refcounted.
+ *
+ * \param[in] arena The arena to allocate the constant and the blob from.
+ * \param[in] kind The BLS constant kind.
+ * \param[in] data The raw blst value to copy. Must not be NULL.
+ * \param[in] size The number of bytes to copy from \p data.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p data or \p constant is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if \p kind is not a BLS kind or \p size is 0, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve the
+ *         node.
+ */
+cardano_error_t
+cardano_uplc_constant_new_bls(
+  struct cardano_uplc_arena_t* arena,
+  cardano_uplc_type_kind_t     kind,
+  const void*                  data,
+  size_t                       size,
+  cardano_uplc_constant_t**    constant);
+
+/**
+ * \brief Builds a typed list constant from an arena-allocated item array.
+ *
+ * The \p items array and the items it points at must already live in \p arena;
+ * the constructor copies the pointers it is given by reference, it does not copy
+ * the items. An empty list is allowed with \p count 0 and \p items NULL.
+ *
+ * \param[in] arena The arena to allocate the constant from.
+ * \param[in] element_type The element type descriptor. Must not be NULL.
+ * \param[in] items The element pointers, or NULL when \p count is 0.
+ * \param[in] count The number of elements.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p element_type, or \p constant is NULL,
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT if \p items is NULL while
+ *         \p count is non-zero, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_constant_new_list(
+  struct cardano_uplc_arena_t*          arena,
+  const cardano_uplc_type_t*            element_type,
+  const cardano_uplc_constant_t* const* items,
+  size_t                                count,
+  cardano_uplc_constant_t**             constant);
+
+/**
+ * \brief Builds a typed array constant from an arena-allocated item array.
+ *
+ * An array is stored exactly like a list (element type, item pointers and a
+ * count) but carries the \ref CARDANO_UPLC_TYPE_ARRAY kind, which keeps it a
+ * distinct constant form for the \c lengthOfArray, \c listToArray and
+ * \c indexArray builtins and for the surface syntax. The \p items array and the
+ * items it points at must already live in \p arena; the constructor copies the
+ * pointers it is given by reference. An empty array is allowed with \p count 0
+ * and \p items NULL.
+ *
+ * \param[in] arena The arena to allocate the constant from.
+ * \param[in] element_type The element type descriptor. Must not be NULL.
+ * \param[in] items The element pointers, or NULL when \p count is 0.
+ * \param[in] count The number of elements.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p element_type, or \p constant is NULL,
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT if \p items is NULL while
+ *         \p count is non-zero, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_constant_new_array(
+  struct cardano_uplc_arena_t*          arena,
+  const cardano_uplc_type_t*            element_type,
+  const cardano_uplc_constant_t* const* items,
+  size_t                                count,
+  cardano_uplc_constant_t**             constant);
+
+/**
+ * \brief Builds a multi-asset value constant from a normalized policy list.
+ *
+ * A value is stored exactly like a list (element type, item pointers and a count)
+ * but carries the \ref CARDANO_UPLC_TYPE_VALUE kind. Each item must be a pair whose
+ * first component is a byte-string policy and whose second component is a list of
+ * pairs of (byte-string token, integer amount). The caller is responsible for the
+ * invariants the V4 value builtins maintain (ascending keys, no duplicates, no zero
+ * amounts, no empty inner maps); this constructor stores the items by reference. An
+ * empty value is allowed with \p count 0 and \p items NULL. The \p element_type is
+ * the canonical value element type and must not be NULL.
+ *
+ * \param[in] arena The arena to allocate the constant from.
+ * \param[in] element_type The element type descriptor. Must not be NULL.
+ * \param[in] items The policy-entry pointers, or NULL when \p count is 0.
+ * \param[in] count The number of policy entries.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p element_type, or \p constant is NULL,
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT if \p items is NULL while \p count is
+ *         non-zero, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena
+ *         cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_constant_new_value(
+  struct cardano_uplc_arena_t*          arena,
+  const cardano_uplc_type_t*            element_type,
+  const cardano_uplc_constant_t* const* items,
+  size_t                                count,
+  cardano_uplc_constant_t**             constant);
+
+/**
+ * \brief Builds a typed pair constant from two arena-allocated components.
+ *
+ * \param[in] arena The arena to allocate the constant from.
+ * \param[in] fst The first component. Must not be NULL and must live in \p arena.
+ * \param[in] snd The second component. Must not be NULL and must live in \p arena.
+ * \param[out] constant On success, set to the new constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_constant_new_pair(
+  struct cardano_uplc_arena_t*   arena,
+  const cardano_uplc_constant_t* fst,
+  const cardano_uplc_constant_t* snd,
+  cardano_uplc_constant_t**      constant);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_CONSTANT_H */
diff --git a/vendor/src/uplc/ast/uplc_int.c b/vendor/src/uplc/ast/uplc_int.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_int.c
@@ -0,0 +1,335 @@
+/**
+ * \file uplc_int.c
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_int.h"
+
+#include "../arena/uplc_arena.h"
+#include "../data/uplc_data.h"
+
+#include <src/string_safe.h>
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Copies a byte span into the arena and writes the inline descriptor.
+ *
+ * Bump-allocates \p size bytes from \p arena and copies \p data into them, then
+ * stores the resulting pointer and length in \p out_data and \p out_size. An empty
+ * span allocates nothing and yields a NULL pointer with a zero size, the canonical
+ * empty byte string.
+ *
+ * \param[in] arena The arena the copy is allocated from.
+ * \param[in] data The bytes to copy, or NULL when \p size is 0.
+ * \param[in] size The number of bytes.
+ * \param[out] out_data On success, the arena pointer (NULL for an empty span).
+ * \param[out] out_size On success, the byte count.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve the
+ *         copy.
+ */
+static cardano_error_t
+copy_bytes(
+  cardano_uplc_arena_t* arena,
+  const byte_t*         data,
+  size_t                size,
+  const byte_t**        out_data,
+  size_t*               out_size)
+{
+  if (size == 0U)
+  {
+    *out_data = NULL;
+    *out_size = 0U;
+
+    return CARDANO_SUCCESS;
+  }
+
+  {
+    byte_t* copy = (byte_t*)cardano_uplc_arena_alloc(arena, size, 1U);
+
+    if (copy == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    cardano_safe_memcpy(copy, size, data, size);
+
+    *out_data = copy;
+    *out_size = size;
+
+    return CARDANO_SUCCESS;
+  }
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_uplc_constant_t*
+cardano_uplc_int_alloc_constant(cardano_uplc_arena_t* arena)
+{
+  cardano_uplc_constant_t* constant = (cardano_uplc_constant_t*)cardano_uplc_arena_alloc(arena, sizeof(cardano_uplc_constant_t), 0U);
+
+  return constant;
+}
+
+void
+cardano_uplc_int_unref_bigint(void* object)
+{
+  cardano_bigint_t* bigint = (cardano_bigint_t*)object;
+
+  cardano_bigint_unref(&bigint);
+}
+
+bool
+cardano_uplc_int_bigint_fits_int64(const cardano_bigint_t* value, int64_t* out)
+{
+  size_t bits = 0U;
+
+  if ((value == NULL) || (out == NULL))
+  {
+    return false;
+  }
+
+  bits = cardano_bigint_bit_length(value);
+
+  if (bits <= 63U)
+  {
+    *out = cardano_bigint_to_int(value);
+
+    return true;
+  }
+
+  if ((bits == 64U) && (cardano_bigint_signum(value) < 0))
+  {
+    const int64_t candidate = cardano_bigint_to_int(value);
+
+    if (candidate == (int64_t)INT64_MIN)
+    {
+      *out = candidate;
+
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool
+cardano_uplc_constant_int_is_small(const cardano_uplc_constant_t* constant)
+{
+  return constant->as.integer.is_small;
+}
+
+int64_t
+cardano_uplc_constant_int_small(const cardano_uplc_constant_t* constant)
+{
+  return constant->as.integer.small;
+}
+
+cardano_error_t
+cardano_uplc_constant_int_materialize(
+  cardano_uplc_arena_t*          arena,
+  const cardano_uplc_constant_t* constant,
+  const cardano_bigint_t**       out)
+{
+  // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+  cardano_uplc_constant_t* mutable_constant = (cardano_uplc_constant_t*)((void*)constant);
+  cardano_bigint_t*        built            = NULL;
+  cardano_error_t          error            = CARDANO_SUCCESS;
+
+  if (constant->as.integer.big != NULL)
+  {
+    *out = constant->as.integer.big;
+
+    return CARDANO_SUCCESS;
+  }
+
+  error = cardano_bigint_from_int(constant->as.integer.small, &built);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_uplc_arena_register_unref(arena, built, &cardano_uplc_int_unref_bigint);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_bigint_unref(&built);
+
+    return error;
+  }
+
+  mutable_constant->as.integer.big = built;
+  *out                             = built;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_int_constant_new_byte_string_copy(
+  cardano_uplc_arena_t*     arena,
+  const byte_t*             data,
+  size_t                    size,
+  cardano_uplc_constant_t** constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+  cardano_error_t          error  = CARDANO_SUCCESS;
+
+  if ((arena == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((data == NULL) && (size != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  error = copy_bytes(arena, data, size, &result->as.bytes.data, &result->as.bytes.size);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  result->kind = CARDANO_UPLC_TYPE_BYTE_STRING;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_int_constant_new_byte_string_take(
+  cardano_uplc_arena_t*     arena,
+  const byte_t*             data,
+  size_t                    size,
+  cardano_uplc_constant_t** constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+
+  if ((arena == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((data == NULL) && (size != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind          = CARDANO_UPLC_TYPE_BYTE_STRING;
+  result->as.bytes.data = (size == 0U) ? NULL : data;
+  result->as.bytes.size = size;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_int_constant_new_string_copy(
+  cardano_uplc_arena_t*     arena,
+  const byte_t*             data,
+  size_t                    size,
+  cardano_uplc_constant_t** constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+  cardano_error_t          error  = CARDANO_SUCCESS;
+
+  if ((arena == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((data == NULL) && (size != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  error = copy_bytes(arena, data, size, &result->as.string.data, &result->as.string.size);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  result->kind = CARDANO_UPLC_TYPE_STRING;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_int_constant_new_data_node(
+  cardano_uplc_arena_t*      arena,
+  const cardano_uplc_data_t* data,
+  cardano_uplc_constant_t**  constant)
+{
+  cardano_uplc_constant_t* result = NULL;
+
+  if ((arena == NULL) || (data == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_uplc_int_alloc_constant(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind    = CARDANO_UPLC_TYPE_DATA;
+  result->as.data = data;
+
+  *constant = result;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/ast/uplc_int.h b/vendor/src/uplc/ast/uplc_int.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_int.h
@@ -0,0 +1,239 @@
+/**
+ * \file uplc_int.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_INT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_INT_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_term.h"
+#include <cardano/common/bigint.h>
+#include <cardano/error.h>
+
+#include "../arena/uplc_arena.h"
+
+#include <stdbool.h>
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* FORWARD DECLARATIONS ******************************************************/
+
+/**
+ * \brief A VM-internal, arena-allocated Plutus-data node.
+ */
+struct cardano_uplc_data_t;
+
+/**
+ * \brief Allocates a zero-initialized constant node from the arena.
+ *
+ * Shared interior helper behind the constant constructors. The returned node is
+ * raw arena memory, not zeroed beyond what the arena guarantees, and is released
+ * with the arena. The \c cardano_uplc_int_ prefix marks it module-internal.
+ *
+ * \param[in] arena The arena to allocate from.
+ *
+ * \return The new constant node, or NULL if the arena cannot serve it.
+ */
+cardano_uplc_constant_t*
+cardano_uplc_int_alloc_constant(cardano_uplc_arena_t* arena);
+
+/**
+ * \brief Releases the arena's reference to a bigint registered for unref.
+ *
+ * The callback the constant constructors pass to
+ * \ref cardano_uplc_arena_register_unref so the arena drops its bigint reference
+ * on free. The \c cardano_uplc_int_ prefix marks it module-internal.
+ *
+ * \param[in] object The \ref cardano_bigint_t the arena owns a reference to.
+ */
+void
+cardano_uplc_int_unref_bigint(void* object);
+
+/**
+ * \brief Builds a data constant that wraps an arena-allocated data node directly.
+ *
+ * The node and the constant share \p arena and are released together; nothing is
+ * refcounted. This is the lean path the decoder, the text parser and the data
+ * builtins use to wrap an arena \c cardano_uplc_data_t without a round-trip through
+ * the library \ref cardano_plutus_data_t.
+ *
+ * \param[in] arena The arena to allocate the constant from. Must not be NULL.
+ * \param[in] data The arena data node. Must not be NULL and must live in \p arena.
+ * \param[out] constant On success, set to the new constant; untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if any
+ *         argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_int_constant_new_data_node(
+  cardano_uplc_arena_t*             arena,
+  const struct cardano_uplc_data_t* data,
+  cardano_uplc_constant_t**         constant);
+
+/**
+ * \brief Builds a byte-string constant by copying a raw byte span into the arena.
+ *
+ * The lean hot path behind every byte-string-producing builtin: it bump-allocates
+ * \p size bytes from \p arena, copies \p data into them, and stores the inline
+ * \c (data, size) descriptor directly in the constant. Nothing is refcounted and an
+ * empty span yields a NULL pointer with size 0.
+ *
+ * \param[in] arena The arena the constant and the byte copy are allocated from.
+ * \param[in] data The bytes to copy, or NULL when \p size is 0.
+ * \param[in] size The number of bytes.
+ * \param[out] constant On success, the new constant; untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p constant is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p data is NULL while \p size is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve the
+ *         node or the byte copy.
+ */
+cardano_error_t
+cardano_uplc_int_constant_new_byte_string_copy(
+  cardano_uplc_arena_t*     arena,
+  const byte_t*             data,
+  size_t                    size,
+  cardano_uplc_constant_t** constant);
+
+/**
+ * \brief Builds a UTF-8 string constant by copying a raw byte span into the arena.
+ *
+ * The string counterpart of \ref cardano_uplc_int_constant_new_byte_string_copy. The
+ * caller is responsible for having validated the UTF-8; this does not re-validate.
+ *
+ * \param[in] arena The arena the constant and the byte copy are allocated from.
+ * \param[in] data The UTF-8 bytes to copy, or NULL when \p size is 0.
+ * \param[in] size The number of bytes.
+ * \param[out] constant On success, the new constant; untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p constant is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p data is NULL while \p size is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve the
+ *         node or the byte copy.
+ */
+cardano_error_t
+cardano_uplc_int_constant_new_string_copy(
+  cardano_uplc_arena_t*     arena,
+  const byte_t*             data,
+  size_t                    size,
+  cardano_uplc_constant_t** constant);
+
+/**
+ * \brief Builds a byte-string constant that adopts an existing arena byte span.
+ *
+ * The zero-copy hot path: \p data must already live in \p arena (it is typically the
+ * scratch a bitwise or encoding builtin just filled), so the constant stores the
+ * pointer and length directly with no copy. An empty span stores a NULL pointer.
+ *
+ * \param[in] arena The arena the constant node is allocated from and that \p data
+ *            already belongs to.
+ * \param[in] data The arena bytes to adopt, or NULL when \p size is 0.
+ * \param[in] size The number of bytes.
+ * \param[out] constant On success, the new constant; untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p constant is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p data is NULL while \p size is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve the
+ *         node.
+ */
+cardano_error_t
+cardano_uplc_int_constant_new_byte_string_take(
+  cardano_uplc_arena_t*     arena,
+  const byte_t*             data,
+  size_t                    size,
+  cardano_uplc_constant_t** constant);
+
+/**
+ * \brief Tests whether a bigint fits exactly in a signed 64-bit integer.
+ *
+ * Handles the \c INT64_MIN edge (magnitude 2^63, bit length 64) explicitly: it is
+ * the one value with a 64-bit magnitude that still fits, so the cheap bit-length
+ * test alone would wrongly reject it.
+ *
+ * \param[in] value The bigint to test. Must not be NULL.
+ * \param[out] out On a fit, set to the \c int64_t value; untouched otherwise.
+ *
+ * \return \c true when \p value fits an \c int64_t, \c false otherwise.
+ */
+bool
+cardano_uplc_int_bigint_fits_int64(const cardano_bigint_t* value, int64_t* out);
+
+/**
+ * \brief Tests whether an integer constant is stored inline.
+ *
+ * \param[in] constant An integer constant. Must not be NULL.
+ *
+ * \return \c true when the value is stored inline as an \c int64_t, \c false when it
+ *         is stored as a \ref cardano_bigint_t.
+ */
+bool
+cardano_uplc_constant_int_is_small(const cardano_uplc_constant_t* constant);
+
+/**
+ * \brief Returns the inline value of a small integer constant.
+ *
+ * Only valid when \ref cardano_uplc_constant_int_is_small returns \c true.
+ *
+ * \param[in] constant A small integer constant. Must not be NULL.
+ *
+ * \return The inline \c int64_t value.
+ */
+int64_t
+cardano_uplc_constant_int_small(const cardano_uplc_constant_t* constant);
+
+/**
+ * \brief Returns the \ref cardano_bigint_t for any integer constant, building one
+ *        lazily for an inline value and caching it in the node.
+ *
+ * For a big constant this returns the stored bigint directly. For an inline
+ * constant it builds a bigint equal to the inline value, registers it with \p arena
+ * so the arena releases it, caches it in the node, and returns it; later calls
+ * return the cached pointer with no further allocation. The returned bigint is owned
+ * by the arena; the caller must not unref it.
+ *
+ * \param[in] arena The arena the lazily built bigint is registered with.
+ * \param[in] constant An integer constant. Must not be NULL.
+ * \param[out] out On success, the bigint view; untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a bigint cannot be built or
+ *         registered.
+ */
+cardano_error_t
+cardano_uplc_constant_int_materialize(
+  cardano_uplc_arena_t*          arena,
+  const cardano_uplc_constant_t* constant,
+  const cardano_bigint_t**       out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_INT_H */
diff --git a/vendor/src/uplc/ast/uplc_int_math.c b/vendor/src/uplc/ast/uplc_int_math.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_int_math.c
@@ -0,0 +1,93 @@
+/**
+ * \file uplc_int_math.c
+ *
+ * \author angel.castillo
+ * \date   Oct 31, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_int_math.h"
+
+/* DEFINITIONS ***************************************************************/
+
+bool
+cardano_uplc_i64_add_overflow(int64_t a, int64_t b, int64_t* result)
+{
+#if defined(_MSC_VER) && !defined(__clang__)
+  if (((b > 0) && (a > ((int64_t)INT64_MAX - b))) || ((b < 0) && (a < ((int64_t)(INT64_MIN)-b))))
+  {
+    return true;
+  }
+
+  *result = a + b;
+
+  return false;
+#else
+  return __builtin_add_overflow(a, b, result);
+#endif
+}
+
+bool
+cardano_uplc_i64_sub_overflow(int64_t a, int64_t b, int64_t* result)
+{
+#if defined(_MSC_VER) && !defined(__clang__)
+  if (((b > 0) && (a < ((int64_t)(INT64_MIN) + b))) || ((b < 0) && (a > ((int64_t)INT64_MAX + b))))
+  {
+    return true;
+  }
+
+  *result = a - b;
+
+  return false;
+#else
+  return __builtin_sub_overflow(a, b, result);
+#endif
+}
+
+bool
+cardano_uplc_i64_mul_overflow(int64_t a, int64_t b, int64_t* result)
+{
+#if defined(_MSC_VER) && !defined(__clang__)
+  if (a > 0)
+  {
+    if (((b > 0) && (a > ((int64_t)INT64_MAX / b))) || ((b < 0) && (b < ((int64_t)(INT64_MIN) / a))))
+    {
+      return true;
+    }
+  }
+  else if (a < 0)
+  {
+    if (((b > 0) && (a < ((int64_t)(INT64_MIN) / b))) || ((b < 0) && (a < ((int64_t)INT64_MAX / b))))
+    {
+      return true;
+    }
+  }
+  else
+  {
+    *result = 0;
+
+    return false;
+  }
+
+  *result = a * b;
+
+  return false;
+#else
+  return __builtin_mul_overflow(a, b, result);
+#endif
+}
diff --git a/vendor/src/uplc/ast/uplc_int_math.h b/vendor/src/uplc/ast/uplc_int_math.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_int_math.h
@@ -0,0 +1,78 @@
+/**
+ * \file uplc_int_math.h
+ *
+ * \author angel.castillo
+ * \date   Oct 31, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_INT_MATH_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_INT_MATH_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Adds two signed 64-bit integers and detects overflow.
+ *
+ * \param[in] a The first operand.
+ * \param[in] b The second operand.
+ * \param[out] result Receives the result when no overflow occurs. Must not be NULL.
+ *
+ * \return true if the mathematical result is outside the int64 range; false
+ *         otherwise. The value of \p result is unspecified on overflow.
+ */
+bool
+cardano_uplc_i64_add_overflow(int64_t a, int64_t b, int64_t* result);
+
+/**
+ * \brief Subtracts two signed 64-bit integers and detects overflow.
+ *
+ * \param[in] a The first operand.
+ * \param[in] b The second operand.
+ * \param[out] result Receives the result when no overflow occurs. Must not be NULL.
+ *
+ * \return true if the mathematical result is outside the int64 range; false
+ *         otherwise. The value of \p result is unspecified on overflow.
+ */
+bool
+cardano_uplc_i64_sub_overflow(int64_t a, int64_t b, int64_t* result);
+
+/**
+ * \brief Multiplies two signed 64-bit integers and detects overflow.
+ *
+ * \param[in] a The first operand.
+ * \param[in] b The second operand.
+ * \param[out] result Receives the result when no overflow occurs. Must not be NULL.
+ *
+ * \return true if the mathematical result is outside the int64 range; false
+ *         otherwise. The value of \p result is unspecified on overflow.
+ */
+bool
+cardano_uplc_i64_mul_overflow(int64_t a, int64_t b, int64_t* result);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_INT_MATH_H */
diff --git a/vendor/src/uplc/ast/uplc_lang_version.c b/vendor/src/uplc/ast/uplc_lang_version.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_lang_version.c
@@ -0,0 +1,131 @@
+/**
+ * \file uplc_lang_version.c
+ *
+ * \author angel.castillo
+ * \date   Oct 28, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_lang_version.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief The number of Plutus languages, V1 through V4.
+ */
+enum
+{
+  LANG_VERSION_COUNT = 4
+};
+
+/**
+ * \brief The number of Plutus Core program versions the ledger accepts.
+ */
+enum
+{
+  PLC_VERSION_COUNT = 3
+};
+
+/**
+ * \brief The protocol major version that enables each Plutus language, indexed by
+ *        \ref cardano_uplc_lang_version_t.
+ *
+ * Alonzo (5) for V1, Vasil (7) for V2, Chang (9) for V3 and Dijkstra (12) for V4.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t LANGUAGE_INTRODUCED_IN[LANG_VERSION_COUNT] = { 5U, 7U, 9U, 12U };
+
+/**
+ * \brief A Plutus Core program version and the protocol major version that makes
+ *        it available in each Plutus language.
+ */
+typedef struct
+{
+    uint32_t major;
+    uint32_t minor;
+    uint32_t patch;
+    uint64_t introduced_in[LANG_VERSION_COUNT];
+} plc_version_row_t;
+
+/**
+ * \brief The ledger's \c plcVersionsIntroducedIn table, one row per program
+ *        version, with the introduction protocol for V1, V2, V3 and V4.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const plc_version_row_t PLC_VERSIONS[PLC_VERSION_COUNT] = {
+  { 1U, 0U, 0U, { 5U, 7U, 9U, 12U } },
+  { 1U, 1U, 0U, { 11U, 11U, 9U, 12U } },
+  { 1U, 2U, 0U, { 12U, 12U, 12U, 12U } }
+};
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Reports whether a language value names one of V1 through V4.
+ *
+ * \param[in] language The language to check.
+ *
+ * \return \c true for a valid language, \c false otherwise.
+ */
+static bool
+is_valid_language(const cardano_uplc_lang_version_t language)
+{
+  return ((int)language >= 0) && ((size_t)language < (size_t)LANG_VERSION_COUNT);
+}
+
+/* DEFINITIONS ***************************************************************/
+
+bool
+cardano_uplc_lang_version_available(const cardano_uplc_lang_version_t language, const uint64_t protocol_major)
+{
+  if (!is_valid_language(language))
+  {
+    return false;
+  }
+
+  return protocol_major >= LANGUAGE_INTRODUCED_IN[(size_t)language];
+}
+
+bool
+cardano_uplc_plc_version_available(
+  const cardano_uplc_lang_version_t language,
+  const uint64_t                    protocol_major,
+  const uint32_t                    major,
+  const uint32_t                    minor,
+  const uint32_t                    patch)
+{
+  if (!is_valid_language(language))
+  {
+    return false;
+  }
+
+  for (size_t i = 0U; i < (size_t)PLC_VERSION_COUNT; ++i)
+  {
+    const plc_version_row_t* row = &PLC_VERSIONS[i];
+
+    if ((row->major == major) && (row->minor == minor) && (row->patch == patch))
+    {
+      return protocol_major >= row->introduced_in[(size_t)language];
+    }
+  }
+
+  return false;
+}
diff --git a/vendor/src/uplc/ast/uplc_lang_version.h b/vendor/src/uplc/ast/uplc_lang_version.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_lang_version.h
@@ -0,0 +1,102 @@
+/**
+ * \file uplc_lang_version.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_LANG_VERSION_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_LANG_VERSION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Plutus language version a builtin first became available in.
+ *
+ * This is a module-local version enum rather than
+ * \ref cardano_plutus_language_version_t because the shared enum stops at V3.
+ * Keeping a self-contained enum here lets the builtin metadata name V4 without
+ * modifying the shared, public version type. The numeric values match the shared
+ * enum (V1=0, V2=1, V3=2) and extend it with V4=3.
+ */
+typedef enum
+{
+  CARDANO_UPLC_LANG_VERSION_V1 = 0,
+  CARDANO_UPLC_LANG_VERSION_V2 = 1,
+  CARDANO_UPLC_LANG_VERSION_V3 = 2,
+  CARDANO_UPLC_LANG_VERSION_V4 = 3
+} cardano_uplc_lang_version_t;
+
+/**
+ * \brief Returns whether a Plutus language is enabled at a protocol version.
+ *
+ * Encodes the ledger's \c ledgerLanguageIntroducedIn schedule
+ * (plutus-ledger-api/src/PlutusLedgerApi/Common/Versions.hs): V1 from protocol 5,
+ * V2 from 7, V3 from 9 and V4 from 12. A script in a language that is not yet
+ * enabled cannot be deserialised.
+ *
+ * \param[in] language The Plutus language of the script.
+ * \param[in] protocol_major The major protocol version the script is used under.
+ *
+ * \return \c true when the language is enabled, \c false otherwise (including for
+ *         an invalid language).
+ */
+bool
+cardano_uplc_lang_version_available(cardano_uplc_lang_version_t language, uint64_t protocol_major);
+
+/**
+ * \brief Returns whether a Plutus Core program version may be evaluated in a
+ *        language at a protocol version.
+ *
+ * Encodes the ledger's \c plcVersionsIntroducedIn schedule
+ * (plutus-ledger-api/src/PlutusLedgerApi/Common/Versions.hs): 1.0.0 is available
+ * once the language is enabled, 1.1.0 is available in V1 and V2 from protocol 11
+ * and in V3 and V4 once they are enabled, and 1.2.0 is available in every
+ * language from protocol 12. Any other version triple is never available.
+ *
+ * \param[in] language The Plutus language of the script.
+ * \param[in] protocol_major The major protocol version the script is evaluated under.
+ * \param[in] major The major component of the program version.
+ * \param[in] minor The minor component of the program version.
+ * \param[in] patch The patch component of the program version.
+ *
+ * \return \c true when the program version is available, \c false otherwise
+ *         (including for an invalid language).
+ */
+bool
+cardano_uplc_plc_version_available(
+  cardano_uplc_lang_version_t language,
+  uint64_t                    protocol_major,
+  uint32_t                    major,
+  uint32_t                    minor,
+  uint32_t                    patch);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_LANG_VERSION_H */
diff --git a/vendor/src/uplc/ast/uplc_program.c b/vendor/src/uplc/ast/uplc_program.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_program.c
@@ -0,0 +1,392 @@
+/**
+ * \file uplc_program.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+
+#include "uplc_constant.h"
+#include "uplc_lang_version.h"
+#include "uplc_program.h"
+#include "uplc_term.h"
+
+#include "../arena/uplc_arena.h"
+#include "../flat/flat_decode.h"
+#include "../flat/flat_encode.h"
+#include "../flat/flat_reader.h"
+
+#include <cardano/buffer.h>
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Reads exactly one CBOR bytestring that consumes the whole reader.
+ *
+ * Succeeds only when the next item is a definite-length CBOR bytestring (major
+ * type 2) and, unless \p allow_trailing is set, the reader holds nothing after
+ * it. The indefinite-length form is rejected because it does not peek as a
+ * single bytestring item.
+ *
+ * \param[in] data The bytes to read. May be NULL only when \p size is 0.
+ * \param[in] size The number of bytes in \p data.
+ * \param[in] allow_trailing Whether bytes after the bytestring are ignored rather
+ *            than rejected.
+ * \param[out] inner On success, the decoded bytestring contents; the caller
+ *             releases it with \ref cardano_buffer_unref. Left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING when the
+ *         item is not a bytestring or is followed by bytes that are not allowed,
+ *         or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the reader or decoded
+ *         bytes cannot be allocated.
+ */
+static cardano_error_t
+peel_bytestring(const byte_t* data, const size_t size, const bool allow_trailing, cardano_buffer_t** inner)
+{
+  cardano_cbor_reader_t*      reader    = NULL;
+  cardano_buffer_t*           bytes     = NULL;
+  cardano_cbor_reader_state_t state     = CARDANO_CBOR_READER_STATE_UNDEFINED;
+  size_t                      remaining = 0U;
+  cardano_error_t             result    = CARDANO_SUCCESS;
+
+  if (size == 0U)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  reader = cardano_cbor_reader_new(data, size);
+
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_cbor_reader_peek_state(reader, &state);
+
+  if ((result != CARDANO_SUCCESS) || (state != CARDANO_CBOR_READER_STATE_BYTESTRING))
+  {
+    cardano_cbor_reader_unref(&reader);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = cardano_cbor_reader_read_bytestring(reader, &bytes);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_reader_unref(&reader);
+
+    return (result == CARDANO_ERROR_MEMORY_ALLOCATION_FAILED) ? result : CARDANO_ERROR_DECODING;
+  }
+
+  result = cardano_cbor_reader_get_bytes_remaining(reader, &remaining);
+
+  if ((result != CARDANO_SUCCESS) || ((remaining != 0U) && !allow_trailing))
+  {
+    cardano_buffer_unref(&bytes);
+    cardano_cbor_reader_unref(&reader);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  cardano_cbor_reader_unref(&reader);
+
+  *inner = bytes;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Initializes a flat reader over the contents of a buffer.
+ *
+ * \param[in] flat The flat-encoded program bytes.
+ * \param[out] reader The reader to initialize.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a propagated reader error.
+ */
+static cardano_error_t
+init_flat_reader(const cardano_buffer_t* flat, cardano_uplc_flat_reader_t* reader)
+{
+  return cardano_uplc_flat_reader_init(reader, cardano_buffer_get_data(flat), cardano_buffer_get_size(flat));
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_program_from_script_bytes(
+  cardano_uplc_arena_t*          arena,
+  const byte_t*                  script_bytes,
+  size_t                         size,
+  const cardano_uplc_program_t** program)
+{
+  cardano_buffer_t*          outer  = NULL;
+  cardano_uplc_flat_reader_t reader = { NULL, 0U, 0U, 0U };
+  cardano_error_t            result = CARDANO_SUCCESS;
+
+  if ((arena == NULL) || (program == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((script_bytes == NULL) && (size != 0U))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = peel_bytestring(script_bytes, size, false, &outer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = init_flat_reader(outer, &reader);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_flat_decode_program(arena, &reader, program);
+  }
+
+  cardano_buffer_unref(&outer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_uplc_program_from_ledger_script(
+  cardano_uplc_arena_t*             arena,
+  const byte_t*                     script_bytes,
+  const size_t                      size,
+  const cardano_uplc_lang_version_t language,
+  const uint64_t                    protocol_major,
+  const cardano_uplc_program_t**    program)
+{
+  cardano_buffer_t*          outer          = NULL;
+  cardano_uplc_flat_reader_t reader         = { NULL, 0U, 0U, 0U };
+  const bool                 allow_trailing = (language == CARDANO_UPLC_LANG_VERSION_V1) || (language == CARDANO_UPLC_LANG_VERSION_V2);
+  cardano_error_t            result         = CARDANO_SUCCESS;
+
+  if ((arena == NULL) || (program == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((script_bytes == NULL) && (size != 0U))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (!cardano_uplc_lang_version_available(language, protocol_major))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = peel_bytestring(script_bytes, size, allow_trailing, &outer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = init_flat_reader(outer, &reader);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_flat_decode_script_program(arena, &reader, language, protocol_major, program);
+  }
+
+  cardano_buffer_unref(&outer);
+
+  return result;
+}
+
+cardano_error_t
+cardano_uplc_flat_encode_program(
+  const cardano_uplc_program_t* program,
+  cardano_buffer_t**            out_flat)
+{
+  if ((program == NULL) || (program->term == NULL) || (out_flat == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return cardano_uplc_int_flat_encode_program(program, out_flat);
+}
+
+cardano_error_t
+cardano_uplc_program_to_cbor(
+  const cardano_uplc_program_t* program,
+  cardano_buffer_t**            out_cbor)
+{
+  cardano_buffer_t*      flat   = NULL;
+  cardano_cbor_writer_t* writer = NULL;
+  cardano_error_t        result = CARDANO_SUCCESS;
+
+  if ((program == NULL) || (program->term == NULL) || (out_cbor == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_uplc_flat_encode_program(program, &flat);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    cardano_buffer_unref(&flat);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_cbor_writer_write_bytestring(writer, cardano_buffer_get_data(flat), cardano_buffer_get_size(flat));
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_writer_encode_in_buffer(writer, out_cbor);
+  }
+
+  cardano_cbor_writer_unref(&writer);
+  cardano_buffer_unref(&flat);
+
+  return result;
+}
+
+cardano_error_t
+cardano_uplc_program_apply_data(
+  cardano_uplc_arena_t*         arena,
+  const cardano_uplc_program_t* program,
+  cardano_plutus_data_t*        param,
+  cardano_uplc_program_t**      out)
+{
+  cardano_uplc_program_t*  result        = NULL;
+  cardano_uplc_constant_t* data_constant = NULL;
+  cardano_uplc_term_t*     constant_term = NULL;
+  cardano_uplc_term_t*     apply_term    = NULL;
+  cardano_error_t          build_res     = CARDANO_SUCCESS;
+
+  if ((arena == NULL) || (program == NULL) || (program->term == NULL) || (param == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = (cardano_uplc_program_t*)cardano_uplc_arena_alloc(arena, sizeof(cardano_uplc_program_t), 0U);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  build_res = cardano_uplc_constant_new_data(arena, param, &data_constant);
+
+  if (build_res != CARDANO_SUCCESS)
+  {
+    return build_res;
+  }
+
+  build_res = cardano_uplc_term_new_constant(arena, data_constant, &constant_term);
+
+  if (build_res != CARDANO_SUCCESS)
+  {
+    return build_res;
+  }
+
+  build_res = cardano_uplc_term_new_apply(arena, program->term, constant_term, &apply_term);
+
+  if (build_res != CARDANO_SUCCESS)
+  {
+    return build_res;
+  }
+
+  result->version_major = program->version_major;
+  result->version_minor = program->version_minor;
+  result->version_patch = program->version_patch;
+  result->term          = apply_term;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_program_apply_data_params(
+  cardano_uplc_arena_t*         arena,
+  const cardano_uplc_program_t* program,
+  cardano_plutus_data_t* const* params,
+  size_t                        count,
+  cardano_uplc_program_t**      out)
+{
+  cardano_uplc_program_t* current = NULL;
+  cardano_uplc_program_t* applied = NULL;
+  size_t                  i       = 0U;
+
+  if ((arena == NULL) || (program == NULL) || (program->term == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((params == NULL) && (count != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  current = (cardano_uplc_program_t*)cardano_uplc_arena_alloc(arena, sizeof(cardano_uplc_program_t), 0U);
+
+  if (current == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  current->version_major = program->version_major;
+  current->version_minor = program->version_minor;
+  current->version_patch = program->version_patch;
+  current->term          = program->term;
+
+  for (i = 0U; i < count; ++i)
+  {
+    cardano_error_t apply_res;
+
+    if (params[i] == NULL)
+    {
+      return CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    apply_res = cardano_uplc_program_apply_data(arena, current, params[i], &applied);
+
+    if (apply_res != CARDANO_SUCCESS)
+    {
+      return apply_res;
+    }
+
+    current = applied;
+  }
+
+  *out = current;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/ast/uplc_program.h b/vendor/src/uplc/ast/uplc_program.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_program.h
@@ -0,0 +1,267 @@
+/**
+ * \file uplc_program.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_PROGRAM_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_PROGRAM_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../arena/uplc_arena.h"
+#include "uplc_lang_version.h"
+#include "uplc_term.h"
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A decoded program: a version triple and its top-level term.
+ */
+typedef struct cardano_uplc_program_t
+{
+    uint32_t                   version_major;
+    uint32_t                   version_minor;
+    uint32_t                   version_patch;
+    const cardano_uplc_term_t* term;
+} cardano_uplc_program_t;
+
+/**
+ * \brief Decodes on-chain Plutus script bytes into an arena-allocated program.
+ *
+ * This entry expects the ledger witness-set form: the flat-encoded program
+ * wrapped in exactly one CBOR bytestring (CBOR major type 2). It peels that one
+ * bytestring and runs the flat program decoder on the resulting flat bytes,
+ * peeling exactly one CBOR layer as the consensus encoding prescribes.
+ *
+ * Only the single-CBOR-wrapped form is accepted. Raw (unwrapped) flat bytes are
+ * not accepted: the leading byte is read as a CBOR major-type-2 header, so a raw
+ * program is rejected with \ref CARDANO_ERROR_DECODING. Double-CBOR-wrapped bytes
+ * are likewise not accepted: after one peel the buffer is still a CBOR bytestring
+ * rather than valid flat, so the flat decoder rejects it. A caller that holds
+ * such a script knows its wrapping and removes the extra layer before calling.
+ *
+ * The returned program and its whole term tree are owned by \p arena; a single
+ * \ref cardano_uplc_arena_free releases everything regardless of the exit path.
+ * Every intermediate buffer the peeling produces is released before this returns.
+ *
+ * \param[in] arena The arena every node and interior object is allocated from.
+ * \param[in] script_bytes The raw on-chain script bytes. May be NULL only when
+ *            \p size is 0.
+ * \param[in] size The number of bytes in \p script_bytes.
+ * \param[out] program On success, the decoded program; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p program is NULL, or if \p script_bytes is NULL while
+ *         \p size is non-zero, \ref CARDANO_ERROR_DECODING for malformed CBOR, an
+ *         outer item that is not a bytestring, trailing bytes after the outer
+ *         bytestring, or a flat program that fails to decode, including one that
+ *         carries a BLS12-381 constant value, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena or an interior
+ *         object cannot be allocated.
+ */
+cardano_error_t
+cardano_uplc_program_from_script_bytes(
+  struct cardano_uplc_arena_t*   arena,
+  const byte_t*                  script_bytes,
+  size_t                         size,
+  const cardano_uplc_program_t** program);
+
+/**
+ * \brief Deserialises an on-chain Plutus script the way the ledger does for a
+ *        language at a protocol version.
+ *
+ * Mirrors \c deserialiseScript
+ * (plutus-ledger-api/src/PlutusLedgerApi/Common/SerialisedScript.hs). The
+ * language must be enabled at \p protocol_major
+ * (\ref cardano_uplc_lang_version_available). The script bytes are one CBOR
+ * bytestring, as for \ref cardano_uplc_program_from_script_bytes, except that V1
+ * and V2 scripts may carry trailing bytes after it, which are ignored; V3 and V4
+ * scripts with trailing bytes are rejected. The flat program is decoded with the
+ * ledger's script checks (\ref cardano_uplc_flat_decode_script_program): builtin
+ * availability, the constant type header limit and the \c constr field limit.
+ *
+ * The Plutus Core version of the program is not checked here; the ledger checks
+ * it before evaluation (\ref cardano_uplc_plc_version_available).
+ *
+ * \param[in] arena The arena every node and interior object is allocated from.
+ * \param[in] script_bytes The raw on-chain script bytes. May be NULL only when
+ *            \p size is 0.
+ * \param[in] size The number of bytes in \p script_bytes.
+ * \param[in] language The Plutus language of the script.
+ * \param[in] protocol_major The major protocol version the script is used under.
+ * \param[out] program On success, the decoded program; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p program is NULL, or if \p script_bytes is NULL while
+ *         \p size is non-zero, \ref CARDANO_ERROR_DECODING when the script cannot
+ *         be deserialised for \p language at \p protocol_major, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena or an interior
+ *         object cannot be allocated.
+ */
+cardano_error_t
+cardano_uplc_program_from_ledger_script(
+  struct cardano_uplc_arena_t*   arena,
+  const byte_t*                  script_bytes,
+  size_t                         size,
+  cardano_uplc_lang_version_t    language,
+  uint64_t                       protocol_major,
+  const cardano_uplc_program_t** program);
+
+/**
+ * \brief Flat-encodes a program into a newly allocated byte buffer.
+ *
+ * The exact inverse of \ref cardano_uplc_flat_decode_program. The three version
+ * words are written, then the term, then a byte-aligning filler. The output is the
+ * canonical flat byte stream, so a program obtained by decoding flat bytes encodes
+ * back to those same bytes, and the result is a fixed point under a second
+ * decode-encode pass.
+ *
+ * BLS12-381 G1, G2 and Miller-loop-result values have no flat serialization (the
+ * reference encoder and decoder both refuse them), so a program carrying one is
+ * rejected here with \ref CARDANO_ERROR_INVALID_ARGUMENT rather than producing
+ * bytes that could not be decoded back.
+ *
+ * \param[in] program The program to encode. Must not be NULL and must carry a
+ *            non-NULL term.
+ * \param[out] out_flat On success, the flat bytes; the caller releases them with
+ *             \ref cardano_buffer_unref. Left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p program, its term, or \p out_flat is NULL,
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT for an unknown term kind or a
+ *         constant kind with no flat serialization, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a buffer cannot be grown.
+ */
+cardano_error_t
+cardano_uplc_flat_encode_program(
+  const cardano_uplc_program_t* program,
+  cardano_buffer_t**            out_flat);
+
+/**
+ * \brief Flat-encodes a program and wraps it in a single CBOR bytestring.
+ *
+ * Runs \ref cardano_uplc_flat_encode_program and wraps the resulting flat bytes in
+ * exactly one CBOR bytestring (CBOR major type 2) through
+ * \ref cardano_cbor_writer_write_bytestring, producing the ledger witness-set form
+ * that \ref cardano_uplc_program_from_script_bytes consumes.
+ *
+ * \param[in] program The program to encode. Must not be NULL and must carry a
+ *            non-NULL term.
+ * \param[out] out_cbor On success, the CBOR-wrapped flat bytes; the caller releases
+ *             them with \ref cardano_buffer_unref. Left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p program, its term, or \p out_cbor is NULL,
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT for a constant kind with no flat
+ *         serialization, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a buffer
+ *         or the CBOR writer cannot be allocated.
+ */
+cardano_error_t
+cardano_uplc_program_to_cbor(
+  const cardano_uplc_program_t* program,
+  cardano_buffer_t**            out_cbor);
+
+/**
+ * \brief Applies a single Plutus-data parameter to a program.
+ *
+ * Produces a new program with the same version as \p program and a term that
+ * wraps the original in one application of a data constant:
+ * \c Apply(program->term, Constant(Data(param))). This is how a parameterized
+ * validator binds a compile-time parameter before evaluation.
+ *
+ * Ownership: the new program, its application term, the constant term and the
+ * data constant are all allocated from \p arena, and the original
+ * \p program->term is shared by reference (it is not copied). The data constant
+ * registers \p param with \p arena, which takes its own reference; the caller
+ * keeps the reference it passed in and must still release it. A single
+ * \ref cardano_uplc_arena_free releases the new program and its new nodes. Both
+ * \p program and the result share \p arena, so they stay valid for the same
+ * lifetime.
+ *
+ * \param[in] arena The arena every new node is allocated from. Must not be NULL.
+ * \param[in] program The program to wrap. Must not be NULL, must carry a non-NULL
+ *            term, and must live in \p arena.
+ * \param[in] param The data parameter to apply. Must not be NULL.
+ * \param[out] out On success, set to the new program; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p program, \p program->term, \p param, or \p out is NULL,
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve a
+ *         node, or \ref CARDANO_ERROR_ILLEGAL_STATE if the arena is past its byte
+ *         ceiling.
+ */
+cardano_error_t
+cardano_uplc_program_apply_data(
+  struct cardano_uplc_arena_t*  arena,
+  const cardano_uplc_program_t* program,
+  cardano_plutus_data_t*        param,
+  cardano_uplc_program_t**      out);
+
+/**
+ * \brief Applies a list of Plutus-data parameters to a program, left to right.
+ *
+ * Folds \ref cardano_uplc_program_apply_data over \p params in order, so the
+ * resulting term is \c [[...[term p0] p1] ... pn]: \c params[0] is applied first
+ * and becomes the innermost argument, so a left-to-right list of datum, redeemer
+ * and script context is applied in that order. With \p count 0 the result is a
+ * new program equal to \p program (same version, same term, no wrapping).
+ *
+ * Ownership: identical to \ref cardano_uplc_program_apply_data applied \p count
+ * times. Every intermediate and the final program live in \p arena; each
+ * parameter is registered with \p arena, which takes its own reference, and the
+ * caller keeps the references it passed in.
+ *
+ * \param[in] arena The arena every new node is allocated from. Must not be NULL.
+ * \param[in] program The program to wrap. Must not be NULL, must carry a non-NULL
+ *            term, and must live in \p arena.
+ * \param[in] params The data parameters, or NULL when \p count is 0. No element
+ *            may be NULL.
+ * \param[in] count The number of parameters.
+ * \param[out] out On success, set to the new program; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p program, \p program->term, \p out, or any element of
+ *         \p params is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if \p params is
+ *         NULL while \p count is non-zero,
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve a
+ *         node, or \ref CARDANO_ERROR_ILLEGAL_STATE if the arena is past its byte
+ *         ceiling.
+ */
+cardano_error_t
+cardano_uplc_program_apply_data_params(
+  struct cardano_uplc_arena_t*  arena,
+  const cardano_uplc_program_t* program,
+  cardano_plutus_data_t* const* params,
+  size_t                        count,
+  cardano_uplc_program_t**      out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_PROGRAM_H */
diff --git a/vendor/src/uplc/ast/uplc_scope_check_mode.h b/vendor/src/uplc/ast/uplc_scope_check_mode.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_scope_check_mode.h
@@ -0,0 +1,55 @@
+/**
+ * \file uplc_scope_check_mode.h
+ *
+ * \author angel.castillo
+ * \date   Oct 28, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_SCOPE_CHECK_MODE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_SCOPE_CHECK_MODE_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Which subterms the scope check of a term visits.
+ *
+ * The ledger checks that a script is closed before evaluating it. Before the
+ * Dijkstra protocol version that check did not look inside \c constr and \c case
+ * terms, so a free variable there was only caught if the machine reached it; from
+ * Dijkstra on every subterm is checked.
+ */
+typedef enum
+{
+  /** \brief Skips the fields of \c constr and the scrutinee and branches of \c case. */
+  CARDANO_UPLC_SCOPE_CHECK_NO_CASE_CONSTR = 0,
+  /** \brief Checks every subterm. */
+  CARDANO_UPLC_SCOPE_CHECK_FULL = 1
+} cardano_uplc_scope_check_mode_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_SCOPE_CHECK_MODE_H */
diff --git a/vendor/src/uplc/ast/uplc_term.c b/vendor/src/uplc/ast/uplc_term.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_term.c
@@ -0,0 +1,430 @@
+/**
+ * \file uplc_term.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_term.h"
+
+#include "../arena/uplc_arena.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Allocates a zero-initialized term from the arena.
+ *
+ * \param[in] arena The arena to allocate from.
+ *
+ * \return The new term, or NULL if the arena cannot serve the node.
+ */
+static cardano_uplc_term_t*
+alloc_term(cardano_uplc_arena_t* arena)
+{
+  cardano_uplc_term_t* term = (cardano_uplc_term_t*)cardano_uplc_arena_alloc(arena, sizeof(cardano_uplc_term_t), 0U);
+
+  return term;
+}
+
+/**
+ * \brief Checks that a term is closed under a number of enclosing lambdas.
+ *
+ * \param[in] term The term to check.
+ * \param[in] level The number of lambdas that enclose \p term.
+ * \param[in] mode Which subterms to visit.
+ *
+ * \return \c true when no visited variable is free, \c false otherwise.
+ */
+static bool
+is_closed_at(const cardano_uplc_term_t* term, const uint64_t level, const cardano_uplc_scope_check_mode_t mode)
+{
+  bool closed = true;
+
+  switch (term->kind)
+  {
+    case CARDANO_UPLC_TERM_VAR:
+    {
+      closed = (term->as.var_index >= 1U) && (term->as.var_index <= level);
+      break;
+    }
+    case CARDANO_UPLC_TERM_LAMBDA:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      closed = is_closed_at(term->as.unary, level + 1U, mode);
+      break;
+    }
+    case CARDANO_UPLC_TERM_DELAY:
+    case CARDANO_UPLC_TERM_FORCE:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      closed = is_closed_at(term->as.unary, level, mode);
+      break;
+    }
+    case CARDANO_UPLC_TERM_APPLY:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      closed = is_closed_at(term->as.apply.function, level, mode) && is_closed_at(term->as.apply.argument, level, mode);
+      break;
+    }
+    case CARDANO_UPLC_TERM_CONSTR:
+    {
+      for (size_t i = 0U; (mode == CARDANO_UPLC_SCOPE_CHECK_FULL) && closed && (i < term->as.constr.field_count); ++i)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        closed = is_closed_at(term->as.constr.fields[i], level, mode);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TERM_CASE:
+    {
+      if (mode == CARDANO_UPLC_SCOPE_CHECK_FULL)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        closed = is_closed_at(term->as.cases.scrutinee, level, mode);
+      }
+
+      for (size_t i = 0U; (mode == CARDANO_UPLC_SCOPE_CHECK_FULL) && closed && (i < term->as.cases.branch_count); ++i)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        closed = is_closed_at(term->as.cases.branches[i], level, mode);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TERM_CONSTANT:
+    case CARDANO_UPLC_TERM_ERROR:
+    case CARDANO_UPLC_TERM_BUILTIN:
+    default:
+    {
+      break;
+    }
+  }
+
+  return closed;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_term_new_var(
+  cardano_uplc_arena_t* arena,
+  uint64_t              index,
+  cardano_uplc_term_t** term)
+{
+  cardano_uplc_term_t* result = NULL;
+
+  if ((arena == NULL) || (term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_term(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind         = CARDANO_UPLC_TERM_VAR;
+  result->as.var_index = index;
+
+  *term = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_term_new_delay(
+  cardano_uplc_arena_t*      arena,
+  const cardano_uplc_term_t* body,
+  cardano_uplc_term_t**      term)
+{
+  cardano_uplc_term_t* result = NULL;
+
+  if ((arena == NULL) || (body == NULL) || (term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_term(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind     = CARDANO_UPLC_TERM_DELAY;
+  result->as.unary = body;
+
+  *term = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_term_new_lambda(
+  cardano_uplc_arena_t*      arena,
+  const cardano_uplc_term_t* body,
+  cardano_uplc_term_t**      term)
+{
+  cardano_uplc_term_t* result = NULL;
+
+  if ((arena == NULL) || (body == NULL) || (term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_term(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind     = CARDANO_UPLC_TERM_LAMBDA;
+  result->as.unary = body;
+
+  *term = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_term_new_apply(
+  cardano_uplc_arena_t*      arena,
+  const cardano_uplc_term_t* function,
+  const cardano_uplc_term_t* argument,
+  cardano_uplc_term_t**      term)
+{
+  cardano_uplc_term_t* result = NULL;
+
+  if ((arena == NULL) || (function == NULL) || (argument == NULL) || (term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_term(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind              = CARDANO_UPLC_TERM_APPLY;
+  result->as.apply.function = function;
+  result->as.apply.argument = argument;
+
+  *term = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_term_new_constant(
+  cardano_uplc_arena_t*          arena,
+  const cardano_uplc_constant_t* constant,
+  cardano_uplc_term_t**          term)
+{
+  cardano_uplc_term_t* result = NULL;
+
+  if ((arena == NULL) || (constant == NULL) || (term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_term(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind        = CARDANO_UPLC_TERM_CONSTANT;
+  result->as.constant = constant;
+
+  *term = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_term_new_force(
+  cardano_uplc_arena_t*      arena,
+  const cardano_uplc_term_t* body,
+  cardano_uplc_term_t**      term)
+{
+  cardano_uplc_term_t* result = NULL;
+
+  if ((arena == NULL) || (body == NULL) || (term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_term(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind     = CARDANO_UPLC_TERM_FORCE;
+  result->as.unary = body;
+
+  *term = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_term_new_error(
+  cardano_uplc_arena_t* arena,
+  cardano_uplc_term_t** term)
+{
+  cardano_uplc_term_t* result = NULL;
+
+  if ((arena == NULL) || (term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_term(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind = CARDANO_UPLC_TERM_ERROR;
+
+  *term = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_term_new_builtin(
+  cardano_uplc_arena_t*  arena,
+  cardano_uplc_builtin_t builtin,
+  cardano_uplc_term_t**  term)
+{
+  cardano_uplc_term_t* result = NULL;
+
+  if ((arena == NULL) || (term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_term(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind       = CARDANO_UPLC_TERM_BUILTIN;
+  result->as.builtin = builtin;
+
+  *term = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_term_new_constr(
+  cardano_uplc_arena_t*             arena,
+  uint64_t                          tag,
+  const cardano_uplc_term_t* const* fields,
+  size_t                            field_count,
+  cardano_uplc_term_t**             term)
+{
+  cardano_uplc_term_t* result = NULL;
+
+  if ((arena == NULL) || (term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((fields == NULL) && (field_count != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = alloc_term(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                  = CARDANO_UPLC_TERM_CONSTR;
+  result->as.constr.tag         = tag;
+  result->as.constr.fields      = fields;
+  result->as.constr.field_count = field_count;
+
+  *term = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_term_new_case(
+  cardano_uplc_arena_t*             arena,
+  const cardano_uplc_term_t*        scrutinee,
+  const cardano_uplc_term_t* const* branches,
+  size_t                            branch_count,
+  cardano_uplc_term_t**             term)
+{
+  cardano_uplc_term_t* result = NULL;
+
+  if ((arena == NULL) || (scrutinee == NULL) || (term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((branches == NULL) && (branch_count != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = alloc_term(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                  = CARDANO_UPLC_TERM_CASE;
+  result->as.cases.scrutinee    = scrutinee;
+  result->as.cases.branches     = branches;
+  result->as.cases.branch_count = branch_count;
+
+  *term = result;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_uplc_term_is_closed(const cardano_uplc_term_t* term, const cardano_uplc_scope_check_mode_t mode)
+{
+  return is_closed_at(term, 0U, mode);
+}
diff --git a/vendor/src/uplc/ast/uplc_term.h b/vendor/src/uplc/ast/uplc_term.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_term.h
@@ -0,0 +1,302 @@
+/**
+ * \file uplc_term.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TERM_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TERM_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../arena/uplc_arena.h"
+#include "../builtins/uplc_builtin.h"
+#include "uplc_constant.h"
+#include "uplc_scope_check_mode.h"
+#include "uplc_term_kind.h"
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief An immutable Untyped Plutus Core term, tagged by its term kind.
+ *
+ * Variables are de Bruijn indices, so terms carry no binder names: a lambda
+ * stores only its body and introduces one de Bruijn level. The \c kind selects
+ * the active union arm; never read an arm the kind does not select. Terms are
+ * allocated from an arena and are immutable after construction.
+ */
+typedef struct cardano_uplc_term_t
+{
+    cardano_uplc_term_kind_t kind;
+
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        uint64_t                          var_index;
+        const struct cardano_uplc_term_t* unary;
+        const cardano_uplc_constant_t*    constant;
+        cardano_uplc_builtin_t            builtin;
+
+        struct
+        {
+            const struct cardano_uplc_term_t* function;
+            const struct cardano_uplc_term_t* argument;
+        } apply;
+
+        struct
+        {
+            uint64_t                                 tag;
+            const struct cardano_uplc_term_t* const* fields;
+            size_t                                   field_count;
+        } constr;
+
+        struct
+        {
+            const struct cardano_uplc_term_t*        scrutinee;
+            const struct cardano_uplc_term_t* const* branches;
+            size_t                                   branch_count;
+        } cases;
+
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } as;
+} cardano_uplc_term_t;
+
+/**
+ * \brief Builds a variable term from a de Bruijn index.
+ *
+ * \param[in] arena The arena to allocate the term from.
+ * \param[in] index The de Bruijn index; 1 names the innermost binder.
+ * \param[out] term On success, set to the new term; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p term is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_term_new_var(
+  struct cardano_uplc_arena_t* arena,
+  uint64_t                     index,
+  cardano_uplc_term_t**        term);
+
+/**
+ * \brief Builds a delay term wrapping a body term.
+ *
+ * \param[in] arena The arena to allocate the term from.
+ * \param[in] body The delayed body. Must not be NULL and must live in \p arena.
+ * \param[out] term On success, set to the new term; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_term_new_delay(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_term_t*   body,
+  cardano_uplc_term_t**        term);
+
+/**
+ * \brief Builds a lambda term wrapping a body term.
+ *
+ * The binder is implicit: the lambda introduces one de Bruijn level and stores
+ * only \p body.
+ *
+ * \param[in] arena The arena to allocate the term from.
+ * \param[in] body The lambda body. Must not be NULL and must live in \p arena.
+ * \param[out] term On success, set to the new term; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_term_new_lambda(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_term_t*   body,
+  cardano_uplc_term_t**        term);
+
+/**
+ * \brief Builds an application term from a function and an argument.
+ *
+ * \param[in] arena The arena to allocate the term from.
+ * \param[in] function The function term. Must not be NULL and must live in \p arena.
+ * \param[in] argument The argument term. Must not be NULL and must live in \p arena.
+ * \param[out] term On success, set to the new term; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_term_new_apply(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_term_t*   function,
+  const cardano_uplc_term_t*   argument,
+  cardano_uplc_term_t**        term);
+
+/**
+ * \brief Builds a constant term wrapping a constant.
+ *
+ * \param[in] arena The arena to allocate the term from.
+ * \param[in] constant The constant. Must not be NULL and must live in \p arena.
+ * \param[out] term On success, set to the new term; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_term_new_constant(
+  struct cardano_uplc_arena_t*   arena,
+  const cardano_uplc_constant_t* constant,
+  cardano_uplc_term_t**          term);
+
+/**
+ * \brief Builds a force term wrapping a body term.
+ *
+ * \param[in] arena The arena to allocate the term from.
+ * \param[in] body The forced body. Must not be NULL and must live in \p arena.
+ * \param[out] term On success, set to the new term; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_term_new_force(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_term_t*   body,
+  cardano_uplc_term_t**        term);
+
+/**
+ * \brief Builds the error term.
+ *
+ * \param[in] arena The arena to allocate the term from.
+ * \param[out] term On success, set to the new term; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p term is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_term_new_error(
+  struct cardano_uplc_arena_t* arena,
+  cardano_uplc_term_t**        term);
+
+/**
+ * \brief Builds a builtin term naming a default function.
+ *
+ * \param[in] arena The arena to allocate the term from.
+ * \param[in] builtin The builtin tag.
+ * \param[out] term On success, set to the new term; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p term is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_term_new_builtin(
+  struct cardano_uplc_arena_t* arena,
+  cardano_uplc_builtin_t       builtin,
+  cardano_uplc_term_t**        term);
+
+/**
+ * \brief Builds a constructor term from a tag and a field array.
+ *
+ * The \p fields array and the terms it points at must already live in \p arena.
+ * An empty constructor is allowed with \p field_count 0 and \p fields NULL.
+ *
+ * \param[in] arena The arena to allocate the term from.
+ * \param[in] tag The constructor tag.
+ * \param[in] fields The field pointers, or NULL when \p field_count is 0.
+ * \param[in] field_count The number of fields.
+ * \param[out] term On success, set to the new term; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p term is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p fields is NULL while \p field_count is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_term_new_constr(
+  struct cardano_uplc_arena_t*      arena,
+  uint64_t                          tag,
+  const cardano_uplc_term_t* const* fields,
+  size_t                            field_count,
+  cardano_uplc_term_t**             term);
+
+/**
+ * \brief Builds a case term from a scrutinee and a branch array.
+ *
+ * The \p branches array and the terms it points at must already live in \p arena.
+ * A case with no branches is allowed with \p branch_count 0 and \p branches NULL.
+ *
+ * \param[in] arena The arena to allocate the term from.
+ * \param[in] scrutinee The scrutinee term. Must not be NULL and must live in \p arena.
+ * \param[in] branches The branch pointers, or NULL when \p branch_count is 0.
+ * \param[in] branch_count The number of branches.
+ * \param[out] term On success, set to the new term; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p scrutinee, or \p term is NULL,
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT if \p branches is NULL while
+ *         \p branch_count is non-zero, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *         if the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_term_new_case(
+  struct cardano_uplc_arena_t*      arena,
+  const cardano_uplc_term_t*        scrutinee,
+  const cardano_uplc_term_t* const* branches,
+  size_t                            branch_count,
+  cardano_uplc_term_t**             term);
+
+/**
+ * \brief Returns whether a term is closed, the scope check the ledger runs on a
+ * script before evaluating it.
+ *
+ * A term is closed when every variable is bound by an enclosing lambda, that is
+ * when each de Bruijn index is at least 1 and at most the number of lambdas
+ * around it. With \ref CARDANO_UPLC_SCOPE_CHECK_NO_CASE_CONSTR the fields of
+ * \c constr terms and the scrutinee and branches of \c case terms are not
+ * visited. Recursion follows the term nesting, which the decoders bound.
+ *
+ * \param[in] term The term to check. Must not be NULL.
+ * \param[in] mode Which subterms to visit.
+ *
+ * \return \c true when no visited variable is free, \c false otherwise.
+ */
+bool
+cardano_uplc_term_is_closed(const cardano_uplc_term_t* term, cardano_uplc_scope_check_mode_t mode);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TERM_H */
diff --git a/vendor/src/uplc/ast/uplc_term_kind.h b/vendor/src/uplc/ast/uplc_term_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_term_kind.h
@@ -0,0 +1,71 @@
+/**
+ * \file uplc_term_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TERM_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TERM_KIND_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The kind of an Untyped Plutus Core term.
+ *
+ * The integer value of each enumerator is the 4-bit flat-encoding tag the
+ * decoder reads for that term form, so the enum doubles as the authoritative
+ * term-tag list the decoder and the CEK machine switch on. The tags are fixed by
+ * the protocol. \c Constr and \c Case exist from Plutus V3 on.
+ */
+typedef enum
+{
+  /** \brief A de Bruijn-indexed variable. */
+  CARDANO_UPLC_TERM_VAR = 0,
+  /** \brief A delayed computation. */
+  CARDANO_UPLC_TERM_DELAY = 1,
+  /** \brief A lambda abstraction with an implicit binder. */
+  CARDANO_UPLC_TERM_LAMBDA = 2,
+  /** \brief A function application. */
+  CARDANO_UPLC_TERM_APPLY = 3,
+  /** \brief A constant of the constant universe. */
+  CARDANO_UPLC_TERM_CONSTANT = 4,
+  /** \brief Forcing of a delayed computation. */
+  CARDANO_UPLC_TERM_FORCE = 5,
+  /** \brief The error term. */
+  CARDANO_UPLC_TERM_ERROR = 6,
+  /** \brief A reference to a default (builtin) function. */
+  CARDANO_UPLC_TERM_BUILTIN = 7,
+  /** \brief A constructor with a tag and a field list (V3+). */
+  CARDANO_UPLC_TERM_CONSTR = 8,
+  /** \brief A case expression over a scrutinee and branch list (V3+). */
+  CARDANO_UPLC_TERM_CASE = 9
+} cardano_uplc_term_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TERM_KIND_H */
diff --git a/vendor/src/uplc/ast/uplc_type.c b/vendor/src/uplc/ast/uplc_type.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_type.c
@@ -0,0 +1,111 @@
+/**
+ * \file uplc_type.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_type.h"
+
+#include "../arena/uplc_arena.h"
+
+#include <stddef.h>
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_type_new(
+  cardano_uplc_arena_t*      arena,
+  cardano_uplc_type_kind_t   kind,
+  const cardano_uplc_type_t* fst,
+  const cardano_uplc_type_t* snd,
+  cardano_uplc_type_t**      type)
+{
+  cardano_uplc_type_t* result = NULL;
+
+  if ((arena == NULL) || (type == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  switch (kind)
+  {
+    case CARDANO_UPLC_TYPE_LIST:
+    case CARDANO_UPLC_TYPE_ARRAY:
+    {
+      if (fst == NULL)
+      {
+        return CARDANO_ERROR_POINTER_IS_NULL;
+      }
+
+      if (snd != NULL)
+      {
+        return CARDANO_ERROR_INVALID_ARGUMENT;
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      if ((fst == NULL) || (snd == NULL))
+      {
+        return CARDANO_ERROR_POINTER_IS_NULL;
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_INTEGER:
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    case CARDANO_UPLC_TYPE_STRING:
+    case CARDANO_UPLC_TYPE_UNIT:
+    case CARDANO_UPLC_TYPE_BOOL:
+    case CARDANO_UPLC_TYPE_DATA:
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    case CARDANO_UPLC_TYPE_VALUE:
+    {
+      if ((fst != NULL) || (snd != NULL))
+      {
+        return CARDANO_ERROR_INVALID_ARGUMENT;
+      }
+
+      break;
+    }
+    default:
+    {
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+
+  result = (cardano_uplc_type_t*)cardano_uplc_arena_alloc(arena, sizeof(cardano_uplc_type_t), 0U);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind = kind;
+  result->fst  = fst;
+  result->snd  = snd;
+
+  *type = result;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/ast/uplc_type.h b/vendor/src/uplc/ast/uplc_type.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_type.h
@@ -0,0 +1,87 @@
+/**
+ * \file uplc_type.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TYPE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TYPE_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../arena/uplc_arena.h"
+#include "uplc_type_kind.h"
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A constant type descriptor.
+ *
+ * Flat encodes the type of every constant, and list, array and pair constants
+ * carry their element and component types, so the universe needs a recursive
+ * type descriptor as well as a value. For a list or an array, \c fst is the
+ * element type and \c snd is NULL; for a pair, \c fst and \c snd are the
+ * component types; for every other kind both are NULL.
+ */
+typedef struct cardano_uplc_type_t
+{
+    cardano_uplc_type_kind_t          kind;
+    const struct cardano_uplc_type_t* fst;
+    const struct cardano_uplc_type_t* snd;
+} cardano_uplc_type_t;
+
+/**
+ * \brief Builds a constant type descriptor from an arena.
+ *
+ * For \ref CARDANO_UPLC_TYPE_LIST and \ref CARDANO_UPLC_TYPE_ARRAY, \p fst is the
+ * required element type and \p snd must be NULL. For \ref CARDANO_UPLC_TYPE_PAIR,
+ * \p fst and \p snd are the required component types. For every other kind, both
+ * \p fst and \p snd must be NULL.
+ *
+ * \param[in] arena The arena to allocate the descriptor from.
+ * \param[in] kind The constant kind the descriptor names.
+ * \param[in] fst The element type for a list, the first type for a pair, else NULL.
+ * \param[in] snd The second type for a pair, else NULL.
+ * \param[out] type On success, set to the new descriptor; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p type, or a required component type is NULL,
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT if a component type is supplied
+ *         where the kind forbids it, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *         if the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_type_new(
+  struct cardano_uplc_arena_t* arena,
+  cardano_uplc_type_kind_t     kind,
+  const cardano_uplc_type_t*   fst,
+  const cardano_uplc_type_t*   snd,
+  cardano_uplc_type_t**        type);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TYPE_H */
diff --git a/vendor/src/uplc/ast/uplc_type_kind.h b/vendor/src/uplc/ast/uplc_type_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/ast/uplc_type_kind.h
@@ -0,0 +1,75 @@
+/**
+ * \file uplc_type_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TYPE_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TYPE_KIND_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The kind of a constant in the constant universe.
+ *
+ * Drives the active arm of \ref cardano_uplc_constant_t and the shape of a
+ * \ref cardano_uplc_type_t.
+ */
+typedef enum
+{
+  /** \brief Arbitrary-precision integer. */
+  CARDANO_UPLC_TYPE_INTEGER = 0,
+  /** \brief Byte string. */
+  CARDANO_UPLC_TYPE_BYTE_STRING = 1,
+  /** \brief UTF-8 text string. */
+  CARDANO_UPLC_TYPE_STRING = 2,
+  /** \brief The unit type. */
+  CARDANO_UPLC_TYPE_UNIT = 3,
+  /** \brief Boolean. */
+  CARDANO_UPLC_TYPE_BOOL = 4,
+  /** \brief Homogeneous list carrying its element type. */
+  CARDANO_UPLC_TYPE_LIST = 5,
+  /** \brief Pair carrying its two component types. */
+  CARDANO_UPLC_TYPE_PAIR = 6,
+  /** \brief Plutus data. */
+  CARDANO_UPLC_TYPE_DATA = 7,
+  /** \brief BLS12-381 G1 group element. */
+  CARDANO_UPLC_TYPE_BLS_G1 = 8,
+  /** \brief BLS12-381 G2 group element. */
+  CARDANO_UPLC_TYPE_BLS_G2 = 9,
+  /** \brief BLS12-381 Miller-loop result. */
+  CARDANO_UPLC_TYPE_BLS_ML_RESULT = 10,
+  /** \brief Homogeneous array carrying its element type (Plutus V4). */
+  CARDANO_UPLC_TYPE_ARRAY = 11,
+  /** \brief Multi-asset value: a sorted map of policy to sorted map of token to amount (Plutus V4). */
+  CARDANO_UPLC_TYPE_VALUE = 12
+} cardano_uplc_type_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_AST_UPLC_TYPE_KIND_H */
diff --git a/vendor/src/uplc/builtins/bls.c b/vendor/src/uplc/builtins/bls.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/builtins/bls.c
@@ -0,0 +1,136 @@
+/**
+ * \file bls.c
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "bls.h"
+
+#include <blst.h>
+
+#include <stddef.h>
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_int_bls_g1_from_compressed(
+  cardano_uplc_arena_t*     arena,
+  const byte_t*             bytes,
+  size_t                    size,
+  cardano_uplc_constant_t** constant)
+{
+  blst_p1_affine affine;
+  blst_p1        point;
+
+  if ((arena == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((bytes == NULL) || (size != CARDANO_UPLC_BLS_G1_COMPRESSED_SIZE))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (blst_p1_uncompress(&affine, bytes) != BLST_SUCCESS)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  blst_p1_from_affine(&point, &affine);
+
+  if (!blst_p1_in_g1(&point))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  return cardano_uplc_constant_new_bls(arena, CARDANO_UPLC_TYPE_BLS_G1, &point, sizeof(point), constant);
+}
+
+cardano_error_t
+cardano_uplc_int_bls_g2_from_compressed(
+  cardano_uplc_arena_t*     arena,
+  const byte_t*             bytes,
+  size_t                    size,
+  cardano_uplc_constant_t** constant)
+{
+  blst_p2_affine affine;
+  blst_p2        point;
+
+  if ((arena == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((bytes == NULL) || (size != CARDANO_UPLC_BLS_G2_COMPRESSED_SIZE))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (blst_p2_uncompress(&affine, bytes) != BLST_SUCCESS)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  blst_p2_from_affine(&point, &affine);
+
+  if (!blst_p2_in_g2(&point))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  return cardano_uplc_constant_new_bls(arena, CARDANO_UPLC_TYPE_BLS_G2, &point, sizeof(point), constant);
+}
+
+cardano_error_t
+cardano_uplc_int_bls_g1_compress(const cardano_uplc_constant_t* constant, byte_t* out)
+{
+  if ((constant == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_BLS_G1)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  blst_p1_compress(out, (const blst_p1*)constant->as.bls);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_int_bls_g2_compress(const cardano_uplc_constant_t* constant, byte_t* out)
+{
+  if ((constant == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_BLS_G2)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  blst_p2_compress(out, (const blst_p2*)constant->as.bls);
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/builtins/bls.h b/vendor/src/uplc/builtins/bls.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/builtins/bls.h
@@ -0,0 +1,121 @@
+/**
+ * \file bls.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_BLS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_BLS_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_term.h"
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+#include "../arena/uplc_arena.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Length in bytes of a BLS12-381 G1 point in compressed serialization.
+ */
+#define CARDANO_UPLC_BLS_G1_COMPRESSED_SIZE ((size_t)48U)
+
+/**
+ * \brief Length in bytes of a BLS12-381 G2 point in compressed serialization.
+ */
+#define CARDANO_UPLC_BLS_G2_COMPRESSED_SIZE ((size_t)96U)
+
+/**
+ * \brief Uncompresses a G1 point and stores it as an arena BLS constant.
+ *
+ * The input must be exactly \ref CARDANO_UPLC_BLS_G1_COMPRESSED_SIZE bytes,
+ * uncompress without error, and lie in the G1 subgroup. Any other length, a bad
+ * encoding, or a point outside the subgroup yields \ref CARDANO_ERROR_DECODING.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in] bytes The compressed point bytes. May be NULL only when \p size is 0.
+ * \param[in] size The number of bytes in \p bytes.
+ * \param[out] constant On success, the G1 constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for an
+ *         invalid or out-of-subgroup point, or a propagated allocation error.
+ */
+cardano_error_t
+cardano_uplc_int_bls_g1_from_compressed(
+  cardano_uplc_arena_t*     arena,
+  const byte_t*             bytes,
+  size_t                    size,
+  cardano_uplc_constant_t** constant);
+
+/**
+ * \brief Uncompresses a G2 point and stores it as an arena BLS constant.
+ *
+ * As \ref cardano_uplc_int_bls_g1_from_compressed but for G2: the input must be
+ * exactly \ref CARDANO_UPLC_BLS_G2_COMPRESSED_SIZE bytes and lie in the G2
+ * subgroup.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in] bytes The compressed point bytes. May be NULL only when \p size is 0.
+ * \param[in] size The number of bytes in \p bytes.
+ * \param[out] constant On success, the G2 constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for an
+ *         invalid or out-of-subgroup point, or a propagated allocation error.
+ */
+cardano_error_t
+cardano_uplc_int_bls_g2_from_compressed(
+  cardano_uplc_arena_t*     arena,
+  const byte_t*             bytes,
+  size_t                    size,
+  cardano_uplc_constant_t** constant);
+
+/**
+ * \brief Compresses the G1 point a constant carries into a byte buffer.
+ *
+ * \param[in] constant A constant of kind \ref CARDANO_UPLC_TYPE_BLS_G1.
+ * \param[out] out A buffer of at least \ref CARDANO_UPLC_BLS_G1_COMPRESSED_SIZE bytes.
+ *
+ * \return \ref CARDANO_SUCCESS on success or \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if \p constant is not a G1 constant.
+ */
+cardano_error_t
+cardano_uplc_int_bls_g1_compress(const cardano_uplc_constant_t* constant, byte_t* out);
+
+/**
+ * \brief Compresses the G2 point a constant carries into a byte buffer.
+ *
+ * \param[in] constant A constant of kind \ref CARDANO_UPLC_TYPE_BLS_G2.
+ * \param[out] out A buffer of at least \ref CARDANO_UPLC_BLS_G2_COMPRESSED_SIZE bytes.
+ *
+ * \return \ref CARDANO_SUCCESS on success or \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if \p constant is not a G2 constant.
+ */
+cardano_error_t
+cardano_uplc_int_bls_g2_compress(const cardano_uplc_constant_t* constant, byte_t* out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_BLS_H */
diff --git a/vendor/src/uplc/builtins/builtins.c b/vendor/src/uplc/builtins/builtins.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/builtins/builtins.c
@@ -0,0 +1,9856 @@
+/**
+ * \file builtins.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_int_math.h"
+
+#include "builtins.h"
+
+#include "../../allocators.h"
+#include "../arena/uplc_arena.h"
+#include "../ast/uplc_int.h"
+#include "../cost/uplc_ex_mem.h"
+#include "bls.h"
+
+#include <blst.h>
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/byte_order.h>
+#include <cardano/crypto/ed25519_public_key.h>
+#include <cardano/crypto/ed25519_signature.h>
+#include <cardano/plutus_data/constr_plutus_data.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/plutus_data/plutus_list.h>
+#include <cardano/plutus_data/plutus_map.h>
+
+#include <sodium/crypto_generichash.h>
+#include <sodium/crypto_hash_sha256.h>
+
+#include <ripemd160.h>
+#include <sha3.h>
+
+#ifndef SECP256K1_STATIC
+#define SECP256K1_STATIC
+#endif
+
+#include <secp256k1.h>
+#include <secp256k1_extrakeys.h>
+#include <secp256k1_schnorrsig.h>
+
+#include <src/string_safe.h>
+
+#include <stddef.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief Number of distinct byte values, the modulus for the wrapping
+ *        \c consByteString and the exclusive upper bound for a byte literal.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_BUILTIN_BYTE_MODULUS = 256;
+
+/**
+ * \brief Highest valid byte value, used by \c consByteString and
+ *        \c replicateByte range checks and as the all-ones complement mask.
+ */
+static const int64_t CARDANO_UPLC_BUILTIN_BYTE_MAX = 255;
+
+/**
+ * \brief Maximum output length \c integerToByteString accepts, in bytes.
+ *
+ * Caps both the requested width and the minimal-width encoding; a value that would
+ * exceed this length is a script error.
+ */
+static const int64_t CARDANO_UPLC_BUILTIN_INT_TO_BS_MAX = 8192;
+
+/**
+ * \brief Bit width of the signed range a bounded integer argument must lie in.
+ *
+ * Under the variants that bound integer arguments, an argument outside
+ * -(2^262143) .. 2^262143 - 1 is a script error.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_INTEGER_ARG_BITS = 262143U;
+
+/**
+ * \brief Maximum length, in bytes, of a bounded byte-string argument.
+ *
+ * Under the variants that bound byte-string arguments, a longer argument is a
+ * script error.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_BYTE_STRING_ARG_MAX = 65536U;
+
+/**
+ * \brief Maximum input length, in bytes, of the bounded \c writeBits.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_WRITE_BITS_INPUT_MAX = 4096U;
+
+/**
+ * \brief Maximum bit length of the bounded \c constrData tag, an unsigned 64-bit integer.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_CONSTR_TAG_BITS = 64U;
+
+/**
+ * \brief Bit width of the signed range \c expModInteger accepts.
+ *
+ * The base and exponent must lie in -(2^8191) .. 2^8191 - 1 and the modulus in
+ * 1 .. 2^8191 - 1; anything else is a script error.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_EXP_MOD_BOUND_BITS = 8191U;
+
+/**
+ * \brief Flag naming the first argument in the bounded-argument tables.
+ */
+#define CARDANO_UPLC_BUILTIN_ARG_0 ((uint8_t)0x01U)
+
+/**
+ * \brief Flag naming the second argument in the bounded-argument tables.
+ */
+#define CARDANO_UPLC_BUILTIN_ARG_1 ((uint8_t)0x02U)
+
+/**
+ * \brief Flag naming the third argument in the bounded-argument tables.
+ */
+#define CARDANO_UPLC_BUILTIN_ARG_2 ((uint8_t)0x04U)
+
+/**
+ * \brief The integer arguments each builtin bounds under variants D and E.
+ *
+ * Each entry is a set of \c CARDANO_UPLC_BUILTIN_ARG_* flags naming the argument
+ * positions checked against \ref CARDANO_UPLC_BUILTIN_INTEGER_ARG_BITS; a builtin
+ * not listed bounds none.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t BUILTIN_BOUNDED_INTEGER_ARGS[CARDANO_UPLC_BUILTIN_COUNT] = {
+  [CARDANO_UPLC_BUILTIN_ADD_INTEGER]              = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER]         = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_MULTIPLY_INTEGER]         = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER]           = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER]         = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER]        = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_MOD_INTEGER]              = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER]        = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER] = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING]         = CARDANO_UPLC_BUILTIN_ARG_0
+};
+
+/**
+ * \brief The byte-string arguments each builtin bounds under variants D, E, F and G.
+ *
+ * Each entry is a set of \c CARDANO_UPLC_BUILTIN_ARG_* flags naming the argument
+ * positions checked against \ref CARDANO_UPLC_BUILTIN_BYTE_STRING_ARG_MAX; a
+ * builtin not listed bounds none.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t BUILTIN_BOUNDED_BYTE_STRING_ARGS[CARDANO_UPLC_BUILTIN_COUNT] = {
+  [CARDANO_UPLC_BUILTIN_APPEND_BYTE_STRING]                 = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING]                   = CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING]                  = CARDANO_UPLC_BUILTIN_ARG_2,
+  [CARDANO_UPLC_BUILTIN_INDEX_BYTE_STRING]                  = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING]                 = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING]              = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING]       = CARDANO_UPLC_BUILTIN_ARG_0 | CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_SHA2_256]                           = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_SHA3_256]                           = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_BLAKE2B_256]                        = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE]           = CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE] = CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_DECODE_UTF8]                        = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_HASH_TO_GROUP]         = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_HASH_TO_GROUP]         = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_KECCAK_256]                         = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_BLAKE2B_224]                        = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER]             = CARDANO_UPLC_BUILTIN_ARG_1,
+  [CARDANO_UPLC_BUILTIN_AND_BYTE_STRING]                    = CARDANO_UPLC_BUILTIN_ARG_1 | CARDANO_UPLC_BUILTIN_ARG_2,
+  [CARDANO_UPLC_BUILTIN_OR_BYTE_STRING]                     = CARDANO_UPLC_BUILTIN_ARG_1 | CARDANO_UPLC_BUILTIN_ARG_2,
+  [CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING]                    = CARDANO_UPLC_BUILTIN_ARG_1 | CARDANO_UPLC_BUILTIN_ARG_2,
+  [CARDANO_UPLC_BUILTIN_COMPLEMENT_BYTE_STRING]             = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_READ_BIT]                           = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_COUNT_SET_BITS]                     = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_FIND_FIRST_SET_BIT]                 = CARDANO_UPLC_BUILTIN_ARG_0,
+  [CARDANO_UPLC_BUILTIN_RIPEMD_160]                         = CARDANO_UPLC_BUILTIN_ARG_0
+};
+
+/**
+ * \brief Output length, in bytes, of a Blake2b-224 digest.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_BLAKE2B_224_SIZE = 28U;
+
+/**
+ * \brief Output length, in bytes, of a Blake2b-256 digest.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_BLAKE2B_256_SIZE = 32U;
+
+/**
+ * \brief Length, in bytes, of an Ed25519 public key.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_ED25519_KEY_SIZE = 32U;
+
+/**
+ * \brief Length, in bytes, of an Ed25519 signature.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_ED25519_SIG_SIZE = 64U;
+
+/**
+ * \brief Length, in bytes, of a compressed secp256k1 ECDSA public key.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_ECDSA_KEY_SIZE = 33U;
+
+/**
+ * \brief Length, in bytes, of the pre-hashed message an ECDSA verify consumes.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_ECDSA_MSG_SIZE = 32U;
+
+/**
+ * \brief Length, in bytes, of a compact secp256k1 ECDSA signature.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_ECDSA_SIG_SIZE = 64U;
+
+/**
+ * \brief Length, in bytes, of an x-only BIP340 Schnorr public key.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_SCHNORR_KEY_SIZE = 32U;
+
+/**
+ * \brief Length, in bytes, of a BIP340 Schnorr signature.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_SCHNORR_SIG_SIZE = 64U;
+
+/**
+ * \brief Output length, in bytes, of a SHA3-256 or Keccak-256 digest.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_SHA3_256_SIZE = 32U;
+
+/**
+ * \brief Output length, in bytes, of a RIPEMD-160 digest.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t CARDANO_UPLC_BUILTIN_RIPEMD_160_SIZE = 20U;
+
+/**
+ * \brief Domain-separation pad byte selecting FIPS-202 SHA-3 in \c sha3_final_pad.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t CARDANO_UPLC_BUILTIN_SHA3_PAD = 0x06U;
+
+/**
+ * \brief Domain-separation pad byte selecting the original Keccak in \c sha3_final_pad.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t CARDANO_UPLC_BUILTIN_KECCAK_PAD = 0x01U;
+
+/**
+ * \brief Width in bytes of a BLS12-381 scalar.
+ */
+#define CARDANO_UPLC_BLS_SCALAR_SIZE ((size_t)32U)
+
+/**
+ * \brief Width in bits of a BLS12-381 scalar.
+ */
+static const size_t CARDANO_UPLC_BLS_SCALAR_BITS = 256U;
+
+/**
+ * \brief Maximum length in bytes of a hash-to-curve domain separation tag.
+ *
+ * A domain separation tag longer than this is rejected by the BLS12-381 G1 and G2
+ * hash-to-group builtins as a script error.
+ */
+static const size_t CARDANO_UPLC_BLS_DST_MAX = 255U;
+
+/**
+ * \brief Bit width of the signed range a bounded BLS12-381 scalar must lie in.
+ *
+ * The multi-scalar-multiplication builtins, and \c scalarMul under the variants
+ * that bound it, reject a scalar outside -(2^4095) .. 2^4095 - 1.
+ */
+static const size_t CARDANO_UPLC_BLS_SCALAR_BOUND_BITS = 4095U;
+
+/**
+ * \brief The BLS12-381 scalar field order \c r in big-endian bytes.
+ *
+ * A scalar argument to \c scalarMul is reduced modulo this period before the
+ * multiplication.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const byte_t CARDANO_UPLC_BLS_SCALAR_PERIOD[CARDANO_UPLC_BLS_SCALAR_SIZE] = {
+  0x73U,
+  0xedU,
+  0xa7U,
+  0x53U,
+  0x29U,
+  0x9dU,
+  0x7dU,
+  0x48U,
+  0x33U,
+  0x39U,
+  0xd8U,
+  0x08U,
+  0x09U,
+  0xa1U,
+  0xd8U,
+  0x05U,
+  0x53U,
+  0xbdU,
+  0xa4U,
+  0x02U,
+  0xffU,
+  0xfeU,
+  0x5bU,
+  0xfeU,
+  0xffU,
+  0xffU,
+  0xffU,
+  0xffU,
+  0x00U,
+  0x00U,
+  0x00U,
+  0x01U
+};
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Reads the constant a value wraps, if it is a constant value.
+ *
+ * A non-constant value (a delay, lambda, builtin or constr) is reported by
+ * returning \c false.
+ *
+ * \param[in] value The value to read. Must not be NULL.
+ * \param[out] out On success, the borrowed constant; left untouched otherwise.
+ *
+ * \return \c true when \p value is a constant, \c false otherwise.
+ */
+static bool
+as_constant(const cardano_uplc_value_t* value, const cardano_uplc_constant_t** out)
+{
+  if ((value == NULL) || (value->kind != CARDANO_UPLC_VALUE_CONSTANT))
+  {
+    return false;
+  }
+
+  *out = value->as.constant;
+
+  return true;
+}
+
+/**
+ * \brief Spends a builtin's computed cost on the step accumulator.
+ *
+ * Computes the cpu/mem cost from the ex-mem sizes of \p args and charges it
+ * before the body runs.
+ *
+ * \param[in,out] acc The accumulator to charge. Must not be NULL.
+ * \param[in] costs The per-builtin costs. Must not be NULL.
+ * \param[in] semantics The semantics variant selecting the string ex-mem measure.
+ * \param[in] func The builtin being run.
+ * \param[in] args The saturated argument values.
+ * \param[in] arg_count The number of arguments.
+ *
+ * \return \ref CARDANO_SUCCESS on success, propagating any accumulator failure.
+ */
+static cardano_error_t
+spend_builtin_cost(
+  cardano_uplc_step_accumulator_t*    acc,
+  const cardano_uplc_builtin_costs_t* costs,
+  cardano_uplc_builtin_semantics_t    semantics,
+  cardano_uplc_builtin_t              func,
+  const cardano_uplc_value_t* const*  args,
+  size_t                              arg_count)
+{
+  bool                  by_utf8 = cardano_uplc_semantics_costs_strings_by_utf8_bytes(semantics);
+  cardano_uplc_budget_t cost    = cardano_uplc_builtin_cost(costs, func, args, arg_count, by_utf8);
+
+  return cardano_uplc_step_accumulator_charge(acc, cost);
+}
+
+/* BODY HELPERS *************************************************************/
+
+/**
+ * \brief Wraps an owned bigint as an arena result value and drops the caller ref.
+ *
+ * Builds an integer constant that borrows \p value (the constructor takes its own
+ * reference and registers the arena unref hook), wraps it in a constant value, and
+ * always releases the reference \p value held on entry. On failure \p value is
+ * still released so the helper never leaks.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in,out] value The owned bigint to publish; released before return.
+ * \param[out] out On success, the constant value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+result_integer(
+  struct cardano_uplc_arena_t* arena,
+  cardano_bigint_t*            value,
+  const cardano_uplc_value_t** out)
+{
+  cardano_uplc_constant_t* constant = NULL;
+  cardano_uplc_value_t*    result   = NULL;
+  cardano_error_t          error    = CARDANO_SUCCESS;
+  int64_t                  small    = 0;
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  if (cardano_uplc_int_bigint_fits_int64(value, &small))
+  {
+    error = cardano_uplc_constant_new_integer_small(arena, small, &constant);
+  }
+  else
+  {
+    error = cardano_uplc_constant_new_integer(arena, value, &constant);
+  }
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_bigint_unref(&value);
+
+    return error;
+  }
+
+  cardano_bigint_unref(&value);
+
+  error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Builds an integer result value from a host \c int64_t.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] n The integer value.
+ * \param[out] out On success, the constant value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+result_integer_from_int(
+  struct cardano_uplc_arena_t* arena,
+  int64_t                      n,
+  const cardano_uplc_value_t** out)
+{
+  cardano_uplc_constant_t* constant = NULL;
+  cardano_uplc_value_t*    result   = NULL;
+  cardano_error_t          error    = cardano_uplc_constant_new_integer_small(arena, n, &constant);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief A read-only view of an integer argument as either inline or bigint.
+ *
+ * \c is_small selects the active field: \c small holds the value when inline and
+ * \c big the value when not. A big integer is by construction out of \c int64_t
+ * range, so \c is_small alone distinguishes the two domains.
+ */
+typedef struct int_view_t
+{
+    bool                           is_small;
+    int64_t                        small;
+    const cardano_uplc_constant_t* constant;
+} int_view_t;
+
+/**
+ * \brief Reads a value as an integer view without materializing a bigint.
+ *
+ * \param[in] value The value to inspect.
+ * \param[out] view On success, the integer view.
+ *
+ * \return \c true when \p value is a constant integer, \c false otherwise.
+ */
+static bool
+as_int_view(const cardano_uplc_value_t* value, int_view_t* view)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_INTEGER)
+  {
+    return false;
+  }
+
+  view->constant = constant;
+  view->is_small = cardano_uplc_constant_int_is_small(constant);
+  view->small    = view->is_small ? cardano_uplc_constant_int_small(constant) : 0;
+
+  return true;
+}
+
+/**
+ * \brief Reads a value as a \ref cardano_bigint_t, materializing inline values.
+ *
+ * The cold-path accessor for builtins that genuinely need a bigint (modular
+ * exponentiation, the integer/bytestring conversions, scalar reduction, and the
+ * data and multi-asset boundaries). For an inline integer it builds a bigint once
+ * and caches it in the arena-owned constant; the returned pointer is owned by the
+ * arena and must not be unref'd by the caller.
+ *
+ * \param[in] arena The arena the materialized bigint is registered with.
+ * \param[in] value The value to read.
+ * \param[out] out On success, the bigint view.
+ *
+ * \return \c true when \p value is a constant integer and a bigint is available,
+ *         \c false when \p value is not an integer or materialization fails.
+ */
+static bool
+as_integer_big(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_value_t*  value,
+  const cardano_bigint_t**     out)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_INTEGER)
+  {
+    return false;
+  }
+
+  return cardano_uplc_constant_int_materialize(arena, constant, out) == CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads the integer arm of a constant as a \ref cardano_bigint_t.
+ *
+ * Like \ref as_integer_big but takes a constant directly, for the writeBits,
+ * multi-asset and multi-scalar paths that inspect list or pair items rather than a
+ * top-level value.
+ *
+ * \param[in] arena The arena the materialized bigint is registered with.
+ * \param[in] constant An integer constant. Must not be NULL.
+ * \param[out] out On success, the bigint view.
+ *
+ * \return \c true on success, \c false if \p constant is not an integer or
+ *         materialization fails.
+ */
+static bool
+constant_integer_big(
+  struct cardano_uplc_arena_t*   arena,
+  const cardano_uplc_constant_t* constant,
+  const cardano_bigint_t**       out)
+{
+  if ((constant == NULL) || (constant->kind != CARDANO_UPLC_TYPE_INTEGER))
+  {
+    return false;
+  }
+
+  return cardano_uplc_constant_int_materialize(arena, constant, out) == CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Tests whether an integer lies in the signed range -(2^bits) .. 2^bits - 1.
+ *
+ * Decided from the magnitude's bit length without building the bound. The only
+ * in-range value whose magnitude needs \p bits + 1 bits is -(2^bits); for a
+ * negative value \ref cardano_bigint_test_bit reads the two's-complement form, in
+ * which bit \p bits is set for -(2^bits) and clear for every larger magnitude of
+ * the same bit length.
+ *
+ * \param[in] value The integer to test.
+ * \param[in] bits The bit width of the range.
+ *
+ * \return \c true when \p value is in range, \c false otherwise.
+ */
+static bool
+bigint_within_signed_bits(const cardano_bigint_t* value, size_t bits)
+{
+  const size_t length = cardano_bigint_bit_length(value);
+
+  if (length <= bits)
+  {
+    return true;
+  }
+
+  if ((length > (bits + 1U)) || (cardano_bigint_signum(value) >= 0))
+  {
+    return false;
+  }
+
+  return cardano_bigint_test_bit(value, (uint32_t)bits);
+}
+
+/**
+ * \brief Tests whether an integer constant lies in the signed range -(2^bits) .. 2^bits - 1.
+ *
+ * Reads the constant without materializing a bigint: an inline value always fits,
+ * so \p bits must be at least 63.
+ *
+ * \param[in] constant An integer constant. Must not be NULL.
+ * \param[in] bits The bit width of the range, at least 63.
+ *
+ * \return \c true when the constant is in range, \c false otherwise.
+ */
+static bool
+constant_integer_within_signed_bits(const cardano_uplc_constant_t* constant, size_t bits)
+{
+  if (cardano_uplc_constant_int_is_small(constant))
+  {
+    return true;
+  }
+
+  return bigint_within_signed_bits(constant->as.integer.big, bits);
+}
+
+/**
+ * \brief Checks a builtin's arguments against the bounds its semantics variant applies.
+ *
+ * Under variants D and E the integer arguments named by
+ * \ref BUILTIN_BOUNDED_INTEGER_ARGS must lie in -(2^262143) .. 2^262143 - 1, and
+ * under variants D, E, F and G the byte-string arguments named by
+ * \ref BUILTIN_BOUNDED_BYTE_STRING_ARGS must be at most 65536 bytes long. An
+ * argument of another type is left for the body to reject.
+ *
+ * \param[in] semantics The semantics variant selecting which bounds apply.
+ * \param[in] func The builtin being run.
+ * \param[in] args The saturated argument values.
+ * \param[in] arg_count The number of arguments.
+ *
+ * \return \c true when every bounded argument is within its bound, \c false otherwise.
+ */
+static bool
+arguments_within_bounds(
+  cardano_uplc_builtin_semantics_t   semantics,
+  cardano_uplc_builtin_t             func,
+  const cardano_uplc_value_t* const* args,
+  size_t                             arg_count)
+{
+  uint8_t integer_args     = 0U;
+  uint8_t byte_string_args = 0U;
+  size_t  i                = 0U;
+
+  if ((size_t)func >= (size_t)CARDANO_UPLC_BUILTIN_COUNT)
+  {
+    return true;
+  }
+
+  if (cardano_uplc_semantics_bounds_integer_arguments(semantics))
+  {
+    integer_args = BUILTIN_BOUNDED_INTEGER_ARGS[func];
+  }
+
+  if (cardano_uplc_semantics_bounds_byte_string_arguments(semantics))
+  {
+    byte_string_args = BUILTIN_BOUNDED_BYTE_STRING_ARGS[func];
+  }
+
+  if ((integer_args | byte_string_args) == 0U)
+  {
+    return true;
+  }
+
+  for (i = 0U; i < arg_count; ++i)
+  {
+    const uint8_t            flag  = (uint8_t)(1U << i);
+    int_view_t               view  = { false, 0, NULL };
+    cardano_uplc_byte_view_t bytes = { NULL, 0U };
+
+    if (((integer_args & flag) != 0U) && as_int_view(args[i], &view) && !constant_integer_within_signed_bits(view.constant, CARDANO_UPLC_BUILTIN_INTEGER_ARG_BITS))
+    {
+      return false;
+    }
+
+    if (((byte_string_args & flag) != 0U) && cardano_uplc_builtin_as_byte_string(args[i], &bytes) && (bytes.size > CARDANO_UPLC_BUILTIN_BYTE_STRING_ARG_MAX))
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+/**
+ * \brief Returns a never-NULL byte pointer for a possibly-empty span.
+ *
+ * The arena byte-string representation uses a NULL pointer for the empty string, but
+ * some vendored crypto routines (e.g. \c ripemd160) assert a non-NULL input pointer
+ * even for a zero length. This yields a stable dummy address in that case so the
+ * one-shot hashers and verifiers can be fed \c (ptr, 0) safely.
+ *
+ * \param[in] data The span pointer, possibly NULL when \p size is 0.
+ * \param[in] size The span length.
+ *
+ * \return \p data when non-NULL, otherwise a valid non-dereferenced dummy pointer.
+ */
+static const byte_t*
+nonnull_bytes(const byte_t* data, size_t size)
+{
+  static const byte_t empty = 0;
+
+  (void)size;
+
+  return (data != NULL) ? data : &empty;
+}
+
+/**
+ * \brief Compares two raw byte spans lexicographically.
+ *
+ * Compares the common prefix byte by byte and breaks a tie by length, the ordering
+ * \c equalsByteString, \c lessThanByteString and the value-map key checks rely on. A
+ * NULL span is treated as empty, valid only when its length is 0.
+ *
+ * \param[in] da The first span, or NULL when \p la is 0.
+ * \param[in] la The first span length.
+ * \param[in] db The second span, or NULL when \p lb is 0.
+ * \param[in] lb The second span length.
+ *
+ * \return A negative, zero or positive value as the first span is less than, equal
+ *         to, or greater than the second.
+ */
+static int
+byte_view_compare(const byte_t* da, size_t la, const byte_t* db, size_t lb)
+{
+  size_t n = (la < lb) ? la : lb;
+  size_t i = 0U;
+
+  for (i = 0U; i < n; ++i)
+  {
+    if (da[i] != db[i])
+    {
+      return (da[i] < db[i]) ? -1 : 1;
+    }
+  }
+
+  if (la == lb)
+  {
+    return 0;
+  }
+
+  return (la < lb) ? -1 : 1;
+}
+
+/**
+ * \brief Builds a byte-string result value by copying a raw byte span into the arena.
+ *
+ * The single byte-string producer for every byte-string builtin: it bump-allocates a
+ * copy of \p data in the arena, wraps it in a constant and a value, and never
+ * mallocs or refcounts a library buffer. An empty span yields the empty byte string.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] data The bytes to copy, or NULL when \p size is 0.
+ * \param[in] size The number of bytes.
+ * \param[out] out On success, the constant value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+result_bytes_from(
+  struct cardano_uplc_arena_t* arena,
+  const byte_t*                data,
+  size_t                       size,
+  const cardano_uplc_value_t** out)
+{
+  cardano_uplc_constant_t* constant = NULL;
+  cardano_uplc_value_t*    result   = NULL;
+  cardano_error_t          error    = cardano_uplc_int_constant_new_byte_string_copy(arena, data, size, &constant);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Wraps an already-arena byte span as a byte-string result with no copy.
+ *
+ * The zero-copy counterpart of \ref result_bytes_from for bodies that have
+ * just filled a span allocated from the arena (a bitwise or encoding scratch): the
+ * constant adopts the span directly. \p data must live in \p arena.
+ *
+ * \param[in] arena The arena the result is allocated from and that owns \p data.
+ * \param[in] data The arena bytes to adopt, or NULL when \p size is 0.
+ * \param[in] size The number of bytes.
+ * \param[out] out On success, the constant value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+result_bytes_take(
+  struct cardano_uplc_arena_t* arena,
+  const byte_t*                data,
+  size_t                       size,
+  const cardano_uplc_value_t** out)
+{
+  cardano_uplc_constant_t* constant = NULL;
+  cardano_uplc_value_t*    result   = NULL;
+  cardano_error_t          error    = cardano_uplc_int_constant_new_byte_string_take(arena, data, size, &constant);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Builds a boolean result value.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] value The boolean value.
+ * \param[out] out On success, the constant value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+result_bool(
+  struct cardano_uplc_arena_t* arena,
+  bool                         value,
+  const cardano_uplc_value_t** out)
+{
+  cardano_uplc_constant_t* constant = NULL;
+  cardano_uplc_value_t*    result   = NULL;
+  cardano_error_t          error    = cardano_uplc_constant_new_bool(arena, value, &constant);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Computes the floor quotient and remainder of two bigints.
+ *
+ * The library bigint primitives round toward zero (truncated division), so floor
+ * division is derived: when the truncated remainder is non-zero and its sign
+ * differs from the divisor's, the quotient is decremented and the divisor added to
+ * the remainder. This is the rounding \c divideInteger and \c modInteger use. The
+ * caller must have ruled out a zero divisor.
+ *
+ * \param[in] dividend The dividend.
+ * \param[in] divisor The non-zero divisor.
+ * \param[out] quotient Pre-initialised bigint receiving the floor quotient.
+ * \param[out] remainder Pre-initialised bigint receiving the floor remainder.
+ */
+static void
+floor_div_mod(
+  const cardano_bigint_t* dividend,
+  const cardano_bigint_t* divisor,
+  cardano_bigint_t*       quotient,
+  cardano_bigint_t*       remainder)
+{
+  cardano_bigint_divide_and_reminder(dividend, divisor, quotient, remainder);
+
+  if (cardano_bigint_signum(remainder) != 0)
+  {
+    if (cardano_bigint_signum(remainder) != cardano_bigint_signum(divisor))
+    {
+      cardano_bigint_t* one = NULL;
+
+      if (cardano_bigint_from_int(1, &one) == CARDANO_SUCCESS)
+      {
+        cardano_bigint_subtract(quotient, one, quotient);
+        cardano_bigint_add(remainder, divisor, remainder);
+        cardano_bigint_unref(&one);
+      }
+    }
+  }
+}
+
+/**
+ * \brief Validates that a byte range is well-formed UTF-8.
+ *
+ * Applies the Unicode well-formed-UTF-8 rules so \c decodeUtf8 fails the script
+ * on invalid input. Lead bytes 0xC2..0xDF, 0xE0..0xEF and 0xF0..0xF4 introduce
+ * 2-, 3- and 4-byte sequences whose continuation bytes are 0x80..0xBF, with the
+ * ranges narrowed to reject overlong encodings, UTF-16 surrogates and code points
+ * above U+10FFFF.
+ *
+ * \param[in] data The bytes to validate. May be NULL only when \p size is 0.
+ * \param[in] size The number of bytes.
+ *
+ * \return \c true if the range is valid UTF-8, \c false otherwise.
+ */
+static bool
+is_valid_utf8(const byte_t* data, size_t size)
+{
+  size_t i = 0U;
+
+  while (i < size)
+  {
+    const byte_t b0 = data[i];
+
+    if (b0 <= 0x7FU)
+    {
+      i += 1U;
+    }
+    else if ((b0 >= 0xC2U) && (b0 <= 0xDFU))
+    {
+      if ((i + 1U) >= size)
+      {
+        return false;
+      }
+
+      if ((data[i + 1U] & 0xC0U) != 0x80U)
+      {
+        return false;
+      }
+
+      i += 2U;
+    }
+    else if ((b0 >= 0xE0U) && (b0 <= 0xEFU))
+    {
+      byte_t lo = 0x80U;
+      byte_t hi = 0xBFU;
+
+      if ((i + 2U) >= size)
+      {
+        return false;
+      }
+
+      if (b0 == 0xE0U)
+      {
+        lo = 0xA0U;
+      }
+      else if (b0 == 0xEDU)
+      {
+        hi = 0x9FU;
+      }
+      else
+      {
+        lo = 0x80U;
+        hi = 0xBFU;
+      }
+
+      if ((data[i + 1U] < lo) || (data[i + 1U] > hi))
+      {
+        return false;
+      }
+
+      if ((data[i + 2U] & 0xC0U) != 0x80U)
+      {
+        return false;
+      }
+
+      i += 3U;
+    }
+    else if ((b0 >= 0xF0U) && (b0 <= 0xF4U))
+    {
+      byte_t lo = 0x80U;
+      byte_t hi = 0xBFU;
+
+      if ((i + 3U) >= size)
+      {
+        return false;
+      }
+
+      if (b0 == 0xF0U)
+      {
+        lo = 0x90U;
+      }
+      else if (b0 == 0xF4U)
+      {
+        hi = 0x8FU;
+      }
+      else
+      {
+        lo = 0x80U;
+        hi = 0xBFU;
+      }
+
+      if ((data[i + 1U] < lo) || (data[i + 1U] > hi))
+      {
+        return false;
+      }
+
+      if ((data[i + 2U] & 0xC0U) != 0x80U)
+      {
+        return false;
+      }
+
+      if ((data[i + 3U] & 0xC0U) != 0x80U)
+      {
+        return false;
+      }
+
+      i += 4U;
+    }
+    else
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+/**
+ * \brief Tests two type descriptors for structural equality.
+ *
+ * Compares the kinds, and for a list the element type and for a pair both
+ * component types, recursively. Used to compare a list head that is itself a
+ * list against the declared element type.
+ *
+ * \param[in] a The first type descriptor. Must not be NULL.
+ * \param[in] b The second type descriptor. Must not be NULL.
+ *
+ * \return \c true when the descriptors are structurally equal, \c false otherwise.
+ */
+static bool
+type_equals(const cardano_uplc_type_t* a, const cardano_uplc_type_t* b)
+{
+  if ((a == NULL) || (b == NULL))
+  {
+    return false;
+  }
+
+  if (a->kind != b->kind)
+  {
+    return false;
+  }
+
+  switch (a->kind)
+  {
+    case CARDANO_UPLC_TYPE_LIST:
+    case CARDANO_UPLC_TYPE_ARRAY:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      return type_equals(a->fst, b->fst);
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      if (!type_equals(a->fst, b->fst))
+      {
+        return false;
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      return type_equals(a->snd, b->snd);
+    }
+    case CARDANO_UPLC_TYPE_INTEGER:
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    case CARDANO_UPLC_TYPE_STRING:
+    case CARDANO_UPLC_TYPE_UNIT:
+    case CARDANO_UPLC_TYPE_BOOL:
+    case CARDANO_UPLC_TYPE_DATA:
+    case CARDANO_UPLC_TYPE_VALUE:
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    default:
+    {
+      return true;
+    }
+  }
+}
+
+/**
+ * \brief Tests whether a constant's type matches a type descriptor.
+ *
+ * The element-type guard \c mkCons enforces: a list of element type \c T accepts
+ * a head only when the head's type equals \c T, where a list head's type is the
+ * element type it carries and a pair head's type is the pair of its component
+ * types, compared recursively.
+ *
+ * \param[in] type The element type descriptor the list declares. Must not be NULL.
+ * \param[in] constant The candidate head constant. Must not be NULL.
+ *
+ * \return \c true when the constant's type matches \p type, \c false otherwise.
+ */
+static bool
+constant_has_type(const cardano_uplc_type_t* type, const cardano_uplc_constant_t* constant)
+{
+  if ((type == NULL) || (constant == NULL))
+  {
+    return false;
+  }
+
+  if (type->kind != constant->kind)
+  {
+    return false;
+  }
+
+  switch (constant->kind)
+  {
+    case CARDANO_UPLC_TYPE_LIST:
+    case CARDANO_UPLC_TYPE_ARRAY:
+    {
+      const cardano_uplc_type_t* inner = type->fst;
+      const cardano_uplc_type_t* item  = constant->as.list.element_type;
+
+      if ((inner == NULL) || (item == NULL))
+      {
+        return false;
+      }
+
+      return type_equals(inner, item);
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      if ((type->fst == NULL) || (type->snd == NULL))
+      {
+        return false;
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      if (!constant_has_type(type->fst, constant->as.pair.fst))
+      {
+        return false;
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      return constant_has_type(type->snd, constant->as.pair.snd);
+    }
+    case CARDANO_UPLC_TYPE_INTEGER:
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    case CARDANO_UPLC_TYPE_STRING:
+    case CARDANO_UPLC_TYPE_UNIT:
+    case CARDANO_UPLC_TYPE_BOOL:
+    case CARDANO_UPLC_TYPE_DATA:
+    case CARDANO_UPLC_TYPE_VALUE:
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    default:
+    {
+      return true;
+    }
+  }
+}
+
+/* DEFINITIONS ***************************************************************/
+
+bool
+cardano_uplc_builtin_as_integer(const cardano_uplc_value_t* value, const cardano_bigint_t** out)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (out == NULL)
+  {
+    return false;
+  }
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_INTEGER)
+  {
+    return false;
+  }
+
+  if (constant->as.integer.big == NULL)
+  {
+    return false;
+  }
+
+  *out = constant->as.integer.big;
+
+  return true;
+}
+
+bool
+cardano_uplc_builtin_as_byte_string(const cardano_uplc_value_t* value, cardano_uplc_byte_view_t* out)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (out == NULL)
+  {
+    return false;
+  }
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_BYTE_STRING)
+  {
+    return false;
+  }
+
+  out->data = constant->as.bytes.data;
+  out->size = constant->as.bytes.size;
+
+  return true;
+}
+
+bool
+cardano_uplc_builtin_as_string(const cardano_uplc_value_t* value, cardano_uplc_byte_view_t* out)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (out == NULL)
+  {
+    return false;
+  }
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_STRING)
+  {
+    return false;
+  }
+
+  out->data = constant->as.string.data;
+  out->size = constant->as.string.size;
+
+  return true;
+}
+
+bool
+cardano_uplc_builtin_as_bool(const cardano_uplc_value_t* value, bool* out)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (out == NULL)
+  {
+    return false;
+  }
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_BOOL)
+  {
+    return false;
+  }
+
+  *out = constant->as.boolean;
+
+  return true;
+}
+
+bool
+cardano_uplc_builtin_as_unit(const cardano_uplc_value_t* value)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  return (constant->kind == CARDANO_UPLC_TYPE_UNIT);
+}
+
+bool
+cardano_uplc_builtin_as_data(const cardano_uplc_value_t* value, const cardano_uplc_data_t** out)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (out == NULL)
+  {
+    return false;
+  }
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_DATA)
+  {
+    return false;
+  }
+
+  *out = constant->as.data;
+
+  return true;
+}
+
+bool
+cardano_uplc_builtin_as_list(
+  const cardano_uplc_value_t* value,
+  const cardano_uplc_type_t** element_type,
+  // cppcheck-suppress misra-c2012-18.5; Reason: pointer nesting required by the API shape
+  const cardano_uplc_constant_t* const** items,
+  size_t*                                count)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_LIST)
+  {
+    return false;
+  }
+
+  if (element_type != NULL)
+  {
+    *element_type = constant->as.list.element_type;
+  }
+
+  if (items != NULL)
+  {
+    *items = constant->as.list.items;
+  }
+
+  if (count != NULL)
+  {
+    *count = constant->as.list.count;
+  }
+
+  return true;
+}
+
+bool
+cardano_uplc_builtin_as_pair(
+  const cardano_uplc_value_t*     value,
+  const cardano_uplc_constant_t** fst,
+  const cardano_uplc_constant_t** snd)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_PAIR)
+  {
+    return false;
+  }
+
+  if (fst != NULL)
+  {
+    *fst = constant->as.pair.fst;
+  }
+
+  if (snd != NULL)
+  {
+    *snd = constant->as.pair.snd;
+  }
+
+  return true;
+}
+
+/* BUILTIN BODIES **********************************************************/
+
+/**
+ * \brief Runs the binary integer-arithmetic builtins.
+ *
+ * Covers \c addInteger, \c subtractInteger and \c multiplyInteger. Each unwraps
+ * two integer arguments (a non-integer is a script error) and publishes the
+ * integer result, using an inline \c int64_t fast path with overflow detection
+ * and falling back to bigint arithmetic.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] func The arithmetic builtin to run.
+ * \param[in] args The two saturated argument values.
+ * \param[out] out_result On success, the integer result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_int_arith(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_t             func,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  int_view_t              a      = { false, 0, NULL };
+  int_view_t              b      = { false, 0, NULL };
+  const cardano_bigint_t* lhs    = NULL;
+  const cardano_bigint_t* rhs    = NULL;
+  cardano_bigint_t*       result = NULL;
+
+  if (!as_int_view(args[0], &a) || !as_int_view(args[1], &b))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (a.is_small && b.is_small)
+  {
+    int64_t out      = 0;
+    bool    overflow = false;
+
+    if (func == CARDANO_UPLC_BUILTIN_ADD_INTEGER)
+    {
+      overflow = cardano_uplc_i64_add_overflow(a.small, b.small, &out);
+    }
+    else if (func == CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER)
+    {
+      overflow = cardano_uplc_i64_sub_overflow(a.small, b.small, &out);
+    }
+    else
+    {
+      overflow = cardano_uplc_i64_mul_overflow(a.small, b.small, &out);
+    }
+
+    if (!overflow)
+    {
+      *host_error = result_integer_from_int(arena, out, out_result);
+
+      return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+  }
+
+  if (!constant_integer_big(arena, a.constant, &lhs) || !constant_integer_big(arena, b.constant, &rhs))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_bigint_from_int(0, &result);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (func == CARDANO_UPLC_BUILTIN_ADD_INTEGER)
+  {
+    cardano_bigint_add(lhs, rhs, result);
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER)
+  {
+    cardano_bigint_subtract(lhs, rhs, result);
+  }
+  else
+  {
+    cardano_bigint_multiply(lhs, rhs, result);
+  }
+
+  *host_error = result_integer(arena, result, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs the integer division-family builtins.
+ *
+ * Covers \c divideInteger and \c modInteger (floor rounding, toward negative
+ * infinity) and \c quotientInteger and \c remainderInteger (truncated rounding,
+ * toward zero). A zero divisor is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] func The division builtin to run.
+ * \param[in] args The two saturated argument values.
+ * \param[out] out_result On success, the integer result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_int_div(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_t             func,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  int_view_t              a         = { false, 0, NULL };
+  int_view_t              b         = { false, 0, NULL };
+  const cardano_bigint_t* lhs       = NULL;
+  const cardano_bigint_t* rhs       = NULL;
+  cardano_bigint_t*       quotient  = NULL;
+  cardano_bigint_t*       remainder = NULL;
+  bool                    want_quot = (func == CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER) || (func == CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER);
+  bool                    is_floor  = (func == CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER) || (func == CARDANO_UPLC_BUILTIN_MOD_INTEGER);
+
+  if (!as_int_view(args[0], &a) || !as_int_view(args[1], &b))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (a.is_small && b.is_small)
+  {
+    if (b.small == 0)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    if (!((a.small == (int64_t)INT64_MIN) && (b.small == -1)))
+    {
+      int64_t q = a.small / b.small;
+      int64_t r = a.small % b.small;
+
+      if (is_floor && (r != 0) && (((r < 0) ? -1 : 1) != ((b.small < 0) ? -1 : 1)))
+      {
+        q -= 1;
+        r += b.small;
+      }
+
+      *host_error = result_integer_from_int(arena, want_quot ? q : r, out_result);
+
+      return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+  }
+
+  if (!constant_integer_big(arena, a.constant, &lhs) || !constant_integer_big(arena, b.constant, &rhs))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_bigint_signum(rhs) == 0)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_bigint_from_int(0, &quotient);
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_bigint_from_int(0, &remainder);
+  }
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    cardano_bigint_unref(&quotient);
+    cardano_bigint_unref(&remainder);
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (is_floor)
+  {
+    floor_div_mod(lhs, rhs, quotient, remainder);
+  }
+  else
+  {
+    cardano_bigint_divide_and_reminder(lhs, rhs, quotient, remainder);
+  }
+
+  if (want_quot)
+  {
+    cardano_bigint_unref(&remainder);
+    *host_error = result_integer(arena, quotient, out_result);
+  }
+  else
+  {
+    cardano_bigint_unref(&quotient);
+    *host_error = result_integer(arena, remainder, out_result);
+  }
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs the integer comparison builtins.
+ *
+ * Covers \c equalsInteger, \c lessThanInteger and \c lessThanEqualsInteger,
+ * each producing a boolean from a signed bigint comparison.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] func The comparison builtin to run.
+ * \param[in] args The two saturated argument values.
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_int_compare(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_t             func,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  int_view_t              a     = { false, 0, NULL };
+  int_view_t              b     = { false, 0, NULL };
+  const cardano_bigint_t* lhs   = NULL;
+  const cardano_bigint_t* rhs   = NULL;
+  int32_t                 cmp   = 0;
+  bool                    value = false;
+
+  if (!as_int_view(args[0], &a) || !as_int_view(args[1], &b))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (a.is_small && b.is_small)
+  {
+    cmp = (a.small < b.small) ? (int32_t)-1 : ((a.small > b.small) ? (int32_t)1 : (int32_t)0);
+  }
+  else
+  {
+    if (!constant_integer_big(arena, a.constant, &lhs) || !constant_integer_big(arena, b.constant, &rhs))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    cmp = cardano_bigint_compare(lhs, rhs);
+  }
+
+  if (func == CARDANO_UPLC_BUILTIN_EQUALS_INTEGER)
+  {
+    value = (cmp == 0);
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER)
+  {
+    value = (cmp < 0);
+  }
+  else
+  {
+    value = (cmp <= 0);
+  }
+
+  *host_error = result_bool(arena, value, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c expModInteger: base raised to an exponent modulo a modulus.
+ *
+ * A modulus outside 1 .. 2^8191 - 1 is a script error. A modulus of one yields
+ * zero whatever the base and exponent; otherwise a base or exponent outside
+ * -(2^8191) .. 2^8191 - 1 is a script error. A zero exponent yields one. A positive exponent uses modular exponentiation. A
+ * negative exponent inverts the base modulo the modulus (a script error when the
+ * base is not invertible, or when the base is zero) then exponentiates by the
+ * magnitude.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The three saturated argument values (base, exponent, modulus).
+ * \param[out] out_result On success, the integer result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_exp_mod_integer(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_bigint_t* base     = NULL;
+  const cardano_bigint_t* exponent = NULL;
+  const cardano_bigint_t* modulus  = NULL;
+  cardano_bigint_t*       result   = NULL;
+
+  if (!as_integer_big(arena, args[0], &base) || !as_integer_big(arena, args[1], &exponent) || !as_integer_big(arena, args[2], &modulus))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((cardano_bigint_signum(modulus) <= 0) || (cardano_bigint_bit_length(modulus) > CARDANO_UPLC_BUILTIN_EXP_MOD_BOUND_BITS))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((cardano_bigint_bit_length(modulus) > 1U) && (!bigint_within_signed_bits(base, CARDANO_UPLC_BUILTIN_EXP_MOD_BOUND_BITS) || !bigint_within_signed_bits(exponent, CARDANO_UPLC_BUILTIN_EXP_MOD_BOUND_BITS)))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_bigint_from_int(0, &result);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  {
+    cardano_bigint_t* one = NULL;
+
+    *host_error = cardano_bigint_from_int(1, &one);
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      cardano_bigint_unref(&result);
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    if (cardano_bigint_compare(modulus, one) == 0)
+    {
+      cardano_bigint_unref(&one);
+
+      *host_error = result_integer_from_int(arena, 0, out_result);
+      cardano_bigint_unref(&result);
+
+      return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    if (cardano_bigint_signum(exponent) == 0)
+    {
+      cardano_bigint_unref(&one);
+
+      *host_error = result_integer_from_int(arena, 1, out_result);
+      cardano_bigint_unref(&result);
+
+      return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    if (cardano_bigint_signum(exponent) > 0)
+    {
+      cardano_bigint_unref(&one);
+
+      cardano_bigint_mod_pow(base, exponent, modulus, result);
+
+      *host_error = result_integer(arena, result, out_result);
+
+      return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    if (cardano_bigint_signum(base) == 0)
+    {
+      cardano_bigint_unref(&one);
+      cardano_bigint_unref(&result);
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    {
+      cardano_bigint_t* reduced = NULL;
+      cardano_bigint_t* gcd     = NULL;
+      cardano_bigint_t* inverse = NULL;
+      cardano_bigint_t* abs_exp = NULL;
+
+      *host_error = cardano_bigint_from_int(0, &reduced);
+
+      if (*host_error == CARDANO_SUCCESS)
+      {
+        *host_error = cardano_bigint_from_int(0, &gcd);
+      }
+
+      if (*host_error == CARDANO_SUCCESS)
+      {
+        *host_error = cardano_bigint_from_int(0, &inverse);
+      }
+
+      if (*host_error == CARDANO_SUCCESS)
+      {
+        *host_error = cardano_bigint_from_int(0, &abs_exp);
+      }
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        cardano_bigint_unref(&reduced);
+        cardano_bigint_unref(&gcd);
+        cardano_bigint_unref(&inverse);
+        cardano_bigint_unref(&abs_exp);
+        cardano_bigint_unref(&one);
+        cardano_bigint_unref(&result);
+
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      floor_div_mod(base, modulus, inverse, reduced);
+      cardano_bigint_gcd(reduced, modulus, gcd);
+
+      if (cardano_bigint_compare(gcd, one) != 0)
+      {
+        cardano_bigint_unref(&reduced);
+        cardano_bigint_unref(&gcd);
+        cardano_bigint_unref(&inverse);
+        cardano_bigint_unref(&abs_exp);
+        cardano_bigint_unref(&one);
+        cardano_bigint_unref(&result);
+
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      cardano_bigint_mod_inverse(reduced, modulus, inverse);
+      cardano_bigint_abs(exponent, abs_exp);
+      cardano_bigint_mod_pow(inverse, abs_exp, modulus, result);
+
+      cardano_bigint_unref(&reduced);
+      cardano_bigint_unref(&gcd);
+      cardano_bigint_unref(&inverse);
+      cardano_bigint_unref(&abs_exp);
+      cardano_bigint_unref(&one);
+
+      *host_error = result_integer(arena, result, out_result);
+
+      return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+  }
+}
+
+/**
+ * \brief Runs \c appendByteString: the concatenation of two byte strings.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two saturated argument values.
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_append_byte_string(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t lhs     = { NULL, 0U };
+  cardano_uplc_byte_view_t rhs     = { NULL, 0U };
+  size_t                   total   = 0U;
+  byte_t*                  scratch = NULL;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &lhs) || !cardano_uplc_builtin_as_byte_string(args[1], &rhs))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  total = lhs.size + rhs.size;
+
+  if (total == 0U)
+  {
+    *host_error = result_bytes_from(arena, NULL, 0U, out_result);
+
+    return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  scratch = (byte_t*)cardano_uplc_arena_alloc(arena, total, 1U);
+
+  if (scratch == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (lhs.size > 0U)
+  {
+    cardano_safe_memcpy(scratch, total, lhs.data, lhs.size);
+  }
+
+  if (rhs.size > 0U)
+  {
+    // cppcheck-suppress misra-c2012-18.4; Reason: pointer arithmetic over a contiguous arena buffer
+    cardano_safe_memcpy(scratch + lhs.size, rhs.size, rhs.data, rhs.size);
+  }
+
+  *host_error = result_bytes_take(arena, scratch, total, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c consByteString: prepends a byte to a byte string.
+ *
+ * With range checks on, a leading integer outside 0..255 is a script error; with
+ * range checks off the byte wraps modulo 256. The semantics variant selects which
+ * behaviour applies.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] semantics The semantics variant selecting the range-check behaviour.
+ * \param[in] args The two saturated argument values (byte, byte string).
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_cons_byte_string(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_semantics_t   semantics,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_bigint_t*  head    = NULL;
+  cardano_uplc_byte_view_t tail    = { NULL, 0U };
+  byte_t                   byte    = 0;
+  byte_t*                  scratch = NULL;
+
+  if (!as_integer_big(arena, args[0], &head) || !cardano_uplc_builtin_as_byte_string(args[1], &tail))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_uplc_semantics_cons_byte_string_range_checks(semantics))
+  {
+    cardano_bigint_t* upper = NULL;
+
+    if (cardano_bigint_signum(head) < 0)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    *host_error = cardano_bigint_from_int(CARDANO_UPLC_BUILTIN_BYTE_MAX, &upper);
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    if (cardano_bigint_compare(head, upper) > 0)
+    {
+      cardano_bigint_unref(&upper);
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    cardano_bigint_unref(&upper);
+
+    byte = (byte_t)(cardano_bigint_to_unsigned_int(head) & 0xFFU);
+  }
+  else
+  {
+    cardano_bigint_t* modulus = NULL;
+    cardano_bigint_t* wrapped = NULL;
+    cardano_bigint_t* discard = NULL;
+
+    *host_error = cardano_bigint_from_int(CARDANO_UPLC_BUILTIN_BYTE_MODULUS, &modulus);
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = cardano_bigint_from_int(0, &wrapped);
+    }
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = cardano_bigint_from_int(0, &discard);
+    }
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      cardano_bigint_unref(&modulus);
+      cardano_bigint_unref(&wrapped);
+      cardano_bigint_unref(&discard);
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    floor_div_mod(head, modulus, discard, wrapped);
+
+    byte = (byte_t)(cardano_bigint_to_unsigned_int(wrapped) & 0xFFU);
+
+    cardano_bigint_unref(&modulus);
+    cardano_bigint_unref(&wrapped);
+    cardano_bigint_unref(&discard);
+  }
+
+  scratch = (byte_t*)cardano_uplc_arena_alloc(arena, tail.size + 1U, 1U);
+
+  if (scratch == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  scratch[0] = byte;
+
+  if (tail.size > 0U)
+  {
+    // cppcheck-suppress misra-c2012-18.4; Reason: pointer arithmetic over a contiguous arena buffer
+    cardano_safe_memcpy(scratch + 1U, tail.size, tail.data, tail.size);
+  }
+
+  *host_error = result_bytes_take(arena, scratch, tail.size + 1U, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Converts a signed count to a clamped \c size_t skip/take count.
+ *
+ * A negative value clamps to zero (so a negative skip or take selects nothing); a
+ * value above the byte-string length clamps to the length.
+ *
+ * \param[in] value The count to clamp.
+ * \param[in] limit The upper bound (the byte-string length).
+ *
+ * \return The clamped count in 0..limit.
+ */
+static size_t
+clamp_index(int64_t value, size_t limit)
+{
+  if (value < 0)
+  {
+    return 0U;
+  }
+
+  if ((uint64_t)value > (uint64_t)limit)
+  {
+    return limit;
+  }
+
+  return (size_t)value;
+}
+
+/**
+ * \brief Runs \c sliceByteString: a clamped sub-string by start and length.
+ *
+ * The start and length must fit a signed 64-bit integer, otherwise the call is a
+ * script error. Within that range they are clamped to the byte-string bounds, so
+ * an out-of-range request yields a shorter or empty result rather than an error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The three saturated argument values (start, length, byte string).
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_slice_byte_string(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_bigint_t*  start_arg = NULL;
+  const cardano_bigint_t*  len_arg   = NULL;
+  cardano_uplc_byte_view_t bytes     = { NULL, 0U };
+  int64_t                  start     = 0;
+  int64_t                  length    = 0;
+  size_t                   skip      = 0U;
+  size_t                   take      = 0U;
+  size_t                   available = 0U;
+
+  if (!as_integer_big(arena, args[0], &start_arg) || !as_integer_big(arena, args[1], &len_arg) || !cardano_uplc_builtin_as_byte_string(args[2], &bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (!cardano_uplc_int_bigint_fits_int64(start_arg, &start) || !cardano_uplc_int_bigint_fits_int64(len_arg, &length))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  skip = clamp_index(start, bytes.size);
+  take = clamp_index(length, bytes.size);
+
+  available = bytes.size - skip;
+
+  if (take > available)
+  {
+    take = available;
+  }
+
+  // cppcheck-suppress misra-c2012-18.4; Reason: pointer arithmetic over a contiguous arena buffer
+  *host_error = result_bytes_from(arena, (bytes.data != NULL) ? (bytes.data + skip) : NULL, take, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c lengthOfByteString: the length of a byte string as an integer.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the integer result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_length_of_byte_string(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes = { NULL, 0U };
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_integer_from_int(arena, (int64_t)bytes.size, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c indexByteString: the byte at an index, as an integer.
+ *
+ * An index below zero or at or beyond the length is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two saturated argument values (byte string, index).
+ * \param[out] out_result On success, the integer result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_index_byte_string(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes = { NULL, 0U };
+  const cardano_bigint_t*  index = NULL;
+  uint64_t                 raw   = 0U;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes) || !as_integer_big(arena, args[1], &index))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((cardano_bigint_signum(index) < 0) || (cardano_bigint_bit_length(index) > 63U))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  raw = cardano_bigint_to_unsigned_int(index);
+
+  if (raw >= (uint64_t)bytes.size)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_integer_from_int(arena, (int64_t)bytes.data[raw], out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs the byte-string comparison builtins.
+ *
+ * Covers \c equalsByteString, \c lessThanByteString and
+ * \c lessThanEqualsByteString, each producing a boolean from a lexicographic
+ * comparison of the two byte strings.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] func The comparison builtin to run.
+ * \param[in] args The two saturated argument values.
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_byte_string_compare(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_t             func,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t lhs   = { NULL, 0U };
+  cardano_uplc_byte_view_t rhs   = { NULL, 0U };
+  int                      cmp   = 0;
+  bool                     value = false;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &lhs) || !cardano_uplc_builtin_as_byte_string(args[1], &rhs))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  cmp = byte_view_compare(lhs.data, lhs.size, rhs.data, rhs.size);
+
+  if (func == CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING)
+  {
+    value = (cmp == 0);
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING)
+  {
+    value = (cmp < 0);
+  }
+  else
+  {
+    value = (cmp <= 0);
+  }
+
+  *host_error = result_bool(arena, value, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/* BITWISE BODIES **********************************************************/
+
+/**
+ * \brief Runs the logical binary bitwise builtins over two byte strings.
+ *
+ * Covers \c andByteString, \c orByteString and \c xorByteString. The leading
+ * boolean selects padding: when set, the shorter operand is virtually extended so
+ * the result has the length of the longer operand, the surplus bytes carried
+ * through unchanged (which matches AND-with-0xFF, OR-with-0x00 and XOR-with-0x00);
+ * when clear, the result length is the shorter operand.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] func The logical builtin to run.
+ * \param[in] args The three saturated argument values (pad flag, two byte strings).
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_logical_byte_string(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_t             func,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  bool                     should_pad = false;
+  cardano_uplc_byte_view_t lhs        = { NULL, 0U };
+  cardano_uplc_byte_view_t rhs        = { NULL, 0U };
+  const byte_t*            a          = NULL;
+  const byte_t*            b          = NULL;
+  size_t                   la         = 0U;
+  size_t                   lb         = 0U;
+  size_t                   shorter    = 0U;
+  size_t                   out_len    = 0U;
+  byte_t*                  scratch    = NULL;
+  size_t                   i          = 0U;
+
+  if (!cardano_uplc_builtin_as_bool(args[0], &should_pad) || !cardano_uplc_builtin_as_byte_string(args[1], &lhs) || !cardano_uplc_builtin_as_byte_string(args[2], &rhs))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  a  = lhs.data;
+  b  = rhs.data;
+  la = lhs.size;
+  lb = rhs.size;
+
+  shorter = (la < lb) ? la : lb;
+  out_len = should_pad ? ((la > lb) ? la : lb) : shorter;
+
+  if (out_len == 0U)
+  {
+    *host_error = result_bytes_from(arena, NULL, 0U, out_result);
+
+    return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  scratch = (byte_t*)cardano_uplc_arena_alloc(arena, out_len, 1U);
+
+  if (scratch == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; i < shorter; ++i)
+  {
+    if (func == CARDANO_UPLC_BUILTIN_AND_BYTE_STRING)
+    {
+      scratch[i] = (byte_t)(a[i] & b[i]);
+    }
+    else if (func == CARDANO_UPLC_BUILTIN_OR_BYTE_STRING)
+    {
+      scratch[i] = (byte_t)(a[i] | b[i]);
+    }
+    else
+    {
+      scratch[i] = (byte_t)(a[i] ^ b[i]);
+    }
+  }
+
+  for (i = shorter; i < out_len; ++i)
+  {
+    scratch[i] = (i < la) ? a[i] : b[i];
+  }
+
+  *host_error = result_bytes_take(arena, scratch, out_len, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c complementByteString: every byte XOR-ed with 0xFF.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_complement_byte_string(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes   = { NULL, 0U };
+  byte_t*                  scratch = NULL;
+  size_t                   i       = 0U;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (bytes.size == 0U)
+  {
+    *host_error = result_bytes_from(arena, NULL, 0U, out_result);
+
+    return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  scratch = (byte_t*)cardano_uplc_arena_alloc(arena, bytes.size, 1U);
+
+  if (scratch == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; i < bytes.size; ++i)
+  {
+    scratch[i] = (byte_t)(bytes.data[i] ^ (byte_t)CARDANO_UPLC_BUILTIN_BYTE_MAX);
+  }
+
+  *host_error = result_bytes_take(arena, scratch, bytes.size, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Resolves a CIP-0122 bit index to a byte offset and intra-byte bit.
+ *
+ * The bit index is counted from the least-significant bit of the last byte, so
+ * byte offset \c index/8 measures from the end of the string and the intra-byte
+ * offset \c index%8 counts from the low bit. The caller must have checked the
+ * index is in 0..len*8.
+ *
+ * \param[in] bit_index The non-negative bit index, known to be in range.
+ * \param[in] length The byte-string length.
+ * \param[out] byte_pos The resolved index into the byte array (from the front).
+ * \param[out] bit_offset The intra-byte bit offset from the low bit (0..7).
+ */
+static void
+resolve_bit(uint64_t bit_index, size_t length, size_t* byte_pos, unsigned int* bit_offset)
+{
+  uint64_t from_end = bit_index / 8U;
+
+  *bit_offset = (unsigned int)(bit_index % 8U);
+  *byte_pos   = (length - 1U) - (size_t)from_end;
+}
+
+/**
+ * \brief Runs \c readBit: reads one bit of a byte string as a boolean.
+ *
+ * An empty byte string, or a bit index outside 0..len*8, is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two saturated argument values (byte string, bit index).
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_read_bit(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes      = { NULL, 0U };
+  const cardano_bigint_t*  bit_index  = NULL;
+  uint64_t                 index      = 0U;
+  size_t                   byte_pos   = 0U;
+  unsigned int             bit_offset = 0U;
+  bool                     value      = false;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes) || !as_integer_big(arena, args[1], &bit_index))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (bytes.size == 0U)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((cardano_bigint_signum(bit_index) < 0) || (cardano_bigint_bit_length(bit_index) > 63U))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  index = cardano_bigint_to_unsigned_int(bit_index);
+
+  if (index >= (uint64_t)bytes.size * 8U)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  resolve_bit(index, bytes.size, &byte_pos, &bit_offset);
+
+  value = (((bytes.data[byte_pos] >> bit_offset) & 1U) == 1U);
+
+  *host_error = result_bool(arena, value, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c writeBits: sets or clears each listed bit of a byte string.
+ *
+ * The first argument is the byte string, the second a list of integer bit
+ * indices, the third the boolean value to write. Any index outside 0..len*8 is a
+ * script error and no result is produced. Under the variants that bound
+ * byte-string arguments an input longer than 4096 bytes is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] semantics The semantics variant selecting the input-length bound.
+ * \param[in] args The three saturated argument values (byte string, index list, bit).
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_write_bits(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_semantics_t   semantics,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t              bytes   = { NULL, 0U };
+  const cardano_uplc_type_t*            element = NULL;
+  const cardano_uplc_constant_t* const* items   = NULL;
+  size_t                                count   = 0U;
+  bool                                  set_bit = false;
+  byte_t*                               scratch = NULL;
+  size_t                                i       = 0U;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes) || !cardano_uplc_builtin_as_list(args[1], &element, &items, &count) || !cardano_uplc_builtin_as_bool(args[2], &set_bit))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_uplc_semantics_bounds_byte_string_arguments(semantics) && (bytes.size > CARDANO_UPLC_BUILTIN_WRITE_BITS_INPUT_MAX))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (bytes.size > 0U)
+  {
+    scratch = (byte_t*)cardano_uplc_arena_alloc(arena, bytes.size, 1U);
+
+    if (scratch == NULL)
+    {
+      *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    cardano_safe_memcpy(scratch, bytes.size, bytes.data, bytes.size);
+  }
+
+  for (i = 0U; i < count; ++i)
+  {
+    const cardano_uplc_constant_t* item       = items[i];
+    uint64_t                       index      = 0U;
+    size_t                         byte_pos   = 0U;
+    unsigned int                   bit_offset = 0U;
+    byte_t                         mask       = 0;
+
+    if ((item == NULL) || (item->kind != CARDANO_UPLC_TYPE_INTEGER))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    if (cardano_uplc_constant_int_is_small(item))
+    {
+      const int64_t small = cardano_uplc_constant_int_small(item);
+
+      if (small < 0)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      index = (uint64_t)small;
+    }
+    else
+    {
+      const cardano_bigint_t* big = item->as.integer.big;
+
+      if ((cardano_bigint_signum(big) < 0) || (cardano_bigint_bit_length(big) > 63U))
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      index = cardano_bigint_to_unsigned_int(big);
+    }
+
+    if (index >= (uint64_t)bytes.size * 8U)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    resolve_bit(index, bytes.size, &byte_pos, &bit_offset);
+
+    mask = (byte_t)(1U << bit_offset);
+
+    if (set_bit)
+    {
+      scratch[byte_pos] = (byte_t)(scratch[byte_pos] | mask);
+    }
+    else
+    {
+      scratch[byte_pos] = (byte_t)(scratch[byte_pos] & (byte_t)(~mask));
+    }
+  }
+
+  *host_error = result_bytes_take(arena, scratch, bytes.size, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c replicateByte: a byte string of one repeated byte.
+ *
+ * The first argument is the count (non-negative, already bounded by the cost
+ * model), the second the byte value (a value outside 0..255 is a script error).
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two saturated argument values (count, byte).
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_replicate_byte(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_bigint_t* size_arg = NULL;
+  const cardano_bigint_t* byte_arg = NULL;
+  uint64_t                size     = 0U;
+  byte_t                  byte     = 0;
+  byte_t*                 scratch  = NULL;
+
+  if (!as_integer_big(arena, args[0], &size_arg) || !as_integer_big(arena, args[1], &byte_arg))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((cardano_bigint_signum(size_arg) < 0) || (cardano_bigint_bit_length(size_arg) > 63U))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_bigint_to_unsigned_int(size_arg) > (uint64_t)CARDANO_UPLC_BUILTIN_INT_TO_BS_MAX)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  {
+    cardano_bigint_t* upper = NULL;
+
+    if (cardano_bigint_signum(byte_arg) < 0)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    *host_error = cardano_bigint_from_int(CARDANO_UPLC_BUILTIN_BYTE_MAX, &upper);
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    if (cardano_bigint_compare(byte_arg, upper) > 0)
+    {
+      cardano_bigint_unref(&upper);
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    cardano_bigint_unref(&upper);
+  }
+
+  size = cardano_bigint_to_unsigned_int(size_arg);
+  byte = (byte_t)(cardano_bigint_to_unsigned_int(byte_arg) & 0xFFU);
+
+  if (size == 0U)
+  {
+    *host_error = result_bytes_from(arena, NULL, 0U, out_result);
+
+    return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  scratch = (byte_t*)cardano_uplc_arena_alloc(arena, (size_t)size, 1U);
+
+  if (scratch == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  (void)memset(scratch, byte, (size_t)size);
+
+  *host_error = result_bytes_take(arena, scratch, (size_t)size, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c shiftByteString: a logical bit shift, MSB-first, zero-filled.
+ *
+ * The shift count is signed: a positive count shifts left (toward the most
+ * significant bit), a negative count shifts right; the result keeps the input
+ * length and vacated bits are zero. A magnitude at or beyond the bit length
+ * yields an all-zero string. Bits are addressed most-significant-first. Under the
+ * variants that bound byte-string arguments a shift that does not fit a signed
+ * 64-bit integer is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] semantics The semantics variant selecting the shift bound.
+ * \param[in] args The two saturated argument values (byte string, shift).
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_shift_byte_string(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_semantics_t   semantics,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes     = { NULL, 0U };
+  const cardano_bigint_t*  shift     = NULL;
+  const byte_t*            data      = NULL;
+  size_t                   size      = 0U;
+  uint64_t                 bits      = 0U;
+  uint64_t                 magnitude = 0U;
+  bool                     is_left   = false;
+  byte_t*                  scratch   = NULL;
+  uint64_t                 dst_bit   = 0U;
+  int64_t                  bounded   = 0;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes) || !as_integer_big(arena, args[1], &shift))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_uplc_semantics_bounds_byte_string_arguments(semantics) && !cardano_uplc_int_bigint_fits_int64(shift, &bounded))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  data = bytes.data;
+  size = bytes.size;
+  bits = (uint64_t)size * 8U;
+
+  is_left = (cardano_bigint_signum(shift) >= 0);
+
+  if (cardano_bigint_bit_length(shift) > 63U)
+  {
+    magnitude = bits;
+  }
+  else
+  {
+    cardano_bigint_t* abs_shift = NULL;
+
+    *host_error = cardano_bigint_from_int(0, &abs_shift);
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    cardano_bigint_abs(shift, abs_shift);
+    magnitude = cardano_bigint_to_unsigned_int(abs_shift);
+    cardano_bigint_unref(&abs_shift);
+  }
+
+  if (size == 0U)
+  {
+    *host_error = result_bytes_from(arena, NULL, 0U, out_result);
+
+    return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  scratch = (byte_t*)cardano_uplc_arena_alloc(arena, size, 1U);
+
+  if (scratch == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  (void)memset(scratch, 0, size);
+
+  for (dst_bit = 0U; dst_bit < bits; ++dst_bit)
+  {
+    uint64_t src_bit  = 0U;
+    bool     in_range = false;
+
+    if (is_left)
+    {
+      src_bit  = dst_bit + magnitude;
+      in_range = (src_bit < bits);
+    }
+    else
+    {
+      if (dst_bit >= magnitude)
+      {
+        src_bit  = dst_bit - magnitude;
+        in_range = true;
+      }
+    }
+
+    if (in_range)
+    {
+      size_t       src_byte = (size_t)(src_bit / 8U);
+      unsigned int src_off  = (unsigned int)(7U - (src_bit % 8U));
+      size_t       dst_byte = (size_t)(dst_bit / 8U);
+      unsigned int dst_off  = (unsigned int)(7U - (dst_bit % 8U));
+
+      if (((data[src_byte] >> src_off) & 1U) == 1U)
+      {
+        scratch[dst_byte] = (byte_t)(scratch[dst_byte] | (byte_t)(1U << dst_off));
+      }
+    }
+  }
+
+  *host_error = result_bytes_take(arena, scratch, size, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c rotateByteString: a circular bit rotation, MSB-first.
+ *
+ * The bit rotation count is reduced modulo the bit length (floor modulo, so a
+ * negative count rotates right). Bits shifted off one end re-enter at the other;
+ * the result keeps the input length. An empty input is returned unchanged. Under
+ * the variants that bound byte-string arguments a rotation that does not fit a
+ * signed 64-bit integer is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] semantics The semantics variant selecting the rotation bound.
+ * \param[in] args The two saturated argument values (byte string, rotation).
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_rotate_byte_string(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_semantics_t   semantics,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes   = { NULL, 0U };
+  const cardano_bigint_t*  shift   = NULL;
+  const byte_t*            data    = NULL;
+  size_t                   size    = 0U;
+  uint64_t                 bits    = 0U;
+  uint64_t                 rot     = 0U;
+  byte_t*                  scratch = NULL;
+  uint64_t                 dst_bit = 0U;
+  int64_t                  bounded = 0;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes) || !as_integer_big(arena, args[1], &shift))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_uplc_semantics_bounds_byte_string_arguments(semantics) && !cardano_uplc_int_bigint_fits_int64(shift, &bounded))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  data = bytes.data;
+  size = bytes.size;
+
+  if (size == 0U)
+  {
+    *host_error = result_bytes_from(arena, NULL, 0U, out_result);
+
+    return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  bits = (uint64_t)size * 8U;
+
+  {
+    cardano_bigint_t* modulus  = NULL;
+    cardano_bigint_t* reduced  = NULL;
+    cardano_bigint_t* quotient = NULL;
+
+    *host_error = cardano_bigint_from_unsigned_int(bits, &modulus);
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = cardano_bigint_from_int(0, &reduced);
+    }
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = cardano_bigint_from_int(0, &quotient);
+    }
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      cardano_bigint_unref(&modulus);
+      cardano_bigint_unref(&reduced);
+      cardano_bigint_unref(&quotient);
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    floor_div_mod(shift, modulus, quotient, reduced);
+    rot = cardano_bigint_to_unsigned_int(reduced);
+
+    cardano_bigint_unref(&modulus);
+    cardano_bigint_unref(&reduced);
+    cardano_bigint_unref(&quotient);
+  }
+
+  scratch = (byte_t*)cardano_uplc_arena_alloc(arena, size, 1U);
+
+  if (scratch == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  (void)memset(scratch, 0, size);
+
+  for (dst_bit = 0U; dst_bit < bits; ++dst_bit)
+  {
+    uint64_t     src_bit  = (dst_bit + rot) % bits;
+    size_t       src_byte = (size_t)(src_bit / 8U);
+    unsigned int src_off  = (unsigned int)(7U - (src_bit % 8U));
+    size_t       dst_byte = (size_t)(dst_bit / 8U);
+    unsigned int dst_off  = (unsigned int)(7U - (dst_bit % 8U));
+
+    if (((data[src_byte] >> src_off) & 1U) == 1U)
+    {
+      scratch[dst_byte] = (byte_t)(scratch[dst_byte] | (byte_t)(1U << dst_off));
+    }
+  }
+
+  *host_error = result_bytes_take(arena, scratch, size, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c countSetBits: the population count of a byte string.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the integer result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_count_set_bits(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes = { NULL, 0U };
+  const byte_t*            data  = NULL;
+  size_t                   size  = 0U;
+  int64_t                  total = 0;
+  size_t                   i     = 0U;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  data = bytes.data;
+  size = bytes.size;
+
+  for (i = 0U; i < size; ++i)
+  {
+    byte_t b = data[i];
+
+    while (b != 0U)
+    {
+      total += (int64_t)b & (int64_t)1;
+      b     = (byte_t)(b >> 1);
+    }
+  }
+
+  *host_error = result_integer_from_int(arena, total, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c findFirstSetBit: the index of the lowest set bit, else -1.
+ *
+ * The bit index is counted from the least-significant bit of the last byte, the
+ * same ordering as \c readBit. An all-zero or empty string yields -1.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the integer result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_find_first_set_bit(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes  = { NULL, 0U };
+  const byte_t*            data   = NULL;
+  size_t                   size   = 0U;
+  int64_t                  result = -1;
+  size_t                   i      = 0U;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  data = bytes.data;
+  size = bytes.size;
+
+  for (i = 0U; (i < size) && (result < 0); ++i)
+  {
+    byte_t b = data[size - 1U - i];
+
+    if (b != 0U)
+    {
+      unsigned int bit = 0U;
+
+      while (((b >> bit) & 1U) == 0U)
+      {
+        ++bit;
+      }
+
+      result = ((int64_t)i * 8) + (int64_t)bit;
+    }
+  }
+
+  *host_error = result_integer_from_int(arena, result, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c integerToByteString: a fixed-or-minimal-width encoding.
+ *
+ * The first argument is the endianness flag (true for big-endian), the second the
+ * requested width (zero meaning the minimal width), the third the non-negative
+ * value. A negative value, a negative or over-large width, or a width too small to
+ * hold the value, is a script error; a zero width with a value that would exceed
+ * the maximum output length is likewise a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The three saturated argument values (endianness, width, value).
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_integer_to_byte_string(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  bool                    big_endian  = false;
+  const cardano_bigint_t* width_arg   = NULL;
+  const cardano_bigint_t* value       = NULL;
+  uint64_t                width       = 0U;
+  size_t                  value_bytes = 0U;
+  byte_t*                 raw         = NULL;
+  byte_t*                 scratch     = NULL;
+  size_t                  out_len     = 0U;
+  cardano_error_t         conv        = CARDANO_SUCCESS;
+
+  if (!cardano_uplc_builtin_as_bool(args[0], &big_endian) || !as_integer_big(arena, args[1], &width_arg) || !as_integer_big(arena, args[2], &value))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_bigint_signum(width_arg) < 0)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_bigint_bit_length(width_arg) > 63U)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  width = cardano_bigint_to_unsigned_int(width_arg);
+
+  if (width > (uint64_t)CARDANO_UPLC_BUILTIN_INT_TO_BS_MAX)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_bigint_signum(value) < 0)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((width == 0U) && (cardano_bigint_signum(value) != 0))
+  {
+    size_t needed = (cardano_bigint_bit_length(value) + 7U) / 8U;
+
+    if (needed > (size_t)CARDANO_UPLC_BUILTIN_INT_TO_BS_MAX)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+  }
+
+  if (cardano_bigint_signum(value) == 0)
+  {
+    if (width == 0U)
+    {
+      *host_error = result_bytes_from(arena, NULL, 0U, out_result);
+
+      return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    scratch = (byte_t*)cardano_uplc_arena_alloc(arena, (size_t)width, 1U);
+
+    if (scratch == NULL)
+    {
+      *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    (void)memset(scratch, 0, (size_t)width);
+    *host_error = result_bytes_take(arena, scratch, (size_t)width, out_result);
+
+    return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  value_bytes = cardano_bigint_get_bytes_size(value);
+  raw         = (byte_t*)_cardano_malloc(value_bytes);
+
+  if (raw == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  conv = cardano_bigint_to_bytes(value, CARDANO_BYTE_ORDER_BIG_ENDIAN, raw, value_bytes);
+
+  if (conv != CARDANO_SUCCESS)
+  {
+    _cardano_free(raw);
+    *host_error = conv;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  {
+    size_t lead = 0U;
+
+    while ((lead < (value_bytes - 1U)) && (raw[lead] == 0U))
+    {
+      ++lead;
+    }
+
+    {
+      size_t significant = value_bytes - lead;
+      // cppcheck-suppress misra-c2012-18.4; Reason: pointer arithmetic over a contiguous arena buffer
+      byte_t* msb      = raw + lead;
+      size_t  width_sz = (size_t)width;
+
+      if ((width_sz != 0U) && (value_bytes > (width_sz + lead)))
+      {
+        _cardano_free(raw);
+
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      out_len = (width_sz != 0U) ? width_sz : significant;
+
+      scratch = (byte_t*)cardano_uplc_arena_alloc(arena, out_len, 1U);
+
+      if (scratch == NULL)
+      {
+        _cardano_free(raw);
+        *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      (void)memset(scratch, 0, out_len);
+
+      if (big_endian)
+      {
+        // cppcheck-suppress misra-c2012-18.4; Reason: pointer arithmetic over a contiguous arena buffer
+        cardano_safe_memcpy(scratch + (out_len - significant), significant, msb, significant);
+      }
+      else
+      {
+        size_t k = 0U;
+
+        for (k = 0U; k < significant; ++k)
+        {
+          scratch[k] = msb[significant - 1U - k];
+        }
+      }
+
+      _cardano_free(raw);
+    }
+  }
+
+  *host_error = result_bytes_take(arena, scratch, out_len, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c byteStringToInteger: decodes a byte string as a non-negative int.
+ *
+ * The first argument is the endianness flag (true for big-endian), the second the
+ * byte string. An empty input decodes to zero. The result is always non-negative.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two saturated argument values (endianness, byte string).
+ * \param[out] out_result On success, the integer result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_byte_string_to_integer(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  bool                     big_endian = false;
+  cardano_uplc_byte_view_t bytes      = { NULL, 0U };
+  const byte_t*            data       = NULL;
+  size_t                   size       = 0U;
+  cardano_bigint_t*        value      = NULL;
+
+  if (!cardano_uplc_builtin_as_bool(args[0], &big_endian) || !cardano_uplc_builtin_as_byte_string(args[1], &bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  data = bytes.data;
+  size = bytes.size;
+
+  if (size == 0U)
+  {
+    *host_error = result_integer_from_int(arena, 0, out_result);
+
+    return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_bigint_from_bytes(
+    data,
+    size,
+    big_endian ? CARDANO_BYTE_ORDER_BIG_ENDIAN : CARDANO_BYTE_ORDER_LITTLE_ENDIAN,
+    &value);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_integer(arena, value, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/* BOOL, UNIT, STRING, PAIR AND LIST BODIES *******************************/
+
+/**
+ * \brief Builds a string result value by copying a raw UTF-8 span into the arena.
+ *
+ * The span must already hold valid UTF-8; the constructor does not re-validate. Like
+ * the byte-string producer it bump-allocates the copy in the arena and never mallocs
+ * or refcounts a library buffer.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] data The UTF-8 bytes to copy, or NULL when \p size is 0.
+ * \param[in] size The number of bytes.
+ * \param[out] out On success, the constant value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+result_string_from(
+  struct cardano_uplc_arena_t* arena,
+  const byte_t*                data,
+  size_t                       size,
+  const cardano_uplc_value_t** out)
+{
+  cardano_uplc_constant_t* constant = NULL;
+  cardano_uplc_value_t*    result   = NULL;
+  cardano_error_t          error    = cardano_uplc_int_constant_new_string_copy(arena, data, size, &constant);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Runs \c ifThenElse: selects one of two already-evaluated values.
+ *
+ * The leading argument is a boolean; a non-boolean is a script error. The result
+ * is the second argument when the boolean is true and the third otherwise. Both
+ * branch arguments are returned by value unchanged.
+ *
+ * \param[in] args The three saturated argument values (condition, then, else).
+ * \param[out] out_result On success, the selected branch value.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_if_then_else(
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result)
+{
+  bool condition = false;
+
+  if (!cardano_uplc_builtin_as_bool(args[0], &condition))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = condition ? args[1] : args[2];
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c chooseUnit: forces the unit type then returns its second value.
+ *
+ * The first argument must be the unit constant (a type check; any other value is a
+ * script error); the result is the second argument returned unchanged.
+ *
+ * \param[in] args The two saturated argument values (unit, value).
+ * \param[out] out_result On success, the second argument value.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_choose_unit(
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result)
+{
+  if (!cardano_uplc_builtin_as_unit(args[0]))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = args[1];
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c trace: type-checks the trace string then returns its second value.
+ *
+ * The first argument must be a string (a type check; a non-string is a script
+ * error). Trace output is not surfaced by this machine, so the text is
+ * type-checked and discarded. The result is the second argument returned
+ * unchanged.
+ *
+ * \param[in] args The two saturated argument values (message, value).
+ * \param[out] out_result On success, the second argument value.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_trace(
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result)
+{
+  cardano_uplc_byte_view_t message = { NULL, 0U };
+
+  if (!cardano_uplc_builtin_as_string(args[0], &message))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  (void)message;
+
+  *out_result = args[1];
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c appendString: concatenates two UTF-8 text strings.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two saturated argument values.
+ * \param[out] out_result On success, the string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_append_string(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t lhs     = { NULL, 0U };
+  cardano_uplc_byte_view_t rhs     = { NULL, 0U };
+  size_t                   total   = 0U;
+  byte_t*                  scratch = NULL;
+
+  if (!cardano_uplc_builtin_as_string(args[0], &lhs) || !cardano_uplc_builtin_as_string(args[1], &rhs))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  total = lhs.size + rhs.size;
+
+  if (total == 0U)
+  {
+    *host_error = result_string_from(arena, NULL, 0U, out_result);
+
+    return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  scratch = (byte_t*)cardano_uplc_arena_alloc(arena, total, 1U);
+
+  if (scratch == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (lhs.size > 0U)
+  {
+    cardano_safe_memcpy(scratch, total, lhs.data, lhs.size);
+  }
+
+  if (rhs.size > 0U)
+  {
+    // cppcheck-suppress misra-c2012-18.4; Reason: pointer arithmetic over a contiguous arena buffer
+    cardano_safe_memcpy(scratch + lhs.size, rhs.size, rhs.data, rhs.size);
+  }
+
+  *host_error = result_string_from(arena, scratch, total, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c equalsString: tests two UTF-8 text strings for equality.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two saturated argument values.
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_equals_string(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t lhs = { NULL, 0U };
+  cardano_uplc_byte_view_t rhs = { NULL, 0U };
+
+  if (!cardano_uplc_builtin_as_string(args[0], &lhs) || !cardano_uplc_builtin_as_string(args[1], &rhs))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_bool(arena, byte_view_compare(lhs.data, lhs.size, rhs.data, rhs.size) == 0, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c encodeUtf8: the UTF-8 bytes of a text string as a byte string.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_encode_utf8(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t text = { NULL, 0U };
+
+  if (!cardano_uplc_builtin_as_string(args[0], &text))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_bytes_from(arena, text.data, text.size, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c decodeUtf8: a byte string interpreted as UTF-8 text.
+ *
+ * A byte string that is not well-formed UTF-8 is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_decode_utf8(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes = { NULL, 0U };
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (!is_valid_utf8(bytes.data, bytes.size))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_string_from(arena, bytes.data, bytes.size, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c fstPair and \c sndPair: a pair component as a value.
+ *
+ * The argument must be a pair (a non-pair is a script error). The result wraps the
+ * selected component constant in a constant value.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] want_first Selects the first component when true, the second otherwise.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the component value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_pair_component(
+  struct cardano_uplc_arena_t*       arena,
+  bool                               want_first,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_constant_t* fst    = NULL;
+  const cardano_uplc_constant_t* snd    = NULL;
+  cardano_uplc_value_t*          result = NULL;
+
+  if (!cardano_uplc_builtin_as_pair(args[0], &fst, &snd))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_value_new_constant(arena, want_first ? fst : snd, &result);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c chooseList: branches on whether a list is empty.
+ *
+ * The first argument must be a list (a non-list is a script error). The result is
+ * the second argument when the list is empty and the third otherwise, returned by
+ * value unchanged.
+ *
+ * \param[in] args The three saturated argument values (list, empty case, non-empty).
+ * \param[out] out_result On success, the selected branch value.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_choose_list(
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result)
+{
+  size_t count = 0U;
+
+  if (!cardano_uplc_builtin_as_list(args[0], NULL, NULL, &count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = (count == 0U) ? args[1] : args[2];
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c mkCons: prepends an element to a list of matching element type.
+ *
+ * The first argument is the element constant, the second a list whose element type
+ * must equal the element's type (a mismatch is a script error). The result is a new
+ * list carrying the declared element type with the element at the head.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two saturated argument values (element, list).
+ * \param[out] out_result On success, the list result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_mk_cons(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_constant_t*        head         = NULL;
+  const cardano_uplc_type_t*            element_type = NULL;
+  const cardano_uplc_constant_t* const* items        = NULL;
+  size_t                                count        = 0U;
+  const cardano_uplc_constant_t**       merged       = NULL;
+  cardano_uplc_constant_t*              constant     = NULL;
+  cardano_uplc_value_t*                 result       = NULL;
+  size_t                                i            = 0U;
+
+  if (!as_constant(args[0], &head))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (!cardano_uplc_builtin_as_list(args[1], &element_type, &items, &count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (!constant_has_type(element_type, head))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  merged = (const cardano_uplc_constant_t**)cardano_uplc_arena_alloc(arena, sizeof(*merged) * (count + 1U), 0U);
+
+  if (merged == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  merged[0] = head;
+
+  for (i = 0U; i < count; ++i)
+  {
+    merged[i + 1U] = items[i];
+  }
+
+  *host_error = cardano_uplc_constant_new_list(arena, element_type, merged, count + 1U, &constant);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c headList: the first element of a list as a value.
+ *
+ * An empty list is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the head element value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_head_list(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_constant_t* const* items  = NULL;
+  size_t                                count  = 0U;
+  cardano_uplc_value_t*                 result = NULL;
+
+  if (!cardano_uplc_builtin_as_list(args[0], NULL, &items, &count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (count == 0U)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_value_new_constant(arena, items[0], &result);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c tailList: a list minus its first element.
+ *
+ * An empty list is a script error. The result carries the same element type and
+ * the items from index one onward.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the tail list value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_tail_list(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_type_t*            element_type = NULL;
+  const cardano_uplc_constant_t* const* items        = NULL;
+  size_t                                count        = 0U;
+  cardano_uplc_constant_t*              constant     = NULL;
+  cardano_uplc_value_t*                 result       = NULL;
+
+  if (!cardano_uplc_builtin_as_list(args[0], &element_type, &items, &count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (count == 0U)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_constant_new_list(
+    arena,
+    element_type,
+    // cppcheck-suppress misra-c2012-12.1; Reason: operator precedence is explicit and intentional
+    // cppcheck-suppress misra-c2012-18.4; Reason: pointer arithmetic over a contiguous arena buffer
+    (count > 1U) ? (items + 1) : NULL,
+    count - 1U,
+    &constant);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c nullList: whether a list is empty, as a boolean.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_null_list(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  size_t count = 0U;
+
+  if (!cardano_uplc_builtin_as_list(args[0], NULL, NULL, &count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_bool(arena, count == 0U, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/* DATA BODIES ************************************************************/
+
+/**
+ * \brief Wraps an arena data node as a constant value result.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] data The arena data node to publish. Must live in \p arena.
+ * \param[out] out On success, the constant value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+result_data_node(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_data_t*   data,
+  const cardano_uplc_value_t** out)
+{
+  cardano_uplc_constant_t* constant = NULL;
+  cardano_uplc_value_t*    result   = NULL;
+  cardano_error_t          error    = CARDANO_SUCCESS;
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  error = cardano_uplc_int_constant_new_data_node(arena, data, &constant);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Wraps an owned library plutus-data object as an arena data result.
+ *
+ * Converts \p data into an arena data tree, wraps it in a constant value, and always
+ * releases the reference \p data held on entry, on success and failure alike. Used
+ * by the \c valueData builtin, which builds the library plutus-data type before
+ * crossing into the arena.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in,out] data The owned plutus-data to publish; released before return.
+ * \param[out] out On success, the constant value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+result_data(
+  struct cardano_uplc_arena_t* arena,
+  cardano_plutus_data_t*       data,
+  const cardano_uplc_value_t** out)
+{
+  cardano_uplc_data_t* node  = NULL;
+  cardano_error_t      error = CARDANO_SUCCESS;
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  error = cardano_uplc_data_from_plutus_data(arena, data, &node);
+
+  cardano_plutus_data_unref(&data);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  return result_data_node(arena, node, out);
+}
+
+/**
+ * \brief Builds the \c data type descriptor in an arena.
+ *
+ * \param[in] arena The arena the descriptor is allocated from.
+ * \param[out] out On success, the descriptor; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+type_data(struct cardano_uplc_arena_t* arena, cardano_uplc_type_t** out)
+{
+  return cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_DATA, NULL, NULL, out);
+}
+
+/**
+ * \brief Builds the \c (pair data data) type descriptor in an arena.
+ *
+ * \param[in] arena The arena the descriptor is allocated from.
+ * \param[out] out On success, the descriptor; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+type_pair_data(struct cardano_uplc_arena_t* arena, cardano_uplc_type_t** out)
+{
+  cardano_uplc_type_t* data_a = NULL;
+  cardano_uplc_type_t* data_b = NULL;
+  cardano_error_t      error  = type_data(arena, &data_a);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = type_data(arena, &data_b);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  return cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_PAIR, data_a, data_b, out);
+}
+
+/**
+ * \brief Reads the arena data node wrapped by a data constant.
+ *
+ * \param[in] constant The candidate constant. Must not be NULL.
+ * \param[out] out On success, the borrowed data node; left untouched otherwise.
+ *
+ * \return \c true when \p constant is a data constant, \c false otherwise.
+ */
+static bool
+constant_as_data_node(const cardano_uplc_constant_t* constant, const cardano_uplc_data_t** out)
+{
+  if ((constant == NULL) || (constant->kind != CARDANO_UPLC_TYPE_DATA))
+  {
+    return false;
+  }
+
+  *out = constant->as.data;
+
+  return true;
+}
+
+/**
+ * \brief Tests whether a constant type descriptor is \c (pair data data).
+ *
+ * \param[in] type The descriptor to test.
+ *
+ * \return \c true when \p type names a pair of two data components.
+ */
+static bool
+type_is_pair_data(const cardano_uplc_type_t* type)
+{
+  if ((type == NULL) || (type->kind != CARDANO_UPLC_TYPE_PAIR))
+  {
+    return false;
+  }
+
+  if ((type->fst == NULL) || (type->snd == NULL))
+  {
+    return false;
+  }
+
+  return (type->fst->kind == CARDANO_UPLC_TYPE_DATA) && (type->snd->kind == CARDANO_UPLC_TYPE_DATA);
+}
+
+/**
+ * \brief Collects the data nodes of a proto-list of data into an arena node array.
+ *
+ * The list element type must be \c data and every item a data constant. The
+ * returned array lives in \p arena.
+ *
+ * \param[in] arena The arena the array is allocated from.
+ * \param[in] element_type The list element type descriptor.
+ * \param[in] items The element constants.
+ * \param[in] count The number of elements.
+ * \param[out] out_nodes On success, the arena node array, or NULL when empty.
+ *
+ * \return \c true on success, \c false on a shape mismatch or allocation failure.
+ */
+static bool
+collect_data_nodes(
+  struct cardano_uplc_arena_t*          arena,
+  const cardano_uplc_type_t*            element_type,
+  const cardano_uplc_constant_t* const* items,
+  size_t                                count,
+  // cppcheck-suppress misra-c2012-18.5; Reason: pointer nesting required by the API shape
+  const cardano_uplc_data_t* const** out_nodes)
+{
+  const cardano_uplc_data_t** nodes = NULL;
+  size_t                      i     = 0U;
+
+  if ((element_type == NULL) || (element_type->kind != CARDANO_UPLC_TYPE_DATA))
+  {
+    return false;
+  }
+
+  if (count > 0U)
+  {
+    nodes = (const cardano_uplc_data_t**)cardano_uplc_arena_alloc(arena, sizeof(*nodes) * count, 0U);
+
+    if (nodes == NULL)
+    {
+      return false;
+    }
+  }
+
+  for (i = 0U; i < count; ++i)
+  {
+    const cardano_uplc_data_t* node = NULL;
+
+    if (!constant_as_data_node(items[i], &node))
+    {
+      return false;
+    }
+
+    nodes[i] = node;
+  }
+
+  *out_nodes = (const cardano_uplc_data_t* const*)nodes;
+
+  return true;
+}
+
+/**
+ * \brief Runs \c constrData: a constructor index and a data list into Data Constr.
+ *
+ * The first argument is the constructor alternative (an integer), the second a
+ * proto-list of data. The raw alternative is stored; the compact CBOR tag is
+ * derived by the serializer. Under the variants that bound byte-string arguments
+ * an alternative that does not fit an unsigned 64-bit integer is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] semantics The semantics variant selecting the alternative bound.
+ * \param[in] args The two saturated argument values (index, data list).
+ * \param[out] out_result On success, the data result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_constr_data(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_semantics_t   semantics,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_bigint_t*               index        = NULL;
+  const cardano_uplc_type_t*            element_type = NULL;
+  const cardano_uplc_constant_t* const* items        = NULL;
+  size_t                                count        = 0U;
+  const cardano_uplc_data_t* const*     fields       = NULL;
+  cardano_uplc_data_t*                  data         = NULL;
+  uint64_t                              alternative  = 0U;
+
+  if (!as_integer_big(arena, args[0], &index))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_uplc_semantics_bounds_byte_string_arguments(semantics) && ((cardano_bigint_signum(index) < 0) || (cardano_bigint_bit_length(index) > CARDANO_UPLC_BUILTIN_CONSTR_TAG_BITS)))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (!cardano_uplc_builtin_as_list(args[1], &element_type, &items, &count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (!collect_data_nodes(arena, element_type, items, count, &fields))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  alternative = cardano_bigint_to_unsigned_int(index);
+
+  *host_error = cardano_uplc_data_new_constr(arena, alternative, fields, count, &data);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_data_node(arena, data, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c mapData: a proto-list of data pairs into Data Map.
+ *
+ * The argument must be a list whose element type is \c (pair data data); each pair
+ * contributes a key and a value.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the data result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_map_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_type_t*            element_type = NULL;
+  const cardano_uplc_constant_t* const* items        = NULL;
+  size_t                                count        = 0U;
+  cardano_uplc_data_pair_t*             entries      = NULL;
+  cardano_uplc_data_t*                  data         = NULL;
+  size_t                                i            = 0U;
+
+  if (!cardano_uplc_builtin_as_list(args[0], &element_type, &items, &count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (!type_is_pair_data(element_type))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (count > 0U)
+  {
+    entries = (cardano_uplc_data_pair_t*)cardano_uplc_arena_alloc(arena, sizeof(*entries) * count, 0U);
+
+    if (entries == NULL)
+    {
+      *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+  }
+
+  for (i = 0U; i < count; ++i)
+  {
+    const cardano_uplc_constant_t* entry = items[i];
+    const cardano_uplc_data_t*     key   = NULL;
+    const cardano_uplc_data_t*     value = NULL;
+
+    if ((entry == NULL) || (entry->kind != CARDANO_UPLC_TYPE_PAIR) || !constant_as_data_node(entry->as.pair.fst, &key) || !constant_as_data_node(entry->as.pair.snd, &value))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    entries[i].key   = key;
+    entries[i].value = value;
+  }
+
+  *host_error = cardano_uplc_data_new_map(arena, entries, count, false, &data);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_data_node(arena, data, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c listData: a proto-list of data into Data List.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the data result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_list_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_type_t*            element_type = NULL;
+  const cardano_uplc_constant_t* const* items        = NULL;
+  size_t                                count        = 0U;
+  const cardano_uplc_data_t* const*     nodes        = NULL;
+  cardano_uplc_data_t*                  data         = NULL;
+
+  if (!cardano_uplc_builtin_as_list(args[0], &element_type, &items, &count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (!collect_data_nodes(arena, element_type, items, count, &nodes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_data_new_list(arena, nodes, count, &data);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_data_node(arena, data, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c iData: an integer into Data Integer.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the data result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_i_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_bigint_t* integer = NULL;
+  cardano_uplc_data_t*    data    = NULL;
+
+  if (!as_integer_big(arena, args[0], &integer))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+  *host_error = cardano_uplc_data_new_integer(arena, (cardano_bigint_t*)((const void*)integer), &data);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_data_node(arena, data, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bData: a byte string into Data Bytes.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the data result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_b_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes = { NULL, 0U };
+  cardano_uplc_data_t*     data  = NULL;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_data_new_bytes(arena, bytes.data, bytes.size, &data);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_data_node(arena, data, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c unConstrData: a Data Constr into a (pair integer (list data)).
+ *
+ * A non-Constr argument is a script error. The first component is the constructor
+ * alternative as an integer, the second the fields as a proto-list of data.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the pair result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_un_constr_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_data_t* data       = NULL;
+  cardano_uplc_constant_t*   tag_const  = NULL;
+  cardano_uplc_constant_t*   list_const = NULL;
+  cardano_uplc_constant_t*   pair_const = NULL;
+  cardano_uplc_value_t*      result     = NULL;
+
+  if (!cardano_uplc_builtin_as_data(args[0], &data))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (data->kind != CARDANO_UPLC_DATA_KIND_CONSTR)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_constant_new_integer_small(arena, (int64_t)data->as.constr.tag, &tag_const);
+
+  if ((*host_error == CARDANO_SUCCESS) && (data->as.constr.tag > (uint64_t)INT64_MAX))
+  {
+    cardano_bigint_t* tag_value = NULL;
+
+    *host_error = cardano_bigint_from_unsigned_int(data->as.constr.tag, &tag_value);
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = cardano_uplc_constant_new_integer(arena, tag_value, &tag_const);
+      cardano_bigint_unref(&tag_value);
+    }
+  }
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_int_data_list_from_nodes(arena, data->as.constr.fields, data->as.constr.count, &list_const);
+  }
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_constant_new_pair(arena, tag_const, list_const, &pair_const);
+  }
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_value_new_constant(arena, pair_const, &result);
+  }
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c unMapData: a Data Map into a proto-list of (pair data data).
+ *
+ * A non-Map argument is a script error. Each entry becomes a proto-pair of its key
+ * and value.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the list result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_un_map_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_data_t*      data       = NULL;
+  cardano_uplc_type_t*            pair_type  = NULL;
+  const cardano_uplc_constant_t** items      = NULL;
+  cardano_uplc_constant_t*        list_const = NULL;
+  cardano_uplc_value_t*           result     = NULL;
+  size_t                          count      = 0U;
+  size_t                          i          = 0U;
+
+  if (!cardano_uplc_builtin_as_data(args[0], &data))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (data->kind != CARDANO_UPLC_DATA_KIND_MAP)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = type_pair_data(arena, &pair_type);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  count = data->as.map.count;
+
+  if (count > 0U)
+  {
+    items = (const cardano_uplc_constant_t**)cardano_uplc_arena_alloc(arena, sizeof(*items) * count, 0U);
+
+    if (items == NULL)
+    {
+      *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+  }
+
+  for (i = 0U; i < count; ++i)
+  {
+    cardano_uplc_constant_t* key_const  = NULL;
+    cardano_uplc_constant_t* val_const  = NULL;
+    cardano_uplc_constant_t* pair_const = NULL;
+
+    *host_error = cardano_uplc_int_constant_new_data_node(arena, data->as.map.entries[i].key, &key_const);
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = cardano_uplc_int_constant_new_data_node(arena, data->as.map.entries[i].value, &val_const);
+    }
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = cardano_uplc_constant_new_pair(arena, key_const, val_const, &pair_const);
+    }
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    items[i] = pair_const;
+  }
+
+  *host_error = cardano_uplc_constant_new_list(arena, pair_type, items, count, &list_const);
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_value_new_constant(arena, list_const, &result);
+  }
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c unListData: a Data List into a proto-list of data.
+ *
+ * A non-List argument is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the list result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_un_list_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_data_t* data       = NULL;
+  cardano_uplc_constant_t*   list_const = NULL;
+  cardano_uplc_value_t*      result     = NULL;
+
+  if (!cardano_uplc_builtin_as_data(args[0], &data))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (data->kind != CARDANO_UPLC_DATA_KIND_LIST)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_int_data_list_from_nodes(arena, data->as.list.items, data->as.list.count, &list_const);
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_value_new_constant(arena, list_const, &result);
+  }
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c unIData: a Data Integer into an integer.
+ *
+ * A non-Integer argument is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the integer result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_un_i_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_data_t* data = NULL;
+
+  if (!cardano_uplc_builtin_as_data(args[0], &data))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (data->kind != CARDANO_UPLC_DATA_KIND_INTEGER)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (data->as.integer.is_small)
+  {
+    cardano_uplc_constant_t* constant = NULL;
+    cardano_uplc_value_t*    result   = NULL;
+
+    *host_error = cardano_uplc_constant_new_integer_small(arena, data->as.integer.small, &constant);
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = cardano_uplc_value_new_constant(arena, constant, &result);
+    }
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    *out_result = result;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+  }
+
+  {
+    const cardano_bigint_t*  integer  = NULL;
+    cardano_uplc_constant_t* constant = NULL;
+    cardano_uplc_value_t*    result   = NULL;
+
+    *host_error = cardano_uplc_data_integer_materialize(arena, data, &integer);
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+      *host_error = cardano_uplc_constant_new_integer(arena, (cardano_bigint_t*)((const void*)integer), &constant);
+    }
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = cardano_uplc_value_new_constant(arena, constant, &result);
+    }
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    *out_result = result;
+  }
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c unBData: a Data Bytes into a byte string.
+ *
+ * A non-Bytes argument is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_un_b_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_data_t* data = NULL;
+
+  if (!cardano_uplc_builtin_as_data(args[0], &data))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (data->kind != CARDANO_UPLC_DATA_KIND_BYTES)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_bytes_from(arena, data->as.bytes.data, data->as.bytes.size, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c chooseData: selects a branch by the data's kind.
+ *
+ * The first argument must be data (a non-data is a script error); a Constr selects
+ * the second argument, a Map the third, a List the fourth, an Integer the fifth and
+ * Bytes the sixth, returned by value unchanged.
+ *
+ * \param[in] args The six saturated argument values.
+ * \param[out] out_result On success, the selected branch value.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_choose_data(
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result)
+{
+  const cardano_uplc_data_t* data = NULL;
+
+  if (!cardano_uplc_builtin_as_data(args[0], &data))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  switch (data->kind)
+  {
+    case CARDANO_UPLC_DATA_KIND_CONSTR:
+    {
+      *out_result = args[1];
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_MAP:
+    {
+      *out_result = args[2];
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_LIST:
+    {
+      *out_result = args[3];
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_INTEGER:
+    {
+      *out_result = args[4];
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_BYTES:
+    {
+      *out_result = args[5];
+
+      break;
+    }
+    default:
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+  }
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c equalsData: tests two data values for structural equality.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two saturated argument values.
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_equals_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_data_t* lhs = NULL;
+  const cardano_uplc_data_t* rhs = NULL;
+
+  if (!cardano_uplc_builtin_as_data(args[0], &lhs) || !cardano_uplc_builtin_as_data(args[1], &rhs))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_bool(arena, cardano_uplc_data_equals(lhs, rhs), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c serialiseData: the canonical CBOR encoding of a data value.
+ *
+ * The serializer always writes the canonical form the ledger expects: indefinite
+ * arrays and constr fields except when empty, and maps in their decoded definite
+ * or indefinite form.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_serialise_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_data_t* data   = NULL;
+  cardano_cbor_writer_t*     writer = NULL;
+  cardano_buffer_t*          bytes  = NULL;
+
+  if (!cardano_uplc_builtin_as_data(args[0], &data))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_data_to_cbor(data, writer);
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_cbor_writer_encode_in_buffer(writer, &bytes);
+  }
+
+  cardano_cbor_writer_unref(&writer);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&bytes);
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_bytes_from(arena, cardano_buffer_get_data(bytes), cardano_buffer_get_size(bytes), out_result);
+
+  cardano_buffer_unref(&bytes);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c mkPairData: two data values into a proto-pair (pair data data).
+ *
+ * A non-data argument is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two saturated argument values.
+ * \param[out] out_result On success, the pair result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_mk_pair_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_constant_t* fst        = NULL;
+  const cardano_uplc_constant_t* snd        = NULL;
+  cardano_uplc_constant_t*       pair_const = NULL;
+  cardano_uplc_value_t*          result     = NULL;
+
+  if (!as_constant(args[0], &fst) || !as_constant(args[1], &snd))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((fst->kind != CARDANO_UPLC_TYPE_DATA) || (snd->kind != CARDANO_UPLC_TYPE_DATA))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_constant_new_pair(arena, fst, snd, &pair_const);
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_value_new_constant(arena, pair_const, &result);
+  }
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c mkNilData and \c mkNilPairData: an empty proto-list.
+ *
+ * The argument must be unit (anything else is a script error). The element type is
+ * \c data for \c mkNilData and \c (pair data data) for \c mkNilPairData.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] pair_elements Selects the \c (pair data data) element type when true.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the empty list result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_mk_nil_data(
+  struct cardano_uplc_arena_t*       arena,
+  bool                               pair_elements,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_type_t*     element_type = NULL;
+  cardano_uplc_constant_t* list_const   = NULL;
+  cardano_uplc_value_t*    result       = NULL;
+
+  if (!cardano_uplc_builtin_as_unit(args[0]))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (pair_elements)
+  {
+    *host_error = type_pair_data(arena, &element_type);
+  }
+  else
+  {
+    *host_error = type_data(arena, &element_type);
+  }
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_constant_new_list(arena, element_type, NULL, 0U, &list_const);
+  }
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_value_new_constant(arena, list_const, &result);
+  }
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c sha2_256: the SHA-256 digest of a byte string.
+ *
+ * Produces a 32-byte digest using libsodium's \c crypto_hash_sha256.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_sha2_256(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t input = { NULL, 0U };
+  byte_t                   digest[32];
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &input))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  (void)crypto_hash_sha256(digest, nonnull_bytes(input.data, input.size), input.size);
+
+  *host_error = result_bytes_from(arena, digest, (size_t)crypto_hash_sha256_BYTES, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs the Blake2b digest builtins.
+ *
+ * Produces a digest of \p out_size bytes (28 for \c blake2b_224, 32 for
+ * \c blake2b_256) using libsodium's \c crypto_generichash (Blake2b). The digest
+ * of an empty input is a valid hash, not an error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] out_size The digest length in bytes.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_blake2b(
+  struct cardano_uplc_arena_t*       arena,
+  size_t                             out_size,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t input = { NULL, 0U };
+  byte_t                   digest[32];
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &input))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  (void)crypto_generichash(digest, out_size, nonnull_bytes(input.data, input.size), input.size, NULL, 0U);
+
+  *host_error = result_bytes_from(arena, digest, out_size, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs the SHA3-256 and Keccak-256 digest builtins.
+ *
+ * Both feed the input byte string through the same 32-byte Keccak sponge and
+ * differ only in the final domain-separation pad byte: 0x06 yields FIPS-202
+ * SHA3-256, 0x01 yields the original Keccak-256. Both hash the single byte-string
+ * argument. The digest of an empty input is a valid hash.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] pad The final pad byte selecting SHA3 (0x06) or Keccak (0x01).
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_sha3_keccak(
+  struct cardano_uplc_arena_t*       arena,
+  uint8_t                            pad,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t input = { NULL, 0U };
+  byte_t                   digest[32];
+  sha3_ctx_t               ctx;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &input))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  (void)sha3_init(&ctx, (int)CARDANO_UPLC_BUILTIN_SHA3_256_SIZE);
+  (void)sha3_update(&ctx, nonnull_bytes(input.data, input.size), input.size);
+  (void)sha3_final_pad(digest, &ctx, pad);
+
+  *host_error = result_bytes_from(arena, digest, CARDANO_UPLC_BUILTIN_SHA3_256_SIZE, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c ripemd_160: the RIPEMD-160 digest of a byte string.
+ *
+ * Produces a 20-byte digest using the vendored one-shot \c ripemd160. The digest
+ * of an empty input is a valid hash, not an error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single saturated argument value.
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_ripemd_160(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t input = { NULL, 0U };
+  byte_t                   digest[20];
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &input))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  ripemd160(nonnull_bytes(input.data, input.size), input.size, digest);
+
+  *host_error = result_bytes_from(arena, digest, CARDANO_UPLC_BUILTIN_RIPEMD_160_SIZE, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c verifyEd25519Signature: checks an Ed25519 signature.
+ *
+ * A public key that is not 32 bytes or a signature that is not 64 bytes is a
+ * script error. With valid lengths the result is the boolean verification
+ * outcome; a verification failure is a \c false result, not an error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The three saturated argument values (public key, message, signature).
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_verify_ed25519(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t      key_bytes = { NULL, 0U };
+  cardano_uplc_byte_view_t      msg_bytes = { NULL, 0U };
+  cardano_uplc_byte_view_t      sig_bytes = { NULL, 0U };
+  cardano_ed25519_public_key_t* key       = NULL;
+  cardano_ed25519_signature_t*  signature = NULL;
+  cardano_error_t               key_error = CARDANO_SUCCESS;
+  cardano_error_t               sig_error = CARDANO_SUCCESS;
+  bool                          valid     = false;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &key_bytes) || !cardano_uplc_builtin_as_byte_string(args[1], &msg_bytes) || !cardano_uplc_builtin_as_byte_string(args[2], &sig_bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (key_bytes.size != CARDANO_UPLC_BUILTIN_ED25519_KEY_SIZE)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (sig_bytes.size != CARDANO_UPLC_BUILTIN_ED25519_SIG_SIZE)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  key_error = cardano_ed25519_public_key_from_bytes(
+    key_bytes.data,
+    key_bytes.size,
+    &key);
+
+  if (key_error != CARDANO_SUCCESS)
+  {
+    *host_error = key_error;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  sig_error = cardano_ed25519_signature_from_bytes(
+    sig_bytes.data,
+    sig_bytes.size,
+    &signature);
+
+  if (sig_error != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_public_key_unref(&key);
+    *host_error = sig_error;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  valid = cardano_ed25519_public_verify(key, signature, nonnull_bytes(msg_bytes.data, msg_bytes.size), msg_bytes.size);
+
+  cardano_ed25519_public_key_unref(&key);
+  cardano_ed25519_signature_unref(&signature);
+
+  *host_error = result_bool(arena, valid, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c verifyEcdsaSecp256k1Signature: checks a secp256k1 ECDSA signature.
+ *
+ * The public key must be a 33-byte compressed point, the message a 32-byte
+ * pre-hashed digest, and the signature 64 compact bytes; any other length, an
+ * unparseable key, or an unparseable signature is a script error. With well-formed
+ * inputs the result is the boolean verification outcome. The verifier rejects
+ * signatures whose S component is not in low-S form, so a high-S signature is a
+ * \c false result rather than \c true.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The three saturated argument values (public key, message, signature).
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_verify_ecdsa(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t  key_bytes = { NULL, 0U };
+  cardano_uplc_byte_view_t  msg_bytes = { NULL, 0U };
+  cardano_uplc_byte_view_t  sig_bytes = { NULL, 0U };
+  secp256k1_pubkey          pubkey;
+  secp256k1_ecdsa_signature signature;
+  bool                      valid = false;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &key_bytes) || !cardano_uplc_builtin_as_byte_string(args[1], &msg_bytes) || !cardano_uplc_builtin_as_byte_string(args[2], &sig_bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((key_bytes.size != CARDANO_UPLC_BUILTIN_ECDSA_KEY_SIZE) || (msg_bytes.size != CARDANO_UPLC_BUILTIN_ECDSA_MSG_SIZE) || (sig_bytes.size != CARDANO_UPLC_BUILTIN_ECDSA_SIG_SIZE))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (secp256k1_ec_pubkey_parse(secp256k1_context_static, &pubkey, key_bytes.data, key_bytes.size) != 1)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (secp256k1_ecdsa_signature_parse_compact(secp256k1_context_static, &signature, sig_bytes.data) != 1)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  valid = (secp256k1_ecdsa_verify(secp256k1_context_static, &signature, msg_bytes.data, &pubkey) == 1);
+
+  *host_error = result_bool(arena, valid, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c verifySchnorrSecp256k1Signature: checks a BIP340 signature.
+ *
+ * The public key must be a 32-byte x-only point and the signature 64 bytes;
+ * either wrong length or an unparseable key is a script error. Unlike the
+ * message of the ECDSA builtin the Schnorr message is of arbitrary length. With
+ * well-formed key and signature the result is the boolean verification outcome.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The three saturated argument values (public key, message, signature).
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_verify_schnorr(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t key_bytes = { NULL, 0U };
+  cardano_uplc_byte_view_t msg_bytes = { NULL, 0U };
+  cardano_uplc_byte_view_t sig_bytes = { NULL, 0U };
+  secp256k1_xonly_pubkey   pubkey;
+  const unsigned char*     msg_data  = NULL;
+  size_t                   msg_size  = 0U;
+  const unsigned char      msg_empty = 0U;
+  bool                     valid     = false;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &key_bytes) || !cardano_uplc_builtin_as_byte_string(args[1], &msg_bytes) || !cardano_uplc_builtin_as_byte_string(args[2], &sig_bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((key_bytes.size != CARDANO_UPLC_BUILTIN_SCHNORR_KEY_SIZE) || (sig_bytes.size != CARDANO_UPLC_BUILTIN_SCHNORR_SIG_SIZE))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (secp256k1_xonly_pubkey_parse(secp256k1_context_static, &pubkey, key_bytes.data) != 1)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  msg_size = msg_bytes.size;
+  msg_data = (msg_size == 0U) ? &msg_empty : msg_bytes.data;
+
+  valid = (secp256k1_schnorrsig_verify(secp256k1_context_static, sig_bytes.data, msg_data, msg_size, &pubkey) == 1);
+
+  *host_error = result_bool(arena, valid, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/* BLS12-381 HELPERS ********************************************************/
+
+/**
+ * \brief Reads the BLS12-381 point a BLS constant of a given kind carries.
+ *
+ * A value that is not a constant of the requested BLS kind is a type mismatch,
+ * reported here by returning \c false.
+ *
+ * \param[in] value The argument value.
+ * \param[in] kind The required BLS constant kind.
+ * \param[out] out On success, the borrowed point struct pointer.
+ *
+ * \return \c true when \p value is a BLS constant of \p kind, \c false otherwise.
+ */
+static bool
+as_bls(const cardano_uplc_value_t* value, cardano_uplc_type_kind_t kind, const void** out)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  if (constant->kind != kind)
+  {
+    return false;
+  }
+
+  *out = constant->as.bls;
+
+  return true;
+}
+
+/**
+ * \brief Wraps a BLS12-381 value as an arena BLS result value.
+ *
+ * Builds a BLS constant copying \p size bytes from \p data and wraps it in a
+ * constant value.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] kind The BLS constant kind.
+ * \param[in] data The raw point or field value to copy.
+ * \param[in] size The number of bytes to copy.
+ * \param[out] out On success, the constant value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+result_bls(
+  struct cardano_uplc_arena_t* arena,
+  cardano_uplc_type_kind_t     kind,
+  const void*                  data,
+  size_t                       size,
+  const cardano_uplc_value_t** out)
+{
+  cardano_uplc_constant_t* constant = NULL;
+  cardano_uplc_value_t*    result   = NULL;
+  cardano_error_t          error    = cardano_uplc_constant_new_bls(arena, kind, data, size, &constant);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reduces an integer scalar modulo the BLS scalar period into 32 bytes.
+ *
+ * Computes \c scalar mod r big-endian, left-padded to 32 bytes, the form the
+ * scalar-multiplication routines expect.
+ *
+ * \param[in] scalar The integer scalar.
+ * \param[out] out A 32-byte buffer receiving the big-endian reduced scalar.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+static cardano_error_t
+bls_reduce_scalar(const cardano_bigint_t* scalar, byte_t* out)
+{
+  cardano_bigint_t* period    = NULL;
+  cardano_bigint_t* reduced   = NULL;
+  cardano_bigint_t* quotient  = NULL;
+  cardano_error_t   error     = CARDANO_SUCCESS;
+  size_t            byte_size = 0U;
+  byte_t*           be_bytes  = NULL;
+  size_t            i         = 0U;
+
+  for (i = 0U; i < CARDANO_UPLC_BLS_SCALAR_SIZE; ++i)
+  {
+    out[i] = 0U;
+  }
+
+  error = cardano_bigint_from_bytes(CARDANO_UPLC_BLS_SCALAR_PERIOD, CARDANO_UPLC_BLS_SCALAR_SIZE, CARDANO_BYTE_ORDER_BIG_ENDIAN, &period);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_bigint_from_int(0, &reduced);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_bigint_unref(&period);
+
+    return error;
+  }
+
+  error = cardano_bigint_from_int(0, &quotient);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    cardano_bigint_unref(&period);
+    cardano_bigint_unref(&reduced);
+
+    return error;
+  }
+
+  floor_div_mod(scalar, period, quotient, reduced);
+
+  if (cardano_bigint_signum(reduced) == 0)
+  {
+    cardano_bigint_unref(&period);
+    cardano_bigint_unref(&reduced);
+    cardano_bigint_unref(&quotient);
+
+    return CARDANO_SUCCESS;
+  }
+
+  byte_size = cardano_bigint_get_bytes_size(reduced);
+
+  be_bytes = (byte_t*)_cardano_malloc(byte_size);
+
+  if (be_bytes == NULL)
+  {
+    cardano_bigint_unref(&period);
+    cardano_bigint_unref(&reduced);
+    cardano_bigint_unref(&quotient);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  error = cardano_bigint_to_bytes(reduced, CARDANO_BYTE_ORDER_BIG_ENDIAN, be_bytes, byte_size);
+
+  if (error == CARDANO_SUCCESS)
+  {
+    if (byte_size <= CARDANO_UPLC_BLS_SCALAR_SIZE)
+    {
+      const size_t offset = CARDANO_UPLC_BLS_SCALAR_SIZE - byte_size;
+
+      for (i = 0U; i < byte_size; ++i)
+      {
+        out[offset + i] = be_bytes[i];
+      }
+    }
+    else
+    {
+      const size_t offset = byte_size - CARDANO_UPLC_BLS_SCALAR_SIZE;
+
+      for (i = 0U; i < CARDANO_UPLC_BLS_SCALAR_SIZE; ++i)
+      {
+        out[i] = be_bytes[offset + i];
+      }
+    }
+  }
+
+  _cardano_free(be_bytes);
+  cardano_bigint_unref(&period);
+  cardano_bigint_unref(&reduced);
+  cardano_bigint_unref(&quotient);
+
+  return error;
+}
+
+/**
+ * \brief Runs \c bls12_381_G1_add: the group addition of two G1 points.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two G1 argument values.
+ * \param[out] out_result On success, the G1 result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g1_add(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const void* a = NULL;
+  const void* b = NULL;
+  blst_p1     out;
+
+  if (!as_bls(args[0], CARDANO_UPLC_TYPE_BLS_G1, &a) || !as_bls(args[1], CARDANO_UPLC_TYPE_BLS_G1, &b))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  blst_p1_add_or_double(&out, (const blst_p1*)a, (const blst_p1*)b);
+
+  *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_G1, &out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_G1_neg: the group negation of a G1 point.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The G1 argument value.
+ * \param[out] out_result On success, the G1 result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g1_neg(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const void* a = NULL;
+  blst_p1     out;
+
+  if (!as_bls(args[0], CARDANO_UPLC_TYPE_BLS_G1, &a))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  out = *(const blst_p1*)a;
+  blst_p1_cneg(&out, true);
+
+  *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_G1, &out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_G1_scalarMul: scalar multiplication of a G1 point.
+ *
+ * The integer scalar is reduced modulo the group order before multiplication.
+ * Under the variants that bound byte-string arguments a scalar outside
+ * -(2^4095) .. 2^4095 - 1 is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] semantics The semantics variant selecting the scalar bound.
+ * \param[in] args The scalar integer and the G1 point.
+ * \param[out] out_result On success, the G1 result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g1_scalar_mul(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_semantics_t   semantics,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_bigint_t* scalar = NULL;
+  const void*             point  = NULL;
+  byte_t                  scalar_be[CARDANO_UPLC_BLS_SCALAR_SIZE];
+  blst_scalar             blst_scalar_value;
+  blst_p1                 out;
+
+  if (!as_integer_big(arena, args[0], &scalar) || !as_bls(args[1], CARDANO_UPLC_TYPE_BLS_G1, &point))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_uplc_semantics_bounds_byte_string_arguments(semantics) && !bigint_within_signed_bits(scalar, CARDANO_UPLC_BLS_SCALAR_BOUND_BITS))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = bls_reduce_scalar(scalar, scalar_be);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  blst_scalar_from_bendian(&blst_scalar_value, scalar_be);
+  blst_p1_mult(&out, (const blst_p1*)point, blst_scalar_value.b, CARDANO_UPLC_BLS_SCALAR_BITS);
+
+  *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_G1, &out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_G1_equal: equality of two G1 points.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two G1 argument values.
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g1_equal(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const void* a = NULL;
+  const void* b = NULL;
+
+  if (!as_bls(args[0], CARDANO_UPLC_TYPE_BLS_G1, &a) || !as_bls(args[1], CARDANO_UPLC_TYPE_BLS_G1, &b))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_bool(arena, blst_p1_is_equal((const blst_p1*)a, (const blst_p1*)b), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_G1_compress: serializes a G1 point to 48 bytes.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The G1 argument value.
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g1_compress(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const void* a = NULL;
+  byte_t      out[CARDANO_UPLC_BLS_G1_COMPRESSED_SIZE];
+
+  if (!as_bls(args[0], CARDANO_UPLC_TYPE_BLS_G1, &a))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  blst_p1_compress(out, (const blst_p1*)a);
+
+  *host_error = result_bytes_from(arena, out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_G1_uncompress: parses 48 bytes into a G1 point.
+ *
+ * A wrong length, a bad encoding, or a point outside the subgroup is a script
+ * error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The byte-string argument value.
+ * \param[out] out_result On success, the G1 result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g1_uncompress(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes    = { NULL, 0U };
+  cardano_uplc_constant_t* constant = NULL;
+  cardano_uplc_value_t*    result   = NULL;
+  cardano_error_t          error    = CARDANO_SUCCESS;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  error = cardano_uplc_int_bls_g1_from_compressed(arena, nonnull_bytes(bytes.data, bytes.size), bytes.size, &constant);
+
+  if (error == CARDANO_ERROR_DECODING)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (error != CARDANO_SUCCESS)
+  {
+    *host_error = error;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c bls12_381_G1_hashToGroup: hashes a message to a G1 point.
+ *
+ * The domain separation tag is capped at 255 bytes; a longer tag is a script
+ * error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The message bytes and the domain separation tag bytes.
+ * \param[out] out_result On success, the G1 result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g1_hash_to_group(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t msg = { NULL, 0U };
+  cardano_uplc_byte_view_t dst = { NULL, 0U };
+  blst_p1                  out;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &msg) || !cardano_uplc_builtin_as_byte_string(args[1], &dst))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (dst.size > CARDANO_UPLC_BLS_DST_MAX)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  blst_hash_to_g1(
+    &out,
+    nonnull_bytes(msg.data, msg.size),
+    msg.size,
+    nonnull_bytes(dst.data, dst.size),
+    dst.size,
+    NULL,
+    0U);
+
+  *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_G1, &out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_G2_add: the group addition of two G2 points.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two G2 argument values.
+ * \param[out] out_result On success, the G2 result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g2_add(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const void* a = NULL;
+  const void* b = NULL;
+  blst_p2     out;
+
+  if (!as_bls(args[0], CARDANO_UPLC_TYPE_BLS_G2, &a) || !as_bls(args[1], CARDANO_UPLC_TYPE_BLS_G2, &b))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  blst_p2_add_or_double(&out, (const blst_p2*)a, (const blst_p2*)b);
+
+  *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_G2, &out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_G2_neg: the group negation of a G2 point.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The G2 argument value.
+ * \param[out] out_result On success, the G2 result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g2_neg(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const void* a = NULL;
+  blst_p2     out;
+
+  if (!as_bls(args[0], CARDANO_UPLC_TYPE_BLS_G2, &a))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  out = *(const blst_p2*)a;
+  blst_p2_cneg(&out, true);
+
+  *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_G2, &out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_G2_scalarMul: scalar multiplication of a G2 point.
+ *
+ * The integer scalar is reduced modulo the group order before multiplication.
+ * Under the variants that bound byte-string arguments a scalar outside
+ * -(2^4095) .. 2^4095 - 1 is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] semantics The semantics variant selecting the scalar bound.
+ * \param[in] args The scalar integer and the G2 point.
+ * \param[out] out_result On success, the G2 result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g2_scalar_mul(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_semantics_t   semantics,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_bigint_t* scalar = NULL;
+  const void*             point  = NULL;
+  byte_t                  scalar_be[CARDANO_UPLC_BLS_SCALAR_SIZE];
+  blst_scalar             blst_scalar_value;
+  blst_p2                 out;
+
+  if (!as_integer_big(arena, args[0], &scalar) || !as_bls(args[1], CARDANO_UPLC_TYPE_BLS_G2, &point))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_uplc_semantics_bounds_byte_string_arguments(semantics) && !bigint_within_signed_bits(scalar, CARDANO_UPLC_BLS_SCALAR_BOUND_BITS))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = bls_reduce_scalar(scalar, scalar_be);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  blst_scalar_from_bendian(&blst_scalar_value, scalar_be);
+  blst_p2_mult(&out, (const blst_p2*)point, blst_scalar_value.b, CARDANO_UPLC_BLS_SCALAR_BITS);
+
+  *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_G2, &out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_G2_equal: equality of two G2 points.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two G2 argument values.
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g2_equal(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const void* a = NULL;
+  const void* b = NULL;
+
+  if (!as_bls(args[0], CARDANO_UPLC_TYPE_BLS_G2, &a) || !as_bls(args[1], CARDANO_UPLC_TYPE_BLS_G2, &b))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_bool(arena, blst_p2_is_equal((const blst_p2*)a, (const blst_p2*)b), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_G2_compress: serializes a G2 point to 96 bytes.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The G2 argument value.
+ * \param[out] out_result On success, the byte-string result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g2_compress(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const void* a = NULL;
+  byte_t      out[CARDANO_UPLC_BLS_G2_COMPRESSED_SIZE];
+
+  if (!as_bls(args[0], CARDANO_UPLC_TYPE_BLS_G2, &a))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  blst_p2_compress(out, (const blst_p2*)a);
+
+  *host_error = result_bytes_from(arena, out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_G2_uncompress: parses 96 bytes into a G2 point.
+ *
+ * A wrong length, a bad encoding, or a point outside the subgroup is a script
+ * error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The byte-string argument value.
+ * \param[out] out_result On success, the G2 result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g2_uncompress(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t bytes    = { NULL, 0U };
+  cardano_uplc_constant_t* constant = NULL;
+  cardano_uplc_value_t*    result   = NULL;
+  cardano_error_t          error    = CARDANO_SUCCESS;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &bytes))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  error = cardano_uplc_int_bls_g2_from_compressed(arena, nonnull_bytes(bytes.data, bytes.size), bytes.size, &constant);
+
+  if (error == CARDANO_ERROR_DECODING)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (error != CARDANO_SUCCESS)
+  {
+    *host_error = error;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c bls12_381_G2_hashToGroup: hashes a message to a G2 point.
+ *
+ * The domain separation tag is capped at 255 bytes; a longer tag is a script
+ * error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The message bytes and the domain separation tag bytes.
+ * \param[out] out_result On success, the G2 result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_g2_hash_to_group(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t msg = { NULL, 0U };
+  cardano_uplc_byte_view_t dst = { NULL, 0U };
+  blst_p2                  out;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &msg) || !cardano_uplc_builtin_as_byte_string(args[1], &dst))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (dst.size > CARDANO_UPLC_BLS_DST_MAX)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  blst_hash_to_g2(
+    &out,
+    nonnull_bytes(msg.data, msg.size),
+    msg.size,
+    nonnull_bytes(dst.data, dst.size),
+    dst.size,
+    NULL,
+    0U);
+
+  *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_G2, &out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_millerLoop: the Miller loop of a G1 and a G2 point.
+ *
+ * Both points are converted to affine and passed to the Miller loop with the G2
+ * point first, the argument order the BLS12-381 Miller loop requires.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The G1 point and the G2 point.
+ * \param[out] out_result On success, the ML-result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_miller_loop(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const void*    g1 = NULL;
+  const void*    g2 = NULL;
+  blst_p1_affine affine1;
+  blst_p2_affine affine2;
+  blst_fp12      out;
+
+  if (!as_bls(args[0], CARDANO_UPLC_TYPE_BLS_G1, &g1) || !as_bls(args[1], CARDANO_UPLC_TYPE_BLS_G2, &g2))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  blst_p1_to_affine(&affine1, (const blst_p1*)g1);
+  blst_p2_to_affine(&affine2, (const blst_p2*)g2);
+  blst_miller_loop(&out, &affine2, &affine1);
+
+  *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_ML_RESULT, &out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_mulMlResult: multiplies two Miller-loop results.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two ML-result argument values.
+ * \param[out] out_result On success, the ML-result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_mul_ml_result(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const void* a = NULL;
+  const void* b = NULL;
+  blst_fp12   out;
+
+  if (!as_bls(args[0], CARDANO_UPLC_TYPE_BLS_ML_RESULT, &a) || !as_bls(args[1], CARDANO_UPLC_TYPE_BLS_ML_RESULT, &b))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  blst_fp12_mul(&out, (const blst_fp12*)a, (const blst_fp12*)b);
+
+  *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_ML_RESULT, &out, sizeof(out), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c bls12_381_finalVerify: the final-exponentiation pairing check.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two ML-result argument values.
+ * \param[out] out_result On success, the boolean result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_final_verify(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const void* a = NULL;
+  const void* b = NULL;
+
+  if (!as_bls(args[0], CARDANO_UPLC_TYPE_BLS_ML_RESULT, &a) || !as_bls(args[1], CARDANO_UPLC_TYPE_BLS_ML_RESULT, &b))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_bool(arena, blst_fp12_finalverify((const blst_fp12*)a, (const blst_fp12*)b), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/* ARRAY AND LIST V4 BODIES ************************************************/
+
+/**
+ * \brief Reads the items an array constant carries, rejecting any other value.
+ *
+ * The \c lengthOfArray and \c indexArray builtins accept only an array constant:
+ * a list, even with identical contents, is a type mismatch.
+ *
+ * \param[in] value The argument value.
+ * \param[out] element_type On success, the array element type, or NULL to ignore.
+ * \param[out] items On success, the array items, or NULL to ignore.
+ * \param[out] count On success, the item count, or NULL to ignore.
+ *
+ * \return \c true when \p value is an array constant, \c false otherwise.
+ */
+static bool
+as_array(
+  const cardano_uplc_value_t* value,
+  const cardano_uplc_type_t** element_type,
+  // cppcheck-suppress misra-c2012-18.5; Reason: pointer nesting required by the API shape
+  const cardano_uplc_constant_t* const** items,
+  size_t*                                count)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (!as_constant(value, &constant))
+  {
+    return false;
+  }
+
+  if (constant->kind != CARDANO_UPLC_TYPE_ARRAY)
+  {
+    return false;
+  }
+
+  if (element_type != NULL)
+  {
+    *element_type = constant->as.list.element_type;
+  }
+
+  if (items != NULL)
+  {
+    *items = constant->as.list.items;
+  }
+
+  if (count != NULL)
+  {
+    *count = constant->as.list.count;
+  }
+
+  return true;
+}
+
+/* VALUE BODIES **********************************************************/
+
+/**
+ * \brief The maximum byte length of a value policy or token key.
+ */
+static const size_t PRV_VALUE_KEY_MAX = 32U;
+
+/**
+ * \brief The bit width of the signed quantity bound: amounts fit in 128 bits.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t PRV_VALUE_AMOUNT_BITS = 128U;
+
+/**
+ * \brief Reads the value constant a value argument holds.
+ *
+ * \param[in] value The argument value.
+ * \param[out] out On success, the value constant.
+ *
+ * \return \c true when \p value is a value constant, \c false otherwise.
+ */
+static bool
+as_value_constant(const cardano_uplc_value_t* value, const cardano_uplc_constant_t** out)
+{
+  const cardano_uplc_constant_t* constant = NULL;
+
+  if (!as_constant(value, &constant) || (constant == NULL) || (constant->kind != CARDANO_UPLC_TYPE_VALUE))
+  {
+    return false;
+  }
+
+  *out = constant;
+
+  return true;
+}
+
+/**
+ * \brief Reads the policy bytes and token list of a value policy entry.
+ *
+ * \param[in] entry The policy entry constant.
+ * \param[out] policy On success, the policy byte view.
+ * \param[out] tokens On success, the token-pair item array.
+ * \param[out] token_count On success, the token count.
+ *
+ * \return \c true when the entry is well-formed, \c false otherwise.
+ */
+static bool
+value_entry(
+  const cardano_uplc_constant_t* entry,
+  cardano_uplc_byte_view_t*      policy,
+  // cppcheck-suppress misra-c2012-18.5; Reason: pointer nesting required by the API shape
+  const cardano_uplc_constant_t* const** tokens,
+  size_t*                                token_count)
+{
+  if ((entry == NULL) || (entry->kind != CARDANO_UPLC_TYPE_PAIR))
+  {
+    return false;
+  }
+
+  if ((entry->as.pair.fst == NULL) || (entry->as.pair.fst->kind != CARDANO_UPLC_TYPE_BYTE_STRING) || (entry->as.pair.snd == NULL) || (entry->as.pair.snd->kind != CARDANO_UPLC_TYPE_LIST))
+  {
+    return false;
+  }
+
+  policy->data = entry->as.pair.fst->as.bytes.data;
+  policy->size = entry->as.pair.fst->as.bytes.size;
+  *tokens      = entry->as.pair.snd->as.list.items;
+  *token_count = entry->as.pair.snd->as.list.count;
+
+  return true;
+}
+
+/**
+ * \brief Reads the token bytes and amount of a token-pair constant.
+ *
+ * The amount is materialized to a \ref cardano_bigint_t through \p arena when it is
+ * stored inline, so the multi-asset arithmetic can keep operating on bigints.
+ *
+ * \param[in] arena The arena an inline amount is materialized through.
+ * \param[in] token The token-pair constant.
+ * \param[out] name On success, the token byte view.
+ * \param[out] amount On success, the amount bigint.
+ *
+ * \return \c true when the token pair is well-formed, \c false otherwise.
+ */
+static bool
+value_token(
+  struct cardano_uplc_arena_t*   arena,
+  const cardano_uplc_constant_t* token,
+  cardano_uplc_byte_view_t*      name,
+  const cardano_bigint_t**       amount)
+{
+  if ((token == NULL) || (token->kind != CARDANO_UPLC_TYPE_PAIR))
+  {
+    return false;
+  }
+
+  if ((token->as.pair.fst == NULL) || (token->as.pair.fst->kind != CARDANO_UPLC_TYPE_BYTE_STRING) || (token->as.pair.snd == NULL) || (token->as.pair.snd->kind != CARDANO_UPLC_TYPE_INTEGER))
+  {
+    return false;
+  }
+
+  name->data = token->as.pair.fst->as.bytes.data;
+  name->size = token->as.pair.fst->as.bytes.size;
+
+  return constant_integer_big(arena, token->as.pair.snd, amount);
+}
+
+/**
+ * \brief Compares two byte views lexicographically.
+ *
+ * \param[in] a The first view.
+ * \param[in] b The second view.
+ *
+ * \return A negative, zero, or positive value as \p a is less than, equal to, or
+ *         greater than \p b.
+ */
+static int
+compare_buffers(cardano_uplc_byte_view_t a, cardano_uplc_byte_view_t b)
+{
+  return byte_view_compare(a.data, a.size, b.data, b.size);
+}
+
+/**
+ * \brief Tests whether a quantity fits the signed 128-bit range.
+ *
+ * The valid range is \c -(2^127) .. \c (2^127 - 1). A magnitude under 128 bits is
+ * always valid; exactly 128 bits is valid only for \c -(2^127).
+ *
+ * \param[in] amount The quantity to check.
+ *
+ * \return \c true when the quantity is in range, \c false otherwise.
+ */
+static bool
+amount_in_range(const cardano_bigint_t* amount)
+{
+  cardano_bigint_t* one   = NULL;
+  cardano_bigint_t* limit = NULL;
+  bool              ok    = false;
+
+  if (cardano_bigint_bit_length(amount) < PRV_VALUE_AMOUNT_BITS)
+  {
+    return true;
+  }
+
+  if (cardano_bigint_from_int(1, &one) != CARDANO_SUCCESS)
+  {
+    return false;
+  }
+
+  if (cardano_bigint_from_int(0, &limit) != CARDANO_SUCCESS)
+  {
+    cardano_bigint_unref(&one);
+
+    return false;
+  }
+
+  cardano_bigint_shift_left(one, 127U, limit);
+
+  if (cardano_bigint_signum(amount) >= 0)
+  {
+    ok = (cardano_bigint_compare(amount, limit) < 0);
+  }
+  else
+  {
+    cardano_bigint_t* neg_limit = NULL;
+
+    if (cardano_bigint_from_int(0, &neg_limit) == CARDANO_SUCCESS)
+    {
+      cardano_bigint_negate(limit, neg_limit);
+      ok = (cardano_bigint_compare(amount, neg_limit) >= 0);
+      cardano_bigint_unref(&neg_limit);
+    }
+  }
+
+  cardano_bigint_unref(&one);
+  cardano_bigint_unref(&limit);
+
+  return ok;
+}
+
+/**
+ * \brief Builds a token-pair constant from a token buffer and an amount bigint.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in] name The token bytes; copied into the arena.
+ * \param[in] amount The amount; the constructor clones it.
+ * \param[out] out On success, the token-pair constant.
+ *
+ * \return \ref CARDANO_SUCCESS or a propagated allocation error.
+ */
+static cardano_error_t
+make_token_pair(
+  struct cardano_uplc_arena_t*    arena,
+  cardano_uplc_byte_view_t        name,
+  const cardano_bigint_t*         amount,
+  const cardano_uplc_constant_t** out)
+{
+  cardano_bigint_t*        amount_copy = NULL;
+  cardano_uplc_constant_t* name_const  = NULL;
+  cardano_uplc_constant_t* amt_const   = NULL;
+  cardano_uplc_constant_t* pair_const  = NULL;
+  cardano_error_t          error       = CARDANO_SUCCESS;
+
+  error = cardano_uplc_int_constant_new_byte_string_copy(arena, name.data, name.size, &name_const);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_bigint_clone(amount, &amount_copy);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_uplc_constant_new_integer(arena, amount_copy, &amt_const);
+  cardano_bigint_unref(&amount_copy);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_uplc_constant_new_pair(arena, name_const, amt_const, &pair_const);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *out = pair_const;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Builds a policy-entry constant from a policy buffer and a token list.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in] policy The policy bytes; copied into the arena.
+ * \param[in] tokens The token-pair item array.
+ * \param[in] count The token count.
+ * \param[out] out On success, the policy-entry constant.
+ *
+ * \return \ref CARDANO_SUCCESS or a propagated allocation error.
+ */
+static cardano_error_t
+make_policy_entry(
+  struct cardano_uplc_arena_t*          arena,
+  cardano_uplc_byte_view_t              policy,
+  const cardano_uplc_constant_t* const* tokens,
+  size_t                                count,
+  const cardano_uplc_constant_t**       out)
+{
+  cardano_uplc_constant_t* policy_const = NULL;
+  cardano_uplc_type_t*     token_pair   = NULL;
+  cardano_uplc_type_t*     bytestring   = NULL;
+  cardano_uplc_type_t*     integer      = NULL;
+  cardano_uplc_constant_t* list_const   = NULL;
+  cardano_uplc_constant_t* pair_const   = NULL;
+  cardano_error_t          error        = CARDANO_SUCCESS;
+
+  error = cardano_uplc_int_constant_new_byte_string_copy(arena, policy.data, policy.size, &policy_const);
+
+  if (error == CARDANO_SUCCESS)
+  {
+    error = cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_BYTE_STRING, NULL, NULL, &bytestring);
+  }
+
+  if (error == CARDANO_SUCCESS)
+  {
+    error = cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_INTEGER, NULL, NULL, &integer);
+  }
+
+  if (error == CARDANO_SUCCESS)
+  {
+    error = cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_PAIR, bytestring, integer, &token_pair);
+  }
+
+  if (error == CARDANO_SUCCESS)
+  {
+    error = cardano_uplc_constant_new_list(arena, token_pair, tokens, count, &list_const);
+  }
+
+  if (error == CARDANO_SUCCESS)
+  {
+    error = cardano_uplc_constant_new_pair(arena, policy_const, list_const, &pair_const);
+  }
+
+  if (error == CARDANO_SUCCESS)
+  {
+    *out = pair_const;
+  }
+
+  return error;
+}
+
+/**
+ * \brief Allocates an arena array of constant pointers.
+ *
+ * \param[in] arena The arena to allocate from.
+ * \param[in] count The number of pointers.
+ *
+ * \return The array, or NULL on allocation failure (or NULL for a zero count).
+ */
+static const cardano_uplc_constant_t**
+alloc_const_array(struct cardano_uplc_arena_t* arena, size_t count)
+{
+  if (count == 0U)
+  {
+    return NULL;
+  }
+
+  return (const cardano_uplc_constant_t**)cardano_uplc_arena_alloc(arena, sizeof(const cardano_uplc_constant_t*) * count, 0U);
+}
+
+/**
+ * \brief Wraps a normalized policy-entry array as a value result.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] entries The policy-entry item array.
+ * \param[in] count The number of policy entries.
+ * \param[out] out_result On success, the value result.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+value_result(
+  struct cardano_uplc_arena_t*          arena,
+  const cardano_uplc_constant_t* const* entries,
+  size_t                                count,
+  const cardano_uplc_value_t**          out_result,
+  cardano_error_t*                      host_error)
+{
+  const cardano_uplc_type_t* elem_type = NULL;
+  cardano_uplc_constant_t*   constant  = NULL;
+  cardano_uplc_value_t*      result    = NULL;
+
+  *host_error = cardano_uplc_int_value_element_type(arena, &elem_type);
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_constant_new_value(arena, elem_type, entries, count, &constant);
+  }
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_value_new_constant(arena, constant, &result);
+  }
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c insertCoin: sets a coin in a value, deleting it when the amount is zero.
+ *
+ * Enforces the signed 128-bit amount range and the 32-byte key length (oversize
+ * keys are allowed only for a zero amount, which is a no-op). Maintains ascending
+ * policy and token order with no duplicates and no zero quantities.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The policy, token, amount and value arguments.
+ * \param[out] out_result On success, the value result.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_insert_coin(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t        ccy       = { NULL, 0U };
+  cardano_uplc_byte_view_t        tok       = { NULL, 0U };
+  const cardano_bigint_t*         amount    = NULL;
+  const cardano_uplc_constant_t*  value     = NULL;
+  const cardano_uplc_constant_t** entries   = NULL;
+  size_t                          out_count = 0U;
+  size_t                          i         = 0U;
+  bool                            is_zero   = false;
+  bool                            found_ccy = false;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &ccy) || !cardano_uplc_builtin_as_byte_string(args[1], &tok) || !as_integer_big(arena, args[2], &amount) || !as_value_constant(args[3], &value))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  is_zero = cardano_bigint_is_zero(amount);
+
+  if ((ccy.size > PRV_VALUE_KEY_MAX) || (tok.size > PRV_VALUE_KEY_MAX))
+  {
+    if (!is_zero)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    *out_result = args[3];
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+  }
+
+  if (!is_zero && !amount_in_range(amount))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  entries = alloc_const_array(arena, value->as.list.count + 1U);
+
+  if (entries == NULL)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; i < value->as.list.count; ++i)
+  {
+    cardano_uplc_byte_view_t              policy = { NULL, 0U };
+    const cardano_uplc_constant_t* const* tokens = NULL;
+    size_t                                tcount = 0U;
+    int                                   cmp    = 0;
+
+    if (!value_entry(value->as.list.items[i], &policy, &tokens, &tcount))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    cmp = compare_buffers(policy, ccy);
+
+    if (cmp < 0)
+    {
+      entries[out_count] = value->as.list.items[i];
+      out_count          += 1U;
+    }
+    else if (cmp == 0)
+    {
+      const cardano_uplc_constant_t** new_tokens = alloc_const_array(arena, tcount + 1U);
+      size_t                          tout       = 0U;
+      size_t                          j          = 0U;
+      bool                            found_tok  = false;
+
+      found_ccy = true;
+
+      if (new_tokens == NULL)
+      {
+        *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      for (j = 0U; j < tcount; ++j)
+      {
+        cardano_uplc_byte_view_t name = { NULL, 0U };
+        const cardano_bigint_t*  amt  = NULL;
+        int                      tcmp = 0;
+
+        if (!value_token(arena, tokens[j], &name, &amt))
+        {
+          return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+        }
+
+        tcmp = compare_buffers(name, tok);
+
+        if (tcmp < 0)
+        {
+          new_tokens[tout] = tokens[j];
+          tout             += 1U;
+        }
+        else if (tcmp == 0)
+        {
+          found_tok = true;
+
+          if (!is_zero)
+          {
+            *host_error = make_token_pair(arena, tok, amount, &new_tokens[tout]);
+
+            if (*host_error != CARDANO_SUCCESS)
+            {
+              return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+            }
+
+            tout += 1U;
+          }
+        }
+        else
+        {
+          if (!found_tok)
+          {
+            found_tok = true;
+
+            if (!is_zero)
+            {
+              *host_error = make_token_pair(arena, tok, amount, &new_tokens[tout]);
+
+              if (*host_error != CARDANO_SUCCESS)
+              {
+                return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+              }
+
+              tout += 1U;
+            }
+          }
+
+          new_tokens[tout] = tokens[j];
+          tout             += 1U;
+        }
+      }
+
+      if (!found_tok && !is_zero)
+      {
+        *host_error = make_token_pair(arena, tok, amount, &new_tokens[tout]);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+        }
+
+        tout += 1U;
+      }
+
+      if (tout > 0U)
+      {
+        *host_error = make_policy_entry(arena, policy, new_tokens, tout, &entries[out_count]);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+        }
+
+        out_count += 1U;
+      }
+    }
+    else
+    {
+      if (!found_ccy)
+      {
+        found_ccy = true;
+
+        if (!is_zero)
+        {
+          const cardano_uplc_constant_t** single = alloc_const_array(arena, 1U);
+
+          if (single == NULL)
+          {
+            *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+            return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+          }
+
+          *host_error = make_token_pair(arena, tok, amount, &single[0]);
+
+          if (*host_error == CARDANO_SUCCESS)
+          {
+            *host_error = make_policy_entry(arena, ccy, single, 1U, &entries[out_count]);
+          }
+
+          if (*host_error != CARDANO_SUCCESS)
+          {
+            return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+          }
+
+          out_count += 1U;
+        }
+      }
+
+      entries[out_count] = value->as.list.items[i];
+      out_count          += 1U;
+    }
+  }
+
+  if (!found_ccy && !is_zero)
+  {
+    const cardano_uplc_constant_t** single = alloc_const_array(arena, 1U);
+
+    if (single == NULL)
+    {
+      *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    *host_error = make_token_pair(arena, tok, amount, &single[0]);
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = make_policy_entry(arena, ccy, single, 1U, &entries[out_count]);
+    }
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    out_count += 1U;
+  }
+
+  return value_result(arena, entries, out_count, out_result, host_error);
+}
+
+/**
+ * \brief Runs \c lookupCoin: the amount of a coin in a value, or zero if absent.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The policy, token and value arguments.
+ * \param[out] out_result On success, the integer result.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_lookup_coin(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_byte_view_t       ccy   = { NULL, 0U };
+  cardano_uplc_byte_view_t       tok   = { NULL, 0U };
+  const cardano_uplc_constant_t* value = NULL;
+  const cardano_bigint_t*        found = NULL;
+  size_t                         i     = 0U;
+
+  if (!cardano_uplc_builtin_as_byte_string(args[0], &ccy) || !cardano_uplc_builtin_as_byte_string(args[1], &tok) || !as_value_constant(args[2], &value))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; (i < value->as.list.count) && (found == NULL); ++i)
+  {
+    cardano_uplc_byte_view_t              policy = { NULL, 0U };
+    const cardano_uplc_constant_t* const* tokens = NULL;
+    size_t                                tcount = 0U;
+    int                                   cmp    = 0;
+
+    if (!value_entry(value->as.list.items[i], &policy, &tokens, &tcount))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    cmp = compare_buffers(policy, ccy);
+
+    if (cmp == 0)
+    {
+      size_t j = 0U;
+
+      for (j = 0U; (j < tcount) && (found == NULL); ++j)
+      {
+        cardano_uplc_byte_view_t name = { NULL, 0U };
+        const cardano_bigint_t*  amt  = NULL;
+
+        if (!value_token(arena, tokens[j], &name, &amt))
+        {
+          return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+        }
+
+        if (compare_buffers(name, tok) == 0)
+        {
+          found = amt;
+        }
+      }
+    }
+  }
+
+  if (found != NULL)
+  {
+    cardano_bigint_t* clone = NULL;
+
+    *host_error = cardano_bigint_clone(found, &clone);
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    *host_error = result_integer(arena, clone, out_result);
+
+    return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_integer_from_int(arena, 0, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c scaleValue: multiplies every amount in a value by a scalar.
+ *
+ * A zero scalar yields the empty value. The scalar and every product must fit the
+ * signed 128-bit range.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The scalar and the value arguments.
+ * \param[out] out_result On success, the value result.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_scale_value(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_bigint_t*         scalar    = NULL;
+  const cardano_uplc_constant_t*  value     = NULL;
+  const cardano_uplc_constant_t** entries   = NULL;
+  size_t                          out_count = 0U;
+  size_t                          i         = 0U;
+
+  if (!as_integer_big(arena, args[0], &scalar) || !as_value_constant(args[1], &value))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_bigint_is_zero(scalar))
+  {
+    return value_result(arena, NULL, 0U, out_result, host_error);
+  }
+
+  if (!amount_in_range(scalar))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  entries = alloc_const_array(arena, value->as.list.count);
+
+  if ((value->as.list.count > 0U) && (entries == NULL))
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; i < value->as.list.count; ++i)
+  {
+    cardano_uplc_byte_view_t              policy     = { NULL, 0U };
+    const cardano_uplc_constant_t* const* tokens     = NULL;
+    size_t                                tcount     = 0U;
+    const cardano_uplc_constant_t**       new_tokens = NULL;
+    size_t                                tout       = 0U;
+    size_t                                j          = 0U;
+
+    if (!value_entry(value->as.list.items[i], &policy, &tokens, &tcount))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    new_tokens = alloc_const_array(arena, tcount);
+
+    if ((tcount > 0U) && (new_tokens == NULL))
+    {
+      *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    for (j = 0U; j < tcount; ++j)
+    {
+      cardano_uplc_byte_view_t name    = { NULL, 0U };
+      const cardano_bigint_t*  amt     = NULL;
+      cardano_bigint_t*        product = NULL;
+
+      if (!value_token(arena, tokens[j], &name, &amt))
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      if (cardano_bigint_from_int(0, &product) != CARDANO_SUCCESS)
+      {
+        *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      cardano_bigint_multiply(amt, scalar, product);
+
+      if (!amount_in_range(product))
+      {
+        cardano_bigint_unref(&product);
+
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      *host_error = make_token_pair(arena, name, product, &new_tokens[tout]);
+      cardano_bigint_unref(&product);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      tout += 1U;
+    }
+
+    if (tout > 0U)
+    {
+      *host_error = make_policy_entry(arena, policy, new_tokens, tout, &entries[out_count]);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      out_count += 1U;
+    }
+  }
+
+  return value_result(arena, entries, out_count, out_result, host_error);
+}
+
+/**
+ * \brief Merges two sorted token lists by adding amounts, dropping zeros.
+ *
+ * Each summed amount must fit the signed 128-bit range.
+ *
+ * \param[in] arena The arena the merged tokens are allocated from.
+ * \param[in] t1 The first token-pair array.
+ * \param[in] n1 The length of \p t1.
+ * \param[in] t2 The second token-pair array.
+ * \param[in] n2 The length of \p t2.
+ * \param[out] out On success, the merged token array.
+ * \param[out] out_count On success, the merged length.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return \c true on success, \c false on a range or allocation failure.
+ */
+static bool
+merge_tokens(
+  struct cardano_uplc_arena_t*          arena,
+  const cardano_uplc_constant_t* const* t1,
+  size_t                                n1,
+  const cardano_uplc_constant_t* const* t2,
+  size_t                                n2,
+  // cppcheck-suppress misra-c2012-18.5; Reason: pointer nesting required by the API shape
+  const cardano_uplc_constant_t*** out,
+  size_t*                          out_count,
+  cardano_error_t*                 host_error)
+{
+  const cardano_uplc_constant_t** merged = alloc_const_array(arena, n1 + n2);
+  size_t                          count  = 0U;
+  size_t                          i      = 0U;
+  size_t                          j      = 0U;
+
+  if (((n1 + n2) > 0U) && (merged == NULL))
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return false;
+  }
+
+  while ((i < n1) && (j < n2))
+  {
+    cardano_uplc_byte_view_t name1 = { NULL, 0U };
+    const cardano_bigint_t*  amt1  = NULL;
+    cardano_uplc_byte_view_t name2 = { NULL, 0U };
+    const cardano_bigint_t*  amt2  = NULL;
+    int                      cmp   = 0;
+
+    if (!value_token(arena, t1[i], &name1, &amt1) || !value_token(arena, t2[j], &name2, &amt2))
+    {
+      return false;
+    }
+
+    cmp = compare_buffers(name1, name2);
+
+    if (cmp < 0)
+    {
+      merged[count] = t1[i];
+      count         += 1U;
+      i             += 1U;
+    }
+    else if (cmp > 0)
+    {
+      merged[count] = t2[j];
+      count         += 1U;
+      j             += 1U;
+    }
+    else
+    {
+      cardano_bigint_t* sum = NULL;
+
+      if (cardano_bigint_from_int(0, &sum) != CARDANO_SUCCESS)
+      {
+        *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+        return false;
+      }
+
+      cardano_bigint_add(amt1, amt2, sum);
+
+      if (!amount_in_range(sum))
+      {
+        cardano_bigint_unref(&sum);
+
+        return false;
+      }
+
+      if (!cardano_bigint_is_zero(sum))
+      {
+        *host_error = make_token_pair(arena, name1, sum, &merged[count]);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          cardano_bigint_unref(&sum);
+
+          return false;
+        }
+
+        count += 1U;
+      }
+
+      cardano_bigint_unref(&sum);
+      i += 1U;
+      j += 1U;
+    }
+  }
+
+  while (i < n1)
+  {
+    merged[count] = t1[i];
+    count         += 1U;
+    i             += 1U;
+  }
+
+  while (j < n2)
+  {
+    merged[count] = t2[j];
+    count         += 1U;
+    j             += 1U;
+  }
+
+  *out       = merged;
+  *out_count = count;
+
+  return true;
+}
+
+/**
+ * \brief Runs \c unionValue: merges two values by adding matching amounts.
+ *
+ * Performs a sorted merge of the policy lists that sums shared tokens, drops zero
+ * results and range-checks every sum.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The two value arguments.
+ * \param[out] out_result On success, the value result.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_union_value(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_constant_t*  a         = NULL;
+  const cardano_uplc_constant_t*  b         = NULL;
+  const cardano_uplc_constant_t** entries   = NULL;
+  size_t                          out_count = 0U;
+  size_t                          i         = 0U;
+  size_t                          j         = 0U;
+
+  if (!as_value_constant(args[0], &a) || !as_value_constant(args[1], &b))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  entries = alloc_const_array(arena, a->as.list.count + b->as.list.count);
+
+  if (((a->as.list.count + b->as.list.count) > 0U) && (entries == NULL))
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  while ((i < a->as.list.count) && (j < b->as.list.count))
+  {
+    cardano_uplc_byte_view_t              pa  = { NULL, 0U };
+    const cardano_uplc_constant_t* const* ta  = NULL;
+    size_t                                na  = 0U;
+    cardano_uplc_byte_view_t              pb  = { NULL, 0U };
+    const cardano_uplc_constant_t* const* tb  = NULL;
+    size_t                                nb  = 0U;
+    int                                   cmp = 0;
+
+    if (!value_entry(a->as.list.items[i], &pa, &ta, &na) || !value_entry(b->as.list.items[j], &pb, &tb, &nb))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    cmp = compare_buffers(pa, pb);
+
+    if (cmp < 0)
+    {
+      entries[out_count] = a->as.list.items[i];
+      out_count          += 1U;
+      i                  += 1U;
+    }
+    else if (cmp > 0)
+    {
+      entries[out_count] = b->as.list.items[j];
+      out_count          += 1U;
+      j                  += 1U;
+    }
+    else
+    {
+      const cardano_uplc_constant_t** merged = NULL;
+      size_t                          mcount = 0U;
+
+      if (!merge_tokens(arena, ta, na, tb, nb, &merged, &mcount, host_error))
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      if (mcount > 0U)
+      {
+        *host_error = make_policy_entry(arena, pa, merged, mcount, &entries[out_count]);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+        }
+
+        out_count += 1U;
+      }
+
+      i += 1U;
+      j += 1U;
+    }
+  }
+
+  while (i < a->as.list.count)
+  {
+    entries[out_count] = a->as.list.items[i];
+    out_count          += 1U;
+    i                  += 1U;
+  }
+
+  while (j < b->as.list.count)
+  {
+    entries[out_count] = b->as.list.items[j];
+    out_count          += 1U;
+    j                  += 1U;
+  }
+
+  return value_result(arena, entries, out_count, out_result, host_error);
+}
+
+/**
+ * \brief Tests whether a value carries any negative amount.
+ *
+ * \param[in] value The value constant.
+ * \param[out] malformed Set to \c true when the structure is malformed.
+ *
+ * \return \c true when a negative amount is present.
+ */
+static bool
+value_has_negative(struct cardano_uplc_arena_t* arena, const cardano_uplc_constant_t* value, bool* malformed)
+{
+  size_t i = 0U;
+
+  for (i = 0U; i < value->as.list.count; ++i)
+  {
+    cardano_uplc_byte_view_t              policy = { NULL, 0U };
+    const cardano_uplc_constant_t* const* tokens = NULL;
+    size_t                                tcount = 0U;
+    size_t                                j      = 0U;
+
+    if (!value_entry(value->as.list.items[i], &policy, &tokens, &tcount))
+    {
+      *malformed = true;
+
+      return false;
+    }
+
+    for (j = 0U; j < tcount; ++j)
+    {
+      cardano_uplc_byte_view_t name = { NULL, 0U };
+      const cardano_bigint_t*  amt  = NULL;
+
+      if (!value_token(arena, tokens[j], &name, &amt))
+      {
+        *malformed = true;
+
+        return false;
+      }
+
+      if (cardano_bigint_signum(amt) < 0)
+      {
+        return true;
+      }
+    }
+  }
+
+  return false;
+}
+
+/**
+ * \brief Looks up an amount in a value, returning whether it was found.
+ *
+ * \param[in] value The value constant.
+ * \param[in] ccy The policy byte view.
+ * \param[in] tok The token byte view.
+ * \param[out] out On success and when found, the amount bigint.
+ *
+ * \return \c true when the (policy, token) pair is present.
+ */
+static bool
+value_lookup(
+  struct cardano_uplc_arena_t*   arena,
+  const cardano_uplc_constant_t* value,
+  cardano_uplc_byte_view_t       ccy,
+  cardano_uplc_byte_view_t       tok,
+  const cardano_bigint_t**       out)
+{
+  size_t i = 0U;
+
+  for (i = 0U; i < value->as.list.count; ++i)
+  {
+    cardano_uplc_byte_view_t              policy = { NULL, 0U };
+    const cardano_uplc_constant_t* const* tokens = NULL;
+    size_t                                tcount = 0U;
+
+    if (!value_entry(value->as.list.items[i], &policy, &tokens, &tcount))
+    {
+      return false;
+    }
+
+    if (compare_buffers(policy, ccy) == 0)
+    {
+      size_t j = 0U;
+
+      for (j = 0U; j < tcount; ++j)
+      {
+        cardano_uplc_byte_view_t name = { NULL, 0U };
+        const cardano_bigint_t*  amt  = NULL;
+
+        if (!value_token(arena, tokens[j], &name, &amt))
+        {
+          return false;
+        }
+
+        if (compare_buffers(name, tok) == 0)
+        {
+          *out = amt;
+
+          return true;
+        }
+      }
+    }
+  }
+
+  return false;
+}
+
+/**
+ * \brief Runs \c valueContains: whether the first value covers the second.
+ *
+ * Both values must be free of negative amounts (a negative is a script error).
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The covering value and the required value.
+ * \param[out] out_result On success, the boolean result.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_value_contains(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_constant_t* covering  = NULL;
+  const cardano_uplc_constant_t* required  = NULL;
+  bool                           malformed = false;
+  bool                           contains  = true;
+  size_t                         i         = 0U;
+
+  if (!as_value_constant(args[0], &covering) || !as_value_constant(args[1], &required))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (value_has_negative(arena, required, &malformed) || malformed)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (value_has_negative(arena, covering, &malformed) || malformed)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; (i < required->as.list.count) && contains; ++i)
+  {
+    cardano_uplc_byte_view_t              policy = { NULL, 0U };
+    const cardano_uplc_constant_t* const* tokens = NULL;
+    size_t                                tcount = 0U;
+    size_t                                j      = 0U;
+
+    if (!value_entry(required->as.list.items[i], &policy, &tokens, &tcount))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    for (j = 0U; (j < tcount) && contains; ++j)
+    {
+      cardano_uplc_byte_view_t name      = { NULL, 0U };
+      const cardano_bigint_t*  needed    = NULL;
+      const cardano_bigint_t*  available = NULL;
+
+      if (!value_token(arena, tokens[j], &name, &needed))
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      if (!value_lookup(arena, covering, policy, name, &available) || (cardano_bigint_compare(available, needed) < 0))
+      {
+        contains = false;
+      }
+    }
+  }
+
+  *host_error = result_bool(arena, contains, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c valueData: encodes a value as Data Map of policy to token map.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The value argument.
+ * \param[out] out_result On success, the data result.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_value_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_constant_t* value = NULL;
+  cardano_plutus_map_t*          outer = NULL;
+  cardano_plutus_data_t*         data  = NULL;
+  size_t                         i     = 0U;
+
+  if (!as_value_constant(args[0], &value))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_plutus_map_new(&outer) != CARDANO_SUCCESS)
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; i < value->as.list.count; ++i)
+  {
+    cardano_uplc_byte_view_t              policy   = { NULL, 0U };
+    const cardano_uplc_constant_t* const* tokens   = NULL;
+    size_t                                tcount   = 0U;
+    cardano_plutus_map_t*                 inner    = NULL;
+    cardano_plutus_data_t*                key_data = NULL;
+    cardano_plutus_data_t*                val_data = NULL;
+    size_t                                j        = 0U;
+
+    if (!value_entry(value->as.list.items[i], &policy, &tokens, &tcount))
+    {
+      cardano_plutus_map_unref(&outer);
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    if (cardano_plutus_map_new(&inner) != CARDANO_SUCCESS)
+    {
+      cardano_plutus_map_unref(&outer);
+      *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    for (j = 0U; j < tcount; ++j)
+    {
+      cardano_uplc_byte_view_t name     = { NULL, 0U };
+      const cardano_bigint_t*  amt      = NULL;
+      cardano_plutus_data_t*   tok_data = NULL;
+      cardano_plutus_data_t*   amt_data = NULL;
+      cardano_bigint_t*        amt_copy = NULL;
+
+      if (!value_token(arena, tokens[j], &name, &amt))
+      {
+        cardano_plutus_map_unref(&inner);
+        cardano_plutus_map_unref(&outer);
+
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      {
+        static const byte_t empty = 0;
+
+        *host_error = cardano_plutus_data_new_bytes((name.data != NULL) ? name.data : &empty, name.size, &tok_data);
+      }
+
+      if (*host_error == CARDANO_SUCCESS)
+      {
+        *host_error = cardano_bigint_clone(amt, &amt_copy);
+      }
+
+      if (*host_error == CARDANO_SUCCESS)
+      {
+        *host_error = cardano_plutus_data_new_integer(amt_copy, &amt_data);
+        cardano_bigint_unref(&amt_copy);
+      }
+
+      if (*host_error == CARDANO_SUCCESS)
+      {
+        *host_error = cardano_plutus_map_insert(inner, tok_data, amt_data);
+      }
+
+      cardano_plutus_data_unref(&tok_data);
+      cardano_plutus_data_unref(&amt_data);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        cardano_plutus_map_unref(&inner);
+        cardano_plutus_map_unref(&outer);
+
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+    }
+
+    {
+      static const byte_t empty = 0;
+
+      *host_error = cardano_plutus_data_new_bytes((policy.data != NULL) ? policy.data : &empty, policy.size, &key_data);
+    }
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = cardano_plutus_data_new_map(inner, &val_data);
+    }
+
+    cardano_plutus_map_unref(&inner);
+
+    if (*host_error == CARDANO_SUCCESS)
+    {
+      *host_error = cardano_plutus_map_insert(outer, key_data, val_data);
+    }
+
+    cardano_plutus_data_unref(&key_data);
+    cardano_plutus_data_unref(&val_data);
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      cardano_plutus_map_unref(&outer);
+
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+  }
+
+  *host_error = cardano_plutus_data_new_map(outer, &data);
+  cardano_plutus_map_unref(&outer);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_data(arena, data, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Decodes one data-map token entry into a token-pair constant.
+ *
+ * Enforces a byte-string key of at most 32 bytes that ascends strictly past
+ * \p prev, a non-zero integer amount in the signed 128-bit range, and writes the
+ * token bytes used for the next ordering check.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in] key The token-key data.
+ * \param[in] val The amount data.
+ * \param[in] prev The previous token bytes, or NULL for the first entry.
+ * \param[out] out On success, the token-pair constant.
+ * \param[out] next On success, the bytes of \p key.
+ *
+ * \return \c true on success, \c false on a validation or allocation failure.
+ */
+static bool
+decode_token(
+  struct cardano_uplc_arena_t*    arena,
+  cardano_plutus_data_t*          key,
+  cardano_plutus_data_t*          val,
+  const cardano_buffer_t*         prev,
+  const cardano_uplc_constant_t** out,
+  cardano_buffer_t**              next)
+{
+  cardano_plutus_data_kind_t key_kind = CARDANO_PLUTUS_DATA_KIND_INTEGER;
+  cardano_plutus_data_kind_t val_kind = CARDANO_PLUTUS_DATA_KIND_INTEGER;
+  cardano_buffer_t*          name     = NULL;
+  cardano_bigint_t*          amount   = NULL;
+  bool                       ok       = false;
+
+  if ((cardano_plutus_data_get_kind(key, &key_kind) != CARDANO_SUCCESS) || (key_kind != CARDANO_PLUTUS_DATA_KIND_BYTES))
+  {
+    return false;
+  }
+
+  if ((cardano_plutus_data_get_kind(val, &val_kind) != CARDANO_SUCCESS) || (val_kind != CARDANO_PLUTUS_DATA_KIND_INTEGER))
+  {
+    return false;
+  }
+
+  if (cardano_plutus_data_to_bounded_bytes(key, &name) != CARDANO_SUCCESS)
+  {
+    return false;
+  }
+
+  if (cardano_plutus_data_to_integer(val, &amount) != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&name);
+
+    return false;
+  }
+
+  {
+    cardano_uplc_byte_view_t name_view = { cardano_buffer_get_data(name), cardano_buffer_get_size(name) };
+    cardano_uplc_byte_view_t prev_view = { NULL, 0U };
+
+    if (prev != NULL)
+    {
+      prev_view.data = cardano_buffer_get_data(prev);
+      prev_view.size = cardano_buffer_get_size(prev);
+    }
+
+    if ((name_view.size <= PRV_VALUE_KEY_MAX) && ((prev == NULL) || (compare_buffers(prev_view, name_view) < 0)) && !cardano_bigint_is_zero(amount) && amount_in_range(amount))
+    {
+      cardano_buffer_t* name_copy = cardano_buffer_new_from(name_view.data, name_view.size);
+
+      if (name_copy != NULL)
+      {
+        ok = (make_token_pair(arena, name_view, amount, out) == CARDANO_SUCCESS);
+
+        if (ok)
+        {
+          *next = name_copy;
+        }
+        else
+        {
+          cardano_buffer_unref(&name_copy);
+        }
+      }
+    }
+  }
+
+  cardano_bigint_unref(&amount);
+  cardano_buffer_unref(&name);
+
+  return ok;
+}
+
+/**
+ * \brief Runs \c unValueData: decodes a Data Map into a value, validating it.
+ *
+ * Requires a Map whose policy keys are byte strings of at most 32 bytes in strict
+ * ascending order, each mapped to a non-empty token Map with ascending token keys
+ * of at most 32 bytes and non-zero amounts in the signed 128-bit range. Any
+ * violation is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The data argument.
+ * \param[out] out_result On success, the value result.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_un_value_data(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_data_t*      node     = NULL;
+  cardano_plutus_data_t*          data     = NULL;
+  cardano_plutus_data_kind_t      kind     = CARDANO_PLUTUS_DATA_KIND_INTEGER;
+  cardano_plutus_map_t*           outer    = NULL;
+  cardano_plutus_list_t*          keys     = NULL;
+  cardano_plutus_list_t*          values   = NULL;
+  const cardano_uplc_constant_t** entries  = NULL;
+  cardano_buffer_t*               prev_ccy = NULL;
+  size_t                          count    = 0U;
+  size_t                          i        = 0U;
+  bool                            failed   = false;
+
+  if (!cardano_uplc_builtin_as_data(args[0], &node))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (node->kind != CARDANO_UPLC_DATA_KIND_MAP)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_data_to_plutus_data(node, &data);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((cardano_plutus_data_get_kind(data, &kind) != CARDANO_SUCCESS) || (kind != CARDANO_PLUTUS_DATA_KIND_MAP))
+  {
+    cardano_plutus_data_unref(&data);
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_plutus_data_to_map(data, &outer) != CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_unref(&data);
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((cardano_plutus_map_get_keys(outer, &keys) != CARDANO_SUCCESS) || (cardano_plutus_map_get_values(outer, &values) != CARDANO_SUCCESS))
+  {
+    cardano_plutus_list_unref(&keys);
+    cardano_plutus_list_unref(&values);
+    cardano_plutus_map_unref(&outer);
+    cardano_plutus_data_unref(&data);
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  cardano_plutus_map_unref(&outer);
+
+  count   = cardano_plutus_list_get_length(keys);
+  entries = alloc_const_array(arena, count);
+
+  if ((count > 0U) && (entries == NULL))
+  {
+    cardano_plutus_list_unref(&keys);
+    cardano_plutus_list_unref(&values);
+    cardano_plutus_data_unref(&data);
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; (i < count) && !failed; ++i)
+  {
+    cardano_plutus_data_t*          key_data   = NULL;
+    cardano_plutus_data_t*          val_data   = NULL;
+    cardano_plutus_data_kind_t      key_kind   = CARDANO_PLUTUS_DATA_KIND_INTEGER;
+    cardano_plutus_data_kind_t      val_kind   = CARDANO_PLUTUS_DATA_KIND_INTEGER;
+    cardano_buffer_t*               policy     = NULL;
+    cardano_plutus_map_t*           inner      = NULL;
+    cardano_plutus_list_t*          tok_keys   = NULL;
+    cardano_plutus_list_t*          tok_values = NULL;
+    const cardano_uplc_constant_t** tokens     = NULL;
+    cardano_buffer_t*               prev_tok   = NULL;
+    size_t                          tcount     = 0U;
+    size_t                          j          = 0U;
+
+    if ((cardano_plutus_list_get(keys, i, &key_data) != CARDANO_SUCCESS) || (cardano_plutus_list_get(values, i, &val_data) != CARDANO_SUCCESS))
+    {
+      cardano_plutus_data_unref(&key_data);
+      failed = true;
+      break;
+    }
+
+    if ((cardano_plutus_data_get_kind(key_data, &key_kind) != CARDANO_SUCCESS) || (key_kind != CARDANO_PLUTUS_DATA_KIND_BYTES) || (cardano_plutus_data_to_bounded_bytes(key_data, &policy) != CARDANO_SUCCESS))
+    {
+      failed = true;
+    }
+
+    if (!failed && (cardano_buffer_get_size(policy) > PRV_VALUE_KEY_MAX))
+    {
+      failed = true;
+    }
+
+    if (!failed && (prev_ccy != NULL))
+    {
+      cardano_uplc_byte_view_t prev_view   = { cardano_buffer_get_data(prev_ccy), cardano_buffer_get_size(prev_ccy) };
+      cardano_uplc_byte_view_t policy_view = { cardano_buffer_get_data(policy), cardano_buffer_get_size(policy) };
+
+      if (compare_buffers(prev_view, policy_view) >= 0)
+      {
+        failed = true;
+      }
+    }
+
+    if (!failed)
+    {
+      if ((cardano_plutus_data_get_kind(val_data, &val_kind) != CARDANO_SUCCESS) || (val_kind != CARDANO_PLUTUS_DATA_KIND_MAP) || (cardano_plutus_data_to_map(val_data, &inner) != CARDANO_SUCCESS))
+      {
+        failed = true;
+      }
+    }
+
+    if (!failed && ((cardano_plutus_map_get_keys(inner, &tok_keys) != CARDANO_SUCCESS) || (cardano_plutus_map_get_values(inner, &tok_values) != CARDANO_SUCCESS)))
+    {
+      failed = true;
+    }
+
+    cardano_plutus_map_unref(&inner);
+
+    if (!failed)
+    {
+      tcount = cardano_plutus_list_get_length(tok_keys);
+
+      if (tcount == 0U)
+      {
+        failed = true;
+      }
+    }
+
+    if (!failed)
+    {
+      tokens = alloc_const_array(arena, tcount);
+
+      if (tokens == NULL)
+      {
+        *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        failed      = true;
+      }
+    }
+
+    for (j = 0U; (j < tcount) && !failed; ++j)
+    {
+      cardano_plutus_data_t* tk   = NULL;
+      cardano_plutus_data_t* tv   = NULL;
+      cardano_buffer_t*      next = NULL;
+
+      if ((cardano_plutus_list_get(tok_keys, j, &tk) != CARDANO_SUCCESS) || (cardano_plutus_list_get(tok_values, j, &tv) != CARDANO_SUCCESS))
+      {
+        cardano_plutus_data_unref(&tk);
+        failed = true;
+      }
+      else if (!decode_token(arena, tk, tv, prev_tok, &tokens[j], &next))
+      {
+        failed = true;
+      }
+      else
+      {
+        cardano_buffer_unref(&prev_tok);
+        prev_tok = next;
+      }
+
+      cardano_plutus_data_unref(&tk);
+      cardano_plutus_data_unref(&tv);
+    }
+
+    cardano_buffer_unref(&prev_tok);
+    cardano_plutus_list_unref(&tok_keys);
+    cardano_plutus_list_unref(&tok_values);
+
+    if (!failed)
+    {
+      cardano_uplc_byte_view_t policy_view = { cardano_buffer_get_data(policy), cardano_buffer_get_size(policy) };
+
+      *host_error = make_policy_entry(arena, policy_view, tokens, tcount, &entries[i]);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        failed = true;
+      }
+      else
+      {
+        cardano_buffer_unref(&prev_ccy);
+        prev_ccy = cardano_buffer_new_from(cardano_buffer_get_data(policy), cardano_buffer_get_size(policy));
+
+        if (prev_ccy == NULL)
+        {
+          *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+          failed      = true;
+        }
+      }
+    }
+
+    cardano_buffer_unref(&policy);
+    cardano_plutus_data_unref(&key_data);
+    cardano_plutus_data_unref(&val_data);
+  }
+
+  cardano_buffer_unref(&prev_ccy);
+  cardano_plutus_list_unref(&keys);
+  cardano_plutus_list_unref(&values);
+  cardano_plutus_data_unref(&data);
+
+  if (failed)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  return value_result(arena, entries, count, out_result, host_error);
+}
+
+/**
+ * \brief Runs \c dropList: a list without its first \c n elements.
+ *
+ * The first argument is the count to drop and the second is the list. A negative
+ * count drops nothing; a count at or above the length yields the empty list. The
+ * result keeps the list's element type.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The count and the list.
+ * \param[out] out_result On success, the resulting list value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_drop_list(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_bigint_t*               n            = NULL;
+  const cardano_uplc_type_t*            element_type = NULL;
+  const cardano_uplc_constant_t* const* items        = NULL;
+  size_t                                count        = 0U;
+  size_t                                start        = 0U;
+  cardano_uplc_constant_t*              constant     = NULL;
+  cardano_uplc_value_t*                 result       = NULL;
+
+  if (!as_integer_big(arena, args[0], &n) || !cardano_uplc_builtin_as_list(args[1], &element_type, &items, &count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_bigint_signum(n) <= 0)
+  {
+    start = 0U;
+  }
+  else if (cardano_bigint_bit_length(n) > 63U)
+  {
+    start = count;
+  }
+  else
+  {
+    const int64_t n64 = cardano_bigint_to_int(n);
+
+    start = ((uint64_t)n64 >= (uint64_t)count) ? count : (size_t)n64;
+  }
+
+  *host_error = cardano_uplc_constant_new_list(
+    arena,
+    element_type,
+    // cppcheck-suppress misra-c2012-12.1; Reason: operator precedence is explicit and intentional
+    // cppcheck-suppress misra-c2012-18.4; Reason: pointer arithmetic over a contiguous arena buffer
+    (start < count) ? (items + start) : NULL,
+    count - start,
+    &constant);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c lengthOfArray: the element count of an array, as an integer.
+ *
+ * The argument must be an array constant; a list is a type mismatch.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single array argument value.
+ * \param[out] out_result On success, the integer result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_length_of_array(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  size_t count = 0U;
+
+  if (!as_array(args[0], NULL, NULL, &count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_integer_from_int(arena, (int64_t)count, out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Runs \c listToArray: builds an array from a list's elements.
+ *
+ * The argument must be a list constant. The result is an array of the same
+ * element type carrying the same elements.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single list argument value.
+ * \param[out] out_result On success, the array result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_list_to_array(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_type_t*            element_type = NULL;
+  const cardano_uplc_constant_t* const* items        = NULL;
+  size_t                                count        = 0U;
+  cardano_uplc_constant_t*              constant     = NULL;
+  cardano_uplc_value_t*                 result       = NULL;
+
+  if (!cardano_uplc_builtin_as_list(args[0], &element_type, &items, &count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_constant_new_array(arena, element_type, (count > 0U) ? items : NULL, count, &constant);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_value_new_constant(arena, constant, &result);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c indexArray: the array element at a given index.
+ *
+ * The first argument must be an array and the second an integer index. A
+ * negative index, an index too large to address, or one at or beyond the length
+ * is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The array and the index.
+ * \param[out] out_result On success, the element value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_index_array(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_constant_t* const* items  = NULL;
+  size_t                                count  = 0U;
+  const cardano_bigint_t*               idx    = NULL;
+  int64_t                               i      = 0;
+  cardano_uplc_value_t*                 result = NULL;
+
+  if (!as_array(args[0], NULL, &items, &count) || !as_integer_big(arena, args[1], &idx))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_bigint_signum(idx) < 0)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if (cardano_bigint_bit_length(idx) > 63U)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  i = cardano_bigint_to_int(idx);
+
+  if ((uint64_t)i >= (uint64_t)count)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = cardano_uplc_value_new_constant(arena, items[i], &result);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs the BLS multi-scalar-multiplication pair (G1 and G2).
+ *
+ * The first argument is a list of integer scalars and the second a list of group
+ * points of \p kind (\ref CARDANO_UPLC_TYPE_BLS_G1 or
+ * \ref CARDANO_UPLC_TYPE_BLS_G2). The result is the sum of scalar_i * point_i
+ * over the shorter of the two lists; empty lists give the group identity. Every
+ * scalar in the list, including any beyond the length of the point list, must lie
+ * in -(2^4095) .. 2^4095 - 1, otherwise the call is a script error. Each scalar is
+ * reduced modulo the scalar period before multiplication, as ordinary scalar
+ * multiplication does.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] kind The group kind, G1 or G2.
+ * \param[in] args The scalar list and the point list.
+ * \param[out] out_result On success, the group result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_bls_multi_scalar_mul(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_type_kind_t           kind,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_constant_t* const* scalars      = NULL;
+  const cardano_uplc_constant_t* const* points       = NULL;
+  size_t                                scalar_count = 0U;
+  size_t                                point_count  = 0U;
+  size_t                                n            = 0U;
+  size_t                                i            = 0U;
+  byte_t                                scalar_be[CARDANO_UPLC_BLS_SCALAR_SIZE];
+  blst_scalar                           blst_scalar_value;
+  blst_p1                               acc1;
+  blst_p2                               acc2;
+
+  if (!cardano_uplc_builtin_as_list(args[0], NULL, &scalars, &scalar_count) || !cardano_uplc_builtin_as_list(args[1], NULL, &points, &point_count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; i < scalar_count; ++i)
+  {
+    const cardano_uplc_constant_t* scalar_const = scalars[i];
+
+    if ((scalar_const == NULL) || (scalar_const->kind != CARDANO_UPLC_TYPE_INTEGER))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    if (!constant_integer_within_signed_bits(scalar_const, CARDANO_UPLC_BLS_SCALAR_BOUND_BITS))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+  }
+
+  n = (scalar_count < point_count) ? scalar_count : point_count;
+
+  (void)memset(&acc1, 0, sizeof(acc1));
+  (void)memset(&acc2, 0, sizeof(acc2));
+
+  for (i = 0U; i < n; ++i)
+  {
+    const cardano_uplc_constant_t* scalar_const = scalars[i];
+    const cardano_uplc_constant_t* point_const  = points[i];
+    const cardano_bigint_t*        scalar_big   = NULL;
+
+    if ((point_const == NULL) || (point_const->kind != kind))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    if (!constant_integer_big(arena, scalar_const, &scalar_big))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    *host_error = bls_reduce_scalar(scalar_big, scalar_be);
+
+    if (*host_error != CARDANO_SUCCESS)
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    blst_scalar_from_bendian(&blst_scalar_value, scalar_be);
+
+    if (kind == CARDANO_UPLC_TYPE_BLS_G1)
+    {
+      blst_p1 term;
+
+      blst_p1_mult(&term, (const blst_p1*)point_const->as.bls, blst_scalar_value.b, CARDANO_UPLC_BLS_SCALAR_BITS);
+      blst_p1_add_or_double(&acc1, &acc1, &term);
+    }
+    else
+    {
+      blst_p2 term;
+
+      blst_p2_mult(&term, (const blst_p2*)point_const->as.bls, blst_scalar_value.b, CARDANO_UPLC_BLS_SCALAR_BITS);
+      blst_p2_add_or_double(&acc2, &acc2, &term);
+    }
+  }
+
+  if (kind == CARDANO_UPLC_TYPE_BLS_G1)
+  {
+    *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_G1, &acc1, sizeof(acc1), out_result);
+  }
+  else
+  {
+    *host_error = result_bls(arena, CARDANO_UPLC_TYPE_BLS_G2, &acc2, sizeof(acc2), out_result);
+  }
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/* BATCH 7 BODIES ***********************************************************/
+
+/**
+ * \brief The most indices \c multiIndexArray accepts in its index list.
+ *
+ * Walking a long list makes the execution time unpredictable from the index
+ * count alone, so the count is limited and the cost model is fitted over exactly
+ * that range.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t PRV_MULTI_INDEX_ARRAY_MAX_INDICES = 1024U;
+
+/**
+ * \brief The most policy ids \c keepPolicies and \c dropPolicies accept in their list.
+ *
+ * Every element counts, repeated ids and ids longer than a policy key included.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t PRV_POLICY_FILTER_MAX_IDS = 256U;
+
+/**
+ * \brief The largest bit length of an index that can address an array element.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t PRV_ARRAY_INDEX_MAX_BITS = 63U;
+
+/**
+ * \brief Resolves an integer index constant to a position in an array.
+ *
+ * \param[in] index The integer index constant.
+ * \param[in] count The number of array elements.
+ * \param[out] position On success, the element position.
+ *
+ * \return \c true when \p index is in 0 .. count - 1, \c false otherwise.
+ */
+static bool
+array_position(const cardano_uplc_constant_t* index, size_t count, size_t* position)
+{
+  uint64_t value = 0U;
+
+  if (cardano_uplc_constant_int_is_small(index))
+  {
+    const int64_t small = cardano_uplc_constant_int_small(index);
+
+    if (small < 0)
+    {
+      return false;
+    }
+
+    value = (uint64_t)small;
+  }
+  else
+  {
+    const cardano_bigint_t* big = index->as.integer.big;
+
+    if ((cardano_bigint_signum(big) < 0) || (cardano_bigint_bit_length(big) > PRV_ARRAY_INDEX_MAX_BITS))
+    {
+      return false;
+    }
+
+    value = cardano_bigint_to_unsigned_int(big);
+  }
+
+  if (value >= (uint64_t)count)
+  {
+    return false;
+  }
+
+  *position = (size_t)value;
+
+  return true;
+}
+
+/**
+ * \brief Runs \c multiIndexArray: the array elements at a list of indices.
+ *
+ * The first argument must be an array and the second a list of integer indices.
+ * The result is a list of the array element type holding the element at each
+ * index, in index-list order and keeping repeats. Any index out of bounds, or
+ * more than \ref PRV_MULTI_INDEX_ARRAY_MAX_INDICES indices, is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The array and the index list.
+ * \param[out] out_result On success, the list result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_multi_index_array(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_type_t*            element_type = NULL;
+  const cardano_uplc_constant_t* const* items        = NULL;
+  size_t                                count        = 0U;
+  const cardano_uplc_type_t*            index_type   = NULL;
+  const cardano_uplc_constant_t* const* indices      = NULL;
+  size_t                                index_count  = 0U;
+  const cardano_uplc_constant_t**       selected     = NULL;
+  cardano_uplc_constant_t*              constant     = NULL;
+  cardano_uplc_value_t*                 result       = NULL;
+  size_t                                i            = 0U;
+
+  if (!as_array(args[0], &element_type, &items, &count) || !cardano_uplc_builtin_as_list(args[1], &index_type, &indices, &index_count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((index_type->kind != CARDANO_UPLC_TYPE_INTEGER) || (index_count > PRV_MULTI_INDEX_ARRAY_MAX_INDICES))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  selected = alloc_const_array(arena, index_count);
+
+  if ((index_count > 0U) && (selected == NULL))
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; i < index_count; ++i)
+  {
+    size_t position = 0U;
+
+    if (!array_position(indices[i], count, &position))
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+    }
+
+    selected[i] = items[position];
+  }
+
+  *host_error = cardano_uplc_constant_new_list(arena, element_type, selected, index_count, &constant);
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_value_new_constant(arena, constant, &result);
+  }
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c policies: the policy ids of a value.
+ *
+ * The result is a list of byte strings holding every policy id of the value in
+ * ascending order.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single value argument.
+ * \param[out] out_result On success, the list result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_policies(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_constant_t*  value      = NULL;
+  const cardano_uplc_constant_t** ids        = NULL;
+  cardano_uplc_type_t*            bytestring = NULL;
+  cardano_uplc_constant_t*        constant   = NULL;
+  cardano_uplc_value_t*           result     = NULL;
+  size_t                          i          = 0U;
+
+  if (!as_value_constant(args[0], &value))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  ids = alloc_const_array(arena, value->as.list.count);
+
+  if ((value->as.list.count > 0U) && (ids == NULL))
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; i < value->as.list.count; ++i)
+  {
+    ids[i] = value->as.list.items[i]->as.pair.fst;
+  }
+
+  *host_error = cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_BYTE_STRING, NULL, NULL, &bytestring);
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_constant_new_list(arena, bytestring, ids, value->as.list.count, &constant);
+  }
+
+  if (*host_error == CARDANO_SUCCESS)
+  {
+    *host_error = cardano_uplc_value_new_constant(arena, constant, &result);
+  }
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *out_result = result;
+
+  return CARDANO_UPLC_BUILTIN_OUTCOME_OK;
+}
+
+/**
+ * \brief Runs \c assetCount: the number of (policy, token) entries of a value.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] args The single value argument.
+ * \param[out] out_result On success, the integer result value.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_asset_count(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_constant_t* value = NULL;
+
+  if (!as_value_constant(args[0], &value))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = result_integer_from_int(arena, cardano_uplc_value_token_count(value), out_result);
+
+  return (*host_error == CARDANO_SUCCESS) ? CARDANO_UPLC_BUILTIN_OUTCOME_OK : CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+}
+
+/**
+ * \brief Tests whether a policy id appears in a list of byte-string constants.
+ *
+ * \param[in] ids The byte-string item array.
+ * \param[in] count The number of ids.
+ * \param[in] policy The policy id to look for.
+ *
+ * \return \c true when some id equals \p policy, \c false otherwise.
+ */
+static bool
+policy_listed(const cardano_uplc_constant_t* const* ids, size_t count, cardano_uplc_byte_view_t policy)
+{
+  size_t i = 0U;
+
+  for (i = 0U; i < count; ++i)
+  {
+    const cardano_uplc_byte_view_t id = { ids[i]->as.bytes.data, ids[i]->as.bytes.size };
+
+    if (compare_buffers(id, policy) == 0)
+    {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+/**
+ * \brief Runs \c keepPolicies or \c dropPolicies: filters a value by policy id.
+ *
+ * The first argument must be a list of byte strings and the second a value. With
+ * \p keep set the result holds only the policies the list names, otherwise only
+ * the policies it does not name; every kept policy keeps all its tokens. Ids the
+ * value does not have, and repeated ids, are ignored. A list with more than
+ * \ref PRV_POLICY_FILTER_MAX_IDS ids is a script error.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] keep \c true for \c keepPolicies, \c false for \c dropPolicies.
+ * \param[in] args The policy id list and the value.
+ * \param[out] out_result On success, the value result.
+ * \param[out] host_error Set to a host error on allocation failure.
+ *
+ * \return The script-visible outcome.
+ */
+static cardano_uplc_int_builtin_outcome_t
+body_filter_policies(
+  struct cardano_uplc_arena_t*       arena,
+  bool                               keep,
+  const cardano_uplc_value_t* const* args,
+  const cardano_uplc_value_t**       out_result,
+  cardano_error_t*                   host_error)
+{
+  const cardano_uplc_type_t*            id_type   = NULL;
+  const cardano_uplc_constant_t* const* ids       = NULL;
+  size_t                                id_count  = 0U;
+  const cardano_uplc_constant_t*        value     = NULL;
+  const cardano_uplc_constant_t**       entries   = NULL;
+  size_t                                out_count = 0U;
+  size_t                                i         = 0U;
+
+  if (!cardano_uplc_builtin_as_list(args[0], &id_type, &ids, &id_count) || !as_value_constant(args[1], &value))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  if ((id_type->kind != CARDANO_UPLC_TYPE_BYTE_STRING) || (id_count > PRV_POLICY_FILTER_MAX_IDS))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  entries = alloc_const_array(arena, value->as.list.count);
+
+  if ((value->as.list.count > 0U) && (entries == NULL))
+  {
+    *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  for (i = 0U; i < value->as.list.count; ++i)
+  {
+    const cardano_uplc_constant_t* policy = value->as.list.items[i]->as.pair.fst;
+    const cardano_uplc_byte_view_t view   = { policy->as.bytes.data, policy->as.bytes.size };
+
+    if (policy_listed(ids, id_count, view) == keep)
+    {
+      entries[out_count] = value->as.list.items[i];
+      out_count          += 1U;
+    }
+  }
+
+  return value_result(arena, entries, out_count, out_result, host_error);
+}
+
+/* DISPATCH *****************************************************************/
+
+cardano_uplc_int_builtin_outcome_t
+cardano_uplc_int_builtin_run(
+  struct cardano_uplc_arena_t*        arena,
+  cardano_uplc_step_accumulator_t*    acc,
+  const cardano_uplc_builtin_costs_t* costs,
+  cardano_uplc_builtin_semantics_t    semantics,
+  cardano_uplc_builtin_t              func,
+  const cardano_uplc_value_t* const*  args,
+  size_t                              arg_count,
+  const cardano_uplc_value_t**        out_result,
+  cardano_error_t*                    host_error)
+{
+  if ((arena == NULL) || (acc == NULL) || (costs == NULL) || (out_result == NULL) || (host_error == NULL))
+  {
+    if (host_error != NULL)
+    {
+      *host_error = CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  *host_error = CARDANO_SUCCESS;
+
+  if (!arguments_within_bounds(semantics, func, args, arg_count))
+  {
+    return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+  }
+
+  /*
+   * Each arm spends its cost before its body runs (cost-before-execute). Budget
+   * exhaustion is detected by the caller after the step and takes precedence over
+   * any script error this body returns, so spending first is safe. An unsupported
+   * builtin falls to the default and reports the unsupported outcome WITHOUT
+   * spending. The switch is exhaustive over cardano_uplc_builtin_t so
+   * -Wswitch-enum makes a forgotten builtin a build error.
+   */
+  switch (func)
+  {
+    case CARDANO_UPLC_BUILTIN_ADD_INTEGER:
+    case CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER:
+    case CARDANO_UPLC_BUILTIN_MULTIPLY_INTEGER:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_int_arith(arena, func, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER:
+    case CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER:
+    case CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER:
+    case CARDANO_UPLC_BUILTIN_MOD_INTEGER:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_int_div(arena, func, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_EQUALS_INTEGER:
+    case CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER:
+    case CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_int_compare(arena, func, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_exp_mod_integer(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_APPEND_BYTE_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_append_byte_string(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_cons_byte_string(arena, semantics, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_slice_byte_string(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_LENGTH_OF_BYTE_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_length_of_byte_string(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_INDEX_BYTE_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_index_byte_string(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING:
+    case CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING:
+    case CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_byte_string_compare(arena, func, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_AND_BYTE_STRING:
+    case CARDANO_UPLC_BUILTIN_OR_BYTE_STRING:
+    case CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_logical_byte_string(arena, func, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_COMPLEMENT_BYTE_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_complement_byte_string(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_READ_BIT:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_read_bit(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_WRITE_BITS:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_write_bits(arena, semantics, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_REPLICATE_BYTE:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_replicate_byte(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_SHIFT_BYTE_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_shift_byte_string(arena, semantics, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_ROTATE_BYTE_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_rotate_byte_string(arena, semantics, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_COUNT_SET_BITS:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_count_set_bits(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_FIND_FIRST_SET_BIT:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_find_first_set_bit(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_integer_to_byte_string(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_byte_string_to_integer(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_APPEND_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_append_string(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_EQUALS_STRING:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_equals_string(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_ENCODE_UTF8:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_encode_utf8(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_DECODE_UTF8:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_decode_utf8(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_IF_THEN_ELSE:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_if_then_else(args, out_result);
+    }
+    case CARDANO_UPLC_BUILTIN_CHOOSE_UNIT:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_choose_unit(args, out_result);
+    }
+    case CARDANO_UPLC_BUILTIN_TRACE:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_trace(args, out_result);
+    }
+    case CARDANO_UPLC_BUILTIN_FST_PAIR:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_pair_component(arena, true, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_SND_PAIR:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_pair_component(arena, false, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_CHOOSE_LIST:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_choose_list(args, out_result);
+    }
+    case CARDANO_UPLC_BUILTIN_MK_CONS:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_mk_cons(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_HEAD_LIST:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_head_list(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_TAIL_LIST:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_tail_list(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_NULL_LIST:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_null_list(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_CHOOSE_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_choose_data(args, out_result);
+    }
+    case CARDANO_UPLC_BUILTIN_CONSTR_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_constr_data(arena, semantics, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_MAP_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_map_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_LIST_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_list_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_I_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_i_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_B_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_b_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_UN_CONSTR_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_un_constr_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_UN_MAP_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_un_map_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_UN_LIST_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_un_list_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_UN_I_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_un_i_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_UN_B_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_un_b_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_EQUALS_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_equals_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_MK_PAIR_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_mk_pair_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_MK_NIL_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_mk_nil_data(arena, false, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_MK_NIL_PAIR_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_mk_nil_data(arena, true, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_SERIALISE_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_serialise_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_SHA2_256:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_sha2_256(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLAKE2B_224:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_blake2b(arena, CARDANO_UPLC_BUILTIN_BLAKE2B_224_SIZE, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLAKE2B_256:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_blake2b(arena, CARDANO_UPLC_BUILTIN_BLAKE2B_256_SIZE, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_verify_ed25519(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_SHA3_256:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_sha3_keccak(arena, CARDANO_UPLC_BUILTIN_SHA3_PAD, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_KECCAK_256:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_sha3_keccak(arena, CARDANO_UPLC_BUILTIN_KECCAK_PAD, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_RIPEMD_160:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_ripemd_160(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_VERIFY_ECDSA_SECP256K1_SIGNATURE:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_verify_ecdsa(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_verify_schnorr(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G1_ADD:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g1_add(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G1_NEG:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g1_neg(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G1_SCALAR_MUL:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g1_scalar_mul(arena, semantics, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G1_EQUAL:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g1_equal(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G1_COMPRESS:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g1_compress(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G1_UNCOMPRESS:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g1_uncompress(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G1_HASH_TO_GROUP:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g1_hash_to_group(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G2_ADD:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g2_add(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G2_NEG:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g2_neg(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G2_SCALAR_MUL:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g2_scalar_mul(arena, semantics, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G2_EQUAL:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g2_equal(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G2_COMPRESS:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g2_compress(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G2_UNCOMPRESS:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g2_uncompress(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G2_HASH_TO_GROUP:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_g2_hash_to_group(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_MILLER_LOOP:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_miller_loop(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_MUL_ML_RESULT:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_mul_ml_result(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_FINAL_VERIFY:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_final_verify(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_DROP_LIST:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_drop_list(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_LENGTH_OF_ARRAY:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_length_of_array(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_LIST_TO_ARRAY:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_list_to_array(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_INDEX_ARRAY:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_index_array(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G1_MULTI_SCALAR_MUL:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_multi_scalar_mul(arena, CARDANO_UPLC_TYPE_BLS_G1, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_BLS12_381_G2_MULTI_SCALAR_MUL:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_bls_multi_scalar_mul(arena, CARDANO_UPLC_TYPE_BLS_G2, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_INSERT_COIN:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_insert_coin(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_LOOKUP_COIN:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_lookup_coin(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_UNION_VALUE:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_union_value(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_VALUE_CONTAINS:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_value_contains(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_VALUE_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_value_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_UN_VALUE_DATA:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_un_value_data(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_SCALE_VALUE:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_scale_value(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_multi_index_array(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_POLICIES:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_policies(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_ASSET_COUNT:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_asset_count(arena, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_KEEP_POLICIES:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_filter_policies(arena, true, args, out_result, host_error);
+    }
+    case CARDANO_UPLC_BUILTIN_DROP_POLICIES:
+    {
+      *host_error = spend_builtin_cost(acc, costs, semantics, func, args, arg_count);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR;
+      }
+
+      return body_filter_policies(arena, false, args, out_result, host_error);
+    }
+    default:
+    {
+      return CARDANO_UPLC_BUILTIN_OUTCOME_UNSUPPORTED;
+    }
+  }
+}
+
+cardano_error_t
+cardano_uplc_int_data_list_from_nodes(
+  struct cardano_uplc_arena_t*      arena,
+  const cardano_uplc_data_t* const* nodes,
+  const size_t                      count,
+  cardano_uplc_constant_t**         out)
+{
+  cardano_uplc_type_t*            data_type = NULL;
+  const cardano_uplc_constant_t** items     = NULL;
+  size_t                          i         = 0U;
+  cardano_error_t                 error     = type_data(arena, &data_type);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (count > 0U)
+  {
+    items = (const cardano_uplc_constant_t**)cardano_uplc_arena_alloc(arena, sizeof(*items) * count, 0U);
+
+    if (items == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  for (i = 0U; i < count; ++i)
+  {
+    cardano_uplc_constant_t* constant = NULL;
+
+    error = cardano_uplc_int_constant_new_data_node(arena, nodes[i], &constant);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    items[i] = constant;
+  }
+
+  return cardano_uplc_constant_new_list(arena, data_type, items, count, out);
+}
+
+bool
+cardano_uplc_int_value_entries_are_canonical(
+  struct cardano_uplc_arena_t*          arena,
+  const cardano_uplc_constant_t* const* entries,
+  const size_t                          count)
+{
+  cardano_uplc_byte_view_t prev_policy = { NULL, 0U };
+
+  if ((arena == NULL) || ((entries == NULL) && (count > 0U)))
+  {
+    return false;
+  }
+
+  for (size_t i = 0U; i < count; ++i)
+  {
+    cardano_uplc_byte_view_t              policy     = { NULL, 0U };
+    cardano_uplc_byte_view_t              prev_token = { NULL, 0U };
+    const cardano_uplc_constant_t* const* tokens     = NULL;
+    size_t                                tcount     = 0U;
+
+    if (!value_entry(entries[i], &policy, &tokens, &tcount) || (policy.size > PRV_VALUE_KEY_MAX) || (tcount == 0U))
+    {
+      return false;
+    }
+
+    if ((i > 0U) && (compare_buffers(prev_policy, policy) >= 0))
+    {
+      return false;
+    }
+
+    for (size_t j = 0U; j < tcount; ++j)
+    {
+      cardano_uplc_byte_view_t name   = { NULL, 0U };
+      const cardano_bigint_t*  amount = NULL;
+
+      if (!value_token(arena, tokens[j], &name, &amount) || (name.size > PRV_VALUE_KEY_MAX))
+      {
+        return false;
+      }
+
+      if (cardano_bigint_is_zero(amount) || !amount_in_range(amount))
+      {
+        return false;
+      }
+
+      if ((j > 0U) && (compare_buffers(prev_token, name) >= 0))
+      {
+        return false;
+      }
+
+      prev_token = name;
+    }
+
+    prev_policy = policy;
+  }
+
+  return true;
+}
+
+cardano_error_t
+cardano_uplc_int_value_element_type(struct cardano_uplc_arena_t* arena, const cardano_uplc_type_t** type)
+{
+  cardano_uplc_type_t* bytestring = NULL;
+  cardano_uplc_type_t* integer    = NULL;
+  cardano_uplc_type_t* token      = NULL;
+  cardano_uplc_type_t* tokens     = NULL;
+  cardano_uplc_type_t* policy     = NULL;
+  cardano_error_t      result     = cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_BYTE_STRING, NULL, NULL, &bytestring);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_INTEGER, NULL, NULL, &integer);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_PAIR, bytestring, integer, &token);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_LIST, token, NULL, &tokens);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_PAIR, bytestring, tokens, &policy);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    *type = policy;
+  }
+
+  return result;
+}
diff --git a/vendor/src/uplc/builtins/builtins.h b/vendor/src/uplc/builtins/builtins.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/builtins/builtins.h
@@ -0,0 +1,301 @@
+/**
+ * \file builtins.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_BUILTINS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_BUILTINS_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../cost/uplc_builtin_costs.h"
+#include "../cost/uplc_step_accumulator.h"
+#include "../data/uplc_data.h"
+#include "../machine/uplc_value.h"
+#include "uplc_builtin_outcome.h"
+#include "uplc_builtin_semantics.h"
+#include "uplc_byte_view.h"
+
+#include "../arena/uplc_arena.h"
+#include "uplc_builtin.h"
+#include <cardano/common/bigint.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Runs a saturated builtin: cost-before-execute, then the body.
+ *
+ * Precondition: the builtin is ready, i.e. \p arg_count equals its arity and the
+ * forces it accumulated equal its force count. An implemented builtin first
+ * computes its cpu/mem cost from the ex-mem sizes of \p args
+ * (\ref cardano_uplc_builtin_cost), spends that cost on \p acc, and only then
+ * runs its body; this ordering is observable: the cost is spent before the body
+ * is called. An unimplemented builtin spends nothing and returns
+ * \ref CARDANO_UPLC_BUILTIN_OUTCOME_UNSUPPORTED (its case is skipped, so leaving
+ * the budget untouched cannot corrupt the run).
+ *
+ * Before any cost is spent, the arguments are checked against the bounds the
+ * semantics variant applies: under D and E an integer argument of the integer
+ * arithmetic and ordering builtins (and the byte of \c consByteString) outside
+ * -(2^262143) .. 2^262143 - 1, and under D, E, F and G a byte-string argument
+ * longer than 65536 bytes, is a script error with nothing spent.
+ *
+ * The dispatch is an exhaustive switch over \ref cardano_uplc_builtin_t; every
+ * arm currently returns the unsupported outcome. As bodies land they replace
+ * their arm with compute-cost, spend, run.
+ *
+ * \param[in] arena The arena every result value is allocated from. Must not be NULL.
+ * \param[in,out] acc The step accumulator the builtin cost is spent on. Must not
+ *            be NULL.
+ * \param[in] costs The per-builtin costing functions. Must not be NULL.
+ * \param[in] semantics The builtin semantics variant selecting the string ex-mem
+ *            measure, the argument bounds and the body's range-check behaviour.
+ * \param[in] func The saturated builtin to run.
+ * \param[in] args The saturated argument values, in application order. May be NULL
+ *            only when \p arg_count is 0.
+ * \param[in] arg_count The number of arguments applied.
+ * \param[out] out_result On \ref CARDANO_UPLC_BUILTIN_OUTCOME_OK, the result value;
+ *             left untouched otherwise.
+ * \param[out] host_error On a host failure (allocation), the error code; set to
+ *             \ref CARDANO_SUCCESS otherwise.
+ *
+ * \return The script-visible outcome of the run.
+ */
+cardano_uplc_int_builtin_outcome_t
+cardano_uplc_int_builtin_run(
+  struct cardano_uplc_arena_t*        arena,
+  cardano_uplc_step_accumulator_t*    acc,
+  const cardano_uplc_builtin_costs_t* costs,
+  cardano_uplc_builtin_semantics_t    semantics,
+  cardano_uplc_builtin_t              func,
+  const cardano_uplc_value_t* const*  args,
+  size_t                              arg_count,
+  const cardano_uplc_value_t**        out_result,
+  cardano_error_t*                    host_error);
+
+/* ARGUMENT-UNWRAP HELPERS **************************************************/
+
+/**
+ * \brief Reads the integer payload of a constant value.
+ *
+ * The value must be a constant of integer kind. Any other value (a non-constant,
+ * or a constant of a different kind) is a type mismatch, a Plutus script error.
+ *
+ * \param[in] value The value to unwrap. Must not be NULL.
+ * \param[out] out On success, set to the borrowed bigint; left untouched on a
+ *             mismatch.
+ *
+ * The machine stores a small integer inline as an \c int64_t with no
+ * \ref cardano_bigint_t allocated, so this accessor reports a mismatch for such a
+ * value unless a bigint view has already been materialized for it. The builtin
+ * bodies read integers through the internal inline-aware path instead; this entry
+ * remains for callers that already hold a bigint-backed integer constant.
+ *
+ * \return \c true on success, \c false on a type mismatch (script error) or when the
+ *         value is a small integer with no materialized bigint.
+ */
+bool
+cardano_uplc_builtin_as_integer(const cardano_uplc_value_t* value, const cardano_bigint_t** out);
+
+/**
+ * \brief Reads the byte-string payload of a constant value as an arena byte view.
+ *
+ * A non-byte-string value is a type mismatch (script error). The view borrows
+ * the constant's arena bytes.
+ *
+ * \param[in] value The value to unwrap. Must not be NULL.
+ * \param[out] out On success, set to the borrowed \c (data, size) view; left
+ *             untouched on a mismatch.
+ *
+ * \return \c true on success, \c false on a type mismatch (script error).
+ */
+bool
+cardano_uplc_builtin_as_byte_string(const cardano_uplc_value_t* value, cardano_uplc_byte_view_t* out);
+
+/**
+ * \brief Reads the text-string payload of a constant value as an arena byte view.
+ *
+ * A non-string value is a type mismatch (script error). The view borrows the
+ * constant's arena bytes.
+ *
+ * \param[in] value The value to unwrap. Must not be NULL.
+ * \param[out] out On success, set to the borrowed \c (data, size) view; left
+ *             untouched on a mismatch.
+ *
+ * \return \c true on success, \c false on a type mismatch (script error).
+ */
+bool
+cardano_uplc_builtin_as_string(const cardano_uplc_value_t* value, cardano_uplc_byte_view_t* out);
+
+/**
+ * \brief Reads the boolean payload of a constant value.
+ *
+ * A non-boolean value is a type mismatch (script error).
+ *
+ * \param[in] value The value to unwrap. Must not be NULL.
+ * \param[out] out On success, set to the boolean; left untouched on a mismatch.
+ *
+ * \return \c true on success, \c false on a type mismatch (script error).
+ */
+bool
+cardano_uplc_builtin_as_bool(const cardano_uplc_value_t* value, bool* out);
+
+/**
+ * \brief Reads the unit payload of a constant value.
+ *
+ * A non-unit value is a type mismatch (script error). There is no payload;
+ * success is the only information returned.
+ *
+ * \param[in] value The value to unwrap. Must not be NULL.
+ *
+ * \return \c true on success, \c false on a type mismatch (script error).
+ */
+bool
+cardano_uplc_builtin_as_unit(const cardano_uplc_value_t* value);
+
+/**
+ * \brief Reads the arena Plutus-data payload of a constant value.
+ *
+ * A non-data value is a type mismatch (script error).
+ *
+ * \param[in] value The value to unwrap. Must not be NULL.
+ * \param[out] out On success, set to the borrowed arena data node; left untouched on
+ *             a mismatch.
+ *
+ * \return \c true on success, \c false on a type mismatch (script error).
+ */
+bool
+cardano_uplc_builtin_as_data(const cardano_uplc_value_t* value, const cardano_uplc_data_t** out);
+
+/**
+ * \brief Reads the list payload of a constant value.
+ *
+ * The value must be a constant of list kind. A non-list value is a list type
+ * mismatch (script error). The element type and the item array are borrowed from
+ * the constant.
+ *
+ * \param[in] value The value to unwrap. Must not be NULL.
+ * \param[out] element_type On success, the borrowed element type; left untouched
+ *             on a mismatch. May be NULL if the caller does not need it.
+ * \param[out] items On success, the borrowed item array (NULL when \p count is 0);
+ *             left untouched on a mismatch. May be NULL if not needed.
+ * \param[out] count On success, the number of items; left untouched on a mismatch.
+ *             May be NULL if not needed.
+ *
+ * \return \c true on success, \c false on a type mismatch (script error).
+ */
+bool
+cardano_uplc_builtin_as_list(
+  const cardano_uplc_value_t* value,
+  const cardano_uplc_type_t** element_type,
+  // cppcheck-suppress misra-c2012-18.5; Reason: pointer nesting required by the API shape
+  const cardano_uplc_constant_t* const** items,
+  size_t*                                count);
+
+/**
+ * \brief Reads the pair payload of a constant value.
+ *
+ * The value must be a constant of pair kind. A non-pair value is a pair type
+ * mismatch (script error). Both components are borrowed from the constant.
+ *
+ * \param[in] value The value to unwrap. Must not be NULL.
+ * \param[out] fst On success, the borrowed first component; left untouched on a
+ *             mismatch. May be NULL if not needed.
+ * \param[out] snd On success, the borrowed second component; left untouched on a
+ *             mismatch. May be NULL if not needed.
+ *
+ * \return \c true on success, \c false on a type mismatch (script error).
+ */
+bool
+cardano_uplc_builtin_as_pair(
+  const cardano_uplc_value_t*     value,
+  const cardano_uplc_constant_t** fst,
+  const cardano_uplc_constant_t** snd);
+
+/* DATA HELPERS *************************************************************/
+
+/**
+ * \brief Builds a proto-list of data constants from an arena data node array.
+ *
+ * Each data node is wrapped in a fresh data constant; the result is a list constant
+ * carrying element type \c data. Used by the deconstructors that surface a Data List
+ * or the fields of a Data Constr, and by \c case on a Data Constr to bind its fields.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] nodes The data nodes to expose, or NULL when \p count is 0.
+ * \param[in] count The number of nodes.
+ * \param[out] out On success, the list constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success or a propagated allocation error.
+ */
+cardano_error_t
+cardano_uplc_int_data_list_from_nodes(
+  struct cardano_uplc_arena_t*      arena,
+  const cardano_uplc_data_t* const* nodes,
+  size_t                            count,
+  cardano_uplc_constant_t**         out);
+
+/* VALUE HELPERS ************************************************************/
+
+/**
+ * \brief Tests whether a policy-entry list is in the canonical form of a value.
+ *
+ * Each entry must be a pair of a byte-string policy and a list of (byte-string
+ * token, integer amount) pairs. The list is canonical when policies are strictly
+ * ascending, every token list is non-empty and strictly ascending, every key is at
+ * most 32 bytes, and every amount is non-zero and within -(2^127) .. 2^127 - 1.
+ * These are the invariants the value builtins maintain and the ones the reference
+ * enforces when it deserializes a value.
+ *
+ * \param[in] arena The arena an inline amount is materialized through. Must not
+ *            be NULL.
+ * \param[in] entries The policy entries, or NULL when \p count is 0.
+ * \param[in] count The number of policy entries.
+ *
+ * \return \c true when the entries are canonical, \c false when they are not, when
+ *         an argument is invalid or when an amount cannot be materialized.
+ */
+bool
+cardano_uplc_int_value_entries_are_canonical(
+  struct cardano_uplc_arena_t*          arena,
+  const cardano_uplc_constant_t* const* entries,
+  size_t                                count);
+
+/**
+ * \brief Builds the value element type <tt>pair(bytestring, list(pair(bytestring, integer)))</tt>.
+ *
+ * \param[in] arena The arena every descriptor node is allocated from.
+ * \param[out] type On success, the element type descriptor.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a propagated allocation error.
+ */
+cardano_error_t
+cardano_uplc_int_value_element_type(struct cardano_uplc_arena_t* arena, const cardano_uplc_type_t** type);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_BUILTINS_H */
diff --git a/vendor/src/uplc/builtins/uplc_builtin.c b/vendor/src/uplc/builtins/uplc_builtin.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/builtins/uplc_builtin.c
@@ -0,0 +1,411 @@
+/**
+ * \file uplc_builtin.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_builtin.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* CONSTANTS *****************************************************************/
+
+/*
+ * The builtin flat tags are the 7-bit identifiers assigned to each default
+ * function in the UPLC binary encoding. Tags 88..100 cover the array, BLS
+ * multi-scalar-multiplication, and multi-asset value builtins: dropList 88,
+ * lengthOfArray 89, listToArray 90, indexArray 91, bls12_381_G1_multiScalarMul
+ * 92, bls12_381_G2_multiScalarMul 93, insertCoin 94, lookupCoin 95, unionValue
+ * 96, valueContains 97, valueData 98, unValueData 99, scaleValue 100. Tags
+ * 101..105 cover the batch 7 builtins: multiIndexArray 101, policies 102,
+ * assetCount 103, keepPolicies 104, dropPolicies 105. The total number of
+ * builtins is 106 (tags 0..105).
+ *
+ * The tables below record, for each builtin, its tag (the enumerator order), its
+ * arity (the number of value arguments it saturates on), its force count (the
+ * number of type arguments it takes before its value arguments), and the first
+ * language version in which it is available. The builtins on tags 88..105 are
+ * labelled CARDANO_UPLC_LANG_VERSION_V4, the module-local label for the batches
+ * of builtins introduced after PlutusV3.
+ */
+
+/**
+ * \brief Arity of every builtin, indexed by \ref cardano_uplc_builtin_t.
+ *
+ * The number of value arguments each builtin saturates on before its body runs.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t BUILTIN_ARITY[CARDANO_UPLC_BUILTIN_COUNT] = {
+  [CARDANO_UPLC_BUILTIN_ADD_INTEGER]                        = 2U,
+  [CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER]                   = 2U,
+  [CARDANO_UPLC_BUILTIN_MULTIPLY_INTEGER]                   = 2U,
+  [CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER]                     = 2U,
+  [CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER]                   = 2U,
+  [CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER]                  = 2U,
+  [CARDANO_UPLC_BUILTIN_MOD_INTEGER]                        = 2U,
+  [CARDANO_UPLC_BUILTIN_EQUALS_INTEGER]                     = 2U,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER]                  = 2U,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER]           = 2U,
+  [CARDANO_UPLC_BUILTIN_APPEND_BYTE_STRING]                 = 2U,
+  [CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING]                   = 2U,
+  [CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING]                  = 3U,
+  [CARDANO_UPLC_BUILTIN_LENGTH_OF_BYTE_STRING]              = 1U,
+  [CARDANO_UPLC_BUILTIN_INDEX_BYTE_STRING]                  = 2U,
+  [CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING]                 = 2U,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING]              = 2U,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING]       = 2U,
+  [CARDANO_UPLC_BUILTIN_SHA2_256]                           = 1U,
+  [CARDANO_UPLC_BUILTIN_SHA3_256]                           = 1U,
+  [CARDANO_UPLC_BUILTIN_BLAKE2B_256]                        = 1U,
+  [CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE]           = 3U,
+  [CARDANO_UPLC_BUILTIN_APPEND_STRING]                      = 2U,
+  [CARDANO_UPLC_BUILTIN_EQUALS_STRING]                      = 2U,
+  [CARDANO_UPLC_BUILTIN_ENCODE_UTF8]                        = 1U,
+  [CARDANO_UPLC_BUILTIN_DECODE_UTF8]                        = 1U,
+  [CARDANO_UPLC_BUILTIN_IF_THEN_ELSE]                       = 3U,
+  [CARDANO_UPLC_BUILTIN_CHOOSE_UNIT]                        = 2U,
+  [CARDANO_UPLC_BUILTIN_TRACE]                              = 2U,
+  [CARDANO_UPLC_BUILTIN_FST_PAIR]                           = 1U,
+  [CARDANO_UPLC_BUILTIN_SND_PAIR]                           = 1U,
+  [CARDANO_UPLC_BUILTIN_CHOOSE_LIST]                        = 3U,
+  [CARDANO_UPLC_BUILTIN_MK_CONS]                            = 2U,
+  [CARDANO_UPLC_BUILTIN_HEAD_LIST]                          = 1U,
+  [CARDANO_UPLC_BUILTIN_TAIL_LIST]                          = 1U,
+  [CARDANO_UPLC_BUILTIN_NULL_LIST]                          = 1U,
+  [CARDANO_UPLC_BUILTIN_CHOOSE_DATA]                        = 6U,
+  [CARDANO_UPLC_BUILTIN_CONSTR_DATA]                        = 2U,
+  [CARDANO_UPLC_BUILTIN_MAP_DATA]                           = 1U,
+  [CARDANO_UPLC_BUILTIN_LIST_DATA]                          = 1U,
+  [CARDANO_UPLC_BUILTIN_I_DATA]                             = 1U,
+  [CARDANO_UPLC_BUILTIN_B_DATA]                             = 1U,
+  [CARDANO_UPLC_BUILTIN_UN_CONSTR_DATA]                     = 1U,
+  [CARDANO_UPLC_BUILTIN_UN_MAP_DATA]                        = 1U,
+  [CARDANO_UPLC_BUILTIN_UN_LIST_DATA]                       = 1U,
+  [CARDANO_UPLC_BUILTIN_UN_I_DATA]                          = 1U,
+  [CARDANO_UPLC_BUILTIN_UN_B_DATA]                          = 1U,
+  [CARDANO_UPLC_BUILTIN_EQUALS_DATA]                        = 2U,
+  [CARDANO_UPLC_BUILTIN_MK_PAIR_DATA]                       = 2U,
+  [CARDANO_UPLC_BUILTIN_MK_NIL_DATA]                        = 1U,
+  [CARDANO_UPLC_BUILTIN_MK_NIL_PAIR_DATA]                   = 1U,
+  [CARDANO_UPLC_BUILTIN_SERIALISE_DATA]                     = 1U,
+  [CARDANO_UPLC_BUILTIN_VERIFY_ECDSA_SECP256K1_SIGNATURE]   = 3U,
+  [CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE] = 3U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_ADD]                   = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_NEG]                   = 1U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_SCALAR_MUL]            = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_EQUAL]                 = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_COMPRESS]              = 1U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_UNCOMPRESS]            = 1U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_HASH_TO_GROUP]         = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_ADD]                   = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_NEG]                   = 1U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_SCALAR_MUL]            = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_EQUAL]                 = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_COMPRESS]              = 1U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_UNCOMPRESS]            = 1U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_HASH_TO_GROUP]         = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_MILLER_LOOP]              = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_MUL_ML_RESULT]            = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_FINAL_VERIFY]             = 2U,
+  [CARDANO_UPLC_BUILTIN_KECCAK_256]                         = 1U,
+  [CARDANO_UPLC_BUILTIN_BLAKE2B_224]                        = 1U,
+  [CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING]             = 3U,
+  [CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER]             = 2U,
+  [CARDANO_UPLC_BUILTIN_AND_BYTE_STRING]                    = 3U,
+  [CARDANO_UPLC_BUILTIN_OR_BYTE_STRING]                     = 3U,
+  [CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING]                    = 3U,
+  [CARDANO_UPLC_BUILTIN_COMPLEMENT_BYTE_STRING]             = 1U,
+  [CARDANO_UPLC_BUILTIN_READ_BIT]                           = 2U,
+  [CARDANO_UPLC_BUILTIN_WRITE_BITS]                         = 3U,
+  [CARDANO_UPLC_BUILTIN_REPLICATE_BYTE]                     = 2U,
+  [CARDANO_UPLC_BUILTIN_SHIFT_BYTE_STRING]                  = 2U,
+  [CARDANO_UPLC_BUILTIN_ROTATE_BYTE_STRING]                 = 2U,
+  [CARDANO_UPLC_BUILTIN_COUNT_SET_BITS]                     = 1U,
+  [CARDANO_UPLC_BUILTIN_FIND_FIRST_SET_BIT]                 = 1U,
+  [CARDANO_UPLC_BUILTIN_RIPEMD_160]                         = 1U,
+  [CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER]                    = 3U,
+  [CARDANO_UPLC_BUILTIN_DROP_LIST]                          = 2U,
+  [CARDANO_UPLC_BUILTIN_LENGTH_OF_ARRAY]                    = 1U,
+  [CARDANO_UPLC_BUILTIN_LIST_TO_ARRAY]                      = 1U,
+  [CARDANO_UPLC_BUILTIN_INDEX_ARRAY]                        = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_MULTI_SCALAR_MUL]      = 2U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_MULTI_SCALAR_MUL]      = 2U,
+  [CARDANO_UPLC_BUILTIN_INSERT_COIN]                        = 4U,
+  [CARDANO_UPLC_BUILTIN_LOOKUP_COIN]                        = 3U,
+  [CARDANO_UPLC_BUILTIN_UNION_VALUE]                        = 2U,
+  [CARDANO_UPLC_BUILTIN_VALUE_CONTAINS]                     = 2U,
+  [CARDANO_UPLC_BUILTIN_VALUE_DATA]                         = 1U,
+  [CARDANO_UPLC_BUILTIN_UN_VALUE_DATA]                      = 1U,
+  [CARDANO_UPLC_BUILTIN_SCALE_VALUE]                        = 2U,
+  [CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY]                  = 2U,
+  [CARDANO_UPLC_BUILTIN_POLICIES]                           = 1U,
+  [CARDANO_UPLC_BUILTIN_ASSET_COUNT]                        = 1U,
+  [CARDANO_UPLC_BUILTIN_KEEP_POLICIES]                      = 2U,
+  [CARDANO_UPLC_BUILTIN_DROP_POLICIES]                      = 2U
+};
+
+/**
+ * \brief Force count of every builtin, indexed by \ref cardano_uplc_builtin_t.
+ *
+ * The number of type arguments (forces) each builtin takes before its value
+ * arguments. The V4 builtins that are polymorphic in their element type take one
+ * force (dropList, lengthOfArray, listToArray, indexArray, multiIndexArray); the
+ * value/coin and multi-scalar-mul builtins are monomorphic and take none.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t BUILTIN_FORCE_COUNT[CARDANO_UPLC_BUILTIN_COUNT] = {
+  [CARDANO_UPLC_BUILTIN_ADD_INTEGER]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER]                   = 0U,
+  [CARDANO_UPLC_BUILTIN_MULTIPLY_INTEGER]                   = 0U,
+  [CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER]                     = 0U,
+  [CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER]                   = 0U,
+  [CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER]                  = 0U,
+  [CARDANO_UPLC_BUILTIN_MOD_INTEGER]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_EQUALS_INTEGER]                     = 0U,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER]                  = 0U,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER]           = 0U,
+  [CARDANO_UPLC_BUILTIN_APPEND_BYTE_STRING]                 = 0U,
+  [CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING]                   = 0U,
+  [CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING]                  = 0U,
+  [CARDANO_UPLC_BUILTIN_LENGTH_OF_BYTE_STRING]              = 0U,
+  [CARDANO_UPLC_BUILTIN_INDEX_BYTE_STRING]                  = 0U,
+  [CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING]                 = 0U,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING]              = 0U,
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING]       = 0U,
+  [CARDANO_UPLC_BUILTIN_SHA2_256]                           = 0U,
+  [CARDANO_UPLC_BUILTIN_SHA3_256]                           = 0U,
+  [CARDANO_UPLC_BUILTIN_BLAKE2B_256]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE]           = 0U,
+  [CARDANO_UPLC_BUILTIN_APPEND_STRING]                      = 0U,
+  [CARDANO_UPLC_BUILTIN_EQUALS_STRING]                      = 0U,
+  [CARDANO_UPLC_BUILTIN_ENCODE_UTF8]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_DECODE_UTF8]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_IF_THEN_ELSE]                       = 1U,
+  [CARDANO_UPLC_BUILTIN_CHOOSE_UNIT]                        = 1U,
+  [CARDANO_UPLC_BUILTIN_TRACE]                              = 1U,
+  [CARDANO_UPLC_BUILTIN_FST_PAIR]                           = 2U,
+  [CARDANO_UPLC_BUILTIN_SND_PAIR]                           = 2U,
+  [CARDANO_UPLC_BUILTIN_CHOOSE_LIST]                        = 2U,
+  [CARDANO_UPLC_BUILTIN_MK_CONS]                            = 1U,
+  [CARDANO_UPLC_BUILTIN_HEAD_LIST]                          = 1U,
+  [CARDANO_UPLC_BUILTIN_TAIL_LIST]                          = 1U,
+  [CARDANO_UPLC_BUILTIN_NULL_LIST]                          = 1U,
+  [CARDANO_UPLC_BUILTIN_CHOOSE_DATA]                        = 1U,
+  [CARDANO_UPLC_BUILTIN_CONSTR_DATA]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_MAP_DATA]                           = 0U,
+  [CARDANO_UPLC_BUILTIN_LIST_DATA]                          = 0U,
+  [CARDANO_UPLC_BUILTIN_I_DATA]                             = 0U,
+  [CARDANO_UPLC_BUILTIN_B_DATA]                             = 0U,
+  [CARDANO_UPLC_BUILTIN_UN_CONSTR_DATA]                     = 0U,
+  [CARDANO_UPLC_BUILTIN_UN_MAP_DATA]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_UN_LIST_DATA]                       = 0U,
+  [CARDANO_UPLC_BUILTIN_UN_I_DATA]                          = 0U,
+  [CARDANO_UPLC_BUILTIN_UN_B_DATA]                          = 0U,
+  [CARDANO_UPLC_BUILTIN_EQUALS_DATA]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_MK_PAIR_DATA]                       = 0U,
+  [CARDANO_UPLC_BUILTIN_MK_NIL_DATA]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_MK_NIL_PAIR_DATA]                   = 0U,
+  [CARDANO_UPLC_BUILTIN_SERIALISE_DATA]                     = 0U,
+  [CARDANO_UPLC_BUILTIN_VERIFY_ECDSA_SECP256K1_SIGNATURE]   = 0U,
+  [CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE] = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_ADD]                   = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_NEG]                   = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_SCALAR_MUL]            = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_EQUAL]                 = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_COMPRESS]              = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_UNCOMPRESS]            = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_HASH_TO_GROUP]         = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_ADD]                   = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_NEG]                   = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_SCALAR_MUL]            = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_EQUAL]                 = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_COMPRESS]              = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_UNCOMPRESS]            = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_HASH_TO_GROUP]         = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_MILLER_LOOP]              = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_MUL_ML_RESULT]            = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_FINAL_VERIFY]             = 0U,
+  [CARDANO_UPLC_BUILTIN_KECCAK_256]                         = 0U,
+  [CARDANO_UPLC_BUILTIN_BLAKE2B_224]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING]             = 0U,
+  [CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER]             = 0U,
+  [CARDANO_UPLC_BUILTIN_AND_BYTE_STRING]                    = 0U,
+  [CARDANO_UPLC_BUILTIN_OR_BYTE_STRING]                     = 0U,
+  [CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING]                    = 0U,
+  [CARDANO_UPLC_BUILTIN_COMPLEMENT_BYTE_STRING]             = 0U,
+  [CARDANO_UPLC_BUILTIN_READ_BIT]                           = 0U,
+  [CARDANO_UPLC_BUILTIN_WRITE_BITS]                         = 0U,
+  [CARDANO_UPLC_BUILTIN_REPLICATE_BYTE]                     = 0U,
+  [CARDANO_UPLC_BUILTIN_SHIFT_BYTE_STRING]                  = 0U,
+  [CARDANO_UPLC_BUILTIN_ROTATE_BYTE_STRING]                 = 0U,
+  [CARDANO_UPLC_BUILTIN_COUNT_SET_BITS]                     = 0U,
+  [CARDANO_UPLC_BUILTIN_FIND_FIRST_SET_BIT]                 = 0U,
+  [CARDANO_UPLC_BUILTIN_RIPEMD_160]                         = 0U,
+  [CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER]                    = 0U,
+  [CARDANO_UPLC_BUILTIN_DROP_LIST]                          = 1U,
+  [CARDANO_UPLC_BUILTIN_LENGTH_OF_ARRAY]                    = 1U,
+  [CARDANO_UPLC_BUILTIN_LIST_TO_ARRAY]                      = 1U,
+  [CARDANO_UPLC_BUILTIN_INDEX_ARRAY]                        = 1U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_MULTI_SCALAR_MUL]      = 0U,
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_MULTI_SCALAR_MUL]      = 0U,
+  [CARDANO_UPLC_BUILTIN_INSERT_COIN]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_LOOKUP_COIN]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_UNION_VALUE]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_VALUE_CONTAINS]                     = 0U,
+  [CARDANO_UPLC_BUILTIN_VALUE_DATA]                         = 0U,
+  [CARDANO_UPLC_BUILTIN_UN_VALUE_DATA]                      = 0U,
+  [CARDANO_UPLC_BUILTIN_SCALE_VALUE]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY]                  = 1U,
+  [CARDANO_UPLC_BUILTIN_POLICIES]                           = 0U,
+  [CARDANO_UPLC_BUILTIN_ASSET_COUNT]                        = 0U,
+  [CARDANO_UPLC_BUILTIN_KEEP_POLICIES]                      = 0U,
+  [CARDANO_UPLC_BUILTIN_DROP_POLICIES]                      = 0U
+};
+
+/**
+ * \brief The number of Plutus languages a builtin batch is introduced in, V1 through V4.
+ */
+enum
+{
+  BUILTIN_LANGUAGE_COUNT = 4
+};
+
+/**
+ * \brief The number of builtin release batches.
+ */
+enum
+{
+  BUILTIN_BATCH_COUNT = 8
+};
+
+/**
+ * \brief A release batch of builtins and the protocol major version that
+ *        introduces it in each Plutus language.
+ *
+ * The builtin tags are assigned in introduction order, so each batch is the
+ * contiguous tag range ending at \c last_tag and starting after the previous
+ * batch.
+ */
+typedef struct
+{
+    size_t   last_tag;
+    uint64_t introduced_in[BUILTIN_LANGUAGE_COUNT];
+} builtin_batch_t;
+
+/**
+ * \brief The ledger's \c builtinsIntroducedIn schedule
+ *        (plutus-ledger-api/src/PlutusLedgerApi/Common/Versions.hs), one row per
+ *        batch, with the introduction protocol for V1, V2, V3 and V4.
+ *
+ * The batches are: 1, the Alonzo builtins (tags 0..50); 2, serialiseData (51);
+ * 3, the secp256k1 signature checks (52..53); 4a, BLS12-381, keccak_256 and
+ * blake2b_224 (54..72); 4b, integerToByteString and byteStringToInteger
+ * (73..74); 5, the bitwise builtins and ripemd_160 (75..86); 6, expModInteger and
+ * the array, multi-scalar-multiplication and value builtins (87..100); and 7,
+ * multiIndexArray, policies, assetCount, keepPolicies and dropPolicies
+ * (101..105).
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const builtin_batch_t BUILTIN_BATCHES[BUILTIN_BATCH_COUNT] = {
+  { 50U, { 5U, 7U, 9U, 12U } },
+  { 51U, { 11U, 7U, 9U, 12U } },
+  { 53U, { 11U, 8U, 9U, 12U } },
+  { 72U, { 11U, 11U, 9U, 12U } },
+  { 74U, { 11U, 10U, 9U, 12U } },
+  { 86U, { 11U, 11U, 10U, 12U } },
+  { 100U, { 11U, 11U, 11U, 12U } },
+  { 105U, { 12U, 12U, 12U, 12U } }
+};
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Reports whether a builtin tag is in the valid range.
+ *
+ * \param[in] builtin The builtin tag to check.
+ *
+ * \return Nonzero if \p builtin is in 0 .. CARDANO_UPLC_BUILTIN_COUNT - 1, zero
+ *         otherwise.
+ */
+static int
+is_valid_builtin(const cardano_uplc_builtin_t builtin)
+{
+  return ((int)builtin >= 0) && ((size_t)builtin < (size_t)CARDANO_UPLC_BUILTIN_COUNT);
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_builtin_arity(const cardano_uplc_builtin_t builtin, size_t* arity)
+{
+  if (arity == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (!is_valid_builtin(builtin))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *arity = (size_t)BUILTIN_ARITY[(size_t)builtin];
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_builtin_force_count(const cardano_uplc_builtin_t builtin, size_t* force_count)
+{
+  if (force_count == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (!is_valid_builtin(builtin))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *force_count = (size_t)BUILTIN_FORCE_COUNT[(size_t)builtin];
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_uplc_builtin_available(
+  const cardano_uplc_builtin_t      builtin,
+  const cardano_uplc_lang_version_t language,
+  const uint64_t                    protocol_major)
+{
+  size_t batch = 0U;
+
+  if (!is_valid_builtin(builtin) || ((int)language < 0) || ((size_t)language >= (size_t)BUILTIN_LANGUAGE_COUNT))
+  {
+    return false;
+  }
+
+  while ((size_t)builtin > BUILTIN_BATCHES[batch].last_tag)
+  {
+    ++batch;
+  }
+
+  return protocol_major >= BUILTIN_BATCHES[batch].introduced_in[(size_t)language];
+}
diff --git a/vendor/src/uplc/builtins/uplc_builtin.h b/vendor/src/uplc/builtins/uplc_builtin.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/builtins/uplc_builtin.h
@@ -0,0 +1,272 @@
+/**
+ * \file uplc_builtin.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BUILTIN_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BUILTIN_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_lang_version.h"
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Untyped Plutus Core default (builtin) functions, identified by
+ *        their flat-encoding tag.
+ *
+ * Each enumerator value is the integer the flat decoder reads for that builtin,
+ * so the enum is the authoritative tag list the decoder and the CEK machine
+ * switch on. Each tag is the explicit 7-bit number the flat encoding assigns to
+ * that builtin; it is consensus-critical, since a wrong number silently
+ * misdecodes on-chain scripts.
+ *
+ * Tags 0..87 cover the V1-V3 builtins. Tags 88..100 cover the post-V3 ("V4")
+ * builtins: the array operations, the BLS12-381 multi-scalar multiplications, and
+ * the value/coin operations. The V4 builtins became available at the van Rossem
+ * hard fork. Tags 101..105 cover the batch 7 builtins, available in every
+ * language from protocol version 12 (Dijkstra): multiIndexArray, policies,
+ * assetCount, keepPolicies and dropPolicies.
+ */
+typedef enum
+{
+  /* Integer functions (V1) */
+  CARDANO_UPLC_BUILTIN_ADD_INTEGER              = 0,
+  CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER         = 1,
+  CARDANO_UPLC_BUILTIN_MULTIPLY_INTEGER         = 2,
+  CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER           = 3,
+  CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER         = 4,
+  CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER        = 5,
+  CARDANO_UPLC_BUILTIN_MOD_INTEGER              = 6,
+  CARDANO_UPLC_BUILTIN_EQUALS_INTEGER           = 7,
+  CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER        = 8,
+  CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER = 9,
+
+  /* ByteString functions (V1) */
+  CARDANO_UPLC_BUILTIN_APPEND_BYTE_STRING           = 10,
+  CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING             = 11,
+  CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING            = 12,
+  CARDANO_UPLC_BUILTIN_LENGTH_OF_BYTE_STRING        = 13,
+  CARDANO_UPLC_BUILTIN_INDEX_BYTE_STRING            = 14,
+  CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING           = 15,
+  CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING        = 16,
+  CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING = 17,
+
+  /* Cryptography and hash functions (V1) */
+  CARDANO_UPLC_BUILTIN_SHA2_256                 = 18,
+  CARDANO_UPLC_BUILTIN_SHA3_256                 = 19,
+  CARDANO_UPLC_BUILTIN_BLAKE2B_256              = 20,
+  CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE = 21,
+
+  /* String functions (V1) */
+  CARDANO_UPLC_BUILTIN_APPEND_STRING = 22,
+  CARDANO_UPLC_BUILTIN_EQUALS_STRING = 23,
+  CARDANO_UPLC_BUILTIN_ENCODE_UTF8   = 24,
+  CARDANO_UPLC_BUILTIN_DECODE_UTF8   = 25,
+
+  /* Bool function (V1) */
+  CARDANO_UPLC_BUILTIN_IF_THEN_ELSE = 26,
+
+  /* Unit function (V1) */
+  CARDANO_UPLC_BUILTIN_CHOOSE_UNIT = 27,
+
+  /* Tracing function (V1) */
+  CARDANO_UPLC_BUILTIN_TRACE = 28,
+
+  /* Pair functions (V1) */
+  CARDANO_UPLC_BUILTIN_FST_PAIR = 29,
+  CARDANO_UPLC_BUILTIN_SND_PAIR = 30,
+
+  /* List functions (V1) */
+  CARDANO_UPLC_BUILTIN_CHOOSE_LIST = 31,
+  CARDANO_UPLC_BUILTIN_MK_CONS     = 32,
+  CARDANO_UPLC_BUILTIN_HEAD_LIST   = 33,
+  CARDANO_UPLC_BUILTIN_TAIL_LIST   = 34,
+  CARDANO_UPLC_BUILTIN_NULL_LIST   = 35,
+
+  /* Data functions (V1) */
+  CARDANO_UPLC_BUILTIN_CHOOSE_DATA    = 36,
+  CARDANO_UPLC_BUILTIN_CONSTR_DATA    = 37,
+  CARDANO_UPLC_BUILTIN_MAP_DATA       = 38,
+  CARDANO_UPLC_BUILTIN_LIST_DATA      = 39,
+  CARDANO_UPLC_BUILTIN_I_DATA         = 40,
+  CARDANO_UPLC_BUILTIN_B_DATA         = 41,
+  CARDANO_UPLC_BUILTIN_UN_CONSTR_DATA = 42,
+  CARDANO_UPLC_BUILTIN_UN_MAP_DATA    = 43,
+  CARDANO_UPLC_BUILTIN_UN_LIST_DATA   = 44,
+  CARDANO_UPLC_BUILTIN_UN_I_DATA      = 45,
+  CARDANO_UPLC_BUILTIN_UN_B_DATA      = 46,
+  CARDANO_UPLC_BUILTIN_EQUALS_DATA    = 47,
+
+  /* Misc constructors (V1) */
+  CARDANO_UPLC_BUILTIN_MK_PAIR_DATA     = 48,
+  CARDANO_UPLC_BUILTIN_MK_NIL_DATA      = 49,
+  CARDANO_UPLC_BUILTIN_MK_NIL_PAIR_DATA = 50,
+
+  /* Serialisation (V2) */
+  CARDANO_UPLC_BUILTIN_SERIALISE_DATA = 51,
+
+  /* ECDSA / Schnorr (V2) */
+  CARDANO_UPLC_BUILTIN_VERIFY_ECDSA_SECP256K1_SIGNATURE   = 52,
+  CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE = 53,
+
+  /* BLS12-381 G1 (V3) */
+  CARDANO_UPLC_BUILTIN_BLS12_381_G1_ADD           = 54,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G1_NEG           = 55,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G1_SCALAR_MUL    = 56,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G1_EQUAL         = 57,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G1_COMPRESS      = 58,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G1_UNCOMPRESS    = 59,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G1_HASH_TO_GROUP = 60,
+
+  /* BLS12-381 G2 (V3) */
+  CARDANO_UPLC_BUILTIN_BLS12_381_G2_ADD           = 61,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G2_NEG           = 62,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G2_SCALAR_MUL    = 63,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G2_EQUAL         = 64,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G2_COMPRESS      = 65,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G2_UNCOMPRESS    = 66,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G2_HASH_TO_GROUP = 67,
+
+  /* BLS12-381 pairing (V3) */
+  CARDANO_UPLC_BUILTIN_BLS12_381_MILLER_LOOP   = 68,
+  CARDANO_UPLC_BUILTIN_BLS12_381_MUL_ML_RESULT = 69,
+  CARDANO_UPLC_BUILTIN_BLS12_381_FINAL_VERIFY  = 70,
+
+  /* Additional hash functions (V3) */
+  CARDANO_UPLC_BUILTIN_KECCAK_256  = 71,
+  CARDANO_UPLC_BUILTIN_BLAKE2B_224 = 72,
+
+  /* Integer/ByteString conversions and bitwise operations (V3) */
+  CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING = 73,
+  CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER = 74,
+  CARDANO_UPLC_BUILTIN_AND_BYTE_STRING        = 75,
+  CARDANO_UPLC_BUILTIN_OR_BYTE_STRING         = 76,
+  CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING        = 77,
+  CARDANO_UPLC_BUILTIN_COMPLEMENT_BYTE_STRING = 78,
+  CARDANO_UPLC_BUILTIN_READ_BIT               = 79,
+  CARDANO_UPLC_BUILTIN_WRITE_BITS             = 80,
+  CARDANO_UPLC_BUILTIN_REPLICATE_BYTE         = 81,
+  CARDANO_UPLC_BUILTIN_SHIFT_BYTE_STRING      = 82,
+  CARDANO_UPLC_BUILTIN_ROTATE_BYTE_STRING     = 83,
+  CARDANO_UPLC_BUILTIN_COUNT_SET_BITS         = 84,
+  CARDANO_UPLC_BUILTIN_FIND_FIRST_SET_BIT     = 85,
+
+  /* RIPEMD-160 (V3) */
+  CARDANO_UPLC_BUILTIN_RIPEMD_160 = 86,
+
+  /* Modular exponentiation (V3) */
+  CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER = 87,
+
+  /* Post-V3 ("V4") builtins, tags 88..100. */
+  CARDANO_UPLC_BUILTIN_DROP_LIST                     = 88,
+  CARDANO_UPLC_BUILTIN_LENGTH_OF_ARRAY               = 89,
+  CARDANO_UPLC_BUILTIN_LIST_TO_ARRAY                 = 90,
+  CARDANO_UPLC_BUILTIN_INDEX_ARRAY                   = 91,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G1_MULTI_SCALAR_MUL = 92,
+  CARDANO_UPLC_BUILTIN_BLS12_381_G2_MULTI_SCALAR_MUL = 93,
+  CARDANO_UPLC_BUILTIN_INSERT_COIN                   = 94,
+  CARDANO_UPLC_BUILTIN_LOOKUP_COIN                   = 95,
+  CARDANO_UPLC_BUILTIN_UNION_VALUE                   = 96,
+  CARDANO_UPLC_BUILTIN_VALUE_CONTAINS                = 97,
+  CARDANO_UPLC_BUILTIN_VALUE_DATA                    = 98,
+  CARDANO_UPLC_BUILTIN_UN_VALUE_DATA                 = 99,
+  CARDANO_UPLC_BUILTIN_SCALE_VALUE                   = 100,
+
+  /* Batch 7 builtins, tags 101..105. */
+  CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY = 101,
+  CARDANO_UPLC_BUILTIN_POLICIES          = 102,
+  CARDANO_UPLC_BUILTIN_ASSET_COUNT       = 103,
+  CARDANO_UPLC_BUILTIN_KEEP_POLICIES     = 104,
+  CARDANO_UPLC_BUILTIN_DROP_POLICIES     = 105
+} cardano_uplc_builtin_t;
+
+/**
+ * \brief Number of distinct builtin tags, equal to the largest valid tag plus one.
+ *
+ * The largest tag is 105 (dropPolicies), so the count is 106. Valid tags are
+ * 0 .. CARDANO_UPLC_BUILTIN_COUNT - 1.
+ */
+#define CARDANO_UPLC_BUILTIN_COUNT 106
+
+/**
+ * \brief Returns the number of term arguments a builtin must be applied to before
+ *        it can run.
+ *
+ * \param[in] builtin The builtin tag to query.
+ * \param[out] arity On success, set to the arity (one of 1, 2, 3, 4 or 6); left
+ *             untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arity is NULL, or \ref CARDANO_ERROR_INVALID_ARGUMENT if \p builtin is
+ *         not a valid tag in 0 .. CARDANO_UPLC_BUILTIN_COUNT - 1.
+ */
+cardano_error_t
+cardano_uplc_builtin_arity(cardano_uplc_builtin_t builtin, size_t* arity);
+
+/**
+ * \brief Returns the number of \c force operations a builtin must receive before
+ *        it can run.
+ *
+ * \param[in] builtin The builtin tag to query.
+ * \param[out] force_count On success, set to the force count (one of 0, 1 or 2);
+ *             left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p force_count is NULL, or \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p builtin is not a valid tag in 0 .. CARDANO_UPLC_BUILTIN_COUNT - 1.
+ */
+cardano_error_t
+cardano_uplc_builtin_force_count(cardano_uplc_builtin_t builtin, size_t* force_count);
+
+/**
+ * \brief Returns whether a builtin is available in a language at a protocol version.
+ *
+ * Encodes the ledger's \c builtinsIntroducedIn schedule: each builtin becomes
+ * available in a given Plutus language at the protocol major version that
+ * introduced its release batch for that language. A script that names a builtin
+ * before it is available cannot be deserialised, so the script decoder rejects it
+ * (see \ref cardano_uplc_flat_decode_script_program).
+ *
+ * \param[in] builtin The builtin tag to query.
+ * \param[in] language The Plutus language of the script using the builtin.
+ * \param[in] protocol_major The major protocol version the transaction is evaluated under.
+ *
+ * \return \c true when the builtin is available, \c false otherwise (including for
+ *         an invalid builtin tag or language).
+ */
+bool
+cardano_uplc_builtin_available(
+  cardano_uplc_builtin_t      builtin,
+  cardano_uplc_lang_version_t language,
+  uint64_t                    protocol_major);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BUILTIN_H */
diff --git a/vendor/src/uplc/builtins/uplc_builtin_outcome.h b/vendor/src/uplc/builtins/uplc_builtin_outcome.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/builtins/uplc_builtin_outcome.h
@@ -0,0 +1,55 @@
+/**
+ * \file uplc_builtin_outcome.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BUILTIN_OUTCOME_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BUILTIN_OUTCOME_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The outcome of running a saturated builtin.
+ *
+ * The builtin runtime distinguishes three script-visible results plus a host
+ * failure that is reported separately through a \ref cardano_error_t out-param.
+ * A successful run yields a value; a type mismatch (or any other Plutus failure a
+ * body raises) is a script error that fails the script; an unimplemented builtin
+ * is reported as unsupported so the caller can tell "this VM build does not run
+ * this builtin yet" apart from "the script failed".
+ */
+typedef enum
+{
+  /** \brief The body ran and produced a result value. */
+  CARDANO_UPLC_BUILTIN_OUTCOME_OK = 0,
+  /** \brief The body raised a Plutus failure (type mismatch, etc.); the script fails. */
+  CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR = 1,
+  /** \brief The builtin body is not implemented in this VM build yet. */
+  CARDANO_UPLC_BUILTIN_OUTCOME_UNSUPPORTED = 2
+} cardano_uplc_int_builtin_outcome_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BUILTIN_OUTCOME_H */
diff --git a/vendor/src/uplc/builtins/uplc_builtin_semantics.c b/vendor/src/uplc/builtins/uplc_builtin_semantics.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/builtins/uplc_builtin_semantics.c
@@ -0,0 +1,240 @@
+/**
+ * \file uplc_builtin_semantics.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_builtin_semantics.h"
+#include "../ast/uplc_lang_version.h"
+
+#include <stdint.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief The protocol major version at which the Chang upgrade activated.
+ *
+ * At and above this version V1/V2 select semantics B.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t CARDANO_UPLC_CHANG_PROTOCOL_VERSION = 9U;
+
+/**
+ * \brief The protocol major version at which the Van-Rossem upgrade activated.
+ *
+ * At and above this version V1/V2 select semantics D and V3 selects E.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t CARDANO_UPLC_VAN_ROSSEM_PROTOCOL_VERSION = 11U;
+
+/**
+ * \brief The protocol major version at which the Dijkstra upgrade activates.
+ *
+ * At and above this version V1/V2 select semantics F and V3/V4 select G.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t CARDANO_UPLC_DIJKSTRA_PROTOCOL_VERSION = 12U;
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_uplc_builtin_semantics_t
+cardano_uplc_builtin_semantics_for_language_and_protocol(
+  cardano_uplc_lang_version_t lang_version,
+  uint64_t                    protocol_major)
+{
+  cardano_uplc_builtin_semantics_t result = CARDANO_UPLC_SEMANTICS_C;
+
+  switch (lang_version)
+  {
+    case CARDANO_UPLC_LANG_VERSION_V1:
+    case CARDANO_UPLC_LANG_VERSION_V2:
+    {
+      if (protocol_major >= CARDANO_UPLC_DIJKSTRA_PROTOCOL_VERSION)
+      {
+        result = CARDANO_UPLC_SEMANTICS_F;
+      }
+      else if (protocol_major >= CARDANO_UPLC_VAN_ROSSEM_PROTOCOL_VERSION)
+      {
+        result = CARDANO_UPLC_SEMANTICS_D;
+      }
+      else if (protocol_major >= CARDANO_UPLC_CHANG_PROTOCOL_VERSION)
+      {
+        result = CARDANO_UPLC_SEMANTICS_B;
+      }
+      else
+      {
+        result = CARDANO_UPLC_SEMANTICS_A;
+      }
+      break;
+    }
+    case CARDANO_UPLC_LANG_VERSION_V3:
+    {
+      if (protocol_major >= CARDANO_UPLC_DIJKSTRA_PROTOCOL_VERSION)
+      {
+        result = CARDANO_UPLC_SEMANTICS_G;
+      }
+      else if (protocol_major >= CARDANO_UPLC_VAN_ROSSEM_PROTOCOL_VERSION)
+      {
+        result = CARDANO_UPLC_SEMANTICS_E;
+      }
+      else
+      {
+        result = CARDANO_UPLC_SEMANTICS_C;
+      }
+      break;
+    }
+    case CARDANO_UPLC_LANG_VERSION_V4:
+    {
+      result = (protocol_major >= CARDANO_UPLC_DIJKSTRA_PROTOCOL_VERSION) ? CARDANO_UPLC_SEMANTICS_G
+                                                                          : CARDANO_UPLC_SEMANTICS_E;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+bool
+cardano_uplc_semantics_costs_strings_by_utf8_bytes(cardano_uplc_builtin_semantics_t semantics)
+{
+  bool result = false;
+
+  switch (semantics)
+  {
+    case CARDANO_UPLC_SEMANTICS_D:
+    case CARDANO_UPLC_SEMANTICS_E:
+    case CARDANO_UPLC_SEMANTICS_F:
+    case CARDANO_UPLC_SEMANTICS_G:
+    {
+      result = true;
+      break;
+    }
+    case CARDANO_UPLC_SEMANTICS_A:
+    case CARDANO_UPLC_SEMANTICS_B:
+    case CARDANO_UPLC_SEMANTICS_C:
+    {
+      result = false;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+bool
+cardano_uplc_semantics_cons_byte_string_range_checks(cardano_uplc_builtin_semantics_t semantics)
+{
+  bool result = false;
+
+  switch (semantics)
+  {
+    case CARDANO_UPLC_SEMANTICS_C:
+    case CARDANO_UPLC_SEMANTICS_E:
+    case CARDANO_UPLC_SEMANTICS_G:
+    {
+      result = true;
+      break;
+    }
+    case CARDANO_UPLC_SEMANTICS_A:
+    case CARDANO_UPLC_SEMANTICS_B:
+    case CARDANO_UPLC_SEMANTICS_D:
+    case CARDANO_UPLC_SEMANTICS_F:
+    {
+      result = false;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+bool
+cardano_uplc_semantics_bounds_integer_arguments(cardano_uplc_builtin_semantics_t semantics)
+{
+  bool result = false;
+
+  switch (semantics)
+  {
+    case CARDANO_UPLC_SEMANTICS_D:
+    case CARDANO_UPLC_SEMANTICS_E:
+    {
+      result = true;
+      break;
+    }
+    case CARDANO_UPLC_SEMANTICS_A:
+    case CARDANO_UPLC_SEMANTICS_B:
+    case CARDANO_UPLC_SEMANTICS_C:
+    case CARDANO_UPLC_SEMANTICS_F:
+    case CARDANO_UPLC_SEMANTICS_G:
+    {
+      result = false;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+bool
+cardano_uplc_semantics_bounds_byte_string_arguments(cardano_uplc_builtin_semantics_t semantics)
+{
+  bool result = false;
+
+  switch (semantics)
+  {
+    case CARDANO_UPLC_SEMANTICS_D:
+    case CARDANO_UPLC_SEMANTICS_E:
+    case CARDANO_UPLC_SEMANTICS_F:
+    case CARDANO_UPLC_SEMANTICS_G:
+    {
+      result = true;
+      break;
+    }
+    case CARDANO_UPLC_SEMANTICS_A:
+    case CARDANO_UPLC_SEMANTICS_B:
+    case CARDANO_UPLC_SEMANTICS_C:
+    {
+      result = false;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
diff --git a/vendor/src/uplc/builtins/uplc_builtin_semantics.h b/vendor/src/uplc/builtins/uplc_builtin_semantics.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/builtins/uplc_builtin_semantics.h
@@ -0,0 +1,150 @@
+/**
+ * \file uplc_builtin_semantics.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BUILTIN_SEMANTICS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BUILTIN_SEMANTICS_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_lang_version.h"
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The ledger builtin semantics variants, selected by language and protocol.
+ *
+ * Some builtins behave or cost differently across protocol upgrades; the variant
+ * captures that selection so the cost model and the builtin runtime read one
+ * value rather than re-deriving the protocol rules. The observable differences
+ * are that variants D, E, F and G cost text strings by their utf-8 byte length
+ * rather than code-point count (see \ref cardano_uplc_semantics_costs_strings_by_utf8_bytes),
+ * that variants C, E and G apply a range check to \c consByteString (see
+ * \ref cardano_uplc_semantics_cons_byte_string_range_checks), that variants D and
+ * E bound integer arguments (see \ref cardano_uplc_semantics_bounds_integer_arguments)
+ * and that variants D, E, F and G bound byte-string arguments (see
+ * \ref cardano_uplc_semantics_bounds_byte_string_arguments).
+ */
+typedef enum
+{
+  /** \brief Pre-Chang V1/V2 semantics. */
+  CARDANO_UPLC_SEMANTICS_A = 0,
+  /** \brief Chang-era V1/V2 semantics. */
+  CARDANO_UPLC_SEMANTICS_B = 1,
+  /** \brief Pre-Van-Rossem V3 semantics (consByteString range checks). */
+  CARDANO_UPLC_SEMANTICS_C = 2,
+  /** \brief Van-Rossem-era V1/V2 semantics (utf-8-byte string costing). */
+  CARDANO_UPLC_SEMANTICS_D = 3,
+  /** \brief V3 from Van-Rossem and V4 before Dijkstra (utf-8 costing, range checks). */
+  CARDANO_UPLC_SEMANTICS_E = 4,
+  /** \brief Dijkstra-era V1/V2 semantics (utf-8-byte string costing). */
+  CARDANO_UPLC_SEMANTICS_F = 5,
+  /** \brief Dijkstra-era V3/V4 semantics (utf-8 costing and range checks). */
+  CARDANO_UPLC_SEMANTICS_G = 6
+} cardano_uplc_builtin_semantics_t;
+
+/**
+ * \brief Selects the builtin semantics variant from language and protocol.
+ *
+ * For V1 and V2 a protocol major version at or above the Dijkstra version
+ * selects F, at or above the Van-Rossem version selects D, at or above the Chang
+ * version selects B, and anything earlier selects A. For V3 a protocol at or
+ * above Dijkstra selects G, at or above Van-Rossem selects E, otherwise C. For V4
+ * a protocol at or above Dijkstra selects G and anything earlier selects E. An
+ * unrecognized version selects C.
+ *
+ * \param[in] lang_version The language version selecting the rule.
+ * \param[in] protocol_major The protocol major version.
+ *
+ * \return The selected semantics variant.
+ */
+cardano_uplc_builtin_semantics_t
+cardano_uplc_builtin_semantics_for_language_and_protocol(
+  cardano_uplc_lang_version_t lang_version,
+  uint64_t                    protocol_major);
+
+/**
+ * \brief Whether a semantics variant costs text strings by their utf-8 byte length.
+ *
+ * True for D, E, F and G, false for A, B and C. This is the boolean the ex-mem
+ * string measure consumes (\ref cardano_uplc_string_ex_mem).
+ *
+ * \param[in] semantics The semantics variant to query.
+ *
+ * \return \c true for D, E, F and G, \c false otherwise (including an unknown variant).
+ */
+bool
+cardano_uplc_semantics_costs_strings_by_utf8_bytes(cardano_uplc_builtin_semantics_t semantics);
+
+/**
+ * \brief Whether a semantics variant range-checks the consByteString builtin.
+ *
+ * True for C, E and G, false for A, B, D and F. The \c consByteString builtin
+ * consults this to decide whether to reject a byte argument outside 0..255.
+ *
+ * \param[in] semantics The semantics variant to query.
+ *
+ * \return \c true for C, E and G, \c false otherwise (including an unknown variant).
+ */
+bool
+cardano_uplc_semantics_cons_byte_string_range_checks(cardano_uplc_builtin_semantics_t semantics);
+
+/**
+ * \brief Whether a semantics variant bounds the integer arguments of builtins.
+ *
+ * True for D and E, false for A, B, C, F and G. Under these variants the integer
+ * arithmetic and ordering builtins, and the leading integer of \c consByteString,
+ * reject an argument outside -(2^262143) .. 2^262143 - 1.
+ *
+ * \param[in] semantics The semantics variant to query.
+ *
+ * \return \c true for D and E, \c false otherwise (including an unknown variant).
+ */
+bool
+cardano_uplc_semantics_bounds_integer_arguments(cardano_uplc_builtin_semantics_t semantics);
+
+/**
+ * \brief Whether a semantics variant bounds the byte-string arguments of builtins.
+ *
+ * True for D, E, F and G, false for A, B and C. Under these variants the builtins
+ * that consume a byte string's contents reject one longer than 65536 bytes, and
+ * the same variants select the bounded forms of \c writeBits (input of at most
+ * 4096 bytes), \c shiftByteString and \c rotateByteString (a shift that fits a
+ * signed 64-bit integer), \c constrData (a tag that fits an unsigned 64-bit
+ * integer) and the BLS12-381 \c scalarMul builtins (a scalar in
+ * -(2^4095) .. 2^4095 - 1).
+ *
+ * \param[in] semantics The semantics variant to query.
+ *
+ * \return \c true for D, E, F and G, \c false otherwise (including an unknown variant).
+ */
+bool
+cardano_uplc_semantics_bounds_byte_string_arguments(cardano_uplc_builtin_semantics_t semantics);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BUILTIN_SEMANTICS_H */
diff --git a/vendor/src/uplc/builtins/uplc_byte_view.h b/vendor/src/uplc/builtins/uplc_byte_view.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/builtins/uplc_byte_view.h
@@ -0,0 +1,53 @@
+/**
+ * \file uplc_byte_view.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BYTE_VIEW_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BYTE_VIEW_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A borrowed, read-only view of a constant's byte-string or string payload.
+ *
+ * The machine stores byte strings and strings as an inline arena \c (data, size)
+ * descriptor, so unwrapping one yields a pointer-and-length view straight into arena
+ * memory with no allocation or refcount. The view borrows the arena bytes and must
+ * not outlive them. For the empty byte string \c data is NULL and \c size is 0.
+ */
+typedef struct cardano_uplc_byte_view_t
+{
+    const byte_t* data;
+    size_t        size;
+} cardano_uplc_byte_view_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_BUILTINS_UPLC_BYTE_VIEW_H */
diff --git a/vendor/src/uplc/cost/uplc_builtin_cost.h b/vendor/src/uplc/cost/uplc_builtin_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_builtin_cost.h
@@ -0,0 +1,90 @@
+/**
+ * \file uplc_builtin_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_BUILTIN_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_BUILTIN_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_builtin_cost_arity.h"
+#include "uplc_four_arg_cost.h"
+#include "uplc_one_arg_cost.h"
+#include "uplc_six_arg_cost.h"
+#include "uplc_three_arg_cost.h"
+#include "uplc_two_arg_cost.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The cpu and mem costing functions of a single builtin.
+ *
+ * The \c arity selects which member of \c cpu and \c mem is active; both members
+ * always have the same arity for a given builtin.
+ */
+typedef struct cardano_uplc_builtin_cost_t
+{
+    /** \brief The arity selecting the active union member of \c cpu and \c mem. */
+    cardano_uplc_builtin_cost_arity_t arity;
+
+    /** \brief The cpu costing function for the builtin. */
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        /** \brief Active when arity is ONE. */
+        cardano_uplc_one_arg_cost_t one;
+        /** \brief Active when arity is TWO. */
+        cardano_uplc_two_arg_cost_t two;
+        /** \brief Active when arity is THREE. */
+        cardano_uplc_three_arg_cost_t three;
+        /** \brief Active when arity is FOUR. */
+        cardano_uplc_four_arg_cost_t four;
+        /** \brief Active when arity is SIX. */
+        cardano_uplc_six_arg_cost_t six;
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } cpu;
+
+    /** \brief The mem costing function for the builtin. */
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        /** \brief Active when arity is ONE. */
+        cardano_uplc_one_arg_cost_t one;
+        /** \brief Active when arity is TWO. */
+        cardano_uplc_two_arg_cost_t two;
+        /** \brief Active when arity is THREE. */
+        cardano_uplc_three_arg_cost_t three;
+        /** \brief Active when arity is FOUR. */
+        cardano_uplc_four_arg_cost_t four;
+        /** \brief Active when arity is SIX. */
+        cardano_uplc_six_arg_cost_t six;
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } mem;
+} cardano_uplc_builtin_cost_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_BUILTIN_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_builtin_cost_arity.h b/vendor/src/uplc/cost/uplc_builtin_cost_arity.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_builtin_cost_arity.h
@@ -0,0 +1,57 @@
+/**
+ * \file uplc_builtin_cost_arity.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_BUILTIN_COST_ARITY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_BUILTIN_COST_ARITY_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The arity of a builtin's costing function, selecting its cost shape.
+ *
+ * Each builtin takes its cpu and mem cost from a costing function of a fixed
+ * arity (one of 1, 2, 3, 4 or 6). The arity is a property of the builtin and
+ * never changes between versions; it selects which member of the cpu/mem unions
+ * in \ref cardano_uplc_builtin_cost_t is active.
+ */
+typedef enum
+{
+  /** \brief A one-argument costing function. */
+  CARDANO_UPLC_BUILTIN_COST_ARITY_ONE = 0,
+  /** \brief A two-argument costing function. */
+  CARDANO_UPLC_BUILTIN_COST_ARITY_TWO = 1,
+  /** \brief A three-argument costing function. */
+  CARDANO_UPLC_BUILTIN_COST_ARITY_THREE = 2,
+  /** \brief A four-argument costing function. */
+  CARDANO_UPLC_BUILTIN_COST_ARITY_FOUR = 3,
+  /** \brief A six-argument costing function. */
+  CARDANO_UPLC_BUILTIN_COST_ARITY_SIX = 4
+} cardano_uplc_builtin_cost_arity_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_BUILTIN_COST_ARITY_H */
diff --git a/vendor/src/uplc/cost/uplc_builtin_costs.c b/vendor/src/uplc/cost/uplc_builtin_costs.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_builtin_costs.c
@@ -0,0 +1,1542 @@
+/**
+ * \file uplc_builtin_costs.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_builtin_costs.h"
+#include "../ast/uplc_int.h"
+#include "../builtins/uplc_builtin.h"
+#include "../data/uplc_data.h"
+#include "../machine/uplc_value.h"
+#include "uplc_builtin_cost.h"
+#include "uplc_ex_mem.h"
+
+#include <cardano/common/bigint.h>
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief The prohibitive sentinel cost for a builtin not in a version.
+ */
+static const int64_t CARDANO_UPLC_UNAVAILABLE_BUILTIN_COST = 30000000000;
+
+/**
+ * \brief The byte-string chunk used to convert a literal width to an ex-mem size.
+ *
+ * The width literal of \c integerToByteString and \c replicateByte is converted
+ * to a size of \c 0 when zero else \c ((n - 1) / 8) + 1.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_COST_SIZE_CHUNK = 8;
+
+/**
+ * \brief The maximum output length the width-to-size conversion accepts before clamping.
+ *
+ * This is the maximum output length of \c integerToByteString.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_COST_SIZE_MAX = 8192;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Builds a one-argument constant-cost costing function.
+ *
+ * \param[in] c The flat cost.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_one_arg_cost_t
+one_const(int64_t c)
+{
+  cardano_uplc_one_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind            = CARDANO_UPLC_ONE_ARG_CONSTANT;
+  fn.params.constant = c;
+  return fn;
+}
+
+/**
+ * \brief Builds a one-argument linear costing function.
+ *
+ * \param[in] intercept The constant term.
+ * \param[in] slope The coefficient of the size.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_one_arg_cost_t
+one_linear(int64_t intercept, int64_t slope)
+{
+  cardano_uplc_one_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                    = CARDANO_UPLC_ONE_ARG_LINEAR;
+  fn.params.linear.intercept = intercept;
+  fn.params.linear.slope     = slope;
+  return fn;
+}
+
+/**
+ * \brief Builds a two-argument constant-cost costing function.
+ *
+ * \param[in] c The flat cost.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_two_arg_cost_t
+two_const(int64_t c)
+{
+  cardano_uplc_two_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind            = CARDANO_UPLC_TWO_ARG_CONSTANT;
+  fn.params.constant = c;
+  return fn;
+}
+
+/**
+ * \brief Builds a two-argument linear costing function of the given kind.
+ *
+ * Used for the LINEAR_IN_X, LINEAR_IN_Y, ADDED_SIZES, MULTIPLIED_SIZES, MIN_SIZE
+ * and MAX_SIZE arms, all of which carry a plain linear pair.
+ *
+ * \param[in] kind The two-argument arm.
+ * \param[in] intercept The constant term.
+ * \param[in] slope The slope.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_two_arg_cost_t
+two_linear(cardano_uplc_two_arg_kind_t kind, int64_t intercept, int64_t slope)
+{
+  cardano_uplc_two_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                    = kind;
+  fn.params.linear.intercept = intercept;
+  fn.params.linear.slope     = slope;
+  return fn;
+}
+
+/**
+ * \brief Builds a two-argument subtracted-sizes costing function.
+ *
+ * \param[in] intercept The constant term.
+ * \param[in] slope The slope of the floored difference.
+ * \param[in] minimum The lower bound on the difference.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_two_arg_cost_t
+two_subtracted(int64_t intercept, int64_t slope, int64_t minimum)
+{
+  cardano_uplc_two_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                              = CARDANO_UPLC_TWO_ARG_SUBTRACTED_SIZES;
+  fn.params.subtracted_sizes.intercept = intercept;
+  fn.params.subtracted_sizes.slope     = slope;
+  fn.params.subtracted_sizes.minimum   = minimum;
+  return fn;
+}
+
+/**
+ * \brief Builds a two-argument linear-on-diagonal costing function.
+ *
+ * \param[in] constant The flat cost off the diagonal.
+ * \param[in] intercept The constant term on the diagonal.
+ * \param[in] slope The slope on the diagonal.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_two_arg_cost_t
+two_on_diagonal(int64_t constant, int64_t intercept, int64_t slope)
+{
+  cardano_uplc_two_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                                = CARDANO_UPLC_TWO_ARG_LINEAR_ON_DIAGONAL;
+  fn.params.linear_on_diagonal.constant  = constant;
+  fn.params.linear_on_diagonal.intercept = intercept;
+  fn.params.linear_on_diagonal.slope     = slope;
+  return fn;
+}
+
+/**
+ * \brief Builds a two-argument const-above-diagonal over multiplied sizes.
+ *
+ * \param[in] constant The flat cost when x is below the diagonal.
+ * \param[in] intercept The intercept of the off-diagonal multiplied-sizes model.
+ * \param[in] slope The slope of the off-diagonal multiplied-sizes model.
+ *
+ * \return The costing function.
+ */
+/**
+ * \brief Builds a one-argument quadratic costing function.
+ *
+ * \param[in] c0 The constant term.
+ * \param[in] c1 The linear coefficient.
+ * \param[in] c2 The quadratic coefficient.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_one_arg_cost_t
+one_quadratic(int64_t c0, int64_t c1, int64_t c2)
+{
+  cardano_uplc_one_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                     = CARDANO_UPLC_ONE_ARG_QUADRATIC;
+  fn.params.quadratic.coeff_0 = c0;
+  fn.params.quadratic.coeff_1 = c1;
+  fn.params.quadratic.coeff_2 = c2;
+  return fn;
+}
+
+/**
+ * \brief Builds a two-argument bilinear-with-interaction costing function.
+ *
+ * \param[in] c00 The constant term.
+ * \param[in] c10 The coefficient of x.
+ * \param[in] c01 The coefficient of y.
+ * \param[in] c11 The coefficient of x*y.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_two_arg_cost_t
+two_with_interaction(int64_t c00, int64_t c10, int64_t c01, int64_t c11)
+{
+  cardano_uplc_two_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                        = CARDANO_UPLC_TWO_ARG_WITH_INTERACTION;
+  fn.params.with_interaction.c00 = c00;
+  fn.params.with_interaction.c10 = c10;
+  fn.params.with_interaction.c01 = c01;
+  fn.params.with_interaction.c11 = c11;
+  return fn;
+}
+
+/**
+ * \brief Builds a two-argument const-above-diagonal over a two-variable linear model.
+ *
+ * Off the diagonal (x < y) the flat \p constant is charged; otherwise the model
+ * \c intercept + \c slope_x * x + \c slope_y * y applies. This is the
+ * const-above-diagonal over linear-in-x-and-y shape used by \c valueContains.
+ *
+ * \param[in] constant The flat off-diagonal cost.
+ * \param[in] intercept The constant term of the linear model.
+ * \param[in] slope_x The coefficient of x.
+ * \param[in] slope_y The coefficient of y.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_two_arg_cost_t
+two_const_above_linear(int64_t constant, int64_t intercept, int64_t slope_x, int64_t slope_y)
+{
+  cardano_uplc_two_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                                                    = CARDANO_UPLC_TWO_ARG_CONST_ABOVE_DIAGONAL;
+  fn.params.const_diagonal.constant                          = constant;
+  fn.params.const_diagonal.kind                              = CARDANO_UPLC_DIAG_MODEL_LINEAR_IN_X_AND_Y;
+  fn.params.const_diagonal.model.linear_in_x_and_y.intercept = intercept;
+  fn.params.const_diagonal.model.linear_in_x_and_y.slope1    = slope_x;
+  fn.params.const_diagonal.model.linear_in_x_and_y.slope2    = slope_y;
+  return fn;
+}
+
+static cardano_uplc_two_arg_cost_t
+two_const_above_mult(int64_t constant, int64_t intercept, int64_t slope)
+{
+  cardano_uplc_two_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                                                   = CARDANO_UPLC_TWO_ARG_CONST_ABOVE_DIAGONAL;
+  fn.params.const_diagonal.constant                         = constant;
+  fn.params.const_diagonal.kind                             = CARDANO_UPLC_DIAG_MODEL_MULTIPLIED_SIZES;
+  fn.params.const_diagonal.model.multiplied_sizes.intercept = intercept;
+  fn.params.const_diagonal.model.multiplied_sizes.slope     = slope;
+  return fn;
+}
+
+/**
+ * \brief Builds a two-argument const-above-diagonal-into-quadratic function.
+ *
+ * \param[in] constant The flat cost when x is below the diagonal.
+ * \param[in] minimum The lower bound on the quadratic.
+ * \param[in] c00 The constant quadratic coefficient.
+ * \param[in] c10 The coefficient of x.
+ * \param[in] c01 The coefficient of y.
+ * \param[in] c20 The coefficient of x*x.
+ * \param[in] c11 The coefficient of x*y.
+ * \param[in] c02 The coefficient of y*y.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_two_arg_cost_t
+two_const_above_quad(
+  int64_t constant,
+  int64_t minimum,
+  int64_t c00,
+  int64_t c10,
+  int64_t c01,
+  int64_t c20,
+  int64_t c11,
+  int64_t c02)
+{
+  cardano_uplc_two_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                                                 = CARDANO_UPLC_TWO_ARG_CONST_ABOVE_DIAGONAL_INTO_QUADRATIC;
+  fn.params.const_above_into_quadratic.constant           = constant;
+  fn.params.const_above_into_quadratic.quadratic.minimum  = minimum;
+  fn.params.const_above_into_quadratic.quadratic.coeff_00 = c00;
+  fn.params.const_above_into_quadratic.quadratic.coeff_10 = c10;
+  fn.params.const_above_into_quadratic.quadratic.coeff_01 = c01;
+  fn.params.const_above_into_quadratic.quadratic.coeff_20 = c20;
+  fn.params.const_above_into_quadratic.quadratic.coeff_11 = c11;
+  fn.params.const_above_into_quadratic.quadratic.coeff_02 = c02;
+  return fn;
+}
+
+/**
+ * \brief Builds a two-argument quadratic-in-y costing function.
+ *
+ * \param[in] c0 The constant term.
+ * \param[in] c1 The linear coefficient.
+ * \param[in] c2 The quadratic coefficient.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_two_arg_cost_t
+two_quadratic_in_y(int64_t c0, int64_t c1, int64_t c2)
+{
+  cardano_uplc_two_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                          = CARDANO_UPLC_TWO_ARG_QUADRATIC_IN_Y;
+  fn.params.quadratic_in_y.coeff_0 = c0;
+  fn.params.quadratic_in_y.coeff_1 = c1;
+  fn.params.quadratic_in_y.coeff_2 = c2;
+  return fn;
+}
+
+/**
+ * \brief Builds a three-argument constant-cost costing function.
+ *
+ * \param[in] c The flat cost.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_three_arg_cost_t
+three_const(int64_t c)
+{
+  cardano_uplc_three_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind            = CARDANO_UPLC_THREE_ARG_CONSTANT;
+  fn.params.constant = c;
+  return fn;
+}
+
+/**
+ * \brief Builds a three-argument linear costing function of the given kind.
+ *
+ * \param[in] kind The three-argument arm carrying a plain linear pair.
+ * \param[in] intercept The constant term.
+ * \param[in] slope The slope.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_three_arg_cost_t
+three_linear(cardano_uplc_three_arg_kind_t kind, int64_t intercept, int64_t slope)
+{
+  cardano_uplc_three_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                    = kind;
+  fn.params.linear.intercept = intercept;
+  fn.params.linear.slope     = slope;
+  return fn;
+}
+
+/**
+ * \brief Builds a three-argument quadratic-in-z costing function.
+ *
+ * \param[in] c0 The constant term.
+ * \param[in] c1 The linear coefficient.
+ * \param[in] c2 The quadratic coefficient.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_three_arg_cost_t
+three_quadratic_in_z(int64_t c0, int64_t c1, int64_t c2)
+{
+  cardano_uplc_three_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                          = CARDANO_UPLC_THREE_ARG_QUADRATIC_IN_Z;
+  fn.params.quadratic_in_z.coeff_0 = c0;
+  fn.params.quadratic_in_z.coeff_1 = c1;
+  fn.params.quadratic_in_z.coeff_2 = c2;
+  return fn;
+}
+
+/**
+ * \brief Builds a three-argument linear-in-y-and-z costing function.
+ *
+ * \param[in] intercept The constant term.
+ * \param[in] slope1 The coefficient of y.
+ * \param[in] slope2 The coefficient of z.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_three_arg_cost_t
+three_linear_yz(int64_t intercept, int64_t slope1, int64_t slope2)
+{
+  cardano_uplc_three_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                               = CARDANO_UPLC_THREE_ARG_LINEAR_IN_Y_AND_Z;
+  fn.params.linear_in_y_and_z.intercept = intercept;
+  fn.params.linear_in_y_and_z.slope1    = slope1;
+  fn.params.linear_in_y_and_z.slope2    = slope2;
+  return fn;
+}
+
+/**
+ * \brief Builds a three-argument modular-exponentiation costing function.
+ *
+ * \param[in] coeff_00 The constant term.
+ * \param[in] coeff_11 The coefficient of the exponent-by-modulus product.
+ * \param[in] coeff_12 The coefficient of the exponent-by-modulus-squared product.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_three_arg_cost_t
+three_exp_mod(int64_t coeff_00, int64_t coeff_11, int64_t coeff_12)
+{
+  cardano_uplc_three_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind                    = CARDANO_UPLC_THREE_ARG_EXP_MOD;
+  fn.params.exp_mod.coeff_00 = coeff_00;
+  fn.params.exp_mod.coeff_11 = coeff_11;
+  fn.params.exp_mod.coeff_12 = coeff_12;
+  return fn;
+}
+
+/**
+ * \brief Builds a six-argument constant-cost costing function.
+ *
+ * \param[in] c The flat cost.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_six_arg_cost_t
+six_const(int64_t c)
+{
+  cardano_uplc_six_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind            = CARDANO_UPLC_SIX_ARG_CONSTANT;
+  fn.params.constant = c;
+  return fn;
+}
+
+/**
+ * \brief Builds a four-argument constant-cost costing function.
+ *
+ * \param[in] c The flat cost.
+ *
+ * \return The costing function.
+ */
+static cardano_uplc_four_arg_cost_t
+four_const(int64_t c)
+{
+  cardano_uplc_four_arg_cost_t fn;
+  (void)memset(&fn, 0, sizeof(fn));
+  fn.kind            = CARDANO_UPLC_FOUR_ARG_CONSTANT;
+  fn.params.constant = c;
+  return fn;
+}
+
+/**
+ * \brief Builds a one-argument builtin cost entry from cpu and mem functions.
+ *
+ * \param[in] cpu The cpu costing function.
+ * \param[in] mem The mem costing function.
+ *
+ * \return The builtin cost entry.
+ */
+static cardano_uplc_builtin_cost_t
+entry_one(cardano_uplc_one_arg_cost_t cpu, cardano_uplc_one_arg_cost_t mem)
+{
+  cardano_uplc_builtin_cost_t e;
+  (void)memset(&e, 0, sizeof(e));
+  e.arity   = CARDANO_UPLC_BUILTIN_COST_ARITY_ONE;
+  e.cpu.one = cpu;
+  e.mem.one = mem;
+  return e;
+}
+
+/**
+ * \brief Builds a two-argument builtin cost entry from cpu and mem functions.
+ *
+ * \param[in] cpu The cpu costing function.
+ * \param[in] mem The mem costing function.
+ *
+ * \return The builtin cost entry.
+ */
+static cardano_uplc_builtin_cost_t
+entry_two(cardano_uplc_two_arg_cost_t cpu, cardano_uplc_two_arg_cost_t mem)
+{
+  cardano_uplc_builtin_cost_t e;
+  (void)memset(&e, 0, sizeof(e));
+  e.arity   = CARDANO_UPLC_BUILTIN_COST_ARITY_TWO;
+  e.cpu.two = cpu;
+  e.mem.two = mem;
+  return e;
+}
+
+/**
+ * \brief Builds a three-argument builtin cost entry from cpu and mem functions.
+ *
+ * \param[in] cpu The cpu costing function.
+ * \param[in] mem The mem costing function.
+ *
+ * \return The builtin cost entry.
+ */
+static cardano_uplc_builtin_cost_t
+entry_three(cardano_uplc_three_arg_cost_t cpu, cardano_uplc_three_arg_cost_t mem)
+{
+  cardano_uplc_builtin_cost_t e;
+  (void)memset(&e, 0, sizeof(e));
+  e.arity     = CARDANO_UPLC_BUILTIN_COST_ARITY_THREE;
+  e.cpu.three = cpu;
+  e.mem.three = mem;
+  return e;
+}
+
+/**
+ * \brief Builds a four-argument builtin cost entry from cpu and mem functions.
+ *
+ * \param[in] cpu The cpu costing function.
+ * \param[in] mem The mem costing function.
+ *
+ * \return The builtin cost entry.
+ */
+static cardano_uplc_builtin_cost_t
+entry_four(cardano_uplc_four_arg_cost_t cpu, cardano_uplc_four_arg_cost_t mem)
+{
+  cardano_uplc_builtin_cost_t e;
+  (void)memset(&e, 0, sizeof(e));
+  e.arity    = CARDANO_UPLC_BUILTIN_COST_ARITY_FOUR;
+  e.cpu.four = cpu;
+  e.mem.four = mem;
+  return e;
+}
+
+/**
+ * \brief Builds a six-argument builtin cost entry from cpu and mem functions.
+ *
+ * \param[in] cpu The cpu costing function.
+ * \param[in] mem The mem costing function.
+ *
+ * \return The builtin cost entry.
+ */
+static cardano_uplc_builtin_cost_t
+entry_six(cardano_uplc_six_arg_cost_t cpu, cardano_uplc_six_arg_cost_t mem)
+{
+  cardano_uplc_builtin_cost_t e;
+  (void)memset(&e, 0, sizeof(e));
+  e.arity   = CARDANO_UPLC_BUILTIN_COST_ARITY_SIX;
+  e.cpu.six = cpu;
+  e.mem.six = mem;
+  return e;
+}
+
+/**
+ * \brief Builds a one-argument sentinel cost entry for an unavailable builtin.
+ *
+ * \return The sentinel one-argument entry.
+ */
+static cardano_uplc_builtin_cost_t
+unavail_one(void)
+{
+  int64_t s = CARDANO_UPLC_UNAVAILABLE_BUILTIN_COST;
+  return entry_one(one_const(s), one_const(s));
+}
+
+/**
+ * \brief Builds a two-argument sentinel cost entry for an unavailable builtin.
+ *
+ * \return The sentinel two-argument entry.
+ */
+static cardano_uplc_builtin_cost_t
+unavail_two(void)
+{
+  int64_t s = CARDANO_UPLC_UNAVAILABLE_BUILTIN_COST;
+  return entry_two(two_const(s), two_const(s));
+}
+
+/**
+ * \brief Builds a three-argument sentinel cost entry for an unavailable builtin.
+ *
+ * \return The sentinel three-argument entry.
+ */
+static cardano_uplc_builtin_cost_t
+unavail_three(void)
+{
+  int64_t s = CARDANO_UPLC_UNAVAILABLE_BUILTIN_COST;
+  return entry_three(three_const(s), three_const(s));
+}
+
+/**
+ * \brief Fills the V1-and-V2 shared core builtins into a costs table.
+ *
+ * Every builtin available in V1 has the same shape and coefficients in V2; this
+ * sets those shared entries and leaves the version-specific ones (serialise_data,
+ * the secp256k1 verifiers) to the caller.
+ *
+ * \param[out] c The costs table to populate.
+ */
+static void
+fill_v1_v2_core(cardano_uplc_builtin_costs_t* c)
+{
+  c->entries[CARDANO_UPLC_BUILTIN_ADD_INTEGER]              = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_MAX_SIZE, 100788, 420), two_linear(CARDANO_UPLC_TWO_ARG_MAX_SIZE, 1, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER]         = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_MAX_SIZE, 100788, 420), two_linear(CARDANO_UPLC_TWO_ARG_MAX_SIZE, 1, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_MULTIPLY_INTEGER]         = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_MULTIPLIED_SIZES, 90434, 519), two_linear(CARDANO_UPLC_TWO_ARG_ADDED_SIZES, 0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER]           = entry_two(two_const_above_mult(85848, 228465, 122), two_subtracted(0, 1, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER]         = entry_two(two_const_above_mult(85848, 228465, 122), two_subtracted(0, 1, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER]        = entry_two(two_const_above_mult(85848, 228465, 122), two_subtracted(0, 1, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_MOD_INTEGER]              = entry_two(two_const_above_mult(85848, 228465, 122), two_subtracted(0, 1, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_EQUALS_INTEGER]           = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_MIN_SIZE, 51775, 558), two_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER]        = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_MIN_SIZE, 44749, 541), two_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER] = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_MIN_SIZE, 43285, 552), two_const(1));
+
+  c->entries[CARDANO_UPLC_BUILTIN_APPEND_BYTE_STRING]           = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_ADDED_SIZES, 1000, 173), two_linear(CARDANO_UPLC_TWO_ARG_ADDED_SIZES, 0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING]             = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y, 72010, 178), two_linear(CARDANO_UPLC_TWO_ARG_ADDED_SIZES, 0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING]            = entry_three(three_linear(CARDANO_UPLC_THREE_ARG_LINEAR_IN_Z, 20467, 1), three_linear(CARDANO_UPLC_THREE_ARG_LINEAR_IN_Z, 4, 0));
+  c->entries[CARDANO_UPLC_BUILTIN_LENGTH_OF_BYTE_STRING]        = entry_one(one_const(22100), one_const(10));
+  c->entries[CARDANO_UPLC_BUILTIN_INDEX_BYTE_STRING]            = entry_two(two_const(13169), two_const(4));
+  c->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING]           = entry_two(two_on_diagonal(30623, 28755, 75), two_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING]        = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_MIN_SIZE, 28999, 74), two_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING] = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_MIN_SIZE, 28999, 74), two_const(1));
+
+  c->entries[CARDANO_UPLC_BUILTIN_SHA2_256]                 = entry_one(one_linear(270652, 22588), one_const(4));
+  c->entries[CARDANO_UPLC_BUILTIN_SHA3_256]                 = entry_one(one_linear(1457325, 64566), one_const(4));
+  c->entries[CARDANO_UPLC_BUILTIN_BLAKE2B_256]              = entry_one(one_linear(201305, 8356), one_const(4));
+  c->entries[CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE] = entry_three(three_linear(CARDANO_UPLC_THREE_ARG_LINEAR_IN_Y, 53384111, 14333), three_const(10));
+
+  c->entries[CARDANO_UPLC_BUILTIN_APPEND_STRING] = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_ADDED_SIZES, 1000, 59957), two_linear(CARDANO_UPLC_TWO_ARG_ADDED_SIZES, 4, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING] = entry_two(two_on_diagonal(39184, 1000, 60594), two_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_ENCODE_UTF8]   = entry_one(one_linear(1000, 42921), one_linear(4, 2));
+  c->entries[CARDANO_UPLC_BUILTIN_DECODE_UTF8]   = entry_one(one_linear(91189, 769), one_linear(4, 2));
+
+  c->entries[CARDANO_UPLC_BUILTIN_IF_THEN_ELSE]     = entry_three(three_const(76049), three_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_CHOOSE_UNIT]      = entry_two(two_const(61462), two_const(4));
+  c->entries[CARDANO_UPLC_BUILTIN_TRACE]            = entry_two(two_const(59498), two_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_FST_PAIR]         = entry_one(one_const(141895), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_SND_PAIR]         = entry_one(one_const(141992), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_CHOOSE_LIST]      = entry_three(three_const(132994), three_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_MK_CONS]          = entry_two(two_const(72362), two_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_HEAD_LIST]        = entry_one(one_const(83150), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_TAIL_LIST]        = entry_one(one_const(81663), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_NULL_LIST]        = entry_one(one_const(74433), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_CHOOSE_DATA]      = entry_six(six_const(94375), six_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_CONSTR_DATA]      = entry_two(two_const(22151), two_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_MAP_DATA]         = entry_one(one_const(68246), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_LIST_DATA]        = entry_one(one_const(33852), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_I_DATA]           = entry_one(one_const(15299), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_B_DATA]           = entry_one(one_const(11183), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_UN_CONSTR_DATA]   = entry_one(one_const(24588), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_UN_MAP_DATA]      = entry_one(one_const(24623), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_UN_LIST_DATA]     = entry_one(one_const(25933), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_UN_I_DATA]        = entry_one(one_const(20744), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_UN_B_DATA]        = entry_one(one_const(20142), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_EQUALS_DATA]      = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_MIN_SIZE, 898148, 27279), two_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_MK_PAIR_DATA]     = entry_two(two_const(11546), two_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_MK_NIL_DATA]      = entry_one(one_const(7243), one_const(32));
+  c->entries[CARDANO_UPLC_BUILTIN_MK_NIL_PAIR_DATA] = entry_one(one_const(7391), one_const(32));
+}
+
+/**
+ * \brief Sets every entry of a costs table to the unavailable sentinel.
+ *
+ * Each builtin is set to the sentinel of its own arity so the dispatch reads the
+ * active union member. The caller overwrites the entries available in a version.
+ *
+ * \param[out] c The costs table to fill with sentinels.
+ */
+static void
+fill_all_unavail(cardano_uplc_builtin_costs_t* c)
+{
+  size_t  i = 0U;
+  int64_t s = CARDANO_UPLC_UNAVAILABLE_BUILTIN_COST;
+
+  (void)memset(c, 0, sizeof(*c));
+
+  for (i = 0U; i < (size_t)CARDANO_UPLC_BUILTIN_COUNT; ++i)
+  {
+    cardano_uplc_builtin_t func  = (cardano_uplc_builtin_t)i;
+    size_t                 arity = 2U;
+
+    (void)cardano_uplc_builtin_arity(func, &arity);
+
+    switch (arity)
+    {
+      case 1U:
+      {
+        c->entries[i] = unavail_one();
+        break;
+      }
+      case 3U:
+      {
+        c->entries[i] = unavail_three();
+        break;
+      }
+      case 4U:
+      {
+        c->entries[i] = entry_four(four_const(s), four_const(s));
+        break;
+      }
+      case 6U:
+      {
+        c->entries[i] = entry_six(six_const(s), six_const(s));
+        break;
+      }
+      case 2U:
+      default:
+      {
+        c->entries[i] = unavail_two();
+        break;
+      }
+    }
+  }
+}
+
+/**
+ * \brief Fills the builtins shared by every version's list from protocol
+ *        version 11 (van Rossem) onwards, with the reference default coefficients.
+ *
+ * Covers serialise_data, the secp256k1 verifiers, the additional hashes, the
+ * BLS12-381 family, the integer/byte-string conversions, the bitwise family,
+ * exp_mod_integer, the batch-6 builtins and the batch-7 builtins. Version 11
+ * unified the builtin set across the three languages, so V1 and V2 carry these
+ * entries too; the batch-7 coefficients are the same in every version.
+ *
+ * \param[in,out] c The builtin costs to fill.
+ */
+static void
+fill_shared_extension(cardano_uplc_builtin_costs_t* c)
+{
+  c->entries[CARDANO_UPLC_BUILTIN_SERIALISE_DATA]                     = entry_one(one_linear(955506, 213312), one_linear(0, 2));
+  c->entries[CARDANO_UPLC_BUILTIN_VERIFY_ECDSA_SECP256K1_SIGNATURE]   = entry_three(three_const(43053543), three_const(10));
+  c->entries[CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE] = entry_three(three_linear(CARDANO_UPLC_THREE_ARG_LINEAR_IN_Y, 43574283, 26308), three_const(10));
+
+  c->entries[CARDANO_UPLC_BUILTIN_BLAKE2B_224] = entry_one(one_linear(207616, 8310), one_const(4));
+  c->entries[CARDANO_UPLC_BUILTIN_KECCAK_256]  = entry_one(one_linear(2261318, 64571), one_const(4));
+
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_ADD]           = entry_two(two_const(962335), two_const(18));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_NEG]           = entry_one(one_const(267929), one_const(18));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_SCALAR_MUL]    = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 76433006, 8868), two_const(18));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_EQUAL]         = entry_two(two_const(442008), two_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_COMPRESS]      = entry_one(one_const(2780678), one_const(6));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_UNCOMPRESS]    = entry_one(one_const(52948122), one_const(18));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_HASH_TO_GROUP] = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 52538055, 3756), two_const(18));
+
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_ADD]           = entry_two(two_const(1995836), two_const(36));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_NEG]           = entry_one(one_const(284546), one_const(36));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_SCALAR_MUL]    = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 158221314, 26549), two_const(36));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_EQUAL]         = entry_two(two_const(901022), two_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_COMPRESS]      = entry_one(one_const(3227919), one_const(12));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_UNCOMPRESS]    = entry_one(one_const(74698472), one_const(36));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_HASH_TO_GROUP] = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 166917843, 4307), two_const(36));
+
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_MILLER_LOOP]   = entry_two(two_const(254006273), two_const(72));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_MUL_ML_RESULT] = entry_two(two_const(2174038), two_const(72));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_FINAL_VERIFY]  = entry_two(two_const(333849714), two_const(1));
+
+  c->entries[CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING] = entry_three(three_quadratic_in_z(1293828, 28716, 63), three_linear(CARDANO_UPLC_THREE_ARG_LITERAL_IN_Y_OR_LINEAR_IN_Z, 0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER] = entry_two(two_quadratic_in_y(1006041, 43623, 251), two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y, 0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_AND_BYTE_STRING]        = entry_three(three_linear_yz(100181, 726, 719), three_linear(CARDANO_UPLC_THREE_ARG_LINEAR_IN_MAX_YZ, 0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_OR_BYTE_STRING]         = entry_three(three_linear_yz(100181, 726, 719), three_linear(CARDANO_UPLC_THREE_ARG_LINEAR_IN_MAX_YZ, 0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING]        = entry_three(three_linear_yz(100181, 726, 719), three_linear(CARDANO_UPLC_THREE_ARG_LINEAR_IN_MAX_YZ, 0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_COMPLEMENT_BYTE_STRING] = entry_one(one_linear(107878, 680), one_linear(0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_READ_BIT]               = entry_two(two_const(95336), two_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_WRITE_BITS]             = entry_three(three_linear(CARDANO_UPLC_THREE_ARG_LINEAR_IN_Y, 281145, 18848), three_linear(CARDANO_UPLC_THREE_ARG_LINEAR_IN_X, 0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_REPLICATE_BYTE]         = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 180194, 159), two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 1, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_SHIFT_BYTE_STRING]      = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 158519, 8942), two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_ROTATE_BYTE_STRING]     = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 159378, 8813), two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 0, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_COUNT_SET_BITS]         = entry_one(one_linear(107490, 3298), one_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_FIND_FIRST_SET_BIT]     = entry_one(one_linear(106057, 655), one_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_RIPEMD_160]             = entry_one(one_linear(1964219, 24520), one_const(3));
+
+  c->entries[CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER] = entry_three(three_exp_mod(607153, 231697, 53144), three_linear(CARDANO_UPLC_THREE_ARG_LINEAR_IN_Z, 0, 1));
+
+  c->entries[CARDANO_UPLC_BUILTIN_DROP_LIST]       = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 116711, 1957), two_const(4));
+  c->entries[CARDANO_UPLC_BUILTIN_LENGTH_OF_ARRAY] = entry_one(one_const(231883), one_const(10));
+  c->entries[CARDANO_UPLC_BUILTIN_LIST_TO_ARRAY]   = entry_one(one_linear(1000, 24838), one_linear(7, 1));
+  c->entries[CARDANO_UPLC_BUILTIN_INDEX_ARRAY]     = entry_two(two_const(232010), two_const(32));
+
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_MULTI_SCALAR_MUL] = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 321837444, 25087669), two_const(18));
+  c->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_MULTI_SCALAR_MUL] = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_X, 617887431, 67302824), two_const(36));
+
+  c->entries[CARDANO_UPLC_BUILTIN_INSERT_COIN]    = entry_one(one_linear(390841, 30257), one_linear(47, 27));
+  c->entries[CARDANO_UPLC_BUILTIN_LOOKUP_COIN]    = entry_three(three_linear(CARDANO_UPLC_THREE_ARG_LINEAR_IN_Z, 219951, 9444), three_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_UNION_VALUE]    = entry_two(two_with_interaction(1000, 284948, 143815, 4), two_linear(CARDANO_UPLC_TWO_ARG_ADDED_SIZES, 26, 29));
+  c->entries[CARDANO_UPLC_BUILTIN_VALUE_CONTAINS] = entry_two(two_const_above_linear(213283, 618401, 1998, 28258), two_const(1));
+  c->entries[CARDANO_UPLC_BUILTIN_VALUE_DATA]     = entry_one(one_linear(1000, 38159), one_linear(2, 22));
+  c->entries[CARDANO_UPLC_BUILTIN_UN_VALUE_DATA]  = entry_one(one_quadratic(1000, 128595, 1), one_linear(14, 18));
+  c->entries[CARDANO_UPLC_BUILTIN_SCALE_VALUE]    = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y, 1000, 383231), two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y, 14, 29));
+
+  c->entries[CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY] = entry_two(two_quadratic_in_y(326163, 12304, 2), two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y, 4, 3));
+  c->entries[CARDANO_UPLC_BUILTIN_POLICIES]          = entry_one(one_linear(930912, 13220), one_linear(4, 3));
+  c->entries[CARDANO_UPLC_BUILTIN_ASSET_COUNT]       = entry_one(one_const(129043), one_const(10));
+  c->entries[CARDANO_UPLC_BUILTIN_KEEP_POLICIES]     = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_MULTIPLIED_SIZES, 335279, 57077), two_linear(CARDANO_UPLC_TWO_ARG_MULTIPLIED_SIZES, 32, 32));
+  c->entries[CARDANO_UPLC_BUILTIN_DROP_POLICIES]     = entry_two(two_linear(CARDANO_UPLC_TWO_ARG_MULTIPLIED_SIZES, 345402, 57932), two_linear(CARDANO_UPLC_TWO_ARG_MULTIPLIED_SIZES, 32, 36));
+}
+
+/**
+ * \brief Turns a const-above-diagonal division cpu into above-and-below-diagonal.
+ *
+ * Keeps the constant and the nested model coefficients. A const-above-diagonal
+ * function only changes its tag; the const-above-diagonal-into-quadratic form is
+ * rebuilt as an above-and-below-diagonal over the same two-variable quadratic.
+ * Any other shape is left unchanged.
+ *
+ * \param[in,out] fn The costing function to reshape.
+ */
+static void
+to_above_and_below_diagonal(cardano_uplc_two_arg_cost_t* fn)
+{
+  if (fn->kind == CARDANO_UPLC_TWO_ARG_CONST_ABOVE_DIAGONAL)
+  {
+    fn->kind = CARDANO_UPLC_TWO_ARG_ABOVE_AND_BELOW_DIAGONAL;
+  }
+
+  if (fn->kind == CARDANO_UPLC_TWO_ARG_CONST_ABOVE_DIAGONAL_INTO_QUADRATIC)
+  {
+    cardano_uplc_two_arg_cost_t reshaped;
+
+    (void)memset(&reshaped, 0, sizeof(reshaped));
+    reshaped.kind                                  = CARDANO_UPLC_TWO_ARG_ABOVE_AND_BELOW_DIAGONAL;
+    reshaped.params.const_diagonal.constant        = fn->params.const_above_into_quadratic.constant;
+    reshaped.params.const_diagonal.kind            = CARDANO_UPLC_DIAG_MODEL_QUADRATIC;
+    reshaped.params.const_diagonal.model.quadratic = fn->params.const_above_into_quadratic.quadratic;
+
+    *fn = reshaped;
+  }
+}
+
+/**
+ * \brief Turns a subtracted-sizes division mem into linear-in-y2.
+ *
+ * Both shapes read the same intercept, slope and minimum, so only the tag
+ * changes. Any other shape is left unchanged.
+ *
+ * \param[in,out] fn The costing function to reshape.
+ */
+static void
+to_linear_in_y2(cardano_uplc_two_arg_cost_t* fn)
+{
+  if (fn->kind == CARDANO_UPLC_TWO_ARG_SUBTRACTED_SIZES)
+  {
+    fn->kind = CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y2;
+  }
+}
+
+cardano_uplc_builtin_costs_t
+cardano_uplc_builtin_costs_v1(void)
+{
+  cardano_uplc_builtin_costs_t c;
+
+  fill_all_unavail(&c);
+  fill_v1_v2_core(&c);
+  fill_shared_extension(&c);
+
+  return c;
+}
+
+cardano_uplc_builtin_costs_t
+cardano_uplc_builtin_costs_v2(void)
+{
+  cardano_uplc_builtin_costs_t c;
+
+  fill_all_unavail(&c);
+  fill_v1_v2_core(&c);
+  fill_shared_extension(&c);
+
+  return c;
+}
+
+cardano_uplc_builtin_costs_t
+cardano_uplc_builtin_costs_v3(void)
+{
+  cardano_uplc_builtin_costs_t c;
+
+  fill_all_unavail(&c);
+  fill_v1_v2_core(&c);
+  fill_shared_extension(&c);
+
+  c.entries[CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER]    = entry_two(two_const_above_quad(85848, 85848, 123203, 1716, 7305, 57, 960, -900), two_subtracted(0, 1, 1));
+  c.entries[CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER]  = entry_two(two_const_above_quad(85848, 85848, 123203, 1716, 7305, 57, 960, -900), two_subtracted(0, 1, 1));
+  c.entries[CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER] = entry_two(two_const_above_quad(85848, 85848, 123203, 1716, 7305, 57, 960, -900), two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y, 0, 1));
+  c.entries[CARDANO_UPLC_BUILTIN_MOD_INTEGER]       = entry_two(two_const_above_quad(85848, 85848, 123203, 1716, 7305, 57, 960, -900), two_linear(CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y, 0, 1));
+
+  return c;
+}
+
+void
+cardano_uplc_builtin_costs_select_division_shapes(
+  cardano_uplc_builtin_costs_t*    costs,
+  cardano_uplc_builtin_semantics_t semantics)
+{
+  if (costs == NULL)
+  {
+    return;
+  }
+
+  switch (semantics)
+  {
+    case CARDANO_UPLC_SEMANTICS_D:
+    case CARDANO_UPLC_SEMANTICS_F:
+    {
+      to_above_and_below_diagonal(&costs->entries[CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER].cpu.two);
+      to_above_and_below_diagonal(&costs->entries[CARDANO_UPLC_BUILTIN_MOD_INTEGER].cpu.two);
+      to_linear_in_y2(&costs->entries[CARDANO_UPLC_BUILTIN_MOD_INTEGER].mem.two);
+      to_linear_in_y2(&costs->entries[CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER].mem.two);
+      break;
+    }
+    case CARDANO_UPLC_SEMANTICS_E:
+    case CARDANO_UPLC_SEMANTICS_G:
+    {
+      to_above_and_below_diagonal(&costs->entries[CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER].cpu.two);
+      to_above_and_below_diagonal(&costs->entries[CARDANO_UPLC_BUILTIN_MOD_INTEGER].cpu.two);
+      break;
+    }
+    case CARDANO_UPLC_SEMANTICS_A:
+    case CARDANO_UPLC_SEMANTICS_B:
+    case CARDANO_UPLC_SEMANTICS_C:
+    default:
+    {
+      break;
+    }
+  }
+}
+
+/**
+ * \brief Returns floor(log2(n)) for a positive count, or 0 for 0.
+ *
+ * \param[in] n The count.
+ *
+ * \return The floor of the base-2 logarithm, or 0 when \p n is 0.
+ */
+static int64_t
+floor_log2(size_t n)
+{
+  int64_t log = 0;
+
+  while (n > 1U)
+  {
+    // cppcheck-suppress misra-c2012-17.8; Reason: parameter reused as a local iteration cursor
+    n   >>= 1U;
+    log += 1;
+  }
+
+  return log;
+}
+
+/**
+ * \brief Returns the cost-model max-depth size of a value constant.
+ *
+ * The size is (log2(outer) + 1 if outer > 0 else 0) + (log2(maxInner) + 1 if
+ * maxInner > 0 else 0). Used by \c insertCoin and \c lookupCoin.
+ *
+ * \param[in] constant The value constant, or NULL.
+ *
+ * \return The max-depth size.
+ */
+static int64_t
+value_max_depth(const cardano_uplc_constant_t* constant)
+{
+  size_t  outer     = 0U;
+  size_t  max_inner = 0U;
+  size_t  i         = 0U;
+  int64_t log_outer = 0;
+  int64_t log_inner = 0;
+
+  if ((constant == NULL) || (constant->kind != CARDANO_UPLC_TYPE_VALUE))
+  {
+    return 0;
+  }
+
+  outer = constant->as.list.count;
+
+  for (i = 0U; i < outer; ++i)
+  {
+    size_t inner = cardano_uplc_value_entry_token_count(constant->as.list.items[i]);
+
+    if (inner > max_inner)
+    {
+      max_inner = inner;
+    }
+  }
+
+  log_outer = (outer > 0U) ? (floor_log2(outer) + 1) : 0;
+  log_inner = (max_inner > 0U) ? (floor_log2(max_inner) + 1) : 0;
+
+  return log_outer + log_inner;
+}
+
+/**
+ * \brief Returns the constant integer a value holds, or a fallback otherwise.
+ *
+ * Reads the integer literal of a constant integer value, used by the builtins
+ * whose cost depends on a literal argument rather than its ex-mem.
+ *
+ * \param[in] value The value to inspect, or NULL.
+ * \param[in] fallback The value returned when \p value is not a constant integer.
+ *
+ * \return The integer literal, or \p fallback.
+ */
+static int64_t
+value_integer(const cardano_uplc_value_t* value, int64_t fallback)
+{
+  if ((value == NULL) || (value->kind != CARDANO_UPLC_VALUE_CONSTANT))
+  {
+    return fallback;
+  }
+
+  if ((value->as.constant == NULL) || (value->as.constant->kind != CARDANO_UPLC_TYPE_INTEGER))
+  {
+    return fallback;
+  }
+
+  if (cardano_uplc_constant_int_is_small(value->as.constant))
+  {
+    return cardano_uplc_constant_int_small(value->as.constant);
+  }
+
+  if (value->as.constant->as.integer.big == NULL)
+  {
+    return fallback;
+  }
+
+  return cardano_bigint_to_int(value->as.constant->as.integer.big);
+}
+
+/**
+ * \brief Returns the element count a constant list value holds, or 0 otherwise.
+ *
+ * Used by \c writeBits, which feeds the length of its update list as the second
+ * cost size.
+ *
+ * \param[in] value The value to inspect, or NULL.
+ *
+ * \return The list length, or 0 when \p value is not a constant list.
+ */
+static int64_t
+value_list_len(const cardano_uplc_value_t* value)
+{
+  if ((value == NULL) || (value->kind != CARDANO_UPLC_VALUE_CONSTANT))
+  {
+    return 0;
+  }
+
+  if ((value->as.constant == NULL) || ((value->as.constant->kind != CARDANO_UPLC_TYPE_LIST) && (value->as.constant->kind != CARDANO_UPLC_TYPE_ARRAY)))
+  {
+    return (int64_t)0;
+  }
+
+  return (int64_t)value->as.constant->as.list.count;
+}
+
+/**
+ * \brief Returns the token count of a value argument, or 0 otherwise.
+ *
+ * \param[in] value The value to inspect, or NULL.
+ *
+ * \return The total token count, or 0 when \p value is not a value constant.
+ */
+static int64_t
+value_arg_token_count(const cardano_uplc_value_t* value)
+{
+  if ((value == NULL) || (value->kind != CARDANO_UPLC_VALUE_CONSTANT))
+  {
+    return 0;
+  }
+
+  return cardano_uplc_value_token_count(value->as.constant);
+}
+
+/**
+ * \brief Returns the max-depth size of a value argument, or 0 otherwise.
+ *
+ * \param[in] value The value to inspect, or NULL.
+ *
+ * \return The max-depth size, or 0 when \p value is not a value constant.
+ */
+static int64_t
+value_arg_max_depth(const cardano_uplc_value_t* value)
+{
+  if ((value == NULL) || (value->kind != CARDANO_UPLC_VALUE_CONSTANT))
+  {
+    return 0;
+  }
+
+  return value_max_depth(value->as.constant);
+}
+
+/**
+ * \brief Returns the policy count of a value argument, or 0 otherwise.
+ *
+ * The policy count is the size of the outer map. Used by \c policies.
+ *
+ * \param[in] value The value to inspect, or NULL.
+ *
+ * \return The number of policies, or 0 when \p value is not a value constant.
+ */
+static int64_t
+value_arg_policy_count(const cardano_uplc_value_t* value)
+{
+  if ((value == NULL) || (value->kind != CARDANO_UPLC_VALUE_CONSTANT))
+  {
+    return 0;
+  }
+
+  if ((value->as.constant == NULL) || (value->as.constant->kind != CARDANO_UPLC_TYPE_VALUE))
+  {
+    return 0;
+  }
+
+  return (int64_t)value->as.constant->as.list.count;
+}
+
+/**
+ * \brief Returns the outer-depth size of a value argument, or 1 otherwise.
+ *
+ * The size is log2(outer) + 1 for a value with policies and 1 for the empty
+ * value, so that a model multiplying the two argument sizes still charges for
+ * the policy list. Used by \c keepPolicies and \c dropPolicies, which locate
+ * each listed policy in the outer map and never descend an inner one.
+ *
+ * \param[in] value The value to inspect, or NULL.
+ *
+ * \return The outer-depth size.
+ */
+static int64_t
+value_arg_outer_depth(const cardano_uplc_value_t* value)
+{
+  const int64_t outer = value_arg_policy_count(value);
+
+  return (outer > 0) ? (floor_log2((size_t)outer) + 1) : 1;
+}
+
+/**
+ * \brief Returns the data-node count of a data argument, or 0 otherwise.
+ *
+ * \param[in] value The value to inspect, or NULL.
+ *
+ * \return The node count, or 0 when \p value is not a data constant.
+ */
+static int64_t
+value_arg_data_node_count(const cardano_uplc_value_t* value)
+{
+  if ((value == NULL) || (value->kind != CARDANO_UPLC_VALUE_CONSTANT))
+  {
+    return 0;
+  }
+
+  if ((value->as.constant == NULL) || (value->as.constant->kind != CARDANO_UPLC_TYPE_DATA))
+  {
+    return 0;
+  }
+
+  return cardano_uplc_data_node_count(value->as.constant->as.data);
+}
+
+/**
+ * \brief Returns the absolute value of a constant integer literal, saturating.
+ *
+ * Used by \c dropList, whose cpu cost is linear in the count it is asked to drop,
+ * taken as the absolute value of the literal (a negative drop is costed by its
+ * magnitude). A literal too large to fit a signed 64-bit value saturates to
+ * \c INT64_MAX.
+ *
+ * \param[in] value The value to inspect, or NULL.
+ *
+ * \return The saturating absolute literal, or 0 when \p value is not a constant
+ *         integer.
+ */
+static int64_t
+value_abs_integer_saturating(const cardano_uplc_value_t* value)
+{
+  const cardano_bigint_t* integer = NULL;
+
+  if ((value == NULL) || (value->kind != CARDANO_UPLC_VALUE_CONSTANT))
+  {
+    return 0;
+  }
+
+  if ((value->as.constant == NULL) || (value->as.constant->kind != CARDANO_UPLC_TYPE_INTEGER))
+  {
+    return 0;
+  }
+
+  if (cardano_uplc_constant_int_is_small(value->as.constant))
+  {
+    const int64_t raw = cardano_uplc_constant_int_small(value->as.constant);
+
+    if (raw == (int64_t)INT64_MIN)
+    {
+      return INT64_MAX;
+    }
+
+    return (raw < 0) ? -raw : raw;
+  }
+
+  integer = value->as.constant->as.integer.big;
+
+  if ((integer == NULL) || (cardano_bigint_bit_length(integer) > 63U))
+  {
+    return INT64_MAX;
+  }
+
+  {
+    const int64_t raw = cardano_bigint_to_int(integer);
+
+    if (raw == (int64_t)INT64_MIN)
+    {
+      return INT64_MAX;
+    }
+
+    return (raw < 0) ? -raw : raw;
+  }
+}
+
+/**
+ * \brief Converts a literal width to a byte-string ex-mem size, saturating.
+ *
+ * Negative widths and widths above the maximum are clamped, then the size is 0
+ * when the width is 0 else \c ((width - 1) / 8) + 1.
+ *
+ * \param[in] width The literal width.
+ *
+ * \return The byte-string ex-mem size of an output of that width.
+ */
+static int64_t
+cost_as_size(int64_t width)
+{
+  if (width <= 0)
+  {
+    return 0;
+  }
+
+  if (width > CARDANO_UPLC_COST_SIZE_MAX)
+  {
+    // cppcheck-suppress misra-c2012-17.8; Reason: parameter reused as a local iteration cursor
+    width = CARDANO_UPLC_COST_SIZE_MAX;
+  }
+
+  return ((width - 1) / CARDANO_UPLC_COST_SIZE_CHUNK) + 1;
+}
+
+/**
+ * \brief Returns the absolute value of a signed 64-bit integer, saturating.
+ *
+ * \param[in] v The value.
+ *
+ * \return The absolute value, clamped to INT64_MAX for INT64_MIN.
+ */
+static int64_t
+abs_i64(int64_t v)
+{
+  if (v == (int64_t)INT64_MIN)
+  {
+    return INT64_MAX;
+  }
+
+  return (v < 0) ? -v : v;
+}
+
+/**
+ * \brief Evaluates a builtin cost entry over up to six argument sizes.
+ *
+ * Selects the active union member by the entry arity and evaluates both the cpu
+ * and mem cost functions over the supplied sizes in a single arity dispatch.
+ *
+ * \param[in] e The builtin cost entry.
+ * \param[in] s The six argument sizes; unused sizes are ignored by the arm.
+ *
+ * \return The saturating cpu and mem cost.
+ */
+static inline cardano_uplc_budget_t
+eval_entry(const cardano_uplc_builtin_cost_t* e, const int64_t s[6])
+{
+  cardano_uplc_budget_t result = { 0, 0 };
+
+  switch (e->arity)
+  {
+    case CARDANO_UPLC_BUILTIN_COST_ARITY_ONE:
+    {
+      result.cpu = cardano_uplc_one_arg_eval(&e->cpu.one, s[0]);
+      result.mem = cardano_uplc_one_arg_eval(&e->mem.one, s[0]);
+      break;
+    }
+    case CARDANO_UPLC_BUILTIN_COST_ARITY_TWO:
+    {
+      result.cpu = cardano_uplc_two_arg_eval(&e->cpu.two, s[0], s[1]);
+      result.mem = cardano_uplc_two_arg_eval(&e->mem.two, s[0], s[1]);
+      break;
+    }
+    case CARDANO_UPLC_BUILTIN_COST_ARITY_THREE:
+    {
+      result.cpu = cardano_uplc_three_arg_eval(&e->cpu.three, s[0], s[1], s[2]);
+      result.mem = cardano_uplc_three_arg_eval(&e->mem.three, s[0], s[1], s[2]);
+      break;
+    }
+    case CARDANO_UPLC_BUILTIN_COST_ARITY_FOUR:
+    {
+      result.cpu = cardano_uplc_four_arg_eval(&e->cpu.four, s[0], s[1], s[2], s[3]);
+      result.mem = cardano_uplc_four_arg_eval(&e->mem.four, s[0], s[1], s[2], s[3]);
+      break;
+    }
+    case CARDANO_UPLC_BUILTIN_COST_ARITY_SIX:
+    {
+      result.cpu = cardano_uplc_six_arg_eval(&e->cpu.six, s[0], s[1], s[2], s[3], s[4], s[5]);
+      result.mem = cardano_uplc_six_arg_eval(&e->mem.six, s[0], s[1], s[2], s[3], s[4], s[5]);
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Returns the ex-mem size of an argument value, fast-pathing the common kinds.
+ *
+ * Inlines the integer and byte-string measures that dominate the builtin call path
+ * and uses the value-level ex-mem cache so its result is identical to
+ * \ref cardano_uplc_value_ex_mem. Falls back to the general routine for every other
+ * value shape.
+ *
+ * \param[in] value The argument value, or NULL.
+ * \param[in] costs_strings_by_utf8_bytes The string-measure flag for the fallback.
+ *
+ * \return The ex-mem size of \p value.
+ */
+static inline int64_t
+arg_ex_mem(const cardano_uplc_value_t* value, bool costs_strings_by_utf8_bytes)
+{
+  const cardano_uplc_constant_t* k = NULL;
+
+  if (value == NULL)
+  {
+    return 0;
+  }
+
+  if (value->ex_mem != CARDANO_UPLC_VALUE_EX_MEM_UNCOMPUTED)
+  {
+    return value->ex_mem;
+  }
+
+  if (value->kind == CARDANO_UPLC_VALUE_CONSTANT)
+  {
+    k = value->as.constant;
+
+    if ((k != NULL) && (k->kind == CARDANO_UPLC_TYPE_INTEGER) && k->as.integer.is_small)
+    {
+      // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+      ((cardano_uplc_value_t*)((void*)value))->ex_mem = 1;
+
+      return 1;
+    }
+
+    if ((k != NULL) && (k->kind == CARDANO_UPLC_TYPE_BYTE_STRING))
+    {
+      int64_t total = cardano_uplc_byte_string_ex_mem(k->as.bytes.size);
+
+      // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+      ((cardano_uplc_value_t*)((void*)value))->ex_mem = total;
+
+      return total;
+    }
+  }
+
+  return cardano_uplc_value_ex_mem(value, costs_strings_by_utf8_bytes);
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_uplc_budget_t
+cardano_uplc_builtin_cost(
+  const cardano_uplc_builtin_costs_t* costs,
+  cardano_uplc_builtin_t              func,
+  const cardano_uplc_value_t* const*  args,
+  size_t                              arg_count,
+  bool                                costs_strings_by_utf8_bytes)
+{
+  cardano_uplc_budget_t              result = { 0, 0 };
+  const cardano_uplc_builtin_cost_t* e      = NULL;
+  int64_t                            s[6]   = { 0, 0, 0, 0, 0, 0 };
+  size_t                             i      = 0U;
+
+  if ((costs == NULL) || ((size_t)func >= (size_t)CARDANO_UPLC_BUILTIN_COUNT))
+  {
+    return result;
+  }
+
+  e = &costs->entries[(size_t)func];
+
+  for (i = 0U; (i < arg_count) && (i < 6U); ++i)
+  {
+    const cardano_uplc_value_t* arg = (args != NULL) ? args[i] : NULL;
+    s[i]                            = arg_ex_mem(arg, costs_strings_by_utf8_bytes);
+  }
+
+  if (func == CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING)
+  {
+    if (arg_count > 1U)
+    {
+      s[1] = cost_as_size(value_integer((args != NULL) ? args[1] : NULL, 0));
+    }
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_REPLICATE_BYTE)
+  {
+    if (arg_count > 0U)
+    {
+      s[0] = cost_as_size(value_integer((args != NULL) ? args[0] : NULL, 0));
+    }
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_WRITE_BITS)
+  {
+    if (arg_count > 1U)
+    {
+      s[1] = value_list_len((args != NULL) ? args[1] : NULL);
+    }
+  }
+  else if ((func == CARDANO_UPLC_BUILTIN_SHIFT_BYTE_STRING) || (func == CARDANO_UPLC_BUILTIN_ROTATE_BYTE_STRING))
+  {
+    if (arg_count > 1U)
+    {
+      s[1] = abs_i64(value_integer((args != NULL) ? args[1] : NULL, 0));
+    }
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_DROP_LIST)
+  {
+    if (arg_count > 0U)
+    {
+      s[0] = value_abs_integer_saturating((args != NULL) ? args[0] : NULL);
+    }
+
+    if (arg_count > 1U)
+    {
+      s[1] = value_list_len((args != NULL) ? args[1] : NULL);
+    }
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_LIST_TO_ARRAY)
+  {
+    if (arg_count > 0U)
+    {
+      s[0] = value_list_len((args != NULL) ? args[0] : NULL);
+    }
+  }
+  else if ((func == CARDANO_UPLC_BUILTIN_BLS12_381_G1_MULTI_SCALAR_MUL) || (func == CARDANO_UPLC_BUILTIN_BLS12_381_G2_MULTI_SCALAR_MUL) || (func == CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY))
+  {
+    if (arg_count > 0U)
+    {
+      s[0] = value_list_len((args != NULL) ? args[0] : NULL);
+    }
+
+    if (arg_count > 1U)
+    {
+      s[1] = value_list_len((args != NULL) ? args[1] : NULL);
+    }
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_INSERT_COIN)
+  {
+    if (arg_count > 3U)
+    {
+      s[0] = value_arg_max_depth((args != NULL) ? args[3] : NULL);
+    }
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_LOOKUP_COIN)
+  {
+    if (arg_count > 2U)
+    {
+      s[2] = value_arg_max_depth((args != NULL) ? args[2] : NULL);
+    }
+  }
+  else if ((func == CARDANO_UPLC_BUILTIN_UNION_VALUE) || (func == CARDANO_UPLC_BUILTIN_VALUE_CONTAINS))
+  {
+    if (arg_count > 0U)
+    {
+      s[0] = value_arg_token_count((args != NULL) ? args[0] : NULL);
+    }
+
+    if (arg_count > 1U)
+    {
+      s[1] = value_arg_token_count((args != NULL) ? args[1] : NULL);
+    }
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_VALUE_DATA)
+  {
+    if (arg_count > 0U)
+    {
+      s[0] = value_arg_token_count((args != NULL) ? args[0] : NULL);
+    }
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_UN_VALUE_DATA)
+  {
+    if (arg_count > 0U)
+    {
+      s[0] = value_arg_data_node_count((args != NULL) ? args[0] : NULL);
+    }
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_SCALE_VALUE)
+  {
+    if (arg_count > 1U)
+    {
+      s[1] = value_arg_token_count((args != NULL) ? args[1] : NULL);
+    }
+  }
+  else if (func == CARDANO_UPLC_BUILTIN_POLICIES)
+  {
+    if (arg_count > 0U)
+    {
+      s[0] = value_arg_policy_count((args != NULL) ? args[0] : NULL);
+    }
+  }
+  else if ((func == CARDANO_UPLC_BUILTIN_KEEP_POLICIES) || (func == CARDANO_UPLC_BUILTIN_DROP_POLICIES))
+  {
+    if (arg_count > 0U)
+    {
+      s[0] = value_list_len((args != NULL) ? args[0] : NULL);
+    }
+
+    if (arg_count > 1U)
+    {
+      s[1] = value_arg_outer_depth((args != NULL) ? args[1] : NULL);
+    }
+  }
+  else
+  {
+    /* No literal-derived size; all sizes are ex-mem. */
+  }
+
+  result = eval_entry(e, s);
+
+  return result;
+}
diff --git a/vendor/src/uplc/cost/uplc_builtin_costs.h b/vendor/src/uplc/cost/uplc_builtin_costs.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_builtin_costs.h
@@ -0,0 +1,159 @@
+/**
+ * \file uplc_builtin_costs.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_BUILTIN_COSTS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_BUILTIN_COSTS_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_builtin_cost.h"
+
+#include "../builtins/uplc_builtin.h"
+#include "../builtins/uplc_builtin_semantics.h"
+#include "../machine/uplc_budget.h"
+#include <cardano/typedefs.h>
+
+/* FORWARD DECLARATIONS ******************************************************/
+
+#ifndef CARDANO_UPLC_VALUE_T_FORWARD_DECLARED
+#define CARDANO_UPLC_VALUE_T_FORWARD_DECLARED
+typedef struct cardano_uplc_value_t cardano_uplc_value_t;
+#endif /* CARDANO_UPLC_VALUE_T_FORWARD_DECLARED */
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The cpu/mem costing functions of every builtin, indexed by tag.
+ *
+ * Holds one \ref cardano_uplc_builtin_cost_t per \ref cardano_uplc_builtin_t,
+ * indexable by the builtin tag. Builtins not available in a version carry the
+ * prohibitive sentinel cost.
+ */
+typedef struct cardano_uplc_builtin_costs_t
+{
+    /** \brief The per-builtin costing functions, indexed by builtin tag. */
+    cardano_uplc_builtin_cost_t entries[CARDANO_UPLC_BUILTIN_COUNT];
+} cardano_uplc_builtin_costs_t;
+
+/**
+ * \brief Returns the default Plutus V1 per-builtin costing functions.
+ *
+ * The coefficients are those of the reference builtin cost model D, which the
+ * V1 and V2 languages read from protocol version 11 (van Rossem). The integer
+ * division shapes are those of cost model B until
+ * \ref cardano_uplc_builtin_costs_select_division_shapes reshapes them. Builtins
+ * without a costing function carry the prohibitive sentinel cost.
+ *
+ * \return The V1 builtin costs by value.
+ */
+cardano_uplc_builtin_costs_t
+cardano_uplc_builtin_costs_v1(void);
+
+/**
+ * \brief Returns the default Plutus V2 per-builtin costing functions.
+ *
+ * Identical to \ref cardano_uplc_builtin_costs_v1, since both read builtin
+ * cost model D.
+ *
+ * \return The V2 builtin costs by value.
+ */
+cardano_uplc_builtin_costs_t
+cardano_uplc_builtin_costs_v2(void);
+
+/**
+ * \brief Returns the default Plutus V3 and V4 per-builtin costing functions.
+ *
+ * The coefficients are those of the reference builtin cost model E, which V3
+ * reads from protocol version 11 (van Rossem) and V4 always reads. The integer
+ * division shapes are those of cost model C until
+ * \ref cardano_uplc_builtin_costs_select_division_shapes reshapes them.
+ *
+ * \return The V3 builtin costs by value.
+ */
+cardano_uplc_builtin_costs_t
+cardano_uplc_builtin_costs_v3(void);
+
+/**
+ * \brief Reshapes the integer-division costing functions for a semantics variant.
+ *
+ * The ledger overlays its parameters on the builtin cost model of the semantics
+ * variant: A, B and C read cost models A, B and C, D and F read cost model D, and
+ * E and G read cost model E. The parameter lists are the same for every variant;
+ * cost models D and E only interpret some division parameters with other shapes.
+ * Under D, E, F and G the cpu of divideInteger and modInteger becomes
+ * above-and-below-diagonal: the nested model of the const-above-diagonal shape is
+ * evaluated at (max(x, y), min(x, y)) on both sides of the diagonal, and the
+ * constant is no longer charged. Under D and F the mem of modInteger and
+ * remainderInteger becomes linear-in-y2, which is linear in y and keeps the
+ * subtracted-sizes minimum unread. quotientInteger keeps its shapes. Under A, B
+ * and C nothing changes.
+ *
+ * Only const-above-diagonal and const-above-diagonal-into-quadratic cpu functions
+ * and subtracted-sizes mem functions are reshaped, keeping their coefficients;
+ * any other shape is left as is, so applying the same variant twice is harmless.
+ *
+ * \param[in,out] costs The builtin costs to reshape. Ignored when NULL.
+ * \param[in] semantics The semantics variant selecting the cost model shapes.
+ */
+void
+cardano_uplc_builtin_costs_select_division_shapes(
+  cardano_uplc_builtin_costs_t*    costs,
+  cardano_uplc_builtin_semantics_t semantics);
+
+/**
+ * \brief Computes the cpu and mem budget a builtin charges for its arguments.
+ *
+ * Computes each argument's ex-mem and feeds the right sizes to the builtin's cpu
+ * and mem costing functions. Most builtins feed the ex-mem
+ * of each argument; a few feed a literal-derived size (\c integerToByteString and
+ * \c replicateByte feed a width derived from an integer literal, \c writeBits
+ * feeds the update-list length, and \c shiftByteString and \c rotateByteString
+ * feed the absolute shift literal). When an argument the size depends on is
+ * missing or of the wrong shape, the size used is 0.
+ *
+ * \param[in] costs The per-builtin costs to charge against. Must not be NULL.
+ * \param[in] func The builtin being applied.
+ * \param[in] args The saturated argument values, in application order. May be
+ *            NULL only when \p arg_count is 0.
+ * \param[in] arg_count The number of arguments applied.
+ * \param[in] costs_strings_by_utf8_bytes Selects the string ex-mem measure, as in
+ *            \ref cardano_uplc_string_ex_mem.
+ *
+ * \return The cpu and mem budget the builtin charges. A NULL \p costs or an
+ *         out-of-range \p func yields a zero budget.
+ */
+cardano_uplc_budget_t
+cardano_uplc_builtin_cost(
+  const cardano_uplc_builtin_costs_t* costs,
+  cardano_uplc_builtin_t              func,
+  const cardano_uplc_value_t* const*  args,
+  size_t                              arg_count,
+  bool                                costs_strings_by_utf8_bytes);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_BUILTIN_COSTS_H */
diff --git a/vendor/src/uplc/cost/uplc_const_or_linear_cost.h b/vendor/src/uplc/cost/uplc_const_or_linear_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_const_or_linear_cost.h
@@ -0,0 +1,55 @@
+/**
+ * \file uplc_const_or_linear_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_CONST_OR_LINEAR_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_CONST_OR_LINEAR_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A diagonal cost: \c intercept + \c slope * x on the diagonal, else \c constant.
+ *
+ * When x equals y the linear term applies, otherwise the flat \c constant is
+ * charged.
+ */
+typedef struct cardano_uplc_const_or_linear_cost_t
+{
+    /** \brief The flat cost charged off the diagonal. */
+    int64_t constant;
+    /** \brief The constant term of the on-diagonal linear cost. */
+    int64_t intercept;
+    /** \brief The slope of the on-diagonal linear cost. */
+    int64_t slope;
+} cardano_uplc_const_or_linear_cost_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_CONST_OR_LINEAR_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_const_or_two_arg_cost.h b/vendor/src/uplc/cost/uplc_const_or_two_arg_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_const_or_two_arg_cost.h
@@ -0,0 +1,116 @@
+/**
+ * \file uplc_const_or_two_arg_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_CONST_OR_TWO_ARG_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_CONST_OR_TWO_ARG_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_cost_sat.h"
+#include "uplc_diag_model_kind.h"
+#include "uplc_linear_cost.h"
+#include "uplc_two_var_linear_cost.h"
+#include "uplc_two_var_quadratic_cost.h"
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A const-above/below-diagonal cost: a flat constant plus a nested model.
+ *
+ * Off the diagonal the flat \c constant is charged; on the relevant side of the
+ * diagonal the nested model selected by \c kind is evaluated over (x, y). The
+ * nested model is restricted to the shapes that actually occur.
+ */
+typedef struct cardano_uplc_const_or_two_arg_cost_t
+{
+    /** \brief The flat cost charged on the constant side of the diagonal. */
+    int64_t constant;
+    /** \brief Selects which member of \c model is active. */
+    cardano_uplc_diag_model_kind_t kind;
+
+    /** \brief The nested off-diagonal model. */
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        /** \brief Active when kind is LINEAR_IN_X_AND_Y. */
+        cardano_uplc_two_var_linear_cost_t linear_in_x_and_y;
+        /** \brief Active when kind is MULTIPLIED_SIZES. */
+        cardano_uplc_linear_cost_t multiplied_sizes;
+        /** \brief Active when kind is QUADRATIC. */
+        cardano_uplc_two_var_quadratic_cost_t quadratic;
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } model;
+} cardano_uplc_const_or_two_arg_cost_t;
+
+/**
+ * \brief Evaluates the nested off-diagonal model of a const-diagonal arm.
+ *
+ * Dispatches on the nested model kind and evaluates it over (x, y), restricted
+ * to the shapes that occur in the default tables.
+ *
+ * \param[in] c The const-or-two-argument parameters.
+ * \param[in] x The first size argument.
+ * \param[in] y The second size argument.
+ *
+ * \return The saturating cost of the nested model at (x, y).
+ */
+static inline int64_t
+cardano_uplc_const_or_two_arg_cost_eval(cardano_uplc_const_or_two_arg_cost_t c, int64_t x, int64_t y)
+{
+  int64_t result = 0;
+
+  switch (c.kind)
+  {
+    case CARDANO_UPLC_DIAG_MODEL_LINEAR_IN_X_AND_Y:
+    {
+      result = cardano_uplc_two_var_linear_cost_eval(c.model.linear_in_x_and_y, x, y);
+      break;
+    }
+    case CARDANO_UPLC_DIAG_MODEL_MULTIPLIED_SIZES:
+    {
+      result = cardano_uplc_linear_cost_eval(c.model.multiplied_sizes, sat_mul(x, y));
+      break;
+    }
+    case CARDANO_UPLC_DIAG_MODEL_QUADRATIC:
+    {
+      result = cardano_uplc_two_var_quadratic_cost_eval(c.model.quadratic, x, y);
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_CONST_OR_TWO_ARG_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_cost_model.c b/vendor/src/uplc/cost/uplc_cost_model.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_cost_model.c
@@ -0,0 +1,955 @@
+/**
+ * \file uplc_cost_model.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_cost_model.h"
+#include "../builtins/uplc_builtin.h"
+#include "uplc_builtin_costs.h"
+#include "uplc_machine_costs.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Overwrites the two coefficients of a one-argument linear cpu and mem.
+ *
+ * \param[in,out] e The entry whose one-argument linear functions are set.
+ * \param[in] p The parameter array.
+ * \param[in] cpu_i The intercept index of the cpu function.
+ * \param[in] cpu_s The slope index of the cpu function.
+ * \param[in] mem_i The intercept index of the mem function.
+ * \param[in] mem_s The slope index of the mem function.
+ */
+static void
+set_one_lin(cardano_uplc_builtin_cost_t* e, const int64_t* p, size_t cpu_i, size_t cpu_s, size_t mem_i, size_t mem_s)
+{
+  e->cpu.one.params.linear.intercept = p[cpu_i];
+  e->cpu.one.params.linear.slope     = p[cpu_s];
+  e->mem.one.params.linear.intercept = p[mem_i];
+  e->mem.one.params.linear.slope     = p[mem_s];
+}
+
+/**
+ * \brief Overwrites a one-argument linear cpu and a constant mem.
+ *
+ * \param[in,out] e The entry to set.
+ * \param[in] p The parameter array.
+ * \param[in] cpu_i The cpu intercept index.
+ * \param[in] cpu_s The cpu slope index.
+ * \param[in] mem_c The mem constant index.
+ */
+static void
+set_one_lin_cpu_const_mem(cardano_uplc_builtin_cost_t* e, const int64_t* p, size_t cpu_i, size_t cpu_s, size_t mem_c)
+{
+  e->cpu.one.params.linear.intercept = p[cpu_i];
+  e->cpu.one.params.linear.slope     = p[cpu_s];
+  e->mem.one.params.constant         = p[mem_c];
+}
+
+/**
+ * \brief Overwrites a one-argument constant cpu and mem.
+ *
+ * \param[in,out] e The entry to set.
+ * \param[in] p The parameter array.
+ * \param[in] cpu_c The cpu constant index.
+ * \param[in] mem_c The mem constant index.
+ */
+static void
+set_one_const(cardano_uplc_builtin_cost_t* e, const int64_t* p, size_t cpu_c, size_t mem_c)
+{
+  e->cpu.one.params.constant = p[cpu_c];
+  e->mem.one.params.constant = p[mem_c];
+}
+
+/**
+ * \brief Overwrites a two-argument linear cpu and mem (both plain linear arms).
+ *
+ * \param[in,out] e The entry to set.
+ * \param[in] p The parameter array.
+ * \param[in] cpu_i The cpu intercept index.
+ * \param[in] cpu_s The cpu slope index.
+ * \param[in] mem_i The mem intercept index.
+ * \param[in] mem_s The mem slope index.
+ */
+static void
+set_two_lin(cardano_uplc_builtin_cost_t* e, const int64_t* p, size_t cpu_i, size_t cpu_s, size_t mem_i, size_t mem_s)
+{
+  e->cpu.two.params.linear.intercept = p[cpu_i];
+  e->cpu.two.params.linear.slope     = p[cpu_s];
+  e->mem.two.params.linear.intercept = p[mem_i];
+  e->mem.two.params.linear.slope     = p[mem_s];
+}
+
+/**
+ * \brief Overwrites a two-argument constant cpu and mem.
+ *
+ * \param[in,out] e The entry to set.
+ * \param[in] p The parameter array.
+ * \param[in] cpu_c The cpu constant index.
+ * \param[in] mem_c The mem constant index.
+ */
+static void
+set_two_const(cardano_uplc_builtin_cost_t* e, const int64_t* p, size_t cpu_c, size_t mem_c)
+{
+  e->cpu.two.params.constant = p[cpu_c];
+  e->mem.two.params.constant = p[mem_c];
+}
+
+/**
+ * \brief Sets the budget of a machine step kind from a cpu and mem index.
+ *
+ * \param[out] b The budget to set.
+ * \param[in] p The parameter array.
+ * \param[in] cpu_i The cpu index.
+ * \param[in] mem_i The mem index.
+ */
+static void
+set_budget(cardano_uplc_budget_t* b, const int64_t* p, size_t cpu_i, size_t mem_i)
+{
+  b->cpu = p[cpu_i];
+  b->mem = p[mem_i];
+}
+
+/**
+ * \brief Fills the machine-step costs shared by V1, V2 and V3 from params.
+ *
+ * The machine-step indices are identical across the three versions; constr and
+ * case are V3-only and are set by the V3 path.
+ *
+ * \param[out] m The machine costs to populate.
+ * \param[in] p The parameter array.
+ */
+static void
+fill_machine_common(cardano_uplc_machine_costs_t* m, const int64_t* p)
+{
+  set_budget(&m->apply, p, 17U, 18U);
+  set_budget(&m->builtin, p, 19U, 20U);
+  set_budget(&m->constant, p, 21U, 22U);
+  set_budget(&m->delay, p, 23U, 24U);
+  set_budget(&m->force, p, 25U, 26U);
+  set_budget(&m->lambda, p, 27U, 28U);
+  set_budget(&m->startup, p, 29U, 30U);
+  set_budget(&m->var_step, p, 31U, 32U);
+}
+
+/**
+ * \brief Fills the integer-division entries shared by V1 and V2 from params.
+ *
+ * Divide, quotient, remainder and mod all carry the same const-above-diagonal
+ * over multiplied-sizes cpu shape and subtracted-sizes mem shape under the V1/V2
+ * semantics, and each reads its own constant/intercept/slope/minimum indices.
+ *
+ * \param[in,out] e The entry to set.
+ * \param[in] p The parameter array.
+ * \param[in] cpu_c The cpu off-diagonal constant index.
+ * \param[in] cpu_i The cpu model intercept index.
+ * \param[in] cpu_s The cpu model slope index.
+ * \param[in] mem_i The mem intercept index.
+ * \param[in] mem_min The mem minimum index.
+ * \param[in] mem_s The mem slope index.
+ */
+static void
+set_v12_div(
+  cardano_uplc_builtin_cost_t* e,
+  const int64_t*               p,
+  size_t                       cpu_c,
+  size_t                       cpu_i,
+  size_t                       cpu_s,
+  size_t                       mem_i,
+  size_t                       mem_min,
+  size_t                       mem_s)
+{
+  e->cpu.two.params.const_diagonal.constant                         = p[cpu_c];
+  e->cpu.two.params.const_diagonal.model.multiplied_sizes.intercept = p[cpu_i];
+  e->cpu.two.params.const_diagonal.model.multiplied_sizes.slope     = p[cpu_s];
+  e->mem.two.params.subtracted_sizes.intercept                      = p[mem_i];
+  e->mem.two.params.subtracted_sizes.minimum                        = p[mem_min];
+  e->mem.two.params.subtracted_sizes.slope                          = p[mem_s];
+}
+
+/**
+ * \brief Fills the BLS12-381 builtin block from a contiguous run of 38 params.
+ *
+ * The run is ordered g1_add, g1_compress, g1_equal, g1_hash_to_group, g1_neg,
+ * g1_scalar_mul, g1_uncompress, the same seven for g2, then final_verify,
+ * miller_loop and mul_ml_result; the order is identical in every version's list.
+ *
+ * \param[in,out] b The builtin costs to fill.
+ * \param[in] p The parameter array.
+ * \param[in] base The index of the first parameter of the run.
+ */
+static void
+fill_bls(cardano_uplc_builtin_costs_t* b, const int64_t* p, size_t base)
+{
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_ADD], p, base + 0U, base + 1U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_COMPRESS], p, base + 2U, base + 3U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_EQUAL], p, base + 4U, base + 5U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_HASH_TO_GROUP].cpu.two.params.linear.intercept = p[base + 6U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_HASH_TO_GROUP].cpu.two.params.linear.slope     = p[base + 7U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_HASH_TO_GROUP].mem.two.params.constant         = p[base + 8U];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_NEG], p, base + 9U, base + 10U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_SCALAR_MUL].cpu.two.params.linear.intercept = p[base + 11U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_SCALAR_MUL].cpu.two.params.linear.slope     = p[base + 12U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_SCALAR_MUL].mem.two.params.constant         = p[base + 13U];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_UNCOMPRESS], p, base + 14U, base + 15U);
+
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_ADD], p, base + 16U, base + 17U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_COMPRESS], p, base + 18U, base + 19U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_EQUAL], p, base + 20U, base + 21U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_HASH_TO_GROUP].cpu.two.params.linear.intercept = p[base + 22U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_HASH_TO_GROUP].cpu.two.params.linear.slope     = p[base + 23U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_HASH_TO_GROUP].mem.two.params.constant         = p[base + 24U];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_NEG], p, base + 25U, base + 26U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_SCALAR_MUL].cpu.two.params.linear.intercept = p[base + 27U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_SCALAR_MUL].cpu.two.params.linear.slope     = p[base + 28U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_SCALAR_MUL].mem.two.params.constant         = p[base + 29U];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_UNCOMPRESS], p, base + 30U, base + 31U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_FINAL_VERIFY], p, base + 32U, base + 33U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_MILLER_LOOP], p, base + 34U, base + 35U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_MUL_ML_RESULT], p, base + 36U, base + 37U);
+}
+
+/**
+ * \brief Fills keccak_256 and blake2b_224 from a contiguous run of 6 params.
+ *
+ * \param[in,out] b The builtin costs to fill.
+ * \param[in] p The parameter array.
+ * \param[in] base The index of the first parameter of the run.
+ */
+static void
+fill_keccak_blake224(cardano_uplc_builtin_costs_t* b, const int64_t* p, size_t base)
+{
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_KECCAK_256], p, base + 0U, base + 1U, base + 2U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_BLAKE2B_224], p, base + 3U, base + 4U, base + 5U);
+}
+
+/**
+ * \brief Fills the integer/byte-string conversions from a contiguous run of 10 params.
+ *
+ * \param[in,out] b The builtin costs to fill.
+ * \param[in] p The parameter array.
+ * \param[in] base The index of the first parameter of the run.
+ */
+static void
+fill_int_bytestring_conversions(cardano_uplc_builtin_costs_t* b, const int64_t* p, size_t base)
+{
+  b->entries[CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING].cpu.three.params.quadratic_in_z.coeff_0 = p[base + 0U];
+  b->entries[CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING].cpu.three.params.quadratic_in_z.coeff_1 = p[base + 1U];
+  b->entries[CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING].cpu.three.params.quadratic_in_z.coeff_2 = p[base + 2U];
+  b->entries[CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING].mem.three.params.linear.intercept       = p[base + 3U];
+  b->entries[CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING].mem.three.params.linear.slope           = p[base + 4U];
+
+  b->entries[CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER].cpu.two.params.quadratic_in_y.coeff_0 = p[base + 5U];
+  b->entries[CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER].cpu.two.params.quadratic_in_y.coeff_1 = p[base + 6U];
+  b->entries[CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER].cpu.two.params.quadratic_in_y.coeff_2 = p[base + 7U];
+  b->entries[CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER].mem.two.params.linear.intercept       = p[base + 8U];
+  b->entries[CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER].mem.two.params.linear.slope           = p[base + 9U];
+}
+
+/**
+ * \brief Fills the bitwise builtin block from a contiguous run of 46 params.
+ *
+ * The run is ordered and/or/xor, complement, read_bit, write_bits, replicate_byte,
+ * shift, rotate, count_set_bits, find_first_set_bit and ripemd_160; the order is
+ * identical in every version's list.
+ *
+ * \param[in,out] b The builtin costs to fill.
+ * \param[in] p The parameter array.
+ * \param[in] base The index of the first parameter of the run.
+ */
+static void
+fill_bitwise(cardano_uplc_builtin_costs_t* b, const int64_t* p, size_t base)
+{
+  b->entries[CARDANO_UPLC_BUILTIN_AND_BYTE_STRING].cpu.three.params.linear_in_y_and_z.intercept = p[base + 0U];
+  b->entries[CARDANO_UPLC_BUILTIN_AND_BYTE_STRING].cpu.three.params.linear_in_y_and_z.slope1    = p[base + 1U];
+  b->entries[CARDANO_UPLC_BUILTIN_AND_BYTE_STRING].cpu.three.params.linear_in_y_and_z.slope2    = p[base + 2U];
+  b->entries[CARDANO_UPLC_BUILTIN_AND_BYTE_STRING].mem.three.params.linear.intercept            = p[base + 3U];
+  b->entries[CARDANO_UPLC_BUILTIN_AND_BYTE_STRING].mem.three.params.linear.slope                = p[base + 4U];
+
+  b->entries[CARDANO_UPLC_BUILTIN_OR_BYTE_STRING].cpu.three.params.linear_in_y_and_z.intercept = p[base + 5U];
+  b->entries[CARDANO_UPLC_BUILTIN_OR_BYTE_STRING].cpu.three.params.linear_in_y_and_z.slope1    = p[base + 6U];
+  b->entries[CARDANO_UPLC_BUILTIN_OR_BYTE_STRING].cpu.three.params.linear_in_y_and_z.slope2    = p[base + 7U];
+  b->entries[CARDANO_UPLC_BUILTIN_OR_BYTE_STRING].mem.three.params.linear.intercept            = p[base + 8U];
+  b->entries[CARDANO_UPLC_BUILTIN_OR_BYTE_STRING].mem.three.params.linear.slope                = p[base + 9U];
+
+  b->entries[CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING].cpu.three.params.linear_in_y_and_z.intercept = p[base + 10U];
+  b->entries[CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING].cpu.three.params.linear_in_y_and_z.slope1    = p[base + 11U];
+  b->entries[CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING].cpu.three.params.linear_in_y_and_z.slope2    = p[base + 12U];
+  b->entries[CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING].mem.three.params.linear.intercept            = p[base + 13U];
+  b->entries[CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING].mem.three.params.linear.slope                = p[base + 14U];
+
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_COMPLEMENT_BYTE_STRING], p, base + 15U, base + 16U, base + 17U, base + 18U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_READ_BIT], p, base + 19U, base + 20U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_WRITE_BITS].cpu.three.params.linear.intercept = p[base + 21U];
+  b->entries[CARDANO_UPLC_BUILTIN_WRITE_BITS].cpu.three.params.linear.slope     = p[base + 22U];
+  b->entries[CARDANO_UPLC_BUILTIN_WRITE_BITS].mem.three.params.linear.intercept = p[base + 23U];
+  b->entries[CARDANO_UPLC_BUILTIN_WRITE_BITS].mem.three.params.linear.slope     = p[base + 24U];
+
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_REPLICATE_BYTE], p, base + 25U, base + 26U, base + 27U, base + 28U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_SHIFT_BYTE_STRING], p, base + 29U, base + 30U, base + 31U, base + 32U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_ROTATE_BYTE_STRING], p, base + 33U, base + 34U, base + 35U, base + 36U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_COUNT_SET_BITS], p, base + 37U, base + 38U, base + 39U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_FIND_FIRST_SET_BIT], p, base + 40U, base + 41U, base + 42U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_RIPEMD_160], p, base + 43U, base + 44U, base + 45U);
+}
+
+/**
+ * \brief Fills exp_mod_integer from a contiguous run of 5 params.
+ *
+ * \param[in,out] b The builtin costs to fill.
+ * \param[in] p The parameter array.
+ * \param[in] base The index of the first parameter of the run.
+ */
+static void
+fill_exp_mod(cardano_uplc_builtin_costs_t* b, const int64_t* p, size_t base)
+{
+  b->entries[CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER].cpu.three.params.exp_mod.coeff_00 = p[base + 0U];
+  b->entries[CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER].cpu.three.params.exp_mod.coeff_11 = p[base + 1U];
+  b->entries[CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER].cpu.three.params.exp_mod.coeff_12 = p[base + 2U];
+  b->entries[CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER].mem.three.params.linear.intercept = p[base + 3U];
+  b->entries[CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER].mem.three.params.linear.slope     = p[base + 4U];
+}
+
+/**
+ * \brief Fills the batch-6 builtins from a contiguous run of 48 params.
+ *
+ * The run is ordered drop_list, length_of_array, list_to_array, index_array, the
+ * two multi-scalar multiplications, then the builtin Value family insert_coin,
+ * lookup_coin, union_value, value_contains, value_data, un_value_data and
+ * scale_value; the order is identical in every version's list.
+ *
+ * \param[in,out] b The builtin costs to fill.
+ * \param[in] p The parameter array.
+ * \param[in] base The index of the first parameter of the run.
+ */
+static void
+fill_batch6(cardano_uplc_builtin_costs_t* b, const int64_t* p, size_t base)
+{
+  b->entries[CARDANO_UPLC_BUILTIN_DROP_LIST].cpu.two.params.linear.intercept = p[base + 0U];
+  b->entries[CARDANO_UPLC_BUILTIN_DROP_LIST].cpu.two.params.linear.slope     = p[base + 1U];
+  b->entries[CARDANO_UPLC_BUILTIN_DROP_LIST].mem.two.params.constant         = p[base + 2U];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_LENGTH_OF_ARRAY], p, base + 3U, base + 4U);
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_LIST_TO_ARRAY], p, base + 5U, base + 6U, base + 7U, base + 8U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_INDEX_ARRAY], p, base + 9U, base + 10U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_MULTI_SCALAR_MUL].cpu.two.params.linear.intercept = p[base + 11U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_MULTI_SCALAR_MUL].cpu.two.params.linear.slope     = p[base + 12U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G1_MULTI_SCALAR_MUL].mem.two.params.constant         = p[base + 13U];
+
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_MULTI_SCALAR_MUL].cpu.two.params.linear.intercept = p[base + 14U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_MULTI_SCALAR_MUL].cpu.two.params.linear.slope     = p[base + 15U];
+  b->entries[CARDANO_UPLC_BUILTIN_BLS12_381_G2_MULTI_SCALAR_MUL].mem.two.params.constant         = p[base + 16U];
+
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_INSERT_COIN], p, base + 17U, base + 18U, base + 19U, base + 20U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_LOOKUP_COIN].cpu.three.params.linear.intercept = p[base + 21U];
+  b->entries[CARDANO_UPLC_BUILTIN_LOOKUP_COIN].cpu.three.params.linear.slope     = p[base + 22U];
+  b->entries[CARDANO_UPLC_BUILTIN_LOOKUP_COIN].mem.three.params.constant         = p[base + 23U];
+
+  b->entries[CARDANO_UPLC_BUILTIN_UNION_VALUE].cpu.two.params.with_interaction.c00 = p[base + 24U];
+  b->entries[CARDANO_UPLC_BUILTIN_UNION_VALUE].cpu.two.params.with_interaction.c10 = p[base + 25U];
+  b->entries[CARDANO_UPLC_BUILTIN_UNION_VALUE].cpu.two.params.with_interaction.c01 = p[base + 26U];
+  b->entries[CARDANO_UPLC_BUILTIN_UNION_VALUE].cpu.two.params.with_interaction.c11 = p[base + 27U];
+  b->entries[CARDANO_UPLC_BUILTIN_UNION_VALUE].mem.two.params.linear.intercept     = p[base + 28U];
+  b->entries[CARDANO_UPLC_BUILTIN_UNION_VALUE].mem.two.params.linear.slope         = p[base + 29U];
+
+  b->entries[CARDANO_UPLC_BUILTIN_VALUE_CONTAINS].cpu.two.params.const_diagonal.constant                          = p[base + 30U];
+  b->entries[CARDANO_UPLC_BUILTIN_VALUE_CONTAINS].cpu.two.params.const_diagonal.model.linear_in_x_and_y.intercept = p[base + 31U];
+  b->entries[CARDANO_UPLC_BUILTIN_VALUE_CONTAINS].cpu.two.params.const_diagonal.model.linear_in_x_and_y.slope1    = p[base + 32U];
+  b->entries[CARDANO_UPLC_BUILTIN_VALUE_CONTAINS].cpu.two.params.const_diagonal.model.linear_in_x_and_y.slope2    = p[base + 33U];
+  b->entries[CARDANO_UPLC_BUILTIN_VALUE_CONTAINS].mem.two.params.constant                                         = p[base + 34U];
+
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_VALUE_DATA], p, base + 35U, base + 36U, base + 37U, base + 38U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_UN_VALUE_DATA].cpu.one.params.quadratic.coeff_0 = p[base + 39U];
+  b->entries[CARDANO_UPLC_BUILTIN_UN_VALUE_DATA].cpu.one.params.quadratic.coeff_1 = p[base + 40U];
+  b->entries[CARDANO_UPLC_BUILTIN_UN_VALUE_DATA].cpu.one.params.quadratic.coeff_2 = p[base + 41U];
+  b->entries[CARDANO_UPLC_BUILTIN_UN_VALUE_DATA].mem.one.params.linear.intercept  = p[base + 42U];
+  b->entries[CARDANO_UPLC_BUILTIN_UN_VALUE_DATA].mem.one.params.linear.slope      = p[base + 43U];
+
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_SCALE_VALUE], p, base + 44U, base + 45U, base + 46U, base + 47U);
+}
+
+/**
+ * \brief Fills the batch-7 builtins from a contiguous run of 19 params.
+ *
+ * The run is ordered multi_index_array, asset_count, policies, keep_policies and
+ * drop_policies; the order is identical in every version's list.
+ *
+ * \param[in,out] b The builtin costs to fill.
+ * \param[in] p The parameter array.
+ * \param[in] base The index of the first parameter of the run.
+ */
+static void
+fill_batch7(cardano_uplc_builtin_costs_t* b, const int64_t* p, size_t base)
+{
+  b->entries[CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY].cpu.two.params.quadratic_in_y.coeff_0 = p[base + 0U];
+  b->entries[CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY].cpu.two.params.quadratic_in_y.coeff_1 = p[base + 1U];
+  b->entries[CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY].cpu.two.params.quadratic_in_y.coeff_2 = p[base + 2U];
+  b->entries[CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY].mem.two.params.linear.intercept       = p[base + 3U];
+  b->entries[CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY].mem.two.params.linear.slope           = p[base + 4U];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_ASSET_COUNT], p, base + 5U, base + 6U);
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_POLICIES], p, base + 7U, base + 8U, base + 9U, base + 10U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_KEEP_POLICIES], p, base + 11U, base + 12U, base + 13U, base + 14U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_DROP_POLICIES], p, base + 15U, base + 16U, base + 17U, base + 18U);
+}
+
+/**
+ * \brief Maps the V1 flat parameter list onto a default V1 cost model.
+ *
+ * The default shapes come from \ref cardano_uplc_builtin_costs_v1; this
+ * overwrites their coefficients. Protocol version 11 (van Rossem) unified the
+ * builtin set across the three languages, so the V1 list appends the previously
+ * V2/V3-only builtins, the constr and case machine steps and the batch-6
+ * builtins after the original 166 parameters, followed by the batch-7
+ * builtins of protocol version 12.
+ *
+ * \param[out] out The cost model to populate.
+ * \param[in] p The V1 parameter array.
+ */
+static void
+from_params_v1(cardano_uplc_cost_model_t* out, const int64_t* p)
+{
+  cardano_uplc_builtin_costs_t* b = &out->builtins;
+
+  out->machine = cardano_uplc_machine_costs_default(CARDANO_UPLC_COST_MODEL_VERSION_V1);
+  *b           = cardano_uplc_builtin_costs_v1();
+
+  fill_machine_common(&out->machine, p);
+
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_ADD_INTEGER], p, 0U, 1U, 2U, 3U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_APPEND_BYTE_STRING], p, 4U, 5U, 6U, 7U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_APPEND_STRING], p, 8U, 9U, 10U, 11U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_B_DATA], p, 12U, 13U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_BLAKE2B_256], p, 14U, 15U, 16U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_DATA].cpu.six.params.constant   = p[33];
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_DATA].mem.six.params.constant   = p[34];
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_LIST].cpu.three.params.constant = p[35];
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_LIST].mem.three.params.constant = p[36];
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_UNIT], p, 37U, 38U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING], p, 39U, 40U, 41U, 42U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_CONSTR_DATA], p, 43U, 44U);
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_DECODE_UTF8], p, 45U, 46U, 47U, 48U);
+
+  set_v12_div(&b->entries[CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER], p, 49U, 50U, 51U, 52U, 53U, 54U);
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_ENCODE_UTF8], p, 55U, 56U, 57U, 58U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].cpu.two.params.linear_on_diagonal.constant  = p[59];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].cpu.two.params.linear_on_diagonal.intercept = p[60];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].cpu.two.params.linear_on_diagonal.slope     = p[61];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].mem.two.params.constant                     = p[62];
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_DATA].cpu.two.params.linear.intercept = p[63];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_DATA].cpu.two.params.linear.slope     = p[64];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_DATA].mem.two.params.constant         = p[65];
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_INTEGER].cpu.two.params.linear.intercept = p[66];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_INTEGER].cpu.two.params.linear.slope     = p[67];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_INTEGER].mem.two.params.constant         = p[68];
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].cpu.two.params.linear_on_diagonal.constant  = p[69];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].cpu.two.params.linear_on_diagonal.intercept = p[70];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].cpu.two.params.linear_on_diagonal.slope     = p[71];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].mem.two.params.constant                     = p[72];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_FST_PAIR], p, 73U, 74U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_HEAD_LIST], p, 75U, 76U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_I_DATA], p, 77U, 78U);
+  b->entries[CARDANO_UPLC_BUILTIN_IF_THEN_ELSE].cpu.three.params.constant = p[79];
+  b->entries[CARDANO_UPLC_BUILTIN_IF_THEN_ELSE].mem.three.params.constant = p[80];
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_INDEX_BYTE_STRING], p, 81U, 82U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_LENGTH_OF_BYTE_STRING], p, 83U, 84U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING].cpu.two.params.linear.intercept = p[85];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING].cpu.two.params.linear.slope     = p[86];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING].mem.two.params.constant         = p[87];
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING].cpu.two.params.linear.intercept = p[88];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING].cpu.two.params.linear.slope     = p[89];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING].mem.two.params.constant         = p[90];
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER].cpu.two.params.linear.intercept = p[91];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER].cpu.two.params.linear.slope     = p[92];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER].mem.two.params.constant         = p[93];
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER].cpu.two.params.linear.intercept = p[94];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER].cpu.two.params.linear.slope     = p[95];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER].mem.two.params.constant         = p[96];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_LIST_DATA], p, 97U, 98U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_MAP_DATA], p, 99U, 100U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_CONS], p, 101U, 102U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_NIL_DATA], p, 103U, 104U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_NIL_PAIR_DATA], p, 105U, 106U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_PAIR_DATA], p, 107U, 108U);
+
+  set_v12_div(&b->entries[CARDANO_UPLC_BUILTIN_MOD_INTEGER], p, 109U, 110U, 111U, 112U, 113U, 114U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_MULTIPLY_INTEGER], p, 115U, 116U, 117U, 118U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_NULL_LIST], p, 119U, 120U);
+  set_v12_div(&b->entries[CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER], p, 121U, 122U, 123U, 124U, 125U, 126U);
+  set_v12_div(&b->entries[CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER], p, 127U, 128U, 129U, 130U, 131U, 132U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_SHA2_256], p, 133U, 134U, 135U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_SHA3_256], p, 136U, 137U, 138U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].cpu.three.params.linear.intercept = p[139];
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].cpu.three.params.linear.slope     = p[140];
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].mem.three.params.linear.intercept = p[141];
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].mem.three.params.linear.slope     = p[142];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_SND_PAIR], p, 143U, 144U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER], p, 145U, 146U, 147U, 148U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_TAIL_LIST], p, 149U, 150U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_TRACE], p, 151U, 152U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_B_DATA], p, 153U, 154U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_CONSTR_DATA], p, 155U, 156U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_I_DATA], p, 157U, 158U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_LIST_DATA], p, 159U, 160U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_MAP_DATA], p, 161U, 162U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE].cpu.three.params.linear.intercept = p[163];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE].cpu.three.params.linear.slope     = p[164];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE].mem.three.params.constant         = p[165];
+
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_SERIALISE_DATA], p, 166U, 167U, 168U, 169U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ECDSA_SECP256K1_SIGNATURE], p, 170U, 171U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE].cpu.three.params.linear.intercept = p[172];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE].cpu.three.params.linear.slope     = p[173];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE].mem.three.params.constant         = p[174];
+
+  set_budget(&out->machine.constr, p, 175U, 176U);
+  set_budget(&out->machine.case_step, p, 177U, 178U);
+
+  fill_bls(b, p, 179U);
+  fill_keccak_blake224(b, p, 217U);
+  fill_int_bytestring_conversions(b, p, 223U);
+  fill_bitwise(b, p, 233U);
+  fill_exp_mod(b, p, 279U);
+  fill_batch6(b, p, 284U);
+  fill_batch7(b, p, 332U);
+}
+
+/**
+ * \brief Maps the V2 flat parameter list onto a default V2 cost model.
+ *
+ * The default shapes come from \ref cardano_uplc_builtin_costs_v2; this
+ * overwrites their coefficients. The integer/byte-string conversions were
+ * appended to the V2 list at protocol version 10 (Plomin); protocol version 11
+ * (van Rossem) then unified the builtin set across the three languages,
+ * appending the previously V3-only builtins, the constr and case machine steps
+ * and the batch-6 builtins, followed by the batch-7 builtins of protocol
+ * version 12.
+ *
+ * \param[out] out The cost model to populate.
+ * \param[in] p The V2 parameter array.
+ */
+static void
+from_params_v2(cardano_uplc_cost_model_t* out, const int64_t* p)
+{
+  cardano_uplc_builtin_costs_t* b = &out->builtins;
+
+  out->machine = cardano_uplc_machine_costs_default(CARDANO_UPLC_COST_MODEL_VERSION_V2);
+  *b           = cardano_uplc_builtin_costs_v2();
+
+  fill_machine_common(&out->machine, p);
+
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_ADD_INTEGER], p, 0U, 1U, 2U, 3U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_APPEND_BYTE_STRING], p, 4U, 5U, 6U, 7U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_APPEND_STRING], p, 8U, 9U, 10U, 11U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_B_DATA], p, 12U, 13U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_BLAKE2B_256], p, 14U, 15U, 16U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_DATA].cpu.six.params.constant   = p[33];
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_DATA].mem.six.params.constant   = p[34];
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_LIST].cpu.three.params.constant = p[35];
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_LIST].mem.three.params.constant = p[36];
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_UNIT], p, 37U, 38U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING], p, 39U, 40U, 41U, 42U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_CONSTR_DATA], p, 43U, 44U);
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_DECODE_UTF8], p, 45U, 46U, 47U, 48U);
+  set_v12_div(&b->entries[CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER], p, 49U, 50U, 51U, 52U, 53U, 54U);
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_ENCODE_UTF8], p, 55U, 56U, 57U, 58U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].cpu.two.params.linear_on_diagonal.constant  = p[59];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].cpu.two.params.linear_on_diagonal.intercept = p[60];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].cpu.two.params.linear_on_diagonal.slope     = p[61];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].mem.two.params.constant                     = p[62];
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_DATA].cpu.two.params.linear.intercept = p[63];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_DATA].cpu.two.params.linear.slope     = p[64];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_DATA].mem.two.params.constant         = p[65];
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_INTEGER].cpu.two.params.linear.intercept = p[66];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_INTEGER].cpu.two.params.linear.slope     = p[67];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_INTEGER].mem.two.params.constant         = p[68];
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].cpu.two.params.linear_on_diagonal.constant  = p[69];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].cpu.two.params.linear_on_diagonal.intercept = p[70];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].cpu.two.params.linear_on_diagonal.slope     = p[71];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].mem.two.params.constant                     = p[72];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_FST_PAIR], p, 73U, 74U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_HEAD_LIST], p, 75U, 76U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_I_DATA], p, 77U, 78U);
+  b->entries[CARDANO_UPLC_BUILTIN_IF_THEN_ELSE].cpu.three.params.constant = p[79];
+  b->entries[CARDANO_UPLC_BUILTIN_IF_THEN_ELSE].mem.three.params.constant = p[80];
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_INDEX_BYTE_STRING], p, 81U, 82U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_LENGTH_OF_BYTE_STRING], p, 83U, 84U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING].cpu.two.params.linear.intercept = p[85];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING].cpu.two.params.linear.slope     = p[86];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING].mem.two.params.constant         = p[87];
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING].cpu.two.params.linear.intercept = p[88];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING].cpu.two.params.linear.slope     = p[89];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING].mem.two.params.constant         = p[90];
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER].cpu.two.params.linear.intercept = p[91];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER].cpu.two.params.linear.slope     = p[92];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER].mem.two.params.constant         = p[93];
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER].cpu.two.params.linear.intercept = p[94];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER].cpu.two.params.linear.slope     = p[95];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER].mem.two.params.constant         = p[96];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_LIST_DATA], p, 97U, 98U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_MAP_DATA], p, 99U, 100U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_CONS], p, 101U, 102U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_NIL_DATA], p, 103U, 104U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_NIL_PAIR_DATA], p, 105U, 106U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_PAIR_DATA], p, 107U, 108U);
+  set_v12_div(&b->entries[CARDANO_UPLC_BUILTIN_MOD_INTEGER], p, 109U, 110U, 111U, 112U, 113U, 114U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_MULTIPLY_INTEGER], p, 115U, 116U, 117U, 118U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_NULL_LIST], p, 119U, 120U);
+  set_v12_div(&b->entries[CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER], p, 121U, 122U, 123U, 124U, 125U, 126U);
+  set_v12_div(&b->entries[CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER], p, 127U, 128U, 129U, 130U, 131U, 132U);
+
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_SERIALISE_DATA], p, 133U, 134U, 135U, 136U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_SHA2_256], p, 137U, 138U, 139U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_SHA3_256], p, 140U, 141U, 142U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].cpu.three.params.linear.intercept = p[143];
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].cpu.three.params.linear.slope     = p[144];
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].mem.three.params.linear.intercept = p[145];
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].mem.three.params.linear.slope     = p[146];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_SND_PAIR], p, 147U, 148U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER], p, 149U, 150U, 151U, 152U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_TAIL_LIST], p, 153U, 154U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_TRACE], p, 155U, 156U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_B_DATA], p, 157U, 158U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_CONSTR_DATA], p, 159U, 160U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_I_DATA], p, 161U, 162U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_LIST_DATA], p, 163U, 164U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_MAP_DATA], p, 165U, 166U);
+
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ECDSA_SECP256K1_SIGNATURE], p, 167U, 168U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE].cpu.three.params.linear.intercept = p[169];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE].cpu.three.params.linear.slope     = p[170];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE].mem.three.params.constant         = p[171];
+
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE].cpu.three.params.linear.intercept = p[172];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE].cpu.three.params.linear.slope     = p[173];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE].mem.three.params.constant         = p[174];
+
+  fill_int_bytestring_conversions(b, p, 175U);
+
+  set_budget(&out->machine.constr, p, 185U, 186U);
+  set_budget(&out->machine.case_step, p, 187U, 188U);
+
+  fill_bls(b, p, 189U);
+  fill_keccak_blake224(b, p, 227U);
+  fill_bitwise(b, p, 233U);
+  fill_exp_mod(b, p, 279U);
+  fill_batch6(b, p, 284U);
+  fill_batch7(b, p, 332U);
+}
+
+/**
+ * \brief Sets the V3 const-above-into-quadratic cpu of an integer-division entry.
+ *
+ * Under V3 semantics divide, quotient, remainder and mod share this cpu shape,
+ * each reading a contiguous run of eight indices in the order constant, c00, c01,
+ * c02, c10, c11, c20, minimum.
+ *
+ * \param[in,out] e The entry whose cpu is set.
+ * \param[in] p The parameter array.
+ * \param[in] base The index of the off-diagonal constant; the next seven indices
+ *            follow in the documented order.
+ */
+static void
+set_v3_div_cpu(cardano_uplc_builtin_cost_t* e, const int64_t* p, size_t base)
+{
+  e->cpu.two.params.const_above_into_quadratic.constant           = p[base + 0U];
+  e->cpu.two.params.const_above_into_quadratic.quadratic.coeff_00 = p[base + 1U];
+  e->cpu.two.params.const_above_into_quadratic.quadratic.coeff_01 = p[base + 2U];
+  e->cpu.two.params.const_above_into_quadratic.quadratic.coeff_02 = p[base + 3U];
+  e->cpu.two.params.const_above_into_quadratic.quadratic.coeff_10 = p[base + 4U];
+  e->cpu.two.params.const_above_into_quadratic.quadratic.coeff_11 = p[base + 5U];
+  e->cpu.two.params.const_above_into_quadratic.quadratic.coeff_20 = p[base + 6U];
+  e->cpu.two.params.const_above_into_quadratic.quadratic.minimum  = p[base + 7U];
+}
+
+/**
+ * \brief Maps the V3 flat parameter list onto a default V3 cost model.
+ *
+ * Reads every builtin through the exp_mod_integer coefficients plus the array
+ * and value families appended at protocol version 11 (van Rossem) and the
+ * batch-7 builtins of protocol version 12. The V4 list shares this ordering.
+ *
+ * \param[out] out The cost model to populate.
+ * \param[in] p The V3 parameter array.
+ */
+static void
+from_params_v3(cardano_uplc_cost_model_t* out, const int64_t* p)
+{
+  cardano_uplc_builtin_costs_t* b = &out->builtins;
+
+  out->machine = cardano_uplc_machine_costs_default(CARDANO_UPLC_COST_MODEL_VERSION_V3);
+  *b           = cardano_uplc_builtin_costs_v3();
+
+  fill_machine_common(&out->machine, p);
+  set_budget(&out->machine.constr, p, 193U, 194U);
+  set_budget(&out->machine.case_step, p, 195U, 196U);
+
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_ADD_INTEGER], p, 0U, 1U, 2U, 3U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_APPEND_BYTE_STRING], p, 4U, 5U, 6U, 7U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_APPEND_STRING], p, 8U, 9U, 10U, 11U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_B_DATA], p, 12U, 13U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_BLAKE2B_256], p, 14U, 15U, 16U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_DATA].cpu.six.params.constant   = p[33];
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_DATA].mem.six.params.constant   = p[34];
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_LIST].cpu.three.params.constant = p[35];
+  b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_LIST].mem.three.params.constant = p[36];
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_CHOOSE_UNIT], p, 37U, 38U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING], p, 39U, 40U, 41U, 42U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_CONSTR_DATA], p, 43U, 44U);
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_DECODE_UTF8], p, 45U, 46U, 47U, 48U);
+
+  set_v3_div_cpu(&b->entries[CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER], p, 49U);
+  b->entries[CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER].mem.two.params.subtracted_sizes.intercept = p[57];
+  b->entries[CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER].mem.two.params.subtracted_sizes.minimum   = p[58];
+  b->entries[CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER].mem.two.params.subtracted_sizes.slope     = p[59];
+
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_ENCODE_UTF8], p, 60U, 61U, 62U, 63U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].cpu.two.params.linear_on_diagonal.constant  = p[64];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].cpu.two.params.linear_on_diagonal.intercept = p[65];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].cpu.two.params.linear_on_diagonal.slope     = p[66];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING].mem.two.params.constant                     = p[67];
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_DATA].cpu.two.params.linear.intercept = p[68];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_DATA].cpu.two.params.linear.slope     = p[69];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_DATA].mem.two.params.constant         = p[70];
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_INTEGER].cpu.two.params.linear.intercept = p[71];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_INTEGER].cpu.two.params.linear.slope     = p[72];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_INTEGER].mem.two.params.constant         = p[73];
+
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].cpu.two.params.linear_on_diagonal.constant  = p[74];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].cpu.two.params.linear_on_diagonal.intercept = p[75];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].cpu.two.params.linear_on_diagonal.slope     = p[76];
+  b->entries[CARDANO_UPLC_BUILTIN_EQUALS_STRING].mem.two.params.constant                     = p[77];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_FST_PAIR], p, 78U, 79U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_HEAD_LIST], p, 80U, 81U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_I_DATA], p, 82U, 83U);
+  b->entries[CARDANO_UPLC_BUILTIN_IF_THEN_ELSE].cpu.three.params.constant = p[84];
+  b->entries[CARDANO_UPLC_BUILTIN_IF_THEN_ELSE].mem.three.params.constant = p[85];
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_INDEX_BYTE_STRING], p, 86U, 87U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_LENGTH_OF_BYTE_STRING], p, 88U, 89U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING].cpu.two.params.linear.intercept = p[90];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING].cpu.two.params.linear.slope     = p[91];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING].mem.two.params.constant         = p[92];
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING].cpu.two.params.linear.intercept = p[93];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING].cpu.two.params.linear.slope     = p[94];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING].mem.two.params.constant         = p[95];
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER].cpu.two.params.linear.intercept = p[96];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER].cpu.two.params.linear.slope     = p[97];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER].mem.two.params.constant         = p[98];
+
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER].cpu.two.params.linear.intercept = p[99];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER].cpu.two.params.linear.slope     = p[100];
+  b->entries[CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER].mem.two.params.constant         = p[101];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_LIST_DATA], p, 102U, 103U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_MAP_DATA], p, 104U, 105U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_CONS], p, 106U, 107U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_NIL_DATA], p, 108U, 109U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_NIL_PAIR_DATA], p, 110U, 111U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_MK_PAIR_DATA], p, 112U, 113U);
+
+  set_v3_div_cpu(&b->entries[CARDANO_UPLC_BUILTIN_MOD_INTEGER], p, 114U);
+  b->entries[CARDANO_UPLC_BUILTIN_MOD_INTEGER].mem.two.params.linear.intercept = p[122];
+  b->entries[CARDANO_UPLC_BUILTIN_MOD_INTEGER].mem.two.params.linear.slope     = p[123];
+
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_MULTIPLY_INTEGER], p, 124U, 125U, 126U, 127U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_NULL_LIST], p, 128U, 129U);
+
+  set_v3_div_cpu(&b->entries[CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER], p, 130U);
+  b->entries[CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER].mem.two.params.subtracted_sizes.intercept = p[138];
+  b->entries[CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER].mem.two.params.subtracted_sizes.minimum   = p[139];
+  b->entries[CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER].mem.two.params.subtracted_sizes.slope     = p[140];
+
+  set_v3_div_cpu(&b->entries[CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER], p, 141U);
+  b->entries[CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER].mem.two.params.linear.intercept = p[149];
+  b->entries[CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER].mem.two.params.linear.slope     = p[150];
+
+  set_one_lin(&b->entries[CARDANO_UPLC_BUILTIN_SERIALISE_DATA], p, 151U, 152U, 153U, 154U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_SHA2_256], p, 155U, 156U, 157U);
+  set_one_lin_cpu_const_mem(&b->entries[CARDANO_UPLC_BUILTIN_SHA3_256], p, 158U, 159U, 160U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].cpu.three.params.linear.intercept = p[161];
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].cpu.three.params.linear.slope     = p[162];
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].mem.three.params.linear.intercept = p[163];
+  b->entries[CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING].mem.three.params.linear.slope     = p[164];
+
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_SND_PAIR], p, 165U, 166U);
+  set_two_lin(&b->entries[CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER], p, 167U, 168U, 169U, 170U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_TAIL_LIST], p, 171U, 172U);
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_TRACE], p, 173U, 174U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_B_DATA], p, 175U, 176U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_CONSTR_DATA], p, 177U, 178U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_I_DATA], p, 179U, 180U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_LIST_DATA], p, 181U, 182U);
+  set_one_const(&b->entries[CARDANO_UPLC_BUILTIN_UN_MAP_DATA], p, 183U, 184U);
+
+  set_two_const(&b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ECDSA_SECP256K1_SIGNATURE], p, 185U, 186U);
+
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE].cpu.three.params.linear.intercept = p[187];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE].cpu.three.params.linear.slope     = p[188];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE].mem.three.params.constant         = p[189];
+
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE].cpu.three.params.linear.intercept = p[190];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE].cpu.three.params.linear.slope     = p[191];
+  b->entries[CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE].mem.three.params.constant         = p[192];
+
+  fill_bls(b, p, 197U);
+  fill_keccak_blake224(b, p, 235U);
+  fill_int_bytestring_conversions(b, p, 241U);
+  fill_bitwise(b, p, 251U);
+  fill_exp_mod(b, p, 297U);
+  fill_batch6(b, p, 302U);
+  fill_batch7(b, p, 350U);
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_cost_model_from_params(
+  cardano_uplc_cost_model_version_t version,
+  const int64_t*                    params,
+  size_t                            count,
+  cardano_uplc_builtin_semantics_t  semantics,
+  cardano_uplc_cost_model_t*        out)
+{
+  size_t  expected = 0U;
+  int64_t padded[CARDANO_UPLC_COST_MODEL_PARAM_COUNT_V4];
+
+  if ((params == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  switch (version)
+  {
+    case CARDANO_UPLC_COST_MODEL_VERSION_V1:
+    case CARDANO_UPLC_COST_MODEL_VERSION_V2:
+    {
+      expected = CARDANO_UPLC_COST_MODEL_PARAM_COUNT_V1;
+      break;
+    }
+    case CARDANO_UPLC_COST_MODEL_VERSION_V3:
+    case CARDANO_UPLC_COST_MODEL_VERSION_V4:
+    {
+      expected = CARDANO_UPLC_COST_MODEL_PARAM_COUNT_V3;
+      break;
+    }
+    default:
+    {
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+
+  const int64_t* effective = params;
+
+  if (count < expected)
+  {
+    size_t i = 0U;
+
+    for (i = 0U; i < count; ++i)
+    {
+      padded[i] = params[i];
+    }
+
+    for (i = count; i < expected; ++i)
+    {
+      padded[i] = INT64_MAX;
+    }
+
+    effective = padded;
+  }
+
+  switch (version)
+  {
+    case CARDANO_UPLC_COST_MODEL_VERSION_V1:
+    {
+      from_params_v1(out, effective);
+      break;
+    }
+    case CARDANO_UPLC_COST_MODEL_VERSION_V2:
+    {
+      from_params_v2(out, effective);
+      break;
+    }
+    case CARDANO_UPLC_COST_MODEL_VERSION_V3:
+    case CARDANO_UPLC_COST_MODEL_VERSION_V4:
+    default:
+    {
+      from_params_v3(out, effective);
+      break;
+    }
+  }
+
+  cardano_uplc_builtin_costs_select_division_shapes(&out->builtins, semantics);
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/cost/uplc_cost_model.h b/vendor/src/uplc/cost/uplc_cost_model.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_cost_model.h
@@ -0,0 +1,139 @@
+/**
+ * \file uplc_cost_model.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_COST_MODEL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_COST_MODEL_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../builtins/uplc_builtin_semantics.h"
+#include "uplc_builtin_costs.h"
+#include "uplc_cost_model_version.h"
+#include "uplc_machine_costs.h"
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A full cost model: the machine-step costs and the per-builtin costs.
+ *
+ * Pairs the per-step machine costs with the per-builtin costing functions.
+ */
+typedef struct cardano_uplc_cost_model_t
+{
+    /** \brief The per-step machine costs. */
+    cardano_uplc_machine_costs_t machine;
+    /** \brief The per-builtin costing functions. */
+    cardano_uplc_builtin_costs_t builtins;
+} cardano_uplc_cost_model_t;
+
+/**
+ * \brief The number of flat protocol parameters in the Plutus V1 cost model.
+ *
+ * The V1 parameter list as ordered by the ledger has this many entries: the
+ * original 166, the builtins appended when protocol version 11 (van Rossem)
+ * unified the builtin set across the languages, the batch-6 coefficients and the
+ * batch-7 coefficients of multiIndexArray, assetCount, policies, keepPolicies and
+ * dropPolicies.
+ */
+#define CARDANO_UPLC_COST_MODEL_PARAM_COUNT_V1 ((size_t)351)
+
+/**
+ * \brief The number of flat protocol parameters in the Plutus V2 cost model.
+ *
+ * The V2 parameter list as ordered by the ledger has this many entries, ending
+ * with the same batch-6 and batch-7 coefficients as the V1 list.
+ */
+#define CARDANO_UPLC_COST_MODEL_PARAM_COUNT_V2 ((size_t)351)
+
+/**
+ * \brief The number of flat protocol parameters in the Plutus V3 cost model.
+ *
+ * Covers the V3 list through the exp_mod_integer coefficients, the array and
+ * value families appended at protocol version 11 (van Rossem) and the batch-7
+ * coefficients, ending at dropPolicies.
+ */
+#define CARDANO_UPLC_COST_MODEL_PARAM_COUNT_V3 ((size_t)369)
+
+/**
+ * \brief The number of flat protocol parameters in the Plutus V4 cost model.
+ *
+ * The V4 parameter list has the same names in the same order as the V3 list.
+ */
+#define CARDANO_UPLC_COST_MODEL_PARAM_COUNT_V4 ((size_t)369)
+
+/**
+ * \brief Builds a full cost model from a flat ordered protocol parameter list.
+ *
+ * Maps the flat int64 list positionally into the machine-step costs and the
+ * per-builtin costing functions, using the per-version ledger parameter
+ * ordering; V4 uses the V3 ordering. The shapes are fixed per version and then
+ * adjusted for the semantics variant
+ * (\ref cardano_uplc_builtin_costs_select_division_shapes); only the
+ * coefficients come from \p params. When given the version's default parameter
+ * vector this reproduces the version's default builtin costs with the division
+ * shapes of \p semantics selected, and the default machine-step costs.
+ *
+ * The ledger's flat list grows append-only across protocol versions, so its
+ * length need not equal the count this build knows about. Following the Haskell
+ * reference (\c PlutusLedgerApi.Common.ParamName.tagWithParamNames), the count is
+ * not enforced: a longer list keeps its known prefix and ignores the extra
+ * trailing coefficients, and a shorter list is read as a positional prefix of
+ * the full list, with every missing parameter set to \c INT64_MAX. A builtin
+ * whose coefficients are missing therefore costs a saturated budget and cannot
+ * run within any transaction limit; a list that predates batch 7 therefore
+ * prices multiIndexArray, assetCount, policies, keepPolicies and dropPolicies
+ * out of reach.
+ *
+ * \param[in] version The cost-model version selecting the parameter ordering and
+ *            the per-builtin shapes.
+ * \param[in] params The flat ordered parameter list. Must not be NULL.
+ * \param[in] count The number of parameters in \p params. Any count is accepted;
+ *            extra trailing parameters are ignored and missing ones are set to
+ *            \c INT64_MAX.
+ * \param[in] semantics The builtin semantics variant, selecting the cost model
+ *            generation whose shapes interpret the integer-division parameters.
+ * \param[out] out On success, set to the built cost model; left untouched on
+ *             failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p params or \p out is NULL, or \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p version is unknown.
+ */
+cardano_error_t
+cardano_uplc_cost_model_from_params(
+  cardano_uplc_cost_model_version_t version,
+  const int64_t*                    params,
+  size_t                            count,
+  cardano_uplc_builtin_semantics_t  semantics,
+  cardano_uplc_cost_model_t*        out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_COST_MODEL_H */
diff --git a/vendor/src/uplc/cost/uplc_cost_model_version.h b/vendor/src/uplc/cost/uplc_cost_model_version.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_cost_model_version.h
@@ -0,0 +1,56 @@
+/**
+ * \file uplc_cost_model_version.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_COST_MODEL_VERSION_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_COST_MODEL_VERSION_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Plutus language version that selects a cost-model parameter ordering
+ *        and its default builtin costs.
+ *
+ * Every version prices the machine steps alike, including constr and case. The
+ * versions differ in their builtin costs and parameter lists; V4 reads the same
+ * parameter list as V3. The resulting cost model is a plain value so a caller may
+ * replace it wholesale with one built from ledger parameters.
+ */
+typedef enum
+{
+  /** \brief Plutus V1. */
+  CARDANO_UPLC_COST_MODEL_VERSION_V1 = 0,
+  /** \brief Plutus V2. */
+  CARDANO_UPLC_COST_MODEL_VERSION_V2 = 1,
+  /** \brief Plutus V3. */
+  CARDANO_UPLC_COST_MODEL_VERSION_V3 = 2,
+  /** \brief Plutus V4: the V3 parameter list. */
+  CARDANO_UPLC_COST_MODEL_VERSION_V4 = 3
+} cardano_uplc_cost_model_version_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_COST_MODEL_VERSION_H */
diff --git a/vendor/src/uplc/cost/uplc_cost_sat.c b/vendor/src/uplc/cost/uplc_cost_sat.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_cost_sat.c
@@ -0,0 +1,40 @@
+/**
+ * \file uplc_cost_sat.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_cost_sat.h"
+
+#include <stdint.h>
+
+/* DEFINITIONS ***************************************************************/
+
+int64_t
+cardano_uplc_cost_sat_add(int64_t a, int64_t b)
+{
+  return sat_add(a, b);
+}
+
+int64_t
+cardano_uplc_cost_sat_mul(int64_t a, int64_t b)
+{
+  return sat_mul(a, b);
+}
diff --git a/vendor/src/uplc/cost/uplc_cost_sat.h b/vendor/src/uplc/cost/uplc_cost_sat.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_cost_sat.h
@@ -0,0 +1,165 @@
+/**
+ * \file uplc_cost_sat.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_COST_SAT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_COST_SAT_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_int_math.h"
+
+#include <cardano/typedefs.h>
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Adds two signed 64-bit values, saturating at the int64 bounds.
+ *
+ * \param[in] a The first operand.
+ * \param[in] b The second operand.
+ *
+ * \return \p a + \p b, clamped to [INT64_MIN, INT64_MAX] on overflow.
+ */
+static inline int64_t
+sat_add(int64_t a, int64_t b)
+{
+  int64_t result = 0;
+
+  if (cardano_uplc_i64_add_overflow(a, b, &result) != 0)
+  {
+    result = (a >= 0) ? (int64_t)INT64_MAX : (int64_t)INT64_MIN;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Subtracts two signed 64-bit values, saturating at the int64 bounds.
+ *
+ * \param[in] a The minuend.
+ * \param[in] b The subtrahend.
+ *
+ * \return \p a - \p b, clamped to [INT64_MIN, INT64_MAX] on overflow.
+ */
+static inline int64_t
+sat_sub(int64_t a, int64_t b)
+{
+  int64_t result = 0;
+
+  if (cardano_uplc_i64_sub_overflow(a, b, &result) != 0)
+  {
+    result = (a >= 0) ? (int64_t)INT64_MAX : (int64_t)INT64_MIN;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Multiplies two signed 64-bit values, saturating at the int64 bounds.
+ *
+ * The result clamps to \c INT64_MAX or \c INT64_MIN on overflow rather than
+ * wrapping.
+ *
+ * \param[in] a The first operand.
+ * \param[in] b The second operand.
+ *
+ * \return \p a * \p b, clamped to [INT64_MIN, INT64_MAX] on overflow.
+ */
+static inline int64_t
+sat_mul(int64_t a, int64_t b)
+{
+  int64_t result = 0;
+
+  if (cardano_uplc_i64_mul_overflow(a, b, &result) != 0)
+  {
+    result = ((a > 0) == (b > 0)) ? (int64_t)INT64_MAX : (int64_t)INT64_MIN;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Returns the smaller of two signed 64-bit values.
+ *
+ * \param[in] a The first value.
+ * \param[in] b The second value.
+ *
+ * \return The minimum of \p a and \p b.
+ */
+static inline int64_t
+min_i64(int64_t a, int64_t b)
+{
+  return (a < b) ? a : b;
+}
+
+/**
+ * \brief Returns the larger of two signed 64-bit values.
+ *
+ * \param[in] a The first value.
+ * \param[in] b The second value.
+ *
+ * \return The maximum of \p a and \p b.
+ */
+static inline int64_t
+max_i64(int64_t a, int64_t b)
+{
+  return (a > b) ? a : b;
+}
+
+/**
+ * \brief Adds two signed 64-bit costs, saturating at the int64 bounds.
+ *
+ * Used wherever a cost is summed so that an intermediate that exceeds the int64
+ * range clamps to \c INT64_MAX (or \c INT64_MIN) rather than wrapping.
+ *
+ * \param[in] a The first operand.
+ * \param[in] b The second operand.
+ *
+ * \return \p a + \p b, clamped to [INT64_MIN, INT64_MAX] on overflow.
+ */
+int64_t
+cardano_uplc_cost_sat_add(int64_t a, int64_t b);
+
+/**
+ * \brief Multiplies two signed 64-bit costs, saturating at the int64 bounds.
+ *
+ * Used wherever sizes or coefficients are multiplied so that a large product
+ * clamps to \c INT64_MAX (or \c INT64_MIN) rather than wrapping.
+ *
+ * \param[in] a The first operand.
+ * \param[in] b The second operand.
+ *
+ * \return \p a * \p b, clamped to [INT64_MIN, INT64_MAX] on overflow.
+ */
+int64_t
+cardano_uplc_cost_sat_mul(int64_t a, int64_t b);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_COST_SAT_H */
diff --git a/vendor/src/uplc/cost/uplc_diag_model_kind.h b/vendor/src/uplc/cost/uplc_diag_model_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_diag_model_kind.h
@@ -0,0 +1,54 @@
+/**
+ * \file uplc_diag_model_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_DIAG_MODEL_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_DIAG_MODEL_KIND_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Selects which nested model a const-above/below-diagonal arm evaluates.
+ *
+ * Off the diagonal the cost model wraps an arbitrary two-argument model; only
+ * three concrete shapes occur in the default V1-V4 cost tables, so the nested
+ * model is a small closed union rather than a boxed recursive type. The arms
+ * cover linear-in-x-and-y (used by valueContains), multiplied-sizes (used by
+ * V1/V2 divide/mod/quotient/remainder) and the two-variable quadratic.
+ */
+typedef enum
+{
+  /** \brief Off-diagonal model is a two-variable linear cost. */
+  CARDANO_UPLC_DIAG_MODEL_LINEAR_IN_X_AND_Y = 0,
+  /** \brief Off-diagonal model is a multiplied-sizes linear cost over x*y. */
+  CARDANO_UPLC_DIAG_MODEL_MULTIPLIED_SIZES = 1,
+  /** \brief Off-diagonal model is a two-variable quadratic cost. */
+  CARDANO_UPLC_DIAG_MODEL_QUADRATIC = 2
+} cardano_uplc_diag_model_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_DIAG_MODEL_KIND_H */
diff --git a/vendor/src/uplc/cost/uplc_ex_mem.c b/vendor/src/uplc/cost/uplc_ex_mem.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_ex_mem.c
@@ -0,0 +1,340 @@
+/**
+ * \file uplc_ex_mem.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_ex_mem.h"
+#include "../ast/uplc_int.h"
+#include "../data/uplc_data.h"
+#include "../machine/uplc_value.h"
+#include "uplc_cost_sat.h"
+
+#include <cardano/common/bigint.h>
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief The number of 64-bit words an integer occupies for one memory unit.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_INTEGER_WORD_BITS = 64;
+
+/**
+ * \brief The byte-string chunk size: one memory unit per this many bytes.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_BYTE_STRING_CHUNK = 8;
+
+/**
+ * \brief The utf-8 string chunk size: one memory unit per this many whole bytes.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_STRING_UTF8_CHUNK = 4;
+
+/**
+ * \brief The ex-mem size of a BLS12-381 G1 element.
+ *
+ * Equal to the 144-byte element size divided by 8.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_BLS_G1_EX_MEM = 18;
+
+/**
+ * \brief The ex-mem size of a BLS12-381 G2 element.
+ *
+ * Equal to the 288-byte element size divided by 8.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_BLS_G2_EX_MEM = 36;
+
+/**
+ * \brief The ex-mem size of a BLS12-381 Miller-loop result.
+ *
+ * Equal to the 576-byte result size divided by 8.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_BLS_ML_RESULT_EX_MEM = 72;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Counts the Unicode code points in a UTF-8 byte sequence.
+ *
+ * Code points are counted by skipping the continuation bytes (those whose top
+ * two bits are 10); every other byte begins a new code point. The input is
+ * assumed to be valid UTF-8, as string constants are validated on construction.
+ *
+ * \param[in] bytes The UTF-8 bytes, or NULL when \p size is 0.
+ * \param[in] size The number of bytes.
+ *
+ * \return The code-point count.
+ */
+static int64_t
+utf8_code_point_count(const byte_t* bytes, size_t size)
+{
+  int64_t count = 0;
+  size_t  i     = 0U;
+
+  if (bytes == NULL)
+  {
+    return 0;
+  }
+
+  for (i = 0U; i < size; ++i)
+  {
+    if ((bytes[i] & 0xC0U) != 0x80U)
+    {
+      ++count;
+    }
+  }
+
+  return count;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+size_t
+cardano_uplc_value_entry_token_count(const cardano_uplc_constant_t* entry)
+{
+  if ((entry == NULL) || (entry->kind != CARDANO_UPLC_TYPE_PAIR))
+  {
+    return 0U;
+  }
+
+  if ((entry->as.pair.snd == NULL) || (entry->as.pair.snd->kind != CARDANO_UPLC_TYPE_LIST))
+  {
+    return 0U;
+  }
+
+  return entry->as.pair.snd->as.list.count;
+}
+
+int64_t
+cardano_uplc_value_token_count(const cardano_uplc_constant_t* constant)
+{
+  int64_t total = 0;
+  size_t  i     = 0U;
+
+  if ((constant == NULL) || (constant->kind != CARDANO_UPLC_TYPE_VALUE))
+  {
+    return 0;
+  }
+
+  for (i = 0U; i < constant->as.list.count; ++i)
+  {
+    total += (int64_t)cardano_uplc_value_entry_token_count(constant->as.list.items[i]);
+  }
+
+  return total;
+}
+
+int64_t
+cardano_uplc_integer_ex_mem(const cardano_bigint_t* value)
+{
+  size_t  bits = 0U;
+  int64_t log2 = 0;
+
+  if ((value == NULL) || cardano_bigint_is_zero(value))
+  {
+    return 1;
+  }
+
+  bits = cardano_bigint_bit_length(value);
+  log2 = (int64_t)bits - 1;
+
+  return (log2 / CARDANO_UPLC_INTEGER_WORD_BITS) + 1;
+}
+
+int64_t
+cardano_uplc_byte_string_ex_mem(size_t length)
+{
+  if (length == 0U)
+  {
+    return 1;
+  }
+
+  return (((int64_t)length - 1) / CARDANO_UPLC_BYTE_STRING_CHUNK) + 1;
+}
+
+int64_t
+cardano_uplc_string_ex_mem(const byte_t* bytes, size_t size, bool costs_by_utf8_bytes)
+{
+  if (costs_by_utf8_bytes)
+  {
+    return (int64_t)size / CARDANO_UPLC_STRING_UTF8_CHUNK;
+  }
+
+  return utf8_code_point_count(bytes, size);
+}
+
+int64_t
+cardano_uplc_data_ex_mem(const cardano_uplc_data_t* data)
+{
+  return cardano_uplc_data_node_ex_mem(data);
+}
+
+int64_t
+cardano_uplc_constant_ex_mem(
+  const cardano_uplc_constant_t* constant,
+  bool                           costs_strings_by_utf8_bytes)
+{
+  int64_t total = 0;
+
+  if (constant == NULL)
+  {
+    return 0;
+  }
+
+  switch (constant->kind)
+  {
+    case CARDANO_UPLC_TYPE_INTEGER:
+    {
+      if (cardano_uplc_constant_int_is_small(constant))
+      {
+        total = 1;
+      }
+      else
+      {
+        total = cardano_uplc_integer_ex_mem(constant->as.integer.big);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    {
+      total = cardano_uplc_byte_string_ex_mem(constant->as.bytes.size);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_STRING:
+    {
+      total = cardano_uplc_string_ex_mem(
+        constant->as.string.data,
+        constant->as.string.size,
+        costs_strings_by_utf8_bytes);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_UNIT:
+    case CARDANO_UPLC_TYPE_BOOL:
+    {
+      total = 1;
+      break;
+    }
+    case CARDANO_UPLC_TYPE_LIST:
+    case CARDANO_UPLC_TYPE_ARRAY:
+    {
+      size_t i = 0U;
+
+      for (i = 0U; i < constant->as.list.count; ++i)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        total = sat_add(total, cardano_uplc_constant_ex_mem(constant->as.list.items[i], costs_strings_by_utf8_bytes));
+      }
+      break;
+    }
+    case CARDANO_UPLC_TYPE_VALUE:
+    {
+      total = cardano_uplc_value_token_count(constant);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      total = sat_add(
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        cardano_uplc_constant_ex_mem(constant->as.pair.fst, costs_strings_by_utf8_bytes),
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        cardano_uplc_constant_ex_mem(constant->as.pair.snd, costs_strings_by_utf8_bytes));
+      break;
+    }
+    case CARDANO_UPLC_TYPE_DATA:
+    {
+      total = cardano_uplc_data_ex_mem(constant->as.data);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    {
+      total = CARDANO_UPLC_BLS_G1_EX_MEM;
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    {
+      total = CARDANO_UPLC_BLS_G2_EX_MEM;
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    {
+      total = CARDANO_UPLC_BLS_ML_RESULT_EX_MEM;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return total;
+}
+
+int64_t
+cardano_uplc_value_ex_mem(
+  const cardano_uplc_value_t* value,
+  bool                        costs_strings_by_utf8_bytes)
+{
+  int64_t total = 0;
+
+  if (value == NULL)
+  {
+    return 0;
+  }
+
+  if (value->ex_mem != CARDANO_UPLC_VALUE_EX_MEM_UNCOMPUTED)
+  {
+    return value->ex_mem;
+  }
+
+  switch (value->kind)
+  {
+    case CARDANO_UPLC_VALUE_CONSTANT:
+    {
+      total = cardano_uplc_constant_ex_mem(value->as.constant, costs_strings_by_utf8_bytes);
+      break;
+    }
+    case CARDANO_UPLC_VALUE_DELAY:
+    case CARDANO_UPLC_VALUE_LAMBDA:
+    case CARDANO_UPLC_VALUE_BUILTIN:
+    case CARDANO_UPLC_VALUE_CONSTR:
+    {
+      total = 1;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+  ((cardano_uplc_value_t*)((void*)value))->ex_mem = total;
+
+  return total;
+}
diff --git a/vendor/src/uplc/cost/uplc_ex_mem.h b/vendor/src/uplc/cost/uplc_ex_mem.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_ex_mem.h
@@ -0,0 +1,171 @@
+/**
+ * \file uplc_ex_mem.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_EX_MEM_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_EX_MEM_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_constant.h"
+#include <cardano/common/bigint.h>
+#include <cardano/typedefs.h>
+
+/* FORWARD DECLARATIONS ******************************************************/
+
+#ifndef CARDANO_UPLC_VALUE_T_FORWARD_DECLARED
+#define CARDANO_UPLC_VALUE_T_FORWARD_DECLARED
+typedef struct cardano_uplc_value_t cardano_uplc_value_t;
+#endif /* CARDANO_UPLC_VALUE_T_FORWARD_DECLARED */
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The ex-mem size of an integer, in 64-bit words.
+ *
+ * Zero costs one word; a non-zero integer costs floor(log2(|n|)) / 64 + 1 words,
+ * which is its 64-bit word count. The bit length is taken from
+ * \ref cardano_bigint_bit_length, which returns the base-2 digit count of the
+ * absolute value (sign-independent), so floor(log2(|n|)) is that count minus one.
+ *
+ * \param[in] value The integer to measure. A NULL pointer is measured as zero,
+ *            yielding 1.
+ *
+ * \return The integer's ex-mem size.
+ */
+int64_t
+cardano_uplc_integer_ex_mem(const cardano_bigint_t* value);
+
+/**
+ * \brief The ex-mem size of a byte string, in 8-byte chunks.
+ *
+ * An empty byte string costs 1; otherwise the cost is (len - 1) / 8 + 1, the
+ * number of 8-byte chunks needed to hold it.
+ *
+ * \param[in] length The byte-string length in bytes.
+ *
+ * \return The byte string's ex-mem size.
+ */
+int64_t
+cardano_uplc_byte_string_ex_mem(size_t length);
+
+/**
+ * \brief The ex-mem size of a UTF-8 text string.
+ *
+ * Under the character-count semantics (variants A, B, C) the cost is the number
+ * of Unicode code points; under the utf-8-byte semantics (variants D, E, F, G)
+ * it is the byte length divided by 4, rounded down, so strings shorter than 4
+ * bytes cost 0. The single boolean selects between the two.
+ *
+ * \param[in] bytes The UTF-8 encoded bytes, or NULL when \p size is 0.
+ * \param[in] size The number of encoded bytes.
+ * \param[in] costs_by_utf8_bytes \c true to cost by utf-8 byte length (D/E/F/G),
+ *            \c false to cost by code-point count (A/B/C).
+ *
+ * \return The string's ex-mem size.
+ */
+int64_t
+cardano_uplc_string_ex_mem(const byte_t* bytes, size_t size, bool costs_by_utf8_bytes);
+
+/**
+ * \brief The ex-mem size of a Plutus data value.
+ *
+ * Walks the data tree charging 4 per node and adding the integer or byte-string
+ * size of each leaf. The walk is depth-bounded so adversarial nesting cannot
+ * overflow the C stack; a tree deeper than the bound stops descending past it,
+ * which legitimate Plutus data never reaches.
+ *
+ * \param[in] data The data value to measure. A NULL pointer is measured as 0.
+ *
+ * \return The data value's ex-mem size.
+ */
+int64_t
+cardano_uplc_data_ex_mem(const struct cardano_uplc_data_t* data);
+
+/**
+ * \brief The ex-mem size of a constant value.
+ *
+ * Sums the per-arm sizes recursively: integer, byte string, string (selected by
+ * \p costs_strings_by_utf8_bytes), 1 for bool and unit, the data size for data,
+ * the sum of the items for a list, the sum of the components for a pair, and the
+ * fixed BLS sizes for the reserved BLS arms.
+ *
+ * \param[in] constant The constant to measure. A NULL pointer is measured as 0.
+ * \param[in] costs_strings_by_utf8_bytes Selects the string measure, as in
+ *            \ref cardano_uplc_string_ex_mem.
+ *
+ * \return The constant's ex-mem size.
+ */
+int64_t
+cardano_uplc_constant_ex_mem(
+  const cardano_uplc_constant_t* constant,
+  bool                           costs_strings_by_utf8_bytes);
+
+/**
+ * \brief The ex-mem size of a CEK runtime value.
+ *
+ * A constant value measures its constant via \ref cardano_uplc_constant_ex_mem;
+ * a delay, lambda, builtin or constr value measures 1.
+ *
+ * \param[in] value The value to measure. A NULL pointer is measured as 0.
+ * \param[in] costs_strings_by_utf8_bytes Selects the string measure, as in
+ *            \ref cardano_uplc_string_ex_mem.
+ *
+ * \return The value's ex-mem size.
+ */
+int64_t
+cardano_uplc_value_ex_mem(
+  const cardano_uplc_value_t* value,
+  bool                        costs_strings_by_utf8_bytes);
+
+/**
+ * \brief Returns the token count of a single value policy entry.
+ *
+ * A policy entry is a pair whose second component is the token list; the count is
+ * the length of that list, or 0 for a malformed entry.
+ *
+ * \param[in] entry The policy entry constant, or NULL.
+ *
+ * \return The number of tokens carried by the entry.
+ */
+size_t
+cardano_uplc_value_entry_token_count(const cardano_uplc_constant_t* entry);
+
+/**
+ * \brief Returns the total number of (policy, token) pairs in a value constant.
+ *
+ * The total is the sum of token-list lengths over all policy entries.
+ *
+ * \param[in] constant The value constant, or NULL.
+ *
+ * \return The total token count.
+ */
+int64_t
+cardano_uplc_value_token_count(const cardano_uplc_constant_t* constant);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_EX_MEM_H */
diff --git a/vendor/src/uplc/cost/uplc_exp_mod_cost.h b/vendor/src/uplc/cost/uplc_exp_mod_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_exp_mod_cost.h
@@ -0,0 +1,55 @@
+/**
+ * \file uplc_exp_mod_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_EXP_MOD_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_EXP_MOD_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The exp-mod costing function over the three modExp size arguments.
+ *
+ * Computes base = \c coeff_00 + \c coeff_11 * y * z + \c coeff_12 * y * z * z,
+ * then base when x <= z and base + base / 2 otherwise.
+ */
+typedef struct cardano_uplc_exp_mod_cost_t
+{
+    /** \brief The constant term. */
+    int64_t coeff_00;
+    /** \brief The coefficient of the y*z term. */
+    int64_t coeff_11;
+    /** \brief The coefficient of the y*z*z term. */
+    int64_t coeff_12;
+} cardano_uplc_exp_mod_cost_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_EXP_MOD_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_four_arg_cost.c b/vendor/src/uplc/cost/uplc_four_arg_cost.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_four_arg_cost.c
@@ -0,0 +1,40 @@
+/**
+ * \file uplc_four_arg_cost.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_four_arg_cost.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* DEFINITIONS ***************************************************************/
+
+int64_t
+cardano_uplc_four_arg_cost_eval(const cardano_uplc_four_arg_cost_t* fn, int64_t x, int64_t y, int64_t z, int64_t u)
+{
+  if (fn == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_uplc_four_arg_eval(fn, x, y, z, u);
+}
diff --git a/vendor/src/uplc/cost/uplc_four_arg_cost.h b/vendor/src/uplc/cost/uplc_four_arg_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_four_arg_cost.h
@@ -0,0 +1,123 @@
+/**
+ * \file uplc_four_arg_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_FOUR_ARG_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_FOUR_ARG_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_four_arg_kind.h"
+#include "uplc_linear_cost.h"
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A four-argument costing function as a tagged union.
+ *
+ * The active union member is selected by \c kind. Evaluate with
+ * \ref cardano_uplc_four_arg_cost_eval.
+ */
+typedef struct cardano_uplc_four_arg_cost_t
+{
+    /** \brief Selects the active union member. */
+    cardano_uplc_four_arg_kind_t kind;
+
+    /** \brief The variant parameters. */
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        /** \brief Active for CONSTANT. */
+        int64_t constant;
+        /** \brief Active for LINEAR_IN_U. */
+        cardano_uplc_linear_cost_t linear_in_u;
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } params;
+} cardano_uplc_four_arg_cost_t;
+
+/**
+ * \brief Evaluates a non-NULL four-argument costing function at four sizes.
+ *
+ * \param[in] fn The costing function. Must not be NULL.
+ * \param[in] x The ex-mem size of the first argument.
+ * \param[in] y The ex-mem size of the second argument.
+ * \param[in] z The ex-mem size of the third argument.
+ * \param[in] u The ex-mem size of the fourth argument.
+ *
+ * \return The saturating cost.
+ */
+static inline int64_t
+cardano_uplc_four_arg_eval(const cardano_uplc_four_arg_cost_t* fn, int64_t x, int64_t y, int64_t z, int64_t u)
+{
+  int64_t result = 0;
+
+  (void)x;
+  (void)y;
+  (void)z;
+
+  switch (fn->kind)
+  {
+    case CARDANO_UPLC_FOUR_ARG_CONSTANT:
+    {
+      result = fn->params.constant;
+      break;
+    }
+    case CARDANO_UPLC_FOUR_ARG_LINEAR_IN_U:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear_in_u, u);
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Evaluates a four-argument costing function at four sizes.
+ *
+ * Only the fourth argument can affect the cost in the shapes that occur; the
+ * first three are accepted to keep the evaluator total over the arity.
+ *
+ * \param[in] fn The costing function. Must not be NULL.
+ * \param[in] x The ex-mem size of the first argument.
+ * \param[in] y The ex-mem size of the second argument.
+ * \param[in] z The ex-mem size of the third argument.
+ * \param[in] u The ex-mem size of the fourth argument.
+ *
+ * \return The saturating cost, or 0 if \p fn is NULL.
+ */
+int64_t
+cardano_uplc_four_arg_cost_eval(const cardano_uplc_four_arg_cost_t* fn, int64_t x, int64_t y, int64_t z, int64_t u);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_FOUR_ARG_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_four_arg_kind.h b/vendor/src/uplc/cost/uplc_four_arg_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_four_arg_kind.h
@@ -0,0 +1,48 @@
+/**
+ * \file uplc_four_arg_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_FOUR_ARG_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_FOUR_ARG_KIND_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Discriminator for a four-argument costing function.
+ *
+ * The \c LINEAR_IN_U arm is the V4 four-argument linear-in-u shape.
+ */
+typedef enum
+{
+  /** \brief A fixed cost independent of all four arguments. */
+  CARDANO_UPLC_FOUR_ARG_CONSTANT = 0,
+  /** \brief Linear in the fourth argument. */
+  CARDANO_UPLC_FOUR_ARG_LINEAR_IN_U = 1
+} cardano_uplc_four_arg_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_FOUR_ARG_KIND_H */
diff --git a/vendor/src/uplc/cost/uplc_linear_cost.h b/vendor/src/uplc/cost/uplc_linear_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_linear_cost.h
@@ -0,0 +1,68 @@
+/**
+ * \file uplc_linear_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_LINEAR_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_LINEAR_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_cost_sat.h"
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A linear cost: \c intercept + \c slope * x, evaluated saturating.
+ *
+ * The member order is intercept first, then slope.
+ */
+typedef struct cardano_uplc_linear_cost_t
+{
+    /** \brief The constant term added to the slope contribution. */
+    int64_t intercept;
+    /** \brief The coefficient multiplying the size argument. */
+    int64_t slope;
+} cardano_uplc_linear_cost_t;
+
+/**
+ * \brief Evaluates a linear cost intercept + slope * x with saturation.
+ *
+ * \param[in] l The linear cost parameters.
+ * \param[in] x The size argument.
+ *
+ * \return \c l.intercept + \c l.slope * x, saturating.
+ */
+static inline int64_t
+cardano_uplc_linear_cost_eval(cardano_uplc_linear_cost_t l, int64_t x)
+{
+  return sat_add(l.intercept, sat_mul(l.slope, x));
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_LINEAR_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_machine_costs.c b/vendor/src/uplc/cost/uplc_machine_costs.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_machine_costs.c
@@ -0,0 +1,149 @@
+/**
+ * \file uplc_machine_costs.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_machine_costs.h"
+
+#include <cardano/export.h>
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief Memory cost shared by startup.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_STARTUP_MEM = 100;
+
+/**
+ * \brief CPU cost of startup.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_STARTUP_CPU = 100;
+
+/**
+ * \brief Memory cost of a normal machine step.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_STEP_MEM = 100;
+
+/**
+ * \brief CPU cost of a normal machine step.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_STEP_CPU = 16000;
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_uplc_machine_costs_t
+cardano_uplc_machine_costs_default(cardano_uplc_cost_model_version_t version)
+{
+  cardano_uplc_machine_costs_t costs;
+
+  const cardano_uplc_budget_t startup = { CARDANO_UPLC_STARTUP_CPU, CARDANO_UPLC_STARTUP_MEM };
+  const cardano_uplc_budget_t step    = { CARDANO_UPLC_STEP_CPU, CARDANO_UPLC_STEP_MEM };
+
+  CARDANO_UNUSED(version);
+
+  costs.startup   = startup;
+  costs.constant  = step;
+  costs.var_step  = step;
+  costs.lambda    = step;
+  costs.apply     = step;
+  costs.delay     = step;
+  costs.force     = step;
+  costs.builtin   = step;
+  costs.constr    = step;
+  costs.case_step = step;
+
+  return costs;
+}
+
+cardano_uplc_budget_t
+cardano_uplc_machine_costs_get(
+  const cardano_uplc_machine_costs_t* costs,
+  cardano_uplc_step_kind_t            kind)
+{
+  cardano_uplc_budget_t result = { 0, 0 };
+
+  if (costs == NULL)
+  {
+    return result;
+  }
+
+  switch (kind)
+  {
+    case CARDANO_UPLC_STEP_KIND_CONSTANT:
+    {
+      result = costs->constant;
+      break;
+    }
+    case CARDANO_UPLC_STEP_KIND_VAR:
+    {
+      result = costs->var_step;
+      break;
+    }
+    case CARDANO_UPLC_STEP_KIND_LAMBDA:
+    {
+      result = costs->lambda;
+      break;
+    }
+    case CARDANO_UPLC_STEP_KIND_APPLY:
+    {
+      result = costs->apply;
+      break;
+    }
+    case CARDANO_UPLC_STEP_KIND_DELAY:
+    {
+      result = costs->delay;
+      break;
+    }
+    case CARDANO_UPLC_STEP_KIND_FORCE:
+    {
+      result = costs->force;
+      break;
+    }
+    case CARDANO_UPLC_STEP_KIND_BUILTIN:
+    {
+      result = costs->builtin;
+      break;
+    }
+    case CARDANO_UPLC_STEP_KIND_CONSTR:
+    {
+      result = costs->constr;
+      break;
+    }
+    case CARDANO_UPLC_STEP_KIND_CASE:
+    {
+      result = costs->case_step;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
diff --git a/vendor/src/uplc/cost/uplc_machine_costs.h b/vendor/src/uplc/cost/uplc_machine_costs.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_machine_costs.h
@@ -0,0 +1,102 @@
+/**
+ * \file uplc_machine_costs.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_MACHINE_COSTS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_MACHINE_COSTS_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../machine/uplc_budget.h"
+#include "uplc_cost_model_version.h"
+#include "uplc_step_kind.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The CPU/memory cost of each CEK machine step.
+ *
+ * Holds the one-off startup cost and a budget for each of the nine step kinds,
+ * indexable by \ref cardano_uplc_step_kind_t through
+ * \ref cardano_uplc_machine_costs_get.
+ */
+typedef struct cardano_uplc_machine_costs_t
+{
+    /** \brief Charged once before the evaluation loop starts. */
+    cardano_uplc_budget_t startup;
+    /** \brief Cost of one constant step. */
+    cardano_uplc_budget_t constant;
+    /** \brief Cost of one variable step. */
+    cardano_uplc_budget_t var_step;
+    /** \brief Cost of one lambda step. */
+    cardano_uplc_budget_t lambda;
+    /** \brief Cost of one apply step. */
+    cardano_uplc_budget_t apply;
+    /** \brief Cost of one delay step. */
+    cardano_uplc_budget_t delay;
+    /** \brief Cost of one force step. */
+    cardano_uplc_budget_t force;
+    /** \brief Cost of one builtin step. */
+    cardano_uplc_budget_t builtin;
+    /** \brief Cost of one constr step. */
+    cardano_uplc_budget_t constr;
+    /** \brief Cost of one case step. */
+    cardano_uplc_budget_t case_step;
+} cardano_uplc_machine_costs_t;
+
+/**
+ * \brief Returns the default machine-cost table for a language version.
+ *
+ * Every language version uses the same table: each step, including constr and
+ * case, costs 16000 CPU and 100 memory, and startup costs 100 CPU and 100 memory.
+ * V1 and V2 can reach constr and case through Plutus Core 1.1.0 from protocol
+ * version 11, so they price those steps like V3 and V4.
+ *
+ * \param[in] version The language version. Every version, including an
+ *            unrecognized one, yields the same table.
+ *
+ * \return The machine-cost table by value.
+ */
+cardano_uplc_machine_costs_t
+cardano_uplc_machine_costs_default(cardano_uplc_cost_model_version_t version);
+
+/**
+ * \brief Returns the per-step budget for a given step kind.
+ *
+ * \param[in] costs The cost table to read. Must not be NULL.
+ * \param[in] kind The step kind to look up.
+ *
+ * \return The budget for \p kind, or a zero budget if \p costs is NULL or
+ *         \p kind is not a valid step kind.
+ */
+cardano_uplc_budget_t
+cardano_uplc_machine_costs_get(
+  const cardano_uplc_machine_costs_t* costs,
+  cardano_uplc_step_kind_t            kind);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_MACHINE_COSTS_H */
diff --git a/vendor/src/uplc/cost/uplc_one_arg_cost.c b/vendor/src/uplc/cost/uplc_one_arg_cost.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_one_arg_cost.c
@@ -0,0 +1,40 @@
+/**
+ * \file uplc_one_arg_cost.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_one_arg_cost.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* DEFINITIONS ***************************************************************/
+
+int64_t
+cardano_uplc_one_arg_cost_eval(const cardano_uplc_one_arg_cost_t* fn, int64_t x)
+{
+  if (fn == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_uplc_one_arg_eval(fn, x);
+}
diff --git a/vendor/src/uplc/cost/uplc_one_arg_cost.h b/vendor/src/uplc/cost/uplc_one_arg_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_one_arg_cost.h
@@ -0,0 +1,118 @@
+/**
+ * \file uplc_one_arg_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_ONE_ARG_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_ONE_ARG_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_linear_cost.h"
+#include "uplc_one_arg_kind.h"
+#include "uplc_quadratic_cost.h"
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A one-argument costing function as a tagged union.
+ *
+ * The active union member is selected by \c kind. Evaluate with
+ * \ref cardano_uplc_one_arg_cost_eval.
+ */
+typedef struct cardano_uplc_one_arg_cost_t
+{
+    /** \brief Selects the active union member. */
+    cardano_uplc_one_arg_kind_t kind;
+
+    /** \brief The variant parameters. */
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        /** \brief Active when kind is CONSTANT. */
+        int64_t constant;
+        /** \brief Active when kind is LINEAR. */
+        cardano_uplc_linear_cost_t linear;
+        /** \brief Active when kind is QUADRATIC. */
+        cardano_uplc_quadratic_cost_t quadratic;
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } params;
+} cardano_uplc_one_arg_cost_t;
+
+/**
+ * \brief Evaluates a non-NULL one-argument costing function at a size.
+ *
+ * \param[in] fn The costing function. Must not be NULL.
+ * \param[in] x The ex-mem size of the single argument.
+ *
+ * \return The saturating cost.
+ */
+static inline int64_t
+cardano_uplc_one_arg_eval(const cardano_uplc_one_arg_cost_t* fn, int64_t x)
+{
+  int64_t result = 0;
+
+  switch (fn->kind)
+  {
+    case CARDANO_UPLC_ONE_ARG_CONSTANT:
+    {
+      result = fn->params.constant;
+      break;
+    }
+    case CARDANO_UPLC_ONE_ARG_LINEAR:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, x);
+      break;
+    }
+    case CARDANO_UPLC_ONE_ARG_QUADRATIC:
+    {
+      result = cardano_uplc_quadratic_cost_eval(fn->params.quadratic, x);
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Evaluates a one-argument costing function at a size.
+ *
+ * \param[in] fn The costing function. Must not be NULL.
+ * \param[in] x The ex-mem size of the single argument.
+ *
+ * \return The saturating cost, or 0 if \p fn is NULL.
+ */
+int64_t
+cardano_uplc_one_arg_cost_eval(const cardano_uplc_one_arg_cost_t* fn, int64_t x);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_ONE_ARG_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_one_arg_kind.h b/vendor/src/uplc/cost/uplc_one_arg_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_one_arg_kind.h
@@ -0,0 +1,48 @@
+/**
+ * \file uplc_one_arg_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_ONE_ARG_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_ONE_ARG_KIND_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Discriminator for a one-argument costing function.
+ */
+typedef enum
+{
+  /** \brief A fixed cost independent of the argument. */
+  CARDANO_UPLC_ONE_ARG_CONSTANT = 0,
+  /** \brief A linear cost in the argument. */
+  CARDANO_UPLC_ONE_ARG_LINEAR = 1,
+  /** \brief A quadratic cost in the argument. */
+  CARDANO_UPLC_ONE_ARG_QUADRATIC = 2
+} cardano_uplc_one_arg_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_ONE_ARG_KIND_H */
diff --git a/vendor/src/uplc/cost/uplc_quadratic_cost.h b/vendor/src/uplc/cost/uplc_quadratic_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_quadratic_cost.h
@@ -0,0 +1,71 @@
+/**
+ * \file uplc_quadratic_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_QUADRATIC_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_QUADRATIC_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_cost_sat.h"
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A one-variable quadratic: \c coeff_0 + \c coeff_1 * x + \c coeff_2 * x * x.
+ */
+typedef struct cardano_uplc_quadratic_cost_t
+{
+    /** \brief The constant term. */
+    int64_t coeff_0;
+    /** \brief The linear coefficient. */
+    int64_t coeff_1;
+    /** \brief The quadratic coefficient. */
+    int64_t coeff_2;
+} cardano_uplc_quadratic_cost_t;
+
+/**
+ * \brief Evaluates a one-variable quadratic c0 + c1*x + c2*x*x with saturation.
+ *
+ * \param[in] q The quadratic cost parameters.
+ * \param[in] x The size argument.
+ *
+ * \return The saturating quadratic value.
+ */
+static inline int64_t
+cardano_uplc_quadratic_cost_eval(cardano_uplc_quadratic_cost_t q, int64_t x)
+{
+  int64_t result = sat_add(q.coeff_0, sat_mul(q.coeff_1, x));
+  result         = sat_add(result, sat_mul(q.coeff_2, sat_mul(x, x)));
+
+  return result;
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_QUADRATIC_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_selected_cost_model.c b/vendor/src/uplc/cost/uplc_selected_cost_model.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_selected_cost_model.c
@@ -0,0 +1,102 @@
+/**
+ * \file uplc_selected_cost_model.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_selected_cost_model.h"
+#include "../ast/uplc_lang_version.h"
+#include "../builtins/uplc_builtin_semantics.h"
+#include "uplc_cost_model.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_uplc_cost_model_version_t
+cardano_uplc_cost_model_version_for_language(cardano_uplc_lang_version_t lang_version)
+{
+  cardano_uplc_cost_model_version_t result = CARDANO_UPLC_COST_MODEL_VERSION_V3;
+
+  switch (lang_version)
+  {
+    case CARDANO_UPLC_LANG_VERSION_V1:
+    {
+      result = CARDANO_UPLC_COST_MODEL_VERSION_V1;
+      break;
+    }
+    case CARDANO_UPLC_LANG_VERSION_V2:
+    {
+      result = CARDANO_UPLC_COST_MODEL_VERSION_V2;
+      break;
+    }
+    case CARDANO_UPLC_LANG_VERSION_V3:
+    {
+      result = CARDANO_UPLC_COST_MODEL_VERSION_V3;
+      break;
+    }
+    case CARDANO_UPLC_LANG_VERSION_V4:
+    {
+      result = CARDANO_UPLC_COST_MODEL_VERSION_V4;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_uplc_select_cost_model(
+  cardano_uplc_lang_version_t         lang_version,
+  uint64_t                            protocol_major,
+  const int64_t*                      params,
+  size_t                              count,
+  cardano_uplc_selected_cost_model_t* out)
+{
+  cardano_uplc_cost_model_version_t cost_version;
+  cardano_uplc_cost_model_t         model;
+  cardano_uplc_builtin_semantics_t  semantics;
+  cardano_error_t                   result;
+
+  if ((params == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cost_version = cardano_uplc_cost_model_version_for_language(lang_version);
+  semantics    = cardano_uplc_builtin_semantics_for_language_and_protocol(lang_version, protocol_major);
+
+  result = cardano_uplc_cost_model_from_params(cost_version, params, count, semantics, &model);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  out->model     = model;
+  out->semantics = semantics;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/cost/uplc_selected_cost_model.h b/vendor/src/uplc/cost/uplc_selected_cost_model.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_selected_cost_model.h
@@ -0,0 +1,117 @@
+/**
+ * \file uplc_selected_cost_model.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SELECTED_COST_MODEL_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SELECTED_COST_MODEL_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_lang_version.h"
+#include "../builtins/uplc_builtin_semantics.h"
+#include "uplc_cost_model.h"
+#include "uplc_cost_model_version.h"
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A selected cost model paired with its builtin semantics variant.
+ *
+ * The phase-2 driver resolves one of these per Plutus script from the script's
+ * language version, the protocol major version and the ledger cost model
+ * parameters, then hands both halves to the CEK machine: the structured
+ * \c model drives the per-step and per-builtin costs and the \c semantics variant
+ * drives the version-dependent builtin behaviours (utf-8 string costing and the
+ * \c consByteString range check). Pairing them keeps the two selections, which are
+ * made from the same inputs, from drifting apart.
+ */
+typedef struct cardano_uplc_selected_cost_model_t
+{
+    /** \brief The structured cost model built for the language version. */
+    cardano_uplc_cost_model_t model;
+    /** \brief The builtin semantics variant for the language and protocol. */
+    cardano_uplc_builtin_semantics_t semantics;
+} cardano_uplc_selected_cost_model_t;
+
+/**
+ * \brief Maps a Plutus language version to its cost-model parameter ordering.
+ *
+ * Each language maps to its own cost-model version; the V4 parameter list has
+ * the same names and order as the V3 list. This is the version that selects the
+ * parameter count and per-builtin shapes consumed by
+ * \ref cardano_uplc_cost_model_from_params.
+ *
+ * \param[in] lang_version The language version to map.
+ *
+ * \return The matching cost-model version. An unrecognized language version maps
+ *         to \ref CARDANO_UPLC_COST_MODEL_VERSION_V3.
+ */
+cardano_uplc_cost_model_version_t
+cardano_uplc_cost_model_version_for_language(cardano_uplc_lang_version_t lang_version);
+
+/**
+ * \brief Selects the cost model and builtin semantics for a script.
+ *
+ * Builds the structured cost model from the flat ordered ledger parameter list for
+ * the language version's parameter ordering, and selects the builtin semantics
+ * variant from the language version and protocol major version
+ * (\ref cardano_uplc_builtin_semantics_for_language_and_protocol). The variant
+ * also picks the cost model generation whose shapes interpret the parameters, as
+ * the ledger does: D and F read the integer-division parameters with the cost
+ * model D shapes, E and G with the cost model E shapes, and A, B and C keep the
+ * earlier shapes (\ref cardano_uplc_builtin_costs_select_division_shapes). Both
+ * selections are made from the same inputs and returned together so the driver
+ * and the CEK machine read one consistent pair. Consensus-critical: a wrong semantics variant
+ * or cost model changes the validation outcome.
+ *
+ * \param[in] lang_version The script's language version, selecting the parameter
+ *            ordering and (with \p protocol_major) the semantics variant.
+ * \param[in] protocol_major The protocol major version, selecting the semantics
+ *            variant at the Chang, Van-Rossem and Dijkstra boundaries.
+ * \param[in] params The flat ordered cost-model parameter list. Must not be NULL.
+ * \param[in] count The number of parameters in \p params. Must equal the parameter
+ *            count for the language version's cost-model ordering.
+ * \param[out] out On success, set to the selected cost model and semantics; left
+ *             untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p params or \p out is NULL, or \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p count is not the language version's parameter count.
+ */
+cardano_error_t
+cardano_uplc_select_cost_model(
+  cardano_uplc_lang_version_t         lang_version,
+  uint64_t                            protocol_major,
+  const int64_t*                      params,
+  size_t                              count,
+  cardano_uplc_selected_cost_model_t* out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SELECTED_COST_MODEL_H */
diff --git a/vendor/src/uplc/cost/uplc_six_arg_cost.c b/vendor/src/uplc/cost/uplc_six_arg_cost.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_six_arg_cost.c
@@ -0,0 +1,47 @@
+/**
+ * \file uplc_six_arg_cost.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_six_arg_cost.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* DEFINITIONS ***************************************************************/
+
+int64_t
+cardano_uplc_six_arg_cost_eval(
+  const cardano_uplc_six_arg_cost_t* fn,
+  int64_t                            a,
+  int64_t                            b,
+  int64_t                            c,
+  int64_t                            d,
+  int64_t                            e,
+  int64_t                            f)
+{
+  if (fn == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_uplc_six_arg_eval(fn, a, b, c, d, e, f);
+}
diff --git a/vendor/src/uplc/cost/uplc_six_arg_cost.h b/vendor/src/uplc/cost/uplc_six_arg_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_six_arg_cost.h
@@ -0,0 +1,143 @@
+/**
+ * \file uplc_six_arg_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SIX_ARG_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SIX_ARG_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_six_arg_kind.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A six-argument costing function as a tagged union.
+ *
+ * The active union member is selected by \c kind. Evaluate with
+ * \ref cardano_uplc_six_arg_cost_eval.
+ */
+typedef struct cardano_uplc_six_arg_cost_t
+{
+    /** \brief Selects the active union member. */
+    cardano_uplc_six_arg_kind_t kind;
+
+    /** \brief The variant parameters. */
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        /** \brief Active for CONSTANT. */
+        int64_t constant;
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } params;
+} cardano_uplc_six_arg_cost_t;
+
+/**
+ * \brief Evaluates a six-argument costing function for a non-NULL pointer.
+ *
+ * The six sizes are accepted for symmetry; the only shape is the constant cost.
+ *
+ * \param[in] fn The costing function, or NULL.
+ * \param[in] a The ex-mem size of the first argument.
+ * \param[in] b The ex-mem size of the second argument.
+ * \param[in] c The ex-mem size of the third argument.
+ * \param[in] d The ex-mem size of the fourth argument.
+ * \param[in] e The ex-mem size of the fifth argument.
+ * \param[in] f The ex-mem size of the sixth argument.
+ *
+ * \return The saturating cost, or 0 if \p fn is NULL.
+ */
+static inline int64_t
+cardano_uplc_six_arg_eval(
+  const cardano_uplc_six_arg_cost_t* fn,
+  int64_t                            a,
+  int64_t                            b,
+  int64_t                            c,
+  int64_t                            d,
+  int64_t                            e,
+  int64_t                            f)
+{
+  int64_t result = 0;
+
+  (void)a;
+  (void)b;
+  (void)c;
+  (void)d;
+  (void)e;
+  (void)f;
+
+  if (fn == NULL)
+  {
+    return result;
+  }
+
+  switch (fn->kind)
+  {
+    case CARDANO_UPLC_SIX_ARG_CONSTANT:
+    {
+      result = fn->params.constant;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Evaluates a six-argument costing function.
+ *
+ * The six sizes are accepted for symmetry; the only shape is the constant cost.
+ *
+ * \param[in] fn The costing function. Must not be NULL.
+ * \param[in] a The ex-mem size of the first argument.
+ * \param[in] b The ex-mem size of the second argument.
+ * \param[in] c The ex-mem size of the third argument.
+ * \param[in] d The ex-mem size of the fourth argument.
+ * \param[in] e The ex-mem size of the fifth argument.
+ * \param[in] f The ex-mem size of the sixth argument.
+ *
+ * \return The saturating cost, or 0 if \p fn is NULL.
+ */
+int64_t
+cardano_uplc_six_arg_cost_eval(
+  const cardano_uplc_six_arg_cost_t* fn,
+  int64_t                            a,
+  int64_t                            b,
+  int64_t                            c,
+  int64_t                            d,
+  int64_t                            e,
+  int64_t                            f);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SIX_ARG_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_six_arg_kind.h b/vendor/src/uplc/cost/uplc_six_arg_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_six_arg_kind.h
@@ -0,0 +1,46 @@
+/**
+ * \file uplc_six_arg_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SIX_ARG_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SIX_ARG_KIND_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Discriminator for a six-argument costing function.
+ *
+ * The only shape is the constant cost.
+ */
+typedef enum
+{
+  /** \brief A fixed cost independent of all six arguments. */
+  CARDANO_UPLC_SIX_ARG_CONSTANT = 0
+} cardano_uplc_six_arg_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SIX_ARG_KIND_H */
diff --git a/vendor/src/uplc/cost/uplc_step_accumulator.c b/vendor/src/uplc/cost/uplc_step_accumulator.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_step_accumulator.c
@@ -0,0 +1,262 @@
+/**
+ * \file uplc_step_accumulator.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_step_accumulator.h"
+#include "../machine/uplc_budget.h"
+#include "uplc_cost_sat.h"
+#include "uplc_machine_costs.h"
+#include "uplc_step_kind.h"
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief The default slippage threshold: flush after this many steps.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t CARDANO_UPLC_DEFAULT_SLIPPAGE = 200U;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Multiplies a signed cost by a non-negative count, saturating high.
+ *
+ * The count comes from an occurrence counter and is always non-negative, so the
+ * product cannot underflow; only the positive overflow needs clamping.
+ *
+ * \param[in] cost The per-step cost (non-negative in every default table).
+ * \param[in] count The number of occurrences.
+ *
+ * \return \p cost * \p count, clamped to INT64_MAX on overflow.
+ */
+static int64_t
+sat_mul_count(int64_t cost, uint64_t count)
+{
+  int64_t result = 0;
+
+  if ((cost == 0) || (count == 0U))
+  {
+    result = 0;
+  }
+  else if (cost > 0)
+  {
+    if ((uint64_t)cost > ((uint64_t)INT64_MAX / count))
+    {
+      result = INT64_MAX;
+    }
+    else
+    {
+      uint64_t product = (uint64_t)cost * count;
+
+      result = (int64_t)product;
+    }
+  }
+  else
+  {
+    uint64_t magnitude = (uint64_t)(-(cost + 1)) + 1U;
+
+    if (magnitude > ((uint64_t)INT64_MAX / count))
+    {
+      result = INT64_MIN;
+    }
+    else
+    {
+      uint64_t product = magnitude * count;
+
+      result = -(int64_t)product;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Flushes all pending step counts into the spent budget and resets them.
+ *
+ * For each step kind with a non-zero count, adds count * per-step cost (cpu and
+ * mem separately) to the spent budget and zeroes the count, iterating the kinds
+ * in index order. Resets the pending total.
+ *
+ * \param[in,out] acc The accumulator to flush. Must not be NULL.
+ */
+static void
+flush_step_budget(cardano_uplc_step_accumulator_t* acc)
+{
+  size_t i = 0U;
+
+  for (i = 0U; i < CARDANO_UPLC_STEP_KIND_COUNT; ++i)
+  {
+    uint64_t n = acc->counts[i];
+
+    if (n > 0U)
+    {
+      cardano_uplc_budget_t cost = cardano_uplc_machine_costs_get(&acc->costs, (cardano_uplc_step_kind_t)i);
+
+      acc->spent.cpu = sat_add(acc->spent.cpu, sat_mul_count(cost.cpu, n));
+      acc->spent.mem = sat_add(acc->spent.mem, sat_mul_count(cost.mem, n));
+
+      acc->counts[i] = 0U;
+    }
+  }
+
+  acc->pending = 0U;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_step_accumulator_init(
+  cardano_uplc_step_accumulator_t*    acc,
+  const cardano_uplc_machine_costs_t* costs)
+{
+  if ((acc == NULL) || (costs == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  acc->costs     = *costs;
+  acc->spent.cpu = 0;
+  acc->spent.mem = 0;
+  acc->pending   = 0U;
+  acc->slippage  = CARDANO_UPLC_DEFAULT_SLIPPAGE;
+
+  (void)memset(acc->counts, 0, sizeof(acc->counts));
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_step_accumulator_charge_startup(cardano_uplc_step_accumulator_t* acc)
+{
+  if (acc == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  acc->spent.cpu = sat_add(acc->spent.cpu, acc->costs.startup.cpu);
+  acc->spent.mem = sat_add(acc->spent.mem, acc->costs.startup.mem);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_step_accumulator_step(
+  cardano_uplc_step_accumulator_t* acc,
+  cardano_uplc_step_kind_t         kind)
+{
+  if (acc == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((size_t)kind < CARDANO_UPLC_STEP_KIND_COUNT)
+  {
+    ++acc->counts[(size_t)kind];
+    ++acc->pending;
+  }
+
+  if (acc->pending >= acc->slippage)
+  {
+    flush_step_budget(acc);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_step_accumulator_charge(
+  cardano_uplc_step_accumulator_t* acc,
+  cardano_uplc_budget_t            delta)
+{
+  if (acc == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  acc->spent.cpu = sat_add(acc->spent.cpu, delta.cpu);
+  acc->spent.mem = sat_add(acc->spent.mem, delta.mem);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_step_accumulator_flush(cardano_uplc_step_accumulator_t* acc)
+{
+  if (acc == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  flush_step_budget(acc);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_uplc_budget_t
+cardano_uplc_step_accumulator_spent(const cardano_uplc_step_accumulator_t* acc)
+{
+  cardano_uplc_budget_t result = { 0, 0 };
+
+  if (acc != NULL)
+  {
+    result = acc->spent;
+  }
+
+  return result;
+}
+
+cardano_uplc_budget_t
+cardano_uplc_step_accumulator_remaining(
+  const cardano_uplc_step_accumulator_t* acc,
+  cardano_uplc_budget_t                  initial)
+{
+  cardano_uplc_budget_t result = initial;
+
+  if (acc != NULL)
+  {
+    result.cpu = sat_sub(initial.cpu, acc->spent.cpu);
+    result.mem = sat_sub(initial.mem, acc->spent.mem);
+  }
+
+  return result;
+}
+
+bool
+cardano_uplc_step_accumulator_is_exhausted(
+  const cardano_uplc_step_accumulator_t* acc,
+  cardano_uplc_budget_t                  initial)
+{
+  cardano_uplc_budget_t remaining;
+
+  if (acc == NULL)
+  {
+    return false;
+  }
+
+  remaining = cardano_uplc_step_accumulator_remaining(acc, initial);
+
+  return (remaining.cpu < 0) || (remaining.mem < 0);
+}
diff --git a/vendor/src/uplc/cost/uplc_step_accumulator.h b/vendor/src/uplc/cost/uplc_step_accumulator.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_step_accumulator.h
@@ -0,0 +1,203 @@
+/**
+ * \file uplc_step_accumulator.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_STEP_ACCUMULATOR_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_STEP_ACCUMULATOR_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../machine/uplc_budget.h"
+#include "uplc_machine_costs.h"
+#include "uplc_step_kind.h"
+
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Accumulates step counts per kind and flushes them into a budget.
+ *
+ * Step costs are not charged one transition at a time; each step bumps a
+ * per-kind counter, and once the total reaches \c slippage the accumulated
+ * counts are multiplied by the per-step cost and added to \c spent in one batch
+ * (and the counters reset). A final flush at machine end charges whatever is
+ * left. The end result equals, for every kind, count_of_kind * per_step_cost,
+ * which is what makes the batching budget-exact.
+ *
+ * Overflow posture: \c spent is signed 64-bit and is meant to grow past the
+ * initial budget (that is how exhaustion is detected). All additions and the
+ * count-times-cost product saturate at \c INT64_MAX rather than wrapping, so a
+ * malicious step count or cost can only ever drive the budget further into
+ * exhaustion, never wrap it back to a passing value.
+ */
+typedef struct cardano_uplc_step_accumulator_t
+{
+    /** \brief The per-step cost table used when flushing. */
+    cardano_uplc_machine_costs_t costs;
+    /** \brief Total budget charged so far (startup + flushed steps + explicit). */
+    cardano_uplc_budget_t spent;
+    /** \brief Pending occurrence count for each step kind, indexed by kind. */
+    uint64_t counts[CARDANO_UPLC_STEP_KIND_COUNT];
+    /** \brief Total pending step count across all kinds, the flush trigger. */
+    uint64_t pending;
+    /** \brief Flush threshold: flush when \c pending reaches this value. */
+    uint64_t slippage;
+} cardano_uplc_step_accumulator_t;
+
+/**
+ * \brief Initializes a step accumulator with a cost table and slippage.
+ *
+ * Zeroes the spent budget and all pending counts and copies \p costs into the
+ * accumulator. The slippage threshold is the default value (200).
+ *
+ * \param[out] acc The accumulator to initialize. Must not be NULL.
+ * \param[in] costs The per-step cost table to charge against. Must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if \p acc or \p costs is NULL.
+ */
+cardano_error_t
+cardano_uplc_step_accumulator_init(
+  cardano_uplc_step_accumulator_t*    acc,
+  const cardano_uplc_machine_costs_t* costs);
+
+/**
+ * \brief Charges the one-off startup cost into the spent budget.
+ *
+ * Call once before the evaluation loop. Adds \c costs.startup to \c spent with
+ * saturating addition.
+ *
+ * \param[in,out] acc The accumulator to charge. Must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if \p acc is NULL.
+ */
+cardano_error_t
+cardano_uplc_step_accumulator_charge_startup(cardano_uplc_step_accumulator_t* acc);
+
+/**
+ * \brief Records one CEK step of the given kind, flushing at the threshold.
+ *
+ * Increments the per-kind counter and the total pending count. When the total
+ * reaches the slippage threshold, every pending count is multiplied by its
+ * per-step cost, the products are added to the spent budget, and the counters
+ * reset.
+ *
+ * \param[in,out] acc The accumulator. Must not be NULL.
+ * \param[in] kind The kind of step taken.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if \p acc is NULL.
+ */
+cardano_error_t
+cardano_uplc_step_accumulator_step(
+  cardano_uplc_step_accumulator_t* acc,
+  cardano_uplc_step_kind_t         kind);
+
+/**
+ * \brief Adds an explicit budget delta to the spent budget.
+ *
+ * Used by builtins, which compute their own cost rather than a per-step cost.
+ * The delta is added to \c spent with saturating addition.
+ *
+ * \param[in,out] acc The accumulator. Must not be NULL.
+ * \param[in] delta The budget to charge.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if \p acc is NULL.
+ */
+cardano_error_t
+cardano_uplc_step_accumulator_charge(
+  cardano_uplc_step_accumulator_t* acc,
+  cardano_uplc_budget_t            delta);
+
+/**
+ * \brief Flushes any remaining pending step counts into the spent budget.
+ *
+ * Call once at machine end. After this returns, \c spent equals the exact total
+ * of every step's cost. Calling it again with no pending steps is a no-op.
+ *
+ * \param[in,out] acc The accumulator. Must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_POINTER_IS_NULL
+ *         if \p acc is NULL.
+ */
+cardano_error_t
+cardano_uplc_step_accumulator_flush(cardano_uplc_step_accumulator_t* acc);
+
+/**
+ * \brief Reads the total budget spent so far.
+ *
+ * Reflects the spent budget at the moment of the call; pending un-flushed steps
+ * are not included, so call \ref cardano_uplc_step_accumulator_flush first for
+ * the final total.
+ *
+ * \param[in] acc The accumulator. Must not be NULL.
+ *
+ * \return The spent budget, or a zero budget if \p acc is NULL.
+ */
+cardano_uplc_budget_t
+cardano_uplc_step_accumulator_spent(const cardano_uplc_step_accumulator_t* acc);
+
+/**
+ * \brief Tests whether an initial budget has been exhausted.
+ *
+ * The remaining budget is \p initial minus the spent budget; the budget is
+ * exhausted when either component of the remainder is negative. Pending
+ * un-flushed steps are not considered.
+ *
+ * \param[in] acc The accumulator. Must not be NULL.
+ * \param[in] initial The initial budget the script was given.
+ *
+ * \return \c true if remaining cpu or mem is negative, \c false otherwise (and
+ *         \c false if \p acc is NULL).
+ */
+bool
+cardano_uplc_step_accumulator_is_exhausted(
+  const cardano_uplc_step_accumulator_t* acc,
+  cardano_uplc_budget_t                  initial);
+
+/**
+ * \brief Computes the remaining budget for a given initial budget.
+ *
+ * Returns \p initial minus the spent budget, component-wise, with saturating
+ * subtraction. Pending un-flushed steps are not considered.
+ *
+ * \param[in] acc The accumulator. Must not be NULL.
+ * \param[in] initial The initial budget the script was given.
+ *
+ * \return The remaining budget, or \p initial if \p acc is NULL.
+ */
+cardano_uplc_budget_t
+cardano_uplc_step_accumulator_remaining(
+  const cardano_uplc_step_accumulator_t* acc,
+  cardano_uplc_budget_t                  initial);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_STEP_ACCUMULATOR_H */
diff --git a/vendor/src/uplc/cost/uplc_step_kind.h b/vendor/src/uplc/cost/uplc_step_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_step_kind.h
@@ -0,0 +1,76 @@
+/**
+ * \file uplc_step_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_STEP_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_STEP_KIND_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The number of CEK step kinds that carry a per-step cost.
+ *
+ * Startup is charged once outside the step loop and is not part of this set, so
+ * it is not counted here. The nine kinds run from constant through case.
+ */
+#define CARDANO_UPLC_STEP_KIND_COUNT ((size_t)9)
+
+/**
+ * \brief The kind of CEK machine step that incurs a per-step cost.
+ *
+ * The numeric values are the index into the per-kind occurrence array used by
+ * the slippage accumulator and must stay in this order. Startup is not a
+ * member: it is charged once by \ref cardano_uplc_step_accumulator_charge_startup.
+ */
+typedef enum
+{
+  /** \brief Computing a constant term. */
+  CARDANO_UPLC_STEP_KIND_CONSTANT = 0,
+  /** \brief Computing a variable term. */
+  CARDANO_UPLC_STEP_KIND_VAR = 1,
+  /** \brief Computing a lambda term. */
+  CARDANO_UPLC_STEP_KIND_LAMBDA = 2,
+  /** \brief Computing an apply term. */
+  CARDANO_UPLC_STEP_KIND_APPLY = 3,
+  /** \brief Computing a delay term. */
+  CARDANO_UPLC_STEP_KIND_DELAY = 4,
+  /** \brief Computing a force term. */
+  CARDANO_UPLC_STEP_KIND_FORCE = 5,
+  /** \brief Computing a builtin term (not the builtin call itself). */
+  CARDANO_UPLC_STEP_KIND_BUILTIN = 6,
+  /** \brief Computing a constr term. */
+  CARDANO_UPLC_STEP_KIND_CONSTR = 7,
+  /** \brief Computing a case term. */
+  CARDANO_UPLC_STEP_KIND_CASE = 8
+} cardano_uplc_step_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_STEP_KIND_H */
diff --git a/vendor/src/uplc/cost/uplc_subtracted_sizes_cost.h b/vendor/src/uplc/cost/uplc_subtracted_sizes_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_subtracted_sizes_cost.h
@@ -0,0 +1,54 @@
+/**
+ * \file uplc_subtracted_sizes_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SUBTRACTED_SIZES_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SUBTRACTED_SIZES_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A subtracted-sizes cost: \c slope * max(\c minimum, x - y) + \c intercept.
+ *
+ * The \c minimum floors the difference before the linear term is applied.
+ */
+typedef struct cardano_uplc_subtracted_sizes_cost_t
+{
+    /** \brief The constant term. */
+    int64_t intercept;
+    /** \brief The coefficient of the floored difference. */
+    int64_t slope;
+    /** \brief The lower bound applied to x - y before scaling. */
+    int64_t minimum;
+} cardano_uplc_subtracted_sizes_cost_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_SUBTRACTED_SIZES_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_three_arg_cost.c b/vendor/src/uplc/cost/uplc_three_arg_cost.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_three_arg_cost.c
@@ -0,0 +1,40 @@
+/**
+ * \file uplc_three_arg_cost.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_three_arg_cost.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* DEFINITIONS ***************************************************************/
+
+int64_t
+cardano_uplc_three_arg_cost_eval(const cardano_uplc_three_arg_cost_t* fn, int64_t x, int64_t y, int64_t z)
+{
+  if (fn == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_uplc_three_arg_eval(fn, x, y, z);
+}
diff --git a/vendor/src/uplc/cost/uplc_three_arg_cost.h b/vendor/src/uplc/cost/uplc_three_arg_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_three_arg_cost.h
@@ -0,0 +1,182 @@
+/**
+ * \file uplc_three_arg_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_THREE_ARG_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_THREE_ARG_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_exp_mod_cost.h"
+#include "uplc_linear_cost.h"
+#include "uplc_quadratic_cost.h"
+#include "uplc_three_arg_kind.h"
+#include "uplc_two_var_linear_cost.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A three-argument costing function as a tagged union.
+ *
+ * The active union member is selected by \c kind. Evaluate with
+ * \ref cardano_uplc_three_arg_cost_eval.
+ */
+typedef struct cardano_uplc_three_arg_cost_t
+{
+    /** \brief Selects the active union member. */
+    cardano_uplc_three_arg_kind_t kind;
+
+    /** \brief The variant parameters. */
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        /** \brief Active for CONSTANT. */
+        int64_t constant;
+        /** \brief Active for ADDED_SIZES, LINEAR_IN_X, LINEAR_IN_Y, LINEAR_IN_Z, LITERAL_IN_Y_OR_LINEAR_IN_Z, LINEAR_IN_MAX_YZ. */
+        cardano_uplc_linear_cost_t linear;
+        /** \brief Active for QUADRATIC_IN_Z. */
+        cardano_uplc_quadratic_cost_t quadratic_in_z;
+        /** \brief Active for EXP_MOD. */
+        cardano_uplc_exp_mod_cost_t exp_mod;
+        /** \brief Active for LINEAR_IN_Y_AND_Z. */
+        cardano_uplc_two_var_linear_cost_t linear_in_y_and_z;
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } params;
+} cardano_uplc_three_arg_cost_t;
+
+/**
+ * \brief Evaluates a non-NULL three-argument costing function at three sizes.
+ *
+ * \param[in] fn The costing function. Must not be NULL.
+ * \param[in] x The ex-mem size of the first argument.
+ * \param[in] y The ex-mem size of the second argument.
+ * \param[in] z The ex-mem size of the third argument.
+ *
+ * \return The saturating cost.
+ */
+static inline int64_t
+cardano_uplc_three_arg_eval(const cardano_uplc_three_arg_cost_t* fn, int64_t x, int64_t y, int64_t z)
+{
+  int64_t result = 0;
+
+  if (fn == NULL)
+  {
+    return result;
+  }
+
+  switch (fn->kind)
+  {
+    case CARDANO_UPLC_THREE_ARG_CONSTANT:
+    {
+      result = fn->params.constant;
+      break;
+    }
+    case CARDANO_UPLC_THREE_ARG_ADDED_SIZES:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, sat_add(sat_add(x, y), z));
+      break;
+    }
+    case CARDANO_UPLC_THREE_ARG_LINEAR_IN_X:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, x);
+      break;
+    }
+    case CARDANO_UPLC_THREE_ARG_LINEAR_IN_Y:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, y);
+      break;
+    }
+    case CARDANO_UPLC_THREE_ARG_LINEAR_IN_Z:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, z);
+      break;
+    }
+    case CARDANO_UPLC_THREE_ARG_QUADRATIC_IN_Z:
+    {
+      result = cardano_uplc_quadratic_cost_eval(fn->params.quadratic_in_z, z);
+      break;
+    }
+    case CARDANO_UPLC_THREE_ARG_EXP_MOD:
+    {
+      cardano_uplc_exp_mod_cost_t e    = fn->params.exp_mod;
+      int64_t                     yz   = sat_mul(y, z);
+      int64_t                     base = sat_add(e.coeff_00, sat_mul(e.coeff_11, yz));
+
+      base = sat_add(base, sat_mul(e.coeff_12, sat_mul(yz, z)));
+
+      result = (x <= z) ? base : sat_add(base, base / 2);
+      break;
+    }
+    case CARDANO_UPLC_THREE_ARG_LITERAL_IN_Y_OR_LINEAR_IN_Z:
+    {
+      if (y == 0)
+      {
+        result = cardano_uplc_linear_cost_eval(fn->params.linear, z);
+      }
+      else
+      {
+        result = y;
+      }
+      break;
+    }
+    case CARDANO_UPLC_THREE_ARG_LINEAR_IN_MAX_YZ:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, max_i64(y, z));
+      break;
+    }
+    case CARDANO_UPLC_THREE_ARG_LINEAR_IN_Y_AND_Z:
+    {
+      result = cardano_uplc_two_var_linear_cost_eval(fn->params.linear_in_y_and_z, y, z);
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Evaluates a three-argument costing function at three sizes.
+ *
+ * \param[in] fn The costing function. Must not be NULL.
+ * \param[in] x The ex-mem size of the first argument.
+ * \param[in] y The ex-mem size of the second argument.
+ * \param[in] z The ex-mem size of the third argument.
+ *
+ * \return The saturating cost, or 0 if \p fn is NULL.
+ */
+int64_t
+cardano_uplc_three_arg_cost_eval(const cardano_uplc_three_arg_cost_t* fn, int64_t x, int64_t y, int64_t z);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_THREE_ARG_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_three_arg_kind.h b/vendor/src/uplc/cost/uplc_three_arg_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_three_arg_kind.h
@@ -0,0 +1,62 @@
+/**
+ * \file uplc_three_arg_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_THREE_ARG_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_THREE_ARG_KIND_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Discriminator for a three-argument costing function.
+ */
+typedef enum
+{
+  /** \brief A fixed cost independent of all arguments. */
+  CARDANO_UPLC_THREE_ARG_CONSTANT = 0,
+  /** \brief Linear in x + y + z. */
+  CARDANO_UPLC_THREE_ARG_ADDED_SIZES = 1,
+  /** \brief Linear in x. */
+  CARDANO_UPLC_THREE_ARG_LINEAR_IN_X = 2,
+  /** \brief Linear in y. */
+  CARDANO_UPLC_THREE_ARG_LINEAR_IN_Y = 3,
+  /** \brief Linear in z. */
+  CARDANO_UPLC_THREE_ARG_LINEAR_IN_Z = 4,
+  /** \brief Quadratic in z. */
+  CARDANO_UPLC_THREE_ARG_QUADRATIC_IN_Z = 5,
+  /** \brief The exp-mod costing function. */
+  CARDANO_UPLC_THREE_ARG_EXP_MOD = 6,
+  /** \brief y when y != 0, else linear in z. */
+  CARDANO_UPLC_THREE_ARG_LITERAL_IN_Y_OR_LINEAR_IN_Z = 7,
+  /** \brief Linear in max(y, z). */
+  CARDANO_UPLC_THREE_ARG_LINEAR_IN_MAX_YZ = 8,
+  /** \brief Linear in y and z with separate slopes. */
+  CARDANO_UPLC_THREE_ARG_LINEAR_IN_Y_AND_Z = 9
+} cardano_uplc_three_arg_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_THREE_ARG_KIND_H */
diff --git a/vendor/src/uplc/cost/uplc_two_arg_cost.c b/vendor/src/uplc/cost/uplc_two_arg_cost.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_two_arg_cost.c
@@ -0,0 +1,40 @@
+/**
+ * \file uplc_two_arg_cost.c
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_two_arg_cost.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* DEFINITIONS ***************************************************************/
+
+int64_t
+cardano_uplc_two_arg_cost_eval(const cardano_uplc_two_arg_cost_t* fn, int64_t x, int64_t y)
+{
+  if (fn == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_uplc_two_arg_eval(fn, x, y);
+}
diff --git a/vendor/src/uplc/cost/uplc_two_arg_cost.h b/vendor/src/uplc/cost/uplc_two_arg_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_two_arg_cost.h
@@ -0,0 +1,259 @@
+/**
+ * \file uplc_two_arg_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_ARG_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_ARG_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_const_or_linear_cost.h"
+#include "uplc_const_or_two_arg_cost.h"
+#include "uplc_linear_cost.h"
+#include "uplc_quadratic_cost.h"
+#include "uplc_subtracted_sizes_cost.h"
+#include "uplc_two_arg_kind.h"
+#include "uplc_two_var_linear_cost.h"
+#include "uplc_two_var_quadratic_cost.h"
+#include "uplc_with_interaction_cost.h"
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A two-argument costing function as a tagged union.
+ *
+ * The active union member is selected by \c kind. Evaluate with
+ * \ref cardano_uplc_two_arg_cost_eval.
+ */
+typedef struct cardano_uplc_two_arg_cost_t
+{
+    /** \brief Selects the active union member. */
+    cardano_uplc_two_arg_kind_t kind;
+
+    /** \brief The variant parameters. */
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        /** \brief Active for CONSTANT. */
+        int64_t constant;
+        /** \brief Active for LINEAR_IN_X, LINEAR_IN_Y, ADDED_SIZES, MULTIPLIED_SIZES, MIN_SIZE, MAX_SIZE, DROP_LIST. */
+        cardano_uplc_linear_cost_t linear;
+        /** \brief Active for LINEAR_IN_X_AND_Y. */
+        cardano_uplc_two_var_linear_cost_t linear_in_x_and_y;
+        /** \brief Active for WITH_INTERACTION. */
+        cardano_uplc_with_interaction_cost_t with_interaction;
+        /** \brief Active for SUBTRACTED_SIZES and LINEAR_IN_Y2. */
+        cardano_uplc_subtracted_sizes_cost_t subtracted_sizes;
+        /** \brief Active for LINEAR_ON_DIAGONAL. */
+        cardano_uplc_const_or_linear_cost_t linear_on_diagonal;
+        /** \brief Active for CONST_ABOVE_DIAGONAL, ABOVE_AND_BELOW_DIAGONAL, CONST_BELOW_DIAGONAL. */
+        cardano_uplc_const_or_two_arg_cost_t const_diagonal;
+        /** \brief Active for QUADRATIC_IN_Y. */
+        cardano_uplc_quadratic_cost_t quadratic_in_y;
+        /** \brief Active for QUADRATIC_IN_X_AND_Y. */
+        cardano_uplc_two_var_quadratic_cost_t quadratic_in_x_and_y;
+
+        /** \brief Active for CONST_ABOVE_DIAGONAL_INTO_QUADRATIC. */
+        struct
+        {
+            /** \brief The flat cost charged when x < y. */
+            int64_t constant;
+            /** \brief The quadratic evaluated when x >= y. */
+            cardano_uplc_two_var_quadratic_cost_t quadratic;
+        } const_above_into_quadratic;
+
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } params;
+} cardano_uplc_two_arg_cost_t;
+
+/**
+ * \brief Evaluates a non-NULL two-argument costing function at two sizes.
+ *
+ * \param[in] fn The costing function. Must not be NULL.
+ * \param[in] x The ex-mem size of the first argument.
+ * \param[in] y The ex-mem size of the second argument.
+ *
+ * \return The saturating cost.
+ */
+static inline int64_t
+cardano_uplc_two_arg_eval(const cardano_uplc_two_arg_cost_t* fn, int64_t x, int64_t y)
+{
+  int64_t result = 0;
+
+  switch (fn->kind)
+  {
+    case CARDANO_UPLC_TWO_ARG_CONSTANT:
+    {
+      result = fn->params.constant;
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_LINEAR_IN_X:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, x);
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, y);
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_LINEAR_IN_X_AND_Y:
+    {
+      result = cardano_uplc_two_var_linear_cost_eval(fn->params.linear_in_x_and_y, x, y);
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_WITH_INTERACTION:
+    {
+      cardano_uplc_with_interaction_cost_t w = fn->params.with_interaction;
+
+      result = sat_add(w.c00, sat_mul(w.c10, x));
+      result = sat_add(result, sat_mul(w.c01, y));
+      result = sat_add(result, sat_mul(w.c11, sat_mul(x, y)));
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_ADDED_SIZES:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, sat_add(x, y));
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_SUBTRACTED_SIZES:
+    {
+      cardano_uplc_subtracted_sizes_cost_t s   = fn->params.subtracted_sizes;
+      int64_t                              arg = max_i64(s.minimum, sat_sub(x, y));
+
+      result = sat_add(s.intercept, sat_mul(s.slope, arg));
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_MULTIPLIED_SIZES:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, sat_mul(x, y));
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_MIN_SIZE:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, min_i64(x, y));
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_MAX_SIZE:
+    {
+      result = cardano_uplc_linear_cost_eval(fn->params.linear, max_i64(x, y));
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_LINEAR_ON_DIAGONAL:
+    {
+      cardano_uplc_const_or_linear_cost_t d = fn->params.linear_on_diagonal;
+
+      if (x == y)
+      {
+        result = sat_add(d.intercept, sat_mul(d.slope, x));
+      }
+      else
+      {
+        result = d.constant;
+      }
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_CONST_ABOVE_DIAGONAL:
+    {
+      cardano_uplc_const_or_two_arg_cost_t c = fn->params.const_diagonal;
+
+      result = (x < y) ? c.constant : cardano_uplc_const_or_two_arg_cost_eval(c, x, y);
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_ABOVE_AND_BELOW_DIAGONAL:
+    {
+      cardano_uplc_const_or_two_arg_cost_t c = fn->params.const_diagonal;
+
+      result = cardano_uplc_const_or_two_arg_cost_eval(c, max_i64(x, y), min_i64(x, y));
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_CONST_BELOW_DIAGONAL:
+    {
+      cardano_uplc_const_or_two_arg_cost_t c = fn->params.const_diagonal;
+
+      result = (x > y) ? c.constant : cardano_uplc_const_or_two_arg_cost_eval(c, x, y);
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_QUADRATIC_IN_Y:
+    {
+      result = cardano_uplc_quadratic_cost_eval(fn->params.quadratic_in_y, y);
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_QUADRATIC_IN_X_AND_Y:
+    {
+      result = cardano_uplc_two_var_quadratic_cost_eval(fn->params.quadratic_in_x_and_y, x, y);
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_CONST_ABOVE_DIAGONAL_INTO_QUADRATIC:
+    {
+      if (x < y)
+      {
+        result = fn->params.const_above_into_quadratic.constant;
+      }
+      else
+      {
+        result = cardano_uplc_two_var_quadratic_cost_eval(fn->params.const_above_into_quadratic.quadratic, x, y);
+      }
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_DROP_LIST:
+    {
+      result = fn->params.linear.intercept;
+      break;
+    }
+    case CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y2:
+    {
+      cardano_uplc_subtracted_sizes_cost_t s = fn->params.subtracted_sizes;
+
+      result = sat_add(s.intercept, sat_mul(s.slope, y));
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Evaluates a two-argument costing function at two sizes.
+ *
+ * \param[in] fn The costing function. Must not be NULL.
+ * \param[in] x The ex-mem size of the first argument.
+ * \param[in] y The ex-mem size of the second argument.
+ *
+ * \return The saturating cost, or 0 if \p fn is NULL.
+ */
+int64_t
+cardano_uplc_two_arg_cost_eval(const cardano_uplc_two_arg_cost_t* fn, int64_t x, int64_t y);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_ARG_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_two_arg_kind.h b/vendor/src/uplc/cost/uplc_two_arg_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_two_arg_kind.h
@@ -0,0 +1,85 @@
+/**
+ * \file uplc_two_arg_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_ARG_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_ARG_KIND_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Discriminator for a two-argument costing function.
+ *
+ * The \c DROP_LIST arm is the V4 dropList shape, which charges the linear
+ * intercept only. The \c LINEAR_IN_Y2 arm is the cost model D memory shape of
+ * modInteger and remainderInteger: linear in y, carrying a subtracted-sizes
+ * minimum that is never read so the ledger parameter list keeps its length.
+ */
+typedef enum
+{
+  /** \brief A fixed cost independent of both arguments. */
+  CARDANO_UPLC_TWO_ARG_CONSTANT = 0,
+  /** \brief Linear in x. */
+  CARDANO_UPLC_TWO_ARG_LINEAR_IN_X = 1,
+  /** \brief Linear in y. */
+  CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y = 2,
+  /** \brief Linear in x and y with separate slopes. */
+  CARDANO_UPLC_TWO_ARG_LINEAR_IN_X_AND_Y = 3,
+  /** \brief Bilinear with an x*y interaction term. */
+  CARDANO_UPLC_TWO_ARG_WITH_INTERACTION = 4,
+  /** \brief Linear in x + y. */
+  CARDANO_UPLC_TWO_ARG_ADDED_SIZES = 5,
+  /** \brief Linear in the floored difference x - y. */
+  CARDANO_UPLC_TWO_ARG_SUBTRACTED_SIZES = 6,
+  /** \brief Linear in x * y. */
+  CARDANO_UPLC_TWO_ARG_MULTIPLIED_SIZES = 7,
+  /** \brief Linear in min(x, y). */
+  CARDANO_UPLC_TWO_ARG_MIN_SIZE = 8,
+  /** \brief Linear in max(x, y). */
+  CARDANO_UPLC_TWO_ARG_MAX_SIZE = 9,
+  /** \brief Linear on the diagonal, constant off it. */
+  CARDANO_UPLC_TWO_ARG_LINEAR_ON_DIAGONAL = 10,
+  /** \brief Constant when x < y, nested model otherwise. */
+  CARDANO_UPLC_TWO_ARG_CONST_ABOVE_DIAGONAL = 11,
+  /** \brief Nested model evaluated at (max(x,y), min(x,y)). */
+  CARDANO_UPLC_TWO_ARG_ABOVE_AND_BELOW_DIAGONAL = 12,
+  /** \brief Constant when x > y, nested model otherwise. */
+  CARDANO_UPLC_TWO_ARG_CONST_BELOW_DIAGONAL = 13,
+  /** \brief Quadratic in y. */
+  CARDANO_UPLC_TWO_ARG_QUADRATIC_IN_Y = 14,
+  /** \brief Two-variable quadratic in x and y. */
+  CARDANO_UPLC_TWO_ARG_QUADRATIC_IN_X_AND_Y = 15,
+  /** \brief Constant when x < y, two-variable quadratic otherwise. */
+  CARDANO_UPLC_TWO_ARG_CONST_ABOVE_DIAGONAL_INTO_QUADRATIC = 16,
+  /** \brief Charges the linear intercept only (V4 dropList). */
+  CARDANO_UPLC_TWO_ARG_DROP_LIST = 17,
+  /** \brief Linear in y, ignoring the carried minimum. */
+  CARDANO_UPLC_TWO_ARG_LINEAR_IN_Y2 = 18
+} cardano_uplc_two_arg_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_ARG_KIND_H */
diff --git a/vendor/src/uplc/cost/uplc_two_var_linear_cost.h b/vendor/src/uplc/cost/uplc_two_var_linear_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_two_var_linear_cost.h
@@ -0,0 +1,75 @@
+/**
+ * \file uplc_two_var_linear_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_VAR_LINEAR_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_VAR_LINEAR_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_cost_sat.h"
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A two-variable linear cost: \c intercept + \c slope1 * x + \c slope2 * y.
+ *
+ * Reused for the two-argument linear-in-x-and-y arm and the three-argument
+ * linear-in-y-and-z arm.
+ */
+typedef struct cardano_uplc_two_var_linear_cost_t
+{
+    /** \brief The constant term. */
+    int64_t intercept;
+    /** \brief The coefficient of the first variable. */
+    int64_t slope1;
+    /** \brief The coefficient of the second variable. */
+    int64_t slope2;
+} cardano_uplc_two_var_linear_cost_t;
+
+/**
+ * \brief Evaluates a two-variable linear cost intercept + s1*x + s2*y, saturating.
+ *
+ * \param[in] l The two-variable linear parameters.
+ * \param[in] x The first size argument.
+ * \param[in] y The second size argument.
+ *
+ * \return The saturating two-variable linear value.
+ */
+static inline int64_t
+cardano_uplc_two_var_linear_cost_eval(cardano_uplc_two_var_linear_cost_t l, int64_t x, int64_t y)
+{
+  int64_t result = sat_add(l.intercept, sat_mul(l.slope1, x));
+  result         = sat_add(result, sat_mul(l.slope2, y));
+
+  return result;
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_VAR_LINEAR_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_two_var_quadratic_cost.h b/vendor/src/uplc/cost/uplc_two_var_quadratic_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_two_var_quadratic_cost.h
@@ -0,0 +1,89 @@
+/**
+ * \file uplc_two_var_quadratic_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_VAR_QUADRATIC_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_VAR_QUADRATIC_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_cost_sat.h"
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A two-variable quadratic floored by a minimum.
+ *
+ * Evaluates max(\c minimum, \c coeff_00 + \c coeff_10 * x + \c coeff_01 * y +
+ * \c coeff_20 * x * x + \c coeff_11 * x * y + \c coeff_02 * y * y).
+ */
+typedef struct cardano_uplc_two_var_quadratic_cost_t
+{
+    /** \brief The lower bound on the result. */
+    int64_t minimum;
+    /** \brief The constant term. */
+    int64_t coeff_00;
+    /** \brief The coefficient of x. */
+    int64_t coeff_10;
+    /** \brief The coefficient of y. */
+    int64_t coeff_01;
+    /** \brief The coefficient of x*x. */
+    int64_t coeff_20;
+    /** \brief The coefficient of x*y. */
+    int64_t coeff_11;
+    /** \brief The coefficient of y*y. */
+    int64_t coeff_02;
+} cardano_uplc_two_var_quadratic_cost_t;
+
+/**
+ * \brief Evaluates a two-variable quadratic floored by its minimum, saturating.
+ *
+ * Computes c00 + c10*x + c01*y + c20*x*x + c11*x*y + c02*y*y, then takes the
+ * maximum with the configured minimum.
+ *
+ * \param[in] q The two-variable quadratic parameters.
+ * \param[in] x The first size argument.
+ * \param[in] y The second size argument.
+ *
+ * \return max(minimum, quadratic), saturating.
+ */
+static inline int64_t
+cardano_uplc_two_var_quadratic_cost_eval(cardano_uplc_two_var_quadratic_cost_t q, int64_t x, int64_t y)
+{
+  int64_t result = sat_add(q.coeff_00, sat_mul(q.coeff_10, x));
+  result         = sat_add(result, sat_mul(q.coeff_01, y));
+  result         = sat_add(result, sat_mul(q.coeff_20, sat_mul(x, x)));
+  result         = sat_add(result, sat_mul(q.coeff_11, sat_mul(x, y)));
+  result         = sat_add(result, sat_mul(q.coeff_02, sat_mul(y, y)));
+
+  return max_i64(q.minimum, result);
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_TWO_VAR_QUADRATIC_COST_H */
diff --git a/vendor/src/uplc/cost/uplc_with_interaction_cost.h b/vendor/src/uplc/cost/uplc_with_interaction_cost.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/cost/uplc_with_interaction_cost.h
@@ -0,0 +1,54 @@
+/**
+ * \file uplc_with_interaction_cost.h
+ *
+ * \author angel.castillo
+ * \date   Jun 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_WITH_INTERACTION_COST_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_WITH_INTERACTION_COST_H
+
+/* INCLUDES ******************************************************************/
+
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A bilinear cost with interaction: \c c00 + \c c10 * x + \c c01 * y + \c c11 * x * y.
+ */
+typedef struct cardano_uplc_with_interaction_cost_t
+{
+    /** \brief The constant term. */
+    int64_t c00;
+    /** \brief The coefficient of x. */
+    int64_t c10;
+    /** \brief The coefficient of y. */
+    int64_t c01;
+    /** \brief The coefficient of the x*y interaction term. */
+    int64_t c11;
+} cardano_uplc_with_interaction_cost_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_COST_UPLC_WITH_INTERACTION_COST_H */
diff --git a/vendor/src/uplc/data/uplc_data.c b/vendor/src/uplc/data/uplc_data.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/data/uplc_data.c
@@ -0,0 +1,3067 @@
+/**
+ * \file uplc_data.c
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_data.h"
+
+#include "../../allocators.h"
+#include "../ast/uplc_int.h"
+
+#include <cardano/common/byte_order.h>
+#include <cardano/plutus_data/constr_plutus_data.h>
+#include <cardano/plutus_data/plutus_list.h>
+#include <cardano/plutus_data/plutus_map.h>
+
+#include <src/string_safe.h>
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief The memory units charged per Plutus-data node.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_DATA_NODE_COST = 4;
+
+/**
+ * \brief The number of 64-bit words an integer occupies for one memory unit.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_DATA_INTEGER_WORD_BITS = 64;
+
+/**
+ * \brief The byte-string chunk size: one memory unit per this many bytes.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int64_t CARDANO_UPLC_DATA_BYTE_STRING_CHUNK = 8;
+
+/**
+ * \brief The maximum Plutus-data nesting the recursive converters descend.
+ *
+ * The cost (ex-mem, node count), CBOR serialization and structural-equality walks are
+ * iterative and carry no depth limit. Only the converters that bridge to the recursive
+ * library plutus-data type (decode, and the library handoff in both directions) remain
+ * recursive; this caps their recursion so adversarial nesting fails gracefully with a
+ * decoding error instead of overflowing the C stack. The bound stays far above any
+ * depth legitimate on-chain data reaches, and the library plutus-data type cannot
+ * itself represent deeper trees, so no input the reference accepts is rejected here.
+ */
+static const uint32_t CARDANO_UPLC_DATA_MAX_DEPTH = 8192U;
+
+/**
+ * \brief The CBOR major-type-2 indefinite-length byte-string header byte.
+ */
+static const byte_t CARDANO_UPLC_DATA_INDEFINITE_BYTE_STRING = 95;
+
+/**
+ * \brief The byte-string chunk size used by the canonical CBOR serializer.
+ */
+static const size_t CARDANO_UPLC_DATA_CBOR_CHUNK = 64U;
+
+/**
+ * \brief Marks an uncomputed memoized field on a data node.
+ */
+static const int64_t CARDANO_UPLC_DATA_UNCOMPUTED = -1;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Releases the arena's reference to a bigint registered for unref.
+ *
+ * \param[in] object The \ref cardano_bigint_t the arena owns a reference to.
+ */
+static void
+unref_bigint(void* object)
+{
+  cardano_bigint_t* bigint = (cardano_bigint_t*)object;
+
+  cardano_bigint_unref(&bigint);
+}
+
+/**
+ * \brief A pair of nodes pending a structural-equality comparison.
+ */
+typedef struct equals_pair_t
+{
+    const cardano_uplc_data_t* lhs;
+    const cardano_uplc_data_t* rhs;
+} equals_pair_t;
+
+/**
+ * \brief Grows a heap work stack to hold at least one more element.
+ *
+ * \param[in,out] stack The stack base pointer.
+ * \param[in,out] capacity The current element capacity.
+ * \param[in] element_size The size in bytes of one element.
+ *
+ * \return \c true on success, \c false if reallocation fails.
+ */
+static bool
+stack_reserve(void** stack, size_t* capacity, size_t element_size)
+{
+  size_t next  = (*capacity == 0U) ? 64U : (*capacity * 2U);
+  void*  grown = _cardano_realloc(*stack, next * element_size);
+
+  if (grown == NULL)
+  {
+    return false;
+  }
+
+  *stack    = grown;
+  *capacity = next;
+
+  return true;
+}
+
+/**
+ * \brief Pushes a node pair onto the equality work stack, growing it as needed.
+ *
+ * \param[in,out] stack The stack base pointer.
+ * \param[in,out] capacity The current element capacity.
+ * \param[in,out] count The current element count.
+ * \param[in] lhs The first node of the pair.
+ * \param[in] rhs The second node of the pair.
+ *
+ * \return \c true on success, \c false if the stack cannot grow.
+ */
+static bool
+equals_push(
+  equals_pair_t**            stack,
+  size_t*                    capacity,
+  size_t*                    count,
+  const cardano_uplc_data_t* lhs,
+  const cardano_uplc_data_t* rhs)
+{
+  if ((*count >= *capacity) && !stack_reserve((void**)stack, capacity, sizeof(equals_pair_t)))
+  {
+    return false;
+  }
+
+  (*stack)[*count].lhs = lhs;
+  (*stack)[*count].rhs = rhs;
+  ++(*count);
+
+  return true;
+}
+
+/**
+ * \brief A post-order traversal frame: a node and whether its children were pushed.
+ */
+typedef struct walk_frame_t
+{
+    const cardano_uplc_data_t* node;
+    bool                       expanded;
+} walk_frame_t;
+
+/**
+ * \brief Pushes a traversal frame onto a heap work stack, growing it as needed.
+ *
+ * \param[in,out] stack The stack base pointer.
+ * \param[in,out] capacity The current element capacity.
+ * \param[in,out] count The current element count.
+ * \param[in] node The node to push.
+ * \param[in] expanded Whether the frame's children have already been pushed.
+ *
+ * \return \c true on success, \c false if the stack cannot grow.
+ */
+static bool
+walk_push(
+  walk_frame_t**             stack,
+  size_t*                    capacity,
+  size_t*                    count,
+  const cardano_uplc_data_t* node,
+  bool                       expanded)
+{
+  if ((*count >= *capacity) && !stack_reserve((void**)stack, capacity, sizeof(walk_frame_t)))
+  {
+    return false;
+  }
+
+  (*stack)[*count].node     = node;
+  (*stack)[*count].expanded = expanded;
+  ++(*count);
+
+  return true;
+}
+
+/**
+ * \brief Allocates and zero-initializes a bare data node from the arena.
+ *
+ * Sets the memoized ex-mem and node-count fields to the uncomputed sentinel and
+ * leaves the union arm to the caller.
+ *
+ * \param[in] arena The arena to allocate from.
+ *
+ * \return The new node, or NULL when the arena cannot serve it.
+ */
+static cardano_uplc_data_t*
+alloc_node(cardano_uplc_arena_t* arena)
+{
+  cardano_uplc_data_t* node = (cardano_uplc_data_t*)cardano_uplc_arena_alloc(arena, sizeof(cardano_uplc_data_t), 0U);
+
+  if (node == NULL)
+  {
+    return NULL;
+  }
+
+  (void)memset(node, 0, sizeof(cardano_uplc_data_t));
+
+  node->ex_mem     = CARDANO_UPLC_DATA_UNCOMPUTED;
+  node->node_count = CARDANO_UPLC_DATA_UNCOMPUTED;
+
+  return node;
+}
+
+/**
+ * \brief Returns the ex-mem of an integer leaf in 64-bit words.
+ *
+ * Zero costs one word; a non-zero integer costs floor(log2(|n|)) / 64 + 1.
+ *
+ * \param[in] data An integer data node.
+ *
+ * \return The integer leaf ex-mem.
+ */
+static int64_t
+integer_ex_mem(const cardano_uplc_data_t* data)
+{
+  size_t  bits = 0U;
+  int64_t log2 = 0;
+
+  if (data->as.integer.is_small)
+  {
+    uint64_t magnitude = 0U;
+
+    if (data->as.integer.small == 0)
+    {
+      return 1;
+    }
+
+    if (data->as.integer.small < 0)
+    {
+      magnitude = (uint64_t)(-(data->as.integer.small + 1)) + 1U;
+    }
+    else
+    {
+      magnitude = (uint64_t)data->as.integer.small;
+    }
+
+    bits = 0U;
+
+    while (magnitude != 0U)
+    {
+      ++bits;
+      magnitude >>= 1U;
+    }
+
+    log2 = (int64_t)bits - 1;
+
+    return (log2 / CARDANO_UPLC_DATA_INTEGER_WORD_BITS) + 1;
+  }
+
+  if ((data->as.integer.big == NULL) || cardano_bigint_is_zero(data->as.integer.big))
+  {
+    return 1;
+  }
+
+  bits = cardano_bigint_bit_length(data->as.integer.big);
+  log2 = (int64_t)bits - 1;
+
+  return (log2 / CARDANO_UPLC_DATA_INTEGER_WORD_BITS) + 1;
+}
+
+/**
+ * \brief Returns the ex-mem of a byte-string leaf in 8-byte chunks.
+ *
+ * \param[in] length The byte-string length.
+ *
+ * \return The byte-string leaf ex-mem.
+ */
+static int64_t
+byte_string_ex_mem(size_t length)
+{
+  if (length == 0U)
+  {
+    return 1;
+  }
+
+  return (((int64_t)length - 1) / CARDANO_UPLC_DATA_BYTE_STRING_CHUNK) + 1;
+}
+
+/**
+ * \brief Computes the data ex-mem of a subtree, depth-bounded.
+ *
+ * \param[in] data The data node, or NULL.
+ * \param[in] depth The current recursion depth.
+ *
+ * \return The subtree ex-mem.
+ */
+/**
+ * \brief Pushes the immediate children of a node onto a node work stack.
+ *
+ * \param[in] data The parent node.
+ * \param[in,out] stack The stack base pointer.
+ * \param[in,out] capacity The current element capacity.
+ * \param[in,out] count The current element count.
+ *
+ * \return \c true on success, \c false if the stack cannot grow.
+ */
+static bool
+push_children(
+  const cardano_uplc_data_t* data,
+  walk_frame_t**             stack,
+  size_t*                    capacity,
+  size_t*                    count)
+{
+  size_t i = 0U;
+
+  switch (data->kind)
+  {
+    case CARDANO_UPLC_DATA_KIND_CONSTR:
+    {
+      for (i = 0U; i < data->as.constr.count; ++i)
+      {
+        if (!walk_push(stack, capacity, count, data->as.constr.fields[i], false))
+        {
+          return false;
+        }
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_MAP:
+    {
+      for (i = 0U; i < data->as.map.count; ++i)
+      {
+        if (!walk_push(stack, capacity, count, data->as.map.entries[i].key, false) || !walk_push(stack, capacity, count, data->as.map.entries[i].value, false))
+        {
+          return false;
+        }
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_LIST:
+    {
+      for (i = 0U; i < data->as.list.count; ++i)
+      {
+        if (!walk_push(stack, capacity, count, data->as.list.items[i], false))
+        {
+          return false;
+        }
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_INTEGER:
+    case CARDANO_UPLC_DATA_KIND_BYTES:
+    default:
+    {
+      break;
+    }
+  }
+
+  return true;
+}
+
+/**
+ * \brief Sums the memoized ex-mem of a node's immediate children.
+ *
+ * \param[in] data The parent node, whose children's ex-mem memos are set.
+ *
+ * \return The total child ex-mem.
+ */
+static int64_t
+children_ex_mem(const cardano_uplc_data_t* data)
+{
+  int64_t total = 0;
+  size_t  i     = 0U;
+
+  switch (data->kind)
+  {
+    case CARDANO_UPLC_DATA_KIND_CONSTR:
+    {
+      for (i = 0U; i < data->as.constr.count; ++i)
+      {
+        const cardano_uplc_data_t* child = data->as.constr.fields[i];
+
+        total += (child != NULL) ? child->ex_mem : 0;
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_MAP:
+    {
+      for (i = 0U; i < data->as.map.count; ++i)
+      {
+        const cardano_uplc_data_t* key   = data->as.map.entries[i].key;
+        const cardano_uplc_data_t* value = data->as.map.entries[i].value;
+
+        total += (key != NULL) ? key->ex_mem : 0;
+        total += (value != NULL) ? value->ex_mem : 0;
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_LIST:
+    {
+      for (i = 0U; i < data->as.list.count; ++i)
+      {
+        const cardano_uplc_data_t* child = data->as.list.items[i];
+
+        total += (child != NULL) ? child->ex_mem : 0;
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_INTEGER:
+    {
+      total += integer_ex_mem(data);
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_BYTES:
+    {
+      total += byte_string_ex_mem(data->as.bytes.size);
+
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+
+  return total;
+}
+
+/**
+ * \brief Sums the memoized node count of a node's immediate children.
+ *
+ * \param[in] data The parent node, whose children's node-count memos are set.
+ *
+ * \return The total child node count.
+ */
+static int64_t
+children_node_count(const cardano_uplc_data_t* data)
+{
+  int64_t total = 0;
+  size_t  i     = 0U;
+
+  switch (data->kind)
+  {
+    case CARDANO_UPLC_DATA_KIND_CONSTR:
+    {
+      for (i = 0U; i < data->as.constr.count; ++i)
+      {
+        const cardano_uplc_data_t* child = data->as.constr.fields[i];
+
+        total += (child != NULL) ? child->node_count : 0;
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_MAP:
+    {
+      for (i = 0U; i < data->as.map.count; ++i)
+      {
+        const cardano_uplc_data_t* key   = data->as.map.entries[i].key;
+        const cardano_uplc_data_t* value = data->as.map.entries[i].value;
+
+        total += (key != NULL) ? key->node_count : 0;
+        total += (value != NULL) ? value->node_count : 0;
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_LIST:
+    {
+      for (i = 0U; i < data->as.list.count; ++i)
+      {
+        const cardano_uplc_data_t* child = data->as.list.items[i];
+
+        total += (child != NULL) ? child->node_count : 0;
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_INTEGER:
+    case CARDANO_UPLC_DATA_KIND_BYTES:
+    default:
+    {
+      break;
+    }
+  }
+
+  return total;
+}
+
+/**
+ * \brief Computes the data ex-mem of a subtree iteratively, memoizing every node.
+ *
+ * Uses an explicit post-order work stack so adversarial nesting cannot overflow the C
+ * stack. On allocation failure the partial walk is abandoned and the contribution of
+ * the unmeasured subtree is taken as the per-node base cost so the result is never
+ * larger than the true ex-mem.
+ *
+ * \param[in] data The data node, or NULL.
+ *
+ * \return The subtree ex-mem.
+ */
+static int64_t
+compute_ex_mem(const cardano_uplc_data_t* data)
+{
+  walk_frame_t* stack    = NULL;
+  size_t        capacity = 0U;
+  size_t        count    = 0U;
+
+  if (data == NULL)
+  {
+    return 0;
+  }
+
+  if (data->ex_mem != CARDANO_UPLC_DATA_UNCOMPUTED)
+  {
+    return data->ex_mem;
+  }
+
+  if (!walk_push(&stack, &capacity, &count, data, false))
+  {
+    return CARDANO_UPLC_DATA_NODE_COST;
+  }
+
+  while (count > 0U)
+  {
+    // cppcheck-suppress misra-c2012-13.3; Reason: local post-increment with no aliasing
+    walk_frame_t frame = stack[--count];
+
+    if ((frame.node == NULL) || (frame.node->ex_mem != CARDANO_UPLC_DATA_UNCOMPUTED))
+    {
+      continue;
+    }
+
+    if (frame.expanded)
+    {
+      // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+      ((cardano_uplc_data_t*)((void*)frame.node))->ex_mem = CARDANO_UPLC_DATA_NODE_COST + children_ex_mem(frame.node);
+
+      continue;
+    }
+
+    if (!walk_push(&stack, &capacity, &count, frame.node, true) || !push_children(frame.node, &stack, &capacity, &count))
+    {
+      _cardano_free(stack);
+
+      return CARDANO_UPLC_DATA_NODE_COST;
+    }
+  }
+
+  _cardano_free(stack);
+
+  return data->ex_mem;
+}
+
+/**
+ * \brief Counts the nodes of a subtree iteratively, memoizing every node.
+ *
+ * Uses an explicit post-order work stack so adversarial nesting cannot overflow the C
+ * stack. On allocation failure the partial walk is abandoned and the contribution of
+ * the uncounted subtree is taken as a single node so the result is never larger than
+ * the true node count.
+ *
+ * \param[in] data The data node, or NULL.
+ *
+ * \return The subtree node count.
+ */
+static int64_t
+compute_node_count(const cardano_uplc_data_t* data)
+{
+  walk_frame_t* stack    = NULL;
+  size_t        capacity = 0U;
+  size_t        count    = 0U;
+
+  if (data == NULL)
+  {
+    return 0;
+  }
+
+  if (data->node_count != CARDANO_UPLC_DATA_UNCOMPUTED)
+  {
+    return data->node_count;
+  }
+
+  if (!walk_push(&stack, &capacity, &count, data, false))
+  {
+    return 1;
+  }
+
+  while (count > 0U)
+  {
+    // cppcheck-suppress misra-c2012-13.3; Reason: local post-increment with no aliasing
+    walk_frame_t frame = stack[--count];
+
+    if ((frame.node == NULL) || (frame.node->node_count != CARDANO_UPLC_DATA_UNCOMPUTED))
+    {
+      continue;
+    }
+
+    if (frame.expanded)
+    {
+      // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+      ((cardano_uplc_data_t*)((void*)frame.node))->node_count = 1 + children_node_count(frame.node);
+
+      continue;
+    }
+
+    if (!walk_push(&stack, &capacity, &count, frame.node, true) || !push_children(frame.node, &stack, &capacity, &count))
+    {
+      _cardano_free(stack);
+
+      return 1;
+    }
+  }
+
+  _cardano_free(stack);
+
+  return data->node_count;
+}
+
+/**
+ * \brief Tests two integer data nodes for value equality.
+ *
+ * Compares the inline values directly when both are inline; otherwise materializes
+ * is avoided by comparing through the bigint when present and the inline value
+ * promoted to a bigint-free comparison when one side is inline and equal sign.
+ *
+ * \param[in] lhs The first integer node.
+ * \param[in] rhs The second integer node.
+ *
+ * \return \c true when equal, \c false otherwise.
+ */
+static bool
+integer_equals(const cardano_uplc_data_t* lhs, const cardano_uplc_data_t* rhs)
+{
+  if (lhs->as.integer.is_small && rhs->as.integer.is_small)
+  {
+    return lhs->as.integer.small == rhs->as.integer.small;
+  }
+
+  if (!lhs->as.integer.is_small && !rhs->as.integer.is_small)
+  {
+    return cardano_bigint_equals(lhs->as.integer.big, rhs->as.integer.big);
+  }
+
+  {
+    const cardano_uplc_data_t* small_side = lhs->as.integer.is_small ? lhs : rhs;
+    const cardano_uplc_data_t* big_side   = lhs->as.integer.is_small ? rhs : lhs;
+    int64_t                    big_inline = 0;
+
+    if (cardano_uplc_int_bigint_fits_int64(big_side->as.integer.big, &big_inline))
+    {
+      return big_inline == small_side->as.integer.small;
+    }
+  }
+
+  return false;
+}
+
+/**
+ * \brief Writes the canonical CBOR for an integer leaf.
+ *
+ * Replicates the library's plutus-data integer encoding exactly: uint / nint for
+ * values in [-2^64, 2^64 - 1] and the bignum tags 2 / 3 with chunked indefinite
+ * byte strings outside that range. Tag 3 carries the magnitude \c -1 - v of a
+ * negative value \c v, as defined in RFC 8949, section 3.4.3.
+ *
+ * \param[in] data An integer data node.
+ * \param[in] writer The CBOR writer.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a writer or bigint error code.
+ */
+static cardano_error_t
+write_integer(const cardano_uplc_data_t* data, cardano_cbor_writer_t* writer)
+{
+  if (data->as.integer.is_small)
+  {
+    if (data->as.integer.small < 0)
+    {
+      return cardano_cbor_writer_write_signed_int(writer, data->as.integer.small);
+    }
+
+    return cardano_cbor_writer_write_uint(writer, (uint64_t)data->as.integer.small);
+  }
+
+  const cardano_bigint_t* value       = data->as.integer.big;
+  const bool              is_negative = cardano_bigint_signum(value) < 0;
+  const size_t            bit_length  = cardano_bigint_bit_length(value);
+  cardano_bigint_t*       magnitude   = NULL;
+  cardano_error_t         result      = CARDANO_SUCCESS;
+
+  if (bit_length <= 64U)
+  {
+    const uint64_t absolute = cardano_bigint_to_unsigned_int(value);
+
+    if (is_negative)
+    {
+      return cardano_cbor_writer_write_negative_int(writer, absolute - 1U);
+    }
+
+    return cardano_cbor_writer_write_uint(writer, absolute);
+  }
+
+  result = cardano_bigint_clone(value, &magnitude);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (is_negative)
+  {
+    cardano_bigint_negate(value, magnitude);
+    cardano_bigint_decrement(magnitude);
+  }
+
+  if (is_negative && (cardano_bigint_bit_length(magnitude) <= 64U))
+  {
+    result = cardano_cbor_writer_write_negative_int(writer, cardano_bigint_to_unsigned_int(magnitude));
+    cardano_bigint_unref(&magnitude);
+
+    return result;
+  }
+
+  {
+    const size_t size  = cardano_bigint_get_bytes_size(magnitude);
+    byte_t*      bytes = (byte_t*)_cardano_malloc(size);
+
+    if (bytes == NULL)
+    {
+      cardano_bigint_unref(&magnitude);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    result = cardano_bigint_to_bytes(magnitude, CARDANO_BYTE_ORDER_BIG_ENDIAN, bytes, size);
+
+    cardano_bigint_unref(&magnitude);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_cbor_writer_write_tag(
+        writer,
+        is_negative ? CARDANO_CBOR_TAG_NEGATIVE_BIG_NUM : CARDANO_CBOR_TAG_UNSIGNED_BIG_NUM);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      if (size <= CARDANO_UPLC_DATA_CBOR_CHUNK)
+      {
+        result = cardano_cbor_writer_write_bytestring(writer, bytes, size);
+      }
+      else
+      {
+        const size_t chunks = size / CARDANO_UPLC_DATA_CBOR_CHUNK;
+        const size_t rest   = size % CARDANO_UPLC_DATA_CBOR_CHUNK;
+        size_t       i      = 0U;
+
+        result = cardano_cbor_writer_write_encoded(writer, &CARDANO_UPLC_DATA_INDEFINITE_BYTE_STRING, sizeof(CARDANO_UPLC_DATA_INDEFINITE_BYTE_STRING));
+
+        for (i = 0U; (i < chunks) && (result == CARDANO_SUCCESS); ++i)
+        {
+          result = cardano_cbor_writer_write_bytestring(writer, &bytes[i * CARDANO_UPLC_DATA_CBOR_CHUNK], CARDANO_UPLC_DATA_CBOR_CHUNK);
+        }
+
+        if ((result == CARDANO_SUCCESS) && (rest > 0U))
+        {
+          result = cardano_cbor_writer_write_bytestring(writer, &bytes[chunks * CARDANO_UPLC_DATA_CBOR_CHUNK], rest);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_cbor_writer_write_end_array(writer);
+        }
+      }
+    }
+
+    _cardano_free(bytes);
+
+    return result;
+  }
+}
+
+/**
+ * \brief Writes the canonical CBOR for a byte-string leaf.
+ *
+ * \param[in] data A byte-string data node.
+ * \param[in] writer The CBOR writer.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a writer error code.
+ */
+static cardano_error_t
+write_bytes(const cardano_uplc_data_t* data, cardano_cbor_writer_t* writer)
+{
+  static const byte_t empty = 0U;
+  const size_t        size  = data->as.bytes.size;
+  const byte_t*       bytes = (data->as.bytes.data != NULL) ? data->as.bytes.data : &empty;
+
+  if (size <= CARDANO_UPLC_DATA_CBOR_CHUNK)
+  {
+    return cardano_cbor_writer_write_bytestring(writer, bytes, size);
+  }
+
+  {
+    const size_t    chunks = size / CARDANO_UPLC_DATA_CBOR_CHUNK;
+    const size_t    rest   = size % CARDANO_UPLC_DATA_CBOR_CHUNK;
+    size_t          i      = 0U;
+    cardano_error_t result = cardano_cbor_writer_write_encoded(writer, &CARDANO_UPLC_DATA_INDEFINITE_BYTE_STRING, sizeof(CARDANO_UPLC_DATA_INDEFINITE_BYTE_STRING));
+
+    for (i = 0U; (i < chunks) && (result == CARDANO_SUCCESS); ++i)
+    {
+      result = cardano_cbor_writer_write_bytestring(writer, &bytes[i * CARDANO_UPLC_DATA_CBOR_CHUNK], CARDANO_UPLC_DATA_CBOR_CHUNK);
+    }
+
+    if ((result == CARDANO_SUCCESS) && (rest > 0U))
+    {
+      result = cardano_cbor_writer_write_bytestring(writer, &bytes[chunks * CARDANO_UPLC_DATA_CBOR_CHUNK], rest);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_cbor_writer_write_end_array(writer);
+    }
+
+    return result;
+  }
+}
+
+/**
+ * \brief Maps a constructor alternative to its canonical compact CBOR tag.
+ *
+ * \param[in] alternative The constructor alternative.
+ *
+ * \return The compact tag 121-127, the ranged tag 1280-1400, or 102 for the general
+ *         form.
+ */
+static uint64_t
+alternative_to_tag(uint64_t alternative)
+{
+  if (alternative <= 6U)
+  {
+    return 121U + alternative;
+  }
+
+  if (alternative <= 127U)
+  {
+    return ((uint64_t)1280U - (uint64_t)7U) + alternative;
+  }
+
+  return 102U;
+}
+
+/**
+ * \brief Writes the opening CBOR of a node and pushes its children in walk order.
+ *
+ * For a container this writes the tag/header and start markers and pushes a deferred
+ * close frame plus every child in reverse so the children emit front-to-back. For a
+ * leaf it writes the whole encoding and pushes nothing.
+ *
+ * \param[in] data The data node.
+ * \param[in] writer The CBOR writer.
+ * \param[in,out] stack The traversal work stack.
+ * \param[in,out] capacity The current stack capacity.
+ * \param[in,out] count The current stack count.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code.
+ */
+static cardano_error_t
+to_cbor_open(
+  const cardano_uplc_data_t* data,
+  cardano_cbor_writer_t*     writer,
+  walk_frame_t**             stack,
+  size_t*                    capacity,
+  size_t*                    count)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+  size_t          i      = 0U;
+
+  switch (data->kind)
+  {
+    case CARDANO_UPLC_DATA_KIND_CONSTR:
+    {
+      uint64_t tag = alternative_to_tag(data->as.constr.tag);
+
+      result = cardano_cbor_writer_write_tag(writer, (cardano_cbor_tag_t)tag);
+
+      if ((result == CARDANO_SUCCESS) && (tag == 102U))
+      {
+        result = cardano_cbor_writer_write_start_array(writer, 2);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_cbor_writer_write_uint(writer, data->as.constr.tag);
+        }
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_cbor_writer_write_start_array(writer, (data->as.constr.count > 0U) ? -1 : 0);
+      }
+
+      if ((result == CARDANO_SUCCESS) && !walk_push(stack, capacity, count, data, true))
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+
+      for (i = data->as.constr.count; (result == CARDANO_SUCCESS) && (i > 0U); --i)
+      {
+        if (!walk_push(stack, capacity, count, data->as.constr.fields[i - 1U], false))
+        {
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_MAP:
+    {
+      if (data->as.map.indefinite)
+      {
+        result = cardano_cbor_writer_write_start_map(writer, -1);
+      }
+      else
+      {
+        result = cardano_cbor_writer_write_start_map(writer, (int64_t)data->as.map.count);
+      }
+
+      if ((result == CARDANO_SUCCESS) && !walk_push(stack, capacity, count, data, true))
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+
+      for (i = data->as.map.count; (result == CARDANO_SUCCESS) && (i > 0U); --i)
+      {
+        if (!walk_push(stack, capacity, count, data->as.map.entries[i - 1U].value, false) || !walk_push(stack, capacity, count, data->as.map.entries[i - 1U].key, false))
+        {
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_LIST:
+    {
+      result = cardano_cbor_writer_write_start_array(writer, (data->as.list.count > 0U) ? -1 : 0);
+
+      if ((result == CARDANO_SUCCESS) && !walk_push(stack, capacity, count, data, true))
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+
+      for (i = data->as.list.count; (result == CARDANO_SUCCESS) && (i > 0U); --i)
+      {
+        if (!walk_push(stack, capacity, count, data->as.list.items[i - 1U], false))
+        {
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_INTEGER:
+    {
+      result = write_integer(data, writer);
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_BYTES:
+    {
+      result = write_bytes(data, writer);
+
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Writes the closing CBOR marker of a container node, if any.
+ *
+ * \param[in] data The container node.
+ * \param[in] writer The CBOR writer.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code.
+ */
+static cardano_error_t
+to_cbor_close(const cardano_uplc_data_t* data, cardano_cbor_writer_t* writer)
+{
+  switch (data->kind)
+  {
+    case CARDANO_UPLC_DATA_KIND_CONSTR:
+    {
+      if (data->as.constr.count > 0U)
+      {
+        return cardano_cbor_writer_write_end_array(writer);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_MAP:
+    {
+      if (data->as.map.indefinite)
+      {
+        return cardano_cbor_writer_write_end_map(writer);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_LIST:
+    {
+      if (data->as.list.count > 0U)
+      {
+        return cardano_cbor_writer_write_end_array(writer);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_INTEGER:
+    case CARDANO_UPLC_DATA_KIND_BYTES:
+    default:
+    {
+      break;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Iterative CBOR serializer for an arena data subtree.
+ *
+ * Walks the tree with an explicit work stack so adversarial nesting cannot overflow
+ * the C stack. The byte stream is identical to a recursive pre-order emit: each
+ * container writes its header and start markers, then its children in order, then its
+ * close marker.
+ *
+ * \param[in] data The data node.
+ * \param[in] writer The CBOR writer.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code.
+ */
+static cardano_error_t
+to_cbor(const cardano_uplc_data_t* data, cardano_cbor_writer_t* writer)
+{
+  walk_frame_t*   stack    = NULL;
+  size_t          capacity = 0U;
+  size_t          count    = 0U;
+  cardano_error_t result   = CARDANO_SUCCESS;
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (!walk_push(&stack, &capacity, &count, data, false))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  while ((result == CARDANO_SUCCESS) && (count > 0U))
+  {
+    // cppcheck-suppress misra-c2012-13.3; Reason: local post-increment with no aliasing
+    walk_frame_t frame = stack[--count];
+
+    if (frame.node == NULL)
+    {
+      result = CARDANO_ERROR_POINTER_IS_NULL;
+
+      break;
+    }
+
+    if (frame.expanded)
+    {
+      result = to_cbor_close(frame.node, writer);
+    }
+    else
+    {
+      result = to_cbor_open(frame.node, writer, &stack, &capacity, &count);
+    }
+  }
+
+  _cardano_free(stack);
+
+  return result;
+}
+
+/**
+ * \brief The CBOR major type carried in the top three bits of a head byte.
+ */
+typedef enum
+{
+  /** \brief Major type 0: an unsigned integer. */
+  PRV_CBOR_MAJOR_UNSIGNED = 0,
+  /** \brief Major type 1: a negative integer. */
+  PRV_CBOR_MAJOR_NEGATIVE = 1,
+  /** \brief Major type 2: a byte string. */
+  PRV_CBOR_MAJOR_BYTES = 2,
+  /** \brief Major type 4: an array. */
+  PRV_CBOR_MAJOR_ARRAY = 4,
+  /** \brief Major type 5: a map. */
+  PRV_CBOR_MAJOR_MAP = 5,
+  /** \brief Major type 6: a semantic tag. */
+  PRV_CBOR_MAJOR_TAG = 6
+} cbor_major_t;
+
+/**
+ * \brief The additional-information field carried in the low five bits of a head byte.
+ */
+typedef enum
+{
+  /** \brief Argument follows in one byte. */
+  PRV_CBOR_INFO_ONE_BYTE = 24,
+  /** \brief Argument follows in two big-endian bytes. */
+  PRV_CBOR_INFO_TWO_BYTES = 25,
+  /** \brief Argument follows in four big-endian bytes. */
+  PRV_CBOR_INFO_FOUR_BYTES = 26,
+  /** \brief Argument follows in eight big-endian bytes. */
+  PRV_CBOR_INFO_EIGHT_BYTES = 27,
+  /** \brief The item is indefinite-length. */
+  PRV_CBOR_INFO_INDEFINITE = 31
+} cbor_info_t;
+
+/**
+ * \brief The byte-string chunk size the canonical serializer emits, repeated here so
+ *        the parser uses the same named bound.
+ */
+static const uint64_t PRV_CBOR_BREAK = 0xFFU;
+
+/**
+ * \brief The CBOR tag selecting the constructor general form.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t PRV_CONSTR_GENERAL_FORM_TAG = 102U;
+
+/**
+ * \brief The first CBOR tag of the compact constructor range (alternative 0).
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t PRV_CONSTR_COMPACT_TAG_LO = 121U;
+
+/**
+ * \brief The last CBOR tag of the compact constructor range (alternative 6).
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t PRV_CONSTR_COMPACT_TAG_HI = 127U;
+
+/**
+ * \brief The first CBOR tag of the ranged constructor form (alternative 7).
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t PRV_CONSTR_RANGED_TAG_LO = 1280U;
+
+/**
+ * \brief The last CBOR tag of the ranged constructor form (alternative 127).
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t PRV_CONSTR_RANGED_TAG_HI = 1400U;
+
+/**
+ * \brief The alternative the first ranged-form tag maps to.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t PRV_CONSTR_RANGED_OFFSET = 7U;
+
+/**
+ * \brief A forward, allocation-free cursor over the CBOR byte buffer.
+ *
+ * The decoder threads a single \ref cursor_t through the recursion: it never
+ * slices the buffer, never refcounts, and advances \c offset in place. Bytes for a
+ * byte-string node are copied straight into the arena from the cursor.
+ */
+typedef struct cursor_t
+{
+    const byte_t* buf;
+    size_t        size;
+    size_t        offset;
+} cursor_t;
+
+/**
+ * \brief Reads one head byte from the cursor, splitting it into major type and
+ *        additional information.
+ *
+ * \param[in,out] cursor The byte cursor; advanced one byte on success.
+ * \param[out] major On success, the major type (top three bits).
+ * \param[out] info On success, the additional information (low five bits).
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_DECODING when the
+ *         cursor is exhausted.
+ */
+static cardano_error_t
+read_head(cursor_t* cursor, byte_t* major, byte_t* info)
+{
+  byte_t head = 0U;
+
+  if (cursor->offset >= cursor->size)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  head = cursor->buf[cursor->offset];
+  ++cursor->offset;
+
+  *major = (byte_t)((head >> 5U) & 0x07U);
+  *info  = (byte_t)(head & 0x1FU);
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads the unsigned argument that follows a head byte for the given
+ *        additional information.
+ *
+ * Mirrors \c _cbor_reader_decode_unsigned_integer: \c info below 24 is the immediate
+ * value, 24/25/26/27 read 1/2/4/8 following big-endian bytes, and anything else (28-31)
+ * is rejected. No canonical-minimal-encoding check is performed, matching the library.
+ *
+ * \param[in,out] cursor The byte cursor; advanced past the argument on success.
+ * \param[in] info The additional information from the head byte.
+ * \param[out] out On success, the decoded unsigned argument.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_DECODING on a
+ *         truncated or malformed argument.
+ */
+static cardano_error_t
+read_argument(cursor_t* cursor, byte_t info, uint64_t* out)
+{
+  size_t   width = 0U;
+  uint64_t value = 0U;
+  size_t   i     = 0U;
+
+  if (info < (byte_t)PRV_CBOR_INFO_ONE_BYTE)
+  {
+    *out = (uint64_t)info;
+
+    return CARDANO_SUCCESS;
+  }
+
+  switch (info)
+  {
+    case PRV_CBOR_INFO_ONE_BYTE:
+    {
+      width = 1U;
+
+      break;
+    }
+    case PRV_CBOR_INFO_TWO_BYTES:
+    {
+      width = 2U;
+
+      break;
+    }
+    case PRV_CBOR_INFO_FOUR_BYTES:
+    {
+      width = 4U;
+
+      break;
+    }
+    case PRV_CBOR_INFO_EIGHT_BYTES:
+    {
+      width = 8U;
+
+      break;
+    }
+    default:
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+  }
+
+  if ((cursor->offset + width) > cursor->size)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  for (i = 0U; i < width; ++i)
+  {
+    value = (value << 8U) | (uint64_t)cursor->buf[cursor->offset + i];
+  }
+
+  cursor->offset += width;
+  *out           = value;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads one data item from the cursor into a freshly allocated arena node.
+ *
+ * \param[in] arena The arena every node is allocated from.
+ * \param[in,out] cursor The byte cursor; advanced past the item on success.
+ * \param[in] depth The current recursion depth.
+ * \param[out] out On success, the parsed node.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for malformed
+ *         CBOR, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED on arena exhaustion.
+ */
+static cardano_error_t
+parse_data_node(cardano_uplc_arena_t* arena, cursor_t* cursor, uint32_t depth, cardano_uplc_data_t** out);
+
+/**
+ * \brief Builds a bignum integer node from an owned bigint.
+ *
+ * \param[in] arena The arena.
+ * \param[in] integer The bigint just built; ownership transfers to this function.
+ * \param[out] out On success, the integer node.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code. On every exit the bigint
+ *         is released.
+ */
+static cardano_error_t
+node_from_bigint(cardano_uplc_arena_t* arena, cardano_bigint_t* integer, cardano_uplc_data_t** out)
+{
+  cardano_error_t result = cardano_uplc_data_new_integer(arena, integer, out);
+
+  cardano_bigint_unref(&integer);
+
+  return result;
+}
+
+/**
+ * \brief Reads a byte-string item (definite or indefinite/chunked) into an arena
+ *        byte node.
+ *
+ * For a definite string the bytes are copied straight from the cursor. For the
+ * indefinite form (head byte 0x5F) the chunk byte strings are concatenated in order,
+ * exactly as \c _cbor_reader_read_indefinite_length_concatenated does; only definite
+ * byte-string chunks are accepted and the run ends at the 0xFF break.
+ *
+ * \param[in] arena The arena.
+ * \param[in,out] cursor The byte cursor, positioned just past the head byte.
+ * \param[in] info The additional information from the head byte.
+ * \param[out] out On success, the byte node.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code.
+ */
+static cardano_error_t
+parse_bytes(cardano_uplc_arena_t* arena, cursor_t* cursor, byte_t info, cardano_uplc_data_t** out)
+{
+  uint64_t        length = 0U;
+  cardano_error_t result;
+
+  if (info != (byte_t)PRV_CBOR_INFO_INDEFINITE)
+  {
+    const byte_t* data = NULL;
+
+    result = read_argument(cursor, info, &length);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if ((length > (uint64_t)(cursor->size - cursor->offset)) || (length > (uint64_t)SIZE_MAX))
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    data           = &cursor->buf[cursor->offset];
+    cursor->offset += (size_t)length;
+
+    return cardano_uplc_data_new_bytes(arena, data, (size_t)length, out);
+  }
+
+  {
+    byte_t* scratch  = NULL;
+    size_t  total    = 0U;
+    size_t  capacity = 0U;
+
+    for (;;)
+    {
+      byte_t   chunk_major = 0U;
+      byte_t   chunk_info  = 0U;
+      uint64_t chunk_len   = 0U;
+
+      if (cursor->offset >= cursor->size)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if (cursor->buf[cursor->offset] == (byte_t)PRV_CBOR_BREAK)
+      {
+        ++cursor->offset;
+
+        break;
+      }
+
+      result = read_head(cursor, &chunk_major, &chunk_info);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      if ((chunk_major != (byte_t)PRV_CBOR_MAJOR_BYTES) || (chunk_info == (byte_t)PRV_CBOR_INFO_INDEFINITE))
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      result = read_argument(cursor, chunk_info, &chunk_len);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      if (chunk_len > (uint64_t)(cursor->size - cursor->offset))
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if ((total + (size_t)chunk_len) > capacity)
+      {
+        size_t  new_capacity = ((capacity == 0U) ? 128U : (capacity * 2U));
+        byte_t* grown        = NULL;
+
+        while (new_capacity < (total + (size_t)chunk_len))
+        {
+          new_capacity *= 2U;
+        }
+
+        grown = (byte_t*)cardano_uplc_arena_alloc(arena, new_capacity, 1U);
+
+        if (grown == NULL)
+        {
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+
+        if (total > 0U)
+        {
+          cardano_safe_memcpy(grown, new_capacity, scratch, total);
+        }
+
+        scratch  = grown;
+        capacity = new_capacity;
+      }
+
+      if (chunk_len > 0U)
+      {
+        cardano_safe_memcpy(&scratch[total], capacity - total, &cursor->buf[cursor->offset], (size_t)chunk_len);
+        total          += (size_t)chunk_len;
+        cursor->offset += (size_t)chunk_len;
+      }
+    }
+
+    return cardano_uplc_data_new_bytes(arena, scratch, total, out);
+  }
+}
+
+/**
+ * \brief Reads the element items of an array (definite or indefinite) into an arena
+ *        pointer array.
+ *
+ * \param[in] arena The arena.
+ * \param[in,out] cursor The byte cursor, positioned just past the array head byte.
+ * \param[in] info The additional information from the head byte.
+ * \param[in] depth The current recursion depth.
+ * \param[out] out_items On success, the arena item array, or NULL when empty.
+ * \param[out] out_count On success, the item count.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code.
+ */
+static cardano_error_t
+parse_array(
+  cardano_uplc_arena_t* arena,
+  cursor_t*             cursor,
+  byte_t                info,
+  uint32_t              depth,
+  // cppcheck-suppress misra-c2012-18.5; Reason: pointer nesting required by the API shape
+  const cardano_uplc_data_t* const** out_items,
+  size_t*                            out_count)
+{
+  const cardano_uplc_data_t** items      = NULL;
+  size_t                      capacity   = 0U;
+  size_t                      count      = 0U;
+  bool                        indefinite = (info == (byte_t)PRV_CBOR_INFO_INDEFINITE);
+  uint64_t                    length     = 0U;
+  cardano_error_t             result;
+
+  if (!indefinite)
+  {
+    result = read_argument(cursor, info, &length);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (length > (uint64_t)(cursor->size - cursor->offset))
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    if (length > 0U)
+    {
+      capacity = (size_t)length;
+      items    = (const cardano_uplc_data_t**)cardano_uplc_arena_alloc(arena, sizeof(*items) * capacity, 0U);
+
+      if (items == NULL)
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+    }
+  }
+
+  for (;;)
+  // cppcheck-suppress misra-c2012-15.4; Reason: multiple loop exits keep the control flow flat
+  {
+    cardano_uplc_data_t* item = NULL;
+
+    if (indefinite)
+    {
+      if (cursor->offset >= cursor->size)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if (cursor->buf[cursor->offset] == (byte_t)PRV_CBOR_BREAK)
+      {
+        ++cursor->offset;
+
+        break;
+      }
+    }
+    else if (count == (size_t)length)
+    {
+      break;
+    }
+    else
+    {
+      /* Definite array still has items to read. */
+    }
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = parse_data_node(arena, cursor, depth + 1U, &item);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (count == capacity)
+    {
+      size_t                      new_capacity = (capacity == 0U) ? 4U : (capacity * 2U);
+      const cardano_uplc_data_t** grown        = (const cardano_uplc_data_t**)cardano_uplc_arena_alloc(arena, sizeof(*grown) * new_capacity, 0U);
+
+      if (grown == NULL)
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+
+      if (count > 0U)
+      {
+        cardano_safe_memcpy(grown, sizeof(*grown) * new_capacity, items, sizeof(*grown) * count);
+      }
+
+      items    = grown;
+      capacity = new_capacity;
+    }
+
+    items[count] = item;
+    ++count;
+  }
+
+  *out_items = (const cardano_uplc_data_t* const*)items;
+  *out_count = count;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads the (key, value) pairs of a map (definite or indefinite) into an arena
+ *        entry array.
+ *
+ * \param[in] arena The arena.
+ * \param[in,out] cursor The byte cursor, positioned just past the map head byte.
+ * \param[in] info The additional information from the head byte.
+ * \param[in] depth The current recursion depth.
+ * \param[out] out_entries On success, the arena entry array, or NULL when empty.
+ * \param[out] out_count On success, the entry count.
+ * \param[out] out_indefinite On success, whether the map was indefinite-length.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code.
+ */
+static cardano_error_t
+parse_map(
+  cardano_uplc_arena_t*            arena,
+  cursor_t*                        cursor,
+  byte_t                           info,
+  uint32_t                         depth,
+  const cardano_uplc_data_pair_t** out_entries,
+  size_t*                          out_count,
+  bool*                            out_indefinite)
+{
+  cardano_uplc_data_pair_t* entries    = NULL;
+  size_t                    capacity   = 0U;
+  size_t                    count      = 0U;
+  bool                      indefinite = (info == (byte_t)PRV_CBOR_INFO_INDEFINITE);
+  uint64_t                  length     = 0U;
+  cardano_error_t           result;
+
+  *out_indefinite = indefinite;
+
+  if (!indefinite)
+  {
+    result = read_argument(cursor, info, &length);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (length > ((uint64_t)(cursor->size - cursor->offset)))
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    if (length > 0U)
+    {
+      capacity = (size_t)length;
+      entries  = (cardano_uplc_data_pair_t*)cardano_uplc_arena_alloc(arena, sizeof(*entries) * capacity, 0U);
+
+      if (entries == NULL)
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+    }
+  }
+
+  for (;;)
+  // cppcheck-suppress misra-c2012-15.4; Reason: multiple loop exits keep the control flow flat
+  {
+    cardano_uplc_data_t* key   = NULL;
+    cardano_uplc_data_t* value = NULL;
+
+    if (indefinite)
+    {
+      if (cursor->offset >= cursor->size)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if (cursor->buf[cursor->offset] == (byte_t)PRV_CBOR_BREAK)
+      {
+        ++cursor->offset;
+
+        break;
+      }
+    }
+    else if (count == (size_t)length)
+    {
+      break;
+    }
+    else
+    {
+      /* Definite map still has pairs to read. */
+    }
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = parse_data_node(arena, cursor, depth + 1U, &key);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_data_node(arena, cursor, depth + 1U, &value);
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (count == capacity)
+    {
+      size_t                    new_capacity = (capacity == 0U) ? 4U : (capacity * 2U);
+      cardano_uplc_data_pair_t* grown        = (cardano_uplc_data_pair_t*)cardano_uplc_arena_alloc(arena, sizeof(*grown) * new_capacity, 0U);
+
+      if (grown == NULL)
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+
+      if (count > 0U)
+      {
+        cardano_safe_memcpy(grown, sizeof(*grown) * new_capacity, entries, sizeof(*grown) * count);
+      }
+
+      entries  = grown;
+      capacity = new_capacity;
+    }
+
+    entries[count].key   = key;
+    entries[count].value = value;
+    ++count;
+  }
+
+  *out_entries = entries;
+  *out_count   = count;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a bignum (tag 2 or 3) magnitude byte string and builds the integer
+ *        node.
+ *
+ * Replicates \c _cardano_reader_read_bigint exactly: the magnitude is the big-endian
+ * unsigned value of the byte string, and tag 3 yields \c -1 - magnitude, as defined
+ * in RFC 8949, section 3.4.3. The node down-converts to an inline \c int64_t when it
+ * fits.
+ *
+ * \param[in] arena The arena.
+ * \param[in,out] cursor The byte cursor, positioned just past the tag head byte.
+ * \param[in] negative Whether the tag was the negative-bignum tag 3.
+ * \param[out] out On success, the integer node.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code.
+ */
+static cardano_error_t
+parse_bignum(cardano_uplc_arena_t* arena, cursor_t* cursor, bool negative, cardano_uplc_data_t** out)
+{
+  cardano_uplc_data_t* bytes_node = NULL;
+  byte_t               major      = 0U;
+  byte_t               info       = 0U;
+  cardano_bigint_t*    magnitude  = NULL;
+  cardano_error_t      result     = read_head(cursor, &major, &info);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (major != (byte_t)PRV_CBOR_MAJOR_BYTES)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = parse_bytes(arena, cursor, info, &bytes_node);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_bigint_from_bytes(
+    (bytes_node->as.bytes.data != NULL) ? bytes_node->as.bytes.data : (const byte_t*)"",
+    bytes_node->as.bytes.size,
+    CARDANO_BYTE_ORDER_BIG_ENDIAN,
+    &magnitude);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (negative)
+  {
+    cardano_bigint_t* negated = NULL;
+
+    result = cardano_bigint_clone(magnitude, &negated);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_bigint_unref(&magnitude);
+
+      return result;
+    }
+
+    cardano_bigint_negate(magnitude, negated);
+    cardano_bigint_decrement(negated);
+    cardano_bigint_unref(&magnitude);
+
+    return node_from_bigint(arena, negated, out);
+  }
+
+  return node_from_bigint(arena, magnitude, out);
+}
+
+/**
+ * \brief Reads a tagged item: a bignum, or a constructor in one of its three forms.
+ *
+ * \param[in] arena The arena.
+ * \param[in,out] cursor The byte cursor, positioned just past the tag head byte.
+ * \param[in] info The additional information from the tag head byte.
+ * \param[in] depth The current recursion depth.
+ * \param[out] out On success, the parsed node.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code.
+ */
+static cardano_error_t
+parse_tagged(cardano_uplc_arena_t* arena, cursor_t* cursor, byte_t info, uint32_t depth, cardano_uplc_data_t** out)
+{
+  uint64_t        tag    = 0U;
+  cardano_error_t result = read_argument(cursor, info, &tag);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (tag == (uint64_t)CARDANO_CBOR_TAG_UNSIGNED_BIG_NUM)
+  {
+    return parse_bignum(arena, cursor, false, out);
+  }
+
+  if (tag == (uint64_t)CARDANO_CBOR_TAG_NEGATIVE_BIG_NUM)
+  {
+    return parse_bignum(arena, cursor, true, out);
+  }
+
+  {
+    uint64_t                          alternative = 0U;
+    const cardano_uplc_data_t* const* fields      = NULL;
+    size_t                            count       = 0U;
+    byte_t                            major       = 0U;
+    byte_t                            inner_info  = 0U;
+
+    if (tag == PRV_CONSTR_GENERAL_FORM_TAG)
+    {
+      uint64_t array_len = 0U;
+      byte_t   alt_major = 0U;
+      byte_t   alt_info  = 0U;
+
+      result = read_head(cursor, &major, &inner_info);
+
+      if ((result == CARDANO_SUCCESS) && (major != (byte_t)PRV_CBOR_MAJOR_ARRAY))
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = read_argument(cursor, inner_info, &array_len);
+      }
+
+      if ((result == CARDANO_SUCCESS) && (array_len != 2U))
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = read_head(cursor, &alt_major, &alt_info);
+      }
+
+      if ((result == CARDANO_SUCCESS) && (alt_major != (byte_t)PRV_CBOR_MAJOR_UNSIGNED))
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = read_argument(cursor, alt_info, &alternative);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = read_head(cursor, &major, &inner_info);
+      }
+
+      if ((result == CARDANO_SUCCESS) && (major != (byte_t)PRV_CBOR_MAJOR_ARRAY))
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = parse_array(arena, cursor, inner_info, depth, &fields, &count);
+      }
+    }
+    else if ((tag >= PRV_CONSTR_COMPACT_TAG_LO) && (tag <= PRV_CONSTR_COMPACT_TAG_HI))
+    {
+      alternative = tag - PRV_CONSTR_COMPACT_TAG_LO;
+
+      result = read_head(cursor, &major, &inner_info);
+
+      if ((result == CARDANO_SUCCESS) && (major != (byte_t)PRV_CBOR_MAJOR_ARRAY))
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = parse_array(arena, cursor, inner_info, depth, &fields, &count);
+      }
+    }
+    else if ((tag >= PRV_CONSTR_RANGED_TAG_LO) && (tag <= PRV_CONSTR_RANGED_TAG_HI))
+    {
+      alternative = (tag - PRV_CONSTR_RANGED_TAG_LO) + PRV_CONSTR_RANGED_OFFSET;
+
+      result = read_head(cursor, &major, &inner_info);
+
+      if ((result == CARDANO_SUCCESS) && (major != (byte_t)PRV_CBOR_MAJOR_ARRAY))
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = parse_array(arena, cursor, inner_info, depth, &fields, &count);
+      }
+    }
+    else
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    return cardano_uplc_data_new_constr(arena, alternative, fields, count, out);
+  }
+}
+
+static cardano_error_t
+parse_data_node(cardano_uplc_arena_t* arena, cursor_t* cursor, uint32_t depth, cardano_uplc_data_t** out)
+{
+  byte_t          major  = 0U;
+  byte_t          info   = 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (depth >= CARDANO_UPLC_DATA_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = read_head(cursor, &major, &info);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch ((cbor_major_t)major)
+  {
+    case PRV_CBOR_MAJOR_UNSIGNED:
+    {
+      uint64_t value = 0U;
+
+      result = read_argument(cursor, info, &value);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      if (value <= (uint64_t)INT64_MAX)
+      {
+        return cardano_uplc_data_new_integer_small(arena, (int64_t)value, out);
+      }
+
+      {
+        cardano_bigint_t* integer = NULL;
+
+        result = cardano_bigint_from_unsigned_int(value, &integer);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        return node_from_bigint(arena, integer, out);
+      }
+    }
+    case PRV_CBOR_MAJOR_NEGATIVE:
+    {
+      uint64_t value = 0U;
+
+      result = read_argument(cursor, info, &value);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      if (value <= (uint64_t)INT64_MAX)
+      {
+        return cardano_uplc_data_new_integer_small(arena, (int64_t)(-1) - (int64_t)value, out);
+      }
+
+      {
+        cardano_bigint_t* integer = NULL;
+
+        result = cardano_bigint_from_unsigned_int(value, &integer);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        cardano_bigint_negate(integer, integer);
+        cardano_bigint_decrement(integer);
+
+        return node_from_bigint(arena, integer, out);
+      }
+    }
+    case PRV_CBOR_MAJOR_BYTES:
+    {
+      return parse_bytes(arena, cursor, info, out);
+    }
+    case PRV_CBOR_MAJOR_ARRAY:
+    {
+      const cardano_uplc_data_t* const* items = NULL;
+      size_t                            count = 0U;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_array(arena, cursor, info, depth, &items, &count);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      return cardano_uplc_data_new_list(arena, items, count, out);
+    }
+    case PRV_CBOR_MAJOR_MAP:
+    {
+      const cardano_uplc_data_pair_t* entries    = NULL;
+      size_t                          count      = 0U;
+      bool                            indefinite = false;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_map(arena, cursor, info, depth, &entries, &count, &indefinite);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      return cardano_uplc_data_new_map(arena, entries, count, indefinite, out);
+    }
+    case PRV_CBOR_MAJOR_TAG:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      return parse_tagged(arena, cursor, info, depth, out);
+    }
+    default:
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+  }
+}
+
+/**
+ * \brief Recursively converts a library plutus-data node into an arena node.
+ *
+ * \param[in] arena The arena.
+ * \param[in] data The library node.
+ * \param[in] depth The current recursion depth.
+ * \param[out] out On success, the arena node.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code.
+ */
+static cardano_error_t
+from_plutus_data(cardano_uplc_arena_t* arena, const cardano_plutus_data_t* data, uint32_t depth, cardano_uplc_data_t** out)
+{
+  cardano_plutus_data_kind_t kind   = CARDANO_PLUTUS_DATA_KIND_INTEGER;
+  cardano_error_t            result = CARDANO_SUCCESS;
+
+  if (depth >= CARDANO_UPLC_DATA_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = cardano_plutus_data_get_kind(data, &kind);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (kind)
+  {
+    case CARDANO_PLUTUS_DATA_KIND_CONSTR:
+    {
+      cardano_constr_plutus_data_t* constr      = NULL;
+      cardano_plutus_list_t*        fields      = NULL;
+      uint64_t                      alternative = 0U;
+      size_t                        count       = 0U;
+      const cardano_uplc_data_t**   nodes       = NULL;
+      size_t                        i           = 0U;
+
+      // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+      result = cardano_plutus_data_to_constr((cardano_plutus_data_t*)((const void*)data), &constr);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_constr_plutus_data_get_alternative(constr, &alternative);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_constr_plutus_data_get_data(constr, &fields);
+      }
+
+      cardano_constr_plutus_data_unref(&constr);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_list_unref(&fields);
+
+        return result;
+      }
+
+      count = cardano_plutus_list_get_length(fields);
+
+      if (count > 0U)
+      {
+        nodes = (const cardano_uplc_data_t**)cardano_uplc_arena_alloc(arena, sizeof(*nodes) * count, 0U);
+
+        if (nodes == NULL)
+        {
+          cardano_plutus_list_unref(&fields);
+
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+      }
+
+      for (i = 0U; i < count; ++i)
+      {
+        cardano_plutus_data_t* element = NULL;
+        cardano_uplc_data_t*   node    = NULL;
+
+        result = cardano_plutus_list_get(fields, i, &element);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          result = from_plutus_data(arena, element, depth + 1U, &node);
+        }
+
+        cardano_plutus_data_unref(&element);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_plutus_list_unref(&fields);
+
+          return result;
+        }
+
+        nodes[i] = node;
+      }
+
+      cardano_plutus_list_unref(&fields);
+
+      return cardano_uplc_data_new_constr(arena, alternative, (const cardano_uplc_data_t* const*)nodes, count, out);
+    }
+    case CARDANO_PLUTUS_DATA_KIND_MAP:
+    {
+      cardano_plutus_map_t*     map     = NULL;
+      cardano_plutus_list_t*    keys    = NULL;
+      cardano_plutus_list_t*    values  = NULL;
+      cardano_uplc_data_pair_t* entries = NULL;
+      size_t                    count   = 0U;
+      size_t                    i       = 0U;
+
+      // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+      result = cardano_plutus_data_to_map((cardano_plutus_data_t*)((const void*)data), &map);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_map_get_keys(map, &keys);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_map_get_values(map, &values);
+      }
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_list_unref(&keys);
+        cardano_plutus_list_unref(&values);
+        cardano_plutus_map_unref(&map);
+
+        return result;
+      }
+
+      count = cardano_plutus_map_get_length(map);
+
+      if (count > 0U)
+      {
+        entries = (cardano_uplc_data_pair_t*)cardano_uplc_arena_alloc(arena, sizeof(*entries) * count, 0U);
+
+        if (entries == NULL)
+        {
+          cardano_plutus_list_unref(&keys);
+          cardano_plutus_list_unref(&values);
+          cardano_plutus_map_unref(&map);
+
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+      }
+
+      for (i = 0U; i < count; ++i)
+      {
+        cardano_plutus_data_t* key      = NULL;
+        cardano_plutus_data_t* value    = NULL;
+        cardano_uplc_data_t*   key_node = NULL;
+        cardano_uplc_data_t*   val_node = NULL;
+
+        result = cardano_plutus_list_get(keys, i, &key);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_list_get(values, i, &value);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          result = from_plutus_data(arena, key, depth + 1U, &key_node);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          result = from_plutus_data(arena, value, depth + 1U, &val_node);
+        }
+
+        cardano_plutus_data_unref(&key);
+        cardano_plutus_data_unref(&value);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_plutus_list_unref(&keys);
+          cardano_plutus_list_unref(&values);
+          cardano_plutus_map_unref(&map);
+
+          return result;
+        }
+
+        entries[i].key   = key_node;
+        entries[i].value = val_node;
+      }
+
+      cardano_plutus_list_unref(&keys);
+      cardano_plutus_list_unref(&values);
+      cardano_plutus_map_unref(&map);
+
+      return cardano_uplc_data_new_map(arena, entries, count, false, out);
+    }
+    case CARDANO_PLUTUS_DATA_KIND_LIST:
+    {
+      cardano_plutus_list_t*      list  = NULL;
+      const cardano_uplc_data_t** nodes = NULL;
+      size_t                      count = 0U;
+      size_t                      i     = 0U;
+
+      // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+      result = cardano_plutus_data_to_list((cardano_plutus_data_t*)((const void*)data), &list);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      count = cardano_plutus_list_get_length(list);
+
+      if (count > 0U)
+      {
+        nodes = (const cardano_uplc_data_t**)cardano_uplc_arena_alloc(arena, sizeof(*nodes) * count, 0U);
+
+        if (nodes == NULL)
+        {
+          cardano_plutus_list_unref(&list);
+
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+      }
+
+      for (i = 0U; i < count; ++i)
+      {
+        cardano_plutus_data_t* element = NULL;
+        cardano_uplc_data_t*   node    = NULL;
+
+        result = cardano_plutus_list_get(list, i, &element);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          result = from_plutus_data(arena, element, depth + 1U, &node);
+        }
+
+        cardano_plutus_data_unref(&element);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_plutus_list_unref(&list);
+
+          return result;
+        }
+
+        nodes[i] = node;
+      }
+
+      cardano_plutus_list_unref(&list);
+
+      return cardano_uplc_data_new_list(arena, (const cardano_uplc_data_t* const*)nodes, count, out);
+    }
+    case CARDANO_PLUTUS_DATA_KIND_INTEGER:
+    {
+      cardano_bigint_t* integer = NULL;
+
+      result = cardano_plutus_data_to_integer(data, &integer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_uplc_data_new_integer(arena, integer, out);
+
+      cardano_bigint_unref(&integer);
+
+      return result;
+    }
+    case CARDANO_PLUTUS_DATA_KIND_BYTES:
+    {
+      cardano_buffer_t* bytes = NULL;
+
+      // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+      result = cardano_plutus_data_to_bounded_bytes((cardano_plutus_data_t*)((const void*)data), &bytes);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_uplc_data_new_bytes(arena, cardano_buffer_get_data(bytes), cardano_buffer_get_size(bytes), out);
+
+      cardano_buffer_unref(&bytes);
+
+      return result;
+    }
+    default:
+    {
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+}
+
+/**
+ * \brief Recursively converts an arena data node into a library plutus-data node.
+ *
+ * \param[in] data The arena node.
+ * \param[in] depth The current recursion depth.
+ * \param[out] out On success, the owned library node.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code.
+ */
+static cardano_error_t
+to_plutus_data(const cardano_uplc_data_t* data, uint32_t depth, cardano_plutus_data_t** out)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+  size_t          i      = 0U;
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (depth >= CARDANO_UPLC_DATA_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  switch (data->kind)
+  {
+    case CARDANO_UPLC_DATA_KIND_CONSTR:
+    {
+      cardano_plutus_list_t*        fields = NULL;
+      cardano_constr_plutus_data_t* constr = NULL;
+
+      result = cardano_plutus_list_new(&fields);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      for (i = 0U; i < data->as.constr.count; ++i)
+      {
+        cardano_plutus_data_t* element = NULL;
+
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = to_plutus_data(data->as.constr.fields[i], depth + 1U, &element);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_list_add(fields, element);
+        }
+
+        cardano_plutus_data_unref(&element);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_plutus_list_unref(&fields);
+
+          return result;
+        }
+      }
+
+      result = cardano_constr_plutus_data_new(data->as.constr.tag, fields, &constr);
+
+      cardano_plutus_list_unref(&fields);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_plutus_data_new_constr(constr, out);
+
+      cardano_constr_plutus_data_unref(&constr);
+
+      return result;
+    }
+    case CARDANO_UPLC_DATA_KIND_MAP:
+    {
+      cardano_plutus_map_t* map = NULL;
+
+      result = cardano_plutus_map_new(&map);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      for (i = 0U; i < data->as.map.count; ++i)
+      {
+        cardano_plutus_data_t* key   = NULL;
+        cardano_plutus_data_t* value = NULL;
+
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = to_plutus_data(data->as.map.entries[i].key, depth + 1U, &key);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          result = to_plutus_data(data->as.map.entries[i].value, depth + 1U, &value);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_map_insert(map, key, value);
+        }
+
+        cardano_plutus_data_unref(&key);
+        cardano_plutus_data_unref(&value);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_plutus_map_unref(&map);
+
+          return result;
+        }
+      }
+
+      result = cardano_plutus_data_new_map(map, out);
+
+      cardano_plutus_map_unref(&map);
+
+      return result;
+    }
+    case CARDANO_UPLC_DATA_KIND_LIST:
+    {
+      cardano_plutus_list_t* list = NULL;
+
+      result = cardano_plutus_list_new(&list);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      for (i = 0U; i < data->as.list.count; ++i)
+      {
+        cardano_plutus_data_t* element = NULL;
+
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = to_plutus_data(data->as.list.items[i], depth + 1U, &element);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_list_add(list, element);
+        }
+
+        cardano_plutus_data_unref(&element);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          cardano_plutus_list_unref(&list);
+
+          return result;
+        }
+      }
+
+      result = cardano_plutus_data_new_list(list, out);
+
+      cardano_plutus_list_unref(&list);
+
+      return result;
+    }
+    case CARDANO_UPLC_DATA_KIND_INTEGER:
+    {
+      if (data->as.integer.is_small)
+      {
+        cardano_bigint_t* integer = NULL;
+
+        result = cardano_bigint_from_int(data->as.integer.small, &integer);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = cardano_plutus_data_new_integer(integer, out);
+
+        cardano_bigint_unref(&integer);
+
+        return result;
+      }
+
+      return cardano_plutus_data_new_integer(data->as.integer.big, out);
+    }
+    case CARDANO_UPLC_DATA_KIND_BYTES:
+    {
+      static const byte_t empty = 0U;
+      const byte_t*       bytes = (data->as.bytes.data != NULL) ? data->as.bytes.data : &empty;
+
+      return cardano_plutus_data_new_bytes(bytes, data->as.bytes.size, out);
+    }
+    default:
+    {
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_data_new_constr(
+  cardano_uplc_arena_t*             arena,
+  uint64_t                          tag,
+  const cardano_uplc_data_t* const* fields,
+  size_t                            count,
+  cardano_uplc_data_t**             out)
+{
+  cardano_uplc_data_t* node = NULL;
+
+  if ((arena == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((fields == NULL) && (count > 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  node = alloc_node(arena);
+
+  if (node == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  node->kind             = CARDANO_UPLC_DATA_KIND_CONSTR;
+  node->as.constr.tag    = tag;
+  node->as.constr.fields = fields;
+  node->as.constr.count  = count;
+
+  *out = node;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_data_new_map(
+  cardano_uplc_arena_t*           arena,
+  const cardano_uplc_data_pair_t* entries,
+  size_t                          count,
+  bool                            indefinite,
+  cardano_uplc_data_t**           out)
+{
+  cardano_uplc_data_t* node = NULL;
+
+  if ((arena == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((entries == NULL) && (count > 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  node = alloc_node(arena);
+
+  if (node == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  node->kind              = CARDANO_UPLC_DATA_KIND_MAP;
+  node->as.map.entries    = entries;
+  node->as.map.count      = count;
+  node->as.map.indefinite = indefinite;
+
+  *out = node;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_data_new_list(
+  cardano_uplc_arena_t*             arena,
+  const cardano_uplc_data_t* const* items,
+  size_t                            count,
+  cardano_uplc_data_t**             out)
+{
+  cardano_uplc_data_t* node = NULL;
+
+  if ((arena == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((items == NULL) && (count > 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  node = alloc_node(arena);
+
+  if (node == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  node->kind          = CARDANO_UPLC_DATA_KIND_LIST;
+  node->as.list.items = items;
+  node->as.list.count = count;
+
+  *out = node;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_data_new_integer_small(
+  cardano_uplc_arena_t* arena,
+  int64_t               value,
+  cardano_uplc_data_t** out)
+{
+  cardano_uplc_data_t* node = NULL;
+
+  if ((arena == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  node = alloc_node(arena);
+
+  if (node == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  node->kind                = CARDANO_UPLC_DATA_KIND_INTEGER;
+  node->as.integer.is_small = true;
+  node->as.integer.small    = value;
+  node->as.integer.big      = NULL;
+
+  *out = node;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_data_new_integer(
+  cardano_uplc_arena_t* arena,
+  cardano_bigint_t*     value,
+  cardano_uplc_data_t** out)
+{
+  cardano_uplc_data_t* node    = NULL;
+  int64_t              inline_ = 0;
+
+  if ((arena == NULL) || (value == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cardano_uplc_int_bigint_fits_int64(value, &inline_))
+  {
+    return cardano_uplc_data_new_integer_small(arena, inline_, out);
+  }
+
+  node = alloc_node(arena);
+
+  if (node == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_bigint_ref(value);
+
+  if (cardano_uplc_arena_register_unref(arena, value, &unref_bigint) != CARDANO_SUCCESS)
+  {
+    cardano_bigint_unref(&value);
+
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  node->kind                = CARDANO_UPLC_DATA_KIND_INTEGER;
+  node->as.integer.is_small = false;
+  node->as.integer.small    = 0;
+  node->as.integer.big      = value;
+
+  *out = node;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_data_new_bytes(
+  cardano_uplc_arena_t* arena,
+  const byte_t*         bytes,
+  size_t                size,
+  cardano_uplc_data_t** out)
+{
+  cardano_uplc_data_t* node = NULL;
+  byte_t*              copy = NULL;
+
+  if ((arena == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((bytes == NULL) && (size > 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  node = alloc_node(arena);
+
+  if (node == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  if (size > 0U)
+  {
+    copy = (byte_t*)cardano_uplc_arena_alloc(arena, size, 1U);
+
+    if (copy == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    cardano_safe_memcpy(copy, size, bytes, size);
+  }
+
+  node->kind          = CARDANO_UPLC_DATA_KIND_BYTES;
+  node->as.bytes.data = copy;
+  node->as.bytes.size = size;
+
+  *out = node;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_data_integer_materialize(
+  cardano_uplc_arena_t*      arena,
+  const cardano_uplc_data_t* data,
+  const cardano_bigint_t**   out)
+{
+  // cppcheck-suppress misra-c2012-11.8; Reason: interfacing a non-const-correct API
+  cardano_uplc_data_t* mutable_node = (cardano_uplc_data_t*)((const void*)data);
+  cardano_bigint_t*    built        = NULL;
+  cardano_error_t      result       = CARDANO_SUCCESS;
+
+  if (data->as.integer.big != NULL)
+  {
+    *out = data->as.integer.big;
+
+    return CARDANO_SUCCESS;
+  }
+
+  result = cardano_bigint_from_int(data->as.integer.small, &built);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_uplc_arena_register_unref(arena, built, &unref_bigint);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_bigint_unref(&built);
+
+    return result;
+  }
+
+  mutable_node->as.integer.big = built;
+  *out                         = built;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_uplc_data_equals(const cardano_uplc_data_t* lhs, const cardano_uplc_data_t* rhs)
+{
+  equals_pair_t* stack    = NULL;
+  size_t         capacity = 0U;
+  size_t         count    = 0U;
+  bool           equal    = true;
+
+  if (!equals_push(&stack, &capacity, &count, lhs, rhs))
+  {
+    return false;
+  }
+
+  while (equal && (count > 0U))
+  {
+    // cppcheck-suppress misra-c2012-13.3; Reason: local post-increment with no aliasing
+    equals_pair_t pair = stack[--count];
+
+    const cardano_uplc_data_t* a = pair.lhs;
+    const cardano_uplc_data_t* b = pair.rhs;
+
+    size_t i = 0U;
+
+    if (a == b)
+    {
+      continue;
+    }
+
+    if ((a == NULL) || (b == NULL) || (a->kind != b->kind))
+    {
+      equal = false;
+
+      break;
+    }
+
+    switch (a->kind)
+    {
+      case CARDANO_UPLC_DATA_KIND_CONSTR:
+      {
+        if ((a->as.constr.tag != b->as.constr.tag) || (a->as.constr.count != b->as.constr.count))
+        {
+          equal = false;
+
+          break;
+        }
+
+        for (i = 0U; equal && (i < a->as.constr.count); ++i)
+        {
+          if (!equals_push(&stack, &capacity, &count, a->as.constr.fields[i], b->as.constr.fields[i]))
+          {
+            equal = false;
+          }
+        }
+
+        break;
+      }
+      case CARDANO_UPLC_DATA_KIND_MAP:
+      {
+        if (a->as.map.count != b->as.map.count)
+        {
+          equal = false;
+
+          break;
+        }
+
+        for (i = 0U; equal && (i < a->as.map.count); ++i)
+        {
+          if (!equals_push(&stack, &capacity, &count, a->as.map.entries[i].key, b->as.map.entries[i].key) || !equals_push(&stack, &capacity, &count, a->as.map.entries[i].value, b->as.map.entries[i].value))
+          {
+            equal = false;
+          }
+        }
+
+        break;
+      }
+      case CARDANO_UPLC_DATA_KIND_LIST:
+      {
+        if (a->as.list.count != b->as.list.count)
+        {
+          equal = false;
+
+          break;
+        }
+
+        for (i = 0U; equal && (i < a->as.list.count); ++i)
+        {
+          if (!equals_push(&stack, &capacity, &count, a->as.list.items[i], b->as.list.items[i]))
+          {
+            equal = false;
+          }
+        }
+
+        break;
+      }
+      case CARDANO_UPLC_DATA_KIND_INTEGER:
+      {
+        equal = integer_equals(a, b);
+
+        break;
+      }
+      case CARDANO_UPLC_DATA_KIND_BYTES:
+      {
+        if (a->as.bytes.size != b->as.bytes.size)
+        {
+          equal = false;
+        }
+        else if (a->as.bytes.size > 0U)
+        {
+          equal = memcmp(a->as.bytes.data, b->as.bytes.data, a->as.bytes.size) == 0;
+        }
+        else
+        {
+          /* Equal empty byte strings: nothing to compare. */
+        }
+
+        break;
+      }
+      default:
+      {
+        equal = false;
+
+        break;
+      }
+    }
+  }
+
+  _cardano_free(stack);
+
+  return equal;
+}
+
+int64_t
+cardano_uplc_data_node_ex_mem(const cardano_uplc_data_t* data)
+{
+  return compute_ex_mem(data);
+}
+
+int64_t
+cardano_uplc_data_node_count(const cardano_uplc_data_t* data)
+{
+  return compute_node_count(data);
+}
+
+cardano_error_t
+cardano_uplc_data_from_cbor_bytes(
+  cardano_uplc_arena_t* arena,
+  const byte_t*         bytes,
+  size_t                size,
+  cardano_uplc_data_t** out)
+{
+  cursor_t        cursor = { NULL, 0U, 0U };
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if ((arena == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((bytes == NULL) && (size > 0U))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  cursor.buf  = bytes;
+  cursor.size = size;
+
+  result = parse_data_node(arena, &cursor, 0U, out);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return (result == CARDANO_ERROR_MEMORY_ALLOCATION_FAILED) ? result : CARDANO_ERROR_DECODING;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_data_to_cbor(const cardano_uplc_data_t* data, cardano_cbor_writer_t* writer)
+{
+  if ((data == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return to_cbor(data, writer);
+}
+
+cardano_error_t
+cardano_uplc_data_from_plutus_data(
+  cardano_uplc_arena_t*        arena,
+  const cardano_plutus_data_t* data,
+  cardano_uplc_data_t**        out)
+{
+  if ((arena == NULL) || (data == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return from_plutus_data(arena, data, 0U, out);
+}
+
+cardano_error_t
+cardano_uplc_data_to_plutus_data(
+  const cardano_uplc_data_t* data,
+  cardano_plutus_data_t**    out)
+{
+  if ((data == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return to_plutus_data(data, 0U, out);
+}
diff --git a/vendor/src/uplc/data/uplc_data.h b/vendor/src/uplc/data/uplc_data.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/data/uplc_data.h
@@ -0,0 +1,405 @@
+/**
+ * \file uplc_data.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_DATA_UPLC_DATA_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_DATA_UPLC_DATA_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_reader.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/common/bigint.h>
+#include <cardano/error.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/typedefs.h>
+
+#include "../arena/uplc_arena.h"
+
+#include "uplc_data_kind.h"
+#include "uplc_data_pair.h"
+
+#include <stdbool.h>
+#include <stdint.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A lean, arena-allocated Plutus-data node walked directly by the CEK
+ *        machine.
+ *
+ * Unlike the library's refcounted \ref cardano_plutus_data_t, this node carries
+ * no CBOR cache and is never refcounted: every node and every interior array is
+ * served from the interpreter arena and released in one
+ * \ref cardano_uplc_arena_free. The \c kind selects the active union arm.
+ *
+ * Integers reuse the inline-small representation from the integer constants: a
+ * value that fits an \c int64_t lives in \c integer.small with \c integer.is_small
+ * set and \c integer.big NULL; a larger value lives in \c integer.big. A bigint is
+ * only ever built lazily, and cached in \c integer.big, by code that genuinely
+ * needs a \ref cardano_bigint_t.
+ *
+ * The \c ex_mem field memoizes the data ex-mem of the subtree rooted at this node:
+ * it is \c -1 until the first \ref cardano_uplc_data_ex_mem call fills it, after
+ * which the value is reused with no re-walk. The \c node_count field memoizes the
+ * subtree node count the same way.
+ */
+typedef struct cardano_uplc_data_t
+{
+    cardano_uplc_data_kind_t kind;
+    int64_t                  ex_mem;
+    int64_t                  node_count;
+
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        struct
+        {
+            uint64_t                                 tag;
+            const struct cardano_uplc_data_t* const* fields;
+            size_t                                   count;
+        } constr;
+
+        struct
+        {
+            const cardano_uplc_data_pair_t* entries;
+            size_t                          count;
+            bool                            indefinite;
+        } map;
+
+        struct
+        {
+            const struct cardano_uplc_data_t* const* items;
+            size_t                                   count;
+        } list;
+
+        struct
+        {
+            int64_t           small;
+            cardano_bigint_t* big;
+            bool              is_small;
+        } integer;
+
+        struct
+        {
+            const byte_t* data;
+            size_t        size;
+        } bytes;
+
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } as;
+} cardano_uplc_data_t;
+
+/**
+ * \brief Builds an arena constructor data node from an arena-allocated field array.
+ *
+ * \param[in] arena The arena to allocate the node from.
+ * \param[in] tag The constructor alternative tag.
+ * \param[in] fields The field pointers, or NULL when \p count is 0. The array and
+ *            the nodes it points at must already live in \p arena.
+ * \param[in] count The number of fields.
+ * \param[out] out On success, set to the new node; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p out is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p fields is NULL while \p count is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve the
+ *         node.
+ */
+cardano_error_t
+cardano_uplc_data_new_constr(
+  cardano_uplc_arena_t*             arena,
+  uint64_t                          tag,
+  const cardano_uplc_data_t* const* fields,
+  size_t                            count,
+  cardano_uplc_data_t**             out);
+
+/**
+ * \brief Builds an arena map data node from an arena-allocated entry array.
+ *
+ * \param[in] arena The arena to allocate the node from.
+ * \param[in] entries The (key, value) entries, or NULL when \p count is 0. The
+ *            array and the nodes it points at must already live in \p arena.
+ * \param[in] count The number of entries.
+ * \param[in] indefinite Whether the map round-trips as a CBOR indefinite-length map.
+ * \param[out] out On success, set to the new node; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p out is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p entries is NULL while \p count is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve the
+ *         node.
+ */
+cardano_error_t
+cardano_uplc_data_new_map(
+  cardano_uplc_arena_t*           arena,
+  const cardano_uplc_data_pair_t* entries,
+  size_t                          count,
+  bool                            indefinite,
+  cardano_uplc_data_t**           out);
+
+/**
+ * \brief Builds an arena list data node from an arena-allocated item array.
+ *
+ * \param[in] arena The arena to allocate the node from.
+ * \param[in] items The item pointers, or NULL when \p count is 0. The array and
+ *            the nodes it points at must already live in \p arena.
+ * \param[in] count The number of items.
+ * \param[out] out On success, set to the new node; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p out is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p items is NULL while \p count is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve the
+ *         node.
+ */
+cardano_error_t
+cardano_uplc_data_new_list(
+  cardano_uplc_arena_t*             arena,
+  const cardano_uplc_data_t* const* items,
+  size_t                            count,
+  cardano_uplc_data_t**             out);
+
+/**
+ * \brief Builds an arena integer data node from an inline \c int64_t value.
+ *
+ * \param[in] arena The arena to allocate the node from.
+ * \param[in] value The inline integer value.
+ * \param[out] out On success, set to the new node; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p out is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *         if the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_data_new_integer_small(
+  cardano_uplc_arena_t* arena,
+  int64_t               value,
+  cardano_uplc_data_t** out);
+
+/**
+ * \brief Builds an arena integer data node from a refcounted bigint.
+ *
+ * The node stores \p value inline as an \c int64_t when it fits; otherwise it
+ * registers \p value with \p arena (which takes its own reference) and stores it in
+ * \c integer.big. The caller keeps the reference it passed in.
+ *
+ * \param[in] arena The arena to allocate the node from.
+ * \param[in] value The integer value. Must not be NULL.
+ * \param[out] out On success, set to the new node; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node or register the bigint.
+ */
+cardano_error_t
+cardano_uplc_data_new_integer(
+  cardano_uplc_arena_t* arena,
+  cardano_bigint_t*     value,
+  cardano_uplc_data_t** out);
+
+/**
+ * \brief Builds an arena byte-string data node, copying the bytes into the arena.
+ *
+ * \param[in] arena The arena to allocate the node and the byte copy from.
+ * \param[in] bytes The byte-string contents, or NULL when \p size is 0.
+ * \param[in] size The number of bytes.
+ * \param[out] out On success, set to the new node; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p out is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p bytes is NULL while \p size is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve the
+ *         node.
+ */
+cardano_error_t
+cardano_uplc_data_new_bytes(
+  cardano_uplc_arena_t* arena,
+  const byte_t*         bytes,
+  size_t                size,
+  cardano_uplc_data_t** out);
+
+/**
+ * \brief Returns the bigint view of an integer data node, building one lazily.
+ *
+ * For a node whose value already lives in \c integer.big this returns it directly.
+ * For an inline node it builds a bigint equal to \c integer.small, registers it with
+ * \p arena (which takes ownership), caches it in the node, and returns it; later
+ * calls return the cached pointer. The returned bigint is owned by the arena and the
+ * caller must not unref it.
+ *
+ * \param[in] arena The arena the lazily built bigint is registered with.
+ * \param[in] data An integer data node. Must not be NULL and must be of kind
+ *            \ref CARDANO_UPLC_DATA_KIND_INTEGER.
+ * \param[out] out On success, the bigint view; untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a bigint cannot be built or
+ *         registered.
+ */
+cardano_error_t
+cardano_uplc_data_integer_materialize(
+  cardano_uplc_arena_t*      arena,
+  const cardano_uplc_data_t* data,
+  const cardano_bigint_t**   out);
+
+/**
+ * \brief Tests two arena data nodes for structural equality.
+ *
+ * Compares kind, then recursively compares structure with no CBOR round-trip:
+ * constructor tag and ordered fields, map entries in order, list items in order,
+ * integer value (inline or bigint), and byte content. Mirrors the structural
+ * equality of \ref cardano_plutus_data_equals on the same tree.
+ *
+ * \param[in] lhs The first node, or NULL.
+ * \param[in] rhs The second node, or NULL.
+ *
+ * \return \c true when the two trees are structurally equal, \c false otherwise.
+ *         Two NULL pointers compare equal; a NULL and a non-NULL compare unequal.
+ */
+bool
+cardano_uplc_data_equals(const cardano_uplc_data_t* lhs, const cardano_uplc_data_t* rhs);
+
+/**
+ * \brief Returns the memoized data ex-mem of a node, computing it on first call.
+ *
+ * Walks the tree once charging the per-node and per-leaf cost identical to
+ * \ref cardano_uplc_data_ex_mem on the library type, caching the result on the node
+ * so later calls return it with no re-walk. A NULL node measures 0.
+ *
+ * \param[in] data The data node to measure, or NULL.
+ *
+ * \return The data node's ex-mem size.
+ */
+int64_t
+cardano_uplc_data_node_ex_mem(const cardano_uplc_data_t* data);
+
+/**
+ * \brief Returns the memoized total node count of a data tree.
+ *
+ * Counts every node (leaves and interior) by the same traversal as
+ * \ref cardano_uplc_data_node_ex_mem, caching the result on the node. A NULL node
+ * counts 0.
+ *
+ * \param[in] data The data tree, or NULL.
+ *
+ * \return The node count.
+ */
+int64_t
+cardano_uplc_data_node_count(const cardano_uplc_data_t* data);
+
+/**
+ * \brief Parses CBOR bytes into an arena data tree with no per-node caching.
+ *
+ * Decodes \p bytes as one Plutus-data item directly into arena nodes, matching the
+ * library's CBOR decoding rules exactly (constr tags 121-127 / 1280-1400 / 102
+ * general form, definite and indefinite maps and lists, bignum tags 2 and 3,
+ * chunked indefinite byte strings) but without the per-node encoded-subtree caching
+ * the library performs. Every node is served from \p arena.
+ *
+ * \param[in] arena The arena every node is allocated from. Must not be NULL.
+ * \param[in] bytes The CBOR bytes, or NULL when \p size is 0.
+ * \param[in] size The number of CBOR bytes.
+ * \param[out] out On success, the decoded tree; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p out is NULL, \ref CARDANO_ERROR_DECODING for malformed CBOR,
+ *         or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena or the CBOR
+ *         reader cannot be allocated.
+ */
+cardano_error_t
+cardano_uplc_data_from_cbor_bytes(
+  cardano_uplc_arena_t* arena,
+  const byte_t*         bytes,
+  size_t                size,
+  cardano_uplc_data_t** out);
+
+/**
+ * \brief Serializes an arena data tree to canonical CBOR bytes.
+ *
+ * Writes the tree directly to a \ref cardano_cbor_writer_t replicating the library's
+ * canonical Plutus-data encoding exactly: constr tag selection (121-127, then
+ * 1280-1400, then the 102 general form), non-empty lists as indefinite arrays and
+ * empty lists as definite, maps definite or indefinite per the round-trip flag,
+ * integers as uint / nint / bignum (tags 2 and 3) and chunked indefinite byte
+ * strings at the 64-byte boundary.
+ *
+ * \param[in] data The data tree to serialize. Must not be NULL.
+ * \param[in] writer The CBOR writer to write into. Must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p data or \p writer is NULL, or a writer error code on failure.
+ */
+cardano_error_t
+cardano_uplc_data_to_cbor(const cardano_uplc_data_t* data, cardano_cbor_writer_t* writer);
+
+/**
+ * \brief Converts a library plutus-data object into an arena data tree.
+ *
+ * Recursively rebuilds \p data as arena nodes; the library object is read but not
+ * referenced or retained. This is the boundary converter for parameter application
+ * and the script context, which produce the heavyweight library type.
+ *
+ * \param[in] arena The arena every node is allocated from. Must not be NULL.
+ * \param[in] data The library data object to convert. Must not be NULL.
+ * \param[out] out On success, the converted tree; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         arena cannot serve a node, or a library error code propagated from a failed
+ *         accessor.
+ */
+cardano_error_t
+cardano_uplc_data_from_plutus_data(
+  cardano_uplc_arena_t*        arena,
+  const cardano_plutus_data_t* data,
+  cardano_uplc_data_t**        out);
+
+/**
+ * \brief Converts an arena data tree back into a refcounted library plutus-data
+ *        object.
+ *
+ * Recursively rebuilds \p data as library nodes. The returned object is refcounted
+ * and the caller owns one reference, which it must release with
+ * \ref cardano_plutus_data_unref. This is the boundary converter for any consumer
+ * that must hand back the library type.
+ *
+ * \param[in] data The arena data tree to convert. Must not be NULL.
+ * \param[out] out On success, the library object; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or a library error code propagated from a failed
+ *         constructor.
+ */
+cardano_error_t
+cardano_uplc_data_to_plutus_data(
+  const cardano_uplc_data_t* data,
+  cardano_plutus_data_t**    out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_DATA_UPLC_DATA_H */
diff --git a/vendor/src/uplc/data/uplc_data_kind.h b/vendor/src/uplc/data/uplc_data_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/data/uplc_data_kind.h
@@ -0,0 +1,56 @@
+/**
+ * \file uplc_data_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_DATA_UPLC_DATA_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_DATA_UPLC_DATA_KIND_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The kind of an arena Plutus-data node.
+ *
+ * Mirrors \ref cardano_plutus_data_kind_t but tags the lean, arena-allocated
+ * data node the CEK machine walks directly. The integer values match the
+ * library kind so a kind crosses the boundary by a plain cast.
+ */
+typedef enum
+{
+  /** \brief A constructor with an alternative tag and an ordered field list. */
+  CARDANO_UPLC_DATA_KIND_CONSTR = 0,
+  /** \brief A map of (key, value) data pairs. */
+  CARDANO_UPLC_DATA_KIND_MAP = 1,
+  /** \brief An ordered list of data items. */
+  CARDANO_UPLC_DATA_KIND_LIST = 2,
+  /** \brief An arbitrary-precision integer. */
+  CARDANO_UPLC_DATA_KIND_INTEGER = 3,
+  /** \brief A byte string. */
+  CARDANO_UPLC_DATA_KIND_BYTES = 4
+} cardano_uplc_data_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_DATA_UPLC_DATA_KIND_H */
diff --git a/vendor/src/uplc/data/uplc_data_pair.h b/vendor/src/uplc/data/uplc_data_pair.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/data/uplc_data_pair.h
@@ -0,0 +1,54 @@
+/**
+ * \file uplc_data_pair.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_DATA_UPLC_DATA_PAIR_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_DATA_UPLC_DATA_PAIR_H
+
+/* FORWARD DECLARATIONS ******************************************************/
+
+/**
+ * \brief A lean, arena-allocated Plutus-data node, defined in \c uplc_data.h.
+ *
+ * A data pair references its key and value by pointer, so only a forward
+ * declaration is needed here.
+ */
+struct cardano_uplc_data_t;
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A single (key, value) entry of an arena data map.
+ */
+typedef struct cardano_uplc_data_pair_t
+{
+    const struct cardano_uplc_data_t* key;
+    const struct cardano_uplc_data_t* value;
+} cardano_uplc_data_pair_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_DATA_UPLC_DATA_PAIR_H */
diff --git a/vendor/src/uplc/flat/flat_decode.c b/vendor/src/uplc/flat/flat_decode.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/flat/flat_decode.c
@@ -0,0 +1,1830 @@
+/**
+ * \file flat_decode.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "flat_decode.h"
+
+#include "../ast/uplc_int.h"
+#include "../ast/uplc_lang_version.h"
+#include "../builtins/builtins.h"
+#include "../builtins/uplc_builtin.h"
+#include "../data/uplc_data.h"
+
+#include <cardano/cbor/cbor_reader.h>
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief Flat const-type list tags.
+ *
+ * These are the 4-bit tags read from the const-type list, fixed by the protocol
+ * (\c encodeUni in plutus-core/src/PlutusCore/Default/Universe.hs). They are
+ * distinct from \ref cardano_uplc_type_kind_t enumerator values: the descriptor
+ * enum places \c data at 7, the BLS kinds at 8..10, \c array at 11 and \c value
+ * at 12, while the flat tags place \c apply at 7, \c data at 8, the BLS tags at
+ * 9..11, \c array at 12 and \c value at 13.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_INTEGER = 0U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BYTE_STRING = 1U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_STRING = 2U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_UNIT = 3U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BOOL = 4U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_LIST = 5U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_PAIR = 6U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_APPLY = 7U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_DATA = 8U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BLS_G1 = 9U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BLS_G2 = 10U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BLS_ML_RESULT = 11U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_ARRAY = 12U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_VALUE = 13U;
+
+/**
+ * \brief Number of bits in a single const-type tag.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BITS = 4U;
+
+/**
+ * \brief Flat term tags.
+ *
+ * These are the 4-bit tags read for each term form, fixed by the protocol. They
+ * mirror \ref cardano_uplc_term_kind_t one for one.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_VAR = 0U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_DELAY = 1U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_LAMBDA = 2U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_APPLY = 3U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_CONSTANT = 4U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_FORCE = 5U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_ERROR = 6U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_BUILTIN = 7U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_CONSTR = 8U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_CASE = 9U;
+
+/**
+ * \brief Number of bits in a single term tag.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_BITS = 4U;
+
+/**
+ * \brief Number of bits in a builtin tag.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_BUILTIN_TAG_BITS = 7U;
+
+/**
+ * \brief The first program version, 1.1.0, whose terms may use \c constr and \c case.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t FLAT_CONSTR_CASE_MIN_MAJOR = 1U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t FLAT_CONSTR_CASE_MIN_MINOR = 1U;
+
+/**
+ * \brief Upper bound on the term nesting depth the decoder will follow.
+ *
+ * Term decoding recurses through \c Delay, \c Lambda, \c Apply, \c Force, \c Constr
+ * and \c Case; recursing on an adversarial program without a bound would overflow
+ * the C stack. The decoder refuses past this depth with \ref CARDANO_ERROR_DECODING.
+ * The bound is generous relative to any real script yet small enough to keep the
+ * worst-case recursion well inside the stack.
+ */
+enum
+{
+  FLAT_TERM_MAX_DEPTH = 4096
+};
+
+/**
+ * \brief Upper bound on the nesting depth of a type descriptor or a value.
+ *
+ * A malformed program can encode an arbitrarily deep nesting of \c list and
+ * \c pair applications; recursing on it without a bound would overflow the C
+ * stack. The parser refuses past this depth with \ref CARDANO_ERROR_DECODING.
+ * The bound is generous relative to any real script yet small enough to keep the
+ * worst-case recursion well inside the stack. It is an enum constant so it can
+ * also size the on-stack tag buffer.
+ */
+enum
+{
+  FLAT_TYPE_MAX_DEPTH = 128
+};
+
+/**
+ * \brief The largest constant type header a ledger script may carry, counted in
+ *        flat type tags (\c maxHeaderSize in
+ *        plutus-ledger-api/src/PlutusLedgerApi/Common/Versions.hs).
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t FLAT_SCRIPT_MAX_HEADER_SIZE = 32U;
+
+/**
+ * \brief The largest number of fields a \c constr term in a ledger script may
+ *        carry (\c maxConstrFields in
+ *        plutus-ledger-api/src/PlutusLedgerApi/Common/Versions.hs).
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t FLAT_SCRIPT_MAX_CONSTR_FIELDS = 1024U;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The rules a program decode applies to every term it reads.
+ *
+ * \c allow_constr_case follows the program version. When \c ledger_checks is set
+ * the decode also applies the ledger's script checks for \c language at
+ * \c protocol_major: every builtin must be available, every constant type header
+ * must fit \ref FLAT_SCRIPT_MAX_HEADER_SIZE and every \c constr must have at most
+ * \ref FLAT_SCRIPT_MAX_CONSTR_FIELDS fields.
+ */
+typedef struct
+{
+    bool                        allow_constr_case;
+    bool                        ledger_checks;
+    cardano_uplc_lang_version_t language;
+    uint64_t                    protocol_major;
+} decode_rules_t;
+
+/**
+ * \brief The rules of a decode without the ledger script checks, in which
+ *        \c constr and \c case are accepted until a program version says otherwise.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const decode_rules_t UNRESTRICTED_RULES = { true, false, CARDANO_UPLC_LANG_VERSION_V1, 0U };
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Validates that a byte range is well-formed UTF-8.
+ *
+ * Applies the Unicode well-formed-UTF-8 rules: ASCII bytes stand alone; lead
+ * bytes 0xC2..0xDF, 0xE0..0xEF and 0xF0..0xF4 introduce 2-, 3- and 4-byte
+ * sequences whose continuation bytes are 0x80..0xBF, with the ranges narrowed to
+ * reject overlong encodings, UTF-16 surrogates and code points above U+10FFFF.
+ *
+ * \param[in] data The bytes to validate. May be NULL only when \p size is 0.
+ * \param[in] size The number of bytes.
+ *
+ * \return \c true if the range is valid UTF-8, \c false otherwise.
+ */
+static bool
+is_valid_utf8(const byte_t* data, const size_t size)
+{
+  size_t i = 0U;
+
+  while (i < size)
+  {
+    const byte_t b0 = data[i];
+
+    if (b0 <= 0x7FU)
+    {
+      i += 1U;
+    }
+    else if ((b0 >= 0xC2U) && (b0 <= 0xDFU))
+    {
+      if ((i + 1U) >= size)
+      {
+        return false;
+      }
+
+      if ((data[i + 1U] & 0xC0U) != 0x80U)
+      {
+        return false;
+      }
+
+      i += 2U;
+    }
+    else if ((b0 >= 0xE0U) && (b0 <= 0xEFU))
+    {
+      byte_t lo = 0x80U;
+      byte_t hi = 0xBFU;
+
+      if ((i + 2U) >= size)
+      {
+        return false;
+      }
+
+      if (b0 == 0xE0U)
+      {
+        lo = 0xA0U;
+      }
+      else if (b0 == 0xEDU)
+      {
+        hi = 0x9FU;
+      }
+      else
+      {
+        lo = 0x80U;
+        hi = 0xBFU;
+      }
+
+      if ((data[i + 1U] < lo) || (data[i + 1U] > hi))
+      {
+        return false;
+      }
+
+      if ((data[i + 2U] & 0xC0U) != 0x80U)
+      {
+        return false;
+      }
+
+      i += 3U;
+    }
+    else if ((b0 >= 0xF0U) && (b0 <= 0xF4U))
+    {
+      byte_t lo = 0x80U;
+      byte_t hi = 0xBFU;
+
+      if ((i + 3U) >= size)
+      {
+        return false;
+      }
+
+      if (b0 == 0xF0U)
+      {
+        lo = 0x90U;
+      }
+      else if (b0 == 0xF4U)
+      {
+        hi = 0x8FU;
+      }
+      else
+      {
+        lo = 0x80U;
+        hi = 0xBFU;
+      }
+
+      if ((data[i + 1U] < lo) || (data[i + 1U] > hi))
+      {
+        return false;
+      }
+
+      if ((data[i + 2U] & 0xC0U) != 0x80U)
+      {
+        return false;
+      }
+
+      if ((data[i + 3U] & 0xC0U) != 0x80U)
+      {
+        return false;
+      }
+
+      i += 4U;
+    }
+    else
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+/**
+ * \brief Maps a leaf flat type tag to its \ref cardano_uplc_type_kind_t.
+ *
+ * Handles only the tags that name a non-application type. The list, array and
+ * pair applications are handled by the recursive type parser, and the apply tag
+ * never reaches this function.
+ *
+ * \param[in] tag The flat type tag.
+ * \param[out] kind On success, the corresponding descriptor kind.
+ *
+ * \return \ref CARDANO_SUCCESS on a known leaf tag, or \ref CARDANO_ERROR_DECODING
+ *         for an unknown or non-leaf tag.
+ */
+static cardano_error_t
+leaf_kind(const uint8_t tag, cardano_uplc_type_kind_t* kind)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (tag == FLAT_TYPE_TAG_INTEGER)
+  {
+    *kind = CARDANO_UPLC_TYPE_INTEGER;
+  }
+  else if (tag == FLAT_TYPE_TAG_BYTE_STRING)
+  {
+    *kind = CARDANO_UPLC_TYPE_BYTE_STRING;
+  }
+  else if (tag == FLAT_TYPE_TAG_STRING)
+  {
+    *kind = CARDANO_UPLC_TYPE_STRING;
+  }
+  else if (tag == FLAT_TYPE_TAG_UNIT)
+  {
+    *kind = CARDANO_UPLC_TYPE_UNIT;
+  }
+  else if (tag == FLAT_TYPE_TAG_BOOL)
+  {
+    *kind = CARDANO_UPLC_TYPE_BOOL;
+  }
+  else if (tag == FLAT_TYPE_TAG_DATA)
+  {
+    *kind = CARDANO_UPLC_TYPE_DATA;
+  }
+  else if (tag == FLAT_TYPE_TAG_BLS_G1)
+  {
+    *kind = CARDANO_UPLC_TYPE_BLS_G1;
+  }
+  else if (tag == FLAT_TYPE_TAG_BLS_G2)
+  {
+    *kind = CARDANO_UPLC_TYPE_BLS_G2;
+  }
+  else if (tag == FLAT_TYPE_TAG_BLS_ML_RESULT)
+  {
+    *kind = CARDANO_UPLC_TYPE_BLS_ML_RESULT;
+  }
+  else if (tag == FLAT_TYPE_TAG_VALUE)
+  {
+    *kind = CARDANO_UPLC_TYPE_VALUE;
+  }
+  else
+  {
+    result = CARDANO_ERROR_DECODING;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Builds a type descriptor from the collected const-type tag list.
+ *
+ * Consumes tags starting at \p index. A leaf tag yields a leaf type. The apply
+ * tag drives the three application shapes used by flat: <tt>[7, 5, T]</tt> builds
+ * <tt>list(T)</tt>, <tt>[7, 12, T]</tt> builds <tt>array(T)</tt> and
+ * <tt>[7, 7, 6, A, B]</tt> builds <tt>pair(A, B)</tt>, exactly as \c decode_type
+ * does in the references. Recursion is bounded by \ref FLAT_TYPE_MAX_DEPTH.
+ *
+ * \param[in] arena The arena every descriptor node is allocated from.
+ * \param[in] tags The collected 4-bit type tags.
+ * \param[in] tag_count The number of tags in \p tags.
+ * \param[in,out] index The cursor into \p tags, advanced past the parsed type.
+ * \param[in] depth The current nesting depth.
+ * \param[out] type On success, the parsed type descriptor.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         truncated or unknown tag sequence or nesting past the depth bound, or
+ *         a propagated allocation error from the descriptor constructor.
+ */
+static cardano_error_t
+parse_type(
+  cardano_uplc_arena_t*       arena,
+  const uint8_t*              tags,
+  const size_t                tag_count,
+  size_t*                     index,
+  const size_t                depth,
+  const cardano_uplc_type_t** type)
+{
+  uint8_t                  tag    = 0U;
+  cardano_error_t          result = CARDANO_SUCCESS;
+  cardano_uplc_type_kind_t kind   = CARDANO_UPLC_TYPE_INTEGER;
+
+  if (depth > FLAT_TYPE_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (*index >= tag_count)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  tag    = tags[*index];
+  *index += 1U;
+
+  if (tag == FLAT_TYPE_TAG_APPLY)
+  {
+    if (*index >= tag_count)
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    {
+      const uint8_t applied = tags[*index];
+      *index                += 1U;
+
+      if ((applied == FLAT_TYPE_TAG_LIST) || (applied == FLAT_TYPE_TAG_ARRAY))
+      {
+        const cardano_uplc_type_t*     element   = NULL;
+        cardano_uplc_type_t*           built     = NULL;
+        const cardano_uplc_type_kind_t container = (applied == FLAT_TYPE_TAG_LIST) ? CARDANO_UPLC_TYPE_LIST : CARDANO_UPLC_TYPE_ARRAY;
+
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = parse_type(arena, tags, tag_count, index, depth + 1U, &element);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = cardano_uplc_type_new(arena, container, element, NULL, &built);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        *type = built;
+
+        return CARDANO_SUCCESS;
+      }
+
+      if (applied == FLAT_TYPE_TAG_APPLY)
+      {
+        if (*index >= tag_count)
+        {
+          return CARDANO_ERROR_DECODING;
+        }
+
+        if (tags[*index] != FLAT_TYPE_TAG_PAIR)
+        {
+          return CARDANO_ERROR_DECODING;
+        }
+
+        *index += 1U;
+
+        {
+          const cardano_uplc_type_t* fst   = NULL;
+          const cardano_uplc_type_t* snd   = NULL;
+          cardano_uplc_type_t*       built = NULL;
+
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          result = parse_type(arena, tags, tag_count, index, depth + 1U, &fst);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            return result;
+          }
+
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          result = parse_type(arena, tags, tag_count, index, depth + 1U, &snd);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            return result;
+          }
+
+          result = cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_PAIR, fst, snd, &built);
+
+          if (result != CARDANO_SUCCESS)
+          {
+            return result;
+          }
+
+          *type = built;
+
+          return CARDANO_SUCCESS;
+        }
+      }
+
+      return CARDANO_ERROR_DECODING;
+    }
+  }
+
+  result = leaf_kind(tag, &kind);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  {
+    cardano_uplc_type_t* built = NULL;
+
+    result = cardano_uplc_type_new(arena, kind, NULL, NULL, &built);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    *type = built;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads the const-type list and parses it into a type descriptor.
+ *
+ * The const-type list is a sequence of 4-bit tags, each preceded by a one
+ * continuation bit; a zero continuation bit ends the list. The collected tags are
+ * then parsed into a (possibly nested) type descriptor.
+ *
+ * \param[in] arena The arena every descriptor node is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the type list.
+ * \param[out] type On success, the parsed type descriptor.
+ * \param[out] header_size On success, the number of tags in the type list.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         truncated stream, an empty list, an unconsumed trailing tag or an
+ *         unknown tag sequence, or a propagated allocation error.
+ */
+static cardano_error_t
+read_type(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const cardano_uplc_type_t** type,
+  size_t*                     header_size)
+{
+  uint8_t         tags[FLAT_TYPE_MAX_DEPTH];
+  size_t          tag_count = 0U;
+  size_t          index     = 0U;
+  cardano_error_t result    = CARDANO_SUCCESS;
+  uint8_t         more      = 0U;
+
+  result = cardano_uplc_flat_reader_bit(reader, &more);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  while (more != 0U)
+  {
+    uint8_t tag = 0U;
+
+    if (tag_count >= FLAT_TYPE_MAX_DEPTH)
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    result = cardano_uplc_flat_reader_bits8(reader, FLAT_TYPE_TAG_BITS, &tag);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    tags[tag_count] = tag;
+    tag_count       += 1U;
+
+    result = cardano_uplc_flat_reader_bit(reader, &more);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  if (tag_count == 0U)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = parse_type(arena, tags, tag_count, &index, 0U, type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (index != tag_count)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *header_size = tag_count;
+
+  return CARDANO_SUCCESS;
+}
+
+/* Forward declaration: value decoding recurses on list and pair types. */
+static cardano_error_t
+read_value(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const cardano_uplc_type_t*  type,
+  size_t                      depth,
+  cardano_uplc_constant_t**   constant);
+
+/**
+ * \brief Reads an integer constant value.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the value.
+ * \param[out] constant On success, the integer constant.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a propagated decode or allocation
+ *         error.
+ */
+static cardano_error_t
+read_integer(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  cardano_uplc_constant_t**   constant)
+{
+  cardano_bigint_t* value  = NULL;
+  int64_t           small  = 0;
+  cardano_error_t   result = cardano_uplc_flat_reader_integer(reader, &value);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (cardano_uplc_int_bigint_fits_int64(value, &small))
+  {
+    result = cardano_uplc_constant_new_integer_small(arena, small, constant);
+  }
+  else
+  {
+    result = cardano_uplc_constant_new_integer(arena, value, constant);
+  }
+
+  cardano_bigint_unref(&value);
+
+  return result;
+}
+
+/**
+ * \brief Reads a byte-string constant value.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the value.
+ * \param[out] constant On success, the byte-string constant.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a propagated decode or allocation
+ *         error.
+ */
+static cardano_error_t
+read_byte_string(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  cardano_uplc_constant_t**   constant)
+{
+  cardano_buffer_t* bytes  = NULL;
+  cardano_error_t   result = cardano_uplc_flat_reader_bytes(reader, &bytes);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_uplc_constant_new_byte_string(arena, bytes, constant);
+
+  cardano_buffer_unref(&bytes);
+
+  return result;
+}
+
+/**
+ * \brief Reads a UTF-8 string constant value.
+ *
+ * The bytes are read as a flat bytestring and then validated as UTF-8; invalid
+ * UTF-8 is rejected with \ref CARDANO_ERROR_DECODING.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the value.
+ * \param[out] constant On success, the string constant.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for
+ *         invalid UTF-8, or a propagated decode or allocation error.
+ */
+static cardano_error_t
+read_string(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  cardano_uplc_constant_t**   constant)
+{
+  cardano_buffer_t* bytes  = NULL;
+  cardano_error_t   result = cardano_uplc_flat_reader_bytes(reader, &bytes);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (!is_valid_utf8(cardano_buffer_get_data(bytes), cardano_buffer_get_size(bytes)))
+  {
+    cardano_buffer_unref(&bytes);
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = cardano_uplc_constant_new_string(arena, bytes, constant);
+
+  cardano_buffer_unref(&bytes);
+
+  return result;
+}
+
+/**
+ * \brief Reads a data constant value.
+ *
+ * The data is encoded as a flat bytestring whose contents are CBOR; those bytes
+ * are decoded directly into an arena data node through
+ * \ref cardano_uplc_data_from_cbor_bytes with no per-node caching.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the value.
+ * \param[out] constant On success, the data constant.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for
+ *         malformed CBOR, or a propagated decode or allocation error.
+ */
+static cardano_error_t
+read_data(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  cardano_uplc_constant_t**   constant)
+{
+  cardano_buffer_t*    bytes  = NULL;
+  cardano_uplc_data_t* data   = NULL;
+  cardano_error_t      result = cardano_uplc_flat_reader_bytes(reader, &bytes);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_uplc_data_from_cbor_bytes(arena, cardano_buffer_get_data(bytes), cardano_buffer_get_size(bytes), &data);
+
+  cardano_buffer_unref(&bytes);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return cardano_uplc_int_constant_new_data_node(arena, data, constant);
+}
+
+/**
+ * \brief Reads a cons-bit sequence of constant values of one element type.
+ *
+ * A one bit precedes each element and a zero bit ends the sequence. Each element
+ * is read at \p element_type and the element pointers are gathered into an arena
+ * array. This is the flat form of a list, of an array (the reference encodes a
+ * vector as a list) and of each level of a value.
+ *
+ * \param[in] arena The arena the elements and the element array are allocated from.
+ * \param[in,out] reader The flat reader, advanced past the sequence.
+ * \param[in] element_type The element type descriptor.
+ * \param[in] depth The current value nesting depth.
+ * \param[out] items On success, the element array, or NULL when \p count is 0.
+ * \param[out] count On success, the number of elements.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         truncated stream or nesting past the depth bound, or a propagated
+ *         allocation error.
+ */
+static cardano_error_t
+read_items(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const cardano_uplc_type_t*  element_type,
+  const size_t                depth,
+  // cppcheck-suppress misra-c2012-18.5; Reason: pointer nesting required by the API shape
+  const cardano_uplc_constant_t*** items,
+  size_t*                          count)
+{
+  const cardano_uplc_constant_t** list     = NULL;
+  size_t                          length   = 0U;
+  size_t                          capacity = 0U;
+  cardano_error_t                 result   = CARDANO_SUCCESS;
+  uint8_t                         more     = 0U;
+
+  result = cardano_uplc_flat_reader_bit(reader, &more);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  while (more != 0U)
+  {
+    cardano_uplc_constant_t* element = NULL;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = read_value(arena, reader, element_type, depth + 1U, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (length == capacity)
+    {
+      const size_t                    next_capacity = (capacity == 0U) ? 4U : (capacity * 2U);
+      const cardano_uplc_constant_t** grown         = (const cardano_uplc_constant_t**)cardano_uplc_arena_alloc(
+        arena,
+        next_capacity * sizeof(const cardano_uplc_constant_t*),
+        0U);
+
+      if (grown == NULL)
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+
+      for (size_t i = 0U; i < length; ++i)
+      {
+        grown[i] = list[i];
+      }
+
+      list     = grown;
+      capacity = next_capacity;
+    }
+
+    list[length] = element;
+    length       += 1U;
+
+    result = cardano_uplc_flat_reader_bit(reader, &more);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  *items = list;
+  *count = length;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a typed list or array constant value.
+ *
+ * Both forms are a cons-bit sequence of elements read at the element type; the
+ * array form is the reference's flat instance for a strict vector, which encodes
+ * the vector as a list (plutus-core/src/Data/Vector/Orphans.hs).
+ *
+ * \param[in] arena The arena the constant and its element array are allocated from.
+ * \param[in,out] reader The flat reader, advanced past the value.
+ * \param[in] type The list or array type descriptor.
+ * \param[in] depth The current value nesting depth.
+ * \param[out] constant On success, the list or array constant.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         truncated stream or nesting past the depth bound, or a propagated
+ *         allocation error.
+ */
+static cardano_error_t
+read_sequence(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const cardano_uplc_type_t*  type,
+  const size_t                depth,
+  cardano_uplc_constant_t**   constant)
+{
+  const cardano_uplc_constant_t** items = NULL;
+  size_t                          count = 0U;
+  // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+  cardano_error_t result = read_items(arena, reader, type->fst, depth, &items, &count);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (type->kind == CARDANO_UPLC_TYPE_ARRAY)
+  {
+    return cardano_uplc_constant_new_array(arena, type->fst, items, count, constant);
+  }
+
+  return cardano_uplc_constant_new_list(arena, type->fst, items, count, constant);
+}
+
+/**
+ * \brief Reads a multi-asset value constant.
+ *
+ * The flat form is the reference's encoding of the nested map: a cons-bit list of
+ * (currency symbol, cons-bit list of (token name, quantity)) entries, keys as flat
+ * byte strings and quantities as flat integers (plutus-core/src/PlutusCore/Value.hs,
+ * \c Flat instance of \c Value). The entries must already be canonical, as the
+ * reference's \c buildValueWith requires: strictly ascending keys of at most 32
+ * bytes, no empty token map and non-zero quantities in the signed 128-bit range.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the value.
+ * \param[in] depth The current value nesting depth.
+ * \param[out] constant On success, the value constant.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         truncated stream or a non-canonical value, or a propagated allocation
+ *         error.
+ */
+static cardano_error_t
+read_asset_value(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const size_t                depth,
+  cardano_uplc_constant_t**   constant)
+{
+  const cardano_uplc_type_t*      element = NULL;
+  const cardano_uplc_constant_t** items   = NULL;
+  size_t                          count   = 0U;
+  cardano_error_t                 result  = cardano_uplc_int_value_element_type(arena, &element);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+  result = read_items(arena, reader, element, depth, &items, &count);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (!cardano_uplc_int_value_entries_are_canonical(arena, items, count))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  return cardano_uplc_constant_new_value(arena, element, items, count, constant);
+}
+
+/**
+ * \brief Reads a typed pair constant value.
+ *
+ * A pair value is the first component value followed by the second component
+ * value, each read at its respective type.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the value.
+ * \param[in] type The pair type descriptor.
+ * \param[in] depth The current value nesting depth.
+ * \param[out] constant On success, the pair constant.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a propagated decode or allocation
+ *         error.
+ */
+static cardano_error_t
+read_pair(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const cardano_uplc_type_t*  type,
+  const size_t                depth,
+  cardano_uplc_constant_t**   constant)
+{
+  cardano_uplc_constant_t* fst = NULL;
+  cardano_uplc_constant_t* snd = NULL;
+  // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+  cardano_error_t result = read_value(arena, reader, type->fst, depth + 1U, &fst);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+  result = read_value(arena, reader, type->snd, depth + 1U, &snd);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return cardano_uplc_constant_new_pair(arena, fst, snd, constant);
+}
+
+/**
+ * \brief Reads a constant value for a parsed type descriptor.
+ *
+ * Dispatches on \p type->kind to the per-type readers. Recursion through list,
+ * array, pair and value constants is bounded by \ref FLAT_TYPE_MAX_DEPTH. The
+ * BLS12-381 G1, G2 and Miller-loop-result types have no flat value form: the
+ * reference's \c Flat instances fail to decode them (\c G1.hs, \c G2.hs and
+ * \c Pairing.hs under plutus-core/src/PlutusCore/Crypto/BLS12_381), so a value of
+ * any of them is a decode error. The type alone is accepted, so an empty list of
+ * such elements decodes as it does in the reference.
+ *
+ * \param[in] arena The arena the constant is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the value.
+ * \param[in] type The type descriptor whose value is read.
+ * \param[in] depth The current value nesting depth.
+ * \param[out] constant On success, the decoded constant.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         truncated or invalid value, a BLS12-381 value, a non-canonical value
+ *         constant, or nesting past the depth bound, or a propagated allocation
+ *         error.
+ */
+static cardano_error_t
+read_value(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const cardano_uplc_type_t*  type,
+  const size_t                depth,
+  cardano_uplc_constant_t**   constant)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (depth > FLAT_TYPE_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  switch (type->kind)
+  {
+    case CARDANO_UPLC_TYPE_INTEGER:
+    {
+      result = read_integer(arena, reader, constant);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    {
+      result = read_byte_string(arena, reader, constant);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_STRING:
+    {
+      result = read_string(arena, reader, constant);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_UNIT:
+    {
+      result = cardano_uplc_constant_new_unit(arena, constant);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BOOL:
+    {
+      uint8_t bit = 0U;
+
+      result = cardano_uplc_flat_reader_bit(reader, &bit);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_uplc_constant_new_bool(arena, bit != 0U, constant);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_LIST:
+    case CARDANO_UPLC_TYPE_ARRAY:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = read_sequence(arena, reader, type, depth, constant);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = read_pair(arena, reader, type, depth, constant);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_DATA:
+    {
+      result = read_data(arena, reader, constant);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_VALUE:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = read_asset_value(arena, reader, depth, constant);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    default:
+    {
+      result = CARDANO_ERROR_DECODING;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Reads a constant: its const-type list, then a value of that type.
+ *
+ * Under the ledger script checks a type list longer than
+ * \ref FLAT_SCRIPT_MAX_HEADER_SIZE tags is rejected before the value is read, as
+ * the ledger's script decoder does
+ * (plutus-ledger-api/src/PlutusLedgerApi/Common/SerialisedScript.hs,
+ * \c checkConstant).
+ *
+ * \param[in] arena The arena every node and interior object is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the constant.
+ * \param[in] rules The program-wide decoding rules.
+ * \param[out] constant On success, the decoded constant.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         malformed type or value or an oversized type header under the ledger
+ *         script checks, or a propagated allocation error.
+ */
+static cardano_error_t
+read_constant(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const decode_rules_t*       rules,
+  cardano_uplc_constant_t**   constant)
+{
+  const cardano_uplc_type_t* type        = NULL;
+  size_t                     header_size = 0U;
+  cardano_error_t            result      = read_type(arena, reader, &type, &header_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (rules->ledger_checks && (header_size > FLAT_SCRIPT_MAX_HEADER_SIZE))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  return read_value(arena, reader, type, 0U, constant);
+}
+
+/* Forward declaration: term decoding recurses on every nested term. */
+static cardano_error_t
+read_term(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const decode_rules_t*       rules,
+  size_t                      depth,
+  const cardano_uplc_term_t** term);
+
+/**
+ * \brief Reads a cons-bit list of terms into an arena-allocated pointer array.
+ *
+ * A term list is a cons-bit sequence: a one bit precedes each element and a zero
+ * bit ends the sequence, exactly like the constant list encoding. Each element is
+ * a full term decoded at \p depth, so an empty list yields a NULL array and a zero
+ * count. The element pointers are gathered into an arena array handed back to the
+ * caller.
+ *
+ * \param[in] arena The arena the element array and every element are allocated from.
+ * \param[in,out] reader The flat reader, advanced past the list.
+ * \param[in] rules The program-wide decoding rules.
+ * \param[in] depth The current term nesting depth.
+ * \param[out] items On success, the element array, or NULL when \p count is 0.
+ * \param[out] count On success, the number of elements.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         truncated stream or nesting past the depth bound, or a propagated
+ *         allocation error.
+ */
+static cardano_error_t
+read_term_list(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const decode_rules_t*       rules,
+  const size_t                depth,
+  // cppcheck-suppress misra-c2012-18.5; Reason: pointer nesting required by the API shape
+  const cardano_uplc_term_t*** items,
+  size_t*                      count)
+{
+  const cardano_uplc_term_t** list     = NULL;
+  size_t                      length   = 0U;
+  size_t                      capacity = 0U;
+  cardano_error_t             result   = CARDANO_SUCCESS;
+  uint8_t                     more     = 0U;
+
+  result = cardano_uplc_flat_reader_bit(reader, &more);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  while (more != 0U)
+  {
+    const cardano_uplc_term_t* element = NULL;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = read_term(arena, reader, rules, depth + 1U, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (length == capacity)
+    {
+      const size_t                next_capacity = (capacity == 0U) ? 4U : (capacity * 2U);
+      const cardano_uplc_term_t** grown         = (const cardano_uplc_term_t**)cardano_uplc_arena_alloc(
+        arena,
+        next_capacity * sizeof(const cardano_uplc_term_t*),
+        0U);
+
+      if (grown == NULL)
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+
+      for (size_t i = 0U; i < length; ++i)
+      {
+        grown[i] = list[i];
+      }
+
+      list     = grown;
+      capacity = next_capacity;
+    }
+
+    list[length] = element;
+    length       += 1U;
+
+    result = cardano_uplc_flat_reader_bit(reader, &more);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  *items = list;
+  *count = length;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a builtin term, validating the 7-bit builtin tag.
+ *
+ * Under the ledger script checks a builtin that is not available in the script's
+ * language at the protocol version is rejected, as the ledger's script decoder
+ * does (plutus-ledger-api/src/PlutusLedgerApi/Common/SerialisedScript.hs,
+ * \c checkBuiltin).
+ *
+ * \param[in] arena The arena the term is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the builtin tag.
+ * \param[in] rules The program-wide decoding rules.
+ * \param[out] term On success, the builtin term.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for an
+ *         unknown or unavailable builtin tag or a truncated stream, or a
+ *         propagated allocation error.
+ */
+static cardano_error_t
+read_builtin(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const decode_rules_t*       rules,
+  const cardano_uplc_term_t** term)
+{
+  uint8_t              tag    = 0U;
+  cardano_uplc_term_t* built  = NULL;
+  cardano_error_t      result = cardano_uplc_flat_reader_bits8(reader, FLAT_BUILTIN_TAG_BITS, &tag);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (tag >= (uint8_t)CARDANO_UPLC_BUILTIN_COUNT)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (rules->ledger_checks && !cardano_uplc_builtin_available((cardano_uplc_builtin_t)tag, rules->language, rules->protocol_major))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = cardano_uplc_term_new_builtin(arena, (cardano_uplc_builtin_t)tag, &built);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *term = built;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a constructor term: a tag word then a cons-bit field list.
+ *
+ * A constructor in a program older than 1.1.0 is rejected before its payload is
+ * read, as the reference decoder does
+ * (plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Core/Instance/Flat.hs,
+ * \c handleTerm 8). Under the ledger script checks a constructor with more than
+ * \ref FLAT_SCRIPT_MAX_CONSTR_FIELDS fields is rejected once its fields are read
+ * (plutus-ledger-api/src/PlutusLedgerApi/Common/SerialisedScript.hs,
+ * \c checkConstr).
+ *
+ * \param[in] arena The arena the term and its field array are allocated from.
+ * \param[in,out] reader The flat reader, advanced past the constructor.
+ * \param[in] rules The program-wide decoding rules.
+ * \param[in] depth The current term nesting depth.
+ * \param[out] term On success, the constructor term.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING when
+ *         constructors are not allowed, for too many fields under the ledger script
+ *         checks, a truncated stream or nesting past the depth bound, or a
+ *         propagated allocation error.
+ */
+static cardano_error_t
+read_constr(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const decode_rules_t*       rules,
+  const size_t                depth,
+  const cardano_uplc_term_t** term)
+{
+  size_t                      tag         = 0U;
+  const cardano_uplc_term_t** fields      = NULL;
+  size_t                      field_count = 0U;
+  cardano_uplc_term_t*        built       = NULL;
+  cardano_error_t             result      = CARDANO_SUCCESS;
+
+  if (!rules->allow_constr_case)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = cardano_uplc_flat_reader_word(reader, &tag);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+  result = read_term_list(arena, reader, rules, depth, &fields, &field_count);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (rules->ledger_checks && (field_count > FLAT_SCRIPT_MAX_CONSTR_FIELDS))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = cardano_uplc_term_new_constr(arena, (uint64_t)tag, fields, field_count, &built);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *term = built;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a case term: a scrutinee term then a cons-bit branch list.
+ *
+ * A case in a program older than 1.1.0 is rejected before its payload is read,
+ * as the reference decoder does
+ * (plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Core/Instance/Flat.hs,
+ * \c handleTerm 9).
+ *
+ * \param[in] arena The arena the term and its branch array are allocated from.
+ * \param[in,out] reader The flat reader, advanced past the case.
+ * \param[in] rules The program-wide decoding rules.
+ * \param[in] depth The current term nesting depth.
+ * \param[out] term On success, the case term.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING when
+ *         case terms are not allowed, for a truncated stream or nesting past the
+ *         depth bound, or a propagated allocation error.
+ */
+static cardano_error_t
+read_case(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const decode_rules_t*       rules,
+  const size_t                depth,
+  const cardano_uplc_term_t** term)
+{
+  const cardano_uplc_term_t*  scrutinee    = NULL;
+  const cardano_uplc_term_t** branches     = NULL;
+  size_t                      branch_count = 0U;
+  cardano_uplc_term_t*        built        = NULL;
+  cardano_error_t             result       = CARDANO_SUCCESS;
+
+  if (!rules->allow_constr_case)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+  result = read_term(arena, reader, rules, depth + 1U, &scrutinee);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+  result = read_term_list(arena, reader, rules, depth, &branches, &branch_count);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_uplc_term_new_case(arena, scrutinee, branches, branch_count, &built);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *term = built;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a single term, dispatching on the 4-bit term tag.
+ *
+ * Recursion through the nested forms is bounded by \ref FLAT_TERM_MAX_DEPTH so a
+ * deeply nested adversarial input fails with \ref CARDANO_ERROR_DECODING instead of
+ * overflowing the C stack. An unknown term tag is rejected with the same error.
+ *
+ * \param[in] arena The arena every node is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the term.
+ * \param[in] rules The program-wide decoding rules.
+ * \param[in] depth The current term nesting depth.
+ * \param[out] term On success, the decoded term.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for an
+ *         unknown term or builtin tag, a malformed constant, a truncated stream or
+ *         nesting past the depth bound, or a propagated allocation error.
+ */
+static cardano_error_t
+read_term(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const decode_rules_t*       rules,
+  const size_t                depth,
+  const cardano_uplc_term_t** term)
+{
+  uint8_t         tag    = 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (depth > FLAT_TERM_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = cardano_uplc_flat_reader_bits8(reader, FLAT_TERM_TAG_BITS, &tag);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (tag == FLAT_TERM_TAG_VAR)
+  {
+    size_t               index = 0U;
+    cardano_uplc_term_t* built = NULL;
+
+    result = cardano_uplc_flat_reader_word(reader, &index);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_uplc_term_new_var(arena, (uint64_t)index, &built);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      *term = built;
+    }
+  }
+  else if (tag == FLAT_TERM_TAG_DELAY)
+  {
+    const cardano_uplc_term_t* body  = NULL;
+    cardano_uplc_term_t*       built = NULL;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = read_term(arena, reader, rules, depth + 1U, &body);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_uplc_term_new_delay(arena, body, &built);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      *term = built;
+    }
+  }
+  else if (tag == FLAT_TERM_TAG_LAMBDA)
+  {
+    const cardano_uplc_term_t* body  = NULL;
+    cardano_uplc_term_t*       built = NULL;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = read_term(arena, reader, rules, depth + 1U, &body);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_uplc_term_new_lambda(arena, body, &built);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      *term = built;
+    }
+  }
+  else if (tag == FLAT_TERM_TAG_APPLY)
+  {
+    const cardano_uplc_term_t* function = NULL;
+    const cardano_uplc_term_t* argument = NULL;
+    cardano_uplc_term_t*       built    = NULL;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = read_term(arena, reader, rules, depth + 1U, &function);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = read_term(arena, reader, rules, depth + 1U, &argument);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_uplc_term_new_apply(arena, function, argument, &built);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      *term = built;
+    }
+  }
+  else if (tag == FLAT_TERM_TAG_CONSTANT)
+  {
+    cardano_uplc_constant_t* constant = NULL;
+    cardano_uplc_term_t*     built    = NULL;
+
+    result = read_constant(arena, reader, rules, &constant);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_uplc_term_new_constant(arena, constant, &built);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      *term = built;
+    }
+  }
+  else if (tag == FLAT_TERM_TAG_FORCE)
+  {
+    const cardano_uplc_term_t* body  = NULL;
+    cardano_uplc_term_t*       built = NULL;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = read_term(arena, reader, rules, depth + 1U, &body);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_uplc_term_new_force(arena, body, &built);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      *term = built;
+    }
+  }
+  else if (tag == FLAT_TERM_TAG_ERROR)
+  {
+    cardano_uplc_term_t* built = NULL;
+
+    result = cardano_uplc_term_new_error(arena, &built);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      *term = built;
+    }
+  }
+  else if (tag == FLAT_TERM_TAG_BUILTIN)
+  {
+    result = read_builtin(arena, reader, rules, term);
+  }
+  else if (tag == FLAT_TERM_TAG_CONSTR)
+  {
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = read_constr(arena, reader, rules, depth, term);
+  }
+  else if (tag == FLAT_TERM_TAG_CASE)
+  {
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = read_case(arena, reader, rules, depth, term);
+  }
+  else
+  {
+    result = CARDANO_ERROR_DECODING;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Reads a full program: three version words, a term, then the filler.
+ *
+ * \c Constr and \c Case are accepted only from version 1.1.0, matching the
+ * reference decoder. The filler must end exactly at the end of the stream, since
+ * the reference decoder rejects any bytes left over after the program.
+ *
+ * \param[in] arena The arena every node and interior object is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the program.
+ * \param[in] rules The ledger script checks to apply; its \c allow_constr_case
+ *            is replaced by the program version gate.
+ * \param[out] program On success, the decoded program.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         malformed, truncated or over-long stream, a version word too large for
+ *         32 bits, a term \p rules rejects or a \c Constr or \c Case before
+ *         version 1.1.0, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         arena cannot serve a node.
+ */
+static cardano_error_t
+decode_program(
+  cardano_uplc_arena_t*          arena,
+  cardano_uplc_flat_reader_t*    reader,
+  const decode_rules_t*          rules,
+  const cardano_uplc_program_t** program)
+{
+  size_t                     major         = 0U;
+  size_t                     minor         = 0U;
+  size_t                     patch         = 0U;
+  const cardano_uplc_term_t* term          = NULL;
+  cardano_uplc_program_t*    result        = NULL;
+  cardano_error_t            status        = CARDANO_SUCCESS;
+  decode_rules_t             program_rules = *rules;
+
+  status = cardano_uplc_flat_reader_word(reader, &major);
+
+  if (status != CARDANO_SUCCESS)
+  {
+    return status;
+  }
+
+  status = cardano_uplc_flat_reader_word(reader, &minor);
+
+  if (status != CARDANO_SUCCESS)
+  {
+    return status;
+  }
+
+  status = cardano_uplc_flat_reader_word(reader, &patch);
+
+  if (status != CARDANO_SUCCESS)
+  {
+    return status;
+  }
+
+  if ((major > UINT32_MAX) || (minor > UINT32_MAX) || (patch > UINT32_MAX))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  program_rules.allow_constr_case = (major > FLAT_CONSTR_CASE_MIN_MAJOR) || ((major == FLAT_CONSTR_CASE_MIN_MAJOR) && (minor >= FLAT_CONSTR_CASE_MIN_MINOR));
+
+  status = read_term(arena, reader, &program_rules, 0U, &term);
+
+  if (status != CARDANO_SUCCESS)
+  {
+    return status;
+  }
+
+  status = cardano_uplc_flat_reader_filler(reader);
+
+  if (status != CARDANO_SUCCESS)
+  {
+    return status;
+  }
+
+  if (reader->byte_pos != reader->size)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  result = (cardano_uplc_program_t*)cardano_uplc_arena_alloc(arena, sizeof(cardano_uplc_program_t), 0U);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->version_major = (uint32_t)major;
+  result->version_minor = (uint32_t)minor;
+  result->version_patch = (uint32_t)patch;
+  result->term          = term;
+
+  *program = result;
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_flat_decode_constant(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  cardano_uplc_constant_t**   constant)
+{
+  if ((arena == NULL) || (reader == NULL) || (constant == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return read_constant(arena, reader, &UNRESTRICTED_RULES, constant);
+}
+
+cardano_error_t
+cardano_uplc_flat_decode_term(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const cardano_uplc_term_t** term)
+{
+  if ((arena == NULL) || (reader == NULL) || (term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return read_term(arena, reader, &UNRESTRICTED_RULES, 0U, term);
+}
+
+cardano_error_t
+cardano_uplc_flat_decode_program(
+  cardano_uplc_arena_t*          arena,
+  cardano_uplc_flat_reader_t*    reader,
+  const cardano_uplc_program_t** program)
+{
+  if ((arena == NULL) || (reader == NULL) || (program == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  return decode_program(arena, reader, &UNRESTRICTED_RULES, program);
+}
+
+cardano_error_t
+cardano_uplc_flat_decode_script_program(
+  cardano_uplc_arena_t*             arena,
+  cardano_uplc_flat_reader_t*       reader,
+  const cardano_uplc_lang_version_t language,
+  const uint64_t                    protocol_major,
+  const cardano_uplc_program_t**    program)
+{
+  decode_rules_t rules;
+
+  if ((arena == NULL) || (reader == NULL) || (program == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  rules.allow_constr_case = false;
+  rules.ledger_checks     = true;
+  rules.language          = language;
+  rules.protocol_major    = protocol_major;
+
+  return decode_program(arena, reader, &rules, program);
+}
diff --git a/vendor/src/uplc/flat/flat_decode.h b/vendor/src/uplc/flat/flat_decode.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/flat/flat_decode.h
@@ -0,0 +1,195 @@
+/**
+ * \file flat_decode.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_DECODE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_DECODE_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_lang_version.h"
+#include "../ast/uplc_program.h"
+#include "../ast/uplc_term.h"
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+#include "../arena/uplc_arena.h"
+#include "flat_reader.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Decodes a single flat-encoded constant into an arena-allocated value.
+ *
+ * Reads the const-type list (a run of 4-bit type tags, each preceded by a one
+ * continuation bit, with the application tag building \c list<T>, \c array<T> and
+ * \c pair<a,b>) and then the value for that type. The \c data constant is read as
+ * a flat bytestring whose contents are decoded as CBOR through
+ * \ref cardano_plutus_data_from_cbor. An array is read like a list. A value is
+ * read as a list of (currency symbol, list of (token name, quantity)) entries and
+ * must be canonical: strictly ascending keys of at most 32 bytes, no empty token
+ * list and non-zero quantities in the signed 128-bit range.
+ *
+ * Every node the decoder produces is allocated from \p arena, and every interior
+ * refcounted object (bigint, buffer, plutus data) is registered with \p arena
+ * through the \c term.c constructors, so a single \ref cardano_uplc_arena_free
+ * releases everything regardless of the exit path. On failure no constant is
+ * handed back and nothing the call created outlives \p arena.
+ *
+ * The BLS12-381 G1, G2 and Miller-loop-result types have no flat value form, as in
+ * the reference decoder, so a value of any of them is rejected with
+ * \ref CARDANO_ERROR_DECODING.
+ *
+ * \param[in] arena The arena every node and interior object is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the encoded constant.
+ * \param[out] constant On success, the decoded constant; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, \ref CARDANO_ERROR_DECODING for a malformed
+ *         type list, an unknown tag, a truncated value, invalid UTF-8 in a string,
+ *         malformed CBOR for a \c data value, a non-canonical value constant, a
+ *         BLS12-381 value, or type/value nesting past the depth bound,
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena or an
+ *         interior object cannot be allocated, or \ref CARDANO_ERROR_ILLEGAL_STATE
+ *         if the arena is past its byte ceiling.
+ */
+cardano_error_t
+cardano_uplc_flat_decode_constant(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  cardano_uplc_constant_t**   constant);
+
+/**
+ * \brief Decodes a single flat-encoded term into an arena-allocated AST.
+ *
+ * Reads the 4-bit term tag and recurses per the term table:
+ * tag 0 is a \c Var carrying a de Bruijn index word, 1 \c Delay, 2 \c Lambda (the
+ * binder is implicit in the de Bruijn encoding), 3 \c Apply, 4 a \c Constant read
+ * through \ref cardano_uplc_flat_decode_constant, 5 \c Force, 6 \c Error, 7 a
+ * \c Builtin naming a default function by a 7-bit tag, 8 a \c Constr (a tag word
+ * then a cons-bit list of field terms) and 9 a \c Case (a scrutinee term then a
+ * cons-bit list of branch terms). A field or branch list, like the constant list
+ * encoding, places a one bit before each element and a zero bit to stop.
+ *
+ * No program version is known at this level, so \c Constr and \c Case are always
+ * accepted; \ref cardano_uplc_flat_decode_program applies the version gate.
+ *
+ * Recursion through \c Delay, \c Lambda, \c Apply, \c Force, \c Constr and \c Case
+ * is bounded by an internal depth ceiling, so a deeply nested adversarial input
+ * fails with \ref CARDANO_ERROR_DECODING rather than overflowing the C stack.
+ *
+ * Every node is allocated from \p arena, and an interior constant is built through
+ * the constant decoder, which registers its refcounted objects with \p arena. On
+ * failure no term is handed back and nothing the call created outlives \p arena.
+ *
+ * \param[in] arena The arena every node and interior object is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the encoded term.
+ * \param[out] term On success, the decoded term; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, \ref CARDANO_ERROR_DECODING for an unknown term or
+ *         builtin tag, a malformed constant, a truncated stream or nesting past the
+ *         depth bound, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena
+ *         cannot serve a node.
+ */
+cardano_error_t
+cardano_uplc_flat_decode_term(
+  cardano_uplc_arena_t*       arena,
+  cardano_uplc_flat_reader_t* reader,
+  const cardano_uplc_term_t** term);
+
+/**
+ * \brief Decodes a full flat-encoded program into an arena-allocated value.
+ *
+ * Reads three version words (major, minor, patch), then one term through
+ * \ref cardano_uplc_flat_decode_term, then a final filler run: a sequence of zero
+ * bits up to and including a terminating one bit that byte-aligns the stream. A
+ * truncated stream, a missing terminating filler bit, bytes left over after the
+ * filler or a version word that does not fit in 32 bits is rejected with
+ * \ref CARDANO_ERROR_DECODING. A \c Constr or \c Case term in a program whose
+ * version is below 1.1.0 is rejected the same way, matching the reference decoder.
+ *
+ * No ledger script checks are applied; \ref cardano_uplc_flat_decode_script_program
+ * decodes a program the way the ledger deserialises a script.
+ *
+ * The returned program and its whole term tree are owned by \p arena; a single
+ * \ref cardano_uplc_arena_free releases everything regardless of the exit path.
+ *
+ * \param[in] arena The arena every node and interior object is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the encoded program.
+ * \param[out] program On success, the decoded program; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, \ref CARDANO_ERROR_DECODING for a malformed or
+ *         truncated stream, a version word too large for 32 bits, a \c Constr or
+ *         \c Case term before version 1.1.0, a missing terminating filler bit or
+ *         bytes after it, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         arena cannot serve a node.
+ */
+cardano_error_t
+cardano_uplc_flat_decode_program(
+  cardano_uplc_arena_t*          arena,
+  cardano_uplc_flat_reader_t*    reader,
+  const cardano_uplc_program_t** program);
+
+/**
+ * \brief Decodes a flat-encoded ledger script for a language at a protocol version.
+ *
+ * Decodes like \ref cardano_uplc_flat_decode_program and also applies the checks
+ * the ledger's script decoder makes
+ * (plutus-ledger-api/src/PlutusLedgerApi/Common/SerialisedScript.hs,
+ * \c scriptCBORDecoder): every builtin must be available in \p language at
+ * \p protocol_major (\ref cardano_uplc_builtin_available), every constant type
+ * header must be at most 32 flat type tags, and every \c Constr term must have at
+ * most 1024 fields. A script that fails any of them cannot be deserialised.
+ *
+ * Ownership matches \ref cardano_uplc_flat_decode_program, so the program and
+ * its term tree are owned by \p arena.
+ *
+ * \param[in] arena The arena every node and interior object is allocated from.
+ * \param[in,out] reader The flat reader, advanced past the encoded program.
+ * \param[in] language The Plutus language of the script.
+ * \param[in] protocol_major The major protocol version the script is used under.
+ * \param[out] program On success, the decoded program; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p reader or \p program is NULL, \ref CARDANO_ERROR_DECODING
+ *         for any failure \ref cardano_uplc_flat_decode_program reports or a
+ *         failed ledger script check, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve a
+ *         node.
+ */
+cardano_error_t
+cardano_uplc_flat_decode_script_program(
+  cardano_uplc_arena_t*          arena,
+  cardano_uplc_flat_reader_t*    reader,
+  cardano_uplc_lang_version_t    language,
+  uint64_t                       protocol_major,
+  const cardano_uplc_program_t** program);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_DECODE_H */
diff --git a/vendor/src/uplc/flat/flat_encode.c b/vendor/src/uplc/flat/flat_encode.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/flat/flat_encode.c
@@ -0,0 +1,731 @@
+/**
+ * \file flat_encode.c
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "flat_encode.h"
+#include "../ast/uplc_program.h"
+#include "../ast/uplc_term.h"
+#include <cardano/cbor/cbor_writer.h>
+
+#include "../ast/uplc_int.h"
+#include "../data/uplc_data.h"
+#include "flat_writer.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief Flat const-type list tags, the inverse of the tags in flat_decode.c.
+ *
+ * The application tag drives the three nested shapes: <tt>[7, 5, T]</tt> for
+ * <tt>list(T)</tt>, <tt>[7, 12, T]</tt> for <tt>array(T)</tt> and
+ * <tt>[7, 7, 6, A, B]</tt> for <tt>pair(A, B)</tt>.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_INTEGER = 0U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BYTE_STRING = 1U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_STRING = 2U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_UNIT = 3U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BOOL = 4U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_LIST = 5U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_PAIR = 6U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_APPLY = 7U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_DATA = 8U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BLS_G1 = 9U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BLS_G2 = 10U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BLS_ML_RESULT = 11U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_ARRAY = 12U;
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_VALUE = 13U;
+
+/**
+ * \brief Number of bits in a single const-type tag.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TYPE_TAG_BITS = 4U;
+
+/**
+ * \brief Number of bits in a single term tag.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_TERM_TAG_BITS = 4U;
+
+/**
+ * \brief Number of bits in a builtin tag.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_BUILTIN_TAG_BITS = 7U;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/* Forward declaration: constant encoding recurses on list and pair values. */
+static cardano_error_t
+write_constant(cardano_uplc_flat_writer_t* writer, const cardano_uplc_constant_t* constant);
+
+/* Forward declaration: term encoding recurses on every nested term. */
+static cardano_error_t
+write_term(cardano_uplc_flat_writer_t* writer, const cardano_uplc_term_t* term);
+
+/**
+ * \brief Writes one const-type tag: a one continuation bit then the 4-bit tag.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] tag The 4-bit type tag.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a propagated write error.
+ */
+static cardano_error_t
+write_type_tag(cardano_uplc_flat_writer_t* writer, const uint8_t tag)
+{
+  cardano_error_t result = cardano_uplc_flat_writer_bit(writer, 1U);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  return cardano_uplc_flat_writer_bits8(writer, tag, FLAT_TYPE_TAG_BITS);
+}
+
+/**
+ * \brief Emits the const-type tag run for a type descriptor (no terminator).
+ *
+ * Leaf types emit a single tag; a list emits <tt>[apply, list, ...element]</tt>,
+ * an array <tt>[apply, array, ...element]</tt> and a pair
+ * <tt>[apply, apply, pair, ...fst, ...snd]</tt>, matching \c parse_type in
+ * flat_decode.c. The terminating zero bit is written by the caller.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] type The type descriptor to emit.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_INVALID_ARGUMENT for
+ *         an unknown kind, or a propagated write error.
+ */
+static cardano_error_t
+write_type_tags(cardano_uplc_flat_writer_t* writer, const cardano_uplc_type_t* type)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (type->kind)
+  {
+    case CARDANO_UPLC_TYPE_INTEGER:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_INTEGER);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_BYTE_STRING);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_STRING:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_STRING);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_UNIT:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_UNIT);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BOOL:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_BOOL);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_DATA:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_DATA);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_BLS_G1);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_BLS_G2);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_BLS_ML_RESULT);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_VALUE:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_VALUE);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_LIST:
+    case CARDANO_UPLC_TYPE_ARRAY:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_APPLY);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = write_type_tag(writer, (type->kind == CARDANO_UPLC_TYPE_LIST) ? FLAT_TYPE_TAG_LIST : FLAT_TYPE_TAG_ARRAY);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = write_type_tags(writer, type->fst);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      result = write_type_tag(writer, FLAT_TYPE_TAG_APPLY);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = write_type_tag(writer, FLAT_TYPE_TAG_APPLY);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = write_type_tag(writer, FLAT_TYPE_TAG_PAIR);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = write_type_tags(writer, type->fst);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = write_type_tags(writer, type->snd);
+      }
+
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Writes the data carried by a value at a given type descriptor.
+ *
+ * Dispatches on \p type->kind: an integer is zig-zagged, byte-string/string/data
+ * become flat bytestrings, a bool is one bit, a unit writes nothing, a list or an
+ * array is a cons-bit run of element values and a pair is its two component values.
+ * A value is the cons-bit run of its (currency symbol, token list) entries, the
+ * reference's encoding of the nested map. The BLS12-381 kinds have no flat value
+ * form in the reference and are rejected.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] type The type descriptor whose value is written.
+ * \param[in] constant The constant whose value is written.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_INVALID_ARGUMENT for
+ *         a kind with no flat serialization, or a propagated write or allocation
+ *         error.
+ */
+static cardano_error_t
+write_value(
+  cardano_uplc_flat_writer_t*    writer,
+  const cardano_uplc_type_t*     type,
+  const cardano_uplc_constant_t* constant)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (type->kind)
+  {
+    case CARDANO_UPLC_TYPE_INTEGER:
+    {
+      if (cardano_uplc_constant_int_is_small(constant))
+      {
+        cardano_bigint_t* temp = NULL;
+
+        result = cardano_bigint_from_int(cardano_uplc_constant_int_small(constant), &temp);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_uplc_flat_writer_integer(writer, temp);
+          cardano_bigint_unref(&temp);
+        }
+      }
+      else
+      {
+        result = cardano_uplc_flat_writer_integer(writer, constant->as.integer.big);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    {
+      result = cardano_uplc_flat_writer_bytes(
+        writer,
+        constant->as.bytes.data,
+        constant->as.bytes.size);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_STRING:
+    {
+      result = cardano_uplc_flat_writer_bytes(
+        writer,
+        constant->as.string.data,
+        constant->as.string.size);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_UNIT:
+    {
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BOOL:
+    {
+      result = cardano_uplc_flat_writer_bit(writer, constant->as.boolean ? 1U : 0U);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_DATA:
+    {
+      cardano_cbor_writer_t* cbor  = cardano_cbor_writer_new();
+      cardano_buffer_t*      bytes = NULL;
+
+      if (cbor == NULL)
+      {
+        result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        break;
+      }
+
+      result = cardano_uplc_data_to_cbor(constant->as.data, cbor);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_cbor_writer_encode_in_buffer(cbor, &bytes);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_uplc_flat_writer_bytes(writer, cardano_buffer_get_data(bytes), cardano_buffer_get_size(bytes));
+      }
+
+      cardano_buffer_unref(&bytes);
+      cardano_cbor_writer_unref(&cbor);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_LIST:
+    case CARDANO_UPLC_TYPE_ARRAY:
+    case CARDANO_UPLC_TYPE_VALUE:
+    {
+      const cardano_uplc_type_t* element = (type->kind == CARDANO_UPLC_TYPE_VALUE) ? constant->as.list.element_type : type->fst;
+
+      for (size_t i = 0U; (result == CARDANO_SUCCESS) && (i < constant->as.list.count); ++i)
+      {
+        result = cardano_uplc_flat_writer_bit(writer, 1U);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          result = write_value(writer, element, constant->as.list.items[i]);
+        }
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_uplc_flat_writer_bit(writer, 0U);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = write_value(writer, type->fst, constant->as.pair.fst);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = write_value(writer, type->snd, constant->as.pair.snd);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Recovers the type descriptor a constant carries.
+ *
+ * Leaf constants, including a value, map their kind directly. A list or an array
+ * builds <tt>list(element_type)</tt> or <tt>array(element_type)</tt> and a pair
+ * builds <tt>pair(fst-type, snd-type)</tt> from the recovered component types. The
+ * descriptor and any nested nodes are allocated from \p arena.
+ *
+ * \param[in] arena The arena every descriptor node is allocated from.
+ * \param[in] constant The constant whose type is recovered.
+ * \param[out] type On success, the recovered type descriptor; left untouched on
+ *             failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_INVALID_ARGUMENT for
+ *         an unknown kind, or a propagated allocation error.
+ */
+static cardano_error_t
+constant_type(
+  cardano_uplc_arena_t*          arena,
+  const cardano_uplc_constant_t* constant,
+  const cardano_uplc_type_t**    type)
+{
+  cardano_error_t      result = CARDANO_SUCCESS;
+  cardano_uplc_type_t* built  = NULL;
+
+  switch (constant->kind)
+  {
+    case CARDANO_UPLC_TYPE_INTEGER:
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    case CARDANO_UPLC_TYPE_STRING:
+    case CARDANO_UPLC_TYPE_UNIT:
+    case CARDANO_UPLC_TYPE_BOOL:
+    case CARDANO_UPLC_TYPE_DATA:
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    case CARDANO_UPLC_TYPE_VALUE:
+    {
+      result = cardano_uplc_type_new(arena, constant->kind, NULL, NULL, &built);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *type = built;
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_LIST:
+    case CARDANO_UPLC_TYPE_ARRAY:
+    {
+      result = cardano_uplc_type_new(arena, constant->kind, constant->as.list.element_type, NULL, &built);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *type = built;
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      const cardano_uplc_type_t* fst = NULL;
+      const cardano_uplc_type_t* snd = NULL;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = constant_type(arena, constant->as.pair.fst, &fst);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = constant_type(arena, constant->as.pair.snd, &snd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_uplc_type_new(arena, CARDANO_UPLC_TYPE_PAIR, fst, snd, &built);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        *type = built;
+      }
+
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Writes a constant: its const-type list then its value.
+ *
+ * Recovers the constant's type into a scratch arena, emits the const-type tag run
+ * followed by the terminating zero bit, then writes the value. The scratch arena is
+ * freed on every exit path.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] constant The constant to write.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_INVALID_ARGUMENT for
+ *         a kind with no flat serialization, or a propagated write or allocation
+ *         error.
+ */
+static cardano_error_t
+write_constant(cardano_uplc_flat_writer_t* writer, const cardano_uplc_constant_t* constant)
+{
+  cardano_uplc_arena_t*      arena  = NULL;
+  const cardano_uplc_type_t* type   = NULL;
+  cardano_error_t            result = cardano_uplc_arena_new(0U, &arena);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = constant_type(arena, constant, &type);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = write_type_tags(writer, type);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_flat_writer_bit(writer, 0U);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = write_value(writer, type, constant);
+  }
+
+  cardano_uplc_arena_free(&arena);
+
+  return result;
+}
+
+/**
+ * \brief Writes a cons-bit list of terms: a one bit before each, a zero to stop.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] items The element terms, or NULL when \p count is 0.
+ * \param[in] count The number of elements.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a propagated write error.
+ */
+static cardano_error_t
+write_term_list(
+  cardano_uplc_flat_writer_t*       writer,
+  const cardano_uplc_term_t* const* items,
+  const size_t                      count)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (result == CARDANO_SUCCESS) && (i < count); ++i)
+  {
+    result = cardano_uplc_flat_writer_bit(writer, 1U);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = write_term(writer, items[i]);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_flat_writer_bit(writer, 0U);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Writes a single term: its 4-bit tag then its payload.
+ *
+ * The exact inverse of \c read_term in flat_decode.c. The term kind enum value
+ * is itself the 4-bit tag.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] term The term to write.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_INVALID_ARGUMENT for
+ *         an unknown term kind, or a propagated write or allocation error.
+ */
+static cardano_error_t
+write_term(cardano_uplc_flat_writer_t* writer, const cardano_uplc_term_t* term)
+{
+  cardano_error_t result = cardano_uplc_flat_writer_bits8(writer, (uint8_t)term->kind, FLAT_TERM_TAG_BITS);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (term->kind)
+  {
+    case CARDANO_UPLC_TERM_VAR:
+    {
+      result = cardano_uplc_flat_writer_word(writer, (size_t)term->as.var_index);
+      break;
+    }
+    case CARDANO_UPLC_TERM_DELAY:
+    case CARDANO_UPLC_TERM_LAMBDA:
+    case CARDANO_UPLC_TERM_FORCE:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = write_term(writer, term->as.unary);
+      break;
+    }
+    case CARDANO_UPLC_TERM_APPLY:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = write_term(writer, term->as.apply.function);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = write_term(writer, term->as.apply.argument);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TERM_CONSTANT:
+    {
+      result = write_constant(writer, term->as.constant);
+      break;
+    }
+    case CARDANO_UPLC_TERM_ERROR:
+    {
+      break;
+    }
+    case CARDANO_UPLC_TERM_BUILTIN:
+    {
+      result = cardano_uplc_flat_writer_bits8(writer, (uint8_t)term->as.builtin, FLAT_BUILTIN_TAG_BITS);
+      break;
+    }
+    case CARDANO_UPLC_TERM_CONSTR:
+    {
+      result = cardano_uplc_flat_writer_word(writer, (size_t)term->as.constr.tag);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = write_term_list(writer, term->as.constr.fields, term->as.constr.field_count);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TERM_CASE:
+    {
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = write_term(writer, term->as.cases.scrutinee);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = write_term_list(writer, term->as.cases.branches, term->as.cases.branch_count);
+      }
+
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_int_flat_encode_program(
+  const cardano_uplc_program_t* program,
+  cardano_buffer_t**            out_flat)
+{
+  cardano_uplc_flat_writer_t writer = { NULL, 0U, 0U };
+  cardano_error_t            result = CARDANO_SUCCESS;
+
+  if ((program == NULL) || (program->term == NULL) || (out_flat == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_uplc_flat_writer_init(&writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_uplc_flat_writer_word(&writer, (size_t)program->version_major);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_flat_writer_word(&writer, (size_t)program->version_minor);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_flat_writer_word(&writer, (size_t)program->version_patch);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = write_term(&writer, program->term);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_flat_writer_filler(&writer);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_flat_writer_finish(&writer, out_flat);
+  }
+
+  cardano_uplc_flat_writer_dispose(&writer);
+
+  return result;
+}
diff --git a/vendor/src/uplc/flat/flat_encode.h b/vendor/src/uplc/flat/flat_encode.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/flat/flat_encode.h
@@ -0,0 +1,70 @@
+/**
+ * \file flat_encode.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_ENCODE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_ENCODE_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_program.h"
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Flat-encodes a program into a newly allocated byte buffer.
+ *
+ * Internal flat encoder behind \ref cardano_uplc_flat_encode_program. Writes the
+ * three version words, then the term, then a byte-aligning filler, producing the
+ * canonical flat byte stream and the exact inverse of
+ * \ref cardano_uplc_flat_decode_program. The BLS12-381 G1, G2 and Miller-loop-result
+ * values have no flat serialization and are rejected, as the reference encoder
+ * refuses them; a list or array of such elements still encodes when it is empty.
+ * The caller is expected to have validated its arguments; the \c cardano_uplc_int_
+ * prefix marks this entry module-internal.
+ *
+ * \param[in] program The program to encode. Must not be NULL and must carry a
+ *            non-NULL term.
+ * \param[out] out_flat On success, the flat bytes; the caller releases them with
+ *             \ref cardano_buffer_unref. Left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p program, its term, or \p out_flat is NULL,
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT for an unknown term kind or a
+ *         constant kind with no flat serialization, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a buffer cannot be grown.
+ */
+cardano_error_t
+cardano_uplc_int_flat_encode_program(
+  const cardano_uplc_program_t* program,
+  cardano_buffer_t**            out_flat);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_ENCODE_H */
diff --git a/vendor/src/uplc/flat/flat_reader.c b/vendor/src/uplc/flat/flat_reader.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/flat/flat_reader.c
@@ -0,0 +1,434 @@
+/**
+ * \file flat_reader.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "flat_reader.h"
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief Number of bits in a byte; the bit cursor wraps at this count.
+ */
+static const uint8_t FLAT_BITS_PER_BYTE = 8U;
+
+/**
+ * \brief Mask selecting the most significant bit of a byte, read first.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_MSB_MASK = 0x80U;
+
+/**
+ * \brief Number of payload bits carried by each continuation group of a word.
+ */
+static const uint8_t FLAT_WORD_GROUP_BITS = 7U;
+
+/**
+ * \brief Mask selecting the 7 payload bits of a word continuation group.
+ */
+static const uint8_t FLAT_WORD_PAYLOAD_MASK = 0x7FU;
+
+/**
+ * \brief Mask selecting the continuation flag (high bit) of a word group.
+ */
+static const uint8_t FLAT_WORD_CONTINUATION_MASK = 0x80U;
+
+/**
+ * \brief Initial capacity requested for the bytestring accumulator.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t FLAT_BYTES_INITIAL_CAPACITY = 64U;
+
+/* STATIC FUNCTIONS *********************************************************/
+
+/**
+ * \brief Applies the flat zig-zag decode to an unsigned magnitude in place.
+ *
+ * Maps the unsigned encoding back to its signed value: an even magnitude \c u
+ * decodes to <tt>u >> 1</tt>, an odd magnitude to <tt>-((u >> 1) + 1)</tt>. This
+ * is the <tt>(u >> 1) xor -(u and 1)</tt> transform over the bigint.
+ *
+ * \param[in,out] magnitude The unsigned magnitude, replaced by its signed value.
+ */
+static void
+decode_zigzag(cardano_bigint_t* magnitude)
+{
+  const bool is_odd = cardano_bigint_test_bit(magnitude, 0U);
+
+  cardano_bigint_shift_right(magnitude, 1U, magnitude);
+
+  if (is_odd)
+  {
+    cardano_bigint_negate(magnitude, magnitude);
+    cardano_bigint_decrement(magnitude);
+  }
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_flat_reader_init(cardano_uplc_flat_reader_t* reader, const byte_t* buffer, const size_t size)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((buffer == NULL) && (size != 0U))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  reader->buffer   = buffer;
+  reader->size     = size;
+  reader->byte_pos = 0U;
+  reader->bit_pos  = 0U;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_flat_reader_bit(cardano_uplc_flat_reader_t* reader, uint8_t* value)
+{
+  if ((reader == NULL) || (value == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader->byte_pos >= reader->size)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  const uint8_t selector = (uint8_t)(FLAT_MSB_MASK >> reader->bit_pos);
+
+  *value = ((reader->buffer[reader->byte_pos] & selector) != 0U) ? 1U : 0U;
+
+  if (reader->bit_pos == (FLAT_BITS_PER_BYTE - 1U))
+  {
+    reader->bit_pos  = 0U;
+    reader->byte_pos += 1U;
+  }
+  else
+  {
+    reader->bit_pos += 1U;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_flat_reader_bits8(cardano_uplc_flat_reader_t* reader, const uint8_t count, uint8_t* value)
+{
+  if ((reader == NULL) || (value == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (count > FLAT_BITS_PER_BYTE)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (count == 0U)
+  {
+    *value = 0U;
+    return CARDANO_SUCCESS;
+  }
+
+  if (reader->byte_pos >= reader->size)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  const uint8_t available = (uint8_t)(FLAT_BITS_PER_BYTE - reader->bit_pos);
+  uint8_t       result    = 0U;
+
+  if (count <= available)
+  {
+    const uint8_t shift = (uint8_t)(available - count);
+
+    result = (uint8_t)((reader->buffer[reader->byte_pos] >> shift) & (uint8_t)((1U << count) - 1U));
+
+    reader->bit_pos = (uint8_t)(reader->bit_pos + count);
+
+    if (reader->bit_pos == FLAT_BITS_PER_BYTE)
+    {
+      reader->bit_pos  = 0U;
+      reader->byte_pos += 1U;
+    }
+  }
+  else
+  {
+    if ((reader->byte_pos + 1U) >= reader->size)
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    const uint8_t from_second = (uint8_t)(count - available);
+    const uint8_t high        = (uint8_t)(reader->buffer[reader->byte_pos] & (uint8_t)((1U << available) - 1U));
+    const uint8_t low         = (uint8_t)(reader->buffer[reader->byte_pos + 1U] >> (FLAT_BITS_PER_BYTE - from_second));
+
+    result = (uint8_t)(((uint32_t)high << from_second) | low);
+
+    reader->byte_pos += 1U;
+    reader->bit_pos  = from_second;
+  }
+
+  *value = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_flat_reader_word(cardano_uplc_flat_reader_t* reader, size_t* value)
+{
+  if ((reader == NULL) || (value == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t size_t_bits = sizeof(size_t) * (size_t)FLAT_BITS_PER_BYTE;
+
+  size_t result = 0U;
+  size_t shift  = 0U;
+  bool   more   = true;
+
+  while (more)
+  {
+    uint8_t         group = 0U;
+    cardano_error_t error = cardano_uplc_flat_reader_bits8(reader, FLAT_BITS_PER_BYTE, &group);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    const uint8_t payload_bits = (uint8_t)(group & FLAT_WORD_PAYLOAD_MASK);
+    const size_t  payload      = (size_t)payload_bits;
+
+    if (shift >= size_t_bits)
+    {
+      if (payload != 0U)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+    }
+    else
+    {
+      if (payload > (SIZE_MAX >> shift))
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      result |= (payload << shift);
+      shift  += FLAT_WORD_GROUP_BITS;
+    }
+
+    more = (group & FLAT_WORD_CONTINUATION_MASK) != 0U;
+  }
+
+  *value = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_flat_reader_filler(cardano_uplc_flat_reader_t* reader)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  bool terminated = false;
+
+  while (!terminated)
+  {
+    uint8_t         bit   = 0U;
+    cardano_error_t error = cardano_uplc_flat_reader_bit(reader, &bit);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    terminated = (bit != 0U);
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_flat_reader_big_word(cardano_uplc_flat_reader_t* reader, cardano_bigint_t** value)
+{
+  if ((reader == NULL) || (value == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bigint_t* result = NULL;
+  cardano_error_t   error  = cardano_bigint_from_int(0, &result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  uint32_t shift = 0U;
+  bool     more  = true;
+
+  while (more)
+  {
+    uint8_t group = 0U;
+
+    error = cardano_uplc_flat_reader_bits8(reader, FLAT_BITS_PER_BYTE, &group);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_bigint_unref(&result);
+
+      return error;
+    }
+
+    const uint8_t payload = (uint8_t)(group & FLAT_WORD_PAYLOAD_MASK);
+
+    if (payload != 0U)
+    {
+      cardano_bigint_t* group_value = NULL;
+
+      error = cardano_bigint_from_unsigned_int((uint64_t)payload, &group_value);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        cardano_bigint_unref(&result);
+
+        return error;
+      }
+
+      cardano_bigint_shift_left(group_value, shift, group_value);
+      cardano_bigint_or(result, group_value, result);
+      cardano_bigint_unref(&group_value);
+    }
+
+    shift += FLAT_WORD_GROUP_BITS;
+    more  = (group & FLAT_WORD_CONTINUATION_MASK) != 0U;
+  }
+
+  *value = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_flat_reader_integer(cardano_uplc_flat_reader_t* reader, cardano_bigint_t** value)
+{
+  if ((reader == NULL) || (value == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bigint_t* magnitude = NULL;
+  cardano_error_t   error     = cardano_uplc_flat_reader_big_word(reader, &magnitude);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  decode_zigzag(magnitude);
+
+  *value = magnitude;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_flat_reader_bytes(cardano_uplc_flat_reader_t* reader, cardano_buffer_t** value)
+{
+  if ((reader == NULL) || (value == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t error = cardano_uplc_flat_reader_filler(reader);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_buffer_t* result = cardano_buffer_new(FLAT_BYTES_INITIAL_CAPACITY);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  bool done = false;
+
+  while (!done)
+  {
+    if (reader->byte_pos >= reader->size)
+    {
+      cardano_buffer_unref(&result);
+
+      return CARDANO_ERROR_DECODING;
+    }
+
+    const size_t block_len = (size_t)reader->buffer[reader->byte_pos];
+
+    reader->byte_pos += 1U;
+
+    if (block_len == 0U)
+    {
+      done = true;
+    }
+    else
+    {
+      if (block_len > (reader->size - reader->byte_pos))
+      {
+        cardano_buffer_unref(&result);
+
+        return CARDANO_ERROR_DECODING;
+      }
+
+      error = cardano_buffer_write(result, &reader->buffer[reader->byte_pos], block_len);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        cardano_buffer_unref(&result);
+
+        return error;
+      }
+
+      reader->byte_pos += block_len;
+    }
+  }
+
+  *value = result;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/flat/flat_reader.h b/vendor/src/uplc/flat/flat_reader.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/flat/flat_reader.h
@@ -0,0 +1,208 @@
+/**
+ * \file flat_reader.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_READER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_READER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/common/bigint.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief MSB-first bit reader over the flat serialization used for Plutus scripts.
+ *
+ * Flat is a big-endian bit stream: within each byte the most significant bit is
+ * consumed first. The reader tracks the current byte and how many bits of that
+ * byte have already been consumed. It does not own \c buffer; the caller keeps
+ * the backing bytes alive for the reader's lifetime.
+ */
+typedef struct cardano_uplc_flat_reader_t
+{
+    const byte_t* buffer;
+    size_t        size;
+    size_t        byte_pos;
+    uint8_t       bit_pos;
+} cardano_uplc_flat_reader_t;
+
+/**
+ * \brief Initializes a reader over \p buffer positioned at the first bit.
+ *
+ * Sets the cursor to byte 0, bit 0. The reader borrows \p buffer; the caller must
+ * keep those bytes valid while the reader is used. A NULL \p buffer is permitted
+ * only when \p size is 0, describing an empty stream.
+ *
+ * \param[out] reader The reader to initialize.
+ * \param[in] buffer The flat bytes to read from. May be NULL only if \p size is 0.
+ * \param[in] size The number of bytes in \p buffer.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p reader is NULL or if \p buffer is NULL while \p size is non-zero.
+ */
+cardano_error_t
+cardano_uplc_flat_reader_init(cardano_uplc_flat_reader_t* reader, const byte_t* buffer, size_t size);
+
+/**
+ * \brief Reads one bit, most significant bit of the current byte first.
+ *
+ * \param[in,out] reader The reader to advance by one bit.
+ * \param[out] value Set to 1 if the bit is set, 0 otherwise.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_DECODING if the stream is
+ *         exhausted.
+ */
+cardano_error_t
+cardano_uplc_flat_reader_bit(cardano_uplc_flat_reader_t* reader, uint8_t* value);
+
+/**
+ * \brief Reads \p count bits (0..8) most significant bit first into a byte.
+ *
+ * The bits are accumulated in stream order, so the first bit read becomes the most
+ * significant bit of the result. A \p count of 0 yields 0 and consumes nothing.
+ *
+ * \param[in,out] reader The reader to advance by \p count bits.
+ * \param[in] count The number of bits to read; must be at most 8.
+ * \param[out] value The assembled bits, right-aligned.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if \p count
+ *         exceeds 8, or \ref CARDANO_ERROR_DECODING if the stream is exhausted.
+ */
+cardano_error_t
+cardano_uplc_flat_reader_bits8(cardano_uplc_flat_reader_t* reader, uint8_t count, uint8_t* value);
+
+/**
+ * \brief Reads a natural number encoded as 7-bit little-endian continuation groups.
+ *
+ * Each byte contributes its low 7 bits to the result, least significant group
+ * first; the high bit signals that another group follows. A value whose groups
+ * would shift past the width of \c size_t is rejected rather than silently
+ * truncated.
+ *
+ * \param[in,out] reader The reader to advance past the encoded word.
+ * \param[out] value The decoded natural number.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_DECODING if the stream is
+ *         exhausted or the encoded value does not fit in \c size_t.
+ */
+cardano_error_t
+cardano_uplc_flat_reader_word(cardano_uplc_flat_reader_t* reader, size_t* value);
+
+/**
+ * \brief Consumes zero bits up to and including the next one bit (byte alignment).
+ *
+ * The flat format pads to a byte boundary with a run of zero bits terminated by a
+ * single one bit. This reads that run; it does not require the cursor to already be
+ * byte-aligned.
+ *
+ * \param[in,out] reader The reader to advance past the filler.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p reader is NULL, or \ref CARDANO_ERROR_DECODING if the stream ends
+ *         before a one bit is seen.
+ */
+cardano_error_t
+cardano_uplc_flat_reader_filler(cardano_uplc_flat_reader_t* reader);
+
+/**
+ * \brief Reads a flat bytestring into a newly allocated buffer.
+ *
+ * Byte-aligns via \ref cardano_uplc_flat_reader_filler, then reads length-prefixed
+ * blocks: a one-byte length in 1..255 followed by that many bytes, repeating, until
+ * a zero-length block terminates the sequence. The concatenated bytes are returned
+ * in \p value, which the caller releases with \ref cardano_buffer_unref. On any
+ * failure no buffer is handed back.
+ *
+ * \param[in,out] reader The reader to advance past the bytestring.
+ * \param[out] value On success, the assembled bytes; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         buffer cannot be grown, or \ref CARDANO_ERROR_DECODING if a block runs
+ *         past the end of the stream or the sequence is not terminated.
+ */
+cardano_error_t
+cardano_uplc_flat_reader_bytes(cardano_uplc_flat_reader_t* reader, cardano_buffer_t** value);
+
+/**
+ * \brief Reads a natural number of unbounded width as 7-bit little-endian groups.
+ *
+ * The same continuation scheme as \ref cardano_uplc_flat_reader_word. Each byte
+ * contributes its low 7 bits, least significant group first, and the high bit
+ * signals that another group follows. Unlike \ref cardano_uplc_flat_reader_word the
+ * magnitude is accumulated into a \ref cardano_bigint_t, so there is no width
+ * ceiling and the value is never rejected for being too large.
+ *
+ * On success \p value receives a newly created bigint that the caller owns and
+ * releases with \ref cardano_bigint_unref. On any failure no bigint is handed back
+ * and \p value is left untouched.
+ *
+ * \param[in,out] reader The reader to advance past the encoded magnitude.
+ * \param[out] value On success, the decoded magnitude; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         bigint cannot be created, or \ref CARDANO_ERROR_DECODING if the stream is
+ *         exhausted before the magnitude terminates.
+ */
+cardano_error_t
+cardano_uplc_flat_reader_big_word(cardano_uplc_flat_reader_t* reader, cardano_bigint_t** value);
+
+/**
+ * \brief Reads a signed arbitrary-precision integer (magnitude then zig-zag decode).
+ *
+ * Reads an unsigned magnitude with \ref cardano_uplc_flat_reader_big_word, then
+ * applies the zig-zag decode that maps the unsigned encoding back to a signed
+ * value: for unsigned \c u the result is <tt>(u >> 1)</tt> when \c u is even and
+ * <tt>-((u >> 1) + 1)</tt> when \c u is odd, i.e. <tt>(u >> 1) xor -(u and 1)</tt>
+ * over the bigint. A non-negative \c n encodes as \c 2n and a negative \c n as
+ * <tt>-2n - 1</tt>.
+ *
+ * On success \p value receives a newly created bigint that the caller owns and
+ * releases with \ref cardano_bigint_unref. On any failure no bigint is handed back
+ * and \p value is left untouched.
+ *
+ * \param[in,out] reader The reader to advance past the encoded integer.
+ * \param[out] value On success, the decoded signed integer; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a
+ *         bigint cannot be created, or \ref CARDANO_ERROR_DECODING if the stream is
+ *         exhausted before the magnitude terminates.
+ */
+cardano_error_t
+cardano_uplc_flat_reader_integer(cardano_uplc_flat_reader_t* reader, cardano_bigint_t** value);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_READER_H */
diff --git a/vendor/src/uplc/flat/flat_writer.c b/vendor/src/uplc/flat/flat_writer.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/flat/flat_writer.c
@@ -0,0 +1,433 @@
+/**
+ * \file flat_writer.c
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "flat_writer.h"
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief Number of bits in a byte; the bit cursor wraps at this count.
+ */
+static const uint8_t FLAT_BITS_PER_BYTE = 8U;
+
+/**
+ * \brief Mask selecting the most significant bit of a byte, written first.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_MSB_MASK = 0x80U;
+
+/**
+ * \brief Number of payload bits carried by each continuation group of a word.
+ */
+static const uint8_t FLAT_WORD_GROUP_BITS = 7U;
+
+/**
+ * \brief Mask selecting the 7 payload bits of a word continuation group.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint8_t FLAT_WORD_PAYLOAD_MASK = 0x7FU;
+
+/**
+ * \brief Continuation flag (high bit) set on a non-final word group.
+ */
+static const uint8_t FLAT_WORD_CONTINUATION = 0x80U;
+
+/**
+ * \brief Largest length a single flat bytestring block can carry.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t FLAT_BYTES_MAX_BLOCK = 255U;
+
+/**
+ * \brief Initial capacity requested for the writer's backing buffer.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const size_t FLAT_WRITER_INITIAL_CAPACITY = 64U;
+
+/* STATIC FUNCTIONS *********************************************************/
+
+/**
+ * \brief Applies the flat zig-zag encode to a signed value into a new magnitude.
+ *
+ * Maps a non-negative \c n to <tt>2n</tt> and a negative \c n to <tt>-2n - 1</tt>,
+ * the inverse of \c decode_zigzag in flat_reader.c.
+ *
+ * \param[in] value The signed value to encode. Must not be NULL.
+ * \param[out] magnitude On success, a newly created non-negative magnitude the
+ *             caller releases with \ref cardano_bigint_unref; left untouched on
+ *             failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *         if the magnitude cannot be created.
+ */
+static cardano_error_t
+encode_zigzag(const cardano_bigint_t* value, cardano_bigint_t** magnitude)
+{
+  cardano_bigint_t* result = NULL;
+  cardano_error_t   error  = cardano_bigint_clone(value, &result);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_bigint_shift_left(result, 1U, result);
+
+  if (cardano_bigint_signum(value) < 0)
+  {
+    cardano_bigint_negate(result, result);
+    cardano_bigint_decrement(result);
+  }
+
+  *magnitude = result;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Appends a fully assembled byte to the writer's backing buffer.
+ *
+ * \param[in,out] writer The writer whose buffer receives \p value.
+ * \param[in] value The byte to append.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *         if the buffer cannot be grown.
+ */
+static cardano_error_t
+push_byte(cardano_uplc_flat_writer_t* writer, const uint8_t value)
+{
+  return cardano_buffer_write(writer->buffer, &value, 1U);
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_flat_writer_init(cardano_uplc_flat_writer_t* writer)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  writer->buffer  = cardano_buffer_new(FLAT_WRITER_INITIAL_CAPACITY);
+  writer->current = 0U;
+  writer->used    = 0U;
+
+  if (writer->buffer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_uplc_flat_writer_dispose(cardano_uplc_flat_writer_t* writer)
+{
+  if (writer == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&writer->buffer);
+  writer->current = 0U;
+  writer->used    = 0U;
+}
+
+cardano_error_t
+cardano_uplc_flat_writer_bit(cardano_uplc_flat_writer_t* writer, const uint8_t value)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value != 0U)
+  {
+    writer->current = (uint8_t)(writer->current | (uint8_t)(FLAT_MSB_MASK >> writer->used));
+  }
+
+  if (writer->used == (FLAT_BITS_PER_BYTE - 1U))
+  {
+    result = push_byte(writer, writer->current);
+
+    writer->current = 0U;
+    writer->used    = 0U;
+  }
+  else
+  {
+    writer->used += 1U;
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_uplc_flat_writer_bits8(cardano_uplc_flat_writer_t* writer, const uint8_t value, const uint8_t count)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (count > FLAT_BITS_PER_BYTE)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  for (uint8_t i = 0U; i < count; ++i)
+  {
+    const uint8_t   shift = (uint8_t)(count - 1U - i);
+    const uint8_t   bit   = (uint8_t)((value >> shift) & 1U);
+    cardano_error_t error = cardano_uplc_flat_writer_bit(writer, bit);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_flat_writer_word(cardano_uplc_flat_writer_t* writer, const size_t value)
+{
+  size_t remaining = value;
+  bool   more      = true;
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  while (more)
+  {
+    uint8_t         group = (uint8_t)(remaining & (size_t)FLAT_WORD_PAYLOAD_MASK);
+    cardano_error_t error = CARDANO_SUCCESS;
+
+    remaining >>= FLAT_WORD_GROUP_BITS;
+
+    if (remaining != 0U)
+    {
+      group = (uint8_t)(group | FLAT_WORD_CONTINUATION);
+    }
+    else
+    {
+      more = false;
+    }
+
+    error = cardano_uplc_flat_writer_bits8(writer, group, FLAT_BITS_PER_BYTE);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_flat_writer_big_word(cardano_uplc_flat_writer_t* writer, const cardano_bigint_t* magnitude)
+{
+  cardano_bigint_t* temp   = NULL;
+  cardano_error_t   result = CARDANO_SUCCESS;
+  bool              more   = true;
+
+  if ((writer == NULL) || (magnitude == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_bigint_clone(magnitude, &temp);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  while (more)
+  {
+    uint8_t group = 0U;
+
+    for (uint8_t i = 0U; i < FLAT_WORD_GROUP_BITS; ++i)
+    {
+      if (cardano_bigint_test_bit(temp, i))
+      {
+        group = (uint8_t)(group | (uint8_t)(1U << i));
+      }
+    }
+
+    cardano_bigint_shift_right(temp, FLAT_WORD_GROUP_BITS, temp);
+
+    if (!cardano_bigint_is_zero(temp))
+    {
+      group = (uint8_t)(group | FLAT_WORD_CONTINUATION);
+    }
+    else
+    {
+      more = false;
+    }
+
+    result = cardano_uplc_flat_writer_bits8(writer, group, FLAT_BITS_PER_BYTE);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_bigint_unref(&temp);
+
+      return result;
+    }
+  }
+
+  cardano_bigint_unref(&temp);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_flat_writer_integer(cardano_uplc_flat_writer_t* writer, const cardano_bigint_t* value)
+{
+  cardano_bigint_t* magnitude = NULL;
+  cardano_error_t   result    = CARDANO_SUCCESS;
+
+  if ((writer == NULL) || (value == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = encode_zigzag(value, &magnitude);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_uplc_flat_writer_big_word(writer, magnitude);
+
+  cardano_bigint_unref(&magnitude);
+
+  return result;
+}
+
+cardano_error_t
+cardano_uplc_flat_writer_filler(cardano_uplc_flat_writer_t* writer)
+{
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  while (writer->used != (FLAT_BITS_PER_BYTE - 1U))
+  {
+    cardano_error_t error = cardano_uplc_flat_writer_bit(writer, 0U);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  return cardano_uplc_flat_writer_bit(writer, 1U);
+}
+
+cardano_error_t
+cardano_uplc_flat_writer_bytes(cardano_uplc_flat_writer_t* writer, const byte_t* data, const size_t size)
+{
+  size_t          offset = 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((data == NULL) && (size != 0U))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_uplc_flat_writer_filler(writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  while (offset < size)
+  {
+    const size_t remaining = size - offset;
+    const size_t block_len = (remaining > FLAT_BYTES_MAX_BLOCK) ? FLAT_BYTES_MAX_BLOCK : remaining;
+
+    result = push_byte(writer, (uint8_t)block_len);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_buffer_write(writer->buffer, &data[offset], block_len);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    offset += block_len;
+  }
+
+  return push_byte(writer, 0U);
+}
+
+cardano_error_t
+cardano_uplc_flat_writer_finish(cardano_uplc_flat_writer_t* writer, cardano_buffer_t** out)
+{
+  if ((writer == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer->used != 0U)
+  {
+    cardano_error_t result = push_byte(writer, writer->current);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    writer->current = 0U;
+    writer->used    = 0U;
+  }
+
+  *out           = writer->buffer;
+  writer->buffer = NULL;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/flat/flat_writer.h b/vendor/src/uplc/flat/flat_writer.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/flat/flat_writer.h
@@ -0,0 +1,216 @@
+/**
+ * \file flat_writer.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_WRITER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_WRITER_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/buffer.h>
+#include <cardano/common/bigint.h>
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief MSB-first bit writer over the flat serialization used for Plutus scripts.
+ *
+ * The exact inverse of \ref cardano_uplc_flat_reader_t. Bits are laid down most
+ * significant first within each byte. Whole bytes are accumulated in \c buffer
+ * as they fill, while \c current and \c used hold the partial trailing byte
+ * that has not yet been flushed. The writer owns \c buffer; the caller releases
+ * the finished bytes with \ref cardano_uplc_flat_writer_finish.
+ */
+typedef struct cardano_uplc_flat_writer_t
+{
+    cardano_buffer_t* buffer;
+    uint8_t           current;
+    uint8_t           used;
+} cardano_uplc_flat_writer_t;
+
+/**
+ * \brief Initializes a writer with an empty, freshly allocated byte buffer.
+ *
+ * \param[out] writer The writer to initialize.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p writer is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the
+ *         backing buffer cannot be created.
+ */
+cardano_error_t
+cardano_uplc_flat_writer_init(cardano_uplc_flat_writer_t* writer);
+
+/**
+ * \brief Releases the writer's backing buffer if it still owns one.
+ *
+ * Idempotent: a writer whose buffer was already taken by
+ * \ref cardano_uplc_flat_writer_finish is left unchanged. After this call the
+ * writer must not be used again without re-initialization.
+ *
+ * \param[in,out] writer The writer to dispose. A NULL \p writer is a no-op.
+ */
+void
+cardano_uplc_flat_writer_dispose(cardano_uplc_flat_writer_t* writer);
+
+/**
+ * \brief Writes one bit, most significant bit of the current byte first.
+ *
+ * \param[in,out] writer The writer to append the bit to.
+ * \param[in] value The bit; any non-zero value writes a one.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p writer is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a
+ *         completed byte cannot be appended.
+ */
+cardano_error_t
+cardano_uplc_flat_writer_bit(cardano_uplc_flat_writer_t* writer, uint8_t value);
+
+/**
+ * \brief Writes the low \p count bits (0..8) of \p value, most significant first.
+ *
+ * The inverse of \ref cardano_uplc_flat_reader_bits8. Bit <tt>count - 1</tt> of
+ * \p value is written first and bit 0 last. A \p count of 0 writes nothing.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] value The bits to write, taken from the low \p count positions.
+ * \param[in] count The number of bits to write; must be at most 8.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p writer is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if \p count
+ *         exceeds 8, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED on a failed
+ *         byte append.
+ */
+cardano_error_t
+cardano_uplc_flat_writer_bits8(cardano_uplc_flat_writer_t* writer, uint8_t value, uint8_t count);
+
+/**
+ * \brief Writes a natural number as 7-bit little-endian continuation groups.
+ *
+ * The inverse of \ref cardano_uplc_flat_reader_word. The low 7 bits are emitted
+ * first, each group carrying a high continuation bit while more groups remain and
+ * a clear high bit on the final group.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] value The natural number to write.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p writer is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED on a
+ *         failed byte append.
+ */
+cardano_error_t
+cardano_uplc_flat_writer_word(cardano_uplc_flat_writer_t* writer, size_t value);
+
+/**
+ * \brief Writes a non-negative magnitude as 7-bit little-endian groups.
+ *
+ * The inverse of \ref cardano_uplc_flat_reader_big_word for unbounded magnitudes:
+ * the low 7 bits are emitted first, each non-final group carrying a high
+ * continuation bit. A zero magnitude writes one zero group.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] magnitude The non-negative magnitude to write. Must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a
+ *         byte append or an interior bigint cannot be allocated.
+ */
+cardano_error_t
+cardano_uplc_flat_writer_big_word(cardano_uplc_flat_writer_t* writer, const cardano_bigint_t* magnitude);
+
+/**
+ * \brief Writes a signed arbitrary-precision integer (zig-zag then big word).
+ *
+ * The inverse of \ref cardano_uplc_flat_reader_integer. The zig-zag transform maps
+ * a non-negative \c n to <tt>2n</tt> and a negative \c n to <tt>-2n - 1</tt>, and
+ * the resulting non-negative magnitude is written with
+ * \ref cardano_uplc_flat_writer_big_word.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] value The signed integer to write. Must not be NULL.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if a
+ *         byte append or an interior bigint cannot be allocated.
+ */
+cardano_error_t
+cardano_uplc_flat_writer_integer(cardano_uplc_flat_writer_t* writer, const cardano_bigint_t* value);
+
+/**
+ * \brief Writes filler that pads to a byte boundary with a terminating one bit.
+ *
+ * The inverse of \ref cardano_uplc_flat_reader_filler. Zero bits are written until
+ * one more bit would land on a byte boundary, then a single one bit closes the
+ * run. An already byte-aligned cursor emits a whole <tt>0x01</tt> byte.
+ *
+ * \param[in,out] writer The writer to append to.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p writer is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED on a
+ *         failed byte append.
+ */
+cardano_error_t
+cardano_uplc_flat_writer_filler(cardano_uplc_flat_writer_t* writer);
+
+/**
+ * \brief Writes a flat bytestring: byte-align, then length-prefixed blocks.
+ *
+ * The inverse of \ref cardano_uplc_flat_reader_bytes. A \ref cardano_uplc_flat_writer_filler
+ * byte-aligns the stream, then the data is emitted in blocks each prefixed by a
+ * one-byte length in 1..255, and a terminating zero-length block ends the sequence.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] data The bytes to write. May be NULL only when \p size is 0.
+ * \param[in] size The number of bytes in \p data.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p writer is NULL or \p data is NULL while \p size is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED on a failed byte append.
+ */
+cardano_error_t
+cardano_uplc_flat_writer_bytes(cardano_uplc_flat_writer_t* writer, const byte_t* data, size_t size);
+
+/**
+ * \brief Finalizes the stream and hands the accumulated bytes to the caller.
+ *
+ * Any partial trailing byte is flushed and the backing buffer ownership is
+ * transferred to \p out, which the caller releases with \ref cardano_buffer_unref.
+ * After this call the writer no longer owns a buffer; dispose is a no-op.
+ *
+ * \param[in,out] writer The writer to finalize.
+ * \param[out] out On success, the assembled bytes; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED on a
+ *         failed flush of the trailing byte.
+ */
+cardano_error_t
+cardano_uplc_flat_writer_finish(cardano_uplc_flat_writer_t* writer, cardano_buffer_t** out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_FLAT_FLAT_WRITER_H */
diff --git a/vendor/src/uplc/machine/uplc_budget.h b/vendor/src/uplc/machine/uplc_budget.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_budget.h
@@ -0,0 +1,55 @@
+/**
+ * \file uplc_budget.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_BUDGET_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_BUDGET_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief A CPU and memory budget for evaluation.
+ *
+ * Both components are signed 64-bit and are allowed to go negative: a charge that
+ * drives either below zero is how the machine detects an exhausted script. A
+ * budget passed to \ref cardano_uplc_evaluate is the ceiling the script may
+ * consume; the spent budget reported back is how much was actually charged.
+ */
+typedef struct cardano_uplc_budget_t
+{
+    /** \brief CPU units. */
+    int64_t cpu;
+    /** \brief Memory units. */
+    int64_t mem;
+} cardano_uplc_budget_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_BUDGET_H */
diff --git a/vendor/src/uplc/machine/uplc_env.c b/vendor/src/uplc/machine/uplc_env.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_env.c
@@ -0,0 +1,126 @@
+/**
+ * \file uplc_env.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_env.h"
+
+#include "../arena/uplc_arena.h"
+
+#include <stddef.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Allocates an environment chunk from the arena.
+ *
+ * \param[in] arena The arena to allocate from.
+ *
+ * \return The new chunk, or NULL if the arena cannot serve the node.
+ */
+static cardano_uplc_env_t*
+alloc_env(cardano_uplc_arena_t* arena)
+{
+  return (cardano_uplc_env_t*)cardano_uplc_arena_alloc(arena, sizeof(cardano_uplc_env_t), 0U);
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_env_extend(
+  cardano_uplc_arena_t*       arena,
+  const cardano_uplc_env_t*   env,
+  const cardano_uplc_value_t* value,
+  const cardano_uplc_env_t**  out)
+{
+  cardano_uplc_env_t* result = NULL;
+
+  if ((arena == NULL) || (value == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_env(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  if ((env == NULL) || (env->count >= CARDANO_UPLC_ENV_CHUNK_SLOTS))
+  {
+    result->count    = (size_t)1;
+    result->next     = env;
+    result->slots[0] = value;
+  }
+  else
+  {
+    size_t i = (size_t)0;
+
+    for (i = (size_t)0; i < env->count; ++i)
+    {
+      result->slots[i] = env->slots[i];
+    }
+
+    result->slots[env->count] = value;
+    result->count             = env->count + (size_t)1;
+    result->next              = env->next;
+  }
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_env_lookup(
+  const cardano_uplc_env_t*    env,
+  uint64_t                     index,
+  const cardano_uplc_value_t** out)
+{
+  const cardano_uplc_env_t* current   = env;
+  uint64_t                  remaining = index;
+
+  if (out == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (index == 0U)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  while (current != NULL)
+  {
+    if (remaining <= (uint64_t)current->count)
+    {
+      *out = current->slots[current->count - (size_t)remaining];
+
+      return CARDANO_SUCCESS;
+    }
+
+    remaining -= (uint64_t)current->count;
+    current   = current->next;
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
diff --git a/vendor/src/uplc/machine/uplc_env.h b/vendor/src/uplc/machine/uplc_env.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_env.h
@@ -0,0 +1,128 @@
+/**
+ * \file uplc_env.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_ENV_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_ENV_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_value.h"
+
+#include "../arena/uplc_arena.h"
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Number of value slots per environment chunk.
+ *
+ * Eight slots keep a chunk at 80 bytes while dividing the pointer chase of a
+ * deep de Bruijn lookup by eight relative to a plain cons list. Measured on the
+ * plutus_use_cases corpus, eight outperforms both four and sixteen slots.
+ */
+#define CARDANO_UPLC_ENV_CHUNK_SLOTS 8U
+
+/**
+ * \brief One chunk of the de Bruijn environment.
+ *
+ * The environment is a persistent chunked list: each chunk packs up to
+ * \ref CARDANO_UPLC_ENV_CHUNK_SLOTS bound values, newest last, in front of a
+ * chain of full enclosing chunks. Lookup is by 1-based de Bruijn index: index 1
+ * is the newest slot of the head chunk (the innermost binder) and deeper
+ * indices step through the slots and then hop chunks, so a lookup at depth
+ * \c d chases about \c d / \ref CARDANO_UPLC_ENV_CHUNK_SLOTS pointers rather
+ * than \c d. Chunks are arena-allocated and immutable; extension copies the
+ * head chunk's slots into a fresh chunk (or starts a new chunk when the head
+ * is full) and shares the enclosing chain, so every tail chunk is always full.
+ */
+struct cardano_uplc_env_t
+{
+    /** \brief Number of occupied slots, 1 to \ref CARDANO_UPLC_ENV_CHUNK_SLOTS. */
+    size_t count;
+    /** \brief The enclosing chain of full chunks, or NULL at the outermost chunk. */
+    const cardano_uplc_env_t* next;
+    /** \brief The bound values, oldest first; \c slots[count - 1] is de Bruijn index 1. */
+    const cardano_uplc_value_t* slots[CARDANO_UPLC_ENV_CHUNK_SLOTS];
+};
+
+/**
+ * \brief Extends an environment with a value at a fresh de Bruijn level.
+ *
+ * Allocates a new head chunk from \p arena that binds \p value at de Bruijn
+ * index 1: when \p env has room in its head chunk the existing slots are copied
+ * in front of the enclosing chain, and when it is full (or \p env is NULL) a
+ * fresh one-slot chunk is started with \p env as the enclosing chain. The
+ * enclosing chunks are shared, never copied, so the previous environment value
+ * remains valid and unchanged.
+ *
+ * \param[in] arena The arena to allocate the chunk from. Must not be NULL.
+ * \param[in] env The environment to extend, or NULL for the empty environment.
+ * \param[in] value The value to bind at the new head. Must not be NULL and must
+ *            live in \p arena.
+ * \param[out] out On success, set to the new environment head; left untouched on
+ *             failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p value, or \p out is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the cell.
+ */
+cardano_error_t
+cardano_uplc_env_extend(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_env_t*    env,
+  const cardano_uplc_value_t*  value,
+  const cardano_uplc_env_t**   out);
+
+/**
+ * \brief Looks a value up in an environment by 1-based de Bruijn index.
+ *
+ * Walks \p env starting at the head: index 1 returns the head value, index 2 the
+ * next, and so on. Index 0 is not a valid de Bruijn index and is reported as not
+ * found, as is any index that walks off the end of the list (including a lookup
+ * in the empty environment).
+ *
+ * \param[in] env The environment to search, or NULL for the empty environment.
+ * \param[in] index The 1-based de Bruijn index to resolve.
+ * \param[out] out On success, set to the bound value; left untouched when the
+ *             index is not found or \p out is NULL.
+ *
+ * \return \ref CARDANO_SUCCESS when the index resolves to a value,
+ *         \ref CARDANO_ERROR_POINTER_IS_NULL if \p out is NULL, or
+ *         \ref CARDANO_ERROR_ELEMENT_NOT_FOUND when \p index is 0 or out of
+ *         range for \p env.
+ */
+cardano_error_t
+cardano_uplc_env_lookup(
+  const cardano_uplc_env_t*    env,
+  uint64_t                     index,
+  const cardano_uplc_value_t** out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_ENV_H */
diff --git a/vendor/src/uplc/machine/uplc_eval_result.h b/vendor/src/uplc/machine/uplc_eval_result.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_eval_result.h
@@ -0,0 +1,62 @@
+/**
+ * \file uplc_eval_result.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_EVAL_RESULT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_EVAL_RESULT_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_term.h"
+#include "uplc_budget.h"
+#include "uplc_eval_status.h"
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The result of a successful host call to \ref cardano_uplc_evaluate.
+ *
+ * The \c status names the script outcome. \c spent is the budget the evaluation
+ * consumed (the initial budget minus what remained), reported on every outcome
+ * including failure and exhaustion. \c result is the discharged result term on
+ * \ref CARDANO_UPLC_EVAL_SUCCESS and NULL on every other outcome; it is allocated
+ * in the arena the caller passed to \ref cardano_uplc_evaluate and stays valid as
+ * long as that arena is alive.
+ */
+typedef struct cardano_uplc_eval_result_t
+{
+    /** \brief The script outcome. */
+    cardano_uplc_eval_status_t status;
+    /** \brief The budget consumed by the evaluation. */
+    cardano_uplc_budget_t spent;
+    /** \brief The discharged result term on success, NULL otherwise. */
+    const cardano_uplc_term_t* result;
+} cardano_uplc_eval_result_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_EVAL_RESULT_H */
diff --git a/vendor/src/uplc/machine/uplc_eval_status.h b/vendor/src/uplc/machine/uplc_eval_status.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_eval_status.h
@@ -0,0 +1,73 @@
+/**
+ * \file uplc_eval_status.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_EVAL_STATUS_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_EVAL_STATUS_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The outcome of an evaluation that the host successfully ran.
+ *
+ * These three values describe what the script did, not whether the host could
+ * run it: a host failure (null argument, allocation failure) is reported through
+ * the \ref cardano_error_t return of \ref cardano_uplc_evaluate, while a script
+ * that reaches the error term or exhausts its budget is a successful host call
+ * that reports its outcome here.
+ */
+typedef enum
+{
+  /** \brief The machine reached Done; \c result holds the discharged term. */
+  CARDANO_UPLC_EVAL_SUCCESS = 0,
+  /**
+   * \brief The script failed: it reached the error term, applied a non-function,
+   *        looked up an out-of-range variable, matched a missing case branch, or
+   *        reached an unimplemented builtin. \c result is NULL.
+   */
+  CARDANO_UPLC_EVAL_ERROR_TERM = 1,
+  /** \brief The script exhausted its CPU or memory budget. \c result is NULL. */
+  CARDANO_UPLC_EVAL_OUT_OF_BUDGET = 2,
+  /**
+   * \brief A saturated builtin this VM build does not implement yet was reached.
+   *        \c result is NULL.
+   *
+   * This is NOT a script failure and NOT a \ref cardano_error_t host failure: it
+   * means the VM build does not run that builtin yet, distinct from
+   * \ref CARDANO_UPLC_EVAL_ERROR_TERM (the script genuinely failed). The
+   * conformance runner uses it to skip exactly the cases that hit an
+   * unimplemented builtin.
+   */
+  CARDANO_UPLC_EVAL_UNSUPPORTED_BUILTIN = 3
+} cardano_uplc_eval_status_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_EVAL_STATUS_H */
diff --git a/vendor/src/uplc/machine/uplc_frame.c b/vendor/src/uplc/machine/uplc_frame.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_frame.c
@@ -0,0 +1,275 @@
+/**
+ * \file uplc_frame.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_frame.h"
+
+#include "../arena/uplc_arena.h"
+
+#include <stddef.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Allocates a zero-initialized frame from the arena.
+ *
+ * \param[in] arena The arena to allocate from.
+ *
+ * \return The new frame, or NULL if the arena cannot serve the node.
+ */
+static cardano_uplc_frame_t*
+alloc_frame(cardano_uplc_arena_t* arena)
+{
+  return (cardano_uplc_frame_t*)cardano_uplc_arena_alloc(arena, sizeof(cardano_uplc_frame_t), 0U);
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_frame_new_no_frame(
+  cardano_uplc_arena_t*  arena,
+  cardano_uplc_frame_t** out)
+{
+  cardano_uplc_frame_t* result = NULL;
+
+  if ((arena == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_frame(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind = CARDANO_UPLC_FRAME_NO_FRAME;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_frame_new_await_arg(
+  cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* value,
+  const cardano_uplc_frame_t* ctx,
+  cardano_uplc_frame_t**      out)
+{
+  cardano_uplc_frame_t* result = NULL;
+
+  if ((arena == NULL) || (value == NULL) || (ctx == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_frame(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind               = CARDANO_UPLC_FRAME_AWAIT_ARG;
+  result->as.await_arg.value = value;
+  result->as.await_arg.ctx   = ctx;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_frame_new_await_fun_term(
+  cardano_uplc_arena_t*       arena,
+  const cardano_uplc_env_t*   env,
+  const cardano_uplc_term_t*  term,
+  const cardano_uplc_frame_t* ctx,
+  cardano_uplc_frame_t**      out)
+{
+  cardano_uplc_frame_t* result = NULL;
+
+  if ((arena == NULL) || (term == NULL) || (ctx == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_frame(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                   = CARDANO_UPLC_FRAME_AWAIT_FUN_TERM;
+  result->as.await_fun_term.env  = env;
+  result->as.await_fun_term.term = term;
+  result->as.await_fun_term.ctx  = ctx;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_frame_new_await_fun_value(
+  cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* value,
+  const cardano_uplc_frame_t* ctx,
+  cardano_uplc_frame_t**      out)
+{
+  cardano_uplc_frame_t* result = NULL;
+
+  if ((arena == NULL) || (value == NULL) || (ctx == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_frame(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                     = CARDANO_UPLC_FRAME_AWAIT_FUN_VALUE;
+  result->as.await_fun_value.value = value;
+  result->as.await_fun_value.ctx   = ctx;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_frame_new_force(
+  cardano_uplc_arena_t*       arena,
+  const cardano_uplc_frame_t* ctx,
+  cardano_uplc_frame_t**      out)
+{
+  cardano_uplc_frame_t* result = NULL;
+
+  if ((arena == NULL) || (ctx == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_frame(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind         = CARDANO_UPLC_FRAME_FORCE;
+  result->as.force.ctx = ctx;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_frame_new_constr(
+  cardano_uplc_arena_t*              arena,
+  const cardano_uplc_env_t*          env,
+  uint64_t                           tag,
+  const cardano_uplc_term_t* const*  fields,
+  size_t                             field_count,
+  const cardano_uplc_value_t* const* resolved,
+  size_t                             resolved_count,
+  const cardano_uplc_frame_t*        ctx,
+  cardano_uplc_frame_t**             out)
+{
+  cardano_uplc_frame_t* result = NULL;
+
+  if ((arena == NULL) || (ctx == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (((fields == NULL) && (field_count != 0U)) || ((resolved == NULL) && (resolved_count != 0U)))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = alloc_frame(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                     = CARDANO_UPLC_FRAME_CONSTR;
+  result->as.constr.env            = env;
+  result->as.constr.tag            = tag;
+  result->as.constr.fields         = fields;
+  result->as.constr.field_count    = field_count;
+  result->as.constr.resolved       = resolved;
+  result->as.constr.resolved_count = resolved_count;
+  result->as.constr.ctx            = ctx;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_frame_new_cases(
+  cardano_uplc_arena_t*             arena,
+  const cardano_uplc_env_t*         env,
+  const cardano_uplc_term_t* const* branches,
+  size_t                            branch_count,
+  const cardano_uplc_frame_t*       ctx,
+  cardano_uplc_frame_t**            out)
+{
+  cardano_uplc_frame_t* result = NULL;
+
+  if ((arena == NULL) || (ctx == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((branches == NULL) && (branch_count != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = alloc_frame(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                  = CARDANO_UPLC_FRAME_CASES;
+  result->as.cases.env          = env;
+  result->as.cases.branches     = branches;
+  result->as.cases.branch_count = branch_count;
+  result->as.cases.ctx          = ctx;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/machine/uplc_frame.h b/vendor/src/uplc/machine/uplc_frame.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_frame.h
@@ -0,0 +1,277 @@
+/**
+ * \file uplc_frame.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_FRAME_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_FRAME_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_env.h"
+#include "uplc_frame_kind.h"
+#include "uplc_value.h"
+
+#include "../arena/uplc_arena.h"
+#include "../ast/uplc_term.h"
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct cardano_uplc_frame_t cardano_uplc_frame_t;
+
+/**
+ * \brief An immutable CEK continuation frame, tagged by its frame kind.
+ *
+ * Frames form the continuation chain: every non-empty frame holds a \c ctx
+ * pointing at the enclosing frame, terminating at a \ref CARDANO_UPLC_FRAME_NO_FRAME
+ * frame whose \c ctx is NULL. The \c kind selects the active arm; never read an
+ * arm the kind does not select. Frames are arena-allocated and immutable.
+ */
+struct cardano_uplc_frame_t
+{
+    cardano_uplc_frame_kind_t kind;
+
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        struct
+        {
+            const cardano_uplc_value_t* value;
+            const cardano_uplc_frame_t* ctx;
+        } await_arg;
+
+        struct
+        {
+            const cardano_uplc_env_t*   env;
+            const cardano_uplc_term_t*  term;
+            const cardano_uplc_frame_t* ctx;
+        } await_fun_term;
+
+        struct
+        {
+            const cardano_uplc_value_t* value;
+            const cardano_uplc_frame_t* ctx;
+        } await_fun_value;
+
+        struct
+        {
+            const cardano_uplc_frame_t* ctx;
+        } force;
+
+        struct
+        {
+            const cardano_uplc_env_t*          env;
+            uint64_t                           tag;
+            const cardano_uplc_term_t* const*  fields;
+            size_t                             field_count;
+            const cardano_uplc_value_t* const* resolved;
+            size_t                             resolved_count;
+            const cardano_uplc_frame_t*        ctx;
+        } constr;
+
+        struct
+        {
+            const cardano_uplc_env_t*         env;
+            const cardano_uplc_term_t* const* branches;
+            size_t                            branch_count;
+            const cardano_uplc_frame_t*       ctx;
+        } cases;
+
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } as;
+};
+
+/**
+ * \brief Builds the empty continuation frame.
+ *
+ * Returning a value into this frame ends evaluation. Its \c ctx is NULL.
+ *
+ * \param[in] arena The arena to allocate the frame from. Must not be NULL.
+ * \param[out] out On success, set to the new frame; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p out is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_frame_new_no_frame(
+  struct cardano_uplc_arena_t* arena,
+  cardano_uplc_frame_t**       out);
+
+/**
+ * \brief Builds an await-argument frame holding a function value.
+ *
+ * \param[in] arena The arena to allocate the frame from. Must not be NULL.
+ * \param[in] value The function value to apply once the argument is computed.
+ *            Must not be NULL and must live in \p arena.
+ * \param[in] ctx The enclosing frame. Must not be NULL and must live in \p arena.
+ * \param[out] out On success, set to the new frame; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_frame_new_await_arg(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_value_t*  value,
+  const cardano_uplc_frame_t*  ctx,
+  cardano_uplc_frame_t**       out);
+
+/**
+ * \brief Builds an await-function-term frame holding the argument term and env.
+ *
+ * \param[in] arena The arena to allocate the frame from. Must not be NULL.
+ * \param[in] env The environment the argument term is computed in, or NULL for
+ *            the empty environment.
+ * \param[in] term The argument term still to be computed. Must not be NULL and
+ *            must live in \p arena.
+ * \param[in] ctx The enclosing frame. Must not be NULL and must live in \p arena.
+ * \param[out] out On success, set to the new frame; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p term, \p ctx, or \p out is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_frame_new_await_fun_term(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_env_t*    env,
+  const cardano_uplc_term_t*   term,
+  const cardano_uplc_frame_t*  ctx,
+  cardano_uplc_frame_t**       out);
+
+/**
+ * \brief Builds an await-function-value frame holding an argument value.
+ *
+ * \param[in] arena The arena to allocate the frame from. Must not be NULL.
+ * \param[in] value The argument value held while the function is computed. Must
+ *            not be NULL and must live in \p arena.
+ * \param[in] ctx The enclosing frame. Must not be NULL and must live in \p arena.
+ * \param[out] out On success, set to the new frame; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_frame_new_await_fun_value(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_value_t*  value,
+  const cardano_uplc_frame_t*  ctx,
+  cardano_uplc_frame_t**       out);
+
+/**
+ * \brief Builds a force frame.
+ *
+ * \param[in] arena The arena to allocate the frame from. Must not be NULL.
+ * \param[in] ctx The enclosing frame. Must not be NULL and must live in \p arena.
+ * \param[out] out On success, set to the new frame; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p ctx, or \p out is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_frame_new_force(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_frame_t*  ctx,
+  cardano_uplc_frame_t**       out);
+
+/**
+ * \brief Builds a constructor frame for evaluating fields one at a time.
+ *
+ * \p fields is the list of field terms still to be computed and \p resolved is
+ * the list of field values computed so far; both arrays and the nodes they point
+ * at must live in \p arena. Either may be empty (count 0 with a NULL array).
+ *
+ * \param[in] arena The arena to allocate the frame from. Must not be NULL.
+ * \param[in] env The environment the remaining field terms are computed in, or
+ *            NULL for the empty environment.
+ * \param[in] tag The constructor tag being built.
+ * \param[in] fields The field terms still to compute, or NULL when
+ *            \p field_count is 0.
+ * \param[in] field_count The number of remaining field terms.
+ * \param[in] resolved The field values resolved so far, or NULL when
+ *            \p resolved_count is 0.
+ * \param[in] resolved_count The number of resolved field values.
+ * \param[in] ctx The enclosing frame. Must not be NULL and must live in \p arena.
+ * \param[out] out On success, set to the new frame; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p ctx, or \p out is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if a count is non-zero while its array is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_frame_new_constr(
+  struct cardano_uplc_arena_t*       arena,
+  const cardano_uplc_env_t*          env,
+  uint64_t                           tag,
+  const cardano_uplc_term_t* const*  fields,
+  size_t                             field_count,
+  const cardano_uplc_value_t* const* resolved,
+  size_t                             resolved_count,
+  const cardano_uplc_frame_t*        ctx,
+  cardano_uplc_frame_t**             out);
+
+/**
+ * \brief Builds a cases frame holding the case branches.
+ *
+ * The \p branches array and the terms it points at must live in \p arena. A case
+ * with no branches is allowed with \p branch_count 0 and \p branches NULL.
+ *
+ * \param[in] arena The arena to allocate the frame from. Must not be NULL.
+ * \param[in] env The environment the chosen branch is computed in, or NULL for
+ *            the empty environment.
+ * \param[in] branches The branch terms, or NULL when \p branch_count is 0.
+ * \param[in] branch_count The number of branches.
+ * \param[in] ctx The enclosing frame. Must not be NULL and must live in \p arena.
+ * \param[out] out On success, set to the new frame; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p ctx, or \p out is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         if \p branches is NULL while \p branch_count is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_frame_new_cases(
+  struct cardano_uplc_arena_t*      arena,
+  const cardano_uplc_env_t*         env,
+  const cardano_uplc_term_t* const* branches,
+  size_t                            branch_count,
+  const cardano_uplc_frame_t*       ctx,
+  cardano_uplc_frame_t**            out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_FRAME_H */
diff --git a/vendor/src/uplc/machine/uplc_frame_kind.h b/vendor/src/uplc/machine/uplc_frame_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_frame_kind.h
@@ -0,0 +1,59 @@
+/**
+ * \file uplc_frame_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_FRAME_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_FRAME_KIND_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The kind of a CEK continuation frame.
+ *
+ * Selects the active arm of \ref cardano_uplc_frame_t. The set is the six
+ * continuation frames plus the empty frame.
+ */
+typedef enum
+{
+  /** \brief No continuation remains; returning here ends evaluation. */
+  CARDANO_UPLC_FRAME_NO_FRAME = 0,
+  /** \brief A function value is held, waiting to be applied to an argument value. */
+  CARDANO_UPLC_FRAME_AWAIT_ARG = 1,
+  /** \brief A function value is held, the argument term still has to be computed. */
+  CARDANO_UPLC_FRAME_AWAIT_FUN_TERM = 2,
+  /** \brief An argument value is held, the function value still has to be computed. */
+  CARDANO_UPLC_FRAME_AWAIT_FUN_VALUE = 3,
+  /** \brief A delayed value is being forced. */
+  CARDANO_UPLC_FRAME_FORCE = 4,
+  /** \brief Constructor fields are being computed one by one. */
+  CARDANO_UPLC_FRAME_CONSTR = 5,
+  /** \brief A scrutinee is being matched against case branches. */
+  CARDANO_UPLC_FRAME_CASES = 6
+} cardano_uplc_frame_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_FRAME_KIND_H */
diff --git a/vendor/src/uplc/machine/uplc_machine.c b/vendor/src/uplc/machine/uplc_machine.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_machine.c
@@ -0,0 +1,2194 @@
+/**
+ * \file uplc_machine.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "../arena/uplc_arena.h"
+#include "../ast/uplc_int.h"
+#include "../builtins/builtins.h"
+#include "../builtins/uplc_builtin.h"
+#include "../builtins/uplc_builtin_semantics.h"
+#include "../cost/uplc_builtin_costs.h"
+#include "../cost/uplc_cost_model.h"
+#include "../cost/uplc_machine_costs.h"
+#include "../cost/uplc_step_accumulator.h"
+
+#include "uplc_env.h"
+#include "uplc_frame.h"
+#include "uplc_frame_kind.h"
+#include "uplc_machine.h"
+#include "uplc_state_kind.h"
+#include "uplc_value.h"
+#include "uplc_value_kind.h"
+
+#include <stddef.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief The protocol major version (van Rossem) from which \c case may scrutinise
+ *        a constant of a built-in type
+ *        (plutus-ledger-api/src/PlutusLedgerApi/Common/Eval.hs,
+ *        \c defaultCaserBuiltinFor).
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t CASE_ON_BUILTINS_PROTOCOL_VERSION = 11U;
+
+/**
+ * \brief The protocol major version (Dijkstra) from which \c case may scrutinise
+ *        a Data constant
+ *        (plutus-ledger-api/src/PlutusLedgerApi/Common/Eval.hs,
+ *        \c defaultCaserBuiltinFor).
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint64_t CASE_ON_DATA_PROTOCOL_VERSION = 12U;
+
+/**
+ * \brief The major component of the Plutus Core program version (1.2.0) from which
+ *        \c case may scrutinise a Data constant.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint32_t CASE_ON_DATA_PLC_VERSION_MAJOR = 1U;
+
+/**
+ * \brief The minor component of the Plutus Core program version (1.2.0) from which
+ *        \c case may scrutinise a Data constant.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint32_t CASE_ON_DATA_PLC_VERSION_MINOR = 2U;
+
+/* MACHINE LOOP **************************************************************/
+
+/**
+ * \brief The classification of a single CEK transition.
+ *
+ * A transition either advances the machine, finishes it, or hits a normal Plutus
+ * failure (the error term, a bad application, an out-of-range index, a missing
+ * branch, or an unimplemented builtin) reported as a script error. Host failures
+ * (allocation) are reported separately through a \ref cardano_error_t out-param,
+ * not through this enum.
+ */
+typedef enum
+{
+  /** \brief The state was advanced; keep looping. */
+  PRV_STEP_CONTINUE = 0,
+  /** \brief The machine reached Done; the result value is ready to discharge. */
+  PRV_STEP_DONE = 1,
+  /** \brief The script failed; the outcome is the error term. */
+  PRV_STEP_SCRIPT_ERROR = 2,
+  /**
+   * \brief A saturated builtin this VM build does not implement was reached.
+   *
+   * Distinct from \ref PRV_STEP_SCRIPT_ERROR: the script did not fail, the VM
+   * just does not run that builtin.
+   */
+  PRV_STEP_UNSUPPORTED_BUILTIN = 3
+} step_outcome_t;
+
+/**
+ * \brief A CEK machine state: a Compute, a Return, or a Done.
+ *
+ * Compute carries the term, its environment and the continuation; Return carries
+ * the value and the continuation; Done carries only the final value. The active
+ * fields are selected by \c kind.
+ */
+typedef struct
+{
+    cardano_uplc_state_kind_t   kind;
+    const cardano_uplc_frame_t* ctx;
+    const cardano_uplc_env_t*   env;
+    const cardano_uplc_term_t*  term;
+    const cardano_uplc_value_t* value;
+} state_t;
+
+/**
+ * \brief The mutable context threaded through every transition.
+ *
+ * Holds the arena every interior node is allocated from, the step/budget
+ * accumulator, and the initial budget used to test exhaustion. It also carries
+ * the full cost model (machine-step costs plus the per-builtin costing functions)
+ * and the builtin semantics variant; the step loop reads its machine-step costs
+ * through the accumulator, and the saturated-builtin path reads \c cost_model.builtins
+ * and \c semantics to charge builtin costs. \c protocol_major decides whether
+ * \c case may scrutinise a constant, and \c case_on_data whether that constant may
+ * be a Data value.
+ */
+typedef struct
+{
+    cardano_uplc_arena_t*            arena;
+    cardano_uplc_step_accumulator_t  acc;
+    cardano_uplc_budget_t            initial;
+    cardano_uplc_cost_model_t        cost_model;
+    cardano_uplc_builtin_semantics_t semantics;
+    uint64_t                         protocol_major;
+    bool                             case_on_data;
+} machine_t;
+
+/**
+ * \brief Charges one machine step and, on host failure, reports it.
+ *
+ * \param[in,out] machine The machine whose accumulator is charged.
+ * \param[in] kind The step kind to charge.
+ *
+ * \return \ref CARDANO_SUCCESS on success, propagating any accumulator failure.
+ */
+static cardano_error_t
+charge_step(machine_t* machine, cardano_uplc_step_kind_t kind)
+{
+  return cardano_uplc_step_accumulator_step(&machine->acc, kind);
+}
+
+/**
+ * \brief Computes a term in an environment under a continuation.
+ *
+ * Implements the Compute half of the CEK transition for every term form, charging
+ * the matching step and producing the next state.
+ *
+ * \param[in,out] machine The machine context.
+ * \param[in] ctx The continuation the result returns into.
+ * \param[in] env The environment the term is computed in.
+ * \param[in] term The term to compute.
+ * \param[out] next On \ref PRV_STEP_CONTINUE, the next state.
+ * \param[out] host_error On a host failure, the error code; \ref CARDANO_SUCCESS
+ *             otherwise.
+ *
+ * \return The transition outcome.
+ */
+static step_outcome_t
+run_compute_state(
+  machine_t*                  machine,
+  const cardano_uplc_frame_t* ctx,
+  const cardano_uplc_env_t*   env,
+  const cardano_uplc_term_t*  term,
+  state_t*                    next,
+  cardano_error_t*            host_error)
+{
+  *host_error = CARDANO_SUCCESS;
+
+  switch (term->kind)
+  {
+    case CARDANO_UPLC_TERM_VAR:
+    {
+      const cardano_uplc_value_t* value = NULL;
+
+      *host_error = charge_step(machine, CARDANO_UPLC_STEP_KIND_VAR);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      if (cardano_uplc_env_lookup(env, term->as.var_index, &value) != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      next->kind  = CARDANO_UPLC_STATE_RETURN;
+      next->ctx   = ctx;
+      next->value = value;
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    case CARDANO_UPLC_TERM_DELAY:
+    {
+      cardano_uplc_value_t* value = NULL;
+
+      *host_error = charge_step(machine, CARDANO_UPLC_STEP_KIND_DELAY);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = cardano_uplc_value_new_delay(machine->arena, term->as.unary, env, &value);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      next->kind  = CARDANO_UPLC_STATE_RETURN;
+      next->ctx   = ctx;
+      next->value = value;
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    case CARDANO_UPLC_TERM_LAMBDA:
+    {
+      cardano_uplc_value_t* value = NULL;
+
+      *host_error = charge_step(machine, CARDANO_UPLC_STEP_KIND_LAMBDA);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = cardano_uplc_value_new_lambda(machine->arena, term->as.unary, env, &value);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      next->kind  = CARDANO_UPLC_STATE_RETURN;
+      next->ctx   = ctx;
+      next->value = value;
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    case CARDANO_UPLC_TERM_APPLY:
+    {
+      cardano_uplc_frame_t* frame = NULL;
+
+      *host_error = charge_step(machine, CARDANO_UPLC_STEP_KIND_APPLY);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = cardano_uplc_frame_new_await_fun_term(machine->arena, env, term->as.apply.argument, ctx, &frame);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      next->kind = CARDANO_UPLC_STATE_COMPUTE;
+      next->ctx  = frame;
+      next->env  = env;
+      next->term = term->as.apply.function;
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    case CARDANO_UPLC_TERM_CONSTANT:
+    {
+      cardano_uplc_value_t* value = NULL;
+
+      *host_error = charge_step(machine, CARDANO_UPLC_STEP_KIND_CONSTANT);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = cardano_uplc_value_new_constant(machine->arena, term->as.constant, &value);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      next->kind  = CARDANO_UPLC_STATE_RETURN;
+      next->ctx   = ctx;
+      next->value = value;
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    case CARDANO_UPLC_TERM_FORCE:
+    {
+      cardano_uplc_frame_t* frame = NULL;
+
+      *host_error = charge_step(machine, CARDANO_UPLC_STEP_KIND_FORCE);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = cardano_uplc_frame_new_force(machine->arena, ctx, &frame);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      next->kind = CARDANO_UPLC_STATE_COMPUTE;
+      next->ctx  = frame;
+      next->env  = env;
+      next->term = term->as.unary;
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    case CARDANO_UPLC_TERM_ERROR:
+    {
+      return PRV_STEP_SCRIPT_ERROR;
+    }
+
+    case CARDANO_UPLC_TERM_BUILTIN:
+    {
+      cardano_uplc_value_t* value = NULL;
+
+      *host_error = charge_step(machine, CARDANO_UPLC_STEP_KIND_BUILTIN);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = cardano_uplc_value_new_builtin(machine->arena, term->as.builtin, (size_t)0, NULL, (size_t)0, &value);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      next->kind  = CARDANO_UPLC_STATE_RETURN;
+      next->ctx   = ctx;
+      next->value = value;
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    case CARDANO_UPLC_TERM_CONSTR:
+    {
+      *host_error = charge_step(machine, CARDANO_UPLC_STEP_KIND_CONSTR);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      if (term->as.constr.field_count == (size_t)0)
+      {
+        cardano_uplc_value_t* value = NULL;
+
+        *host_error = cardano_uplc_value_new_constr(machine->arena, term->as.constr.tag, NULL, (size_t)0, &value);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return PRV_STEP_SCRIPT_ERROR;
+        }
+
+        next->kind  = CARDANO_UPLC_STATE_RETURN;
+        next->ctx   = ctx;
+        next->value = value;
+
+        return PRV_STEP_CONTINUE;
+      }
+      else
+      {
+        cardano_uplc_frame_t* frame = NULL;
+
+        *host_error = cardano_uplc_frame_new_constr(
+          machine->arena,
+          env,
+          term->as.constr.tag,
+          &term->as.constr.fields[1],
+          term->as.constr.field_count - (size_t)1,
+          NULL,
+          (size_t)0,
+          ctx,
+          &frame);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return PRV_STEP_SCRIPT_ERROR;
+        }
+
+        next->kind = CARDANO_UPLC_STATE_COMPUTE;
+        next->ctx  = frame;
+        next->env  = env;
+        next->term = term->as.constr.fields[0];
+
+        return PRV_STEP_CONTINUE;
+      }
+
+      break;
+    }
+
+    case CARDANO_UPLC_TERM_CASE:
+    {
+      cardano_uplc_frame_t* frame = NULL;
+
+      *host_error = charge_step(machine, CARDANO_UPLC_STEP_KIND_CASE);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = cardano_uplc_frame_new_cases(
+        machine->arena,
+        env,
+        term->as.cases.branches,
+        term->as.cases.branch_count,
+        ctx,
+        &frame);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      next->kind = CARDANO_UPLC_STATE_COMPUTE;
+      next->ctx  = frame;
+      next->env  = env;
+      next->term = term->as.cases.scrutinee;
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    default:
+    {
+      return PRV_STEP_SCRIPT_ERROR;
+    }
+  }
+}
+
+/**
+ * \brief Appends one argument value to a builtin's argument array.
+ *
+ * Copies the existing argument pointers into a fresh arena array one slot longer
+ * and writes \p arg at the end, leaving the source builtin value untouched.
+ *
+ * \param[in] arena The arena to allocate the new array from.
+ * \param[in] builtin The builtin value whose arguments are extended.
+ * \param[in] arg The argument value to append.
+ * \param[out] out On success, the extended array; the new count is the builtin's
+ *             count plus one.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the array.
+ */
+static cardano_error_t
+extend_builtin_args(
+  cardano_uplc_arena_t*       arena,
+  const cardano_uplc_value_t* builtin,
+  const cardano_uplc_value_t* arg,
+  // cppcheck-suppress misra-c2012-18.5; Reason: pointer nesting required by the API shape
+  const cardano_uplc_value_t* const** out)
+{
+  const cardano_uplc_value_t** args  = NULL;
+  size_t                       count = builtin->as.builtin.arg_count;
+  size_t                       i     = (size_t)0;
+
+  args = (const cardano_uplc_value_t**)cardano_uplc_arena_alloc(
+    arena,
+    sizeof(const cardano_uplc_value_t*) * (count + (size_t)1),
+    0U);
+
+  if (args == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (i = (size_t)0; i < count; ++i)
+  {
+    args[i] = builtin->as.builtin.args[i];
+  }
+
+  args[count] = arg;
+
+  *out = args;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Applies a forced or applied builtin, saturating it if it is ready.
+ *
+ * Builds the next builtin value from \p func, \p forces and \p args and, when it
+ * has all its forces and arguments, runs it through the builtin runtime. A ready
+ * builtin spends its cost before its body runs (cost-before-execute, handled by
+ * \ref cardano_uplc_int_builtin_run using \c machine->cost_model.builtins and
+ * \c machine->semantics); the body produces the resulting value, fails the script
+ * on a Plutus error (type mismatch, etc.), or reports that this VM build does not
+ * implement that builtin. An unsaturated builtin is returned as a value.
+ *
+ * \param[in,out] machine The machine context.
+ * \param[in] func The builtin function tag.
+ * \param[in] forces The forces accumulated so far.
+ * \param[in] args The argument values accumulated so far.
+ * \param[in] arg_count The number of arguments accumulated so far.
+ * \param[in] arity The builtin's arity, supplied by the caller.
+ * \param[in] force_count The builtin's force count, supplied by the caller.
+ * \param[out] out On \ref PRV_STEP_CONTINUE, the resulting value (the partially
+ *             applied builtin when unsaturated, or the builtin result when ready).
+ * \param[out] host_error On a host failure, the error code.
+ *
+ * \return \ref PRV_STEP_CONTINUE when the builtin is unsaturated or ran to a
+ *         result, \ref PRV_STEP_SCRIPT_ERROR when a ready builtin fails the script
+ *         or on a host failure, or \ref PRV_STEP_UNSUPPORTED_BUILTIN when a ready
+ *         builtin is not implemented.
+ */
+static step_outcome_t
+try_call_builtin(
+  machine_t*                         machine,
+  cardano_uplc_builtin_t             func,
+  size_t                             forces,
+  const cardano_uplc_value_t* const* args,
+  size_t                             arg_count,
+  size_t                             arity,
+  size_t                             force_count,
+  const cardano_uplc_value_t**       out,
+  cardano_error_t*                   host_error)
+{
+  cardano_uplc_value_t* value = NULL;
+
+  *host_error = CARDANO_SUCCESS;
+
+  if ((arg_count == arity) && (forces == force_count))
+  {
+    const cardano_uplc_value_t*        result  = NULL;
+    cardano_uplc_int_builtin_outcome_t outcome = cardano_uplc_int_builtin_run(
+      machine->arena,
+      &machine->acc,
+      &machine->cost_model.builtins,
+      machine->semantics,
+      func,
+      args,
+      arg_count,
+      &result,
+      host_error);
+
+    switch (outcome)
+    {
+      case CARDANO_UPLC_BUILTIN_OUTCOME_OK:
+      {
+        *out = result;
+        return PRV_STEP_CONTINUE;
+      }
+
+      case CARDANO_UPLC_BUILTIN_OUTCOME_UNSUPPORTED:
+      {
+        return PRV_STEP_UNSUPPORTED_BUILTIN;
+      }
+
+      case CARDANO_UPLC_BUILTIN_OUTCOME_SCRIPT_ERROR:
+      default:
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+    }
+  }
+
+  *host_error = cardano_uplc_value_new_builtin(machine->arena, func, forces, args, arg_count, &value);
+
+  if (*host_error != CARDANO_SUCCESS)
+  {
+    return PRV_STEP_SCRIPT_ERROR;
+  }
+
+  *out = value;
+
+  return PRV_STEP_CONTINUE;
+}
+
+/**
+ * \brief Applies a function value to an argument value.
+ *
+ * A lambda extends its captured environment and computes its body; a builtin that
+ * still expects a term argument accumulates the argument and saturates if ready;
+ * any other value is a non-functional application and fails as a script error.
+ *
+ * \param[in,out] machine The machine context.
+ * \param[in] ctx The continuation the application returns into.
+ * \param[in] function The function value applied.
+ * \param[in] arg The argument value applied.
+ * \param[out] next On \ref PRV_STEP_CONTINUE, the next state.
+ * \param[out] host_error On a host failure, the error code.
+ *
+ * \return The transition outcome.
+ */
+static step_outcome_t
+apply_evaluate(
+  machine_t*                  machine,
+  const cardano_uplc_frame_t* ctx,
+  const cardano_uplc_value_t* function,
+  const cardano_uplc_value_t* arg,
+  state_t*                    next,
+  cardano_error_t*            host_error)
+{
+  *host_error = CARDANO_SUCCESS;
+
+  switch (function->kind)
+  {
+    case CARDANO_UPLC_VALUE_LAMBDA:
+    {
+      const cardano_uplc_env_t* env = NULL;
+
+      *host_error = cardano_uplc_env_extend(machine->arena, function->as.lambda.env, arg, &env);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      next->kind = CARDANO_UPLC_STATE_COMPUTE;
+      next->ctx  = ctx;
+      next->env  = env;
+      next->term = function->as.lambda.body;
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    case CARDANO_UPLC_VALUE_BUILTIN:
+    {
+      const cardano_uplc_value_t* const* args        = NULL;
+      const cardano_uplc_value_t*        value       = NULL;
+      size_t                             arity       = (size_t)0;
+      size_t                             force_count = (size_t)0;
+
+      if ((cardano_uplc_builtin_arity(function->as.builtin.func, &arity) != CARDANO_SUCCESS) || (cardano_uplc_builtin_force_count(function->as.builtin.func, &force_count) != CARDANO_SUCCESS))
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      if ((force_count <= function->as.builtin.forces) && (arity > function->as.builtin.arg_count))
+      {
+        *host_error = extend_builtin_args(machine->arena, function, arg, &args);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return PRV_STEP_SCRIPT_ERROR;
+        }
+
+        step_outcome_t outcome = try_call_builtin(
+          machine,
+          function->as.builtin.func,
+          function->as.builtin.forces,
+          args,
+          function->as.builtin.arg_count + (size_t)1,
+          arity,
+          force_count,
+          &value,
+          host_error);
+
+        if (outcome != PRV_STEP_CONTINUE)
+        {
+          return outcome;
+        }
+
+        next->kind  = CARDANO_UPLC_STATE_RETURN;
+        next->ctx   = ctx;
+        next->value = value;
+
+        return PRV_STEP_CONTINUE;
+      }
+
+      return PRV_STEP_SCRIPT_ERROR;
+    }
+
+    case CARDANO_UPLC_VALUE_CONSTANT:
+    case CARDANO_UPLC_VALUE_DELAY:
+    case CARDANO_UPLC_VALUE_CONSTR:
+    default:
+    {
+      return PRV_STEP_SCRIPT_ERROR;
+    }
+  }
+}
+
+/**
+ * \brief Forces a delayed value or a builtin awaiting a force.
+ *
+ * A delay computes its body in its captured environment; a builtin that still
+ * expects a force consumes one and saturates if ready; any other value is a
+ * non-polymorphic instantiation and fails as a script error.
+ *
+ * \param[in,out] machine The machine context.
+ * \param[in] ctx The continuation the force returns into.
+ * \param[in] value The value being forced.
+ * \param[out] next On \ref PRV_STEP_CONTINUE, the next state.
+ * \param[out] host_error On a host failure, the error code.
+ *
+ * \return The transition outcome.
+ */
+static step_outcome_t
+force_evaluate(
+  machine_t*                  machine,
+  const cardano_uplc_frame_t* ctx,
+  const cardano_uplc_value_t* value,
+  state_t*                    next,
+  cardano_error_t*            host_error)
+{
+  *host_error = CARDANO_SUCCESS;
+
+  switch (value->kind)
+  {
+    case CARDANO_UPLC_VALUE_DELAY:
+    {
+      next->kind = CARDANO_UPLC_STATE_COMPUTE;
+      next->ctx  = ctx;
+      next->env  = value->as.delay.env;
+      next->term = value->as.delay.body;
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    case CARDANO_UPLC_VALUE_BUILTIN:
+    {
+      const cardano_uplc_value_t* resolved    = NULL;
+      size_t                      arity       = (size_t)0;
+      size_t                      force_count = (size_t)0;
+      step_outcome_t              outcome;
+
+      if ((cardano_uplc_builtin_arity(value->as.builtin.func, &arity) != CARDANO_SUCCESS) || (cardano_uplc_builtin_force_count(value->as.builtin.func, &force_count) != CARDANO_SUCCESS))
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      if (force_count > value->as.builtin.forces)
+      {
+        outcome = try_call_builtin(
+          machine,
+          value->as.builtin.func,
+          value->as.builtin.forces + (size_t)1,
+          value->as.builtin.args,
+          value->as.builtin.arg_count,
+          arity,
+          force_count,
+          &resolved,
+          host_error);
+
+        if (outcome != PRV_STEP_CONTINUE)
+        {
+          return outcome;
+        }
+
+        next->kind  = CARDANO_UPLC_STATE_RETURN;
+        next->ctx   = ctx;
+        next->value = resolved;
+
+        return PRV_STEP_CONTINUE;
+      }
+
+      return PRV_STEP_SCRIPT_ERROR;
+    }
+
+    case CARDANO_UPLC_VALUE_CONSTANT:
+    case CARDANO_UPLC_VALUE_LAMBDA:
+    case CARDANO_UPLC_VALUE_CONSTR:
+    default:
+    {
+      return PRV_STEP_SCRIPT_ERROR;
+    }
+  }
+}
+
+/**
+ * \brief Pushes constructor fields onto the continuation as await-fun-value
+ *        frames so a case branch is applied to them in order.
+ *
+ * Wraps each field, last first, in a \ref CARDANO_UPLC_FRAME_AWAIT_FUN_VALUE frame
+ * so that when the branch value returns it is applied to field 0 first.
+ *
+ * \param[in,out] machine The machine context.
+ * \param[in] fields The resolved constructor field values.
+ * \param[in] field_count The number of fields.
+ * \param[in] ctx The continuation to push the frames onto.
+ * \param[out] out On success, the continuation with the field frames pushed.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve a
+ *         frame.
+ */
+static cardano_error_t
+transfer_arg_stack(
+  machine_t*                         machine,
+  const cardano_uplc_value_t* const* fields,
+  size_t                             field_count,
+  const cardano_uplc_frame_t*        ctx,
+  const cardano_uplc_frame_t**       out)
+{
+  const cardano_uplc_frame_t* current = ctx;
+  size_t                      i       = field_count;
+
+  while (i > (size_t)0)
+  {
+    cardano_uplc_frame_t* frame = NULL;
+    cardano_error_t       error;
+
+    --i;
+
+    error = cardano_uplc_frame_new_await_fun_value(machine->arena, fields[i], current, &frame);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    current = frame;
+  }
+
+  *out = current;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Resolves the constant-index of a non-negative in-range integer.
+ *
+ * Maps a constant integer to a branch index, rejecting any integer that is
+ * negative or does not fit a \c size_t.
+ *
+ * \param[in] integer The integer constant to convert.
+ * \param[out] out On success, the branch index.
+ *
+ * \return \ref CARDANO_SUCCESS when the integer is a valid index, or
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT when it is negative or too large.
+ */
+static cardano_error_t
+constant_to_index(const cardano_bigint_t* integer, size_t* out)
+{
+  if (cardano_bigint_signum(integer) < 0)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (cardano_bigint_bit_length(integer) > (sizeof(size_t) * (size_t)8))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  *out = (size_t)cardano_bigint_to_unsigned_int(integer);
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Wraps a constant as a fresh constant value in the arena.
+ *
+ * \param[in,out] machine The machine context.
+ * \param[in] constant The constant to wrap.
+ * \param[out] out On success, the new constant value.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+static cardano_error_t
+constant_value(
+  machine_t*                     machine,
+  const cardano_uplc_constant_t* constant,
+  const cardano_uplc_value_t**   out)
+{
+  cardano_uplc_value_t* value = NULL;
+  cardano_error_t       error = cardano_uplc_value_new_constant(machine->arena, constant, &value);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  *out = value;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Selects and enters a case branch when the scrutinee is a constant.
+ *
+ * A bool takes one or two branches and selects branch 1 when true and branch 0
+ * when false, so true with a single branch fails; a unit takes exactly one
+ * branch; an integer selects the branch at its non-negative in-range index; a
+ * list takes one or two branches, a non-empty list selects branch 0 and pushes
+ * its head then tail, and an empty list selects branch 1, so it fails with a
+ * single branch; a pair takes exactly one branch, selects it and pushes its
+ * first then second component; a Data Constr selects the branch at its tag and
+ * pushes its fields as one list of data, while any other Data value is a script
+ * error. Any other constant kind, or an out-of-range or missing branch, is a
+ * script error. Before protocol version 11 casing on any constant is a script
+ * error, as the ledger's unavailable caser makes it, and casing on Data is a
+ * script error unless \c machine->case_on_data is set
+ * (plutus-ledger-api/src/PlutusLedgerApi/Common/Eval.hs, \c defaultCaserBuiltinFor;
+ * plutus-core/plutus-core/src/PlutusCore/Default/Universe.hs, \c caseBuiltinDefault
+ * and \c caseBuiltinData).
+ *
+ * \param[in,out] machine The machine context.
+ * \param[in] frame The cases frame holding the branches and environment.
+ * \param[in] constant The constant scrutinee.
+ * \param[out] next On \ref PRV_STEP_CONTINUE, the next state.
+ * \param[out] host_error On a host failure, the error code.
+ *
+ * \return The transition outcome.
+ */
+static step_outcome_t
+case_on_constant(
+  machine_t*                     machine,
+  const cardano_uplc_frame_t*    frame,
+  const cardano_uplc_constant_t* constant,
+  state_t*                       next,
+  cardano_error_t*               host_error)
+{
+  const cardano_uplc_frame_t* branch_ctx = frame->as.cases.ctx;
+  size_t                      tag        = (size_t)0;
+
+  *host_error = CARDANO_SUCCESS;
+
+  if (machine->protocol_major < CASE_ON_BUILTINS_PROTOCOL_VERSION)
+  {
+    return PRV_STEP_SCRIPT_ERROR;
+  }
+
+  switch (constant->kind)
+  {
+    case CARDANO_UPLC_TYPE_BOOL:
+    {
+      if ((frame->as.cases.branch_count < (size_t)1) || (frame->as.cases.branch_count > (size_t)2))
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      tag = constant->as.boolean ? (size_t)1 : (size_t)0;
+
+      if (tag >= frame->as.cases.branch_count)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      break;
+    }
+
+    case CARDANO_UPLC_TYPE_UNIT:
+    {
+      if (frame->as.cases.branch_count != (size_t)1)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      break;
+    }
+
+    case CARDANO_UPLC_TYPE_INTEGER:
+    {
+      if (cardano_uplc_constant_int_is_small(constant))
+      {
+        const int64_t small = cardano_uplc_constant_int_small(constant);
+
+        if (small < 0)
+        {
+          return PRV_STEP_SCRIPT_ERROR;
+        }
+
+        tag = (size_t)small;
+      }
+      else if (constant_to_index(constant->as.integer.big, &tag) != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+      else
+      {
+      }
+
+      if (tag >= frame->as.cases.branch_count)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      break;
+    }
+
+    case CARDANO_UPLC_TYPE_LIST:
+    {
+      if ((frame->as.cases.branch_count < (size_t)1) || (frame->as.cases.branch_count > (size_t)2))
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      if (constant->as.list.count > (size_t)0)
+      {
+        const cardano_uplc_value_t* fields[2];
+        cardano_uplc_constant_t*    tail_constant = NULL;
+
+        *host_error = constant_value(machine, constant->as.list.items[0], &fields[0]);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return PRV_STEP_SCRIPT_ERROR;
+        }
+
+        *host_error = cardano_uplc_constant_new_list(
+          machine->arena,
+          constant->as.list.element_type,
+          &constant->as.list.items[1],
+          constant->as.list.count - (size_t)1,
+          &tail_constant);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return PRV_STEP_SCRIPT_ERROR;
+        }
+
+        *host_error = constant_value(machine, tail_constant, &fields[1]);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return PRV_STEP_SCRIPT_ERROR;
+        }
+
+        *host_error = transfer_arg_stack(machine, fields, (size_t)2, frame->as.cases.ctx, &branch_ctx);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return PRV_STEP_SCRIPT_ERROR;
+        }
+
+        tag = (size_t)0;
+      }
+      else
+      {
+        if (frame->as.cases.branch_count != (size_t)2)
+        {
+          return PRV_STEP_SCRIPT_ERROR;
+        }
+
+        tag = (size_t)1;
+      }
+
+      break;
+    }
+
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      const cardano_uplc_value_t* fields[2];
+
+      if (frame->as.cases.branch_count != (size_t)1)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = constant_value(machine, constant->as.pair.fst, &fields[0]);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = constant_value(machine, constant->as.pair.snd, &fields[1]);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = transfer_arg_stack(machine, fields, (size_t)2, frame->as.cases.ctx, &branch_ctx);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      tag = (size_t)0;
+
+      break;
+    }
+
+    case CARDANO_UPLC_TYPE_DATA:
+    {
+      const cardano_uplc_data_t*  data = constant->as.data;
+      const cardano_uplc_value_t* fields[1];
+      cardano_uplc_constant_t*    fields_constant = NULL;
+
+      if (!machine->case_on_data || (data->kind != CARDANO_UPLC_DATA_KIND_CONSTR))
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      if (data->as.constr.tag >= (uint64_t)frame->as.cases.branch_count)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = cardano_uplc_int_data_list_from_nodes(
+        machine->arena,
+        data->as.constr.fields,
+        data->as.constr.count,
+        &fields_constant);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = constant_value(machine, fields_constant, &fields[0]);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = transfer_arg_stack(machine, fields, (size_t)1, frame->as.cases.ctx, &branch_ctx);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      tag = (size_t)data->as.constr.tag;
+
+      break;
+    }
+
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    case CARDANO_UPLC_TYPE_STRING:
+    case CARDANO_UPLC_TYPE_ARRAY:
+    case CARDANO_UPLC_TYPE_VALUE:
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    default:
+    {
+      return PRV_STEP_SCRIPT_ERROR;
+    }
+  }
+
+  next->kind = CARDANO_UPLC_STATE_COMPUTE;
+  next->ctx  = branch_ctx;
+  next->env  = frame->as.cases.env;
+  next->term = frame->as.cases.branches[tag];
+
+  return PRV_STEP_CONTINUE;
+}
+
+/**
+ * \brief Returns a computed value into the current continuation.
+ *
+ * Implements the Return half of the CEK transition for every frame. The empty
+ * frame ends the machine; the apply, force, constr and cases frames advance it.
+ *
+ * \param[in,out] machine The machine context.
+ * \param[in] ctx The frame the value returns into.
+ * \param[in] value The value being returned.
+ * \param[out] next On \ref PRV_STEP_CONTINUE, the next state; on
+ *             \ref PRV_STEP_DONE, the final value in \c value.
+ * \param[out] host_error On a host failure, the error code.
+ *
+ * \return The transition outcome.
+ */
+static step_outcome_t
+run_return_state(
+  machine_t*                  machine,
+  const cardano_uplc_frame_t* ctx,
+  const cardano_uplc_value_t* value,
+  state_t*                    next,
+  cardano_error_t*            host_error)
+{
+  *host_error = CARDANO_SUCCESS;
+
+  switch (ctx->kind)
+  {
+    case CARDANO_UPLC_FRAME_NO_FRAME:
+    {
+      next->kind  = CARDANO_UPLC_STATE_DONE;
+      next->value = value;
+
+      return PRV_STEP_DONE;
+    }
+
+    case CARDANO_UPLC_FRAME_AWAIT_FUN_TERM:
+    {
+      cardano_uplc_frame_t* frame = NULL;
+
+      *host_error = cardano_uplc_frame_new_await_arg(machine->arena, value, ctx->as.await_fun_term.ctx, &frame);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      next->kind = CARDANO_UPLC_STATE_COMPUTE;
+      next->ctx  = frame;
+      next->env  = ctx->as.await_fun_term.env;
+      next->term = ctx->as.await_fun_term.term;
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    case CARDANO_UPLC_FRAME_AWAIT_ARG:
+    {
+      return apply_evaluate(machine, ctx->as.await_arg.ctx, ctx->as.await_arg.value, value, next, host_error);
+    }
+
+    case CARDANO_UPLC_FRAME_AWAIT_FUN_VALUE:
+    {
+      return apply_evaluate(machine, ctx->as.await_fun_value.ctx, value, ctx->as.await_fun_value.value, next, host_error);
+    }
+
+    case CARDANO_UPLC_FRAME_FORCE:
+    {
+      return force_evaluate(machine, ctx->as.force.ctx, value, next, host_error);
+    }
+
+    case CARDANO_UPLC_FRAME_CONSTR:
+    {
+      const cardano_uplc_value_t** resolved = NULL;
+      size_t                       count    = ctx->as.constr.resolved_count;
+      size_t                       i        = (size_t)0;
+
+      resolved = (const cardano_uplc_value_t**)cardano_uplc_arena_alloc(
+        machine->arena,
+        sizeof(const cardano_uplc_value_t*) * (count + (size_t)1),
+        0U);
+
+      if (resolved == NULL)
+      {
+        *host_error = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      for (i = (size_t)0; i < count; ++i)
+      {
+        resolved[i] = ctx->as.constr.resolved[i];
+      }
+
+      resolved[count] = value;
+
+      if (ctx->as.constr.field_count == (size_t)0)
+      {
+        cardano_uplc_value_t* result = NULL;
+
+        *host_error = cardano_uplc_value_new_constr(
+          machine->arena,
+          ctx->as.constr.tag,
+          resolved,
+          count + (size_t)1,
+          &result);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return PRV_STEP_SCRIPT_ERROR;
+        }
+
+        next->kind  = CARDANO_UPLC_STATE_RETURN;
+        next->ctx   = ctx->as.constr.ctx;
+        next->value = result;
+
+        return PRV_STEP_CONTINUE;
+      }
+      else
+      {
+        cardano_uplc_frame_t* frame = NULL;
+
+        *host_error = cardano_uplc_frame_new_constr(
+          machine->arena,
+          ctx->as.constr.env,
+          ctx->as.constr.tag,
+          &ctx->as.constr.fields[1],
+          ctx->as.constr.field_count - (size_t)1,
+          resolved,
+          count + (size_t)1,
+          ctx->as.constr.ctx,
+          &frame);
+
+        if (*host_error != CARDANO_SUCCESS)
+        {
+          return PRV_STEP_SCRIPT_ERROR;
+        }
+
+        next->kind = CARDANO_UPLC_STATE_COMPUTE;
+        next->ctx  = frame;
+        next->env  = ctx->as.constr.env;
+        next->term = ctx->as.constr.fields[0];
+
+        return PRV_STEP_CONTINUE;
+      }
+
+      break;
+    }
+
+    case CARDANO_UPLC_FRAME_CASES:
+    {
+      const cardano_uplc_frame_t* branch_ctx = NULL;
+
+      if (value->kind == CARDANO_UPLC_VALUE_CONSTANT)
+      {
+        return case_on_constant(machine, ctx, value->as.constant, next, host_error);
+      }
+
+      if (value->kind != CARDANO_UPLC_VALUE_CONSTR)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      if (value->as.constr.tag >= ctx->as.cases.branch_count)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      *host_error = transfer_arg_stack(
+        machine,
+        value->as.constr.fields,
+        value->as.constr.field_count,
+        ctx->as.cases.ctx,
+        &branch_ctx);
+
+      if (*host_error != CARDANO_SUCCESS)
+      {
+        return PRV_STEP_SCRIPT_ERROR;
+      }
+
+      next->kind = CARDANO_UPLC_STATE_COMPUTE;
+      next->ctx  = branch_ctx;
+      next->env  = ctx->as.cases.env;
+      next->term = ctx->as.cases.branches[value->as.constr.tag];
+
+      return PRV_STEP_CONTINUE;
+    }
+
+    default:
+    {
+      return PRV_STEP_SCRIPT_ERROR;
+    }
+  }
+}
+
+/* DISCHARGE ****************************************************************/
+
+/**
+ * \brief Upper bound on the nesting depth the discharge traversal will follow.
+ *
+ * \c with_env and \c discharge_value are mutually recursive over a
+ * result value that can be arbitrarily deep on attacker-controlled input, so the
+ * recursion is capped to keep the worst case well inside the C stack. Past this
+ * depth the traversal stops with \ref CARDANO_ERROR_ILLEGAL_STATE, a host-side
+ * resource limit rather than a script outcome. The value mirrors the decoder's
+ * \c FLAT_TERM_MAX_DEPTH ceiling in \c flat_decode.c.
+ */
+enum
+{
+  PRV_DISCHARGE_MAX_DEPTH = 4096
+};
+
+static cardano_error_t
+discharge_value(cardano_uplc_arena_t* arena, size_t depth, const cardano_uplc_value_t* value, const cardano_uplc_term_t** out);
+
+/**
+ * \brief Re-discharges a body term, substituting environment values for the free
+ *        variables it does not itself bind.
+ *
+ * Walks \p term counting the binders entered along the way (\p lam_cnt). A
+ * variable bound by one of those binders is left as-is; a deeper variable is
+ * resolved in \p env and the bound value is discharged in its place.
+ *
+ * \param[in] arena The arena the rebuilt term is allocated in.
+ * \param[in] depth The current discharge nesting depth.
+ * \param[in] lam_cnt The number of binders entered since the discharge root.
+ * \param[in] env The environment the closure captured.
+ * \param[in] term The term to re-discharge.
+ * \param[out] out On success, the rebuilt term.
+ *
+ * \return \ref CARDANO_SUCCESS on success,
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve a
+ *         node, or \ref CARDANO_ERROR_ILLEGAL_STATE past
+ *         \ref PRV_DISCHARGE_MAX_DEPTH.
+ */
+static cardano_error_t
+with_env(
+  cardano_uplc_arena_t*       arena,
+  size_t                      depth,
+  uint64_t                    lam_cnt,
+  const cardano_uplc_env_t*   env,
+  const cardano_uplc_term_t*  term,
+  const cardano_uplc_term_t** out)
+{
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  if (depth > (size_t)PRV_DISCHARGE_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_ILLEGAL_STATE;
+  }
+
+  switch (term->kind)
+  {
+    case CARDANO_UPLC_TERM_VAR:
+    {
+      if (lam_cnt >= term->as.var_index)
+      {
+        *out = term;
+        return CARDANO_SUCCESS;
+      }
+      else
+      {
+        const cardano_uplc_value_t* bound = NULL;
+
+        if (cardano_uplc_env_lookup(env, term->as.var_index - lam_cnt, &bound) == CARDANO_SUCCESS)
+        {
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          return discharge_value(arena, depth + (size_t)1, bound, out);
+        }
+
+        *out = term;
+        return CARDANO_SUCCESS;
+      }
+
+      break;
+    }
+
+    case CARDANO_UPLC_TERM_LAMBDA:
+    {
+      const cardano_uplc_term_t* body   = NULL;
+      cardano_uplc_term_t*       result = NULL;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      error = with_env(arena, depth + (size_t)1, lam_cnt + (uint64_t)1, env, term->as.unary, &body);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      error = cardano_uplc_term_new_lambda(arena, body, &result);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      *out = result;
+
+      return CARDANO_SUCCESS;
+    }
+
+    case CARDANO_UPLC_TERM_DELAY:
+    {
+      const cardano_uplc_term_t* body   = NULL;
+      cardano_uplc_term_t*       result = NULL;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      error = with_env(arena, depth + (size_t)1, lam_cnt, env, term->as.unary, &body);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      error = cardano_uplc_term_new_delay(arena, body, &result);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      *out = result;
+
+      return CARDANO_SUCCESS;
+    }
+
+    case CARDANO_UPLC_TERM_FORCE:
+    {
+      const cardano_uplc_term_t* body   = NULL;
+      cardano_uplc_term_t*       result = NULL;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      error = with_env(arena, depth + (size_t)1, lam_cnt, env, term->as.unary, &body);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      error = cardano_uplc_term_new_force(arena, body, &result);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      *out = result;
+
+      return CARDANO_SUCCESS;
+    }
+
+    case CARDANO_UPLC_TERM_APPLY:
+    {
+      const cardano_uplc_term_t* function = NULL;
+      const cardano_uplc_term_t* argument = NULL;
+      cardano_uplc_term_t*       result   = NULL;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      error = with_env(arena, depth + (size_t)1, lam_cnt, env, term->as.apply.function, &function);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      error = with_env(arena, depth + (size_t)1, lam_cnt, env, term->as.apply.argument, &argument);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      error = cardano_uplc_term_new_apply(arena, function, argument, &result);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      *out = result;
+
+      return CARDANO_SUCCESS;
+    }
+
+    case CARDANO_UPLC_TERM_CONSTR:
+    {
+      const cardano_uplc_term_t** fields = NULL;
+      cardano_uplc_term_t*        result = NULL;
+
+      if (term->as.constr.field_count > (size_t)0)
+      {
+        size_t i;
+
+        fields = (const cardano_uplc_term_t**)cardano_uplc_arena_alloc(
+          arena,
+          sizeof(const cardano_uplc_term_t*) * term->as.constr.field_count,
+          0U);
+
+        if (fields == NULL)
+        {
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+
+        for (i = (size_t)0; i < term->as.constr.field_count; ++i)
+        {
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          error = with_env(arena, depth + (size_t)1, lam_cnt, env, term->as.constr.fields[i], &fields[i]);
+
+          if (error != CARDANO_SUCCESS)
+          {
+            return error;
+          }
+        }
+      }
+
+      error = cardano_uplc_term_new_constr(arena, term->as.constr.tag, fields, term->as.constr.field_count, &result);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      *out = result;
+
+      return CARDANO_SUCCESS;
+    }
+
+    case CARDANO_UPLC_TERM_CASE:
+    {
+      const cardano_uplc_term_t*  scrutinee = NULL;
+      const cardano_uplc_term_t** branches  = NULL;
+      cardano_uplc_term_t*        result    = NULL;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      error = with_env(arena, depth + (size_t)1, lam_cnt, env, term->as.cases.scrutinee, &scrutinee);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      if (term->as.cases.branch_count > (size_t)0)
+      {
+        size_t i;
+
+        branches = (const cardano_uplc_term_t**)cardano_uplc_arena_alloc(
+          arena,
+          sizeof(const cardano_uplc_term_t*) * term->as.cases.branch_count,
+          0U);
+
+        if (branches == NULL)
+        {
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+
+        for (i = (size_t)0; i < term->as.cases.branch_count; ++i)
+        {
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          error = with_env(arena, depth + (size_t)1, lam_cnt, env, term->as.cases.branches[i], &branches[i]);
+
+          if (error != CARDANO_SUCCESS)
+          {
+            return error;
+          }
+        }
+      }
+
+      error = cardano_uplc_term_new_case(arena, scrutinee, branches, term->as.cases.branch_count, &result);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      *out = result;
+
+      return CARDANO_SUCCESS;
+    }
+
+    case CARDANO_UPLC_TERM_CONSTANT:
+    case CARDANO_UPLC_TERM_BUILTIN:
+    case CARDANO_UPLC_TERM_ERROR:
+    default:
+    {
+      *out = term;
+      return CARDANO_SUCCESS;
+    }
+  }
+}
+
+/**
+ * \brief Converts a final CEK value back into a term for the result.
+ *
+ * A constant becomes a constant term; a delay or lambda closure rebuilds its term
+ * and re-discharges its captured environment into the body; a builtin rebuilds the
+ * builtin applied to its forces and arguments; a constr discharges each field.
+ *
+ * \param[in] arena The arena the result term is allocated in.
+ * \param[in] depth The current discharge nesting depth.
+ * \param[in] value The value to discharge.
+ * \param[out] out On success, the discharged term.
+ *
+ * \return \ref CARDANO_SUCCESS on success,
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve a
+ *         node, or \ref CARDANO_ERROR_ILLEGAL_STATE past
+ *         \ref PRV_DISCHARGE_MAX_DEPTH.
+ */
+static cardano_error_t
+discharge_value(
+  cardano_uplc_arena_t*       arena,
+  size_t                      depth,
+  const cardano_uplc_value_t* value,
+  const cardano_uplc_term_t** out)
+{
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  if (depth > (size_t)PRV_DISCHARGE_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_ILLEGAL_STATE;
+  }
+
+  switch (value->kind)
+  {
+    case CARDANO_UPLC_VALUE_CONSTANT:
+    {
+      cardano_uplc_term_t* result = NULL;
+
+      error = cardano_uplc_term_new_constant(arena, value->as.constant, &result);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      *out = result;
+
+      return CARDANO_SUCCESS;
+    }
+
+    case CARDANO_UPLC_VALUE_DELAY:
+    {
+      cardano_uplc_term_t* delay = NULL;
+
+      error = cardano_uplc_term_new_delay(arena, value->as.delay.body, &delay);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      return with_env(arena, depth + (size_t)1, (uint64_t)0, value->as.delay.env, delay, out);
+    }
+
+    case CARDANO_UPLC_VALUE_LAMBDA:
+    {
+      const cardano_uplc_term_t* discharged_body = NULL;
+      cardano_uplc_term_t*       result          = NULL;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      error = with_env(arena, depth + (size_t)1, (uint64_t)1, value->as.lambda.env, value->as.lambda.body, &discharged_body);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      error = cardano_uplc_term_new_lambda(arena, discharged_body, &result);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      *out = result;
+
+      return CARDANO_SUCCESS;
+    }
+
+    case CARDANO_UPLC_VALUE_BUILTIN:
+    {
+      cardano_uplc_term_t*       builtin_term = NULL;
+      const cardano_uplc_term_t* term         = NULL;
+      size_t                     i            = (size_t)0;
+
+      error = cardano_uplc_term_new_builtin(arena, value->as.builtin.func, &builtin_term);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      term = builtin_term;
+
+      for (i = (size_t)0; i < value->as.builtin.forces; ++i)
+      {
+        cardano_uplc_term_t* force_term = NULL;
+
+        error = cardano_uplc_term_new_force(arena, term, &force_term);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+
+        term = force_term;
+      }
+
+      for (i = (size_t)0; i < value->as.builtin.arg_count; ++i)
+      {
+        const cardano_uplc_term_t* arg_term = NULL;
+        cardano_uplc_term_t*       apply    = NULL;
+
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        error = discharge_value(arena, depth + (size_t)1, value->as.builtin.args[i], &arg_term);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+
+        error = cardano_uplc_term_new_apply(arena, term, arg_term, &apply);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+
+        term = apply;
+      }
+
+      *out = term;
+
+      return CARDANO_SUCCESS;
+    }
+
+    case CARDANO_UPLC_VALUE_CONSTR:
+    {
+      const cardano_uplc_term_t** fields = NULL;
+      cardano_uplc_term_t*        result = NULL;
+
+      if (value->as.constr.field_count > (size_t)0)
+      {
+        size_t i;
+
+        fields = (const cardano_uplc_term_t**)cardano_uplc_arena_alloc(
+          arena,
+          sizeof(const cardano_uplc_term_t*) * value->as.constr.field_count,
+          0U);
+
+        if (fields == NULL)
+        {
+          return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+        }
+
+        for (i = (size_t)0; i < value->as.constr.field_count; ++i)
+        {
+          // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+          error = discharge_value(arena, depth + (size_t)1, value->as.constr.fields[i], &fields[i]);
+
+          if (error != CARDANO_SUCCESS)
+          {
+            return error;
+          }
+        }
+      }
+
+      error = cardano_uplc_term_new_constr(arena, value->as.constr.tag, fields, value->as.constr.field_count, &result);
+
+      if (error != CARDANO_SUCCESS)
+      {
+        return error;
+      }
+
+      *out = result;
+
+      return CARDANO_SUCCESS;
+    }
+
+    default:
+    {
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+}
+
+/* EVALUATE *****************************************************************/
+
+/**
+ * \brief Reports whether \c case may scrutinise a Data constant.
+ *
+ * Mirrors the ledger's caser choice: casing on Data needs protocol version 12 or
+ * later and a program version of 1.2.0 or later; below either bound the caser
+ * without Data applies
+ * (plutus-ledger-api/src/PlutusLedgerApi/Common/Eval.hs, \c defaultCaserBuiltinFor).
+ *
+ * \param[in] protocol_major The major protocol version the program is evaluated under.
+ * \param[in] program The program being evaluated.
+ *
+ * \return \c true when casing on Data is available, \c false otherwise.
+ */
+static bool
+case_on_data_available(uint64_t protocol_major, const cardano_uplc_program_t* program)
+{
+  if (protocol_major < CASE_ON_DATA_PROTOCOL_VERSION)
+  {
+    return false;
+  }
+
+  if (program->version_major != CASE_ON_DATA_PLC_VERSION_MAJOR)
+  {
+    return program->version_major > CASE_ON_DATA_PLC_VERSION_MAJOR;
+  }
+
+  return program->version_minor >= CASE_ON_DATA_PLC_VERSION_MINOR;
+}
+
+/**
+ * \brief Maps a machine version to the matching cost-model version.
+ *
+ * \param[in] version The machine version to map.
+ *
+ * \return The cost-model version selecting the default tables; an unrecognized
+ *         machine version maps to V3.
+ */
+static cardano_uplc_cost_model_version_t
+cost_model_version(cardano_uplc_machine_version_t version)
+{
+  switch (version)
+  {
+    case CARDANO_UPLC_MACHINE_VERSION_V1:
+    {
+      return CARDANO_UPLC_COST_MODEL_VERSION_V1;
+    }
+
+    case CARDANO_UPLC_MACHINE_VERSION_V2:
+    {
+      return CARDANO_UPLC_COST_MODEL_VERSION_V2;
+    }
+
+    case CARDANO_UPLC_MACHINE_VERSION_V3:
+    default:
+    {
+      return CARDANO_UPLC_COST_MODEL_VERSION_V3;
+    }
+  }
+}
+
+/**
+ * \brief Maps a machine version to the matching builtin language version.
+ *
+ * \param[in] version The machine version to map.
+ *
+ * \return The builtin language version; an unrecognized machine version maps to V3.
+ */
+static cardano_uplc_lang_version_t
+lang_version(cardano_uplc_machine_version_t version)
+{
+  switch (version)
+  {
+    case CARDANO_UPLC_MACHINE_VERSION_V1:
+    {
+      return CARDANO_UPLC_LANG_VERSION_V1;
+    }
+
+    case CARDANO_UPLC_MACHINE_VERSION_V2:
+    {
+      return CARDANO_UPLC_LANG_VERSION_V2;
+    }
+
+    case CARDANO_UPLC_MACHINE_VERSION_V3:
+    default:
+    {
+      return CARDANO_UPLC_LANG_VERSION_V3;
+    }
+  }
+}
+
+/**
+ * \brief Builds the default full cost model for a machine version.
+ *
+ * Pairs the default machine-step costs with the default per-builtin costing
+ * functions for the version. The machine-step component equals
+ * \ref cardano_uplc_machine_costs_default for the version, so the step loop charges
+ * the same budgets as before this model was threaded through.
+ *
+ * \param[in] version The machine version selecting the tables.
+ *
+ * \return The default full cost model for \p version.
+ */
+static cardano_uplc_cost_model_t
+cost_model_for_version(cardano_uplc_machine_version_t version)
+{
+  cardano_uplc_cost_model_t         model;
+  cardano_uplc_cost_model_version_t cost_version = cost_model_version(version);
+
+  model.machine = cardano_uplc_machine_costs_default(cost_version);
+
+  switch (cost_version)
+  {
+    case CARDANO_UPLC_COST_MODEL_VERSION_V1:
+    {
+      model.builtins = cardano_uplc_builtin_costs_v1();
+      break;
+    }
+
+    case CARDANO_UPLC_COST_MODEL_VERSION_V2:
+    {
+      model.builtins = cardano_uplc_builtin_costs_v2();
+      break;
+    }
+
+    case CARDANO_UPLC_COST_MODEL_VERSION_V3:
+    case CARDANO_UPLC_COST_MODEL_VERSION_V4:
+    default:
+    {
+      model.builtins = cardano_uplc_builtin_costs_v3();
+      break;
+    }
+  }
+
+  return model;
+}
+
+cardano_error_t
+cardano_uplc_int_evaluate_with_costs(
+  cardano_uplc_arena_t*            arena,
+  const cardano_uplc_program_t*    program,
+  const cardano_uplc_cost_model_t* cost_model,
+  cardano_uplc_builtin_semantics_t semantics,
+  uint64_t                         protocol_major,
+  cardano_uplc_budget_t            initial_budget,
+  cardano_uplc_eval_result_t*      out)
+{
+  machine_t             machine;
+  cardano_uplc_frame_t* no_frame = NULL;
+  state_t               state;
+  cardano_error_t       error       = CARDANO_SUCCESS;
+  bool                  running     = true;
+  bool                  failed      = false;
+  bool                  unsupported = false;
+
+  if ((arena == NULL) || (program == NULL) || (program->term == NULL) || (cost_model == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  machine.arena          = arena;
+  machine.initial        = initial_budget;
+  machine.cost_model     = *cost_model;
+  machine.semantics      = semantics;
+  machine.protocol_major = protocol_major;
+  machine.case_on_data   = case_on_data_available(protocol_major, program);
+
+  error = cardano_uplc_step_accumulator_init(&machine.acc, &machine.cost_model.machine);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  error = cardano_uplc_step_accumulator_charge_startup(&machine.acc);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (cardano_uplc_step_accumulator_is_exhausted(&machine.acc, machine.initial))
+  {
+    out->status = CARDANO_UPLC_EVAL_OUT_OF_BUDGET;
+    out->spent  = cardano_uplc_step_accumulator_spent(&machine.acc);
+    out->result = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  error = cardano_uplc_frame_new_no_frame(arena, &no_frame);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  state.kind  = CARDANO_UPLC_STATE_COMPUTE;
+  state.ctx   = no_frame;
+  state.env   = NULL;
+  state.term  = program->term;
+  state.value = NULL;
+
+  while (running)
+  {
+    state_t               next;
+    step_outcome_t        outcome      = PRV_STEP_DONE;
+    cardano_uplc_budget_t spent_before = machine.acc.spent;
+
+    next.kind = CARDANO_UPLC_STATE_COMPUTE;
+
+    switch (state.kind)
+    {
+      case CARDANO_UPLC_STATE_COMPUTE:
+      {
+        outcome = run_compute_state(&machine, state.ctx, state.env, state.term, &next, &error);
+        break;
+      }
+
+      case CARDANO_UPLC_STATE_RETURN:
+      {
+        outcome = run_return_state(&machine, state.ctx, state.value, &next, &error);
+        break;
+      }
+
+      case CARDANO_UPLC_STATE_DONE:
+      default:
+      {
+        outcome = PRV_STEP_DONE;
+        break;
+      }
+    }
+
+    if ((outcome == PRV_STEP_SCRIPT_ERROR) && (error != CARDANO_SUCCESS))
+    {
+      return error;
+    }
+
+    if (((machine.acc.spent.cpu != spent_before.cpu) || (machine.acc.spent.mem != spent_before.mem)) && cardano_uplc_step_accumulator_is_exhausted(&machine.acc, machine.initial))
+    {
+      out->status = CARDANO_UPLC_EVAL_OUT_OF_BUDGET;
+      out->spent  = cardano_uplc_step_accumulator_spent(&machine.acc);
+      out->result = NULL;
+
+      return CARDANO_SUCCESS;
+    }
+
+    if (outcome == PRV_STEP_UNSUPPORTED_BUILTIN)
+    {
+      unsupported = true;
+      running     = false;
+    }
+    else if (outcome == PRV_STEP_SCRIPT_ERROR)
+    {
+      failed  = true;
+      running = false;
+    }
+    else if (outcome == PRV_STEP_DONE)
+    {
+      state   = next;
+      running = false;
+    }
+    else
+    {
+      state = next;
+    }
+  }
+
+  error = cardano_uplc_step_accumulator_flush(&machine.acc);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  if (cardano_uplc_step_accumulator_is_exhausted(&machine.acc, machine.initial))
+  {
+    out->status = CARDANO_UPLC_EVAL_OUT_OF_BUDGET;
+    out->spent  = cardano_uplc_step_accumulator_spent(&machine.acc);
+    out->result = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (unsupported)
+  {
+    out->status = CARDANO_UPLC_EVAL_UNSUPPORTED_BUILTIN;
+    out->spent  = cardano_uplc_step_accumulator_spent(&machine.acc);
+    out->result = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  if (failed)
+  {
+    out->status = CARDANO_UPLC_EVAL_ERROR_TERM;
+    out->spent  = cardano_uplc_step_accumulator_spent(&machine.acc);
+    out->result = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  {
+    const cardano_uplc_term_t* result = NULL;
+
+    error = discharge_value(arena, (size_t)0, state.value, &result);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    out->status = CARDANO_UPLC_EVAL_SUCCESS;
+    out->spent  = cardano_uplc_step_accumulator_spent(&machine.acc);
+    out->result = result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_evaluate(
+  cardano_uplc_arena_t*          arena,
+  const cardano_uplc_program_t*  program,
+  cardano_uplc_machine_version_t version,
+  cardano_uplc_budget_t          initial_budget,
+  cardano_uplc_eval_result_t*    out)
+{
+  const uint64_t                   VAN_ROSSEM_PROTOCOL_VERSION = 11U;
+  cardano_uplc_cost_model_t        cost_model                  = cost_model_for_version(version);
+  cardano_uplc_builtin_semantics_t semantics                   = cardano_uplc_builtin_semantics_for_language_and_protocol(
+    lang_version(version),
+    VAN_ROSSEM_PROTOCOL_VERSION);
+
+  cardano_uplc_builtin_costs_select_division_shapes(&cost_model.builtins, semantics);
+
+  return cardano_uplc_int_evaluate_with_costs(arena, program, &cost_model, semantics, VAN_ROSSEM_PROTOCOL_VERSION, initial_budget, out);
+}
diff --git a/vendor/src/uplc/machine/uplc_machine.h b/vendor/src/uplc/machine/uplc_machine.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_machine.h
@@ -0,0 +1,155 @@
+/**
+ * \file uplc_machine.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_MACHINE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_MACHINE_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../arena/uplc_arena.h"
+#include "../ast/uplc_program.h"
+#include "../ast/uplc_term.h"
+#include "../builtins/uplc_builtin_semantics.h"
+#include "../cost/uplc_cost_model.h"
+#include "uplc_budget.h"
+#include "uplc_eval_result.h"
+#include "uplc_eval_status.h"
+#include "uplc_machine_version.h"
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Evaluates a decoded UPLC program on the CEK machine.
+ *
+ * Runs the Compute/Return/Done transition machine over \p program->term,
+ * charging the default machine-step costs for \p version with slippage batching,
+ * and reports the outcome through \p out. The builtin semantics variant and the
+ * \c case rules are those of \p version at protocol version 11.
+ *
+ * The loop is iterative, not host-recursive, so a deeply nested term cannot
+ * overflow the C stack. Builtin bodies are implemented in later milestones: a
+ * builtin that saturates but whose body is not implemented yet ends the
+ * evaluation with \ref CARDANO_UPLC_EVAL_UNSUPPORTED_BUILTIN rather than
+ * producing a wrong value, so a program that relies on such a builtin is visibly
+ * distinguishable from a script that genuinely failed.
+ *
+ * Ownership: \p program and its whole term tree are borrowed and must stay valid
+ * for the call; they live in \p arena, the arena they were decoded into. The
+ * machine allocates every interior value, environment cell and continuation frame
+ * in \p arena, and allocates the discharged result term in \p arena as well, so
+ * the result outlives the call exactly as long as \p arena does. The machine does
+ * not create or free an arena of its own; the caller owns \p arena and releases it
+ * with \ref cardano_uplc_arena_free when done with the result.
+ *
+ * Host failure versus script outcome: a \ref cardano_error_t other than
+ * \ref CARDANO_SUCCESS means the host could not run the script (a null argument,
+ * or an arena allocation failure). A script that fails or runs out of budget is a
+ * \ref CARDANO_SUCCESS return whose \p out carries the
+ * \ref CARDANO_UPLC_EVAL_ERROR_TERM or \ref CARDANO_UPLC_EVAL_OUT_OF_BUDGET status.
+ *
+ * \param[in] arena The arena that owns \p program and receives the result term.
+ *            Must not be NULL.
+ * \param[in] program The decoded program to evaluate. Must not be NULL and must
+ *            live in \p arena.
+ * \param[in] version The language version selecting the default step costs.
+ * \param[in] initial_budget The CPU and memory ceiling for the evaluation.
+ * \param[out] out On a \ref CARDANO_SUCCESS return, the script outcome, spent
+ *             budget and result term; left untouched on a \ref cardano_error_t
+ *             failure.
+ *
+ * \return \ref CARDANO_SUCCESS when the host ran the script (whatever the script
+ *         outcome), \ref CARDANO_ERROR_POINTER_IS_NULL if \p arena, \p program,
+ *         \p program->term, or \p out is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if \p arena cannot serve an
+ *         interior allocation.
+ */
+cardano_error_t
+cardano_uplc_evaluate(
+  struct cardano_uplc_arena_t*   arena,
+  const cardano_uplc_program_t*  program,
+  cardano_uplc_machine_version_t version,
+  cardano_uplc_budget_t          initial_budget,
+  cardano_uplc_eval_result_t*    out);
+
+/* INTERNAL DECLARATIONS *****************************************************/
+
+/* The following entry point is module-internal (the cardano_uplc_int_ prefix
+ * marks it so). It is the cost-model-aware core of the CEK evaluator and is not
+ * part of the public API. */
+
+/**
+ * \brief Evaluates a decoded UPLC program with a caller-provided cost model.
+ *
+ * The cost-model-aware counterpart of the public \ref cardano_uplc_evaluate. It
+ * takes a structured \p cost_model and a builtin \p semantics variant directly
+ * rather than deriving the per-version defaults, so a caller can charge the real
+ * ledger cost model the transaction was submitted under. The step loop reads
+ * \p cost_model.machine through the slippage accumulator and the saturated
+ * builtin path reads \p cost_model.builtins and \p semantics. The public
+ * \ref cardano_uplc_evaluate is a thin wrapper that supplies the version default
+ * model and semantics.
+ *
+ * Ownership and outcome semantics match \ref cardano_uplc_evaluate exactly: the
+ * program and result live in \p arena, a script outcome is reported through
+ * \p out on a \ref CARDANO_SUCCESS return, and a \ref cardano_error_t marks a host
+ * failure.
+ *
+ * \param[in] arena The arena that owns \p program and receives the result term.
+ *            Must not be NULL.
+ * \param[in] program The decoded program to evaluate. Must not be NULL and must
+ *            live in \p arena.
+ * \param[in] cost_model The full cost model to charge against. Must not be NULL.
+ * \param[in] semantics The builtin semantics variant driving the version-dependent
+ *            builtin behaviours.
+ * \param[in] protocol_major The major protocol version the program is evaluated
+ *            under; below 11 a \c case on a constant fails the script, and below 12,
+ *            or for a program version below 1.2.0, a \c case on a Data constant
+ *            fails the script. Builtin availability is not checked here: the
+ *            ledger rejects an unavailable builtin when it deserialises the script.
+ * \param[in] initial_budget The CPU and memory ceiling for the evaluation.
+ * \param[out] out On a \ref CARDANO_SUCCESS return, the script outcome, spent
+ *             budget and result term.
+ *
+ * \return \ref CARDANO_SUCCESS when the host ran the script, or a
+ *         \ref cardano_error_t host failure.
+ */
+cardano_error_t
+cardano_uplc_int_evaluate_with_costs(
+  struct cardano_uplc_arena_t*     arena,
+  const cardano_uplc_program_t*    program,
+  const cardano_uplc_cost_model_t* cost_model,
+  cardano_uplc_builtin_semantics_t semantics,
+  uint64_t                         protocol_major,
+  cardano_uplc_budget_t            initial_budget,
+  cardano_uplc_eval_result_t*      out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_MACHINE_H */
diff --git a/vendor/src/uplc/machine/uplc_machine_version.h b/vendor/src/uplc/machine/uplc_machine_version.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_machine_version.h
@@ -0,0 +1,55 @@
+/**
+ * \file uplc_machine_version.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_MACHINE_VERSION_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_MACHINE_VERSION_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/typedefs.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The Plutus language version selecting the default builtin costs.
+ *
+ * The versions differ in their default builtin costs; every version charges the
+ * same machine-step costs. An unrecognized value is treated as V3.
+ */
+typedef enum
+{
+  /** \brief Plutus V1 default builtin costs. */
+  CARDANO_UPLC_MACHINE_VERSION_V1 = 0,
+  /** \brief Plutus V2 default builtin costs. */
+  CARDANO_UPLC_MACHINE_VERSION_V2 = 1,
+  /** \brief Plutus V3 default builtin costs (the default). */
+  CARDANO_UPLC_MACHINE_VERSION_V3 = 2
+} cardano_uplc_machine_version_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_MACHINE_VERSION_H */
diff --git a/vendor/src/uplc/machine/uplc_state_kind.h b/vendor/src/uplc/machine/uplc_state_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_state_kind.h
@@ -0,0 +1,52 @@
+/**
+ * \file uplc_state_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_STATE_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_STATE_KIND_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The phase of a single CEK step.
+ *
+ * The machine alternates between computing a term in an environment and
+ * returning a computed value into the continuation, ending when the value is
+ * returned into the empty frame.
+ */
+typedef enum
+{
+  /** \brief Evaluate a term in an environment under a continuation. */
+  CARDANO_UPLC_STATE_COMPUTE = 0,
+  /** \brief Apply the continuation to an already-computed value. */
+  CARDANO_UPLC_STATE_RETURN = 1,
+  /** \brief Evaluation is complete; the result term is available. */
+  CARDANO_UPLC_STATE_DONE = 2
+} cardano_uplc_state_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_STATE_KIND_H */
diff --git a/vendor/src/uplc/machine/uplc_value.c b/vendor/src/uplc/machine/uplc_value.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_value.c
@@ -0,0 +1,216 @@
+/**
+ * \file uplc_value.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_value.h"
+
+#include "../arena/uplc_arena.h"
+
+#include <stddef.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Allocates a zero-initialized value from the arena.
+ *
+ * \param[in] arena The arena to allocate from.
+ *
+ * \return The new value, or NULL if the arena cannot serve the node.
+ */
+static cardano_uplc_value_t*
+alloc_value(cardano_uplc_arena_t* arena)
+{
+  cardano_uplc_value_t* value = (cardano_uplc_value_t*)cardano_uplc_arena_alloc(arena, sizeof(cardano_uplc_value_t), 0U);
+
+  if (value != NULL)
+  {
+    value->ex_mem = CARDANO_UPLC_VALUE_EX_MEM_UNCOMPUTED;
+  }
+
+  return value;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_value_new_constant(
+  cardano_uplc_arena_t*          arena,
+  const cardano_uplc_constant_t* constant,
+  cardano_uplc_value_t**         out)
+{
+  cardano_uplc_value_t* result = NULL;
+
+  if ((arena == NULL) || (constant == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_value(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind        = CARDANO_UPLC_VALUE_CONSTANT;
+  result->as.constant = constant;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_value_new_delay(
+  cardano_uplc_arena_t*      arena,
+  const cardano_uplc_term_t* body,
+  const cardano_uplc_env_t*  env,
+  cardano_uplc_value_t**     out)
+{
+  cardano_uplc_value_t* result = NULL;
+
+  if ((arena == NULL) || (body == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_value(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind          = CARDANO_UPLC_VALUE_DELAY;
+  result->as.delay.body = body;
+  result->as.delay.env  = env;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_value_new_lambda(
+  cardano_uplc_arena_t*      arena,
+  const cardano_uplc_term_t* body,
+  const cardano_uplc_env_t*  env,
+  cardano_uplc_value_t**     out)
+{
+  cardano_uplc_value_t* result = NULL;
+
+  if ((arena == NULL) || (body == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = alloc_value(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind           = CARDANO_UPLC_VALUE_LAMBDA;
+  result->as.lambda.body = body;
+  result->as.lambda.env  = env;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_value_new_builtin(
+  cardano_uplc_arena_t*              arena,
+  cardano_uplc_builtin_t             func,
+  size_t                             forces,
+  const cardano_uplc_value_t* const* args,
+  size_t                             arg_count,
+  cardano_uplc_value_t**             out)
+{
+  cardano_uplc_value_t* result = NULL;
+
+  if ((arena == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((args == NULL) && (arg_count != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = alloc_value(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                 = CARDANO_UPLC_VALUE_BUILTIN;
+  result->as.builtin.func      = func;
+  result->as.builtin.forces    = forces;
+  result->as.builtin.args      = args;
+  result->as.builtin.arg_count = arg_count;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_value_new_constr(
+  cardano_uplc_arena_t*              arena,
+  uint64_t                           tag,
+  const cardano_uplc_value_t* const* fields,
+  size_t                             field_count,
+  cardano_uplc_value_t**             out)
+{
+  cardano_uplc_value_t* result = NULL;
+
+  if ((arena == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((fields == NULL) && (field_count != 0U))
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  result = alloc_value(arena);
+
+  if (result == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result->kind                  = CARDANO_UPLC_VALUE_CONSTR;
+  result->as.constr.tag         = tag;
+  result->as.constr.fields      = fields;
+  result->as.constr.field_count = field_count;
+
+  *out = result;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/machine/uplc_value.h b/vendor/src/uplc/machine/uplc_value.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_value.h
@@ -0,0 +1,245 @@
+/**
+ * \file uplc_value.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_VALUE_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_VALUE_H
+
+/* INCLUDES ******************************************************************/
+
+#include "uplc_value_kind.h"
+
+#include "../arena/uplc_arena.h"
+#include "../ast/uplc_term.h"
+#include "../builtins/uplc_builtin.h"
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+/* FORWARD DECLARATIONS ******************************************************/
+
+#ifndef CARDANO_UPLC_VALUE_T_FORWARD_DECLARED
+#define CARDANO_UPLC_VALUE_T_FORWARD_DECLARED
+typedef struct cardano_uplc_value_t cardano_uplc_value_t;
+#endif /* CARDANO_UPLC_VALUE_T_FORWARD_DECLARED */
+
+#ifndef CARDANO_UPLC_ENV_T_FORWARD_DECLARED
+#define CARDANO_UPLC_ENV_T_FORWARD_DECLARED
+typedef struct cardano_uplc_env_t cardano_uplc_env_t;
+#endif /* CARDANO_UPLC_ENV_T_FORWARD_DECLARED */
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Sentinel for an un-memoized \ref cardano_uplc_value_t ex-mem size.
+ *
+ * Every ex-mem size is non-negative, so a negative value unambiguously marks the
+ * cache as not yet computed.
+ */
+#define CARDANO_UPLC_VALUE_EX_MEM_UNCOMPUTED ((int64_t)-1)
+
+/**
+ * \brief An immutable CEK runtime value, tagged by its value kind.
+ *
+ * The \c kind selects the active union arm; never read an arm the kind does not
+ * select. Closures (\c delay, \c lambda) hold the body term and the environment
+ * they were built in. A \c builtin accumulates the forces seen and the argument
+ * values applied so far until it saturates. A \c constr holds its tag and the
+ * already-resolved field values. Values are arena-allocated and never mutated
+ * after construction; the constant an arena owns inside a \c constant value is
+ * already registered with that arena.
+ *
+ * \c ex_mem caches the value's ex-mem size so the builtin cost path does not
+ * walk the constant on every application. It starts at
+ * \ref CARDANO_UPLC_VALUE_EX_MEM_UNCOMPUTED and is filled lazily on first use by
+ * \ref cardano_uplc_value_ex_mem. The size depends only on the value's payload
+ * and the semantics flag, both fixed for the lifetime of the value, so the cache
+ * is always consistent.
+ */
+struct cardano_uplc_value_t
+{
+    cardano_uplc_value_kind_t kind;
+    int64_t                   ex_mem;
+
+    // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    union
+    {
+        const cardano_uplc_constant_t* constant;
+
+        struct
+        {
+            const cardano_uplc_term_t* body;
+            const cardano_uplc_env_t*  env;
+        } delay;
+
+        struct
+        {
+            const cardano_uplc_term_t* body;
+            const cardano_uplc_env_t*  env;
+        } lambda;
+
+        struct
+        {
+            cardano_uplc_builtin_t             func;
+            size_t                             forces;
+            const cardano_uplc_value_t* const* args;
+            size_t                             arg_count;
+        } builtin;
+
+        struct
+        {
+            uint64_t                           tag;
+            const cardano_uplc_value_t* const* fields;
+            size_t                             field_count;
+        } constr;
+
+        // cppcheck-suppress misra-c2012-19.2; Reason: tagged union is the VM value and cost-shape representation
+    } as;
+};
+
+/**
+ * \brief Builds a constant value wrapping an arena-owned constant.
+ *
+ * \param[in] arena The arena to allocate the value from. Must not be NULL.
+ * \param[in] constant The constant the value holds. Must not be NULL and must
+ *            live in \p arena.
+ * \param[out] out On success, set to the new value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         any argument is NULL, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if
+ *         the arena cannot serve the node.
+ */
+cardano_error_t
+cardano_uplc_value_new_constant(
+  struct cardano_uplc_arena_t*   arena,
+  const cardano_uplc_constant_t* constant,
+  cardano_uplc_value_t**         out);
+
+/**
+ * \brief Builds a delay value closing a body term over an environment.
+ *
+ * \param[in] arena The arena to allocate the value from. Must not be NULL.
+ * \param[in] body The delayed body term. Must not be NULL and must live in \p arena.
+ * \param[in] env The environment the delay closes over, or NULL for the empty
+ *            environment.
+ * \param[out] out On success, set to the new value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p body, or \p out is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_value_new_delay(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_term_t*   body,
+  const cardano_uplc_env_t*    env,
+  cardano_uplc_value_t**       out);
+
+/**
+ * \brief Builds a lambda closure closing a body term over an environment.
+ *
+ * The binder is implicit: applying the closure extends \p env with the argument
+ * value before computing \p body.
+ *
+ * \param[in] arena The arena to allocate the value from. Must not be NULL.
+ * \param[in] body The lambda body term. Must not be NULL and must live in \p arena.
+ * \param[in] env The environment the closure captures, or NULL for the empty
+ *            environment.
+ * \param[out] out On success, set to the new value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena, \p body, or \p out is NULL, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_value_new_lambda(
+  struct cardano_uplc_arena_t* arena,
+  const cardano_uplc_term_t*   body,
+  const cardano_uplc_env_t*    env,
+  cardano_uplc_value_t**       out);
+
+/**
+ * \brief Builds a partially applied builtin value.
+ *
+ * The \p args array and the values it points at must already live in \p arena;
+ * the constructor copies the pointers by reference, it does not copy the values.
+ * A builtin with no arguments yet is allowed with \p arg_count 0 and \p args
+ * NULL.
+ *
+ * \param[in] arena The arena to allocate the value from. Must not be NULL.
+ * \param[in] func The builtin function tag.
+ * \param[in] forces The number of forces applied to the builtin so far.
+ * \param[in] args The argument values applied so far, or NULL when \p arg_count
+ *            is 0.
+ * \param[in] arg_count The number of arguments applied so far.
+ * \param[out] out On success, set to the new value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p out is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p args is NULL while \p arg_count is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_value_new_builtin(
+  struct cardano_uplc_arena_t*       arena,
+  cardano_uplc_builtin_t             func,
+  size_t                             forces,
+  const cardano_uplc_value_t* const* args,
+  size_t                             arg_count,
+  cardano_uplc_value_t**             out);
+
+/**
+ * \brief Builds a constructor value from a tag and a resolved-field array.
+ *
+ * The \p fields array and the values it points at must already live in \p arena.
+ * A constructor with no fields is allowed with \p field_count 0 and \p fields
+ * NULL.
+ *
+ * \param[in] arena The arena to allocate the value from. Must not be NULL.
+ * \param[in] tag The constructor tag.
+ * \param[in] fields The resolved field values, or NULL when \p field_count is 0.
+ * \param[in] field_count The number of fields.
+ * \param[out] out On success, set to the new value; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p out is NULL, \ref CARDANO_ERROR_INVALID_ARGUMENT if
+ *         \p fields is NULL while \p field_count is non-zero, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena cannot serve
+ *         the node.
+ */
+cardano_error_t
+cardano_uplc_value_new_constr(
+  struct cardano_uplc_arena_t*       arena,
+  uint64_t                           tag,
+  const cardano_uplc_value_t* const* fields,
+  size_t                             field_count,
+  cardano_uplc_value_t**             out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_VALUE_H */
diff --git a/vendor/src/uplc/machine/uplc_value_kind.h b/vendor/src/uplc/machine/uplc_value_kind.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/machine/uplc_value_kind.h
@@ -0,0 +1,54 @@
+/**
+ * \file uplc_value_kind.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_VALUE_KIND_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_VALUE_KIND_H
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief The kind of a CEK runtime value.
+ *
+ * Selects the active arm of \ref cardano_uplc_value_t.
+ */
+typedef enum
+{
+  /** \brief A constant of the constant universe. */
+  CARDANO_UPLC_VALUE_CONSTANT = 0,
+  /** \brief A delayed computation closed over its environment. */
+  CARDANO_UPLC_VALUE_DELAY = 1,
+  /** \brief A lambda closure closed over its environment. */
+  CARDANO_UPLC_VALUE_LAMBDA = 2,
+  /** \brief A builtin with the forces and arguments accumulated so far. */
+  CARDANO_UPLC_VALUE_BUILTIN = 3,
+  /** \brief A constructor value carrying a tag and resolved fields. */
+  CARDANO_UPLC_VALUE_CONSTR = 4
+} cardano_uplc_value_kind_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_MACHINE_UPLC_VALUE_KIND_H */
diff --git a/vendor/src/uplc/syntax/pretty.c b/vendor/src/uplc/syntax/pretty.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/syntax/pretty.c
@@ -0,0 +1,1272 @@
+/**
+ * \file pretty.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "pretty.h"
+
+#include "../../allocators.h"
+#include "../ast/uplc_int.h"
+#include "../builtins/bls.h"
+#include "../data/uplc_data.h"
+
+#include <cardano/common/bigint.h>
+#include <cardano/plutus_data/constr_plutus_data.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/plutus_data/plutus_list.h>
+#include <cardano/plutus_data/plutus_map.h>
+
+#include <src/string_safe.h>
+
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief Initial capacity, in bytes, of the output buffer.
+ */
+static const size_t PRETTY_INITIAL_CAPACITY = 256U;
+
+/**
+ * \brief Maximum term and data nesting the renderer descends before refusing.
+ *
+ * Bounds recursion so a deeply nested adversarial term cannot exhaust the C
+ * stack while being printed; past it the renderer returns
+ * \ref CARDANO_ERROR_ILLEGAL_STATE.
+ */
+static const uint32_t PRETTY_MAX_DEPTH = 2000U;
+
+/**
+ * \brief Size of the scratch buffer used to format a 64-bit value in decimal,
+ *        wide enough for any uint64_t plus the NUL terminator.
+ */
+#define PRETTY_INDEX_BUFFER_SIZE 24
+
+/**
+ * \brief Numeric base used when rendering big integers.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int32_t PRETTY_DECIMAL_BASE = 10;
+
+/**
+ * \brief Surface-syntax name of every builtin, indexed by
+ *        \ref cardano_uplc_builtin_t.
+ *
+ * The names are the textual UPLC surface form of each builtin, indexed by the
+ * builtin tag (see uplc_builtin.h).
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const char* const BUILTIN_NAME[CARDANO_UPLC_BUILTIN_COUNT] = {
+  [CARDANO_UPLC_BUILTIN_ADD_INTEGER]                        = "addInteger",
+  [CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER]                   = "subtractInteger",
+  [CARDANO_UPLC_BUILTIN_MULTIPLY_INTEGER]                   = "multiplyInteger",
+  [CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER]                     = "divideInteger",
+  [CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER]                   = "quotientInteger",
+  [CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER]                  = "remainderInteger",
+  [CARDANO_UPLC_BUILTIN_MOD_INTEGER]                        = "modInteger",
+  [CARDANO_UPLC_BUILTIN_EQUALS_INTEGER]                     = "equalsInteger",
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER]                  = "lessThanInteger",
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER]           = "lessThanEqualsInteger",
+  [CARDANO_UPLC_BUILTIN_APPEND_BYTE_STRING]                 = "appendByteString",
+  [CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING]                   = "consByteString",
+  [CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING]                  = "sliceByteString",
+  [CARDANO_UPLC_BUILTIN_LENGTH_OF_BYTE_STRING]              = "lengthOfByteString",
+  [CARDANO_UPLC_BUILTIN_INDEX_BYTE_STRING]                  = "indexByteString",
+  [CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING]                 = "equalsByteString",
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING]              = "lessThanByteString",
+  [CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING]       = "lessThanEqualsByteString",
+  [CARDANO_UPLC_BUILTIN_SHA2_256]                           = "sha2_256",
+  [CARDANO_UPLC_BUILTIN_SHA3_256]                           = "sha3_256",
+  [CARDANO_UPLC_BUILTIN_BLAKE2B_256]                        = "blake2b_256",
+  [CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE]           = "verifyEd25519Signature",
+  [CARDANO_UPLC_BUILTIN_APPEND_STRING]                      = "appendString",
+  [CARDANO_UPLC_BUILTIN_EQUALS_STRING]                      = "equalsString",
+  [CARDANO_UPLC_BUILTIN_ENCODE_UTF8]                        = "encodeUtf8",
+  [CARDANO_UPLC_BUILTIN_DECODE_UTF8]                        = "decodeUtf8",
+  [CARDANO_UPLC_BUILTIN_IF_THEN_ELSE]                       = "ifThenElse",
+  [CARDANO_UPLC_BUILTIN_CHOOSE_UNIT]                        = "chooseUnit",
+  [CARDANO_UPLC_BUILTIN_TRACE]                              = "trace",
+  [CARDANO_UPLC_BUILTIN_FST_PAIR]                           = "fstPair",
+  [CARDANO_UPLC_BUILTIN_SND_PAIR]                           = "sndPair",
+  [CARDANO_UPLC_BUILTIN_CHOOSE_LIST]                        = "chooseList",
+  [CARDANO_UPLC_BUILTIN_MK_CONS]                            = "mkCons",
+  [CARDANO_UPLC_BUILTIN_HEAD_LIST]                          = "headList",
+  [CARDANO_UPLC_BUILTIN_TAIL_LIST]                          = "tailList",
+  [CARDANO_UPLC_BUILTIN_NULL_LIST]                          = "nullList",
+  [CARDANO_UPLC_BUILTIN_CHOOSE_DATA]                        = "chooseData",
+  [CARDANO_UPLC_BUILTIN_CONSTR_DATA]                        = "constrData",
+  [CARDANO_UPLC_BUILTIN_MAP_DATA]                           = "mapData",
+  [CARDANO_UPLC_BUILTIN_LIST_DATA]                          = "listData",
+  [CARDANO_UPLC_BUILTIN_I_DATA]                             = "iData",
+  [CARDANO_UPLC_BUILTIN_B_DATA]                             = "bData",
+  [CARDANO_UPLC_BUILTIN_UN_CONSTR_DATA]                     = "unConstrData",
+  [CARDANO_UPLC_BUILTIN_UN_MAP_DATA]                        = "unMapData",
+  [CARDANO_UPLC_BUILTIN_UN_LIST_DATA]                       = "unListData",
+  [CARDANO_UPLC_BUILTIN_UN_I_DATA]                          = "unIData",
+  [CARDANO_UPLC_BUILTIN_UN_B_DATA]                          = "unBData",
+  [CARDANO_UPLC_BUILTIN_EQUALS_DATA]                        = "equalsData",
+  [CARDANO_UPLC_BUILTIN_MK_PAIR_DATA]                       = "mkPairData",
+  [CARDANO_UPLC_BUILTIN_MK_NIL_DATA]                        = "mkNilData",
+  [CARDANO_UPLC_BUILTIN_MK_NIL_PAIR_DATA]                   = "mkNilPairData",
+  [CARDANO_UPLC_BUILTIN_SERIALISE_DATA]                     = "serialiseData",
+  [CARDANO_UPLC_BUILTIN_VERIFY_ECDSA_SECP256K1_SIGNATURE]   = "verifyEcdsaSecp256k1Signature",
+  [CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE] = "verifySchnorrSecp256k1Signature",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_ADD]                   = "bls12_381_G1_add",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_NEG]                   = "bls12_381_G1_neg",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_SCALAR_MUL]            = "bls12_381_G1_scalarMul",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_EQUAL]                 = "bls12_381_G1_equal",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_COMPRESS]              = "bls12_381_G1_compress",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_UNCOMPRESS]            = "bls12_381_G1_uncompress",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_HASH_TO_GROUP]         = "bls12_381_G1_hashToGroup",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_ADD]                   = "bls12_381_G2_add",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_NEG]                   = "bls12_381_G2_neg",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_SCALAR_MUL]            = "bls12_381_G2_scalarMul",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_EQUAL]                 = "bls12_381_G2_equal",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_COMPRESS]              = "bls12_381_G2_compress",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_UNCOMPRESS]            = "bls12_381_G2_uncompress",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_HASH_TO_GROUP]         = "bls12_381_G2_hashToGroup",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_MILLER_LOOP]              = "bls12_381_millerLoop",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_MUL_ML_RESULT]            = "bls12_381_mulMlResult",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_FINAL_VERIFY]             = "bls12_381_finalVerify",
+  [CARDANO_UPLC_BUILTIN_KECCAK_256]                         = "keccak_256",
+  [CARDANO_UPLC_BUILTIN_BLAKE2B_224]                        = "blake2b_224",
+  [CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING]             = "integerToByteString",
+  [CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER]             = "byteStringToInteger",
+  [CARDANO_UPLC_BUILTIN_AND_BYTE_STRING]                    = "andByteString",
+  [CARDANO_UPLC_BUILTIN_OR_BYTE_STRING]                     = "orByteString",
+  [CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING]                    = "xorByteString",
+  [CARDANO_UPLC_BUILTIN_COMPLEMENT_BYTE_STRING]             = "complementByteString",
+  [CARDANO_UPLC_BUILTIN_READ_BIT]                           = "readBit",
+  [CARDANO_UPLC_BUILTIN_WRITE_BITS]                         = "writeBits",
+  [CARDANO_UPLC_BUILTIN_REPLICATE_BYTE]                     = "replicateByte",
+  [CARDANO_UPLC_BUILTIN_SHIFT_BYTE_STRING]                  = "shiftByteString",
+  [CARDANO_UPLC_BUILTIN_ROTATE_BYTE_STRING]                 = "rotateByteString",
+  [CARDANO_UPLC_BUILTIN_COUNT_SET_BITS]                     = "countSetBits",
+  [CARDANO_UPLC_BUILTIN_FIND_FIRST_SET_BIT]                 = "findFirstSetBit",
+  [CARDANO_UPLC_BUILTIN_RIPEMD_160]                         = "ripemd_160",
+  [CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER]                    = "expModInteger",
+  [CARDANO_UPLC_BUILTIN_DROP_LIST]                          = "dropList",
+  [CARDANO_UPLC_BUILTIN_LENGTH_OF_ARRAY]                    = "lengthOfArray",
+  [CARDANO_UPLC_BUILTIN_LIST_TO_ARRAY]                      = "listToArray",
+  [CARDANO_UPLC_BUILTIN_INDEX_ARRAY]                        = "indexArray",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G1_MULTI_SCALAR_MUL]      = "bls12_381_G1_multiScalarMul",
+  [CARDANO_UPLC_BUILTIN_BLS12_381_G2_MULTI_SCALAR_MUL]      = "bls12_381_G2_multiScalarMul",
+  [CARDANO_UPLC_BUILTIN_INSERT_COIN]                        = "insertCoin",
+  [CARDANO_UPLC_BUILTIN_LOOKUP_COIN]                        = "lookupCoin",
+  [CARDANO_UPLC_BUILTIN_UNION_VALUE]                        = "unionValue",
+  [CARDANO_UPLC_BUILTIN_VALUE_CONTAINS]                     = "valueContains",
+  [CARDANO_UPLC_BUILTIN_VALUE_DATA]                         = "valueData",
+  [CARDANO_UPLC_BUILTIN_UN_VALUE_DATA]                      = "unValueData",
+  [CARDANO_UPLC_BUILTIN_SCALE_VALUE]                        = "scaleValue",
+  [CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY]                  = "multiIndexArray",
+  [CARDANO_UPLC_BUILTIN_POLICIES]                           = "policies",
+  [CARDANO_UPLC_BUILTIN_ASSET_COUNT]                        = "assetCount",
+  [CARDANO_UPLC_BUILTIN_KEEP_POLICIES]                      = "keepPolicies",
+  [CARDANO_UPLC_BUILTIN_DROP_POLICIES]                      = "dropPolicies"
+};
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Append-only writer over an output buffer with a sticky error.
+ *
+ * Every append goes through one of the writer helpers, which record the first
+ * failure in \c status and become no-ops afterwards, so the renderer can run to
+ * completion and report a single error rather than checking each append.
+ */
+typedef struct
+{
+    cardano_buffer_t* buffer;
+    cardano_error_t   status;
+} writer_t;
+
+/* STATIC FUNCTION DECLARATIONS *********************************************/
+
+static cardano_error_t print_term(writer_t* writer, const cardano_uplc_term_t* term, uint32_t depth, uint32_t binders);
+static void            print_constant(writer_t* writer, const cardano_uplc_constant_t* constant, uint32_t depth);
+static void            print_data(writer_t* writer, const cardano_uplc_data_t* data, uint32_t depth);
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Appends \p length bytes of \p text to the writer if no error is pending.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] text The bytes to append.
+ * \param[in] length The number of bytes to append.
+ */
+static void
+write_text(writer_t* writer, const char* text, const size_t length)
+{
+  if (writer->status != CARDANO_SUCCESS)
+  {
+    return;
+  }
+
+  writer->status = cardano_buffer_write(writer->buffer, (const byte_t*)text, length);
+}
+
+/**
+ * \brief Appends a NUL-terminated string to the writer.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] text The NUL-terminated string to append.
+ */
+static void
+write_str(writer_t* writer, const char* text)
+{
+  write_text(writer, text, cardano_safe_strlen(text, 256U));
+}
+
+/**
+ * \brief Appends a single character to the writer.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] character The character to append.
+ */
+static void
+write_char(writer_t* writer, const char character)
+{
+  write_text(writer, &character, 1U);
+}
+
+/**
+ * \brief Appends an unsigned 64-bit value in decimal to the writer.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] value The value to append.
+ */
+static void
+write_u64(writer_t* writer, const uint64_t value)
+{
+  char buffer[PRETTY_INDEX_BUFFER_SIZE];
+  int  written = snprintf(buffer, sizeof(buffer), "%" PRIu64, value);
+
+  if (written < 0)
+  {
+    if (writer->status == CARDANO_SUCCESS)
+    {
+      writer->status = CARDANO_ERROR_ENCODING;
+    }
+
+    return;
+  }
+
+  write_text(writer, buffer, (size_t)written);
+}
+
+/**
+ * \brief Appends a signed 64-bit value in decimal to the writer.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] value The value to append.
+ */
+static void
+write_i64(writer_t* writer, const int64_t value)
+{
+  char buffer[PRETTY_INDEX_BUFFER_SIZE];
+  int  written = snprintf(buffer, sizeof(buffer), "%" PRId64, value);
+
+  if (written < 0)
+  {
+    if (writer->status == CARDANO_SUCCESS)
+    {
+      writer->status = CARDANO_ERROR_ENCODING;
+    }
+
+    return;
+  }
+
+  write_text(writer, buffer, (size_t)written);
+}
+
+/**
+ * \brief Appends a big integer in decimal to the writer.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] value The integer to append; a NULL value is printed as 0.
+ */
+static void
+write_bigint(writer_t* writer, const cardano_bigint_t* value)
+{
+  size_t size   = 0U;
+  char*  string = NULL;
+
+  if (writer->status != CARDANO_SUCCESS)
+  {
+    return;
+  }
+
+  if (value == NULL)
+  {
+    write_char(writer, '0');
+    return;
+  }
+
+  size   = cardano_bigint_get_string_size(value, PRETTY_DECIMAL_BASE);
+  string = (char*)_cardano_malloc(size);
+
+  if (string == NULL)
+  {
+    writer->status = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    return;
+  }
+
+  writer->status = cardano_bigint_to_string(value, string, size, PRETTY_DECIMAL_BASE);
+
+  if (writer->status == CARDANO_SUCCESS)
+  {
+    write_str(writer, string);
+  }
+
+  _cardano_free(string);
+}
+
+/**
+ * \brief Appends a raw byte span as a hex string prefixed with '#'.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] data The bytes to render; a NULL or empty span prints just '#'.
+ * \param[in] size The number of bytes.
+ */
+static void
+write_hex(writer_t* writer, const byte_t* data, size_t size)
+{
+  static const char digits[] = "0123456789abcdef";
+  size_t            i        = 0U;
+
+  if (writer->status != CARDANO_SUCCESS)
+  {
+    return;
+  }
+
+  write_char(writer, '#');
+
+  if ((data == NULL) || (size == 0U))
+  {
+    return;
+  }
+
+  for (i = 0U; (i < size) && (writer->status == CARDANO_SUCCESS); ++i)
+  {
+    write_char(writer, digits[(data[i] >> 4) & 0x0FU]);
+    write_char(writer, digits[data[i] & 0x0FU]);
+  }
+}
+
+/**
+ * \brief Appends a string constant's contents wrapped in double quotes.
+ *
+ * Backslash and double-quote bytes are escaped; every other byte is emitted
+ * verbatim, which preserves the UTF-8 contents the constant was built with.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] data The text bytes; a NULL span prints an empty string.
+ * \param[in] size The number of bytes.
+ */
+static void
+write_string(writer_t* writer, const byte_t* data, size_t size)
+{
+  size_t i = 0U;
+
+  write_char(writer, '"');
+
+  for (i = 0U; i < size; ++i)
+  {
+    char c = (char)data[i];
+
+    if ((c == '"') || (c == '\\'))
+    {
+      write_char(writer, '\\');
+    }
+
+    write_char(writer, c);
+  }
+
+  write_char(writer, '"');
+}
+
+/**
+ * \brief Appends the type-list head of a constant type descriptor.
+ *
+ * Renders the type names the way they appear inside \c (con <type> ...): bare
+ * \c integer, \c bytestring, \c string, \c unit, \c bool and \c data, and the
+ * parenthesised \c (list T) and \c (pair A B) forms. BLS types are reserved and
+ * print their reserved names.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] type The type descriptor; a NULL type prints \c unit.
+ */
+static void
+print_type(writer_t* writer, const cardano_uplc_type_t* type)
+{
+  if (type == NULL)
+  {
+    write_str(writer, "unit");
+    return;
+  }
+
+  switch (type->kind)
+  {
+    case CARDANO_UPLC_TYPE_INTEGER:
+    {
+      write_str(writer, "integer");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    {
+      write_str(writer, "bytestring");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_STRING:
+    {
+      write_str(writer, "string");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_UNIT:
+    {
+      write_str(writer, "unit");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BOOL:
+    {
+      write_str(writer, "bool");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_LIST:
+    {
+      write_str(writer, "(list ");
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      print_type(writer, type->fst);
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TYPE_ARRAY:
+    {
+      write_str(writer, "(array ");
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      print_type(writer, type->fst);
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      write_str(writer, "(pair ");
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      print_type(writer, type->fst);
+      write_char(writer, ' ');
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      print_type(writer, type->snd);
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TYPE_DATA:
+    {
+      write_str(writer, "data");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    {
+      write_str(writer, "bls12_381_G1_element");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    {
+      write_str(writer, "bls12_381_G2_element");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    {
+      write_str(writer, "bls12_381_mlresult");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_VALUE:
+    {
+      write_str(writer, "value");
+      break;
+    }
+    default:
+    {
+      if (writer->status == CARDANO_SUCCESS)
+      {
+        writer->status = CARDANO_ERROR_INVALID_ARGUMENT;
+      }
+      break;
+    }
+  }
+}
+
+/**
+ * \brief Appends an arena data value in the textual data syntax.
+ *
+ * Renders the same forms the conformance corpus uses for the contents of a
+ * \c (con data ...) constant: \c Constr <i> [..], \c Map [(k, v), ..],
+ * \c List [..], \c I <integer> and \c B #hex. Recursion is bounded by \p depth.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] data The arena data node to render.
+ * \param[in] depth The current nesting depth, checked against the ceiling.
+ */
+static void
+print_data(writer_t* writer, const cardano_uplc_data_t* data, const uint32_t depth)
+{
+  size_t i = 0U;
+
+  if (writer->status != CARDANO_SUCCESS)
+  {
+    return;
+  }
+
+  if (depth >= PRETTY_MAX_DEPTH)
+  {
+    writer->status = CARDANO_ERROR_ILLEGAL_STATE;
+    return;
+  }
+
+  if (data == NULL)
+  {
+    writer->status = CARDANO_ERROR_POINTER_IS_NULL;
+    return;
+  }
+
+  switch (data->kind)
+  {
+    case CARDANO_UPLC_DATA_KIND_CONSTR:
+    {
+      write_str(writer, "Constr ");
+      write_u64(writer, data->as.constr.tag);
+      write_str(writer, " [");
+
+      for (i = 0U; i < data->as.constr.count; ++i)
+      {
+        if (i > 0U)
+        {
+          write_str(writer, ", ");
+        }
+
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        print_data(writer, data->as.constr.fields[i], depth + 1U);
+      }
+
+      write_char(writer, ']');
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_MAP:
+    {
+      write_str(writer, "Map [");
+
+      for (i = 0U; i < data->as.map.count; ++i)
+      {
+        if (i > 0U)
+        {
+          write_str(writer, ", ");
+        }
+
+        write_char(writer, '(');
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        print_data(writer, data->as.map.entries[i].key, depth + 1U);
+        write_str(writer, ", ");
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        print_data(writer, data->as.map.entries[i].value, depth + 1U);
+        write_char(writer, ')');
+      }
+
+      write_char(writer, ']');
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_LIST:
+    {
+      write_str(writer, "List [");
+
+      for (i = 0U; i < data->as.list.count; ++i)
+      {
+        if (i > 0U)
+        {
+          write_str(writer, ", ");
+        }
+
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        print_data(writer, data->as.list.items[i], depth + 1U);
+      }
+
+      write_char(writer, ']');
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_INTEGER:
+    {
+      write_str(writer, "I ");
+
+      if (data->as.integer.is_small)
+      {
+        write_i64(writer, data->as.integer.small);
+      }
+      else
+      {
+        write_bigint(writer, data->as.integer.big);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_DATA_KIND_BYTES:
+    {
+      write_str(writer, "B ");
+      write_hex(writer, data->as.bytes.data, data->as.bytes.size);
+
+      break;
+    }
+    default:
+    {
+      writer->status = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+}
+
+/**
+ * \brief Appends a raw byte span as a \c 0x-prefixed lowercase hex string.
+ *
+ * The surface form a BLS12-381 element constant uses for its compressed point.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] data The bytes to render.
+ * \param[in] size The number of bytes.
+ */
+static void
+write_0x_hex(writer_t* writer, const byte_t* data, const size_t size)
+{
+  static const char digits[] = "0123456789abcdef";
+  size_t            i        = 0U;
+
+  if (writer->status != CARDANO_SUCCESS)
+  {
+    return;
+  }
+
+  write_str(writer, "0x");
+
+  for (i = 0U; i < size; ++i)
+  {
+    char pair[2];
+
+    pair[0] = digits[(data[i] >> 4U) & 0x0FU];
+    pair[1] = digits[data[i] & 0x0FU];
+
+    write_text(writer, pair, 2U);
+  }
+}
+
+/**
+ * \brief Appends a BLS12-381 element constant as its \c 0x compressed-point hex.
+ *
+ * G1 and G2 elements compress to their fixed serialization; an ML-result has no
+ * surface form, so it is rejected with \ref CARDANO_ERROR_NOT_IMPLEMENTED.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] constant The BLS constant whose compressed point to render.
+ */
+static void
+write_bls(writer_t* writer, const cardano_uplc_constant_t* constant)
+{
+  if (writer->status != CARDANO_SUCCESS)
+  {
+    return;
+  }
+
+  if (constant->kind == CARDANO_UPLC_TYPE_BLS_G1)
+  {
+    byte_t out[CARDANO_UPLC_BLS_G1_COMPRESSED_SIZE];
+
+    writer->status = cardano_uplc_int_bls_g1_compress(constant, out);
+
+    if (writer->status == CARDANO_SUCCESS)
+    {
+      write_0x_hex(writer, out, CARDANO_UPLC_BLS_G1_COMPRESSED_SIZE);
+    }
+  }
+  else if (constant->kind == CARDANO_UPLC_TYPE_BLS_G2)
+  {
+    byte_t out[CARDANO_UPLC_BLS_G2_COMPRESSED_SIZE];
+
+    writer->status = cardano_uplc_int_bls_g2_compress(constant, out);
+
+    if (writer->status == CARDANO_SUCCESS)
+    {
+      write_0x_hex(writer, out, CARDANO_UPLC_BLS_G2_COMPRESSED_SIZE);
+    }
+  }
+  else
+  {
+    writer->status = CARDANO_ERROR_NOT_IMPLEMENTED;
+  }
+}
+
+/**
+ * \brief Appends a constant value's contents without the \c con head, as it
+ *        appears as an item of a list or a component of a pair.
+ *
+ * This is the bare form: \c 12345, \c #hex, a quoted string, \c (), \c True,
+ * a bracketed list, a parenthesised pair, the data forms, or a \c 0x BLS point.
+ * The leading type head belongs to the surrounding \c (con <type> ...) or
+ * \c (list T) and is not repeated here.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] constant The constant whose value to render.
+ * \param[in] depth The current nesting depth, checked against the ceiling.
+ */
+static void
+print_value(writer_t* writer, const cardano_uplc_constant_t* constant, const uint32_t depth)
+{
+  if (writer->status != CARDANO_SUCCESS)
+  {
+    return;
+  }
+
+  if (depth >= PRETTY_MAX_DEPTH)
+  {
+    writer->status = CARDANO_ERROR_ILLEGAL_STATE;
+    return;
+  }
+
+  if (constant == NULL)
+  {
+    writer->status = CARDANO_ERROR_POINTER_IS_NULL;
+    return;
+  }
+
+  switch (constant->kind)
+  {
+    case CARDANO_UPLC_TYPE_INTEGER:
+    {
+      if (cardano_uplc_constant_int_is_small(constant))
+      {
+        write_i64(writer, cardano_uplc_constant_int_small(constant));
+      }
+      else
+      {
+        write_bigint(writer, constant->as.integer.big);
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    {
+      write_hex(writer, constant->as.bytes.data, constant->as.bytes.size);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_STRING:
+    {
+      write_string(writer, constant->as.string.data, constant->as.string.size);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_UNIT:
+    {
+      write_str(writer, "()");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BOOL:
+    {
+      write_str(writer, constant->as.boolean ? "True" : "False");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_LIST:
+    case CARDANO_UPLC_TYPE_ARRAY:
+    case CARDANO_UPLC_TYPE_VALUE:
+    {
+      size_t i = 0U;
+
+      write_char(writer, '[');
+
+      for (i = 0U; i < constant->as.list.count; ++i)
+      {
+        if (i > 0U)
+        {
+          write_str(writer, ", ");
+        }
+
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        print_value(writer, constant->as.list.items[i], depth + 1U);
+      }
+
+      write_char(writer, ']');
+      break;
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      write_char(writer, '(');
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      print_value(writer, constant->as.pair.fst, depth + 1U);
+      write_str(writer, ", ");
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      print_value(writer, constant->as.pair.snd, depth + 1U);
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TYPE_DATA:
+    {
+      print_data(writer, constant->as.data, depth + 1U);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    {
+      write_bls(writer, constant);
+      break;
+    }
+    default:
+    {
+      writer->status = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+}
+
+/**
+ * \brief Appends the type head of a constant for the \c (con <type> ...) form.
+ *
+ * The leaf kinds map to their bare names. A list takes its element type from the
+ * stored \c element_type descriptor; a pair has no stored component-type
+ * descriptors, so its component types are reconstructed from the kinds of its
+ * actual component constants, recursing for nested lists and pairs.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] constant The constant whose type head to render.
+ */
+static void
+print_constant_type(writer_t* writer, const cardano_uplc_constant_t* constant)
+{
+  if (constant == NULL)
+  {
+    if (writer->status == CARDANO_SUCCESS)
+    {
+      writer->status = CARDANO_ERROR_POINTER_IS_NULL;
+    }
+    return;
+  }
+
+  switch (constant->kind)
+  {
+    case CARDANO_UPLC_TYPE_INTEGER:
+    {
+      write_str(writer, "integer");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    {
+      write_str(writer, "bytestring");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_STRING:
+    {
+      write_str(writer, "string");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_UNIT:
+    {
+      write_str(writer, "unit");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BOOL:
+    {
+      write_str(writer, "bool");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_LIST:
+    {
+      write_str(writer, "(list ");
+      print_type(writer, constant->as.list.element_type);
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TYPE_ARRAY:
+    {
+      write_str(writer, "(array ");
+      print_type(writer, constant->as.list.element_type);
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      write_str(writer, "(pair ");
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      print_constant_type(writer, constant->as.pair.fst);
+      write_char(writer, ' ');
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      print_constant_type(writer, constant->as.pair.snd);
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TYPE_DATA:
+    {
+      write_str(writer, "data");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    {
+      write_str(writer, "bls12_381_G1_element");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    {
+      write_str(writer, "bls12_381_G2_element");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    {
+      write_str(writer, "bls12_381_mlresult");
+      break;
+    }
+    case CARDANO_UPLC_TYPE_VALUE:
+    {
+      write_str(writer, "value");
+      break;
+    }
+    default:
+    {
+      if (writer->status == CARDANO_SUCCESS)
+      {
+        writer->status = CARDANO_ERROR_INVALID_ARGUMENT;
+      }
+      break;
+    }
+  }
+}
+
+/**
+ * \brief Appends a constant as the contents of a \c (con ...) term.
+ *
+ * Writes the type head followed by a space and the bare value, for example
+ * \c integer 23 or \c (pair integer bool) (12345, True).
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] constant The constant to render.
+ * \param[in] depth The current nesting depth, checked against the ceiling.
+ */
+static void
+print_constant(writer_t* writer, const cardano_uplc_constant_t* constant, const uint32_t depth)
+{
+  if (writer->status != CARDANO_SUCCESS)
+  {
+    return;
+  }
+
+  if (constant == NULL)
+  {
+    writer->status = CARDANO_ERROR_POINTER_IS_NULL;
+    return;
+  }
+
+  print_constant_type(writer, constant);
+  write_char(writer, ' ');
+
+  if (constant->kind == CARDANO_UPLC_TYPE_DATA)
+  {
+    write_char(writer, '(');
+    print_value(writer, constant, depth);
+    write_char(writer, ')');
+  }
+  else
+  {
+    print_value(writer, constant, depth);
+  }
+}
+
+/**
+ * \brief Appends the binder name introduced at de Bruijn level \p level.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] prefix The base name of the binder.
+ * \param[in] level The zero-based level counting binders from the outermost.
+ */
+static void
+write_binder(writer_t* writer, const char* prefix, const uint64_t level)
+{
+  write_str(writer, prefix);
+  write_char(writer, '-');
+  write_u64(writer, level);
+}
+
+/**
+ * \brief Appends a variable term resolved against the binders in scope.
+ *
+ * A variable with de Bruijn index \p index (1 names the innermost binder) under
+ * \p binders binders in scope names the binder at level \c binders-index, which
+ * is printed as \c v-<level>. An index that escapes the binders in scope (a free
+ * variable) is printed as \c free-<index>, so rendering never fails on a
+ * malformed term.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] index The de Bruijn index.
+ * \param[in] binders The number of binders currently in scope.
+ */
+static void
+print_var(writer_t* writer, const uint64_t index, const uint32_t binders)
+{
+  if ((index >= 1U) && (index <= (uint64_t)binders))
+  {
+    write_binder(writer, "v", (uint64_t)binders - index);
+  }
+  else
+  {
+    write_binder(writer, "free", index);
+  }
+}
+
+/**
+ * \brief Appends a term in the textual surface syntax.
+ *
+ * \param[in,out] writer The writer to append to.
+ * \param[in] term The term to render.
+ * \param[in] depth The current nesting depth, checked against the ceiling.
+ * \param[in] binders The number of binders in scope, used to name variables and
+ *            lambda binders.
+ *
+ * \return The writer status after rendering: \ref CARDANO_SUCCESS, or the first
+ *         error recorded.
+ */
+static cardano_error_t
+print_term(writer_t* writer, const cardano_uplc_term_t* term, const uint32_t depth, const uint32_t binders)
+{
+  if (writer->status != CARDANO_SUCCESS)
+  {
+    return writer->status;
+  }
+
+  if (depth >= PRETTY_MAX_DEPTH)
+  {
+    writer->status = CARDANO_ERROR_ILLEGAL_STATE;
+    return writer->status;
+  }
+
+  if (term == NULL)
+  {
+    writer->status = CARDANO_ERROR_POINTER_IS_NULL;
+    return writer->status;
+  }
+
+  switch (term->kind)
+  {
+    case CARDANO_UPLC_TERM_VAR:
+    {
+      print_var(writer, term->as.var_index, binders);
+      break;
+    }
+    case CARDANO_UPLC_TERM_DELAY:
+    {
+      write_str(writer, "(delay ");
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      (void)print_term(writer, term->as.unary, depth + 1U, binders);
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TERM_LAMBDA:
+    {
+      write_str(writer, "(lam ");
+      write_binder(writer, "v", binders);
+      write_char(writer, ' ');
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      (void)print_term(writer, term->as.unary, depth + 1U, binders + 1U);
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TERM_APPLY:
+    {
+      write_str(writer, "[ ");
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      (void)print_term(writer, term->as.apply.function, depth + 1U, binders);
+      write_char(writer, ' ');
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      (void)print_term(writer, term->as.apply.argument, depth + 1U, binders);
+      write_str(writer, " ]");
+      break;
+    }
+    case CARDANO_UPLC_TERM_CONSTANT:
+    {
+      write_str(writer, "(con ");
+      print_constant(writer, term->as.constant, depth + 1U);
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TERM_FORCE:
+    {
+      write_str(writer, "(force ");
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      (void)print_term(writer, term->as.unary, depth + 1U, binders);
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TERM_ERROR:
+    {
+      write_str(writer, "(error)");
+      break;
+    }
+    case CARDANO_UPLC_TERM_BUILTIN:
+    {
+      write_str(writer, "(builtin ");
+
+      if (((int)term->as.builtin >= 0) && ((size_t)term->as.builtin < (size_t)CARDANO_UPLC_BUILTIN_COUNT))
+      {
+        write_str(writer, BUILTIN_NAME[(size_t)term->as.builtin]);
+      }
+      else if (writer->status == CARDANO_SUCCESS)
+      {
+        writer->status = CARDANO_ERROR_INVALID_ARGUMENT;
+      }
+      else
+      {
+        /* status already records a prior error; leave it untouched */
+      }
+
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TERM_CONSTR:
+    {
+      size_t i = 0U;
+
+      write_str(writer, "(constr ");
+      write_u64(writer, term->as.constr.tag);
+
+      for (i = 0U; i < term->as.constr.field_count; ++i)
+      {
+        write_char(writer, ' ');
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        (void)print_term(writer, term->as.constr.fields[i], depth + 1U, binders);
+      }
+
+      write_char(writer, ')');
+      break;
+    }
+    case CARDANO_UPLC_TERM_CASE:
+    {
+      size_t i = 0U;
+
+      write_str(writer, "(case ");
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      (void)print_term(writer, term->as.cases.scrutinee, depth + 1U, binders);
+
+      for (i = 0U; i < term->as.cases.branch_count; ++i)
+      {
+        write_char(writer, ' ');
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        (void)print_term(writer, term->as.cases.branches[i], depth + 1U, binders);
+      }
+
+      write_char(writer, ')');
+      break;
+    }
+    default:
+    {
+      if (writer->status == CARDANO_SUCCESS)
+      {
+        writer->status = CARDANO_ERROR_INVALID_ARGUMENT;
+      }
+      break;
+    }
+  }
+
+  return writer->status;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_pretty_print_term(const cardano_uplc_term_t* term, cardano_buffer_t** out)
+{
+  writer_t writer = { NULL, CARDANO_SUCCESS };
+  byte_t   nul    = 0U;
+
+  if ((term == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  writer.buffer = cardano_buffer_new(PRETTY_INITIAL_CAPACITY);
+
+  if (writer.buffer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (void)print_term(&writer, term, 0U, 0U);
+
+  if (writer.status == CARDANO_SUCCESS)
+  {
+    writer.status = cardano_buffer_write(writer.buffer, &nul, 1U);
+  }
+
+  if (writer.status != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&writer.buffer);
+    return writer.status;
+  }
+
+  *out = writer.buffer;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_uplc_pretty_print_program(const cardano_uplc_program_t* program, cardano_buffer_t** out)
+{
+  writer_t writer = { NULL, CARDANO_SUCCESS };
+  byte_t   nul    = 0U;
+
+  if ((program == NULL) || (out == NULL) || (program->term == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  writer.buffer = cardano_buffer_new(PRETTY_INITIAL_CAPACITY);
+
+  if (writer.buffer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  write_str(&writer, "(program ");
+  write_u64(&writer, (uint64_t)program->version_major);
+  write_char(&writer, '.');
+  write_u64(&writer, (uint64_t)program->version_minor);
+  write_char(&writer, '.');
+  write_u64(&writer, (uint64_t)program->version_patch);
+  write_char(&writer, ' ');
+  (void)print_term(&writer, program->term, 0U, 0U);
+  write_char(&writer, ')');
+
+  if (writer.status == CARDANO_SUCCESS)
+  {
+    writer.status = cardano_buffer_write(writer.buffer, &nul, 1U);
+  }
+
+  if (writer.status != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&writer.buffer);
+    return writer.status;
+  }
+
+  *out = writer.buffer;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/uplc/syntax/pretty.h b/vendor/src/uplc/syntax/pretty.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/syntax/pretty.h
@@ -0,0 +1,102 @@
+/**
+ * \file pretty.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_SYNTAX_PRETTY_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_SYNTAX_PRETTY_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_program.h"
+#include "../ast/uplc_term.h"
+#include <cardano/buffer.h>
+#include <cardano/error.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Renders an Untyped Plutus Core term to the textual surface syntax.
+ *
+ * The output is the human-readable surface syntax the Plutus conformance
+ * \c .uplc.expected files use, produced for diagnostics and round-trip checks
+ * rather than for the consensus-critical comparison, which is done structurally
+ * on the de Bruijn AST. Application is rendered as \c [ f x ], constants as
+ * \c (con \<type\> \<value\>), and the other term forms with their \c (lam ...),
+ * \c (delay ...), \c (force ...), \c (error), \c (builtin name), \c (constr ...)
+ * and \c (case ...) heads. The result is one compact line with single-space
+ * separators and is NUL-terminated.
+ *
+ * Because the AST carries de Bruijn indices and no binder names, a lambda binder
+ * is printed as \c v-\<level\>, where \c level counts binders from the outermost
+ * (zero-based), and a variable prints the same name as the binder it resolves to.
+ * A variable whose index escapes the binders in scope (a free variable) is
+ * printed as \c free-\<index\> so rendering never fails on a malformed term.
+ *
+ * \param[in] term The term to render. Must not be NULL.
+ * \param[out] out On success, a newly allocated buffer holding the rendered,
+ *             NUL-terminated text; the caller owns it and must release it with
+ *             \ref cardano_buffer_unref. Left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p term or \p out is NULL, \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED
+ *         if the output buffer cannot be grown, \ref CARDANO_ERROR_ILLEGAL_STATE
+ *         if the term nests deeper than the rendering depth ceiling, or
+ *         \ref CARDANO_ERROR_NOT_IMPLEMENTED for a BLS constant value, which has
+ *         no textual representation here.
+ */
+cardano_error_t
+cardano_uplc_pretty_print_term(
+  const cardano_uplc_term_t* term,
+  cardano_buffer_t**         out);
+
+/**
+ * \brief Renders an Untyped Plutus Core program to the textual surface syntax.
+ *
+ * Wraps the term rendering of \ref cardano_uplc_pretty_print_term in
+ * \c (program major.minor.patch \<term\>), the form the conformance
+ * \c .uplc.expected files use.
+ *
+ * \param[in] program The program to render. Must not be NULL and must carry a
+ *            non-NULL term.
+ * \param[out] out On success, a newly allocated buffer holding the rendered,
+ *             NUL-terminated text; the caller owns it and must release it with
+ *             \ref cardano_buffer_unref. Left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p program, \p out, or the program term is NULL,
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the output buffer cannot
+ *         be grown, \ref CARDANO_ERROR_ILLEGAL_STATE if the term nests deeper than
+ *         the rendering depth ceiling, or \ref CARDANO_ERROR_NOT_IMPLEMENTED for a
+ *         BLS constant value.
+ */
+cardano_error_t
+cardano_uplc_pretty_print_program(
+  const cardano_uplc_program_t* program,
+  cardano_buffer_t**            out);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_SYNTAX_PRETTY_H */
diff --git a/vendor/src/uplc/syntax/text_parser.c b/vendor/src/uplc/syntax/text_parser.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/syntax/text_parser.c
@@ -0,0 +1,2791 @@
+/**
+ * \file text_parser.c
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "text_parser.h"
+
+#include "../../allocators.h"
+#include "../ast/uplc_int.h"
+#include "../builtins/bls.h"
+#include "../builtins/builtins.h"
+
+#include <cardano/buffer.h>
+#include <cardano/common/bigint.h>
+#include <cardano/plutus_data/constr_plutus_data.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/plutus_data/plutus_list.h>
+#include <cardano/plutus_data/plutus_map.h>
+
+#include <src/string_safe.h>
+
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief Maximum term and constant nesting the parser descends before refusing.
+ *
+ * Bounds recursion so a deeply nested adversarial input cannot exhaust the C
+ * stack. It matches the flat term decoder's bound so the two front ends accept
+ * the same depth of nesting. Past it the parser returns
+ * \ref CARDANO_ERROR_DECODING.
+ */
+static const uint32_t PARSER_MAX_DEPTH = 4096U;
+
+/**
+ * \brief Numeric base used when parsing decimal integer literals.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const int32_t PARSER_DECIMAL_BASE = 10;
+
+/**
+ * \brief Number of hex digits that make up one byte.
+ */
+static const size_t PARSER_HEX_DIGITS_PER_BYTE = 2U;
+
+/**
+ * \brief Highest Unicode code point a numeric string escape may denote.
+ */
+// cppcheck-suppress misra-c2012-8.9; Reason: file-scope constant data grouped with the module
+static const uint32_t PARSER_MAX_CODE_POINT = 0x10FFFFU;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief A binder name in scope, recorded as a slice into the source text.
+ *
+ * The scope stack holds one of these per \c lam currently open. A variable
+ * resolves to the de Bruijn index counting from the top of the stack, so the
+ * innermost binder is index 1.
+ */
+typedef struct binder_t
+{
+    const char* text;
+    size_t      length;
+} binder_t;
+
+/**
+ * \brief Parser state: a cursor over the source and the open-binder scope stack.
+ *
+ * \c text and \c len delimit the source; \c pos is the current read offset and is
+ * never advanced past \c len. \c scope is a growable array of binders in scope,
+ * \c scope_count its used length and \c scope_capacity its allocated length.
+ */
+typedef struct parser_t
+{
+    cardano_uplc_arena_t* arena;
+    const char*           text;
+    size_t                len;
+    size_t                pos;
+    binder_t*             scope;
+    size_t                scope_count;
+    size_t                scope_capacity;
+    uint64_t              version_major;
+    uint64_t              version_minor;
+} parser_t;
+
+/* STATIC FUNCTION DECLARATIONS *********************************************/
+
+static cardano_error_t parse_term(parser_t* parser, uint32_t depth, const cardano_uplc_term_t** out);
+static cardano_error_t parse_constant(parser_t* parser, uint32_t depth, const cardano_uplc_constant_t** out);
+static cardano_error_t parse_type(parser_t* parser, uint32_t depth, const cardano_uplc_type_t** out);
+static cardano_error_t parse_value(parser_t* parser, const cardano_uplc_type_t* type, uint32_t depth, const cardano_uplc_constant_t** out);
+static cardano_error_t parse_data(parser_t* parser, uint32_t depth, cardano_plutus_data_t** out);
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Tests whether a byte is an ASCII whitespace character.
+ *
+ * \param[in] c The byte to test.
+ *
+ * \return \c true for space, tab, carriage return or newline, else \c false.
+ */
+static bool
+is_space(const char c)
+{
+  return (c == ' ') || (c == '\t') || (c == '\r') || (c == '\n');
+}
+
+/**
+ * \brief Tests whether a byte may appear in an identifier or builtin name.
+ *
+ * The set matches the corpus surface syntax: letters, digits, underscore, the
+ * apostrophe, the tilde and the hyphen (binder names such as \c y-0 occur in the
+ * corpus). The hyphen is part of the identifier set and not a token by itself.
+ *
+ * \param[in] c The byte to test.
+ *
+ * \return \c true if \p c is an identifier byte, else \c false.
+ */
+static bool
+is_ident(const char c)
+{
+  const bool lower = (c >= 'a') && (c <= 'z');
+  const bool upper = (c >= 'A') && (c <= 'Z');
+  const bool digit = (c >= '0') && (c <= '9');
+
+  return lower || upper || digit || (c == '_') || (c == '\'') || (c == '~') || (c == '-');
+}
+
+/**
+ * \brief Tests whether a byte is a decimal digit.
+ *
+ * \param[in] c The byte to test.
+ *
+ * \return \c true for '0'..'9', else \c false.
+ */
+static bool
+is_digit(const char c)
+{
+  return (c >= '0') && (c <= '9');
+}
+
+/**
+ * \brief Tests whether a byte is a hexadecimal digit.
+ *
+ * \param[in] c The byte to test.
+ *
+ * \return \c true for '0'..'9', 'a'..'f' or 'A'..'F', else \c false.
+ */
+static bool
+is_hex(const char c)
+{
+  const bool digit = (c >= '0') && (c <= '9');
+  const bool lower = (c >= 'a') && (c <= 'f');
+  const bool upper = (c >= 'A') && (c <= 'F');
+
+  return digit || lower || upper;
+}
+
+/**
+ * \brief Returns the byte at the cursor without consuming it.
+ *
+ * \param[in] parser The parser whose cursor to peek.
+ *
+ * \return The current byte, or '\\0' when the cursor is at the end of the source.
+ */
+static char
+peek_char(const parser_t* parser)
+{
+  if (parser->pos >= parser->len)
+  {
+    return '\0';
+  }
+
+  return parser->text[parser->pos];
+}
+
+/**
+ * \brief Skips a run of whitespace and \c "--" line comments.
+ *
+ * A line comment runs from \c "--" to the next newline or the end of the source.
+ * Leaves the cursor on the first byte that is neither whitespace nor inside a
+ * comment.
+ *
+ * \param[in,out] parser The parser whose cursor to advance.
+ */
+static void
+skip_trivia(parser_t* parser)
+{
+  while (parser->pos < parser->len)
+  {
+    const char c = parser->text[parser->pos];
+
+    if (is_space(c))
+    {
+      parser->pos += 1U;
+    }
+    else if (((int)c == (int)'-') && ((parser->pos + 1U) < parser->len) && ((int)parser->text[parser->pos + 1U] == (int)'-'))
+    {
+      parser->pos += 2U;
+
+      while ((parser->pos < parser->len) && ((int)parser->text[parser->pos] != (int)'\n'))
+      {
+        parser->pos += 1U;
+      }
+    }
+    else
+    {
+      break;
+    }
+  }
+}
+
+/**
+ * \brief Consumes a single expected byte after skipping leading trivia.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[in] expected The byte that must appear next.
+ *
+ * \return \ref CARDANO_SUCCESS if the byte was present and consumed, else
+ *         \ref CARDANO_ERROR_DECODING.
+ */
+static cardano_error_t
+expect_char(parser_t* parser, const char expected)
+{
+  skip_trivia(parser);
+
+  if ((int)peek_char(parser) != (int)expected)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  parser->pos += 1U;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Compares two byte spans of equal known length for equality.
+ *
+ * A length-bounded byte compare that never reads past \p length and does not
+ * treat either span as a NUL-terminated C string.
+ *
+ * \param[in] a The first byte span.
+ * \param[in] b The second byte span.
+ * \param[in] length The number of bytes to compare.
+ *
+ * \return \c true if the spans are byte-for-byte equal, else \c false.
+ */
+static bool
+bytes_equal(const char* a, const char* b, const size_t length)
+{
+  size_t i = 0U;
+
+  for (i = 0U; i < length; ++i)
+  {
+    if (a[i] != b[i])
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+/**
+ * \brief Consumes an expected keyword followed by a non-identifier boundary.
+ *
+ * Skips leading trivia, matches \p word exactly, and requires the byte after the
+ * word to be absent from the identifier set so that, for instance, \c "con" does
+ * not match a prefix of \c "constr". The cursor is left just past the keyword on
+ * success and is not moved on failure.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[in] word The NUL-terminated keyword to match.
+ *
+ * \return \c true if the keyword was matched and consumed, else \c false.
+ */
+static bool
+match_keyword(parser_t* parser, const char* word)
+{
+  size_t      length = cardano_safe_strlen(word, 256U);
+  size_t      start  = 0U;
+  const char* at     = NULL;
+
+  skip_trivia(parser);
+
+  start = parser->pos;
+
+  if ((start + length) > parser->len)
+  {
+    return false;
+  }
+
+  at = &parser->text[start];
+
+  if (!bytes_equal(at, word, length))
+  {
+    return false;
+  }
+
+  if (((start + length) < parser->len) && is_ident(parser->text[start + length]))
+  {
+    return false;
+  }
+
+  parser->pos = start + length;
+
+  return true;
+}
+
+/**
+ * \brief Reads an identifier or builtin-name token.
+ *
+ * Skips leading trivia, then captures a maximal run of identifier bytes as a slice
+ * into the source. An empty run is a parse error.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[out] text On success, set to the start of the identifier in the source.
+ * \param[out] length On success, set to the identifier length in bytes.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING if no
+ *         identifier byte is present.
+ */
+static cardano_error_t
+read_ident(parser_t* parser, const char** text, size_t* length)
+{
+  size_t start = 0U;
+
+  skip_trivia(parser);
+
+  start = parser->pos;
+
+  while ((parser->pos < parser->len) && is_ident(parser->text[parser->pos]))
+  {
+    parser->pos += 1U;
+  }
+
+  if (parser->pos == start)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *text   = &parser->text[start];
+  *length = parser->pos - start;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads an unsigned decimal literal into a 64-bit value, detecting overflow.
+ *
+ * Skips leading trivia, then reads one or more decimal digits. Overflow past
+ * \c UINT64_MAX is reported as a parse error so an out-of-range tag does not wrap.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[out] value On success, the parsed value.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         missing digit or an overflow.
+ */
+static cardano_error_t
+read_u64(parser_t* parser, uint64_t* value)
+{
+  uint64_t acc   = 0U;
+  size_t   start = 0U;
+
+  skip_trivia(parser);
+
+  start = parser->pos;
+
+  while ((parser->pos < parser->len) && is_digit(parser->text[parser->pos]))
+  {
+    const uint64_t digit = (uint64_t)parser->text[parser->pos] - (uint64_t)'0';
+
+    if (acc > ((UINT64_MAX - digit) / 10U))
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    acc         = (acc * 10U) + digit;
+    parser->pos += 1U;
+  }
+
+  if (parser->pos == start)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *value = acc;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a signed decimal integer literal into a fresh bigint.
+ *
+ * Skips leading trivia, accepts an optional leading sign, then requires at least
+ * one decimal digit. A leading '+' denotes a positive value and is dropped before
+ * the magnitude is handed to the bigint parser, which accepts only '-' or digits;
+ * a leading '-' is kept. This matches the reference, where '+7' parses to 7. The
+ * caller owns the returned reference and must release it.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[out] out On success, a newly created bigint the caller owns.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         malformed literal, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+static cardano_error_t
+read_bigint(parser_t* parser, cardano_bigint_t** out)
+{
+  size_t          start      = 0U;
+  size_t          digits     = 0U;
+  size_t          length     = 0U;
+  char*           terminated = NULL;
+  cardano_error_t result     = CARDANO_SUCCESS;
+
+  skip_trivia(parser);
+
+  if ((int)peek_char(parser) == (int)'+')
+  {
+    parser->pos += 1U;
+  }
+
+  start = parser->pos;
+
+  if ((int)peek_char(parser) == (int)'-')
+  {
+    parser->pos += 1U;
+  }
+
+  while ((parser->pos < parser->len) && is_digit(parser->text[parser->pos]))
+  {
+    parser->pos += 1U;
+    digits      += 1U;
+  }
+
+  if (digits == 0U)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  length     = parser->pos - start;
+  terminated = (char*)_cardano_malloc(length + 1U);
+
+  if (terminated == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_safe_memcpy(terminated, length + 1U, &parser->text[start], length);
+  terminated[length] = '\0';
+
+  result = cardano_bigint_from_string(terminated, length, PARSER_DECIMAL_BASE, out);
+
+  _cardano_free(terminated);
+
+  if (result == CARDANO_ERROR_MEMORY_ALLOCATION_FAILED)
+  {
+    return result;
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Converts a single hex digit to its value.
+ *
+ * \param[in] c The hex digit, assumed to satisfy \ref is_hex.
+ *
+ * \return The numeric value 0..15.
+ */
+static byte_t
+hex_value(const char c)
+{
+  byte_t value = 0U;
+
+  if ((c >= '0') && (c <= '9'))
+  {
+    value = (byte_t)((byte_t)c - (byte_t)'0');
+  }
+  else if ((c >= 'a') && (c <= 'f'))
+  {
+    value = (byte_t)(((byte_t)c - (byte_t)'a') + (byte_t)10U);
+  }
+  else
+  {
+    value = (byte_t)(((byte_t)c - (byte_t)'A') + (byte_t)10U);
+  }
+
+  return value;
+}
+
+/**
+ * \brief Reads a \c #hex byte-string literal into a fresh buffer.
+ *
+ * Skips leading trivia, requires a \c '#', then reads an even number of hex digits.
+ * An empty \c '#' yields an empty buffer. An odd digit count or a non-hex byte in
+ * the run is a parse error. The caller owns the returned reference.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[out] out On success, a newly created buffer the caller owns.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         malformed literal, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+static cardano_error_t
+read_hex_bytes(parser_t* parser, cardano_buffer_t** out)
+{
+  size_t            start  = 0U;
+  size_t            count  = 0U;
+  size_t            i      = 0U;
+  cardano_buffer_t* buffer = NULL;
+
+  skip_trivia(parser);
+
+  if ((int)peek_char(parser) != (int)'#')
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  parser->pos += 1U;
+  start       = parser->pos;
+
+  while ((parser->pos < parser->len) && is_hex(parser->text[parser->pos]))
+  {
+    parser->pos += 1U;
+  }
+
+  count = parser->pos - start;
+
+  if ((count % PARSER_HEX_DIGITS_PER_BYTE) != 0U)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  buffer = cardano_buffer_new((count / PARSER_HEX_DIGITS_PER_BYTE) + 1U);
+
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (i = 0U; i < count; i += PARSER_HEX_DIGITS_PER_BYTE)
+  {
+    const byte_t high = hex_value(parser->text[start + i]);
+    const byte_t low  = hex_value(parser->text[start + i + 1U]);
+    const byte_t b    = (byte_t)((high << 4U) | low);
+
+    if (cardano_buffer_write(buffer, &b, 1U) != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&buffer);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *out = buffer;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a \c 0x byte-string literal into a fresh buffer.
+ *
+ * Skips leading trivia, requires the \c 0x prefix, then reads an even number of
+ * hex digits. The textual form BLS12-381 element constants use. An odd digit
+ * count is a parse error. The caller owns the returned reference.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[out] out On success, a newly created buffer the caller owns.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         malformed literal, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+static cardano_error_t
+read_0x_bytes(parser_t* parser, cardano_buffer_t** out)
+{
+  size_t            start  = 0U;
+  size_t            count  = 0U;
+  size_t            i      = 0U;
+  cardano_buffer_t* buffer = NULL;
+
+  skip_trivia(parser);
+
+  if ((parser->pos + 1U) >= parser->len)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (((int)parser->text[parser->pos] != (int)'0') || ((int)parser->text[parser->pos + 1U] != (int)'x'))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  parser->pos += 2U;
+  start       = parser->pos;
+
+  while ((parser->pos < parser->len) && is_hex(parser->text[parser->pos]))
+  {
+    parser->pos += 1U;
+  }
+
+  count = parser->pos - start;
+
+  if ((count % PARSER_HEX_DIGITS_PER_BYTE) != 0U)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  buffer = cardano_buffer_new((count / PARSER_HEX_DIGITS_PER_BYTE) + 1U);
+
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  for (i = 0U; i < count; i += PARSER_HEX_DIGITS_PER_BYTE)
+  {
+    const byte_t high = hex_value(parser->text[start + i]);
+    const byte_t low  = hex_value(parser->text[start + i + 1U]);
+    const byte_t b    = (byte_t)((high << 4U) | low);
+
+    if (cardano_buffer_write(buffer, &b, 1U) != CARDANO_SUCCESS)
+    {
+      cardano_buffer_unref(&buffer);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *out = buffer;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Tests whether a byte is an octal digit.
+ *
+ * \param[in] c The byte to test.
+ *
+ * \return \c true for '0'..'7', else \c false.
+ */
+static bool
+is_octal(const char c)
+{
+  return (c >= '0') && (c <= '7');
+}
+
+/**
+ * \brief Appends the UTF-8 encoding of a code point to a buffer.
+ *
+ * Encodes \p code_point as one to four UTF-8 bytes so a numeric string escape that
+ * denotes a code point above 127 is stored as the UTF-8 text the corpus expects.
+ *
+ * \param[in,out] buffer The buffer to append to.
+ * \param[in] code_point The Unicode code point, assumed not above
+ *            \ref PARSER_MAX_CODE_POINT.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the append fails.
+ */
+static cardano_error_t
+utf8_encode(cardano_buffer_t* buffer, const uint32_t code_point)
+{
+  byte_t bytes[4] = { 0U, 0U, 0U, 0U };
+  size_t length   = 0U;
+
+  if (code_point < 0x80U)
+  {
+    bytes[0] = (byte_t)code_point;
+    length   = 1U;
+  }
+  else if (code_point < 0x800U)
+  {
+    bytes[0] = (byte_t)(0xC0U | (code_point >> 6U));
+    bytes[1] = (byte_t)(0x80U | (code_point & 0x3FU));
+    length   = 2U;
+  }
+  else if (code_point < 0x10000U)
+  {
+    bytes[0] = (byte_t)(0xE0U | (code_point >> 12U));
+    bytes[1] = (byte_t)(0x80U | ((code_point >> 6U) & 0x3FU));
+    bytes[2] = (byte_t)(0x80U | (code_point & 0x3FU));
+    length   = 3U;
+  }
+  else
+  {
+    bytes[0] = (byte_t)(0xF0U | (code_point >> 18U));
+    bytes[1] = (byte_t)(0x80U | ((code_point >> 12U) & 0x3FU));
+    bytes[2] = (byte_t)(0x80U | ((code_point >> 6U) & 0x3FU));
+    bytes[3] = (byte_t)(0x80U | (code_point & 0x3FU));
+    length   = 4U;
+  }
+
+  return cardano_buffer_write(buffer, bytes, length);
+}
+
+/**
+ * \brief Reads a run of digits in a given base as a code point.
+ *
+ * Reads a maximal run of digits valid in \p base starting at the cursor and folds
+ * them into a code point, rejecting an empty run or a value past
+ * \ref PARSER_MAX_CODE_POINT. Used by the decimal, octal and hex numeric string
+ * escapes.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[in] base The numeric base, 8, 10 or 16.
+ * \param[out] code_point On success, the parsed code point.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for an
+ *         empty run or an out-of-range value.
+ */
+static cardano_error_t
+read_code_point(parser_t* parser, const uint32_t base, uint32_t* code_point)
+{
+  uint32_t acc    = 0U;
+  size_t   digits = 0U;
+
+  while (parser->pos < parser->len)
+  {
+    const char c   = parser->text[parser->pos];
+    uint32_t   val = 0U;
+
+    if ((base == 16U) && is_hex(c))
+    {
+      val = (uint32_t)hex_value(c);
+    }
+    else if (((base == 8U) && is_octal(c)) || ((base == 10U) && is_digit(c)))
+    {
+      val = (uint32_t)c - (uint32_t)'0';
+    }
+    else
+    {
+      break;
+    }
+
+    if (acc > ((PARSER_MAX_CODE_POINT - val) / base))
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    acc         = (acc * base) + val;
+    parser->pos += 1U;
+    digits      += 1U;
+  }
+
+  if (digits == 0U)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *code_point = acc;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Matches a named control-code string escape at the cursor.
+ *
+ * Tries the ASCII control-code mnemonics (\c NUL through \c US plus \c SP and
+ * \c DEL) at the cursor, preferring the longest match so \c "\\SOH" is not read as
+ * \c "\\SO" followed by \c "H". On a match the cursor is advanced past the name and
+ * the corresponding code point is returned.
+ *
+ * \param[in,out] parser The parser to advance, positioned just past the backslash.
+ * \param[out] code_point On a match, the control-code value 0..127.
+ *
+ * \return \c true if a name matched and was consumed, else \c false.
+ */
+static bool
+match_named_escape(parser_t* parser, uint32_t* code_point)
+{
+  static const struct
+  {
+      const char* name;
+      uint32_t    value;
+  } table[] = {
+    { "NUL", 0U }, { "SOH", 1U }, { "STX", 2U }, { "ETX", 3U }, { "EOT", 4U }, { "ENQ", 5U }, { "ACK", 6U }, { "DLE", 16U }, { "DC1", 17U }, { "DC2", 18U }, { "DC3", 19U }, { "DC4", 20U }, { "NAK", 21U }, { "SYN", 22U }, { "ETB", 23U }, { "CAN", 24U }, { "SUB", 26U }, { "ESC", 27U }, { "DEL", 127U }, { "BEL", 7U }, { "BS", 8U }, { "HT", 9U }, { "LF", 10U }, { "VT", 11U }, { "FF", 12U }, { "CR", 13U }, { "SO", 14U }, { "SI", 15U }, { "EM", 25U }, { "FS", 28U }, { "GS", 29U }, { "RS", 30U }, { "US", 31U }, { "SP", 32U }
+  };
+
+  const size_t count    = sizeof(table) / sizeof(table[0]);
+  size_t       best     = count;
+  size_t       best_len = 0U;
+  size_t       i        = 0U;
+
+  for (i = 0U; i < count; ++i)
+  {
+    const size_t name_len = cardano_safe_strlen(table[i].name, 256U);
+
+    if (((parser->pos + name_len) <= parser->len) && bytes_equal(&parser->text[parser->pos], table[i].name, name_len) && (name_len > best_len))
+    {
+      best     = i;
+      best_len = name_len;
+    }
+  }
+
+  if (best == count)
+  {
+    return false;
+  }
+
+  parser->pos += best_len;
+  *code_point = table[best].value;
+
+  return true;
+}
+
+/**
+ * \brief Skips a string gap: a backslash, whitespace and a closing backslash.
+ *
+ * A string gap lets a literal span lines and contributes no character. The cursor
+ * is positioned on the first whitespace byte after the opening backslash; this
+ * consumes the whitespace run and the required closing backslash.
+ *
+ * \param[in,out] parser The parser to advance.
+ *
+ * \return \ref CARDANO_SUCCESS if a well-formed gap was consumed, else
+ *         \ref CARDANO_ERROR_DECODING.
+ */
+static cardano_error_t
+skip_string_gap(parser_t* parser)
+{
+  while ((parser->pos < parser->len) && is_space(parser->text[parser->pos]))
+  {
+    parser->pos += 1U;
+  }
+
+  if ((parser->pos >= parser->len) || ((int)parser->text[parser->pos] != (int)'\\'))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  parser->pos += 1U;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Reads a double-quoted string literal into a fresh UTF-8 buffer.
+ *
+ * Skips leading trivia, requires an opening quote, then reads bytes until the
+ * closing quote, decoding the escape set: the simple
+ * escapes \c \\n \c \\r \c \\t \c \\" \c \\' \c \\\\ \c \\a \c \\b \c \\f \c \\v, a
+ * decimal numeric escape \c \\DDD, a hex escape \c \\xHH..., an octal escape
+ * \c \\oNNN, the named ASCII control codes (for example \c \\DEL), the empty escape
+ * \c \\& and a string gap (a backslash, whitespace and a closing backslash). A
+ * numeric escape denoting a code point above 127 is UTF-8 encoded. Bytes outside an
+ * escape are stored verbatim, so raw multi-byte UTF-8 in the source passes through.
+ * An unterminated string or a malformed escape is a parse error. The caller owns the
+ * returned reference.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[out] out On success, a newly created buffer the caller owns.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         malformed literal, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+static cardano_error_t
+read_string(parser_t* parser, cardano_buffer_t** out)
+{
+  cardano_buffer_t* buffer = NULL;
+
+  skip_trivia(parser);
+
+  if ((int)peek_char(parser) != (int)'"')
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  parser->pos += 1U;
+
+  buffer = cardano_buffer_new(1U);
+
+  if (buffer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  while (true)
+  {
+    char            c;
+    bool            have_byte = false;
+    byte_t          emitted   = 0U;
+    cardano_error_t result    = CARDANO_SUCCESS;
+
+    if (parser->pos >= parser->len)
+    {
+      cardano_buffer_unref(&buffer);
+
+      return CARDANO_ERROR_DECODING;
+    }
+
+    c           = parser->text[parser->pos];
+    parser->pos += 1U;
+
+    if (c == '"')
+    {
+      break;
+    }
+
+    if (c != '\\')
+    {
+      emitted   = (byte_t)c;
+      have_byte = true;
+    }
+    else
+    {
+      char esc;
+
+      if (parser->pos >= parser->len)
+      {
+        cardano_buffer_unref(&buffer);
+
+        return CARDANO_ERROR_DECODING;
+      }
+
+      esc = parser->text[parser->pos];
+
+      switch (esc)
+      {
+        case 'n':
+        {
+          emitted     = (byte_t)'\n';
+          have_byte   = true;
+          parser->pos += 1U;
+          break;
+        }
+        case 'r':
+        {
+          emitted     = (byte_t)'\r';
+          have_byte   = true;
+          parser->pos += 1U;
+          break;
+        }
+        case 't':
+        {
+          emitted     = (byte_t)'\t';
+          have_byte   = true;
+          parser->pos += 1U;
+          break;
+        }
+        case 'v':
+        {
+          emitted     = (byte_t)'\v';
+          have_byte   = true;
+          parser->pos += 1U;
+          break;
+        }
+        case 'f':
+        {
+          emitted     = (byte_t)'\f';
+          have_byte   = true;
+          parser->pos += 1U;
+          break;
+        }
+        case 'a':
+        {
+          emitted     = (byte_t)0x07U;
+          have_byte   = true;
+          parser->pos += 1U;
+          break;
+        }
+        case 'b':
+        {
+          emitted     = (byte_t)0x08U;
+          have_byte   = true;
+          parser->pos += 1U;
+          break;
+        }
+        case '"':
+        {
+          emitted     = (byte_t)'"';
+          have_byte   = true;
+          parser->pos += 1U;
+          break;
+        }
+        case '\'':
+        {
+          emitted     = (byte_t)'\'';
+          have_byte   = true;
+          parser->pos += 1U;
+          break;
+        }
+        case '\\':
+        {
+          emitted     = (byte_t)'\\';
+          have_byte   = true;
+          parser->pos += 1U;
+          break;
+        }
+        case '&':
+        {
+          parser->pos += 1U;
+          break;
+        }
+        case 'x':
+        {
+          uint32_t code_point = 0U;
+
+          parser->pos += 1U;
+          result      = read_code_point(parser, 16U, &code_point);
+
+          if (result == CARDANO_SUCCESS)
+          {
+            result = utf8_encode(buffer, code_point);
+          }
+          break;
+        }
+        case 'o':
+        {
+          uint32_t code_point = 0U;
+
+          parser->pos += 1U;
+          result      = read_code_point(parser, 8U, &code_point);
+
+          if (result == CARDANO_SUCCESS)
+          {
+            result = utf8_encode(buffer, code_point);
+          }
+          break;
+        }
+        default:
+        {
+          uint32_t code_point = 0U;
+
+          if (is_digit(esc))
+          {
+            result = read_code_point(parser, 10U, &code_point);
+
+            if (result == CARDANO_SUCCESS)
+            {
+              result = utf8_encode(buffer, code_point);
+            }
+          }
+          else if (is_space(esc))
+          {
+            result = skip_string_gap(parser);
+          }
+          else if (match_named_escape(parser, &code_point))
+          {
+            result = utf8_encode(buffer, code_point);
+          }
+          else
+          {
+            result = CARDANO_ERROR_DECODING;
+          }
+          break;
+        }
+      }
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_buffer_unref(&buffer);
+
+        return result;
+      }
+    }
+
+    if (have_byte && (cardano_buffer_write(buffer, &emitted, 1U) != CARDANO_SUCCESS))
+    {
+      cardano_buffer_unref(&buffer);
+
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  *out = buffer;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Pushes a binder onto the scope stack, growing it if needed.
+ *
+ * The stack array lives in arena-independent heap memory owned by the parser run
+ * and freed when parsing finishes, regardless of outcome.
+ *
+ * \param[in,out] parser The parser whose scope to extend.
+ * \param[in] text The binder name slice start in the source.
+ * \param[in] length The binder name length.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the stack cannot grow.
+ */
+static cardano_error_t
+scope_push(parser_t* parser, const char* text, const size_t length)
+{
+  if (parser->scope_count == parser->scope_capacity)
+  {
+    const size_t next  = (parser->scope_capacity == 0U) ? 8U : (parser->scope_capacity * 2U);
+    binder_t*    grown = (binder_t*)_cardano_realloc(parser->scope, next * sizeof(binder_t));
+
+    if (grown == NULL)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    parser->scope          = grown;
+    parser->scope_capacity = next;
+  }
+
+  parser->scope[parser->scope_count].text   = text;
+  parser->scope[parser->scope_count].length = length;
+  parser->scope_count                       += 1U;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Pops the innermost binder off the scope stack.
+ *
+ * \param[in,out] parser The parser whose scope to shrink.
+ */
+static void
+scope_pop(parser_t* parser)
+{
+  if (parser->scope_count > 0U)
+  {
+    parser->scope_count -= 1U;
+  }
+}
+
+/**
+ * \brief Resolves a variable name to its 1-based de Bruijn index.
+ *
+ * Searches the scope stack from the innermost binder outward and returns the
+ * distance to the matching binder, so the innermost binder is index 1. The
+ * latest binding of a shadowed name wins, matching the lexical scope of the flat
+ * encoding.
+ *
+ * A free (unbound) name is a parse error, as in the reference, whose conversion
+ * of the parsed names to de Bruijn indices fails on a free variable. This holds
+ * wherever the variable occurs, including in an unused lambda body or in the
+ * fields of a \c constr.
+ *
+ * \param[in] parser The parser whose scope to search.
+ * \param[in] text The variable name slice start.
+ * \param[in] length The variable name length.
+ * \param[out] index On success, the 1-based de Bruijn index.
+ *
+ * \return \ref CARDANO_SUCCESS when the name is bound, or
+ *         \ref CARDANO_ERROR_DECODING for a free variable.
+ */
+static cardano_error_t
+resolve_name_index(const parser_t* parser, const char* text, const size_t length, uint64_t* index)
+{
+  size_t i = parser->scope_count;
+
+  while (i > 0U)
+  {
+    const binder_t* binder = &parser->scope[i - 1U];
+
+    if ((binder->length == length) && bytes_equal(binder->text, text, length))
+    {
+      *index = (uint64_t)(parser->scope_count - (i - 1U));
+
+      return CARDANO_SUCCESS;
+    }
+
+    i -= 1U;
+  }
+
+  return CARDANO_ERROR_DECODING;
+}
+
+/**
+ * \brief Resolves a builtin name to its tag.
+ *
+ * Looks the name up in the surface-syntax builtin name table. An unknown name is
+ * a parse error.
+ *
+ * \param[in] text The builtin name slice start.
+ * \param[in] length The builtin name length.
+ * \param[out] builtin On success, the builtin tag.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING if the
+ *         name is not a known builtin.
+ */
+static cardano_error_t
+resolve_builtin(const char* text, const size_t length, cardano_uplc_builtin_t* builtin)
+{
+  static const char* const names[CARDANO_UPLC_BUILTIN_COUNT] = {
+    [CARDANO_UPLC_BUILTIN_ADD_INTEGER]                        = "addInteger",
+    [CARDANO_UPLC_BUILTIN_SUBTRACT_INTEGER]                   = "subtractInteger",
+    [CARDANO_UPLC_BUILTIN_MULTIPLY_INTEGER]                   = "multiplyInteger",
+    [CARDANO_UPLC_BUILTIN_DIVIDE_INTEGER]                     = "divideInteger",
+    [CARDANO_UPLC_BUILTIN_QUOTIENT_INTEGER]                   = "quotientInteger",
+    [CARDANO_UPLC_BUILTIN_REMAINDER_INTEGER]                  = "remainderInteger",
+    [CARDANO_UPLC_BUILTIN_MOD_INTEGER]                        = "modInteger",
+    [CARDANO_UPLC_BUILTIN_EQUALS_INTEGER]                     = "equalsInteger",
+    [CARDANO_UPLC_BUILTIN_LESS_THAN_INTEGER]                  = "lessThanInteger",
+    [CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_INTEGER]           = "lessThanEqualsInteger",
+    [CARDANO_UPLC_BUILTIN_APPEND_BYTE_STRING]                 = "appendByteString",
+    [CARDANO_UPLC_BUILTIN_CONS_BYTE_STRING]                   = "consByteString",
+    [CARDANO_UPLC_BUILTIN_SLICE_BYTE_STRING]                  = "sliceByteString",
+    [CARDANO_UPLC_BUILTIN_LENGTH_OF_BYTE_STRING]              = "lengthOfByteString",
+    [CARDANO_UPLC_BUILTIN_INDEX_BYTE_STRING]                  = "indexByteString",
+    [CARDANO_UPLC_BUILTIN_EQUALS_BYTE_STRING]                 = "equalsByteString",
+    [CARDANO_UPLC_BUILTIN_LESS_THAN_BYTE_STRING]              = "lessThanByteString",
+    [CARDANO_UPLC_BUILTIN_LESS_THAN_EQUALS_BYTE_STRING]       = "lessThanEqualsByteString",
+    [CARDANO_UPLC_BUILTIN_SHA2_256]                           = "sha2_256",
+    [CARDANO_UPLC_BUILTIN_SHA3_256]                           = "sha3_256",
+    [CARDANO_UPLC_BUILTIN_BLAKE2B_256]                        = "blake2b_256",
+    [CARDANO_UPLC_BUILTIN_VERIFY_ED25519_SIGNATURE]           = "verifyEd25519Signature",
+    [CARDANO_UPLC_BUILTIN_APPEND_STRING]                      = "appendString",
+    [CARDANO_UPLC_BUILTIN_EQUALS_STRING]                      = "equalsString",
+    [CARDANO_UPLC_BUILTIN_ENCODE_UTF8]                        = "encodeUtf8",
+    [CARDANO_UPLC_BUILTIN_DECODE_UTF8]                        = "decodeUtf8",
+    [CARDANO_UPLC_BUILTIN_IF_THEN_ELSE]                       = "ifThenElse",
+    [CARDANO_UPLC_BUILTIN_CHOOSE_UNIT]                        = "chooseUnit",
+    [CARDANO_UPLC_BUILTIN_TRACE]                              = "trace",
+    [CARDANO_UPLC_BUILTIN_FST_PAIR]                           = "fstPair",
+    [CARDANO_UPLC_BUILTIN_SND_PAIR]                           = "sndPair",
+    [CARDANO_UPLC_BUILTIN_CHOOSE_LIST]                        = "chooseList",
+    [CARDANO_UPLC_BUILTIN_MK_CONS]                            = "mkCons",
+    [CARDANO_UPLC_BUILTIN_HEAD_LIST]                          = "headList",
+    [CARDANO_UPLC_BUILTIN_TAIL_LIST]                          = "tailList",
+    [CARDANO_UPLC_BUILTIN_NULL_LIST]                          = "nullList",
+    [CARDANO_UPLC_BUILTIN_CHOOSE_DATA]                        = "chooseData",
+    [CARDANO_UPLC_BUILTIN_CONSTR_DATA]                        = "constrData",
+    [CARDANO_UPLC_BUILTIN_MAP_DATA]                           = "mapData",
+    [CARDANO_UPLC_BUILTIN_LIST_DATA]                          = "listData",
+    [CARDANO_UPLC_BUILTIN_I_DATA]                             = "iData",
+    [CARDANO_UPLC_BUILTIN_B_DATA]                             = "bData",
+    [CARDANO_UPLC_BUILTIN_UN_CONSTR_DATA]                     = "unConstrData",
+    [CARDANO_UPLC_BUILTIN_UN_MAP_DATA]                        = "unMapData",
+    [CARDANO_UPLC_BUILTIN_UN_LIST_DATA]                       = "unListData",
+    [CARDANO_UPLC_BUILTIN_UN_I_DATA]                          = "unIData",
+    [CARDANO_UPLC_BUILTIN_UN_B_DATA]                          = "unBData",
+    [CARDANO_UPLC_BUILTIN_EQUALS_DATA]                        = "equalsData",
+    [CARDANO_UPLC_BUILTIN_MK_PAIR_DATA]                       = "mkPairData",
+    [CARDANO_UPLC_BUILTIN_MK_NIL_DATA]                        = "mkNilData",
+    [CARDANO_UPLC_BUILTIN_MK_NIL_PAIR_DATA]                   = "mkNilPairData",
+    [CARDANO_UPLC_BUILTIN_SERIALISE_DATA]                     = "serialiseData",
+    [CARDANO_UPLC_BUILTIN_VERIFY_ECDSA_SECP256K1_SIGNATURE]   = "verifyEcdsaSecp256k1Signature",
+    [CARDANO_UPLC_BUILTIN_VERIFY_SCHNORR_SECP256K1_SIGNATURE] = "verifySchnorrSecp256k1Signature",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G1_ADD]                   = "bls12_381_G1_add",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G1_NEG]                   = "bls12_381_G1_neg",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G1_SCALAR_MUL]            = "bls12_381_G1_scalarMul",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G1_EQUAL]                 = "bls12_381_G1_equal",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G1_COMPRESS]              = "bls12_381_G1_compress",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G1_UNCOMPRESS]            = "bls12_381_G1_uncompress",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G1_HASH_TO_GROUP]         = "bls12_381_G1_hashToGroup",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G2_ADD]                   = "bls12_381_G2_add",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G2_NEG]                   = "bls12_381_G2_neg",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G2_SCALAR_MUL]            = "bls12_381_G2_scalarMul",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G2_EQUAL]                 = "bls12_381_G2_equal",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G2_COMPRESS]              = "bls12_381_G2_compress",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G2_UNCOMPRESS]            = "bls12_381_G2_uncompress",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G2_HASH_TO_GROUP]         = "bls12_381_G2_hashToGroup",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_MILLER_LOOP]              = "bls12_381_millerLoop",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_MUL_ML_RESULT]            = "bls12_381_mulMlResult",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_FINAL_VERIFY]             = "bls12_381_finalVerify",
+    [CARDANO_UPLC_BUILTIN_KECCAK_256]                         = "keccak_256",
+    [CARDANO_UPLC_BUILTIN_BLAKE2B_224]                        = "blake2b_224",
+    [CARDANO_UPLC_BUILTIN_INTEGER_TO_BYTE_STRING]             = "integerToByteString",
+    [CARDANO_UPLC_BUILTIN_BYTE_STRING_TO_INTEGER]             = "byteStringToInteger",
+    [CARDANO_UPLC_BUILTIN_AND_BYTE_STRING]                    = "andByteString",
+    [CARDANO_UPLC_BUILTIN_OR_BYTE_STRING]                     = "orByteString",
+    [CARDANO_UPLC_BUILTIN_XOR_BYTE_STRING]                    = "xorByteString",
+    [CARDANO_UPLC_BUILTIN_COMPLEMENT_BYTE_STRING]             = "complementByteString",
+    [CARDANO_UPLC_BUILTIN_READ_BIT]                           = "readBit",
+    [CARDANO_UPLC_BUILTIN_WRITE_BITS]                         = "writeBits",
+    [CARDANO_UPLC_BUILTIN_REPLICATE_BYTE]                     = "replicateByte",
+    [CARDANO_UPLC_BUILTIN_SHIFT_BYTE_STRING]                  = "shiftByteString",
+    [CARDANO_UPLC_BUILTIN_ROTATE_BYTE_STRING]                 = "rotateByteString",
+    [CARDANO_UPLC_BUILTIN_COUNT_SET_BITS]                     = "countSetBits",
+    [CARDANO_UPLC_BUILTIN_FIND_FIRST_SET_BIT]                 = "findFirstSetBit",
+    [CARDANO_UPLC_BUILTIN_RIPEMD_160]                         = "ripemd_160",
+    [CARDANO_UPLC_BUILTIN_EXP_MOD_INTEGER]                    = "expModInteger",
+    [CARDANO_UPLC_BUILTIN_DROP_LIST]                          = "dropList",
+    [CARDANO_UPLC_BUILTIN_LENGTH_OF_ARRAY]                    = "lengthOfArray",
+    [CARDANO_UPLC_BUILTIN_LIST_TO_ARRAY]                      = "listToArray",
+    [CARDANO_UPLC_BUILTIN_INDEX_ARRAY]                        = "indexArray",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G1_MULTI_SCALAR_MUL]      = "bls12_381_G1_multiScalarMul",
+    [CARDANO_UPLC_BUILTIN_BLS12_381_G2_MULTI_SCALAR_MUL]      = "bls12_381_G2_multiScalarMul",
+    [CARDANO_UPLC_BUILTIN_INSERT_COIN]                        = "insertCoin",
+    [CARDANO_UPLC_BUILTIN_LOOKUP_COIN]                        = "lookupCoin",
+    [CARDANO_UPLC_BUILTIN_UNION_VALUE]                        = "unionValue",
+    [CARDANO_UPLC_BUILTIN_VALUE_CONTAINS]                     = "valueContains",
+    [CARDANO_UPLC_BUILTIN_VALUE_DATA]                         = "valueData",
+    [CARDANO_UPLC_BUILTIN_UN_VALUE_DATA]                      = "unValueData",
+    [CARDANO_UPLC_BUILTIN_SCALE_VALUE]                        = "scaleValue",
+    [CARDANO_UPLC_BUILTIN_MULTI_INDEX_ARRAY]                  = "multiIndexArray",
+    [CARDANO_UPLC_BUILTIN_POLICIES]                           = "policies",
+    [CARDANO_UPLC_BUILTIN_ASSET_COUNT]                        = "assetCount",
+    [CARDANO_UPLC_BUILTIN_KEEP_POLICIES]                      = "keepPolicies",
+    [CARDANO_UPLC_BUILTIN_DROP_POLICIES]                      = "dropPolicies"
+  };
+
+  size_t i = 0U;
+
+  for (i = 0U; i < (size_t)CARDANO_UPLC_BUILTIN_COUNT; ++i)
+  {
+    const char* name = names[i];
+
+    if ((name != NULL) && (cardano_safe_strlen(name, length + 1U) == length) && bytes_equal(name, text, length))
+    {
+      *builtin = (cardano_uplc_builtin_t)i;
+
+      return CARDANO_SUCCESS;
+    }
+  }
+
+  return CARDANO_ERROR_DECODING;
+}
+
+/**
+ * \brief Parses one plutus-data value in the textual data syntax.
+ *
+ * Reads one of \c Constr <i> [d, ...], \c Map [(k, v), ...], \c List [d, ...],
+ * \c I <integer> or \c B #hex into a fresh \ref cardano_plutus_data_t. Recursion
+ * is bounded by \p depth. The caller owns the returned reference and must release
+ * it. Every interior object created on an error path is released before return.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[in] depth The current nesting depth, checked against the bound.
+ * \param[out] out On success, a newly created data value the caller owns.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for
+ *         malformed syntax or nesting past the bound, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+static cardano_error_t
+parse_data(parser_t* parser, const uint32_t depth, cardano_plutus_data_t** out)
+{
+  if (depth >= PARSER_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  skip_trivia(parser);
+
+  if (match_keyword(parser, "Constr"))
+  {
+    uint64_t                      tag    = 0U;
+    cardano_plutus_list_t*        fields = NULL;
+    cardano_constr_plutus_data_t* constr = NULL;
+    cardano_error_t               result = read_u64(parser, &tag);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = expect_char(parser, '[');
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (cardano_plutus_list_new(&fields) != CARDANO_SUCCESS)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    skip_trivia(parser);
+
+    while ((int)peek_char(parser) != (int)']')
+    {
+      cardano_plutus_data_t* element = NULL;
+
+      if (cardano_plutus_list_get_length(fields) > 0U)
+      {
+        if (expect_char(parser, ',') != CARDANO_SUCCESS)
+        {
+          cardano_plutus_list_unref(&fields);
+
+          return CARDANO_ERROR_DECODING;
+        }
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_data(parser, depth + 1U, &element);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_list_unref(&fields);
+
+        return result;
+      }
+
+      result = cardano_plutus_list_add(fields, element);
+      cardano_plutus_data_unref(&element);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_list_unref(&fields);
+
+        return result;
+      }
+
+      skip_trivia(parser);
+    }
+
+    if (expect_char(parser, ']') != CARDANO_SUCCESS)
+    {
+      cardano_plutus_list_unref(&fields);
+
+      return CARDANO_ERROR_DECODING;
+    }
+
+    result = cardano_constr_plutus_data_new(tag, fields, &constr);
+    cardano_plutus_list_unref(&fields);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_data_new_constr(constr, out);
+    cardano_constr_plutus_data_unref(&constr);
+
+    return result;
+  }
+
+  if (match_keyword(parser, "Map"))
+  {
+    cardano_plutus_map_t* map    = NULL;
+    cardano_error_t       result = expect_char(parser, '[');
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (cardano_plutus_map_new(&map) != CARDANO_SUCCESS)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    skip_trivia(parser);
+
+    while ((int)peek_char(parser) != (int)']')
+    {
+      cardano_plutus_data_t* key   = NULL;
+      cardano_plutus_data_t* value = NULL;
+
+      if (cardano_plutus_map_get_length(map) > 0U)
+      {
+        if (expect_char(parser, ',') != CARDANO_SUCCESS)
+        {
+          cardano_plutus_map_unref(&map);
+
+          return CARDANO_ERROR_DECODING;
+        }
+      }
+
+      if (expect_char(parser, '(') != CARDANO_SUCCESS)
+      {
+        cardano_plutus_map_unref(&map);
+
+        return CARDANO_ERROR_DECODING;
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_data(parser, depth + 1U, &key);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_map_unref(&map);
+
+        return result;
+      }
+
+      if (expect_char(parser, ',') != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_unref(&key);
+        cardano_plutus_map_unref(&map);
+
+        return CARDANO_ERROR_DECODING;
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_data(parser, depth + 1U, &value);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_unref(&key);
+        cardano_plutus_map_unref(&map);
+
+        return result;
+      }
+
+      if (expect_char(parser, ')') != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_unref(&key);
+        cardano_plutus_data_unref(&value);
+        cardano_plutus_map_unref(&map);
+
+        return CARDANO_ERROR_DECODING;
+      }
+
+      result = cardano_plutus_map_insert(map, key, value);
+      cardano_plutus_data_unref(&key);
+      cardano_plutus_data_unref(&value);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_map_unref(&map);
+
+        return result;
+      }
+
+      skip_trivia(parser);
+    }
+
+    if (expect_char(parser, ']') != CARDANO_SUCCESS)
+    {
+      cardano_plutus_map_unref(&map);
+
+      return CARDANO_ERROR_DECODING;
+    }
+
+    result = cardano_plutus_data_new_map(map, out);
+    cardano_plutus_map_unref(&map);
+
+    return result;
+  }
+
+  if (match_keyword(parser, "List"))
+  {
+    cardano_plutus_list_t* list   = NULL;
+    cardano_error_t        result = expect_char(parser, '[');
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (cardano_plutus_list_new(&list) != CARDANO_SUCCESS)
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+
+    skip_trivia(parser);
+
+    while ((int)peek_char(parser) != (int)']')
+    {
+      cardano_plutus_data_t* element = NULL;
+
+      if (cardano_plutus_list_get_length(list) > 0U)
+      {
+        if (expect_char(parser, ',') != CARDANO_SUCCESS)
+        {
+          cardano_plutus_list_unref(&list);
+
+          return CARDANO_ERROR_DECODING;
+        }
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_data(parser, depth + 1U, &element);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_list_unref(&list);
+
+        return result;
+      }
+
+      result = cardano_plutus_list_add(list, element);
+      cardano_plutus_data_unref(&element);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_list_unref(&list);
+
+        return result;
+      }
+
+      skip_trivia(parser);
+    }
+
+    if (expect_char(parser, ']') != CARDANO_SUCCESS)
+    {
+      cardano_plutus_list_unref(&list);
+
+      return CARDANO_ERROR_DECODING;
+    }
+
+    result = cardano_plutus_data_new_list(list, out);
+    cardano_plutus_list_unref(&list);
+
+    return result;
+  }
+
+  if (match_keyword(parser, "I"))
+  {
+    cardano_bigint_t* integer = NULL;
+    cardano_error_t   result  = read_bigint(parser, &integer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_data_new_integer(integer, out);
+    cardano_bigint_unref(&integer);
+
+    return result;
+  }
+
+  if (match_keyword(parser, "B"))
+  {
+    cardano_buffer_t* bytes  = NULL;
+    cardano_error_t   result = read_hex_bytes(parser, &bytes);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_data_new_bytes(cardano_buffer_get_data(bytes), cardano_buffer_get_size(bytes), out);
+    cardano_buffer_unref(&bytes);
+
+    return result;
+  }
+
+  return CARDANO_ERROR_DECODING;
+}
+
+/**
+ * \brief Parses a constant type descriptor following the \c con keyword.
+ *
+ * Reads a leaf type name (\c integer, \c bytestring, \c string, \c unit, \c bool,
+ * \c data) or a parenthesised \c (list T) or \c (pair A B) descriptor into an
+ * arena-allocated \ref cardano_uplc_type_t. The BLS element type names are
+ * rejected with \ref CARDANO_ERROR_NOT_IMPLEMENTED.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[in] depth The current nesting depth, checked against the bound.
+ * \param[out] out On success, the arena-allocated type descriptor.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for an
+ *         unknown or malformed type, \ref CARDANO_ERROR_NOT_IMPLEMENTED for a BLS
+ *         type, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+static cardano_error_t
+parse_type(parser_t* parser, const uint32_t depth, const cardano_uplc_type_t** out)
+{
+  cardano_uplc_type_t* built  = NULL;
+  cardano_error_t      result = CARDANO_SUCCESS;
+
+  if (depth >= PARSER_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  skip_trivia(parser);
+
+  if ((int)peek_char(parser) == (int)'(')
+  {
+    parser->pos += 1U;
+
+    if (match_keyword(parser, "list"))
+    {
+      const cardano_uplc_type_t* element = NULL;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_type(parser, depth + 1U, &element);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      if (expect_char(parser, ')') != CARDANO_SUCCESS)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_LIST, element, NULL, &built);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *out = built;
+
+      return CARDANO_SUCCESS;
+    }
+
+    if (match_keyword(parser, "array"))
+    {
+      const cardano_uplc_type_t* element = NULL;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_type(parser, depth + 1U, &element);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      if (expect_char(parser, ')') != CARDANO_SUCCESS)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_ARRAY, element, NULL, &built);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *out = built;
+
+      return CARDANO_SUCCESS;
+    }
+
+    if (match_keyword(parser, "pair"))
+    {
+      const cardano_uplc_type_t* fst = NULL;
+      const cardano_uplc_type_t* snd = NULL;
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_type(parser, depth + 1U, &fst);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_type(parser, depth + 1U, &snd);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      if (expect_char(parser, ')') != CARDANO_SUCCESS)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_PAIR, fst, snd, &built);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      *out = built;
+
+      return CARDANO_SUCCESS;
+    }
+
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (match_keyword(parser, "integer"))
+  {
+    result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_INTEGER, NULL, NULL, &built);
+  }
+  else if (match_keyword(parser, "bytestring"))
+  {
+    result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_BYTE_STRING, NULL, NULL, &built);
+  }
+  else if (match_keyword(parser, "string"))
+  {
+    result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_STRING, NULL, NULL, &built);
+  }
+  else if (match_keyword(parser, "unit"))
+  {
+    result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_UNIT, NULL, NULL, &built);
+  }
+  else if (match_keyword(parser, "bool"))
+  {
+    result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_BOOL, NULL, NULL, &built);
+  }
+  else if (match_keyword(parser, "data"))
+  {
+    result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_DATA, NULL, NULL, &built);
+  }
+  else if (match_keyword(parser, "bls12_381_G1_element"))
+  {
+    result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_BLS_G1, NULL, NULL, &built);
+  }
+  else if (match_keyword(parser, "bls12_381_G2_element"))
+  {
+    result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_BLS_G2, NULL, NULL, &built);
+  }
+  else if (match_keyword(parser, "value"))
+  {
+    result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_VALUE, NULL, NULL, &built);
+  }
+  else
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *out = built;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Builds a value constant from a parsed list of policy entries.
+ *
+ * The entries must already be in canonical form, as the reference parser
+ * requires: currency ids strictly ascending, token ids strictly ascending within
+ * each currency, ids of at most 32 bytes, no empty token list and non-zero
+ * quantities in the signed 128-bit range. Repeated or unordered keys are not
+ * merged or sorted.
+ *
+ * \param[in] arena The arena the result is allocated from.
+ * \param[in] element_type The canonical value element type.
+ * \param[in] raw The parsed list of policy entries.
+ * \param[out] out On success, the value constant.
+ *
+ * \return \ref CARDANO_SUCCESS, \ref CARDANO_ERROR_DECODING when the entries are
+ *         not canonical, or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+static cardano_error_t
+canonical_value(
+  cardano_uplc_arena_t*          arena,
+  const cardano_uplc_type_t*     element_type,
+  const cardano_uplc_constant_t* raw,
+  cardano_uplc_constant_t**      out)
+{
+  if (!cardano_uplc_int_value_entries_are_canonical(arena, raw->as.list.items, raw->as.list.count))
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  return cardano_uplc_constant_new_value(arena, element_type, raw->as.list.items, raw->as.list.count, out);
+}
+
+/**
+ * \brief Parses a constant value for a known type descriptor.
+ *
+ * Reads the bare value form for \p type: a signed integer, a \c #hex byte string,
+ * a quoted string, \c () for unit, \c True / \c False for bool, a bracketed list
+ * \c [v, ...], a parenthesised pair \c (a, b), or the wrapped data form. The value
+ * is built into an arena-allocated \ref cardano_uplc_constant_t. The BLS arms are
+ * unreachable because \ref parse_type rejects BLS types first.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[in] type The type descriptor whose value to read.
+ * \param[in] depth The current nesting depth, checked against the bound.
+ * \param[out] out On success, the arena-allocated constant.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         malformed value or nesting past the bound, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+static cardano_error_t
+parse_value(parser_t* parser, const cardano_uplc_type_t* type, const uint32_t depth, const cardano_uplc_constant_t** out)
+{
+  cardano_uplc_constant_t* built  = NULL;
+  cardano_error_t          result = CARDANO_SUCCESS;
+
+  if (depth >= PARSER_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  skip_trivia(parser);
+
+  switch (type->kind)
+  {
+    case CARDANO_UPLC_TYPE_INTEGER:
+    {
+      cardano_bigint_t* integer = NULL;
+
+      result = read_bigint(parser, &integer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_uplc_constant_new_integer(parser->arena, integer, &built);
+      cardano_bigint_unref(&integer);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BYTE_STRING:
+    {
+      cardano_buffer_t* bytes = NULL;
+
+      result = read_hex_bytes(parser, &bytes);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_uplc_constant_new_byte_string(parser->arena, bytes, &built);
+      cardano_buffer_unref(&bytes);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_STRING:
+    {
+      cardano_buffer_t* text = NULL;
+
+      result = read_string(parser, &text);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_uplc_constant_new_string(parser->arena, text, &built);
+      cardano_buffer_unref(&text);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_UNIT:
+    {
+      if (expect_char(parser, '(') != CARDANO_SUCCESS)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if (expect_char(parser, ')') != CARDANO_SUCCESS)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      result = cardano_uplc_constant_new_unit(parser->arena, &built);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BOOL:
+    {
+      if (match_keyword(parser, "True"))
+      {
+        result = cardano_uplc_constant_new_bool(parser->arena, true, &built);
+      }
+      else if (match_keyword(parser, "False"))
+      {
+        result = cardano_uplc_constant_new_bool(parser->arena, false, &built);
+      }
+      else
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      break;
+    }
+    case CARDANO_UPLC_TYPE_LIST:
+    case CARDANO_UPLC_TYPE_ARRAY:
+    {
+      const cardano_uplc_constant_t** items    = NULL;
+      size_t                          count    = 0U;
+      size_t                          capacity = 0U;
+
+      if (expect_char(parser, '[') != CARDANO_SUCCESS)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      skip_trivia(parser);
+
+      while ((int)peek_char(parser) != (int)']')
+      {
+        const cardano_uplc_constant_t* element = NULL;
+
+        if (count > 0U)
+        {
+          if (expect_char(parser, ',') != CARDANO_SUCCESS)
+          {
+            return CARDANO_ERROR_DECODING;
+          }
+        }
+
+        // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+        result = parse_value(parser, type->fst, depth + 1U, &element);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        if (count == capacity)
+        {
+          const size_t                    next  = (capacity == 0U) ? 4U : (capacity * 2U);
+          const cardano_uplc_constant_t** grown = (const cardano_uplc_constant_t**)cardano_uplc_arena_alloc(parser->arena, next * sizeof(const cardano_uplc_constant_t*), 0U);
+          size_t                          i     = 0U;
+
+          if (grown == NULL)
+          {
+            return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+          }
+
+          for (i = 0U; i < count; ++i)
+          {
+            grown[i] = items[i];
+          }
+
+          items    = grown;
+          capacity = next;
+        }
+
+        items[count] = element;
+        count        += 1U;
+
+        skip_trivia(parser);
+      }
+
+      if (expect_char(parser, ']') != CARDANO_SUCCESS)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      if (type->kind == CARDANO_UPLC_TYPE_ARRAY)
+      {
+        result = cardano_uplc_constant_new_array(parser->arena, type->fst, items, count, &built);
+      }
+      else
+      {
+        result = cardano_uplc_constant_new_list(parser->arena, type->fst, items, count, &built);
+      }
+      break;
+    }
+    case CARDANO_UPLC_TYPE_PAIR:
+    {
+      const cardano_uplc_constant_t* fst = NULL;
+      const cardano_uplc_constant_t* snd = NULL;
+
+      if (expect_char(parser, '(') != CARDANO_SUCCESS)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_value(parser, type->fst, depth + 1U, &fst);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      if (expect_char(parser, ',') != CARDANO_SUCCESS)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_value(parser, type->snd, depth + 1U, &snd);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      if (expect_char(parser, ')') != CARDANO_SUCCESS)
+      {
+        return CARDANO_ERROR_DECODING;
+      }
+
+      result = cardano_uplc_constant_new_pair(parser->arena, fst, snd, &built);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_DATA:
+    {
+      cardano_plutus_data_t* data = NULL;
+
+      result = parse_data(parser, depth + 1U, &data);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_uplc_constant_new_data(parser->arena, data, &built);
+      cardano_plutus_data_unref(&data);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_G1:
+    case CARDANO_UPLC_TYPE_BLS_G2:
+    {
+      cardano_buffer_t* bytes = NULL;
+
+      result = read_0x_bytes(parser, &bytes);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      if (type->kind == CARDANO_UPLC_TYPE_BLS_G1)
+      {
+        result = cardano_uplc_int_bls_g1_from_compressed(parser->arena, cardano_buffer_get_data(bytes), cardano_buffer_get_size(bytes), &built);
+      }
+      else
+      {
+        result = cardano_uplc_int_bls_g2_from_compressed(parser->arena, cardano_buffer_get_data(bytes), cardano_buffer_get_size(bytes), &built);
+      }
+
+      cardano_buffer_unref(&bytes);
+      break;
+    }
+    case CARDANO_UPLC_TYPE_BLS_ML_RESULT:
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+    case CARDANO_UPLC_TYPE_VALUE:
+    {
+      const cardano_uplc_type_t*     element_type = NULL;
+      cardano_uplc_type_t*           list_type    = NULL;
+      const cardano_uplc_constant_t* list_const   = NULL;
+
+      result = cardano_uplc_int_value_element_type(parser->arena, &element_type);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_uplc_type_new(parser->arena, CARDANO_UPLC_TYPE_LIST, element_type, NULL, &list_type);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+      result = parse_value(parser, list_type, depth + 1U, &list_const);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = canonical_value(parser->arena, element_type, list_const, &built);
+      break;
+    }
+    default:
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *out = built;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Parses a constant body following the \c con keyword.
+ *
+ * Reads the type descriptor and then the value at that type. The \c data form is
+ * written \c data ( <data> ), with the data wrapped in its own parentheses, which
+ * this matches.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[in] depth The current nesting depth, checked against the bound.
+ * \param[out] out On success, the arena-allocated constant.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         malformed constant, \ref CARDANO_ERROR_NOT_IMPLEMENTED for a BLS type,
+ *         or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+static cardano_error_t
+parse_constant(parser_t* parser, const uint32_t depth, const cardano_uplc_constant_t** out)
+{
+  const cardano_uplc_type_t* type   = NULL;
+  cardano_error_t            result = parse_type(parser, depth, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (type->kind == CARDANO_UPLC_TYPE_DATA)
+  {
+    if (expect_char(parser, '(') != CARDANO_SUCCESS)
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    result = parse_value(parser, type, depth, out);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (expect_char(parser, ')') != CARDANO_SUCCESS)
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    return CARDANO_SUCCESS;
+  }
+
+  return parse_value(parser, type, depth, out);
+}
+
+/**
+ * \brief Collects a space-separated run of terms until a closing delimiter.
+ *
+ * Parses zero or more terms, each preceded by trivia, into an arena-allocated
+ * pointer array, stopping when the next non-trivia byte is \p terminator. Used for
+ * the field list of \c constr and the branch list of \c case.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[in] depth The current nesting depth, passed to each term parse.
+ * \param[in] terminator The byte that ends the run.
+ * \param[out] items On success, the arena-allocated array, or NULL when empty.
+ * \param[out] count On success, the number of terms read.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a propagated parse or allocation
+ *         error.
+ */
+static cardano_error_t
+// cppcheck-suppress misra-c2012-18.5; Reason: pointer nesting required by the API shape
+parse_term_run(parser_t* parser, const uint32_t depth, const char terminator, const cardano_uplc_term_t* const** items, size_t* count)
+{
+  const cardano_uplc_term_t** array    = NULL;
+  size_t                      used     = 0U;
+  size_t                      capacity = 0U;
+
+  skip_trivia(parser);
+
+  while ((int)peek_char(parser) != (int)terminator)
+  {
+    const cardano_uplc_term_t* element = NULL;
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    cardano_error_t result = parse_term(parser, depth + 1U, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (used == capacity)
+    {
+      const size_t                next  = (capacity == 0U) ? 4U : (capacity * 2U);
+      const cardano_uplc_term_t** grown = (const cardano_uplc_term_t**)cardano_uplc_arena_alloc(parser->arena, next * sizeof(const cardano_uplc_term_t*), 0U);
+      size_t                      i     = 0U;
+
+      if (grown == NULL)
+      {
+        return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+      }
+
+      for (i = 0U; i < used; ++i)
+      {
+        grown[i] = array[i];
+      }
+
+      array    = grown;
+      capacity = next;
+    }
+
+    array[used] = element;
+    used        += 1U;
+
+    skip_trivia(parser);
+  }
+
+  *items = array;
+  *count = used;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Tests whether the program version admits the \c constr and \c case forms.
+ *
+ * The sum-of-products terms were introduced at UPLC version 1.1.0, so a program
+ * with an earlier version header must reject them with a parse error.
+ *
+ * \param[in] parser The parser holding the parsed version triple.
+ *
+ * \return \c true if the version is at least 1.1.0, else \c false.
+ */
+static bool
+supports_sums(const parser_t* parser)
+{
+  if (parser->version_major != 1U)
+  {
+    return parser->version_major > 1U;
+  }
+
+  return parser->version_minor >= 1U;
+}
+
+/**
+ * \brief Parses a parenthesised term form after the opening \c '('.
+ *
+ * Dispatches on the keyword that follows the paren: \c con, \c lam, \c delay,
+ * \c force, \c error, \c builtin, \c constr or \c case, then consumes the closing
+ * paren. The \c constr and \c case forms require version 1.1.0 or later and are a
+ * parse error under an earlier version. Only \c lam introduces a binder; it pushes
+ * the parameter name on the scope stack for the body and pops it afterward.
+ *
+ * \param[in,out] parser The parser to advance, positioned just past the \c '('.
+ * \param[in] depth The current nesting depth, checked against the bound.
+ * \param[out] out On success, the arena-allocated term.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         malformed form, \ref CARDANO_ERROR_NOT_IMPLEMENTED for a BLS constant,
+ *         or \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+static cardano_error_t
+parse_paren_term(parser_t* parser, const uint32_t depth, const cardano_uplc_term_t** out)
+{
+  cardano_uplc_term_t* built  = NULL;
+  cardano_error_t      result = CARDANO_SUCCESS;
+
+  if (match_keyword(parser, "con"))
+  {
+    const cardano_uplc_constant_t* constant = NULL;
+
+    result = parse_constant(parser, depth + 1U, &constant);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_uplc_term_new_constant(parser->arena, constant, &built);
+  }
+  else if (match_keyword(parser, "lam"))
+  {
+    const char*                name   = NULL;
+    size_t                     length = 0U;
+    const cardano_uplc_term_t* body   = NULL;
+
+    result = read_ident(parser, &name, &length);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = scope_push(parser, name, length);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = parse_term(parser, depth + 1U, &body);
+    scope_pop(parser);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_uplc_term_new_lambda(parser->arena, body, &built);
+  }
+  else if (match_keyword(parser, "delay"))
+  {
+    const cardano_uplc_term_t* body = NULL;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = parse_term(parser, depth + 1U, &body);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_uplc_term_new_delay(parser->arena, body, &built);
+  }
+  else if (match_keyword(parser, "force"))
+  {
+    const cardano_uplc_term_t* body = NULL;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = parse_term(parser, depth + 1U, &body);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_uplc_term_new_force(parser->arena, body, &built);
+  }
+  else if (match_keyword(parser, "error"))
+  {
+    result = cardano_uplc_term_new_error(parser->arena, &built);
+  }
+  else if (match_keyword(parser, "builtin"))
+  {
+    const char*            name    = NULL;
+    size_t                 length  = 0U;
+    cardano_uplc_builtin_t builtin = CARDANO_UPLC_BUILTIN_ADD_INTEGER;
+
+    result = read_ident(parser, &name, &length);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = resolve_builtin(name, length, &builtin);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_uplc_term_new_builtin(parser->arena, builtin, &built);
+  }
+  else if (match_keyword(parser, "constr"))
+  {
+    uint64_t                          tag    = 0U;
+    const cardano_uplc_term_t* const* fields = NULL;
+    size_t                            count  = 0U;
+
+    if (!supports_sums(parser))
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    result = read_u64(parser, &tag);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = parse_term_run(parser, depth, ')', &fields, &count);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_uplc_term_new_constr(parser->arena, tag, fields, count, &built);
+  }
+  else if (match_keyword(parser, "case"))
+  {
+    const cardano_uplc_term_t*        scrutinee = NULL;
+    const cardano_uplc_term_t* const* branches  = NULL;
+    size_t                            count     = 0U;
+
+    if (!supports_sums(parser))
+    {
+      return CARDANO_ERROR_DECODING;
+    }
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = parse_term(parser, depth + 1U, &scrutinee);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = parse_term_run(parser, depth, ')', &branches, &count);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_uplc_term_new_case(parser->arena, scrutinee, branches, count, &built);
+  }
+  else
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (expect_char(parser, ')') != CARDANO_SUCCESS)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *out = built;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Parses an application after the opening \c '['.
+ *
+ * Reads two or more terms and folds them left-associatively into nested apply
+ * terms, so \c [ f x y ] builds \c ((f x) y). An application with fewer than two
+ * terms is a parse error. The closing \c ']' is consumed.
+ *
+ * \param[in,out] parser The parser to advance, positioned just past the \c '['.
+ * \param[in] depth The current nesting depth, checked against the bound.
+ * \param[out] out On success, the arena-allocated apply term.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         malformed application, or a propagated allocation error.
+ */
+static cardano_error_t
+parse_apply(parser_t* parser, const uint32_t depth, const cardano_uplc_term_t** out)
+{
+  const cardano_uplc_term_t* accumulator = NULL;
+  // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+  cardano_error_t result         = parse_term(parser, depth + 1U, &accumulator);
+  size_t          argument_count = 0U;
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  skip_trivia(parser);
+
+  while ((int)peek_char(parser) != (int)']')
+  {
+    const cardano_uplc_term_t* argument = NULL;
+    cardano_uplc_term_t*       applied  = NULL;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    result = parse_term(parser, depth + 1U, &argument);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_uplc_term_new_apply(parser->arena, accumulator, argument, &applied);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    accumulator    = applied;
+    argument_count += 1U;
+
+    skip_trivia(parser);
+  }
+
+  if (expect_char(parser, ']') != CARDANO_SUCCESS)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (argument_count == 0U)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  *out = accumulator;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Parses one term: a variable, an application, or a parenthesised form.
+ *
+ * A leading \c '[' starts an application, a leading \c '(' a parenthesised form,
+ * and a leading identifier byte a variable, which is resolved to its de Bruijn
+ * index against the scope stack. Any other byte is a parse error. Recursion is
+ * bounded by \p depth.
+ *
+ * \param[in,out] parser The parser to advance.
+ * \param[in] depth The current nesting depth, checked against the bound.
+ * \param[out] out On success, the arena-allocated term.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_DECODING for a
+ *         malformed term, an unbound variable or nesting past the bound,
+ *         \ref CARDANO_ERROR_NOT_IMPLEMENTED for a BLS constant, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED.
+ */
+static cardano_error_t
+parse_term(parser_t* parser, const uint32_t depth, const cardano_uplc_term_t** out)
+{
+  char c;
+
+  if (depth >= PARSER_MAX_DEPTH)
+  {
+    return CARDANO_ERROR_DECODING;
+  }
+
+  skip_trivia(parser);
+
+  c = peek_char(parser);
+
+  if (c == '[')
+  {
+    parser->pos += 1U;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    return parse_apply(parser, depth, out);
+  }
+
+  if (c == '(')
+  {
+    parser->pos += 1U;
+
+    // cppcheck-suppress misra-c2012-17.2; Reason: bounded-depth recursion limited by program/data nesting and the execution budget
+    return parse_paren_term(parser, depth, out);
+  }
+
+  if (is_ident(c) && !is_digit(c))
+  {
+    const char*          name   = NULL;
+    size_t               length = 0U;
+    uint64_t             index  = 0U;
+    cardano_uplc_term_t* built  = NULL;
+    cardano_error_t      result = read_ident(parser, &name, &length);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = resolve_name_index(parser, name, length, &index);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_uplc_term_new_var(parser->arena, index, &built);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    *out = built;
+
+    return CARDANO_SUCCESS;
+  }
+
+  return CARDANO_ERROR_DECODING;
+}
+
+/* IMPLEMENTATION ************************************************************/
+
+cardano_error_t
+cardano_uplc_parse_program(
+  cardano_uplc_arena_t*          arena,
+  const char*                    text,
+  size_t                         len,
+  const cardano_uplc_program_t** program,
+  size_t*                        error_offset)
+{
+  parser_t                   parser = { NULL, NULL, 0U, 0U, NULL, 0U, 0U, 0U, 0U };
+  cardano_uplc_program_t*    result = NULL;
+  const cardano_uplc_term_t* term   = NULL;
+  uint64_t                   major  = 0U;
+  uint64_t                   minor  = 0U;
+  uint64_t                   patch  = 0U;
+  cardano_error_t            status = CARDANO_SUCCESS;
+
+  if ((arena == NULL) || (program == NULL) || ((text == NULL) && (len != 0U)))
+  {
+    if (error_offset != NULL)
+    {
+      *error_offset = 0U;
+    }
+
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  parser.arena = arena;
+  parser.text  = (text != NULL) ? text : "";
+  parser.len   = len;
+
+  status = expect_char(&parser, '(');
+
+  if (status == CARDANO_SUCCESS)
+  {
+    status = match_keyword(&parser, "program") ? CARDANO_SUCCESS : CARDANO_ERROR_DECODING;
+  }
+
+  if (status == CARDANO_SUCCESS)
+  {
+    status = read_u64(&parser, &major);
+  }
+
+  if (status == CARDANO_SUCCESS)
+  {
+    status = expect_char(&parser, '.');
+  }
+
+  if (status == CARDANO_SUCCESS)
+  {
+    status = read_u64(&parser, &minor);
+  }
+
+  if (status == CARDANO_SUCCESS)
+  {
+    status = expect_char(&parser, '.');
+  }
+
+  if (status == CARDANO_SUCCESS)
+  {
+    status = read_u64(&parser, &patch);
+  }
+
+  if ((status == CARDANO_SUCCESS) && ((major > UINT32_MAX) || (minor > UINT32_MAX) || (patch > UINT32_MAX)))
+  {
+    status = CARDANO_ERROR_DECODING;
+  }
+
+  if (status == CARDANO_SUCCESS)
+  {
+    parser.version_major = major;
+    parser.version_minor = minor;
+
+    status = parse_term(&parser, 0U, &term);
+  }
+
+  if (status == CARDANO_SUCCESS)
+  {
+    status = expect_char(&parser, ')');
+  }
+
+  if (status == CARDANO_SUCCESS)
+  {
+    skip_trivia(&parser);
+
+    if (parser.pos != parser.len)
+    {
+      status = CARDANO_ERROR_DECODING;
+    }
+  }
+
+  if (status == CARDANO_SUCCESS)
+  {
+    result = (cardano_uplc_program_t*)cardano_uplc_arena_alloc(arena, sizeof(cardano_uplc_program_t), 0U);
+
+    if (result == NULL)
+    {
+      status = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  if (status == CARDANO_SUCCESS)
+  {
+    result->version_major = (uint32_t)major;
+    result->version_minor = (uint32_t)minor;
+    result->version_patch = (uint32_t)patch;
+    result->term          = term;
+
+    *program = result;
+  }
+
+  if (error_offset != NULL)
+  {
+    *error_offset = parser.pos;
+  }
+
+  _cardano_free(parser.scope);
+
+  return status;
+}
diff --git a/vendor/src/uplc/syntax/text_parser.h b/vendor/src/uplc/syntax/text_parser.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/syntax/text_parser.h
@@ -0,0 +1,109 @@
+/**
+ * \file text_parser.h
+ *
+ * \author angel.castillo
+ * \date   Jun 18, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_SYNTAX_TEXT_PARSER_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_SYNTAX_TEXT_PARSER_H
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_program.h"
+#include "../ast/uplc_term.h"
+#include <cardano/error.h>
+#include <cardano/typedefs.h>
+
+#include "../arena/uplc_arena.h"
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Parses the textual UPLC surface syntax into an arena-allocated program.
+ *
+ * Reads the surface form the Plutus conformance corpus uses, for example
+ * \c "(program 1.0.0 (lam x x))", and produces a \ref cardano_uplc_program_t whose
+ * whole term tree is owned by \p arena. Named variables are resolved to de Bruijn
+ * indices during parsing using a scope stack, so the produced AST matches, term for
+ * term, the AST the flat decoder yields for the same program (alpha-equivalence).
+ * Only \c lam introduces a term-level binder; \c delay and \c force do not bind.
+ *
+ * Application is written \c [ f x y ... ] and is left-associative n-ary, so
+ * \c [ f x y ] builds \c ((f x) y). Constants follow the \c (con \<type\> \<value\>)
+ * form for integer, bytestring (\c \#hex), string, bool (\c True / \c False),
+ * unit (\c ()), \c (list T), \c (pair A B) and \c data (with the textual
+ * \c Constr / \c Map / \c List / \c I / \c B data syntax). The \c constr and
+ * \c case forms are parsed only when the program version is 1.1.0 or later; under
+ * an earlier version they are a parse error.
+ *
+ * A free (unbound) variable is a parse error wherever it occurs, matching the
+ * reference, whose conversion of the parsed names to de Bruijn indices rejects
+ * open terms. A \c value constant must be written in canonical form: currency
+ * ids strictly ascending, token ids strictly ascending within each currency (both
+ * in bytewise lexicographic order), ids of at most 32 bytes, no empty token list
+ * and non-zero quantities in the signed 128-bit range. Anything else is a parse
+ * error.
+ *
+ * BLS constant value literals are not parsed: a \c (con bls12_381_G1_element ...)
+ * or G2 constant is rejected with \ref CARDANO_ERROR_NOT_IMPLEMENTED rather than
+ * crashing. No corpus value-literal needs them at parse time.
+ *
+ * The whole tree, the version triple and every interior object live in \p arena;
+ * a single \ref cardano_uplc_arena_free releases everything on every exit path,
+ * including failure. Recursion over nested terms and constants is bounded; input
+ * that nests past the bound is rejected with the parse-error code. The parser
+ * never reads past \p text + \p len.
+ *
+ * \param[in] arena The arena every node and interior object is allocated from.
+ *            Must not be NULL.
+ * \param[in] text The UTF-8 source text. May be NULL only when \p len is 0.
+ * \param[in] len The number of bytes in \p text.
+ * \param[out] program On success, the parsed program owned by \p arena; left
+ *             untouched on failure.
+ * \param[out] error_offset On any return, set to the byte offset into \p text at
+ *             which parsing failed, or to \p len on success. May be NULL when the
+ *             caller does not want the offset.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p arena or \p program is NULL, or if \p text is NULL while \p len is
+ *         non-zero, \ref CARDANO_ERROR_DECODING for any malformed input (bad token,
+ *         unbalanced parens or brackets, unknown builtin name, a \c constr or
+ *         \c case form under a version below 1.1.0, bad constant, bad hex, a
+ *         free variable, a non-canonical value constant, or nesting past the
+ *         bound),
+ *         \ref CARDANO_ERROR_NOT_IMPLEMENTED for a BLS constant value literal, or
+ *         \ref CARDANO_ERROR_MEMORY_ALLOCATION_FAILED if the arena or an interior
+ *         object cannot be allocated.
+ */
+cardano_error_t
+cardano_uplc_parse_program(
+  cardano_uplc_arena_t*          arena,
+  const char*                    text,
+  size_t                         len,
+  const cardano_uplc_program_t** program,
+  size_t*                        error_offset);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_SYNTAX_TEXT_PARSER_H */
diff --git a/vendor/src/uplc/tx/script_context.c b/vendor/src/uplc/tx/script_context.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/tx/script_context.c
@@ -0,0 +1,9399 @@
+/**
+ * \file script_context.c
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "script_context.h"
+
+#include <cardano/uplc/uplc_apply_params.h>
+
+#include "../../allocators.h"
+#include "../../common/ledger_order.h"
+
+#include <cardano/address/address.h>
+#include <cardano/address/address_type.h>
+#include <cardano/address/base_address.h>
+#include <cardano/address/enterprise_address.h>
+#include <cardano/address/pointer_address.h>
+#include <cardano/address/reward_address.h>
+#include <cardano/address/stake_pointer.h>
+#include <cardano/assets/asset_name.h>
+#include <cardano/assets/asset_name_map.h>
+#include <cardano/assets/multi_asset.h>
+#include <cardano/assets/policy_id_list.h>
+#include <cardano/buffer.h>
+#include <cardano/cbor/cbor_writer.h>
+#include <cardano/certs/auth_committee_hot_cert.h>
+#include <cardano/certs/certificate.h>
+#include <cardano/certs/certificate_set.h>
+#include <cardano/certs/pool_registration_cert.h>
+#include <cardano/certs/pool_retirement_cert.h>
+#include <cardano/certs/register_drep_cert.h>
+#include <cardano/certs/registration_cert.h>
+#include <cardano/certs/resign_committee_cold_cert.h>
+#include <cardano/certs/stake_delegation_cert.h>
+#include <cardano/certs/stake_deregistration_cert.h>
+#include <cardano/certs/stake_registration_cert.h>
+#include <cardano/certs/stake_registration_delegation_cert.h>
+#include <cardano/certs/stake_vote_delegation_cert.h>
+#include <cardano/certs/stake_vote_registration_delegation_cert.h>
+#include <cardano/certs/unregister_drep_cert.h>
+#include <cardano/certs/unregistration_cert.h>
+#include <cardano/certs/update_drep_cert.h>
+#include <cardano/certs/vote_delegation_cert.h>
+#include <cardano/certs/vote_registration_delegation_cert.h>
+#include <cardano/common/bigint.h>
+#include <cardano/common/credential.h>
+#include <cardano/common/datum.h>
+#include <cardano/common/drep.h>
+#include <cardano/common/governance_action_id.h>
+#include <cardano/common/guard_set.h>
+#include <cardano/common/network_id.h>
+#include <cardano/common/protocol_version.h>
+#include <cardano/common/unit_interval.h>
+#include <cardano/common/utxo.h>
+#include <cardano/common/withdrawal_map.h>
+#include <cardano/crypto/blake2b_hash.h>
+#include <cardano/crypto/blake2b_hash_set.h>
+#include <cardano/crypto/blake2b_hash_size.h>
+#include <cardano/plutus_data/constr_plutus_data.h>
+#include <cardano/plutus_data/plutus_list.h>
+#include <cardano/plutus_data/plutus_map.h>
+#include <cardano/pool_params/pool_params.h>
+#include <cardano/proposal_procedures/committee_members_map.h>
+#include <cardano/proposal_procedures/constitution.h>
+#include <cardano/proposal_procedures/credential_set.h>
+#include <cardano/proposal_procedures/hard_fork_initiation_action.h>
+#include <cardano/proposal_procedures/new_constitution_action.h>
+#include <cardano/proposal_procedures/no_confidence_action.h>
+#include <cardano/proposal_procedures/parameter_change_action.h>
+#include <cardano/proposal_procedures/proposal_procedure.h>
+#include <cardano/proposal_procedures/proposal_procedure_set.h>
+#include <cardano/proposal_procedures/treasury_withdrawals_action.h>
+#include <cardano/proposal_procedures/update_committee_action.h>
+#include <cardano/scripts/script.h>
+#include <cardano/transaction/sub_transaction.h>
+#include <cardano/transaction_body/account_balance_interval.h>
+#include <cardano/transaction_body/account_balance_intervals_map.h>
+#include <cardano/transaction_body/direct_deposit_map.h>
+#include <cardano/transaction_body/required_guards_map.h>
+#include <cardano/transaction_body/sub_transaction_body.h>
+#include <cardano/transaction_body/sub_transaction_set.h>
+#include <cardano/transaction_body/transaction_body.h>
+#include <cardano/transaction_body/transaction_input.h>
+#include <cardano/transaction_body/transaction_input_set.h>
+#include <cardano/transaction_body/transaction_output.h>
+#include <cardano/transaction_body/transaction_output_list.h>
+#include <cardano/transaction_body/value.h>
+#include <cardano/voting_procedures/governance_action_id_list.h>
+#include <cardano/voting_procedures/vote.h>
+#include <cardano/voting_procedures/voter.h>
+#include <cardano/voting_procedures/voter_list.h>
+#include <cardano/voting_procedures/voting_procedure.h>
+#include <cardano/voting_procedures/voting_procedures.h>
+#include <cardano/witness_set/plutus_data_set.h>
+#include <cardano/witness_set/redeemer_list.h>
+#include <cardano/witness_set/witness_set.h>
+
+#include <src/string_safe.h>
+
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+/**
+ * \brief Plutus data constructor alternatives reused across the encoder.
+ */
+static const uint64_t CONSTR_0 = 0U;
+static const uint64_t CONSTR_1 = 1U;
+static const uint64_t CONSTR_2 = 2U;
+static const uint64_t CONSTR_3 = 3U;
+static const uint64_t CONSTR_4 = 4U;
+static const uint64_t CONSTR_5 = 5U;
+static const uint64_t CONSTR_6 = 6U;
+
+/**
+ * \brief Capacity of a ledger sort key, in bytes.
+ *
+ * Wide enough for the longest key the encoders build: a voter followed by a
+ * governance action id, or a policy id followed by an asset name.
+ */
+enum
+{
+  SORT_KEY_SIZE = 128
+};
+
+/**
+ * \brief Number of fields of the V4 TxInfo record.
+ */
+enum
+{
+  TX_INFO_V4_FIELD_COUNT = 19
+};
+
+/**
+ * \brief Number of fields of the V4 TopTxInfoSimplified record.
+ */
+enum
+{
+  TOP_TX_INFO_SIMPLIFIED_FIELD_COUNT = 18
+};
+
+/**
+ * \brief Number of fields of the V4 TopTxInfo record.
+ */
+enum
+{
+  TOP_TX_INFO_FIELD_COUNT = 4
+};
+
+/**
+ * \brief Number of fields of the V4 ScriptContext record.
+ */
+enum
+{
+  SCRIPT_CONTEXT_V4_FIELD_COUNT = 4
+};
+
+/**
+ * \brief Largest number of items a script purpose carries besides its script hash.
+ */
+enum
+{
+  PURPOSE_MAX_ITEMS = 2
+};
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief A byte string that orders map keys the way the ledger orders them.
+ *
+ * Keys compare byte by byte and a key that is a prefix of another sorts first,
+ * which is the ordering of the ledger's Haskell \c Ord instances once each
+ * constructor is written as its rank followed by its fields.
+ */
+typedef struct sort_key_t
+{
+    byte_t bytes[SORT_KEY_SIZE];
+    size_t size;
+} sort_key_t;
+
+/**
+ * \brief How a sorted map combines a new entry with an existing one of the same key.
+ */
+typedef enum
+{
+  MERGE_KEEP_FIRST = 0,
+  MERGE_KEEP_LAST  = 1,
+  MERGE_SUM        = 2
+} merge_mode_t;
+
+/**
+ * \brief Which amounts of a multi-asset a value table collects.
+ */
+typedef enum
+{
+  ASSETS_ALL      = 0,
+  ASSETS_POSITIVE = 1,
+  ASSETS_NEGATIVE = 2
+} asset_filter_t;
+
+/**
+ * \brief An entry of a sorted map.
+ *
+ * \c key_data is the encoded map key, \c inner_key the key of a nested map when
+ * the entry belongs to one, and the value is either \c value or, for summed
+ * entries, \c amount.
+ */
+typedef struct sorted_entry_t
+{
+    sort_key_t             key;
+    cardano_plutus_data_t* key_data;
+    cardano_plutus_data_t* inner_key;
+    cardano_plutus_data_t* value;
+    cardano_bigint_t*      amount;
+} sorted_entry_t;
+
+/**
+ * \brief A map kept in ledger key order while it is filled.
+ */
+typedef struct sorted_map_t
+{
+    sorted_entry_t* items;
+    size_t          count;
+    size_t          capacity;
+} sorted_map_t;
+
+/**
+ * \brief The parts of a top-level transaction or a sub-transaction that a V4 TxInfo reads.
+ *
+ * Both transaction levels share this view so a single encoder serves them.
+ * Every pointer is an owned reference released by \ref tx_view_release.
+ */
+typedef struct tx_view_t
+{
+    cardano_blake2b_hash_t*                  id;
+    bool                                     is_sub_tx;
+    uint64_t                                 sub_tx_index;
+    cardano_transaction_input_set_t*         inputs;
+    cardano_transaction_input_set_t*         reference_inputs;
+    cardano_transaction_output_list_t*       outputs;
+    cardano_multi_asset_t*                   mint;
+    cardano_certificate_set_t*               certificates;
+    cardano_withdrawal_map_t*                withdrawals;
+    cardano_direct_deposit_map_t*            direct_deposits;
+    cardano_account_balance_intervals_map_t* balance_intervals;
+    bool                                     has_invalid_before;
+    uint64_t                                 invalid_before;
+    bool                                     has_invalid_after;
+    uint64_t                                 invalid_after;
+    cardano_guard_set_t*                     guards;
+    cardano_required_guards_map_t*           required_guards;
+    cardano_voting_procedures_t*             votes;
+    cardano_proposal_procedure_set_t*        proposals;
+    bool                                     has_treasury;
+    uint64_t                                 treasury;
+    uint64_t                                 donation;
+    cardano_redeemer_list_t*                 redeemers;
+    cardano_plutus_data_set_t*               datums;
+} tx_view_t;
+
+/**
+ * \brief The aggregates of a whole transaction that make up a TopTxInfo.
+ */
+typedef struct batch_t
+{
+    cardano_plutus_list_t* sub_tx_infos;
+    cardano_plutus_list_t* ids;
+    cardano_plutus_list_t* inputs;
+    cardano_plutus_list_t* reference_inputs;
+    cardano_plutus_list_t* outputs;
+    cardano_plutus_list_t* certificates;
+    cardano_plutus_list_t* guards;
+    cardano_plutus_list_t* proposals;
+    sorted_map_t           guard_datums;
+    sorted_map_t           mints;
+    sorted_map_t           burns;
+    sorted_map_t           withdrawals;
+    sorted_map_t           direct_deposits;
+    sorted_map_t           required_guards;
+    sorted_map_t           redeemer_hashes;
+    sorted_map_t           datums;
+    sorted_map_t           votes;
+    bool                   has_lower;
+    uint64_t               lower;
+    bool                   has_upper;
+    uint64_t               upper;
+    bool                   has_treasury;
+    uint64_t               treasury;
+    cardano_bigint_t*      donations;
+} batch_t;
+
+/**
+ * \brief What a redeemer points to, resolved at its transaction level.
+ *
+ * \c items are the fields a ScriptPurpose and a ScriptInfo share, \c script_hash
+ * the hash of the script that runs and \c guard the encoded guard credential of
+ * a guarding redeemer. Every value is an owned reference.
+ */
+typedef struct purpose_parts_t
+{
+    uint64_t               alternative;
+    cardano_plutus_data_t* items[PURPOSE_MAX_ITEMS];
+    size_t                 item_count;
+    cardano_plutus_data_t* script_hash;
+    cardano_plutus_data_t* guard;
+} purpose_parts_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Wraps a list of plutus-data fields in a constructor of the given alternative.
+ */
+static cardano_error_t
+encode_constr(const uint64_t alternative, cardano_plutus_list_t* fields, cardano_plutus_data_t** out)
+{
+  cardano_constr_plutus_data_t* constr = NULL;
+  cardano_error_t               result = cardano_constr_plutus_data_new(alternative, fields, &constr);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_plutus_data_new_constr(constr, out);
+
+  cardano_constr_plutus_data_unref(&constr);
+
+  return result;
+}
+
+/**
+ * \brief Builds an empty-field constructor of the given alternative.
+ */
+static cardano_error_t
+empty_constr(const uint64_t alternative, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* fields = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&fields);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = encode_constr(alternative, fields, out);
+
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Wraps a single plutus-data value in a constructor of the given alternative.
+ */
+static cardano_error_t
+wrap_constr(const uint64_t alternative, cardano_plutus_data_t* value, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* fields = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&fields);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_plutus_list_add(fields, value);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(alternative, fields, out);
+  }
+
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Creates a plutus-data byte string from a raw buffer.
+ */
+static cardano_error_t
+encode_bytes(const byte_t* data, const size_t size, cardano_plutus_data_t** out)
+{
+  static const byte_t empty = 0U;
+
+  return cardano_plutus_data_new_bytes(((data == NULL) || (size == 0U)) ? &empty : data, size, out);
+}
+
+/**
+ * \brief Creates a plutus-data byte string from a blake2b hash.
+ */
+static cardano_error_t
+hash_bytes(const cardano_blake2b_hash_t* hash, cardano_plutus_data_t** out)
+{
+  return encode_bytes(cardano_blake2b_hash_get_data(hash), cardano_blake2b_hash_get_bytes_size(hash), out);
+}
+
+/**
+ * \brief Encodes the boolean values used by the interval bounds as Constr 0/1.
+ */
+static cardano_error_t
+encode_bool(const bool value, cardano_plutus_data_t** out)
+{
+  return empty_constr(value ? CONSTR_1 : CONSTR_0, out);
+}
+
+/**
+ * \brief Encodes a stake credential: Constr 0 [key hash] for a key credential, Constr 1 [script hash] for a script credential.
+ */
+static cardano_error_t
+encode_credential(cardano_credential_t* credential, cardano_plutus_data_t** out)
+{
+  cardano_credential_type_t type   = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+  cardano_error_t           result = cardano_credential_get_type(credential, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_plutus_data_t* hash = NULL;
+
+  result = encode_bytes(cardano_credential_get_hash_bytes(credential), cardano_credential_get_hash_bytes_size(credential), &hash);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (type)
+  {
+    case CARDANO_CREDENTIAL_TYPE_KEY_HASH:
+    {
+      result = wrap_constr(CONSTR_0, hash, out);
+      break;
+    }
+    case CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH:
+    {
+      result = wrap_constr(CONSTR_1, hash, out);
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_CREDENTIAL_TYPE;
+      break;
+    }
+  }
+
+  cardano_plutus_data_unref(&hash);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a stake-credential delegation part as the StakingHash variant.
+ *
+ * Some(Constr 0 [credential]) wrapped again as Constr 0 [value], producing the
+ * "StakingHash credential" shape used inside an Address.
+ */
+static cardano_error_t
+some_staking_hash(cardano_credential_t* credential, cardano_plutus_data_t** out)
+{
+  cardano_plutus_data_t* cred    = NULL;
+  cardano_error_t        result  = encode_credential(credential, &cred);
+  cardano_plutus_data_t* staking = NULL;
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = wrap_constr(CONSTR_0, cred, &staking);
+
+  cardano_plutus_data_unref(&cred);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = wrap_constr(CONSTR_0, staking, out);
+
+  cardano_plutus_data_unref(&staking);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a stake-pointer delegation part as the StakingPtr variant.
+ *
+ * Some(Constr 1 [slot, tx index, cert index]) wrapped as Constr 0 [value].
+ */
+static cardano_error_t
+some_staking_ptr(const cardano_stake_pointer_t* pointer, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* fields = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&fields);
+  cardano_plutus_data_t* slot   = NULL;
+  cardano_plutus_data_t* txidx  = NULL;
+  cardano_plutus_data_t* crtidx = NULL;
+  cardano_plutus_data_t* ptr    = NULL;
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_plutus_data_new_integer_from_uint(pointer->slot, &slot);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, slot);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(pointer->tx_index, &txidx);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, txidx);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(pointer->cert_index, &crtidx);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, crtidx);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_1, fields, &ptr);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = wrap_constr(CONSTR_0, ptr, out);
+  }
+
+  cardano_plutus_data_unref(&slot);
+  cardano_plutus_data_unref(&txidx);
+  cardano_plutus_data_unref(&crtidx);
+  cardano_plutus_data_unref(&ptr);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the delegation part of an address as an Option<StakeCredential>.
+ *
+ * A base address yields Some(StakingHash), a pointer address yields Some(StakingPtr),
+ * and an enterprise address yields None (Constr 1).
+ */
+static cardano_error_t
+address_stake_part(const cardano_address_t* address, cardano_plutus_data_t** out)
+{
+  cardano_base_address_t*    base    = NULL;
+  cardano_pointer_address_t* pointer = NULL;
+  cardano_error_t            result  = cardano_base_address_from_address(address, &base);
+
+  if ((result == CARDANO_SUCCESS) && (base != NULL))
+  {
+    cardano_credential_t* stake = cardano_base_address_get_stake_credential(base);
+
+    result = some_staking_hash(stake, out);
+
+    cardano_credential_unref(&stake);
+    cardano_base_address_unref(&base);
+
+    return result;
+  }
+
+  cardano_base_address_unref(&base);
+
+  result = cardano_pointer_address_from_address(address, &pointer);
+
+  if ((result == CARDANO_SUCCESS) && (pointer != NULL))
+  {
+    cardano_stake_pointer_t stake_pointer = { 0U, 0U, 0U };
+
+    result = cardano_pointer_address_get_stake_pointer(pointer, &stake_pointer);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = some_staking_ptr(&stake_pointer, out);
+    }
+
+    cardano_pointer_address_unref(&pointer);
+
+    return result;
+  }
+
+  cardano_pointer_address_unref(&pointer);
+
+  return empty_constr(CONSTR_1, out);
+}
+
+/**
+ * \brief Extracts the payment credential of a shelley/enterprise/pointer/base address.
+ */
+static cardano_credential_t*
+payment_credential(const cardano_address_t* address)
+{
+  cardano_base_address_t*       base       = NULL;
+  cardano_enterprise_address_t* enterprise = NULL;
+  cardano_pointer_address_t*    pointer    = NULL;
+  cardano_credential_t*         credential = NULL;
+
+  if ((cardano_base_address_from_address(address, &base) == CARDANO_SUCCESS) && (base != NULL))
+  {
+    credential = cardano_base_address_get_payment_credential(base);
+    cardano_base_address_unref(&base);
+    return credential;
+  }
+
+  cardano_base_address_unref(&base);
+
+  if ((cardano_enterprise_address_from_address(address, &enterprise) == CARDANO_SUCCESS) && (enterprise != NULL))
+  {
+    credential = cardano_enterprise_address_get_payment_credential(enterprise);
+    cardano_enterprise_address_unref(&enterprise);
+    return credential;
+  }
+
+  cardano_enterprise_address_unref(&enterprise);
+
+  if ((cardano_pointer_address_from_address(address, &pointer) == CARDANO_SUCCESS) && (pointer != NULL))
+  {
+    credential = cardano_pointer_address_get_payment_credential(pointer);
+    cardano_pointer_address_unref(&pointer);
+    return credential;
+  }
+
+  cardano_pointer_address_unref(&pointer);
+
+  return NULL;
+}
+
+/**
+ * \brief Encodes a shelley address: Constr 0 [payment credential, stake part].
+ */
+static cardano_error_t
+encode_address(const cardano_address_t* address, cardano_plutus_data_t** out)
+{
+  cardano_credential_t* payment = payment_credential(address);
+
+  if (payment == NULL)
+  {
+    return CARDANO_ERROR_INVALID_ADDRESS_TYPE;
+  }
+
+  cardano_plutus_list_t* fields = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&fields);
+  cardano_plutus_data_t* pay    = NULL;
+  cardano_plutus_data_t* stake  = NULL;
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_credential(payment, &pay);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, pay);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = address_stake_part(address, &stake);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, stake);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, out);
+  }
+
+  cardano_credential_unref(&payment);
+  cardano_plutus_data_unref(&pay);
+  cardano_plutus_data_unref(&stake);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Appends bytes to a sort key, truncating at its capacity.
+ */
+static void
+sort_key_append(sort_key_t* key, const byte_t* data, const size_t size)
+{
+  const size_t room = (size_t)SORT_KEY_SIZE - key->size;
+  const size_t copy = (size < room) ? size : room;
+
+  cardano_safe_memcpy(&key->bytes[key->size], room, data, copy);
+
+  key->size += copy;
+}
+
+/**
+ * \brief Appends a single rank byte to a sort key.
+ */
+static void
+sort_key_append_byte(sort_key_t* key, const byte_t value)
+{
+  sort_key_append(key, &value, 1U);
+}
+
+/**
+ * \brief Appends an unsigned integer to a sort key as 8 big-endian bytes.
+ */
+static void
+sort_key_append_index(sort_key_t* key, const uint64_t index)
+{
+  static const size_t SORT_KEY_INDEX_SIZE    = 8U;
+  static const size_t SORT_KEY_BITS_PER_BYTE = 8U;
+
+  byte_t bytes[8] = { 0 };
+
+  for (size_t i = 0U; i < SORT_KEY_INDEX_SIZE; ++i)
+  {
+    bytes[i] = (byte_t)(index >> (SORT_KEY_BITS_PER_BYTE * (SORT_KEY_INDEX_SIZE - 1U - i)));
+  }
+
+  sort_key_append(key, bytes, SORT_KEY_INDEX_SIZE);
+}
+
+/**
+ * \brief Appends the bytes of a hash to a sort key.
+ */
+static void
+sort_key_append_hash(sort_key_t* key, const cardano_blake2b_hash_t* hash)
+{
+  sort_key_append(key, cardano_blake2b_hash_get_data(hash), cardano_blake2b_hash_get_bytes_size(hash));
+}
+
+/**
+ * \brief Appends a credential to a sort key in the ledger order: script credentials sort before key credentials.
+ */
+static cardano_error_t
+sort_key_append_credential(sort_key_t* key, const cardano_credential_t* credential)
+{
+  byte_t          bytes[CARDANO_LEDGER_ORDER_CREDENTIAL_KEY_SIZE] = { 0 };
+  cardano_error_t result                                          = _cardano_ledger_order_credential_key(credential, bytes);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    sort_key_append(key, bytes, sizeof(bytes));
+  }
+
+  return result;
+}
+
+/**
+ * \brief Appends a voter to a sort key in the ledger order.
+ *
+ * The ledger orders committee voters first, then DReps, then stake pools, each
+ * by credential.
+ */
+static cardano_error_t
+sort_key_append_voter(sort_key_t* key, cardano_voter_t* voter)
+{
+  byte_t          bytes[CARDANO_LEDGER_ORDER_KEY_SIZE] = { 0 };
+  cardano_error_t result                               = _cardano_ledger_order_voter_key(voter, bytes);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    sort_key_append(key, bytes, sizeof(bytes));
+  }
+
+  return result;
+}
+
+/**
+ * \brief Orders two sort keys byte by byte, a proper prefix first.
+ */
+static int32_t
+compare_sort_keys(const sort_key_t* lhs, const sort_key_t* rhs)
+{
+  const size_t  common = (lhs->size < rhs->size) ? lhs->size : rhs->size;
+  const int32_t order  = (int32_t)memcmp(lhs->bytes, rhs->bytes, common);
+
+  if (order != 0)
+  {
+    return order;
+  }
+
+  if (lhs->size == rhs->size)
+  {
+    return 0;
+  }
+
+  return (lhs->size < rhs->size) ? -1 : 1;
+}
+
+/**
+ * \brief Releases the entries of a sorted map and resets it to empty.
+ */
+static void
+sorted_map_free(sorted_map_t* map)
+{
+  for (size_t i = 0U; i < map->count; ++i)
+  {
+    cardano_plutus_data_unref(&map->items[i].key_data);
+    cardano_plutus_data_unref(&map->items[i].inner_key);
+    cardano_plutus_data_unref(&map->items[i].value);
+    cardano_bigint_unref(&map->items[i].amount);
+  }
+
+  _cardano_free(map->items);
+
+  map->items    = NULL;
+  map->count    = 0U;
+  map->capacity = 0U;
+}
+
+/**
+ * \brief Makes room for one more entry in a sorted map.
+ */
+static cardano_error_t
+sorted_map_reserve(sorted_map_t* map)
+{
+  static const size_t SORTED_MAP_INITIAL_CAPACITY = 4U;
+
+  if (map->count < map->capacity)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  const size_t    capacity = (map->capacity == 0U) ? SORTED_MAP_INITIAL_CAPACITY : (map->capacity * 2U);
+  sorted_entry_t* items    = (sorted_entry_t*)_cardano_malloc(capacity * sizeof(sorted_entry_t));
+
+  if (items == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  if (map->items != NULL)
+  {
+    cardano_safe_memcpy(items, capacity * sizeof(sorted_entry_t), map->items, map->count * sizeof(sorted_entry_t));
+  }
+
+  _cardano_free(map->items);
+
+  map->items    = items;
+  map->capacity = capacity;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Inserts an entry into a sorted map, merging it with an entry of the same key.
+ *
+ * \param[in] map The map to insert into.
+ * \param[in] key The ledger sort key of the entry.
+ * \param[in] key_data The encoded key. A new reference is taken.
+ * \param[in] inner_key The encoded key inside a nested map, or NULL.
+ * \param[in] value The encoded value, or NULL when the entry carries an amount.
+ * \param[in] amount The amount of a summed entry, or NULL. It is copied.
+ * \param[in] mode How an entry with an existing key is merged.
+ */
+static cardano_error_t
+sorted_map_put(
+  sorted_map_t*           map,
+  const sort_key_t*       key,
+  cardano_plutus_data_t*  key_data,
+  cardano_plutus_data_t*  inner_key,
+  cardano_plutus_data_t*  value,
+  const cardano_bigint_t* amount,
+  const merge_mode_t      mode)
+{
+  size_t  position = 0U;
+  int32_t order    = -1;
+
+  while (position < map->count)
+  {
+    order = compare_sort_keys(&map->items[position].key, key);
+
+    if (order >= 0)
+    {
+      break;
+    }
+
+    ++position;
+  }
+
+  if ((position < map->count) && (order == 0))
+  {
+    sorted_entry_t* entry = &map->items[position];
+
+    if (mode == MERGE_KEEP_LAST)
+    {
+      cardano_plutus_data_ref(inner_key);
+      cardano_plutus_data_ref(value);
+      cardano_plutus_data_unref(&entry->inner_key);
+      cardano_plutus_data_unref(&entry->value);
+
+      entry->inner_key = inner_key;
+      entry->value     = value;
+    }
+
+    if (mode == MERGE_SUM)
+    {
+      cardano_bigint_add(entry->amount, amount, entry->amount);
+    }
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_error_t result = sorted_map_reserve(map);
+  sorted_entry_t  entry;
+
+  CARDANO_UNUSED(memset(&entry, 0, sizeof(entry)));
+
+  if ((result == CARDANO_SUCCESS) && (amount != NULL))
+  {
+    result = cardano_bigint_clone(amount, &entry.amount);
+  }
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  entry.key = *key;
+
+  cardano_plutus_data_ref(key_data);
+  cardano_plutus_data_ref(inner_key);
+  cardano_plutus_data_ref(value);
+
+  entry.key_data  = key_data;
+  entry.inner_key = inner_key;
+  entry.value     = value;
+
+  CARDANO_UNUSED(memmove(&map->items[position + 1U], &map->items[position], (map->count - position) * sizeof(sorted_entry_t)));
+
+  map->items[position] = entry;
+  map->count           += 1U;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Encodes the value of a sorted-map entry: its amount when summed, its value otherwise.
+ */
+static cardano_error_t
+sorted_entry_value(sorted_entry_t* entry, cardano_plutus_data_t** out)
+{
+  if (entry->amount != NULL)
+  {
+    return cardano_plutus_data_new_integer(entry->amount, out);
+  }
+
+  cardano_plutus_data_ref(entry->value);
+  *out = entry->value;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Encodes a sorted map as a plutus-data map, in key order.
+ */
+static cardano_error_t
+sorted_map_encode(sorted_map_t* map, cardano_plutus_data_t** out)
+{
+  cardano_plutus_map_t* encoded = NULL;
+  cardano_error_t       result  = cardano_plutus_map_new(&encoded);
+
+  for (size_t i = 0U; (i < map->count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_plutus_data_t* value = NULL;
+
+    result = sorted_entry_value(&map->items[i], &value);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_map_insert(encoded, map->items[i].key_data, value);
+    }
+
+    cardano_plutus_data_unref(&value);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(encoded, out);
+  }
+
+  cardano_plutus_map_unref(&encoded);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the keys of a sorted map as a plutus-data list, in key order.
+ */
+static cardano_error_t
+sorted_map_encode_keys(sorted_map_t* map, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  for (size_t i = 0U; (i < map->count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    result = cardano_plutus_list_add(list, map->items[i].key_data);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Appends a sorted map to a plutus-data map as a map of nested maps.
+ *
+ * Consecutive entries with the same outer key form one nested map, keyed by
+ * their inner keys.
+ */
+static cardano_error_t
+sorted_map_append_nested(sorted_map_t* map, cardano_plutus_map_t* target)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+  size_t          start  = 0U;
+
+  while ((start < map->count) && (result == CARDANO_SUCCESS))
+  {
+    cardano_plutus_map_t*  inner    = NULL;
+    cardano_plutus_data_t* inner_pd = NULL;
+    size_t                 end      = start;
+
+    result = cardano_plutus_map_new(&inner);
+
+    while ((result == CARDANO_SUCCESS) && (end < map->count) && cardano_plutus_data_equals(map->items[end].key_data, map->items[start].key_data))
+    {
+      cardano_plutus_data_t* value = NULL;
+
+      result = sorted_entry_value(&map->items[end], &value);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_map_insert(inner, map->items[end].inner_key, value);
+      }
+
+      cardano_plutus_data_unref(&value);
+
+      ++end;
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_data_new_map(inner, &inner_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_map_insert(target, map->items[start].key_data, inner_pd);
+    }
+
+    cardano_plutus_map_unref(&inner);
+    cardano_plutus_data_unref(&inner_pd);
+
+    start = end;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes a sorted map of nested entries as a plutus-data map of maps.
+ */
+static cardano_error_t
+sorted_map_encode_nested(sorted_map_t* map, cardano_plutus_data_t** out)
+{
+  cardano_plutus_map_t* encoded = NULL;
+  cardano_error_t       result  = cardano_plutus_map_new(&encoded);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_append_nested(map, encoded);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(encoded, out);
+  }
+
+  cardano_plutus_map_unref(&encoded);
+
+  return result;
+}
+
+/**
+ * \brief Appends a reward account to a sort key in the ledger order.
+ *
+ * The ledger orders accounts by network, test networks first, then by credential.
+ */
+static cardano_error_t
+sort_key_append_account(sort_key_t* key, cardano_reward_address_t* address)
+{
+  byte_t          bytes[CARDANO_LEDGER_ORDER_KEY_SIZE] = { 0 };
+  cardano_error_t result                               = _cardano_ledger_order_reward_address_key(address, bytes);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    sort_key_append(key, bytes, sizeof(bytes));
+  }
+
+  return result;
+}
+
+/**
+ * \brief Builds the sort key and the encoded credential of a reward account.
+ */
+static cardano_error_t
+account_entry(cardano_reward_address_t* address, sort_key_t* key, cardano_plutus_data_t** credential_data)
+{
+  cardano_credential_t* credential = NULL;
+  cardano_error_t       result     = sort_key_append_account(key, address);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    credential = cardano_reward_address_get_credential(address);
+    result     = encode_credential(credential, credential_data);
+  }
+
+  cardano_credential_unref(&credential);
+
+  return result;
+}
+
+/**
+ * \brief Adds an amount keyed by a reward account to a sorted map, summing amounts of the same account.
+ */
+static cardano_error_t
+put_account_amount(sorted_map_t* map, cardano_reward_address_t* address, const uint64_t amount)
+{
+  sort_key_t             key;
+  cardano_plutus_data_t* credential = NULL;
+  cardano_bigint_t*      value      = NULL;
+
+  key.size = 0U;
+
+  cardano_error_t result = account_entry(address, &key, &credential);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_bigint_from_unsigned_int(amount, &value);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_put(map, &key, credential, NULL, NULL, value, MERGE_SUM);
+  }
+
+  cardano_plutus_data_unref(&credential);
+  cardano_bigint_unref(&value);
+
+  return result;
+}
+
+/**
+ * \brief Adds the withdrawals of a transaction to a sorted map of account amounts.
+ */
+static cardano_error_t
+put_withdrawals(sorted_map_t* map, cardano_withdrawal_map_t* withdrawals)
+{
+  const size_t    count  = (withdrawals != NULL) ? cardano_withdrawal_map_get_length(withdrawals) : 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_reward_address_t* address = NULL;
+    uint64_t                  amount  = 0U;
+
+    result = cardano_withdrawal_map_get_key_value_at(withdrawals, i, &address, &amount);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = put_account_amount(map, address, amount);
+    }
+
+    cardano_reward_address_unref(&address);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Adds the amounts of a multi-asset to a sorted map keyed by policy id and asset name.
+ *
+ * Entries are ordered as the ledger orders them: by policy id, then by asset
+ * name compared byte by byte. The filter keeps every amount, only the positive
+ * ones or only the negative ones; amounts of the same asset are summed.
+ */
+static cardano_error_t
+put_assets(sorted_map_t* map, cardano_multi_asset_t* multi_asset, const asset_filter_t filter)
+{
+  if (multi_asset == NULL)
+  {
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_policy_id_list_t* policies = NULL;
+  cardano_error_t           result   = cardano_multi_asset_get_keys(multi_asset, &policies);
+  const size_t              count    = (result == CARDANO_SUCCESS) ? cardano_policy_id_list_get_length(policies) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_blake2b_hash_t*   policy_id = NULL;
+    cardano_asset_name_map_t* assets    = NULL;
+    cardano_plutus_data_t*    policy_pd = NULL;
+
+    result = cardano_policy_id_list_get(policies, i, &policy_id);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_multi_asset_get_assets(multi_asset, policy_id, &assets);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = hash_bytes(policy_id, &policy_pd);
+    }
+
+    const size_t asset_count = (result == CARDANO_SUCCESS) ? cardano_asset_name_map_get_length(assets) : 0U;
+
+    for (size_t j = 0U; (j < asset_count) && (result == CARDANO_SUCCESS); ++j)
+    {
+      cardano_asset_name_t*  asset_name = NULL;
+      int64_t                quantity   = 0;
+      cardano_plutus_data_t* name_pd    = NULL;
+      cardano_bigint_t*      amount     = NULL;
+      sort_key_t             key;
+
+      key.size = 0U;
+      result   = cardano_asset_name_map_get_key_value_at(assets, j, &asset_name, &quantity);
+
+      const bool keep = (filter == ASSETS_ALL) || ((filter == ASSETS_POSITIVE) && (quantity > 0)) || ((filter == ASSETS_NEGATIVE) && (quantity < 0));
+
+      if ((result == CARDANO_SUCCESS) && keep)
+      {
+        sort_key_append_hash(&key, policy_id);
+        sort_key_append(&key, cardano_asset_name_get_bytes(asset_name), cardano_asset_name_get_bytes_size(asset_name));
+
+        result = encode_bytes(cardano_asset_name_get_bytes(asset_name), cardano_asset_name_get_bytes_size(asset_name), &name_pd);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_bigint_from_int(quantity, &amount);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = sorted_map_put(map, &key, policy_pd, name_pd, NULL, amount, MERGE_SUM);
+        }
+      }
+
+      cardano_asset_name_unref(&asset_name);
+      cardano_plutus_data_unref(&name_pd);
+      cardano_bigint_unref(&amount);
+    }
+
+    cardano_blake2b_hash_unref(&policy_id);
+    cardano_asset_name_map_unref(&assets);
+    cardano_plutus_data_unref(&policy_pd);
+  }
+
+  cardano_policy_id_list_unref(&policies);
+
+  return result;
+}
+
+/**
+ * \brief Computes the greatest common divisor of two unsigned integers.
+ */
+static uint64_t
+gcd_u64(const uint64_t lhs, const uint64_t rhs)
+{
+  uint64_t a = lhs;
+  uint64_t b = rhs;
+
+  while (b != 0U)
+  {
+    const uint64_t remainder = a % b;
+
+    a = b;
+    b = remainder;
+  }
+
+  return a;
+}
+
+/**
+ * \brief Adds a credential to a sorted map keyed by credential, with an optional value.
+ */
+static cardano_error_t
+put_credential(sorted_map_t* map, cardano_credential_t* credential, cardano_plutus_data_t* value)
+{
+  sort_key_t             key;
+  cardano_plutus_data_t* key_pd = NULL;
+
+  key.size = 0U;
+
+  cardano_error_t result = sort_key_append_credential(&key, credential);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_credential(credential, &key_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_put(map, &key, key_pd, NULL, value, NULL, MERGE_KEEP_FIRST);
+  }
+
+  cardano_plutus_data_unref(&key_pd);
+
+  return result;
+}
+
+/**
+ * \brief Inserts the ada entry (empty policy id -> {empty asset name -> coin}) into a value map.
+ *
+ * The entry is inserted even for a zero coin, as the ledger's \c transValue does.
+ */
+static cardano_error_t
+value_add_coin(cardano_plutus_map_t* value_map, const int64_t coin)
+{
+  cardano_plutus_map_t*  inner     = NULL;
+  cardano_plutus_data_t* empty_pol = NULL;
+  cardano_plutus_data_t* empty_asn = NULL;
+  cardano_plutus_data_t* amount    = NULL;
+  cardano_plutus_data_t* inner_pd  = NULL;
+  cardano_error_t        result    = cardano_plutus_map_new(&inner);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_bytes(NULL, 0U, &empty_asn);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_int(coin, &amount);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_map_insert(inner, empty_asn, amount);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(inner, &inner_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_bytes(NULL, 0U, &empty_pol);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_map_insert(value_map, empty_pol, inner_pd);
+  }
+
+  cardano_plutus_map_unref(&inner);
+  cardano_plutus_data_unref(&empty_pol);
+  cardano_plutus_data_unref(&empty_asn);
+  cardano_plutus_data_unref(&amount);
+  cardano_plutus_data_unref(&inner_pd);
+
+  return result;
+}
+
+/**
+ * \brief Appends the policies and amounts of a multi-asset to a value map, in ledger order.
+ *
+ * Policies are ordered by id and the assets of a policy by name compared byte by
+ * byte, the order the ledger folds its asset maps in.
+ */
+static cardano_error_t
+value_add_multiasset(cardano_plutus_map_t* value_map, cardano_multi_asset_t* multi_asset)
+{
+  sorted_map_t map = { NULL, 0U, 0U };
+
+  cardano_error_t result = put_assets(&map, multi_asset, ASSETS_ALL);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_append_nested(&map, value_map);
+  }
+
+  sorted_map_free(&map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a transaction-output value as the zero-ada-asset Value map.
+ *
+ * The ada entry is always present, even for a zero coin, followed by the
+ * policies and assets in ledger order. Every Plutus version shares this shape.
+ */
+static cardano_error_t
+encode_value(cardano_value_t* value, cardano_plutus_data_t** out)
+{
+  cardano_plutus_map_t* value_map = NULL;
+  cardano_error_t       result    = cardano_plutus_map_new(&value_map);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = value_add_coin(value_map, cardano_value_get_coin(value));
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_multi_asset_t* multi_asset = cardano_value_get_multi_asset(value);
+
+    result = value_add_multiasset(value_map, multi_asset);
+
+    cardano_multi_asset_unref(&multi_asset);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(value_map, out);
+  }
+
+  cardano_plutus_map_unref(&value_map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the lovelace-only fee as the zero-ada-asset Value map.
+ */
+static cardano_error_t
+encode_fee(const uint64_t coin, cardano_plutus_data_t** out)
+{
+  cardano_plutus_map_t* value_map = NULL;
+  cardano_error_t       result    = cardano_plutus_map_new(&value_map);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = value_add_coin(value_map, (int64_t)coin);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(value_map, out);
+  }
+
+  cardano_plutus_map_unref(&value_map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the mint field as the zero-ada-asset MintValue map.
+ *
+ * The map always opens with the synthetic ada entry (empty policy ->
+ * {empty asset -> 0}) and is followed by the sorted mint policies with signed
+ * amounts.
+ */
+static cardano_error_t
+encode_mint(cardano_multi_asset_t* mint, cardano_plutus_data_t** out)
+{
+  cardano_plutus_map_t*  value_map = NULL;
+  cardano_plutus_map_t*  inner     = NULL;
+  cardano_plutus_data_t* empty_pol = NULL;
+  cardano_plutus_data_t* empty_asn = NULL;
+  cardano_plutus_data_t* zero      = NULL;
+  cardano_plutus_data_t* inner_pd  = NULL;
+  cardano_error_t        result    = cardano_plutus_map_new(&value_map);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_map_new(&inner);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_bytes(NULL, 0U, &empty_asn);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_int(0, &zero);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_map_insert(inner, empty_asn, zero);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(inner, &inner_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_bytes(NULL, 0U, &empty_pol);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_map_insert(value_map, empty_pol, inner_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = value_add_multiasset(value_map, mint);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(value_map, out);
+  }
+
+  cardano_plutus_map_unref(&value_map);
+  cardano_plutus_map_unref(&inner);
+  cardano_plutus_data_unref(&empty_pol);
+  cardano_plutus_data_unref(&empty_asn);
+  cardano_plutus_data_unref(&zero);
+  cardano_plutus_data_unref(&inner_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the output datum field for V1 (datum hash only, Maybe DatumHash).
+ *
+ * Some(hash) when the datum is a hash, None otherwise. Inline data in inputs is
+ * rejected upstream, so the only datum reaching V1 is a hash.
+ */
+static cardano_error_t
+output_datum_v1(cardano_datum_t* datum, cardano_plutus_data_t** out)
+{
+  if (datum != NULL)
+  {
+    cardano_datum_type_t type = CARDANO_DATUM_TYPE_DATA_HASH;
+
+    if (cardano_datum_get_type(datum, &type) == CARDANO_SUCCESS)
+    {
+      if (type == CARDANO_DATUM_TYPE_DATA_HASH)
+      {
+        cardano_blake2b_hash_t* hash = cardano_datum_get_data_hash(datum);
+        cardano_plutus_data_t*  pd   = NULL;
+        cardano_error_t         res  = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+        if (hash != NULL)
+        {
+          res = hash_bytes(hash, &pd);
+        }
+
+        cardano_blake2b_hash_unref(&hash);
+
+        if (res != CARDANO_SUCCESS)
+        {
+          return res;
+        }
+
+        res = wrap_constr(CONSTR_0, pd, out);
+
+        cardano_plutus_data_unref(&pd);
+
+        return res;
+      }
+    }
+  }
+
+  return empty_constr(CONSTR_1, out);
+}
+
+/**
+ * \brief Encodes the output datum option for V2 (NoOutputDatum/Hash/Inline).
+ *
+ * None -> Constr 0, hash -> Constr 1 [hash], inline data -> Constr 2 [data].
+ */
+static cardano_error_t
+output_datum_v2(cardano_datum_t* datum, cardano_plutus_data_t** out)
+{
+  if (datum == NULL)
+  {
+    return empty_constr(CONSTR_0, out);
+  }
+
+  cardano_datum_type_t type   = CARDANO_DATUM_TYPE_DATA_HASH;
+  cardano_error_t      result = cardano_datum_get_type(datum, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (type)
+  {
+    case CARDANO_DATUM_TYPE_DATA_HASH:
+    {
+      cardano_blake2b_hash_t* hash = cardano_datum_get_data_hash(datum);
+      cardano_plutus_data_t*  pd   = NULL;
+
+      result = CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+
+      if (hash != NULL)
+      {
+        result = hash_bytes(hash, &pd);
+      }
+
+      cardano_blake2b_hash_unref(&hash);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_1, pd, out);
+      }
+
+      cardano_plutus_data_unref(&pd);
+
+      break;
+    }
+    case CARDANO_DATUM_TYPE_INLINE_DATA:
+    {
+      cardano_plutus_data_t* inline_data = cardano_datum_get_inline_data(datum);
+
+      result = wrap_constr(CONSTR_2, inline_data, out);
+
+      cardano_plutus_data_unref(&inline_data);
+
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_DATUM_TYPE;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes the optional script ref of an output as a Maybe ScriptHash.
+ *
+ * Some(script hash) when present, None otherwise.
+ */
+static cardano_error_t
+output_script_ref(cardano_transaction_output_t* output, cardano_plutus_data_t** out)
+{
+  cardano_script_t* script = cardano_transaction_output_get_script_ref(output);
+
+  if (script == NULL)
+  {
+    return empty_constr(CONSTR_1, out);
+  }
+
+  cardano_blake2b_hash_t* hash   = cardano_script_get_hash(script);
+  cardano_plutus_data_t*  pd     = NULL;
+  cardano_error_t         result = (hash != NULL) ? CARDANO_SUCCESS : CARDANO_ERROR_POINTER_IS_NULL;
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = hash_bytes(hash, &pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = wrap_constr(CONSTR_0, pd, out);
+  }
+
+  cardano_blake2b_hash_unref(&hash);
+  cardano_script_unref(&script);
+  cardano_plutus_data_unref(&pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a transaction output for the given version.
+ *
+ * V1: Constr 0 [address, value, Maybe datum hash].
+ * V2: Constr 0 [address, value, datum option, Maybe script hash].
+ */
+static cardano_error_t
+encode_output(cardano_transaction_output_t* output, const bool is_v2, cardano_plutus_data_t** out)
+{
+  cardano_address_t*     address = cardano_transaction_output_get_address(output);
+  cardano_value_t*       value   = cardano_transaction_output_get_value(output);
+  cardano_datum_t*       datum   = cardano_transaction_output_get_datum(output);
+  cardano_plutus_list_t* fields  = NULL;
+  cardano_plutus_data_t* addr_pd = NULL;
+  cardano_plutus_data_t* val_pd  = NULL;
+  cardano_plutus_data_t* dat_pd  = NULL;
+  cardano_plutus_data_t* ref_pd  = NULL;
+  cardano_error_t        result  = cardano_plutus_list_new(&fields);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_address(address, &addr_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, addr_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_value(value, &val_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, val_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = is_v2 ? output_datum_v2(datum, &dat_pd) : output_datum_v1(datum, &dat_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, dat_pd);
+  }
+
+  if ((result == CARDANO_SUCCESS) && is_v2)
+  {
+    result = output_script_ref(output, &ref_pd);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(fields, ref_pd);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, out);
+  }
+
+  cardano_address_unref(&address);
+  cardano_value_unref(&value);
+  cardano_datum_unref(&datum);
+  cardano_plutus_data_unref(&addr_pd);
+  cardano_plutus_data_unref(&val_pd);
+  cardano_plutus_data_unref(&dat_pd);
+  cardano_plutus_data_unref(&ref_pd);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a transaction input (out ref).
+ *
+ * V1/V2 use the wrapped transaction id: Constr 0 [Constr 0 [id], index].
+ */
+static cardano_error_t
+out_ref_wrapped(cardano_transaction_input_t* input, cardano_plutus_data_t** out)
+{
+  cardano_blake2b_hash_t* id      = cardano_transaction_input_get_id(input);
+  cardano_plutus_list_t*  fields  = NULL;
+  cardano_plutus_data_t*  id_pd   = NULL;
+  cardano_plutus_data_t*  wrap_id = NULL;
+  cardano_plutus_data_t*  idx_pd  = NULL;
+  cardano_error_t         result  = cardano_plutus_list_new(&fields);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = hash_bytes(id, &id_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = wrap_constr(CONSTR_0, id_pd, &wrap_id);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, wrap_id);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(cardano_transaction_input_get_index(input), &idx_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, idx_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, out);
+  }
+
+  cardano_blake2b_hash_unref(&id);
+  cardano_plutus_data_unref(&id_pd);
+  cardano_plutus_data_unref(&wrap_id);
+  cardano_plutus_data_unref(&idx_pd);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Finds the resolved output of an input in the UTxO set.
+ *
+ * Returns a new reference to the output, or NULL when the input is not present.
+ */
+static cardano_transaction_output_t*
+resolve_output(cardano_utxo_list_t* resolved_inputs, cardano_transaction_input_t* input)
+{
+  const size_t count = cardano_utxo_list_get_length(resolved_inputs);
+
+  for (size_t i = 0U; i < count; ++i)
+  {
+    cardano_utxo_t* utxo = NULL;
+
+    if (cardano_utxo_list_get(resolved_inputs, i, &utxo) != CARDANO_SUCCESS)
+    {
+      cardano_utxo_unref(&utxo);
+      return NULL;
+    }
+
+    cardano_transaction_input_t* candidate = cardano_utxo_get_input(utxo);
+
+    if (cardano_transaction_input_equals(candidate, input))
+    {
+      cardano_transaction_output_t* output = cardano_utxo_get_output(utxo);
+
+      cardano_transaction_input_unref(&candidate);
+      cardano_utxo_unref(&utxo);
+
+      return output;
+    }
+
+    cardano_transaction_input_unref(&candidate);
+    cardano_utxo_unref(&utxo);
+  }
+
+  return NULL;
+}
+
+/**
+ * \brief Encodes a single resolved input (TxInInfo).
+ *
+ * Constr 0 [out ref (wrapped id), resolved output].
+ */
+static cardano_error_t
+tx_in_info(
+  cardano_transaction_input_t* input,
+  cardano_utxo_list_t*         resolved_inputs,
+  const bool                   is_v2,
+  cardano_plutus_data_t**      out)
+{
+  cardano_transaction_output_t* output = resolve_output(resolved_inputs, input);
+
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_plutus_list_t* fields = NULL;
+  cardano_plutus_data_t* ref_pd = NULL;
+  cardano_plutus_data_t* out_pd = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&fields);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = out_ref_wrapped(input, &ref_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, ref_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_output(output, is_v2, &out_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, out_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, out);
+  }
+
+  cardano_transaction_output_unref(&output);
+  cardano_plutus_data_unref(&ref_pd);
+  cardano_plutus_data_unref(&out_pd);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a set of inputs as the list of resolved TxInInfo.
+ */
+static cardano_error_t
+encode_inputs(
+  cardano_transaction_input_set_t* inputs,
+  cardano_utxo_list_t*             resolved_inputs,
+  const bool                       is_v2,
+  cardano_plutus_data_t**          out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  const size_t count = (inputs != NULL) ? cardano_transaction_input_set_get_length(inputs) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_transaction_input_t* input = NULL;
+    cardano_plutus_data_t*       pd    = NULL;
+
+    result = cardano_transaction_input_set_get(inputs, i, &input);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = tx_in_info(input, resolved_inputs, is_v2, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_transaction_input_unref(&input);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the transaction outputs as the list of outputs.
+ */
+static cardano_error_t
+encode_outputs(cardano_transaction_output_list_t* outputs, const bool is_v2, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  const size_t count = (outputs != NULL) ? cardano_transaction_output_list_get_length(outputs) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_transaction_output_t* output = NULL;
+    cardano_plutus_data_t*        pd     = NULL;
+
+    result = cardano_transaction_output_list_get(outputs, i, &output);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_output(output, is_v2, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_transaction_output_unref(&output);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the required signers as the list of public key hashes.
+ */
+static cardano_error_t
+encode_signatories(cardano_blake2b_hash_set_t* signers, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  const size_t count = (signers != NULL) ? cardano_blake2b_hash_set_get_length(signers) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_blake2b_hash_t* hash = NULL;
+    cardano_plutus_data_t*  pd   = NULL;
+
+    result = cardano_blake2b_hash_set_get(signers, i, &hash);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = hash_bytes(hash, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_blake2b_hash_unref(&hash);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the withdrawals as a list of (Constr 0 [stake credential], coin) pairs.
+ *
+ * V1 uses a list of tuples (each tuple a Constr 0 [key, value]); V2 uses a map.
+ * The stake credential is wrapped (the wrapped-stake-credential shape).
+ */
+static cardano_error_t
+encode_withdrawals(cardano_withdrawal_map_t* withdrawals, const bool is_v2, cardano_plutus_data_t** out)
+{
+  const size_t count = (withdrawals != NULL) ? cardano_withdrawal_map_get_length(withdrawals) : 0U;
+
+  cardano_plutus_list_t* list   = NULL;
+  cardano_plutus_map_t*  map    = NULL;
+  cardano_error_t        result = CARDANO_SUCCESS;
+
+  if (is_v2)
+  {
+    result = cardano_plutus_map_new(&map);
+  }
+  else
+  {
+    result = cardano_plutus_list_new(&list);
+  }
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_reward_address_t* address    = NULL;
+    uint64_t                  coin       = 0U;
+    cardano_credential_t*     credential = NULL;
+    cardano_plutus_data_t*    cred_pd    = NULL;
+    cardano_plutus_data_t*    key_pd     = NULL;
+    cardano_plutus_data_t*    coin_pd    = NULL;
+
+    result = cardano_withdrawal_map_get_key_value_at(withdrawals, i, &address, &coin);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      credential = cardano_reward_address_get_credential(address);
+      result     = encode_credential(credential, &cred_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = wrap_constr(CONSTR_0, cred_pd, &key_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_data_new_integer_from_uint(coin, &coin_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      if (is_v2)
+      {
+        result = cardano_plutus_map_insert(map, key_pd, coin_pd);
+      }
+      else
+      {
+        cardano_plutus_list_t* tuple    = NULL;
+        cardano_plutus_data_t* tuple_pd = NULL;
+
+        result = cardano_plutus_list_new(&tuple);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_list_add(tuple, key_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_list_add(tuple, coin_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_constr(CONSTR_0, tuple, &tuple_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_list_add(list, tuple_pd);
+        }
+
+        cardano_plutus_list_unref(&tuple);
+        cardano_plutus_data_unref(&tuple_pd);
+      }
+    }
+
+    cardano_reward_address_unref(&address);
+    cardano_credential_unref(&credential);
+    cardano_plutus_data_unref(&cred_pd);
+    cardano_plutus_data_unref(&key_pd);
+    cardano_plutus_data_unref(&coin_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    if (is_v2)
+    {
+      result = cardano_plutus_data_new_map(map, out);
+    }
+    else
+    {
+      result = cardano_plutus_data_new_list(list, out);
+    }
+  }
+
+  cardano_plutus_list_unref(&list);
+  cardano_plutus_map_unref(&map);
+
+  return result;
+}
+
+cardano_error_t
+cardano_uplc_int_slot_to_posix_time(
+  const cardano_slot_config_t* slot_config,
+  uint64_t                     slot,
+  uint64_t*                    posix_time)
+{
+  uint64_t ms_after_begin = 0U;
+
+  if ((slot_config == NULL) || (posix_time == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (slot < slot_config->zero_slot)
+  {
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  ms_after_begin = (slot - slot_config->zero_slot) * slot_config->slot_length;
+
+  *posix_time = slot_config->zero_time + ms_after_begin;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Converts an absolute slot to its beginning POSIX time (milliseconds).
+ *
+ * Delegates to the shared \ref cardano_uplc_int_slot_to_posix_time so there is a
+ * single implementation of the slot-to-time conversion; this thin wrapper keeps
+ * the encoder's existing (slot, slot_config) argument order.
+ */
+static cardano_error_t
+slot_to_posix(const uint64_t slot, const cardano_slot_config_t* slot_config, uint64_t* time)
+{
+  return cardano_uplc_int_slot_to_posix_time(slot_config, slot, time);
+}
+
+/**
+ * \brief Encodes one bound of the validity interval as an Extended/LowerBound.
+ *
+ * A finite bound is Constr 0 [Constr 1 [time], closure]; an infinite bound is
+ * Constr 0 [Constr 0|2, true]. Finite lower bounds are inclusive (true) and
+ * finite upper bounds are exclusive (false); infinite bounds are exclusive.
+ */
+static cardano_error_t
+interval_bound(const uint64_t* slot, const bool is_lower, const cardano_slot_config_t* slot_config, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* fields  = NULL;
+  cardano_plutus_data_t* extreme = NULL;
+  cardano_plutus_data_t* closure = NULL;
+  cardano_error_t        result  = cardano_plutus_list_new(&fields);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  if (slot != NULL)
+  {
+    cardano_plutus_data_t* time  = NULL;
+    uint64_t               posix = 0U;
+
+    result = slot_to_posix(*slot, slot_config, &posix);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_data_new_integer_from_uint(posix, &time);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = wrap_constr(CONSTR_1, time, &extreme);
+    }
+
+    cardano_plutus_data_unref(&time);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_bool(is_lower, &closure);
+    }
+  }
+  else
+  {
+    result = empty_constr(is_lower ? CONSTR_0 : CONSTR_2, &extreme);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_bool(true, &closure);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, extreme);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, closure);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, out);
+  }
+
+  cardano_plutus_data_unref(&extreme);
+  cardano_plutus_data_unref(&closure);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the validity interval as a POSIX TimeRange: Constr 0 [lower, upper].
+ */
+static cardano_error_t
+valid_range(cardano_transaction_body_t* body, const cardano_slot_config_t* slot_config, cardano_plutus_data_t** out)
+{
+  const uint64_t* lower = cardano_transaction_body_get_invalid_before(body);
+  const uint64_t* upper = cardano_transaction_body_get_invalid_after(body);
+
+  cardano_plutus_list_t* fields   = NULL;
+  cardano_plutus_data_t* lower_pd = NULL;
+  cardano_plutus_data_t* upper_pd = NULL;
+  cardano_error_t        result   = cardano_plutus_list_new(&fields);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = interval_bound(lower, true, slot_config, &lower_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, lower_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = interval_bound(upper, false, slot_config, &upper_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, upper_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, out);
+  }
+
+  cardano_plutus_data_unref(&lower_pd);
+  cardano_plutus_data_unref(&upper_pd);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Computes the blake2b-256 hash of a plutus-data value from its CBOR.
+ *
+ * The plutus-data value caches the original CBOR when decoded, so the hash is
+ * computed over the original datum bytes.
+ */
+static cardano_error_t
+datum_hash(cardano_plutus_data_t* datum, cardano_blake2b_hash_t** out)
+{
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_buffer_t* buffer = NULL;
+  cardano_error_t   result = cardano_plutus_data_to_cbor(datum, writer);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_cbor_writer_encode_in_buffer(writer, &buffer);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_blake2b_compute_hash(cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer), CARDANO_BLAKE2B_HASH_SIZE_256, out);
+  }
+
+  cardano_buffer_unref(&buffer);
+  cardano_cbor_writer_unref(&writer);
+
+  return result;
+}
+
+/**
+ * \brief Adds the witness datums of a transaction to a sorted map keyed by datum hash.
+ */
+static cardano_error_t
+put_datums(sorted_map_t* map, cardano_plutus_data_set_t* datums)
+{
+  const size_t    count  = (datums != NULL) ? cardano_plutus_data_set_get_length(datums) : 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_plutus_data_t*  datum   = NULL;
+    cardano_blake2b_hash_t* hash    = NULL;
+    cardano_plutus_data_t*  hash_pd = NULL;
+    sort_key_t              key;
+
+    key.size = 0U;
+    result   = cardano_plutus_data_set_get(datums, i, &datum);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = datum_hash(datum, &hash);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      sort_key_append_hash(&key, hash);
+      result = hash_bytes(hash, &hash_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = sorted_map_put(map, &key, hash_pd, NULL, datum, NULL, MERGE_KEEP_FIRST);
+    }
+
+    cardano_plutus_data_unref(&datum);
+    cardano_blake2b_hash_unref(&hash);
+    cardano_plutus_data_unref(&hash_pd);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes the witness datums as a map of datum hash -> datum, in hash order.
+ *
+ * The ledger keeps the witness datums in a map keyed by hash, so the context
+ * lists them by hash, not in witness order, and a repeated datum appears once.
+ */
+static cardano_error_t
+encode_data(cardano_plutus_data_set_t* datums, cardano_plutus_data_t** out)
+{
+  sorted_map_t map = { NULL, 0U, 0U };
+
+  cardano_error_t result = put_datums(&map, datums);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&map, out);
+  }
+
+  sorted_map_free(&map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the witness datums as the V1 list of (datum hash, datum) pairs, in hash order.
+ *
+ * The V1 \c txInfoData field has type \c [(DatumHash, Datum)], so each entry is
+ * a tuple Constr 0 [hash, datum] rather than a map entry.
+ */
+static cardano_error_t
+encode_data_v1(cardano_plutus_data_set_t* datums, cardano_plutus_data_t** out)
+{
+  sorted_map_t           map    = { NULL, 0U, 0U };
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = put_datums(&map, datums);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_new(&list);
+  }
+
+  for (size_t i = 0U; (i < map.count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_plutus_list_t* tuple    = NULL;
+    cardano_plutus_data_t* tuple_pd = NULL;
+
+    result = cardano_plutus_list_new(&tuple);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(tuple, map.items[i].key_data);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(tuple, map.items[i].value);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_constr(CONSTR_0, tuple, &tuple_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, tuple_pd);
+    }
+
+    cardano_plutus_list_unref(&tuple);
+    cardano_plutus_data_unref(&tuple_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+  sorted_map_free(&map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a certificate as a V1/V2 DCert (partial certificates).
+ *
+ * Only the V1/V2-supported certificate kinds are encoded; other kinds yield an
+ * unsupported-certificate error.
+ */
+static cardano_error_t
+encode_certificate(cardano_certificate_t* certificate, cardano_plutus_data_t** out)
+{
+  cardano_cert_type_t type   = CARDANO_CERT_TYPE_STAKE_REGISTRATION;
+  cardano_error_t     result = cardano_cert_get_type(certificate, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (type)
+  {
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION:
+    {
+      cardano_stake_registration_cert_t* cert       = NULL;
+      cardano_credential_t*              credential = NULL;
+      cardano_plutus_data_t*             cred_pd    = NULL;
+      cardano_plutus_data_t*             wrapped    = NULL;
+
+      result = cardano_certificate_to_stake_registration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_stake_registration_cert_get_credential(cert);
+        result     = encode_credential(credential, &cred_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_0, cred_pd, &wrapped);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_0, wrapped, out);
+      }
+
+      cardano_stake_registration_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_plutus_data_unref(&cred_pd);
+      cardano_plutus_data_unref(&wrapped);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DEREGISTRATION:
+    {
+      cardano_stake_deregistration_cert_t* cert       = NULL;
+      cardano_credential_t*                credential = NULL;
+      cardano_plutus_data_t*               cred_pd    = NULL;
+      cardano_plutus_data_t*               wrapped    = NULL;
+
+      result = cardano_certificate_to_stake_deregistration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_stake_deregistration_cert_get_credential(cert);
+        result     = encode_credential(credential, &cred_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_0, cred_pd, &wrapped);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_1, wrapped, out);
+      }
+
+      cardano_stake_deregistration_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_plutus_data_unref(&cred_pd);
+      cardano_plutus_data_unref(&wrapped);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DELEGATION:
+    {
+      cardano_stake_delegation_cert_t* cert       = NULL;
+      cardano_credential_t*            credential = NULL;
+      cardano_blake2b_hash_t*          pool       = NULL;
+      cardano_plutus_list_t*           fields     = NULL;
+      cardano_plutus_data_t*           cred_pd    = NULL;
+      cardano_plutus_data_t*           wrapped    = NULL;
+      cardano_plutus_data_t*           pool_pd    = NULL;
+
+      result = cardano_certificate_to_stake_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_list_new(&fields);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_stake_delegation_cert_get_credential(cert);
+        result     = encode_credential(credential, &cred_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_0, cred_pd, &wrapped);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_list_add(fields, wrapped);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        pool   = cardano_stake_delegation_cert_get_pool_key_hash(cert);
+        result = hash_bytes(pool, &pool_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_list_add(fields, pool_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = encode_constr(CONSTR_2, fields, out);
+      }
+
+      cardano_stake_delegation_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_blake2b_hash_unref(&pool);
+      cardano_plutus_data_unref(&cred_pd);
+      cardano_plutus_data_unref(&wrapped);
+      cardano_plutus_data_unref(&pool_pd);
+      cardano_plutus_list_unref(&fields);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_POOL_REGISTRATION:
+    {
+      cardano_pool_registration_cert_t* cert          = NULL;
+      cardano_pool_params_t*            params        = NULL;
+      cardano_blake2b_hash_t*           operator_hash = NULL;
+      cardano_blake2b_hash_t*           vrf           = NULL;
+      cardano_plutus_list_t*            fields        = NULL;
+      cardano_plutus_data_t*            op_pd         = NULL;
+      cardano_plutus_data_t*            vrf_pd        = NULL;
+
+      result = cardano_certificate_to_pool_registration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_pool_registration_cert_get_params(cert, &params);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_pool_params_get_operator_key_hash(params, &operator_hash);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_pool_params_get_vrf_vk_hash(params, &vrf);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = hash_bytes(operator_hash, &op_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = hash_bytes(vrf, &vrf_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_list_new(&fields);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_list_add(fields, op_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_list_add(fields, vrf_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = encode_constr(CONSTR_3, fields, out);
+      }
+
+      cardano_pool_registration_cert_unref(&cert);
+      cardano_pool_params_unref(&params);
+      cardano_blake2b_hash_unref(&operator_hash);
+      cardano_blake2b_hash_unref(&vrf);
+      cardano_plutus_list_unref(&fields);
+      cardano_plutus_data_unref(&op_pd);
+      cardano_plutus_data_unref(&vrf_pd);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_POOL_RETIREMENT:
+    {
+      cardano_pool_retirement_cert_t* cert     = NULL;
+      cardano_blake2b_hash_t*         pool     = NULL;
+      cardano_plutus_list_t*          fields   = NULL;
+      cardano_plutus_data_t*          pool_pd  = NULL;
+      cardano_plutus_data_t*          epoch_pd = NULL;
+
+      result = cardano_certificate_to_pool_retirement(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        pool   = cardano_pool_retirement_cert_get_pool_key_hash(cert);
+        result = hash_bytes(pool, &pool_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_data_new_integer_from_uint(cardano_pool_retirement_cert_get_epoch(cert), &epoch_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_list_new(&fields);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_list_add(fields, pool_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_list_add(fields, epoch_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = encode_constr(CONSTR_4, fields, out);
+      }
+
+      cardano_pool_retirement_cert_unref(&cert);
+      cardano_blake2b_hash_unref(&pool);
+      cardano_plutus_list_unref(&fields);
+      cardano_plutus_data_unref(&pool_pd);
+      cardano_plutus_data_unref(&epoch_pd);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_REGISTRATION:
+    {
+      cardano_registration_cert_t* cert       = NULL;
+      cardano_credential_t*        credential = NULL;
+      cardano_plutus_data_t*       cred_pd    = NULL;
+      cardano_plutus_data_t*       wrapped    = NULL;
+
+      result = cardano_certificate_to_registration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_registration_cert_get_stake_credential(cert);
+        result     = encode_credential(credential, &cred_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_0, cred_pd, &wrapped);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_0, wrapped, out);
+      }
+
+      cardano_registration_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_plutus_data_unref(&cred_pd);
+      cardano_plutus_data_unref(&wrapped);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_UNREGISTRATION:
+    {
+      cardano_unregistration_cert_t* cert       = NULL;
+      cardano_credential_t*          credential = NULL;
+      cardano_plutus_data_t*         cred_pd    = NULL;
+      cardano_plutus_data_t*         wrapped    = NULL;
+
+      result = cardano_certificate_to_unregistration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_unregistration_cert_get_credential(cert);
+        result     = encode_credential(credential, &cred_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_0, cred_pd, &wrapped);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_1, wrapped, out);
+      }
+
+      cardano_unregistration_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_plutus_data_unref(&cred_pd);
+      cardano_plutus_data_unref(&wrapped);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION:
+    case CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS:
+    case CARDANO_CERT_TYPE_VOTE_DELEGATION:
+    case CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION:
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION:
+    case CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION:
+    case CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION:
+    case CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT:
+    case CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD:
+    case CARDANO_CERT_TYPE_DREP_REGISTRATION:
+    case CARDANO_CERT_TYPE_DREP_UNREGISTRATION:
+    case CARDANO_CERT_TYPE_UPDATE_DREP:
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes the certificates as the list of DCert.
+ */
+static cardano_error_t
+encode_certificates(cardano_certificate_set_t* certificates, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  const size_t count = (certificates != NULL) ? cardano_certificate_set_get_length(certificates) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_certificate_t* certificate = NULL;
+    cardano_plutus_data_t* pd          = NULL;
+
+    result = cardano_certificate_set_get(certificates, i, &certificate);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_certificate(certificate, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_certificate_unref(&certificate);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the redeemers of a V2 transaction as a map of script purpose -> redeemer data.
+ */
+static cardano_error_t
+redeemers_map_v2(
+  cardano_transaction_t*   tx,
+  cardano_utxo_list_t*     resolved_inputs,
+  cardano_redeemer_list_t* redeemers,
+  cardano_plutus_data_t**  out)
+{
+  cardano_plutus_map_t* map    = NULL;
+  cardano_error_t       result = cardano_plutus_map_new(&map);
+
+  const size_t count = (redeemers != NULL) ? cardano_redeemer_list_get_length(redeemers) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_redeemer_t*    redeemer   = NULL;
+    cardano_plutus_data_t* purpose_pd = NULL;
+    cardano_plutus_data_t* data       = NULL;
+
+    result = cardano_redeemer_list_get(redeemers, i, &redeemer);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_uplc_int_build_script_purpose_v1v2(tx, resolved_inputs, redeemer, &purpose_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      data   = cardano_redeemer_get_data(redeemer);
+      result = (data != NULL) ? cardano_plutus_map_insert(map, purpose_pd, data) : CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    cardano_redeemer_unref(&redeemer);
+    cardano_plutus_data_unref(&purpose_pd);
+    cardano_plutus_data_unref(&data);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(map, out);
+  }
+
+  cardano_plutus_map_unref(&map);
+
+  return result;
+}
+
+/**
+ * \brief Rejects a transaction that carries Conway-only fields a V1/V2 context cannot represent.
+ *
+ * Mirrors the ledger's \c guardConwayFeaturesForPlutusV1V2: a V1 or V2 script
+ * context cannot be built for a transaction with voting procedures, proposal
+ * procedures, a current-treasury value, or a non-zero treasury donation, so such
+ * a transaction is rejected rather than silently mis-encoded.
+ */
+static cardano_error_t
+guard_conway_features_v1v2(cardano_transaction_body_t* body)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  cardano_voting_procedures_t* votes = cardano_transaction_body_get_voting_procedures(body);
+
+  if (votes != NULL)
+  {
+    cardano_voter_list_t* voters = NULL;
+
+    if (cardano_voting_procedures_get_voters(votes, &voters) == CARDANO_SUCCESS)
+    {
+      if (cardano_voter_list_get_length(voters) > 0U)
+      {
+        result = CARDANO_ERROR_INVALID_ARGUMENT;
+      }
+    }
+
+    cardano_voter_list_unref(&voters);
+  }
+
+  cardano_voting_procedures_unref(&votes);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_proposal_procedure_set_t* proposals = cardano_transaction_body_get_proposal_procedures(body);
+
+    if ((proposals != NULL) && (cardano_proposal_procedure_set_get_length(proposals) > 0U))
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+
+    cardano_proposal_procedure_set_unref(&proposals);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    const uint64_t* treasury = cardano_transaction_body_get_treasury_value(body);
+
+    if (treasury != NULL)
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    const uint64_t* donation = cardano_transaction_body_get_donation(body);
+
+    if ((donation != NULL) && (*donation != 0U))
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Rejects a transaction that carries Dijkstra-only fields a V1, V2 or V3 context cannot represent.
+ *
+ * Mirrors the ledger's \c guardDijkstraFeaturesForPlutusV1toV3: a V1, V2 or V3
+ * script context cannot be built for a transaction with direct deposits,
+ * account balance intervals, required top-level guards, or a script-hash
+ * credential among its guards. Key-hash guards are accepted, since those
+ * contexts see them as signatories.
+ */
+static cardano_error_t
+guard_dijkstra_features_v1v3(cardano_transaction_body_t* body)
+{
+  cardano_direct_deposit_map_t*            deposits    = cardano_transaction_body_get_direct_deposits(body);
+  cardano_account_balance_intervals_map_t* intervals   = cardano_transaction_body_get_account_balance_intervals(body);
+  cardano_required_guards_map_t*           required    = cardano_transaction_body_get_required_top_level_guards(body);
+  cardano_guard_set_t*                     guards      = cardano_transaction_body_get_guards(body);
+  const size_t                             guard_count = (guards != NULL) ? cardano_guard_set_get_length(guards) : 0U;
+  cardano_error_t                          result      = CARDANO_SUCCESS;
+
+  if ((deposits != NULL) && (cardano_direct_deposit_map_get_length(deposits) > 0U))
+  {
+    result = CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if ((intervals != NULL) && (cardano_account_balance_intervals_map_get_length(intervals) > 0U))
+  {
+    result = CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if ((required != NULL) && (cardano_required_guards_map_get_length(required) > 0U))
+  {
+    result = CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  for (size_t i = 0U; (result == CARDANO_SUCCESS) && (i < guard_count); ++i)
+  {
+    cardano_credential_t*     credential = NULL;
+    cardano_credential_type_t type       = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+
+    result = cardano_guard_set_get(guards, i, &credential);
+
+    if ((result == CARDANO_SUCCESS) && (cardano_credential_get_type(credential, &type) == CARDANO_SUCCESS) && (type == CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH))
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+
+    cardano_credential_unref(&credential);
+  }
+
+  cardano_direct_deposit_map_unref(&deposits);
+  cardano_account_balance_intervals_map_unref(&intervals);
+  cardano_required_guards_map_unref(&required);
+  cardano_guard_set_unref(&guards);
+
+  return result;
+}
+
+/**
+ * \brief Validates the reference inputs of a V1 transaction (which has no reference-input field).
+ *
+ * Mirrors the ledger's V1 \c toPlutusTxInfo, which resolves each reference input
+ * through \c transTxInInfoV1 (and so fails on an output the V1 TxOut cannot
+ * represent, such as an inline datum or a reference script) and then discards it. Our
+ * V1 output encoder silently drops those fields, so the representability check is
+ * done explicitly here.
+ */
+static cardano_error_t
+validate_v1_reference_inputs(cardano_transaction_input_set_t* ref_inputs, cardano_utxo_list_t* resolved_inputs)
+{
+  const size_t    count  = (ref_inputs != NULL) ? cardano_transaction_input_set_get_length(ref_inputs) : 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (result == CARDANO_SUCCESS) && (i < count); ++i)
+  {
+    cardano_transaction_input_t* input = NULL;
+
+    result = cardano_transaction_input_set_get(ref_inputs, i, &input);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_transaction_output_t* output = resolve_output(resolved_inputs, input);
+
+      if (output == NULL)
+      {
+        result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+      }
+      else
+      {
+        cardano_script_t*    script = cardano_transaction_output_get_script_ref(output);
+        cardano_datum_t*     datum  = cardano_transaction_output_get_datum(output);
+        cardano_datum_type_t dtype  = CARDANO_DATUM_TYPE_DATA_HASH;
+
+        const bool has_script = (script != NULL);
+        const bool has_inline = (datum != NULL) && (cardano_datum_get_type(datum, &dtype) == CARDANO_SUCCESS) && (dtype == CARDANO_DATUM_TYPE_INLINE_DATA);
+
+        if (has_script || has_inline)
+        {
+          result = CARDANO_ERROR_INVALID_ARGUMENT;
+        }
+
+        cardano_script_unref(&script);
+        cardano_datum_unref(&datum);
+        cardano_transaction_output_unref(&output);
+      }
+    }
+
+    cardano_transaction_input_unref(&input);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes the TxInfo of a transaction for V1 or V2.
+ */
+static cardano_error_t
+build_tx_info(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  const bool                   is_v2,
+  cardano_plutus_data_t**      out)
+{
+  if ((tx == NULL) || (resolved_inputs == NULL) || (slot_config == NULL) || (out == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body        = cardano_transaction_get_body(tx);
+  cardano_witness_set_t*      witness_set = cardano_transaction_get_witness_set(tx);
+  cardano_plutus_list_t*      fields      = NULL;
+  cardano_error_t             result      = cardano_plutus_list_new(&fields);
+
+  cardano_transaction_input_set_t*   inputs     = NULL;
+  cardano_transaction_input_set_t*   ref_inputs = NULL;
+  cardano_transaction_output_list_t* outputs    = NULL;
+  cardano_multi_asset_t*             mint       = NULL;
+  cardano_certificate_set_t*         certs      = NULL;
+  cardano_withdrawal_map_t*          withdraws  = NULL;
+  cardano_blake2b_hash_set_t*        signers    = NULL;
+  cardano_plutus_data_set_t*         datums     = NULL;
+  cardano_redeemer_list_t*           redeemers  = NULL;
+  cardano_blake2b_hash_t*            tx_id      = NULL;
+
+  cardano_plutus_data_t* inputs_pd  = NULL;
+  cardano_plutus_data_t* refs_pd    = NULL;
+  cardano_plutus_data_t* outputs_pd = NULL;
+  cardano_plutus_data_t* fee_pd     = NULL;
+  cardano_plutus_data_t* mint_pd    = NULL;
+  cardano_plutus_data_t* certs_pd   = NULL;
+  cardano_plutus_data_t* with_pd    = NULL;
+  cardano_plutus_data_t* range_pd   = NULL;
+  cardano_plutus_data_t* signs_pd   = NULL;
+  cardano_plutus_data_t* redeem_pd  = NULL;
+  cardano_plutus_data_t* data_pd    = NULL;
+  cardano_plutus_data_t* id_pd      = NULL;
+  cardano_plutus_data_t* wrap_id_pd = NULL;
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = guard_conway_features_v1v2(body);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = guard_dijkstra_features_v1v3(body);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    inputs     = cardano_transaction_body_get_inputs(body);
+    ref_inputs = cardano_transaction_body_get_reference_inputs(body);
+
+    if (!is_v2)
+    {
+      result = validate_v1_reference_inputs(ref_inputs, resolved_inputs);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_inputs(inputs, resolved_inputs, is_v2, &inputs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, inputs_pd);
+  }
+
+  if ((result == CARDANO_SUCCESS) && is_v2)
+  {
+    result = encode_inputs(ref_inputs, resolved_inputs, is_v2, &refs_pd);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(fields, refs_pd);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    outputs = cardano_transaction_body_get_outputs(body);
+    result  = encode_outputs(outputs, is_v2, &outputs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, outputs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_fee(cardano_transaction_body_get_fee(body), &fee_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, fee_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    mint   = cardano_transaction_body_get_mint(body);
+    result = encode_mint(mint, &mint_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, mint_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    certs  = cardano_transaction_body_get_certificates(body);
+    result = encode_certificates(certs, &certs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, certs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    withdraws = cardano_transaction_body_get_withdrawals(body);
+    result    = encode_withdrawals(withdraws, is_v2, &with_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, with_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = valid_range(body, slot_config, &range_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, range_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    signers = cardano_transaction_body_get_required_signers(body);
+    result  = encode_signatories(signers, &signs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, signs_pd);
+  }
+
+  if ((result == CARDANO_SUCCESS) && is_v2)
+  {
+    redeemers = cardano_witness_set_get_redeemers(witness_set);
+    result    = redeemers_map_v2(tx, resolved_inputs, redeemers, &redeem_pd);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(fields, redeem_pd);
+    }
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    datums = cardano_witness_set_get_plutus_data(witness_set);
+    result = is_v2 ? encode_data(datums, &data_pd) : encode_data_v1(datums, &data_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, data_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    tx_id  = cardano_transaction_get_id(tx);
+    result = (tx_id != NULL) ? hash_bytes(tx_id, &id_pd) : CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = wrap_constr(CONSTR_0, id_pd, &wrap_id_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, wrap_id_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, out);
+  }
+
+  cardano_transaction_body_unref(&body);
+  cardano_witness_set_unref(&witness_set);
+  cardano_transaction_input_set_unref(&inputs);
+  cardano_transaction_input_set_unref(&ref_inputs);
+  cardano_transaction_output_list_unref(&outputs);
+  cardano_multi_asset_unref(&mint);
+  cardano_certificate_set_unref(&certs);
+  cardano_withdrawal_map_unref(&withdraws);
+  cardano_blake2b_hash_set_unref(&signers);
+  cardano_plutus_data_set_unref(&datums);
+  cardano_redeemer_list_unref(&redeemers);
+  cardano_blake2b_hash_unref(&tx_id);
+
+  cardano_plutus_data_unref(&inputs_pd);
+  cardano_plutus_data_unref(&refs_pd);
+  cardano_plutus_data_unref(&outputs_pd);
+  cardano_plutus_data_unref(&fee_pd);
+  cardano_plutus_data_unref(&mint_pd);
+  cardano_plutus_data_unref(&certs_pd);
+  cardano_plutus_data_unref(&with_pd);
+  cardano_plutus_data_unref(&range_pd);
+  cardano_plutus_data_unref(&signs_pd);
+  cardano_plutus_data_unref(&redeem_pd);
+  cardano_plutus_data_unref(&data_pd);
+  cardano_plutus_data_unref(&id_pd);
+  cardano_plutus_data_unref(&wrap_id_pd);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/* V3 STATIC FUNCTIONS *******************************************************/
+
+/**
+ * \brief Wraps a value as Some(x) = Constr 0 [x]; a NULL value yields None = Constr 1.
+ */
+static cardano_error_t
+encode_maybe(cardano_plutus_data_t* value, cardano_plutus_data_t** out)
+{
+  if (value == NULL)
+  {
+    return empty_constr(CONSTR_1, out);
+  }
+
+  return wrap_constr(CONSTR_0, value, out);
+}
+
+/**
+ * \brief Encodes the V3 mint as the plain MintValue map: signed amounts, no synthetic ada entry.
+ */
+static cardano_error_t
+mint_plain(cardano_multi_asset_t* mint, cardano_plutus_data_t** out)
+{
+  cardano_plutus_map_t* value_map = NULL;
+  cardano_error_t       result    = cardano_plutus_map_new(&value_map);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = value_add_multiasset(value_map, mint);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(value_map, out);
+  }
+
+  cardano_plutus_map_unref(&value_map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a V3 transaction output: Constr 0 [address, plain value, datum option, Maybe script hash].
+ */
+static cardano_error_t
+output_v3(cardano_transaction_output_t* output, cardano_plutus_data_t** out)
+{
+  cardano_address_t*     address = cardano_transaction_output_get_address(output);
+  cardano_value_t*       value   = cardano_transaction_output_get_value(output);
+  cardano_datum_t*       datum   = cardano_transaction_output_get_datum(output);
+  cardano_plutus_list_t* fields  = NULL;
+  cardano_plutus_data_t* addr_pd = NULL;
+  cardano_plutus_data_t* val_pd  = NULL;
+  cardano_plutus_data_t* dat_pd  = NULL;
+  cardano_plutus_data_t* ref_pd  = NULL;
+  cardano_error_t        result  = cardano_plutus_list_new(&fields);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_address(address, &addr_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, addr_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_value(value, &val_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, val_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = output_datum_v2(datum, &dat_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, dat_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = output_script_ref(output, &ref_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, ref_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, out);
+  }
+
+  cardano_address_unref(&address);
+  cardano_value_unref(&value);
+  cardano_datum_unref(&datum);
+  cardano_plutus_data_unref(&addr_pd);
+  cardano_plutus_data_unref(&val_pd);
+  cardano_plutus_data_unref(&dat_pd);
+  cardano_plutus_data_unref(&ref_pd);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a V3 transaction input (out ref) with the unwrapped id: Constr 0 [id, index].
+ */
+static cardano_error_t
+out_ref_v3(cardano_transaction_input_t* input, cardano_plutus_data_t** out)
+{
+  cardano_blake2b_hash_t* id     = cardano_transaction_input_get_id(input);
+  cardano_plutus_list_t*  fields = NULL;
+  cardano_plutus_data_t*  id_pd  = NULL;
+  cardano_plutus_data_t*  idx_pd = NULL;
+  cardano_error_t         result = cardano_plutus_list_new(&fields);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = hash_bytes(id, &id_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, id_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(cardano_transaction_input_get_index(input), &idx_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, idx_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, out);
+  }
+
+  cardano_blake2b_hash_unref(&id);
+  cardano_plutus_data_unref(&id_pd);
+  cardano_plutus_data_unref(&idx_pd);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a single resolved input as the V3 TxInInfo: Constr 0 [out ref, resolved output].
+ */
+static cardano_error_t
+tx_in_info_v3(
+  cardano_transaction_input_t* input,
+  cardano_utxo_list_t*         resolved_inputs,
+  cardano_plutus_data_t**      out)
+{
+  cardano_transaction_output_t* output = resolve_output(resolved_inputs, input);
+
+  if (output == NULL)
+  {
+    return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  cardano_plutus_list_t* fields = NULL;
+  cardano_plutus_data_t* ref_pd = NULL;
+  cardano_plutus_data_t* out_pd = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&fields);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = out_ref_v3(input, &ref_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, ref_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = output_v3(output, &out_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, out_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, out);
+  }
+
+  cardano_transaction_output_unref(&output);
+  cardano_plutus_data_unref(&ref_pd);
+  cardano_plutus_data_unref(&out_pd);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a set of inputs as the V3 list of resolved TxInInfo.
+ */
+static cardano_error_t
+inputs_v3(
+  cardano_transaction_input_set_t* inputs,
+  cardano_utxo_list_t*             resolved_inputs,
+  cardano_plutus_data_t**          out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  const size_t count = (inputs != NULL) ? cardano_transaction_input_set_get_length(inputs) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_transaction_input_t* input = NULL;
+    cardano_plutus_data_t*       pd    = NULL;
+
+    result = cardano_transaction_input_set_get(inputs, i, &input);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = tx_in_info_v3(input, resolved_inputs, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_transaction_input_unref(&input);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the transaction outputs as the V3 list of outputs.
+ */
+static cardano_error_t
+outputs_v3(cardano_transaction_output_list_t* outputs, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  const size_t count = (outputs != NULL) ? cardano_transaction_output_list_get_length(outputs) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_transaction_output_t* output = NULL;
+    cardano_plutus_data_t*        pd     = NULL;
+
+    result = cardano_transaction_output_list_get(outputs, i, &output);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = output_v3(output, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_transaction_output_unref(&output);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the V3 withdrawals as a map keyed by a bare staking credential.
+ *
+ * The V3 \c txInfoWdrl field has type \c Map Credential Lovelace, so the key is
+ * a bare \c Credential (Constr 0 [pubKeyHash] or Constr 1 [scriptHash]); not a
+ * full Address and not the V1/V2 StakingHash wrapper. Entries follow the
+ * ledger's reward-account order: by network, then script credentials before key
+ * credentials.
+ */
+static cardano_error_t
+withdrawals_v3(cardano_withdrawal_map_t* withdrawals, cardano_plutus_data_t** out)
+{
+  sorted_map_t map = { NULL, 0U, 0U };
+
+  cardano_error_t result = put_withdrawals(&map, withdrawals);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&map, out);
+  }
+
+  sorted_map_free(&map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a DRep.
+ *
+ * Key => Constr 0 [Constr 0 [hash]], Script => Constr 0 [Constr 1 [hash]],
+ * Abstain => Constr 1, NoConfidence => Constr 2.
+ */
+static cardano_error_t
+encode_drep(cardano_drep_t* drep, cardano_plutus_data_t** out)
+{
+  cardano_drep_type_t type   = CARDANO_DREP_TYPE_KEY_HASH;
+  cardano_error_t     result = cardano_drep_get_type(drep, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (type)
+  {
+    case CARDANO_DREP_TYPE_KEY_HASH:
+    case CARDANO_DREP_TYPE_SCRIPT_HASH:
+    {
+      cardano_credential_t*  credential = NULL;
+      cardano_plutus_data_t* cred_pd    = NULL;
+
+      result = cardano_drep_get_credential(drep, &credential);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = encode_credential(credential, &cred_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_0, cred_pd, out);
+      }
+
+      cardano_credential_unref(&credential);
+      cardano_plutus_data_unref(&cred_pd);
+
+      break;
+    }
+    case CARDANO_DREP_TYPE_ABSTAIN:
+    {
+      result = empty_constr(CONSTR_1, out);
+      break;
+    }
+    case CARDANO_DREP_TYPE_NO_CONFIDENCE:
+    {
+      result = empty_constr(CONSTR_2, out);
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes the second field of a Conway delegation certificate as a Delegatee.
+ *
+ * Delegatee::Pool(pool) => Constr 0 [pool], Delegatee::DRep(drep) => Constr 1 [drep],
+ * Delegatee::StakeAndVote(pool, drep) => Constr 2 [pool, drep].
+ */
+static cardano_error_t
+delegatee_pool(cardano_blake2b_hash_t* pool, cardano_plutus_data_t** out)
+{
+  cardano_plutus_data_t* pool_pd = NULL;
+  cardano_error_t        result  = hash_bytes(pool, &pool_pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = wrap_constr(CONSTR_0, pool_pd, out);
+  }
+
+  cardano_plutus_data_unref(&pool_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a credential wrapped in the Conway delegation deposit shape Constr alt [...].
+ */
+static cardano_error_t
+constr_two(const uint64_t alternative, cardano_plutus_data_t* first, cardano_plutus_data_t* second, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* fields = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&fields);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, first);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, second);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(alternative, fields, out);
+  }
+
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a 3-field constructor.
+ */
+static cardano_error_t
+constr_three(
+  const uint64_t          alternative,
+  cardano_plutus_data_t*  first,
+  cardano_plutus_data_t*  second,
+  cardano_plutus_data_t*  third,
+  cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* fields = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&fields);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, first);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, second);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, third);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(alternative, fields, out);
+  }
+
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the Conway StakeRegistration / Reg certificate: Constr 0 [credential, deposit].
+ *
+ * The deposit is \c Just for the Conway registration-with-deposit certificate and
+ * \c Nothing for the legacy (no-deposit) registration, matching the ledger's
+ * \c transTxCert TxCertRegStaking translation (post the Conway bootstrap phase).
+ */
+static cardano_error_t
+cert_v3_register(cardano_credential_t* credential, const uint64_t* deposit, cardano_plutus_data_t** out)
+{
+  cardano_plutus_data_t* cred_pd    = NULL;
+  cardano_plutus_data_t* deposit_pd = NULL;
+  cardano_plutus_data_t* maybe      = NULL;
+  cardano_error_t        result     = encode_credential(credential, &cred_pd);
+
+  if ((result == CARDANO_SUCCESS) && (deposit != NULL))
+  {
+    result = cardano_plutus_data_new_integer_from_uint(*deposit, &deposit_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_maybe(deposit_pd, &maybe);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = constr_two(CONSTR_0, cred_pd, maybe, out);
+  }
+
+  cardano_plutus_data_unref(&cred_pd);
+  cardano_plutus_data_unref(&deposit_pd);
+  cardano_plutus_data_unref(&maybe);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the Conway StakeDeregistration / UnReg certificate: Constr 1 [credential, refund].
+ *
+ * The refund is \c Just for the Conway unregistration-with-refund certificate and
+ * \c Nothing for the legacy (no-deposit) deregistration, matching the ledger's
+ * \c transTxCert TxCertUnRegStaking translation (post the Conway bootstrap phase).
+ */
+static cardano_error_t
+cert_v3_unregister(cardano_credential_t* credential, const uint64_t* refund, cardano_plutus_data_t** out)
+{
+  cardano_plutus_data_t* cred_pd   = NULL;
+  cardano_plutus_data_t* refund_pd = NULL;
+  cardano_plutus_data_t* maybe     = NULL;
+  cardano_error_t        result    = encode_credential(credential, &cred_pd);
+
+  if ((result == CARDANO_SUCCESS) && (refund != NULL))
+  {
+    result = cardano_plutus_data_new_integer_from_uint(*refund, &refund_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_maybe(refund_pd, &maybe);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = constr_two(CONSTR_1, cred_pd, maybe, out);
+  }
+
+  cardano_plutus_data_unref(&cred_pd);
+  cardano_plutus_data_unref(&refund_pd);
+  cardano_plutus_data_unref(&maybe);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a Conway delegation certificate: Constr 2 [credential, delegatee].
+ */
+static cardano_error_t
+cert_v3_delegation(cardano_credential_t* credential, cardano_plutus_data_t* delegatee, cardano_plutus_data_t** out)
+{
+  cardano_plutus_data_t* cred_pd = NULL;
+  cardano_error_t        result  = encode_credential(credential, &cred_pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = constr_two(CONSTR_2, cred_pd, delegatee, out);
+  }
+
+  cardano_plutus_data_unref(&cred_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a Conway registration-and-delegation certificate: Constr 3 [credential, delegatee, deposit].
+ */
+static cardano_error_t
+cert_v3_reg_delegation(
+  cardano_credential_t*   credential,
+  cardano_plutus_data_t*  delegatee,
+  const uint64_t          deposit,
+  cardano_plutus_data_t** out)
+{
+  cardano_plutus_data_t* cred_pd    = NULL;
+  cardano_plutus_data_t* deposit_pd = NULL;
+  cardano_error_t        result     = encode_credential(credential, &cred_pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(deposit, &deposit_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = constr_three(CONSTR_3, cred_pd, delegatee, deposit_pd, out);
+  }
+
+  cardano_plutus_data_unref(&cred_pd);
+  cardano_plutus_data_unref(&deposit_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a Conway certificate as a V3 Certificate (never-registration-deposit shape).
+ *
+ * Covers every certificate kind encoded for V3. Stake registration and
+ * deregistration always emit a None deposit (the never-registration-deposit
+ * convention). Returns an error for unsupported (genesis / MIR) kinds.
+ */
+static cardano_error_t
+certificate_v3(cardano_certificate_t* certificate, cardano_plutus_data_t** out)
+{
+  cardano_cert_type_t type   = CARDANO_CERT_TYPE_STAKE_REGISTRATION;
+  cardano_error_t     result = cardano_cert_get_type(certificate, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (type)
+  {
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION:
+    {
+      cardano_stake_registration_cert_t* cert       = NULL;
+      cardano_credential_t*              credential = NULL;
+
+      result = cardano_certificate_to_stake_registration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_stake_registration_cert_get_credential(cert);
+        result     = cert_v3_register(credential, NULL, out);
+      }
+
+      cardano_stake_registration_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_REGISTRATION:
+    {
+      cardano_registration_cert_t* cert       = NULL;
+      cardano_credential_t*        credential = NULL;
+
+      result = cardano_certificate_to_registration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential             = cardano_registration_cert_get_stake_credential(cert);
+        const uint64_t deposit = cardano_registration_cert_get_deposit(cert);
+        result                 = cert_v3_register(credential, &deposit, out);
+      }
+
+      cardano_registration_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DEREGISTRATION:
+    {
+      cardano_stake_deregistration_cert_t* cert       = NULL;
+      cardano_credential_t*                credential = NULL;
+
+      result = cardano_certificate_to_stake_deregistration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_stake_deregistration_cert_get_credential(cert);
+        result     = cert_v3_unregister(credential, NULL, out);
+      }
+
+      cardano_stake_deregistration_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_UNREGISTRATION:
+    {
+      cardano_unregistration_cert_t* cert       = NULL;
+      cardano_credential_t*          credential = NULL;
+
+      result = cardano_certificate_to_unregistration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential            = cardano_unregistration_cert_get_credential(cert);
+        const uint64_t refund = cardano_unregistration_cert_get_deposit(cert);
+        result                = cert_v3_unregister(credential, &refund, out);
+      }
+
+      cardano_unregistration_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_DELEGATION:
+    {
+      cardano_stake_delegation_cert_t* cert       = NULL;
+      cardano_credential_t*            credential = NULL;
+      cardano_blake2b_hash_t*          pool       = NULL;
+      cardano_plutus_data_t*           delegatee  = NULL;
+
+      result = cardano_certificate_to_stake_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_stake_delegation_cert_get_credential(cert);
+        pool       = cardano_stake_delegation_cert_get_pool_key_hash(cert);
+        result     = delegatee_pool(pool, &delegatee);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cert_v3_delegation(credential, delegatee, out);
+      }
+
+      cardano_stake_delegation_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_blake2b_hash_unref(&pool);
+      cardano_plutus_data_unref(&delegatee);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_VOTE_DELEGATION:
+    {
+      cardano_vote_delegation_cert_t* cert       = NULL;
+      cardano_credential_t*           credential = NULL;
+      cardano_drep_t*                 drep       = NULL;
+      cardano_plutus_data_t*          drep_pd    = NULL;
+      cardano_plutus_data_t*          delegatee  = NULL;
+
+      result = cardano_certificate_to_vote_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_vote_delegation_cert_get_credential(cert);
+        drep       = cardano_vote_delegation_cert_get_drep(cert);
+        result     = encode_drep(drep, &drep_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_1, drep_pd, &delegatee);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cert_v3_delegation(credential, delegatee, out);
+      }
+
+      cardano_vote_delegation_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_drep_unref(&drep);
+      cardano_plutus_data_unref(&drep_pd);
+      cardano_plutus_data_unref(&delegatee);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION:
+    {
+      cardano_stake_vote_delegation_cert_t* cert       = NULL;
+      cardano_credential_t*                 credential = NULL;
+      cardano_blake2b_hash_t*               pool       = NULL;
+      cardano_drep_t*                       drep       = NULL;
+      cardano_plutus_data_t*                pool_pd    = NULL;
+      cardano_plutus_data_t*                drep_pd    = NULL;
+      cardano_plutus_data_t*                delegatee  = NULL;
+
+      result = cardano_certificate_to_stake_vote_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_stake_vote_delegation_cert_get_credential(cert);
+        pool       = cardano_stake_vote_delegation_cert_get_pool_key_hash(cert);
+        drep       = cardano_stake_vote_delegation_cert_get_drep(cert);
+        result     = hash_bytes(pool, &pool_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = encode_drep(drep, &drep_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_two(CONSTR_2, pool_pd, drep_pd, &delegatee);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cert_v3_delegation(credential, delegatee, out);
+      }
+
+      cardano_stake_vote_delegation_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_blake2b_hash_unref(&pool);
+      cardano_drep_unref(&drep);
+      cardano_plutus_data_unref(&pool_pd);
+      cardano_plutus_data_unref(&drep_pd);
+      cardano_plutus_data_unref(&delegatee);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION:
+    {
+      cardano_stake_registration_delegation_cert_t* cert       = NULL;
+      cardano_credential_t*                         credential = NULL;
+      cardano_blake2b_hash_t*                       pool       = NULL;
+      cardano_plutus_data_t*                        delegatee  = NULL;
+
+      result = cardano_certificate_to_stake_registration_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_stake_registration_delegation_cert_get_credential(cert);
+        pool       = cardano_stake_registration_delegation_cert_get_pool_key_hash(cert);
+        result     = delegatee_pool(pool, &delegatee);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cert_v3_reg_delegation(credential, delegatee, cardano_stake_registration_delegation_cert_get_deposit(cert), out);
+      }
+
+      cardano_stake_registration_delegation_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_blake2b_hash_unref(&pool);
+      cardano_plutus_data_unref(&delegatee);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION:
+    {
+      cardano_vote_registration_delegation_cert_t* cert       = NULL;
+      cardano_credential_t*                        credential = NULL;
+      cardano_drep_t*                              drep       = NULL;
+      cardano_plutus_data_t*                       drep_pd    = NULL;
+      cardano_plutus_data_t*                       delegatee  = NULL;
+
+      result = cardano_certificate_to_vote_registration_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_vote_registration_delegation_cert_get_credential(cert);
+        drep       = cardano_vote_registration_delegation_cert_get_drep(cert);
+        result     = encode_drep(drep, &drep_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_1, drep_pd, &delegatee);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cert_v3_reg_delegation(credential, delegatee, cardano_vote_registration_delegation_cert_get_deposit(cert), out);
+      }
+
+      cardano_vote_registration_delegation_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_drep_unref(&drep);
+      cardano_plutus_data_unref(&drep_pd);
+      cardano_plutus_data_unref(&delegatee);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION:
+    {
+      cardano_stake_vote_registration_delegation_cert_t* cert       = NULL;
+      cardano_credential_t*                              credential = NULL;
+      cardano_blake2b_hash_t*                            pool       = NULL;
+      cardano_drep_t*                                    drep       = NULL;
+      cardano_plutus_data_t*                             pool_pd    = NULL;
+      cardano_plutus_data_t*                             drep_pd    = NULL;
+      cardano_plutus_data_t*                             delegatee  = NULL;
+
+      result = cardano_certificate_to_stake_vote_registration_delegation(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_stake_vote_registration_delegation_cert_get_credential(cert);
+        pool       = cardano_stake_vote_registration_delegation_cert_get_pool_key_hash(cert);
+        drep       = cardano_stake_vote_registration_delegation_cert_get_drep(cert);
+        result     = hash_bytes(pool, &pool_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = encode_drep(drep, &drep_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_two(CONSTR_2, pool_pd, drep_pd, &delegatee);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cert_v3_reg_delegation(credential, delegatee, cardano_stake_vote_registration_delegation_cert_get_deposit(cert), out);
+      }
+
+      cardano_stake_vote_registration_delegation_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_blake2b_hash_unref(&pool);
+      cardano_drep_unref(&drep);
+      cardano_plutus_data_unref(&pool_pd);
+      cardano_plutus_data_unref(&drep_pd);
+      cardano_plutus_data_unref(&delegatee);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_DREP_REGISTRATION:
+    {
+      cardano_register_drep_cert_t* cert       = NULL;
+      cardano_credential_t*         credential = NULL;
+      cardano_plutus_data_t*        cred_pd    = NULL;
+      cardano_plutus_data_t*        deposit_pd = NULL;
+
+      result = cardano_certificate_to_register_drep(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_register_drep_cert_get_credential(cert);
+        result     = encode_credential(credential, &cred_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_data_new_integer_from_uint(cardano_register_drep_cert_get_deposit(cert), &deposit_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_two(CONSTR_4, cred_pd, deposit_pd, out);
+      }
+
+      cardano_register_drep_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_plutus_data_unref(&cred_pd);
+      cardano_plutus_data_unref(&deposit_pd);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_UPDATE_DREP:
+    {
+      cardano_update_drep_cert_t* cert       = NULL;
+      cardano_credential_t*       credential = NULL;
+      cardano_plutus_data_t*      cred_pd    = NULL;
+
+      result = cardano_certificate_to_update_drep(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_update_drep_cert_get_credential(cert);
+        result     = encode_credential(credential, &cred_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_5, cred_pd, out);
+      }
+
+      cardano_update_drep_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_plutus_data_unref(&cred_pd);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_DREP_UNREGISTRATION:
+    {
+      cardano_unregister_drep_cert_t* cert       = NULL;
+      cardano_credential_t*           credential = NULL;
+      cardano_plutus_data_t*          cred_pd    = NULL;
+      cardano_plutus_data_t*          deposit_pd = NULL;
+
+      result = cardano_certificate_to_unregister_drep(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        credential = cardano_unregister_drep_cert_get_credential(cert);
+        result     = encode_credential(credential, &cred_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_data_new_integer_from_uint(cardano_unregister_drep_cert_get_deposit(cert), &deposit_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_two(CONSTR_6, cred_pd, deposit_pd, out);
+      }
+
+      cardano_unregister_drep_cert_unref(&cert);
+      cardano_credential_unref(&credential);
+      cardano_plutus_data_unref(&cred_pd);
+      cardano_plutus_data_unref(&deposit_pd);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_POOL_REGISTRATION:
+    {
+      cardano_pool_registration_cert_t* cert          = NULL;
+      cardano_pool_params_t*            params        = NULL;
+      cardano_blake2b_hash_t*           operator_hash = NULL;
+      cardano_blake2b_hash_t*           vrf           = NULL;
+      cardano_plutus_data_t*            op_pd         = NULL;
+      cardano_plutus_data_t*            vrf_pd        = NULL;
+
+      result = cardano_certificate_to_pool_registration(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_pool_registration_cert_get_params(cert, &params);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_pool_params_get_operator_key_hash(params, &operator_hash);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_pool_params_get_vrf_vk_hash(params, &vrf);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = hash_bytes(operator_hash, &op_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = hash_bytes(vrf, &vrf_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_two(7U, op_pd, vrf_pd, out);
+      }
+
+      cardano_pool_registration_cert_unref(&cert);
+      cardano_pool_params_unref(&params);
+      cardano_blake2b_hash_unref(&operator_hash);
+      cardano_blake2b_hash_unref(&vrf);
+      cardano_plutus_data_unref(&op_pd);
+      cardano_plutus_data_unref(&vrf_pd);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_POOL_RETIREMENT:
+    {
+      cardano_pool_retirement_cert_t* cert     = NULL;
+      cardano_blake2b_hash_t*         pool     = NULL;
+      cardano_plutus_data_t*          pool_pd  = NULL;
+      cardano_plutus_data_t*          epoch_pd = NULL;
+
+      result = cardano_certificate_to_pool_retirement(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        pool   = cardano_pool_retirement_cert_get_pool_key_hash(cert);
+        result = hash_bytes(pool, &pool_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_data_new_integer_from_uint(cardano_pool_retirement_cert_get_epoch(cert), &epoch_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_two(8U, pool_pd, epoch_pd, out);
+      }
+
+      cardano_pool_retirement_cert_unref(&cert);
+      cardano_blake2b_hash_unref(&pool);
+      cardano_plutus_data_unref(&pool_pd);
+      cardano_plutus_data_unref(&epoch_pd);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT:
+    {
+      cardano_auth_committee_hot_cert_t* cert    = NULL;
+      cardano_credential_t*              cold    = NULL;
+      cardano_credential_t*              hot     = NULL;
+      cardano_plutus_data_t*             cold_pd = NULL;
+      cardano_plutus_data_t*             hot_pd  = NULL;
+
+      result = cardano_certificate_to_auth_committee_hot(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_auth_committee_hot_cert_get_cold_cred(cert, &cold);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_auth_committee_hot_cert_get_hot_cred(cert, &hot);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = encode_credential(cold, &cold_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = encode_credential(hot, &hot_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_two(9U, cold_pd, hot_pd, out);
+      }
+
+      cardano_auth_committee_hot_cert_unref(&cert);
+      cardano_credential_unref(&cold);
+      cardano_credential_unref(&hot);
+      cardano_plutus_data_unref(&cold_pd);
+      cardano_plutus_data_unref(&hot_pd);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD:
+    {
+      cardano_resign_committee_cold_cert_t* cert    = NULL;
+      cardano_credential_t*                 cold    = NULL;
+      cardano_plutus_data_t*                cold_pd = NULL;
+
+      result = cardano_certificate_to_resign_committee_cold(certificate, &cert);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cold   = cardano_resign_committee_cold_cert_get_credential(cert);
+        result = encode_credential(cold, &cold_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(10U, cold_pd, out);
+      }
+
+      cardano_resign_committee_cold_cert_unref(&cert);
+      cardano_credential_unref(&cold);
+      cardano_plutus_data_unref(&cold_pd);
+
+      break;
+    }
+    case CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION:
+    case CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS:
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes the certificates as the V3 list of Conway certificates.
+ */
+static cardano_error_t
+certificates_v3(cardano_certificate_set_t* certificates, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  const size_t count = (certificates != NULL) ? cardano_certificate_set_get_length(certificates) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_certificate_t* certificate = NULL;
+    cardano_plutus_data_t* pd          = NULL;
+
+    result = cardano_certificate_set_get(certificates, i, &certificate);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = certificate_v3(certificate, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_certificate_unref(&certificate);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a voter.
+ *
+ * Committee key/script => Constr 0 [stake credential], DRep key/script =>
+ * Constr 1 [stake credential], stake pool => Constr 2 [hash].
+ */
+static cardano_error_t
+encode_voter(cardano_voter_t* voter, cardano_plutus_data_t** out)
+{
+  cardano_voter_type_t type   = CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_KEY_HASH;
+  cardano_error_t      result = cardano_voter_get_type(voter, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_credential_t* credential = cardano_voter_get_credential(voter);
+
+  switch (type)
+  {
+    case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_KEY_HASH:
+    case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_SCRIPT_HASH:
+    {
+      cardano_plutus_data_t* cred_pd = NULL;
+
+      result = encode_credential(credential, &cred_pd);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_0, cred_pd, out);
+      }
+
+      cardano_plutus_data_unref(&cred_pd);
+
+      break;
+    }
+    case CARDANO_VOTER_TYPE_DREP_KEY_HASH:
+    case CARDANO_VOTER_TYPE_DREP_SCRIPT_HASH:
+    {
+      cardano_plutus_data_t* cred_pd = NULL;
+
+      result = encode_credential(credential, &cred_pd);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_1, cred_pd, out);
+      }
+
+      cardano_plutus_data_unref(&cred_pd);
+
+      break;
+    }
+    case CARDANO_VOTER_TYPE_STAKE_POOL_KEY_HASH:
+    {
+      cardano_plutus_data_t* hash_pd = NULL;
+
+      result = encode_bytes(cardano_credential_get_hash_bytes(credential), cardano_credential_get_hash_bytes_size(credential), &hash_pd);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_2, hash_pd, out);
+      }
+
+      cardano_plutus_data_unref(&hash_pd);
+
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  cardano_credential_unref(&credential);
+
+  return result;
+}
+
+/**
+ * \brief Builds the sort key and the encoding of a voter.
+ */
+static cardano_error_t
+voter_entry(cardano_voter_t* voter, sort_key_t* key, cardano_plutus_data_t** voter_data)
+{
+  cardano_error_t result = sort_key_append_voter(key, voter);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_voter(voter, voter_data);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes a governance action id: Constr 0 [transaction id, action index].
+ */
+static cardano_error_t
+gov_action_id(cardano_governance_action_id_t* id, cardano_plutus_data_t** out)
+{
+  uint64_t               index  = 0U;
+  cardano_plutus_data_t* id_pd  = NULL;
+  cardano_plutus_data_t* idx_pd = NULL;
+  cardano_error_t        result = encode_bytes(cardano_governance_action_id_get_hash_bytes(id), cardano_governance_action_id_get_hash_bytes_size(id), &id_pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_governance_action_id_get_index(id, &index);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(index, &idx_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = constr_two(CONSTR_0, id_pd, idx_pd, out);
+  }
+
+  cardano_plutus_data_unref(&id_pd);
+  cardano_plutus_data_unref(&idx_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes an optional governance action id: Some => Constr 0 [id], None => Constr 1.
+ */
+static cardano_error_t
+maybe_gov_action_id(cardano_governance_action_id_t* id, cardano_plutus_data_t** out)
+{
+  if (id == NULL)
+  {
+    return empty_constr(CONSTR_1, out);
+  }
+
+  cardano_plutus_data_t* id_pd  = NULL;
+  cardano_error_t        result = gov_action_id(id, &id_pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = wrap_constr(CONSTR_0, id_pd, out);
+  }
+
+  cardano_plutus_data_unref(&id_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a vote: No => Constr 0, Yes => Constr 1, Abstain => Constr 2.
+ */
+static cardano_error_t
+encode_vote(const cardano_vote_t vote, cardano_plutus_data_t** out)
+{
+  switch (vote)
+  {
+    case CARDANO_VOTE_NO:
+    {
+      return empty_constr(CONSTR_0, out);
+    }
+    case CARDANO_VOTE_YES:
+    {
+      return empty_constr(CONSTR_1, out);
+    }
+    case CARDANO_VOTE_ABSTAIN:
+    {
+      return empty_constr(CONSTR_2, out);
+    }
+    default:
+    {
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+  }
+}
+
+/**
+ * \brief Encodes the votes as a map of Voter -> map of GovActionId -> Vote.
+ *
+ * Voters follow the ledger's voter order, committee members first, then DReps,
+ * then stake pools, each with script credentials before key credentials.
+ */
+static cardano_error_t
+encode_votes(cardano_voting_procedures_t* procedures, cardano_plutus_data_t** out)
+{
+  sorted_map_t          outer  = { NULL, 0U, 0U };
+  cardano_error_t       result = CARDANO_SUCCESS;
+  cardano_voter_list_t* voters = NULL;
+
+  if (procedures != NULL)
+  {
+    result = cardano_voting_procedures_get_voters(procedures, &voters);
+  }
+
+  const size_t voter_count = (voters != NULL) ? cardano_voter_list_get_length(voters) : 0U;
+
+  for (size_t i = 0U; (i < voter_count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_voter_t*                     voter    = NULL;
+    cardano_governance_action_id_list_t* ids      = NULL;
+    cardano_plutus_data_t*               voter_pd = NULL;
+    cardano_plutus_map_t*                inner    = NULL;
+    cardano_plutus_data_t*               inner_pd = NULL;
+    sort_key_t                           key;
+
+    key.size = 0U;
+    result   = cardano_voter_list_get(voters, i, &voter);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = voter_entry(voter, &key, &voter_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_voting_procedures_get_governance_ids_by_voter(procedures, voter, &ids);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_map_new(&inner);
+    }
+
+    const size_t id_count = (ids != NULL) ? cardano_governance_action_id_list_get_length(ids) : 0U;
+
+    for (size_t j = 0U; (j < id_count) && (result == CARDANO_SUCCESS); ++j)
+    {
+      cardano_governance_action_id_t* id        = NULL;
+      cardano_voting_procedure_t*     procedure = NULL;
+      cardano_plutus_data_t*          id_pd     = NULL;
+      cardano_plutus_data_t*          vote_pd   = NULL;
+
+      result = cardano_governance_action_id_list_get(ids, j, &id);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = gov_action_id(id, &id_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        procedure = cardano_voting_procedures_get(procedures, voter, id);
+        result    = (procedure != NULL) ? encode_vote(cardano_voting_procedure_get_vote(procedure), &vote_pd) : CARDANO_ERROR_ELEMENT_NOT_FOUND;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_map_insert(inner, id_pd, vote_pd);
+      }
+
+      cardano_governance_action_id_unref(&id);
+      cardano_voting_procedure_unref(&procedure);
+      cardano_plutus_data_unref(&id_pd);
+      cardano_plutus_data_unref(&vote_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_data_new_map(inner, &inner_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = sorted_map_put(&outer, &key, voter_pd, NULL, inner_pd, NULL, MERGE_KEEP_FIRST);
+    }
+
+    cardano_voter_unref(&voter);
+    cardano_governance_action_id_list_unref(&ids);
+    cardano_plutus_data_unref(&voter_pd);
+    cardano_plutus_map_unref(&inner);
+    cardano_plutus_data_unref(&inner_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&outer, out);
+  }
+
+  cardano_voter_list_unref(&voters);
+  sorted_map_free(&outer);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a unit interval as a RationalNumber: Constr 0 [numerator, denominator] in lowest terms.
+ *
+ * The ledger translates the interval through a Haskell \c Rational, which is
+ * always reduced.
+ */
+static cardano_error_t
+encode_rational(cardano_unit_interval_t* interval, cardano_plutus_data_t** out)
+{
+  const uint64_t numerator   = cardano_unit_interval_get_numerator(interval);
+  const uint64_t denominator = cardano_unit_interval_get_denominator(interval);
+  const uint64_t divisor     = gcd_u64(numerator, denominator);
+  const uint64_t scale       = (divisor == 0U) ? 1U : divisor;
+
+  cardano_plutus_data_t* num_pd = NULL;
+  cardano_plutus_data_t* den_pd = NULL;
+  cardano_error_t        result = cardano_plutus_data_new_integer_from_uint(numerator / scale, &num_pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(denominator / scale, &den_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = constr_two(CONSTR_0, num_pd, den_pd, out);
+  }
+
+  cardano_plutus_data_unref(&num_pd);
+  cardano_plutus_data_unref(&den_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a treasury-withdrawals map (reward address -> coin).
+ */
+static cardano_error_t
+treasury_withdrawals(cardano_withdrawal_map_t* withdrawals, cardano_plutus_data_t** out)
+{
+  return withdrawals_v3(withdrawals, out);
+}
+
+/**
+ * \brief Encodes the members an UpdateCommittee action removes and adds, in ledger credential order.
+ *
+ * The removed members are a list and the added members a map of credential to
+ * expiration epoch, both with script credentials before key credentials.
+ */
+static cardano_error_t
+committee_changes(cardano_update_committee_action_t* action, cardano_plutus_data_t** removed_out, cardano_plutus_data_t** added_out)
+{
+  cardano_credential_set_t*        removed     = cardano_update_committee_action_get_members_to_be_removed(action);
+  cardano_committee_members_map_t* added       = cardano_update_committee_action_get_members_to_be_added(action);
+  sorted_map_t                     removed_map = { NULL, 0U, 0U };
+  sorted_map_t                     added_map   = { NULL, 0U, 0U };
+  const size_t                     removed_n   = (removed != NULL) ? cardano_credential_set_get_length(removed) : 0U;
+  const size_t                     added_n     = (added != NULL) ? cardano_committee_members_map_get_length(added) : 0U;
+  cardano_error_t                  result      = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < removed_n) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_credential_t* credential = NULL;
+
+    result = cardano_credential_set_get(removed, i, &credential);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = put_credential(&removed_map, credential, NULL);
+    }
+
+    cardano_credential_unref(&credential);
+  }
+
+  for (size_t i = 0U; (i < added_n) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_credential_t*  credential = NULL;
+    uint64_t               epoch      = 0U;
+    cardano_plutus_data_t* epoch_pd   = NULL;
+
+    result = cardano_committee_members_map_get_key_value_at(added, i, &credential, &epoch);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_data_new_integer_from_uint(epoch, &epoch_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = put_credential(&added_map, credential, epoch_pd);
+    }
+
+    cardano_credential_unref(&credential);
+    cardano_plutus_data_unref(&epoch_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode_keys(&removed_map, removed_out);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&added_map, added_out);
+  }
+
+  sorted_map_free(&removed_map);
+  sorted_map_free(&added_map);
+  cardano_credential_set_unref(&removed);
+  cardano_committee_members_map_unref(&added);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the governance action of a proposal procedure.
+ *
+ * The ParameterChange protocol-parameter update is encoded as its changed-parameters
+ * map via \ref cardano_protocol_param_update_to_plutus_data. All governance actions
+ * are encoded fully.
+ */
+static cardano_error_t
+gov_action(cardano_proposal_procedure_t* proposal, cardano_plutus_data_t** out)
+{
+  cardano_governance_action_type_t type   = CARDANO_GOVERNANCE_ACTION_TYPE_INFO;
+  cardano_error_t                  result = cardano_proposal_procedure_get_action_type(proposal, &type);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (type)
+  {
+    case CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE:
+    {
+      cardano_parameter_change_action_t* action     = NULL;
+      cardano_governance_action_id_t*    prev       = NULL;
+      cardano_protocol_param_update_t*   update     = NULL;
+      cardano_blake2b_hash_t*            guardrail  = NULL;
+      cardano_plutus_data_t*             prev_pd    = NULL;
+      cardano_plutus_data_t*             params_pd  = NULL;
+      cardano_plutus_data_t*             guard_pd   = NULL;
+      cardano_plutus_data_t*             guard_hash = NULL;
+
+      result = cardano_proposal_procedure_to_parameter_change_action(proposal, &action);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        prev   = cardano_parameter_change_action_get_governance_action_id(action);
+        result = maybe_gov_action_id(prev, &prev_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        update = cardano_parameter_change_action_get_protocol_param_update(action);
+        result = cardano_protocol_param_update_to_plutus_data(update, &params_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        guardrail = cardano_parameter_change_action_get_policy_hash(action);
+
+        if (guardrail != NULL)
+        {
+          result = hash_bytes(guardrail, &guard_hash);
+        }
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = encode_maybe(guard_hash, &guard_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_three(CONSTR_0, prev_pd, params_pd, guard_pd, out);
+      }
+
+      cardano_parameter_change_action_unref(&action);
+      cardano_governance_action_id_unref(&prev);
+      cardano_protocol_param_update_unref(&update);
+      cardano_blake2b_hash_unref(&guardrail);
+      cardano_plutus_data_unref(&prev_pd);
+      cardano_plutus_data_unref(&params_pd);
+      cardano_plutus_data_unref(&guard_pd);
+      cardano_plutus_data_unref(&guard_hash);
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION:
+    {
+      cardano_hard_fork_initiation_action_t* action  = NULL;
+      cardano_governance_action_id_t*        prev    = NULL;
+      cardano_protocol_version_t*            version = NULL;
+      cardano_plutus_data_t*                 prev_pd = NULL;
+      cardano_plutus_data_t*                 major   = NULL;
+      cardano_plutus_data_t*                 minor   = NULL;
+      cardano_plutus_data_t*                 ver_pd  = NULL;
+
+      result = cardano_proposal_procedure_to_hard_fork_initiation_action(proposal, &action);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        prev   = cardano_hard_fork_initiation_action_get_governance_action_id(action);
+        result = maybe_gov_action_id(prev, &prev_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        version = cardano_hard_fork_initiation_action_get_protocol_version(action);
+        result  = cardano_plutus_data_new_integer_from_uint(cardano_protocol_version_get_major(version), &major);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = cardano_plutus_data_new_integer_from_uint(cardano_protocol_version_get_minor(version), &minor);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_two(CONSTR_0, major, minor, &ver_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_two(CONSTR_1, prev_pd, ver_pd, out);
+      }
+
+      cardano_hard_fork_initiation_action_unref(&action);
+      cardano_governance_action_id_unref(&prev);
+      cardano_protocol_version_unref(&version);
+      cardano_plutus_data_unref(&prev_pd);
+      cardano_plutus_data_unref(&major);
+      cardano_plutus_data_unref(&minor);
+      cardano_plutus_data_unref(&ver_pd);
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS:
+    {
+      cardano_treasury_withdrawals_action_t* action      = NULL;
+      cardano_withdrawal_map_t*              withdrawals = NULL;
+      cardano_blake2b_hash_t*                guardrail   = NULL;
+      cardano_plutus_data_t*                 with_pd     = NULL;
+      cardano_plutus_data_t*                 guard_pd    = NULL;
+      cardano_plutus_data_t*                 guard_hash  = NULL;
+
+      result = cardano_proposal_procedure_to_treasury_withdrawals_action(proposal, &action);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        withdrawals = cardano_treasury_withdrawals_action_get_withdrawals(action);
+        result      = treasury_withdrawals(withdrawals, &with_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        guardrail = cardano_treasury_withdrawals_action_get_policy_hash(action);
+
+        if (guardrail != NULL)
+        {
+          result = hash_bytes(guardrail, &guard_hash);
+        }
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = encode_maybe(guard_hash, &guard_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_two(CONSTR_2, with_pd, guard_pd, out);
+      }
+
+      cardano_treasury_withdrawals_action_unref(&action);
+      cardano_withdrawal_map_unref(&withdrawals);
+      cardano_blake2b_hash_unref(&guardrail);
+      cardano_plutus_data_unref(&with_pd);
+      cardano_plutus_data_unref(&guard_pd);
+      cardano_plutus_data_unref(&guard_hash);
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE:
+    {
+      cardano_no_confidence_action_t* action  = NULL;
+      cardano_governance_action_id_t* prev    = NULL;
+      cardano_plutus_data_t*          prev_pd = NULL;
+
+      result = cardano_proposal_procedure_to_no_confidence_action(proposal, &action);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        prev   = cardano_no_confidence_action_get_governance_action_id(action);
+        result = maybe_gov_action_id(prev, &prev_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_3, prev_pd, out);
+      }
+
+      cardano_no_confidence_action_unref(&action);
+      cardano_governance_action_id_unref(&prev);
+      cardano_plutus_data_unref(&prev_pd);
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE:
+    {
+      cardano_update_committee_action_t* action     = NULL;
+      cardano_governance_action_id_t*    prev       = NULL;
+      cardano_unit_interval_t*           quorum     = NULL;
+      cardano_plutus_data_t*             prev_pd    = NULL;
+      cardano_plutus_data_t*             removed_pd = NULL;
+      cardano_plutus_data_t*             added_pd   = NULL;
+      cardano_plutus_data_t*             quorum_pd  = NULL;
+
+      result = cardano_proposal_procedure_to_update_committee_action(proposal, &action);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        prev   = cardano_update_committee_action_get_governance_action_id(action);
+        result = maybe_gov_action_id(prev, &prev_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = committee_changes(action, &removed_pd, &added_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        quorum = cardano_update_committee_action_get_quorum(action);
+        result = encode_rational(quorum, &quorum_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_plutus_list_t* fields = NULL;
+
+        result = cardano_plutus_list_new(&fields);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_list_add(fields, prev_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_list_add(fields, removed_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_list_add(fields, added_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_list_add(fields, quorum_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_constr(CONSTR_4, fields, out);
+        }
+
+        cardano_plutus_list_unref(&fields);
+      }
+
+      cardano_update_committee_action_unref(&action);
+      cardano_governance_action_id_unref(&prev);
+      cardano_unit_interval_unref(&quorum);
+      cardano_plutus_data_unref(&prev_pd);
+      cardano_plutus_data_unref(&removed_pd);
+      cardano_plutus_data_unref(&added_pd);
+      cardano_plutus_data_unref(&quorum_pd);
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION:
+    {
+      cardano_new_constitution_action_t* action       = NULL;
+      cardano_governance_action_id_t*    prev         = NULL;
+      cardano_constitution_t*            constitution = NULL;
+      cardano_blake2b_hash_t*            script_hash  = NULL;
+      cardano_plutus_data_t*             prev_pd      = NULL;
+      cardano_plutus_data_t*             guard_pd     = NULL;
+      cardano_plutus_data_t*             guard_hash   = NULL;
+      cardano_plutus_data_t*             constr_pd    = NULL;
+
+      result = cardano_proposal_procedure_to_constitution_action(proposal, &action);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        prev   = cardano_new_constitution_action_get_governance_action_id(action);
+        result = maybe_gov_action_id(prev, &prev_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        constitution = cardano_new_constitution_action_get_constitution(action);
+        script_hash  = cardano_constitution_get_script_hash(constitution);
+
+        if (script_hash != NULL)
+        {
+          result = hash_bytes(script_hash, &guard_hash);
+        }
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = encode_maybe(guard_hash, &guard_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_0, guard_pd, &constr_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = constr_two(CONSTR_5, prev_pd, constr_pd, out);
+      }
+
+      cardano_new_constitution_action_unref(&action);
+      cardano_governance_action_id_unref(&prev);
+      cardano_constitution_unref(&constitution);
+      cardano_blake2b_hash_unref(&script_hash);
+      cardano_plutus_data_unref(&prev_pd);
+      cardano_plutus_data_unref(&guard_pd);
+      cardano_plutus_data_unref(&guard_hash);
+      cardano_plutus_data_unref(&constr_pd);
+
+      break;
+    }
+    case CARDANO_GOVERNANCE_ACTION_TYPE_INFO:
+    {
+      result = empty_constr(CONSTR_6, out);
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes a proposal procedure: Constr 0 [deposit, return credential, gov action].
+ *
+ * The V3 \c ppReturnAddr field has type \c Credential, so the return address is
+ * encoded as a bare Credential, not as a full Address.
+ */
+static cardano_error_t
+encode_proposal_procedure(cardano_proposal_procedure_t* proposal, cardano_plutus_data_t** out)
+{
+  cardano_reward_address_t* reward     = cardano_proposal_procedure_get_reward_address(proposal);
+  cardano_credential_t*     credential = NULL;
+  cardano_plutus_data_t*    deposit_pd = NULL;
+  cardano_plutus_data_t*    addr_pd    = NULL;
+  cardano_plutus_data_t*    action_pd  = NULL;
+  cardano_error_t           result     = cardano_plutus_data_new_integer_from_uint(cardano_proposal_procedure_get_deposit(proposal), &deposit_pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    credential = cardano_reward_address_get_credential(reward);
+    result     = (credential != NULL) ? encode_credential(credential, &addr_pd) : CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = gov_action(proposal, &action_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = constr_three(CONSTR_0, deposit_pd, addr_pd, action_pd, out);
+  }
+
+  cardano_reward_address_unref(&reward);
+  cardano_credential_unref(&credential);
+  cardano_plutus_data_unref(&deposit_pd);
+  cardano_plutus_data_unref(&addr_pd);
+  cardano_plutus_data_unref(&action_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the proposal procedures as the list of proposal procedures.
+ */
+static cardano_error_t
+encode_proposal_procedures(cardano_proposal_procedure_set_t* proposals, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  const size_t count = (proposals != NULL) ? cardano_proposal_procedure_set_get_length(proposals) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_proposal_procedure_t* proposal = NULL;
+    cardano_plutus_data_t*        pd       = NULL;
+
+    result = cardano_proposal_procedure_set_get(proposals, i, &proposal);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_proposal_procedure(proposal, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_proposal_procedure_unref(&proposal);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes an optional lovelace amount as a Maybe Coin.
+ */
+static cardano_error_t
+maybe_coin(const uint64_t* coin, cardano_plutus_data_t** out)
+{
+  if (coin == NULL)
+  {
+    return empty_constr(CONSTR_1, out);
+  }
+
+  cardano_plutus_data_t* coin_pd = NULL;
+  cardano_error_t        result  = cardano_plutus_data_new_integer_from_uint(*coin, &coin_pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = wrap_constr(CONSTR_0, coin_pd, out);
+  }
+
+  cardano_plutus_data_unref(&coin_pd);
+
+  return result;
+}
+
+/**
+ * \brief Builds the V3 ScriptInfo or ScriptPurpose of a redeemer.
+ *
+ * When \p with_datum is true the Spending variant carries the optional datum
+ * (the ScriptInfo shape used by the ScriptContext); when false the Spending
+ * variant is the bare out ref (the ScriptPurpose shape used as a redeemer-map
+ * key). All other variants are identical between the two shapes.
+ */
+static cardano_error_t
+script_info_v3(
+  cardano_transaction_t*     tx,
+  const cardano_utxo_list_t* resolved_inputs,
+  cardano_redeemer_t*        redeemer,
+  cardano_plutus_data_t*     datum,
+  bool                       with_datum,
+  cardano_plutus_data_t**    script_info);
+
+/**
+ * \brief Encodes the redeemers of a V3 transaction as a map of ScriptPurpose -> redeemer data.
+ *
+ * The purpose key uses the Conway WithNeverRegistrationDeposit ScriptPurpose
+ * shape, where the Spending variant is the bare out ref without a datum.
+ */
+static cardano_error_t
+redeemers_map_v3(
+  cardano_transaction_t*   tx,
+  cardano_utxo_list_t*     resolved_inputs,
+  cardano_redeemer_list_t* redeemers,
+  cardano_plutus_data_t**  out)
+{
+  cardano_plutus_map_t* map    = NULL;
+  cardano_error_t       result = cardano_plutus_map_new(&map);
+
+  const size_t count = (redeemers != NULL) ? cardano_redeemer_list_get_length(redeemers) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_redeemer_t*    redeemer   = NULL;
+    cardano_plutus_data_t* purpose_pd = NULL;
+    cardano_plutus_data_t* data       = NULL;
+
+    result = cardano_redeemer_list_get(redeemers, i, &redeemer);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = script_info_v3(tx, resolved_inputs, redeemer, NULL, false, &purpose_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      data   = cardano_redeemer_get_data(redeemer);
+      result = (data != NULL) ? cardano_plutus_map_insert(map, purpose_pd, data) : CARDANO_ERROR_POINTER_IS_NULL;
+    }
+
+    cardano_redeemer_unref(&redeemer);
+    cardano_plutus_data_unref(&purpose_pd);
+    cardano_plutus_data_unref(&data);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_map(map, out);
+  }
+
+  cardano_plutus_map_unref(&map);
+
+  return result;
+}
+
+/* V4 STATIC FUNCTIONS *******************************************************/
+
+/**
+ * \brief Releases every plutus-data value of an array.
+ */
+static void
+unref_all(cardano_plutus_data_t** items, const size_t count)
+{
+  for (size_t i = 0U; i < count; ++i)
+  {
+    cardano_plutus_data_unref(&items[i]);
+  }
+}
+
+/**
+ * \brief Builds a plutus-data list from an array of values, in order.
+ */
+static cardano_error_t
+encode_list(cardano_plutus_data_t** items, const size_t count, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    result = cardano_plutus_list_add(list, items[i]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Builds a constructor of the given alternative from an array of fields.
+ */
+static cardano_error_t
+encode_variant(const uint64_t alternative, cardano_plutus_data_t** fields, const size_t count, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    result = cardano_plutus_list_add(list, fields[i]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(alternative, list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Reads the alternative and one field of a constructor plutus-data value.
+ */
+static cardano_error_t
+constr_field_at(cardano_plutus_data_t* data, const size_t index, uint64_t* alternative, cardano_plutus_data_t** field)
+{
+  cardano_constr_plutus_data_t* constr = NULL;
+  cardano_plutus_list_t*        fields = NULL;
+  cardano_error_t               result = cardano_plutus_data_to_constr(data, &constr);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_constr_plutus_data_get_alternative(constr, alternative);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_constr_plutus_data_get_data(constr, &fields);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_get(fields, index, field);
+  }
+
+  cardano_plutus_list_unref(&fields);
+  cardano_constr_plutus_data_unref(&constr);
+
+  return result;
+}
+
+/**
+ * \brief Extracts the script hash of an encoded credential.
+ *
+ * A script credential is Constr 1 [script hash]; a key credential has no script
+ * hash and yields \ref CARDANO_ERROR_ELEMENT_NOT_FOUND.
+ */
+static cardano_error_t
+credential_script_hash(cardano_plutus_data_t* credential, cardano_plutus_data_t** script_hash)
+{
+  uint64_t               alternative = CONSTR_0;
+  cardano_plutus_data_t* hash        = NULL;
+  cardano_error_t        result      = constr_field_at(credential, 0U, &alternative, &hash);
+
+  if ((result == CARDANO_SUCCESS) && (alternative != CONSTR_1))
+  {
+    result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_ref(hash);
+    *script_hash = hash;
+  }
+
+  cardano_plutus_data_unref(&hash);
+
+  return result;
+}
+
+/**
+ * \brief Adds the direct deposits of a transaction to a sorted map of account amounts.
+ */
+static cardano_error_t
+put_direct_deposits(sorted_map_t* map, cardano_direct_deposit_map_t* deposits)
+{
+  const size_t    count  = (deposits != NULL) ? cardano_direct_deposit_map_get_length(deposits) : 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_reward_address_t* address = NULL;
+    uint64_t                  amount  = 0U;
+
+    result = cardano_direct_deposit_map_get_key_value_at(deposits, i, &address, &amount);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = put_account_amount(map, address, amount);
+    }
+
+    cardano_reward_address_unref(&address);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes the direct deposits of a transaction as the V4 map of credential to lovelace.
+ */
+static cardano_error_t
+direct_deposits_v4(cardano_direct_deposit_map_t* deposits, cardano_plutus_data_t** out)
+{
+  sorted_map_t map = { NULL, 0U, 0U };
+
+  cardano_error_t result = put_direct_deposits(&map, deposits);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&map, out);
+  }
+
+  sorted_map_free(&map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes an account balance interval.
+ *
+ * Lower bound => Constr 0 [lower], upper bound => Constr 1 [upper], both bounds
+ * => Constr 2 [lower, upper], exact balance => Constr 3 [balance].
+ */
+static cardano_error_t
+balance_interval_v4(const cardano_account_balance_interval_t* interval, cardano_plutus_data_t** out)
+{
+  const uint64_t* exact  = cardano_account_balance_interval_get_exact_balance(interval);
+  const uint64_t* lower  = cardano_account_balance_interval_get_inclusive_lower_bound(interval);
+  const uint64_t* upper  = cardano_account_balance_interval_get_exclusive_upper_bound(interval);
+  uint64_t        bounds = 0U;
+
+  cardano_plutus_data_t* fields[2] = { NULL, NULL };
+  cardano_error_t        result    = CARDANO_SUCCESS;
+  uint64_t               variant   = CONSTR_3;
+
+  if (exact != NULL)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(*exact, &fields[0]);
+    bounds = 1U;
+  }
+  else if ((lower != NULL) && (upper != NULL))
+  {
+    variant = CONSTR_2;
+    result  = cardano_plutus_data_new_integer_from_uint(*lower, &fields[0]);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_data_new_integer_from_uint(*upper, &fields[1]);
+    }
+
+    bounds = 2U;
+  }
+  else if (lower != NULL)
+  {
+    variant = CONSTR_0;
+    result  = cardano_plutus_data_new_integer_from_uint(*lower, &fields[0]);
+    bounds  = 1U;
+  }
+  else
+  {
+    variant = CONSTR_1;
+    result  = (upper != NULL) ? cardano_plutus_data_new_integer_from_uint(*upper, &fields[0]) : CARDANO_ERROR_INVALID_ARGUMENT;
+    bounds  = 1U;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_variant(variant, fields, (size_t)bounds, out);
+  }
+
+  unref_all(fields, 2U);
+
+  return result;
+}
+
+/**
+ * \brief Encodes account balance intervals as the V4 map of account to interval, in ledger account order.
+ */
+static cardano_error_t
+balance_intervals_v4(cardano_account_balance_intervals_map_t* intervals, cardano_plutus_data_t** out)
+{
+  sorted_map_t    map    = { NULL, 0U, 0U };
+  const size_t    count  = (intervals != NULL) ? cardano_account_balance_intervals_map_get_length(intervals) : 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_reward_address_t*           address     = NULL;
+    cardano_account_balance_interval_t* interval    = NULL;
+    cardano_plutus_data_t*              credential  = NULL;
+    cardano_plutus_data_t*              interval_pd = NULL;
+    sort_key_t                          key;
+
+    key.size = 0U;
+    result   = cardano_account_balance_intervals_map_get_key_value_at(intervals, i, &address, &interval);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = account_entry(address, &key, &credential);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = balance_interval_v4(interval, &interval_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = sorted_map_put(&map, &key, credential, NULL, interval_pd, NULL, MERGE_KEEP_FIRST);
+    }
+
+    cardano_reward_address_unref(&address);
+    cardano_account_balance_interval_unref(&interval);
+    cardano_plutus_data_unref(&credential);
+    cardano_plutus_data_unref(&interval_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&map, out);
+  }
+
+  sorted_map_free(&map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a multi-asset as a MintValue map: policies and assets in ledger order, without an ada entry.
+ */
+static cardano_error_t
+mint_v4(cardano_multi_asset_t* multi_asset, const asset_filter_t filter, cardano_plutus_data_t** out)
+{
+  sorted_map_t map = { NULL, 0U, 0U };
+
+  cardano_error_t result = put_assets(&map, multi_asset, filter);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode_nested(&map, out);
+  }
+
+  sorted_map_free(&map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the staking part of a V4 address as a Maybe AccountId.
+ *
+ * A base address is staked to the account of its stake credential, an
+ * enterprise address to none. Pointer, Byron and reward addresses cannot appear
+ * in a V4 context and are rejected, as the ledger rejects them.
+ */
+static cardano_error_t
+address_account_v4(const cardano_address_t* address, cardano_plutus_data_t** out)
+{
+  cardano_address_type_t type   = CARDANO_ADDRESS_TYPE_BYRON;
+  cardano_error_t        result = cardano_address_get_type(address, &type);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    switch (type)
+    {
+      case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_KEY:
+      case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_KEY:
+      case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_KEY_STAKE_SCRIPT:
+      case CARDANO_ADDRESS_TYPE_BASE_PAYMENT_SCRIPT_STAKE_SCRIPT:
+      {
+        cardano_base_address_t* base     = NULL;
+        cardano_credential_t*   stake    = NULL;
+        cardano_plutus_data_t*  stake_pd = NULL;
+
+        result = cardano_base_address_from_address(address, &base);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          stake  = cardano_base_address_get_stake_credential(base);
+          result = encode_credential(stake, &stake_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_maybe(stake_pd, out);
+        }
+
+        cardano_base_address_unref(&base);
+        cardano_credential_unref(&stake);
+        cardano_plutus_data_unref(&stake_pd);
+
+        break;
+      }
+      case CARDANO_ADDRESS_TYPE_ENTERPRISE_KEY:
+      case CARDANO_ADDRESS_TYPE_ENTERPRISE_SCRIPT:
+      {
+        result = encode_maybe(NULL, out);
+        break;
+      }
+      case CARDANO_ADDRESS_TYPE_POINTER_KEY:
+      case CARDANO_ADDRESS_TYPE_POINTER_SCRIPT:
+      case CARDANO_ADDRESS_TYPE_BYRON:
+      case CARDANO_ADDRESS_TYPE_REWARD_KEY:
+      case CARDANO_ADDRESS_TYPE_REWARD_SCRIPT:
+      default:
+      {
+        result = CARDANO_ERROR_INVALID_ADDRESS_TYPE;
+        break;
+      }
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes a V4 address: the list [payment credential, Maybe AccountId].
+ */
+static cardano_error_t
+address_v4(const cardano_address_t* address, cardano_plutus_data_t** out)
+{
+  cardano_plutus_data_t* fields[2] = { NULL, NULL };
+  cardano_credential_t*  payment   = NULL;
+  cardano_error_t        result    = address_account_v4(address, &fields[1]);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    payment = payment_credential(address);
+    result  = encode_credential(payment, &fields[0]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_list(fields, 2U, out);
+  }
+
+  cardano_credential_unref(&payment);
+  unref_all(fields, 2U);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the datum of a V4 transaction output as an OutputDatum.
+ *
+ * No datum => Constr 0 [], a datum hash => Constr 1 [hash], an inline datum =>
+ * Constr 2 [datum].
+ */
+static cardano_error_t
+output_datum_v4(cardano_datum_t* datum, cardano_plutus_data_t** out)
+{
+  if (datum == NULL)
+  {
+    return empty_constr(CONSTR_0, out);
+  }
+
+  cardano_datum_type_t   type   = CARDANO_DATUM_TYPE_DATA_HASH;
+  cardano_plutus_data_t* value  = NULL;
+  uint64_t               option = CONSTR_1;
+  cardano_error_t        result = cardano_datum_get_type(datum, &type);
+
+  if ((result == CARDANO_SUCCESS) && (type == CARDANO_DATUM_TYPE_INLINE_DATA))
+  {
+    option = CONSTR_2;
+    value  = cardano_datum_get_inline_data(datum);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (type == CARDANO_DATUM_TYPE_DATA_HASH))
+  {
+    result = encode_bytes(cardano_datum_get_data_hash_bytes(datum), cardano_datum_get_data_hash_bytes_size(datum), &value);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = wrap_constr(option, value, out);
+  }
+
+  cardano_plutus_data_unref(&value);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a V4 transaction output: the list [address, value, datum option, Maybe script hash].
+ */
+static cardano_error_t
+output_v4(cardano_transaction_output_t* output, cardano_plutus_data_t** out)
+{
+  cardano_address_t*     address   = cardano_transaction_output_get_address(output);
+  cardano_value_t*       value     = cardano_transaction_output_get_value(output);
+  cardano_datum_t*       datum     = cardano_transaction_output_get_datum(output);
+  cardano_plutus_data_t* fields[4] = { NULL, NULL, NULL, NULL };
+  cardano_error_t        result    = address_v4(address, &fields[0]);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_value(value, &fields[1]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = output_datum_v4(datum, &fields[2]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = output_script_ref(output, &fields[3]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_list(fields, 4U, out);
+  }
+
+  cardano_address_unref(&address);
+  cardano_value_unref(&value);
+  cardano_datum_unref(&datum);
+  unref_all(fields, 4U);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a V4 output reference: the list [transaction id, index].
+ */
+static cardano_error_t
+out_ref_v4(cardano_transaction_input_t* input, cardano_plutus_data_t** out)
+{
+  cardano_blake2b_hash_t* id        = cardano_transaction_input_get_id(input);
+  cardano_plutus_data_t*  fields[2] = { NULL, NULL };
+  cardano_error_t         result    = hash_bytes(id, &fields[0]);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(cardano_transaction_input_get_index(input), &fields[1]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_list(fields, 2U, out);
+  }
+
+  cardano_blake2b_hash_unref(&id);
+  unref_all(fields, 2U);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a set of inputs as the V4 list of TxInInfo records [out ref, resolved output].
+ */
+static cardano_error_t
+inputs_v4(cardano_transaction_input_set_t* inputs, cardano_utxo_list_t* resolved_inputs, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+  const size_t           count  = (inputs != NULL) ? cardano_transaction_input_set_get_length(inputs) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_transaction_input_t*  input     = NULL;
+    cardano_transaction_output_t* output    = NULL;
+    cardano_plutus_data_t*        fields[2] = { NULL, NULL };
+    cardano_plutus_data_t*        info      = NULL;
+
+    result = cardano_transaction_input_set_get(inputs, i, &input);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      output = resolve_output(resolved_inputs, input);
+      result = (output != NULL) ? out_ref_v4(input, &fields[0]) : CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = output_v4(output, &fields[1]);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_list(fields, 2U, &info);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, info);
+    }
+
+    cardano_transaction_input_unref(&input);
+    cardano_transaction_output_unref(&output);
+    cardano_plutus_data_unref(&info);
+    unref_all(fields, 2U);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Rejects reference inputs that are also spent, as the ledger does before building a V4 TxInfo.
+ */
+static cardano_error_t
+check_reference_inputs_disjoint(cardano_transaction_input_set_t* inputs, cardano_transaction_input_set_t* reference_inputs)
+{
+  const size_t    input_count     = (inputs != NULL) ? cardano_transaction_input_set_get_length(inputs) : 0U;
+  const size_t    reference_count = (reference_inputs != NULL) ? cardano_transaction_input_set_get_length(reference_inputs) : 0U;
+  cardano_error_t result          = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < reference_count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_transaction_input_t* reference = NULL;
+
+    result = cardano_transaction_input_set_get(reference_inputs, i, &reference);
+
+    for (size_t j = 0U; (j < input_count) && (result == CARDANO_SUCCESS); ++j)
+    {
+      cardano_transaction_input_t* input = NULL;
+
+      result = cardano_transaction_input_set_get(inputs, j, &input);
+
+      if ((result == CARDANO_SUCCESS) && cardano_transaction_input_equals(input, reference))
+      {
+        result = CARDANO_ERROR_INVALID_ARGUMENT;
+      }
+
+      cardano_transaction_input_unref(&input);
+    }
+
+    cardano_transaction_input_unref(&reference);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes the transaction outputs as the V4 list of outputs.
+ */
+static cardano_error_t
+outputs_v4(cardano_transaction_output_list_t* outputs, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+  const size_t           count  = (outputs != NULL) ? cardano_transaction_output_list_get_length(outputs) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_transaction_output_t* output = NULL;
+    cardano_plutus_data_t*        pd     = NULL;
+
+    result = cardano_transaction_output_list_get(outputs, i, &output);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = output_v4(output, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_transaction_output_unref(&output);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a certificate as a V4 TxCert.
+ *
+ * Account registration and deregistration carry their deposit as a plain
+ * lovelace amount: Constr 0 [credential, deposit] and Constr 1 [credential,
+ * refund]. The other certificates share their V3 encoding. Certificates without
+ * a deposit, genesis delegations and MIR certificates no longer exist in the
+ * Dijkstra era and are rejected.
+ */
+static cardano_error_t
+certificate_v4(cardano_certificate_t* certificate, cardano_plutus_data_t** out)
+{
+  cardano_cert_type_t type   = CARDANO_CERT_TYPE_STAKE_REGISTRATION;
+  cardano_error_t     result = cardano_cert_get_type(certificate, &type);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    switch (type)
+    {
+      case CARDANO_CERT_TYPE_REGISTRATION:
+      {
+        cardano_registration_cert_t* cert       = NULL;
+        cardano_credential_t*        credential = NULL;
+        cardano_plutus_data_t*       fields[2]  = { NULL, NULL };
+
+        result = cardano_certificate_to_registration(certificate, &cert);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          credential = cardano_registration_cert_get_stake_credential(cert);
+          result     = encode_credential(credential, &fields[0]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_data_new_integer_from_uint(cardano_registration_cert_get_deposit(cert), &fields[1]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_variant(CONSTR_0, fields, 2U, out);
+        }
+
+        cardano_registration_cert_unref(&cert);
+        cardano_credential_unref(&credential);
+        unref_all(fields, 2U);
+
+        break;
+      }
+      case CARDANO_CERT_TYPE_UNREGISTRATION:
+      {
+        cardano_unregistration_cert_t* cert       = NULL;
+        cardano_credential_t*          credential = NULL;
+        cardano_plutus_data_t*         fields[2]  = { NULL, NULL };
+
+        result = cardano_certificate_to_unregistration(certificate, &cert);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          credential = cardano_unregistration_cert_get_credential(cert);
+          result     = encode_credential(credential, &fields[0]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_data_new_integer_from_uint(cardano_unregistration_cert_get_deposit(cert), &fields[1]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_variant(CONSTR_1, fields, 2U, out);
+        }
+
+        cardano_unregistration_cert_unref(&cert);
+        cardano_credential_unref(&credential);
+        unref_all(fields, 2U);
+
+        break;
+      }
+      case CARDANO_CERT_TYPE_STAKE_DELEGATION:
+      case CARDANO_CERT_TYPE_POOL_REGISTRATION:
+      case CARDANO_CERT_TYPE_POOL_RETIREMENT:
+      case CARDANO_CERT_TYPE_VOTE_DELEGATION:
+      case CARDANO_CERT_TYPE_STAKE_VOTE_DELEGATION:
+      case CARDANO_CERT_TYPE_STAKE_REGISTRATION_DELEGATION:
+      case CARDANO_CERT_TYPE_VOTE_REGISTRATION_DELEGATION:
+      case CARDANO_CERT_TYPE_STAKE_VOTE_REGISTRATION_DELEGATION:
+      case CARDANO_CERT_TYPE_AUTH_COMMITTEE_HOT:
+      case CARDANO_CERT_TYPE_RESIGN_COMMITTEE_COLD:
+      case CARDANO_CERT_TYPE_DREP_REGISTRATION:
+      case CARDANO_CERT_TYPE_DREP_UNREGISTRATION:
+      case CARDANO_CERT_TYPE_UPDATE_DREP:
+      {
+        result = certificate_v3(certificate, out);
+        break;
+      }
+      case CARDANO_CERT_TYPE_STAKE_REGISTRATION:
+      case CARDANO_CERT_TYPE_STAKE_DEREGISTRATION:
+      case CARDANO_CERT_TYPE_GENESIS_KEY_DELEGATION:
+      case CARDANO_CERT_TYPE_MOVE_INSTANTANEOUS_REWARDS:
+      default:
+      {
+        result = CARDANO_ERROR_INVALID_CERTIFICATE_TYPE;
+        break;
+      }
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes the certificates as the V4 list of TxCert.
+ */
+static cardano_error_t
+certificates_v4(cardano_certificate_set_t* certificates, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+  const size_t           count  = (certificates != NULL) ? cardano_certificate_set_get_length(certificates) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_certificate_t* certificate = NULL;
+    cardano_plutus_data_t* pd          = NULL;
+
+    result = cardano_certificate_set_get(certificates, i, &certificate);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = certificate_v4(certificate, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_certificate_unref(&certificate);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Encodes an optional slot as a Maybe POSIXTime.
+ */
+static cardano_error_t
+maybe_posix_time(const uint64_t* slot, const cardano_slot_config_t* slot_config, cardano_plutus_data_t** out)
+{
+  if (slot == NULL)
+  {
+    return encode_maybe(NULL, out);
+  }
+
+  uint64_t               time    = 0U;
+  cardano_plutus_data_t* time_pd = NULL;
+  cardano_error_t        result  = slot_to_posix(*slot, slot_config, &time);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(time, &time_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_maybe(time_pd, out);
+  }
+
+  cardano_plutus_data_unref(&time_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a validity interval as the V4 POSIXTimeRange: the list [Maybe from, Maybe until].
+ *
+ * The lower bound is the inclusive start of the first valid slot, the upper bound
+ * the exclusive start of the first invalid slot; a missing bound is unbounded.
+ */
+static cardano_error_t
+time_range_v4(const uint64_t* lower, const uint64_t* upper, const cardano_slot_config_t* slot_config, cardano_plutus_data_t** out)
+{
+  cardano_plutus_data_t* fields[2] = { NULL, NULL };
+  cardano_error_t        result    = maybe_posix_time(lower, slot_config, &fields[0]);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = maybe_posix_time(upper, slot_config, &fields[1]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_list(fields, 2U, out);
+  }
+
+  unref_all(fields, 2U);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the guards of a transaction as the list of credentials, in transaction order.
+ */
+static cardano_error_t
+guards_v4(cardano_guard_set_t* guards, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+  const size_t           count  = (guards != NULL) ? cardano_guard_set_get_length(guards) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_credential_t*  credential = NULL;
+    cardano_plutus_data_t* pd         = NULL;
+
+    result = cardano_guard_set_get(guards, i, &credential);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_credential(credential, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_credential_unref(&credential);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Adds the required top-level guards of a transaction to a sorted map keyed by credential.
+ *
+ * Each value is the guard datum as a Maybe Datum.
+ */
+static cardano_error_t
+put_required_guards(sorted_map_t* map, cardano_required_guards_map_t* guards)
+{
+  const size_t    count  = (guards != NULL) ? cardano_required_guards_map_get_length(guards) : 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_credential_t*  credential = NULL;
+    cardano_plutus_data_t* datum      = NULL;
+    cardano_plutus_data_t* key_pd     = NULL;
+    cardano_plutus_data_t* datum_pd   = NULL;
+    sort_key_t             key;
+
+    key.size = 0U;
+    result   = cardano_required_guards_map_get_key_value_at(guards, i, &credential, &datum);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = sort_key_append_credential(&key, credential);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_credential(credential, &key_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_maybe(datum, &datum_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = sorted_map_put(map, &key, key_pd, NULL, datum_pd, NULL, MERGE_KEEP_FIRST);
+    }
+
+    cardano_credential_unref(&credential);
+    cardano_plutus_data_unref(&datum);
+    cardano_plutus_data_unref(&key_pd);
+    cardano_plutus_data_unref(&datum_pd);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes the required top-level guards as the V4 map of credential to Maybe Datum, in ledger order.
+ */
+static cardano_error_t
+required_guards_v4(cardano_required_guards_map_t* guards, cardano_plutus_data_t** out)
+{
+  sorted_map_t map = { NULL, 0U, 0U };
+
+  cardano_error_t result = put_required_guards(&map, guards);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&map, out);
+  }
+
+  sorted_map_free(&map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a V4 governance action id: the list [transaction id, action index].
+ *
+ * The sort key receives the transaction id and the index, the ledger order of
+ * governance action ids.
+ */
+static cardano_error_t
+gov_action_id_v4(cardano_governance_action_id_t* id, sort_key_t* key, cardano_plutus_data_t** out)
+{
+  const byte_t*          tx_id     = cardano_governance_action_id_get_hash_bytes(id);
+  const size_t           id_size   = cardano_governance_action_id_get_hash_bytes_size(id);
+  uint64_t               index     = 0U;
+  cardano_plutus_data_t* fields[2] = { NULL, NULL };
+  cardano_error_t        result    = encode_bytes(tx_id, id_size, &fields[0]);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_governance_action_id_get_index(id, &index);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    sort_key_append(key, tx_id, id_size);
+    sort_key_append_index(key, index);
+
+    result = cardano_plutus_data_new_integer_from_uint(index, &fields[1]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_list(fields, 2U, out);
+  }
+
+  unref_all(fields, 2U);
+
+  return result;
+}
+
+/**
+ * \brief Encodes an optional V4 governance action id as a Maybe GovernanceActionId.
+ */
+static cardano_error_t
+maybe_gov_action_id_v4(cardano_governance_action_id_t* id, cardano_plutus_data_t** out)
+{
+  if (id == NULL)
+  {
+    return encode_maybe(NULL, out);
+  }
+
+  sort_key_t             key;
+  cardano_plutus_data_t* id_pd = NULL;
+
+  key.size = 0U;
+
+  cardano_error_t result = gov_action_id_v4(id, &key, &id_pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_maybe(id_pd, out);
+  }
+
+  cardano_plutus_data_unref(&id_pd);
+
+  return result;
+}
+
+/**
+ * \brief Adds the votes of a transaction to a sorted map keyed by voter and governance action id.
+ *
+ * A later vote of the same voter on the same action replaces an earlier one.
+ */
+static cardano_error_t
+put_votes(sorted_map_t* map, cardano_voting_procedures_t* procedures)
+{
+  cardano_voter_list_t* voters = NULL;
+  cardano_error_t       result = CARDANO_SUCCESS;
+
+  if (procedures != NULL)
+  {
+    result = cardano_voting_procedures_get_voters(procedures, &voters);
+  }
+
+  const size_t voter_count = (voters != NULL) ? cardano_voter_list_get_length(voters) : 0U;
+
+  for (size_t i = 0U; (i < voter_count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_voter_t*                     voter    = NULL;
+    cardano_governance_action_id_list_t* ids      = NULL;
+    cardano_plutus_data_t*               voter_pd = NULL;
+    sort_key_t                           voter_key;
+
+    voter_key.size = 0U;
+    result         = cardano_voter_list_get(voters, i, &voter);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = voter_entry(voter, &voter_key, &voter_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_voting_procedures_get_governance_ids_by_voter(procedures, voter, &ids);
+    }
+
+    const size_t id_count = (result == CARDANO_SUCCESS) ? cardano_governance_action_id_list_get_length(ids) : 0U;
+
+    for (size_t j = 0U; (j < id_count) && (result == CARDANO_SUCCESS); ++j)
+    {
+      cardano_governance_action_id_t* id        = NULL;
+      cardano_voting_procedure_t*     procedure = NULL;
+      cardano_plutus_data_t*          id_pd     = NULL;
+      cardano_plutus_data_t*          vote_pd   = NULL;
+      sort_key_t                      key       = voter_key;
+
+      result = cardano_governance_action_id_list_get(ids, j, &id);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = gov_action_id_v4(id, &key, &id_pd);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        procedure = cardano_voting_procedures_get(procedures, voter, id);
+        result    = (procedure != NULL) ? encode_vote(cardano_voting_procedure_get_vote(procedure), &vote_pd) : CARDANO_ERROR_ELEMENT_NOT_FOUND;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = sorted_map_put(map, &key, voter_pd, id_pd, vote_pd, NULL, MERGE_KEEP_LAST);
+      }
+
+      cardano_governance_action_id_unref(&id);
+      cardano_voting_procedure_unref(&procedure);
+      cardano_plutus_data_unref(&id_pd);
+      cardano_plutus_data_unref(&vote_pd);
+    }
+
+    cardano_voter_unref(&voter);
+    cardano_governance_action_id_list_unref(&ids);
+    cardano_plutus_data_unref(&voter_pd);
+  }
+
+  cardano_voter_list_unref(&voters);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the votes as the V4 map of voter to map of governance action id to vote, in ledger order.
+ */
+static cardano_error_t
+votes_v4(cardano_voting_procedures_t* procedures, cardano_plutus_data_t** out)
+{
+  sorted_map_t map = { NULL, 0U, 0U };
+
+  cardano_error_t result = put_votes(&map, procedures);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode_nested(&map, out);
+  }
+
+  sorted_map_free(&map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes a unit interval as the V4 Rational: the list [numerator, denominator] in lowest terms.
+ *
+ * The ledger translates the interval through a Haskell \c Rational, which is
+ * always reduced.
+ */
+static cardano_error_t
+rational_v4(const cardano_unit_interval_t* interval, cardano_plutus_data_t** out)
+{
+  const uint64_t numerator   = cardano_unit_interval_get_numerator(interval);
+  const uint64_t denominator = cardano_unit_interval_get_denominator(interval);
+  const uint64_t divisor     = gcd_u64(numerator, denominator);
+  const uint64_t scale       = (divisor == 0U) ? 1U : divisor;
+
+  cardano_plutus_data_t* fields[2] = { NULL, NULL };
+  cardano_error_t        result    = cardano_plutus_data_new_integer_from_uint(numerator / scale, &fields[0]);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(denominator / scale, &fields[1]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_list(fields, 2U, out);
+  }
+
+  unref_all(fields, 2U);
+
+  return result;
+}
+
+/**
+ * \brief Encodes an optional script hash as a Maybe ScriptHash.
+ */
+static cardano_error_t
+maybe_script_hash(cardano_blake2b_hash_t* hash, cardano_plutus_data_t** out)
+{
+  if (hash == NULL)
+  {
+    return encode_maybe(NULL, out);
+  }
+
+  cardano_plutus_data_t* hash_pd = NULL;
+  cardano_error_t        result  = hash_bytes(hash, &hash_pd);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_maybe(hash_pd, out);
+  }
+
+  cardano_plutus_data_unref(&hash_pd);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the fields of an UpdateCommittee action: removed members, added members and quorum.
+ *
+ * The removed members are a list and the added members a map, both in ledger
+ * credential order.
+ */
+static cardano_error_t
+update_committee_v4(cardano_update_committee_action_t* action, cardano_plutus_data_t** fields)
+{
+  cardano_unit_interval_t* quorum = cardano_update_committee_action_get_quorum(action);
+  cardano_error_t          result = committee_changes(action, &fields[0], &fields[1]);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = (quorum != NULL) ? rational_v4(quorum, &fields[2]) : CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_unit_interval_unref(&quorum);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the governance action of a proposal procedure as a V4 GovernanceAction.
+ *
+ * The constructors match V3, but governance action ids, protocol versions,
+ * constitutions and rationals are list-encoded records, and every map and set
+ * follows the ledger key order.
+ */
+static cardano_error_t
+gov_action_v4(cardano_proposal_procedure_t* proposal, cardano_plutus_data_t** out)
+{
+  cardano_governance_action_type_t type   = CARDANO_GOVERNANCE_ACTION_TYPE_INFO;
+  cardano_error_t                  result = cardano_proposal_procedure_get_action_type(proposal, &type);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    switch (type)
+    {
+      case CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE:
+      {
+        cardano_parameter_change_action_t* action    = NULL;
+        cardano_governance_action_id_t*    prev      = NULL;
+        cardano_protocol_param_update_t*   update    = NULL;
+        cardano_blake2b_hash_t*            guardrail = NULL;
+        cardano_plutus_data_t*             fields[3] = { NULL, NULL, NULL };
+
+        result = cardano_proposal_procedure_to_parameter_change_action(proposal, &action);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          prev   = cardano_parameter_change_action_get_governance_action_id(action);
+          result = maybe_gov_action_id_v4(prev, &fields[0]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          update = cardano_parameter_change_action_get_protocol_param_update(action);
+          result = cardano_protocol_param_update_to_plutus_data(update, &fields[1]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          guardrail = cardano_parameter_change_action_get_policy_hash(action);
+          result    = maybe_script_hash(guardrail, &fields[2]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_variant(CONSTR_0, fields, 3U, out);
+        }
+
+        cardano_parameter_change_action_unref(&action);
+        cardano_governance_action_id_unref(&prev);
+        cardano_protocol_param_update_unref(&update);
+        cardano_blake2b_hash_unref(&guardrail);
+        unref_all(fields, 3U);
+
+        break;
+      }
+      case CARDANO_GOVERNANCE_ACTION_TYPE_HARD_FORK_INITIATION:
+      {
+        cardano_hard_fork_initiation_action_t* action    = NULL;
+        cardano_governance_action_id_t*        prev      = NULL;
+        cardano_protocol_version_t*            version   = NULL;
+        cardano_plutus_data_t*                 fields[2] = { NULL, NULL };
+        cardano_plutus_data_t*                 parts[2]  = { NULL, NULL };
+
+        result = cardano_proposal_procedure_to_hard_fork_initiation_action(proposal, &action);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          prev   = cardano_hard_fork_initiation_action_get_governance_action_id(action);
+          result = maybe_gov_action_id_v4(prev, &fields[0]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          version = cardano_hard_fork_initiation_action_get_protocol_version(action);
+          result  = cardano_plutus_data_new_integer_from_uint(cardano_protocol_version_get_major(version), &parts[0]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_data_new_integer_from_uint(cardano_protocol_version_get_minor(version), &parts[1]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_list(parts, 2U, &fields[1]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_variant(CONSTR_1, fields, 2U, out);
+        }
+
+        cardano_hard_fork_initiation_action_unref(&action);
+        cardano_governance_action_id_unref(&prev);
+        cardano_protocol_version_unref(&version);
+        unref_all(fields, 2U);
+        unref_all(parts, 2U);
+
+        break;
+      }
+      case CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS:
+      {
+        cardano_treasury_withdrawals_action_t* action      = NULL;
+        cardano_withdrawal_map_t*              withdrawals = NULL;
+        cardano_blake2b_hash_t*                guardrail   = NULL;
+        cardano_plutus_data_t*                 fields[2]   = { NULL, NULL };
+
+        result = cardano_proposal_procedure_to_treasury_withdrawals_action(proposal, &action);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          withdrawals = cardano_treasury_withdrawals_action_get_withdrawals(action);
+          result      = withdrawals_v3(withdrawals, &fields[0]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          guardrail = cardano_treasury_withdrawals_action_get_policy_hash(action);
+          result    = maybe_script_hash(guardrail, &fields[1]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_variant(CONSTR_2, fields, 2U, out);
+        }
+
+        cardano_treasury_withdrawals_action_unref(&action);
+        cardano_withdrawal_map_unref(&withdrawals);
+        cardano_blake2b_hash_unref(&guardrail);
+        unref_all(fields, 2U);
+
+        break;
+      }
+      case CARDANO_GOVERNANCE_ACTION_TYPE_NO_CONFIDENCE:
+      {
+        cardano_no_confidence_action_t* action    = NULL;
+        cardano_governance_action_id_t* prev      = NULL;
+        cardano_plutus_data_t*          fields[1] = { NULL };
+
+        result = cardano_proposal_procedure_to_no_confidence_action(proposal, &action);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          prev   = cardano_no_confidence_action_get_governance_action_id(action);
+          result = maybe_gov_action_id_v4(prev, &fields[0]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_variant(CONSTR_3, fields, 1U, out);
+        }
+
+        cardano_no_confidence_action_unref(&action);
+        cardano_governance_action_id_unref(&prev);
+        unref_all(fields, 1U);
+
+        break;
+      }
+      case CARDANO_GOVERNANCE_ACTION_TYPE_UPDATE_COMMITTEE:
+      {
+        cardano_update_committee_action_t* action    = NULL;
+        cardano_governance_action_id_t*    prev      = NULL;
+        cardano_plutus_data_t*             fields[4] = { NULL, NULL, NULL, NULL };
+
+        result = cardano_proposal_procedure_to_update_committee_action(proposal, &action);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          prev   = cardano_update_committee_action_get_governance_action_id(action);
+          result = maybe_gov_action_id_v4(prev, &fields[0]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = update_committee_v4(action, &fields[1]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_variant(CONSTR_4, fields, 4U, out);
+        }
+
+        cardano_update_committee_action_unref(&action);
+        cardano_governance_action_id_unref(&prev);
+        unref_all(fields, 4U);
+
+        break;
+      }
+      case CARDANO_GOVERNANCE_ACTION_TYPE_NEW_CONSTITUTION:
+      {
+        cardano_new_constitution_action_t* action       = NULL;
+        cardano_governance_action_id_t*    prev         = NULL;
+        cardano_constitution_t*            constitution = NULL;
+        cardano_blake2b_hash_t*            script_hash  = NULL;
+        cardano_plutus_data_t*             fields[2]    = { NULL, NULL };
+        cardano_plutus_data_t*             script_pd    = NULL;
+
+        result = cardano_proposal_procedure_to_constitution_action(proposal, &action);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          prev   = cardano_new_constitution_action_get_governance_action_id(action);
+          result = maybe_gov_action_id_v4(prev, &fields[0]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          constitution = cardano_new_constitution_action_get_constitution(action);
+          script_hash  = cardano_constitution_get_script_hash(constitution);
+          result       = maybe_script_hash(script_hash, &script_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_list(&script_pd, 1U, &fields[1]);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_variant(CONSTR_5, fields, 2U, out);
+        }
+
+        cardano_new_constitution_action_unref(&action);
+        cardano_governance_action_id_unref(&prev);
+        cardano_constitution_unref(&constitution);
+        cardano_blake2b_hash_unref(&script_hash);
+        cardano_plutus_data_unref(&script_pd);
+        unref_all(fields, 2U);
+
+        break;
+      }
+      case CARDANO_GOVERNANCE_ACTION_TYPE_INFO:
+      {
+        result = empty_constr(CONSTR_6, out);
+        break;
+      }
+      default:
+      {
+        result = CARDANO_ERROR_INVALID_ARGUMENT;
+        break;
+      }
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes a V4 proposal procedure: the list [deposit, return credential, governance action].
+ */
+static cardano_error_t
+proposal_procedure_v4(cardano_proposal_procedure_t* proposal, cardano_plutus_data_t** out)
+{
+  cardano_reward_address_t* reward     = cardano_proposal_procedure_get_reward_address(proposal);
+  cardano_credential_t*     credential = cardano_reward_address_get_credential(reward);
+  cardano_plutus_data_t*    fields[3]  = { NULL, NULL, NULL };
+  cardano_error_t           result     = cardano_plutus_data_new_integer_from_uint(cardano_proposal_procedure_get_deposit(proposal), &fields[0]);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_credential(credential, &fields[1]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = gov_action_v4(proposal, &fields[2]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_list(fields, 3U, out);
+  }
+
+  cardano_reward_address_unref(&reward);
+  cardano_credential_unref(&credential);
+  unref_all(fields, 3U);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the proposal procedures as the V4 list, in transaction order.
+ */
+static cardano_error_t
+proposal_procedures_v4(cardano_proposal_procedure_set_t* proposals, cardano_plutus_data_t** out)
+{
+  cardano_plutus_list_t* list   = NULL;
+  cardano_error_t        result = cardano_plutus_list_new(&list);
+  const size_t           count  = (proposals != NULL) ? cardano_proposal_procedure_set_get_length(proposals) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_proposal_procedure_t* proposal = NULL;
+    cardano_plutus_data_t*        pd       = NULL;
+
+    result = cardano_proposal_procedure_set_get(proposals, i, &proposal);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = proposal_procedure_v4(proposal, &pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(list, pd);
+    }
+
+    cardano_proposal_procedure_unref(&proposal);
+    cardano_plutus_data_unref(&pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(list, out);
+  }
+
+  cardano_plutus_list_unref(&list);
+
+  return result;
+}
+
+/**
+ * \brief Releases the references held by a transaction view.
+ */
+static void
+tx_view_release(tx_view_t* view)
+{
+  cardano_blake2b_hash_unref(&view->id);
+  cardano_transaction_input_set_unref(&view->inputs);
+  cardano_transaction_input_set_unref(&view->reference_inputs);
+  cardano_transaction_output_list_unref(&view->outputs);
+  cardano_multi_asset_unref(&view->mint);
+  cardano_certificate_set_unref(&view->certificates);
+  cardano_withdrawal_map_unref(&view->withdrawals);
+  cardano_direct_deposit_map_unref(&view->direct_deposits);
+  cardano_account_balance_intervals_map_unref(&view->balance_intervals);
+  cardano_guard_set_unref(&view->guards);
+  cardano_required_guards_map_unref(&view->required_guards);
+  cardano_voting_procedures_unref(&view->votes);
+  cardano_proposal_procedure_set_unref(&view->proposals);
+  cardano_redeemer_list_unref(&view->redeemers);
+  cardano_plutus_data_set_unref(&view->datums);
+}
+
+/**
+ * \brief Copies an optional slot or amount into a view.
+ */
+static void
+tx_view_set_optional(const uint64_t* source, bool* is_set, uint64_t* value)
+{
+  *is_set = (source != NULL);
+  *value  = (source != NULL) ? *source : 0U;
+}
+
+/**
+ * \brief Reads the view of a top-level transaction.
+ */
+static cardano_error_t
+tx_view_from_transaction(cardano_transaction_t* tx, tx_view_t* view)
+{
+  cardano_transaction_body_t* body        = cardano_transaction_get_body(tx);
+  cardano_witness_set_t*      witness_set = cardano_transaction_get_witness_set(tx);
+  const uint64_t*             donation    = cardano_transaction_body_get_donation(body);
+
+  CARDANO_UNUSED(memset(view, 0, sizeof(tx_view_t)));
+
+  view->id                = cardano_transaction_get_id(tx);
+  view->inputs            = cardano_transaction_body_get_inputs(body);
+  view->reference_inputs  = cardano_transaction_body_get_reference_inputs(body);
+  view->outputs           = cardano_transaction_body_get_outputs(body);
+  view->mint              = cardano_transaction_body_get_mint(body);
+  view->certificates      = cardano_transaction_body_get_certificates(body);
+  view->withdrawals       = cardano_transaction_body_get_withdrawals(body);
+  view->direct_deposits   = cardano_transaction_body_get_direct_deposits(body);
+  view->balance_intervals = cardano_transaction_body_get_account_balance_intervals(body);
+  view->guards            = cardano_transaction_body_get_guards(body);
+  view->required_guards   = cardano_transaction_body_get_required_top_level_guards(body);
+  view->votes             = cardano_transaction_body_get_voting_procedures(body);
+  view->proposals         = cardano_transaction_body_get_proposal_procedures(body);
+  view->redeemers         = cardano_witness_set_get_redeemers(witness_set);
+  view->datums            = cardano_witness_set_get_plutus_data(witness_set);
+  view->donation          = (donation != NULL) ? *donation : 0U;
+
+  tx_view_set_optional(cardano_transaction_body_get_invalid_before(body), &view->has_invalid_before, &view->invalid_before);
+  tx_view_set_optional(cardano_transaction_body_get_invalid_after(body), &view->has_invalid_after, &view->invalid_after);
+  tx_view_set_optional(cardano_transaction_body_get_treasury_value(body), &view->has_treasury, &view->treasury);
+
+  cardano_transaction_body_unref(&body);
+  cardano_witness_set_unref(&witness_set);
+
+  return (view->id != NULL) ? CARDANO_SUCCESS : CARDANO_ERROR_POINTER_IS_NULL;
+}
+
+/**
+ * \brief Reads the view of the sub-transaction at a position of the top-level transaction.
+ *
+ * The position is the index of the sub-transaction in the body of the top-level
+ * transaction, and becomes the sub-transaction index of its TxInfo.
+ */
+static cardano_error_t
+tx_view_from_sub_transaction(cardano_transaction_t* tx, const uint64_t index, tx_view_t* view)
+{
+  cardano_transaction_body_t*    body   = cardano_transaction_get_body(tx);
+  cardano_sub_transaction_set_t* subs   = cardano_transaction_body_get_sub_transactions(body);
+  cardano_sub_transaction_t*     sub    = NULL;
+  cardano_error_t                result = CARDANO_SUCCESS;
+
+  CARDANO_UNUSED(memset(view, 0, sizeof(tx_view_t)));
+
+  if ((subs == NULL) || (index >= (uint64_t)cardano_sub_transaction_set_get_length(subs)))
+  {
+    result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_sub_transaction_set_get(subs, (size_t)index, &sub);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_sub_transaction_body_t* sub_body    = cardano_sub_transaction_get_body(sub);
+    cardano_witness_set_t*          witness_set = cardano_sub_transaction_get_witness_set(sub);
+    const uint64_t*                 donation    = cardano_sub_transaction_body_get_donation(sub_body);
+
+    view->id                = cardano_sub_transaction_get_id(sub);
+    view->is_sub_tx         = true;
+    view->sub_tx_index      = index;
+    view->inputs            = cardano_sub_transaction_body_get_inputs(sub_body);
+    view->reference_inputs  = cardano_sub_transaction_body_get_reference_inputs(sub_body);
+    view->outputs           = cardano_sub_transaction_body_get_outputs(sub_body);
+    view->mint              = cardano_sub_transaction_body_get_mint(sub_body);
+    view->certificates      = cardano_sub_transaction_body_get_certificates(sub_body);
+    view->withdrawals       = cardano_sub_transaction_body_get_withdrawals(sub_body);
+    view->direct_deposits   = cardano_sub_transaction_body_get_direct_deposits(sub_body);
+    view->balance_intervals = cardano_sub_transaction_body_get_account_balance_intervals(sub_body);
+    view->guards            = cardano_sub_transaction_body_get_guards(sub_body);
+    view->required_guards   = cardano_sub_transaction_body_get_required_top_level_guards(sub_body);
+    view->votes             = cardano_sub_transaction_body_get_voting_procedures(sub_body);
+    view->proposals         = cardano_sub_transaction_body_get_proposal_procedures(sub_body);
+    view->redeemers         = cardano_witness_set_get_redeemers(witness_set);
+    view->datums            = cardano_witness_set_get_plutus_data(witness_set);
+    view->donation          = (donation != NULL) ? *donation : 0U;
+
+    tx_view_set_optional(cardano_sub_transaction_body_get_invalid_before(sub_body), &view->has_invalid_before, &view->invalid_before);
+    tx_view_set_optional(cardano_sub_transaction_body_get_invalid_after(sub_body), &view->has_invalid_after, &view->invalid_after);
+    tx_view_set_optional(cardano_sub_transaction_body_get_treasury_value(sub_body), &view->has_treasury, &view->treasury);
+
+    cardano_sub_transaction_body_unref(&sub_body);
+    cardano_witness_set_unref(&witness_set);
+
+    result = (view->id != NULL) ? CARDANO_SUCCESS : CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_sub_transaction_unref(&sub);
+  cardano_sub_transaction_set_unref(&subs);
+  cardano_transaction_body_unref(&body);
+
+  return result;
+}
+
+/**
+ * \brief Reads the view of the transaction level a script runs at.
+ *
+ * \param[in] tx The top-level transaction.
+ * \param[in] sub_tx_index The position of the sub-transaction, or NULL for the top level.
+ * \param[out] view The view to fill.
+ */
+static cardano_error_t
+tx_view_read(cardano_transaction_t* tx, const uint64_t* sub_tx_index, tx_view_t* view)
+{
+  if (sub_tx_index == NULL)
+  {
+    return tx_view_from_transaction(tx, view);
+  }
+
+  return tx_view_from_sub_transaction(tx, *sub_tx_index, view);
+}
+
+/**
+ * \brief Finds the minting policy that a mint redeemer points to, in ledger policy order.
+ */
+static cardano_error_t
+indexed_policy(cardano_multi_asset_t* mint, const uint64_t index, cardano_plutus_data_t** policy)
+{
+  sorted_map_t           map    = { NULL, 0U, 0U };
+  cardano_plutus_data_t* found  = NULL;
+  uint64_t               seen   = 0U;
+  cardano_error_t        result = put_assets(&map, mint, ASSETS_ALL);
+
+  for (size_t i = 0U; (result == CARDANO_SUCCESS) && (i < map.count); ++i)
+  {
+    const bool is_new_policy = (i == 0U) || !cardano_plutus_data_equals(map.items[i].key_data, map.items[i - 1U].key_data);
+
+    if (is_new_policy && (seen == index))
+    {
+      found = map.items[i].key_data;
+    }
+
+    seen += is_new_policy ? 1U : 0U;
+  }
+
+  if ((result == CARDANO_SUCCESS) && (found == NULL))
+  {
+    result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_ref(found);
+    *policy = found;
+  }
+
+  sorted_map_free(&map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the voter that a voting redeemer points to, in ledger voter order.
+ */
+static cardano_error_t
+indexed_voter(cardano_voting_procedures_t* procedures, const uint64_t index, cardano_plutus_data_t** voter_data)
+{
+  cardano_voter_t* voter  = NULL;
+  cardano_error_t  result = _cardano_ledger_order_voter_at_index(procedures, index, &voter);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_voter(voter, voter_data);
+  }
+
+  cardano_voter_unref(&voter);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the credential that a withdrawal redeemer points to, in ledger account order.
+ */
+static cardano_error_t
+indexed_withdrawal(cardano_withdrawal_map_t* withdrawals, const uint64_t index, cardano_plutus_data_t** credential)
+{
+  cardano_reward_address_t* address = NULL;
+  cardano_credential_t*     cred    = NULL;
+  cardano_error_t           result  = _cardano_ledger_order_withdrawal_at_index(withdrawals, index, &address);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cred   = cardano_reward_address_get_credential(address);
+    result = encode_credential(cred, credential);
+  }
+
+  cardano_credential_unref(&cred);
+  cardano_reward_address_unref(&address);
+
+  return result;
+}
+
+/**
+ * \brief Extracts the script hash that witnesses an encoded V4 TxCert.
+ *
+ * Every certificate but the stake pool ones carries its witness credential as
+ * its first field.
+ */
+static cardano_error_t
+certificate_script_hash(cardano_plutus_data_t* certificate, cardano_plutus_data_t** script_hash)
+{
+  static const uint64_t TX_CERT_V4_POOL_REGISTER = 7U;
+  static const uint64_t TX_CERT_V4_POOL_RETIRE   = 8U;
+
+  uint64_t               alternative = CONSTR_0;
+  cardano_plutus_data_t* credential  = NULL;
+  cardano_error_t        result      = constr_field_at(certificate, 0U, &alternative, &credential);
+
+  if ((result == CARDANO_SUCCESS) && ((alternative == TX_CERT_V4_POOL_REGISTER) || (alternative == TX_CERT_V4_POOL_RETIRE)))
+  {
+    result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = credential_script_hash(credential, script_hash);
+  }
+
+  cardano_plutus_data_unref(&credential);
+
+  return result;
+}
+
+/**
+ * \brief Extracts the script hash of an encoded voter: committee members and DReps may be scripts, stake pools never are.
+ */
+static cardano_error_t
+voter_script_hash(cardano_plutus_data_t* voter, cardano_plutus_data_t** script_hash)
+{
+  uint64_t               alternative = CONSTR_0;
+  cardano_plutus_data_t* credential  = NULL;
+  cardano_error_t        result      = constr_field_at(voter, 0U, &alternative, &credential);
+
+  if ((result == CARDANO_SUCCESS) && (alternative == CONSTR_2))
+  {
+    result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = credential_script_hash(credential, script_hash);
+  }
+
+  cardano_plutus_data_unref(&credential);
+
+  return result;
+}
+
+/**
+ * \brief Extracts the guardrail script hash of a proposal procedure.
+ *
+ * Only parameter changes and treasury withdrawals can carry a guardrail script.
+ */
+static cardano_error_t
+proposal_script_hash(cardano_proposal_procedure_t* proposal, cardano_plutus_data_t** script_hash)
+{
+  cardano_governance_action_type_t type   = CARDANO_GOVERNANCE_ACTION_TYPE_INFO;
+  cardano_blake2b_hash_t*          hash   = NULL;
+  cardano_error_t                  result = cardano_proposal_procedure_get_action_type(proposal, &type);
+
+  if ((result == CARDANO_SUCCESS) && (type == CARDANO_GOVERNANCE_ACTION_TYPE_PARAMETER_CHANGE))
+  {
+    cardano_parameter_change_action_t* action = NULL;
+
+    result = cardano_proposal_procedure_to_parameter_change_action(proposal, &action);
+    hash   = (result == CARDANO_SUCCESS) ? cardano_parameter_change_action_get_policy_hash(action) : NULL;
+
+    cardano_parameter_change_action_unref(&action);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (type == CARDANO_GOVERNANCE_ACTION_TYPE_TREASURY_WITHDRAWALS))
+  {
+    cardano_treasury_withdrawals_action_t* action = NULL;
+
+    result = cardano_proposal_procedure_to_treasury_withdrawals_action(proposal, &action);
+    hash   = (result == CARDANO_SUCCESS) ? cardano_treasury_withdrawals_action_get_policy_hash(action) : NULL;
+
+    cardano_treasury_withdrawals_action_unref(&action);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (hash == NULL))
+  {
+    result = CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = hash_bytes(hash, script_hash);
+  }
+
+  cardano_blake2b_hash_unref(&hash);
+
+  return result;
+}
+
+/**
+ * \brief Releases the values held by resolved purpose parts.
+ */
+static void
+purpose_parts_release(purpose_parts_t* parts)
+{
+  unref_all(parts->items, PURPOSE_MAX_ITEMS);
+  cardano_plutus_data_unref(&parts->script_hash);
+  cardano_plutus_data_unref(&parts->guard);
+}
+
+/**
+ * \brief Resolves the spending purpose: the spent output reference and the script locking it.
+ */
+static cardano_error_t
+spend_parts(const tx_view_t* view, cardano_utxo_list_t* resolved_inputs, const uint64_t index, purpose_parts_t* parts)
+{
+  cardano_transaction_input_t*  input      = NULL;
+  cardano_transaction_output_t* output     = NULL;
+  cardano_address_t*            address    = NULL;
+  cardano_credential_t*         payment    = NULL;
+  cardano_plutus_data_t*        credential = NULL;
+  cardano_error_t               result     = CARDANO_SUCCESS;
+
+  if ((view->inputs == NULL) || (index >= (uint64_t)cardano_transaction_input_set_get_length(view->inputs)))
+  {
+    result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_transaction_input_set_get(view->inputs, (size_t)index, &input);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    output = resolve_output(resolved_inputs, input);
+    result = (output != NULL) ? out_ref_v4(input, &parts->items[0]) : CARDANO_ERROR_ELEMENT_NOT_FOUND;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    address = cardano_transaction_output_get_address(output);
+    payment = payment_credential(address);
+    result  = (payment != NULL) ? encode_credential(payment, &credential) : CARDANO_ERROR_INVALID_ADDRESS_TYPE;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = credential_script_hash(credential, &parts->script_hash);
+  }
+
+  parts->alternative = CONSTR_1;
+  parts->item_count  = 1U;
+
+  cardano_transaction_input_unref(&input);
+  cardano_transaction_output_unref(&output);
+  cardano_address_unref(&address);
+  cardano_credential_unref(&payment);
+  cardano_plutus_data_unref(&credential);
+
+  return result;
+}
+
+/**
+ * \brief Resolves the certifying purpose: the certificate index, the certificate and its witness script.
+ */
+static cardano_error_t
+cert_parts(const tx_view_t* view, const uint64_t index, purpose_parts_t* parts)
+{
+  cardano_certificate_t* certificate = NULL;
+  cardano_error_t        result      = CARDANO_SUCCESS;
+
+  if ((view->certificates == NULL) || (index >= (uint64_t)cardano_certificate_set_get_length(view->certificates)))
+  {
+    result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_certificate_set_get(view->certificates, (size_t)index, &certificate);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(index, &parts->items[0]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = certificate_v4(certificate, &parts->items[1]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = certificate_script_hash(parts->items[1], &parts->script_hash);
+  }
+
+  parts->alternative = CONSTR_3;
+  parts->item_count  = 2U;
+
+  cardano_certificate_unref(&certificate);
+
+  return result;
+}
+
+/**
+ * \brief Resolves the proposing purpose: the proposal index, the proposal and its guardrail script.
+ */
+static cardano_error_t
+propose_parts(const tx_view_t* view, const uint64_t index, purpose_parts_t* parts)
+{
+  cardano_proposal_procedure_t* proposal = NULL;
+  cardano_error_t               result   = CARDANO_SUCCESS;
+
+  if ((view->proposals == NULL) || (index >= (uint64_t)cardano_proposal_procedure_set_get_length(view->proposals)))
+  {
+    result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_proposal_procedure_set_get(view->proposals, (size_t)index, &proposal);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(index, &parts->items[0]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = proposal_procedure_v4(proposal, &parts->items[1]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = proposal_script_hash(proposal, &parts->script_hash);
+  }
+
+  parts->alternative = CONSTR_5;
+  parts->item_count  = 2U;
+
+  cardano_proposal_procedure_unref(&proposal);
+
+  return result;
+}
+
+/**
+ * \brief Resolves the guarding purpose: the guard index and the guard script.
+ *
+ * The index points into the guards of the transaction, which may also hold key
+ * credentials; a guarding redeemer can only point to a script credential.
+ */
+static cardano_error_t
+guard_parts(const tx_view_t* view, const uint64_t index, purpose_parts_t* parts)
+{
+  cardano_credential_t* credential = NULL;
+  cardano_error_t       result     = CARDANO_SUCCESS;
+
+  if ((view->guards == NULL) || (index >= (uint64_t)cardano_guard_set_get_length(view->guards)))
+  {
+    result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_guard_set_get(view->guards, (size_t)index, &credential);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(index, &parts->items[0]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_credential(credential, &parts->guard);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = credential_script_hash(parts->guard, &parts->script_hash);
+  }
+
+  parts->alternative = CONSTR_6;
+  parts->item_count  = 1U;
+
+  cardano_credential_unref(&credential);
+
+  return result;
+}
+
+/**
+ * \brief Resolves what a redeemer points to at a transaction level.
+ *
+ * Fills the ScriptPurpose / ScriptInfo constructor alternative, the items both
+ * share, and the hash of the script that runs. Redeemer indices follow the
+ * ledger order of each collection: sorted inputs, policies, accounts and
+ * voters, and the transaction order of certificates, proposals and guards.
+ */
+static cardano_error_t
+resolve_purpose(
+  tx_view_t*                   view,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_redeemer_tag_t tag,
+  const uint64_t               index,
+  purpose_parts_t*             parts)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  CARDANO_UNUSED(memset(parts, 0, sizeof(purpose_parts_t)));
+
+  switch (tag)
+  {
+    case CARDANO_REDEEMER_TAG_SPEND:
+    {
+      result = spend_parts(view, resolved_inputs, index, parts);
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_MINT:
+    {
+      parts->alternative = CONSTR_0;
+      parts->item_count  = 1U;
+      result             = indexed_policy(view->mint, index, &parts->items[0]);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_ref(parts->items[0]);
+        parts->script_hash = parts->items[0];
+      }
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_REWARD:
+    {
+      parts->alternative = CONSTR_2;
+      parts->item_count  = 1U;
+      result             = indexed_withdrawal(view->withdrawals, index, &parts->items[0]);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = credential_script_hash(parts->items[0], &parts->script_hash);
+      }
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_CERTIFYING:
+    {
+      result = cert_parts(view, index, parts);
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_VOTING:
+    {
+      parts->alternative = CONSTR_4;
+      parts->item_count  = 1U;
+      result             = indexed_voter(view->votes, index, &parts->items[0]);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = voter_script_hash(parts->items[0], &parts->script_hash);
+      }
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_PROPOSING:
+    {
+      result = propose_parts(view, index, parts);
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_GUARDING:
+    {
+      result = guard_parts(view, index, parts);
+      break;
+    }
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  return result;
+}
+
+/**
+ * \brief Encodes the ScriptPurpose of resolved purpose parts: Constr alternative [script hash, items...].
+ */
+static cardano_error_t
+script_purpose_v4(const purpose_parts_t* parts, cardano_plutus_data_t** out)
+{
+  cardano_plutus_data_t* fields[PURPOSE_MAX_ITEMS + 1U] = { NULL };
+
+  fields[0] = parts->script_hash;
+
+  for (size_t i = 0U; i < parts->item_count; ++i)
+  {
+    fields[i + 1U] = parts->items[i];
+  }
+
+  return encode_variant(parts->alternative, fields, parts->item_count + 1U, out);
+}
+
+/**
+ * \brief Encodes the redeemers of a transaction level as the V4 map of ScriptPurpose to redeemer, in ledger purpose order.
+ *
+ * When \p script_hashes is not NULL it also receives the hash of every script
+ * the redeemers run.
+ */
+static cardano_error_t
+redeemers_v4(tx_view_t* view, cardano_utxo_list_t* resolved_inputs, sorted_map_t* script_hashes, cardano_plutus_data_t** out)
+{
+  sorted_map_t    map    = { NULL, 0U, 0U };
+  const size_t    count  = (view->redeemers != NULL) ? cardano_redeemer_list_get_length(view->redeemers) : 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_redeemer_t*    redeemer      = NULL;
+    cardano_plutus_data_t* redeemer_data = NULL;
+    cardano_plutus_data_t* purpose_pd    = NULL;
+    purpose_parts_t        parts;
+    sort_key_t             key;
+
+    key.size = 0U;
+
+    CARDANO_UNUSED(memset(&parts, 0, sizeof(purpose_parts_t)));
+
+    result = cardano_redeemer_list_get(view->redeemers, i, &redeemer);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      const cardano_redeemer_tag_t tag   = cardano_redeemer_get_tag(redeemer);
+      const uint64_t               index = cardano_redeemer_get_index(redeemer);
+
+      sort_key_append_byte(&key, (byte_t)tag);
+      sort_key_append_index(&key, index);
+
+      result = resolve_purpose(view, resolved_inputs, tag, index, &parts);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = script_purpose_v4(&parts, &purpose_pd);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      redeemer_data = cardano_redeemer_get_data(redeemer);
+      result        = sorted_map_put(&map, &key, purpose_pd, NULL, redeemer_data, NULL, MERGE_KEEP_FIRST);
+    }
+
+    if ((result == CARDANO_SUCCESS) && (script_hashes != NULL))
+    {
+      sort_key_t hash_key;
+
+      hash_key.size = 0U;
+
+      cardano_buffer_t* bytes = NULL;
+
+      result = cardano_plutus_data_to_bounded_bytes(parts.script_hash, &bytes);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        sort_key_append(&hash_key, cardano_buffer_get_data(bytes), cardano_buffer_get_size(bytes));
+        result = sorted_map_put(script_hashes, &hash_key, parts.script_hash, NULL, NULL, NULL, MERGE_KEEP_FIRST);
+      }
+
+      cardano_buffer_unref(&bytes);
+    }
+
+    purpose_parts_release(&parts);
+    cardano_redeemer_unref(&redeemer);
+    cardano_plutus_data_unref(&redeemer_data);
+    cardano_plutus_data_unref(&purpose_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&map, out);
+  }
+
+  sorted_map_free(&map);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the sub-transaction index of a TxInfo: Nothing at the top level, Just the index in a sub-transaction.
+ */
+static cardano_error_t
+sub_tx_index_v4(const tx_view_t* view, cardano_plutus_data_t** out)
+{
+  if (!view->is_sub_tx)
+  {
+    return encode_maybe(NULL, out);
+  }
+
+  cardano_plutus_data_t* index  = NULL;
+  cardano_error_t        result = cardano_plutus_data_new_integer_from_uint(view->sub_tx_index, &index);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_maybe(index, out);
+  }
+
+  cardano_plutus_data_unref(&index);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the 19 fields of a V4 TxInfo for a transaction level.
+ *
+ * The fields are, in order: id, sub-transaction index, inputs, reference inputs,
+ * outputs, mint, certificates, withdrawals, direct deposits, account balance
+ * intervals, validity range, guards, required top-level guards, redeemers,
+ * datums, votes, proposals, current treasury amount and treasury donation.
+ *
+ * \param[in] view The transaction level.
+ * \param[in] resolved_inputs The outputs spent or referenced by the level.
+ * \param[in] slot_config The slot configuration of the network.
+ * \param[in] script_hashes Receives the hashes of the scripts the redeemers run, or NULL.
+ * \param[out] fields The encoded fields; the caller releases them.
+ */
+static cardano_error_t
+tx_info_fields_v4(
+  tx_view_t*                   view,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  sorted_map_t*                script_hashes,
+  cardano_plutus_data_t**      fields)
+{
+  cardano_error_t result = check_reference_inputs_disjoint(view->inputs, view->reference_inputs);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = hash_bytes(view->id, &fields[0]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sub_tx_index_v4(view, &fields[1]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = inputs_v4(view->inputs, resolved_inputs, &fields[2]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = inputs_v4(view->reference_inputs, resolved_inputs, &fields[3]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = outputs_v4(view->outputs, &fields[4]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = mint_v4(view->mint, ASSETS_ALL, &fields[5]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = certificates_v4(view->certificates, &fields[6]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = withdrawals_v3(view->withdrawals, &fields[7]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = direct_deposits_v4(view->direct_deposits, &fields[8]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = balance_intervals_v4(view->balance_intervals, &fields[9]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = time_range_v4(
+      view->has_invalid_before ? &view->invalid_before : NULL,
+      view->has_invalid_after ? &view->invalid_after : NULL,
+      slot_config,
+      &fields[10]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = guards_v4(view->guards, &fields[11]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = required_guards_v4(view->required_guards, &fields[12]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = redeemers_v4(view, resolved_inputs, script_hashes, &fields[13]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_data(view->datums, &fields[14]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = votes_v4(view->votes, &fields[15]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = proposal_procedures_v4(view->proposals, &fields[16]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = maybe_coin(view->has_treasury ? &view->treasury : NULL, &fields[17]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(view->donation, &fields[18]);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Appends the items of an encoded list to a plutus-data list.
+ */
+static cardano_error_t
+append_list_items(cardano_plutus_list_t* target, cardano_plutus_data_t* source)
+{
+  cardano_plutus_list_t* items  = NULL;
+  cardano_error_t        result = cardano_plutus_data_to_list(source, &items);
+  const size_t           count  = (result == CARDANO_SUCCESS) ? cardano_plutus_list_get_length(items) : 0U;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_plutus_data_t* item = NULL;
+
+    result = cardano_plutus_list_get(items, i, &item);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(target, item);
+    }
+
+    cardano_plutus_data_unref(&item);
+  }
+
+  cardano_plutus_list_unref(&items);
+
+  return result;
+}
+
+/**
+ * \brief Releases the aggregates of a whole transaction.
+ */
+static void
+batch_free(batch_t* batch)
+{
+  cardano_plutus_list_unref(&batch->sub_tx_infos);
+  cardano_plutus_list_unref(&batch->ids);
+  cardano_plutus_list_unref(&batch->inputs);
+  cardano_plutus_list_unref(&batch->reference_inputs);
+  cardano_plutus_list_unref(&batch->outputs);
+  cardano_plutus_list_unref(&batch->certificates);
+  cardano_plutus_list_unref(&batch->guards);
+  cardano_plutus_list_unref(&batch->proposals);
+  sorted_map_free(&batch->guard_datums);
+  sorted_map_free(&batch->mints);
+  sorted_map_free(&batch->burns);
+  sorted_map_free(&batch->withdrawals);
+  sorted_map_free(&batch->direct_deposits);
+  sorted_map_free(&batch->required_guards);
+  sorted_map_free(&batch->redeemer_hashes);
+  sorted_map_free(&batch->datums);
+  sorted_map_free(&batch->votes);
+  cardano_bigint_unref(&batch->donations);
+}
+
+/**
+ * \brief Prepares empty aggregates for a whole transaction.
+ */
+static cardano_error_t
+batch_init(batch_t* batch)
+{
+  CARDANO_UNUSED(memset(batch, 0, sizeof(batch_t)));
+
+  cardano_plutus_list_t** lists[] = {
+    &batch->sub_tx_infos,
+    &batch->ids,
+    &batch->inputs,
+    &batch->reference_inputs,
+    &batch->outputs,
+    &batch->certificates,
+    &batch->guards,
+    &batch->proposals
+  };
+
+  cardano_error_t result = cardano_bigint_from_unsigned_int(0U, &batch->donations);
+
+  for (size_t i = 0U; (i < (sizeof(lists) / sizeof(lists[0]))) && (result == CARDANO_SUCCESS); ++i)
+  {
+    result = cardano_plutus_list_new(lists[i]);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Records the datum a transaction level supplies to the running guard, keyed by the level's id.
+ *
+ * A level supplies a datum when its required top-level guards hold the guard
+ * credential with a datum.
+ */
+static cardano_error_t
+batch_add_guard_datum(batch_t* batch, const tx_view_t* view, cardano_plutus_data_t* id, cardano_plutus_data_t* guard)
+{
+  const size_t    count  = (view->required_guards != NULL) ? cardano_required_guards_map_get_length(view->required_guards) : 0U;
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    cardano_credential_t*  credential    = NULL;
+    cardano_plutus_data_t* datum         = NULL;
+    cardano_plutus_data_t* credential_pd = NULL;
+
+    result = cardano_required_guards_map_get_key_value_at(view->required_guards, i, &credential, &datum);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_credential(credential, &credential_pd);
+    }
+
+    if ((result == CARDANO_SUCCESS) && (datum != NULL) && cardano_plutus_data_equals(credential_pd, guard))
+    {
+      sort_key_t key;
+
+      key.size = 0U;
+
+      sort_key_append_hash(&key, view->id);
+
+      result = sorted_map_put(&batch->guard_datums, &key, id, NULL, datum, NULL, MERGE_KEEP_FIRST);
+    }
+
+    cardano_credential_unref(&credential);
+    cardano_plutus_data_unref(&datum);
+    cardano_plutus_data_unref(&credential_pd);
+  }
+
+  return result;
+}
+
+/**
+ * \brief Narrows the batch validity interval to its intersection with a transaction level's interval.
+ */
+static void
+batch_add_validity(batch_t* batch, const tx_view_t* view)
+{
+  if (view->has_invalid_before)
+  {
+    batch->lower     = (batch->has_lower && (batch->lower > view->invalid_before)) ? batch->lower : view->invalid_before;
+    batch->has_lower = true;
+  }
+
+  if (view->has_invalid_after)
+  {
+    batch->upper     = (batch->has_upper && (batch->upper < view->invalid_after)) ? batch->upper : view->invalid_after;
+    batch->has_upper = true;
+  }
+}
+
+/**
+ * \brief Keeps the first current treasury amount any transaction level of the batch states.
+ */
+static void
+batch_add_treasury(batch_t* batch, const tx_view_t* view)
+{
+  if (view->has_treasury && !batch->has_treasury)
+  {
+    batch->treasury     = view->treasury;
+    batch->has_treasury = true;
+  }
+}
+
+/**
+ * \brief Adds a transaction level to the aggregates of the whole transaction.
+ *
+ * The id, inputs, reference inputs, outputs, certificates, guards and proposals
+ * fields of the level are aggregated as they are.
+ *
+ * \param[in] batch The aggregates.
+ * \param[in] view The transaction level, added after the levels before it.
+ * \param[in] fields The encoded TxInfo fields of the level.
+ * \param[in] guard The encoded credential of the running guard.
+ */
+static cardano_error_t
+batch_add(batch_t* batch, tx_view_t* view, cardano_plutus_data_t** fields, cardano_plutus_data_t* guard)
+{
+  static const size_t TX_INFO_V4_ID_FIELD         = 0U;
+  static const size_t TX_INFO_V4_INPUTS_FIELD     = 2U;
+  static const size_t TX_INFO_V4_REF_INPUTS_FIELD = 3U;
+  static const size_t TX_INFO_V4_OUTPUTS_FIELD    = 4U;
+  static const size_t TX_INFO_V4_CERTS_FIELD      = 6U;
+  static const size_t TX_INFO_V4_GUARDS_FIELD     = 11U;
+  static const size_t TX_INFO_V4_PROPOSALS_FIELD  = 16U;
+
+  cardano_bigint_t* donation = NULL;
+  cardano_error_t   result   = cardano_plutus_list_add(batch->ids, fields[TX_INFO_V4_ID_FIELD]);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = append_list_items(batch->inputs, fields[TX_INFO_V4_INPUTS_FIELD]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = append_list_items(batch->reference_inputs, fields[TX_INFO_V4_REF_INPUTS_FIELD]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = append_list_items(batch->outputs, fields[TX_INFO_V4_OUTPUTS_FIELD]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = append_list_items(batch->certificates, fields[TX_INFO_V4_CERTS_FIELD]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = append_list_items(batch->guards, fields[TX_INFO_V4_GUARDS_FIELD]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = append_list_items(batch->proposals, fields[TX_INFO_V4_PROPOSALS_FIELD]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = put_assets(&batch->mints, view->mint, ASSETS_POSITIVE);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = put_assets(&batch->burns, view->mint, ASSETS_NEGATIVE);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = put_withdrawals(&batch->withdrawals, view->withdrawals);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = put_direct_deposits(&batch->direct_deposits, view->direct_deposits);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = put_required_guards(&batch->required_guards, view->required_guards);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = put_datums(&batch->datums, view->datums);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = put_votes(&batch->votes, view->votes);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = batch_add_guard_datum(batch, view, fields[TX_INFO_V4_ID_FIELD], guard);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_bigint_from_unsigned_int(view->donation, &donation);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_bigint_add(batch->donations, donation, batch->donations);
+    batch_add_validity(batch, view);
+    batch_add_treasury(batch, view);
+  }
+
+  cardano_bigint_unref(&donation);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the TopTxInfoSimplified of the whole transaction from its aggregates.
+ */
+static cardano_error_t
+top_tx_info_simplified_v4(batch_t* batch, const cardano_slot_config_t* slot_config, cardano_plutus_data_t** out)
+{
+  cardano_plutus_data_t* fields[TOP_TX_INFO_SIMPLIFIED_FIELD_COUNT] = { NULL };
+  cardano_error_t        result                                     = cardano_plutus_data_new_list(batch->ids, &fields[0]);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(batch->inputs, &fields[1]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(batch->reference_inputs, &fields[2]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(batch->outputs, &fields[3]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode_nested(&batch->mints, &fields[4]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode_nested(&batch->burns, &fields[5]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(batch->certificates, &fields[6]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&batch->withdrawals, &fields[7]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&batch->direct_deposits, &fields[8]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = time_range_v4(batch->has_lower ? &batch->lower : NULL, batch->has_upper ? &batch->upper : NULL, slot_config, &fields[9]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(batch->guards, &fields[10]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode_keys(&batch->required_guards, &fields[11]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode_keys(&batch->redeemer_hashes, &fields[12]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&batch->datums, &fields[13]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode_nested(&batch->votes, &fields[14]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(batch->proposals, &fields[15]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = maybe_coin(batch->has_treasury ? &batch->treasury : NULL, &fields[16]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer(batch->donations, &fields[17]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_list(fields, TOP_TX_INFO_SIMPLIFIED_FIELD_COUNT, out);
+  }
+
+  unref_all(fields, TOP_TX_INFO_SIMPLIFIED_FIELD_COUNT);
+
+  return result;
+}
+
+/**
+ * \brief Adds every sub-transaction of a transaction to the aggregates, in body order.
+ *
+ * Each sub-transaction contributes its own TxInfo, whose sub-transaction index
+ * is its position in the body.
+ */
+static cardano_error_t
+batch_add_sub_transactions(
+  batch_t*                     batch,
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_plutus_data_t*       guard)
+{
+  cardano_transaction_body_t*    body   = cardano_transaction_get_body(tx);
+  cardano_sub_transaction_set_t* subs   = cardano_transaction_body_get_sub_transactions(body);
+  const size_t                   count  = (subs != NULL) ? cardano_sub_transaction_set_get_length(subs) : 0U;
+  cardano_error_t                result = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; (i < count) && (result == CARDANO_SUCCESS); ++i)
+  {
+    tx_view_t              view;
+    cardano_plutus_data_t* fields[TX_INFO_V4_FIELD_COUNT] = { NULL };
+    cardano_plutus_data_t* info                           = NULL;
+
+    result = tx_view_from_sub_transaction(tx, (uint64_t)i, &view);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = tx_info_fields_v4(&view, resolved_inputs, slot_config, &batch->redeemer_hashes, fields);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = encode_list(fields, TX_INFO_V4_FIELD_COUNT, &info);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = cardano_plutus_list_add(batch->sub_tx_infos, info);
+    }
+
+    if (result == CARDANO_SUCCESS)
+    {
+      result = batch_add(batch, &view, fields, guard);
+    }
+
+    tx_view_release(&view);
+    unref_all(fields, TX_INFO_V4_FIELD_COUNT);
+    cardano_plutus_data_unref(&info);
+  }
+
+  cardano_sub_transaction_set_unref(&subs);
+  cardano_transaction_body_unref(&body);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the TopTxInfo a guard running at the top level receives.
+ *
+ * The record is the list [sub-transaction TxInfos, guard datums by transaction
+ * id, starting account balance intervals, TopTxInfoSimplified]. The aggregates
+ * take the sub-transactions in body order followed by the top-level
+ * transaction.
+ *
+ * \param[in] batch The aggregates, already holding the redeemer script hashes of the top level.
+ * \param[in] tx The top-level transaction.
+ * \param[in] top The view of the top-level transaction.
+ * \param[in] top_fields The encoded TxInfo fields of the top-level transaction.
+ * \param[in] resolved_inputs The outputs spent or referenced by the whole transaction.
+ * \param[in] slot_config The slot configuration of the network.
+ * \param[in] guard The encoded credential of the running guard.
+ * \param[out] out The encoded TopTxInfo.
+ */
+static cardano_error_t
+top_tx_info_v4(
+  batch_t*                     batch,
+  cardano_transaction_t*       tx,
+  tx_view_t*                   top,
+  cardano_plutus_data_t**      top_fields,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_plutus_data_t*       guard,
+  cardano_plutus_data_t**      out)
+{
+  cardano_transaction_body_t*              body                            = cardano_transaction_get_body(tx);
+  cardano_account_balance_intervals_map_t* starting                        = cardano_transaction_body_get_starting_account_balance_intervals(body);
+  cardano_plutus_data_t*                   fields[TOP_TX_INFO_FIELD_COUNT] = { NULL };
+  cardano_error_t                          result                          = batch_add_sub_transactions(batch, tx, resolved_inputs, slot_config, guard);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = batch_add(batch, top, top_fields, guard);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_list(batch->sub_tx_infos, &fields[0]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = sorted_map_encode(&batch->guard_datums, &fields[1]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = balance_intervals_v4(starting, &fields[2]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = top_tx_info_simplified_v4(batch, slot_config, &fields[3]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_list(fields, TOP_TX_INFO_FIELD_COUNT, out);
+  }
+
+  unref_all(fields, TOP_TX_INFO_FIELD_COUNT);
+  cardano_account_balance_intervals_map_unref(&starting);
+  cardano_transaction_body_unref(&body);
+
+  return result;
+}
+
+/**
+ * \brief Encodes the V4 ScriptInfo of resolved purpose parts.
+ *
+ * Spending scripts also receive their optional datum and guards their optional
+ * TopTxInfo; every other script receives the purpose items as they are.
+ */
+static cardano_error_t
+script_info_v4(const purpose_parts_t* parts, cardano_plutus_data_t* extra, cardano_plutus_data_t** out)
+{
+  cardano_plutus_data_t* fields[PURPOSE_MAX_ITEMS + 1U] = { NULL };
+  size_t                 count                          = parts->item_count;
+
+  for (size_t i = 0U; i < parts->item_count; ++i)
+  {
+    fields[i] = parts->items[i];
+  }
+
+  if (extra != NULL)
+  {
+    fields[count] = extra;
+    ++count;
+  }
+
+  return encode_variant(parts->alternative, fields, count, out);
+}
+
+/**
+ * \brief Builds the V4 ScriptContext list [TxInfo, redeemer, ScriptInfo, script hash] of a transaction level.
+ */
+static cardano_error_t
+script_context_v4(
+  cardano_transaction_t*       tx,
+  tx_view_t*                   view,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_redeemer_t*          redeemer,
+  cardano_plutus_data_t*       datum,
+  cardano_plutus_data_t**      script_context)
+{
+  const cardano_redeemer_tag_t tag                                    = cardano_redeemer_get_tag(redeemer);
+  const bool                   with_top                               = (tag == CARDANO_REDEEMER_TAG_GUARDING) && !view->is_sub_tx;
+  cardano_plutus_data_t*       tx_fields[TX_INFO_V4_FIELD_COUNT]      = { NULL };
+  cardano_plutus_data_t*       context[SCRIPT_CONTEXT_V4_FIELD_COUNT] = { NULL };
+  cardano_plutus_data_t*       top                                    = NULL;
+  cardano_plutus_data_t*       extra                                  = NULL;
+  purpose_parts_t              parts;
+  batch_t                      batch;
+
+  CARDANO_UNUSED(memset(&parts, 0, sizeof(purpose_parts_t)));
+
+  cardano_error_t result = batch_init(&batch);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = resolve_purpose(view, resolved_inputs, tag, cardano_redeemer_get_index(redeemer), &parts);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = tx_info_fields_v4(view, resolved_inputs, slot_config, with_top ? &batch.redeemer_hashes : NULL, tx_fields);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_list(tx_fields, TX_INFO_V4_FIELD_COUNT, &context[0]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    context[1] = cardano_redeemer_get_data(redeemer);
+    result     = (context[1] != NULL) ? CARDANO_SUCCESS : CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if ((result == CARDANO_SUCCESS) && with_top)
+  {
+    result = top_tx_info_v4(&batch, tx, view, tx_fields, resolved_inputs, slot_config, parts.guard, &top);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (tag == CARDANO_REDEEMER_TAG_SPEND))
+  {
+    result = encode_maybe(datum, &extra);
+  }
+
+  if ((result == CARDANO_SUCCESS) && (tag == CARDANO_REDEEMER_TAG_GUARDING))
+  {
+    result = encode_maybe(top, &extra);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = script_info_v4(&parts, extra, &context[2]);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_ref(parts.script_hash);
+    context[3] = parts.script_hash;
+
+    result = encode_list(context, SCRIPT_CONTEXT_V4_FIELD_COUNT, script_context);
+  }
+
+  batch_free(&batch);
+  purpose_parts_release(&parts);
+  unref_all(tx_fields, TX_INFO_V4_FIELD_COUNT);
+  unref_all(context, SCRIPT_CONTEXT_V4_FIELD_COUNT);
+  cardano_plutus_data_unref(&top);
+  cardano_plutus_data_unref(&extra);
+
+  return result;
+}
+
+/* PUBLIC FUNCTIONS **********************************************************/
+
+cardano_error_t
+cardano_uplc_int_build_tx_info_v1(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_plutus_data_t**      tx_info)
+{
+  return build_tx_info(tx, resolved_inputs, slot_config, false, tx_info);
+}
+
+cardano_error_t
+cardano_uplc_int_build_tx_info_v2(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_plutus_data_t**      tx_info)
+{
+  return build_tx_info(tx, resolved_inputs, slot_config, true, tx_info);
+}
+
+cardano_error_t
+cardano_uplc_int_build_script_purpose_v1v2(
+  cardano_transaction_t*     tx,
+  const cardano_utxo_list_t* resolved_inputs,
+  cardano_redeemer_t*        redeemer,
+  cardano_plutus_data_t**    purpose)
+{
+  if ((tx == NULL) || (resolved_inputs == NULL) || (redeemer == NULL) || (purpose == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t*  body   = cardano_transaction_get_body(tx);
+  const cardano_redeemer_tag_t tag    = cardano_redeemer_get_tag(redeemer);
+  const uint64_t               index  = cardano_redeemer_get_index(redeemer);
+  cardano_error_t              result = CARDANO_SUCCESS;
+
+  switch (tag)
+  {
+    case CARDANO_REDEEMER_TAG_MINT:
+    {
+      cardano_multi_asset_t*    mint     = cardano_transaction_body_get_mint(body);
+      cardano_policy_id_list_t* policies = NULL;
+
+      result = (mint != NULL) ? cardano_multi_asset_get_keys(mint, &policies) : CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+
+      if ((result == CARDANO_SUCCESS) && (index >= cardano_policy_id_list_get_length(policies)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_t* policy_id = NULL;
+        cardano_plutus_data_t*  pd        = NULL;
+
+        result = cardano_policy_id_list_get(policies, (size_t)index, &policy_id);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = hash_bytes(policy_id, &pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = wrap_constr(CONSTR_0, pd, purpose);
+        }
+
+        cardano_blake2b_hash_unref(&policy_id);
+        cardano_plutus_data_unref(&pd);
+      }
+
+      cardano_multi_asset_unref(&mint);
+      cardano_policy_id_list_unref(&policies);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_SPEND:
+    {
+      cardano_transaction_input_set_t* inputs = cardano_transaction_body_get_inputs(body);
+
+      if ((inputs == NULL) || (index >= cardano_transaction_input_set_get_length(inputs)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_transaction_input_t* input  = NULL;
+        cardano_plutus_data_t*       ref_pd = NULL;
+
+        result = cardano_transaction_input_set_get(inputs, (size_t)index, &input);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = out_ref_wrapped(input, &ref_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = wrap_constr(CONSTR_1, ref_pd, purpose);
+        }
+
+        cardano_transaction_input_unref(&input);
+        cardano_plutus_data_unref(&ref_pd);
+      }
+
+      cardano_transaction_input_set_unref(&inputs);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_REWARD:
+    {
+      cardano_withdrawal_map_t* withdrawals = cardano_transaction_body_get_withdrawals(body);
+      cardano_plutus_data_t*    cred_pd     = NULL;
+      cardano_plutus_data_t*    wrapped     = NULL;
+
+      result = indexed_withdrawal(withdrawals, index, &cred_pd);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_0, cred_pd, &wrapped);
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_2, wrapped, purpose);
+      }
+
+      cardano_withdrawal_map_unref(&withdrawals);
+      cardano_plutus_data_unref(&cred_pd);
+      cardano_plutus_data_unref(&wrapped);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_CERTIFYING:
+    {
+      cardano_certificate_set_t* certificates = cardano_transaction_body_get_certificates(body);
+
+      if ((certificates == NULL) || (index >= cardano_certificate_set_get_length(certificates)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_certificate_t* certificate = NULL;
+        cardano_plutus_data_t* cert_pd     = NULL;
+
+        result = cardano_certificate_set_get(certificates, (size_t)index, &certificate);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_certificate(certificate, &cert_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = wrap_constr(CONSTR_3, cert_pd, purpose);
+        }
+
+        cardano_certificate_unref(&certificate);
+        cardano_plutus_data_unref(&cert_pd);
+      }
+
+      cardano_certificate_set_unref(&certificates);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_VOTING:
+    case CARDANO_REDEEMER_TAG_PROPOSING:
+    case CARDANO_REDEEMER_TAG_GUARDING:
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  cardano_transaction_body_unref(&body);
+
+  return result;
+}
+
+/**
+ * \brief Wraps a TxInfo and the redeemer purpose into the V1/V2 ScriptContext.
+ */
+static cardano_error_t
+build_script_context(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_redeemer_t*          redeemer,
+  const bool                   is_v2,
+  cardano_plutus_data_t**      script_context)
+{
+  if ((tx == NULL) || (resolved_inputs == NULL) || (slot_config == NULL) || (redeemer == NULL) || (script_context == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_list_t* fields  = NULL;
+  cardano_plutus_data_t* tx_info = NULL;
+  cardano_plutus_data_t* purpose = NULL;
+  cardano_error_t        result  = cardano_plutus_list_new(&fields);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = build_tx_info(tx, resolved_inputs, slot_config, is_v2, &tx_info);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, tx_info);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_int_build_script_purpose_v1v2(tx, resolved_inputs, redeemer, &purpose);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, purpose);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, script_context);
+  }
+
+  cardano_plutus_data_unref(&tx_info);
+  cardano_plutus_data_unref(&purpose);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+cardano_error_t
+cardano_uplc_int_build_script_context_v1(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_redeemer_t*          redeemer,
+  cardano_plutus_data_t**      script_context)
+{
+  return build_script_context(tx, resolved_inputs, slot_config, redeemer, false, script_context);
+}
+
+cardano_error_t
+cardano_uplc_int_build_script_context_v2(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_redeemer_t*          redeemer,
+  cardano_plutus_data_t**      script_context)
+{
+  return build_script_context(tx, resolved_inputs, slot_config, redeemer, true, script_context);
+}
+
+cardano_error_t
+cardano_uplc_int_build_tx_info_v3(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_plutus_data_t**      tx_info)
+{
+  if ((tx == NULL) || (resolved_inputs == NULL) || (slot_config == NULL) || (tx_info == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t* body        = cardano_transaction_get_body(tx);
+  cardano_witness_set_t*      witness_set = cardano_transaction_get_witness_set(tx);
+  cardano_plutus_list_t*      fields      = NULL;
+  cardano_error_t             result      = cardano_plutus_list_new(&fields);
+
+  cardano_transaction_input_set_t*   inputs     = NULL;
+  cardano_transaction_input_set_t*   ref_inputs = NULL;
+  cardano_transaction_output_list_t* outputs    = NULL;
+  cardano_multi_asset_t*             mint       = NULL;
+  cardano_certificate_set_t*         certs      = NULL;
+  cardano_withdrawal_map_t*          withdraws  = NULL;
+  cardano_blake2b_hash_set_t*        signers    = NULL;
+  cardano_plutus_data_set_t*         datums     = NULL;
+  cardano_redeemer_list_t*           redeemers  = NULL;
+  cardano_voting_procedures_t*       votes      = NULL;
+  cardano_proposal_procedure_set_t*  proposals  = NULL;
+  cardano_blake2b_hash_t*            tx_id      = NULL;
+
+  cardano_plutus_data_t* inputs_pd   = NULL;
+  cardano_plutus_data_t* refs_pd     = NULL;
+  cardano_plutus_data_t* outputs_pd  = NULL;
+  cardano_plutus_data_t* fee_pd      = NULL;
+  cardano_plutus_data_t* mint_pd     = NULL;
+  cardano_plutus_data_t* certs_pd    = NULL;
+  cardano_plutus_data_t* with_pd     = NULL;
+  cardano_plutus_data_t* range_pd    = NULL;
+  cardano_plutus_data_t* signs_pd    = NULL;
+  cardano_plutus_data_t* redeem_pd   = NULL;
+  cardano_plutus_data_t* data_pd     = NULL;
+  cardano_plutus_data_t* id_pd       = NULL;
+  cardano_plutus_data_t* votes_pd    = NULL;
+  cardano_plutus_data_t* props_pd    = NULL;
+  cardano_plutus_data_t* treasury_pd = NULL;
+  cardano_plutus_data_t* donation_pd = NULL;
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = guard_dijkstra_features_v1v3(body);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    inputs = cardano_transaction_body_get_inputs(body);
+    result = inputs_v3(inputs, resolved_inputs, &inputs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, inputs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    ref_inputs = cardano_transaction_body_get_reference_inputs(body);
+    result     = inputs_v3(ref_inputs, resolved_inputs, &refs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, refs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    outputs = cardano_transaction_body_get_outputs(body);
+    result  = outputs_v3(outputs, &outputs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, outputs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_data_new_integer_from_uint(cardano_transaction_body_get_fee(body), &fee_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, fee_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    mint   = cardano_transaction_body_get_mint(body);
+    result = mint_plain(mint, &mint_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, mint_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    certs  = cardano_transaction_body_get_certificates(body);
+    result = certificates_v3(certs, &certs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, certs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    withdraws = cardano_transaction_body_get_withdrawals(body);
+    result    = withdrawals_v3(withdraws, &with_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, with_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = valid_range(body, slot_config, &range_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, range_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    signers = cardano_transaction_body_get_required_signers(body);
+    result  = encode_signatories(signers, &signs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, signs_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    redeemers = cardano_witness_set_get_redeemers(witness_set);
+    result    = redeemers_map_v3(tx, resolved_inputs, redeemers, &redeem_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, redeem_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    datums = cardano_witness_set_get_plutus_data(witness_set);
+    result = encode_data(datums, &data_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, data_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    tx_id  = cardano_transaction_get_id(tx);
+    result = (tx_id != NULL) ? hash_bytes(tx_id, &id_pd) : CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, id_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    votes  = cardano_transaction_body_get_voting_procedures(body);
+    result = encode_votes(votes, &votes_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, votes_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    proposals = cardano_transaction_body_get_proposal_procedures(body);
+    result    = encode_proposal_procedures(proposals, &props_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, props_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = maybe_coin(cardano_transaction_body_get_treasury_value(body), &treasury_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, treasury_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = maybe_coin(cardano_transaction_body_get_donation(body), &donation_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, donation_pd);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, tx_info);
+  }
+
+  cardano_transaction_body_unref(&body);
+  cardano_witness_set_unref(&witness_set);
+  cardano_transaction_input_set_unref(&inputs);
+  cardano_transaction_input_set_unref(&ref_inputs);
+  cardano_transaction_output_list_unref(&outputs);
+  cardano_multi_asset_unref(&mint);
+  cardano_certificate_set_unref(&certs);
+  cardano_withdrawal_map_unref(&withdraws);
+  cardano_blake2b_hash_set_unref(&signers);
+  cardano_plutus_data_set_unref(&datums);
+  cardano_redeemer_list_unref(&redeemers);
+  cardano_voting_procedures_unref(&votes);
+  cardano_proposal_procedure_set_unref(&proposals);
+  cardano_blake2b_hash_unref(&tx_id);
+
+  cardano_plutus_data_unref(&inputs_pd);
+  cardano_plutus_data_unref(&refs_pd);
+  cardano_plutus_data_unref(&outputs_pd);
+  cardano_plutus_data_unref(&fee_pd);
+  cardano_plutus_data_unref(&mint_pd);
+  cardano_plutus_data_unref(&certs_pd);
+  cardano_plutus_data_unref(&with_pd);
+  cardano_plutus_data_unref(&range_pd);
+  cardano_plutus_data_unref(&signs_pd);
+  cardano_plutus_data_unref(&redeem_pd);
+  cardano_plutus_data_unref(&data_pd);
+  cardano_plutus_data_unref(&id_pd);
+  cardano_plutus_data_unref(&votes_pd);
+  cardano_plutus_data_unref(&props_pd);
+  cardano_plutus_data_unref(&treasury_pd);
+  cardano_plutus_data_unref(&donation_pd);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+static cardano_error_t
+script_info_v3(
+  cardano_transaction_t*     tx,
+  const cardano_utxo_list_t* resolved_inputs,
+  cardano_redeemer_t*        redeemer,
+  cardano_plutus_data_t*     datum,
+  const bool                 with_datum,
+  cardano_plutus_data_t**    script_info)
+{
+  if ((tx == NULL) || (resolved_inputs == NULL) || (redeemer == NULL) || (script_info == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_transaction_body_t*  body   = cardano_transaction_get_body(tx);
+  const cardano_redeemer_tag_t tag    = cardano_redeemer_get_tag(redeemer);
+  const uint64_t               index  = cardano_redeemer_get_index(redeemer);
+  cardano_error_t              result = CARDANO_SUCCESS;
+
+  switch (tag)
+  {
+    case CARDANO_REDEEMER_TAG_MINT:
+    {
+      cardano_multi_asset_t*    mint     = cardano_transaction_body_get_mint(body);
+      cardano_policy_id_list_t* policies = NULL;
+
+      result = (mint != NULL) ? cardano_multi_asset_get_keys(mint, &policies) : CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+
+      if ((result == CARDANO_SUCCESS) && (index >= cardano_policy_id_list_get_length(policies)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_blake2b_hash_t* policy_id = NULL;
+        cardano_plutus_data_t*  pd        = NULL;
+
+        result = cardano_policy_id_list_get(policies, (size_t)index, &policy_id);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = hash_bytes(policy_id, &pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = wrap_constr(CONSTR_0, pd, script_info);
+        }
+
+        cardano_blake2b_hash_unref(&policy_id);
+        cardano_plutus_data_unref(&pd);
+      }
+
+      cardano_multi_asset_unref(&mint);
+      cardano_policy_id_list_unref(&policies);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_SPEND:
+    {
+      cardano_transaction_input_set_t* inputs = cardano_transaction_body_get_inputs(body);
+
+      if ((inputs == NULL) || (index >= cardano_transaction_input_set_get_length(inputs)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_transaction_input_t* input    = NULL;
+        cardano_plutus_data_t*       ref_pd   = NULL;
+        cardano_plutus_data_t*       datum_pd = NULL;
+        cardano_plutus_list_t*       sfields  = NULL;
+
+        result = cardano_transaction_input_set_get(inputs, (size_t)index, &input);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = out_ref_v3(input, &ref_pd);
+        }
+
+        if (!with_datum)
+        {
+          if (result == CARDANO_SUCCESS)
+          {
+            result = wrap_constr(CONSTR_1, ref_pd, script_info);
+          }
+        }
+        else
+        {
+          if (result == CARDANO_SUCCESS)
+          {
+            result = encode_maybe(datum, &datum_pd);
+          }
+
+          if (result == CARDANO_SUCCESS)
+          {
+            result = cardano_plutus_list_new(&sfields);
+          }
+
+          if (result == CARDANO_SUCCESS)
+          {
+            result = cardano_plutus_list_add(sfields, ref_pd);
+          }
+
+          if (result == CARDANO_SUCCESS)
+          {
+            result = cardano_plutus_list_add(sfields, datum_pd);
+          }
+
+          if (result == CARDANO_SUCCESS)
+          {
+            result = encode_constr(CONSTR_1, sfields, script_info);
+          }
+        }
+
+        cardano_transaction_input_unref(&input);
+        cardano_plutus_data_unref(&ref_pd);
+        cardano_plutus_data_unref(&datum_pd);
+        cardano_plutus_list_unref(&sfields);
+      }
+
+      cardano_transaction_input_set_unref(&inputs);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_REWARD:
+    {
+      cardano_withdrawal_map_t* withdrawals = cardano_transaction_body_get_withdrawals(body);
+      cardano_plutus_data_t*    cred_pd     = NULL;
+
+      result = indexed_withdrawal(withdrawals, index, &cred_pd);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_2, cred_pd, script_info);
+      }
+
+      cardano_withdrawal_map_unref(&withdrawals);
+      cardano_plutus_data_unref(&cred_pd);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_CERTIFYING:
+    {
+      cardano_certificate_set_t* certificates = cardano_transaction_body_get_certificates(body);
+
+      if ((certificates == NULL) || (index >= cardano_certificate_set_get_length(certificates)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_certificate_t* certificate = NULL;
+        cardano_plutus_data_t* idx_pd      = NULL;
+        cardano_plutus_data_t* cert_pd     = NULL;
+
+        result = cardano_certificate_set_get(certificates, (size_t)index, &certificate);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_data_new_integer_from_uint(index, &idx_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = certificate_v3(certificate, &cert_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = constr_two(CONSTR_3, idx_pd, cert_pd, script_info);
+        }
+
+        cardano_certificate_unref(&certificate);
+        cardano_plutus_data_unref(&idx_pd);
+        cardano_plutus_data_unref(&cert_pd);
+      }
+
+      cardano_certificate_set_unref(&certificates);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_VOTING:
+    {
+      cardano_voting_procedures_t* procedures = cardano_transaction_body_get_voting_procedures(body);
+      cardano_plutus_data_t*       voter_pd   = NULL;
+
+      result = indexed_voter(procedures, index, &voter_pd);
+
+      if (result == CARDANO_SUCCESS)
+      {
+        result = wrap_constr(CONSTR_4, voter_pd, script_info);
+      }
+
+      cardano_voting_procedures_unref(&procedures);
+      cardano_plutus_data_unref(&voter_pd);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_PROPOSING:
+    {
+      cardano_proposal_procedure_set_t* proposals = cardano_transaction_body_get_proposal_procedures(body);
+
+      if ((proposals == NULL) || (index >= cardano_proposal_procedure_set_get_length(proposals)))
+      {
+        result = CARDANO_ERROR_INDEX_OUT_OF_BOUNDS;
+      }
+
+      if (result == CARDANO_SUCCESS)
+      {
+        cardano_proposal_procedure_t* proposal = NULL;
+        cardano_plutus_data_t*        idx_pd   = NULL;
+        cardano_plutus_data_t*        prop_pd  = NULL;
+
+        result = cardano_proposal_procedure_set_get(proposals, (size_t)index, &proposal);
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = cardano_plutus_data_new_integer_from_uint(index, &idx_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = encode_proposal_procedure(proposal, &prop_pd);
+        }
+
+        if (result == CARDANO_SUCCESS)
+        {
+          result = constr_two(CONSTR_5, idx_pd, prop_pd, script_info);
+        }
+
+        cardano_proposal_procedure_unref(&proposal);
+        cardano_plutus_data_unref(&idx_pd);
+        cardano_plutus_data_unref(&prop_pd);
+      }
+
+      cardano_proposal_procedure_set_unref(&proposals);
+
+      break;
+    }
+    case CARDANO_REDEEMER_TAG_GUARDING:
+    default:
+    {
+      result = CARDANO_ERROR_INVALID_ARGUMENT;
+      break;
+    }
+  }
+
+  cardano_transaction_body_unref(&body);
+
+  return result;
+}
+
+cardano_error_t
+cardano_uplc_int_build_script_info_v3(
+  cardano_transaction_t*  tx,
+  cardano_utxo_list_t*    resolved_inputs,
+  cardano_redeemer_t*     redeemer,
+  cardano_plutus_data_t*  datum,
+  cardano_plutus_data_t** script_info)
+{
+  return script_info_v3(tx, resolved_inputs, redeemer, datum, true, script_info);
+}
+
+cardano_error_t
+cardano_uplc_int_build_script_context_v3(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_redeemer_t*          redeemer,
+  cardano_plutus_data_t*       datum,
+  cardano_plutus_data_t**      script_context)
+{
+  if ((tx == NULL) || (resolved_inputs == NULL) || (slot_config == NULL) || (redeemer == NULL) || (script_context == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_list_t* fields      = NULL;
+  cardano_plutus_data_t* tx_info     = NULL;
+  cardano_plutus_data_t* redeemer_pd = NULL;
+  cardano_plutus_data_t* info        = NULL;
+  cardano_error_t        result      = cardano_plutus_list_new(&fields);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_int_build_tx_info_v3(tx, resolved_inputs, slot_config, &tx_info);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, tx_info);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    redeemer_pd = cardano_redeemer_get_data(redeemer);
+    result      = (redeemer_pd != NULL) ? cardano_plutus_list_add(fields, redeemer_pd) : CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_uplc_int_build_script_info_v3(tx, resolved_inputs, redeemer, datum, &info);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = cardano_plutus_list_add(fields, info);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_constr(CONSTR_0, fields, script_context);
+  }
+
+  cardano_plutus_data_unref(&tx_info);
+  cardano_plutus_data_unref(&redeemer_pd);
+  cardano_plutus_data_unref(&info);
+  cardano_plutus_list_unref(&fields);
+
+  return result;
+}
+
+cardano_error_t
+cardano_uplc_int_build_tx_info_v4(
+  cardano_transaction_t*       tx,
+  const uint64_t*              sub_tx_index,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_plutus_data_t**      tx_info)
+{
+  if ((tx == NULL) || (resolved_inputs == NULL) || (slot_config == NULL) || (tx_info == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  tx_view_t              view;
+  cardano_plutus_data_t* fields[TX_INFO_V4_FIELD_COUNT] = { NULL };
+  cardano_error_t        result                         = tx_view_read(tx, sub_tx_index, &view);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = tx_info_fields_v4(&view, resolved_inputs, slot_config, NULL, fields);
+  }
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = encode_list(fields, TX_INFO_V4_FIELD_COUNT, tx_info);
+  }
+
+  tx_view_release(&view);
+  unref_all(fields, TX_INFO_V4_FIELD_COUNT);
+
+  return result;
+}
+
+cardano_error_t
+cardano_uplc_int_build_script_context_v4(
+  cardano_transaction_t*       tx,
+  const uint64_t*              sub_tx_index,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_redeemer_t*          redeemer,
+  cardano_plutus_data_t*       datum,
+  cardano_plutus_data_t**      script_context)
+{
+  if ((tx == NULL) || (resolved_inputs == NULL) || (slot_config == NULL) || (redeemer == NULL) || (script_context == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  tx_view_t       view;
+  cardano_error_t result = tx_view_read(tx, sub_tx_index, &view);
+
+  if (result == CARDANO_SUCCESS)
+  {
+    result = script_context_v4(tx, &view, resolved_inputs, slot_config, redeemer, datum, script_context);
+  }
+
+  tx_view_release(&view);
+
+  return result;
+}
diff --git a/vendor/src/uplc/tx/script_context.h b/vendor/src/uplc/tx/script_context.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/tx/script_context.h
@@ -0,0 +1,373 @@
+/**
+ * \file script_context.h
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_UPLC_TX_SCRIPT_CONTEXT_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_UPLC_TX_SCRIPT_CONTEXT_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/utxo_list.h>
+#include <cardano/error.h>
+#include <cardano/plutus_data/plutus_data.h>
+#include <cardano/slot_config.h>
+#include <cardano/transaction/transaction.h>
+#include <cardano/witness_set/redeemer.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Converts an absolute slot to its beginning POSIX time, in milliseconds.
+ *
+ * Computes \c zero_time + (slot - zero_slot) * slot_length, the inclusive start of
+ * the slot. A slot earlier than \c zero_slot has no representable time and is
+ * rejected. This is the single implementation of the conversion used to derive the
+ * validity-interval bounds of the script-context \c TxInfo from the transaction's
+ * validity slots, and is consensus-critical: a wrong time changes which validity
+ * range a script sees. A slot before the slot-config origin is rejected.
+ *
+ * \param[in] slot_config The slot configuration (\c zero_time, \c zero_slot and
+ *            \c slot_length). Must not be NULL.
+ * \param[in] slot The absolute slot number to convert.
+ * \param[out] posix_time On success, set to the beginning POSIX time in
+ *             milliseconds; left untouched on failure.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_POINTER_IS_NULL if
+ *         \p slot_config or \p posix_time is NULL, or
+ *         \ref CARDANO_ERROR_INVALID_ARGUMENT if \p slot is earlier than
+ *         \c zero_slot.
+ */
+cardano_error_t
+cardano_uplc_int_slot_to_posix_time(
+  const cardano_slot_config_t* slot_config,
+  uint64_t                     slot,
+  uint64_t*                    posix_time);
+
+/**
+ * \brief Builds the Plutus V1 TxInfo of a transaction as Plutus data.
+ *
+ * The encoding is the V1 TxInfo plutus-data: a constructor with index 0 whose
+ * fields are (inputs, outputs, fee, mint, dcert, withdrawals, valid range,
+ * signatories, datums, transaction id). Inputs and outputs carry the legacy
+ * datum-hash-only output shape and the wrapped transaction id.
+ *
+ * \param[in] tx The transaction to translate. Must not be NULL.
+ * \param[in] resolved_inputs The UTxO set resolving every spent input. Must not
+ *            be NULL. A reference-input section in \p tx is rejected, matching
+ *            the V1 ledger rules.
+ * \param[in] slot_config The slot/time parameters used to convert the validity
+ *            interval slots to POSIX time. Must not be NULL.
+ * \param[out] tx_info On success, the newly created TxInfo data. The caller owns
+ *             it and must release it with \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         when \p tx carries a field the V1 and V2 contexts cannot represent
+ *         (votes, proposals, a current treasury value, a treasury donation,
+ *         direct deposits, account balance intervals, required top-level guards
+ *         or a script-hash guard), or an error code otherwise.
+ */
+cardano_error_t
+cardano_uplc_int_build_tx_info_v1(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_plutus_data_t**      tx_info);
+
+/**
+ * \brief Builds the Plutus V2 TxInfo of a transaction as Plutus data.
+ *
+ * As \ref cardano_uplc_int_build_tx_info_v1, but for the V2 shape: it adds the
+ * reference inputs, keeps inline datums and reference scripts in outputs,
+ * carries the redeemers as a map keyed by script purpose, and exposes the full
+ * datum witnesses as a map. The constructor index is 0.
+ *
+ * \param[in] tx The transaction to translate. Must not be NULL.
+ * \param[in] resolved_inputs The UTxO set resolving inputs and reference inputs.
+ *            Must not be NULL.
+ * \param[in] slot_config The slot/time parameters. Must not be NULL.
+ * \param[out] tx_info On success, the newly created TxInfo data, owned by the
+ *             caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code otherwise.
+ */
+cardano_error_t
+cardano_uplc_int_build_tx_info_v2(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_plutus_data_t**      tx_info);
+
+/**
+ * \brief Builds the script purpose of a redeemer as Plutus data, in the V1/V2 shape.
+ *
+ * The purpose is resolved by looking up the redeemer tag and index against the
+ * sorted inputs, mint policies, certificates and withdrawals of \p tx, then
+ * encoded as the wrapped-transaction-id ScriptPurpose: Minting =>
+ * Constr 0 [policy id], Spending => Constr 1 [out ref], Rewarding => Constr 2
+ * [wrapped stake credential], Certifying => Constr 3 [certificate].
+ *
+ * \param[in] tx The transaction. Must not be NULL.
+ * \param[in] resolved_inputs The UTxO set resolving the inputs. Must not be NULL.
+ * \param[in] redeemer The redeemer whose purpose is requested. Must not be NULL.
+ * \param[out] purpose On success, the newly created purpose data, owned by the
+ *             caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code otherwise.
+ */
+cardano_error_t
+cardano_uplc_int_build_script_purpose_v1v2(
+  cardano_transaction_t*     tx,
+  const cardano_utxo_list_t* resolved_inputs,
+  cardano_redeemer_t*        redeemer,
+  cardano_plutus_data_t**    purpose);
+
+/**
+ * \brief Builds the complete Plutus V1 ScriptContext of a redeemer as Plutus data.
+ *
+ * The result is the V1/V2 ScriptContext plutus-data: a constructor with index 0
+ * whose fields are the V1 TxInfo and the script purpose.
+ *
+ * \param[in] tx The transaction. Must not be NULL.
+ * \param[in] resolved_inputs The UTxO set resolving the inputs. Must not be NULL.
+ * \param[in] slot_config The slot/time parameters. Must not be NULL.
+ * \param[in] redeemer The redeemer for which the context is built. Must not be NULL.
+ * \param[out] script_context On success, the newly created ScriptContext data,
+ *             owned by the caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code otherwise.
+ */
+cardano_error_t
+cardano_uplc_int_build_script_context_v1(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_redeemer_t*          redeemer,
+  cardano_plutus_data_t**      script_context);
+
+/**
+ * \brief Builds the complete Plutus V2 ScriptContext of a redeemer as Plutus data.
+ *
+ * As \ref cardano_uplc_int_build_script_context_v1 but using the V2 TxInfo.
+ *
+ * \param[in] tx The transaction. Must not be NULL.
+ * \param[in] resolved_inputs The UTxO set resolving the inputs. Must not be NULL.
+ * \param[in] slot_config The slot/time parameters. Must not be NULL.
+ * \param[in] redeemer The redeemer for which the context is built. Must not be NULL.
+ * \param[out] script_context On success, the newly created ScriptContext data,
+ *             owned by the caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code otherwise.
+ */
+cardano_error_t
+cardano_uplc_int_build_script_context_v2(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_redeemer_t*          redeemer,
+  cardano_plutus_data_t**      script_context);
+
+/**
+ * \brief Builds the Plutus V3 (Conway) TxInfo of a transaction as Plutus data.
+ *
+ * The encoding is the V3 TxInfo plutus-data. Compared to V2, V3 uses the
+ * unwrapped transaction id in
+ * inputs and the top-level id, encodes the fee as a bare lovelace integer
+ * (rather than a value map), encodes the mint as a signed-amount value without
+ * the synthetic zero-ada entry, keeps the withdrawals keyed by the full address
+ * (not a wrapped stake credential), encodes the certificates and the redeemer
+ * purposes in the Conway never-registration-deposit shape, and adds the
+ * Conway governance fields: votes, proposal procedures, the current treasury
+ * amount and the treasury donation.
+ *
+ * The constructor index is 0 and the field order is: inputs, reference inputs,
+ * outputs, fee, mint, certificates, withdrawals, validity range, signatories,
+ * redeemers, datums, transaction id, votes, proposal procedures, current
+ * treasury amount, treasury donation.
+ *
+ * \param[in] tx The transaction to translate. Must not be NULL.
+ * \param[in] resolved_inputs The UTxO set resolving inputs and reference inputs.
+ *            Must not be NULL.
+ * \param[in] slot_config The slot/time parameters. Must not be NULL.
+ * \param[out] tx_info On success, the newly created TxInfo data, owned by the
+ *             caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_INVALID_ARGUMENT
+ *         when \p tx carries a Dijkstra field the V3 context cannot represent
+ *         (direct deposits, account balance intervals, required top-level guards
+ *         or a script-hash guard), or an error code otherwise.
+ */
+cardano_error_t
+cardano_uplc_int_build_tx_info_v3(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_plutus_data_t**      tx_info);
+
+/**
+ * \brief Builds the V3 ScriptInfo of a redeemer as Plutus data.
+ *
+ * The ScriptInfo supersedes the V1/V2 ScriptPurpose. It is resolved by looking
+ * up the redeemer tag and index against the sorted inputs, mint policies,
+ * certificates, withdrawals, votes and proposal procedures of \p tx, then
+ * encoded as the never-registration-deposit ScriptInfo: Minting =>
+ * Constr 0 [policy id], Spending => Constr 1 [out ref (unwrapped), Maybe datum],
+ * Rewarding => Constr 2 [stake credential], Certifying => Constr 3 [index,
+ * certificate], Voting => Constr 4 [voter], Proposing => Constr 5 [index,
+ * proposal procedure].
+ *
+ * \param[in] tx The transaction. Must not be NULL.
+ * \param[in] resolved_inputs The UTxO set resolving the inputs. Must not be NULL.
+ * \param[in] redeemer The redeemer whose script info is requested. Must not be NULL.
+ * \param[in] datum The resolved spending datum, or NULL. Only used (and encoded
+ *            as a \c Maybe) for the Spending variant.
+ * \param[out] script_info On success, the newly created script info data, owned
+ *             by the caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code otherwise.
+ */
+cardano_error_t
+cardano_uplc_int_build_script_info_v3(
+  cardano_transaction_t*  tx,
+  cardano_utxo_list_t*    resolved_inputs,
+  cardano_redeemer_t*     redeemer,
+  cardano_plutus_data_t*  datum,
+  cardano_plutus_data_t** script_info);
+
+/**
+ * \brief Builds the complete Plutus V3 ScriptContext of a redeemer as Plutus data.
+ *
+ * The result is the V3 ScriptContext plutus-data: a constructor with index 0
+ * whose fields are the V3 TxInfo, the script's own redeemer data,
+ * and the V3 ScriptInfo (which, for the Spending purpose, carries the optional
+ * datum).
+ *
+ * \param[in] tx The transaction. Must not be NULL.
+ * \param[in] resolved_inputs The UTxO set resolving the inputs. Must not be NULL.
+ * \param[in] slot_config The slot/time parameters. Must not be NULL.
+ * \param[in] redeemer The redeemer for which the context is built. Must not be NULL.
+ * \param[in] datum The resolved spending datum, or NULL.
+ * \param[out] script_context On success, the newly created ScriptContext data,
+ *             owned by the caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or an error code otherwise.
+ */
+cardano_error_t
+cardano_uplc_int_build_script_context_v3(
+  cardano_transaction_t*       tx,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_redeemer_t*          redeemer,
+  cardano_plutus_data_t*       datum,
+  cardano_plutus_data_t**      script_context);
+
+/**
+ * \brief Builds the Plutus V4 (Dijkstra) TxInfo of a transaction level as Plutus data.
+ *
+ * A Dijkstra transaction runs scripts at two levels: the top-level transaction
+ * and each of its sub-transactions. Every level has its own TxInfo, built from
+ * that level's body and witness set.
+ *
+ * The V4 TxInfo is a plutus-data list (not a constructor) whose fields are: id,
+ * sub-transaction index (Nothing at the top level, Just the position of the
+ * sub-transaction otherwise), inputs, reference inputs, outputs, mint,
+ * certificates, withdrawals, direct deposits, account balance intervals,
+ * validity range, guards, required top-level guards, redeemers, datums, votes,
+ * proposal procedures, current treasury amount and treasury donation. Maps and
+ * sets follow the ledger key order.
+ *
+ * Fails when an input or output pays to a pointer, Byron or reward address, when
+ * a reference input is also spent, or when a certificate no longer exists in the
+ * Dijkstra era.
+ *
+ * \param[in] tx The top-level transaction. Must not be NULL.
+ * \param[in] sub_tx_index The position of the sub-transaction in the body of \p tx,
+ *            or NULL for the top-level transaction.
+ * \param[in] resolved_inputs The UTxO set resolving the inputs and reference inputs
+ *            of the level. Must not be NULL.
+ * \param[in] slot_config The slot/time parameters. Must not be NULL.
+ * \param[out] tx_info On success, the newly created TxInfo data, owned by the
+ *             caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_INDEX_OUT_OF_BOUNDS
+ *         when \p sub_tx_index points past the sub-transactions, or another error
+ *         code otherwise.
+ */
+cardano_error_t
+cardano_uplc_int_build_tx_info_v4(
+  cardano_transaction_t*       tx,
+  const uint64_t*              sub_tx_index,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_plutus_data_t**      tx_info);
+
+/**
+ * \brief Builds the complete Plutus V4 ScriptContext of a redeemer as Plutus data.
+ *
+ * The result is the plutus-data list [TxInfo, redeemer data, ScriptInfo, script
+ * hash] for the transaction level the redeemer belongs to. The redeemer index is
+ * resolved against that level, and the script hash is the one the ledger runs
+ * for the purpose.
+ *
+ * The ScriptInfo is Minting => Constr 0 [policy id], Spending => Constr 1
+ * [out ref, Maybe datum], Withdrawing => Constr 2 [credential], Certifying =>
+ * Constr 3 [index, certificate], Voting => Constr 4 [voter], Proposing =>
+ * Constr 5 [index, proposal procedure] and Guarding => Constr 6 [index, Maybe
+ * TopTxInfo]. A guard running at the top level receives Just the TopTxInfo,
+ * the view of the whole transaction with all its sub-transactions; a guard
+ * running in a sub-transaction receives Nothing.
+ *
+ * \param[in] tx The top-level transaction. Must not be NULL.
+ * \param[in] sub_tx_index The position of the sub-transaction the redeemer belongs
+ *            to, or NULL for a redeemer of the top-level transaction.
+ * \param[in] resolved_inputs The UTxO set resolving the inputs and reference inputs.
+ *            For a top-level guard it must resolve those of every sub-transaction
+ *            too. Must not be NULL.
+ * \param[in] slot_config The slot/time parameters. Must not be NULL.
+ * \param[in] redeemer The redeemer, taken from the witness set of its level. Must
+ *            not be NULL.
+ * \param[in] datum The resolved spending datum, or NULL. Only used for the
+ *            Spending purpose.
+ * \param[out] script_context On success, the newly created ScriptContext data,
+ *             owned by the caller.
+ *
+ * \return \ref CARDANO_SUCCESS on success, \ref CARDANO_ERROR_INDEX_OUT_OF_BOUNDS
+ *         when the sub-transaction or redeemer index is out of range,
+ *         \ref CARDANO_ERROR_ELEMENT_NOT_FOUND when the purpose is not run by a
+ *         script, or another error code otherwise.
+ */
+cardano_error_t
+cardano_uplc_int_build_script_context_v4(
+  cardano_transaction_t*       tx,
+  const uint64_t*              sub_tx_index,
+  cardano_utxo_list_t*         resolved_inputs,
+  const cardano_slot_config_t* slot_config,
+  cardano_redeemer_t*          redeemer,
+  cardano_plutus_data_t*       datum,
+  cardano_plutus_data_t**      script_context);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* BIGLUP_LABS_INCLUDE_CARDANO_UPLC_TX_SCRIPT_CONTEXT_H */
diff --git a/vendor/src/uplc/tx/uplc_apply_params.c b/vendor/src/uplc/tx/uplc_apply_params.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/uplc/tx/uplc_apply_params.c
@@ -0,0 +1,152 @@
+/**
+ * \file evaluator.c
+ *
+ * \author angel.castillo
+ * \date   Jun 19, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "../ast/uplc_program.h"
+#include "../ast/uplc_term.h"
+#include <cardano/uplc/uplc_apply_params.h>
+
+#include "../arena/uplc_arena.h"
+
+#include <stddef.h>
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Folds the elements of a plutus list onto a program, left to right.
+ *
+ * Applies \c list[0] first so it becomes the innermost argument, matching the
+ * application order of \c apply_params_to_script. Each element is borrowed from
+ * \p params with its own reference, handed to the apply step, then released; the
+ * apply step takes the arena's own reference, so the list keeps its contents.
+ *
+ * \param[in] arena The arena every new node is allocated from.
+ * \param[in] params The parameters to apply, or NULL to apply none.
+ * \param[in] program The program to wrap.
+ * \param[out] out On success, the parameterized program.
+ *
+ * \return \ref CARDANO_SUCCESS on success, or a propagated error.
+ */
+static cardano_error_t
+apply_param_list(
+  cardano_uplc_arena_t*          arena,
+  const cardano_plutus_list_t*   params,
+  const cardano_uplc_program_t*  program,
+  const cardano_uplc_program_t** out)
+{
+  const cardano_uplc_program_t* current = program;
+  size_t                        count   = 0U;
+  size_t                        i       = 0U;
+
+  if (params != NULL)
+  {
+    count = cardano_plutus_list_get_length(params);
+  }
+
+  for (i = 0U; i < count; ++i)
+  {
+    cardano_plutus_data_t*  param   = NULL;
+    cardano_uplc_program_t* applied = NULL;
+    cardano_error_t         get_res = cardano_plutus_list_get(params, i, &param);
+
+    if (get_res != CARDANO_SUCCESS)
+    {
+      return get_res;
+    }
+
+    cardano_error_t apply_res = cardano_uplc_program_apply_data(arena, current, param, &applied);
+
+    cardano_plutus_data_unref(&param);
+
+    if (apply_res != CARDANO_SUCCESS)
+    {
+      return apply_res;
+    }
+
+    current = applied;
+  }
+
+  *out = current;
+
+  return CARDANO_SUCCESS;
+}
+
+/* DEFINITIONS ***************************************************************/
+
+cardano_error_t
+cardano_uplc_apply_params_to_script(
+  const cardano_plutus_list_t* params,
+  const byte_t*                script_bytes,
+  size_t                       script_size,
+  cardano_buffer_t**           out_script)
+{
+  static const size_t kArenaBlockSize = 4096U;
+
+  cardano_uplc_arena_t*         arena   = NULL;
+  const cardano_uplc_program_t* program = NULL;
+  const cardano_uplc_program_t* applied = NULL;
+  cardano_buffer_t*             encoded = NULL;
+  cardano_error_t               result  = CARDANO_SUCCESS;
+
+  if ((out_script == NULL) || ((script_bytes == NULL) && (script_size != 0U)))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  result = cardano_uplc_arena_new(kArenaBlockSize, &arena);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  result = cardano_uplc_program_from_script_bytes(arena, script_bytes, script_size, &program);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_uplc_arena_free(&arena);
+
+    return result;
+  }
+
+  result = apply_param_list(arena, params, program, &applied);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_uplc_arena_free(&arena);
+
+    return result;
+  }
+
+  result = cardano_uplc_program_to_cbor(applied, &encoded);
+
+  cardano_uplc_arena_free(&arena);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  *out_script = encoded;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/voting_procedures/governance_action_id_list.c b/vendor/src/voting_procedures/governance_action_id_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/voting_procedures/governance_action_id_list.c
@@ -0,0 +1,278 @@
+/**
+ * \file governance_action_id_list.c
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/governance_action_id.h>
+#include <cardano/object.h>
+#include <cardano/voting_procedures/governance_action_id_list.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano governance action id list.
+ */
+typedef struct cardano_governance_action_id_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_governance_action_id_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a governance action id list object.
+ *
+ * This function is responsible for properly deallocating a governance action id list object (`cardano_governance_action_id_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the governance_action_id_list object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_governance_action_id_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the governance_action_id_list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_governance_action_id_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_governance_action_id_list_t* list = (cardano_governance_action_id_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_governance_action_id_list_new(cardano_governance_action_id_list_t** governance_action_id_list)
+{
+  if (governance_action_id_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_governance_action_id_list_t* list = _cardano_malloc(sizeof(cardano_governance_action_id_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_governance_action_id_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *governance_action_id_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_governance_action_id_list_get_length(const cardano_governance_action_id_list_t* governance_action_id_list)
+{
+  if (governance_action_id_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(governance_action_id_list->array);
+}
+
+cardano_error_t
+cardano_governance_action_id_list_get(
+  const cardano_governance_action_id_list_t* governance_action_id_list,
+  size_t                                     index,
+  cardano_governance_action_id_t**           element)
+{
+  if (governance_action_id_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(governance_action_id_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_governance_action_id_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_governance_action_id_list_add(cardano_governance_action_id_list_t* governance_action_id_list, cardano_governance_action_id_t* element)
+{
+  if (governance_action_id_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(governance_action_id_list->array);
+  const size_t new_size      = cardano_array_push(governance_action_id_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_governance_action_id_list_unref(cardano_governance_action_id_list_t** governance_action_id_list)
+{
+  if ((governance_action_id_list == NULL) || (*governance_action_id_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*governance_action_id_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *governance_action_id_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_governance_action_id_list_ref(cardano_governance_action_id_list_t* governance_action_id_list)
+{
+  if (governance_action_id_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&governance_action_id_list->base);
+}
+
+size_t
+cardano_governance_action_id_list_refcount(const cardano_governance_action_id_list_t* governance_action_id_list)
+{
+  if (governance_action_id_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&governance_action_id_list->base);
+}
+
+void
+cardano_governance_action_id_list_set_last_error(cardano_governance_action_id_list_t* governance_action_id_list, const char* message)
+{
+  cardano_object_set_last_error(&governance_action_id_list->base, message);
+}
+
+const char*
+cardano_governance_action_id_list_get_last_error(const cardano_governance_action_id_list_t* governance_action_id_list)
+{
+  return cardano_object_get_last_error(&governance_action_id_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_governance_action_id_t* copy   = NULL;
+  const cardano_error_t           result = cardano_governance_action_id_deep_clone((const cardano_governance_action_id_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_governance_action_id_list_deep_clone(const cardano_governance_action_id_list_t* source, cardano_governance_action_id_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_governance_action_id_list_t* copy = _cardano_malloc(sizeof(cardano_governance_action_id_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/voting_procedures/vote.c b/vendor/src/voting_procedures/vote.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/voting_procedures/vote.c
@@ -0,0 +1,50 @@
+/**
+ * \file vote.c
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/voting_procedures/vote.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_vote_to_string(const cardano_vote_t vote)
+{
+  const char* message;
+
+  switch (vote)
+  {
+    case CARDANO_VOTE_NO:
+      message = "Vote: No";
+      break;
+    case CARDANO_VOTE_YES:
+      message = "Vote: Yes";
+      break;
+    case CARDANO_VOTE_ABSTAIN:
+      message = "Vote: Abstain";
+      break;
+    default:
+      message = "Vote: Unknown";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/voting_procedures/voter.c b/vendor/src/voting_procedures/voter.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/voting_procedures/voter.c
@@ -0,0 +1,545 @@
+/**
+ * \file voter.c
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/voting_procedures/voter.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t VOTER_ARRAY_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano voter.
+ */
+typedef struct cardano_voter_t
+{
+    cardano_object_t      base;
+    cardano_voter_type_t  type;
+    cardano_credential_t* credential;
+} cardano_voter_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a voter object.
+ *
+ * This function is responsible for properly deallocating a voter object (`cardano_voter_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the voter object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_voter_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the voter
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_voter_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_voter_t* data = (cardano_voter_t*)object;
+
+  cardano_credential_unref(&data->credential);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_voter_new(const cardano_voter_type_t type, cardano_credential_t* credential, cardano_voter_t** voter)
+{
+  if (voter == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    *voter = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *voter = _cardano_malloc(sizeof(cardano_voter_t));
+
+  if (*voter == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*voter)->base.deallocator   = cardano_voter_deallocate;
+  (*voter)->base.ref_count     = 1;
+  (*voter)->base.last_error[0] = '\0';
+  (*voter)->type               = type;
+
+  cardano_credential_ref(credential);
+  (*voter)->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voter_from_cbor(cardano_cbor_reader_t* reader, cardano_voter_t** voter)
+{
+  if (voter == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    *voter = NULL;
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "Voter";
+
+  int64_t               array_size          = 0;
+  const cardano_error_t expect_array_result = cardano_cbor_reader_read_start_array(reader, &array_size);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    *voter = NULL;
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "voter_type",
+    reader,
+    &type,
+    CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_KEY_HASH,
+    CARDANO_VOTER_TYPE_STAKE_POOL_KEY_HASH);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    *voter = NULL;
+    return read_uint_result;
+  }
+
+  if (array_size < VOTER_ARRAY_SIZE)
+  {
+    cardano_cbor_reader_set_last_error(reader, "Voter: unexpected array size, expected 2");
+
+    *voter = NULL;
+    return CARDANO_ERROR_DECODING;
+  }
+
+  cardano_buffer_t*     credential_buffer        = NULL;
+  const cardano_error_t credential_buffer_result = cardano_cbor_reader_read_bytestring(reader, &credential_buffer);
+
+  if (credential_buffer_result != CARDANO_SUCCESS)
+  {
+    *voter = NULL;
+    return credential_buffer_result;
+  }
+
+  cardano_credential_t*     credential = NULL;
+  cardano_credential_type_t credential_type;
+
+  switch (type)
+  {
+    case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_KEY_HASH:
+    case CARDANO_VOTER_TYPE_DREP_KEY_HASH:
+    case CARDANO_VOTER_TYPE_STAKE_POOL_KEY_HASH:
+      credential_type = CARDANO_CREDENTIAL_TYPE_KEY_HASH;
+      break;
+    case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_SCRIPT_HASH:
+    case CARDANO_VOTER_TYPE_DREP_SCRIPT_HASH:
+      credential_type = CARDANO_CREDENTIAL_TYPE_SCRIPT_HASH;
+      break;
+
+    default:
+      cardano_buffer_unref(&credential_buffer);
+      *voter = NULL;
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  const cardano_error_t credential_result = cardano_credential_from_hash_bytes(
+    cardano_buffer_get_data(credential_buffer),
+    cardano_buffer_get_size(credential_buffer),
+    credential_type,
+    &credential);
+
+  cardano_buffer_unref(&credential_buffer);
+
+  if (credential_result != CARDANO_SUCCESS)
+  {
+    *voter = NULL;
+    return credential_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_credential_unref(&credential);
+    *voter = NULL;
+    return expect_end_array_result;
+  }
+
+  const cardano_error_t new_voter_result = cardano_voter_new((cardano_voter_type_t)type, credential, voter);
+  cardano_credential_unref(&credential);
+
+  if (new_voter_result != CARDANO_SUCCESS)
+  {
+    *voter = NULL;
+    return new_voter_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voter_to_cbor(
+  const cardano_voter_t* voter,
+  cardano_cbor_writer_t* writer)
+{
+  if (voter == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(writer, VOTER_ARRAY_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, voter->type);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  cardano_credential_t* credential = voter->credential;
+
+  cardano_error_t credential_result = cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_credential_get_hash_bytes(credential),
+    cardano_credential_get_hash_bytes_size(credential));
+
+  if (credential_result != CARDANO_SUCCESS)
+  {
+    return credential_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voter_to_cip116_json(
+  const cardano_voter_t* voter,
+  cardano_json_writer_t* writer)
+{
+  if ((voter == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+
+  switch (voter->type)
+  {
+    case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_KEY_HASH:
+    case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_SCRIPT_HASH:
+      cardano_json_writer_write_string(writer, "cc_credential", 13);
+      cardano_json_writer_write_property_name(writer, "credential", 10);
+
+      cardano_error_t cc_error = cardano_credential_to_cip116_json(voter->credential, writer);
+
+      if (cc_error != CARDANO_SUCCESS)
+      {
+        return cc_error;
+      }
+
+      break;
+    case CARDANO_VOTER_TYPE_DREP_KEY_HASH:
+    case CARDANO_VOTER_TYPE_DREP_SCRIPT_HASH:
+      cardano_json_writer_write_string(writer, "drep_credential", 15);
+      cardano_json_writer_write_property_name(writer, "credential", 10);
+
+      cardano_error_t drep_error = cardano_credential_to_cip116_json(voter->credential, writer);
+
+      if (drep_error != CARDANO_SUCCESS)
+      {
+        return drep_error;
+      }
+
+      break;
+    case CARDANO_VOTER_TYPE_STAKE_POOL_KEY_HASH:
+      cardano_json_writer_write_string(writer, "spo_keyhash", 11);
+      cardano_json_writer_write_property_name(writer, "pubkey_hash", 11);
+
+      cardano_blake2b_hash_t* hash = cardano_credential_get_hash(voter->credential);
+
+      cardano_error_t hash_error = cardano_blake2b_hash_to_cip116_json(hash, writer);
+      cardano_blake2b_hash_unref(&hash);
+
+      if (hash_error != CARDANO_SUCCESS)
+      {
+        return hash_error;
+      }
+
+      break;
+    default:
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_credential_t*
+cardano_voter_get_credential(cardano_voter_t* voter)
+{
+  if (voter == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_credential_ref(voter->credential);
+
+  return voter->credential;
+}
+
+cardano_error_t
+cardano_voter_set_credential(cardano_voter_t* voter, cardano_credential_t* credential)
+{
+  if (voter == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (credential == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_credential_ref(credential);
+  cardano_credential_unref(&voter->credential);
+  voter->credential = credential;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voter_get_type(const cardano_voter_t* voter, cardano_voter_type_t* type)
+{
+  if (voter == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (type == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *type = voter->type;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voter_set_type(cardano_voter_t* voter, const cardano_voter_type_t type)
+{
+  if (voter == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  voter->type = type;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_voter_equals(const cardano_voter_t* lhs, const cardano_voter_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return true;
+  }
+
+  if (lhs == NULL)
+  {
+    return false;
+  }
+
+  if (rhs == NULL)
+  {
+    return false;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return false;
+  }
+
+  return cardano_credential_equals(lhs->credential, rhs->credential);
+}
+
+int32_t
+cardano_voter_compare(
+  const cardano_voter_t* lhs,
+  const cardano_voter_t* rhs)
+{
+  if (lhs == rhs)
+  {
+    return 0;
+  }
+
+  if (lhs == NULL)
+  {
+    return -1;
+  }
+
+  if (rhs == NULL)
+  {
+    return 1;
+  }
+
+  if (lhs->type != rhs->type)
+  {
+    return (lhs->type < rhs->type) ? -1 : 1;
+  }
+
+  return cardano_credential_compare(lhs->credential, rhs->credential);
+}
+
+void
+cardano_voter_unref(cardano_voter_t** voter)
+{
+  if ((voter == NULL) || (*voter == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*voter)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *voter = NULL;
+    return;
+  }
+}
+
+void
+cardano_voter_ref(cardano_voter_t* voter)
+{
+  if (voter == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&voter->base);
+}
+
+size_t
+cardano_voter_refcount(const cardano_voter_t* voter)
+{
+  if (voter == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&voter->base);
+}
+
+void
+cardano_voter_set_last_error(cardano_voter_t* voter, const char* message)
+{
+  cardano_object_set_last_error(&voter->base, message);
+}
+
+const char*
+cardano_voter_get_last_error(const cardano_voter_t* voter)
+{
+  return cardano_object_get_last_error(&voter->base);
+}
+
+cardano_error_t
+cardano_voter_deep_clone(const cardano_voter_t* source, cardano_voter_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voter_t* copy = _cardano_malloc(sizeof(cardano_voter_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->type               = source->type;
+  copy->credential         = NULL;
+
+  if (source->credential != NULL)
+  {
+    const cardano_error_t result = cardano_credential_deep_clone(source->credential, &copy->credential);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/voting_procedures/voter_list.c b/vendor/src/voting_procedures/voter_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/voting_procedures/voter_list.c
@@ -0,0 +1,278 @@
+/**
+ * \file voter_list.c
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/voting_procedures/voter.h>
+#include <cardano/voting_procedures/voter_list.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano governance action id list.
+ */
+typedef struct cardano_voter_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_voter_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a governance action id list object.
+ *
+ * This function is responsible for properly deallocating a governance action id list object (`cardano_voter_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the voter_list object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_voter_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the voter_list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_voter_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_voter_list_t* list = (cardano_voter_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_voter_list_new(cardano_voter_list_t** voter_list)
+{
+  if (voter_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voter_list_t* list = _cardano_malloc(sizeof(cardano_voter_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_voter_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *voter_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_voter_list_get_length(const cardano_voter_list_t* voter_list)
+{
+  if (voter_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(voter_list->array);
+}
+
+cardano_error_t
+cardano_voter_list_get(
+  const cardano_voter_list_t* voter_list,
+  size_t                      index,
+  cardano_voter_t**           element)
+{
+  if (voter_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(voter_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_voter_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voter_list_add(cardano_voter_list_t* voter_list, cardano_voter_t* element)
+{
+  if (voter_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(voter_list->array);
+  const size_t new_size      = cardano_array_push(voter_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_voter_list_unref(cardano_voter_list_t** voter_list)
+{
+  if ((voter_list == NULL) || (*voter_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*voter_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *voter_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_voter_list_ref(cardano_voter_list_t* voter_list)
+{
+  if (voter_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&voter_list->base);
+}
+
+size_t
+cardano_voter_list_refcount(const cardano_voter_list_t* voter_list)
+{
+  if (voter_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&voter_list->base);
+}
+
+void
+cardano_voter_list_set_last_error(cardano_voter_list_t* voter_list, const char* message)
+{
+  cardano_object_set_last_error(&voter_list->base, message);
+}
+
+const char*
+cardano_voter_list_get_last_error(const cardano_voter_list_t* voter_list)
+{
+  return cardano_object_get_last_error(&voter_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_voter_t*      copy   = NULL;
+  const cardano_error_t result = cardano_voter_deep_clone((const cardano_voter_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_voter_list_deep_clone(const cardano_voter_list_t* source, cardano_voter_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voter_list_t* copy = _cardano_malloc(sizeof(cardano_voter_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/voting_procedures/voter_type.c b/vendor/src/voting_procedures/voter_type.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/voting_procedures/voter_type.c
@@ -0,0 +1,56 @@
+/**
+ * \file voter_type.c
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/voting_procedures/voter_type.h>
+
+/* DEFINITIONS ***************************************************************/
+
+const char*
+cardano_voter_type_to_string(const cardano_voter_type_t voter_type)
+{
+  const char* message;
+
+  switch (voter_type)
+  {
+    case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_KEY_HASH:
+      message = "Voter Type: Constitutional Committee Key Hash";
+      break;
+    case CARDANO_VOTER_TYPE_CONSTITUTIONAL_COMMITTEE_SCRIPT_HASH:
+      message = "Voter Type: Constitutional Committee Script Hash";
+      break;
+    case CARDANO_VOTER_TYPE_DREP_KEY_HASH:
+      message = "Voter Type: DRep Key Hash";
+      break;
+    case CARDANO_VOTER_TYPE_DREP_SCRIPT_HASH:
+      message = "Voter Type: DRep Script Hash";
+      break;
+    case CARDANO_VOTER_TYPE_STAKE_POOL_KEY_HASH:
+      message = "Voter Type: Stake Pool Key Hash";
+      break;
+    default:
+      message = "Voter Type: Unknown";
+      break;
+  }
+
+  return message;
+}
diff --git a/vendor/src/voting_procedures/voting_procedure.c b/vendor/src/voting_procedures/voting_procedure.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/voting_procedures/voting_procedure.c
@@ -0,0 +1,444 @@
+/**
+ * \file voting_procedure.c
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/common/anchor.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/voting_procedures/vote.h>
+#include <cardano/voting_procedures/voting_procedure.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Updates the DRep anchored metadata.
+ */
+typedef struct cardano_voting_procedure_t
+{
+    cardano_object_t  base;
+    cardano_vote_t    vote;
+    cardano_anchor_t* anchor;
+} cardano_voting_procedure_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a voting_procedure object.
+ *
+ * This function is responsible for properly deallocating a voting_procedure object (`cardano_voting_procedure_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the voting_procedure object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_voting_procedure_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the voting_procedure
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_voting_procedure_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_voting_procedure_t* data = (cardano_voting_procedure_t*)object;
+
+  cardano_anchor_unref(&data->anchor);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_voting_procedure_new(
+  const cardano_vote_t         vote,
+  cardano_anchor_t*            anchor,
+  cardano_voting_procedure_t** voting_procedure)
+{
+  if (voting_procedure == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedure_t* data = _cardano_malloc(sizeof(cardano_voting_procedure_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_voting_procedure_deallocate;
+
+  if (anchor != NULL)
+  {
+    cardano_anchor_ref(anchor);
+  }
+
+  data->anchor = anchor;
+  data->vote   = vote;
+
+  *voting_procedure = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voting_procedure_from_cbor(cardano_cbor_reader_t* reader, cardano_voting_procedure_t** voting_procedure)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (voting_procedure == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "voting_procedure";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  uint64_t              type             = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "voter_type",
+    reader,
+    &type,
+    CARDANO_VOTE_NO,
+    CARDANO_VOTE_ABSTAIN);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    return read_uint_result;
+  }
+
+  cardano_anchor_t* anchor = NULL;
+
+  cardano_cbor_reader_state_t state;
+
+  cardano_error_t read_state = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_state != CARDANO_SUCCESS)
+  {
+    return read_state;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_NULL)
+  {
+    cardano_error_t read_null = cardano_cbor_reader_read_null(reader);
+    CARDANO_UNUSED(read_null);
+  }
+  else
+  {
+    cardano_error_t read_anchor_result = cardano_anchor_from_cbor(reader, &anchor);
+
+    if (read_anchor_result != CARDANO_SUCCESS)
+    {
+      return read_anchor_result;
+    }
+  }
+
+  cardano_error_t new_result = cardano_voting_procedure_new((cardano_vote_t)type, anchor, voting_procedure);
+
+  cardano_anchor_unref(&anchor);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_voting_procedure_to_cbor(
+  const cardano_voting_procedure_t* voting_procedure,
+  cardano_cbor_writer_t*            writer)
+{
+  if (voting_procedure == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_uint_result = cardano_cbor_writer_write_uint(writer, voting_procedure->vote);
+
+  if (write_uint_result != CARDANO_SUCCESS)
+  {
+    return write_uint_result;
+  }
+
+  if (voting_procedure->anchor != NULL)
+  {
+    cardano_error_t write_anchor_result = cardano_anchor_to_cbor(voting_procedure->anchor, writer);
+
+    if (write_anchor_result != CARDANO_SUCCESS)
+    {
+      return write_anchor_result;
+    }
+  }
+  else
+  {
+    cardano_error_t write_null_result = cardano_cbor_writer_write_null(writer);
+
+    if (write_null_result != CARDANO_SUCCESS)
+    {
+      return write_null_result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voting_procedure_to_cip116_json(
+  const cardano_voting_procedure_t* procedure,
+  cardano_json_writer_t*            writer)
+{
+  if ((procedure == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_property_name(writer, "vote", 4);
+
+  switch (procedure->vote)
+  {
+    case CARDANO_VOTE_YES:
+      cardano_json_writer_write_string(writer, "yes", 3);
+      break;
+    case CARDANO_VOTE_NO:
+      cardano_json_writer_write_string(writer, "no", 2);
+      break;
+    case CARDANO_VOTE_ABSTAIN:
+      cardano_json_writer_write_string(writer, "abstain", 7);
+      break;
+    default:
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  if (procedure->anchor != NULL)
+  {
+    cardano_json_writer_write_property_name(writer, "anchor", 6);
+    error = cardano_anchor_to_cip116_json(procedure->anchor, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_vote_t
+cardano_voting_procedure_get_vote(const cardano_voting_procedure_t* voting_procedure)
+{
+  if (voting_procedure == NULL)
+  {
+    return CARDANO_VOTE_NO;
+  }
+
+  return voting_procedure->vote;
+}
+
+cardano_error_t
+cardano_voting_procedure_set_vote(
+  cardano_voting_procedure_t* voting_procedure,
+  const cardano_vote_t        vote)
+{
+  if (voting_procedure == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  voting_procedure->vote = vote;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_anchor_t*
+cardano_voting_procedure_get_anchor(cardano_voting_procedure_t* certificate)
+{
+  if (certificate == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_anchor_ref(certificate->anchor);
+
+  return certificate->anchor;
+}
+
+cardano_error_t
+cardano_voting_procedure_set_anchor(
+  cardano_voting_procedure_t* certificate,
+  cardano_anchor_t*           anchor)
+{
+  if (certificate == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (anchor == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_anchor_ref(anchor);
+  cardano_anchor_unref(&certificate->anchor);
+  certificate->anchor = anchor;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_voting_procedure_unref(cardano_voting_procedure_t** voting_procedure)
+{
+  if ((voting_procedure == NULL) || (*voting_procedure == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*voting_procedure)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *voting_procedure = NULL;
+    return;
+  }
+}
+
+void
+cardano_voting_procedure_ref(cardano_voting_procedure_t* voting_procedure)
+{
+  if (voting_procedure == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&voting_procedure->base);
+}
+
+size_t
+cardano_voting_procedure_refcount(const cardano_voting_procedure_t* voting_procedure)
+{
+  if (voting_procedure == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&voting_procedure->base);
+}
+
+void
+cardano_voting_procedure_set_last_error(cardano_voting_procedure_t* voting_procedure, const char* message)
+{
+  cardano_object_set_last_error(&voting_procedure->base, message);
+}
+
+const char*
+cardano_voting_procedure_get_last_error(const cardano_voting_procedure_t* voting_procedure)
+{
+  return cardano_object_get_last_error(&voting_procedure->base);
+}
+
+cardano_error_t
+cardano_voting_procedure_deep_clone(const cardano_voting_procedure_t* source, cardano_voting_procedure_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedure_t* copy = _cardano_malloc(sizeof(cardano_voting_procedure_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->vote               = source->vote;
+  copy->anchor             = NULL;
+
+  if (source->anchor != NULL)
+  {
+    const cardano_error_t result = cardano_anchor_deep_clone(source->anchor, &copy->anchor);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/voting_procedures/voting_procedure_list.c b/vendor/src/voting_procedures/voting_procedure_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/voting_procedures/voting_procedure_list.c
@@ -0,0 +1,279 @@
+/**
+ * \file voting_procedure_list.c
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/voting_procedures/voting_procedure.h>
+
+#include <cardano/voting_procedures/voting_procedure_list.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano governance action id list.
+ */
+typedef struct cardano_voting_procedure_list_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_voting_procedure_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a governance action id list object.
+ *
+ * This function is responsible for properly deallocating a governance action id list object (`cardano_voting_procedure_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the voting_procedure_list object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_voting_procedure_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the voting_procedure_list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_voting_procedure_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_voting_procedure_list_t* list = (cardano_voting_procedure_list_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_voting_procedure_list_new(cardano_voting_procedure_list_t** voting_procedure_list)
+{
+  if (voting_procedure_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedure_list_t* list = _cardano_malloc(sizeof(cardano_voting_procedure_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_voting_procedure_list_deallocate;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *voting_procedure_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_voting_procedure_list_get_length(const cardano_voting_procedure_list_t* voting_procedure_list)
+{
+  if (voting_procedure_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(voting_procedure_list->array);
+}
+
+cardano_error_t
+cardano_voting_procedure_list_get(
+  const cardano_voting_procedure_list_t* voting_procedure_list,
+  size_t                                 index,
+  cardano_voting_procedure_t**           element)
+{
+  if (voting_procedure_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(voting_procedure_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_voting_procedure_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voting_procedure_list_add(cardano_voting_procedure_list_t* voting_procedure_list, cardano_voting_procedure_t* element)
+{
+  if (voting_procedure_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(voting_procedure_list->array);
+  const size_t new_size      = cardano_array_push(voting_procedure_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_voting_procedure_list_unref(cardano_voting_procedure_list_t** voting_procedure_list)
+{
+  if ((voting_procedure_list == NULL) || (*voting_procedure_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*voting_procedure_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *voting_procedure_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_voting_procedure_list_ref(cardano_voting_procedure_list_t* voting_procedure_list)
+{
+  if (voting_procedure_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&voting_procedure_list->base);
+}
+
+size_t
+cardano_voting_procedure_list_refcount(const cardano_voting_procedure_list_t* voting_procedure_list)
+{
+  if (voting_procedure_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&voting_procedure_list->base);
+}
+
+void
+cardano_voting_procedure_list_set_last_error(cardano_voting_procedure_list_t* voting_procedure_list, const char* message)
+{
+  cardano_object_set_last_error(&voting_procedure_list->base, message);
+}
+
+const char*
+cardano_voting_procedure_list_get_last_error(const cardano_voting_procedure_list_t* voting_procedure_list)
+{
+  return cardano_object_get_last_error(&voting_procedure_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_voting_procedure_t* copy   = NULL;
+  const cardano_error_t       result = cardano_voting_procedure_deep_clone((const cardano_voting_procedure_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_voting_procedure_list_deep_clone(const cardano_voting_procedure_list_t* source, cardano_voting_procedure_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedure_list_t* copy = _cardano_malloc(sizeof(cardano_voting_procedure_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/voting_procedures/voting_procedure_map.c b/vendor/src/voting_procedures/voting_procedure_map.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/voting_procedures/voting_procedure_map.c
@@ -0,0 +1,627 @@
+/**
+ * \file voting_procedure_map.c
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/governance_action_id.h>
+#include <cardano/object.h>
+#include <cardano/voting_procedures/governance_action_id_list.h>
+#include <cardano/voting_procedures/voting_procedure.h>
+#include <cardano/voting_procedures/voting_procedure_list.h>
+
+#include "../allocators.h"
+#include "../collections/array.h"
+#include "voting_procedure_map.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano voting_procedure map.
+ */
+typedef struct cardano_voting_procedure_map_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_voting_procedure_map_t;
+
+/**
+ * \brief Represents a Cardano voting_procedure map key value pair.
+ */
+typedef struct cardano_voting_procedure_map_kvp_t
+{
+    cardano_object_t                base;
+    cardano_governance_action_id_t* key;
+    cardano_voting_procedure_t*     value;
+} cardano_voting_procedure_map_kvp_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a voting_procedure map object.
+ *
+ * This function is responsible for properly deallocating a voting_procedure map object (`cardano_voting_procedure_map_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the voting_procedure_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_voting_procedure_map_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the voting_procedure_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_voting_procedure_map_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_voting_procedure_map_t* map = (cardano_voting_procedure_map_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a voting_procedure map key value pair object.
+ *
+ * This function is responsible for properly deallocating a voting_procedure map key value pair object (`cardano_voting_procedure_map_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the voting_procedure_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_voting_procedure_map_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the voting_procedure_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_voting_procedure_map_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_voting_procedure_map_kvp_t* map = (cardano_voting_procedure_map_kvp_t*)object;
+
+  if (map->key != NULL)
+  {
+    cardano_governance_action_id_unref(&map->key);
+  }
+
+  if (map->value != NULL)
+  {
+    cardano_voting_procedure_unref(&map->value);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two cardano_voting_procedure_map_kvp_t objects based on their governance action id.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the governance action id of lhs is less than the governance action id of rhs, zero if they are equal,
+ *         and a positive value if the governance action id of lhs is greater than the governance action id of rhs.
+ */
+static int32_t
+compare_by_governance_action_id(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_voting_procedure_map_kvp_t* lhs_kvp = (const cardano_voting_procedure_map_kvp_t*)((const void*)lhs);
+  const cardano_voting_procedure_map_kvp_t* rhs_kvp = (const cardano_voting_procedure_map_kvp_t*)((const void*)rhs);
+
+  const size_t lhs_size = cardano_governance_action_id_get_hash_bytes_size(lhs_kvp->key);
+  const size_t rhs_size = cardano_governance_action_id_get_hash_bytes_size(rhs_kvp->key);
+
+  if (lhs_size != rhs_size)
+  {
+    return (lhs_size < rhs_size) ? -1 : 1;
+  }
+
+  const uint8_t* lhs_bytes   = cardano_governance_action_id_get_hash_bytes(lhs_kvp->key);
+  const uint8_t* rhs_bytes   = cardano_governance_action_id_get_hash_bytes(rhs_kvp->key);
+  const int32_t  comp_result = memcmp(lhs_bytes, rhs_bytes, lhs_size);
+
+  if (comp_result != 0)
+  {
+    return comp_result;
+  }
+
+  uint64_t lhs_gov_action_index = 0;
+  uint64_t rhs_gov_action_index = 0;
+
+  cardano_error_t result = cardano_governance_action_id_get_index(lhs_kvp->key, &lhs_gov_action_index);
+  CARDANO_UNUSED(result);
+
+  result = cardano_governance_action_id_get_index(rhs_kvp->key, &rhs_gov_action_index);
+  CARDANO_UNUSED(result);
+
+  if (lhs_gov_action_index == rhs_gov_action_index)
+  {
+    return 0;
+  }
+
+  return (lhs_gov_action_index < rhs_gov_action_index) ? -1 : 1;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_voting_procedure_map_new(cardano_voting_procedure_map_t** voting_procedure_map)
+{
+  if (voting_procedure_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedure_map_t* map = _cardano_malloc(sizeof(cardano_voting_procedure_map_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_voting_procedure_map_deallocate;
+
+  map->array = cardano_array_new(128);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *voting_procedure_map = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voting_procedure_map_to_cip116_json(
+  const cardano_voting_procedure_map_t* map,
+  cardano_json_writer_t*                writer)
+{
+  if ((map == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t array_size = cardano_array_get_size(map->array);
+
+  for (size_t i = 0; i < array_size; ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(map->array, i);
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    cardano_voting_procedure_map_kvp_t* kvp_data = (cardano_voting_procedure_map_kvp_t*)((void*)kvp);
+
+    cardano_json_writer_write_start_object(writer);
+
+    cardano_json_writer_write_property_name(writer, "key", 3);
+    cardano_error_t error = cardano_governance_action_id_to_cip116_json(kvp_data->key, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return error;
+    }
+
+    cardano_json_writer_write_property_name(writer, "value", 5);
+    error = cardano_voting_procedure_to_cip116_json(kvp_data->value, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return error;
+    }
+
+    cardano_json_writer_write_end_object(writer);
+    cardano_object_unref(&kvp);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_voting_procedure_map_get_length(const cardano_voting_procedure_map_t* voting_procedure_map)
+{
+  if (voting_procedure_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(voting_procedure_map->array);
+}
+
+cardano_error_t
+cardano_voting_procedure_map_get(
+  cardano_voting_procedure_map_t* voting_procedure_map,
+  cardano_governance_action_id_t* key,
+  cardano_voting_procedure_t**    element)
+{
+  if (voting_procedure_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(voting_procedure_map->array); ++i)
+  {
+    cardano_object_t*                   object = cardano_array_get(voting_procedure_map->array, i);
+    cardano_voting_procedure_map_kvp_t* kvp    = (cardano_voting_procedure_map_kvp_t*)((void*)object);
+
+    if (cardano_governance_action_id_equals(kvp->key, key))
+    {
+      cardano_voting_procedure_ref(kvp->value);
+      *element = kvp->value;
+
+      cardano_object_unref(&object);
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_voting_procedure_map_insert(
+  cardano_voting_procedure_map_t* voting_procedure_map,
+  cardano_governance_action_id_t* key,
+  cardano_voting_procedure_t*     value)
+{
+  if (voting_procedure_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (key == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedure_map_kvp_t* kvp = _cardano_malloc(sizeof(cardano_voting_procedure_map_kvp_t));
+
+  if (kvp == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_voting_procedure_map_kvp_deallocate;
+  kvp->key                = key;
+  kvp->value              = value;
+
+  cardano_governance_action_id_ref(key);
+  cardano_voting_procedure_ref(value);
+
+  const size_t old_size = cardano_array_get_size(voting_procedure_map->array);
+  const size_t new_size = cardano_array_push(voting_procedure_map->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_voting_procedure_map_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(voting_procedure_map->array, compare_by_governance_action_id, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voting_procedure_map_get_keys(
+  cardano_voting_procedure_map_t*       voting_procedure_map,
+  cardano_governance_action_id_list_t** keys)
+{
+  if (voting_procedure_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (keys == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_governance_action_id_list_t* list = NULL;
+
+  cardano_error_t result = cardano_governance_action_id_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(voting_procedure_map->array); ++i)
+  {
+    cardano_object_t*                   object = cardano_array_get(voting_procedure_map->array, i);
+    cardano_voting_procedure_map_kvp_t* kvp    = (cardano_voting_procedure_map_kvp_t*)((void*)object);
+
+    result = cardano_governance_action_id_list_add(list, kvp->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_governance_action_id_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *keys = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voting_procedure_map_get_values(
+  cardano_voting_procedure_map_t*   voting_procedure_map,
+  cardano_voting_procedure_list_t** values)
+{
+  if (voting_procedure_map == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (values == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedure_list_t* list = NULL;
+
+  cardano_error_t result = cardano_voting_procedure_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(voting_procedure_map->array); ++i)
+  {
+    cardano_object_t*                   object = cardano_array_get(voting_procedure_map->array, i);
+    cardano_voting_procedure_map_kvp_t* kvp    = (cardano_voting_procedure_map_kvp_t*)((void*)object);
+
+    result = cardano_voting_procedure_list_add(list, kvp->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_voting_procedure_list_unref(&list);
+      cardano_object_unref(&object);
+      return result;
+    }
+
+    cardano_object_unref(&object);
+  }
+
+  *values = list;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_voting_procedure_map_unref(cardano_voting_procedure_map_t** voting_procedure_map)
+{
+  if ((voting_procedure_map == NULL) || (*voting_procedure_map == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*voting_procedure_map)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *voting_procedure_map = NULL;
+    return;
+  }
+}
+
+void
+cardano_voting_procedure_map_ref(cardano_voting_procedure_map_t* voting_procedure_map)
+{
+  if (voting_procedure_map == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&voting_procedure_map->base);
+}
+
+size_t
+cardano_voting_procedure_map_refcount(const cardano_voting_procedure_map_t* voting_procedure_map)
+{
+  if (voting_procedure_map == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&voting_procedure_map->base);
+}
+
+void
+cardano_voting_procedure_map_set_last_error(cardano_voting_procedure_map_t* voting_procedure_map, const char* message)
+{
+  cardano_object_set_last_error(&voting_procedure_map->base, message);
+}
+
+const char*
+cardano_voting_procedure_map_get_last_error(const cardano_voting_procedure_map_t* voting_procedure_map)
+{
+  return cardano_object_get_last_error(&voting_procedure_map->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_voting_procedure_map_kvp_deep_clone(const cardano_voting_procedure_map_kvp_t* source, cardano_voting_procedure_map_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedure_map_kvp_t* copy = _cardano_malloc(sizeof(cardano_voting_procedure_map_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = NULL;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_governance_action_id_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_voting_procedure_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_voting_procedure_map_kvp_t* copy   = NULL;
+  const cardano_error_t               result = cardano_voting_procedure_map_kvp_deep_clone((const cardano_voting_procedure_map_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+cardano_error_t
+cardano_voting_procedure_map_deep_clone(const cardano_voting_procedure_map_t* source, cardano_voting_procedure_map_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedure_map_t* copy = _cardano_malloc(sizeof(cardano_voting_procedure_map_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/voting_procedures/voting_procedure_map.h b/vendor/src/voting_procedures/voting_procedure_map.h
new file mode 100644
--- /dev/null
+++ b/vendor/src/voting_procedures/voting_procedure_map.h
@@ -0,0 +1,436 @@
+/**
+ * \file voting_procedure_map.h
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURE_MAP_H
+#define BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURE_MAP_H
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/common/governance_action_id.h>
+#include <cardano/error.h>
+#include <cardano/export.h>
+#include <cardano/voting_procedures/governance_action_id_list.h>
+#include <cardano/voting_procedures/voting_procedure.h>
+#include <cardano/voting_procedures/voting_procedure_list.h>
+
+/* DECLARATIONS **************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * \brief Represents a map of voting procedure.
+ */
+typedef struct cardano_voting_procedure_map_t cardano_voting_procedure_map_t;
+
+/**
+ * \brief Creates and initializes a new instance of a voting procedure map.
+ *
+ * This function allocates and initializes a new instance of \ref cardano_voting_procedure_map_t,
+ * representing a map structure. It returns an error code to indicate the success or failure of the operation.
+ *
+ * \param[out] voting_procedure_map A pointer to a pointer to a \ref cardano_voting_procedure_map_t object. Upon successful
+ *                        initialization, this will point to a newly created \ref cardano_voting_procedure_map_t
+ *                        object. This object represents a "strong reference" to the voting_procedure_map,
+ *                        fully initialized and ready for use. The caller is responsible for managing
+ *                        the lifecycle of this object. Specifically, once the voting_procedure_map is no longer
+ *                        needed, the caller must release it by calling \ref cardano_voting_procedure_map_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the voting_procedure_map was successfully created, or an appropriate error code
+ *         indicating the failure reason.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_map_t* voting_procedure_map = NULL;
+ *
+ * // Attempt to create a new voting_procedure_map
+ * cardano_error_t result = cardano_voting_procedure_map_new(&voting_procedure_map);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the voting_procedure_map
+ *
+ *   // Once done, ensure to clean up and release the voting_procedure_map
+ *   cardano_voting_procedure_map_unref(&voting_procedure_map);
+ * }
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t
+cardano_voting_procedure_map_new(cardano_voting_procedure_map_t** voting_procedure_map);
+
+/**
+ * \brief Serializes a voting procedure map to a CIP-116 JSON array.
+ *
+ * This function serializes a map of [GovActionId -> VotingProcedure] into
+ * a JSON array of key-value objects.
+ *
+ * \param[in]  map     Pointer to a valid \ref cardano_voting_procedure_map_t.
+ * \param[in]  writer  Pointer to a valid \ref cardano_json_writer_t.
+ *
+ * \return CARDANO_SUCCESS       On success.
+ * CARDANO_ERROR_POINTER_IS_NULL If \p map or \p writer is NULL.
+ * Other                         Any error propagated from nested writers.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedure_map_to_cip116_json(
+  const cardano_voting_procedure_map_t* map,
+  cardano_json_writer_t*                writer);
+
+/**
+ * \brief Retrieves the length of the voting_procedure_map.
+ *
+ * This function returns the number of key-value pairs contained in the specified voting_procedure_map.
+ *
+ * \param[in] voting_procedure_map A constant pointer to the \ref cardano_voting_procedure_map_t object for which
+ *                       the length is to be retrieved.
+ *
+ * \return The number of key-value pairs in the voting_procedure_map. Returns 0 if the voting_procedure_map is NULL.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_map_t* voting_procedure_map = cardano_voting_procedure_map_new();
+ *
+ * // Populate the voting_procedure_map with key-value pairs
+ *
+ * size_t length = cardano_voting_procedure_map_get_length(voting_procedure_map);
+ * printf("The length of the voting_procedure_map is: %zu\n", length);
+ *
+ * cardano_voting_procedure_map_unref(&voting_procedure_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_voting_procedure_map_get_length(const cardano_voting_procedure_map_t* voting_procedure_map);
+
+/**
+ * \brief Retrieves the value associated with a given key in the voting procedure map.
+ *
+ * This function retrieves the value associated with the specified key in the provided voting procedure map.
+ * It returns the value through the output parameter `element`. If the key is not found in the voting procedure map,
+ * the output parameter `element` will be set to NULL.
+ *
+ * \param[in] voting_procedure_map A constant pointer to the \ref cardano_voting_procedure_map_t object from which
+ *                       the value is to be retrieved.
+ * \param[in] key The key whose associated value is to be retrieved from the voting_procedure_map.
+ * \param[out] element A pointer to a variable where the retrieved value will be stored. If the key
+ *                     is found in the voting procedure map, this variable will be set to the associated value.
+ *                     If the key is not found, this variable will be set to NULL. The caller is
+ *                     responsible for releasing the value by calling \ref cardano_plutus_data_unref.
+ *
+ * \return \ref CARDANO_SUCCESS if the value associated with the key was successfully retrieved, or
+ *         an appropriate error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_map_t* voting_procedure_map = cardano_voting_procedure_map_new();
+ *
+ * // Populate the voting_procedure_map with key-value pairs
+ *
+ * cardano_plutus_data_t* key = ...; // Create a plutus_data object representing the key
+ * cardano_plutus_data_t* value = NULL;
+ * cardano_error_t result = cardano_voting_procedure_map_get(voting_procedure_map, key, &value);
+ *
+ * if (result == CARDANO_SUCCESS && value != NULL)
+ * {
+ *   // Use the retrieved value
+ *   // ...
+ *   cardano_plutus_data_unref(&value); // Clean up the value resource
+ * }
+ * else
+ * {
+ *   // Handle error or key not found
+ * }
+ *
+ * cardano_plutus_data_unref(&key); // Clean up the key resource
+ * cardano_voting_procedure_map_unref(&voting_procedure_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedure_map_get(cardano_voting_procedure_map_t* voting_procedure_map, cardano_governance_action_id_t* key, cardano_voting_procedure_t** element);
+
+/**
+ * \brief Inserts a key-value pair into the voting procedure map.
+ *
+ * This function inserts the specified key-value pair into the provided voting procedure map.
+ *
+ * \param[in] voting_procedure_map A constant pointer to the \ref cardano_voting_procedure_map_t object where
+ *                       the key-value pair is to be inserted.
+ * \param[in] key The key to be inserted into the voting procedure map. The caller is responsible for managing
+ *                the lifecycle of the key object.
+ * \param[in] value The value to be associated with the key and inserted into the voting_procedure_map.
+ *                  The caller is responsible for managing the lifecycle of the value object.
+ *
+ * \return \ref CARDANO_SUCCESS if the key-value pair was successfully inserted, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_map_t* voting_procedure_map = cardano_voting_procedure_map_new();
+ *
+ * // Create key and value objects
+ * cardano_plutus_data_t* key = ...; // Create a plutus_data object representing the key
+ * cardano_plutus_data_t* value = ...; // Create a plutus_data object representing the value
+ *
+ * // Insert the key-value pair into the voting_procedure_map
+ * cardano_error_t result = cardano_voting_procedure_map_insert(voting_procedure_map, key, value);
+ *
+ * if (result != CARDANO_SUCCESS)
+ * {
+ *   // Handle insertion failure
+ * }
+ *
+ * // Clean up key and value objects
+ * cardano_plutus_data_unref(&key);
+ * cardano_plutus_data_unref(&value);
+ *
+ * cardano_voting_procedure_map_unref(&voting_procedure_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedure_map_insert(cardano_voting_procedure_map_t* voting_procedure_map, cardano_governance_action_id_t* key, cardano_voting_procedure_t* value);
+
+/**
+ * \brief Retrieves the keys from the voting procedure map.
+ *
+ * This function retrieves all the keys from the provided voting procedure map and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_plutus_list_unref when it is no longer needed.
+ *
+ * \param[in] voting_procedure_map A constant pointer to the \ref cardano_voting_procedure_map_t object from which
+ *                       the keys are to be retrieved.
+ * \param[out] keys A pointer to a variable where the retrieved keys will be stored as a list.
+ *                  If successful, this variable will be set to point to the list of keys.
+ *                  The caller is responsible for managing the lifecycle of this list.
+ *                  It must be released by calling \ref cardano_plutus_list_unref when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the keys were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_map_t* voting_procedure_map = cardano_voting_procedure_map_new();
+ *
+ * // Populate the voting_procedure_map with key-value pairs
+ *
+ * cardano_plutus_list_t* keys = NULL;
+ * cardano_error_t result = cardano_voting_procedure_map_get_keys(voting_procedure_map, &keys);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of keys
+ *   // Keys must also be freed if retrieved from the list
+ *
+ *   // Once done, ensure to clean up and release the keys list
+ *   cardano_plutus_list_unref(&keys);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_voting_procedure_map_unref(&voting_procedure_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedure_map_get_keys(cardano_voting_procedure_map_t* voting_procedure_map, cardano_governance_action_id_list_t** keys);
+
+/**
+ * \brief Retrieves the values from the voting procedure map.
+ *
+ * This function retrieves all the values from the provided voting procedure map and returns them as a list.
+ * The caller is responsible for managing the lifecycle of the returned list by calling
+ * \ref cardano_plutus_list_unref when it is no longer needed.
+ *
+ * \param[in] voting_procedure_map A constant pointer to the \ref cardano_voting_procedure_map_t object from which
+ *                       the values are to be retrieved.
+ * \param[out] values A pointer to a variable where the retrieved values will be stored as a list.
+ *                    If successful, this variable will be set to point to the list of values.
+ *                    The caller is responsible for managing the lifecycle of this list.
+ *                    It must be released by calling \ref cardano_plutus_list_unref when no longer needed.
+ *
+ * \return \ref CARDANO_SUCCESS if the values were successfully retrieved, or an appropriate
+ *         error code if the input parameters are invalid or any other error occurs.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_map_t* voting_procedure_map = cardano_voting_procedure_map_new();
+ *
+ * // Populate the voting_procedure_map with key-value pairs
+ *
+ * cardano_plutus_list_t* values = NULL;
+ * cardano_error_t result = cardano_voting_procedure_map_get_values(voting_procedure_map, &values);
+ *
+ * if (result == CARDANO_SUCCESS)
+ * {
+ *   // Use the list of values
+ *
+ *   // Once done, ensure to clean up and release the values list
+ *   // Values must also be freed if retrieved from the list
+ *   cardano_plutus_list_unref(&values);
+ * }
+ * else
+ * {
+ *   // Handle error
+ * }
+ *
+ * cardano_voting_procedure_map_unref(&voting_procedure_map);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT cardano_error_t cardano_voting_procedure_map_get_values(cardano_voting_procedure_map_t* voting_procedure_map, cardano_voting_procedure_list_t** values);
+
+/**
+ * \brief Decrements the reference count of a voting_procedure_map object.
+ *
+ * This function is responsible for managing the lifecycle of a \ref cardano_voting_procedure_map_t object
+ * by decreasing its reference count. When the reference count reaches zero, the voting_procedure_map is
+ * finalized; its associated resources are released, and its memory is deallocated.
+ *
+ * \param[in,out] voting_procedure_map A pointer to the pointer of the voting_procedure_map object. This double
+ *                            indirection allows the function to set the caller's pointer to
+ *                            NULL, avoiding dangling pointer issues after the object has been
+ *                            freed.
+ *
+ * Usage Example:
+ * \code{.c}
+ * cardano_voting_procedure_map_t* voting_procedure_map = cardano_voting_procedure_map_new();
+ *
+ * // Perform operations with the voting_procedure_map...
+ *
+ * cardano_voting_procedure_map_unref(&voting_procedure_map);
+ * // At this point, voting_procedure_map is NULL and cannot be used.
+ * \endcode
+ *
+ * \note After calling \ref cardano_voting_procedure_map_unref, the pointer to the \ref cardano_voting_procedure_map_t object
+ *       will be set to NULL to prevent its reuse.
+ */
+CARDANO_EXPORT void cardano_voting_procedure_map_unref(cardano_voting_procedure_map_t** voting_procedure_map);
+
+/**
+ * \brief Increases the reference count of the cardano_voting_procedure_map_t object.
+ *
+ * This function is used to manually increment the reference count of a voting_procedure_map
+ * object, indicating that another part of the code has taken ownership of it. This
+ * ensures the object remains allocated and valid until all owners have released their
+ * reference by calling \ref cardano_voting_procedure_map_unref.
+ *
+ * \param voting_procedure_map A pointer to the voting_procedure_map object whose reference count is to be incremented.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voting_procedure_map is a previously created voting_procedure_map object
+ *
+ * cardano_voting_procedure_map_ref(voting_procedure_map);
+ *
+ * // Now voting_procedure_map can be safely used elsewhere without worrying about premature deallocation
+ * \endcode
+ *
+ * \note Always ensure that for every call to \ref cardano_voting_procedure_map_ref there is a corresponding
+ * call to \ref cardano_voting_procedure_map_unref to prevent memory leaks.
+ */
+CARDANO_EXPORT void cardano_voting_procedure_map_ref(cardano_voting_procedure_map_t* voting_procedure_map);
+
+/**
+ * \brief Retrieves the current reference count of the cardano_voting_procedure_map_t object.
+ *
+ * This function returns the number of active references to a voting_procedure_map object. It's useful
+ * for debugging purposes or managing the lifecycle of the object in complex scenarios.
+ *
+ * \warning This function does not account for transitive references. A transitive reference
+ * occurs when an object holds a reference to another object, rather than directly to the
+ * cardano_voting_procedure_map_t. As such, the reported count may not fully represent the total number
+ * of conceptual references in cases where such transitive relationships exist.
+ *
+ * \param voting_procedure_map A pointer to the voting_procedure_map object whose reference count is queried.
+ *                    The object must not be NULL.
+ *
+ * \return The number of active references to the specified voting_procedure_map object. If the object
+ * is properly managed (i.e., every \ref cardano_voting_procedure_map_ref call is matched with a
+ * \ref cardano_voting_procedure_map_unref call), this count should reach zero right before the object
+ * is deallocated.
+ *
+ * Usage Example:
+ * \code{.c}
+ * // Assuming voting_procedure_map is a previously created voting_procedure_map object
+ *
+ * size_t ref_count = cardano_voting_procedure_map_refcount(voting_procedure_map);
+ *
+ * printf("Reference count: %zu\n", ref_count);
+ * \endcode
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT size_t cardano_voting_procedure_map_refcount(const cardano_voting_procedure_map_t* voting_procedure_map);
+
+/**
+ * \brief Sets the last error message for a given voting_procedure_map object.
+ *
+ * Records an error message in the voting_procedure_map's last_error buffer, overwriting any existing message.
+ * This is useful for storing descriptive error information that can be later retrieved. The message
+ * is truncated if it exceeds the buffer's capacity.
+ *
+ * \param[in] voting_procedure_map A pointer to the \ref cardano_voting_procedure_map_t instance whose last error message is
+ *                       to be set. If \c NULL, the function does nothing.
+ * \param[in] message A null-terminated string containing the error message. If \c NULL, the voting_procedure_map's
+ *                    last_error is set to an empty string, indicating no error.
+ *
+ * \note The error message is limited to 1023 characters, including the null terminator, due to the
+ * fixed size of the last_error buffer.
+ */
+CARDANO_EXPORT void cardano_voting_procedure_map_set_last_error(cardano_voting_procedure_map_t* voting_procedure_map, const char* message);
+
+/**
+ * \brief Retrieves the last error message recorded for a specific voting_procedure_map.
+ *
+ * This function returns a pointer to the null-terminated string containing
+ * the last error message set by \ref cardano_voting_procedure_map_set_last_error for the given
+ * voting_procedure_map. If no error message has been set, or if the last_error buffer was
+ * explicitly cleared, an empty string is returned, indicating no error.
+ *
+ * \param[in] voting_procedure_map A pointer to the \ref cardano_voting_procedure_map_t instance whose last error
+ *                   message is to be retrieved. If the voting_procedure_map is NULL, the function
+ *                   returns a generic error message indicating the null voting_procedure_map.
+ *
+ * \return A pointer to a null-terminated string containing the last error
+ *         message for the specified voting_procedure_map. If the voting_procedure_map is NULL, "Object is NULL."
+ *         is returned to indicate the error.
+ *
+ * \note The returned string points to internal storage within the object and
+ *       must not be modified by the caller. The string remains valid until the
+ *       next call to \ref cardano_voting_procedure_map_set_last_error for the same voting_procedure_map, or until
+ *       the voting_procedure_map is deallocated.
+ */
+CARDANO_NODISCARD
+CARDANO_EXPORT const char* cardano_voting_procedure_map_get_last_error(const cardano_voting_procedure_map_t* voting_procedure_map);
+
+/**
+ * \brief Deep copies the action IDs and voting procedures in the map.
+ * \param[in] source Map to copy.
+ * \param[out] clone Receives one owned copy, or NULL on failure.
+ * \return Success or a null argument/allocation error.
+ */
+cardano_error_t cardano_voting_procedure_map_deep_clone(const cardano_voting_procedure_map_t* source, cardano_voting_procedure_map_t** clone);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // BIGLUP_LABS_INCLUDE_CARDANO_VOTING_PROCEDURE_MAP_H
diff --git a/vendor/src/voting_procedures/voting_procedures.c b/vendor/src/voting_procedures/voting_procedures.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/voting_procedures/voting_procedures.c
@@ -0,0 +1,956 @@
+/**
+ * \file voting_procedures.c
+ *
+ * \author angel.castillo
+ * \date   Aug 08, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/voting_procedures/governance_action_id_list.h>
+#include <cardano/voting_procedures/voter.h>
+#include <cardano/voting_procedures/voter_list.h>
+#include <cardano/voting_procedures/voting_procedures.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+#include "voting_procedure_map.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano voting procedure key value pair.
+ */
+typedef struct cardano_voting_procedure_kvp_t
+{
+    cardano_object_t                base;
+    cardano_voter_t*                key;
+    cardano_voting_procedure_map_t* value;
+} cardano_voting_procedure_kvp_t;
+
+/**
+ * \brief Updates the voting procedure metadata.
+ */
+typedef struct cardano_voting_procedures_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+} cardano_voting_procedures_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a voting_procedures object.
+ *
+ * This function is responsible for properly deallocating a voting_procedures object (`cardano_voting_procedures_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the voting_procedures object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_voting_procedures_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the voting_procedures
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_voting_procedures_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_voting_procedures_t* map = (cardano_voting_procedures_t*)object;
+
+  if (map->array != NULL)
+  {
+    cardano_array_unref(&map->array);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Deallocates a voting_procedure map key value pair object.
+ *
+ * This function is responsible for properly deallocating a voting_procedure map key value pair object (`cardano_voting_procedure_kvp_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the voting_procedure_map object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_voting_procedure_kvp_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the voting_procedure_map
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_voting_procedure_kvp_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_voting_procedure_kvp_t* map = (cardano_voting_procedure_kvp_t*)object;
+
+  if (map->key != NULL)
+  {
+    cardano_voter_unref(&map->key);
+  }
+
+  if (map->value != NULL)
+  {
+    cardano_voting_procedure_map_unref(&map->value);
+  }
+
+  _cardano_free(map);
+}
+
+/**
+ * \brief Compares two cardano_voting_procedure_kvp_t objects based on their voter.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the voter id of lhs is less than the voter id of rhs, zero if they are equal,
+ *         and a positive value if the voter id of lhs is greater than the voter id of rhs.
+ */
+static int32_t
+compare_by_voter(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_voting_procedure_kvp_t* lhs_kvp = (const cardano_voting_procedure_kvp_t*)((const void*)lhs);
+  const cardano_voting_procedure_kvp_t* rhs_kvp = (const cardano_voting_procedure_kvp_t*)((const void*)rhs);
+
+  return cardano_voter_compare(lhs_kvp->key, rhs_kvp->key);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_voting_procedures_new(cardano_voting_procedures_t** voting_procedures)
+{
+  if (voting_procedures == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedures_t* map = _cardano_malloc(sizeof(cardano_voting_procedures_t));
+
+  if (map == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  map->base.ref_count     = 1;
+  map->base.last_error[0] = '\0';
+  map->base.deallocator   = cardano_voting_procedures_deallocate;
+
+  map->array = cardano_array_new(128);
+
+  if (map->array == NULL)
+  {
+    _cardano_free(map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *voting_procedures = map;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voting_procedures_from_cbor(cardano_cbor_reader_t* reader, cardano_voting_procedures_t** voting_procedures)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (voting_procedures == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  int64_t         map_size          = 0;
+  cardano_error_t expect_map_result = cardano_cbor_reader_read_start_map(reader, &map_size);
+
+  CARDANO_UNUSED(map_size);
+
+  if (expect_map_result != CARDANO_SUCCESS)
+  {
+    return expect_map_result;
+  }
+
+  cardano_voting_procedures_t* data       = NULL;
+  cardano_error_t              new_result = cardano_voting_procedures_new(&data);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  cardano_error_t read_state = cardano_cbor_reader_peek_state(reader, &state);
+
+  if (read_state != CARDANO_SUCCESS)
+  {
+    cardano_voting_procedures_unref(&data);
+    return read_state;
+  }
+
+  while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+  {
+    cardano_voter_t* voter = NULL;
+
+    cardano_error_t read_voter_result = cardano_voter_from_cbor(reader, &voter);
+
+    if (read_voter_result != CARDANO_SUCCESS)
+    {
+      cardano_voter_unref(&voter);
+      cardano_voting_procedures_unref(&data);
+
+      return read_voter_result;
+    }
+
+    int64_t         votes_map_size               = 0;
+    cardano_error_t expect_votes_map_size_result = cardano_cbor_reader_read_start_map(reader, &votes_map_size);
+
+    CARDANO_UNUSED(votes_map_size);
+
+    if (expect_votes_map_size_result != CARDANO_SUCCESS)
+    {
+      cardano_voter_unref(&voter);
+      cardano_voting_procedures_unref(&data);
+
+      return expect_votes_map_size_result;
+    }
+
+    read_state = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (read_state != CARDANO_SUCCESS)
+    {
+      cardano_voter_unref(&voter);
+      cardano_voting_procedures_unref(&data);
+      return read_state;
+    }
+
+    while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      cardano_governance_action_id_t* action_id = NULL;
+      cardano_voting_procedure_t*     vote      = NULL;
+
+      cardano_error_t read_action_id_result = cardano_governance_action_id_from_cbor(reader, &action_id);
+
+      if (read_action_id_result != CARDANO_SUCCESS)
+      {
+        cardano_governance_action_id_unref(&action_id);
+        cardano_voting_procedure_unref(&vote);
+        cardano_voter_unref(&voter);
+        cardano_voting_procedures_unref(&data);
+
+        return read_action_id_result;
+      }
+
+      cardano_error_t read_vote_result = cardano_voting_procedure_from_cbor(reader, &vote);
+
+      if (read_vote_result != CARDANO_SUCCESS)
+      {
+        cardano_governance_action_id_unref(&action_id);
+        cardano_voting_procedure_unref(&vote);
+        cardano_voter_unref(&voter);
+        cardano_voting_procedures_unref(&data);
+
+        return read_vote_result;
+      }
+
+      cardano_error_t insert_result = cardano_voting_procedures_insert(data, voter, action_id, vote);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_governance_action_id_unref(&action_id);
+        cardano_voting_procedure_unref(&vote);
+        cardano_voter_unref(&voter);
+        cardano_voting_procedures_unref(&data);
+
+        return insert_result;
+      }
+
+      cardano_governance_action_id_unref(&action_id);
+      cardano_voting_procedure_unref(&vote);
+
+      read_state = cardano_cbor_reader_peek_state(reader, &state);
+
+      if (read_state != CARDANO_SUCCESS)
+      {
+        cardano_voter_unref(&voter);
+        cardano_voting_procedures_unref(&data);
+        return read_state;
+      }
+    }
+
+    cardano_error_t end_inner_map_result = cardano_cbor_reader_read_end_map(reader);
+
+    if (end_inner_map_result != CARDANO_SUCCESS)
+    {
+      cardano_voter_unref(&voter);
+      cardano_voting_procedures_unref(&data);
+
+      return end_inner_map_result;
+    }
+
+    read_state = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (read_state != CARDANO_SUCCESS)
+    {
+      cardano_voter_unref(&voter);
+      cardano_voting_procedures_unref(&data);
+
+      return read_state;
+    }
+
+    cardano_voter_unref(&voter);
+
+    cardano_array_sort(data->array, compare_by_voter, NULL);
+  }
+
+  cardano_error_t result = cardano_cbor_validate_end_map("voting_procedures", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_voting_procedures_unref(&data);
+    return result;
+  }
+
+  *voting_procedures = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voting_procedures_to_cbor(
+  const cardano_voting_procedures_t* voting_procedures,
+  cardano_cbor_writer_t*             writer)
+{
+  if (voting_procedures == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t size = cardano_array_get_size(voting_procedures->array);
+
+  cardano_error_t write_map_result = cardano_cbor_writer_write_start_map(writer, (int64_t)size);
+
+  if (write_map_result != CARDANO_SUCCESS)
+  {
+    return write_map_result;
+  }
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_voting_procedure_kvp_t* kvp = (cardano_voting_procedure_kvp_t*)((void*)cardano_array_get(voting_procedures->array, i));
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    cardano_error_t write_voter_result = cardano_voter_to_cbor(kvp->key, writer);
+
+    if (write_voter_result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+      return write_voter_result;
+    }
+
+    size_t votes_size = cardano_voting_procedure_map_get_length(kvp->value);
+
+    cardano_error_t write_votes_map_result = cardano_cbor_writer_write_start_map(writer, (int64_t)votes_size);
+
+    if (write_votes_map_result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+      return write_votes_map_result;
+    }
+
+    cardano_governance_action_id_list_t* action_ids = NULL;
+
+    cardano_error_t get_keys_result = cardano_voting_procedure_map_get_keys(kvp->value, &action_ids);
+
+    if (get_keys_result != CARDANO_SUCCESS)
+    {
+      cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+      return get_keys_result;
+    }
+
+    size_t action_ids_size = cardano_governance_action_id_list_get_length(action_ids);
+
+    for (size_t j = 0U; j < action_ids_size; ++j)
+    {
+      cardano_governance_action_id_t* action_id = NULL;
+
+      cardano_error_t get_action_id_result = cardano_governance_action_id_list_get(action_ids, j, &action_id);
+
+      if (get_action_id_result != CARDANO_SUCCESS)
+      {
+        cardano_governance_action_id_list_unref(&action_ids);
+        cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+        return get_action_id_result;
+      }
+
+      cardano_voting_procedure_t* vote = NULL;
+
+      cardano_error_t get_vote_result = cardano_voting_procedure_map_get(kvp->value, action_id, &vote);
+
+      if (get_vote_result != CARDANO_SUCCESS)
+      {
+        cardano_governance_action_id_unref(&action_id);
+        cardano_governance_action_id_list_unref(&action_ids);
+        cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+        return get_vote_result;
+      }
+
+      cardano_error_t write_action_id_result = cardano_governance_action_id_to_cbor(action_id, writer);
+
+      if (write_action_id_result != CARDANO_SUCCESS)
+      {
+        cardano_governance_action_id_unref(&action_id);
+        cardano_governance_action_id_list_unref(&action_ids);
+        cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+        return write_action_id_result;
+      }
+
+      cardano_error_t write_vote_result = cardano_voting_procedure_to_cbor(vote, writer);
+
+      if (write_vote_result != CARDANO_SUCCESS)
+      {
+        cardano_governance_action_id_unref(&action_id);
+        cardano_governance_action_id_list_unref(&action_ids);
+        cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+        return write_vote_result;
+      }
+
+      cardano_governance_action_id_unref(&action_id);
+      cardano_voting_procedure_unref(&vote);
+    }
+
+    cardano_governance_action_id_list_unref(&action_ids);
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voting_procedures_to_cip116_json(
+  const cardano_voting_procedures_t* procedures,
+  cardano_json_writer_t*             writer)
+{
+  if ((procedures == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t          array_size = cardano_array_get_size(procedures->array);
+  cardano_error_t error      = CARDANO_SUCCESS;
+
+  for (size_t i = 0; i < array_size; ++i)
+  {
+    cardano_object_t* kvp = cardano_array_get(procedures->array, i);
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    cardano_voting_procedure_kvp_t* kvp_data = (cardano_voting_procedure_kvp_t*)((void*)kvp);
+
+    cardano_json_writer_write_start_object(writer);
+
+    cardano_json_writer_write_property_name(writer, "key", 3);
+    error = cardano_voter_to_cip116_json(kvp_data->key, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return error;
+    }
+
+    cardano_json_writer_write_property_name(writer, "value", 5);
+    error = cardano_voting_procedure_map_to_cip116_json(kvp_data->value, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_object_unref(&kvp);
+      return error;
+    }
+
+    cardano_json_writer_write_end_object(writer);
+    cardano_object_unref(&kvp);
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return error;
+}
+
+cardano_error_t
+cardano_voting_procedures_insert(
+  cardano_voting_procedures_t*    voting_procedures,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* governance_action_id,
+  cardano_voting_procedure_t*     value)
+{
+  if (voting_procedures == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (voter == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (governance_action_id == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (value == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t size = cardano_array_get_size(voting_procedures->array);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_voting_procedure_kvp_t* kvp = (cardano_voting_procedure_kvp_t*)((void*)cardano_array_get(voting_procedures->array, i));
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    if (cardano_voter_equals(kvp->key, voter))
+    {
+      cardano_error_t insert_result = cardano_voting_procedure_map_insert(kvp->value, governance_action_id, value);
+
+      if (insert_result != CARDANO_SUCCESS)
+      {
+        cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+        return insert_result;
+      }
+
+      cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+      return CARDANO_SUCCESS;
+    }
+
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+  }
+
+  cardano_voting_procedure_map_t* map               = NULL;
+  cardano_error_t                 create_map_result = cardano_voting_procedure_map_new(&map);
+
+  if (create_map_result != CARDANO_SUCCESS)
+  {
+    return create_map_result;
+  }
+
+  cardano_error_t insert_result = cardano_voting_procedure_map_insert(map, governance_action_id, value);
+
+  if (insert_result != CARDANO_SUCCESS)
+  {
+    cardano_voting_procedure_map_unref(&map);
+    return insert_result;
+  }
+
+  cardano_voting_procedure_kvp_t* kvp = _cardano_malloc(sizeof(cardano_voting_procedure_kvp_t));
+
+  if (kvp == NULL)
+  {
+    cardano_voting_procedure_map_unref(&map);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  kvp->base.ref_count     = 0;
+  kvp->base.last_error[0] = '\0';
+  kvp->base.deallocator   = cardano_voting_procedure_kvp_deallocate;
+  kvp->key                = voter;
+  kvp->value              = map;
+
+  cardano_voter_ref(voter);
+
+  const size_t old_size = cardano_array_get_size(voting_procedures->array);
+  const size_t new_size = cardano_array_push(voting_procedures->array, (cardano_object_t*)((void*)kvp));
+
+  if (new_size != (old_size + 1U))
+  {
+    cardano_voting_procedure_kvp_deallocate(kvp);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(voting_procedures->array, compare_by_voter, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_voting_procedure_t*
+cardano_voting_procedures_get(
+  cardano_voting_procedures_t*    voting_procedures,
+  cardano_voter_t*                voter,
+  cardano_governance_action_id_t* governance_action_id)
+{
+  if (voting_procedures == NULL)
+  {
+    return NULL;
+  }
+
+  if (voter == NULL)
+  {
+    return NULL;
+  }
+
+  if (governance_action_id == NULL)
+  {
+    return NULL;
+  }
+
+  size_t size = cardano_array_get_size(voting_procedures->array);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_voting_procedure_kvp_t* kvp = (cardano_voting_procedure_kvp_t*)((void*)cardano_array_get(voting_procedures->array, i));
+
+    if (kvp == NULL)
+    {
+      return NULL;
+    }
+
+    if (cardano_voter_equals(kvp->key, voter))
+    {
+      cardano_voting_procedure_t* procedure = NULL;
+
+      cardano_error_t get_element_result = cardano_voting_procedure_map_get(kvp->value, governance_action_id, &procedure);
+
+      cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+      if (get_element_result != CARDANO_SUCCESS)
+      {
+        return NULL;
+      }
+
+      return procedure;
+    }
+
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+  }
+
+  return NULL;
+}
+
+cardano_error_t
+cardano_voting_procedures_get_governance_ids_by_voter(
+  cardano_voting_procedures_t*          voting_procedures,
+  cardano_voter_t*                      voter,
+  cardano_governance_action_id_list_t** governance_action_ids)
+{
+  if (voting_procedures == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (voter == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (governance_action_ids == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  size_t size = cardano_array_get_size(voting_procedures->array);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_voting_procedure_kvp_t* kvp = (cardano_voting_procedure_kvp_t*)((void*)cardano_array_get(voting_procedures->array, i));
+
+    if (kvp == NULL)
+    {
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    if (cardano_voter_equals(kvp->key, voter))
+    {
+      cardano_error_t get_result = cardano_voting_procedure_map_get_keys(kvp->value, governance_action_ids);
+
+      if (get_result != CARDANO_SUCCESS)
+      {
+        cardano_object_unref((cardano_object_t**)((void*)&kvp));
+        return get_result;
+      }
+    }
+
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_voting_procedures_get_voters(cardano_voting_procedures_t* voting_procedures, cardano_voter_list_t** voters)
+{
+  if (voting_procedures == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (voters == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voter_list_t* list = NULL;
+
+  cardano_error_t create_list_result = cardano_voter_list_new(&list);
+
+  if (create_list_result != CARDANO_SUCCESS)
+  {
+    return create_list_result;
+  }
+
+  size_t size = cardano_array_get_size(voting_procedures->array);
+
+  for (size_t i = 0U; i < size; ++i)
+  {
+    cardano_voting_procedure_kvp_t* kvp = (cardano_voting_procedure_kvp_t*)((void*)cardano_array_get(voting_procedures->array, i));
+
+    if (kvp == NULL)
+    {
+      cardano_voter_list_unref(&list);
+      return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+    }
+
+    cardano_object_unref((cardano_object_t**)((void*)&kvp));
+
+    cardano_error_t add_result = cardano_voter_list_add(list, kvp->key);
+
+    if (add_result != CARDANO_SUCCESS)
+    {
+      cardano_voter_list_unref(&list);
+      return add_result;
+    }
+  }
+
+  *voters = list;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_voting_procedures_unref(cardano_voting_procedures_t** voting_procedures)
+{
+  if ((voting_procedures == NULL) || (*voting_procedures == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*voting_procedures)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *voting_procedures = NULL;
+    return;
+  }
+}
+
+void
+cardano_voting_procedures_ref(cardano_voting_procedures_t* voting_procedures)
+{
+  if (voting_procedures == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&voting_procedures->base);
+}
+
+size_t
+cardano_voting_procedures_refcount(const cardano_voting_procedures_t* voting_procedures)
+{
+  if (voting_procedures == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&voting_procedures->base);
+}
+
+void
+cardano_voting_procedures_set_last_error(cardano_voting_procedures_t* voting_procedures, const char* message)
+{
+  cardano_object_set_last_error(&voting_procedures->base, message);
+}
+
+const char*
+cardano_voting_procedures_get_last_error(const cardano_voting_procedures_t* voting_procedures)
+{
+  return cardano_object_get_last_error(&voting_procedures->base);
+}
+
+/**
+ * Deep copies a private map entry and its owned values.
+ */
+static cardano_error_t
+cardano_voting_procedure_kvp_deep_clone(const cardano_voting_procedure_kvp_t* source, cardano_voting_procedure_kvp_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedure_kvp_t* copy = _cardano_malloc(sizeof(cardano_voting_procedure_kvp_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->key                = NULL;
+  copy->value              = NULL;
+
+  if (source->key != NULL)
+  {
+    const cardano_error_t result = cardano_voter_deep_clone(source->key, &copy->key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->value != NULL)
+  {
+    const cardano_error_t result = cardano_voting_procedure_map_deep_clone(source->value, &copy->value);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_voting_procedure_kvp_t* copy   = NULL;
+  const cardano_error_t           result = cardano_voting_procedure_kvp_deep_clone((const cardano_voting_procedure_kvp_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_voting_procedures_deep_clone(const cardano_voting_procedures_t* source, cardano_voting_procedures_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_voting_procedures_t* copy = _cardano_malloc(sizeof(cardano_voting_procedures_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/bootstrap_witness.c b/vendor/src/witness_set/bootstrap_witness.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/bootstrap_witness.c
@@ -0,0 +1,630 @@
+/**
+ * \file bootstrap_witness.c
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/witness_set/bootstrap_witness.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 4;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief The bootstrap witness proves that the transaction has the authority to spend
+ * the value from the associated Byron-era input UTxOs.
+ *
+ * Cardano has transitioned away from this type of witness from Shelley and later eras, BootstrapWitnesses
+ * are currently deprecated.
+ */
+typedef struct cardano_bootstrap_witness_t
+{
+    cardano_object_t              base;
+    cardano_ed25519_public_key_t* vkey;
+    cardano_ed25519_signature_t*  signature;
+    cardano_buffer_t*             chain_code;
+    cardano_buffer_t*             attributes;
+} cardano_bootstrap_witness_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a bootstrap_witness object.
+ *
+ * This function is responsible for properly deallocating a bootstrap_witness object (`cardano_bootstrap_witness_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the bootstrap_witness object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_bootstrap_witness_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the bootstrap_witness
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_bootstrap_witness_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_bootstrap_witness_t* data = (cardano_bootstrap_witness_t*)object;
+
+  cardano_ed25519_public_key_unref(&data->vkey);
+  cardano_ed25519_signature_unref(&data->signature);
+  cardano_buffer_unref(&data->chain_code);
+  cardano_buffer_unref(&data->attributes);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_bootstrap_witness_new(
+  cardano_ed25519_public_key_t* vkey,
+  cardano_ed25519_signature_t*  signature,
+  cardano_buffer_t*             chain_code,
+  cardano_buffer_t*             attributes,
+  cardano_bootstrap_witness_t** bootstrap_witness)
+{
+  if (vkey == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (signature == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (chain_code == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (attributes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bootstrap_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bootstrap_witness_t* data = _cardano_malloc(sizeof(cardano_bootstrap_witness_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_bootstrap_witness_deallocate;
+
+  cardano_ed25519_public_key_ref(vkey);
+  data->vkey = vkey;
+
+  cardano_ed25519_signature_ref(signature);
+  data->signature = signature;
+
+  cardano_buffer_ref(chain_code);
+  data->chain_code = chain_code;
+
+  cardano_buffer_ref(attributes);
+  data->attributes = attributes;
+
+  *bootstrap_witness = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_from_cbor(cardano_cbor_reader_t* reader, cardano_bootstrap_witness_t** bootstrap_witness)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bootstrap_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "bootstrap_witness";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  cardano_buffer_t* vkey_bytes = NULL;
+
+  cardano_error_t read_vkey_result = cardano_cbor_reader_read_bytestring(reader, &vkey_bytes);
+
+  if (read_vkey_result != CARDANO_SUCCESS)
+  {
+    return read_vkey_result;
+  }
+
+  cardano_ed25519_public_key_t* vkey = NULL;
+
+  cardano_error_t new_vkey_result = cardano_ed25519_public_key_from_bytes(cardano_buffer_get_data(vkey_bytes), cardano_buffer_get_size(vkey_bytes), &vkey);
+  cardano_buffer_unref(&vkey_bytes);
+
+  if (new_vkey_result != CARDANO_SUCCESS)
+  {
+    return new_vkey_result;
+  }
+
+  cardano_buffer_t* signature_bytes = NULL;
+
+  cardano_error_t read_signature_result = cardano_cbor_reader_read_bytestring(reader, &signature_bytes);
+
+  if (read_signature_result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_public_key_unref(&vkey);
+
+    return read_signature_result;
+  }
+
+  cardano_ed25519_signature_t* signature = NULL;
+
+  cardano_error_t new_signature_result = cardano_ed25519_signature_from_bytes(cardano_buffer_get_data(signature_bytes), cardano_buffer_get_size(signature_bytes), &signature);
+
+  cardano_buffer_unref(&signature_bytes);
+
+  if (new_signature_result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_public_key_unref(&vkey);
+
+    return new_signature_result;
+  }
+
+  cardano_buffer_t* chain_code = NULL;
+
+  cardano_error_t read_chain_code_result = cardano_cbor_validate_byte_string(validator_name, reader, &chain_code);
+
+  if (read_chain_code_result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_public_key_unref(&vkey);
+    cardano_ed25519_signature_unref(&signature);
+
+    return read_chain_code_result;
+  }
+
+  cardano_buffer_t* attributes = NULL;
+
+  cardano_error_t read_attributes_result = cardano_cbor_reader_read_bytestring(reader, &attributes);
+
+  if (read_attributes_result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_public_key_unref(&vkey);
+    cardano_ed25519_signature_unref(&signature);
+    cardano_buffer_unref(&chain_code);
+
+    return read_attributes_result;
+  }
+
+  cardano_error_t new_result = cardano_bootstrap_witness_new(vkey, signature, chain_code, attributes, bootstrap_witness);
+
+  cardano_ed25519_public_key_unref(&vkey);
+  cardano_ed25519_signature_unref(&signature);
+  cardano_buffer_unref(&chain_code);
+  cardano_buffer_unref(&attributes);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_bootstrap_witness_to_cbor(
+  const cardano_bootstrap_witness_t* bootstrap_witness,
+  cardano_cbor_writer_t*             writer)
+{
+  if (bootstrap_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_vkey_result = cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_ed25519_public_key_get_data(bootstrap_witness->vkey),
+    cardano_ed25519_public_key_get_bytes_size(bootstrap_witness->vkey));
+
+  if (write_vkey_result != CARDANO_SUCCESS)
+  {
+    return write_vkey_result;
+  }
+
+  cardano_error_t write_signature_result = cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_ed25519_signature_get_data(bootstrap_witness->signature),
+    cardano_ed25519_signature_get_bytes_size(bootstrap_witness->signature));
+
+  if (write_signature_result != CARDANO_SUCCESS)
+  {
+    return write_signature_result;
+  }
+
+  cardano_error_t write_chain_code_result = cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_buffer_get_data(bootstrap_witness->chain_code),
+    cardano_buffer_get_size(bootstrap_witness->chain_code));
+
+  if (write_chain_code_result != CARDANO_SUCCESS)
+  {
+    return write_chain_code_result;
+  }
+
+  cardano_error_t write_attributes_result = cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_buffer_get_data(bootstrap_witness->attributes),
+    cardano_buffer_get_size(bootstrap_witness->attributes));
+
+  if (write_attributes_result != CARDANO_SUCCESS)
+  {
+    return write_attributes_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_to_cip116_json(
+  const cardano_bootstrap_witness_t* witness,
+  cardano_json_writer_t*             writer)
+{
+  if ((witness == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "attributes", 10);
+  cardano_json_writer_write_buffer_as_hex(writer, witness->attributes);
+
+  cardano_json_writer_write_property_name(writer, "chain_code", 10);
+  cardano_json_writer_write_buffer_as_hex(writer, witness->chain_code);
+
+  cardano_json_writer_write_property_name(writer, "signature", 9);
+  const byte_t* sig_data = cardano_ed25519_signature_get_data(witness->signature);
+  const size_t  sig_size = cardano_ed25519_signature_get_bytes_size(witness->signature);
+  cardano_json_writer_write_bytes_as_hex(writer, sig_data, sig_size);
+
+  cardano_json_writer_write_property_name(writer, "vkey", 4);
+  const byte_t* vkey_data = cardano_ed25519_public_key_get_data(witness->vkey);
+  const size_t  vkey_size = cardano_ed25519_public_key_get_bytes_size(witness->vkey);
+  cardano_json_writer_write_bytes_as_hex(writer, vkey_data, vkey_size);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_ed25519_public_key_t*
+cardano_bootstrap_witness_get_vkey(
+  cardano_bootstrap_witness_t* bootstrap_witness)
+{
+  if (bootstrap_witness == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_ed25519_public_key_ref(bootstrap_witness->vkey);
+
+  return bootstrap_witness->vkey;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_set_vkey(
+  cardano_bootstrap_witness_t*  bootstrap_witness,
+  cardano_ed25519_public_key_t* vkey)
+{
+  if (bootstrap_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vkey == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ed25519_public_key_ref(vkey);
+  cardano_ed25519_public_key_unref(&bootstrap_witness->vkey);
+
+  bootstrap_witness->vkey = vkey;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_ed25519_signature_t*
+cardano_bootstrap_witness_get_signature(
+  cardano_bootstrap_witness_t* bootstrap_witness)
+{
+  if (bootstrap_witness == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_ed25519_signature_ref(bootstrap_witness->signature);
+
+  return bootstrap_witness->signature;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_set_signature(
+  cardano_bootstrap_witness_t* bootstrap_witness,
+  cardano_ed25519_signature_t* signature)
+{
+  if (bootstrap_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (signature == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ed25519_signature_ref(signature);
+  cardano_ed25519_signature_unref(&bootstrap_witness->signature);
+
+  bootstrap_witness->signature = signature;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_buffer_t*
+cardano_bootstrap_witness_get_chain_code(
+  cardano_bootstrap_witness_t* bootstrap_witness)
+{
+  if (bootstrap_witness == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_buffer_ref(bootstrap_witness->chain_code);
+
+  return bootstrap_witness->chain_code;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_set_chain_code(
+  cardano_bootstrap_witness_t* bootstrap_witness,
+  cardano_buffer_t*            chan_code)
+{
+  if (bootstrap_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (chan_code == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_ref(chan_code);
+  cardano_buffer_unref(&bootstrap_witness->chain_code);
+
+  bootstrap_witness->chain_code = chan_code;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_buffer_t*
+cardano_bootstrap_witness_get_attributes(
+  cardano_bootstrap_witness_t* bootstrap_witness)
+{
+  if (bootstrap_witness == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_buffer_ref(bootstrap_witness->attributes);
+
+  return bootstrap_witness->attributes;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_set_attributes(
+  cardano_bootstrap_witness_t* bootstrap_witness,
+  cardano_buffer_t*            attributes)
+{
+  if (bootstrap_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (attributes == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_ref(attributes);
+  cardano_buffer_unref(&bootstrap_witness->attributes);
+
+  bootstrap_witness->attributes = attributes;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_bootstrap_witness_unref(cardano_bootstrap_witness_t** bootstrap_witness)
+{
+  if ((bootstrap_witness == NULL) || (*bootstrap_witness == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*bootstrap_witness)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *bootstrap_witness = NULL;
+    return;
+  }
+}
+
+void
+cardano_bootstrap_witness_ref(cardano_bootstrap_witness_t* bootstrap_witness)
+{
+  if (bootstrap_witness == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&bootstrap_witness->base);
+}
+
+size_t
+cardano_bootstrap_witness_refcount(const cardano_bootstrap_witness_t* bootstrap_witness)
+{
+  if (bootstrap_witness == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&bootstrap_witness->base);
+}
+
+void
+cardano_bootstrap_witness_set_last_error(cardano_bootstrap_witness_t* bootstrap_witness, const char* message)
+{
+  cardano_object_set_last_error(&bootstrap_witness->base, message);
+}
+
+const char*
+cardano_bootstrap_witness_get_last_error(const cardano_bootstrap_witness_t* bootstrap_witness)
+{
+  return cardano_object_get_last_error(&bootstrap_witness->base);
+}
+
+cardano_error_t
+cardano_bootstrap_witness_deep_clone(const cardano_bootstrap_witness_t* source, cardano_bootstrap_witness_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bootstrap_witness_t* copy = _cardano_malloc(sizeof(cardano_bootstrap_witness_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->vkey               = NULL;
+  copy->signature          = NULL;
+  copy->chain_code         = NULL;
+  copy->attributes         = NULL;
+
+  if (source->vkey != NULL)
+  {
+    const cardano_error_t result = cardano_ed25519_public_key_deep_clone(source->vkey, &copy->vkey);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->signature != NULL)
+  {
+    const cardano_error_t result = cardano_ed25519_signature_deep_clone(source->signature, &copy->signature);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->chain_code != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->chain_code, &copy->chain_code);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->attributes != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->attributes, &copy->attributes);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/bootstrap_witness_set.c b/vendor/src/witness_set/bootstrap_witness_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/bootstrap_witness_set.c
@@ -0,0 +1,660 @@
+/**
+ * \file bootstrap_witness_set.c
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/witness_set/bootstrap_witness_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano bootstrap_witness_set list.
+ */
+typedef struct cardano_bootstrap_witness_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             uses_tags;
+    bool             preserves_duplicates;
+} cardano_bootstrap_witness_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a bootstrap_witness_set list object.
+ *
+ * This function is responsible for properly deallocating a bootstrap_witness_set list object (`cardano_bootstrap_witness_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the bootstrap_witness_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_bootstrap_witness_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the bootstrap_witness_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_bootstrap_witness_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_bootstrap_witness_set_t* list = (cardano_bootstrap_witness_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/**
+ * \brief Determines whether two bootstrap witnesses are for the same Byron address root.
+ *
+ * The address root of a bootstrap witness is the hash of its public key, chain code and attributes, so two bootstrap
+ * witnesses are for the same address root when they have the same public key, chain code and attributes. Their
+ * signatures are not compared.
+ *
+ * \param lhs The first bootstrap witness to compare.
+ * \param rhs The second bootstrap witness to compare.
+ * \return true if both witnesses are for the same address root, false otherwise.
+ */
+static bool
+is_same_address_root(cardano_bootstrap_witness_t* lhs, cardano_bootstrap_witness_t* rhs)
+{
+  cardano_ed25519_public_key_t* lhs_vkey       = cardano_bootstrap_witness_get_vkey(lhs);
+  cardano_ed25519_public_key_t* rhs_vkey       = cardano_bootstrap_witness_get_vkey(rhs);
+  cardano_buffer_t*             lhs_chain_code = cardano_bootstrap_witness_get_chain_code(lhs);
+  cardano_buffer_t*             rhs_chain_code = cardano_bootstrap_witness_get_chain_code(rhs);
+  cardano_buffer_t*             lhs_attributes = cardano_bootstrap_witness_get_attributes(lhs);
+  cardano_buffer_t*             rhs_attributes = cardano_bootstrap_witness_get_attributes(rhs);
+
+  cardano_ed25519_public_key_unref(&lhs_vkey);
+  cardano_ed25519_public_key_unref(&rhs_vkey);
+  cardano_buffer_unref(&lhs_chain_code);
+  cardano_buffer_unref(&rhs_chain_code);
+  cardano_buffer_unref(&lhs_attributes);
+  cardano_buffer_unref(&rhs_attributes);
+
+  if ((lhs_vkey == NULL) || (rhs_vkey == NULL))
+  {
+    return false;
+  }
+
+  const size_t lhs_size = cardano_ed25519_public_key_get_bytes_size(lhs_vkey);
+  const size_t rhs_size = cardano_ed25519_public_key_get_bytes_size(rhs_vkey);
+
+  if ((lhs_size != rhs_size) || (memcmp(cardano_ed25519_public_key_get_data(lhs_vkey), cardano_ed25519_public_key_get_data(rhs_vkey), lhs_size) != 0))
+  {
+    return false;
+  }
+
+  return cardano_buffer_equals(lhs_chain_code, rhs_chain_code) && cardano_buffer_equals(lhs_attributes, rhs_attributes);
+}
+
+/**
+ * \brief Determines whether a later witness of the bootstrap witness set is for the same address root as the witness
+ * at the given index.
+ *
+ * \param bootstrap_witness_set The bootstrap witness set to search.
+ * \param index The index of the witness to look for.
+ * \return true if a witness after \p index is for the same address root, false otherwise.
+ */
+static bool
+is_repeated_later(const cardano_bootstrap_witness_set_t* bootstrap_witness_set, const size_t index)
+{
+  cardano_object_t* item  = cardano_array_get(bootstrap_witness_set->array, index);
+  bool              found = false;
+
+  for (size_t i = index + 1U; (i < cardano_array_get_size(bootstrap_witness_set->array)) && !found; ++i)
+  {
+    cardano_object_t* other = cardano_array_get(bootstrap_witness_set->array, i);
+
+    found = is_same_address_root((cardano_bootstrap_witness_t*)((void*)item), (cardano_bootstrap_witness_t*)((void*)other));
+
+    cardano_object_unref(&other);
+  }
+
+  cardano_object_unref(&item);
+
+  return found;
+}
+
+/**
+ * \brief Determines whether the witness at the given index is part of the encoding of the bootstrap witness set.
+ *
+ * A bootstrap witness set decoded from CBOR encodes every witness it was decoded with. Otherwise, a witness followed
+ * by another witness for the same address root is left out, so that the encoding holds one witness per address root
+ * and, as in the ledger, the last one wins.
+ *
+ * \param bootstrap_witness_set The bootstrap witness set being encoded.
+ * \param index The index of the witness.
+ * \return true if the witness is written when the set is encoded, false otherwise.
+ */
+static bool
+is_encoded(const cardano_bootstrap_witness_set_t* bootstrap_witness_set, const size_t index)
+{
+  return bootstrap_witness_set->preserves_duplicates || !is_repeated_later(bootstrap_witness_set, index);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_bootstrap_witness_set_new(cardano_bootstrap_witness_set_t** bootstrap_witness_set)
+{
+  if (bootstrap_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bootstrap_witness_set_t* list = _cardano_malloc(sizeof(cardano_bootstrap_witness_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_bootstrap_witness_set_deallocate;
+
+  list->array                = cardano_array_new(128);
+  list->uses_tags            = true;
+  list->preserves_duplicates = false;
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *bootstrap_witness_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_set_from_cbor(cardano_cbor_reader_t* reader, cardano_bootstrap_witness_set_t** bootstrap_witness_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bootstrap_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bootstrap_witness_set_t* list   = NULL;
+  cardano_error_t                  result = cardano_bootstrap_witness_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_bootstrap_witness_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  list->uses_tags            = (state == CARDANO_CBOR_READER_STATE_TAG);
+  list->preserves_duplicates = true;
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("bootstrap_witness_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_bootstrap_witness_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_bootstrap_witness_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_bootstrap_witness_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_bootstrap_witness_t* element = NULL;
+
+    result = cardano_bootstrap_witness_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_bootstrap_witness_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_bootstrap_witness_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_bootstrap_witness_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("bootstrap_witness_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_bootstrap_witness_set_unref(&list);
+    return result;
+  }
+
+  *bootstrap_witness_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_set_to_cbor(const cardano_bootstrap_witness_set_t* bootstrap_witness_set, cardano_cbor_writer_t* writer)
+{
+  if (bootstrap_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(bootstrap_witness_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (bootstrap_witness_set->uses_tags)
+  {
+    result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  const size_t array_size    = cardano_array_get_size(bootstrap_witness_set->array);
+  size_t       encoded_count = 0U;
+
+  for (size_t i = 0U; i < array_size; ++i)
+  {
+    if (is_encoded(bootstrap_witness_set, i))
+    {
+      ++encoded_count;
+    }
+  }
+
+  result = cardano_cbor_writer_write_start_array(writer, (int64_t)encoded_count);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0U; i < array_size; ++i)
+  {
+    cardano_object_t* element = cardano_array_get(bootstrap_witness_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in bootstrap_witness_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    if (is_encoded(bootstrap_witness_set, i))
+    {
+      result = cardano_bootstrap_witness_to_cbor((cardano_bootstrap_witness_t*)((void*)element), writer);
+    }
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_set_to_cip116_json(
+  const cardano_bootstrap_witness_set_t* witnesses,
+  cardano_json_writer_t*                 writer)
+{
+  if ((witnesses == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t          length = cardano_bootstrap_witness_set_get_length(witnesses);
+  cardano_error_t error  = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_bootstrap_witness_t* witness = NULL;
+    error                                = cardano_bootstrap_witness_set_get(witnesses, i, &witness);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_bootstrap_witness_to_cip116_json(witness, writer);
+    cardano_bootstrap_witness_unref(&witness);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return error;
+}
+
+size_t
+cardano_bootstrap_witness_set_get_length(const cardano_bootstrap_witness_set_t* bootstrap_witness_set)
+{
+  if (bootstrap_witness_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(bootstrap_witness_set->array);
+}
+
+cardano_error_t
+cardano_bootstrap_witness_set_get(
+  const cardano_bootstrap_witness_set_t* bootstrap_witness_set,
+  size_t                                 index,
+  cardano_bootstrap_witness_t**          element)
+{
+  if (bootstrap_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(bootstrap_witness_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_bootstrap_witness_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_set_add(cardano_bootstrap_witness_set_t* bootstrap_witness_set, cardano_bootstrap_witness_t* element)
+{
+  if (bootstrap_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ed25519_signature_t* sig = cardano_bootstrap_witness_get_signature(element);
+
+  cardano_ed25519_signature_unref(&sig);
+
+  if (sig == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  bool found = false;
+
+  for (size_t i = 0U; i < cardano_array_get_size(bootstrap_witness_set->array); ++i)
+  {
+    cardano_object_t* item = cardano_array_get(bootstrap_witness_set->array, i);
+
+    cardano_bootstrap_witness_t* witness = (cardano_bootstrap_witness_t*)((void*)item);
+    cardano_object_unref(&item);
+
+    if (is_same_address_root(witness, element))
+    {
+      cardano_error_t result = cardano_bootstrap_witness_set_signature(witness, sig);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      found = true;
+    }
+  }
+
+  if (!found)
+  {
+    const size_t original_size = cardano_array_get_size(bootstrap_witness_set->array);
+    const size_t new_size      = cardano_array_push(bootstrap_witness_set->array, (cardano_object_t*)((void*)element));
+
+    if (new_size != (original_size + 1U))
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  bootstrap_witness_set->preserves_duplicates = false;
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_bootstrap_witness_set_get_use_tag(const cardano_bootstrap_witness_set_t* bootstrap_witness_set)
+{
+  if (bootstrap_witness_set == NULL)
+  {
+    return false;
+  }
+
+  return bootstrap_witness_set->uses_tags;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_set_set_use_tag(cardano_bootstrap_witness_set_t* bootstrap_witness_set, const bool use_tag)
+{
+  if (bootstrap_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  bootstrap_witness_set->uses_tags = use_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_bootstrap_witness_set_clear_cbor_cache(cardano_bootstrap_witness_set_t* bootstrap_witness_set)
+{
+  if (bootstrap_witness_set == NULL)
+  {
+    return;
+  }
+
+  bootstrap_witness_set->uses_tags            = true;
+  bootstrap_witness_set->preserves_duplicates = false;
+}
+
+void
+cardano_bootstrap_witness_set_unref(cardano_bootstrap_witness_set_t** bootstrap_witness_set)
+{
+  if ((bootstrap_witness_set == NULL) || (*bootstrap_witness_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*bootstrap_witness_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *bootstrap_witness_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_bootstrap_witness_set_ref(cardano_bootstrap_witness_set_t* bootstrap_witness_set)
+{
+  if (bootstrap_witness_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&bootstrap_witness_set->base);
+}
+
+size_t
+cardano_bootstrap_witness_set_refcount(const cardano_bootstrap_witness_set_t* bootstrap_witness_set)
+{
+  if (bootstrap_witness_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&bootstrap_witness_set->base);
+}
+
+void
+cardano_bootstrap_witness_set_set_last_error(cardano_bootstrap_witness_set_t* bootstrap_witness_set, const char* message)
+{
+  cardano_object_set_last_error(&bootstrap_witness_set->base, message);
+}
+
+const char*
+cardano_bootstrap_witness_set_get_last_error(const cardano_bootstrap_witness_set_t* bootstrap_witness_set)
+{
+  return cardano_object_get_last_error(&bootstrap_witness_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_bootstrap_witness_t* copy   = NULL;
+  const cardano_error_t        result = cardano_bootstrap_witness_deep_clone((const cardano_bootstrap_witness_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_bootstrap_witness_set_deep_clone(const cardano_bootstrap_witness_set_t* source, cardano_bootstrap_witness_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_bootstrap_witness_set_t* copy = _cardano_malloc(sizeof(cardano_bootstrap_witness_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count       = 1U;
+  copy->base.deallocator     = source->base.deallocator;
+  copy->base.last_error[0]   = '\0';
+  copy->array                = NULL;
+  copy->uses_tags            = source->uses_tags;
+  copy->preserves_duplicates = source->preserves_duplicates;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/native_script_set.c b/vendor/src/witness_set/native_script_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/native_script_set.c
@@ -0,0 +1,505 @@
+/**
+ * \file native_script_set.c
+ *
+ * \author angel.castillo
+ * \date   Aug 15, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/witness_set/native_script_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano native_script_set list.
+ */
+typedef struct cardano_native_script_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             uses_tags;
+} cardano_native_script_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a native_script_set list object.
+ *
+ * This function is responsible for properly deallocating a native_script_set list object (`cardano_native_script_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the native_script_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_native_script_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the native_script_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_native_script_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_native_script_set_t* list = (cardano_native_script_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_native_script_set_new(cardano_native_script_set_t** native_script_set)
+{
+  if (native_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_set_t* list = _cardano_malloc(sizeof(cardano_native_script_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_native_script_set_deallocate;
+  list->uses_tags          = true;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *native_script_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_set_from_cbor(cardano_cbor_reader_t* reader, cardano_native_script_set_t** native_script_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_set_t* list   = NULL;
+  cardano_error_t              result = cardano_native_script_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_native_script_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  list->uses_tags = (state == CARDANO_CBOR_READER_STATE_TAG);
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("native_script_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_native_script_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_native_script_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_native_script_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_native_script_t* element = NULL;
+
+    result = cardano_native_script_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_native_script_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_native_script_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_native_script_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("native_script_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_native_script_set_unref(&list);
+    return result;
+  }
+
+  *native_script_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_set_to_cbor(const cardano_native_script_set_t* native_script_set, cardano_cbor_writer_t* writer)
+{
+  if (native_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(native_script_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (native_script_set->uses_tags)
+  {
+    result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  size_t array_size = cardano_array_get_size(native_script_set->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(native_script_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(native_script_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in native_script_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_native_script_to_cbor((cardano_native_script_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_native_script_set_to_cip116_json(
+  const cardano_native_script_set_t* scripts,
+  cardano_json_writer_t*             writer)
+{
+  if ((scripts == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t          length = cardano_native_script_set_get_length(scripts);
+  cardano_error_t error  = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_native_script_t* script = NULL;
+    error                           = cardano_native_script_set_get(scripts, i, &script);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_native_script_to_cip116_json(script, writer);
+    cardano_native_script_unref(&script);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return error;
+}
+
+size_t
+cardano_native_script_set_get_length(const cardano_native_script_set_t* native_script_set)
+{
+  if (native_script_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(native_script_set->array);
+}
+
+cardano_error_t
+cardano_native_script_set_get(
+  const cardano_native_script_set_t* native_script_set,
+  size_t                             index,
+  cardano_native_script_t**          element)
+{
+  if (native_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(native_script_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_native_script_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_native_script_set_add(cardano_native_script_set_t* native_script_set, cardano_native_script_t* element)
+{
+  if (native_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(native_script_set->array);
+  const size_t new_size      = cardano_array_push(native_script_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_native_script_set_get_use_tag(const cardano_native_script_set_t* native_script)
+{
+  if (native_script == NULL)
+  {
+    return false;
+  }
+
+  return native_script->uses_tags;
+}
+
+cardano_error_t
+cardano_native_script_set_set_use_tag(cardano_native_script_set_t* native_script, const bool use_tag)
+{
+  if (native_script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  native_script->uses_tags = use_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_native_script_set_unref(cardano_native_script_set_t** native_script_set)
+{
+  if ((native_script_set == NULL) || (*native_script_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*native_script_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *native_script_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_native_script_set_ref(cardano_native_script_set_t* native_script_set)
+{
+  if (native_script_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&native_script_set->base);
+}
+
+size_t
+cardano_native_script_set_refcount(const cardano_native_script_set_t* native_script_set)
+{
+  if (native_script_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&native_script_set->base);
+}
+
+void
+cardano_native_script_set_set_last_error(cardano_native_script_set_t* native_script_set, const char* message)
+{
+  cardano_object_set_last_error(&native_script_set->base, message);
+}
+
+const char*
+cardano_native_script_set_get_last_error(const cardano_native_script_set_t* native_script_set)
+{
+  return cardano_object_get_last_error(&native_script_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_native_script_t* copy   = NULL;
+  const cardano_error_t    result = cardano_native_script_deep_clone((const cardano_native_script_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_native_script_set_deep_clone(const cardano_native_script_set_t* source, cardano_native_script_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_native_script_set_t* copy = _cardano_malloc(sizeof(cardano_native_script_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+  copy->uses_tags          = source->uses_tags;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/plutus_data_set.c b/vendor/src/witness_set/plutus_data_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/plutus_data_set.c
@@ -0,0 +1,562 @@
+/**
+ * \file plutus_data_set.c
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/witness_set/plutus_data_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus_data_set list.
+ */
+typedef struct cardano_plutus_data_set_t
+{
+    cardano_object_t  base;
+    cardano_array_t*  array;
+    bool              uses_tags;
+    cardano_buffer_t* cbor_cache;
+} cardano_plutus_data_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus_data_set list object.
+ *
+ * This function is responsible for properly deallocating a plutus_data_set list object (`cardano_plutus_data_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus_data_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_data_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_data_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_data_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_data_set_t* list = (cardano_plutus_data_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  if (list->cbor_cache != NULL)
+  {
+    cardano_buffer_unref(&list->cbor_cache);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_data_set_new(cardano_plutus_data_set_t** plutus_data_set)
+{
+  if (plutus_data_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_set_t* list = _cardano_malloc(sizeof(cardano_plutus_data_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_plutus_data_set_deallocate;
+  list->cbor_cache         = NULL;
+  list->uses_tags          = true;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *plutus_data_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_set_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_data_set_t** plutus_data_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_set_t* list   = NULL;
+  cardano_error_t            result = cardano_plutus_data_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        copy_result = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_set_unref(&list);
+
+    return copy_result;
+  }
+
+  copy_result = cardano_cbor_reader_read_encoded_value(reader_copy, &list->cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_set_unref(&list);
+
+    *plutus_data_set = NULL;
+    return copy_result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  list->uses_tags = (state == CARDANO_CBOR_READER_STATE_TAG);
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("plutus_data_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_data_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_data_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_plutus_data_t* element = NULL;
+
+    result = cardano_plutus_data_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_data_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_plutus_data_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_plutus_data_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("plutus_data_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_data_set_unref(&list);
+    return result;
+  }
+
+  *plutus_data_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_set_to_cbor(const cardano_plutus_data_set_t* plutus_data_set, cardano_cbor_writer_t* writer)
+{
+  if (plutus_data_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(plutus_data_set->array != NULL);
+
+  if (plutus_data_set->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(plutus_data_set->cbor_cache), cardano_buffer_get_size(plutus_data_set->cbor_cache));
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (plutus_data_set->uses_tags)
+  {
+    result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  size_t array_size = cardano_array_get_size(plutus_data_set->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_data_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(plutus_data_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in plutus_data_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_plutus_data_to_cbor((cardano_plutus_data_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_data_set_to_cip116_json(
+  const cardano_plutus_data_set_t* set,
+  cardano_json_writer_t*           writer)
+{
+  if ((set == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t len = cardano_plutus_data_set_get_length(set);
+
+  for (size_t i = 0; i < len; ++i)
+  {
+    cardano_plutus_data_t* data  = NULL;
+    cardano_error_t        error = cardano_plutus_data_set_get(set, i, &data);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_plutus_data_to_cip116_json(data, writer);
+    cardano_plutus_data_unref(&data);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_plutus_data_set_get_length(const cardano_plutus_data_set_t* plutus_data_set)
+{
+  if (plutus_data_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(plutus_data_set->array);
+}
+
+cardano_error_t
+cardano_plutus_data_set_get(
+  const cardano_plutus_data_set_t* plutus_data_set,
+  size_t                           index,
+  cardano_plutus_data_t**          element)
+{
+  if (plutus_data_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(plutus_data_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_plutus_data_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_data_set_add(cardano_plutus_data_set_t* plutus_data_set, cardano_plutus_data_t* element)
+{
+  if (plutus_data_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(plutus_data_set->array);
+  const size_t new_size      = cardano_array_push(plutus_data_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_plutus_data_set_get_use_tag(const cardano_plutus_data_set_t* plutus_data_set)
+{
+  if (plutus_data_set == NULL)
+  {
+    return false;
+  }
+
+  return plutus_data_set->uses_tags;
+}
+
+cardano_error_t
+cardano_plutus_data_set_set_use_tag(cardano_plutus_data_set_t* plutus_data_set, const bool use_tag)
+{
+  if (plutus_data_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  plutus_data_set->uses_tags = use_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_plutus_data_set_clear_cbor_cache(cardano_plutus_data_set_t* plutus_data_set)
+{
+  if (plutus_data_set == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&plutus_data_set->cbor_cache);
+  plutus_data_set->cbor_cache = NULL;
+  plutus_data_set->uses_tags  = true;
+}
+
+void
+cardano_plutus_data_set_unref(cardano_plutus_data_set_t** plutus_data_set)
+{
+  if ((plutus_data_set == NULL) || (*plutus_data_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_data_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_data_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_data_set_ref(cardano_plutus_data_set_t* plutus_data_set)
+{
+  if (plutus_data_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_data_set->base);
+}
+
+size_t
+cardano_plutus_data_set_refcount(const cardano_plutus_data_set_t* plutus_data_set)
+{
+  if (plutus_data_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_data_set->base);
+}
+
+void
+cardano_plutus_data_set_set_last_error(cardano_plutus_data_set_t* plutus_data_set, const char* message)
+{
+  cardano_object_set_last_error(&plutus_data_set->base, message);
+}
+
+const char*
+cardano_plutus_data_set_get_last_error(const cardano_plutus_data_set_t* plutus_data_set)
+{
+  return cardano_object_get_last_error(&plutus_data_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_plutus_data_t* copy   = NULL;
+  const cardano_error_t  result = cardano_plutus_data_deep_clone((const cardano_plutus_data_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_data_set_deep_clone(const cardano_plutus_data_set_t* source, cardano_plutus_data_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_set_t* copy = _cardano_malloc(sizeof(cardano_plutus_data_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+  copy->uses_tags          = source->uses_tags;
+  copy->cbor_cache         = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/plutus_v1_script_set.c b/vendor/src/witness_set/plutus_v1_script_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/plutus_v1_script_set.c
@@ -0,0 +1,505 @@
+/**
+ * \file plutus_v1_script_set.c
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/witness_set/plutus_v1_script_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus_v1_script_set list.
+ */
+typedef struct cardano_plutus_v1_script_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             uses_tags;
+} cardano_plutus_v1_script_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus_v1_script_set list object.
+ *
+ * This function is responsible for properly deallocating a plutus_v1_script_set list object (`cardano_plutus_v1_script_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus_v1_script_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v1_script_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_v1_script_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v1_script_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v1_script_set_t* list = (cardano_plutus_v1_script_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v1_script_set_new(cardano_plutus_v1_script_set_t** plutus_v1_script_set)
+{
+  if (plutus_v1_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v1_script_set_t* list = _cardano_malloc(sizeof(cardano_plutus_v1_script_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_plutus_v1_script_set_deallocate;
+  list->uses_tags          = true;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *plutus_v1_script_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_set_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v1_script_set_t** plutus_v1_script_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v1_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v1_script_set_t* list   = NULL;
+  cardano_error_t                 result = cardano_plutus_v1_script_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v1_script_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  list->uses_tags = (state == CARDANO_CBOR_READER_STATE_TAG);
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("plutus_v1_script_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v1_script_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v1_script_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v1_script_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_plutus_v1_script_t* element = NULL;
+
+    result = cardano_plutus_v1_script_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v1_script_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_plutus_v1_script_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_plutus_v1_script_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("plutus_v1_script_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v1_script_set_unref(&list);
+    return result;
+  }
+
+  *plutus_v1_script_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_set_to_cbor(const cardano_plutus_v1_script_set_t* plutus_v1_script_set, cardano_cbor_writer_t* writer)
+{
+  if (plutus_v1_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(plutus_v1_script_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (plutus_v1_script_set->uses_tags)
+  {
+    result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  size_t array_size = cardano_array_get_size(plutus_v1_script_set->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_v1_script_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(plutus_v1_script_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in plutus_v1_script_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_plutus_v1_script_to_cbor((cardano_plutus_v1_script_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_set_to_cip116_json(
+  const cardano_plutus_v1_script_set_t* plutus_v1_scripts,
+  cardano_json_writer_t*                writer)
+{
+  if ((plutus_v1_scripts == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  const size_t count = cardano_plutus_v1_script_set_get_length(plutus_v1_scripts);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    cardano_plutus_v1_script_t* script = NULL;
+
+    cardano_error_t error = cardano_plutus_v1_script_set_get(plutus_v1_scripts, i, &script);
+
+    assert(error == CARDANO_SUCCESS);
+    CARDANO_UNUSED(error);
+
+    error = cardano_plutus_v1_script_to_cip116_json(script, writer);
+
+    cardano_plutus_v1_script_unref(&script);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_json_writer_set_last_error(writer, "Failed to serialize Plutus v1 script to CIP-116 JSON.");
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_plutus_v1_script_set_get_length(const cardano_plutus_v1_script_set_t* plutus_v1_script_set)
+{
+  if (plutus_v1_script_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(plutus_v1_script_set->array);
+}
+
+cardano_error_t
+cardano_plutus_v1_script_set_get(
+  const cardano_plutus_v1_script_set_t* plutus_v1_script_set,
+  size_t                                index,
+  cardano_plutus_v1_script_t**          element)
+{
+  if (plutus_v1_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(plutus_v1_script_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_plutus_v1_script_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_set_add(cardano_plutus_v1_script_set_t* plutus_v1_script_set, cardano_plutus_v1_script_t* element)
+{
+  if (plutus_v1_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(plutus_v1_script_set->array);
+  const size_t new_size      = cardano_array_push(plutus_v1_script_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_plutus_v1_script_set_get_use_tag(const cardano_plutus_v1_script_set_t* plutus_v1_script_set)
+{
+  if (plutus_v1_script_set == NULL)
+  {
+    return false;
+  }
+
+  return plutus_v1_script_set->uses_tags;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_set_set_use_tag(cardano_plutus_v1_script_set_t* plutus_v1_script_set, const bool use_tag)
+{
+  if (plutus_v1_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  plutus_v1_script_set->uses_tags = use_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_plutus_v1_script_set_unref(cardano_plutus_v1_script_set_t** plutus_v1_script_set)
+{
+  if ((plutus_v1_script_set == NULL) || (*plutus_v1_script_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v1_script_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v1_script_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v1_script_set_ref(cardano_plutus_v1_script_set_t* plutus_v1_script_set)
+{
+  if (plutus_v1_script_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v1_script_set->base);
+}
+
+size_t
+cardano_plutus_v1_script_set_refcount(const cardano_plutus_v1_script_set_t* plutus_v1_script_set)
+{
+  if (plutus_v1_script_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v1_script_set->base);
+}
+
+void
+cardano_plutus_v1_script_set_set_last_error(cardano_plutus_v1_script_set_t* plutus_v1_script_set, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v1_script_set->base, message);
+}
+
+const char*
+cardano_plutus_v1_script_set_get_last_error(const cardano_plutus_v1_script_set_t* plutus_v1_script_set)
+{
+  return cardano_object_get_last_error(&plutus_v1_script_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_plutus_v1_script_t* copy   = NULL;
+  const cardano_error_t       result = cardano_plutus_v1_script_deep_clone((const cardano_plutus_v1_script_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v1_script_set_deep_clone(const cardano_plutus_v1_script_set_t* source, cardano_plutus_v1_script_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v1_script_set_t* copy = _cardano_malloc(sizeof(cardano_plutus_v1_script_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+  copy->uses_tags          = source->uses_tags;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/plutus_v2_script_set.c b/vendor/src/witness_set/plutus_v2_script_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/plutus_v2_script_set.c
@@ -0,0 +1,505 @@
+/**
+ * \file plutus_v2_script_set.c
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/witness_set/plutus_v2_script_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus_v2_script_set list.
+ */
+typedef struct cardano_plutus_v2_script_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             uses_tags;
+} cardano_plutus_v2_script_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus_v2_script_set list object.
+ *
+ * This function is responsible for properly deallocating a plutus_v2_script_set list object (`cardano_plutus_v2_script_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus_v2_script_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v2_script_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_v2_script_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v2_script_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v2_script_set_t* list = (cardano_plutus_v2_script_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v2_script_set_new(cardano_plutus_v2_script_set_t** plutus_v2_script_set)
+{
+  if (plutus_v2_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v2_script_set_t* list = _cardano_malloc(sizeof(cardano_plutus_v2_script_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_plutus_v2_script_set_deallocate;
+  list->uses_tags          = true;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *plutus_v2_script_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_set_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v2_script_set_t** plutus_v2_script_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v2_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v2_script_set_t* list   = NULL;
+  cardano_error_t                 result = cardano_plutus_v2_script_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v2_script_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  list->uses_tags = (state == CARDANO_CBOR_READER_STATE_TAG);
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("plutus_v2_script_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v2_script_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v2_script_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v2_script_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_plutus_v2_script_t* element = NULL;
+
+    result = cardano_plutus_v2_script_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v2_script_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_plutus_v2_script_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_plutus_v2_script_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("plutus_v2_script_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v2_script_set_unref(&list);
+    return result;
+  }
+
+  *plutus_v2_script_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_set_to_cbor(const cardano_plutus_v2_script_set_t* plutus_v2_script_set, cardano_cbor_writer_t* writer)
+{
+  if (plutus_v2_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(plutus_v2_script_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (plutus_v2_script_set->uses_tags)
+  {
+    result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  size_t array_size = cardano_array_get_size(plutus_v2_script_set->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_v2_script_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(plutus_v2_script_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in plutus_v2_script_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_plutus_v2_script_to_cbor((cardano_plutus_v2_script_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_set_to_cip116_json(
+  const cardano_plutus_v2_script_set_t* plutus_v2_scripts,
+  cardano_json_writer_t*                writer)
+{
+  if ((plutus_v2_scripts == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  const size_t count = cardano_plutus_v2_script_set_get_length(plutus_v2_scripts);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    cardano_plutus_v2_script_t* script = NULL;
+
+    cardano_error_t error = cardano_plutus_v2_script_set_get(plutus_v2_scripts, i, &script);
+
+    assert(error == CARDANO_SUCCESS);
+    CARDANO_UNUSED(error);
+
+    error = cardano_plutus_v2_script_to_cip116_json(script, writer);
+
+    cardano_plutus_v2_script_unref(&script);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_json_writer_set_last_error(writer, "Failed to serialize Plutus v2 script to CIP-116 JSON.");
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_plutus_v2_script_set_get_length(const cardano_plutus_v2_script_set_t* plutus_v2_script_set)
+{
+  if (plutus_v2_script_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(plutus_v2_script_set->array);
+}
+
+cardano_error_t
+cardano_plutus_v2_script_set_get(
+  const cardano_plutus_v2_script_set_t* plutus_v2_script_set,
+  size_t                                index,
+  cardano_plutus_v2_script_t**          element)
+{
+  if (plutus_v2_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(plutus_v2_script_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_plutus_v2_script_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_set_add(cardano_plutus_v2_script_set_t* plutus_v2_script_set, cardano_plutus_v2_script_t* element)
+{
+  if (plutus_v2_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(plutus_v2_script_set->array);
+  const size_t new_size      = cardano_array_push(plutus_v2_script_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_plutus_v2_script_set_get_use_tag(const cardano_plutus_v2_script_set_t* plutus_v2_script_set)
+{
+  if (plutus_v2_script_set == NULL)
+  {
+    return false;
+  }
+
+  return plutus_v2_script_set->uses_tags;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_set_set_use_tag(cardano_plutus_v2_script_set_t* plutus_v2_script_set, const bool use_tag)
+{
+  if (plutus_v2_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  plutus_v2_script_set->uses_tags = use_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_plutus_v2_script_set_unref(cardano_plutus_v2_script_set_t** plutus_v2_script_set)
+{
+  if ((plutus_v2_script_set == NULL) || (*plutus_v2_script_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v2_script_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v2_script_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v2_script_set_ref(cardano_plutus_v2_script_set_t* plutus_v2_script_set)
+{
+  if (plutus_v2_script_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v2_script_set->base);
+}
+
+size_t
+cardano_plutus_v2_script_set_refcount(const cardano_plutus_v2_script_set_t* plutus_v2_script_set)
+{
+  if (plutus_v2_script_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v2_script_set->base);
+}
+
+void
+cardano_plutus_v2_script_set_set_last_error(cardano_plutus_v2_script_set_t* plutus_v2_script_set, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v2_script_set->base, message);
+}
+
+const char*
+cardano_plutus_v2_script_set_get_last_error(const cardano_plutus_v2_script_set_t* plutus_v2_script_set)
+{
+  return cardano_object_get_last_error(&plutus_v2_script_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_plutus_v2_script_t* copy   = NULL;
+  const cardano_error_t       result = cardano_plutus_v2_script_deep_clone((const cardano_plutus_v2_script_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v2_script_set_deep_clone(const cardano_plutus_v2_script_set_t* source, cardano_plutus_v2_script_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v2_script_set_t* copy = _cardano_malloc(sizeof(cardano_plutus_v2_script_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+  copy->uses_tags          = source->uses_tags;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/plutus_v3_script_set.c b/vendor/src/witness_set/plutus_v3_script_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/plutus_v3_script_set.c
@@ -0,0 +1,505 @@
+/**
+ * \file plutus_v3_script_set.c
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/witness_set/plutus_v3_script_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus_v3_script_set list.
+ */
+typedef struct cardano_plutus_v3_script_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             uses_tags;
+} cardano_plutus_v3_script_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus_v3_script_set list object.
+ *
+ * This function is responsible for properly deallocating a plutus_v3_script_set list object (`cardano_plutus_v3_script_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus_v3_script_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v3_script_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_v3_script_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v3_script_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v3_script_set_t* list = (cardano_plutus_v3_script_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v3_script_set_new(cardano_plutus_v3_script_set_t** plutus_v3_script_set)
+{
+  if (plutus_v3_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v3_script_set_t* list = _cardano_malloc(sizeof(cardano_plutus_v3_script_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_plutus_v3_script_set_deallocate;
+  list->uses_tags          = true;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *plutus_v3_script_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_set_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v3_script_set_t** plutus_v3_script_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v3_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v3_script_set_t* list   = NULL;
+  cardano_error_t                 result = cardano_plutus_v3_script_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v3_script_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  list->uses_tags = (state == CARDANO_CBOR_READER_STATE_TAG);
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("plutus_v3_script_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v3_script_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v3_script_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v3_script_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_plutus_v3_script_t* element = NULL;
+
+    result = cardano_plutus_v3_script_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v3_script_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_plutus_v3_script_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_plutus_v3_script_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("plutus_v3_script_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v3_script_set_unref(&list);
+    return result;
+  }
+
+  *plutus_v3_script_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_set_to_cbor(const cardano_plutus_v3_script_set_t* plutus_v3_script_set, cardano_cbor_writer_t* writer)
+{
+  if (plutus_v3_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(plutus_v3_script_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (plutus_v3_script_set->uses_tags)
+  {
+    result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  size_t array_size = cardano_array_get_size(plutus_v3_script_set->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_v3_script_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(plutus_v3_script_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in plutus_v3_script_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_plutus_v3_script_to_cbor((cardano_plutus_v3_script_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_set_to_cip116_json(
+  const cardano_plutus_v3_script_set_t* plutus_v3_scripts,
+  cardano_json_writer_t*                writer)
+{
+  if ((plutus_v3_scripts == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  const size_t count = cardano_plutus_v3_script_set_get_length(plutus_v3_scripts);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    cardano_plutus_v3_script_t* script = NULL;
+
+    cardano_error_t error = cardano_plutus_v3_script_set_get(plutus_v3_scripts, i, &script);
+
+    assert(error == CARDANO_SUCCESS);
+    CARDANO_UNUSED(error);
+
+    error = cardano_plutus_v3_script_to_cip116_json(script, writer);
+
+    cardano_plutus_v3_script_unref(&script);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_json_writer_set_last_error(writer, "Failed to serialize Plutus v3 script to CIP-116 JSON.");
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_plutus_v3_script_set_get_length(const cardano_plutus_v3_script_set_t* plutus_v3_script_set)
+{
+  if (plutus_v3_script_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(plutus_v3_script_set->array);
+}
+
+cardano_error_t
+cardano_plutus_v3_script_set_get(
+  const cardano_plutus_v3_script_set_t* plutus_v3_script_set,
+  size_t                                index,
+  cardano_plutus_v3_script_t**          element)
+{
+  if (plutus_v3_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(plutus_v3_script_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_plutus_v3_script_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_set_add(cardano_plutus_v3_script_set_t* plutus_v3_script_set, cardano_plutus_v3_script_t* element)
+{
+  if (plutus_v3_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(plutus_v3_script_set->array);
+  const size_t new_size      = cardano_array_push(plutus_v3_script_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_plutus_v3_script_set_get_use_tag(const cardano_plutus_v3_script_set_t* plutus_v3_script_set)
+{
+  if (plutus_v3_script_set == NULL)
+  {
+    return false;
+  }
+
+  return plutus_v3_script_set->uses_tags;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_set_set_use_tag(cardano_plutus_v3_script_set_t* plutus_v3_script_set, const bool use_tag)
+{
+  if (plutus_v3_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  plutus_v3_script_set->uses_tags = use_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_plutus_v3_script_set_unref(cardano_plutus_v3_script_set_t** plutus_v3_script_set)
+{
+  if ((plutus_v3_script_set == NULL) || (*plutus_v3_script_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v3_script_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v3_script_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v3_script_set_ref(cardano_plutus_v3_script_set_t* plutus_v3_script_set)
+{
+  if (plutus_v3_script_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v3_script_set->base);
+}
+
+size_t
+cardano_plutus_v3_script_set_refcount(const cardano_plutus_v3_script_set_t* plutus_v3_script_set)
+{
+  if (plutus_v3_script_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v3_script_set->base);
+}
+
+void
+cardano_plutus_v3_script_set_set_last_error(cardano_plutus_v3_script_set_t* plutus_v3_script_set, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v3_script_set->base, message);
+}
+
+const char*
+cardano_plutus_v3_script_set_get_last_error(const cardano_plutus_v3_script_set_t* plutus_v3_script_set)
+{
+  return cardano_object_get_last_error(&plutus_v3_script_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_plutus_v3_script_t* copy   = NULL;
+  const cardano_error_t       result = cardano_plutus_v3_script_deep_clone((const cardano_plutus_v3_script_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v3_script_set_deep_clone(const cardano_plutus_v3_script_set_t* source, cardano_plutus_v3_script_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v3_script_set_t* copy = _cardano_malloc(sizeof(cardano_plutus_v3_script_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+  copy->uses_tags          = source->uses_tags;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/plutus_v4_script_set.c b/vendor/src/witness_set/plutus_v4_script_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/plutus_v4_script_set.c
@@ -0,0 +1,505 @@
+/**
+ * \file plutus_v4_script_set.c
+ *
+ * \author angel.castillo
+ * \date   Oct 27, 2026
+ *
+ * Copyright 2026 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/witness_set/plutus_v4_script_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano plutus_v4_script_set list.
+ */
+typedef struct cardano_plutus_v4_script_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             uses_tags;
+} cardano_plutus_v4_script_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a plutus_v4_script_set list object.
+ *
+ * This function is responsible for properly deallocating a plutus_v4_script_set list object (`cardano_plutus_v4_script_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the plutus_v4_script_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_plutus_v4_script_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the plutus_v4_script_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_plutus_v4_script_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_plutus_v4_script_set_t* list = (cardano_plutus_v4_script_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_plutus_v4_script_set_new(cardano_plutus_v4_script_set_t** plutus_v4_script_set)
+{
+  if (plutus_v4_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v4_script_set_t* list = _cardano_malloc(sizeof(cardano_plutus_v4_script_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_plutus_v4_script_set_deallocate;
+  list->uses_tags          = true;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *plutus_v4_script_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_set_from_cbor(cardano_cbor_reader_t* reader, cardano_plutus_v4_script_set_t** plutus_v4_script_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_v4_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v4_script_set_t* list   = NULL;
+  cardano_error_t                 result = cardano_plutus_v4_script_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v4_script_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  list->uses_tags = (state == CARDANO_CBOR_READER_STATE_TAG);
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("plutus_v4_script_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v4_script_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v4_script_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v4_script_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_plutus_v4_script_t* element = NULL;
+
+    result = cardano_plutus_v4_script_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_plutus_v4_script_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_plutus_v4_script_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_plutus_v4_script_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("plutus_v4_script_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_plutus_v4_script_set_unref(&list);
+    return result;
+  }
+
+  *plutus_v4_script_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_set_to_cbor(const cardano_plutus_v4_script_set_t* plutus_v4_script_set, cardano_cbor_writer_t* writer)
+{
+  if (plutus_v4_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(plutus_v4_script_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (plutus_v4_script_set->uses_tags)
+  {
+    result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  size_t array_size = cardano_array_get_size(plutus_v4_script_set->array);
+  result            = cardano_cbor_writer_write_start_array(writer, (int64_t)array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(plutus_v4_script_set->array); ++i)
+  {
+    cardano_object_t* element = cardano_array_get(plutus_v4_script_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in plutus_v4_script_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    result = cardano_plutus_v4_script_to_cbor((cardano_plutus_v4_script_t*)((void*)element), writer);
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_set_to_cip116_json(
+  const cardano_plutus_v4_script_set_t* plutus_v4_scripts,
+  cardano_json_writer_t*                writer)
+{
+  if ((plutus_v4_scripts == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  const size_t count = cardano_plutus_v4_script_set_get_length(plutus_v4_scripts);
+
+  for (size_t i = 0; i < count; ++i)
+  {
+    cardano_plutus_v4_script_t* script = NULL;
+
+    cardano_error_t error = cardano_plutus_v4_script_set_get(plutus_v4_scripts, i, &script);
+
+    assert(error == CARDANO_SUCCESS);
+    CARDANO_UNUSED(error);
+
+    error = cardano_plutus_v4_script_to_cip116_json(script, writer);
+
+    cardano_plutus_v4_script_unref(&script);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      cardano_json_writer_set_last_error(writer, "Failed to serialize Plutus v4 script to CIP-116 JSON.");
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_plutus_v4_script_set_get_length(const cardano_plutus_v4_script_set_t* plutus_v4_script_set)
+{
+  if (plutus_v4_script_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(plutus_v4_script_set->array);
+}
+
+cardano_error_t
+cardano_plutus_v4_script_set_get(
+  const cardano_plutus_v4_script_set_t* plutus_v4_script_set,
+  size_t                                index,
+  cardano_plutus_v4_script_t**          element)
+{
+  if (plutus_v4_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(plutus_v4_script_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_plutus_v4_script_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_set_add(cardano_plutus_v4_script_set_t* plutus_v4_script_set, cardano_plutus_v4_script_t* element)
+{
+  if (plutus_v4_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(plutus_v4_script_set->array);
+  const size_t new_size      = cardano_array_push(plutus_v4_script_set->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_plutus_v4_script_set_get_use_tag(const cardano_plutus_v4_script_set_t* plutus_v4_script_set)
+{
+  if (plutus_v4_script_set == NULL)
+  {
+    return false;
+  }
+
+  return plutus_v4_script_set->uses_tags;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_set_set_use_tag(cardano_plutus_v4_script_set_t* plutus_v4_script_set, const bool use_tag)
+{
+  if (plutus_v4_script_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  plutus_v4_script_set->uses_tags = use_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_plutus_v4_script_set_unref(cardano_plutus_v4_script_set_t** plutus_v4_script_set)
+{
+  if ((plutus_v4_script_set == NULL) || (*plutus_v4_script_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*plutus_v4_script_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *plutus_v4_script_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_plutus_v4_script_set_ref(cardano_plutus_v4_script_set_t* plutus_v4_script_set)
+{
+  if (plutus_v4_script_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&plutus_v4_script_set->base);
+}
+
+size_t
+cardano_plutus_v4_script_set_refcount(const cardano_plutus_v4_script_set_t* plutus_v4_script_set)
+{
+  if (plutus_v4_script_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&plutus_v4_script_set->base);
+}
+
+void
+cardano_plutus_v4_script_set_set_last_error(cardano_plutus_v4_script_set_t* plutus_v4_script_set, const char* message)
+{
+  cardano_object_set_last_error(&plutus_v4_script_set->base, message);
+}
+
+const char*
+cardano_plutus_v4_script_set_get_last_error(const cardano_plutus_v4_script_set_t* plutus_v4_script_set)
+{
+  return cardano_object_get_last_error(&plutus_v4_script_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_plutus_v4_script_t* copy   = NULL;
+  const cardano_error_t       result = cardano_plutus_v4_script_deep_clone((const cardano_plutus_v4_script_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_plutus_v4_script_set_deep_clone(const cardano_plutus_v4_script_set_t* source, cardano_plutus_v4_script_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_v4_script_set_t* copy = _cardano_malloc(sizeof(cardano_plutus_v4_script_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+  copy->uses_tags          = source->uses_tags;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/redeemer.c b/vendor/src/witness_set/redeemer.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/redeemer.c
@@ -0,0 +1,640 @@
+/**
+ * \file redeemer.c
+ *
+ * \author angel.castillo
+ * \date   Sep 21, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/witness_set/redeemer.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../string_safe.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t REDEEMER_EMBEDDED_GROUP_SIZE = 4;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * The Redeemer is an argument provided to a Plutus smart contract (script) when
+ * you are attempting to redeem a UTxO that's protected by that script.
+ */
+typedef struct cardano_redeemer_t
+{
+    cardano_object_t       base;
+    cardano_redeemer_tag_t tag;
+    uint64_t               index;
+    cardano_plutus_data_t* data;
+    cardano_ex_units_t*    execution_units;
+    cardano_buffer_t*      cbor_cache;
+} cardano_redeemer_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a redeemer object.
+ *
+ * This function is responsible for properly deallocating a redeemer object (`cardano_redeemer_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the redeemer object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_redeemer_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the redeemer
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_redeemer_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_redeemer_t* redeemer = (cardano_redeemer_t*)object;
+
+  cardano_plutus_data_unref(&redeemer->data);
+  cardano_ex_units_unref(&redeemer->execution_units);
+  cardano_buffer_unref(&redeemer->cbor_cache);
+
+  _cardano_free(object);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_redeemer_new(
+  const cardano_redeemer_tag_t tag,
+  const uint64_t               index,
+  cardano_plutus_data_t*       data,
+  cardano_ex_units_t*          ex_units,
+  cardano_redeemer_t**         redeemer)
+{
+  if (redeemer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (ex_units == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *redeemer = (cardano_redeemer_t*)_cardano_malloc(sizeof(cardano_redeemer_t));
+
+  if (*redeemer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  (*redeemer)->base.deallocator   = cardano_redeemer_deallocate;
+  (*redeemer)->base.ref_count     = 1;
+  (*redeemer)->base.last_error[0] = '\0';
+
+  (*redeemer)->tag             = tag;
+  (*redeemer)->index           = index;
+  (*redeemer)->data            = data;
+  (*redeemer)->execution_units = ex_units;
+  (*redeemer)->cbor_cache      = NULL;
+
+  cardano_plutus_data_ref(data);
+  cardano_ex_units_ref(ex_units);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_redeemer_from_cbor(cardano_cbor_reader_t* reader, cardano_redeemer_t** redeemer)
+{
+  if (redeemer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_buffer_t*      cbor_cache  = NULL;
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        copy_result = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    return copy_result;
+  }
+
+  copy_result = cardano_cbor_reader_read_encoded_value(reader_copy, &cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    *redeemer = NULL;
+    return copy_result;
+  }
+
+  static const char* validator_name = "redeemer";
+
+  const cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)REDEEMER_EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    *redeemer = NULL;
+    return expect_array_result;
+  }
+
+  uint64_t              tag              = 0U;
+  const cardano_error_t read_uint_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "tag",
+    reader,
+    &tag,
+    CARDANO_REDEEMER_TAG_SPEND,
+    CARDANO_REDEEMER_TAG_GUARDING);
+
+  if (read_uint_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    *redeemer = NULL;
+    return read_uint_result;
+  }
+
+  uint64_t              index             = 0U;
+  const cardano_error_t read_minor_result = cardano_cbor_validate_uint_in_range(
+    validator_name,
+    "index",
+    reader,
+    &index,
+    0,
+    UINT64_MAX);
+
+  if (read_minor_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    *redeemer = NULL;
+    return read_minor_result;
+  }
+
+  cardano_plutus_data_t* data     = NULL;
+  cardano_ex_units_t*    ex_units = NULL;
+
+  cardano_error_t read_data_result = cardano_plutus_data_from_cbor(reader, &data);
+
+  if (read_data_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    *redeemer = NULL;
+    return read_data_result;
+  }
+
+  cardano_error_t read_ex_units_result = cardano_ex_units_from_cbor(reader, &ex_units);
+
+  if (read_ex_units_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    cardano_plutus_data_unref(&data);
+    *redeemer = NULL;
+    return read_ex_units_result;
+  }
+
+  const cardano_error_t expect_end_array_result = cardano_cbor_validate_end_array(validator_name, reader);
+
+  if (expect_end_array_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+    cardano_plutus_data_unref(&data);
+    cardano_ex_units_unref(&ex_units);
+    *redeemer = NULL;
+
+    return expect_end_array_result;
+  }
+
+  cardano_error_t new_redeemer_result = cardano_redeemer_new((cardano_redeemer_tag_t)tag, index, data, ex_units, redeemer);
+
+  cardano_plutus_data_unref(&data);
+  cardano_ex_units_unref(&ex_units);
+
+  if (new_redeemer_result != CARDANO_SUCCESS)
+  {
+    cardano_buffer_unref(&cbor_cache);
+
+    *redeemer = NULL;
+
+    return new_redeemer_result;
+  }
+
+  (*redeemer)->cbor_cache = cbor_cache;
+
+  return new_redeemer_result;
+}
+
+cardano_error_t
+cardano_redeemer_to_cbor(const cardano_redeemer_t* redeemer, cardano_cbor_writer_t* writer)
+{
+  if (redeemer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (redeemer->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(redeemer->cbor_cache), cardano_buffer_get_size(redeemer->cbor_cache));
+  }
+
+  if (redeemer->index > UINT32_MAX)
+  {
+    cardano_cbor_writer_set_last_error(writer, "Redeemer index must fit in a 32-bit unsigned integer.");
+    return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_error_t write_start_array_result = cardano_cbor_writer_write_start_array(
+    writer,
+    REDEEMER_EMBEDDED_GROUP_SIZE);
+
+  if (write_start_array_result != CARDANO_SUCCESS)
+  {
+    return write_start_array_result;
+  }
+
+  cardano_error_t write_tag_result = cardano_cbor_writer_write_uint(
+    writer,
+    (uint64_t)redeemer->tag);
+
+  if (write_tag_result != CARDANO_SUCCESS)
+  {
+    return write_tag_result;
+  }
+
+  cardano_error_t write_index_result = cardano_cbor_writer_write_uint(
+    writer,
+    redeemer->index);
+
+  if (write_index_result != CARDANO_SUCCESS)
+  {
+    return write_index_result;
+  }
+
+  cardano_error_t write_data_result = cardano_plutus_data_to_cbor(redeemer->data, writer);
+
+  if (write_data_result != CARDANO_SUCCESS)
+  {
+    return write_data_result;
+  }
+
+  cardano_error_t write_ex_units_result = cardano_ex_units_to_cbor(redeemer->execution_units, writer);
+
+  if (write_ex_units_result != CARDANO_SUCCESS)
+  {
+    return write_ex_units_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_redeemer_to_cip116_json(
+  const cardano_redeemer_t* redeemer,
+  cardano_json_writer_t*    writer)
+{
+  if ((redeemer == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  cardano_json_writer_write_property_name(writer, "tag", 3);
+
+  switch (redeemer->tag)
+  {
+    case CARDANO_REDEEMER_TAG_SPEND:
+      cardano_json_writer_write_string(writer, "spend", 5);
+      break;
+    case CARDANO_REDEEMER_TAG_MINT:
+      cardano_json_writer_write_string(writer, "mint", 4);
+      break;
+    case CARDANO_REDEEMER_TAG_CERTIFYING:
+      cardano_json_writer_write_string(writer, "cert", 4);
+      break;
+    case CARDANO_REDEEMER_TAG_REWARD:
+      cardano_json_writer_write_string(writer, "reward", 6);
+      break;
+    case CARDANO_REDEEMER_TAG_VOTING:
+      cardano_json_writer_write_string(writer, "voting", 6);
+      break;
+    case CARDANO_REDEEMER_TAG_PROPOSING:
+      cardano_json_writer_write_string(writer, "proposing", 9);
+      break;
+    case CARDANO_REDEEMER_TAG_GUARDING:
+      cardano_json_writer_write_string(writer, "guarding", 8);
+      break;
+    default:
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+  }
+
+  cardano_json_writer_write_property_name(writer, "index", 5);
+  cardano_json_writer_write_uint_as_string(writer, redeemer->index);
+
+  cardano_json_writer_write_property_name(writer, "data", 4);
+  error = cardano_plutus_data_to_cip116_json(redeemer->data, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_property_name(writer, "ex_units", 8);
+  error = cardano_ex_units_to_cip116_json(redeemer->execution_units, writer);
+
+  if (error != CARDANO_SUCCESS)
+  {
+    return error;
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_redeemer_tag_t
+cardano_redeemer_get_tag(const cardano_redeemer_t* redeemer)
+{
+  if (redeemer == NULL)
+  {
+    return CARDANO_REDEEMER_TAG_SPEND;
+  }
+
+  return redeemer->tag;
+}
+
+cardano_error_t
+cardano_redeemer_set_tag(cardano_redeemer_t* redeemer, cardano_redeemer_tag_t tag)
+{
+  if (redeemer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  redeemer->tag = tag;
+
+  return CARDANO_SUCCESS;
+}
+
+uint64_t
+cardano_redeemer_get_index(const cardano_redeemer_t* redeemer)
+{
+  if (redeemer == NULL)
+  {
+    return 0;
+  }
+
+  return redeemer->index;
+}
+
+cardano_error_t
+cardano_redeemer_set_index(cardano_redeemer_t* redeemer, uint64_t index)
+{
+  if (redeemer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  redeemer->index = index;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_plutus_data_t*
+cardano_redeemer_get_data(cardano_redeemer_t* redeemer)
+{
+  if (redeemer == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_plutus_data_ref(redeemer->data);
+  return redeemer->data;
+}
+
+cardano_error_t
+cardano_redeemer_set_data(cardano_redeemer_t* redeemer, cardano_plutus_data_t* data)
+{
+  if (redeemer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_plutus_data_unref(&redeemer->data);
+  redeemer->data = data;
+
+  cardano_plutus_data_ref(data);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_ex_units_t*
+cardano_redeemer_get_ex_units(cardano_redeemer_t* redeemer)
+{
+  if (redeemer == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_ex_units_ref(redeemer->execution_units);
+  return redeemer->execution_units;
+}
+
+cardano_error_t
+cardano_redeemer_set_ex_units(cardano_redeemer_t* redeemer, cardano_ex_units_t* ex_units)
+{
+  if (redeemer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (ex_units == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ex_units_unref(&redeemer->execution_units);
+  redeemer->execution_units = ex_units;
+
+  cardano_ex_units_ref(ex_units);
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_redeemer_clear_cbor_cache(cardano_redeemer_t* redeemer)
+{
+  if (redeemer == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&redeemer->cbor_cache);
+  cardano_plutus_data_clear_cbor_cache(redeemer->data);
+
+  redeemer->cbor_cache = NULL;
+}
+
+void
+cardano_redeemer_unref(cardano_redeemer_t** redeemer)
+{
+  if ((redeemer == NULL) || (*redeemer == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*redeemer)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *redeemer = NULL;
+    return;
+  }
+}
+
+void
+cardano_redeemer_ref(cardano_redeemer_t* redeemer)
+{
+  if (redeemer == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&redeemer->base);
+}
+
+size_t
+cardano_redeemer_refcount(const cardano_redeemer_t* redeemer)
+{
+  if (redeemer == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&redeemer->base);
+}
+
+void
+cardano_redeemer_set_last_error(cardano_redeemer_t* redeemer, const char* message)
+{
+  cardano_object_set_last_error(&redeemer->base, message);
+}
+
+const char*
+cardano_redeemer_get_last_error(const cardano_redeemer_t* redeemer)
+{
+  return cardano_object_get_last_error(&redeemer->base);
+}
+
+cardano_error_t
+cardano_redeemer_deep_clone(const cardano_redeemer_t* source, cardano_redeemer_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_redeemer_t* copy = _cardano_malloc(sizeof(cardano_redeemer_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->tag                = source->tag;
+  copy->index              = source->index;
+  copy->data               = NULL;
+  copy->execution_units    = NULL;
+  copy->cbor_cache         = NULL;
+
+  if (source->data != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_data_deep_clone(source->data, &copy->data);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->execution_units != NULL)
+  {
+    const cardano_error_t result = cardano_ex_units_deep_clone(source->execution_units, &copy->execution_units);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/redeemer_list.c b/vendor/src/witness_set/redeemer_list.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/redeemer_list.c
@@ -0,0 +1,945 @@
+/**
+ * \file redeemer_list.c
+ *
+ * \author angel.castillo
+ * \date   Sep 21, 2024
+ *
+ * Copyright 2024 Biglup labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/witness_set/redeemer.h>
+#include <cardano/witness_set/redeemer_list.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano redeemer list.
+ */
+typedef struct cardano_redeemer_list_t
+{
+    cardano_object_t  base;
+    cardano_array_t*  array;
+    cardano_buffer_t* cbor_cache;
+} cardano_redeemer_list_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a redeemer_list list object.
+ *
+ * This function is responsible for properly deallocating a redeemer_list list object (`cardano_redeemer_list_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the redeemer_list object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_redeemer_list_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the redeemer_list
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_redeemer_list_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_redeemer_list_t* list = (cardano_redeemer_list_t*)object;
+
+  cardano_array_unref(&list->array);
+  cardano_buffer_unref(&list->cbor_cache);
+
+  _cardano_free(list);
+}
+
+/**
+ * \brief Compares two cardano_object_t objects based on their redeemer key.
+ *
+ * This function casts the cardano_object_t objects to cardano_redeemer_t
+ * and compares their hashes using the cardano_redeemer_compare function.
+ *
+ * \param[in] lhs Pointer to the first cardano_object_t object.
+ * \param[in] rhs Pointer to the second cardano_object_t object.
+ * \param[in] context Unused.
+ *
+ * \return A negative value if the redeemer of lhs is less than the redeemer of rhs, zero if they are equal,
+ *         and a positive value if the redeemer of lhs is greater than the redeemer of rhs.
+ */
+static int32_t
+compare_by_key(const cardano_object_t* lhs, const cardano_object_t* rhs, void* context)
+{
+  assert(lhs != NULL);
+  assert(rhs != NULL);
+
+  CARDANO_UNUSED(context);
+
+  const cardano_redeemer_t* lhs_redeemer = (const cardano_redeemer_t*)((const void*)lhs);
+  const cardano_redeemer_t* rhs_redeemer = (const cardano_redeemer_t*)((const void*)rhs);
+
+  const uint64_t               lhs_index = cardano_redeemer_get_index(lhs_redeemer);
+  const uint64_t               rhs_index = cardano_redeemer_get_index(rhs_redeemer);
+  const cardano_redeemer_tag_t lhs_tag   = cardano_redeemer_get_tag(lhs_redeemer);
+  const cardano_redeemer_tag_t rhs_tag   = cardano_redeemer_get_tag(rhs_redeemer);
+
+  if (lhs_tag < rhs_tag)
+  {
+    return -1;
+  }
+
+  if (lhs_tag > rhs_tag)
+  {
+    return 1;
+  }
+
+  if (lhs_index < rhs_index)
+  {
+    return -1;
+  }
+
+  if (lhs_index > rhs_index)
+  {
+    return 1;
+  }
+
+  return 0;
+}
+
+/**
+ * \brief Checks whether two redeemers of the list share the same tag and index.
+ *
+ * Redeemers are mutable and shared, so their keys can change after they are added to the list and the
+ * array is not guaranteed to be sorted. Every pair of redeemers is compared.
+ *
+ * \param[in] array Pointer to the array holding the redeemers of the list.
+ *
+ * \return \c true if two redeemers have the same tag and index; \c false otherwise.
+ */
+static bool
+has_duplicate_keys(const cardano_array_t* array)
+{
+  assert(array != NULL);
+
+  bool result = false;
+
+  const size_t length = cardano_array_get_size(array);
+
+  for (size_t i = 0U; (i < length) && !result; ++i)
+  {
+    cardano_object_t* lhs = cardano_array_get(array, i);
+
+    assert(lhs != NULL);
+
+    for (size_t j = i + 1U; j < length; ++j)
+    {
+      cardano_object_t* rhs = cardano_array_get(array, j);
+
+      assert(rhs != NULL);
+
+      result = (compare_by_key(lhs, rhs, NULL) == 0);
+
+      cardano_object_unref(&rhs);
+
+      if (result)
+      {
+        break;
+      }
+    }
+
+    cardano_object_unref(&lhs);
+  }
+
+  return result;
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_redeemer_list_new(cardano_redeemer_list_t** redeemer_list)
+{
+  if (redeemer_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_redeemer_list_t* list = _cardano_malloc(sizeof(cardano_redeemer_list_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count     = 1;
+  list->base.last_error[0] = '\0';
+  list->base.deallocator   = cardano_redeemer_list_deallocate;
+
+  list->array      = cardano_array_new(128);
+  list->cbor_cache = NULL;
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *redeemer_list = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_redeemer_list_from_cbor(cardano_cbor_reader_t* reader, cardano_redeemer_list_t** redeemer_list)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (redeemer_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_redeemer_list_t* list   = NULL;
+  cardano_error_t          result = cardano_redeemer_list_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_t* reader_copy = NULL;
+  cardano_error_t        copy_result = cardano_cbor_reader_clone(reader, &reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_redeemer_list_unref(&list);
+
+    return copy_result;
+  }
+
+  copy_result = cardano_cbor_reader_read_encoded_value(reader_copy, &list->cbor_cache);
+  cardano_cbor_reader_unref(&reader_copy);
+
+  if (copy_result != CARDANO_SUCCESS)
+  {
+    cardano_redeemer_list_unref(&list);
+
+    *redeemer_list = NULL;
+    return copy_result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_redeemer_list_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  if (state == CARDANO_CBOR_READER_STATE_START_MAP)
+  {
+    int64_t map_size = 0;
+
+    result = cardano_cbor_reader_read_start_map(reader, &map_size);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_redeemer_list_unref(&list);
+      return result;
+    }
+
+    CARDANO_UNUSED(map_size);
+
+    while (state != CARDANO_CBOR_READER_STATE_END_MAP)
+    {
+      result = cardano_cbor_reader_peek_state(reader, &state);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_redeemer_list_unref(&list);
+        return result;
+      }
+
+      if (state == CARDANO_CBOR_READER_STATE_END_MAP)
+      {
+        break;
+      }
+
+      int64_t key_array = 0;
+
+      result = cardano_cbor_reader_read_start_array(reader, &key_array);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_redeemer_list_unref(&list);
+        return result;
+      }
+
+      if (key_array != 2)
+      {
+        cardano_redeemer_list_unref(&list);
+        cardano_cbor_reader_set_last_error(reader, "Invalid key array size in redeemer_list");
+
+        return CARDANO_ERROR_DECODING;
+      }
+
+      uint64_t tag   = 0;
+      uint64_t index = 0;
+
+      result = cardano_cbor_validate_uint_in_range(
+        "redeemer_list",
+        "tag",
+        reader,
+        &tag,
+        CARDANO_REDEEMER_TAG_SPEND,
+        CARDANO_REDEEMER_TAG_GUARDING);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_redeemer_list_unref(&list);
+        return result;
+      }
+
+      result = cardano_cbor_reader_read_uint(reader, &index);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_redeemer_list_unref(&list);
+        return result;
+      }
+
+      result = cardano_cbor_validate_end_array("redeemer_list key", reader);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_redeemer_list_unref(&list);
+        return result;
+      }
+
+      int64_t value_array = 0;
+
+      result = cardano_cbor_reader_read_start_array(reader, &value_array);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_redeemer_list_unref(&list);
+        return result;
+      }
+
+      if (value_array != 2)
+      {
+        cardano_redeemer_list_unref(&list);
+        cardano_cbor_reader_set_last_error(reader, "Invalid value array size in redeemer_list");
+
+        return CARDANO_ERROR_DECODING;
+      }
+
+      cardano_plutus_data_t* data     = NULL;
+      cardano_ex_units_t*    ex_units = NULL;
+
+      result = cardano_plutus_data_from_cbor(reader, &data);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_redeemer_list_unref(&list);
+        return result;
+      }
+
+      result = cardano_ex_units_from_cbor(reader, &ex_units);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_unref(&data);
+        cardano_redeemer_list_unref(&list);
+        return result;
+      }
+
+      result = cardano_cbor_validate_end_array("redeemer_list value", reader);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_plutus_data_unref(&data);
+        cardano_ex_units_unref(&ex_units);
+        cardano_redeemer_list_unref(&list);
+        return result;
+      }
+
+      cardano_redeemer_t* redeemer = NULL;
+
+      result = cardano_redeemer_new(tag, index, data, ex_units, &redeemer);
+      cardano_plutus_data_unref(&data);
+      cardano_ex_units_unref(&ex_units);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_redeemer_list_unref(&list);
+        return result;
+      }
+
+      result = cardano_redeemer_list_add(list, redeemer);
+      cardano_redeemer_unref(&redeemer);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        cardano_redeemer_list_unref(&list);
+        return result;
+      }
+    }
+
+    result = cardano_cbor_validate_end_map("redeemer_list", reader);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_redeemer_list_unref(&list);
+      return result;
+    }
+
+    cardano_array_sort(list->array, compare_by_key, NULL);
+
+    *redeemer_list = list;
+
+    return CARDANO_SUCCESS;
+  }
+
+  int64_t array_size = 0;
+
+  result = cardano_cbor_reader_read_start_array(reader, &array_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_redeemer_list_unref(&list);
+    return result;
+  }
+
+  CARDANO_UNUSED(array_size);
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_redeemer_list_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_redeemer_list_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_redeemer_t* redeemer = NULL;
+
+    result = cardano_redeemer_from_cbor(reader, &redeemer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_redeemer_list_unref(&list);
+      return result;
+    }
+
+    result = cardano_redeemer_list_add(list, redeemer);
+    cardano_redeemer_unref(&redeemer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_redeemer_list_unref(&list);
+      return result;
+    }
+  }
+
+  cardano_array_sort(list->array, compare_by_key, NULL);
+
+  *redeemer_list = list;
+
+  return cardano_cbor_validate_end_array("redeemer_list", reader);
+}
+
+cardano_error_t
+cardano_redeemer_list_to_cip116_json(
+  const cardano_redeemer_list_t* list,
+  cardano_json_writer_t*         writer)
+{
+  if ((list == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t          length = cardano_redeemer_list_get_length(list);
+  cardano_error_t error  = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_redeemer_t* redeemer = NULL;
+    error                        = cardano_redeemer_list_get(list, i, &redeemer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_redeemer_to_cip116_json(redeemer, writer);
+    cardano_redeemer_unref(&redeemer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return error;
+}
+
+cardano_error_t
+cardano_redeemer_list_to_cbor(const cardano_redeemer_list_t* redeemer_list, cardano_cbor_writer_t* writer)
+{
+  if (redeemer_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (redeemer_list->cbor_cache != NULL)
+  {
+    return cardano_cbor_writer_write_encoded(writer, cardano_buffer_get_data(redeemer_list->cbor_cache), cardano_buffer_get_size(redeemer_list->cbor_cache));
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (has_duplicate_keys(redeemer_list->array))
+  {
+    cardano_cbor_writer_set_last_error(writer, "Redeemer list contains two redeemers with the same tag and index.");
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  result = cardano_cbor_writer_write_start_map(writer, (int64_t)cardano_redeemer_list_get_length(redeemer_list));
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0U; i < cardano_redeemer_list_get_length(redeemer_list); ++i)
+  {
+    cardano_redeemer_t* redeemer = NULL;
+
+    result = cardano_redeemer_list_get(redeemer_list, i, &redeemer);
+    cardano_redeemer_unref(&redeemer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if (cardano_redeemer_get_index(redeemer) > UINT32_MAX)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Redeemer index must fit in a 32-bit unsigned integer.");
+      return CARDANO_ERROR_INVALID_ARGUMENT;
+    }
+
+    result = cardano_cbor_writer_write_start_array(writer, 2);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, cardano_redeemer_get_tag(redeemer));
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_uint(writer, cardano_redeemer_get_index(redeemer));
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_cbor_writer_write_start_array(writer, 2);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_plutus_data_t* data = cardano_redeemer_get_data(redeemer);
+    cardano_plutus_data_unref(&data);
+
+    result = cardano_plutus_data_to_cbor(data, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    cardano_ex_units_t* ex_units = cardano_redeemer_get_ex_units(redeemer);
+    cardano_ex_units_unref(&ex_units);
+
+    result = cardano_ex_units_to_cbor(ex_units, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+size_t
+cardano_redeemer_list_get_length(const cardano_redeemer_list_t* redeemer_list)
+{
+  if (redeemer_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(redeemer_list->array);
+}
+
+cardano_error_t
+cardano_redeemer_list_get(
+  const cardano_redeemer_list_t* redeemer_list,
+  size_t                         index,
+  cardano_redeemer_t**           element)
+{
+  if (redeemer_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(redeemer_list->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_redeemer_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_redeemer_list_add(cardano_redeemer_list_t* redeemer_list, cardano_redeemer_t* element)
+{
+  if (redeemer_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+  const size_t original_size = cardano_array_get_size(redeemer_list->array);
+  const size_t new_size      = cardano_array_push(redeemer_list->array, (cardano_object_t*)((void*)element));
+
+  if (new_size != (original_size + 1U))
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_array_sort(redeemer_list->array, compare_by_key, NULL);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_redeemer_list_set_ex_units(
+  cardano_redeemer_list_t*     redeemer_list,
+  const cardano_redeemer_tag_t tag,
+  const uint64_t               index,
+  const uint64_t               mem,
+  const uint64_t               steps)
+{
+  if (redeemer_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0U; i < cardano_redeemer_list_get_length(redeemer_list); ++i)
+  {
+    cardano_redeemer_t* redeemer = NULL;
+
+    cardano_error_t result = cardano_redeemer_list_get(redeemer_list, i, &redeemer);
+    cardano_redeemer_unref(&redeemer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    if ((cardano_redeemer_get_tag(redeemer) == tag) && (cardano_redeemer_get_index(redeemer) == index))
+    {
+      cardano_ex_units_t* ex_units = cardano_redeemer_get_ex_units(redeemer);
+      cardano_ex_units_unref(&ex_units);
+
+      if (ex_units == NULL)
+      {
+        return CARDANO_ERROR_POINTER_IS_NULL;
+      }
+
+      cardano_error_t set_result = cardano_ex_units_set_memory(ex_units, mem);
+
+      if (set_result != CARDANO_SUCCESS)
+      {
+        return set_result;
+      }
+
+      set_result = cardano_ex_units_set_cpu_steps(ex_units, steps);
+
+      return set_result;
+    }
+  }
+
+  return CARDANO_ERROR_ELEMENT_NOT_FOUND;
+}
+
+cardano_error_t
+cardano_redeemer_list_clone(
+  cardano_redeemer_list_t*  redeemer_list,
+  cardano_redeemer_list_t** cloned_redeemer_list)
+{
+  if (redeemer_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (cloned_redeemer_list == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_cbor_writer_t* writer = cardano_cbor_writer_new();
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  cardano_error_t result = cardano_redeemer_list_to_cbor(redeemer_list, writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_cbor_writer_unref(&writer);
+    return result;
+  }
+
+  cardano_buffer_t* buffer = NULL;
+  result                   = cardano_cbor_writer_encode_in_buffer(writer, &buffer);
+
+  cardano_cbor_writer_unref(&writer);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_t* reader = cardano_cbor_reader_new(cardano_buffer_get_data(buffer), cardano_buffer_get_size(buffer));
+  cardano_buffer_unref(&buffer);
+
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  result = cardano_redeemer_list_from_cbor(reader, cloned_redeemer_list);
+
+  cardano_cbor_reader_unref(&reader);
+
+  cardano_redeemer_list_clear_cbor_cache(*cloned_redeemer_list);
+
+  cardano_array_sort(redeemer_list->array, compare_by_key, NULL);
+
+  return result;
+}
+
+void
+cardano_redeemer_list_clear_cbor_cache(cardano_redeemer_list_t* redeemer_list)
+{
+  if (redeemer_list == NULL)
+  {
+    return;
+  }
+
+  cardano_buffer_unref(&redeemer_list->cbor_cache);
+  redeemer_list->cbor_cache = NULL;
+
+  for (size_t i = 0U; i < cardano_redeemer_list_get_length(redeemer_list); ++i)
+  {
+    cardano_redeemer_t* redeemer = NULL;
+
+    cardano_error_t result = cardano_redeemer_list_get(redeemer_list, i, &redeemer);
+
+    cardano_redeemer_unref(&redeemer);
+
+    if (result == CARDANO_SUCCESS)
+    {
+      cardano_redeemer_clear_cbor_cache(redeemer);
+    }
+  }
+}
+
+void
+cardano_redeemer_list_unref(cardano_redeemer_list_t** redeemer_list)
+{
+  if ((redeemer_list == NULL) || (*redeemer_list == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*redeemer_list)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *redeemer_list = NULL;
+    return;
+  }
+}
+
+void
+cardano_redeemer_list_ref(cardano_redeemer_list_t* redeemer_list)
+{
+  if (redeemer_list == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&redeemer_list->base);
+}
+
+size_t
+cardano_redeemer_list_refcount(const cardano_redeemer_list_t* redeemer_list)
+{
+  if (redeemer_list == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&redeemer_list->base);
+}
+
+void
+cardano_redeemer_list_set_last_error(cardano_redeemer_list_t* redeemer_list, const char* message)
+{
+  cardano_object_set_last_error(&redeemer_list->base, message);
+}
+
+const char*
+cardano_redeemer_list_get_last_error(const cardano_redeemer_list_t* redeemer_list)
+{
+  return cardano_object_get_last_error(&redeemer_list->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_redeemer_t*   copy   = NULL;
+  const cardano_error_t result = cardano_redeemer_deep_clone((const cardano_redeemer_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_redeemer_list_deep_clone(const cardano_redeemer_list_t* source, cardano_redeemer_list_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_redeemer_list_t* copy = _cardano_malloc(sizeof(cardano_redeemer_list_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->array              = NULL;
+  copy->cbor_cache         = NULL;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->cbor_cache != NULL)
+  {
+    const cardano_error_t result = cardano_buffer_deep_clone(source->cbor_cache, &copy->cbor_cache);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/vkey_witness.c b/vendor/src/witness_set/vkey_witness.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/vkey_witness.c
@@ -0,0 +1,471 @@
+/**
+ * \file vkey_witness.c
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/certs/cert_type.h>
+#include <cardano/error.h>
+#include <cardano/object.h>
+#include <cardano/witness_set/vkey_witness.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+static const int64_t EMBEDDED_GROUP_SIZE = 2;
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief vkey Witness (Verification Key Witness) is a component of a transaction that
+ * provides cryptographic proof that proves that the creator of the transaction
+ * has access to the private keys controlling the UTxOs being spent.
+ */
+typedef struct cardano_vkey_witness_t
+{
+    cardano_object_t              base;
+    cardano_ed25519_public_key_t* vkey;
+    cardano_ed25519_signature_t*  signature;
+} cardano_vkey_witness_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a vkey_witness object.
+ *
+ * This function is responsible for properly deallocating a vkey_witness object (`cardano_vkey_witness_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the vkey_witness object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_vkey_witness_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the vkey_witness
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_vkey_witness_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_vkey_witness_t* data = (cardano_vkey_witness_t*)object;
+
+  cardano_ed25519_public_key_unref(&data->vkey);
+  cardano_ed25519_signature_unref(&data->signature);
+
+  _cardano_free(data);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_vkey_witness_new(
+  cardano_ed25519_public_key_t* vkey,
+  cardano_ed25519_signature_t*  signature,
+  cardano_vkey_witness_t**      vkey_witness)
+{
+  if (vkey == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (signature == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vkey_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_vkey_witness_t* data = _cardano_malloc(sizeof(cardano_vkey_witness_t));
+
+  if (data == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  data->base.ref_count     = 1;
+  data->base.last_error[0] = '\0';
+  data->base.deallocator   = cardano_vkey_witness_deallocate;
+
+  cardano_ed25519_public_key_ref(vkey);
+  data->vkey = vkey;
+
+  cardano_ed25519_signature_ref(signature);
+  data->signature = signature;
+
+  *vkey_witness = data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_vkey_witness_from_cbor(cardano_cbor_reader_t* reader, cardano_vkey_witness_t** vkey_witness)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vkey_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  static const char* validator_name = "vkey_witness";
+
+  cardano_error_t expect_array_result = cardano_cbor_validate_array_of_n_elements(validator_name, reader, (uint32_t)EMBEDDED_GROUP_SIZE);
+
+  if (expect_array_result != CARDANO_SUCCESS)
+  {
+    return expect_array_result;
+  }
+
+  cardano_buffer_t* vkey_bytes = NULL;
+
+  cardano_error_t read_vkey_result = cardano_cbor_reader_read_bytestring(reader, &vkey_bytes);
+
+  if (read_vkey_result != CARDANO_SUCCESS)
+  {
+    return read_vkey_result;
+  }
+
+  cardano_ed25519_public_key_t* vkey = NULL;
+
+  cardano_error_t new_vkey_result = cardano_ed25519_public_key_from_bytes(cardano_buffer_get_data(vkey_bytes), cardano_buffer_get_size(vkey_bytes), &vkey);
+  cardano_buffer_unref(&vkey_bytes);
+
+  if (new_vkey_result != CARDANO_SUCCESS)
+  {
+    return new_vkey_result;
+  }
+
+  cardano_buffer_t* signature_bytes = NULL;
+
+  cardano_error_t read_signature_result = cardano_cbor_reader_read_bytestring(reader, &signature_bytes);
+
+  if (read_signature_result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_public_key_unref(&vkey);
+
+    return read_signature_result;
+  }
+
+  cardano_ed25519_signature_t* signature = NULL;
+
+  cardano_error_t new_signature_result = cardano_ed25519_signature_from_bytes(cardano_buffer_get_data(signature_bytes), cardano_buffer_get_size(signature_bytes), &signature);
+
+  cardano_buffer_unref(&signature_bytes);
+
+  if (new_signature_result != CARDANO_SUCCESS)
+  {
+    cardano_ed25519_public_key_unref(&vkey);
+
+    return new_signature_result;
+  }
+
+  cardano_error_t new_result = cardano_vkey_witness_new(vkey, signature, vkey_witness);
+
+  cardano_ed25519_public_key_unref(&vkey);
+  cardano_ed25519_signature_unref(&signature);
+
+  if (new_result != CARDANO_SUCCESS)
+  {
+    return new_result;
+  }
+
+  return cardano_cbor_validate_end_array(validator_name, reader);
+}
+
+cardano_error_t
+cardano_vkey_witness_to_cbor(
+  const cardano_vkey_witness_t* vkey_witness,
+  cardano_cbor_writer_t*        writer)
+{
+  if (vkey_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t write_array_result = cardano_cbor_writer_write_start_array(writer, EMBEDDED_GROUP_SIZE);
+
+  if (write_array_result != CARDANO_SUCCESS)
+  {
+    return write_array_result;
+  }
+
+  cardano_error_t write_vkey_result = cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_ed25519_public_key_get_data(vkey_witness->vkey),
+    cardano_ed25519_public_key_get_bytes_size(vkey_witness->vkey));
+
+  if (write_vkey_result != CARDANO_SUCCESS)
+  {
+    return write_vkey_result;
+  }
+
+  cardano_error_t write_signature_result = cardano_cbor_writer_write_bytestring(
+    writer,
+    cardano_ed25519_signature_get_data(vkey_witness->signature),
+    cardano_ed25519_signature_get_bytes_size(vkey_witness->signature));
+
+  if (write_signature_result != CARDANO_SUCCESS)
+  {
+    return write_signature_result;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_vkey_witness_to_cip116_json(
+  const cardano_vkey_witness_t* witness,
+  cardano_json_writer_t*        writer)
+{
+  if ((witness == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+
+  cardano_json_writer_write_property_name(writer, "vkey", 4);
+  const byte_t* vkey_data = cardano_ed25519_public_key_get_data(witness->vkey);
+  const size_t  vkey_size = cardano_ed25519_public_key_get_bytes_size(witness->vkey);
+  cardano_json_writer_write_bytes_as_hex(writer, vkey_data, vkey_size);
+
+  cardano_json_writer_write_property_name(writer, "signature", 9);
+  const byte_t* signature_data = cardano_ed25519_signature_get_data(witness->signature);
+  const size_t  signature_size = cardano_ed25519_signature_get_bytes_size(witness->signature);
+  cardano_json_writer_write_bytes_as_hex(writer, signature_data, signature_size);
+
+  cardano_json_writer_write_end_object(writer);
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_vkey_witness_has_public_key(const cardano_vkey_witness_t* vkey_witness, const cardano_ed25519_public_key_t* vkey)
+{
+  if ((vkey_witness == NULL) || (vkey == NULL))
+  {
+    return false;
+  }
+
+  const byte_t* key_bytes  = cardano_ed25519_public_key_get_data(vkey);
+  const size_t  key_size   = cardano_ed25519_public_key_get_bytes_size(vkey);
+  const byte_t* vkey_bytes = cardano_ed25519_public_key_get_data(vkey_witness->vkey);
+  const size_t  vkey_size  = cardano_ed25519_public_key_get_bytes_size(vkey_witness->vkey);
+
+  return (key_size == vkey_size) && (memcmp(key_bytes, vkey_bytes, key_size) == 0);
+}
+
+cardano_ed25519_public_key_t*
+cardano_vkey_witness_get_vkey(
+  cardano_vkey_witness_t* vkey_witness)
+{
+  if (vkey_witness == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_ed25519_public_key_ref(vkey_witness->vkey);
+
+  return vkey_witness->vkey;
+}
+
+cardano_error_t
+cardano_vkey_witness_set_vkey(
+  cardano_vkey_witness_t*       vkey_witness,
+  cardano_ed25519_public_key_t* vkey)
+{
+  if (vkey_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vkey == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ed25519_public_key_ref(vkey);
+  cardano_ed25519_public_key_unref(&vkey_witness->vkey);
+
+  vkey_witness->vkey = vkey;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_ed25519_signature_t*
+cardano_vkey_witness_get_signature(
+  cardano_vkey_witness_t* vkey_witness)
+{
+  if (vkey_witness == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_ed25519_signature_ref(vkey_witness->signature);
+
+  return vkey_witness->signature;
+}
+
+cardano_error_t
+cardano_vkey_witness_set_signature(
+  cardano_vkey_witness_t*      vkey_witness,
+  cardano_ed25519_signature_t* signature)
+{
+  if (vkey_witness == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (signature == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ed25519_signature_ref(signature);
+  cardano_ed25519_signature_unref(&vkey_witness->signature);
+
+  vkey_witness->signature = signature;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_vkey_witness_unref(cardano_vkey_witness_t** vkey_witness)
+{
+  if ((vkey_witness == NULL) || (*vkey_witness == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*vkey_witness)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *vkey_witness = NULL;
+    return;
+  }
+}
+
+void
+cardano_vkey_witness_ref(cardano_vkey_witness_t* vkey_witness)
+{
+  if (vkey_witness == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&vkey_witness->base);
+}
+
+size_t
+cardano_vkey_witness_refcount(const cardano_vkey_witness_t* vkey_witness)
+{
+  if (vkey_witness == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&vkey_witness->base);
+}
+
+void
+cardano_vkey_witness_set_last_error(cardano_vkey_witness_t* vkey_witness, const char* message)
+{
+  cardano_object_set_last_error(&vkey_witness->base, message);
+}
+
+const char*
+cardano_vkey_witness_get_last_error(const cardano_vkey_witness_t* vkey_witness)
+{
+  return cardano_object_get_last_error(&vkey_witness->base);
+}
+
+cardano_error_t
+cardano_vkey_witness_deep_clone(const cardano_vkey_witness_t* source, cardano_vkey_witness_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_vkey_witness_t* copy = _cardano_malloc(sizeof(cardano_vkey_witness_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count     = 1U;
+  copy->base.deallocator   = source->base.deallocator;
+  copy->base.last_error[0] = '\0';
+  copy->vkey               = NULL;
+  copy->signature          = NULL;
+
+  if (source->vkey != NULL)
+  {
+    const cardano_error_t result = cardano_ed25519_public_key_deep_clone(source->vkey, &copy->vkey);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->signature != NULL)
+  {
+    const cardano_error_t result = cardano_ed25519_signature_deep_clone(source->signature, &copy->signature);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/vkey_witness_set.c b/vendor/src/witness_set/vkey_witness_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/vkey_witness_set.c
@@ -0,0 +1,687 @@
+/**
+ * \file vkey_witness_set.c
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/witness_set/vkey_witness_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+#include "../collections/array.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief Represents a Cardano vkey_witness_set list.
+ */
+typedef struct cardano_vkey_witness_set_t
+{
+    cardano_object_t base;
+    cardano_array_t* array;
+    bool             uses_tags;
+    bool             preserves_duplicates;
+} cardano_vkey_witness_set_t;
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a vkey_witness_set list object.
+ *
+ * This function is responsible for properly deallocating a vkey_witness_set list object (`cardano_vkey_witness_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the vkey_witness_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_vkey_witness_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the vkey_witness_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_vkey_witness_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_vkey_witness_set_t* list = (cardano_vkey_witness_set_t*)object;
+
+  if (list->array != NULL)
+  {
+    cardano_array_unref(&list->array);
+  }
+
+  _cardano_free(list);
+}
+
+/**
+ * \brief Determines whether two vkey witnesses are the same witness.
+ *
+ * Two vkey witnesses are the same witness when they have the same public key and the same signature. Witnesses
+ * with the same public key and different signatures are different witnesses.
+ *
+ * \param lhs The first vkey witness to compare.
+ * \param rhs The second vkey witness to compare.
+ * \return true if both witnesses have the same public key and the same signature, false otherwise.
+ */
+static bool
+is_same_witness(cardano_vkey_witness_t* lhs, cardano_vkey_witness_t* rhs)
+{
+  cardano_ed25519_public_key_t* vkey    = cardano_vkey_witness_get_vkey(rhs);
+  cardano_ed25519_signature_t*  lhs_sig = cardano_vkey_witness_get_signature(lhs);
+  cardano_ed25519_signature_t*  rhs_sig = cardano_vkey_witness_get_signature(rhs);
+
+  cardano_ed25519_public_key_unref(&vkey);
+  cardano_ed25519_signature_unref(&lhs_sig);
+  cardano_ed25519_signature_unref(&rhs_sig);
+
+  if ((vkey == NULL) || (lhs_sig == NULL) || (rhs_sig == NULL) || !cardano_vkey_witness_has_public_key(lhs, vkey))
+  {
+    return false;
+  }
+
+  const size_t lhs_size = cardano_ed25519_signature_get_bytes_size(lhs_sig);
+  const size_t rhs_size = cardano_ed25519_signature_get_bytes_size(rhs_sig);
+
+  return (lhs_size == rhs_size) && (memcmp(cardano_ed25519_signature_get_data(lhs_sig), cardano_ed25519_signature_get_data(rhs_sig), lhs_size) == 0);
+}
+
+/**
+ * \brief Determines whether the witness at the given index is repeated later in the vkey witness set.
+ *
+ * \param vkey_witness_set The vkey witness set to search.
+ * \param index The index of the witness to look for.
+ * \return true if a witness after \p index is the same witness, false otherwise.
+ */
+static bool
+is_repeated_later(const cardano_vkey_witness_set_t* vkey_witness_set, const size_t index)
+{
+  cardano_object_t* item  = cardano_array_get(vkey_witness_set->array, index);
+  bool              found = false;
+
+  for (size_t i = index + 1U; (i < cardano_array_get_size(vkey_witness_set->array)) && !found; ++i)
+  {
+    cardano_object_t* other = cardano_array_get(vkey_witness_set->array, i);
+
+    found = is_same_witness((cardano_vkey_witness_t*)((void*)item), (cardano_vkey_witness_t*)((void*)other));
+
+    cardano_object_unref(&other);
+  }
+
+  cardano_object_unref(&item);
+
+  return found;
+}
+
+/**
+ * \brief Determines whether the witness at the given index is part of the encoding of the vkey witness set.
+ *
+ * A vkey witness set decoded from CBOR encodes every witness it was decoded with. Otherwise, a witness repeated
+ * later in the set is left out, so that the encoding never holds the same witness twice and the last occurrence of
+ * each witness keeps its position.
+ *
+ * \param vkey_witness_set The vkey witness set being encoded.
+ * \param index The index of the witness.
+ * \return true if the witness is written when the set is encoded, false otherwise.
+ */
+static bool
+is_encoded(const cardano_vkey_witness_set_t* vkey_witness_set, const size_t index)
+{
+  return vkey_witness_set->preserves_duplicates || !is_repeated_later(vkey_witness_set, index);
+}
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_vkey_witness_set_new(cardano_vkey_witness_set_t** vkey_witness_set)
+{
+  if (vkey_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_vkey_witness_set_t* list = _cardano_malloc(sizeof(cardano_vkey_witness_set_t));
+
+  if (list == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  list->base.ref_count       = 1;
+  list->base.last_error[0]   = '\0';
+  list->base.deallocator     = cardano_vkey_witness_set_deallocate;
+  list->uses_tags            = true;
+  list->preserves_duplicates = false;
+
+  list->array = cardano_array_new(128);
+
+  if (list->array == NULL)
+  {
+    _cardano_free(list);
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  *vkey_witness_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_vkey_witness_set_from_cbor(cardano_cbor_reader_t* reader, cardano_vkey_witness_set_t** vkey_witness_set)
+{
+  if (reader == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vkey_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_vkey_witness_set_t* list   = NULL;
+  cardano_error_t             result = cardano_vkey_witness_set_new(&list);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  cardano_cbor_reader_state_t state;
+
+  if (cardano_cbor_reader_peek_state(reader, &state) != CARDANO_SUCCESS)
+  {
+    cardano_vkey_witness_set_unref(&list);
+    return CARDANO_ERROR_DECODING;
+  }
+
+  list->uses_tags            = (state == CARDANO_CBOR_READER_STATE_TAG);
+  list->preserves_duplicates = true;
+
+  if (state == CARDANO_CBOR_READER_STATE_TAG)
+  {
+    const cardano_error_t read_tag_result = cardano_cbor_validate_tag("vkey_witness_set", reader, CARDANO_CBOR_TAG_SET);
+
+    if (read_tag_result != CARDANO_SUCCESS)
+    {
+      cardano_vkey_witness_set_unref(&list);
+      return read_tag_result;
+    }
+  }
+
+  int64_t length = 0;
+  result         = cardano_cbor_reader_read_start_array(reader, &length);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_vkey_witness_set_unref(&list);
+    return result;
+  }
+
+  state = CARDANO_CBOR_READER_STATE_UNDEFINED;
+
+  while (state != CARDANO_CBOR_READER_STATE_END_ARRAY)
+  {
+    result = cardano_cbor_reader_peek_state(reader, &state);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_vkey_witness_set_unref(&list);
+      return result;
+    }
+
+    if (state == CARDANO_CBOR_READER_STATE_END_ARRAY)
+    {
+      break;
+    }
+
+    cardano_vkey_witness_t* element = NULL;
+
+    result = cardano_vkey_witness_from_cbor(reader, &element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_vkey_witness_set_unref(&list);
+      return result;
+    }
+
+    const size_t old_size = cardano_array_get_size(list->array);
+    const size_t new_size = cardano_array_push(list->array, (cardano_object_t*)((void*)element));
+
+    cardano_vkey_witness_unref(&element);
+
+    if ((old_size + 1U) != new_size)
+    {
+      cardano_vkey_witness_set_unref(&list);
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  result = cardano_cbor_validate_end_array("vkey_witness_set", reader);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_vkey_witness_set_unref(&list);
+    return result;
+  }
+
+  *vkey_witness_set = list;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_vkey_witness_set_to_cbor(const cardano_vkey_witness_set_t* vkey_witness_set, cardano_cbor_writer_t* writer)
+{
+  if (vkey_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  assert(vkey_witness_set->array != NULL);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  if (vkey_witness_set->uses_tags)
+  {
+    result = cardano_cbor_writer_write_tag(writer, CARDANO_CBOR_TAG_SET);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  const size_t array_size    = cardano_array_get_size(vkey_witness_set->array);
+  size_t       encoded_count = 0U;
+
+  for (size_t i = 0U; i < array_size; ++i)
+  {
+    if (is_encoded(vkey_witness_set, i))
+    {
+      ++encoded_count;
+    }
+  }
+
+  result = cardano_cbor_writer_write_start_array(writer, (int64_t)encoded_count);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0U; i < array_size; ++i)
+  {
+    cardano_object_t* element = cardano_array_get(vkey_witness_set->array, i);
+
+    if (element == NULL)
+    {
+      cardano_cbor_writer_set_last_error(writer, "Element in vkey_witness_set list is NULL");
+      return CARDANO_ERROR_ENCODING;
+    }
+
+    if (is_encoded(vkey_witness_set, i))
+    {
+      result = cardano_vkey_witness_to_cbor((cardano_vkey_witness_t*)((void*)element), writer);
+    }
+
+    cardano_object_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return result;
+}
+
+cardano_error_t
+cardano_vkey_witness_set_to_cip116_json(
+  const cardano_vkey_witness_set_t* witnesses,
+  cardano_json_writer_t*            writer)
+{
+  if ((witnesses == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_array(writer);
+
+  size_t          length = cardano_vkey_witness_set_get_length(witnesses);
+  cardano_error_t error  = CARDANO_SUCCESS;
+
+  for (size_t i = 0U; i < length; ++i)
+  {
+    cardano_vkey_witness_t* witness = NULL;
+    error                           = cardano_vkey_witness_set_get(witnesses, i, &witness);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+
+    error = cardano_vkey_witness_to_cip116_json(witness, writer);
+    cardano_vkey_witness_unref(&witness);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_array(writer);
+
+  return error;
+}
+
+size_t
+cardano_vkey_witness_set_get_length(const cardano_vkey_witness_set_t* vkey_witness_set)
+{
+  if (vkey_witness_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_array_get_size(vkey_witness_set->array);
+}
+
+cardano_error_t
+cardano_vkey_witness_set_get(
+  const cardano_vkey_witness_set_t* vkey_witness_set,
+  size_t                            index,
+  cardano_vkey_witness_t**          element)
+{
+  if (vkey_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_object_t* object = cardano_array_get(vkey_witness_set->array, index);
+
+  if (object == NULL)
+  {
+    return CARDANO_ERROR_OUT_OF_BOUNDS_MEMORY_READ;
+  }
+
+  *element = (cardano_vkey_witness_t*)((void*)object);
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_vkey_witness_set_add(cardano_vkey_witness_set_t* vkey_witness_set, cardano_vkey_witness_t* element)
+{
+  if (vkey_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (element == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_ed25519_public_key_t* vkey = cardano_vkey_witness_get_vkey(element);
+  cardano_ed25519_signature_t*  sig  = cardano_vkey_witness_get_signature(element);
+
+  cardano_ed25519_signature_unref(&sig);
+  cardano_ed25519_public_key_unref(&vkey);
+
+  if ((vkey == NULL) || (sig == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  bool found = false;
+
+  for (size_t i = 0U; i < cardano_array_get_size(vkey_witness_set->array); ++i)
+  {
+    cardano_object_t* item = cardano_array_get(vkey_witness_set->array, i);
+
+    cardano_vkey_witness_t* witness = (cardano_vkey_witness_t*)((void*)item);
+    cardano_object_unref(&item);
+
+    if (cardano_vkey_witness_has_public_key(witness, vkey))
+    {
+      cardano_error_t result = cardano_vkey_witness_set_signature(witness, sig);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      found = true;
+    }
+  }
+
+  if (!found)
+  {
+    const size_t original_size = cardano_array_get_size(vkey_witness_set->array);
+    const size_t new_size      = cardano_array_push(vkey_witness_set->array, (cardano_object_t*)((void*)element));
+
+    if (new_size != (original_size + 1U))
+    {
+      return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+    }
+  }
+
+  vkey_witness_set->preserves_duplicates = false;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_vkey_witness_set_apply(
+  cardano_vkey_witness_set_t* vkey_witness_set,
+  cardano_vkey_witness_set_t* new_vkey_witnesses)
+{
+  if (vkey_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (new_vkey_witnesses == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  for (size_t i = 0; i < cardano_array_get_size(new_vkey_witnesses->array); ++i)
+  {
+    cardano_vkey_witness_t* element = NULL;
+
+    cardano_error_t result = cardano_vkey_witness_set_get(new_vkey_witnesses, i, &element);
+    cardano_vkey_witness_unref(&element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_vkey_witness_set_add(vkey_witness_set, element);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+bool
+cardano_vkey_witness_set_get_use_tag(const cardano_vkey_witness_set_t* vkey_witness_set)
+{
+  if (vkey_witness_set == NULL)
+  {
+    return false;
+  }
+
+  return vkey_witness_set->uses_tags;
+}
+
+cardano_error_t
+cardano_vkey_witness_set_set_use_tag(cardano_vkey_witness_set_t* vkey_witness_set, const bool use_tag)
+{
+  if (vkey_witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  vkey_witness_set->uses_tags = use_tag;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_vkey_witness_set_clear_cbor_cache(cardano_vkey_witness_set_t* vkey_witness_set)
+{
+  if (vkey_witness_set == NULL)
+  {
+    return;
+  }
+
+  vkey_witness_set->uses_tags            = true;
+  vkey_witness_set->preserves_duplicates = false;
+}
+
+void
+cardano_vkey_witness_set_unref(cardano_vkey_witness_set_t** vkey_witness_set)
+{
+  if ((vkey_witness_set == NULL) || (*vkey_witness_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*vkey_witness_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *vkey_witness_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_vkey_witness_set_ref(cardano_vkey_witness_set_t* vkey_witness_set)
+{
+  if (vkey_witness_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&vkey_witness_set->base);
+}
+
+size_t
+cardano_vkey_witness_set_refcount(const cardano_vkey_witness_set_t* vkey_witness_set)
+{
+  if (vkey_witness_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&vkey_witness_set->base);
+}
+
+void
+cardano_vkey_witness_set_set_last_error(cardano_vkey_witness_set_t* vkey_witness_set, const char* message)
+{
+  cardano_object_set_last_error(&vkey_witness_set->base, message);
+}
+
+const char*
+cardano_vkey_witness_set_get_last_error(const cardano_vkey_witness_set_t* vkey_witness_set)
+{
+  return cardano_object_get_last_error(&vkey_witness_set->base);
+}
+
+/**
+ * Deep copies one element for the typed collection.
+ */
+static cardano_error_t
+clone_array_element(const cardano_object_t* source, cardano_object_t** clone)
+{
+  cardano_vkey_witness_t* copy   = NULL;
+  const cardano_error_t   result = cardano_vkey_witness_deep_clone((const cardano_vkey_witness_t*)((const void*)source), &copy);
+
+  *clone = (cardano_object_t*)((void*)copy);
+
+  return result;
+}
+
+cardano_error_t
+cardano_vkey_witness_set_deep_clone(const cardano_vkey_witness_set_t* source, cardano_vkey_witness_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_vkey_witness_set_t* copy = _cardano_malloc(sizeof(cardano_vkey_witness_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count       = 1U;
+  copy->base.deallocator     = source->base.deallocator;
+  copy->base.last_error[0]   = '\0';
+  copy->array                = NULL;
+  copy->uses_tags            = source->uses_tags;
+  copy->preserves_duplicates = source->preserves_duplicates;
+
+  if (source->array != NULL)
+  {
+    const cardano_error_t result = cardano_array_deep_clone(source->array, clone_array_element, &copy->array);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
diff --git a/vendor/src/witness_set/witness_set.c b/vendor/src/witness_set/witness_set.c
new file mode 100644
--- /dev/null
+++ b/vendor/src/witness_set/witness_set.c
@@ -0,0 +1,2156 @@
+/**
+ * \file witness_set.c
+ *
+ * \author angel.castillo
+ * \date   Sep 22, 2024
+ *
+ * Copyright 2024 Biglup Labs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License") {}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <cardano/object.h>
+#include <cardano/witness_set/witness_set.h>
+
+#include "../allocators.h"
+#include "../cbor/cbor_validation.h"
+
+#include <assert.h>
+#include <cardano/scripts/script.h>
+#include <string.h>
+
+/* CONSTANTS *****************************************************************/
+
+#define WITNESS_SET_FIELD_COUNT ((size_t)9U)
+
+/* STRUCTURES ****************************************************************/
+
+/**
+ * \brief A witness is a piece of information that allows you to efficiently verify the
+ * authenticity of the transaction (also known as proof).
+ *
+ * In Cardano, transactions have multiple types of authentication proofs, these can range
+ * from signatures for spending UTxOs, to scripts (with its arguments, datums and redeemers) for
+ * smart contract execution.
+ */
+typedef struct cardano_witness_set_t
+{
+    cardano_object_t                 base;
+    cardano_vkey_witness_set_t*      vkey_witnesses;
+    cardano_native_script_set_t*     native_scripts;
+    cardano_bootstrap_witness_set_t* bootstrap_witnesses;
+    cardano_plutus_v1_script_set_t*  plutus_v1_scripts;
+    cardano_plutus_data_set_t*       plutus_data;
+    cardano_redeemer_list_t*         redeemer;
+    cardano_plutus_v2_script_set_t*  plutus_v2_scripts;
+    cardano_plutus_v3_script_set_t*  plutus_v3_scripts;
+    cardano_plutus_v4_script_set_t*  plutus_v4_scripts;
+    size_t                           key_order[WITNESS_SET_FIELD_COUNT];
+} cardano_witness_set_t;
+
+/* STATIC DECLARATIONS *******************************************************/
+
+/**
+ * \brief Type definition for a parameter handler function.
+ *
+ * This type defines a function pointer used for handling witness set fields
+ * when reading from a CBOR reader. Each handler function reads a specific type of
+ * field from the CBOR reader and stores the result in the specified field pointer.
+ *
+ * The function pointed to by `param_handler_t` is responsible for:
+ * - Reading the field value from the provided CBOR reader.
+ * - Storing the field value in the provided field pointer.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the field value.
+ * \param[out] field_ptr A pointer to the field where the read value should be stored.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the field was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+typedef cardano_error_t (*param_handler_t)(cardano_cbor_reader_t*, void*);
+
+/* STATIC FUNCTIONS **********************************************************/
+
+/**
+ * \brief Deallocates a witness set object.
+ *
+ * This function is responsible for properly deallocating a witness set object (`cardano_witness_set_t`)
+ * and its associated resources.
+ *
+ * \param object A void pointer to the witness_set object to be deallocated. The function casts this
+ *               pointer to the appropriate type (`cardano_witness_set_t*`).
+ *
+ * \note It is assumed that this function is called only when the reference count of the witness_set
+ *       object reaches zero, as part of the reference counting mechanism implemented for managing the
+ *       lifecycle of these objects.
+ */
+static void
+cardano_witness_set_deallocate(void* object)
+{
+  assert(object != NULL);
+
+  cardano_witness_set_t* data = (cardano_witness_set_t*)object;
+
+  cardano_vkey_witness_set_unref(&data->vkey_witnesses);
+  cardano_native_script_set_unref(&data->native_scripts);
+  cardano_bootstrap_witness_set_unref(&data->bootstrap_witnesses);
+  cardano_plutus_v1_script_set_unref(&data->plutus_v1_scripts);
+  cardano_plutus_data_set_unref(&data->plutus_data);
+  cardano_redeemer_list_unref(&data->redeemer);
+  cardano_plutus_v2_script_set_unref(&data->plutus_v2_scripts);
+  cardano_plutus_v3_script_set_unref(&data->plutus_v3_scripts);
+  cardano_plutus_v4_script_set_unref(&data->plutus_v4_scripts);
+
+  _cardano_free(object);
+}
+
+/**
+ * \brief Computes the map size of this witness set object.
+ *
+ * \param witness The witness set object to compute the map size for.
+ *
+ * \return The map size of the witness set object.
+ */
+static size_t
+get_map_size(const cardano_witness_set_t* witness)
+{
+  assert(witness != NULL);
+
+  size_t map_size = 0U;
+
+  if (cardano_vkey_witness_set_get_length(witness->vkey_witnesses) > 0U)
+  {
+    map_size += 1U;
+  }
+
+  if (cardano_native_script_set_get_length(witness->native_scripts) > 0U)
+  {
+    map_size += 1U;
+  }
+
+  if (cardano_bootstrap_witness_set_get_length(witness->bootstrap_witnesses) > 0U)
+  {
+    map_size += 1U;
+  }
+
+  if (cardano_plutus_v1_script_set_get_length(witness->plutus_v1_scripts) > 0U)
+  {
+    map_size += 1U;
+  }
+
+  if (cardano_plutus_data_set_get_length(witness->plutus_data) > 0U)
+  {
+    map_size += 1U;
+  }
+
+  if (cardano_redeemer_list_get_length(witness->redeemer) > 0U)
+  {
+    map_size += 1U;
+  }
+
+  if (cardano_plutus_v2_script_set_get_length(witness->plutus_v2_scripts) > 0U)
+  {
+    map_size += 1U;
+  }
+
+  if (cardano_plutus_v3_script_set_get_length(witness->plutus_v3_scripts) > 0U)
+  {
+    map_size += 1U;
+  }
+
+  if (cardano_plutus_v4_script_set_get_length(witness->plutus_v4_scripts) > 0U)
+  {
+    map_size += 1U;
+  }
+
+  return map_size;
+}
+
+/**
+ * \brief Retrieves a pointer to the specified field in the witness set witness object.
+ *
+ * This function returns a pointer to the field specified by the key in the given protocol
+ * parameter witness object. The key corresponds to different fields within the witness object.
+ * If the key does not correspond to any field, NULL is returned.
+ *
+ * \param[in] witness Pointer to the witness set witness object.
+ *
+ * \return void* A pointer to the specified field, or NULL if the key does not correspond to any field.
+ *
+ * \note The caller must ensure that the `cardano_witness_set_t` pointer is not NULL before calling this function.
+ */
+static void*
+get_field_ptr(cardano_witness_set_t* witness, size_t key)
+{
+  assert(witness != NULL);
+
+  switch (key)
+  {
+    case 0:
+      return (void*)&witness->vkey_witnesses;
+    case 1:
+      return (void*)&witness->native_scripts;
+    case 2:
+      return (void*)&witness->bootstrap_witnesses;
+    case 3:
+      return (void*)&witness->plutus_v1_scripts;
+    case 4:
+      return (void*)&witness->plutus_data;
+    case 5:
+      return (void*)&witness->redeemer;
+    case 6:
+      return (void*)&witness->plutus_v2_scripts;
+    case 7:
+      return (void*)&witness->plutus_v3_scripts;
+    case 8:
+      return (void*)&witness->plutus_v4_scripts;
+
+    default:
+      return NULL;
+  }
+}
+
+/**
+ * \brief Reads a cardano_vk_witness_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_vk_witness_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_vk_witness_set_t in the witness set witness.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_vk_witness_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_vk_witness_set_t value should be stored.
+ *                       The field pointer should be of type cardano_vk_witness_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_vk_witness_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_vk_witness_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_vkey_witness_set_t** field = (cardano_vkey_witness_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_vkey_witness_set_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_native_script_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_native_script_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_native_script_set_t in the witness set witness.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_native_script_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_native_script_set_t value should be stored.
+ *                       The field pointer should be of type cardano_native_script_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_native_script_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_native_script_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_native_script_set_t** field = (cardano_native_script_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_native_script_set_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_bootstrap_witness_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_bootstrap_witness_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_bootstrap_witness_set_t in the witness set witness.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_bootstrap_witness_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_bootstrap_witness_set_t value should be stored.
+ *                       The field pointer should be of type cardano_bootstrap_witness_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_bootstrap_witness_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_bootstrap_witness_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_bootstrap_witness_set_t** field = (cardano_bootstrap_witness_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_bootstrap_witness_set_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_plutus_v1_script_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_plutus_v1_script_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_plutus_v1_script_set_t in the witness set witness.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_plutus_v1_script_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_plutus_v1_script_set_t value should be stored.
+ *                       The field pointer should be of type cardano_plutus_v1_script_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_plutus_v1_script_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_plutus_v1_script_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_plutus_v1_script_set_t** field = (cardano_plutus_v1_script_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_plutus_v1_script_set_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_plutus_data_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_plutus_data_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_plutus_data_set_t in the witness set witness.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_plutus_data_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_plutus_data_set_t value should be stored.
+ *                       The field pointer should be of type cardano_plutus_data_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_plutus_data_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_plutus_data(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_plutus_data_set_t** field = (cardano_plutus_data_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_plutus_data_set_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_redeemer_list_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_redeemer_list_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_redeemer_list_t in the witness set witness.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_redeemer_list_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_redeemer_list_t value should be stored.
+ *                       The field pointer should be of type cardano_redeemer_list_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_redeemer_list_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_redeemer_list(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_redeemer_list_t** field = (cardano_redeemer_list_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_redeemer_list_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_plutus_v2_script_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_plutus_v2_script_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_plutus_v2_script_set_t in the witness set witness.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_plutus_v2_script_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_plutus_v2_script_set_t value should be stored.
+ *                       The field pointer should be of type cardano_plutus_v2_script_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_plutus_v2_script_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_plutus_v2_script_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_plutus_v2_script_set_t** field = (cardano_plutus_v2_script_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_plutus_v2_script_set_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_plutus_v3_script_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_plutus_v3_script_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_plutus_v3_script_set_t in the witness set witness.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_plutus_v3_script_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_plutus_v3_script_set_t value should be stored.
+ *                       The field pointer should be of type cardano_plutus_v3_script_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_plutus_v3_script_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_plutus_v3_script_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_plutus_v3_script_set_t** field = (cardano_plutus_v3_script_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_plutus_v3_script_set_from_cbor(reader, field);
+}
+
+/**
+ * \brief Reads a cardano_plutus_v4_script_set_t value from the CBOR reader and stores it in the specified field.
+ *
+ * This function reads a cardano_plutus_v4_script_set_t value from the provided CBOR reader and stores the result
+ * in the specified field pointer. It is used as a handler function for parameters that are
+ * represented as cardano_plutus_v4_script_set_t in the witness set witness.
+ *
+ * \param[in] reader A pointer to the CBOR reader from which to read the cardano_plutus_v4_script_set_t value.
+ * \param[out] field_ptr A pointer to the field where the read cardano_plutus_v4_script_set_t value should be stored.
+ *                       The field pointer should be of type cardano_plutus_v4_script_set_t*.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the cardano_plutus_v4_script_set_t value was successfully read and stored.
+ *         - An appropriate error code indicating the failure reason.
+ */
+static cardano_error_t
+handle_plutus_v4_script_set(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  assert(reader != NULL);
+  assert(field_ptr != NULL);
+
+  cardano_plutus_v4_script_set_t** field = (cardano_plutus_v4_script_set_t**)field_ptr;
+
+  if (*field != NULL)
+  {
+    return CARDANO_ERROR_DUPLICATED_CBOR_MAP_KEY;
+  }
+
+  return cardano_plutus_v4_script_set_from_cbor(reader, field);
+}
+
+/**
+ * \brief Handles an invalid key in the CBOR map during deserialization.
+ *
+ * This function is used as a handler for invalid keys encountered in the CBOR map.
+ * It does nothing with the provided reader and field pointer, and always returns
+ * \ref CARDANO_ERROR_INVALID_CBOR_MAP_KEY to indicate the error.
+ *
+ * \param[in] reader A pointer to the CBOR reader. This parameter is unused.
+ * \param[in] field_ptr A pointer to the field where the value should be stored. This parameter is unused.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - Always returns \ref CARDANO_ERROR_INVALID_CBOR_MAP_KEY.
+ */
+static cardano_error_t
+handle_invalid_key(cardano_cbor_reader_t* reader, void* field_ptr)
+{
+  CARDANO_UNUSED(reader);
+  CARDANO_UNUSED(field_ptr);
+
+  return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated vkey witness set value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the vkey witness set value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_vkey_witness_set_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_vkey_witness_set_t* value)
+{
+  assert(writer != NULL);
+
+  if ((value != NULL) && (cardano_vkey_witness_set_get_length(value) > 0U))
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_vkey_witness_set_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated native script value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the native script value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_native_script_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_native_script_set_t* value)
+{
+  assert(writer != NULL);
+
+  if ((value != NULL) && (cardano_native_script_set_get_length(value) > 0U))
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_native_script_set_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated bootstrap witness set value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the bootstrap witness set value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_bootstrap_witness_set_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_bootstrap_witness_set_t* value)
+{
+  assert(writer != NULL);
+
+  if ((value != NULL) && (cardano_bootstrap_witness_set_get_length(value) > 0U))
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_bootstrap_witness_set_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated plutus v1 script set value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the plutus v1 script set value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_plutus_v1_script_set_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_plutus_v1_script_set_t* value)
+{
+  assert(writer != NULL);
+
+  if ((value != NULL) && (cardano_plutus_v1_script_set_get_length(value) > 0U))
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_v1_script_set_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated plutus data value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the plutus data value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_plutus_data_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_plutus_data_set_t* value)
+{
+  assert(writer != NULL);
+
+  if ((value != NULL) && (cardano_plutus_data_set_get_length(value) > 0U))
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_data_set_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated redeemer list value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the redeemer list value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_redeemer_list_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_redeemer_list_t* value)
+{
+  assert(writer != NULL);
+
+  if ((value != NULL) && (cardano_redeemer_list_get_length(value) > 0U))
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_redeemer_list_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated plutus v2 script set value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the plutus v2 script set value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_plutus_v2_script_set_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_plutus_v2_script_set_t* value)
+{
+  assert(writer != NULL);
+
+  if ((value != NULL) && (cardano_plutus_v2_script_set_get_length(value) > 0U))
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_v2_script_set_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated plutus v3 script set value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the plutus v3 script set value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_plutus_v3_script_set_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_plutus_v3_script_set_t* value)
+{
+  assert(writer != NULL);
+
+  if ((value != NULL) && (cardano_plutus_v3_script_set_get_length(value) > 0U))
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_v3_script_set_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes a key-value pair to the CBOR writer if the value is present.
+ *
+ * This function writes a key and its associated plutus v4 script set value to the CBOR writer
+ * only if the value is not NULL. If the value is NULL, the function does nothing and
+ * returns \ref CARDANO_SUCCESS.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] key The key to be written to the CBOR map.
+ * \param[in] value A pointer to the plutus v4 script set value to be written. If NULL, nothing is written.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ *         - \ref CARDANO_SUCCESS if the key-value pair was successfully written or if the value is NULL.
+ *         - An appropriate error code indicating the failure reason if writing to the CBOR writer fails.
+ *
+ * \pre \p writer must not be NULL.
+ */
+static cardano_error_t
+write_plutus_v4_script_set_if_present(cardano_cbor_writer_t* writer, const uint64_t key, const cardano_plutus_v4_script_set_t* value)
+{
+  assert(writer != NULL);
+
+  if ((value != NULL) && (cardano_plutus_v4_script_set_get_length(value) > 0U))
+  {
+    cardano_error_t result = cardano_cbor_writer_write_uint(writer, key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+
+    result = cardano_plutus_v4_script_set_to_cbor(value, writer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+/**
+ * \brief Writes the witness set field identified by the given map key if it is present.
+ *
+ * \param[in] writer A pointer to the CBOR writer. Must not be NULL.
+ * \param[in] witness_set The witness set whose field is to be written.
+ * \param[in] key The witness set map key identifying the field to write.
+ *
+ * \return \ref cardano_error_t indicating the outcome of the operation.
+ */
+static cardano_error_t
+write_field_if_present(cardano_cbor_writer_t* writer, const cardano_witness_set_t* witness_set, const size_t key)
+{
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  switch (key)
+  {
+    case 0U:
+      result = write_vkey_witness_set_if_present(writer, 0U, witness_set->vkey_witnesses);
+      break;
+    case 1U:
+      result = write_native_script_if_present(writer, 1U, witness_set->native_scripts);
+      break;
+    case 2U:
+      result = write_bootstrap_witness_set_if_present(writer, 2U, witness_set->bootstrap_witnesses);
+      break;
+    case 3U:
+      result = write_plutus_v1_script_set_if_present(writer, 3U, witness_set->plutus_v1_scripts);
+      break;
+    case 4U:
+      result = write_plutus_data_if_present(writer, 4U, witness_set->plutus_data);
+      break;
+    case 5U:
+      result = write_redeemer_list_if_present(writer, 5U, witness_set->redeemer);
+      break;
+    case 6U:
+      result = write_plutus_v2_script_set_if_present(writer, 6U, witness_set->plutus_v2_scripts);
+      break;
+    case 7U:
+      result = write_plutus_v3_script_set_if_present(writer, 7U, witness_set->plutus_v3_scripts);
+      break;
+    case 8U:
+      result = write_plutus_v4_script_set_if_present(writer, 8U, witness_set->plutus_v4_scripts);
+      break;
+    default:
+      result = CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+      break;
+  }
+
+  return result;
+}
+
+/**
+ * \brief Resets the serialization key order of the witness set to the canonical ascending order.
+ *
+ * \param witness_set The witness set object whose key order will be reset.
+ */
+static void
+reset_key_order(cardano_witness_set_t* witness_set)
+{
+  assert(witness_set != NULL);
+
+  for (size_t i = 0U; i < WITNESS_SET_FIELD_COUNT; ++i)
+  {
+    witness_set->key_order[i] = i;
+  }
+}
+
+/**
+ * \brief Allocates and initializes a new cardano_witness_set_t structure.
+ *
+ * \param witness_set A pointer to the location where the new cardano_witness_set_t structure should be stored.
+ * \return The pointer to the newly allocated cardano_witness_set_t structure.
+ */
+static cardano_witness_set_t*
+create_witness_set_new(void)
+{
+  cardano_witness_set_t* witness_set = (cardano_witness_set_t*)_cardano_malloc(sizeof(cardano_witness_set_t));
+
+  if (witness_set == NULL)
+  {
+    return NULL;
+  }
+
+  witness_set->base.deallocator    = cardano_witness_set_deallocate;
+  witness_set->base.ref_count      = 1;
+  witness_set->base.last_error[0]  = '\0';
+  witness_set->vkey_witnesses      = NULL;
+  witness_set->native_scripts      = NULL;
+  witness_set->bootstrap_witnesses = NULL;
+  witness_set->plutus_v1_scripts   = NULL;
+  witness_set->plutus_data         = NULL;
+  witness_set->redeemer            = NULL;
+  witness_set->plutus_v2_scripts   = NULL;
+  witness_set->plutus_v3_scripts   = NULL;
+  witness_set->plutus_v4_scripts   = NULL;
+
+  reset_key_order(witness_set);
+
+  return witness_set;
+}
+
+/* STATIC CONSTANTS ***********************************************************/
+
+// cppcheck-suppress misra-c2012-8.9; Reason: Is more readable to define the map here
+static const param_handler_t param_handlers[] = {
+  handle_vk_witness_set,
+  handle_native_script_set,
+  handle_bootstrap_witness_set,
+  handle_plutus_v1_script_set,
+  handle_plutus_data,
+  handle_redeemer_list,
+  handle_plutus_v2_script_set,
+  handle_plutus_v3_script_set,
+  handle_plutus_v4_script_set
+};
+
+/* DEFINITIONS ****************************************************************/
+
+cardano_error_t
+cardano_witness_set_new(cardano_witness_set_t** witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *witness_set = create_witness_set_new();
+
+  if (*witness_set == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_witness_set_from_cbor(cardano_cbor_reader_t* reader, cardano_witness_set_t** witness_set)
+{
+  if (!reader || !witness_set)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *witness_set                   = NULL;
+  cardano_witness_set_t* witness = create_witness_set_new();
+
+  if (witness == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  int64_t         map_size = 0;
+  cardano_error_t result   = cardano_cbor_reader_read_start_map(reader, &map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    cardano_witness_set_unref(&witness);
+
+    return result;
+  }
+
+  bool   seen_keys[WITNESS_SET_FIELD_COUNT];
+  size_t order_index = 0U;
+
+  (void)memset(seen_keys, 0, sizeof(seen_keys));
+
+  for (size_t i = 0U; i < (size_t)map_size; ++i)
+  {
+    uint64_t key = 0;
+    result       = cardano_cbor_reader_read_uint(reader, &key);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_witness_set_unref(&witness);
+
+      return result;
+    }
+
+    if (key >= WITNESS_SET_FIELD_COUNT)
+    {
+      cardano_witness_set_unref(&witness);
+
+      return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+    }
+
+    if (!seen_keys[key])
+    {
+      seen_keys[key]                  = true;
+      witness->key_order[order_index] = (size_t)key;
+      order_index                     += 1U;
+    }
+
+    void* field_ptr = get_field_ptr(witness, key);
+
+    if (field_ptr == NULL)
+    {
+      cardano_witness_set_unref(&witness);
+
+      return CARDANO_ERROR_INVALID_CBOR_MAP_KEY;
+    }
+
+    result = param_handlers[key](reader, field_ptr);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      cardano_witness_set_unref(&witness);
+
+      return result;
+    }
+  }
+
+  for (size_t key = 0U; key < WITNESS_SET_FIELD_COUNT; ++key)
+  {
+    if (!seen_keys[key])
+    {
+      witness->key_order[order_index] = key;
+      order_index                     += 1U;
+    }
+  }
+
+  *witness_set = witness;
+
+  return cardano_cbor_validate_end_map("witness_set", reader);
+}
+
+cardano_error_t
+cardano_witness_set_to_cbor(const cardano_witness_set_t* witness_set, cardano_cbor_writer_t* writer)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (writer == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  const size_t map_size = get_map_size(witness_set);
+
+  cardano_error_t result = cardano_cbor_writer_write_start_map(writer, (int64_t)map_size);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  for (size_t i = 0U; i < WITNESS_SET_FIELD_COUNT; ++i)
+  {
+    result = write_field_if_present(writer, witness_set, witness_set->key_order[i]);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      return result;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_error_t
+cardano_witness_set_to_cip116_json(
+  const cardano_witness_set_t* witness_set,
+  cardano_json_writer_t*       writer)
+{
+  if ((witness_set == NULL) || (writer == NULL))
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_json_writer_write_start_object(writer);
+  cardano_error_t error = CARDANO_SUCCESS;
+
+  if ((witness_set->vkey_witnesses != NULL) && (cardano_vkey_witness_set_get_length(witness_set->vkey_witnesses) > 0U))
+  {
+    cardano_json_writer_write_property_name(writer, "vkey_witnesses", 14);
+    error = cardano_vkey_witness_set_to_cip116_json(witness_set->vkey_witnesses, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if ((witness_set->native_scripts != NULL) && (cardano_native_script_set_get_length(witness_set->native_scripts) > 0U))
+  {
+    cardano_json_writer_write_property_name(writer, "native_scripts", 14);
+    error = cardano_native_script_set_to_cip116_json(witness_set->native_scripts, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if ((witness_set->bootstrap_witnesses != NULL) && (cardano_bootstrap_witness_set_get_length(witness_set->bootstrap_witnesses) > 0U))
+  {
+    cardano_json_writer_write_property_name(writer, "bootstraps", 10);
+    error = cardano_bootstrap_witness_set_to_cip116_json(witness_set->bootstrap_witnesses, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_plutus_v1_script_set_t* plutus_v1_scripts = witness_set->plutus_v1_scripts;
+  cardano_plutus_v2_script_set_t* plutus_v2_scripts = witness_set->plutus_v2_scripts;
+  cardano_plutus_v3_script_set_t* plutus_v3_scripts = witness_set->plutus_v3_scripts;
+  cardano_plutus_v4_script_set_t* plutus_v4_scripts = witness_set->plutus_v4_scripts;
+  const bool                      hash_plutus_v1    = (plutus_v1_scripts != NULL) && (cardano_plutus_v1_script_set_get_length(plutus_v1_scripts) > 0U);
+  const bool                      hash_plutus_v2    = (plutus_v2_scripts != NULL) && (cardano_plutus_v2_script_set_get_length(plutus_v2_scripts) > 0U);
+  const bool                      hash_plutus_v3    = (plutus_v3_scripts != NULL) && (cardano_plutus_v3_script_set_get_length(plutus_v3_scripts) > 0U);
+  const bool                      hash_plutus_v4    = (plutus_v4_scripts != NULL) && (cardano_plutus_v4_script_set_get_length(plutus_v4_scripts) > 0U);
+
+  if (hash_plutus_v1 || hash_plutus_v2 || hash_plutus_v3 || hash_plutus_v4)
+  {
+    cardano_json_writer_write_property_name(writer, "plutus_scripts", 14);
+    cardano_json_writer_write_start_array(writer);
+
+    if (hash_plutus_v1)
+    {
+      const size_t length = cardano_plutus_v1_script_set_get_length(plutus_v1_scripts);
+
+      for (size_t i = 0U; i < length; ++i)
+      {
+        cardano_plutus_v1_script_t* script = NULL;
+        error                              = cardano_plutus_v1_script_set_get(plutus_v1_scripts, i, &script);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+
+        error = cardano_plutus_v1_script_to_cip116_json(script, writer);
+        cardano_plutus_v1_script_unref(&script);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+      }
+    }
+
+    if (hash_plutus_v2)
+    {
+      const size_t length = cardano_plutus_v2_script_set_get_length(plutus_v2_scripts);
+
+      for (size_t i = 0U; i < length; ++i)
+      {
+        cardano_plutus_v2_script_t* script = NULL;
+        error                              = cardano_plutus_v2_script_set_get(plutus_v2_scripts, i, &script);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+
+        error = cardano_plutus_v2_script_to_cip116_json(script, writer);
+        cardano_plutus_v2_script_unref(&script);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+      }
+    }
+
+    if (hash_plutus_v3)
+    {
+      const size_t length = cardano_plutus_v3_script_set_get_length(plutus_v3_scripts);
+
+      for (size_t i = 0U; i < length; ++i)
+      {
+        cardano_plutus_v3_script_t* script = NULL;
+        error                              = cardano_plutus_v3_script_set_get(plutus_v3_scripts, i, &script);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+
+        error = cardano_plutus_v3_script_to_cip116_json(script, writer);
+        cardano_plutus_v3_script_unref(&script);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+      }
+    }
+
+    if (hash_plutus_v4)
+    {
+      const size_t length = cardano_plutus_v4_script_set_get_length(plutus_v4_scripts);
+
+      for (size_t i = 0U; i < length; ++i)
+      {
+        cardano_plutus_v4_script_t* script = NULL;
+        error                              = cardano_plutus_v4_script_set_get(plutus_v4_scripts, i, &script);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+
+        error = cardano_plutus_v4_script_to_cip116_json(script, writer);
+        cardano_plutus_v4_script_unref(&script);
+
+        if (error != CARDANO_SUCCESS)
+        {
+          return error;
+        }
+      }
+    }
+
+    cardano_json_writer_write_end_array(writer);
+  }
+
+  if ((witness_set->plutus_data != NULL) && (cardano_plutus_data_set_get_length(witness_set->plutus_data) > 0U))
+  {
+    cardano_json_writer_write_property_name(writer, "plutus_data", 11);
+    error = cardano_plutus_data_set_to_cip116_json(witness_set->plutus_data, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  if ((witness_set->redeemer != NULL) && (cardano_redeemer_list_get_length(witness_set->redeemer) > 0U))
+  {
+    cardano_json_writer_write_property_name(writer, "redeemers", 9);
+    error = cardano_redeemer_list_to_cip116_json(witness_set->redeemer, writer);
+
+    if (error != CARDANO_SUCCESS)
+    {
+      return error;
+    }
+  }
+
+  cardano_json_writer_write_end_object(writer);
+
+  return error;
+}
+
+cardano_vkey_witness_set_t*
+cardano_witness_set_get_vkeys(cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_vkey_witness_set_ref(witness_set->vkey_witnesses);
+
+  return witness_set->vkey_witnesses;
+}
+
+cardano_error_t
+cardano_witness_set_set_vkeys(
+  cardano_witness_set_t*      witness_set,
+  cardano_vkey_witness_set_t* vkeys)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (vkeys == NULL)
+  {
+    cardano_vkey_witness_set_unref(&witness_set->vkey_witnesses);
+    witness_set->vkey_witnesses = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_vkey_witness_set_ref(vkeys);
+  cardano_vkey_witness_set_unref(&witness_set->vkey_witnesses);
+  witness_set->vkey_witnesses = vkeys;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_bootstrap_witness_set_t*
+cardano_witness_set_get_bootstrap(cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_bootstrap_witness_set_ref(witness_set->bootstrap_witnesses);
+
+  return witness_set->bootstrap_witnesses;
+}
+
+cardano_error_t
+cardano_witness_set_set_bootstrap(
+  cardano_witness_set_t*           witness_set,
+  cardano_bootstrap_witness_set_t* bootstraps)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (bootstraps == NULL)
+  {
+    cardano_bootstrap_witness_set_unref(&witness_set->bootstrap_witnesses);
+    witness_set->bootstrap_witnesses = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_bootstrap_witness_set_ref(bootstraps);
+  cardano_bootstrap_witness_set_unref(&witness_set->bootstrap_witnesses);
+  witness_set->bootstrap_witnesses = bootstraps;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_native_script_set_t*
+cardano_witness_set_get_native_scripts(cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_native_script_set_ref(witness_set->native_scripts);
+
+  return witness_set->native_scripts;
+}
+
+cardano_error_t
+cardano_witness_set_set_native_scripts(
+  cardano_witness_set_t*       witness_set,
+  cardano_native_script_set_t* native_scripts)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (native_scripts == NULL)
+  {
+    cardano_native_script_set_unref(&witness_set->native_scripts);
+    witness_set->native_scripts = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_native_script_set_ref(native_scripts);
+  cardano_native_script_set_unref(&witness_set->native_scripts);
+  witness_set->native_scripts = native_scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_plutus_v1_script_set_t*
+cardano_witness_set_get_plutus_v1_scripts(cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_plutus_v1_script_set_ref(witness_set->plutus_v1_scripts);
+
+  return witness_set->plutus_v1_scripts;
+}
+
+cardano_error_t
+cardano_witness_set_set_plutus_v1_scripts(
+  cardano_witness_set_t*          witness_set,
+  cardano_plutus_v1_script_set_t* plutus_scripts)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_scripts == NULL)
+  {
+    cardano_plutus_v1_script_set_unref(&witness_set->plutus_v1_scripts);
+    witness_set->plutus_v1_scripts = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_plutus_v1_script_set_ref(plutus_scripts);
+  cardano_plutus_v1_script_set_unref(&witness_set->plutus_v1_scripts);
+  witness_set->plutus_v1_scripts = plutus_scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_plutus_v2_script_set_t*
+cardano_witness_set_get_plutus_v2_scripts(cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_plutus_v2_script_set_ref(witness_set->plutus_v2_scripts);
+
+  return witness_set->plutus_v2_scripts;
+}
+
+cardano_error_t
+cardano_witness_set_set_plutus_v2_scripts(
+  cardano_witness_set_t*          witness_set,
+  cardano_plutus_v2_script_set_t* plutus_scripts)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_scripts == NULL)
+  {
+    cardano_plutus_v2_script_set_unref(&witness_set->plutus_v2_scripts);
+    witness_set->plutus_v2_scripts = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_plutus_v2_script_set_ref(plutus_scripts);
+  cardano_plutus_v2_script_set_unref(&witness_set->plutus_v2_scripts);
+  witness_set->plutus_v2_scripts = plutus_scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_plutus_v3_script_set_t*
+cardano_witness_set_get_plutus_v3_scripts(cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_plutus_v3_script_set_ref(witness_set->plutus_v3_scripts);
+
+  return witness_set->plutus_v3_scripts;
+}
+
+cardano_error_t
+cardano_witness_set_set_plutus_v3_scripts(
+  cardano_witness_set_t*          witness_set,
+  cardano_plutus_v3_script_set_t* plutus_scripts)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_scripts == NULL)
+  {
+    cardano_plutus_v3_script_set_unref(&witness_set->plutus_v3_scripts);
+    witness_set->plutus_v3_scripts = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_plutus_v3_script_set_ref(plutus_scripts);
+  cardano_plutus_v3_script_set_unref(&witness_set->plutus_v3_scripts);
+  witness_set->plutus_v3_scripts = plutus_scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_plutus_v4_script_set_t*
+cardano_witness_set_get_plutus_v4_scripts(cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_plutus_v4_script_set_ref(witness_set->plutus_v4_scripts);
+
+  return witness_set->plutus_v4_scripts;
+}
+
+cardano_error_t
+cardano_witness_set_set_plutus_v4_scripts(
+  cardano_witness_set_t*          witness_set,
+  cardano_plutus_v4_script_set_t* plutus_scripts)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_scripts == NULL)
+  {
+    cardano_plutus_v4_script_set_unref(&witness_set->plutus_v4_scripts);
+    witness_set->plutus_v4_scripts = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_plutus_v4_script_set_ref(plutus_scripts);
+  cardano_plutus_v4_script_set_unref(&witness_set->plutus_v4_scripts);
+  witness_set->plutus_v4_scripts = plutus_scripts;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_plutus_data_set_t*
+cardano_witness_set_get_plutus_data(cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_plutus_data_set_ref(witness_set->plutus_data);
+
+  return witness_set->plutus_data;
+}
+
+cardano_error_t
+cardano_witness_set_set_plutus_data(
+  cardano_witness_set_t*     witness_set,
+  cardano_plutus_data_set_t* plutus_data)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (plutus_data == NULL)
+  {
+    cardano_plutus_data_set_unref(&witness_set->plutus_data);
+    witness_set->plutus_data = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_plutus_data_set_ref(plutus_data);
+  cardano_plutus_data_set_unref(&witness_set->plutus_data);
+  witness_set->plutus_data = plutus_data;
+
+  return CARDANO_SUCCESS;
+}
+
+cardano_redeemer_list_t*
+cardano_witness_set_get_redeemers(cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return NULL;
+  }
+
+  cardano_redeemer_list_ref(witness_set->redeemer);
+
+  return witness_set->redeemer;
+}
+
+cardano_error_t
+cardano_witness_set_set_redeemers(
+  cardano_witness_set_t*   witness_set,
+  cardano_redeemer_list_t* redeemers)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (redeemers == NULL)
+  {
+    cardano_redeemer_list_unref(&witness_set->redeemer);
+    witness_set->redeemer = NULL;
+
+    return CARDANO_SUCCESS;
+  }
+
+  cardano_redeemer_list_ref(redeemers);
+  cardano_redeemer_list_unref(&witness_set->redeemer);
+  witness_set->redeemer = redeemers;
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_witness_set_clear_cbor_cache(cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return;
+  }
+
+  reset_key_order(witness_set);
+
+  cardano_plutus_data_set_clear_cbor_cache(witness_set->plutus_data);
+  cardano_redeemer_list_clear_cbor_cache(witness_set->redeemer);
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  result = cardano_plutus_data_set_set_use_tag(witness_set->plutus_data, true);
+  CARDANO_UNUSED(result);
+
+  cardano_vkey_witness_set_clear_cbor_cache(witness_set->vkey_witnesses);
+  cardano_bootstrap_witness_set_clear_cbor_cache(witness_set->bootstrap_witnesses);
+
+  result = cardano_native_script_set_set_use_tag(witness_set->native_scripts, true);
+  CARDANO_UNUSED(result);
+
+  result = cardano_plutus_v1_script_set_set_use_tag(witness_set->plutus_v1_scripts, true);
+  CARDANO_UNUSED(result);
+
+  result = cardano_plutus_v2_script_set_set_use_tag(witness_set->plutus_v2_scripts, true);
+  CARDANO_UNUSED(result);
+
+  result = cardano_plutus_v3_script_set_set_use_tag(witness_set->plutus_v3_scripts, true);
+  CARDANO_UNUSED(result);
+
+  result = cardano_plutus_v4_script_set_set_use_tag(witness_set->plutus_v4_scripts, true);
+  CARDANO_UNUSED(result);
+}
+
+cardano_error_t
+cardano_witness_set_add_script(cardano_witness_set_t* witness_set, cardano_script_t* script)
+{
+  if (witness_set == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  if (script == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_error_t result = CARDANO_SUCCESS;
+
+  cardano_script_language_t language;
+
+  result = cardano_script_get_language(script, &language);
+
+  if (result != CARDANO_SUCCESS)
+  {
+    return result;
+  }
+
+  switch (language)
+  {
+    case CARDANO_SCRIPT_LANGUAGE_NATIVE:
+    {
+      cardano_native_script_set_t* scripts = cardano_witness_set_get_native_scripts(witness_set);
+
+      if (scripts == NULL)
+      {
+        result = cardano_native_script_set_new(&scripts);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = cardano_witness_set_set_native_scripts(witness_set, scripts);
+
+        assert(result == CARDANO_SUCCESS);
+        CARDANO_UNUSED(result);
+      }
+
+      cardano_native_script_set_unref(&scripts);
+
+      cardano_native_script_t* native_script = NULL;
+
+      result = cardano_script_to_native(script, &native_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_native_script_set_add(scripts, native_script);
+      cardano_native_script_unref(&native_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V1:
+    {
+      cardano_plutus_v1_script_set_t* scripts = cardano_witness_set_get_plutus_v1_scripts(witness_set);
+
+      if (scripts == NULL)
+      {
+        result = cardano_plutus_v1_script_set_new(&scripts);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = cardano_witness_set_set_plutus_v1_scripts(witness_set, scripts);
+
+        assert(result == CARDANO_SUCCESS);
+        CARDANO_UNUSED(result);
+      }
+
+      cardano_plutus_v1_script_set_unref(&scripts);
+
+      cardano_plutus_v1_script_t* plutus_v1_script = NULL;
+
+      result = cardano_script_to_plutus_v1(script, &plutus_v1_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_plutus_v1_script_set_add(scripts, plutus_v1_script);
+      cardano_plutus_v1_script_unref(&plutus_v1_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V2:
+    {
+      cardano_plutus_v2_script_set_t* scripts = cardano_witness_set_get_plutus_v2_scripts(witness_set);
+
+      if (scripts == NULL)
+      {
+        result = cardano_plutus_v2_script_set_new(&scripts);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = cardano_witness_set_set_plutus_v2_scripts(witness_set, scripts);
+
+        assert(result == CARDANO_SUCCESS);
+        CARDANO_UNUSED(result);
+      }
+
+      cardano_plutus_v2_script_set_unref(&scripts);
+
+      cardano_plutus_v2_script_t* plutus_v2_script = NULL;
+
+      result = cardano_script_to_plutus_v2(script, &plutus_v2_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_plutus_v2_script_set_add(scripts, plutus_v2_script);
+      cardano_plutus_v2_script_unref(&plutus_v2_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V3:
+    {
+      cardano_plutus_v3_script_set_t* scripts = cardano_witness_set_get_plutus_v3_scripts(witness_set);
+
+      if (scripts == NULL)
+      {
+        result = cardano_plutus_v3_script_set_new(&scripts);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = cardano_witness_set_set_plutus_v3_scripts(witness_set, scripts);
+
+        assert(result == CARDANO_SUCCESS);
+        CARDANO_UNUSED(result);
+      }
+
+      cardano_plutus_v3_script_set_unref(&scripts);
+
+      cardano_plutus_v3_script_t* plutus_v3_script = NULL;
+
+      result = cardano_script_to_plutus_v3(script, &plutus_v3_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_plutus_v3_script_set_add(scripts, plutus_v3_script);
+      cardano_plutus_v3_script_unref(&plutus_v3_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    case CARDANO_SCRIPT_LANGUAGE_PLUTUS_V4:
+    {
+      cardano_plutus_v4_script_set_t* scripts = cardano_witness_set_get_plutus_v4_scripts(witness_set);
+
+      if (scripts == NULL)
+      {
+        result = cardano_plutus_v4_script_set_new(&scripts);
+
+        if (result != CARDANO_SUCCESS)
+        {
+          return result;
+        }
+
+        result = cardano_witness_set_set_plutus_v4_scripts(witness_set, scripts);
+
+        assert(result == CARDANO_SUCCESS);
+        CARDANO_UNUSED(result);
+      }
+
+      cardano_plutus_v4_script_set_unref(&scripts);
+
+      cardano_plutus_v4_script_t* plutus_v4_script = NULL;
+
+      result = cardano_script_to_plutus_v4(script, &plutus_v4_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      result = cardano_plutus_v4_script_set_add(scripts, plutus_v4_script);
+      cardano_plutus_v4_script_unref(&plutus_v4_script);
+
+      if (result != CARDANO_SUCCESS)
+      {
+        return result;
+      }
+
+      break;
+    }
+    default:
+    {
+      return CARDANO_ERROR_INVALID_SCRIPT_LANGUAGE;
+    }
+  }
+
+  return CARDANO_SUCCESS;
+}
+
+void
+cardano_witness_set_unref(cardano_witness_set_t** witness_set)
+{
+  if ((witness_set == NULL) || (*witness_set == NULL))
+  {
+    return;
+  }
+
+  cardano_object_t* object = &(*witness_set)->base;
+  cardano_object_unref(&object);
+
+  if (object == NULL)
+  {
+    *witness_set = NULL;
+    return;
+  }
+}
+
+void
+cardano_witness_set_ref(cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return;
+  }
+
+  cardano_object_ref(&witness_set->base);
+}
+
+size_t
+cardano_witness_set_refcount(const cardano_witness_set_t* witness_set)
+{
+  if (witness_set == NULL)
+  {
+    return 0;
+  }
+
+  return cardano_object_refcount(&witness_set->base);
+}
+
+void
+cardano_witness_set_set_last_error(cardano_witness_set_t* witness_set, const char* message)
+{
+  cardano_object_set_last_error(&witness_set->base, message);
+}
+
+const char*
+cardano_witness_set_get_last_error(const cardano_witness_set_t* witness_set)
+{
+  return cardano_object_get_last_error(&witness_set->base);
+}
+
+cardano_error_t
+cardano_witness_set_deep_clone(const cardano_witness_set_t* source, cardano_witness_set_t** clone)
+{
+  if (clone == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  *clone = NULL;
+
+  if (source == NULL)
+  {
+    return CARDANO_ERROR_POINTER_IS_NULL;
+  }
+
+  cardano_witness_set_t* copy = _cardano_malloc(sizeof(cardano_witness_set_t));
+
+  if (copy == NULL)
+  {
+    return CARDANO_ERROR_MEMORY_ALLOCATION_FAILED;
+  }
+
+  copy->base.ref_count      = 1U;
+  copy->base.deallocator    = source->base.deallocator;
+  copy->base.last_error[0]  = '\0';
+  copy->vkey_witnesses      = NULL;
+  copy->native_scripts      = NULL;
+  copy->bootstrap_witnesses = NULL;
+  copy->plutus_v1_scripts   = NULL;
+  copy->plutus_data         = NULL;
+  copy->redeemer            = NULL;
+  copy->plutus_v2_scripts   = NULL;
+  copy->plutus_v3_scripts   = NULL;
+  copy->plutus_v4_scripts   = NULL;
+  CARDANO_UNUSED(memcpy(copy->key_order, source->key_order, sizeof(copy->key_order)));
+
+  if (source->vkey_witnesses != NULL)
+  {
+    const cardano_error_t result = cardano_vkey_witness_set_deep_clone(source->vkey_witnesses, &copy->vkey_witnesses);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->native_scripts != NULL)
+  {
+    const cardano_error_t result = cardano_native_script_set_deep_clone(source->native_scripts, &copy->native_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->bootstrap_witnesses != NULL)
+  {
+    const cardano_error_t result = cardano_bootstrap_witness_set_deep_clone(source->bootstrap_witnesses, &copy->bootstrap_witnesses);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v1_scripts != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v1_script_set_deep_clone(source->plutus_v1_scripts, &copy->plutus_v1_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_data != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_data_set_deep_clone(source->plutus_data, &copy->plutus_data);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->redeemer != NULL)
+  {
+    const cardano_error_t result = cardano_redeemer_list_deep_clone(source->redeemer, &copy->redeemer);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v2_scripts != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v2_script_set_deep_clone(source->plutus_v2_scripts, &copy->plutus_v2_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v3_scripts != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v3_script_set_deep_clone(source->plutus_v3_scripts, &copy->plutus_v3_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  if (source->plutus_v4_scripts != NULL)
+  {
+    const cardano_error_t result = cardano_plutus_v4_script_set_deep_clone(source->plutus_v4_scripts, &copy->plutus_v4_scripts);
+
+    if (result != CARDANO_SUCCESS)
+    {
+      copy->base.deallocator(copy);
+      return result;
+    }
+  }
+
+  *clone = copy;
+
+  return CARDANO_SUCCESS;
+}
